[Pkg-virtualbox-commits] [virtualbox] 01/03: Imported Upstream version 5.0.0~beta4-dfsg

Gianfranco Costamagna locutusofborg-guest at moszumanska.debian.org
Tue May 19 08:36:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

locutusofborg-guest pushed a commit to branch experimental
in repository virtualbox.

commit c2756dd2bf7a0b00d82343959d5b53eb83d8bd28
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date:   Tue May 19 10:05:20 2015 +0200

    Imported Upstream version 5.0.0~beta4-dfsg
---
 .scm-settings                                      |    16 +-
 Config.kmk                                         |   712 +-
 Maintenance.kmk                                    |    52 +
 Makefile.kmk                                       |   340 +-
 configure                                          |   195 +-
 configure.vbs                                      |     4 +-
 doc/VBox-CodingGuidelines.cpp                      |    16 +
 doc/VBox-doc.c                                     |     4 +-
 doc/manual/Makefile.kmk                            |    12 +-
 doc/manual/en_US/SDKRef.xml                        |   577 +-
 doc/manual/en_US/images/dnd-modes.png              |   Bin 0 -> 84541 bytes
 doc/manual/en_US/images/vbox-components.png        |   Bin 183580 -> 178225 bytes
 doc/manual/en_US/user_AdvancedTopics.xml           |   384 +-
 doc/manual/en_US/user_BasicConcepts.xml            |   166 +-
 doc/manual/en_US/user_Frontends.xml                |    35 +-
 doc/manual/en_US/user_Glossary.xml                 |     9 +
 doc/manual/en_US/user_GuestAdditions.xml           |   112 +
 doc/manual/en_US/user_Installation.xml             |    48 +-
 doc/manual/en_US/user_Introduction.xml             |    63 +-
 doc/manual/en_US/user_KnownIssues.xml              |    17 +-
 doc/manual/en_US/user_Networking.xml               |     9 +-
 doc/manual/en_US/user_Storage.xml                  |    39 +-
 doc/manual/en_US/user_Technical.xml                |    47 +-
 doc/manual/en_US/user_Troubleshooting.xml          |    26 +-
 doc/manual/en_US/user_VBoxManage.xml               |   452 +-
 doc/manual/fr_FR/UserManual.xml                    |     6 +
 doc/manual/fr_FR/images/dnd-modes.png              |   Bin 0 -> 84541 bytes
 doc/manual/fr_FR/images/vbox-components.png        |   Bin 183580 -> 178225 bytes
 doc/manual/fr_FR/user_AdvancedTopics.xml           |   314 +-
 doc/manual/fr_FR/user_BasicConcepts.xml            |   132 +-
 doc/manual/fr_FR/user_ChangeLog.xml                |  1122 +-
 doc/manual/fr_FR/user_Frontends.xml                |   107 +-
 doc/manual/fr_FR/user_Glossary.xml                 |   272 +-
 doc/manual/fr_FR/user_GuestAdditions.xml           |   238 +-
 doc/manual/fr_FR/user_Installation.xml             |    54 +-
 doc/manual/fr_FR/user_Introduction.xml             |   255 +-
 doc/manual/fr_FR/user_KnownIssues.xml              |    54 +-
 doc/manual/fr_FR/user_Networking.xml               |   123 +-
 doc/manual/fr_FR/user_Security.xml                 |    32 +-
 doc/manual/fr_FR/user_Storage.xml                  |   112 +-
 doc/manual/fr_FR/user_Technical.xml                |   133 +-
 doc/manual/fr_FR/user_ThirdParty.xml               |    20 +-
 doc/manual/fr_FR/user_Troubleshooting.xml          |   157 +-
 doc/manual/fr_FR/user_VBoxManage.xml               |   317 +-
 doc/manual/fr_FR/user_VirtualBoxAPI.xml            |     4 +-
 doc/manual/user_ChangeLogImpl.xml                  |   134 +-
 include/VBox/GuestHost/DragAndDrop.h               |   199 +
 include/VBox/HGSMI/HGSMI.h                         |   264 +-
 include/VBox/HGSMI/HGSMIDefs.h                     |   123 +
 include/VBox/HGSMI/HGSMIMemAlloc.h                 |   100 +
 include/VBox/Hardware/VBoxVideoVBE.h               |     2 +-
 include/VBox/HostServices/DragAndDropSvc.h         |   565 +-
 include/VBox/HostServices/Service.h                |    65 +-
 include/VBox/HostServices/VBoxCrOpenGLSvc.h        |    15 +
 include/VBox/RemoteDesktop/VRDE.h                  |    10 +-
 include/VBox/VBoxGuest.h                           |    17 +-
 include/VBox/VBoxGuestLib.h                        |    81 +-
 include/VBox/VBoxNetCfg-win.h                      |     6 +-
 include/VBox/VBoxOGL.h                             |    56 +
 include/VBox/VBoxOGLTest.h                         |    37 -
 include/VBox/VBoxTpG.h                             |     2 +
 include/VBox/VBoxVideo3D.h                         |     3 +-
 include/VBox/VBoxVideoGuest.h                      |     3 +-
 include/VBox/VMMDev.h                              |    21 +-
 include/VBox/apic.h                                |     4 +
 include/VBox/apic.mac                              |     4 +
 include/VBox/com/ErrorInfo.h                       |     4 +-
 include/VBox/com/Guid.h                            |   370 +-
 include/VBox/com/array.h                           |    52 +-
 include/VBox/com/ptr.h                             |     9 +
 include/VBox/com/string.h                          |    17 +-
 include/VBox/dbg.h                                 |    56 +-
 include/VBox/dbggui.h                              |    11 +-
 include/VBox/dbus-calls.h                          |     2 +
 include/VBox/dbus.h                                |     2 +-
 include/VBox/dis.h                                 |    91 +-
 include/VBox/disopcode.h                           |  1528 +-
 include/VBox/err.h                                 |   275 +-
 include/VBox/err.mac                               |    52 +-
 include/VBox/hgcmsvc.h                             |    28 +-
 include/VBox/intnet.h                              |    80 +-
 include/VBox/log.h                                 |    47 +-
 include/VBox/ostypes.h                             |     1 +
 include/VBox/param.h                               |     5 +-
 include/VBox/settings.h                            |    56 +-
 include/VBox/shflsvc.h                             |     2 +-
 include/VBox/sup.h                                 |   460 +-
 include/VBox/sup.mac                               |    24 +-
 include/VBox/types.h                               |     6 +-
 include/VBox/usb.h                                 |     2 +
 include/VBox/vd-filter-backend.h                   |     3 +-
 include/VBox/vd-ifs.h                              |   151 +-
 include/VBox/vd-image-backend.h                    |     4 +-
 include/VBox/vd.h                                  |    38 +-
 include/VBox/version.h                             |    68 +-
 include/VBox/vmm/cfgm.h                            |     4 +-
 include/VBox/vmm/cpum.h                            |   778 +-
 include/VBox/vmm/cpum.mac                          |    60 +-
 include/VBox/vmm/cpumctx.h                         |    68 +-
 include/VBox/vmm/csam.h                            |     5 +-
 include/VBox/vmm/dbgf.h                            |   110 +-
 include/VBox/vmm/em.h                              |     7 +-
 include/VBox/vmm/ftm.h                             |     3 +-
 include/VBox/vmm/gim.h                             |   185 +
 include/VBox/vmm/gmm.h                             |     3 +-
 include/VBox/vmm/gvm.h                             |     4 +-
 include/VBox/vmm/hm.h                              |    75 +-
 include/VBox/vmm/hm_svm.h                          |   154 +-
 include/VBox/vmm/hm_vmx.h                          |   458 +-
 include/VBox/vmm/iem.h                             |    22 +-
 include/VBox/vmm/iom.h                             |     8 +-
 include/VBox/vmm/mm.h                              |    25 +-
 include/VBox/vmm/patm.h                            |    28 +-
 include/VBox/vmm/pdmapi.h                          |     6 +-
 include/VBox/vmm/pdmaudioifs.h                     |   680 +
 include/VBox/vmm/pdmdev.h                          |    53 +-
 include/VBox/vmm/pdmdrv.h                          |    13 +-
 include/VBox/vmm/pdmifs.h                          |    87 +-
 include/VBox/vmm/pdmqueue.h                        |     1 +
 include/VBox/vmm/pdmusb.h                          |    47 +-
 include/VBox/vmm/pgm.h                             |   293 +-
 include/VBox/vmm/rem.h                             |    15 +-
 include/VBox/vmm/selm.h                            |     3 +-
 include/VBox/vmm/ssm.h                             |    75 +-
 include/VBox/vmm/stam.h                            |     1 -
 include/VBox/vmm/tm.h                              |    14 +-
 include/VBox/vmm/trpm.h                            |     7 +-
 include/VBox/vmm/uvm.h                             |    10 +-
 include/VBox/vmm/vm.h                              |    80 +-
 include/VBox/vmm/vm.mac                            |    18 +-
 include/VBox/vmm/vmcpuset.h                        |     2 +-
 include/VBox/vmm/vmm.h                             |    35 +-
 include/VBox/vscsi.h                               |     2 +
 include/VBox/vusb.h                                |   221 +-
 include/iprt/alloca.h                              |     4 +-
 include/iprt/asm-amd64-x86.h                       |   176 +-
 include/iprt/asm-math.h                            |    50 +-
 include/iprt/asm.h                                 |    88 +-
 include/iprt/asmdefs.mac                           |    37 +
 include/iprt/asn1-generator-sanity.h               |     1 -
 include/iprt/assert.h                              |   253 +-
 include/iprt/avl.h                                 |     2 +-
 include/iprt/cdefs.h                               |    17 +-
 include/iprt/cdrom.h                               |     5 +-
 include/iprt/cpp/list.h                            |     2 +-
 include/iprt/cpp/ministring.h                      |    62 +-
 include/iprt/cpp/utils.h                           |     4 +-
 include/iprt/cpuset.h                              |    46 +
 include/iprt/crc.h                                 |    39 +
 include/iprt/crypto/rsa.h                          |     1 -
 include/iprt/crypto/tsp.h                          |     1 -
 include/iprt/dbg.h                                 |    29 +-
 include/iprt/dir.h                                 |     8 +-
 include/iprt/env.h                                 |   133 +-
 include/iprt/err.h                                 |   118 +-
 include/iprt/err.mac                               |    16 +
 include/iprt/file.h                                |    81 +-
 include/iprt/filesystem.h                          |     6 +-
 include/iprt/ldr.h                                 |     1 +
 include/iprt/linux/sysfs.h                         |    36 +-
 include/iprt/list-off32.h                          |   502 +
 include/iprt/localipc.h                            |    17 +-
 include/iprt/log.h                                 |     6 +-
 include/iprt/mangling.h                            |   147 +-
 include/iprt/mem.h                                 |    85 -
 include/iprt/mp.h                                  |    98 +-
 include/iprt/net.h                                 |    52 +-
 include/iprt/nt/nt.h                               |   270 +-
 include/iprt/path.h                                |    31 +-
 include/iprt/queueatomic.h                         |     5 +-
 include/iprt/socket.h                              |     4 +-
 include/iprt/spinlock.h                            |     5 +-
 include/iprt/stream.h                              |    20 +
 include/iprt/string.h                              |     5 -
 include/iprt/tar.h                                 |   319 +-
 include/iprt/tcp.h                                 |     2 +-
 include/iprt/test.h                                |    38 +-
 include/iprt/thread.h                              |   116 +-
 include/iprt/time.h                                |   108 +-
 include/iprt/timer.h                               |    12 +-
 include/iprt/types.h                               |    35 +-
 include/iprt/uint128.h                             |     4 +-
 include/iprt/uri.h                                 |     9 +-
 include/iprt/vfs.h                                 |     2 +-
 include/iprt/vfslowlevel.h                         |     2 +-
 include/iprt/x509-branch-collision.h               |    81 +
 include/iprt/x86.h                                 |   597 +-
 include/iprt/x86.mac                               |   104 +-
 include/iprt/zip.h                                 |    15 -
 src/Makefile.kmk                                   |     3 -
 src/VBox/Additions/Makefile.kmk                    |     4 +-
 src/VBox/Additions/common/Makefile.kmk             |     4 +-
 .../Additions/common/VBoxControl/VBoxControl.cpp   |   106 +-
 .../Additions/common/VBoxControl/VBoxControl.rc    |    25 +-
 .../common/VBoxControl/testcase/tstVBoxControl.cpp |     7 +
 src/VBox/Additions/common/VBoxGuest/Makefile.kmk   |     8 +-
 .../Additions/common/VBoxGuest/VBoxDev-haiku.c     |    10 +-
 .../common/VBoxGuest/VBoxGuest-darwin.cpp          |   159 +-
 .../Additions/common/VBoxGuest/VBoxGuest-freebsd.c |    32 +-
 .../common/VBoxGuest/VBoxGuest-haiku-stubs.c       |   172 +-
 .../Additions/common/VBoxGuest/VBoxGuest-haiku.c   |    28 +-
 .../Additions/common/VBoxGuest/VBoxGuest-haiku.h   |     8 +-
 .../Additions/common/VBoxGuest/VBoxGuest-linux.c   |    83 +-
 .../Additions/common/VBoxGuest/VBoxGuest-os2.cpp   |    34 +-
 .../Additions/common/VBoxGuest/VBoxGuest-solaris.c |    57 +-
 .../common/VBoxGuest/VBoxGuest-win-legacy.cpp      |     2 +-
 .../common/VBoxGuest/VBoxGuest-win-pnp.cpp         |     6 +-
 .../Additions/common/VBoxGuest/VBoxGuest-win.cpp   |    36 +-
 .../Additions/common/VBoxGuest/VBoxGuest-win.h     |     2 +-
 src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp  |  2343 +-
 src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp |   142 -
 src/VBox/Additions/common/VBoxGuest/VBoxGuest2.h   |    40 -
 .../Additions/common/VBoxGuest/VBoxGuestA-os2.asm  |     2 +-
 .../common/VBoxGuest/VBoxGuestIDC-unix.c.h         |    12 +-
 .../Additions/common/VBoxGuest/VBoxGuestInternal.h |   134 +-
 .../Additions/common/VBoxGuest/freebsd/Makefile    |     6 +-
 .../common/VBoxGuest/freebsd/files_vboxguest       |     4 +-
 src/VBox/Additions/common/VBoxGuest/linux/Makefile |     8 +-
 .../common/VBoxGuest/linux/files_vboxguest         |     8 +-
 .../Additions/common/VBoxGuest/win/VBoxGuest.rc    |    25 +-
 .../common/VBoxGuestLib/GenericRequest.cpp         |    14 +-
 src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp    |     2 +-
 .../Additions/common/VBoxGuestLib/HGCMInternal.cpp |     4 +-
 src/VBox/Additions/common/VBoxGuestLib/Init.cpp    |     2 +-
 .../Additions/common/VBoxGuestLib/Makefile.kmk     |     4 +-
 src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp   |     2 +-
 .../Additions/common/VBoxGuestLib/PhysHeap.cpp     |     2 +-
 src/VBox/Additions/common/VBoxGuestLib/SysHlp.cpp  |     2 +-
 src/VBox/Additions/common/VBoxGuestLib/SysHlp.h    |     2 +-
 .../Additions/common/VBoxGuestLib/VBGLInternal.h   |     2 +-
 .../Additions/common/VBoxGuestLib/VBoxGuestLog.h   |     1 +
 .../common/VBoxGuestLib/VBoxGuestR0LibCrOgl.cpp    |     1 +
 .../common/VBoxGuestLib/VBoxGuestR0LibCrOgl.h      |     1 +
 .../VBoxGuestLib/VBoxGuestR0LibSharedFolders.c     |     2 +-
 .../VBoxGuestLib/VBoxGuestR0LibSharedFolders.h     |     1 +
 .../VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp     |  1426 +-
 .../common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp    |     2 +-
 src/VBox/Additions/common/VBoxGuestLib/VMMDev.cpp  |     1 +
 .../VBoxGuestLib/VbglR0CanUsePhysPageList.cpp      |     2 +-
 src/VBox/Additions/common/VBoxService/Makefile.kmk |     3 -
 .../common/VBoxService/VBoxService-win.rc          |    25 +-
 .../Additions/common/VBoxService/VBoxService.cpp   |    23 +-
 .../common/VBoxService/VBoxServiceControl.cpp      |    54 +-
 .../VBoxService/VBoxServiceControlProcess.cpp      |     2 +
 .../VBoxService/VBoxServiceControlSession.cpp      |   176 +-
 .../common/VBoxService/VBoxServiceToolBox.cpp      |    77 +-
 .../common/VBoxService/VBoxServiceVMInfo-win.cpp   |     9 -
 .../common/VBoxService/VBoxServiceVMInfo.cpp       |   343 +-
 src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp  |     9 +-
 src/VBox/Additions/common/crOpenGL/Makefile.kmk    |    22 +-
 src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc    |    26 +-
 .../Additions/common/crOpenGL/array/arrayspu.rc    |    27 +-
 src/VBox/Additions/common/crOpenGL/context.c       |    15 +-
 .../common/crOpenGL/feedback/feedbackspu.rc        |    27 +-
 src/VBox/Additions/common/crOpenGL/icd_drv.c       |    64 +-
 src/VBox/Additions/common/crOpenGL/load.c          |     8 +
 src/VBox/Additions/common/crOpenGL/pack/packspu.rc |    25 +-
 .../common/crOpenGL/pack/packspu_context.c         |    45 +-
 .../Additions/common/crOpenGL/pack/packspu_init.c  |    10 +-
 .../common/crOpenGL/passthrough/passthroughspu.rc  |    25 +-
 src/VBox/Additions/common/crOpenGL/stub.c          |     2 +-
 src/VBox/Additions/common/crOpenGL/stub.h          |     2 +-
 src/VBox/Additions/common/crOpenGL/wgl.c           |    13 +-
 .../Additions/freebsd/vboxvfs/vboxvfs_vfsops.c     |     4 +-
 .../haiku/VBoxVideo/accelerant/Makefile.kmk        |     2 +-
 src/VBox/Additions/linux/Makefile.kmk              |     1 -
 src/VBox/Additions/linux/drm/Makefile.kmk          |    13 +-
 src/VBox/Additions/linux/drm/Makefile.module.kms   |     5 +-
 src/VBox/Additions/linux/drm/files_vboxvideo_drv   |     4 +
 src/VBox/Additions/linux/drm/vbox_drv.c            |   106 +-
 src/VBox/Additions/linux/drm/vbox_drv.h            |   161 +-
 src/VBox/Additions/linux/drm/vbox_fb.c             |   484 +
 src/VBox/Additions/linux/drm/vbox_main.c           |   533 +
 src/VBox/Additions/linux/drm/vbox_mode.c           |   727 +
 src/VBox/Additions/linux/drm/vbox_ttm.c            |   513 +
 src/VBox/Additions/linux/drm/vboxvideo_drm.c       |    70 +-
 src/VBox/Additions/linux/installer/vboxadd-x11.sh  |     7 +-
 src/VBox/Additions/linux/installer/vboxadd.sh      |     2 +-
 .../linux/lightdm-greeter/vbox-greeter.cpp         |     2 +
 src/VBox/Additions/solaris/DRM/vboxvideo_drm.c     |     1 -
 src/VBox/Additions/solaris/Makefile.kmk            |     2 +-
 src/VBox/Additions/solaris/Mouse/vboxmslnk.c       |     3 +-
 .../Additions/solaris/SharedFolders/Makefile.kmk   |     4 +-
 .../Additions/solaris/SharedFolders/vboxfs_prov.h  |     2 +-
 .../Additions/solaris/SharedFolders/vboxfs_vfs.c   |     2 +-
 .../Additions/solaris/SharedFolders/vboxfs_vnode.c |     6 +
 src/VBox/Additions/x11/VBoxClient/Makefile.kmk     |    12 +-
 src/VBox/Additions/x11/VBoxClient/VBoxClient.h     |     1 +
 src/VBox/Additions/x11/VBoxClient/display.cpp      |     4 +-
 src/VBox/Additions/x11/VBoxClient/draganddrop.cpp  |  2756 ++-
 src/VBox/Additions/x11/VBoxClient/hostversion.cpp  |     5 +-
 src/VBox/Additions/x11/VBoxClient/main.cpp         |    27 +-
 src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp |     1 +
 src/VBox/Additions/x11/VBoxClient/seamless-x11.h   |     1 +
 src/VBox/Additions/x11/VBoxClient/seamless.cpp     |     3 +-
 src/VBox/Additions/x11/VBoxClient/seamless.h       |     5 +-
 .../VBoxClient/testcase/tstSeamlessX11-auto.cpp    |     1 +
 .../x11/VBoxClient/testcase/tstSeamlessX11.cpp     |     1 +
 src/VBox/Additions/x11/undefined_xorg              |     2 +-
 src/VBox/Additions/x11/vboxmouse/vboxmouse.c       |     1 +
 src/VBox/Additions/x11/vboxvideo/Makefile.kmk      |     1 +
 src/VBox/Additions/x11/vboxvideo/pointer.c         |     1 +
 src/VBox/Additions/x11/vboxvideo/undefined         |   216 -
 src/VBox/Additions/x11/vboxvideo/vboxvideo.c       |     4 +
 src/VBox/Additions/x11/vboxvideo/vboxvideo.h       |     3 +-
 src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c   |     2 +-
 src/VBox/Additions/x11/vboxvideo/vbva.c            |    22 +-
 src/VBox/Debugger/DBGCCmdHlp.cpp                   |     2 +-
 src/VBox/Debugger/DBGCCommands.cpp                 |   488 +-
 src/VBox/Debugger/DBGCEmulateCodeView.cpp          |     8 +-
 src/VBox/Debugger/DBGCInternal.h                   |    29 +-
 src/VBox/Debugger/DBGCPlugInDiggers.rc             |    50 -
 src/VBox/Debugger/DBGConsole.cpp                   |     5 +-
 src/VBox/Debugger/DBGPlugInDarwin.cpp              |   474 +-
 src/VBox/Debugger/DBGPlugInDiggers.cpp             |    10 +-
 src/VBox/Debugger/DBGPlugInLinux.cpp               |  1001 +-
 src/VBox/Debugger/Makefile.kmk                     |    25 +-
 src/VBox/Debugger/VBoxDbg.cpp                      |     5 +
 src/VBox/Debugger/VBoxDbg.rc                       |    50 -
 src/VBox/Debugger/VBoxDbgConsole.cpp               |     2 +-
 src/VBox/Debugger/VBoxDbgConsole.h                 |     2 +-
 src/VBox/Debugger/VBoxDbgStatsQt4.cpp              |    39 +-
 src/VBox/Debugger/VBoxDbgStatsQt4.h                |     8 +
 src/VBox/Debugger/testcase/tstDBGCStubs.cpp        |    16 +
 src/VBox/Devices/Audio/AudioMixBuffer.cpp          |  1486 ++
 src/VBox/Devices/Audio/AudioMixBuffer.h            |    79 +
 src/VBox/Devices/Audio/AudioMixer.cpp              |   476 +
 src/VBox/Devices/Audio/AudioMixer.h                |   111 +
 src/VBox/Devices/Audio/DevIchAc97.cpp              |  1684 +-
 src/VBox/Devices/Audio/DevIchHda.cpp               |  2778 ++-
 src/VBox/Devices/Audio/DevIchHdaCodec.cpp          |   335 +-
 src/VBox/Devices/Audio/DevIchHdaCodec.h            |    83 +-
 src/VBox/Devices/Audio/DevSB16.cpp                 |  2967 +--
 src/VBox/Devices/Audio/DrvAudio.cpp                |  1947 ++
 src/VBox/Devices/Audio/DrvAudio.h                  |   200 +
 src/VBox/Devices/Audio/DrvAudioCommon.cpp          |   486 +
 src/VBox/Devices/Audio/DrvHostALSAAudio.cpp        |  1399 ++
 src/VBox/Devices/Audio/DrvHostCoreAudio.cpp        |  2076 ++
 src/VBox/Devices/Audio/DrvHostDSound.cpp           |  1685 ++
 src/VBox/Devices/Audio/DrvHostNullAudio.cpp        |   318 +
 src/VBox/Devices/Audio/DrvHostOSSAudio.cpp         |   997 +
 src/VBox/Devices/Audio/DrvHostPulseAudio.cpp       |  1226 ++
 src/VBox/Devices/Audio/audio.c                     |     2 +-
 src/VBox/Devices/Audio/coreaudio.c                 |    28 +-
 src/VBox/Devices/Audio/dsound_template.h           |   108 +-
 src/VBox/Devices/Audio/dsoundaudio.c               |   724 +-
 src/VBox/Devices/Audio/mixeng.c                    |    31 +-
 src/VBox/Devices/Audio/mixeng.h                    |    10 +-
 src/VBox/Devices/Audio/mixeng_template.h           |    27 +
 src/VBox/Devices/Audio/pulseaudio.c                |     6 +-
 src/VBox/Devices/Audio/testcase/Makefile.kmk       |    41 +
 .../Devices/Audio/testcase/tstAudioMixBuffer.cpp   |   592 +
 .../BiosCommonCode/MakeAlternativeSource.cpp       |    57 +-
 src/VBox/Devices/BiosCommonCode/Makefile.kmk       |     2 +-
 src/VBox/Devices/Bus/DevPCI.cpp                    |     4 +-
 src/VBox/Devices/Bus/DevPciIch9.cpp                |   272 +-
 src/VBox/Devices/Bus/SrvPciRawR0.cpp               |     8 +-
 src/VBox/Devices/EFI/DevEFI.cpp                    |    21 +-
 src/VBox/Devices/EFI/DevEFI.h                      |     2 +-
 src/VBox/Devices/EFI/DevSmc.cpp                    |    10 +-
 .../EFI/Firmware/MdePkg/Include/Uefi/UefiSpec.h    |    14 +
 .../OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c   |     4 +-
 .../Firmware/VBoxPkg/VBoxAppleSim/VBoxAppleSim.c   |   202 +-
 .../Firmware/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c  |     2 +-
 src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxPkg.dec  |     1 +
 .../Firmware/VBoxPkg/VBoxVgaDxe/ComponentName.c    |     4 +-
 .../EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.c      |    19 +-
 .../EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf |     7 +-
 .../VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c     |     2 +-
 src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd      |   Bin 1048576 -> 1048576 bytes
 src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd      |   Bin 1048576 -> 1048576 bytes
 src/VBox/Devices/GIMDev/GIMDev.cpp                 |   227 +
 src/VBox/Devices/Graphics/BIOS/Makefile.kmk        |     4 +-
 .../Graphics/BIOS/VBoxVgaBiosAlternative.asm       |  2536 +--
 .../Graphics/BIOS/VBoxVgaBiosAlternative.md5sum    |     2 +-
 src/VBox/Devices/Graphics/BIOS/vbe.c               |     2 +-
 src/VBox/Devices/Graphics/BIOS/vberom.asm          |     2 +
 src/VBox/Devices/Graphics/BIOS/vgabios.c           |    66 +-
 src/VBox/Devices/Graphics/DevVGA-SVGA.cpp          |   116 +-
 src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m    |     4 +-
 src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp    |     4 +-
 src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp |    27 +-
 src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h   |    11 +-
 src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp    |     1 +
 src/VBox/Devices/Graphics/DevVGA.cpp               |   376 +-
 src/VBox/Devices/Graphics/DevVGA.h                 |    32 +-
 src/VBox/Devices/Graphics/DevVGATmpl.h             |   122 +-
 src/VBox/Devices/Graphics/DevVGA_VBVA.cpp          |   121 +-
 src/VBox/Devices/Graphics/DevVGA_VDMA.cpp          |   100 +-
 src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp      |  1091 +-
 src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h        |    37 +-
 src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.cpp   |    80 -
 src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.h     |   112 -
 src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.cpp     |     1 +
 src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.h       |     1 +
 src/VBox/Devices/Graphics/VBoxSVGA3D.rc            |    50 -
 src/VBox/Devices/Input/DevPS2.cpp                  |   208 +-
 src/VBox/Devices/Input/DrvKeyboardQueue.cpp        |   181 +-
 src/VBox/Devices/Input/DrvMouseQueue.cpp           |    14 +
 src/VBox/Devices/Input/PS2Dev.h                    |     2 +
 src/VBox/Devices/Input/PS2K.cpp                    |   173 +-
 src/VBox/Devices/Input/PS2M.cpp                    |   390 +-
 src/VBox/Devices/Input/UsbKbd.cpp                  |   417 +-
 src/VBox/Devices/Input/UsbMouse.cpp                |     1 +
 src/VBox/Devices/Input/testcase/tstUsbMouse.cpp    |     1 -
 src/VBox/Devices/Makefile.kmk                      |   276 +-
 src/VBox/Devices/Network/DevE1000.cpp              |    69 +-
 src/VBox/Devices/Network/DevINIP.cpp               |   175 +-
 src/VBox/Devices/Network/DevPCNet.cpp              |    85 +-
 src/VBox/Devices/Network/DrvNAT.cpp                |    12 +-
 src/VBox/Devices/Network/DrvTAP.cpp                |    24 +-
 src/VBox/Devices/Network/SrvIntNetR0.cpp           |   519 +-
 .../Devices/Network/lwip-new/vbox/VBoxLwipCore.cpp |    10 +-
 .../Devices/Network/lwip-new/vbox/VBoxLwipCore.h   |     2 +-
 .../Network/lwip-new/vbox/include/arch/cc.h        |     2 +-
 .../Network/lwip-new/vbox/include/lwip-namespace.h |     2 +-
 src/VBox/Devices/Network/lwip-new/vbox/sys_arch.c  |     2 +-
 src/VBox/Devices/Network/lwip/CHANGELOG            |   680 -
 src/VBox/Devices/Network/lwip/COPYING              |    33 -
 src/VBox/Devices/Network/lwip/FILES                |     4 -
 src/VBox/Devices/Network/lwip/Makefile.kmk         |    49 -
 src/VBox/Devices/Network/lwip/README               |    74 -
 src/VBox/Devices/Network/lwip/README.vbox          |     1 -
 src/VBox/Devices/Network/lwip/doc/FILES            |     5 -
 src/VBox/Devices/Network/lwip/doc/contrib.txt      |    62 -
 src/VBox/Devices/Network/lwip/doc/rawapi.txt       |   419 -
 src/VBox/Devices/Network/lwip/doc/savannah.txt     |   135 -
 src/VBox/Devices/Network/lwip/doc/snmp_agent.txt   |   172 -
 src/VBox/Devices/Network/lwip/doc/sys_arch.txt     |   201 -
 src/VBox/Devices/Network/lwip/src/FILES            |    13 -
 src/VBox/Devices/Network/lwip/src/api/api_lib.c    |   722 -
 src/VBox/Devices/Network/lwip/src/api/api_msg.c    |   807 -
 src/VBox/Devices/Network/lwip/src/api/err.c        |    59 -
 src/VBox/Devices/Network/lwip/src/api/sockets.c    |  1367 --
 src/VBox/Devices/Network/lwip/src/api/tcpip.c      |   224 -
 src/VBox/Devices/Network/lwip/src/core/dhcp.c      |  1464 --
 src/VBox/Devices/Network/lwip/src/core/inet.c      |   537 -
 src/VBox/Devices/Network/lwip/src/core/inet6.c     |   168 -
 src/VBox/Devices/Network/lwip/src/core/ipv4/icmp.c |   202 -
 src/VBox/Devices/Network/lwip/src/core/ipv4/ip.c   |   516 -
 .../Devices/Network/lwip/src/core/ipv4/ip_addr.c   |    78 -
 .../Devices/Network/lwip/src/core/ipv4/ip_frag.c   |   388 -
 src/VBox/Devices/Network/lwip/src/core/ipv6/README |     1 -
 .../Devices/Network/lwip/src/core/ipv6/icmp6.c     |   184 -
 src/VBox/Devices/Network/lwip/src/core/ipv6/ip6.c  |   386 -
 .../Devices/Network/lwip/src/core/ipv6/ip6_addr.c  |    90 -
 src/VBox/Devices/Network/lwip/src/core/mem.c       |   414 -
 src/VBox/Devices/Network/lwip/src/core/memp.c      |   238 -
 src/VBox/Devices/Network/lwip/src/core/netif.c     |   325 -
 src/VBox/Devices/Network/lwip/src/core/pbuf.c      |   961 -
 src/VBox/Devices/Network/lwip/src/core/raw.c       |   326 -
 .../Devices/Network/lwip/src/core/snmp/asn1_dec.c  |   652 -
 .../Devices/Network/lwip/src/core/snmp/asn1_enc.c  |   610 -
 src/VBox/Devices/Network/lwip/src/core/snmp/mib2.c |  4021 ----
 .../Network/lwip/src/core/snmp/mib_structs.c       |  1185 -
 .../Devices/Network/lwip/src/core/snmp/msg_in.c    |  1458 --
 .../Devices/Network/lwip/src/core/snmp/msg_out.c   |   687 -
 src/VBox/Devices/Network/lwip/src/core/stats.c     |   115 -
 src/VBox/Devices/Network/lwip/src/core/sys.c       |   294 -
 src/VBox/Devices/Network/lwip/src/core/tcp.c       |  1182 -
 src/VBox/Devices/Network/lwip/src/core/tcp_in.c    |  1209 -
 src/VBox/Devices/Network/lwip/src/core/tcp_out.c   |   727 -
 src/VBox/Devices/Network/lwip/src/core/udp.c       |   661 -
 .../Network/lwip/src/include/ipv4/lwip/icmp.h      |   112 -
 .../Network/lwip/src/include/ipv4/lwip/inet.h      |    99 -
 .../Network/lwip/src/include/ipv4/lwip/ip.h        |   154 -
 .../Network/lwip/src/include/ipv4/lwip/ip_addr.h   |   160 -
 .../Network/lwip/src/include/ipv4/lwip/ip_frag.h   |    49 -
 .../Network/lwip/src/include/ipv6/lwip/icmp.h      |    90 -
 .../Network/lwip/src/include/ipv6/lwip/inet.h      |    62 -
 .../Network/lwip/src/include/ipv6/lwip/ip.h        |    96 -
 .../Network/lwip/src/include/ipv6/lwip/ip_addr.h   |    59 -
 .../Devices/Network/lwip/src/include/lwip/api.h    |   159 -
 .../Network/lwip/src/include/lwip/api_msg.h        |    94 -
 .../Devices/Network/lwip/src/include/lwip/arch.h   |   216 -
 .../Devices/Network/lwip/src/include/lwip/debug.h  |    87 -
 .../Devices/Network/lwip/src/include/lwip/def.h    |    47 -
 .../Devices/Network/lwip/src/include/lwip/dhcp.h   |   223 -
 .../Devices/Network/lwip/src/include/lwip/err.h    |    70 -
 .../Devices/Network/lwip/src/include/lwip/mem.h    |    69 -
 .../Devices/Network/lwip/src/include/lwip/memp.h   |    63 -
 .../Devices/Network/lwip/src/include/lwip/netif.h  |   165 -
 .../Devices/Network/lwip/src/include/lwip/opt.h    |   722 -
 .../Devices/Network/lwip/src/include/lwip/pbuf.h   |   113 -
 .../Devices/Network/lwip/src/include/lwip/raw.h    |    74 -
 .../Devices/Network/lwip/src/include/lwip/sio.h    |    63 -
 .../Devices/Network/lwip/src/include/lwip/snmp.h   |   309 -
 .../Network/lwip/src/include/lwip/snmp_asn1.h      |    90 -
 .../Network/lwip/src/include/lwip/snmp_msg.h       |   292 -
 .../Network/lwip/src/include/lwip/snmp_structs.h   |   253 -
 .../Network/lwip/src/include/lwip/sockets.h        |   271 -
 .../Devices/Network/lwip/src/include/lwip/stats.h  |   158 -
 .../Devices/Network/lwip/src/include/lwip/sys.h    |   187 -
 .../Devices/Network/lwip/src/include/lwip/tcp.h    |   531 -
 .../Devices/Network/lwip/src/include/lwip/tcpip.h  |    75 -
 .../Devices/Network/lwip/src/include/lwip/udp.h    |   106 -
 .../Network/lwip/src/include/netif/etharp.h        |   129 -
 .../Network/lwip/src/include/netif/loopif.h        |    39 -
 .../Network/lwip/src/include/netif/slipif.h        |    42 -
 src/VBox/Devices/Network/lwip/src/netif/FILES      |    27 -
 src/VBox/Devices/Network/lwip/src/netif/etharp.c   |   892 -
 .../Devices/Network/lwip/src/netif/ethernetif.c    |   326 -
 src/VBox/Devices/Network/lwip/src/netif/loopif.c   |   119 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/auth.c |   927 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/auth.h |    94 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/chap.c |   872 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/chap.h |   167 -
 .../Devices/Network/lwip/src/netif/ppp/chpms.c     |   398 -
 .../Devices/Network/lwip/src/netif/ppp/chpms.h     |    64 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.c  |   838 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.h  |   187 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.c |  1377 --
 src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.h |   126 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.c  |  1991 --
 src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.h  |   169 -
 .../Devices/Network/lwip/src/netif/ppp/magic.c     |    79 -
 .../Devices/Network/lwip/src/netif/ppp/magic.h     |    64 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/md5.c  |   306 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/md5.h  |    55 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/pap.c  |   608 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/pap.h  |   129 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/ppp.c  |  1631 --
 src/VBox/Devices/Network/lwip/src/netif/ppp/ppp.h  |   446 -
 .../Devices/Network/lwip/src/netif/ppp/pppdebug.h  |    89 -
 .../Devices/Network/lwip/src/netif/ppp/randm.c     |   242 -
 .../Devices/Network/lwip/src/netif/ppp/randm.h     |    81 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/vj.c   |   633 -
 src/VBox/Devices/Network/lwip/src/netif/ppp/vj.h   |   155 -
 .../Devices/Network/lwip/src/netif/ppp/vjbsdhdr.h  |    76 -
 src/VBox/Devices/Network/lwip/src/netif/slipif.c   |   213 -
 .../Network/lwip/vbox/include/arch/bpstruct.h      |     1 -
 .../Devices/Network/lwip/vbox/include/arch/cc.h    |    48 -
 .../Network/lwip/vbox/include/arch/epstruct.h      |     1 -
 .../Devices/Network/lwip/vbox/include/arch/perf.h  |     7 -
 .../Network/lwip/vbox/include/arch/sys_arch.h      |    33 -
 .../Devices/Network/lwip/vbox/include/lwipopts.h   |   300 -
 src/VBox/Devices/Network/lwip/vbox/sys_arch.c      |   445 -
 src/VBox/Devices/Network/lwipopts.h                |     8 +-
 .../Devices/Network/scripts/VBoxPortForwarding.py  |    24 +-
 src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h      |     2 +-
 src/VBox/Devices/Network/slirp/debug.c             |    10 +-
 src/VBox/Devices/Network/slirp/ip_icmp.c           |   220 +-
 src/VBox/Devices/Network/slirp/ip_icmp.h           |     5 +-
 .../Devices/Network/slirp/libalias/alias_mod.c     |    24 +-
 .../Devices/Network/slirp/resolv_conf_parser.c     |     4 +
 src/VBox/Devices/Network/slirp/sbuf.c              |    82 -
 src/VBox/Devices/Network/slirp/sbuf.h              |    10 -
 src/VBox/Devices/Network/slirp/slirp.c             |    15 +-
 src/VBox/Devices/Network/slirp/slirp_dns.c         |     2 +-
 src/VBox/Devices/Network/slirp/slirp_state.h       |     2 +
 src/VBox/Devices/Network/slirp/socket.c            |   147 +-
 src/VBox/Devices/Network/slirp/tcp_input.c         |    30 +-
 src/VBox/Devices/Network/slirp/tcp_output.c        |     4 -
 src/VBox/Devices/Network/slirp/tcp_subr.c          |     5 -
 src/VBox/Devices/Network/testcase/tstIntNet-1.cpp  |     2 +-
 src/VBox/Devices/PC/BIOS/Makefile.kmk              |     1 +
 src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm   |  6646 +++---
 .../Devices/PC/BIOS/VBoxBiosAlternative.md5sum     |     2 +-
 src/VBox/Devices/PC/BIOS/ahci.c                    |    46 +-
 src/VBox/Devices/PC/BIOS/biosint.h                 |     1 +
 src/VBox/Devices/PC/BIOS/floppy.c                  |   201 +-
 src/VBox/Devices/PC/BIOS/keyboard.c                |    15 +-
 src/VBox/Devices/PC/BIOS/makefile                  |     4 +-
 src/VBox/Devices/PC/BIOS/orgs.asm                  |   168 +-
 src/VBox/Devices/PC/BIOS/pcibios.c                 |     4 +-
 src/VBox/Devices/PC/BIOS/pmsetup.inc               |    22 +-
 src/VBox/Devices/PC/BIOS/post.c                    |   102 +
 src/VBox/Devices/PC/BIOS/scsi.c                    |    45 +-
 src/VBox/Devices/PC/DevACPI.cpp                    |    27 +-
 src/VBox/Devices/PC/DevAPIC.cpp                    |   108 +-
 src/VBox/Devices/PC/DevHPET.cpp                    |    44 +-
 src/VBox/Devices/PC/DevIoApic.cpp                  |     2 +-
 src/VBox/Devices/PC/DevPcBios.cpp                  |    29 +-
 src/VBox/Devices/PC/DevRTC.cpp                     |    29 +-
 src/VBox/Devices/PC/ipxe/iPxeBiosBin.rom           |   Bin 54272 -> 53248 bytes
 src/VBox/Devices/PC/ipxe/src/config/general.h      |     2 +-
 src/VBox/Devices/PC/vbox.dsl                       |     2 +-
 src/VBox/Devices/Serial/DevSerial.cpp              |    83 +-
 src/VBox/Devices/Serial/DrvTCP.cpp                 |   492 +
 src/VBox/Devices/Storage/DevAHCI.cpp               |   608 +-
 src/VBox/Devices/Storage/DevATA.cpp                |     9 +-
 src/VBox/Devices/Storage/DevBusLogic.cpp           |    98 +-
 src/VBox/Devices/Storage/DevFdc.cpp                |   130 +-
 src/VBox/Devices/Storage/DrvBlock.cpp              |     2 +-
 src/VBox/Devices/Storage/DrvDiskIntegrity.cpp      |    10 -
 src/VBox/Devices/Storage/DrvHostFloppy.cpp         |     1 +
 src/VBox/Devices/Storage/DrvSCSIHost.cpp           |     6 +-
 src/VBox/Devices/Storage/DrvVD.cpp                 |   129 +-
 src/VBox/Devices/Storage/PIIX3ATABmDma.h           |     1 +
 src/VBox/Devices/Storage/UsbMsd.cpp                |   582 +-
 src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h     |    23 +-
 src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp     |     7 +-
 src/VBox/Devices/Storage/VSCSI/VSCSISense.cpp      |    16 +
 src/VBox/Devices/Storage/swab.h                    |     1 +
 src/VBox/Devices/USB/DevOHCI.cpp                   |   169 +-
 src/VBox/Devices/USB/DrvVUSBRootHub.cpp            |    65 +-
 src/VBox/Devices/USB/VUSBDevice.cpp                |    63 +-
 src/VBox/Devices/USB/VUSBInternal.h                |    17 +-
 src/VBox/Devices/USB/VUSBReadAhead.cpp             |     2 -
 src/VBox/Devices/USB/VUSBSniffer.cpp               |     1 +
 src/VBox/Devices/USB/VUSBUrb.cpp                   |    17 +
 .../Devices/USB/freebsd/USBProxyDevice-freebsd.cpp |    91 +-
 .../{Network/lwip => USB/usbip}/Makefile.kup       |     0
 .../Devices/USB/usbip/USBProxyDevice-usbip.cpp     |  1078 +
 src/VBox/Devices/VMMDev/VMMDev.cpp                 |   233 +-
 src/VBox/Devices/VMMDev/VMMDevHGCM.cpp             |    14 +-
 src/VBox/Devices/VMMDev/VMMDevState.h              |    21 +-
 src/VBox/Devices/build/VBoxDD.cpp                  |    55 +-
 src/VBox/Devices/build/VBoxDD.h                    |    27 +-
 src/VBox/Devices/build/VBoxDD.rc                   |    50 -
 src/VBox/Devices/build/VBoxDD2.rc                  |    50 -
 src/VBox/Devices/build/VBoxDDU.rc                  |    50 -
 src/VBox/Devices/testcase/Makefile.kmk             |     7 +-
 src/VBox/Devices/testcase/tstDeviceStructSize.cpp  |    24 +-
 .../Devices/testcase/tstDeviceStructSizeRC.cpp     |   169 +-
 src/VBox/Disassembler/DisasmCore.cpp               |   381 +-
 src/VBox/Disassembler/DisasmFormatYasm.cpp         |   154 +-
 src/VBox/Disassembler/DisasmInternal.h             |   124 +-
 src/VBox/Disassembler/DisasmTables.cpp             |  3673 +++-
 src/VBox/Disassembler/DisasmTablesX64.cpp          |     4 +-
 src/VBox/Disassembler/Makefile.kmk                 |    60 +-
 src/VBox/Disassembler/testcase/tstDisasm-1A.asm    |   195 +-
 src/VBox/ExtPacks/Makefile.kmk                     |     5 +-
 src/VBox/ExtPacks/VBoxDTrace/CDDL-ONLY             |     2 +
 src/VBox/ExtPacks/VBoxDTrace/COPYING               |   378 +
 src/VBox/ExtPacks/VBoxDTrace/ExtPack.xml           |     8 +
 src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk          |   349 +
 src/VBox/ExtPacks/VBoxDTrace/Samples/Hello.d       |    13 +
 src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceMain.cpp    |   137 +
 src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0.cpp      |  2135 ++
 src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0A.asm     |    32 +
 src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceWrapper.cpp |   202 +
 .../ExtPacks/VBoxDTrace/generated/dt_grammar.c     |  3358 +++
 .../ExtPacks/VBoxDTrace/generated/dt_grammar.h     |   284 +
 src/VBox/ExtPacks/VBoxDTrace/generated/dt_lex.c    |  3763 ++++
 .../VBoxDTrace/include/VBoxDTraceLibCWrappers.h    |    96 +
 .../ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h  |   465 +
 src/VBox/ExtPacks/VBoxDTrace/onnv/COPYING          |   378 +
 .../VBox/ExtPacks/VBoxDTrace/onnv/Makefile.kup     |     0
 .../VBoxDTrace/onnv/cmd}/Makefile.kup              |     0
 .../ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile   |    57 +
 .../VBoxDTrace/onnv/cmd/dtrace/Makefile.com        |    57 +
 .../VBoxDTrace/onnv/cmd/dtrace}/Makefile.kup       |     0
 .../VBoxDTrace/onnv/cmd/dtrace/amd64/Makefile      |    32 +
 .../VBoxDTrace/onnv/cmd/dtrace/amd64}/Makefile.kup |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/Makefile       |   167 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo}/Makefile.kup  |     0
 .../onnv/cmd/dtrace/demo/act}/Makefile.kup         |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/act/time.d     |    44 +
 .../onnv/cmd/dtrace/demo/agg}/Makefile.kup         |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/agg/clear.d    |    45 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/agg/dateprof.d |    52 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/agg/denorm.d   |    51 +
 .../onnv/cmd/dtrace/demo/agg/lquantize.d           |    30 +
 .../onnv/cmd/dtrace/demo/agg/normalize.d           |    49 +
 .../onnv/cmd/dtrace/demo/agg/renormalize.d         |    43 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/agg/trunc.d    |    46 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/agg/writes.d   |    30 +
 .../onnv/cmd/dtrace/demo/agg/writesbycmd.d         |    30 +
 .../onnv/cmd/dtrace/demo/agg/writesbycmdfd.d       |    30 +
 .../onnv/cmd/dtrace/demo/agg/writetime.d           |    37 +
 .../onnv/cmd/dtrace/demo/agg/writetimeq.d          |    37 +
 .../onnv/cmd/dtrace/demo/anon}/Makefile.kup        |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/anon/iprb.d    |    39 +
 .../onnv/cmd/dtrace/demo/buf}/Makefile.kup         |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/buf/ring.d     |    39 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/chapters       |   125 +
 .../onnv/cmd/dtrace/demo/dtrace}/Makefile.kup      |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/begin.d |    42 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/end.d   |    39 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/error.d |    35 +
 .../onnv/cmd/dtrace/demo/fbt}/Makefile.kup         |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/fbt/delay.d    |    39 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/fbt/putnext.d  |    30 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/fbt/ssd.d      |    31 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/fbt/xioctl.d   |    50 +
 .../onnv/cmd/dtrace/demo/intro}/Makefile.kup       |     0
 .../onnv/cmd/dtrace/demo/intro/countdown.d         |    43 +
 .../onnv/cmd/dtrace/demo/intro/counter.d           |    44 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/intro/hello.d  |    31 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/intro/rwtime.d |    39 +
 .../onnv/cmd/dtrace/demo/intro/trussrw.d           |    38 +
 .../onnv/cmd/dtrace/demo/io}/Makefile.kup          |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/io/applicat.d  |    32 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/io/iocpu.d     |    65 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/io/iosnoop.d   |    38 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/io/iothrough.d |    66 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/io/iotime.d    |    47 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/io/whoio.d     |    38 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/io/whowrite.d  |    39 +
 .../onnv/cmd/dtrace/demo/ip}/Makefile.kup          |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipio.d      |    52 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipproto.d   |    45 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/ip/tcprst.d    |   284 +
 .../onnv/cmd/dtrace/demo/lockstat}/Makefile.kup    |     0
 .../onnv/cmd/dtrace/demo/lockstat/whatlock.d       |    37 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/mkdemo.pl      |   227 +
 .../onnv/cmd/dtrace/demo/out}/Makefile.kup         |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/out/printa.d   |    35 +
 .../onnv/cmd/dtrace/demo/proc}/Makefile.kup        |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/proc/lwptime.d |    38 +
 .../onnv/cmd/dtrace/demo/proc/progtime.d           |    37 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/proc/sig.d     |    39 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/proc/whoexec.d |    51 +
 .../onnv/cmd/dtrace/demo/profile}/Makefile.kup     |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/profile/prof.d |    39 +
 .../onnv/cmd/dtrace/demo/profile/profpri.d         |    31 +
 .../onnv/cmd/dtrace/demo/profile/restest.d         |    45 +
 .../onnv/cmd/dtrace/demo/sched}/Makefile.kup       |     0
 .../onnv/cmd/dtrace/demo/sched/firebird.d          |    52 +
 .../onnv/cmd/dtrace/demo/sched/howlong.d           |    42 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/nscd.d   |    45 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/pri.d    |    31 +
 .../onnv/cmd/dtrace/demo/sched/pritime.d           |    44 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/qlen.d   |    37 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/qtime.d  |    38 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/tick.d   |    31 +
 .../onnv/cmd/dtrace/demo/sched/ticktime.d          |    38 +
 .../onnv/cmd/dtrace/demo/sched/whatfor.d           |    64 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/where.d  |    37 +
 .../onnv/cmd/dtrace/demo/sched/whererun.d          |    60 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/whofor.d |    46 +
 .../onnv/cmd/dtrace/demo/sched/whopreempt.d        |    57 +
 .../onnv/cmd/dtrace/demo/sched/whoqueue.d          |    95 +
 .../onnv/cmd/dtrace/demo/sched/whosteal.d          |    40 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/xterm.d  |    44 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sched/xwork.d  |    40 +
 .../onnv/cmd/dtrace/demo/script}/Makefile.kup      |     0
 .../onnv/cmd/dtrace/demo/script/interp.d           |    33 +
 .../onnv/cmd/dtrace/demo/script/syscall.d          |    31 +
 .../onnv/cmd/dtrace/demo/script/tracewrite.d       |    32 +
 .../onnv/cmd/dtrace/demo/sdt}/Makefile.kup         |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sdt/callout.d  |    38 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sdt/interval.d |    54 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sdt/intr.d     |    38 +
 .../onnv/cmd/dtrace/demo/spec}/Makefile.kup        |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/spec/spec.d    |    37 +
 .../onnv/cmd/dtrace/demo/spec/specopen.d           |    93 +
 .../onnv/cmd/dtrace/demo/struct}/Makefile.kup      |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/struct/kstat.d |    44 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/struct/ksyms.d |    55 +
 .../onnv/cmd/dtrace/demo/struct/rwinfo.d           |    59 +
 .../onnv/cmd/dtrace/demo/sysinfo}/Makefile.kup     |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/find.d |    45 +
 .../onnv/cmd/dtrace/demo/tcp}/Makefile.kup         |     0
 .../onnv/cmd/dtrace/demo/tcp/tcp1stbyte.d          |    37 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytes.d |    36 +
 .../onnv/cmd/dtrace/demo/tcp/tcpbytesstat.d        |    45 +
 .../onnv/cmd/dtrace/demo/tcp/tcpconnlat.d          |    37 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpio.d    |    32 +
 .../onnv/cmd/dtrace/demo/tcp/tcpioflags.d          |    64 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpsnoop.d |    78 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpstate.d |    39 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcptop.d   |   138 +
 .../onnv/cmd/dtrace/demo/udp}/Makefile.kup         |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytes.d |    36 +
 .../onnv/cmd/dtrace/demo/udp/udpbytesstat.d        |    45 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpio.d    |    32 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpsnoop.d |    59 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/udp/udptop.d   |   133 +
 .../onnv/cmd/dtrace/demo/user}/Makefile.kup        |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/user/badopen.d |    38 +
 .../onnv/cmd/dtrace/demo/user/errorpath.d          |    52 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/user/libc.d    |    30 +
 .../onnv/cmd/dtrace/demo/user/userfunc.d           |    42 +
 .../onnv/cmd/dtrace/demo/vars}/Makefile.kup        |     0
 .../VBoxDTrace/onnv/cmd/dtrace/demo/vars/clause.d  |    55 +
 .../VBoxDTrace/onnv/cmd/dtrace/demo/vars/rtime.d   |    43 +
 .../onnv/cmd/dtrace/demo/vminfo}/Makefile.kup      |     0
 .../onnv/cmd/dtrace/demo/vminfo/soffice.d          |    52 +
 .../ExtPacks/VBoxDTrace/onnv/cmd/dtrace/dtrace.c   |  2025 ++
 .../VBoxDTrace/onnv/cmd/dtrace/i386/Makefile       |    30 +
 .../VBoxDTrace/onnv/cmd/dtrace/i386}/Makefile.kup  |     0
 .../VBoxDTrace/onnv/cmd/dtrace/sparc/Makefile      |    30 +
 .../VBoxDTrace/onnv/cmd/dtrace/sparc}/Makefile.kup |     0
 .../VBoxDTrace/onnv/cmd/dtrace/sparcv9/Makefile    |    31 +
 .../onnv/cmd/dtrace/sparcv9}/Makefile.kup          |     0
 .../VBoxDTrace/onnv/cmd/dtrace/test/Makefile       |    46 +
 .../VBoxDTrace/onnv/cmd/dtrace/test}/Makefile.kup  |     0
 .../onnv/cmd/dtrace/test/Makefile.subdirs          |    41 +
 .../VBoxDTrace/onnv/cmd/dtrace/test/README         |    32 +
 .../VBoxDTrace/onnv/cmd/dtrace/test/cmd/Makefile   |    31 +
 .../onnv/cmd/dtrace/test/cmd}/Makefile.kup         |     0
 .../onnv/cmd/dtrace/test/cmd/baddof/Makefile       |    59 +
 .../onnv/cmd/dtrace/test/cmd/baddof}/Makefile.kup  |     0
 .../onnv/cmd/dtrace/test/cmd/baddof/baddof.c       |   207 +
 .../onnv/cmd/dtrace/test/cmd/badioctl/Makefile     |    58 +
 .../cmd/dtrace/test/cmd/badioctl}/Makefile.kup     |     0
 .../onnv/cmd/dtrace/test/cmd/badioctl/badioctl.c   |   145 +
 .../onnv/cmd/dtrace/test/cmd/chkargs/Makefile      |    33 +
 .../onnv/cmd/dtrace/test/cmd/chkargs/Makefile.com  |    76 +
 .../onnv/cmd/dtrace/test/cmd/chkargs}/Makefile.kup |     0
 .../cmd/dtrace/test/cmd/chkargs/amd64/Makefile     |    31 +
 .../dtrace/test/cmd/chkargs/amd64}/Makefile.kup    |     0
 .../onnv/cmd/dtrace/test/cmd/chkargs/chkargs.c     |   149 +
 .../onnv/cmd/dtrace/test/cmd/chkargs/i386/Makefile |    30 +
 .../cmd/dtrace/test/cmd/chkargs/i386}/Makefile.kup |     0
 .../cmd/dtrace/test/cmd/chkargs/sparc/Makefile     |    30 +
 .../dtrace/test/cmd/chkargs/sparc}/Makefile.kup    |     0
 .../cmd/dtrace/test/cmd/chkargs/sparcv9/Makefile   |    31 +
 .../dtrace/test/cmd/chkargs/sparcv9}/Makefile.kup  |     0
 .../onnv/cmd/dtrace/test/cmd/jdtrace/Getopt.java   |   453 +
 .../onnv/cmd/dtrace/test/cmd/jdtrace/JDTrace.java  |  1042 +
 .../onnv/cmd/dtrace/test/cmd/jdtrace/Makefile      |   109 +
 .../onnv/cmd/dtrace/test/cmd/jdtrace}/Makefile.kup |     0
 .../onnv/cmd/dtrace/test/cmd/jdtrace/exception.lst |    77 +
 .../onnv/cmd/dtrace/test/cmd/jdtrace/jdtrace.c     |    60 +
 .../dtrace/test/cmd/jdtrace/manifest}/Makefile.kup |     0
 .../test/cmd/jdtrace/manifest/jdtrace.jar-manifest |     3 +
 .../onnv/cmd/dtrace/test/cmd/scripts/Makefile      |    56 +
 .../onnv/cmd/dtrace/test/cmd/scripts}/Makefile.kup |     0
 .../onnv/cmd/dtrace/test/cmd/scripts/dstyle.pl     |   235 +
 .../onnv/cmd/dtrace/test/cmd/scripts/dtest.pl      |   704 +
 .../VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile   |    39 +
 .../onnv/cmd/dtrace/test/tst/Makefile.com          |   104 +
 .../onnv/cmd/dtrace/test/tst}/Makefile.kup         |     0
 .../onnv/cmd/dtrace/test/tst/common/Makefile       |   101 +
 .../onnv/cmd/dtrace/test/tst/common}/Makefile.kup  |     0
 .../cmd/dtrace/test/tst/common/aggs}/Makefile.kup  |     0
 .../test/tst/common/aggs/err.D_AGG_FUNC.bad.d      |    45 +
 .../test/tst/common/aggs/err.D_AGG_MDIM.bad.d      |    45 +
 .../test/tst/common/aggs/err.D_AGG_NULL.bad.d      |    44 +
 .../test/tst/common/aggs/err.D_AGG_REDEF.redef.d   |    45 +
 .../tst/common/aggs/err.D_AGG_SCALAR.avgtoofew.d   |    43 +
 .../tst/common/aggs/err.D_AGG_SCALAR.maxnoarg.d    |    41 +
 .../tst/common/aggs/err.D_AGG_SCALAR.mintoofew.d   |    42 +
 .../common/aggs/err.D_AGG_SCALAR.quantizetoofew.d  |    41 +
 .../common/aggs/err.D_AGG_SCALAR.stddevtoofew.d    |    41 +
 .../tst/common/aggs/err.D_AGG_SCALAR.sumtoofew.d   |    42 +
 .../test/tst/common/aggs/err.D_CLEAR_AGGARG.bad.d  |    77 +
 .../test/tst/common/aggs/err.D_CLEAR_PROTO.bad.d   |    77 +
 .../test/tst/common/aggs/err.D_FUNC_IDENT.bad.d    |    45 +
 .../tst/common/aggs/err.D_FUNC_UNDEF.badaggfunc.d  |    43 +
 .../tst/common/aggs/err.D_IDENT_UNDEF.badexpr.d    |    41 +
 .../tst/common/aggs/err.D_IDENT_UNDEF.badkey3.d    |    42 +
 .../tst/common/aggs/err.D_IDENT_UNDEF.noeffect.d   |    41 +
 .../test/tst/common/aggs/err.D_KEY_TYPE.badkey1.d  |    41 +
 .../test/tst/common/aggs/err.D_KEY_TYPE.badkey2.d  |    42 +
 .../test/tst/common/aggs/err.D_KEY_TYPE.badkey4.d  |    44 +
 .../tst/common/aggs/err.D_LQUANT_BASETYPE.lqbad1.d |    44 +
 .../common/aggs/err.D_LQUANT_BASETYPE.lqshort.d    |    44 +
 .../tst/common/aggs/err.D_LQUANT_BASEVAL.bad.d     |    43 +
 .../tst/common/aggs/err.D_LQUANT_LIMTYPE.lqbad1.d  |    45 +
 .../test/tst/common/aggs/err.D_LQUANT_LIMVAL.bad.d |    44 +
 .../test/tst/common/aggs/err.D_LQUANT_MATCHBASE.d  |    33 +
 .../tst/common/aggs/err.D_LQUANT_MATCHBASE.order.d |    33 +
 .../test/tst/common/aggs/err.D_LQUANT_MATCHLIM.d   |    33 +
 .../tst/common/aggs/err.D_LQUANT_MATCHLIM.order.d  |    33 +
 .../test/tst/common/aggs/err.D_LQUANT_MATCHSTEP.d  |    33 +
 .../common/aggs/err.D_LQUANT_MISMATCH.lqbadarg.d   |    55 +
 .../common/aggs/err.D_LQUANT_STEPLARGE.lqtoofew.d  |    42 +
 .../tst/common/aggs/err.D_LQUANT_STEPSMALL.bad.d   |    55 +
 .../common/aggs/err.D_LQUANT_STEPTYPE.lqbadinc.d   |    56 +
 .../tst/common/aggs/err.D_LQUANT_STEPVAL.bad.d     |    56 +
 .../tst/common/aggs/err.D_NORMALIZE_AGGARG.bad.d   |    65 +
 .../tst/common/aggs/err.D_NORMALIZE_PROTO.bad.d    |    64 +
 .../tst/common/aggs/err.D_NORMALIZE_SCALAR.bad.d   |    64 +
 .../common/aggs/err.D_PROTO_ARG.lquantizetoofew.d  |    42 +
 .../tst/common/aggs/err.D_PROTO_LEN.avgnoarg.d     |    44 +
 .../tst/common/aggs/err.D_PROTO_LEN.avgtoomany.d   |    44 +
 .../tst/common/aggs/err.D_PROTO_LEN.counttoomany.d |    41 +
 .../common/aggs/err.D_PROTO_LEN.lquantizenoarg.d   |    42 +
 .../common/aggs/err.D_PROTO_LEN.lquantizetoomany.d |    40 +
 .../tst/common/aggs/err.D_PROTO_LEN.maxnoarg.d     |    41 +
 .../tst/common/aggs/err.D_PROTO_LEN.maxtoomany.d   |    41 +
 .../tst/common/aggs/err.D_PROTO_LEN.minnoarg.d     |    41 +
 .../tst/common/aggs/err.D_PROTO_LEN.mintoomany.d   |    42 +
 .../common/aggs/err.D_PROTO_LEN.quantizenoarg.d    |    42 +
 .../common/aggs/err.D_PROTO_LEN.quantizetoomany.d  |    41 +
 .../tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d  |    41 +
 .../common/aggs/err.D_PROTO_LEN.stddevtoomany.d    |    41 +
 .../tst/common/aggs/err.D_PROTO_LEN.sumnoarg.d     |    41 +
 .../tst/common/aggs/err.D_PROTO_LEN.sumtoomany.d   |    41 +
 .../test/tst/common/aggs/err.D_TRUNC_AGGARG.bad.d  |    35 +
 .../tst/common/aggs/err.D_TRUNC_PROTO.badmany.d    |    34 +
 .../tst/common/aggs/err.D_TRUNC_PROTO.badnone.d    |    33 +
 .../test/tst/common/aggs/err.D_TRUNC_SCALAR.bad.d  |    34 +
 .../cmd/dtrace/test/tst/common/aggs/tst.allquant.d |    46 +
 .../dtrace/test/tst/common/aggs/tst.allquant.d.out |   131 +
 .../onnv/cmd/dtrace/test/tst/common/aggs/tst.avg.d |    57 +
 .../cmd/dtrace/test/tst/common/aggs/tst.avg.d.out  |     2 +
 .../cmd/dtrace/test/tst/common/aggs/tst.avg_neg.d  |    46 +
 .../dtrace/test/tst/common/aggs/tst.avg_neg.d.out  |     2 +
 .../cmd/dtrace/test/tst/common/aggs/tst.clear.d    |    75 +
 .../dtrace/test/tst/common/aggs/tst.clear.d.out    |    22 +
 .../cmd/dtrace/test/tst/common/aggs/tst.clearavg.d |    60 +
 .../dtrace/test/tst/common/aggs/tst.clearavg.d.out |     2 +
 .../dtrace/test/tst/common/aggs/tst.clearavg2.d    |    63 +
 .../test/tst/common/aggs/tst.clearavg2.d.out       |    16 +
 .../test/tst/common/aggs/tst.cleardenormalize.d    |    78 +
 .../tst/common/aggs/tst.cleardenormalize.d.out     |    22 +
 .../test/tst/common/aggs/tst.clearlquantize.d      |    67 +
 .../test/tst/common/aggs/tst.clearlquantize.d.out  |    94 +
 .../test/tst/common/aggs/tst.clearnormalize.d      |    77 +
 .../test/tst/common/aggs/tst.clearnormalize.d.out  |    22 +
 .../dtrace/test/tst/common/aggs/tst.clearstddev.d  |    57 +
 .../test/tst/common/aggs/tst.clearstddev.d.out     |     2 +
 .../cmd/dtrace/test/tst/common/aggs/tst.count.d    |    44 +
 .../dtrace/test/tst/common/aggs/tst.count.d.out    |     2 +
 .../cmd/dtrace/test/tst/common/aggs/tst.count2.d   |    54 +
 .../dtrace/test/tst/common/aggs/tst.count2.d.out   |     2 +
 .../cmd/dtrace/test/tst/common/aggs/tst.count3.d   |    56 +
 .../dtrace/test/tst/common/aggs/tst.denormalize.d  |    63 +
 .../test/tst/common/aggs/tst.denormalize.d.out     |     7 +
 .../test/tst/common/aggs/tst.denormalizeonly.d     |    61 +
 .../test/tst/common/aggs/tst.denormalizeonly.d.out |     6 +
 .../dtrace/test/tst/common/aggs/tst.fmtnormalize.d |    61 +
 .../test/tst/common/aggs/tst.fmtnormalize.d.out    |     7 +
 .../cmd/dtrace/test/tst/common/aggs/tst.forms.d    |    53 +
 .../dtrace/test/tst/common/aggs/tst.forms.d.out    |     6 +
 .../cmd/dtrace/test/tst/common/aggs/tst.goodkey.d  |    55 +
 .../cmd/dtrace/test/tst/common/aggs/tst.keysort.d  |   108 +
 .../dtrace/test/tst/common/aggs/tst.keysort.d.out  |   160 +
 .../dtrace/test/tst/common/aggs/tst.lquantize.d    |    57 +
 .../test/tst/common/aggs/tst.lquantize.d.out       |    61 +
 .../dtrace/test/tst/common/aggs/tst.lquantnormal.d |    51 +
 .../test/tst/common/aggs/tst.lquantnormal.d.out    |    16 +
 .../dtrace/test/tst/common/aggs/tst.lquantrange.d  |    40 +
 .../test/tst/common/aggs/tst.lquantrange.d.out     |    23 +
 .../dtrace/test/tst/common/aggs/tst.lquantround.d  |    57 +
 .../test/tst/common/aggs/tst.lquantround.d.out     |     9 +
 .../dtrace/test/tst/common/aggs/tst.lquantzero.d   |    96 +
 .../test/tst/common/aggs/tst.lquantzero.d.out      |   910 +
 .../onnv/cmd/dtrace/test/tst/common/aggs/tst.max.d |    58 +
 .../cmd/dtrace/test/tst/common/aggs/tst.max.d.out  |     3 +
 .../cmd/dtrace/test/tst/common/aggs/tst.max_neg.d  |    46 +
 .../dtrace/test/tst/common/aggs/tst.max_neg.d.out  |     2 +
 .../onnv/cmd/dtrace/test/tst/common/aggs/tst.min.d |    57 +
 .../cmd/dtrace/test/tst/common/aggs/tst.min.d.out  |     2 +
 .../cmd/dtrace/test/tst/common/aggs/tst.min_neg.d  |    46 +
 .../dtrace/test/tst/common/aggs/tst.min_neg.d.out  |     2 +
 .../dtrace/test/tst/common/aggs/tst.multiaggs1.d   |    66 +
 .../dtrace/test/tst/common/aggs/tst.multiaggs2.d   |    61 +
 .../test/tst/common/aggs/tst.multiaggs2.d.out      |    37 +
 .../dtrace/test/tst/common/aggs/tst.multiaggs3.d   |    74 +
 .../test/tst/common/aggs/tst.multiaggs3.d.out      |    38 +
 .../test/tst/common/aggs/tst.multinormalize.d      |    65 +
 .../test/tst/common/aggs/tst.multinormalize.d.out  |    15 +
 .../dtrace/test/tst/common/aggs/tst.neglquant.d    |   150 +
 .../test/tst/common/aggs/tst.neglquant.d.out       |    64 +
 .../cmd/dtrace/test/tst/common/aggs/tst.negorder.d |    85 +
 .../dtrace/test/tst/common/aggs/tst.negorder.d.out |   376 +
 .../cmd/dtrace/test/tst/common/aggs/tst.negquant.d |   115 +
 .../dtrace/test/tst/common/aggs/tst.negquant.d.out |    55 +
 .../cmd/dtrace/test/tst/common/aggs/tst.negtrunc.d |    49 +
 .../dtrace/test/tst/common/aggs/tst.negtrunc.d.out |    11 +
 .../test/tst/common/aggs/tst.negtruncquant.d       |    52 +
 .../test/tst/common/aggs/tst.negtruncquant.d.out   |    46 +
 .../dtrace/test/tst/common/aggs/tst.normalize.d    |    60 +
 .../test/tst/common/aggs/tst.normalize.d.out       |     7 +
 .../cmd/dtrace/test/tst/common/aggs/tst.order.d    |    78 +
 .../dtrace/test/tst/common/aggs/tst.order.d.out    |    33 +
 .../cmd/dtrace/test/tst/common/aggs/tst.quantize.d |    57 +
 .../dtrace/test/tst/common/aggs/tst.quantize.d.out |    61 +
 .../dtrace/test/tst/common/aggs/tst.quantmany.d    |    56 +
 .../test/tst/common/aggs/tst.quantmany.d.out       |  1208 +
 .../dtrace/test/tst/common/aggs/tst.quantround.d   |    57 +
 .../test/tst/common/aggs/tst.quantround.d.out      |     9 +
 .../dtrace/test/tst/common/aggs/tst.quantzero.d    |    63 +
 .../test/tst/common/aggs/tst.quantzero.d.out       |   146 +
 .../dtrace/test/tst/common/aggs/tst.signature.d    |    54 +
 .../dtrace/test/tst/common/aggs/tst.signedkeys.d   |   120 +
 .../test/tst/common/aggs/tst.signedkeys.d.out      |    44 +
 .../test/tst/common/aggs/tst.signedkeyspos.d       |   115 +
 .../test/tst/common/aggs/tst.signedkeyspos.d.out   |    61 +
 .../cmd/dtrace/test/tst/common/aggs/tst.stddev.d   |    64 +
 .../dtrace/test/tst/common/aggs/tst.stddev.d.out   |     3 +
 .../cmd/dtrace/test/tst/common/aggs/tst.subr.d     |   112 +
 .../onnv/cmd/dtrace/test/tst/common/aggs/tst.sum.d |    57 +
 .../cmd/dtrace/test/tst/common/aggs/tst.sum.d.out  |     2 +
 .../cmd/dtrace/test/tst/common/aggs/tst.trunc.d    |    49 +
 .../dtrace/test/tst/common/aggs/tst.trunc.d.out    |    11 +
 .../cmd/dtrace/test/tst/common/aggs/tst.trunc0.d   |    57 +
 .../dtrace/test/tst/common/aggs/tst.trunc0.d.out   |     7 +
 .../dtrace/test/tst/common/aggs/tst.truncquant.d   |    52 +
 .../test/tst/common/aggs/tst.truncquant.d.out      |    46 +
 .../test/tst/common/aggs/tst.valsortkeypos.d       |    49 +
 .../test/tst/common/aggs/tst.valsortkeypos.d.out   |     4 +
 .../test/tst/common/arithmetic}/Makefile.kup       |     0
 .../tst/common/arithmetic/err.D_DIV_ZERO.divby0.d  |    43 +
 .../common/arithmetic/err.D_DIV_ZERO.divby0_1.d    |    45 +
 .../common/arithmetic/err.D_DIV_ZERO.divby0_2.d    |    46 +
 .../tst/common/arithmetic/err.D_DIV_ZERO.modby0.d  |    44 +
 .../tst/common/arithmetic/err.D_SYNTAX.addmin.d    |    47 +
 .../tst/common/arithmetic/err.D_SYNTAX.divmin.d    |    46 +
 .../tst/common/arithmetic/err.D_SYNTAX.muladd.d    |    46 +
 .../tst/common/arithmetic/err.D_SYNTAX.muldiv.d    |    46 +
 .../dtrace/test/tst/common/arithmetic/tst.basics.d |    66 +
 .../test/tst/common/arithmetic/tst.complex.d       |    57 +
 .../dtrace/test/tst/common/arrays}/Makefile.kup    |     0
 .../test/tst/common/arrays/err.D_ARR_BADREF.bad.d  |    42 +
 .../tst/common/arrays/err.D_DECL_ARRBIG.toobig.d   |    45 +
 .../tst/common/arrays/err.D_DECL_ARRNULL.bad.d     |    42 +
 .../test/tst/common/arrays/err.D_DECL_ARRSUB.bad.d |    42 +
 .../common/arrays/err.D_DECL_PROTO_TYPE.badtuple.d |    44 +
 .../tst/common/arrays/err.D_IDENT_UNDEF.badureg.d  |    42 +
 .../cmd/dtrace/test/tst/common/arrays/tst.basic1.d |    56 +
 .../cmd/dtrace/test/tst/common/arrays/tst.basic2.d |    57 +
 .../cmd/dtrace/test/tst/common/arrays/tst.basic3.d |    56 +
 .../cmd/dtrace/test/tst/common/arrays/tst.basic4.d |    56 +
 .../cmd/dtrace/test/tst/common/arrays/tst.basic5.d |    59 +
 .../cmd/dtrace/test/tst/common/arrays/tst.basic6.d |    58 +
 .../dtrace/test/tst/common/arrays/tst.uregsarray.d |    51 +
 .../dtrace/test/tst/common/assocs}/Makefile.kup    |     0
 .../tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d |    42 +
 .../tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d |    42 +
 .../tst/common/assocs/err.D_OP_INCOMPAT.this.d     |    48 +
 .../tst/common/assocs/err.D_PROTO_ARG.badsig.d     |    46 +
 .../tst/common/assocs/err.D_PROTO_LEN.toofew.d     |    46 +
 .../tst/common/assocs/err.D_PROTO_LEN.toomany.d    |    46 +
 .../tst/common/assocs/err.D_SYNTAX.errassign.d     |    45 +
 .../dtrace/test/tst/common/assocs/err.tupoflow.d   |    41 +
 .../dtrace/test/tst/common/assocs/tst.cpyarray.d   |    65 +
 .../test/tst/common/assocs/tst.diffprofile.d       |    62 +
 .../dtrace/test/tst/common/assocs/tst.initialize.d |    47 +
 .../dtrace/test/tst/common/assocs/tst.invalidref.d |    75 +
 .../cmd/dtrace/test/tst/common/assocs/tst.misc.d   |    69 +
 .../test/tst/common/assocs/tst.orthogonality.d     |    51 +
 .../cmd/dtrace/test/tst/common/assocs/tst.this.d   |    49 +
 .../test/tst/common/assocs/tst.valassign.d.out     |     2 +
 .../cmd/dtrace/test/tst/common/begin}/Makefile.kup |     0
 .../test/tst/common/begin/err.D_PDESC_ZERO.begin.d |    44 +
 .../test/tst/common/begin/err.D_PDESC_ZERO.tick.d  |    45 +
 .../cmd/dtrace/test/tst/common/begin/tst.begin.d   |    55 +
 .../dtrace/test/tst/common/begin/tst.begin.d.out   |     5 +
 .../dtrace/test/tst/common/begin/tst.multibegin.d  |    60 +
 .../test/tst/common/begin/tst.multibegin.d.out     |     6 +
 .../dtrace/test/tst/common/bitfields}/Makefile.kup |     0
 .../err.D_ADDROF_BITFIELD.BitfieldAddress.d        |    50 +
 .../bitfields/err.D_DECL_BFCONST.NegBitField.d     |    46 +
 .../bitfields/err.D_DECL_BFCONST.ZeroBitField.d    |    46 +
 .../bitfields/err.D_DECL_BFSIZE.ExceedBaseType.d   |    53 +
 .../bitfields/err.D_DECL_BFSIZE.GreaterThan64.d    |    46 +
 .../common/bitfields/err.D_DECL_BFTYPE.badtype.d   |    47 +
 .../tst/common/bitfields/err.D_OFFSETOF_BITFIELD.d |    53 +
 .../err.D_SIZEOF_BITFIELD.SizeofBitfield.d         |    49 +
 .../tst/common/bitfields/tst.BitFieldPromotion.d   |    60 +
 .../test/tst/common/bitfields/tst.SizeofBitField.d |   109 +
 .../dtrace/test/tst/common/buffering}/Makefile.kup |     0
 .../cmd/dtrace/test/tst/common/buffering/err.end.d |    54 +
 .../dtrace/test/tst/common/buffering/err.resize1.d |    46 +
 .../dtrace/test/tst/common/buffering/err.resize2.d |    47 +
 .../dtrace/test/tst/common/buffering/err.resize3.d |    62 +
 .../dtrace/test/tst/common/buffering/err.zerobuf.d |    43 +
 .../test/tst/common/buffering/tst.alignring.d      |    81 +
 .../test/tst/common/buffering/tst.cputime.ksh      |    90 +
 .../test/tst/common/buffering/tst.dynvarsize.d     |    67 +
 .../dtrace/test/tst/common/buffering/tst.fill1.d   |   115 +
 .../test/tst/common/buffering/tst.fill1.d.out      |     9 +
 .../dtrace/test/tst/common/buffering/tst.resize1.d |    51 +
 .../dtrace/test/tst/common/buffering/tst.resize2.d |    52 +
 .../dtrace/test/tst/common/buffering/tst.resize3.d |    73 +
 .../dtrace/test/tst/common/buffering/tst.ring1.d   |    75 +
 .../dtrace/test/tst/common/buffering/tst.ring2.d   |    53 +
 .../test/tst/common/buffering/tst.ring2.d.out      |     6 +
 .../dtrace/test/tst/common/buffering/tst.ring3.d   |    78 +
 .../test/tst/common/buffering/tst.ring3.d.out      |     5 +
 .../test/tst/common/buffering/tst.smallring.d      |    57 +
 .../dtrace/test/tst/common/buffering/tst.switch1.d |    69 +
 .../test/tst/common/buffering/tst.switch1.d.out    |    11 +
 .../test/tst/common/builtinvar}/Makefile.kup       |     0
 .../builtinvar/err.D_XLATE_NOCONV.cpuusage.d       |    42 +
 .../common/builtinvar/err.D_XLATE_NOCONV.nice.d    |    45 +
 .../builtinvar/err.D_XLATE_NOCONV.priority.d       |    43 +
 .../common/builtinvar/err.D_XLATE_NOCONV.prsize.d  |    42 +
 .../common/builtinvar/err.D_XLATE_NOCONV.rssize.d  |    42 +
 .../dtrace/test/tst/common/builtinvar/tst.arg0.d   |    42 +
 .../test/tst/common/builtinvar/tst.arg0clause.d    |    47 +
 .../dtrace/test/tst/common/builtinvar/tst.arg1.d   |    42 +
 .../test/tst/common/builtinvar/tst.arg1to8.d       |    43 +
 .../test/tst/common/builtinvar/tst.arg1to8clause.d |    47 +
 .../dtrace/test/tst/common/builtinvar/tst.caller.d |    42 +
 .../test/tst/common/builtinvar/tst.caller1.d       |    46 +
 .../dtrace/test/tst/common/builtinvar/tst.epid.d   |    46 +
 .../dtrace/test/tst/common/builtinvar/tst.epid1.d  |    43 +
 .../dtrace/test/tst/common/builtinvar/tst.errno.d  |    47 +
 .../dtrace/test/tst/common/builtinvar/tst.errno1.d |    43 +
 .../test/tst/common/builtinvar/tst.execname.d      |    49 +
 .../test/tst/common/builtinvar/tst.hpriority.d     |    42 +
 .../cmd/dtrace/test/tst/common/builtinvar/tst.id.d |    46 +
 .../dtrace/test/tst/common/builtinvar/tst.id1.d    |    42 +
 .../dtrace/test/tst/common/builtinvar/tst.ipl.d    |    46 +
 .../dtrace/test/tst/common/builtinvar/tst.ipl1.d   |    42 +
 .../test/tst/common/builtinvar/tst.lwpsinfo.d      |    55 +
 .../test/tst/common/builtinvar/tst.lwpsinfo1.d     |    51 +
 .../dtrace/test/tst/common/builtinvar/tst.pid.d    |    46 +
 .../dtrace/test/tst/common/builtinvar/tst.pid1.d   |    42 +
 .../dtrace/test/tst/common/builtinvar/tst.psinfo.d |    55 +
 .../test/tst/common/builtinvar/tst.psinfo1.d       |    51 +
 .../dtrace/test/tst/common/builtinvar/tst.tid.d    |    46 +
 .../dtrace/test/tst/common/builtinvar/tst.tid1.d   |    43 +
 .../test/tst/common/builtinvar/tst.timestamp.d     |    43 +
 .../test/tst/common/builtinvar/tst.vtimestamp.d    |    43 +
 .../dtrace/test/tst/common/clauses}/Makefile.kup   |     0
 .../tst/common/clauses/err.D_IDENT_UNDEF.aggfun.d  |    40 +
 .../tst/common/clauses/err.D_IDENT_UNDEF.aggtup.d  |    40 +
 .../tst/common/clauses/err.D_IDENT_UNDEF.arrtup.d  |    40 +
 .../tst/common/clauses/err.D_IDENT_UNDEF.body.d    |    38 +
 .../tst/common/clauses/err.D_IDENT_UNDEF.both.d    |    41 +
 .../tst/common/clauses/err.D_IDENT_UNDEF.pred.d    |    39 +
 .../dtrace/test/tst/common/clauses/tst.nopred.d    |    38 +
 .../cmd/dtrace/test/tst/common/clauses/tst.pred.d  |    39 +
 .../dtrace/test/tst/common/clauses/tst.predfirst.d |    41 +
 .../dtrace/test/tst/common/clauses/tst.predlast.d  |    42 +
 .../cmd/dtrace/test/tst/common/cpc}/Makefile.kup   |     0
 .../tst/common/cpc/err.D_PDESC_ZERO.lowfrequency.d |    45 +
 .../cpc/err.D_PDESC_ZERO.malformedoverflow.d       |    40 +
 .../common/cpc/err.D_PDESC_ZERO.nonexistentevent.d |    40 +
 .../test/tst/common/cpc/err.cpcvscpustatpart1.ksh  |    78 +
 .../test/tst/common/cpc/err.cpcvscpustatpart2.ksh  |    70 +
 .../tst/common/cpc/err.cputrackfailtostart.ksh     |    77 +
 .../test/tst/common/cpc/err.cputrackterminates.ksh |    70 +
 .../test/tst/common/cpc/err.toomanyenablings.d     |    55 +
 .../cmd/dtrace/test/tst/common/cpc/tst.allcpus.ksh |   107 +
 .../dtrace/test/tst/common/cpc/tst.genericevent.d  |    48 +
 .../test/tst/common/cpc/tst.platformevent.ksh      |    81 +
 .../cmd/dtrace/test/tst/common/decls}/Makefile.kup |     0
 .../decls/err.D_DECL_LOCASSC.NonLocalAssoc.d       |    49 +
 .../common/decls/err.D_DECL_LONGINT.LongStruct.d   |    52 +
 .../decls/err.D_DECL_PARMCLASS.BadStorageClass.d   |    51 +
 .../common/decls/err.D_DECL_PROTO_NAME.VoidName.d  |    40 +
 .../tst/common/decls/err.D_DECL_PROTO_TYPE.Dyn.d   |    40 +
 .../decls/err.D_DECL_PROTO_VARARGS.VarLenArgs.d    |    50 +
 .../decls/err.D_DECL_PROTO_VOID.NonSoleVoid.d      |    49 +
 .../decls/err.D_DECL_SIGNINT.UnsignedStruct.d      |    52 +
 .../decls/err.D_DECL_VOIDATTR.ShortVoidDecl.d      |    49 +
 .../cmd/dtrace/test/tst/common/decls/tst.arrays.d  |    51 +
 .../cmd/dtrace/test/tst/common/decls/tst.basics.d  |    67 +
 .../cmd/dtrace/test/tst/common/decls/tst.funcs.d   |    49 +
 .../dtrace/test/tst/common/decls/tst.pointers.d    |    43 +
 .../test/tst/common/decls/tst.varargsfuncs.d       |    45 +
 .../test/tst/common/docsExamples}/Makefile.kup     |     0
 .../dtrace/test/tst/common/docsExamples/badptr.d   |    42 +
 .../test/tst/common/docsExamples/countdown.d       |    53 +
 .../dtrace/test/tst/common/docsExamples/counter.d  |    52 +
 .../test/tst/common/docsExamples/errorpath.d       |    47 +
 .../dtrace/test/tst/common/docsExamples/hello.d    |    42 +
 .../dtrace/test/tst/common/docsExamples/kstat.d    |    57 +
 .../dtrace/test/tst/common/docsExamples/ksyms.d    |    63 +
 .../test/tst/common/docsExamples/renormalize.d     |    55 +
 .../dtrace/test/tst/common/docsExamples/rtime.d    |    50 +
 .../cmd/dtrace/test/tst/common/docsExamples/rw.d   |    42 +
 .../dtrace/test/tst/common/docsExamples/rwinfo.d   |    74 +
 .../dtrace/test/tst/common/docsExamples/rwtime.d   |    50 +
 .../dtrace/test/tst/common/docsExamples/specopen.d |    79 +
 .../dtrace/test/tst/common/docsExamples/truss.d    |    55 +
 .../dtrace/test/tst/common/docsExamples/trussrw.d  |    52 +
 .../dtrace/test/tst/common/docsExamples/userfunc.d |    61 +
 .../cmd/dtrace/test/tst/common/drops}/Makefile.kup |     0
 .../tst/common/drops/drp.DTRACEDROP_AGGREGATION.d  |    44 +
 .../tst/common/drops/drp.DTRACEDROP_DBLERROR.d     |    42 +
 .../test/tst/common/drops/drp.DTRACEDROP_DYNAMIC.d |    43 +
 .../tst/common/drops/drp.DTRACEDROP_PRINCIPAL.d    |    43 +
 .../common/drops/drp.DTRACEDROP_PRINCIPAL.end.d    |    43 +
 .../test/tst/common/drops/drp.DTRACEDROP_SPEC.d    |    48 +
 .../tst/common/drops/drp.DTRACEDROP_SPECUNAVAIL.d  |    42 +
 .../common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d   |    53 +
 .../test/tst/common/dtraceUtil}/Makefile.kup       |     0
 .../err.D_PDESC_ZERO.InvalidDescription1.d         |    42 +
 .../test/tst/common/dtraceUtil/man.APIVersion.d    |    37 +
 .../test/tst/common/dtraceUtil/man.AddSearchPath.d |    55 +
 .../test/tst/common/dtraceUtil/man.CoalesceTrace.d |    67 +
 .../test/tst/common/dtraceUtil/man.ELFGeneration.d |    48 +
 .../tst/common/dtraceUtil/man.IncludedFilePath.d   |    48 +
 .../common/dtraceUtil/man.ListProbesWithFunctions  |    99 +
 .../tst/common/dtraceUtil/man.ListProbesWithIDs    |    77 +
 .../common/dtraceUtil/man.ListProbesWithModules    |    91 +
 .../tst/common/dtraceUtil/man.ListProbesWithNames  |   128 +
 .../common/dtraceUtil/man.ListProbesWithProviders  |    82 +
 .../tst/common/dtraceUtil/man.ShowCompilerCode.d   |    44 +
 .../test/tst/common/dtraceUtil/man.TraceFunctions  |   115 +
 .../dtrace/test/tst/common/dtraceUtil/man.TraceIDs |    70 +
 .../test/tst/common/dtraceUtil/man.TraceModule     |   114 +
 .../test/tst/common/dtraceUtil/man.TraceNames      |   129 +
 .../test/tst/common/dtraceUtil/man.TraceProvider   |    83 +
 .../common/dtraceUtil/man.VerboseStabilityReport.d |    47 +
 .../tst/common/dtraceUtil/tst.AddSearchPath.d.ksh  |    82 +
 .../tst/common/dtraceUtil/tst.BufsizeGiga.d.ksh    |    45 +
 .../tst/common/dtraceUtil/tst.BufsizeKilo.d.ksh    |    45 +
 .../tst/common/dtraceUtil/tst.BufsizeMega.d.ksh    |    45 +
 .../tst/common/dtraceUtil/tst.BufsizeTera.d.ksh    |    45 +
 .../tst/common/dtraceUtil/tst.DataModel32.d.ksh    |    73 +
 .../tst/common/dtraceUtil/tst.DataModel64.d.ksh    |    74 +
 .../common/dtraceUtil/tst.DefineNameWithCPP.d.ksh  |    68 +
 .../dtraceUtil/tst.DefineNameWithCPP.d.ksh.out     |     2 +
 .../dtraceUtil/tst.DestructWithFunction.d.ksh      |    56 +
 .../dtraceUtil/tst.DestructWithFunction.d.ksh.out  |     1 +
 .../tst/common/dtraceUtil/tst.DestructWithID.d.ksh |    54 +
 .../common/dtraceUtil/tst.DestructWithID.d.ksh.out |     1 +
 .../common/dtraceUtil/tst.DestructWithModule.d.ksh |    54 +
 .../dtraceUtil/tst.DestructWithModule.d.ksh.out    |     1 +
 .../common/dtraceUtil/tst.DestructWithName.d.ksh   |    54 +
 .../dtraceUtil/tst.DestructWithName.d.ksh.out      |     1 +
 .../dtraceUtil/tst.DestructWithProvider.d.ksh      |    54 +
 .../dtraceUtil/tst.DestructWithProvider.d.ksh.out  |     1 +
 .../common/dtraceUtil/tst.DestructWithoutW.d.ksh   |    55 +
 .../common/dtraceUtil/tst.ELFGenerationOut.d.ksh   |    73 +
 .../common/dtraceUtil/tst.ELFGenerationWithO.d.ksh |    74 +
 .../tst/common/dtraceUtil/tst.ExitStatus1.d.ksh    |    56 +
 .../tst/common/dtraceUtil/tst.ExitStatus2.d.ksh    |    55 +
 .../common/dtraceUtil/tst.ExtraneousProbeIds.d.ksh |    53 +
 .../common/dtraceUtil/tst.InvalidFuncName1.d.ksh   |    53 +
 .../common/dtraceUtil/tst.InvalidFuncName2.d.ksh   |    53 +
 .../tst/common/dtraceUtil/tst.InvalidId1.d.ksh     |    59 +
 .../tst/common/dtraceUtil/tst.InvalidId2.d.ksh     |    59 +
 .../tst/common/dtraceUtil/tst.InvalidId3.d.ksh     |    59 +
 .../tst/common/dtraceUtil/tst.InvalidModule1.d.ksh |    59 +
 .../tst/common/dtraceUtil/tst.InvalidModule2.d.ksh |    59 +
 .../tst/common/dtraceUtil/tst.InvalidModule3.d.ksh |    59 +
 .../tst/common/dtraceUtil/tst.InvalidModule4.d.ksh |    59 +
 .../dtraceUtil/tst.InvalidProbeIdentifier.d.ksh    |    53 +
 .../common/dtraceUtil/tst.InvalidProvider1.d.ksh   |    59 +
 .../common/dtraceUtil/tst.InvalidProvider2.d.ksh   |    59 +
 .../common/dtraceUtil/tst.InvalidProvider3.d.ksh   |    59 +
 .../common/dtraceUtil/tst.InvalidProvider4.d.ksh   |    59 +
 .../common/dtraceUtil/tst.InvalidTraceFunc1.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceFunc2.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceFunc3.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceFunc4.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceFunc5.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceFunc6.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceFunc7.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceFunc8.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceFunc9.d.ksh  |    53 +
 .../common/dtraceUtil/tst.InvalidTraceID1.d.ksh    |    58 +
 .../common/dtraceUtil/tst.InvalidTraceID2.d.ksh    |    58 +
 .../common/dtraceUtil/tst.InvalidTraceID3.d.ksh    |    58 +
 .../common/dtraceUtil/tst.InvalidTraceID4.d.ksh    |    58 +
 .../common/dtraceUtil/tst.InvalidTraceID5.d.ksh    |    58 +
 .../common/dtraceUtil/tst.InvalidTraceID6.d.ksh    |    58 +
 .../common/dtraceUtil/tst.InvalidTraceID7.d.ksh    |    58 +
 .../dtraceUtil/tst.InvalidTraceModule1.d.ksh       |    58 +
 .../dtraceUtil/tst.InvalidTraceModule2.d.ksh       |    58 +
 .../dtraceUtil/tst.InvalidTraceModule3.d.ksh       |    58 +
 .../dtraceUtil/tst.InvalidTraceModule4.d.ksh       |    58 +
 .../dtraceUtil/tst.InvalidTraceModule5.d.ksh       |    58 +
 .../dtraceUtil/tst.InvalidTraceModule6.d.ksh       |    58 +
 .../dtraceUtil/tst.InvalidTraceModule7.d.ksh       |    58 +
 .../dtraceUtil/tst.InvalidTraceModule8.d.ksh       |    58 +
 .../common/dtraceUtil/tst.InvalidTraceName1.d.ksh  |    57 +
 .../common/dtraceUtil/tst.InvalidTraceName2.d.ksh  |    57 +
 .../common/dtraceUtil/tst.InvalidTraceName3.d.ksh  |    57 +
 .../common/dtraceUtil/tst.InvalidTraceName4.d.ksh  |    57 +
 .../common/dtraceUtil/tst.InvalidTraceName5.d.ksh  |    57 +
 .../common/dtraceUtil/tst.InvalidTraceName6.d.ksh  |    57 +
 .../common/dtraceUtil/tst.InvalidTraceName7.d.ksh  |    57 +
 .../common/dtraceUtil/tst.InvalidTraceName8.d.ksh  |    57 +
 .../common/dtraceUtil/tst.InvalidTraceName9.d.ksh  |    57 +
 .../dtraceUtil/tst.InvalidTraceProvider1.d.ksh     |    58 +
 .../dtraceUtil/tst.InvalidTraceProvider2.d.ksh     |    58 +
 .../dtraceUtil/tst.InvalidTraceProvider3.d.ksh     |    58 +
 .../dtraceUtil/tst.InvalidTraceProvider4.d.ksh     |    58 +
 .../dtraceUtil/tst.InvalidTraceProvider5.d.ksh     |    58 +
 .../dtraceUtil/tst.MultipleInvalidProbeId.d.ksh    |    53 +
 .../dtraceUtil/tst.PreprocessorStatement.d.ksh     |    70 +
 .../test/tst/common/dtraceUtil/tst.QuietMode.d.ksh |    65 +
 .../tst/common/dtraceUtil/tst.QuietMode.d.ksh.out  |     1 +
 .../tst/common/dtraceUtil/tst.TestCompile.d.ksh    |    67 +
 .../common/dtraceUtil/tst.TestCompile.d.ksh.out    |     0
 .../dtraceUtil/tst.UnDefineNameWithCPP.d.ksh       |    71 +
 .../common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh |    58 +
 .../dtraceUtil/tst.ZeroFunctionProbes.d.ksh.out    |     1 +
 .../common/dtraceUtil/tst.ZeroModuleProbes.d.ksh   |    57 +
 .../dtraceUtil/tst.ZeroModuleProbes.d.ksh.out      |     1 +
 .../tst/common/dtraceUtil/tst.ZeroNameProbes.d.ksh |    56 +
 .../common/dtraceUtil/tst.ZeroNameProbes.d.ksh.out |     1 +
 .../common/dtraceUtil/tst.ZeroProbeIdentfier.d.ksh |    53 +
 .../common/dtraceUtil/tst.ZeroProbesWithoutZ.d.ksh |    57 +
 .../common/dtraceUtil/tst.ZeroProviderProbes.d.ksh |    57 +
 .../dtraceUtil/tst.ZeroProviderProbes.d.ksh.out    |     1 +
 .../cmd/dtrace/test/tst/common/end}/Makefile.kup   |     0
 .../tst/common/end/err.D_IDENT_UNDEF.timespent.d   |    49 +
 .../onnv/cmd/dtrace/test/tst/common/end/tst.end.d  |    55 +
 .../test/tst/common/end/tst.endwithoutbegin.d      |    48 +
 .../dtrace/test/tst/common/end/tst.multibeginend.d |    77 +
 .../cmd/dtrace/test/tst/common/end/tst.multiend.d  |    61 +
 .../cmd/dtrace/test/tst/common/enum}/Makefile.kup  |     0
 .../common/enum/err.D_DECL_IDRED.EnumSameName.d    |    57 +
 .../common/enum/err.D_UNKNOWN.RepeatIdentifiers.d  |    52 +
 .../dtrace/test/tst/common/enum/tst.EnumEquality.d |    56 +
 .../test/tst/common/enum/tst.EnumSameValue.d       |    51 +
 .../test/tst/common/enum/tst.EnumValAssign.d       |    57 +
 .../cmd/dtrace/test/tst/common/error}/Makefile.kup |     0
 .../test/tst/common/error/tst.DTRACEFLT_BADADDR.d  |    51 +
 .../test/tst/common/error/tst.DTRACEFLT_DIVZERO.d  |    54 +
 .../test/tst/common/error/tst.DTRACEFLT_UNKNOWN.d  |    53 +
 .../cmd/dtrace/test/tst/common/error/tst.error.d   |    49 +
 .../dtrace/test/tst/common/error/tst.errorend.d    |    54 +
 .../cmd/dtrace/test/tst/common/exit}/Makefile.kup  |     0
 .../test/tst/common/exit/err.D_PROTO_LEN.noarg.d   |    42 +
 .../cmd/dtrace/test/tst/common/exit/err.exitarg1.d |    42 +
 .../cmd/dtrace/test/tst/common/exit/tst.basic1.d   |    42 +
 .../test/tst/common/fbtprovider}/Makefile.kup      |     0
 .../fbtprovider/err.D_PDESC_ZERO.notreturn.d       |    56 +
 .../dtrace/test/tst/common/fbtprovider/tst.basic.d |    49 +
 .../tst/common/fbtprovider/tst.functionentry.d     |    48 +
 .../common/fbtprovider/tst.functionreturnvalue.d   |    43 +
 .../test/tst/common/fbtprovider/tst.ioctlargs.d    |    50 +
 .../test/tst/common/fbtprovider/tst.offset.d       |    53 +
 .../test/tst/common/fbtprovider/tst.offsetzero.d   |    50 +
 .../test/tst/common/fbtprovider/tst.return.d       |    52 +
 .../test/tst/common/fbtprovider/tst.return0.d      |    44 +
 .../test/tst/common/fbtprovider/tst.tailcall.d     |    55 +
 .../cmd/dtrace/test/tst/common/funcs}/Makefile.kup |     0
 .../common/funcs/err.D_FUNC_UNDEF.progenyofbad1.d  |    44 +
 .../test/tst/common/funcs/err.D_OP_VFPTR.badop.d   |    47 +
 .../tst/common/funcs/err.D_PROTO_ARG.chillbadarg.d |    43 +
 .../common/funcs/err.D_PROTO_ARG.copyoutbadarg.d   |    43 +
 .../tst/common/funcs/err.D_PROTO_ARG.mobadarg.d    |    41 +
 .../tst/common/funcs/err.D_PROTO_ARG.raisebadarg.d |    43 +
 .../tst/common/funcs/err.D_PROTO_LEN.allocanoarg.d |    45 +
 .../common/funcs/err.D_PROTO_LEN.badbreakpoint.d   |    43 +
 .../tst/common/funcs/err.D_PROTO_LEN.chilltoofew.d |    43 +
 .../common/funcs/err.D_PROTO_LEN.chilltoomany.d    |    42 +
 .../funcs/err.D_PROTO_LEN.copyoutstrbadarg.d       |    43 +
 .../funcs/err.D_PROTO_LEN.copyoutstrtoofew.d       |    43 +
 .../common/funcs/err.D_PROTO_LEN.copyouttoofew.d   |    43 +
 .../common/funcs/err.D_PROTO_LEN.copyouttoomany.d  |    44 +
 .../tst/common/funcs/err.D_PROTO_LEN.motoofew.d    |    41 +
 .../tst/common/funcs/err.D_PROTO_LEN.motoomany.d   |    41 +
 .../tst/common/funcs/err.D_PROTO_LEN.mtabadarg.d   |    42 +
 .../tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d   |    43 +
 .../tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d  |    42 +
 .../tst/common/funcs/err.D_PROTO_LEN.panicbadarg.d |    43 +
 .../common/funcs/err.D_PROTO_LEN.progenyofbad2.d   |    44 +
 .../tst/common/funcs/err.D_PROTO_LEN.stopbadarg.d  |    43 +
 .../common/funcs/err.D_STRINGOF_TYPE.badstringof.d |    43 +
 .../test/tst/common/funcs/err.D_VAR_UNDEF.badvar.d |    43 +
 .../dtrace/test/tst/common/funcs/err.badalloca.d   |    56 +
 .../dtrace/test/tst/common/funcs/err.badalloca2.d  |    49 +
 .../dtrace/test/tst/common/funcs/err.badbcopy.d    |    55 +
 .../dtrace/test/tst/common/funcs/err.badbcopy1.d   |    54 +
 .../dtrace/test/tst/common/funcs/err.badbcopy2.d   |    53 +
 .../dtrace/test/tst/common/funcs/err.badbcopy3.d   |    50 +
 .../dtrace/test/tst/common/funcs/err.badbcopy4.d   |    53 +
 .../dtrace/test/tst/common/funcs/err.badbcopy5.d   |    55 +
 .../dtrace/test/tst/common/funcs/err.badbcopy6.d   |    40 +
 .../dtrace/test/tst/common/funcs/err.badchill.d    |    39 +
 .../test/tst/common/funcs/err.chillbadarg.ksh      |    69 +
 .../cmd/dtrace/test/tst/common/funcs/err.copyout.d |    49 +
 .../test/tst/common/funcs/err.copyoutbadaddr.ksh   |    71 +
 .../tst/common/funcs/err.copyoutstrbadaddr.ksh     |    70 +
 .../test/tst/common/funcs/err.inet_ntoa6badaddr.d  |    45 +
 .../test/tst/common/funcs/err.inet_ntoabadaddr.d   |    45 +
 .../test/tst/common/funcs/err.inet_ntopbadaddr.d   |    45 +
 .../test/tst/common/funcs/err.inet_ntopbadarg.d    |    47 +
 .../test/tst/common/funcs/tst.badfreopen.ksh       |   102 +
 .../dtrace/test/tst/common/funcs/tst.basename.d    |    87 +
 .../test/tst/common/funcs/tst.basename.d.out       |   163 +
 .../cmd/dtrace/test/tst/common/funcs/tst.bcopy.d   |    61 +
 .../cmd/dtrace/test/tst/common/funcs/tst.chill.ksh |    77 +
 .../dtrace/test/tst/common/funcs/tst.cleanpath.d   |    70 +
 .../test/tst/common/funcs/tst.cleanpath.d.out      |    22 +
 .../cmd/dtrace/test/tst/common/funcs/tst.copyin.d  |    54 +
 .../dtrace/test/tst/common/funcs/tst.copyinto.d    |    56 +
 .../test/tst/common/funcs/tst.ddi_pathname.d       |    64 +
 .../cmd/dtrace/test/tst/common/funcs/tst.default.d |    64 +
 .../dtrace/test/tst/common/funcs/tst.freopen.ksh   |   111 +
 .../dtrace/test/tst/common/funcs/tst.ftruncate.ksh |    64 +
 .../test/tst/common/funcs/tst.ftruncate.ksh.out    |    11 +
 .../cmd/dtrace/test/tst/common/funcs/tst.hton.d    |    97 +
 .../cmd/dtrace/test/tst/common/funcs/tst.index.d   |   226 +
 .../dtrace/test/tst/common/funcs/tst.index.d.out   |  1126 +
 .../dtrace/test/tst/common/funcs/tst.inet_ntoa.d   |    58 +
 .../test/tst/common/funcs/tst.inet_ntoa.d.out      |     5 +
 .../dtrace/test/tst/common/funcs/tst.inet_ntoa6.d  |    95 +
 .../test/tst/common/funcs/tst.inet_ntoa6.d.out     |     8 +
 .../dtrace/test/tst/common/funcs/tst.inet_ntop.d   |   135 +
 .../test/tst/common/funcs/tst.inet_ntop.d.out      |    13 +
 .../cmd/dtrace/test/tst/common/funcs/tst.lltostr.d |    41 +
 .../dtrace/test/tst/common/funcs/tst.lltostr.d.out |     8 +
 .../dtrace/test/tst/common/funcs/tst.mutex_owned.d |    62 +
 .../dtrace/test/tst/common/funcs/tst.mutex_owner.d |    63 +
 .../tst/common/funcs/tst.mutex_type_adaptive.d     |    71 +
 .../dtrace/test/tst/common/funcs/tst.progenyof.d   |    64 +
 .../cmd/dtrace/test/tst/common/funcs/tst.rand.d    |    54 +
 .../cmd/dtrace/test/tst/common/funcs/tst.strchr.d  |    71 +
 .../dtrace/test/tst/common/funcs/tst.strchr.d.out  |     6 +
 .../cmd/dtrace/test/tst/common/funcs/tst.strjoin.d |    38 +
 .../dtrace/test/tst/common/funcs/tst.strjoin.d.out |     5 +
 .../cmd/dtrace/test/tst/common/funcs/tst.strstr.d  |    89 +
 .../dtrace/test/tst/common/funcs/tst.strstr.d.out  |    10 +
 .../cmd/dtrace/test/tst/common/funcs/tst.strtok.d  |   146 +
 .../dtrace/test/tst/common/funcs/tst.strtok.d.out  |     5 +
 .../dtrace/test/tst/common/funcs/tst.strtok_null.d |    43 +
 .../cmd/dtrace/test/tst/common/funcs/tst.substr.d  |   231 +
 .../dtrace/test/tst/common/funcs/tst.substr.d.out  |   254 +
 .../test/tst/common/funcs/tst.substrminate.d       |    52 +
 .../test/tst/common/funcs/tst.substrminate.d.out   |     3 +
 .../cmd/dtrace/test/tst/common/funcs/tst.system.d  |    45 +
 .../dtrace/test/tst/common/funcs/tst.system.d.out  |     8 +
 .../dtrace/test/tst/common/grammar}/Makefile.kup   |     0
 .../test/tst/common/grammar/err.D_ADDROF_LVAL.d    |    41 +
 .../test/tst/common/grammar/err.D_EMPTY.empty.d    |    34 +
 .../dtrace/test/tst/common/grammar/tst.clauses.d   |    48 +
 .../cmd/dtrace/test/tst/common/grammar/tst.stmts.d |    59 +
 .../dtrace/test/tst/common/inline}/Makefile.kup    |     0
 .../tst/common/inline/err.D_DECL_IDRED.redef1.d    |    42 +
 .../tst/common/inline/err.D_DECL_IDRED.redef2.d    |    41 +
 .../tst/common/inline/err.D_IDENT_UNDEF.recur.d    |    41 +
 .../tst/common/inline/err.D_OP_INCOMPAT.baddef1.d  |    41 +
 .../tst/common/inline/err.D_OP_INCOMPAT.baddef2.d  |    41 +
 .../tst/common/inline/err.D_OP_INCOMPAT.badxlate.d |    41 +
 .../test/tst/common/inline/tst.InlineDataAssign.d  |    68 +
 .../test/tst/common/inline/tst.InlineExpression.d  |    80 +
 .../test/tst/common/inline/tst.InlineKinds.d       |    64 +
 .../test/tst/common/inline/tst.InlineKinds.d.out   |     7 +
 .../test/tst/common/inline/tst.InlineTypedef.d     |    52 +
 .../tst/common/inline/tst.InlineWritableAssign.d   |    66 +
 .../cmd/dtrace/test/tst/common/io}/Makefile.kup    |     0
 .../onnv/cmd/dtrace/test/tst/common/io/tst.fds.c   |   100 +
 .../onnv/cmd/dtrace/test/tst/common/io/tst.fds.d   |    54 +
 .../cmd/dtrace/test/tst/common/io/tst.fds.d.out    |    36 +
 .../cmd/dtrace/test/tst/common/ip}/Makefile.kup    |     0
 .../dtrace/test/tst/common/ip/get.ipv4remote.pl    |   104 +
 .../dtrace/test/tst/common/ip/get.ipv6remote.pl    |    88 +
 .../test/tst/common/ip/tst.ipv4localicmp.ksh       |    70 +
 .../test/tst/common/ip/tst.ipv4localicmp.ksh.out   |     6 +
 .../dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh |   125 +
 .../test/tst/common/ip/tst.ipv4localtcp.ksh.out    |     7 +
 .../dtrace/test/tst/common/ip/tst.ipv4localudp.ksh |    93 +
 .../test/tst/common/ip/tst.ipv4localudp.ksh.out    |     6 +
 .../test/tst/common/ip/tst.ipv4remoteicmp.ksh      |    81 +
 .../test/tst/common/ip/tst.ipv4remoteicmp.ksh.out  |     3 +
 .../test/tst/common/ip/tst.ipv4remotetcp.ksh       |   128 +
 .../test/tst/common/ip/tst.ipv4remotetcp.ksh.out   |     7 +
 .../test/tst/common/ip/tst.ipv4remoteudp.ksh       |    88 +
 .../test/tst/common/ip/tst.ipv4remoteudp.ksh.out   |     5 +
 .../test/tst/common/ip/tst.ipv6localicmp.ksh       |    82 +
 .../test/tst/common/ip/tst.ipv6localicmp.ksh.out   |     6 +
 .../test/tst/common/ip/tst.ipv6remoteicmp.ksh      |    88 +
 .../test/tst/common/ip/tst.ipv6remoteicmp.ksh.out  |     3 +
 .../test/tst/common/ip/tst.localtcpstate.ksh       |   182 +
 .../test/tst/common/ip/tst.localtcpstate.ksh.out   |    18 +
 .../test/tst/common/ip/tst.remotetcpstate.ksh      |   172 +
 .../test/tst/common/ip/tst.remotetcpstate.ksh.out  |    15 +
 .../cmd/dtrace/test/tst/common/java_api/Makefile   |    79 +
 .../dtrace/test/tst/common/java_api}/Makefile.kup  |     0
 .../tst/common/java_api/manifest}/Makefile.kup     |     0
 .../tst/common/java_api/manifest/test.jar-manifest |     2 +
 .../test/tst/common/java_api/src}/Makefile.kup     |     0
 .../test/tst/common/java_api/src/TestAbort.java    |   158 +
 .../test/tst/common/java_api/src/TestBean.java     |   706 +
 .../test/tst/common/java_api/src/TestClose.java    |    90 +
 .../test/tst/common/java_api/src/TestDrop.java     |   169 +
 .../test/tst/common/java_api/src/TestEnable.java   |   151 +
 .../common/java_api/src/TestFunctionLookup.java    |   114 +
 .../tst/common/java_api/src/TestGetAggregate.java  |   252 +
 .../tst/common/java_api/src/TestMaxConsumers.java  |    97 +
 .../common/java_api/src/TestMultiAggPrinta.java    |   144 +
 .../tst/common/java_api/src/TestProbeData.java     |   110 +
 .../common/java_api/src/TestProbeDescription.java  |    55 +
 .../tst/common/java_api/src/TestStateMachine.java  |   627 +
 .../test/tst/common/java_api/src/TestStopLock.java |    67 +
 .../dtrace/test/tst/common/java_api/tst.Abort.ksh  |    39 +
 .../test/tst/common/java_api/tst.Abort.ksh.out     |     1 +
 .../dtrace/test/tst/common/java_api/tst.Bean.ksh   |    41 +
 .../test/tst/common/java_api/tst.Bean.ksh.out      |   722 +
 .../dtrace/test/tst/common/java_api/tst.Close.ksh  |    38 +
 .../test/tst/common/java_api/tst.Close.ksh.out     |     1 +
 .../dtrace/test/tst/common/java_api/tst.Drop.ksh   |    38 +
 .../test/tst/common/java_api/tst.Drop.ksh.out      |     1 +
 .../dtrace/test/tst/common/java_api/tst.Enable.ksh |    40 +
 .../test/tst/common/java_api/tst.Enable.ksh.out    |     6 +
 .../test/tst/common/java_api/tst.FunctionLookup.c  |    51 +
 .../tst/common/java_api/tst.FunctionLookup.ksh     |    39 +
 .../tst/common/java_api/tst.FunctionLookup.ksh.out |     3 +
 .../test/tst/common/java_api/tst.GetAggregate.ksh  |    36 +
 .../test/tst/common/java_api/tst.MaxConsumers.ksh  |    47 +
 .../tst/common/java_api/tst.MaxConsumers.ksh.out   |    17 +
 .../tst/common/java_api/tst.MultiAggPrinta.ksh     |    38 +
 .../tst/common/java_api/tst.MultiAggPrinta.ksh.out |    78 +
 .../test/tst/common/java_api/tst.ProbeData.c       |    93 +
 .../test/tst/common/java_api/tst.ProbeData.ksh     |    38 +
 .../test/tst/common/java_api/tst.ProbeData.ksh.out |    50 +
 .../tst/common/java_api/tst.ProbeDescription.ksh   |    45 +
 .../common/java_api/tst.ProbeDescription.ksh.out   |     8 +
 .../test/tst/common/java_api/tst.StateMachine.ksh  |    40 +
 .../tst/common/java_api/tst.StateMachine.ksh.out   |    70 +
 .../test/tst/common/java_api/tst.StopLock.ksh      |    39 +
 .../test/tst/common/java_api/tst.StopLock.ksh.out  |     1 +
 .../dtrace/test/tst/common/java_api/tst.printa.d   |    78 +
 .../test/tst/common/java_api/tst.printa.d.out      |    47 +
 .../cmd/dtrace/test/tst/common/lexer}/Makefile.kup |     0
 .../test/tst/common/lexer/err.D_CHR_NL.char.d      |    43 +
 .../test/tst/common/lexer/err.D_CHR_NULL.char.d    |    42 +
 .../common/lexer/err.D_INT_DIGIT.InvalidDigit.d    |    39 +
 .../test/tst/common/lexer/err.D_INT_OFLOW.BigInt.d |    39 +
 .../test/tst/common/lexer/err.D_STR_NL.string.d    |    44 +
 .../test/tst/common/lexer/err.D_SYNTAX.brace1.d    |    39 +
 .../test/tst/common/lexer/err.D_SYNTAX.brace2.d    |    37 +
 .../test/tst/common/lexer/err.D_SYNTAX.brack1.d    |    38 +
 .../test/tst/common/lexer/err.D_SYNTAX.brack2.d    |    38 +
 .../test/tst/common/lexer/err.D_SYNTAX.brack3.d    |    39 +
 .../test/tst/common/lexer/err.D_SYNTAX.paren1.d    |    38 +
 .../test/tst/common/lexer/err.D_SYNTAX.paren2.d    |    38 +
 .../test/tst/common/lexer/err.D_SYNTAX.paren3.d    |    39 +
 .../lexer/tst.D_MACRO_OFLOW.ParIntOvflow.d.ksh     |    54 +
 .../cmd/dtrace/test/tst/common/mdb}/Makefile.kup   |     0
 .../dtrace/test/tst/common/mdb/tst.dtracedcmd.ksh  |    85 +
 .../cmd/dtrace/test/tst/common/mib}/Makefile.kup   |     0
 .../cmd/dtrace/test/tst/common/mib/tst.icmp.ksh    |    79 +
 .../cmd/dtrace/test/tst/common/mib/tst.tcp.ksh     |   155 +
 .../cmd/dtrace/test/tst/common/mib/tst.udp.ksh     |    74 +
 .../cmd/dtrace/test/tst/common/misc}/Makefile.kup  |     0
 .../test/tst/common/misc/err.D_PRAGMA_OPTSET.d     |    34 +
 .../cmd/dtrace/test/tst/common/misc/tst.badopt.d   |    41 +
 .../cmd/dtrace/test/tst/common/misc/tst.boolopt.d  |    50 +
 .../dtrace/test/tst/common/misc/tst.boolopt.d.out  |     2 +
 .../cmd/dtrace/test/tst/common/misc/tst.dynopt.d   |    61 +
 .../dtrace/test/tst/common/misc/tst.dynopt.d.out   |    31 +
 .../dtrace/test/tst/common/misc/tst.enablerace.ksh |    89 +
 .../cmd/dtrace/test/tst/common/misc/tst.haslam.d   |    63 +
 .../dtrace/test/tst/common/misc/tst.include.ksh    |   135 +
 .../dtrace/test/tst/common/misc/tst.macroglob.ksh  |    41 +
 .../test/tst/common/misc/tst.macroglob.ksh.out     |    15 +
 .../cmd/dtrace/test/tst/common/misc/tst.roch.d     |    93 +
 .../dtrace/test/tst/common/misc/tst.schrock.ksh    |    79 +
 .../dtrace/test/tst/common/multiaggs}/Makefile.kup |     0
 .../tst/common/multiaggs/err.D_PRINTA_AGGKEY.d     |    38 +
 .../tst/common/multiaggs/err.D_PRINTA_AGGPROTO.d   |    38 +
 .../dtrace/test/tst/common/multiaggs/tst.many.d    |   311 +
 .../test/tst/common/multiaggs/tst.many.d.out       |   265 +
 .../dtrace/test/tst/common/multiaggs/tst.same.d    |    37 +
 .../test/tst/common/multiaggs/tst.same.d.out       |     3 +
 .../dtrace/test/tst/common/multiaggs/tst.sort.d    |    46 +
 .../test/tst/common/multiaggs/tst.sort.d.out       |   201 +
 .../dtrace/test/tst/common/multiaggs/tst.sortpos.d |    60 +
 .../test/tst/common/multiaggs/tst.sortpos.d.out    |  1021 +
 .../test/tst/common/multiaggs/tst.tuplecompat.d    |    37 +
 .../tst/common/multiaggs/tst.tuplecompat.d.out     |     2 +
 .../dtrace/test/tst/common/multiaggs/tst.zero.d    |    51 +
 .../test/tst/common/multiaggs/tst.zero.d.out       |    55 +
 .../dtrace/test/tst/common/multiaggs/tst.zero2.d   |    50 +
 .../test/tst/common/multiaggs/tst.zero2.d.out      |    72 +
 .../dtrace/test/tst/common/multiaggs/tst.zero3.d   |    45 +
 .../test/tst/common/multiaggs/tst.zero3.d.out      |     3 +
 .../cmd/dtrace/test/tst/common/nfs}/Makefile.kup   |     0
 .../onnv/cmd/dtrace/test/tst/common/nfs/tst.call.c |   120 +
 .../onnv/cmd/dtrace/test/tst/common/nfs/tst.call.d |    70 +
 .../cmd/dtrace/test/tst/common/nfs/tst.call3.c     |   441 +
 .../cmd/dtrace/test/tst/common/nfs/tst.call3.d     |    91 +
 .../dtrace/test/tst/common/offsetof}/Makefile.kup  |     0
 .../offsetof/err.D_OFFSETOF_BITFIELD.bitfield.d    |    50 +
 .../common/offsetof/err.D_OFFSETOF_TYPE.badtype.d  |    44 +
 .../common/offsetof/err.D_OFFSETOF_TYPE.notsou.d   |    44 +
 .../common/offsetof/err.D_UNKNOWN.OffsetofNULL.d   |    49 +
 .../tst/common/offsetof/err.D_UNKNOWN.badmemb.d    |    44 +
 .../test/tst/common/offsetof/tst.OffsetofAlias.d   |    59 +
 .../test/tst/common/offsetof/tst.OffsetofArith.d   |    73 +
 .../test/tst/common/offsetof/tst.OffsetofUnion.d   |    59 +
 .../dtrace/test/tst/common/offsetof/tst.struct.d   |    50 +
 .../test/tst/common/offsetof/tst.struct.d.out      |     2 +
 .../dtrace/test/tst/common/offsetof/tst.union.d    |    50 +
 .../test/tst/common/offsetof/tst.union.d.out       |     2 +
 .../dtrace/test/tst/common/operators}/Makefile.kup |     0
 .../dtrace/test/tst/common/operators/tst.ternary.d |    48 +
 .../test/tst/common/operators/tst.ternary.d.out    |     4 +
 .../cmd/dtrace/test/tst/common/pid}/Makefile.kup   |     0
 .../test/tst/common/pid/err.D_PDESC_ZERO.badlib.d  |    38 +
 .../tst/common/pid/err.D_PDESC_ZERO.badlib.exe     |    29 +
 .../tst/common/pid/err.D_PDESC_ZERO.badproc1.d     |    38 +
 .../tst/common/pid/err.D_PROC_BADPID.badproc2.d    |    38 +
 .../tst/common/pid/err.D_PROC_CREATEFAIL.many.d    |    36 +
 .../tst/common/pid/err.D_PROC_CREATEFAIL.many.exe  |    29 +
 .../test/tst/common/pid/err.D_PROC_FUNC.badfunc.d  |    40 +
 .../tst/common/pid/err.D_PROC_FUNC.badfunc.exe     |    29 +
 .../test/tst/common/pid/err.D_PROC_LIB.libdash.d   |    38 +
 .../test/tst/common/pid/err.D_PROC_LIB.libdash.exe |    29 +
 .../test/tst/common/pid/err.D_PROC_NAME.alldash.d  |    38 +
 .../tst/common/pid/err.D_PROC_NAME.alldash.exe     |    29 +
 .../test/tst/common/pid/err.D_PROC_NAME.badname.d  |    38 +
 .../tst/common/pid/err.D_PROC_NAME.badname.exe     |    29 +
 .../test/tst/common/pid/err.D_PROC_NAME.globdash.d |    38 +
 .../tst/common/pid/err.D_PROC_NAME.globdash.exe    |    29 +
 .../test/tst/common/pid/err.D_PROC_OFF.toobig.d    |    40 +
 .../test/tst/common/pid/err.D_PROC_OFF.toobig.exe  |    29 +
 .../dtrace/test/tst/common/pid/tst.addprobes.ksh   |    61 +
 .../cmd/dtrace/test/tst/common/pid/tst.args1.c     |    52 +
 .../cmd/dtrace/test/tst/common/pid/tst.args1.d     |    75 +
 .../cmd/dtrace/test/tst/common/pid/tst.coverage.d  |    51 +
 .../dtrace/test/tst/common/pid/tst.coverage.exe    |    29 +
 .../dtrace/test/tst/common/pid/tst.emptystack.d    |    64 +
 .../test/tst/common/pid/tst.emptystack.d.out       |     3 +
 .../dtrace/test/tst/common/pid/tst.emptystack.exe  |    29 +
 .../cmd/dtrace/test/tst/common/pid/tst.float.c     |    46 +
 .../cmd/dtrace/test/tst/common/pid/tst.float.d     |    51 +
 .../onnv/cmd/dtrace/test/tst/common/pid/tst.fork.c |    63 +
 .../onnv/cmd/dtrace/test/tst/common/pid/tst.fork.d |    86 +
 .../onnv/cmd/dtrace/test/tst/common/pid/tst.gcc.c  |    63 +
 .../onnv/cmd/dtrace/test/tst/common/pid/tst.gcc.d  |    52 +
 .../dtrace/test/tst/common/pid/tst.killonerror.ksh |    41 +
 .../cmd/dtrace/test/tst/common/pid/tst.main.ksh    |    59 +
 .../dtrace/test/tst/common/pid/tst.manypids.ksh    |    70 +
 .../dtrace/test/tst/common/pid/tst.newprobes.ksh   |    62 +
 .../test/tst/common/pid/tst.newprobes.ksh.out      |     7 +
 .../dtrace/test/tst/common/pid/tst.probemod.ksh    |    54 +
 .../dtrace/test/tst/common/pid/tst.provregex1.ksh  |    93 +
 .../dtrace/test/tst/common/pid/tst.provregex2.ksh  |   131 +
 .../test/tst/common/pid/tst.provregex2.ksh.out     |     3 +
 .../dtrace/test/tst/common/pid/tst.provregex3.ksh  |   102 +
 .../test/tst/common/pid/tst.provregex3.ksh.out     |     3 +
 .../dtrace/test/tst/common/pid/tst.provregex4.ksh  |   154 +
 .../test/tst/common/pid/tst.provregex4.ksh.out     |     3 +
 .../onnv/cmd/dtrace/test/tst/common/pid/tst.ret1.c |    64 +
 .../onnv/cmd/dtrace/test/tst/common/pid/tst.ret1.d |    73 +
 .../onnv/cmd/dtrace/test/tst/common/pid/tst.ret2.c |    58 +
 .../onnv/cmd/dtrace/test/tst/common/pid/tst.ret2.d |    73 +
 .../cmd/dtrace/test/tst/common/pid/tst.vfork.c     |    65 +
 .../cmd/dtrace/test/tst/common/pid/tst.vfork.d     |    61 +
 .../cmd/dtrace/test/tst/common/pid/tst.weak1.c     |    58 +
 .../cmd/dtrace/test/tst/common/pid/tst.weak1.d     |    83 +
 .../cmd/dtrace/test/tst/common/pid/tst.weak2.c     |    58 +
 .../cmd/dtrace/test/tst/common/pid/tst.weak2.d     |    83 +
 .../dtrace/test/tst/common/plockstat}/Makefile.kup |     0
 .../test/tst/common/plockstat/tst.available.d      |    39 +
 .../test/tst/common/plockstat/tst.available.exe    |    29 +
 .../dtrace/test/tst/common/plockstat/tst.libmap.d  |    39 +
 .../test/tst/common/plockstat/tst.libmap.exe       |    29 +
 .../dtrace/test/tst/common/pointers}/Makefile.kup  |     0
 .../dtrace/test/tst/common/pointers/err.BadAlign.d |    50 +
 .../common/pointers/err.D_ADDROF_VAR.ArrayVar.d    |    47 +
 .../common/pointers/err.D_ADDROF_VAR.DynamicVar.d  |    50 +
 .../tst/common/pointers/err.D_ADDROF_VAR.agg.d     |    42 +
 .../tst/common/pointers/err.D_DEREF_NONPTR.noptr.d |    46 +
 .../pointers/err.D_DEREF_VOID.VoidPointerDeref.d   |    52 +
 .../pointers/err.D_OP_ARRFUN.ArrayAssignment.d     |    61 +
 .../pointers/err.D_OP_INCOMPAT.VoidPointerArith.d  |    46 +
 .../common/pointers/err.D_OP_LVAL.AddressChange.d  |    50 +
 .../pointers/err.D_OP_PTR.NonPointerAccess.d       |    59 +
 .../tst/common/pointers/err.D_OP_PTR.badpointer.d  |    50 +
 .../pointers/err.D_OP_SOU.BadPointerAccess.d       |    51 +
 .../tst/common/pointers/err.D_OP_SOU.badpointer.d  |    44 +
 .../test/tst/common/pointers/err.InvalidAddress1.d |    52 +
 .../test/tst/common/pointers/err.InvalidAddress2.d |    52 +
 .../test/tst/common/pointers/err.InvalidAddress3.d |    50 +
 .../test/tst/common/pointers/err.InvalidAddress4.d |    52 +
 .../test/tst/common/pointers/err.InvalidAddress5.d |    75 +
 .../test/tst/common/pointers/tst.ArrayPointer1.d   |   174 +
 .../test/tst/common/pointers/tst.ArrayPointer2.d   |    71 +
 .../test/tst/common/pointers/tst.ArrayPointer3.d   |    72 +
 .../test/tst/common/pointers/tst.GlobalVar.d       |    59 +
 .../tst/common/pointers/tst.IntegerArithmetic1.d   |    72 +
 .../tst/common/pointers/tst.PointerArithmetic1.d   |    58 +
 .../tst/common/pointers/tst.PointerArithmetic2.d   |    72 +
 .../tst/common/pointers/tst.PointerArithmetic3.d   |    61 +
 .../tst/common/pointers/tst.PointerAssignment.d    |    71 +
 .../test/tst/common/pointers/tst.ValidPointer1.d   |    49 +
 .../test/tst/common/pointers/tst.ValidPointer2.d   |    49 +
 .../dtrace/test/tst/common/pointers/tst.VoidCast.d |    59 +
 .../dtrace/test/tst/common/pointers/tst.basic1.d   |    47 +
 .../dtrace/test/tst/common/pointers/tst.basic2.d   |    47 +
 .../dtrace/test/tst/common/pragma}/Makefile.kup    |     0
 .../dtrace/test/tst/common/pragma/err.D_PRAGERR.d  |    42 +
 .../tst/common/pragma/err.D_PRAGMA_DEPEND.main.d   |    38 +
 .../test/tst/common/pragma/err.D_PRAGMA_INVAL.d    |    45 +
 .../test/tst/common/pragma/err.D_PRAGMA_MALFORM.d  |    42 +
 .../pragma/err.D_PRAGMA_UNUSED.UnusedPragma.d      |    50 +
 .../test/tst/common/pragma/err.circlibdep.ksh      |    58 +
 .../test/tst/common/pragma/err.invalidlibdep.ksh   |    57 +
 .../dtrace/test/tst/common/pragma/tst.libchain.ksh |    58 +
 .../dtrace/test/tst/common/pragma/tst.libdep.ksh   |    66 +
 .../tst/common/pragma/tst.libdepfullyconnected.ksh |   100 +
 .../test/tst/common/predicates}/Makefile.kup       |     0
 .../predicates/err.D_PRED_SCALAR.NonScalarPred.d   |    44 +
 .../tst/common/predicates/err.D_SYNTAX.invalid.d   |    50 +
 .../tst/common/predicates/err.D_SYNTAX.operr.d     |    50 +
 .../test/tst/common/predicates/tst.argsnotcached.d |    55 +
 .../dtrace/test/tst/common/predicates/tst.basics.d |    57 +
 .../test/tst/common/predicates/tst.basics.d.out    |     1 +
 .../test/tst/common/predicates/tst.complex.d       |   126 +
 .../test/tst/common/predicates/tst.complex.d.out   |    83 +
 .../test/tst/common/predicates/tst.predcache.ksh   |   197 +
 .../test/tst/common/preprocessor}/Makefile.kup     |     0
 .../preprocessor/err.D_IDENT_UNDEF.afterprobe.d    |    51 +
 .../preprocessor/err.D_PRAGCTL_INVAL.tabdefine.d   |    47 +
 .../preprocessor/err.D_SYNTAX.withoutpound.d       |    47 +
 .../test/tst/common/preprocessor/err.defincomp.d   |    47 +
 .../common/preprocessor/err.ifdefelsenotendif.d    |    50 +
 .../test/tst/common/preprocessor/err.ifdefincomp.d |    48 +
 .../tst/common/preprocessor/err.ifdefnotendif.d    |    47 +
 .../test/tst/common/preprocessor/err.incompelse.d  |    47 +
 .../test/tst/common/preprocessor/err.mulelse.d     |    55 +
 .../test/tst/common/preprocessor/tst.ifdef.d       |    51 +
 .../test/tst/common/preprocessor/tst.ifdef.d.out   |     2 +
 .../test/tst/common/preprocessor/tst.ifndef.d      |    55 +
 .../test/tst/common/preprocessor/tst.ifndef.d.out  |     2 +
 .../test/tst/common/preprocessor/tst.ifnotdef.d    |    51 +
 .../tst/common/preprocessor/tst.ifnotdef.d.out     |     2 +
 .../test/tst/common/preprocessor/tst.logicaland.d  |    50 +
 .../tst/common/preprocessor/tst.logicaland.d.out   |     2 +
 .../tst/common/preprocessor/tst.logicalandor.d     |    50 +
 .../tst/common/preprocessor/tst.logicalandor.d.out |     2 +
 .../test/tst/common/preprocessor/tst.logicalor.d   |    50 +
 .../tst/common/preprocessor/tst.logicalor.d.out    |     2 +
 .../test/tst/common/preprocessor/tst.muland.d      |    50 +
 .../test/tst/common/preprocessor/tst.muland.d.out  |     2 +
 .../test/tst/common/preprocessor/tst.mulor.d       |    50 +
 .../test/tst/common/preprocessor/tst.mulor.d.out   |     2 +
 .../test/tst/common/preprocessor/tst.precondi.d    |    48 +
 .../tst/common/preprocessor/tst.precondi.d.out     |     2 +
 .../tst/common/preprocessor/tst.predicatedeclare.d |    49 +
 .../test/tst/common/preprocessor/tst.preexp.d      |    48 +
 .../test/tst/common/preprocessor/tst.preexp.d.out  |     2 +
 .../test/tst/common/preprocessor/tst.preexpelse.d  |    51 +
 .../tst/common/preprocessor/tst.preexpelse.d.out   |     2 +
 .../test/tst/common/preprocessor/tst.preexpif.d    |    50 +
 .../tst/common/preprocessor/tst.preexpif.d.out     |     2 +
 .../tst/common/preprocessor/tst.preexpifelse.d     |    52 +
 .../tst/common/preprocessor/tst.preexpifelse.d.out |     2 +
 .../test/tst/common/preprocessor/tst.withinprobe.d |    50 +
 .../dtrace/test/tst/common/printa}/Makefile.kup    |     0
 .../tst/common/printa/err.D_PRINTA_AGGARG.badagg.d |    40 +
 .../tst/common/printa/err.D_PRINTA_AGGARG.badfmt.d |    40 +
 .../tst/common/printa/err.D_PRINTA_AGGARG.badval.d |    41 +
 .../tst/common/printa/err.D_PRINTA_PROTO.bad.d     |    40 +
 .../common/printa/err.D_PRINTF_ARG_TYPE.jstack.d   |    36 +
 .../common/printa/err.D_PRINTF_ARG_TYPE.stack.d    |    36 +
 .../common/printa/err.D_PRINTF_ARG_TYPE.ustack.d   |    36 +
 .../cmd/dtrace/test/tst/common/printa/tst.basics.d |    58 +
 .../dtrace/test/tst/common/printa/tst.basics.d.out |    19 +
 .../cmd/dtrace/test/tst/common/printa/tst.def.d    |    44 +
 .../dtrace/test/tst/common/printa/tst.def.d.out    |     3 +
 .../dtrace/test/tst/common/printa/tst.dynwidth.d   |    43 +
 .../test/tst/common/printa/tst.dynwidth.d.out      |     5 +
 .../cmd/dtrace/test/tst/common/printa/tst.fmt.d    |    43 +
 .../dtrace/test/tst/common/printa/tst.fmt.d.out    |     1 +
 .../test/tst/common/printa/tst.largeusersym.ksh    |    83 +
 .../cmd/dtrace/test/tst/common/printa/tst.many.d   |    76 +
 .../dtrace/test/tst/common/printa/tst.manyval.d    |    44 +
 .../test/tst/common/printa/tst.manyval.d.out       |     2 +
 .../cmd/dtrace/test/tst/common/printa/tst.stack.d  |    40 +
 .../cmd/dtrace/test/tst/common/printa/tst.tuple.d  |    55 +
 .../dtrace/test/tst/common/printa/tst.tuple.d.out  |     8 +
 .../test/tst/common/printa/tst.walltimestamp.ksh   |    62 +
 .../tst/common/printa/tst.walltimestamp.ksh.out    |     2 +
 .../dtrace/test/tst/common/printf}/Makefile.kup    |     0
 .../common/printf/err.D_PRINTF_AGG_CONV.aggfmt.d   |    40 +
 .../common/printf/err.D_PRINTF_ARG_EXTRA.toomany.d |    40 +
 .../common/printf/err.D_PRINTF_ARG_EXTRA.widths.d  |    47 +
 .../common/printf/err.D_PRINTF_ARG_FMT.badfmt.d    |    40 +
 .../common/printf/err.D_PRINTF_ARG_PROTO.novalue.d |    40 +
 .../common/printf/err.D_PRINTF_ARG_TYPE.aggarg.d   |    42 +
 .../printf/err.D_PRINTF_ARG_TYPE.recursive.d       |    46 +
 .../common/printf/err.D_PRINTF_DYN_PROTO.noprec.d  |    40 +
 .../common/printf/err.D_PRINTF_DYN_PROTO.nowidth.d |    40 +
 .../common/printf/err.D_PRINTF_DYN_TYPE.badprec.d  |    40 +
 .../common/printf/err.D_PRINTF_DYN_TYPE.badwidth.d |    40 +
 .../tst/common/printf/err.D_PROTO_LEN.toofew.d     |    40 +
 .../test/tst/common/printf/err.D_SYNTAX.badconv1.d |    40 +
 .../test/tst/common/printf/err.D_SYNTAX.badconv2.d |    40 +
 .../test/tst/common/printf/err.D_SYNTAX.badconv3.d |    40 +
 .../cmd/dtrace/test/tst/common/printf/tst.basics.d |    73 +
 .../dtrace/test/tst/common/printf/tst.basics.d.out |    26 +
 .../cmd/dtrace/test/tst/common/printf/tst.flags.d  |    49 +
 .../dtrace/test/tst/common/printf/tst.flags.d.out  |     7 +
 .../cmd/dtrace/test/tst/common/printf/tst.hello.d  |    44 +
 .../dtrace/test/tst/common/printf/tst.hello.d.out  |     1 +
 .../cmd/dtrace/test/tst/common/printf/tst.ints.d   |    87 +
 .../dtrace/test/tst/common/printf/tst.ints.d.out   |    45 +
 .../cmd/dtrace/test/tst/common/printf/tst.precs.d  |    58 +
 .../dtrace/test/tst/common/printf/tst.precs.d.out  |    14 +
 .../dtrace/test/tst/common/printf/tst.print-f.d    |    51 +
 .../test/tst/common/printf/tst.print-f.d.out       |     4 +
 .../dtrace/test/tst/common/printf/tst.printT.ksh   |    56 +
 .../test/tst/common/printf/tst.printT.ksh.out      |     3 +
 .../dtrace/test/tst/common/printf/tst.printY.ksh   |    56 +
 .../test/tst/common/printf/tst.printY.ksh.out      |     3 +
 .../dtrace/test/tst/common/printf/tst.printcont.d  |    60 +
 .../test/tst/common/printf/tst.printcont.d.out     |    16 +
 .../dtrace/test/tst/common/printf/tst.printeE.d    |    54 +
 .../test/tst/common/printf/tst.printeE.d.out       |     6 +
 .../dtrace/test/tst/common/printf/tst.printgG.d    |    54 +
 .../test/tst/common/printf/tst.printgG.d.out       |     6 +
 .../cmd/dtrace/test/tst/common/printf/tst.rawfmt.d |    43 +
 .../dtrace/test/tst/common/printf/tst.rawfmt.d.out |     1 +
 .../cmd/dtrace/test/tst/common/printf/tst.str.d    |    41 +
 .../dtrace/test/tst/common/printf/tst.str.d.out    |     1 +
 .../cmd/dtrace/test/tst/common/printf/tst.sym.d    |    43 +
 .../dtrace/test/tst/common/printf/tst.sym.d.out    |     1 +
 .../cmd/dtrace/test/tst/common/printf/tst.uints.d  |    47 +
 .../dtrace/test/tst/common/printf/tst.uints.d.out  |     6 +
 .../cmd/dtrace/test/tst/common/printf/tst.widths.d |    59 +
 .../dtrace/test/tst/common/printf/tst.widths.d.out |    14 +
 .../dtrace/test/tst/common/printf/tst.widths1.d    |    52 +
 .../cmd/dtrace/test/tst/common/printf/tst.wp.d     |    66 +
 .../cmd/dtrace/test/tst/common/printf/tst.wp.d.out |    22 +
 .../cmd/dtrace/test/tst/common/privs}/Makefile.kup |     0
 .../test/tst/common/privs/tst.func_access.ksh      |    82 +
 .../dtrace/test/tst/common/privs/tst.op_access.ksh |    70 +
 .../test/tst/common/privs/tst.unpriv_funcs.ksh     |    79 +
 .../dtrace/test/tst/common/probes}/Makefile.kup    |     0
 .../tst/common/probes/err.D_PDESC_ZERO.probeqtn.d  |    51 +
 .../tst/common/probes/err.D_PDESC_ZERO.probestar.d |    45 +
 .../tst/common/probes/err.D_PDESC_ZERO.tickstar.d  |    51 +
 .../test/tst/common/probes/err.D_SYNTAX.assign.d   |    48 +
 .../test/tst/common/probes/err.D_SYNTAX.declare.d  |    46 +
 .../tst/common/probes/err.D_SYNTAX.declarein.d     |    46 +
 .../test/tst/common/probes/err.D_SYNTAX.lbraces.d  |    43 +
 .../tst/common/probes/err.D_SYNTAX.probespec.d     |    45 +
 .../test/tst/common/probes/err.D_SYNTAX.rbraces.d  |    43 +
 .../test/tst/common/probes/err.D_SYNTAX.recdec.d   |    46 +
 .../cmd/dtrace/test/tst/common/probes/tst.basic1.d |    44 +
 .../cmd/dtrace/test/tst/common/probes/tst.check.d  |    51 +
 .../dtrace/test/tst/common/probes/tst.declare.d    |    45 +
 .../test/tst/common/probes/tst.declareafter.d      |    45 +
 .../dtrace/test/tst/common/probes/tst.emptyprobe.d |    47 +
 .../cmd/dtrace/test/tst/common/probes/tst.pragma.d |    44 +
 .../test/tst/common/probes/tst.pragmaaftertab.d    |    44 +
 .../test/tst/common/probes/tst.pragmainside.d      |    44 +
 .../test/tst/common/probes/tst.pragmaoutside.d     |    44 +
 .../dtrace/test/tst/common/probes/tst.probestar.d  |    50 +
 .../cmd/dtrace/test/tst/common/proc}/Makefile.kup  |     0
 .../cmd/dtrace/test/tst/common/proc/tst.create.ksh |    67 +
 .../dtrace/test/tst/common/proc/tst.discard.ksh    |    74 +
 .../cmd/dtrace/test/tst/common/proc/tst.exec.ksh   |    73 +
 .../test/tst/common/proc/tst.execfail.ENOENT.ksh   |    84 +
 .../dtrace/test/tst/common/proc/tst.execfail.ksh   |    86 +
 .../dtrace/test/tst/common/proc/tst.exitcore.ksh   |    95 +
 .../dtrace/test/tst/common/proc/tst.exitexit.ksh   |    67 +
 .../dtrace/test/tst/common/proc/tst.exitkilled.ksh |    75 +
 .../cmd/dtrace/test/tst/common/proc/tst.signal.ksh |    84 +
 .../cmd/dtrace/test/tst/common/proc/tst.sigwait.c  |    75 +
 .../cmd/dtrace/test/tst/common/proc/tst.sigwait.d  |    41 +
 .../dtrace/test/tst/common/proc/tst.startexit.ksh  |    89 +
 .../dtrace/test/tst/common/profile-n}/Makefile.kup |     0
 .../common/profile-n/err.D_PDESC_ZERO.profile.d    |    45 +
 .../tst/common/profile-n/err.D_PDESC_ZEROonens.d   |    44 +
 .../tst/common/profile-n/err.D_PDESC_ZEROonensec.d |    44 +
 .../tst/common/profile-n/err.D_PDESC_ZEROoneus.d   |    44 +
 .../tst/common/profile-n/err.D_PDESC_ZEROoneusec.d |    44 +
 .../dtrace/test/tst/common/profile-n/tst.argtest.d |    53 +
 .../test/tst/common/profile-n/tst.argtest.d.out    |     2 +
 .../dtrace/test/tst/common/profile-n/tst.basic.d   |    45 +
 .../test/tst/common/profile-n/tst.basic.d.out      |     2 +
 .../dtrace/test/tst/common/profile-n/tst.func.ksh  |    74 +
 .../dtrace/test/tst/common/profile-n/tst.mod.ksh   |    70 +
 .../test/tst/common/profile-n/tst.profilehz.d      |    45 +
 .../test/tst/common/profile-n/tst.profilehz.d.out  |     1 +
 .../test/tst/common/profile-n/tst.profilems.d      |    45 +
 .../test/tst/common/profile-n/tst.profilems.d.out  |     1 +
 .../test/tst/common/profile-n/tst.profilemsec.d    |    45 +
 .../tst/common/profile-n/tst.profilemsec.d.out     |     1 +
 .../test/tst/common/profile-n/tst.profilenhz.d     |    45 +
 .../test/tst/common/profile-n/tst.profilenhz.d.out |     1 +
 .../test/tst/common/profile-n/tst.profilens.d      |    45 +
 .../test/tst/common/profile-n/tst.profilens.d.out  |     1 +
 .../test/tst/common/profile-n/tst.profilensec.d    |    45 +
 .../tst/common/profile-n/tst.profilensec.d.out     |     1 +
 .../test/tst/common/profile-n/tst.profiles.d       |    45 +
 .../test/tst/common/profile-n/tst.profiles.d.out   |     1 +
 .../test/tst/common/profile-n/tst.profilesec.d     |    45 +
 .../test/tst/common/profile-n/tst.profilesec.d.out |     1 +
 .../test/tst/common/profile-n/tst.profileus.d      |    45 +
 .../test/tst/common/profile-n/tst.profileus.d.out  |     1 +
 .../test/tst/common/profile-n/tst.profileusec.d    |    45 +
 .../tst/common/profile-n/tst.profileusec.d.out     |     1 +
 .../dtrace/test/tst/common/profile-n/tst.sym.ksh   |    70 +
 .../dtrace/test/tst/common/profile-n/tst.ufunc.ksh |    71 +
 .../test/tst/common/profile-n/tst.ufuncsort.c      |    78 +
 .../test/tst/common/profile-n/tst.ufuncsort.ksh    |    66 +
 .../tst/common/profile-n/tst.ufuncsort.ksh.out     |     6 +
 .../dtrace/test/tst/common/profile-n/tst.umod.ksh  |    69 +
 .../dtrace/test/tst/common/profile-n/tst.usym.ksh  |    70 +
 .../dtrace/test/tst/common/providers}/Makefile.kup |     0
 .../common/providers/err.D_PDESC_INVAL.wrongdec4.d |    50 +
 .../common/providers/err.D_PDESC_ZERO.nonprofile.d |    50 +
 .../common/providers/err.D_PDESC_ZERO.wrongdec1.d  |    49 +
 .../common/providers/err.D_PDESC_ZERO.wrongdec2.d  |    49 +
 .../common/providers/err.D_PDESC_ZERO.wrongdec3.d  |    49 +
 .../dtrace/test/tst/common/providers/tst.basics.d  |    57 +
 .../test/tst/common/providers/tst.basics.d.out     |     1 +
 .../test/tst/common/providers/tst.beginexit.d      |    43 +
 .../test/tst/common/providers/tst.beginprof.d      |    47 +
 .../test/tst/common/providers/tst.beginprof.d.out  |     1 +
 .../test/tst/common/providers/tst.probattrs.d      |    52 +
 .../test/tst/common/providers/tst.probattrs.d.out  |     1 +
 .../test/tst/common/providers/tst.probefunc.d      |    52 +
 .../test/tst/common/providers/tst.probefunc.d.out  |     1 +
 .../test/tst/common/providers/tst.probemod.d       |    52 +
 .../test/tst/common/providers/tst.probemod.d.out   |     1 +
 .../test/tst/common/providers/tst.probename.d      |    52 +
 .../test/tst/common/providers/tst.probename.d.out  |     1 +
 .../test/tst/common/providers/tst.probprov.d       |    52 +
 .../test/tst/common/providers/tst.probprov.d.out   |     1 +
 .../dtrace/test/tst/common/providers/tst.profend.d |    57 +
 .../test/tst/common/providers/tst.profend.d.out    |     2 +
 .../test/tst/common/providers/tst.profexit.d       |    52 +
 .../test/tst/common/providers/tst.profexit.d.out   |     1 +
 .../dtrace/test/tst/common/providers/tst.trace.d   |    56 +
 .../test/tst/common/providers/tst.trace.d.out      |     1 +
 .../dtrace/test/tst/common/providers/tst.twoprof.d |    58 +
 .../test/tst/common/providers/tst.twoprof.d.out    |     1 +
 .../cmd/dtrace/test/tst/common/raise}/Makefile.kup |     0
 .../cmd/dtrace/test/tst/common/raise/tst.raise1.c  |    47 +
 .../cmd/dtrace/test/tst/common/raise/tst.raise1.d  |    67 +
 .../cmd/dtrace/test/tst/common/raise/tst.raise2.c  |    52 +
 .../cmd/dtrace/test/tst/common/raise/tst.raise2.d  |    67 +
 .../cmd/dtrace/test/tst/common/raise/tst.raise3.c  |    52 +
 .../cmd/dtrace/test/tst/common/raise/tst.raise3.d  |    67 +
 .../cmd/dtrace/test/tst/common/rates}/Makefile.kup |     0
 .../cmd/dtrace/test/tst/common/rates/tst.aggrate.d |    68 +
 .../dtrace/test/tst/common/rates/tst.aggrate.d.out |   101 +
 .../dtrace/test/tst/common/rates/tst.statusrate.d  |    72 +
 .../dtrace/test/tst/common/rates/tst.switchrate.d  |    62 +
 .../test/tst/common/rates/tst.switchrate.d.out     |   101 +
 .../dtrace/test/tst/common/safety}/Makefile.kup    |     0
 .../dtrace/test/tst/common/safety/tst.basename.d   |    54 +
 .../cmd/dtrace/test/tst/common/safety/tst.caller.d |    54 +
 .../dtrace/test/tst/common/safety/tst.cleanpath.d  |    54 +
 .../cmd/dtrace/test/tst/common/safety/tst.copyin.d |    83 +
 .../dtrace/test/tst/common/safety/tst.copyin2.d    |    67 +
 .../test/tst/common/safety/tst.ddi_pathname.d      |    54 +
 .../dtrace/test/tst/common/safety/tst.dirname.d    |    54 +
 .../cmd/dtrace/test/tst/common/safety/tst.errno.d  |    49 +
 .../dtrace/test/tst/common/safety/tst.execname.d   |    49 +
 .../cmd/dtrace/test/tst/common/safety/tst.gid.d    |    49 +
 .../cmd/dtrace/test/tst/common/safety/tst.hton.d   |    78 +
 .../cmd/dtrace/test/tst/common/safety/tst.index.d  |    67 +
 .../dtrace/test/tst/common/safety/tst.msgdsize.d   |    64 +
 .../dtrace/test/tst/common/safety/tst.msgsize.d    |    64 +
 .../cmd/dtrace/test/tst/common/safety/tst.null.d   |    78 +
 .../cmd/dtrace/test/tst/common/safety/tst.pid.d    |    49 +
 .../cmd/dtrace/test/tst/common/safety/tst.ppid.d   |    49 +
 .../dtrace/test/tst/common/safety/tst.progenyof.d  |    57 +
 .../cmd/dtrace/test/tst/common/safety/tst.random.d |    73 +
 .../cmd/dtrace/test/tst/common/safety/tst.rw.d     |    64 +
 .../dtrace/test/tst/common/safety/tst.shortstr.d   |    77 +
 .../cmd/dtrace/test/tst/common/safety/tst.stack.d  |    52 +
 .../dtrace/test/tst/common/safety/tst.stackdepth.d |    53 +
 .../cmd/dtrace/test/tst/common/safety/tst.stddev.d |    52 +
 .../cmd/dtrace/test/tst/common/safety/tst.strchr.d |    66 +
 .../dtrace/test/tst/common/safety/tst.strjoin.d    |    54 +
 .../cmd/dtrace/test/tst/common/safety/tst.strstr.d |    54 +
 .../cmd/dtrace/test/tst/common/safety/tst.strtok.d |    54 +
 .../cmd/dtrace/test/tst/common/safety/tst.substr.d |    54 +
 .../dtrace/test/tst/common/safety/tst.ucaller.d    |    49 +
 .../cmd/dtrace/test/tst/common/safety/tst.uid.d    |    49 +
 .../dtrace/test/tst/common/safety/tst.unalign.d    |    60 +
 .../cmd/dtrace/test/tst/common/safety/tst.uregs.d  |    52 +
 .../cmd/dtrace/test/tst/common/safety/tst.ustack.d |    52 +
 .../test/tst/common/safety/tst.ustackdepth.d       |    53 +
 .../cmd/dtrace/test/tst/common/safety/tst.vahole.d |    69 +
 .../test/tst/common/safety/tst.violentdeath.ksh    |    51 +
 .../dtrace/test/tst/common/safety/tst.zonename.d   |    49 +
 .../dtrace/test/tst/common/scalars}/Makefile.kup   |     0
 .../tst/common/scalars/err.D_ARR_LOCAL.thisarray.d |    46 +
 .../tst/common/scalars/err.D_DECL_CLASS.selfthis.d |    41 +
 .../tst/common/scalars/err.D_DECL_CLASS.thisself.d |    42 +
 .../tst/common/scalars/err.D_DECL_IDRED.errval.d   |    44 +
 .../tst/common/scalars/err.D_OP_INCOMPAT.dec.err.d |    42 +
 .../common/scalars/err.D_OP_INCOMPAT.dupgtype.d    |    41 +
 .../common/scalars/err.D_OP_INCOMPAT.dupltype.d    |    41 +
 .../common/scalars/err.D_OP_INCOMPAT.dupttype.d    |    42 +
 .../test/tst/common/scalars/err.D_SYNTAX.declare.d |    41 +
 .../dtrace/test/tst/common/scalars/tst.basicvar.d  |    57 +
 .../test/tst/common/scalars/tst.basicvar.d.out     |     2 +
 .../dtrace/test/tst/common/scalars/tst.localvar.d  |    54 +
 .../cmd/dtrace/test/tst/common/scalars/tst.misc.d  |    50 +
 .../cmd/dtrace/test/tst/common/scalars/tst.self.d  |    42 +
 .../dtrace/test/tst/common/scalars/tst.selfarray.d |    48 +
 .../test/tst/common/scalars/tst.selfarray2.d       |    64 +
 .../dtrace/test/tst/common/scalars/tst.selfthis.d  |    45 +
 .../cmd/dtrace/test/tst/common/scalars/tst.this.d  |    43 +
 .../dtrace/test/tst/common/scalars/tst.thisself.d  |    44 +
 .../cmd/dtrace/test/tst/common/sched}/Makefile.kup |     0
 .../cmd/dtrace/test/tst/common/sched/tst.enqueue.d |    48 +
 .../cmd/dtrace/test/tst/common/sched/tst.oncpu.d   |    54 +
 .../dtrace/test/tst/common/sched/tst.stackdepth.d  |    41 +
 .../dtrace/test/tst/common/scripting}/Makefile.kup |     0
 .../scripting/err.D_MACRO_UNDEF.invalidargs.d      |    43 +
 .../tst/common/scripting/err.D_OP_LVAL.rdonly.d    |    43 +
 .../common/scripting/err.D_OP_WRITE.usepidmacro.d  |    43 +
 .../tst/common/scripting/err.D_SYNTAX.concat.d     |    45 +
 .../test/tst/common/scripting/err.D_SYNTAX.desc.d  |    49 +
 .../test/tst/common/scripting/err.D_SYNTAX.inval.d |    43 +
 .../test/tst/common/scripting/err.D_SYNTAX.pid.d   |    43 +
 .../scripting/tst.D_MACRO_UNUSED.overflow.ksh      |    80 +
 .../dtrace/test/tst/common/scripting/tst.arg0.d    |    43 +
 .../test/tst/common/scripting/tst.arguments.ksh    |    90 +
 .../dtrace/test/tst/common/scripting/tst.assign.d  |    43 +
 .../dtrace/test/tst/common/scripting/tst.basic.d   |    42 +
 .../dtrace/test/tst/common/scripting/tst.egid.d    |    43 +
 .../dtrace/test/tst/common/scripting/tst.egid.ksh  |    97 +
 .../dtrace/test/tst/common/scripting/tst.euid.d    |    44 +
 .../dtrace/test/tst/common/scripting/tst.euid.ksh  |    86 +
 .../cmd/dtrace/test/tst/common/scripting/tst.gid.d |    43 +
 .../dtrace/test/tst/common/scripting/tst.gid.ksh   |    86 +
 .../dtrace/test/tst/common/scripting/tst.pgid.d    |    43 +
 .../cmd/dtrace/test/tst/common/scripting/tst.pid.d |    43 +
 .../dtrace/test/tst/common/scripting/tst.ppid.d    |    43 +
 .../dtrace/test/tst/common/scripting/tst.ppid.ksh  |    86 +
 .../dtrace/test/tst/common/scripting/tst.projid.d  |    43 +
 .../test/tst/common/scripting/tst.projid.ksh       |    86 +
 .../dtrace/test/tst/common/scripting/tst.quite.d   |    42 +
 .../cmd/dtrace/test/tst/common/scripting/tst.sid.d |    43 +
 .../dtrace/test/tst/common/scripting/tst.sid.ksh   |    86 +
 .../test/tst/common/scripting/tst.stringmacro.ksh  |    78 +
 .../dtrace/test/tst/common/scripting/tst.taskid.d  |    43 +
 .../test/tst/common/scripting/tst.taskid.ksh       |    86 +
 .../dtrace/test/tst/common/scripting/tst.trace.d   |    43 +
 .../cmd/dtrace/test/tst/common/scripting/tst.uid.d |    43 +
 .../dtrace/test/tst/common/scripting/tst.uid.ksh   |    86 +
 .../cmd/dtrace/test/tst/common/sdt}/Makefile.kup   |     0
 .../cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c   |    45 +
 .../cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d   |    67 +
 .../dtrace/test/tst/common/sizeof}/Makefile.kup    |     0
 .../common/sizeof/err.D_IDENT_BADREF.SizeofAssoc.d |    51 +
 .../sizeof/err.D_IDENT_UNDEF.UnknownSymbol.d       |    42 +
 .../test/tst/common/sizeof/err.D_SIZEOF_TYPE.d     |    41 +
 .../tst/common/sizeof/err.D_SYNTAX.SizeofBadType.d |    42 +
 .../test/tst/common/sizeof/tst.SizeofArray.d       |    61 +
 .../test/tst/common/sizeof/tst.SizeofDataTypes.d   |   122 +
 .../test/tst/common/sizeof/tst.SizeofExpression.d  |    64 +
 .../dtrace/test/tst/common/sizeof/tst.SizeofNULL.d |    48 +
 .../test/tst/common/sizeof/tst.SizeofStrConst.d    |    42 +
 .../tst/common/sizeof/tst.SizeofStrConst.d.out     |     2 +
 .../test/tst/common/sizeof/tst.SizeofString1.d     |    51 +
 .../test/tst/common/sizeof/tst.SizeofString1.d.out |     3 +
 .../test/tst/common/sizeof/tst.SizeofString2.d     |    44 +
 .../test/tst/common/sizeof/tst.SizeofString2.d.out |     2 +
 .../test/tst/common/speculation}/Makefile.kup      |     0
 .../speculation/bug.1001148.SpecSizeVariations.d   |    87 +
 .../common/speculation/err.BufSizeVariations1.d    |    88 +
 .../common/speculation/err.BufSizeVariations2.d    |    88 +
 .../err.D_ACT_SPEC.SpeculateWithBreakPoint.d       |    69 +
 .../err.D_ACT_SPEC.SpeculateWithChill.d            |    69 +
 .../err.D_ACT_SPEC.SpeculateWithCopyOut.d          |    69 +
 .../err.D_ACT_SPEC.SpeculateWithCopyOutStr.d       |    68 +
 .../err.D_ACT_SPEC.SpeculateWithPanic.d            |    69 +
 .../err.D_ACT_SPEC.SpeculateWithRaise.d            |    68 +
 .../speculation/err.D_ACT_SPEC.SpeculateWithStop.d |    68 +
 .../speculation/err.D_AGG_COMM.AggAftCommit.d      |    40 +
 .../speculation/err.D_AGG_SPEC.SpeculateWithAvg.d  |    67 +
 .../err.D_AGG_SPEC.SpeculateWithCount.d            |    67 +
 .../err.D_AGG_SPEC.SpeculateWithLquant.d           |    72 +
 .../speculation/err.D_AGG_SPEC.SpeculateWithMax.d  |    62 +
 .../speculation/err.D_AGG_SPEC.SpeculateWithMin.d  |    62 +
 .../err.D_AGG_SPEC.SpeculateWithQuant.d            |    67 +
 .../err.D_AGG_SPEC.SpeculateWithStddev.d           |    65 +
 .../speculation/err.D_AGG_SPEC.SpeculateWithSum.d  |    62 +
 .../speculation/err.D_COMM_COMM.CommitAftCommit.d  |    82 +
 .../speculation/err.D_COMM_COMM.DisjointCommit.d   |   102 +
 .../speculation/err.D_COMM_DREC.CommitAftDataRec.d |    51 +
 .../speculation/err.D_DREC_COMM.DataRecAftCommit.d |    73 +
 .../speculation/err.D_DREC_COMM.ExitAfterCommit.d  |    61 +
 .../speculation/err.D_EXIT_SPEC.ExitAftSpec.d      |    70 +
 .../speculation/err.D_PRAGMA_MALFORM.NspecExpr.d   |    77 +
 .../err.D_PRAGMA_OPTSET.HugeNspecValue.d           |    76 +
 .../err.D_PRAGMA_OPTSET.InvalidSpecSize.d          |    53 +
 .../speculation/err.D_PRAGMA_OPTSET.NegSpecSize.d  |    78 +
 .../common/speculation/err.D_PROTO_LEN.SpecNoId.d  |    61 +
 .../speculation/err.D_SPEC_COMM.SpecAftCommit.d    |    72 +
 .../speculation/err.D_SPEC_DREC.SpecAftDataRec.d   |    70 +
 .../speculation/err.D_SPEC_SPEC.SpecAftSpec.d      |    66 +
 .../tst/common/speculation/err.NegativeBufSize.d   |    88 +
 .../tst/common/speculation/err.NegativeNspec.d     |    48 +
 .../tst/common/speculation/err.NegativeSpecSize.d  |    47 +
 .../common/speculation/err.SpecSizeVariations1.d   |    78 +
 .../common/speculation/err.SpecSizeVariations2.d   |    78 +
 .../common/speculation/tst.CommitAfterDiscard.d    |    86 +
 .../tst/common/speculation/tst.CommitWithZero.d    |    66 +
 .../tst/common/speculation/tst.DataRecAftDiscard.d |    77 +
 .../tst/common/speculation/tst.DiscardAftCommit.d  |    85 +
 .../tst/common/speculation/tst.DiscardAftDataRec.d |    50 +
 .../tst/common/speculation/tst.DiscardAftDiscard.d |    85 +
 .../tst/common/speculation/tst.DiscardWithZero.d   |    67 +
 .../tst/common/speculation/tst.ExitAftDiscard.d    |    56 +
 .../test/tst/common/speculation/tst.NoSpecBuffer.d |    64 +
 .../common/speculation/tst.SpecSizeVariations1.d   |    78 +
 .../common/speculation/tst.SpecSizeVariations2.d   |    78 +
 .../common/speculation/tst.SpecSizeVariations3.d   |    78 +
 .../common/speculation/tst.SpeculateWithRandom.d   |    59 +
 .../tst/common/speculation/tst.SpeculationCommit.d |    75 +
 .../common/speculation/tst.SpeculationDiscard.d    |    74 +
 .../tst/common/speculation/tst.SpeculationID.d     |    50 +
 .../common/speculation/tst.SpeculationWithZero.d   |    65 +
 .../tst/common/speculation/tst.TwoSpecBuffers.d    |    77 +
 .../test/tst/common/speculation/tst.negcommit.d    |    37 +
 .../test/tst/common/speculation/tst.negspec.d      |    37 +
 .../test/tst/common/speculation/tst.zerosize.d     |    53 +
 .../dtrace/test/tst/common/stability}/Makefile.kup |     0
 .../stability/err.D_ATTR_MIN.MinAttributes.d       |    50 +
 .../cmd/dtrace/test/tst/common/stack}/Makefile.kup |     0
 .../test/tst/common/stack/err.D_STACK_PROTO.bad.d  |    43 +
 .../test/tst/common/stack/err.D_STACK_SIZE.d       |    40 +
 .../tst/common/stack/err.D_USTACK_FRAMES.bad.d     |    44 +
 .../test/tst/common/stack/err.D_USTACK_PROTO.bad.d |    44 +
 .../tst/common/stack/err.D_USTACK_STRSIZE.bad.d    |    44 +
 .../cmd/dtrace/test/tst/common/stack/tst.default.d |    41 +
 .../test/tst/common/stackdepth}/Makefile.kup       |     0
 .../test/tst/common/stackdepth/tst.default.d       |    41 +
 .../cmd/dtrace/test/tst/common/stop}/Makefile.kup  |     0
 .../cmd/dtrace/test/tst/common/stop/tst.stop1.c    |    37 +
 .../cmd/dtrace/test/tst/common/stop/tst.stop1.d    |    78 +
 .../cmd/dtrace/test/tst/common/stop/tst.stop2.c    |    37 +
 .../cmd/dtrace/test/tst/common/stop/tst.stop2.d    |    78 +
 .../dtrace/test/tst/common/strlen}/Makefile.kup    |     0
 .../dtrace/test/tst/common/strlen/tst.strlen1.d    |    46 +
 .../dtrace/test/tst/common/struct}/Makefile.kup    |     0
 .../common/struct/err.D_ADDROF_VAR.StructPointer.d |    59 +
 .../struct/err.D_DECL_COMBO.StructWithoutColon.d   |    74 +
 .../struct/err.D_DECL_COMBO.StructWithoutColon1.d  |    68 +
 .../common/struct/err.D_DECL_INCOMPLETE.circular.d |    66 +
 .../common/struct/err.D_DECL_INCOMPLETE.order.d    |    69 +
 .../common/struct/err.D_DECL_INCOMPLETE.order2.d   |   108 +
 .../struct/err.D_DECL_INCOMPLETE.recursive.d       |    59 +
 .../common/struct/err.D_DECL_INCOMPLETE.simple.d   |    59 +
 .../tst/common/struct/err.D_DECL_VOIDOBJ.baddec.d  |    46 +
 .../common/struct/err.D_PROTO_ARG.DupStructAssoc.d |    80 +
 .../test/tst/common/struct/tst.StructAssoc.d       |    71 +
 .../test/tst/common/struct/tst.StructDataTypes.d   |   133 +
 .../test/tst/common/struct/tst.StructInside.d      |   124 +
 .../test/tst/common/struct/tst.clauselocal.d       |    52 +
 .../test/tst/common/struct/tst.clauselocal.d.out   |     2 +
 .../dtrace/test/tst/common/syscall}/Makefile.kup   |     0
 .../cmd/dtrace/test/tst/common/syscall/tst.args.c  |    41 +
 .../cmd/dtrace/test/tst/common/syscall/tst.args.d  |    46 +
 .../dtrace/test/tst/common/syscall/tst.openret.ksh |    75 +
 .../dtrace/test/tst/common/sysevent}/Makefile.kup  |     0
 .../cmd/dtrace/test/tst/common/sysevent/tst.post.c |    45 +
 .../cmd/dtrace/test/tst/common/sysevent/tst.post.d |    88 +
 .../test/tst/common/sysevent/tst.post_chan.c       |    49 +
 .../test/tst/common/sysevent/tst.post_chan.d       |    87 +
 .../dtrace/test/tst/common/tick-n}/Makefile.kup    |     0
 .../test/tst/common/tick-n/err.D_PDESC_ZERO.tick.d |    45 +
 .../test/tst/common/tick-n/err.D_PDESC_ZEROonens.d |    44 +
 .../tst/common/tick-n/err.D_PDESC_ZEROonensec.d    |    44 +
 .../test/tst/common/tick-n/err.D_PDESC_ZEROoneus.d |    44 +
 .../tst/common/tick-n/err.D_PDESC_ZEROoneusec.d    |    44 +
 .../dtrace/test/tst/common/tick-n/tst.tickarg0.d   |    45 +
 .../cmd/dtrace/test/tst/common/tick-n/tst.tickms.d |    45 +
 .../dtrace/test/tst/common/tick-n/tst.tickms.d.out |     2 +
 .../dtrace/test/tst/common/tick-n/tst.tickmsec.d   |    45 +
 .../test/tst/common/tick-n/tst.tickmsec.d.out      |     2 +
 .../cmd/dtrace/test/tst/common/tick-n/tst.tickns.d |    45 +
 .../dtrace/test/tst/common/tick-n/tst.tickns.d.out |     2 +
 .../dtrace/test/tst/common/tick-n/tst.ticknsec.d   |    45 +
 .../test/tst/common/tick-n/tst.ticknsec.d.out      |     2 +
 .../cmd/dtrace/test/tst/common/tick-n/tst.ticks.d  |    45 +
 .../dtrace/test/tst/common/tick-n/tst.ticks.d.out  |     2 +
 .../dtrace/test/tst/common/tick-n/tst.ticksec.d    |    49 +
 .../test/tst/common/tick-n/tst.ticksec.d.out       |     2 +
 .../cmd/dtrace/test/tst/common/tick-n/tst.tickus.d |    45 +
 .../dtrace/test/tst/common/tick-n/tst.tickus.d.out |     2 +
 .../dtrace/test/tst/common/tick-n/tst.tickusec.d   |    45 +
 .../test/tst/common/tick-n/tst.tickusec.d.out      |     2 +
 .../cmd/dtrace/test/tst/common/trace}/Makefile.kup |     0
 .../test/tst/common/trace/err.D_PROTO_LEN.bad.d    |    41 +
 .../test/tst/common/trace/err.D_TRACE_VOID.bad.d   |    39 +
 .../cmd/dtrace/test/tst/common/trace/tst.misc.d    |    63 +
 .../cmd/dtrace/test/tst/common/trace/tst.qstring.d |    48 +
 .../dtrace/test/tst/common/trace/tst.qstring.d.out |     3 +
 .../cmd/dtrace/test/tst/common/trace/tst.string.d  |    43 +
 .../dtrace/test/tst/common/tracemem}/Makefile.kup  |     0
 .../tst/common/tracemem/err.D_PROTO_ARG.badsize.d  |    39 +
 .../tst/common/tracemem/err.D_PROTO_LEN.toofew.d   |    40 +
 .../tst/common/tracemem/err.D_PROTO_LEN.toomany.d  |    39 +
 .../common/tracemem/err.D_TRACEMEM_ADDR.badaddr.d  |    39 +
 .../common/tracemem/err.D_TRACEMEM_SIZE.negsize.d  |    39 +
 .../common/tracemem/err.D_TRACEMEM_SIZE.zerosize.d |    39 +
 .../dtrace/test/tst/common/tracemem/tst.rootvp.d   |    54 +
 .../test/tst/common/translators}/Makefile.kup      |     0
 .../translators/err.D_DECL_TYPERED.BadTransDecl.d  |    64 +
 .../err.D_OP_INCOMPLETE.NonExistentInput1.d        |    54 +
 .../translators/err.D_SYNTAX.BadTransDecl1.d       |    60 +
 .../translators/err.D_SYNTAX.BadTransDecl3.d       |    59 +
 .../translators/err.D_SYNTAX.BadTransDecl4.d       |    65 +
 .../err.D_TYPE_MEMBER.NonExistentInput2.d          |    60 +
 .../err.D_XLATE_INCOMPAT.BadInputType1.d           |    60 +
 .../err.D_XLATE_MEMB.NonExistentOutput2.d          |    60 +
 .../translators/err.D_XLATE_NONE.BadTransDecl6.d   |    72 +
 .../err.D_XLATE_REDECL.RepeatTransDecl.d           |    67 +
 .../translators/err.D_XLATE_SOU.BadTransDecl8.d    |    58 +
 .../translators/err.D_XLATE_SOU.BadTransInt.d      |    52 +
 .../err.D_XLATE_SOU.NonExistentOutput1.d           |    55 +
 .../common/translators/man.TestTransStability.d    |    61 +
 .../tst/common/translators/tst.CircularTransDecl.d |   100 +
 .../tst/common/translators/tst.EmptyTransDecl.d    |    79 +
 .../test/tst/common/translators/tst.ForwardTag.d   |    60 +
 .../tst/common/translators/tst.InputAliasTrans.d   |    60 +
 .../tst/common/translators/tst.InputIntTrans.d     |    60 +
 .../tst/common/translators/tst.OutputAliasTrans.d  |    63 +
 .../common/translators/tst.PartialDereferencing.d  |    85 +
 .../translators/tst.PartialOutputTransDefn.d       |    60 +
 .../tst/common/translators/tst.ProcModelTrans.d    |    53 +
 .../tst/common/translators/tst.RepeatDeclaration.d |    71 +
 .../translators/tst.SimultaneousTranslators.d      |    71 +
 .../common/translators/tst.StructureAssignment.d   |    85 +
 .../tst/common/translators/tst.TransNonPointer.d   |    84 +
 .../common/translators/tst.TransOutputPointer.d    |    80 +
 .../test/tst/common/translators/tst.TransPointer.d |    63 +
 .../tst/common/translators/tst.TranslateSelf.d     |    76 +
 .../tst/common/translators/tst.UnionInputTrans.d   |    61 +
 .../tst/common/translators/tst.UnionOutputTrans.d  |    61 +
 .../dtrace/test/tst/common/typedef}/Makefile.kup   |     0
 .../common/typedef/err.D_DECL_IDRED.DupTypeDef.d   |    51 +
 .../typedef/err.D_SYNTAX.BadExistingTypedef.d      |    45 +
 .../common/typedef/err.D_SYNTAX.TypedefInClause.d  |    43 +
 .../test/tst/common/typedef/tst.ChainTypedef.d     |    48 +
 .../tst/common/typedef/tst.TypedefDataAssign.d     |   118 +
 .../cmd/dtrace/test/tst/common/types}/Makefile.kup |     0
 .../tst/common/types/err.D_CAST_INVAL.badcast.d    |    45 +
 .../tst/common/types/err.D_CG_DYN.ResultDynType.d  |    47 +
 .../tst/common/types/err.D_CHR_OFLOW.charconst.d   |    46 +
 .../tst/common/types/err.D_DECL_BADCLASS.bad.d     |    43 +
 .../common/types/err.D_DECL_CHARATTR.badtype3.d    |    44 +
 .../tst/common/types/err.D_DECL_COMBO.badtype4.d   |    44 +
 .../tst/common/types/err.D_DECL_COMBO.badtype5.d   |    44 +
 .../tst/common/types/err.D_DECL_ENCONST.badeval.d  |    39 +
 .../tst/common/types/err.D_DECL_ENOFLOW.enoflow.d  |    38 +
 .../tst/common/types/err.D_DECL_ENOFLOW.enuflow.d  |    39 +
 .../tst/common/types/err.D_DECL_SCOPE.scopeop.d    |    46 +
 .../tst/common/types/err.D_DECL_USELESS.baddec.d   |    43 +
 .../test/tst/common/types/err.D_OP_ACT.badcond.d   |    46 +
 .../tst/common/types/err.D_OP_ARITH.badoperand.d   |    44 +
 .../tst/common/types/err.D_OP_INCOMPAT.badassign.d |    44 +
 .../test/tst/common/types/err.D_OP_INT.badbitop.d  |    43 +
 .../test/tst/common/types/err.D_OP_INT.badshift.d  |    43 +
 .../tst/common/types/err.D_OP_SCALAR.badcond.d     |    44 +
 .../tst/common/types/err.D_OP_SCALAR.badincop.d    |    44 +
 .../tst/common/types/err.D_OP_SCALAR.badlogop.d    |    43 +
 .../tst/common/types/err.D_PROTO_LEN.badcond1.d    |    45 +
 .../test/tst/common/types/err.D_SYNTAX.badenum.d   |    40 +
 .../test/tst/common/types/err.D_SYNTAX.badid.d     |    46 +
 .../test/tst/common/types/err.D_SYNTAX.badstruct.d |    38 +
 .../test/tst/common/types/err.D_UNKNOWN.badtype1.d |    44 +
 .../test/tst/common/types/err.D_UNKNOWN.badtype2.d |    44 +
 .../test/tst/common/types/err.D_UNKNOWN.dupenum.d  |    39 +
 .../tst/common/types/err.D_UNKNOWN.dupstruct.d     |    39 +
 .../types/err.D_XLATE_REDECL.ResultDynType.d       |    48 +
 .../dtrace/test/tst/common/types/tst.assignops.d   |    82 +
 .../dtrace/test/tst/common/types/tst.badshiftops.d |    49 +
 .../cmd/dtrace/test/tst/common/types/tst.basics.d  |    59 +
 .../dtrace/test/tst/common/types/tst.basics.d.out  |    16 +
 .../cmd/dtrace/test/tst/common/types/tst.bitops.d  |    62 +
 .../test/tst/common/types/tst.charconstants.d      |    68 +
 .../cmd/dtrace/test/tst/common/types/tst.complex.d |    74 +
 .../dtrace/test/tst/common/types/tst.condexpr.d    |    61 +
 .../dtrace/test/tst/common/types/tst.constants.d   |    52 +
 .../cmd/dtrace/test/tst/common/types/tst.conv.d    |   109 +
 .../cmd/dtrace/test/tst/common/types/tst.enum.d    |    51 +
 .../dtrace/test/tst/common/types/tst.intincop.d    |    70 +
 .../cmd/dtrace/test/tst/common/types/tst.intops.d  |    70 +
 .../dtrace/test/tst/common/types/tst.inttypes.d    |    52 +
 .../dtrace/test/tst/common/types/tst.ptrincop.d    |    72 +
 .../cmd/dtrace/test/tst/common/types/tst.ptrops.d  |    71 +
 .../cmd/dtrace/test/tst/common/types/tst.relenum.d |    73 +
 .../dtrace/test/tst/common/types/tst.relstring.d   |    70 +
 .../dtrace/test/tst/common/types/tst.shiftops.d    |    62 +
 .../test/tst/common/types/tst.stringconstants.d    |    51 +
 .../cmd/dtrace/test/tst/common/types/tst.struct.d  |    84 +
 .../cmd/dtrace/test/tst/common/types/tst.typedef.d |    85 +
 .../cmd/dtrace/test/tst/common/types/tst.unaryop.d |    50 +
 .../cmd/dtrace/test/tst/common/union}/Makefile.kup |     0
 .../common/union/err.D_ADDROF_VAR.UnionPointer.d   |    60 +
 .../union/err.D_DECL_COMBO.UnionWithoutColon.d     |    69 +
 .../union/err.D_DECL_COMBO.UnionWithoutColon1.d    |    68 +
 .../common/union/err.D_DECL_INCOMPLETE.circular.d  |    65 +
 .../tst/common/union/err.D_DECL_INCOMPLETE.order.d |    69 +
 .../common/union/err.D_DECL_INCOMPLETE.recursive.d |    59 +
 .../common/union/err.D_DECL_INCOMPLETE.simple.d    |    58 +
 .../common/union/err.D_PROTO_ARG.DupUnionAssoc.d   |    80 +
 .../dtrace/test/tst/common/union/tst.UnionAssoc.d  |    71 +
 .../test/tst/common/union/tst.UnionDataTypes.d     |   132 +
 .../dtrace/test/tst/common/union/tst.UnionInside.d |    85 +
 .../cmd/dtrace/test/tst/common/usdt}/Makefile.kup  |     0
 .../onnv/cmd/dtrace/test/tst/common/usdt/argmap.d  |    31 +
 .../onnv/cmd/dtrace/test/tst/common/usdt/args.d    |    31 +
 .../onnv/cmd/dtrace/test/tst/common/usdt/forker.d  |    31 +
 .../cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh |    46 +
 .../cmd/dtrace/test/tst/common/usdt/tst.argmap.c   |    39 +
 .../cmd/dtrace/test/tst/common/usdt/tst.argmap.d   |    65 +
 .../cmd/dtrace/test/tst/common/usdt/tst.args.c     |    39 +
 .../cmd/dtrace/test/tst/common/usdt/tst.args.d     |    60 +
 .../dtrace/test/tst/common/usdt/tst.badguess.ksh   |    84 +
 .../dtrace/test/tst/common/usdt/tst.corruptenv.ksh |   107 +
 .../dtrace/test/tst/common/usdt/tst.dlclose1.ksh   |   159 +
 .../test/tst/common/usdt/tst.dlclose1.ksh.out      |     3 +
 .../dtrace/test/tst/common/usdt/tst.dlclose2.ksh   |   160 +
 .../test/tst/common/usdt/tst.dlclose2.ksh.out      |     2 +
 .../dtrace/test/tst/common/usdt/tst.dlclose3.ksh   |   170 +
 .../dtrace/test/tst/common/usdt/tst.eliminate.ksh  |   106 +
 .../dtrace/test/tst/common/usdt/tst.enabled.ksh    |    96 +
 .../test/tst/common/usdt/tst.enabled.ksh.out       |     2 +
 .../dtrace/test/tst/common/usdt/tst.enabled2.ksh   |   113 +
 .../test/tst/common/usdt/tst.enabled2.ksh.out      |     3 +
 .../test/tst/common/usdt/tst.entryreturn.ksh       |   118 +
 .../test/tst/common/usdt/tst.entryreturn.ksh.out   |    10 +
 .../cmd/dtrace/test/tst/common/usdt/tst.fork.ksh   |   105 +
 .../dtrace/test/tst/common/usdt/tst.fork.ksh.out   |     4 +
 .../cmd/dtrace/test/tst/common/usdt/tst.forker.c   |    47 +
 .../cmd/dtrace/test/tst/common/usdt/tst.forker.ksh |    55 +
 .../dtrace/test/tst/common/usdt/tst.guess32.ksh    |    96 +
 .../dtrace/test/tst/common/usdt/tst.guess64.ksh    |   100 +
 .../cmd/dtrace/test/tst/common/usdt/tst.header.ksh |    85 +
 .../dtrace/test/tst/common/usdt/tst.include.ksh    |    61 +
 .../dtrace/test/tst/common/usdt/tst.linkpriv.ksh   |    82 +
 .../dtrace/test/tst/common/usdt/tst.linkunpriv.ksh |    84 +
 .../dtrace/test/tst/common/usdt/tst.multiple.ksh   |    99 +
 .../test/tst/common/usdt/tst.multiple.ksh.out      |     5 +
 .../dtrace/test/tst/common/usdt/tst.nodtrace.ksh   |    90 +
 .../test/tst/common/usdt/tst.onlyenabled.ksh       |    82 +
 .../cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh |    98 +
 .../cmd/dtrace/test/tst/common/usdt/tst.static.ksh |    98 +
 .../dtrace/test/tst/common/usdt/tst.static.ksh.out |     5 +
 .../dtrace/test/tst/common/usdt/tst.static2.ksh    |   108 +
 .../test/tst/common/usdt/tst.static2.ksh.out       |     5 +
 .../cmd/dtrace/test/tst/common/usdt/tst.user.ksh   |    96 +
 .../dtrace/test/tst/common/usdt/tst.user.ksh.out   |     2 +
 .../dtrace/test/tst/common/ustack}/Makefile.kup    |     0
 .../dtrace/test/tst/common/ustack/tst.bigstack.c   |    61 +
 .../dtrace/test/tst/common/ustack/tst.bigstack.d   |    45 +
 .../dtrace/test/tst/common/ustack/tst.depth.ksh    |   110 +
 .../cmd/dtrace/test/tst/common/ustack/tst.spin.c   |    61 +
 .../cmd/dtrace/test/tst/common/ustack/tst.spin.ksh |   139 +
 .../cmd/dtrace/test/tst/common/vars}/Makefile.kup  |     0
 .../onnv/cmd/dtrace/test/tst/common/vars/tst.gid.d |    41 +
 .../dtrace/test/tst/common/vars/tst.nullassign.d   |    94 +
 .../cmd/dtrace/test/tst/common/vars/tst.ppid.d     |    41 +
 .../dtrace/test/tst/common/vars/tst.ucaller.ksh    |    65 +
 .../test/tst/common/vars/tst.ucaller.ksh.out       |     3 +
 .../onnv/cmd/dtrace/test/tst/common/vars/tst.uid.d |    41 +
 .../test/tst/common/vars/tst.walltimestamp.d       |    55 +
 .../dtrace/test/tst/common/version}/Makefile.kup   |     0
 .../cmd/dtrace/test/tst/common/version/tst.1.0.d   |    48 +
 .../onnv/cmd/dtrace/test/tst/i386/Makefile         |    51 +
 .../onnv/cmd/dtrace/test/tst/i386}/Makefile.kup    |     0
 .../cmd/dtrace/test/tst/i386/arrays}/Makefile.kup  |     0
 .../dtrace/test/tst/i386/arrays/tst.uregsarray.d   |    63 +
 .../cmd/dtrace/test/tst/i386/funcs}/Makefile.kup   |     0
 .../cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d |    52 +
 .../dtrace/test/tst/i386/funcs/tst.badcopyinstr.d  |    52 +
 .../dtrace/test/tst/i386/funcs/tst.badcopyout.d    |    56 +
 .../dtrace/test/tst/i386/funcs/tst.badcopyoutstr.d |    56 +
 .../cmd/dtrace/test/tst/i386/pid}/Makefile.kup     |     0
 .../cmd/dtrace/test/tst/i386/pid/tst.badinstr.d    |    40 +
 .../cmd/dtrace/test/tst/i386/pid/tst.badinstr.s    |    41 +
 .../onnv/cmd/dtrace/test/tst/i386/pid/tst.branch.d |    78 +
 .../onnv/cmd/dtrace/test/tst/i386/pid/tst.branch.s |    73 +
 .../cmd/dtrace/test/tst/i386/pid/tst.embedded.d    |    73 +
 .../cmd/dtrace/test/tst/i386/pid/tst.embedded.s    |    68 +
 .../onnv/cmd/dtrace/test/tst/i386/pid/tst.ret.d    |    76 +
 .../onnv/cmd/dtrace/test/tst/i386/pid/tst.ret.s    |   114 +
 .../cmd/dtrace/test/tst/i386/pid/tst.retlist.ksh   |    50 +
 .../cmd/dtrace/test/tst/i386/pid/tst.retlist.s     |    51 +
 .../cmd/dtrace/test/tst/i386/ustack}/Makefile.kup  |     0
 .../dtrace/test/tst/i386/ustack/annotated_helper.d |    32 +
 .../dtrace/test/tst/i386/ustack/helper_helper.d    |    32 +
 .../dtrace/test/tst/i386/ustack/tst.annotated.c    |    43 +
 .../dtrace/test/tst/i386/ustack/tst.annotated.d    |    35 +
 .../test/tst/i386/ustack/tst.annotated.d.out       |     4 +
 .../dtrace/test/tst/i386/ustack/tst.circstack.d    |    46 +
 .../dtrace/test/tst/i386/ustack/tst.circstack.s    |    43 +
 .../cmd/dtrace/test/tst/i386/ustack/tst.helper.c   |    82 +
 .../cmd/dtrace/test/tst/i386/ustack/tst.helper.d   |    44 +
 .../dtrace/test/tst/i386/ustack/tst.helper.d.out   |     4 +
 .../onnv/cmd/dtrace/test/tst/i86xpv/Makefile       |    29 +
 .../onnv/cmd/dtrace/test/tst/i86xpv}/Makefile.kup  |     0
 .../cmd/dtrace/test/tst/i86xpv/xdt}/Makefile.kup   |     0
 .../cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh   |    77 +
 .../dtrace/test/tst/i86xpv/xdt/tst.hvmenable.ksh   |    64 +
 .../dtrace/test/tst/i86xpv/xdt/tst.memenable.ksh   |    65 +
 .../dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh   |   121 +
 .../dtrace/test/tst/i86xpv/xdt/tst.schedenable.ksh |    74 +
 .../onnv/cmd/dtrace/test/tst/sparc/Makefile        |    51 +
 .../onnv/cmd/dtrace/test/tst/sparc}/Makefile.kup   |     0
 .../cmd/dtrace/test/tst/sparc/arrays}/Makefile.kup |     0
 .../dtrace/test/tst/sparc/arrays/tst.uregsarray.d  |    85 +
 .../cmd/dtrace/test/tst/sparc/pid}/Makefile.kup    |     0
 .../tst/sparc/pid/err.D_PROC_ALIGN.misaligned.d    |    40 +
 .../tst/sparc/pid/err.D_PROC_ALIGN.misaligned.exe  |    29 +
 .../onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.d    |    70 +
 .../cmd/dtrace/test/tst/sparc/pid/tst.br.d.out     |    23 +
 .../onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.s    |    81 +
 .../cmd/dtrace/test/tst/sparc/pid/tst.branch.d     |    78 +
 .../cmd/dtrace/test/tst/sparc/pid/tst.branch.s     |    63 +
 .../cmd/dtrace/test/tst/sparc/pid/tst.embedded.d   |    73 +
 .../cmd/dtrace/test/tst/sparc/pid/tst.embedded.s   |    59 +
 .../cmd/dtrace/test/tst/sparc/usdt}/Makefile.kup   |     0
 .../dtrace/test/tst/sparc/usdt/tst.tailcall.ksh    |   132 +
 .../cmd/dtrace/test/tst/sparc/ustack}/Makefile.kup |     0
 .../test/tst/sparc/ustack/annotated_helper.d       |    32 +
 .../dtrace/test/tst/sparc/ustack/helper_helper.d   |    32 +
 .../dtrace/test/tst/sparc/ustack/tst.annotated.c   |    43 +
 .../dtrace/test/tst/sparc/ustack/tst.annotated.d   |    35 +
 .../test/tst/sparc/ustack/tst.annotated.d.out      |     4 +
 .../dtrace/test/tst/sparc/ustack/tst.circstack.d   |    46 +
 .../dtrace/test/tst/sparc/ustack/tst.circstack.s   |    44 +
 .../cmd/dtrace/test/tst/sparc/ustack/tst.helper.c  |    81 +
 .../cmd/dtrace/test/tst/sparc/ustack/tst.helper.d  |    44 +
 .../dtrace/test/tst/sparc/ustack/tst.helper.d.out  |     4 +
 .../dtrace/test/tst/sparc/ustack/tst.trapstat.ksh  |    87 +
 .../VBoxDTrace/onnv/common}/Makefile.kup           |     0
 .../VBoxDTrace/onnv/common/ctf}/Makefile.kup       |     0
 .../VBoxDTrace/onnv/common/ctf/ctf_create.c        |  1369 ++
 .../ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_decl.c |   190 +
 .../VBoxDTrace/onnv/common/ctf/ctf_error.c         |    99 +
 .../ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_hash.c |   180 +
 .../ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_impl.h |   353 +
 .../VBoxDTrace/onnv/common/ctf/ctf_labels.c        |   155 +
 .../VBoxDTrace/onnv/common/ctf/ctf_lookup.c        |   317 +
 .../ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_open.c |   972 +
 .../VBoxDTrace/onnv/common/ctf/ctf_types.c         |   847 +
 .../ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_util.c |   154 +
 .../VBoxDTrace/onnv/common/dtrace}/Makefile.kup    |     0
 .../VBoxDTrace/onnv/common/dtrace/dtrace_data.c    |   113 +
 .../VBoxDTrace/onnv/lib}/Makefile.kup              |     0
 .../ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile   |    55 +
 .../VBoxDTrace/onnv/lib/libctf/Makefile.com        |    72 +
 .../VBoxDTrace/onnv/lib/libctf}/Makefile.kup       |     0
 .../VBoxDTrace/onnv/lib/libctf/amd64/Makefile      |    31 +
 .../onnv/lib/libctf/common}/Makefile.kup           |     0
 .../VBoxDTrace/onnv/lib/libctf/common/ctf_lib.c    |   595 +
 .../VBoxDTrace/onnv/lib/libctf/common/ctf_subr.c   |   118 +
 .../VBoxDTrace/onnv/lib/libctf/common/libctf.h     |    66 +
 .../VBoxDTrace/onnv/lib/libctf/common/llib-lctf    |    32 +
 .../VBoxDTrace/onnv/lib/libctf/common/mapfile-vers |   114 +
 .../VBoxDTrace/onnv/lib/libctf/i386/Makefile       |    30 +
 .../VBoxDTrace/onnv/lib/libctf/sparc/Makefile      |    30 +
 .../VBoxDTrace/onnv/lib/libctf/sparcv9/Makefile    |    31 +
 .../VBoxDTrace/onnv/lib/libdtrace/Makefile         |    63 +
 .../VBoxDTrace/onnv/lib/libdtrace/Makefile.com     |   233 +
 .../VBoxDTrace/onnv/lib/libdtrace}/Makefile.kup    |     0
 .../VBoxDTrace/onnv/lib/libdtrace/amd64/Makefile   |    46 +
 .../onnv/lib/libdtrace/amd64}/Makefile.kup         |     0
 .../onnv/lib/libdtrace/common}/Makefile.kup        |     0
 .../VBoxDTrace/onnv/lib/libdtrace/common/drti.c    |   190 +
 .../onnv/lib/libdtrace/common/dt_aggregate.c       |  1910 ++
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_as.c   |   505 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_as.h   |    66 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.c  |   181 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.h  |    71 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_cc.c   |  2306 ++
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_cg.c   |  1973 ++
 .../onnv/lib/libdtrace/common/dt_consume.c         |  2329 ++
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.c |  1129 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.h |   128 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_dis.c  |   513 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.c  |   968 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.h  |    68 +
 .../onnv/lib/libdtrace/common/dt_error.c           |   218 +
 .../onnv/lib/libdtrace/common/dt_errtags.h         |   249 +
 .../onnv/lib/libdtrace/common/dt_grammar.y         |   842 +
 .../onnv/lib/libdtrace/common/dt_handle.c          |   483 +
 .../onnv/lib/libdtrace/common/dt_ident.c           |  1045 +
 .../onnv/lib/libdtrace/common/dt_ident.h           |   185 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_impl.h |   669 +
 .../onnv/lib/libdtrace/common/dt_inttab.c          |   117 +
 .../onnv/lib/libdtrace/common/dt_inttab.h          |    71 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.l  |   914 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_link.c |  1634 ++
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_list.c |   117 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_list.h |    57 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_map.c  |   428 +
 .../onnv/lib/libdtrace/common/dt_module.c          |  1344 ++
 .../onnv/lib/libdtrace/common/dt_module.h          |    58 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_open.c |  1498 ++
 .../onnv/lib/libdtrace/common/dt_options.c         |  1080 +
 .../onnv/lib/libdtrace/common/dt_parser.c          |  4897 +++++
 .../onnv/lib/libdtrace/common/dt_parser.h          |   290 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.c  |   193 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.h  |   105 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.c  |   757 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.h  |    66 +
 .../onnv/lib/libdtrace/common/dt_pragma.c          |   507 +
 .../onnv/lib/libdtrace/common/dt_printf.c          |  2016 ++
 .../onnv/lib/libdtrace/common/dt_printf.h          |   137 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.c |  1111 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.h |   136 +
 .../onnv/lib/libdtrace/common/dt_program.c         |   619 +
 .../onnv/lib/libdtrace/common/dt_program.h         |    65 +
 .../onnv/lib/libdtrace/common/dt_provider.c        |   883 +
 .../onnv/lib/libdtrace/common/dt_provider.h        |   120 +
 .../onnv/lib/libdtrace/common/dt_regset.c          |   112 +
 .../onnv/lib/libdtrace/common/dt_regset.h          |    57 +
 .../onnv/lib/libdtrace/common/dt_string.c          |   348 +
 .../onnv/lib/libdtrace/common/dt_string.h          |    51 +
 .../onnv/lib/libdtrace/common/dt_strtab.c          |   295 +
 .../onnv/lib/libdtrace/common/dt_strtab.h          |    76 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_subr.c |  1002 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dt_work.c |   322 +
 .../onnv/lib/libdtrace/common/dt_xlator.c          |   385 +
 .../onnv/lib/libdtrace/common/dt_xlator.h          |    89 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/dtrace.h  |   587 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/fc.d      |   183 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/io.d.in   |   218 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/io.sed.in |    69 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/ip.d.in   |   374 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/ip.sed.in |    78 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/iscsit.d  |   454 +
 .../onnv/lib/libdtrace/common/llib-ldtrace         |    32 +
 .../onnv/lib/libdtrace/common/mapfile-vers         |   127 +
 .../onnv/lib/libdtrace/common/mkerrno.sh           |    40 +
 .../onnv/lib/libdtrace/common/mkerrtags.sed        |    33 +
 .../onnv/lib/libdtrace/common/mkerrtags.sh         |    61 +
 .../onnv/lib/libdtrace/common/mknames.sed          |    37 +
 .../onnv/lib/libdtrace/common/mknames.sh           |    53 +
 .../onnv/lib/libdtrace/common/mksignal.sh          |    40 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/net.d.in  |    44 +
 .../onnv/lib/libdtrace/common/net.sed.in           |    41 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/nfs.d     |   138 +
 .../onnv/lib/libdtrace/common/procfs.d.in          |   365 +
 .../onnv/lib/libdtrace/common/procfs.sed.in        |   163 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/sched.d   |    82 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/scsi.d    |    89 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/srp.d     |   168 +
 .../onnv/lib/libdtrace/common/sysevent.d.in        |    50 +
 .../onnv/lib/libdtrace/common/sysevent.sed.in      |    34 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/tcp.d.in  |   269 +
 .../onnv/lib/libdtrace/common/tcp.sed.in           |    53 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/udp.d.in  |    73 +
 .../onnv/lib/libdtrace/common/udp.sed.in           |    29 +
 .../VBoxDTrace/onnv/lib/libdtrace/common/unistd.d  |    56 +
 .../VBoxDTrace/onnv/lib/libdtrace/i386/Makefile    |    54 +
 .../onnv/lib/libdtrace/i386}/Makefile.kup          |     0
 .../VBoxDTrace/onnv/lib/libdtrace/i386/dt_isadep.c |   488 +
 .../VBoxDTrace/onnv/lib/libdtrace/i386/regs.d.in   |   117 +
 .../VBoxDTrace/onnv/lib/libdtrace/i386/regs.sed.in |    82 +
 .../VBoxDTrace/onnv/lib/libdtrace/sparc/Makefile   |    33 +
 .../onnv/lib/libdtrace/sparc}/Makefile.kup         |     0
 .../onnv/lib/libdtrace/sparc/dt_isadep.c           |   338 +
 .../VBoxDTrace/onnv/lib/libdtrace/sparc/regs.d     |   120 +
 .../VBoxDTrace/onnv/lib/libdtrace/sparcv9/Makefile |    36 +
 .../onnv/lib/libdtrace/sparcv9}/Makefile.kup       |     0
 .../VBoxDTrace/onnv/uts}/Makefile.kup              |     0
 .../VBoxDTrace/onnv/uts/common}/Makefile.kup       |     0
 .../onnv/uts/common/dtrace}/Makefile.kup           |     0
 .../VBoxDTrace/onnv/uts/common/dtrace/dcpc.c       |  1214 ++
 .../VBoxDTrace/onnv/uts/common/dtrace/dcpc.conf    |    33 +
 .../VBoxDTrace/onnv/uts/common/dtrace/dtrace.c     | 16255 ++++++++++++++
 .../VBoxDTrace/onnv/uts/common/dtrace/dtrace.conf  |    28 +
 .../VBoxDTrace/onnv/uts/common/dtrace/fasttrap.c   |  2378 ++
 .../VBoxDTrace/onnv/uts/common/dtrace/lockstat.c   |   343 +
 .../onnv/uts/common/dtrace/lockstat.conf           |    28 +
 .../VBoxDTrace/onnv/uts/common/dtrace/profile.c    |   577 +
 .../VBoxDTrace/onnv/uts/common/dtrace/profile.conf |    28 +
 .../VBoxDTrace/onnv/uts/common/dtrace/sdt_subr.c   |  1191 +
 .../VBoxDTrace/onnv/uts/common/dtrace/systrace.c   |   374 +
 .../onnv/uts/common/dtrace/systrace.conf           |    28 +
 .../VBoxDTrace/onnv/uts/common/os}/Makefile.kup    |     0
 .../VBoxDTrace/onnv/uts/common/os/dtrace_subr.c    |   337 +
 .../VBoxDTrace/onnv/uts/common/sys}/Makefile.kup   |     0
 .../ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf.h  |   364 +
 .../VBoxDTrace/onnv/uts/common/sys/ctf_api.h       |   251 +
 .../VBoxDTrace/onnv/uts/common/sys/dtrace.h        |  2272 ++
 .../VBoxDTrace/onnv/uts/common/sys/dtrace_impl.h   |  1304 ++
 .../VBoxDTrace/onnv/uts/i86pc}/Makefile.kup        |     0
 .../VBoxDTrace/onnv/uts/i86pc/os}/Makefile.kup     |     0
 .../VBoxDTrace/onnv/uts/i86pc/os/dtrace_subr.c     |   400 +
 .../VBoxDTrace/onnv/uts/intel}/Makefile.kup        |     0
 .../VBoxDTrace/onnv/uts/intel/dtrace/Makefile      |    76 +
 .../VBoxDTrace/onnv/uts/intel/dtrace}/Makefile.kup |     0
 .../VBoxDTrace/onnv/uts/intel/dtrace/dtrace_asm.s  |   457 +
 .../VBoxDTrace/onnv/uts/intel/dtrace/dtrace_isa.c  |   746 +
 .../VBoxDTrace/onnv/uts/intel/dtrace/fasttrap.conf |    39 +
 .../onnv/uts/intel/dtrace/fasttrap_isa.c           |  1745 ++
 .../VBoxDTrace/onnv/uts/intel/dtrace/fbt.c         |   849 +
 .../VBoxDTrace/onnv/uts/intel/dtrace/fbt.conf      |    28 +
 .../VBoxDTrace/onnv/uts/intel/dtrace/sdt.c         |   557 +
 .../VBoxDTrace/onnv/uts/intel/dtrace/sdt.conf      |    28 +
 src/VBox/ExtPacks/VNC/VBoxVNC.cpp                  |     3 +
 .../Frontends/VBoxAutostart/VBoxAutostartStop.cpp  |     4 +-
 .../Frontends/VBoxAutostart/VBoxAutostartUtils.cpp |    20 +-
 .../Frontends/VBoxBalloonCtrl/VBoxBalloonCtrl.rc   |    21 +-
 .../VBoxBalloonCtrl/VBoxModAPIMonitor.cpp          |     8 +-
 src/VBox/Frontends/VBoxFB/VBoxFB.cpp               |     4 +-
 src/VBox/Frontends/VBoxHeadless/Framebuffer.cpp    |   300 -
 src/VBox/Frontends/VBoxHeadless/Framebuffer.h      |    97 -
 src/VBox/Frontends/VBoxHeadless/Makefile.kmk       |     1 -
 src/VBox/Frontends/VBoxHeadless/NullFramebuffer.h  |   233 -
 src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp   |   400 +-
 src/VBox/Frontends/VBoxHeadless/VBoxHeadless.h     |    31 -
 src/VBox/Frontends/VBoxHeadless/VBoxHeadless.rc    |    29 +-
 .../Frontends/VBoxManage/VBoxInternalManage.cpp    |    62 +-
 src/VBox/Frontends/VBoxManage/VBoxManage.cpp       |    68 +-
 src/VBox/Frontends/VBoxManage/VBoxManage.h         |    61 +-
 src/VBox/Frontends/VBoxManage/VBoxManage.rc        |    21 +-
 .../Frontends/VBoxManage/VBoxManageAppliance.cpp   |   155 +-
 .../VBoxManage/VBoxManageBandwidthControl.cpp      |     3 +-
 .../Frontends/VBoxManage/VBoxManageControlVM.cpp   |   269 +-
 .../Frontends/VBoxManage/VBoxManageDebugVM.cpp     |    20 +-
 src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp   |   945 +-
 .../Frontends/VBoxManage/VBoxManageGuestCtrl.cpp   |  3168 +--
 .../Frontends/VBoxManage/VBoxManageGuestCtrl.h     |     8 +-
 .../VBoxManage/VBoxManageGuestCtrlListener.cpp     |    48 +-
 src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp   |    91 +-
 src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp   |   217 +-
 src/VBox/Frontends/VBoxManage/VBoxManageList.cpp   |    74 +-
 src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp   |    53 +-
 .../Frontends/VBoxManage/VBoxManageModifyVM.cpp    |   488 +-
 .../Frontends/VBoxManage/VBoxManageNATNetwork.cpp  |     4 +-
 .../Frontends/VBoxManage/VBoxManageSnapshot.cpp    |   100 +-
 .../VBoxManage/VBoxManageStorageController.cpp     |    66 +-
 src/VBox/Frontends/VBoxSDL/Framebuffer-darwin.m    |    24 +
 src/VBox/Frontends/VBoxSDL/Framebuffer.cpp         |   400 +-
 src/VBox/Frontends/VBoxSDL/Framebuffer.h           |    80 +-
 src/VBox/Frontends/VBoxSDL/Helper.cpp              |     1 +
 src/VBox/Frontends/VBoxSDL/Helper.h                |     1 +
 src/VBox/Frontends/VBoxSDL/Makefile.kmk            |    47 +-
 src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp             |   269 +-
 src/VBox/Frontends/VBoxSDL/VBoxSDL.h               |    14 +-
 src/VBox/Frontends/VBoxSDL/VBoxSDL.rc              |    68 -
 src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.h    |     1 +
 src/VBox/Frontends/VBoxSDL/VBoxSDLTest.cpp         |     1 +
 src/VBox/Frontends/VBoxShell/vboxshell.py          |    37 +-
 src/VBox/Frontends/VirtualBox/Doxyfile             |  1509 ++
 src/VBox/Frontends/VirtualBox/Makefile.kmk         |   269 +-
 src/VBox/Frontends/VirtualBox/VBoxUI.pro           |     3 +-
 src/VBox/Frontends/VirtualBox/VirtualBox1.qrc      |   524 +-
 .../Frontends/VirtualBox/VirtualBox1_hidpi.qrc     |   273 +
 src/VBox/Frontends/VirtualBox/VirtualBox2.qrc      |   426 +-
 .../Frontends/VirtualBox/VirtualBox2_hidpi.qrc     |   275 +
 src/VBox/Frontends/VirtualBox/VirtualBoxBrand.qrc  |     2 +
 .../VirtualBox/images/add_host_iface_16px.png      |   Bin 3317 -> 658 bytes
 .../images/add_host_iface_disabled_16px.png        |   Bin 3290 -> 631 bytes
 .../VirtualBox/images/adjust_win_size_16px.png     |   Bin 3097 -> 624 bytes
 .../images/adjust_win_size_disabled_16px.png       |   Bin 3068 -> 598 bytes
 .../VirtualBox/images/arrow_down_10px.png          |   Bin 3062 -> 402 bytes
 .../VirtualBox/images/arrow_left_10px.png          |   Bin 3075 -> 416 bytes
 .../VirtualBox/images/arrow_right_10px.png         |   Bin 3057 -> 402 bytes
 .../Frontends/VirtualBox/images/arrow_up_10px.png  |   Bin 3045 -> 386 bytes
 .../VirtualBox/images/attachment_16px.png          |   Bin 3090 -> 0 bytes
 .../VirtualBox/images/attachment_add_16px.png      |   Bin 3312 -> 653 bytes
 .../images/attachment_add_disabled_16px.png        |   Bin 3275 -> 616 bytes
 .../VirtualBox/images/attachment_disabled_16px.png |   Bin 3069 -> 0 bytes
 .../VirtualBox/images/attachment_remove_16px.png   |   Bin 3178 -> 519 bytes
 .../images/attachment_remove_disabled_16px.png     |   Bin 3143 -> 484 bytes
 .../VirtualBox/images/auto_resize_off_16px.png     |   Bin 3173 -> 0 bytes
 .../images/auto_resize_off_disabled_16px.png       |   Bin 3173 -> 0 bytes
 .../VirtualBox/images/auto_resize_on_16px.png      |   Bin 3219 -> 507 bytes
 .../images/auto_resize_on_disabled_16px.png        |   Bin 3173 -> 421 bytes
 .../VirtualBox/images/auto_resize_on_on_16px.png   |   Bin 3182 -> 491 bytes
 .../images/auto_resize_on_on_disabled_16px.png     |   Bin 3165 -> 431 bytes
 .../Frontends/VirtualBox/images/cancel_16px.png    |   Bin 3507 -> 847 bytes
 src/VBox/Frontends/VirtualBox/images/cd_16px.png   |   Bin 3566 -> 906 bytes
 src/VBox/Frontends/VirtualBox/images/cd_32px.png   |   Bin 4819 -> 0 bytes
 .../Frontends/VirtualBox/images/cd_add_16px.png    |   Bin 3584 -> 924 bytes
 .../VirtualBox/images/cd_add_disabled_16px.png     |   Bin 3579 -> 919 bytes
 .../Frontends/VirtualBox/images/cd_copy_16px.png   |   Bin 0 -> 829 bytes
 .../Frontends/VirtualBox/images/cd_copy_22px.png   |   Bin 0 -> 1312 bytes
 .../VirtualBox/images/cd_copy_disabled_16px.png    |   Bin 0 -> 895 bytes
 .../VirtualBox/images/cd_copy_disabled_22px.png    |   Bin 0 -> 1332 bytes
 .../VirtualBox/images/cd_disabled_16px.png         |   Bin 3589 -> 929 bytes
 .../VirtualBox/images/cd_disabled_32px.png         |   Bin 4796 -> 0 bytes
 .../Frontends/VirtualBox/images/cd_modify_16px.png |   Bin 0 -> 930 bytes
 .../Frontends/VirtualBox/images/cd_modify_22px.png |   Bin 0 -> 1379 bytes
 .../VirtualBox/images/cd_modify_disabled_16px.png  |   Bin 0 -> 972 bytes
 .../VirtualBox/images/cd_modify_disabled_22px.png  |   Bin 0 -> 1475 bytes
 .../Frontends/VirtualBox/images/cd_read_16px.png   |   Bin 3603 -> 944 bytes
 .../VirtualBox/images/cd_release_16px.png          |   Bin 0 -> 954 bytes
 .../VirtualBox/images/cd_release_22px.png          |   Bin 0 -> 1402 bytes
 .../VirtualBox/images/cd_release_disabled_16px.png |   Bin 0 -> 968 bytes
 .../VirtualBox/images/cd_release_disabled_22px.png |   Bin 0 -> 1441 bytes
 .../Frontends/VirtualBox/images/cd_remove_16px.png |   Bin 0 -> 877 bytes
 .../Frontends/VirtualBox/images/cd_remove_22px.png |   Bin 0 -> 1264 bytes
 .../VirtualBox/images/cd_remove_disabled_16px.png  |   Bin 0 -> 880 bytes
 .../VirtualBox/images/cd_remove_disabled_22px.png  |   Bin 0 -> 1297 bytes
 .../VirtualBox/images/cd_unmount_16px.png          |   Bin 3615 -> 957 bytes
 .../VirtualBox/images/cd_unmount_dis_16px.png      |   Bin 3639 -> 0 bytes
 .../VirtualBox/images/cd_unmount_disabled_16px.png |   Bin 0 -> 980 bytes
 .../Frontends/VirtualBox/images/cd_write_16px.png  |   Bin 3592 -> 933 bytes
 .../Frontends/VirtualBox/images/chipset_16px.png   |   Bin 3148 -> 489 bytes
 .../Frontends/VirtualBox/images/chipset_24px.png   |   Bin 0 -> 743 bytes
 .../Frontends/VirtualBox/images/chipset_32px.png   |   Bin 3563 -> 903 bytes
 .../VirtualBox/images/chipset_disabled_16px.png    |   Bin 3109 -> 0 bytes
 .../VirtualBox/images/chipset_disabled_32px.png    |   Bin 3485 -> 0 bytes
 .../VirtualBox/images/chipset_warning_16px.png     |   Bin 3350 -> 687 bytes
 .../Frontends/VirtualBox/images/close_16px.png     |   Bin 3487 -> 828 bytes
 .../VirtualBox/images/close_popup_16px.png         |   Bin 3460 -> 801 bytes
 .../Frontends/VirtualBox/images/connect_16px.png   |   Bin 3480 -> 821 bytes
 .../VirtualBox/images/controller_add_16px.png      |   Bin 3472 -> 813 bytes
 .../images/controller_add_disabled_16px.png        |   Bin 3440 -> 787 bytes
 .../VirtualBox/images/controller_remove_16px.png   |   Bin 3427 -> 768 bytes
 .../images/controller_remove_disabled_16px.png     |   Bin 3382 -> 739 bytes
 src/VBox/Frontends/VirtualBox/images/cpu_16px.png  |   Bin 3198 -> 538 bytes
 .../VirtualBox/images/description_16px.png         |   Bin 3488 -> 829 bytes
 .../images/description_disabled_16px.png           |   Bin 3501 -> 0 bytes
 .../VirtualBox/images/description_edit_16px.png    |   Bin 3538 -> 0 bytes
 .../images/description_edit_disabled_16px.png      |   Bin 3560 -> 0 bytes
 .../VirtualBox/images/discard_cur_state_16px.png   |   Bin 3300 -> 0 bytes
 .../VirtualBox/images/discard_cur_state_22px.png   |   Bin 3503 -> 0 bytes
 .../images/discard_cur_state_dis_16px.png          |   Bin 3266 -> 0 bytes
 .../images/discard_cur_state_dis_22px.png          |   Bin 3465 -> 0 bytes
 .../images/discard_cur_state_snapshot_16px.png     |   Bin 3496 -> 0 bytes
 .../images/discard_cur_state_snapshot_22px.png     |   Bin 3729 -> 0 bytes
 .../images/discard_cur_state_snapshot_dis_16px.png |   Bin 3466 -> 0 bytes
 .../images/discard_cur_state_snapshot_dis_22px.png |   Bin 3702 -> 0 bytes
 .../VirtualBox/images/disconnect_16px.png          |   Bin 3466 -> 807 bytes
 .../Frontends/VirtualBox/images/diskimage_16px.png |   Bin 3424 -> 765 bytes
 .../Frontends/VirtualBox/images/diskimage_32px.png |   Bin 4315 -> 1656 bytes
 .../VirtualBox/images/diskimage_disabled_32px.png  |   Bin 4159 -> 0 bytes
 .../VirtualBox/images/display_hardware_16px.png    |   Bin 0 -> 507 bytes
 .../images/display_hardware_write_16px.png         |   Bin 0 -> 616 bytes
 .../VirtualBox/images/display_software_16px.png    |   Bin 0 -> 397 bytes
 .../Frontends/VirtualBox/images/drag_drop_16px.png |   Bin 3376 -> 717 bytes
 .../VirtualBox/images/drag_drop_disabled_16px.png  |   Bin 3335 -> 676 bytes
 .../Frontends/VirtualBox/images/edata_add_16px.png |   Bin 0 -> 639 bytes
 .../Frontends/VirtualBox/images/edata_add_22px.png |   Bin 0 -> 937 bytes
 .../VirtualBox/images/edata_add_disabled_16px.png  |   Bin 0 -> 613 bytes
 .../VirtualBox/images/edata_add_disabled_22px.png  |   Bin 0 -> 831 bytes
 .../VirtualBox/images/edata_load_16px.png          |   Bin 0 -> 670 bytes
 .../VirtualBox/images/edata_load_22px.png          |   Bin 0 -> 1016 bytes
 .../VirtualBox/images/edata_load_disabled_16px.png |   Bin 0 -> 658 bytes
 .../VirtualBox/images/edata_load_disabled_22px.png |   Bin 0 -> 940 bytes
 .../VirtualBox/images/edata_remove_16px.png        |   Bin 0 -> 548 bytes
 .../VirtualBox/images/edata_remove_22px.png        |   Bin 0 -> 772 bytes
 .../images/edata_remove_disabled_16px.png          |   Bin 0 -> 530 bytes
 .../images/edata_remove_disabled_22px.png          |   Bin 0 -> 711 bytes
 .../VirtualBox/images/edata_save_16px.png          |   Bin 0 -> 682 bytes
 .../VirtualBox/images/edata_save_22px.png          |   Bin 0 -> 1021 bytes
 .../VirtualBox/images/edata_save_disabled_16px.png |   Bin 0 -> 666 bytes
 .../VirtualBox/images/edata_save_disabled_22px.png |   Bin 0 -> 957 bytes
 .../VirtualBox/images/edataglobal_32px.png         |   Bin 0 -> 460 bytes
 .../Frontends/VirtualBox/images/edataman_16px.png  |   Bin 0 -> 685 bytes
 .../Frontends/VirtualBox/images/edataman_32px.png  |   Bin 0 -> 1744 bytes
 .../Frontends/VirtualBox/images/eraser_16px.png    |   Bin 3389 -> 730 bytes
 .../VirtualBox/images/eraser_disabled_16px.png     |   Bin 3347 -> 0 bytes
 src/VBox/Frontends/VirtualBox/images/exit_16px.png |   Bin 3277 -> 617 bytes
 .../images/expanding_collapsing_16px.png           |   Bin 3215 -> 555 bytes
 .../Frontends/VirtualBox/images/export_16px.png    |   Bin 3476 -> 817 bytes
 .../VirtualBox/images/extension_pack_16px.png      |   Bin 3102 -> 443 bytes
 .../VirtualBox/images/extension_pack_24px.png      |   Bin 0 -> 564 bytes
 .../VirtualBox/images/extension_pack_32px.png      |   Bin 3623 -> 963 bytes
 .../images/extension_pack_disabled_16px.png        |   Bin 3070 -> 0 bytes
 .../images/extension_pack_disabled_32px.png        |   Bin 3461 -> 0 bytes
 .../images/extension_pack_install_16px.png         |   Bin 3376 -> 709 bytes
 .../images/extension_pack_install_32px.png         |   Bin 4061 -> 0 bytes
 .../extension_pack_install_disabled_16px.png       |   Bin 3344 -> 685 bytes
 .../extension_pack_install_disabled_32px.png       |   Bin 3881 -> 0 bytes
 .../images/extension_pack_uninstall_16px.png       |   Bin 3445 -> 781 bytes
 .../images/extension_pack_uninstall_32px.png       |   Bin 4390 -> 0 bytes
 .../extension_pack_uninstall_disabled_16px.png     |   Bin 3360 -> 700 bytes
 .../extension_pack_uninstall_disabled_32px.png     |   Bin 4202 -> 0 bytes
 .../images/extension_pack_warning_16px.png         |   Bin 3365 -> 705 bytes
 src/VBox/Frontends/VirtualBox/images/fd_16px.png   |   Bin 3143 -> 484 bytes
 src/VBox/Frontends/VirtualBox/images/fd_32px.png   |   Bin 3719 -> 0 bytes
 .../Frontends/VirtualBox/images/fd_add_16px.png    |   Bin 3335 -> 675 bytes
 .../VirtualBox/images/fd_add_disabled_16px.png     |   Bin 3295 -> 636 bytes
 .../Frontends/VirtualBox/images/fd_copy_16px.png   |   Bin 0 -> 596 bytes
 .../Frontends/VirtualBox/images/fd_copy_22px.png   |   Bin 0 -> 773 bytes
 .../VirtualBox/images/fd_copy_disabled_16px.png    |   Bin 0 -> 553 bytes
 .../VirtualBox/images/fd_copy_disabled_22px.png    |   Bin 0 -> 712 bytes
 .../VirtualBox/images/fd_disabled_16px.png         |   Bin 3120 -> 461 bytes
 .../VirtualBox/images/fd_disabled_32px.png         |   Bin 3526 -> 0 bytes
 .../Frontends/VirtualBox/images/fd_modify_16px.png |   Bin 0 -> 645 bytes
 .../Frontends/VirtualBox/images/fd_modify_22px.png |   Bin 0 -> 961 bytes
 .../VirtualBox/images/fd_modify_disabled_16px.png  |   Bin 0 -> 623 bytes
 .../VirtualBox/images/fd_modify_disabled_22px.png  |   Bin 0 -> 901 bytes
 .../Frontends/VirtualBox/images/fd_read_16px.png   |   Bin 3308 -> 649 bytes
 .../VirtualBox/images/fd_release_16px.png          |   Bin 0 -> 760 bytes
 .../VirtualBox/images/fd_release_22px.png          |   Bin 0 -> 1012 bytes
 .../VirtualBox/images/fd_release_disabled_16px.png |   Bin 0 -> 715 bytes
 .../VirtualBox/images/fd_release_disabled_22px.png |   Bin 0 -> 919 bytes
 .../Frontends/VirtualBox/images/fd_remove_16px.png |   Bin 0 -> 558 bytes
 .../Frontends/VirtualBox/images/fd_remove_22px.png |   Bin 0 -> 739 bytes
 .../VirtualBox/images/fd_remove_disabled_16px.png  |   Bin 0 -> 525 bytes
 .../VirtualBox/images/fd_remove_disabled_22px.png  |   Bin 0 -> 671 bytes
 .../VirtualBox/images/fd_unmount_16px.png          |   Bin 3435 -> 774 bytes
 .../VirtualBox/images/fd_unmount_dis_16px.png      |   Bin 3380 -> 0 bytes
 .../VirtualBox/images/fd_unmount_disabled_16px.png |   Bin 0 -> 721 bytes
 .../Frontends/VirtualBox/images/fd_write_16px.png  |   Bin 3306 -> 646 bytes
 .../Frontends/VirtualBox/images/floppy_16px.png    |   Bin 3428 -> 769 bytes
 .../VirtualBox/images/floppy_add_16px.png          |   Bin 3534 -> 871 bytes
 .../VirtualBox/images/floppy_add_disabled_16px.png |   Bin 3499 -> 840 bytes
 .../VirtualBox/images/floppy_collapse_16px.png     |   Bin 3443 -> 784 bytes
 .../VirtualBox/images/floppy_expand_16px.png       |   Bin 3510 -> 848 bytes
 .../VirtualBox/images/fullscreen_16px.png          |   Bin 3010 -> 258 bytes
 .../VirtualBox/images/fullscreen_disabled_16px.png |   Bin 3011 -> 252 bytes
 .../VirtualBox/images/fullscreen_on_16px.png       |   Bin 3055 -> 332 bytes
 .../images/fullscreen_on_disabled_16px.png         |   Bin 3041 -> 333 bytes
 .../VirtualBox/images/global_settings_16px.png     |   Bin 3369 -> 710 bytes
 .../images/global_settings_disabled_16px.png       |   Bin 3367 -> 0 bytes
 .../VirtualBox/images/group_abstract_16px.png      |   Bin 3125 -> 466 bytes
 .../VirtualBox/images/guesttools_16px.png          |   Bin 3276 -> 622 bytes
 .../VirtualBox/images/guesttools_disabled_16px.png |   Bin 3248 -> 589 bytes
 src/VBox/Frontends/VirtualBox/images/hd_16px.png   |   Bin 3392 -> 732 bytes
 src/VBox/Frontends/VirtualBox/images/hd_24px.png   |   Bin 0 -> 1155 bytes
 src/VBox/Frontends/VirtualBox/images/hd_32px.png   |   Bin 4486 -> 1827 bytes
 .../Frontends/VirtualBox/images/hd_add_16px.png    |   Bin 3469 -> 809 bytes
 .../Frontends/VirtualBox/images/hd_add_22px.png    |   Bin 3811 -> 0 bytes
 .../VirtualBox/images/hd_add_disabled_16px.png     |   Bin 3433 -> 774 bytes
 .../VirtualBox/images/hd_add_disabled_22px.png     |   Bin 3397 -> 0 bytes
 .../Frontends/VirtualBox/images/hd_copy_16px.png   |   Bin 0 -> 738 bytes
 .../Frontends/VirtualBox/images/hd_copy_22px.png   |   Bin 0 -> 1027 bytes
 .../VirtualBox/images/hd_copy_disabled_16px.png    |   Bin 0 -> 698 bytes
 .../VirtualBox/images/hd_copy_disabled_22px.png    |   Bin 0 -> 951 bytes
 .../VirtualBox/images/hd_disabled_16px.png         |   Bin 3357 -> 697 bytes
 .../VirtualBox/images/hd_disabled_32px.png         |   Bin 4390 -> 0 bytes
 .../Frontends/VirtualBox/images/hd_modify_16px.png |   Bin 0 -> 847 bytes
 .../Frontends/VirtualBox/images/hd_modify_22px.png |   Bin 0 -> 1229 bytes
 .../VirtualBox/images/hd_modify_disabled_16px.png  |   Bin 0 -> 815 bytes
 .../VirtualBox/images/hd_modify_disabled_22px.png  |   Bin 0 -> 1207 bytes
 .../Frontends/VirtualBox/images/hd_new_16px.png    |   Bin 3507 -> 848 bytes
 .../Frontends/VirtualBox/images/hd_new_22px.png    |   Bin 3900 -> 0 bytes
 .../VirtualBox/images/hd_new_disabled_16px.png     |   Bin 3475 -> 815 bytes
 .../VirtualBox/images/hd_new_disabled_22px.png     |   Bin 3867 -> 0 bytes
 .../Frontends/VirtualBox/images/hd_read_16px.png   |   Bin 3515 -> 856 bytes
 .../VirtualBox/images/hd_release_16px.png          |   Bin 3529 -> 870 bytes
 .../VirtualBox/images/hd_release_22px.png          |   Bin 3876 -> 1217 bytes
 .../VirtualBox/images/hd_release_disabled_16px.png |   Bin 3485 -> 826 bytes
 .../VirtualBox/images/hd_release_disabled_22px.png |   Bin 3819 -> 1160 bytes
 .../Frontends/VirtualBox/images/hd_remove_16px.png |   Bin 3401 -> 741 bytes
 .../Frontends/VirtualBox/images/hd_remove_22px.png |   Bin 3668 -> 1010 bytes
 .../VirtualBox/images/hd_remove_disabled_16px.png  |   Bin 3361 -> 701 bytes
 .../VirtualBox/images/hd_remove_disabled_22px.png  |   Bin 3606 -> 947 bytes
 .../VirtualBox/images/hd_settings_16px.png         |   Bin 0 -> 875 bytes
 .../images/hd_settings_disabled_16px.png           |   Bin 0 -> 847 bytes
 .../VirtualBox/images/hd_warning_16px.png          |   Bin 3452 -> 793 bytes
 .../Frontends/VirtualBox/images/hd_write_16px.png  |   Bin 3510 -> 851 bytes
 src/VBox/Frontends/VirtualBox/images/help_16px.png |   Bin 3328 -> 668 bytes
 .../images/help_button_normal_mac_22px.png         |   Bin 4096 -> 1437 bytes
 .../images/help_button_pressed_mac_22px.png        |   Bin 4107 -> 1448 bytes
 .../images/hidpi/add_host_iface_16px_hidpi.png     |   Bin 0 -> 1321 bytes
 .../hidpi/add_host_iface_disabled_16px_hidpi.png   |   Bin 0 -> 1153 bytes
 .../images/hidpi/adjust_win_size_16px_hidpi.png    |   Bin 0 -> 1481 bytes
 .../hidpi/adjust_win_size_disabled_16px_hidpi.png  |   Bin 0 -> 1282 bytes
 .../images/hidpi/arrow_down_10px_hidpi.png         |   Bin 0 -> 739 bytes
 .../images/hidpi/arrow_left_10px_hidpi.png         |   Bin 0 -> 777 bytes
 .../images/hidpi/arrow_right_10px_hidpi.png        |   Bin 0 -> 808 bytes
 .../images/hidpi/arrow_up_10px_hidpi.png           |   Bin 0 -> 767 bytes
 .../images/hidpi/attachment_add_16px_hidpi.png     |   Bin 0 -> 1623 bytes
 .../hidpi/attachment_add_disabled_16px_hidpi.png   |   Bin 0 -> 1353 bytes
 .../images/hidpi/attachment_remove_16px_hidpi.png  |   Bin 0 -> 1156 bytes
 .../attachment_remove_disabled_16px_hidpi.png      |   Bin 0 -> 1009 bytes
 .../images/hidpi/auto_resize_on_16px_hidpi.png     |   Bin 0 -> 1099 bytes
 .../hidpi/auto_resize_on_disabled_16px_hidpi.png   |   Bin 0 -> 934 bytes
 .../images/hidpi/auto_resize_on_on_16px_hidpi.png  |   Bin 0 -> 1001 bytes
 .../auto_resize_on_on_disabled_16px_hidpi.png      |   Bin 0 -> 882 bytes
 .../VirtualBox/images/hidpi/cancel_16px_hidpi.png  |   Bin 0 -> 2156 bytes
 .../VirtualBox/images/hidpi/cd_16px_hidpi.png      |   Bin 0 -> 2160 bytes
 .../VirtualBox/images/hidpi/cd_add_16px_hidpi.png  |   Bin 0 -> 2329 bytes
 .../images/hidpi/cd_add_disabled_16px_hidpi.png    |   Bin 0 -> 2250 bytes
 .../VirtualBox/images/hidpi/cd_copy_16px_hidpi.png |   Bin 0 -> 1934 bytes
 .../VirtualBox/images/hidpi/cd_copy_22px_hidpi.png |   Bin 0 -> 2837 bytes
 .../images/hidpi/cd_copy_disabled_16px_hidpi.png   |   Bin 0 -> 1985 bytes
 .../images/hidpi/cd_copy_disabled_22px_hidpi.png   |   Bin 0 -> 2952 bytes
 .../images/hidpi/cd_disabled_16px_hidpi.png        |   Bin 0 -> 2137 bytes
 .../images/hidpi/cd_modify_16px_hidpi.png          |   Bin 0 -> 2398 bytes
 .../images/hidpi/cd_modify_22px_hidpi.png          |   Bin 0 -> 3668 bytes
 .../images/hidpi/cd_modify_disabled_16px_hidpi.png |   Bin 0 -> 2378 bytes
 .../images/hidpi/cd_modify_disabled_22px_hidpi.png |   Bin 0 -> 3406 bytes
 .../VirtualBox/images/hidpi/cd_read_16px_hidpi.png |   Bin 0 -> 2428 bytes
 .../images/hidpi/cd_release_16px_hidpi.png         |   Bin 0 -> 2467 bytes
 .../images/hidpi/cd_release_22px_hidpi.png         |   Bin 0 -> 3846 bytes
 .../hidpi/cd_release_disabled_16px_hidpi.png       |   Bin 0 -> 2402 bytes
 .../hidpi/cd_release_disabled_22px_hidpi.png       |   Bin 0 -> 3513 bytes
 .../images/hidpi/cd_remove_16px_hidpi.png          |   Bin 0 -> 2050 bytes
 .../images/hidpi/cd_remove_22px_hidpi.png          |   Bin 0 -> 3206 bytes
 .../images/hidpi/cd_remove_disabled_16px_hidpi.png |   Bin 0 -> 1979 bytes
 .../images/hidpi/cd_remove_disabled_22px_hidpi.png |   Bin 0 -> 2962 bytes
 .../images/hidpi/cd_unmount_16px_hidpi.png         |   Bin 0 -> 2526 bytes
 .../hidpi/cd_unmount_disabled_16px_hidpi.png       |   Bin 0 -> 2488 bytes
 .../images/hidpi/cd_write_16px_hidpi.png           |   Bin 0 -> 2358 bytes
 .../VirtualBox/images/hidpi/chipset_16px_hidpi.png |   Bin 0 -> 903 bytes
 .../VirtualBox/images/hidpi/chipset_24px_hidpi.png |   Bin 0 -> 1254 bytes
 .../VirtualBox/images/hidpi/chipset_32px_hidpi.png |   Bin 0 -> 1472 bytes
 .../images/hidpi/chipset_warning_16px_hidpi.png    |   Bin 0 -> 1618 bytes
 .../VirtualBox/images/hidpi/close_16px_hidpi.png   |   Bin 0 -> 2319 bytes
 .../images/hidpi/close_popup_16px_hidpi.png        |   Bin 0 -> 1835 bytes
 .../VirtualBox/images/hidpi/connect_16px_hidpi.png |   Bin 0 -> 1886 bytes
 .../images/hidpi/controller_add_16px_hidpi.png     |   Bin 0 -> 2308 bytes
 .../hidpi/controller_add_disabled_16px_hidpi.png   |   Bin 0 -> 2127 bytes
 .../images/hidpi/controller_remove_16px_hidpi.png  |   Bin 0 -> 2004 bytes
 .../controller_remove_disabled_16px_hidpi.png      |   Bin 0 -> 1899 bytes
 .../VirtualBox/images/hidpi/cpu_16px_hidpi.png     |   Bin 0 -> 1008 bytes
 .../images/hidpi/description_16px_hidpi.png        |   Bin 0 -> 1910 bytes
 .../images/hidpi/disconnect_16px_hidpi.png         |   Bin 0 -> 2158 bytes
 .../images/hidpi/diskimage_16px_hidpi.png          |   Bin 0 -> 1656 bytes
 .../images/hidpi/diskimage_32px_hidpi.png          |   Bin 0 -> 3514 bytes
 .../images/hidpi/display_hardware_16px_hidpi.png   |   Bin 0 -> 951 bytes
 .../hidpi/display_hardware_write_16px_hidpi.png    |   Bin 0 -> 1342 bytes
 .../images/hidpi/display_software_16px_hidpi.png   |   Bin 0 -> 682 bytes
 .../images/hidpi/drag_drop_16px_hidpi.png          |   Bin 0 -> 1468 bytes
 .../images/hidpi/drag_drop_disabled_16px_hidpi.png |   Bin 0 -> 1346 bytes
 .../images/hidpi/edata_add_16px_hidpi.png          |   Bin 0 -> 1357 bytes
 .../images/hidpi/edata_add_22px_hidpi.png          |   Bin 0 -> 1906 bytes
 .../images/hidpi/edata_add_disabled_16px_hidpi.png |   Bin 0 -> 1145 bytes
 .../images/hidpi/edata_add_disabled_22px_hidpi.png |   Bin 0 -> 1545 bytes
 .../images/hidpi/edata_load_16px_hidpi.png         |   Bin 0 -> 1559 bytes
 .../images/hidpi/edata_load_22px_hidpi.png         |   Bin 0 -> 2324 bytes
 .../hidpi/edata_load_disabled_16px_hidpi.png       |   Bin 0 -> 1496 bytes
 .../hidpi/edata_load_disabled_22px_hidpi.png       |   Bin 0 -> 2178 bytes
 .../images/hidpi/edata_remove_16px_hidpi.png       |   Bin 0 -> 1021 bytes
 .../images/hidpi/edata_remove_22px_hidpi.png       |   Bin 0 -> 1405 bytes
 .../hidpi/edata_remove_disabled_16px_hidpi.png     |   Bin 0 -> 897 bytes
 .../hidpi/edata_remove_disabled_22px_hidpi.png     |   Bin 0 -> 1247 bytes
 .../images/hidpi/edata_save_16px_hidpi.png         |   Bin 0 -> 1525 bytes
 .../images/hidpi/edata_save_22px_hidpi.png         |   Bin 0 -> 2157 bytes
 .../hidpi/edata_save_disabled_16px_hidpi.png       |   Bin 0 -> 1414 bytes
 .../hidpi/edata_save_disabled_22px_hidpi.png       |   Bin 0 -> 1999 bytes
 .../images/hidpi/edataglobal_32px_hidpi.png        |   Bin 0 -> 668 bytes
 .../images/hidpi/edataman_16px_hidpi.png           |   Bin 0 -> 1744 bytes
 .../images/hidpi/edataman_32px_hidpi.png           |   Bin 0 -> 4251 bytes
 .../VirtualBox/images/hidpi/eraser_16px_hidpi.png  |   Bin 0 -> 1393 bytes
 .../VirtualBox/images/hidpi/exit_16px_hidpi.png    |   Bin 0 -> 1375 bytes
 .../hidpi/expanding_collapsing_16px_hidpi.png      |   Bin 0 -> 984 bytes
 .../VirtualBox/images/hidpi/export_16px_hidpi.png  |   Bin 0 -> 2057 bytes
 .../images/hidpi/extension_pack_16px_hidpi.png     |   Bin 0 -> 963 bytes
 .../images/hidpi/extension_pack_24px_hidpi.png     |   Bin 0 -> 1316 bytes
 .../images/hidpi/extension_pack_32px_hidpi.png     |   Bin 0 -> 2081 bytes
 .../hidpi/extension_pack_install_16px_hidpi.png    |   Bin 0 -> 1652 bytes
 .../extension_pack_install_disabled_16px_hidpi.png |   Bin 0 -> 1538 bytes
 .../hidpi/extension_pack_uninstall_16px_hidpi.png  |   Bin 0 -> 1930 bytes
 ...xtension_pack_uninstall_disabled_16px_hidpi.png |   Bin 0 -> 1727 bytes
 .../hidpi/extension_pack_warning_16px_hidpi.png    |   Bin 0 -> 1695 bytes
 .../VirtualBox/images/hidpi/fd_16px_hidpi.png      |   Bin 0 -> 1060 bytes
 .../VirtualBox/images/hidpi/fd_add_16px_hidpi.png  |   Bin 0 -> 1659 bytes
 .../images/hidpi/fd_add_disabled_16px_hidpi.png    |   Bin 0 -> 1371 bytes
 .../VirtualBox/images/hidpi/fd_copy_16px_hidpi.png |   Bin 0 -> 963 bytes
 .../VirtualBox/images/hidpi/fd_copy_22px_hidpi.png |   Bin 0 -> 1511 bytes
 .../images/hidpi/fd_copy_disabled_16px_hidpi.png   |   Bin 0 -> 849 bytes
 .../images/hidpi/fd_copy_disabled_22px_hidpi.png   |   Bin 0 -> 1251 bytes
 .../images/hidpi/fd_disabled_16px_hidpi.png        |   Bin 0 -> 867 bytes
 .../images/hidpi/fd_modify_16px_hidpi.png          |   Bin 0 -> 1629 bytes
 .../images/hidpi/fd_modify_22px_hidpi.png          |   Bin 0 -> 2228 bytes
 .../images/hidpi/fd_modify_disabled_16px_hidpi.png |   Bin 0 -> 1429 bytes
 .../images/hidpi/fd_modify_disabled_22px_hidpi.png |   Bin 0 -> 1897 bytes
 .../VirtualBox/images/hidpi/fd_read_16px_hidpi.png |   Bin 0 -> 1641 bytes
 .../images/hidpi/fd_release_16px_hidpi.png         |   Bin 0 -> 1832 bytes
 .../images/hidpi/fd_release_22px_hidpi.png         |   Bin 0 -> 2433 bytes
 .../hidpi/fd_release_disabled_16px_hidpi.png       |   Bin 0 -> 1597 bytes
 .../hidpi/fd_release_disabled_22px_hidpi.png       |   Bin 0 -> 2058 bytes
 .../images/hidpi/fd_remove_16px_hidpi.png          |   Bin 0 -> 1215 bytes
 .../images/hidpi/fd_remove_22px_hidpi.png          |   Bin 0 -> 1580 bytes
 .../images/hidpi/fd_remove_disabled_16px_hidpi.png |   Bin 0 -> 1036 bytes
 .../images/hidpi/fd_remove_disabled_22px_hidpi.png |   Bin 0 -> 1297 bytes
 .../images/hidpi/fd_unmount_16px_hidpi.png         |   Bin 0 -> 2010 bytes
 .../hidpi/fd_unmount_disabled_16px_hidpi.png       |   Bin 0 -> 1775 bytes
 .../images/hidpi/fd_write_16px_hidpi.png           |   Bin 0 -> 1598 bytes
 .../VirtualBox/images/hidpi/floppy_16px_hidpi.png  |   Bin 0 -> 1599 bytes
 .../images/hidpi/floppy_add_16px_hidpi.png         |   Bin 0 -> 2029 bytes
 .../hidpi/floppy_add_disabled_16px_hidpi.png       |   Bin 0 -> 1814 bytes
 .../images/hidpi/floppy_collapse_16px_hidpi.png    |   Bin 0 -> 1792 bytes
 .../images/hidpi/floppy_expand_16px_hidpi.png      |   Bin 0 -> 1987 bytes
 .../images/hidpi/fullscreen_16px_hidpi.png         |   Bin 0 -> 372 bytes
 .../hidpi/fullscreen_disabled_16px_hidpi.png       |   Bin 0 -> 328 bytes
 .../images/hidpi/fullscreen_on_16px_hidpi.png      |   Bin 0 -> 522 bytes
 .../hidpi/fullscreen_on_disabled_16px_hidpi.png    |   Bin 0 -> 483 bytes
 .../images/hidpi/global_settings_16px_hidpi.png    |   Bin 0 -> 1869 bytes
 .../images/hidpi/group_abstract_16px_hidpi.png     |   Bin 0 -> 897 bytes
 .../images/hidpi/guesttools_16px_hidpi.png         |   Bin 0 -> 1366 bytes
 .../hidpi/guesttools_disabled_16px_hidpi.png       |   Bin 0 -> 1188 bytes
 .../VirtualBox/images/hidpi/hd_16px_hidpi.png      |   Bin 0 -> 1827 bytes
 .../VirtualBox/images/hidpi/hd_24px_hidpi.png      |   Bin 0 -> 2767 bytes
 .../VirtualBox/images/hidpi/hd_32px_hidpi.png      |   Bin 0 -> 4479 bytes
 .../VirtualBox/images/hidpi/hd_add_16px_hidpi.png  |   Bin 0 -> 2027 bytes
 .../images/hidpi/hd_add_disabled_16px_hidpi.png    |   Bin 0 -> 1787 bytes
 .../VirtualBox/images/hidpi/hd_copy_16px_hidpi.png |   Bin 0 -> 1463 bytes
 .../VirtualBox/images/hidpi/hd_copy_22px_hidpi.png |   Bin 0 -> 2443 bytes
 .../images/hidpi/hd_copy_disabled_16px_hidpi.png   |   Bin 0 -> 1394 bytes
 .../images/hidpi/hd_copy_disabled_22px_hidpi.png   |   Bin 0 -> 2311 bytes
 .../images/hidpi/hd_disabled_16px_hidpi.png        |   Bin 0 -> 1731 bytes
 .../images/hidpi/hd_modify_16px_hidpi.png          |   Bin 0 -> 2224 bytes
 .../images/hidpi/hd_modify_22px_hidpi.png          |   Bin 0 -> 3277 bytes
 .../images/hidpi/hd_modify_disabled_16px_hidpi.png |   Bin 0 -> 2127 bytes
 .../images/hidpi/hd_modify_disabled_22px_hidpi.png |   Bin 0 -> 2947 bytes
 .../VirtualBox/images/hidpi/hd_new_16px_hidpi.png  |   Bin 0 -> 2191 bytes
 .../images/hidpi/hd_new_disabled_16px_hidpi.png    |   Bin 0 -> 2127 bytes
 .../VirtualBox/images/hidpi/hd_read_16px_hidpi.png |   Bin 0 -> 2226 bytes
 .../images/hidpi/hd_release_16px_hidpi.png         |   Bin 0 -> 2242 bytes
 .../images/hidpi/hd_release_22px_hidpi.png         |   Bin 0 -> 3363 bytes
 .../hidpi/hd_release_disabled_16px_hidpi.png       |   Bin 0 -> 2144 bytes
 .../hidpi/hd_release_disabled_22px_hidpi.png       |   Bin 0 -> 3070 bytes
 .../images/hidpi/hd_remove_16px_hidpi.png          |   Bin 0 -> 1765 bytes
 .../images/hidpi/hd_remove_22px_hidpi.png          |   Bin 0 -> 2562 bytes
 .../images/hidpi/hd_remove_disabled_16px_hidpi.png |   Bin 0 -> 1650 bytes
 .../images/hidpi/hd_remove_disabled_22px_hidpi.png |   Bin 0 -> 2344 bytes
 .../images/hidpi/hd_settings_16px_hidpi.png        |   Bin 0 -> 2348 bytes
 .../hidpi/hd_settings_disabled_16px_hidpi.png      |   Bin 0 -> 2233 bytes
 .../images/hidpi/hd_warning_16px_hidpi.png         |   Bin 0 -> 2160 bytes
 .../images/hidpi/hd_write_16px_hidpi.png           |   Bin 0 -> 2155 bytes
 .../VirtualBox/images/hidpi/help_16px_hidpi.png    |   Bin 0 -> 1494 bytes
 .../hidpi/help_button_normal_mac_22px_hidpi.png    |   Bin 0 -> 4134 bytes
 .../hidpi/help_button_pressed_mac_22px_hidpi.png   |   Bin 0 -> 4070 bytes
 .../VirtualBox/images/hidpi/hostkey_16px_hidpi.png |   Bin 0 -> 1345 bytes
 .../VirtualBox/images/hidpi/hostkey_24px_hidpi.png |   Bin 0 -> 1910 bytes
 .../VirtualBox/images/hidpi/hostkey_32px_hidpi.png |   Bin 0 -> 3017 bytes
 .../images/hidpi/hostkey_captured_16px_hidpi.png   |   Bin 0 -> 1432 bytes
 .../hidpi/hostkey_captured_pressed_16px_hidpi.png  |   Bin 0 -> 1416 bytes
 .../images/hidpi/hostkey_disabled_16px_hidpi.png   |   Bin 0 -> 1174 bytes
 .../images/hidpi/hostkey_pressed_16px_hidpi.png    |   Bin 0 -> 1321 bytes
 .../images/hidpi/hostkey_warning_16px_hidpi.png    |   Bin 0 -> 1862 bytes
 .../VirtualBox/images/hidpi/ide_16px_hidpi.png     |   Bin 0 -> 1901 bytes
 .../VirtualBox/images/hidpi/ide_add_16px_hidpi.png |   Bin 0 -> 2215 bytes
 .../images/hidpi/ide_add_disabled_16px_hidpi.png   |   Bin 0 -> 2092 bytes
 .../images/hidpi/ide_collapse_16px_hidpi.png       |   Bin 0 -> 1925 bytes
 .../images/hidpi/ide_expand_16px_hidpi.png         |   Bin 0 -> 2180 bytes
 .../VirtualBox/images/hidpi/import_16px_hidpi.png  |   Bin 0 -> 2116 bytes
 .../images/hidpi/interface_16px_hidpi.png          |   Bin 0 -> 427 bytes
 .../images/hidpi/interface_24px_hidpi.png          |   Bin 0 -> 449 bytes
 .../images/hidpi/interface_32px_hidpi.png          |   Bin 0 -> 588 bytes
 .../images/hidpi/interface_warning_16px_hidpi.png  |   Bin 0 -> 1278 bytes
 .../images/hidpi/keyboard_16px_hidpi.png           |   Bin 0 -> 1842 bytes
 .../images/hidpi/keyboard_24px_hidpi.png           |   Bin 0 -> 2822 bytes
 .../images/hidpi/keyboard_32px_hidpi.png           |   Bin 0 -> 4041 bytes
 .../images/hidpi/keyboard_settings_16px_hidpi.png  |   Bin 0 -> 1647 bytes
 .../keyboard_settings_disabled_16px_hidpi.png      |   Bin 0 -> 1551 bytes
 .../images/hidpi/list_movedown_16px_hidpi.png      |   Bin 0 -> 841 bytes
 .../hidpi/list_movedown_disabled_16px_hidpi.png    |   Bin 0 -> 732 bytes
 .../images/hidpi/list_moveup_16px_hidpi.png        |   Bin 0 -> 840 bytes
 .../hidpi/list_moveup_disabled_16px_hidpi.png      |   Bin 0 -> 726 bytes
 .../VirtualBox/images/hidpi/machine_16px_hidpi.png |   Bin 0 -> 738 bytes
 .../VirtualBox/images/hidpi/machine_24px_hidpi.png |   Bin 0 -> 886 bytes
 .../VirtualBox/images/hidpi/machine_32px_hidpi.png |   Bin 0 -> 1218 bytes
 .../images/hidpi/machine_abstract_16px_hidpi.png   |   Bin 0 -> 595 bytes
 .../images/hidpi/machine_warning_16px_hidpi.png    |   Bin 0 -> 1502 bytes
 .../images/hidpi/meditation_32px_hidpi.png         |   Bin 0 -> 8491 bytes
 .../images/hidpi/menubar_on_16px_hidpi.png         |   Bin 0 -> 760 bytes
 .../hidpi/menubar_on_disabled_16px_hidpi.png       |   Bin 0 -> 690 bytes
 .../images/hidpi/minimize_16px_hidpi.png           |   Bin 0 -> 482 bytes
 .../VirtualBox/images/hidpi/mouse_16px_hidpi.png   |   Bin 0 -> 2239 bytes
 .../images/hidpi/mouse_can_seamless_16px_hidpi.png |   Bin 0 -> 2401 bytes
 .../mouse_can_seamless_disabled_16px_hidpi.png     |   Bin 0 -> 2195 bytes
 .../hidpi/mouse_can_seamless_on_16px_hidpi.png     |   Bin 0 -> 1927 bytes
 .../mouse_can_seamless_on_disabled_16px_hidpi.png  |   Bin 0 -> 1882 bytes
 .../mouse_can_seamless_uncaptured_16px_hidpi.png   |   Bin 0 -> 2305 bytes
 .../images/hidpi/mouse_disabled_16px_hidpi.png     |   Bin 0 -> 2017 bytes
 .../images/hidpi/mouse_seamless_16px_hidpi.png     |   Bin 0 -> 2441 bytes
 .../images/hidpi/movie_reel_16px_hidpi.png         |   Bin 0 -> 1639 bytes
 .../VirtualBox/images/hidpi/name_16px_hidpi.png    |   Bin 0 -> 2362 bytes
 .../VirtualBox/images/hidpi/next_16px_hidpi.png    |   Bin 0 -> 1184 bytes
 .../VirtualBox/images/hidpi/nw_16px_hidpi.png      |   Bin 0 -> 863 bytes
 .../VirtualBox/images/hidpi/nw_24px_hidpi.png      |   Bin 0 -> 1002 bytes
 .../VirtualBox/images/hidpi/nw_32px_hidpi.png      |   Bin 0 -> 1284 bytes
 .../images/hidpi/nw_disabled_16px_hidpi.png        |   Bin 0 -> 763 bytes
 .../images/hidpi/nw_disconnected_16px_hidpi.png    |   Bin 0 -> 853 bytes
 .../images/hidpi/nw_error_16px_hidpi.png           |   Bin 0 -> 1745 bytes
 .../images/hidpi/nw_loading_16px_hidpi.png         |   Bin 0 -> 1971 bytes
 .../VirtualBox/images/hidpi/nw_read_16px_hidpi.png |   Bin 0 -> 1367 bytes
 .../images/hidpi/nw_settings_16px_hidpi.png        |   Bin 0 -> 1655 bytes
 .../hidpi/nw_settings_disabled_16px_hidpi.png      |   Bin 0 -> 1532 bytes
 .../images/hidpi/nw_warning_16px_hidpi.png         |   Bin 0 -> 1503 bytes
 .../images/hidpi/nw_write_16px_hidpi.png           |   Bin 0 -> 1297 bytes
 .../VirtualBox/images/hidpi/ok_16px_hidpi.png      |   Bin 0 -> 2200 bytes
 .../images/hidpi/os_archlinux_64_hidpi.png         |   Bin 0 -> 4977 bytes
 .../VirtualBox/images/hidpi/os_archlinux_hidpi.png |   Bin 0 -> 4248 bytes
 .../VirtualBox/images/hidpi/os_debian_64_hidpi.png |   Bin 0 -> 6386 bytes
 .../VirtualBox/images/hidpi/os_debian_hidpi.png    |   Bin 0 -> 5888 bytes
 .../VirtualBox/images/hidpi/os_dos_hidpi.png       |   Bin 0 -> 4255 bytes
 .../VirtualBox/images/hidpi/os_fedora_64_hidpi.png |   Bin 0 -> 4025 bytes
 .../VirtualBox/images/hidpi/os_fedora_hidpi.png    |   Bin 0 -> 3385 bytes
 .../images/hidpi/os_freebsd_64_hidpi.png           |   Bin 0 -> 4576 bytes
 .../VirtualBox/images/hidpi/os_freebsd_hidpi.png   |   Bin 0 -> 4100 bytes
 .../VirtualBox/images/hidpi/os_freedos_hidpi.png   |   Bin 0 -> 5072 bytes
 .../VirtualBox/images/hidpi/os_gentoo_64_hidpi.png |   Bin 0 -> 4896 bytes
 .../VirtualBox/images/hidpi/os_gentoo_hidpi.png    |   Bin 0 -> 4386 bytes
 .../VirtualBox/images/hidpi/os_jrockitve_hidpi.png |   Bin 0 -> 4627 bytes
 .../VirtualBox/images/hidpi/os_l4_hidpi.png        |   Bin 0 -> 4690 bytes
 .../VirtualBox/images/hidpi/os_linux22_hidpi.png   |   Bin 0 -> 5248 bytes
 .../images/hidpi/os_linux24_64_hidpi.png           |   Bin 0 -> 5889 bytes
 .../VirtualBox/images/hidpi/os_linux24_hidpi.png   |   Bin 0 -> 5221 bytes
 .../images/hidpi/os_linux26_64_hidpi.png           |   Bin 0 -> 5981 bytes
 .../VirtualBox/images/hidpi/os_linux26_hidpi.png   |   Bin 0 -> 5301 bytes
 .../VirtualBox/images/hidpi/os_linux_hidpi.png     |   Bin 0 -> 4471 bytes
 .../images/hidpi/os_linux_other_hidpi.png          |   Bin 0 -> 5256 bytes
 .../VirtualBox/images/hidpi/os_macosx_64_hidpi.png |   Bin 0 -> 5152 bytes
 .../VirtualBox/images/hidpi/os_macosx_hidpi.png    |   Bin 0 -> 5056 bytes
 .../images/hidpi/os_mandriva_64_hidpi.png          |   Bin 0 -> 5394 bytes
 .../VirtualBox/images/hidpi/os_mandriva_hidpi.png  |   Bin 0 -> 4725 bytes
 .../VirtualBox/images/hidpi/os_mint_64_hidpi.png   |   Bin 0 -> 3030 bytes
 .../VirtualBox/images/hidpi/os_mint_hidpi.png      |   Bin 0 -> 2356 bytes
 .../VirtualBox/images/hidpi/os_netbsd_64_hidpi.png |   Bin 0 -> 5306 bytes
 .../VirtualBox/images/hidpi/os_netbsd_hidpi.png    |   Bin 0 -> 4933 bytes
 .../VirtualBox/images/hidpi/os_netware_hidpi.png   |   Bin 0 -> 6512 bytes
 .../images/hidpi/os_openbsd_64_hidpi.png           |   Bin 0 -> 6951 bytes
 .../VirtualBox/images/hidpi/os_openbsd_hidpi.png   |   Bin 0 -> 6463 bytes
 .../images/hidpi/os_opensuse_64_hidpi.png          |   Bin 0 -> 7872 bytes
 .../VirtualBox/images/hidpi/os_opensuse_hidpi.png  |   Bin 0 -> 7229 bytes
 .../VirtualBox/images/hidpi/os_oracle_64_hidpi.png |   Bin 0 -> 6872 bytes
 .../VirtualBox/images/hidpi/os_oracle_hidpi.png    |   Bin 0 -> 6679 bytes
 .../images/hidpi/os_oraclesolaris_64_hidpi.png     |   Bin 0 -> 3909 bytes
 .../images/hidpi/os_oraclesolaris_hidpi.png        |   Bin 0 -> 3234 bytes
 .../VirtualBox/images/hidpi/os_os2_other_hidpi.png |   Bin 0 -> 6672 bytes
 .../VirtualBox/images/hidpi/os_os2ecs_hidpi.png    |   Bin 0 -> 5308 bytes
 .../VirtualBox/images/hidpi/os_os2warp3_hidpi.png  |   Bin 0 -> 6780 bytes
 .../VirtualBox/images/hidpi/os_os2warp45_hidpi.png |   Bin 0 -> 5148 bytes
 .../VirtualBox/images/hidpi/os_os2warp4_hidpi.png  |   Bin 0 -> 4822 bytes
 .../VirtualBox/images/hidpi/os_other_64_hidpi.png  |   Bin 0 -> 5022 bytes
 .../VirtualBox/images/hidpi/os_other_hidpi.png     |   Bin 0 -> 5058 bytes
 .../VirtualBox/images/hidpi/os_qnx_hidpi.png       |   Bin 0 -> 6583 bytes
 .../VirtualBox/images/hidpi/os_redhat_64_hidpi.png |   Bin 0 -> 6082 bytes
 .../VirtualBox/images/hidpi/os_redhat_hidpi.png    |   Bin 0 -> 5447 bytes
 .../images/hidpi/os_solaris_64_hidpi.png           |   Bin 0 -> 5651 bytes
 .../VirtualBox/images/hidpi/os_solaris_hidpi.png   |   Bin 0 -> 5235 bytes
 .../images/hidpi/os_turbolinux_64_hidpi.png        |   Bin 0 -> 4934 bytes
 .../images/hidpi/os_turbolinux_hidpi.png           |   Bin 0 -> 4835 bytes
 .../VirtualBox/images/hidpi/os_ubuntu_64_hidpi.png |   Bin 0 -> 5371 bytes
 .../VirtualBox/images/hidpi/os_ubuntu_hidpi.png    |   Bin 0 -> 5006 bytes
 .../VirtualBox/images/hidpi/os_win10_64_hidpi.png  |   Bin 0 -> 7389 bytes
 .../VirtualBox/images/hidpi/os_win10_hidpi.png     |   Bin 0 -> 7531 bytes
 .../images/hidpi/os_win2k12_64_hidpi.png           |   Bin 0 -> 7172 bytes
 .../VirtualBox/images/hidpi/os_win2k3_64_hidpi.png |   Bin 0 -> 7610 bytes
 .../VirtualBox/images/hidpi/os_win2k3_hidpi.png    |   Bin 0 -> 7773 bytes
 .../VirtualBox/images/hidpi/os_win2k8_64_hidpi.png |   Bin 0 -> 7658 bytes
 .../VirtualBox/images/hidpi/os_win2k8_hidpi.png    |   Bin 0 -> 7821 bytes
 .../VirtualBox/images/hidpi/os_win2k_hidpi.png     |   Bin 0 -> 7682 bytes
 .../VirtualBox/images/hidpi/os_win31_hidpi.png     |   Bin 0 -> 7710 bytes
 .../VirtualBox/images/hidpi/os_win7_64_hidpi.png   |   Bin 0 -> 7409 bytes
 .../VirtualBox/images/hidpi/os_win7_hidpi.png      |   Bin 0 -> 7555 bytes
 .../VirtualBox/images/hidpi/os_win81_64_hidpi.png  |   Bin 0 -> 7651 bytes
 .../VirtualBox/images/hidpi/os_win81_hidpi.png     |   Bin 0 -> 7802 bytes
 .../VirtualBox/images/hidpi/os_win8_64_hidpi.png   |   Bin 0 -> 7688 bytes
 .../VirtualBox/images/hidpi/os_win8_hidpi.png      |   Bin 0 -> 7826 bytes
 .../VirtualBox/images/hidpi/os_win95_hidpi.png     |   Bin 0 -> 7675 bytes
 .../VirtualBox/images/hidpi/os_win98_hidpi.png     |   Bin 0 -> 7894 bytes
 .../VirtualBox/images/hidpi/os_win_other_hidpi.png |   Bin 0 -> 8014 bytes
 .../VirtualBox/images/hidpi/os_winme_hidpi.png     |   Bin 0 -> 7498 bytes
 .../VirtualBox/images/hidpi/os_winnt4_hidpi.png    |   Bin 0 -> 7398 bytes
 .../images/hidpi/os_winvista_64_hidpi.png          |   Bin 0 -> 7593 bytes
 .../VirtualBox/images/hidpi/os_winvista_hidpi.png  |   Bin 0 -> 7754 bytes
 .../VirtualBox/images/hidpi/os_winxp_64_hidpi.png  |   Bin 0 -> 7470 bytes
 .../VirtualBox/images/hidpi/os_winxp_hidpi.png     |   Bin 0 -> 7625 bytes
 .../images/hidpi/os_xandros_64_hidpi.png           |   Bin 0 -> 5224 bytes
 .../VirtualBox/images/hidpi/os_xandros_hidpi.png   |   Bin 0 -> 4759 bytes
 .../images/hidpi/parallel_port_16px_hidpi.png      |   Bin 0 -> 2104 bytes
 .../images/hidpi/parallel_port_24px_hidpi.png      |   Bin 0 -> 3741 bytes
 .../images/hidpi/parallel_port_32px_hidpi.png      |   Bin 0 -> 5607 bytes
 .../hidpi/parallel_port_warning_16px_hidpi.png     |   Bin 0 -> 2416 bytes
 .../VirtualBox/images/hidpi/pin_16px_hidpi.png     |   Bin 0 -> 1599 bytes
 .../hidpi/preview_empty_16to10_242x167px_hidpi.png |   Bin 0 -> 4271 bytes
 .../hidpi/preview_empty_16to9_242x155px_hidpi.png  |   Bin 0 -> 4197 bytes
 .../hidpi/preview_empty_4to3_242x192px_hidpi.png   |   Bin 0 -> 4448 bytes
 .../hidpi/preview_full_16to10_242x167px_hidpi.png  |   Bin 0 -> 11944 bytes
 .../hidpi/preview_full_16to9_242x155px_hidpi.png   |   Bin 0 -> 11440 bytes
 .../hidpi/preview_full_4to3_242x192px_hidpi.png    |   Bin 0 -> 13000 bytes
 .../images/hidpi/previous_16px_hidpi.png           |   Bin 0 -> 1073 bytes
 .../images/hidpi/progress_clone_90px_hidpi.png     |   Bin 0 -> 18751 bytes
 .../images/hidpi/progress_delete_90px_hidpi.png    |   Bin 0 -> 23048 bytes
 .../images/hidpi/progress_dnd_gh_90px_hidpi.png    |   Bin 0 -> 16387 bytes
 .../images/hidpi/progress_dnd_hg_90px_hidpi.png    |   Bin 0 -> 15317 bytes
 .../images/hidpi/progress_export_90px_hidpi.png    |   Bin 0 -> 23241 bytes
 .../images/hidpi/progress_import_90px_hidpi.png    |   Bin 0 -> 24803 bytes
 ...progress_install_guest_additions_90px_hidpi.png |   Bin 0 -> 21651 bytes
 .../hidpi/progress_media_create_90px_hidpi.png     |   Bin 0 -> 16752 bytes
 .../hidpi/progress_media_delete_90px_hidpi.png     |   Bin 0 -> 17215 bytes
 .../progress_network_interface_90px_hidpi.png      |   Bin 0 -> 4301 bytes
 .../images/hidpi/progress_poweroff_90px_hidpi.png  |   Bin 0 -> 18732 bytes
 .../progress_reading_appliance_90px_hidpi.png      |   Bin 0 -> 24756 bytes
 .../images/hidpi/progress_refresh_90px_hidpi.png   |   Bin 0 -> 27797 bytes
 .../images/hidpi/progress_settings_90px_hidpi.png  |   Bin 0 -> 22889 bytes
 .../hidpi/progress_snapshot_create_90px_hidpi.png  |   Bin 0 -> 20206 bytes
 .../hidpi/progress_snapshot_discard_90px_hidpi.png |   Bin 0 -> 8012 bytes
 .../hidpi/progress_snapshot_restore_90px_hidpi.png |   Bin 0 -> 8700 bytes
 .../images/hidpi/progress_start_90px_hidpi.png     |   Bin 0 -> 21443 bytes
 .../hidpi/progress_state_restore_90px_hidpi.png    |   Bin 0 -> 36393 bytes
 .../hidpi/progress_state_save_90px_hidpi.png       |   Bin 0 -> 35971 bytes
 .../VirtualBox/images/hidpi/proxy_16px_hidpi.png   |   Bin 0 -> 797 bytes
 .../VirtualBox/images/hidpi/proxy_24px_hidpi.png   |   Bin 0 -> 909 bytes
 .../VirtualBox/images/hidpi/proxy_32px_hidpi.png   |   Bin 0 -> 1005 bytes
 .../images/hidpi/proxy_warning_16px_hidpi.png      |   Bin 0 -> 1594 bytes
 .../VirtualBox/images/hidpi/ram_16px_hidpi.png     |   Bin 0 -> 831 bytes
 .../VirtualBox/images/hidpi/refresh_16px_hidpi.png |   Bin 0 -> 2246 bytes
 .../VirtualBox/images/hidpi/refresh_22px_hidpi.png |   Bin 0 -> 3628 bytes
 .../VirtualBox/images/hidpi/refresh_24px_hidpi.png |   Bin 0 -> 4212 bytes
 .../VirtualBox/images/hidpi/refresh_32px_hidpi.png |   Bin 0 -> 5948 bytes
 .../images/hidpi/refresh_disabled_16px_hidpi.png   |   Bin 0 -> 2139 bytes
 .../images/hidpi/refresh_disabled_22px_hidpi.png   |   Bin 0 -> 2971 bytes
 .../images/hidpi/refresh_disabled_32px_hidpi.png   |   Bin 0 -> 4577 bytes
 .../images/hidpi/refresh_warning_16px_hidpi.png    |   Bin 0 -> 2417 bytes
 .../images/hidpi/remove_host_iface_16px_hidpi.png  |   Bin 0 -> 905 bytes
 .../remove_host_iface_disabled_16px_hidpi.png      |   Bin 0 -> 821 bytes
 .../images/hidpi/reset_warnings_16px_hidpi.png     |   Bin 0 -> 1513 bytes
 .../VirtualBox/images/hidpi/restore_16px_hidpi.png |   Bin 0 -> 535 bytes
 .../VirtualBox/images/hidpi/sata_16px_hidpi.png    |   Bin 0 -> 1571 bytes
 .../images/hidpi/sata_add_16px_hidpi.png           |   Bin 0 -> 1957 bytes
 .../images/hidpi/sata_add_disabled_16px_hidpi.png  |   Bin 0 -> 1803 bytes
 .../images/hidpi/sata_collapse_16px_hidpi.png      |   Bin 0 -> 1618 bytes
 .../images/hidpi/sata_expand_16px_hidpi.png        |   Bin 0 -> 1922 bytes
 .../VirtualBox/images/hidpi/scale_16px_hidpi.png   |   Bin 0 -> 858 bytes
 .../images/hidpi/scale_disabled_16px_hidpi.png     |   Bin 0 -> 683 bytes
 .../images/hidpi/scale_factor_16px_hidpi.png       |   Bin 0 -> 482 bytes
 .../hidpi/scale_factor_disabled_16px_hidpi.png     |   Bin 0 -> 418 bytes
 .../images/hidpi/scale_on_16px_hidpi.png           |   Bin 0 -> 888 bytes
 .../images/hidpi/scale_on_disabled_16px_hidpi.png  |   Bin 0 -> 740 bytes
 .../images/hidpi/screenshot_take_16px_hidpi.png    |   Bin 0 -> 1266 bytes
 .../hidpi/screenshot_take_disabled_16px_hidpi.png  |   Bin 0 -> 1161 bytes
 .../VirtualBox/images/hidpi/scsi_16px_hidpi.png    |   Bin 0 -> 2052 bytes
 .../images/hidpi/scsi_add_16px_hidpi.png           |   Bin 0 -> 2359 bytes
 .../images/hidpi/scsi_add_disabled_16px_hidpi.png  |   Bin 0 -> 2221 bytes
 .../images/hidpi/scsi_collapse_16px_hidpi.png      |   Bin 0 -> 2009 bytes
 .../images/hidpi/scsi_expand_16px_hidpi.png        |   Bin 0 -> 2307 bytes
 .../images/hidpi/seamless_16px_hidpi.png           |   Bin 0 -> 656 bytes
 .../images/hidpi/seamless_disabled_16px_hidpi.png  |   Bin 0 -> 576 bytes
 .../images/hidpi/seamless_on_16px_hidpi.png        |   Bin 0 -> 720 bytes
 .../hidpi/seamless_on_disabled_16px_hidpi.png      |   Bin 0 -> 642 bytes
 .../images/hidpi/select_file_16px_hidpi.png        |   Bin 0 -> 1508 bytes
 .../hidpi/select_file_disabled_16px_hidpi.png      |   Bin 0 -> 1373 bytes
 .../images/hidpi/serial_port_16px_hidpi.png        |   Bin 0 -> 2427 bytes
 .../images/hidpi/serial_port_24px_hidpi.png        |   Bin 0 -> 4279 bytes
 .../images/hidpi/serial_port_32px_hidpi.png        |   Bin 0 -> 6338 bytes
 .../hidpi/serial_port_warning_16px_hidpi.png       |   Bin 0 -> 2557 bytes
 .../images/hidpi/session_info_16px_hidpi.png       |   Bin 0 -> 2071 bytes
 .../images/hidpi/session_info_32px_hidpi.png       |   Bin 0 -> 4992 bytes
 .../hidpi/session_info_details_16px_hidpi.png      |   Bin 0 -> 1718 bytes
 .../hidpi/session_info_disabled_16px_hidpi.png     |   Bin 0 -> 1914 bytes
 .../hidpi/session_info_runtime_16px_hidpi.png      |   Bin 0 -> 1310 bytes
 .../VirtualBox/images/hidpi/sf_16px_hidpi.png      |   Bin 0 -> 643 bytes
 .../VirtualBox/images/hidpi/sf_24px_hidpi.png      |   Bin 0 -> 966 bytes
 .../VirtualBox/images/hidpi/sf_32px_hidpi.png      |   Bin 0 -> 1433 bytes
 .../VirtualBox/images/hidpi/sf_add_16px_hidpi.png  |   Bin 0 -> 1335 bytes
 .../images/hidpi/sf_add_disabled_16px_hidpi.png    |   Bin 0 -> 1141 bytes
 .../images/hidpi/sf_disabled_16px_hidpi.png        |   Bin 0 -> 596 bytes
 .../VirtualBox/images/hidpi/sf_edit_16px_hidpi.png |   Bin 0 -> 1311 bytes
 .../images/hidpi/sf_edit_disabled_16px_hidpi.png   |   Bin 0 -> 1252 bytes
 .../VirtualBox/images/hidpi/sf_read_16px_hidpi.png |   Bin 0 -> 1327 bytes
 .../images/hidpi/sf_remove_16px_hidpi.png          |   Bin 0 -> 831 bytes
 .../images/hidpi/sf_remove_disabled_16px_hidpi.png |   Bin 0 -> 753 bytes
 .../images/hidpi/sf_settings_16px_hidpi.png        |   Bin 0 -> 1654 bytes
 .../hidpi/sf_settings_disabled_16px_hidpi.png      |   Bin 0 -> 1561 bytes
 .../images/hidpi/sf_warning_16px_hidpi.png         |   Bin 0 -> 1464 bytes
 .../images/hidpi/sf_write_16px_hidpi.png           |   Bin 0 -> 1255 bytes
 .../images/hidpi/shared_clipboard_16px_hidpi.png   |   Bin 0 -> 488 bytes
 .../hidpi/shared_clipboard_disabled_16px_hidpi.png |   Bin 0 -> 449 bytes
 .../VirtualBox/images/hidpi/site_16px_hidpi.png    |   Bin 0 -> 2285 bytes
 .../VirtualBox/images/hidpi/site_24px_hidpi.png    |   Bin 0 -> 4348 bytes
 .../VirtualBox/images/hidpi/site_32px_hidpi.png    |   Bin 0 -> 6301 bytes
 .../images/hidpi/site_warning_16px_hidpi.png       |   Bin 0 -> 2417 bytes
 .../images/hidpi/snapshot_delete_16px_hidpi.png    |   Bin 0 -> 2280 bytes
 .../images/hidpi/snapshot_delete_22px_hidpi.png    |   Bin 0 -> 3722 bytes
 .../hidpi/snapshot_delete_disabled_16px_hidpi.png  |   Bin 0 -> 2148 bytes
 .../hidpi/snapshot_delete_disabled_22px_hidpi.png  |   Bin 0 -> 3262 bytes
 .../images/hidpi/snapshot_offline_16px_hidpi.png   |   Bin 0 -> 1785 bytes
 .../images/hidpi/snapshot_online_16px_hidpi.png    |   Bin 0 -> 2042 bytes
 .../images/hidpi/snapshot_restore_16px_hidpi.png   |   Bin 0 -> 2097 bytes
 .../images/hidpi/snapshot_restore_22px_hidpi.png   |   Bin 0 -> 3367 bytes
 .../hidpi/snapshot_restore_disabled_16px_hidpi.png |   Bin 0 -> 2010 bytes
 .../hidpi/snapshot_restore_disabled_22px_hidpi.png |   Bin 0 -> 3013 bytes
 .../hidpi/snapshot_show_details_16px_hidpi.png     |   Bin 0 -> 2070 bytes
 .../hidpi/snapshot_show_details_22px_hidpi.png     |   Bin 0 -> 3209 bytes
 .../snapshot_show_details_disabled_16px_hidpi.png  |   Bin 0 -> 1987 bytes
 .../snapshot_show_details_disabled_22px_hidpi.png  |   Bin 0 -> 2848 bytes
 .../images/hidpi/snapshot_take_16px_hidpi.png      |   Bin 0 -> 1559 bytes
 .../images/hidpi/snapshot_take_22px_hidpi.png      |   Bin 0 -> 2407 bytes
 .../hidpi/snapshot_take_disabled_16px_hidpi.png    |   Bin 0 -> 1427 bytes
 .../hidpi/snapshot_take_disabled_22px_hidpi.png    |   Bin 0 -> 2081 bytes
 .../VirtualBox/images/hidpi/sort_16px_hidpi.png    |   Bin 0 -> 1701 bytes
 .../images/hidpi/sort_disabled_16px_hidpi.png      |   Bin 0 -> 1497 bytes
 .../VirtualBox/images/hidpi/sound_16px_hidpi.png   |   Bin 0 -> 1448 bytes
 .../VirtualBox/images/hidpi/sound_24px_hidpi.png   |   Bin 0 -> 1954 bytes
 .../VirtualBox/images/hidpi/sound_32px_hidpi.png   |   Bin 0 -> 2918 bytes
 .../images/hidpi/sound_warning_16px_hidpi.png      |   Bin 0 -> 1921 bytes
 .../images/hidpi/state_aborted_16px_hidpi.png      |   Bin 0 -> 1310 bytes
 .../images/hidpi/state_discarding_16px_hidpi.png   |   Bin 0 -> 2110 bytes
 .../images/hidpi/state_paused_16px_hidpi.png       |   Bin 0 -> 700 bytes
 .../images/hidpi/state_powered_off_16px_hidpi.png  |   Bin 0 -> 2195 bytes
 .../images/hidpi/state_restoring_16px_hidpi.png    |   Bin 0 -> 1831 bytes
 .../images/hidpi/state_running_16px_hidpi.png      |   Bin 0 -> 1792 bytes
 .../images/hidpi/state_saved_16px_hidpi.png        |   Bin 0 -> 1801 bytes
 .../images/hidpi/state_saving_16px_hidpi.png       |   Bin 0 -> 1857 bytes
 .../images/hidpi/state_stuck_16px_hidpi.png        |   Bin 0 -> 771 bytes
 .../images/hidpi/status_check_16px_hidpi.png       |   Bin 0 -> 2013 bytes
 .../images/hidpi/status_error_16px_hidpi.png       |   Bin 0 -> 1956 bytes
 .../images/hidpi/statusbar_16px_hidpi.png          |   Bin 0 -> 607 bytes
 .../images/hidpi/statusbar_disabled_16px_hidpi.png |   Bin 0 -> 510 bytes
 .../images/hidpi/statusbar_on_16px_hidpi.png       |   Bin 0 -> 649 bytes
 .../hidpi/statusbar_on_disabled_16px_hidpi.png     |   Bin 0 -> 605 bytes
 .../images/hidpi/statusbar_settings_16px_hidpi.png |   Bin 0 -> 1571 bytes
 .../statusbar_settings_disabled_16px_hidpi.png     |   Bin 0 -> 1429 bytes
 .../VirtualBox/images/hidpi/usb_16px_hidpi.png     |   Bin 0 -> 1953 bytes
 .../VirtualBox/images/hidpi/usb_24px_hidpi.png     |   Bin 0 -> 3093 bytes
 .../VirtualBox/images/hidpi/usb_32px_hidpi.png     |   Bin 0 -> 4396 bytes
 .../VirtualBox/images/hidpi/usb_add_16px_hidpi.png |   Bin 0 -> 2092 bytes
 .../images/hidpi/usb_add_disabled_16px_hidpi.png   |   Bin 0 -> 1931 bytes
 .../images/hidpi/usb_collapse_16px_hidpi.png       |   Bin 0 -> 1915 bytes
 .../images/hidpi/usb_disabled_16px_hidpi.png       |   Bin 0 -> 1878 bytes
 .../images/hidpi/usb_expand_16px_hidpi.png         |   Bin 0 -> 2043 bytes
 .../images/hidpi/usb_filter_edit_16px_hidpi.png    |   Bin 0 -> 2335 bytes
 .../hidpi/usb_filter_edit_disabled_16px_hidpi.png  |   Bin 0 -> 2285 bytes
 .../images/hidpi/usb_movedown_16px_hidpi.png       |   Bin 0 -> 2366 bytes
 .../hidpi/usb_movedown_disabled_16px_hidpi.png     |   Bin 0 -> 2356 bytes
 .../images/hidpi/usb_moveup_16px_hidpi.png         |   Bin 0 -> 2334 bytes
 .../hidpi/usb_moveup_disabled_16px_hidpi.png       |   Bin 0 -> 2285 bytes
 .../VirtualBox/images/hidpi/usb_new_16px_hidpi.png |   Bin 0 -> 2333 bytes
 .../images/hidpi/usb_new_disabled_16px_hidpi.png   |   Bin 0 -> 2285 bytes
 .../images/hidpi/usb_read_16px_hidpi.png           |   Bin 0 -> 2358 bytes
 .../images/hidpi/usb_remove_16px_hidpi.png         |   Bin 0 -> 1885 bytes
 .../hidpi/usb_remove_disabled_16px_hidpi.png       |   Bin 0 -> 1808 bytes
 .../images/hidpi/usb_settings_16px_hidpi.png       |   Bin 0 -> 2468 bytes
 .../hidpi/usb_settings_disabled_16px_hidpi.png     |   Bin 0 -> 2422 bytes
 .../images/hidpi/usb_unavailable_16px_hidpi.png    |   Bin 0 -> 2414 bytes
 .../hidpi/usb_unavailable_disabled_16px_hidpi.png  |   Bin 0 -> 2412 bytes
 .../images/hidpi/usb_warning_16px_hidpi.png        |   Bin 0 -> 2187 bytes
 .../images/hidpi/usb_write_16px_hidpi.png          |   Bin 0 -> 2296 bytes
 .../images/hidpi/video_capture_16px_hidpi.png      |   Bin 0 -> 870 bytes
 .../hidpi/video_capture_disabled_16px_hidpi.png    |   Bin 0 -> 825 bytes
 .../images/hidpi/video_capture_on_16px_hidpi.png   |   Bin 0 -> 930 bytes
 .../hidpi/video_capture_on_disabled_16px_hidpi.png |   Bin 0 -> 896 bytes
 .../hidpi/video_capture_settings_16px_hidpi.png    |   Bin 0 -> 1765 bytes
 .../images/hidpi/virtual_screen_16px_hidpi.png     |   Bin 0 -> 1429 bytes
 .../hidpi/virtual_screen_disabled_16px_hidpi.png   |   Bin 0 -> 1325 bytes
 .../VirtualBox/images/hidpi/vm_add_16px_hidpi.png  |   Bin 0 -> 1229 bytes
 .../images/hidpi/vm_clone_16px_hidpi.png           |   Bin 0 -> 2242 bytes
 .../images/hidpi/vm_clone_22px_hidpi.png           |   Bin 0 -> 2994 bytes
 .../images/hidpi/vm_clone_disabled_16px_hidpi.png  |   Bin 0 -> 2203 bytes
 .../images/hidpi/vm_clone_disabled_22px_hidpi.png  |   Bin 0 -> 2939 bytes
 .../images/hidpi/vm_create_shortcut_16px_hidpi.png |   Bin 0 -> 1405 bytes
 .../vm_create_shortcut_disabled_16px_hidpi.png     |   Bin 0 -> 1389 bytes
 .../images/hidpi/vm_delete_16px_hidpi.png          |   Bin 0 -> 2435 bytes
 .../images/hidpi/vm_delete_32px_hidpi.png          |   Bin 0 -> 5143 bytes
 .../images/hidpi/vm_delete_disabled_16px_hidpi.png |   Bin 0 -> 2252 bytes
 .../images/hidpi/vm_delete_disabled_32px_hidpi.png |   Bin 0 -> 4037 bytes
 .../images/hidpi/vm_discard_16px_hidpi.png         |   Bin 0 -> 1779 bytes
 .../images/hidpi/vm_discard_32px_hidpi.png         |   Bin 0 -> 3650 bytes
 .../hidpi/vm_discard_disabled_16px_hidpi.png       |   Bin 0 -> 1608 bytes
 .../hidpi/vm_discard_disabled_32px_hidpi.png       |   Bin 0 -> 2888 bytes
 .../images/hidpi/vm_group_create_16px_hidpi.png    |   Bin 0 -> 2051 bytes
 .../hidpi/vm_group_create_disabled_16px_hidpi.png  |   Bin 0 -> 1598 bytes
 .../images/hidpi/vm_group_name_16px_hidpi.png      |   Bin 0 -> 2059 bytes
 .../hidpi/vm_group_name_disabled_16px_hidpi.png    |   Bin 0 -> 1598 bytes
 .../images/hidpi/vm_group_remove_16px_hidpi.png    |   Bin 0 -> 2203 bytes
 .../hidpi/vm_group_remove_disabled_16px_hidpi.png  |   Bin 0 -> 1795 bytes
 .../VirtualBox/images/hidpi/vm_new_16px_hidpi.png  |   Bin 0 -> 2211 bytes
 .../VirtualBox/images/hidpi/vm_new_32px_hidpi.png  |   Bin 0 -> 5547 bytes
 .../hidpi/vm_open_filemanager_16px_hidpi.png       |   Bin 0 -> 392 bytes
 .../vm_open_filemanager_disabled_16px_hidpi.png    |   Bin 0 -> 462 bytes
 .../images/hidpi/vm_pause_16px_hidpi.png           |   Bin 0 -> 705 bytes
 .../images/hidpi/vm_pause_32px_hidpi.png           |   Bin 0 -> 1321 bytes
 .../images/hidpi/vm_pause_disabled_16px_hidpi.png  |   Bin 0 -> 604 bytes
 .../images/hidpi/vm_pause_disabled_32px_hidpi.png  |   Bin 0 -> 993 bytes
 .../images/hidpi/vm_pause_on_16px_hidpi.png        |   Bin 0 -> 823 bytes
 .../hidpi/vm_pause_on_disabled_16px_hidpi.png      |   Bin 0 -> 727 bytes
 .../images/hidpi/vm_poweroff_16px_hidpi.png        |   Bin 0 -> 1559 bytes
 .../hidpi/vm_poweroff_disabled_16px_hidpi.png      |   Bin 0 -> 1458 bytes
 .../images/hidpi/vm_reset_16px_hidpi.png           |   Bin 0 -> 2306 bytes
 .../images/hidpi/vm_reset_disabled_16px_hidpi.png  |   Bin 0 -> 2225 bytes
 .../images/hidpi/vm_save_state_16px_hidpi.png      |   Bin 0 -> 1860 bytes
 .../hidpi/vm_save_state_disabled_16px_hidpi.png    |   Bin 0 -> 1622 bytes
 .../images/hidpi/vm_settings_16px_hidpi.png        |   Bin 0 -> 2411 bytes
 .../images/hidpi/vm_settings_32px_hidpi.png        |   Bin 0 -> 6097 bytes
 .../hidpi/vm_settings_disabled_16px_hidpi.png      |   Bin 0 -> 2242 bytes
 .../hidpi/vm_settings_disabled_32px_hidpi.png      |   Bin 0 -> 4959 bytes
 .../images/hidpi/vm_show_logs_16px_hidpi.png       |   Bin 0 -> 1354 bytes
 .../images/hidpi/vm_show_logs_32px_hidpi.png       |   Bin 0 -> 2592 bytes
 .../hidpi/vm_show_logs_disabled_16px_hidpi.png     |   Bin 0 -> 1218 bytes
 .../hidpi/vm_show_logs_disabled_32px_hidpi.png     |   Bin 0 -> 2384 bytes
 .../images/hidpi/vm_shutdown_16px_hidpi.png        |   Bin 0 -> 2203 bytes
 .../hidpi/vm_shutdown_disabled_16px_hidpi.png      |   Bin 0 -> 2161 bytes
 .../images/hidpi/vm_start_16px_hidpi.png           |   Bin 0 -> 1792 bytes
 .../images/hidpi/vm_start_32px_hidpi.png           |   Bin 0 -> 3799 bytes
 .../images/hidpi/vm_start_disabled_16px_hidpi.png  |   Bin 0 -> 1701 bytes
 .../images/hidpi/vm_start_disabled_32px_hidpi.png  |   Bin 0 -> 2993 bytes
 .../VirtualBox/images/hidpi/vrdp_16px_hidpi.png    |   Bin 0 -> 995 bytes
 .../VirtualBox/images/hidpi/vrdp_24px_hidpi.png    |   Bin 0 -> 1249 bytes
 .../VirtualBox/images/hidpi/vrdp_32px_hidpi.png    |   Bin 0 -> 1435 bytes
 .../images/hidpi/vrdp_disabled_16px_hidpi.png      |   Bin 0 -> 834 bytes
 .../VirtualBox/images/hidpi/vrdp_on_16px_hidpi.png |   Bin 0 -> 977 bytes
 .../images/hidpi/vrdp_on_disabled_16px_hidpi.png   |   Bin 0 -> 857 bytes
 .../images/hidpi/vrdp_warning_16px_hidpi.png       |   Bin 0 -> 1603 bytes
 .../images/hidpi/vtx_amdv_16px_hidpi.png           |   Bin 0 -> 1298 bytes
 .../images/hidpi/vtx_amdv_disabled_16px_hidpi.png  |   Bin 0 -> 1169 bytes
 .../images/hidpi/web_camera_16px_hidpi.png         |   Bin 0 -> 1826 bytes
 .../hidpi/web_camera_disabled_16px_hidpi.png       |   Bin 0 -> 1780 bytes
 .../Frontends/VirtualBox/images/hostkey_16px.png   |   Bin 3340 -> 681 bytes
 .../Frontends/VirtualBox/images/hostkey_24px.png   |   Bin 0 -> 948 bytes
 .../Frontends/VirtualBox/images/hostkey_32px.png   |   Bin 4005 -> 1345 bytes
 .../VirtualBox/images/hostkey_captured_16px.png    |   Bin 3352 -> 693 bytes
 .../images/hostkey_captured_pressed_16px.png       |   Bin 3362 -> 702 bytes
 .../VirtualBox/images/hostkey_disabled_16px.png    |   Bin 3302 -> 643 bytes
 .../VirtualBox/images/hostkey_disabled_32px.png    |   Bin 3819 -> 0 bytes
 .../VirtualBox/images/hostkey_pressed_16px.png     |   Bin 3339 -> 680 bytes
 .../VirtualBox/images/hostkey_warning_16px.png     |   Bin 3449 -> 790 bytes
 src/VBox/Frontends/VirtualBox/images/ide_16px.png  |   Bin 3410 -> 791 bytes
 .../Frontends/VirtualBox/images/ide_add_16px.png   |   Bin 3457 -> 795 bytes
 .../VirtualBox/images/ide_add_disabled_16px.png    |   Bin 3440 -> 787 bytes
 .../VirtualBox/images/ide_collapse_16px.png        |   Bin 3400 -> 768 bytes
 .../VirtualBox/images/ide_expand_16px.png          |   Bin 3444 -> 785 bytes
 .../Frontends/VirtualBox/images/import_16px.png    |   Bin 3498 -> 844 bytes
 .../Frontends/VirtualBox/images/interface_16px.png |   Bin 0 -> 328 bytes
 .../Frontends/VirtualBox/images/interface_24px.png |   Bin 0 -> 377 bytes
 .../Frontends/VirtualBox/images/interface_32px.png |   Bin 0 -> 427 bytes
 .../VirtualBox/images/interface_warning_16px.png   |   Bin 0 -> 635 bytes
 .../Frontends/VirtualBox/images/keyboard_16px.png  |   Bin 0 -> 399 bytes
 .../Frontends/VirtualBox/images/keyboard_24px.png  |   Bin 0 -> 1108 bytes
 .../Frontends/VirtualBox/images/keyboard_32px.png  |   Bin 0 -> 1842 bytes
 .../VirtualBox/images/keyboard_settings_16px.png   |   Bin 0 -> 664 bytes
 .../images/keyboard_settings_disabled_16px.png     |   Bin 0 -> 647 bytes
 .../VirtualBox/images/list_movedown_16px.png       |   Bin 3167 -> 508 bytes
 .../VirtualBox/images/list_movedown_22px.png       |   Bin 3274 -> 0 bytes
 .../images/list_movedown_disabled_16px.png         |   Bin 3120 -> 461 bytes
 .../images/list_movedown_disabled_22px.png         |   Bin 3212 -> 0 bytes
 .../VirtualBox/images/list_moveup_16px.png         |   Bin 3167 -> 508 bytes
 .../VirtualBox/images/list_moveup_22px.png         |   Bin 3264 -> 0 bytes
 .../images/list_moveup_disabled_16px.png           |   Bin 3123 -> 464 bytes
 .../images/list_moveup_disabled_22px.png           |   Bin 3204 -> 0 bytes
 .../Frontends/VirtualBox/images/machine_16px.png   |   Bin 3021 -> 361 bytes
 .../Frontends/VirtualBox/images/machine_24px.png   |   Bin 0 -> 445 bytes
 .../Frontends/VirtualBox/images/machine_32px.png   |   Bin 3397 -> 738 bytes
 .../VirtualBox/images/machine_abstract_16px.png    |   Bin 2986 -> 326 bytes
 .../VirtualBox/images/machine_disabled_16px.png    |   Bin 3029 -> 0 bytes
 .../VirtualBox/images/machine_disabled_32px.png    |   Bin 3345 -> 0 bytes
 .../VirtualBox/images/machine_warning_16px.png     |   Bin 3314 -> 655 bytes
 .../VirtualBox/images/meditation_32px.png          |   Bin 5306 -> 2649 bytes
 .../Frontends/VirtualBox/images/menubar_16px.png   |   Bin 0 -> 346 bytes
 .../VirtualBox/images/menubar_disabled_16px.png    |   Bin 0 -> 318 bytes
 .../VirtualBox/images/menubar_on_16px.png          |   Bin 0 -> 422 bytes
 .../VirtualBox/images/menubar_on_disabled_16px.png |   Bin 0 -> 399 bytes
 .../VirtualBox/images/menubar_settings_16px.png    |   Bin 0 -> 673 bytes
 .../images/menubar_settings_disabled_16px.png      |   Bin 0 -> 635 bytes
 .../Frontends/VirtualBox/images/minimize_16px.png  |   Bin 2930 -> 271 bytes
 src/VBox/Frontends/VirtualBox/images/monitor.png   |   Bin 2855 -> 1243 bytes
 .../Frontends/VirtualBox/images/monitor_glossy.png |   Bin 1171 -> 1913 bytes
 .../Frontends/VirtualBox/images/mouse_16px.png     |   Bin 3508 -> 849 bytes
 .../VirtualBox/images/mouse_can_seamless_16px.png  |   Bin 3574 -> 914 bytes
 .../images/mouse_can_seamless_disabled_16px.png    |   Bin 3565 -> 906 bytes
 .../images/mouse_can_seamless_on_16px.png          |   Bin 3384 -> 725 bytes
 .../images/mouse_can_seamless_on_disabled_16px.png |   Bin 3399 -> 740 bytes
 .../images/mouse_can_seamless_uncaptured_16px.png  |   Bin 3608 -> 949 bytes
 .../VirtualBox/images/mouse_disabled_16px.png      |   Bin 3521 -> 861 bytes
 .../VirtualBox/images/mouse_seamless_16px.png      |   Bin 3567 -> 908 bytes
 .../VirtualBox/images/movie_reel_16px.png          |   Bin 3427 -> 780 bytes
 src/VBox/Frontends/VirtualBox/images/name_16px.png |   Bin 3542 -> 883 bytes
 src/VBox/Frontends/VirtualBox/images/next_16px.png |   Bin 3264 -> 605 bytes
 src/VBox/Frontends/VirtualBox/images/nw_16px.png   |   Bin 3071 -> 412 bytes
 src/VBox/Frontends/VirtualBox/images/nw_24px.png   |   Bin 0 -> 481 bytes
 src/VBox/Frontends/VirtualBox/images/nw_32px.png   |   Bin 3523 -> 863 bytes
 .../VirtualBox/images/nw_disabled_16px.png         |   Bin 3066 -> 407 bytes
 .../VirtualBox/images/nw_disabled_32px.png         |   Bin 3446 -> 0 bytes
 .../VirtualBox/images/nw_disconnected_16px.png     |   Bin 0 -> 422 bytes
 .../Frontends/VirtualBox/images/nw_error_16px.png  |   Bin 3264 -> 675 bytes
 .../VirtualBox/images/nw_loading_16px.png          |   Bin 3331 -> 672 bytes
 .../Frontends/VirtualBox/images/nw_read_16px.png   |   Bin 3233 -> 574 bytes
 .../VirtualBox/images/nw_settings_16px.png         |   Bin 3309 -> 650 bytes
 .../images/nw_settings_disabled_16px.png           |   Bin 3290 -> 631 bytes
 .../VirtualBox/images/nw_warning_16px.png          |   Bin 3304 -> 644 bytes
 .../Frontends/VirtualBox/images/nw_write_16px.png  |   Bin 3221 -> 562 bytes
 src/VBox/Frontends/VirtualBox/images/ok_16px.png   |   Bin 3521 -> 862 bytes
 .../Frontends/VirtualBox/images/os_archlinux.png   |   Bin 4513 -> 1862 bytes
 .../VirtualBox/images/os_archlinux_64.png          |   Bin 4767 -> 2108 bytes
 src/VBox/Frontends/VirtualBox/images/os_debian.png |   Bin 5000 -> 2341 bytes
 .../Frontends/VirtualBox/images/os_debian_64.png   |   Bin 5185 -> 2525 bytes
 src/VBox/Frontends/VirtualBox/images/os_dos.png    |   Bin 4648 -> 1988 bytes
 src/VBox/Frontends/VirtualBox/images/os_fedora.png |   Bin 4151 -> 1492 bytes
 .../Frontends/VirtualBox/images/os_fedora_64.png   |   Bin 4440 -> 1781 bytes
 .../Frontends/VirtualBox/images/os_freebsd.png     |   Bin 4771 -> 1724 bytes
 .../Frontends/VirtualBox/images/os_freebsd_64.png  |   Bin 5057 -> 1933 bytes
 src/VBox/Frontends/VirtualBox/images/os_gentoo.png |   Bin 4442 -> 1782 bytes
 .../Frontends/VirtualBox/images/os_gentoo_64.png   |   Bin 4664 -> 2005 bytes
 .../Frontends/VirtualBox/images/os_jrockitve.png   |   Bin 5056 -> 2397 bytes
 src/VBox/Frontends/VirtualBox/images/os_l4.png     |   Bin 4456 -> 1800 bytes
 src/VBox/Frontends/VirtualBox/images/os_linux.png  |   Bin 4382 -> 1723 bytes
 .../Frontends/VirtualBox/images/os_linux22.png     |   Bin 4634 -> 1975 bytes
 .../Frontends/VirtualBox/images/os_linux24.png     |   Bin 4648 -> 1989 bytes
 .../Frontends/VirtualBox/images/os_linux24_64.png  |   Bin 4935 -> 2268 bytes
 .../Frontends/VirtualBox/images/os_linux26.png     |   Bin 4665 -> 2006 bytes
 .../Frontends/VirtualBox/images/os_linux26_64.png  |   Bin 4957 -> 2289 bytes
 .../Frontends/VirtualBox/images/os_linux_other.png |   Bin 4659 -> 2003 bytes
 src/VBox/Frontends/VirtualBox/images/os_macosx.png |   Bin 4687 -> 2028 bytes
 .../Frontends/VirtualBox/images/os_macosx_64.png   |   Bin 4772 -> 2113 bytes
 .../Frontends/VirtualBox/images/os_mandriva.png    |   Bin 4550 -> 1890 bytes
 .../Frontends/VirtualBox/images/os_mandriva_64.png |   Bin 4844 -> 2185 bytes
 src/VBox/Frontends/VirtualBox/images/os_netbsd.png |   Bin 4661 -> 2001 bytes
 .../Frontends/VirtualBox/images/os_netbsd_64.png   |   Bin 4825 -> 2166 bytes
 .../Frontends/VirtualBox/images/os_netware.png     |   Bin 4967 -> 2308 bytes
 .../Frontends/VirtualBox/images/os_openbsd.png     |   Bin 4973 -> 2314 bytes
 .../Frontends/VirtualBox/images/os_openbsd_64.png  |   Bin 5174 -> 2515 bytes
 .../Frontends/VirtualBox/images/os_opensuse.png    |   Bin 4988 -> 2329 bytes
 .../Frontends/VirtualBox/images/os_opensuse_64.png |   Bin 5245 -> 2579 bytes
 src/VBox/Frontends/VirtualBox/images/os_oracle.png |   Bin 5226 -> 2580 bytes
 .../Frontends/VirtualBox/images/os_oracle_64.png   |   Bin 5267 -> 2613 bytes
 .../VirtualBox/images/os_oraclesolaris.png         |   Bin 4110 -> 1451 bytes
 .../VirtualBox/images/os_oraclesolaris_64.png      |   Bin 4416 -> 1752 bytes
 .../Frontends/VirtualBox/images/os_os2_other.png   |   Bin 5421 -> 2762 bytes
 src/VBox/Frontends/VirtualBox/images/os_os2ecs.png |   Bin 4678 -> 2019 bytes
 .../Frontends/VirtualBox/images/os_os2warp3.png    |   Bin 5353 -> 2689 bytes
 .../Frontends/VirtualBox/images/os_os2warp4.png    |   Bin 4755 -> 2095 bytes
 .../Frontends/VirtualBox/images/os_os2warp45.png   |   Bin 4842 -> 2183 bytes
 src/VBox/Frontends/VirtualBox/images/os_other.png  |   Bin 4633 -> 1974 bytes
 .../Frontends/VirtualBox/images/os_other_64.png    |   Bin 4661 -> 2002 bytes
 src/VBox/Frontends/VirtualBox/images/os_qnx.png    |   Bin 5105 -> 2445 bytes
 src/VBox/Frontends/VirtualBox/images/os_redhat.png |   Bin 4733 -> 2073 bytes
 .../Frontends/VirtualBox/images/os_redhat_64.png   |   Bin 4995 -> 2336 bytes
 .../Frontends/VirtualBox/images/os_solaris.png     |   Bin 4617 -> 1959 bytes
 .../Frontends/VirtualBox/images/os_solaris_64.png  |   Bin 4798 -> 2141 bytes
 .../Frontends/VirtualBox/images/os_turbolinux.png  |   Bin 4739 -> 2083 bytes
 .../VirtualBox/images/os_turbolinux_64.png         |   Bin 4819 -> 2160 bytes
 .../Frontends/VirtualBox/images/os_type_16px.png   |   Bin 3070 -> 411 bytes
 src/VBox/Frontends/VirtualBox/images/os_ubuntu.png |   Bin 4640 -> 1981 bytes
 .../Frontends/VirtualBox/images/os_ubuntu_64.png   |   Bin 4807 -> 2148 bytes
 src/VBox/Frontends/VirtualBox/images/os_win2k.png  |   Bin 5394 -> 2734 bytes
 .../Frontends/VirtualBox/images/os_win2k12_64.png  |   Bin 5255 -> 2581 bytes
 src/VBox/Frontends/VirtualBox/images/os_win2k3.png |   Bin 5413 -> 2754 bytes
 .../Frontends/VirtualBox/images/os_win2k3_64.png   |   Bin 5393 -> 2733 bytes
 src/VBox/Frontends/VirtualBox/images/os_win2k8.png |   Bin 5395 -> 2736 bytes
 .../Frontends/VirtualBox/images/os_win2k8_64.png   |   Bin 5369 -> 2710 bytes
 src/VBox/Frontends/VirtualBox/images/os_win31.png  |   Bin 5349 -> 2690 bytes
 src/VBox/Frontends/VirtualBox/images/os_win7.png   |   Bin 5310 -> 2636 bytes
 .../Frontends/VirtualBox/images/os_win7_64.png     |   Bin 5297 -> 2637 bytes
 src/VBox/Frontends/VirtualBox/images/os_win8.png   |   Bin 5381 -> 2733 bytes
 .../Frontends/VirtualBox/images/os_win8_64.png     |   Bin 5372 -> 2724 bytes
 src/VBox/Frontends/VirtualBox/images/os_win95.png  |   Bin 5352 -> 2692 bytes
 src/VBox/Frontends/VirtualBox/images/os_win98.png  |   Bin 5400 -> 2741 bytes
 .../Frontends/VirtualBox/images/os_win_other.png   |   Bin 5356 -> 2697 bytes
 src/VBox/Frontends/VirtualBox/images/os_winme.png  |   Bin 5254 -> 2595 bytes
 src/VBox/Frontends/VirtualBox/images/os_winnt4.png |   Bin 5275 -> 2616 bytes
 .../Frontends/VirtualBox/images/os_winvista.png    |   Bin 5365 -> 2706 bytes
 .../Frontends/VirtualBox/images/os_winvista_64.png |   Bin 5346 -> 2687 bytes
 src/VBox/Frontends/VirtualBox/images/os_winxp.png  |   Bin 5351 -> 2691 bytes
 .../Frontends/VirtualBox/images/os_winxp_64.png    |   Bin 5341 -> 2682 bytes
 .../Frontends/VirtualBox/images/os_xandros.png     |   Bin 4393 -> 1734 bytes
 .../Frontends/VirtualBox/images/os_xandros_64.png  |   Bin 4591 -> 1932 bytes
 .../VirtualBox/images/parallel_port_16px.png       |   Bin 3436 -> 776 bytes
 .../VirtualBox/images/parallel_port_24px.png       |   Bin 0 -> 1225 bytes
 .../VirtualBox/images/parallel_port_32px.png       |   Bin 4764 -> 2104 bytes
 .../images/parallel_port_disabled_16px.png         |   Bin 3451 -> 0 bytes
 .../images/parallel_port_disabled_32px.png         |   Bin 4769 -> 0 bytes
 .../VirtualBox/images/parallel_port_read_16px.png  |   Bin 3496 -> 0 bytes
 .../images/parallel_port_warning_16px.png          |   Bin 3476 -> 816 bytes
 .../VirtualBox/images/parallel_port_write_16px.png |   Bin 3480 -> 0 bytes
 src/VBox/Frontends/VirtualBox/images/pin_16px.png  |   Bin 3390 -> 729 bytes
 .../images/preview_empty_16to10_242x167px.png      |   Bin 0 -> 1906 bytes
 .../images/preview_empty_16to9_242x155px.png       |   Bin 0 -> 1867 bytes
 .../VirtualBox/images/preview_empty_228x168px.png  |   Bin 4545 -> 0 bytes
 .../images/preview_empty_4to3_242x192px.png        |   Bin 0 -> 1957 bytes
 .../images/preview_full_16to10_242x167px.png       |   Bin 0 -> 4776 bytes
 .../images/preview_full_16to9_242x155px.png        |   Bin 0 -> 4487 bytes
 .../VirtualBox/images/preview_full_228x168px.png   |   Bin 7401 -> 0 bytes
 .../images/preview_full_4to3_242x192px.png         |   Bin 0 -> 5254 bytes
 .../Frontends/VirtualBox/images/previous_16px.png  |   Bin 3237 -> 577 bytes
 .../VirtualBox/images/progress_clone_90px.png      |   Bin 10634 -> 8217 bytes
 .../VirtualBox/images/progress_delete_90px.png     |   Bin 11582 -> 8799 bytes
 .../VirtualBox/images/progress_dnd_gh_90px.png     |   Bin 9622 -> 6793 bytes
 .../VirtualBox/images/progress_dnd_hg_90px.png     |   Bin 9296 -> 6421 bytes
 .../VirtualBox/images/progress_export_90px.png     |   Bin 11821 -> 9466 bytes
 .../VirtualBox/images/progress_import_90px.png     |   Bin 12173 -> 9576 bytes
 .../progress_install_guest_additions_90px.png      |   Bin 11502 -> 8208 bytes
 .../images/progress_media_create_90px.png          |   Bin 13201 -> 7792 bytes
 .../images/progress_media_delete_90px.png          |   Bin 13226 -> 7800 bytes
 .../images/progress_network_interface_90px.png     |   Bin 0 -> 2307 bytes
 .../VirtualBox/images/progress_poweroff_90px.png   |   Bin 10969 -> 7572 bytes
 .../images/progress_reading_appliance_90px.png     |   Bin 0 -> 9433 bytes
 .../VirtualBox/images/progress_refresh_90px.png    |   Bin 0 -> 10838 bytes
 .../VirtualBox/images/progress_settings_90px.png   |   Bin 0 -> 9371 bytes
 .../images/progress_snapshot_create_90px.png       |   Bin 11241 -> 8186 bytes
 .../images/progress_snapshot_discard_90px.png      |   Bin 8911 -> 3890 bytes
 .../images/progress_snapshot_restore_90px.png      |   Bin 8936 -> 4090 bytes
 .../VirtualBox/images/progress_start_90px.png      |   Bin 10237 -> 7961 bytes
 .../images/progress_state_restore_90px.png         |   Bin 14794 -> 12378 bytes
 .../VirtualBox/images/progress_state_save_90px.png |   Bin 14228 -> 11818 bytes
 .../Frontends/VirtualBox/images/proxy_16px.png     |   Bin 3143 -> 484 bytes
 .../Frontends/VirtualBox/images/proxy_24px.png     |   Bin 0 -> 620 bytes
 .../Frontends/VirtualBox/images/proxy_32px.png     |   Bin 3456 -> 797 bytes
 .../VirtualBox/images/proxy_disabled_16px.png      |   Bin 3178 -> 0 bytes
 .../VirtualBox/images/proxy_disabled_32px.png      |   Bin 3436 -> 0 bytes
 .../VirtualBox/images/proxy_warning_16px.png       |   Bin 3383 -> 725 bytes
 src/VBox/Frontends/VirtualBox/images/ram_16px.png  |   Bin 3140 -> 481 bytes
 .../Frontends/VirtualBox/images/refresh_16px.png   |   Bin 3559 -> 900 bytes
 .../Frontends/VirtualBox/images/refresh_22px.png   |   Bin 4025 -> 1366 bytes
 .../Frontends/VirtualBox/images/refresh_24px.png   |   Bin 0 -> 1587 bytes
 .../Frontends/VirtualBox/images/refresh_32px.png   |   Bin 4923 -> 2264 bytes
 .../VirtualBox/images/refresh_disabled_16px.png    |   Bin 3519 -> 859 bytes
 .../VirtualBox/images/refresh_disabled_22px.png    |   Bin 3984 -> 1325 bytes
 .../VirtualBox/images/refresh_disabled_32px.png    |   Bin 4798 -> 2139 bytes
 .../VirtualBox/images/refresh_warning_16px.png     |   Bin 3574 -> 915 bytes
 .../Frontends/VirtualBox/images/register_16px.png  |   Bin 3574 -> 0 bytes
 .../Frontends/VirtualBox/images/register_32px.png  |   Bin 5076 -> 0 bytes
 .../VirtualBox/images/register_disabled_16px.png   |   Bin 3551 -> 0 bytes
 .../VirtualBox/images/remove_host_iface_16px.png   |   Bin 3188 -> 529 bytes
 .../images/remove_host_iface_disabled_16px.png     |   Bin 3162 -> 503 bytes
 .../VirtualBox/images/reset_warnings_16px.png      |   Bin 3305 -> 646 bytes
 .../Frontends/VirtualBox/images/restore_16px.png   |   Bin 2972 -> 316 bytes
 src/VBox/Frontends/VirtualBox/images/sata_16px.png |   Bin 3290 -> 630 bytes
 .../Frontends/VirtualBox/images/sata_add_16px.png  |   Bin 3396 -> 737 bytes
 .../VirtualBox/images/sata_add_disabled_16px.png   |   Bin 3413 -> 754 bytes
 .../VirtualBox/images/sata_collapse_16px.png       |   Bin 3303 -> 644 bytes
 .../VirtualBox/images/sata_expand_16px.png         |   Bin 3386 -> 726 bytes
 .../Frontends/VirtualBox/images/scale_16px.png     |   Bin 3116 -> 440 bytes
 .../VirtualBox/images/scale_disabled_16px.png      |   Bin 3091 -> 406 bytes
 .../VirtualBox/images/scale_factor_16px.png        |   Bin 0 -> 322 bytes
 .../images/scale_factor_disabled_16px.png          |   Bin 0 -> 297 bytes
 .../Frontends/VirtualBox/images/scale_on_16px.png  |   Bin 3138 -> 456 bytes
 .../VirtualBox/images/scale_on_disabled_16px.png   |   Bin 3117 -> 436 bytes
 .../VirtualBox/images/screenshot_take_16px.png     |   Bin 3297 -> 611 bytes
 .../images/screenshot_take_disabled_16px.png       |   Bin 3261 -> 591 bytes
 src/VBox/Frontends/VirtualBox/images/scsi_16px.png |   Bin 3495 -> 846 bytes
 .../Frontends/VirtualBox/images/scsi_add_16px.png  |   Bin 3495 -> 841 bytes
 .../VirtualBox/images/scsi_add_disabled_16px.png   |   Bin 3440 -> 787 bytes
 .../VirtualBox/images/scsi_collapse_16px.png       |   Bin 3467 -> 807 bytes
 .../VirtualBox/images/scsi_expand_16px.png         |   Bin 3481 -> 822 bytes
 .../Frontends/VirtualBox/images/seamless_16px.png  |   Bin 2970 -> 364 bytes
 .../VirtualBox/images/seamless_disabled_16px.png   |   Bin 2951 -> 359 bytes
 .../VirtualBox/images/seamless_on_16px.png         |   Bin 3045 -> 401 bytes
 .../images/seamless_on_disabled_16px.png           |   Bin 3027 -> 396 bytes
 .../VirtualBox/images/select_file_16px.png         |   Bin 3356 -> 696 bytes
 .../images/select_file_disabled_16px.png           |   Bin 3334 -> 675 bytes
 .../VirtualBox/images/serial_port_16px.png         |   Bin 3437 -> 778 bytes
 .../VirtualBox/images/serial_port_24px.png         |   Bin 0 -> 1542 bytes
 .../VirtualBox/images/serial_port_32px.png         |   Bin 5086 -> 2427 bytes
 .../images/serial_port_disabled_16px.png           |   Bin 3519 -> 0 bytes
 .../images/serial_port_disabled_32px.png           |   Bin 5051 -> 0 bytes
 .../VirtualBox/images/serial_port_read_16px.png    |   Bin 3491 -> 0 bytes
 .../VirtualBox/images/serial_port_warning_16px.png |   Bin 3491 -> 831 bytes
 .../VirtualBox/images/serial_port_write_16px.png   |   Bin 3482 -> 0 bytes
 .../VirtualBox/images/session_info_16px.png        |   Bin 3517 -> 858 bytes
 .../VirtualBox/images/session_info_32px.png        |   Bin 4730 -> 2071 bytes
 .../images/session_info_details_16px.png           |   Bin 3401 -> 742 bytes
 .../images/session_info_disabled_16px.png          |   Bin 3507 -> 848 bytes
 .../images/session_info_disabled_32px.png          |   Bin 4681 -> 0 bytes
 .../images/session_info_runtime_16px.png           |   Bin 3341 -> 682 bytes
 src/VBox/Frontends/VirtualBox/images/sf_16px.png   |   Bin 3021 -> 362 bytes
 src/VBox/Frontends/VirtualBox/images/sf_24px.png   |   Bin 0 -> 444 bytes
 src/VBox/Frontends/VirtualBox/images/sf_32px.png   |   Bin 3303 -> 643 bytes
 .../Frontends/VirtualBox/images/sf_add_16px.png    |   Bin 3260 -> 601 bytes
 .../VirtualBox/images/sf_add_disabled_16px.png     |   Bin 3240 -> 581 bytes
 .../VirtualBox/images/sf_disabled_16px.png         |   Bin 3025 -> 366 bytes
 .../VirtualBox/images/sf_disabled_32px.png         |   Bin 3255 -> 0 bytes
 .../Frontends/VirtualBox/images/sf_edit_16px.png   |   Bin 3231 -> 572 bytes
 .../VirtualBox/images/sf_edit_disabled_16px.png    |   Bin 3241 -> 582 bytes
 .../Frontends/VirtualBox/images/sf_read_16px.png   |   Bin 3239 -> 580 bytes
 .../Frontends/VirtualBox/images/sf_remove_16px.png |   Bin 3108 -> 449 bytes
 .../VirtualBox/images/sf_remove_disabled_16px.png  |   Bin 3102 -> 443 bytes
 .../VirtualBox/images/sf_settings_16px.png         |   Bin 3339 -> 680 bytes
 .../images/sf_settings_disabled_16px.png           |   Bin 3455 -> 674 bytes
 .../VirtualBox/images/sf_warning_16px.png          |   Bin 3343 -> 684 bytes
 .../Frontends/VirtualBox/images/sf_write_16px.png  |   Bin 3231 -> 572 bytes
 .../VirtualBox/images/shared_clipboard_16px.png    |   Bin 3003 -> 344 bytes
 .../images/shared_clipboard_disabled_16px.png      |   Bin 2991 -> 332 bytes
 src/VBox/Frontends/VirtualBox/images/site_16px.png |   Bin 3567 -> 908 bytes
 src/VBox/Frontends/VirtualBox/images/site_24px.png |   Bin 0 -> 1567 bytes
 src/VBox/Frontends/VirtualBox/images/site_32px.png |   Bin 4944 -> 2285 bytes
 .../VirtualBox/images/site_disabled_16px.png       |   Bin 3549 -> 0 bytes
 .../VirtualBox/images/site_disabled_32px.png       |   Bin 4781 -> 0 bytes
 .../VirtualBox/images/site_warning_16px.png        |   Bin 3567 -> 907 bytes
 .../VirtualBox/images/snapshot_delete_16px.png     |   Bin 3473 -> 814 bytes
 .../VirtualBox/images/snapshot_delete_22px.png     |   Bin 3909 -> 1250 bytes
 .../images/snapshot_delete_disabled_16px.png       |   Bin 3444 -> 785 bytes
 .../images/snapshot_delete_disabled_22px.png       |   Bin 3866 -> 1202 bytes
 .../VirtualBox/images/snapshot_offline_16px.png    |   Bin 3375 -> 716 bytes
 .../VirtualBox/images/snapshot_online_16px.png     |   Bin 3429 -> 771 bytes
 .../VirtualBox/images/snapshot_restore_16px.png    |   Bin 3425 -> 766 bytes
 .../VirtualBox/images/snapshot_restore_22px.png    |   Bin 3859 -> 1200 bytes
 .../images/snapshot_restore_disabled_16px.png      |   Bin 3411 -> 752 bytes
 .../images/snapshot_restore_disabled_22px.png      |   Bin 3824 -> 1165 bytes
 .../images/snapshot_show_details_16px.png          |   Bin 3407 -> 748 bytes
 .../images/snapshot_show_details_22px.png          |   Bin 3839 -> 1177 bytes
 .../images/snapshot_show_details_disabled_16px.png |   Bin 3400 -> 741 bytes
 .../images/snapshot_show_details_disabled_22px.png |   Bin 3807 -> 1147 bytes
 .../VirtualBox/images/snapshot_take_16px.png       |   Bin 3241 -> 582 bytes
 .../VirtualBox/images/snapshot_take_22px.png       |   Bin 3571 -> 911 bytes
 .../images/snapshot_take_disabled_16px.png         |   Bin 3234 -> 575 bytes
 .../images/snapshot_take_disabled_22px.png         |   Bin 3482 -> 823 bytes
 src/VBox/Frontends/VirtualBox/images/sort_16px.png |   Bin 3362 -> 703 bytes
 .../VirtualBox/images/sort_disabled_16px.png       |   Bin 3315 -> 655 bytes
 .../Frontends/VirtualBox/images/sound_16px.png     |   Bin 3332 -> 673 bytes
 .../Frontends/VirtualBox/images/sound_24px.png     |   Bin 0 -> 962 bytes
 .../Frontends/VirtualBox/images/sound_32px.png     |   Bin 4107 -> 1448 bytes
 .../VirtualBox/images/sound_disabled_16px.png      |   Bin 3333 -> 0 bytes
 .../VirtualBox/images/sound_disabled_32px.png      |   Bin 4006 -> 0 bytes
 .../VirtualBox/images/sound_warning_16px.png       |   Bin 3425 -> 766 bytes
 .../VirtualBox/images/state_aborted_16px.png       |   Bin 3355 -> 696 bytes
 .../VirtualBox/images/state_discarding_16px.png    |   Bin 3435 -> 777 bytes
 .../VirtualBox/images/state_paused_16px.png        |   Bin 3015 -> 355 bytes
 .../VirtualBox/images/state_powered_off_16px.png   |   Bin 3567 -> 908 bytes
 .../VirtualBox/images/state_restoring_16px.png     |   Bin 3386 -> 727 bytes
 .../VirtualBox/images/state_running_16px.png       |   Bin 3364 -> 705 bytes
 .../VirtualBox/images/state_saved_16px.png         |   Bin 3388 -> 729 bytes
 .../VirtualBox/images/state_saving_16px.png        |   Bin 3408 -> 749 bytes
 .../VirtualBox/images/state_stuck_16px.png         |   Bin 3176 -> 516 bytes
 .../VirtualBox/images/status_check_16px.png        |   Bin 3416 -> 762 bytes
 .../VirtualBox/images/status_check_32px.png        |   Bin 4540 -> 0 bytes
 .../VirtualBox/images/status_error_16px.png        |   Bin 3512 -> 853 bytes
 .../VirtualBox/images/status_error_32px.png        |   Bin 4654 -> 0 bytes
 .../Frontends/VirtualBox/images/statusbar_16px.png |   Bin 0 -> 352 bytes
 .../VirtualBox/images/statusbar_disabled_16px.png  |   Bin 0 -> 313 bytes
 .../VirtualBox/images/statusbar_on_16px.png        |   Bin 0 -> 381 bytes
 .../images/statusbar_on_disabled_16px.png          |   Bin 0 -> 355 bytes
 .../VirtualBox/images/statusbar_settings_16px.png  |   Bin 0 -> 639 bytes
 .../images/statusbar_settings_disabled_16px.png    |   Bin 0 -> 601 bytes
 src/VBox/Frontends/VirtualBox/images/tpixel.png    |   Bin 163 -> 910 bytes
 .../VirtualBox/images/transparent_16px.png         |   Bin 114 -> 0 bytes
 .../VirtualBox/images/unused/attachment_16px.png   |   Bin 0 -> 431 bytes
 .../VirtualBox/images/unused/attachment_24px.png   |   Bin 0 -> 615 bytes
 .../images/unused/attachment_disabled_16px.png     |   Bin 0 -> 410 bytes
 .../images/unused/auto_resize_off_16px.png         |   Bin 0 -> 514 bytes
 .../images/unused/auto_resize_off_16px_hidpi.png   |   Bin 0 -> 1014 bytes
 .../unused/auto_resize_off_disabled_16px.png       |   Bin 0 -> 513 bytes
 .../Frontends/VirtualBox/images/unused/cd_22px.png |   Bin 0 -> 1313 bytes
 .../Frontends/VirtualBox/images/unused/cd_24px.png |   Bin 0 -> 1486 bytes
 .../Frontends/VirtualBox/images/unused/cd_32px.png |   Bin 0 -> 2160 bytes
 .../VirtualBox/images/unused/cd_add_22px.png       |   Bin 0 -> 1349 bytes
 .../images/unused/cd_add_disabled_22px.png         |   Bin 0 -> 1365 bytes
 .../VirtualBox/images/unused/cd_disabled_32px.png  |   Bin 0 -> 2137 bytes
 .../VirtualBox/images/unused/cd_new_16px.png       |   Bin 0 -> 935 bytes
 .../VirtualBox/images/unused/cd_new_22px.png       |   Bin 0 -> 1395 bytes
 .../images/unused/cd_new_disabled_16px.png         |   Bin 0 -> 972 bytes
 .../images/unused/cd_new_disabled_22px.png         |   Bin 0 -> 1475 bytes
 .../images/unused/chipset_disabled_16px.png        |   Bin 0 -> 450 bytes
 .../images/unused/chipset_disabled_32px.png        |   Bin 0 -> 825 bytes
 .../VirtualBox/images/unused/close_red_16px.png    |   Bin 0 -> 877 bytes
 .../images/unused/description_disabled_16px.png    |   Bin 0 -> 841 bytes
 .../images/unused/description_edit_16px.png        |   Bin 0 -> 879 bytes
 .../unused/description_edit_disabled_16px.png      |   Bin 0 -> 901 bytes
 .../images/unused/discard_cur_state_16px.png       |   Bin 0 -> 638 bytes
 .../images/unused/discard_cur_state_22px.png       |   Bin 0 -> 844 bytes
 .../images/unused/discard_cur_state_dis_16px.png   |   Bin 0 -> 607 bytes
 .../images/unused/discard_cur_state_dis_22px.png   |   Bin 0 -> 807 bytes
 .../unused/discard_cur_state_snapshot_16px.png     |   Bin 0 -> 824 bytes
 .../unused/discard_cur_state_snapshot_22px.png     |   Bin 0 -> 1070 bytes
 .../unused/discard_cur_state_snapshot_dis_16px.png |   Bin 0 -> 806 bytes
 .../unused/discard_cur_state_snapshot_dis_22px.png |   Bin 0 -> 1042 bytes
 .../images/unused/diskimage_disabled_32px.png      |   Bin 0 -> 1500 bytes
 .../images/unused/eraser_disabled_16px.png         |   Bin 0 -> 688 bytes
 .../images/unused/extension_pack_disabled_16px.png |   Bin 0 -> 410 bytes
 .../images/unused/extension_pack_disabled_32px.png |   Bin 0 -> 802 bytes
 .../images/unused/extension_pack_install_32px.png  |   Bin 0 -> 1402 bytes
 .../extension_pack_install_disabled_32px.png       |   Bin 0 -> 1220 bytes
 .../unused/extension_pack_uninstall_32px.png       |   Bin 0 -> 1724 bytes
 .../extension_pack_uninstall_disabled_32px.png     |   Bin 0 -> 1546 bytes
 .../Frontends/VirtualBox/images/unused/fd_22px.png |   Bin 0 -> 613 bytes
 .../Frontends/VirtualBox/images/unused/fd_24px.png |   Bin 0 -> 676 bytes
 .../Frontends/VirtualBox/images/unused/fd_32px.png |   Bin 0 -> 1060 bytes
 .../VirtualBox/images/unused/fd_add_22px.png       |   Bin 0 -> 948 bytes
 .../images/unused/fd_add_disabled_22px.png         |   Bin 0 -> 852 bytes
 .../VirtualBox/images/unused/fd_disabled_32px.png  |   Bin 0 -> 867 bytes
 .../VirtualBox/images/unused/fd_new_16px.png       |   Bin 0 -> 647 bytes
 .../VirtualBox/images/unused/fd_new_22px.png       |   Bin 0 -> 956 bytes
 .../images/unused/fd_new_disabled_16px.png         |   Bin 0 -> 623 bytes
 .../images/unused/fd_new_disabled_22px.png         |   Bin 0 -> 901 bytes
 .../unused/global_settings_disabled_16px.png       |   Bin 0 -> 708 bytes
 .../VirtualBox/images/unused/go_to_error_16px.png  |   Bin 0 -> 739 bytes
 .../images/unused/go_to_error_disabled_16px.png    |   Bin 0 -> 738 bytes
 .../Frontends/VirtualBox/images/unused/hd_22px.png |   Bin 0 -> 999 bytes
 .../VirtualBox/images/unused/hd_add_22px.png       |   Bin 0 -> 1152 bytes
 .../images/unused/hd_add_disabled_22px.png         |   Bin 0 -> 1075 bytes
 .../VirtualBox/images/unused/hd_disabled_32px.png  |   Bin 0 -> 1731 bytes
 .../VirtualBox/images/unused/hd_new_22px.png       |   Bin 0 -> 1241 bytes
 .../images/unused/hd_new_disabled_22px.png         |   Bin 0 -> 1207 bytes
 .../images/unused/hostkey_disabled_32px.png        |   Bin 0 -> 1160 bytes
 .../images/unused/list_movedown_22px.png           |   Bin 0 -> 614 bytes
 .../images/unused/list_movedown_disabled_22px.png  |   Bin 0 -> 553 bytes
 .../VirtualBox/images/unused/list_moveup_22px.png  |   Bin 0 -> 604 bytes
 .../images/unused/list_moveup_disabled_22px.png    |   Bin 0 -> 545 bytes
 .../images/unused/machine_disabled_16px.png        |   Bin 0 -> 370 bytes
 .../images/unused/machine_disabled_32px.png        |   Bin 0 -> 685 bytes
 .../VirtualBox/images/unused/nw_disabled_32px.png  |   Bin 0 -> 786 bytes
 .../images/unused/parallel_port_disabled_16px.png  |   Bin 0 -> 792 bytes
 .../images/unused/parallel_port_disabled_32px.png  |   Bin 0 -> 2110 bytes
 .../images/unused/parallel_port_read_16px.png      |   Bin 0 -> 832 bytes
 .../images/unused/parallel_port_write_16px.png     |   Bin 0 -> 821 bytes
 .../images/unused/proxy_disabled_16px.png          |   Bin 0 -> 519 bytes
 .../images/unused/proxy_disabled_32px.png          |   Bin 0 -> 776 bytes
 .../VirtualBox/images/unused/register_16px.png     |   Bin 0 -> 915 bytes
 .../VirtualBox/images/unused/register_32px.png     |   Bin 0 -> 2417 bytes
 .../images/unused/register_disabled_16px.png       |   Bin 0 -> 892 bytes
 .../images/unused/serial_port_disabled_16px.png    |   Bin 0 -> 860 bytes
 .../images/unused/serial_port_disabled_32px.png    |   Bin 0 -> 2391 bytes
 .../images/unused/serial_port_read_16px.png        |   Bin 0 -> 832 bytes
 .../images/unused/serial_port_write_16px.png       |   Bin 0 -> 823 bytes
 .../images/unused/session_info_disabled_32px.png   |   Bin 0 -> 2012 bytes
 .../VirtualBox/images/unused/sf_disabled_32px.png  |   Bin 0 -> 596 bytes
 .../images/unused/site_disabled_16px.png           |   Bin 0 -> 890 bytes
 .../images/unused/site_disabled_32px.png           |   Bin 0 -> 2122 bytes
 .../images/unused/sound_disabled_16px.png          |   Bin 0 -> 670 bytes
 .../images/unused/sound_disabled_32px.png          |   Bin 0 -> 1347 bytes
 .../VirtualBox/images/unused/status_check_32px.png |   Bin 0 -> 1880 bytes
 .../VirtualBox/images/unused/status_error_32px.png |   Bin 0 -> 1990 bytes
 .../VirtualBox/images/unused/transparent_16px.png  |   Bin 0 -> 150 bytes
 .../VirtualBox/images/unused/usb_disabled_32px.png |   Bin 0 -> 1878 bytes
 .../images/unused/video_capture_write_16px.png     |   Bin 0 -> 640 bytes
 .../VirtualBox/images/unused/vm_add_32px.png       |   Bin 0 -> 1234 bytes
 .../images/unused/vm_new_disabled_32px.png         |   Bin 0 -> 2152 bytes
 .../VirtualBox/images/unused/vm_show_logs_22px.png |   Bin 0 -> 852 bytes
 .../images/unused/vm_show_logs_disabled_22px.png   |   Bin 0 -> 840 bytes
 .../images/unused/vrdp_disabled_32px.png           |   Bin 0 -> 855 bytes
 src/VBox/Frontends/VirtualBox/images/usb_16px.png  |   Bin 3323 -> 676 bytes
 src/VBox/Frontends/VirtualBox/images/usb_24px.png  |   Bin 0 -> 1233 bytes
 src/VBox/Frontends/VirtualBox/images/usb_32px.png  |   Bin 4612 -> 1953 bytes
 .../Frontends/VirtualBox/images/usb_add_16px.png   |   Bin 3382 -> 729 bytes
 .../VirtualBox/images/usb_add_disabled_16px.png    |   Bin 3378 -> 719 bytes
 .../VirtualBox/images/usb_collapse_16px.png        |   Bin 0 -> 647 bytes
 .../VirtualBox/images/usb_disabled_16px.png        |   Bin 3370 -> 711 bytes
 .../VirtualBox/images/usb_disabled_32px.png        |   Bin 4537 -> 0 bytes
 .../VirtualBox/images/usb_expand_16px.png          |   Bin 0 -> 714 bytes
 .../VirtualBox/images/usb_filter_edit_16px.png     |   Bin 3427 -> 774 bytes
 .../images/usb_filter_edit_disabled_16px.png       |   Bin 3483 -> 824 bytes
 .../VirtualBox/images/usb_movedown_16px.png        |   Bin 3431 -> 780 bytes
 .../images/usb_movedown_disabled_16px.png          |   Bin 3488 -> 831 bytes
 .../VirtualBox/images/usb_moveup_16px.png          |   Bin 3417 -> 767 bytes
 .../VirtualBox/images/usb_moveup_disabled_16px.png |   Bin 3470 -> 810 bytes
 .../Frontends/VirtualBox/images/usb_new_16px.png   |   Bin 3437 -> 787 bytes
 .../VirtualBox/images/usb_new_disabled_16px.png    |   Bin 3483 -> 824 bytes
 .../Frontends/VirtualBox/images/usb_read_16px.png  |   Bin 3436 -> 786 bytes
 .../VirtualBox/images/usb_remove_16px.png          |   Bin 3307 -> 657 bytes
 .../VirtualBox/images/usb_remove_disabled_16px.png |   Bin 3340 -> 681 bytes
 .../VirtualBox/images/usb_settings_16px.png        |   Bin 0 -> 785 bytes
 .../images/usb_settings_disabled_16px.png          |   Bin 0 -> 793 bytes
 .../VirtualBox/images/usb_unavailable_16px.png     |   Bin 3450 -> 791 bytes
 .../images/usb_unavailable_disabled_16px.png       |   Bin 3482 -> 823 bytes
 .../VirtualBox/images/usb_warning_16px.png         |   Bin 3448 -> 787 bytes
 .../Frontends/VirtualBox/images/usb_write_16px.png |   Bin 3428 -> 775 bytes
 .../VirtualBox/images/video_capture_16px.png       |   Bin 3073 -> 442 bytes
 .../images/video_capture_disabled_16px.png         |   Bin 3072 -> 435 bytes
 .../VirtualBox/images/video_capture_on_16px.png    |   Bin 3058 -> 479 bytes
 .../images/video_capture_on_disabled_16px.png      |   Bin 3060 -> 474 bytes
 .../images/video_capture_settings_16px.png         |   Bin 3365 -> 710 bytes
 .../VirtualBox/images/video_capture_write_16px.png |   Bin 3299 -> 0 bytes
 .../VirtualBox/images/virtual_screen_16px.png      |   Bin 0 -> 606 bytes
 .../images/virtual_screen_disabled_16px.png        |   Bin 0 -> 559 bytes
 .../Frontends/VirtualBox/images/vm_add_16px.png    |   Bin 3216 -> 557 bytes
 .../Frontends/VirtualBox/images/vm_add_32px.png    |   Bin 3893 -> 0 bytes
 .../Frontends/VirtualBox/images/vm_clone_16px.png  |   Bin 3218 -> 875 bytes
 .../Frontends/VirtualBox/images/vm_clone_22px.png  |   Bin 3315 -> 1346 bytes
 .../VirtualBox/images/vm_clone_disabled_16px.png   |   Bin 3235 -> 851 bytes
 .../VirtualBox/images/vm_clone_disabled_22px.png   |   Bin 3259 -> 1325 bytes
 .../VirtualBox/images/vm_create_shortcut_16px.png  |   Bin 3287 -> 627 bytes
 .../images/vm_create_shortcut_disabled_16px.png    |   Bin 3286 -> 627 bytes
 .../Frontends/VirtualBox/images/vm_delete_16px.png |   Bin 3532 -> 872 bytes
 .../Frontends/VirtualBox/images/vm_delete_32px.png |   Bin 5095 -> 2435 bytes
 .../VirtualBox/images/vm_delete_disabled_16px.png  |   Bin 3496 -> 836 bytes
 .../VirtualBox/images/vm_delete_disabled_32px.png  |   Bin 4911 -> 2252 bytes
 .../VirtualBox/images/vm_discard_16px.png          |   Bin 3410 -> 747 bytes
 .../VirtualBox/images/vm_discard_32px.png          |   Bin 4438 -> 1779 bytes
 .../VirtualBox/images/vm_discard_disabled_16px.png |   Bin 3370 -> 711 bytes
 .../VirtualBox/images/vm_discard_disabled_32px.png |   Bin 4267 -> 1608 bytes
 .../VirtualBox/images/vm_group_create_16px.png     |   Bin 3435 -> 776 bytes
 .../images/vm_group_create_disabled_16px.png       |   Bin 3335 -> 676 bytes
 .../VirtualBox/images/vm_group_name_16px.png       |   Bin 3423 -> 764 bytes
 .../images/vm_group_name_disabled_16px.png         |   Bin 3335 -> 676 bytes
 .../VirtualBox/images/vm_group_remove_16px.png     |   Bin 3489 -> 830 bytes
 .../images/vm_group_remove_disabled_16px.png       |   Bin 3410 -> 759 bytes
 .../Frontends/VirtualBox/images/vm_new_16px.png    |   Bin 3553 -> 893 bytes
 .../Frontends/VirtualBox/images/vm_new_32px.png    |   Bin 4870 -> 2211 bytes
 .../VirtualBox/images/vm_new_disabled_32px.png     |   Bin 4811 -> 0 bytes
 .../VirtualBox/images/vm_open_filemanager_16px.png |   Bin 2933 -> 274 bytes
 .../images/vm_open_filemanager_disabled_16px.png   |   Bin 2957 -> 298 bytes
 .../Frontends/VirtualBox/images/vm_pause_16px.png  |   Bin 3045 -> 386 bytes
 .../Frontends/VirtualBox/images/vm_pause_32px.png  |   Bin 3364 -> 705 bytes
 .../VirtualBox/images/vm_pause_disabled_16px.png   |   Bin 3013 -> 354 bytes
 .../VirtualBox/images/vm_pause_disabled_32px.png   |   Bin 3264 -> 604 bytes
 .../VirtualBox/images/vm_pause_on_16px.png         |   Bin 3105 -> 446 bytes
 .../images/vm_pause_on_disabled_16px.png           |   Bin 3085 -> 426 bytes
 .../VirtualBox/images/vm_poweroff_16px.png         |   Bin 3454 -> 791 bytes
 .../images/vm_poweroff_disabled_16px.png           |   Bin 3411 -> 752 bytes
 .../Frontends/VirtualBox/images/vm_reset_16px.png  |   Bin 3583 -> 924 bytes
 .../VirtualBox/images/vm_reset_disabled_16px.png   |   Bin 3600 -> 935 bytes
 .../VirtualBox/images/vm_save_state_16px.png       |   Bin 3409 -> 749 bytes
 .../images/vm_save_state_disabled_16px.png         |   Bin 3478 -> 722 bytes
 .../VirtualBox/images/vm_settings_16px.png         |   Bin 3577 -> 922 bytes
 .../VirtualBox/images/vm_settings_32px.png         |   Bin 5070 -> 2411 bytes
 .../images/vm_settings_disabled_16px.png           |   Bin 3560 -> 900 bytes
 .../images/vm_settings_disabled_32px.png           |   Bin 4902 -> 2242 bytes
 .../VirtualBox/images/vm_show_logs_16px.png        |   Bin 3359 -> 700 bytes
 .../VirtualBox/images/vm_show_logs_22px.png        |   Bin 3511 -> 0 bytes
 .../VirtualBox/images/vm_show_logs_32px.png        |   Bin 4014 -> 1354 bytes
 .../images/vm_show_logs_disabled_16px.png          |   Bin 3309 -> 650 bytes
 .../images/vm_show_logs_disabled_22px.png          |   Bin 3499 -> 0 bytes
 .../images/vm_show_logs_disabled_32px.png          |   Bin 3877 -> 1218 bytes
 .../VirtualBox/images/vm_shutdown_16px.png         |   Bin 3567 -> 908 bytes
 .../images/vm_shutdown_disabled_16px.png           |   Bin 3562 -> 897 bytes
 .../Frontends/VirtualBox/images/vm_start_16px.png  |   Bin 3364 -> 705 bytes
 .../Frontends/VirtualBox/images/vm_start_32px.png  |   Bin 4441 -> 1792 bytes
 .../VirtualBox/images/vm_start_disabled_16px.png   |   Bin 3373 -> 713 bytes
 .../VirtualBox/images/vm_start_disabled_32px.png   |   Bin 4360 -> 1701 bytes
 src/VBox/Frontends/VirtualBox/images/vmw_clone.png |   Bin 30619 -> 27742 bytes
 .../Frontends/VirtualBox/images/vmw_clone_bg.png   |   Bin 47316 -> 44728 bytes
 .../Frontends/VirtualBox/images/vmw_first_run.png  |   Bin 43754 -> 41216 bytes
 .../VirtualBox/images/vmw_first_run_bg.png         |   Bin 89818 -> 87170 bytes
 .../VirtualBox/images/vmw_new_harddisk.png         |   Bin 31693 -> 29028 bytes
 .../VirtualBox/images/vmw_new_harddisk_bg.png      |   Bin 72822 -> 70076 bytes
 .../Frontends/VirtualBox/images/vmw_new_user.png   |   Bin 31785 -> 29072 bytes
 .../VirtualBox/images/vmw_new_user_bg.png          |   Bin 77308 -> 74685 bytes
 .../VirtualBox/images/vmw_new_welcome.png          |   Bin 29235 -> 26554 bytes
 .../VirtualBox/images/vmw_new_welcome_bg.png       |   Bin 67348 -> 64773 bytes
 .../Frontends/VirtualBox/images/vmw_ovf_export.png |   Bin 32895 -> 30125 bytes
 .../VirtualBox/images/vmw_ovf_export_bg.png        |   Bin 62261 -> 59484 bytes
 .../Frontends/VirtualBox/images/vmw_ovf_import.png |   Bin 33188 -> 30338 bytes
 .../VirtualBox/images/vmw_ovf_import_bg.png        |   Bin 62931 -> 60202 bytes
 src/VBox/Frontends/VirtualBox/images/vrdp_16px.png |   Bin 3077 -> 418 bytes
 src/VBox/Frontends/VirtualBox/images/vrdp_24px.png |   Bin 0 -> 509 bytes
 src/VBox/Frontends/VirtualBox/images/vrdp_32px.png |   Bin 3654 -> 995 bytes
 .../VirtualBox/images/vrdp_disabled_16px.png       |   Bin 3066 -> 406 bytes
 .../VirtualBox/images/vrdp_disabled_32px.png       |   Bin 3515 -> 0 bytes
 .../Frontends/VirtualBox/images/vrdp_on_16px.png   |   Bin 3104 -> 444 bytes
 .../VirtualBox/images/vrdp_on_disabled_16px.png    |   Bin 3070 -> 411 bytes
 .../VirtualBox/images/vrdp_warning_16px.png        |   Bin 3319 -> 660 bytes
 .../Frontends/VirtualBox/images/vtx_amdv_16px.png  |   Bin 3335 -> 675 bytes
 .../VirtualBox/images/vtx_amdv_disabled_16px.png   |   Bin 3288 -> 629 bytes
 .../VirtualBox/images/web_camera_16px.png          |   Bin 3415 -> 756 bytes
 .../VirtualBox/images/web_camera_disabled_16px.png |   Bin 3421 -> 762 bytes
 .../images/web_camera_unavailable_16px.png         |   Bin 0 -> 885 bytes
 .../web_camera_unavailable_disabled_16px.png       |   Bin 0 -> 854 bytes
 src/VBox/Frontends/VirtualBox/images/welcome.png   |   Bin 31861 -> 31948 bytes
 .../Frontends/VirtualBox/nls/ApprovedLanguages.kmk |     2 -
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_bg.ts |  2702 ++-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca.ts |  2541 ++-
 .../Frontends/VirtualBox/nls/VirtualBox_ca_VA.ts   |  2544 ++-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts |  1707 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_da.ts |  2309 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_de.ts |  1570 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_en.ts |    41 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts |  1387 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_eu.ts | 16546 ++++++++------
 .../Frontends/VirtualBox/nls/VirtualBox_fa_IR.ts   |  2173 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_fi.ts |  1614 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts |  2163 +-
 .../Frontends/VirtualBox/nls/VirtualBox_gl_ES.ts   |  1636 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_hu.ts |  2472 ++-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_id.ts |  3639 ++--
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_it.ts |  1550 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_ja.ts |  3898 ++--
 .../Frontends/VirtualBox/nls/VirtualBox_km_KH.ts   |  2598 ++-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_ko.ts |  1708 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_lt.ts |  1552 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_nl.ts |  1503 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_pl.ts |  1780 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt.ts |  1918 +-
 .../Frontends/VirtualBox/nls/VirtualBox_pt_BR.ts   |  2078 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_ro.ts |  1913 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts |  1627 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_sk.ts |  1659 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_sr.ts |  1643 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_sv.ts |  2802 ++-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_tr.ts |  2133 +-
 src/VBox/Frontends/VirtualBox/nls/VirtualBox_uk.ts |  1663 +-
 .../Frontends/VirtualBox/nls/VirtualBox_xx_YY.ts   |  1406 +-
 .../Frontends/VirtualBox/nls/VirtualBox_zh_CN.ts   |  1602 +-
 .../Frontends/VirtualBox/nls/VirtualBox_zh_TW.ts   |  1677 +-
 src/VBox/Frontends/VirtualBox/nls/qt_bg.ts         |   444 +-
 src/VBox/Frontends/VirtualBox/nls/qt_ca.ts         |     2 +-
 src/VBox/Frontends/VirtualBox/nls/qt_ca_VA.ts      |     2 +-
 src/VBox/Frontends/VirtualBox/nls/qt_eu.ts         |  3677 ++--
 src/VBox/Frontends/VirtualBox/nls/qt_fa_IR.ts      |     6 +-
 src/VBox/Frontends/VirtualBox/nls/qt_it.ts         |   134 +-
 src/VBox/Frontends/VirtualBox/nls/qt_zh_CN.ts      |     9 +-
 src/VBox/Frontends/VirtualBox/nls/qt_zh_TW.ts      |    32 +-
 src/VBox/Frontends/VirtualBox/shaders/cconvAYUV.c  |     1 +
 .../Frontends/VirtualBox/shaders/cconvAYUV_void.c  |     1 +
 .../Frontends/VirtualBox/shaders/cconvApplyAYUV.c  |     1 +
 src/VBox/Frontends/VirtualBox/shaders/cconvBGR.c   |     1 +
 .../Frontends/VirtualBox/shaders/cconvBGR_void.c   |     1 +
 src/VBox/Frontends/VirtualBox/shaders/cconvUYVY.c  |     1 +
 .../Frontends/VirtualBox/shaders/cconvUYVY_void.c  |     1 +
 src/VBox/Frontends/VirtualBox/shaders/cconvYUY2.c  |     1 +
 .../Frontends/VirtualBox/shaders/cconvYUY2_void.c  |     1 +
 src/VBox/Frontends/VirtualBox/shaders/cconvYV12.c  |     1 +
 .../Frontends/VirtualBox/shaders/cconvYV12_void.c  |     1 +
 src/VBox/Frontends/VirtualBox/shaders/ckeyDst.c    |     1 +
 src/VBox/Frontends/VirtualBox/shaders/ckeyDst2.c   |     1 +
 .../Frontends/VirtualBox/shaders/ckeyDst_void.c    |     1 +
 .../Frontends/VirtualBox/shaders/mainOverlay.c     |     1 +
 .../VirtualBox/shaders/mainOverlayNoCKey.c         |     1 +
 .../VirtualBox/shaders/mainOverlayNoDiscard.c      |     1 +
 .../VirtualBox/shaders/mainOverlayNoDiscard2.c     |     1 +
 src/VBox/Frontends/VirtualBox/shaders/splitBGRA.c  |     1 +
 .../VirtualBox/src/UIMediumTypeChangeDialog.cpp    |    11 +-
 .../VirtualBox/src/UIMediumTypeChangeDialog.h      |     5 +-
 .../Frontends/VirtualBox/src/UIVMInfoDialog.cpp    |   918 +
 src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.h |   159 +
 .../Frontends/VirtualBox/src/UIVMLogViewer.cpp     |    57 +-
 src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.h  |     5 +-
 src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.cpp |    31 +-
 src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h   |     8 +-
 .../Frontends/VirtualBox/src/VBoxFBOverlay.cpp     |   243 +-
 src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h  |   162 +-
 .../Frontends/VirtualBox/src/VBoxFBOverlayCommon.h |     5 +-
 .../Frontends/VirtualBox/src/VBoxGLSupportInfo.cpp |    38 +-
 .../VirtualBox/src/VBoxGlobalSettings.cpp          |    35 +-
 .../Frontends/VirtualBox/src/VBoxGlobalSettings.h  |    13 +-
 .../Frontends/VirtualBox/src/VBoxLicenseViewer.cpp |    25 +-
 .../Frontends/VirtualBox/src/VBoxLicenseViewer.h   |     5 +-
 .../VirtualBox/src/VBoxSnapshotDetailsDlg.cpp      |    27 +-
 .../VirtualBox/src/VBoxSnapshotDetailsDlg.h        |     5 +-
 .../VirtualBox/src/VBoxTakeSnapshotDlg.cpp         |    31 +-
 .../Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.h |     5 +-
 .../VirtualBox/src/VBoxVMInformationDlg.cpp        |   733 -
 .../VirtualBox/src/VBoxVMInformationDlg.h          |    92 -
 .../VirtualBox/src/VBoxVMInformationDlg.ui         |   155 -
 .../VirtualBox/src/converter/UIConverter.cpp       |    11 +-
 .../VirtualBox/src/converter/UIConverter.h         |    28 +-
 .../VirtualBox/src/converter/UIConverterBackend.h  |   111 +-
 .../src/converter/UIConverterBackendCOM.cpp        |   129 +-
 .../src/converter/UIConverterBackendGlobal.cpp     |   911 +-
 .../VirtualBox/src/extensions/QIAdvancedSlider.cpp |    23 +-
 .../VirtualBox/src/extensions/QIAdvancedSlider.h   |     5 +-
 .../src/extensions/QIAdvancedToolBar.cpp           |    17 +-
 .../VirtualBox/src/extensions/QIAdvancedToolBar.h  |     5 +-
 .../src/extensions/QIArrowButtonPress.cpp          |    75 +-
 .../VirtualBox/src/extensions/QIArrowButtonPress.h |    54 +-
 .../src/extensions/QIArrowButtonSwitch.cpp         |    80 +-
 .../src/extensions/QIArrowButtonSwitch.h           |    63 +-
 .../VirtualBox/src/extensions/QIArrowSplitter.cpp  |   393 +-
 .../VirtualBox/src/extensions/QIArrowSplitter.h    |   111 +-
 .../VirtualBox/src/extensions/QIDialog.cpp         |    31 +-
 .../Frontends/VirtualBox/src/extensions/QIDialog.h |     5 +-
 .../src/extensions/QIDialogButtonBox.cpp           |    23 +-
 .../VirtualBox/src/extensions/QIDialogButtonBox.h  |     5 +-
 .../VirtualBox/src/extensions/QIFileDialog.cpp     |   146 +-
 .../VirtualBox/src/extensions/QIFileDialog.h       |     5 +-
 .../VirtualBox/src/extensions/QILabel.cpp          |    31 +-
 .../Frontends/VirtualBox/src/extensions/QILabel.h  |     5 +-
 .../VirtualBox/src/extensions/QILabelSeparator.cpp |    17 +-
 .../VirtualBox/src/extensions/QILabelSeparator.h   |     5 +-
 .../VirtualBox/src/extensions/QILineEdit.cpp       |    24 +-
 .../VirtualBox/src/extensions/QILineEdit.h         |     5 +-
 .../VirtualBox/src/extensions/QIListView.cpp       |    20 +-
 .../VirtualBox/src/extensions/QIListView.h         |     5 +-
 .../VirtualBox/src/extensions/QIMainDialog.cpp     |   429 +-
 .../VirtualBox/src/extensions/QIMainDialog.h       |   111 +-
 .../Frontends/VirtualBox/src/extensions/QIMenu.cpp |    40 +
 .../Frontends/VirtualBox/src/extensions/QIMenu.h   |    41 +
 .../VirtualBox/src/extensions/QIMessageBox.cpp     |   330 +-
 .../VirtualBox/src/extensions/QIMessageBox.h       |   148 +-
 .../VirtualBox/src/extensions/QIProcess.cpp        |    11 +-
 .../VirtualBox/src/extensions/QIProcess.h          |     5 +-
 .../VirtualBox/src/extensions/QIRichTextLabel.cpp  |    17 +-
 .../VirtualBox/src/extensions/QIRichTextLabel.h    |     5 +-
 .../VirtualBox/src/extensions/QIRichToolButton.cpp |   177 +-
 .../VirtualBox/src/extensions/QIRichToolButton.h   |    77 +-
 .../VirtualBox/src/extensions/QISplitter.cpp       |    21 +-
 .../VirtualBox/src/extensions/QISplitter.h         |     5 +-
 .../VirtualBox/src/extensions/QIStateIndicator.cpp |   126 -
 .../VirtualBox/src/extensions/QIStateIndicator.h   |    92 -
 .../VirtualBox/src/extensions/QIStatusBar.cpp      |    11 +-
 .../VirtualBox/src/extensions/QIStatusBar.h        |     5 +-
 .../src/extensions/QIStatusBarIndicator.cpp        |   139 +
 .../src/extensions/QIStatusBarIndicator.h          |   128 +
 .../src/extensions/QIStyledItemDelegate.h          |    67 +
 .../VirtualBox/src/extensions/QITabWidget.h        |     5 +-
 .../VirtualBox/src/extensions/QITableView.cpp      |    13 +-
 .../VirtualBox/src/extensions/QITableView.h        |     5 +-
 .../VirtualBox/src/extensions/QITextEdit.cpp       |    33 -
 .../VirtualBox/src/extensions/QITextEdit.h         |    39 -
 .../VirtualBox/src/extensions/QIToolButton.h       |    26 +-
 .../VirtualBox/src/extensions/QITreeView.cpp       |    17 +-
 .../VirtualBox/src/extensions/QITreeView.h         |     5 +-
 .../VirtualBox/src/extensions/QITreeWidget.cpp     |    17 +-
 .../VirtualBox/src/extensions/QITreeWidget.h       |     5 +-
 .../src/extensions/QIWidgetValidator.cpp           |   115 +-
 .../VirtualBox/src/extensions/QIWidgetValidator.h  |    85 +-
 .../src/extensions/graphics/QIGraphicsWidget.cpp   |    13 +-
 .../src/extensions/graphics/QIGraphicsWidget.h     |     5 +-
 .../VirtualBox/src/extradata/UIExtraDataDefs.cpp   |   166 +
 .../VirtualBox/src/extradata/UIExtraDataDefs.h     |   648 +
 .../src/extradata/UIExtraDataManager.cpp           |  3873 ++++
 .../VirtualBox/src/extradata/UIExtraDataManager.h  |   607 +
 .../Frontends/VirtualBox/src/globals/CIShared.h    |     5 +-
 .../Frontends/VirtualBox/src/globals/COMDefs.cpp   |    46 +-
 .../Frontends/VirtualBox/src/globals/COMDefs.h     |    29 +-
 .../VirtualBox/src/globals/COMWrappers.xsl         |   318 +-
 .../VirtualBox/src/globals/QIWithRetranslateUI.h   |     6 +-
 .../VirtualBox/src/globals/UIActionPool.cpp        |  1064 +-
 .../VirtualBox/src/globals/UIActionPool.h          |   498 +-
 .../src/globals/UIAnimationFramework.cpp           |    29 +-
 .../VirtualBox/src/globals/UIAnimationFramework.h  |     5 +-
 .../Frontends/VirtualBox/src/globals/UIDefs.cpp    |   148 +-
 src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h |   421 +-
 .../src/globals/UIExtraDataEventHandler.cpp        |   226 -
 .../src/globals/UIExtraDataEventHandler.h          |    60 -
 .../VirtualBox/src/globals/UIIconPool.cpp          |   342 +-
 .../Frontends/VirtualBox/src/globals/UIIconPool.h  |   119 +-
 .../VirtualBox/src/globals/UIImageTools.cpp        |    15 +-
 .../VirtualBox/src/globals/UIImageTools.h          |     5 +-
 .../VirtualBox/src/globals/UIMainEventListener.cpp |   194 +-
 .../VirtualBox/src/globals/UIMainEventListener.h   |    81 +-
 .../VirtualBox/src/globals/UIMessageCenter.cpp     |   410 +-
 .../VirtualBox/src/globals/UIMessageCenter.h       |    54 +-
 .../src/globals/UIModalWindowManager.cpp           |    29 +-
 .../VirtualBox/src/globals/UIModalWindowManager.h  |     5 +-
 .../VirtualBox/src/globals/UIPopupCenter.cpp       |    37 +-
 .../VirtualBox/src/globals/UIPopupCenter.h         |     5 +-
 .../VirtualBox/src/globals/UIShortcutPool.cpp      |    27 +-
 .../VirtualBox/src/globals/UIShortcutPool.h        |     5 +-
 .../VirtualBox/src/globals/UIThreadPool.cpp        |    20 +-
 .../VirtualBox/src/globals/UIThreadPool.h          |     1 +
 .../VirtualBox/src/globals/VBoxGlobal.cpp          |  1678 +-
 .../Frontends/VirtualBox/src/globals/VBoxGlobal.h  |   208 +-
 .../Frontends/VirtualBox/src/globals/VBoxUtils.h   |    31 +-
 .../Frontends/VirtualBox/src/globals/VBoxVersion.h |     5 +-
 src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp |    52 +-
 src/VBox/Frontends/VirtualBox/src/main.cpp         |   207 +-
 .../Frontends/VirtualBox/src/medium/UIMedium.cpp   |   498 +-
 .../Frontends/VirtualBox/src/medium/UIMedium.h     |   366 +-
 .../VirtualBox/src/medium/UIMediumDefs.cpp         |    13 +-
 .../Frontends/VirtualBox/src/medium/UIMediumDefs.h |    60 +-
 .../VirtualBox/src/medium/UIMediumEnumerator.cpp   |    52 +-
 .../VirtualBox/src/medium/UIMediumEnumerator.h     |     1 +
 .../VirtualBox/src/medium/UIMediumManager.cpp      |  2747 ++-
 .../VirtualBox/src/medium/UIMediumManager.h        |   294 +-
 .../VirtualBox/src/medium/UIMediumManager.ui       |   321 -
 .../Frontends/VirtualBox/src/net/UIDownloader.cpp  |    21 +-
 .../Frontends/VirtualBox/src/net/UIDownloader.h    |     5 +-
 .../VirtualBox/src/net/UIDownloaderAdditions.cpp   |    27 +-
 .../VirtualBox/src/net/UIDownloaderAdditions.h     |     5 +-
 .../src/net/UIDownloaderExtensionPack.cpp          |    30 +-
 .../VirtualBox/src/net/UIDownloaderExtensionPack.h |     5 +-
 .../VirtualBox/src/net/UIDownloaderUserManual.cpp  |    27 +-
 .../VirtualBox/src/net/UIDownloaderUserManual.h    |     5 +-
 .../VirtualBox/src/net/UINetworkCustomer.cpp       |    19 +-
 .../VirtualBox/src/net/UINetworkCustomer.h         |     5 +-
 .../Frontends/VirtualBox/src/net/UINetworkDefs.h   |     5 +-
 .../VirtualBox/src/net/UINetworkManager.cpp        |    27 +-
 .../VirtualBox/src/net/UINetworkManager.h          |     5 +-
 .../VirtualBox/src/net/UINetworkManagerDialog.cpp  |    43 +-
 .../VirtualBox/src/net/UINetworkManagerDialog.h    |     5 +-
 .../src/net/UINetworkManagerIndicator.cpp          |    17 +-
 .../VirtualBox/src/net/UINetworkManagerIndicator.h |    15 +-
 .../VirtualBox/src/net/UINetworkReply.cpp          |    30 +-
 .../Frontends/VirtualBox/src/net/UINetworkReply.h  |     5 +-
 .../VirtualBox/src/net/UINetworkRequest.cpp        |    27 +-
 .../VirtualBox/src/net/UINetworkRequest.h          |     5 +-
 .../VirtualBox/src/net/UINetworkRequestWidget.cpp  |    31 +-
 .../VirtualBox/src/net/UINetworkRequestWidget.h    |     5 +-
 .../Frontends/VirtualBox/src/net/UIUpdateDefs.cpp  |    19 +-
 .../Frontends/VirtualBox/src/net/UIUpdateDefs.h    |     5 +-
 .../VirtualBox/src/net/UIUpdateManager.cpp         |    88 +-
 .../Frontends/VirtualBox/src/net/UIUpdateManager.h |     5 +-
 .../VirtualBox/src/objects/UIRichTextString.cpp    |   233 +
 .../VirtualBox/src/objects/UIRichTextString.h      |   114 +
 .../VirtualBox/src/platform/UIDesktopServices.h    |     5 +-
 .../src/platform/darwin/CocoaEventHelper.h         |     7 +-
 .../src/platform/darwin/CocoaEventHelper.mm        |     5 +-
 .../src/platform/darwin/DarwinKeyboard.h           |     3 +-
 .../src/platform/darwin/DockIconPreview.h          |     4 +-
 .../platform/darwin/UIAbstractDockIconPreview.cpp  |    19 +-
 .../platform/darwin/UIAbstractDockIconPreview.h    |     4 +-
 .../src/platform/darwin/UICocoaApplication.h       |     3 +-
 .../src/platform/darwin/UICocoaApplication.mm      |     2 +-
 .../src/platform/darwin/UICocoaDockIconPreview.h   |     4 +-
 .../src/platform/darwin/UICocoaDockIconPreview.mm  |     4 +-
 .../src/platform/darwin/UICocoaSpecialControls.h   |    41 +-
 .../src/platform/darwin/UICocoaSpecialControls.mm  |   223 +-
 .../platform/darwin/UIDesktopServices_darwin.cpp   |     4 +-
 .../darwin/UIDesktopServices_darwin_cocoa.mm       |     4 +-
 .../platform/darwin/UIDesktopServices_darwin_p.h   |     5 +-
 .../src/platform/darwin/UIWindowMenuManager.cpp    |    23 +-
 .../src/platform/darwin/UIWindowMenuManager.h      |     5 +-
 .../src/platform/darwin/VBoxCocoaHelper.h          |     5 +-
 .../src/platform/darwin/VBoxIChatTheaterWrapper.h  |     2 +-
 .../src/platform/darwin/VBoxIChatTheaterWrapper.m  |     2 +-
 .../src/platform/darwin/VBoxUtils-darwin-cocoa.mm  |    30 +-
 .../src/platform/darwin/VBoxUtils-darwin.cpp       |     7 +-
 .../src/platform/darwin/VBoxUtils-darwin.h         |     8 +-
 .../src/platform/darwin/tstDarwinKeyboard.cpp      |    21 +-
 .../VirtualBox/src/platform/darwin/vmstarter.mm    |     5 +-
 .../VirtualBox/src/platform/os2/VBoxHlp.asm        |     4 +-
 .../VirtualBox/src/platform/os2/VBoxHlp.cpp        |     3 +-
 .../VirtualBox/src/platform/os2/VBoxHlp.h          |     4 +-
 .../src/platform/win/UIDesktopServices_win.cpp     |    19 +-
 .../VirtualBox/src/platform/win/VBoxUtils-win.cpp  |     4 +-
 .../VirtualBox/src/platform/win/VBoxUtils-win.h    |     5 +-
 .../VirtualBox/src/platform/win/VirtualBox.rc      |    35 +-
 .../src/platform/win/VirtualBoxHardened.rc         |    29 +-
 .../VirtualBox/src/platform/win/WinKeyboard.cpp    |    15 +-
 .../VirtualBox/src/platform/win/WinKeyboard.h      |     4 +-
 .../src/platform/x11/UIDesktopServices_x11.cpp     |    25 +-
 .../VirtualBox/src/platform/x11/VBoxX11Helper.cpp  |     4 +-
 .../VirtualBox/src/platform/x11/VBoxX11Helper.h    |     5 +-
 .../VirtualBox/src/platform/x11/XKeyboard-new.cpp  |     5 +-
 .../VirtualBox/src/platform/x11/XKeyboard.h        |     5 +-
 src/VBox/Frontends/VirtualBox/src/precomp.cpp      |     4 +
 src/VBox/Frontends/VirtualBox/src/precomp.h        |   659 +-
 .../VirtualBox/src/runtime/UIActionPoolRuntime.cpp |  2737 ++-
 .../VirtualBox/src/runtime/UIActionPoolRuntime.h   |   322 +-
 .../runtime/UIAddDiskEncryptionPasswordDialog.cpp  |   623 +
 .../runtime/UIAddDiskEncryptionPasswordDialog.h    |    90 +
 .../src/runtime/UIConsoleEventHandler.cpp          |   176 +-
 .../VirtualBox/src/runtime/UIConsoleEventHandler.h |    71 +-
 .../VirtualBox/src/runtime/UIDnDDataObject_win.cpp |   744 +
 .../VirtualBox/src/runtime/UIDnDDataObject_win.h   |   107 +
 .../VirtualBox/src/runtime/UIDnDDropSource_win.cpp |   148 +
 .../VirtualBox/src/runtime/UIDnDDropSource_win.h   |    55 +
 .../VirtualBox/src/runtime/UIDnDEnumFormat_win.cpp |   191 +
 .../VirtualBox/src/runtime/UIDnDEnumFormat_win.h   |    54 +
 .../VirtualBox/src/runtime/UIDnDHandler.cpp        |   676 +-
 .../VirtualBox/src/runtime/UIDnDHandler.h          |   121 +-
 .../VirtualBox/src/runtime/UIDnDMIMEData.cpp       |   320 +
 .../VirtualBox/src/runtime/UIDnDMIMEData.h         |   108 +
 .../VirtualBox/src/runtime/UIFrameBuffer.cpp       |  1640 +-
 .../VirtualBox/src/runtime/UIFrameBuffer.h         |   333 +-
 .../VirtualBox/src/runtime/UIFrameBufferQImage.cpp |   389 -
 .../VirtualBox/src/runtime/UIFrameBufferQImage.h   |    75 -
 .../src/runtime/UIFrameBufferQuartz2D.cpp          |   528 -
 .../VirtualBox/src/runtime/UIFrameBufferQuartz2D.h |    90 -
 .../VirtualBox/src/runtime/UIIndicatorsPool.cpp    |  1249 +-
 .../VirtualBox/src/runtime/UIIndicatorsPool.h      |   108 +-
 .../VirtualBox/src/runtime/UIKeyboardHandler.cpp   |   142 +-
 .../VirtualBox/src/runtime/UIKeyboardHandler.h     |    30 +-
 .../Frontends/VirtualBox/src/runtime/UIMachine.cpp |   452 +-
 .../Frontends/VirtualBox/src/runtime/UIMachine.h   |    89 +-
 .../VirtualBox/src/runtime/UIMachineDefs.h         |    16 +-
 .../VirtualBox/src/runtime/UIMachineLogic.cpp      |  2385 +-
 .../VirtualBox/src/runtime/UIMachineLogic.h        |   151 +-
 .../VirtualBox/src/runtime/UIMachineMenuBar.cpp    |   634 -
 .../VirtualBox/src/runtime/UIMachineMenuBar.h      |    69 -
 .../VirtualBox/src/runtime/UIMachineView.cpp       |  1328 +-
 .../VirtualBox/src/runtime/UIMachineView.h         |   153 +-
 .../VirtualBox/src/runtime/UIMachineWindow.cpp     |   173 +-
 .../VirtualBox/src/runtime/UIMachineWindow.h       |    36 +-
 .../src/runtime/UIMenuBarEditorWindow.cpp          |  1037 +
 .../VirtualBox/src/runtime/UIMenuBarEditorWindow.h |   205 +
 .../VirtualBox/src/runtime/UIMouseHandler.cpp      |   210 +-
 .../VirtualBox/src/runtime/UIMouseHandler.h        |    28 +-
 .../VirtualBox/src/runtime/UIMultiScreenLayout.cpp |   218 +-
 .../VirtualBox/src/runtime/UIMultiScreenLayout.h   |    25 +-
 .../Frontends/VirtualBox/src/runtime/UISession.cpp |  1713 +-
 .../Frontends/VirtualBox/src/runtime/UISession.h   |   263 +-
 .../VirtualBox/src/runtime/UISlidingToolBar.cpp    |   321 +
 .../VirtualBox/src/runtime/UISlidingToolBar.h      |   145 +
 .../src/runtime/UIStatusBarEditorWindow.cpp        |   720 +
 .../src/runtime/UIStatusBarEditorWindow.h          |   161 +
 .../VirtualBox/src/runtime/UIVMCloseDialog.cpp     |    89 +-
 .../VirtualBox/src/runtime/UIVMCloseDialog.h       |    13 +-
 .../fullscreen/UIKeyboardHandlerFullscreen.cpp     |    36 +-
 .../fullscreen/UIKeyboardHandlerFullscreen.h       |    21 +-
 .../fullscreen/UIMachineLogicFullscreen.cpp        |   294 +-
 .../runtime/fullscreen/UIMachineLogicFullscreen.h  |    29 +-
 .../runtime/fullscreen/UIMachineViewFullscreen.cpp |    60 +-
 .../runtime/fullscreen/UIMachineViewFullscreen.h   |     5 +-
 .../fullscreen/UIMachineWindowFullscreen.cpp       |   228 +-
 .../runtime/fullscreen/UIMachineWindowFullscreen.h |    29 +-
 .../src/runtime/normal/UIKeyboardHandlerNormal.cpp |    82 +-
 .../src/runtime/normal/UIKeyboardHandlerNormal.h   |    23 +-
 .../src/runtime/normal/UIMachineLogicNormal.cpp    |   279 +-
 .../src/runtime/normal/UIMachineLogicNormal.h      |    41 +-
 .../src/runtime/normal/UIMachineViewNormal.cpp     |    86 +-
 .../src/runtime/normal/UIMachineViewNormal.h       |     5 +-
 .../src/runtime/normal/UIMachineWindowNormal.cpp   |   630 +-
 .../src/runtime/normal/UIMachineWindowNormal.h     |    55 +-
 .../src/runtime/scale/UIKeyboardHandlerScale.cpp   |    48 +-
 .../src/runtime/scale/UIKeyboardHandlerScale.h     |    23 +-
 .../src/runtime/scale/UIMachineLogicScale.cpp      |   130 +-
 .../src/runtime/scale/UIMachineLogicScale.h        |    19 +
 .../src/runtime/scale/UIMachineViewScale.cpp       |   178 +-
 .../src/runtime/scale/UIMachineViewScale.h         |    19 +-
 .../src/runtime/scale/UIMachineWindowScale.cpp     |   162 +-
 .../src/runtime/scale/UIMachineWindowScale.h       |    17 +-
 .../runtime/seamless/UIKeyboardHandlerSeamless.cpp |    44 +-
 .../runtime/seamless/UIKeyboardHandlerSeamless.h   |    23 +-
 .../runtime/seamless/UIMachineLogicSeamless.cpp    |   158 +-
 .../src/runtime/seamless/UIMachineLogicSeamless.h  |    17 +-
 .../src/runtime/seamless/UIMachineViewSeamless.cpp |    63 +-
 .../src/runtime/seamless/UIMachineViewSeamless.h   |     5 +-
 .../runtime/seamless/UIMachineWindowSeamless.cpp   |   192 +-
 .../src/runtime/seamless/UIMachineWindowSeamless.h |    34 +-
 .../src/selector/UIActionPoolSelector.cpp          |   466 +-
 .../VirtualBox/src/selector/UIActionPoolSelector.h |   151 +-
 .../VirtualBox/src/selector/UISelectorWindow.cpp   |   973 +-
 .../VirtualBox/src/selector/UISelectorWindow.h     |    83 +-
 .../VirtualBox/src/selector/UIVMDesktop.cpp        |    77 +-
 .../VirtualBox/src/selector/UIVMDesktop.h          |     1 +
 .../Frontends/VirtualBox/src/selector/UIVMItem.cpp |   122 +-
 .../Frontends/VirtualBox/src/selector/UIVMItem.h   |    22 +-
 .../src/selector/UIVirtualBoxEventHandler.cpp      |    96 +-
 .../src/selector/UIVirtualBoxEventHandler.h        |    48 +-
 .../VirtualBox/src/selector/VBoxSnapshotsWgt.cpp   |   241 +-
 .../VirtualBox/src/selector/VBoxSnapshotsWgt.h     |    15 +-
 .../src/selector/graphics/chooser/UIGChooser.cpp   |    32 +-
 .../src/selector/graphics/chooser/UIGChooser.h     |    17 +-
 .../graphics/chooser/UIGChooserHandlerKeyboard.cpp |    19 +-
 .../graphics/chooser/UIGChooserHandlerKeyboard.h   |     5 +-
 .../graphics/chooser/UIGChooserHandlerMouse.cpp    |    21 +-
 .../graphics/chooser/UIGChooserHandlerMouse.h      |     5 +-
 .../selector/graphics/chooser/UIGChooserItem.cpp   |    46 +-
 .../src/selector/graphics/chooser/UIGChooserItem.h |    11 +-
 .../graphics/chooser/UIGChooserItemGroup.cpp       |    48 +-
 .../graphics/chooser/UIGChooserItemGroup.h         |     5 +-
 .../graphics/chooser/UIGChooserItemMachine.cpp     |    75 +-
 .../graphics/chooser/UIGChooserItemMachine.h       |     5 +-
 .../selector/graphics/chooser/UIGChooserModel.cpp  |   260 +-
 .../selector/graphics/chooser/UIGChooserModel.h    |    17 +-
 .../selector/graphics/chooser/UIGChooserView.cpp   |    17 +-
 .../src/selector/graphics/chooser/UIGChooserView.h |     5 +-
 .../src/selector/graphics/details/UIGDetails.cpp   |    21 +-
 .../src/selector/graphics/details/UIGDetails.h     |     5 +-
 .../graphics/details/UIGDetailsElement.cpp         |   467 +-
 .../selector/graphics/details/UIGDetailsElement.h  |    40 +-
 .../graphics/details/UIGDetailsElements.cpp        |   288 +-
 .../selector/graphics/details/UIGDetailsElements.h |    46 +-
 .../selector/graphics/details/UIGDetailsGroup.cpp  |    52 +-
 .../selector/graphics/details/UIGDetailsGroup.h    |     7 +-
 .../selector/graphics/details/UIGDetailsItem.cpp   |    27 +-
 .../src/selector/graphics/details/UIGDetailsItem.h |     5 +-
 .../selector/graphics/details/UIGDetailsModel.cpp  |   108 +-
 .../selector/graphics/details/UIGDetailsModel.h    |    14 +-
 .../selector/graphics/details/UIGDetailsSet.cpp    |    62 +-
 .../src/selector/graphics/details/UIGDetailsSet.h  |    26 +-
 .../selector/graphics/details/UIGDetailsView.cpp   |    17 +-
 .../src/selector/graphics/details/UIGDetailsView.h |     5 +-
 .../graphics/details/UIGMachinePreview.cpp         |   448 +-
 .../selector/graphics/details/UIGMachinePreview.h  |    51 +-
 .../VirtualBox/src/settings/UISettingsDefs.cpp     |    41 +-
 .../VirtualBox/src/settings/UISettingsDefs.h       |    32 +-
 .../VirtualBox/src/settings/UISettingsDialog.cpp   |   201 +-
 .../VirtualBox/src/settings/UISettingsDialog.h     |    58 +-
 .../src/settings/UISettingsDialogSpecific.cpp      |   710 +-
 .../src/settings/UISettingsDialogSpecific.h        |    34 +-
 .../VirtualBox/src/settings/UISettingsPage.cpp     |    19 +-
 .../VirtualBox/src/settings/UISettingsPage.h       |    35 +-
 .../src/settings/UISettingsSerializer.cpp          |   388 +
 .../VirtualBox/src/settings/UISettingsSerializer.h |   229 +
 .../src/settings/VBoxSettingsSelector.cpp          |    62 +-
 .../VirtualBox/src/settings/VBoxSettingsSelector.h |    14 +-
 .../settings/global/UIGlobalSettingsDisplay.cpp    |    25 +-
 .../src/settings/global/UIGlobalSettingsDisplay.h  |     5 +-
 .../settings/global/UIGlobalSettingsExtension.cpp  |    32 +-
 .../settings/global/UIGlobalSettingsExtension.h    |     5 +-
 .../settings/global/UIGlobalSettingsGeneral.cpp    |    36 +-
 .../src/settings/global/UIGlobalSettingsGeneral.h  |     8 +-
 .../src/settings/global/UIGlobalSettingsGeneral.ui |    27 +-
 .../src/settings/global/UIGlobalSettingsInput.cpp  |    91 +-
 .../src/settings/global/UIGlobalSettingsInput.h    |     7 +-
 .../src/settings/global/UIGlobalSettingsInput.ui   |     3 -
 .../settings/global/UIGlobalSettingsLanguage.cpp   |    32 +-
 .../src/settings/global/UIGlobalSettingsLanguage.h |     5 +-
 .../settings/global/UIGlobalSettingsNetwork.cpp    |    52 +-
 .../src/settings/global/UIGlobalSettingsNetwork.h  |     5 +-
 .../src/settings/global/UIGlobalSettingsNetwork.ui |    10 +-
 .../global/UIGlobalSettingsNetworkDetailsHost.cpp  |    17 +-
 .../global/UIGlobalSettingsNetworkDetailsHost.h    |     5 +-
 .../global/UIGlobalSettingsNetworkDetailsNAT.cpp   |    24 +-
 .../global/UIGlobalSettingsNetworkDetailsNAT.h     |     5 +-
 .../global/UIGlobalSettingsPortForwardingDlg.cpp   |    25 +-
 .../global/UIGlobalSettingsPortForwardingDlg.h     |     5 +-
 .../src/settings/global/UIGlobalSettingsProxy.cpp  |    19 +-
 .../src/settings/global/UIGlobalSettingsProxy.h    |     5 +-
 .../src/settings/global/UIGlobalSettingsUpdate.cpp |    20 +-
 .../src/settings/global/UIGlobalSettingsUpdate.h   |     5 +-
 .../settings/machine/UIMachineSettingsAudio.cpp    |    17 +-
 .../src/settings/machine/UIMachineSettingsAudio.h  |     5 +-
 .../settings/machine/UIMachineSettingsDisplay.cpp  |   160 +-
 .../settings/machine/UIMachineSettingsDisplay.h    |    37 +-
 .../settings/machine/UIMachineSettingsDisplay.ui   |   107 +-
 .../settings/machine/UIMachineSettingsGeneral.cpp  |   580 +-
 .../settings/machine/UIMachineSettingsGeneral.h    |   159 +-
 .../settings/machine/UIMachineSettingsGeneral.ui   |   230 +-
 .../machine/UIMachineSettingsInterface.cpp         |   188 +
 .../settings/machine/UIMachineSettingsInterface.h  |   121 +
 .../settings/machine/UIMachineSettingsInterface.ui |   146 +
 .../settings/machine/UIMachineSettingsNetwork.cpp  |    39 +-
 .../settings/machine/UIMachineSettingsNetwork.h    |     5 +-
 .../settings/machine/UIMachineSettingsNetwork.ui   |     7 -
 .../settings/machine/UIMachineSettingsParallel.cpp |    23 +-
 .../settings/machine/UIMachineSettingsParallel.h   |     5 +-
 .../machine/UIMachineSettingsPortForwardingDlg.cpp |    23 +-
 .../machine/UIMachineSettingsPortForwardingDlg.h   |     5 +-
 .../src/settings/machine/UIMachineSettingsSF.cpp   |    31 +-
 .../src/settings/machine/UIMachineSettingsSF.h     |     5 +-
 .../machine/UIMachineSettingsSFDetails.cpp         |    19 +-
 .../settings/machine/UIMachineSettingsSFDetails.h  |     5 +-
 .../settings/machine/UIMachineSettingsSFDetails.ui |     3 -
 .../settings/machine/UIMachineSettingsSerial.cpp   |    38 +-
 .../src/settings/machine/UIMachineSettingsSerial.h |     5 +-
 .../settings/machine/UIMachineSettingsSerial.ui    |    12 +-
 .../settings/machine/UIMachineSettingsStorage.cpp  |   718 +-
 .../settings/machine/UIMachineSettingsStorage.h    |   201 +-
 .../settings/machine/UIMachineSettingsStorage.ui   |   141 +-
 .../settings/machine/UIMachineSettingsSystem.cpp   |    95 +-
 .../src/settings/machine/UIMachineSettingsSystem.h |    16 +-
 .../settings/machine/UIMachineSettingsSystem.ui    |    58 +-
 .../src/settings/machine/UIMachineSettingsUSB.cpp  |   181 +-
 .../src/settings/machine/UIMachineSettingsUSB.h    |    13 +-
 .../src/settings/machine/UIMachineSettingsUSB.ui   |    68 +-
 .../machine/UIMachineSettingsUSBFilterDetails.cpp  |    15 +-
 .../machine/UIMachineSettingsUSBFilterDetails.h    |     5 +-
 .../src/widgets/UIApplianceEditorWidget.cpp        |    41 +-
 .../src/widgets/UIApplianceEditorWidget.h          |     5 +-
 .../src/widgets/UIApplianceExportEditorWidget.cpp  |    19 +-
 .../src/widgets/UIApplianceExportEditorWidget.h    |     5 +-
 .../src/widgets/UIApplianceImportEditorWidget.cpp  |    21 +-
 .../src/widgets/UIApplianceImportEditorWidget.h    |     5 +-
 .../Frontends/VirtualBox/src/widgets/UIBar.cpp     |    25 +-
 src/VBox/Frontends/VirtualBox/src/widgets/UIBar.h  |     5 +-
 .../VirtualBox/src/widgets/UIBootTable.cpp         |    42 +-
 .../Frontends/VirtualBox/src/widgets/UIBootTable.h |     5 +-
 .../VirtualBox/src/widgets/UIFilmContainer.cpp     |    25 +-
 .../VirtualBox/src/widgets/UIFilmContainer.h       |     5 +-
 .../VirtualBox/src/widgets/UIHostComboEditor.cpp   |    32 +-
 .../VirtualBox/src/widgets/UIHostComboEditor.h     |     5 +-
 .../VirtualBox/src/widgets/UIHotKeyEditor.cpp      |    27 +-
 .../VirtualBox/src/widgets/UIHotKeyEditor.h        |     5 +-
 .../VirtualBox/src/widgets/UILineTextEdit.cpp      |    29 +-
 .../VirtualBox/src/widgets/UILineTextEdit.h        |     5 +-
 .../Frontends/VirtualBox/src/widgets/UIMenuBar.cpp |    62 +
 .../Frontends/VirtualBox/src/widgets/UIMenuBar.h   |    46 +
 .../VirtualBox/src/widgets/UIMiniToolBar.cpp       |   244 +-
 .../VirtualBox/src/widgets/UIMiniToolBar.h         |    19 +-
 .../src/widgets/UINameAndSystemEditor.cpp          |    25 +-
 .../VirtualBox/src/widgets/UINameAndSystemEditor.h |     5 +-
 .../VirtualBox/src/widgets/UIPopupBox.cpp          |    25 +-
 .../Frontends/VirtualBox/src/widgets/UIPopupBox.h  |     5 +-
 .../VirtualBox/src/widgets/UIPopupPane.cpp         |    22 +-
 .../Frontends/VirtualBox/src/widgets/UIPopupPane.h |     5 +-
 .../src/widgets/UIPopupPaneButtonPane.cpp          |    26 +-
 .../VirtualBox/src/widgets/UIPopupPaneButtonPane.h |     5 +-
 .../VirtualBox/src/widgets/UIPopupPaneTextPane.cpp |    18 +-
 .../VirtualBox/src/widgets/UIPopupPaneTextPane.h   |     5 +-
 .../VirtualBox/src/widgets/UIPopupStack.cpp        |    26 +-
 .../VirtualBox/src/widgets/UIPopupStack.h          |     5 +-
 .../src/widgets/UIPopupStackViewport.cpp           |    16 +-
 .../VirtualBox/src/widgets/UIPopupStackViewport.h  |     5 +-
 .../src/widgets/UIPortForwardingTable.cpp          |   217 +-
 .../VirtualBox/src/widgets/UIPortForwardingTable.h |     5 +-
 .../VirtualBox/src/widgets/UIProgressDialog.cpp    |   118 +-
 .../VirtualBox/src/widgets/UIProgressDialog.h      |    56 +-
 .../VirtualBox/src/widgets/UISpacerWidgets.h       |     5 +-
 .../VirtualBox/src/widgets/UISpecialControls.cpp   |    51 +-
 .../VirtualBox/src/widgets/UISpecialControls.h     |    17 +-
 .../Frontends/VirtualBox/src/widgets/UIToolBar.cpp |    82 +-
 .../Frontends/VirtualBox/src/widgets/UIToolBar.h   |    30 +-
 .../VirtualBox/src/widgets/UIWarningPane.cpp       |    25 +-
 .../VirtualBox/src/widgets/UIWarningPane.h         |     5 +-
 .../src/widgets/VBoxFilePathSelectorWidget.cpp     |    43 +-
 .../src/widgets/VBoxFilePathSelectorWidget.h       |     5 +-
 .../VirtualBox/src/widgets/VBoxGuestRAMSlider.cpp  |    17 +-
 .../VirtualBox/src/widgets/VBoxGuestRAMSlider.h    |     5 +-
 .../VirtualBox/src/widgets/VBoxMediaComboBox.cpp   |    21 +-
 .../VirtualBox/src/widgets/VBoxMediaComboBox.h     |     5 +-
 .../src/widgets/VBoxOSTypeSelectorButton.cpp       |    19 +-
 .../src/widgets/VBoxOSTypeSelectorButton.h         |     5 +-
 .../src/widgets/graphics/UIGraphicsButton.cpp      |    17 +-
 .../src/widgets/graphics/UIGraphicsButton.h        |     5 +-
 .../widgets/graphics/UIGraphicsRotatorButton.cpp   |    24 +-
 .../src/widgets/graphics/UIGraphicsRotatorButton.h |     5 +-
 .../src/widgets/graphics/UIGraphicsTextPane.cpp    |   441 +
 .../src/widgets/graphics/UIGraphicsTextPane.h      |   133 +
 .../src/widgets/graphics/UIGraphicsToolBar.cpp     |    15 +-
 .../src/widgets/graphics/UIGraphicsToolBar.h       |     5 +-
 .../src/widgets/graphics/UIGraphicsZoomButton.cpp  |    23 +-
 .../src/widgets/graphics/UIGraphicsZoomButton.h    |     5 +-
 .../Frontends/VirtualBox/src/wizards/UIWizard.cpp  |   126 +-
 .../Frontends/VirtualBox/src/wizards/UIWizard.h    |    36 +-
 .../VirtualBox/src/wizards/UIWizardPage.cpp        |    19 +-
 .../VirtualBox/src/wizards/UIWizardPage.h          |     5 +-
 .../src/wizards/clonevd/UIWizardCloneVD.cpp        |    41 +-
 .../src/wizards/clonevd/UIWizardCloneVD.h          |     5 +-
 .../wizards/clonevd/UIWizardCloneVDPageBasic1.cpp  |    29 +-
 .../wizards/clonevd/UIWizardCloneVDPageBasic1.h    |     5 +-
 .../wizards/clonevd/UIWizardCloneVDPageBasic2.cpp  |    31 +-
 .../wizards/clonevd/UIWizardCloneVDPageBasic2.h    |     5 +-
 .../wizards/clonevd/UIWizardCloneVDPageBasic3.cpp  |    27 +-
 .../wizards/clonevd/UIWizardCloneVDPageBasic3.h    |     5 +-
 .../wizards/clonevd/UIWizardCloneVDPageBasic4.cpp  |    37 +-
 .../wizards/clonevd/UIWizardCloneVDPageBasic4.h    |     5 +-
 .../wizards/clonevd/UIWizardCloneVDPageExpert.cpp  |    41 +-
 .../wizards/clonevd/UIWizardCloneVDPageExpert.h    |     5 +-
 .../src/wizards/clonevm/UIWizardCloneVM.cpp        |    49 +-
 .../src/wizards/clonevm/UIWizardCloneVM.h          |     5 +-
 .../wizards/clonevm/UIWizardCloneVMPageBasic1.cpp  |    23 +-
 .../wizards/clonevm/UIWizardCloneVMPageBasic1.h    |     5 +-
 .../wizards/clonevm/UIWizardCloneVMPageBasic2.cpp  |    23 +-
 .../wizards/clonevm/UIWizardCloneVMPageBasic2.h    |     5 +-
 .../wizards/clonevm/UIWizardCloneVMPageBasic3.cpp  |    21 +-
 .../wizards/clonevm/UIWizardCloneVMPageBasic3.h    |     5 +-
 .../wizards/clonevm/UIWizardCloneVMPageExpert.cpp  |    27 +-
 .../wizards/clonevm/UIWizardCloneVMPageExpert.h    |     5 +-
 .../wizards/exportappliance/UIWizardExportApp.cpp  |   116 +-
 .../wizards/exportappliance/UIWizardExportApp.h    |     5 +-
 .../exportappliance/UIWizardExportAppDefs.h        |     5 +-
 .../UIWizardExportAppPageBasic1.cpp                |    29 +-
 .../exportappliance/UIWizardExportAppPageBasic1.h  |     5 +-
 .../UIWizardExportAppPageBasic2.cpp                |    32 +-
 .../exportappliance/UIWizardExportAppPageBasic2.h  |     5 +-
 .../UIWizardExportAppPageBasic3.cpp                |    46 +-
 .../exportappliance/UIWizardExportAppPageBasic3.h  |     5 +-
 .../UIWizardExportAppPageBasic4.cpp                |    29 +-
 .../exportappliance/UIWizardExportAppPageBasic4.h  |     5 +-
 .../UIWizardExportAppPageExpert.cpp                |    41 +-
 .../exportappliance/UIWizardExportAppPageExpert.h  |     5 +-
 .../src/wizards/firstrun/UIWizardFirstRun.cpp      |    31 +-
 .../src/wizards/firstrun/UIWizardFirstRun.h        |     5 +-
 .../wizards/firstrun/UIWizardFirstRunPageBasic.cpp |    33 +-
 .../wizards/firstrun/UIWizardFirstRunPageBasic.h   |     5 +-
 .../wizards/importappliance/UIWizardImportApp.cpp  |    44 +-
 .../wizards/importappliance/UIWizardImportApp.h    |     5 +-
 .../importappliance/UIWizardImportAppDefs.h        |     5 +-
 .../UIWizardImportAppPageBasic1.cpp                |    27 +-
 .../importappliance/UIWizardImportAppPageBasic1.h  |     5 +-
 .../UIWizardImportAppPageBasic2.cpp                |    19 +-
 .../importappliance/UIWizardImportAppPageBasic2.h  |     5 +-
 .../UIWizardImportAppPageExpert.cpp                |    27 +-
 .../importappliance/UIWizardImportAppPageExpert.h  |     5 +-
 .../VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp |    43 +-
 .../VirtualBox/src/wizards/newvd/UIWizardNewVD.h   |     7 +-
 .../src/wizards/newvd/UIWizardNewVDPageBasic1.cpp  |    31 +-
 .../src/wizards/newvd/UIWizardNewVDPageBasic1.h    |     5 +-
 .../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp  |    27 +-
 .../src/wizards/newvd/UIWizardNewVDPageBasic2.h    |     5 +-
 .../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp  |    49 +-
 .../src/wizards/newvd/UIWizardNewVDPageBasic3.h    |     5 +-
 .../src/wizards/newvd/UIWizardNewVDPageExpert.cpp  |    49 +-
 .../src/wizards/newvd/UIWizardNewVDPageExpert.h    |     5 +-
 .../VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp |    58 +-
 .../VirtualBox/src/wizards/newvm/UIWizardNewVM.h   |     5 +-
 .../src/wizards/newvm/UIWizardNewVMPageBasic1.cpp  |    45 +-
 .../src/wizards/newvm/UIWizardNewVMPageBasic1.h    |     5 +-
 .../src/wizards/newvm/UIWizardNewVMPageBasic2.cpp  |    33 +-
 .../src/wizards/newvm/UIWizardNewVMPageBasic2.h    |     5 +-
 .../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp  |    36 +-
 .../src/wizards/newvm/UIWizardNewVMPageBasic3.h    |     5 +-
 .../src/wizards/newvm/UIWizardNewVMPageExpert.cpp  |    45 +-
 .../src/wizards/newvm/UIWizardNewVMPageExpert.h    |     5 +-
 src/VBox/GuestHost/DragAndDrop/DnDDir.cpp          |   185 +
 src/VBox/GuestHost/DragAndDrop/DnDMIME.cpp         |    41 +
 src/VBox/GuestHost/DragAndDrop/DnDPath.cpp         |    57 +
 src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp      |   493 +
 src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp    |   402 +
 src/VBox/GuestHost/DragAndDrop/Makefile.kmk        |    53 +
 src/VBox/GuestHost/HGSMI/HGSMICommon.cpp           |   339 +-
 src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp         |   661 +
 src/VBox/GuestHost/HGSMI/Makefile.kmk              |     6 +-
 src/VBox/GuestHost/Makefile.kmk                    |     6 +-
 src/VBox/GuestHost/OpenGL/Makefile.kmk             |     8 +-
 src/VBox/GuestHost/OpenGL/error/VBoxOGLerrorspu.rc |    50 +-
 src/VBox/GuestHost/OpenGL/error/errorspu.rc        |    25 +-
 src/VBox/GuestHost/OpenGL/include/chromium.h       |     2 +-
 src/VBox/GuestHost/OpenGL/include/cr_dlm.h         |   655 -
 src/VBox/GuestHost/OpenGL/include/cr_server.h      |     7 +-
 src/VBox/GuestHost/OpenGL/include/state/cr_line.h  |     2 +-
 src/VBox/GuestHost/OpenGL/include/state/cr_point.h |     6 +-
 src/VBox/GuestHost/OpenGL/packer/pack_client.c     |     3 +-
 .../GuestHost/OpenGL/state_tracker/state_glsl.c    |     8 +-
 .../GuestHost/OpenGL/state_tracker/state_init.c    |    32 +-
 src/VBox/GuestHost/OpenGL/util/VBoxOGLcrutil.rc    |    47 +-
 src/VBox/GuestHost/OpenGL/util/compositor.cpp      |    30 +-
 src/VBox/GuestHost/OpenGL/util/error.c             |   634 +-
 src/VBox/GuestHost/OpenGL/util/hash.c              |     5 +-
 src/VBox/GuestHost/OpenGL/util/threads.c           |    15 +-
 src/VBox/GuestHost/OpenGL/util/util.rc             |    23 +-
 .../GuestHost/SharedClipboard/x11-clipboard.cpp    |    18 +-
 src/VBox/HostDrivers/Makefile.kmk                  |     4 +-
 src/VBox/HostDrivers/Support/Makefile.kmk          |   117 +-
 src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp     |    66 +-
 src/VBox/HostDrivers/Support/SUPDrv.c              |  6552 ------
 src/VBox/HostDrivers/Support/SUPDrv.cpp            |  5491 +++++
 src/VBox/HostDrivers/Support/SUPDrvGip.cpp         |  4725 ++++
 src/VBox/HostDrivers/Support/SUPDrvIOC.h           |   200 +-
 src/VBox/HostDrivers/Support/SUPDrvInternal.h      |   180 +-
 src/VBox/HostDrivers/Support/SUPDrvSem.c           |   421 -
 src/VBox/HostDrivers/Support/SUPDrvSem.cpp         |   421 +
 src/VBox/HostDrivers/Support/SUPDrvTracer.cpp      |     6 +
 src/VBox/HostDrivers/Support/SUPLib.cpp            |   923 +-
 src/VBox/HostDrivers/Support/SUPLibAll.cpp         |   273 +
 src/VBox/HostDrivers/Support/SUPLibInternal.h      |    13 +-
 src/VBox/HostDrivers/Support/SUPLibLdr.cpp         |   799 +
 .../HostDrivers/Support/SUPR3HardenedVerify.cpp    |     6 +-
 .../HostDrivers/Support/darwin/SUPDrv-darwin.cpp   |   239 +-
 .../HostDrivers/Support/darwin/SUPLib-darwin.cpp   |     2 +-
 src/VBox/HostDrivers/Support/freebsd/Makefile      |     9 +-
 .../HostDrivers/Support/freebsd/SUPDrv-freebsd.c   |    38 +
 src/VBox/HostDrivers/Support/freebsd/files_vboxdrv |    12 +-
 src/VBox/HostDrivers/Support/linux/Makefile        |    11 +-
 src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c  |   192 +-
 src/VBox/HostDrivers/Support/linux/files_vboxdrv   |    10 +-
 src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp    |    46 +-
 .../HostDrivers/Support/solaris/SUPDrv-solaris.c   |   119 +-
 src/VBox/HostDrivers/Support/solaris/load.sh       |    11 +-
 src/VBox/HostDrivers/Support/testcase/Makefile.kmk |     6 +-
 src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp |    67 +-
 .../Support/testcase/tstSupTscDelta.cpp            |   225 +
 src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp    |   240 +
 .../Support/win/SUPHardenedVerifyProcess-win.cpp   |     2 +-
 src/VBox/HostDrivers/Support/win/SUPLib-win.cpp    |     2 +-
 src/VBox/HostDrivers/Support/win/VBoxDrv.rc        |    21 +-
 src/VBox/HostDrivers/Support/win/VBoxSupLib.rc     |    21 +-
 src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk       |    11 +-
 src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c       |    32 +-
 .../VBoxNetAdp/solaris/VBoxNetAdp-solaris.c        |    19 +-
 src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk       |   211 +-
 src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c       |    26 +-
 src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.rc      |    30 +-
 .../HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h    |     7 +-
 .../VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp        |   271 +-
 .../VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c        |     2 +-
 .../VBoxNetFlt/linux/VBoxNetFlt-linux.c            |   197 +-
 .../VBoxNetFlt/solaris/VBoxNetFlt-solaris.c        |    22 +-
 .../VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c     |     2 +-
 .../HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp  |    78 +-
 .../VBoxNetFlt/win/drv/VBoxNetFlt-win.rc           |    17 +-
 .../VBoxNetFlt/win/drv/VBoxNetFltM-win.cpp         |    12 +-
 .../VBoxNetFlt/win/drv/VBoxNetFltP-win.cpp         |    20 +-
 .../VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp        |     6 +-
 .../VBoxNetFlt/win/drv/VBoxNetFltRt-win.h          |    34 +-
 .../VBoxNetFlt/win/ndis6/VBoxNetAdp-win.cpp        |   748 +
 .../VBoxNetFlt/win/ndis6/VBoxNetAdp-win.h          |    48 +
 .../VBoxNetFlt/win/ndis6/VBoxNetAdp-win.rc         |    53 +
 .../VBoxNetFlt/win/ndis6/VBoxNetAdp6.inf           |    90 +
 .../VBoxNetFlt/win/ndis6/VBoxNetCmn-win.h          |   127 +
 .../VBoxNetFlt/win/ndis6/VBoxNetLwf-win.cpp        |  2263 ++
 .../VBoxNetFlt/win/ndis6/VBoxNetLwf-win.h          |    32 +
 .../VBoxNetFlt/win/ndis6/VBoxNetLwf.inf            |    98 +
 .../VBoxNetFlt/win/nobj/VBoxNetFltNobj.rc          |    25 +-
 .../VBoxNetFlt/win/tools/VBoxNetAdpInstall.cpp     |    26 +-
 .../VBoxNetFlt/win/tools/VBoxNetAdpUninstall.cpp   |     9 +-
 .../VBoxNetFlt/win/tools/VBoxNetLwfInstall.cpp     |   157 +
 .../VBoxNetFlt/win/tools/VBoxNetLwfUninstall.cpp   |   100 +
 src/VBox/HostDrivers/VBoxPci/VBoxPci.c             |     4 +-
 src/VBox/HostDrivers/VBoxPci/VBoxPciInternal.h     |     2 +
 src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c |   169 +-
 src/VBox/HostDrivers/VBoxUSB/darwin/Makefile.kmk   |     9 +-
 .../HostDrivers/VBoxUSB/darwin/USBLib-darwin.cpp   |     2 +-
 src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp    |     6 +
 .../HostDrivers/VBoxUSB/darwin/VBoxUSBInterface.h  |     2 +
 .../HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c  |     7 +-
 .../VBoxUSB/solaris/VBoxUSBMon-solaris.c           |     3 +-
 src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.h  |     2 +-
 src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.rc |    21 +-
 src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbRt.cpp |     1 +
 .../HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp |    85 +-
 .../HostDrivers/VBoxUSB/win/mon/VBoxUSBMon.inf     |     9 +-
 .../HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp     |    52 +
 src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.rc |    21 +-
 .../HostDrivers/VBoxUSB/win/testcase/USBTest.cpp   |     2 +-
 src/VBox/HostDrivers/linux/load.sh                 |     2 +-
 src/VBox/HostDrivers/win/VBoxDbgLog.h              |     2 +-
 src/VBox/HostDrivers/win/cfg/VBoxDrvCfg.cpp        |    39 +-
 src/VBox/HostDrivers/win/load.sh                   |     4 +-
 src/VBox/HostDrivers/win/loadall.sh                |    24 +-
 src/VBox/HostServices/DragAndDrop/Makefile.kmk     |     3 +-
 .../HostServices/DragAndDrop/VBoxDragAndDropSvc.rc |    21 +-
 src/VBox/HostServices/DragAndDrop/dndmanager.cpp   |   800 +-
 src/VBox/HostServices/DragAndDrop/dndmanager.h     |   102 +-
 src/VBox/HostServices/DragAndDrop/service.cpp      |   832 +-
 .../GuestControl/VBoxGuestControlSvc.rc            |    21 +-
 src/VBox/HostServices/GuestControl/service.cpp     |    56 +-
 .../GuestProperties/VBoxGuestPropSvc.rc            |    21 +-
 .../HostServices/HostChannel/VBoxHostChannel.rc    |    21 +-
 .../SharedClipboard/VBoxSharedClipboard.rc         |    21 +-
 src/VBox/HostServices/SharedClipboard/service.cpp  |     2 +-
 .../SharedFolders/VBoxSharedFolders.rc             |    21 +-
 .../testcase/tstSharedFolderService.cpp            |     1 +
 src/VBox/HostServices/SharedOpenGL/Makefile.kmk    |   113 +-
 .../SharedOpenGL/OpenGLTest/OpenGLTest.cpp         |     4 +-
 .../SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp   |   160 +-
 .../SharedOpenGL/OpenGLTest/VBoxTestOGL.rc         |    21 +-
 .../SharedOpenGL/crserver/VBoxSharedCrOpenGL.rc    |    21 +-
 .../SharedOpenGL/crserver/crservice.cpp            |   239 +-
 .../crserverlib/presenter/display_base.cpp         |   390 +
 .../crserverlib/presenter/display_composite.cpp    |   341 +
 .../crserverlib/presenter/display_vrdp.cpp         |   381 +
 .../crserverlib/presenter/display_window.cpp       |   570 +
 .../presenter/display_window_rootvr.cpp            |   347 +
 .../crserverlib/presenter/server_presenter.cpp     |  4037 ++++
 .../crserverlib/presenter/server_presenter.h       |   440 +
 .../SharedOpenGL/crserverlib/presenter/window.cpp  |   463 +
 .../HostServices/SharedOpenGL/crserverlib/server.h |     3 +-
 .../SharedOpenGL/crserverlib/server_config.c       |    42 +-
 .../SharedOpenGL/crserverlib/server_glsl.c         |    67 +
 .../SharedOpenGL/crserverlib/server_lists.c        |   158 +-
 .../SharedOpenGL/crserverlib/server_main.c         |   304 +-
 .../SharedOpenGL/crserverlib/server_misc.c         |     2 +-
 .../SharedOpenGL/crserverlib/server_presenter.cpp  |  6435 ------
 .../SharedOpenGL/crserverlib/server_special        |     1 +
 .../SharedOpenGL/crserverlib/server_texture.c      |    96 +
 .../SharedOpenGL/dlm}/Makefile.kup                 |     0
 src/VBox/HostServices/SharedOpenGL/dlm/dlm.c       |   739 +
 src/VBox/HostServices/SharedOpenGL/dlm/dlm.h       |    31 +
 .../HostServices/SharedOpenGL/dlm/dlm_arrays.c     |   387 +
 src/VBox/HostServices/SharedOpenGL/dlm/dlm_bbox.c  |   454 +
 .../HostServices/SharedOpenGL/dlm/dlm_calllist.c   |    63 +
 .../HostServices/SharedOpenGL/dlm/dlm_checklist.c  |    51 +
 src/VBox/HostServices/SharedOpenGL/dlm/dlm_error.c |    56 +
 .../HostServices/SharedOpenGL/dlm/dlm_generated.py |   418 +
 .../HostServices/SharedOpenGL/dlm/dlm_header.py    |   265 +
 src/VBox/HostServices/SharedOpenGL/dlm/dlm_lists.c |   275 +
 .../HostServices/SharedOpenGL/dlm/dlm_pointers.c   |  1125 +
 .../HostServices/SharedOpenGL/dlm/dlm_pointers.h   |    81 +
 src/VBox/HostServices/SharedOpenGL/dlm/dlm_special |    21 +
 .../SharedOpenGL/expando}/Makefile.kup             |     0
 .../HostServices/SharedOpenGL/expando/expando.py   |    91 +
 .../SharedOpenGL/expando/expando_special           |    17 +
 .../HostServices/SharedOpenGL/expando/expandospu.c |   158 +
 .../SharedOpenGL/expando/expandospu.def            |     6 +
 .../HostServices/SharedOpenGL/expando/expandospu.h |    68 +
 .../SharedOpenGL/expando/expandospu_config.c       |    48 +
 .../SharedOpenGL/expando/expandospu_init.c         |    87 +
 .../SharedOpenGL/render/VBoxOGLrenderspu.rc        |    21 +-
 .../HostServices/SharedOpenGL/render/renderspu.c   |     5 +
 .../HostServices/SharedOpenGL/render/renderspu.h   |     4 +
 .../SharedOpenGL/render/renderspu_cocoa.c          |    19 +-
 .../SharedOpenGL/render/renderspu_cocoa_helper.h   |    17 +-
 .../SharedOpenGL/render/renderspu_cocoa_helper.m   |   584 +-
 .../SharedOpenGL/render/renderspu_glx.c            |    49 -
 .../SharedOpenGL/render/renderspu_init.c           |     2 +
 .../SharedOpenGL/render/renderspu_wgl.c            |     2 +-
 .../HostServices/auth/simple/VBoxAuthSimple.rc     |    21 +-
 src/VBox/HostServices/auth/winlogon/VBoxAuth.rc    |    21 +-
 src/VBox/Installer/Config.kmk                      |   101 +
 src/VBox/Installer/Makefile.kmk                    |     9 +-
 src/VBox/Installer/common/vboxapisetup.py          |    46 +-
 src/VBox/Installer/common/virtualbox.desktop.in    |     3 +
 src/VBox/Installer/darwin/Makefile.kmk             |   344 +-
 .../darwin/VBoxKEXTs/VirtualBoxStartup.sh          |    26 +-
 src/VBox/Installer/darwin/VirtualBox/postflight    |    28 +-
 src/VBox/Installer/freebsd/Makefile.kmk            |    33 +-
 src/VBox/Installer/freebsd/pkg_plist               |     1 +
 src/VBox/Installer/linux/Makefile.kmk              |    70 +-
 src/VBox/Installer/linux/VBox.sh                   |     9 +-
 src/VBox/Installer/linux/deffiles                  |    20 +-
 src/VBox/Installer/linux/distributions_deb         |     4 +-
 src/VBox/Installer/linux/install.sh                |     9 +
 .../install_service/generate_service_file.cpp      |    10 +-
 .../linux/install_service/init_template.sh         |     2 +-
 .../linux/install_service/install_service.sh       |     2 +-
 src/VBox/Installer/linux/rpm/LocalConfig.kmk       |     4 +-
 src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec  |     5 +-
 src/VBox/Installer/linux/rpm/rules                 |     2 +-
 src/VBox/Installer/linux/scripts/install.sh        |     9 +
 .../Installer/linux/testcase/tstInstallInit.sh     |     2 +-
 src/VBox/Installer/linux/uninstall.sh              |     3 +
 src/VBox/Installer/solaris/Makefile.kmk            |  1036 +-
 src/VBox/Installer/solaris/VBox.sh                 |    13 +-
 src/VBox/Installer/solaris/makepackage.sh          |    43 +-
 src/VBox/Installer/solaris/smf-vboxballoonctrl.sh  |     8 +-
 src/VBox/Installer/solaris/smf-vboxwebsrv.sh       |     8 +-
 src/VBox/Installer/solaris/vboxconfig.sh           |    40 +-
 .../win/InstallHelper/VBoxInstallHelper.cpp        |   190 +-
 .../win/InstallHelper/VBoxInstallHelper.def        |     7 +-
 .../win/InstallHelper/VBoxInstallHelper.rc         |    21 +-
 src/VBox/Installer/win/Makefile.kmk                |   244 +-
 src/VBox/Installer/win/NLS/de_DE.wxl               |    18 +-
 src/VBox/Installer/win/NLS/en_US.wxl               |    12 +
 src/VBox/Installer/win/NLS/fa_IR.wxl               |    13 +-
 src/VBox/Installer/win/NLS/fr_FR.wxl               |    17 +-
 src/VBox/Installer/win/NLS/it_IT.wxl               |    13 +-
 src/VBox/Installer/win/NLS/tr_TR.wxl               |    20 +-
 src/VBox/Installer/win/NLS/zh_TW.wxl               |    14 +-
 src/VBox/Installer/win/Properties.wxi              |     4 +-
 src/VBox/Installer/win/Resources/VBoxRes.rc        |    25 +-
 src/VBox/Installer/win/Stub/VBoxStub.cpp           |     6 +-
 src/VBox/Installer/win/Stub/VBoxStub.rc            |    25 +-
 src/VBox/Installer/win/UserInterface.wxi           |    76 +-
 src/VBox/Installer/win/VBoxMergeApp.wxi            |    16 +-
 src/VBox/Installer/win/VBoxMergeNetAdp.wxi         |     1 +
 src/VBox/Installer/win/VBoxMergeNetAdp6.wxi        |    30 +
 src/VBox/Installer/win/VBoxMergeNetAdp6.wxs        |    54 +
 src/VBox/Installer/win/VBoxMergeNetAdp6CA.wxi      |    31 +
 src/VBox/Installer/win/VBoxMergeNetAdp6Seq.wxi     |    53 +
 src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi       |     5 +-
 src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi      |    18 +-
 src/VBox/Installer/win/VBoxMergeNetFlt.wxi         |     2 +
 src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi      |    25 +-
 src/VBox/Installer/win/VBoxMergeNetLwf.wxi         |    33 +
 src/VBox/Installer/win/VBoxMergeNetLwf.wxs         |    54 +
 src/VBox/Installer/win/VBoxMergeNetLwfCA.wxi       |    33 +
 src/VBox/Installer/win/VBoxMergeNetLwfSeq.wxi      |    79 +
 src/VBox/Installer/win/VBoxMergeUSB.wxi            |    12 +-
 src/VBox/Installer/win/VirtualBox.wxs              |    66 +-
 src/VBox/Installer/win/dep.sed                     |    29 -
 src/VBox/Installer/win/dep.xsl                     |    68 +
 src/VBox/Installer/win/dep2.xsl                    |    82 +
 src/VBox/Main/Config.kmk                           |    41 +
 src/VBox/Main/Makefile.kmk                         |   291 +-
 src/VBox/Main/cbinding/LegacyVBoxXPCOMCGlue.c      |   330 -
 src/VBox/Main/cbinding/LegacyVBoxXPCOMCGlue.h      |    64 -
 src/VBox/Main/cbinding/Makefile.kmk                |    27 +-
 src/VBox/Main/cbinding/VBoxCAPI.rc                 |    21 +-
 src/VBox/Main/cbinding/VBoxCAPIGlue.c              |     2 +-
 src/VBox/Main/cbinding/VBoxCAPIGlue.h.in           |     2 +-
 src/VBox/Main/cbinding/VBoxCAPI_v4_2.h             |   153 +-
 src/VBox/Main/cbinding/VBoxCAPI_v4_3.h             | 21826 +++++++++++++++++++
 src/VBox/Main/cbinding/capiidl.xsl                 |    95 +-
 src/VBox/Main/cbinding/makefile.tstCAPIGlue        |     2 +-
 src/VBox/Main/cbinding/tstCAPIGlue.c               |     2 +-
 src/VBox/Main/glue/com.cpp                         |    10 +-
 src/VBox/Main/glue/constants-python.xsl            |    20 +-
 src/VBox/Main/glue/glue-java.xsl                   |   275 +-
 src/VBox/Main/glue/initterm.cpp                    |     3 +-
 src/VBox/Main/glue/string.cpp                      |    29 +-
 src/VBox/Main/glue/tests/TestVBox.java             |     4 +-
 src/VBox/Main/glue/vboxapi.py                      |   697 +-
 src/VBox/Main/glue/xpcom/helpers.cpp               |     1 +
 src/VBox/Main/idl/VirtualBox.dtd                   |    10 +
 src/VBox/Main/idl/VirtualBox.xidl                  |  4846 ++--
 src/VBox/Main/idl/apiwrap-server-filelist.xsl      |   138 +
 src/VBox/Main/idl/apiwrap-server.xsl               |  1910 +-
 src/VBox/Main/idl/comimpl.xsl                      |    98 +-
 src/VBox/Main/idl/doxygen.xsl                      |    76 +-
 src/VBox/Main/idl/midl.xsl                         |    96 +-
 src/VBox/Main/idl/typemap-shared.inc.xsl           |   226 +-
 src/VBox/Main/idl/xpidl.xsl                        |    60 +-
 src/VBox/Main/include/AdditionsFacilityImpl.h      |    45 +-
 src/VBox/Main/include/ApplianceImpl.h              |   427 +-
 src/VBox/Main/include/ApplianceImplPrivate.h       |    44 +-
 src/VBox/Main/include/AudioAdapterImpl.h           |    60 +-
 src/VBox/Main/include/AudioSnifferInterface.h      |     1 +
 src/VBox/Main/include/AutoCaller.h                 |   204 +-
 src/VBox/Main/include/AutoStateDep.h               |    60 +-
 src/VBox/Main/include/AutostartDb.h                |     1 +
 src/VBox/Main/include/BIOSSettingsImpl.h           |    77 +-
 src/VBox/Main/include/BandwidthControlImpl.h       |    80 +-
 src/VBox/Main/include/BandwidthGroupImpl.h         |    96 +-
 src/VBox/Main/include/BusAssignmentManager.h       |    11 +-
 src/VBox/Main/include/ConsoleImpl.h                |   870 +-
 src/VBox/Main/include/ConsoleVRDPServer.h          |    65 +-
 src/VBox/Main/include/DHCPServerImpl.h             |    92 +-
 src/VBox/Main/include/DisplayImpl.h                |   537 +-
 src/VBox/Main/include/DisplayUtils.h               |     1 +
 src/VBox/Main/include/DrvAudioVRDE.h               |    64 +
 src/VBox/Main/include/DrvAudioVideoRec.h           |    62 +
 src/VBox/Main/include/EmulatedUSBImpl.h            |    16 +-
 src/VBox/Main/include/EventImpl.h                  |   151 +-
 src/VBox/Main/include/ExtPackManagerImpl.h         |   247 +-
 src/VBox/Main/include/FramebufferImpl.h            |    76 -
 src/VBox/Main/include/Global.h                     |    44 +-
 src/VBox/Main/include/GuestCtrlImplPrivate.h       |   574 +-
 src/VBox/Main/include/GuestDirectoryImpl.h         |    47 +-
 src/VBox/Main/include/GuestDnDImpl.h               |    53 -
 src/VBox/Main/include/GuestDnDPrivate.h            |   549 +
 src/VBox/Main/include/GuestDnDSourceImpl.h         |   103 +
 src/VBox/Main/include/GuestDnDTargetImpl.h         |    95 +
 src/VBox/Main/include/GuestFileImpl.h              |   124 +-
 src/VBox/Main/include/GuestFsObjInfoImpl.h         |    69 +-
 src/VBox/Main/include/GuestImpl.h                  |   220 +-
 src/VBox/Main/include/GuestOSTypeImpl.h            |    94 +-
 src/VBox/Main/include/GuestProcessImpl.h           |   180 +-
 src/VBox/Main/include/GuestSessionImpl.h           |   368 +-
 src/VBox/Main/include/HGCM.h                       |     1 +
 src/VBox/Main/include/HGCMObjects.h                |     1 +
 src/VBox/Main/include/HGCMThread.h                 |     1 +
 src/VBox/Main/include/HostImpl.h                   |   174 +-
 src/VBox/Main/include/HostNetworkInterfaceImpl.h   |    77 +-
 src/VBox/Main/include/HostPower.h                  |    28 +
 src/VBox/Main/include/HostUSBDeviceImpl.h          |   125 +-
 src/VBox/Main/include/KeyboardImpl.h               |    54 +-
 src/VBox/Main/include/MachineDebuggerImpl.h        |   170 +-
 src/VBox/Main/include/MachineImpl.h                |  1396 +-
 src/VBox/Main/include/MachineImplCloneVM.h         |     1 +
 src/VBox/Main/include/Matching.h                   |     1 +
 src/VBox/Main/include/MediumAttachmentImpl.h       |   108 +-
 src/VBox/Main/include/MediumImpl.h                 |   511 +-
 src/VBox/Main/include/MouseImpl.h                  |   136 +-
 src/VBox/Main/include/NATEngineImpl.h              |   141 +-
 src/VBox/Main/include/NATNetworkImpl.h             |   123 +-
 src/VBox/Main/include/NetworkAdapterImpl.h         |   193 +-
 src/VBox/Main/include/ObjectState.h                |   129 +
 src/VBox/Main/include/PCIDeviceAttachmentImpl.h    |    36 +-
 src/VBox/Main/include/ParallelPortImpl.h           |    60 +-
 src/VBox/Main/include/Performance.h                |     4 +-
 src/VBox/Main/include/ProgressImpl.h               |   241 +-
 src/VBox/Main/include/QMTranslator.h               |    57 +
 src/VBox/Main/include/RemoteUSBBackend.h           |     1 +
 src/VBox/Main/include/RemoteUSBDeviceImpl.h        |     4 +-
 src/VBox/Main/include/SecretKeyStore.h             |   190 +
 src/VBox/Main/include/SerialPortImpl.h             |    86 +-
 src/VBox/Main/include/SessionImpl.h                |   159 +-
 src/VBox/Main/include/SharedFolderImpl.h           |    60 +-
 src/VBox/Main/include/SnapshotImpl.h               |   119 +-
 src/VBox/Main/include/StorageControllerImpl.h      |    90 +-
 src/VBox/Main/include/SystemPropertiesImpl.h       |   189 +-
 src/VBox/Main/include/USBControllerImpl.h          |    42 +-
 src/VBox/Main/include/USBDeviceFilterImpl.h        |   181 +-
 src/VBox/Main/include/USBDeviceFiltersImpl.h       |    57 +-
 src/VBox/Main/include/USBDeviceImpl.h              |    58 +-
 src/VBox/Main/include/USBProxyService.h            |     4 +-
 src/VBox/Main/include/VFSExplorerImpl.h            |    73 +-
 src/VBox/Main/include/VMMDev.h                     |     1 +
 src/VBox/Main/include/VRDEServerImpl.h             |    95 +-
 src/VBox/Main/include/VirtualBoxBase.h             |   134 +-
 src/VBox/Main/include/VirtualBoxClientImpl.h       |    31 +-
 src/VBox/Main/include/VirtualBoxErrorInfoImpl.h    |    28 +-
 src/VBox/Main/include/VirtualBoxImpl.h             |   475 +-
 src/VBox/Main/include/Wrapper.h                    |     4 +-
 src/VBox/Main/include/netif.h                      |     1 +
 src/VBox/Main/include/objectslist.h                |     1 +
 src/VBox/Main/include/vbox-libhal.h                |     1 +
 src/VBox/Main/include/vector.h                     |     1 +
 src/VBox/Main/include/win/resource.h               |     1 +
 src/VBox/Main/src-all/AutoCaller.cpp               |   514 +
 src/VBox/Main/src-all/DisplayResampleImage.cpp     |     1 +
 src/VBox/Main/src-all/DisplayUtils.cpp             |     3 +-
 src/VBox/Main/src-all/EventImpl.cpp                |   366 +-
 src/VBox/Main/src-all/ExtPackManagerImpl.cpp       |  1134 +-
 src/VBox/Main/src-all/ExtPackUtil.cpp              |    15 +-
 src/VBox/Main/src-all/Global.cpp                   |    13 +-
 src/VBox/Main/src-all/Logging.cpp                  |     1 +
 src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp  |    28 +-
 src/VBox/Main/src-all/ProgressImpl.cpp             |  1362 +-
 src/VBox/Main/src-all/QMTranslatorImpl.cpp         |   433 +
 src/VBox/Main/src-all/SecretKeyStore.cpp           |   228 +
 src/VBox/Main/src-all/SharedFolderImpl.cpp         |    90 +-
 src/VBox/Main/src-all/VBoxAPI-end.d                |     9 +
 src/VBox/Main/src-all/VBoxAPI-start.d              |    23 +
 src/VBox/Main/src-all/VirtualBoxBase.cpp           |   647 +-
 src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp  |     1 +
 src/VBox/Main/src-all/win/VBoxProxyStub.def        |    25 +
 src/VBox/Main/src-all/win/comregister.cmd          |   100 +-
 src/VBox/Main/src-client/AdditionsFacilityImpl.cpp |    66 +-
 src/VBox/Main/src-client/AudioSnifferInterface.cpp |    14 +-
 src/VBox/Main/src-client/BusAssignmentManager.cpp  |    23 +-
 src/VBox/Main/src-client/ClientTokenHolder.cpp     |     1 +
 src/VBox/Main/src-client/ConsoleImpl.cpp           |  3802 ++--
 src/VBox/Main/src-client/ConsoleImpl2.cpp          |  1586 +-
 src/VBox/Main/src-client/ConsoleImplTeleporter.cpp |   105 +-
 src/VBox/Main/src-client/ConsoleVRDPServer.cpp     |   735 +-
 src/VBox/Main/src-client/DisplayImpl.cpp           |  3766 ++--
 src/VBox/Main/src-client/DisplayImplLegacy.cpp     |  1008 +
 .../Main/src-client/DisplaySourceBitmapImpl.cpp    |   185 +
 src/VBox/Main/src-client/DrvAudioVRDE.cpp          |   616 +
 src/VBox/Main/src-client/DrvAudioVideoRec.cpp      |   911 +
 src/VBox/Main/src-client/EbmlWriter.cpp            |  1039 +-
 src/VBox/Main/src-client/EbmlWriter.h              |   305 +-
 src/VBox/Main/src-client/EmulatedUSBImpl.cpp       |    22 +-
 src/VBox/Main/src-client/GuestCtrlImpl.cpp         |   316 +-
 src/VBox/Main/src-client/GuestCtrlPrivate.cpp      |   269 +-
 src/VBox/Main/src-client/GuestDirectoryImpl.cpp    |    74 +-
 src/VBox/Main/src-client/GuestDnDImpl.cpp          |   995 -
 src/VBox/Main/src-client/GuestDnDPrivate.cpp       |   929 +
 src/VBox/Main/src-client/GuestDnDSourceImpl.cpp    |  1156 +
 src/VBox/Main/src-client/GuestDnDTargetImpl.cpp    |  1199 +
 src/VBox/Main/src-client/GuestFileImpl.cpp         |   400 +-
 src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp    |   242 +-
 src/VBox/Main/src-client/GuestImpl.cpp             |   673 +-
 src/VBox/Main/src-client/GuestProcessImpl.cpp      |   636 +-
 src/VBox/Main/src-client/GuestSessionImpl.cpp      |  1925 +-
 src/VBox/Main/src-client/GuestSessionImplTasks.cpp |   170 +-
 src/VBox/Main/src-client/HGCM.cpp                  |   672 +-
 src/VBox/Main/src-client/HGCMThread.cpp            |     6 +-
 src/VBox/Main/src-client/KeyboardImpl.cpp          |   143 +-
 src/VBox/Main/src-client/MachineDebuggerImpl.cpp   |   952 +-
 src/VBox/Main/src-client/MouseImpl.cpp             |   454 +-
 src/VBox/Main/src-client/Nvram.cpp                 |     6 +-
 src/VBox/Main/src-client/PCIRawDevImpl.cpp         |     5 +-
 src/VBox/Main/src-client/RemoteUSBBackend.cpp      |   249 +-
 src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp   |    25 +-
 src/VBox/Main/src-client/SessionImpl.cpp           |   492 +-
 src/VBox/Main/src-client/USBDeviceImpl.cpp         |   116 +-
 src/VBox/Main/src-client/UsbCardReader.cpp         |     6 +-
 src/VBox/Main/src-client/UsbWebcamInterface.cpp    |     6 +-
 src/VBox/Main/src-client/VBoxDriversRegister.cpp   |     9 +
 src/VBox/Main/src-client/VMMDevInterface.cpp       |   229 +-
 src/VBox/Main/src-client/VideoRec.cpp              |   123 +-
 src/VBox/Main/src-client/VideoRec.h                |     4 +-
 src/VBox/Main/src-client/VirtualBoxClientImpl.cpp  |    52 +-
 src/VBox/Main/src-client/win/VBoxC.rc              |    27 +-
 src/VBox/Main/src-client/win/VBoxClient-x86.rc     |    27 +-
 src/VBox/Main/src-client/xpcom/module.cpp          |   103 +-
 .../Main/src-helper-apps/VBoxExtPackHelperApp.cpp  |     2 +-
 .../Main/src-helper-apps/VBoxExtPackHelperApp.rc   |    21 +-
 src/VBox/Main/src-server/ApplianceImpl.cpp         |   700 +-
 src/VBox/Main/src-server/ApplianceImplExport.cpp   |   546 +-
 src/VBox/Main/src-server/ApplianceImplIO.cpp       |   608 +-
 src/VBox/Main/src-server/ApplianceImplImport.cpp   |  1410 +-
 src/VBox/Main/src-server/AudioAdapterImpl.cpp      |   169 +-
 src/VBox/Main/src-server/BIOSSettingsImpl.cpp      |   191 +-
 src/VBox/Main/src-server/BandwidthControlImpl.cpp  |   233 +-
 src/VBox/Main/src-server/BandwidthGroupImpl.cpp    |   129 +-
 src/VBox/Main/src-server/ClientToken.cpp           |     1 +
 src/VBox/Main/src-server/ClientWatcher.cpp         |    47 +-
 src/VBox/Main/src-server/DHCPServerImpl.cpp        |   236 +-
 src/VBox/Main/src-server/GuestOSTypeImpl.cpp       |   231 +-
 src/VBox/Main/src-server/HostDnsService.cpp        |    30 +-
 src/VBox/Main/src-server/HostDnsService.h          |     6 +-
 src/VBox/Main/src-server/HostImpl.cpp              |   933 +-
 .../Main/src-server/HostNetworkInterfaceImpl.cpp   |   269 +-
 src/VBox/Main/src-server/HostPower.cpp             |    34 +-
 src/VBox/Main/src-server/HostUSBDeviceImpl.cpp     |   517 +-
 .../Main/src-server/HostVideoInputDeviceImpl.cpp   |    12 +-
 src/VBox/Main/src-server/MachineImpl.cpp           |  7253 +++---
 src/VBox/Main/src-server/MachineImplCloneVM.cpp    |   201 +-
 src/VBox/Main/src-server/Matching.cpp              |     1 +
 src/VBox/Main/src-server/MediumAttachmentImpl.cpp  |   175 +-
 src/VBox/Main/src-server/MediumImpl.cpp            |  3175 ++-
 src/VBox/Main/src-server/MediumLock.cpp            |    13 +-
 src/VBox/Main/src-server/NATEngineImpl.cpp         |   474 +-
 src/VBox/Main/src-server/NATNetworkImpl.cpp        |   478 +-
 src/VBox/Main/src-server/NetworkAdapterImpl.cpp    |   551 +-
 src/VBox/Main/src-server/ParallelPortImpl.cpp      |   107 +-
 src/VBox/Main/src-server/Performance.cpp           |    24 +-
 src/VBox/Main/src-server/PerformanceImpl.cpp       |    28 +-
 src/VBox/Main/src-server/ProgressProxyImpl.cpp     |    31 +-
 src/VBox/Main/src-server/SerialPortImpl.cpp        |   178 +-
 src/VBox/Main/src-server/SnapshotImpl.cpp          |  1831 +-
 src/VBox/Main/src-server/StorageControllerImpl.cpp |   152 +-
 src/VBox/Main/src-server/SystemPropertiesImpl.cpp  |   662 +-
 src/VBox/Main/src-server/TokenImpl.cpp             |     4 +-
 src/VBox/Main/src-server/USBControllerImpl.cpp     |    45 +-
 src/VBox/Main/src-server/USBDeviceFilterImpl.cpp   |   460 +-
 src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp  |   206 +-
 src/VBox/Main/src-server/USBProxyService.cpp       |   123 +-
 src/VBox/Main/src-server/VFSExplorerImpl.cpp       |   211 +-
 src/VBox/Main/src-server/VRDEServerImpl.cpp        |   393 +-
 src/VBox/Main/src-server/VirtualBoxImpl.cpp        |  1692 +-
 .../Main/src-server/darwin/HostPowerDarwin.cpp     |     1 +
 src/VBox/Main/src-server/darwin/NetIf-darwin.cpp   |     2 +
 .../src-server/darwin/USBProxyServiceDarwin.cpp    |    12 +-
 src/VBox/Main/src-server/darwin/iokit.cpp          |     5 +-
 .../src-server/freebsd/HostHardwareFreeBSD.cpp     |     4 +-
 .../src-server/freebsd/USBProxyServiceFreeBSD.cpp  |    14 +-
 src/VBox/Main/src-server/generic/NetIf-generic.cpp |    75 +-
 .../Main/src-server/linux/HostHardwareLinux.cpp    |   177 +-
 src/VBox/Main/src-server/linux/HostPowerLinux.cpp  |   144 +
 .../Main/src-server/linux/PerformanceLinux.cpp     |     2 +-
 src/VBox/Main/src-server/linux/USBGetDevices.cpp   |    23 +-
 .../Main/src-server/linux/USBProxyServiceLinux.cpp |    14 +-
 src/VBox/Main/src-server/linux/vbox-libhal.cpp     |     1 +
 .../Main/src-server/os2/USBProxyServiceOs2.cpp     |     3 +-
 src/VBox/Main/src-server/solaris/NetIf-solaris.cpp |     3 +-
 .../src-server/solaris/USBProxyServiceSolaris.cpp  |    21 +-
 src/VBox/Main/src-server/win/HostPowerWin.cpp      |    13 +-
 src/VBox/Main/src-server/win/NetIf-win.cpp         |   100 +-
 src/VBox/Main/src-server/win/PerformanceWin.cpp    |     5 +-
 .../Main/src-server/win/USBProxyServiceWindows.cpp |    34 +-
 src/VBox/Main/src-server/win/VBoxComEvents.cpp     |     1 +
 src/VBox/Main/src-server/win/VBoxComEvents.h       |     1 +
 src/VBox/Main/src-server/win/VBoxSVC.rc            |    27 +-
 src/VBox/Main/src-server/win/svchlp.cpp            |     1 +
 src/VBox/Main/src-server/win/svchlp.h              |     1 +
 src/VBox/Main/src-server/win/svcmain.cpp           |    73 +-
 src/VBox/Main/src-server/xpcom/server.cpp          |   161 +-
 src/VBox/Main/src-server/xpcom/server.h            |     1 +
 src/VBox/Main/src-server/xpcom/server_module.cpp   |     9 +-
 src/VBox/Main/testcase/Makefile.kmk                |   109 +-
 src/VBox/Main/testcase/makefile.tstVBoxAPIXPCOM    |     6 +-
 .../ovf-winxp-vbox-sharedfolders/winxp.ovf         |     2 +-
 src/VBox/Main/testcase/tstAPI.cpp                  |     1 +
 src/VBox/Main/testcase/tstCollector.cpp            |     2 +-
 src/VBox/Main/testcase/tstGuid.cpp                 |    99 +
 src/VBox/Main/testcase/tstMediumLock.cpp           |     4 +-
 src/VBox/Main/testcase/tstOVF.cpp                  |    20 +-
 src/VBox/Main/testcase/tstUSBProxyLinux.cpp        |     2 +-
 src/VBox/Main/testcase/tstVBoxAPI.cpp              |   400 +
 src/VBox/Main/testcase/tstVBoxAPIPerf.cpp          |   243 +
 src/VBox/Main/testcase/tstVBoxAPIWin.cpp           |    18 +-
 src/VBox/Main/testcase/tstVBoxAPIXPCOM.cpp         |   187 +-
 src/VBox/Main/webservice/Makefile.kmk              |    29 +-
 src/VBox/Main/webservice/VBoxWebSrv.rc             |    21 +-
 .../Main/webservice/samples/php/clienttest.php     |     6 +-
 .../Main/webservice/samples/python/clienttest.py   |     4 +-
 src/VBox/Main/webservice/vboxweb.cpp               |   473 +-
 src/VBox/Main/webservice/vboxweb.h                 |   107 +-
 src/VBox/Main/webservice/websrv-cpp.xsl            |    41 +-
 src/VBox/Main/webservice/websrv-php.xsl            |     8 +-
 src/VBox/Main/webservice/websrv-python.xsl         |     9 +-
 src/VBox/Main/webservice/websrv-typemap.xsl        |    12 +-
 src/VBox/Main/webservice/websrv-wsdl.xsl           |    21 +-
 src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl    |    98 +-
 src/VBox/Main/xml/Settings.cpp                     |   447 +-
 src/VBox/Main/xml/VirtualBox-settings.xsd          |     3 +-
 src/VBox/Makefile.kmk                              |    17 +-
 src/VBox/NetworkServices/DHCP/Config.cpp           |    16 +-
 src/VBox/NetworkServices/DHCP/Config.h             |    16 +-
 src/VBox/NetworkServices/DHCP/README.customoptions |    23 +
 src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp      |    41 +-
 src/VBox/NetworkServices/DHCP/VBoxNetDHCP.rc       |    17 +-
 src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp    |    59 +-
 src/VBox/NetworkServices/NAT/VBoxNetNAT.rc         |    21 +-
 src/VBox/NetworkServices/NAT/lwipopts.h            |     8 +-
 src/VBox/NetworkServices/NAT/portfwd.c             |     4 +-
 src/VBox/NetworkServices/NAT/proxy.c               |    47 +-
 src/VBox/NetworkServices/NAT/pxdns.c               |     2 +-
 src/VBox/NetworkServices/NAT/pxping.c              |     2 +-
 src/VBox/NetworkServices/NAT/pxping_win.c          |    23 +-
 src/VBox/NetworkServices/NAT/pxtcp.c               |    64 +-
 src/VBox/NetworkServices/NAT/winutils.h            |    12 +-
 src/VBox/NetworkServices/NetLib/ComHostUtils.cpp   |    56 +
 .../NetworkServices/NetLib/VBoxNetBaseService.cpp  |    99 +-
 .../NetworkServices/NetLib/VBoxNetBaseService.h    |     1 +
 .../NetLib/VBoxNetPortForwardString.cpp            |     3 +-
 src/VBox/NetworkServices/NetLib/utils.h            |     6 +
 src/VBox/RDP/client-1.8.3/vrdp/rdpusb.c            |     1 +
 src/VBox/Resources/OSE/virtualbox-128px.png        |   Bin 14278 -> 4861 bytes
 src/VBox/Resources/OSE/virtualbox-16px.png         |   Bin 788 -> 625 bytes
 src/VBox/Resources/OSE/virtualbox-20px.png         |   Bin 1035 -> 730 bytes
 src/VBox/Resources/OSE/virtualbox-32px.png         |   Bin 1821 -> 1136 bytes
 src/VBox/Resources/OSE/virtualbox-40px.png         |   Bin 2354 -> 1492 bytes
 src/VBox/Resources/OSE/virtualbox-48px.png         |   Bin 3002 -> 1733 bytes
 src/VBox/Resources/OSE/virtualbox-64px.png         |   Bin 6895 -> 2365 bytes
 src/VBox/Resources/win/TemplateDll.rc              |   114 +
 src/VBox/Resources/win/TemplateDrv.rc              |   117 +
 src/VBox/Resources/win/TemplateExe.rc              |   114 +
 src/VBox/Resources/win/TemplateR0.rc               |   115 +
 src/VBox/Resources/win/TemplateRC.rc               |   115 +
 src/VBox/Resources/win/TemplateRsrcDefs.h          |    45 +
 src/VBox/Runtime/Makefile.kmk                      |   104 +-
 src/VBox/Runtime/VBox/VBoxRTDeps.cpp               |     7 +-
 src/VBox/Runtime/VBox/VBoxRTImp.def                |    42 +-
 src/VBox/Runtime/VBox/dbus.cpp                     |     1 +
 src/VBox/Runtime/VBox/log-vbox.cpp                 |     4 +-
 src/VBox/Runtime/common/alloc/memcache.cpp         |   150 +-
 src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm  |     2 -
 src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm  |     1 -
 src/VBox/Runtime/common/asm/ASMAtomicUoDecU32.asm  |    56 +
 src/VBox/Runtime/common/asm/ASMAtomicUoIncU32.asm  |    56 +
 src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm   |     1 -
 src/VBox/Runtime/common/asm/ASMGetIdtrLimit.asm    |    48 +
 src/VBox/Runtime/common/asm/ASMGetXcr0.asm         |    49 +
 .../Runtime/common/asm/ASMMultU32ByU32DivByU32.asm |    64 +
 src/VBox/Runtime/common/asm/ASMSetGDTR.asm         |    52 +
 src/VBox/Runtime/common/asm/ASMSetIDTR.asm         |    52 +
 src/VBox/Runtime/common/asm/ASMSetXcr0.asm         |    60 +
 src/VBox/Runtime/common/asm/ASMXRstor.asm          |    63 +
 src/VBox/Runtime/common/asm/ASMXSave.asm           |    63 +
 .../Runtime/common/asn1/asn1-ut-time-template.h    |     1 -
 .../Runtime/common/checksum/RTSha256Digest.cpp     |     1 +
 src/VBox/Runtime/common/checksum/alt-sha1.cpp      |     1 -
 src/VBox/Runtime/common/checksum/crc32c.cpp        |   122 +
 src/VBox/Runtime/common/checksum/manifest3.cpp     |     2 +-
 .../Runtime/common/checksum/openssl-sha512.cpp     |     1 -
 src/VBox/Runtime/common/checksum/x509.cpp          |   400 +
 src/VBox/Runtime/common/crypto/pkcs7-init.cpp      |     1 -
 .../common/crypto/pkix-signature-builtin.cpp       |     1 -
 src/VBox/Runtime/common/crypto/rsa-internal.h      |     1 -
 src/VBox/Runtime/common/crypto/rsa-template.h      |     1 -
 src/VBox/Runtime/common/crypto/spc-init.cpp        |     1 -
 src/VBox/Runtime/common/crypto/spc-sanity.cpp      |     1 -
 src/VBox/Runtime/common/crypto/tsp-core.cpp        |     1 -
 src/VBox/Runtime/common/crypto/tsp-sanity.cpp      |     1 -
 src/VBox/Runtime/common/crypto/x509-core.cpp       |     1 -
 src/VBox/Runtime/common/dbg/dbgcfg.cpp             |   530 +-
 src/VBox/Runtime/common/dbg/dbgmod.cpp             |   115 +-
 src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp     |     2 +-
 src/VBox/Runtime/common/dbg/dbgmoddbghelp.cpp      |    10 +-
 src/VBox/Runtime/common/dbg/dbgmoddwarf.cpp        |   126 +-
 src/VBox/Runtime/common/dbg/dbgmodexports.cpp      |     7 +-
 src/VBox/Runtime/common/ldr/Makefile.kup           |     1 -
 src/VBox/Runtime/common/ldr/ldrMemory.cpp          |     4 +-
 src/VBox/Runtime/common/ldr/ldrNative.cpp          |    26 +-
 src/VBox/Runtime/common/ldr/ldrPE.cpp              |     3 +-
 src/VBox/Runtime/common/ldr/ldrkStuff.cpp          |     5 -
 src/VBox/Runtime/common/log/log.cpp                |   672 +-
 src/VBox/Runtime/common/log/tracebuf.cpp           |    26 +
 src/VBox/Runtime/common/log/tracedefault.cpp       |    26 +
 src/VBox/Runtime/common/math/ldexpl.asm            |     2 +-
 src/VBox/Runtime/common/misc/lockvalidator.cpp     |     6 +
 src/VBox/Runtime/common/misc/thread.cpp            |    51 +-
 src/VBox/Runtime/common/misc/uri.cpp               |     8 +-
 src/VBox/Runtime/common/net/netaddrstr.cpp         |    67 -
 src/VBox/Runtime/common/net/netaddrstr2.cpp        |   346 +-
 src/VBox/Runtime/common/path/RTPathExt.cpp         |    13 +-
 src/VBox/Runtime/common/path/RTPathHasExt.cpp      |    13 +-
 src/VBox/Runtime/common/path/RTPathStripExt.cpp    |    39 +-
 src/VBox/Runtime/common/string/ministring.cpp      |    23 +-
 src/VBox/Runtime/common/string/strformatrt.cpp     |   135 +-
 src/VBox/Runtime/common/string/unidata-flags.cpp   |     1 -
 src/VBox/Runtime/common/string/unidata-lower.cpp   |     1 -
 src/VBox/Runtime/common/string/unidata-upper.cpp   |     1 -
 src/VBox/Runtime/common/time/timesup.cpp           |   191 +-
 src/VBox/Runtime/common/time/timesupA.asm          |    46 +-
 src/VBox/Runtime/common/time/timesupA.mac          |   158 +-
 src/VBox/Runtime/common/time/timesupref.cpp        |   186 +-
 src/VBox/Runtime/common/time/timesupref.h          |   392 +-
 src/VBox/Runtime/common/zip/gzipvfs.cpp            |    10 +-
 src/VBox/Runtime/common/zip/pkzipvfs.cpp           |     4 +-
 src/VBox/Runtime/common/zip/tar.cpp                |  1776 +-
 src/VBox/Runtime/common/zip/tarvfs.cpp             |    92 +-
 src/VBox/Runtime/common/zip/unzipcmd.cpp           |     4 +-
 src/VBox/Runtime/common/zip/zip.cpp                |     2 +-
 src/VBox/Runtime/generic/RTFileCopy-generic.cpp    |    12 +-
 .../generic/RTMpGetDescription-generic-stub.cpp    |     4 +-
 .../Runtime/generic/RTMpGetDescription-generic.cpp |     4 +-
 src/VBox/Runtime/generic/RTMpOnPair-generic.cpp    |   137 +
 src/VBox/Runtime/generic/RTTimerCreate-generic.cpp |     4 +-
 src/VBox/Runtime/generic/env-generic.cpp           |   443 +-
 src/VBox/Runtime/generic/spinlock-generic.cpp      |    25 +-
 src/VBox/Runtime/include/internal/dbgmod.h         |    21 -
 src/VBox/Runtime/include/internal/dir.h            |     2 +-
 src/VBox/Runtime/include/internal/iprt.h           |     8 +-
 src/VBox/Runtime/include/internal/magics.h         |     6 +-
 src/VBox/Runtime/include/internal/socket.h         |     1 +
 src/VBox/Runtime/include/internal/thread.h         |    23 +-
 src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp   |     2 +
 src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp  |    20 +-
 .../Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp |     2 +-
 .../Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp |    14 +-
 .../Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp  |     7 +
 .../Runtime/r0drv/darwin/time-r0drv-darwin.cpp     |     8 +-
 .../Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c   |     8 +
 src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c  |    20 +-
 .../Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c |    12 -
 .../Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c  |     7 +
 .../Runtime/r0drv/freebsd/time-r0drv-freebsd.c     |     5 +-
 .../Runtime/r0drv/freebsd/timer-r0drv-freebsd.c    |     2 +-
 .../Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp |    29 +-
 .../r0drv/generic/threadctxhooks-r0drv-generic.cpp |    47 +-
 src/VBox/Runtime/r0drv/haiku/mp-r0drv-haiku.c      |    20 +-
 .../Runtime/r0drv/haiku/spinlock-r0drv-haiku.c     |    10 +-
 src/VBox/Runtime/r0drv/haiku/thread2-r0drv-haiku.c |    17 +-
 src/VBox/Runtime/r0drv/haiku/time-r0drv-haiku.c    |     8 +-
 src/VBox/Runtime/r0drv/initterm-r0drv.cpp          |     2 +
 src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c   |    11 +-
 .../Runtime/r0drv/linux/initterm-r0drv-linux.c     |    10 +-
 src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c  |     2 +-
 src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c      |   245 +-
 .../r0drv/linux/mpnotification-r0drv-linux.c       |    80 +-
 .../Runtime/r0drv/linux/spinlock-r0drv-linux.c     |    23 +-
 src/VBox/Runtime/r0drv/linux/the-linux-kernel.h    |    17 +
 src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c  |     6 +-
 src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c |     7 +
 .../r0drv/linux/threadctxhooks-r0drv-linux.c       |   298 +-
 src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c    |     8 +-
 src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c   |     8 +-
 src/VBox/Runtime/r0drv/memobj-r0drv.cpp            |     2 +-
 src/VBox/Runtime/r0drv/mp-r0drv.h                  |    10 +
 src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp    |    80 +-
 src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h      |    19 +-
 src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp          |   598 +-
 src/VBox/Runtime/r0drv/nt/ntBldSymDb.cpp           |     2 +-
 src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp    |    14 +-
 src/VBox/Runtime/r0drv/nt/the-nt-kernel.h          |     4 +-
 src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp     |     8 +
 src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp        |     6 +-
 src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp       |    39 +-
 src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp  |    12 -
 src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp   |     5 +
 src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp     |    16 +-
 .../Runtime/r0drv/solaris/alloc-r0drv-solaris.c    |     2 +-
 .../r0drv/solaris/dbgkrnlinfo-r0drv-solaris.c      |    13 +-
 .../Runtime/r0drv/solaris/initterm-r0drv-solaris.c |    50 +-
 .../Runtime/r0drv/solaris/memobj-r0drv-solaris.c   |     3 +
 .../r0drv/solaris/modulestub-r0drv-solaris.c       |    26 +-
 src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c  |   162 +-
 .../r0drv/solaris/mpnotification-r0drv-solaris.c   |    61 +-
 .../r0drv/solaris/semeventwait-r0drv-solaris.h     |    15 +-
 .../Runtime/r0drv/solaris/spinlock-r0drv-solaris.c |    14 +-
 .../Runtime/r0drv/solaris/the-solaris-kernel.h     |     7 +-
 .../Runtime/r0drv/solaris/thread-r0drv-solaris.c   |    14 +-
 .../Runtime/r0drv/solaris/thread2-r0drv-solaris.c  |    52 +-
 .../r0drv/solaris/threadctxhooks-r0drv-solaris.c   |   266 +-
 .../Runtime/r0drv/solaris/time-r0drv-solaris.c     |     8 +-
 .../Runtime/r0drv/solaris/timer-r0drv-solaris.c    |   536 +-
 src/VBox/Runtime/r3/alloc-ef-cpp.cpp               |     6 +-
 src/VBox/Runtime/r3/alloc-ef.cpp                   |   272 +
 src/VBox/Runtime/r3/alloc-ef.h                     |    22 +
 src/VBox/Runtime/r3/darwin/time-darwin.cpp         |     8 +-
 src/VBox/Runtime/r3/fileio.cpp                     |   226 +-
 src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp  |    98 +
 src/VBox/Runtime/r3/haiku/time-haiku.cpp           |     7 +-
 src/VBox/Runtime/r3/linux/sysfs.cpp                |    90 +-
 src/VBox/Runtime/r3/linux/time-linux.cpp           |    10 +-
 src/VBox/Runtime/r3/nt/time-nt.cpp                 |   218 +
 src/VBox/Runtime/r3/posix/env-posix.cpp            |     7 +-
 src/VBox/Runtime/r3/posix/ldrNative-posix.cpp      |     2 +-
 .../Runtime/r3/posix/process-creation-posix.cpp    |     2 +-
 src/VBox/Runtime/r3/posix/process-posix.cpp        |     1 +
 src/VBox/Runtime/r3/posix/rtmemlocked-posix.cpp    |   160 -
 .../r3/posix/rtmempage-exec-mmap-heap-posix.cpp    |    16 +-
 src/VBox/Runtime/r3/posix/time-posix.cpp           |    10 +-
 src/VBox/Runtime/r3/posix/timer-posix.cpp          |     6 +-
 src/VBox/Runtime/r3/socket.cpp                     |    65 +-
 src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp |     4 +-
 src/VBox/Runtime/r3/stream.cpp                     |    89 +
 src/VBox/Runtime/r3/test.cpp                       |     4 +-
 src/VBox/Runtime/r3/win/VBoxRT-win32.def           |    20 +-
 src/VBox/Runtime/r3/win/VBoxRT-win64.def           |    20 +-
 src/VBox/Runtime/r3/win/VBoxRT.rc                  |    59 -
 src/VBox/Runtime/r3/win/dir-win.cpp                |    12 +-
 src/VBox/Runtime/r3/win/env-win.cpp                |    14 +-
 src/VBox/Runtime/r3/win/fileio-win.cpp             |     7 +-
 src/VBox/Runtime/r3/win/internal-r3-win.h          |    26 +
 src/VBox/Runtime/r3/win/ldrNative-win.cpp          |     2 +-
 src/VBox/Runtime/r3/win/localipc-win.cpp           |     7 +-
 src/VBox/Runtime/r3/win/mp-win.cpp                 |    17 +-
 src/VBox/Runtime/r3/win/ntdll-mini-implib.def      |     2 +
 src/VBox/Runtime/r3/win/process-win.cpp            |    59 +-
 src/VBox/Runtime/r3/win/rtmemlocked-win.cpp        |   110 -
 src/VBox/Runtime/r3/win/symlink-win.cpp            |    10 +
 src/VBox/Runtime/r3/win/thread-win.cpp             |    41 +
 src/VBox/Runtime/r3/win/time-win.cpp               |    65 +-
 src/VBox/Runtime/r3/win/time2-win.cpp              |    94 +
 src/VBox/Runtime/r3/xml.cpp                        |    10 +-
 src/VBox/Runtime/testcase/Makefile.kmk             |    92 +-
 src/VBox/Runtime/testcase/tstDarwinSched.cpp       |    26 +
 src/VBox/Runtime/testcase/tstHandleTable.cpp       |     2 +-
 src/VBox/Runtime/testcase/tstLdr-3.cpp             |     5 +
 src/VBox/Runtime/testcase/tstPrfRT.cpp             |    33 +-
 .../Runtime/testcase/tstR0ThreadPreemption.cpp     |   457 -
 src/VBox/Runtime/testcase/tstR0ThreadPreemption.h  |    44 -
 .../testcase/tstR0ThreadPreemptionDriver.cpp       |   301 -
 src/VBox/Runtime/testcase/tstRTGetOpt.cpp          |     4 +
 src/VBox/Runtime/testcase/tstRTInlineAsm.cpp       |   279 +-
 src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.S  |   126 +
 .../Runtime/testcase/tstRTLdrMachORelocs-1.disas   |   206 +
 src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.o  |   Bin 0 -> 1480 bytes
 src/VBox/Runtime/testcase/tstRTNetIPv4.cpp         |   134 +
 src/VBox/Runtime/testcase/tstRTNetIPv6.cpp         |   191 +
 src/VBox/Runtime/testcase/tstRTPath.cpp            |    18 +-
 src/VBox/Runtime/testcase/tstRTR0Thread.cpp        |   120 +
 src/VBox/Runtime/testcase/tstRTR0Thread.h          |    42 +
 src/VBox/Runtime/testcase/tstRTR0ThreadDriver.cpp  |    80 +
 .../Runtime/testcase/tstRTR0ThreadPreemption.cpp   |   456 +
 .../Runtime/testcase/tstRTR0ThreadPreemption.h     |    44 +
 .../testcase/tstRTR0ThreadPreemptionDriver.cpp     |   301 +
 src/VBox/Runtime/testcase/tstRTR0Timer.cpp         |     5 +-
 src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp   |     2 +-
 src/VBox/Runtime/testcase/tstRTSymlink.cpp         |    23 +-
 src/VBox/Runtime/testcase/tstRTTcp-1.cpp           |    27 +
 src/VBox/Runtime/testcase/tstRTTime.cpp            |     5 +-
 src/VBox/Runtime/testcase/tstRTZip.cpp             |    87 +
 src/VBox/Runtime/testcase/tstUtf8.cpp              |    18 +-
 src/VBox/Runtime/tools/Makefile.kmk                |    14 +-
 src/VBox/Runtime/tools/RTDbgSymCache.cpp           |   167 +-
 src/VBox/Runtime/tools/RTGzip.cpp                  |    12 +-
 src/VBox/Runtime/tools/RTNtDbgHelp.cpp             |     8 +-
 src/VBox/Runtime/win/RTErrConvertFromWin32.cpp     |     3 +-
 src/VBox/Storage/DMG.cpp                           |    12 +-
 src/VBox/Storage/Debug/Makefile.kmk                |     2 +-
 src/VBox/Storage/Debug/VDDbgIoLog.cpp              |     6 +-
 src/VBox/Storage/ISCSI.cpp                         |   127 +-
 src/VBox/Storage/Makefile.kmk                      |     4 +-
 src/VBox/Storage/Parallels.cpp                     |    30 +-
 src/VBox/Storage/QCOW.cpp                          |    20 +-
 src/VBox/Storage/QED.cpp                           |    22 +-
 src/VBox/Storage/RAW.cpp                           |    42 +-
 src/VBox/Storage/VD.cpp                            |   678 +-
 src/VBox/Storage/VDI.cpp                           |    25 +-
 src/VBox/Storage/VHD.cpp                           |    33 +-
 src/VBox/Storage/VHDX.cpp                          |    40 +-
 src/VBox/Storage/VMDK.cpp                          |    60 +-
 src/VBox/Storage/testcase/BuiltinTests.h           |     4 +-
 src/VBox/Storage/testcase/Makefile.kmk             |     2 +-
 src/VBox/Storage/testcase/VDIoBackend.cpp          |    12 +
 src/VBox/Storage/testcase/VDIoBackend.h            |     2 +
 src/VBox/Storage/testcase/VDScript.cpp             |    44 +-
 src/VBox/Storage/testcase/tstVDIo.cpp              |    12 +-
 src/VBox/Storage/testcase/vbox-img.cpp             |   177 +-
 src/VBox/Storage/testcase/vbox-img.rc              |    21 +-
 src/VBox/Storage/testcase/vditool.cpp              |     3 +-
 src/VBox/VMM/Makefile.kmk                          |   136 +-
 src/VBox/VMM/VBoxVMM.d                             |    13 +-
 src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp                |  1020 +-
 src/VBox/VMM/VMMAll/CPUMAllRegs.cpp                |  1391 +-
 src/VBox/VMM/VMMAll/CPUMStack.cpp                  |     2 +-
 src/VBox/VMM/VMMAll/EMAll.cpp                      |   139 +-
 src/VBox/VMM/VMMAll/GIMAll.cpp                     |   263 +
 src/VBox/VMM/VMMAll/GIMAllHv.cpp                   |   332 +
 src/VBox/VMM/VMMAll/GIMAllKvm.cpp                  |   413 +
 src/VBox/VMM/VMMAll/HMAll.cpp                      |   107 +-
 src/VBox/VMM/VMMAll/IEMAll.cpp                     |  2135 +-
 src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h              |  1353 +-
 src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h      |     9 +-
 src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h       |   218 +-
 src/VBox/VMM/VMMAll/IOMAll.cpp                     |     4 +-
 src/VBox/VMM/VMMAll/IOMAllMMIO.cpp                 |    32 +-
 src/VBox/VMM/VMMAll/MMAll.cpp                      |     1 +
 src/VBox/VMM/VMMAll/MMAllHyper.cpp                 |    41 +
 src/VBox/VMM/VMMAll/PATMAll.cpp                    |   187 +-
 src/VBox/VMM/VMMAll/PDMAll.cpp                     |    19 +
 src/VBox/VMM/VMMAll/PDMAllCritSect.cpp             |     4 +-
 src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp           |     4 +
 src/VBox/VMM/VMMAll/PDMAllQueue.cpp                |    53 +-
 src/VBox/VMM/VMMAll/PGMAll.cpp                     |     1 +
 src/VBox/VMM/VMMAll/PGMAllBth.h                    |   123 +-
 src/VBox/VMM/VMMAll/PGMAllGst.h                    |    14 +-
 src/VBox/VMM/VMMAll/PGMAllHandler.cpp              |   365 +-
 src/VBox/VMM/VMMAll/PGMAllPhys.cpp                 |   224 +-
 src/VBox/VMM/VMMAll/PGMAllPool.cpp                 |   190 +-
 src/VBox/VMM/VMMAll/REMAll.cpp                     |    18 +-
 src/VBox/VMM/VMMAll/SELMAll.cpp                    |    31 +-
 src/VBox/VMM/VMMAll/TMAll.cpp                      |    58 +-
 src/VBox/VMM/VMMAll/TMAllCpu.cpp                   |   337 +-
 src/VBox/VMM/VMMAll/TMAllVirtual.cpp               |   284 +-
 src/VBox/VMM/VMMAll/TRPMAll.cpp                    |     7 +-
 src/VBox/VMM/VMMAll/VMMAll.cpp                     |    79 +-
 src/VBox/VMM/VMMR0/CPUMR0.cpp                      |    97 +-
 src/VBox/VMM/VMMR0/CPUMR0A.asm                     |   841 +-
 src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm               |    14 +-
 src/VBox/VMM/VMMR0/GIMR0.cpp                       |   109 +
 src/VBox/VMM/VMMR0/GIMR0Hv.cpp                     |   170 +
 src/VBox/VMM/VMMR0/GMMR0.cpp                       |     3 +
 src/VBox/VMM/VMMR0/GVMMR0.cpp                      |    23 +-
 src/VBox/VMM/VMMR0/HMR0.cpp                        |   280 +-
 src/VBox/VMM/VMMR0/HMR0A.asm                       |   343 +-
 src/VBox/VMM/VMMR0/HMR0Mixed.mac                   |   352 +-
 src/VBox/VMM/VMMR0/HMSVMR0.cpp                     |   876 +-
 src/VBox/VMM/VMMR0/HMVMXR0.cpp                     |  3424 ++-
 src/VBox/VMM/VMMR0/PDMR0Device.cpp                 |    15 +-
 src/VBox/VMM/VMMR0/PGMR0.cpp                       |    15 +-
 src/VBox/VMM/VMMR0/VMMR0.cpp                       |   681 +-
 src/VBox/VMM/VMMR0/VMMR0.def                       |     8 +-
 src/VBox/VMM/VMMR3/CFGM.cpp                        |    28 +-
 src/VBox/VMM/VMMR3/CPUM.cpp                        |  3819 +---
 src/VBox/VMM/VMMR3/CPUMDbg.cpp                     |   375 +-
 src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp                 |  5169 ++++-
 src/VBox/VMM/VMMR3/CPUMR3Db.cpp                    |   128 +-
 src/VBox/VMM/VMMR3/CSAM.cpp                        |   124 +-
 src/VBox/VMM/VMMR3/DBGF.cpp                        |    43 +-
 src/VBox/VMM/VMMR3/DBGFCoreWrite.cpp               |     4 +-
 src/VBox/VMM/VMMR3/DBGFInfo.cpp                    |    87 +-
 src/VBox/VMM/VMMR3/DBGFOS.cpp                      |   198 +-
 src/VBox/VMM/VMMR3/DBGFR3PlugIn.cpp                |   614 +
 src/VBox/VMM/VMMR3/EM.cpp                          |    32 +-
 src/VBox/VMM/VMMR3/EMRaw.cpp                       |    20 +-
 src/VBox/VMM/VMMR3/FTM.cpp                         |     2 +-
 src/VBox/VMM/VMMR3/GIM.cpp                         |   619 +
 src/VBox/VMM/VMMR3/GIMHv.cpp                       |   714 +
 src/VBox/VMM/VMMR3/GIMKvm.cpp                      |   541 +
 src/VBox/VMM/VMMR3/GIMMinimal.cpp                  |   137 +
 src/VBox/VMM/VMMR3/HM.cpp                          |   323 +-
 src/VBox/VMM/VMMR3/IEMR3.cpp                       |     9 -
 src/VBox/VMM/VMMR3/IOM.cpp                         |   113 +-
 src/VBox/VMM/VMMR3/MM.cpp                          |    20 +-
 src/VBox/VMM/VMMR3/MMHyper.cpp                     |   104 +-
 src/VBox/VMM/VMMR3/MMPagePool.cpp                  |     2 +-
 src/VBox/VMM/VMMR3/PATM.cpp                        |   317 +-
 src/VBox/VMM/VMMR3/PATMA.asm                       |  2308 +-
 src/VBox/VMM/VMMR3/PATMA.mac                       |   145 +-
 src/VBox/VMM/VMMR3/PATMPatch.cpp                   |   734 +-
 src/VBox/VMM/VMMR3/PATMR3Dbg.cpp                   |     8 +-
 src/VBox/VMM/VMMR3/PATMSSM.cpp                     |   356 +-
 src/VBox/VMM/VMMR3/PDM.cpp                         |    56 +-
 src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp      |    11 +-
 src/VBox/VMM/VMMR3/PDMBlkCache.cpp                 |    19 +-
 src/VBox/VMM/VMMR3/PDMDevHlp.cpp                   |    74 +-
 src/VBox/VMM/VMMR3/PDMDevice.cpp                   |     2 +-
 src/VBox/VMM/VMMR3/PDMDriver.cpp                   |     6 +-
 src/VBox/VMM/VMMR3/PDMLdr.cpp                      |    71 +-
 src/VBox/VMM/VMMR3/PDMUsb.cpp                      |   391 +-
 src/VBox/VMM/VMMR3/PGM.cpp                         |   175 +-
 src/VBox/VMM/VMMR3/PGMHandler.cpp                  |   478 +-
 src/VBox/VMM/VMMR3/PGMPhys.cpp                     |   186 +-
 src/VBox/VMM/VMMR3/PGMPhysRWTmpl.h                 |    12 +-
 src/VBox/VMM/VMMR3/PGMPool.cpp                     |   143 +-
 src/VBox/VMM/VMMR3/SELM.cpp                        |   173 +-
 src/VBox/VMM/VMMR3/SSM.cpp                         |   530 +-
 src/VBox/VMM/VMMR3/STAM.cpp                        |     6 +-
 src/VBox/VMM/VMMR3/TM.cpp                          |   605 +-
 src/VBox/VMM/VMMR3/TRPM.cpp                        |    78 +-
 src/VBox/VMM/VMMR3/VM.cpp                          |    78 +-
 src/VBox/VMM/VMMR3/VMEmt.cpp                       |     4 +-
 src/VBox/VMM/VMMR3/VMM.cpp                         |    32 +-
 src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp           |     1 +
 src/VBox/VMM/VMMR3/VMMR3.def                       |    10 +-
 src/VBox/VMM/VMMR3/VMMR3.rc                        |    50 -
 src/VBox/VMM/VMMR3/VMMSwitcher.cpp                 |    10 +-
 src/VBox/VMM/VMMR3/VMMTests.cpp                    |     6 +-
 src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_3200.h       |    12 +-
 .../VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h   |     6 +-
 src/VBox/VMM/VMMR3/cpus/AMD_FX_8150_Eight_Core.h   |    14 +-
 src/VBox/VMM/VMMR3/cpus/AMD_Phenom_II_X6_1100T.h   |    12 +-
 src/VBox/VMM/VMMR3/cpus/Intel_Core_i5_3570.h       |    14 +-
 src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_2635QM.h     |    14 +-
 src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3820QM.h     |    14 +-
 src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3960X.h      |    18 +-
 src/VBox/VMM/VMMR3/cpus/Intel_Pentium_4_3_00GHz.h  |    12 +-
 .../VMMR3/cpus/Intel_Pentium_M_processor_2_00GHz.h |    12 +-
 src/VBox/VMM/VMMR3/cpus/Intel_Xeon_X5482_3_20GHz.h |    12 +-
 .../VMM/VMMR3/cpus/Quad_Core_AMD_Opteron_2384.h    |    12 +-
 .../VMM/VMMR3/cpus/VIA_QuadCore_L4700_1_2_GHz.h    |    12 +-
 src/VBox/VMM/VMMRC/CPUMRC.cpp                      |     2 +-
 src/VBox/VMM/VMMRC/CPUMRCA.asm                     |   644 +-
 src/VBox/VMM/VMMRC/CPUMRCPatchHlp.asm              |   194 +
 src/VBox/VMM/VMMRC/CSAMRC.cpp                      |    19 +-
 src/VBox/VMM/VMMRC/PATMRC.cpp                      |    10 +-
 src/VBox/VMM/VMMRC/PDMRCDevice.cpp                 |    15 +-
 src/VBox/VMM/VMMRC/SELMRC.cpp                      |    68 +-
 src/VBox/VMM/VMMRC/TRPMRC.cpp                      |    24 +-
 src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp              |    23 +-
 src/VBox/VMM/VMMRC/VMMRC.cpp                       |     4 +-
 src/VBox/VMM/VMMRC/VMMRC.def                       |     9 +-
 src/VBox/VMM/VMMRC/VMMRC.mac                       |    70 +-
 src/VBox/VMM/VMMRC/VMMRC0.asm                      |     8 +-
 src/VBox/VMM/VMMRC/VMMRC99.asm                     |    17 +-
 src/VBox/VMM/VMMRZ/PGMRZDynMap.cpp                 |    22 +-
 src/VBox/VMM/VMMRZ/VMMRZ.cpp                       |     6 +-
 src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac        |    90 +-
 src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac        |   185 +-
 src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac           |    57 +-
 .../VMM/dtrace/return-to-ring-3-aggregation-1.d    |    36 +
 src/VBox/VMM/dtrace/vmexit-reason-aggregation-1.d  |    36 +
 src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d     |     3 +-
 src/VBox/VMM/include/CPUMInternal.h                |   795 +-
 src/VBox/VMM/include/CPUMInternal.mac              |   562 +-
 src/VBox/VMM/include/CSAMInternal.h                |    21 +-
 src/VBox/VMM/include/DBGFInternal.h                |    24 +-
 src/VBox/VMM/include/EMHandleRCTmpl.h              |    21 +
 src/VBox/VMM/include/GIMHvInternal.h               |   534 +
 src/VBox/VMM/include/GIMInternal.h                 |   114 +
 src/VBox/VMM/include/GIMKvmInternal.h              |   270 +
 src/VBox/VMM/include/GIMMinimalInternal.h          |    35 +
 src/VBox/VMM/include/HMInternal.h                  |   307 +-
 src/VBox/VMM/include/HMInternal.mac                |    27 +-
 src/VBox/VMM/include/IEMInternal.h                 |    33 +-
 src/VBox/VMM/include/IOMInternal.h                 |    18 +-
 src/VBox/VMM/include/PATMA.h                       |   244 +-
 src/VBox/VMM/include/PATMInternal.h                |    81 +-
 src/VBox/VMM/include/PDMInternal.h                 |     9 +-
 src/VBox/VMM/include/PGMInline.h                   |    46 +-
 src/VBox/VMM/include/PGMInternal.h                 |   281 +-
 src/VBox/VMM/include/REMInternal.h                 |     6 +-
 src/VBox/VMM/include/SELMInternal.h                |    65 +-
 src/VBox/VMM/include/SSMInternal.h                 |    38 +
 src/VBox/VMM/include/TMInternal.h                  |    80 +-
 src/VBox/VMM/include/TRPMInternal.h                |    10 +-
 src/VBox/VMM/include/TRPMInternal.mac              |     8 +-
 src/VBox/VMM/include/VMMInternal.h                 |    17 +-
 src/VBox/VMM/include/VMMInternal.mac               |    11 +-
 src/VBox/VMM/include/VMMSwitcher.h                 |     4 +-
 src/VBox/VMM/include/VMMSwitcher.mac               |     4 +-
 .../testcase/Instructions/InstructionTestGen.py    |     2 +-
 src/VBox/VMM/testcase/Instructions/itgTableDaa.py  |     2 +-
 src/VBox/VMM/testcase/Instructions/itgTableDas.py  |     2 +-
 src/VBox/VMM/testcase/Makefile.kmk                 |    27 +-
 src/VBox/VMM/testcase/tstAnimate.cpp               |     2 +-
 src/VBox/VMM/testcase/tstHelp.h                    |     6 +-
 src/VBox/VMM/testcase/tstIEMCheckMc.cpp            |    10 +-
 src/VBox/VMM/testcase/tstSSM-2.cpp                 |    81 +
 src/VBox/VMM/testcase/tstVMM.cpp                   |    45 +-
 src/VBox/VMM/testcase/tstVMStruct.h                |    69 +-
 src/VBox/VMM/testcase/tstVMStructDTrace.cpp        |     1 +
 src/VBox/VMM/testcase/tstVMStructRC.cpp            |     1 +
 src/VBox/VMM/testcase/tstVMStructSize.cpp          |    27 +-
 src/VBox/VMM/testcase/tstX86-FpuSaveRestore.cpp    |   116 +
 src/VBox/VMM/testcase/tstX86-FpuSaveRestoreA.asm   |   117 +
 src/VBox/VMM/tools/Makefile.kmk                    |     2 +-
 src/VBox/VMM/tools/VBoxCpuReport.cpp               |    27 +-
 src/VBox/ValidationKit/Config.kmk                  |   237 +
 src/VBox/ValidationKit/Makefile.kmk                |   272 +
 .../ValidationKitCodingGuidelines.cpp              |    75 +
 src/VBox/ValidationKit/bootsectors/Makefile.kmk    |   190 +
 .../ValidationKit/bootsectors/VBoxBs2Linker.cpp    |   210 +
 .../ValidationKit/bootsectors/bootsector-empty.asm |    61 +
 .../ValidationKit/bootsectors/bootsector-pae.asm   |   163 +
 .../bootsectors/bootsector-shutdown.asm            |    76 +
 .../ValidationKit/bootsectors/bootsector2-api.mac  |   152 +
 .../bootsectors/bootsector2-boot-registers-1.asm   |    77 +
 .../bootsectors/bootsector2-common-end.mac         |    42 +
 .../bootsectors/bootsector2-common-init-code.mac   |  2295 ++
 .../bootsectors/bootsector2-common-init-traps.mac  |  1605 ++
 .../bootsectors/bootsector2-common-macros-1.mac    |    50 +
 .../bootsector2-common-routines-template-1.mac     |  2641 +++
 .../bootsector2-common-routines-template-2.mac     |   214 +
 .../bootsectors/bootsector2-common-routines.mac    |   222 +
 .../bootsector2-common-traprec-template.mac        |   105 +
 .../bootsectors/bootsector2-common-traprec.mac     |   199 +
 .../bootsectors/bootsector2-cpu-a20-1-template.mac |   375 +
 .../bootsectors/bootsector2-cpu-a20-1.asm          |   376 +
 .../bootsector2-cpu-basic-1-template.mac           |    74 +
 .../bootsectors/bootsector2-cpu-basic-1.asm        |   119 +
 .../bootsector2-cpu-hidden-regs-1-template.mac     |   342 +
 .../bootsectors/bootsector2-cpu-hidden-regs-1.asm  |   275 +
 .../bootsector2-cpu-instr-1-template.mac           |   315 +
 .../bootsectors/bootsector2-cpu-instr-1.asm        |   110 +
 .../bootsectors/bootsector2-cpu-pf-1-template.mac  |  1051 +
 .../bootsectors/bootsector2-cpu-pf-1.asm           |   154 +
 .../bootsector2-cpu-xcpt-1-template.mac            |  1963 ++
 .../bootsectors/bootsector2-cpu-xcpt-1.asm         |   128 +
 .../bootsector2-cpu-xcpt-2-template.mac            |   501 +
 .../bootsectors/bootsector2-cpu-xcpt-2.asm         |   119 +
 .../bootsectors/bootsector2-first.mac              |    74 +
 .../bootsectors/bootsector2-structures.mac         |    91 +
 .../bootsectors/bootsector2-template-footer.mac    |   106 +
 .../bootsectors/bootsector2-template-header.mac    |   793 +
 .../bootsectors/bootsector2-test1-template.mac     |   756 +
 .../bootsectors/bootsector2-test1.asm              |   187 +
 .../bootsectors/bootsector2-triple-fault-1.asm     |   380 +
 .../bootsectors/bootsector2-vbinstst-64-1.asm      |   111 +
 .../bootsector2-vbinstst-big-template.asm          |    81 +
 .../bootsectors/bootsector2-vbinstst-kernel.asm    |   517 +
 src/VBox/ValidationKit/bootsectors/todo.txt        |    10 +
 src/VBox/ValidationKit/common/Makefile.kmk         |    65 +
 src/VBox/ValidationKit/common/__init__.py          |    35 +
 .../common/constants}/Makefile.kup                 |     0
 .../ValidationKit/common/constants/__init__.py     |    37 +
 src/VBox/ValidationKit/common/constants/result.py  |    41 +
 .../ValidationKit/common/constants/rtexitcode.py   |    47 +
 src/VBox/ValidationKit/common/constants/tbreq.py   |   120 +
 src/VBox/ValidationKit/common/constants/tbresp.py  |    83 +
 .../ValidationKit/common/constants/valueunit.py    |   128 +
 src/VBox/ValidationKit/common/utils.py             |  1475 ++
 src/VBox/ValidationKit/common/webutils.py          |   204 +
 .../ValidationKit/docs/AutomaticTestingRevamp.html |  1357 ++
 .../ValidationKit/docs/AutomaticTestingRevamp.txt  |  1062 +
 src/VBox/ValidationKit/docs/Makefile.kmk           |    40 +
 .../docs/VBoxValidationKitReadMe.html              |   445 +
 .../ValidationKit/docs/VBoxValidationKitReadMe.txt |   114 +
 src/VBox/ValidationKit/jshintrc.js                 |     8 +
 src/VBox/ValidationKit/readme.txt                  |     3 +
 src/VBox/ValidationKit/snippets/alloc-1.c          |    99 +
 src/VBox/ValidationKit/snippets/time-1.c           |   112 +
 src/VBox/ValidationKit/td-dummy.py                 |    51 +
 src/VBox/ValidationKit/testanalysis/Makefile.kmk   |    35 +
 src/VBox/ValidationKit/testanalysis/__init__.py    |    31 +
 src/VBox/ValidationKit/testanalysis/diff.py        |    95 +
 src/VBox/ValidationKit/testanalysis/reader.py      |   291 +
 src/VBox/ValidationKit/testanalysis/reporting.py   |   302 +
 src/VBox/ValidationKit/testanalysis/tst-a1.py      |   100 +
 src/VBox/ValidationKit/testboxscript/Makefile.kmk  |    83 +
 .../ValidationKit/testboxscript/TestBoxHelper.cpp  |   442 +
 .../testboxscript/darwin/setup-routines.sh         |   238 +
 .../testboxscript/linux/setup-routines.sh          |    98 +
 .../testboxscript/linux/testboxscript-service.sh   |   499 +
 src/VBox/ValidationKit/testboxscript/setup.sh      |   485 +
 .../testboxscript/solaris/setup-routines.sh        |   383 +
 .../ValidationKit/testboxscript/testboxcommand.py  |   356 +
 .../ValidationKit/testboxscript/testboxcommons.py  |   136 +
 .../testboxscript/testboxconnection.py             |   296 +
 .../ValidationKit/testboxscript/testboxscript.py   |   121 +
 .../testboxscript/testboxscript_real.py            |   982 +
 .../ValidationKit/testboxscript/testboxtasks.py    |   916 +
 .../ValidationKit/testboxscript/testboxupgrade.py  |   318 +
 .../testboxscript/win/autoexec-testbox.cmd         |     5 +
 .../ValidationKit/testboxscript/win/readme.txt     |   107 +
 src/VBox/ValidationKit/testdriver/Makefile.kmk     |    38 +
 src/VBox/ValidationKit/testdriver/__init__.py      |    31 +
 src/VBox/ValidationKit/testdriver/base.py          |  1722 ++
 src/VBox/ValidationKit/testdriver/reporter.py      |  1384 ++
 src/VBox/ValidationKit/testdriver/tst-txsclient.py |   287 +
 src/VBox/ValidationKit/testdriver/txsclient.py     |  2113 ++
 src/VBox/ValidationKit/testdriver/vbox.py          |  3233 +++
 src/VBox/ValidationKit/testdriver/vboxcon.py       |    82 +
 src/VBox/ValidationKit/testdriver/vboxinstaller.py |   895 +
 src/VBox/ValidationKit/testdriver/vboxtestvms.py   |   946 +
 src/VBox/ValidationKit/testdriver/vboxwrappers.py  |  2707 +++
 .../testdriver/win-vbox-net-drvstore-cleanup.ps1   |    34 +
 .../testdriver/win-vbox-net-uninstall.ps1          |   217 +
 src/VBox/ValidationKit/testdriver/winbase.py       |   229 +
 src/VBox/ValidationKit/testmanager/Makefile.kmk    |    44 +
 src/VBox/ValidationKit/testmanager/__init__.py     |    30 +
 .../testmanager/apache-template-2.2.conf           |    77 +
 .../testmanager/apache-template-2.4.conf           |    71 +
 .../ValidationKit/testmanager/batch/Makefile.kmk   |    36 +
 .../ValidationKit/testmanager/batch/add_build.py   |   127 +
 .../testmanager/batch/close_orphaned_testsets.py   |    93 +
 .../ValidationKit/testmanager/batch/del_build.py   |    83 +
 .../testmanager/batch/filearchiver.py              |   271 +
 .../ValidationKit/testmanager/batch/vcs_import.py  |   139 +
 .../ValidationKit/testmanager/cgi/Makefile.kmk     |    36 +
 src/VBox/ValidationKit/testmanager/cgi/admin.py    |    67 +
 .../ValidationKit/testmanager/cgi/debuginfo.py     |    61 +
 src/VBox/ValidationKit/testmanager/cgi/index.py    |    68 +
 src/VBox/ValidationKit/testmanager/cgi/logout.py   |    69 +
 src/VBox/ValidationKit/testmanager/cgi/logout2.py  |    72 +
 .../ValidationKit/testmanager/cgi/testboxdisp.py   |    65 +
 src/VBox/ValidationKit/testmanager/config.py       |   177 +
 .../ValidationKit/testmanager/core/Makefile.kmk    |    36 +
 .../ValidationKit/testmanager/core/__init__.py     |    30 +
 src/VBox/ValidationKit/testmanager/core/base.py    |  1129 +
 src/VBox/ValidationKit/testmanager/core/build.py   |   808 +
 .../testmanager/core/buildblacklist.py             |   273 +
 .../ValidationKit/testmanager/core/buildsource.py  |   473 +
 .../ValidationKit/testmanager/core/coreconsts.py   |    88 +
 src/VBox/ValidationKit/testmanager/core/db.py      |   630 +
 .../ValidationKit/testmanager/core/dbobjcache.py   |   191 +
 .../testmanager/core/failurecategory.py            |   239 +
 .../testmanager/core/failurereason.py              |   306 +
 .../testmanager/core/globalresource.pgsql          |   108 +
 .../testmanager/core/globalresource.py             |   276 +
 src/VBox/ValidationKit/testmanager/core/report.py  |   627 +
 .../ValidationKit/testmanager/core/schedgroup.py   |   977 +
 .../testmanager/core/schedulerbase.py              |  1406 ++
 .../testmanager/core/schedulerbeci.py              |   119 +
 .../ValidationKit/testmanager/core/systemlog.py    |   175 +
 src/VBox/ValidationKit/testmanager/core/testbox.py |   885 +
 .../testmanager/core/testboxcontroller.py          |   955 +
 .../testmanager/core/testboxstatus.py              |   287 +
 .../ValidationKit/testmanager/core/testcase.pgsql  |   254 +
 .../ValidationKit/testmanager/core/testcase.py     |  1390 ++
 .../ValidationKit/testmanager/core/testcaseargs.py |   356 +
 .../ValidationKit/testmanager/core/testgroup.py    |   718 +
 .../ValidationKit/testmanager/core/testresults.py  |  1613 ++
 src/VBox/ValidationKit/testmanager/core/testset.py |   650 +
 .../testmanager/core/useraccount.pgsql             |   168 +
 .../ValidationKit/testmanager/core/useraccount.py  |   257 +
 .../ValidationKit/testmanager/core/vcsrevisions.py |   242 +
 .../testmanager/core/webservergluebase.py          |   611 +
 .../testmanager/core/webservergluecgi.py           |    85 +
 src/VBox/ValidationKit/testmanager/db/Makefile.kmk |    66 +
 .../testmanager/db/TestManagerDatabase.dmd         |     8 +
 .../db/TestManagerDatabase/datatypes/DataTypes.xml |    15 +
 .../seg_0/47E390DE-0671-C4B1-8428-0F45CBEE18F8.xml |    37 +
 .../seg_0/F72C39E0-D1CA-8821-2AD7-A1E95A37D3D1.xml |    37 +
 .../E9476B45-3C62-EE27-4705-6F1EFAD11B74.xml       |    21 +
 .../db/TestManagerDatabase/defaultRDBMSSites.xml   |    12 +
 .../db/TestManagerDatabase/defaultdomains.xml      |    13 +
 .../db/TestManagerDatabase/dl_settings.xml         |   288 +
 .../db/TestManagerDatabase/dr_custom_scripts.xml   |   360 +
 .../db/TestManagerDatabase/logical/Logical.xml     |     7 +
 .../seg_0/16464F5A-64BE-D2ED-91E0-BCBD0AA34680.xml |    52 +
 .../seg_0/1BEAB532-23CA-8628-0C97-7CAD39119A4E.xml |    52 +
 .../seg_0/24150FB1-B00F-4F69-6F77-49ECB58F0F66.xml |    52 +
 .../seg_0/28DD93CF-D058-7343-CD47-E9B435E1AC16.xml |    52 +
 .../seg_0/2F6ACC6D-3D17-537D-8ADF-F8424395B345.xml |    52 +
 .../seg_0/44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39.xml |    52 +
 .../seg_0/4579B792-2F35-D72A-1A3B-C7E53C41A766.xml |    52 +
 .../seg_0/4D937E7C-3A28-E52D-89C0-EC8804C62367.xml |    52 +
 .../seg_0/504221DA-1B57-4EAD-39DB-40FD553E9FA2.xml |    52 +
 .../seg_0/6A886CEE-579B-48FF-63F6-0FB03393FBF6.xml |    52 +
 .../seg_0/7AE36CC1-A030-63E5-6EF3-72FCD04815EE.xml |    52 +
 .../seg_0/90367AFB-BA2D-A918-46B9-1E5DE53ACC48.xml |    52 +
 .../seg_0/90F477EE-35D6-21A7-B693-E5724FB07476.xml |    52 +
 .../seg_0/9F78B73C-056D-DDEF-8C50-A9DA76B9E724.xml |    52 +
 .../seg_0/A352A20F-310D-E285-FBC9-90DD0DA7BB9B.xml |    52 +
 .../seg_0/A6A5F317-479C-A0DD-CAAE-9DCB56B29D40.xml |    52 +
 .../seg_0/B36A186B-CDB3-7851-8C38-12EA8D50EAEB.xml |    52 +
 .../seg_0/B82DAF9A-6F99-5CF6-4D99-A391BAD66192.xml |    52 +
 .../seg_0/C332E3D7-638B-6CA8-24BF-383CA8659A3A.xml |    52 +
 .../seg_0/C79482B8-771B-FAD8-0337-163E3A45003A.xml |    52 +
 .../seg_0/D09E0DE5-99D6-2991-032A-A8A124F6ACBA.xml |    52 +
 .../seg_0/DCC79294-5434-1DED-298C-6473DEE59FBA.xml |    52 +
 .../seg_0/DE366053-6F7A-7F42-ABA3-00E583098C37.xml |    52 +
 .../seg_0/E93BBF08-067B-A665-39F3-CF488A6547B2.xml |    52 +
 .../seg_0/876CB767-80BA-6C8E-AACA-F1CCC95C445E.xml |    16 +
 .../seg_0/D487AFDC-4027-F824-EA29-5C6D0ABB9E1E.xml |    16 +
 .../seg_0/01537211-CCFB-0A1E-B43B-E8C641B69471.xml |    17 +
 .../seg_0/02096BBB-0795-1759-1E26-2877BE36BB59.xml |    17 +
 .../seg_0/0CCF1DE3-7916-9054-BEA6-C601FF564DB2.xml |    17 +
 .../seg_0/10867E70-94CE-FDAF-6B6E-2742D3A49E57.xml |    17 +
 .../seg_0/11710A55-6423-1904-841A-C7D2AB8CEEBF.xml |    17 +
 .../seg_0/1C189437-742B-B999-C955-7754C8ADB089.xml |    17 +
 .../seg_0/34733942-1305-4CA1-47EB-ACE724B04E69.xml |    17 +
 .../seg_0/3563C940-E524-7F96-7AE0-DAC3C1C17AFC.xml |    17 +
 .../seg_0/3983F50A-EBB9-E4DE-1958-60EA4EDD6D6C.xml |    17 +
 .../seg_0/3B7C8913-EB6A-47B1-27D0-E2C85EE9048B.xml |    17 +
 .../seg_0/518CE489-97B4-C05C-07A2-E3DBF14EE267.xml |    17 +
 .../seg_0/68A0C3E1-0FA1-8414-A361-33B08A8EDB39.xml |    17 +
 .../seg_0/7497D76B-781B-3BDD-D797-FFBDB974F772.xml |    17 +
 .../seg_0/7DA9DD83-A52E-CA1E-FCBF-FC9CE71AF635.xml |    17 +
 .../seg_0/89A83E25-364B-6B73-0613-FEAD875EF9FB.xml |    17 +
 .../seg_0/8E5018CC-34E3-9AFC-D6D1-31E2BC4E9FE2.xml |    17 +
 .../seg_0/9B1FE0CF-B2AD-EED0-22FC-461A7D46DE51.xml |    17 +
 .../seg_0/A182A65A-47AE-5D00-9A30-BC20AB050BF2.xml |    17 +
 .../seg_0/B346381F-48FE-E495-01A7-E22EC26AEE8A.xml |    17 +
 .../seg_0/B3596116-540F-6397-ECE4-58A386644E15.xml |    17 +
 .../seg_0/BAD8EC05-6F14-4E38-366C-B4B660C6F38A.xml |    17 +
 .../seg_0/C5B67DD4-FA4F-EF9F-1FF5-0445D51B32EE.xml |    17 +
 .../seg_0/CCD38E11-8557-EB34-2651-07EB29E83FA6.xml |    17 +
 .../seg_0/E2A47942-ED55-E81D-4C71-9A134C49C147.xml |    17 +
 .../seg_0/E4FE88E9-EE21-B43B-B0FE-A153E38246F9.xml |    17 +
 .../seg_0/E62AE7DF-49EE-9280-B328-A867CBD273AE.xml |    17 +
 .../seg_0/E74406B5-20F1-4323-DC99-6E45982CB606.xml |    17 +
 .../seg_0/EC4EB506-3DBE-7F36-6451-F31920EDAB52.xml |    17 +
 .../seg_0/EE1D98EF-6AEA-2790-D9B9-DBC2ED21D880.xml |    17 +
 .../016BA1CF-6EA4-9CA4-CDF7-3AAA507EF6EF.xml       |    40 +
 .../32D718B4-250F-95DC-37F0-C0A817F69020.xml       |    70 +
 .../571DBBAF-CDDA-1C46-4220-D1319C0EEC00.xml       |    24 +
 .../65FA5BA0-CC9C-C108-BB1B-AC9E13F5BC83.xml       |   127 +
 .../AFCEF013-4CF2-4A5A-79A3-31521C1CA20A.xml       |   306 +
 .../F936BE6D-7A74-1B57-7564-41C1E13B973B.xml       |    33 +
 .../db/TestManagerDatabase/mapping/ExtendedMap.xml |     3 +
 ...dMap_RMB082B14A-BEA8-D8A7-D661-197F34766ED3.xml |     3 +
 .../rdbms/TestManagerDatabase_RDBMSSites.xml       |     2 +
 .../rel/B082B14A-197F34766ED3.xml                  |     8 +
 .../6CEC5843-B4DD-D9B0-54D4-2845569D5E9F.xml       |    13 +
 .../testmanager/db/TestManagerDatabase/types.xml   |   933 +
 .../db/TestManagerDatabaseComments.pgsql           |  1234 ++
 .../TestManagerDatabaseDefaultUserAccounts.pgsql   |    33 +
 .../db/TestManagerDatabaseForeignKeyErHacks.pgsql  |    80 +
 .../db/TestManagerDatabaseForeignKeyErHacks2.pgsql |    67 +
 .../testmanager/db/TestManagerDatabaseInit.pgsql   |  1758 ++
 .../testmanager/db/TestManagerDatabaseMap.png      |   Bin 0 -> 44750 bytes
 .../testmanager/db/TestManagerVBoxPilot-1.pgsql    |    92 +
 .../testmanager/db/gen-sql-comments.py             |   210 +
 .../testmanager/db/tmdb-r01-builds-1.pgsql         |    81 +
 .../testmanager/db/tmdb-r02-testboxes-1.pgsql      |   184 +
 .../testmanager/db/tmdb-r03-teststatus-1.pgsql     |    38 +
 .../testmanager/db/tmdb-r04-teststatus-2.pgsql     |    36 +
 .../testmanager/db/tmdb-r05-teststatus-3.pgsql     |    44 +
 .../testmanager/db/tmdb-r06-buildsources-1.pgsql   |    36 +
 .../testmanager/db/tmdb-r07-testresults-1.pgsql    |    38 +
 .../db/tmdb-r08-testresultvalues-1.pgsql           |    37 +
 .../testmanager/db/tmdb-r09-testsets-1.pgsql       |    38 +
 .../db/tmdb-r10-testresultvalues-2.pgsql           |   101 +
 .../testmanager/db/tmdb-r11-testsets-2.pgsql       |   204 +
 .../tmdb-r12-testresultvalues-3-testsets-3.pgsql   |    48 +
 ...tmdb-r13-buildcategories-1-vcsrevisions-1.pgsql |   124 +
 .../testmanager/db/tmdb-r14-testboxes-2.pgsql      |   191 +
 .../ValidationKit/testmanager/debug/Makefile.kmk   |    36 +
 .../ValidationKit/testmanager/debug/__init__.py    |    30 +
 .../testmanager/debug/add_testbox.pgsql            |    66 +
 .../testmanager/debug/cgiprofiling.py              |    73 +
 .../testmanager/debug/functions.pgsql              |    72 +
 .../testmanager/htdocs}/Makefile.kup               |     0
 .../testmanager/htdocs/css/common.css              |   815 +
 .../testmanager/htdocs/css/details.css             |   203 +
 .../testmanager/htdocs/css/graphwiz.css            |   227 +
 .../testmanager/htdocs/css/tooltip.css             |   122 +
 .../testmanager/htdocs/images/VirtualBox.svg       |   806 +
 .../testmanager/htdocs/images/VirtualBox_64px.png  |   Bin 0 -> 7884 bytes
 .../testmanager/htdocs/images/tmfavicon.ico        |   Bin 0 -> 3262 bytes
 .../testmanager/htdocs/js}/Makefile.kup            |     0
 .../ValidationKit/testmanager/htdocs/js/common.js  |  1019 +
 .../testmanager/htdocs/js/graphwiz.js              |   117 +
 .../ValidationKit/testmanager/misc/Makefile.kmk    |    36 +
 .../ValidationKit/testmanager/misc/htpasswd-logout |     1 +
 .../ValidationKit/testmanager/misc/htpasswd-sample |     2 +
 src/VBox/ValidationKit/testmanager/readme.txt      |    13 +
 .../testmanager/selftest/st1-load.pgsql            |   154 +
 .../testmanager/selftest/st1-unload.pgsql          |    77 +
 .../ValidationKit/testmanager/webui/Makefile.kmk   |    37 +
 .../ValidationKit/testmanager/webui/__init__.py    |    30 +
 .../testmanager/webui/template-details.html        |    46 +
 .../testmanager/webui/template-graphwiz.html       |    47 +
 .../testmanager/webui/template-tooltip.html        |    20 +
 .../ValidationKit/testmanager/webui/template.html  |    58 +
 .../ValidationKit/testmanager/webui/wuiadmin.py    |   739 +
 .../testmanager/webui/wuiadminbuild.py             |   140 +
 .../testmanager/webui/wuiadminbuildblacklist.py    |   149 +
 .../testmanager/webui/wuiadminbuildcategory.py     |   109 +
 .../testmanager/webui/wuiadminbuildsource.py       |   147 +
 .../testmanager/webui/wuiadminfailurereason.py     |   126 +
 .../testmanager/webui/wuiadminglobalrsrc.py        |   115 +
 .../testmanager/webui/wuiadminschedgroup.py        |   184 +
 .../testmanager/webui/wuiadminsystemlog.py         |    73 +
 .../testmanager/webui/wuiadmintestbox.py           |   332 +
 .../testmanager/webui/wuiadmintestcase.py          |   210 +
 .../testmanager/webui/wuiadmintestgroup.py         |   181 +
 .../testmanager/webui/wuiadminuseraccount.py       |    88 +
 .../ValidationKit/testmanager/webui/wuibase.py     |   986 +
 .../testmanager/webui/wuicontentbase.py            |   857 +
 .../testmanager/webui/wuifailurecategory.py        |   103 +
 .../ValidationKit/testmanager/webui/wuigraphwiz.py |   652 +
 .../ValidationKit/testmanager/webui/wuihlpform.py  |   828 +
 .../ValidationKit/testmanager/webui/wuihlpgraph.py |   115 +
 .../testmanager/webui/wuihlpgraphbase.py           |   121 +
 .../testmanager/webui/wuihlpgraphgooglechart.py    |   246 +
 .../testmanager/webui/wuihlpgraphmatplotlib.py     |   322 +
 .../testmanager/webui/wuihlpgraphsimple.py         |   146 +
 .../testmanager/webui/wuilogviewer.py              |   205 +
 .../ValidationKit/testmanager/webui/wuimain.py     |   994 +
 .../ValidationKit/testmanager/webui/wuireport.py   |   158 +
 .../testmanager/webui/wuitestresult.py             |   713 +
 .../testmanager/webui/wuivcshistory.py             |    91 +
 src/VBox/ValidationKit/tests/Makefile.kmk          |    48 +
 .../ValidationKit/tests/additions/Makefile.kmk     |    43 +
 .../ValidationKit/tests/additions/tdAddBasic1.py   |   315 +
 .../tests/additions/tdAddGuestCtrl.py              |  3383 +++
 src/VBox/ValidationKit/tests/api/Makefile.kmk      |    42 +
 src/VBox/ValidationKit/tests/api/tdPython1.py      |   225 +
 src/VBox/ValidationKit/tests/api/tdTreeDepth1.py   |   163 +
 .../ValidationKit/tests/autostart/Makefile.kmk     |    41 +
 .../ValidationKit/tests/autostart/tdAutostart1.py  |   706 +
 .../ValidationKit/tests/benchmarks/Makefile.kmk    |    41 +
 .../ValidationKit/tests/benchmarks/tdBenchmark1.py |   115 +
 src/VBox/ValidationKit/tests/cpu/Makefile.kmk      |    41 +
 src/VBox/ValidationKit/tests/cpu/tdCpuPae1.py      |   256 +
 .../ValidationKit/tests/installation/Makefile.kmk  |    41 +
 .../tests/installation/tdGuestOsInstOs2.py         |   248 +
 .../tests/installation/tdGuestOsInstTest1.py       |   418 +
 src/VBox/ValidationKit/tests/network/Makefile.kmk  |    41 +
 .../ValidationKit/tests/network/tdNetBenchmark1.py |   621 +
 .../ValidationKit/tests/selftests/Makefile.kmk     |    44 +
 .../ValidationKit/tests/selftests/tdSelfTest1.py   |    47 +
 .../ValidationKit/tests/selftests/tdSelfTest2.py   |   121 +
 .../ValidationKit/tests/selftests/tdSelfTest3.py   |   115 +
 .../ValidationKit/tests/selftests/tdSelfTest4.py   |   115 +
 .../tests/shutdown/tdGuestOsShutdown1.py           |   357 +
 .../ValidationKit/tests/smoketests/Makefile.kmk    |    41 +
 .../ValidationKit/tests/smoketests/tdSmokeTest1.py |   160 +
 src/VBox/ValidationKit/tests/storage/Makefile.kmk  |    43 +
 .../tests/storage/tdStorageBenchmark1.py           |   641 +
 .../tests/storage/tdStorageSnapshotMerging1.py     |   317 +
 .../tests/storage/tdStorageStress1.py              |   517 +
 .../ValidationKit/tests/teleportation/Makefile.kmk |    41 +
 .../tests/teleportation/tdTeleportLocal1.py        |   956 +
 .../ValidationKit/tests/unittests/Makefile.kmk     |    41 +
 .../ValidationKit/tests/unittests/tdUnitTest1.py   |   748 +
 src/VBox/ValidationKit/tests/usb/Makefile.kmk      |    42 +
 src/VBox/ValidationKit/tests/usb/tdUsb1.py         |   381 +
 src/VBox/ValidationKit/tests/usb/usbgadget.py      |   165 +
 src/VBox/ValidationKit/utils/Makefile.kmk          |    60 +
 .../ValidationKit/utils/TestExecServ/Makefile.kmk  |    65 +
 .../utils/TestExecServ/TestExecService.cpp         |  3467 +++
 .../utils/TestExecServ/TestExecServiceInternal.h   |   219 +
 .../utils/TestExecServ/TestExecServiceTcp.cpp      |   830 +
 .../utils/TestExecServ/linux/vboxtxs-nat.sh        |   341 +
 .../utils/TestExecServ/linux/vboxtxs.sh            |   340 +
 .../utils/TestExecServ/solaris/vboxtxs-sol10.xml   |    73 +
 .../utils/TestExecServ/solaris/vboxtxs.sh          |    54 +
 .../utils/TestExecServ/solaris/vboxtxs.xml         |    73 +
 .../utils/TestExecServ/vboxtxs-readme.txt          |   113 +
 .../utils/TestExecServ/win/vboxtxs-nat.cmd         |    30 +
 .../utils/TestExecServ/win/vboxtxs-nat.reg         |    12 +
 .../utils/TestExecServ/win/vboxtxs.cmd             |    29 +
 .../utils/TestExecServ/win/vboxtxs.reg             |    12 +
 src/VBox/ValidationKit/utils/cpu/Makefile.kmk      |    65 +
 src/VBox/ValidationKit/utils/cpu/cidet-app.cpp     |  1361 ++
 src/VBox/ValidationKit/utils/cpu/cidet-appA.asm    |   309 +
 src/VBox/ValidationKit/utils/cpu/cidet-core.cpp    |  2351 ++
 src/VBox/ValidationKit/utils/cpu/cidet-instr-1.cpp |   287 +
 src/VBox/ValidationKit/utils/cpu/cidet.h           |  1080 +
 src/VBox/ValidationKit/utils/cpu/cidet.mac         |    65 +
 .../ValidationKit/utils/cpu/cpu-alloc-all-mem.cpp  |   213 +
 src/VBox/ValidationKit/utils/cpu/cpu-numa.cpp      |   195 +
 .../ValidationKit/utils/cpu/exceptionsR3-asm.asm   |   150 +
 src/VBox/ValidationKit/utils/cpu/exceptionsR3.cpp  |   262 +
 src/VBox/ValidationKit/utils/cpu/rdtsc.cpp         |    77 +
 src/VBox/ValidationKit/utils/cpu/xmmsaving-asm.asm |   153 +
 src/VBox/ValidationKit/utils/cpu/xmmsaving.cpp     |   120 +
 src/VBox/ValidationKit/utils/misc/Makefile.kmk     |    48 +
 .../ValidationKit/utils/misc/loadgenerator.cpp     |   380 +
 .../ValidationKit/utils/misc/loadgeneratorR0.cpp   |    91 +
 src/VBox/ValidationKit/utils/misc/vts_rm.cpp       |    44 +
 src/VBox/ValidationKit/utils/misc/vts_tar.cpp      |    44 +
 src/VBox/ValidationKit/utils/network/Makefile.kmk  |    39 +
 src/VBox/ValidationKit/utils/network/NetPerf.cpp   |  1922 ++
 src/VBox/ValidationKit/utils/nt/Makefile.kmk       |    45 +
 src/VBox/ValidationKit/utils/nt/ntsetfreq.cpp      |   158 +
 src/VBox/ValidationKit/utils/nt/nttimesources.cpp  |   234 +
 src/VBox/ValidationKit/utils/usb/Makefile.kmk      |    39 +
 src/VBox/ValidationKit/utils/usb/UsbTest.cpp       |   371 +
 src/VBox/ValidationKit/vms/nt4sp1.txt              |    26 +
 src/VBox/ValidationKit/vms/sol11u1.txt             |    25 +
 src/VBox/ValidationKit/vms/xppro.txt               |    50 +
 src/bldprogs/VBoxCPP.cpp                           |     2 +-
 src/bldprogs/VBoxDef2LazyLoad.cpp                  |     2 +-
 src/bldprogs/VBoxTpG.cpp                           |    17 +-
 src/bldprogs/scm.cpp                               |     2 +-
 src/libs/Makefile.kmk                              |     6 +-
 src/libs/xpcom18a4/Config.kmk                      |     4 +-
 src/libs/xpcom18a4/Makefile.kmk                    |    15 +-
 .../extensions/dconnect/src/ipcDConnectService.h   |     4 +
 src/libs/xpcom18a4/java/tools/genjifaces.xsl       |    39 +-
 src/libs/xpcom18a4/nsprpub/pr/include/md/_darwin.h |     7 +
 src/libs/xpcom18a4/nsprpub/pr/include/md/_vbox.cfg |     2 +-
 src/libs/xpcom18a4/nsprpub/pr/src/misc/prnetdb.c   |     4 +-
 src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c  |     4 +
 src/libs/xpcom18a4/python/Makefile.kmk             |     8 +-
 src/libs/xpcom18a4/python/src/PyISupports.cpp      |    12 +-
 src/libs/xpcom18a4/python/src/PyXPCOM.h            |     2 +-
 .../xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp     |     2 +-
 .../xpcom/components/nsIServiceManagerUtils.h      |     2 +
 src/libs/xpcom18a4/xpcom/ds/nsCheapSets.h          |     2 +-
 src/libs/xpcom18a4/xpcom/ds/pldhash.c              |     2 +-
 src/libs/xpcom18a4/xpcom/io/nsFastLoadService.cpp  |     4 +-
 .../xpcom18a4/xpcom/proxy/public/nsProxyRelease.h  |     2 +-
 .../xpcom/reflect/xptcall/public/xptcall.h         |     5 +
 src/libs/xpcom18a4/xpcom/tests/TestThreads.cpp     |     2 +-
 src/libs/xpcom18a4/xpcom/typelib/xpt/src/xpt_xdr.c |    12 +-
 src/recompiler/Makefile.kmk                        |     7 +-
 src/recompiler/VBoxREM.rc                          |    25 +-
 src/recompiler/VBoxREMWrapper.cpp                  |    46 +-
 src/recompiler/VBoxRecompiler.c                    |   315 +-
 src/recompiler/target-i386/cpu.h                   |     5 +-
 src/recompiler/target-i386/exec.h                  |    28 +-
 src/recompiler/target-i386/op_helper.c             |     2 +-
 src/recompiler/tcg/tcg.c                           |     2 +-
 5916 files changed, 609887 insertions(+), 197659 deletions(-)

diff --git a/.scm-settings b/.scm-settings
index 489e991..c688df3 100644
--- a/.scm-settings
+++ b/.scm-settings
@@ -53,18 +53,23 @@
 --filter-out-dirs  "*/src/VBox/Additions/WINNT/Graphics/Wine/."
 --filter-out-dirs  "*/src/VBox/Additions/WINNT/Network/freebsd/."
 --filter-out-dirs  "*/src/VBox/Additions/WINNT/i8042prt/include/."
+--filter-out-dirs  "*/src/VBox/Additions/WINNT/Graphics/Wine*/."
 --filter-out-dirs  "*/src/VBox/Additions/common/crOpenGL/."
 --filter-out-dirs  "*/src/VBox/Additions/solaris/DRM/include/."
 --filter-out-dirs  "*/src/VBox/Additions/solaris/SharedFolders/solaris10/sys/."
+--filter-out-dirs  "*/src/VBox/Additions/linux/lightdm-greeter/*/."
 --filter-out-dirs  "*/src/VBox/HostServices/SharedOpenGL/."
 --filter-out-dirs  "*/src/VBox/HostDrivers/VBoxNetFlt/solaris/include/."
 --filter-out-dirs  "*/src/VBox/HostDrivers/VBoxUSB/solaris/include/."
 --filter-out-dirs  "*/src/VBox/GuestHost/OpenGL/*/."
---filter-out-dirs  "*/src/VBox/Devices/PC/Etherboot-src/*/."
---filter-out-dirs  "*/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Include/*/."
---filter-out-dirs  "*/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxIdeBusDxe/."
---filter-out-dirs  "*/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxIdeControllerDxe/."
---filter-out-dirs  "*/src/VBox/Devices/Network/lwip/."
+--filter-out-dirs  "*/src/VBox/Devices/Graphics/shaderlib*/."
+--filter-out-dirs  "*/src/VBox/Devices/Graphics/vmsvga/."
+--filter-out-dirs  "*/src/VBox/Devices/Graphics/vmsvga_glext/."
+--filter-out-dirs  "*/src/VBox/Devices/PC/ipxe/*/."
+--filter-out-dirs  "*/src/VBox/Devices/EFI/Firmware*/."
+--filter-out-dirs  "*/src/VBox/Devices/Network/lwip*/src*/."
+--filter-out-dirs  "*/src/VBox/Devices/Network/lwip*/doc*/."
+--filter-out-dirs  "*/src/VBox/Devices/Network/lwip*/test*/."
 --filter-out-dirs  "*/src/VBox/Storage/VDFormats/StorageCraft/*/."
 --filter-out-dirs  "*/src/VBox/RDP/client/."
 --filter-out-dirs  "*/src/recompiler/tests/."
@@ -79,7 +84,6 @@
 --filter-out-files "*/include/VBox/HostServices/glext.h"
 --filter-out-files "*/include/VBox/HostServices/glxext.h"
 --filter-out-files "*/include/VBox/HostServices/wglext.h"
---filter-out-files "*/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxFsDxe/fsw_strfunc.h"
 --filter-out-files "*/src/VBox/Devices/Audio/sys-queue.h"
 --filter-out-files "*/src/VBox/HostDrivers/VBoxUSB/os2/usbcalls.h"
 --filter-out-files "*/src/VBox/RDP/x11server/Init*.c"
diff --git a/Config.kmk b/Config.kmk
index 2d4fa50..8032eef 100644
--- a/Config.kmk
+++ b/Config.kmk
@@ -7,7 +7,7 @@
 #
 
 #
-# Copyright (C) 2006-2014 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -60,7 +60,7 @@ PROPS_DLLS_ACCUMULATE_L      += INTERMEDIATES
 PROPS_SYSMODS_ACCUMULATE_L   += INTERMEDIATES
 PROPS_MISCBINS_ACCUMULATE_L  += INTERMEDIATES
 
-# Misc names used bye the install paths below.
+# Misc names used by the install paths below.
 VBOX_PUEL_MANGLED_NAME := Oracle_VM_VirtualBox_Extension_Pack
 
 # Install paths
@@ -137,7 +137,7 @@ else
 endif
 
 
-INST_TESTSUITE        = testsuite/
+INST_VALIDATIONKIT    = validationkit/
 INST_TESTBOXSCRIPT    = testboxscript/
 
 INST_DOC              = doc/
@@ -148,7 +148,7 @@ INST_PACKAGES         = packages/
 
 VBOX_PATH_SDK         = $(patsubst %/,%,$(PATH_STAGE)/$(INST_SDK))
 VBOX_PATH_DIST        = $(patsubst %/,%,$(PATH_STAGE)/$(INST_DIST))
-VBOX_PATH_TESTSUITE   = $(patsubst %/,%,$(PATH_STAGE)/$(INST_TESTSUITE))
+VBOX_PATH_VALIDATIONKIT = $(patsubst %/,%,$(PATH_STAGE)/$(INST_VALIDATIONKIT))
 VBOX_PATH_ADDITIONS   = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS))
 VBOX_PATH_ADDITIONS_ISO = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS_ISO))
 VBOX_PATH_ADDITIONS_LIB = $(patsubst %/,%,$(PATH_STAGE)/$(INST_ADDITIONS_LIB))
@@ -202,13 +202,13 @@ endif
 #
 
 # Major version.
-VBOX_VERSION_MAJOR = 4
+VBOX_VERSION_MAJOR = 5
 # Minor version.
-VBOX_VERSION_MINOR = 3
+VBOX_VERSION_MINOR = 0
 # This is the current build number. It should be increased every time we publish a
 # new build. The define is available in every source file. Only even build numbers
 # will be published, odd numbers are set during development.
-VBOX_VERSION_BUILD = 28
+VBOX_VERSION_BUILD = 0
 # The raw version string. This *must not* contain any other information/fields than
 # major, minor and build revision (as it is now) -- also will be used for host/guest version
 # comparison.
@@ -220,7 +220,9 @@ VBOX_BUILD_PUBLISHER =
 # Note! The BETA[n],ALPHA[n],RC[n] indicators should be inserted before the
 #       publisher so that RTStrVersionCompare have a chance of comparing
 #       prerelease from different publishers correctly.
-VBOX_VERSION_STRING = $(VBOX_VERSION_STRING_RAW)$(VBOX_BUILD_PUBLISHER)
+VBOX_VERSION_STRING = $(VBOX_VERSION_STRING_RAW)_BETA4$(VBOX_BUILD_PUBLISHER)
+# Just the BETA[n],ALPHA[n],RC[n] indicators. Set to empty string for release.
+VBOX_VERSION_PRERELEASE = BETA4
 
 # Force the additions.sh script to get an exact additions build when we're doing the release.
 ifeq ($(int-mod $(VBOX_VERSION_BUILD),2),0)
@@ -381,13 +383,8 @@ VBOX_WITH_PREALLOC_RAM_BY_DEFAULT =
 VBOX_WITH_DEBUGGER = 1
 # Enable the debugger GUI.
 VBOX_WITH_DEBUGGER_GUI = 1
-# Enable the PDM Lock and let I/O threads call into the PICs.
-# TODO: Eliminate VBOX_WITH_PDM_LOCK.
-VBOX_WITH_PDM_LOCK = 1
 # Enables the first step using IEM (the interpreter).
 VBOX_WITH_FIRST_IEM_STEP = 1
-# Enables the new MSR code.
-VBOX_WITH_NEW_MSR_CODE = 1
 ## @}
 
 
@@ -407,8 +404,6 @@ VBOX_WITH_EHCI = 1
 VBOX_WITH_ISCSI = 1
 # Enable INIP support in the ISCSI feature.
 VBOX_WITH_INIP = 1
-# Enable new (pre-1.5.0 release) version of LWIP.
-VBOX_WITH_NEW_LWIP = 1
 # Enables lwip as a core of NAT service
 VBOX_WITH_LWIP_NAT = 1
 # Enables compilation of NAT service
@@ -417,12 +412,16 @@ VBOX_WITH_NAT_SERVICE = 1
 VBOX_WITH_E1000 = 1
 # Enable the Virtio feature.
 VBOX_WITH_VIRTIO = 1
+# Enable new PS/2 mouse emulation.
+VBOX_WITH_NEW_PS2M = 1
 # Enable ALSA support for Linux.
 VBOX_WITH_ALSA = 1
 # Enable Pulse support for Linux.
 VBOX_WITH_PULSE = 1
 # Enable PCI passthrough support.
 VBOX_WITH_PCI_PASSTHROUGH = 1
+# Enable PDM based audio driver
+VBOX_WITH_PDM_AUDIO_DRIVER  = 1
 # Enable statically linked dbus support.
 if1of ($(KBUILD_TARGET), linux solaris)
  VBOX_WITH_DBUS = 1
@@ -481,6 +480,7 @@ VBOX_WITH_PDM_ASYNC_COMPLETION = 1
 VBOX_WITH_NEW_USB_CODE_ON_DARWIN = 1
 ifdef VBOX_WITH_USB
  VBOX_WITH_VUSB = 1
+ VBOX_WITH_XHCI_IMPL=1
 endif
 ifdef VBOX_WITH_EHCI
  VBOX_WITH_EHCI_IMPL = 1
@@ -528,6 +528,11 @@ VBOX_WITH_PLUGIN_CRYPT = 1
 VBOX_WITH_VIRTUALKD = 1
 ## @}
 
+# legacy
+ifdef VBOX_ONLY_TESTSUITE
+ $(warning VBOX_ONLY_TESTSUITE was renamed to VBOX_ONLY_VALIDATIONKIT)
+ VBOX_ONLY_VALIDATIONKIT = $(VBOX_ONLY_TESTSUITE)
+endif
 
 ## @name Other Component
 ## @{
@@ -539,7 +544,7 @@ VBOX_WITH_VBOXDRV = 1
 VBOX_WITH_MAIN = 1
 # Whether to also ship 32-bit main API on 64-bit systems.
 if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), solaris.amd64 win.amd64)
- if !defined(VBOX_ONLY_TESTSUITE) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_DOCS)
+ if !defined(VBOX_ONLY_VALIDATIONKIT) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_DOCS)
   VBOX_WITH_32_ON_64_MAIN_API = 1
  endif
 endif
@@ -579,8 +584,12 @@ VBOX_WITH_VRDP_AUTHMOD = 1
 VBOX_WITH_VRDP_RDESKTOP = 1
 ## The Direct Framebuffer GUI.
 #VBOX_WITH_VBOXFB = 1
-# Enables the Python<->XPCOM and Python<->COM bindings.
+# Enables the Python<->XPCOM, Python<->COM and (WS enabled) Python<->WS bindings.
 VBOX_WITH_PYTHON ?= 1
+# Enables the PERL<->WS binding (if WS enabled).
+#VBOX_WITH_PERL ?= 1
+# Enables the PHP<->WS binding (if WS enabled).
+VBOX_WITH_PHP ?= 1
 if1of ($(KBUILD_TARGET), darwin linux solaris)
  # Enable Java<->XPCOM bridge + glue code
  VBOX_WITH_JXPCOM ?= 1
@@ -599,8 +608,8 @@ VBOX_WITH_JAVA_SUPPORT_IN_XPIDL ?=
 VBOX_WITH_MULTIVERSION_PYTHON ?= 1
 # Enable the kchmviewer.
 VBOX_WITH_KCHMVIEWER = 1
-# Build the testsuite.
-VBOX_WITH_TESTSUITE = 1
+# Build the Validation Kit.
+VBOX_WITH_VALIDATIONKIT = 1
 # Build the testcases.
 VBOX_WITH_TESTCASES = 1
 # Enable this to build vditool even if VBOX_WITH_TESTCASES is disabled
@@ -636,12 +645,9 @@ VBOX_WITH_S3 = 1
 # Enable Host=>Guest Drag'n'Drop
 if1of ($(KBUILD_TARGET), darwin linux solaris win)
  VBOX_WITH_DRAG_AND_DROP = 1
- # Guest=>Host drag'n'drop doesn't work
- #VBOX_WITH_DRAG_AND_DROP_GH = 1
-endif
-# Enable support for VRDP redirection of Windows Media Player content
-ifeq ($(KBUILD_TARGET),win)
- VBOX_WITH_MMR = 1
+ if1of ($(KBUILD_TARGET), linux solaris win)
+  VBOX_WITH_DRAG_AND_DROP_GH = 1
+ endif
 endif
 # Enables use of merge modules in the windows installer. This will increase
 # the overall installer size significantly because merge modules are not able
@@ -687,6 +693,8 @@ VBOX_WITH_EXTPACK_PUEL_BUILD = 1
 #VBOX_WITH_EXTPACK_BUSMOUSESAMPLE = 1
 # Enable the VNC server extension pack (GPL only).
 #VBOX_WITH_EXTPACK_VNC = 1
+# Enables the VBoxDTrace extension pack.
+VBOX_WITH_EXTPACK_VBOXDTRACE = 1
 ## @}
 
 ## @name Misc
@@ -703,6 +711,7 @@ VBOX_WITH_ALL_DOXYGEN_TARGETS = 1
 # Set this to enable user mode dtrace probes.
 if1of ($(KBUILD_TARGET), darwin linux solaris)
  VBOX_WITH_DTRACE_R3 = 1
+ VBOX_WITH_DTRACE_R3_MAIN = 1
 endif
 # Set this to enable kernel driver dtrace probes.
 if1of ($(KBUILD_TARGET), darwin solaris)
@@ -719,7 +728,7 @@ endif
 # Set this to enable support for dtrace probes in guest code.
 #VBOX_WITH_DTRACE_GST = 1
 # Set this to indicate that the host ships with DTrace.
-if1of ($(KBUILD_TARGET), darwin solaris freebsd)
+if1of ($(KBUILD_TARGET), darwin solaris)
  VBOX_WITH_NATIVE_DTRACE = 1
 endif
 ## @}
@@ -753,7 +762,7 @@ ifdef VBOX_WITH_HARDENING
  else ifeq ($(KBUILD_TARGET),freebsd)
   VBOX_PATH_APP_PRIVATE      = /usr/local/lib/virtualbox
  else ifeq ($(KBUILD_TARGET),haiku)
-  VBOX_PATH_APP_PRIVATE      = /boot/apps/VirtualBox
+  VBOX_PATH_APP_PRIVATE      = /boot/system/apps/VirtualBox
  endif
 endif
 # Where the architecture specific application files are (going to be) installed.
@@ -850,7 +859,9 @@ VBOX_BRAND_LICENSE_RTF               := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
 VBOX_BRAND_LICENSE_TXT               := $(PATH_ROOT)/doc/License-gpl-2.0.txt
 VBOX_BRAND_LICENSE_VER               :=
 VBOX_BRAND_GUI_ABOUT_PNG             := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about.png
+VBOX_BRAND_GUI_ABOUT_HIDPI_PNG       := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/hidpi/NonOSE/about_hidpi.png
 VBOX_BRAND_GUI_ABOUT_16PX_PNG        := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/about_16px.png
+VBOX_BRAND_GUI_ABOUT_16PX_HIDPI_PNG  := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/hidpi/NonOSE/about_16px_hidpi.png
 VBOX_BRAND_GUI_VBOX_16PX_PNG         := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_16px.png
 VBOX_BRAND_GUI_VBOX_20PX_PNG         := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_20px.png
 VBOX_BRAND_GUI_VBOX_32PX_PNG         := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/NonOSE/VirtualBox_32px.png
@@ -880,7 +891,7 @@ endif
 # VBOX_QUICK can be used by core developers to speed to the build
 ifdef VBOX_QUICK
  # undefine variables by assigning blank.
- VBOX_WITH_TESTSUITE=
+ VBOX_WITH_VALIDATIONKIT=
  VBOX_WITH_TESTCASES=
  VBOX_WITH_MAIN =
  VBOX_WITH_VBOXSDL =
@@ -934,7 +945,7 @@ ifeq ($(KBUILD_TARGET),os2)
  VBOX_WITH_SECURELABEL=
  VBOX_WITH_VRDP_AUTHMOD=
  VBOX_WITH_VRDP_RDESKTOP=
- VBOX_WITH_TESTSUITE=
+ VBOX_WITH_VALIDATIONKIT=
  VBOX_WITH_QTGUI=
  VBOX_WITH_USB=
  VBOX_WITH_EHCI=
@@ -974,7 +985,7 @@ ifn1of ($(KBUILD_TARGET_ARCH), x86 amd64)
  VBOX_WITH_QTGUI=
  VBOX_WITH_RAW_MODE=
  VBOX_WITH_SECURELABEL=
- VBOX_WITH_TESTSUITE=
+ VBOX_WITH_VALIDATIONKIT=
  VBOX_WITH_USB=
  VBOX_WITH_VBOXDRV=
  VBOX_WITH_VBOXSDL=
@@ -1031,7 +1042,7 @@ endif
 #
 # Indicate VBOX_ONLY build if any of the VBOX_ONLY_* variables are set.
 #
-VBOX_ONLY_BUILD := $(strip $(foreach x, ADDITIONS DOCS EXTPACKS SDK TESTSUITE\
+VBOX_ONLY_BUILD := $(strip $(foreach x, ADDITIONS DOCS EXTPACKS SDK VALIDATIONKIT\
 	, $(if-expr defined(VBOX_ONLY_$(x)),VBOX_ONLY_$(x))))
 if $(words $(VBOX_ONLY_BUILD)) > 1
  $(error VBox: More than one VBOX_ONLY build enabled! $(VBOX_ONLY_BUILD))
@@ -1050,6 +1061,7 @@ endif
 ifdef VBOX_OSE
  VBOX_WITH_VRDP=
  VBOX_WITH_EHCI_IMPL=
+ VBOX_WITH_XHCI_IMPL=
  VBOX_WITH_USB_VIDEO_IMPL=
  VBOX_WITH_EXTPACK_PUEL=
  VBOX_WITH_EXTPACK_PUEL_BUILD=
@@ -1069,7 +1081,6 @@ ifdef VBOX_OSE
  ifndef ($(VBOX_NO_DOCS_TRANSLATIONS))
   VBOX_WITH_DOCS_TRANSLATIONS = 1
  endif
- VBOX_WITH_TESTSUITE=
  VBOX_WITH_INTEL_PXE=
  # Disable for OSE, requires snv_159+.
  VBOX_WITH_NETFLT_CROSSBOW=
@@ -1081,20 +1092,22 @@ ifdef VBOX_OSE
  endif
  VBOX_GUI_WITH_HIDPI=
  # branding
- VBOX_BRAND_LICENSE_HTML       := $(PATH_ROOT)/doc/License-gpl-2.0.html
- VBOX_BRAND_LICENSE_RTF        := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
- VBOX_BRAND_LICENSE_TXT        := $(PATH_ROOT)/doc/License-gpl-2.0.txt
- VBOX_BRAND_BIOS_LOGO          := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/ose_logo.bmp
- VBOX_BRAND_GUI_ABOUT_PNG      := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about.png
- VBOX_BRAND_GUI_ABOUT_16PX_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px.png
- VBOX_BRAND_GUI_VBOX_16PX_PNG  := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_16px.png
- VBOX_BRAND_GUI_VBOX_20PX_PNG  := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_20px.png
- VBOX_BRAND_GUI_VBOX_32PX_PNG  := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_32px.png
- VBOX_BRAND_GUI_VBOX_40PX_PNG  := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_40px.png
- VBOX_BRAND_GUI_VBOX_48PX_PNG  := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_48px.png
- VBOX_BRAND_GUI_VBOX_64PX_PNG  := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_64px.png
- VBOX_BRAND_GUI_CUBE_42PX_PNG  := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_cube_42px.png
- VBOX_BRAND_GUI_VBOX_SVG       := $(PATH_ROOT)/src/VBox/Resources/OSE/virtualbox.svg
+ VBOX_BRAND_LICENSE_HTML             := $(PATH_ROOT)/doc/License-gpl-2.0.html
+ VBOX_BRAND_LICENSE_RTF              := $(PATH_ROOT)/doc/License-gpl-2.0.rtf
+ VBOX_BRAND_LICENSE_TXT              := $(PATH_ROOT)/doc/License-gpl-2.0.txt
+ VBOX_BRAND_BIOS_LOGO                := $(PATH_ROOT)/src/VBox/Devices/Graphics/BIOS/ose_logo.bmp
+ VBOX_BRAND_GUI_ABOUT_PNG            := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about.png
+ VBOX_BRAND_GUI_ABOUT_HIDPI_PNG      := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about.png
+ VBOX_BRAND_GUI_ABOUT_16PX_PNG       := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px.png
+ VBOX_BRAND_GUI_ABOUT_16PX_HIDPI_PNG := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/about_16px.png
+ VBOX_BRAND_GUI_VBOX_16PX_PNG        := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_16px.png
+ VBOX_BRAND_GUI_VBOX_20PX_PNG        := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_20px.png
+ VBOX_BRAND_GUI_VBOX_32PX_PNG        := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_32px.png
+ VBOX_BRAND_GUI_VBOX_40PX_PNG        := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_40px.png
+ VBOX_BRAND_GUI_VBOX_48PX_PNG        := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_48px.png
+ VBOX_BRAND_GUI_VBOX_64PX_PNG        := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_64px.png
+ VBOX_BRAND_GUI_CUBE_42PX_PNG        := $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/OSE/VirtualBox_cube_42px.png
+ VBOX_BRAND_GUI_VBOX_SVG             := $(PATH_ROOT)/src/VBox/Resources/OSE/virtualbox.svg
 endif
 
 #
@@ -1194,6 +1207,11 @@ ifdef VBOX_WITH_EXTPACK_PUEL_BUILD
  VBOX_WITH_EXTPACK_PUEL = 1
 endif
 
+ifdef VBOX_WITH_TESTSUITE
+ $(warning VBOX_WITH_TESTSUITE was renamed to VBOX_WITH_VALIDATIONKIT)
+ VBOX_WITH_VALIDATIONKIT = $(VBOX_WITH_TESTSUITE)
+endif
+
 #
 # Mark OSE builds clearly, helps figuring out limitations more easily.
 #
@@ -1227,6 +1245,11 @@ else
  VBOX_GUI_USE_QGL=
 endif
 
+# Collection macro mainly for deciding whether VBoxDTrace needs shipping.
+VBOX_WITH_DTRACE := $(if-expr defined(VBOX_WITH_DTRACE_R0) || defined(VBOX_WITH_DTRACE_R0DRV) \
+	       	            || defined(VBOX_WITH_DTRACE_R3) || defined(VBOX_WITH_DTRACE_RC),1,)
+
+
 #
 # Image and object format config.
 #
@@ -1397,14 +1420,6 @@ ifndef VBOX_VCC_TOOL
  VBOX_VCC_TOOL := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_TARGET_ARCH))
 endif
 
-#
-# The kBuild tools and SDKs are using PATH_DEVTOOLS, PATH_DEVTOOLS_BLD
-# and PATH_DEVTOOLS_TRG to find things if we give them specific locations.
-#
-PATH_DEVTOOLS ?= $(PATH_ROOT)/tools
-PATH_DEVTOOLS := $(abspath $(PATH_DEVTOOLS))
-PATH_DEVTOOLS_BLD ?= $(PATH_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
-PATH_DEVTOOLS_TRG ?= $(PATH_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
 
 ## @todo Remove the default tool crap here!
 TOOL = $(VBOX_GCC_TOOL)
@@ -1412,6 +1427,7 @@ TOOL.win.x86 = $(VBOX_VCC_TOOL_STEM)X86
 TOOL.win.amd64 = $(VBOX_VCC_TOOL_STEM)AMD64
 ASTOOL = $(VBOX_ASTOOL)
 
+
 #
 # Setup the global defines and includes.
 #
@@ -1493,7 +1509,7 @@ USES += dtrace
 #
 # Compiler optimization flags.
 #
-VBOX_GCC_WARN     ?= -Wall $(VBOX_GCC_Wextra) $(VBOX_GCC_Wno-missing-field-initializers) -Wno-unused -Wno-trigraphs $(VBOX_GCC_fdiagnostics-show-option) $(VBOX_GCC_Wno-unused-parameter)
+VBOX_GCC_WARN     ?= -Wall $(VBOX_GCC_Wextra) $(VBOX_GCC_Wno-missing-field-initializers) -Wno-unused -Wno-trigraphs $(VBOX_GCC_fdiagnostics-show-option) $(VBOX_GCC_Wno-unused-parameter) $(VBOX_GCC_Wlogical-op)
 VBOX_GCC_WARN_PEDANTIC = -Wshadow $(VBOX_GCC_WARN) -Wno-long-long
 ifdef VBOX_WITH_MASOCHISTIC_WARNINGS
  VBOX_GCC_WARN_PEDANTIC += -Wunused-variable -Wunused-function -Wunused-label -Wunused-parameter
@@ -1709,7 +1725,7 @@ endif
 # Python
 ifndef VBOX_BLD_PYTHON
  if1of ($(KBUILD_HOST), win)
-  VBOX_BLD_PYTHON := $(firstword $(rsort $(wildcard $(PATH_DEVTOOLS)/win.x86/python/v*/python$(HOSTSUFF_EXE))) \
+  VBOX_BLD_PYTHON := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/python/v*/python$(HOSTSUFF_EXE))) \
   				   python-not-found.exe)
  else
   VBOX_BLD_PYTHON := $(firstword $(which python$(HOSTSUFF_EXE)) $(which python2.7$(HOSTSUFF_EXE)) \
@@ -1735,7 +1751,7 @@ endif
 #
 # Note! Users of older pylint release (< 1.0) needs to define
 #       VBOX_WITH_PYLINT_PRE_V1_0 in LocalConfig because they changed the
-#	 output arguments in an backwards incompatible way and added more
+#       output arguments in an backwards incompatible way and added more
 #       attribute regex options.
 #
 ifndef VBOX_PYLINT
@@ -1749,10 +1765,10 @@ if !defined(VBOX_WITH_PYLINT) && defined(VBOX_PYLINT)
 endif
 VBOX_PYLINT_FLAGS   := --report=n \
 	$(if-expr !defined(VBOX_WITH_PYLINT_PRE_V1_0)\
-	  ,--msg-template='{path}:{line}: {msg_id}({obj}:{symbol}): {msg}' \
+	  ,--msg-template='{path}:{line}: <{msg_id}>({obj}:{symbol}): {msg}' \
 	  ,--output-format=msvs --include-ids=y) \
 	--persistent=n \
-	--rcfile=$(if-expr "$(KBUILD_HOST)" == "win",nul,/dev/null) \
+	--rcfile=$(PATH_ROOT)/tools/pylintrc \
 	--max-line-length=130 \
 	--max-attributes=20 \
 	--max-branch$(if-expr !defined(VBOX_WITH_PYLINT_PRE_V1_0),e,)s=50 \
@@ -1765,14 +1781,16 @@ VBOX_PYLINT_FLAGS   := --report=n \
        --min-public-methods=0 \
 	--function-rgx='[a-z_][a-zA-Z0-9_]{2,40}$(DOLLAR)' \
 	--method-rgx='[a-z_][a-zA-Z0-9_]{2,40}$(DOLLAR)' \
-	--argument-rgx='([a-z_][a-zA-Z0-9_]{2,30}|rc|hr|s|c|cx|cy|cb|fn)$(DOLLAR)' \
-	--variable-rgx='([a-z_][a-zA-Z0-9_]{2,30}|rc|hr|s|c|cx|cy|cb|fn)$(DOLLAR)' \
+	--argument-rgx='([a-z_][a-zA-Z0-9_]{2,30}|rc|hr|s|c|ch|cx|cy|cb|fn)$(DOLLAR)' \
+	--variable-rgx='([a-z_][a-zA-Z0-9_]{2,30}|rc|hr|s|c|ch|cx|cy|cb|fn)$(DOLLAR)' \
 	--attr-rgx='([a-z_][a-zA-Z0-9_]{2,30}|rc|hr|o)$(DOLLAR)' \
 	--module-rgx='(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(td[A-Z][a-zA-Z0-9]+)|(t(e|)st(-|)[a-zA-Z0-9]+))$(DOLLAR)' \
 	--class-rgx='(td|)[A-Z_][a-zA-Z0-9_]+$(DOLLAR)' \
 	--const-rgx='(g_(k|)[abcdefhmnpilorstu]+[A-Z][a-zA-Z0-9]+|[A-Z_][A-Z0-9_]+|__copyright__|__version__|__file__|__all__)$(DOLLAR)' \
-	--good-names='i,j,k,t,o,c,e,_' \
+	--good-names='i,j,k,t,o,c,e,ch,s,_' \
 	$(if-expr !defined(VBOX_WITH_PYLINT_PRE_V1_0),--class-attribute-rgx='(k[abcdefhmnpilorstu]+[A-Z0-9][a-zA-Z0-9_]{0,32}|[A-Z_][A-Z0-9_]{2,32})',) \
+       $(if-expr defined(VBOX_WITH_PYLINT_V1_1_PLUS) || defined(VBOX_WITH_PYLINT_V1_2_1_PLUS),--disable=C0326,) \
+       $(if-expr defined(VBOX_WITH_PYLINT_V1_2_1_PLUS),--disable=C0330 --disable=W0123,) \
 	--disable=W0301,W0511,W0603,W0702,W0703,C0321,R0201,I0011 \
 	--ignored-classes=testdriver.vboxcon \
 
@@ -1801,7 +1819,7 @@ LIB_PTHREAD      ?= pthread
 # Xcursor (consider an SDK for this).
 ifeq ($(VBOX_XCURSOR_LIBS),)
  ifeq ($(KBUILD_TARGET),solaris)
-  VBOX_XCURSOR_LIBS := $(lastword $(wildcard $(PATH_DEVTOOLS_TRG)/libXcursor/*/lib/libXcursor.a))
+  VBOX_XCURSOR_LIBS := $(lastword $(wildcard $(KBUILD_DEVTOOLS_TRG)/libXcursor/*/lib/libXcursor.a))
   ifneq ($(VBOX_XCURSOR_LIBS),)
    VBOX_XCURSOR_INCS := $(patsubst %/lib/libXcursor.a,%/include, $(VBOX_XCURSOR_LIBS))
    VBOX_XCURSOR_LIBS += X11 Xrender Xfixes
@@ -1814,18 +1832,22 @@ endif
 
 
 # Intel ASL compiler for ACPI
-VBOX_IASLCMD   ?= $(firstword $(wildcard $(PATH_DEVTOOLS_BLD)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
+VBOX_IASLCMD   ?= $(firstword $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/iasl$(HOSTSUFF_EXE)) iasl$(HOSTSUFF_EXE))
 
 # libxslt XSLT processor. (see PATH_TOOL_YASM for explanation why it's temporarily located in bin.)
-ifeq ($(KBUILD_HOST),win)
-# VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/win.x86/libxslt/10114/xsltproc.exe
- VBOX_XSLTPROC  ?= $(PATH_DEVTOOLS)/win.x86/bin/xsltproc.exe
-else ifeq ($(KBUILD_HOST),os2)
- VBOX_XSLTPROC  ?= BEGINLIBPATH="$(PATH_DEVTOOLS_BLD)/bin;$$BEGINLIBPATH" $(PATH_DEVTOOLS_BLD)/bin/xsltproc.exe
-else ifeq ($(KBUILD_HOST),haiku)
- VBOX_XSLTPROC ?= $(PATH_DEVTOOLS)/haiku.x86/bin/xsltproc
-else
- VBOX_XSLTPROC  ?= xsltproc$(HOSTSUFF_EXE)
+ifeq ($(VBOX_XSLTPROC),)
+ ifeq ($(KBUILD_HOST),win)
+   VBOX_XSLTPROC := $(wildcard $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)/libxslt/10128/bin/xsltproc.exe)
+   ifeq ($(VBOX_XSLTPROC),)
+    VBOX_XSLTPROC := $(KBUILD_DEVTOOLS)/win.x86/bin/xsltproc.exe
+   endif
+ else ifeq ($(KBUILD_HOST),os2)
+  VBOX_XSLTPROC  := BEGINLIBPATH="$(KBUILD_DEVTOOLS_HST)/bin;$$BEGINLIBPATH" $(KBUILD_DEVTOOLS_HST)/bin/xsltproc.exe
+ else ifeq ($(KBUILD_HOST),haiku)
+  VBOX_XSLTPROC  := $(KBUILD_DEVTOOLS)/haiku.x86/bin/xsltproc
+ else
+  VBOX_XSLTPROC  := xsltproc$(HOSTSUFF_EXE)
+ endif
 endif
 
 # bin2c (convert binary files into C arrays)
@@ -1873,48 +1895,56 @@ endif
 
 # mkisofs
 ifeq ($(KBUILD_HOST),win)
- VBOX_MKISOFS  ?= $(PATH_DEVTOOLS_BLD)/bin/mkisofs.exe
+ VBOX_MKISOFS  ?= $(KBUILD_DEVTOOLS_HST)/bin/mkisofs.exe
 else
  VBOX_MKISOFS  ?= mkisofs
 endif
 
+ifeq ($(KBUILD_HOST),win)
+ VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
+else
+ VBOX_NM ?= nm -p
+endif
+
 # Makeself for the linux installers.
-VBOX_MAKESELF  ?= $(PATH_DEVTOOLS)/common/makeself/v2.1.5/makeself.sh
+VBOX_MAKESELF  ?= $(KBUILD_DEVTOOLS)/common/makeself/v2.1.5/makeself.sh
 
 # Microsoft HTML Help Workshop.
-VBOX_PATH_HTML_HELP_WORKSHOP ?= $(PATH_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
+VBOX_PATH_HTML_HELP_WORKSHOP ?= $(KBUILD_DEVTOOLS)/win.x86/HTML_Help_Workshop/v1.3/
 
 # Path to the null soft installer.
-VBOX_PATH_NSIS ?= $(PATH_DEVTOOLS)/win.x86/nsis/v2.46-log-nsscm-r1
+VBOX_PATH_NSIS ?= $(KBUILD_DEVTOOLS)/win.x86/nsis/v2.46-log-nsscm-r1
 
 # Path to AutoIt3.
-VBOX_PATH_AUTOIT3 ?= $(PATH_DEVTOOLS)/win.x86/autoit/v3.2.10.0
+VBOX_PATH_AUTOIT3 ?= $(KBUILD_DEVTOOLS)/win.x86/autoit/v3.2.10.0
 
 # Windows install tools...
 # Note! The scripts has been moved to Bin in v8.0.
-VBOX_PATH_WIX       ?= $(PATH_DEVTOOLS)/win.x86/wix/v3.5.2519.0
-VBOX_PATH_MSITRAN   ?= $(PATH_DEVTOOLS)/win.x86/sdk/v7.1/Bin/MsiTran.Exe
-VBOX_PATH_MSIDB     ?= $(PATH_DEVTOOLS)/win.x86/sdk/v7.1/Bin/MsiDb.Exe
-VBOX_PATH_WISUBSTG  ?= $(PATH_DEVTOOLS)/win.x86/sdk/v7.1/Samples/sysmgmt/msi/scripts/WiSubStg.vbs
-VBOX_PATH_WISUMINFO ?= $(PATH_DEVTOOLS)/win.x86/sdk/v7.1/Samples/sysmgmt/msi/scripts/WiSumInf.vbs
-VBOX_PATH_DIFX      ?= $(PATH_DEVTOOLS)/win.$(KBUILD_TARGET_ARCH)/DIFx/v2.1-r3
-VBOX_PATH_CABSDK    ?= $(PATH_DEVTOOLS)/win.x86/cabsdk/r1
+VBOX_PATH_WIX       ?= $(KBUILD_DEVTOOLS)/win.x86/wix/v3.8.1128.0
+VBOX_PATH_MSITRAN   ?= $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Bin/MsiTran.Exe
+VBOX_PATH_MSIDB     ?= $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Bin/MsiDb.Exe
+VBOX_PATH_WISUBSTG  ?= $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Samples/sysmgmt/msi/scripts/WiSubStg.vbs
+VBOX_PATH_WISUMINFO ?= $(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Samples/sysmgmt/msi/scripts/WiSumInf.vbs
+VBOX_PATH_DIFX      ?= $(KBUILD_DEVTOOLS)/win.$(KBUILD_TARGET_ARCH)/DIFx/v2.1-r3
+VBOX_PATH_CABSDK    ?= $(KBUILD_DEVTOOLS)/win.x86/cabsdk/r1
 VBOX_PATH_MAKECAB   ?= $(VBOX_PATH_CABSDK)/BIN/MAKECAB.EXE
 
 # We need to export YASM for OSE, but since it was converted to .zip we need to
 # allow for the location used by the zip to be properly cleaned up first.
 if1of ($(KBUILD_HOST).$(KBUILD_HOST_ARCH), linux.x86 solaris.x86 win.x86)
- PATH_TOOL_YASM ?= $(PATH_DEVTOOLS_BLD)/bin
+ PATH_TOOL_YASM ?= $(KBUILD_DEVTOOLS_HST)/bin
 endif
 
 # The Microsoft IDL compiler (the SDK build needs this on non-Windows).
-VBOX_WIN_MIDL ?= $(EXEC_X86_WIN32) $(call VBOX_FN_MAKE_WIN_PATH,$(firstword $(wildcard \
-	$(PATH_SDK_$(VBOX_WINPSDK)_BIN)/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
-	$(PATH_SDK_$(VBOX_WINPSDK))/[Bb][Ii][Nn]/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
-	$(PATH_SDK_WINPSDK_BIN)/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
-	$(PATH_SDK_WINPSDK)/[Bb][Ii][Nn]/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
-	$(PATH_DEVTOOLS)/win.x86/bin/[Mm][Ii][Dd][Ll].[Ee][Xx][Ee]\
-	) Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK))
+VBOX_WIN_MIDL ?= $(EXEC_X86_WIN32) $(call VBOX_FN_MAKE_WIN_PATH,$(firstword $(wildcard $(addsuffix /[Mm][Ii][Dd][Ll].[Ee][Xx][Ee], \
+	$(KBUILD_DEVTOOLS)/win.x86/sdk/v7.1/Bin$(if-expr "$(KBUILD_HOST).$(KBUILD_HOST_ARCH)" == "win.amd64",/x64,) \
+	$(KBUILD_DEVTOOLS)/win.x86/ddk/7600.16385.1/bin/x86 \
+	$(KBUILD_DEVTOOLS)/win.x86/bin \
+	$(PATH_SDK_$(VBOX_WINPSDK)_BIN) \
+	$(PATH_SDK_$(VBOX_WINPSDK)) \
+	$(PATH_SDK_WINPSDK_BIN) \
+	$(PATH_SDK_WINPSDK) \
+	)) Sorry_Cannot_Find_The_Midl_Compiler_In_The_PSDK))
 
 # XPCOM setup for all but win32.
 ifneq ($(KBUILD_TARGET),win)
@@ -1926,12 +1956,12 @@ ifneq ($(KBUILD_TARGET),win)
  endif
  VBOX_PATH_XPCOM_IDL ?= $(VBOX_PATH_SDK)/bindings/xpcom/idl
  VBOX_XPCOM_INCS     ?=				\
-	$(VBOX_PATH_SDK)/bindings/xpcom/include	\
-	$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom	\
-	$(VBOX_PATH_SDK)/bindings/xpcom/include/string	\
-	$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom	\
-        $(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
-	$(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd
+ 	$(VBOX_PATH_SDK)/bindings/xpcom/include	\
+ 	$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom	\
+ 	$(VBOX_PATH_SDK)/bindings/xpcom/include/string	\
+ 	$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom	\
+ 	$(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
+ 	$(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd
  ifneq ($(KBUILD_TARGET),os2)
   # libIDL-config (for xpcom18a4)
   ifeq ($(origin VBOX_LIBIDL_CONFIG),undefined)
@@ -1960,9 +1990,22 @@ VBOX_GOOD_COMSPEC_BS ?= $(subst /,\,$(VBOX_GOOD_COMSPEC))
 # version is assumed to be the
 #
 ifeq ($(KBUILD_TARGET),darwin)
+ VBOX_DEF_MACOSX_VERSION_MIN ?= 10.6
+
+ # Check for the Xcode 4.1 bits in tools/darwin.x86.
+ if   !defined(VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL) \
+   && !defined(VBOX_XCODE_VERSION) \
+   && exists "$(KBUILD_DEVTOOLS)/darwin.x86/xcode/v4.1"
+  VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL := 1
+  VBOX_PATH_MACOSX_DEVEL_ROOT := $(KBUILD_DEVTOOLS)/darwin.x86/xcode/v4.1
+  VBOX_XCODE_VERSION := 4.1
+ endif
+
+ # Fallback - system / LocalConfig.kmk.
  VBOX_PATH_MACOSX_DEVEL_ROOT ?= /Developer
  VBOX_PATH_MACOSX_SDK_ROOT ?= $(VBOX_PATH_MACOSX_DEVEL_ROOT)/SDKs
 
+ # Figure the default SDK location and obsolete linker tricks.
  ifeq ($(VBOX_DEF_MACOSX_VERSION_MIN),10.4)
   ifeq ($(origin VBOX_DARWIN_CLASSIC_LINKER),undefined)
    VBOX_DARWIN_CLASSIC_LINKER := $(shell ld -v 2>&1 )
@@ -1998,7 +2041,6 @@ ifeq ($(KBUILD_TARGET),darwin)
  VBOX_XCODE_VERSION_MINOR := $(word 2, $(subst ., ,$(VBOX_XCODE_VERSION)))
  VBOX_XCODE_VERSION       := $(VBOX_XCODE_VERSION_MAJOR).$(VBOX_XCODE_VERSION_MINOR)
 
- VBOX_DEF_MACOSX_VERSION_MIN ?= 10.6
  ifeq ($(KBUILD_TARGET_ARCH),x86)
   if1of ($(VBOX_DEF_MACOSX_VERSION_MIN), 10.4 10.5)
    VBOX_DARWIN_NO_COMPACT_LINKEDIT ?= $(VBOX_LD_no_compact_linkedit)
@@ -2006,7 +2048,11 @@ ifeq ($(KBUILD_TARGET),darwin)
   endif
  else
   if $(VBOX_XCODE_VERSION_MAJOR) < 4 && "$(VBOX_XCODE_VERSION)" != "3.2"
-   $(error VBox: 64-bit darwin builds require Xcode 3.2 or later, you have $(VBOX_XCODE_VERSION))
+   ifeq ($(PATH_CURRENT),$(PATH_ROOT)/tools)
+    $(warning VBox: 64-bit darwin builds require Xcode 3.2 or later, you have $(VBOX_XCODE_VERSION))
+   else
+    $(error VBox: 64-bit darwin builds require Xcode 3.2 or later, you have $(VBOX_XCODE_VERSION))
+   endif
   endif
  endif
  if $(VBOX_XCODE_VERSION_MAJOR) == 4 && $(VBOX_XCODE_VERSION_MINOR) >= 2
@@ -2026,6 +2072,10 @@ ifeq ($(KBUILD_TARGET),darwin)
    SVN := $(firstword $(which svn) svn)
   endif
   export PATH:=$(VBOX_PATH_MACOSX_DEVEL_ROOT)/usr/bin/:$(PATH)
+  TOOL_GXX32_CC  = $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX) -m32
+  TOOL_GXX32_CXX = $(TOOL_GCC4MACHO_PREFIX)g++$(TOOL_GCC4MACHO_SUFFIX) -m32
+  TOOL_GXX32_LD  = $(TOOL_GXX32_CXX)
+  override TOOL_StandardDTrace_DTRACE := dtrace "-xcpppath=$(TOOL_GCC4MACHO_PREFIX)cpp-4.2"
  endif
  ## @todo WTF do we do the -m32/64 stuff here for these compilers? Also the visibility should be elsewhere...
  TOOL_GXX4MACHO_OBJC   = $(TOOL_GCC4MACHO_PREFIX)gcc$(TOOL_GCC4MACHO_SUFFIX) $(if-expr $(KBUILD_TARGET_ARCH) == "x86",-m32,-m64) -fvisibility=hidden
@@ -2090,7 +2140,7 @@ ifeq ($(KBUILD_TARGET),darwin)
    ifneq ($(wildcard $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.7.sdk),)
     VBOX_PATH_MACOSX_SDK_10_7           = $(VBOX_PATH_MACOSX_SDK_ROOT)/MacOSX10.7.sdk
    else
-    VBOX_PATH_MACOSX_SDK_10_7           = $(PATH_DEVTOOLS)/darwin.x86/SDKs/MacOSX10.7.sdk
+    VBOX_PATH_MACOSX_SDK_10_7           = $(KBUILD_DEVTOOLS)/darwin.x86/SDKs/MacOSX10.7.sdk
    endif
   endif
   VBOX_DARWIN_DEF_SDK_10_7_DEFS        := MAC_OS_X_VERSION_MIN_REQUIRED=1070 MAC_OS_X_VERSION_MAX_ALLOWED=1070
@@ -2145,8 +2195,8 @@ endif
 # VBOX_WITH_ORIGIN translates into VBOX_WITH_RELATIVE_RUNPATH.
 #
 # We use two helper variables for the VBOX_WITH_ORIGIN stuff:
-#	VBOX_ORIGIN - Indirect expansion trick.
-#	VBOX_GCC_RPATH_OPT - Different GCC/LD combinations needs different options.
+#   VBOX_ORIGIN - Indirect expansion trick.
+#   VBOX_GCC_RPATH_OPT - Different GCC/LD combinations needs different options.
 #
 VBOX_ORIGIN = $$ORIGIN
 ifeq ($(KBUILD_TARGET),solaris)
@@ -2232,9 +2282,9 @@ else
   VBOX_WINDOWS_ICON_FILE           ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-vista.ico
   VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-vista.ico
   VBOX_NSIS_ICON_FILE              ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-nsis.ico
-  TOOL_VCC80X86_RC    := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
-  TOOL_VCC80AMD64_RC  := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
-  TOOL_VCC70_RC       := $(PATH_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
+  TOOL_VCC80X86_RC    := $(KBUILD_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
+  TOOL_VCC80AMD64_RC  := $(KBUILD_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
+  TOOL_VCC70_RC       := $(KBUILD_DEVTOOLS)/win.x86/ddk/6000/bin/x86/rc.exe
  else
   VBOX_WINDOWS_ICON_FILE           ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBox-winxp.ico
   VBOX_WINDOWS_ADDITIONS_ICON_FILE ?= $(PATH_ROOT)/src/VBox/Artwork/VirtualBoxGA-winxp.ico
@@ -2367,7 +2417,11 @@ $(PATH_OUT)/DynamicConfig.kmk: \
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-array_bounds      ?= $(call VBOX_GCC_CHECK_CC,-Wno-array-bounds,)'
 # -Wextra produces additional useful warnings but includes -Wno-missing-field-initializers (too noisy)
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wextra                ?= $(call VBOX_GCC_CHECK_CC,-Wextra,)'
-	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wlogical-op           ?= $(call VBOX_GCC_CHECK_CC,-Wlogical-op,)'
+	$(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CC),)'
+	$(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CC),40500),)'
+	$(QUIET)$(APPEND) '$@' '  VBOX_GCC_Wlogical-op           ?= $(call VBOX_GCC_CHECK_CC,-Wlogical-op,)'
+	$(QUIET)$(APPEND) '$@' ' endif'
+	$(QUIET)$(APPEND) '$@' 'endif'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-address           ?= $(call VBOX_GCC_CHECK_CXX,-Wno-address,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-delete-non-virtual-dtor    ?= $(call VBOX_GCC_CHECK_CXX,-Wno-delete-non-virtual-dtor,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-int-to-pointer-cast        ?= $(call VBOX_GCC_CHECK_CC,-Wno-int-to-pointer-cast,)'
@@ -2376,6 +2430,7 @@ $(PATH_OUT)/DynamicConfig.kmk: \
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-pointer-to-int-cast        ?= $(call VBOX_GCC_CHECK_CC,-Wno-pointer-to-int-cast,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-variadic-macros   ?= $(call VBOX_GCC_CHECK_CXX,-Wno-variadic-macros,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-vla               ?= $(call VBOX_GCC_CHECK_CXX,-Wno-vla,)'
+	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_Wno-overlength-strings?= $(call VBOX_GCC_CHECK_CC,-Wno-overlength-strings,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_fno-stack-protector   ?= $(call VBOX_GCC_CHECK_CC,-fno-stack-protector,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_fno-dwarf2-cfi-asm    ?= $(call VBOX_GCC_CHECK_CC,-fno-dwarf2-cfi-asm,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_fdiagnostics-show-option ?= $(call VBOX_GCC_CHECK_CC,-fdiagnostics-show-option,)'
@@ -2407,6 +2462,14 @@ endif
 	$(QUIET)$(APPEND) '$@' '  VBOX_GCC_Wno-unused-parameter ?= -Wno-unused-parameter'
 	$(QUIET)$(APPEND) '$@' ' endif'
 	$(QUIET)$(APPEND) '$@' 'endif'
+# C++ Std settings
+	$(QUIET)$(APPEND) '$@' 'ifneq ($$(VBOX_GCC_VERSION_CXX),)'
+	$(QUIET)$(APPEND) '$@' ' ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40800),)'
+	$(QUIET)$(APPEND) '$@' '  VBOX_GCC_std ?= -std=c++11'
+	$(QUIET)$(APPEND) '$@' ' else ifneq ($$(int-ge $$(VBOX_GCC_VERSION_CXX),40600),)'
+	$(QUIET)$(APPEND) '$@' '  VBOX_GCC_std ?= -std=c++0x'
+	$(QUIET)$(APPEND) '$@' ' endif'
+	$(QUIET)$(APPEND) '$@' 'endif'
 ifeq ($(KBUILD_TARGET),solaris)
 	$(QUIET)$(APPEND) '$@' 'VBOX_GCC_msave-args            ?= $(call VBOX_GCC_CHECK_CXX,-msave-args,)'
 # Detect the solaris assembler. It is used by the the 4.x gcc compilers,
@@ -2460,6 +2523,8 @@ ifdef VBOX_PATH_PREFIX_MINGW64
 	$(QUIET)$(APPEND) '$@' 'VBOX_MINGW64_Wno-maybe-uninitialized     ?= $(call VBOX_GCC_CHECK_EX_CXX,$(VBOX_PATH_PREFIX_MINGW64)g++ -m64,-Wno-maybe-uninitialized,)'
 	$(QUIET)$(APPEND) '$@' 'VBOX_MINGW64_USER_LABEL_PREFIX           ?= $(shell echo "__USER_LABEL_PREFIX__" | $(VBOX_PATH_PREFIX_MINGW64)g++ -m64 -E -xc++ - | $(SED) -e "/^$(HASH)/d")'
 endif
+	$(QUIET)$(APPEND) '$@' 'VBOX_HAVE_FLEX  ?= $(if $(which flex),1,)'
+	$(QUIET)$(APPEND) '$@' 'VBOX_HAVE_BISON ?= $(if $(which bison),1,)'
 	$(QUIET)$(ECHO) '========= START OF $@ ========='
 	$(QUIET)$(CAT) $@
 	$(QUIET)$(ECHO) '=========== END OF $@ ========='
@@ -2584,7 +2649,21 @@ endef # VBOX_GENERATE_IMPORT_TARGET_DEF
 #
 # Code Signing.
 #
+# There are two signing modes; 'test' and 'release'.
+#  - The 'test' mode is tailored local development, where typically test
+#    certificates are involved. Only the bar minimum of files are signed and
+#    nothing is timestamped (if we can control timestamping) in order to reduce
+#    build time and to allow working offline.
+#  - The 'release' mode is tailored for creating builds that are give to other
+#    people, like the ones the build servers create.  As much as possible is
+#    signed and timestamped.
+#
 ifdef VBOX_SIGNING_MODE
+ VBOX_SIGNING_MODE := $(strip $(VBOX_SIGNING_MODE))
+ ifn1of ($(VBOX_SIGNING_MODE), test release)
+  $(error VBOX_SIGNING_MODE must be either 'test' or 'release'. The value '$(VBOX_SIGNING_MODE)' is not recognized.)
+ endif
+
  ifeq ($(KBUILD_HOST),win)
   #
   # Windows
@@ -2592,30 +2671,34 @@ ifdef VBOX_SIGNING_MODE
 
   # VBOX_PATH_SELFSIGN points to the Vista WDK bin/SelfSign directory.
   ifndef VBOX_PATH_SELFSIGN
-   VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS)/win.x86/selfsign/*)))
+   VBOX_PATH_SELFSIGN := $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS)/win.x86/selfsign/*)))
    ifeq ($(VBOX_PATH_SELFSIGN),)
-    VBOX_PATH_SELFSIGN := $(PATH_DEVTOOLS)/win.x86/selfsign/r1
+    VBOX_PATH_SELFSIGN := $(KBUILD_DEVTOOLS)/win.x86/selfsign/r1
    endif
   endif
-  VBOX_SIGNTOOL ?= $(PATH_DEVTOOLS)/bin/retry.cmd $(VBOX_PATH_SELFSIGN)/SignTool.exe
+  VBOX_SIGNTOOL ?= $(KBUILD_DEVTOOLS)/bin/retry.cmd $(VBOX_PATH_SELFSIGN)/SignTool.exe
   VBOX_INF2CAT  ?= $(VBOX_PATH_SELFSIGN)/Inf2Cat.exe
 
-  # There are three signing modes; 'test', 'development' and 'release'.
-  ifeq ($(strip $(VBOX_SIGNING_MODE)),test)
+  ifeq ($(VBOX_SIGNING_MODE),test)
    VBOX_CERTIFICATE_SUBJECT_NAME ?= MyTestCertificate
    VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
-  else if1of ($(VBOX_SIGNING_MODE), release development)
+  else # release
    VBOX_CERTIFICATE_SUBJECT_NAME ?= Oracle Corporation
    VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= /n "$(VBOX_CERTIFICATE_SUBJECT_NAME)" /a
-   VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/VeriSign Class 3 Public Primary Certification Authority - G5.cer
+   # TEMPORARY HACK!
+   if defined(VBOX_ONLY_VALIDATIONKIT)
+    VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/MSCV-VSClass3.cer
+   else
+    VBOX_CROSS_CERTIFICATE_FILE ?= $(VBOX_PATH_SELFSIGN)/VeriSign Class 3 Public Primary Certification Authority - G5.cer
+   endif
    VBOX_CROSS_CERTIFICATE_FILE_ARGS ?= /ac "$(VBOX_CROSS_CERTIFICATE_FILE)"
    VBOX_TSA_URL ?= http://timestamp.verisign.com/scripts/timestamp.dll
    VBOX_TSA_URL_ARGS ?= /t "$(VBOX_TSA_URL)"
-  else
-   $(error VBox: Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
   endif
   VBOX_CERTIFICATE_STORE ?= my
   VBOX_CERTIFICATE_STORE_ARGS ?= /s "$(VBOX_CERTIFICATE_STORE)"
+  VBOX_CERTIFICATE_FINGERPRINT_ARGS := $(if-expr "$(VBOX_CERTIFICATE_FINGERPRINT)" != "" \
+  	,/sha1 "$(subst $(SP),,$(VBOX_CERTIFICATE_FINGERPRINT))",)
 
   ## Commands for signing a driver image after link.
   VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_IMAGE_FN,$(out)))
@@ -2627,9 +2710,10 @@ ifdef VBOX_SIGNING_MODE
 	$(VBOX_CROSS_CERTIFICATE_FILE_ARGS) \
 	$(VBOX_CERTIFICATE_STORE_ARGS) \
 	$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
+       $(VBOX_CERTIFICATE_FINGERPRINT_ARGS) \
 	$(VBOX_TSA_URL_ARGS) \
 	$(if $(strip $(2)),/d "$(strip $(2))",) \
-       $(3) \
+	$(3) \
 	$(1)
   ## Sign an executable image.
   # @param 1  The file to sign.
@@ -2654,7 +2738,7 @@ ifdef VBOX_SIGNING_MODE
   endif
 
   # Go nuts, sign everything.
-  if "$(strip $(VBOX_SIGNING_MODE))" == "release" || defined(VBOX_WITH_HARDENING)
+  if "$(VBOX_SIGNING_MODE)" == "release" || defined(VBOX_WITH_HARDENING)
    ## Commands for signing an executable or a dll image after link.
    VBOX_SIGN_IMAGE_CMDS  ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_IMAGE_FN,$(out)))
   endif
@@ -2668,33 +2752,40 @@ ifdef VBOX_SIGNING_MODE
   # Currently release signing is done when packing.  This may change later.
   # (Installer package signing is done elsewhere (VBOX_MACOSX_INSTALLER_SIGN).)
   #
-  ifeq ($(strip $(VBOX_SIGNING_MODE)),test)
-   VBOX_CERTIFICATE_SUBJECT_NAME ?= $(error You, need to set VBOX_CERTIFICATE_SUBJECT_NAME in LocalConfig.kmk.)
+  if defined(VBOX_CERTIFICATE_FINGERPRINT) && !defined(VBOX_CERTIFICATE_SUBJECT_NAME)
+    VBOX_CERTIFICATE_SUBJECT_NAME = $(subst $(SP),,$(VBOX_CERTIFICATE_FINGERPRINT))
+  endif
+  ifeq ($(VBOX_SIGNING_MODE),test)
+   VBOX_CERTIFICATE_SUBJECT_NAME ?= $(error You need to set VBOX_CERTIFICATE_SUBJECT_NAME in LocalConfig.kmk.)
    VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= --sign "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
-  else if1of ($(VBOX_SIGNING_MODE), release development)
+  else
    VBOX_CERTIFICATE_SUBJECT_NAME ?= Developer ID Application: Oracle America, Inc.
    VBOX_CERTIFICATE_SUBJECT_NAME_ARGS ?= --sign "$(VBOX_CERTIFICATE_SUBJECT_NAME)"
-  else
-   $(error VBox: Unknown VBOX_SIGNING_MODE: $(VBOX_SIGNING_MODE))
   endif
 
   VBOX_CODESIGN ?= codesign
+  if 0
+   VBOX_DARWIN_KEXT_SIGN_FILES = CodeDirectory CodeRequirement CodeResources CodeSignature
+  else
+   VBOX_DARWIN_KEXT_SIGN_FILES = CodeResources
+  endif
 
   # The above version with complicated requirements is what Xcode 5.0.1GM suggest for kexts.
-  VBOX_SIGN_BUNDLE_FN = $(VBOX_CODESIGN) \
+  VBOX_SIGN_BUNDLE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \
 	--verbose=9 \
 	--force \
 	--file-list - \
+       $(3) \
 	$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
 	$(1) $(if $(2),--identifier "$(2)",)
 
   ## Sign a Mach-O image.
   # @param 1  The bundle to sign.
   # @param 2  Identifier, optional.
-  VBOX_SIGN_MACHO_FN = $(VBOX_CODESIGN) \
+  VBOX_SIGN_MACHO_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \
 	--verbose=9 \
 	--force \
-       --file-list - \
+	--file-list - \
 	$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
 	$(1) \
 	$(if $(2),--identifier "$(2)",)
@@ -2702,16 +2793,108 @@ ifdef VBOX_SIGNING_MODE
   ## Sign a VMM Mach-O image.
   # @param 1  The bundle to sign.
   # @param 2  Identifier, optional.
-  VBOX_SIGN_VMM_MOD_FN = $(VBOX_CODESIGN) \
+  ifdef VBOX_NOT_OSX_105
+  VBOX_SIGN_VMM_MOD_FN = $(VBOX_SIGN_MACHO_FN)
+  else
+  VBOX_SIGN_VMM_MOD_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \
 	--verbose=9 \
 	--force \
-       --file-list - \
+	--file-list - \
 	$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
 	$(1) -D $(1).codesign \
 	$(if $(2),--identifier "$(2)",)
+  endif
+
+  ## Sign a non-executable file.
+  # @param 1  The bundle to sign.
+  # @param 2  Identifier, optional.
+  ifdef VBOX_NOT_OSX_105
+  VBOX_SIGN_FILE_FN = $(call MSG_TOOL,SIGNTOOL,,$(1),$(2))$(NLTAB)$(VBOX_CODESIGN) \
+	--verbose=9 \
+	--force \
+	--file-list - \
+	$(VBOX_CERTIFICATE_SUBJECT_NAME_ARGS) \
+	$(1) \
+	$(if $(2),--identifier "$(2)",)
+  else
+  VBOX_SIGN_FILE_FN =
+  endif
+
+
+  ## @def VBOX_TEST_SIGN_KEXT
+  # Adds test signing to a $1.kext target (the plist installer target).
+  #
+  # After both targets has been defined:
+  #    $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxDrv)
+  #
+  # @param 1   The kext name.  Assumes there is a SYSMODS target of name $1
+  #            as well as an .plist installer by the name of '$1.kext'.
+  # @remarks   Currently assumes only binary + Info.plist in the bundle, no
+  #            other files.  Should that be requirement, add them as a list
+  #            in the 2nd parameter.
+  # @note      This is only for the 'test' signing mode, we skip this in
+  #             'release' signing mode as to not waste time on the build boxes.
+  ifeq ($(VBOX_SIGNING_MODE),test) ## @todo when kBuild is updated to r2742+, this should be enabled for both modes.
+   define VBOX_TEST_SIGN_KEXT
+  $1_INSTTYPE.darwin = none
+
+  $1.kext_SOURCES  += $$($1.kext_0_OUTDIR)/Contents/MacOS/$1=>MacOS/$1 \
+  	$(foreach extfile, $(VBOX_DARWIN_KEXT_SIGN_FILES) \
+	        , $$($1.kext_0_OUTDIR)/Contents/_CodeSignature/$(extfile)=>_CodeSignature/$(extfile))
+  $1.kext_SYMLINKS += $(foreach symfile, $(VBOX_DARWIN_KEXT_SIGN_SYMLINKS), $(symfile)=>_CodeSignature/$(symfile))
+  $1.kext_CLEAN    += \
+  	$(foreach extfile, $(VBOX_DARWIN_KEXT_SIGN_FILES)   , $$($1.kext_0_OUTDIR)/Contents/_CodeSignature/$(extfile)) \
+  	$(foreach symfile, $(VBOX_DARWIN_KEXT_SIGN_SYMLINKS), $$($1.kext_0_OUTDIR)/Contents/$(symfile)) \
+	$$($1.kext_0_OUTDIR)/Contents/MacOS/$1 \
+	$$($1.kext_0_OUTDIR)/$1.kext/Contents/_CodeSignature/
+  $1.kext_BLDDIRS  += $$($1.kext_0_OUTDIR)/Contents/MacOS/
+
+  $$$$($1.kext_0_OUTDIR)/Contents/MacOS/$1 \
+  + $(foreach file,$(VBOX_DARWIN_KEXT_SIGN_FILES), $$$$($1.kext_0_OUTDIR)/Contents/_CodeSignature/$(file)): \
+ 		$$$$($1.kext_0_OUTDIR)/Contents/Info.plist $$$$($1_1_TARGET) | $$$$($1.kext_0_OUTDIR)/
+	$(RM) -Rf -- "$$($1.kext_0_OUTDIR)/Contents/_CodeSignature/" "$$($1.kext_0_OUTDIR)/Contents/MacOS/"
+	$(MKDIR) -p -- "$$($1.kext_0_OUTDIR)/Contents/MacOS/"
+	$(INSTALL) -m 644 $$($1_1_TARGET) $$($1.kext_0_OUTDIR)/Contents/MacOS/$1
+	$(call VBOX_SIGN_BUNDLE_FN,$$($1.kext_0_OUTDIR),org.virtualbox.app.kext.$1,)
+   endef
+  else
+   VBOX_TEST_SIGN_KEXT =
+  endif
+
+
+ else ifeq ($(KBUILD_HOST),solaris)
+  #
+  # Solaris code signing.
+  #
+
+  ifeq ($(VBOX_SIGNING_MODE),test)
+   VBOX_CERTIFICATE_FILE  ?= $(error You need to set VBOX_CERTIFICATE_FILE in LocalConfig.kmk.)
+   VBOX_TOKEN_NAME        ?= $(error You need to set VBOX_TOKEN_NAME in LocalConfig.kmk.)
+   VBOX_PIN_FILE          ?= $(error You need to set VBOX_PIN_FILE in LocalConfig.kmk.)
+  else
+   VBOX_CERTIFICATE_FILE  ?= $(PATH_ROOT)/oracle.pem
+   VBOX_TOKEN_NAME        ?= "Sun Software PKCS\#11 softtoken"
+   VBOX_PIN_FILE          ?= $(PATH_ROOT)/oracle.pin
+  endif
+  VBOX_CERTIFICATE_FILE_ARGS ?= -c $(VBOX_CERTIFICATE_FILE)
+  VBOX_TOKEN_NAME_ARGS       ?= -T $(VBOX_TOKEN_NAME)
+  VBOX_PIN_ARGS              ?= -P $(VBOX_PIN_FILE)
+
+  VBOX_ELFSIGN ?= elfsign
+
+  ## Commands for signing a driver image after link.
+  VBOX_SIGN_DRIVER_CMDS ?= $(if $(eq $(tool_do),LINK_LIBRARY),,$(call VBOX_SIGN_ELF_FN,$(out)))
+  # Sign an ELF image.
+  # @param 1   The elf object file to sign.
+  VBOX_SIGN_ELF_FN ?= $(VBOX_ELFSIGN) \
+	sign \
+	$(VBOX_CERTIFICATE_FILE_ARGS) \
+	$(VBOX_TOKEN_NAME_ARGS) \
+	$(VBOX_PIN_ARGS) \
+	-e $(1)
 
  else
-  # Not Windows or mac os x build host, ignore.
+  # Not Windows, Mac OS X or Solaris build host, ignore.
   VBOX_SIGNING_MODE :=
  endif
 
@@ -2792,6 +2975,86 @@ endif
 # @param
 VBOX_RESIGN_DLL_FN =
 
+
+#
+# File version info and description macros (ignored on most OSes).
+#
+
+##
+# Internal macro.
+#
+# @param 1     The target name.
+# @param 2     The description
+# @param 3     Optional icon file.
+# @param 4     The template base name.
+# @param 5     Additional RC options.
+#
+# @remarks     ASSUMES RCFLAGS isn't a simple variable (var := value).
+define VBOX_SET_VER_INFO_INTERNAL
+ifeq ($(KBUILD_TARGET),win)
+$(1)_SOURCES.win += $(PATH_ROOT)/src/VBox/Resources/win/$(4)
+$(1)_RCFLAGS += /nologo /dIN_INTERNAL_NAME="\"$(1)\"" /dIN_FILE_DESCRIPTION="\"$(2)\"" \
+	/dIN_ORIGINAL_NAME="\"$$(notdir $$($(1)_1_INST_TARGET))\"" \
+	$(if $(3), /dIN_ICON_FILE="\"$(subst \\,/,$(strip $(3)))\"") $(5)
+$$$$($(1)_0_OUTDIR)/src/VBox/Resources/win/$(basename $(4)).res: \
+	$(PATH_ROOT)/include/VBox/version.h $$$$(VBOX_VERSION_HEADER)
+endif
+endef
+
+##
+# Macro for setting DLL/SO/DYLIB version information and description.
+#
+# The macro must be invoked using evalcall2 after the whole target has
+# been declared.
+#
+# @param 1     The target name.
+# @param 2     The description
+# @param 3     Optional icon file.
+VBOX_SET_VER_INFO_DLL = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateDll.rc,)
+
+##
+# Macro for setting EXE version information and description.
+#
+# The macro must be invoked using call after the whole target has been declared.
+#
+# @param 1     The target name.
+# @param 2     The description
+# @param 3     Optional icon file.
+VBOX_SET_VER_INFO_EXE = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateExe.rc,)
+
+##
+# Macro for setting driver version information and description.
+#
+# The macro must be invoked using call after the whole target has been declared.
+#
+# @param 1     The target name.
+# @param 2     The description
+# @param 3     Optional icon file.
+# @param 4     Optional VFT2_DRV_xxx define for windows.  Uses VFT2_UNKNOWN by default.
+VBOX_SET_VER_INFO_DRV = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateDrv.rc,$(if $(4), /dIN_FILE_SUBTYPE=$(4)))
+
+##
+# Macro for setting the version information and description for a ring-0 module.
+#
+# The macro must be invoked using call after the whole target has been declared.
+#
+# @param 1     The target name.
+# @param 2     The description
+# @param 3     Optional icon file.
+VBOX_SET_VER_INFO_R0 = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateR0.rc,)
+
+##
+# Macro for setting the version information and description for a raw-mode context module.
+#
+# The macro must be invoked using call after the whole target has been declared.
+#
+# @param 1     The target name.
+# @param 2     The description
+# @param 3     Optional icon file.
+VBOX_SET_VER_INFO_RC = $(evalcall2 VBOX_SET_VER_INFO_INTERNAL,$1,$2,$3,TemplateRc.rc,)
+
+
+
 #
 # Adjust kBuild defaults.
 #
@@ -2840,6 +3103,11 @@ VBOX_SUFF_LIB = .lib
 else
 VBOX_SUFF_LIB = .a
 endif
+if1of ($(KBUILD_HOST), os2 win)
+VBOX_HOSTSUFF_LIB = .lib
+else
+VBOX_HOSTSUFF_LIB = .a
+endif
 VBOX_SUFF_DLL = $(SUFF_DLL)
 ifeq ($(KBUILD_TARGET),os2) # GXX3OMF produces out .o at the moment.
 VBOX_SUFF_OBJ = .o
@@ -3019,7 +3287,7 @@ ifeq ($(KBUILD_TARGET),solaris)
   # uname -v can report "snv_XYZ" or "11.X"
   VBOX_SOLARIS_11_VERSION = $(shell uname -v | sed 's/snv_//' | cut -f1 -d'.')
   ifeq ($(VBOX_SOLARIS_11_VERSION),11)
-   VBOX_SOLARIS_11_FULLVERSION = $(shell pkg contents -H -t set -o pkg.fmri entire | $(SED_EXT) -e '1!d' -e 's/^.*\@//;s/\:.*//;s/.*,//')
+   VBOX_SOLARIS_11_FULLVERSION = $(shell pkg contents -H -t set -o pkg.fmri system/kernel | $(SED_EXT) -e '1!d' -e 's/^.*\@//;s/\:.*//;s/.*,//')
    # FULLVERSION format e.g. "5.11-0.175.1.0.0.16.0", we're interested in 175 (VERSION), 1 (UPDATE), 16 (BUILD).
    VBOX_SOLARIS_11_VERSION = $(word 2, $(subst ., ,$(word 2,$(subst -, ,$(VBOX_SOLARIS_11_FULLVERSION)))))
    VBOX_SOLARIS_11_UPDATE_VERSION = $(word 3, $(subst ., ,$(word 2,$(subst -, ,$(VBOX_SOLARIS_11_FULLVERSION)))))
@@ -3027,7 +3295,12 @@ ifeq ($(KBUILD_TARGET),solaris)
   endif
 
   # OSS audio support for Solaris
- VBOX_WITH_SOLARIS_OSS := $(if-expr $(VBOX_SOLARIS_11_VERSION) >= 115,1,)
+  VBOX_WITH_SOLARIS_OSS := $(if-expr $(VBOX_SOLARIS_11_VERSION) >= 115,1,)
+ endif
+
+ # XPCOM namespace cleanup issue with Solaris GCC 4.5.2 and newer, see @bugref{5838}.
+ if $(VBOX_GCC_VERSION_CXX) >= 40502
+  VBOX_WITH_XPCOM_NAMESPACE_CLEANUP =
  endif
 endif
 
@@ -3109,13 +3382,14 @@ ifdef VBOX_WITH_RAW_MODE
 
  ifeq ($(VBOX_LDR_FMT32),pe)
   TEMPLATE_VBoxRc_TOOL               = $(VBOX_VCC_TOOL_STEM)X86
+  TEMPLATE_VBoxRc_RCDEFS             = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000)
   ifdef TODO_MORE_WARNINGS
    TEMPLATE_VBoxRc_CXXFLAGS          = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- -Gs8192 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP) -W4 -wd4244 -wd4996 -wd4127 -wd4100 -wd4214 -wd4706 $(VBOX_VCC_WERR)
   else
    TEMPLATE_VBoxRc_CXXFLAGS          = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- -Gs8192 $(VBOX_VCC_GC_OPT) $(VBOX_VCC_GC_FP) -W3 -wd4244 -wd4996 $(VBOX_VCC_WERR)
   endif
   TEMPLATE_VBoxRc_CFLAGS             = $(TEMPLATE_VBoxRc_CXXFLAGS)
-  TEMPLATE_VBoxRc_LDFLAGS            = \
+  TEMPLATE_VBoxRc_LDFLAGS            =  -Ignore:4197 \
   	-Driver -Subsystem:NATIVE -Incremental:NO -Align:64 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Release -Debug \
   	-Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
   	-Stub:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
@@ -3180,7 +3454,7 @@ ifdef VBOX_WITH_RAW_MODE
  TEMPLATE_VBoxRcExe_MODE = $(NO_SUCH_VARIABLE)
 
  ifeq ($(VBOX_LDR_FMT32),pe)
-  TEMPLATE_VBoxRcExe_LDFLAGS = \
+  TEMPLATE_VBoxRcExe_LDFLAGS = -Ignore:4197 \
   	-Incremental:NO -MapInfo:Exports -NoD -Debug \
   	-Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
   	-Stub:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
@@ -3244,13 +3518,14 @@ endif
 
 ifeq ($(VBOX_LDR_FMT),pe)
 TEMPLATE_VBoxR0_TOOL                = $(VBOX_VCC_TOOL)
+TEMPLATE_VBoxR0_RCDEFS              = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000)
  ifdef TODO_MORE_WARNINGS
 TEMPLATE_VBoxR0_CXXFLAGS            = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) -W4 -wd4244 -wd4127 -wd4100 -wd4214 -wd4706 -wd4996 $(VBOX_VCC_WERR)
  else
 TEMPLATE_VBoxR0_CXXFLAGS            = -Zi -Zl -GR- -EHs- -GF -GS- -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) -W3 -wd4244 -wd4996 $(VBOX_VCC_WERR)
  endif
 TEMPLATE_VBoxR0_CFLAGS              = $(TEMPLATE_VBoxR0_CXXFLAGS)
-TEMPLATE_VBoxR0_LDFLAGS             = \
+TEMPLATE_VBoxR0_LDFLAGS             = -Ignore:4197 \
 	-Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD $(VBOX_VCC_LD_WERR) -Release -Debug \
 	-Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	-Stub:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
@@ -3283,6 +3558,8 @@ ifeq ($(KBUILD_TARGET),solaris)
   TEMPLATE_VBoxR0_CFLAGS.amd64 += -Wa,-xmodel=kernel
   TEMPLATE_VBoxR0_CXXFLAGS.amd64 += -Wa,-xmodel=kernel
  endif
+ # Solaris driver signing.
+ TEMPLATE_VBoxR0_POST_CMDS          = $(VBOX_SIGN_DRIVER_CMDS)
 else
  TEMPLATE_VBoxR0_LDFLAGS            = -nostdlib -Bsymbolic -g
  ## @todo WTF doesn't the globals work? Debug info is supposed to be split everywhere. GRR
@@ -3348,22 +3625,14 @@ endif
 
 ifeq ($(KBUILD_TARGET),win)
  TEMPLATE_VBOXR0DRV_TOOL               = $(VBOX_VCC_TOOL)
- TEMPLATE_VBOXR0DRV_RCDEFS             = \
-	VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
-	VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
-	VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
-	VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
-	VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
-	VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
-	VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
-	VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
+ TEMPLATE_VBOXR0DRV_RCDEFS             = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000)
  TEMPLATE_VBOXR0DRV_DEFS.x86           = _X86_
  TEMPLATE_VBOXR0DRV_DEFS.x86          += NO_INTERLOCKED_INTRINSICS # Avoids intrisic VC/WDK trouble
  TEMPLATE_VBOXR0DRV_DEFS.x86          += WIN9X_COMPAT_SPINLOCK     # Avoid multiply defined _KeInitializeSpinLock at 4
  TEMPLATE_VBOXR0DRV_DEFS.amd64         = _AMD64_
  TEMPLATE_VBOXR0DRV_CXXFLAGS           = -Zi -Zl -GR- -EHs- -GF -Gz -W3 -GS- -wd4996 -Zc:wchar_t- -Gs4096 $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
  TEMPLATE_VBOXR0DRV_CFLAGS             = $(TEMPLATE_VBOXR0DRV_CXXFLAGS)
- TEMPLATE_VBOXR0DRV_LDFLAGS            = \
+ TEMPLATE_VBOXR0DRV_LDFLAGS            = -Ignore:4197 \
  	-Driver -Subsystem:NATIVE -Incremental:NO -Align:4096 -MapInfo:Exports -NoD -Release -Debug \
 	-Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	-Stub:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
@@ -3464,6 +3733,7 @@ TEMPLATE_VBOXR0DRV_CXXFLAGS           = -Wpointer-arith -Winline \
 	-O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -fno-exceptions -fno-rtti
 TEMPLATE_VBOXR0DRV_CXXFLAGS.x86       = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
 TEMPLATE_VBOXR0DRV_CXXFLAGS.amd64     = $(TEMPLATE_VBOXR0DRV_CFLAGS.amd64)
+TEMPLATE_VBOXR0DRV_POST_CMDS          = $(VBOX_SIGN_DRIVER_CMDS)
 endif # Solaris
 
 ifeq ($(KBUILD_TARGET),freebsd)
@@ -3510,7 +3780,7 @@ TEMPLATE_VBOXR0DRV_CFLAGS              =  \
 	$(VBOX_GCC_WARN) -Wpointer-arith -Winline $(VBOX_GCC_Wno-pointer-sign) $(VBOX_GCC_fdiagnostics-show-option) \
 	-Wstrict-prototypes -Wmissing-prototypes -Wstrict-prototypes \
 	-Wimplicit-function-declaration -Werror-implicit-function-declaration \
-	-O2 -fformat-extensions -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
+	-O2 -ffreestanding -fno-strict-aliasing -fno-common -finline-limit=8000 \
 	$(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
 	-nostdinc -std=c99
 TEMPLATE_VBOXR0DRV_CFLAGS.x86          = -m32 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2
@@ -3519,7 +3789,7 @@ TEMPLATE_VBOXR0DRV_CFLAGS.amd64        = -m64 --param inline-unit-growth=100 --p
 	-mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -Wundef
 TEMPLATE_VBOXR0DRV_CXXFLAGS            = -fno-exceptions -fno-rtti \
 	$(VBOX_GCC_WARN) -Wpointer-arith -Winline \
-	-O2 -fno-format-extensions -fno-strict-aliasing -fno-common -finline-limit=8000 \
+	-O2 -fno-strict-aliasing -fno-common -finline-limit=8000 \
 	$(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) \
 	-nostdinc
 TEMPLATE_VBOXR0DRV_CXXFLAGS.x86        = $(TEMPLATE_VBOXR0DRV_CFLAGS.x86)
@@ -3575,8 +3845,8 @@ TEMPLATE_VBOXR0DRV_LDTOOL              = $(VBOX_GCC_TOOL)
 TEMPLATE_VBOXR0DRV_DEFS                = _KERNEL_MODE=1 _STRICT_STDC IN_RING0 IN_RT_R0
 TEMPLATE_VBOXR0DRV_INCS                = $(VBOX_HAIKU_SYS_INCS)
 #TODO: sort this out
-TEMPLATE_VBOXR0DRV_LDFLAGS             = -shared -no-undefined -dc -dy -nostdlib -rpath-link /boot/develop/lib/x86 --no-add-needed /boot/develop/lib/x86/_KERNEL_ --no-add-needed /boot/develop/lib/x86/haiku_version_glue.o
-TEMPLATE_VBOXR0DRV_CFLAGS              = -no-fpic \
+TEMPLATE_VBOXR0DRV_LDFLAGS             = -shared -no-undefined -dc -dy -lroot -rpath-link /boot/system/develop/lib/x86 --no-add-needed /boot/system/develop/lib/_KERNEL_ --no-add-needed /boot/system/develop/lib/haiku_version_glue.o
+TEMPLATE_VBOXR0DRV_CFLAGS              = -fno-PIC \
 	$(VBOX_GCC_WARN) -Wstrict-prototypes $(VBOX_GCC_Wno-pointer-sign) -Wno-sign-compare \
 	$(VBOX_GCC_fno-stack-protector) $(VBOX_GCC_R0_OPT) $(VBOX_GCC_R0_FP) -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration
 TEMPLATE_VBOXR0DRV_CFLAGS.x86          = -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
@@ -3584,7 +3854,7 @@ TEMPLATE_VBOXR0DRV_CFLAGS.x86          = -m32 -mno-sse -mno-mmx -mno-sse2 -mno-3
 TEMPLATE_VBOXR0DRV_CFLAGS.amd64        = -m64 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow \
 	-fno-reorder-blocks -ffreestanding -fno-asynchronous-unwind-tables -funit-at-a-time \
 	-Wno-sign-compare -Wdeclaration-after-statement
-TEMPLATE_VBOXR0DRV_CXXFLAGS           = -no-fpic -Wpointer-arith \
+TEMPLATE_VBOXR0DRV_CXXFLAGS           = -fno-PIC -Wpointer-arith \
 	-Wshadow -Wuninitialized -Wunused-function -Wunused-label -Wunused-value -Wunused-variable \
 	-Wformat \
 	-O2 -nodefaultlibs -fno-omit-frame-pointer -fno-strict-aliasing -fno-common -fno-exceptions -fno-rtti
@@ -3645,15 +3915,7 @@ ifeq ($(KBUILD_TARGET),win)
 # TEMPLATE_VBOXR3EXE_TOOL               = $(VBOX_VCC_TOOL)
  TEMPLATE_VBOXR3EXE_TOOL.win.x86       = $(VBOX_VCC_TOOL_STEM)X86
  TEMPLATE_VBOXR3EXE_TOOL.win.amd64     = $(VBOX_VCC_TOOL_STEM)AMD64
- TEMPLATE_VBOXR3EXE_RCDEFS             = \
-	VBOX_VERSION_MAJOR=\"$(VBOX_VERSION_MAJOR)\" \
-	VBOX_VERSION_MINOR=\"$(VBOX_VERSION_MINOR)\" \
-	VBOX_VERSION_BUILD=\"$(VBOX_VERSION_BUILD)\" \
-	VBOX_SVN_REV=\"$(VBOX_SVN_REV)\" \
-	VBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
-	VBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
-	VBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
-	VBOX_SVN_REV_NR=$(VBOX_SVN_REV)
+ TEMPLATE_VBOXR3EXE_RCDEFS             = VBOX_SVN_REV=$(VBOX_SVN_REV) VBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000)
  TEMPLATE_VBOXR3EXE_SDKS               = ReorderCompilerIncs $(VBOX_WINPSDK)
  TEMPLATE_VBOXR3EXE_CXXFLAGS           = -Zi -Zl -GR- -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -W3 -wd4065 -wd4244 -wd4996 -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP)
  TEMPLATE_VBOXR3EXE_CXXFLAGS.debug     = -RTCsu
@@ -3663,7 +3925,7 @@ ifeq ($(KBUILD_TARGET),win)
  TEMPLATE_VBOXR3EXE_CFLAGS.debug       = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)
  TEMPLATE_VBOXR3EXE_CFLAGS.dbgopt      = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.dbgopt)
  TEMPLATE_VBOXR3EXE_CFLAGS.kprofile    = $(TEMPLATE_VBOXR3EXE_CXXFLAGS.kprofile)
- TEMPLATE_VBOXR3EXE_LDFLAGS            = \
+ TEMPLATE_VBOXR3EXE_LDFLAGS            = -Ignore:4197 \
 	/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug \
 	/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com \
@@ -3719,7 +3981,7 @@ TEMPLATE_VBOXR3EXE_LDFLAGS.x86         = -m32
 TEMPLATE_VBOXR3EXE_LDFLAGS.amd64       = -m64
 TEMPLATE_VBOXR3EXE_LDFLAGS.sparc32     = -m32
 TEMPLATE_VBOXR3EXE_LDFLAGS.sparc64     = -m64
-TEMPLATE_VBOXR3EXE_LDFLAGS.linux       = -Wl,-z,noexecstack $(VBOX_LD_as_needed)
+TEMPLATE_VBOXR3EXE_LDFLAGS.linux       = -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
 TEMPLATE_VBOXR3EXE_LDFLAGS.solaris     = -Wl,-z,ignore # same as VBOX_LD_as_needed
 
  ifeq ($(KBUILD_TARGET),linux)
@@ -3764,7 +4026,6 @@ TEMPLATE_VBOXR3EXE_LIBPATH            += \
  else ifeq ($(KBUILD_TARGET),solaris)
 TEMPLATE_VBOXR3EXE_TOOL                = GXX3PLAIN
 TEMPLATE_VBOXR3EXE_DEFS               += LIBICONV_PLUG _REENTRANT # Avoid the GNU libiconv, for now at least.
-
 TEMPLATE_VBOXR3EXE_LIBS                = rt socket
  else
 $(warning Warning: VBOX Build: Target $(KBUILD_TARGET) is not officially supported!)
@@ -4212,6 +4473,8 @@ ifneq ($(KBUILD_TARGET),win) # (only gcc)
  TEMPLATE_VBOXR3NP_CXXFLAGS              = $(filter-out -pedantic -Wshadow,$(TEMPLATE_VBOXR3_CXXFLAGS)) -Wno-sign-compare
  TEMPLATE_VBOXR3NP_CFLAGS                = $(filter-out -pedantic -Wshadow -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations,$(TEMPLATE_VBOXR3_CFLAGS)) \
 	-Wno-sign-compare -Werror-implicit-function-declaration
+ TEMPLATE_VBOXR3NP_OBJCFLAGS             = $(filter-out -pedantic -Wstrict-prototypes,$(TEMPLATE_VBOXR3_OBJCFLAGS))
+ TEMPLATE_VBOXR3NP_OBJCXXFLAGS           = $(filter-out -pedantic,$(TEMPLATE_VBOXR3_OBJCXXFLAGS))
 endif
 
 
@@ -4263,7 +4526,7 @@ ifeq (disabled-by-mingw-w64 $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
  TEMPLATE_VBoxNoCrtGccLib_TOOL             = XGCCAMD64LINUX
  TEMPLATE_VBoxNoCrtGccLib_ASTOOL           = YASM
  TEMPLATE_VBoxNoCrtGccLib_ASFLAGS          = -f elf64 -DASM_FORMAT_ELF -D__YASM__ -w+orphan-labels -g dwarf2
- TEMPLATE_VBoxNoCrtGccLib_LIBS             = $(PATH_DEVTOOLS)/win.x86/x86_64-unknown-linux-gnu/20060701-r2/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/libgcc.a
+ TEMPLATE_VBoxNoCrtGccLib_LIBS             = $(KBUILD_DEVTOOLS)/win.x86/x86_64-unknown-linux-gnu/20060701-r2/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/libgcc.a
  TEMPLATE_VBoxNoCrtGccLib_LDFLAGS          = -nostdlib
 
 else if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.x86 win.amd64)
@@ -4273,7 +4536,7 @@ else if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), win.x86 win.amd64)
  TEMPLATE_VBoxNoCrtGccLib_ASTOOL           = $(VBOX_ASTOOL)
  TEMPLATE_VBoxNoCrtGccLib_ASFLAGS          = $(VBOX_ASFLAGS)
  TEMPLATE_VBoxNoCrtGccLib_LDTOOL           = $(VBOX_VCC_TOOL)
- TEMPLATE_VBoxNoCrtGccLib_LDFLAGS          = -Incremental:NO -MapInfo:Exports -NoD
+ TEMPLATE_VBoxNoCrtGccLib_LDFLAGS          = -Incremental:NO -MapInfo:Exports -NoD -Ignore:4197
  TEMPLATE_VBoxNoCrtGccLib_LIBS             = $(VBOX_GCC_LIBGCC)
  TEMPLATE_VBoxNoCrtGccLib_CFLAGS          := $(filter-out -g,$(TEMPLATE_VBoxNoCrtGccLib_CFLAGS)) -s
  TEMPLATE_VBoxNoCrtGccLib_CXXFLAGS        := $(filter-out -g,$(TEMPLATE_VBoxNoCrtGccLib_CXXFLAGS)) -s
@@ -4330,6 +4593,22 @@ TEMPLATE_VBOXMAINEXE_DEFS                = IN_RING3 UNICODE NDEBUG=1
 TEMPLATE_VBOXMAINEXE_DEFS.win            = _UNICODE
 TEMPLATE_VBOXMAINEXE_RCDEFS              = $(TEMPLATE_VBOXR3EXE_RCDEFS)
 TEMPLATE_VBOXMAINEXE_LIBS.kprofile       = $(LIB_KPROFILE)
+TEMPLATE_VBOXMAINEXE_USES                = dtrace
+if defined(VBOX_WITH_DTRACE_R3_MAIN) && defined(VBOX_WITH_NATIVE_DTRACE)
+ TEMPLATE_VBOXMAINEXE_DTRACETOOL         = DTraceAndVBoxTpG
+ TEMPLATE_VBOXMAINEXE_DTRACE_OBJ_FLAGS   = -C
+ TEMPLATE_VBOXMAINEXE_DTRACE_HDR_FLAGS   = -C
+ TEMPLATE_VBOXMAINEXE_DEFS              += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3 VBOX_WITH_DTRACE_R3_MAIN VBOX_WITH_NATIVE_DTRACE
+else
+  TEMPLATE_VBOXMAINEXE_DTRACE_HDR_FLAGS  = --ring-3-context
+  TEMPLATE_VBOXMAINEXE_DTRACE_OBJ_FLAGS  = --ring-3-context --pic --probe-fn-imported --probe-fn-name "SUPTracerFireProbe"
+ if defined(VBOX_WITH_DTRACE_R3_MAIN)
+  TEMPLATE_VBOXMAINEXE_DTRACETOOL        = VBoxTpG
+  TEMPLATE_VBOXMAINEXE_DEFS             += VBOX_WITH_DTRACE VBOX_WITH_DTRACE_R3 VBOX_WITH_DTRACE_R3_MAIN
+ else
+  TEMPLATE_VBOXMAINEXE_DTRACETOOL        = VBoxTpG-Disabled
+ endif
+endif
 
 ifeq ($(KBUILD_TARGET),win)
  TEMPLATE_VBOXMAINEXE_SDKS               = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
@@ -4347,7 +4626,7 @@ ifeq ($(KBUILD_TARGET),win)
  TEMPLATE_VBOXMAINEXE_CFLAGS.debug       = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.debug)
  TEMPLATE_VBOXMAINEXE_CFLAGS.dbgopt      = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.dbgopt)
  TEMPLATE_VBOXMAINEXE_CFLAGS.kprofile    = $(TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile)
- TEMPLATE_VBOXMAINEXE_LDFLAGS            = \
+ TEMPLATE_VBOXMAINEXE_LDFLAGS            = -Ignore:4197 \
 	/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug \
 	/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com \
@@ -4360,6 +4639,9 @@ ifeq ($(KBUILD_TARGET),win)
  if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_HARDENING)
   TEMPLATE_VBOXMAINEXE_LDFLAGS          += -IntegrityCheck
  endif
+ ifdef VBOX_WITH_DTRACE_R3_MAIN
+  TEMPLATE_VBOXMAINEXE_LDFLAGS          += -Merge:VTGPrLc.Data=VTGPrLc.Begin -Merge:VTGPrLc.End=VTGPrLc.Begin -Merge:VTGPrLc.Begin=VTGObj
+ endif
  TEMPLATE_VBOXMAINEXE_LIBS               = \
 	$(LIB_RUNTIME)
  TEMPLATE_VBOXMAINEXE_LIBS.x86           = \
@@ -4380,7 +4662,10 @@ TEMPLATE_VBOXMAINEXE_TOOL                = $(VBOX_GCC_TOOL)
 TEMPLATE_VBOXMAINEXE_CXXFLAGS            = -g $(VBOX_GCC_pipe) \
 	$(VBOX_GCC_PEDANTIC_CXX) $(VBOX_GCC_Wno-variadic-macros) -Wno-long-long -Wno-non-virtual-dtor -Wshadow \
 	-fshort-wchar -fpermissive -fexceptions -frtti $(VBOX_GCC_OPT) $(VBOX_GCC_FP) -fno-strict-aliasing \
-	$(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden)
+	$(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_std)
+ifdef VBOX_WITH_DTRACE_R3_MAIN
+ TEMPLATE_VBOXMAINEXE_CXXFLAGS := $(filter-out -pedantic,$(TEMPLATE_VBOXMAINEXE_CXXFLAGS)) -fdollars-in-identifiers # annoying gcc option precedence.
+endif
 TEMPLATE_VBOXMAINEXE_CXXFLAGS.x86        = -m32
 TEMPLATE_VBOXMAINEXE_CXXFLAGS.amd64      = -m64
 TEMPLATE_VBOXMAINEXE_CXXFLAGS.kprofile   = -finstrument-functions
@@ -4401,7 +4686,7 @@ TEMPLATE_VBOXMAINEXE_LDFLAGS.x86         = -m32
 TEMPLATE_VBOXMAINEXE_LDFLAGS.amd64       = -m64
  ifeq ($(KBUILD_TARGET),linux)
 TEMPLATE_VBOXMAINEXE_LIBS                = pthread m rt $(LIB_RUNTIME) dl
-TEMPLATE_VBOXMAINEXE_LDFLAGS.linux       = -Wl,-z,noexecstack $(VBOX_LD_as_needed)
+TEMPLATE_VBOXMAINEXE_LDFLAGS.linux       = -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
  else ifeq ($(KBUILD_TARGET),os2)
 TEMPLATE_VBOXMAINEXE_TOOL                = GXX3OMF
 TEMPLATE_VBOXMAINEXE_LIBS                = $(LIB_RUNTIME)
@@ -4698,19 +4983,23 @@ ifdef VBOX_WITH_EXTPACK
   TEMPLATE_VBoxR3ExtPackPuel = For the ring-3 context modules in the PUEL extension pack.
   TEMPLATE_VBoxR3ExtPackPuel_EXTENDS = VBoxR3ExtPack
   TEMPLATE_VBoxR3ExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
+  TEMPLATE_VBoxR3ExtPackPuel_DEFS = $(TEMPLATE_VBoxR3ExtPack_DEFS) VBOX_IN_PUEL_EXTPACK
 
   TEMPLATE_VBoxR0ExtPackPuel = For the ring-0 context modules in the PUEL extension pack.
   TEMPLATE_VBoxR0ExtPackPuel_EXTENDS = VBoxR0ExtPack
   TEMPLATE_VBoxR0ExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
+  TEMPLATE_VBoxR0ExtPackPuel_DEFS = $(TEMPLATE_VBoxR0ExtPack_DEFS) VBOX_IN_PUEL_EXTPACK
 
   TEMPLATE_VBoxRcExtPackPuel = For the raw-mode context modules in the PUEL extension pack.
   TEMPLATE_VBoxRcExtPackPuel_EXTENDS = VBoxRcExtPack
   TEMPLATE_VBoxRcExtPackPuel_INST = $(INST_EXTPACK_PUEL)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
+  TEMPLATE_VBoxRcExtPackPuel_DEFS = $(TEMPLATE_VBoxRcExtPack_DEFS) VBOX_IN_PUEL_EXTPACK
 
   TEMPLATE_VBoxInsExtPackPuel = For the install targets of an extension pack.
   TEMPLATE_VBoxInsExtPackPuel_EXTENDS = VBoxR0ExtPack
   TEMPLATE_VBoxInsExtPackPuel_INST = $(INST_EXTPACK_PUEL)
-endif
+ endif
+
 endif # VBOX_WITH_EXTPACK
 
 
@@ -4736,7 +5025,7 @@ ifdef VBOX_WITH_QTGUI
  #
  ifeq ($(VBOX_PATH_QT4),)
   ifeq ($(KBUILD_TARGET),darwin)
-   VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
+   VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*)))
    ifeq ($(VBOX_PATH_QT4),)
     ifneq ($(wildcard /Library/Frameworks/QtCore.framework),)
      # Using the global installation (for OSE).
@@ -4745,9 +5034,9 @@ ifdef VBOX_WITH_QTGUI
     endif
    endif
   else if1of ($(KBUILD_TARGET), win)
-   VBOX_PATH_QT4 ?= $(lastword $(filter %-$(tolower $(VBOX_VCC_TOOL_STEM)),$(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*))))
+   VBOX_PATH_QT4 ?= $(lastword $(filter %-$(tolower $(VBOX_VCC_TOOL_STEM)),$(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*))))
   else if1of ($(KBUILD_TARGET), linux solaris)
-   VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
+   VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*)))
    ifneq ($(VBOX_PATH_QT4),)
     VBOX_WITH_QT4_SUN = 1
    endif
@@ -4805,7 +5094,7 @@ ifdef VBOX_WITH_QTGUI
   TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE)
   TEMPLATE_VBOXQT4GUIEXE_INCS += \
 	$(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
-  TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = \
+  TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = -Ignore:4197 \
 	/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug \
 	/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
@@ -4840,7 +5129,7 @@ ifdef VBOX_WITH_QTGUI
 	-g $(VBOX_GCC_pipe) $(filter-out -Wno-unused,$(VBOX_GCC_WARN)) -frtti -fno-exceptions -Wno-non-virtual-dtor \
 	-Wno-long-long -fshort-wchar -fno-strict-aliasing \
 	$(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) \
-	$(VBOX_GCC_Wno-delete-non-virtual-dtor)
+	$(VBOX_GCC_Wno-delete-non-virtual-dtor) $(VBOX_GCC_std)
   TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86 = -m32
   TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64 = -m64
   TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.linux = -pthread
@@ -4862,7 +5151,7 @@ ifdef VBOX_WITH_QTGUI
 	$(VBOX_LIB_VMM_LAZY)
 
   ifeq ($(KBUILD_TARGET),linux)
-   TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += -Wl,-z,noexecstack $(VBOX_LD_as_needed)
+   TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed)
    TEMPLATE_VBOXQT4GUIEXE_LIBS += \
      $(VBOX_XCURSOR_LIBS) \
 	Xext \
@@ -4976,9 +5265,28 @@ TEMPLATE_VBoxBldProg_BLD_TRG_ARCH       := $(KBUILD_HOST_ARCH)
 TEMPLATE_VBoxBldProg_BLD_TRG_CPU        := $(KBUILD_HOST_CPU)
 TEMPLATE_VBoxBldProg_DEFS               := IN_RING3 LOG_DISABLED
 TEMPLATE_VBoxBldProg_DEFS.win           := _CRT_SECURE_NO_DEPRECATE
-TEMPLATE_VBoxBldProg_ASTOOL             := $(VBOX_ASTOOL)
-TEMPLATE_VBoxBldProg_ASFLAGS.x86        := $(VBOX_ASFLAGS32)
-TEMPLATE_VBoxBldProg_ASFLAGS.amd64      := $(VBOX_ASFLAGS64)
+ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
+ TEMPLATE_VBoxBldProg_ASTOOL            := $(VBOX_ASTOOL)
+ TEMPLATE_VBoxBldProg_ASFLAGS.x86       := $(VBOX_ASFLAGS32)
+ TEMPLATE_VBoxBldProg_ASFLAGS.amd64     := $(VBOX_ASFLAGS64)
+else
+ TEMPLATE_VBoxBldProg_ASTOOL            := YASM
+ TEMPLATE_VBoxBldProg_ASFLAGS           := -D__YASM__ -Worphan-labels
+ if1of ($(KBUILD_HOST),win)
+  TEMPLATE_VBoxBldProg_ASFLAGS          += -g cv8 -DASM_FORMAT_ELF
+  TEMPLATE_VBoxBldProg_ASFLAGS.x86      := -f win32
+  TEMPLATE_VBoxBldProg_ASFLAGS.amd64    := -f win64
+ else if1of ($(KBUILD_HOST),darwin)
+  TEMPLATE_VBoxBldProg_ASFLAGS          += -DASM_FORMAT_MACHO
+  TEMPLATE_VBoxBldProg_ASFLAGS.x86      := -f macho32
+  TEMPLATE_VBoxBldProg_ASFLAGS.amd64    := -f macho64
+ else
+  TEMPLATE_VBoxBldProg_ASFLAGS          += -g dwarf2 -DASM_FORMAT_ELF
+  TEMPLATE_VBoxBldProg_ASFLAGS.x86      := -f elf32
+  TEMPLATE_VBoxBldProg_ASFLAGS.amd64    := -f elf64
+ endif
+  TEMPLATE_VBoxBldProg_ASFLAGS.amd64    += $(VBOX_YASM_Wno-segreg-in-64bit)
+endif
 ifeq ($(KBUILD_HOST),win)
  TEMPLATE_VBoxBldProg_TOOL              := $(VBOX_VCC_TOOL_STEM)$(toupper $(KBUILD_HOST_ARCH))
  TEMPLATE_VBoxBldProg_SDKS              := ReorderCompilerIncs $(VBOX_WINPSDK)
@@ -4993,7 +5301,7 @@ ifeq ($(KBUILD_HOST),win)
  TEMPLATE_VBoxBldProg_CFLAGS.release     = $(TEMPLATE_VBoxBldProg_CXXFLAGS.release)
  TEMPLATE_VBoxBldProg_CFLAGS.profile     = $(TEMPLATE_VBoxBldProg_CXXFLAGS.profile)
  TEMPLATE_VBoxBldProg_CFLAGS.kprofile    = $(TEMPLATE_VBoxBldProg_CXXFLAGS.kprofile)
- TEMPLATE_VBoxBldProg_LDFLAGS            = \
+ TEMPLATE_VBoxBldProg_LDFLAGS            = -Ignore:4197 \
 	/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug \
 	/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	/DISALLOWLIB:libc$(VBOX_VCC_CRT_TYPE_N).lib \
@@ -5118,10 +5426,10 @@ ifeq ($(KBUILD_HOST),win)
  TEMPLATE_VBoxAdvBldProg_CXXFLAGS = $(TEMPLATE_VBoxBldProg_CXXFLAGS) $(VBOX_VCC_WERR)
 endif
 TEMPLATE_VBoxAdvBldProg_LIBS    = \
-	$(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_SUFF_LIB) \
+	$(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_HOSTSUFF_LIB) \
 	$(if-expr defined(IPRT_WITH_KSTUFF), \
-		$(PATH_STAGE_LIB)/VBox-kStuffStaticBldProg$(VBOX_SUFF_LIB) \
-		$(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_SUFF_LIB) \
+		$(PATH_STAGE_LIB)/VBox-kStuffStaticBldProg$(VBOX_HOSTSUFF_LIB) \
+		$(PATH_STAGE_LIB)/RuntimeBldProg$(VBOX_HOSTSUFF_LIB) \
 	,) \
 	$(TEMPLATE_VBoxBldProg_LIBS)
 TEMPLATE_VBoxAdvBldProg_LIBS.darwin = \
@@ -5152,10 +5460,10 @@ TEMPLATE_VBoxAdvBldProg_LIBS.solaris = \
 # (Some (old) Wine versions fails loading msvcrt.dll from the VCC bin directory.)
 #
 ifneq ($(KBUILD_HOST),win)
- TOOL_VCC80X86_RC    := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
- TOOL_VCC80AMD64_RC  := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
- TOOL_VCC70_RC       := $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/rc.exe
- WIN32_MC = $(EXEC_X86_WIN32) $(PATH_DEVTOOLS)/win.x86/bin/mc.exe
+ TOOL_VCC80X86_RC    := $(EXEC_X86_WIN32) $(KBUILD_DEVTOOLS)/win.x86/bin/rc.exe
+ TOOL_VCC80AMD64_RC  := $(EXEC_X86_WIN32) $(KBUILD_DEVTOOLS)/win.x86/bin/rc.exe
+ TOOL_VCC70_RC       := $(EXEC_X86_WIN32) $(KBUILD_DEVTOOLS)/win.x86/bin/rc.exe
+ WIN32_MC = $(EXEC_X86_WIN32) $(KBUILD_DEVTOOLS)/win.x86/bin/mc.exe
 else
  WIN32_MC = $(EXEC_X86_WIN32) $(firstword $(wildcard \
 	$(PATH_SDK_$(VBOX_WINPSDK)_BIN)/MC.Exe\
@@ -5163,7 +5471,7 @@ else
 	$(PATH_SDK_WINPSDK)/Bin/MC.Exe\
 	$(PATH_SDK_WIN32SDK_BIN)/MC.Exe\
 	$(PATH_SDK_WIN64SDK_BIN)/MC.Exe\
-	$(PATH_DEVTOOLS)/win.x86/bin/mc.exe\
+	$(KBUILD_DEVTOOLS)/win.x86/bin/mc.exe\
 	) Sorry_Cannot_find_mc_in_the_PSDK)
 endif
 
@@ -5209,7 +5517,7 @@ else # the gcc guys
    TEMPLATE_VBOXGUESTR3EXE_TOOL         := VBoxXGccAmd64LinuxGnu
    TEMPLATE_VBOXGUESTR3EXE_TOOL.x86     := VBoxXGccX86RedHatLinux
   endif
-  TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS      := $(filter-out $(VBOX_GCC_pipe) $(VBOX_GCC_Wextra) $(VBOX_GCC_Wno-missing-field-initializers) $(VBOX_GCC_fdiagnostics-show-option) $(VBOX_GCC_Wno-delete-non-virtual-dtor) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden),$(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)) -pipe
+  TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS      := $(filter-out $(VBOX_GCC_pipe) $(VBOX_GCC_Wextra) $(VBOX_GCC_Wno-missing-field-initializers) $(VBOX_GCC_fdiagnostics-show-option) $(VBOX_GCC_Wno-delete-non-virtual-dtor) $(VBOX_GCC_Wno-variadic-macros) $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_mtune-generic) $(VBOX_GCC_Wlogical-op),$(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)) -pipe
   TEMPLATE_VBOXGUESTR3EXE_CFLAGS        := $(TEMPLATE_VBOXGUESTR3EXE_CXXFLAGS)
   TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux := $(filter-out $(VBOX_GCC_ORIGIN_OPT) $(VBOX_LD_as_needed),$(TEMPLATE_VBOXGUESTR3EXE_LDFLAGS.linux))
  endif
@@ -5386,9 +5694,6 @@ TEMPLATE_VBOXGUESTR3XORGMOD_DEFS = $(TEMPLATE_VBOXGUESTR3DLL_DEFS) VBOX_GUESTR3X
 ifeq ($(KBUILD_TARGET_ARCH),amd64)
  TEMPLATE_VBOXGUESTR3XORGMOD_DEFS += _XSERVER64
 endif
-if1of ($(KBUILD_TARGET), linux)
- TEMPLATE_VBOXGUESTR3XORGMOD_LDFLAGS = $(TEMPLATE_VBOXGUESTR3DLL_LDFLAGS)
-endif
 TEMPLATE_VBOXGUESTR3XORGMOD_LIBS = \
 	$(VBOX_LIB_VBGL_R3_XORG)
 TEMPLATE_VBOXGUESTR3XORGMOD_LIBS.freebsd += \
@@ -5523,7 +5828,8 @@ ifeq ($(KBUILD_TARGET_ARCH),x86)
 else
  VBOX_LIB_IPRT_GUEST_R0_NT4      = $(VBOX_LIB_IPRT_GUEST_R0)
 endif
-VBOX_LIB_VBGL_R3                 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB)
+VBOX_LIB_VBGL_R3                 = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3Lib$(VBOX_SUFF_LIB) \
+				   $(if $(VBOX_WITH_DRAG_AND_DROP),$(VBOX_PATH_ADDITIONS_LIB)/VBoxDnDGuestR3Lib$(VBOX_SUFF_LIB))
 VBOX_LIB_VBGL_R3_XFREE86         = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXFree86$(VBOX_SUFF_LIB)
 VBOX_LIB_VBGL_R3_XORG            = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibXOrg$(VBOX_SUFF_LIB)
 VBOX_LIB_VBGL_R3_SHARED          = $(VBOX_PATH_ADDITIONS_LIB)/VBoxGuestR3LibShared$(VBOX_SUFF_LIB)
@@ -5605,7 +5911,7 @@ VBOX_VER_TMP2 :=
 # directory. If you don't run it there, you get a consistent sub-tree only.
 #
 VBOX_BAD_CHAR_SET   = ,;:/\$(SP)$(TAB)$(HASH)=![]@%&''()*""<>?^{}|~
-VBOX_VERSION_STAMP  = $(PATH_OUT)/version-stamp-raw-api-$(translate $(VBOX_VERSION_STRING)-$(VBOX_C_YEAR)-$(VBOX_VENDOR)-$(VBOX_PRODUCT)-$(VBOX_API_VERSION)-$(VBOX_BUILD_PUBLISHER),$(VBOX_BAD_CHAR_SET),,_)
+VBOX_VERSION_STAMP  = $(PATH_OUT)/version-stamp-raw-api-$(translate $(VBOX_VERSION_STRING)-$(VBOX_C_YEAR)-$(VBOX_VENDOR)-$(VBOX_PRODUCT)-$(VBOX_API_VERSION)-$(VBOX_BUILD_PUBLISHER)-$(USERNAME),$(VBOX_BAD_CHAR_SET),,_)
 VBOX_VERSION_HEADER = $(PATH_OUT)/version-generated.h
 VBOX_VERSION_MK     = $(PATH_OUT)/version-generated.mk
 
@@ -5625,10 +5931,19 @@ $(VBOX_VERSION_HEADER): $(VBOX_VERSION_STAMP)
 	$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_MAJOR $(VBOX_VERSION_MAJOR)'
 	$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_MINOR $(VBOX_VERSION_MINOR)'
 	$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_BUILD $(VBOX_VERSION_BUILD)'
+ifneq ($(VBOX_VERSION_PRERELEASE),)
+	$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_PRERELEASE "$(strip $(VBOX_VERSION_PRERELEASE))"'
+endif
 	$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_STRING_RAW "$(VBOX_VERSION_STRING_RAW)"'
 	$(QUIET)$(APPEND) $@.tmp '#define VBOX_VERSION_STRING "$(VBOX_VERSION_STRING)"'
 	$(QUIET)$(APPEND) $@.tmp '#define VBOX_API_VERSION_STRING "$(VBOX_API_VERSION)"'
 	$(QUIET)$(APPEND) $@.tmp ''
+ifdef VBOX_BUILD_SERVER_BUILD
+	$(QUIET)$(APPEND) $@.tmp '#define VBOX_BUILD_SERVER_BUILD 1'
+else
+	$(QUIET)$(APPEND) $@.tmp '#define VBOX_PRIVATE_BUILD_DESC "Private build by $(USERNAME)"'
+endif
+	$(QUIET)$(APPEND) $@.tmp ''
 	$(QUIET)$(APPEND) $@.tmp '#endif'
 	$(QUIET)$(MV) -f $@.tmp $@
 
@@ -5676,10 +5991,18 @@ $(VBOX_VERSION_MK): $(VBOX_VERSION_STAMP)
 	$(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_MINOR = $(VBOX_VERSION_MINOR)'
 	$(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_BUILD = $(VBOX_VERSION_BUILD)'
 	$(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_STRING = $(VBOX_VERSION_STRING)'
+ifneq ($(VBOX_VERSION_PRERELEASE),)
+	$(QUIET)$(APPEND) $@.tmp 'VBOX_VERSION_PRERELEASE = $(strip $(VBOX_VERSION_PRERELEASE))'
+endif
 	$(QUIET)$(APPEND) $@.tmp 'VBOX_VENDOR = $(VBOX_VENDOR)'
 	$(QUIET)$(APPEND) $@.tmp 'VBOX_VENDOR_SHORT = $(VBOX_VENDOR_SHORT)'
 	$(QUIET)$(APPEND) $@.tmp 'VBOX_PRODUCT = $(VBOX_PRODUCT)'
 	$(QUIET)$(APPEND) $@.tmp 'VBOX_C_YEAR = $(VBOX_C_YEAR)'
+ifdef VBOX_BUILD_SERVER_BUILD
+	$(QUIET)$(APPEND) $@.tmp 'VBOX_BUILD_SERVER_BUILD = 1'
+else
+	$(QUIET)$(APPEND) $@.tmp 'VBOX_PRIVATE_BUILD_DESC = Private build by $(USERNAME)'
+endif
 	$(QUIET)$(MV) -f $@.tmp $@
 
 if !defined(VBOX_OSE) && !defined(VBOX_NOINC_LICENSE_VER_KMK)
@@ -5728,7 +6051,7 @@ endif
 SVN                    ?= svn$(HOSTSUFF_EXE)
 VBOX_SVN_REV_KMK        = $(PATH_OUT)/revision.kmk
 ifndef VBOX_SVN_REV
- VBOX_SVN_REV_FALLBACK := $(patsubst %:,,  $Rev: 100309 $  )
+ VBOX_SVN_REV_FALLBACK := $(patsubst %:,,  $Rev: 100374 $  )
  VBOX_SVN_DEP          := $(firstword $(wildcard $(PATH_ROOT)/.svn/wc.db $(abspath $(PATH_ROOT)/../.svn/wc.db) $(abspath $(PATH_ROOT)/../../.svn/wc.db) $(PATH_ROOT)/.svn/entries))
  ifeq ($(which $(SVN)),)
   VBOX_SVN_DEP         :=
@@ -5806,7 +6129,7 @@ else
   ifeq ($(origin VBOX_JAVA_HOME),undefined)
    # Add correct detection for you distro after the /usr/../java-6-sun line.
    VBOX_JAVA_HOME := $(firstword $(wildcard \
-	$(PATH_DEVTOOLS)/linux.x86/jdk1.6.0_27 \
+	$(KBUILD_DEVTOOLS)/linux.x86/jdk1.6.0_27 \
 	/usr/lib/jvm/java-6-sun  \
 	/usr/lib/jvm/java-6-openjdk \
 	/usr/lib/jvm/java-6-openjdk-i386 \
@@ -5880,4 +6203,3 @@ st stat status:
 quick:
 	$(MAKE) VBOX_QUICK=1
 
-
diff --git a/Maintenance.kmk b/Maintenance.kmk
new file mode 100644
index 0000000..9f28f0a
--- /dev/null
+++ b/Maintenance.kmk
@@ -0,0 +1,52 @@
+# $Id: Maintenance.kmk $
+## @file
+# Maintenance makefile.
+#
+
+#
+# Copyright (C) 2006-2015 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+
+#
+# By default, only show the maintence help info.
+#
+PASS_MAINTHELP      := Maintence Help
+PASS_MAINTHELP_trgs := show-maintence-help
+PASS_MAINTHELP_vars :=
+PASS_MAINTHELP_pass := maintence-help
+
+override DEFAULT_PASSES := MAINTHELP
+
+show-maintence-help:
+	@$(ECHO) ""
+	@$(ECHO) "up update         - Update svn and fetch tools."
+	@$(ECHO) "up2 update2       - Update svn and fetch tools, ignore externals (kBuild, kStuff)."
+	@$(ECHO) "incs              - Update autogenerated assembly include files in include/."
+	@$(ECHO) "snapshot-puel     - Create a source tarball of the PUEL (closed) sources."
+	@$(ECHO) "docs docs.core    - run doxygen on core code."
+	@$(ECHO) ""
+	@$(ECHO) "Build aliases:"
+	@$(ECHO) "  both-types-archs   both-archs-types   - Do both 32-bit and 64-bit builds in both debug and release variants."
+	@$(ECHO) "  both-x86-amd64     both-amd64-x86     - Do both 32-bit and 64-bit builds for the current build type."
+	@$(ECHO) "  both-debug-release both-release-debug - Do both release and debug builds for the current target."
+	@$(ECHO) "  build-release-x86                     - Do a 32-bit release build."
+	@$(ECHO) "  build-debug-x86                       - Do a 32-bit debug build."
+	@$(ECHO) "  build-release-amd64                   - Do a 64-bit release build."
+	@$(ECHO) "  build-debug-amd64                     - Do a 64-bit debug build."
+
+#
+# Include the normal root makefile, but without dragging in sub-makefiles.
+#
+VBOX_ONLY_ROOT_MAKEFILE=1
+include $(dir $(firstword $(MAKEFILE_LIST)))Makefile.kmk
+
+
diff --git a/Makefile.kmk b/Makefile.kmk
index 45bf632..d86269e 100644
--- a/Makefile.kmk
+++ b/Makefile.kmk
@@ -61,7 +61,7 @@ OTHER_CLEAN += \
 if  !defined(VBOX_ONLY_ADDITIONS) \
  && !defined(VBOX_ONLY_DOCS) \
  && !defined(VBOX_ONLY_EXTPACKS) \
- && !defined(VBOX_ONLY_TESTSUITE) # -> line 426b ;-)
+ && !defined(VBOX_ONLY_VALIDATIONKIT) # -> line 426b ;-)
 
  if !defined(VBOX_OSE) && defined(VBOX_LICENSE_FILES)
   #
@@ -142,13 +142,19 @@ endif
 #
 # Install our Qt DLLs / Shared Objects / Frameworks.
 # Note: The installer fixes the darwin .dylibs when hardening is enabled.
+# Note: Contents/Info.plist is where it's in 4.7.x, not sure if the location is kosher... According to
+#       https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html
+#       the Info.plist file goes into Resources.
 #
 ifeq ($(KBUILD_TARGET),darwin)
+ include $(KBUILD_PATH)/units/qt4.kmk
  INSTALLS += qt4-bin
  qt4-bin_MODE = 755
  qt4-bin_INST = $(INST_VIRTUALBOX)Contents/
  qt4-bin_SOURCES = $(foreach qtmod,$(VBOX_QT4_MOD_NAMES) \
-  	,$(PATH_SDK_QT4_LIB)/$(qtmod).framework/Versions/4/$(qtmod)=>Frameworks/$(qtmod).framework/Versions/4/$(qtmod))
+  	,$(PATH_SDK_QT4_LIB)/$(qtmod).framework/Versions/4/$(qtmod)=>Frameworks/$(qtmod).framework/Versions/4/$(qtmod) \
+  	 $(PATH_SDK_QT4_LIB)/$(qtmod).framework/Contents/Info.plist=>Frameworks/$(qtmod).framework/Versions/4/Resources/Info.plist \
+       )
  ifdef VBOX_WITH_COCOA_QT
   qt4-bin_SOURCES += \
   	$(PATH_SDK_QT4_LIB)/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/classes.nib=>Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/classes.nib \
@@ -160,13 +166,12 @@ ifeq ($(KBUILD_TARGET),darwin)
   	$(VBOX_PATH_QT4)/plugins/accessible/libqtaccessiblewidgets.dylib=>MacOS/accessible/libqtaccessiblewidgets.dylib
  endif
  qt4-bin_SYMLINKS = $(foreach qtmod, $(VBOX_QT4_MOD_NAMES) \
- 		,Frameworks/$(qtmod).framework/$(qtmod)=>Versions/4/$(qtmod))
- ifdef VBOX_WITH_COCOA_QT
-  qt4-bin_SYMLINKS += \
-  	Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Resources=>Versions/4/Resources/
- endif
+ 		,Frameworks/$(qtmod).framework/Versions/Current=>4 \
+		 Frameworks/$(qtmod).framework/$(qtmod)=>Versions/4/$(qtmod) \
+		 Frameworks/$(qtmod).framework/Resources=>Versions/4/Resources)
 else
  if defined(VBOX_WITH_QT4_SUN) || defined(VBOX_WITH_QT4_PAYLOAD)
+  include $(KBUILD_PATH)/units/qt4.kmk
   ifeq ($(KBUILD_TARGET),win)
    INSTALLS += qt4-bin
    qt4-bin_MODE = 755
@@ -405,7 +410,7 @@ ifn1of ($(KBUILD_TARGET), linux win)
 
 endif
 
-endif # !VBOX_ONLY_ADDITIONS && !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_TESTSUITE
+endif # !VBOX_ONLY_ADDITIONS && !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
 
 
 ifdef VBOX_ONLY_DOCS
@@ -772,7 +777,7 @@ $(PATH_TARGET)/docs.Core: $(PATH_TARGET)/Doxyfile.Core $$(VBOX_CORE_DOXYFILE_INP
 
 
 #
-# Alias for kmk_time.  Used by both the additions and testsuite build setups.
+# Alias for kmk_time.  Used by both the additions and validation kit build setups.
 #
 VBOX_KMK_TIME = $(KBUILD_BIN_PATH)/kmk_time
 
@@ -1273,229 +1278,248 @@ extpacks-packing:
 # This is currently tailored (hardcoded) for the additions build box just like
 # the additions build above, which it in fact is a copy of.
 #
-testsuite-fetch:
-	+ $(KMK) -C tools fetch VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=darwin  BUILD_TARGET_ARCH=amd64 BUILD_TARGET=darwin    VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=darwin  BUILD_TARGET_ARCH=x86   BUILD_TARGET=darwin    VBOX_ONLY_TESTSUITE=1
-#	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=freebsd BUILD_TARGET_ARCH=amd64 BUILD_TARGET=freebsd   VBOX_ONLY_TESTSUITE=1
-#	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=freebsd BUILD_TARGET_ARCH=x86   BUILD_TARGET=freebsd   VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=linux   BUILD_TARGET_ARCH=amd64 BUILD_TARGET=linux     VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=linux   BUILD_TARGET_ARCH=x86   BUILD_TARGET=linux     VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=os2     BUILD_TARGET_ARCH=x86   BUILD_TARGET=os2       VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=solaris BUILD_TARGET_ARCH=amd64 BUILD_TARGET=solaris   VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=solaris BUILD_TARGET_ARCH=x86   BUILD_TARGET=solaris   VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=win     BUILD_TARGET_ARCH=amd64 BUILD_TARGET=win       VBOX_ONLY_TESTSUITE=1
-	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=win     BUILD_TARGET_ARCH=x86   BUILD_TARGET=win       VBOX_ONLY_TESTSUITE=1
-
-
-testsuite-build: \
-	testsuite-build-rsync-into-vms \
-	testsuite-build-solaris.amd64 \
-	testsuite-build-solaris.x86 \
-	testsuite-build-win.x86 \
-	testsuite-build-win.amd64 \
-	testsuite-build-os2.x86 \
-	testsuite-build-linux.amd64 \
-	testsuite-build-linux.x86 \
-	testsuite-build-freebsd.amd64 \
-	testsuite-build-freebsd.x86 \
-	testsuite-build-darwin.amd64 \
-	testsuite-build-darwin.x86
-
-testsuite-build-rsync-into-vms: \
-		testsuite-build-solaris.rsync-into-vm \
-		testsuite-build-os2.rsync-into-vm
+validationkit-fetch:
+	+ $(KMK) -C tools fetch VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=darwin  BUILD_TARGET_ARCH=amd64 BUILD_TARGET=darwin    VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=darwin  BUILD_TARGET_ARCH=x86   BUILD_TARGET=darwin    VBOX_ONLY_VALIDATIONKIT=1
+#	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=freebsd BUILD_TARGET_ARCH=amd64 BUILD_TARGET=freebsd   VBOX_ONLY_VALIDATIONKIT=1
+#	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=freebsd BUILD_TARGET_ARCH=x86   BUILD_TARGET=freebsd   VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=linux   BUILD_TARGET_ARCH=amd64 BUILD_TARGET=linux     VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=linux   BUILD_TARGET_ARCH=x86   BUILD_TARGET=linux     VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=os2     BUILD_TARGET_ARCH=x86   BUILD_TARGET=os2       VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=solaris BUILD_TARGET_ARCH=amd64 BUILD_TARGET=solaris   VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=solaris BUILD_TARGET_ARCH=x86   BUILD_TARGET=solaris   VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=amd64 KBUILD_TARGET=win     BUILD_TARGET_ARCH=amd64 BUILD_TARGET=win       VBOX_ONLY_VALIDATIONKIT=1
+	+ $(KMK) -C tools fetch KBUILD_TARGET_ARCH=x86   KBUILD_TARGET=win     BUILD_TARGET_ARCH=x86   BUILD_TARGET=win       VBOX_ONLY_VALIDATIONKIT=1
+
+
+validationkit-build: \
+	validationkit-build-rsync-into-vms \
+	validationkit-build-solaris.amd64 \
+	validationkit-build-solaris.x86 \
+	validationkit-build-win.x86 \
+	validationkit-build-win.amd64 \
+	validationkit-build-os2.x86 \
+	validationkit-build-linux \
+	validationkit-build-freebsd.amd64 \
+	validationkit-build-freebsd.x86 \
+	validationkit-build-darwin.amd64 \
+	validationkit-build-darwin.x86
+
+validationkit-build-rsync-into-vms: \
+		validationkit-build-solaris.rsync-into-vm \
+		validationkit-build-os2.rsync-into-vm \
+		validationkit-build-linux.rsync-into-vm
 	$(call MSG_L1,Rsynced the sources + tools into the VMs.)
-.NOTPARALLEL: testsuite-build-rsync-into-vms
+.NOTPARALLEL: validationkit-build-rsync-into-vms
+.PHONY:       validationkit-build-rsync-into-vms
 
 
-VBOX_TESTSUITE_BUILD.amd64 = VBOX_ONLY_TESTSUITE=1 \
+VBOX_VALIDATIONKIT_BUILD.amd64 = VBOX_ONLY_VALIDATIONKIT=1 \
 	KBUILD_TYPE=$(KBUILD_TYPE) BUILD_TYPE=$(KBUILD_TYPE) \
 	KBUILD_TARGET_ARCH=amd64 BUILD_TARGET_ARCH=amd64 \
 	VBOX_SVN_REV=$(VBOX_SVN_REV)
 
-VBOX_TESTSUITE_BUILD.x86 = VBOX_ONLY_TESTSUITE=1 \
+VBOX_VALIDATIONKIT_BUILD.x86 = VBOX_ONLY_VALIDATIONKIT=1 \
 	KBUILD_TYPE=$(KBUILD_TYPE) BUILD_TYPE=$(KBUILD_TYPE) \
 	KBUILD_TARGET_ARCH=x86 BUILD_TARGET_ARCH=x86 \
 	VBOX_SVN_REV=$(VBOX_SVN_REV)
 
-# Automatically determine the testsuite build subdir name. Used for figuring
+# Automatically determine the Validation Kit build subdir name. Used for figuring
 # out directory names inside the test suite building VMs.
-VBOX_TESTSUITE_BUILD_SUBDIRNAME := $(lastword $(subst /, ,$(PATH_ROOT)))
+VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME := $(lastword $(subst /, ,$(PATH_ROOT)))
 
 # When building in parallel on a Windows host, make sure we finish the host
 # bit before kicking off any UNIX guest or we'll run into file sharing issues.
 ifeq ($(KBUILD_TARGET),win)
-VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST = testsuite-build-win.x86 testsuite-build-win.amd64
+VBOX_VALIDATIONKIT_BUILD_WIN_HOST_FIRST = validationkit-build-win.x86 validationkit-build-win.amd64
 else
-VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST =
+VBOX_VALIDATIONKIT_BUILD_WIN_HOST_FIRST =
 endif
 
 # ASSUMES the 32-bit edition has been built already. Also for serializing VM access.
-testsuite-build-win.amd64: testsuite-build-win.x86
+validationkit-build-win.amd64: validationkit-build-win.x86
 ifeq ($(KBUILD_TARGET),win)
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.amd64) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.amd64) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
 else
-	$(call VBOX_BLD_VM_MSG_BEGIN,Windows/amd64 testsuite)
-	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_WIN_X86_IP) " echo $@ && cd e:/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh kmk $(VBOX_TESTSUITE_BUILD.amd64) all "
-	$(call VBOX_BLD_VM_MSG_END__,Windows/amd64 testsuite)
+	$(call VBOX_BLD_VM_MSG_BEGIN,Windows/amd64 Validation Kit)
+	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_WIN_X86_IP) " echo $@ && cd e:/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh kmk $(VBOX_VALIDATIONKIT_BUILD.amd64) all "
+	$(call VBOX_BLD_VM_MSG_END__,Windows/amd64 Validation Kit)
 endif
 
-testsuite-build-win.x86:
+validationkit-build-win.x86:
 ifeq ($(KBUILD_TARGET),win)
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.x86) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.x86) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
 else
-	$(call VBOX_BLD_VM_MSG_BEGIN,Windows/x86 testsuite)
-	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_WIN_AMD64_IP) " echo $@ && cd e:/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh kmk $(VBOX_TESTSUITE_BUILD.x86) all"
-	$(call VBOX_BLD_VM_MSG_END__,Windows/x86 testsuite)
+	$(call VBOX_BLD_VM_MSG_BEGIN,Windows/x86 Validation Kit)
+	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_WIN_AMD64_IP) " echo $@ && cd e:/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh kmk $(VBOX_VALIDATIONKIT_BUILD.x86) all"
+	$(call VBOX_BLD_VM_MSG_END__,Windows/x86 Validation Kit)
 endif
 
 ifeq ($(KBUILD_TARGET),solaris)
-testsuite-build-solaris.amd64:
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.amd64) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+validationkit-build-solaris.amd64:
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.amd64) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
 
-testsuite-build-solaris.x86:
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.x86)   all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+validationkit-build-solaris.x86:
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.x86)   all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
 
 else
-testsuite-build-solaris.rsync-into-vm: $(VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST)
-	$(VBOX_KMK_TIME) rsync -a --delete --delete-excluded --exclude .svn --exclude=FetchDir --exclude=tinderclient.log --exclude=win.amd64 --exclude=win.x86 . $(VBOX_BLD_VM_SOLARIS_IP):/mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)
-
-testsuite-build-solaris.build-it: testsuite-build-solaris.rsync-into-vm
-	$(call VBOX_BLD_VM_MSG_BEGIN,Solaris/amd64 testsuite)
-	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_SOLARIS_IP) " echo $@/amd64 && cd /mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.amd64) all"
-	$(call VBOX_BLD_VM_MSG_END__,Solaris/amd64 testsuite)
-	$(call VBOX_BLD_VM_MSG_BEGIN,Solaris/x86 testsuite)
-	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_SOLARIS_IP) " echo $@/x86   && cd /mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.x86) all "
-	$(call VBOX_BLD_VM_MSG_END__,Solaris/x86 testsuite)
-
-testsuite-build-solaris.rsync-out-of-vm: testsuite-build-solaris.build-it
-	$(VBOX_KMK_TIME) rsync -a --delete $(VBOX_BLD_VM_SOLARIS_IP):/mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)/out/solaris.x86   out/
-	$(VBOX_KMK_TIME) rsync -a --delete $(VBOX_BLD_VM_SOLARIS_IP):/mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)/out/solaris.amd64 out/
-
-.NOTPARALLEL: testsuite-build-solaris.rsync-into-vm
-.PHONY:       testsuite-build-solaris.rsync-out-of-vm testsuite-build-solaris.rsync-into-vm testsuite-build-solaris.build-it
-
-testsuite-build-solaris.amd64: testsuite-build-solaris.rsync-out-of-vm
-testsuite-build-solaris.x86:   testsuite-build-solaris.rsync-out-of-vm
+validationkit-build-solaris.rsync-into-vm: $(VBOX_VALIDATIONKIT_BUILD_WIN_HOST_FIRST)
+	$(VBOX_KMK_TIME) $(call VBOX_RSYNC_IN_FN,solaris,*) \
+		'--exclude=src/VBox/Additions/WINNT/**' \
+		'--exclude=src/VBox/Frontends/**' \
+		'--exclude=src/VBox/VMM/**' \
+		. $(VBOX_BLD_VM_SOLARIS_IP):/mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)
+
+validationkit-build-solaris.build-it: validationkit-build-solaris.rsync-into-vm
+	$(call VBOX_BLD_VM_MSG_BEGIN,Solaris/amd64 Validation Kit)
+	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_SOLARIS_IP) " echo $@/amd64 && cd /mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.amd64) all"
+	$(call VBOX_BLD_VM_MSG_END__,Solaris/amd64 Validation Kit)
+	$(call VBOX_BLD_VM_MSG_BEGIN,Solaris/x86 Validation Kit)
+	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_SOLARIS_IP) " echo $@/x86   && cd /mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.x86) all "
+	$(call VBOX_BLD_VM_MSG_END__,Solaris/x86 Validation Kit)
+
+validationkit-build-solaris.rsync-out-of-vm: validationkit-build-solaris.build-it
+	$(VBOX_KMK_TIME) rsync -a --delete $(VBOX_BLD_VM_SOLARIS_IP):/mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)/out/solaris.x86   out/
+	$(VBOX_KMK_TIME) rsync -a --delete $(VBOX_BLD_VM_SOLARIS_IP):/mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)/out/solaris.amd64 out/
+
+.PHONY:       validationkit-build-solaris.rsync-out-of-vm validationkit-build-solaris.rsync-into-vm validationkit-build-solaris.build-it
+
+validationkit-build-solaris.amd64: validationkit-build-solaris.rsync-out-of-vm
+validationkit-build-solaris.x86:   validationkit-build-solaris.rsync-out-of-vm
 endif
 
 ifeq ($(KBUILD_TARGET),os2)
-testsuite-build-os2.x86:
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.x86) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
-testsuite-build-os2.rsync-into-vm:
+validationkit-build-os2.x86:
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.x86) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
+validationkit-build-os2.rsync-into-vm:
 else # !OS/2
-testsuite-build-os2.rsync-into-vm:
+validationkit-build-os2.rsync-into-vm:
 	$(VBOX_KMK_TIME) $(call VBOX_RSYNC_IN_FN,os2,*) \
 		'--exclude=src/VBox/Additions/x11/**' \
 		'--exclude=src/VBox/Additions/WINNT/**' \
 		'--exclude=src/VBox/Frontends/**' \
 		'--exclude=src/VBox/VMM/**' \
-		. rsync://vbox@$(VBOX_BLD_VM_OS2_IP)/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)
+		. rsync://vbox@$(VBOX_BLD_VM_OS2_IP)/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)
 
-testsuite-build-os2.build-it: testsuite-build-os2.rsync-into-vm
-	$(call VBOX_BLD_VM_MSG_BEGIN,OS/2 TestSuite)
-	$(VBOX_KMK_TIME) rsh -l vbox $(VBOX_BLD_VM_OS2_IP) "cd e:\\tinderbox\\$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && e: && kbuild\\bin\\os2.x86\\kmk_ash tools\\env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.x86) all packing"
-	$(call VBOX_BLD_VM_MSG_END__,OS/2 TestSuite)
+validationkit-build-os2.build-it: validationkit-build-os2.rsync-into-vm
+	$(call VBOX_BLD_VM_MSG_BEGIN,OS/2 Validation Kit)
+	$(VBOX_KMK_TIME) rsh -l vbox $(VBOX_BLD_VM_OS2_IP) "cd e:\\tinderbox\\$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && e: && kbuild\\bin\\os2.x86\\kmk_ash tools\\env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.x86) all"
+	$(call VBOX_BLD_VM_MSG_END__,OS/2 Validation Kit)
 
-testsuite-build-os2.rsync-out-of-vm: testsuite-build-os2.build-it
-	$(VBOX_KMK_TIME) rsync -v -a --delete rsync://vbox@$(VBOX_BLD_VM_OS2_IP)/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)/out/os2.x86 ./out
+validationkit-build-os2.rsync-out-of-vm: validationkit-build-os2.build-it
+	$(VBOX_KMK_TIME) rsync -v -a --delete rsync://vbox@$(VBOX_BLD_VM_OS2_IP)/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)/out/os2.x86 ./out
 
-.NOTPARALLEL: testsuite-build-os2.rsync-into-vm
-.PHONY:       testsuite-build-os2.rsync-into-vm testsuite-build-os2.rsync-out-of-vm testsuite-build-os2.build-it
+.PHONY:       validationkit-build-os2.rsync-into-vm validationkit-build-os2.rsync-out-of-vm validationkit-build-os2.build-it
 
-testsuite-build-os2.x86: testsuite-build-os2.rsync-out-of-vm
+validationkit-build-os2.x86: validationkit-build-os2.rsync-out-of-vm
 endif # !OS/2
 
-testsuite-build-linux.amd64:   $(VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST)
-ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),linux.amd64)
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.amd64) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+ifeq ($(KBUILD_TARGET),linux)
+validationkit-build-linux.amd64:
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.amd64) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
+
+validationkit-build-linux.x86:
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.x86)   all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
+
+validationkit-build-linux: validationkit-build-linux.x86 validationkit-build-linux.amd64
 else
+validationkit-build-linux.rsync-into-vm: $(VBOX_VALIDATIONKIT_BUILD_WIN_HOST_FIRST)
+	$(VBOX_KMK_TIME) $(call VBOX_RSYNC_IN_FN,linux,*) \
+		'--exclude=src/VBox/Additions/WINNT/**' \
+		'--exclude=src/VBox/Frontends/**' \
+		'--exclude=src/VBox/VMM/**' \
+		. $(VBOX_BLD_VM_LNX_IP):/mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)
+
+validationkit-build-linux.build-it: validationkit-build-linux.rsync-into-vm
 	$(call VBOX_BLD_VM_MSG_BEGIN,Linux/amd64 Validation Kit)
-	$(VBOX_KMK_TIME) ssh 'vbox@$(VBOX_BLD_VM_LNX_IP) " echo $@/amd64 && dchroot -c debian-4.0-amd64 \"cd /mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.amd64) all\""'
+	$(VBOX_KMK_TIME) ssh 'vbox@$(VBOX_BLD_VM_LNX_IP) " echo $@/amd64 && dchroot -c debian-4.0-amd64 \"cd /mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.amd64) all\""'
 	$(call VBOX_BLD_VM_MSG_END__,Linux/amd64 Validation Kit)
-endif
-
-testsuite-build-linux.x86:   $(VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST)
-ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),linux.x86)
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.x86) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
-else
 	$(call VBOX_BLD_VM_MSG_BEGIN,Linux/x86 Validation Kit)
-	$(VBOX_KMK_TIME) ssh 'vbox@$(VBOX_BLD_VM_LNX_IP) " echo $@/x86 && linux32 dchroot -c rhel3-i386 \"cd /mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.x86) all\""'
+	$(VBOX_KMK_TIME) ssh 'vbox@$(VBOX_BLD_VM_LNX_IP) " echo $@/x86 && linux32 dchroot -c rhel3-i386 \"cd /mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.x86) all\""'
 	$(call VBOX_BLD_VM_MSG_END__,Linux/x86 Validation Kit)
+
+validationkit-build-linux.rsync-out-of-vm: validationkit-build-linux.build-it
+	$(VBOX_KMK_TIME) rsync -a --delete $(VBOX_BLD_VM_LNX_IP):/mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)/out/linux.x86   out/
+	$(VBOX_KMK_TIME) rsync -a --delete $(VBOX_BLD_VM_LNX_IP):/mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)/out/linux.amd64 out/
+
+.PHONY:       validationkit-build-linux.rsync-out-of-vm validationkit-build-linux.rsync-into-vm validationkit-build-linux.build-it
+
+validationkit-build-linux: validationkit-build-linux.rsync-out-of-vm
 endif
 
-testsuite-build-freebsd.amd64:   $(VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST)
+validationkit-build-freebsd.amd64:   $(VBOX_VALIDATIONKIT_BUILD_WIN_HOST_FIRST)
 #ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),freebsd.amd64)
-#	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.amd64) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+#	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.amd64) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
 #else
-#	$(call VBOX_BLD_VM_MSG_BEGIN,Freebsd/amd64 testsuite)
-#	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_FBSD_AMD64_IP) " echo $@ && cd /mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.amd64) all"
-#	$(call VBOX_BLD_VM_MSG_END__,Freebsd/amd64 testsuite)
+#	$(call VBOX_BLD_VM_MSG_BEGIN,Freebsd/amd64 Validation Kit)
+#	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_FBSD_AMD64_IP) " echo $@ && cd /mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.amd64) all"
+#	$(call VBOX_BLD_VM_MSG_END__,Freebsd/amd64 Validation Kit)
 #endif
 
-testsuite-build-freebsd.x86:   $(VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST)
+validationkit-build-freebsd.x86:   $(VBOX_VALIDATIONKIT_BUILD_WIN_HOST_FIRST)
 #ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),freebsd.x86)
-#	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.x86) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+#	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.x86) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
 #else
-#	$(call VBOX_BLD_VM_MSG_BEGIN,Freebsd/x86 testsuite)
-#	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_FBSD_X86_IP) " echo $@ && cd /mnt/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.x86) all"
-#	$(call VBOX_BLD_VM_MSG_END__,Freebsd/x86 testsuite)
+#	$(call VBOX_BLD_VM_MSG_BEGIN,Freebsd/x86 Validation Kit)
+#	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_FBSD_X86_IP) " echo $@ && cd /mnt/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.x86) all"
+#	$(call VBOX_BLD_VM_MSG_END__,Freebsd/x86 Validation Kit)
 #endif
 
-testsuite-build-darwin.amd64:   $(VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST)
+validationkit-build-darwin.amd64:   $(VBOX_VALIDATIONKIT_BUILD_WIN_HOST_FIRST)
 ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.amd64)
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.amd64) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.amd64) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
 else
-	$(call VBOX_BLD_VM_MSG_BEGIN,Darwin/amd64 testsuite)
-	$(VBOX_KMK_TIME) $(call VBOX_RSYNC_IN_FN,darwin,amd64) . $(VBOX_BLD_VM_DARWIN_AMD64_IP):/Users/vbox/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)
-	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_DARWIN_AMD64_IP) " echo $@ && cd /Users/vbox/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.amd64) all"
-	$(VBOX_KMK_TIME) rsync -am -v --delete $(VBOX_BLD_VM_DARWIN_AMD64_IP):/Users/vbox/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)/out/darwin.amd64 out/
-	$(call VBOX_BLD_VM_MSG_END__,Darwin/amd64 testsuite)
+	$(call VBOX_BLD_VM_MSG_BEGIN,Darwin/amd64 Validation Kit)
+	$(VBOX_KMK_TIME) $(call VBOX_RSYNC_IN_FN,darwin,amd64) . $(VBOX_BLD_VM_DARWIN_AMD64_IP):/Users/vbox/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)
+	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_DARWIN_AMD64_IP) " echo $@ && cd /Users/vbox/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.amd64) all"
+	$(VBOX_KMK_TIME) rsync -am -v --delete $(VBOX_BLD_VM_DARWIN_AMD64_IP):/Users/vbox/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)/out/darwin.amd64 out/
+	$(call VBOX_BLD_VM_MSG_END__,Darwin/amd64 Validation Kit)
 endif
 
-testsuite-build-darwin.x86:   $(VBOX_TESTSUITE_BUILD_WIN_HOST_FIRST)
+validationkit-build-darwin.x86:   $(VBOX_VALIDATIONKIT_BUILD_WIN_HOST_FIRST)
 ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),darwin.x86)
-	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_TESTSUITE_BUILD.x86) all $(VBOX_TESTSUITE_HOST_BUILD_TWEAK)
+	+ $(VBOX_KMK_TIME) $(KMK) $(VBOX_VALIDATIONKIT_BUILD.x86) all $(VBOX_VALIDATIONKIT_HOST_BUILD_TWEAK)
 else
-	$(call VBOX_BLD_VM_MSG_BEGIN,Darwin/x86 testsuite)
-	$(VBOX_KMK_TIME) $(call VBOX_RSYNC_IN_FN,darwin,x86) . $(VBOX_BLD_VM_DARWIN_X86_IP):/Users/vbox/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)
-	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_DARWIN_X86_IP) " echo $@ && cd /Users/vbox/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_TESTSUITE_BUILD.x86) all"
-	$(VBOX_KMK_TIME) rsync -am -v --delete $(VBOX_BLD_VM_DARWIN_X86_IP):/Users/vbox/tinderbox/$(VBOX_TESTSUITE_BUILD_SUBDIRNAME)/out/darwin.x86 out/
-	$(call VBOX_BLD_VM_MSG_END__,Darwin/x86 testsuite)
+	$(call VBOX_BLD_VM_MSG_BEGIN,Darwin/x86 Validation Kit)
+	$(VBOX_KMK_TIME) $(call VBOX_RSYNC_IN_FN,darwin,x86) . $(VBOX_BLD_VM_DARWIN_X86_IP):/Users/vbox/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)
+	$(VBOX_KMK_TIME) ssh vbox@$(VBOX_BLD_VM_DARWIN_X86_IP) " echo $@ && cd /Users/vbox/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME) && tools/env.sh --no-wine kmk $(VBOX_VALIDATIONKIT_BUILD.x86) all"
+	$(VBOX_KMK_TIME) rsync -am -v --delete $(VBOX_BLD_VM_DARWIN_X86_IP):/Users/vbox/tinderbox/$(VBOX_VALIDATIONKIT_BUILD_SUBDIRNAME)/out/darwin.x86 out/
+	$(call VBOX_BLD_VM_MSG_END__,Darwin/x86 Validation Kit)
 endif
 
 
-testsuite-packing:
-	+ $(KMK) VBOX_ONLY_TESTSUITE=1 \
-		VBOX_WITH_TESTSUITE_PACKING.darwin.amd64=1 \
-		VBOX_WITH_TESTSUITE_PACKING.darwin.x86=2 \
-		VBOX_WITH_TESTSUITE_PACKING.freebsd.amd64= \
-		VBOX_WITH_TESTSUITE_PACKING.freebsd.x86= \
-		VBOX_WITH_TESTSUITE_PACKING.linux.amd64=1 \
-		VBOX_WITH_TESTSUITE_PACKING.linux.x86=1 \
-		VBOX_WITH_TESTSUITE_PACKING.os2.x86=1 \
-		VBOX_WITH_TESTSUITE_PACKING.solaris.amd64=1 \
-		VBOX_WITH_TESTSUITE_PACKING.solaris.x86=1 \
-		VBOX_WITH_TESTSUITE_PACKING.win.amd64=1 \
-		VBOX_WITH_TESTSUITE_PACKING.win.x86=1 \
-		-C src/VBox/Testsuite \
-		$(PATH_OUT)/VBoxTestSuite.zip \
+validationkit-packing:
+	+ $(KMK) VBOX_ONLY_VALIDATIONKIT=1 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.darwin.amd64=1 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.darwin.x86=2 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.freebsd.amd64= \
+		VBOX_WITH_VALIDATIONKIT_PACKING.freebsd.x86= \
+		VBOX_WITH_VALIDATIONKIT_PACKING.linux.amd64=1 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.linux.x86=1 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.os2.x86=1 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.solaris.amd64=1 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.solaris.x86=1 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.win.amd64=1 \
+		VBOX_WITH_VALIDATIONKIT_PACKING.win.x86=1 \
+		-C src/VBox/ValidationKit \
+		$(PATH_OUT)/VBoxValidationKit.zip \
 		$(PATH_OUT)/VBoxTestBoxScript.zip
 
 .PHONY: \
-	testsuite-build-win.x86 \
-	testsuite-build-win.amd64 \
-	testsuite-build-solaris.amd64 \
-	testsuite-build-solaris.x86 \
-	testsuite-build-os2.x86 \
-	testsuite-build-linux.amd64 \
-	testsuite-build-linux.x86 \
-	testsuite-build-freebsd.amd64 \
-	testsuite-build-freebsd.x86 \
-	testsuite-build-darwin.amd64 \
-	testsuite-build-darwin.x86 \
-	testsuite-packing
+	validationkit-build-win.x86 \
+	validationkit-build-win.amd64 \
+	validationkit-build-solaris.amd64 \
+	validationkit-build-solaris.x86 \
+	validationkit-build-os2.x86 \
+	validationkit-build-linux \
+	validationkit-build-linux.amd64 \
+	validationkit-build-linux.x86 \
+	validationkit-build-freebsd.amd64 \
+	validationkit-build-freebsd.x86 \
+	validationkit-build-darwin.amd64 \
+	validationkit-build-darwin.x86 \
+	validationkit-packing
 
 
 #
diff --git a/configure b/configure
index 83fa74c..a77f450 100755
--- a/configure
+++ b/configure
@@ -71,6 +71,7 @@ ODIR_OVERRIDE=0
 OUT_PATH=""
 OUT_PATH_OVERRIDE=0
 SETUP_WINE=
+ONLY_ADDITIONS=0
 TARGET_MACHINE=""
 TARGET_CPU=""
 WITH_XPCOM=1
@@ -421,8 +422,9 @@ check_gcc()
              -o \( $cc_maj -eq 3 -a $cc_min -lt 2 \) \
              -o \( $cc_maj -eq 4 -a $cc_min -lt 1 -a "$OS" != "darwin" \) \
              -o \( $cc_maj -eq 4 -a $cc_min -gt 9 \) \
-             -o $cc_maj -gt 4 ]; then
-        log_failure "gcc version $cc_ver found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<10"
+             -o \( $cc_maj -eq 5 -a $cc_min -gt 1 \) \
+             -o $cc_maj -gt 5 ]; then
+        log_failure "gcc version $cc_maj.$cc_min found, expected gcc 3.x with x>1 or gcc 4.x with 0<x<10 or gcc 5.1"
         fail really
       else
         log_success "found version $cc_ver"
@@ -2116,6 +2118,26 @@ check_gsoap()
 
 
 #
+# Check Xcode path
+#
+check_xcode_sdk_path()
+{
+    # Check if WITH_XCODE_DIR is set.
+    if [ -z "$WITH_XCODE_DIR" ]; then
+        echo "Please specify --with-xcode-dir option."
+        return 0
+    fi
+
+    # Check if specified path exists and is a directory.
+    if [ -d "$1" ]; then
+        return 1
+    else
+        echo "Xcode path [$1] not found."
+        return 0
+    fi
+}
+
+#
 # Determines the Darwin version.
 # @todo This should really check the Xcode/SDK version.
 #
@@ -2124,6 +2146,33 @@ check_darwinversion()
   test_header "Darwin version"
   darwin_ver=`uname -r`
   case "$darwin_ver" in
+    14\.*)
+      check_xcode_sdk_path "$WITH_XCODE_SDK_DIR"
+      [ $? -eq 1 ] || fail
+      darwin_ver="10.10" # Yosemite
+      sdk=$WITH_XCODE_DIR/Developer/SDKs/MacOSX10.6.sdk
+      cnf_append "VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL" "1"
+      cnf_append "VBOX_PATH_MACOSX_DEVEL_ROOT" "$WITH_XCODE_DIR/Developer"
+      ;;
+    13\.*)
+      check_xcode_sdk_path "$WITH_XCODE_DIR"
+      [ $? -eq 1 ] || fail
+      darwin_ver="10.9" # Mavericks
+      sdk=$WITH_XCODE_DIR/Developer/SDKs/MacOSX10.6.sdk
+      cnf_append "VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL" "1"
+      cnf_append "VBOX_PATH_MACOSX_DEVEL_ROOT" "$WITH_XCODE_DIR/Developer"
+      ;;
+    12\.*)
+      darwin_ver="10.8" # Mountain Lion
+      if [ ! -z "$WITH_XCODE_DIR" ]; then
+        sdk=$WITH_XCODE_DIR/Developer/SDKs/MacOSX10.6.sdk
+        cnf_append "VBOX_WITH_MACOSX_COMPILERS_FROM_DEVEL" "1"
+        cnf_append "VBOX_PATH_MACOSX_DEVEL_ROOT" "$WITH_XCODE_DIR/Developer"
+      else
+        sdk=/Developer/SDKs/MacOSX10.6.sdk
+      fi
+      CXX_FLAGS="-mmacosx-version-min=10.6 -isysroot $sdk -Wl,-syslibroot,$sdk"
+      ;;
     11\.*)
       darwin_ver="10.7" # Lion
       sdk=/Developer/SDKs/MacOSX10.6.sdk
@@ -2249,6 +2298,7 @@ EOF
 EOF
 [ "$OS"   != "darwin" ] && echo "  --setup-wine             setup a Wine directory and register the hhc hack"
 cat << EOF
+  --only-additions         only build the Guest Additions
 
 Paths:
   --with-gcc=PATH          location of the gcc compiler [$CC]
@@ -2258,6 +2308,9 @@ Paths:
   --with-mkisofs=PATH      location of mkisofs [$MKISOFS]
   --with-makeself=PATH     location of makeself [$MAKESELF]
 EOF
+[ "$OS"   = "darwin" ] && echo "  --with-xcode-dir=DIR     custom path to Xcode root directory; it is assumed that Xcode"
+[ "$OS"   = "darwin" ] && echo "                           contains OS X 10.6 SDK (required for Mountain Lion and newer hosts"
+[ "$OS"   = "darwin" ] && echo "                           only, ignored for the rest)"
 [ "$OS"    = "linux" ] && echo "  --with-linux=DIR         Linux kernel source directory [$LINUX]"
 [ $WITH_QT4    -eq 1 ] && echo "  --with-qt-dir=DIR        directory for Qt4 headers/libraries [pkgconfig]"
 [ $WITH_GSOAP  -eq 1 ] && echo "  --with-gsoap-dir=PATH    directory for gSOAP compiler/headers/libraries"
@@ -2303,6 +2356,7 @@ if [ "$OS" = "darwin" ]; then
   BUILD_LIBVPX=1
   [ $OSE -eq 1 ] || BUILD_LIBCURL=1
   [ $OSE -eq 1 ] && WITH_LIBVPX=0
+  WITH_XCODE_DIR=""
 elif [ "$OS" = "haiku" ]; then
   #WITH_SDL=0
   WITH_SDL_TTF=0
@@ -2326,7 +2380,7 @@ elif [ "$OS" = "solaris" ]; then
 fi
 
 # scan command line options
-for option in $*; do
+for option in "$@"; do
   case "$option" in
     --help|-help|-h)
       show_help
@@ -2371,6 +2425,10 @@ for option in $*; do
     --with-iasl=*)
       IASL=`echo $option | cut -d'=' -f2`
       ;;
+    --with-xcode-dir=*)
+      WITH_XCODE_DIR=`echo $option | cut -d'=' -f2`
+      echo $option
+      ;;
     --with-linux=*)
       LINUX=`echo $option | cut -d'=' -f2`
       ;;
@@ -2508,6 +2566,9 @@ for option in $*; do
     --setup-wine)
       [ "$OS" != "darwin" ] && SETUP_WINE=1
       ;;
+    --only-additions)
+      ONLY_ADDITIONS=1
+      ;;
     *)
       echo
       echo "Unrecognized option \"$option\""
@@ -2601,7 +2662,9 @@ if [ $OSE -ge 1 ]; then
 fi
 
 # extpack
-if [ $OSE -eq 0 ]; then
+if [ $ONLY_ADDITIONS -eq 1 ]; then
+  cnf_append "VBOX_WITH_EXTPACK_PUEL_BUILD" ""
+elif [ $OSE -eq 0 ]; then
   if [ $WITH_EXTPACK -eq 1 ]; then
     BUILD_LIBSSL=1
   else
@@ -2637,43 +2700,47 @@ if [ "$OS" = "darwin" ]; then
 fi
 # the tools
 check_gcc
-check_open_watcom
-[ "$OS" != "darwin"  ] && check_iasl
-# don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
-# [ "$OS" != "darwin" ] && check_yasm
-[ "$OS" != "darwin"  ] && check_xsltproc
-[ "$OS" != "darwin"  ] && check_mkisofs
+if [ $ONLY_ADDITIONS -eq 0 ]; then
+  check_open_watcom
+  [ "$OS" != "darwin"  ] && check_iasl
+  # don't check for yasm for the time beeing as 0.40 and 0.50 both have known bugs
+  # [ "$OS" != "darwin" ] && check_yasm
+  [ "$OS" != "darwin"  ] && check_xsltproc
+  [ "$OS" != "darwin"  ] && check_mkisofs
+fi
 
 # the libraries
-[ "$OS" != "darwin"  ] && check_pthread
-check_libxml2
-[ $WITH_LIBIDL -eq 1 ] && check_libidl
-check_ssl
-check_curl
-[ $WITH_LIBVPX -eq 1 ] && check_vpx
-[ "$OS" != "darwin"  ] && check_z
-[ "$OS" != "darwin"  ] && check_png
-[ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
-[ $WITH_SDL -eq 1 ]    && check_sdl
-[ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
-[ $WITH_X11    -eq 1 ] && check_x
-# TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
-# TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
-[ $WITH_X11    -eq 1 ] && check_xcursor
-[ $WITH_X11    -eq 1 ] && check_xinerama
-[ $WITH_X11    -eq 1 ] && check_xrandr
-[ $WITH_OPENGL -eq 1 ] && check_opengl
-[ $WITH_QT4    -eq 1 ] && check_qt4
-[ $WITH_PYTHON -eq 1 ] && check_python
-[ $WITH_JAVA   -eq 1 ] && check_java
-
-# PulseAudio
-if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
-  if [ $WITH_PULSE -eq 1 ]; then
-    check_pulse
-  elif [ $WITH_PULSE -eq 0 ]; then
-    cnf_append "VBOX_WITH_PULSE" ""
-  fi
+if [ $ONLY_ADDITIONS -eq 0 ]; then
+  [ "$OS" != "darwin"  ] && check_pthread
+  check_libxml2
+  [ $WITH_LIBIDL -eq 1 ] && check_libidl
+  check_ssl
+  check_curl
+  [ $WITH_LIBVPX -eq 1 ] && check_vpx
+ [ "$OS" != "darwin"  ] && check_z
+  [ "$OS" != "darwin"  ] && check_png
+  [ $OSE -eq 0 -a "$OS" = "linux" ] && check_pam
+  [ $WITH_SDL -eq 1 ]    && check_sdl
+  [ $WITH_SDL_TTF -eq 1 -a $OSE -eq 0 ] && check_sdl_ttf
+  [ $WITH_X11    -eq 1 ] && check_x
+  # TODO check for xcomposite-dev (X11/extensions/Xcomposite.h, additions only)
+  # TODO check for libxdamange-dev (X11/extensions/Xdamage.h, additions only)
+  [ $WITH_X11    -eq 1 ] && check_xcursor
+  [ $WITH_X11    -eq 1 ] && check_xinerama
+  [ $WITH_X11    -eq 1 ] && check_xrandr
+  [ $WITH_OPENGL -eq 1 ] && check_opengl
+  [ $WITH_QT4    -eq 1 ] && check_qt4
+  [ $WITH_PYTHON -eq 1 ] && check_python
+  [ $WITH_JAVA   -eq 1 ] && check_java
+
+  # PulseAudio
+  if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
+    if [ $WITH_PULSE -eq 1 ]; then
+      check_pulse
+    elif [ $WITH_PULSE -eq 0 ]; then
+      cnf_append "VBOX_WITH_PULSE" ""
+    fi
+ fi
 fi
 
 # Linux-specific
@@ -2688,29 +2755,31 @@ if [ "$OS" = "linux" ]; then
     cnf_append "VBOX_WITH_VBOXDRV" ""
     cnf_append "VBOX_WITH_ADDITION_DRIVERS" ""
   fi
-  if [ $WITH_ALSA -eq 1 ]; then
-    check_alsa
-  else
-    cnf_append "VBOX_WITH_ALSA" ""
-  fi
-  if [ $WITH_DBUS -eq 0 ]; then
-    cnf_append "VBOX_WITH_DBUS" ""
-  fi
-  if [ $WITH_DEVMAPPER -eq 1 ]; then
-    check_libdevmapper
-  else
-    cnf_append "VBOX_WITH_DEVMAPPER" ""
+  if [ $ONLY_ADDITIONS -eq 0 ]; then
+    if [ $WITH_ALSA -eq 1 ]; then
+      check_alsa
+    else
+      cnf_append "VBOX_WITH_ALSA" ""
+    fi
+    if [ $WITH_DBUS -eq 0 ]; then
+      cnf_append "VBOX_WITH_DBUS" ""
+    fi
+    if [ $WITH_DEVMAPPER -eq 1 ]; then
+      check_libdevmapper
+    else
+      cnf_append "VBOX_WITH_DEVMAPPER" ""
+    fi
+    check_libcap
   fi
-  check_libcap
   check_compiler_h
-  [ "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
+  [ $ONLY_ADDITIONS -eq 0 -a "$BUILD_MACHINE" = "amd64" -a $WITH_VMMRAW -eq 1 ] && check_32bit
   # tools/common/makeself*
   [ $OSE -ge 1 ] && check_makeself
 fi
 
 [ -n "$SETUP_WINE" ] && setup_wine
 
-if [ $WITH_GSOAP -eq 1 ]; then
+if [ $ONLY_ADDITIONS -eq 0 -a $WITH_GSOAP -eq 1 ]; then
   check_gsoap
 else
   if [ $OSE -ge 1 ]; then
@@ -2719,25 +2788,25 @@ else
 fi
 
 # UDPTUNNEL
-if [ $WITH_UDPTUNNEL -eq 0 ]; then
+if [ $ONLY_ADDITIONS -eq 0 -a $WITH_UDPTUNNEL -eq 0 ]; then
   cnf_append "VBOX_WITH_UDPTUNNEL" ""
 fi
 
 # VDE
-if [ "$OS" = "linux" -o "$OS" = "freebsd" ]; then
+if [ $ONLY_ADDITIONS -eq 0 -a "$OS" = "linux" -o "$OS" = "freebsd" ]; then
   if [ $WITH_VDE -eq 1 ]; then
     cnf_append "VBOX_WITH_VDE" "1"
   fi
 fi
 
 # DOCS
-if [ $WITH_DOCS -eq 0 ]; then
+if [ $ONLY_ADDITIONS -eq 1 -o $WITH_DOCS -eq 0 ]; then
   cnf_append "VBOX_WITH_DOCS" ""
   cnf_append "VBOX_WITH_DOCS_PACKING" ""
 fi
 
 # VNC server support
-if [ $OSE -ge 1 ]; then
+if [ $ONLY_ADDITIONS -eq 0 -a $OSE -ge 1 ]; then
   if [ $WITH_VNC = 1 ]; then
     check_vncserver
   else
@@ -2745,6 +2814,10 @@ if [ $OSE -ge 1 ]; then
   fi
 fi
 
+if [ $ONLY_ADDITIONS -eq 1 ]; then
+  cnf_append "VBOX_ONLY_ADDITIONS" "1"
+fi
+
 # success!
 echo
 echo "Successfully generated '$CNF' and '$ENV'."
@@ -2765,7 +2838,11 @@ if [ "$OS" = "linux" ]; then
     echo "  make"
     echo ""
 fi
-if [ $WITH_HARDENING -gt 0 ]; then
+if [ $ONLY_ADDITIONS -eq 1 ]; then
+    echo ""
+    echo "  Tree configured to build only the Guest Additions"
+    echo ""
+elif [ $WITH_HARDENING -gt 0 ]; then
     echo ""
     echo "  +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++ WARNING +++"
     echo "  Hardening is enabled which means that the VBox binaries will not run from"
diff --git a/configure.vbs b/configure.vbs
index ca047af..adf1cf4 100644
--- a/configure.vbs
+++ b/configure.vbs
@@ -1446,7 +1446,7 @@ sub CheckForMinGW32(strOptMinGW32, strOptW32API)
    ' Success?
    if strPathMingW32 = "" then
       if g_strTargetArch = "amd64" then
-         MsgWarning "Can't locate a suitable MinGW32 installation, ignoring since we're targetting AMD64 and won't need it."
+         MsgWarning "Can't locate a suitable MinGW32 installation, ignoring since we're targeting AMD64 and won't need it."
       elseif strOptMinGW32 = "" then
          MsgError "Can't locate a suitable MinGW32 installation. Try specify the path with " _
             & "the --with-MinGW32=<path> argument. If still no luck, consult the configure.log and the build requirements."
@@ -1583,7 +1583,7 @@ sub CheckForMinGWw64(strOptMinGWw64)
    ' Success?
    if strPathMinGWw64 = "" then
       if g_strTargetArch = "x86" then
-         MsgWarning "Can't locate a suitable MinGW-w64 installation, ignoring since we're targetting x86 and won't need it."
+         MsgWarning "Can't locate a suitable MinGW-w64 installation, ignoring since we're targeting x86 and won't need it."
       elseif strOptMinGWw64 = "" then
          MsgError "Can't locate a suitable MinGW-w64 installation. Try specify the path with " _
             & "the --with-MinGW-w64=<path> argument. If still no luck, consult the configure.log and the build requirements."
diff --git a/doc/VBox-CodingGuidelines.cpp b/doc/VBox-CodingGuidelines.cpp
index d334507..0a0766a 100644
--- a/doc/VBox-CodingGuidelines.cpp
+++ b/doc/VBox-CodingGuidelines.cpp
@@ -259,6 +259,22 @@
  *   same directory and named the same
  *
  *
+ * @subsection sec_vbox_guideline_compulsory_xslt  XSLT
+ *
+ * XSLT (eXtensible Stylesheet Language Transformations) is used quite a bit in
+ * the Main API area of VirtualBox to generate sources and bindings to that API.
+ * There are a couple of common pitfalls worth mentioning:
+ *
+ *      - Never do repeated //interface[@name=...] and //enum[@name=...] lookups
+ *        because they are expensive. Instead delcare xsl:key elements for these
+ *        searches and do the lookup using the key() function. xsltproc uses
+ *        (per current document) hash tables for each xsl:key, i.e. very fast.
+ *
+ *      - When output type is 'text' make sure to call xsltprocNewlineOutputHack
+ *        from typemap-shared.inc.xsl every few KB of output, or xsltproc will
+ *        end up wasting all the time reallocating the output buffer.
+ *
+ *
  * @section sec_vbox_guideline_optional         Optional
  *
  * First part is the actual coding style and all the prefixes.  The second part
diff --git a/doc/VBox-doc.c b/doc/VBox-doc.c
index a83cec2..7fc3828 100644
--- a/doc/VBox-doc.c
+++ b/doc/VBox-doc.c
@@ -144,8 +144,8 @@
  *      - VBoxBFE - A bare metal edition which does not use COM/XPCOM (barely
  *        maintained atm).
  *  - IPRT - Runtime Library for hiding host OS differences.
- *  - Testsuite:
- *      - @ref pg_testsuite_guideline
+ *  - Validation Kit:
+ *      - @ref pg_validationkit_guideline
  *
  * @todo Make links to the components.
  *
diff --git a/doc/manual/Makefile.kmk b/doc/manual/Makefile.kmk
index 29bd67b..ce14e49 100644
--- a/doc/manual/Makefile.kmk
+++ b/doc/manual/Makefile.kmk
@@ -311,7 +311,7 @@ $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/user_ChangeL
 	$(QUIET)$(SED) -e '1,/<!--\$$VIRTUALBOX_CHANGELOG_IMPL-->/!d' \
 	               -e 's/<!--\$$VIRTUALBOX_CHANGELOG_IMPL-->//' \
 	               --output $@ $@.tmp
-	$(QUIET)var=`$(SED) -n '/!--\$$VIRTUALBOX_CHANGELOG_IMPL-->/p' $<`; \
+	var=`$(SED) -n '/!--\$$VIRTUALBOX_CHANGELOG_IMPL-->/p' $<`; \
 	               test -n "$${var}" && \
 	               $(SED) -e 's/<?xml version=\"1.0\" encoding=\"UTF-8\"?>//g' \
 	                       --append $@ $(VBOX_PATH_MANUAL_SRC)/user_ChangeLogImpl.xml; \
@@ -520,9 +520,10 @@ $(foreach f,$(VBOX_MANUAL_LANGUAGES),$(VBOX_PATH_MANUAL_OUTBASE)/$f/UserManual.p
 	$(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(PDFLATEX) UserManual.tex
 	$(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(PDFLATEX) UserManual.tex
 	$(QUIET)$(REDIRECT) -w+ti /dev/null -C $(@D) -- $(PDFLATEX) UserManual.tex
+	$(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
 	$(QUIET)$(SED) -n \
-        -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
-        $(basename $@).log
+		-e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
+		$(basename $@).log
 
 ##@todo restore this when above has been converted to INSTALLS target.	$(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
 
@@ -564,9 +565,10 @@ $(VBOX_PATH_SDK)/docs/SDKRef.pdf: \
 	$(QUIET)$(REDIRECT) -C $(<D) -- $(PDFLATEX) SDKRef.tex
 	$(QUIET)$(REDIRECT) -C $(<D) -- $(PDFLATEX) SDKRef.tex
 	$(QUIET)$(REDIRECT) -C $(<D) -- $(PDFLATEX) SDKRef.tex
+	$(QUIET)$(SED) -ne '/Warning: Hyper reference/p' $(basename $<).log
 	$(QUIET)$(SED) -n \
-        -e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
-        $(basename $<).log
+		-e '/Warning: There were \(undefined references\|multiply-defined labels\)/{p; q 1}' \
+		$(basename $<).log
 	$(QUIET)$(CP) $(<D)/SDKRef.pdf $@
 	$(call MSG_L1,Fresh LaTeX-generated PDF is now at $@)
 
diff --git a/doc/manual/en_US/SDKRef.xml b/doc/manual/en_US/SDKRef.xml
index d95c475..0a2f45a 100644
--- a/doc/manual/en_US/SDKRef.xml
+++ b/doc/manual/en_US/SDKRef.xml
@@ -141,7 +141,7 @@
           <listitem>
             <para>Internally, for portability and easier maintenance, the Main
             API is implemented using the <emphasis role="bold">Component
-            Object Model (COM),</emphasis> an interprocess mechanism for
+            Object Model (COM), </emphasis> an interprocess mechanism for
             software components originally introduced by Microsoft for
             Microsoft Windows. On a Windows host, VirtualBox will use
             Microsoft COM; on other hosts where COM is not present, it ships
@@ -835,7 +835,8 @@ export VBOX_SDK_PATH=/home/youruser/vbox-sdk
         <para>VirtualBox also comes with object-oriented web service (OOWS)
         wrappers for PHP5. These wrappers rely on the PHP SOAP
         Extension<footnote>
-            <para>See <ulink url="???">http://www.php.net/soap</ulink>.</para>
+            <para>See
+            <ulink url="https://www.php.net/soap">https://www.php.net/soap</ulink>.</para>
           </footnote>, which can be installed by configuring PHP with
         <computeroutput>--enable-soap</computeroutput>.</para>
       </sect2>
@@ -1215,20 +1216,19 @@ print version;</screen></para>
                 xreflabel="IWebsessionManager::logon()" />.</para>
 
                 <para>Upon logon, the websession manager creates one instance
-                of <xref linkend="IVirtualBox" xreflabel="IVirtualBox" /> and
-                another object of <xref linkend="ISession"
-                xreflabel="ISession" /> representing the web service session.
-                This can be retrieved using <xref
+                of <xref linkend="IVirtualBox" xreflabel="IVirtualBox" />,
+                which can be used for directly performing calls to its
+                methods, or used as a parameter for calling some methods of
+                <xref linkend="IWebsessionManager" xreflabel="IWebsessionManager" />.
+                Creating Main API session objects is performed using <xref
                 linkend="IWebsessionManager__getSessionObject"
                 xreflabel="IWebsessionManager::getSessionObject()" />.</para>
 
                 <para>(Technically, there is always only one <xref
                 linkend="IVirtualBox" xreflabel="IVirtualBox" /> object, which
-                is shared between all sessions and clients, as it is a COM
+                is shared between all websessions and clients, as it is a COM
                 singleton. However, each session receives its own managed
-                object reference to it. The <xref linkend="ISession"
-                xreflabel="ISession" /> object, however, is created and
-                destroyed for each session.)</para>
+                object reference to it.)</para>
               </listitem>
 
               <listitem>
@@ -1391,14 +1391,14 @@ string result = service.SayHello("Peter");  // invoke remote procedure</screen>a
 
             <orderedlist>
               <listitem>
-                <para>For <emphasis role="bold">C++,</emphasis> among many
+                <para>For <emphasis role="bold">C++, </emphasis> among many
                 others, the gSOAP toolkit is a good option. Parts of gSOAP are
                 also used in VirtualBox to implement the VirtualBox web
                 service.</para>
               </listitem>
 
               <listitem>
-                <para>For <emphasis role="bold">Java,</emphasis> there are
+                <para>For <emphasis role="bold">Java, </emphasis> there are
                 several implementations already described in this document
                 (see <xref linkend="glue-jax-ws" /> and <xref
                 linkend="webservice-java-sample" />).</para>
@@ -1526,7 +1526,7 @@ mgr = VirtualBoxManager(None, None)
 vbox = mgr.vbox
 name = "Linux"
 mach = vbox.findMachine(name)
-session = mgr.mgr.getSessionObject(vbox)
+session = mgr.getSessionObject(vbox)
 progress = mach.launchVMProcess(session, "gui", "")
 progress.waitForCompletion(-1)
 mgr.closeMachineSession(session)
@@ -1547,7 +1547,7 @@ print "Machine '%s' logs in '%s'" %(m.name, m.logFolder)
         <computeroutput>vbox.machines</computeroutput> to access a list of
         available virtual machines in case of XPCOM), and a mechanism of
         uniform session creation and closing
-        (<computeroutput>mgr.mgr.getSessionObject()</computeroutput>).</para>
+        (<computeroutput>mgr.getSessionObject()</computeroutput>).</para>
 
         <para>In case you want to use the glue layer with a different Python
         installation, use these steps in a shell to add the necessary
@@ -1761,7 +1761,7 @@ print "Machine '%s' logs in '%s'" %(m.name, m.logFolder)
           <para>The sample program <computeroutput>tstCAPIGlue</computeroutput>
           can be built using the provided <computeroutput>Makefile</computeroutput>
           and can be run without arguments.</para>
-          
+
           <para>It uses the VBoxCAPIGlue library (source code is in directory
           <computeroutput>sdk/bindings/c/glue</computeroutput>, to be used in
           your API client code) to open the C binding layer during runtime,
@@ -1819,7 +1819,7 @@ if (VBoxCGlueInit())
             argv[0], g_szVBoxErrMsg);
     return EXIT_FAILURE;
 }
-    
+
 g_pVBoxFuncs->pfnClientInitialize(NULL, &vboxclient);
 if (!vboxclient)
 {
@@ -1875,7 +1875,7 @@ if (!vboxclient)
           attribute name. Unless the attribute is read-only, an analogous
           <computeroutput>set_</computeroutput> method exists. Let's apply
           these rules to get the <computeroutput>IVirtualBox</computeroutput>
-          reference, an <computeroutput>ISession</computeroutput> instance 
+          reference, an <computeroutput>ISession</computeroutput> instance
           reference and read the <xref linkend="IVirtualBox__revision"
           xreflabel="IVirtualBox::revision" /> attribute:<screen>rc = IVirtualBoxClient_get_VirtualBox(vboxclient, &vbox);
 if (FAILED(rc) || !vbox)
@@ -2266,7 +2266,7 @@ String name = machine.getName();</screen>Boolean attribute getters can
     </sect1>
 
     <sect1>
-      <title>Changing machine settings. Sessions</title>
+      <title>Changing machine settings: Sessions</title>
 
       <para>As said in the previous section, to read a machine's attribute,
       one invokes the corresponding "get" method. One would think that to
@@ -2290,11 +2290,11 @@ String name = machine.getName();</screen>Boolean attribute getters can
       "sessions", in particular, the <xref linkend="ISession"
       xreflabel="ISession" /> interface. Each process which talks to
       VirtualBox needs its own instance of ISession. In the web service, you
-      cannot create such an object, but
-      <computeroutput>vboxwebsrv</computeroutput> creates one for you when you
-      log on, which you can obtain by calling <xref
+      can request the creation of such an object by calling <xref
       linkend="IWebsessionManager__getSessionObject"
-      xreflabel="IWebsessionManager::getSessionObject()" />.</para>
+      xreflabel="IWebsessionManager::getSessionObject()" />. More complex
+      management tasks might need multiple instances of ISession, and each call
+      returns a new one.</para>
 
       <para>This session object must then be used like a mutex semaphore in
       common programming environments. Before you can change machine settings,
@@ -2477,7 +2477,8 @@ es.unregisterListener(listener); </screen></para>
             format = "vdi"
 
         # Call VirtualBox API, using context's fields
-        hdd = ctx['vb'].createHardDisk(format, loc)
+        hdd = ctx['vb'].createMedium(format, loc, ctx['global'].constants.AccessMode_ReadWrite, \
+                                     ctx['global'].constants.DeviceType_HardDisk)
         # Access constants using ctx['global'].constants
         progress = hdd.createBaseStorage(size, (ctx['global'].constants.MediumVariant_Standard, ))
         # use standard progress bar mechanism
@@ -3489,6 +3490,97 @@ extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *pt
     </sect1>
   </chapter>
 
+  <chapter id="dnd">
+    <title>Drag'n Drop</title>
+
+    <para>Since VirtualBox 4.2 it's possible to transfer files from host to the
+    Linux guests by dragging files, directories or text from the host into the
+    guest's screen. This is called <emphasis>drag'n drop (DnD)</emphasis>.</para>
+
+    <para>In version 5.0 support for Windows guests has been added, as well as
+    the ability to transfer data the other way around, that is, from the guest
+    to the host.</para>
+
+    <note><para>Currently only the VirtualBox Manager frontend supports drag'n
+      drop.</para></note>
+
+    <para>This chapter will show how to use the required interfaces provided
+    by VirtualBox for adding drag'n drop functionality to third-party
+    frontends.</para>
+
+    <sect1>
+      <title>Basic concepts</title>
+
+      <para>In order to use the interfaces provided by VirtualBox, some basic
+      concepts needs to be understood first: To successfully initiate a
+      drag'n drop operation at least two sides needs to be involved, a
+      <emphasis>source</emphasis> and a <emphasis>target</emphasis>:</para>
+
+      <para>The <emphasis>source</emphasis> is the side which provides the data,
+      e.g. is the origin of data. This data can be stored within the source directly
+      or can be retrieved on-demand by the source itself. Other interfaces don't
+      care where the data from this source actually came from.</para>
+
+      <para>The <emphasis>target</emphasis> on the other hand is the side which
+      provides the source a visual representation where the user can drop the
+      data the source offers. This representation can be a window (or just a certain
+      part of it), for example.</para>
+
+      <para>The source and the target have abstract interfaces called
+      <xref linkend="IDnDSource" xreflabel="IDnDSource" /> and
+      <xref linkend="IDnDTarget" xreflabel="IDnDTarget" />. VirtualBox also
+      provides implementations of both interfaces, called
+      <xref linkend="IGuestDnDSource" xreflabel="IGuestDnDSource" /> and
+      <xref linkend="IGuestDnDTarget" xreflabel="IGuestDnDTarget" />. Both
+      implementations are also used in the VirtualBox Manager frontend.</para>
+    </sect1>
+
+    <sect1>
+      <title>Supported formats</title>
+
+      <para>As the target needs to perform specific actions depending on the data
+      the source provided, the target first needs to know what type of data it
+      actually is going to retrieve. It might be that the source offers data the
+      target cannot (or intentionally does not want to) support.</para>
+
+      <para>VirtualBox handles those data types by providing so-called
+      <emphasis>MIME types</emphasis> -- these MIME types were originally defined
+      in <ulink url="https://tools.ietf.org/html/rfc2046">RFC 2046</ulink> and
+      are also called <emphasis>Content-types</emphasis>.
+      <xref linkend="IGuestDnDSource" xreflabel="IGuestDnDSource" /> and
+      <xref linkend="IGuestDnDTarget" xreflabel="IGuestDnDTarget" /> support
+      the following MIME types by default:<itemizedlist>
+          <listitem>
+            <para><emphasis role="bold">text/uri-list</emphasis> - A list of URIs
+            (Uniform Resource Identifier, see
+            <ulink url="https://tools.ietf.org/html/rfc3986">RFC 3986</ulink>)
+            pointing to the file and/or directory paths already transferred from
+            the source to the target.</para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">text/plain;charset=utf-8</emphasis> and
+            <emphasis role="bold">UTF8_STRING</emphasis> - text in UTF8 format.</para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">text/plain, TEXT</emphasis>
+            and <emphasis role="bold">STRING</emphasis> - plain ASCII text, depending
+            on the source's active ANSI page (if any).</para>
+          </listitem>
+        </itemizedlist>
+      </para>
+
+      <para>If, for whatever reason, a certain default format should not be supported
+      or a new format should be registered,
+      <xref linkend="IDnDSource" xreflabel="IDnDSource" /> and
+      <xref linkend="IDnDTarget" xreflabel="IDnDTarget" /> have methods derived from
+      <xref linkend="IDnDBase" xreflabel="IDnDBase" /> which provide adding,
+      removing and enumerating specific formats.
+      <note><para>Registering new or removing default formats on the guest side
+      currently is not implemented.</para></note></para>
+    </sect1>
+
+  </chapter>
+
   <chapter id="vbox-auth">
     <title>VirtualBox external authentication modules</title>
 
@@ -3621,7 +3713,7 @@ AuthResult AUTHCALL AuthEntry(
       the package is named <computeroutput>org.virtualbox_3_2</computeroutput>
       for VirtualBox version 3.2. <itemizedlist>
           <listitem>
-            <para><emphasis role="bold">XPCOM:</emphasis> - for all platforms,
+            <para><emphasis role="bold">XPCOM</emphasis> - for all platforms,
             but Microsoft Windows. A Java bridge based on JavaXPCOM is shipped
             with VirtualBox. The classpath must contain
             <computeroutput>vboxjxpcom.jar</computeroutput> and the
@@ -3636,7 +3728,7 @@ AuthResult AUTHCALL AuthEntry(
           </listitem>
 
           <listitem>
-            <para><emphasis role="bold">COM:</emphasis> - for Microsoft
+            <para><emphasis role="bold">COM</emphasis> - for Microsoft
             Windows. We rely on <computeroutput>Jacob</computeroutput> - a
             generic Java to COM bridge - which has to be installed seperately.
             See <ulink
@@ -3760,11 +3852,382 @@ AuthResult AUTHCALL AuthEntry(
     existing client code.</para>
 
     <sect1>
+      <title>Incompatible API changes with version 5.0</title>
+
+      <itemizedlist>
+        <listitem>
+          <para>The methods for saving state, adopting a saved state file,
+          discarding a saved state, taking a snapshot, restoring
+          a snapshot and deleting a snapshot have been moved from
+          <computeroutput>IConsole</computeroutput> to
+          <computeroutput>IMachine</computeroutput>. This straightens out the
+          logical placement of methods and was necessary to resolve a
+          long-standing issue, preventing 32 bit API clients from invoking
+          those operations in the case where no VM is running.
+          <itemizedlist>
+            <listitem><xref linkend="IMachine__saveState"
+                xreflabel="IMachine::saveState()" /> replaces
+              <computeroutput>IConsole::saveState()</computeroutput>
+            </listitem>
+            <listitem>
+              <xref linkend="IMachine__adoptSavedState"
+                xreflabel="IMachine::adoptSavedState()" /> replaces
+              <computeroutput>IConsole::adoptSavedState()</computeroutput>
+            </listitem>
+            <listitem>
+              <xref linkend="IMachine__discardSavedState"
+                xreflabel="IMachine::discardSavedState()" /> replaces
+              <computeroutput>IConsole::discardSavedState()</computeroutput>
+            </listitem>
+            <listitem>
+              <xref linkend="IMachine__takeSnapshot"
+                xreflabel="IMachine::takeSnapshot()" /> replaces
+              <computeroutput>IConsole::takeSnapshot()</computeroutput>
+            </listitem>
+            <listitem>
+              <xref linkend="IMachine__deleteSnapshot"
+                xreflabel="IMachine::deleteSnapshot()" /> replaces
+              <computeroutput>IConsole::deleteSnapshot()</computeroutput>
+            </listitem>
+            <listitem>
+              <xref linkend="IMachine__deleteSnapshotAndAllChildren"
+                xreflabel="IMachine::deleteSnapshotAndAllChildren()" /> replaces
+              <computeroutput>IConsole::deleteSnapshotAndAllChildren()</computeroutput>
+            </listitem>
+            <listitem>
+               <xref linkend="IMachine__deleteSnapshotRange"
+                xreflabel="IMachine::deleteSnapshotRange()" /> replaces
+               <computeroutput>IConsole::deleteSnapshotRange()</computeroutput>
+             </listitem>
+             <listitem>
+               <xref linkend="IMachine__restoreSnapshot"
+                xreflabel="IMachine::restoreSnapshot()" /> replaces
+               <computeroutput>IConsole::restoreSnapshot()</computeroutput>
+             </listitem>
+           </itemizedlist>
+          Small adjustments to the parameter lists have been made to reduce
+          the number of API calls when taking online snapshots etc.</para>
+        </listitem>
+
+        <listitem>
+          <para>Two new machine states have been introduced to allow proper
+          distinction between saving state and taking a snapshot.
+          <xref linkend="MachineState__Saving" xreflabel="MachineState::Saving" />
+          now is used exclusively while the VM's state is being saved, without
+          any overlaps with snapshot functionality. The new state
+          <xref linkend="MachineState__Snapshotting" xreflabel="MachineState::Snapshotting" />
+          is used when an offline snapshot is taken and likewise the new state
+          <xref linkend="MachineState__OnlineSnapshotting" xreflabel="MachineState::OnlineSnapshotting" />
+          is used when an online snapshot is taken.</para>
+        </listitem>
+
+        <listitem>
+          <para>A new event has been introduced, which signals when a snapshot has been
+          restored:
+          <xref linkend="ISnapshotRestoredEvent" xreflabel="ISnapshotRestoredEvent"/>.
+          Previously the event
+          <xref linkend="ISnapshotDeletedEvent" xreflabel="ISnapshotDeletedEvent"/> was
+          signalled, which isn't logical (but could be distinguished from actual deletion
+          by the fact that the snapshot was still there).</para>
+        </listitem>
+
+        <listitem>
+          <para>The method <xref linkend="IVirtualBox__createMedium"
+          xreflabel="IVirtualBox::createMedium()" /> replaces
+          <computeroutput>VirtualBox::createHardDisk()</computeroutput>.
+          Adjusting existing code needs adding two parameters with
+          value <computeroutput>AccessMode_ReadWrite</computeroutput>
+          and <computeroutput>DeviceType_HardDisk</computeroutput>
+          respectively. The new method supports creating floppy and
+          DVD images, and (less obviously) further API functionality
+          such as cloning floppy images.</para>
+        </listitem>
+
+        <listitem>
+          <para>The attribute <computeroutput>IMachine::sessionType</computeroutput>
+          has been renamed to <xref linkend="IMachine__sessionName"
+          xreflabel="IMachine::sessionName()" />. This cleans up the confusing
+          terminology (as the session type is something different).</para>
+        </listitem>
+
+        <listitem><para>Drag'n drop APIs were changed as follows:<itemizedlist>
+
+          <listitem>
+            <para>Methods for providing host to guest drag'n drop functionality,
+              such as <computeroutput>IGuest::dragHGEnter</computeroutput>,
+              <computeroutput>IGuest::dragHGMove()</computeroutput>,
+              <computeroutput>IGuest::dragHGLeave()</computeroutput>,
+              <computeroutput>IGuest::dragHGDrop()</computeroutput> and
+              <computeroutput>IGuest::dragHGPutData()</computeroutput>,
+              have been moved to an abstract base class called
+              <xref linkend="IDnDTarget" xreflabel="IDnDTarget" />. VirtualBox implements
+              this base class in the <xref linkend="IGuestDnDTarget" xreflabel="IGuestDnDTarget" />
+              interface. The implementation can be used by using the
+              <xref linkend="IGuest__dnDTarget" xreflabel="IGuest::dnDTarget()" /> method.</para>
+            <para>Methods for providing guest to host drag'n drop functionality,
+              such as <computeroutput>IGuest::dragGHPending()</computeroutput>,
+              <computeroutput>IGuest::dragGHDropped()</computeroutput> and
+              <computeroutput>IGuest::dragGHGetData()</computeroutput>,
+              have been moved to an abstract base class called
+              <xref linkend="IDnDSource" xreflabel="IDnDSource" />. VirtualBox implements
+              this base class in the <xref linkend="IGuestDnDSource" xreflabel="IGuestDnDSource" />
+              interface. The implementation can be used by using the
+              <xref linkend="IGuest__dnDSource" xreflabel="IGuest::dnDSource()" /> method.</para>
+          </listitem>
+
+          <listitem>
+            <para>The <computeroutput>DragAndDropAction</computeroutput> enumeration has been
+              renamed to <xref linkend="DnDAction" xreflabel="DnDAction" />.</para>
+          </listitem>
+
+          <listitem>
+            <para>The <computeroutput>DragAndDropMode</computeroutput> enumeration has been
+              renamed to <xref linkend="DnDMode" xreflabel="DnDMode" />.</para>
+          </listitem>
+
+          <listitem>
+            <para>The attribute <computeroutput>IMachine::dragAndDropMode</computeroutput>
+              has been renamed to <xref linkend="IMachine__dnDMode" xreflabel="IMachine::dnDMode()" />.</para>
+          </listitem>
+
+          <listitem>
+            <para>The event <computeroutput>IDragAndDropModeChangedEvent</computeroutput>
+              has been renamed to <xref linkend="IDnDModeChangedEvent" xreflabel="IDnDModeChangedEvent" />.</para>
+          </listitem>
+
+          <listitem>
+            <para>The callback method <computeroutput>IInternalSessionControl::onDragAndDropModeChange</computeroutput>
+              has been renamed to <xref linkend="IInternalSessionControl__onDnDModeChange" xreflabel="IInternalSessionControl::onDnDModeChange()" />.</para>
+          </listitem>
+
+          </itemizedlist></para>
+        </listitem>
+
+        <listitem><para>IDisplay and IFramebuffer interfaces were changed to allow IFramebuffer
+          object to reside in a separate frontend process:<itemizedlist>
+
+          <listitem><para>
+            IDisplay::ResizeCompleted() has been removed, because the IFramebuffer object
+            does not provide the screen memory anymore.
+          </para></listitem>
+
+          <listitem><para>
+            IDisplay::SetFramebuffer() has been replaced with IDisplay::AttachFramebuffer()
+            and IDisplay::DetachFramebuffer().
+          </para></listitem>
+
+          <listitem><para>
+            IDisplay::GetFramebuffer() has been replaced with IDisplay::QueryFramebuffer().
+          </para></listitem>
+
+          <listitem><para>
+            IDisplay::GetScreenResolution() has a new output parameter
+            <computeroutput>guestMonitorStatus</computeroutput>
+            which tells whether the monitor is enabled in the guest.
+          </para></listitem>
+
+          <listitem><para>
+            IDisplay::TakeScreenShot() and IDisplay::TakeScreenShotToArray() have a new parameter
+            <computeroutput>bitmapFormat</computeroutput>. As a consequence of this,
+            IDisplay::TakeScreenShotPNGToArray() has been removed.
+          </para></listitem>
+
+          <listitem><para>
+            IFramebuffer::RequestResize() has been replaced with IFramebuffer::NotifyChange().
+          </para></listitem>
+
+          <listitem><para>
+            IFramebuffer::NotifyUpdateImage() added to support IFramebuffer objects in a different process.
+          </para></listitem>
+
+          <listitem><para>
+            IFramebuffer::Lock(), IFramebuffer::Unlock(), IFramebuffer::Address(), IFramebuffer::UsesGuestVRAM()
+            have been removed because  the IFramebuffer object does not provide the screen memory anymore.
+          </para></listitem>
+
+          </itemizedlist></para>
+        </listitem>
+
+        <listitem><para>IGuestSession, IGuestFile and IGuestProcess interfaces were changed as follows:
+          <itemizedlist>
+            <listitem>
+              <para>Replaced IGuestSession::directoryQueryInfo and IGuestSession::fileQueryInfo with a new
+                 <xref linkend="IGuestSession__fsObjQueryInfo" xreflabel="IGuestSession::fsObjQueryInfo"/> method
+                 that works on any type of file system object.</para>
+            </listitem>
+            <listitem>
+              <para>Replaced IGuestSession::fileRemove, IGuestSession::symlinkRemoveDirectory and
+                 IGuestSession::symlinkRemoveFile with a new
+                 <xref linkend="IGuestSession__fsObjRemove" xreflabel="IGuestSession::fsObjRemove"/> method that works
+                 on any type of file system object except directories. (fileRemove also worked on any type of object too,
+                 though that was not the intent of the method.)</para>
+            </listitem>
+            <listitem>
+              <para>Replaced IGuestSession::directoryRename and IGuestSession::directoryRename with a new
+                 <xref linkend="IGuestSession__fsObjRename" xreflabel="IGuestSession::fsObjRename"/> method that works
+                 on any type of file system object. (directoryRename and fileRename may already have worked for any kind
+                 of object, but that was never the intent of the methods.)</para>
+            </listitem>
+            <listitem>
+              <para>Replaced the unimplemented IGuestSession::directorySetACL and IGuestSession::fileSetACL with a new
+                 <xref linkend="IGuestSession__fsObjSetACL" xreflabel="IGuestSession::fsObjSetACL"/> method that works
+                 on all type of file system object. Also added a UNIX-style mode parameter as an alternative to the ACL.</para>
+            </listitem>
+            <listitem>
+              <para>Replaced IGuestSession::fileRemove, IGuestSession::symlinkRemoveDirectory and
+                 IGuestSession::symlinkRemoveFile with a new
+                 <xref linkend="IGuestSession__fsObjRemove" xreflabel="IGuestSession::fsObjRemove"/> method that works
+                 on any type of file system object except directories (fileRemove also worked on any type of object,
+                 though that was not the intent of the method.)</para>
+            </listitem>
+            <listitem>
+              <para>Renamed IGuestSession::copyTo to <xref linkend="IGuestSession__fileCopyToGuest"
+                 xreflabel="IGuestSession::fileCopyToGuest"/>.</para>
+            </listitem>
+            <listitem>
+              <para>Renamed IGuestSession::copyFrom to <xref linkend="IGuestSession__fileCopyFromGuest"
+                 xreflabel="IGuestSession::fileCopyFromGuest"/>.</para>
+            </listitem>
+            <listitem>
+              <para>Renamed the CopyFileFlag enum to <xref linkend="FileCopyFlag" xreflabel="FileCopyFlag"/>.</para>
+            </listitem>
+            <listitem>
+              <para>Renamed the IGuestSession::environment attribute to <xref linkend="IGuestSession__environmentChanges"
+                xreflabel="IGuestSession::environmentChanges"/> to better reflect what it does.</para>
+            </listitem>
+            <listitem>
+              <para>Changed the <xref linkend="IProcess__environment" xreflabel="IGuestProcess::environment"/> to
+               a stub returning E_NOTIMPL since it wasn't doing what was advertised (returned changes, not the
+               actual environment).</para>
+            </listitem>
+            <listitem>
+              <para>Renamed IGuestSession::environmentSet to <xref linkend="IGuestSession__environmentScheduleSet"
+                xreflabel="IGuestSession::environmentScheduleSet"/> to better reflect what it does.</para>
+            </listitem>
+            <listitem>
+              <para>Renamed IGuestSession::environmentUnset to <xref linkend="IGuestSession__environmentScheduleUnset"
+                xreflabel="IGuestSession::environmentScheduleUnset"/> to better reflect what it does.</para>
+            </listitem>
+            <listitem>
+              <para>Removed IGuestSession::environmentGet it was only getting changes while giving the impression it was
+                actual environment variables, and it did not represent scheduled unset operations.</para>
+            </listitem>
+            <listitem>
+              <para>Removed IGuestSession::environmentClear as it duplicates assigning an empty array to the
+                <xref linkend="IGuestSession__environmentChanges" xreflabel="IGuestSession::environmentChanges"/> (formerly
+                known as IGuestSession::environment).</para>
+            </listitem>
+            <listitem>
+              <para>Changed the <xref linkend="IGuestSession__processCreate" xreflabel="IGuestSession::processCreate"/> and
+              <xref linkend="IGuestSession__processCreateEx" xreflabel="IGuestSession::processCreateEx"/> methods to accept
+              arguments starting with argument zero (argv[0]) instead of argument one (argv[1]). (Not yet implemented on the
+              guest additions side, so argv[0] will probably be ignored for a short while.)</para>
+            </listitem>
+
+            <listitem>
+              <para>Added a followSymlink parameter to the following methods:<itemizedlist>
+                <listitem><para><xref linkend="IGuestSession__directoryExists"
+                  xreflabel="IGuestSession::directoryExists"/></para></listitem>
+                <listitem><para><xref linkend="IGuestSession__fileExists"
+                  xreflabel="IGuestSession::fileExists"/></para></listitem>
+                <listitem><para><xref linkend="IGuestSession__fileQuerySize"
+                  xreflabel="IGuestSession::fileQuerySize"/></para></listitem>
+              </itemizedlist></para>
+            </listitem>
+            <listitem>
+              <para>The parameters to the <xref linkend="IGuestSession__fileOpen" xreflabel="IGuestSession::fileOpen"/>
+                and <xref linkend="IGuestSession__fileOpenEx" xreflabel="IGuestSession::fileOpenEx"/> methods were
+                altered:<itemizedlist>
+                <listitem><para>The openMode string parameter was replaced by the enum
+                  <xref linkend="FileAccessMode" xreflabel="FileAccessMode"/> and renamed to accessMode.</para></listitem>
+                <listitem><para>The disposition string parameter was replaced by the enum
+                  <xref linkend="FileOpenAction" xreflabel="FileOpenAction"/> and renamed to openAction.</para></listitem>
+                <listitem><para>The unimplemented sharingMode string parameter was replaced by the enum
+                  <xref linkend="FileSharingMode" xreflabel="FileSharingMode"/> (fileOpenEx only).</para></listitem>
+                <listitem><para>Added a flags parameter taking a list of <xref linkend="FileOpenExFlags"
+                  xreflabel="FileOpenExFlags"/> values (fileOpenEx only).</para></listitem>
+                <listitem><para>Removed the offset parameter (fileOpenEx only).</para></listitem>
+              </itemizedlist></para>
+            </listitem>
+
+            <listitem>
+              <para><xref linkend="IFile__seek" xreflabel="IGuestFile::seek"/> now returns the new offset.</para>
+            </listitem>
+            <listitem>
+              <para>Renamed the FileSeekType enum used by <xref linkend="IFile__seek" xreflabel="IGuestFile::seek"/>
+                to <xref linkend="FileSeekOrigin" xreflabel="FileSeekOrigin"/> and added the missing End value
+                and renaming the Set to Begin.</para>
+            </listitem>
+            <listitem>
+              <para>Extended the unimplemented <xref linkend="IFile__setACL" xreflabel="IGuestFile::setACL"/>
+                method with a UNIX-style mode parameter as an alternative to the ACL.</para>
+            </listitem>
+            <listitem>
+              <para>Renamed the IFile::openMode attribute to <xref linkend="IFile__accessMode" xreflabel="IFile::accessMode"/>
+                and change the type from string to <xref linkend="FileAccessMode" xreflabel="FileAccessMode"/> to reflect
+                the changes to the fileOpen methods.</para>
+            </listitem>
+            <listitem>
+              <para>Renamed the IGuestFile::disposition attribute to <xref linkend="IFile__openAction"
+                xreflabel="IFile::openAction"/> and change the type from string to <xref linkend="FileOpenAction"
+                xreflabel="FileOpenAction"/> to reflect the changes to the fileOpen methods.</para>
+            </listitem>
+
+            <!-- Non-incompatible things worth mentioning (stubbed methods/attrs aren't worth it). -->
+            <listitem>
+              <para>Added <xref linkend="IGuestSession__pathStyle" xreflabel="IGuestSession::pathStyle"/> attribute.</para>
+            </listitem>
+            <listitem>
+              <para>Added <xref linkend="IGuestSession__fsObjExists" xreflabel="IGuestSession::fsObjExists"/> attribute.</para>
+            </listitem>
+
+          </itemizedlist>
+          </para>
+        </listitem>
+
+        <listitem><para>
+          IConsole::GetDeviceActivity() returns information about multiple devices.
+        </para></listitem>
+
+        <listitem><para>
+          IMachine::ReadSavedThumbnailToArray() has a new parameter
+          <computeroutput>bitmapFormat</computeroutput>. As a consequence of this,
+          IMachine::ReadSavedThumbnailPNGToArray() has been removed.
+        </para></listitem>
+
+        <listitem><para>
+          IMachine::QuerySavedScreenshotPNGSize() has been renamed to
+          IMachine::QuerySavedScreenshotInfo() which also returns
+          an array of available screenshot formats.
+        </para></listitem>
+
+        <listitem><para>
+          IMachine::ReadSavedScreenshotPNGToArray() has been renamed to
+          IMachine::ReadSavedScreenshotToArray() which  has a new parameter
+          <computeroutput>bitmapFormat</computeroutput>.
+        </para></listitem>
+
+        <listitem><para>
+          IMachine::QuerySavedThumbnailSize() has been removed.
+        </para></listitem>
+
+        <listitem>
+          <para>The method <xref linkend="IWebsessionManager__getSessionObject"
+          xreflabel="IWebsessionManager::getSessionObject()" /> now returns
+          a new <xref linkend="ISession" xreflabel="ISession" /> instance for
+          every invocation. This puts the behavior in line with other binding
+          styles, which never forced the equivalent of establishing another
+          connection and logging in again to get another instance.</para>
+        </listitem>
+      </itemizedlist>
+    </sect1>
+
+    <sect1>
       <title>Incompatible API changes with version 4.3</title>
 
       <itemizedlist>
         <listitem>
-          <para>The explicit medium locking methods 
+          <para>The explicit medium locking methods
             <xref linkend="IMedium__lockRead" xreflabel="IMedium::lockRead()" />
             and <xref linkend="IMedium__lockWrite" xreflabel="IMedium::lockWrite()" />
             have been redesigned. They return a lock token object reference
@@ -3915,7 +4378,7 @@ AuthResult AUTHCALL AuthEntry(
           event there needs to be at least the 4.3 Guest Additions installed on
           the guest. At the moment only the states "Idle" and "InUse" of the
           <xref linkend="GuestUserState"
-          xreflabel="GuestUserState" /> enum are supported on
+          xreflabel="GuestUserState" /> enumeration are supported on
           Windows guests, starting at Windows 2000 SP2.</para>
         </listitem>
 
@@ -3991,10 +4454,8 @@ AuthResult AUTHCALL AuthEntry(
                 xreflabel="IGuestSession::symlinkExists()" />,
                 <xref linkend="IGuestSession__symlinkRead"
                 xreflabel="IGuestSession::symlinkRead()" />,
-                <xref linkend="IGuestSession__symlinkRemoveDirectory"
-                xreflabel="IGuestSession::symlinkRemoveDirectory()" /> and
-                <xref linkend="IGuestSession__symlinkRemoveFile"
-                xreflabel="IGuestSession::symlinkRemoveFile()" /> are not
+                IGuestSession::symlinkRemoveDirectory() and
+                IGuestSession::symlinkRemoveFile() are not
                 implemented yet.</para>
               </listitem>
               <listitem><para>The directory APIs
@@ -4002,10 +4463,8 @@ AuthResult AUTHCALL AuthEntry(
                 xreflabel="IGuestSession::directoryRemove()" />,
                 <xref linkend="IGuestSession__directoryRemoveRecursive"
                 xreflabel="IGuestSession::directoryRemoveRecursive()" />,
-                <xref linkend="IGuestSession__directoryRename"
-                xreflabel="IGuestSession::directoryRename()" /> and
-                <xref linkend="IGuestSession__directorySetACL"
-                xreflabel="IGuestSession::directorySetACL()" /> are not
+                IGuestSession::directoryRename() and
+                IGuestSession::directorySetACL() are not
                 implemented yet.</para>
               </listitem>
               <listitem><para>The temporary file creation API
@@ -4431,9 +4890,9 @@ AuthResult AUTHCALL AuthEntry(
           result, a number of media-related APIs had to be modified again.
           <itemizedlist>
               <listitem>
-                <para>Neither <xref linkend="IVirtualBox__createHardDisk"
-                xreflabel="IVirtualBox::createHardDisk()" /> nor <xref
-                linkend="IVirtualBox__openMedium"
+                <para>Neither
+                <computeroutput>IVirtualBox::createHardDisk()</computeroutput>
+                nor <xref linkend="IVirtualBox__openMedium"
                 xreflabel="IVirtualBox::openMedium()" /> register media
                 automatically any more.</para>
               </listitem>
@@ -4530,9 +4989,7 @@ AuthResult AUTHCALL AuthEntry(
 
               <listitem>
                 <para><computeroutput>IConsole::forgetSavedState</computeroutput>
-                has been renamed to <xref
-                linkend="IConsole__discardSavedState"
-                xreflabel="IConsole::discardSavedState()" />.</para>
+                has been renamed to <computeroutput>IConsole::discardSavedState()</computeroutput>.</para>
               </listitem>
             </itemizedlist></para>
         </listitem>
@@ -4785,7 +5242,7 @@ AuthResult AUTHCALL AuthEntry(
         <listitem>
           <para>When creating a VM configuration with <xref
           linkend="IVirtualBox__createMachine"
-          xreflabel="IVirtualBox::createMachine" />) it is now possible to
+          xreflabel="IVirtualBox::createMachine()" /> it is now possible to
           ignore existing configuration files which would previously have
           caused a failure. For this the
           <computeroutput>override</computeroutput> parameter was
@@ -4793,12 +5250,12 @@ AuthResult AUTHCALL AuthEntry(
         </listitem>
 
         <listitem>
-          <para>Deleting snapshots via <xref
-          linkend="IConsole__deleteSnapshot"
-          xreflabel="IConsole::deleteSnapshot()" /> is now possible while the
-          associated VM is running in almost all cases. The API is unchanged,
-          but client code that verifies machine states to determine whether
-          snapshots can be deleted may need to be adjusted.</para>
+          <para>Deleting snapshots via
+          <computeroutput>IConsole::deleteSnapshot()</computeroutput> is now
+          possible while the associated VM is running in almost all cases.
+          The API is unchanged, but client code that verifies machine states
+          to determine whether snapshots can be deleted may need to be
+          adjusted.</para>
         </listitem>
 
         <listitem>
@@ -4812,8 +5269,7 @@ AuthResult AUTHCALL AuthEntry(
           extended to require an additional
           <computeroutput>screenId</computeroutput> parameter: <itemizedlist>
               <listitem>
-                <para><xref linkend="IMachine__querySavedThumbnailSize"
-                xreflabel="IMachine::querySavedThumbnailSize()" /></para>
+                <para>IMachine::querySavedThumbnailSize()</para>
               </listitem>
 
               <listitem>
@@ -4822,12 +5278,12 @@ AuthResult AUTHCALL AuthEntry(
               </listitem>
 
               <listitem>
-                <para><xref linkend="IMachine__querySavedScreenshotPNGSize"
+                <para><xref linkend="IMachine__querySavedScreenshotInfo"
                 xreflabel="IMachine::querySavedScreenshotPNGSize()" /></para>
               </listitem>
 
               <listitem>
-                <para><xref linkend="IMachine__readSavedScreenshotPNGToArray"
+                <para><xref linkend="IMachine__readSavedScreenshotToArray"
                 xreflabel="IMachine::readSavedScreenshotPNGToArray()" /></para>
               </listitem>
             </itemizedlist></para>
@@ -4908,18 +5364,15 @@ AuthResult AUTHCALL AuthEntry(
         <listitem>
           <para>There were substantial changes related to snapshots, triggered
           by the "branched snapshots" functionality introduced with version
-          3.1. IConsole::discardSnapshot was renamed to <xref
-          linkend="IConsole__deleteSnapshot"
-          xreflabel="IConsole::deleteSnapshot()" />.
+          3.1. IConsole::discardSnapshot was renamed to
+          <computeroutput>IConsole::deleteSnapshot()</computeroutput>.
           IConsole::discardCurrentState and
           IConsole::discardCurrentSnapshotAndState were removed; corresponding
-          new functionality is in <xref linkend="IConsole__restoreSnapshot"
-          xreflabel="IConsole::restoreSnapshot()" />. Also, when <xref
-          linkend="IConsole__takeSnapshot"
-          xreflabel="IConsole::takeSnapshot()" /> is called on a running
-          virtual machine, a live snapshot will be created. The old behavior
-          was to temporarily pause the virtual machine while creating an
-          online snapshot.</para>
+          new functionality is in <computeroutput>IConsole::restoreSnapshot()</computeroutput>.
+          Also, when <computeroutput>IConsole::takeSnapshot()</computeroutput>
+          is called on a running virtual machine, a live snapshot will be
+          created. The old behavior was to temporarily pause the virtual
+          machine while creating an online snapshot.</para>
         </listitem>
 
         <listitem>
diff --git a/doc/manual/en_US/images/dnd-modes.png b/doc/manual/en_US/images/dnd-modes.png
new file mode 100644
index 0000000..ad5f62e
Binary files /dev/null and b/doc/manual/en_US/images/dnd-modes.png differ
diff --git a/doc/manual/en_US/images/vbox-components.png b/doc/manual/en_US/images/vbox-components.png
index 441192c..45ad6e5 100644
Binary files a/doc/manual/en_US/images/vbox-components.png and b/doc/manual/en_US/images/vbox-components.png differ
diff --git a/doc/manual/en_US/user_AdvancedTopics.xml b/doc/manual/en_US/user_AdvancedTopics.xml
index 6b81646..d223eb4 100644
--- a/doc/manual/en_US/user_AdvancedTopics.xml
+++ b/doc/manual/en_US/user_AdvancedTopics.xml
@@ -943,7 +943,7 @@ host path or identifier</screen>
     </sect2>
 
     <sect2>
-      <title>Linux hosts</title>
+      <title>Linux and Solaris hosts</title>
 
       <para>When the webcam is detached from the host the emulated webcam device is
       automatically detached from the guest only if the webcam is streaming video.
@@ -1789,15 +1789,19 @@ VBoxManage setextradata "VM name"
         with VirtualBox 4.1 and requires Solaris 11 build 159 or above.</para>
       </footnote> A VirtualBox VNIC template is a VNIC whose name starts with
     "vboxvnic_template" (case-sensitive).</para>
+ 
+    <para>On Solaris 11 hosts<footnote><para>When Crossbow based bridged
+    networking is used.</para></footnote>, a VNIC template may be used to
+    specify the VLAN ID to use while bridging over a network link.</para>
 
-    <para>Here is an example of how to use a VNIC template to configure a VLAN
-    for VMs. Create a VirtualBox VNIC template, by executing as root:</para>
+    <para>Here is an example of how to use a VNIC template to configure a VM
+    over a VLAN. Create a VirtualBox VNIC template, by executing as root:</para>
 
     <screen>dladm create-vnic -t -l nge0 -v 23 vboxvnic_template0</screen>
 
-    <para>This will create a temporary VNIC over interface "nge0" with the
-    VLAN ID 23. To create VNIC templates that are persistent across host
-    reboots, skip the <computeroutput>-t</computeroutput> parameter in the
+    <para>This will create a temporary VNIC template over interface "nge0"
+    with the VLAN ID 23. To create VNIC templates that are persistent across
+    host reboots, skip the <computeroutput>-t</computeroutput> parameter in the
     above command. You may check the current state of links using:</para>
 
     <para><screen>$ dladm show-link
@@ -1810,16 +1814,19 @@ $ dladm show-vnic
 LINK         OVER         SPEED  MACADDRESS        MACADDRTYPE         VID
 vboxvnic_template0 nge0   1000   2:8:20:25:12:75   random              23</screen></para>
 
-    <para>Once the VNIC template is created, all VMs that need to be part of
-    VLAN 23 over the physical interface "nge0" can use the same VNIC template.
-    This makes managing VMs on VLANs simpler and efficient, as the VLAN
-    details are not stored as part of every VM's configuration but rather
-    picked from the VNIC template which can be modified anytime using
-    <computeroutput>dladm</computeroutput>. Apart from the VLAN ID, VNIC
-    templates can be created with additional properties such as bandwidth
-    limits, CPU fanout etc. Refer to your Solaris network documentation on how
-    to accomplish this. These additional properties, if any, are also applied
-    to VMs which use the VNIC template.</para>
+    <para>Once the VNIC template is created, any VMs that need to be on VLAN
+    23 over the interface "nge0" can be configured to bridge using this VNIC
+    template.</para>
+
+    <para>VNIC templates makes managing VMs on VLANs simpler and efficient.
+    The VLAN details are not stored as part of every VM's configuration but
+    rather inherited from the VNIC template while starting the VM. The VNIC
+    template itself can be modified anytime using <computeroutput>dladm</computeroutput>.</para>
+
+    <para>VNIC templates can be created with additional properties such as
+    bandwidth limits, CPU fanout etc. Refer to your Solaris network
+    documentation on how to accomplish this. These additional properties,
+    if any, are also applied to VMs which bridge using the VNIC template.</para>
   </sect1>
 
   <sect1 id="addhostonlysolaris">
@@ -1828,34 +1835,57 @@ vboxvnic_template0 nge0   1000   2:8:20:25:12:75   random              23</scree
 
     <para>By default VirtualBox provides you with one host-only network
     interface. Adding more host-only network interfaces on Solaris hosts
-    requires manual configuration. Here's how to add two more host-only
-    network interfaces.</para>
+    requires manual configuration. Here's how to add another host-only
+    network interface.</para>
 
-    <para>You first need to stop all running VMs and unplumb all existing
-    "vboxnet" interfaces. Execute the following commands as root:</para>
+    <para>Begin by stopping all running VMs. Then, unplumb the existing
+    "vboxnet0" interface by execute the following command as root:</para>
 
     <screen>ifconfig vboxnet0 unplumb</screen>
 
-    <para>Once you make sure all vboxnet interfaces are unplumbed, remove the
-    driver using:</para>
+    <para>If you have several vboxnet interfaces, you will need to unplumb
+    all of them. Once all vboxnet interfaces are unplumbed, remove the
+    driver by executing the following command as root:</para>
+
+    <screen>rem_drv vboxnet</screen>
+    
+    <para>Edit the file <computeroutput>/platform/i86pc/kernel/drv/vboxnet.conf</computeroutput>
+    and add a line for the new interface we want to add as shown below:</para>
+
+    <screen>name="vboxnet" parent="pseudo" instance=1;
+name="vboxnet" parent="pseudo" instance=2;</screen>
+
+    <para>Add as many of these lines as required with each line having a
+    unique instance number.</para>
 
-    <para><screen>rem_drv vboxnet</screen>then edit the file
-    <computeroutput>/platform/i86pc/kernel/drv/vboxnet.conf</computeroutput>
-    and add a line for the new interfaces:</para>
+    <para>Next, reload the vboxnet driver by executing the following command
+    as root:</para>
 
-    <para><screen>name="vboxnet" parent="pseudo" instance=1;
-name="vboxnet" parent="pseudo" instance=2;</screen>Add as many of these lines
-    as required and make sure "instance" number is uniquely incremented. Next
-    reload the vboxnet driver using:</para>
+    <screen>add_drv vboxnet</screen>
 
-    <para><screen>add_drv vboxnet</screen>Now plumb all the interfaces using
-    <computeroutput>ifconfig vboxnetX plumb</computeroutput> (where X can be
-    0, 1 or 2 in this case) and once plumbed you can then configure the
-    interface like any other network interface.</para>
+    <para>On Solaris 11.1 and newer hosts you may want to rename the default
+    vanity interface name. To check what name has been assigned, execute:</para>
 
-    <para>To make your newly added interfaces' settings persistent across
-    reboots you will need to edit the files
-    <computeroutput>/etc/netmasks</computeroutput>, and if you are using NWAM
+    <screen>dladm show-phys
+LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
+net0              Ethernet             up         100    full      e1000g0
+net2              Ethernet             up         1000   full      vboxnet1
+net1              Ethernet             up         1000   full      vboxnet0</screen>
+
+    <para>In the above example, we can rename "net2" to "vboxnet1" before
+    proceeding to plumb the interface. This can be done by executing as root:</para>
+
+    <screen>dladm rename-link net2 vboxnet1</screen>
+
+    <para>Now plumb all the interfaces using
+    <computeroutput>ifconfig vboxnetX plumb</computeroutput> (where 'X' would
+    be 1 in this case). Once the interface is plumbed, it may be configured
+    like any other network interface. Refer to the
+    <computeroutput>ifconfig</computeroutput> documentation for further details.</para>
+
+    <para>To make the newly added interfaces' settings persistent across
+    reboots, you will need to edit the files
+    <computeroutput>/etc/inet/netmasks</computeroutput>, and if you are using NWAM
     <computeroutput>/etc/nwam/llp</computeroutput> and add the appropriate
     entries to set the netmask and static IP for each of those interfaces. The
     VirtualBox installer only updates these configuration files for the one
@@ -1912,6 +1942,31 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
     for example <computeroutput>core.vb.VBoxHeadless.11321</computeroutput>.</para>
   </sect1>
 
+  <sect1 id="vboxandsolzvmm">
+    <title>VirtualBox and Solaris kernel zones</title>
+
+    <para>Solaris kernel zones on x86-based systems make use of hardware-assisted
+    virtualization features like VirtualBox does. However, for kernel zones and
+    VirtualBox to share this hardware resource, they need to co-operate.</para>
+
+    <para>By default, due to performance reasons, VirtualBox acquires the
+    hardware-assisted virtualization resource (VT-x/AMD-V) globally on the
+    host machine and uses it until the last VirtualBox VM that requires it is
+    powered off. This prevents other software from using VT-x/AMD-V during the
+    time VirtualBox has taken control of it.</para>
+
+    <para>VirtualBox can be instructed to relinquish use of hardware-assisted
+    virtualization features when not executing guest code, thereby allowing
+    kernel zones to make use of them. To do this, shutdown all VirtualBox VMs
+    and execute the following command:</para>
+
+    <screen>VBoxManage setproperty hwvirtexclusive off</screen>
+
+    <para>This command needs to be executed only once as the setting is stored
+    as part of the global VirtualBox settings which will continue to persist
+    across host-reboots and VirtualBox upgrades.</para>
+  </sect1>
+
   <sect1 id="guitweaks">
     <title>Locking down the VirtualBox manager GUI</title>
 
@@ -2603,7 +2658,7 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
             <para>Don't allow to switch the VM into scale mode.</para>
           </glossdef>
         </glossentry>
-      
+
       </glosslist>
 
       <para>This is a per-VM setting. Any combination of the above is allowed. To restore
@@ -2812,7 +2867,7 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
         default is to show a message window which instructs the user to
         open a bug report.</para>
       <para>This behavior can be configured:</para>
-        
+
       <para><screen>VBoxManage setextradata "VM name" GUI/GuruMeditationHandler MODE</screen></para>
 
       <para>where <computeroutput>MODE</computeroutput> is one of the
@@ -2845,6 +2900,50 @@ VBoxManage setextradata "VM name" VBoxInternal2/CoreDumpLive 1</screen>At
       <para>This is a per-VM setting.</para>
     </sect2>
 
+    <sect2>
+      <title>Configuring automatic mouse capturing</title>
+
+      <para>
+        By default, the mouse is captured if the user clicks on the guest window
+        and the guest expects relative mouse coordiantes at this time. This
+        happens if the pointing device is configured as PS/2 mouse and the guest did
+        not (yet) start the VirtualBox Guest Additions (for instance, the guest is
+        booting or no Guest Additions installed at all) or if the pointing device
+        is configured as USB tablet but the guest has no USB driver loaded yet.
+        Once the Guest Additions become active or the USB guest driver is started,
+        the mouse capture is automatically released.
+      </para>
+      <para>
+        The default behavior is sometimes not desired. Therefore it can be configured:
+      </para>
+      <para><screen>VBoxManage setextradata "VM name" GUI/MouseCapturePolicy MODE</screen></para>
+
+      <para>where <computeroutput>MODE</computeroutput> is one of the
+        following keywords:</para><glosslist>
+        <glossentry>
+          <glossterm><computeroutput>Default</computeroutput></glossterm>
+          <glossdef>
+            <para>The default behavior as described above.</para>
+          </glossdef>
+        </glossentry>
+        <glossentry>
+          <glossterm><computeroutput>HostComboOnly</computeroutput></glossterm>
+          <glossdef>
+            <para>The mouse is only captured if the Host Key is toggled.</para>
+          </glossdef>
+        </glossentry>
+        <glossentry>
+          <glossterm><computeroutput>Disabled</computeroutput></glossterm>
+          <glossdef>
+            <para>The mouse is never captured, also not by toggling the Host Key</para>
+          </glossdef>
+        </glossentry>
+      </glosslist>
+
+      <para>This is a per-VM setting.</para>
+
+    </sect2>
+
     <sect2 id="mouse-capture">
       <title>Configuring automatic mouse capturing</title>
 
@@ -3564,4 +3663,213 @@ VBoxManage setextradata "VM name" VBoxInternal/CPUM/SSE4.2 1</screen>
 
   </sect1>
 
+  <sect1 id="usbtrafficcapturing">
+    <title>Capturing USB traffic for selected devices</title>
+
+    <para>
+      Starting with VirtualBox 5.0 it is possible to capture USB traffic for
+      single USB devices or on the root hub level which captures the traffic of
+      all USB devices attached to the root hub. VirtualBox stores the traffic
+      in a format which is compatible with Wireshark. To capture the traffic
+      of a specific USB device it must be attached to the VM with VBoxManage
+      using the following command:
+    </para>
+
+    <screen>VBoxManage controlvm "VM name" usbattach "device uuid|address" --capturefile "filename"</screen>
+
+    <para>
+      In order to enable capturing on the root hub use the following command
+      while the VM is not running:
+    </para>
+
+    <screen>VBoxManage setextradata "VM name" VBoxInternal/Devices/usb-ehci/LUN#0/Config/CaptureFilename "filename"</screen>
+
+    The command above enables capturing on the root hub attached to the EHCI controller.
+    To enable it for the OHCI or XHCI controller replace <computeroutput>usb-ehci</computeroutput>
+    with <computeroutput>usb-ohci</computeroutput> or <computeroutput>usb-xhci</computeroutput> respectively.
+
+  </sect1>
+
+  <sect1 id="heartbeatservice">
+    <title>Configuring the heartbeat service</title>
+    <para>
+      VirtualBox ships a simple heartbeat service. Once the Guest Additions are
+      active, the guest sends frequent heartbeat pings to the host. If the guest
+      stops sending the heartbeat pings without properly termination the service,
+      the VM process will log this event in the VBox.log file. In the future it
+      might be possible to configure dedicated actions but for there is only a
+      warning in the log file.</para>
+
+    <para>
+      There are two parameters to configure. The <emphasis>heartbeat interval</emphasis>
+      defines the time between two heartbeat pings. The default value is 2 seconds, that
+      is, the heartbeat service of the VirtualBox Guest Additions will send a heartbeat
+      ping every two seconds. The value in nanoseconds can be configured like this:
+    </para>
+    <screen>VBoxManage controlvm "VM name" VBoxInternal/Devices/VMMDev/0/Config/HeartbeatInterval 2000000000</screen>
+    <para>
+      The <emphasis>heartbeat timeout</emphasis> defines the time the host waits
+      starting from the last heartbeat ping before it defines the guest as unresponsive.
+      The default value is 2 times the heartbeat interval (4 seconds) and can be configured
+      as following (in nanoseconds):
+    </para>
+
+    <screen>VBoxManage controlvm "VM name" VBoxInternal/Devices/VMMDev/0/Config/HeartbeatTimeout 4000000000</screen>
+
+    <para>
+      If the heartbeat timeout expires, there will be a log message like
+      <emphasis>VMMDev: HeartBeatCheckTimer: Guest seems to be unresponsive. Last heartbeat
+        received 5 seconds ago.</emphasis>
+      If another heartbeat ping arrives after this warning, there will be a log
+      message like
+      <emphasis>VMMDev: GuestHeartBeat: Guest is alive.</emphasis>
+    </para>
+
+  </sect1>
+
+  <sect1 id="diskencryption">
+    <title>Encryption of disk images</title>
+
+    <para>
+      Starting with VirtualBox 5.0, it is possible to encrypt the data stored in
+      hard disk images transparently for the guest. It does not depend on a specific
+      image format to be used. Images which have the data encrypted are not portable
+      between VirtualBox and other virtualization software though.
+    </para>
+
+    <para>
+      VirtualBox uses the AES algorithm in XTS mode and supports 128 or 256 bit
+      data encryption keys (DEK).
+      The DEK is stored encrypted in the medium properties and is decrypted during
+      VM startup by entering a password which was chosen when the image was encrypted.
+    </para>
+
+    <sect2 id="diskencryption-limitations">
+      <title>Limitations</title>
+
+      <para>
+        There are some limitations the user needs to be aware of when using this
+        feature:
+      </para>
+
+      <itemizedlist>
+
+        <listitem>
+          <para>This feature is currently closed source and requires the VirtualBox extension
+            pack to be installed to work.</para>
+        </listitem>
+
+        <listitem>
+          <para>Since encryption works only on the stored user data,
+            it is currently not possible to check for metadata integrity of the disk image.
+            Attackers might take advantage of this to remove or insert blocks of data
+            into the image or change certain metadata items such as the disk size.</para>
+        </listitem>
+
+        <listitem>
+          <para>Exporting appliances which contain encrypted disk images is not
+            possible because the OVF specification doesn't support this.
+            All images are therefore decrypted during export.</para>
+        </listitem>
+
+        <listitem>
+          <para>The DEK is kept in memory while the VM is running to be able to
+            decrypt data read and encrypt data written by the guest. While this should
+            be obvious the user needs to be aware of this because an attacker might be able
+            to extract the key on a compromised host and get access to the data later.</para>
+        </listitem>
+
+        <listitem>
+          <para>When encrypting or decrypting the images, the password is passed unencrypted
+            via the Main API from the frontend to VBoxSVC. This needs to be kept in mind,
+            especially when using third party frontends which make use of the webservice
+            where the password might be transmitted unencrypted over the network.</para>
+        </listitem>
+
+        <listitem>
+          <para>Encrypting images with differencing images is only possible if there
+            are no branches. This limitation may be addressed in a future
+            VirtualBox version.</para>
+        </listitem>
+
+      </itemizedlist>
+
+    </sect2>
+
+    <sect2 id="diskencryption-encryption">
+      <title>Encrypting disk images</title>
+
+      <para>
+        Encrypting disk images can be done either using the GUI or VBoxManage.
+        While the GUI is easier to use, it works on a per VM basis and encrypts
+        all disk images attached to the specific VM.
+        With VBoxManage one can encrypt individual images (including all differencing
+        images). To encrypt an unencrypted medium with VBoxManage, use:
+      </para>
+
+      <screen>VBoxManage encryptmedium "uuid|filename" --newpassword "file|-" --cipher "cipher id" --newpasswordid "id"</screen>
+
+      <para>
+        To supply the encryption password point VBoxManage to the file where the
+        password is stored or specify <computeroutput>-</computeroutput> to let VBoxManage
+        ask you for the password on the command line.
+      </para>
+      <para>
+        The cipher parameter specifies the cipher to use for encryption and can be either
+        <computeroutput>AES-XTS128-PLAIN64</computeroutput> or <computeroutput>AES-XTS256-PLAIN64</computeroutput>.
+        The specified password identifier can be freely chosen by the user and is
+        used for correct identification when supplying multiple passwords during
+        VM startup.
+      </para>
+      <para>
+        If the user uses the same password when encrypting multiple images and also the
+        same password identifier, the user needs to supply the password only once during
+        VM startup.
+      </para>
+    </sect2>
+
+    <sect2 id="diskencryption-startvm">
+      <title>Starting a VM with encrypted images</title>
+
+      <para>
+        When a VM is started using the GUI, a dialog will open where the user
+        needs to enter all passwords for all encrypted images attached to the VM.
+        If another frontend like VBoxHeadless is used, the VM will be paused as soon
+        as the guest tries to access an encrypted disk.
+        The user needs to provide the passwords through VBoxManage using the following
+        command:
+      </para>
+
+      <screen>VBoxManage controlvm "uuid|vmname" addencpassword "id" "password" [--removeonsuspend "yes|no"]</screen>
+
+      <para>
+        The <computeroutput>id</computeroutput> parameter must be the same as the password identifier
+        supplied when encrypting the images. <computeroutput>password</computeroutput> is the password
+        used when encrypting the images. The user can optionally specify
+        <computeroutput>--removeonsuspend "yes|no"</computeroutput> to specify whether
+        to remove the password from VM memory when the VM is suspended. Before the VM can be
+        resumed, the user needs to supply the passwords again. This is useful when
+        a VM is suspended by a host suspend event and the user doesn't want
+        the password to remain in memory.
+      </para>
+    </sect2>
+
+    <sect2 id="diskencryption-decryption">
+      <title>Decrypting encrypted images</title>
+
+      <para>
+        In some circumstances it might be required to decrypt previously encrypted
+        images. This can be done in the GUI for a complete VM or using VBoxManage
+        with the following command:
+      </para>
+
+      <screen>VBoxManage encryptmedium "uuid|filename" --oldpassword "file|-"</screen>
+
+      <para>
+        The only required parameter is the password the image was encrypted with.
+        The options are the same as for encrypting images.
+      </para>
+    </sect2>
+  </sect1>
+
 </chapter>
diff --git a/doc/manual/en_US/user_BasicConcepts.xml b/doc/manual/en_US/user_BasicConcepts.xml
index fb050c1..5eb8ba7 100644
--- a/doc/manual/en_US/user_BasicConcepts.xml
+++ b/doc/manual/en_US/user_BasicConcepts.xml
@@ -97,8 +97,8 @@
           11 Express)</glossterm>
 
           <glossdef>
-            <para>Fully supported (32 bits and 64 bits). Guest Additions are
-            available.</para>
+            <para>Fully supported (64 bits, prior to Solaris 11 11/11 also 32 bits).
+            Guest Additions are available.</para>
           </glossdef>
         </glossentry>
 
@@ -297,11 +297,18 @@
         </listitem>
 
         <listitem>
-          <para><emphasis role="bold">USB.</emphasis> VirtualBox emulates two
-          USB host controllers, EHCI and OHCI. There is a need for two host
-          controllers because OHCI only handles USB low- and full-speed
+          <para><emphasis role="bold">USB.</emphasis> VirtualBox emulates three
+          USB host controllers: xHCI, EHCI, and OHCI. While xHCI handles all USB
+          transfer speeds, only guest operating systems released approximately
+          after 2011 support xHCI. Note that for Windows 7 guests, 3rd party
+          drivers must be installed for xHCI support.</para>
+          <para>
+          Older operating systems typically support OHCI and EHCI. The two
+          controllers are needed because OHCI only handles USB low- and full-speed
           devices (both USB 1.x and 2.0), while EHCI only handles high-speed
-          devices (USB 2.0 only). The emulated USB controllers do not
+          devices (USB 2.0 only).</para>
+          <para>
+          The emulated USB controllers do not
           communicate directly with devices on the host but rather with a
           virtual USB layer which abstracts the USB protocol and allows the
           use of remote USB devices.</para>
@@ -369,7 +376,7 @@
 
       <para><glosslist>
           <glossentry>
-            <glossterm>Snapshot folder</glossterm>
+            <glossterm>Snapshot Folder</glossterm>
 
             <glossdef>
               <para>By default, VirtualBox saves snapshot data together with
@@ -380,7 +387,7 @@
           </glossentry>
 
           <glossentry>
-            <glossterm>Shared clipboard</glossterm>
+            <glossterm>Shared Clipboard</glossterm>
 
             <glossdef>
               <para>You can select here whether the clipboard of the guest
@@ -395,7 +402,7 @@
               otherwise; see <xref linkend="guestadditions" /> for
               details.</para>
 
-            <para>The shared clipboard is disabled by default. See
+              <para>The shared clipboard is disabled by default. See
               <xref linkend="security_clipboard"/> for an explanation. This
               setting can be changed at any time using the "Shared Clipboard"
               menu item in the "Devices" menu of the virtual machine.</para>
@@ -405,29 +412,35 @@
           <glossentry>
             <glossterm>Drag'n'Drop</glossterm>
             <glossdef>
-              <para>This setting allows to enable Drag and Drop: Select a file
-                on the desktop, click the left mouse button, move the mouse
-                to the VM window and release the mouse button. The file is
-                copied from the host to the guest. This feature is currently
-                only implemented for Linux guests and only for copying files
-                from the host to the guest.<footnote><para>Support
-                for Drag'n'Drop was added with VirtualBox 4.2</para></footnote></para>
+              <para>This setting allows to enable support for drag'n drop: Select
+              an object (e.g. a file) from the host or guest and directly copy
+              or open it on the guest or host. Multiple per-VM drag'n drop modes
+              allow restricting access in either direction.</para>
+
+              <para>For drag'n drop to work the Guest Additions need to be
+              installed on the guest.</para>
+
+              <note>Drag'n drop is disabled by default. This setting can be
+              changed at any time using the "Drag'n'Drop" menu item in the
+              "Devices" menu of the virtual machine.</note>
+
+              <para>See <xref linkend="guestadd-dnd"/> for more information.</para>
+
+              <footnote><para>Experimental support for drag and drop was added
+              with VirtualBox 4.2.</para></footnote>
             </glossdef>
           </glossentry>
 
           <glossentry>
-            <glossterm>Removable media: remember runtime changes</glossterm>
-
+            <glossterm>Removable Media</glossterm>
             <glossdef>
               <para>If this is checked, VirtualBox will save the state of what
-              media has been mounted between several runs of a virtual
-              machine.</para>
+              media has been mounted between several runs of a virtual machine.</para>
             </glossdef>
           </glossentry>
 
           <glossentry>
-            <glossterm>Mini toolbar</glossterm>
-
+            <glossterm>Mini ToolBar</glossterm>
             <glossdef>
               <para>In full screen or seamless mode, VirtualBox can display a
               small toolbar that contains some of the items that are normally
@@ -524,9 +537,11 @@
               modern ICH9 chipset, which supports PCI express, three PCI
               buses, PCI-to-PCI bridges and Message Signaled Interrupts
               (MSI). This allows modern operating systems to address more PCI
-              devices and no longer requires IRQ sharing. Note that the ICH9
-              support is experimental and not recommended for guest operating
-              systems which do not require it.</para>
+              devices and no longer requires IRQ sharing. Using the ICH9 chipset
+              it is also possible to configure up to 36 network cards (up to 8
+              network adapters with PIIX3). Note that the ICH9 support is
+              experimental and not recommended for guest operating systems which
+              do not require it.</para>
             </glossdef>
           </glossentry>
 
@@ -694,6 +709,14 @@
       VT-x) features, then you can expect a significant performance increase
       by enabling nested paging in addition to hardware virtualization. For
       technical details, see <xref linkend="nestedpaging" />.</para>
+      
+      <para>Starting with version 5.0, VirtualBox provides paravirtualization
+      interfaces to improve time-keeping accuracy and performance of guest
+      operating systems. The options available are documented under the
+      <computeroutput>paravirtprovider</computeroutput> option
+      in <xref linkend="vboxmanage-modifyvm" />. For futher details on
+      the paravirtualization providers, please refer to
+      <xref linkend="gimproviders" />.</para>
     </sect2>
   </sect1>
 
@@ -716,7 +739,7 @@
           screen resolution and the color depth of the host display as well
           as of the activation of <emphasis>3D acceleration</emphasis> and
           <emphasis>2D video acceleration</emphasis>. A rough estimate
-          is (<emphasis>color depth</emphasis> / 8) x 
+          is (<emphasis>color depth</emphasis> / 8) x
           <emphasis>vertical pixels</emphasis> x
           <emphasis>horizontal pixels</emphasis> x
           <emphasis>number of screens</emphasis> = <emphasis>number of bytes</emphasis>.
@@ -1026,8 +1049,8 @@
     <para>Ever since the original IBM PC, personal computers have been
     equipped with one or two serial ports (also called COM ports by DOS and
     Windows). Serial ports were commonly used with modems, and some
-    computer mice used to be connected to serial ports before USB became 
-    commonplace. 
+    computer mice used to be connected to serial ports before USB became
+    commonplace.
     </para>
 
     <para>While serial ports are no longer as ubiquitous as they used to be,
@@ -1041,7 +1064,7 @@
 
     <para>If a virtual serial port is enabled, the guest operating system sees
     a standard 16550A compatible UART device. Both receiving and transmitting
-    data is supported. How this virtual serial port is then connected to the 
+    data is supported. How this virtual serial port is then connected to the
     host is configurable, and the details depend on your host operating system.
     </para>
 
@@ -1052,7 +1075,7 @@
     <computeroutput>--uart</computeroutput> and
     <computeroutput>--uartmode</computeroutput> options.</para>
 
-    <para>In either case, you can configure up to two virtual serial ports per 
+    <para>In either case, you can configure up to two virtual serial ports per
     virtual machine. For each such device, you will need to
     determine<orderedlist>
         <listitem>
@@ -1112,31 +1135,21 @@
                     <listitem>
                       <para>On a Windows host, data will be sent and received
                       through a named pipe. The pipe name must be in the format
-                      <computeroutput>\\.\pipe\<name></computeroutput> 
+                      <computeroutput>\\.\pipe\<name></computeroutput>
                       where <computeroutput><name></computeroutput> should
-                      identify the virtual machine but may be freely 
-                      chosen.</para> 
-                      <para>For forwarding serial traffic, you can use a helper
-                      program called VMware Serial Line Gateway, available for
-                      download at
-                                  <literal> <ulink
-                      url="http://www.l4ka.org/91.php">http://www.l4ka.org/91.php</ulink>
-                      </literal>. This tool provides a fixed server mode named
-                      pipe at
-                      <computeroutput>\\.\pipe\vmwaredebug</computeroutput>
-                      and connects incoming TCP connections on port 567 with
-                      the named pipe.</para>
+                      identify the virtual machine but may be freely
+                      chosen.</para>
                     </listitem>
 
                     <listitem>
                       <para>On a Mac, Linux or Solaris host, a local
                       domain socket is used instead. The socket filename must be
-                      chosen such that the user running VirtualBox has 
-                      sufficient privileges to create and write to it. The 
-                      <computeroutput>/tmp</computeroutput> directory is often a 
+                      chosen such that the user running VirtualBox has
+                      sufficient privileges to create and write to it. The
+                      <computeroutput>/tmp</computeroutput> directory is often a
                       good candidate.</para>
-                      <para>On Linux there are various tools which can connect 
-                      to a local domain socket or create one in server mode. The 
+                      <para>On Linux there are various tools which can connect
+                      to a local domain socket or create one in server mode. The
                       most flexible tool is
                       <computeroutput>socat</computeroutput> and is available
                       as part of many distributions.</para>
@@ -1152,25 +1165,57 @@
                 respectively.</para>
 
                 <para>For a direct connection between two virtual machines
-                (corresponding to a null-modem cable), simply configure one VM 
+                (corresponding to a null-modem cable), simply configure one VM
                 to create a pipe/socket and another to attach to it.
                 </para>
               </listitem>
 
               <listitem>
-                <para>You can send the virtual serial port output to a file. 
-                This option is very useful for capturing diagnostic output from 
-                a guest. Any file may be used for this purpose, as long as the 
-                user running VirtualBox has sufficient privileges to create and 
+                <para>You can send the virtual serial port output to a file.
+                This option is very useful for capturing diagnostic output from
+                a guest. Any file may be used for this purpose, as long as the
+                user running VirtualBox has sufficient privileges to create and
                 write to the file.
                 </para>
               </listitem>
+
+              <listitem>
+                <para>TCP Socket: Useful for forwarding serial traffic over TCP/IP,
+                  acting as a server, or it can act as a TCP client connecting to other
+                  servers. It allows a remote machine to directly connect to the guest's
+                  serial port via TCP.
+                </para>
+                <itemizedlist>
+                  <listitem>
+                    <para>TCP Server: Uncheck the
+                      <emphasis>Connect to existing pipe/socket</emphasis> checkbox and specify
+                      the <emphasis role="bold"><computeroutput>port</computeroutput></emphasis>
+                      number. Typically 23 or 2023. Note that on UNIX-like systems you will
+                      have to use a port a number greater than 1024 for regular users.
+                    </para>
+                    <para>
+                      The client can use software such as <computeroutput>PuTTY</computeroutput>
+                      or the <computeroutput>telnet</computeroutput> command line
+                      tool to access the TCP Server.
+                    </para>
+                  </listitem>
+                  <listitem>
+                    <para>TCP Client: To create a virtual null-modem cable over the Internet or
+                      LAN, the other side can connect via TCP by specifying <emphasis role="bold">
+                      <computeroutput>hostname:port</computeroutput></emphasis>. The TCP socket
+                    will act in client mode if check the <emphasis>Connect to existing pipe/socket</emphasis>
+                    checkbox.
+                    </para>
+                  </listitem>
+                </itemizedlist>
+              </listitem>
+
             </itemizedlist></para>
         </listitem>
-      </orderedlist>Up to two serial ports can be configured per virtual 
+      </orderedlist>Up to two serial ports can be configured per virtual
       machine, but you can pick any port numbers out of the above. However,
-      serial ports cannot reliably share interrupts; if both ports are to be 
-      used at the same time, they must use different interrupt levels, for 
+      serial ports cannot reliably share interrupts; if both ports are to be
+      used at the same time, they must use different interrupt levels, for
       example COM1 and COM2, but not COM1 and COM3.
     </para>
   </sect1>
@@ -1211,11 +1256,10 @@
       this, see <xref linkend="usb-over-rdp" />.</para>
 
       <para>In the Settings dialog, you can first configure whether USB is
-      available in the guest at all, and in addition also optionally enable
-      the USB 2.0 (EHCI) controller for the guest. If so, you can determine in
-      detail which devices are available. For this, you must create so-called
-      "filters" by specifying certain properties of the USB device.<note>
-          <para>The EHCI controller is shipped as a VirtualBox extension
+      available in the guest at all, and then choose the level of USB support:
+      OHCI for USB 1.1, EHCI (which will also enable OHCI) for USB 2.0,
+      or xHCI for all USB speeds. <note>
+          <para>The xHCI and EHCI controllers are shipped as a VirtualBox extension
           package, which must be installed separately. See <xref
           linkend="intro-installing" /> for more information.</para>
         </note></para>
diff --git a/doc/manual/en_US/user_Frontends.xml b/doc/manual/en_US/user_Frontends.xml
index d4519b9..34bd361 100644
--- a/doc/manual/en_US/user_Frontends.xml
+++ b/doc/manual/en_US/user_Frontends.xml
@@ -37,10 +37,6 @@
     linkend="settings-display" />) or with
     <computeroutput>VBoxManage</computeroutput>:<screen>VBoxManage modifyvm "VM name" --vrde on</screen></para>
 
-    <para>If you use <computeroutput>VBoxHeadless</computeroutput> (described
-    further below), VRDP support will be automatically enabled since
-    VBoxHeadless has no other means of output.</para>
-
     <para>By default, the VRDP server uses TCP port
     <computeroutput>3389</computeroutput>. You will need to change the
     default port if you run more than one VRDP server, since the port can
@@ -165,7 +161,7 @@
 
       <para>VirtualBox therefore comes with yet another front-end called
       <computeroutput>VBoxHeadless</computeroutput>, which produces no visible
-      output on the host at all, but instead only delivers VRDP data. This
+      output on the host at all, but still can deliver VRDP data. This
       front-end has no dependencies on the X Window system on Linux and
       Solaris hosts.<footnote>
           <para>Before VirtualBox 1.6, the headless server was called
@@ -206,21 +202,23 @@
           <para>The other alternative is to start
           <computeroutput>VBoxHeadless</computeroutput> from the VirtualBox
           Manager GUI, by holding the Shift key when starting a virtual
-          machine.
+          machine or selecting <computeroutput>Headless Start</computeroutput>
+          from the <computeroutput>Machine</computeroutput> menu.
           </para>
         </listitem>
       </itemizedlist>
 
-      <para>Note that when you use
-      <computeroutput>VBoxHeadless</computeroutput> to start a VM, since the
-      headless server has no other means of output, the VRDP server will
-      <emphasis>always</emphasis> be enabled, regardless of whether you had
-      enabled the VRDP server in the VM's settings. If this is undesirable
-      (for example because you want to access the VM via
-      <computeroutput>ssh</computeroutput> only), start the VM like
-      this:<screen>VBoxHeadless --startvm <uuid|name> --vrde off</screen>To
-      have the VRDP server enabled depending on the VM configuration, as the
-      other front-ends would, use this:<screen>VBoxHeadless --startvm <uuid|name> --vrde config</screen></para>
+      <para>Since VirtualBox version 5.0, when you use
+      <computeroutput>VBoxHeadless</computeroutput> to start a VM,
+      the VRDP server will be enabled according to the VM configuration.
+      You can override the VM's setting using <computeroutput>--vrde</computeroutput>
+      command line parameter. To enable the VRDP server start the VM like
+      this:<screen>VBoxHeadless --startvm <uuid|name> --vrde on</screen>
+      and to disable it:<screen>VBoxHeadless --startvm <uuid|name> --vrde off</screen>
+      To have the VRDP server enabled depending on the VM configuration, as the
+      other front-ends would, you can still use:
+      <screen>VBoxHeadless --startvm <uuid|name> --vrde config</screen>
+      but this is the same as <screen>VBoxHeadless --startvm <uuid|name></screen></para>
 
       <para>If you start the VM with <computeroutput>VBoxManage startvm ...</computeroutput>
       then the configuration settings of the VM are always used.</para>
@@ -313,6 +311,11 @@
           </listitem>
 
           <listitem>
+            <para>Enable VirtualBox remote desktop extension (the VRDP server):
+            <screen>VBoxManage modifyvm "Windows XP" --vrde on</screen></para>
+          </listitem>
+
+          <listitem>
             <para>Start the virtual machine using VBoxHeadless:<screen>VBoxHeadless --startvm "Windows XP"</screen></para>
 
             <para>If everything worked, you should see a copyright notice. If,
diff --git a/doc/manual/en_US/user_Glossary.xml b/doc/manual/en_US/user_Glossary.xml
index 26bc080..38d3af2 100644
--- a/doc/manual/en_US/user_Glossary.xml
+++ b/doc/manual/en_US/user_Glossary.xml
@@ -470,6 +470,15 @@
     <title>X</title>
 
     <glossentry>
+      <glossterm>xHCI</glossterm>
+
+      <glossdef>
+        <para>eXtended Host Controller Interface, the interface that
+        implements the USB 3.0 standard.</para>
+      </glossdef>
+    </glossentry>
+
+    <glossentry>
       <glossterm>XML</glossterm>
 
       <glossdef>
diff --git a/doc/manual/en_US/user_GuestAdditions.xml b/doc/manual/en_US/user_GuestAdditions.xml
index 73fc1c1..61853a9 100644
--- a/doc/manual/en_US/user_GuestAdditions.xml
+++ b/doc/manual/en_US/user_GuestAdditions.xml
@@ -1079,6 +1079,14 @@
           <para>Currently only Linux and Solaris Guest Additions support
           symlinks.</para>
         </listitem>
+
+        <listitem>
+          <para>For security reasons the guest OS is not allowed to create
+          symlinks by default. If you trust the guest OS to not abuse the
+          functionality, you can enable creation of symlinks for "sharename"
+          with:
+          <screen>VBoxManage setextradata "VM name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/sharename 1</screen></para>
+        </listitem>
       </orderedlist></para>
 
     <sect2 id="sf_mount_manual">
@@ -1239,6 +1247,110 @@ $</screen>
     </sect2>
   </sect1>
 
+  <sect1 id="guestadd-dnd">
+    <title>Drag'n Drop</title>
+
+    <para>Starting with version 5.0, VirtualBox supports to drag'n drop content
+    from the host to the guest and vice versa. For this to work the latest Guest
+    Additions must be installed on the guest.</para>
+
+    <para>Drag'n drop transparently allows copying or opening files, directories
+    and even certain clipboard formats from one end to the other, e.g. from the
+    host to the guest or from the guest to the host. One then can perform drag'n
+    drop operations between the host and a VM as it would be a native drag'n drop
+    operation on the host OS.</para>
+
+    <para>At the moment drag'n drop is implemented for Windows- and X-Windows-based
+    systems, both, on host and guest side. As X-Windows sports different drag'n drop
+    protocols only the most used one, XDND, is supported for now. Applications using
+    other protocols (such as Motif or OffiX) will not be recognized by VirtualBox.</para>
+
+    <para>In context of using drag'n drop the origin of the data is called
+    <emphasis role="bold">source</emphasis>, that is, where the actual data comes
+    from and is specified. On the other hand there is the
+    <emphasis role="bold">target</emphasis>, which specifies where the data from
+    the source should go to. Transferring data from the source to the target can
+    be done in various ways, e.g. copying, moving or linking.<footnote><para>At
+    the moment only copying of data is supported. Moving or linking is not yet
+    implemented.</para></footnote></para>
+
+    <para>When transferring data from the host to the guest OS, the host in this
+    case is the source, whereas the guest OS is the target. However, when doing
+    it the other way around, that is, transferring data from the guest OS to the
+    host, the guest OS this time became the source and the host is the target.</para>
+
+    <para>For security reasons drag'n drop can be configured at runtime
+    on a per-VM basis either using the "Drag'n'Drop" menu item in the "Devices" menu
+    of the virtual machine or VBoxManage: The following four modes are available:
+
+    <para><mediaobject>
+      <imageobject>
+        <imagedata align="center" fileref="images/dnd-modes.png"
+                   width="10cm" />
+        </imageobject>
+      </mediaobject></para>
+
+    <itemizedlist>
+      <listitem>
+        <para><emphasis role="bold">Disabled</emphasis> disables the drag'n drop
+        entirely. This is the default when creating new VMs.</para>
+      </listitem>
+      <listitem>
+        <para><emphasis role="bold">Host To Guest</emphasis> enables performing
+        drag'n drop operations from the host to the guest only.</para>
+      </listitem>
+      <listitem>
+        <para><emphasis role="bold">Guest To Host</emphasis> enables performing
+        drag'n drop operations from the guest to the host only.</para>
+      </listitem>
+      <listitem>
+        <para><emphasis role="bold">Bidirectional</emphasis> enables performing
+        drag'n drop operations to both directions, e.g. from the host to the guest
+        and vice versa.</para>
+      </listitem>
+    </itemizedlist></para>
+
+    <note><para>Drag'n drop support depends on the frontend being used; at the
+    moment only the VirtualBox Manager frontend provides this
+    functionality.</para></note>
+
+    <para>To use VBoxManage for controlling the current drag'n drop mode, see <xref
+    linkend="vboxmanage" />. The commands <computeroutput>modifyvm</computeroutput>
+    and <computeroutput>controlvm</computeroutput> allow setting the VM's current
+    drag'n drop mode via command line.</para>
+
+    <sect2 id="guestadd-dnd-formats">
+      <title>Supported formats</title>
+
+      <para>As VirtualBox can run on a variety of host OSes and also supports a wide
+      range of guests, certain data formats must be translated after those
+      got transfered over so that the target OS (that is, the side which receiving the
+      data) is able to handle them in an appropriate manner.</para>
+
+      <note><para>When dragging files however, no data conversion is done in any way, e.g.
+      when transferring a file from a Linux guest to a Windows host the Linux-specific
+      line endings won't be converted to Windows ones.</para></note>
+
+      <para>The following formats are handled by the VirtualBox drag'n drop service:
+        <itemizedlist>
+          <listitem>
+            <para><emphasis role="bold">Plain text</emphasis>, from applications such as
+            text editors, internet browsers and terminal windows</para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">Files</emphasis>, from file managers such
+            as Windows explorer, Nautilus and Finder</para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">Directories</emphasis>, where the same applies
+            as for files</para>
+          </listitem>
+        </itemizedlist>
+      </para>
+    </sect2>
+
+  </sect1>
+
   <sect1 id="guestadd-video">
     <title>Hardware-accelerated graphics</title>
 
diff --git a/doc/manual/en_US/user_Installation.xml b/doc/manual/en_US/user_Installation.xml
index 321bbca..fdff9ec 100644
--- a/doc/manual/en_US/user_Installation.xml
+++ b/doc/manual/en_US/user_Installation.xml
@@ -158,6 +158,22 @@
         </glosslist>For example, to only install USB support along with the
       main binaries, do a: <screen>VirtualBox.exe -msiparams ADDLOCAL=VBoxApplication,VBoxUSB</screen>
       or <screen>msiexec /i VirtualBox-<version>-MultiArch_<x86|amd64>.msi ADDLOCAL=VBoxApplication,VBoxUSB</screen></para>
+
+      <para>
+      The user is able to choose between NDIS5 and NDIS6 host network filters drivers during
+      the installation. This is realized via a command line parameter
+      <computeroutput>NETWORKTYPE</computeroutput>.
+      The NDIS6 driver is default for Windows Vista and later. For older Windows versions,
+      the installer will automatically select the NDIS5 driver and this cannot be changed.
+      For Windows Vista and later the user can force to install the (legacy) NDIS5 host
+      network filter driver using <computeroutput>NETWORKTYPE=NDIS5</computeroutput>. For
+      example, to install the NDIS5 driver on Windows 7, do
+      <screen>VirtualBox.exe -msiparams NETWORKTYPE=NDIS5</screen>
+      or
+      <screen>msiexec /i VirtualBox-<version>-MultiArch_<x86|amd64>.msi NETWORKTYPE=NDIS5</screen>
+      </para>
+
+
     </sect2>
 
     <sect2>
@@ -174,6 +190,7 @@
 
       <para>Unattended installations can be performed using the standard MSI
       support.</para>
+
     </sect2>
   </sect1>
 
@@ -395,7 +412,7 @@
         Ubuntu Raring system. Use <computeroutput>dpkg</computeroutput> to
         install the Debian package:</para>
 
-        <screen>sudo dpkg -i VirtualBox-3.2_$VBOX_VERSION_STRING_Ubuntu_raring_i386.deb</screen>
+        <screen>sudo dpkg -i virtualbox-4.3_$VBOX_VERSION_STRING_Ubuntu_raring_i386.deb</screen>
 
         <para>You will be asked to accept the VirtualBox Personal Use and
         Evaluation License. Unless you answer "yes" here, the installation
@@ -828,11 +845,6 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>The first line
     <sect2 id="solaris-zones">
       <title>Configuring a zone for running VirtualBox</title>
 
-      <para>Starting with VirtualBox 1.6 it is possible to run VirtualBox from
-      within Solaris zones. For an introduction of Solaris zones, please refer
-      to <ulink
-      url="http://www.sun.com/bigadmin/features/articles/solaris_zones.jsp">http://www.sun.com/bigadmin/features/articles/solaris_zones.jsp</ulink>.</para>
-
       <para>Assuming that VirtualBox has already been installed into your
       zone, you need to give the zone access to VirtualBox's device node. This
       is done by performing the following steps. Start a root terminal and
@@ -840,6 +852,9 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>The first line
 
       <screen>zonecfg -z vboxzone</screen>
 
+      <para>Replace "vboxzone" with the name of the zone in which you intend
+      to run VirtualBox.</para>
+
       <para>Inside the <computeroutput>zonecfg</computeroutput> prompt add the
       <computeroutput>device</computeroutput> resource and
       <computeroutput>match</computeroutput> properties to the zone. Here's
@@ -848,19 +863,18 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>The first line
       <screen>zonecfg:vboxzone>add device
 zonecfg:vboxzone:device>set match=/dev/vboxdrv
 zonecfg:vboxzone:device>end
-zonecfg:vboxzone>verify
+zonecfg:vboxzone>add device
+zonecfg:vboxzone:device>set match=/dev/vboxdrvu
+zonecfg:vboxzone:device>end
 zonecfg:vboxzone>exit</screen>
 
-      <para>If you are running VirtualBox 2.2.0 or above on Solaris 11 or
-      Nevada hosts, you should add a device for
-      <computeroutput>/dev/vboxusbmon</computeroutput> too, similar to what
-      was shown above. This does not apply to Solaris 10 hosts due to lack of
-      USB support.</para>
-
-      <para>Replace "vboxzone" with the name of the zone in which you intend
-      to run VirtualBox. Next reboot the zone using
-      <computeroutput>zoneadm</computeroutput> and you should be able to run
-      VirtualBox from within the configured zone.</para>
+      <para>If you are running VirtualBox 2.2.0 or above on Solaris 11 or 
+      above, you may add a device for <computeroutput>/dev/vboxusbmon</computeroutput>
+      too, similar to what was shown above. This does not apply to Solaris 10
+      hosts due to lack of USB support.</para>
+      
+      <para>Next reboot the zone using <computeroutput>zoneadm</computeroutput>
+      and you should be able to run VirtualBox from within the configured zone.</para>
     </sect2>
   </sect1>
 </chapter>
diff --git a/doc/manual/en_US/user_Introduction.xml b/doc/manual/en_US/user_Introduction.xml
index fa6284a..db429f1 100644
--- a/doc/manual/en_US/user_Introduction.xml
+++ b/doc/manual/en_US/user_Introduction.xml
@@ -399,22 +399,18 @@
       <listitem>
         <para><emphasis role="bold">Windows</emphasis> hosts:<itemizedlist>
             <listitem>
-              <para>Windows XP, all service packs (32-bit)</para>
-            </listitem>
-
-            <listitem>
-              <para>Windows Server 2003 (32-bit)</para>
-            </listitem>
-
-            <listitem>
-              <para>Windows Vista (32-bit and 64-bit<footnote>
+              <para>Windows Vista SP1 and later (32-bit and 64-bit<footnote>
                   <para>Support for 64-bit Windows was added with VirtualBox
                   1.5.</para>
                 </footnote>).</para>
             </listitem>
 
             <listitem>
-              <para>Windows Server 2008 (32-bit and 64-bit)</para>
+              <para>Windows Server 2008 (64-bit)</para>
+            </listitem>
+
+            <listitem>
+              <para>Windows Server 2008 R2 (64-bit)</para>
             </listitem>
 
             <listitem>
@@ -426,9 +422,17 @@
             </listitem>
             
             <listitem>
+              <para>Windows 8.1 (32-bit and 64-bit)</para>
+            </listitem>
+            
+            <listitem>
               <para>Windows Server 2012 (64-bit)</para>
             </listitem>
 
+            <listitem>
+              <para>Windows Server 2012 R2 (64-bit)</para>
+            </listitem>
+
           </itemizedlist></para>
       </listitem>
 
@@ -436,26 +440,22 @@
         <para><emphasis role="bold">Mac OS X</emphasis> hosts:<footnote>
             <para>Preliminary Mac OS X support (beta stage) was added with
             VirtualBox 1.4, full support with 1.6. Mac OS X 10.4 (Tiger)
-            support was removed with VirtualBox 3.1.</para>
+            support was removed with VirtualBox 3.1. Mac OS X 10.7 (Lion)
+            and earlier was removed with VirtualBox 5.0.</para>
           </footnote></para>
 
         <itemizedlist>
           <listitem>
-            <para>10.6 (Snow Leopard, 32-bit and 64-bit)</para>
-          </listitem>
-
-          <listitem>
-            <para>10.7 (Lion, 32-bit and 64-bit)</para>
+            <para>10.8 (Mountain Lion)</para>
           </listitem>
 
           <listitem>
-            <para>10.8 (Mountain Lion, 64-bit)</para>
+            <para>10.9 (Mavericks)</para>
           </listitem>
 
           <listitem>
-            <para>10.9 (Mavericks, 64-bit)</para>
+            <para>10.10 (Yosemite)</para>
           </listitem>
-
         </itemizedlist>
 
         <para>Intel hardware is required; please see <xref
@@ -469,10 +469,7 @@
             1.4.</para>
           </footnote>). Among others, this includes:<itemizedlist>
             <listitem>
-              <para>10.04 ("Lucid Lynx"), 10.10 ("Maverick Meerkat),
-              11.04 ("Natty Narwhal"), 11.10 ("Oneiric Oncelot"),
-              12.04 ("Precise Pangolin"), 12.10 ("Quantal Quetzal"),
-              13.04 ("Raring Ringtail"), 13.10 ("Saucy Salamander")</para>
+              <para>Ubuntu 10.04 to 14.10</para>
             </listitem>
 
             <listitem>
@@ -488,7 +485,7 @@
             </listitem>
 
             <listitem>
-              <para>Fedora Core 6 to 19</para>
+              <para>Fedora Core 6 to 20</para>
             </listitem>
 
             <listitem>
@@ -496,11 +493,11 @@
             </listitem>
 
             <listitem>
-              <para>openSUSE 11.0, 11.1, 11.2, 11.3, 11.4, 12.1, 12.2</para>
+              <para>openSUSE 11.0, 11.1, 11.2, 11.3, 11.4, 12.1, 12.2, 13.1</para>
             </listitem>
 
             <listitem>
-              <para>Mandriva 2010 and 2011</para>
+              <para>Mandriva 2011</para>
             </listitem>
           </itemizedlist></para>
 
@@ -519,11 +516,11 @@
         supported with the restrictions listed in <xref
         linkend="KnownIssues" />:<itemizedlist>
             <listitem>
-              <para>Solaris 11 including Solaris 11 Express</para>
+              <para>Solaris 11</para>
             </listitem>
 
             <listitem>
-              <para>Solaris 10 (u8 and higher)</para>
+              <para>Solaris 10 (U10 and higher)</para>
             </listitem>
           </itemizedlist></para>
       </listitem>
@@ -565,6 +562,11 @@
               </listitem>
 
               <listitem>
+                <para>The virtual USB 3.0 (xHCI) device; see <xref
+                linkend="settings-usb" />.</para>
+              </listitem>
+
+              <listitem>
                 <para>VirtualBox Remote Desktop Protocol (VRDP) support; see
                 <xref linkend="vrde" />.</para>
               </listitem>
@@ -1817,8 +1819,9 @@
         <listitem>
           <para>Finally, <computeroutput>VBoxHeadless</computeroutput> is yet
           another front-end that produces no visible output on the host at
-          all, but merely acts as a RDP server if the VirtualBox Remote
-          Desktop Extension (VRDE) is installed. As opposed to the other
+          all, but can act as a RDP server if the VirtualBox Remote
+          Desktop Extension (VRDE) is installed and enabled for the VM.
+          As opposed to the other
           graphical interfaces, the headless front-end requires no graphics
           support. This is useful, for example, if you want to host your
           virtual machines on a headless Linux server that has no X Window
diff --git a/doc/manual/en_US/user_KnownIssues.xml b/doc/manual/en_US/user_KnownIssues.xml
index 6a774b6..ed05db0 100644
--- a/doc/manual/en_US/user_KnownIssues.xml
+++ b/doc/manual/en_US/user_KnownIssues.xml
@@ -73,13 +73,6 @@
               </listitem>
             </itemizedlist></para>
         </listitem>
-    
-        <listitem>
-          <para><emphasis role="bold">64-bit guests on some 32-bit host systems
-          with VT-x</emphasis> can cause instabilities to your system. If you
-          experience this, do not attempt to execute 64-bit guests. Refer to the
-          VirtualBox user forum for additional information.</para>
-        </listitem>
 
         <listitem>
           <para><emphasis role="bold">NX (no execute, data execution
@@ -252,6 +245,12 @@
                 snv_124 or higher. Webcams and other isochronous devices are known
                 to have poor performance.</para>
               </listitem>
+
+              <listitem>
+                <para>Host Webcam passthrough is restricted to 640x480 frames at
+                20 frames per second due to limitations in the Solaris V4L2 API.
+                This may be addressed in a future Solaris release.</para>
+              </listitem>
     
               <listitem>
                 <para>No ACPI information (battery status, power source) is
@@ -267,8 +266,8 @@
                 <para>Crossbow-based bridged networking on Solaris 11 hosts does
                 not work directly with aggregate links. However, you can manually
                 create a VNIC (using <computeroutput>dladm</computeroutput>) over
-                the aggregate link and use that with a VM. This technical
-                limitation will be addressed in a future Solaris 11 release.</para>
+                the aggregate link and use that with a VM. This limitation does
+                not exist in Solaris 11u1 build 17 and newer.</para>
               </listitem>
             </itemizedlist></para>
         </listitem>
diff --git a/doc/manual/en_US/user_Networking.xml b/doc/manual/en_US/user_Networking.xml
index 6e8a8dd..900e1d4 100644
--- a/doc/manual/en_US/user_Networking.xml
+++ b/doc/manual/en_US/user_Networking.xml
@@ -696,7 +696,14 @@
           "VM name" --nic<x> hostonly</computeroutput>; see <xref
           linkend="vboxmanage-modifyvm" /> for details.</para>
         </listitem>
-      </itemizedlist></para>
+    </itemizedlist></para>
+
+    <para>Before you can attach a VM to a host-only network you have to
+      create at least one host-only interface, either from the GUI:
+      "File" -> "Preferences" -> "Network" -> "Host-only network"
+      -> "(+)Add host-only network", or via command line with</para>
+      <screen>VBoxManage hostonlyif create</screen> 
+      <para>see <xref linkend="vboxmanage-hostonlyif" /> for details.</para>
 
     <para>For host-only networking, like with internal networking, you may
     find the DHCP server useful that is built into VirtualBox. This can be
diff --git a/doc/manual/en_US/user_Storage.xml b/doc/manual/en_US/user_Storage.xml
index ee9cd6c..f339366 100644
--- a/doc/manual/en_US/user_Storage.xml
+++ b/doc/manual/en_US/user_Storage.xml
@@ -35,30 +35,31 @@
   section.</para>
 
   <sect1 id="harddiskcontrollers">
-    <title>Hard disk controllers: IDE, SATA (AHCI), SCSI, SAS</title>
+    <title>Hard disk controllers: IDE, SATA (AHCI), SCSI, SAS, USB MSC</title>
 
     <para>In a real PC, hard disks and CD/DVD drives are connected to a device
     called hard disk controller which drives hard disk operation and data
-    transfers. VirtualBox can emulate the four most common types of hard disk
-    controllers typically found in today's PCs: IDE, SATA (AHCI), SCSI and
-    SAS.<footnote>
+    transfers. VirtualBox can emulate the five most common types of hard disk
+    controllers typically found in today's PCs: IDE, SATA (AHCI), SCSI,
+    SAS and USB-based mass storage devices.<footnote>
         <para>SATA support was added with VirtualBox 1.6; experimental SCSI
         support was added with 2.1 and fully implemented with 2.2. Generally,
         storage attachments were made much more flexible with VirtualBox 3.1;
         see below. Support for the LSI Logic SAS controller was added with
-        VirtualBox 3.2.</para>
+        VirtualBox 3.2; USB mass storage devices are supported since
+        VirtualBox 5.0.</para>
       </footnote><itemizedlist>
         <listitem>
           <para><emphasis role="bold">IDE (ATA)</emphasis> controllers are a
           backwards compatible yet very advanced extension of the disk
-	  controller in the IBM PC/AT (1984). Initially, this interface
+          controller in the IBM PC/AT (1984). Initially, this interface
           worked only with hard disks, but was later extended to also support
           CD-ROM drives and other types of removable media. In physical PCs,
           this standard uses flat ribbon parallel cables with 40 or 80 wires.
           Each such cable can connect two devices to a controller, which have
           traditionally been called "master" and "slave". Typical PCs had
           two connectors for such cables; as a result, support for up to four
-	  IDE devices was most common.</para>
+          IDE devices was most common.</para>
 
           <para>In VirtualBox, each virtual machine may have one IDE
           contoller enabled, which gives you up to four virtual storage
@@ -189,6 +190,25 @@
             see such disks unless you install additional drivers.</para>
           </warning>
         </listitem>
+
+        <listitem>
+          <para>The <emphasis role="bold">USB mass storage device class</emphasis>
+          is a standard to connect external storage devices like hard disksor flash
+          drives to a host through USB. All major operating systems support these
+          devices for a long time and ship generic drivers making third-party
+          drivers superfluous. In particular legacy operating systems without
+          support for SATA controllers may benefit from USB mass storage devices.</para>
+          <para>The virtual USB storage controller offered by VirtualBox works
+          different than the other storage controller types: When storage
+          controllers appear as a single PCI device to the guest with multiple
+          disks attached to it, the USB-based storage controller does not appear
+          as virtual storage controller. Each disk attached to the controller
+          appears as a dedicated USB device to the guest.</para>
+          <warning>
+            <para>Booting from drives attached via USB is not supported as the
+              BIOS lacks USB support.</para>
+          </warning>
+        </listitem>
       </itemizedlist></para>
 
     <para>In summary, VirtualBox gives you the following categories of virtual
@@ -213,6 +233,11 @@
           <para>eight slots attached to the SAS controller, if enabled and
           supported by the guest operating system.</para>
         </listitem>
+
+        <listitem>
+          <para>eight slots attached to the virtual USB controller, if enabled and
+          supported by the guest operating system.</para>
+        </listitem>
       </orderedlist></para>
 
     <para>Given this large choice of storage controllers, you may ask yourself
diff --git a/doc/manual/en_US/user_Technical.xml b/doc/manual/en_US/user_Technical.xml
index 713d80a..3b3c06d 100644
--- a/doc/manual/en_US/user_Technical.xml
+++ b/doc/manual/en_US/user_Technical.xml
@@ -585,6 +585,49 @@
     </warning>
   </sect1>
 
+  <sect1 id="gimproviders">
+    <title>Paravirtualization providers</title>
+
+    <para>VirtualBox allows exposing a paravirtualization interface to
+    facilitate accurate and efficient execution of software within a
+    virtual machine. These interfaces require the guest operating system
+    to recognize their presence and make use of them in order to leverage
+    the benefits of communicating with the VirtualBox hypervisor.</para>
+
+    <para>Most mainstream, modern operating systems, including Windows and
+    Linux, ship with support for one or more paravirtualization interfaces.
+    Hence, there is typically no need to install additional software in the
+    guest (including VirtualBox Guest Additions) to make use of this
+    feature.</para>
+
+    <para>VirtualBox provides the following interfaces:</para>
+      <itemizedlist>
+        <listitem>
+          <para><emphasis role="bold">Minimal</emphasis>: Announces the
+          presence of a virtualized environment. Additionally, reports the
+          TSC and APIC frequency to the guest operating system. This provider
+          is mandatory for running any Mac OS X guests.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">KVM</emphasis>: Presents a Linux KVM
+          hypervisor interface which is recognized by Linux kernels starting
+          with version 2.6.25. VirtualBox's implementation currently supports
+          paravirtualized clocks and SMP spinlocks. This provider is
+          recommended for Linux guests.</para>
+        </listitem>
+
+        <listitem>
+          <para><emphasis role="bold">Hyper-V</emphasis>: Presents a Microsoft
+          Hyper-V hypervisor interface which is recognized by Windows 7 and newer
+          operating systems. VirtualBox's implementation currently supports
+          paravirtualized clocks, APIC frequency reporting and relaxed timer
+          checks. This provider is recommended for Windows and FreeBSD guests.
+          </para>
+        </listitem>
+     </itemizedlist>
+  </sect1>
+
   <sect1>
     <title>Details about software virtualization</title>
 
@@ -701,8 +744,8 @@
         <listitem>
           <para>There are certain flaws in the implementation of ring 1 in the
           x86 architecture that were never fixed. Certain instructions that
-          <emphasis>should</emphasis> trap in ring 1 don't. This affect for
-          example the LGDT/SGDT, LIDT/SIDT, or POPF/PUSHF instruction pairs.
+          <emphasis>should</emphasis> trap in ring 1 don't. This affects, for
+          example, the LGDT/SGDT, LIDT/SIDT, or POPF/PUSHF instruction pairs.
           Whereas the "load" operation is privileged and can therefore be
           trapped, the "store" instruction always succeed. If the guest is
           allowed to execute these, it will see the true state of the CPU, not
diff --git a/doc/manual/en_US/user_Troubleshooting.xml b/doc/manual/en_US/user_Troubleshooting.xml
index 65280c6..c574f47 100644
--- a/doc/manual/en_US/user_Troubleshooting.xml
+++ b/doc/manual/en_US/user_Troubleshooting.xml
@@ -88,7 +88,7 @@
         </orderedlist></para>
     </sect2>
 
-    <sect2>
+    <sect2 id="collect-debug-info">
       <title>Collecting debugging information</title>
 
       <para>For problem determination, it is often important to collect
@@ -378,8 +378,8 @@
           </listitem>
 
           <listitem>
-            <para><computeroutput>ohci/ehci</computeroutput> -- print a subset
-            of the OHCI/EHCI USB controller state</para>
+            <para><computeroutput>ohci/ehci/xhci</computeroutput> -- print a subset
+            of the OHCI/EHCI/xHCI USB controller state</para>
           </listitem>
 
           <listitem>
@@ -1081,6 +1081,24 @@ VBoxClient --seamless</screen> when your X11 user session is started if you
     </sect2>
   </sect1>
 
+  <sect1 id="ts_fbsd-guests">
+    <title>FreeBSD guests</title>
+
+    <sect2>
+        <title>FreeBSD 10.0 may hang with xHCI</title>
+
+        <para>
+            If xHCI (USB 3.0) emulation is enabled for FreeBSD 10.0 guests, the guest
+            OS will hang. This is caused by the guest OS incorrectly handling systems
+            where MSIs (Message Signaled Interrupts) are not used with the xHCI device.
+        </para>
+        <para>
+            The problem does not exist in earlier FreeBSD releases and was fixed in
+            FreeBSD 10.1.
+        </para>
+    </sect2>
+  </sect1>
+
   <sect1 id="ts_win-hosts">
     <title>Windows hosts</title>
 
@@ -1362,7 +1380,7 @@ VirtualBox</screen>
       between different VirtualBox processes and maintains the global
       configuration, i.e. the XML database. When starting a VirtualBox
       component, the processes <computeroutput>VBoxSVC</computeroutput> and
-      <computeroutput>VirtualBoxXPCOMIPCD</computeroutput> are started
+      <computeroutput>VBoxXPCOMIPCD</computeroutput> are started
       automatically. They are only accessible from the user account they are
       running under. <computeroutput>VBoxSVC</computeroutput> owns the
       VirtualBox configuration database which normally resides in
diff --git a/doc/manual/en_US/user_VBoxManage.xml b/doc/manual/en_US/user_VBoxManage.xml
index 9c579da..dac01d0 100644
--- a/doc/manual/en_US/user_VBoxManage.xml
+++ b/doc/manual/en_US/user_VBoxManage.xml
@@ -98,7 +98,7 @@ Settings file: '/home/username/.config/VirtualBox/Machines/SUSE 10.2/SUSE 10.2.x
       <listitem>
         <para>To change settings while a VM is powered off, use
         <computeroutput>VBoxManage modifyvm</computeroutput>, e.g. as
-        follows:<screen>VBoxManage modifyvm "Windows XP" --memory "512MB"</screen></para>
+        follows:<screen>VBoxManage modifyvm "Windows XP" --memory 512</screen></para>
 
         <para>For details, see <xref linkend="vboxmanage-modifyvm" />.</para>
       </listitem>
@@ -531,12 +531,6 @@ Statistics update:  disabled</screen></para>
           </listitem>
 
           <listitem>
-            <para><computeroutput>--rtcuseutc on|off</computeroutput>: This
-            option lets the real-time clock (RTC) operate in UTC time (see
-            <xref linkend="settings-motherboard" />).</para>
-          </listitem>
-
-          <listitem>
             <para><computeroutput>--cpuhotplug on|off</computeroutput>: This
             enables CPU hot-plugging. When enabled, virtual CPUs can be added
             to and removed from a virtual machine while it is running. See
@@ -603,6 +597,27 @@ Statistics update:  disabled</screen></para>
           </listitem>
 
           <listitem>
+            <para><computeroutput>--paravirtprovider
+            none|default|legacy|minimal|hyperv|kvm</computeroutput>: This
+            setting specifies which paravirtualization interface to provide to
+            the guest operating system. Specifying
+            <computeroutput>none</computeroutput> explicitly turns off exposing
+            any paravirtualization interface. The option
+            <computeroutput>default</computeroutput>, will pick an appropriate
+            interface depending on the guest OS type while starting the VM.
+            This is the default option chosen while creating new VMs. The
+            <computeroutput>legacy</computeroutput> option is chosen for VMs
+            which were created with older VirtualBox versions and will pick a
+            paravirtualization interface while starting the VM with VirtualBox
+            5.0 and newer. The <computeroutput>minimal</computeroutput> provider
+            is mandatory for Mac OS X guests, while
+            <computeroutput>kvm</computeroutput> and
+            <computeroutput>hyperv</computeroutput> are recommended for Linux
+            and Windows guests respectively. These options are explained in
+            detail under <xref linkend="gimproviders" />.</para>
+          </listitem>
+
+          <listitem>
             <para><computeroutput>--nestedpaging on|off</computeroutput>: If
             hardware virtualization is enabled, this additional setting
             enables or disables the use of the nested paging feature in the
@@ -642,6 +657,21 @@ Statistics update:  disabled</screen></para>
           </listitem>
 
           <listitem>
+            <para><computeroutput>--accelerate2dvideo on|off</computeroutput>:
+            This enables, if the Guest Additions are installed, whether 2D video
+            acceleration should be available; see <xref
+            linkend="guestadd-2d" />.</para>
+          </listitem>
+
+          <listitem>
+            <para><computeroutput>--chipset piix3|ich9</computeroutput>:
+            By default VirtualBox emulates an Intel PIIX3 chipset. Usually there
+            is no reason to change the default setting unless it is required to
+            relax some of its constraints; see <xref
+            linkend="settings-motherboard" />.</para>
+          </listitem>
+
+          <listitem>
             <para>You can influence the BIOS logo that is displayed when a
             virtual machine starts up with a number of settings. Per default,
             a VirtualBox logo is displayed.</para>
@@ -684,6 +714,13 @@ Statistics update:  disabled</screen></para>
             ROM is used.
             </para>
           </listitem>
+          
+          <listitem>
+            <para><computeroutput>--biospxedebug on|off</computeroutput>:
+            This option enables additional debugging output when using the
+            Intel PXE boot ROM. The output will be written to the release log
+            file (<xref linkend="collect-debug-info" />.</para>
+          </listitem>
 
           <listitem>
             <para><computeroutput>--boot<1-4>
@@ -694,6 +731,19 @@ Statistics update:  disabled</screen></para>
           </listitem>
 
           <listitem>
+            <para><computeroutput>--rtcuseutc on|off</computeroutput>: This
+            option lets the real-time clock (RTC) operate in UTC time (see
+            <xref linkend="settings-motherboard" />).</para>
+          </listitem>
+
+          <listitem>
+            <para><computeroutput>--biossystemtimeoffset <ms></computeroutput>:
+            This allows you to set a fixed time offset of the guest relative to
+            the host time. The offset is specified in milliseconds. If the offset
+            is positive the guest time runs ahead the host time.</para>
+          </listitem>
+
+          <listitem>
             <para><computeroutput>--snapshotfolder
             default|<path></computeroutput>: This allows you to specify
             the folder in which snapshots will be kept for a virtual
@@ -712,28 +762,10 @@ Statistics update:  disabled</screen></para>
             <size></computeroutput> sets the default size of the guest
             memory balloon, that is, memory allocated by the VirtualBox Guest
             Additions from the guest operating system and returned to the
-            hypervisor for re-use by other virtual machines. <size> must
-            be specified in megabytes. The default size is 0 megabytes. For
-            details, see <xref linkend="guestadd-balloon" />.</para>
-          </listitem>
-
-          <listitem>
-            <para><computeroutput>--lptmode<1-N>
-            <Device></computeroutput>
-            Specifies the Device Name of the parallel port that
-            the Parallel Port feature will be using. Use this
-            <emphasis>before</emphasis> <computeroutput>--lpt</computeroutput>.
-            This feature is host operating system specific.</para>
-          </listitem>
-
-          <listitem>
-            <para><computeroutput>--lpt<1-N>
-            <I/O base> <IRQ></computeroutput>
-            Specifies the I/O address of the parallel port and the IRQ
-            number that the Parallel Port feature will be using. Use this
-            <emphasis>after</emphasis>
-            <computeroutput>--lptmod</computeroutput>. I/O base address and IRQ are
-			the values that guest sees i.e. the values avalable under guest Device Manager.</para>
+            hypervisor for re-use by other virtual machines.
+            <computeroutput><size></computeroutput> must be specified in
+            megabytes. The default size is 0 megabytes. For details,
+            see <xref linkend="guestadd-balloon" />.</para>
           </listitem>
 
           <listitem>
@@ -755,13 +787,14 @@ Statistics update:  disabled</screen></para>
       should be changed.<itemizedlist>
           <listitem>
             <para><computeroutput>--nic<1-N>
-            none|null|nat|bridged|intnet|hostonly|generic
-            </computeroutput>: With
-            this, you can set, for each of the VM's virtual network cards,
+            none|null|nat|natnetwork|bridged|intnet|hostonly|generic</computeroutput>:
+            With this, you can set, for each of the VM's virtual network cards,
             what type of networking should be available. They can be not
             present (<computeroutput>none</computeroutput>), not connected to
             the host (<computeroutput>null</computeroutput>), use network
             address translation (<computeroutput>nat</computeroutput>),
+            use the new network address translation engine
+            (<computeroutput>natnetwork</computeroutput>),
             bridged networking (<computeroutput>bridged</computeroutput>) or
             communicate with other virtual machines using internal networking
             (<computeroutput>intnet</computeroutput>), host-only networking
@@ -773,6 +806,21 @@ Statistics update:  disabled</screen></para>
           </listitem>
 
           <listitem>
+            <para><computeroutput>--nicpromisc<1-N>
+            deny|allow-vms|allow-all</computeroutput>:
+            This allows you, for each of the VM's virtual network cards, to
+            specify how the promiscious mode is handled. This setting is only
+            relevant for bridged networking.
+            <computeroutput>deny</computeroutput> (default setting) hides
+            any traffic not intended for this VM.
+            <computeroutput>allow-vms</computeroutput> hides all host
+            traffic from this VM but allows the VM to see traffic from/to other
+            VMs.
+            <computeroutput>allow-all</computeroutput> removes this
+            restriction completely.</para>
+          </listitem>
+
+          <listitem>
             <para><computeroutput>--nictype<1-N>
             Am79C970A|Am79C973|82540EM|82543GC|82545EM|virtio</computeroutput>:
             This allows you, for each of the VM's virtual network cards, to
@@ -804,6 +852,25 @@ Statistics update:  disabled</screen></para>
           </listitem>
 
           <listitem>
+            <para><computeroutput>--natnet<1-N>
+            <network>|default</computeroutput>:
+            If the networking type is set to <computeroutput>nat</computeroutput>
+            (not <computeroutput>natnetwork</computeroutput>) then this
+            setting specifies the IP address range to be used for
+            this network. See <xref linkend="changenat" /> for an
+            example.</para>
+          </listitem>
+
+          <listitem>
+            <para><computeroutput>--nat-network<1-N> <network
+            name></computeroutput>: If the networking type is set to
+            <computeroutput>natnetwork</computeroutput> (not
+            <computeroutput>nat</computeroutput>) then this setting specifies
+            the name of the NAT network this adapter is connected to.</para>
+          </listitem>
+          
+          This allows you to change the address range occupied by
+          <listitem>
             <para><computeroutput>--bridgeadapter<1-N>
             none|<devicename></computeroutput>: If bridged networking
             has been enabled for a virtual network card (see the
@@ -952,9 +1019,10 @@ Statistics update:  disabled</screen></para>
     </sect2>
 
     <sect2 id="vboxmanage-modifyvm-other">
-      <title>Serial port, audio, clipboard and USB settings</title>
+      <title>Miscellaneous settings</title>
 
-      <para>The following other hardware settings are available through
+      <para>The following other hardware settings, such as serial port, audio,
+      clipboard, drag'n drop, monitor and USB settings are available through
       <computeroutput>VBoxManage modifyvm</computeroutput>:<itemizedlist>
           <listitem>
             <para><computeroutput>--uart<1-N> off|<I/O base>
@@ -1000,6 +1068,23 @@ Statistics update:  disabled</screen></para>
                 </listitem>
 
                 <listitem>
+                  <para><computeroutput>tcpserver
+                  <port></computeroutput>: This
+                  tells VirtualBox to create a TCP socket on the host with TCP
+                  <computeroutput><port></computeroutput> and
+                  connect the virtual serial device to it. Note that UNIX-like
+                  systems require ports over 1024 for normal users.</para>
+                </listitem>
+
+                <listitem>
+                  <para><computeroutput>tcpclient
+                  <hostname:port></computeroutput>: This operates just like
+                  <computeroutput>tcpserver ...</computeroutput>, except that the
+                  TCP socket is not created by VirtualBox,
+                  but assumed to exist already.</para>
+                </listitem>
+
+                <listitem>
                   <para><computeroutput><devicename></computeroutput>:
                   If, instead of the above, the device name of a physical
                   hardware serial port of the host is specified, the virtual
@@ -1014,6 +1099,25 @@ Statistics update:  disabled</screen></para>
           </listitem>
 
           <listitem>
+            <para><computeroutput>--lptmode<1-N>
+            <Device></computeroutput>:
+            Specifies the Device Name of the parallel port that
+            the Parallel Port feature will be using. Use this
+            <emphasis>before</emphasis> <computeroutput>--lpt</computeroutput>.
+            This feature is host operating system specific.</para>
+          </listitem>
+
+          <listitem>
+            <para><computeroutput>--lpt<1-N>
+            <I/O base> <IRQ></computeroutput>:
+            Specifies the I/O address of the parallel port and the IRQ
+            number that the Parallel Port feature will be using. Use this
+            <emphasis>after</emphasis>
+            <computeroutput>--lptmod</computeroutput>. I/O base address and IRQ are
+			the values that guest sees i.e. the values avalable under guest Device Manager.</para>
+          </listitem>
+
+          <listitem>
             <para><computeroutput>--audio none|null|oss</computeroutput>: With
             this option, you can set whether the VM should have audio
             support.</para>
@@ -1022,9 +1126,18 @@ Statistics update:  disabled</screen></para>
           <listitem>
             <para><computeroutput>--clipboard
             disabled|hosttoguest|guesttohost|bidirectional</computeroutput>:
-            With this setting, you can select whether the guest operating
-            system's clipboard should be shared with the host; see <xref
-            linkend="generalsettings" />. This requires that the Guest
+            With this setting, you can select if and how the guest or host
+            operating system's clipboard should be shared with the host or guest;
+            see <xref linkend="generalsettings" />. This requires that the Guest
+            Additions be installed in the virtual machine.</para>
+          </listitem>
+
+          <listitem>
+            <para><computeroutput>--draganddrop
+            disabled|hosttoguest|guesttohost|bidirectional</computeroutput>:
+            With this setting, you can select the current drag'n drop mode
+            being used between the host and the virtual machine;
+            see <xref linkend="guestadd-dnd" />. This requires that the Guest
             Additions be installed in the virtual machine.</para>
           </listitem>
 
@@ -1045,7 +1158,15 @@ Statistics update:  disabled</screen></para>
             option enables or disables the VM's virtual USB 2.0 controller;
             see <xref linkend="settings-usb" /> for details.</para>
           </listitem>
+
+          <listitem>
+            <para><computeroutput>--usbxhci on|off</computeroutput>: This
+            option enables or disables the VM's virtual USB 3.0 controller;
+            see <xref linkend="settings-usb" /> for details.</para>
+          </listitem>
         </itemizedlist></para>
+
+        <!-- @todo r=andy Document tracing-* commands -->
     </sect2>
 
     <sect2 id="vboxmanage-modifyvm-vrde">
@@ -1055,12 +1176,18 @@ Statistics update:  disabled</screen></para>
       available through <computeroutput>VBoxManage
       modifyvm</computeroutput>:<itemizedlist>
           <listitem>
-            <para><computeroutput>--vrde on|off</computeroutput>: With the
-            VirtualBox graphical user interface, this enables or disables the
-            VirtualBox remote desktop extension (VRDE) server. Note that if
-            you are using <computeroutput>VBoxHeadless</computeroutput> (see
-            <xref linkend="vboxheadless" />), VRDE is enabled by
-            default.</para>
+            <para><computeroutput>--vrde on|off</computeroutput>:
+            This enables or disables the VirtualBox remote desktop extension
+            (VRDE) server.</para>
+          </listitem>
+
+          <!-- @todo r=andy Document vrdeproperty -->
+
+          <listitem>
+            <para><computeroutput>--vrdeextpack default|<name></computeroutput>:
+            Allows to specify the library to use for to access the VM
+            remotely. The default is to use the RDP code which is part of the
+            Oracle VM VirtualBox Extension Pack.</para>
           </listitem>
 
           <listitem>
@@ -1109,6 +1236,13 @@ Statistics update:  disabled</screen></para>
           </listitem>
 
           <listitem>
+            <para><computeroutput>--vrdeauthlibrary
+            default|<name></computeroutput>: This allos to set the
+            library used for RDP authentication, see <xref lang=""
+            linkend="vbox-auth" /> for details.</para>
+          </listitem>
+
+          <listitem>
             <para><computeroutput>--vrdemulticon on|off</computeroutput>: This
             enables multiple connections to the same VRDE server, if the
             server supports this feature; see <xref lang=""
@@ -1203,6 +1337,26 @@ Statistics update:  disabled</screen></para>
           </listitem>
         </itemizedlist></para>
     </sect2>
+    
+    <sect2 id="vboxmanage-modifyvm-debugging">
+      <title>Debugging settings</title>
+
+      <para>The following settings are only relevant for low-level VM
+      debugging. Regular users will never need these settings.<itemizedlist>
+          <listitem>
+            <para><computeroutput>--tracing-enabled on|off</computeroutput>:
+            Enable the tracebuffer. This consumes some memory for the tracebuffer
+            and adds extra overhead.</para>
+          </listitem>
+          <listitem>
+            <para><computeroutput>--tracing-config <config-string></computeroutput>:
+            Allows to configure tracing. In particular this defines which group of
+            tracepoints are enabled.</para>
+          </listitem>
+        </itemizedlist>
+      </para>
+    </sect2>
+
   </sect1>
 
   <sect1 id="vboxmanage-clonevm">
@@ -1434,6 +1588,17 @@ Virtual system 0:
           <para>Starts a VM with a minimal GUI and limited features.</para>
         </glossdef>
       </glossentry>
+
+      <glossentry>
+        <glossterm><computeroutput>separate</computeroutput></glossterm>
+
+        <glossdef>
+          <para>Starts a VM with detachable UI (technically it is a headless VM
+            with user interface in a separate process). This is an experimental
+            feature as it lacks certain functionality at the moment (e.g. 3D
+            acceleration will not work).</para>
+        </glossdef>
+      </glossentry>
     </glosslist>
 
     <note>
@@ -1524,6 +1689,8 @@ Virtual system 0:
     VM's running state:</para>
 
     <itemizedlist>
+      <!-- @todo r=andy Document keyboardputscancode -->
+
       <listitem>
         <para>The <computeroutput>setlinkstate<1-N></computeroutput>
         operation connects or disconnects virtual network cables from their
@@ -1548,6 +1715,56 @@ Virtual system 0:
       </listitem>
 
       <listitem>
+        <para>With the "nictrace" options, you can optionally trace
+        network traffic by dumping it to a file, for debugging
+        purposes.</para>
+
+        <para>With <computeroutput>nictrace<1-N>
+        on|off</computeroutput>, you can enable network tracing for a
+        particular virtual network card.</para>
+
+        <para>If enabled, you must specify with
+        <computeroutput>--nictracefile<1-N>
+        <filename></computeroutput> what file the trace should be
+        logged to.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>nicpromisc<1-N>
+        deny|allow-vms|allow-all</computeroutput>:
+        This allows you, for each of the VM's virtual network cards, to
+        specify how the promiscious mode is handled. This setting is only
+        relevant for bridged networking.
+        <computeroutput>deny</computeroutput> (default setting) hides
+        any traffic not intended for this VM.
+        <computeroutput>allow-vms</computeroutput> hides all host
+        traffic from this VM but allows the VM to see traffic from/to other
+        VMs.
+        <computeroutput>allow-all</computeroutput> removes this
+        restriction completely.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>nicproperty<1-N>
+        <paramname>="paramvalue"</computeroutput>:
+        This option, in combination with "nicgenericdrv" allows you to
+        pass parameters to rarely-used network backends.</para><para>
+        Those parameters are backend engine-specific, and are different
+        between UDP Tunnel and the VDE backend drivers. For example,
+        please see <xref linkend="network_udp_tunnel" />.
+        </para>
+      </listitem>
+
+      <listitem>
+        <para>The <computeroutput>guestmemoryballoon</computeroutput>
+        operation changes the size of the guest memory balloon, that is,
+        memory allocated by the VirtualBox Guest Additions from the guest
+        operating system and returned to the hypervisor for re-use by other
+        virtual machines. This must be specified in megabytes. For details,
+        see <xref linkend="guestadd-balloon" />.</para>
+      </listitem>
+
+      <listitem>
         <para><computeroutput>usbattach</computeroutput> and
         <computeroutput>usbdettach</computeroutput> make host USB devices
         visible to the virtual machine on the fly, without the need for
@@ -1559,6 +1776,24 @@ Virtual system 0:
       </listitem>
 
       <listitem>
+        <para><computeroutput>clipboard
+        disabled|hosttoguest|guesttohost|bidirectional</computeroutput>:
+        With this setting, you can select if and how the guest or host
+        operating system's clipboard should be shared with the host or guest;
+        see <xref linkend="generalsettings" />. This requires that the Guest
+        Additions be installed in the virtual machine.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>draganddrop
+        disabled|hosttoguest|guesttohost|bidirectional</computeroutput>:
+        With this setting, you can select the current drag'n drop mode
+        being used between the host and the virtual machine;
+        see <xref linkend="guestadd-dnd" />. This requires that the Guest
+        Additions be installed in the virtual machine.</para>
+      </listitem>
+
+      <listitem>
         <para><computeroutput>vrde on|off</computeroutput> lets you enable or
         disable the VRDE server, if it is installed.</para>
       </listitem>
@@ -1572,6 +1807,7 @@ Virtual system 0:
         linkend="vboxmanage-modifyvm-other" />.</para>
       </listitem>
 
+
       <listitem>
         <para><computeroutput>setvideomodehint</computeroutput> requests that
         the guest system change to a particular video mode. This requires that
@@ -1585,18 +1821,83 @@ Virtual system 0:
       </listitem>
 
       <listitem>
+        <para><computeroutput>videocap on|off</computeroutput> enables or disables
+        recording a VM session into a WebM/VP8 file.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>videocapscreens all|<screen ID> [<screen ID> ...]]</computeroutput>
+        allows to specify which screens of the VM are being recorded. This setting
+        cannot be changed while video capturing is enabled. Each screen is recorded
+        into a separate file.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>videocapfile <file></computeroutput> sets the filename
+        VirtualBox uses to save the recorded content. This setting cannot be changed
+        while video capturing is enabled.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>videocapres <width> <height></computeroutput>
+        sets the resolution (in pixels) of the recorded video. This setting cannot be
+        changed while video capturing is enabled.</para>
+      </listitem>
+
+      <listitem> <!-- @todo r=andy Clarify rate. -->
+        <para><computeroutput>videocaprate <rate></computeroutput> sets the
+        bitrate in kilobits (kb) per second. Increasing this value makes the video
+        look better for the cost of an increased file size. This setting cannot be
+        changed while video capturing is enabled.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>videocapfps <fps></computeroutput> sets the
+        maximum number of frames per second (FPS) to be recorded. Frames with a
+        higher frequency will be skipped. Reducing this value increases the number
+        of skipped frames and reduces the file size. This setting cannot be changed
+        while video capturing is enabled.</para>
+      </listitem>
+
+      <listitem> <!-- @todo r=andy Clarify time format. -->
+        <para><computeroutput>videocapmaxtime <time></computeroutput> sets
+        the maximum time the video capturing will take place since activation.
+        The capturing stops when the defined time interval has elapsed. If this
+        value is zero the capturing is not limited by time. This setting cannot
+        be changed while video capturing is enabled.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>videocapmaxsize <MB></computeroutput> limits
+        the maximum size of the captured video file (in MB). The capturing stops
+        when file size has reached the specified size. If this value is zero
+        the capturing will not be limited by file size. This setting cannot be
+        changed while video capturing is enabled.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>videocapopts <key=value> [<key=value> ...]</computeroutput>
+        can be used to specify additional video capturing options. These options
+        only are for advanced users and must be specified in a comma-separated
+        key=value format, e.g. <computeroutput>foo=bar,a=b</computeroutput>.
+        This setting cannot be changed while video capturing is enabled.</para>
+      </listitem>
+
+      <listitem>
         <para>The <computeroutput>setcredentials</computeroutput> operation is
         used for remote logons in Windows guests. For details, please refer to
         <xref linkend="autologon" />.</para>
       </listitem>
 
+      <!-- @todo r=andy Document teleport! -->
+
       <listitem>
-        <para>The <computeroutput>guestmemoryballoon</computeroutput>
-        operation changes the size of the guest memory balloon, that is,
-        memory allocated by the VirtualBox Guest Additions from the guest
-        operating system and returned to the hypervisor for re-use by other
-        virtual machines. This must be specified in megabytes. For details,
-        see <xref linkend="guestadd-balloon" />.</para>
+        <para><computeroutput>--plugcpu|unplugcpu
+        <id></computeroutput>: If CPU hot-plugging is enabled, this adds
+        a virtual CPU to the virtual machines (or removes one).
+        <computeroutput><id></computeroutput> specifies the index of
+        the virtual CPU to be added or removed and must be a number from 0
+        to the maximum no. of CPUs configured. CPU 0 can never be removed.</para>
       </listitem>
 
       <listitem>
@@ -1605,6 +1906,9 @@ Virtual system 0:
         time a virtual CPU can use. A value of 50 implies a single virtual CPU
         can use up to 50% of a single host CPU.</para>
       </listitem>
+
+      <!-- @todo r=andy Document webcam! -->
+
     </itemizedlist>
   </sect1>
 
@@ -2013,8 +2317,8 @@ Virtual system 0:
                             --name <name>
                             [--add <ide/sata/scsi/floppy>]
                             [--controller <LsiLogic|LSILogicSAS|BusLogic|
-                                          IntelAhci|PIIX3|PIIX4|ICH6|I82078>]
-                            [--portcount <1-30>]
+                                          IntelAhci|PIIX3|PIIX4|ICH6|I82078|usb>]
+                            [--sataportcount <1-30>]
                             [--hostiocache on|off]
                             [--bootable on|off]
                             [--remove]</screen>
@@ -2055,7 +2359,7 @@ Virtual system 0:
         </glossentry>
 
         <glossentry>
-          <glossterm><computeroutput>--portcount</computeroutput></glossterm>
+          <glossterm><computeroutput>--sataportcount</computeroutput></glossterm>
 
           <glossdef>
             <para>This determines how many ports the SATA controller should
@@ -2759,8 +3063,8 @@ Value: 2006.01.01</screen>
   <sect1 id="vboxmanage-guestcontrol">
     <title>VBoxManage guestcontrol</title>
 
-    <para>The "guestcontrol" commands allow you to control certain things
-    inside a guest from the host. Please see <xref
+    <para>The <computeroutput>guestcontrol</computeroutput> commands allow you
+    to control certain things inside a guest from the host. Please see <xref
     linkend="guestadd-guestcontrol" /> for an introduction.</para>
 
     <para>Generally, the syntax is as follows:</para>
@@ -2783,7 +3087,7 @@ Value: 2006.01.01</screen>
             [--environment "<NAME>=<VALUE> [<NAME>=<VALUE>]"]
             [--verbose] [--timeout <msec>]
             [--wait-exit] [--wait-stdout] [--wait-stderr]
-            [--dos2unix] [--unquoted-args] [--unix2dos]
+            [--dos2unix] [--unix2dos]
             -- [[<argument1>] ... [<argumentN>]]</screen>
 
           <para>where the parameters mean: <glosslist>
@@ -2844,17 +3148,6 @@ Value: 2006.01.01</screen>
               </glossentry>
 
               <glossentry>
-                <glossterm><computeroutput>--unquoted-args</computeroutput></glossterm>
-
-                <glossdef>
-                  Work around for Windows and OS/2 applications not following normal
-                  argument quoting and escaping rules. The arguments are passed to the
-                  application without any extra quoting, just a single space between each.
-                  <footnote>This parameter was introduced with VirtualBox 4.3.28</footnote>
-                </glossdef>
-              </glossentry>
-
-              <glossentry>
                 <glossterm><computeroutput>--environment
                     "<NAME>=<VALUE>"</computeroutput></glossterm>
 
@@ -4171,7 +4464,7 @@ Value: 2006.01.01</screen>
     </glosslist>
   </sect1>
 
-  <sect1>
+  <sect1 id="vboxmanage-hostonlyif">
     <title>VBoxManage hostonlyif</title>
 
     <para>With "hostonlyif" you can change the IP configuration of a host-only
@@ -4179,6 +4472,31 @@ Value: 2006.01.01</screen>
     refer to <xref linkend="network_hostonly" />. Each host-only interface is
     identified by a name and can either use the internal DHCP server or a
     manual IP configuration (both IP4 and IP6).</para>
+
+    <para>The following list summarizes the available subcommands:</para>
+
+    <glosslist>
+      <glossentry>
+        <glossterm><computeroutput>ipconfig "<name>"</computeroutput></glossterm>
+        <glossdef>
+          <para>Configure a hostonly interface</para>
+        </glossdef>
+      </glossentry>
+      <glossentry>
+        <glossterm><computeroutput>create</computeroutput></glossterm>
+        <glossdef>
+          <para>Ceates a new vboxnet<N> interface on the host OS.
+            This command is essential before you can attach VMs to host-only network.</para>
+        </glossdef>
+      </glossentry>
+      <glossentry>
+        <glossterm><computeroutput>remove vboxnet<N></computeroutput></glossterm>
+        <glossdef>
+          <para>Removes a vboxnet<N> interface from the host OS.</para>
+        </glossdef>
+      </glossentry>
+    </glosslist>
+
   </sect1>
 
   <sect1 id="vboxmanage-dhcpserver">
diff --git a/doc/manual/fr_FR/UserManual.xml b/doc/manual/fr_FR/UserManual.xml
index bfe4df0..da39c93 100644
--- a/doc/manual/fr_FR/UserManual.xml
+++ b/doc/manual/fr_FR/UserManual.xml
@@ -12,6 +12,12 @@
 
     <corpauthor>$VBOX_VENDOR</corpauthor>
 
+    <othercredit class="translator">
+      <contrib>Traducteur</contrib>
+      <firstname>Jean-Philippe</firstname>
+      <surname>Mengual</surname>
+    </othercredit>
+
     <address>http://www.virtualbox.org</address>
 
     <copyright>
diff --git a/doc/manual/fr_FR/images/dnd-modes.png b/doc/manual/fr_FR/images/dnd-modes.png
new file mode 100644
index 0000000..ad5f62e
Binary files /dev/null and b/doc/manual/fr_FR/images/dnd-modes.png differ
diff --git a/doc/manual/fr_FR/images/vbox-components.png b/doc/manual/fr_FR/images/vbox-components.png
index 441192c..45ad6e5 100644
Binary files a/doc/manual/fr_FR/images/vbox-components.png and b/doc/manual/fr_FR/images/vbox-components.png differ
diff --git a/doc/manual/fr_FR/user_AdvancedTopics.xml b/doc/manual/fr_FR/user_AdvancedTopics.xml
index 9c00d87..e48ffe4 100644
--- a/doc/manual/fr_FR/user_AdvancedTopics.xml
+++ b/doc/manual/fr_FR/user_AdvancedTopics.xml
@@ -15,7 +15,7 @@
       VBoxSDL est utilisé actuellement d'abord pour déboguer VirtualBox, donc
       il n'est pas officiellement supporté. Vous pouvez quand même le trouver
       utile pour des environnements où les machines virtuelles ne sont pas
-      nécessairement contrôlées par la même personne qui utilise la machine virtuelle.<note>
+      nécessairement contrôlées par la personne qui utilise la machine virtuelle.<note>
           <para>VBoxSDL n'est pas disponible sur la plateforme hôte Mac OS X.</para>
         </note></para>
 
@@ -33,7 +33,7 @@
 
       <para>Pour démarrer une machine virtuelle avec VBoxSDL au lieu de l'interface
       graphique de VirtualBox, tapez ce qui suit sur une ligne de 
-      commanees&#xA0;:<screen>VBoxSDL --startvm <vm></screen></para>
+      commandes&#xA0;:<screen>VBoxSDL --startvm <vm></screen></para>
 
       <para>où <computeroutput><vm></computeroutput> est, comme d'habitude
       dans les paramètres en ligne de commande de VirtualBox, le nom ou l'UUID
@@ -70,7 +70,7 @@
       utilisez le paramètre <computeroutput>--seclabelsiz</computeroutput>.</para>
 
       <para>Vous pouvez définir le texte de l'étiquette avec <screen>VBoxManage setextradata "nom VM" "VBoxSDL/SecureLabel" "L étiquette"</screen>
-      Une modification ce cette étiquette prendra effet immédiatement.</para>
+      Une modification de cette étiquette prendra effet immédiatement.</para>
 
       <para>En général, les résolutions du plein écran sont limitées à 
       certaines géométries "standards" telles que 1024 x 768. Une augmentation
@@ -81,7 +81,7 @@
       dessinée en haut de la zone de l'écran de l'invité. Pour surmonter le 
       problème selon lequel le bas de l'écran de l'invité est caché, VBoxSDL 
       peut fournir des modes graphiques personnalisés à l'invité, réduits par
-      la hauteur de l'étiquette. Pour les invités Windows et ceux
+      la hauteur de l'étiquette. Pour les invités Windows et les
       Solaris et Linux récents, les suppléments invité de VirtualBox fournissent
       automatiquement les modes graphiques réduits. De plus, le BIOS VESA a été
       ajusté pour dupliquer sa table en mode standard avec des résolutions
@@ -121,7 +121,7 @@ vga = 839</screen>
       entrée de la liste <computeroutput>ps</computeroutput>). Par exemple, quand
       vous basculez vers un autre VT et quand vous enregistrez la machine virtuelle
       à partir de ce terminal, la séquence suivante peut être utilisée pour
-      s'assurer que la VM sauvegardée avec des modificateurs bloqué&#xA0;:</para>
+      s'assurer que la VM n'est pas sauvegardée avec des modificateurs bloqué&#xA0;:</para>
 
       <para><screen>kill -usr1 <pid>
 VBoxManage controlvm "Windows 2000" savestate</screen></para>
@@ -138,7 +138,7 @@ VBoxManage controlvm "Windows 2000" savestate</screen></para>
     il pourrait être souhaitable d'effectuer des identifications automatiques et
     coordonnées en utilisant des autorisations issues d'un système d'identification
     maître. (Avec les "autorisations", on se réfère aux informations d'identification
-    qui consistent dans le nom d'utilisateur, le mot de passe et le nom de domaine,
+    qui consistent en nom d'utilisateur, mot de passe et nom de domaine,
     où chaque valeur pourrait être vide.)</para>
 
     <sect2 id="autologon_win">
@@ -185,7 +185,7 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}
 
 HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</screen></para>
 
-      <para>avec pour valeurs celles par défault (la clé nommçe 
+      <para>avec pour valeurs celles par défault (la clé nommée 
       <computeroutput>(Default)</computeroutput> dans chaque clé) définies sur
       <computeroutput>VBoxCredProv</computeroutput>. Après quoi, il faut créer
       une nouvelle chaîne nommée <screen>HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32\ThreadingModel</screen>
@@ -196,11 +196,11 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
 
       <screen>VBoxManage controlvm "Windows XP" setcredentials "John Doe" "secretpassword" "DOMTEST"</screen>
 
-      <para>Pendant que la VM est en fonction, vous pouvez hercher les autorisations
+      <para>Pendant que la VM est en fonction, vous pouvez interroger les autorisations
       accordées par les modules d'identification de VirtualBox (GINA ou
-      fournisseur d'autorisation) en utilipnt le pérphérique des suppléments
+      fournisseur d'autorisation) en utilisant le pérphérique des suppléments
       invité de VirtualBox. Quand Windows est en mode "déconnecté", les modules
-      d'identification chercheront constament les autorisations et si elles
+      d'identification interrogeront constament les autorisations et si elles
       existent, il tentera une identification. Après avoir récupéré les autorisations,
       les modules d'identification les écraseront pour que la commande ci-dessus
       doive se répéter pour les identifications consécutives.</para>
@@ -217,7 +217,7 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
             <para>Pour les <emphasis role="bold">invités Windows XP,</emphasis> 
             le sous-système d'identification doit être configuré pour utiliser 
             la boîte de dialogue classique d'identification car le module GINA
-            de VirtualBoxu ne supporte pas la boîte de dialogz de bienvenue à
+            de VirtualBox ne supporte pas la boîte de dialogue de bienvenue à
             la XP.</para>
           </listitem>
 
@@ -248,7 +248,7 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
       <para>La commande suivante oblige VirtualBox à garder les autorisations
       après leur lecture par l'invité et au redémarrage de la VM&#xA0;:
       <screen>VBoxManage setextradata "Windows XP" VBoxInternal/Devices/VMMDev/0/Config/KeepCredentials 1</screen>Remarquez
-      que c'est un risque de sécurité potentiel car une application mavrc,llante
+      que c'est un risque de sécurité potentiel car une application malveillante
       en fonction sur l'invité pourrait solliciter ces informations en utilisant
       la bonne interface.</para>
     </sect2>
@@ -281,11 +281,11 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
       du service PAM.</para>
 
       <note>
-        <para><computeroutput>pam_vbox.so</computeroutput> ne supporte que le
-        <computeroutput>auth</computeroutput> primitif. D'autres primates tels
+        <para><computeroutput>pam_vbox.so</computeroutput> ne supporte que la primitive
+        <computeroutput>auth</computeroutput>. D'autres primitives telles
         que <computeroutput>account</computeroutput>,
         <computeroutput>session</computeroutput> ou
-        <computeroutput>password</computeroutput> ne sont pas supportés.</para>
+        <computeroutput>password</computeroutput> ne sont pas supportées.</para>
       </note>
 
       <para>Le module <computeroutput>pam_vbox.so</computeroutput> est inclu
@@ -296,10 +296,10 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
       <computeroutput>/lib/security/</computeroutput> sur les invités Linux 32
       bit ou <computeroutput>/lib64/security/</computeroutput> sur ceux 64 bits.
       Merci de vous reporter à la documentation de votre OS invité pour le bon
-      répertuire du module PAM.</para>
+      répertoire du module PAM.</para>
 
       <para>Par exemple, pour utiliser <computeroutput>pam_vbox.so</computeroutput>
-      avec un OS invité Linux Ubuntu et GDM (le GNOME Desktop Manager) pour identifier
+      avec un OS invité Linux Ubuntu et GDM (GNOME Desktop Manager) pour identifier
       les utilisateurs automatiquement avec les droits passés par l'hôte, l'OS
       invité doit être configuré comme ce qui suit&#xA0;:</para>
 
@@ -311,18 +311,18 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
         </listitem>
 
         <listitem>
-          <para>Éditz le fichier de configuration de PAM avec GDM qui se trouve
+          <para>Éditez le fichier de configuration de PAM avec GDM qui se trouve
           dans <computeroutput>/etc/pam.d/gdm</computeroutput>, en ajoutant la
           ligne <computeroutput>auth requisite pam_vbox.so</computeroutput> au
           début. En outre, dans la plupart des distributions Linux, il existe
           un fichier appelé <computeroutput>/etc/pam.d/common-auth</computeroutput>. 
-          Ce fichier est inclut dans de nombreux services (comme le fichier GDM
+          Ce fichier est inclu dans de nombreux services (comme le fichier GDM
           indiqué ci-dessus). Vous devez y ajouter la ligne <computeroutput>auth
           requisite pam_vbox.so</computeroutput>.</para>
         </listitem>
 
         <listitem>
-          <para>Si vous voulez une authentification contre la base de données
+          <para>Si vous voulez une authentification via la base de données
           shadow en utilisant <computeroutput>pam_unix.so</computeroutput> ou
           <computeroutput>pam_unix2.so</computeroutput>, l'argument
           <computeroutput>try_first_pass</computeroutput> de
@@ -354,25 +354,25 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
           l'hôte, en d'autres termes&#xA0;: quand une invite de connexion s'affiche
           (ppar exemple via GDM/KDM ou la console texte) et quand pam_vbox n'a
           pas encore les autorisations, il n'attend pas qu'elles viennent. Le module
-          suivant de la pile PAM (selon la configuration de PAM) aura une chance
-          d'authentification.</para>
+          suivant de la pile PAM (selon la configuration de PAM) aura l'opportunité
+          d'authentifier.</para>
         </note></para>
 
       <para>À partir de VirtualBox 4.1.4 pam_vbox supporte plusieurs paramètres
       de propriétés d'invité résidant tous dans
       <computeroutput>/VirtualBox/GuestAdd/PAM/</computeroutput>. Ces paramètres
-      permettent à pam_vbox d'attendre que les autorisations soient fournies dans
+      permettent à pam_vbox d'attendre que les autorisations soient fournies par
       l'hôte et, éventuellement, il peut afficher un message tout en les attendant.
       Les propriétés d'invité suivantes peuvent être définies&#xA0;:</para>
 
       <orderedlist>
         <listitem>
-          <para><computeroutput>CredsWait</computeroutput>&#xA0;: Définissez sur
+          <para><computeroutput>CredsWait</computeroutput>&#xA0;: Indiquez
           "1" si pam_vbox devrait commencer à attendre jusqu'à ce que les autorisations
           viennent de l'hôte. En attendant, aucune autre méthode d'authentification
           comme la connexion à la main ne sera disponible. Si cette propriété est
           vide ou effacée, les autorisations ne seront pas attendues et pam_vbox
-          comme avant (voir le paragraphe ci-dessus). Cette propriété doit être
+          agira comme avant (voir paragraphe ci-dessus). Cette propriété doit être
           définie en lecture seule pour l'invité
           (<computeroutput>RDONLYGUEST</computeroutput>).</para>
         </listitem>
@@ -395,7 +395,7 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
         </listitem>
       </orderedlist>
 
-      <para>Pour personnaliser davantage pam_vbox, il existe les propriçtés 
+      <para>Pour personnaliser davantage pam_vbox, il existe les propriétés 
       invité suivantes&#xA0;:</para>
 
       <orderedlist>
@@ -473,7 +473,7 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
 
         <note><para>vbox-greeter est indépendant de la session graphique choisie
         par l'utilisateur (comme Gnome, KDE, Unity etc). Néanmoins, il exige
-        FLTK 1.3pour afficher sa propre interface utilisateur.</para></note>
+        FLTK 1.3 pour afficher sa propre interface utilisateur.</para></note>
 
         <para>De noubreuses propriétés invité peuvent être utilisées pour
         personnaliser davantage l'identification de l'utilisateur. Pour identifier
@@ -487,14 +487,14 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
 
         <orderedlist>
           <listitem>
-            <para><computeroutput>HideRestart</computeroutput> : Réglez-le sur
+            <para><computeroutput>HideRestart</computeroutput> : Indiquez
             "1" si vbox-greeter doit masquer le bouton de redémarrage de l'invité.
             Vous devez définir cette propriété en lecture seule pour l'invité
             (<computeroutput>RDONLYGUEST</computeroutput>).</para>
           </listitem>
 
           <listitem>
-            <para><computeroutput>HideShutdown</computeroutput> : Réglez-la
+            <para><computeroutput>HideShutdown</computeroutput> : Indiquez
             à "1" si vbox-greeter doit masquer le bouton d'extinction de
             l'invité. Vous devez définir cette propriété en lecture seule pour l'invité
             (<computeroutput>RDONLYGUEST</computeroutput>).</para>
@@ -503,14 +503,14 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
           <listitem>
             <para><computeroutput>BannerPath</computeroutput> : Chemin vers
             un fichier .PNG à utiliser comme bannière en haut. La taille de
-            l'image doit être de 460 x 90 pixels, quelle rue soit la profondeur
+            l'image doit être de 460 x 90 pixels, quelle que soit la profondeur
             de bit. Vous devez définir cette propriété en lecture seule pour l'invité
             (<computeroutput>RDONLYGUEST</computeroutput>).</para>
           </listitem>
 
           <listitem>
-            <para><computeroutput>UseTheming</computeroutput> : Définissez-la
-            à "1" pour activer les options de thème suivantes.
+            <para><computeroutput>UseTheming</computeroutput> : Indiquez
+            "1" pour activer les options de thème suivantes.
             Vous devez définir cette propriété en lecture seule pour l'invité
             (<computeroutput>RDONLYGUEST</computeroutput>).</para>
           </listitem>
@@ -636,7 +636,7 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
       <title>Paramétrage approfondi des pilotes graphique et souris de l'invité</title>
 
       <para>Cette section suppose que vous êtes familier de la configuration de
-      votre serveur X.Org en utilisant xorg.conf et éventuellement les méhanismes
+      votre serveur X.Org en utilisant xorg.conf et éventuellement des mécanismes
       récents en utilisant hal ou udev et xorg.conf.d. Sinon, vous pouvez apprendre
       à les utiliser en étudiant la documentation fournie avec X.Org.</para>
 
@@ -669,11 +669,11 @@ HKEY_CLASSES_ROOT\CLSID\{275D3BCC-22BB-4948-A7F6-3A3054EBA92B}\InprocServer32</s
       <para>Pour que l'intégration graphique fonctionne correctement, le serveur
       X doit charger le pilote vboxvideo (beaucoup de versions récentes du serveur
       X le cherchent automatiquement si elles voient qu'elles sont sur VirtualBox) 
-      et pour uneexpérience utilisateur optimale,  les pilotes du noyau invité
-      doivent être chargés et l'outil des supplçments invité VBoxClient doit être
-       en fonction en tant que client dans la session X. Pour que l'intégration de
-       la souris fonctionne correctement, les pilotes du noyau invité doivent
-       être chargés et, au surplus, dans les serveurs X de X.Org X11R6.8
+      et pour une expérience utilisateur optimale,  les pilotes du noyau invité
+      doivent être chargés et l'outil des suppléments invité VBoxClient doit être
+      en fonction en tant que client dans la session X. Pour que l'intégration de
+      la souris fonctionne correctement, les pilotes du noyau invité doivent
+      être chargés et, au surplus, dans les serveurs X de X.Org X11R6.8
       à X11R7.1 et dans XFree86 version 4.3, le bon pilote vboxmouse doit être 
       chargé et associé à /dev/mouse ou /dev/psaux&#xA0;; dans le serveur X.Org
       1.3 ou supérieur, un pilote de souris PS/2 doit être chargé et le bon
@@ -715,7 +715,7 @@ EndSection</screen>
   <sect1 id="cpuhotplug">
     <title>Montage de processeur à chaud</title>
 
-    <para>Quand des machines virtuelles fonctionnent sur des szstèmes
+    <para>Quand des machines virtuelles fonctionnent sur des systèmes
     d'exploitation serveurs modernes, VirtualBox supporte le montage à chaud de
     processeur.<footnote>
         <para>Le support du montage de processeur à chaud a été introduit avec VirtualBox
@@ -723,12 +723,12 @@ EndSection</screen>
       </footnote> Alors que, sur un ordinateur physique, cela voudrait dire qu'un
     processeur peut être ajouté ou supprimé pendant que la machine fonctionne,
     VirtualBox supporte l'ajout et le retrait de processeurs virtuels pendant que la
-    machine is virtuelle est en fonction.</para>
+    machine virtuelle est en fonction.</para>
 
     <para>Le montage à chaud de processeur ne fonctionne qu'avec les systèmes
     d'exploitation invités qui le supportent. Jusque-là, il ne s'applique qu'à
     Linux et Windows Server 2008 x64 édition Data Center. Windows ne supporte que
-    l'ajout à chaud alors que Linux supporte l'ajout et le retrait à chaud., mais
+    l'ajout à chaud alors que Linux supporte l'ajout et le retrait à chaud. Mais
     pour utiliser cette fonction avec plus de 8 processeurs, il faut un invité
     Linux 64 bits.</para>
 
@@ -751,11 +751,11 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
     <para>Voir <xref linkend="vboxmanage-modifyvm" /> et <xref
     linkend="vboxmanage-controlvm" /> pour des détails.</para>
 
-    <para>Avec des invités Linux, ce qui suit s'applique&#xA0;: Pkur empêcher
+    <para>Avec des invités Linux, ce qui suit s'applique&#xA0;: Pour empêcher
     d'éjecter alors que le processeur est utilisé, il doit être éjecté de l'invité
     au préalable. Les suppléments invité pour Linux contiennent un service qui
     reçoit les événements de retrait à chaud et ils éjectent le processeur.
-    De plus, après qu'un processeur a été ajoutà à la VM, il n'est pas utilisç
+    De plus, après qu'un processeur ait été ajouté à la VM, il n'est pas utilisé
     automatiquement par Linux. Le service des suppléments invité pour Linux s'en
     chargera s'il est installé. Sinon, vous pouvez démarrer un processeur avec
     la commande suivante&#xA0;:<screen>echo 1 > /sys/devices/system/cpu/cpu<id>/online</screen></para>
@@ -773,7 +773,7 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
 
     <note>
       <para>Le module PCI passthrough est inclu comme un paquet d'extension de
-      VirtualBox, qui doit être installé séparémeq. Voir <xref
+      VirtualBox, qui doit être installé séparément. Voir <xref
       linkend="intro-installing" /> pour plus d'informations.</para>
     </note>
 
@@ -781,8 +781,8 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
     les périphériques PCI physiques de l'hôte sur l'invité même si l'hôte n'a pas
     de pilote pour ce périphérique particulier. Tant les cartes PCI normales que
     certaines cartes PCI express sont supportées. L'AGP et certaines cartes PCI
-    Express ne sont pas supportées pour l'instant si elles s'appuient sur l'unité
-    de programmation GART (Graphics Address Remapping Table) pour la gestion 
+    Express ne sont pas supportées pour l'instant si elles s'appuient sur la
+    programmation d'unités GART (Graphics Address Remapping Table) pour la gestion 
     des textures vu qu'il fait plutôt des opérations non triviales avec l'association
     de pages qui s'interfacent avec IOMMU. Il se peut que cette limite soit
     surmontée dans les prochaines versions.</para>
@@ -792,12 +792,12 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
     largement disponible. Si le périphérique utilise le bus mastering (à savoir
     qu'il fait sa propre DMA sur la mémoire de l'OS), une IOMMU est requise,
     sinon de telles transactions DMA peuvent écrire sur la mauvaise adresse physique
-    de la mémoire car le moteur DMA du pçriphérique est est programmé pour utiliser
+    de la mémoire car le moteur DMA du périphérique est programmé pour utiliser
     un protocole spécifique au périphérique pour faire des transactions avec la
-    mémoire. Les fonctions IOMMU comme traduction des unités correspondant à la
+    mémoire. Les fonctions IOMMU telle que la translation des unités de correspondance de
     mémoire physique accèdent aux requêtes du périphérique en utilisant la connaissance
     de l'adresse physique de la mémoire de l'invité via les règles de traduction
-    d'adresse shysique de l'hôte.</para>
+    d'adresse physique de l'hôte.</para>
 
     <para>La solution d'Intel pour IOMMU est vendue sous le nom "Intel Virtualization
     Technology for Directed I/O" (VT-d), et celle d'AMD s'appelle AMD-Vi. Merci
@@ -805,7 +805,7 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
     adaptée. Même si votre matériel n'a pas d'IOMMU, certaines cartes PCI peuvent
     fonctionner (comme des adaptateurs série PCI), mais l'invité affichera un
     avertissement au démarrage et l'exécution de la VM s'achèvera si le pilote
-    invité essaie d'activer le bus mastering.</para>
+    invité essaie d'activer le bus mastering de la carte.</para>
 
     <para>Très couramment, le BIOS ou 
     l'OS hôte désactive par défaut l'IOMMU. Donc avant d'essayer de l'utiliser,
@@ -824,7 +824,7 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
         </listitem>
 
         <listitem>
-          <para>La VM doit fonctionner avec VT-x/AMD-V et la pagination nested
+          <para>La VM doit fonctionner avec VT-x/AMD-V et la pagination imbriquée
           doit être activée.</para>
         </listitem>
 
@@ -860,7 +860,7 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
     <computeroutput>bus:device.function</computeroutput>). Cette adresse pourrait
     être utilisée pour identifier les périphériques pour aller plus loin. Par
     exemple, pour attacher un contrôleur réseau PCI du système listé ci-dessus,
-    au second bus PCI de l'invité, en périphériqz 5, la fonction 0, utilisez
+    au second bus PCI de l'invité, en périphérique 5, la fonction 0, utilisez
     la commande suivante&#xA0;:
     <screen>VBoxManage modifyvm "nom VM" --pciattach 02:00.0 at 01:05.0</screen>
     Pour détacher ce même périphérique, utilisez <screen>VBoxManage modifyvm "nom VM" --pcidetach 02:00.0</screen>
@@ -869,7 +869,7 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
     s'appliquent qu'à l'adresse de la carte au moment d'être attaché (hôte), et
     lors de l'initialisation du PCI de BIOS (invité).</para>
 
-    <para>Si la machine (irtuelle a un périphérique PCI attaché, certaines
+    <para>Si la machine virtuelle a un périphérique PCI attaché, certaines
     limitations s'appliquent&#xA0;: <orderedlist>
         <listitem>
            Seules les cartes PCI aux interruptions non partagées (telles que 
@@ -901,7 +901,7 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
       <title>Utilisation d'une webcam hôte dans l'invité</title>
 
       <para>VirtualBox 4.3 inclut une fonction expérimentale permettant à un 
-      invité d'utiliser une webcam hôte. Ceci complète le support génçral du
+      invité d'utiliser une webcam hôte. Ceci complète le support général du
       passthrough USB qui était la façon dont on utilisait généralement les webcams
       dans les anciennes versions. Le support de webcam passthrough peut gérer
       théoriquement des sources graphiques non USB, mais cela n'a pas été testé du
@@ -939,7 +939,7 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
             <screen>VBoxManage controlvm "nom VM" webcam attach [chemin_hôte_|alias [paramètres]]</screen>
             Ceci connectera une webcam à l'invité. Le paramètre
             <computeroutput>settings</computeroutput> est une chaîne 
-            <computeroutput>Paramètre1=Valer1;Paramètre2=Valeur2</computeroutput>, qui
+            <computeroutput>Paramètre1=Valeur1;Paramètre2=Valeur2</computeroutput>, qui
             permet de configurer la webcam émulée. Les paramètres suivants
             sont supportés :
             <itemizedlist>
@@ -992,10 +992,10 @@ VBoxManage controlvm "nom VM" unplugcpu 3</screen></para>
     </sect2>
 
     <sect2>
-      <title>Hôtes Linux</title>
+      <title>Hôtes Linux et Solaris</title>
 
       <para>Quand on déconnecte la webcam de l'hôte, la webcam émulée n'est automatiquement
-      déconnectée de de l'invité que si la webcam est en train de transmettre
+      déconnectée de l'invité que si la webcam est en train de transmettre
       de l'image. Si la webcam est inactive, vous devrez la déconnecter à la
       main en utilisant la commande
       <computeroutput>VBoxManage controlvm "nom VM" webcam detach ...</computeroutput>.</para>
@@ -1084,7 +1084,7 @@ vga = 864</screen>
       VirtualBox peut aussi présenter aux machines virtuelles soit des disques 
       durs entiers, soit des partitions sélectionnées, comme des disques virtuels.</para>
 
-      <para>Avec VirtualBox, ce typed'accès s'appelle "l'accès au disque dur brut"&#xA0;;
+      <para>Avec VirtualBox, ce type d'accès s'appelle "l'accès au disque dur brut"&#xA0;;
       il permet à un système d'exploitation invité d'accéder à son disque dur
       virtuel sans passer par le système de fichiers de l'OS hôte. La 
       différence de performance finale entre les fichiers images et les disques
@@ -1133,9 +1133,9 @@ vga = 864</screen>
         <code>/chemin/vers/fichier.vmdk</code> (il doit être absolu), et toutes
         les données seront lues et écrites à partir de <code>/dev/sda</code>.</para>
 
-        <para>Sur un hôte Windows, plutît que de spécifier le périphérique comme
+        <para>Sur un hôte Windows, plutôt que de spécifier le périphérique comme
         ci-dessus, utilisez par exemple <code>\\.\PhysicalDrive0</code>. Sur un
-        hôte Mac OS X, utilisez plutît, par exemple, <code>/dev/disk1</code>.
+        hôte Mac OS X, utilisez plutôt, par exemple, <code>/dev/disk1</code>.
         Remarquez que sur OS X, vous ne pouvez avoir d'accès à tout un disque
         que si aucun volume n'est monté à partir de là.</para>
 
@@ -1162,7 +1162,7 @@ vga = 864</screen>
         informations de partitionnement seront stockées dans l'image VMDK, donc
         vous pouvez par exemple installer un autre chargeur d'amorçage dans le
         disque dur virtuel sans toucher les informations de partitionnement de
-        l'hôte. Si l'invité pourra <emphasis>svoir</emphasis> toutes
+        l'hôte. Alors que l'invité pourra <emphasis>voir</emphasis> toutes
         les partitions existantes sur le disque physique, l'accès sera filtré de
         sorte que la lecture des partitions pour lesquelles aucun accès n'est
         autorisé ne contiendra que des zéros et que toutes les écritures dessus
@@ -1180,8 +1180,8 @@ vga = 864</screen>
         doit être absolu), et les partitions 1 et 5 de <code>/dev/sda</code> deviendraient
         accessibles à l'invité.</para>
 
-        <para>VirtualBox la même numçrotation de partitions que votre hôte Linux.
-        Il s'en suit que les numçros donnés dans l'exemple ci-dessus se référeraient
+        <para>VirtualBox utilise la même numérotation de partitions que l'hôte Linux.
+        Il s'en suit que les numéros donnés dans l'exemple ci-dessus se référeraient
         respectivement à la première partition primaire et au premier lecteur 
         logique de la partition étendue.</para>
 
@@ -1214,7 +1214,7 @@ vga = 864</screen>
       machine virtuelle, l'image ne se réfèrera pas à tout le disque mais seulement
       aux partitions individuelles (dans l'exemple 
         <code>/dev/sda1</code> et <code>/dev/sda5</code>). Par conséquent, l'accès
-        en lecture/écriture n'est requis que pou! les partitions concernées, pas
+        en lecture/écriture n'est requis que pour les partitions concernées, pas
         pour tout le disque. Mais lors de la création, un accès en lecture seule
         à tout le disque est nécessaire pour avoir les informations de
         partitionnement.</para>
@@ -1240,7 +1240,7 @@ vga = 864</screen>
     <sect2 id="changevpd">
       <title>Configuration des vendor product data (VPD) du disque dur</title>
 
-      <para>VirtualBox signale les données liçes au fabricant du produit de
+      <para>VirtualBox signale les données liées au fabricant du produit de
       ses disques durs virtuels, consistant dans le numéro de série du disque dur,
       le numro de révision du firmware et du modèle. Vous pouvez modifier ces
       données en utilisant les commandes suivantes&#xA0;:</para>
@@ -1335,7 +1335,7 @@ VBoxManage setextradata "nom VM" VBoxInternal/Devices/IntNetIP/0/LUN#0/Config/Is
   <sect1>
     <title>Commandes de base pour utiliser les ports série</title>
 
-    <para>À partir de la version 1.4, VirtualBox fournissait le support les
+    <para>À partir de la version 1.4, VirtualBox fournissait le support des
     ports série virtuels qui, pour l'instant, était plutôt compliqué à paramétrer
     avec la séquence des commandes
     <computeroutput>VBoxManage setextradata</computeroutput>. Depuis la version 1.5,
@@ -1384,7 +1384,7 @@ VBoxManage setextradata "nom VM"
   </sect1>
 
   <sect1 id="changenat">
-    <title>Peaufiner le moteur NAT de VirtualBox</title>
+    <title>Régler le moteur NAT de VirtualBox</title>
 
     <sect2>
       <title>Configurer l'adresse d'une interface réseau NAT</title>
@@ -1425,7 +1425,7 @@ VBoxManage modifyvm "nom VM" --nattftpfile1 /srv/tftp/boot/MyPXEBoot.pxe</screen
     </sect2>
 
     <sect2 id="nat-adv-settings">
-      <title>Peaufiner les tampons TCP/IP pour NAT</title>
+      <title>Réglage des tampons TCP/IP pour NAT</title>
 
       <para>La performance de la pile NAT de VirtualBox est souvent déterminée
       par son interaction avec la pile TCP/IP de l'hôte et la taille de plusieurs
@@ -1435,9 +1435,9 @@ VBoxManage modifyvm "nom VM" --nattftpfile1 /srv/tftp/boot/MyPXEBoot.pxe</screen
       meilleure performance. Vous pouvez faire cela en utilisant les commandes
       suivantes (les valeurs s'expriment en kilo-octets peuvent varier de
       8 à 1024)&#xA0;: <screen>VBoxManage modifyvm "nom VM" --natsettings1 16000,128,128,0,0</screen>
-      Cet exemple illustre le peaufinage des paramètres NAT. Le premier paramètre
-      est le MTU, puis la taille du tampon d'envoi de la socket et la taille du
-      tampon de réception de la socket, la taille initiale de la fenêtre d'envoi
+      Cet exemple illustre le réglage des paramètres NAT. Le premier paramètre
+      est le MTU, puis la taille du tampon d'envoi du socket et la taille du
+      tampon de réception du socket, la taille initiale de la fenêtre d'envoi
       TCP, et enfin, la taille initiale de la fenêtre de réception TCP. Remarquez
       que la spécification de zéro revient à se rabattre sur la valeur par défaut.</para>
 
@@ -1467,7 +1467,7 @@ VBoxManage modifyvm "nom VM" --nattftpfile1 /srv/tftp/boot/MyPXEBoot.pxe</screen
       <para>Le moteur NAT offre par défaut les mêmes serveurs DNS à l'invité
       que ceux configurés sur l'hôte. Dans certains scenari, il peut être souhaitable
       de cacher les IPs du serveur DNS à l'invité, par exemple quand ces informations
-      peuvent changer sur l'hôte après l'expiration des baux DHCP. Dans ce cas,
+      peuvent changer sur l'hôte après l'expiration de l'allocation DHCP. Dans ce cas,
       vous pouvez dire au moteur NAT d'agir comme un proxy DNS en utilisant la
       commande suivante&#xA0;: <screen>VBoxManage modifyvm "nom VM" --natdnsproxy1 on</screen></para>
     </sect2>
@@ -1499,20 +1499,20 @@ VBoxManage modifyvm "nom VM" --nattftpfile1 /srv/tftp/boot/MyPXEBoot.pxe</screen
               d'une IP spécifiée&#xA0;:</para>
             <screen>VBoxManage setextradata "nom VM" \
       "VBoxInternal/Devices/{pcnet,e1000}/0/LUN#0/Config/HostResolverMappings/ \
-      <nom uniq de la règle d'interception>/HostIP" <IPv4>
+      <nom unique de la règle d'interception>/HostIP" <IPv4>
 VBoxManage setextradata "nom VM" \
       "VBoxInternal/Devices/{pcnet,e1000}/0/LUN#0/Config/HostResolverMappings/ \
-      <nom uniq de la règle d'interception>/HostName" <nom de vhôte></screen>
+      <nom unique de la règle d'interception>/HostName" <nom de hôte></screen>
     <para>La commande suivante définit une règle pour associer un échantillon de
      nom à une IP spécifiée&#xA0;:</para>
             <screen>VBoxManage setextradata "nom VM" \
       "VBoxInternal/Devices/{pcnet,e1000}/0/LUN#0/Config/HostResolverMappings/ \
-      <nom uniq de la règle d'interception>/HostIP" <IPv4>
+      <nom unique de la règle d'interception>/HostIP" <IPv4>
 VBoxManage setextradata "nom VM" \
       "VBoxInternal/Devices/{pcnet,e1000}/0/LUN#0/Config/HostResolverMappings/ \
-      <uniq name of interception rule>/HostNamePattern" <échantillonhôte></screen>
+      <nom unique de la règle d'interception>/HostNamePattern" <échantillonhôte></screen>
     <para>L'échantillon hôte peut inclure <computeroutput>"|", "?" et "*"</computeroutput>.</para>
-    <para>Cette exmple démontre la façon de demander au mécanisme du résolveur
+    <para>Cette exmeple montre la façon de demander au mécanisme du résolveur
     de l'hôte de résoudre tout le domaine et probablement des mirroirs du site
     www.blocked-site.info avec l'IP 127.0.0.1:</para>
             <screen>VBoxManage setextradata "nom VM" \
@@ -1538,7 +1538,7 @@ VBoxManage setextradata "nom VM" \
       ou dépendre du vrai numéro de port pour envoyer un paquet. Il est possible
       de modifier le mode NAT avec l'interface VBoxManage avec les commandes
       suivantes&#xA0;: <screen>VBoxManage modifyvm "nom VM" --nataliasmode1 proxyonly</screen>
-      and <screen>VBoxManage modifyvm "Linux Guest" --nataliasmode1 sameports</screen>
+      et <screen>VBoxManage modifyvm "Linux Guest" --nataliasmode1 sameports</screen>
       Le premier exemple désactive les alias et passe NAT en mode transparent,
       le deuxième exemple renforce la préservation des numéros des ports. Ces
       modes peuvent se combiner si nécessaire.</para>
@@ -1550,7 +1550,9 @@ VBoxManage setextradata "nom VM" \
 
     <para>Vous pouvez changer les données DMI que VirtualBox fournit aux invités
     pour une VM spécifique. Utilisez les commandes suivantes pour configurer les
-    informations DMI du BIOS&#xA0;:</para>
+    informations DMI du BIOS. Si votre VM est configurée pour utiliser un firmware
+    EFI, vous devez remplacer <code>pcbios</code> par <code>efi</code> dans les
+    clés.</para>
 
     <sect2>
       <title>Informations DMI du BIOS (type 0)</title>
@@ -1644,11 +1646,11 @@ VBoxManage setextradata "nom VM"
     <screen>VBoxManage setextradata "nom VM"
       "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial"      "string:1234"</screen></para>
 
-    <para>La modification de ces information cans peut \avérer nécessaire pour
+    <para>La modification de ces informations peut s'avérer nécessaire pour
     donner les informations DMI de l'hôte à l'invité afin d'empêcher Windows de
     demander une nouvelle clé du produit. Sur les hôtes Linux, vous pouvez obtenir
     les informations de BIOS DMI avec
-    with <screen>dmidecode -t0</screen>et les informations du système DMI avec
+    <screen>dmidecode -t0</screen>et les informations du système DMI avec
     <screen>dmidecode -t1</screen></para>
   </sect1>
 
@@ -1668,15 +1670,15 @@ VBoxManage setextradata "nom VM"
   </sect1>
 
   <sect1>
-    <title>Peaufiner les horloges et la synchronisation du temps</title>
+    <title>Régler les horloges et la synchronisation du temps</title>
 
     <sect2 id="changetscmode">
       <title>Configurer le time stamp counter (TSC) (horodateur) de l'invité pour refléter l'heure de l'exécution</title>
 
       <para>Par défaut, VirtualBox synchronise toutes les sources de l'heure dans
-      une source d'heure unique, l'heure de l'hôte monotonic. Cela reflète les
+      une source d'heure unique, l'heure monotonic de l'hôte. Cela reflète les
       suppositions de nombreux systèmes d'exploitation invités qui s'attendent
-      à ce que toutes les sources d'heure reflètent l'heure "la pendule". Dans
+      à ce que toutes les sources d'heure reflètent l'heure de "la pendule". Dans
       des circonstances spéciales, il peut être cependant utile de faire en
       sorte que le TSC (time stamp counter) de l'invité reflète le temps effectif
       passé à exécuter l'invité.</para>
@@ -1729,7 +1731,7 @@ VBoxManage setextradata "nom VM"
     </sect2>
 
     <sect2 id="changetimesync">
-      <title>Peaufiner les paramètres de synchronisation du temps des suppléments
+      <title>Régler les paramètres de synchronisation du temps des suppléments
       invité</title>
 
       <para>Les suppléments invité de VirtualBox garantissent que l'heure du
@@ -1798,7 +1800,7 @@ VBoxManage setextradata "nom VM"
             <glossterm><computeroutput>--timesync-set-start</computeroutput></glossterm>
 
             <glossdef>
-              <para>Définit l'heure à laquelle démarrer le service de syncchro
+              <para>Définit l'heure à laquelle démarrer le service de synchro
               du temps.</para>
             </glossdef>
           </glossentry>
@@ -1903,7 +1905,7 @@ vboxvnic_template0 nge0   1000   2:8:20:25:12:75   random              23</scree
     VMs sur des VLANs car les détails du VLAN ne sont pas stockés dans la
     configuration de chaque VM mais récupérés dans le modèle VNIC qve vous pouvez
     modifier n'importe quand en utilisant 
-    <computeroutput>dladm</computeroutput>. Outre l'ID du VLAN, des traductions
+    <computeroutput>dladm</computeroutput>. Outre l'ID du VLAN, des patrons de
     VNIC peuvent être créées avec des propriétés supplémentaires telles que les
     limites de bande passante, le fanout du processeur, etc. Reportez-vous à
     la documentation du réseau de votre Solaris pour savoir comment faire cela.
@@ -1920,7 +1922,7 @@ vboxvnic_template0 nge0   1000   2:8:20:25:12:75   random              23</scree
     exige une configuration manuelle. Voici comment ajouter deux interfaces
     réseaux host-only supplémentaires.</para>
 
-    <para>Vous eevez d'abord arrêter toutes les VMs en fonction et désactiver
+    <para>Vous devez d'abord arrêter toutes les VMs en fonction et désactiver
     toutes les interfaces "vboxnet". Exécutez les commandes suivantes en tant
     qu'administrateur&#xA0;:</para>
 
@@ -1974,7 +1976,7 @@ de façon unique. Ensuite, rechargez le pilote vboxnet en utilisant&#xA0;:</para
     ne spécifiez aucun répertoire où mettre les fichiers c&#x153;ur, le répertoire
     actuel de l'exécutable de VirtualBox sera utilisé (ce qui échouerait
     vraisemblablement au moment de l'écriture des c&#x153;urs car ils sont
-    protégés par des droits administrateur). Il est recommandé que voks définissiez
+    protégés par des droits administrateur). Il est recommandé que vous définissiez
     explicitement un répertoire d'envoi des fichiers c&#x153;ur.</para>
 
     <para>Vous devez spécifier le moment où les CoreDumper de VirtualBox devraient
@@ -1986,14 +1988,14 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
 
     <para>Le réglage de <computeroutput>CoreDumpReplaceSystemDump</computeroutput>
     prévoit que la VM outrepasse le mécanisme c&#x153;ur de l'hôte et en cas
-    de de plantage, seul le  de VirtualBox produirait le fichier
+    de plantage, seul le vidage VirtualBox produirait le fichier
     c&#x153;ur.</para>
 
     <para>Le réglage de <computeroutput>CoreDumpLive</computeroutput> demande
     à la VM de produire des c&#x153;urs à chaque fois que le processus de la
     VM reçoit un signal <computeroutput>SIGUSR2</computeroutput>. Après avoir
-    produit le fichier c&#x153;ur, la VM ne sera pas interrompu et continuera
-    de fonctionner. Vous pouvez ainsi récupérer des c&#x153;urs du processus de
+    produit le fichier c&#x153;ur, la VM ne sera pas interrompu et continuerà
+    fonctionner. Vous pouvez ainsi récupérer des c&#x153;urs du processus de
     la VM en utilisant&#xA0;:</para>
 
     <para><screen>kill -s SIGUSR2 <VM-process-id></screen></para>
@@ -2007,7 +2009,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
     <title>Déverrouiller l'interface graphique du gestionnaire de VirtualBox</title>
 
     <sect2>
-      <title>Personnalisation du gestiOnnaire de VM</title>
+      <title>Personnalisation du gestionnaire de VM</title>
 
       <para>Il existe plusieurs paramètres de personnalisation avancés pour
       déverrouiller le gestionnaire de VirtualBox, c'est-à-dire pour supprimer
@@ -2098,8 +2100,8 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
   <sect2>
     <title>Configurer les entrées du menu de sélection de VM</title>
 
-    <para>Vous pouvez désactiver (c'est-à-dire black-lister) certaines entrées
-    de l'onglet des paramèt!es globaux dans le sélecteur de VM :</para>
+    <para>Vous pouvez désactiver (c'est-à-dire inhiber) certaines entrées
+    de l'onglet des paramètres globaux dans le sélecteur de VM :</para>
        <screen>VBoxManage setextradata global GUI/RestrictedGlobalSettingsPages OPTION[,OPTION...]</screen>
        <para>où <computeroutput>OPTION</computeroutput> est un des mots-clés
        suivants :</para><glosslist>
@@ -2163,8 +2165,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
      </glossentry>
    </glosslist>
    <para>C'est un paramètre global. Toutes les combinaisons de ce qui précède
-   est possible . Pour restaurer le comportement
-   par défaut, utilisez</para>
+   est possible. Pour restaurer le comportement par défaut, utilisez</para>
    <screen>VBoxManage setextradata global GUI/RestrictedGlobalSettingsPages</screen>
 
   </sect2>
@@ -2174,7 +2175,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
   <sect2>
     <title>Configurer les entrées du menu de la fenêtre d'une VM</title>
 
-    <para>Vous pouvez désactiver (c'est-à-dire black-lister) certaines actions
+    <para>Vous pouvez désactiver (c'est-à-dire inhiber) certaines actions
     du menu dans la fenêtre de la VM :</para>
     <screen>VBoxManage setextradata "nom VM" GUI/RestrictedRuntimeMenus OPTION[,OPTION...]</screen>
     
@@ -2238,7 +2239,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
   <sect2>
     <title>Configurer les entrées de la barre d'état de la fenêtre de la VM</title>
 
-    <para>Vous pouvez désactiver (c'est-à-dire black-lister) certains éléments
+    <para>Vous pouvez désactiver (c'est-à-dire inhiber) certains éléments
     de la barre d'état :</para>
       <screen>VBoxManage setextradata "nom VM" GUI/RestrictedStatusBarIndicators OPTION[,OPTION...]</screen>
 
@@ -2331,7 +2332,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
     <sect2>
       <title>Configurer les modes visuels de la fenêtre</title>
 
-      <para>Vous pouvez désactiver (c'est-à-dire blacklister) certains modes visuels de la VM :</para>
+      <para>Vous pouvez désactiver (c'est-à-dire inhiber) certains modes visuels de la VM :</para>
       <screen>VBoxManage setextradata "nom VM" GUI/RestrictedVisualStates OPTION[,OPTION...]</screen>
 
       <para>où <computeroutput>OPTION</computeroutput> est un des mots-clés
@@ -2374,7 +2375,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
         <para>Pour désactiver toutes les combinaisons de touches de l'hôte, 
         ouvrez les préférences et modifiez la touche hôte sur <emphasis>Aucune</emphasis>. 
         Cela pourrait être utile lors de l'utilisation de VirtualBox en mode
-        kiosk.</para>
+        kiosque.</para>
 
         <para>Pour redéfinir ou désactiver certaines actions de la touche hôte,
         utilisez la commande suivante&#xA0;:</para>
@@ -2472,7 +2473,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
               <row>
                 <entry><computeroutput>WindowAdjust</computeroutput></entry>
                 <entry>A</entry>
-                <entry>redimension automatique de la fenêtre invité</entry>
+                <entry>redimensionne immédiatement la fenêtre invité</entry>
               </row>
               <row>
                 <entry><computeroutput>PopupMenu</computeroutput></entry>
@@ -2516,9 +2517,9 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
 
       </sect2>
       <sect2>
-        <title>Action puand la VM s'arrête</title>
+        <title>Action quand la VM s'arrête</title>
 
-        <para>Vous pouvez interdire (c'est-à-dire blacklister) certaines ctions
+        <para>Vous pouvez interdire (c'est-à-dire inhiber) certaines actions
         quand la VM s'arrête. Pour interdire des actions spécifiques,
         tapez&#xA0;:</para>
 
@@ -2540,7 +2541,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
 
             <glossdef>
               <para>N'autorise pas l'utilisateur à éteindre la VM en envoyant
-              l'événement ACPI couper à l'invité.</para>
+              l'événement ACPI d'extinction à l'invité.</para>
             </glossdef>
           </glossentry>
 
@@ -2553,7 +2554,7 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
           </glossentry>
 
           <glossentry>
-            <glossterm><computeroutput>Restore</computeroutput></glossterm>
+            <glossterm><computeroutput>PowerOffRestoringSnapshot</computeroutput></glossterm>
 
             <glossdef>
               <para>N'autorise pas l'utilisateur à revenir au dernier instantané
@@ -2642,27 +2643,27 @@ passer au moins une des deux commandes ci-dessus si vous avez activé les CoreDu
             </row>
             <row>
               <entry><computeroutput>SSL_RANDFILE</computeroutput></entry>
-              <entry>Fichier contenant seed en générateur de nombre aléatoire</entry>
+              <entry>Fichier contenant l'amorce du générateur de nombre aléatoire</entry>
               <entry></entry>
             </row>
             <row>
               <entry><computeroutput>TIMEOUT</computeroutput></entry>
-              <entry>Timous de la session en secondes&#xA0;; 0 désactive le timeouts</entry>
+              <entry>Timout de la session en secondes&#xA0;; 0 désactive le timeout</entry>
               <entry>300</entry>
             </row>
             <row>
               <entry><computeroutput>CHECK_INTERVAL</computeroutput></entry>
-              <entry>Fréquence des vérifications des timeout en secondes</entry>
+              <entry>Fréquence des vérifications des timeouts en secondes</entry>
               <entry>5</entry>
             </row>
             <row>
               <entry><computeroutput>THREADS</computeroutput></entry>
-              <entry>Nombre maximum de session simultanées possibles</entry>
+              <entry>Nombre maximum de sessions simultanées possibles</entry>
               <entry>100</entry>
             </row>
             <row>
               <entry><computeroutput>KEEPALIVE</computeroutput></entry>
-              <entry>Nombre maximum de requêtes avant de fermer une socket</entry>
+              <entry>Nombre maximum de requêtes avant de fermer un socket</entry>
               <entry>100</entry>
             </row>
             <row>
@@ -2712,7 +2713,7 @@ svccfg -s svc:/application/virtualbox/webservice:default setprop config/user=roo
 
       <para>Si vous oubliez la commande ci-dessus, les paramètres ci-dessus
       seront utilisés au moment de l'activation du service. Vérifiez les
-      réglages actuelles des propriétés avec&#xA0;:<screen>svcprop -p config svc:/application/virtualbox/webservice:default</screen></para>
+      réglages actuels des propriétés avec&#xA0;:<screen>svcprop -p config svc:/application/virtualbox/webservice:default</screen></para>
 
       <para>Lorsque tout est bien configuré, vous pouvez démarrer le service
       web de VirtualBox avec la commande suivante&#xA0;:<screen>svcadm enable svc:/application/virtualbox/webservice:default</screen></para>
@@ -2739,7 +2740,7 @@ svccfg -s svc:/application/virtualbox/webservice:default setprop config/user=roo
   </sect1>
 
   <sect1 id="vboxwatchdog">
-    <title>VirtualBox Watchdog</title>
+    <title>Surveillance VirtualBox (Watchdog)</title>
     <para>À partir de VirtualBox 4.2, le service de ballon de mémoire, connu
     jadis comme le <computeroutput>VBoxBalloonCtrl</computeroutput>, a été
     renommé en VBoxWatchdog, ce qui intègre à présent plusieurs services de
@@ -2748,17 +2749,17 @@ svccfg -s svc:/application/virtualbox/webservice:default setprop config/user=roo
     <para>Il s'agit des services&#xA0;: <itemizedlist>
         <listitem>
             <para>Contrôle du ballon de mémoire, qui prend en charge automatiquement
-            d'un ballon de mémoire configuré pour une VM (voir <xref linkend="guestadd-balloon" />
-            pour une présentation du jeu de ballon avec la méom:re). Cela
+            un ballon de mémoire configuré pour une VM (voir <xref linkend="guestadd-balloon" />
+            pour une présentation du jeu de ballon avec la méomire). Cela
             est surtout utile pour les environnements serveurs où les VMs peuvent
             solliciter de manière dynamique plus ou moins de mémoire pendant
             leur fonctionnement.</para>
 
-            <para>Le service vérifie régulièrement que le ballon actuel d'une
+            <para>Le service vérifie régulièrement le ballon d'une
             VM et sa RAM invitée disponible et il ajuste automatiquement
-            le ballon de mémoire actuel en l'augmentant ou le réduisant selon
+            le ballon de mémoire en l'augmentant ou le réduisant selon
             le cas. Cette gestion ne s'applique qu'aux VMs en fonction ayant
-            installé des suppléments invité éecents.</para>
+            installé des suppléments invité récents.</para>
         </listitem>
         <listitem>
             <para>La détection d'un isolement de l'hôte, qui offre un moyen de
@@ -2773,7 +2774,7 @@ svccfg -s svc:/application/virtualbox/webservice:default setprop config/user=roo
     Vous pouvez spécifier toutes les valeurs de configuration soit en ligne
     de commande, soit par des données supplémentaires globales, tandis que 
     les valeurs en ligne de commandes ont toujours une priorité élevée si on
-    las définit. Certaines des valeurs de configuration peuvent être également
+    les définit. Certaines des valeurs de configuration peuvent être également
     spécifiées sur une base individuelle par VM. Donc, l'ordre pour regarder
     les paramètres est&#xA0;: ligne de comande, données supplémentaires pour
     chaque VM (s'il y en a), données supplémentaires globales. 
@@ -3075,14 +3076,14 @@ svccfg -s svc:/application/virtualbox/balloonctrl:default setprop config/balloon
 # choix étant "allow".
 default_policy = deny
 
-# Bob est autorisé à démarrer des machines virtuelles, mais chacun à intervalle
+# Bob est autorisé à démarrer des machines virtuelles, mais chacune à intervalle
 # de 10 secondes
 bob = {
     allow = true
     startup_delay = 10
 }
 
-# Alice n'est pas autorisé à démarrer des machines virtuelles, utile pour
+# Alice n'est pas autorisée à démarrer des machines virtuelles, utile pour
 # exclure certains utilisateurs si la politique par défaut est allow.
 alice = {
     allow = false
@@ -3144,7 +3145,7 @@ alice = {
     ou nouvellement connectés.</para>
 
     <para>Vous pouvez activer le mode de gestion experte du stockage pour chaque
-    VM en exécuting :</para>
+    VM en exécution :</para>
 
     <screen>VBoxManage setextradata "nom VM" "VBoxInternal2/SilentReconfigureWhilePaused" 1</screen>
 
@@ -3165,7 +3166,7 @@ alice = {
           <glossterm>Mise en veille prolongée de l'hôte</glossterm>
            <glossdef>
              <para>
-               Cet événement est généré quand l'hîte va se mettre en veille prolongée,
+               Cet événement est généré quand l'hôte va se mettre en veille prolongée,
                c'est-à-dire quand l'hôte sauvegarde son état sur un support
                de stockage non volatile puis s'éteint.
              </para>
@@ -3221,40 +3222,49 @@ VBoxManage setextradata "foo" "VBoxInternal2/SavestateOnBatteryLow" 0</screen>
        </glosslist>
      </para>
 
-   </sect1>
+      <sect2>
+        <title>Eléments pour gérer une Guru Meditation</title>
 
-   <sect1 id="sse412passthrough">
-     <title>Support expérimental du passage par des instructions SSE4.1 / SSE4.2</title>
-     <para>
-       Pour offrir le support des SSE 4.1 / SSE 4.2 aux invités, le processeur
-       de vhôte doit gérer ces jeux d'instructions. A partir de VirtualBox 4.3.8,
-       il est possible d'activer ces instructions pour les invités en utilisant
-       les commandes suivantes :</para><screen>VBoxManage setextradata "VM name" VBoxInternal/CPUM/SSE4.1 1
-VBoxManage setextradata "nom VM" VBoxInternal/CPUM/SSE4.2 1</screen>
-     <para>
-       Ces paramètres se règlent par VM et sont désactivés par défaut.
-     </para>
-   </sect1>
+        <para>Une VM tombe en Guru Meditation si elle rencontre un problème non
+          corrigible par d'autres moyens que celui de terminer le processus. Par
+          défaut, on affiche une fenêtre de message demandant à l'utilisateur
+          d'ouvrir un rapport de bogue.</para>
+        <para>Vous pouvez configurer ce comportement :</para>
 
-  <sect1 id="hidledssync">
-    <title>Support de la synchronization des indicateurs du clavier</title>
+        <para><screen>VBoxManage setextradata "nom VM" GUI/GuruMeditationHandler MODE</screen></para>
 
-    <para>
-      Cette fonction permet aux diodes du clavier de correspondre à celles du
-      clavier de la machine virtuelle quand la fenêtre de la machine est active.
-      Elle est supportée pour l'instant sur les hôtes Mac OS X et Windows et
-      elle est disponible à partir des versions 4.2.24 et 4.3.8. Vous pouvez
-      activer cette fonction en utilisant la commande suivante :
-    </para>
+        <para>où <computeroutput>MODE</computeroutput> est un des mots-clés
+          qui suit :</para><glosslist>
+          <glossentry>
+            <glossterm><computeroutput>Default</computeroutput></glossterm>
+            <glossdef>
+              <para>Une fenêtre de message s'affiche. Après la confirmeation de
+                l'utilisateur, la VM se termine.</para>
+            </glossdef>
+          </glossentry>
 
-    <screen>VBoxManage setextradata "nom VM" GUI/HidLedsSync "1"</screen>
+          <glossentry>
+            <glossterm><computeroutput>PowerOff</computeroutput></glossterm>
+            <glossdef>
+              <para>La VM se coupe immédiatement sans afficher de fenêtre message.
+                Le fichier journal de la VM affichera des informations sur ce
+                qu'il s'est passé.</para>
+            </glossdef>
+          </glossentry>
 
-    <para>
-      Pour la désactiver, utilisez  la même commande mais passez "1" à "0", ou
-      utilisez la commande VBoxManage pour supprimer les données supplémentaires.
-      C'est un paramètre par VM et désactivé par défaut.
-    </para>
+          <glossentry>
+            <glossterm><computeroutput>Ignore</computeroutput></glossterm>
+            <glossdef>
+              <para>On quitte la VM en mode dépannage. L'exécution s'arrête mais
+              aucune fenêtre de message ne s'affiche. Vous devez couper la VM
+              manuellement.</para>
+            </glossdef>
+          </glossentry>
+        </glosslist>
 
-  </sect1>
+        <para>C'est un paramètre individuel à chaque VM.</para>
+     </sect2>
+
+   </sect1>
 
 </chapter>
diff --git a/doc/manual/fr_FR/user_BasicConcepts.xml b/doc/manual/fr_FR/user_BasicConcepts.xml
index 1ebc80f..f38c77a 100644
--- a/doc/manual/fr_FR/user_BasicConcepts.xml
+++ b/doc/manual/fr_FR/user_BasicConcepts.xml
@@ -7,14 +7,14 @@
   <para>Alors que le <xref linkend="Introduction" /> vous donnait une introduction
   rapide à VirtualBox et sur la façon de faire marcher votre première machine
   virtuelle, le chapitre qui suit décrit en détail la manière de configurer des
-  achines virtuelles.</para>
+  machines virtuelles.</para>
 
   <para>Vous disposez d'une latitude considérable dans la décision sur le matériel
   qui sera donné à l'invité. Le matériel virtuel peut être utilisé pour 
   communiquer avec le système hôte ou avec d'autres invités. Par exemple, si vous
   fournissez à VirtualBox l'image d'un CD-ROM dans un fichier ISO, VirtualBox 
   peut présenter cette image à un système invité comme s'il s'agissait d'un
-  CD-ROM physique. De la même façon, vous pouvez donner à un szstème invité
+  CD-ROM physique. De la même façon, vous pouvez donner à un système invité
   un accès au réseau par sa carte réseau virtuelle, si tel est votre choix,
   donner au système hôte, à d'autres invités ou à des ordinateurs un accès
   Internet au système hôte.</para>
@@ -35,7 +35,7 @@
             <para>Toutes les versions, les éditions et les packs service sont 
             complètement supportés&#xA0;; cependant, il y a des problèmes avec
             les anciens packs service. Nous recommandons d'installer le pack
-            service 6a. Les suppléments jnvité sont disponibles avec des fonctionnalités
+            service 6a. Les suppléments invité sont disponibles avec des fonctionnalités
             limitées.</para>
           </glossdef>
         </glossentry>
@@ -150,7 +150,7 @@
       </glosslist></para>
 
     <sect2 id="intro-macosxguests">
-      <title>Inviqés Mac OS X</title>
+      <title>Invités Mac OS X</title>
 
       <para>À partir de la version 3.2, VirtualBox a un support expérimental des
       invités Mac OS X. Il vous permet d'installer et d'exécuter des 
@@ -174,7 +174,7 @@
             interdit de les installer sur du matériel non Apple.</para>
 
             <para>Ces restrictions juridiques sont également renforcées au niveau
-            technique. Mac OS X vérifie s'il s'exécute sur du matériel Apple et
+            technique. Mac OS X vérifie si il s'exécute sur du matériel Apple et
             la plupart des DVDs fournis avec le matériel Apple vérifient même
             le modèle exact. Ces restrictions <emphasis>ne sont pas</emphasis>
             contournées par VirtualBox et s'appliquent toujours.</para>
@@ -263,7 +263,7 @@
     <title>Matériel émulé</title>
 
     <para>VirtualBox virtualise presque tout le matériel de l'hôte. Selon la
-    a configuration de la VM, l'invité utilisera le matériel virtuel suivant&#xA0;:<itemizedlist>
+    configuration de la VM, l'invité utilisera le matériel virtuel suivant&#xA0;:<itemizedlist>
         <listitem>
           <para><emphasis role="bold">Périphériques d'entrée.</emphasis> Par
           défaut, VirtualBox émule un clavier et une souris PS/2 standards. Ces
@@ -326,13 +326,13 @@
 
     <para>Dans la fenêtre des paramètres, dans "Général", vous pouvez configurer
     la plupart des aspects fondamentaux de la machine virtuelle, tels que la
-    mémoire ou du matériel essentiel. Il y a trois onglets, "Base", "Avancé" et
+    mémoire ou du matériel essentiel. Il y a trois onglets, "Simple", "Avancé" et
     "Description".</para>
 
     <sect2>
-      <title>Onglet "Base"</title>
+      <title>Onglet "Simple"</title>
 
-      <para>Sous l'onglet "Base" de la catégorie Général
+      <para>Sous l'onglet "Simple" de la catégorie Général
       des paramètres, vous pouvez voir ces paramètres&#xA0;:</para>
 
       <glosslist>
@@ -412,19 +412,29 @@
        <glossentry>
             <glossterm>Drag'n'Drop</glossterm>
             <glossdef>
-              <para>Ce paramètre permet d'activer le glisser/déplacer : sélectionnez
-              un fichier sur le bureau, cliquez sur le bouton gauche, amenez la
-              souris dans la fenêtre de la VM et cliquez de nouveau pur le bouton
-              de la souris. Le fichier est copié de l'hôte à l'invité. C'est
-              fonction n'est actuellement implémentée que pour la copie de fichiers
-              de l'hôte vers l'invité.<footnote><para>Le support du glisser/déplacer
-              a été ajouté avec VirtualBox 4.2</para></footnote></para>
+              <para>Ce paramètre permet d'activer le support du glisser/déplacer : sélectionnez
+              un objet (comme un fichier) sur le bureau de l'hôte ou de l'invité
+              et copiez-le ou ouvrez-le directement sur l'invité ou l'hôte. Plusieurs
+              modes de glisser/déplacer individuels à chaque VM vous permettent
+              de restreindre les accès dans tous les sens.</para>
+
+              <para>Pour que le glisser/déplacer fonctionne, les suppléments
+              invité doivent être installés sur l'invité.</para>
+
+              <note>Le glisser/déplacer est désactivé par défaut. Vous pouvez
+              changer ce réglage n'importe quand en utilisant l'icône Glisser/déplacer
+              du menu "Périphériques" de la machine virtuelle.</note>
+
+              <para>Voir <xref linkend="guestadd-dnd"/> pour plus d'informations.</para>
+
+              <footnote><para>Le support expérimental du glisser/déplacer a été.
+              introduit avec VirtualBox 4.2.</para></footnote>
             </glossdef>
           </glossentry>
 
           <glossentry>
-            <glossterm>Média amovible&#xA0;: se rappeler des changements au moment
-            de l'exécution</glossterm>
+            <glossterm>Média amovible&#xA0;: enregistrer les changements pendant
+            l'exécution</glossterm>
 
             <glossdef>
               <para>Si ceci est coché, VirtualBox enregistrera l'état des médias
@@ -457,7 +467,7 @@
 
       <para>Ici, vous pouvez taper une description pour votre machine virtuelle si
       vous le voulez. Cela n'a aucun effet sur le fonctionnement de la machine,
-      mais pourriez trouver cet espace utile pour y noter des choses comme
+      mais vous pourriez trouver cet espace utile pour y noter des choses comme
       la configuration d'une machine virtuelle et le logiciel 
       installé dedans.</para>
       <para>Pour insérer un saut de ligne dans la zone de texte de la
@@ -487,13 +497,13 @@
             <glossdef>
               <para>Ceci définit la quantité de RAM affectée et donnée à la VM
               quand elle est en fonction. La quantité de mémoire spécifiée 
-              sera récupérée sur le szstème d'exploitation hôte, donc il faut
+              sera récupérée sur le système d'exploitation hôte, donc il faut
               qu'elle soit disponible ou rendue disponible comme mémoire libre
               sur l'hôte au moment du démarrage de la VM et elle ne sera pas
               disponible pour l'hôte tant que la VM sera en fonction.  C'est le
               même paramètre que celui spécifié dans l'assistant "Nouvelle machine
               virtuelle", comme décrit dans les grandes lignes du
-              <xref linkend="gui-createvm" /> above.</para>
+              <xref linkend="gui-createvm" />.</para>
 
               <para>En général, il est possible de modifier la taille de la mémoire
               après avoir installé le système d'exploitation invité (pourvu que
@@ -533,7 +543,7 @@
               chipset ICH9, plus moderne, qui supporte le PCI express, trois bus
               PCI, des ponts PCI-à-PCI et des Message Signaled Interrupts
               (MSI). Cela permet aux systèmes d'exploitation modernes de gérer 
-              davantage périphériques PCI sans besoin d'un partage d'IRQ. 
+              davantage de périphériques PCI sans besoin d'un partage d'IRQ. 
               Remarquez que le support ICH9 est expérimental et non recommandé
               pour les systèmes d'exploitation invités qui n'en ont pas besoin.</para>
             </glossdef>
@@ -576,7 +586,7 @@
               d'interruptions programmables avancés) sont des fonctionnalités
               du matériel x86 récent ayant remplacé ces dernières années le
               Programmable Interrupt Controllers (PICs). Avec un
-              I/O APIC, les szstèmes d'exploitation peuvent utiliser plus de
+              I/O APIC, les systèmes d'exploitation peuvent utiliser plus de
               16 requêtes d'interruption (IRQs), évitant donc le partage d'IRQ
               pour une meilleure fiabilité.<note>
                   <para>L'activation de I/O APIC est <emphasis>requis</emphasis>
@@ -615,10 +625,10 @@
 
             <glossdef>
               <para>Si ceci est coché, VirtualBox indiquera à l'invité l'heure 
-              du système au format UTC plutît qu'en temps local (hôte). Cela
+              du système au format UTC plutôt qu'en temps local (hôte). Cela
               change la façon dont agit l'horloge en temps réel virtuelle (RTC)
               et peut être utile pour des systèmes d'exploitation invité de type
-              Unix qui attendent généralement une horloge matçrielle en UTC.</para>
+              Unix qui attendent généralement une horloge matérielle en UTC.</para>
             </glossdef>
           </glossentry>
 
@@ -656,7 +666,7 @@
       (coeurs réels, pas d'hyperthreads).</para>
 
       <para>Dans cet onglet, vous pouvez aussi définir le <emphasis role="bold">"CPU execution cap"</emphasis>.
-      Ce paramètre limite la quantité de temps qu'en processeur hôte peut donner
+      Ce paramètre limite la quantité de temps qu'un processeur hôte peut donner
       pour émuler un processeur virtuel. Le réglage par défaut est de 100%
       ce qui veut dire qu'il n'y a aucune limite. Un réglage à 50% implique
       qu'un seul processeur peut utiliser jusqu'à 50% d'un seul processeur hôte.
@@ -682,7 +692,7 @@
       <title>Onglet "Accélération"</title>
       
       <para>Dans cet onglet, vous pouvez déterminer si VirtualBox devrait utiliser
-      les extensions de virtualisation matérielle eque peut supporter votre hôte
+      les extensions de virtualisation matérielle que peut supporter votre hôte
       et comment. C'est le cas avec la plupart des processeurs fabriqués après 2006.</para>
 
       <para>Vous pouvez sélectionner individuellement pour chaque machine virtuelle 
@@ -703,7 +713,7 @@
       modifier ces réglages par défaut préconfigurés.</para>
 
       <para>Il se peut que les utilisateurs avancés s'intéressent aux détails
-      techniques sur la virtualisation logicielle vs matérielle&#xA0;; merci
+      techniques sur la virtualisation logicielle Vs matérielle&#xA0;; merci
       de voir <xref
       linkend="hwvirt" />.</para>
 
@@ -711,7 +721,7 @@
       nested</emphasis> (AMD-V) ou <emphasis role="bold">EPT</emphasis> (Intel
       VT-x), vous pouvez compter sur une augmentation significative des 
       performances en activant la pagination nested en plus de la virtualisation
-      matérielle. Pour des détails techniques, voir <xref linkend="nestedpaging" />.</para>
+      matérielle. Pour des détails techniques, voir <xref linkend="imbriquéepaging" />.</para>
     </sect2>
   </sect1>
 
@@ -730,7 +740,7 @@
           certaines résolutions et profondeur des couleurs peuvent être disponibles.</para>
 
           <para>L'interface graphique affichera un avertissement si la quantité
-          de memory mémoire graphique est trop petite pour pouvoir passer la VM
+          de mémoire graphique est trop petite pour pouvoir passer la VM
           en mode plein écran. La valeur minimum dépend du nombre d'écrans virtuels,
           de la résolution de l'écran et de la profondeur des couleurs sur l'affichage
           hôte, ainsi que de l'activation de <emphasis>l'accélération 3D</emphasis>
@@ -777,7 +787,7 @@
 
         <glossdef>
           <para>Si vous avez installé les Suppléments invité sur une machine
-          virtuelle, vous pouvez sélectionner ici si l'invité devrait supporter
+          virtuelle, vous pouvez ici sélectionner si l'invité devrait supporter
           la vidéo accélérée 3D. Merci de vous reporter à <xref linkend="guestadd-3d" /> 
           pour des détails.</para>
         </glossdef>
@@ -788,7 +798,7 @@
 
         <glossdef>
           <para>Si vous avez installé les Suppléments invité sur une machine
-          virtuelle contenant Windows, vous pouvez sélectionner ici si l'invité
+          virtuelle contenant Windows, vous pouvez ici sélectionner si l'invité
           doit supporter la vidéo accélérée 2D. Merci de vous reporter à <xref
           linkend="guestadd-2d" /> pour les détails.</para>
         </glossdef>
@@ -803,7 +813,7 @@
           VRDP construit dans VirtualBox. Cela vous permet de vous connecter à
           la console de la machine virtuelle à distance avec n'importe quel
           client RDP standard tel que <computeroutput>mstsc.exe</computeroutput> 
-          fourni avec Microsoft Windows. Sur les szstèmes Linux et Solaris,
+          fourni avec Microsoft Windows. Sur les systèmes Linux et Solaris,
           vous pouvez utiliser le programme standard open-source
           <computeroutput>rdesktop</computeroutput>. Ces fonctionnalités sont
           décrites en détail au 
@@ -876,8 +886,8 @@
       </itemizedlist></para>
 
     <para>Si vous avez créé votre VM avec une version antérieure de VirtualBox,
-    la présentation des stockages par défaut peut vrier Il q p¨ut >onc 
-   que vous ayez un contrôleur IDE auquel on a connecté le lecteur CD/DVD et
+    la présentation des stockages par défaut peut varier. Il se peut donc 
+   que vous ayez qu'un contrôleur IDE auquel on a connecté le lecteur CD/DVD et
    les disques durs. Cela pourrait aussi être le cas si vous avez sélectionné un
    ancien type de système d'exploitation quand vous avez créé la VM. Comme les
    anciens systèmes d'exploitation ne supportent pas 
@@ -965,7 +975,7 @@
                             <para>Si vous voulez écrire (graver) des CDs ou des
                             DVDs en utilisant le lecteur hôte, vous devez également
                             activer l'option
-                            <emphasis role="bold">"Passthrough"</emphasis>&#xA0;;
+                            <emphasis role="bold">"Mode direct (Passthrough)"</emphasis>&#xA0;;
                             voir <xref linkend="storage-cds" />.</para>
                           </listitem>
 
@@ -989,7 +999,7 @@
         </listitem>
       </itemizedlist></para>
 
-    <para>On peut changer de média amovible (de CD/DVDs et de disquettes) lendant
+    <para>On peut changer de média amovible (de CD/DVDs et de disquettes) pendant
     que l'invité fonctionne. Comme la boîte de dialogue "Paramètres" n'est pas
     disponibles à ce moment-là, vous pouvez aussi accéder à ces paramètres à
     partir du menu "Périphériques" de la fenêtre de votre machine virtuelle.</para>
@@ -1000,18 +1010,18 @@
 
     <para>La section "Son" de la fenêtre de paramètres d'une machine virtuelle 
     détermine si la VM verra une carte son connectée et si la sortie son se fait
-    en dur sur le szstème hôte.</para>
+    en dur sur le système hôte.</para>
 
     <para>Si le son est activé pour un invité, vous pouvez choisir entre
     l'émulation d'un contrôleur Intel AC'97, un contrôleur Intel HD Audio<footnote>
         <para>Le support d'Intel HD Audio a été ajouté avec VirtualBox 4.0 car
         Windows 7 (versions 32 bits et 64 bits) ainsi que Windows Vista 64 bits
         ne supportent pas le contrôleur Intel AC'97.</para>
-      </footnote> ou un e carte SoundBlaster 16. Dans tous les cas, vous pouvez
+      </footnote> ou une carte SoundBlaster 16. Dans tous les cas, vous pouvez
       sélectionner le pilote son que VirtualBox utilisera sur l'hôte.</para>
 
     <para>Sur un hôte Linux, selon votre configuration hôte, vous pouvez aussi
-    choisir entre les sous-systèmes OSS, ALSA ou the PulseAudio sur les
+    choisir entre les sous-systèmes OSS, ALSA ou PulseAudio sur les
     distributions Linux récentes (Fedora 8 et supérieur, Ubuntu 8.04 et supérieur),
     le sous-système PulseAudio devrait être privilégié.</para>
   </sect1>
@@ -1021,7 +1031,7 @@
 
     <para>La section "Réseau" de la fenêtre des paramètres d'une machine virtuelle
     vous permet de configurer la façon dont VirtualBox présente des cartes réseaux
-    virtuelles à votre VM et dont elles agissent.</para>
+    virtuelles à votre VM et comment elles agissent.</para>
 
     <para>Quand vous créez une machine virtuelle la première fois, VirtualBox
     active par défaut une carte réseau virtuelle et sélectionne le mode "Network
@@ -1131,7 +1141,7 @@
                 comme <computeroutput>COM1</computeroutput>&#xA0;; sur des hôtes
                 Linux ou Solaris, ce sera un n&#x153;ud de périphérique comme
                 <computeroutput>/dev/ttyS0</computeroutput>). VirtualBox redirigera
-                alors simplement toutes les données reçues et envoées sur le
+                alors simplement toutes les données reçues et envoyées sur le
                 port série virtuel vers le périphérique physique.</para>
               </listitem>
 
@@ -1152,7 +1162,7 @@
                       disponible en téléchargement sur
                                   <literal> <ulink
                       url="http://www.l4ka.org/91.php">http://www.l4ka.org/91.php</ulink>
-                      </literal>. This Cet outil fournit un mode serveur fixé 
+                      </literal>. Cet outil fournit un mode serveur fixé 
                       nommé tunnel sur 
                       <computeroutput>\\.\pipe\vmwaredebug</computeroutput>
                       et il connecte les connexions TCP entrantes sur le port 567 
@@ -1160,14 +1170,14 @@
                     </listitem>
 
                     <listitem>
-                      <para>Sur un hôte Mac, Linux ou Solaris, une socket locale
-                      est plutôt utilisée. Le nom de fichier de la socket doit
+                      <para>Sur un hôte Mac, Linux ou Solaris, un socket local
+                      est plutôt utilisé. Le nom de fichier du socket doit
                       être choisi de telle sorte que l'utilisateur de VirtualBox
                       ait assez de droits pour créer et écrire dessus. Le répertoire
                       <computeroutput>/tmp</computeroutput> est souvent un bon
                       candidat.</para>
                       <para>Sur Linux, plusieurs outils peuvent se connecter à
-                      une socket de domaine local ou en créer une en mode serveur.
+                      un socket de domaine local ou en créer un en mode serveur.
                       L'outil le plus flexible est
                       <computeroutput>socat</computeroutput> et il est disponible
                       dans beaucoup de distributions.</para>
@@ -1175,9 +1185,9 @@
                   </itemizedlist></para>
 
                 <para>Dans ce cas, vous pouvez configurer si VirtualBox devrait
-                créer le tunnel nommé (ou, sur les hôtes non Windows, la socket
+                créer le tunnel nommé (ou, sur les hôtes non Windows, le socket
                 de domaine local) lui-même ou si VirtualBox devrait supposer que
-                le tunnel (ou la socket) existse déjà. Avec les options en ligne
+                le tunnel (ou le socket) existe déjà. Avec les options en ligne
                 de commande de
                 <computeroutput>VBoxManage</computeroutput>, ceci est désigné
                 respectivement comme le mode "serveur" ou "client".</para>
@@ -1218,7 +1228,7 @@
 
       <para>VirtualBox peut permettre à des machines virtuelles d'accéder aux
       périphériques USB directement sur votre hôte. Pour cela, VirtualBox présente
-      au szstème d'exploitation invité un contrôleur USB virtuel. Dès que le
+      au système d'exploitation invité un contrôleur USB virtuel. Dès que le
       système invité démarre en utilisant un périphérique USB, il apparaîtra
       comme indisponible sur l'hôte.<note>
           <orderedlist>
@@ -1287,7 +1297,7 @@
           pouvez utiliser la commande suivante (voir <xref linkend="vboxmanage" />): <screen>VBoxManage list usbhost</screen></para>
 
           <para>Sur Windows, vous pouvez aussi voir tous les périphériques USB
-          connectés à votre szstème dans le gestionnaire de périphériques. Sur
+          connectés à votre système dans le gestionnaire de périphériques. Sur
           Linux, vous pouvez utiliser la commande
           <computeroutput>lsusb</computeroutput>.</para>
         </listitem>
@@ -1312,7 +1322,7 @@
       USB pour l'utiliser après avoir créé un filtre pour lui.</para>
 
       <para>Par exemple, vous pourriez créer un nouveau filtre USB et spécifier
-      un ID fabricant de 046d (Logitech, Inc), a Un index de fabricant à 1, et
+      un ID fabricant de 046d (Logitech, Inc), un index de fabricant à 1, et
       "non distant". Tous les périphériques USB de l'hôte fabriqués par Logitech,
       Inc ayant un numéro d'index 1 seront visibles pour le système invité.</para>
 
@@ -1362,7 +1372,7 @@
   <sect1>
     <title>Dossiers partagés</title>
 
-    <para>Les dossiers partagés vous permettent d'échaqger facilement des données
+    <para>Les dossiers partagés vous permettent d'échanger facilement des données
     entre une machine virtuelle et votre hôte. Cette fonctionnalité exige que 
     les suppléments invité de VirtualBox soient installés dans une machine
     virtuelle et ceci est décrit en détail au 
@@ -1407,14 +1417,26 @@
 
       <para>Pour contrôler GOP, utilisez la commande
       <computeroutput>VBoxManage</computeroutput> suivante&#xA0;: <screen>VBoxManage setextradata "nom VM" VBoxInternal2/EfiGopMode N</screen>
-      Où N peut être 0,1,2,3,4, respectivement pour des résolutions d'écran
-      640x480, 800x600, 1024x768, 1280x1024, 1440x900.</para>
+      Où N peut être 0,1,2,3,4,5, respectivement pour des résolutions d'écran
+      640x480, 800x600, 1024x768, 1280x1024, 1440x900, 1920x1200.</para>
 
       <para>Pour modifier la résolution UGA,&#xA0;: <screen>VBoxManage setextradata "nom VM" VBoxInternal2/UgaHorizontalResolution 1440
 VBoxManage setextradata "nom VM" VBoxInternal2/UgaVerticalResolution    900</screen></para>
 
       <para>Le mode graphique pour GOP et UGA ne peut être modifié que quand la
-      VM est éteinte il reste permandot jusqu'à ce qu'il soit modifié.</para>
+      VM est éteinte; il persiste jusqu'à ce qu'il soit modifié.</para>
+    </sect2>
+    <sect2 id="efibootargs">
+      <title>Spécifier des arguments au démarrage</title>
+
+      <para>Il n'est actuellement pas possible de manipuler les variables EFI
+      depuis un invité en fonction (par exemple définir la variable "boot-args"
+      en lançant l'outil <computeroutput>nvram</computeroutput> dans un invité
+      Mac OS X ne fonctionnera pas). Comme alternative, la donnée externe
+      "VBoxInternal2/EfiBootArgs" peut être passée à la VM pour définir la
+      variable "boot-args". Pour modifier la  variable EFI "boot-args" :
+      <screen>VBoxManage setextradata "nom VM" VBoxInternal2/EfiBootArgs <valeur></screen>
+      </para>
     </sect2>
   </sect1>
 </chapter>
diff --git a/doc/manual/fr_FR/user_ChangeLog.xml b/doc/manual/fr_FR/user_ChangeLog.xml
index fecc279..53a39f9 100644
--- a/doc/manual/fr_FR/user_ChangeLog.xml
+++ b/doc/manual/fr_FR/user_ChangeLog.xml
@@ -15,202 +15,652 @@
   hoc représente une construction de développement ou de test. En outre, chaque
   construction contient un numéro de révision.</para>
 
+
   <sect1>
-    <title>Version 4.3.4 (2013-xx-xx)</title>
- 
+    <title>Version 4.4.0 (yyyy-mm-dd)</title>
+
+    <para>C'est une mise à jour majeure. Les nouvelles fonctions importantes
+    suivantes ont été ajoutées :</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>GUI : support du branchement à chaud des disques SATA</para>
+      </listitem>
+
+    </itemizedlist>
+
+    <para>En outre, les éléments suivants ont été corrigés et/ou ajoutés :</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>VBoxManage : lors de l'export d'un applicatif, support de la
+        suppression des adresses MAC, ce qui signifie qu'elles seront toujours
+        recréées au moment de l'importation, évitant des doublons d'adresses MAC
+        entre les VMs importées plusieurs fois.</para>
+      </listitem>
+      <listitem>
+        <para>API : blocage de la suppression de l'instantané actuel s'il a des
+           instantanés fils (pertinent seulement pour les VMs où aucun instantané
+            durs n'est pas possible car leur présence empêchait toujours la
+            suppression), ce qui provoquait une corruption de la config de la VM</para>
+      </listitem>
+
+      <listitem>
+        <para>API : marquage des configs de VM ayant des instantanés mais aucun
+        d'accessible actuellement comme inaccessibles, car cette combinaison
+        n'a pas de sens</para>
+      </listitem>
+
+      <listitem>
+        <para>API : correction des informations de certains événements générées
+        automatiquement (seulement avec XPCOM, l'hôte Windows n'était pas concerné),
+        ce qui provoquait des erreurs de récupération d'attributs par le service
+           Web (bogue #12379)</para>
+      </listitem>
+      <listitem>
+        <para>API : correction de plantages des clients de l'API Java qui
+        utilisent les bindings XPCOM et qui survenaient surtout dans la sortie
+        des paramètres (bogue #11232)</para>
+      </listitem>
+
+    </itemizedlist>
+
+  </sect1>
+
+   <sect1>
+    <title>Version 4.3.8 (25-02-2014)</title>
+
     <para>C'est une version de maintenance. Les éléments suivants ont été
-      corrigés et/ou ajoutés :</para>
- 
-     <itemizedlist>
- 
-       <listitem>
-        <para>VMM : correction d'un bogue dans l'émulation de Local APIC qui 
-          provoquait un BSOD lors du démarrage de certains invités (régression
-          4.3.0 ; bogue #12240)</para>
+    corrigés et/ou ajoutés :</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>VMM : davantage de travail sur l'amélioration de l'émulation de
+        certains registres MSR (par exemple, bogues #12224, #12544)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM : correction d'une Guru Meditation <emphasis>VERR_INVALID_RPL</emphasis> 
+          lors du démarrage de certains invités (bogue #11350)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM : support expérimental de SSE 4.1 / SSE 4.2 passthrough, voir
+          dans le manuel de l'utilisateur la façon de l'activer (bogue #8651)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM : correction pour les noyaux Linux récents avec la virtualisation
+        logicielle</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI: expérimentale des LEDs HID pour les hôtes
+        Windows, voir le manuel de l'utilisateur</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : avertissement de l'utilisateur si le pack d'extensions
+        Oracle n'est pas installé et si l'utilisateur essaie d'activer la fonction
+          d'affichage à distance (bogue #9104)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : on s'assure qu'un inviqé minimisé (en utilisant la mini 
+          barre d'outils en mode plein écran ou transparent) reste minimisé (bogue #12199)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : affichage d'une case à cocher "ne plus afficher ce message"
+        à la place du bouton correspondant</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : les câbles de l'adaptateur réseau peuvent maintenant être
+        connectés/déconnectés directement dans le menu Périphériques / Réseau
+        dans la machine virtuelle actuelle, via un indicateur d'état Réseau</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : l'assistant NouvelleVM propose maintenant par défaut des
+        invités 64 bits sur des hôtes 64 bits ; meilleure distinction entre les
+        types d'OS 32 bits et ceux 64 bits (bogue #12533)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : e d'erreur si l'importation d'un applicatif
+          échoue (bogue #12657)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : possibilité de définir la host-combination (combinaison d'hôte)
+        à 'Aucune' en utilisant les paramètres globaux / onglet Entrée (bogue #12730)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : ne met pas la VM en écran noir pendant la synchronisation
+        d'un instantané en ligne (régression 4.3)</para>
+      </listitem>
+
+      <listitem>
+        <para>VBoxManage : à l'export d'un applicatif, support de la suppression
+           des adresses MAC, ce qui veut dire qu'elles seront toujours recréées
+           lors de l'importation, évitant d'avoir des adresses MAC doubles pour
+           des VMs importées plusieurs fois</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI : correction d'un accroc de VM pendant la suspension dans
+        certaines circonstances</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI : correction d'un accroc de VM pendant la synchronisation des
+        instantanés en ligne dans certaines circonstances</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI: correction d'un bogue faisant planter les invités
+        Windows XP si un lecteur CD-ROM SATA est connecté (bogue #12417)</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI : correction d'une Guru Meditation dans certaines conditions</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI : échec de l'éjection d'un CD/DVD dans certaines conditions</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI : correction du branchement à chaud d'un disque</para>
+      </listitem>
+
+      <listitem>
+        <para>NAT : gestion transparente des veilles prolongées/réveils de l'hôte
+        et des changements de configurationréseau si dnsproxy est actif eu si
+        hostresolver est utilisé
+          (bogue #12441)</para>
+      </listitem>
+
+      <listitem>
+        <para>NAT : correction d'un plantage et d'un mauvais comportemen dans
+        certaines circonstances avec des paquets ICMP ayant TTL=1</para>
+      </listitem>
+
+      <listitem>
+        <para>Réseau NAT : correction du réassemblage en IPv6</para>
       </listitem>
 
       <listitem>
-        <para>VMM : correction du chargement des états sauvegardés si
-        VT-x/AMD-V a été désactivé (régression 4.3.0 ; bogue #12291)</para>
+        <para>Réseau NAT : implémentation du ping d'un proxy</para>
       </listitem>
 
       <listitem>
-        <para>VMM : correction d'un single-stepping dans l'invité pour certaines
+        <para>OVF : correction de la lecture de l'élément de section d'OVF 0.9 
+          (régression 4.3 ; bogue #12345)</para>
+      </listitem>
+
+      <listitem>
+        <para>OVF : plusieurs corrections</para>
+      </listitem>
+
+      <listitem>
+        <para>Support 3D : plusieurs corrections, notamment le multi-écrans
+        (voir bogue #9124)</para>
+      </listitem>
+
+      <listitem>
+        <para>Support 3D : inclusion d'un contenu 3D dans les vidéos capturées
+        (bogue #12666)</para>
+      </listitem>
+
+      <listitem>
+        <para>Support 3D : inclusion d'un contenu 3D dans les impressions d'écran
+        capturées (bogue #11758)</para>
+      </listitem>
+
+      <listitem>
+        <para>VGA : bonne gestion des modes graphiques rudimentaires si les
+          suppléments invité sont actifs (bogue #6649)</para>
+      </listitem>
+
+      <listitem>
+        <para>USB : correction d'un plantage pendant un transfert asynchrone
+        dans de rares circonstances</para>
+      </listitem>
+
+      <listitem>
+        <para>BIOS : meilleure gestion de la géométrie des disques  SCSI</para>
+      </listitem>
+
+      <listitem>
+        <para>API : correction de plantages dans les clients de l'API Java
+        utilisant le binding XPCOM, ce qui n'arrivait qu'avec les paramètres de
+           sortie (bogue #11232)</para>
+      </listitem>
+
+      <listitem>
+        <para>VBoxSVC : documentation de la prise en charge des événements de
+        gestion d'énergie de l'hôte (voir <xref linkend="hostpowertweaks" xreflabel="here"/>)
++          et ajout d'une donnée externe pour configurer la gestion de l'événement
+          batterie faible (bogue #9925)</para>
+      </listitem>
+
+      <listitem>
+        <para>VBoxSVC : correction d'un bogue pouvant provoquer un plantage
+          si l'instantané d'une VM était restauré une deuxième fois alors que
+          la VM avait des groupes de bandes passantes associés
+          (bogue #12569)</para>
+      </listitem>
+
+      <listitem>
+        <para>VBoxSVC : bonne détection d'ifconfig s'il se trouve dans
+        <emphasis>/bin</emphasis>
+          (bogue #12713)</para>
+      </listitem>
+
+      <listitem>
+        <para>Dossiers partagés : correction d'un échec pour restaurer
+        des dossiers partagés précédemment utilisés lors du démarrage d'une VM
+         d'un état sauvegardé (bogue #12578)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes Mac OS X : correction d'un problème quand l'icône de l'application
+          a été maintenue dans le dock si l'interface de bridge n'était pas
+          connectée à un réseau
+          (bogue #12241)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes Linux : prise en compte de l'ID physique des paquets lors de
+        la détermination du nombre de cœurs de processeurs physiques</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes / invités Linux : pas d'avertissement dans le journal du
+          noyau en cas d'échec d'affectation de mémoire (bogue #11171)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes Solaris : correction du script SMF de démarrage automatique
+        (bogue #11720)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes Windows : corrections des noms d'utilisateur des pages de
+        code non ANSI ou des contenus d'environnements du même genre (bogue #12596)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes / invités Windows : correction du réglage et de l'utilisation
+        des variables d'environnement du processus d'un utilisateur de l'invité
+          (par cohérence avec le contrôle de l'invité)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Windows : correction de la gestion des fuites dans
+        VBoxTray (bogue #12563)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Windows : correction d'un plantage pendant la détection
+        des utilisateurs actifs sur l'invité</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Windows : correction de la restauration des fichiers
+        D3D sauvegardés lors du passage de XPDM à WDDM</para>
+      </listitem>
+
+      <listitem>
+        <para>Contrôoe invité : correction de la définition et de l'utilisation
+        des variables d'environnement du processus de l'utilisateur de l'invité</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : support des noyaux Linux Enterprise 6.5
+          (bogue #12505)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : correction de la suppression à chaud du
+        processeur sur les nouveaux noyaux Linux</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux / Solaris : ne monte pas automatiquement un
+        dossier partagé qui est déjà monté</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments X11 : support de X.Org Server 1.15 (bogue #12623)</para>
+      </listitem>
+
+    </itemizedlist>
+
+  </sect1>
+
+  <sect1>
+    <title>Version 4.3.6 (18-12-2013)</title>
+
+    <para>C'est une version de maintenance. Les éléments suivants ont été
+    corrigés et/ou ajoutés :</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>VMM : correction d'une Guru Meditation <emphasis>VINF_EM_TRIPLE_FAULT</emphasis>
+          causée par la mise en cache VMCB avec la pagination nested sur
+          certains processeurs AMD (bogue #12451)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM : correction d'une Guru Meditation <emphasis>VERR_VMX_UNEXPECTED_INTERRUPTION_EXIT_TYPE</emphasis>
+          pendant l'interception des exceptions de débogage (VT-x seulement ; bogue #12410)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM : correction d'une Guru Meditation <emphasis>VERR_SVM_UNEXPECTED_EXIT</emphasis>
+          pendant l'interception des accès aux registres de débogage (AMD-V
+          seulement ; bogue #12481)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM correction d'une erreur a <emphasis>VERR_SSM_STRUCTURE_MAGIC</emphasis> 
+          quand on essaie de charger un état sauvegardé établi par VBox 4.3.4
+          quand VT-x/AMD-V est désactivé. Malheureusement, 
+          VBox 4.3.4 produisait des états sauvegardé cassés dans cette
+          configuration, donc vous devez désactiver ces états (bogue #12414)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM : ajout de quelques MSRs supplémentaires pour la liste
+        blanche exigée par certains invitçs (bogue #12245)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : correction de la suppression des VMs inaccessibles
+        (régression 4.3, bogue #12205)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : correction d'avertissements dans les paramètres de la VM /
+          nombre de processeurs de l'invité (bogue #12480)</para>
+      </listitem>
+
+      <listitem>
+        <para>Principal : n'active pas automatiquement les invités 64 bits sur
+        des hôtes 64 bits si VT-x/AMD-V n'est pas disponible (bogue #12424)</para>
+      </listitem>
+
+      <listitem>
+        <para>Principal : on présente toujours les informations en mémoire DMI
+        pour les invités Windows 2012 (bogue #12017)</para>
+      </listitem>
+
+      <listitem>
+        <para>Principal : correction de plantages occasionels sur lors d'un
+        changement de résolution de l'affichage de l'invité (bogue #7063)</para>
+      </listitem>
+
+      <listitem>
+        <para>Principal : correction de l'affichage des noms temporaires quand on
+          appelle <emphasis>IGuestSession::DirectoryCreateTemp()</emphasis> (bogue #12498)</para>
+      </listitem>
+
+      <listitem>
+        <para>API : correction d'un accroc au lancement d'une VM avec GUI via
+        l'API, qui plante car la GUI n'est pas disponible</para>
+      </listitem>
+
+      <listitem>
+        <para>Stockage : correction d'erreurs à l'exécution de
+        <emphasis>BLKCACHE_IOERR</emphasis> 
+          dans de rares circonstances (bogue #11030)</para>
+      </listitem>
+
+      <listitem>
+        <para>Réseau : possibilité de démarrer plus de 5 instances PCNet (bogue #12426)</para>
+      </listitem>
+
+      <listitem>
+        <para>E1000 : si le câble a été déconnecté avant l'initialisation par
+        l'invité du périphérique, l'état du lien n'était pas bien passé en
+        'désactivé' après la fin de l'initialisation, malgré le fait qu'il n'y
+        avait pas de connexion</para>
+      </listitem>
+
+      <listitem>
+        <para>Support 3D : correction d'un offset d'éléments d'une image 3D dans
+        l'invité (hôtes Mac OS X Retina seulement ; bogue #11021)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes Solaris : correction de l'accès au pilote de l'hôte à parti
+        zones non globales (régression 4.3, bogue #12271)</para>
+      </listitem>
+
+    </itemizedlist>
+
+  </sect1>
+
+  <sect1>
+    <title>Version 4.3.4 (2013-11-29)</title>
+
+    <para>C'est une version de maintenance. Les éléments suivants ont été
+    corrigés et/ou ajoutés :</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>VMM : correction d'un bogue dans l'émulation de l'APIC Local provoquant
+        un BSOD au démarrage de certains invités (régression 4.3.0 ; bogue #12240)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM : correction du chargement des états sauvegardés si VT-x/AMD-V
+        a été désactivé (régression 4.3.2 ; bogue #12291)</para>
+      </listitem>
+
+      <listitem>
+        <para>VMM : correction du single-stepping dans l'invité pour certaines
           instructions (VT-x seulement ; bogue #10947)</para>
       </listitem>
 
       <listitem>
-        <para>VMM : correction d'un problème de performance des accès APIC 
-        au redémarrage d'une VM (régression 4.#.0 ; VT-x seulement ; bogue #12296)</para>
+        <para>VMM : correction d'un problème de performance impliquant les accès
+        à l'APIC après le redémarrage d'une VM (régression 4.3.0 ; VT-x  seulement ;
+        bogue #12296)</para>
       </listitem>
 
       <listitem>
-        <para>VMM : correction d'une correction TPR qui s'activait pour les
-        invités 32 bits quand le type d'invité choisi est 64 bits (régression
-        4.3.0 ; AMD-V seulement)</para>
+        <para>VMM : correction de l'activation d'un correctif TPR pour les
+        invités 32 bits même quand le type d'invité choisi était un 32 bit 
+        (régression 4.3.0 ; AMD-V seulement)</para>
       </listitem>
 
       <listitem>
-        <para>VMM : correction d'erreurs <emphasis>VINF_EM_TRIPLE_FAULT</emphasis>
-        occassionnelles sur les hôtes n'ayant pas la fonction d'exécution de
-          l'invité sans restriction (bogue #12198)</para>
+        <para>VMM : correction d'erreurs <emphasis>VINF_EM_TRIPLE_FAULT</emphasis>  occasionnelles
+          sur des hôtes sans la fonction d'exécution sans restriction de l'invité (bogue #12198)</para>
       </listitem>
 
       <listitem>
-        <para>GUI : on n'ennuie pas l'utilisateur avec un avertissement BPP
-          s'il n'y a pas de suppléments invité installés</para>
+        <para>GUI : on n'ennuie pas l'utilisateur avec l'avertissement BPP si
+          les suppléments invité ne sont pas installés</para>
       </listitem>
 
       <listitem>
-        <para>GUI : correction de dessins d'artifacts dans la fenêtre de la machine 
-          au redémarrage de la VM ou au redimensionnement de l'écran de l'invité</para>
+        <para>GUI : correction de dessins artifcacts dans la fenêtre de la machine
+        au redémarrage de la VM / redimensionnement de l'écran de l'invité</para>
       </listitem>
 
       <listitem>
-        <para>GUI : on s'assure que la licence et la description affectées 
-        sont rattachées à l'applicatif exporté.</para>
+        <para>GUI : on s'assure que la licence et la description sont reliées
+          à l'applicatif exporté</para>
       </listitem>
 
       <listitem>
-        <para>GUI : correction de bogues dans la gestion des restrictions de laa ferin de la VM
-        (bogue #12333)</para>
+        <para>GUI : correction de bogues dans la gestion des restrictions de
+        fermeture d'une VM (bogue #12333)</para>
       </listitem>
 
       <listitem>
-        <para>GUI : correction de mauvaises couleurs du texte des assistant pour
-        des apparences inhabituelles (bogue #11743)</para>
+        <para>GUI : correction de mauvaises couleurs du texte des assistants
+        dans certaines apparences inhabituelles et pour certains styles (bogue #11743)</para>
       </listitem>
 
       <listitem>
         <para>GUI : devrait restaurer le mode transparent dès que possible après
-+          le redémarrage ou l'extinction de la VM</para>
+          le redémarrage ou l'extinction de la VM</para>
       </listitem>
 
       <listitem>
-        <para>GUI : corrections de plus de numéros de médias</para>
+        <para>GUI : corrections de l'énumération des médias</para>
       </listitem>
 
       <listitem>
-        <para>GUI : cache le gestionnaire de VM au lieu de fermer la fenêtre quand
-        on appuie sur le bouton Fermer la fenêtre (hôtes Max OS X seulement ; bogue #1772)</para>
+        <para>GUI : les points chauds d'OS X n'étaient pas accessibles tant qu'une
+        VM VirtualBox est en fonction (hôtes Mac OS X seulement ; bogue #4139)</para>
       </listitem>
 
       <listitem>
-        <para>GUI : les angles chauds d'OS X n'étaient pas accessibles quand
-        VirtualBox VM était ouvert (hôtes Mac OS X seulement ; bogue #4139)</para>
+        <para>GUI : correction d'un vieux bogue qui empêchait vhôte de s'éteindre /
+          redémarrer proprement si la fenêtre de sélection d'une VM est ouverte
+         (hôtes Mac OS X seulement ; bogue #8254)</para>
       </listitem>
 
       <listitem>
-        <para>Réseau Host-only : correction de la création d'interfaces réseaux host-only
-          (régression 4.3.0 ; bogue #12182)</para>
+        <para>Réseau Host-only : correction de la création d'interfaces réseaux
+        host-only (régression 4.3.0 ; bogue #12182)</para>
       </listitem>
 
       <listitem>
-        <para>NAT : ne pas faire une boucle infinie si l'hôte ne peut pas
+        <para>NAT : n'entre pas dans une boucle infinie si l'hôte ne peut pas
           accéder à un serveur DNS (régression 4.3.0 ; bogue #12300)</para>
       </listitem>
 
       <listitem>
-        <para>NAT : ne reconnecte pas le caâle si les informations de DNS changent
+        <para>NAT : ne rebranche pas le câble si les informations de DNS changent
           et si le câble a été déconnecté auparavant (régression 4.3.0 ; bogue #12225)</para>
       </listitem>
 
       <listitem>
-        <para>NAT : correction de plusieurs problèmes au démarrage/fin
-        automatique des réseaux NAT au démarrage/arrêt d'une VM ou lors d'un
-        changement de configuration</para>
+        <para>NAT : correction de plusieurs problèmes avec le démarrage/fin automatique
+          des réseaux NAT au démarrage " arrêt de la VM et lors des changements
+          de configuration</para>
       </listitem>
 
       <listitem>
-        <para>VBoxNetDHCP : n'empêche pas VBoxSVC de se terminer
+        <para>VBoxNetDHCP : le non bloc ge empêche VBoxSVC de se terminer
           (bogue #12264)</para>
       </listitem>
 
       <listitem>
-        <para>Accélération graphique 2D : correction de plantages lors des bascules
-        entre les modes de présentation 
+        <para>Accélération graphique 2D : correction de plantages lors des
+        changements de modes d'affichage 
           (bogue #9194)</para>
       </listitem>
 
       <listitem>
-        <para>BusLogic : possibilité de lancer des VMs ayant plus d'un 
-        contrôleur SCSI BusLogic activé</para>
+        <para>BusLogic : possibilité de lancer des VMs ayant plus d'un contrôleur
+        SCSI BusLogic activé</para>
       </listitem>
 
       <listitem>
-        <para>Clavier : correction d'un plantage de VM si elle est réveillée d'un
-          état sauvegardé et si on a appuyé sur au moins une touche (bogue #11289)</para>
+        <para>Clavier : correction d'un plantage de VM si une VM s'est réveillée
+          d'un état sauvegardé par l'appui sur au moins une touche (bogue #11289)</para>
       </listitem>
 
       <listitem>
-        <para>VBoxSVC : correction d'une corruption heap$$ dans certaines conditions
-          (régression 4.3.0)</para>
+        <para>VBoxSVC : correction d'une corruption heap dans certaines conditions (régression
+        4.3.0)</para>
       </listitem>
 
       <listitem>
-        <para>VBoxSVC : correction d'un conflit facteur d'accrocs à l'initialisation
-          (bogue #12349)</para>
+        <para>VBoxSVC : correction d'un conflit provoquant un accroc pendant
+        l'initialisation (bogue #12349)</para>
+      </listitem>
+      <listitem>
+        <para>OVF : correction d'une logique importation pour les applicatifs OVF
+        contenant plusieurs 
+          VMs</para>
       </listitem>
 
       <listitem>
-        <para>OVF : correction de l'import logique pour les applicatifs OVF qui
-        contiennent plusieurs VMs</para>
+        <para>OVF : amélioration logique de la recherche d'un format d'image
+          adéquat pendant l'importation d'un OVF</para>
+      </listitem>
+
+      <listitem>
+        <para>API : blocage de la suppression de l'instantané actuel s'il a des
+          instantanés fils (pertinent seulement pour les VMs sans disque dur
+          pouvant faire l'objet d'instantanés, leur présence empêchait toujours
+          la suppression), ce qui entraînait une corruption de la config de la VM
+          </para>
       </listitem>
 
       <listitem>
-        <para>OVF : amélioration de la logique permettant de trouver un format d'image
-        adéquat à l'import d'un OVF</para>
+        <para>API : marquage des configurations de VM avec des instantanés sans
+          celui actuel, inaccessible, car cette combinaison est ridicule</para>
       </listitem>
 
       <listitem>
         <para>API : correction des informations sur certains événements générés
-        automatiquement (seulement avec XPCOM, seul l'hôte Windows était concerné), 
-+       qui provoquaient des erreurs lors de la définition d'attributs par le
-        service web 
+        automatiquement (seulement avec XPCOM, l'hôte Windows n'était pas concerné),
+          ce qui provoquait des erreurs lors de ;a définition de certains attributs
+          via le service Web
           (bogue #12379)</para>
       </listitem>
 
       <listitem>
-        <para>SDK : extension de la fonctionnalité aux bindings C</para>
+        <para>SDK : extension des fonctionnalités des bindings C</para>
       </listitem>
 
       <listitem>
-        <para>Contrôle d'invité : diverses correcions (bogues #8072, #11044, #12336, #12338,
-          #12346, #12371)</para>
+        <para>Contrôle d'invité : diverses corrections de bogues et amélioration
+        de l'aide de VBoxManage (bogues #8072, #11044, #12336, #12338, #12346, #12371)</para>
       </listitem>
 
       <listitem>
-        <para>Hôtes Windows : nouvelle tentative de correction de la forte latence 
-        de DPC (bogue #6242)</para>
+        <para>Hôtes Windows : nouvelle tentative de correction de la forte latence
+        DPC 
+          (bogue #6242)</para>
       </listitem>
 
       <listitem>
-        <para>Installeur hôte Windows : l'enregistrement des extensions de
-          fichiers est facultatif, depuis une contribution de Tal Aloni (bogue #8009)</para>
+        <para>Installeur sur hôtes Windows : l'enregistrement des extensions de
+        fichiers devient facultatif, contribution de Tal Aloni (bogue #8009)</para>
       </listitem>
 
       <listitem>
-        <para>Hôtes Mac OS X : bonne signature des extensions du noyau pour les
-          hôtes Mavericks (bogue #12256)</para>
+        <para>Hôtes Mac OS X : signature correct des extensions du noyau pour
+        les hôtes Mavericks (bogue #12256)</para>
       </listitem>
 
       <listitem>
-        <para>Hôtes Mac OS X : correction d'un bogue où l'icône VirtualBox restait
-          dans le dock, empêchant l'hôte de s'éteindre (bogue #12241)</para>
+        <para>Hôtes Mac OS X : correction d'un bogue où l'icône VirtualBox du dock
+          n'était bien supprimée du dock après la fin d'une VM, empêchant
+          les hîtes Mavericks de s'éteindre (bogue #12241)</para>
       </listitem>
 
       <listitem>
-        <para>Hôtes Mac OS X : correction d'un petit problème de l'installeur (bogue #12275)</para>
+        <para>Hôtes Mac OS X : correction d'un petit problème de l'installeur
+        (bogue #12275)</para>
       </listitem>
 
       <listitem>
-        <para>Hôtes / invités Linux : corrections de la compilation avec Linux 
-        3.13 (bogue #12358)</para>
+        <para>Hôtes / invités Linux : corrections de compilation avec Linux 3.13
+        (bogue #12358)</para>
       </listitem>
 
       <listitem>
-        <para>Invités Linux : bonne construction du module vboxvideo du noyau
-           sur les invités OL/RHEL 6.1 (bogue #11996)</para>
+        <para>Invités Linux : bonne construction du module noyau vboxvideo sur les
+           invités OL/RHEL 6.1 (bogue #11996)</para>
       </listitem>
 
       <listitem>
@@ -219,184 +669,185 @@
       </listitem>
 
       <listitem>
-        <para>Suppléments invité/3D : correction de dead-lock occasionnel
-        (bogue #12319)</para>
+        <para>Suppléments invité/3D : correction d'un dead-lock occasionnel (bogue #12319)</para>
       </listitem>
 
       <listitem>
-        <para>Suppléments Windows/3D : correction d'une fuite de mémoire possible (bogue #12228)</para>
+        <para>Suppléments Windows/3D : correction d'une fuite de mémoire possible
+        (bogue #12228)</para>
       </listitem>
 
       <listitem>
-        <para>Suppléments Windows/XPDM : utilisation de tables distinctes contenant
-          les modes graphiques valides de chaque écran virtuel</para>
+        <para>Suppléments Windows/XPDM : utilisation de tables séparées contenant
+        des modes graphiques valides pour chaque écran</para>
+      </listitem>
+      <listitem>
+        <para>Suppléments Windows : correction des icentifications automatiques
+        sur les invités Windows Vista et supérieur (bogue #12332)</para>
       </listitem>
 
-     </itemizedlist>
+    </itemizedlist>
   </sect1>
- 
+
   <sect1>
     <title>Version 4.3.2 (01-11-2013)</title>
 
-    <para>C'est une version de maintenance. Les éléments suivants ont çté
-      corrigés et/ou ajoutés :</para>
- 
-     <itemizedlist>
- 
-       <listitem>
-        <para>VMM : correction de la restauration du TSC MSR auxiliaire avec
-        VT-x, qui provoquait des BSODs de l'hôte sur les hôtes Windows 8.1 et
-        un comportement imprévisible sur les autres hôtes 
-          (bogue #12237)</para>
-       </listitem>
- 
-       <listitem>
-        <para>VMM : fourniture de fausses valeurs pour deux MSRs pour mieux
-          satisfaire l'invité sur certains hôtes</para>
+    <para>C'est une version de maintenance. Les éléments suivants ont été
+    corrigés et/ou ajoutés :</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>VMM : correction de la restauration du TSC MSR auxiliaire en VT-x
+    qui provoquait des BSODs de l'hôte sur les hôtes Windows 8.1 et un comportement
+          imprévisible sur les autres hôtes (bogue #12237)</para>
       </listitem>
 
-       <listitem>
-        <para>VMM : correction de la détection de VT-x sur certaines machines où
-        le BIOS ne définit pas le bit de la fonction VMX LOCK, ce qui touchait
-       les paramètres de la VM dans la GUI</para>
+      <listitem>
+        <para>VMM : on fournit de fausses valeurs pour deux MSRs afin de
+          mieux contenter l'invité sur certains hôtes</para>
        </listitem>
- 
       <listitem>
-        <para>VMM : correction d'un $$ TPR threshold qui provoquait des BSODs sur
-les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</para>
+        <para>VMM : correction de la détection de VT-x sur certaines machines 
+        où le BIOS ne définirait pas le bit de la fonction VMX LOCK, ce qui
+        concernait les paramètres de la VM dans la GUI</para>
       </listitem>
 
       <listitem>
-        <para>VMM : correction d'une incompatibilité de l'état sauvegardé PATM
-          pour les VMs en virtualisationlogicielle (bogue #12222)</para>
+        <para>VMM : correction du threshold TPR qui provoquait des BSODs sur
+        les invités Windows XP qui utilisent l'APIC E/S (VT-x seulement ; bogue #12227)</para>
       </listitem>
 
       <listitem>
-        <para>VMM : n'échoue pas si AMD-V n'est pas disponible si la VM est
-        configurée pour utiliser la virtualisation logicielle</para>
+        <para>VMM : correction d'une incompatibilité PATM dans l'état sauvegardé
+        pour les VMs virtualisées de façon logicielle (bogue #12222)</para>
       </listitem>
 
       <listitem>
-        <para>GUI : correction du redimensionnement de l'invité qui se brisait
-        au changement de mode de représentation visuelle
-	  (en passant de normal à plein-écran etc)</para>
+        <para>VMM : n'échoue pas si if AMD-V n'est pas disponible si la VM est
+        configurée pour utiliser la virtualisation logicielle</para>
+     </listitem>
+
+      <listitem>
+        <para>GUI : correction d'une rupture du redimensionnement de l'invité
+        lors des changements des modes d'affichage (quand on passe du mode normal
+          au plein écran, etc)</para>
       </listitem>
 
       <listitem>
-        <para>GUI : on s'assure que l'écran de l'invité se redimensionne après la
-        restauration d'une VM d'un état sauvegardé si la taille de l'écran de l'hôte 
-          a changé</para>
+        <para>GUI : on s'assure que l'écran de l'invité se redimensionne après
+          la restauration d'une VM d'un état sauvegardé si la taille de l'écran
+          de l'hôte a changé</para>
       </listitem>
 
       <listitem>
-        <para>GUI : désactivation de la synchronisation de la led de défilement
-        de la synchronisation des LEDs HID 
+        <para>GUI : désactivation de la synchronisation de la LED du défilement
+        par rapport à la synchronisation des LEDs HID 
           (hôtes Mac OS X seulement)</para>
       </listitem>
 
       <listitem>
-        <para>Amélioration du support du webcam passthrough avec le support GUI (voir
+        <para>Amélioration du Webcam passthrough, y compris le support en
+        GUI support (voir
           <xref linkend="webcam-passthrough" />)</para>
       </listitem>
 
       <listitem>
-        <para>Contrôle invité : implémentation de davantage de méthodes
+        <para>Contrôle d'invité : implémentation de davantage de méthodes
         <computeroutput>IGuestSession</computeroutput></para>
       </listitem>
 
       <listitem>
         <para>Contrôle invité : ajout du support de l'effacement et du renommage
-        des fichiers et des répertoires de l'invité dans
-          VBoxManage</para>
+        des fichiers et des répertoires de l'invité dans VBoxManage</para>
       </listitem>
 
       <listitem>
-        <para>Contrôle invité : diverses corrections de bogues</para>
+        <para>Contrôle invité : plusieurs corrections de bogues</para>
       </listitem>
 
       <listitem>
-        <para>API : mauvaise gestion de la valeur par défaut de l'UUID du matériel,
-         si bien que tous les UUIDs DMI/SMBIOS sont de zéro, ce qui amène Windows 
-          à demander la ré-activation (régression 4.3 ; bogue #12244)</para>
+        <para>API : mauvaise gestion de la valeur par défaut de l'UUID, ce qui
+          donne des UUIDs DMI/SMBIOS pleins de zéros, amenant Windows à
+          demander d'être réactivé (régression 4.3 ; bogue #12244)</para>
       </listitem>
 
       <listitem>
-        <para>Support 3D : correction d'un plantge à l'extinction si l'accélération 
-        graphique 2D est activée  (hôtes Mac OS X seulement)</para>
+        <para>Support 3D : correction d'un plantage à l'extinction si l'accélération
+        graphique 2D est activée (hôtes Mac OS X seulement)</para>
       </listitem>
 
       <listitem>
-        <para>Support 3D : corrections de généralités</para>
+        <para>Support 3D : corrections diverses</para>
       </listitem>
 
       <listitem>
-        <para>Stockage : correction de la détection d'un CD/DVD quand on vient
-        d'un lecteur vide à celui de l'hôte quand passthrough est activé</para>
+        <para>Stockage : correction de la détection des CD/DVD quand on passe
+          d'un lecteur vide à un rattaché à l'hôte avec passthrough activé</para>
       </listitem>
 
       <listitem>
         <para>Stockage : correction d'un accroc du processus de VM quand le disque
-        est plein dans certaines circonstances</para>
+        est plein dans certaines 
+          circonstances</para>
       </listitem>
 
       <listitem>
-        <para>NAT : écoute des changements de paramétrages du réseau NAT au moment
-        de l'exécution.</para>
+        <para>NAT : écoute des changements de paramétrage du réseau NAT pendant
+        l'exécution.</para>
       </listitem>
 
       <listitem>
-        <para>NAT : le serveur DHCP du réseau NAT enregistre maintenant les baux
-          de façon permanente</para>
+        <para>NAT : le serveur DHCP du réseau NAT enregistre maintenant les
+        adresses sur un support de stockage permanent</para>
       </listitem>
-
       <listitem>
-        <para>Principal : modifications du moniteur dans la configuration du
-        DNS de l'hôte</para>
+        <para>Principal : changements d'écran dans la configuration du DNS de l'hôte </para>
       </listitem>
 
       <listitem>
-        <para>Hôte Mac OS X : on a retravaillé un mécanisme d'ajout d'une icône
-        de bureau d'une VM à partir du sélecteur de VM</para>
+        <para>Hôte Mac OS X : on a retravaillé un mécanisme d'ajout d'un alias
+        sur le bureau vers une VM à partir du sélecteur de VM</para>
       </listitem>
 
       <listitem>
-        <para>Installeur Mac OS X : suppression des anciennes extensions du noyau
-        à la mise à jour  (bogue #12258)</para>
+        <para>Hôtes Mac OS X : suppression des extensions pour les
+         vieux noyaux lors de la mise à jour (bogue #12258)</para>
       </listitem>
 
       <listitem>
-        <para>Suppléments Linux : bon réglage de l'umask avant l'-installation
+        <para>Suppléments Linux : bonne définition de l'umask avant d'installer
           (bogue #12166)</para>
       </listitem>
 
       <listitem>
-        <para>Suppléments X11/3D : correction de gels au démarrage d'un bureau 3D
-          (bogue #11503, merci à Sam Spilsbury)</para>
+        <para>Suppléments X11 /3D : correction de gels au lancement d'un bureau
+        3D (bogue #11503, merci à Sam Spilsbury)</para>
       </listitem>
 
       <listitem>
-        <para>Suppléments X11/3D : correctin de la largeur du support de tampon
+        <para>Suppléments X11 / 3D  : correction du support de tampons en profondeur
         (bogue #11905)</para>
       </listitem>
 
       <listitem>
-        <para>Suppléments X11/3D : correction du thème Age Of Empires 3 (l'âge des
-        Empires 3 (bogue #11331)</para>
+        <para>Suppléments X11 / 3D : correction de l'affichage Age Of Empires 3
+        (bogue #11331)</para>
       </listitem>
 
       <listitem>
-        <para>Suppléments Windows/3D : correction de l'affichage du greffon
+        <para>Suppléments Windows / 3D : correction de l'affichage du greffon
         Google Earth</para>
       </listitem>
 
       <listitem>
-        <para>Suppléments Windows/WDDM : corrections du redimensionnement automatique</para>
+        <para>Suppléments Windows / WDDM : corrections de personnalisation</para>
       </listitem>
 
     </itemizedlist>
   </sect1>
- 
-   <sect1>
+
+  <sect1>
     <title>Version 4.3.0 (2013-10-15)</title>
 
     <para>C'est une mise à jour majeure. Les nouvelles fonctions suivantes ont
@@ -411,7 +862,7 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
        </listitem>
        <listitem>
          <para>VMM : introduction d'un petit interpréteur d'instructions pour les
-         situations que ne gère pas la  virtualisation matérielle</para>
+         situations que ne gère pas la virtualisation matérielle</para>
        </listitem>
        <listitem>
         <para>GUI : mécanisme de messages étendus (utilisation des nouvelles
@@ -434,7 +885,8 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
       </listitem>
 
       <listitem>
-        <para>Ajout du webcam passthrough de la webcam de l'hôte.</para>
+        <para>Ajout du support expérimental du webcam passthrough en complément
+         du passthroough USB (voir <xref linkend="webcam-passthrough" />)</para>
       </listitem>
       <listitem>
         <para>Ajout de l'émulation d'un CD-ROM SCSI, incluant le support au
@@ -451,7 +903,7 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
       </listitem>
 
       <listitem>
-        <para>Contrôle invité : implémentation du support d'IGuestFile</para>
+        <para>Contrôle invité : implémentation du support d'<computeroutput>IGuestFile</computeroutput></para>
       </listitem>
 
       <listitem>
@@ -470,7 +922,7 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
       <listitem>
         <para>VMM : amélioration significative des performances des invités
         NetWare 5.x/6.x sur des systèmes hôte ne supportant pas la pagination
-        nestée</para>
+        imbriquée</para>
       </listitem>
 
       <listitem>
@@ -482,6 +934,10 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
         de tâches (bogue #10532)</para>
       </listitem>
       <listitem>
+        <para>VMM : possibilité d'activer VT-x tout en étant en mode IMX et
+        on donne plus d'informations si ce n'est pas possible</para>
+      </listitem>
+      <listitem>
         <para>GUI : la vérification des mises à jour utilise https</para>
       </listitem>
 
@@ -490,6 +946,10 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
       </listitem>
 
       <listitem>
+        <para>GUI : synchronisation des LEDs HID pendant le changement
+        de fenêtre hôte-invité (hôtes (Mac OS X seulement)</para>
+      </listitem>
+      <listitem>
         <para>GUI, VBoxManage : lorsqu'on désenregistre une VM, désenregistrement
         également des images de disques durs utilisées exclusivement par celle-ci
         (bogue #10311)</para>
@@ -550,7 +1010,7 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
         environ plus de 100 VMs</para>
       </listitem>
       <listitem>
-        <para>Principal : utilisatiod du dossier de configuration standard
+        <para>Principal : utilisation du dossier de configuration standard
         de XDG au lieu de .VirtualBox sur des systèmes où c'est nécessaire (bogue
         #5099)</para>
       </listitem>
@@ -595,10 +1055,15 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
       </listitem>
 
       <listitem>
-        <para>VBoxManage : ajout du support de lsupervision des sessions de l'invité via
+        <para>VBoxManage : ajout du support de supervision des sessions de l'invité via
           <computeroutput>guestcontrol watch</computeroutput>
         </para>
       </listitem>
+      <listitem>
+        <para>VBoxManage : ajout de  <computeroutput>modifyvm --triplefaultreset</computeroutput>
+        pour que la VM redémarre après trois erreurs au lieu de tomber en
+        Meditation Gourou.</para>
+      </listitem>
 
       <listitem>
         <para>Support 3D : plusieurs corrections</para>
@@ -613,7 +1078,7 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
       </listitem>
 
       <listitem>
-        <para>VBoxManage : ajout du support 'de la fin des processus actifs de
+        <para>VBoxManage : ajout du support de la fin des processus actifs de
         l'invité via <computeroutput>guestcontrol process kill|close|terminate --session-id <ID>|
         --session-name <nom ou modèle> <PID> ... <PID n></computeroutput>
         ou
@@ -641,6 +1106,13 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
         contribution de François Revol</para>
        </listitem>
        <listitem>
+         <para>Hôtes Mac OS X : support limité pour Mac OS X 10.9 (Mavericks)</para>
+       </listitem>
+       <listitem>
+         <para>Hôtes Mac OS X : utilisation d'un script de lancement au lieu
+         du mécanisme obsolète StartupItem (bogue #8940)</para>
+       </listitem>
+       <listitem>
          <para>Hôtes Windows : ne provoque pas de grosse latence DPC (seulement
          sur certains hôtes ; a encore besoin d'améliorations ; bogue #6242)</para>
        </listitem>
@@ -661,21 +1133,287 @@ les invités Windows XP utilisant l'APIC E/S (VT-x seulement ; bogue #12227)</pa
          (bogue #12072)</para>
        </listitem>
        <listitem>
+         <para>Invités Windows : possibilité de repérer les moments d'inactivité 
+         de l'utilisateur dans l'invité grâce à l'événement
+         IGuestUserStateChangedEvent, introduit récemment.</para>
+       </listitem>
+       <listitem>
          <para>Suppléments Linux : correction de la détection par udev dans le
          script de démarrage avec les noyaux 3.x</para>
        </listitem>
 
-       <listitem>
-         <para>Invités Windows : possibilité de repérer les moments
-d'inactivité 
-         de l'utilisateur dans l'invité grâce à l'événement
-         IGuestUserStateChangedEvent, introduit récemment.</para>
-       </listitem>
 
     </itemizedlist>
 
   </sect1>
 
+  <sect1>
+    <title>Version 4.2.22 (10-01-2014)</title>
+
+    <para>C'est une version de maintenance. Les éléments suivants ont été
+    corrigés et/ou ajoutés :</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>GUI : hôte Mac OS X : introduction de la donnée externe "GUI/HidLedsSync" 
+        destinée à activer la synchronisation des LEDs HID (fonction désactivée
+        par défaut)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : hôte Mac OS X : correction d'un problème sur les hôtes
+        MacBook Air/Pro quand la GUI pourrait se figer en essayant de synchroniser
+        les LEDs HID</para>
+      </listitem>
+
+      <listitem>
+        <para>Principal : présentation en permanence des informations de la
+        mémoire DMI aux invités Windows 2012 (bogue #12017)</para>
+      </listitem>
+
+      <listitem>
+        <para>HGCM : correction de plantages dans certaines conditions</para>
+      </listitem>
+
+      <listitem>
+        <para>Stockage : correction d'erreurs <emphasis>BLKCACHE_IOERR</emphasis> 
+          à l'exécution dans de rares circonstances (bogue #11030)</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI : correction d'un bogue qui causait un accroc des invités
+        Windows XP si un lecteur CDROM SATA est connecté (bogue #12417)</para>
+      </listitem>
+
+      <listitem>
+        <para>AHCI : correction d'une Guru Meditation dans certaines conditions</para>
+      </listitem>
+
+      <listitem>
+        <para>E1000 : si le câble a été déconnecté avant que l'invité a initialisé
+          le périphérique, l'état de la liaison n'était pas bien passé à 'inactif'
+          après que l'initialisation ne se soit terminée malgré le fait qu'il n'y
+        avait pas de connexion</para>
+      </listitem>
+
+      <listitem>
+        <para>Support 3D : correction d'un offset des éléments d'une image 3D
+        sur certains invités (hôtes Mac OS X Retina seulement ;
+          bogue #11021)</para>
+      </listitem>
+
+      <listitem>
+        <para>Support 3D : nombreuses corrections</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : support des noyaux Linux Enterprise 6.5
+           (bogue #12505)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : correction du retrait à chaud d'un processeur
+        sur les noyaux Linux récents</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Windows : correction de plantages de l'hôte dans le
+          service dossiers partagés dans certaines conditions</para>
+      </listitem>
+
+    </itemizedlist>
+
+  </sect1>
+
+  <sect1>
+    <title>Version 4.2.20 (28-11-2013)</title>
+
+    <para>C'est une version de maintenance. Les éléments suivants ont été
+    corrigés et/ou ajoutés :</para>
+
+    <itemizedlist>
+
+      <listitem>
+        <para>GUI : on signale toujours les résolutions recommandées pour tous 
+        les écrans (craa ne se faisait pas toujours depuis la 4.2.12)</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : on s'assure que la licence et la description affectées sont
+        en lien avec l'applicatif exporté</para>
+      </listitem>
+
+      <listitem>
+        <para>GUI : les angles chauds d'OS X n'étaient pas accessibles tant qu'une
+        VM VirtualBox est en fonction (hôtes Mac OS X seulement ; bogue #4139)</para>
+      </listitem>
+
+      <listitem>
+        <para>NAT : ne tombe pas en boucle infinie si l'hôte ne peut pas 
+          accéder à un serveur de DNS (régression 4.3.0 ; bogue #12300)</para>
+      </listitem>
+
+      <listitem>
+        <para>NAT : pas de reconnexion du câble si les informations DNS
+        changent et si le câble a été déconnecté auparavant (régression 4.3.0 ; bogue #12225)</para>
+      </listitem>
+
+      <listitem>
+        <para>Principal : sauvegarde correcte du drapeau <emphasis>passthrough</emphasis> 
+          pour les lecteurs DVD sans média inséré</para>
+      </listitem>
+
+      <listitem>
+        <para>Clavier : correction d'un plantage de VM si une VM se réveille
+          d'un état sauvegardé où on appuie au moins sur une touche (bogue #11289)</para>
+      </listitem>
+
+      <listitem>
+        <para>Accélération graphique 2D : correction de plantages lors des changements
+        de mode d'affichage (bogue #9194)</para>
+      </listitem>
+
+      <listitem>
+        <para>Stockage : correction d'erreurs d'instantanés quand on utilise des
+    images de disque QCOW ou QED (bogue #12144)</para>
+      </listitem>
+
+      <listitem>
+        <para>Stockage : correction pour les noyaux Linux récents qui ne détectent
+        pas un disque dur en tant que SSD quand on utilise un contrôleur
+          IDE ou SATA (bogue #12025)</para>
+      </listitem>
+
+      <listitem>
+        <para>Stocmage : correction de la détection des CD/DVD quane on passe d'un
+          contenu vide au lecteur hôte quand passthrough est activé</para>
+      </listitem>
+
+      <listitem>
+        <para>Instantanés : correction d'un bogue qui pouvait faire perdre la
+          connexion avec les médias (régression 4.2.18, bogue #11750)</para>
+      </listitem>
+
+      <listitem>
+        <para>Presse-papiers partagç : correction d'une erreur de segmentation
+        potentielle quand on travaille avec un contenu UTF8 et UTF16 (hôtes Mac
+        OS X seulement)</para>
+      </listitem>
+
+      <listitem>
+        <para>OVF : correction d'une logique d'importation pour les applicatifs
+        OVF contenant plusieurs VMs</para>
+      </listitem>
+
+      <listitem>
+        <para>Installeur du pack d'extension : il fonctionne si le fichier se
+          trouve dans un dossier ayant des caractères spéciaux</para>
+      </listitem>
+
+      <listitem>
+        <para>SDK : extension de la fonctionnalité pour les bindings C</para>
+      </listitem>
+
+      <listitem>
+        <para>API : blocage de la suppression de l'instantané actuel s'il a des
++           instantanés fils (pertinent seulement pour les VMs sans disques durs,
+           dont on peut prendre un instantané, leur présence empêchait toujours
+           la suppression), ce qui créait une corruption de configuration de la
+           VM</para>
+      </listitem>
+
+      <listitem>
+        <para>API : marquage des configurations de VM par des instantanés sans
+           que l'instantané actuel ne soit inaccessible, car cette combinaison
+           n'a aucun sens</para>
+      </listitem>
+
+      <listitem>
+        <para>API : correction des informations sur certains événements
+        générés automatiquement (seulement avec XPCOM, l'hôte Windows n'était pas
+        concerné), ce qui ne provoquait pas d'erreurs quand on récupérait les
+        attributs par le service Web (bogue #12379)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes Mac OS X : support pour Mac OS X 10.9 (Mavericks)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hîtes Mac OS X : bonne signature des extensions noyau pour les
+          hôtes Mavericks (bogue #12256)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes Mac OS X : utilisation d'un script de lancement au lieu
+          d'un mécanisme StartupItem obsolète (bogue #8940)</para>
+      </listitem>
+
+      <listitem>
+        <para>Hôtes Mac OS X : correction d'un bogue où l'icône de dock de
+        VirtualBox n'était pas bien supprimé du dock après la fin d'une VM,
+          empêchant les hôtes Mavericks de s'éteindre (bogue #12241)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : correction de la compilation avec Linux 3.13
+        (bogue #12358)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : correction de la compilation avec Linux 3.12 (bogue #12083)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : correction de la compilation avec Linux 3.11 
+        pour les dossiers partagés (bogues #11946, #12128)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : correction de la compilation avec SLES11 SP3</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : bonne définftion de l'umask avant l''installation
+           (bogue #12166)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : construction correcte du module de noyau vboxvideo
+           sur des invités OL/RHEL 6.1 (bogue #11996)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Linux : on a fait en sorte que la 3D fonctionne sur
+        Slackware 14.1 (bogue #12320 commentaires 3 et 4)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Windows : correction de fuites de mémoire causçes par
+          <emphasis>WTSQuerySessionInformation()</emphasis>
+          sur des invités Windows 2000 (bogue #12072)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments Windows : correction du redimensionnement avec plusieurs
+        écrans</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments X11/3D : correction de gels au démarrage du bureau 3D
+        (bogue #11503, merci à Sam Spilsbury)</para>
+      </listitem>
+
+      <listitem>
+        <para>Suppléments invité/3D : correction d'un dead-lock occasionnel
+        (bogue #12319)
+           </para>
+      </listitem>
+
+    </itemizedlist>
+  </sect1>
+
    <sect1>
     <title>Version 4.2.18 (09-06-2013)</title>
 
@@ -711,7 +1449,7 @@ d'inactivité
       </listitem>
 
       <listitem>
-        <para>3D : corrections du multiécrans (mauvais positionnement de la souris,
+        <para>Support 3D : corrections du multiécrans (mauvais positionnement de la souris,
         morcellements)</para>
       </listitem>
 
@@ -745,7 +1483,7 @@ d'inactivité
         <para>Réseau : après le réveil de l'hôte d'une suspension, déconnexion
         et reconnexion des câbles réseaux virtuels pour forcer le renouvellement
           des baux DHCP de l'invité. Jusque-là, seuls les hôtes Mac OS X et
-          Windows le faisaient (bogue #10063).</para>
+          Windows le faisaient (bogue #10063)</para>
       </listitem>
 
       <listitem>
@@ -764,7 +1502,7 @@ d'inactivité
 
       <listitem>
         <para>Hôtes Solaris : correction d'un kernel panic potentiel à cause
-        d'une préemption imprévue due à la journalisation.</para>
+        d'une préemption imprévue due à la journalisation</para>
       </listitem>
 
       <listitem>
@@ -800,7 +1538,7 @@ d'inactivité
 
       <listitem>
         <para>GUI : ne restaure pas l'instantané actuel si on coupe après une
-          Guru Mediation</para>
+          Mediation Gourou</para>
       </listitem>
 
       <listitem>
@@ -927,11 +1665,11 @@ d'inactivité
       </listitem>
 
       <listitem>
-        <para>3D : corrections du mode transparent + 3D (bogue #11723)</para>
+        <para>Support 3D : corrections du mode transparent + 3D (bogue #11723)</para>
       </listitem>
 
       <listitem>
-        <para>3D : la version 4.2.12 ne pouvait pas lire les états suvegardés des
+        <para>Support 3D : la version 4.2.12 ne pouvait pas lire les états suvegardés des
         anciennes versions dans certaines conditions (bogue #11718)</para>
       </listitem>
 
@@ -1067,7 +1805,7 @@ d'inactivité
 
       <listitem>
         <para>VMM : correction d'une Guru Meditation quand on branche un
-        processeur dans un invité Linux si la pagination nested est désactivée</para>
+        processeur dans un invité Linux si la pagination imbriquée est désactivée</para>
       </listitem>
 
       <listitem>
@@ -4905,7 +5643,7 @@ on quitte le mode plein écran avec des
             </listitem>
 
             <listitem>
-              <para>Intel HD Audio, pour un meilleur support des szstèmes
+              <para>Intel HD Audio, pour un meilleur support des systèmes
               d'exploitation modernes (comme Windows 64 bits ; bogue #2785)</para>
             </listitem>
           </itemizedlist>
@@ -4973,7 +5711,7 @@ on quitte le mode plein écran avec des
       <listitem>
         <para>VMM : Activation par défaut du support des grandes pages sur les
         hôtes 64 bits (cela s'applique seulement à la pagination 
-        nested)</para>
+        imbriquée)</para>
       </listitem>
 
       <listitem>
@@ -5185,7 +5923,7 @@ on quitte le mode plein écran avec des
 
       <listitem>
         <para>GUI : application des vérifications de dépassement de la taille
-        limite du szstème de fichiers hôte et d'E/S asynchrones cassés sur les
+        limite du système de fichiers hôte et d'E/S asynchrones cassés sur les
         anciens noyaux Linux ayant les systèmes de fichiers ext4 / xfs, non
         seulement au démarrage à partir de 0 d'une VM, mais aussi au démarrage
         à partir d'un état sauvegardé</para>
@@ -5348,7 +6086,7 @@ on quitte le mode plein écran avec des
 
       <listitem>
         <para>VMM : correction d'une Guru meditation pour les grosses mémoires
-        des invités 64 bits sur les hôtes 32 bits ayant la pagination nested
+        des invités 64 bits sur les hôtes 32 bits ayant la pagination imbriquée
           (bogue #7544)</para>
       </listitem>
 
@@ -6140,7 +6878,7 @@ on quitte le mode plein écran avec des
       </listitem>
 
       <listitem>
-        <para>VMM : correction d'une faible performance avec la pagination nested
+        <para>VMM : correction d'une faible performance avec la pagination imbriquée
         et l'exécution de ;'invité sans restriction (VT-x seulement ; bogue #6716)</para>
       </listitem>
 
@@ -6361,9 +7099,9 @@ on quitte le mode plein écran avec des
       <listitem>
         <para>Nouvelles fonctions de l'Hyperviseur : avec VT-x/AMD-V sur les
         hôtes 64 bits, l'utilisation de grandes pages peut améliorer les
-        performances (voir <xref linkend="nestedpaging"/>) ; en outre, sur
+        performances (voir <xref linkend="imbriquéepaging"/>) ; en outre, sur
           VT-x, l'exécution sans restriction de l'invité est maintenant supportée
-          (si la pagination nested est activée avec VT-x, le mode réel et le mode 
+          (si la pagination imbriquée est activée avec VT-x, le mode réel et le mode 
           protégé sans code de pagination fonctionnent plus vite, ce qui accélère
           considérablement le démarrage de l'OS invité)</para>
       </listitem>
@@ -6580,12 +7318,12 @@ on quitte le mode plein écran avec des
 
       <listitem>
         <para>VMM : correction d'un plantage de l'invité OS/2 quand la pagination
-        nested activée</para>
+        imbriquée activée</para>
       </listitem>
 
       <listitem>
         <para>VMM : correction d'une grosse perte des performances d'affichage
-        (AMD-V avec la pagination nested seulement) </para>
+        (AMD-V avec la pagination imbriquée seulement) </para>
       </listitem>
 
       <listitem>
@@ -6642,7 +7380,7 @@ on quitte le mode plein écran avec des
       </listitem>
 
       <listitem>
-        <para>NAT : correction d'une latence ICMP (hîtes non Windows seulement ;
+        <para>NAT : correction d'une latence ICMP (hôtes non Windows seulement ;
         bogue #6427)</para>
       </listitem>
 
@@ -7004,7 +7742,7 @@ on quitte le mode plein écran avec des
       </listitem>
 
       <listitem>
-        <para>VMM : activation de la pagination nested par défaut sur les
+        <para>VMM : activation de la pagination imbriquée par défaut sur les
         nouvelles VMs (s'il est disponible ; VT-x et AMD-V seulement)</para>
       </listitem>
 
@@ -7810,7 +8548,7 @@ on quitte le mode plein écran avec des
       </listitem>
 
       <listitem>
-        <para>VMM : correction d'une guru meditation en pagination nested et
+        <para>VMM : correction d'une guru meditation en pagination imbriquée et
         avec les invités SMP (bogue #5222) </para>
       </listitem>
 
@@ -7835,7 +8573,7 @@ on quitte le mode plein écran avec des
       </listitem>
 
       <listitem>
-        <para>VMM : correction de la pagination nested cassée pour les invités
+        <para>VMM : correction de la pagination imbriquée cassée pour les invités
         64 bits sur les hôtes 32 bits (AMD-V seulement ; bogue #5285)</para>
       </listitem>
 
@@ -9469,7 +10207,7 @@ on quitte le mode plein écran avec des
 
       <listitem>
         <para>VMM : correction d'un accroc au démarrage de Windows XP (invité
-        PAE + pagination nested seulement) </para>
+        PAE + pagination imbriquée seulement) </para>
       </listitem>
 
       <listitem>
@@ -10522,7 +11260,7 @@ on quitte le mode plein écran avec des
 
       <listitem>
         <para>API : ajout de méthodes pour renvoyer les informations sur la
-        configuration réseau du szstème hôte</para>
+        configuration réseau du système hôte</para>
       </listitem>
 
       <listitem>
@@ -11093,11 +11831,11 @@ on quitte le mode plein écran avec des
     majeures suivantes ont été ajoutées :<itemizedlist>
 
         <listitem>
-          <para>Support des invités 64 bits (!ôtes 64 bits seulement) </para>
+          <para>Support des invités 64 bits (hôtes 64 bits seulement) </para>
         </listitem>
 
         <listitem>
-          <para>Nouvel interface utilisateur natifLeopard sur les hôtes Mac OS X</para>
+          <para>Nouvel interface utilisateur natif Leopard sur les hôtes Mac OS X</para>
         </listitem>
 
         <listitem>
@@ -11123,7 +11861,7 @@ on quitte le mode plein écran avec des
         </listitem>
 
         <listitem>
-          <para>Support de la pagination Nested sur les processeurs AMD modernes
+          <para>Support de la pagination imbriquée sur les processeurs AMD modernes
           (amélioration majeure des performance)</para>
         </listitem>
 
diff --git a/doc/manual/fr_FR/user_Frontends.xml b/doc/manual/fr_FR/user_Frontends.xml
index d23a2ea..70059d1 100644
--- a/doc/manual/fr_FR/user_Frontends.xml
+++ b/doc/manual/fr_FR/user_Frontends.xml
@@ -8,7 +8,7 @@
     <title>Affichage distant (VRDP support)</title>
 
     <para>VirtualBox peut afficher les machines virtuelles à distance, ce qui
-    signifie qu'une machine virtuelle peut s'exécuter sur un ordinateur même si
+    signifie qu'une machine virtuelle peut s'exécuter sur un ordinateur alors que
     la machine sera affichée sur un deuxième ordinateur, et la machine sera
     contrôlée également à partir de là, comme si la machine virtuelle fonctionnait
     sur ce deuxième ordinateur.</para>
@@ -23,7 +23,7 @@
 
     <para>Oracle fournit un support pour le <emphasis role="bold">VirtualBox
     Remote Display Protocol (VRDP)</emphasis> dans ce paquet d'extension de
-    VirtualBox. Tuand on installe ce paquet, les versions de VirtualBox et
+    VirtualBox. Quand on installe ce paquet, les versions de VirtualBox et
     4.0 et supérieur supportent VRDP de la même façon que les versions binaires
     (non libre)) de VirtualBox avant 4.0.</para>
 
@@ -50,38 +50,7 @@
     intégré à Windows lui-même. Les ports 5000 à 5050 sont le plus souvent
     inusités et pourraient être un bon choix.</para>
 
-    <para>Vous pouvez modifier le port soit dans les paramètres "Affichage" d5
-    l'interface graphique, soit via l'option <computeroutput>--vrdeport</computeroutput>
-    de la commande <computeroutput>VBoxManage modifyvm</computeroutput>. Vous
-    pouvez indiquer une liste séparée par des virgules de ports ou de plages de
-    ports. Utilisez un tiret entre deux numéros de ports pour indiquer une plage.
-    Le serveur VRDP s'appuiera sur <emphasis role="bold">un</emphasis> des
-    ports disponibles au sein de la liste spécifiée. Par exemple, <computeroutput>VBoxManage modifyvm "nom
-    VM" --vrdeport 5000,5010-5012</computeroutput> configurera le
-    serveur pour s'appuyer sur un des ports parmi le 5000, 5010, 5011 ou 5012.
-    Voir <xref
-    linkend="vboxmanage-modifyvm-vrde" /> pour des détails.</para>
-
-    <para>Vous pouvez savoir le port utilisé au final par une VM en fonction
-    avec la commande <computeroutput>VBoxManage showvminfo</computeroutput>,
-    vous pouvez aussi le voir dans l'interface graphique sous l'onglet "En cours
-    d'exécution" de la "Boîte de dialogue d'informations sur la session", accessible
-    depuis le menu "Machine" de la fenêtre de la VM.</para>
-
-    <para>Le support d'IPv6 a été implémenté dans VirtualBox 4.3. Si l'OS hôte
-    supporte l'IPv6, le serveur VRDP écoutera automatiquement les connexions IPv6
-    en plus de celles IPv4.</para>
-
-    <para>Par défaut, le serveur VRDP utilise  le port TCP
-    <computeroutput>3389</computeroutput>. Vous devrez modifier le port par
-    défaut si vous exécutez plus d'un serveur VRDP, vu que le port ne peut être
-    utilisé que par un serveur à la fois. Il se pourrait aussi que vous deviez
-    le modifier sur les hôtes Windows car le port par défaut pourrait être
-    déjà utilisé par le serveur RDP
-    intégré à Windows lui-même. Les ports 5000 à 5050 sont le plus souvent
-    inusités et pourraient être un bon choix.</para>
-
-    <para>Vous pouvez modifier le port soit dans les paramètres "Affichage" d5
+    <para>Vous pouvez modifier le port soit dans les paramètres "Affichage" de
     l'interface graphique, soit via l'option <computeroutput>--vrdeport</computeroutput>
     de la commande <computeroutput>VBoxManage modifyvm</computeroutput>. Vous
     pouvez indiquer une liste séparée par des virgules de ports ou de plages de
@@ -106,9 +75,9 @@
     <sect2 id="rdp-viewers">
       <title>Visualiseurs RDP tiers classiques</title>
 
-      <para>Comme VRDP est rétro-compatiblavec RDP, vous pouvez utiliser n'importe
+      <para>Comme VRDP est rétro-compatible avec RDP, vous pouvez utiliser n'importe
       quel visualiseur RDP standard pour vous connecter à une machine virtuelle
-      distante (des exemples arrivent ci-dessous). Pour que cela fonctionne, vous
+      distante (des exemples figurent ci-dessous). Pour que cela fonctionne, vous
       devez spécifier <emphasis role="bold">l'adresse IP</emphasis> de votre
       système <emphasis>hôte</emphasis> (pas celle de la machine virtuelle&#xA0;!)
       l'adresse du serveur auquel se connecter, ainsi que le 
@@ -138,8 +107,8 @@
               adresses <computeroutput>localhost</computeroutput> et
               <computeroutput>127.0.0.1</computeroutput> pourraient ne pas
               fonctionner en utilisant 
-              <computeroutput>mstsc.exe</computeroutput>. Par contre, l'adresse
-              <computeroutput>127.0.0.2[:3389]</computeroutput> doit être utilisée.</para>
+              <computeroutput>mstsc.exe</computeroutput>. L'adresse
+              <computeroutput>127.0.0.2[:3389]</computeroutput> doit être utilisée à la place.</para>
             </note>
           </listitem>
 
@@ -259,7 +228,7 @@
     <sect2>
       <title>Pas à pas&#xA0;: créer une machine virtuelle sur un serveur headless</title>
 
-      <para>Les instructions suivantes peuvent vous donner une idçe de la façon
+      <para>Les instructions suivantes peuvent vous donner une idée de la façon
       de créer une machine virtuelle sur un serveur headless via une connexion
       réseau. Nous allons créer une machine virtuelle, établir une connexion RDP
       et installer un système d'exploitation invité -- tout ceci sans devoir
@@ -308,14 +277,14 @@
             <computeroutput>--ostype</computeroutput>, mais en le faisant, cela
             sélectionne des valeurs par défaut apropriées pour certains paramètres
             de la VM, par exemple la taille de la RAM et le type de périphérique
-            réseau virtuel. Pour avoir la liste complète des szstèmes d'exploitation
+            réseau virtuel. Pour avoir la liste complète des systèmes d'exploitation
             supportés, vous pouvez utiliser</para>
 
             <screen>VBoxManage list ostypes</screen>
           </listitem>
 
           <listitem>
-            <para>Assurez-vous que les paramètres de la VM sont adaptés au szstème
+            <para>Assurez-vous que les paramètres de la VM sont adaptés au système
             d'exploitation invité que nous allons installer. Par exemple&#xA0;:<screen>VBoxManage modifyvm "Windows XP" --memory 256 --acpi on --boot1 dvd --nic1 nat</screen></para>
           </listitem>
 
@@ -353,7 +322,7 @@
           <listitem>
             <para>Sur la machine client, ouvrez le visualiseur RDP et essayez
             de vous connecter au serveur (voir <xref linkend="rdp-viewers" /> 
-            ci-d:ssus pour voir comment utiliser les divers visualiseurs RDP
+            ci-dessus pour voir comment utiliser les divers visualiseurs RDP
             classiques).</para>
 
             <para>Vous devriez voir maintenant le processus d'installation 
@@ -366,10 +335,10 @@
       <title>USB distant</title>
 
       <para>Une fonction très spéciale du support VRDP de VirtualBox est qu'il
-      supporte les périphériques USB distantségalement via le réseau. C'est-à-dire que 
+      supporte les périphériques USB distants également via le réseau. C'est-à-dire que 
       l'invité de VirtualBox en fonction sur l'ordinateur peut accéder à des
       périphériques USB de l'ordinateur distant sur lequel sont affichées les données
-      VRDP de la même manière que des périphériques USB connectàs à l'hôte actuel.
+      VRDP de la même manière que des périphériques USB connectés à l'hôte actuel.
       Cela permet d'exécuter des machines virtuelles sur un hôte VirtualBox qui
       agit comme serveur, où un client peut se connecter de n'importe où avec 
       simplement un adaptateur réseau et un dispositif d'affichage capable de
@@ -378,11 +347,11 @@
 
       <para>Pour ces périphériques USB distants, les mêmes règles de filtres
       s'appliquent, comme pour d'autres périphériques USB, comme décrit au
-      <xref linkend="settings-usb" />. Tout ce que vous dev5z faire est de spécifier
+      <xref linkend="settings-usb" />. Tout ce que vous devez faire est de spécifier
       "Remote" (ou "Any") en définissant ces règles.</para>
 
       <para>L'accès à des périphériques USB n'est possible que si le client RDP
-      supporte cette extension. Sur les hîtes Linux et Solaris, l'installation
+      supporte cette extension. Sur les hôtes Linux et Solaris, l'installation
       de VirtualBox fournit un client VRDP convenable appelé 
       <computeroutput>rdesktop-vrdp</computeroutput>. Les versions récentes de
       <computeroutput>uttsc</computeroutput>, un client taillé pour être utilisé
@@ -392,13 +361,11 @@
 
       <para>Pour rendre disponible un périphérique USB distant pour une VM, vous
       devriez démarrer <computeroutput>rdesktop-vrdp</computeroutput> comme
-      suit&#xA0;:<screen>rdesktop-vrdp -r usb -a 16 -N my.host.address</screen>Remarquez
-      que <computeroutput>rdesktop-vrdp</computeroutput> ne peut accéder à des
-      pçriphériques USB que par <computeroutput>/proc/bus/usb</computeroutput>.
+      suit :<screen>rdesktop-vrdp -r usb -a 16 -N my.host.address</screen>
       Merci de vous reporter au <xref linkend="ts_usb-linux" /> pour des
-      détails supplémentaires sur la manière de régler correctement les droits.
-      De plus, il est conseillé de désactiver le chargement automatique d'un pilote
-      ce l'hôte, sur l'hôte distant, qui pourrait fonctionner sur des périphériques
+      détails supplémentaires sur la manière de régler correctement les droits
+      des périphériques USB. De plus, il est conseillé de désactiver le chargement automatique d'un pilote
+      de l'hôte, depuis l'hôte distant qui serait lu sur des périphériques
       USB, pour vous assurer que les périphériques seront accessibles au client
       RDP. Si vous avez bien fait le paramétrage sur l'hôte distant, les
       événements de branchement/débranchement sont visibles dans le fichier
@@ -470,8 +437,8 @@
                   <computeroutput>VBoxAuthSimple</computeroutput> réalise
                   l'authentification à partir des autorisations configurées
                   dans la section "extradata" du fichier XML des paramètres d'une machine
-                  virtuelle. C'est probablement la méthode la plus simple de
-                  s'authentifier, qui ne dépend pas de l'invité en fonction et
+                  virtuelle. C'est probablement la méthode la plus simple pour
+                  s'authentifier, qui ne dépend pas d'un invité en fonction et
                   supporté (voir ci-dessous). Les étapes suivantes sont
                   nécessaires&#xA0;:<orderedlist>
                       <listitem>
@@ -484,10 +451,10 @@
 
                       <listitem>
                         <para>Pour activer la bibliothèque pour une VM en particulier,
-                        vous devez passer en authentification externe&#xA0;:<screen>VBoxManage modifyvm <vm> --vrdeauthtype external</screen></para>
+                        vous devez passer en authentification externe&#xA0;:<screen>VBoxManage modifyvm "nom VM" --vrdeauthtype external</screen></para>
 
                         <para>Remplacez
-                        <computeroutput><vm></computeroutput> par le nom
+                        <computeroutput>"nom VM"</computeroutput> par le nom
                         ou l'UUID de la VM.</para>
                       </listitem>
 
@@ -498,7 +465,7 @@
                         de la machine, dans lequel il faut écrire le mot de
                         passe à la section "extradata", est un fichier en texte
                         brut, VirtualBox utilise le hachage pour chiffrer les
-                        mots de passe. Il faut utiliser la commande suivante&#xA0;:<screen>VBoxManage setextradata <vm> "VBoxAuthSimple/users/<utilisateur>" <hash></screen></para>
+                        mots de passe. Il faut utiliser la commande suivante&#xA0;:<screen>VBoxManage setextradata "nom VM" "VBoxAuthSimple/users/<utilisateur>" <hash></screen></para>
 
                         <para>Remplacez
                         <computeroutput><vm></computeroutput> par le nom
@@ -569,7 +536,7 @@
             <para>L'authentification RDP5.1 utilise un certificat serveur pour
             lequel le client possède la clé publique. De cette façon, vous avez la
             garantie que le serveur possède la clé privée correspondante. Cependant,
-            comme cette clé privée codée en dur a çté publiçe il y a quelques
+            comme cette clé privée codée en dur a été publiée il y a quelques
             années, l'authentification RDP5.1 n'est pas sécurisée.</para>
           </listitem>
 
@@ -649,7 +616,7 @@ openssl req -new -key server_key_private.pem -out server_req.pem</screen>
 
       <para>Comme le client qui se connecte au serveur détermine le type de chiffrement
       qui sera utilisé, avec rdesktop, le visualiseur RDP de Linux, utilisez
-      lq options <computeroutput>-4</computeroutput> ou
+      les options <computeroutput>-4</computeroutput> ou
       <computeroutput>-5</computeroutput>.</para>
     </sect2>
 
@@ -685,7 +652,7 @@ openssl req -new -key server_key_private.pem -out server_req.pem</screen>
       <computeroutput>domaine\nom_utilisateur</computeroutput> dans le champ
       <computeroutput>Nom d'utilisateur :</computeroutput> -- par exemple, 
       <computeroutput>@2\name</computeroutput>.
-      <computeroutput>nom</computeroutput> doit être remteigné et il doit être
+      <computeroutput>nom</computeroutput> doit être renseigné et il doit être
       le nom utilisé pour vous identifier si le serveur VRDP est configuré pour
       demander une autorisation. Sinon, vous pouvez utiliser n'importe quel texte 
       comme nom d'utilisateur.</para>
@@ -712,11 +679,11 @@ openssl req -new -key server_key_private.pem -out server_req.pem</screen>
       client ne supporte pas la redirection graphique, le serveur VRDP se rabat
       sur le rafraîchissement régulier des bitmap.</para>
 
-      <para>La commande suivnte active la redirection graphique&#xA0;: <screen>VBoxManage modifyvm "nom VM" --vrdevideochannel on</screen></para>
+      <para>La commande suivante active la redirection graphique&#xA0;: <screen>VBoxManage modifyvm "nom VM" --vrdevideochannel on</screen></para>
 
       <para>La qualité de l'image se définit par une valeur entre 10 et 100
       pour cent, ce qui représente un niveau de compression JPEG (où les nombres
-      les plus bas signifient des qualité plus faibles mais une compression plus
+      les plus bas signifient une qualité plus faibles mais une compression plus
       forte). Vous pouvez modifier la qualité en utilisant la commande suivante&#xA0;:
       <screen>VBoxManage modifyvm "nom VM" --vrdevideochannelquality 75</screen></para>
     </sect2>
@@ -769,7 +736,7 @@ VBoxManage setextradata "nom VM" "VRDP/Feature/Client/DisableClipboard" 1</scree
     hôte, qu'on appelle alors la <emphasis role="bold">"source"</emphasis>.
     L'hôte sur lequel la machine virtuelle sera téléportée s'appellera alors la
     <emphasis role="bold">"cible"</emphasis>&#xA0;; la machine sur la cible est
-    alors configurée pour attendre la source afin de contacter la cible.
+    alors configurée pour attendre que la source la contacte.
     L'état en fonction de la machine sera transféré de la source à la cible en
     un temps nimimum.</para>
 
@@ -803,9 +770,9 @@ VBoxManage setextradata "nom VM" "VRDP/Feature/Client/DisableClipboard" 1</scree
 
     <para>Puis, suivez les étapes suivantes&#xA0;:<orderedlist>
         <listitem>
-          <para>Sur l'hôte <emphasis>cible</emphasis>, configurez lamachine 
-          virtuelle pour attendre qu'une demande de téléportation n'arrive quand
-          elle sera démarrée, plutôt que pour essayer de démarrer la machine.
+          <para>Sur l'hôte <emphasis>cible</emphasis>, configurez la machine 
+          virtuelle pour attendre qu'une demande de téléportation arrive quand
+          elle sera démarrée, plutôt que d'essayer de démarrer réellement la machine.
           Cela se fait avec la commande VBoxManage suivante&#xA0;:<screen>VBoxManage modifyvm <nomvmcible> --teleporter on --teleporterport <port></screen></para>
 
           <para>où <computeroutput><nomvmcible></computeroutput> est le
@@ -830,22 +797,22 @@ VBoxManage setextradata "nom VM" "VRDP/Feature/Client/DisableClipboard" 1</scree
           <para>où <computeroutput><nomvmsource></computeroutput> est le
           nom de la machine (irtuelle sur l'hôte source (la machine actuellement en
           fonction) et <computeroutput><hôtecible></computeroutput> est
-          le nom ou l'IP de l'hôte cible où une demande de télémrrtation par la
+          le nom ou l'IP de l'hôte cible où une demande de téléportation par la
           machine est attendue, et <computeroutput><port></computeroutput>
-          doit être le même numéro que celui spécifié dans lacommande sur l'hôte
+          doit être le même numéro que celui spécifié dans la commande sur l'hôte
           cible. Pour les détails, voir <xref
           linkend="vboxmanage-controlvm" />.</para>
         </listitem>
       </orderedlist></para>
 
     <para>Pour tester, vous pouvez aussi téléporter des machines sur le même hôte&#xA0;;
-    dans ce cas, utilisez "localhost" comme nom d'hôte sur l'hôte sourd et
+    dans ce cas, utilisez "localhost" comme nom d'hôte sur l'hôte source et
     cible.<note>
         <para>Dans de rares cas, si les processeurs de la source et de la cible
         sont très différents, la téléportation peut échouer avec un message d'erreur
         ou la cible peut planter. Cela peut arriver surtout si la VM exécute des
         logiciels très optimisés pour fonctionner sur un processeur particulier 
-        sans vérifier correctement que les certaines fonctions du processeur sont
+        sans vérifier correctement que certaines fonctions du processeur sont
         bien présentes. VirtualBox filtre les capacités du processeur présenté 
         au système d'exploitation invité. Les utilisateurs avancés peuvent essayer de
         restreindre les possibilités de ces processeurs virtuels avec la commande
diff --git a/doc/manual/fr_FR/user_Glossary.xml b/doc/manual/fr_FR/user_Glossary.xml
index 26bc080..570f24e 100644
--- a/doc/manual/fr_FR/user_Glossary.xml
+++ b/doc/manual/fr_FR/user_Glossary.xml
@@ -9,11 +9,11 @@
       <glossterm>ACPI</glossterm>
 
       <glossdef>
-        <para>Advanced Configuration and Power Interface, an industry
-        specification for BIOS and hardware extensions to configure PC
-        hardware and perform power management. Windows 2000 and higher as well
-        as Linux 2.4 and higher support ACPI. Windows can only enable or
-        disable ACPI support at installation time.</para>
+        <para>Advanced Configuration and Power Interface, une
+        spécification de l'industrie pour BIOS et extensions matérielles pour configurer
+        le matériel PC et gérer l'alimentation. Windows 2000 et ultérieur ainsi que
+        Linux 2.4 et ultérieur supportent ACPI. Windows ne peut activer/désactiver
+        le support ACPI qu'à l'installation.</para>
       </glossdef>
     </glossentry>
 
@@ -21,8 +21,8 @@
       <glossterm>AHCI</glossterm>
 
       <glossdef>
-        <para>Advanced Host Controller Interface, the interface that supports
-        SATA devices such as hard disks. See <xref
+        <para>Advanced Host Controller Interface, l'interface qui supporte
+        les périphériques SATA tel que les disques durs. Voir <xref
         linkend="harddiskcontrollers" />.</para>
       </glossdef>
     </glossentry>
@@ -31,8 +31,8 @@
       <glossterm>AMD-V</glossterm>
 
       <glossdef>
-        <para>The hardware virtualization features built into modern AMD
-        processors. See <xref linkend="hwvirt" />.</para>
+        <para>La capacité de virtualisation matérielle implémentée dans les
+        processeurs AMD récents. Voir <xref linkend="hwvirt" />.</para>
       </glossdef>
     </glossentry>
 
@@ -48,13 +48,13 @@
       <glossterm>APIC</glossterm>
 
       <glossdef>
-        <para>Advanced Programmable Interrupt Controller, a newer version of
-        the original PC PIC (programmable interrupt controller). Most modern
-        CPUs contain an on-chip APIC ("local APIC"). Many systems also contain
-        an I/O APIC (input output APIC) as a separate chip which provides more
-        than 16 IRQs. Windows 2000 and higher use a different kernel if they
-        detect an I/O APIC during installation. Therefore an I/O APIC must not
-        be removed after installation.</para>
+        <para>Advanced Programmable Interrupt Controller, une version plus récente
+        de l'ancienne PIC (programmable interrupt controller). La plupart des
+        CPUs récents incorporent un APIC ("local APIC"). Beaucoup de systèmes intègrent
+        aussi un I/O APIC (input output APIC) dans une puce à part qui fournit plus de
+        16 IRQs. Windows 2000 et ultérieur utilise un noyau différent si il est 
+        détecté un I/O APIC à l'installation. De ce fait un I/O APIC ne doit pas être
+        supprimé après l'installation.</para>
       </glossdef>
     </glossentry>
 
@@ -62,8 +62,8 @@
       <glossterm>ATA</glossterm>
 
       <glossdef>
-        <para>Advanced Technology Attachment, an industry standard for hard
-        disk interfaces (synonymous with IDE). See <xref
+        <para>Advanced Technology Attachment, un standard de l'industrie pour les
+        interfaces de disques durs (synonyme de IDE). Voir <xref
         linkend="harddiskcontrollers" />.</para>
       </glossdef>
     </glossentry>
@@ -76,11 +76,11 @@
       <glossterm>BIOS</glossterm>
 
       <glossdef>
-        <para>Basic Input/Output System, the firmware built into most personal
-        computers which is responsible of initializing the hardware after the
-        computer has been turned on and then booting an operating system.
-        VirtualBox ships with its own virtual BIOS that runs when a virtual
-        machine is started.</para>
+        <para>Basic Input/Output System, le firmware intégré à la plupart des ordinateurs
+        personnels qui est chargé d'initialiser le matériel après que la machine
+        ait été allumée et qui alors démarre le système d'exploitation.
+        VirtualBox est livré avec son propre BIOS virtuel qui se lance quand une
+        machine est démarrée.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -92,12 +92,12 @@
       <glossterm>COM</glossterm>
 
       <glossdef>
-        <para>Microsoft Component Object Model, a programming infrastructure
-        for modular software. COM allows applications to provide application
-        programming interfaces which can be accessed from various other
-        programming languages and applications. VirtualBox makes use of COM
-        both internally and externally to provide a comprehensive API to 3rd
-        party developers.</para>
+        <para>Microsoft Component Object Model, une infrastructure de programmation
+        pour logiciels modulaires. COM permet aux applications de fournir une interface
+        de programmation qui peut être accédée depuis divers autres langages de
+        programmation et applications. VirtualBox utilise COM en interne et
+        en externe pour fournir une API complète aux développeurs externes
+        .</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -109,12 +109,12 @@
       <glossterm>DHCP</glossterm>
 
       <glossdef>
-        <para>Dynamic Host Configuration Protocol. This allows a networking
-        device in a network to acquire its IP address (and other networking
-        details) automatically, in order to avoid having to configure all
-        devices in a network with fixed IP addresses. VirtualBox has a
-        built-in DHCP server that delivers an IP addresses to a virtual
-        machine when networking is configured to NAT; see <xref
+        <para>Dynamic Host Configuration Protocol. Ceci donne la faculté à un périphérique
+        de réseau d'obtenir automatiquement son adresse IP (et autres informations du réseau)
+        , afin d'éviter d'avoir à configurer tous les périphériques
+        d'un réseau avec des adresses IP fixes. VirtualBox a un serveur
+        DHCP incorporé qui octroie une adresse IP à une machine virtuelle
+        quand le réseau est configuré en mode NAT&#xA0;; voir <xref
         linkend="networkingdetails" />.</para>
       </glossdef>
     </glossentry>
@@ -123,8 +123,8 @@
       <glossterm>DKMS</glossterm>
 
       <glossdef>
-        <para>Dynamic Kernel Module Support. A framework that simplifies
-        installing and updating external kernel modules on Linux machines; see
+        <para>Dynamic Kernel Module Support. Un environnement qui simplifie
+        l'installation et la mise à jour des modules externes de noyau sur les machines Linux&#xA0;; voir
         <xref linkend="externalkernelmodules" />.</para>
       </glossdef>
     </glossentry>
@@ -137,10 +137,10 @@
       <glossterm>EFI</glossterm>
 
       <glossdef>
-        <para>Extensible Firmware Interface, a firmware built into computers
-        which is designed to replace the aging BIOS. Originally designed by
-        Intel, most modern operating systems can now boot on computers which
-        have EFI instead of a BIOS built into them; see <xref
+        <para>Extensible Firmware Interface, un firmware intégré aux ordinateurs
+        qui a pour but de remplacer le BIOS dépassé. À l'origine conçu par
+        Intel, la plupart des systèmes peuvent maintenant démarrer une machine qui
+        a EFI au lieu de BIOS&#xA0;; voir <xref
         linkend="efi" />.</para>
       </glossdef>
     </glossentry>
@@ -149,8 +149,8 @@
       <glossterm>EHCI</glossterm>
 
       <glossdef>
-        <para>Enhanced Host Controller Interface, the interface that
-        implements the USB 2.0 standard.</para>
+        <para>Enhanced Host Controller Interface, l'interface qui
+        implémente l'USB 2.0 standard.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -162,12 +162,12 @@
       <glossterm>GUI</glossterm>
 
       <glossdef>
-        <para>Graphical User Interface. Commonly used as an antonym to a
-        "command line interface", in the context of VirtualBox, we sometimes
-        refer to the main graphical
-        <computeroutput>VirtualBox</computeroutput> program as the "GUI", to
-        differentiate it from the <computeroutput>VBoxManage</computeroutput>
-        interface.</para>
+        <para>Graphical User Interface. Communément employé en opposition à 
+        "interface en ligne de commande", dans le contexte VirtualBox, nous nous
+        référons au programme graphique principal de
+        <computeroutput>VirtualBox</computeroutput> en tant que "GUI", pour le
+        différencier de l'interface <computeroutput>VBoxManage</computeroutput>
+        .</para>
       </glossdef>
     </glossentry>
 
@@ -175,7 +175,7 @@
       <glossterm>GUID</glossterm>
 
       <glossdef>
-        <para>See UUID.</para>
+        <para>Voir UUID.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -187,8 +187,8 @@
       <glossterm>IDE</glossterm>
 
       <glossdef>
-        <para>Integrated Drive Electronics, an industry standard for hard disk
-        interfaces. See <xref linkend="harddiskcontrollers" />.</para>
+        <para>Integrated Drive Electronics, un standard de l'industrie pour une interface
+        de disque dur. Voir <xref linkend="harddiskcontrollers" />.</para>
       </glossdef>
     </glossentry>
 
@@ -196,7 +196,7 @@
       <glossterm>I/O APIC</glossterm>
 
       <glossdef>
-        <para>See APIC.</para>
+        <para>Voir APIC.</para>
       </glossdef>
     </glossentry>
 
@@ -204,7 +204,7 @@
       <glossterm>iSCSI</glossterm>
 
       <glossdef>
-        <para>Internet SCSI; see <xref linkend="storage-iscsi" />.</para>
+        <para>Internet SCSI; voir <xref linkend="storage-iscsi" />.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -216,10 +216,9 @@
       <glossterm>MAC</glossterm>
 
       <glossdef>
-        <para>Media Access Control, a part of an Ethernet network card. A MAC
-        address is a 6-byte number which identifies a network card. It is
-        typically written in hexadecimal notation where the bytes are
-        separated by colons, such as
+        <para>Media Access Control, un élément d'une carte Ethernet. Une adresse MAC
+        est un nombre de 6 octets qui identifie une carte réseau. C'est typiquement
+        écrit en héxadecimal où les octets sont séparés par ":", tel que
         <computeroutput>00:17:3A:5E:CB:08</computeroutput>.</para>
       </glossdef>
     </glossentry>
@@ -228,12 +227,12 @@
       <glossterm>MSI</glossterm>
 
       <glossdef>
-        <para>Message Signaled Interrupts, as supported by modern chipsets
-        such as the ICH9; see <xref linkend="settings-motherboard" />. As
-        opposed to traditional pin-based interrupts, with MSI, a small amount
-        of data can accompany the actual interrupt message. This reduces the
-        amount of hardware pins required, allows for more interrupts and
-        better performance.</para>
+        <para>Message Signaled Interrupts, supporté par les circuits récents
+        tel que le ICH9; voir <xref linkend="settings-motherboard" />.
+        Contrairement aux traditionnelles interruptions pin-based, avec MSI, une petite
+        quantité de données peut accompagner le véritable message d'interruption. Ceci réduit la
+        quantité requise de broches sur le matériel, permet plus d'interruptions avec de 
+        meilleures performances.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -245,12 +244,12 @@
       <glossterm>NAT</glossterm>
 
       <glossdef>
-        <para>Network Address Translation. A technique to share networking
-        interfaces by which an interface modifies the source and/or target IP
-        addresses of network packets according to specific rules. Commonly
-        employed by routers and firewalls to shield an internal network from
-        the Internet, VirtualBox can use NAT to easily share a host's physical
-        networking hardware with its virtual machines. See <xref
+        <para>Network Address Translation. Une technique pour partager les interfaces
+        réseau par laquelle une interface modifie l'adresse IP source et/ou cible
+        des paquets réseau selon des règles spécifiques. Couramment
+        employé par routeurs et pare-feux pour séparer un réseau interne
+        de l'Internet, VirtualBox peut utiliser NAT pour facilement partager un équipement réseau
+        physique de l'hôte avec ses machines virtuelles. Voir <xref
         linkend="network_nat" />.</para>
       </glossdef>
     </glossentry>
@@ -263,8 +262,8 @@
       <glossterm>OVF</glossterm>
 
       <glossdef>
-        <para>Open Virtualization Format, a cross-platform industry standard
-        to exchange virtual appliances between virtualization products; see
+        <para>Open Virtualization Format, un standard de l'industrie inter-platforme
+        pour échanger des briques logicielles virtuelles entre produits de virtualisation; voir
         <xref linkend="ovf" />.</para>
       </glossdef>
     </glossentry>
@@ -277,8 +276,8 @@
       <glossterm>PAE</glossterm>
 
       <glossdef>
-        <para>Physical Address Extension. This allows accessing more than 4 GB
-        of RAM even in 32-bit environments; see <xref
+        <para>Physical Address Extension. Ceci permet l'accès à plus de 4 GB
+        de RAM même en environnement 32-bit&#xA0;; voir <xref
         linkend="settings-general-advanced" />.</para>
       </glossdef>
     </glossentry>
@@ -287,7 +286,7 @@
       <glossterm>PIC</glossterm>
 
       <glossdef>
-        <para>See APIC.</para>
+        <para>Voir APIC.</para>
       </glossdef>
     </glossentry>
 
@@ -295,11 +294,11 @@
       <glossterm>PXE</glossterm>
 
       <glossdef>
-        <para>Preboot Execution Environment, an industry standard for booting
-        PC systems from remote network locations. It includes DHCP for IP
-        configuration and TFTP for file transfer. Using UNDI, a hardware
-        independent driver stack for accessing the network card from bootstrap
-        code is available.</para>
+        <para>Preboot Execution Environment, un standard de l'industrie pour démarrer
+        des systèmes PC à distance. Cela inclue DHCP pour la configuration IP
+        et TFTP pour le transfert de fichier. Avec UNDI, est disponible une pile de pilote de matériel
+        indépendant pour accéder la carte réseau par le code d'amorce
+        .</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -311,16 +310,15 @@
       <glossterm>RDP</glossterm>
 
       <glossdef>
-        <para>Remote Desktop Protocol, a protocol developed by Microsoft as an
-        extension to the ITU T.128 and T.124 video conferencing protocol. With
-        RDP, a PC system can be controlled from a remote location using a
-        network connection over which data is transferred in both directions.
-        Typically graphics updates and audio are sent from the remote machine
-        and keyboard and mouse input events are sent from the client. A
-        VirtualBox extension package by Oracle provides VRDP, an enhanced
-        implementation of the relevant standards which is largely compatible
-        with Microsoft's RDP implementation. See <xref linkend="vrde" /> for
-        details.</para>
+        <para>Remote Desktop Protocol, un protocole développé par Microsoft en
+        extension des protocoles ITU T.128 et T.124 de vidéo conference. Avec
+        RDP, un système PC peut être contrôllé à distance en utilisant une connection
+        réseau à travers laquelle les données sont transférées dans les 2 directions.
+        Typiquement les événements graphiques et audio sont envoyés depuis la machine à distance
+        et les événements clavier et souris sont envoyés depuis le client. Un paquet d'extension
+        VirtualBox d'Oracle fournit VRDP, une implementation améliorée du standard approprié qui est
+        largement compatible avec le RDP Microsoft. Voir <xref linkend="vrde" /> pour le
+        detail.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -332,8 +330,8 @@
       <glossterm>SAS</glossterm>
 
       <glossdef>
-        <para>Serial Attached SCSI, an industry standard for hard disk
-        interfaces. See <xref linkend="harddiskcontrollers" />.</para>
+        <para>Serial Attached SCSI, un standard de l'industrie pour les interfaces
+        de disques durs. Voir <xref linkend="harddiskcontrollers" />.</para>
       </glossdef>
     </glossentry>
 
@@ -341,7 +339,7 @@
       <glossterm>SATA</glossterm>
 
       <glossdef>
-        <para>Serial ATA, an industry standard for hard disk interfaces. See
+        <para>Serial ATA, un standard de l'industrie pour les interfaces de disques durs. Voir
         <xref linkend="harddiskcontrollers" />.</para>
       </glossdef>
     </glossentry>
@@ -350,8 +348,8 @@
       <glossterm>SCSI</glossterm>
 
       <glossdef>
-        <para>Small Computer System Interface. An industry standard for data
-        transfer between devices, especially for storage. See <xref
+        <para>Small Computer System Interface. Un standard de l'industrie pour
+        le transfer de données entre périphériques, de stockage particulièrement. Voir <xref
         linkend="harddiskcontrollers" />.</para>
       </glossdef>
     </glossentry>
@@ -360,10 +358,10 @@
       <glossterm>SMP</glossterm>
 
       <glossdef>
-        <para>Symmetrical Multiprocessing, meaning that the resources of a
-        computer are shared between several processors. These can either be
-        several processor chips or, as is more common with modern hardware,
-        multiple CPU cores in one processor.</para>
+        <para>Symmetrical Multiprocessing, indique que les ressources d'une
+        machine sont partagées entre différents processeurs. Ceci peut être soit
+        plusieurs puces processeur ou, le plus courant dans le matériel récent,
+        plusieurs coeurs CPU dans le processeur.</para>
       </glossdef>
     </glossentry>
 
@@ -371,9 +369,9 @@
       <glossterm>SSD</glossterm>
 
       <glossdef>
-        <para>Solid-state drive, uses microchips for storing data in a computer
-        system. Compared to classical hard-disks they are having no mechanical
-        components like spinning disks.
+        <para>Solid-state drive, utilise des micropuces pour stocker les données système d'une
+        machine. Comparé aux classiquex disques durs ils n'ont pas de composants mécaniques
+        comme les plateaux tournants.
         </para>
       </glossdef>
     </glossentry>
@@ -386,11 +384,11 @@
       <glossterm>TAR</glossterm>
 
       <glossdef>
-        <para>A widely used file format for archiving. Originally, this stood
-        for "Tape ARchive" and was already supported by very early Unix
-        versions for backing up data on tape. The file format is still widely
-        used today, for example, with OVF archives (with an
-        <computeroutput>.ova</computeroutput> file extension); see <xref
+        <para>Un format de fichier largement répandu pour l'archivage. À l'origine
+        pour "Tape ARchive", était déjà supporté par les premières versions d'Unix
+        pour sauvegarder les données sur bande. Le format de fichier est toujours largement
+        utilisé, par exemple, avec les archives OVF (avec l'extension de fichier
+        <computeroutput>.ova</computeroutput>)&#xA0;; voir <xref
         linkend="ovf" />.</para>
       </glossdef>
     </glossentry>
@@ -403,12 +401,12 @@
       <glossterm>UUID</glossterm>
 
       <glossdef>
-        <para>A Universally Unique Identifier -- often also called GUID
-        (Globally Unique Identifier) -- is a string of numbers and letters
-        which can be computed dynamically and is guaranteed to be unique.
-        Generally, it is used as a global handle to identify entities.
-        VirtualBox makes use of UUIDs to identify VMs, Virtual Disk Images
-        (VDI files) and other entities.</para>
+        <para>Un identifiant unique universel (Universally Unique Identifier) -- souvent aussi appelé GUID
+        (Globally Unique Identifier) -- est une chaîne de nombres et lettres
+        qui peut être calculée dynamiquement et qui garantie son unicité.
+        En général, c'est utilisé comme un identifiant global d'un composant.
+        VirtualBox emploie les UUIDs pour identifier les VMs, les images de disque virtuel
+        (fichiers VDI) et autres composants.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -420,9 +418,9 @@
       <glossterm>VM</glossterm>
 
       <glossdef>
-        <para>Virtual Machine -- a virtual computer that VirtualBox allows you
-        to run on top of your actual hardware. See <xref
-        linkend="virtintro" /> for details.</para>
+        <para>Machine virtuelle -- un ordinateur virtuel que VirtualBox fait tourner
+        dans la véritable machine. Voir <xref
+        linkend="virtintro" /> pour le detail.</para>
       </glossdef>
     </glossentry>
 
@@ -430,9 +428,9 @@
       <glossterm>VMM</glossterm>
 
       <glossdef>
-        <para>Virtual Machine Manager -- the component of VirtualBox that
-        controls VM execution. See <xref linkend="technical-components" /> for
-        a list of VirtualBox components.</para>
+        <para>Virtual Machine Manager -- le composant de VirtualBox qui
+        contrôle l'exécution des VMs. Voir <xref linkend="technical-components" /> pour
+        une liste de composants VirtualBox.</para>
       </glossdef>
     </glossentry>
 
@@ -440,11 +438,11 @@
       <glossterm>VRDE</glossterm>
 
       <glossdef>
-        <para>VirtualBox Remote Desktop Extension. This interface is built
-        into VirtualBox to allow VirtualBox extension packages to supply
-        remote access to virtual machines. A VirtualBox extension package by
-        Oracle provides VRDP support; see <xref linkend="vrde" /> for
-        details.</para>
+        <para>VirtualBox Remote Desktop Extension. Cette interface est intégrée
+        à VirtualBox pour permettre aux paquets d'extension VirtualBox de fournir
+        aux machines virtuelles un accès à distance. Un paquet d'extension de VirtualBox
+        d'Oracle implémente VRDP; voir <xref linkend="vrde" /> pour le
+        detail.</para>
       </glossdef>
     </glossentry>
 
@@ -452,7 +450,7 @@
       <glossterm>VRDP</glossterm>
 
       <glossdef>
-        <para>See RDP.</para>
+        <para>Voir RDP.</para>
       </glossdef>
     </glossentry>
 
@@ -460,8 +458,8 @@
       <glossterm>VT-x</glossterm>
 
       <glossdef>
-        <para>The hardware virtualization features built into modern Intel
-        processors. See <xref linkend="hwvirt" />.</para>
+        <para>La capacité de virtualisation matérielle implémentée dans les processeurs Intel
+        récents. Voir <xref linkend="hwvirt" />.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
@@ -473,10 +471,10 @@
       <glossterm>XML</glossterm>
 
       <glossdef>
-        <para>The eXtensible Markup Language, a metastandard for all kinds of
-        textual information. XML only specifies how data in the document is
-        organized generally and does not prescribe how to semantically
-        organize content.</para>
+        <para>eXtensible Markup Language, un métastandard pour toute sorte
+        d'information textuelle. XML spécifie seulement comment les données dans un document sont
+        organisées en général et ne préscrit pas la manière d'organiser
+        le contenu sémantiquement.</para>
       </glossdef>
     </glossentry>
 
@@ -484,12 +482,12 @@
       <glossterm>XPCOM</glossterm>
 
       <glossdef>
-        <para>Mozilla Cross Platform Component Object Model, a programming
-        infrastructure developed by the Mozilla browser project which is
-        similar to Microsoft COM and allows applications to provide a modular
-        programming interface. VirtualBox makes use of XPCOM on Linux both
-        internally and externally to provide a comprehensive API to
-        third-party developers.</para>
+        <para>Mozilla Cross Platform Component Object Model, un environnement
+        de programmation développé par le projet de navigateur Mozilla qui est
+        similaire au COM de Microsoft et permet aux applications de fournir une interface
+        de programmation modulaire. VirtualBox emploie XPCOM sur Linux à la fois
+        en interne et en externe pour fournir une API complète aux développeurs
+        externes.</para>
       </glossdef>
     </glossentry>
   </glossdiv>
diff --git a/doc/manual/fr_FR/user_GuestAdditions.xml b/doc/manual/fr_FR/user_GuestAdditions.xml
index be852a3..e30f9e1 100644
--- a/doc/manual/fr_FR/user_GuestAdditions.xml
+++ b/doc/manual/fr_FR/user_GuestAdditions.xml
@@ -7,8 +7,8 @@
   <para>Le chapitre précédent traitait de la manière de commencer avec VirtualBox
   et d'installer des systèmes d'exploitation dans une machine virtuelle. Pour une
   utilisation interactive et sérieuse, les suppléments invité de VirtualBox vous
-  faciliteront beaucoup la vie, en offrant une intïgration approfondie entre
-  l'hôte et vinvité et en améliorant la performance d'interactivité des systèmes
+  faciliteront beaucoup la vie, en offrant une intégration approfondie entre
+  l'hôte et l'invité et en améliorant la performance d'interactivité des systèmes
   invités. Ce chapitre décrit en détail les suppléments invité.</para>
 
   <sect1>
@@ -16,7 +16,7 @@
 
     <para>Comme indiqué au <xref linkend="virtintro" />, les suppléments invité
     sont conçus pour s'installer <emphasis>à l'intérieur</emphasis> d'une
-    machine virtuelle après qu'un szstème d'exploitation a été installé. Il s'agit
+    machine virtuelle après qu'un système d'exploitation ait été installé. Il s'agit
     de pilotes de périphériques et d'applications système qui optimisent le
     système d'exploitation invité pour une meilleure performance et plus
     d'utilisabilité. Merci de voir <xref
@@ -40,10 +40,10 @@
             <xref linkend="keyb_mouse_normal" />, ceci vous offre un support
             de la souris transparent. Vous n'aurez qu'un pointeur de souris et
             l'appui sur la touche hôte n'est plus nécessaire pour "libérer" la
-            souris de sa captured par l'OS invité. Pour que cela fonctionne, un
-            pilote de souris spécial est installé dans vinvité pour communiquer
+            souris de sa capture par l'OS invité. Pour que cela fonctionne, un
+            pilote de souris spécial est installé dans l'invité pour communiquer
             avec le pilote de la "vraie" souris de votre hôte et il déplace le
-            pointeur de la souris de l'invité en consçquence.</para>
+            pointeur de la souris de l'invité en conséquence.</para>
           </glossdef>
         </glossentry>
 
@@ -56,7 +56,7 @@
             vous pouvez dire à VirtualBox de traiter un répertoire particulier
             de l'hôte comme un dossier partagé et VirtualBox le rendra disponible
             pour le système d'exploitation invité en tant que partage réseau,
-            que vinvité ait ou non un réseau. Pour les détails, merci de vous
+            que l'invité ait ou non un réseau. Pour les détails, merci de vous
             reporter à <xref
             linkend="sharedfolders" />.</para>
           </glossdef>
@@ -72,7 +72,7 @@
             invité vous offrent ces modes graphiques supplémentaires élevés et
             non standards ainsi qu'une performance graphique accélérée.</para>
 
-            <para>De plus, avec les invités Windows, Linux aet Solaris, vous
+            <para>De plus, avec les invités Windows, Linux et Solaris, vous
             pouvez redimensionner la fenêtre de la machine virtuelle si les suppléments
             invité sont installés. La résolution graphique de l'invité sera
             automatiquement ajustée (comme si vous aviez entré à la main une
@@ -107,16 +107,16 @@
             qu'on appelle les "propriétés invité" fournit un mécanisme générique
             à base de chaînes pour échanger des bits de données entre un invité
             et un hôte, certains d'entre eux ayant des significations spéciales
-            pour contrôler et surveiller l'inviténbsp;; voir
+            pour contrôler et surveiller l'invité&#xA0;; voir
             <xref linkend="guestadd-guestprops" /> pour les détails.</para>
 
-            <para>En outre, des applications peuvent être démarrées dans vinvité
+            <para>En outre, des applications peuvent être démarrées dans l'invité
             à partir de l'hôte&#xA0;; voir <xref linkend="guestadd-guestcontrol" />.</para>
           </glossdef>
         </glossentry>
 
         <glossentry>
-          <glossterm>Synchronization du temps</glossterm>
+          <glossterm>Synchronisation du temps</glossterm>
 
           <glossdef>
             <para>Quand les suppléments invité sont installés, VirtualBox peut
@@ -126,18 +126,18 @@
             <para>Pour plusieurs raisons, il se peut que l'horloge de l'invité 
             tourne à un rythme légèrement plus lent que celle de l'hôte. L'hôte
             pourrait recevoir des mises à jour par NTP et sa propre horloge 
-            pourrait ne pas tourner de manière rectiligne. Ude VM pourrait aussi
+            pourrait ne pas tourner de manière rectiligne. Une VM pourrait aussi
             être mise en pause, ce qui arrête le cours du temps dans l'invité 
-            sendant une durée plus ou moins longue. Quand le temps des horloges
+            pendant une durée plus ou moins longue. Quand le temps des horloges
             séparées entre l'invité et l'hôte ne diffère que légèrement, le service de
             synchronisation du temps essaie d'ajuster progressivement et
             doucement l'heure de l'invité, par petites accélérations, soit pour
-            "ratraper", soit pour "perdre" du temps. Quand la différence est trop
+            "rattraper", soit pour "perdre" du temps. Quand la différence est trop
             importante (par exemple si la VM a été mise en pause pendant des 
             heures puis restaurée d'un état sauvegardé), l'heure de l'invité est
             modifiée immédiatement sans ajustement progressif.</para>
 
-            <para>Les suppléments invité resynchroniseront vheure régulièrement.
+            <para>Les suppléments invité resynchroniseront l'heure régulièrement.
             Voir <xref linkend="changetimesync" /> pour savoir comment configurer
             les paramètres du mécanisme de synchronisation du temps.</para>
           </glossdef>
@@ -192,7 +192,7 @@
     décrivent en détail les spécificités de chaque variante.</para>
 
     <sect2 id="additions-windows">
-      <title>Suppléments invité pour for Windows</title>
+      <title>Suppléments invité pour Windows</title>
 
       <para>Les suppléments invité de VirtualBox pour Windows sont conçus
       pour s'installer dans une machine virtuelle exécutant un système d'exploitation
@@ -290,14 +290,14 @@
                 <listitem>
                   <para>Sur les hôtes Mac OS X, vous pouvez trouver ce fichier
                   dans le groupe de l'application VirtualBox. (Effectuez un clic
-                  droit sur l'icône de VirtualBox dans Chercheur et choisissez
+                  droit sur l'icône de VirtualBox dans Finder et choisissez
                   <emphasis>Afficher le contenu du paquet</emphasis>. S'y trouve
                   le fichier, dans le dossier
                   <computeroutput>Contents/MacOS</computeroutput>.)</para>
                 </listitem>
 
                 <listitem>
-                  <para>Sur un hôte Linux, vkus pouvez trouver ce fichier dans
+                  <para>Sur un hôte Linux, vous pouvez trouver ce fichier dans
                   le dossier
                   <computeroutput>additions</computeroutput> sous lequel vous avez
                   installé VirtualBox (normalement,
@@ -370,7 +370,7 @@
       </sect3>
 
       <sect3>
-        <title>Installation sans efforts</title>
+        <title>Installation silencieuse</title>
 
         <para>Avant d'effectuer une installation sans efforts des suppléments
         invité de VirtualBox sur un invité Windows, il doit y avoir absolument
@@ -518,7 +518,7 @@
         être d'au moins 128 Mo.</para></note>
 
         <para>Pour plus d'options concernant les installations d'invité sans efforts,
-        consultez l'aide en ligne de commande en utilisant l commande&#xA0;:</para>
+        consultez l'aide en ligne de commande en utilisant la commande&#xA0;:</para>
 
         <screen>VBoxWindowsAdditions.exe /?</screen>
       </sect3>
@@ -583,12 +583,12 @@
       dans ces distributions.</para>
 
       <para>Remarquez que certaines distributions Linux sont déjà fournies avec
-      tout ou partie des suppléments invité deVirtualBox. Vous pouvez choisir
+      tout ou partie des suppléments invité VirtualBox. Vous pouvez choisir
       de garder la version des suppléments invité de votre distribution, mais 
       ils sont souvent obsolètes et limités dans leurs fonctionnalités, donc nous
       recommandons de les remplacer par les
       suppléments invité fournis avec VirtualBox. L'installeur des suppléments 
-      invité de VirtualBox pour Linux essaie de détecter vinstallation existante
+      invité de VirtualBox pour Linux essaie de détecter l'installation existante
       et de les remplacer, mais selon la façon dont votre distribution intègre
       les suppléments invité, cela peut exiger un peu d'intervention manuelle. 
       Il est fortement 
@@ -598,7 +598,7 @@
       <sect3>
         <title>Installer les suppléments invité pour Linux</title>
 
-        <para>The suppléments invité de VirtualBox pour Linux sont fournis sur
+        <para>Les suppléments invité VirtualBox pour Linux sont fournis sur
         le même fichier de CD-ROM virtuel que les suppléments invité pour Windows
         décrits ci-dessus. Ils sont également fournis avec un programme d'installation
         qui vous guide à travers le processus de paramétrage bien que du fait des
@@ -620,7 +620,7 @@
             d'utiliser DKMS s'il est disponible pour le système invité. S'il n'est
             pas installé, utilisez cette commande pour les systèmes Ubuntu/Debian&#xA0;:
             <screen>sudo apt-get install dkms</screen>
-            ou, pour les szstèmes Fedora&#xA0;: <screen>yum install dkms</screen></para>
+            ou, pour les systèmes Fedora&#xA0;: <screen>yum install dkms</screen></para>
 
             <para>Assurez-vous d'installer DKMS <emphasis>avant</emphasis>
             d'installer les suppléments invité Linux. Si DKMS n'est pas disponible
@@ -650,7 +650,7 @@
 
         <para>Pour votre confort, nous fournissons les 
         instructions pas à pas suivantes pour les copies fraîchement installées
-        des versions récentes de les distributions Linux les plus populaires.
+        des versions récentes des distributions Linux les plus populaires.
         Après ces étapes préparatoires, vous pouvez 
         exécuter l'installeur des suppléments invité VirtualBox comme décrit 
         ci-dessus.</para>
@@ -660,7 +660,7 @@
 
           <para><orderedlist>
               <listitem>
-                <para>Afin de mettre à jour complètement votre szstème invité, ouvrez un
+                <para>Afin de mettre à jour complètement votre système invité, ouvrez un
                 terminal et lancez <screen>apt-get update</screen> en tant qu'administrateur
                 suivi de <screen>apt-get upgrade</screen></para>
               </listitem>
@@ -670,7 +670,7 @@
               </listitem>
 
               <listitem>
-                <para>Redémarrez votre szstème invité afin d'activer les mises à
+                <para>Redémarrez votre système invité afin d'activer les mises à
                 jour puis poursuivez comme décrit ci-dessus.</para>
               </listitem>
             </orderedlist></para>
@@ -681,7 +681,7 @@
 
           <para><orderedlist>
               <listitem>
-                <para>Afin de mettre à jour complètement votre szstème invité, ouvrez un
+                <para>Afin de mettre à jour complètement votre système invité, ouvrez un
                 terminal et lancez <screen>yum update</screen></para> en tant qu'administrateur.
               </listitem>
 
@@ -703,7 +703,7 @@
 
           <para><orderedlist>
               <listitem>
-                <para>Afin de mettre à jour complètement votre szstème invité, ouvrez un
+                <para>Afin de mettre à jour complètement votre système invité, ouvrez un
                 terminal et lancez <screen>zypper update</screen></para> en tant
                 qu'administrateur.
               </listitem>
@@ -742,7 +742,7 @@
 
           <para><orderedlist>
               <listitem>
-                <para>Afin de mettre à jour complètement votre szstème invité, ouvrez un
+                <para>Afin de mettre à jour complètement votre système invité, ouvrez un
                 terminal et lancez <screen>zypper update</screen></para> en tant
                 qu'administrateur.
               </listitem>
@@ -786,7 +786,7 @@
               </listitem>
 
               <listitem>
-                <para>Afin de mettre à jour complètement votre szstème invité, ouvrez un
+                <para>Afin de mettre à jour complètement votre système invité, ouvrez un
                 terminal et lancez <screen>urpmi --auto-update</screen>
                 en tant qu'administrateur.</para>
               </listitem>
@@ -809,7 +809,7 @@
 
           <para><orderedlist>
               <listitem>
-                <para>Mour les versions antérieures à 6, ajoutez 
+                <para>Pour les versions antérieures à 6, ajoutez 
                 <computeroutput>divider=10</computeroutput> aux options de démarrage
                 du noyau dans
                 <computeroutput>/etc/grub.conf</computeroutput> pour réduire la
@@ -817,7 +817,7 @@
               </listitem>
 
               <listitem>
-                <para>Afin de mettre à jour complètement votre szstème invité, ouvrez un
+                <para>Afin de mettre à jour complètement votre système invité, ouvrez un
                 terminal et lancez <screen>yum update</screen></para> en tant
                 qu'administrateur.
               </listitem>
@@ -838,7 +838,7 @@
               <listitem>
                 <para>Si Oracle Linux ne trouve pas les paquets requis,
                 soit vous devez les installer à partir d'une autre source (comme
-                un DVD),  soit utilisez use le serveur public Yum d'Oracle
+                un DVD),  soit utilisez le serveur public Yum d'Oracle
                 qui se troupe sur <ulink
                 url="http://public-yum.oracle.com/">http://public-yum.oracle.com</ulink>.</para>
               </listitem>
@@ -850,7 +850,7 @@
 
           <para><orderedlist>
               <listitem>
-                <para>Afin de mettre à jour complètement votre szstème invité, ouvrez un
+                <para>Afin de mettre à jour complètement votre système invité, ouvrez un
                 terminal et lancez <screen>apt-get update</screen> en tant qu'administrateur
                 suivi de <screen>apt-get upgrade</screen></para>
               </listitem>
@@ -876,9 +876,9 @@
       </sect3>
 
       <sect3>
-        <title>Intégration graphique et de la souris</title>
+        <title>Intégration graphique de la souris</title>
 
-        <para>Dans les invités Linux et Solaris, l'intégration graphique et de la
+        <para>Dans les invités Linux et Solaris, l'intégration graphique de la
         souris de VirtualBox passe par le système X Window.  VirtualBox peut
         utiliser la variante X.Org du système (ou XFree86 version 4.3 qui est
         identique à la première version de X.Org). Au cours du processus 
@@ -968,7 +968,7 @@
       <sect3>
         <title>Installer les suppléments invité Solaris</title>
 
-        <para>Les suppléments invité de VirtualBox pour Solaris sous fournis
+        <para>Les suppléments invité de VirtualBox pour Solaris sont fournis
         sur le même ISO de CD-ROM que les suppléments pour Windows et Linux 
         décrits ci-dessus. Ils sont aussi fournis avec un programme d'installation
         qui vous guide à travers le processus d'initialisation.</para>
@@ -1038,7 +1038,7 @@
       précédemment. Les suppléments invité OS/2 se trouvent dans
       directory <computeroutput>\32bit\OS2</computeroutput>.</para>
 
-      <para>Comme on ne fournit pas pour le moment d'installeur automatiquque,
+      <para>Comme on ne fournit pas pour le moment d'installeur automatique,
       merci de vous reporter au fichier <computeroutput>readme.txt</computeroutput> 
       de ce répertoire, qui décrit la façon d'installer les suppléments invité
       OS/2 à la main.</para>
@@ -1063,7 +1063,7 @@
     les suppléments invité fournissent un système de fichiers virtuel.</para>
 
     <para>Pour partager un dossier hôte avec une machine virtuelle de VirtualBox,
-    vous indiquer le chemin vers ce dossier et choisir pour lui un "nom partagé"
+    indiquer le chemin vers ce dossier et choisir pour lui un "nom partagé"
     que l'invité peut utiliser pour y accéder. D'où: créez tout d'abord le dossier
     partagé sur l'hôte, puis dans l'invité, connectez-vous-y.</para>
 
@@ -1124,6 +1124,13 @@
           <para>Actuellement, seuls les suppléments invité pour Linux et Solaris
           supportent les liens symboliques.</para>
         </listitem>
+        <listitem>
+          <para>Pour des raisons de sécurité, l'OS invité n'est pas autorisé par
+          défaut à créer des liens symboliques. Si vous faites confiance à l'OS
+          invité pour ne pas abuser de la fonction, vous pouvez autoriser la
+          création de liens symboliques pour "nomdupartage" avec :
+          <screen>VBoxManage setextradata "VM name" VBoxInternal2/SharedFoldersEnableSymlinksCreate/sharename 1</screen></para>
+        </listitem>
       </orderedlist></para>
 
     <sect2 id="sf_mount_manual">
@@ -1135,7 +1142,7 @@
       <para><itemizedlist>
           <listitem>
             <para>Dans un invité Windows, on peut naviguer dans les dossiers
-            partagés qui apparaissent donc dans l'exporrateur Windows. Donc,
+            partagés qui apparaissent donc dans l'explorateur Windows. Donc,
             pour connecter un dossier partagé à votre invité Windows, ouvrez
             l'explorateur Windows et cherchez-le dans "Favoris réseaux" -> 
             "Tout le réseau" -> "Dossier partagé VirtualBox". En effectuant
@@ -1223,7 +1230,7 @@ $</screen>
       <title>Montage automatique</title>
 
       <para>À partir de la version 4.0, VirtualBox peut monter automatiquement 
-      des dossiers partagés avec vos options. Si le montage automatique est acqivé
+      des dossiers partagés avec vos options. Si le montage automatique est activé
       pour un dossier partagé spécifique, les suppléments invité monteront
       automatiquement ce dossier dès qu'un utilisateur se connecte à l'OS invité. Les
       détails dépendent du type d'OS invité&#xA0;:<itemizedlist>
@@ -1281,6 +1288,118 @@ $</screen>
     </sect2>
   </sect1>
 
+  <sect1 id="guestadd-dnd">
+    <title>Glisser/Déplacer</title>
+
+    <para>À partir de la version 4.4, VirtualBox supporte le glisser/déplacer
+    d'un contenu de l'hôte à l'invité et vice versa. Pour que cela fonctionne
+    les derniers suppléments invité doivent être installés sur l'invité.</para>
+
+    <para>Le glisser/déplacer vous permet de façon transparente de copier ou
+    d'ouvrir des fichiers, des répertoires, et même certains formats de presse-papiers
+    entre eux (de l'hôte à l'invité ou de l'invité à l'hôte). Vous pouvez
+    ainsi effectuer des opérations de glisser/déplacer entre vhôte et une VM
+    comme si c'était un glisser/déplacer ordinaire sur l'OS de l'hôte.</para>
+
+    <para>Pour le moment, le glisser/déplacer est implémenté sur les systèmes Windows
+    et X-Windows, tant côté invité que côté hôtes. Comme X-Windows supporte
+    différents protocoles de glisser/déplacer, seul celui le plus utilisé, XDND,,
+    est supporté actuellement. Les applications qui utilisent d'autres protocoles
+    (telles que Motif ou OffiX) ne seront pas reconnues par VirtualBox.</para>
+
+    <para>Dans un contexte d'utilisation de glisser/déplacer, l'origine des
+    données s'appelle <emphasis role="bold">source</emphasis>, c'est-à-dire, le
+    point spécifié d'où viennent les données.  De l'autre côté, il y a la
+    <emphasis role="bold">cible</emphasis>, qui désigne là où devraient aller les
+    données de la source. Le transfert de données de la source à la cible peut
+    se faire de plusieurs manières, comme en copiant, déplaçant ou créant des
+    liens.<footnote><para>Pour le
+    moment, seule la copie de données est supportée. Le déplacement ou la création
+    de liens n'est pas encore implémenté.</para></footnote></para>
+
+    <para>Quand on transfère des données de l'hôte à l'OS invité, l'hôte est
+    dans ce cas la source, alors que l'OS invité est la cible. En revanche, quand
+    dans l'autre sens, à savoir lors d'un transfert de données de l'OS invité
+    vers l'hôte, l'OS invité devient cette fois la source et l'hôte est la cible.</para>
+
+    <para>Pour des raisons de sécurité, le glisser/déplacer peut se configurer
+    lors de l'exécution, individuellement pour chaque VM, en utilisant soit
+    l'élément "Glisser/déplacer" du menu "Périphériques" de la machine virtuelle
+    ou VBoxManage : Les quatre modes suivants sont disponibles :
+
+<para><mediaobject>
+      <imageobject>
+        <imagedata align="center" fileref="images/dnd-modes.png"
+                   width="10cm" />
+        </imageobject>
+      </mediaobject></para>
+
+    <itemizedlist>
+      <listitem>
+        <para><emphasis role="bold">Disabled</emphasis> désactive complètement
+        le glisser/déplacer. C'est le réglage par défaut à la création de
+        nouvelles VMs.</para>
+      </listitem>
+      <listitem>
+        <para><emphasis role="bold">Host To Guest</emphasis> active le
+        glisser/déplacer de vhôte vers l'invité seulement.</para>
+      </listitem>
+      <listitem>
+        <para><emphasis role="bold">Guest To Host</emphasis> active le
+        glisser/déplacer de l'invité à l'hôte seulement.</para>
+      </listitem>
+      <listitem>
+        <para><emphasis role="bold">Bidirectional</emphasis> active le
+        glisser/déplacer dans les deux sens, de l'hôte vers l'invité et
+        vice versa.</para>
+      </listitem>
+    </itemizedlist></para>
+
+    <note><para>Le support du glisser/déplacer dépend de l'interface
+     utilisée ; pour le moment, seule celle du gestionnaire VirtualBox offre
+    cette fonctionnalité.</para></note>
+
+    <para>Pour utiliser VBoxManage pour contrôler le mode actuel du glisser/déplacer,
+    voir <xref
+    linkend="vboxmanage" />. Les commandes <computeroutput>modifyvm</computeroutput>
+    et <computeroutput>controlvm</computeroutput> permettent de définir le mode
+    glisser/déplacer d'une VM en ligne de commande.</para>
+
+    <sect2 id="guestadd-dnd-formats">
+      <title>Formats supportés</title>
+
+      <para>Comme VirtualBox peut fonctionner sur divers OS hôtes et il supporte
+      une large gamme d'invités, certains formats de données doivent être
+      traduits après un transfert pour que l'OS cible (c'est-à-dire la partie qui
+      reçoit les données) puisse les gérer de la bonne manière.</para>
+
+      <note><para>Cependant, quand vous glissez des fichiers, on ne fait aucune
+      conversion de données, ainsi quand vous transférez un fichier d'un invité
+      Linux vers un hôte Windows, les ajouts spécifiques à Linux ne seront pas
+      convertis en ajouts Linux.</para></note>
+
+      <para>Les formats suivants sont gérés par le service glisser/déplacer de
+      VirtualBox :
+        <itemizedlist>
+          <listitem>
+            <para><emphasis role="bold">Text brut</emphasis>, issu d'applications
+            telles un éditeur de texte, des navigateurs internet et des fenêtres
+            de terminal</para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">Fichiers</emphasis>, issus de gestionnaires
+            de fichiers comme l'explorateur Windows, Nautilus et Finder</para>
+          </listitem>
+          <listitem>
+            <para><emphasis role="bold">Répertoires</emphasis>, où la même
+            chose que pour les fichiers s'applique</para>
+          </listitem>
+        </itemizedlist>
+      </para>
+    </sect2>
+
+  </sect1>
+
   <sect1 id="guestadd-video">
     <title>L'accélération graphique matérielle</title>
 
@@ -1298,7 +1417,7 @@ $</screen>
         </footnote></para>
 
       <para>Avec cette fonction, si une application de votre machine virtuelle
-      utilise des fonctions 3D via  les interfaces de programmation OpenGL ou
+      utilise des fonctions 3D via les interfaces de programmation OpenGL ou
       Direct3D 8/9, plutôt qu'une émulation logicielle (qui serait lente),
       VirtualBox essaiera d'utiliser le matériel 3D de votre hôte. Cela fonctionne
       pour toutes les plateformes hôtes supportées (Windows, Mac, Linux, Solaris),
@@ -1354,7 +1473,6 @@ $</screen>
               les fonctions d'accélération 3D de VirtualBox tout comme les logiciels
               douteux de l'hôte ne devraient pas être autorisés à utiliser 
               l'accélération 3D. Les pilotes du matériel 3D sont en général trop
-              
               complexes pour être parfaitement sécurisés et tout logiciel 
               autorisé à y accéder peut être en mesure de compromettre le système
               d'exploitation qui les exécute. En outre, l'activation de l'accélération
@@ -1373,12 +1491,12 @@ $</screen>
       il est disponible avec l'installation des suppléments invité. Comme le pilote
       graphique WDDM est pour l'instant expérimental, il n'est pas installé par
       défaut et il faut <emphasis role="bold">le sélectionner à la main</emphasis> 
-      dans l'installeur des suppléments invité  en répondant "Non" dans la boîte
+      dans l'installeur des suppléments invité en répondant "Non" dans la boîte
       de dialogue "Voulez-vous installer le support Direct3D de base" qui s'affiche
       quand la fonction Direct3D est sélectionnée.
       <note><para>Contrairement au support Direct3D de base actuel, l'installation
       du pilote graphique WDDM <emphasis role="bold">n'exige pas</emphasis> 
-      le "Mode sans éfeec".</para></note>
+      le "Mode sans échec".</para></note>
       <para>Le thème Aero n'est pas activé par défaut. Pour l'activer<itemizedlist>
           <listitem>
             <para>Dans l'invité Windows Vista, effectuez un clic droit sur le
@@ -1417,7 +1535,7 @@ $</screen>
       vidéo, VirtualBox essaiera d'utiliser l'accélération graphique matérielle de 
       votre hôte plutôt que de faire de l'interprétation de couches ni conversion
       de couleurs dans le logiciel (ce qui serait lent). Cela fonctionne actuellement
-      avec les plateformes hôtes Windows, Linux et Mac, pourvu que votre szstème
+      avec les plateformes hôtes Windows, Linux et Mac, pourvu que votre système
       d'exploitation hôte puisse utiliser l'accélération graphique 2D au premier plan.</para>
 
       <para>L'accélération graphique 2D est possible aujourd'hui sous les 
@@ -1434,7 +1552,7 @@ $</screen>
           <listitem>
             <para>Le support 2D étant pour l'instant expérimental, il est désactivé
             par défaut et il faut <emphasis role="bold">l'activer à la main</emphasis>
-            dans les paramètres de laVM (voir <xref
+            dans les paramètres de la VM (voir <xref
             linkend="generalsettings" />).</para>
           </listitem>
         </orderedlist></para>
@@ -1464,7 +1582,7 @@ $</screen>
         </listitem>
       </itemizedlist></para>
 
-    <para>Après que les fenêtres transparentes ont été activées (voir ci-dessous), VirtualBox
+    <para>Après que les fenêtres transparentes ait été activées (voir ci-dessous), VirtualBox
     supprime l'affichage de l'arrière-plan du bureau de votre invité, ce qui
     vous permet de lancer les fenêtres de votre système d'exploitation invité 
     de manière transparente à côté des fenêtres de votre hôte&#xA0;:</para>
@@ -1490,7 +1608,7 @@ $</screen>
     choses&#xA0;:<orderedlist>
         <listitem>
           <para>Un certain nombre de caractéristiques prédéfinies de la VM sont maintenues 
-          automatiquement par VirtualBox et peuvent être répercutées sur l'hîte,
+          automatiquement par VirtualBox et peuvent être répercutées sur l'hôte,
           par exemple, pour gérer les performances de la VM et les statistiques.</para>
         </listitem>
 
@@ -1515,14 +1633,14 @@ $</screen>
     du service pack, la version installée des suppléments invité, les utilisateurs
     connectés à l'OS invité, les statistiques réseau et davantage. Ces propriétés
     prédéfinies ont toutes pour préfixe 
-    <computeroutput>/VirtualBox/</computeroutput> et sont organisàes en arborescence
+    <computeroutput>/VirtualBox/</computeroutput> et sont organisées en arborescence
     hiérarchique de clés.</para>
 
     <para>Certaines informations de l'exécution s'affichent quand vous sélectionnez
     "Boîte de dialogue d'informations sur la session" du menu "Machine" de la
     machine virtuelle.</para>
 
-    <para>Une manière plus flexible d'utiliser ce manal est de passer par la commande
+    <para>Une manière plus flexible d'utiliser ce canal est de passer par la commande
     <computeroutput>VBoxManage guestproperty</computeroutput>&#xA0;; voir
     <xref linkend="vboxmanage-guestproperty" /> pour les détails. Par exemple,
     pour voir <emphasis>toutes</emphasis> les propriétés invité disponible pour 
@@ -1630,11 +1748,11 @@ Name: /VirtualBox/GuestInfo/OS/Version, value: #59-Ubuntu SMP Thu Jan 28 01:23:0
 
     <para>À partir de la version 4.0, les suppléments invité pour Windows permettent
     une mise à jour automatique (seulement si les suppléments invité 4.0 ou
-    supérieurs sont déjà installés). En outre, la copie de fichiers de vhôte vers
+    supérieurs sont déjà installés). En outre, la copie de fichiers de l'hôte vers
     l'invité ainsi que la création à distance de répertoires invités est disponible.</para>
 
     <para>Pour utiliser ces fonctionnalités, utilisez la ligne de commande de 
-    VirtualBox, voir see <xref
+    VirtualBox, voir <xref
     linkend="vboxmanage-guestcontrol" />.</para>
   </sect1>
 
@@ -1717,8 +1835,8 @@ Name: /VirtualBox/GuestInfo/OS/Version, value: #59-Ubuntu SMP Thu Jan 28 01:23:0
       (comme avec des systèmes d'exploitation identiques) sur le même hôte, 
       beaucoup de pages de mémoire sont identiques. La technologie de fusion
       de page de VirtualBox, introduite avec VirtualBox 3.2, est une technique
-      de novel pour identifier efficacement ces pages de mémoire identiques et les
-      partager entre plusieurs VMs.<note>
+       pour identifier efficacement ces pages de mémoire identiques et les
+      nouvelle de partage entre plusieurs VMs.<note>
           <para>VirtualBox ne supporte la fusion de page que sur des hôtes 64 bits
           et il n'est pas supporté sur les hôtes Mac OS X. La fusion de page
           ne fonctionne aujourd'hui qu'avec des invités Windows (2000 et
@@ -1746,15 +1864,15 @@ Name: /VirtualBox/GuestInfo/OS/Version, value: #59-Ubuntu SMP Thu Jan 28 01:23:0
             <para>Les hyperviseurs traditionnels analysent <emphasis>toute</emphasis> 
             la mémoire invité et calculent les sommes de contrôle (hachages) pour
             chaque page de mémoire individuelle. Puis ils cherchent des endroits
-            avec des hachages identiques et comparent et comparent tout le contenu
+            avec des hachages identiques et comparent tout le contenu
             de ces pages&#xA0;; si deux pages donnent le même hachage, il est très
             probable que les pages soient identiques par leur contenu. Cela peut,
             bien sûr, prendre du temps, surtout si le système n'est pas inactif.
             La mémoire supplémentaire ne devient donc disponibles qu'après une
             durée importante (cela peut prendre des heures voire des jours&#xA0;!). Pire,
             ce genre d'algorithme de partage de page consomme en général beaucoup
-            de ressources et augmente la vitesse de la
-            virtualisation jusqu'à 10-20%.</para>
+            de ressources et augmente la consommation par la
+            virtualisation jusqu'à 20%.</para>
 
             <para>La fusion de page dans VirtualBox utilise une logique des
             suppléments invité de VirtualBox pour identifier rapidement les cellules
@@ -1775,7 +1893,7 @@ Name: /VirtualBox/GuestInfo/OS/Version, value: #59-Ubuntu SMP Thu Jan 28 01:23:0
       <para>Pour l'instant, la fusion de page ne peut être contrôlée qu'avec
       VBoxManage et pendant qu'une VM est éteinte. Pour activer la fusion de page
       pour une VM, utilisez
-      the following command:<screen>VBoxManage modifyvm "nom VM" --pagefusion on</screen></para>
+      la commande suivante:<screen>VBoxManage modifyvm "nom VM" --pagefusion on</screen></para>
 
       <para>Vous pouvez voir l'opération de fusion de page en utilisant des 
       métriques. 
diff --git a/doc/manual/fr_FR/user_Installation.xml b/doc/manual/fr_FR/user_Installation.xml
index 6fbf118..3da33d7 100644
--- a/doc/manual/fr_FR/user_Installation.xml
+++ b/doc/manual/fr_FR/user_Installation.xml
@@ -43,9 +43,9 @@
           </listitem>
         </itemizedlist></para>
 
-      <para>Dans tous les cas, ceci affichera la boîte de dialrgue de bienvenue
+      <para>Dans tous les cas, ceci affichera la boîte de dialogue de bienvenue
       dans l'installation et vous permet de choisir où installer VirtualBox et
-      les composants à installer. Outre l' application  VirtualBox, les composants
+      les composants à installer. Outre l'application  VirtualBox, les composants
       suivants sont disponibles&#xA0;:<glosslist>
           <glossentry>
             <glossterm>Support USB</glossterm>
@@ -62,8 +62,8 @@
 
             <glossdef>
               <para>Ce paquet contient les pilotes réseaux supplémentaires pour
-              votre hôte Windows, dont a besoin VirtualBox p*ur supporter le
-              réseau bridgç (pour que les cartes réseaux de votre VM soient
+              votre hôte Windows, dont a besoin VirtualBox pour supporter le
+              réseau bridge (pour que les cartes réseaux de votre VM soient
               accessibles depuis d'autres machines de votre réseau physique).</para>
             </glossdef>
           </glossentry>
@@ -216,12 +216,12 @@
     </sect2>
 
     <sect2>
-      <title>Installation sans efforts</title>
+      <title>Installation non interactive</title>
 
       <para>Pour effectuer une installation non interactive de VirtualBox, vous
-      pouvez la version en ligne de commande de l'installeur.</para>
+      pouvez utiliser la version en ligne de commande de l'installeur.</para>
 
-      <para>Montez le fichier image du disque (dmg" comme décrit dans
+      <para>Montez le fichier image du disque (dmg) comme décrit dans
       l'installation normale. Ouvrez ensuite une session de terminal et exécutez&#xA0;:</para>
 
       <screen>sudo installer -pkg /Volumes/VirtualBox/VirtualBox.mpkg \
@@ -274,7 +274,7 @@
       mémoire physique et contrôler le processeur pour exécuter les systèmes
       invités. Sans ce module du noyau, vous pouvez utiliser le gestionnaire
       de VirtualBox pour configurer des machines virtuelles mais elles ne démarreront
-      pas. En outre, existe des modules noyau
+      pas. En outre, il existe des modules noyau
       <computeroutput>vboxnetflt</computeroutput> et
       <computeroutput>vboxnetadp</computeroutput> requis pour les fonctionnalités
       réseau plus avancées de VirtualBox.</para>
@@ -362,7 +362,7 @@
                 Les détails sur la manière de faire cela dépendent de la façon
                 dont vous avez construit votre noyau et si vous n'êtes pas sûr,
                 vous devriez consulter la documentation que vous avez suivie pour
-                construire.</para>
+                le construire.</para>
               </listitem>
             </itemizedlist>
           </listitem>
@@ -393,7 +393,7 @@
         Ubuntu Raring 32 bits. Utilisez <computeroutput>dpkg</computeroutput>
         pour installer le paquet Debian&#xA0;:</para>
 
-        <screen>sudo dpkg -i VirtualBox-3.2_$VBOX_VERSION_STRING_Ubuntu_raring_i386.deb</screen>
+        <screen>sudo dpkg -i VirtualBox-4.3_$VBOX_VERSION_STRING_Ubuntu_raring_i386.deb</screen>
 
         <para>On vous demandera d'accepter la licence d'utilisation Personelle
         et d'évaluation de VirtualBox. Sauf si vous répondez "oui" l'installation
@@ -498,10 +498,10 @@
 
         <para><note>
             <para>La commande <computeroutput>usermod</computeroutput> de
-            certaines distributions Linux anciennes ne supporte pas l'option
+            certaines anciennes distributions Linux ne supporte pas l'option
             <computeroutput>-a</computeroutput> (qui ajoute l'utilisateur au groupe
-            donné sans le rendre membre d'autres groupes). Dans ce cas, cherchez
-            les membres actuels du groupe avec la commande
+            donné sans affecter l'appartenance aux autres groupes). Dans ce cas, cherchez
+            les groupes actuels du user avec la commande
             <computeroutput>groups</computeroutput> et ajoutez tous ces
             groupes dans une liste séparée par des virgules à la ligne de
             commande dans l'option
@@ -549,7 +549,7 @@ tar jxf ./install/VirtualBox.tar.bz2 -C /opt/VirtualBox</screen></para>
         <para>Le module de noyau VirtualBox a besoin d'un n&#x153;ud de périphérique
         pour fonctionner. La commande make ci-dessus vous dira comment créer 
         le n&#x153;ud de périphérique selon votre système Linux. La procédure
-        est lélèrement différente pour une installation Linux classique avec le
+        est légèrement différente pour une installation Linux classique avec le
         répertoire <computeroutput>/dev</computeroutput>, un système avec 
         <computeroutput>devfs</computeroutput>, maintenant obsolète, et un
         système Linux moderne avec <computeroutput>udev</computeroutput>.</para>
@@ -622,7 +622,7 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>La première ligne
         <title>Installation automatique des paquets .rpm</title>
 
         <para>Le format .rpm n'offre pas de système de configuration comparable
-        au système debconf. SVoir <xref
+        au système debconf. Voir <xref
         linkend="linux_install_opts" /> pour savoir comment définir cartaines
         options d'installation classiques fournies par VirtualBox.</para>
       </sect3>
@@ -675,8 +675,8 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>La première ligne
       le noyau Linux. VirtualBox consiste en un démon de service (<computeroutput>VBoxSVC</computeroutput>)
       et plusieurs applications. Le démon est démarré automatiquement si nécessaire.
       Toutes les applications VirtualBox communiqueront avec le démon par les
-      sockets du démon local d'Unix. Il peu] y avoir plusieurs 
-      instances de démon sous différents comptes utilisateurs at les applications
+      sockets du démon local d'Unix. Il peut y avoir plusieurs 
+      instances de démon sous différents comptes utilisateurs et les applications
       peuvent ne communiquer qu'avec le démon en fonction sous le compte utilisateur
       en tant qu'application. La socket de domaine locale réside dans un
       sous-répertoire du répertoire des fichiers temporaires de votre ystème, 
@@ -796,7 +796,7 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>La première ligne
 
       <para>La désinstallation de VirtualBox sur Solaris qécessite les droits
       d'administrateur. Pour effectuer la désinstallation, démarrez une session
-      administrateur en terminal et exeécutez&#xA0;:</para>
+      administrateur en terminal et exécutez&#xA0;:</para>
 
       <screen>pkgrm SUNWvbox</screen>
 
@@ -813,7 +813,7 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>La première ligne
 
       <para>Pour effectuer une installation non interactive de VirtualBox,
       nous avons créé un fichier de réponses appelé
-      <computeroutput>autoresponse</computeroutput> qu'nsilisera l'installeur pour
+      <computeroutput>autoresponse</computeroutput> qu'utilisera l'installeur pour
       répondre à ses questions plutôt que de vous les poser.</para>
 
       <para>Extrayez le paquet tar.gz comme décrit dans l'installation normale.
@@ -830,11 +830,6 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>La première ligne
     <sect2 id="solaris-zones">
       <title>Configurer un espace pour exécuter VirtualBox</title>
 
-      <para>À partir de VirtualBox 1.6, il est possible d'exécuter VirtualBox
-      depuis des espaces Solaris. Pour une introduction aux espaces Solaris, 
-      merci de vous reporter à <ulink
-      url="http://www.sun.com/bigadmin/features/articles/solaris_zones.jsp">http://www.sun.com/bigadmin/features/articles/solaris_zones.jsp</ulink>.</para>
-
       <para>En supposant que VirtualBox a déjà été installé dans votre espace,
       vous devez donner au n&#x153;ud de périphérique de VirtualBox un accès à la
       zone. Ceci se fait en effectuant les étapes suivantes. Démarrez une
@@ -842,6 +837,9 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>La première ligne
 
       <screen>zonecfg -z vboxzone</screen>
 
+      <para>Remplacez "vboxzone" par le nom de la zone où vous souhaitez lancer
+      VirtualBox.</para>
+
       <para>Dans l'invite <computeroutput>zonecfg</computeroutput>, ajoutez la
       ressource <computeroutput>device</computeroutput> et les propriétés
       <computeroutput>match</computeroutput> à l'espace. Voici comment on peut
@@ -850,17 +848,19 @@ virtualbox virtualbox/delete-old-modules boolean true</screen>La première ligne
       <screen>zonecfg:vboxzone>add device
 zonecfg:vboxzone:device>set match=/dev/vboxdrv
 zonecfg:vboxzone:device>end
+zonecfg:vboxzone>add device
+zonecfg:vboxzone:device>set match=/dev/vboxdrvu
+zonecfg:vboxzone:device>end
 zonecfg:vboxzone>verify
 zonecfg:vboxzone>exit</screen>
 
       <para>Si vous exécutez VirtualBox 2.2.0 ou supérieur sur des hôtes Solaris
-      11 ou Nevada, vous devriez aussi ajouter un périphérique pour 
+      11 ou supérieur, vous pouvez aussi ajouter un périphérique pour 
       <computeroutput>/dev/vboxusbmon</computeroutput>, identique à ce qui est
       indiqué ci-dessus. Cela ne s'applique pas aux hôtes Solaris 10 à cause de
       l'absence du support USB.</para>
 
-      <para>Remplacez "vboxzone" par le nom de l'espace dans lequel vous souhaitez
-      exécuter VirtualBox. Ensuite, redémarrez l'espace en utilisant
+      <para>Ensuite, redémarrez l'espace en utilisant
       <computeroutput>zoneadm</computeroutput> et vous devriez pouvoir lancer
       VirtualBox depuis l'espace configuré.</para>
     </sect2>
diff --git a/doc/manual/fr_FR/user_Introduction.xml b/doc/manual/fr_FR/user_Introduction.xml
index 965e9d1..aeaefb6 100644
--- a/doc/manual/fr_FR/user_Introduction.xml
+++ b/doc/manual/fr_FR/user_Introduction.xml
@@ -12,11 +12,11 @@
   d'exploitation Windows, Mac, Linux ou Solaris. D'autre part, il augmente la
   capacité de votre ordinateur existant pour qu'il puisse lancer plusieurs
   systèmes d'exploitation en même temps (dans plusieurs machines virtuelles).
-  Donc, vous pouvez par exemple lancer Windows and Linux sur votre Mac,
+  Donc, vous pouvez par exemple lancer Windows et Linux sur votre Mac,
   lancer Windows Server 2008 sur votre serveur Linux, lancer Linux sur votre
-  PC Windows and ainsi de suite pour toutes vos applications. Vous pouvez
-  installer and lancer autant de machines virtuaelles que vous voulez -- la seule
-  limite pratique étant votre espace disque and la mémoire.</para>
+  PC Windows et ainsi de suite pour toutes vos applications. Vous pouvez
+  installer et lancer autant de machines virtuaelles que vous voulez -- la seule
+  limite pratique étant votre espace disque et la mémoire.</para>
 
   <para>VirtualBox est résolument simple bien que très puissant. Il peut se lancer
   partout, depuis de petits systèmes embarqués jusqu'aux machines de bureau en
@@ -32,16 +32,16 @@
       </imageobject>
     </mediaobject></para>
 
-  <para>Dans ce manuel de l'utilisateur, ne allons simplement commencer par une
-  introduction rapide à la virtualisation and sur la façon de lancer votre première
+  <para>Dans ce manuel de l'utilisateur, nous allons simplement commencer par une
+  introduction rapide à la virtualisation et sur la façon de lancer votre première
   machine virtuelle avec l'interface graphique de VirtualBox, facile à utiliser.
-  Les chapitres suivants entreront beaucoup plus dans les détails en traitant
-  d'outils and de fonctionnalités plus puissants, mais heureusement, il n'est pas
+  Les chapitres suivants entreront beaucoup plus dans le détail en traitant
+  d'outils et de fonctionnalités plus puissants, mais heureusement, il n'est pas
   nécessaire de lire tout le manuel de l'utilisateur avant de pouvoir utiliser
   VirtualBox.</para>
 
   <para>Vous pouvez trouver un résumé des possibilités de VirtualBox au <xref
-  linkend="features-overview" />. Pour ceux qui utilisent déjà VirtualBox and qui
+  linkend="features-overview" />. Pour ceux qui utilisent déjà VirtualBox et qui
   voudraient seulement voir les nouveautés de cette version, une liste détaillée 
   existe au <xref
   linkend="ChangeLog" />.</para>
@@ -49,8 +49,8 @@
   <sect1>
     <title>À quoi sert la virtualisation&#xA0;?</title>
 
-    <para>Les techniques and les fonctionnalités offertes par VirtualBox servent dans    
-    plusieurs scenari&#xA0;:</para>
+    <para>Les techniques et les fonctionnalités offertes par VirtualBox servent dans    
+    plusieurs scenarii&#xA0;:</para>
 
     <itemizedlist>
       <listitem>
@@ -69,32 +69,32 @@
       <listitem>
         <para><emphasis role="bold">Installation plus facile de logiciels.</emphasis>
         Les éditeurs de logiciels peuvent utiliser des machines virtuelles pour
-        y mettre des configurations de logiciels. Par exemple, vinstallation d'une
+        y mettre des configurations de logiciels. Par exemple, installation d'une
         solution complète de serveur de messagerie sur une vraie machine peut
         être une tâche très fastidieuse. Avec VirtualBox, vous pouvez emballer
         une configuration aussi complexe (appelé alors souvent un environnement
-        applicatif) dans une machine virtuelle. L'installation and l'exécution
+        applicatif) dans une machine virtuelle. L'installation et l'exécution
         d'un serveur de messagerie devient aussi facile que d'importer un
         environnement applicatif dans VirtualBox.</para>
       </listitem>
 
       <listitem>
-        <para><emphasis role="bold">Tester and réparer une récupération d'accident.</emphasis>
-        Une fois installés, on peut considérer une machine virtuelle and ses 
+        <para><emphasis role="bold">Tester et réparer en cas d'accident.</emphasis>
+        Une fois installés, on peut considérer une machine virtuelle et ses 
         disques durs virtuels comme un "conteneur" qu'on peut, au choix, geler,
-        réveiller, copier, sauvegarder and transporter entre hôtes.</para>
+        réveiller, copier, sauvegarder et transporter entre hôtes.</para>
 
         <para>Au-delà de cela, en utilisant une autre fonctionnalité de VirtualBox
         appelé les "instantanés", vous pouvez sauvegarder un état en particulier
-        d'une machine virtuelle and revenir à cet état si nécessaire. De cette
+        d'une machine virtuelle et revenir à cet état si nécessaire. De cette
         manière, vous pouvez librement essayer un environnement informatique. Si
         quelque chose ne va pas (par exemple, si un logiciel ne se comporte pas
         bien après l'installation ou si un invité a un virus), on peut facilement
-        revenir à un instantané récent and éviter de sauvegarder and de
+        revenir à un instantané récent et éviter de sauvegarder et de
         restaurer fréquemment.</para>
 
         <para>On peut créer autant d'instantanés que vous voulez, ce qui permet 
-        de voyager dans le temps des machines virtuelles en arrière and en avant.
+        de voyager dans le temps des machines virtuelles en arrière et en avant.
         Vous pouvez effacer des instantanés alors qu'une machine virtuelle est
         en fonction pour gagner de l'espace disque.</para>
       </listitem>
@@ -102,12 +102,12 @@
       <listitem>
         <para><emphasis role="bold">Consolider une infrastructure.</emphasis>
         La virtualisation peut réduire significativement les coûts en matériel
-        and électricité. La plupart du temps, les ordinateurs actuels n'utilisent
-        qu'une partie de leur puissance potentielle and tournent avec une faible
+        et électricité. La plupart du temps, les ordinateurs actuels n'utilisent
+        qu'une partie de leur puissance potentielle et tournent avec une faible
         charge système moyenne. On gaspille donc beaucoup de ressources
-        matérielles and énergétiques. Am lieu de lancer autant d'ordinateurs physiques,
+        matérielles et énergétiques. Au lieu de lancer autant d'ordinateurs physiques,
         qui ne sont que partiellement utilisés, on peut emballer de nombreuses
-        machines virtuelles sur quelques hôtes puissants and équilibrer les 
+        machines virtuelles sur quelques hôtes puissants et équilibrer les 
         charges entre elles.</para>
       </listitem>
     </itemizedlist>
@@ -127,7 +127,7 @@
         <glossdef>
           <para>C'est le système d'exploitation de l'ordinateur physique sur 
           lequel VirtualBox a été installé. Il existe des versions de VirtualBox
-          pour des hôtes Windows, Mac OS X, Linux and Solaris&#xA0;; pour des
+          pour des hôtes Windows, Mac OS X, Linux et Solaris&#xA0;; pour des
           détails, merci de voir le
           <xref linkend="hostossupport" />.</para>
 
@@ -142,13 +142,13 @@
 
         <glossdef>
           <para>C'est le système d'exploitation en fonction dans la machine
-          virtuelle. En théorie, VirtualBox peut lancer tous les szstèmes
+          virtuelle. En théorie, VirtualBox peut lancer tous les systèmes
           d'exploitation x86 (DOS, Windows, OS/2, FreeBSD, OpenBSD), mais
           pour s'approcher le plus possible de la performance d'origine du code
           invité sur votre machine, nous avons dû faire beaucoup d'optimisations
           qui sont spécifiques à certains systèmes d'exploitation. Donc si votre
           système d'exploitation favori 
-          <emphasis>peut</emphasis> être un invité, nous en supportons and optimisons
+          <emphasis>peut</emphasis> être un invité, nous en supportons et optimisons
           officiellement quelques-uns sélectionnés (cependant, cela inclut ceux
           les plus courants).</para>
 
@@ -168,7 +168,7 @@
           autre ordinateur, selon les interfaces de VirtualBox que vous utilisez.</para>
 
           <para>De manière plus abstraite, en interne, VirtualBox conçoit une VM
-          comme un ensemble de paramètres qui déterminent sont comportement.
+          comme un ensemble de paramètres qui déterminent son comportement.
           Parmi eux, on a les paramètres matériels (combien de mémoire devrait 
           avoir la VM, quels disques durs devrait virtualiser VirtualBox via
           quels fichiers conteneurs, quels CDs, lesquels sont montés, etc.)
@@ -189,7 +189,7 @@
           <para>Ceci renvoie aux paquets logiciels spéciaux qui sont inclus
           avec VirtualBox mais conçus pour être installés 
           <emphasis>à l'intérieur</emphasis> d'une VM pour améliorer les 
-          performances de l'OS invité and pour ajouter des fonctionnalités
+          performances de l'OS invité et pour ajouter des fonctionnalités
           supplémentaires. C'est décrit en détails au <xref
           linkend="guestadditions" />.</para>
         </glossdef>
@@ -205,7 +205,7 @@
     <itemizedlist>
       <listitem>
         <para><emphasis role="bold">Portabilité.</emphasis> VirtualBox se
-        lance sur un grand nombre de systèmes d'exploitation hôtes 32 and 64 bits
+        lance sur un grand nombre de systèmes d'exploitation hôtes 32 et 64 bits
         (de nouveau, voir 
         <xref linkend="hostossupport" /> pour les détails).</para>
 
@@ -216,13 +216,13 @@
         lancer toutes les applications sur cet hôte.</para>
 
         <para>Dans une très large mesure, VirtualBox est fonctionellement
-        identique sur toutes les plateformes hôtes and on peut utiliser les mêmes
-        formats de fichiers and d'images. Ceci vous permet de lancer des machines
+        identique sur toutes les plateformes hôtes et on peut utiliser les mêmes
+        formats de fichiers et d'images. Ceci vous permet de lancer des machines
         virtuelles créées sur un hôte sur un autre hôte ayant un système
         d'exploitation hôte différent&#xA0;; par exemple, vous pouvez créer une
         machine virtuelle sur Windows puis la lancer sous Linux.</para>
 
-        <para>En outre, on peut facilement importer and exporter des machines
+        <para>En outre, on peut facilement importer et exporter des machines
         virtuelles en utilisant le format ouvert de virtualisation (OVF, voir
         <xref
         linkend="ovf" />), un standard industriel créé dans ce but. Vous pouvez
@@ -232,7 +232,7 @@
 
       <listitem>
         <para><emphasis role="bold">Aucune virtualisation matérielle requise.
-        </emphasis> Pour de nombreux scenari, VirtualBox n'exige pas la construction,
+        </emphasis> Pour de nombreux scenarii, VirtualBox n'exige pas la construction,
         dans le processeur, des fonctionnalités récentes du matériel telles que
         Intel VT-x ou AMD-V. Contrairement à beaucoup d'autres solutions de
         virtualisation, vous pouvez donc utiliser VirtualBox même sur du vieux
@@ -247,11 +247,11 @@
         suppléments invité de VirtualBox sont des paquets logiciels qu'on peut
         installer 
         <emphasis>à l'intérieur</emphasis> des systèmes invités supportés pour
-        améliorer leurs performances and effectuer une intégration and une
+        améliorer leurs performances et effectuer une intégration et une
         communication accrues avec le système hôte. Après avoir installé les
-        suppléments invité, une machine virtuelle supportera vajustement
+        suppléments invité, une machine virtuelle supportera l'ajustement
         automatique des résolutions graphiques, les fenêtres transparentes,
-        la vidéo 3D accélérée and davantage. Les suppléments invité sont décrits
+        la vidéo 3D accélérée et davantage. Les suppléments invité sont décrits
         en détails au <xref
         linkend="guestadditions" />.</para>
 
@@ -275,7 +275,7 @@
 
           <listitem>
             <para><emphasis role="bold">Support des périphériques USB.</emphasis>
-            VirtualBox implémente un contrôleur USB virtuel and vous permet de
+            VirtualBox implémente un contrôleur USB virtuel et vous permet de
             connecter des périphériques USB de votre choix à vos machines 
             virtuelles sans devoir installer de pilotes spécifiques sur l'hôte.
             Le support USB n'est pas limité à certaines catégories de périphériques.
@@ -288,11 +288,11 @@
             VirtualBox virtualise une vaste gamme de périphériques virtuels,
             parmi lesquels beaucoup sont en général fournis par d'autres
             plateformes de virtualisation. Ceci inclut les contrôleurs de disques
-            IDE, SCSI and SATA, plusieurs cartes son and réseau virtuelles, les
-            ports série and parallèle virtuels, ainsi qu'un contrôleur d'interruptions
+            IDE, SCSI et SATA, plusieurs cartes son et réseau virtuelles, les
+            ports série et parallèle virtuels, ainsi qu'un contrôleur d'interruptions
             entrée/sortie programmable avancé (I/O APIC), ce qu'on trouve dans
             de nombreux systèmes PC modernes. Cela facilite le clonage d'images
-            de PC depuis des machines réelles and l'importation de machines virtuelles
+            de PC depuis des machines réelles et l'importation de machines virtuelles
             tierces dans VirtualBox.</para>
           </listitem>
 
@@ -300,21 +300,21 @@
             <para><emphasis role="bold">Support complet de l'ACPI.</emphasis>
             L'Advanced Configuration and Power Interface (ACPI) est complètement
             supportée par VirtualBox. Cela facilite le clonage d'images
-            de PC depuis des machines réelles and l'importation de machines virtuelles
+            de PC depuis des machines réelles et l'importation de machines virtuelles
             tierces dans VirtualBox. Avec son
             <emphasis role="bold">support d'état d'énergie de l'ACPI</emphasis>
             unique, VirtualBox peut même signaler aux systèmes d'exploitation
             supportant l'ACPI l'état de l'alimentation de l'hôte. Pour les
-            systèmes mobiles sur batterie, le szstème invité peut ainsi 
-            l'économie d'énergie and signaler à l'utilisateur le temps restant 
-            (par exemple en modes plein écran).</para>
+            systèmes mobiles sur batterie, le système invité peut ainsi activer
+            l'économie d'énergie et signaler à l'utilisateur le temps restant 
+            (par exemple en mode plein écran).</para>
           </listitem>
 
           <listitem>
             <para><emphasis role="bold">résolutions sur plusieurs écrans.</emphasis>
             Les machines virtuelles VirtualBox supportent les résolutions d'écran
             sur autant d'écrans que d'écrans physiques, ce qui leur permet de
-            s'étaler sur une grande variété d'écrans reliés au szstème hôte.</para>
+            s'étaler sur une grande variété d'écrans reliés au système hôte.</para>
           </listitem>
 
           <listitem>
@@ -338,7 +338,7 @@
       <listitem>
         <para><emphasis role="bold">Multigénération d'instantanés en branches.
         </emphasis> VirtualBox peut sauvegarder des instantanés de votre choix de
-       l'état de la machine virtuelle. Vous pouvez revenir dans le passé and 
+       l'état de la machine virtuelle. Vous pouvez revenir dans le passé et 
        rétablir l'état de la machine virtuelle à n'importe quel instantané, puis
        démarrer une autre configuration de VM à partir de là, ce qui crée de fait
        une arborescence d'instantanés complète. Pour les
@@ -350,9 +350,9 @@
         une fonction de groupes permettant à l'utilisateur d'organiser les
         machines virtuelles en groupe ou individuellement. Outre les groupes
         classiques, il est également possible pour une VM d'être dans plus d'un
-        groupe et pour des groupes à nested dans une hiérarchie - c'est-à-dire
+        groupe et pour des groupes d'être classés dans une hiérarchie - c'est-à-dire
         des groupes de groupes. Les opérations faisables sur les groupes sont
-        génçralement les mêmes que celles applicables aux VMs individuelles,
+        généralement les mêmes que celles applicables aux VMs individuelles,
         à savoir le démarrage, la pause, la réinitialisation, la fermeture (état sauvegardé, envoyer une extinction,
         couper), désactiver l'état sauvegardé, afficher dans le système de
         fichiers, trier.</para>
@@ -360,8 +360,8 @@
       <listitem>
         <para><emphasis role="bold">Architecture propre&#xA0;; une modularité
         sans précédent.</emphasis> VirtualBox a un aspect extrêmement modulaire
-        avec des interfaces de programmation internes bien définies and une
-        séparation propre du code client and serveur. Cela facilite son contrôle
+        avec des interfaces de programmation internes bien définies et une
+        séparation propre du code client et serveur. Cela facilite son contrôle
         par plusieurs interfaces à la fois&#xA0;: par exemple, vous pouvez
         démarrer une VM en cliquant simplement sur un bouton de l'interface
         graphique de VirtualBox, puis contrôler cette machine à partir de la ligne
@@ -369,7 +369,7 @@
         <xref linkend="frontends" /> pour les détails.</para>
 
         <para>Du fait de son architecture modulaire, VirtualBox peut également
-        présenter toutes ses fonctionnalités and sa flexibilité de configuration
+        présenter toutes ses fonctionnalités et sa flexibilité de configuration
         dans un 
         <emphasis role="bold">kit de développement logiciel (SDK),</emphasis>
         cohérent qui permet d'intégrer tous les aspects de VirtualBox à d'autres
@@ -385,19 +385,19 @@
         départ dans Microsoft Windows, avec des suppléments spéciaux pour
         un support complet de l'USB sur le client.</para>
 
-        <para>Le VRDE de se base pas sur le serveur RDP construit dans 
+        <para>Le VRDE ne se base pas sur le serveur RDP construit dans 
         Microsoft Windows&#xA0;; mais il est inclu directement dans la couche de
         virtualisation. Il s'en suit qu'il fonctionne avec les systèmes
-        d'exploitation hôte différents de Ñindows (même en mode texte) and il
+        d'exploitation hôte différents de Windows (même en mode texte) et il
         n'a pas besoin non plus d'un support applicatif dans la machine
         virtuelle. Le VRDE est décrit en détail au <xref linkend="vrde" />.</para>
 
-        <para>Sur la base de cette possibilité spéciale, VirtualBox vous
-        offre plus de fonctionnalités uniques&#xA0;:<itemizedlist>
+        <para>En plus de cette possibilité, VirtualBox vous
+        offre les fonctionnalités uniques&#xA0;:<itemizedlist>
             <listitem>
               <para><emphasis role="bold">Authentification RDP Extensible.</emphasis> 
               VirtualBox supporte déjà Winlogon
-              sur Windows and PAM sur Linux pour l'anthentification RDP.
+              sur Windows et PAM sur Linux pour l'anthentification RDP.
               En outre, il inclut un SDK facile à utiliser qui vous permet de 
              créer des interfaces de votre choix pour d'autres méthodes 
              d'authentification&#xA0;; voir
@@ -435,41 +435,48 @@
             </listitem>
 
             <listitem>
-              <para>Windows Vista (32 bits and 64 bits<footnote>
+              <para>Windows Vista (32 bits et 64 bits<footnote>
                   <para>Le support pour Windows 64 bits a été ajouté avec VirtualBox
                   1.5.</para>
                 </footnote>).</para>
             </listitem>
 
             <listitem>
-              <para>Windows Server 2008 (32 bits and 64 bits)</para>
+              <para>Windows Server 2008 (32 bits et 64 bits)</para>
+            </listitem>
+            <listitem>
+              <para>Windows Server 2008 R2 (64 bits)</para>
             </listitem>
 
             <listitem>
-              <para>Windows 7 (32 bits and 64 bits)</para>
+              <para>Windows 8 (32 bits et 64 bits)</para>
             </listitem>
 
             <listitem>
-              <para>Windows 8 (32 bits and 64 bits)</para>
+              <para>Windows 8.1 (32 bits et 64 bits)</para>
             </listitem>
-            
+
             <listitem>
               <para>Windows Server 2012 (64 bits)</para>
             </listitem>
 
+            <listitem>
+              <para>Windows Server 2012 R2 (64 bits)</para>
+            </listitem>
+
           </itemizedlist></para>
       </listitem>
 
       <listitem>
         <para>Hôtes <emphasis role="bold">Mac OS X</emphasis>&#xA0;:<footnote>
-            <para>Le support préliminire de Mac OS X (étape beta) a été ajouté
+            <para>Le support préliminaire de Mac OS X (étape beta) a été ajouté
             avec VirtualBox 1.4, le support complet avec 1.6. Le support pour
             Mac OS X 10.4 (Tiger) a été supprimé avec VirtualBox 3.1.</para>
           </footnote></para>
 
         <itemizedlist>
           <listitem>
-            <para>10.6 (Snow Leopard, 32 bits and 64 bits)</para>
+            <para>10.6 (Snow Leopard, 32 bits et 64 bits)</para>
           </listitem>
 
           <listitem>
@@ -479,10 +486,13 @@
           <listitem>
             <para>10.8 (Mountain Lion, 64 bits)</para>
           </listitem>
+          <listitem>
+            <para>10.9 (Mavericks, 64 bits)</para>
+          </listitem>
 
         </itemizedlist>
 
-        <para>Il faut du matériel Intel&#xA0;; merci de voir aussi le <xref
+        <para>Du matériel Intel est requis&#xA0;; merci de voir aussi le <xref
         linkend="KnownIssues" />.</para>
       </listitem>
 
@@ -493,10 +503,11 @@
             1.4.</para>
           </footnote>). Cela inclut entre autres&#xA0;:<itemizedlist>
             <listitem>
-              <para>10.04 ("Lucid Lynx"), 10.10 ("Maverick Meerkat),
+              <para>Ubuntu 10.04 ("Lucid Lynx"), 10.10 ("Maverick Meerkat),
               11.04 ("Natty Narwhal"), 11.10 ("Oneiric Oncelot"),
               12.04 ("Precise Pangolin"), 12.10 ("Quantal Quetzal"),
-              13.04 ("Raring Ringtail")</para>
+              13.04 ("Raring Ringtail"), 13.10 ("Saucy Salamander"),
+              14.04 ("Trusty Tahr")</para>
             </listitem>
 
             <listitem>
@@ -508,11 +519,11 @@
             </listitem>
 
             <listitem>
-              <para>Redhat Enterprise Linux 5 and 6</para>
+              <para>Redhat Enterprise Linux 5 et 6</para>
             </listitem>
 
             <listitem>
-              <para>Fedora Core 6 à 17</para>
+              <para>Fedora Core 6 à 20</para>
             </listitem>
 
             <listitem>
@@ -520,11 +531,11 @@
             </listitem>
 
             <listitem>
-              <para>openSUSE 11.0, 11.1, 11.2, 11.3, 11.4, 12.1, 12.2</para>
+              <para>openSUSE 11.0, 11.1, 11.2, 11.3, 11.4, 12.1, 12.2, 13.1</para>
             </listitem>
 
             <listitem>
-              <para>Mandriva 2010 et 2011</para>
+              <para>Mandriva 2011</para>
             </listitem>
           </itemizedlist></para>
 
@@ -535,8 +546,8 @@
         Linux formellement testées et supportées sont celles pour lesquelles
         nous offrons un paquet dédié.</para>
 
-        <para>Remarquez qu'à partir de VirtualBox 2.1, les szstèmes d'exploitation
-        hôtes Linux basés sur le noyau 2.4 ne sont plus supportées.</para>
+        <para>Remarquez qu'à partir de VirtualBox 2.1, les systèmes d'exploitation
+        hôtes Linux basés sur le noyau 2.4 ne sont plus supportés.</para>
       </listitem>
 
       <listitem>
@@ -564,10 +575,10 @@
     <title>Installer VirtualBox et les packs d'extension</title>
 
     <para>VirtualBox est fourni dans de nombreux paquets et son installation
-    dépend de votre szstème d'exploitation hôte. Si vous avez déjà installé ce
+    dépend de votre système d'exploitation hôte. Si vous avez déjà installé ce
     logiciel, l'installation devrait être facile&#xA0;: pour chaque plateforme hôte,
-    VirtualBox utilise la méthode d'installation la plus courante facile possible.
-    Si vous av5z un problème ou des besoins particuliers, reportez vous à la
+    VirtualBox utilise la méthode d'installation la plus facile possible.
+    Si vous avez un problème ou des besoins particuliers, reportez vous à la
     <xref linkend="installation" /> pour des détails sur les différentes
     méthodes d'installation.</para>
 
@@ -597,7 +608,11 @@
               </listitem>
 
               <listitem>
-                <para>Amorçage Intel PXE ROM avec support pour la carte réseau E1000.</para>
+                <para>Webcam hôte passthrough; voir le chapitre <xref
+                linkend="webcam-passthrough" />.</para>
+              </listitem>
+              <listitem>
+                <para>Amorçage Intel PXE ROM.</para>
               </listitem>
 
               <listitem>
@@ -613,9 +628,9 @@
           du paquet et une fenêtre de gestion des opérations réseaux apparaîtra,
           vous guidant à travers les étapes nécessaires.</para>
 
-          <para>Pour voir les packs d'extension actuellement installés,
+          <para>Pour voir les paquets d'extension actuellement installés,
           merci de démarrer le gestionnaire VirtualBox (voir la prochaine section). 
-          Dans le menu "Fichier", merci de sélectionner "Préférences". Dans
+          Dans le menu "Fichier", merci de sélectionner "Paramètres". Dans
           la fenêtre qui apparaît, allez à la catégorie "Extensions" qui
           affiche les extensions actuellement installées et vous permet de
           supprimer un paquet ou d'en ajouter un.</para>
@@ -653,7 +668,7 @@
 
         <listitem>
           <para>Sur un hôte Linux ou Solaris, selon votre environnement de
-          bureau, une icône "VirtualBox" peut avoir été mis soit dans le groupe
+          bureau, une icône "VirtualBox" peut avoir été mise soit dans le groupe
           "Système" soit dans "Outils système" de votre menu "Applications". Sinon
           vous pouvez taper 
           <computeroutput>VirtualBox</computeroutput> dans un terminal.</para>
@@ -716,7 +731,7 @@
 
         <listitem>
           <para>Pour le <emphasis role="bold">"Type de système d'exploitation",</emphasis>
-          sélectiennez le système d'exploitation que vous voudrez installer plus
+          sélectionnez le système d'exploitation que vous voudrez installer plus
           tard. Les systèmes d'exploitation supportés sont ici regroupés&#xA0;; 
           si vous voulez installer une chose très rare et non listé, sélectionnez
           "Autre". Selon votre sélection, VirtualBox activera ou désactivera
@@ -728,9 +743,9 @@
 
         <listitem>
           <para>Sur la page suivante, sélectionnez la <emphasis role="bold">mémoire
-          (RAM)</emphasis> que irtualBox devra affecter à chaque fois que la
-          machine virtuelle sera démarrée. La quantité de mémoire donnée ici sera
-          retirée de votre machine hôte laissée au système d'exploitation invité,
+          (RAM)</emphasis> que VirtualBox devra affecter à chaque fois que la
+          machine virtuelle sera démarrée. La quantité de mémoire indiquée ici sera
+          soustraite de celle de votre machine hôte et attribuée au système d'exploitation invité,
           lequel verra cette mémoire comme RAM installée sur l'ordinateur (virtuel).</para>
 
           <para><note>
@@ -757,8 +772,8 @@
           <para>La règle d'or est donc que si vous avez 1 Go de RAM voire plus
           dans votre ordinateur hôte, il est sûr d'affecter 512 Mo à chaque 
           VM. Mais dans tous les cas, assurez-vous d'avoir au moins 256 à 512
-          Mo de RAM sur votre szstème d'exploitation hôte. Sinon, il se peut que
-          vous ne votre OS hôte fasse un usage excessif de l'espace d'échange sur votre disque 
+          Mo de RAM sur votre système d'exploitation hôte. Sinon, il se peut que
+          l'OS hôte fasse un usage excessif de l'espace d'échange sur votre disque 
           dur, ce qui peut conduire à un plantage de votre système hôte.</para>
 
           <para>Comme avec les autres paramètres, vous pourrez modifier ce
@@ -766,7 +781,7 @@
         </listitem>
 
         <listitem>
-          <para>Ensuite vous devez spécifier un <emphasis role="bold">disqke dur
+          <para>Ensuite vous devez spécifier un <emphasis role="bold">disque dur
           virtuel</emphasis> pour votre VM.</para>
 
           <para>Il existe de nombreuses façons, potentiellement compliquées, de
@@ -806,8 +821,8 @@
                 actuellement attachées à une machine virtuelle (ou elles l'ont
                 jadis été).</para>
 
-                <para>Vous pouvez aussi cliquer sur le petit <emphasis
-                role="bold">bouton dossier</emphasis> à côté de la boîte à liste
+                <para>Vous pouvez aussi cliquer sur le petit bouton<emphasis
+                role="bold">dossier</emphasis> à côté de la boîte à liste
                 déroulante pour ouvrir une boîte de dialogue de fichier standard
                 qui vous permet de choisir un fichier image de disque sur le
                 disque de votre hôte.</para>
@@ -833,7 +848,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
               <listitem>
                 <para>Un <emphasis role="bold">fichier à taille fixe</emphasis>
                 occupera immédiatement l'espace spécifié même si seule une partie
-                de l'espace disque virtuel est en réalité utilisée. S'il occupera
+                de l'espace disque virtuel est en réalité utilisée. Si il occupe
                 beaucoup plus de place, un fichier à taille fixe connaît moins de
                 latence et il va donc légèrement plus vite qu'un fichier rempli
                 dynamiquement.</para>
@@ -864,7 +879,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
         </listitem>
 
         <listitem>
-          <para>Après avoir cliqué sur <emphasis role="bold">"Terminer"</emphasis>,
+          <para>Après avoir cliqué sur <emphasis role="bold">"Créer"</emphasis>,
           votre nouvelle machine virtuelle sera créée. Vous la verrez alors
           dans la liste à gauche de la fenêtre du gestionnaire, avec le nom
           que vous avez entré au départ.</para>
@@ -877,7 +892,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
 
     <para>Pour démarrer une machine virtuelle, vous avez plusieurs choix&#xA0;:<itemizedlist>
         <listitem>
-          <para>Cliquez deux fois sur son entrée dans la liste dans a fenêtre du
+          <para>Cliquez deux fois sur son entrée dans la liste dans la fenêtre du
           gestionnaire ou</para>
         </listitem>
 
@@ -941,7 +956,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
           vierge et poursuivre comme on vient de décrire. Mais avec VirtualBox,
           vous pouvez passer cette étape et monter le fichier ISO directement.
           VirtualBox présentera ce fichier comme un lecteur de CD ou de DVD-ROM
-          à lamachine virtuelle, comme il le fait avec une image de disque dur virtuel.</para>
+          à la machine virtuelle, comme il le fait avec une image de disque dur virtuel.</para>
 
           <para>Dans ce cas, la liste déroulante de l'assistant contient la liste
           des médias d'installation qui ont été précédemment utilisés avec VirtualBox.</para>
@@ -1080,13 +1095,13 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
           (Windows comme Linux l'interceptent), et l'appui sur cette  combinaison
           de touches redémarrera donc votre <emphasis>hôte</emphasis>.</para>
 
-          <para>De plus, sur les systèmes on Linux et Solaris, qui utilise le
+          <para>De plus, sur les systèmes Linux et Solaris, qui utilise le
           système X Window, la combinaison de touches <emphasis
           role="bold">Ctrl+Alt+Effacement</emphasis> redémarrent en général le
-          serveur X (pour relancer toute vinterface graphique en cas de problème).
+          serveur X (pour relancer toute interface graphique en cas de problème).
           Comme le serveur X intercepte cette combinaison, l'appui sur ces touches
           relancera en général votre interface graphique <emphasis>hôte</emphasis> 
-          (et tuera tous les programmes, dont VirtualBox, dans le processus).</para>
+          (et tuera tous les programmes, dont VirtualBox, dans l'opération).</para>
 
           <para>Par ailleurs, sur les hôtes Linux qui supportent les terminaux
           virtuels, la combinaison de touches <emphasis role="bold">Ctrl+Alt+Fx</emphasis>
@@ -1120,7 +1135,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
                   <listitem>
                     <para><emphasis role="bold">Touch hôte +
                     Effacement</emphasis> pour envoyer Ctrl+Alt+Effacement (pour
-                    redémarrer l'interface graphique 'un invité Linux ou Solaris)&#xA0;;</para>
+                    redémarrer l'interface graphique d'un invité Linux ou Solaris)&#xA0;;</para>
                   </listitem>
 
                   <listitem>
@@ -1138,7 +1153,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
           <para>Pour d'autres combinaisons de touches telles que <emphasis
           role="bold">Alt-Tab</emphasis> (pour basculer entre des fenêtres
           ouvertes), VirtualBox vous permet de configurer si ces combinaisons
-          concerneront vhôte ou l'invité, si la machine virtuelle a
+          concerneront l'hôte ou l'invité, si la machine virtuelle a
           le focus. C'est un paramètre global de toutes les machines virtuelles
           qui se trouve dans "Fichier" -> "Préférences" -> "Entrée" ->
           "Capture automatique du clavier".</para>
@@ -1152,7 +1167,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
       <para>Pendant qu'une machine virtuelle fonctionne, vous pouvez changer de
       média amovible dans le menu "Périphériques" de la fenêtre de la VM.
       Vous pouvez y sélectionner en détail ce que VirtualBox présente à votre
-      VM en tant que CD, DVD, ou 4isquette.</para>
+      VM en tant que CD, DVD, ou disquette.</para>
 
       <para>Les paramètres sont les mêmes que ceux disponibles pour la VM dans
       la boîte de dialogue "Paramètres" de la fenêtre principale de VirtualBox,
@@ -1192,7 +1207,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
             d'affichage, appuyez sur Majuscule pendant l'opération de
             redimensionnement.</para>
 
-            <para>Merci de voir le <xref linkend="KnownIssues" /> pour des
+            <para>Merci de voir <xref linkend="KnownIssues" /> pour des
             remarques supplémentaires.</para>
           </listitem>
 
@@ -1201,12 +1216,12 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
             le <emphasis role="bold">redimensionnement</emphasis> automatique,
             les suppléments invité ajusteront automatiquement la résolution de 
             l'écran du système d'exploitation invité. Par exemple, si vous
-            exécutez un invité Windows 1rc une résolution de 1024x768 pixels et
+            exécutez un invité Windows avec une résolution de 1024x768 pixels et
             si vous élargissez la fenêtre de la VM de 100 pixels, les suppléments
             invité passeront la résolution de l'affichage de Windows en
             1124x768.</para>
 
-            <para>Merci de voir le <xref linkend="guestadditions" /> pour plus
+            <para>Merci de voir <xref linkend="guestadditions" /> pour plus
             d'informations sur les suppléments invité.</para>
           </listitem>
 
@@ -1258,12 +1273,12 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
         </listitem>
 
         <listitem>
-          <para><emphasis role="bold">PCouper la machine&#xA0;:</emphasis> Avec
+          <para><emphasis role="bold">Couper la machine&#xA0;:</emphasis> Avec
           cette option, VirtualBox arrête aussi l'exécution de la machine virtuelle,
           mais <emphasis>sans</emphasis> sauvegarder son état.<warning>
               <para>Cela revient à débrancher le câble d'alimentation d'un
               vrai ordinateur sans l'éteindre correctement. Si vous redémarrez
-              la machine après l'avoir coupée, votre szstème d'exploitation devra
+              la machine après l'avoir coupée, votre système d'exploitation devra
               redémarrer complètement et il se peut qu'il fasse une vérification
               de ses disques systèmes (virtuels). Vous ne devriez donc pas le
               faire car cela peut conduire à une perte de données ou à un état
@@ -1273,13 +1288,13 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
           <para>Par exception, si votre machine virtuelle a des instantanés (voir
           le prochain chapitre), vous pouvez utiliser cette option pour <emphasis
           role="bold">restaurer l'instantané actuel</emphasis> de la
-          machine virtuelle rapidement. Dans ce cas, couper lamachine ne dégradera
+          machine virtuelle rapidement. Dans ce cas, couper la machine ne dégradera
           pas son état mais seules les modifications faites depuis que vous
           avez pris l'instantané seront perdues.</para>
         </listitem>
       </itemizedlist>
 
-      <para>Le bouton <emphasis role="bold">"Désactiver"</emphasis> de la fenêtre
+      <para>Le bouton <emphasis role="bold">"Oublier"</emphasis> de la fenêtre
       du gestionnaire de VirtualBox Manager désactive un état sauvegardé de la 
       machine virtuelle. Cela a le même effet que de couper la machine, donc les
       mêmes avertissements s'appliquent.</para>
@@ -1399,7 +1414,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
 
             <para>Dans tous les cas, une fenêtre apparaîtra et vous demandera un
             nom d'instantané. Ce nom a une finalité purement de référence pour
-            vous aider à vous souvenir de l'état de l'instantané. Par exemple, unnom utile
+            vous aider à vous souvenir de l'état de l'instantané. Par exemple, un nom utile
             serait "Installation neuve à partir de rien, pas de suppléments 
            invité", ou "Pack service à peine installé". Vous pouvez aussi ajouter
            un texte plus long dans le champ "Description" si vous le voulez.</para>
@@ -1419,7 +1434,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
 
             <para>VirtualBox n'impose aucune limite quant au nombre d'instantanés
             que vous pouvez prendre. La seule limite pratique est l'espace disque
-            sur votre rôte&#xA0;: chaque instantané stocke l'état de l machine
+            sur votre hôte&#xA0;: chaque instantané stocke l'état de la machine
             virtuelle et occupe donc de l'espace disque (voir la prochaine section
             pour des détails sur ce qui est stocké exactement dans un instantané.)</para>
           </listitem>
@@ -1427,7 +1442,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
           <listitem>
             <para>Vous pouvez <emphasis role="bold">restaurer un instantané</emphasis>
             en effectuant un clic droit sur un instantané que vous avez pris dans la
-            liste des instantanés. Un restaurant un instantané, vous revenez en arrière (ou
+            liste des instantanés. En restaurant un instantané, vous revenez en arrière (ou
             vous reculez) dans le temps&#xA0;: l'état actuel de la machine est
             perdu et la machine est restaurée dans l'état exact où elle était
             quand vous avez pris l'instantané.<footnote>
@@ -1478,7 +1493,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
             on peut même effacer des instantanés pendant qu'une machine fonctionne.<note>
                 <para>Si la prise et la restauration d'instantanés sont des 
                 opérations très rapides, l'effacement d'un instantané peut mettre
-                temps considérable car de grandes quantité de données peuvent être
+                un temps considérable car de grandes quantité de données peuvent être
                 copiées entre plusieurs fichiers images de disques. Il se peut
                 que les fichiers de disque temporaires aient besoin de beaucoup de
                 place pendant le déroulement de l'opération.</para>
@@ -1525,8 +1540,8 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
             techniquement, ce n'est pas le disque dur virtuel lui-même qui est
             restauré quand on restaure un instantané. En fait, quand on prend
             un instantané, VirtualBox crée des images de différenciation contenant
-            seulement les modifications depuis que l'instantané a été pris, puis le
-            instantané$ est restauré, VirtualBox applique cette image de différenciation,
+            seulement les modifications depuis que l'instantané a été pris, puis 
+            l'instantané est restauré, VirtualBox applique cette image de différenciation,
             revenant ainsi en arrière vers l'état précédent. Ceci est non seulement
             plus rapide, mais cela utilise moins d'espace disque. Pour les
             détails, qui peuvent être complexes, merci de voir le
@@ -1564,7 +1579,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
     cette machine.</para>
 
     <para>Un clic sur le bouton "Paramètres" dans la barre d'outils en haut
-    ouvre une fenêtre détaillée où vous pouvez can configurer de nombreuses
+    ouvre une fenêtre détaillée où vous pouvez configurer de nombreuses
     propriétés de la VM sélectionnée. Mais attention, bien qu'il soit possible 
     de modifier tous les paramètres de la VM après avoir installé un système
     d'exploitation invité, certaines modifications pourraient empêcher un système
@@ -1674,7 +1689,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
   <sect1 id="ovf">
     <title>Importer et exporter des machines virtuelles</title>
 
-    <para>VirtualBox peut importer et exporter des machines virtuaelles au
+    <para>VirtualBox peut importer et exporter des machines virtuelles au
     format du standard industriel Open Virtualization Format (OVF).<footnote>
         <para>Le support d'OVF a été introduit à l'origine avec VirtualBox 2.2
         et a connu des améliorations essentielles au fur et à mesure des versions
@@ -1684,7 +1699,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
     <para>OVF est un standard de plateforme croisée supporté par de nombreux
     produits de virtualisation, permettant de créer des machines virtuelles prêtes
     à l'emploi importables ensuite dans un virtualiseur tel que VirtualBox. VirtualBox 
-    facilite l'expertation et l'importation d'OVF, en y donnant un accès et un
+    facilite l'exportation et l'importation d'OVF, en y donnant un accès et un
     support depuis la fenêtre du gestionnaire et son interface en ligne de
     commande. Cela permet d'empaqueter ce qu'on appelle des
     <emphasis role="bold">applicatifs virtuels</emphasis>&#xA0;: des images de
@@ -1760,18 +1775,18 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
 
     <para>Inversement, pour <emphasis role="bold">exporter</emphasis> des
     machines virtuaelles déjà présentes dans VirtualBox, sélectionnez "Fichier"
-    -> "Exporter un applicatif". Une boîte de dialogue apparaîtra vous permettant de
+    -> "Exporter application virtuelle". Une boîte de dialogue apparaîtra vous permettant de
     mettre plusieurs machines virtuelles dans un applicatif OVF. Puis, sélectionnez
     la destination où stocker les fichiers cibles, le processus de conversion
-    commence. Cela peut mettre encore du temps.</para>
+    commence. Cela peut mettre aussi du temps.</para>
 
     <para>Pour savoir comment exporter une image en ligne de commande, merci de
     voir <xref
     linkend="vboxmanage-export" />.<note>
         <para>OVF ne peut pas décrire d'instantanés pris pour une 
         machine virtuelle. Il s'en suit que lorsque vous exportez une machine
-        virtuelle avec des instantanés, seul vétat actuel de la machine sera
-        exporté et les images de disque de l'export seront dans l'éta
+        virtuelle avec des instantanés, seul l'état actuel de la machine sera
+        exporté et les images de disque de l'export seront dans l'état
         "applati", identique à l'état actuel de la machine virtuelle.</para>
       </note></para>
   </sect1>
@@ -1780,7 +1795,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
     <title>Paramètres globaux</title>
     <para>Vous pouvez atteindre la boîte de dialogue des paramètres globaux par
     le menu <emphasis role="bold">Fichier</emphasis>, en sélectionnant l'élément
-    <emphasis role="bold">Préférences...</emphasis>. Elle offre une sélection
+    <emphasis role="bold">Préférences...</emphasis> (NdT&#xA0;: ou Paramètres selon la version). Elle offre une sélection
     de paramètres qui s'appliquent à toutes les machines virtuelles de l'utilisateur
     actuel ou, s'il y a des <emphasis role="bold">Extensions</emphasis>, à tout
     le système&#xA0;:
@@ -1864,7 +1879,7 @@ x            </itemizedlist>Vraisemblablement, si vous utilisez VirtualBox pour
           conçu pour n'afficher que des machines virtuelles contrôlées en détail
           avec <computeroutput>VBoxManage</computeroutput>. C'est intéressant pour
           des environnements professionnels où l'affichage de tous les gadgets
-          les boutons de l'interface graphique complète n'est pas faisable.
+          graphique n'est pas envisageable.
           <computeroutput>VBoxSDL</computeroutput> est décrit au <xref
           linkend="vboxsdl" />.</para>
         </listitem>
diff --git a/doc/manual/fr_FR/user_KnownIssues.xml b/doc/manual/fr_FR/user_KnownIssues.xml
index e0680ec..94ddbc1 100644
--- a/doc/manual/fr_FR/user_KnownIssues.xml
+++ b/doc/manual/fr_FR/user_KnownIssues.xml
@@ -6,7 +6,7 @@
     <sect1 id="ExperimentalFeatures">
         <title>Fonctions expérimentales</title>
         <para>Certaines fonctions de VirtualBox sont étiquetées comme étant
-        expérimentales. De telles fonctions sont offertes sur une base "as-is"
+        expérimentales. De telles fonctions sont offertes sur une base "tel quel"
         et elles ne sont pas formellement supportées. Cependant, des retours
         et les suggestions sur ces fonctions sont bienvenus. Voici une liste complète
         des fonctions expérimentales&#xA0;:</para>
@@ -25,7 +25,7 @@
                 PCI pass-through (hôtes Linux uniquement)
             </listitem>
             <listitem>
-                Invités Mac OS X (hôtes hosts uniquement)
+                Invités Mac OS X (hôtes Mac uniquement)
             </listitem>
             <listitem>
                 Émulation du chipset ICH9
@@ -69,7 +69,7 @@
                 qui n'incluent pas le support de l'optimisation matérielle APIC
                 virtuel. Cela concerne surtout les invités Windows et Solaris,
                 mais probablement également certaines révisions du noyau Linux.
-                Corrigé partiellement dans la 3.0.12 pours les invités Windows NT,
+                Corrigé partiellement dans la 3.0.12 pour les invités Windows NT,
                 2000, XP et 2003 32 bits. Exige l'installation des suppléments
                 invité 3.0.12 ou supérieur.</para>
           </listitem>
@@ -77,15 +77,7 @@
         </listitem>
     
         <listitem>
-          <para><emphasis role="bold">Invités 64 bits sur des systèmes hôtes
-          32 bits avec VT-x</emphasis> peut provoquer des instabilités sur votre
-          système. Si vous vivez cela, n'essayez pas d'exécuter des invités 64 bits.
-          Reportez-vous au forum des utilisateurs de VirtualBox pour des
-          informations supplémentaires.</para>
-        </listitem>
-
-        <listitem>
-          <para><emphasis role="bold">NX (empêche l'exécution et l'exécution de
+          <para><emphasis role="bold">NX (ne s'éxécute pas ou empêche le traitement de
           données)</emphasis> ne fonctionne que sur les invités en fonction
           sur des hôtes 64 bits ou sur des hôtes 32 bits ayant activé PAE et la
           virtualisation matérielle doit être activée.</para>
@@ -125,7 +117,7 @@
         <listitem>
           <para><emphasis role="bold">La compression d'images de disques virtuels
           est limitée aux fichiers VDI.</emphasis> La commande <code>VBoxManage modifyhd --compact</code>
-          n'est actuellement implémentée que les fichiers VDi. Pour l'instant,
+          n'est actuellement implémentée que pour les fichiers VDi. Pour l'instant,
           la seule façon d'optimiser la taille des images de disques virtuels
           dans d'autres formats (VMDK, VHD) est de cloner l'image puis d'utiliser
           l'image clonée dans la configuration de la VM.</para>
@@ -134,8 +126,8 @@
         <listitem>
           <para><emphasis role="bold">import/export d'OVF&#xA0;:</emphasis><itemizedlist>
               <listitem>
-                <para>La localisation des OVF (plusieurs langues dans un fichier
-                OVF) n'est pas encoresupportée.</para>
+                <para>La particularisation des OVF (plusieurs langues dans un fichier
+                OVF) n'est pas encore supportée.</para>
               </listitem>
     
               <listitem>
@@ -144,7 +136,7 @@
               </listitem>
     
               <listitem>
-                <para>Les documents de venvironnement OVF, y compris leurs
+                <para>Les documents d'environnement OVF, y compris leurs
                 sections de propriétés et la configuration d'applicatifs avec des
                 images ISO, ne sont pas encore supportés.</para>
               </listitem>
@@ -160,7 +152,7 @@
           <para>Ni le <emphasis role="bold">mode échelonné</emphasis> ni <emphasis
           role="bold">le mode transparent</emphasis> ne fonctionnent bien avec les
           invités qui utilisent les fonctions 3D d'OpenGL (telles que celles 
-          avec les gets:nnnaires de fenêtres ayant activé compiz).</para>
+          avec les gestionnaires de fenêtres ayant activé compiz).</para>
         </listitem>
     
         <listitem>
@@ -233,8 +225,14 @@
                 de démarrage. Remarquez qu'il y a de nombreux messages et toutes
                 les erreurs ne sont pas fatales (elles s'afficheraient aussi 
                 sur votre Mac physique). Vous pouvez désactiver ces messages en
-                lançant cette commande&#xA0;:<screen>VBoxManage setextradata "nom VM" "VBoxInternal2/EfiBootArgs" "  "</screen>To
-                revert to the previous behavior, use:<screen>VBoxManage setextradata "nom VM" "VBoxInternal2/EfiBootArgs" ""</screen></para>
+                lançant cette commande&#xA0;:<screen>VBoxManage setextradata "nom VM" "VBoxInternal2/EfiBootArgs" "  "</screen>Pour
+                revenir à l'ancien comportement, utilisez :<screen>VBoxManage setextradata "nom VM" "VBoxInternal2/EfiBootArgs" ""</screen></para>
+              </listitem>
+
+              <listitem>
+                <para>Il n'est actuellement pas possible de démarrer un invité
+                Mac OS X en mode sécurité en spécifiant l'option "-x" dans la donnée
+                externe "VBoxInternal2/EfiBootArgs".</para>
               </listitem>
             </itemizedlist></para>
         </listitem>
@@ -254,6 +252,12 @@
               </listitem>
     
               <listitem>
+                <para>Le passthrough de la webcam hôte se limite aux résolutions
+                640x480 avec 20 images par secondes à cause de limites de l'API
+                V4L2 de Solaris. Il se peut que cela change dans une future
+                version de Solaris.</para>
+              </listitem>
+              <listitem>
                 <para>Aucune informations d'ACPI (état de la batterie, source
                 d'énergie) n'est signalée à l'invité.</para>
               </listitem>
@@ -263,20 +267,20 @@
               </listitem>
     
               <listitem>
-                <para>Le rùseau bridgé basé sur Crossbow sur les hôtes Solaris
+                <para>Le réseau bridgé basé sur Crossbow sur les hôtes Solaris
                 ne fonctionne pas directement avec les liens agrégés. Cependant,
                 vous pouvez créer à la main un VNIC (en utilisant
                 <computeroutput>dladm</computeroutput>) via le lien agrégé et
-                utilisez-le avec une VM. Cette limite technique sera corrigée
-                dans une future version de Solaris 11.</para>
+                utilisez-le avec une VM. Cette limite n'exfste pas dans Solaris
+              11u1 build 17 et supérieur.</para>
               </listitem>
             </itemizedlist></para>
         </listitem>
         
         <listitem>
           <para><emphasis role="bold">Suppléments invité de la version 4.1, 4.1.2 et 4.1.4 pour Windows</emphasis>
-          Il se peut que le pilote graphique WDDM de VirtualBox peut être 
-          installé et gardé dans le sysstème invité après la désinstallation des
+          Il se peut que le pilote graphique WDDM de VirtualBox ait été 
+          installé et soit gardé dans le système invité après la désinstallation des
           suppléments invité. Cela vient d'un bogue du désinstalleur des suppléments
           invité. 
           
@@ -304,7 +308,7 @@
           <para>Ni le pilote <emphasis>virtio</emphasis> ni <emphasis>Intel PRO/1000
             </emphasis> des <emphasis role="bold">invités Windows XP</emphasis> 
             ne supportent la segmentation hors charge (offloading). Donc,
-            les invités Windows XP unt des vitesses de transmission plus lentes
+            les invités Windows XP ont des vitesses de transmission plus lentes
             que d'autres types d'invités. Reportez-vous à l'article 842264
             du MS Knowledge base pour des informations supplémentaires.</para>
         </listitem>
diff --git a/doc/manual/fr_FR/user_Networking.xml b/doc/manual/fr_FR/user_Networking.xml
index b518249..9c3ffcc 100644
--- a/doc/manual/fr_FR/user_Networking.xml
+++ b/doc/manual/fr_FR/user_Networking.xml
@@ -62,7 +62,7 @@
     PRO/1000 ont été choisis pour certains types de systèmes d'exploitation invités
     qui n'incluent plus de pilotes pour la carte PCNet, tel que Windows Vista.</para>
 
-    <para>Le type Intel PRO/1000 MT Desktop fonctionne avec Windows Vista aet
+    <para>Le type Intel PRO/1000 MT Desktop fonctionne avec Windows Vista et
     les versions supérieures. La variante T Server de la carte Intel PRO/1000 
     est reconnue par les invités Windows XP sans installer de pilotes supplémentaires.
     La variante MT Server facilite les imports d'OVF à partir d'autres plateformes.</para>
@@ -82,9 +82,9 @@
 
     <para><itemizedlist>
         <listitem>
-          <para>Les noyaux Linux version 2.6.25 ou supçrieur peuvent être configurés
+          <para>Les noyaux Linux version 2.6.25 ou supérieur peuvent être configurés
           pour fournir le support virtio&#xA0;; certaines distributions ont
-          back-porté aussi virtio dans d'anciens noyaux.</para>
+          adpaté aussi virtio dans d'anciens noyaux.</para>
         </listitem>
 
         <listitem>
@@ -99,12 +99,12 @@
     <para>VirtualBox contient aussi un support limité pour ce qu'on appelle
     <emphasis role="bold">jumbo frames</emphasis>, c'est-à-dire les paquets
     réseaux de plus de 1500 octets de données, si vous utilisez le réseau Intel
-    de virtualisation bridgé. En d'autres termes, jumbo frames ne sont pas
-    supportés avec les périphériques réseaux AMD&#xA0;; dans ce cas, jumbo
-    packets will seront rejetés en silence côté récepteur et transmetteur.
+    de virtualisation bridgé. En d'autres termes, jumbo frames n'est pas
+    supporté avec les périphériques réseaux AMD&#xA0;; dans ce cas, les paquets jumbo
+     seront rejetés en silence tant côté récepteur que transmetteur.
     Les systèmes d'exploitation invités qui essaient d'utiliser cette fonctionnalité
     verront cela comme une perte de paquets, ce qui peut provoquer un comportement
-    inattendu de l'application dans l'invité. Cela ne pose pas problème avec les
+    inattendu de l'application dans l'invité. Cela ne pose pas de problème avec les
     systèmes d'exploitation invités dans leur configuration par défaut, vu que
     jumbo frames doit être explicitement activé.</para>
   </sect1>
@@ -123,7 +123,7 @@
             Ethernet n'était branché dans la carte. De cette façon, il est possible
             de "retirer" le câble réseau virtuel Ethernet et de couper la
             connexion, ce qui peut être utile pour informer un système d'exploitation 
-            invité qu'aucune connexion réseau n'est disponible, et ceci renforce une
+            invité qu'aucune connexion réseau n'est disponible et forcer une
             reconfiguration.</para>
           </glossdef>
         </glossentry>
@@ -193,7 +193,7 @@
           <glossdef>
             <para>Mode rarement utilisé, il partage la même interface réseau 
             générique en permettant à l'utilisateur de sélectionner un pilote qui
-            seut être inclu dans VirtualBox ou distribué dans un pack d'extension.</para>
+            peut être inclu dans VirtualBox ou distribué dans un pack d'extension.</para>
 
             <para>Pour l'instant, il existe potentiellement deux sous-modes
             disponibles&#xA0;:</para>
@@ -238,8 +238,8 @@
     n'exige aucune configuration sur le réseau hôte ou le système invité. C'est
     pourquoi c'est le mode réseau par défaut de VirtualBox.</para>
 
-    <para>Une machine virtuelle dont NAT est activé agit exactement comme un vrai
-    ordinateur qui se connect5 à Internet par un routeur. Le "routeur", dans
+    <para>Une machine virtuelle où NAT est activé agit exactement comme un vrai
+    ordinateur qui se connecte à Internet par un routeur. Le "routeur", dans
     ce cas, est le moteur réseau de VirtualBox, qui dirige le trafic depuis et
     vers la machine virtuelle de façon transparente. Dans VirtualBox, ce routeur
     se place entre chaque machine virtuelle et l'hôte. Cette séparation maximise
@@ -251,20 +251,20 @@
     depuis le réseau extérieur&#xA0;; vous ne pouvez pas lancer de serveur de 
     cette façon, sauf si vous réglez une redirection de ports (décrite ci-dessous).</para>
 
-    <para>Les blocs réseaux envoyés par le système d'exploitation invité sont reçus
+    <para>Les trames réseaux envoyés par le système d'exploitation invité sont reçus
     par le moteur NAT de VirtualBox qui extrait les données TCP/IP et les envoie
     en utilisant le système d'exploitation hôte. Pour une application de l'hôte
     ou un autre ordinateur du même réseau comme l'hôte, cela fonctionne comme
     si des données étaient envoyées par l'application VirtualBox de l'hôte,
     en utilisant une adresse IP appartenant à l'hôte. VirtualBox écoute les
-    réponses aux paquets envoyés et les les réempaquète et les renvoie à la machine invitée
+    réponses aux paquets envoyés et les réempaquète et les renvoie à la machine invitée
     sur son réseau privé.</para>
 
     <para>La machine virtuelle reçoit son adresse et sa configuration réseau
     sur le réseau privé à partir d'un serveur DHCP intégré à VirtualBox. L'adresse
     IP ainsi affectée à la machine virtuelle se trouve en général sur un réseau
     complètement différent de l'hôte. On peut paramétrer l'utilisation de NAT
-    pour autant de cartes qu'a une machine virtuelle, la première carte est
+    pour autant de cartes dont dispose la machine virtuelle, la première carte est
     connectée au réseau privé sur 10.0.2.0, la deuxième carte sur 10.0.3.0 et
     ainsi de suite. Si vous avez besoin de modifier la plage d'adresses affectées
     à l'invité pour une raison quelconque, merci de vous reporter à la
@@ -288,7 +288,7 @@
       que vous ne pouvez pas lancer le même service sur les mêmes ports de
       l'hôte. Néanmoins, vous pouvez toujours tirer parti de lancer un service
       dans une machine virtuelle -- par exemple, les services de la machine hôte
-      ou d'autres machines virtuelles ne peuvent pas -être atteintes ou plantées
+      ou d'autres machines virtuelles ne peuvent pas être atteints ou plantés
       par une faille ou un bogue du service, et le service peut fonctionner dans
       un autre système d'exploitation que le système hôte.</para>
 
@@ -303,7 +303,7 @@
       <computeroutput>VBoxManage</computeroutput>&#xA0;; pour les détails, merci
       de vous reporter au <xref linkend="vboxmanage-modifyvm" />.</para>
 
-      <para>Vous devrez savoir les ports de l'invité utilisés par les services
+      <para>Vous devrez connaître les ports de l'invité utilisés par les services
       de l'invité et décider des ports à utiliser sur l'hôte (souvent, mais pas
       toujours, vous voudrez utiliser les mêmes ports sur l'invité et sur l'hôte).
       Vous pouvez utiliser n'importe quel port de l'hôte qui ne sont pas déjà
@@ -313,7 +313,7 @@
       l'exemple ci-dessus, tout le trafic TCP arrivant sur le port 2222 de
       n'importe quelle interface de l'hôte sera redirigé sur le port 22 de
       l'invité. Le nom du protocole <computeroutput>tcp</computeroutput> est un
-      attribut obligatoire définissant le protocole qu'il faudrait utiliser pour
+      attribut obligatoire définissant le protocole à utiliser pour
       la redirection (on pourrait utiliser <computeroutput>udp</computeroutput>).
       Le nom <computeroutput>guestssh</computeroutput> est purement descriptif
       et il sera auto-généré si vous n'en mettez pas. Le numéro après
@@ -342,13 +342,13 @@
     </sect2>
 
     <sect2 id="nat-tftp">
-      <title>Démarrer avec PXE avec NAT</title>
+      <title>Démarrer avec PXE et NAT</title>
 
       <para>Le démarrage avec PXE est désormais supporté en mode NAT. Le serveur
       DHCP de NAT fournit un fichier d'amorçage dont le nom ressemble à
       <computeroutput>nomvm.pxe</computeroutput> si le répertoire 
       <computeroutput>TFTP</computeroutput> existe dans le répertoire où se trouve
-      le bichier <computeroutput>VirtualBox.xml</computeroutput> de l'utilisateur.
+      le fichier <computeroutput>VirtualBox.xml</computeroutput> de l'utilisateur.
       L'utilisateur est chargé de fournir 
       <computeroutput>nomvm.pxe</computeroutput>.</para>
     </sect2>
@@ -356,8 +356,8 @@
     <sect2 id="nat-limitations">
       <title>Limites du NAT</title>
 
-      <para>Il y a quatre <emphasis role="bold">limites</emphasis> du yrolig;ud
-      NAT que les utilisateurs devraient savoir&#xA0;:</para>
+      <para>Il y a quatre <emphasis role="bold">limites</emphasis> du mode
+      NAT que les utilisateurs devraient connaître&#xA0;:</para>
 
       <glosslist>
         <glossentry>
@@ -415,7 +415,7 @@
       du réseau. Mais la présence de NAT a également des effets subtils qui
       peuvent interférer avec des protocoles qui, en principe, fonctionnent. Un
       exemple est NFS, où le serveur est souvent configuré pour refuser les
-       connexions depuis des ports non privlégiés (donc les ports qui ne sont pas
+       connexions depuis des ports non privilégiés (donc les ports qui ne sont pas
        inférieurs à 1024).</para>
     </sect2>
   </sect1>
@@ -425,7 +425,7 @@
     
     <para>Le service Network Address Translation (NAT) fonctionne comme un
     routeur domestique en regroupant les systèmes qui l'utilisent dans un réseau 
-    et en écartant les systèmes extérieurs d'accéder aux systèmes en son sein
+    et en évitant que les systèmes extérieurs accèdent au sein du réseau
     tout en permettant aux systèmes qu'il contient de communiquer entre eux et
     avec l'extérieur via TCP et UDP en IPv4 et IPv6.</para>
 
@@ -438,7 +438,7 @@
     <para><screen>VBoxManage natnetwork add -t nat-int-network -n "192.168.15.0/24" -e</screen></para>
     <para>
     Ici, "nat-int-network" est le nom du réseau interne à utiliser et
-    "192.168.15.0/24" est l'adresse du réseau et l'interface due masque du service NAT.
+    "192.168.15.0/24" est l'adresse du réseau et l'interface du masque du service NAT.
     Dans cette configuration statique, par défaut, l'adresse affectée à la passerelle sera
     192.168.15.1 (adresse suivant celle de l'interface), bien que cela soit sujet
     à changement. Pour connecter un serveur DHCP au réseau interne, nous
@@ -449,7 +449,7 @@
     <para>Pour le désactiver à nouveau, utilisez :</para>
     <para><screen>VBoxManage natnetwork modify -t nat-int-network -h off</screen></para>
     <para>Le serveur DHCP fournit la liste des noms de serveurs enregistrés 
-    mais elle n'identifie pas les serveurs du réseau 127/8.</para>
+    mais n'identifie pas les serveurs du réseau 127/8.</para>
 
     <para>Pour démarrer le service NAT, utilisez la commande suivante :</para>
     <para><screen>VBoxManage natnetwork start -t nat-int-network</screen></para>
@@ -484,7 +484,7 @@
     Il permet à VirtualBox d'intercepter les données du réseau physique et
     d'y envoyer des données, ce qui crée de fait une nouvelle interface réseau
     logicielle. Quand un invité utilise une telle interface, cela se passe,
-    le sur le système hôte, comme si l'invité était connecté physiquement à
+    sur le système hôte, comme si l'invité était connecté physiquement à
     l'interface réseau en utilisant un câble réseau&#xA0;: l'hôte peut envoyer
     des données à l'invité via cette interface et en reçoit des données. Cela
     veut dire que vous pouvez régler du routage ou des ponts entre l'invité et le
@@ -509,7 +509,7 @@
       </footnote></para>
 
     <para><note>
-        <para>Même si TAP n'est plus  nécessaire sur Linux avec le réseau bridgé,
+        <para>Même si TAP n'est plus nécessaire sur Linux avec le réseau bridgé,
         vous <emphasis>pouvez</emphasis> toujours utiliser les interfaces TAP
         pour certains paramétrages avancés puisque vous pouvez connecter une VM
         à n'importe quel interface de l'hôte -- qui pourrait être également une
@@ -555,13 +555,13 @@
           choisir une interface filaire.</para>
 
           <para>De plus, le paramétrage du MTU sur moins de 1500 octets sur
-          ules interfaces filaires fournies par le pilote sky2 sur les Marvell Yukon II EC
+          les interfaces filaires fournies par le pilote sky2 sur les Marvell Yukon II EC
           Ultra Ethernet NIC est connu pour provoquer une perte de paquets dans
           certaines conditions.</para>
 
           <para>Certains adaptateurs nettoient les tags VLAN matériellement. Cela
           ne permet pas d'utiliser le troncage de VLAN entre une VM et le réseau
-          extern¨e avec les noyaux Linux pre-2.6.27, ni avec les szstèmes d'exploitation
+          externe avec les noyaux Linux pre-2.6.27, ni avec les systèmes d'exploitation
           hôtes autres que Linux.</para>
         </listitem>
 
@@ -591,7 +591,7 @@
 
             <listitem>
               <para>Il faut affecter au VNIC et à l'interface réseau invitée qui utilise
-              VNIC des adresses MAC identiquep.</para>
+              VNIC des adresses MAC identiques.</para>
             </listitem>
           </itemizedlist>
 
@@ -612,29 +612,29 @@
     réseau interne.</para>
 
     <para>Même si, techniquement, on peut faire tout ce qu'on fait avec un réseau interne
-    avec un le réseau bridgé, il présente des avantages de sécurité. En mode réseau
+    sur un réseau bridgé, il présente des avantages de sécurité. En mode réseau
     bridgé, tout le trafic passe par l'interface physique du système hôte. Il est
     donc possible d'attacher un snifeur de paquets (tel que Wireshark) à
     l'interface hôte et d'enregistrer tout le trafic qui y transite. Si, pour
     une raison quelconque, vous préférez que deux ou plusieurs VMs sur une même
-    machine communiquent en privé, en cachant leurs données au szstème et à
+    machine communiquent en privé, en cachant leurs données au système et à
     l'utilisateur hôtes, le réseau bridgé n'est donc pas envisageable.</para>
 
-    <para>Les réseaux internes sont créés automatiquement en tant que de besoin
+    <para>Les réseaux internes sont créés automatiquement au besoin
     c'est-à-dire qu'il n'y a pas de configuration centrale. Chaque réseau interne
     est identifié simplement par son nom. Une fois qu'il y a plus d'une carte
-    réseau virtuelle active avec le même ID réseau interne, le pilote support
+    réseau virtuelle active avec le même ID réseau interne, le pilote 
     de VirtualBox "branchera" automatiquement les cartes et agira comme un switch.
-    Les pilotes suppoqt de VirtualBox implémentent un switch Ethernet complet
+    Les pilotes de VirtualBox implémentent un switch Ethernet complet
     et supportent les frames broadcast/multicast et le mode promiscuous.</para>
 
     <para>Afin d'attacher la carte réseau d'une VM à un réseau interne, réglez
-    son mode réseau sur "réseau interne". Il existe de manières de
+    son mode réseau sur "réseau interne". Il existe 2 manières de
     faire cela&#xA0;:</para>
 
     <para><itemizedlist>
         <listitem>
-          <para>Vous pouvez utiliser une boîte de dialogue "Paramètres" de laVM
+          <para>Vous pouvez utiliser une boîte de dialogue "Paramètres" de la VM
           dans l'interface graphique de VirtualBox. Dans la catégorie "Réseau"
           de la boîte de dialogue des paramètres, sélectionnez "réseau interne"
           dans la liste déroulante des modes réseaux. Maintenant, sélectionnez
@@ -676,17 +676,17 @@
     connectées à une interface réseau physique.</para>
 
     <para>Quand on utilise le mode réseau host-only, VirtualBox crée une nouvelle
-    interface logicielle sur vhôte qui apparaît alors à côté vos interfaces
+    interface logicielle sur l'hôte qui apparaît alors à côté de vos interfaces
     réseaux existantes. En d'autres termes, alors que le réseau bridgé et que
-    l'interface physique existante est utilisée pour y attacher des machines virtuelles,
-    avec le réseau host-only, une nouvelle interface "loopback" est crééesur l'hôte.
+    l'interface physique existante sont utilisés pour y attacher des machines virtuelles,
+    avec le réseau host-only, une nouvelle interface "loopback" est créée sur l'hôte.
     Et alors qu'avec le réseau interne, le trafic entre les machines virtuelles
     n'est pas visible, le trafic sur l'interface "loopback" de l'hôte peut être
     intercepté.</para>
 
     <para>Le réseau Host-only est particulièrement utile pour les applicatifs
     virtuels préconfigués où plusieurs machines virtuelles sont groupées et conçues
-    pour collaborer. Par exemple, une machine e virtuelle peut contenir un
+    pour collaborer. Par exemple, une machine virtuelle peut contenir un
     serveur web et une deuxième une base de données, et comme elles sont faites
     pour se parler, l'applicatif peut demander à VirtualBox de définir un réseau
     host-only pour les deux. Un deuxième réseau (bridgé) connecterait alors le
@@ -709,8 +709,8 @@
       </itemizedlist></para>
 
     <para>Pour le réseau host-only, comme avec le réseau interne, vous pouvez
-    trouver utile le serveur DHCP construit dans VirtualBox. Il peut être activé
-    puis gérer les adresses IP dans le réseau host-only, puisque sans cela,
+    trouver utile que le serveur DHCP soit construit dans VirtualBox. Il peut être activé
+    et donc gérer les adresses IP dans le réseau host-only, puisque sans cela,
     vous devriez configurer toutes les adresses IP de manière statique.<itemizedlist>
         <listitem>
           <para>Dans l'interface graphique de VirtualBox, vous pouvez configurer
@@ -738,8 +738,8 @@
     <para>Ce mode réseau permet d'interconnecter des machines virtuelles qui
     fonctionnent sur des hôtes différents.</para>
 
-    <para>Techniquement, cela se fait en encapsulant des frames Ethernet envoyés
-    ou reçus par la carte réseau de l'invité dans des datadrams UDP/IP, et
+    <para>Techniquement, cela se fait en encapsulant des trames Ethernet envoyées
+    ou reçues par la carte réseau de l'invité dans des datagrammes UDP/IP, et
     en les envoyant via n'importe quel réseau disponible sur l'hôte.</para>
 
     <para>Le mode Tunnel UDP a trois paramètres&#xA0;:<glosslist>
@@ -747,7 +747,7 @@
           <glossterm>Port source UDP</glossterm>
 
           <glossdef>
-            <para>Le port sur lequel écoute l'hôte. Les datagrams arrivant
+            <para>Le port sur lequel écoute l'hôte. Les datagrammess arrivant
             sur ce port depuis n'importe quelle adresse source seront redirigés
             vers la partie réceptrice de la carte réseau invitée.</para>
           </glossdef>
@@ -771,7 +771,7 @@
       </glosslist></para>
 
     <para>Quand on interconnecte deux machines virtuelles sur deux hôtes différents,
-    leurs adresses IP doivent être échangées. Sur un seulhôte, les ports UDP
+    leurs adresses IP doivent être échangées. Sur un seul hôte, les ports UDP
     source et de destination doivent être échangés.</para>
 
     <para>Dans l'exemple suivant, l'hôte 1 utilise l'adresse IP 10.0.0.1 et l'hôte
@@ -794,7 +794,7 @@
 
     <para><note>
          Sur les hôtes basés sur Unix (comme Linux, Solaris, Mac OS X), il
-         n'est pas possible de sonder les portss inférieurs à 1024 pour des
+         n'est pas possible de sonder les ports inférieurs à 1024 pour des
          applications non lancées par
 
         <computeroutput>root</computeroutput>
@@ -819,13 +819,13 @@
     <para>Les blocs à construire de base de l'infrastructure sont les switches
     VDE, les prises VDE et les fils VDE qui inter-connectent les switches.</para>
 
-    <para>Le pilote VDe de VirtualBox prend un paramètre&#xA0;:<glosslist>
+    <para>Le pilote VDE de VirtualBox prend un paramètre&#xA0;:<glosslist>
         <glossentry>
           <glossterm>Réseau VDE</glossterm>
 
           <glossdef>
-            <para>Le nom de la socket du switch du réseau VDE à laquelle la VM
-            sera connectée.</para>
+            <para>Le nom du socket du switch du réseau VDE auquel la VM
+            sera connecté.</para>
           </glossdef>
         </glossentry>
       </glosslist></para>
@@ -879,16 +879,16 @@
     </note>
 
     <para>On configure les limites avec <computeroutput>VBoxManage</computeroutput>. L'exemple
-    ci-dessous crée ÚJ groupe de bande passante appelé "Limit", paramètre la
+    ci-dessous crée un groupe de bande passante appelé "Limit", paramètre la
     limite à 20 Mo/s et affecte le groupe au premier et au deuxième adaptateurs
     de la VM&#xA0;:<screen>VBoxManage bandwidthctl "nom VM" add Limit --type network --limit 20m
 VBoxManage modifyvm "nom VM" --nicbandwidthgroup1 Limit
 VBoxManage modifyvm "nom VM" --nicbandwidthgroup2 Limit</screen></para>
 
     <para>Tous les adaptateurs d'un groupe partagent la limite de la bande
-    passange, ce qui veut dire que dans l'exemple ci-dessus, la bande passante
+    passante, ce qui veut dire que dans l'exemple ci-dessus, la bande passante
     des deux adaptateurs associés ne peut jamais dépasser 20
-    Mo/s. Par contre, si un adaptateur n'a pas besoin de bande sassante, l'autre
+    Mo/s. Par contre, si un adaptateur n'a pas besoin de bande passante, l'autre
     peut utiliser le reste de bande passante de son groupe.</para>
 
     <para>On peut modifier les limites de chaque groupe pendant que la VM 
@@ -909,28 +909,27 @@ VBoxManage modifyvm "nom VM" --nicbandwidthgroup2 Limit</screen></para>
   <sect1 id="network_performance">
     <title>Améliorer les performances réseaux</title>
 
-    <para>VirtualBox offre une variété d'adaptateurs réseaux virtuels qu'on peut be
-      "attacher" au réseau de l'hôte d'un certain nombre de manières. Selon les
-      types d'adaptateurs et d'attachements utilisés, les erformances réseaux
+    <para>VirtualBox offre une variété d'adaptateurs réseaux virtuels qu'on peut 
+      "attacher" au réseau de l'hôte de diverses manières. Selon les
+      types d'adaptateurs et d'attachements utilisés, les performances réseaux
       seront différentes. Dans une logique de performances, l'adaptateur réseau
       <emphasis>virtio</emphasis> est préférable aux adaptateurs
       <emphasis>Intel PRO/1000</emphasis> émulés, préférables eux-mêmes à
       la famille d'adaptateurs <emphasis>PCNet</emphasis>. Tant les adaptateurs
       <emphasis>virtio</emphasis> que <emphasis>Intel PRO/1000
-      </emphasis> profitent de la segmentation et de l'offloading de de
+      </emphasis> profitent de la segmentation et de l'offloading de la
       vérification de somme. La segmentation offloading est essentielle pour de
       hautes performances car elle permet moins de changements de contextes, 
-      augmentant drastiquement les tailles des paquets croisés entre VM/boddary
-      hôte.</para>
+      augmentant drastiquement les tailles des paquets croisés entre VM et hôte.</para>
     <note><para>Ni les pilotes <emphasis>virtio</emphasis>, ni ceux
     <emphasis>Intel PRO/1000</emphasis> de Windows XP supportent la segmentation
         offloading. Donc, les invités Windows XP n'atteignent jamais les mêmes
         vitesses de transmission que les autres types d'invités. Reportez-vous
-        à la base MS Knowledge article 842264 pour des information s supplémentaires.</para>
+        à la base MS Knowledge article 842264 pour des informations supplémentaires.</para>
     </note>
     <para>Trois types d'attachements&#xA0;: <emphasis>interne</emphasis>,
       <emphasis>bridgé</emphasis> et <emphasis>host-only</emphasis>, ont des
-      performances presqu'identiques, le type <emphasis>internal</emphasis> 
+      performances presque identiques, le type <emphasis>internal</emphasis> 
       étant légèrement plus rapide et utilisant moins de cycles processeur puisque
       les paquets ne vont jamais dans la pile réseau de l'hôte. L'attachement
       <emphasis>NAT</emphasis> est le plus lent (et le plus sûr) de tous les
diff --git a/doc/manual/fr_FR/user_Security.xml b/doc/manual/fr_FR/user_Security.xml
index 1e90d8f..68e3be3 100644
--- a/doc/manual/fr_FR/user_Security.xml
+++ b/doc/manual/fr_FR/user_Security.xml
@@ -19,11 +19,11 @@
             <glossterm>Maintenir à jour le logiciel</glossterm>
             <glossdef>
               <para>
-                Une des bonnes pratirues de sécurité est d'avoir des versioos du
+                Une des bonnes pratiques de sécurité est d'avoir des versions de
                 logiciel et des correctifs à jour. Activez la notification de
                 mise à jour de VirtualBox pour être averti quand une nouvelle
                 version de VirtualBox est disponible. Quand vous mettez à jour
-                VirtualBox, n'oubliez pas de mett!e à jour aussi les suppléments
+                VirtualBox, n'oubliez pas de mettre à jour aussi les suppléments
                 invité. Maintenez à jour le système d'exploitation hôte ainsi
                 que l'invité.
               </para>
@@ -31,12 +31,12 @@
           </glossentry>
 
           <glossentry>
-            <glossterm>Restriindre l'accès réseau des services critiques</glossterm>
+            <glossterm>Restreindre l'accès réseau des services critiques</glossterm>
             <glossdef>
               <para>
                 Utilisez les moyens, tels qu'un pare-feu, pour protéger votre
                 ordinateur et vo(s) invité(s) de l'extérieur. Choisir le bon mode
-                de réseau pour des VMs permet de distinguer le réseau de l'hôte
+                de réseau pour les VMs permet de distinguer le réseau de l'hôte
                 de l'invité et vice versa.
               </para>
             </glossdef>
@@ -63,12 +63,12 @@
           </glossentry>
 
           <glossentry>
-            <glossterm>Surveiller l'activité du szstème</glossterm>
+            <glossterm>Surveiller l'activité du système</glossterm>
             <glossdef>
               <para>
                 La sécurité du système repose sur trois piliers&#xA0;: de bons
                 protocoles de sécurité, une bonne configuration du système et
-                la surveillance du szstème. L'évaluation et la lecture des
+                la surveillance du système. L'évaluation et la lecture des
                 fruits de l'évaluation constituent la troisième exigence. Chaque
                 composant d'un système a un certain degré de capacité à être
                 surveillé. Suivez les conseils d'évaluation de ce document et
@@ -82,7 +82,7 @@
             <glossdef>
               <para>
                 Oracle améliore en permanence ses logiciels et sa documentation.
-                Vérifiez ce passage chaque année pour truurer les révisions.
+                Vérifiez ce passage chaque année pour trouver les révisions.
               </para>
             </glossdef>
           </glossentry>
@@ -169,7 +169,7 @@
         d'un utilisateur du système d'exploitation hôte. L'invité ne peut pas
         communiquer directement avec le matériel hôte ou avec d'autres ordinateurs,
         mais uniquement via le VMM. Le VMM offre des ressources physiques et des
-        périphériques émulés à l'invité, auxquelles on accède par le système d'exploitation hôte pour effectuer les
+        périphériques émulés à l'invité, auxquels on accède par le système d'exploitation hôte pour effectuer les
         tâches nécessaires. Les paramètres de la VM contrôlent les ressources 
         fournies à l'invité, par exemple la quantité de mémoire de l'invité ou
         le nombre de processeurs invités (voir <xref linkend="generalsettings"/>) 
@@ -179,7 +179,7 @@
     </sect2>
     
     <sect2>
-      <title>Configuration pécurisée des machines virtuelles</title>
+      <title>Configuration sécurisée des machines virtuelles</title>
       <para>
         Plusieurs aspects de la configuration d'une machine virtuelle sont sujets
         à des considérations de sécurité.</para>
@@ -195,13 +195,13 @@
           et il suffit pour la plupart des besoins. 
         </para>
         <para>
-          Si vous utilisé le réseau bridgé, la VM se comporte comme un ordinateur
+          Si vous utilisez le réseau bridgé, la VM se comporte comme un ordinateur
           dans le même réseau que l'hôte, voir <xref linkend="network_bridged"/>.
           Dans ce cas, l'invité a un accès réseau identique à l'hôte et un
           pare-feu pourrait être nécessaire pour protéger d'autres ordinateurs
           du sous-réseau contre des invités malveillants potentiels et pour
           protéger l'invité contre un accès direct par les autres ordinateurs.
-          Dans certains cas, il est intçressant de songer à utiliser une règle
+          Dans certains cas, il est intéressant de songer à utiliser une règle
           de redirection pour un port spécifique en mode NAT, plutôt que d'utiliser
           le réseau bridgé.
         </para>
@@ -273,7 +273,7 @@
         <para>
           La présentation de périphériques USB à l'invité offre à l'invité un
           accès complet à ces périphériques, voir <xref linkend="settings-usb"/>.
-          Par exemple, outre la lecture et l'écriture du contenu des partitionpartitions
+          Par exemple, outre la lecture et l'écriture du contenu des partitions
           d'un disque USB externe, l'invité pourra également lire et écrire la
           table de partitions et des données matérielles sur ce disque.
         </para>
@@ -326,7 +326,7 @@
     -->
 
     <sect2>
-    <title>Opçrations potentiellement non sécurisées</title>
+    <title>Opérations potentiellement non sécurisées</title>
 
       <para>Les fonctions suivantes de VirtualBox peuvent présenter des problèmes
       de sécurité&#xA0;:<itemizedlist>
@@ -338,7 +338,7 @@
 
         <listitem>
           <para>En téléportant une machine, le flux de données par lequel passe
-          le contenu de la mémoire de la machine est transféré d'un hô!e à l'autre
+          le contenu de la mémoire de la machine est transféré d'un hôte à l'autre
           sans chiffrement. Un tiers ayant un accès au réseau par lequel les
           données sont transférées pourrait donc intercepter ces données. On
           pourrait utiliser un tunnel SSH pour sécuriser la connexion entre les
@@ -367,7 +367,7 @@
           <para>Le trafic envoyé par une connexion réseau en tunnel UDP n'est
           pas chiffré. Vous pouvez soit le chiffrer au niveau du réseau hôte 
           (avec IPsec), soit utiliser des protocoles chiffrés dans le réseau 
-          invité (tel que SSH). The security properties are similar to bridged Ethernet.</para>
+          invité (tel que SSH). Les propriétés de sécurité sont similaires à un Ethernet bridgé.</para>
         </listitem>
       </itemizedlist></para>
     </sect2>
@@ -376,7 +376,7 @@
       <title>Chiffrement</title>
 
       <para>Les composants suivants de VirtualBox utilisent le chiffrement pour
-      protéger ces données sensibles&#xA0;:<itemizedlist>
+      protéger les données sensibles&#xA0;:<itemizedlist>
         <listitem>
           <para>Quand on utilise le pack d'extension de VirtualBox fourni par
           Oracle pour le support du bureau distant (VRDP), les données peuvent
diff --git a/doc/manual/fr_FR/user_Storage.xml b/doc/manual/fr_FR/user_Storage.xml
index edd9e8d..0cc2f07 100644
--- a/doc/manual/fr_FR/user_Storage.xml
+++ b/doc/manual/fr_FR/user_Storage.xml
@@ -40,12 +40,12 @@
     <para>Dans un vrai PC, les disques durs et les lecteurs de CD/DVD sont
     connectés à un périphérique appelé le contrôleur de disque dur, qui pilote les
     opérations du disque dur et les transferts de données. VirtualBox peut émuler
-    les quatre types contrôleurs de disque les plus courants qu'on trouveen
+    les quatre types contrôleurs de disque les plus courants qu'on trouve en
     général dans les PCs d'aujourd'hui&#xA0;: IDE, SATA (AHCI), SCSI et
     SAS.<footnote>
-        <para>Le support SATA a été ajouté avec VirtualBox 1.6&#xA0;; l support SCSI
+        <para>Le support SATA a été ajouté avec VirtualBox 1.6&#xA0;; le support SCSI
         expérimental a été ajouté à la 2.1 et complètement implémenté avec la
-        2.2. En général, les connexions de stockag ont été rendus beaucoup plus
+        2.2. En général, les connexions de stockage ont été rendues beaucoup plus
         flexibles avec VirtualBox 3.1&#xA0;; voir ci-dessous. Le support pour
         le contrôleur LSI Logic SAS a été ajouté avec
         VirtualBox 3.2.</para>
@@ -60,7 +60,7 @@
           nappes de  40 ou 80 fils. Chaque câble peut connecter deux périphériques
           à un contrôleur, ce qu'on appelait traditionnellement le "maître" et "l'esclave".
           Les PCs classiques avaient deux connecteurs par câbles, le support
-          jusqu'à quatre pçriphériques était donc classique.</para>
+          jusqu'à quatre périphériques était donc classique.</para>
 
           <para>Dans VirtualBox, chaque machine virtuelle peut avoir un contrôleur IDE
           activé, ce qui vous donne jusqu'à quatre périphériques de stockage virtuels
@@ -116,7 +116,7 @@
           VM est connecté à ce contrôleur.<warning>
               <para>Tout le contrôleur SATA et les disques virtuels qui s'y connectent
               (y compris ceux en mode de compatibilité IDE) ne seront pas vus par
-              les szstèmes d'exploitation n'ayant pas de support pçriphérique
+              les systèmes d'exploitation n'ayant pas de support périphérique
               pour AHCI. En particulier, <emphasis role="bold">il n'y a pas de
               support pour AHCI dans Windows avant Windows Vista</emphasis>, donc
               Windows XP (même SP3) ne verra pas de tels disques sauf si vous
@@ -125,7 +125,7 @@
               et en changeant le type de contrôleur dans la boîte de dialogue des
               paramètres de la VM.<footnote>
                   <para>VirtualBox recommande les pilotes Intel Matrix Storage 
-                  qui sont téléchargeables skr <ulink
+                  qui sont téléchargeables sur <ulink
                   url="http://downloadcenter.intel.com/Product_Filter.aspx?ProductID=2101">http://downloadcenter.intel.com/Product_Filter.aspx?ProductID=2101</ulink>.</para>
                 </footnote></para>
             </warning></para>
@@ -201,7 +201,7 @@
         </listitem>
       </itemizedlist></para>
 
-    <para>En résumé, VirtualBox vous offre les catégrie; de slots de stockage 
+    <para>En résumé, VirtualBox vous offre les catégories de connecteur (slot) de stockage 
     virtuels suivantes&#xA0;:<orderedlist>
         <listitem>
           <para>quatre slots attachés au contrôleur IDE traditionnel, qui sont
@@ -237,8 +237,8 @@
   <sect1 id="vdidetails">
     <title>Fichiers images de disque (VDI, VMDK, VHD, HDD)</title>
 
-    <para>Les fichiers images de disrue résident sur le système hôte et sont vues
-    par les systèmes invités comme des ditvoct durs d'une certaine composition.
+    <para>Les fichiers images de disque résident sur le système hôte sont vus
+    par les systèmes invités comme des disques durs d'une certaine géométrie.
     Quand un système d'exploitation invité lit ou écrit sur un disque dur,
     VirtualBox redirige la requête vers le fichier image.</para>
 
@@ -260,12 +260,12 @@
         </listitem>
 
         <listitem>
-          <para>VirtualBox supporte aussi complètement le format d
+          <para>VirtualBox supporte aussi complètement le format de
           container VMDK ouvert et populaire, utilisé par de nombreux produits
           de virtualisation, en particulier, par VMware.<footnote>
               <para>Le premier support du VMDK a été ajouté avec VirtualBox 1.4&#xA0;;
-              depuis la version 2.1, VirtualBox supporte complètement le VMDK,
-              ce qui veut dire que vous pouvez créer des dépôts et utilisar toutes
+              depuis la version 2.1, VirtualBox supporte complètement VMDK,
+              ce qui veut dire que vous pouvez créer des dépôts et utiliser toutes
               les autres fonctions avancées décrites ci-dessus pour les images
               VDI avec VMDK.</para>
             </footnote></para>
@@ -307,13 +307,13 @@
         role="bold">image dynamique</emphasis>. Elle sera très petite au départ
         et n'occupera pas de place pour des secteurs de disque virtuel inutilisés,
         mais elle grandira à chaque fois qu'un secteur de disque sera écrit pour
-        la première fois, jusqu'à ce que le lecteur ne atteigne la capacité maximale
+        la première fois, jusqu'à ce que le lecteur atteigne la capacité maximale
         choisie quand le lecteur a été créé. Si ce format prend moins de place au
         départ, le fait que VirtualBox doit étendre le fichier image consomme
         des ressources de calcul supplémentaires, donc jusqu'à ce que la taille
         du fichier de disque ait été stabilisée, les opérations d'écriture peuvent
         être plus lentes qu'avec des disques à taille fixe. Cependant, après
-        un certain temps, la vitesse de grossissement ralentira l'inconvénient
+        un certain temps, le taux de croissance ralentira et le handicap
         moyen des opérations d'écriture deviendra négligeable.</para>
       </listitem>
     </itemizedlist>
@@ -331,14 +331,14 @@
 
         <listitem>
           <para>les médias "enregistrés" pour la compatibilité avec les
-          versions de VirtualBox inférieures à 4.0. Pour les détails sur les modaliqés
+          versions de VirtualBox inférieures à 4.0. Pour les détails sur les modalités
           du changement de l'enregistrement des médias, avec la version 4.0, 
           merci de vous reporter à <xref
           linkend="vboxconfigdata" />.</para>
         </listitem>
       </itemizedlist></para>
 
-    <para>Vous pouvez visualiser et modifier les médias connus dans le the <emphasis
+    <para>Vous pouvez visualiser et modifier les médias connus dans le <emphasis
     role="bold">gestionnaire de médias virtuels</emphasis>, auquel vous
     pouvez accéder à partir du menu "Fichier" de la fenêtre principale de
     VirtualBox&#xA0;:</para>
@@ -380,7 +380,7 @@
       </listitem>
 
       <listitem>
-        <para><emphasis role="bold">"libçrer"</emphasis> une image, c'est-à-dire
+        <para><emphasis role="bold">"libérer"</emphasis> une image, c'est-à-dire
         la détacher d'une machine virtuelle si elle est rattachée actuellement à
         une d'elles en tant que disque dur virtuel.</para>
       </listitem>
@@ -389,7 +389,7 @@
     <para>À partir de la version 4.0, pour <emphasis role="bold">créer de
     nouvelles images de disque,</emphasis> merci d'utiliser l'onglet "Stockage" 
     dans la boîte de dialogue des paramètres d'une machine virtuelle, car les 
-    images de disque sont désormais ptockées par défaut dans le dossier de chaque
+    images de disque sont désormais stockées par défaut dans le dossier de chaque
     machine.</para>
 
     <para>Vous pouvez copier des fichiers images de disque dur entre systèmes
@@ -429,7 +429,7 @@
       <listitem>
         <para>Avec des <emphasis role="bold">images normales</emphasis> (le
         réglage par défaut), il n'y a aucune restriction de lecture et d'écriture
-        pour les szstèmes invités.</para>
+        pour les systèmes invités.</para>
 
         <para>Quand vous prenez un instantané de votre machine virtuelle comme
         décrit au <xref linkend="snapshots" />, l'état d'un "disque dur normal"
@@ -457,17 +457,17 @@
 
       <listitem>
         <para>À l'opposé, <emphasis role="bold">les disques durs write-through</emphasis>
-         sont ne sont absolument pas concernés par les instantanés&#xA0;: leur
-         état <emphasis>n'est pas</emphasis> sauvegardé quand on prend un instantané,
-         et il n'est pas restauré quand on restaure un instantané.</para>
+         ne sont absolument pas concernés par les instantanés&#xA0;: leur
+         état <emphasis>n'est pas</emphasis> sauvegardé quand on prend l'instantané,
+         et il n'est pas restauré quand on le restaure.</para>
       </listitem>
 
       <listitem>
         <para>Les <emphasis role="bold">Disques durs partageables</emphasis> sont
         des variantes des disques durs write-through. En principe, ils se
         comportent exactement de la même façon, à savoir que leur état 
-        <emphasis>n'est pas</emphasis> sauvegardé quand on prend un instantané
-        et il n'est pas restauré quand on restaure un instantané. La
+        <emphasis>n'est pas</emphasis> sauvegardé quand on prend l'instantané
+        et il n'est pas restauré quand on le restaure. La
         différence n'apparaît que si vous attachez de tels disques à plusieurs
         VMs. Les disques partageables peuvent être attachés à plusieurs VMs qui
         peuvent fonctionner en même temps. Cela les rend adaptés pour l'utilisation
@@ -509,12 +509,12 @@
           était en fonction (ce qu'on appelle un instantané "en ligne"). Il s'en
           suit que si l'instantané actuel de la machine est "en ligne",
           ses images immuables se comportent exactement comme les images "normales"
-          décrites précédemment. Prur réactiver la réinitialisation automatique
+          décrites précédemment. Pour réactiver la réinitialisation automatique
           de telles images, effacez l'instantané actuel de la machine.</para>
         </note>
 
         <para>De nouveau, techniquement, VirtualBox n'écrit jamais directement
-        sur image immuable. Toutes les opérations d'écriture de la machine seront
+        sur l'image immuable. Toutes les opérations d'écriture de la machine seront
         envoyées dans une image de différenciation&#xA0;; la prochaine fois que
         la VM sera allumée, l'image de différenciation sera rétablie à chaque 
         démarrage de la machine, ses images  immuables ont exactement le même
@@ -535,7 +535,7 @@
         désactiver en utilisant le paramètre
         <computeroutput>autoreset</computeroutput> de
         <computeroutput>VBoxManage modifyhd</computeroutput>&#xA0;; voir <xref
-        linkend="vboxmanage-modifyvdi" /> for details.</para>
+        linkend="vboxmanage-modifyvdi" /> pour le detail.</para>
       </listitem>
 
       <listitem>
@@ -566,7 +566,7 @@
     Imaginons que vous avez accidentellement infecté votre VM avec un virus et
     vous voulez revenir à l'instantané. Avec une image de disque dur normale,
     vous restaurez simplement l'instantané et l'état antérieur de votre image
-    de disque dur seront restaurées également (et votre infection virale sera
+    de disque dur seront restaurés également (et votre infection virale sera
     annulée). Avec un disque dur immuable, il suffit d'éteindre et de rallumer
     votre VM et l'infection virale sera désactivée. Par contre, avec une image
     write-through, vous ne pouvez pas annuler facilement
@@ -575,8 +575,8 @@
 
     <para>Là encore, vous pourriez trouver les images write-through utiles si vous
     voulez préserver des données critiques indépendamment des instantanés, et
-    comme vous pouvez attacher plus d'une imafe à une VM, vous pourrien vouloir
-    avoir une image immuable pour le szstème d'exploitation et une  en write-through
+    comme vous pouvez attacher plus d'une imafe à une VM, vous pourriez vouloir
+    avoir une image immuable pour le système d'exploitation et une  en write-through
     pour vos fichiers de données.</para>
   </sect1>
 
@@ -622,7 +622,7 @@
     de votre machine. Les opérations d'écriture vont toujours dans l'image de
     différenciation "active" attachée à la machine, et pour les opérations de 
     lecture, VirtualBox peut avoir besoin de regarder jusqu'aux parents dans la
-    chaîne, jusqu'à ce qu'il truuve le secteur en question. Vous pouvez regarder
+    chaîne, jusqu'à ce qu'il trouve le secteur en question. Vous pouvez regarder
     l'arborescence dans le gestionnaire de médias virtuels&#xA0;:<mediaobject>
         <imageobject>
           <imagedata align="center" fileref="images/virtual-disk-manager2.png"
@@ -633,8 +633,8 @@
     <para>Dans toutes ces situations, du point de vue de la machine virtuelle, 
     le disque dur virtuel se comporte comme n'importe quel autre disque.
     Pendant que la machine virtuelle est en fonction, il y a un léger ralentissement
-    (overhead) E/S d'exécution car il se peut que VirtualBox doive regarder des
-    secteurs plusieurs fois. Cela ne se voit cependant pas, puisque les tables
+    des E/S (overhead) car il se peut que VirtualBox doive regarder des
+    secteurs plusieurs fois. Cela ne se ressent cependant pas, puisque les tables
     d'informations des secteurs sont toujours gardées en mémoire et peuvent être
     consultées rapidement.</para>
 
@@ -647,7 +647,7 @@
           images de différenciation pour chacun d'eux (pour être précis, une 
           par image qui n'est pas en mode "write-through"). Du point de vue de
           la machine virtuelle, les disques virtuels continuent d'agir comme
-          avant, pais toutes les opérations d'écriture vont dans les images de
+          avant, mais toutes les opérations d'écriture vont dans les images de
           différenciation. Chaque fois que vous créez un autre instantané, pour 
           chaque disque dur attaché, une autre image de différenciation est
           créée et attachée, formant une chaîne ou une arborescence.</para>
@@ -661,7 +661,7 @@
           la machine stocké dans le dépôt --, il se produit la chose suivante&#xA0;:<orderedlist>
               <listitem>
                 <para>VirtualBox copie les paramètres de la machine virtuelle
-                copiés dans vinstantané vers la machine virtuelle. Du coup, si 
+                mémorisés dans l'instantané vers la machine virtuelle. Du coup, si 
                 vous avez fait des modifications dans la configuration après avoir
                 pris l'instantané, elles sont annulées.</para>
               </listitem>
@@ -670,7 +670,7 @@
                 <para>Si vous avez pris l'instantané quand la machine était en
                 fonction, il contient un état sauvegardé de la machine et cet état
                 est restauré également&#xA0;; après la restauration de l'instantané,
-                la machine sera en état "sauvehaqdé" et elle reprendra son exécution
+                la machine sera en état "sauvegardé" et elle reprendra son exécution
                 là où elle avait été commencée la fois suivante. Sinon, la
                 machine sera dans l'état "éteint" et elle fera un démarrage complet.</para>
               </listitem>
@@ -728,7 +728,7 @@
     l'outil de VirtualBox et l'importer à la place.</para>
 
     <para>Remarquez que les distributions Linux récentes identifient le disque
-    dur de démarrage à partir ce l'ID du disque. L'ID utilisé par VirtualBox pour
+    dur de démarrage à partir de l'ID du disque. L'ID utilisé par VirtualBox pour
     un lecteur est déterminé à partir de l'UUID de l'image du disque dur virtuel. 
     Donc si vous clonez une image de disque et si vous essayez de démarrer l'image,
     copiée il se peut que l'invité ne puisse pas déterminer son propre disque de
@@ -749,7 +749,7 @@
 
     <para>Traditionnellement, VirtualBox ouvrait des fichiers images de disque
     comme des fichiers normaux, ce qui faisait qu'ils étaient mis en cache par le
-    pystème d'exploitation hôte comme n'importe quel autre fichier. Le principal
+    système d'exploitation hôte comme n'importe quel autre fichier. Le principal
     avantage en est la vitesse&#xA0;: quand l'OS invité écrit sur le disque
     et quand le cache de l'hôte utilise l'écriture différée, l'opération d'écriture
     peut être déclarée terminée pour l'OS invité rapidement alors que l'OS hôte
@@ -767,7 +767,7 @@
 
     <para>Si la mise en tampon est un paramètre par défaut utile pour virtualiser
     quelques machines sur un ordinateur de bureau, elle présente quelques
-    , inconvénients&#xA0;:<orderedlist>
+    inconvénients&#xA0;:<orderedlist>
         <listitem>
           <para>L'écriture différée dans le cache de l'OS hôte est moins
           sécurisée. Quand l'OS invité écrit des données, il considère que les 
@@ -785,17 +785,17 @@
           Par exemple, sur des hôtes Linux, la mise en cache de l'hôte peut aboutir
           à un report, par Linux, de toutes les écritures jusqu'à ce que le
           cache de l'hôte soit presque plein, avant d'écrire tous ces changements
-         en une fois, ce qui peut suspendre l'exécution d'une VM pendant quelques
+          en une fois, ce qui peut suspendre l'exécution d'une VM pendant quelques
           minutes. Cel peut donner des erreurs d'E/S dans l'invité car les requêtes
           E/S excèderaient le timeout.</para>
         </listitem>
 
         <listitem>
           <para>La mémoire physique est souvent gaspillée, car les systèmes 
-          d'exploitation hôtes ont en général leur propre szstème de mise en cache
+          d'exploitation hôtes ont en général leur propre système de mise en cache
           des E/S, ce qui aboutit à la mise en cache double des données (à la fois dans
-          le cache de l'invité et de l'hôte), avec peu 
-          d'effet.</para>
+          le cache de l'invité et de l'hôte), avec peu d'effet.
+          </para>
         </listitem>
       </orderedlist></para>
 
@@ -804,7 +804,7 @@
     mettre les écritures en tampon, mais en général, aucune lecture de ce cache
     n'est fait par l'OS invité. De plus, VirtualBox supporte complètement
     l'E/S asynchrone pour ses contrôleurs SATA, SCSI et SAS virtuels via plusieurs
-    threads d'E/S.</para>
+    files (thread) d'E/S.</para>
 
     <para>Les E/S asynchrones n'étant pas supportées par les contrôleurs IDE,
     pour des raisons de performance, vous pourriez vouloir laisser la mise en 
@@ -815,7 +815,7 @@
     la case "Utiliser la mise en cache des E/S de l'hôte" des paramètres de stockage,
     d'un contrôleur de stockage donné, soit utilisez la commande VBoxManage 
     suivante pour désactiver la mise en cache des E/S de l'hôte pour un contrôleur 
-   de stockage virtuel&#xA0;:<screen>VBoxManage storagectl <vm> --name <nomcontrôleur> --hostiocache off</screen></para>
+   de stockage virtuel&#xA0;:<screen>VBoxManage storagectl "nom VM" --name <nomcontrôleur> --hostiocache off</screen></para>
 
     <para>Voir <xref linkend="vboxmanage-storagectl" /> pour les détails.</para>
 
@@ -835,9 +835,9 @@
     <computeroutput>VBoxManage</computeroutput>. L'exemple ci-dessous crée un
     groupe de bandes passantes nommé "Limit", et pose la limite à 20 Mo/s et
     affecte le groupe aux disques attachés à la VM&#xA0;:<screen>VBoxManage bandwidthctl "nom VM" add Limit --type disk --limit 20M
-VBoxManage storageattach "nom VM" --controller "SATA" --port 0 --device 0 --type hdd
+VBoxManage storageattach "nom VM" --storagectl "SATA" --port 0 --device 0 --type hdd
                                    --medium disk1.vdi --bandwidthgroup Limit
-VBoxManage storageattach "nom VM" --controller "SATA" --port 1 --device 0 --type hdd
+VBoxManage storageattach "nom VM" --storagectl "SATA" --port 1 --device 0 --type hdd
                                    --medium disk2.vdi --bandwidthgroup Limit</screen></para>
 
     <para>Tous les disques d'un groupe partagent la limite de la bande passante,
@@ -848,7 +848,7 @@ VBoxManage storageattach "nom VM" --controller "SATA" --port 1 --device 0 --type
 
     <para>Les limites pour chaque groupe peuvent être modifiées pendant que la
     VM est en fonction, ce qui applique immédiatement les modifications. L'exemple
-    ci-d:ssous modifie le groupe créé dans l'exemple ci-dessus en 10 Mo/s:<screen>VBoxManage bandwidthctl "nom VM" set Limit --limit 10M</screen></para>
+    ci-dessous modifie le groupe créé dans l'exemple ci-dessus en 10 Mo/s:<screen>VBoxManage bandwidthctl "nom VM" set Limit --limit 10M</screen></para>
   </sect1>
 
   <sect1 id="storage-cds">
@@ -870,13 +870,13 @@ VBoxManage storageattach "nom VM" --controller "SATA" --port 1 --device 0 --type
         </listitem>
 
         <listitem>
-          <para><emphasis role="bold">EVide</emphasis> signifie un lecteur sans
+          <para><emphasis role="bold">Vide</emphasis> signifie un lecteur sans
           média dedans.</para>
         </listitem>
       </itemizedlist></para>
 
     <para>La modification entre les situations ci-dessus, le changement de 
-    média dans le lecteur hôte ou de fichier image signalera un changement de méjca
+    média dans le lecteur hôte ou de fichier image signalera un changement de média
     au système d'exploitation invité, lequel peut réagir au changement (par exemple,
     en démarrant un programme d'installation).</para>
 
@@ -884,7 +884,7 @@ VBoxManage storageattach "nom VM" --controller "SATA" --port 1 --device 0 --type
     répercute cela en verrouillant le lecteur hôte si besoin. Vous pouvez forcer
     le retrait d'un média en pareilles situations via l'interface graphique de
     VirtualBox ou l'outil en ligne de commandes VBoxManage. En fait, cela revient
-    à une éjection en urgence, ce que supportent de nombreux lecteurs deCD/DVD
+    à une éjection en urgence, ce que supportent de nombreux lecteurs CD/DVD
     avec tous les effets colatéraux associés&#xA0;: l'OS invité peut renvoyer
     des messages d'erreur comme sur du vrai matériel, les applications invitées peuvent
     mal se comporter. Utilisez ceci avec précaution.<note>
@@ -899,7 +899,7 @@ VBoxManage storageattach "nom VM" --controller "SATA" --port 1 --device 0 --type
     <para>L'émulation standard des CD/DVD ne permet de lire que des formats de 
     CD et de DVD de données standards. Une possibilité supplémentaire, expérimentale,
     est de donner un accès direct de l'invité au lecteur CD/DVD de l'hôte en
-    activant le mode "passthrough". Selon le matériel hôte, cela peut potentiellement
+    activant le "Mode direct" (passthrough). Selon le matériel hôte, cela peut potentiellement
     faire marcher trois choses&#xA0;:<itemizedlist>
         <listitem>
           <para>L'écriture sur CD/DVD depuis l'invité, si le lecteur DVD de l'hôte
@@ -915,20 +915,20 @@ VBoxManage storageattach "nom VM" --controller "SATA" --port 1 --device 0 --type
         </listitem>
       </itemizedlist></para>
 
-    <para>Il existe une case à cocher "Passthrough" dans la boîte de dialogue
+    <para>Il existe une case à cocher "Mode direct" dans la boîte de dialogue
     graphique de configuration du média attaché aux contrôleurs de stockage, ou
     vous pouvez utiliser l'option
     <computeroutput>--passthrough</computeroutput> de
     <computeroutput>VBoxManage storageattach</computeroutput>&#xA0;; voir <xref
     linkend="vboxmanage-storageattach" /> pour les détails.</para>
 
-    <para>Même si pass-through est activé, les commandes non sûres telles que
-    la mise à jokr du firmware du lecteur, seront bloquées. Les formats de CD
+    <para>Même si passthrough est activé, les commandes non sûres telles que
+    la mise à jour du firmware du lecteur, seront bloquées. Les formats de CD
     vidéo ne sont pas du tout supportés, même pas en mode passthrough, et on
     ne peut pas les lire à partir d'une 
     machine virtuelle.</para>
 
-    <para>Sur les hôtes Solaris, pass-through exige de lancer VirtualBox avec de
+    <para>Sur les hôtes Solaris, passthrough exige de lancer VirtualBox avec de
     vrais droits d'administrateur du fait de mesures de sécurité renforcées par
     l'hôte.</para>
   </sect1>
diff --git a/doc/manual/fr_FR/user_Technical.xml b/doc/manual/fr_FR/user_Technical.xml
index 080f1d4..4caa20a 100644
--- a/doc/manual/fr_FR/user_Technical.xml
+++ b/doc/manual/fr_FR/user_Technical.xml
@@ -7,14 +7,14 @@
   <para>Le contenu de ce chapitre n'est pas indispensable pour utiliser
   VirtualBox avec succès. Nous indiquons ce qui suit à titre informatif pour
   ceux qui sont plus familiers de la technologie et de l'architecture informatique
-  et qui veulent en savoir davantage sur la manière fonctionne VirtualBox "sous
-  le capeau".</para>
+  et qui veulent en savoir davantage sur la manière dont fonctionne VirtualBox "sous
+  le capot".</para>
 
   <sect1 id="vboxconfigdata">
     <title>Où VirtualBox stocke ses fichiers</title>
 
     <para>Dans VirtualBox, une machine virtuelle et ses paramètres sont
-    déscrits dans un fichier de paramètres de la machine virtuelle, au format
+    décrits dans un fichier de paramètres de la machine virtuelle, au format
         XML. De plus, la plupart des machines virtuelles ont un ou plusieurs
         disques durs qui leur sont en général présentés par des images de disque
         (comme au format VDI). L'endroit où sont stockés tous ces fichiers
@@ -79,7 +79,7 @@
       vous commencez à travailler avec la VM, des fichiers supplémentaires
       apparaîtront&#xA0;: vous trouverez des fichiers journaux dans un
       sous-dossier qui s'appelle 
-      <computeroutput>Logs</computeroutput>, and une fois que vous aurez pris
+      <computeroutput>Logs</computeroutput>, et une fois que vous aurez pris
       des instantanés, ils apparaîtront dans un sous-dossier
       <computeroutput>Snapshots</computeroutput>. Pour chaque VM, vous pouvez
       modifier l'emplacement de son dossier d'instantanés dans les paramètres
@@ -98,11 +98,11 @@
 
       <para>Si vous avez mis à jour vers VirtualBox 4.0 en partant d'une ancienne
       version de VirtualBox, vous aurez probablement vos fichiers de paramètres
-      et les disques selon l'organisation du szstème de fichiers d'alors.</para>
+      et les disques selon l'organisation du système de fichiers d'alors.</para>
       
-      <para>Avant la version 4.0, VirtualBox séparait les fichiers des
-      paramètres de la machine des images de disque virtuel. Les fichiers de
-      paramétrages de la machine avaient une extension
+      <para>Avant la version 4.0, VirtualBox séparait les fichiers de
+      paramètrage de la machine des images de disque virtuel. Les fichiers de
+      paramétrage de la machine avaient une extension
       <computeroutput>.xml</computeroutput> et se trouvaient dans un dossier
       appelé "Machines" dans le répertoire de configuration global de VirtualBox
       (voir la prochaine section). Donc, par exemple, sur Linux, il s'agissait
@@ -128,7 +128,7 @@
             de disque (qui se trouvaient à des endroits différents), mais
             il fallait en plus copier méticuleusement les entrées du disque
             dur à partir du XML du registre de médias global, ce qui était
-            presqu'impossible si la machine avait des instantanés et, donc, des
+            presque impossible si la machine avait des instantanés et, donc, des
             images de différenciation.</para>
           </listitem>
 
@@ -142,7 +142,7 @@
         </orderedlist></para>
 
       <para>Si les nouvelles VMs créées avec VirtualBox 4.0 ou supérieur 
-      respecteront la nouvelle organisation, pour une compatibilité maximum, les
+      respectent la nouvelle organisation, pour une compatibilité maximum, les
       anciennes VMs <emphasis>ne sont pas</emphasis> converties en nouvelle
       organisation. Sans cela, les paramètres de la machine seraient immanquablement
       cassés si l'utilisateur rétrogradait de la 4.0 à une version plus ancienne
@@ -153,7 +153,7 @@
       <title>Données globales de configuration</title>
 
       <para>Outre les fichiers des machines virtuelles, VirtualBox gère des
-      données globales de configuration. Sur Linux et Solaris, depuis as of VirtualBox 4.3
+      données globales de configuration. Sur Linux et Solaris, depuis VirtualBox 4.3
       elles se trouvent dans le répertoire caché <computeroutput>$HOME/.config/VirtualBox</computeroutput>
       même si  <computeroutput>$HOME/.VirtualBox</computeroutput> sera utilisé
       s'il existe pour rester compatible avec les anciennes versions&#xA0;; sur
@@ -171,11 +171,11 @@
       de naviguer entre plusieurs configurations de VirtualBox.</para>
       
       <para>VirtualBox stocke essentiellement dans ce répertoire son fichier
-      de paramètres globaux, un autre fichier XMK appelé 
+      de paramètres globaux, un autre fichier XML appelé 
       <computeroutput>VirtualBox.xml</computeroutput>. Cela comprend des
        options de configuration globales et la liste des machines virtuelles
        enregistrées avec des pointeurs vers leurs fichiers de paramètres XML.
-       Ni l'emplacement du fichier ni son répertoire n'ont changé avec
+       (Ni l'emplacement du fichier ni son répertoire n'ont changé avec
       VirtualBox 4.0.)</para>
 
       <para>Avant VirtualBox 4.0, tous les médias virtuels (fichiers images
@@ -183,8 +183,8 @@
       fichier de paramètres. Par compatibilité, ce registre de médias existe
       toujours si vous mettez à jour VirtualBox et s'il y a des médias
       issus de machines créées avec une version inférieure à 4.0. Si vous
-      n'avez pas de telles machines, ce ne sera pas des retistres de médias 
-     globaux&#xA0;; avec VirtualBox 4.0, chaque fichier XML d'une machine a
+      n'avez pas de telles machines, il n'y aura pas de registre de médias 
+     global&#xA0;; avec VirtualBox 4.0, chaque fichier XML d'une machine a
      son propre registre de médias.</para>
 
       <para>De même, avant VirtualBox 4.0, le dossier "Machines" par défaut
@@ -196,10 +196,13 @@
     </sect2>
 
     <sect2>
-      <title>Résumé des des modifications de la configuration de 4.0</title>
+      <title>Résumé des modifications de la configuration de 4.0</title>
 
       <table>
-        <title>ignoreme</title>
+        <title>Changements de configuration en 4.0 et ultérieure</title>
+
+      <para>La table suivante donne un bref apperçu des changements de configuration
+      entre les versions anciennes et la 4.0 ou ultérieure&#xA0;:</para>
 
         <tgroup cols="3">
           <tbody>
@@ -225,7 +228,7 @@
 
               <entry><computeroutput>$HOME/.VirtualBox/HardDisks</computeroutput></entry>
 
-              <entry>In each machine's folder</entry>
+              <entry>Dans chaque dossier de machine</entry>
             </row>
 
             <row>
@@ -276,8 +279,8 @@
       que si les paramètres actuels ne peuvent pas être exprimés dans l'ancien
       format, par exemple parce que vous avez activé une fonction qui n'était
       pas présente dans l'ancienne version de VirtualBox.<footnote>
-          <para>Par exemple, avant VirtualBox 3.1, il n'était possible que d'activer
-          ou de désactiver un seul lecteur DVD dans une machine virtuelle.
+          <para>Par exemple, avant VirtualBox 3.1, il était possible d'activer
+          /désactiver qu'un seul lecteur DVD dans une machine virtuelle.
           S'il a été activé, cela serait toujours possible sur le deuxième
           maître du contrôleur IDE. Avec VirtualBox 3.1, on peut connecter
           des lecteurs DVD à un slot de son choix sur un contrôleur de son choix,
@@ -316,9 +319,9 @@
           est lancé automatiquement par le processus du premier client
           VirtualBox (la GUI, <computeroutput>VBoxManage</computeroutput>,
           <computeroutput>VBoxHeadless</computeroutput>, le service web ou
-          autres) et il s'arrête peu de temps après que le dernier client a
+          autre) et il s'arrête peu de temps après que le dernier client a
           quitté. Le service est responsable d'archiver, maintenir l'état de
-          toutes les VMS et de la communication entre les composants de VirtualBox.
+          toutes les VMs et de la communication entre les composants de VirtualBox.
           Cette communication est implémentée via COM/XPCOM.<note>
               <para>Quand nous parlons de "clients" ici, nous voulons dire
               les clients locaux d'un processus serveur
@@ -361,7 +364,7 @@
     disponibles. La liste complète comprise dans VirtualBox est&#xA0;:<orderedlist>
         <listitem>
           <para><computeroutput>VirtualBox</computeroutput>, l'interface Qt
-          implémentant le gestionnaire et les VMS en fonction&#xA0;;</para>
+          implémentant le gestionnaire et les VMs en fonction&#xA0;;</para>
         </listitem>
 
         <listitem>
@@ -378,7 +381,7 @@
 
         <listitem>
           <para><computeroutput>VBoxHeadless</computeroutput>, une interface de
-          VM qui ne fournit pas directement de sortie graphiqke et d'entrée
+          VM qui ne fournit pas directement de sortie graphique et d'entrée
           clavier/souris, 
           mais qui permet une redirection par VirtualBox Remote Desktop Extension;
           voir <xref linkend="vboxheadless" />.</para>
@@ -398,7 +401,7 @@
         </listitem>
       </orderedlist></para>
 
-    <para>En interne, VirtualBox consiste beaucoup plus d'interfaces
+    <para>En interne, VirtualBox comprend beaucoup plus d'interfaces
     séparées. Vous pourriez les rencontrer en analysant les messages d'erreur
     internes ou les fichiers journaux. Parmi elles, on compte&#xA0;:</para>
 
@@ -436,7 +439,7 @@
 
       <listitem>
         <para>PDM (Pluggable Device Manager), une interface abstraite entre le
-        VMM et les périphériques émulés qui sépare lese implémentations du
+        VMM et les périphériques émulés qui sépare les implémentations du
         périphérique de l'intérieur du VMM et qui facilite l'ajout de nouveaux
         périphériques émulés. Par PDM, des développeurs tiers peuvent ajouter
         de nouveaux périphériques virtuels à VirtualBox, sans devoir modifier
@@ -496,7 +499,7 @@
       </listitem>
 
       <listitem>
-        <para>Le composant "Main" est spécial&#xA0;: il croise tous les bits
+        <para>Le composant "Main" est spécial&#xA0;: il lie tous les modules
         ci-dessus et c'est la seule API publique fournie par VirtualBox. Tous
         les processus clients listés ci-dessus n'utilisent que cettte API et
         n'accèdent jamais directement aux composants de l'hyperviseur. Il s'en
@@ -524,7 +527,7 @@
     requêtes vers ce que vous avez configuré comme étant le disque dur virtuel
     de la machine virtuelle -- en principe, un fichier image sur votre hôte.</para>
 
-    <para>Malheureusement, la plateforme x86 n'a jamais été conçue pour pour
+    <para>Malheureusement, la plateforme x86 n'a jamais été conçue pour
     être virtualisée. La détection des
     situations où VirtualBox doit contrôler le code invité qui s'exécute, comme
     décrit ci-dessus, est difficile. Il existe deux façons de faire cela&#xA0;:<itemizedlist>
@@ -542,7 +545,7 @@
           role="bold">AMD-V</emphasis>. Le support d'Intel et d'AMD de la
           virtualisation est très différent dans le détail, mais pas si différent
           dans le principe.<note>
-              <para>Sur de nombreux szstèmes, les fonctions de virtualisation
+              <para>Sur de nombreux systèmes, les fonctions de virtualisation
               matérielle doivent être préalablement activées dans le BIOS avant
               de pouvoir être utilisées par VirtualBox.</para>
             </note></para>
@@ -595,7 +598,7 @@
       une petite perte de performances sera inévitable si vous mélangez des
       VMs avec virtualisation VT-x et logicielle. Nous recommandons de ne pas
       mélanger les modes de virtualisation si la performance maximum et
-      une faible overhead sont essentiels. Cela <emphasis>ne s'applique pas</emphasis>
+      une faible surcharge (overhead) sont essentiels. Cela <emphasis>ne s'applique pas</emphasis>
       à AMD-V.</para>
     </warning>
   </sect1>
@@ -608,7 +611,7 @@
     complexe car l'architecture du processeur n'a pas été conçue pour être
      virtualisée. On peut résoudre en général les problèmes, mais au prix de
     performances réduites. Ainsi, il existe un conflit constant entre les
-    performances de virtualisation et et son soin.</para>
+    performances de virtualisation et la précision.</para>
 
     <para>Le jeu d'instructions x86 a été conçu au départ dans les années 1970 et
     subi des modifications significatives avec l'ajout d'un mode protégé dans
@@ -616,7 +619,7 @@
     l'Intel 386 et l'architecture 32 bits. Alors que le 386 avait un
     support de virtualisation vraiment limité pour les opérations en mode réel,
     (le mode V86, utilisé par la "DOS Box" de Windows 3.x et d'OS/2 2.x), aucun
-    pport n'existait pour virtualiser toute l'architecture.</para>
+    port n'existait pour virtualiser toute l'architecture.</para>
 
     <para>En théorie, la virtualisation logicielle n'est pas complexe en soi. 
     Outre les quatre niveaux de privilèges ("rings") fournis par le matériel
@@ -654,7 +657,7 @@
     x86 standards, mais cela ne peut marcher que si l'OS invité peut être
     modifié, ce qui n'est évidemment pas toujours le cas.</para>
 
-    <para>VirtualBox choisit une approche différente. Quand uo démarre une
+    <para>VirtualBox choisit une approche différente. Quand on démarre une
     machine virtuelle par son pilote noyau du support ring-0, VirtualBox a
     réglé le système hôte pour qu'il puisse lancer nativement la plupart du
     code invité, mais il s'insère lui-même "en bas" de l'image. Il peut alors
@@ -669,7 +672,7 @@
     <para><itemizedlist>
         <listitem>
           <para>Le code invité ring 3 s'exécute sans modifications, à pleine
-          vitesse, autant que possible. Le nombre de fautes sera généralement
+          vitesse, autant que possible. Le nombre d'erreurs sera généralement
           faible (sauf si l'invité autorise l'E/S du port depuis ring 3, 
           chose que nous ne pouvons pas faire car nous ne voulons pas que
           l'invité puisse accéder aux ports réels). On parle aussi de "mode brut",
@@ -677,7 +680,7 @@
         </listitem>
 
         <listitem>
-          <para>Mour le code invité en ring 0, VirtualBox utilise une astuce
+          <para>Pour le code invité en ring 0, VirtualBox utilise une astuce
           savoureuse&#xA0;: il reconfigure l'invité pour que son code ring-0
           se lance plutôt en ring 1 (ce qui n'est en principe pas utilisé sur les
           systèmes d'exploitation x86). Il s'en suit que lorsque le code ring-0
@@ -723,7 +726,7 @@
           l'architecture x86 qui n'ont jamais été corrigés. Certaines instructions
           qui <emphasis>planteraient</emphasis> même en ring 1 ne le font pas.
           Cela concerne par exemple les paires d'instructions LGDT/SGDT, LIDT/SIDT,
-          ou POPF/PUSHF. Alors que l'opçration "load" est privilégiée et peut
+          ou POPF/PUSHF. Alors que l'opération "load" est privilégiée et peut
           donc planter, l'instruction "store" réussit toujours. Si l'invité est
           autorisé à les exécuter, il verra l'état réel du PC et pas celui
           virtualisé. L'instruction CPUID a également le même problème.</para>
@@ -754,9 +757,9 @@
         <listitem>
           <para>Certaines ressources doivent (et peuvent) être neutralisées par
           l'hyperviseur, mais l'accès est si fréquent que cela crée une perte
-          significative de performances. Un exemple réside dans le registre
+          significative de performance. Un exemple réside dans le registre
           TPR (Task Priority) en mode 32 bits. Les accès à ce registre doivent
-          être bloqués par l'hyperviseur, mais certains szstèmes d'exploitation
+          être bloqués par l'hyperviseur, mais certains systèmes d'exploitation
           invités (en particulier Windows et  Solaris) écrivent très souvent
           dans ce registre, ce qui porte une atteinte certaine aux performances
           de virtualisation.</para>
@@ -775,12 +778,12 @@
     mémoire de l'hyperviseur, où un générateur intégré a mis une implémentation
     plus convenable. En réalité, c'est une tâche très complexe car il existe
     de nombreuses situations compliquées à trouver et à gérer correctement. Donc,
-    vu son actuelle complexité, vous pourriez trouver que PATM est un recompilateur
-    avancé <emphasis>in-situ</emphasis> recompiler.</para>
+    vu son actuelle complexité, on pourrait dire que PATM est un recompilateur
+    avancé <emphasis>in-situ</emphasis>.</para>
 
     <para>De plus, à chaque fois qu'une erreur survient, VirtualBox analyse
     le code problématique pour déterminer s'il est possible de le corriger afin
-    de  l'empêcher de provoquer davantage futures d'erreurs. Cette approche
+    de  l'empêcher de provoquer davantage de futures erreurs. Cette approche
     fonctionne bien en pratique et améliore de façon drastique les performances
     de la virtualisation logicielle.</para>
   </sect1>
@@ -811,8 +814,8 @@
         </listitem>
       </itemizedlist></para>
 
-    <para>Le passage du mode racine au mode non racine s'appelle "l'entré1 VM",
-    celui en sens invers s'appelle "Quitter VM". Le VMCS inclut une zone d'état
+    <para>Le passage du mode racine au mode non racine s'appelle "l'entrée VM",
+    celui en sens inverse s'appelle "Quitter VM". Le VMCS inclut une zone d'état
     invité et hôte sauvegardée/restaurée à chaque entrée et sortie en VM.
     Surtout, les VMMS contrôlent les opérations de l'invité qui feront quitter
     la VM.</para>
@@ -830,8 +833,8 @@
     le VMCS contient des informations sur les raisons de la sortie, ainsi que,
     souvent, des détails environnants. Par exemple, si une écriture dans le
     registre CR0 fait quitter, l'instruction en cause est enregistrée, ainsi
-    que le fait qu'un accès en écriture sur le registre de contrôle a prurnqué
-    la sortie, et des informations sur la le registre source et destination.
+    que le fait qu'un accès en écriture sur le registre de contrôle a provoqué
+    la sortie, ainsi que les informations sur le registre source et destination.
     L'hyperviseur peut ainsi gérer efficacement la  condition sans avoir besoin
     de techniques avancées telles que CSAM et PATM décrits ci-dessus.</para>
 
@@ -847,7 +850,7 @@
     de périphérique.</para>
 
     <para>La plus grosse différence entre VT-x et AMD-V est qu'AMD-V fournit
-    en environnement de virtualisation plus complet. VT-x exige que le code
+    un environnement de virtualisation plus complet. VT-x exige que le code
     non-racine VMX s'exécute en mode pagination activée, ce qui rejette la
     virtualisation matérielle de logiciels dont le code est en mode réel et en
     mode protégé non paginé. Cela n'inclut en général que les firmwares et les
@@ -855,52 +858,52 @@
     avec VT-x. AMD-V n'a pas cette restriction.</para>
 
     <para>Bien entendu, la virtualisation matérielle n'est pas parfaite. Par
-    rapport à la virtualisation logicielle, la charge des fins des VMs est
+    rapport à la virtualisation logicielle, la surcharge (overherad) des sorties des VMs est
     relativement élevée. Cela pose des problèmes aux périphériques dont l'émulation
-    requiet un grand nombre de blocages (trass). Par exemple, avec le périphérique
+    requiet un grand nombre de captures (traps). Par exemple, avec le périphérique
     VGA en mode 16 couleurs, mon seulement tous les accès au port en E/S, mais
     aussi tous les accès à la mémoire tampon (framebuffer) doivent être 
-    bloqués.</para>
+    capturés.</para>
   </sect1>
 
-  <sect1 id="nestedpaging">
-    <title>Vagination nestée et VPIDs</title>
+  <sect1 id="imbriquéepaging">
+    <title>Pagination imbriquée (imbriquée) et VPIDs</title>
 
     <para>En plus de la virtualisation matérielle "brute", votre processeur peut
     supporter aussi des techniques sophistiquées supplémentaires&#xA0;:<footnote>
-        <para>VirtualBox 2.0 a ajouté le support de la pagination nestée d'AMD&#xA0;;
+        <para>VirtualBox 2.0 a ajouté le support de la pagination imbriquée d'AMD&#xA0;;
         le support de l'EPT et des  VPIDs d'Intel a été ajouté à la version 2.1.</para>
       </footnote><itemizedlist>
         <listitem>
           <para>Une fonctionnalité récente, qui s'appelle la
-          <emphasis role="bold">"pagination nestée"</emphasis> implémente la
-          gestion de la mémoire dans le matériel, ae qui peut beaucoup accélérer
+          <emphasis role="bold">"pagination imbriquée"</emphasis> implémente la
+          gestion de la mémoire dans le matériel, ce qui peut beaucoup accélérer
           la virtualisation matérielle puisque ces tâches n'ont plus besoin d'être
           accomplies par le logiciel de virtualisation.</para>
 
-          <para>Avec la pagination nested, le matériel fournit un autre niveau
+          <para>Avec la pagination imbriquée, le matériel fournit un autre niveau
           d'indirection en passant du linéaire aux adresses physiques. Les
           tables de page fonctionnent comme avant mais les adresses linéaires 
           sont désormais d'abord traduites en adresses physiques de "l'invité"
           et pas directement en adresses physiques. Il existe maintenant un
-          nouveau jeu de registres de pagination sous le mécanisme depagination 
+          nouveau jeu de registres de pagination sous le mécanisme de pagination 
           traditionnel et qui traduit les adresses physiques invitées en adresses
           physiques de l'hôte, qui sont utilisées pour accéder à la mémoire.</para>
 
-          <para>La pagination nested élimine la charge causée par les fins de
+          <para>La pagination imbriquée élimine la charge causée par les sorties de
           VM et les accès aux tables de pages. Par définition, avec les tables
-          de pages nested, l'invité peut gérer la pagination sans que l'hyperviseur
-          n'intervienne. La pagination nestée améliore ainsi substantiellement
+          de pages imbriquées, l'invité peut gérer la pagination sans que l'hyperviseur
+          n'intervienne. La pagination imbriquée améliore ainsi substantiellement
           les performances de virtualisation.</para>
 
-          <para>Sur les processeurs AMD, la pagination nested est disponible 
+          <para>Sur les processeurs AMD, la pagination imbriquée est disponible 
           depuis l'architecture Barcelona (K10) -- on l'appelle maintenant la
           "rapid virtualization indexing" (RVI). Intel a ajouté le support de
-          la pagination nested, qu'ils appellent la "extended page tables" (EPT),
+          la pagination imbriquée, qu'ils appellent la "extended page tables" (EPT),
           à leurs processeurs Core i7 (Nehalem).</para>
 
-          <para>Si la pagination nested est activée, l'hyperviseur de VirtualBox
-          peut également utiliser <emphasis role="bold">large pages</emphasis>,
+          <para>Si la pagination imbriquée est activée, l'hyperviseur de VirtualBox
+          peut également utiliser <emphasis role="bold">grandes pages</emphasis>,
           pour réduire l'utilisation du TLB et la charge. Cela peut provoquer
           une amélioration jusqu'à 5% des performances. Pour activer cette
           fonctionnalité pour une VM, vous avez besoin d'utiliser la commande
@@ -913,11 +916,11 @@
           <para>Sur les processeurs Intel, une autre fonction matérielle, qui
           s'appelle <emphasis role="bold">"Virtual Processor Identifiers" (VPIDs)</emphasis>,
           peut beaucoup accélérer le changement de contexte en réduisant le
-          besoin de flasher beaucoup les Translation Lookaside Buffers
+          besoin coûteux de mémoriser les Translation Lookaside Buffers
           (TLBs) du processeur.</para>
 
           <para>Pour activer ces fonctions pour une VM, vous devez utiliser
-          les commandes <computeroutput>VBoxManage modifyvm --vtxvpid</computeroutput> and
+          les commandes <computeroutput>VBoxManage modifyvm --vtxvpid</computeroutput> et
           <computeroutput>--largepages</computeroutput>&#xA0;; voir <xref
           linkend="vboxmanage-modifyvm" />.</para>
         </listitem>
diff --git a/doc/manual/fr_FR/user_ThirdParty.xml b/doc/manual/fr_FR/user_ThirdParty.xml
index e4d6b50..a10a7d8 100644
--- a/doc/manual/fr_FR/user_ThirdParty.xml
+++ b/doc/manual/fr_FR/user_ThirdParty.xml
@@ -2,24 +2,24 @@
 <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
   "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
 <appendix id="ThirdParty">
-  <title>Matériaux tiers et licences</title>
-
-  <para>VirtualBox englobe des matériaux de plusieurs logiciels Open Source.
-  Donc, l'utilisation de ces matériaux par VirtualBox est soumise à des licences
-  Open Source. Ce document reproduit ces licences et fournit une liste des matériaux
-  utilisés avec leurs conditions de licences respectives. La section 1 contient
-  une liste des matériaux utilisés. La section 2 reproduit les licences Open Source
-  applicables. Pour chaque matériaux, nous fournissons une référence à sa
+  <title>Briques tiers et licences</title>
+
+  <para>VirtualBox englobe des briques de plusieurs logiciels Open Source.
+  Donc, l'utilisation de ces briques par VirtualBox est soumise à des licences
+  Open Source. Ce document reproduit ces licences et fournit une liste des briques
+  utilisées avec leurs conditions de licences respectives. La section 1 contient
+  une liste des briques utilisées. La section 2 reproduit les licences Open Source
+  applicables. Pour chaque brique, nous fournissons une référence à sa
   licence.</para>
 
-  <para>Le code source des matériaux listés ci-dessous ainsi que le reste du
+  <para>Le code source des briques listées ci-dessous ainsi que le reste du
   code de VirtualBox publiés sous licence open source sont disponibles sur
   <ulink url="http://www.virtualbox.org">http://www.virtualbox.org</ulink>, sous
   forme d'archives tar pour des versions en particulier et d'un dépôt SVN en
   direct.</para>
 
   <sect1>
-    <title>Matériaux</title>
+    <title>briques</title>
 
     <itemizedlist>
       <listitem>
diff --git a/doc/manual/fr_FR/user_Troubleshooting.xml b/doc/manual/fr_FR/user_Troubleshooting.xml
index a97f967..f4d0607 100644
--- a/doc/manual/fr_FR/user_Troubleshooting.xml
+++ b/doc/manual/fr_FR/user_Troubleshooting.xml
@@ -22,7 +22,7 @@
       touchées exactement comme celles physiques.</para>
 
       <para>Si vous rencontrez un problème vraiment lié à VirtualBox, celui-ci
-      aide à le catégoriser et à l'isoler. Voici quelques-unes questions auxquelles
+      aide à le catégoriser et à l'isoler. Voici quelques questions auxquelles
       vous devriez répondre avant de signaler un problème&#xA0;:<orderedlist>
           <listitem>
             <para>Le problème est-il spécifique à un OS invité en particulier&#xA0;?
@@ -44,7 +44,7 @@
           <listitem>
             <para>Le problème est-il spécifique à un matériel hôte particulier&#xA0;?
             Cette catégorie de problèmes est généralement liée au processeur de
-            l'hôte. D1 fait de différences importantes entre VT-x et AMD-V, des
+            l'hôte. Du fait de différences importantes entre VT-x et AMD-V, des
             problèmes peuvent être spécifiques à l'une ou l'autre technologie.
             Le modèle exact du processeur peut également marquer une différence
             (même pour la virtualisation logicielle) car différents processeurs
@@ -77,7 +77,7 @@
 
           <listitem>
             <para>Le problème est-il spécifique à un environnement particulier&#xA0;?
-            Certains problèmes sont liés à un environnement et externes à la VM&#xA0;;
+            Certains problèmes sont liés à un environnement externes à la VM&#xA0;;
             cela implique en général un paramétrage du réseau. Certaines
             configurations de serveurs externes tels que DHCP ou PXE peuvent
             poser des problèmes qui ne surviennent pas avec d'autres serveurs
@@ -103,7 +103,7 @@
 
       <para>À chaque fois que VirtualBox démarre une VM, ce qu'on appelle un <emphasis
       role="bold">"release log file"</emphasis> (fichier journal) est créé,
-      centenant beaucoup d'informations sur la configuration de la VM et les
+      contenant beaucoup d'informations sur la configuration de la VM et les
       événements lors de son exécution. Le fichier journal s'appelle
       <computeroutput><literal>VBox.log</literal></computeroutput> et se trouve
       dans le dossier du fichier journal de la VM. Il s'agira en général d'un
@@ -122,7 +122,7 @@
       "Afficher les journaux..." dans la fenêtre "Machine".</para>
 
       <para>Le fichier journal (VBox.log) contient une gamme d'informations
-      de diagnostique telles que le type et la version d'OS hôte, la version
+      de diagnostic telles que le type et la version d'OS hôte, la version
       de VirtualBox et l'architecture (32 ou 64 bits), un aperçu complet de la
       configuration de l'invité (CFGM), des informations détaillées sur le
       type et les fonctions supportées par le processeur, si la virtualisation
@@ -174,7 +174,7 @@
           rendue disponible uniquement pour les utilisateurs avancés ayant un
           degré de familiarité très élevé du jeu d'instructions d'une machine
           x86/AMD64, ainsi que des connaissances détaillées de l'architecture
-          PC. Une certaine familiarité avec les côtés internes de l'OS invité
+          PC. Une certaine familiarité avec les aspects internes de l'OS invité
           concerné peut aussi aider.</para>
         </warning></para>
 
@@ -225,7 +225,7 @@
 
       <para>La syntaxe des commandes du débogueur de VM est grosso modo sur
       le même modèle que les débogueurs de Microsoft et d'IBM, utilisés sur
-      DOS, OS/2 et Windows. Les utilisateurs familiiers de symdeb,
+      DOS, OS/2 et Windows. Les utilisateurs familiers de symdeb,
       CodeView, ou du débogueur du noyau the OS/2 trouveront le débogueur de
       VM de VirtualBox classique.</para>
 
@@ -263,7 +263,7 @@
 
           <listitem>
             <para><computeroutput>da/db/dw/dd/dq</computeroutput> -- affiche
-            le contenu de la mémoire sous forme d'as ASCII/octets/mots/dwords/qwords</para>
+            le contenu de la mémoire sous forme ASCII/octets/mots/dwords/qwords</para>
           </listitem>
 
           <listitem>
@@ -312,7 +312,7 @@
 
           <listitem>
             <para><computeroutput>writecore</computeroutput> -- écrit sur le
-            disque un fichier c&#x153;ur de VM, rcroq!ez-vous au
+            disque un fichier c&#x153;ur de VM, reportez-vous au
             <xref linkend="ts_guest-core-format" /></para>
           </listitem>
         </itemizedlist></para>
@@ -343,7 +343,7 @@
       L'invité est en principe occupé et il devrait être vidé des informations
       symboliques que la boucle active du système d'exploitation invité exécute.</para>
 
-      <para>Un autre groupe de commandes du débogueur est celui
+      <para>Un autre groupe de commandes du débogueur est 
       <computeroutput>info</computeroutput>. L'exécution d
     <computeroutput>info help</computeroutput> fournit ces 
       informations d'utilisation complètes. Les commandes d'informations 
@@ -437,7 +437,7 @@
   -> Version du fichier c&#x153;ur de la VM
   -> Version de VBox
   -> Nombre de vprocesseurs etc.
-[ Note Header, type NT_VBOXCPU ] - one pour chaque vprocesseur
+[ Note Header, type NT_VBOXCPU ] - un pour chaque vCPU
 [ vCPU 1 Note Header ]
   [ CPUMCTX - vCPU 1 dump ]
 [ Remarques + données supplémentaires ] - Non utilisées aujourd'hui
@@ -465,8 +465,8 @@
     <title>Général</title>
 
     <sect2 id="ts_config-periodic-flush">
-      <title>L'invité affiche des erreurs IDE/SATA pour les images basées sur
-      un fichier sur un système de fichiers hôte lent</title>
+      <title>L'invité affiche des erreurs IDE/SATA pour les images 
+      fichier d'un système de fichiers hôte lent</title>
 
       <para>De temps en temps, certains systèmes de fichiers hôte offrent des
       performances d'écriture très faibles et, par conséquent, créent des
@@ -474,7 +474,7 @@
       et cela ne devrait pas provoquer de vrais problèmes, car l'invité devrait
       répéter des commandes qui ont dépassé le timeout. Cependant, certains
       invités (comme certaines versions
-      de Linux) ont de gros problèmes si l'écriture dans un fichier image met
+      de Linux) ont de gros problèmes si l'écriture dans un fichier image dépasse
       15 secondes. Or, certains systèmes de fichiers nécessitent plus d'une
       minute pour effectuer une seule écriture, si le cache de l'hôte contient
       beaucoup de données à écrire.</para>
@@ -486,7 +486,7 @@
       <para>Pour contourner ce problème (la vraie correction est d'utiliser un
       système de fichier plus rapide qui n'excède pas de telles performances
       d'écriture inacceptables), il est possible de flasher le fichier image
-      après qu'une certaine quantité de données a été écrite. Cet intervalle est
+      après qu'une certaine quantité de données ait été écrite. Cet intervalle est
       en principe infini mais vous pouvez le configurer individuellement pour
       chaque disque d'une VM.</para>
 
@@ -508,33 +508,33 @@
       vous ne devez pas la définir pour des lecteurs CD/DVD.</para>
 
       <para>L'unité d'intervalle [b] est le nombre d'octets écrits depuis le
-      dernier flush. Sa valeur doit être sélectionnée de sorte que les longs
-      dépais d'écriture occasionnels ne se produisent pas. Comme la bonne valeur
-      d'intervalle de flush dépend des performances de l'hôte et du système de
+      dernier vidage. Sa valeur doit être sélectionnée de sorte que les longs
+      délais d'écriture occasionnels ne se produisent pas. Comme la bonne valeur
+      d'intervalle de vidage dépend des performances de l'hôte et du système de
       fichiers hôte, savoir la valeur optimum qui fait disparaître le problème 
       nécessite d'expérimenter. Des valeurs entre 1000000 et 10000000 (1 to 10 mégaoctets)
       sont un bon point de départ. La diminution de l'intervalle réduit la probabilité
       du problème et les performances d'écriture de l'invité. Le test des valeurs faibles inutilement sera coûteux en
-      performances sans avantages. Un intervalle de 1 fera un flush toutes les
+      performances sans avantages. Un intervalle de 1 fera un vidage toutes les
       opération d'écriture et cela devrait résoudre le problème dans tous les
       cas, mais cela est très coûteux en performances d'écriture.</para>
 
-      <para>Fournir la valeur 0 à [b] revient à un intervalle de flush infini
+      <para>Fournir la valeur 0 à [b] revient à un intervalle de vidage infini
       ce qui désactive de fait ce contournement. La suppression de la donnée
       supplémentaire en ne spécifiant aucune valeur pour [b] aboutit au même
       effet.</para>
     </sect2>
 
     <sect2>
-      <title>Réponse aux requêtes de flush IDE/SATA de l'invité</title>
+      <title>Réponse aux requêtes de vidage IDE/SATA de l'invité</title>
 
-      <para>Si vous le souhaitez, les images de disque virtuelles peuvent être
+      <para>Si vous le souhaitez, les images virtuelles de disque peuvent être
       flashées quand l'invité lance une commande IDE FLUSH CACHE. Normalement ces
       requêtes sont ignorées pour des performances améliorées. Les paramètres
       ci-dessous sont acceptés uniquement pour les lecteurs de disque. Elles ne
       doivent pas être définies pour des lecteurs DVD.</para>
 
-      <para>Pour activer le flash des disques IDE, lancez la 
+      <para>Pour activer le vidage des disques IDE, lancez la 
       commande suivante&#xA0;:</para>
 
       <screen>VBoxManage setextradata "nom VM" "VBoxInternal/Devices/piix3ide/0/LUN#[x]/Config/IgnoreFlush" 0</screen>
@@ -544,7 +544,7 @@
       canal, 2 pour le périphérique maître du deuxième canal, ou 3 pour le
       périphérique esclave du deuxième canal.</para>
 
-      <para>Pour activer le flash pour des disques SATA, lancez la commande
+      <para>Pour activer le vidage pour des disques SATA, lancez la commande
       suivante&#xA0;:</para>
 
       <screen>VBoxManage setextradata "nom VM" "VBoxInternal/Devices/ahci/0/LUN#[x]/Config/IgnoreFlush" 0</screen>
@@ -552,10 +552,10 @@
       <para>La valeur [x] qui sélectionne le disque peut être une valeur entre
       0 et 29.</para>
 
-      <para>Remarquez que cela ne concerne pas les flash effectués selon la
+      <para>Remarquez que cela ne concerne pas les vidages effectués selon la
       configuration décrite au <xref linkend="ts_config-periodic-flush"
       xrefstyle="template: %n" />. La restauration des paramètres par défaut
-      d'ignrance des commandes est possible en paramétrant la valeur sur 1 ou en
+      d'ignorance des commandes est possible en paramétrant la valeur sur 1 ou en
       supprimant la clé.</para>
     </sect2>
 
@@ -588,9 +588,9 @@
       <para>Pour utiliser l'accélération graphique 2D dans VirtualBox, la carte
       graphique de votre hôte devrait supporter certaines extensions d'OpenGL.
       Au démarrage, VirtualBox vérifie ces extensions et, si le test échoue, cette
-      option est grisée silencieusement..</para>
+      option est grisée silencieusement.</para>
 
-      <para>Pour savoir la raison pour laquelle il a échoué, vous pouvez exécuter
+      <para>Pour connaître la raison pour laquelle il a échoué, vous pouvez exécuter
       à la main la commande suivante&#xA0;:</para>
 
       <screen>VBoxTestOGL --log "log_file_name" --test 2D</screen>
@@ -612,7 +612,7 @@
       <para>La modification de certains paramètres d'une machine virtuelle peut
       faire échouer des invités Windows au démarrage, avec un écran bleu. Cela
       peut se produire si vous changez les paramètres d'une VM après avoir installé
-      Windows ou si vous copiez ude image de disque avec un Windows installé
+      Windows ou si vous copiez une image de disque avec un Windows installé
       sur une VM nouvellement créée dont les paramètres diffèrent de la machine
       d'origine.</para>
 
@@ -643,12 +643,12 @@
       <title>Écran bleu sur Windows 0x101 si SMP est activé (IPI timeout)</title>
 
       <para>Si une VM est configurée pour avoir plus d'un processeur (multiprocesseurs
-      symmétrique, SMP), certaines configurations d'invités Windows plantent avec
+      symmétriques, SMP), certaines configurations d'invités Windows plantent avec
       un message d'erreur 0x101 indiquant une interruption du timeout de
       l'inter-processeur (IPIs, Interprocessor Interrupts). Ces interruptions
       synchronisent la gestion de mémoire entre les processeurs.</para>
 
-      <para>Selon Microsoft, cela vient d'une race condition (condition conflictuelle)
+      <para>Selon Microsoft, cela vient d'une condition concurrentielle (avec conflit)
       dans Windows. Un correctif existe.<footnote>
           <para>Voir <ulink
           url="http://support.microsoft.com/kb/955076">http://support.microsoft.com/kb/955076</ulink>.</para>
@@ -659,8 +659,8 @@
     <sect2>
       <title>Échecs d'installation de Windows 2000</title>
 
-      <para>En installant des invités Windows 2000, vous pourriez rencontrer un
-      des problèmes suivants&#xA0;:</para>
+      <para>En installant des invités Windows 2000, vous pourriez rencontrer 
+      les problèmes suivants&#xA0;:</para>
 
       <itemizedlist>
         <listitem>
@@ -674,28 +674,28 @@
         </listitem>
 
         <listitem>
-          <para>L'installation se plaint d'un échec lors de l'installation de
+          <para>L'installation rapporte un échec lors de l'installation de
           <literal>msgina.dll</literal>.</para>
         </listitem>
       </itemizedlist>
 
       <para>Ces problèmes viennent tous d'un bogue du pilote de disque dur de
-      Windows 2000. Après avoir sollicité une requête du disque dur, il arrive
-      un conflit de condition (race condition) dans le code du pilote Windows,
+      Windows 2000. Après avoir sollicité une requête du disque dur, il survient
+      un conflit concurrentiel (race condition) dans le code du pilote Windows,
       qui conduit à une corruption si l'opération se termine trop vite, donc si
       l'interruption matérielle du contrôleur IDE survient trop tôt. Avec du
       matériel physique, il existe un délai garanti dans la plupart des systèmes,
       donc le problème est généralement caché (il devrait être cependant possible
       de le reproduire aussi sur du matériel physique). Dans un environnement
       virtuel, l'opération peut se faire immédiatement (surtout sur des systèmes
-      très rapides) avec plusieurs processeurs) et l'interruption est signalée
+      très rapides avec plusieurs CPU) et l'interruption est signalée
       plus tôt que sur un système physique. La solution consiste à introduire 
       un délai artificiel avant d'envoyer de telles interruptions. Vous pouvez
       configurer ce délai pour une VM avec la commande suivante&#xA0;:</para>
 
       <screen>VBoxManage setextradata "nom VM" "VBoxInternal/Devices/piix3ide/0/Config/IRQDelay" 1</screen>
 
-      <para>Ceci définit le délai sur une milliseconde. Si cela n'aide pas,
+      <para>Ceci définit le délai à une milliseconde. Si cela n'aide pas,
       passez-le à une valeur entre 1 et 5 millisecondes. Merci de remarquer que
       cela ralentit les performances du disque. Après l'installation, vous devriez
       pouvoir supprimer la clé (ou la passer à 0).</para>
@@ -706,8 +706,8 @@
 
       <para>Quand les invités Windows connaissent un plantage du noyau, ils affichent
       l'horrible écran bleu. Selon la façon dont est configuré Windows, les
-      informations demeureront à l'écran jusqu'à ce que la machine ne redémarre
-      ou ils redémarrent automatiquement. Pendant l'installation, Windows est
+      informations demeureront à l'écran jusqu'à ce que la machine soit redémarrée
+      ou qu'elle redémarre automatiquement. Pendant l'installation, Windows est
       généralement configuré pour redémarrer automatiquement. Avec le
       redémarrage automatique, il n'y a aucune chance d'enregistrer les informations
       d'un écran bleu, alors qu'elles pourraient être importantes pour déterminer
@@ -720,7 +720,7 @@
     </sect2>
 
     <sect2>
-      <title>Pas de réseau dans les invitàs Windows Vista</title>
+      <title>Pas de réseau dans les invités Windows Vista</title>
 
       <para>Avec Windows Vista, Microsoft a abandonné le support de la carte
       AMD PCNet utilisée par VirtualBox comme carte réseau virtuelle par défaut
@@ -785,14 +785,14 @@
       la restauration d'un instantané</title>
 
       <para>Si un invité Windows est membre d'un domaine Active Directory et
-      que vous utilisez la fonction des instantanés de VirtualBox, pourraient
+      que vous utilisez la fonction des instantanés de VirtualBox, il pourrait
       se produire des pertes de cet état après la restauration d'un ancien
       instantané.
       </para>
 
       <para>Ceci vient du changement automatique de mot de passe de la machine opéré
       régulièrement par Windows pour des raisons de sécurité. Vous pouvez
-      désactiver cette fonction en suivant les inptructions de <ulink
+      désactiver cette fonction en suivant les instructions de <ulink
           url="http://support.microsoft.com/kb/154501">http://support.microsoft.com/kb/154501</ulink>
           cet article de Microsoft.
       </para>
@@ -819,7 +819,7 @@
       <para>Par contre, pour le support WDDM Direct3D, les fichiers d3d8.dll et
           d3d9.dll inclus d'origine sont nécessaires pour lancer des applications
           Direct3D 8.0 et Direct3D 9.0. Il résulte de la corruption des fichiers
-          szstème ci-dessus que ces applications ne fonctionneront plus. Voir
+          système ci-dessus que ces applications ne fonctionneront plus. Voir
           ci-dessous pour une guide pas à pas sur la restauration des fichiers
           systèmes d'origine 
           d3d8.dll et d3d9.dll si l'installeur des suppléments invité de
@@ -895,7 +895,7 @@
           <para>Localisez le fichier install.wim et cliquez deux fois dessus.
           Après l'ouverture du fichier par 7-Zip, vous verrez un certain nombre
           de dossiers. Chaque sous-dossier numéroté représente une version
-          différente de I$indows (Starter, Home Basic, and ainsi de suite)</para>
+          différente de Windows (Starter, Home Basic, and ainsi de suite)</para>
         </listitem>
 
         <listitem>
@@ -926,7 +926,7 @@
 
       <para>Certains invités Linux peuvent entraîner une forte charge du processeur
       même si le système invité semble inactif. Cela peut venir d'une fréquence
-      horloge élevée du noyau invité. Certaines distributions Linux, par exemple
+      d'horloge élevée du noyau invité. Certaines distributions Linux, par exemple
       Fedora, incluent un noyau Linux configuré pour une fréquence d'horloge de
       <emphasis role="bold"> 1000Hz</emphasis>. Nous vous recommandons de
       recompiler le noyau invité et de sélectionner une fréquence d'horloge de
@@ -937,7 +937,7 @@
       (par exemple, CentOS et Oracle Linux) supportent un paramètre
       <emphasis>divider=N</emphasis> du noyau. D'où le fait que de tels noyaux
       supportent une fréquence d'horloge plus faible sans recompilation. Nous
-      vous suggérons d'ajouter le paramçtre <emphasis>divider=10</emphasis> du
+      vous suggérons d'ajouter le paramètre <emphasis>divider=10</emphasis> du
       noyau pour sélectionner une fréquence de l'horloge du noyau invité de
       100Hz.</para>
     </sect2>
@@ -952,7 +952,7 @@
     </sect2>
 
     <sect2 id="ts_linux-buggy">
-      <title>Versions bugguées du noyau Linux Linux 2.6</title>
+      <title>Versions buguées du noyau Linux Linux 2.6</title>
 
       <para>Les bogues suivants des noyaux Linux les empêchent de les exécuter
       correctement dans VirtualBox, ce qui fait planter la VM au démarrage&#xA0;:<itemizedlist>
@@ -964,7 +964,7 @@
           </listitem>
 
           <listitem>
-            <para>Avec la virtualisation matérielle et l'APIC EÓS activé, les
+            <para>Avec la virtualisation matérielle et l'APIC E/S activé, les
             noyaux inférieurs au 2.6.24-rc6 peuvent planter au démarrage avec le
             message suivant&#xA0;:<screen>Kernel panic - not syncing: IO-APIC + timer doesn't work!  Boot with
 apic=debug and send a report.  Then try booting with the 'noapic' option</screen></para>
@@ -1021,7 +1021,7 @@ vérifier si le processus qui devrait le fournir est en fonction.</para>
           lors du démarrage, tant dans un environnement virtualisé que physique.
       </para>
       <para>
-          La solution recommandée est de mett!e à jour vers Solaris au moins 10 5/08 
+          La solution recommandée est de mettre à jour vers au moins Solaris 10 5/08 
           ("S10U5"). D'autres solutions consistent à obliger Solaris à toujours
           démarrer le noyau 32 bits ou à appliquer un correctif au bogue 6574102
           (tant que Solaris utilise le noyau 32 bits).
@@ -1041,11 +1041,11 @@ vérifier si le processus qui devrait le fournir est en fonction.</para>
       partager une configuration commune entre les processus de différentes
       machines virtuelles et de fournir plusieurs versions de l'interface
       utilisateur basées sur une architecture commune. Toutes les informations
-      d'état et la configuration globales sont maintenues par le processus
+      d'état et la configuration globale sont maintenues par le processus
       <computeroutput>VBoxSVC.exe</computeroutput>, qui est un service COM
       hors des processus. À chaque fois que le processus de VirtualBox est démarré,
       il demande un accès au serveur COM et Windows démarre automatiquement le
-      processus. Remarquez que l'utilisateur final ne devriez jamais le démarrer.</para>
+      processus. Notez que l'utilisateur final ne devrait jamais le démarrer.</para>
 
       <para>Quand le dernier processus se déconnecte du serveur COM, il se
       terminera lui-même après quelques secondes. La configuration de VirtualBox
@@ -1056,7 +1056,7 @@ vérifier si le processus qui devrait le fournir est en fonction.</para>
       de manière imprévue -, le serveur COM ne remarquera pas que le client est
       déconnecté et il restera actif longtemps (10 minutes voire plus), gardant
       verrouillés les fichiers de configuration. Dans de rares cas, le serveur
-      COM pourrait connaître une erreur interne et, en conséquence, l5s autres
+      COM pourrait connaître une erreur interne et, en conséquence, les autres
       processus pourraient ne pas pouvoir l'initialiser. Dans ces situations, il
       est recommandé d'utiliser le gestionnaire des tâches de Windows pour tuer
       le processus <computeroutput>VBoxSVC.exe</computeroutput>.</para>
@@ -1069,8 +1069,8 @@ vérifier si le processus qui devrait le fournir est en fonction.</para>
       l'invité ne remarque pas les changements de médias, assurez-vous que la
       fonction de notification de changement de média (MCN) de Windows n'est pas
       désactivée. Elle est représentée par la clé suivante dans le registre
-      Windows&#xA0;::<screen><literal>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Cdrom\Autorun</literal></screen>Il
-      se peut que certaines applications désactivent cette clé contre l'avis de
+      Windows&#xA0;::<screen><literal>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Cdrom\Autorun</literal></screen>
+      Il se peut que certaines applications désactivent cette clé contre l'avis de
       Microsoft. Si elle est définie à 0, passez-la à 1 et redémarrez votre système.
       VirtualBox s'appuie sur la notification de Windows de changement de média.</para>
     </sect2>
@@ -1084,7 +1084,7 @@ vérifier si le processus qui devrait le fournir est en fonction.</para>
       plus évidente) et la sortie. Ceci car le client RDP récupère l'entrée pendant
       un certain temps avant de l'envoyer au serveur RDP.</para>
 
-      <para>Vous pouvez diminuer l'intervalle en déscnissant une clé du registre
+      <para>Vous pouvez diminuer l'intervalle en définissant une clé du registre
       Windows sur des valeurs plus petites que celles par défaut, 100. La clé
       n'existe pas au départ, elle doit être de type DWORD. Son unité de valeur est en millisecondes. Les valeurs autour
       de 20 conviennent aux connexions avec faible bande passante entre le client
@@ -1099,7 +1099,7 @@ vérifier si le processus qui devrait le fournir est en fonction.</para>
 
       <screen>HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Min Send Interval</screen>
 
-      <para>osoit</para>
+      <para>soit</para>
 
       <screen>HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client\Min Send Interval</screen>
 
@@ -1109,11 +1109,11 @@ vérifier si le processus qui devrait le fournir est en fonction.</para>
     <sect2>
       <title>Lancer un initiateur et une cible iSCSI sur un seul système</title>
 
-      <para>Des Deadlocks peuvent se produire sur un hôte Windows quand on essaie
+      <para>Des verrouillages peuvent se produire sur un hôte Windows quand on essaie
       d'accéder à une cible iSCSI en fonction dans une machine virtuelle invitée
       avec un initiateur iSCSI (comme Microsoft iSCSI Initiator) en fonction
-      sur l'hôte. Cela vient d'un flaw dans le composant du gestionnaire de cache
-      de Windows et cela donne une réponse lente du szstème hôte, de plusieurs
+      sur l'hôte. Cela vient d'un défaut dans le composant du gestionnaire de cache
+      de Windows et cela donne une réponse lente du système hôte, de plusieurs
       minutes, suivies d'un message d'erreur "Delayed Write Failed" (délai 
       d'écriture différé) dans la barre système ou dans une fenêtre de message
       distincte. L'invité est bloqué pendant ce temps et il peut afficher des
@@ -1128,7 +1128,7 @@ vérifier si le processus qui devrait le fournir est en fonction.</para>
       <screen>set VBOX_DISABLE_HOST_DISK_CACHE=1
 VirtualBox</screen>
 
-      <para>Si cela réduira les performances du disque invité (surtout en écriture),
+      <para>Si cela réduif les performances du disque invité (surtout en écriture),
       cela ne concerne pas les performances d'autres applications en fonction
       sur l'hôte.</para>
     </sect2>
@@ -1142,21 +1142,20 @@ VirtualBox</screen>
       des raisons suivantes&#xA0;: <itemizedlist>
           <listitem>
             <para>Le nombre maximum de filtres autorisés a été atteint sur l'hôte.
-            Dans ce cas, le journal MSI indiquerait le code d'erreur
+            Dans ce cas, le journal MSI indiquera le code d'erreur
             <computeroutput>0x8004a029</computeroutput> retourné à l'installation
             du composant réseau NetFlt&#xA0;:<screen>VBoxNetCfgWinInstallComponent: Install failed, hr (0x8004a029)</screen></para>
 
-            <para>Vous pouvez essayer d'augmenter le nombre de filtrep maximum 
-            dans le registre Windows avec la clé suivante&#xA0;:<screen>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\MaxNumFilters</screen>Le
-            nombre maximum autorisé est de 14. Après le redémarrage, essayez
+            <para>Vous pouvez essayer d'augmenter le nombre de filtre maximum 
+            dans le registre Windows avec la clé suivante&#xA0;:<screen>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\MaxNumFilters</screen>Le nombre maximum autorisé est de 14. Après le redémarrage, essayez
             de réinstaller VirtualBox.</para>
           </listitem>
 
           <listitem>
             <para>Le cache INF est corrompu. Dans ce cas, le journal d'installation
             (<computeroutput>%windir%\inf\setupapi.log</computeroutput> sur XP
-            or <computeroutput>%windir%\inf\setupapi.dev.log</computeroutput>
-            sur Vista ou supérieur) indiqueraient normalement un échec pour 
+            ou <computeroutput>%windir%\inf\setupapi.dev.log</computeroutput>
+            sur Vista ou supérieur) indiquera normalement un échec pour 
             trouver le paquet du pilote adapté aux composants
             <computeroutput>sun_VBoxNetFlt</computeroutput> ou
             <computeroutput>sun_VBoxNetFltmp</computeroutput>. La solution est
@@ -1174,10 +1173,10 @@ VirtualBox</screen>
       soit avec VBoxManage), le cache INF est probablement corrompu. Dans ce cas,
       le journal d'installation (<computeroutput>%windir%\inf\setupapi.log</computeroutput>
       sur XP ou <computeroutput>%windir%\inf\setupapi.dev.log</computeroutput>
-      sur Vista ou supérieur) indiquerait généralement un échec pour trouver un
+      sur Vista ou supérieur) indiquera généralement un échec pour trouver un
       paquet de pilote adapté au composant <computeroutput>sun_VBoxNetAdp</computeroutput>.
       De nouveau, comme pour le problème du réseau bridgé décrit ci-dessus, la
-      solution consiste à désinstaller VirtualBox, à supprimer le cache JNF
+      solution consiste à désinstaller VirtualBox, à supprimer le cache INF
       (<computeroutput>%windir%\inf\INFCACHE.1</computeroutput>), à redémarrer
       et à essayer de réinstaller VirtualBox.</para>
     </sect2>
@@ -1203,7 +1202,7 @@ VirtualBox</screen>
       <title>Lecteur CD/DVD de l'hôte Linux non trouvé</title>
 
       <para>Si vous avez configuré une machine virtuelle pour utiliser le
-      lecteur CD/DVD de l'hôte, mais s'il semble ne pas fonctionner, assurez-vous
+      lecteur CD/DVD de l'hôte, et s'il semble ne pas fonctionner, assurez-vous
       que l'utilisateur actuel a le droit d'accéder au fichier de périphérique
       Linux correspondant (<computeroutput>/dev/hdc</computeroutput> ou
       <computeroutput>/dev/scd0</computeroutput> ou
@@ -1270,7 +1269,7 @@ VirtualBox</screen>
       <para>Si le support expérimental d'écriture sur un CD/DVD est activé avec
       une mauvaise configuration de l'hôte et de l'invité VirtualBox, il est
       possible que vos efforts pour accéder à l'écriture sur CD/DVD échouent et
-      n'aboutissent qu'à des messages d'erreur du noyau invité (pour les idvités
+      n'aboutissent qu'à des messages d'erreur du noyau invité (pour les invités
       Linux) ou à des messages d'erreur de l'application (pour les invités
       Windows). VirtualBox effectue les vérifications de cohérence habituelles 
       quand une VM est allumée (en particulier, il quitte avec un message d'erreur 
@@ -1323,11 +1322,11 @@ VirtualBox</screen>
       de configuration adéquat de votre système d'exploitation. Tant qu'il est en fonction,
       les fichiers de configuration sont verrouillés. La communication entre les
       composants de VirtualBox et <computeroutput>VBoxSVC</computeroutput> est
-      faite via une socket de domaine local qui se trouve dans
+      faite via un socket de domaine local qui se trouve dans
       <computeroutput>/tmp/.vbox-<username>-ipc</computeroutput>. En cas
       de problèmes de communication (par exemple si une application VirtualBox
       ne peut pas communiquer avec <computeroutput>VBoxSVC</computeroutput>),
-      clôturez les démons et supprimez le répertoire de la socket du domaine
+      clôturez les démons et supprimez le répertoire du socket du domaine
       local.</para>
     </sect2>
 
@@ -1337,9 +1336,9 @@ VirtualBox</screen>
       <para>Si l'USB ne fonctionne pas sur votre hôte Linux, assurez-vous que
       l'utilisateur actuel fait partie du groupe 
       <computeroutput>vboxusers</computeroutput>. Sur les hôtes anciens, vous
-      cevez vous assurer que l'utilisateur a le droit d'accéder au système de
+      devez vous assurer que l'utilisateur a le droit d'accéder au système de
       fichiers USB (<computeroutput>usbfs</computeroutput>), sur lequel s'appuie
-      VirtualBox pour récupérer des informations valides sur les périphériques'
+      VirtualBox pour récupérer des informations valides sur les périphériques
       USB de votre hôte. Le reste de cette section ne s'applique qu'à ces anciens
       systèmes.</para>
 
@@ -1386,7 +1385,7 @@ none     /proc/bus/usb     usbfs      devgid=85,devmode=664    0    0</screen>Re
       USB. Modifiez la ligne <screen>domount usbfs usbdevfs /proc/bus/usb -onoexec,nosuid,nodev</screen>
       pour qu'elle contienne <screen>domount usbfs usbdevfs /proc/bus/usb -onoexec,nosuid,nodev,devgid=85,devmode=664</screen>
       Comme d'habitude, remplacez 85 par le vrai numéro du groupe qui devrait
-      avoir accè aux périphériques USB.</para>
+      avoir accès aux périphériques USB.</para>
 
       <para>D'autres distributions font des opérations identiques dans des scripts
       stockés dans le répertoire <computeroutput>/etc/init.d</computeroutput>.</para>
@@ -1405,8 +1404,8 @@ none     /proc/bus/usb     usbfs      devgid=85,devmode=664    0    0</screen>Re
     <sect2>
       <title>pool vmalloc du noyau Linux dépassé</title>
 
-      <para>Quand on exécute un grand nombre de VMs avec un beaucoup de RAM sur
-      un systèmes Linux (disons 20 VMs de 1Go de RAM chacune), les VMs supplémentaires
+      <para>Quand on exécute un grand nombre de VMs avec beaucoup de RAM sur
+      un système Linux (disons 20 VMs de 1Go de RAM chacune), les VMs supplémentaires
       pourraient ne pas réussir à démarrer avec une erreur du noyau disant que
       le pool vmalloc est dépassé et que vous devriez l'agrandir. Le message
       d'erreur vous dit aussi de spécifier 
@@ -1428,7 +1427,7 @@ none     /proc/bus/usb     usbfs      devgid=85,devmode=664    0    0</screen>Re
     <sect2>
       <title>Ne peut pas démarrer de VM, pas assez de mémoire contiguë</title>
 
-      <para>Le szstème de fichiers ZFS est connu pour utiliser presque toute la
+      <para>Le système de fichiers ZFS est connu pour utiliser presque toute la
       RAM disponible comme du cache si les paramètres système par défaut ne sont
       pas modifiés. Cela peut conduire à une énorme fragmentation de la mémoire
       de l'hôte, empêchant les VMS de VirtualBox de démarrer. Nous vous recommandons
diff --git a/doc/manual/fr_FR/user_VBoxManage.xml b/doc/manual/fr_FR/user_VBoxManage.xml
index c0344ed..9b7ebfe 100644
--- a/doc/manual/fr_FR/user_VBoxManage.xml
+++ b/doc/manual/fr_FR/user_VBoxManage.xml
@@ -46,7 +46,7 @@
       <listitem>
         <para>Vous pouvez spécifier le nom de la VM comme il s'affiche dans 
         l'interface graphique de VirtualBox. Remarquez que si ce nom contient des
-        espaces, vous devez l'entourer de guillemets), comme cela est toujours
+        espaces, vous devez l'entourer de guillemets (comme cela est toujours
         le cas avec les arguments d'une ligne de commande contenant des espaces).</para>
 
         <para>Par exemple&#xA0;:<screen>VBoxManage startvm "Windows XP"</screen></para>
@@ -100,7 +100,7 @@ Settings file: '/home/nomutilisateur/.config/VirtualBox/Machines/SUSE 10.2/SUSE
       <listitem>
         <para>Pour modifier les paramètres pendant qu'une VM est éteinte, utilisez
         <computeroutput>VBoxManage modifyvm</computeroutput>, comme ceci&#xA0;:
-        <screen>VBoxManage modifyvm "Windows XP" --memory "512MB"</screen></para>
+        <screen>VBoxManage modifyvm "Windows XP" --memory 512</screen></para>
 
         <para>Pour des détails,voir <xref linkend="vboxmanage-modifyvm" />.</para>
       </listitem>
@@ -164,7 +164,7 @@ Settings file: '/home/nomutilisateur/.config/VirtualBox/Machines/SUSE 10.2/SUSE
             des informations de logo (utile pour les scripts)</para>
         </listitem>
         <listitem>
-          <para><computeroutput>--settingspw</computeroutput>&#xA0;: spécifiie
+          <para><computeroutput>--settingspw</computeroutput>&#xA0;: spécifie
           un mot de passe pour les paramètres</para>
         </listitem>
         <listitem>
@@ -174,7 +174,7 @@ Settings file: '/home/nomutilisateur/.config/VirtualBox/Machines/SUSE 10.2/SUSE
       </itemizedlist>
       Le mot de passe des paramètres est utilisé pour certains paramètres ayant
       besoin d'être stockés et chiffrés pour des raisons de sécurité. Pour le moment,
-      le seul paramètre chiffré est l'initateur secret iSCSI (voir 
+      le seul paramètre chiffré est l'initiateur secret iSCSI (voir 
       <xref linkend="vboxmanage-storageattach" /> pour les détails). Tant
       qu'aucun mot de passe des paramètres n'a été spécifié, ces informations
       sont stockées en <emphasis role="bold">texte brut</emphasis>. Après avoir
@@ -196,7 +196,7 @@ Settings file: '/home/nomutilisateur/.config/VirtualBox/Machines/SUSE 10.2/SUSE
         <listitem>
           <para><computeroutput>vms</computeroutput> liste toutes les machines
           virtuelles actuellement enregistrées avec VirtualBox. Par défaut, elle
-          affiche une liste compacte aavec le nom et l'UUID de chaque VM&#xA0;;
+          affiche une liste compacte avec le nom et l'UUID de chaque VM&#xA0;;
           si vous spécifiez en plus <computeroutput>--long</computeroutput> ou
           <computeroutput>-l</computeroutput>, cela affichera une liste détaillée
           comme avec la commande<computeroutput>showvminfo</computeroutput> (voir
@@ -247,8 +247,8 @@ Settings file: '/home/nomutilisateur/.config/VirtualBox/Machines/SUSE 10.2/SUSE
         </listitem>
 
         <listitem>
-          <para><computeroutput>hddbackends</computeroutput> liste les fondations
-          de disque virtuel connues de VirtualBox. Pour chaque format (tels que
+          <para><computeroutput>hddbackends</computeroutput> liste les backends (fondations)
+          de disque virtuel connus de VirtualBox. Pour chaque format (tels que
           VDI, VMDK ou RAW), ceci liste les possibilités de la fondation et sa
           configuration.</para>
         </listitem>
@@ -274,7 +274,7 @@ Settings file: '/home/nomutilisateur/.config/VirtualBox/Machines/SUSE 10.2/SUSE
         <listitem>
           <para><computeroutput>usbfilters</computeroutput> liste les filtres USB
           globaux enregistrés avec VirtualBox -- c'est-à-dire les filtres des
-          périphériques accessibles à toutes les machinc( virtuelles -- et
+          périphériques accessibles à toutes les machines virtuelles -- et
           il affiche les paramètres du filtre.</para>
         </listitem>
 
@@ -395,8 +395,8 @@ Statistics update:  disabled</screen></para>
         </listitem>
 
         <listitem>
-          <para>les fichiers de l'état sauvegardé créés par la machine s'il y en
-          a (un si la machine était en état "sauvegardé" et un pour chaque
+          <para>les fichiers de l'état sauvegardé créés par la machine si ils existent
+          (un si la machine était en état "sauvegardé" et un pour chaque
           instantané en ligne)&#xA0;;</para>
         </listitem>
 
@@ -485,7 +485,7 @@ Statistics update:  disabled</screen></para>
             <para><computeroutput>--memory
             <taillemémoire></computeroutput>&#xA0;: Ceci définit la quantité
             de RAM, en Mo, que devrait s'affecter à elle-même la machine virtuelle
-            sur l'hîte. Voir les remarques au <xref linkend="gui-createvm" /> pour
+            sur l'hôte. Voir les remarques au <xref linkend="gui-createvm" /> pour
             plus d'informations.</para>
           </listitem>
 
@@ -588,7 +588,8 @@ Statistics update:  disabled</screen></para>
 
           <listitem>
             <para><computeroutput>--triplefaultreset on|off</computeroutput> : ce
-            paramètre permet de relancer l'invité au lieu de récupérer une Guru Meditation. Certains invités échouent par une triple erreur lors de la réinitialisation
+            paramètre permet de relancer l'invité au lieu de récupérer une Guru Meditation.
+Certains invités échouent par une triple erreur lors de la réinitialisation
             du processeur, donc on peut parfois souhaiter ce comportement. Cela
             ne fonctionne que sur les invités non SMP.</para>
           </listitem>
@@ -614,7 +615,7 @@ Statistics update:  disabled</screen></para>
             la virtualisation matérielle est activée, pour Intel VT-x seulement,
             ce paramètre supplémentaire active ou désactive l'utilisation de la
             fonction TLB taggçe (VPID) du processeur de votre système hôte&#xA0;; 
-            voir see <xref linkend="hwvirt" />.</para>
+            voir <xref linkend="hwvirt" />.</para>
           </listitem>
 
           <listitem>
@@ -632,13 +633,13 @@ Statistics update:  disabled</screen></para>
 
           <listitem>
             <para>Vous pouvez influencer le logo du BIOS affiché quand une machine
-            virtuelle démarre avec un certain nombre de paramçtres. Par défaut,
+            virtuelle démarre avec un certain nombre de paramètres. Par défaut,
             un logo VirtualBox est affiché.</para>
 
             <para>Avec <computeroutput>--bioslogofadein
             on|off</computeroutput> et <computeroutput>--bioslogofadeout
-            on|off</computeroutput>, you pouvez déterminer si le logo devrait
-            fade in and out.</para>
+            on|off</computeroutput>, vous pouvez déterminer si le logo apparaît
+            et disparaît éstompé, respectivement.</para>
 
             <para>Avec <computeroutput>--bioslogodisplaytime
             <msec></computeroutput> vous pouvez définir la durée d'affichage
@@ -700,7 +701,7 @@ Statistics update:  disabled</screen></para>
             <para><computeroutput>--guestmemoryballoon
             <taille></computeroutput> définit la taille par défaut de la 
             mémoire du ballon de l'invité c'est-à-dire la mémoire affectée
-            par les suppléments invité de VirtualBox à partir du szstème d'exploitation
+            par les suppléments invité de VirtualBox à partir du système d'exploitation
             invité et rendue à l'hyperviseur pour être réutilisée par d'autres
             machines virtuelles. <taille> doit être spécifiée en mégaoctets.
             La taille par défaut est de 0 mégaoctets. Pour les
@@ -755,7 +756,7 @@ Statistics update:  disabled</screen></para>
             address translation (<computeroutput>nat</computeroutput>),
             le réseau bridgé (<computeroutput>bridged</computeroutput>) ou
             communiquer avec d'autres machines virtuelles en utilisant le réseau
-            internal (<computeroutput>intnet</computeroutput>), le réseau
+            interne (<computeroutput>intnet</computeroutput>), le réseau
             host-only (<computeroutput>hostonly</computeroutput>), ou accéder
             à des sous-modes rarement utilisés (<computeroutput>generic</computeroutput>).
             Ces options correspondent aux modes décrits en détail au <xref
@@ -806,9 +807,9 @@ Statistics update:  disabled</screen></para>
             <para><computeroutput>--hostonlyadapter<1-N>
             none|<nompériphérique></computeroutput>&#xA0;: Si le réseau
             host-only a été activé pour une carte réseau virtuelle (voir l'option
-            --nic ci-dessus&#xA0;; sinon ce paramètre n'a aucun effet), utilisez
-            cette option spécifier l'interface réseau host-only qu'utilisera
-            l'interface réseau donnée. Pour des détails, merci de voir <xref
+            --nic ci-dessus&#xA0;; sinon ce paramètre n'a aucun effet), employez
+            cette option pour spécifier quelle interface réseau host-only utilisera
+            l'interface réseau virtuelle donnée. Pour des détails, merci de voir <xref
             linkend="network_hostonly" />.</para>
           </listitem>
 
@@ -833,7 +834,7 @@ Statistics update:  disabled</screen></para>
           <listitem>
             <para><computeroutput>--nicgenericdrv<1-N>
             <pilote fondation></computeroutput>&#xA0;: Si le réseau
-            générique a été activée pour une carte réseau virtuelle (voir l'option
+            générique a été activé pour une carte réseau virtuelle (voir l'option
             <computeroutput>--nic</computeroutput> ci-dessus&#xA0;; sinon ce paramètre
             n'a aucun effet), ce mode vous permet d'accéder à des sous-modes 
             réseaux rarement utilisés, tels que le réseau VDE ou le tunnel UDP.
@@ -844,9 +845,9 @@ Statistics update:  disabled</screen></para>
             <para><computeroutput>--nicproperty<1-N>
             <nomparam>="paramvaleur"</computeroutput>&#xA0;:
             Cette option, associée avec "nicgenericdrv", vous permet de
-            passer des paramètres aux fondations réseaux rarement utilisées.</para><para>
+            passer des paramètres aux backends (fondations) réseaux rarement utilisées.</para><para>
             Ces paramètres sont des fondations spécifiques au moteur et sont 
-            différentes entre les pilotes de la foncation du tunnel UDP et du
+            différents entre les pilotes du tunnel UDP et ceux de la fondation
             VDE. Par exemple,merci de voir <xref linkend="network_udp_tunnel" />.
             </para>
           </listitem>
@@ -857,7 +858,7 @@ Statistics update:  disabled</screen></para>
 
         <para>Les paramètres de réseau NAT suivants sont disponibles via
         <computeroutput>VBoxManage modifyvm</computeroutput>. Avec tous ces
-        paramètres, le numéro décimale suivant le nom de l'option ("1-N"
+        paramètres, le numéro décimal suivant le nom de l'option ("1-N"
         dans la liste ci-dessous) spécifie l'adaptateur réseau virtuel que
         devrait modifier ces paramètres.<itemizedlist>
             <listitem>
@@ -879,7 +880,7 @@ Statistics update:  disabled</screen></para>
               <para><computeroutput>--nattftpprefix<1-N>
               <préfixe></computeroutput>&#xA0;: Cette option définit un
               préfixe pour le serveur TFTP intégré, à savoir là où se trouve le
-              fichier de démarrage (merci de voir <xref linkend="nat-tftp" /> and <xref
+              fichier de démarrage (merci de voir <xref linkend="nat-tftp" /> et <xref
               linkend="nat-adv-tftp" /> pour les détails).</para>
             </listitem>
 
@@ -905,21 +906,21 @@ Statistics update:  disabled</screen></para>
 
             <listitem>
               <para><computeroutput>--natdnsproxy<1-N>
-              on|off</computeroutput>&#xA0;: Cette option fait faire du proxy au
-              moteur NAT pour toutes les requêtes DNS de l'invité adressées au serveur DNS
+              on|off</computeroutput>&#xA0;: Cette option fait que le proxy du
+              moteur NAT envoie toutes les requêtes DNS de l'invité au serveur DNS
               de l'hôte (merci de voir <xref linkend="nat-adv-dns" /> pour des
               détails).</para>
             </listitem>
 
             <listitem>
               <para><computeroutput>--natdnshostresolver<1-N>
-              on|off</computeroutput>&#xA0;: Cette option fait utiliser par le
-              moteur NAT le mécanismes de résolveur de l'hôte pour gérer les
+              on|off</computeroutput>&#xA0;: Cette option fait que le
+              moteur NAT utilise le mécanismes de résolveur de l'hôte pour gérer les
               requêtes DNS (merci de voir <xref linkend="nat-adv-dns" /> pour les détails).</para>
             </listitem>
 
             <listitem>
-              <para><computeroutput>--natnatsettings<1-N>
+              <para><computeroutput>--natsettings<1-N>
               [<mtu>],[<socksnd>],[<sockrcv>],[<tcpsnd>],
               [<tcprcv>]</computeroutput>&#xA0;: Cette option contrôle
               plusieurs paramètres NAT (merci de voir <xref linkend="nat-adv-settings" />
@@ -941,9 +942,11 @@ Statistics update:  disabled</screen></para>
     </sect2>
 
     <sect2 id="vboxmanage-modifyvm-other">
-      <title>Options du port série, du son, du presse-papier et de l'USB</title>
+      <title>Paramètres divers</title>
 
-      <para>Les autres paramètres matériels suivants sont disponibles avec
+      <para>Les autres paramètres matériels suivants (tels que ceux du port série,
+      du son, du presse-papiers, du glisser/déplacer, de l'écran et de l'USB)
+      sont disponibles avec
       <computeroutput>VBoxManage modifyvm</computeroutput>&#xA0;:<itemizedlist>
           <listitem>
             <para><computeroutput>--uart<1-N> off|<I/O base>
@@ -1012,14 +1015,23 @@ Statistics update:  disabled</screen></para>
             <para><computeroutput>--clipboard
             disabled|hosttoguest|guesttohost|bidirectional</computeroutput>&#xA0;:
             Avec ce paramètre, vous pouvez sélectionner si le presse-papier du
-            système d'exploitation invité doit être partagé avec l'hôte&#xA0;; voir
+            système d'exploitation invité ou de l'hôte doit être partagé avec 
+            l'hôte ou l'invité et comment ; voir
             <xref linkend="generalsettings" />. Cela exige que les suppléments
             invité soient installés dans la machine virtuelle.</para>
           </listitem>
 
           <listitem>
+            <para><computeroutput>--draganddrop
+            disabled|hosttoguest|guesttohost|bidirectional</computeroutput> :
+            Avec ce paramètre, vous pouvez sélectionner le mode actuel de
+            glisser/déplacer à utiliser entre l'hôte et la machine virtuelle ;
+        voir <xref linkend="guestadd-dnd" />. Cela exige que les suppléments
+            invité soient installés dans la machine virtuelle.</para>
+          </listitem>
+          <listitem>
             <para><computeroutput>--monitorcount
-            <nombre></computeroutput>&#xA0;: Cela active le support multi-monitoeurs&#xA0;;
+            <nombre></computeroutput>&#xA0;: Cela active le support multi-moniteurs&#xA0;;
             voir <xref linkend="settings-display" />.</para>
           </listitem>
 
@@ -1054,10 +1066,10 @@ Statistics update:  disabled</screen></para>
           <listitem>
             <para><computeroutput>--vrdeport
             default|<ports></computeroutput>&#xA0;: Un port ou une plage
-            deports que le serveur VRDE peut sonder&#xA0;; "default" ou "0" 
+            de ports que le serveur VRDE peut sonder&#xA0;; "default" ou "0" 
             signifient le port 3389, le port RDP standard. Vous pouvez spécifier
             une liste de ports ou de plages de ports séparée par des virgules.
-            Utilisez un tiret entre de numéros de ports pour spécifier une plage.
+            Utilisez un tiret entre deux numéros de ports pour spécifier une plage.
             Le serveur VRDE  sondera <emphasis role="bold">un</emphasis> des
             ports disponibles dans la liste spécifiée. Une seule machine peut utiliser
             un port donné en même temps. Par exemple, l'option <computeroutput> --vrdeport
@@ -1068,10 +1080,10 @@ Statistics update:  disabled</screen></para>
           <listitem>
             <para><computeroutput>--vrdeaddress <adresse IP
             ></computeroutput>&#xA0;: L'adresse IP de l'interface réseau de 
-            l'hôte que sondera le serveur VRDE. Si vous la spécifiez, leserveur
+            l'hôte que sondera le serveur VRDE. Si vous la spécifiez, le serveur
             n'acceptra les connexions que sur l'interface de l'hôte spécifiée.</para>
             <para>On peut utiliser ce paramètre pour indiquer si le serveur
-            VRDP devrait accepter des donnexions IPv4, IPv6 ou les deux :
+            VRDP devrait accepter des connexions IPv4, IPv6 ou les deux :
             <itemizedlist>
               <listitem>
                 <para>IPv4 seulement : <computeroutput>--vrdeaddress "0.0.0.0"
@@ -1140,7 +1152,7 @@ Statistics update:  disabled</screen></para>
             d'une requête de téléportation venant du réseau lorsqu'elle est
             démarrée. Si elle est activée, quand on démarre la machine, cela ne
             démarre pas la machine virtuelle comme cela est normalement le cas, 
-            mais cela attend qu'une requête de téléportation n'arrive à l'adresse
+            mais cela attend qu'une requête de téléportation arrive à l'adresse
             listée avec les deux options suivantes.</para>
           </listitem>
 
@@ -1182,13 +1194,13 @@ Statistics update:  disabled</screen></para>
             avancés peuvent utiliser cette commande avant une opération de
             téléportation pour restreindre les possibilités du processeur virtuel
             présenté par VirtualBox au système d'exploitation invité. Il faut
-            l'exécuter à la fois sur la machine source et cible. 
+            l'exécuter à la fois sur la machine source et cible
             impliquées dans la téléportation et cela modifiera ce que l'invité
             verra quand il exécutera l'instruction machine 
-            <computeroutput>CPUID</computeroutput>. Cel pourrait aider les applications
-            se comportant mal à cause d'un mauvais présupposé sur la présence de
+            <computeroutput>CPUID</computeroutput>. Cela peut aider des applications
+            présupposant à tord la présence de
             certaines capacités du processeur. La signification des paramètres
-            dépend do matériel&#xA0;; merci de vous reporter aux manuels des
+            dépend du matériel&#xA0;; merci de vous reporter aux manuels des
             processeurs AMD ou Intel.</para>
           </listitem>
         </itemizedlist></para>
@@ -1209,14 +1221,14 @@ Statistics update:  disabled</screen></para>
     <itemizedlist>
        <listitem>
            <para><computeroutput>--snapshot <uuid>|<nom></computeroutput>&#xA0;:
-            Sélectionne un instantané spécifique auquel se reporte le processus 
+            Sélectionne un instantané spécifique auquel se rapporte le processus 
             de clonage. Par défaut, c'est à l'état courant qu'il se réfère.</para>
        </listitem>
        <listitem>
            <para><computeroutput>--mode machine|machineandchildren|all</computeroutput>&#xA0;:
            Sélectionne le mode de clonage. Si 
            <computeroutput>machine</computeroutput> est sélectionnée (comme par
-           défaut), l'état actuel de la VM sans instantanés est cloné. En mode
+           défaut), l'état actuel de la VM sans instantané est cloné. En mode
            <computeroutput>machineandchildren</computeroutput>, l'instantané
            fourni par <computeroutput>--snapshot</computeroutput> et tous les
            instantanés fils sont clonés. Si vous
@@ -1374,6 +1386,15 @@ Virtual system 0:
     <para>Pour les produits de virtualisation non pleinement compatibles avec
     le standard OVF 1.0, vous pouvez activer un mode OVF 0.9 basique avec
     l'option <computeroutput>--legacy09</computeroutput>.</para>
+
+    <para>Pour spécifier des options contrôlant le contenu exact du fichier
+    d'applicatif, vous pouvez utiliser <computeroutput>--option</computeroutput>
+    pour demander la création d'un fichier manifeste (on vous y encourage, cela
+    permet la détection d'applicatifs corrompus lors de l'importation), l'export
+    d'images de DVD supplémentaires, et l'inclusion des adresses MAC. Vous pouvez
+    spécifier une liste d'options comme <computeroutput>--option manifest,nomacs</computeroutput>. Pour des détails,
+    consultez la sortie de l'aide de
+    <computeroutput>--option manifest,nomacs</computeroutput>. For details, +    check the help output of <computeroutput>VBoxManage export</computeroutput>.</para>
   </sect1>
 
   <sect1 id="vboxmanage-startvm">
@@ -1386,7 +1407,7 @@ Virtual system 0:
     détermine si la machine sera démarrée dans une fenêtre ou si la sortie devrait passer par 
     <computeroutput>VBoxHeadless</computeroutput>, en activant ou pas VRDE&#xA0;;
     voir <xref linkend="vboxheadless" /> pour plus d'informations. La liste
-    des types peut changer et il n'est pas garanti que tous les types sont
+    des types peut changer et il n'est pas garanti que tous les types soient
     acceptés par la variante d'un produit.</para>
 
     <para>La valeur par défaut, globale ou individuelle à une VM, du type
@@ -1435,7 +1456,7 @@ Virtual system 0:
     <title>VBoxManage controlvm</title>
 
     <para>La sous-commande <computeroutput>controlvm</computeroutput> vous permet
-    modifier l'état d'une machine virtuelle en fonction. Vous pouvez spécifiar
+    de modifier l'état d'une machine virtuelle en fonction. Vous pouvez spécifier
     ce qui suit&#xA0;:</para>
 
     <para><itemizedlist>
@@ -1488,7 +1509,7 @@ Virtual system 0:
           le bouton fermer de la fenêtre et sélectionner "Sauvegarder l'état de
           la machine" dans la boîte de dialogue.)</para>
 
-          <para>Après cela, l'çtat de la machine sera "Sauveegardé". À partir de
+          <para>Après cela, l'état de la machine sera "Sauvegardé". À partir de
           là, vous pouvez la relancer&#xA0;; voir 
 <xref linkend="vboxmanage-startvm" />.</para>
         </listitem>
@@ -1537,6 +1558,15 @@ Virtual system 0:
       </listitem>
 
       <listitem>
+        <para>L'opération <computeroutput>guestmemoryballoon</computeroutput>
+        change la taille du ballon mémoire de l'invité, c'est-à-dire la mémoire
+        du système d'exploitation invité affectée par les suppléments invité de VirtualBox
+        et rendue à l'hyperviseur pour être réutilisée par d'autres 
+        machines virtuelles. Elle se spécifie en mégaoctets.  Pour des détails,
+        voir <xref linkend="guestadd-balloon" />.</para>
+      </listitem>
+
+      <listitem>
         <para><computeroutput>usbattach</computeroutput> et
         <computeroutput>usbdettach</computeroutput> rendent les pçriphériques
         USB de l'hôte, à la volée, visibles pour la machine virtuelle sans besoin de
@@ -1547,6 +1577,26 @@ Virtual system 0:
         usbhost</computeroutput> pour trouver ces informations.</para>
       </listitem>
 
+       <listitem>
+        <para><computeroutput>clipboard
+        disabled|hosttoguest|guesttohost|bidirectional</computeroutput> :
+        Avec ce paramètre, vous pouvez sélectionner si le presse-papiers du
+        système d'exploitation de l'hôte ou de l'invité doit être partagé avec
+        l'hôte et l'invfté et comment ; voir <xref linkend="generalsettings" />. Ceci
+        exige que les suppléments invité soient installés dans la machine
+        virtuelle.</para>
+      </listitem>
+
+      <listitem>
+        <para><computeroutput>draganddrop
+        disabled|hosttoguest|guesttohost|bidirectional</computeroutput> :
+        Avec ce paramètre, vous pouvez sélectionner le mode glisser/déplacer
+        actuel qui sera utilisé entre l'hôte et la machine virtuelle ;
+        voir <xref linkend="guestadd-dnd" />. Cela exige que les suppléments
+        invité soient installés dans la machine
+        virtuelle.</para>
+      </listitem>
+
       <listitem>
         <para><computeroutput>vrde on|off</computeroutput> vous permet d'activer
         ou de désactiver le serveur VRDP s'il est installé.</para>
@@ -1564,13 +1614,13 @@ Virtual system 0:
       <listitem>
         <para><computeroutput>setvideomodehint</computeroutput> demande
         que le système invité passe dans un mode graphique particulier. Cela exige
-        l'installation des suppléments invité et ne fonctionner pas pour tous
+        l'installation des suppléments invité et ne fonctionnera pas pour tous
         les systèmes invités.</para>
       </listitem>
 
       <listitem>
         <para><computeroutput>screenshotpng</computeroutput> prend une impression
-        écran de l'affichage invité et le sauvegarde au format PNG.</para>
+        écran de l'affichage invité et la sauvegarde au format PNG.</para>
       </listitem>
 
       <listitem>
@@ -1581,13 +1631,14 @@ Virtual system 0:
       </listitem>
 
       <listitem>
-        <para>L'opération <computeroutput>guestmemoryballoon</computeroutput>
-        modifie la taille du ballon de la mémoire de l'invité, c'est-à-dire la
-        mémoire affectée par les suppléments invité de VirtualBox au système
-        d'exploitation invité et rendue à l'hyperviseur pour être réutilisée
-        par d'autres machines virtuelles. Elle doit être spécifiée en mégaoctets.
-        Pour des détails, voir <xref linkend="guestadd-balloon" />.</para>
-      </listitem>
+        <para><computeroutput>--plugcpu|unplugcpu
+        <id></computeroutput> : Si vous avez activé le montage à chaud de
+        processeurs, ceci ajoutera un processeur virtuel aux machines virtuelles
+        (ou en supprimera un).
+        <computeroutput><id></computeroutput> spécifie l'index du processeur
+        virtuel à ajouter ou à supprimer et il doit être un numéro de 0
+        au numéro maximum du nombre de processeurs configuré.</para>
+       </listitem>
 
       <listitem>
         <para><computeroutput>cpuexecutioncap
@@ -1605,13 +1656,13 @@ Virtual system 0:
     <para>Cette commande désactive l'état sauvegardé d'une machine virtuelle
     qui n'est pas en fonction, ce qui fera redémarrer son système d'exploitation
     la prochaine fois que vous démarrerez. Cela revient à débrancher le câble
-    d'alimentation d'une machine physique et vous devrieu l'éviter si possible.</para>
+    d'alimentation d'une machine physique et vous devriez l'éviter si possible.</para>
   </sect1>
  
   <sect1>
     <title>VBoxManage adoptstate</title>
 
-    <para>Si vous avez un fichier d'çtat sauvegardé
+    <para>Si vous avez un fichier d'état sauvegardé
     (<computeroutput>.sav</computeroutput>), c'est-à-dire séparé de la configuration
     de la VM, vous pouvez "adopter" le fichier. Cela passera la VM en état
     sauvegardé et quand vous la démarrerez, VirtualBox essaiera de la restaurer
@@ -1626,11 +1677,11 @@ Virtual system 0:
     commande. Un instantané consiste en une copie complète des paramètres de la
     machine virtuelle, copiés à un moment où l'instantané a été pris, et éventuellement
     un fichier d'état sauvegardé de la machine virtuelle si l'instantané a été 
-    pris alors que la machine était en fonction. Après qu'un instantné a été pris,
-    VirtualBox cre un disque dur de différenciatin pour chaque disque dur normal
+    pris alors que la machine était en fonction. Après qu'un instantané ait été pris,
+    VirtualBox crée un disque dur de différenciation pour chaque disque dur normal
     associé à la machine pour que, quand on restaure un instantané, les disques durs
     virtuels de la machine virtuelle puissent être rapidement réinitialisés en
-    reabandonnant simplement les fichiers de différenciation.</para>
+    disqualifiant simplement les fichiers de différenciation.</para>
 
     <para>L'opération <computeroutput>take</computeroutput> prend un instantané de
     l'état actuel de la machne viruelle. Vous devez fournir un nom pour l'instantané
@@ -1639,7 +1690,7 @@ Virtual system 0:
     actuel et il devient le nouvel instantané actuel. Le paramètre
     <computeroutput>--description</computeroutput> permet de décrire
     l'instantané. Si vous spécifiez <computeroutput>--live</computeroutput>,
-    la VM ne s'arrêtera pas pendant la créqation de l'instantané.</para>
+    la VM ne s'arrêtera pas pendant la création de l'instantané.</para>
 
     <para>L'opération <computeroutput>delete</computeroutput> efface un
     instantané (spécifié par son nom ou son UUID). Cela peut être long à se
@@ -1673,7 +1724,7 @@ Virtual system 0:
     <para>Cette commande supprime un fichier image de disque dur, de DVD ou
     disquette, d'un registre de médias VirtualBox.<footnote>
         <para>Avant VirtualBox 4.0, il fallait appeler VBoxManage
-        openmedium avant de pouvoir attacher à média à une machine virtuelle&#xA0;;
+        openmedium avant de pouvoir attacher un média à une machine virtuelle&#xA0;;
         cet appel "enregistrait" le média avec le registre des médias global de
         VirtualBox. Avec VirtualBox 4.0, ce n'est plus nécessaire&#xA0;; les
         médias sont ajoutés aux registres des médias automatiquement. L'appel
@@ -1691,7 +1742,7 @@ Virtual system 0:
 
     <para>Cette commande attache/modifie/supprime un média de stockage connecté
     à un contrôleur de stockage précédemment ajouté avec la commande
-    <computeroutput>storagectl</computeroutput> command (voir la section précédente).
+    <computeroutput>storagectl</computeroutput> (voir la section précédente).
     La syntaxe est ainsi&#xA0;:</para>
 
     <screen>VBoxManage storageattach    <uuid|nomvm>
@@ -1800,7 +1851,7 @@ Virtual system 0:
 
                 <listitem>
                   <para>Si vous spécifiez un UUID, il doit s'agir de l'UUID d'un
-                  média de stockage déjà connu de VirtualBox (par exemple car il
+                  média de stockage déjà connu de VirtualBox (par exemple parce qu'il
                   a été attaché à une autre machine virtuelle). Voir
                   <xref linkend="vboxmanage-list" /> pour la façon de lister
                   les médias connus. Ce média est alors attaché au slot du 
@@ -1865,7 +1916,7 @@ Virtual system 0:
             la plus fréquemment utilisée est <code>--setuuid ""</code>, qui
             affecte un nouvel UUID (aléatoire) à une image. Cela sert à résoudre
             des erreurs d'UUID dupliqués si on a dupliqué une image par les
-            outils de copie de fichiers..</para>
+            outils de copie de fichiers.</para>
           </glossdef>
         </glossentry>
 
@@ -1884,7 +1935,7 @@ Virtual system 0:
 
           <glossdef>
             <para>Seulement pour un lecteur DVD virtuel, vous pouvez configurer
-            le comportement pour avoir l'éjection du média synchrnmiùe avec l'invité.
+            le comportement de l'éjection du média déclenchée par l'invité.
             Si vous l'activez, l'éjection n'a qu'un effet temporaire. Si vous
             éteignez puis redémarrez la VM, le média configuré au départ sera
             toujours dans le lecteur.</para>
@@ -1924,7 +1975,7 @@ Virtual system 0:
 
     <para>Quand on utilise "iscsi" avec le paramètre
     <computeroutput>--medium</computeroutput> pour le support iSCSI --
-    see <xref linkend="storage-iscsi" /> --, vous pouvez ou devez utiliser
+    voir <xref linkend="storage-iscsi" /> --, vous pouvez ou devez utiliser
     des paramètres supplémentaires&#xA0;:<glosslist>
         <glossentry>
           <glossterm>server</glossterm>
@@ -1981,7 +2032,7 @@ Virtual system 0:
           <glossterm>intnet</glossterm>
 
           <glossdef>
-            <para>Si vous le spécifiez, connecte à la cible iSCSI via le réseau
+            <para>Si spécifié, connecte à la cible iSCSI via le réseau
             interne. Cela nécessite une configuration supplémentaire décrite au
             <xref linkend="iscsi-intnet" />.</para>
           </glossdef>
@@ -2004,12 +2055,12 @@ Virtual system 0:
                             [--add <ide/sata/scsi/floppy>]
                             [--controller <LsiLogic|LSILogicSAS|BusLogic|
                                           IntelAhci|PIIX3|PIIX4|ICH6|I82078>]
-                            [--portcount <1-30>]
+                            [--sataportcount <1-30>]
                             [--hostiocache on|off]
                             [--bootable on|off]
                             [--remove]</screen>
 
-    <para>où les paramètres signifient&#xA0;: <glosslist>
+    <para>où les paramètres signifient&#xA0;:<glosslist>
         <glossentry>
           <glossterm>uuid|nomvm</glossterm>
 
@@ -2045,7 +2096,7 @@ Virtual system 0:
         </glossentry>
 
         <glossentry>
-          <glossterm>--portcount</glossterm>
+          <glossterm>sataportcount</glossterm>
 
           <glossdef>
             <para>Ceci détermine le nombre de ports que le contrôleur SATA 
@@ -2057,7 +2108,7 @@ Virtual system 0:
           <glossterm>hostiocache</glossterm>
 
           <glossdef>
-            <para>Configure l'utilisation du cache E/S de l'hîte pour toutes les
+            <para>Configure l'utilisation du cache E/S de l'hôte pour toutes les
             images de disque attachées à ce contrôleur de stockage. Pour des détails,
             merci de voir <xref
             linkend="iocaching" />.</para>
@@ -2095,7 +2146,7 @@ Virtual system 0:
     <para>Les sous-commandes suivantes sont disponibles&#xA0;:<itemizedlist>
       <listitem>
         <para><computeroutput>add</computeroutput>, crée un nouveau groupe de
-        dande passante d'un type doné.</para>
+        bande passante d'un type donné.</para>
       </listitem>
       <listitem>
         <para><computeroutput>set</computeroutput>, modifie la limite d'un groupe
@@ -2301,8 +2352,8 @@ Virtual system 0:
           mettre des zéros dans l'espace libre avant de compresser l'image de
           disque virtuel. Pour Linux, utilisez l'outil
           <code>zerofree</code> qui supporte les systèmes de fichiers s ext2/ext3.
-          Pour les invités Mac OS X, utilisez utilisez la fonction <emphasis>Supprimer l'espace libre</emphasis> de
-          <emphasis>l'outil de disque</emphasis> intégré. Utilisez-y
+          Pour les invités Mac OS X, utilisez la fonction <emphasis>Supprimer l'espace libre</emphasis> de
+          <emphasis>l'outil de disque</emphasis> intégré. Utilisez
           <emphasis>Zero Out Data</emphasis>.</para>
 
           <para>Remarquez que la compression n'est actuellement disponible que
@@ -2317,10 +2368,10 @@ Virtual system 0:
           le nouvel espace total désiré en <emphasis role="bold">mégaoctets</emphasis>)
           vous permet de modifier la capacité d'une image existante&#xA0;; ceci
           ajuste la taille <emphasis>logique</emphasis> d'un disque virtuel sans
-          beaucoup changer la taille physiqu.<footnote>
+          beaucoup changer la taille physique.<footnote>
               <para>Le redimensionnement d'images a été ajouté à VirtualBox 4.0.</para>
             </footnote> Cela ne fonctionne actuellement que pour les formats
-            VDI et VHD et pour les variantse, à taille dynamique, et vous ne
+            VDI et VHD et pour les variantes, à taille dynamique, et vous ne
             pouvez l'utiliser que pour augmenter (ou réviser) la capacité.
           Par exemple, si vous avez créé au départ un disque de 10G à présent
           plein, vous pouvez utiliser la commande <computeroutput>--resize 15360</computeroutput>
@@ -2330,7 +2381,7 @@ Virtual system 0:
           vous devrez ensuite, en général, utiliser un outil de gestion des
           partitions dans l'invité pour ajuster la partition principale et
           remplir le lecteur.</para><para>L'option <computeroutput>--resizebyte x</computeroutput>
-          fait presque la même chose mait x est exprimé en octets au lieu de
+          fait presque la même chose mais x est exprimé en octets au lieu de
           mégaoctets.</para>
         </listitem>
       </itemizedlist></para>
@@ -2464,7 +2515,7 @@ VBoxManage convertfromraw   stdin <fichiersortie> <octets>
   <sect1>
     <title>VBoxManage getextradata/setextradata</title>
 
-    <para>Ces commandes vous permet d'attacher et de récupérer des chaînes de
+    <para>Ces commandes vous permettent d'attacher et de récupérer des chaînes de
     données dans une machine virtuelle ou à une configuration de VirtualBox (en
     spécifiant <computeroutput>global</computeroutput> au lieu d'un nom de machine
     virtuelle). Vous pouvez spécifier une clé (comme chaîne de texte) pour
@@ -2474,8 +2525,8 @@ VBoxManage convertfromraw   stdin <fichiersortie> <octets>
 VBoxManage setextradata SUSE10 installdate 2006.02.02</screen>
 
     <para>associerait la chaîne "2006.01.01" à la clé installdate pour la
-    the machine virtuelle Fedora5, et "2006.02.02" pour la machine SUSE10. Vous
-    pourriez récupçrer l'information comme suit&#xA0;:</para>
+    machine virtuelle Fedora5, et "2006.02.02" pour la machine SUSE10. Vous
+    pourriez récupérer l'information comme suit&#xA0;:</para>
 
     <screen>VBoxManage getextradata Fedora5 installdate</screen>
 
@@ -2486,8 +2537,8 @@ VBoxManage setextradata SUSE10 installdate 2006.02.02</screen>
 All rights reserved.
 
 Value: 2006.01.01</screen>
-    <para>To remove a key, the <computeroutput>setextradata</computeroutput>
-    command must be run without specifying data (only the key), for example:
+    <para>Pour supprimer une clé, la commande <computeroutput>setextradata</computeroutput>
+    doit être exécutée sans spécifier de données (la clé seule), par exemple:
     </para>
 
     <screen>VBoxManage setextradata Fedora5 installdate</screen>
@@ -2498,7 +2549,7 @@ Value: 2006.01.01</screen>
     <title>VBoxManage setproperty</title>
 
     <para>Cette commande est utilisée pour modifier des paramètres globaux 
-    qui modifient toute l'installation de VirtualBox. Certains d'entr eux
+    qui modifient toute l'installation de VirtualBox. Certains d'entre eux
     correspondent aux paramètres de la boîte de dialogue "Paramètres globaux" de
     l'interface graphique. Les propriétés suivantes sont disponibles&#xA0;:<glosslist>
         <glossentry>
@@ -2601,7 +2652,7 @@ Value: 2006.01.01</screen>
     <computeroutput>usbfilter add</computeroutput>, vous devez fournir trois ou
     quatre paramètres obligatoires. L'index spécifie la position du filtre dans
     la liste. S'il y a déjà un filtre à cette place, lui-mâme et les suivants
-    seront déplacés. Sinon, le nouveau filtre sera ajouté à la fin de laliste.
+    seront déplacés. Sinon, le nouveau filtre sera ajouté à la fin de la liste.
     Le paramètre <computeroutput>target</computeroutput> sélectionne la
     machine virtuelle à laquelle devrait être attaché le 
     filtre, sinon utilisez "global" pour l'appliquer à toutes les machines virtuelles.
@@ -2633,7 +2684,7 @@ Value: 2006.01.01</screen>
     <para>Cette commande vous permet de partager des dossiers de l'ordinateur hôte
     avec les systèmes d'exploitation invités. Pour cela, il faut que les systèmes
     invités aient une version installée des Suppléments invité qui supporte cette
-    fonctionnaalité.</para>
+    fonctionnalité.</para>
 
     <para>Les dossiers partagés sont décrits en détails au <xref
     linkend="sharedfolders" />.</para>
@@ -2659,7 +2710,7 @@ Value: 2006.01.01</screen>
         <listitem>
           <para><computeroutput>enumerate <vm> [--patterns
           <pattern>]</computeroutput>&#xA0;: Ceci liste toutes les
-          propriétés invité disponibles pouq une VM donnée avec leur valeur.
+          propriétés invité disponibles pour une VM donnée avec leur valeur.
           Cette liste sera très limitée si le processus service de l'invité
           ne peut pas être contacté, notamment car la VM n'est pa en fonction
           ou les suppléments invité ne sont pas installés.</para>
@@ -2753,7 +2804,7 @@ Value: 2006.01.01</screen>
   <sect1 id="vboxmanage-guestcontrol">
     <title>VBoxManage guestcontrol</title>
 
-    <para>Les commandes "guestcontrol" vous permettent de contrôler certaines
+    <para>Les commandes <computeroutput>guestcontrol</computeroutput> vous permettent de contrôler certaines
     choses de l'invité à partir de l'hôte. Merci de voir <xref
     linkend="guestadd-guestcontrol" /> pour une présentation.</para>
 
@@ -2780,7 +2831,7 @@ Value: 2006.01.01</screen>
             [--dos2unix] [--unix2dos]
             -- [[<argument1>] ... [<argumentN>]]</screen>
 
-          <para>où les paramètres signifient&#xA0;: <glosslist>
+          <para>où les paramètres signifient&#xA0;:<glosslist>
               <glossentry>
                 <glossterm><computeroutput>uuid|nomvm</computeroutput></glossterm>
 
@@ -2849,7 +2900,7 @@ Value: 2006.01.01</screen>
                   créé avec l'environnement standard de l'OS invité. Cette
                   option permet de modifier cet environnement. Pour définir/modifier
                   une variable, une paire <computeroutput>NOM=VALEUR</computeroutput> doit
-                  être spécifiée&#xA0;; pour dérégler une certaine variable, le
+                  être spécifiée&#xA0;; pour réinitialiser une certaine variable, le
                   nom sans valeur doit être défini, par exemple
                   <computeroutput>NOM=</computeroutput>.</para>
 
@@ -2864,9 +2915,9 @@ Value: 2006.01.01</screen>
                 <glossterm><computeroutput>--timeout <msec></computeroutput></glossterm>
 
                 <glossdef>
-                  <para>Valeur (ien millisecondes) qui spécifie la durée pendant
+                  <para>Valeur (en millisecondes) qui spécifie la durée pendant
                   laquelle le processus démarré est autorisé à fonctionner et
-                  combien de temps VBoxManage attent une sortie de ce processus.
+                  combien de temps VBoxManage attend une sortie de ce processus.
                   Si vous ne spécifiez pas de timeout, VBoxManage attendra
                   jusqu'à ce que le processus démarré se termine ou ce qu'une
                   erreur ne survienne.</para>
@@ -2983,7 +3034,7 @@ Value: 2006.01.01</screen>
             [--passwordfile <fichier> | --password <mot de passe>]
             [--dryrun] [--follow] [--recursive] [--verbose]</screen>
 
-          <para>où les paramètres signifient&#xA0;: <glosslist>
+          <para>où les paramètres signifient&#xA0;:<glosslist>
               <glossentry>
                 <glossterm><computeroutput>uuid|nomvm</computeroutput></glossterm>
 
@@ -3047,7 +3098,7 @@ Value: 2006.01.01</screen>
                 <glossterm><computeroutput>--dryrun</computeroutput></glossterm>
 
                 <glossdef>
-                  <para>Dit à VBoxManage de ne faire qu'une exécution dry au
+                  <para>Dit à VBoxManage de ne faire qu'une exécution "sèche" au
                   lieu de copier vraiment les fichiers dans l'invité.</para>
                 </glossdef>
               </glossentry>
@@ -3108,7 +3159,7 @@ Value: 2006.01.01</screen>
             [--passwordfile <fichier> | --password <mot de passe>]
             [--parents] [--mode <mode>] [--verbose]</screen>
 
-          <para>où les paramètres signifient&#xA0;: <glosslist>
+          <para>où les paramètres signifient&#xA0;:<glosslist>
               <glossentry>
                 <glossterm><computeroutput>uuid|nomvm</computeroutput></glossterm>
 
@@ -3433,7 +3484,7 @@ Value: 2006.01.01</screen>
             [--directory] [--secure] [--tmpdir <répertoire>]
             [--domain <domaine>] [--mode <mode>] [--verbose]</screen>
 
-          <para>où les paramètres signifient&#xA0;: <glosslist>
+          <para>où les paramètres signifient&#xA0;:<glosslist>
               <glossentry>
                 <glossterm><computeroutput>uuid|nomvm</computeroutput></glossterm>
 
@@ -3540,7 +3591,7 @@ Value: 2006.01.01</screen>
           <screen>VBoxManage guestcontrol <uuid|nomvm> list
           <all|sessions|processes|files> [--verbose]</screen>
 
-          <para>où les paramètres signifient : <glosslist>
+          <para>où les paramètres signifient&#xA0;:<glosslist>
             <glossentry>
               <glossterm><computeroutput>uuid|nomvm</computeroutput></glossterm>
               <glossdef>
@@ -3579,7 +3630,7 @@ Value: 2006.01.01</screen>
           [--verbose]
           <PID> ... <PID n></screen>
 
-          <para>où les paramètres signifient : <glosslist>
+          <para>où les paramètres signifient&#xA0;: <glosslist>
             <glossentry>
               <glossterm><computeroutput>uuid|nomvm</computeroutput></glossterm>
 
@@ -3635,7 +3686,7 @@ Value: 2006.01.01</screen>
           [--verbose]
           <PID> ... <PID n></screen>
 
-          <para>où les paramètres signifient : <glosslist>
+          <para>où les paramètres signifient&#xA0;: <glosslist>
             <glossentry>
               <glossterm><computeroutput>uuid|nomvm</computeroutput></glossterm>
 
@@ -3971,7 +4022,7 @@ Value: 2006.01.01</screen>
           à la casse. Quand vous interrogez un registre du processeur, vous 
           pouvez ne pas mettre le réglage du registre, il sera sélectionné en
           utilisant la valeur de l'option <computeroutput>--cpu</computeroutput>
-          (0 par dé2ant).
+          (0 par défaut).
           </para>
         </listitem>
 
@@ -4010,23 +4061,23 @@ Value: 2006.01.01</screen>
     <title>VBoxManage metrics</title>
 
     <para>Cette commande supporte la surveillance de l'utilisation des ressources
-    système. Les ressources sont représentées par différentes métriques associées
+    système. Les ressources sont représentées par différents métriques associés
     au système hôte ou à une VM en particulier. Par exemple, le système hôte a
-    une métrique <computeroutput>CPU/Load/User</computeroutput> qui affiche le
-    pourcentage du temps procc!eur passé à tourner en mode utilisateur sur une
+    un métrique <computeroutput>CPU/Load/User</computeroutput> qui affiche le
+    pourcentage du temps procceseur passé à tourner en mode utilisateur sur une
     période spécifique.</para>
 
     <para>Les données de métrique sont rassemblées et stockées en interne&#xA0;;
     vous pouvez les récupérer n'importe quand avec la sous-commande
     <computeroutput>VBoxManage metric query</computeroutput>. Les données sont
     disponibles tant que le processus en tâche de fond 
-    <computeroutput>VBoxSVC</computeroutput> process is est vivant. Ce processus
+    <computeroutput>VBoxSVC</computeroutput> est vivant. Ce processus
     ce termine peu après que toutes les VMs et les interfaces ont été fermées.</para>
 
-    <para>Par défaut, aucune métrique n'est enregistrée. La récupération de
+    <para>Par défaut, aucun métrique n'est enregistré. La récupération de
     métriques ne commence pas avant que <computeroutput>VBoxManage metrics setup</computeroutput>
     ne soit appelé avec un bon intervalle modèle et que le nombre de métriques
-    n'a été conservé. On mesure l'intervalle en secondes. Par exemple, pour
+    n'ait été conservé. On mesure l'intervalle en secondes. Par exemple, pour
     activer la récupération des métriques de l'utilisation du processeur et de
     la mémoire hôte toutes les secondes, en gardant les 5 échantillons les plus
     actuels, vous pouvez utiliser la commande suivante&#xA0;:</para>
@@ -4040,11 +4091,11 @@ Value: 2006.01.01</screen>
     </computeroutput> pour voir les métriques actuellement disponibles. Vous
     pouvez aussi utiliser l'option <computeroutput>--list</computeroutput> avec
     une sous-commande modifiant les paramètres de métrique pour chercher les
-    métriques concernées.</para>
+    métriques concernés.</para>
 
     <para>Remarquez que la sous-commande <computeroutput>VBoxManage metrics
     setup</computeroutput> désactive tous les échantillons qui peuvent avoir été
-    recueillis pour un jeu d'objets et de métriques spécifique.</para>
+    recueillis pour un jeu d'objets et de métriques spécifiques.</para>
 
     <para>Pour activer ou désactiver la récupération des métriques sans perdre
     les données, vous pouvez utiliser les sous-commandes 
@@ -4055,7 +4106,7 @@ Value: 2006.01.01</screen>
     l'activation de <code>CPU/Load/User</code> tout en désactivant <code>CPU/Load/Kernel</code>
     n'est pas supporté.</para>
 
-    <para>L'hôte et les VMs ont différents ensembles de métriques associées. 
+    <para>L'hôte et les VMs ont différents ensembles de métriques associés. 
     Vous pouvez lister les métriques disponibles avec
     <computeroutput>VBoxManage metrics
     list</computeroutput> subcommand.</para>
@@ -4065,16 +4116,16 @@ Value: 2006.01.01</screen>
     <computeroutput>Catégorie/Métrique[/SousMétrique][:aggrégé]</computeroutput>.
     Par exemple, <computeroutput>RAM/Usage/Free:min</computeroutput> signifie la
     quantité minimum de mémoire disponible parmi toutes les données en mémoire
-    s, cela s'applique à l'objet hôte.</para>
+    , si c'est appliqué à l'objet hôte.</para>
 
     <para>Les sous-commandes peuvent s'appliquer à tous les objets et les
     métriques ou se limiter à un objet et/ou une liste de métriques. Si vous
     ne donnez aucun objet ni métrique en paramètres, les sous-commandes s'appliqueront
-    à toutes les métriques disponibles de tous les objets. Vous pouvez utiliser
-    une astérisque ("<computeroutput>*</computeroutput>") pour spécifier explicitement
-    que la commande devrait s'appliquer à tous les objets ou à toutes les métriques.
+    à tous les métriques disponibles de tous les objets. Vous pouvez utiliser
+    un astérisque ("<computeroutput>*</computeroutput>") pour spécifier explicitement
+    que la commande devrait s'appliquer à tous les objets ou à tous les métriques.
     Utilisez "host" en nom d'objet pour limiter la cible de la commande aux
-    métriques relatives à l'hôte. Pour limiter la cible à un sous-ensemble de métriques,
+    métriques relatifs à l'hôte. Pour limiter la cible à un sous-ensemble de métriques,
     utilisez une liste de noms séparés par des virgules.</para>
 
     <para>Par exemple, pour interroger les données de métriques sur le temps 
@@ -4101,11 +4152,11 @@ Value: 2006.01.01</screen>
         <glossterm>setup</glossterm>
 
         <glossdef>
-          <para>Cette sous-commande définit l''intervalle entre deux prises
+          <para>Cette sous-commande définit l'intervalle entre deux prises
           d'échantillons des données de métriques et le nombre d'échantillons gardés
           en interne. Les données mémorisées sont disponibles en affichage avec
           la sous-commande <code>query</code>. L'option <computeroutput>--list
-          </computeroutput> affiche les métriques qui ont été modifiées dans le
+          </computeroutput> affiche les métriques qui ont été modifiés dans le
           résultat de l'exécution de la commande.</para>
         </glossdef>
       </glossentry>
@@ -4115,9 +4166,9 @@ Value: 2006.01.01</screen>
 
         <glossdef>
           <para>Cette sous-commande "réactive le recueil de données après qu'il
-          a été arrêTé avec la sous-commande <code>disable</code>. Remarquez que
+          ait été arrêté avec la sous-commande <code>disable</code>. Remarquez que
           la spécification de sous-métriques comme paramètres n'activera pas les
-          métriques sous-jacentes. Utilisez 
+          métriques sous-jacents. Utilisez 
           <computeroutput>--list</computeroutput> pour savoir si la commande a
           fait ce que vous aviez prévu.</para>
         </glossdef>
@@ -4127,10 +4178,10 @@ Value: 2006.01.01</screen>
         <glossterm>disable</glossterm>
 
         <glossdef>
-          <para>Cette sous-commande "suspends" le recueil des données sans
+          <para>Cette sous-commande "suspend" le recueil des données sans
           changer les paramètres de récupération ni altérer les données recueillies.
           Remarquez que la spécification de sous-métriques en paramètres ne
-          désactivera pas les métriques sous-jacentes. Utilisez
+          désactivera pas les métriques sous-jacents. Utilisez
           <computeroutput>--list</computeroutput> pour voir si la commande a fait
           ce que vous aviez prévu.</para>
         </glossdef>
@@ -4141,11 +4192,11 @@ Value: 2006.01.01</screen>
 
         <glossdef>
           <para>Cette sous-commande récupère et affiche les données de métriques
-          mémorisées.<note>
-              <para>La sous-commande <code>query</code> subcommand ne supprime
+          mémorisés.<note>
+              <para>La sous-commande <code>query</code> ne supprime
               pas ni ne remet à 0 les données mémorisées. Si vous interrogez 
-              assez souvent, vous verrez la durée d'évacuation graduelle des
-              échantillons par les nouveaux échantillons.</para>
+              assez souvent, vous verrez la vitesse d'évacuation graduelle des
+              anciens échantillons par les nouveaux.</para>
             </note></para>
         </glossdef>
       </glossentry>
@@ -4173,7 +4224,7 @@ Value: 2006.01.01</screen>
     <para>Avec "hostonlyif", vous pouvez changer la configuration de l'IP d'une
     interface réseau host-only. Pour une description du réseau host-only, merci
     de vous reporter au <xref linkend="network_hostonly" />. Chaque interface
-    host-only par un nom et peut soit utiliser le serveur DHCP interne, soit
+    host-only est identifiée par un nom et peut soit utiliser le serveur DHCP interne, soit
     voir son adresse IP configurée à la main (IP4 et IP6).</para>
   </sect1>
 
@@ -4183,7 +4234,7 @@ Value: 2006.01.01</screen>
     <para>Les commandes de "dhcpserver" vous permettent de contrôler le serveur
     DHCP construit dans VirtualBox. Vous pourriez trouver cela utile si vous 
     utilisez le réseau interne ou host-only. (En théorie, vous pouvez 
-    l'activer aussi pour un réseu bridgé, mais cela provoquera probablement des
+    l'activer aussi pour un réseau bridgé, mais cela provoquera probablement des
     conflits avec d'autres serveurs DHCP de votre réseau physique.)</para>
 
     <para>Utilisez les options suivantes de la ligne de commandes&#xA0;:<itemizedlist>
@@ -4229,7 +4280,7 @@ Value: 2006.01.01</screen>
         </listitem>
 
         <listitem>
-          <para>Avec <computeroutput>--lowerip</computeroutput> aet
+          <para>Avec <computeroutput>--lowerip</computeroutput> et
           <computeroutput>--upperip</computeroutput>, vous pouvez spécifier
           respectivement l'adresse la plus basse et la plus haute que le serveur
           DHCP attribuera aux clients.</para>
@@ -4237,10 +4288,10 @@ Value: 2006.01.01</screen>
       </itemizedlist></para>
 
     <para>Enfin, vous devez spécifier<computeroutput>--enable</computeroutput>,
-    sinon le serveur DHCP sera créé en état désactivé, ce qui ne fera rien.</para>
+    sinon le serveur DHCP sera créé en étant désactivé, ce qui ne fera rien.</para>
 
     <para>Après cela, VirtualBox démarrera automatiquement le serveu DHCP pour
-    le réseau nterne ou host-only donné dès que la première machine virtuelle utilisant
+    le réseau donné, interne ou host-only, dès que la première machine virtuelle utilisant
     ce réseau sera démarrée.</para>
 
     <para>Inversement, utilisez <computeroutput>VBoxManage dhcpserver
@@ -4275,7 +4326,7 @@ Value: 2006.01.01</screen>
           <para>Pour supprimer un pack d'extension précédemment installé, utilisez
           <computeroutput>VBoxManage extpack uninstall
           <nom></computeroutput>. Vous pouvez utiliser
-          <computeroutput>VBoxManage list extpacks</computeroutput> tpour
+          <computeroutput>VBoxManage list extpacks</computeroutput> pour
           afficher les noms des pack d'extensions actuellement installés&#xA0;;
           merci de voir aussi <xref linkend="vboxmanage-list" />. Vous pouvez
           utiliser le paramètre optionnel <computeroutput>--force</computeroutput>
diff --git a/doc/manual/fr_FR/user_VirtualBoxAPI.xml b/doc/manual/fr_FR/user_VirtualBoxAPI.xml
index 77badb0..edf4630 100644
--- a/doc/manual/fr_FR/user_VirtualBoxAPI.xml
+++ b/doc/manual/fr_FR/user_VirtualBoxAPI.xml
@@ -4,7 +4,7 @@
 <chapter id="VirtualBoxAPI">
   <title>Interfaces de programmation de VirtualBox</title>
 
-  <para>VirtualBox est fournie avec un support complet pour les développeurs
+  <para>VirtualBox est fourni avec un support complet pour les développeurs
   tiers. Ce qu'on appelle "l'API principale" de VirtualBox implémente toutes
   les fonctionnalités du moteur de virtualisation. Elle est complètement documentée
   et disponible pour n'importe qui souhaitant contrôler VirtualBox en programmant.
@@ -19,7 +19,7 @@
   ont été mises dans un <emphasis role="bold">Software Development Kit (SDK),</emphasis>
   distinct disponible en téléchargement sur <ulink type=""
   url="http://www.virtualbox.org">http://www.virtualbox.org</ulink>. En
-  particulier, le SDK est fourni avec un "PGuide de pogrammation et de Référence"
+  particulier, le SDK est fourni avec un "Guide de pogrammation et de Référence"
   au format PDF contenant entre autres des informations qui se trouvaient jadis
   dans ce chapitre du manuel de l'utilisateur.</para>
 </chapter>
diff --git a/doc/manual/user_ChangeLogImpl.xml b/doc/manual/user_ChangeLogImpl.xml
index 047fc71..a493615 100644
--- a/doc/manual/user_ChangeLogImpl.xml
+++ b/doc/manual/user_ChangeLogImpl.xml
@@ -1,166 +1,183 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
   <sect1>
-    <title>Version 4.3.28 (2015-05-13)</title>
+    <title>Version 5.0.0 Beta 4 (2015-05-18)</title>
 
-    <para>This is a maintenance release. The following items were fixed and/or
-      added:</para>
+    <para>This is a major update. The following major new features
+      were added:</para>
 
     <itemizedlist>
 
       <listitem>
-        <para>VMM: fixed a Guru Meditation when rebooting certain guests (for
-          example Solaris doing fast reboot) by fixing the implementation for INIT IPI</para>
+        <para>Paravirtualization support for Windows and Linux guests to improve
+          time-keeping accuracy and performance (see  <xref linkend="gimproviders" />)</para>
       </listitem>
 
       <listitem>
-        <para>VMM: added some information for diagnosing rare
-          <emphasis>VERR_VMX_INVALID_VMXON_PTR</emphasis> Guru Meditations (VT-x only)</para>
+        <para>Make more instruction set extensions available to the guest when
+          running with hardware-assisted virtualization and nested paging. Among
+          others this includes: SSE 4.1, SSE4.2, AES-NI, <emphasis>POPCNT</emphasis>,
+          <emphasis>RDRAND</emphasis> and <emphasis>RDSEED</emphasis></para>
       </listitem>
 
       <listitem>
-        <para>GUI: HID LEDs sync: prevent synchronization if VM window has no focus
-          (Windows and Mac OS X hosts only)</para>
+        <para>xHCI Controller to support USB 3 devices
+          (see <xref linkend="settings-usb" />)</para>
       </listitem>
 
       <listitem>
-        <para>GUI: fixed drag and drop moving the cursor between guest screens on
-          certain hosts</para>
+        <para>Drag and drop support (bidirectional) for Windows, Linux and Solaris guests</para>
       </listitem>
 
       <listitem>
-        <para>3D: fixed a crash on restoring the VM state on X11 hosts (bug #12737)</para>
+        <para>Disk image encryption (see </para>
       </listitem>
 
       <listitem>
-        <para>3D: fixed a crash on restoring the VM state</para>
+        <para>GUI: VM guest-content scaling support (including 3D acceleration)</para>
       </listitem>
 
       <listitem>
-        <para>3D: fixed a crash on Linux guest shutdown (bug #12772)</para>
+        <para>GUI: New User Interface settings page for customizing status-bar,
+          menu-bar and guest-content scaling</para>
       </listitem>
 
       <listitem>
-        <para>VRDP: fixed incompatibility with rdesktop 1.8.3</para>
+        <para>GUI: New Encryption settings tab for customizing encryption options for
+          disk images</para>
       </listitem>
 
       <listitem>
-        <para>VRDP: fixed listening for IPv6 on some systems (bug #14038)</para>
+        <para>GUI: HiDPI support including application icons and optional unscaled HiDPI
+          output on Mac OS X (including 3D acceleration)</para>
       </listitem>
 
       <listitem>
-        <para>Storage: don't crash if creating an asynchronous I/O context
-          fails (e.g. when starting many VMs) and show a proper error message</para>
+        <para>GUI: Hotplugging support for SATA disks</para>
       </listitem>
 
       <listitem>
-        <para>Floppy: several fixes</para>
+        <para>New, modular audio architecture for providing a better abstraction of the host
+          audio backends</para>
       </listitem>
 
       <listitem>
-        <para>Audio: improved the behavior of the volume control for the
-          HD audio device emulation</para>
+        <para>Support for the NDIS6 networking framework on Windows (default on Vista
+          and later)</para>
       </listitem>
 
+    </itemizedlist>
+
+    <para>In addition, the following items were fixed and/or added:</para>
+
+    <itemizedlist>
+
       <listitem>
-        <para>USB: increase the number of supported drivers from 3 to 5
-          (Windows hosts only)</para>
+        <para>GUI: improved HID LEDs synchronization for Mac and Windows hosts.
+          Phisical LEDs state now restored together with VM state restore.</para>
       </listitem>
 
       <listitem>
-        <para>PS/2 keyboard: synchronize the LED state on VM restore
-          (Windows and Mac OS X hosts only)</para>
+        <para>GUI: take the guest screen aspect ratio into account for the
+          preview window</para>
       </listitem>
 
       <listitem>
-        <para>NAT Network: when running multiple NAT networks with multiple VMs,
-          only stop the respective services when stopping VMs (bug #14090)</para>
+        <para>VMM: improved timing on Solaris hosts with older VT-x hosts
+          without preemption timers</para>
       </listitem>
 
       <listitem>
-        <para>NAT: don't kill UDP bindings on ICMP errors (bug #13475)</para>
+        <para>VBoxManage: when exporting an appliance, support the suppression
+          of MAC addresses, which means they will be always recreated on
+          import, avoiding duplicate MAC addresses for VMs which are imported
+          several times</para>
       </listitem>
 
       <listitem>
-        <para>NAT: bandwidth limit now works properly with NAT (bug #11485)</para>
+        <para>USB: added USB traffic capturing (see <xref linkend="usbtrafficcapturing" />)</para>
       </listitem>
 
       <listitem>
-        <para>BIOS: fixed the returned size value of the VBE 2.0 PMI function 0Ah
-          (4.2.0 regression; bug #14096)</para>
+        <para>Made resizing X11 guests work more reliably</para>
       </listitem>
 
       <listitem>
-        <para>Guest Control: fixed parameter quoting in Windows guests
-          (bug #13157)</para>
+        <para>API: block the removal of the current snapshot if it has child
+          snapshots (only relevant for VMs without snapshottable hard disks,
+          their presence always prevented removal), which resulted in VM
+          config corruption</para>
       </listitem>
 
       <listitem>
-        <para>Webcam passthrough improvements for Linux (V4L2) hosts to support more
-          webcam models</para>
+        <para>API: mark VM configs with snapshots but without current snapshot
+          as inaccessible, as this combination is nonsense</para>
       </listitem>
 
       <listitem>
-        <para>API: don't fail starting a VM with <emphasis>VBOX_E_INVALID_OBJECT_STATE</emphasis>
-          under certain conditions (bug #13617)</para>
+        <para>API: fix information for some automatically generated events
+           (only with XPCOM, Windows host was not affected), which caused
+           errors when getting some of the attributes over the webservice
+           (bug #12379)</para>
       </listitem>
 
       <listitem>
-        <para>API: be more verbose on <emphasis>VBOX_E_INVALID_OBJECT_STATE</emphasis>
-          if a medium is attached to a running VM (bug #13560)</para>
+        <para>API: fix crashes in Java API clients using the XPCOM binding,
+          happened with output parameters only (bug #11232)</para>
       </listitem>
 
       <listitem>
-        <para>API: fixed a bug which could result in losing certain screen resize
-          events with multi-monitor guests</para>
+        <para>API: a number of settings (e.g. network settings) can now also
+          be changed when the VM is in saved state</para>
       </listitem>
 
       <listitem>
-        <para>rdesktop-vrdp: fixed path to the keymaps (bug #12066)</para>
+        <para>3D: fix potential race in which might cause a crash on VM
+          termination</para>
       </listitem>
 
       <listitem>
-        <para>rdesktop-vrdp: switch to version 1.8.3</para>
+        <para>3D: fixed a possible memory leak in the host service</para>
       </listitem>
 
       <listitem>
-        <para>Windows hosts: more hardening fixes (e.g. bugs #14051, #14052)</para>
+        <para>Serial: new TCP/IP backend (see <xref linkend="serialports"/>)</para>
       </listitem>
 
       <listitem>
-        <para>Linux hosts: another fix for activated SMAP on Linux 3.19
-          and newer (Broadwell and later; bug #13961)</para>
+        <para>Storage: added USB mass storage device class
+          (see <xref linkend="harddiskcontrollers"/>)</para>
       </listitem>
 
       <listitem>
-        <para>Linux hosts: Linux 4.1 compile fix (bug #14081)</para>
+        <para>BIOS: fix for booting from SCSI CD/DVD media</para>
       </listitem>
 
       <listitem>
-        <para>Solaris hosts: fixed using of VNIC templates with Crossbow based
-          bridged networking to be compatible with vanity interface names</para>
+        <para>BIOS: fix for reads partially beyond end of disk (bug #14021)</para>
       </listitem>
 
       <listitem>
-        <para>Mac OS X hosts: fixed crash during VM termination under rare
-          circumstances</para>
+        <para>VRDP: fixed listening for IPv6 on some systems (bug #14038)</para>
       </listitem>
 
       <listitem>
-        <para>Windows Additions/WDDM: improved video memory utilization and allow
-          more/bigger guest screens with large resolutions (including HiDPI)</para>
+        <para>rdesktop-vrdp: upgraded to version 1.8.3</para>
       </listitem>
 
       <listitem>
-        <para>X11 Additions: prevent flickering when updating mouse cursor</para>
+        <para>Guest Additions: added a heartbeat service
+          (see <xref linkend="heartbeatservice" />)</para>
       </listitem>
 
       <listitem>
-        <para>Solaris Additions: fixed incorrect usage of 'prtconf' while
-          installing Guest Additions (Solaris 10 only)</para>
+        <para>Windows Additions/WDDM: improved video memory utilization and
+          allow more/bigger guest screens with large resolutions (including HiDPI
+        </para>
       </listitem>
 
     </itemizedlist>
+
   </sect1>
 
   <sect1>
@@ -669,7 +686,7 @@
       </listitem>
 
       <listitem>
-        <para>Storage: fixed broken iSCSI authentication (4.3.14 regression, bugs #13386,
+        <para>Storage: fixed broken iSCSI authentication (4.3.14 regression; bugs #13386,
           #13435)</para>
       </listitem>
 
@@ -1372,8 +1389,7 @@
 
       <listitem>
         <para>VMM: experimental support for SSE 4.1 / SSE 4.2 passthrough, see
-          <xref linkend="sse412passthrough" xreflabel="here"/> how to
-          enable it (bug #8651)</para>
+          the user manual how to enable it (bug #8651)</para>
       </listitem>
 
       <listitem>
diff --git a/include/VBox/GuestHost/DragAndDrop.h b/include/VBox/GuestHost/DragAndDrop.h
new file mode 100644
index 0000000..f6b908c
--- /dev/null
+++ b/include/VBox/GuestHost/DragAndDrop.h
@@ -0,0 +1,199 @@
+/* $Id: DragAndDrop.h $ */
+/** @file
+ * DnD: Shared functions between host and guest.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifndef ___VBox_GuestHost_DragAndDrop_h
+#define ___VBox_GuestHost_DragAndDrop_h
+
+#include <iprt/assert.h>
+#include <iprt/cdefs.h>
+#include <iprt/dir.h>
+#include <iprt/err.h>
+#include <iprt/file.h>
+#include <iprt/types.h>
+
+#include <iprt/cpp/list.h>
+#include <iprt/cpp/ministring.h>
+
+/**
+ * Structure for maintaining a "dropped files" directory
+ * on the host or guest. This will contain all received files & directories
+ * for a single transfer.
+ */
+typedef struct DNDDIRDROPPEDFILES
+{
+    /** Directory handle for drop directory. */
+    PRTDIR                       hDir;
+    /** Absolute path to drop directory. */
+    RTCString                    strPathAbs;
+    /** List for holding created directories in the case of a rollback. */
+    RTCList<RTCString>           lstDirs;
+    /** List for holding created files in the case of a rollback. */
+    RTCList<RTCString>           lstFiles;
+
+} DNDDIRDROPPEDFILES, *PDNDDIRDROPPEDFILES;
+
+int DnDDirDroppedAddFile(PDNDDIRDROPPEDFILES pDir, const char *pszFile);
+int DnDDirDroppedAddDir(PDNDDIRDROPPEDFILES pDir, const char *pszDir);
+int DnDDirDroppedFilesCreateAndOpenEx(const char *pszPath, PDNDDIRDROPPEDFILES pDir);
+int DnDDirDroppedFilesCreateAndOpenTemp(PDNDDIRDROPPEDFILES pDir);
+int DnDDirDroppedFilesClose(PDNDDIRDROPPEDFILES pDir, bool fRemove);
+const char *DnDDirDroppedFilesGetDirAbs(PDNDDIRDROPPEDFILES pDir);
+int DnDDirDroppedFilesRollback(PDNDDIRDROPPEDFILES pDir);
+
+bool DnDMIMEHasFileURLs(const char *pcszFormat, size_t cchFormatMax);
+bool DnDMIMENeedsDropDir(const char *pcszFormat, size_t cchFormatMax);
+
+int DnDPathSanitizeFilename(char *pszPath, size_t cbPath);
+int DnDPathSanitize(char *pszPath, size_t cbPath);
+
+/** Keep the original paths, don't convert paths to relative ones. */
+#define DNDURILIST_FLAGS_ABSOLUTE_PATHS         RT_BIT(0)
+/** Resolve all symlinks. */
+#define DNDURILIST_FLAGS_RESOLVE_SYMLINKS       RT_BIT(1)
+
+class DnDURIObject
+{
+public:
+
+    enum Type
+    {
+        Unknown = 0,
+        File,
+        Directory,
+        Type_32Bit_Hack = 0x7fffffff
+    };
+
+    enum Dest
+    {
+        Source = 0,
+        Target,
+        Dest_32Bit_Hack = 0x7fffffff
+    };
+
+    DnDURIObject(void);
+    DnDURIObject(Type type,
+                 const RTCString &strSrcPath = "",
+                 const RTCString &strDstPath = "",
+                 uint32_t fMode = 0, uint64_t cbSize = 0);
+    virtual ~DnDURIObject(void);
+
+public:
+
+    const RTCString &GetSourcePath(void) const { return m_strSrcPath; }
+    const RTCString &GetDestPath(void) const { return m_strTgtPath; }
+    uint32_t GetMode(void) const { return m_fMode; }
+    uint64_t GetProcessed(void) const { return m_cbProcessed; }
+    uint64_t GetSize(void) const { return m_cbSize; }
+    Type GetType(void) const { return m_Type; }
+
+public:
+
+    int SetSize(uint64_t uSize) { m_cbSize = uSize; return VINF_SUCCESS; }
+
+public:
+
+    void Close(void);
+    bool IsComplete(void) const;
+    bool IsOpen(void) const;
+    int Open(Dest enmDest, uint64_t fOpen, uint32_t fMode = 0);
+    int OpenEx(const RTCString &strPath, Type enmType, Dest enmDest, uint64_t fOpen = 0, uint32_t fMode = 0, uint32_t fFlags = 0);
+    int Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead);
+    void Reset(void);
+    int Write(const void *pvBuf, size_t cbBuf, uint32_t *pcbWritten);
+
+public:
+
+    static int RebaseURIPath(RTCString &strPath, const RTCString &strBaseOld = "", const RTCString &strBaseNew = "");
+
+protected:
+
+    void closeInternal(void);
+
+protected:
+
+    Type      m_Type;
+    RTCString m_strSrcPath;
+    RTCString m_strTgtPath;
+    /** Object (file/directory) mode. */
+    uint32_t  m_fMode;
+    /** Size (in bytes) to read/write. */
+    uint64_t  m_cbSize;
+    /** Bytes processed reading/writing. */
+    uint64_t  m_cbProcessed;
+
+    union
+    {
+        RTFILE m_hFile;
+    } u;
+};
+
+class DnDURIList
+{
+public:
+
+    DnDURIList(void);
+    virtual ~DnDURIList(void);
+
+public:
+
+    int AppendNativePath(const char *pszPath, uint32_t fFlags);
+    int AppendNativePathsFromList(const char *pszNativePaths, size_t cbNativePaths, uint32_t fFlags);
+    int AppendNativePathsFromList(const RTCList<RTCString> &lstNativePaths, uint32_t fFlags);
+    int AppendURIPath(const char *pszURI, uint32_t fFlags);
+    int AppendURIPathsFromList(const char *pszURIPaths, size_t cbURIPaths, uint32_t fFlags);
+    int AppendURIPathsFromList(const RTCList<RTCString> &lstURI, uint32_t fFlags);
+
+    void Clear(void);
+    DnDURIObject &First(void) { return m_lstTree.first(); }
+    bool IsEmpty(void) { return m_lstTree.isEmpty(); }
+    void RemoveFirst(void);
+    int RootFromURIData(const void *pvData, size_t cbData, uint32_t fFlags);
+    RTCString RootToString(const RTCString &strPathBase = "", const RTCString &strSeparator = "\r\n");
+    size_t RootCount(void) { return m_lstRoot.size(); }
+    uint32_t TotalCount(void) { return m_cTotal; }
+    size_t TotalBytes(void) { return m_cbTotal; }
+
+protected:
+
+    int addEntry(const char *pcszSource, const char *pcszTarget, uint32_t fFlags);
+    int appendPathRecursive(const char *pcszSrcPath, const char *pcszDstPath, const char *pcszDstBase, size_t cchDstBase, uint32_t fFlags);
+
+protected:
+
+    /** List of all top-level file/directory entries.
+     *  Note: All paths are kept internally as UNIX paths for
+     *        easier conversion/handling!  */
+    RTCList<RTCString>     m_lstRoot;
+    /** List of all URI objects added. */
+    RTCList<DnDURIObject>  m_lstTree;
+    /** Total number of all URI objects. */
+    uint32_t               m_cTotal;
+    /** Total size of all URI objects, that is, the file
+     *  size of all objects (in bytes). */
+    size_t                 m_cbTotal;
+};
+#endif /* ___VBox_GuestHost_DragAndDrop_h */
+
diff --git a/include/VBox/HGSMI/HGSMI.h b/include/VBox/HGSMI/HGSMI.h
index 61a079e..a258951 100644
--- a/include/VBox/HGSMI/HGSMI.h
+++ b/include/VBox/HGSMI/HGSMI.h
@@ -32,13 +32,9 @@
 #include <iprt/assert.h>
 #include <iprt/types.h>
 
+#include <VBox/HGSMI/HGSMIDefs.h>
 #include <VBox/HGSMI/HGSMIChannels.h>
-
-/* HGSMI uses 32 bit offsets and sizes. */
-typedef uint32_t HGSMISIZE;
-typedef uint32_t HGSMIOFFSET;
-
-#define HGSMIOFFSET_VOID ((HGSMIOFFSET)~0)
+#include <VBox/HGSMI/HGSMIMemAlloc.h>
 
 /*
  * Basic mechanism for the HGSMI is to prepare and pass data buffer to the host and the guest.
@@ -75,96 +71,12 @@ typedef uint32_t HGSMIOFFSET;
  *     * the channel information.
  */
 
-
-/* Describes a shared memory area buffer.
- * Used for calculations with offsets and for buffers verification.
- */
-typedef struct _HGSMIAREA
+typedef struct HGSMIHEAP
 {
-    uint8_t     *pu8Base; /* The starting address of the area. Corresponds to offset 'offBase'. */
-    HGSMIOFFSET  offBase; /* The starting offset of the area. */
-    HGSMIOFFSET  offLast; /* The last valid offset:
-                           * offBase + cbArea - 1 - (sizeof (header) + sizeof (tail)).
-                           */
-    HGSMISIZE    cbArea;  /* Size of the area. */
-} HGSMIAREA;
-
-
-/* The buffer description flags. */
-#define HGSMI_BUFFER_HEADER_F_SEQ_MASK     0x03 /* Buffer sequence type mask. */
-#define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE   0x00 /* Single buffer, not a part of a sequence. */
-#define HGSMI_BUFFER_HEADER_F_SEQ_START    0x01 /* The first buffer in a sequence. */
-#define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02 /* A middle buffer in a sequence. */
-#define HGSMI_BUFFER_HEADER_F_SEQ_END      0x03 /* The last buffer in a sequence. */
-
-
-#pragma pack(1)
-/* 16 bytes buffer header. */
-typedef struct _HGSMIBUFFERHEADER
-{
-    uint32_t    u32DataSize;            /* Size of data that follows the header. */
-
-    uint8_t     u8Flags;                /* The buffer description: HGSMI_BUFFER_HEADER_F_* */
-
-    uint8_t     u8Channel;              /* The channel the data must be routed to. */
-    uint16_t    u16ChannelInfo;         /* Opaque to the HGSMI, used by the channel. */
-
-    union {
-        uint8_t au8Union[8];            /* Opaque placeholder to make the union 8 bytes. */
-
-        struct
-        {                               /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
-            uint32_t u32Reserved1;      /* A reserved field, initialize to 0. */
-            uint32_t u32Reserved2;      /* A reserved field, initialize to 0. */
-        } Buffer;
-
-        struct
-        {                               /* HGSMI_BUFFER_HEADER_F_SEQ_START */
-            uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
-            uint32_t u32SequenceSize;   /* The total size of the sequence. */
-        } SequenceStart;
-
-        struct
-        {                               /* HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and HGSMI_BUFFER_HEADER_F_SEQ_END */
-            uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
-            uint32_t u32SequenceOffset; /* Data offset in the entire sequence. */
-        } SequenceContinue;
-    } u;
-
-} HGSMIBUFFERHEADER;
-
-/* 8 bytes buffer tail. */
-typedef struct _HGSMIBUFFERTAIL
-{
-    uint32_t    u32Reserved;        /* Reserved, must be initialized to 0. */
-    uint32_t    u32Checksum;        /* Verifyer for the buffer header and offset and for first 4 bytes of the tail. */
-} HGSMIBUFFERTAIL;
-#pragma pack()
-
-AssertCompile(sizeof (HGSMIBUFFERHEADER) == 16);
-AssertCompile(sizeof (HGSMIBUFFERTAIL) == 8);
-
-/* Heap types. */
-#define HGSMI_HEAP_TYPE_NULL    0 /* Heap not initialized. */
-#define HGSMI_HEAP_TYPE_POINTER 1 /* Deprecated. RTHEAPSIMPLE. */
-#define HGSMI_HEAP_TYPE_OFFSET  2 /* Deprecated. RTHEAPOFFSET. */
-#define HGSMI_HEAP_TYPE_MA      3 /* Memory allocator. */
-
-#pragma pack(1)
-typedef struct _HGSMIHEAP
-{
-    union
-    {
-        RTHEAPSIMPLE  hPtr;         /**< Pointer based heap. */
-        RTHEAPOFFSET  hOff;         /**< Offset based heap. */
-    } u;
-    HGSMIAREA     area;             /**< Description. */
-    int           cRefs;            /**< Number of heap allocations. */
-    bool          fOffsetBased;     /**< Set if offset based. */
+    HGSMIAREA area; /* Description. */
+    HGSMIMADATA ma; /* Memory allocator */
 } HGSMIHEAP;
-#pragma pack()
 
-#pragma pack(1)
 /* The size of the array of channels. Array indexes are uint8_t. Note: the value must not be changed. */
 #define HGSMI_NUMBER_OF_CHANNELS 0x100
 
@@ -194,7 +106,6 @@ typedef struct _HGSMICHANNELINFO
                                                       * The array is accessed under the instance lock.
                                                       */
 }  HGSMICHANNELINFO;
-#pragma pack()
 
 
 RT_C_DECLS_BEGIN
@@ -209,149 +120,130 @@ DECLINLINE(uint8_t *) HGSMIBufferDataFromPtr(void *pvBuffer)
     return (uint8_t *)pvBuffer + sizeof(HGSMIBUFFERHEADER);
 }
 
-DECLINLINE(HGSMIBUFFERTAIL *) HGSMIBufferTailFromPtr(void *pvBuffer, uint32_t u32DataSize)
+DECLINLINE(HGSMIBUFFERTAIL *) HGSMIBufferTailFromPtr(void *pvBuffer,
+                                                     uint32_t u32DataSize)
 {
     return (HGSMIBUFFERTAIL *)(HGSMIBufferDataFromPtr(pvBuffer) + u32DataSize);
 }
 
-DECLINLINE(HGSMISIZE) HGSMIBufferMinimumSize (void)
-{
-    return sizeof (HGSMIBUFFERHEADER) + sizeof (HGSMIBUFFERTAIL);
-}
-
-DECLINLINE(uint8_t *) HGSMIBufferData (const HGSMIBUFFERHEADER *pHeader)
+DECLINLINE(HGSMISIZE) HGSMIBufferMinimumSize(void)
 {
-    return (uint8_t *)pHeader + sizeof (HGSMIBUFFERHEADER);
+    return sizeof(HGSMIBUFFERHEADER) + sizeof(HGSMIBUFFERTAIL);
 }
 
-DECLINLINE(HGSMIBUFFERTAIL *) HGSMIBufferTail (const HGSMIBUFFERHEADER *pHeader)
+DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromData(const void *pvData)
 {
-    return (HGSMIBUFFERTAIL *)(HGSMIBufferData (pHeader) + pHeader->u32DataSize);
+    return (HGSMIBUFFERHEADER *)((uint8_t *)pvData - sizeof(HGSMIBUFFERHEADER));
 }
 
-DECLINLINE(HGSMIBUFFERHEADER *) HGSMIBufferHeaderFromData (const void *pvData)
+DECLINLINE(HGSMISIZE) HGSMIBufferRequiredSize(uint32_t u32DataSize)
 {
-    return (HGSMIBUFFERHEADER *)((uint8_t *)pvData - sizeof (HGSMIBUFFERHEADER));
+    return HGSMIBufferMinimumSize() + u32DataSize;
 }
 
-DECLINLINE(HGSMISIZE) HGSMIBufferRequiredSize (uint32_t u32DataSize)
+DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset(const HGSMIAREA *pArea,
+                                             const void *pv)
 {
-    return HGSMIBufferMinimumSize () + u32DataSize;
+    return pArea->offBase + (HGSMIOFFSET)((uint8_t *)pv - pArea->pu8Base);
 }
 
-DECLINLINE(HGSMIOFFSET) HGSMIPointerToOffset (const HGSMIAREA *pArea,
-                                              const HGSMIBUFFERHEADER *pHeader)
+DECLINLINE(void *) HGSMIOffsetToPointer(const HGSMIAREA *pArea,
+                                        HGSMIOFFSET offBuffer)
 {
-    return pArea->offBase + (HGSMIOFFSET)((uint8_t *)pHeader - pArea->pu8Base);
+    return pArea->pu8Base + (offBuffer - pArea->offBase);
 }
 
-DECLINLINE(HGSMIBUFFERHEADER *) HGSMIOffsetToPointer (const HGSMIAREA *pArea,
-                                                      HGSMIOFFSET offBuffer)
+DECLINLINE(uint8_t *) HGSMIBufferDataFromOffset(const HGSMIAREA *pArea,
+                                                HGSMIOFFSET offBuffer)
 {
-    return (HGSMIBUFFERHEADER *)(pArea->pu8Base + (offBuffer - pArea->offBase));
+    void *pvBuffer = HGSMIOffsetToPointer(pArea, offBuffer);
+    return HGSMIBufferDataFromPtr(pvBuffer);
 }
 
-DECLINLINE(uint8_t *) HGSMIBufferDataFromOffset (const HGSMIAREA *pArea, HGSMIOFFSET offBuffer)
+DECLINLINE(HGSMIOFFSET) HGSMIBufferOffsetFromData(const HGSMIAREA *pArea,
+                                                  void *pvData)
 {
-    HGSMIBUFFERHEADER *pHeader = HGSMIOffsetToPointer (pArea, offBuffer);
-    Assert(pHeader);
-    if(pHeader)
-        return HGSMIBufferData(pHeader);
-    return NULL;
+    HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);
+    return HGSMIPointerToOffset(pArea, pHeader);
 }
 
-DECLINLINE(uint8_t *) HGSMIBufferDataAndChInfoFromOffset (const HGSMIAREA *pArea, HGSMIOFFSET offBuffer, uint16_t * pChInfo)
+DECLINLINE(uint8_t *) HGSMIBufferDataAndChInfoFromOffset(const HGSMIAREA *pArea,
+                                                         HGSMIOFFSET offBuffer,
+                                                         uint16_t *pu16ChannelInfo)
 {
-    HGSMIBUFFERHEADER *pHeader = HGSMIOffsetToPointer (pArea, offBuffer);
-    Assert(pHeader);
-    if(pHeader)
-    {
-        *pChInfo = pHeader->u16ChannelInfo;
-        return HGSMIBufferData(pHeader);
-    }
-    return NULL;
+    HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIOffsetToPointer(pArea, offBuffer);
+    *pu16ChannelInfo = pHeader->u16ChannelInfo;
+    return HGSMIBufferDataFromPtr(pHeader);
 }
 
-uint32_t HGSMIChecksum (HGSMIOFFSET offBuffer,
-                        const HGSMIBUFFERHEADER *pHeader,
-                        const HGSMIBUFFERTAIL *pTail);
+uint32_t HGSMIChecksum(HGSMIOFFSET offBuffer,
+                       const HGSMIBUFFERHEADER *pHeader,
+                       const HGSMIBUFFERTAIL *pTail);
 
-int HGSMIAreaInitialize (HGSMIAREA *pArea,
-                         void *pvBase,
-                         HGSMISIZE cbArea,
-                         HGSMIOFFSET offBase);
+int HGSMIAreaInitialize(HGSMIAREA *pArea,
+                        void *pvBase,
+                        HGSMISIZE cbArea,
+                        HGSMIOFFSET offBase);
 
-void HGSMIAreaClear (HGSMIAREA *pArea);
+void HGSMIAreaClear(HGSMIAREA *pArea);
 
-DECLINLINE(bool) HGSMIAreaContainsOffset(HGSMIAREA *pArea, HGSMIOFFSET offSet)
+DECLINLINE(bool) HGSMIAreaContainsOffset(const HGSMIAREA *pArea, HGSMIOFFSET off)
 {
-    return pArea->offBase <= offSet && pArea->offBase + pArea->cbArea > offSet;
+    return off >= pArea->offBase && off - pArea->offBase < pArea->cbArea;
 }
 
-HGSMIOFFSET HGSMIBufferInitializeSingle (const HGSMIAREA *pArea,
-                                         HGSMIBUFFERHEADER *pHeader,
-                                         HGSMISIZE cbBuffer,
-                                         uint8_t u8Channel,
-                                         uint16_t u16ChannelInfo);
-
-int HGSMIHeapSetup (HGSMIHEAP *pHeap,
-                    void *pvBase,
-                    HGSMISIZE cbArea,
-                    HGSMIOFFSET offBase,
-                    bool fOffsetBased);
+DECLINLINE(bool) HGSMIAreaContainsPointer(const HGSMIAREA *pArea, const void *pv)
+{
+    return (uintptr_t)pv >= (uintptr_t)pArea->pu8Base && (uintptr_t)pv - (uintptr_t)pArea->pu8Base < pArea->cbArea;
+}
 
-int HGSMIHeapRelocate (HGSMIHEAP *pHeap,
-                       void *pvBase,
-                       uint32_t offHeapHandle,
-                       uintptr_t offDelta,
-                       HGSMISIZE cbArea,
-                       HGSMIOFFSET offBase,
-                       bool fOffsetBased);
+HGSMIOFFSET HGSMIBufferInitializeSingle(const HGSMIAREA *pArea,
+                                        HGSMIBUFFERHEADER *pHeader,
+                                        HGSMISIZE cbBuffer,
+                                        uint8_t u8Channel,
+                                        uint16_t u16ChannelInfo);
 
-void HGSMIHeapSetupUnitialized (HGSMIHEAP *pHeap);
-bool HGSMIHeapIsItialized (HGSMIHEAP *pHeap);
+int HGSMIHeapSetup(HGSMIHEAP *pHeap,
+                   void *pvBase,
+                   HGSMISIZE cbArea,
+                   HGSMIOFFSET offBase,
+                   const HGSMIENV *pEnv);
 
-void HGSMIHeapDestroy (HGSMIHEAP *pHeap);
+void HGSMIHeapDestroy(HGSMIHEAP *pHeap);
 
-void* HGSMIHeapBufferAlloc (HGSMIHEAP *pHeap,
-        HGSMISIZE cbBuffer);
+void *HGSMIHeapBufferAlloc(HGSMIHEAP *pHeap,
+                           HGSMISIZE cbBuffer);
 
 void HGSMIHeapBufferFree(HGSMIHEAP *pHeap,
-                    void *pvBuf);
+                         void *pvBuf);
 
-void *HGSMIHeapAlloc (HGSMIHEAP *pHeap,
-                      HGSMISIZE cbData,
-                      uint8_t u8Channel,
-                      uint16_t u16ChannelInfo);
+void *HGSMIHeapAlloc(HGSMIHEAP *pHeap,
+                     HGSMISIZE cbData,
+                     uint8_t u8Channel,
+                     uint16_t u16ChannelInfo);
 
-HGSMIOFFSET HGSMIHeapBufferOffset (HGSMIHEAP *pHeap,
-                                   void *pvData);
+void HGSMIHeapFree(HGSMIHEAP *pHeap,
+                   void *pvData);
 
-void HGSMIHeapFree (HGSMIHEAP *pHeap,
-                    void *pvData);
+DECLINLINE(const HGSMIAREA *) HGSMIHeapArea(HGSMIHEAP *pHeap)
+{
+    return &pHeap->area;
+}
 
 DECLINLINE(HGSMIOFFSET) HGSMIHeapOffset(HGSMIHEAP *pHeap)
 {
-    return pHeap->area.offBase;
+    return HGSMIHeapArea(pHeap)->offBase;
 }
 
-#ifdef IN_RING3
-/* needed for heap relocation */
-DECLINLINE(HGSMIOFFSET) HGSMIHeapHandleLocationOffset(HGSMIHEAP *pHeap)
+DECLINLINE(HGSMISIZE) HGSMIHeapSize(HGSMIHEAP *pHeap)
 {
-#if (__GNUC__ * 100 + __GNUC_MINOR__) < 405
-    /* does not work with gcc-4.5 */
-    AssertCompile((uintptr_t)NIL_RTHEAPSIMPLE == (uintptr_t)NIL_RTHEAPOFFSET);
-#endif
-    return pHeap->u.hPtr != NIL_RTHEAPSIMPLE
-        ? (HGSMIOFFSET)(pHeap->area.pu8Base - (uint8_t*)pHeap->u.hPtr)
-        : HGSMIOFFSET_VOID;
+    return HGSMIHeapArea(pHeap)->cbArea;
 }
-#endif /* IN_RING3 */
 
-DECLINLINE(HGSMISIZE) HGSMIHeapSize(HGSMIHEAP *pHeap)
+DECLINLINE(HGSMIOFFSET) HGSMIHeapBufferOffset(HGSMIHEAP *pHeap,
+                                              void *pvData)
 {
-    return pHeap->area.cbArea;
+    return HGSMIBufferOffsetFromData(HGSMIHeapArea(pHeap), pvData);
 }
 
 HGSMICHANNEL *HGSMIChannelFindById(HGSMICHANNELINFO *pChannelInfo,
@@ -363,7 +255,7 @@ int HGSMIChannelRegister(HGSMICHANNELINFO *pChannelInfo,
                          PFNHGSMICHANNELHANDLER pfnChannelHandler,
                          void *pvChannelHandler);
 
-int HGSMIBufferProcess(HGSMIAREA *pArea,
+int HGSMIBufferProcess(const HGSMIAREA *pArea,
                        HGSMICHANNELINFO *pChannelInfo,
                        HGSMIOFFSET offBuffer);
 RT_C_DECLS_END
diff --git a/include/VBox/HGSMI/HGSMIDefs.h b/include/VBox/HGSMI/HGSMIDefs.h
new file mode 100644
index 0000000..a3f7d19
--- /dev/null
+++ b/include/VBox/HGSMI/HGSMIDefs.h
@@ -0,0 +1,123 @@
+/** @file
+ *
+ * VBox Host Guest Shared Memory Interface (HGSMI).
+ * Host/Guest shared part: types and defines.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+#ifndef ___VBox_HGSMI_HGSMIDefs_h
+#define ___VBox_HGSMI_HGSMIDefs_h
+
+#include <iprt/assert.h>
+#include <iprt/types.h>
+
+/* HGSMI uses 32 bit offsets and sizes. */
+typedef uint32_t HGSMISIZE;
+typedef uint32_t HGSMIOFFSET;
+
+#define HGSMIOFFSET_VOID ((HGSMIOFFSET)~0)
+
+/* Describes a shared memory area buffer.
+ * Used for calculations with offsets and for buffers verification.
+ */
+typedef struct HGSMIAREA
+{
+    uint8_t     *pu8Base; /* The starting address of the area. Corresponds to offset 'offBase'. */
+    HGSMIOFFSET  offBase; /* The starting offset of the area. */
+    HGSMIOFFSET  offLast; /* The last valid offset:
+                           * offBase + cbArea - 1 - (sizeof(header) + sizeof(tail)).
+                           */
+    HGSMISIZE    cbArea;  /* Size of the area. */
+} HGSMIAREA;
+
+
+/* The buffer description flags. */
+#define HGSMI_BUFFER_HEADER_F_SEQ_MASK     0x03 /* Buffer sequence type mask. */
+#define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE   0x00 /* Single buffer, not a part of a sequence. */
+#define HGSMI_BUFFER_HEADER_F_SEQ_START    0x01 /* The first buffer in a sequence. */
+#define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02 /* A middle buffer in a sequence. */
+#define HGSMI_BUFFER_HEADER_F_SEQ_END      0x03 /* The last buffer in a sequence. */
+
+
+#pragma pack(1)
+/* 16 bytes buffer header. */
+typedef struct HGSMIBUFFERHEADER
+{
+    uint32_t    u32DataSize;            /* Size of data that follows the header. */
+
+    uint8_t     u8Flags;                /* The buffer description: HGSMI_BUFFER_HEADER_F_* */
+
+    uint8_t     u8Channel;              /* The channel the data must be routed to. */
+    uint16_t    u16ChannelInfo;         /* Opaque to the HGSMI, used by the channel. */
+
+    union {
+        uint8_t au8Union[8];            /* Opaque placeholder to make the union 8 bytes. */
+
+        struct
+        {                               /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
+            uint32_t u32Reserved1;      /* A reserved field, initialize to 0. */
+            uint32_t u32Reserved2;      /* A reserved field, initialize to 0. */
+        } Buffer;
+
+        struct
+        {                               /* HGSMI_BUFFER_HEADER_F_SEQ_START */
+            uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
+            uint32_t u32SequenceSize;   /* The total size of the sequence. */
+        } SequenceStart;
+
+        struct
+        {                               /* HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and HGSMI_BUFFER_HEADER_F_SEQ_END */
+            uint32_t u32SequenceNumber; /* The sequence number, the same for all buffers in the sequence. */
+            uint32_t u32SequenceOffset; /* Data offset in the entire sequence. */
+        } SequenceContinue;
+    } u;
+} HGSMIBUFFERHEADER;
+
+/* 8 bytes buffer tail. */
+typedef struct HGSMIBUFFERTAIL
+{
+    uint32_t    u32Reserved;        /* Reserved, must be initialized to 0. */
+    uint32_t    u32Checksum;        /* Verifyer for the buffer header and offset and for first 4 bytes of the tail. */
+} HGSMIBUFFERTAIL;
+#pragma pack()
+
+AssertCompileSize(HGSMIBUFFERHEADER, 16);
+AssertCompileSize(HGSMIBUFFERTAIL, 8);
+
+/* The size of the array of channels. Array indexes are uint8_t. Note: the value must not be changed. */
+#define HGSMI_NUMBER_OF_CHANNELS 0x100
+
+typedef struct HGSMIENV
+{
+    /* Environment context pointer. */
+    void *pvEnv;
+
+    /* Allocate system memory. */
+    DECLCALLBACKMEMBER(void *, pfnAlloc)(void *pvEnv, HGSMISIZE cb);
+
+    /* Free system memory. */
+    DECLCALLBACKMEMBER(void, pfnFree)(void *pvEnv, void *pv);
+} HGSMIENV;
+
+#endif /* !___VBox_HGSMI_HGSMIDefs_h */
diff --git a/include/VBox/HGSMI/HGSMIMemAlloc.h b/include/VBox/HGSMI/HGSMIMemAlloc.h
new file mode 100644
index 0000000..d973e36
--- /dev/null
+++ b/include/VBox/HGSMI/HGSMIMemAlloc.h
@@ -0,0 +1,100 @@
+/** @file
+ *
+ * VBox Host Guest Shared Memory Interface (HGSMI).
+ * Memory allocator.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+#ifndef ___VBox_HGSMI_HGSMIMemAlloc_h
+#define ___VBox_HGSMI_HGSMIMemAlloc_h
+
+#include <VBox/HGSMI/HGSMIDefs.h>
+#include <iprt/list.h>
+
+
+/* Descriptor. */
+#define HGSMI_MA_DESC_OFFSET_MASK UINT32_C(0xFFFFFFE0)
+#define HGSMI_MA_DESC_FREE_MASK   UINT32_C(0x00000010)
+#define HGSMI_MA_DESC_ORDER_MASK  UINT32_C(0x0000000F)
+
+#define HGSMI_MA_DESC_OFFSET(d)  ((d) & HGSMI_MA_DESC_OFFSET_MASK)
+#define HGSMI_MA_DESC_IS_FREE(d) (((d) & HGSMI_MA_DESC_FREE_MASK) != 0)
+#define HGSMI_MA_DESC_ORDER(d)   ((d) & HGSMI_MA_DESC_ORDER_MASK)
+
+#define HGSMI_MA_DESC_ORDER_BASE UINT32_C(5)
+
+#define HGSMI_MA_BLOCK_SIZE_MIN (UINT32_C(1) << (HGSMI_MA_DESC_ORDER_BASE + 0))
+#define HGSMI_MA_BLOCK_SIZE_MAX (UINT32_C(1) << (HGSMI_MA_DESC_ORDER_BASE + HGSMI_MA_DESC_ORDER_MASK))
+
+/* HGSMI_MA_DESC_ORDER_BASE must correspond to HGSMI_MA_DESC_OFFSET_MASK. */
+AssertCompile((~HGSMI_MA_DESC_OFFSET_MASK + 1) == HGSMI_MA_BLOCK_SIZE_MIN);
+
+
+typedef struct HGSMIMABLOCK
+{
+    RTLISTNODE nodeBlock;
+    RTLISTNODE nodeFree;
+    HGSMIOFFSET descriptor;
+} HGSMIMABLOCK;
+
+typedef struct HGSMIMADATA
+{
+    HGSMIAREA area;
+    HGSMIENV env;
+    HGSMISIZE cbMaxBlock;
+
+    uint32_t cBlocks;                                           /* How many blocks in the listBlocks. */
+    RTLISTANCHOR listBlocks;                                    /* All memory blocks, sorted. */
+    RTLISTANCHOR aListFreeBlocks[HGSMI_MA_DESC_ORDER_MASK + 1]; /* For free blocks of each order. */
+} HGSMIMADATA;
+
+RT_C_DECLS_BEGIN
+
+int HGSMIMAInit(HGSMIMADATA *pMA, const HGSMIAREA *pArea,
+                HGSMIOFFSET *paDescriptors, uint32_t cDescriptors, HGSMISIZE cbMaxBlock,
+                const HGSMIENV *pEnv);
+void HGSMIMAUninit(HGSMIMADATA *pMA);
+
+void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb);
+void HGSMIMAFree(HGSMIMADATA *pMA, void *pv);
+
+HGSMIMABLOCK *HGSMIMASearchOffset(HGSMIMADATA *pMA, HGSMIOFFSET off);
+
+uint32_t HGSMIPopCnt32(uint32_t u32);
+
+DECLINLINE(HGSMISIZE) HGSMIMAOrder2Size(HGSMIOFFSET order)
+{
+    return (UINT32_C(1) << (HGSMI_MA_DESC_ORDER_BASE + order));
+}
+
+DECLINLINE(HGSMIOFFSET) HGSMIMASize2Order(HGSMISIZE cb)
+{
+    HGSMIOFFSET order = HGSMIPopCnt32(cb - 1) - HGSMI_MA_DESC_ORDER_BASE;
+    Assert(HGSMIMAOrder2Size(order) == cb);
+    return order;
+}
+
+RT_C_DECLS_END
+
+#endif /* !___VBox_HGSMI_HGSMIMemAlloc_h */
diff --git a/include/VBox/Hardware/VBoxVideoVBE.h b/include/VBox/Hardware/VBoxVideoVBE.h
index dc61d45..97e1c58 100644
--- a/include/VBox/Hardware/VBoxVideoVBE.h
+++ b/include/VBox/Hardware/VBoxVideoVBE.h
@@ -80,7 +80,7 @@
 #define VGA_PORT_HGSMI_HOST             0x3b0
 #define VGA_PORT_HGSMI_GUEST            0x3d0
 
-/* this should be in sync with monitorCount <xsd:maxInclusive value="8"/> in src/VBox/Main/xml/VirtualBox-settings-common.xsd */
+/* this should be in sync with monitorCount <xsd:maxInclusive value="64"/> in src/VBox/Main/xml/VirtualBox-settings-common.xsd */
 #define VBOX_VIDEO_MAX_SCREENS 64
 
 #endif /* !___VBox_Hardware_VBoxVideoVBE_h */
diff --git a/include/VBox/HostServices/DragAndDropSvc.h b/include/VBox/HostServices/DragAndDropSvc.h
index 51289cb..ab102b0 100644
--- a/include/VBox/HostServices/DragAndDropSvc.h
+++ b/include/VBox/HostServices/DragAndDropSvc.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -26,6 +26,7 @@
 #ifndef ___VBox_HostService_DragAndDropSvc_h
 #define ___VBox_HostService_DragAndDropSvc_h
 
+#include <VBox/hgcmsvc.h>
 #include <VBox/VMMDev.h>
 #include <VBox/VBoxGuest2.h>
 
@@ -42,16 +43,36 @@
 #define DND_MOVE_ACTION       RT_BIT_32(1)
 #define DND_LINK_ACTION       RT_BIT_32(2)
 
-#define hasDnDCopyAction(a)   ((a) && DND_COPY_ACTION)
-#define hasDnDMoveAction(a)   ((a) && DND_MOVE_ACTION)
-#define hasDnDLinkAction(a)   ((a) && DND_LINK_ACTION)
+#define hasDnDCopyAction(a)   ((a) & DND_COPY_ACTION)
+#define hasDnDMoveAction(a)   ((a) & DND_MOVE_ACTION)
+#define hasDnDLinkAction(a)   ((a) & DND_LINK_ACTION)
 
 #define isDnDIgnoreAction(a)  ((a) == DND_IGNORE_ACTION)
 #define isDnDCopyAction(a)    ((a) == DND_COPY_ACTION)
 #define isDnDMoveAction(a)    ((a) == DND_MOVE_ACTION)
 #define isDnDLinkAction(a)    ((a) == DND_LINK_ACTION)
 
-/* Everything defined in this file lives in this namespace. */
+/** @def VBOX_DND_FORMATS_DEFAULT
+ * Default drag'n drop formats.
+ * Note: If you add new entries here, make sure you test those
+ *       with all supported guest OSes!
+ */
+#define VBOX_DND_FORMATS_DEFAULT                                                                \
+    "text/uri-list",                                                                            \
+    /* Text. */                                                                                 \
+    "text/html",                                                                                \
+    "text/plain;charset=utf-8",                                                                 \
+    "text/plain;charset=utf-16",                                                                \
+    "text/plain",                                                                               \
+    "text/richtext",                                                                            \
+    "UTF8_STRING",                                                                              \
+    "TEXT",                                                                                     \
+    "STRING",                                                                                   \
+    /* OpenOffice formats. */                                                                   \
+    /* See: https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Common_Application_Features#OpenOffice.org_Clipboard_Data_Formats */ \
+    "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", \
+    "application/x-openoffice;windows_formatname=\"Bitmap\""
+
 namespace DragAndDropSvc {
 
 /******************************************************************************
@@ -60,59 +81,144 @@ namespace DragAndDropSvc {
 
 /**
  * The service functions which are callable by host.
+ * Note: When adding new functions to this table, make sure that the actual ID
+ *       does *not* overlap with the eGuestFn enumeration below!
  */
 enum eHostFn
 {
+    /** The host just has set a new DnD mode. */
     HOST_DND_SET_MODE                  = 100,
 
-    /* H->G */
+    /*
+     * Host -> Guest messages
+     */
+
+    /** The host entered the VM window for starting an actual
+     *  DnD operation. */
     HOST_DND_HG_EVT_ENTER              = 200,
-    HOST_DND_HG_EVT_MOVE,
-    HOST_DND_HG_EVT_LEAVE,
-    HOST_DND_HG_EVT_DROPPED,
-    HOST_DND_HG_EVT_CANCEL,
-    HOST_DND_HG_SND_DATA,
-    HOST_DND_HG_SND_MORE_DATA,
-    HOST_DND_HG_SND_DIR,
-    HOST_DND_HG_SND_FILE,
-
-    /* G->H */
-    HOST_DND_GH_REQ_PENDING            = 300,
-    HOST_DND_GH_EVT_DROPPED
+    /** The host's DnD cursor moved within the VM window. */
+    HOST_DND_HG_EVT_MOVE               = 201,
+    /** The host left the guest VM window. */
+    HOST_DND_HG_EVT_LEAVE              = 202,
+    /** The host issued a "drop" event, meaning that the host is
+     *  ready to transfer data over to the guest. */
+    HOST_DND_HG_EVT_DROPPED            = 203,
+    /** The host requested to cancel the current DnD operation. */
+    HOST_DND_HG_EVT_CANCEL             = 204,
+    /** Gets the actual MIME data, based on
+     *  the format(s) specified by HOST_DND_HG_EVT_ENTER. If the guest
+     *  supplied buffer too small to send the actual data, the host
+     *  will send a HOST_DND_HG_SND_MORE_DATA message as follow-up. */
+    HOST_DND_HG_SND_DATA               = 205,
+    /** Sent when the actual buffer for HOST_DND_HG_SND_DATA
+     *  was too small, issued by the DnD host service. */
+    HOST_DND_HG_SND_MORE_DATA          = 206,
+    /** Directory entry to be sent to the guest. */
+    HOST_DND_HG_SND_DIR                = 207,
+    /** File data chunk to send to the guest. */
+    HOST_DND_HG_SND_FILE_DATA          = 208,
+    /** File header to send to the guest.
+     *  Note: Only for protocol version 2 and up (>= VBox 5.0). */
+    HOST_DND_HG_SND_FILE_HDR           = 209,
+
+    /*
+     * Guest -> Host messages
+     */
+
+    /** The host asks the guest whether a DnD operation
+     *  is in progress when the mouse leaves the guest window. */
+    HOST_DND_GH_REQ_PENDING            = 600,
+    /** The host informs the guest that a DnD drop operation
+     *  has been started and that the host wants the data in
+     *  a specific MIME type. */
+    HOST_DND_GH_EVT_DROPPED            = 601,
+    /** Creates a directory on the guest. */
+    HOST_DND_GH_RECV_DIR               = 650,
+    /** Retrieves file data from the guest. */
+    HOST_DND_GH_RECV_FILE_DATA         = 670,
+    /** Retrieves a file header from the guest.
+     *  Note: Only for protocol version 2 and up (>= VBox 5.0). */
+    HOST_DND_GH_RECV_FILE_HDR          = 671,
+    /** Blow the type up to 32-bit. */
+    HOST_DND_32BIT_HACK                = 0x7fffffff
 };
 
 /**
  * The service functions which are called by guest.
+ * Note: When adding new functions to this table, make sure that the actual ID
+ *       does *not* overlap with the eHostFn enumeration above!
  */
 enum eGuestFn
 {
+    /* Guest sends a connection request to the HGCM service.
+     * Note: New since protocol version 2. */
+    GUEST_DND_CONNECT                  = 10,
+
     /**
-     * Guest waits for a new message the host wants to process on the guest side.
-     * This is a blocking call and can be deferred.
+     * Guest waits for a new message the host wants to process
+     * on the guest side. This can be a blocking call.
      */
     GUEST_DND_GET_NEXT_HOST_MSG        = 300,
 
-    /* H->G */
+    /*
+     * Host -> Guest operation messages.
+     */
+
+    /** The guest acknowledges that the pending DnD data from
+     *  the host can be dropped on the currently selected source
+     *  on the guest. */
     GUEST_DND_HG_ACK_OP                = 400,
-    GUEST_DND_HG_REQ_DATA,
-    GUEST_DND_HG_EVT_PROGRESS,
+    /** The guest requests the actual DnD data to be sent
+     *  from the host. */
+    GUEST_DND_HG_REQ_DATA              = 401,
+    /** Reports back the guest's progress on a host -> guest operation. */
+    GUEST_DND_HG_EVT_PROGRESS          = 402,
+
+    /*
+     * Guest -> Host operation messages.
+     */
 
-    /* G->H */
+    /**
+     * The guests acknowledges that it currently has a drag'n drop
+     * operation in progress on the guest, which eventually could be
+     * dragged over to the host.
+     */
     GUEST_DND_GH_ACK_PENDING           = 500,
-    GUEST_DND_GH_SND_DATA,
-    GUEST_DND_GH_EVT_ERROR
+    /**
+     * Sends data of the requested format to the host. There can
+     * be more than one message if the actual data does not fit
+     * into one.
+     */
+    GUEST_DND_GH_SND_DATA              = 501,
+    /** Reports an error back to the host. */
+    GUEST_DND_GH_EVT_ERROR             = 502,
+    /** Guest sends a directory entry to the host. */
+    GUEST_DND_GH_SND_DIR               = 700,
+    /** Guest sends file data to the host. */
+    /*  Note: On protocol version 1 this also contains the file name
+     *        and other attributes. */
+    GUEST_DND_GH_SND_FILE_DATA         = 701,
+    /** Guest sends a file header to the host, marking the
+     *  beginning of a (new) file transfer.
+     *  Note: Available since protocol version 2 (VBox 5.0). */
+    GUEST_DND_GH_SND_FILE_HDR          = 702,
+    /** Blow the type up to 32-bit. */
+    GUEST_DND_32BIT_HACK               = 0x7fffffff
 };
 
 /**
- * The possible states for the progress operations.
+ * DnD operation progress states.
  */
-enum
+typedef enum DNDPROGRESS
 {
-    DND_PROGRESS_RUNNING = 1,
+    DND_PROGRESS_UNKNOWN               = 0,
+    DND_PROGRESS_RUNNING               = 1,
     DND_PROGRESS_COMPLETE,
     DND_PROGRESS_CANCELLED,
-    DND_PROGRESS_ERROR
-};
+    DND_PROGRESS_ERROR,
+    /** Blow the type up to 32-bit. */
+    DND_PROGRESS_32BIT_HACK            = 0x7fffffff
+} DNDPROGRESS, *PDNDPROGRESS;
 
 #pragma pack (1)
 
@@ -178,7 +284,7 @@ typedef struct VBOXDNDHGSENDDATAMSG
     HGCMFunctionParameter pvFormat;     /* OUT ptr */
     HGCMFunctionParameter cFormat;      /* OUT uint32_t */
     HGCMFunctionParameter pvData;       /* OUT ptr */
-    HGCMFunctionParameter cData;        /* OUT uint32_t */
+    HGCMFunctionParameter cbData;       /* OUT uint32_t */
 } VBOXDNDHGSENDDATAMSG;
 
 typedef struct VBOXDNDHGSENDMOREDATAMSG
@@ -192,7 +298,7 @@ typedef struct VBOXDNDHGSENDMOREDATAMSG
      * HOST_DND_HG_SND_MORE_DATA
      */
     HGCMFunctionParameter pvData;       /* OUT ptr */
-    HGCMFunctionParameter cData;        /* OUT uint32_t */
+    HGCMFunctionParameter cbData;       /* OUT uint32_t */
 } VBOXDNDHGSENDMOREDATAMSG;
 
 typedef struct VBOXDNDHGSENDDIRMSG
@@ -206,26 +312,72 @@ typedef struct VBOXDNDHGSENDDIRMSG
      * HOST_DND_HG_SND_DIR
      */
     HGCMFunctionParameter pvName;       /* OUT ptr */
-    HGCMFunctionParameter cName;        /* OUT uint32_t */
+    HGCMFunctionParameter cbName;       /* OUT uint32_t */
     HGCMFunctionParameter fMode;        /* OUT uint32_t */
 } VBOXDNDHGSENDDIRMSG;
 
-typedef struct VBOXDNDHGSENDFILEMSG
+/**
+ * File header event.
+ * Note: Only for protocol version 2 and up.
+ *
+ * Used by:
+ * HOST_DND_HG_SND_FILE_HDR
+ * HOST_DND_GH_SND_FILE_HDR
+ */
+typedef struct VBOXDNDHGSENDFILEHDRMSG
 {
     VBoxGuestHGCMCallInfo hdr;
 
-    /**
-     * HG File event.
-     *
-     * Used by:
-     * HOST_DND_HG_SND_FILE
-     */
+    /** Context ID. Unused at the moment. */
+    HGCMFunctionParameter uContext;     /* OUT uint32_t */
+    /** File path. */
     HGCMFunctionParameter pvName;       /* OUT ptr */
-    HGCMFunctionParameter cName;        /* OUT uint32_t */
-    HGCMFunctionParameter pvData;       /* OUT ptr */
-    HGCMFunctionParameter cData;        /* OUT uint32_t */
+    /** Size (in bytes) of file path. */
+    HGCMFunctionParameter cbName;       /* OUT uint32_t */
+    /** Optional flags; unused at the moment. */
+    HGCMFunctionParameter uFlags;       /* OUT uint32_t */
+    /** File creation mode. */
     HGCMFunctionParameter fMode;        /* OUT uint32_t */
-} VBOXDNDHGSENDFILEMSG;
+    /** Total size (in bytes). */
+    HGCMFunctionParameter cbTotal;      /* OUT uint64_t */
+
+} VBOXDNDHGSENDFILEHDRMSG;
+
+/**
+ * HG: File data (chunk) event.
+ *
+ * Used by:
+ * HOST_DND_HG_SND_FILE
+ */
+typedef struct VBOXDNDHGSENDFILEDATAMSG
+{
+    VBoxGuestHGCMCallInfo hdr;
+
+    union
+    {
+        /* Note: Protocol v1 sends the file name + file mode
+         *       every time a file data chunk is being sent. */
+        struct
+        {
+            HGCMFunctionParameter pvName;       /* OUT ptr */
+            HGCMFunctionParameter cbName;       /* OUT uint32_t */
+            HGCMFunctionParameter pvData;       /* OUT ptr */
+            HGCMFunctionParameter cbData;       /* OUT uint32_t */
+            HGCMFunctionParameter fMode;        /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Note: pvName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
+            /** Note: cbName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext;     /* OUT uint32_t */
+            HGCMFunctionParameter pvData;       /* OUT ptr */
+            HGCMFunctionParameter cbData;       /* OUT uint32_t */
+            /** Note: fMode is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
+        } v2;
+    } u;
+
+} VBOXDNDHGSENDFILEDATAMSG;
 
 typedef struct VBOXDNDGHREQPENDINGMSG
 {
@@ -259,169 +411,330 @@ typedef struct VBOXDNDGHDROPPEDMSG
  * Guest events
  */
 
+/**
+ * The returned command the host wants to
+ * run on the guest.
+ *
+ * Used by:
+ * GUEST_DND_GET_NEXT_HOST_MSG
+ */
 typedef struct VBOXDNDNEXTMSGMSG
 {
     VBoxGuestHGCMCallInfo hdr;
 
-    /**
-     * The returned command the host wants to
-     * run on the guest.
-     *
-     * Used by:
-     * GUEST_DND_GET_NEXT_HOST_MSG
-     */
     HGCMFunctionParameter msg;          /* OUT uint32_t */
     /** Number of parameters the message needs. */
     HGCMFunctionParameter num_parms;    /* OUT uint32_t */
+    /** Whether or not to block (wait) for a
+     *  new message to arrive. */
     HGCMFunctionParameter block;        /* OUT uint32_t */
 
 } VBOXDNDNEXTMSGMSG;
 
+/**
+ * Connection request. Used to tell the DnD protocol
+ * version to the (host) service.
+ *
+ * Used by:
+ * GUEST_DND_CONNECT
+ */
+typedef struct VBOXDNDCONNECTPMSG
+{
+    VBoxGuestHGCMCallInfo hdr;
+
+    /** Protocol version to use. */
+    HGCMFunctionParameter uProtocol;     /* OUT uint32_t */
+    /** Connection flags. Optional. */
+    HGCMFunctionParameter uFlags;        /* OUT uint32_t */
+
+} VBOXDNDCONNECTPMSG;
+
+/**
+ * HG Acknowledge Operation event.
+ *
+ * Used by:
+ * GUEST_DND_HG_ACK_OP
+ */
 typedef struct VBOXDNDHGACKOPMSG
 {
     VBoxGuestHGCMCallInfo hdr;
 
-    /**
-     * HG Acknowledge Operation event.
-     *
-     * Used by:
-     * GUEST_DND_HG_ACK_OP
-     */
     HGCMFunctionParameter uAction;      /* OUT uint32_t */
 } VBOXDNDHGACKOPMSG;
 
+/**
+ * HG request for data event.
+ *
+ * Used by:
+ * GUEST_DND_HG_REQ_DATA
+ */
 typedef struct VBOXDNDHGREQDATAMSG
 {
     VBoxGuestHGCMCallInfo hdr;
 
-    /**
-     * HG request for data event.
-     *
-     * Used by:
-     * GUEST_DND_HG_REQ_DATA
-     */
     HGCMFunctionParameter pFormat;      /* OUT ptr */
 } VBOXDNDHGREQDATAMSG;
 
+typedef struct VBOXDNDHGEVTPROGRESSMSG
+{
+    VBoxGuestHGCMCallInfo hdr;
+
+    HGCMFunctionParameter uStatus;
+    HGCMFunctionParameter uPercent;
+    HGCMFunctionParameter rc;
+} VBOXDNDHGEVTPROGRESSMSG;
+
+/**
+ * GH Acknowledge Pending event.
+ *
+ * Used by:
+ * GUEST_DND_GH_ACK_PENDING
+ */
 typedef struct VBOXDNDGHACKPENDINGMSG
 {
     VBoxGuestHGCMCallInfo hdr;
 
-    /**
-     * GH Acknowledge Pending event.
-     *
-     * Used by:
-     * GUEST_DND_GH_ACK_PENDING
-     */
     HGCMFunctionParameter uDefAction;   /* OUT uint32_t */
     HGCMFunctionParameter uAllActions;  /* OUT uint32_t */
     HGCMFunctionParameter pFormat;      /* OUT ptr */
 } VBOXDNDGHACKPENDINGMSG;
 
+/**
+ * GH Send Data event.
+ *
+ * Used by:
+ * GUEST_DND_GH_SND_DATA
+ */
 typedef struct VBOXDNDGHSENDDATAMSG
 {
     VBoxGuestHGCMCallInfo hdr;
 
-    /**
-     * GH Send Data event.
-     *
-     * Used by:
-     * GUEST_DND_GH_SND_DATA
-     */
-    HGCMFunctionParameter pData;        /* OUT ptr */
-    HGCMFunctionParameter uSize;        /* OUT uint32_t */
+    HGCMFunctionParameter pvData;       /* OUT ptr */
+    /** Total bytes to send. This can be more than
+     *  the data block specified in pvData above, e.g.
+     *  when sending over file objects afterwards. */
+    HGCMFunctionParameter cbTotalBytes; /* OUT uint32_t */
 } VBOXDNDGHSENDDATAMSG;
 
+/**
+ * GH Directory event.
+ *
+ * Used by:
+ * GUEST_DND_GH_SND_DIR
+ */
+typedef struct VBOXDNDGHSENDDIRMSG
+{
+    VBoxGuestHGCMCallInfo hdr;
+
+    HGCMFunctionParameter pvName;       /* OUT ptr */
+    HGCMFunctionParameter cbName;       /* OUT uint32_t */
+    HGCMFunctionParameter fMode;        /* OUT uint32_t */
+} VBOXDNDGHSENDDIRMSG;
+
+/**
+ * GH File header event.
+ * Note: Only for protocol version 2 and up.
+ *
+ * Used by:
+ * HOST_DND_GH_SND_FILE_HDR
+ */
+typedef struct VBOXDNDHGSENDFILEHDRMSG VBOXDNDGHSENDFILEHDRMSG;
+
+/**
+ * GH File data event.
+ *
+ * Used by:
+ * GUEST_DND_HG_SND_FILE_DATA
+ */
+typedef struct VBOXDNDGHSENDFILEDATAMSG
+{
+    VBoxGuestHGCMCallInfo hdr;
+
+    union
+    {
+        /* Note: Protocol v1 sends the file name + file mode
+         *       every time a file data chunk is being sent. */
+        struct
+        {
+            HGCMFunctionParameter pvName;   /* OUT ptr */
+            HGCMFunctionParameter cbName;   /* OUT uint32_t */
+            HGCMFunctionParameter fMode;    /* OUT uint32_t */
+            HGCMFunctionParameter pvData;   /* OUT ptr */
+            HGCMFunctionParameter cbData;   /* OUT uint32_t */
+        } v1;
+        struct
+        {
+            /** Note: pvName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
+            /** Note: cbName is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
+            /** Context ID. Unused at the moment. */
+            HGCMFunctionParameter uContext; /* OUT uint32_t */
+            HGCMFunctionParameter pvData;   /* OUT ptr */
+            HGCMFunctionParameter cbData;   /* OUT uint32_t */
+            /** Note: fMode is now part of the VBOXDNDHGSENDFILEHDRMSG message. */
+        } v2;
+    } u;
+
+} VBOXDNDGHSENDFILEDATAMSG;
+
+/**
+ * GH Error event.
+ *
+ * Used by:
+ * GUEST_DND_GH_EVT_ERROR
+ */
 typedef struct VBOXDNDGHEVTERRORMSG
 {
     VBoxGuestHGCMCallInfo hdr;
 
-    /**
-     * GH Cancel Data event.
-     *
-     * Used by:
-     * GUEST_DND_GH_EVT_CANCEL
-     */
-    HGCMFunctionParameter uRC;          /* OUT uint32_t */
+    HGCMFunctionParameter rc;               /* OUT uint32_t */
 } VBOXDNDGHEVTERRORMSG;
 
 #pragma pack()
 
 /*
- * Callback handler
+ * Callback data magics.
  */
 enum
 {
-    CB_MAGIC_DND_HG_ACK_OP       = 0xe2100b93,
-    CB_MAGIC_DND_HG_REQ_DATA     = 0x5cb3faf9,
-    CB_MAGIC_DND_HG_EVT_PROGRESS = 0x8c8a6956,
-    CB_MAGIC_DND_GH_ACK_PENDING  = 0xbe975a14,
-    CB_MAGIC_DND_GH_SND_DATA     = 0x4eb61bff,
-    CB_MAGIC_DND_GH_EVT_ERROR    = 0x117a87c4
+    CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG      = 0x19820126,
+    CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG_DATA = 0x19850630,
+    CB_MAGIC_DND_HG_ACK_OP                 = 0xe2100b93,
+    CB_MAGIC_DND_HG_REQ_DATA               = 0x5cb3faf9,
+    CB_MAGIC_DND_HG_EVT_PROGRESS           = 0x8c8a6956,
+    CB_MAGIC_DND_GH_ACK_PENDING            = 0xbe975a14,
+    CB_MAGIC_DND_GH_SND_DATA               = 0x4eb61bff,
+    CB_MAGIC_DND_GH_SND_DIR                = 0x411ca754,
+    CB_MAGIC_DND_GH_SND_FILE_HDR           = 0x65e35eaf,
+    CB_MAGIC_DND_GH_SND_FILE_DATA          = 0x19840804,
+    CB_MAGIC_DND_GH_EVT_ERROR              = 0x117a87c4
 };
 
 typedef struct VBOXDNDCBHEADERDATA
 {
     /** Magic number to identify the structure. */
-    uint32_t u32Magic;
+    uint32_t                    u32Magic;
     /** Context ID to identify callback data. */
-    uint32_t u32ContextID;
-} VBOXDNDCBHEADERDATA;
-typedef VBOXDNDCBHEADERDATA *PVBOXDNDCBHEADERDATA;
+    uint32_t                    u32ContextID;
+} VBOXDNDCBHEADERDATA, *PVBOXDNDCBHEADERDATA;
+
+typedef struct VBOXDNDCBHGGETNEXTHOSTMSG
+{
+    /** Callback data header. */
+    VBOXDNDCBHEADERDATA         hdr;
+    uint32_t                    uMsg;
+    uint32_t                    cParms;
+} VBOXDNDCBHGGETNEXTHOSTMSG, *PVBOXDNDCBHGGETNEXTHOSTMSG;
+
+typedef struct VBOXDNDCBHGGETNEXTHOSTMSGDATA
+{
+    /** Callback data header. */
+    VBOXDNDCBHEADERDATA         hdr;
+    uint32_t                    uMsg;
+    uint32_t                    cParms;
+    PVBOXHGCMSVCPARM            paParms;
+} VBOXDNDCBHGGETNEXTHOSTMSGDATA, *PVBOXDNDCBHGGETNEXTHOSTMSGDATA;
 
 typedef struct VBOXDNDCBHGACKOPDATA
 {
     /** Callback data header. */
-    VBOXDNDCBHEADERDATA hdr;
-    uint32_t uAction;
-} VBOXDNDCBHGACKOPDATA;
-typedef VBOXDNDCBHGACKOPDATA *PVBOXDNDCBHGACKOPDATA;
+    VBOXDNDCBHEADERDATA         hdr;
+    uint32_t                    uAction;
+} VBOXDNDCBHGACKOPDATA, *PVBOXDNDCBHGACKOPDATA;
 
 typedef struct VBOXDNDCBHGREQDATADATA
 {
     /** Callback data header. */
-    VBOXDNDCBHEADERDATA hdr;
-    char *pszFormat;
-} VBOXDNDCBHGREQDATADATA;
-typedef VBOXDNDCBHGREQDATADATA *PVBOXDNDCBHGREQDATADATA;
+    VBOXDNDCBHEADERDATA         hdr;
+    char                       *pszFormat;
+    uint32_t                    cbFormat;
+} VBOXDNDCBHGREQDATADATA, *PVBOXDNDCBHGREQDATADATA;
 
 typedef struct VBOXDNDCBHGEVTPROGRESSDATA
 {
     /** Callback data header. */
-    VBOXDNDCBHEADERDATA hdr;
-    uint32_t uPercentage;
-    uint32_t uState;
-} VBOXDNDCBHGEVTPROGRESSDATA;
-typedef VBOXDNDCBHGEVTPROGRESSDATA *PVBOXDNDCBHGEVTPROGRESSDATA ;
+    VBOXDNDCBHEADERDATA         hdr;
+    uint32_t                    uPercentage;
+    uint32_t                    uStatus;
+    uint32_t                    rc;
+} VBOXDNDCBHGEVTPROGRESSDATA, *PVBOXDNDCBHGEVTPROGRESSDATA;
 
 typedef struct VBOXDNDCBGHACKPENDINGDATA
 {
     /** Callback data header. */
-    VBOXDNDCBHEADERDATA hdr;
-    uint32_t  uDefAction;
-    uint32_t  uAllActions;
-    char     *pszFormat;
-} VBOXDNDCBGHACKPENDINGDATA;
-typedef VBOXDNDCBGHACKPENDINGDATA *PVBOXDNDCBGHACKPENDINGDATA;
+    VBOXDNDCBHEADERDATA         hdr;
+    uint32_t                    uDefAction;
+    uint32_t                    uAllActions;
+    char                       *pszFormat;
+    uint32_t                    cbFormat;
+} VBOXDNDCBGHACKPENDINGDATA, *PVBOXDNDCBGHACKPENDINGDATA;
 
 typedef struct VBOXDNDCBSNDDATADATA
 {
     /** Callback data header. */
-    VBOXDNDCBHEADERDATA hdr;
-    void     *pvData;
-    uint32_t  cbData;
-    uint32_t  cbAllSize;
-} VBOXDNDCBSNDDATADATA;
-typedef VBOXDNDCBSNDDATADATA *PVBOXDNDCBSNDDATADATA;
+    VBOXDNDCBHEADERDATA         hdr;
+    void                       *pvData;
+    uint32_t                    cbData;
+    /** Total metadata size (in bytes). This is transmitted
+     *  with every message because the size can change. */
+    uint32_t                    cbTotalSize;
+} VBOXDNDCBSNDDATADATA, *PVBOXDNDCBSNDDATADATA;
+
+typedef struct VBOXDNDCBSNDDIRDATA
+{
+    /** Callback data header. */
+    VBOXDNDCBHEADERDATA         hdr;
+    char                       *pszPath;
+    uint32_t                    cbPath;
+    uint32_t                    fMode;
+} VBOXDNDCBSNDDIRDATA, *PVBOXDNDCBSNDDIRDATA;
+
+/*  Note: Only for protocol version 2 and up (>= VBox 5.0). */
+typedef struct VBOXDNDCBSNDFILEHDRDATA
+{
+    /** Callback data header. */
+    VBOXDNDCBHEADERDATA         hdr;
+    /** File path (name). */
+    char                       *pszFilePath;
+    /** Size (in bytes) of file path. */
+    uint32_t                    cbFilePath;
+    /** Total size (in bytes) of this file. */
+    uint64_t                    cbSize;
+    /** File (creation) mode. */
+    uint32_t                    fMode;
+    /** Additional flags. Not used at the moment. */
+    uint32_t                    fFlags;
+} VBOXDNDCBSNDFILEHDRDATA, *PVBOXDNDCBSNDFILEHDRDATA;
+
+typedef struct VBOXDNDCBSNDFILEDATADATA
+{
+    /** Callback data header. */
+    VBOXDNDCBHEADERDATA         hdr;
+    /** Current file data chunk. */
+    void                       *pvData;
+    /** Size (in bytes) of current data chunk. */
+    uint32_t                    cbData;
+    union
+    {
+        struct
+        {
+            /** File path (name). */
+            char               *pszFilePath;
+            /** Size (in bytes) of file path. */
+            uint32_t            cbFilePath;
+            /** File (creation) mode. */
+            uint32_t            fMode;
+        } v1;
+        /* Note: Protocol version 2 has the file attributes (name, size,
+                 mode, ...) in the VBOXDNDCBSNDFILEHDRDATA structure. */
+    } u;
+} VBOXDNDCBSNDFILEDATADATA, *PVBOXDNDCBSNDFILEDATADATA;
 
 typedef struct VBOXDNDCBEVTERRORDATA
 {
     /** Callback data header. */
-    VBOXDNDCBHEADERDATA hdr;
-    int32_t  rc;
-} VBOXDNDCBEVTERRORDATA;
-typedef VBOXDNDCBEVTERRORDATA *PVBOXDNDCBEVTERRORDATA;
-
+    VBOXDNDCBHEADERDATA         hdr;
+    int32_t                     rc;
+} VBOXDNDCBEVTERRORDATA, *PVBOXDNDCBEVTERRORDATA;
 
 } /* namespace DragAndDropSvc */
 
diff --git a/include/VBox/HostServices/Service.h b/include/VBox/HostServices/Service.h
index a3c6385..6ac7385 100644
--- a/include/VBox/HostServices/Service.h
+++ b/include/VBox/HostServices/Service.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -43,13 +43,14 @@ class Message
     /* Contains a copy of HGCM parameters. */
 public:
     Message(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[])
-      : m_uMsg(0)
-      , m_cParms(0)
-      , m_paParms(0)
+        : m_uMsg(0)
+        , m_cParms(0)
+        , m_paParms(0)
     {
         initData(uMsg, cParms, aParms);
     }
-    ~Message()
+
+    virtual ~Message(void)
     {
         cleanup();
     }
@@ -89,6 +90,7 @@ public:
 
         return VINF_SUCCESS;
     }
+
     int getParmU64Info(uint32_t iParm, uint64_t *pu64Info) const
     {
         AssertPtrNullReturn(pu64Info, VERR_INVALID_PARAMETER);
@@ -99,6 +101,7 @@ public:
 
         return VINF_SUCCESS;
     }
+
     int getParmPtrInfo(uint32_t iParm, void **ppvAddr, uint32_t *pcSize) const
     {
         AssertPtrNullReturn(ppvAddr, VERR_INVALID_PARAMETER);
@@ -112,12 +115,13 @@ public:
         return VINF_SUCCESS;
     }
 
-    int copyParms(uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst) const
+    static int copyParms(uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst)
     {
         return copyParmsInternal(cParms, paParmsSrc, paParmsDst, false /* fCreatePtrs */);
     }
 
 private:
+
     uint32_t m_uMsg;
     uint32_t m_cParms;
     PVBOXHGCMSVCPARM m_paParms;
@@ -148,7 +152,7 @@ private:
         return rc;
     }
 
-    int copyParmsInternal(uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst, bool fCreatePtrs) const
+    static int copyParmsInternal(uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst, bool fCreatePtrs)
     {
         int rc = VINF_SUCCESS;
         for (uint32_t i = 0; i < cParms; ++i)
@@ -187,14 +191,24 @@ private:
                     {
                         /* No, but we have to check if there is enough room. */
                         if (paParmsDst[i].u.pointer.size < paParmsSrc[i].u.pointer.size)
+                        {
                             rc = VERR_BUFFER_OVERFLOW;
+                            break;
+                        }
+                    }
+
+                    if (paParmsSrc[i].u.pointer.size) 
+                    {
+                        if (   paParmsDst[i].u.pointer.addr
+                            && paParmsDst[i].u.pointer.size)
+                        {
+                            memcpy(paParmsDst[i].u.pointer.addr,
+                                   paParmsSrc[i].u.pointer.addr,
+                                   RT_MIN(paParmsDst[i].u.pointer.size, paParmsSrc[i].u.pointer.size));
+                        }
+                        else 
+                            rc = VERR_INVALID_POINTER;
                     }
-                    if (   paParmsDst[i].u.pointer.addr
-                        && paParmsSrc[i].u.pointer.size > 0
-                        && paParmsDst[i].u.pointer.size > 0)
-                        memcpy(paParmsDst[i].u.pointer.addr,
-                               paParmsSrc[i].u.pointer.addr,
-                               RT_MIN(paParmsDst[i].u.pointer.size, paParmsSrc[i].u.pointer.size));
                     break;
                 }
                 default:
@@ -235,16 +249,27 @@ private:
 class Client
 {
 public:
-    Client(uint32_t uClientId, VBOXHGCMCALLHANDLE hHandle, uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[])
+    Client(uint32_t uClientId, VBOXHGCMCALLHANDLE hHandle = NULL,
+           uint32_t uMsg = 0, uint32_t cParms = 0, VBOXHGCMSVCPARM aParms[] = NULL)
       : m_uClientId(uClientId)
+      , m_uProtocol(0)
       , m_hHandle(hHandle)
       , m_uMsg(uMsg)
       , m_cParms(cParms)
       , m_paParms(aParms) {}
 
-    VBOXHGCMCALLHANDLE handle() const { return m_hHandle; }
-    uint32_t message() const { return m_uMsg; }
-    uint32_t clientId() const { return m_uClientId; }
+public:
+
+    VBOXHGCMCALLHANDLE handle(void) const { return m_hHandle; }
+    uint32_t message(void) const { return m_uMsg; }
+    uint32_t clientId(void) const { return m_uClientId; }
+    uint32_t protocol(void) const { return m_uProtocol; }
+
+public:
+
+    int setProtocol(uint32_t uProtocol) { m_uProtocol = uProtocol; return VINF_SUCCESS; }
+
+public:
 
     int addMessageInfo(uint32_t uMsg, uint32_t cParms)
     {
@@ -258,6 +283,7 @@ public:
     }
     int addMessageInfo(const Message *pMessage)
     {
+        AssertPtrReturn(pMessage, VERR_INVALID_POINTER);
         if (m_cParms != 3)
             return VERR_INVALID_PARAMETER;
 
@@ -268,10 +294,15 @@ public:
     }
     int addMessage(const Message *pMessage)
     {
+        AssertPtrReturn(pMessage, VERR_INVALID_POINTER);
         return pMessage->getData(m_uMsg, m_cParms, m_paParms);
     }
+
 private:
+
     uint32_t m_uClientId;
+    /** Optional protocol version the client uses. */
+    uint32_t m_uProtocol;
     VBOXHGCMCALLHANDLE m_hHandle;
     uint32_t m_uMsg;
     uint32_t m_cParms;
diff --git a/include/VBox/HostServices/VBoxCrOpenGLSvc.h b/include/VBox/HostServices/VBoxCrOpenGLSvc.h
index a16635c..4edc460 100644
--- a/include/VBox/HostServices/VBoxCrOpenGLSvc.h
+++ b/include/VBox/HostServices/VBoxCrOpenGLSvc.h
@@ -50,6 +50,9 @@
 #define SHCRGL_HOST_FN_TAKE_SCREENSHOT (24)
 #define SHCRGL_HOST_FN_WINDOWS_SHOW (25)
 #define SHCRGL_HOST_FN_CTL          (26)
+#define SHCRGL_HOST_FN_SET_SCALE_FACTOR (27)
+#define SHCRGL_HOST_FN_SET_UNSCALED_HIDPI (28)
+
 /* crOpenGL guest functions */
 #define SHCRGL_GUEST_FN_WRITE       (2)
 #define SHCRGL_GUEST_FN_READ        (3)
@@ -409,4 +412,16 @@ typedef struct
     PFNCRSCREENSHOTEND pfnScreenshotEnd;
 } CRVBOXHGCMTAKESCREENSHOT;
 
+typedef struct
+{
+    uint32_t u32Screen;
+    uint32_t u32ScaleFactorWMultiplied;
+    uint32_t u32ScaleFactorHMultiplied;
+} CRVBOXHGCMSETSCALEFACTOR;
+
+typedef struct
+{
+    bool     fUnscaledHiDPI;
+} CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT;
+
 #endif
diff --git a/include/VBox/RemoteDesktop/VRDE.h b/include/VBox/RemoteDesktop/VRDE.h
index ba12986..7fd78c1 100644
--- a/include/VBox/RemoteDesktop/VRDE.h
+++ b/include/VBox/RemoteDesktop/VRDE.h
@@ -93,7 +93,7 @@ typedef uint32_t VRDEAUDIOFORMAT;
 typedef struct VRDEAUDIOINBEGIN
 {
     VRDEAUDIOFORMAT fmt; /* Actual format of data, which will be sent in VRDE_AUDIOIN_DATA events. */
-} VRDEAUDIOINBEGIN;
+} VRDEAUDIOINBEGIN, *PVRDEAUDIOINBEGIN;
 
 
 /*
@@ -632,10 +632,10 @@ typedef struct _VRDEUSBREQNEGOTIATERET_3
 
 
 /** Hints what has been intercepted by the application. */
-#define VRDE_CLIENT_INTERCEPT_AUDIO     (0x1)
-#define VRDE_CLIENT_INTERCEPT_USB       (0x2)
-#define VRDE_CLIENT_INTERCEPT_CLIPBOARD (0x4)
-#define VRDE_CLIENT_INTERCEPT_AUDIO_INPUT (0x8)
+#define VRDE_CLIENT_INTERCEPT_AUDIO       RT_BIT(0)
+#define VRDE_CLIENT_INTERCEPT_USB         RT_BIT(1)
+#define VRDE_CLIENT_INTERCEPT_CLIPBOARD   RT_BIT(2)
+#define VRDE_CLIENT_INTERCEPT_AUDIO_INPUT RT_BIT(3)
 
 
 /** The version of the VRDE server interface. */
diff --git a/include/VBox/VBoxGuest.h b/include/VBox/VBoxGuest.h
index 5797365..d355f00 100644
--- a/include/VBox/VBoxGuest.h
+++ b/include/VBox/VBoxGuest.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -39,7 +39,7 @@
  * @{
  */
 
-/** @todo it would be nice if we could have two define without paths. */
+/** @todo It would be nice if we could have two defines without paths. */
 
 /** @def VBOXGUEST_DEVICE_NAME
  * The support device name. */
@@ -80,10 +80,11 @@
 
 #ifdef RT_OS_DARWIN
 /** Cookie used to fend off some unwanted clients to the IOService. */
-#define VBOXGUEST_DARWIN_IOSERVICE_COOKIE   0x56426F78 /* 'VBox' */
+# define VBOXGUEST_DARWIN_IOSERVICE_COOKIE      UINT32_C(0x56426f78) /* 'VBox' */
 #endif
 
 #if !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT)
+
 /** @name VBoxGuest IOCTL codes and structures.
  *
  * The range 0..15 is for basic driver communication.
@@ -359,7 +360,8 @@ AssertCompileSize(VBoxGuestWriteCoreDump, 4);
 # ifdef RT_ARCH_AMD64
 /** @name IOCTL numbers that 32-bit clients, like the Windows OpenGL guest
  *        driver, will use when taking to a 64-bit driver.
- * @remarks These are only used by the driver implementation! */
+ * @remarks These are only used by the driver implementation!
+ * @{*/
 #  define VBOXGUEST_IOCTL_HGCM_CONNECT_32           VBOXGUEST_IOCTL_CODE_32(16, sizeof(VBoxGuestHGCMConnectInfo))
 #  define VBOXGUEST_IOCTL_HGCM_DISCONNECT_32        VBOXGUEST_IOCTL_CODE_32(17, sizeof(VBoxGuestHGCMDisconnectInfo))
 #  define VBOXGUEST_IOCTL_HGCM_CALL_32(Size)        VBOXGUEST_IOCTL_CODE_32(18, (Size))
@@ -535,8 +537,8 @@ typedef VBOXGUESTOS2IDCCONNECT *PVBOXGUESTOS2IDCCONNECT;
 /** Stop using HGSMI in the kernel driver until it is re-enabled, so that a
  *  user-space driver can use it.  It must be re-enabled before the kernel
  *  driver can be used again in a sensible way. */
-/** @note These are only implemented on Linux currently and should fail
- *        silently on other platforms. */
+/** @note These IOCtls was removed from the code, but are left here as
+ * templates as we may need similar ones in future. */
 # define DRM_VBOX_DISABLE_HGSMI    0
 # define DRM_IOCTL_VBOX_DISABLE_HGSMI    VBOX_DRM_IOCTL(DISABLE_HGSMI)
 # define VBOXVIDEO_IOCTL_DISABLE_HGSMI   _IO('d', DRM_IOCTL_VBOX_DISABLE_HGSMI)
@@ -547,8 +549,9 @@ typedef VBOXGUESTOS2IDCCONNECT *PVBOXGUESTOS2IDCCONNECT;
 
 #endif /* RT_OS_LINUX || RT_OS_SOLARIS || RT_OS_FREEBSD */
 
-/** @} */
 #endif /* !defined(IN_RC) && !defined(IN_RING0_AGNOSTIC) && !defined(IPRT_NO_CRT) */
 
+/** @} */
+
 #endif
 
diff --git a/include/VBox/VBoxGuestLib.h b/include/VBox/VBoxGuestLib.h
index bd1ade6..1d3dda2 100644
--- a/include/VBox/VBoxGuestLib.h
+++ b/include/VBox/VBoxGuestLib.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -78,7 +78,6 @@
 
 RT_C_DECLS_BEGIN
 
-
 /** @defgroup grp_guest_lib_r0     Ring-0 interface.
  * @{
  */
@@ -480,6 +479,14 @@ VBGLR3DECL(int)     VbglR3SetPointerShapeReq(struct VMMDevReqMousePointer *pReq)
 
 /** @name Display
  * @{ */
+/** The folder for the video mode hint unix domain socket on Unix-like guests.
+ */
+/** @note This can be safely changed as all users are rebuilt in lock-step. */
+#define VBGLR3HOSTDISPSOCKETPATH "/tmp/.VBoxService"
+/** The path to the video mode hint unix domain socket on Unix-like guests. */
+#define VBGLR3HOSTDISPSOCKET     VBGLR3VIDEOMODEHINTSOCKETPATH \
+    "/VideoModeHint"
+
 /** The folder for saving video mode hints to between sessions. */
 #define VBGLR3HOSTDISPSAVEDMODEPATH "/var/lib/VBoxGuestAdditions"
 /** The path to the file for saving video mode hints to between sessions. */
@@ -598,7 +605,7 @@ VBGLR3DECL(int)     VbglR3SharedFolderGetMountDir(char **ppszDir);
 /**
  * Structure containing the context required for
  * either retrieving or sending a HGCM guest control
- * command from or to the host.
+ * commands from or to the host.
  *
  * Note: Do not change parameter order without also
  *       adapting all structure initializers.
@@ -705,44 +712,64 @@ VBGLR3DECL(int)     VbglR3PageIsShared(RTGCPTR pPage, bool *pfShared, uint64_t *
 # ifdef VBOX_WITH_DRAG_AND_DROP
 /** @name Drag and Drop
  * @{ */
+/**
+ * Structure containing the context required for
+ * either retrieving or sending a HGCM guest drag'n drop
+ * commands from or to the host.
+ *
+ * Note: Do not change parameter order without also
+ *       adapting all structure initializers.
+ */
+typedef struct VBGLR3GUESTDNDCMDCTX
+{
+    /** @todo This struct could be handy if we want to implement
+     *        a second communication channel, e.g. via TCP/IP.
+     *        Use a union for the HGCM stuff then. */
+
+    /** IN: HGCM client ID to use for communication. */
+    uint32_t uClientID;
+    /** IN: Protocol version to use. */
+    uint32_t uProtocol;
+    /** OUT: Number of parameters retrieved. */
+    uint32_t uNumParms;
+} VBGLR3GUESTDNDCMDCTX, *PVBGLR3GUESTDNDCMDCTX;
+
 typedef struct VBGLR3DNDHGCMEVENT
 {
-    uint32_t uType;               /** The event type this struct contains */
-    uint32_t uScreenId;           /** Screen id this request belongs to */
-    char    *pszFormats;          /** Format list (\r\n separated) */
-    uint32_t cbFormats;           /** Size of pszFormats (\0 included) */
+    uint32_t uType;               /** The event type this struct contains. */
+    uint32_t uScreenId;           /** Screen ID this request belongs to. */
+    char    *pszFormats;          /** Format list (\r\n separated). */
+    uint32_t cbFormats;           /** Size of pszFormats (\0 included). */
     union
     {
         struct
         {
-            uint32_t uXpos;       /** X position of guest screen */
-            uint32_t uYpos;       /** Y position of guest screen */
-            uint32_t uDefAction;  /** Proposed DnD action */
-            uint32_t uAllActions; /** Allowed DnD actions */
-        }a; /** Values used in init, move and drop event type */
+            uint32_t uXpos;       /** X position of guest screen. */
+            uint32_t uYpos;       /** Y position of guest screen. */
+            uint32_t uDefAction;  /** Proposed DnD action. */
+            uint32_t uAllActions; /** Allowed DnD actions. */
+        } a; /** Values used in init, move and drop event type. */
         struct
         {
-            void    *pvData;      /** Data request */
-            size_t   cbData;      /** Size of pvData */
-        }b; /** Values used in drop data event type */
-    }u;
+            void    *pvData;      /** Data request. */
+            size_t   cbData;      /** Size of pvData. */
+        } b; /** Values used in drop data event type. */
+    } u;
 } VBGLR3DNDHGCMEVENT;
 typedef VBGLR3DNDHGCMEVENT *PVBGLR3DNDHGCMEVENT;
 typedef const PVBGLR3DNDHGCMEVENT CPVBGLR3DNDHGCMEVENT;
-VBGLR3DECL(int)     VbglR3DnDInit(void);
-VBGLR3DECL(int)     VbglR3DnDTerm(void);
-
-VBGLR3DECL(int)     VbglR3DnDConnect(uint32_t *pu32ClientId);
-VBGLR3DECL(int)     VbglR3DnDDisconnect(uint32_t u32ClientId);
+VBGLR3DECL(int)     VbglR3DnDConnect(PVBGLR3GUESTDNDCMDCTX pCtx);
+VBGLR3DECL(int)     VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx);
 
-VBGLR3DECL(int)     VbglR3DnDProcessNextMessage(CPVBGLR3DNDHGCMEVENT pEvent);
+VBGLR3DECL(int)     VbglR3DnDProcessNextMessage(PVBGLR3GUESTDNDCMDCTX pCtx, CPVBGLR3DNDHGCMEVENT pEvent);
 
-VBGLR3DECL(int)     VbglR3DnDHGAcknowledgeOperation(uint32_t uAction);
-VBGLR3DECL(int)     VbglR3DnDHGRequestData(const char* pcszFormat);
+VBGLR3DECL(int)     VbglR3DnDHGAcknowledgeOperation(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uAction);
+VBGLR3DECL(int)     VbglR3DnDHGRequestData(PVBGLR3GUESTDNDCMDCTX pCtx, const char* pcszFormat);
+VBGLR3DECL(int)     VbglR3DnDHGSetProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr);
 #  ifdef VBOX_WITH_DRAG_AND_DROP_GH
-VBGLR3DECL(int)     VbglR3DnDGHAcknowledgePending(uint32_t uDefAction, uint32_t uAllActions, const char* pcszFormat);
-VBGLR3DECL(int)     VbglR3DnDGHSendData(void *pvData, uint32_t cbData);
-VBGLR3DECL(int)     VbglR3DnDGHErrorEvent(int rcOp);
+VBGLR3DECL(int)     VbglR3DnDGHAcknowledgePending(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uDefAction, uint32_t uAllActions, const char* pcszFormats);
+VBGLR3DECL(int)     VbglR3DnDGHSendData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat, void *pvData, uint32_t cbData);
+VBGLR3DECL(int)     VbglR3DnDGHSendError(PVBGLR3GUESTDNDCMDCTX pCtx, int rcOp);
 #  endif /* VBOX_WITH_DRAG_AND_DROP_GH */
 /** @} */
 # endif /* VBOX_WITH_DRAG_AND_DROP */
diff --git a/include/VBox/VBoxNetCfg-win.h b/include/VBox/VBoxNetCfg-win.h
index 3bf0664..5b35d3c 100644
--- a/include/VBox/VBoxNetCfg-win.h
+++ b/include/VBox/VBoxNetCfg-win.h
@@ -64,13 +64,15 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetComponentByGuid(IN INetCfg *pNc, IN
 
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltInstall(IN INetCfg *pNc, IN LPCWSTR const * apInfFullPaths, IN UINT cInfFullPaths);
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltUninstall(IN INetCfg *pNc);
+VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetLwfInstall(IN INetCfg *pNc, IN LPCWSTR const pInfFullPath);
+VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetLwfUninstall(IN INetCfg *pNc);
 
-VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetAdpUninstall(IN INetCfg *pNc);
+VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetAdpUninstall(IN INetCfg *pNc, IN LPCWSTR pwszId);
 
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinCreateHostOnlyNetworkInterface(IN LPCWSTR pInfPath, IN bool bIsInfPathFile,
                                                                         OUT GUID *pGuid, OUT BSTR *lppszName,
                                                                         OUT BSTR *pErrMsg);
-VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinUpdateHostOnlyNetworkInterface(LPCWSTR pcsxwInf, BOOL *pbRebootRequired);
+VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinUpdateHostOnlyNetworkInterface(LPCWSTR pcsxwInf, BOOL *pbRebootRequired, LPCWSTR pcsxwId);
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveHostOnlyNetworkInterface(IN const GUID *pGUID, OUT BSTR *pErrMsg);
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveAllNetDevicesOfId(IN LPCWSTR lpszPnPId);
 
diff --git a/include/VBox/VBoxOGL.h b/include/VBox/VBoxOGL.h
new file mode 100644
index 0000000..996c67c
--- /dev/null
+++ b/include/VBox/VBoxOGL.h
@@ -0,0 +1,56 @@
+/* $Id: VBoxOGL.h $ */
+/** @file
+ * VBox 3D Support API
+ */
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+#ifndef ___VBoxOGL_h
+#define ___VBoxOGL_h
+
+#include <iprt/cdefs.h>
+#include <iprt/types.h>
+
+RT_C_DECLS_BEGIN
+
+/* GUI and VBox OpenGL code require scaling factor value to be stored in container
+ * of type of 'double'. Communication between them is done via Main. In the same time,
+ * currently, Main does not like type of 'double' to be used for an interface method parameter.
+ * An integer type should be used instead. This value is used in order to specify scaling factor in type
+ * of 'integer' units. It is assumed that GUI feeds Main with its internal scaling factor value
+ * (which is originally of type of 'double') multiplied by this constant and converted resulting
+ * value to type of 'uint32_t'. Then Main provides this data to OpenGL HGCM thread. Finally, VBox OpenGL
+ * code divides received scalar by this constant and converts result to type of 'double'.
+ * This constant can be increased (multiplied by 10^n) in order to get better precision
+ * for scaling factor manipulations. */
+#define VBOX_OGL_SCALE_FACTOR_MULTIPLIER    10000.0
+
+/* 3D content scale factor range bounds. */
+#define VBOX_OGL_SCALE_FACTOR_MIN           0.01
+#define VBOX_OGL_SCALE_FACTOR_MAX           10.0
+
+bool RTCALL VBoxOglIsOfflineRenderingAppropriate(void);
+bool RTCALL VBoxOglIs3DAccelerationSupported(void);
+
+DECLEXPORT(int) VBoxOglSetScaleFactor(uint32_t idScreen, double dScaleFactorW, double dScaleFactorH);
+
+RT_C_DECLS_END
+
+#endif /* !___VBoxOGL_h */
diff --git a/include/VBox/VBoxOGLTest.h b/include/VBox/VBoxOGLTest.h
deleted file mode 100644
index 1414173..0000000
--- a/include/VBox/VBoxOGLTest.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* $Id: VBoxOGLTest.h $ */
-/** @file
- * VBox 3D Support test API
- */
-/*
- * Copyright (C) 2012-2014 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-#ifndef ___VBoxOGLTest_h__
-#define ___VBoxOGLTest_h__
-
-#include <iprt/cdefs.h>
-
-RT_C_DECLS_BEGIN
-
-bool RTCALL VBoxOglIsOfflineRenderingAppropriate();
-bool RTCALL VBoxOglIs3DAccelerationSupported();
-
-RT_C_DECLS_END
-
-#endif /*#ifndef ___VBoxOGLTest_h__*/
diff --git a/include/VBox/VBoxTpG.h b/include/VBox/VBoxTpG.h
index 4d23dd3..de55d19 100644
--- a/include/VBox/VBoxTpG.h
+++ b/include/VBox/VBoxTpG.h
@@ -163,6 +163,8 @@ typedef uint32_t VTGSTROFF;
 #define VTG_TYPE_CTX_POINTER    RT_BIT_32(10)
 /** The type has the same size as the host architecture. */
 #define VTG_TYPE_HC_ARCH_SIZED  RT_BIT_32(11)
+/** Const char pointer, requires casting in wrapper headers. */
+#define VTG_TYPE_CONST_CHAR_PTR RT_BIT_32(12)
 /** The type applies to ring-3 context. */
 #define VTG_TYPE_CTX_R3         RT_BIT_32(24)
 /** The type applies to ring-0 context. */
diff --git a/include/VBox/VBoxVideo3D.h b/include/VBox/VBoxVideo3D.h
index 56196dc..c662e5e 100644
--- a/include/VBox/VBoxVideo3D.h
+++ b/include/VBox/VBoxVideo3D.h
@@ -137,8 +137,9 @@ struct VBOXTLSREFDATA_DUMMY
 
 
 /* host 3D->Fe[/Qt] notification mechanism defines */
-#define VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA  2
 #define VBOX3D_NOTIFY_EVENT_TYPE_TEST_FUNCTIONAL 3
+#define VBOX3D_NOTIFY_EVENT_TYPE_3DDATA_VISIBLE  4
+#define VBOX3D_NOTIFY_EVENT_TYPE_3DDATA_HIDDEN   5
 
 
 #endif /* #ifndef ___VBox_VBoxVideo3D_h */
diff --git a/include/VBox/VBoxVideoGuest.h b/include/VBox/VBoxVideoGuest.h
index d8ef0d6..997eb47 100644
--- a/include/VBox/VBoxVideoGuest.h
+++ b/include/VBox/VBoxVideoGuest.h
@@ -228,7 +228,8 @@ RTDECL(int)      VBoxHGSMISendCapsInfo(PHGSMIGUESTCOMMANDCONTEXT pCtx,
 RTDECL(int)      VBoxHGSMISetupGuestContext(PHGSMIGUESTCOMMANDCONTEXT pCtx,
                                             void *pvGuestHeapMemory,
                                             uint32_t cbGuestHeapMemory,
-                                            uint32_t offVRAMGuestHeapMemory);
+                                            uint32_t offVRAMGuestHeapMemory,
+                                            const HGSMIENV *pEnv);
 RTDECL(void)     VBoxHGSMIGetHostAreaMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx,
                                              uint32_t cbVRAM,
                                              uint32_t offVRAMBaseMapping,
diff --git a/include/VBox/VMMDev.h b/include/VBox/VMMDev.h
index b5576a7..7e62ce8 100644
--- a/include/VBox/VMMDev.h
+++ b/include/VBox/VMMDev.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -211,6 +211,8 @@ typedef enum
     VMMDevReq_DebugIsPageShared          = 216,
     VMMDevReq_GetSessionId               = 217, /* since version 3.2.8 */
     VMMDevReq_WriteCoreDump              = 218,
+    VMMDevReq_GuestHeartbeat             = 219,
+    VMMDevReq_HeartbeatConfigure         = 220,
     VMMDevReq_SizeHack                   = 0x7fffffff
 } VMMDevRequestType;
 
@@ -1494,6 +1496,19 @@ typedef struct
 } VMMDevReqWriteCoreDump;
 AssertCompileSize(VMMDevReqWriteCoreDump, 24+4);
 
+/** Heart beat check state structure.
+ *  Used by VMMDevReq_HeartbeatConfigure. */
+typedef struct
+{
+    /** Header. */
+    VMMDevRequestHeader header;
+    /** OUT: Guest heartbeat interval in nanosec. */
+    uint64_t    cNsInterval;
+    /** Heartbeat check flag. */
+    bool fEnabled;
+} VMMDevReqHeartbeat;
+AssertCompileSize(VMMDevReqHeartbeat, 24+12);
+
 
 
 #ifdef VBOX_WITH_HGCM
@@ -2013,6 +2028,10 @@ DECLINLINE(size_t) vmmdevGetRequestSize(VMMDevRequestType requestType)
             return sizeof(VMMDevPageIsSharedRequest);
         case VMMDevReq_GetSessionId:
             return sizeof(VMMDevReqSessionId);
+        case VMMDevReq_HeartbeatConfigure:
+            return sizeof(VMMDevReqHeartbeat);
+        case VMMDevReq_GuestHeartbeat:
+            return sizeof(VMMDevRequestHeader);
         default:
             break;
     }
diff --git a/include/VBox/apic.h b/include/VBox/apic.h
index 815c622..6f0bca5 100644
--- a/include/VBox/apic.h
+++ b/include/VBox/apic.h
@@ -41,6 +41,10 @@
 #define APIC_REG_LVT_PC                         0x0340
 #define APIC_REG_LVT_THMR                       0x0330
 #define APIC_REG_LVT_CMCI                       0x02F0
+#define APIC_REG_EILVT0                         0x0500
+#define APIC_REG_EILVT1                         0x0510
+#define APIC_REG_EILVT2                         0x0520
+#define APIC_REG_EILVT3                         0x0530
 #define APIC_REG_LVT_MODE_MASK                  (RT_BIT(8) | RT_BIT(9) | RT_BIT(10))
 #define APIC_REG_LVT_MODE_FIXED                 0
 #define APIC_REG_LVT_MODE_NMI                   RT_BIT(10)
diff --git a/include/VBox/apic.mac b/include/VBox/apic.mac
index c8b4408..f8102f5 100644
--- a/include/VBox/apic.mac
+++ b/include/VBox/apic.mac
@@ -9,6 +9,10 @@
 %define APIC_REG_LVT_PC                         0x0340
 %define APIC_REG_LVT_THMR                       0x0330
 %define APIC_REG_LVT_CMCI                       0x02F0
+%define APIC_REG_EILVT0                         0x0500
+%define APIC_REG_EILVT1                         0x0510
+%define APIC_REG_EILVT2                         0x0520
+%define APIC_REG_EILVT3                         0x0530
 %define APIC_REG_LVT_MODE_MASK                  (RT_BIT(8) | RT_BIT(9) | RT_BIT(10))
 %define APIC_REG_LVT_MODE_FIXED                 0
 %define APIC_REG_LVT_MODE_NMI                   RT_BIT(10)
diff --git a/include/VBox/com/ErrorInfo.h b/include/VBox/com/ErrorInfo.h
index 869b998..9ccf5cf 100644
--- a/include/VBox/com/ErrorInfo.h
+++ b/include/VBox/com/ErrorInfo.h
@@ -31,8 +31,8 @@
 #include "VBox/com/Guid.h"
 #include "VBox/com/assert.h"
 
-struct IProgress;
-struct IVirtualBoxErrorInfo;
+COM_STRUCT_OR_CLASS(IProgress);
+COM_STRUCT_OR_CLASS(IVirtualBoxErrorInfo);
 
 namespace com
 {
diff --git a/include/VBox/com/Guid.h b/include/VBox/com/Guid.h
index 969780b..fcf91f9 100644
--- a/include/VBox/com/Guid.h
+++ b/include/VBox/com/Guid.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -35,10 +35,6 @@
 # define __STDC_CONSTANT_MACROS
 #endif
 
-#if defined(VBOX_WITH_XPCOM)
-# include <nsMemory.h>
-#endif
-
 #include "VBox/com/string.h"
 
 #include <iprt/uuid.h>
@@ -47,12 +43,12 @@
 namespace com
 {
 
-typedef enum
-    {
-        ZERO_GUID,
-        NORMAL_GUID,
-        INVALID_GUID
-    }GuidState_t;
+typedef enum GuidState_t
+{
+    GUID_ZERO,
+    GUID_NORMAL,
+    GUID_INVALID
+} GuidState_t;
 
 /**
  *  Helper class that represents the UUID type and hides platform-specific
@@ -65,156 +61,205 @@ public:
     Guid()
     {
         ::RTUuidClear(&mUuid);
-        refresh();
-        mGuidState = ZERO_GUID;
+        mGuidState = GUID_ZERO;
+        dbg_refresh();
     }
 
     Guid(const Guid &that)
     {
         mUuid = that.mUuid;
-        refresh();
-        if (isEmpty())
-            mGuidState = ZERO_GUID;
-        else
-            mGuidState = NORMAL_GUID;
+        mGuidState = that.mGuidState;
+        dbg_refresh();
     }
 
     Guid(const RTUUID &that)
     {
+        mGuidState = GUID_NORMAL;
         mUuid = that;
-        refresh();
-        if (isEmpty())
-            mGuidState = ZERO_GUID;
-        else
-            mGuidState = NORMAL_GUID;
+        if (isZero())
+            mGuidState = GUID_ZERO;
+        dbg_refresh();
     }
 
     Guid(const GUID &that)
     {
         AssertCompileSize(GUID, sizeof(RTUUID));
         ::memcpy(&mUuid, &that, sizeof(GUID));
-        refresh();
-        if (isEmpty())
-            mGuidState = ZERO_GUID;
-        else
-            mGuidState = NORMAL_GUID;
+        mGuidState = GUID_NORMAL;
+        if (isZero())
+            mGuidState = GUID_ZERO;
+        dbg_refresh();
     }
 
     /**
      * Construct a GUID from a string.
      *
-     * Should the string be invalid, the object will be set to the null GUID
-     * (isEmpty() == true).
-     *
-     * @param   that        The UUID string.  We feed this to RTUuidFromStr(),
-     *                      so check it out for the exact format.
+     * @param   that        The UUID string. Can be with or without the curly
+     *                      brackets. Empty strings are translated to a zero
+     *                      GUID, and strings which are not confirming to
+     *                      valid GUID string representations are marked as
+     *                      invalid.
      */
     Guid(const char *that)
     {
-        mGuidState = NORMAL_GUID;
-
-        int rc = ::RTUuidFromStr(&mUuid, that);
-
-        if (RT_FAILURE(rc))
-        {
-            ::RTUuidClear(&mUuid);
-            mGuidState = INVALID_GUID;
-        }
-        else if(isEmpty())
-            mGuidState = ZERO_GUID;
-        refresh();
+        initString(that);
     }
 
     /**
      * Construct a GUID from a BSTR.
      *
-     * Should the string be empty or invalid, the object will be set to the
-     * null GUID (isEmpty() == true).
+     * @param   that        The UUID BSTR. Can be with or without the curly
+     *                      brackets. Empty strings are translated to a zero
+     *                      GUID, and strings which are not confirming to
+     *                      valid GUID string representations are marked as
+     *                      invalid.
+     */
+    Guid(CBSTR that)
+    {
+        initBSTR(that);
+    }
+
+    /**
+     * Construct a GUID from a Utf8Str.
      *
-     * @param   that        The UUID BSTR.  We feed this to RTUuidFromUtf16(),
-     *                      so check it out for the exact format.
+     * @param   that        The UUID Utf8Str. Can be with or without the curly
+     *                      brackets. Empty strings are translated to a zero
+     *                      GUID, and strings which are not confirming to
+     *                      valid GUID string representations are marked as
      */
-    Guid(const Bstr &that)
+    Guid(const Utf8Str &that)
     {
-        mGuidState = NORMAL_GUID;
+        initString(that.c_str());
+    }
 
-        if (that.isEmpty())
-        {
-            ::RTUuidClear(&mUuid);
-            mGuidState = ZERO_GUID;
-        }
-        else
-        {
-            int rc = ::RTUuidFromUtf16(&mUuid, that.raw());
-            if (RT_FAILURE(rc))
-            {
-                ::RTUuidClear(&mUuid);
-                mGuidState = INVALID_GUID;
-            }
-        }
+    /**
+     * Construct a GUID from a RTCString.
+     *
+     * @param   that        The UUID RTCString. Can be with or without the curly
+     *                      brackets. Empty strings are translated to a zero
+     *                      GUID, and strings which are not confirming to
+     *                      valid GUID string representations are marked as
+     */
+    Guid(const RTCString &that)
+    {
+        initString(that.c_str());
+    }
 
-        refresh();
+    /**
+     * Construct a GUID from a Bstr.
+     *
+     * @param   that        The UUID Bstr. Can be with or without the curly
+     *                      brackets. Empty strings are translated to a zero
+     *                      GUID, and strings which are not confirming to
+     *                      valid GUID string representations are marked as
+     */
+    Guid(const Bstr &that)
+    {
+        initBSTR(that.raw());
     }
 
     Guid& operator=(const Guid &that)
     {
-        mGuidState = NORMAL_GUID;
-        ::memcpy(&mUuid, &that.mUuid, sizeof (RTUUID));
-        if (isEmpty())
-            mGuidState = ZERO_GUID;
-        refresh();
+        mUuid = that.mUuid;
+        mGuidState = that.mGuidState;
+        dbg_refresh();
         return *this;
     }
-    Guid& operator=(const GUID &guid)
+
+    Guid& operator=(const RTUUID &guid)
     {
-        mGuidState = NORMAL_GUID;
-        ::memcpy(&mUuid, &guid, sizeof (GUID));
-        if (isEmpty())
-            mGuidState = ZERO_GUID;
-        refresh();
+        mUuid = guid;
+        mGuidState = GUID_NORMAL;
+        if (isZero())
+            mGuidState = GUID_ZERO;
+        dbg_refresh();
         return *this;
     }
-    Guid& operator=(const RTUUID &guid)
+
+    Guid& operator=(const GUID &guid)
     {
-        mGuidState = NORMAL_GUID;
-        ::memcpy(&mUuid, &guid, sizeof (RTUUID));
-        if (isEmpty())
-            mGuidState = ZERO_GUID;
-        refresh();
+        AssertCompileSize(GUID, sizeof(RTUUID));
+        ::memcpy(&mUuid, &guid, sizeof(GUID));
+        mGuidState = GUID_NORMAL;
+        if (isZero())
+            mGuidState = GUID_ZERO;
+        dbg_refresh();
         return *this;
     }
+
     Guid& operator=(const char *str)
     {
-        mGuidState = NORMAL_GUID;
-        int rc = ::RTUuidFromStr(&mUuid, str);
+        if (!str || !*str)
+        {
+            ::RTUuidClear(&mUuid);
+            mGuidState = GUID_ZERO;
+        }
+        else
+        {
+            mGuidState = GUID_NORMAL;
+            int rc = ::RTUuidFromStr(&mUuid, str);
+            if (RT_FAILURE(rc))
+            {
+                ::RTUuidClear(&mUuid);
+                mGuidState = GUID_INVALID;
+            }
+            else if (isZero())
+                mGuidState = GUID_ZERO;
+        }
+        dbg_refresh();
+        return *this;
+    }
 
-        if (RT_FAILURE(rc))
+    Guid& operator=(CBSTR str)
+    {
+        if (!str || !*str)
         {
             ::RTUuidClear(&mUuid);
-            mGuidState = INVALID_GUID;
+            mGuidState = GUID_ZERO;
         }
         else
         {
-            if (isEmpty())
-            mGuidState = ZERO_GUID;
+            mGuidState = GUID_NORMAL;
+            int rc = ::RTUuidFromUtf16(&mUuid, str);
+            if (RT_FAILURE(rc))
+            {
+                ::RTUuidClear(&mUuid);
+                mGuidState = GUID_INVALID;
+            }
+            else if (isZero())
+                mGuidState = GUID_ZERO;
         }
+        dbg_refresh();
+        return *this;
+    }
 
-        refresh();
+    Guid& operator=(const Utf8Str &str)
+    {
+        return operator=(str.c_str());
+    }
 
-        return *this;
+    Guid& operator=(const RTCString &str)
+    {
+        return operator=(str.c_str());
+    }
+
+    Guid& operator=(const Bstr &str)
+    {
+        return operator=(str.raw());
     }
 
     void create()
     {
         ::RTUuidCreate(&mUuid);
-        mGuidState = NORMAL_GUID;
-        refresh();
+        mGuidState = GUID_NORMAL;
+        dbg_refresh();
     }
+
     void clear()
     {
         ::RTUuidClear(&mUuid);
-        mGuidState = ZERO_GUID;
-        refresh();
+        mGuidState = GUID_ZERO;
+        dbg_refresh();
     }
 
     /**
@@ -225,18 +270,15 @@ public:
      */
     Utf8Str toString() const
     {
-        char buf[RTUUID_STR_LENGTH];
-
-        ::memset(buf,0,RTUUID_STR_LENGTH);
-
-        if (mGuidState == INVALID_GUID)
+        if (mGuidState == GUID_INVALID)
         {
             /* What to return in case of wrong Guid */
             return Utf8Str("00000000-0000-0000-0000-00000000000");
         }
 
-        ::RTUuidToStr(&mUuid, buf, RTUUID_STR_LENGTH);
-
+        char buf[RTUUID_STR_LENGTH];
+        ::memset(buf, '\0', sizeof(buf));
+        ::RTUuidToStr(&mUuid, buf, sizeof(buf));
 
         return Utf8Str(buf);
     }
@@ -249,18 +291,17 @@ public:
      */
     Utf8Str toStringCurly() const
     {
-
-        if (mGuidState == INVALID_GUID)
+        if (mGuidState == GUID_INVALID)
         {
             /* What to return in case of wrong Guid */
             return Utf8Str("{00000000-0000-0000-0000-00000000000}");
         }
 
-        char buf[RTUUID_STR_LENGTH + 2] = "{";
-
-        ::RTUuidToStr(&mUuid, buf + 1, RTUUID_STR_LENGTH);
+        char buf[RTUUID_STR_LENGTH + 2];
+        ::memset(buf, '\0', sizeof(buf));
+        ::RTUuidToStr(&mUuid, buf + 1, sizeof(buf) - 2);
+        buf[0] = '{';
         buf[sizeof(buf) - 2] = '}';
-        buf[sizeof(buf) - 1] = '\0';
 
         return Utf8Str(buf);
     }
@@ -273,34 +314,38 @@ public:
      */
     Bstr toUtf16() const
     {
-        if (mGuidState == INVALID_GUID)
+        if (mGuidState == GUID_INVALID)
+        {
+            /* What to return in case of wrong Guid */
           return Bstr("00000000-0000-0000-0000-00000000000");
+        }
 
         RTUTF16 buf[RTUUID_STR_LENGTH];
-        ::RTUuidToUtf16(&mUuid, buf, RTUUID_STR_LENGTH);
+        ::memset(buf, '\0', sizeof(buf));
+        ::RTUuidToUtf16(&mUuid, buf, RT_ELEMENTS(buf));
+
         return Bstr(buf);
     }
 
     bool isValid() const
     {
-        bool res = true;
-        if (mGuidState == INVALID_GUID)
-            res = false;
-
-        return res;
+        return mGuidState != GUID_INVALID;
     }
 
     bool isZero() const
     {
-        return (::RTUuidIsNull(&mUuid) && mGuidState == ZERO_GUID);
+        return mGuidState == GUID_ZERO;
     }
 
     bool operator==(const Guid &that) const { return ::RTUuidCompare(&mUuid, &that.mUuid)    == 0; }
+    bool operator==(const RTUUID &guid) const { return ::RTUuidCompare(&mUuid, &guid) == 0; }
     bool operator==(const GUID &guid) const { return ::RTUuidCompare(&mUuid, (PRTUUID)&guid) == 0; }
     bool operator!=(const Guid &that) const { return !operator==(that); }
     bool operator!=(const GUID &guid) const { return !operator==(guid); }
-    bool operator<( const Guid &that) const { return ::RTUuidCompare(&mUuid, &that.mUuid)    < 0; }
-    bool operator<( const GUID &guid) const { return ::RTUuidCompare(&mUuid, (PRTUUID)&guid) < 0; }
+    bool operator!=(const RTUUID &guid) const { return !operator==(guid); }
+    bool operator<(const Guid &that) const { return ::RTUuidCompare(&mUuid, &that.mUuid)    < 0; }
+    bool operator<(const GUID &guid) const { return ::RTUuidCompare(&mUuid, (PRTUUID)&guid) < 0; }
+    bool operator<(const RTUUID &guid) const { return ::RTUuidCompare(&mUuid, &guid) < 0; }
 
     /**
      * To directly copy the contents to a GUID, or for passing it as an input
@@ -350,7 +395,7 @@ public:
     /**
      * Internal helper class for asOutParam().
      *
-     * This takes a GUID refrence in the constructor and copies the mUuid from
+     * This takes a GUID reference in the constructor and copies the mUuid from
      * the method to that instance in its destructor.
      */
     class GuidOutParam
@@ -370,10 +415,10 @@ public:
         operator nsID**() { return &ptr; }
         ~GuidOutParam()
         {
-            if (ptr && outer.isEmpty())
+            if (ptr && outer.isZero())
             {
                 outer = *ptr;
-                outer.refresh();
+                outer.dbg_refresh();
                 nsMemory::Free(ptr);
             }
         }
@@ -385,30 +430,56 @@ public:
 
 #endif
 
-    /* to directly test IN_GUID interface method's parameters */
-    static bool isEmpty(const GUID &guid)
-    {
-        return ::RTUuidIsNull((PRTUUID)&guid);
-    }
-
     /**
-     *  Static immutable empty object. May be used for comparison purposes.
+     *  Static immutable empty (zero) object. May be used for comparison purposes.
      */
     static const Guid Empty;
 
-protected:
-
-    bool isEmpty() const
+private:
+    void initString(const char *that)
     {
-        return ::RTUuidIsNull(&mUuid);
+        if (!that || !*that)
+        {
+            ::RTUuidClear(&mUuid);
+            mGuidState = GUID_ZERO;
+        }
+        else
+        {
+            mGuidState = GUID_NORMAL;
+            int rc = ::RTUuidFromStr(&mUuid, that);
+            if (RT_FAILURE(rc))
+            {
+                ::RTUuidClear(&mUuid);
+                mGuidState = GUID_INVALID;
+            }
+            else if (isZero())
+                mGuidState = GUID_ZERO;
+        }
+        dbg_refresh();
     }
 
-    bool isNotEmpty() const
+    void initBSTR(CBSTR that)
     {
-        return !::RTUuidIsNull(&mUuid);
+        if (!that || !*that)
+        {
+            ::RTUuidClear(&mUuid);
+            mGuidState = GUID_ZERO;
+        }
+        else
+        {
+            mGuidState = GUID_NORMAL;
+            int rc = ::RTUuidFromUtf16(&mUuid, that);
+            if (RT_FAILURE(rc))
+            {
+                ::RTUuidClear(&mUuid);
+                mGuidState = GUID_INVALID;
+            }
+            else if (isZero())
+                mGuidState = GUID_ZERO;
+        }
+        dbg_refresh();
     }
 
-private:
     /**
      * Refresh the debug-only UUID string.
      *
@@ -416,11 +487,21 @@ private:
      * must be called every time the internal uuid changes; compiles to nothing
      * in release code.
      */
-    inline void refresh()
+    inline void dbg_refresh()
     {
 #ifdef DEBUG
-//        ::RTUuidToStr(&mUuid, mszUuid, RTUUID_STR_LENGTH);
-//        m_pcszUUID = mszUuid;
+        switch (mGuidState)
+        {
+            case GUID_ZERO:
+            case GUID_NORMAL:
+                ::RTUuidToStr(&mUuid, mszUuid, RTUUID_STR_LENGTH);
+                break;
+            default:
+                ::memset(mszUuid, '\0', sizeof(mszUuid));
+                ::RTStrCopy(mszUuid, sizeof(mszUuid), "INVALID");
+                break;
+        }
+        m_pcszUUID = mszUuid;
 #endif
     }
 
@@ -436,19 +517,6 @@ private:
     const char *m_pcszUUID;
 #endif
 };
-/*
-inline Bstr asGuidStr(const Bstr& str)
-{
-   Guid guid(str);
-   return guid.isEmpty() ? Bstr() : guid.toUtf16();
-}
-*/
-//inline bool isValidGuid(const Bstr& str)
-//{
-//   Guid guid(str);
-//   return guid.isValid();
-////   return !guid.isEmpty();
-//}
 
 } /* namespace com */
 
diff --git a/include/VBox/com/array.h b/include/VBox/com/array.h
index 77f9d60..f70b66e 100644
--- a/include/VBox/com/array.h
+++ b/include/VBox/com/array.h
@@ -163,6 +163,18 @@
 # include <nsMemory.h>
 #endif
 
+        /* Type traits are a C++ 11 feature, so not available everywhere (yet). */
+        /* Only GCC 4.6 or newer. */
+#if    (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406) \
+       /* Only MSVC++ 16.0 (Visual Studio 2010) or newer. */           \
+    || (defined(_MSC_VER) && (_MSC_VER >= 1600))
+    #define VBOX_WITH_TYPE_TRAITS
+#endif
+
+#ifdef VBOX_WITH_TYPE_TRAITS
+# include <type_traits>
+#endif
+
 #include "VBox/com/defs.h"
 #include "VBox/com/ptr.h"
 #include "VBox/com/assert.h"
@@ -393,12 +405,34 @@ protected:
 
     static VARTYPE VarType()
     {
+#ifdef VBOX_WITH_TYPE_TRAITS
+        if (    std::is_integral<T>::value
+            && !std::is_signed<T>::value)
+        {
+            if (sizeof(T) % 8 == 0) return VT_UI8;
+            if (sizeof(T) % 4 == 0) return VT_UI4;
+            if (sizeof(T) % 2 == 0) return VT_UI2;
+            return VT_UI1;
+        }
+#endif
         if (sizeof(T) % 8 == 0) return VT_I8;
         if (sizeof(T) % 4 == 0) return VT_I4;
         if (sizeof(T) % 2 == 0) return VT_I2;
         return VT_I1;
     }
 
+    /*
+     * Fallback method in case type traits (VBOX_WITH_TYPE_TRAITS)
+     * are not available. Always returns unsigned types.
+     */
+    static VARTYPE VarTypeUnsigned()
+    {
+        if (sizeof(T) % 8 == 0) return VT_UI8;
+        if (sizeof(T) % 4 == 0) return VT_UI4;
+        if (sizeof(T) % 2 == 0) return VT_UI2;
+        return VT_UI1;
+    }
+
     static ULONG VarCount(size_t aSize)
     {
         if (sizeof(T) % 8 == 0) return (ULONG)((sizeof(T) / 8) * aSize);
@@ -624,10 +658,18 @@ public:
             VARTYPE vt;
             HRESULT rc = SafeArrayGetVartype(arg, &vt);
             AssertComRCReturnVoid(rc);
-            AssertMsgReturnVoid(vt == VarType(),
+# ifndef VBOX_WITH_TYPE_TRAITS
+            AssertMsgReturnVoid(
+                                   vt == VarType()
+                                || vt == VarTypeUnsigned(),
+                                ("Expected vartype %d or %d, got %d.\n",
+                                 VarType(), VarTypeUnsigned(), vt));
+# else /* !VBOX_WITH_TYPE_TRAITS */
+            AssertMsgReturnVoid(
+                                   vt == VarType(),
                                 ("Expected vartype %d, got %d.\n",
                                  VarType(), vt));
-
+# endif
             rc = SafeArrayAccessData(arg, (void HUGEP **)&m.raw);
             AssertComRCReturnVoid(rc);
 
@@ -1565,8 +1607,8 @@ public:
             HRESULT rc = SafeArrayGetVartype(arg, &vt);
             AssertComRCReturnVoid(rc);
             AssertMsgReturnVoid(vt == VT_UNKNOWN || vt == VT_DISPATCH,
-                                ("Expected vartype VT_UNKNOWN, got %d.\n",
-                                 VarType(), vt));
+                                ("Expected vartype VT_UNKNOWN or VT_DISPATCH, got %d.\n",
+                                 vt));
             GUID guid;
             rc = SafeArrayGetIID(arg, &guid);
             AssertComRCReturnVoid(rc);
@@ -1607,7 +1649,7 @@ public:
         for (typename List::const_iterator it = aCntr.begin();
              it != aCntr.end(); ++ it, ++ i)
 #ifdef VBOX_WITH_XPCOM
-            Copy(*it, Base::m.arr[i]);
+            this->Copy(*it, Base::m.arr[i]);
 #else
             Copy(*it, Base::m.raw[i]);
 #endif
diff --git a/include/VBox/com/ptr.h b/include/VBox/com/ptr.h
index bb6e571..f7d8ac5 100644
--- a/include/VBox/com/ptr.h
+++ b/include/VBox/com/ptr.h
@@ -228,6 +228,15 @@ public:
         return (m_p == NULL);
     }
 
+    /**
+     * Returns true if the pointer is not NULL.
+     */
+    bool isNotNull() const
+    {
+        return (m_p != NULL);
+    }
+
+
     bool operator<(T* p) const
     {
         return m_p < p;
diff --git a/include/VBox/com/string.h b/include/VBox/com/string.h
index 263dc40..65786d4 100644
--- a/include/VBox/com/string.h
+++ b/include/VBox/com/string.h
@@ -513,9 +513,9 @@ public:
         copyFrom(that.raw());
     }
 
-    Utf8Str(CBSTR that)
+    Utf8Str(CBSTR that, size_t a_cwcSize = RTSTR_MAX)
     {
-        copyFrom(that);
+        copyFrom(that, a_cwcSize);
     }
 
     Utf8Str(const char *a_pszSrc, size_t a_cchSrc)
@@ -564,8 +564,6 @@ public:
         return *this;
     }
 
-    bool operator<(const RTCString &that) const { return RTCString::operator<(that); }
-
     /**
      * Extended assignment method that returns a COM status code instead of an
      * exception on failure.
@@ -705,10 +703,13 @@ public:
     Utf8Str& stripPath();
 
     /**
-     * Removes a trailing file name extension from the member string, if present.
-     * Calls RTPathStripExt() without having to mess with mutableRaw().
+     * Removes a trailing file name suffix from the member string, if present.
+     * Calls RTPathStripSuffix() without having to mess with mutableRaw().
      */
-    Utf8Str& stripExt();
+    Utf8Str& stripSuffix();
+
+    // Parse key=value pairs from string
+    size_t parseKeyValue(Utf8Str &key, Utf8Str &value, size_t pos = 0, const Utf8Str &pairSeparator = ",", const Utf8Str &keyValueSeparator = "=") const;
 
     /**
      *  Static immutable empty-string object. May be used for comparison purposes.
@@ -716,7 +717,7 @@ public:
     static const Utf8Str Empty;
 protected:
 
-    void copyFrom(CBSTR a_pbstr);
+    void copyFrom(CBSTR a_pbstr, size_t a_cwcMax = RTSTR_MAX);
     HRESULT copyFromEx(CBSTR a_pbstr);
     HRESULT copyFromExNComRC(const char *a_pcszSrc, size_t a_offSrc, size_t a_cchSrc);
 
diff --git a/include/VBox/dbg.h b/include/VBox/dbg.h
index 7a4a514..617586f 100644
--- a/include/VBox/dbg.h
+++ b/include/VBox/dbg.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -41,8 +41,13 @@
 
 RT_C_DECLS_BEGIN
 
+
 #ifdef IN_RING3 /* The debugger stuff is ring-3 only. */
 
+/** @defgroup grp_dbgc     The Debugger Console API
+ * @{
+ */
+
 /** @def VBOX_WITH_DEBUGGER
  * The build is with debugger module. Test if this is defined before registering
  * external debugger commands. This is normally defined in Config.kmk.
@@ -1095,56 +1100,9 @@ DBGDECL(int)    DBGCDeregisterCommands(PCDBGCCMD paCommands, unsigned cCommands)
 DBGDECL(int)    DBGCTcpCreate(PUVM pUVM, void **ppvUser);
 DBGDECL(int)    DBGCTcpTerminate(PUVM pUVM, void *pvData);
 
-
-/** @defgroup grp_dbgc_plug_in      The DBGC Plug-in Interface
- * @{
- */
-
-/** The plug-in module name prefix. */
-#define DBGC_PLUG_IN_PREFIX         "DBGCPlugIn"
-
-/** The name of the plug-in entry point (FNDBGCPLUGIN) */
-#define DBGC_PLUG_IN_ENTRYPOINT     "DBGCPlugInEntry"
-
-/**
- * DBGC plug-in operations.
- */
-typedef enum DBGCPLUGINOP
-{
-    /** The usual invalid first value. */
-    DBGCPLUGINOP_INVALID,
-    /** Initialize the plug-in, register all the stuff.
-     * The plug-in will be unloaded on failure.
-     * uArg: The VirtualBox version (major+minor). */
-    DBGCPLUGINOP_INIT,
-    /** Terminate the plug-ing, deregister all the stuff.
-     * The plug-in will be unloaded after this call regardless of the return
-     * code. */
-    DBGCPLUGINOP_TERM,
-    /** The usual 32-bit hack. */
-    DBGCPLUGINOP_32BIT_HACK = 0x7fffffff
-} DBGCPLUGINOP;
-
-/**
- * DBGC plug-in main entry point.
- *
- * @returns VBox status code.
- *
- * @param   enmOperation    The operation.
- * @param   pUVM            The user mode VM handle. This may be NULL.
- * @param   uArg            Extra argument.
- */
-typedef DECLCALLBACK(int) FNDBGCPLUGIN(DBGCPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg);
-/** Pointer to a FNDBGCPLUGIN. */
-typedef FNDBGCPLUGIN *PFNDBGCPLUGIN;
-
-/** @copydoc FNDBGCPLUGIN */
-DECLEXPORT(int) DBGCPlugInEntry(DBGCPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg);
-
-#endif /* IN_RING3 */
-
 /** @} */
 
+#endif /* IN_RING3 */
 
 RT_C_DECLS_END
 
diff --git a/include/VBox/dbggui.h b/include/VBox/dbggui.h
index 5d83557..214dc1e 100644
--- a/include/VBox/dbggui.h
+++ b/include/VBox/dbggui.h
@@ -27,11 +27,6 @@
 #define ___VBox_dbggui_h
 
 #include <VBox/types.h>
-#if defined(RT_OS_WINDOWS)
-# include <VirtualBox.h>
-#else
-# include <VirtualBox_XPCOM.h>
-#endif
 
 
 RT_C_DECLS_BEGIN
@@ -40,6 +35,12 @@ RT_C_DECLS_BEGIN
  * @{
  */
 
+#ifdef RT_OS_WINDOWS
+struct ISession;
+#else
+class ISession;
+#endif
+
 /** Pointer to the debugger GUI instance structure. */
 typedef struct DBGGUI *PDBGGUI;
 
diff --git a/include/VBox/dbus-calls.h b/include/VBox/dbus-calls.h
index 315be67..084ef9a 100644
--- a/include/VBox/dbus-calls.h
+++ b/include/VBox/dbus-calls.h
@@ -124,6 +124,8 @@
                  (DBusConnection *connection, \
                   DBusHandleMessageFunction function, void *pvoid), \
                  (connection, function, pvoid)) \
+ RT_PROXY_STUB(dbus_connection_read_write, dbus_bool_t, \
+                 (DBusConnection *connection, int val), (connection, val)) \
  RT_PROXY_STUB(dbus_connection_read_write_dispatch, dbus_bool_t, \
                  (DBusConnection *connection, int val), (connection, val)) \
  RT_PROXY_STUB(dbus_message_is_signal, dbus_bool_t, \
diff --git a/include/VBox/dbus.h b/include/VBox/dbus.h
index 468525b..87f2295 100644
--- a/include/VBox/dbus.h
+++ b/include/VBox/dbus.h
@@ -54,7 +54,7 @@ typedef struct DBusConnection DBusConnection;
 
 typedef uint32_t dbus_bool_t;
 typedef uint32_t dbus_uint32_t;
-typedef enum { DBUS_BUS_SESSON, DBUS_BUS_SYSTEM, DBUS_BUS_STARTER } DBusBusType;
+typedef enum { DBUS_BUS_SESSION, DBUS_BUS_SYSTEM, DBUS_BUS_STARTER } DBusBusType;
 
 struct DBusMessage;
 typedef struct DBusMessage DBusMessage;
diff --git a/include/VBox/dis.h b/include/VBox/dis.h
index 0188642..48a9235 100644
--- a/include/VBox/dis.h
+++ b/include/VBox/dis.h
@@ -54,6 +54,18 @@ RT_C_DECLS_BEGIN
 #define DISPREFIX_REX                   UINT8_C(0x40)
 /** @} */
 
+/** @name VEX.Lvvvv prefix destination register flag.
+ *  @{
+ */
+#define VEX_LEN256                      UINT8_C(0x01)
+#define VEXREG_IS256B(x)                   ((x) & VEX_LEN256)
+/* Convert second byte of VEX prefix to internal format */
+#define VEX_2B2INT(x)                   ((((x) >> 2) & 0x1f))
+#define VEX_HAS_REX_R(x)                  (!((x) & 0x80))
+
+#define DISPREFIX_VEX_FLAG_W            UINT8_C(0x01)
+ /** @} */
+
 /** @name 64 bits prefix byte flags (DISSTATE::fRexPrefix).
  * Requires VBox/disopcode.h.
  * @{
@@ -129,33 +141,34 @@ AssertCompile(RT_IS_POWER_OF_TWO(DISPREFIX_REX_FLAGS_R));
 #define DISUSE_REG_FP                      RT_BIT_64(7)
 #define DISUSE_REG_MMX                     RT_BIT_64(8)
 #define DISUSE_REG_XMM                     RT_BIT_64(9)
-#define DISUSE_REG_CR                      RT_BIT_64(10)
-#define DISUSE_REG_DBG                     RT_BIT_64(11)
-#define DISUSE_REG_SEG                     RT_BIT_64(12)
-#define DISUSE_REG_TEST                    RT_BIT_64(13)
-#define DISUSE_DISPLACEMENT8               RT_BIT_64(14)
-#define DISUSE_DISPLACEMENT16              RT_BIT_64(15)
-#define DISUSE_DISPLACEMENT32              RT_BIT_64(16)
-#define DISUSE_DISPLACEMENT64              RT_BIT_64(17)
-#define DISUSE_RIPDISPLACEMENT32           RT_BIT_64(18)
-#define DISUSE_IMMEDIATE8                  RT_BIT_64(19)
-#define DISUSE_IMMEDIATE8_REL              RT_BIT_64(20)
-#define DISUSE_IMMEDIATE16                 RT_BIT_64(21)
-#define DISUSE_IMMEDIATE16_REL             RT_BIT_64(22)
-#define DISUSE_IMMEDIATE32                 RT_BIT_64(23)
-#define DISUSE_IMMEDIATE32_REL             RT_BIT_64(24)
-#define DISUSE_IMMEDIATE64                 RT_BIT_64(25)
-#define DISUSE_IMMEDIATE64_REL             RT_BIT_64(26)
-#define DISUSE_IMMEDIATE_ADDR_0_32         RT_BIT_64(27)
-#define DISUSE_IMMEDIATE_ADDR_16_32        RT_BIT_64(28)
-#define DISUSE_IMMEDIATE_ADDR_0_16         RT_BIT_64(29)
-#define DISUSE_IMMEDIATE_ADDR_16_16        RT_BIT_64(30)
+#define DISUSE_REG_YMM                     RT_BIT_64(10)
+#define DISUSE_REG_CR                      RT_BIT_64(11)
+#define DISUSE_REG_DBG                     RT_BIT_64(12)
+#define DISUSE_REG_SEG                     RT_BIT_64(13)
+#define DISUSE_REG_TEST                    RT_BIT_64(14)
+#define DISUSE_DISPLACEMENT8               RT_BIT_64(15)
+#define DISUSE_DISPLACEMENT16              RT_BIT_64(16)
+#define DISUSE_DISPLACEMENT32              RT_BIT_64(17)
+#define DISUSE_DISPLACEMENT64              RT_BIT_64(18)
+#define DISUSE_RIPDISPLACEMENT32           RT_BIT_64(19)
+#define DISUSE_IMMEDIATE8                  RT_BIT_64(20)
+#define DISUSE_IMMEDIATE8_REL              RT_BIT_64(21)
+#define DISUSE_IMMEDIATE16                 RT_BIT_64(22)
+#define DISUSE_IMMEDIATE16_REL             RT_BIT_64(23)
+#define DISUSE_IMMEDIATE32                 RT_BIT_64(24)
+#define DISUSE_IMMEDIATE32_REL             RT_BIT_64(25)
+#define DISUSE_IMMEDIATE64                 RT_BIT_64(26)
+#define DISUSE_IMMEDIATE64_REL             RT_BIT_64(27)
+#define DISUSE_IMMEDIATE_ADDR_0_32         RT_BIT_64(28)
+#define DISUSE_IMMEDIATE_ADDR_16_32        RT_BIT_64(29)
+#define DISUSE_IMMEDIATE_ADDR_0_16         RT_BIT_64(30)
+#define DISUSE_IMMEDIATE_ADDR_16_16        RT_BIT_64(31)
 /** DS:ESI */
-#define DISUSE_POINTER_DS_BASED            RT_BIT_64(31)
+#define DISUSE_POINTER_DS_BASED            RT_BIT_64(32)
 /** ES:EDI */
-#define DISUSE_POINTER_ES_BASED            RT_BIT_64(32)
-#define DISUSE_IMMEDIATE16_SX8             RT_BIT_64(33)
-#define DISUSE_IMMEDIATE32_SX8             RT_BIT_64(34)
+#define DISUSE_POINTER_ES_BASED            RT_BIT_64(33)
+#define DISUSE_IMMEDIATE16_SX8             RT_BIT_64(34)
+#define DISUSE_IMMEDIATE32_SX8             RT_BIT_64(35)
 #define DISUSE_IMMEDIATE64_SX8             RT_BIT_64(36)
 
 /** Mask of immediate use flags. */
@@ -421,6 +434,9 @@ typedef struct DISOPPARAM
         /** SSE register index (DISXREG_XXX), applicable if DISUSE_REG_XMM is
          * set in fUse.  1:1 indexes. */
         uint8_t     idxXmmReg;
+        /** SSE2 register index (DISYREG_XXX), applicable if DISUSE_REG_YMM is
+         * set in fUse.  1:1 indexes. */
+        uint8_t     idxYmmReg;
         /** Segment register index (DISSELREG_XXX), applicable if DISUSE_REG_SEG is
          * set in fUse. */
         uint8_t     idxSegReg;
@@ -441,6 +457,12 @@ typedef struct DISOPPARAM
         /** General register index (DISGREG_XXX), applicable if DISUSE_REG_GEN8,
          * DISUSE_REG_GEN16, DISUSE_REG_GEN32 or DISUSE_REG_GEN64 is set in fUse. */
         uint8_t     idxGenReg;
+        /** XMM register index (DISXREG_XXX), applicable if DISUSE_REG_XMM
+         *  is set in fUse. */
+        uint8_t     idxXmmReg;
+        /** YMM register index (DISXREG_XXX), applicable if DISUSE_REG_YMM
+         *  is set in fUse. */
+        uint8_t     idxYmmReg;
     } Index;
     /** 2, 4 or 8, if DISUSE_SCALE is set in fUse. */
     uint8_t         uScale;
@@ -471,8 +493,8 @@ typedef struct DISOPCODE
     uint8_t     idxParse2;
     /** Parameter \#3 parser index. */
     uint8_t     idxParse3;
-    /** Unused padding.  */
-    uint8_t     uUnused;
+    /** Parameter \#4 parser index.  */
+    uint8_t     idxParse4;
     /** The opcode identifier. This DIS specific, @see grp_dis_opcodes and
      * VBox/disopcode.h. */
     uint16_t    uOpcode;
@@ -482,6 +504,10 @@ typedef struct DISOPCODE
     uint16_t    fParam2;
     /** Parameter \#3 info, @see grp_dis_opparam. */
     uint16_t    fParam3;
+    /** Parameter \#4 info, @see grp_dis_opparam. */
+    uint16_t    fParam4;
+    /** padding unused */
+    uint16_t    uPadding;
     /** Operand type flags, DISOPTYPE_XXX. */
     uint32_t    fOpType;
 } DISOPCODE;
@@ -563,14 +589,18 @@ typedef struct DISSTATE
     uint8_t         idxSegPrefix;
     /** Last prefix byte (for SSE2 extension tables). */
     uint8_t         bLastPrefix;
-    /** Last significan opcode byte of instruction. */
+    /** Last significant opcode byte of instruction. */
     uint8_t         bOpCode;
     /** The size of the prefix bytes. */
     uint8_t         cbPrefix;
     /** The instruction size. */
     uint8_t         cbInstr;
+    /** VEX presence flag, destination register and size */
+    uint8_t         bVexDestReg;
+    /** VEX.W flag */
+    uint8_t         bVexWFlag;
     /** Unused bytes. */
-    uint8_t         abUnused[3];
+    uint8_t         abUnused[1];
     /** Internal: instruction filter */
     uint32_t        fFilter;
     /** Internal: pointer to disassembly function table */
@@ -606,8 +636,9 @@ typedef struct DISSTATE
     DISOPPARAM      Param1;
     DISOPPARAM      Param2;
     DISOPPARAM      Param3;
+    DISOPPARAM      Param4;
 } DISSTATE;
-AssertCompileSize(DISSTATE, 0xb8);
+AssertCompileSize(DISSTATE, 0xd8);
 
 /** @deprecated  Use DISSTATE and change Cpu and DisState to Dis. */
 typedef DISSTATE DISCPUSTATE;
diff --git a/include/VBox/disopcode.h b/include/VBox/disopcode.h
index 22ca090..3494d8f 100644
--- a/include/VBox/disopcode.h
+++ b/include/VBox/disopcode.h
@@ -1,9 +1,9 @@
 /** @file
- * Disassembler - opcode.h.
+ * Disassembler - Opcodes
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -23,8 +23,8 @@
  * terms and conditions of either the GPL or the CDDL or both.
  */
 
-#ifndef ___VBox_opcode_h
-#define ___VBox_opcode_h
+#ifndef ___VBox_disopcode_h
+#define ___VBox_disopcode_h
 
 #define MODRM_MOD(a)    (a>>6)
 #define MODRM_REG(a)    ((a>>3)&0x7)
@@ -40,591 +40,725 @@
  * @ingroup grp_dis
  * @{
  */
-
+enum OPCODES
+{
 /** @name  Full Intel X86 opcode list
  * @{ */
-#define OP_INVALID      0
-#define OP_OPSIZE       1
-#define OP_ADDRSIZE     2
-#define OP_SEG          3
-#define OP_REPNE        4
-#define OP_REPE         5
-#define OP_REX          6
-#define OP_LOCK         7
-#define OP_LAST_PREFIX  OP_LOCK   /* disassembler assumes this is the last prefix byte value!!!! */
-#define OP_AND          8
-#define OP_OR           9
-#define OP_DAA          10
-#define OP_SUB          11
-#define OP_DAS          12
-#define OP_XOR          13
-#define OP_AAA          14
-#define OP_CMP          15
-#define OP_IMM_GRP1     16
-#define OP_AAS          17
-#define OP_INC          18
-#define OP_DEC          19
-#define OP_PUSHA        20
-#define OP_POPA         21
-#define OP_BOUND        22
-#define OP_ARPL         23
-#define OP_PUSH         24
-#define OP_POP          25
-#define OP_IMUL         26
-#define OP_INSB         27
-#define OP_INSWD        28
-#define OP_OUTSB        29
-#define OP_OUTSWD       30
-#define OP_JO           31
-#define OP_JNO          32
-#define OP_JC           33
-#define OP_JNC          34
-#define OP_JE           35
-#define OP_JNE          36
-#define OP_JBE          37
-#define OP_JNBE         38
-#define OP_JS           39
-#define OP_JNS          40
-#define OP_JP           41
-#define OP_JNP          42
-#define OP_JL           43
-#define OP_JNL          44
-#define OP_JLE          45
-#define OP_JNLE         46
-#define OP_ADD          47
-#define OP_TEST         48
-#define OP_XCHG         49
-#define OP_MOV          50
-#define OP_LEA          51
-#define OP_NOP          52
-#define OP_CBW          53
-#define OP_CWD          54
-#define OP_CALL         55
-#define OP_WAIT         56
-#define OP_PUSHF        57
-#define OP_POPF         58
-#define OP_SAHF         59
-#define OP_LAHF         60
-#define OP_MOVSB        61
-#define OP_MOVSWD       62
-#define OP_CMPSB        63
-#define OP_CMPWD        64
-#define OP_STOSB        65
-#define OP_STOSWD       66
-#define OP_LODSB        67
-#define OP_LODSWD       68
-#define OP_SCASB        69
-#define OP_SCASWD       70
-#define OP_SHIFT_GRP2   71
-#define OP_RETN         72
-#define OP_LES          73
-#define OP_LDS          74
-#define OP_ENTER        75
-#define OP_LEAVE        76
-#define OP_RETF         77
-#define OP_INT3         78
-#define OP_INT          79
-#define OP_INTO         80
-#define OP_IRET         81
-#define OP_AAM          82
-#define OP_AAD          83
-#define OP_XLAT         84
-#define OP_ESCF0        85
-#define OP_ESCF1        86
-#define OP_ESCF2        87
-#define OP_ESCF3        88
-#define OP_ESCF4        89
-#define OP_ESCF5        90
-#define OP_ESCF6        91
-#define OP_ESCF7        92
-#define OP_LOOPNE       93
-#define OP_LOOPE        94
-#define OP_LOOP         95
-#define OP_JECXZ        96
-#define OP_IN           97
-#define OP_OUT          98
-#define OP_JMP          99
-#define OP_2B_ESC       100
-#define OP_ADC          101
-#define OP_SBB          102
-#define OP_HLT          103
-#define OP_CMC          104
-#define OP_UNARY_GRP3   105
-#define OP_CLC          106
-#define OP_STC          107
-#define OP_CLI          108
-#define OP_STI          109
-#define OP_CLD          110
-#define OP_STD          111
-#define OP_INC_GRP4     112
-#define OP_IND_GRP5     113
-#define OP_GRP6         114
-#define OP_GRP7         115
-#define OP_LAR          116
-#define OP_LSL          117
-#define OP_SYSCALL      118
-#define OP_CLTS         119
-#define OP_SYSRET       120
-#define OP_INVD         121
-#define OP_WBINVD       122
-#define OP_ILLUD2       123
-#define OP_FEMMS        124
-#define OP_3DNOW        125
-#define OP_MOVUPS       126
-#define OP_MOVLPS       127
-#define OP_UNPCKLPS     128
-#define OP_MOVHPS       129
-#define OP_UNPCKHPS     130
-#define OP_PREFETCH_GRP16   131
-#define OP_MOV_CR       132
-#define OP_MOVAPS       133
-#define OP_CVTPI2PS     134
-#define OP_MOVNTPS      135
-#define OP_CVTTPS2PI    136
-#define OP_CVTPS2PI     137
-#define OP_UCOMISS      138
-#define OP_COMISS       139
-#define OP_WRMSR        140
-#define OP_RDTSC        141
-#define OP_RDMSR        142
-#define OP_RDPMC        143
-#define OP_SYSENTER     144
-#define OP_SYSEXIT      145
-#define OP_PAUSE        146
-#define OP_CMOVO        147
-#define OP_CMOVNO       148
-#define OP_CMOVC        149
-#define OP_CMOVNC       150
-#define OP_CMOVZ        151
-#define OP_CMOVNZ       152
-#define OP_CMOVBE       153
-#define OP_CMOVNBE      154
-#define OP_CMOVS        155
-#define OP_CMOVNS       156
-#define OP_CMOVP        157
-#define OP_CMOVNP       158
-#define OP_CMOVL        159
-#define OP_CMOVNL       160
-#define OP_CMOVLE       161
-#define OP_CMOVNLE      162
-#define OP_MOVMSKPS     163
-#define OP_SQRTPS       164
-#define OP_RSQRTPS      165
-#define OP_RCPPS        166
-#define OP_ANDPS        167
-#define OP_ANDNPS       168
-#define OP_ORPS         169
-#define OP_XORPS        170
-#define OP_ADDPS        171
-#define OP_MULPS        172
-#define OP_CVTPS2PD     173
-#define OP_CVTDQ2PS     174
-#define OP_SUBPS        175
-#define OP_MINPS        176
-#define OP_DIVPS        177
-#define OP_MAXPS        178
-#define OP_PUNPCKLBW    179
-#define OP_PUNPCKLWD    180
-#define OP_PUNPCKLDQ    181
-#define OP_PACKSSWB     182
-#define OP_PCMPGTB      183
-#define OP_PCMPGTW      184
-#define OP_PCMPGTD      185
-#define OP_PACKUSWB     186
-#define OP_PUNPCKHBW    187
-#define OP_PUNPCKHWD    188
-#define OP_PUNPCKHDQ    189
-#define OP_PACKSSDW     190
-#define OP_MOVD         191
-#define OP_MOVQ         192
-#define OP_PSHUFW       193
-#define OP_3B_ESC4      194
-#define OP_3B_ESC5      195
-
-#define OP_PCMPEQB      196
-#define OP_PCMPEQW      197
-#define OP_PCMPEQD      198
-#define OP_SETO         199
-#define OP_SETNO        200
-#define OP_SETC         201
-#define OP_SETNC        202
-#define OP_SETE         203
-#define OP_SETNE        204
-#define OP_SETBE        205
-#define OP_SETNBE       206
-#define OP_SETS         207
-#define OP_SETNS        208
-#define OP_SETP         209
-#define OP_SETNP        210
-#define OP_SETL         211
-#define OP_SETNL        212
-#define OP_SETLE        213
-#define OP_SETNLE       214
-#define OP_CPUID        215
-#define OP_BT           216
-#define OP_SHLD         217
-#define OP_RSM          218
-#define OP_BTS          219
-#define OP_SHRD         220
-#define OP_GRP15        221
-#define OP_CMPXCHG      222
-#define OP_LSS          223
-#define OP_BTR          224
-#define OP_LFS          225
-#define OP_LGS          226
-#define OP_MOVZX        227
-#define OP_GRP10_INV    228
-#define OP_GRP8         229
-#define OP_BTC          230
-#define OP_BSF          231
-#define OP_BSR          232
-#define OP_MOVSX        233
-#define OP_XADD         234
-#define OP_CMPPS        235
-#define OP_MOVNTI       236
-#define OP_PINSRW       237
-#define OP_PEXTRW       238
-#define OP_SHUFPS       239
-#define OP_GRP9         240
-#define OP_BSWAP        241
-#define OP_PSRLW        242
-#define OP_PSRLD        243
-#define OP_PSRLQ        244
-#define OP_PADDQ        245
-#define OP_PMULLW       246
-#define OP_PMOVMSKB     247
-#define OP_PSUBUSB      248
-#define OP_PSUBUSW      249
-#define OP_PMINUB       250
-#define OP_PAND         251
-#define OP_PADDUSB      252
-#define OP_PADDUSW      253
-#define OP_PMAXUB       254
-#define OP_PANDN        255
-#define OP_PAVGN        256
-#define OP_PSRAW        257
-#define OP_PSRAD        258
-#define OP_PAVGW        259
-#define OP_PMULHUW      260
-#define OP_PMULHW       261
-#define OP_MOVNTQ       262
-#define OP_PSUBSB       263
-#define OP_PSUBSW       264
-#define OP_PMINSW       265
-#define OP_POR          266
-#define OP_PADDSB       267
-#define OP_PADDSW       268
-#define OP_PMAXSW       269
-#define OP_PXOR         270
-#define OP_PSLLW        271
-#define OP_PSLLD        272
-#define OP_PSSQ         273
-#define OP_PMULUDQ      274
-#define OP_PADDWD       275
-#define OP_PADBW        276
-#define OP_PMASKMOVQ    277
-#define OP_PSUBB        278
-#define OP_PSUBW        279
-
-#define OP_PSUBD        281
-#define OP_PADDB        282
-#define OP_PADDW        283
-#define OP_PADDD        284
-#define OP_MOVUPD       285
-#define OP_MOVLPD       286
-#define OP_UNPCKLPD     287
-#define OP_UNPCKHPD     288
-#define OP_MOVHPD       289
-
-#define OP_MOVAPD       291
-#define OP_CVTPI2PD     292
-#define OP_MOVNTPD      293
-#define OP_CVTTPD2PI    294
-#define OP_CVTPD2PI     295
-#define OP_UCOMISD      296
-#define OP_COMISD       297
-#define OP_MOVMSKPD     298
-#define OP_SQRTPD       299
-#define OP_ANDPD        301
-#define OP_ANDNPD       302
-#define OP_ORPD         303
-#define OP_XORPD        304
-#define OP_ADDPD        305
-#define OP_MULPD        306
-#define OP_CVTPD2PS     307
-#define OP_CVTPS2DQ     308
-#define OP_SUBPD        309
-#define OP_MINPD        310
-#define OP_DIVPD        311
-#define OP_MAXPD        312
-
-#define OP_GRP12        313
-#define OP_GRP13        314
-#define OP_GRP14        315
-#define OP_EMMS         316
-#define OP_MMX_UD78     317
-#define OP_MMX_UD79     318
-#define OP_MMX_UD7A     319
-#define OP_MMX_UD7B     320
-#define OP_MMX_UD7C     321
-#define OP_MMX_UD7D     322
-
-
-#define OP_PUNPCKLQDQ   325
-#define OP_PUNPCKHQD    326
-
-#define OP_MOVDQA       328
-#define OP_PSHUFD       329
-
-
-
-#define OP_CMPPD        334
-#define OP_SHUFPD       337
-
-
-#define OP_CVTTPD2DQ    353
-#define OP_MOVNTDQ      354
-
-#define OP_PSHUFB       355
-#define OP_PHADDW       356
-#define OP_PHADDD       357
-#define OP_PHADDSW      358
-#define OP_PMADDUBSW    359
-#define OP_PHSUBW       360
-#define OP_PHSUBD       361
-#define OP_PHSUBSW      362
-#define OP_PSIGNB       363
-#define OP_PSIGNW       364
-#define OP_PSIGND       365
-#define OP_PMULHRSW     366
-#define OP_PBLENDVB     367
-#define OP_BLENDVPS     368
-#define OP_BLENDVPD     369
-#define OP_PTEST        370
-#define OP_PABSB        371
-#define OP_PABSW        372
-#define OP_PABSD        373
-
-#define OP_PMASKMOVDQU  376
-#define OP_MOVSD        377
-#define OP_CVTSI2SD     378
-#define OP_CVTTSD2SI    379
-#define OP_CVTSD2SI     380
-#define OP_SQRTSD       381
-#define OP_ADDSD        382
-#define OP_MULSD        383
-#define OP_CVTSD2SS     384
-#define OP_SUBSD        385
-#define OP_MINSD        386
-#define OP_DIVSD        387
-#define OP_MAXSD        388
-#define OP_PSHUFLW      389
-#define OP_CMPSD        390
-#define OP_MOVDQ2Q      391
-#define OP_CVTPD2DQ     392
-#define OP_MOVSS        393
-#define OP_CVTSI2SS     394
-#define OP_CVTTSS2SI    395
-#define OP_CVTSS2SI     396
-#define OP_SQRTSS       397
-#define OP_RSQRTSS      398
-#define OP_ADDSS        399
-#define OP_MULSS        401
-#define OP_CVTTPS2DQ    403
-#define OP_SUBSS        404
-#define OP_MINSS        405
-#define OP_DIVSS        406
-#define OP_MAXSS        407
-#define OP_MOVDQU       408
-#define OP_PSHUFHW      409
-#define OP_CMPSS        410
-#define OP_MOVQ2DQ      411
-#define OP_CVTDQ2PD     412
+    OP_INVALID = 0,
+    OP_OPSIZE,
+    OP_ADDRSIZE,
+    OP_SEG,
+    OP_REPNE,
+    OP_REPE,
+    OP_REX,
+    OP_LOCK,
+    OP_LAST_PREFIX = OP_LOCK, /**< Last prefix for disassembler. */
+    OP_AND,
+    OP_OR,
+    OP_DAA,
+    OP_SUB,
+    OP_DAS,
+    OP_XOR,
+    OP_AAA,
+    OP_CMP,
+    OP_IMM_GRP1,
+    OP_AAS,
+    OP_INC,
+    OP_DEC,
+    OP_PUSHA,
+    OP_POPA,
+    OP_BOUND,
+    OP_ARPL,
+    OP_PUSH,
+    OP_POP,
+    OP_IMUL,
+    OP_INSB,
+    OP_INSWD,
+    OP_OUTSB,
+    OP_OUTSWD,
+    OP_JO,
+    OP_JNO,
+    OP_JC,
+    OP_JNC,
+    OP_JE,
+    OP_JNE,
+    OP_JBE,
+    OP_JNBE,
+    OP_JS,
+    OP_JNS,
+    OP_JP,
+    OP_JNP,
+    OP_JL,
+    OP_JNL,
+    OP_JLE,
+    OP_JNLE,
+    OP_ADD,
+    OP_TEST,
+    OP_XCHG,
+    OP_MOV,
+    OP_LEA,
+    OP_NOP,
+    OP_CBW,
+    OP_CWD,
+    OP_CALL,
+    OP_WAIT,
+    OP_PUSHF,
+    OP_POPF,
+    OP_SAHF,
+    OP_LAHF,
+    OP_MOVSB,
+    OP_MOVSWD,
+    OP_CMPSB,
+    OP_CMPWD,
+    OP_STOSB,
+    OP_STOSWD,
+    OP_LODSB,
+    OP_LODSWD,
+    OP_SCASB,
+    OP_SCASWD,
+    OP_SHIFT_GRP2,
+    OP_RETN,
+    OP_LES,
+    OP_LDS,
+    OP_ENTER,
+    OP_LEAVE,
+    OP_RETF,
+    OP_INT3,
+    OP_INT,
+    OP_INTO,
+    OP_IRET,
+    OP_AAM,
+    OP_AAD,
+    OP_XLAT,
+    OP_ESCF0,
+    OP_ESCF1,
+    OP_ESCF2,
+    OP_ESCF3,
+    OP_ESCF4,
+    OP_ESCF5,
+    OP_ESCF6,
+    OP_ESCF7,
+    OP_LOOPNE,
+    OP_LOOPE,
+    OP_LOOP,
+    OP_JECXZ,
+    OP_IN,
+    OP_OUT,
+    OP_JMP,
+    OP_2B_ESC,
+    OP_ADC,
+    OP_SBB,
+    OP_HLT,
+    OP_CMC,
+    OP_UNARY_GRP3,
+    OP_CLC,
+    OP_STC,
+    OP_CLI,
+    OP_STI,
+    OP_CLD,
+    OP_STD,
+    OP_INC_GRP4,
+    OP_IND_GRP5,
+    OP_GRP6,
+    OP_GRP7,
+    OP_LAR,
+    OP_LSL,
+    OP_SYSCALL,
+    OP_CLTS,
+    OP_SYSRET,
+    OP_INVD,
+    OP_WBINVD,
+    OP_ILLUD2,
+    OP_FEMMS,
+    OP_3DNOW,
+    OP_MOVUPS,
+    OP_MOVLPS,
+    OP_UNPCKLPS,
+    OP_MOVHPS,
+    OP_UNPCKHPS,
+    OP_PREFETCH_GRP16,
+    OP_MOV_CR,
+    OP_MOVAPS,
+    OP_CVTPI2PS,
+    OP_MOVNTPS,
+    OP_CVTTPS2PI,
+    OP_CVTPS2PI,
+    OP_UCOMISS,
+    OP_COMISS,
+    OP_WRMSR,
+    OP_RDTSC,
+    OP_RDMSR,
+    OP_RDPMC,
+    OP_SYSENTER,
+    OP_SYSEXIT,
+    OP_GETSEC,
+    OP_PAUSE,
+    OP_CMOVO,
+    OP_CMOVNO,
+    OP_CMOVC,
+    OP_CMOVNC,
+    OP_CMOVZ,
+    OP_CMOVNZ,
+    OP_CMOVBE,
+    OP_CMOVNBE,
+    OP_CMOVS,
+    OP_CMOVNS,
+    OP_CMOVP,
+    OP_CMOVNP,
+    OP_CMOVL,
+    OP_CMOVNL,
+    OP_CMOVLE,
+    OP_CMOVNLE,
+    OP_MOVMSKPS,
+    OP_SQRTPS,
+    OP_RSQRTPS,
+    OP_RCPPS,
+    OP_ANDPS,
+    OP_ANDNPS,
+    OP_ORPS,
+    OP_XORPS,
+    OP_ADDPS,
+    OP_MULPS,
+    OP_CVTPS2PD,
+    OP_CVTDQ2PS,
+    OP_SUBPS,
+    OP_MINPS,
+    OP_DIVPS,
+    OP_MAXPS,
+    OP_PUNPCKLBW,
+    OP_PUNPCKLWD,
+    OP_PUNPCKLDQ,
+    OP_PACKSSWB,
+    OP_PCMPGTB,
+    OP_PCMPGTW,
+    OP_PCMPGTD,
+    OP_PCMPGTQ,
+    OP_PACKUSWB,
+    OP_PUNPCKHBW,
+    OP_PUNPCKHWD,
+    OP_PUNPCKHDQ,
+    OP_PACKSSDW,
+    OP_MOVD,
+    OP_MOVQ,
+    OP_PSHUFW,
+    OP_3B_ESC4,
+    OP_3B_ESC5,
+    OP_PCMPEQB,
+    OP_PCMPEQW,
+    OP_PCMPEQD,
+    OP_PCMPEQQ,
+    OP_SETO,
+    OP_SETNO,
+    OP_SETC,
+    OP_SETNC,
+    OP_SETE,
+    OP_SETNE,
+    OP_SETBE,
+    OP_SETNBE,
+    OP_SETS,
+    OP_SETNS,
+    OP_SETP,
+    OP_SETNP,
+    OP_SETL,
+    OP_SETNL,
+    OP_SETLE,
+    OP_SETNLE,
+    OP_CPUID,
+    OP_BT,
+    OP_SHLD,
+    OP_RSM,
+    OP_BTS,
+    OP_SHRD,
+    OP_GRP15,
+    OP_CMPXCHG,
+    OP_LSS,
+    OP_BTR,
+    OP_LFS,
+    OP_LGS,
+    OP_MOVZX,
+    OP_GRP10_INV,
+    OP_GRP8,
+    OP_BTC,
+    OP_BSF,
+    OP_BSR,
+    OP_MOVSX,
+    OP_XADD,
+    OP_CMPPS,
+    OP_MOVNTI,
+    OP_PINSRW,
+    OP_PEXTRW,
+    OP_SHUFPS,
+    OP_GRP9,
+    OP_BSWAP,
+    OP_ADDSUBPS,
+    OP_ADDSUBPD,
+    OP_PSRLW,
+    OP_PSRLD,
+    OP_PSRLQ,
+    OP_PADDQ,
+    OP_PMULLW,
+    OP_PMOVMSKB,
+    OP_PSUBUSB,
+    OP_PSUBUSW,
+    OP_PMINUB,
+    OP_PAND,
+    OP_PADDUSB,
+    OP_PADDUSW,
+    OP_PMAXUB,
+    OP_PANDN,
+    OP_PAVGB,
+    OP_PSRAW,
+    OP_PSRAD,
+    OP_PAVGW,
+    OP_PMULHUW,
+    OP_PMULHW,
+    OP_MOVNTQ,
+    OP_PSUBSB,
+    OP_PSUBSW,
+    OP_PMINSW,
+    OP_POR,
+    OP_PADDSB,
+    OP_PADDSW,
+    OP_PMAXSW,
+    OP_PXOR,
+    OP_LDDQU,
+    OP_PSLLW,
+    OP_PSLLD,
+    OP_PSSQ,
+    OP_PMULUDQ,
+    OP_PMADDWD,
+    OP_PSADBW,
+    OP_MASKMOVQ,
+    OP_PSUBB,
+    OP_PSUBW,
+    OP_PSUBD,
+    OP_PSUBQ,
+    OP_PADDB,
+    OP_PADDW,
+    OP_PADDD,
+    OP_MOVUPD,
+    OP_MOVLPD,
+    OP_UNPCKLPD,
+    OP_UNPCKHPD,
+    OP_MOVHPD,
+    OP_MOVAPD,
+    OP_CVTPI2PD,
+    OP_MOVNTPD,
+    OP_CVTTPD2PI,
+    OP_CVTPD2PI,
+    OP_UCOMISD,
+    OP_COMISD,
+    OP_MOVMSKPD,
+    OP_SQRTPD,
+    OP_ANDPD,
+    OP_ANDNPD,
+    OP_ORPD,
+    OP_XORPD,
+    OP_ADDPD,
+    OP_MULPD,
+    OP_CVTPD2PS,
+    OP_CVTPS2DQ,
+    OP_SUBPD,
+    OP_MINPD,
+    OP_DIVPD,
+    OP_MAXPD,
+    OP_GRP12,
+    OP_GRP13,
+    OP_GRP14,
+    OP_EMMS,
+    OP_MMX_UD78,
+    OP_MMX_UD79,
+    OP_MMX_UD7A,
+    OP_MMX_UD7B,
+    OP_MMX_UD7C,
+    OP_MMX_UD7D,
+    OP_PUNPCKLQDQ,
+    OP_PUNPCKHQDQ,
+    OP_MOVDQA,
+    OP_PSHUFD,
+    OP_CMPPD,
+    OP_SHUFPD,
+    OP_CVTTPD2DQ,
+    OP_MOVNTDQ,
+    OP_MOVNTDQA,
+    OP_PACKUSDW,
+    OP_PSHUFB,
+    OP_PHADDW,
+    OP_PHADDD,
+    OP_PHADDSW,
+    OP_HADDPS,
+    OP_HADDPD,
+    OP_PMADDUBSW,
+    OP_PHSUBW,
+    OP_PHSUBD,
+    OP_PHSUBSW,
+    OP_HSUBPS,
+    OP_HSUBPD,
+    OP_PSIGNB,
+    OP_PSIGNW,
+    OP_PSIGND,
+    OP_PMULHRSW,
+    OP_PERMILPS,
+    OP_PERMILPD,
+    OP_TESTPS,
+    OP_TESTPD,
+    OP_PBLENDVB,
+    OP_CVTPH2PS,
+    OP_BLENDVPS,
+    OP_BLENDVPD,
+    OP_PERMPS,
+    OP_PERMD,
+    OP_PTEST,
+    OP_BROADCASTSS,
+    OP_BROADCASTSD,
+    OP_BROADCASTF128,
+    OP_PABSB,
+    OP_PABSW,
+    OP_PABSD,
+    OP_PMOVSX,
+    OP_PMOVZX,
+    OP_PMULDQ,
+    OP_PMINSB,
+    OP_PMINSD,
+    OP_PMINUW,
+    OP_PMINUD,
+    OP_PMAXSB,
+    OP_PMAXSD,
+    OP_PMAXUW,
+    OP_PMAXUD,
+    OP_PMULLD,
+    OP_PHMINPOSUW,
+    OP_PSRLVD,
+    OP_PSRAVD,
+    OP_PSLLVD,
+    OP_PBROADCASTD,
+    OP_PBROADCASTQ,
+    OP_PBROADCASTI128,
+    OP_PBROADCASTB,
+    OP_PBROADCASTW,
+    OP_PMASKMOVD,
+    OP_GATHER,
+    OP_FMADDSUB132PS,
+    OP_FMSUBADD132PS,
+    OP_FMADD132PS,
+    OP_FMADD132SS,
+    OP_FMSUB132PS,
+    OP_FMSUB132SS,
+    OP_FNMADD132PS,
+    OP_FNMADD132SS,
+    OP_FNMSUB132PS,
+    OP_FNMSUB132SS,
+    OP_FMADDSUB213PS,
+    OP_FMSUBADD213PS,
+    OP_FMADD213PS,
+    OP_FMADD213SS,
+    OP_FMSUB213PS,
+    OP_FMSUB213SS,
+    OP_FNMADD213PS,
+    OP_FNMADD213SS,
+    OP_FNMSUB213PS,
+    OP_FNMSUB213SS,
+    OP_FMADDSUB231PS,
+    OP_FMSUBADD231PS,
+    OP_FMADD231PS,
+    OP_FMADD231SS,
+    OP_FMSUB231PS,
+    OP_FMSUB231SS,
+    OP_FNMADD231PS,
+    OP_FNMADD231SS,
+    OP_FNMSUB231PS,
+    OP_FNMSUB231SS,
+    OP_AESIMC,
+    OP_AESENC,
+    OP_AESENCLAST,
+    OP_AESDEC,
+    OP_AESDECLAST,
+    OP_MOVBEGM,
+    OP_MOVBEMG,
+    OP_CRC32GDEB,
+    OP_CRC32GDEY,
+    OP_POPCNT,
+    OP_TZCNT,
+    OP_LZCNT,
+    OP_ADCX,
+    OP_ADOX,
+    OP_ANDN,
+    OP_BZHI,
+    OP_BEXTR,
+    OP_PEXT,
+    OP_SARX,
+    OP_PDEP,
+    OP_SHRX,
+    OP_MULX,
+    OP_MASKMOVDQU,
+    OP_MASKMOVPS,
+    OP_MASKMOVPD,
+    OP_MOVSD,
+    OP_CVTSI2SD,
+    OP_CVTTSD2SI,
+    OP_CVTSD2SI,
+    OP_SQRTSD,
+    OP_ADDSD,
+    OP_MULSD,
+    OP_CVTSD2SS,
+    OP_SUBSD,
+    OP_MINSD,
+    OP_DIVSD,
+    OP_MAXSD,
+    OP_PSHUFLW,
+    OP_CMPSD,
+    OP_MOVDQ2Q,
+    OP_CVTPD2DQ,
+    OP_MOVSS,
+    OP_MOVSLDUP,
+    OP_MOVDDUP,
+    OP_MOVSHDUP,
+    OP_CVTSI2SS,
+    OP_CVTTSS2SI,
+    OP_CVTSS2SI,
+    OP_CVTSS2SD,
+    OP_SQRTSS,
+    OP_RSQRTSS,
+    OP_RCPSS,
+    OP_ADDSS,
+    OP_MULSS,
+    OP_CVTTPS2DQ,
+    OP_SUBSS,
+    OP_MINSS,
+    OP_DIVSS,
+    OP_MAXSS,
+    OP_MOVDQU,
+    OP_PSHUFHW,
+    OP_CMPSS,
+    OP_MOVQ2DQ,
+    OP_CVTDQ2PD,
+    OP_PERMQ,
+    OP_PERMPD,
+    OP_PBLENDD,
+    OP_PERM2F128,
+    OP_ROUNDPS,
+    OP_ROUNDPD,
+    OP_ROUNDSS,
+    OP_ROUNDSD,
+    OP_BLENDPS,
+    OP_BLENDPD,
+    OP_PBLENDW,
+    OP_PALIGNR,
+    OP_PEXTRB,
+    OP_PEXTRD,
+    OP_EXTRACTPS,
+    OP_INSERTF128,
+    OP_EXTRACTF128,
+    OP_CVTPS2PH,
+    OP_PINSRB,
+    OP_PINSRD,
+    OP_INSERTPS,
+    OP_INSERTI128,
+    OP_EXTRACTI128,
+    OP_DPPS,
+    OP_DPPD,
+    OP_MPSADBW,
+    OP_PCLMULQDQ,
+    OP_PERM2I128,
+    OP_PCMPESTRM,
+    OP_PCMPESTRI,
+    OP_PCMPISTRM,
+    OP_PCMPISTRI,
+    OP_AESKEYGEN,
+    OP_RORX,
+    OP_VEX3B,
+    OP_VEX2B,
 /** @} */
 
 /** @name Floating point ops
- * @{
- */
-#define OP_FADD         413
-#define OP_FMUL         414
-#define OP_FCOM         415
-#define OP_FCOMP        416
-#define OP_FSUB         417
-#define OP_FSUBR        418
-#define OP_FDIV         419
-#define OP_FDIVR        420
-#define OP_FLD          421
-#define OP_FST          422
-#define OP_FSTP         423
-#define OP_FLDENV       424
-
-#define OP_FSTENV       426
-#define OP_FSTCW        427
-#define OP_FXCH         428
-#define OP_FNOP         429
-#define OP_FCHS         430
-#define OP_FABS         431
-
-#define OP_FLD1         433
-#define OP_FLDL2T       434
-#define OP_FLDL2E       435
-#define OP_FLDPI        436
-#define OP_FLDLG2       437
-#define OP_FLDLN2       438
-#define OP_FLDZ         439
-#define OP_F2XM1        440
-#define OP_FYL2X        441
-#define OP_FPTAN        442
-#define OP_FPATAN       443
-#define OP_FXTRACT      444
-#define OP_FREM1        445
-#define OP_FDECSTP      446
-#define OP_FINCSTP      447
-#define OP_FPREM        448
-#define OP_FYL2XP1      449
-#define OP_FSQRT        450
-#define OP_FSINCOS      451
-#define OP_FRNDINT      452
-#define OP_FSCALE       453
-#define OP_FSIN         454
-#define OP_FCOS         455
-#define OP_FIADD        456
-#define OP_FIMUL        457
-#define OP_FISUB        460
-#define OP_FISUBR       461
-#define OP_FIDIV        462
-#define OP_FIDIVR       463
-#define OP_FCMOVB       464
-#define OP_FCMOVE       465
-#define OP_FCMOVBE      466
-#define OP_FCMOVU       467
-#define OP_FUCOMPP      468
-#define OP_FILD         469
-#define OP_FIST         470
-#define OP_FISTP        471
-#define OP_FCMOVNB      474
-#define OP_FCMOVNE      475
-#define OP_FCMOVNBE     476
-#define OP_FCMOVNU      477
-#define OP_FCLEX        478
-#define OP_FINIT        479
-#define OP_FUCOMI       480
-#define OP_FCOMI        481
-#define OP_FRSTOR       482
-#define OP_FSAVE        483
-#define OP_FNSTSW       484
-#define OP_FFREE        485
-#define OP_FUCOM        486
-#define OP_FUCOMP       487
-#define OP_FICOM        490
-#define OP_FICOMP       491
-#define OP_FADDP        496
-#define OP_FMULP        497
-#define OP_FCOMPP       498
-#define OP_FSUBRP       499
-#define OP_FSUBP        500
-#define OP_FDIVRP       501
-#define OP_FDIVP        502
-#define OP_FBLD         503
-#define OP_FBSTP        504
-#define OP_FCOMIP       506
-#define OP_FUCOMIP      507
+  * @{ */
+    OP_FADD,
+    OP_FMUL,
+    OP_FCOM,
+    OP_FCOMP,
+    OP_FSUB,
+    OP_FSUBR,
+    OP_FDIV,
+    OP_FDIVR,
+    OP_FLD,
+    OP_FST,
+    OP_FSTP,
+    OP_FLDENV,
+    OP_FSTENV,
+    OP_FSTCW,
+    OP_FXCH,
+    OP_FNOP,
+    OP_FCHS,
+    OP_FABS,
+    OP_FLD1,
+    OP_FLDL2T,
+    OP_FLDL2E,
+    OP_FLDPI,
+    OP_FLDLG2,
+    OP_FLDLN2,
+    OP_FLDZ,
+    OP_F2XM1,
+    OP_FYL2X,
+    OP_FPTAN,
+    OP_FPATAN,
+    OP_FXTRACT,
+    OP_FREM1,
+    OP_FDECSTP,
+    OP_FINCSTP,
+    OP_FPREM,
+    OP_FYL2XP1,
+    OP_FSQRT,
+    OP_FSINCOS,
+    OP_FRNDINT,
+    OP_FSCALE,
+    OP_FSIN,
+    OP_FCOS,
+    OP_FIADD,
+    OP_FIMUL,
+    OP_FISUB,
+    OP_FISUBR,
+    OP_FIDIV,
+    OP_FIDIVR,
+    OP_FCMOVB,
+    OP_FCMOVE,
+    OP_FCMOVBE,
+    OP_FCMOVU,
+    OP_FUCOMPP,
+    OP_FILD,
+    OP_FIST,
+    OP_FISTP,
+    OP_FCMOVNB,
+    OP_FCMOVNE,
+    OP_FCMOVNBE,
+    OP_FCMOVNU,
+    OP_FCLEX,
+    OP_FINIT,
+    OP_FUCOMI,
+    OP_FCOMI,
+    OP_FRSTOR,
+    OP_FSAVE,
+    OP_FNSTSW,
+    OP_FFREE,
+    OP_FUCOM,
+    OP_FUCOMP,
+    OP_FICOM,
+    OP_FICOMP,
+    OP_FADDP,
+    OP_FMULP,
+    OP_FCOMPP,
+    OP_FSUBRP,
+    OP_FSUBP,
+    OP_FDIVRP,
+    OP_FDIVP,
+    OP_FBLD,
+    OP_FBSTP,
+    OP_FCOMIP,
+    OP_FUCOMIP,
 /** @} */
 
 /** @name 3DNow!
- * @{
- */
-#define OP_PI2FW        508
-#define OP_PI2FD        509
-#define OP_PF2IW        510
-#define OP_PF2ID        511
-#define OP_PFPNACC      512
-#define OP_PFCMPGE      513
-#define OP_PFMIN        514
-#define OP_PFRCP        515
-#define OP_PFRSQRT      516
-#define OP_PFSUB        517
-#define OP_PFADD        518
-#define OP_PFCMPGT      519
-#define OP_PFMAX        520
-#define OP_PFRCPIT1     521
-#define OP_PFRSQRTIT1   522
-#define OP_PFSUBR       523
-#define OP_PFACC        524
-#define OP_PFCMPEQ      525
-#define OP_PFMUL        526
-#define OP_PFRCPIT2     527
-#define OP_PFMULHRW     528
-#define OP_PFSWAPD      529
-#define OP_PAVGUSB      530
-#define OP_PFNACC       531
-#define OP_ROL          532
-#define OP_ROR          533
-#define OP_RCL          534
-#define OP_RCR          535
-#define OP_SHL          536
-#define OP_SHR          537
-#define OP_SAR          538
-#define OP_NOT          539
-#define OP_NEG          540
-#define OP_MUL          541
-#define OP_DIV          542
-#define OP_IDIV         543
-#define OP_SLDT         544
-#define OP_STR          545
-#define OP_LLDT         546
-#define OP_LTR          547
-#define OP_VERR         548
-#define OP_VERW         549
-#define OP_SGDT         550
-#define OP_LGDT         551
-#define OP_SIDT         552
-#define OP_LIDT         553
-#define OP_SMSW         554
-#define OP_LMSW         555
-#define OP_INVLPG       556
-#define OP_CMPXCHG8B    557
-#define OP_PSLLQ        558
-#define OP_PSRLDQ       559
-#define OP_PSLLDQ       560
-#define OP_FXSAVE       561
-#define OP_FXRSTOR      562
-#define OP_LDMXCSR      563
-#define OP_STMXCSR      564
-#define OP_LFENCE       565
-#define OP_MFENCE       566
-#define OP_SFENCE       567
-#define OP_PREFETCH     568
-#define OP_MONITOR      569
-#define OP_MWAIT        570
-#define OP_CLFLUSH      571
-
-#define OP_MOV_DR       600
-#define OP_MOV_TR       601
-
-#define OP_SWAPGS       610
-
+ * @{ */
+    OP_PI2FW,
+    OP_PI2FD,
+    OP_PF2IW,
+    OP_PF2ID,
+    OP_PFPNACC,
+    OP_PFCMPGE,
+    OP_PFMIN,
+    OP_PFRCP,
+    OP_PFRSQRT,
+    OP_PFSUB,
+    OP_PFADD,
+    OP_PFCMPGT,
+    OP_PFMAX,
+    OP_PFRCPIT1,
+    OP_PFRSQRTIT1,
+    OP_PFSUBR,
+    OP_PFACC,
+    OP_PFCMPEQ,
+    OP_PFMUL,
+    OP_PFRCPIT2,
+    OP_PFMULHRW,
+    OP_PFSWAPD,
+    OP_PAVGUSB,
+    OP_PFNACC,
+    OP_ROL,
+    OP_ROR,
+    OP_RCL,
+    OP_RCR,
+    OP_SHL,
+    OP_SHR,
+    OP_SAR,
+    OP_NOT,
+    OP_NEG,
+    OP_MUL,
+    OP_DIV,
+    OP_IDIV,
+    OP_SLDT,
+    OP_STR,
+    OP_LLDT,
+    OP_LTR,
+    OP_VERR,
+    OP_VERW,
+    OP_SGDT,
+    OP_LGDT,
+    OP_SIDT,
+    OP_LIDT,
+    OP_SMSW,
+    OP_LMSW,
+    OP_INVLPG,
+    OP_CMPXCHG8B,
+    OP_PSLLQ,
+    OP_PSRLDQ,
+    OP_PSLLDQ,
+    OP_FXSAVE,
+    OP_FXRSTOR,
+    OP_LDMXCSR,
+    OP_STMXCSR,
+    OP_LFENCE,
+    OP_MFENCE,
+    OP_SFENCE,
+    OP_PREFETCH,
+    OP_MONITOR,
+    OP_MWAIT,
+    OP_CLFLUSH,
+    OP_MOV_DR,
+    OP_MOV_TR,
+    OP_SWAPGS,
+/** @}  */
 /** @name VT-x instructions
+* @{ */
+    OP_VMREAD,
+    OP_VMWRITE,
+    OP_VMCALL,
+    OP_VMXON,
+    OP_VMXOFF,
+    OP_VMCLEAR,
+    OP_VMLAUNCH,
+    OP_VMRESUME,
+    OP_VMPTRLD,
+    OP_VMPTRST,
+    OP_INVEPT,
+    OP_INVVPID,
+    OP_INVPCID,
+    OP_VMFUNC,
+/** @}  */
+/** @name AMD-V instructions
  * @{ */
-#define OP_VMREAD       650
-#define OP_VMWRITE      651
-#define OP_VMCALL       652
-#define OP_VMXON        653
-#define OP_VMXOFF       654
-#define OP_VMCLEAR      655
-#define OP_VMLAUNCH     656
-#define OP_VMRESUME     657
-#define OP_VMPTRLD      658
-#define OP_VMPTRST      659
-#define OP_INVEPT       660
-#define OP_INVVPID      661
+    OP_VMMCALL,
+    OP_VMRUN,
+    OP_VMLOAD,
+    OP_VMSAVE,
+    OP_CLGI,
+    OP_STGI,
+    OP_INVLPGA,
+    OP_SKINIT,
 /** @}  */
-
 /** @name 64 bits instruction
  * @{ */
-#define OP_MOVSXD       700
-/** @}  */
-
+    OP_MOVSXD
+/** @} */
+};
 /** @} */
 
 
@@ -634,105 +768,109 @@
  * @{
  */
 
-/* NOTE: Register order is important for translations!! */
-#define OP_PARM_NONE            0
-#define OP_PARM_REG_EAX         1
-#define OP_PARM_REG_GEN32_START OP_PARM_REG_EAX
-#define OP_PARM_REG_ECX         2
-#define OP_PARM_REG_EDX         3
-#define OP_PARM_REG_EBX         4
-#define OP_PARM_REG_ESP         5
-#define OP_PARM_REG_EBP         6
-#define OP_PARM_REG_ESI         7
-#define OP_PARM_REG_EDI         8
-#define OP_PARM_REG_GEN32_END   OP_PARM_REG_EDI
-
-#define OP_PARM_REG_ES          9
-#define OP_PARM_REG_SEG_START   OP_PARM_REG_ES
-#define OP_PARM_REG_CS          10
-#define OP_PARM_REG_SS          11
-#define OP_PARM_REG_DS          12
-#define OP_PARM_REG_FS          13
-#define OP_PARM_REG_GS          14
-#define OP_PARM_REG_SEG_END     OP_PARM_REG_GS
-
-#define OP_PARM_REG_AX          15
-#define OP_PARM_REG_GEN16_START   OP_PARM_REG_AX
-#define OP_PARM_REG_CX          16
-#define OP_PARM_REG_DX          17
-#define OP_PARM_REG_BX          18
-#define OP_PARM_REG_SP          19
-#define OP_PARM_REG_BP          20
-#define OP_PARM_REG_SI          21
-#define OP_PARM_REG_DI          22
-#define OP_PARM_REG_GEN16_END   OP_PARM_REG_DI
-
-#define OP_PARM_REG_AL          23
-#define OP_PARM_REG_GEN8_START  OP_PARM_REG_AL
-#define OP_PARM_REG_CL          24
-#define OP_PARM_REG_DL          25
-#define OP_PARM_REG_BL          26
-#define OP_PARM_REG_AH          27
-#define OP_PARM_REG_CH          28
-#define OP_PARM_REG_DH          29
-#define OP_PARM_REG_BH          30
-#define OP_PARM_REG_GEN8_END    OP_PARM_REG_BH
-
-#define OP_PARM_REGFP_0         31
-#define OP_PARM_REG_FP_START    OP_PARM_REGFP_0
-#define OP_PARM_REGFP_1         32
-#define OP_PARM_REGFP_2         33
-#define OP_PARM_REGFP_3         34
-#define OP_PARM_REGFP_4         35
-#define OP_PARM_REGFP_5         36
-#define OP_PARM_REGFP_6         37
-#define OP_PARM_REGFP_7         38
-#define OP_PARM_REG_FP_END      OP_PARM_REGFP_7
-
-#define OP_PARM_NTA             39
-#define OP_PARM_T0              40
-#define OP_PARM_T1              41
-#define OP_PARM_T2              42
-
-#define OP_PARM_1               43
-
-#define OP_PARM_REX             50
-#define OP_PARM_REX_START       OP_PARM_REX
-#define OP_PARM_REX_B           51
-#define OP_PARM_REX_X           52
-#define OP_PARM_REX_XB          53
-#define OP_PARM_REX_R           54
-#define OP_PARM_REX_RB          55
-#define OP_PARM_REX_RX          56
-#define OP_PARM_REX_RXB         57
-#define OP_PARM_REX_W           58
-#define OP_PARM_REX_WB          59
-#define OP_PARM_REX_WX          60
-#define OP_PARM_REX_WXB         61
-#define OP_PARM_REX_WR          62
-#define OP_PARM_REX_WRB         63
-#define OP_PARM_REX_WRX         64
-#define OP_PARM_REX_WRXB        65
-
-#define OP_PARM_REG_RAX         100
-#define OP_PARM_REG_GEN64_START OP_PARM_REG_RAX
-#define OP_PARM_REG_RCX         101
-#define OP_PARM_REG_RDX         102
-#define OP_PARM_REG_RBX         103
-#define OP_PARM_REG_RSP         104
-#define OP_PARM_REG_RBP         105
-#define OP_PARM_REG_RSI         106
-#define OP_PARM_REG_RDI         107
-#define OP_PARM_REG_R8          108
-#define OP_PARM_REG_R9          109
-#define OP_PARM_REG_R10         110
-#define OP_PARM_REG_R11         111
-#define OP_PARM_REG_R12         112
-#define OP_PARM_REG_R13         113
-#define OP_PARM_REG_R14         114
-#define OP_PARM_REG_R15         115
-#define OP_PARM_REG_GEN64_END   OP_PARM_REG_R15
-
+/**
+ * @remarks Register order is important for translations!!
+ */
+enum OP_PARM
+{
+    OP_PARM_NONE,
+
+    OP_PARM_REG_EAX,
+    OP_PARM_REG_GEN32_START = OP_PARM_REG_EAX,
+    OP_PARM_REG_ECX,
+    OP_PARM_REG_EDX,
+    OP_PARM_REG_EBX,
+    OP_PARM_REG_ESP,
+    OP_PARM_REG_EBP,
+    OP_PARM_REG_ESI,
+    OP_PARM_REG_EDI,
+    OP_PARM_REG_GEN32_END = OP_PARM_REG_EDI,
+
+    OP_PARM_REG_ES,
+    OP_PARM_REG_SEG_START = OP_PARM_REG_ES,
+    OP_PARM_REG_CS,
+    OP_PARM_REG_SS,
+    OP_PARM_REG_DS,
+    OP_PARM_REG_FS,
+    OP_PARM_REG_GS,
+    OP_PARM_REG_SEG_END = OP_PARM_REG_GS,
+
+    OP_PARM_REG_AX,
+    OP_PARM_REG_GEN16_START = OP_PARM_REG_AX,
+    OP_PARM_REG_CX,
+    OP_PARM_REG_DX,
+    OP_PARM_REG_BX,
+    OP_PARM_REG_SP,
+    OP_PARM_REG_BP,
+    OP_PARM_REG_SI,
+    OP_PARM_REG_DI,
+    OP_PARM_REG_GEN16_END = OP_PARM_REG_DI,
+
+    OP_PARM_REG_AL,
+    OP_PARM_REG_GEN8_START = OP_PARM_REG_AL,
+    OP_PARM_REG_CL,
+    OP_PARM_REG_DL,
+    OP_PARM_REG_BL,
+    OP_PARM_REG_AH,
+    OP_PARM_REG_CH,
+    OP_PARM_REG_DH,
+    OP_PARM_REG_BH,
+    OP_PARM_REG_GEN8_END = OP_PARM_REG_BH,
+
+    OP_PARM_REGFP_0,
+    OP_PARM_REG_FP_START = OP_PARM_REGFP_0,
+    OP_PARM_REGFP_1,
+    OP_PARM_REGFP_2,
+    OP_PARM_REGFP_3,
+    OP_PARM_REGFP_4,
+    OP_PARM_REGFP_5,
+    OP_PARM_REGFP_6,
+    OP_PARM_REGFP_7,
+    OP_PARM_REG_FP_END = OP_PARM_REGFP_7,
+
+    OP_PARM_NTA,
+    OP_PARM_T0,
+    OP_PARM_T1,
+    OP_PARM_T2,
+    OP_PARM_1,
+
+    OP_PARM_REX,
+    OP_PARM_REX_START = OP_PARM_REX,
+    OP_PARM_REX_B,
+    OP_PARM_REX_X,
+    OP_PARM_REX_XB,
+    OP_PARM_REX_R,
+    OP_PARM_REX_RB,
+    OP_PARM_REX_RX,
+    OP_PARM_REX_RXB,
+    OP_PARM_REX_W,
+    OP_PARM_REX_WB,
+    OP_PARM_REX_WX,
+    OP_PARM_REX_WXB,
+    OP_PARM_REX_WR,
+    OP_PARM_REX_WRB,
+    OP_PARM_REX_WRX,
+    OP_PARM_REX_WRXB,
+
+    OP_PARM_REG_RAX,
+    OP_PARM_REG_GEN64_START = OP_PARM_REG_RAX,
+    OP_PARM_REG_RCX,
+    OP_PARM_REG_RDX,
+    OP_PARM_REG_RBX,
+    OP_PARM_REG_RSP,
+    OP_PARM_REG_RBP,
+    OP_PARM_REG_RSI,
+    OP_PARM_REG_RDI,
+    OP_PARM_REG_R8,
+    OP_PARM_REG_R9,
+    OP_PARM_REG_R10,
+    OP_PARM_REG_R11,
+    OP_PARM_REG_R12,
+    OP_PARM_REG_R13,
+    OP_PARM_REG_R14,
+    OP_PARM_REG_R15,
+    OP_PARM_REG_GEN64_END = OP_PARM_REG_R15
+};
 
 #define OP_PARM_VTYPE(a)        ((unsigned)a & 0xFE0)
 #define OP_PARM_VSUBTYPE(a)     ((unsigned)a & 0x01F)
@@ -751,7 +889,7 @@
 #define OP_PARM_Y               0x240
 
 /* Grouped rare parameters for optimization purposes */
-#define IS_OP_PARM_RARE(a)      ((a & 0xF00) == 0x300)
+#define IS_OP_PARM_RARE(a)      ((a & 0xF00) >= 0x300)
 #define OP_PARM_C               0x300       /* control register */
 #define OP_PARM_D               0x320       /* debug register */
 #define OP_PARM_S               0x340       /* segment register */
@@ -760,6 +898,10 @@
 #define OP_PARM_P               0x3A0       /* mmx register */
 #define OP_PARM_W               0x3C0       /* xmm register */
 #define OP_PARM_V               0x3E0
+#define OP_PARM_U               0x400       /* The R/M field of the ModR/M byte selects XMM/YMM register. */
+#define OP_PARM_B               0x420       /* VEX.vvvv field select general purpose register. */
+#define OP_PARM_H               0x440
+#define OP_PARM_L               0x460
 
 #define OP_PARM_NONE            0
 #define OP_PARM_a               0x1
@@ -777,10 +919,14 @@
 #define OP_PARM_ss              0xD
 #define OP_PARM_v               0xE
 #define OP_PARM_w               0xF
-#define OP_PARM_z               0x10
+#define OP_PARM_x               0x10
+#define OP_PARM_y               0x11
+#define OP_PARM_z               0x12
+#define OP_PARM_qq              0x13
 
 
 #define OP_PARM_Ap              (OP_PARM_A+OP_PARM_p)
+#define OP_PARM_By              (OP_PARM_B+OP_PARM_y)
 #define OP_PARM_Cd              (OP_PARM_C+OP_PARM_d)
 #define OP_PARM_Dd              (OP_PARM_D+OP_PARM_d)
 #define OP_PARM_Eb              (OP_PARM_E+OP_PARM_b)
@@ -788,11 +934,21 @@
 #define OP_PARM_Ep              (OP_PARM_E+OP_PARM_p)
 #define OP_PARM_Ev              (OP_PARM_E+OP_PARM_v)
 #define OP_PARM_Ew              (OP_PARM_E+OP_PARM_w)
+#define OP_PARM_Ey              (OP_PARM_E+OP_PARM_y)
 #define OP_PARM_Fv              (OP_PARM_F+OP_PARM_v)
 #define OP_PARM_Gb              (OP_PARM_G+OP_PARM_b)
 #define OP_PARM_Gd              (OP_PARM_G+OP_PARM_d)
 #define OP_PARM_Gv              (OP_PARM_G+OP_PARM_v)
 #define OP_PARM_Gw              (OP_PARM_G+OP_PARM_w)
+#define OP_PARM_Gy              (OP_PARM_G+OP_PARM_y)
+#define OP_PARM_Hq              (OP_PARM_H+OP_PARM_q)
+#define OP_PARM_Hps             (OP_PARM_H+OP_PARM_ps)
+#define OP_PARM_Hpd             (OP_PARM_H+OP_PARM_pd)
+#define OP_PARM_Hdq             (OP_PARM_H+OP_PARM_dq)
+#define OP_PARM_Hqq             (OP_PARM_H+OP_PARM_qq)
+#define OP_PARM_Hsd             (OP_PARM_H+OP_PARM_sd)
+#define OP_PARM_Hss             (OP_PARM_H+OP_PARM_ss)
+#define OP_PARM_Hx              (OP_PARM_H+OP_PARM_x)
 #define OP_PARM_Ib              (OP_PARM_I+OP_PARM_b)
 #define OP_PARM_Id              (OP_PARM_I+OP_PARM_d)
 #define OP_PARM_Iq              (OP_PARM_I+OP_PARM_q)
@@ -809,6 +965,10 @@
 #define OP_PARM_Mq              (OP_PARM_M+OP_PARM_q)
 #define OP_PARM_Mdq             (OP_PARM_M+OP_PARM_dq)
 #define OP_PARM_Ms              (OP_PARM_M+OP_PARM_s)
+#define OP_PARM_Mx              (OP_PARM_M+OP_PARM_x)
+#define OP_PARM_My              (OP_PARM_M+OP_PARM_y)
+#define OP_PARM_Mps             (OP_PARM_M+OP_PARM_ps)
+#define OP_PARM_Mpd             (OP_PARM_M+OP_PARM_pd)
 #define OP_PARM_Ob              (OP_PARM_O+OP_PARM_b)
 #define OP_PARM_Ov              (OP_PARM_O+OP_PARM_v)
 #define OP_PARM_Pq              (OP_PARM_P+OP_PARM_q)
@@ -817,11 +977,16 @@
 #define OP_PARM_Qq              (OP_PARM_Q+OP_PARM_q)
 #define OP_PARM_Rd              (OP_PARM_R+OP_PARM_d)
 #define OP_PARM_Rw              (OP_PARM_R+OP_PARM_w)
+#define OP_PARM_Ry              (OP_PARM_R+OP_PARM_y)
 #define OP_PARM_Sw              (OP_PARM_S+OP_PARM_w)
 #define OP_PARM_Td              (OP_PARM_T+OP_PARM_d)
+#define OP_PARM_Ux              (OP_PARM_U+OP_PARM_x)
 #define OP_PARM_Vq              (OP_PARM_V+OP_PARM_q)
+#define OP_PARM_Vx              (OP_PARM_V+OP_PARM_x)
+#define OP_PARM_Vy              (OP_PARM_V+OP_PARM_y)
 #define OP_PARM_Wq              (OP_PARM_W+OP_PARM_q)
 #define OP_PARM_Ws              (OP_PARM_W+OP_PARM_s)
+#define OP_PARM_Wx              (OP_PARM_W+OP_PARM_x)
 #define OP_PARM_Xb              (OP_PARM_X+OP_PARM_b)
 #define OP_PARM_Xv              (OP_PARM_X+OP_PARM_v)
 #define OP_PARM_Yb              (OP_PARM_Y+OP_PARM_b)
@@ -834,14 +999,23 @@
 #define OP_PARM_Wps             (OP_PARM_W+OP_PARM_ps)
 #define OP_PARM_Wpd             (OP_PARM_W+OP_PARM_pd)
 #define OP_PARM_Wss             (OP_PARM_W+OP_PARM_ss)
+#define OP_PARM_Ww              (OP_PARM_W+OP_PARM_w)
+#define OP_PARM_Wd              (OP_PARM_W+OP_PARM_d)
+#define OP_PARM_Wq              (OP_PARM_W+OP_PARM_q)
 #define OP_PARM_Wdq             (OP_PARM_W+OP_PARM_dq)
+#define OP_PARM_Wqq             (OP_PARM_W+OP_PARM_qq)
 #define OP_PARM_Ppi             (OP_PARM_P+OP_PARM_pi)
 #define OP_PARM_Qpi             (OP_PARM_Q+OP_PARM_pi)
 #define OP_PARM_Qdq             (OP_PARM_Q+OP_PARM_dq)
 #define OP_PARM_Vsd             (OP_PARM_V+OP_PARM_sd)
 #define OP_PARM_Wsd             (OP_PARM_W+OP_PARM_sd)
 #define OP_PARM_Vpq             (OP_PARM_V+OP_PARM_pq)
+#define OP_PARM_Vqq             (OP_PARM_V+OP_PARM_qq)
 #define OP_PARM_Pdq             (OP_PARM_P+OP_PARM_dq)
+#define OP_PARM_Ups             (OP_PARM_U+OP_PARM_ps)
+#define OP_PARM_Upd             (OP_PARM_U+OP_PARM_pd)
+#define OP_PARM_Udq             (OP_PARM_U+OP_PARM_dq)
+#define OP_PARM_Lx              (OP_PARM_L+OP_PARM_x)
 
 /** @} */
 
diff --git a/include/VBox/err.h b/include/VBox/err.h
index d8429c3..c6cd7c7 100644
--- a/include/VBox/err.h
+++ b/include/VBox/err.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -64,7 +64,7 @@
 #define VERR_OUT_OF_SELECTOR_BOUNDS         (-1010)
 /** Invalid selector. Usually beyond table limits. */
 #define VERR_INVALID_SELECTOR               (-1011)
-/** Invalid requested privilegde level. */
+/** Invalid requested privilege level. */
 #define VERR_INVALID_RPL                    (-1012)
 /** PML4 entry not present. */
 #define VERR_PAGE_MAP_LEVEL4_NOT_PRESENT    (-1013)
@@ -86,6 +86,8 @@
 #define VERR_SERVICE_DISABLED               (-1020)
 /** The requested feature is not supported in raw-mode. */
 #define VERR_NOT_SUP_IN_RAW_MODE            (-1021)
+/** Invalid CPU index. */
+#define VERR_INVALID_CPU_INDEX              (-1022)
 /** @} */
 
 
@@ -98,7 +100,7 @@
  */
 /** First scheduling related status code. */
 #define VINF_EM_FIRST                       1100
-/** Indicating that the VM is being terminated and that the the execution
+/** Indicating that the VM is being terminated and that the execution
  * shall stop. */
 #define VINF_EM_TERMINATE                   1100
 /** Hypervisor code was stepped.
@@ -128,7 +130,7 @@
 /** Indicating that the VM is being turned off and that the EM should
  * exit to the VM awaiting the destruction request. */
 #define VINF_EM_OFF                         1109
-/** Indicating that the VM has been suspended and that the the thread
+/** Indicating that the VM has been suspended and that the thread
  * should wait for request telling it what to do next. */
 #define VINF_EM_SUSPEND                     1110
 /** Indicating that the VM has been reset and that scheduling goes
@@ -246,6 +248,8 @@
 /** The specified execution engine cannot execute guest code in the current
  *  state. */
 #define VERR_EM_CANNOT_EXEC_GUEST           (-1156)
+/** Reason for leaving RC: Inject a TRPM event. */
+#define VINF_EM_RAW_INJECT_TRPM_EVENT       1157
 /** @} */
 
 
@@ -258,7 +262,7 @@
 /** Someone (including the caller) was already attached as
  * debugger to the VM. */
 #define VERR_DBGF_ALREADY_ATTACHED          (-1201)
-/** Tried to hald a debugger which was already halted.
+/** Tried to halt a debugger which was already halted.
  * (This is a warning and not an error.) */
 #define VWRN_DBGF_ALREADY_HALTED            1202
 /** The DBGF has no more free breakpoint slots. */
@@ -367,6 +371,8 @@
 #define VINF_PATCH_CONTINUE                 (1430)
 /** The patch manager is not used because we're using HM and VT-x/AMD-V. */
 #define VERR_PATM_HM_IPE                    (-1431)
+/** Unexpected trap in patch code. */
+#define VERR_PATM_IPE_TRAP_IN_PATCH_CODE    (-1432)
 
 /** @} */
 
@@ -565,7 +571,7 @@
 #define VERR_PGM_PHYS_PAGE_MAP_IPE_4            (-1674)
 /** Too many loops looking for a page to reuse. */
 #define VERR_PGM_POOL_TOO_MANY_LOOPS            (-1675)
-/** Internal procesing error related to guest mappings. */
+/** Internal processing error related to guest mappings. */
 #define VERR_PGM_MAPPING_IPE                    (-1676)
 /** An attempt was made to grow an already maxed out page pool. */
 #define VERR_PGM_POOL_MAXED_OUT_ALREADY         (-1677)
@@ -607,7 +613,7 @@
 #define VERR_CPUM_RAISE_GP_0                    (-1750)
 /** Incompatible CPUM configuration. */
 #define VERR_CPUM_INCOMPATIBLE_CONFIG           (-1751)
-/** CPUMR3DisasmInstrCPU unexpectedly failed to determin the hidden
+/** CPUMR3DisasmInstrCPU unexpectedly failed to determine the hidden
  * parts of the CS register. */
 #define VERR_CPUM_HIDDEN_CS_LOAD_ERROR          (-1752)
 /** Couldn't find the end of CPUID sub-leaves. */
@@ -620,6 +626,23 @@
 #define VERR_CPUM_DB_CPU_NOT_FOUND              (-1756)
 /** Invalid CPUMCPU offset in MSR range. */
 #define VERR_CPUM_MSR_BAD_CPUMCPU_OFFSET        (-1757)
+/** Return to ring-3 to read the MSR there. */
+#define VINF_CPUM_R3_MSR_READ                   (1758)
+/** Return to ring-3 to write the MSR there. */
+#define VINF_CPUM_R3_MSR_WRITE                  (1759)
+/** Too many CPUID leaves. */
+#define VERR_TOO_MANY_CPUID_LEAVES              (-1760)
+/** Invalid config value. */
+#define VERR_CPUM_INVALID_CONFIG_VALUE          (-1761)
+/** The loaded XSAVE component mask is not compatible with the host CPU
+ * or/and VM config. */
+#define VERR_CPUM_INCOMPATIBLE_XSAVE_COMP_MASK  (-1762)
+/** The loaded XSAVE component mask is not valid. */
+#define VERR_CPUM_INVALID_XSAVE_COMP_MASK       (-1763)
+/** The loaded XSAVE header is not valid. */
+#define VERR_CPUM_INVALID_XSAVE_HDR             (-1764)
+/** The loaded XCR0 register value is not valid. */
+#define VERR_CPUM_INVALID_XCR0                  (-1765)
 /** @} */
 
 
@@ -663,9 +686,9 @@
 #define VERR_SSM_INTEGRITY_REC_TERM             (-1823)
 /** Termination record CRC mismatch. */
 #define VERR_SSM_INTEGRITY_REC_TERM_CRC         (-1824)
-/** Decompression interity error.  */
+/** Decompression integrity error.  */
 #define VERR_SSM_INTEGRITY_DECOMPRESSION        (-1825)
-/** Saved state directory iintegrity error.  */
+/** Saved state directory wintertides error.  */
 #define VERR_SSM_INTEGRITY_DIR                  (-1826)
 /** The saved state directory magic is wrong. */
 #define VERR_SSM_INTEGRITY_DIR_MAGIC            (-1827)
@@ -691,7 +714,7 @@
  * Normally caused by hardware changes on the host, but could also be caused by
  * changes in the BIOS setup. */
 #define VERR_SSM_LOAD_CPUID_MISMATCH            (-1842)
-/** The RAM size differes between the saved state and the VM config. */
+/** The RAM size differs between the saved state and the VM config. */
 #define VERR_SSM_LOAD_MEMORY_SIZE_MISMATCH      (-1843)
 /** The state doesn't match the VM configuration in one or another way.
  * (There are certain PCI reconfiguration which the OS could potentially
@@ -794,7 +817,7 @@
  * the interface user screwed up, or we've got corruption/broken logic. */
 #define VERR_VM_REQUEST_STATE                   (-1902)
 /** Invalid VM request packet.
- * One or more of the the VM controlled packet members didn't contain the correct
+ * One or more of the VM controlled packet members didn't contain the correct
  * values. Some thing's broken. */
 #define VERR_VM_REQUEST_INVALID_PACKAGE         (-1903)
 /** The status field has not been updated yet as the request is still
@@ -903,7 +926,7 @@
 #define VERR_CFGM_NOT_BYTES                 (-2108)
 /** The specified string / bytes buffer was to small. Specify a larger one and retry. */
 #define VERR_CFGM_NOT_ENOUGH_SPACE          (-2109)
-/** The path of a new node contained slashs or was empty. */
+/** The path of a new node contained slashes or was empty. */
 #define VERR_CFGM_INVALID_NODE_PATH         (-2160)
 /** A new node couldn't be inserted because one with the same name exists. */
 #define VERR_CFGM_NODE_EXISTS               (-2161)
@@ -972,7 +995,7 @@
  */
 /** No active trap. Cannot query or reset a non-existing trap. */
 #define VERR_TRPM_NO_ACTIVE_TRAP            (-2400)
-/** Active trap. Cannot assert a new trap when when one is already active. */
+/** Active trap. Cannot assert a new trap when one is already active. */
 #define VERR_TRPM_ACTIVE_TRAP               (-2401)
 /** Reason for leaving RC: Guest tried to write to our IDT - fatal.
  * The VM will be terminated assuming the worst, i.e. that the
@@ -1085,9 +1108,9 @@
 #define VINF_IOM_R3_IOPORT_READ             2620
 /** Reason for leaving RZ: I/O port write. */
 #define VINF_IOM_R3_IOPORT_WRITE            2621
-/** Reason for leaving RZ: MMIO write. */
-#define VINF_IOM_R3_MMIO_READ               2623
 /** Reason for leaving RZ: MMIO read. */
+#define VINF_IOM_R3_MMIO_READ               2623
+/** Reason for leaving RZ: MMIO write. */
 #define VINF_IOM_R3_MMIO_WRITE              2624
 /** Reason for leaving RZ: MMIO read/write. */
 #define VINF_IOM_R3_MMIO_READ_WRITE         2625
@@ -1226,7 +1249,7 @@
 /** A attach or prepare mount call failed because the driver already
  * had a driver attached. */
 #define VERR_PDM_DRIVER_ALREADY_ATTACHED            (-2820)
-/** An attempt on deattaching a driver without anyone actually being attached, or
+/** An attempt on detaching a driver without anyone actually being attached, or
  * performing any other operation on an attached driver. */
 #define VERR_PDM_NO_DRIVER_ATTACHED                 (-2821)
 /** The attached driver configuration is missing the 'Driver' attribute. */
@@ -1244,7 +1267,7 @@
 /** A module name is too long. */
 #define VERR_PDM_MODULE_NAME_TOO_LONG               (-2827)
 /** Driver name clash. Another driver with the same name as the
- * one begin registred exists. */
+ * one being registered exists. */
 #define VERR_PDM_DRIVER_NAME_CLASH                  (-2828)
 /** The version of the driver registration structure is unknown
  * to this VBox version. Either mixing incompatible versions or
@@ -1275,7 +1298,7 @@
 /** The guest bit mask didn't match the guest being loaded. */
 #define VERR_PDM_INVALID_DEVICE_HOST_BITS           (-2838)
 /** Device name clash. Another device with the same name as the
- * one begin registred exists. */
+ * one being registered exists. */
 #define VERR_PDM_DEVICE_NAME_CLASH                  (-2839)
 /** The device wasn't found. There was no registered device
  * by that name. */
@@ -1326,7 +1349,7 @@
 /** Invalid entry in the device registration structure. */
 #define VERR_PDM_INVALID_USB_REGISTRATION           (-2857)
 /** Driver name clash. Another driver with the same name as the
- * one begin registred exists. */
+ * one being registered exists. */
 #define VERR_PDM_USB_NAME_CLASH                     (-2858)
 /** The USB hub is already registered. */
 #define VERR_PDM_USB_HUB_EXISTS                     (-2859)
@@ -1528,6 +1551,8 @@
 #define VERR_VD_UNKNOWN_INTERFACE                   (-3213)
 /** The DEK for disk encryption is missing. */
 #define VERR_VD_DEK_MISSING                         (-3214)
+/** The provided password to decrypt the DEK was incorrect. */
+#define VERR_VD_PASSWORD_INCORRECT                  (-3215)
 /** Generic: Invalid image file header. Use this for plugins. */
 #define VERR_VD_GEN_INVALID_HEADER                  (-3220)
 /** VDI: Invalid image file header. */
@@ -1776,6 +1801,17 @@
 #define VERR_SUPDRV_CSRSS_NOT_FOUND                 (-3741)
 /** Type error opening the ApiPort LPC object. */
 #define VERR_SUPDRV_APIPORT_OPEN_ERROR_TYPE         (-3742)
+/** Failed to measure the TSC delta between two CPUs. */
+#define VERR_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED    (-3743)
+/** Failed to calculate the TSC frequency. */
+#define VERR_SUPDRV_TSC_FREQ_MEASUREMENT_FAILED     (-3744)
+/** Failed to get the delta-adjusted TSC value. */
+#define VERR_SUPDRV_TSC_READ_FAILED                 (-3745)
+/** Failed to measure the TSC delta between two CPUs, continue without any
+ *  TSC-delta. */
+#define VWRN_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED     3746
+/** A TSC-delta measurement request is currently being serviced. */
+#define VERR_SUPDRV_TSC_DELTA_MEASUREMENT_BUSY      (-3747)
 /** @} */
 
 
@@ -1975,19 +2011,31 @@
 /** Invalid VMCS pointer passed to VMLAUNCH/VMRESUME. */
 #define VERR_VMX_INVALID_VMCS_PTR_TO_START_VM       (-4022)
 /** Internal VMX processing error no 1. */
-#define VERR_HMVMX_IPE_1                            (-4023)
-/** Internal VMX processing error no 1. */
-#define VERR_HMVMX_IPE_2                            (-4024)
-/** Internal VMX processing error no 1. */
-#define VERR_HMVMX_IPE_3                            (-4025)
-/** Internal VMX processing error no 1. */
-#define VERR_HMVMX_IPE_4                            (-4026)
-/** Internal VMX processing error no 1. */
-#define VERR_HMVMX_IPE_5                            (-4027)
-/** VT-x features for SMX operation disabled by the BIOS. */
-#define VERR_VMX_MSR_SMX_VMXON_DISABLED             (-4028)
+#define VERR_VMX_IPE_1                              (-4023)
+/** Internal VMX processing error no 2. */
+#define VERR_VMX_IPE_2                              (-4024)
+/** Internal VMX processing error no 3. */
+#define VERR_VMX_IPE_3                              (-4025)
+/** Internal VMX processing error no 4. */
+#define VERR_VMX_IPE_4                              (-4026)
+/** Internal VMX processing error no 5. */
+#define VERR_VMX_IPE_5                              (-4027)
+/** VT-x features for all modes (SMX and non-SMX) disabled by the BIOS. */
+#define VERR_VMX_MSR_ALL_VMXON_DISABLED             (-4028)
 /** VT-x features disabled by the BIOS. */
 #define VERR_VMX_MSR_VMXON_DISABLED                 (-4029)
+/** VM-Entry Controls internal cache invalid. */
+#define VERR_VMX_ENTRY_CTLS_CACHE_INVALID           (-4030)
+/** VM-Exit Controls internal cache invalid. */
+#define VERR_VMX_EXIT_CTLS_CACHE_INVALID            (-4031)
+/** VM-Execution Pin-based Controls internal cache invalid. */
+#define VERR_VMX_PIN_EXEC_CTLS_CACHE_INVALID        (-4032)
+/** VM-Execution Primary Processor-based Controls internal cache
+ *  invalid. */
+#define VERR_VMX_PROC_EXEC_CTLS_CACHE_INVALID       (-4033)
+/** VM-Execution Secondary Processor-based Controls internal
+ *  cache invalid. */
+#define VERR_VMX_PROC_EXEC2_CTLS_CACHE_INVALID      (-4034)
 /** @} */
 
 
@@ -2032,12 +2080,12 @@
 #define VERR_HM_CONFIG_MISMATCH                     (-4103)
 /** Internal processing error in the HM init code. */
 #define VERR_HM_ALREADY_ENABLED_IPE                 (-4104)
-/** Unexpected MSR in the load / restore list.  */
+/** Unexpected MSR in the auto-load/store area.  */
 #define VERR_HM_UNEXPECTED_LD_ST_MSR                (-4105)
 /** No 32-bit to 64-bit switcher in place. */
 #define VERR_HM_NO_32_TO_64_SWITCHER                (-4106)
 /** HMR0Leave was called on the wrong CPU. */
-#define VERR_HM_WRONG_CPU_1                         (-4107)
+#define VERR_HM_WRONG_CPU                           (-4107)
 /** Internal processing error \#1 in the HM code.  */
 #define VERR_HM_IPE_1                               (-4108)
 /** Internal processing error \#2 in the HM code.  */
@@ -2050,9 +2098,9 @@
 #define VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO       (-4112)
 /** Internal processing error \#3 in the HM code.  */
 #define VERR_HM_IPE_3                               (-4113)
-/** Internal processing error \#3 in the HM code.  */
+/** Internal processing error \#4 in the HM code.  */
 #define VERR_HM_IPE_4                               (-4114)
-/** Internal processing error \#3 in the HM code.  */
+/** Internal processing error \#5 in the HM code.  */
 #define VERR_HM_IPE_5                               (-4115)
 /** Invalid HM64ON32OP value.  */
 #define VERR_HM_INVALID_HM64ON32OP                  (-4116)
@@ -2152,11 +2200,11 @@
 #define VERR_COM_DONT_CALL_AGAIN                    (VERR_COM_VBOX_LOWEST + 13)
 /** @} */
 
-/** @name VBox CPU hotplug Status codes
+/** @name VBox VMMDev Status codes
  * @{
  */
 /** CPU hotplug events from VMMDev are not monitored by the guest. */
-#define VERR_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST    (-4700)
+#define VERR_VMMDEV_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST      (-4700)
 /** @} */
 
 /** @name VBox async I/O manager Status Codes
@@ -2319,7 +2367,7 @@
 /** Syntax error - you hit a debugger feature which isn't implemented yet.
  * (Feel free to help implement it.) */
 #define VERR_DBGC_PARSE_NOT_IMPLEMENTED             (VERR_DBGC_PARSE_LOWEST + 20)
-/** Syntax error - Couldn't staisfy a request for a sepcific result type. */
+/** Syntax error - Couldn't satisfy a request for a specific result type. */
 #define VERR_DBGC_PARSE_BAD_RESULT_TYPE             (VERR_DBGC_PARSE_LOWEST + 21)
 /** Syntax error - Cannot read symbol value, it is a set-only symbol. */
 #define VERR_DBGC_PARSE_WRITEONLY_SYMBOL            (VERR_DBGC_PARSE_LOWEST + 22)
@@ -2329,151 +2377,150 @@
 #define VERR_DBGC_PARSE_COMMAND_NOT_FOUND           (VERR_DBGC_PARSE_LOWEST + 24)
 /** Syntax error - buggy parser. */
 #define VERR_DBGC_PARSE_BUG                         (VERR_DBGC_PARSE_LOWEST + 25)
-
-
 /** @} */
 
-/** @name Support driver/library shared verfication status codes.
+
+/** @name Support driver/library shared verification status codes.
  * @{  */
-/** Process Verficiation Failure: The memory content does not match the image
+/** Process Verification Failure: The memory content does not match the image
  *  file. */
 #define VERR_SUP_VP_MEMORY_VS_FILE_MISMATCH          (-5600)
-/** Process Verficiation Failure: The memory protection of a image file section
+/** Process Verification Failure: The memory protection of a image file section
  *  does not match what the section header prescribes. */
 #define VERR_SUP_VP_SECTION_PROTECTION_MISMATCH      (-5601)
-/** Process Verficiation Failure: One of the section in the image file is not
+/** Process Verification Failure: One of the section in the image file is not
  *  mapped into memory. */
 #define VERR_SUP_VP_SECTION_NOT_MAPPED               (-5602)
-/** Process Verficiation Failure: One of the section in the image file is not
+/** Process Verification Failure: One of the section in the image file is not
  *  fully mapped into memory. */
 #define VERR_SUP_VP_SECTION_NOT_FULLY_MAPPED         (-5603)
-/** Process Verficiation Failure: Bad file alignment value in image header. */
+/** Process Verification Failure: Bad file alignment value in image header. */
 #define VERR_SUP_VP_BAD_FILE_ALIGNMENT_VALUE         (-5604)
-/** Process Verficiation Failure: Bad image base in header. */
+/** Process Verification Failure: Bad image base in header. */
 #define VERR_SUP_VP_BAD_IMAGE_BASE                   (-5605)
-/** Process Verficiation Failure: Bad image signature. */
+/** Process Verification Failure: Bad image signature. */
 #define VERR_SUP_VP_BAD_IMAGE_SIGNATURE              (-5606)
-/** Process Verficiation Failure: Bad image size. */
+/** Process Verification Failure: Bad image size. */
 #define VERR_SUP_VP_BAD_IMAGE_SIZE                   (-5607)
-/** Process Verficiation Failure: Bad new-header offset in the MZ header. */
+/** Process Verification Failure: Bad new-header offset in the MZ header. */
 #define VERR_SUP_VP_BAD_MZ_OFFSET                    (-5608)
-/** Process Verficiation Failure: Bad optional header field. */
+/** Process Verification Failure: Bad optional header field. */
 #define VERR_SUP_VP_BAD_OPTIONAL_HEADER              (-5609)
-/** Process Verficiation Failure: Bad section alignment value in image
+/** Process Verification Failure: Bad section alignment value in image
  *  header. */
 #define VERR_SUP_VP_BAD_SECTION_ALIGNMENT_VALUE      (-5610)
-/** Process Verficiation Failure: Bad section raw data size. */
+/** Process Verification Failure: Bad section raw data size. */
 #define VERR_SUP_VP_BAD_SECTION_FILE_SIZE            (-5611)
-/** Process Verficiation Failure: Bad virtual section address. */
+/** Process Verification Failure: Bad virtual section address. */
 #define VERR_SUP_VP_BAD_SECTION_RVA                  (-5612)
-/** Process Verficiation Failure: Bad virtual section size. */
+/** Process Verification Failure: Bad virtual section size. */
 #define VERR_SUP_VP_BAD_SECTION_VIRTUAL_SIZE         (-5613)
-/** Process Verficiation Failure: Bad size of image header. */
+/** Process Verification Failure: Bad size of image header. */
 #define VERR_SUP_VP_BAD_SIZE_OF_HEADERS              (-5614)
-/** Process Verficiation Failure: The process is being debugged. */
+/** Process Verification Failure: The process is being debugged. */
 #define VERR_SUP_VP_DEBUGGED                         (-5615)
-/** Process Verficiation Failure: A DLL was found more than once. */
+/** Process Verification Failure: A DLL was found more than once. */
 #define VERR_SUP_VP_DUPLICATE_DLL_MAPPING            (-5616)
-/** Process Verficiation Failure: Image section region is too large. */
+/** Process Verification Failure: Image section region is too large. */
 #define VERR_SUP_VP_EMPTY_REGION_TOO_LARGE           (-5617)
-/** Process Verficiation Failure: Exectuable file name and process image name
+/** Process Verification Failure: Executable file name and process image name
  *  does not match up. */
 #define VERR_SUP_VP_EXE_VS_PROC_NAME_MISMATCH        (-5618)
-/** Process Verficiation Failure: Found executable memory allocated in the
+/** Process Verification Failure: Found executable memory allocated in the
  *  process.  There is only supposed be executable memory associated with
  *  image file mappings (DLLs & EXE). */
 #define VERR_SUP_VP_FOUND_EXEC_MEMORY                (-5619)
-/** Process Verficiation Failure: There is more than one known executable mapped
+/** Process Verification Failure: There is more than one known executable mapped
  *  into the process. */
 #define VERR_SUP_VP_FOUND_MORE_THAN_ONE_EXE_MAPPING  (-5620)
-/** Process Verficiation Failure: Error closing image file handle. */
+/** Process Verification Failure: Error closing image file handle. */
 #define VERR_SUP_VP_IMAGE_FILE_CLOSE_ERROR           (-5621)
-/** Process Verficiation Failure: Error opening image file. */
+/** Process Verification Failure: Error opening image file. */
 #define VERR_SUP_VP_IMAGE_FILE_OPEN_ERROR            (-5622)
-/** Process Verficiation Failure: Error reading image file header. */
+/** Process Verification Failure: Error reading image file header. */
 #define VERR_SUP_VP_IMAGE_HDR_READ_ERROR             (-5623)
-/** Process Verficiation Failure: Image mapping is bogus as the first region
+/** Process Verification Failure: Image mapping is bogus as the first region
  *  has different AllocationBase and BaseAddress values, indicating that a
  *  section was unmapped or otherwise tampered with. */
 #define VERR_SUP_VP_IMAGE_MAPPING_BASE_ERROR         (-5624)
-/** Process Verficiation Failure: Error reading process memory for comparing
+/** Process Verification Failure: Error reading process memory for comparing
  *  with disk data. */
 #define VERR_SUP_VP_MEMORY_READ_ERROR                (-5625)
-/** Process Verficiation Failure: Found no executable mapped into the process
+/** Process Verification Failure: Found no executable mapped into the process
  *  address space. */
 #define VERR_SUP_VP_NO_FOUND_NO_EXE_MAPPING          (-5626)
-/** Process Verficiation Failure: An image mapping failed to report a name. */
+/** Process Verification Failure: An image mapping failed to report a name. */
 #define VERR_SUP_VP_NO_IMAGE_MAPPING_NAME            (-5627)
-/** Process Verficiation Failure: No KERNE32.DLL mapping found.  This is
+/** Process Verification Failure: No KERNE32.DLL mapping found.  This is
  *  impossible. */
 #define VERR_SUP_VP_NO_KERNEL32_MAPPING              (-5628)
-/** Process Verficiation Failure: Error allocating memory. */
+/** Process Verification Failure: Error allocating memory. */
 #define VERR_SUP_VP_NO_MEMORY                        (-5629)
-/** Process Verficiation Failure: Erorr allocating state memory or querying
+/** Process Verification Failure: Error allocating state memory or querying
  *  the system32 path. */
 #define VERR_SUP_VP_NO_MEMORY_STATE                  (-5630)
-/** Process Verficiation Failure: No NTDLL.DLL mapping found.  This is
+/** Process Verification Failure: No NTDLL.DLL mapping found.  This is
  *  impossible. */
 #define VERR_SUP_VP_NO_NTDLL_MAPPING                 (-5631)
-/** Process Verficiation Failure: A DLL residing outside System32 was found
+/** Process Verification Failure: A DLL residing outside System32 was found
  *  in the process. */
 #define VERR_SUP_VP_NON_SYSTEM32_DLL                 (-5632)
-/** Process Verficiation Failure: An unknown and unwanted DLL was found loaded
+/** Process Verification Failure: An unknown and unwanted DLL was found loaded
  *  into the process. */
 #define VERR_SUP_VP_NOT_KNOWN_DLL_OR_EXE             (-5633)
-/** Process Verficiation Failure: The name of an image file changes between
+/** Process Verification Failure: The name of an image file changes between
  *  mapping regions. */
 #define VERR_SUP_VP_NT_MAPPING_NAME_CHANGED          (-5634)
-/** Process Verficiation Failure: Error querying process name. */
+/** Process Verification Failure: Error querying process name. */
 #define VERR_SUP_VP_NT_QI_PROCESS_NM_ERROR           (-5635)
-/** Process Verficiation Failure: Error querying thread information. */
+/** Process Verification Failure: Error querying thread information. */
 #define VERR_SUP_VP_NT_QI_THREAD_ERROR               (-5636)
-/** Process Verficiation Failure: Error query virtual memory information. */
+/** Process Verification Failure: Error query virtual memory information. */
 #define VERR_SUP_VP_NT_QI_VIRTUAL_MEMORY_ERROR       (-5637)
-/** Process Verficiation Failure: Error query virtual memory mapping name. */
+/** Process Verification Failure: Error query virtual memory mapping name. */
 #define VERR_SUP_VP_NT_QI_VIRTUAL_MEMORY_NM_ERROR    (-5638)
-/** Process Verficiation Failure: Error determining the full path of
+/** Process Verification Failure: Error determining the full path of
  *  System32. */
 #define VERR_SUP_VP_SYSTEM32_PATH                    (-5639)
-/** Process Verficiation Failure: The process has more than one thread. */
+/** Process Verification Failure: The process has more than one thread. */
 #define VERR_SUP_VP_THREAD_NOT_ALONE                 (-5640)
-/** Process Verficiation Failure: The image mapping is too large (>= 2GB). */
+/** Process Verification Failure: The image mapping is too large (>= 2GB). */
 #define VERR_SUP_VP_TOO_HIGH_REGION_RVA              (-5641)
-/** Process Verficiation Failure: The memory region is too large (>= 2GB). */
+/** Process Verification Failure: The memory region is too large (>= 2GB). */
 #define VERR_SUP_VP_TOO_LARGE_REGION                 (-5642)
-/** Process Verficiation Failure: There are too many DLLs loaded. */
+/** Process Verification Failure: There are too many DLLs loaded. */
 #define VERR_SUP_VP_TOO_MANY_DLLS_LOADED             (-5643)
-/** Process Verficiation Failure: An image has too many regions. */
+/** Process Verification Failure: An image has too many regions. */
 #define VERR_SUP_VP_TOO_MANY_IMAGE_REGIONS           (-5644)
-/** Process Verficiation Failure: The process has too many virtual memory
+/** Process Verification Failure: The process has too many virtual memory
  *  regions. */
 #define VERR_SUP_VP_TOO_MANY_MEMORY_REGIONS          (-5645)
-/** Process Verficiation Failure: An image has too many sections. */
+/** Process Verification Failure: An image has too many sections. */
 #define VERR_SUP_VP_TOO_MANY_SECTIONS                (-5646)
-/** Process Verficiation Failure: An image is targetting an unexpected
+/** Process Verification Failure: An image is targeting an unexpected
  *  machine/CPU. */
 #define VERR_SUP_VP_UNEXPECTED_IMAGE_MACHINE         (-5647)
-/** Process Verficiation Failure: Unexpected section protection flag
+/** Process Verification Failure: Unexpected section protection flag
  *  combination. */
 #define VERR_SUP_VP_UNEXPECTED_SECTION_FLAGS         (-5648)
-/** Process Verficiation Failure: Expected the process and exe to have forced
+/** Process Verification Failure: Expected the process and exe to have forced
  * integrity checking enabled (verifying signatures). */
 #define VERR_SUP_VP_EXE_MISSING_FORCE_INTEGRITY     (-5649)
-/** Process Verficiation Failure: Expected the process and exe to have dynamic
+/** Process Verification Failure: Expected the process and exe to have dynamic
  * base enabled. */
 #define VERR_SUP_VP_EXE_MISSING_DYNAMIC_BASE        (-5650)
-/** Process Verficiation Failure: Expected the process and exe to advertise
+/** Process Verification Failure: Expected the process and exe to advertise
  * NX compatibility. */
 #define VERR_SUP_VP_EXE_MISSING_NX_COMPAT           (-5651)
-/** Process Verficiation Failure: The DllCharacteristics of the process
+/** Process Verification Failure: The DllCharacteristics of the process
  * does not match the value in the optional header in the exe file. */
 #define VERR_SUP_VP_DLL_CHARECTERISTICS_MISMATCH    (-5652)
-/** Process Verficiation Failure: The ImageCharacteristics of the process
+/** Process Verification Failure: The ImageCharacteristics of the process
  * does not match the value in the file header in the exe file. */
 #define VERR_SUP_VP_IMAGE_CHARECTERISTICS_MISMATCH  (-5653)
-/** Process Verficiation Failure: Error querying image information. */
+/** Process Verification Failure: Error querying image information. */
 #define VERR_SUP_VP_NT_QI_PROCESS_IMG_INFO_ERROR    (-5654)
-/** Process Verficiation Failure: Error querying debug port. */
+/** Process Verification Failure: Error querying debug port. */
 #define VERR_SUP_VP_NT_QI_PROCESS_DBG_PORT_ERROR    (-5655)
 /** WinVerifyTrust failed with an unexpected status code when using the
  * catalog-file approach. */
@@ -2489,7 +2536,7 @@
 #define VERR_SUP_VP_UNEXPECTED_VALID_PATH_COUNT     (-5660)
 /** The image is required to force integrity checks. */
 #define VERR_SUP_VP_SIGNATURE_CHECKS_NOT_ENFORCED   (-5661)
-/** Process Verficiation Failure: Symantec Endpoint Protection must be
+/** Process Verification Failure: Symantec Endpoint Protection must be
  * disabled for the VirtualBox VM processes.
  * http://www.symantec.com/connect/articles/creating-application-control-exclusions-symantec-endpoint-protection-121 */
 #define VERR_SUP_VP_SYSFER_DLL                      (-5662)
@@ -2501,7 +2548,7 @@
 #define VERR_SUP_VP_FREE_VIRTUAL_MEMORY_FAILED      (-5664)
 /** Process Purification Failure: Both NtUnmapViewOfSetion and
  *  NtProtectVirtualMemory failed to get rid of or passify an non-image
- *  exectuable mapping. */
+ *  executable mapping. */
 #define VERR_SUP_VP_UNMAP_AND_PROTECT_FAILED        (-5665)
 /** Process Purification Failure: Unknown memory type of executable memory.   */
 #define VERR_SUP_VP_UNKOWN_MEM_TYPE                 (-5666)
@@ -2512,7 +2559,7 @@
 /** Stub process not found so it cannot be revalidated when vboxdrv is opened
  * by the VM process. */
 #define VERR_SUP_VP_STUB_NOT_FOUND                  (-5669)
-/** Error openeing the stub process for revalidation when vboxdrv is opened by
+/** Error opening the stub process for revalidation when vboxdrv is opened by
  *  the VM process. */
 #define VERR_SUP_VP_STUB_OPEN_ERROR                 (-5670)
 /** Stub process thread not found during revalidation upon vboxdrv opening by
@@ -2558,6 +2605,35 @@
 /** @} */
 
 
+/** @name GIM Status Codes
+ * @{
+ */
+/** No GIM provider is configured for this VM. */
+#define VERR_GIM_NOT_ENABLED                        (-6300)
+/** GIM internal processing error \#1. */
+#define VERR_GIM_IPE_1                              (-6301)
+/** GIM internal processing error \#2. */
+#define VERR_GIM_IPE_2                              (-6302)
+/** GIM internal processing error \#3. */
+#define VERR_GIM_IPE_3                              (-6303)
+/** The GIM provider does not support any paravirtualized TSC. */
+#define VERR_GIM_PVTSC_NOT_AVAILABLE                (-6304)
+/** The guest has not setup use of the paravirtualized TSC. */
+#define VERR_GIM_PVTSC_NOT_ENABLED                  (-6305)
+/** Unknown or invalid GIM provider. */
+#define VERR_GIM_INVALID_PROVIDER                   (-6306)
+/** GIM generic operation failed. */
+#define VERR_GIM_OPERATION_FAILED                   (-6307)
+/** The GIM provider does not support any hypercalls. */
+#define VERR_GIM_HYPERCALLS_NOT_AVAILABLE           (-6308)
+/** The guest has not setup use of the hypercalls. */
+#define VERR_GIM_HYPERCALLS_NOT_ENABLED             (-6309)
+/** The GIM device is not registered with GIM when it ought to be. */
+#define VERR_GIM_DEVICE_NOT_REGISTERED              (-6310)
+/** Hypercall cannot be enabled/performed due to access/permissions/CPL. */
+#define VERR_GIM_HYPERCALL_ACCESS_DENIED            (-6311)
+/** @} */
+
 /** @name Main API Status Codes
  * @{
  */
@@ -2569,6 +2645,7 @@
 #define VERR_MAIN_CONFIG_CONSTRUCTOR_IPE            (-6401)
 /** @} */
 
+
 /* SED-END */
 
 /** @} */
diff --git a/include/VBox/err.mac b/include/VBox/err.mac
index 0b4d237..6151626 100644
--- a/include/VBox/err.mac
+++ b/include/VBox/err.mac
@@ -20,6 +20,7 @@
 %define VERR_TOO_MANY_CPUS    (-1019)
 %define VERR_SERVICE_DISABLED    (-1020)
 %define VERR_NOT_SUP_IN_RAW_MODE    (-1021)
+%define VERR_INVALID_CPU_INDEX    (-1022)
 %define VINF_EM_FIRST    1100
 %define VINF_EM_TERMINATE    1100
 %define VINF_EM_DBG_HYPER_STEPPED    1101
@@ -71,6 +72,7 @@
 %define VERR_EM_UNEXPECTED_MAPPING_CONFLICT    (-1154)
 %define VINF_EM_TRIPLE_FAULT    1155
 %define VERR_EM_CANNOT_EXEC_GUEST    (-1156)
+%define VINF_EM_RAW_INJECT_TRPM_EVENT    1157
 %define VERR_DBGF_NOT_ATTACHED    (-1200)
 %define VERR_DBGF_ALREADY_ATTACHED    (-1201)
 %define VWRN_DBGF_ALREADY_HALTED    1202
@@ -121,6 +123,7 @@
 %define VINF_PATM_SPINLOCK_FAILED    (1429)
 %define VINF_PATCH_CONTINUE    (1430)
 %define VERR_PATM_HM_IPE    (-1431)
+%define VERR_PATM_IPE_TRAP_IN_PATCH_CODE    (-1432)
 %define VWRN_CSAM_TRAP_NOT_HANDLED    1500
 %define VWRN_CSAM_INSTRUCTION_PATCHED    1501
 %define VWRN_CSAM_PAGE_NOT_FOUND    1502
@@ -220,6 +223,10 @@
 %define VERR_CPUM_IPE_2    (-1755)
 %define VERR_CPUM_DB_CPU_NOT_FOUND    (-1756)
 %define VERR_CPUM_MSR_BAD_CPUMCPU_OFFSET    (-1757)
+%define VINF_CPUM_R3_MSR_READ    (1758)
+%define VINF_CPUM_R3_MSR_WRITE    (1759)
+%define VERR_TOO_MANY_CPUID_LEAVES    (1760)
+%define VERR_CPUM_INVALID_CONFIG_VALUE    (1761)
 %define VERR_SSM_UNIT_EXISTS    (-1800)
 %define VERR_SSM_UNIT_NOT_FOUND    (-1801)
 %define VERR_SSM_UNIT_NOT_OWNER    (-1802)
@@ -550,6 +557,7 @@
 %define VERR_VD_UNKNOWN_CFG_VALUES    (-3212)
 %define VERR_VD_UNKNOWN_INTERFACE    (-3213)
 %define VERR_VD_DEK_MISSING    (-3214)
+%define VERR_VD_PASSWORD_INCORRECT    (-3215)
 %define VERR_VD_GEN_INVALID_HEADER    (-3220)
 %define VERR_VD_VDI_INVALID_HEADER    (-3230)
 %define VERR_VD_VDI_INVALID_SIGNATURE    (-3231)
@@ -604,6 +612,12 @@
 %define VERR_INTNET_INCOMPATIBLE_TRUNK    (-3603)
 %define VERR_INTNET_INCOMPATIBLE_FLAGS    (-3604)
 %define VERR_INTNET_FLT_VNIC_CREATE_FAILED    (-3605)
+%define VERR_INTNET_FLT_VNIC_LINK_ID_NOT_FOUND    (-3606)
+%define VERR_INTNET_FLT_VNIC_INIT_FAILED    (-3607)
+%define VERR_INTNET_FLT_VNIC_OPEN_FAILED    (-3608)
+%define VERR_INTNET_FLT_LOWER_LINK_INFO_NOT_FOUND    (-3609)
+%define VERR_INTNET_FLT_LOWER_LINK_OPEN_FAILED    (-3610)
+%define VERR_INTNET_FLT_LOWER_LINK_ID_NOT_FOUND    (-3611)
 %define VERR_SUPDRV_COMPONENT_NOT_FOUND    (-3700)
 %define VERR_SUPDRV_INTERFACE_NOT_SUPPORTED    (-3701)
 %define VERR_SUPDRV_SERVICE_NOT_FOUND    (-3702)
@@ -647,6 +661,11 @@
 %define VERR_SUPDRV_SESSION_PROCESS_ENUM_ERROR    (-3740)
 %define VERR_SUPDRV_CSRSS_NOT_FOUND    (-3741)
 %define VERR_SUPDRV_APIPORT_OPEN_ERROR_TYPE    (-3742)
+%define VERR_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED    (-3743)
+%define VERR_SUPDRV_TSC_FREQ_MEASUREMENT_FAILED    (-3744)
+%define VERR_SUPDRV_TSC_READ_FAILED    (-3745)
+%define VWRN_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED    3746
+%define VERR_SUPDRV_TSC_DELTA_MEASUREMENT_BUSY    (-3747)
 %define VERR_SUPLIB_PATH_NOT_ABSOLUTE    (-3750)
 %define VERR_SUPLIB_PATH_NOT_CLEAN    (-3751)
 %define VERR_SUPLIB_PATH_TOO_LONG    (-3752)
@@ -730,13 +749,18 @@
 %define VERR_VMX_UNDEFINED_EXIT_CODE    (-4019)
 %define VERR_VMX_VMPTRLD_FAILED    (-4021)
 %define VERR_VMX_INVALID_VMCS_PTR_TO_START_VM    (-4022)
-%define VERR_HMVMX_IPE_1    (-4023)
-%define VERR_HMVMX_IPE_2    (-4024)
-%define VERR_HMVMX_IPE_3    (-4025)
-%define VERR_HMVMX_IPE_4    (-4026)
-%define VERR_HMVMX_IPE_5    (-4027)
-%define VERR_VMX_MSR_SMX_VMXON_DISABLED    (-4028)
+%define VERR_VMX_IPE_1    (-4023)
+%define VERR_VMX_IPE_2    (-4024)
+%define VERR_VMX_IPE_3    (-4025)
+%define VERR_VMX_IPE_4    (-4026)
+%define VERR_VMX_IPE_5    (-4027)
+%define VERR_VMX_MSR_ALL_VMXON_DISABLED    (-4028)
 %define VERR_VMX_MSR_VMXON_DISABLED    (-4029)
+%define VERR_VMX_ENTRY_CTLS_CACHE_INVALID    (-4030)
+%define VERR_VMX_EXIT_CTLS_CACHE_INVALID    (-4031)
+%define VERR_VMX_PIN_EXEC_CTLS_CACHE_INVALID    (-4032)
+%define VERR_VMX_PROC_EXEC_CTLS_CACHE_INVALID    (-4033)
+%define VERR_VMX_PROC_EXEC2_CTLS_CACHE_INVALID    (-4034)
 %define VERR_SVM_UNABLE_TO_START_VM    (-4050)
 %define VERR_SVM_ILLEGAL_EFER_MSR    (-4051)
 %define VERR_SVM_NO_SVM    (-4052)
@@ -755,7 +779,7 @@
 %define VERR_HM_ALREADY_ENABLED_IPE    (-4104)
 %define VERR_HM_UNEXPECTED_LD_ST_MSR    (-4105)
 %define VERR_HM_NO_32_TO_64_SWITCHER    (-4106)
-%define VERR_HM_WRONG_CPU_1    (-4107)
+%define VERR_HM_WRONG_CPU    (-4107)
 %define VERR_HM_IPE_1    (-4108)
 %define VERR_HM_IPE_2    (-4109)
 %define VERR_HM_WRONG_SWITCHER    (-4110)
@@ -794,7 +818,7 @@
 %define VERR_COM_INVALID_SESSION_STATE    (VERR_COM_VBOX_LOWEST + 11)
 %define VERR_COM_OBJECT_IN_USE    (VERR_COM_VBOX_LOWEST + 12)
 %define VERR_COM_DONT_CALL_AGAIN    (VERR_COM_VBOX_LOWEST + 13)
-%define VERR_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST    (-4700)
+%define VERR_VMMDEV_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST    (-4700)
 %define VINF_AIO_TASK_PENDING    4800
 %define VERR_VSCSI_LUN_TYPE_NOT_SUPPORTED    (-4900)
 %define VERR_VSCSI_LUN_ATTACHED_TO_DEVICE    (-4901)
@@ -939,6 +963,18 @@
 %define VERR_EXTPACK_VBOX_VERSION_MISMATCH    (-6001)
 %define VERR_GSTCTL_GUEST_ERROR    (-6200)
 %define VWRN_GSTCTL_OBJECTSTATE_CHANGED    6220
+%define VERR_GIM_NOT_ENABLED    (-6300)
+%define VERR_GIM_IPE_1    (-6301)
+%define VERR_GIM_IPE_2    (-6302)
+%define VERR_GIM_IPE_3    (-6303)
+%define VERR_GIM_PVTSC_NOT_AVAILABLE    (-6304)
+%define VERR_GIM_PVTSC_NOT_ENABLED    (-6305)
+%define VERR_GIM_INVALID_PROVIDER    (-6306)
+%define VERR_GIM_OPERATION_FAILED    (-6307)
+%define VERR_GIM_HYPERCALLS_NOT_AVAILABLE    (-6308)
+%define VERR_GIM_HYPERCALLS_NOT_ENABLED    (-6309)
+%define VERR_GIM_DEVICE_NOT_REGISTERED    (-6310)
+%define VERR_GIM_HYPERCALL_ACCESS_DENIED    (-6311)
 %define VERR_MAIN_CONFIG_CONSTRUCTOR_COM_ERROR    (-6400)
 %define VERR_MAIN_CONFIG_CONSTRUCTOR_IPE    (-6401)
 %include "iprt/err.mac"
diff --git a/include/VBox/hgcmsvc.h b/include/VBox/hgcmsvc.h
index 9442bb7..b3412ac 100644
--- a/include/VBox/hgcmsvc.h
+++ b/include/VBox/hgcmsvc.h
@@ -107,8 +107,8 @@ typedef struct VBOXHGCMSVCPARM
         } pointer;
     } u;
 #ifdef __cplusplus
-    /** Extract a uint32_t value from an HGCM parameter structure */
-    int getUInt32 (uint32_t *u32)
+    /** Extract an uint32_t value from an HGCM parameter structure */
+    int getUInt32(uint32_t *u32)
     {
         AssertPtrReturn(u32, VERR_INVALID_POINTER);
         int rc = VINF_SUCCESS;
@@ -120,7 +120,7 @@ typedef struct VBOXHGCMSVCPARM
     }
 
     /** Extract a uint64_t value from an HGCM parameter structure */
-    int getUInt64 (uint64_t *u64)
+    int getUInt64(uint64_t *u64)
     {
         AssertPtrReturn(u64, VERR_INVALID_POINTER);
         int rc = VINF_SUCCESS;
@@ -132,7 +132,7 @@ typedef struct VBOXHGCMSVCPARM
     }
 
     /** Extract a pointer value from an HGCM parameter structure */
-    int getPointer (void **ppv, uint32_t *pcb)
+    int getPointer(void **ppv, uint32_t *pcb)
     {
         AssertPtrReturn(ppv, VERR_INVALID_POINTER);
         AssertPtrReturn(pcb, VERR_INVALID_POINTER);
@@ -147,7 +147,7 @@ typedef struct VBOXHGCMSVCPARM
     }
 
     /** Extract a constant pointer value from an HGCM parameter structure */
-    int getPointer (const void **ppcv, uint32_t *pcb)
+    int getPointer(const void **ppcv, uint32_t *pcb)
     {
         AssertPtrReturn(ppcv, VERR_INVALID_POINTER);
         AssertPtrReturn(pcb, VERR_INVALID_POINTER);
@@ -159,7 +159,7 @@ typedef struct VBOXHGCMSVCPARM
 
     /** Extract a pointer value to a non-empty buffer from an HGCM parameter
      * structure */
-    int getBuffer (void **ppv, uint32_t *pcb)
+    int getBuffer(void **ppv, uint32_t *pcb)
     {
         AssertPtrReturn(ppv, VERR_INVALID_POINTER);
         AssertPtrReturn(pcb, VERR_INVALID_POINTER);
@@ -180,7 +180,7 @@ typedef struct VBOXHGCMSVCPARM
 
     /** Extract a pointer value to a non-empty constant buffer from an HGCM
      * parameter structure */
-    int getBuffer (const void **ppcv, uint32_t *pcb)
+    int getBuffer(const void **ppcv, uint32_t *pcb)
     {
         AssertPtrReturn(ppcv, VERR_INVALID_POINTER);
         AssertPtrReturn(pcb, VERR_INVALID_POINTER);
@@ -191,7 +191,7 @@ typedef struct VBOXHGCMSVCPARM
     }
 
     /** Extract a string value from an HGCM parameter structure */
-    int getString (char **ppch, uint32_t *pcb)
+    int getString(char **ppch, uint32_t *pcb)
     {
         uint32_t cb = 0;
         char *pch = NULL;
@@ -210,7 +210,7 @@ typedef struct VBOXHGCMSVCPARM
     }
 
     /** Extract a constant string value from an HGCM parameter structure */
-    int getString (const char **ppch, uint32_t *pcb)
+    int getString(const char **ppch, uint32_t *pcb)
     {
         char *pch = NULL;
         int rc = getString(&pch, pcb);
@@ -248,6 +248,16 @@ typedef struct VBOXHGCMSVCPARM
         u.pointer.size = (uint32_t)strlen(psz) + 1;
     }
 
+#ifdef ___iprt_cpp_ministring_h
+    /** Set a const string value to an HGCM parameter structure */
+    void setCppString(const RTCString &rString)
+    {
+        type = VBOX_HGCM_SVC_PARM_PTR;
+        u.pointer.addr = (void *)rString.c_str();
+        u.pointer.size = (uint32_t)rString.length() + 1;
+    }
+#endif
+
 #ifdef VBOX_TEST_HGCM_PARMS
     /** Test the getString member function.  Indirectly tests the getPointer
      * and getBuffer APIs.
diff --git a/include/VBox/intnet.h b/include/VBox/intnet.h
index e032baf..19d398b 100644
--- a/include/VBox/intnet.h
+++ b/include/VBox/intnet.h
@@ -386,6 +386,41 @@ typedef enum INTNETSWDECISION
 } INTNETSWDECISION;
 
 
+/**
+ * Network layer address type.
+ */
+typedef enum INTNETADDRTYPE
+{
+    /** The invalid 0 entry. */
+    kIntNetAddrType_Invalid = 0,
+    /** IP version 4. */
+    kIntNetAddrType_IPv4,
+    /** IP version 6. */
+    kIntNetAddrType_IPv6,
+    /** IPX. */
+    kIntNetAddrType_IPX,
+    /** The end of the valid values. */
+    kIntNetAddrType_End,
+    /** The usual 32-bit hack. */
+    kIntNetAddrType_32BitHack = 0x7fffffff
+} INTNETADDRTYPE;
+
+
+/** Pointer to the interface side of a trunk port. */
+typedef struct INTNETTRUNKIFPORT *PINTNETTRUNKIFPORT;
+
+
+/**
+ * Special variation of INTNETTRUNKIFPORT::pfnRelease for use with
+ * INTNETTRUNKSWPORT::pfnDisconnect.
+ *
+ * @param   pIfPort     Pointer to the INTNETTRUNKIFPORT instance.
+ */
+typedef DECLCALLBACK(void) FNINTNETTRUNKIFPORTRELEASEBUSY(PINTNETTRUNKIFPORT pIfPort);
+/** Pointer to a FNINTNETTRUNKIFPORTRELEASEBUSY function. */
+typedef FNINTNETTRUNKIFPORTRELEASEBUSY *PFNINTNETTRUNKIFPORTRELEASEBUSY;
+
+
 /** Pointer to the switch side of a trunk port. */
 typedef struct INTNETTRUNKSWPORT *PINTNETTRUNKSWPORT;
 /**
@@ -560,12 +595,51 @@ typedef struct INTNETTRUNKSWPORT
      */
     DECLR0CALLBACKMEMBER(void, pfnReportNoPreemptDsts,(PINTNETTRUNKSWPORT pSwitchPort, uint32_t fNoPreemptDsts));
 
+    /**
+     * Notifications about changes to host IP addresses.
+     *
+     * This is used by networks bridged to wifi that share mac with
+     * the host.  Host reports changes to its IP addresses so that L3
+     * switching can ingore guests spoofing host's own IP addresses
+     *
+     * This callback may be null to indicate we are not interested.
+     *
+     * @param   pSwitchPort         Pointer to this structure.
+     * @param   fAdded              Whether address is added of removed.
+     * @param   enmType             Address type.
+     * @param   pvAddr              Pointer to the address.
+     */
+    DECLR0CALLBACKMEMBER(void, pfnNotifyHostAddress,(PINTNETTRUNKSWPORT pSwitchPort, bool fAdded,
+                                                     INTNETADDRTYPE enmType, const void *pvAddr));
+
+    /**
+     * OS triggered trunk disconnect.
+     *
+     * The caller shall must be busy when calling this method to prevent racing the
+     * network destruction code. This method will always consume this busy reference
+     * (released via @a pfnReleaseBusy using @a pIfPort).
+     *
+     * The caller shall guarantee that there are absolutely no chance of concurrent
+     * calls to this method on the same instance.
+     *
+     * @param   pSwitchPort         Pointer to this structure.
+     * @param   pIfPort             The interface port structure corresponding to @a
+     *                              pSwitchPort and which should be used when
+     *                              calling @a pfnReleaseBusy.  This is required as
+     *                              the method may no longer have access to a valid
+     *                              @a pIfPort pointer.
+     * @param   pfnReleaseBusy      Callback for releasing the callers busy
+     *                              reference to it's side of things.
+     */
+    DECLR0CALLBACKMEMBER(void, pfnDisconnect,(PINTNETTRUNKSWPORT pSwitchPort, PINTNETTRUNKIFPORT pIfPort,
+                                              PFNINTNETTRUNKIFPORTRELEASEBUSY pfnReleaseBusy));
+
     /** Structure version number. (INTNETTRUNKSWPORT_VERSION) */
     uint32_t u32VersionEnd;
 } INTNETTRUNKSWPORT;
 
 /** Version number for the INTNETTRUNKIFPORT::u32Version and INTNETTRUNKIFPORT::u32VersionEnd fields. */
-#define INTNETTRUNKSWPORT_VERSION   UINT32_C(0xA2CDf001)
+# define INTNETTRUNKSWPORT_VERSION   UINT32_C(0xA2CDf004)
 
 
 /**
@@ -589,8 +663,7 @@ typedef enum INTNETTRUNKIFSTATE
     INTNETTRUNKIFSTATE_32BIT_HACK = 0x7fffffff
 } INTNETTRUNKIFSTATE;
 
-/** Pointer to the interface side of a trunk port. */
-typedef struct INTNETTRUNKIFPORT *PINTNETTRUNKIFPORT;
+
 /**
  * This is the port on the trunk interface, i.e. the driver side which the
  * internal network is connected to.
@@ -618,7 +691,6 @@ typedef struct INTNETTRUNKIFPORT
      *
      * This must be called for every pfnRetain call.
      *
-     *
      * @param   pIfPort     Pointer to this structure.
      *
      * @remarks May own the big mutex, no spinlocks.
diff --git a/include/VBox/log.h b/include/VBox/log.h
index 2ac9ad6..0e5182d 100644
--- a/include/VBox/log.h
+++ b/include/VBox/log.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -97,6 +97,8 @@ typedef enum LOGGROUP
     LOG_GROUP_DEV_EHCI,
     /** Floppy Controller Device group. */
     LOG_GROUP_DEV_FDC,
+    /** Guest Interface Manager Device group. */
+    LOG_GROUP_DEV_GIM,
     /** High Precision Event Timer Device group. */
     LOG_GROUP_DEV_HPET,
     /** IDE Device group. */
@@ -201,6 +203,8 @@ typedef enum LOGGROUP
     LOG_GROUP_DRV_SCSI,
     /** Host SCSI driver group. */
     LOG_GROUP_DRV_SCSIHOST,
+    /** TCP socket stream driver group. */
+    LOG_GROUP_DRV_TCP,
     /** Async transport driver group */
     LOG_GROUP_DRV_TRANSPORT_ASYNC,
     /** TUN network transport driver group */
@@ -221,10 +225,14 @@ typedef enum LOGGROUP
     LOG_GROUP_EM,
     /** FTM group. */
     LOG_GROUP_FTM,
+    /** GIM group. */
+    LOG_GROUP_GIM,
     /** GMM group. */
     LOG_GROUP_GMM,
     /** Guest control. */
     LOG_GROUP_GUEST_CONTROL,
+    /** Guest drag'n drop. */
+    LOG_GROUP_GUEST_DND,
     /** GUI group. */
     LOG_GROUP_GUI,
     /** GVMM group. */
@@ -333,8 +341,16 @@ typedef enum LOGGROUP
     LOG_GROUP_MAIN_DIRECTORY,
     /** Main group, IDisplay. */
     LOG_GROUP_MAIN_DISPLAY,
-    /** Main group, IDragAndDropModeChangedEvent. */
-    LOG_GROUP_MAIN_DRAGANDDROPMODECHANGEDEVENT,
+    /** Main group, IDisplaySourceBitmap. */
+    LOG_GROUP_MAIN_DISPLAYSOURCEBITMAP,
+    /** Main group, IDnDBase. */
+    LOG_GROUP_MAIN_DNDBASE,
+    /** Main group, IDnDModeChangedEvent. */
+    LOG_GROUP_MAIN_DNDMODECHANGEDEVENT,
+    /** Main group, IDnDSource. */
+    LOG_GROUP_MAIN_DNDSOURCE,
+    /** Main group, IDnDTarget. */
+    LOG_GROUP_MAIN_DNDTARGET,
     /** Main group, IEmulatedUSB. */
     LOG_GROUP_MAIN_EMULATEDUSB,
     /** Main group, IEvent. */
@@ -371,6 +387,10 @@ typedef enum LOGGROUP
     LOG_GROUP_MAIN_GUEST,
     /** Main group, IGuestDirectory. */
     LOG_GROUP_MAIN_GUESTDIRECTORY,
+    /** Main group, IGuestDnDSource. */
+    LOG_GROUP_MAIN_GUESTDNDSOURCE,
+    /** Main group, IGuestDnDTarget. */
+    LOG_GROUP_MAIN_GUESTDNDTARGET,
     /** Main group, IGuestErrorInfo. */
     LOG_GROUP_MAIN_GUESTERRORINFO,
     /** Main group, IGuestFile. */
@@ -475,6 +495,8 @@ typedef enum LOGGROUP
     LOG_GROUP_MAIN_MOUSE,
     /** Main group, IMouseCapabilityChangedEvent. */
     LOG_GROUP_MAIN_MOUSECAPABILITYCHANGEDEVENT,
+    /** Main group, IMousePointerShape. */
+    LOG_GROUP_MAIN_MOUSEPOINTERSHAPE,
     /** Main group, IMousePointerShapeChangedEvent. */
     LOG_GROUP_MAIN_MOUSEPOINTERSHAPECHANGEDEVENT,
     /** Main group, INATEngine. */
@@ -542,6 +564,8 @@ typedef enum LOGGROUP
     /** Main group, ISnapshotEvent. */
     LOG_GROUP_MAIN_SNAPSHOTEVENT,
     /** Main group, ISnapshotTakenEvent. */
+    LOG_GROUP_MAIN_SNAPSHOTRESTOREDEVENT,
+    /** Main group, ISnapshotRestoredEvent. */
     LOG_GROUP_MAIN_SNAPSHOTTAKENEVENT,
     /** Main group, IStateChangedEvent. */
     LOG_GROUP_MAIN_STATECHANGEDEVENT,
@@ -717,6 +741,8 @@ typedef enum LOGGROUP
     LOG_GROUP_VD_VDI,
     /** VHD virtual disk backend. */
     LOG_GROUP_VD_VHD,
+    /** VHDX virtual disk backend. */
+    LOG_GROUP_VD_VHDX,
     /** VMDK virtual disk backend. */
     LOG_GROUP_VD_VMDK,
     /** VM group. */
@@ -771,6 +797,7 @@ typedef enum LOGGROUP
     "DEV_EFI",      \
     "DEV_EHCI",     \
     "DEV_FDC",      \
+    "DEV_GIM",      \
     "DEV_HPET",     \
     "DEV_IDE",      \
     "DEV_INIP",     \
@@ -823,6 +850,7 @@ typedef enum LOGGROUP
     "DRV_RAW_IMAGE", \
     "DRV_SCSI",     \
     "DRV_SCSIHOST", \
+    "DRV_TELNETSERVER", \
     "DRV_TRANSPORT_ASYNC", \
     "DRV_TUN",      \
     "DRV_UDPTUNNEL", \
@@ -833,8 +861,10 @@ typedef enum LOGGROUP
     "DRV_VUSB",     \
     "EM",           \
     "FTM",          \
+    "GIM",          \
     "GMM",          \
     "GUEST_CONTROL", \
+    "GUEST_DND",    \
     "GUI",          \
     "GVMM",         \
     "HGCM",         \
@@ -889,7 +919,11 @@ typedef enum LOGGROUP
     "MAIN_DHCPSERVER", \
     "MAIN_DIRECTORY", \
     "MAIN_DISPLAY", \
-    "MAIN_DRAGANDDROPMODECHANGEDEVENT", \
+    "MAIN_DISPLAYSOURCEBITMAP", \
+    "MAIN_DNDBASE", \
+    "MAIN_DNDMODECHANGEDEVENT", \
+    "MAIN_DNDSOURCE", \
+    "MAIN_DNDTARGET", \
     "MAIN_EMULATEDUSB",   \
     "MAIN_EVENT",   \
     "MAIN_EVENTLISTENER", \
@@ -908,6 +942,8 @@ typedef enum LOGGROUP
     "MAIN_FSOBJINFO", \
     "MAIN_GUEST",   \
     "MAIN_GUESTDIRECTORY", \
+    "MAIN_GUESTDNDSOURCE", \
+    "MAIN_GUESTDNDTARGET", \
     "MAIN_GUESTERRORINFO", \
     "MAIN_GUESTFILE", \
     "MAIN_GUESTFILEEVENT", \
@@ -960,6 +996,7 @@ typedef enum LOGGROUP
     "MAIN_MEDIUMREGISTEREDEVENT", \
     "MAIN_MOUSE",   \
     "MAIN_MOUSECAPABILITYCHANGEDEVENT", \
+    "MAIN_MOUSEPOINTERSHAPE", \
     "MAIN_MOUSEPOINTERSHAPECHANGEDEVENT", \
     "MAIN_NATENGINE", \
     "MAIN_NATNETWORK", \
@@ -993,6 +1030,7 @@ typedef enum LOGGROUP
     "MAIN_SNAPSHOTCHANGEDEVENT", \
     "MAIN_SNAPSHOTDELETEDEVENT", \
     "MAIN_SNAPSHOTEVENT", \
+    "MAIN_SNAPSHOTRESTOREDEVENT", \
     "MAIN_SNAPSHOTTAKENEVENT", \
     "MAIN_STATECHANGEDEVENT", \
     "MAIN_STORAGECONTROLLER", \
@@ -1081,6 +1119,7 @@ typedef enum LOGGROUP
     "VD_RAW",       \
     "VD_VDI",       \
     "VD_VHD",       \
+    "VD_VHDX",      \
     "VD_VMDK",      \
     "VM",           \
     "VMM",          \
diff --git a/include/VBox/ostypes.h b/include/VBox/ostypes.h
index c197fe3..426300f 100644
--- a/include/VBox/ostypes.h
+++ b/include/VBox/ostypes.h
@@ -76,6 +76,7 @@ typedef enum VBOXOSTYPE
     VBOXOSTYPE_OS2Warp4         = 0x42000,
     VBOXOSTYPE_OS2Warp45        = 0x43000,
     VBOXOSTYPE_ECS              = 0x44000,
+    VBOXOSTYPE_OS21x            = 0x48000,
     VBOXOSTYPE_Linux            = 0x50000,
     VBOXOSTYPE_Linux_x64        = 0x50100,
     VBOXOSTYPE_Linux22          = 0x51000,
diff --git a/include/VBox/param.h b/include/VBox/param.h
index 86a5c11..35228c8 100644
--- a/include/VBox/param.h
+++ b/include/VBox/param.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -52,7 +52,6 @@
 
 
 /** @defgroup   grp_vbox_param_mm  Memory Monitor Parameters
- * @ingroup grp_vbox_param
  * @{
  */
 /** Initial address of Hypervisor Memory Area.
@@ -89,7 +88,6 @@
 
 
 /** @defgroup   grp_vbox_param_pgm  Page Manager Parameters
- * @ingroup grp_vbox_param
  * @{
  */
 /** The number of handy pages.
@@ -123,7 +121,6 @@
 
 
 /** @defgroup   grp_vbox_param_vmm  VMM Parameters
- * @ingroup grp_vbox_param
  * @{
  */
 /** VMM stack size. */
diff --git a/include/VBox/settings.h b/include/VBox/settings.h
index 03018f5..9ca23f8 100644
--- a/include/VBox/settings.h
+++ b/include/VBox/settings.h
@@ -17,7 +17,7 @@
  */
 
 /*
- * Copyright (C) 2007-2013 Oracle Corporation
+ * Copyright (C) 2007-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -51,11 +51,21 @@
 #include <map>
 
 /**
- * Maximum depth of the snapshot tree, to prevent stack overflows.
+ * Maximum depth of a medium tree, to prevent stack overflows.
  * XPCOM has a relatively low stack size for its workers, and we have
  * to avoid crashes due to exceeding the limit both on reading and
  * writing config files.
  */
+#define SETTINGS_MEDIUM_DEPTH_MAX 300
+
+/**
+ * Maximum depth of the snapshot tree, to prevent stack overflows.
+ * XPCOM has a relatively low stack size for its workers, and we have
+ * to avoid crashes due to exceeding the limit both on reading and
+ * writing config files. The bottleneck is reading config files with
+ * deep snapshot nesting, as libxml2 needs quite some stack space,
+ * so with the current stack size the margin isn't big.
+ */
 #define SETTINGS_SNAPSHOT_DEPTH_MAX 250
 
 namespace xml
@@ -143,6 +153,8 @@ struct Medium
     bool operator==(const Medium &m) const;
 };
 
+extern const struct Medium g_MediumEmpty;
+
 /**
  * A media registry. Starting with VirtualBox 3.3, this can appear in both the
  * VirtualBox.xml file as well as machine XML files with settings version 1.11
@@ -228,19 +240,21 @@ protected:
 
     ~ConfigFileBase();
 
+    typedef enum {Error, HardDisk, DVDImage, FloppyImage} MediaType;
+
+    static const char *stringifyMediaType(MediaType t);
     void parseUUID(com::Guid &guid,
                    const com::Utf8Str &strUUID) const;
     void parseTimestamp(RTTIMESPEC &timestamp,
                         const com::Utf8Str &str) const;
-
-    com::Utf8Str makeString(const RTTIMESPEC &tm);
+    com::Utf8Str stringifyTimestamp(const RTTIMESPEC &tm) const;
 
     void readExtraData(const xml::ElementNode &elmExtraData,
                        StringsMap &map);
     void readUSBDeviceFilters(const xml::ElementNode &elmDeviceFilters,
                               USBDeviceFiltersList &ll);
-    typedef enum {Error, HardDisk, DVDImage, FloppyImage} MediaType;
-    void readMedium(MediaType t, const xml::ElementNode &elmMedium, MediaList &llMedia);
+    void readMediumOne(MediaType t, const xml::ElementNode &elmMedium, Medium &med);
+    void readMedium(MediaType t, uint32_t depth, const xml::ElementNode &elmMedium, Medium &med);
     void readMediaRegistry(const xml::ElementNode &elmMediaRegistry, MediaRegistry &mr);
     void readNATForwardRuleList(const xml::ElementNode  &elmParent, NATRuleList &llRules);
     void readNATLoopbacks(const xml::ElementNode &elmParent, NATLoopbackOffsetList &llLoopBacks);
@@ -252,10 +266,10 @@ protected:
     void buildUSBDeviceFilters(xml::ElementNode &elmParent,
                                const USBDeviceFiltersList &ll,
                                bool fHostMode);
-    void buildMedium(xml::ElementNode &elmMedium,
-                     DeviceType_T devType,
-                     const Medium &m,
-                     uint32_t level);
+    void buildMedium(MediaType t,
+                     uint32_t depth,
+                     xml::ElementNode &elmMedium,
+                     const Medium &mdm);
     void buildMediaRegistry(xml::ElementNode &elmParent,
                             const MediaRegistry &mr);
     void buildNATForwardRuleList(xml::ElementNode &elmParent, const NATRuleList &natRuleList);
@@ -314,8 +328,8 @@ typedef std::list<MachineRegistryEntry> MachinesRegistry;
 struct DhcpOptValue
 {
     enum Encoding {
-	LEGACY,
-	HEX
+	LEGACY = DhcpOptEncoding_Legacy,
+	HEX = DhcpOptEncoding_Hex
     };
 
     com::Utf8Str text;
@@ -882,6 +896,11 @@ struct Hardware
 
     bool operator==(const Hardware&) const;
 
+    bool areParavirtDefaultSettings() const
+    {
+        return paravirtProvider == ParavirtProvider_Legacy;
+    }
+
     com::Utf8Str        strVersion;             // hardware version, optional
     com::Guid           uuid;                   // hardware uuid, optional (null).
 
@@ -901,6 +920,7 @@ struct Hardware
     CpuList             llCpus;                 // requires settings version 1.10 (VirtualBox 3.2)
     bool                fHPETEnabled;           // requires settings version 1.10 (VirtualBox 3.2)
     uint32_t            ulCpuExecutionCap;      // requires settings version 1.11 (VirtualBox 3.3)
+    uint32_t            uCpuIdPortabilityLevel; // requires settings version 1.15 (VirtualBox 5.0)
 
     CpuIdLeafsList      llCpuIdLeafs;
 
@@ -918,6 +938,8 @@ struct Hardware
     uint32_t            ulVideoCaptureVertRes;  // requires settings version 1.14 (VirtualBox 4.3)
     uint32_t            ulVideoCaptureRate;     // requires settings version 1.14 (VirtualBox 4.3)
     uint32_t            ulVideoCaptureFPS;      // requires settings version 1.14 (VirtualBox 4.3)
+    uint32_t            ulVideoCaptureMaxTime;  // requires settings version 1.14 (VirtualBox 4.3)
+    uint32_t            ulVideoCaptureMaxSize;  // requires settings version 1.14 (VirtualBox 4.3)
     bool                fVideoCaptureEnabled;   // requires settings version 1.14 (VirtualBox 4.3)
     uint64_t            u64VideoCaptureScreens; // requires settings version 1.14 (VirtualBox 4.3)
     com::Utf8Str        strVideoCaptureFile;    // requires settings version 1.14 (VirtualBox 4.3)
@@ -928,6 +950,7 @@ struct Hardware
     KeyboardHIDType_T   keyboardHIDType;        // requires settings version 1.10 (VirtualBox 3.2)
 
     ChipsetType_T       chipsetType;            // requires settings version 1.11 (VirtualBox 4.0)
+    ParavirtProvider_T  paravirtProvider;       // requires settings version 1.15 (VirtualBox 4.4)
 
     bool                fEmulatedUSBCardReader; // 1.12 (VirtualBox 4.1)
 
@@ -944,7 +967,7 @@ struct Hardware
     // clever reason <Hardware> is where they are in the XML....
     SharedFoldersList   llSharedFolders;
     ClipboardMode_T     clipboardMode;
-    DragAndDropMode_T   dragAndDropMode;
+    DnDMode_T           dndMode;
 
     uint32_t            ulMemoryBalloonSize;
     bool                fPageFusionEnabled;
@@ -1142,6 +1165,11 @@ typedef std::list<Snapshot> SnapshotsList;
  */
 struct Snapshot
 {
+    Snapshot()
+    {
+        RTTimeSpecSetNano(&timestamp, 0);
+    }
+
     bool operator==(const Snapshot &s) const;
 
     com::Guid       uuid;
@@ -1217,6 +1245,8 @@ struct MachineUserData
     com::Utf8Str            ovIcon;
 };
 
+extern const struct Snapshot g_SnapshotEmpty;
+
 /**
  * MachineConfigFile represents an XML machine configuration. All the machine settings
  * that go out to the XML (or are read from it) are in here.
diff --git a/include/VBox/shflsvc.h b/include/VBox/shflsvc.h
index bf8c1bc..e32da2e 100644
--- a/include/VBox/shflsvc.h
+++ b/include/VBox/shflsvc.h
@@ -193,7 +193,7 @@ DECLINLINE(PSHFLSTRING) ShflStringInitBuffer(void *pvBuffer, uint32_t u32Size)
     PSHFLSTRING pString = NULL;
     const uint32_t u32HeaderSize = SHFLSTRING_HEADER_SIZE;
 
-    /* 
+    /*
      * Check that the buffer size is big enough to hold a zero sized string
      * and is not too big to fit into 16 bit variables.
      */
diff --git a/include/VBox/sup.h b/include/VBox/sup.h
index 4dbda19..d4b781d 100644
--- a/include/VBox/sup.h
+++ b/include/VBox/sup.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -28,9 +28,13 @@
 
 #include <VBox/cdefs.h>
 #include <VBox/types.h>
+#include <VBox/err.h>
 #include <iprt/assert.h>
 #include <iprt/stdarg.h>
 #include <iprt/cpuset.h>
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+# include <iprt/asm-amd64-x86.h>
+#endif
 
 RT_C_DECLS_BEGIN
 
@@ -92,7 +96,7 @@ typedef enum SUPPAGINGMODE
 } SUPPAGINGMODE;
 
 
-/** Flags returned by SUPR0GetKernelFeatures().
+/** @name Flags returned by SUPR0GetKernelFeatures().
  * @{
  */
 /** GDT is read-only. */
@@ -169,6 +173,34 @@ typedef SUPDRVTRACERUSRCTX *PSUPDRVTRACERUSRCTX;
 typedef SUPDRVTRACERUSRCTX const *PCSUPDRVTRACERUSRCTX;
 
 /**
+ * The result of a modification operation (SUPMSRPROBEROP_MODIFY or
+ * SUPMSRPROBEROP_MODIFY_FASTER).
+ */
+typedef struct SUPMSRPROBERMODIFYRESULT
+{
+    /** The MSR value prior to the modifications.  Valid if fBeforeGp is false */
+    uint64_t        uBefore;
+    /** The value that was written.  Valid if fBeforeGp is false */
+    uint64_t        uWritten;
+    /** The MSR value after the modifications. Valid if AfterGp is false. */
+    uint64_t        uAfter;
+    /** Set if we GPed reading the MSR before the modification. */
+    bool            fBeforeGp;
+    /** Set if we GPed while trying to write the modified value.
+     * This is set when fBeforeGp is true. */
+    bool            fModifyGp;
+    /** Set if we GPed while trying to read the MSR after the modification.
+     * This is set when fBeforeGp is true. */
+    bool            fAfterGp;
+    /** Set if we GPed while trying to restore the MSR after the modification.
+     * This is set when fBeforeGp is true. */
+    bool            fRestoreGp;
+    /** Structure size alignment padding. */
+    bool            afReserved[4];
+} SUPMSRPROBERMODIFYRESULT, *PSUPMSRPROBERMODIFYRESULT;
+
+
+/**
  * The CPU state.
  */
 typedef enum SUPGIPCPUSTATE
@@ -207,6 +239,8 @@ typedef struct SUPGIPCPU
     volatile uint64_t   u64TSC;
     /** Current CPU Frequency. */
     volatile uint64_t   u64CpuHz;
+    /** The TSC delta with reference to the master TSC, subtract from RDTSC. */
+    volatile int64_t    i64TSCDelta;
     /** Number of errors during updating.
      * Typical errors are under/overflows. */
     volatile uint32_t   cErrors;
@@ -221,7 +255,13 @@ typedef struct SUPGIPCPU
     volatile uint32_t   u32PrevUpdateIntervalNS;
 
     /** Reserved for future per processor data. */
-    volatile uint32_t   au32Reserved[5+5];
+    volatile uint32_t   au32Reserved0[5];
+
+    /** The TSC value read while doing TSC delta measurements across CPUs. */
+    volatile uint64_t   u64TSCSample;
+
+    /** Reserved for future per processor data. */
+    volatile uint32_t   au32Reserved1[1];
 
     /** @todo Add topology/NUMA info. */
     /** The CPU state. */
@@ -243,6 +283,59 @@ AssertCompileMemberAlignment(SUPGIPCPU, u64TSC, 8);
 typedef SUPGIPCPU *PSUPGIPCPU;
 
 
+/**
+ * The rules concerning the applicability of SUPGIPCPU::i64TscDelta.
+ */
+typedef enum SUPGIPUSETSCDELTA
+{
+    /** Value for SUPGIPMODE_ASYNC_TSC. */
+    SUPGIPUSETSCDELTA_NOT_APPLICABLE = 0,
+    /** The OS specific part of SUPDrv (or the user) claims the TSC is as
+     * good as zero. */
+    SUPGIPUSETSCDELTA_ZERO_CLAIMED,
+    /** The differences in RDTSC output between the CPUs/cores/threads should
+     * be considered zero for all practical purposes. */
+    SUPGIPUSETSCDELTA_PRACTICALLY_ZERO,
+    /** The differences in RDTSC output between the CPUs/cores/threads are a few
+     * hundred ticks or less.  (Probably not worth calling ASMGetApicId two times
+     * just to apply deltas.) */
+    SUPGIPUSETSCDELTA_ROUGHLY_ZERO,
+    /** Significant differences in RDTSC output between the CPUs/cores/threads,
+     * deltas must be applied. */
+    SUPGIPUSETSCDELTA_NOT_ZERO,
+    /** End of valid values (exclusive). */
+    SUPGIPUSETSCDELTA_END,
+    /** Make sure the type is 32-bit sized. */
+    SUPGIPUSETSCDELTA_32BIT_HACK = 0x7fffffff
+} SUPGIPUSETSCDELTA;
+
+
+/** @name SUPGIPGETCPU_XXX - methods that aCPUs can be indexed.
+ * @{
+ */
+/** Use ASMGetApicId (or equivalent) and translate the result via
+ *  aiCpuFromApicId. */
+#define SUPGIPGETCPU_APIC_ID                        RT_BIT_32(0)
+/** Use RDTSCP and translate the first RTCPUSET_MAX_CPUS of ECX via
+ * aiCpuFromCpuSetIdx.
+ *
+ * Linux stores the RTMpCpuId() value in ECX[11:0] and NUMA node number in
+ * ECX[12:31].  Solaris only stores RTMpCpuId() in ECX.  On both systems
+ * RTMpCpuId() == RTMpCpuIdToSetIndex(RTMpCpuId()).  RTCPUSET_MAX_CPUS is
+ * currently 64, 256 or 1024 in size, which lower than
+ * 4096, so there shouldn't be any range issues. */
+#define SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS       RT_BIT_32(1)
+/** Subtract the max IDT size from IDTR.LIMIT, extract the
+ * first RTCPUSET_MAX_CPUS and translate it via aiCpuFromCpuSetIdx.
+ *
+ * Darwin stores the RTMpCpuId() (== RTMpCpuIdToSetIndex(RTMpCpuId()))
+ * value in the IDT limit.  The masking is a precaution against what linux
+ * does with RDTSCP. */
+#define SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS   RT_BIT_32(2)
+/* Linux also offers information via selector 0x78, but we'll settle for
+   RDTSCP for now. */
+/** @} */
+
 
 /**
  * Global Information Page.
@@ -271,6 +364,8 @@ typedef struct SUPGLOBALINFOPAGE
     volatile uint32_t   u32UpdateIntervalNS;
     /** The timestamp of the last time we update the update frequency. */
     volatile uint64_t   u64NanoTSLastUpdateHz;
+    /** The TSC frequency of the system. */
+    uint64_t            u64CpuHz;
     /** The set of online CPUs. */
     RTCPUSET            OnlineCpuSet;
     /** The set of present CPUs. */
@@ -283,13 +378,17 @@ typedef struct SUPGLOBALINFOPAGE
     volatile uint16_t   cPresentCpus;
     /** The highest number of CPUs possible. */
     uint16_t            cPossibleCpus;
-    /** The highest number of CPUs possible. */
     uint16_t            u16Padding0;
     /** The max CPU ID (RTMpGetMaxCpuId). */
     RTCPUID             idCpuMax;
+    /** The applicability of SUPGIPCPU::i64TscDelta. */
+    SUPGIPUSETSCDELTA   enmUseTscDelta;
+    /** Mask of SUPGIPGETCPU_XXX values that indicates different ways that aCPU
+     * can be accessed from ring-3 and raw-mode context. */
+    uint32_t            fGetGipCpu;
 
     /** Padding / reserved space for future data. */
-    uint32_t            au32Padding1[29];
+    uint32_t            au32Padding1[25];
 
     /** Table indexed by the CPU APIC ID to get the CPU table index. */
     uint16_t            aiCpuFromApicId[256];
@@ -299,9 +398,10 @@ typedef struct SUPGLOBALINFOPAGE
     /** Array of per-cpu data.
      * This is index by ApicId via the aiCpuFromApicId table.
      *
-     * The clock and frequency information is updated for all CPUs if u32Mode
-     * is SUPGIPMODE_ASYNC_TSC, otherwise (SUPGIPMODE_SYNC_TSC) only the first
-     * entry is updated. */
+     * The clock and frequency information is updated for all CPUs if @c u32Mode
+     * is SUPGIPMODE_ASYNC_TSC. If @c u32Mode is SUPGIPMODE_SYNC_TSC only the first
+     * entry is updated. If @c u32Mode is SUPGIPMODE_SYNC_TSC the TSC frequency in
+     * @c u64CpuHz is copied to all CPUs. */
     SUPGIPCPU           aCPUs[1];
 } SUPGLOBALINFOPAGE;
 AssertCompileMemberAlignment(SUPGLOBALINFOPAGE, u64NanoTSLastUpdateHz, 8);
@@ -321,7 +421,7 @@ typedef SUPGLOBALINFOPAGE *PSUPGLOBALINFOPAGE;
 /** The GIP version.
  * Upper 16 bits is the major version. Major version is only changed with
  * incompatible changes in the GIP. */
-#define SUPGLOBALINFOPAGE_VERSION   0x00030000
+#define SUPGLOBALINFOPAGE_VERSION   0x00060000
 
 /**
  * SUPGLOBALINFOPAGE::u32Mode values.
@@ -334,6 +434,10 @@ typedef enum SUPGIPMODE
     SUPGIPMODE_SYNC_TSC,
     /** Each core has it's own TSC. */
     SUPGIPMODE_ASYNC_TSC,
+    /** The TSC of the cores are non-stop and have a constant frequency. */
+    SUPGIPMODE_INVARIANT_TSC,
+    /** End of valid GIP mode values (exclusive). */
+    SUPGIPMODE_END,
     /** The usual 32-bit hack. */
     SUPGIPMODE_32BIT_HACK = 0x7fffffff
 } SUPGIPMODE;
@@ -350,7 +454,7 @@ typedef enum SUPGIPMODE
  *          thinking that values doesn't change even if members are marked
  *          as volatile. Thus, there is no PCSUPGLOBALINFOPAGE type.
  */
-#if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_RC)
+#if defined(IN_SUP_R3) || defined(IN_SUP_R0)
 extern DECLEXPORT(PSUPGLOBALINFOPAGE)   g_pSUPGlobalInfoPage;
 
 #elif !defined(IN_RING0) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS)
@@ -384,33 +488,233 @@ extern DECLIMPORT(SUPGLOBALINFOPAGE)    g_SUPGlobalInfoPage;
  */
 SUPDECL(PSUPGLOBALINFOPAGE)             SUPGetGIP(void);
 
-#ifdef ___iprt_asm_amd64_x86_h
+
+/** @internal  */
+SUPDECL(uint64_t) SUPGetCpuHzFromGipForAsyncMode(PSUPGLOBALINFOPAGE pGip);
+
 /**
  * Gets the TSC frequency of the calling CPU.
  *
- * @returns TSC frequency, UINT64_MAX on failure.
+ * @returns TSC frequency, UINT64_MAX on failure (asserted).
  * @param   pGip        The GIP pointer.
  */
-DECLINLINE(uint64_t) SUPGetCpuHzFromGIP(PSUPGLOBALINFOPAGE pGip)
+DECLINLINE(uint64_t) SUPGetCpuHzFromGip(PSUPGLOBALINFOPAGE pGip)
 {
-    unsigned iCpu;
+    if (RT_LIKELY(   pGip
+                  && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC))
+    {
+        switch (pGip->u32Mode)
+        {
+            case SUPGIPMODE_INVARIANT_TSC:
+            case SUPGIPMODE_SYNC_TSC:
+                return pGip->aCPUs[0].u64CpuHz;
+            case SUPGIPMODE_ASYNC_TSC:
+                return SUPGetCpuHzFromGipForAsyncMode(pGip);
+            default: break; /* shut up gcc */
+        }
+    }
+    AssertFailed();
+    return UINT64_MAX;
+}
 
-    if (RT_UNLIKELY(!pGip || pGip->u32Magic != SUPGLOBALINFOPAGE_MAGIC))
-        return UINT64_MAX;
 
-    if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
-        iCpu = 0;
-    else
+/**
+ * Gets the TSC frequency of the specified CPU.
+ *
+ * @returns TSC frequency, UINT64_MAX on failure (asserted).
+ * @param   pGip        The GIP pointer.
+ * @param   iCpuSet     The CPU set index of the CPU in question.
+ */
+DECLINLINE(uint64_t) SUPGetCpuHzFromGipBySetIndex(PSUPGLOBALINFOPAGE pGip, uint32_t iCpuSet)
+{
+    if (RT_LIKELY(   pGip
+                  && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC))
     {
-        iCpu = pGip->aiCpuFromApicId[ASMGetApicId()];
-        if (iCpu >= pGip->cCpus)
-            return UINT64_MAX;
+        switch (pGip->u32Mode)
+        {
+            case SUPGIPMODE_INVARIANT_TSC:
+            case SUPGIPMODE_SYNC_TSC:
+                return pGip->aCPUs[0].u64CpuHz;
+            case SUPGIPMODE_ASYNC_TSC:
+                if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+                {
+                    uint16_t iCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+                    if (RT_LIKELY(iCpu < pGip->cCpus))
+                        return pGip->aCPUs[iCpu].u64CpuHz;
+                }
+                break;
+            default: break; /* shut up gcc */
+        }
     }
+    AssertFailed();
+    return UINT64_MAX;
+}
 
-    return pGip->aCPUs[iCpu].u64CpuHz;
+
+#if 0 /* Not used anywhere.  Unsure where this would be useful. */
+/**
+ * Checks if the provided TSC frequency is close enough to the computed TSC
+ * frequency of the host.
+ *
+ * @returns true if it's compatible, false otherwise.
+ */
+DECLINLINE(bool) SUPIsTscFreqCompatible(uint64_t u64CpuHz)
+{
+    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    if (   pGip
+        && pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC)
+    {
+        if (pGip->u64CpuHz != u64CpuHz)
+        {
+            /* Arbitrary tolerance threshold, tweak later if required, perhaps
+               more tolerance on lower frequencies and less tolerance on higher. */
+            uint64_t uLo = (pGip->u64CpuHz << 10) / 1025;
+            uint64_t uHi = pGip->u64CpuHz + (pGip->u64CpuHz - uLo);
+            if (   u64CpuHz < uLo
+                || u64CpuHz > uHi)
+                return false;
+        }
+        return true;
+    }
+    return false;
 }
 #endif
 
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+
+/** @internal */
+SUPDECL(uint64_t) SUPReadTscWithDelta(PSUPGLOBALINFOPAGE pGip);
+
+/**
+ * Read the host TSC value and applies the TSC delta if appropriate.
+ *
+ * @returns the TSC value.
+ * @remarks Requires GIP to be initialized and valid.
+ */
+DECLINLINE(uint64_t) SUPReadTsc(void)
+{
+    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
+        return ASMReadTSC();
+    return SUPReadTscWithDelta(pGip);
+}
+
+#endif /* X86 || AMD64 */
+
+/** @internal */
+SUPDECL(uint64_t) SUPGetTscDeltaSlow(PSUPGLOBALINFOPAGE pGip);
+
+/**
+ * Gets the TSC delta for the current CPU.
+ *
+ * @returns The TSC delta value (will not return the special INT64_MAX value).
+ * @remarks Requires GIP to be initialized and valid.
+ */
+DECLINLINE(int64_t) SUPGetTscDelta(void)
+{
+    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
+        return 0;
+    return SUPGetTscDeltaSlow(pGip);
+}
+
+
+/**
+ * Gets the TSC delta for a given CPU.
+ *
+ * @returns The TSC delta value (will not return the special INT64_MAX value).
+ * @param   iCpuSet         The CPU set index of the CPU which TSC delta we want.
+ * @remarks Requires GIP to be initialized and valid.
+ */
+DECLINLINE(int64_t) SUPGetTscDeltaByCpuSetIndex(uint32_t iCpuSet)
+{
+    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
+        return 0;
+    if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+    {
+        uint16_t iCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+        if (RT_LIKELY(iCpu < pGip->cCpus))
+        {
+            int64_t iTscDelta = pGip->aCPUs[iCpu].i64TSCDelta;
+            if (iTscDelta != INT64_MAX)
+                return iTscDelta;
+        }
+    }
+    AssertFailed();
+    return 0;
+}
+
+
+/**
+ * Checks if the TSC delta is available for a given CPU (if TSC-deltas are
+ * relevant).
+ *
+ * @returns true if it's okay to read the TSC, false otherwise.
+ *
+ * @param   iCpuSet   The CPU set index of the CPU which TSC delta we check.
+ * @remarks Requires GIP to be initialized and valid.
+ */
+DECLINLINE(bool) SUPIsTscDeltaAvailableForCpuSetIndex(uint32_t iCpuSet)
+{
+    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
+        return true;
+    if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+    {
+        uint16_t iCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+        if (RT_LIKELY(iCpu < pGip->cCpus))
+        {
+            int64_t iTscDelta = pGip->aCPUs[iCpu].i64TSCDelta;
+            if (iTscDelta != INT64_MAX)
+                return true;
+        }
+    }
+    return false;
+}
+
+
+/**
+ * Gets the descriptive GIP mode name.
+ *
+ * @returns The name.
+ * @param   pGip      Pointer to the GIP.
+ */
+DECLINLINE(const char *) SUPGetGIPModeName(PSUPGLOBALINFOPAGE pGip)
+{
+    AssertReturn(pGip, NULL);
+    switch (pGip->u32Mode)
+    {
+        case SUPGIPMODE_INVARIANT_TSC:  return "Invariant";
+        case SUPGIPMODE_SYNC_TSC:       return "Synchronous";
+        case SUPGIPMODE_ASYNC_TSC:      return "Asynchronous";
+        case SUPGIPMODE_INVALID:        return "Invalid";
+        default:                        return "???";
+    }
+}
+
+
+/**
+ * Gets the descriptive TSC-delta enum name.
+ *
+ * @returns The name.
+ * @param   pGip      Pointer to the GIP.
+ */
+DECLINLINE(const char *) SUPGetGIPTscDeltaModeName(PSUPGLOBALINFOPAGE pGip)
+{
+    AssertReturn(pGip, NULL);
+    switch (pGip->enmUseTscDelta)
+    {
+        case SUPGIPUSETSCDELTA_NOT_APPLICABLE:   return "Not Applicable";
+        case SUPGIPUSETSCDELTA_ZERO_CLAIMED:     return "Zero Claimed";
+        case SUPGIPUSETSCDELTA_PRACTICALLY_ZERO: return "Pratically Zero";
+        case SUPGIPUSETSCDELTA_ROUGHLY_ZERO:     return "Roughly Zero";
+        case SUPGIPUSETSCDELTA_NOT_ZERO:         return "Not Zero";
+        default:                                 return "???";
+    }
+}
+
+
 /**
  * Request for generic VMMR0Entry calls.
  */
@@ -433,7 +737,7 @@ typedef SUPVMMR0REQHDR *PSUPVMMR0REQHDR;
 /** @see VMMR0_DO_RAW_RUN. */
 #define SUP_VMMR0_DO_RAW_RUN    0
 /** @see VMMR0_DO_HM_RUN. */
-#define SUP_VMMR0_DO_HM_RUN  1
+#define SUP_VMMR0_DO_HM_RUN     1
 /** @see VMMR0_DO_NOP */
 #define SUP_VMMR0_DO_NOP        2
 /** @} */
@@ -441,9 +745,14 @@ typedef SUPVMMR0REQHDR *PSUPVMMR0REQHDR;
 /** SUPR3QueryVTCaps capability flags
  * @{
  */
-#define SUPVTCAPS_AMD_V             RT_BIT(0)
-#define SUPVTCAPS_VT_X              RT_BIT(1)
-#define SUPVTCAPS_NESTED_PAGING     RT_BIT(2)
+/** AMD-V support. */
+#define SUPVTCAPS_AMD_V                     RT_BIT(0)
+/** VT-x support. */
+#define SUPVTCAPS_VT_X                      RT_BIT(1)
+/** Nested paging is supported. */
+#define SUPVTCAPS_NESTED_PAGING             RT_BIT(2)
+/** VT-x: Unrestricted guest execution is supported. */
+#define SUPVTCAPS_VTX_UNRESTRICTED_GUEST    RT_BIT(3)
 /** @} */
 
 /**
@@ -656,7 +965,6 @@ SUPDECL(uint32_t) SUPSemEventMultiGetResolution(PSUPDRVSESSION pSession);
 #ifdef IN_RING3
 
 /** @defgroup   grp_sup_r3     SUP Host Context Ring-3 API
- * @ingroup grp_sup
  * @{
  */
 
@@ -1343,6 +1651,65 @@ SUPR3DECL(int) SUPR3TracerDeregisterModule(struct VTGOBJHDR *pVtgHdr);
  */
 SUPDECL(void)  SUPTracerFireProbe(struct VTGPROBELOC *pVtgProbeLoc, uintptr_t uArg0, uintptr_t uArg1, uintptr_t uArg2,
                                   uintptr_t uArg3, uintptr_t uArg4);
+
+
+/**
+ * Attempts to read the value of an MSR.
+ *
+ * @returns VBox status code.
+ * @param   uMsr                The MSR to read.
+ * @param   idCpu               The CPU to read it on, NIL_RTCPUID if it doesn't
+ *                              matter which CPU.
+ * @param   puValue             Where to return the value.
+ * @param   pfGp                Where to store the \#GP indicator for the read
+ *                              operation.
+ */
+SUPR3DECL(int) SUPR3MsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue, bool *pfGp);
+
+/**
+ * Attempts to write to an MSR.
+ *
+ * @returns VBox status code.
+ * @param   uMsr                The MSR to write to.
+ * @param   idCpu               The CPU to wrtie it on, NIL_RTCPUID if it
+ *                              doesn't matter which CPU.
+ * @param   uValue              The value to write.
+ * @param   pfGp                Where to store the \#GP indicator for the write
+ *                              operation.
+ */
+SUPR3DECL(int) SUPR3MsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue, bool *pfGp);
+
+/**
+ * Attempts to modify the value of an MSR.
+ *
+ * @returns VBox status code.
+ * @param   uMsr                The MSR to modify.
+ * @param   idCpu               The CPU to modify it on, NIL_RTCPUID if it
+ *                              doesn't matter which CPU.
+ * @param   fAndMask            The bits to keep in the current MSR value.
+ * @param   fOrMask             The bits to set before writing.
+ * @param   pResult             The result buffer.
+ */
+SUPR3DECL(int) SUPR3MsrProberModify(uint32_t uMsr, RTCPUID idCpu, uint64_t fAndMask, uint64_t fOrMask,
+                                    PSUPMSRPROBERMODIFYRESULT pResult);
+
+/**
+ * Attempts to modify the value of an MSR, extended version.
+ *
+ * @returns VBox status code.
+ * @param   uMsr                The MSR to modify.
+ * @param   idCpu               The CPU to modify it on, NIL_RTCPUID if it
+ *                              doesn't matter which CPU.
+ * @param   fAndMask            The bits to keep in the current MSR value.
+ * @param   fOrMask             The bits to set before writing.
+ * @param   fFaster             If set to @c true some cache/tlb invalidation is
+ *                              skipped, otherwise behave like
+ *                              SUPR3MsrProberModify.
+ * @param   pResult             The result buffer.
+ */
+SUPR3DECL(int) SUPR3MsrProberModifyEx(uint32_t uMsr, RTCPUID idCpu, uint64_t fAndMask, uint64_t fOrMask, bool fFaster,
+                                      PSUPMSRPROBERMODIFYRESULT pResult);
+
 /**
  * Resume built-in keyboard on MacBook Air and Pro hosts.
  *
@@ -1350,9 +1717,37 @@ SUPDECL(void)  SUPTracerFireProbe(struct VTGPROBELOC *pVtgProbeLoc, uintptr_t uA
  */
 SUPR3DECL(int) SUPR3ResumeSuspendedKeyboards(void);
 
+
+/**
+ * Measure the TSC-delta for the specified CPU.
+ *
+ * @returns VBox status code.
+ * @param   idCpu               The CPU to measure the TSC-delta for.
+ * @param   fAsync              Whether the measurement is asynchronous, returns
+ *                              immediately after signalling a measurement
+ *                              request.
+ * @param   fForce              Whether to perform a measurement even if the
+ *                              specified CPU has a (possibly) valid TSC delta.
+ * @param   cRetries            Number of times to retry failed delta
+ *                              measurements.
+ * @param   cMsWaitRetry        Number of milliseconds to wait between retries.
+ */
+SUPR3DECL(int) SUPR3TscDeltaMeasure(RTCPUID idCpu, bool fAsync, bool fForce, uint8_t cRetries, uint8_t cMsWaitRetry);
+
+/**
+ * Reads the delta-adjust TSC value.
+ *
+ * @returns VBox status code.
+ * @param   puTsc           Where to store the read TSC value.
+ * @param   pidApic         Where to store the APIC ID of the CPU where the TSC
+ *                          was read (optional, can be NULL).
+ */
+SUPR3DECL(int) SUPR3ReadTsc(uint64_t *puTsc, uint16_t *pidApic);
+
 /** @} */
 #endif /* IN_RING3 */
 
+
 /** @name User mode module flags (SUPR3TracerRegisterModule & SUP_IOCTL_TRACER_UMOD_REG).
  * @{ */
 /** Executable image. */
@@ -1366,7 +1761,6 @@ SUPR3DECL(int) SUPR3ResumeSuspendedKeyboards(void);
 
 #ifdef IN_RING0
 /** @defgroup   grp_sup_r0     SUP Host Context Ring-0 API
- * @ingroup grp_sup
  * @{
  */
 
@@ -1427,6 +1821,8 @@ SUPR0DECL(int) SUPR0PageMapKernel(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_
 SUPR0DECL(int) SUPR0PageProtect(PSUPDRVSESSION pSession, RTR3PTR pvR3, RTR0PTR pvR0, uint32_t offSub, uint32_t cbSub, uint32_t fProt);
 SUPR0DECL(int) SUPR0PageFree(PSUPDRVSESSION pSession, RTR3PTR pvR3);
 SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PRTR3PTR ppGipR3, PRTHCPHYS pHCPhysGip);
+SUPR0DECL(int) SUPR0GetSvmUsability(bool fInitSvm);
+SUPR0DECL(int) SUPR0GetVmxUsability(bool *pfIsSmxModeAmbiguous);
 SUPR0DECL(int) SUPR0QueryVTCaps(PSUPDRVSESSION pSession, uint32_t *pfCaps);
 SUPR0DECL(int) SUPR0GipUnmap(PSUPDRVSESSION pSession);
 SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...);
@@ -1436,6 +1832,11 @@ SUPR0DECL(RTCCUINTREG) SUPR0ChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask)
 SUPR0DECL(int) SUPR0EnableVTx(bool fEnable);
 SUPR0DECL(bool) SUPR0SuspendVTxOnCpu(void);
 SUPR0DECL(void) SUPR0ResumeVTxOnCpu(bool fSuspended);
+#define SUP_TSCDELTA_MEASURE_F_FORCE        RT_BIT_32(0)
+#define SUP_TSCDELTA_MEASURE_F_ASYNC        RT_BIT_32(1)
+#define SUP_TSCDELTA_MEASURE_F_VALID_MASK   UINT32_C(0x00000003)
+SUPR0DECL(int) SUPR0TscDeltaMeasureBySetIndex(PSUPDRVSESSION pSession, uint32_t iCpuSet, uint32_t fFlags,
+                                              RTMSINTERVAL cMsWaitRetry, RTMSINTERVAL cMsWaitThread, uint32_t cTries);
 
 /** @name Absolute symbols
  * Take the address of these, don't try call them.
@@ -1762,7 +2163,6 @@ typedef R0PTRTYPE(FNSUPR0SERVICEREQHANDLER *) PFNSUPR0SERVICEREQHANDLER;
 
 
 /** @defgroup   grp_sup_r0_idc  The IDC Interface
- * @ingroup grp_sup_r0
  * @{
  */
 
diff --git a/include/VBox/sup.mac b/include/VBox/sup.mac
index 1ca7adc..e1d5771 100644
--- a/include/VBox/sup.mac
+++ b/include/VBox/sup.mac
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2012 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -33,17 +33,31 @@ struc SUPGIPCPU
     .u64NanoTS                  resq 1
     .u64TSC                     resq 1
     .u64CpuHz                   resq 1
+    .i64TSCDelta                resq 1
     .cErrors                    resd 1
     .iTSCHistoryHead            resd 1
     .au32TSCHistory             resd 8
     .u32PrevUpdateIntervalNS    resd 1
-    .au32Reserved               resd (5+5)
+    .au32Reserved0              resd (5)
+    .u64TSCSample               resq 1
+    .au32Reserved1              resd (1)
     .enmState                   resd 1
     .idCpu                      resd 1
     .iCpuSet                    resw 1
     .idApic                     resw 1
 endstruc
 
+%define SUPGIPUSETSCDELTA_NOT_APPLICABLE        0
+%define SUPGIPUSETSCDELTA_ZERO_CLAIMED          1
+%define SUPGIPUSETSCDELTA_PRACTICALLY_ZERO      2
+%define SUPGIPUSETSCDELTA_ROUGHLY_ZERO          3
+%define SUPGIPUSETSCDELTA_NOT_ZERO              4
+
+%define SUPGIPGETCPU_APIC_ID                        1
+%define SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS       2
+%define SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS   4
+
+
 %define SUPGLOBALINFOPAGE_MAGIC 0x19590106
 struc SUPGLOBALINFOPAGE
     .u32Magic                   resd 1
@@ -54,6 +68,7 @@ struc SUPGLOBALINFOPAGE
     .u32UpdateHz                resd 1
     .u32UpdateIntervalNS        resd 1
     .u64NanoTSLastUpdateHz      resq 1
+    .u64CpuHz                   resq 1
     .OnlineCpuSet               resq 4
     .PresentCpuSet              resq 4
     .PossibleCpuSet             resq 4
@@ -62,7 +77,9 @@ struc SUPGLOBALINFOPAGE
     .cPossibleCpus              resw 1
     .u16Padding0                resw 1
     .idCpuMax                   resd 1
-    .au32Padding1               resd 29
+    .enmUseTscDelta             resd 1
+    .fGetGipCpu                 resd 1
+    .au32Padding1               resd 25
     .aiCpuFromApicId            resw 256
     .aiCpuFromCpuSetIdx         resw 256
     .aCPUs                      resb SUPGIPCPU_size
@@ -118,6 +135,5 @@ struc SUPDRVTRACERUSRCTX64
         .u.Amd64.r15            resq 1
 endstruc
 
-
 %endif
 
diff --git a/include/VBox/types.h b/include/VBox/types.h
index 4caa582..7297f5a 100644
--- a/include/VBox/types.h
+++ b/include/VBox/types.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -36,13 +36,11 @@
 
 
 /** @defgroup grp_types_both  Common Guest and Host Context Basic Types
- * @ingroup grp_types
  * @{
  */
 
 
 /** @defgroup grp_types_hc  Host Context Basic Types
- * @ingroup grp_types_both
  * @{
  */
 
@@ -50,7 +48,6 @@
 
 
 /** @defgroup grp_types_gc  Guest Context Basic Types
- * @ingroup grp_types_both
  * @{
  */
 
@@ -404,7 +401,6 @@ typedef const struct CPUMSELREG *PCCPUMSELREGHID;
 
 
 /** @defgroup grp_types_idt     Interrupt Descriptor Table Entry.
- * @ingroup grp_types
  * @todo This all belongs in x86.h!
  * @{ */
 
diff --git a/include/VBox/usb.h b/include/VBox/usb.h
index 4ab531a..ea6de6a 100644
--- a/include/VBox/usb.h
+++ b/include/VBox/usb.h
@@ -67,6 +67,8 @@ typedef enum USBDEVICESPEED
     USBDEVICESPEED_HIGH,
     /** Variable speed - USB 2.5 / wireless. */
     USBDEVICESPEED_VARIABLE,
+    /** Super speed - USB 3.0 (5Gbit/s). */
+    USBDEVICESPEED_SUPER,
     /** The usual 32-bit hack. */
     USBDEVICESPEED_32BIT_HACK = 0x7fffffff
 } USBDEVICESPEED;
diff --git a/include/VBox/vd-filter-backend.h b/include/VBox/vd-filter-backend.h
index fae79fe..b2021c5 100644
--- a/include/VBox/vd-filter-backend.h
+++ b/include/VBox/vd-filter-backend.h
@@ -57,10 +57,11 @@ typedef struct VDFILTERBACKEND
      *
      * @returns VBox status code.
      * @param   pVDIfsDisk      Pointer to the per-disk VD interface list.
+     * @param   fFlags          Subset of VD_FILTER_FLAGS_*.
      * @param   pVDIfsFilter    Pointer to the per-filter VD interface list.
      * @param   ppvBackendData  Opaque state data for this filter instance.
      */
-    DECLR3CALLBACKMEMBER(int, pfnCreate, (PVDINTERFACE pVDIfsDisk,
+    DECLR3CALLBACKMEMBER(int, pfnCreate, (PVDINTERFACE pVDIfsDisk, uint32_t fFlags,
                                           PVDINTERFACE pVDIfsFilter,
                                           void **ppvBackendData));
 
diff --git a/include/VBox/vd-ifs.h b/include/VBox/vd-ifs.h
index b37ccb1..7c98aab 100644
--- a/include/VBox/vd-ifs.h
+++ b/include/VBox/vd-ifs.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -69,7 +69,7 @@ typedef enum VDINTERFACETYPE
     VDINTERFACETYPE_QUERYRANGEUSE,
     /** Interface for the metadata traverse callback. Per-operation. */
     VDINTERFACETYPE_TRAVERSEMETADATA,
-    /** Interface for crypto opertions. Per-disk. */
+    /** Interface for crypto operations. Per-filter. */
     VDINTERFACETYPE_CRYPTO,
     /** invalid interface. */
     VDINTERFACETYPE_INVALID
@@ -794,6 +794,21 @@ DECLINLINE(bool) VDCFGAreKeysValid(PVDINTERFACECONFIG pCfgIf, const char *pszzVa
 }
 
 /**
+ * Checks whether a given key is existing.
+ *
+ * @return  true if the key exists.
+ * @return  false if the key does not exist.
+ * @param   pCfgIf      Pointer to configuration callback table.
+ * @param   pszName     Name of the key.
+ */
+DECLINLINE(bool) VDCFGIsKeyExisting(PVDINTERFACECONFIG pCfgIf, const char *pszName)
+{
+    size_t cb = 0;
+    int rc = pCfgIf->pfnQuerySize(pCfgIf->Core.pvUser, pszName, &cb);
+    return rc == VERR_CFGM_VALUE_NOT_FOUND ? false : true;
+}
+
+/**
  * Query configuration, unsigned 64-bit integer value with default.
  *
  * @return  VBox status code.
@@ -821,6 +836,27 @@ DECLINLINE(int) VDCFGQueryU64Def(PVDINTERFACECONFIG pCfgIf,
 }
 
 /**
+ * Query configuration, unsigned 64-bit integer value.
+ *
+ * @return  VBox status code.
+ * @param   pCfgIf      Pointer to configuration callback table.
+ * @param   pszName     Name of an integer value
+ * @param   pu64        Where to store the value.
+ */
+DECLINLINE(int) VDCFGQueryU64(PVDINTERFACECONFIG pCfgIf, const char *pszName,
+                              uint64_t *pu64)
+{
+    char aszBuf[32];
+    int rc = pCfgIf->pfnQuery(pCfgIf->Core.pvUser, pszName, aszBuf, sizeof(aszBuf));
+    if (RT_SUCCESS(rc))
+    {
+        rc = RTStrToUInt64Full(aszBuf, 0, pu64);
+    }
+
+    return rc;
+}
+
+/**
  * Query configuration, unsigned 32-bit integer value with default.
  *
  * @return  VBox status code.
@@ -866,6 +902,24 @@ DECLINLINE(int) VDCFGQueryBoolDef(PVDINTERFACECONFIG pCfgIf,
 }
 
 /**
+ * Query configuration, bool value.
+ *
+ * @return  VBox status code.
+ * @param   pCfgIf      Pointer to configuration callback table.
+ * @param   pszName     Name of an integer value
+ * @param   pf          Where to store the value.
+ */
+DECLINLINE(int) VDCFGQueryBool(PVDINTERFACECONFIG pCfgIf, const char *pszName,
+                               bool *pf)
+{
+    uint64_t u64;
+    int rc = VDCFGQueryU64(pCfgIf, pszName, &u64);
+    if (RT_SUCCESS(rc))
+        *pf = u64 ? true : false;
+    return rc;
+}
+
+/**
  * Query configuration, dynamically allocated (RTMemAlloc) zero terminated
  * character value.
  *
@@ -1390,6 +1444,58 @@ typedef struct VDINTERFACECRYPTO
      */
     DECLR3CALLBACKMEMBER(int, pfnKeyRelease, (void *pvUser, const char *pszId));
 
+    /**
+     * Gets a reference to the password identified by the given ID to open a key store supplied through the config interface.
+     *
+     * @returns VBox status code.
+     * @param   pvUser          The opaque user data associated with this interface.
+     * @param   pszId           The alias/id for the password to retain.
+     * @param   ppszPassword    Where to store the password to unlock the key store on success.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnKeyStorePasswordRetain, (void *pvUser, const char *pszId, const char **ppszPassword));
+
+    /**
+     * Releases a reference of the password previously acquired with VDINTERFACECRYPTO::pfnKeyStorePasswordRetain()
+     * identified by the given ID.
+     *
+     * @returns VBox status code.
+     * @param   pvUser          The opaque user data associated with this interface.
+     * @param   pszId           The alias/id for the password to release.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnKeyStorePasswordRelease, (void *pvUser, const char *pszId));
+
+    /**
+     * Saves a key store.
+     *
+     * @returns VBox status code.
+     * @param   pvUser          The opaque user data associated with this interface.
+     * @param   pvKeyStore      The key store to save.
+     * @param   cbKeyStore      Size of the key store in bytes.
+     *
+     * @note The format is filter specific and should be treated as binary data.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnKeyStoreSave, (void *pvUser, const void *pvKeyStore, size_t cbKeyStore));
+
+    /**
+     * Returns the parameters after the key store was loaded successfully.
+     *
+     * @returns VBox status code.
+     * @param   pvUser          The opaque user data associated with this interface.
+     * @param   pszCipher       The cipher identifier the DEK is used for.
+     * @param   pbDek           The raw DEK which was contained in the key store loaded by
+     *                          VDINTERFACECRYPTO::pfnKeyStoreLoad().
+     * @param   cbDek           The size of the DEK.
+     *
+     * @note The provided pointer to the DEK is only valid until this call returns.
+     *       The content might change afterwards with out notice (when scrambling the key
+     *       for further protection for example) or might be even freed.
+     *
+     * @note This method is optional and can be NULL if the caller does not require the
+     *       parameters.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnKeyStoreReturnParameters, (void *pvUser, const char *pszCipher,
+                                                            const uint8_t *pbDek, size_t cbDek));
+
 } VDINTERFACECRYPTO, *PVDINTERFACECRYPTO;
 
 
@@ -1413,7 +1519,7 @@ DECLINLINE(PVDINTERFACECRYPTO) VDIfCryptoGet(PVDINTERFACE pVDIfs)
 }
 
 /**
- * @copydoc VDINTERFACECRYPTOKEYS::pfnKeyRetain
+ * @copydoc VDINTERFACECRYPTO::pfnKeyRetain
  */
 DECLINLINE(int) vdIfCryptoKeyRetain(PVDINTERFACECRYPTO pIfCrypto, const char *pszId, const uint8_t **ppbKey, size_t *pcbKey)
 {
@@ -1421,13 +1527,50 @@ DECLINLINE(int) vdIfCryptoKeyRetain(PVDINTERFACECRYPTO pIfCrypto, const char *ps
 }
 
 /**
- * @copydoc VDINTERFACECRYPTOKEYS::pfnKeyRelease
+ * @copydoc VDINTERFACECRYPTO::pfnKeyRelease
  */
 DECLINLINE(int) vdIfCryptoKeyRelease(PVDINTERFACECRYPTO pIfCrypto, const char *pszId)
 {
     return pIfCrypto->pfnKeyRelease(pIfCrypto->Core.pvUser, pszId);
 }
 
+/**
+ * @copydoc VDINTERFACECRYPTO::pfnKeyStorePasswordRetain
+ */
+DECLINLINE(int) vdIfCryptoKeyStorePasswordRetain(PVDINTERFACECRYPTO pIfCrypto, const char *pszId, const char **ppszPassword)
+{
+    return pIfCrypto->pfnKeyStorePasswordRetain(pIfCrypto->Core.pvUser, pszId, ppszPassword);
+}
+
+/**
+ * @copydoc VDINTERFACECRYPTO::pfnKeyStorePasswordRelease
+ */
+DECLINLINE(int) vdIfCryptoKeyStorePasswordRelease(PVDINTERFACECRYPTO pIfCrypto, const char *pszId)
+{
+    return pIfCrypto->pfnKeyStorePasswordRelease(pIfCrypto->Core.pvUser, pszId);
+}
+
+/**
+ * @copydoc VDINTERFACECRYPTO::pfnKeyStoreSave
+ */
+DECLINLINE(int) vdIfCryptoKeyStoreSave(PVDINTERFACECRYPTO pIfCrypto, const void *pvKeyStore, size_t cbKeyStore)
+{
+    return pIfCrypto->pfnKeyStoreSave(pIfCrypto->Core.pvUser, pvKeyStore, cbKeyStore);
+}
+
+/**
+ * @copydoc VDINTERFACECRYPTO::pfnKeyStoreReturnParameters
+ */
+DECLINLINE(int) vdIfCryptoKeyStoreReturnParameters(PVDINTERFACECRYPTO pIfCrypto, const char *pszCipher,
+                                                   const uint8_t *pbDek, size_t cbDek)
+{
+    if (pIfCrypto->pfnKeyStoreReturnParameters)
+        return pIfCrypto->pfnKeyStoreReturnParameters(pIfCrypto->Core.pvUser, pszCipher, pbDek, cbDek);
+
+    return VINF_SUCCESS;
+}
+
+
 RT_C_DECLS_END
 
 /** @} */
diff --git a/include/VBox/vd-image-backend.h b/include/VBox/vd-image-backend.h
index c8926db..2ca9f72 100644
--- a/include/VBox/vd-image-backend.h
+++ b/include/VBox/vd-image-backend.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -138,6 +138,7 @@ typedef struct VBOXHDDBACKEND
      * @param   pVDIfsDisk      Pointer to the per-disk VD interface list.
      * @param   pVDIfsImage     Pointer to the per-image VD interface list.
      * @param   pVDIfsOperation Pointer to the per-operation VD interface list.
+     * @param   enmType         Requested type of the image.
      * @param   ppBackendData   Opaque state data for this image.
      */
     DECLR3CALLBACKMEMBER(int, pfnCreate, (const char *pszFilename, uint64_t cbSize,
@@ -149,6 +150,7 @@ typedef struct VBOXHDDBACKEND
                                           PVDINTERFACE pVDIfsDisk,
                                           PVDINTERFACE pVDIfsImage,
                                           PVDINTERFACE pVDIfsOperation,
+                                          VDTYPE enmType,
                                           void **ppBackendData));
 
     /**
diff --git a/include/VBox/vd.h b/include/VBox/vd.h
index 88f5d0c..76d0c01 100644
--- a/include/VBox/vd.h
+++ b/include/VBox/vd.h
@@ -70,6 +70,7 @@ RT_C_DECLS_BEGIN
 #define VD_IMAGE_CONTENT_UNKNOWN    0xffffffffU
 
 /** @name VBox HDD container image flags
+ * Same values as MediumVariant API enum.
  * @{
  */
 /** No flags. */
@@ -240,6 +241,21 @@ typedef struct VBOXHDDRAW
 #define VD_OPEN_FLAGS_MASK          (VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_HONOR_ZEROES | VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_DISCARD | VD_OPEN_FLAGS_IGNORE_FLUSH | VD_OPEN_FLAGS_INFORM_ABOUT_ZERO_BLOCKS | VD_OPEN_FLAGS_SKIP_CONSISTENCY_CHECKS)
 /** @}*/
 
+/** @name VBox HDD container filter flags
+ * @{
+ */
+/** The filter is applied during writes. */
+#define VD_FILTER_FLAGS_WRITE RT_BIT(0)
+/** The filter is applied during reads. */
+#define VD_FILTER_FLAGS_READ  RT_BIT(1)
+/** Open the filter in info mode. */
+#define VD_FILTER_FLAGS_INFO  RT_BIT(2)
+/** Default set of filter flags. */
+#define VD_FILTER_FLAGS_DEFAULT (VD_FILTER_FLAGS_WRITE | VD_FILTER_FLAGS_READ)
+/** Mask of valid flags. */
+#define VD_FILTER_FLAGS_MASK    (VD_FILTER_FLAGS_WRITE | VD_FILTER_FLAGS_READ | VD_FILTER_FLAGS_INFO)
+/** @} */
+
 /**
  * Helper functions to handle open flags.
  */
@@ -639,9 +655,11 @@ VBOXDDU_DECL(int) VDCacheOpen(PVBOXHDD pDisk, const char *pszBackend,
  * @returns VBox status code.
  * @param   pDisk           Pointer to the HDD container which should use the filter.
  * @param   pszFilter       Name of the filter backend to use (case insensitive).
+ * @param   fFlags          Flags which apply to the filter, combination of VD_FILTER_FLAGS_*
+ *                          defines.
  * @param   pVDIfsFilter    Pointer to the per-filter VD interface list.
  */
-VBOXDDU_DECL(int) VDFilterAdd(PVBOXHDD pDisk, const char *pszFilter,
+VBOXDDU_DECL(int) VDFilterAdd(PVBOXHDD pDisk, const char *pszFilter, uint32_t fFlags,
                               PVDINTERFACE pVDIfsFilter);
 
 /**
@@ -878,7 +896,7 @@ VBOXDDU_DECL(int) VDCompact(PVBOXHDD pDisk, unsigned nImage,
  *
  * @return  VBox status
  * @return  VERR_VD_IMAGE_READ_ONLY if image is not writable.
- * @return  VERR_NOT_SUPPORTED if this kind of image can be compacted, but
+ * @return  VERR_NOT_SUPPORTED if this kind of image can't be compacted.
  *
  * @param   pDisk           Pointer to the HDD container.
  * @param   cbSize          New size of the image.
@@ -892,6 +910,17 @@ VBOXDDU_DECL(int) VDResize(PVBOXHDD pDisk, uint64_t cbSize,
                            PVDINTERFACE pVDIfsOperation);
 
 /**
+ * Prepares the given disk for use by the added filters. This applies to all
+ * opened images in the chain which might be opened read/write temporary.
+ *
+ * @return  VBox status code.
+ *
+ * @param   pDisk           Pointer to the HDD container.
+ * @param   pVDIfsOperation Pointer to the per-operation VD interface list.
+ */
+VBOXDDU_DECL(int) VDPrepareWithFilters(PVBOXHDD pDisk, PVDINTERFACE pVDIfsOperation);
+
+/**
  * Closes the last opened image file in HDD container.
  * If previous image file was opened in read-only mode (the normal case) and
  * the last opened image is in read-write mode then the previous image will be
@@ -905,13 +934,14 @@ VBOXDDU_DECL(int) VDResize(PVBOXHDD pDisk, uint64_t cbSize,
 VBOXDDU_DECL(int) VDClose(PVBOXHDD pDisk, bool fDelete);
 
 /**
- * Removes the last added filter in the HDD container.
+ * Removes the last added filter in the HDD container from the specified chain.
  *
  * @return  VBox status code.
  * @retval  VERR_VD_NOT_OPENED if no filter is present for the disk.
  * @param   pDisk           Pointer to HDD container.
+ * @param   fFlags          Combination of VD_FILTER_FLAGS_* defines.
  */
-VBOXDDU_DECL(int) VDFilterRemove(PVBOXHDD pDisk);
+VBOXDDU_DECL(int) VDFilterRemove(PVBOXHDD pDisk, uint32_t fFlags);
 
 /**
  * Closes the currently opened cache image file in HDD container.
diff --git a/include/VBox/version.h b/include/VBox/version.h
index defa321..7cb15c1 100644
--- a/include/VBox/version.h
+++ b/include/VBox/version.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -28,9 +28,13 @@
 
 /* Product info. */
 #include <product-generated.h>
+#include <version-generated.h>
 
-#ifndef RC_INVOKED
-# include <version-generated.h>
+#ifdef RC_INVOKED
+/* Some versions of RC has trouble with cdefs.h, so we duplicate these two here. */
+# define RT_STR(str)             #str
+# define RT_XSTR(str)            RT_STR(str)
+#else  /* !RC_INVOKED */
 
 /** Combined version number. */
 # define VBOX_VERSION                    (VBOX_VERSION_MAJOR << 16 | VBOX_VERSION_MINOR)
@@ -92,20 +96,58 @@
 #endif /* !RC_INVOKED */
 
 /** @name Prefined strings for Windows resource files
- *
- * @remarks The VBOX_VERSION_*_NR define are integer numbers while
- *          VBOX_VERSION_* are strings when using the resource compile.
- *          Kind of confusing...
- *
  * @{ */
 #define VBOX_RC_COMPANY_NAME            VBOX_VENDOR
 #define VBOX_RC_LEGAL_COPYRIGHT         "Copyright (C) 2009-" VBOX_C_YEAR " Oracle Corporation\0"
-#define VBOX_RC_PRODUCT_VERSION         VBOX_VERSION_MAJOR_NR , VBOX_VERSION_MINOR_NR , 0 , 0
-#define VBOX_RC_FILE_VERSION            VBOX_VERSION_MAJOR_NR , VBOX_VERSION_MINOR_NR , 0 , 0
+#define VBOX_RC_PRODUCT_NAME                    VBOX_PRODUCT
+#define VBOX_RC_PRODUCT_NAME_GA                 VBOX_PRODUCT " Guest Additions"
+#define VBOX_RC_PRODUCT_NAME_PUEL_EXTPACK       VBOX_PRODUCT " Extension Pack"
+#define VBOX_RC_PRODUCT_NAME_DTRACE_EXTPACK     VBOX_PRODUCT " VBoxDTrace Extension Pack"
+#define VBOX_RC_PRODUCT_NAME_STR                VBOX_RC_PRODUCT_NAME "\0"
+#define VBOX_RC_PRODUCT_NAME_GA_STR             VBOX_RC_PRODUCT_NAME_GA "\0"
+#define VBOX_RC_PRODUCT_NAME_PUEL_EXTPACK_STR   VBOX_RC_PRODUCT_NAME_PUEL_EXTPACK "\0"
+#define VBOX_RC_PRODUCT_NAME_DTRACE_EXTPACK_STR VBOX_RC_PRODUCT_NAME_DTRACE_EXTPACK "\0"
+#define VBOX_RC_PRODUCT_VERSION         VBOX_VERSION_MAJOR , VBOX_VERSION_MINOR , VBOX_VERSION_BUILD , VBOX_SVN_REV_MOD_5K
+#define VBOX_RC_FILE_VERSION            VBOX_VERSION_MAJOR , VBOX_VERSION_MINOR , VBOX_VERSION_BUILD , VBOX_SVN_REV_MOD_5K
+#ifndef VBOX_VERSION_PRERELEASE
+# define VBOX_RC_PRODUCT_VERSION_STR    RT_XSTR(VBOX_VERSION_MAJOR) "." RT_XSTR(VBOX_VERSION_MINOR) "." RT_XSTR(VBOX_VERSION_BUILD) "." RT_XSTR(VBOX_SVN_REV) "\0"
+# define VBOX_RC_FILE_VERSION_STR       RT_XSTR(VBOX_VERSION_MAJOR) "." RT_XSTR(VBOX_VERSION_MINOR) "." RT_XSTR(VBOX_VERSION_BUILD) "." RT_XSTR(VBOX_SVN_REV) "\0"
+#else
+# define VBOX_RC_PRODUCT_VERSION_STR    RT_XSTR(VBOX_VERSION_MAJOR) "." RT_XSTR(VBOX_VERSION_MINOR) "." RT_XSTR(VBOX_VERSION_BUILD) "." RT_XSTR(VBOX_SVN_REV) " (" VBOX_VERSION_PRERELEASE ")\0"
+# define VBOX_RC_FILE_VERSION_STR       RT_XSTR(VBOX_VERSION_MAJOR) "." RT_XSTR(VBOX_VERSION_MINOR) "." RT_XSTR(VBOX_VERSION_BUILD) "." RT_XSTR(VBOX_SVN_REV) " (" VBOX_VERSION_PRERELEASE ")\0"
+#endif
+#define VBOX_RC_FILE_OS                 VOS_NT_WINDOWS32
+#define VBOX_RC_TYPE_DLL                VFT_DLL
+#define VBOX_RC_TYPE_APP                VFT_APP
+#define VBOX_RC_TYPE_DRV                VFT_DRV
+/* Flags and extra strings depending on the build type and who's building. */
+#if defined(DEBUG) || defined(LOG_ENABLED) || defined(RT_STRICT) || defined(VBOX_STRICT) || defined(VBOX_WITH_STATISTICS)
+# define VBOX_RC_FILE_FLAGS_DEBUG       VS_FF_DEBUG
+#else
+# define VBOX_RC_FILE_FLAGS_DEBUG       0
+#endif
+#if VBOX_VERSION_MINOR >= 51 || defined(VBOX_VERSION_PRERELEASE)
+# define VBOX_RC_FILE_FLAGS_PRERELEASE  VS_FF_PRERELEASE
+#else
+# define VBOX_RC_FILE_FLAGS_PRERELEASE  0
+#endif
+#if defined(VBOX_BUILD_SERVER_BUILD) && (VBOX_VERSION_MINOR & 1) == 0
+# define VBOX_RC_FILE_FLAGS_BUILD       0
+# define VBOX_RC_MORE_STRINGS
+#elif defined(VBOX_BUILD_SERVER_BUILD)
+# define VBOX_RC_FILE_FLAGS_BUILD       VS_FF_SPECIALBUILD
+# define VBOX_RC_MORE_STRINGS           VALUE "SpecialBuild", "r" RT_XSTR(VBOX_SVN_REV) "\0"
+#else
+# define VBOX_RC_FILE_FLAGS_BUILD       VS_FF_PRIVATEBUILD
+# ifdef VBOX_PRIVATE_BUILD_DESC
+#  define VBOX_RC_MORE_STRINGS          VALUE "PrivateBuild", VBOX_PRIVATE_BUILD_DESC "\0"
+# else
+#  define VBOX_RC_MORE_STRINGS          VALUE "PrivateBuild", "r" RT_XSTR(VBOX_SVN_REV) "\0"
+# error
+# endif
+#endif
+#define VBOX_RC_FILE_FLAGS              (VBOX_RC_FILE_FLAGS_DEBUG | VBOX_RC_FILE_FLAGS_PRERELEASE | VBOX_RC_FILE_FLAGS_BUILD)
 /** @} */
 
-/** @todo Clean up the resource compiler mess where we cannot include
- *        version-generated.h and requires two files. */
-
 #endif
 
diff --git a/include/VBox/vmm/cfgm.h b/include/VBox/vmm/cfgm.h
index dbc8e52..b634450 100644
--- a/include/VBox/vmm/cfgm.h
+++ b/include/VBox/vmm/cfgm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -54,7 +54,6 @@ RT_C_DECLS_BEGIN
 
 #ifdef IN_RING3
 /** @defgroup   grp_cfgm_r3     The CFGM Host Context Ring-3 API
- * @ingroup grp_cfgm
  * @{
  */
 
@@ -133,6 +132,7 @@ VMMR3DECL(int)          CFGMR3RemoveValue(PCFGMNODE pNode, const char *pszName);
 /** @} */
 VMMR3DECL(int)          CFGMR3CopyTree(PCFGMNODE pDstTree, PCFGMNODE pSrcTree, uint32_t fFlags);
 
+VMMR3DECL(bool)         CFGMR3Exists(           PCFGMNODE pNode, const char *pszName);
 VMMR3DECL(int)          CFGMR3QueryType(        PCFGMNODE pNode, const char *pszName, PCFGMVALUETYPE penmType);
 VMMR3DECL(int)          CFGMR3QuerySize(        PCFGMNODE pNode, const char *pszName, size_t *pcb);
 VMMR3DECL(int)          CFGMR3QueryInteger(     PCFGMNODE pNode, const char *pszName, uint64_t *pu64);
diff --git a/include/VBox/vmm/cpum.h b/include/VBox/vmm/cpum.h
index 04c722f..85ee5a8 100644
--- a/include/VBox/vmm/cpum.h
+++ b/include/VBox/vmm/cpum.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -29,6 +29,7 @@
 #include <iprt/x86.h>
 #include <VBox/types.h>
 #include <VBox/vmm/cpumctx.h>
+#include <VBox/vmm/stam.h>
 
 RT_C_DECLS_BEGIN
 
@@ -64,6 +65,10 @@ typedef enum CPUMCPUIDFEATURE
     CPUMCPUIDFEATURE_RDTSCP,
     /** The Hypervisor Present bit. (Std) */
     CPUMCPUIDFEATURE_HVP,
+    /** The MWait Extensions bits (Std) */
+    CPUMCPUIDFEATURE_MWAIT_EXTS,
+    /** The CR4.OSXSAVE bit CPUID mirroring, only use from CPUMSetGuestCR4. */
+    CPUMCPUIDFEATURE_OSXSAVE,
     /** 32bit hackishness. */
     CPUMCPUIDFEATURE_32BIT_HACK = 0x7fffffff
 } CPUMCPUIDFEATURE;
@@ -268,6 +273,9 @@ typedef enum CPUMMICROARCH
 
 /**
  * CPUID leaf.
+ *
+ * @remarks This structure is used by the patch manager and is therefore
+ *          more or less set in stone.
  */
 typedef struct CPUMCPUIDLEAF
 {
@@ -290,6 +298,7 @@ typedef struct CPUMCPUIDLEAF
     /** Flags. */
     uint32_t    fFlags;
 } CPUMCPUIDLEAF;
+AssertCompileSize(CPUMCPUIDLEAF, 32);
 /** Pointer to a CPUID leaf. */
 typedef CPUMCPUIDLEAF *PCPUMCPUIDLEAF;
 /** Pointer to a const CPUID leaf. */
@@ -297,36 +306,707 @@ typedef CPUMCPUIDLEAF const *PCCPUMCPUIDLEAF;
 
 /** @name CPUMCPUIDLEAF::fFlags
  * @{ */
-/** Indicates that ECX (the sub-leaf indicator) doesn't change when
- * requesting the final leaf and all undefined leaves that follows it.
- * Observed for 0x0000000b on Intel. */
-#define CPUMCPUIDLEAF_F_SUBLEAVES_ECX_UNCHANGED RT_BIT_32(0)
+/** Indicates working intel leaf 0xb where the lower 8 ECX bits are not modified
+ * and EDX containing the extended APIC ID. */
+#define CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES    RT_BIT_32(0)
+/** The leaf contains an APIC ID that needs changing to that of the current CPU. */
+#define CPUMCPUIDLEAF_F_CONTAINS_APIC_ID            RT_BIT_32(1)
+/** The leaf contains an OSXSAVE which needs individual handling on each CPU. */
+#define CPUMCPUIDLEAF_F_CONTAINS_OSXSAVE            RT_BIT_32(2)
+/** Mask of the valid flags. */
+#define CPUMCPUIDLEAF_F_VALID_MASK                  UINT32_C(0x7)
 /** @} */
 
 /**
- * Method used to deal with unknown CPUID leafs.
+ * Method used to deal with unknown CPUID leaves.
+ * @remarks Used in patch code.
  */
-typedef enum CPUMUKNOWNCPUID
+typedef enum CPUMUNKNOWNCPUID
 {
     /** Invalid zero value. */
-    CPUMUKNOWNCPUID_INVALID = 0,
+    CPUMUNKNOWNCPUID_INVALID = 0,
     /** Use given default values (DefCpuId). */
-    CPUMUKNOWNCPUID_DEFAULTS,
+    CPUMUNKNOWNCPUID_DEFAULTS,
     /** Return the last standard leaf.
      * Intel Sandy Bridge has been observed doing this. */
-    CPUMUKNOWNCPUID_LAST_STD_LEAF,
+    CPUMUNKNOWNCPUID_LAST_STD_LEAF,
     /** Return the last standard leaf, with ecx observed.
      * Intel Sandy Bridge has been observed doing this. */
-    CPUMUKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
+    CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
     /** The register values are passed thru unmodified. */
-    CPUMUKNOWNCPUID_PASSTHRU,
+    CPUMUNKNOWNCPUID_PASSTHRU,
     /** End of valid value. */
-    CPUMUKNOWNCPUID_END,
+    CPUMUNKNOWNCPUID_END,
     /** Ensure 32-bit type. */
-    CPUMUKNOWNCPUID_32BIT_HACK = 0x7fffffff
-} CPUMUKNOWNCPUID;
+    CPUMUNKNOWNCPUID_32BIT_HACK = 0x7fffffff
+} CPUMUNKNOWNCPUID;
 /** Pointer to unknown CPUID leaf method. */
-typedef CPUMUKNOWNCPUID *PCPUMUKNOWNCPUID;
+typedef CPUMUNKNOWNCPUID *PCPUMUNKNOWNCPUID;
+
+
+/**
+ * MSR read functions.
+ */
+typedef enum CPUMMSRRDFN
+{
+    /** Invalid zero value. */
+    kCpumMsrRdFn_Invalid = 0,
+    /** Return the CPUMMSRRANGE::uValue. */
+    kCpumMsrRdFn_FixedValue,
+    /** Alias to the MSR range starting at the MSR given by
+     * CPUMMSRRANGE::uValue.  Must be used in pair with
+     * kCpumMsrWrFn_MsrAlias. */
+    kCpumMsrRdFn_MsrAlias,
+    /** Write only register, GP all read attempts. */
+    kCpumMsrRdFn_WriteOnly,
+
+    kCpumMsrRdFn_Ia32P5McAddr,
+    kCpumMsrRdFn_Ia32P5McType,
+    kCpumMsrRdFn_Ia32TimestampCounter,
+    kCpumMsrRdFn_Ia32PlatformId,            /**< Takes real CPU value for reference. */
+    kCpumMsrRdFn_Ia32ApicBase,
+    kCpumMsrRdFn_Ia32FeatureControl,
+    kCpumMsrRdFn_Ia32BiosSignId,            /**< Range value returned. */
+    kCpumMsrRdFn_Ia32SmmMonitorCtl,
+    kCpumMsrRdFn_Ia32PmcN,
+    kCpumMsrRdFn_Ia32MonitorFilterLineSize,
+    kCpumMsrRdFn_Ia32MPerf,
+    kCpumMsrRdFn_Ia32APerf,
+    kCpumMsrRdFn_Ia32MtrrCap,               /**< Takes real CPU value for reference.  */
+    kCpumMsrRdFn_Ia32MtrrPhysBaseN,         /**< Takes register number. */
+    kCpumMsrRdFn_Ia32MtrrPhysMaskN,         /**< Takes register number. */
+    kCpumMsrRdFn_Ia32MtrrFixed,             /**< Takes CPUMCPU offset. */
+    kCpumMsrRdFn_Ia32MtrrDefType,
+    kCpumMsrRdFn_Ia32Pat,
+    kCpumMsrRdFn_Ia32SysEnterCs,
+    kCpumMsrRdFn_Ia32SysEnterEsp,
+    kCpumMsrRdFn_Ia32SysEnterEip,
+    kCpumMsrRdFn_Ia32McgCap,
+    kCpumMsrRdFn_Ia32McgStatus,
+    kCpumMsrRdFn_Ia32McgCtl,
+    kCpumMsrRdFn_Ia32DebugCtl,
+    kCpumMsrRdFn_Ia32SmrrPhysBase,
+    kCpumMsrRdFn_Ia32SmrrPhysMask,
+    kCpumMsrRdFn_Ia32PlatformDcaCap,
+    kCpumMsrRdFn_Ia32CpuDcaCap,
+    kCpumMsrRdFn_Ia32Dca0Cap,
+    kCpumMsrRdFn_Ia32PerfEvtSelN,           /**< Range value indicates the register number. */
+    kCpumMsrRdFn_Ia32PerfStatus,            /**< Range value returned. */
+    kCpumMsrRdFn_Ia32PerfCtl,               /**< Range value returned. */
+    kCpumMsrRdFn_Ia32FixedCtrN,             /**< Takes register number of start of range. */
+    kCpumMsrRdFn_Ia32PerfCapabilities,      /**< Takes reference value. */
+    kCpumMsrRdFn_Ia32FixedCtrCtrl,
+    kCpumMsrRdFn_Ia32PerfGlobalStatus,      /**< Takes reference value. */
+    kCpumMsrRdFn_Ia32PerfGlobalCtrl,
+    kCpumMsrRdFn_Ia32PerfGlobalOvfCtrl,
+    kCpumMsrRdFn_Ia32PebsEnable,
+    kCpumMsrRdFn_Ia32ClockModulation,       /**< Range value returned. */
+    kCpumMsrRdFn_Ia32ThermInterrupt,        /**< Range value returned. */
+    kCpumMsrRdFn_Ia32ThermStatus,           /**< Range value returned. */
+    kCpumMsrRdFn_Ia32Therm2Ctl,             /**< Range value returned. */
+    kCpumMsrRdFn_Ia32MiscEnable,            /**< Range value returned. */
+    kCpumMsrRdFn_Ia32McCtlStatusAddrMiscN,  /**< Takes bank number. */
+    kCpumMsrRdFn_Ia32McNCtl2,               /**< Takes register number of start of range. */
+    kCpumMsrRdFn_Ia32DsArea,
+    kCpumMsrRdFn_Ia32TscDeadline,
+    kCpumMsrRdFn_Ia32X2ApicN,
+    kCpumMsrRdFn_Ia32DebugInterface,
+    kCpumMsrRdFn_Ia32VmxBase,               /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxPinbasedCtls,       /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxProcbasedCtls,      /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxExitCtls,           /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxEntryCtls,          /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxMisc,               /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxCr0Fixed0,          /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxCr0Fixed1,          /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxCr4Fixed0,          /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxCr4Fixed1,          /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxVmcsEnum,           /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxProcBasedCtls2,     /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxEptVpidCap,         /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxTruePinbasedCtls,   /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxTrueProcbasedCtls,  /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxTrueExitCtls,       /**< Takes real value as reference. */
+    kCpumMsrRdFn_Ia32VmxTrueEntryCtls,      /**< Takes real value as reference. */
+
+    kCpumMsrRdFn_Amd64Efer,
+    kCpumMsrRdFn_Amd64SyscallTarget,
+    kCpumMsrRdFn_Amd64LongSyscallTarget,
+    kCpumMsrRdFn_Amd64CompSyscallTarget,
+    kCpumMsrRdFn_Amd64SyscallFlagMask,
+    kCpumMsrRdFn_Amd64FsBase,
+    kCpumMsrRdFn_Amd64GsBase,
+    kCpumMsrRdFn_Amd64KernelGsBase,
+    kCpumMsrRdFn_Amd64TscAux,
+
+    kCpumMsrRdFn_IntelEblCrPowerOn,
+    kCpumMsrRdFn_IntelI7CoreThreadCount,
+    kCpumMsrRdFn_IntelP4EbcHardPowerOn,
+    kCpumMsrRdFn_IntelP4EbcSoftPowerOn,
+    kCpumMsrRdFn_IntelP4EbcFrequencyId,
+    kCpumMsrRdFn_IntelP6FsbFrequency,       /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelPlatformInfo,
+    kCpumMsrRdFn_IntelFlexRatio,            /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelPkgCStConfigControl,
+    kCpumMsrRdFn_IntelPmgIoCaptureBase,
+    kCpumMsrRdFn_IntelLastBranchFromToN,
+    kCpumMsrRdFn_IntelLastBranchFromN,
+    kCpumMsrRdFn_IntelLastBranchToN,
+    kCpumMsrRdFn_IntelLastBranchTos,
+    kCpumMsrRdFn_IntelBblCrCtl,
+    kCpumMsrRdFn_IntelBblCrCtl3,
+    kCpumMsrRdFn_IntelI7TemperatureTarget,  /**< Range value returned. */
+    kCpumMsrRdFn_IntelI7MsrOffCoreResponseN,/**< Takes register number. */
+    kCpumMsrRdFn_IntelI7MiscPwrMgmt,
+    kCpumMsrRdFn_IntelP6CrN,
+    kCpumMsrRdFn_IntelCpuId1FeatureMaskEcdx,
+    kCpumMsrRdFn_IntelCpuId1FeatureMaskEax,
+    kCpumMsrRdFn_IntelCpuId80000001FeatureMaskEcdx,
+    kCpumMsrRdFn_IntelI7SandyAesNiCtl,
+    kCpumMsrRdFn_IntelI7TurboRatioLimit,    /**< Returns range value. */
+    kCpumMsrRdFn_IntelI7LbrSelect,
+    kCpumMsrRdFn_IntelI7SandyErrorControl,
+    kCpumMsrRdFn_IntelI7VirtualLegacyWireCap,/**< Returns range value. */
+    kCpumMsrRdFn_IntelI7PowerCtl,
+    kCpumMsrRdFn_IntelI7SandyPebsNumAlt,
+    kCpumMsrRdFn_IntelI7PebsLdLat,
+    kCpumMsrRdFn_IntelI7PkgCnResidencyN,     /**< Takes C-state number. */
+    kCpumMsrRdFn_IntelI7CoreCnResidencyN,    /**< Takes C-state number. */
+    kCpumMsrRdFn_IntelI7SandyVrCurrentConfig,/**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7SandyVrMiscConfig,   /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7SandyRaplPowerUnit,  /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7SandyPkgCnIrtlN,     /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7SandyPkgC2Residency, /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPkgPowerLimit,   /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPkgEnergyStatus, /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPkgPerfStatus,   /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPkgPowerInfo,    /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplDramPowerLimit,  /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplDramEnergyStatus,/**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplDramPerfStatus,  /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplDramPowerInfo,   /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPp0PowerLimit,   /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPp0EnergyStatus, /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPp0Policy,       /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPp0PerfStatus,   /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPp1PowerLimit,   /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPp1EnergyStatus, /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7RaplPp1Policy,       /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7IvyConfigTdpNominal, /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7IvyConfigTdpLevel1,  /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7IvyConfigTdpLevel2,  /**< Takes real value as reference. */
+    kCpumMsrRdFn_IntelI7IvyConfigTdpControl,
+    kCpumMsrRdFn_IntelI7IvyTurboActivationRatio,
+    kCpumMsrRdFn_IntelI7UncPerfGlobalCtrl,
+    kCpumMsrRdFn_IntelI7UncPerfGlobalStatus,
+    kCpumMsrRdFn_IntelI7UncPerfGlobalOvfCtrl,
+    kCpumMsrRdFn_IntelI7UncPerfFixedCtrCtrl,
+    kCpumMsrRdFn_IntelI7UncPerfFixedCtr,
+    kCpumMsrRdFn_IntelI7UncCBoxConfig,
+    kCpumMsrRdFn_IntelI7UncArbPerfCtrN,
+    kCpumMsrRdFn_IntelI7UncArbPerfEvtSelN,
+    kCpumMsrRdFn_IntelCore2EmttmCrTablesN,  /**< Range value returned. */
+    kCpumMsrRdFn_IntelCore2SmmCStMiscInfo,
+    kCpumMsrRdFn_IntelCore1ExtConfig,
+    kCpumMsrRdFn_IntelCore1DtsCalControl,
+    kCpumMsrRdFn_IntelCore2PeciControl,
+
+    kCpumMsrRdFn_P6LastBranchFromIp,
+    kCpumMsrRdFn_P6LastBranchToIp,
+    kCpumMsrRdFn_P6LastIntFromIp,
+    kCpumMsrRdFn_P6LastIntToIp,
+
+    kCpumMsrRdFn_AmdFam15hTscRate,
+    kCpumMsrRdFn_AmdFam15hLwpCfg,
+    kCpumMsrRdFn_AmdFam15hLwpCbAddr,
+    kCpumMsrRdFn_AmdFam10hMc4MiscN,
+    kCpumMsrRdFn_AmdK8PerfCtlN,
+    kCpumMsrRdFn_AmdK8PerfCtrN,
+    kCpumMsrRdFn_AmdK8SysCfg,               /**< Range value returned. */
+    kCpumMsrRdFn_AmdK8HwCr,
+    kCpumMsrRdFn_AmdK8IorrBaseN,
+    kCpumMsrRdFn_AmdK8IorrMaskN,
+    kCpumMsrRdFn_AmdK8TopOfMemN,
+    kCpumMsrRdFn_AmdK8NbCfg1,
+    kCpumMsrRdFn_AmdK8McXcptRedir,
+    kCpumMsrRdFn_AmdK8CpuNameN,
+    kCpumMsrRdFn_AmdK8HwThermalCtrl,        /**< Range value returned. */
+    kCpumMsrRdFn_AmdK8SwThermalCtrl,
+    kCpumMsrRdFn_AmdK8FidVidControl,        /**< Range value returned. */
+    kCpumMsrRdFn_AmdK8FidVidStatus,         /**< Range value returned. */
+    kCpumMsrRdFn_AmdK8McCtlMaskN,
+    kCpumMsrRdFn_AmdK8SmiOnIoTrapN,
+    kCpumMsrRdFn_AmdK8SmiOnIoTrapCtlSts,
+    kCpumMsrRdFn_AmdK8IntPendingMessage,
+    kCpumMsrRdFn_AmdK8SmiTriggerIoCycle,
+    kCpumMsrRdFn_AmdFam10hMmioCfgBaseAddr,
+    kCpumMsrRdFn_AmdFam10hTrapCtlMaybe,
+    kCpumMsrRdFn_AmdFam10hPStateCurLimit,   /**< Returns range value. */
+    kCpumMsrRdFn_AmdFam10hPStateControl,    /**< Returns range value. */
+    kCpumMsrRdFn_AmdFam10hPStateStatus,     /**< Returns range value. */
+    kCpumMsrRdFn_AmdFam10hPStateN,          /**< Returns range value. This isn't an register index! */
+    kCpumMsrRdFn_AmdFam10hCofVidControl,    /**< Returns range value. */
+    kCpumMsrRdFn_AmdFam10hCofVidStatus,     /**< Returns range value. */
+    kCpumMsrRdFn_AmdFam10hCStateIoBaseAddr,
+    kCpumMsrRdFn_AmdFam10hCpuWatchdogTimer,
+    kCpumMsrRdFn_AmdK8SmmBase,
+    kCpumMsrRdFn_AmdK8SmmAddr,
+    kCpumMsrRdFn_AmdK8SmmMask,
+    kCpumMsrRdFn_AmdK8VmCr,
+    kCpumMsrRdFn_AmdK8IgnNe,
+    kCpumMsrRdFn_AmdK8SmmCtl,
+    kCpumMsrRdFn_AmdK8VmHSavePa,
+    kCpumMsrRdFn_AmdFam10hVmLockKey,
+    kCpumMsrRdFn_AmdFam10hSmmLockKey,
+    kCpumMsrRdFn_AmdFam10hLocalSmiStatus,
+    kCpumMsrRdFn_AmdFam10hOsVisWrkIdLength,
+    kCpumMsrRdFn_AmdFam10hOsVisWrkStatus,
+    kCpumMsrRdFn_AmdFam16hL2IPerfCtlN,
+    kCpumMsrRdFn_AmdFam16hL2IPerfCtrN,
+    kCpumMsrRdFn_AmdFam15hNorthbridgePerfCtlN,
+    kCpumMsrRdFn_AmdFam15hNorthbridgePerfCtrN,
+    kCpumMsrRdFn_AmdK7MicrocodeCtl,         /**< Returns range value. */
+    kCpumMsrRdFn_AmdK7ClusterIdMaybe,       /**< Returns range value. */
+    kCpumMsrRdFn_AmdK8CpuIdCtlStd07hEbax,
+    kCpumMsrRdFn_AmdK8CpuIdCtlStd06hEcx,
+    kCpumMsrRdFn_AmdK8CpuIdCtlStd01hEdcx,
+    kCpumMsrRdFn_AmdK8CpuIdCtlExt01hEdcx,
+    kCpumMsrRdFn_AmdK8PatchLevel,           /**< Returns range value. */
+    kCpumMsrRdFn_AmdK7DebugStatusMaybe,
+    kCpumMsrRdFn_AmdK7BHTraceBaseMaybe,
+    kCpumMsrRdFn_AmdK7BHTracePtrMaybe,
+    kCpumMsrRdFn_AmdK7BHTraceLimitMaybe,
+    kCpumMsrRdFn_AmdK7HardwareDebugToolCfgMaybe,
+    kCpumMsrRdFn_AmdK7FastFlushCountMaybe,
+    kCpumMsrRdFn_AmdK7NodeId,
+    kCpumMsrRdFn_AmdK7DrXAddrMaskN,      /**< Takes register index. */
+    kCpumMsrRdFn_AmdK7Dr0DataMatchMaybe,
+    kCpumMsrRdFn_AmdK7Dr0DataMaskMaybe,
+    kCpumMsrRdFn_AmdK7LoadStoreCfg,
+    kCpumMsrRdFn_AmdK7InstrCacheCfg,
+    kCpumMsrRdFn_AmdK7DataCacheCfg,
+    kCpumMsrRdFn_AmdK7BusUnitCfg,
+    kCpumMsrRdFn_AmdK7DebugCtl2Maybe,
+    kCpumMsrRdFn_AmdFam15hFpuCfg,
+    kCpumMsrRdFn_AmdFam15hDecoderCfg,
+    kCpumMsrRdFn_AmdFam10hBusUnitCfg2,
+    kCpumMsrRdFn_AmdFam15hCombUnitCfg,
+    kCpumMsrRdFn_AmdFam15hCombUnitCfg2,
+    kCpumMsrRdFn_AmdFam15hCombUnitCfg3,
+    kCpumMsrRdFn_AmdFam15hExecUnitCfg,
+    kCpumMsrRdFn_AmdFam15hLoadStoreCfg2,
+    kCpumMsrRdFn_AmdFam10hIbsFetchCtl,
+    kCpumMsrRdFn_AmdFam10hIbsFetchLinAddr,
+    kCpumMsrRdFn_AmdFam10hIbsFetchPhysAddr,
+    kCpumMsrRdFn_AmdFam10hIbsOpExecCtl,
+    kCpumMsrRdFn_AmdFam10hIbsOpRip,
+    kCpumMsrRdFn_AmdFam10hIbsOpData,
+    kCpumMsrRdFn_AmdFam10hIbsOpData2,
+    kCpumMsrRdFn_AmdFam10hIbsOpData3,
+    kCpumMsrRdFn_AmdFam10hIbsDcLinAddr,
+    kCpumMsrRdFn_AmdFam10hIbsDcPhysAddr,
+    kCpumMsrRdFn_AmdFam10hIbsCtl,
+    kCpumMsrRdFn_AmdFam14hIbsBrTarget,
+
+    kCpumMsrRdFn_Gim,
+
+    /** End of valid MSR read function indexes. */
+    kCpumMsrRdFn_End
+} CPUMMSRRDFN;
+
+/**
+ * MSR write functions.
+ */
+typedef enum CPUMMSRWRFN
+{
+    /** Invalid zero value. */
+    kCpumMsrWrFn_Invalid = 0,
+    /** Writes are ignored, the fWrGpMask is observed though. */
+    kCpumMsrWrFn_IgnoreWrite,
+    /** Writes cause GP(0) to be raised, the fWrGpMask should be UINT64_MAX. */
+    kCpumMsrWrFn_ReadOnly,
+    /** Alias to the MSR range starting at the MSR given by
+     * CPUMMSRRANGE::uValue.  Must be used in pair with
+     * kCpumMsrRdFn_MsrAlias. */
+    kCpumMsrWrFn_MsrAlias,
+
+    kCpumMsrWrFn_Ia32P5McAddr,
+    kCpumMsrWrFn_Ia32P5McType,
+    kCpumMsrWrFn_Ia32TimestampCounter,
+    kCpumMsrWrFn_Ia32ApicBase,
+    kCpumMsrWrFn_Ia32FeatureControl,
+    kCpumMsrWrFn_Ia32BiosSignId,
+    kCpumMsrWrFn_Ia32BiosUpdateTrigger,
+    kCpumMsrWrFn_Ia32SmmMonitorCtl,
+    kCpumMsrWrFn_Ia32PmcN,
+    kCpumMsrWrFn_Ia32MonitorFilterLineSize,
+    kCpumMsrWrFn_Ia32MPerf,
+    kCpumMsrWrFn_Ia32APerf,
+    kCpumMsrWrFn_Ia32MtrrPhysBaseN,         /**< Takes register number. */
+    kCpumMsrWrFn_Ia32MtrrPhysMaskN,         /**< Takes register number. */
+    kCpumMsrWrFn_Ia32MtrrFixed,             /**< Takes CPUMCPU offset. */
+    kCpumMsrWrFn_Ia32MtrrDefType,
+    kCpumMsrWrFn_Ia32Pat,
+    kCpumMsrWrFn_Ia32SysEnterCs,
+    kCpumMsrWrFn_Ia32SysEnterEsp,
+    kCpumMsrWrFn_Ia32SysEnterEip,
+    kCpumMsrWrFn_Ia32McgStatus,
+    kCpumMsrWrFn_Ia32McgCtl,
+    kCpumMsrWrFn_Ia32DebugCtl,
+    kCpumMsrWrFn_Ia32SmrrPhysBase,
+    kCpumMsrWrFn_Ia32SmrrPhysMask,
+    kCpumMsrWrFn_Ia32PlatformDcaCap,
+    kCpumMsrWrFn_Ia32Dca0Cap,
+    kCpumMsrWrFn_Ia32PerfEvtSelN,           /**< Range value indicates the register number. */
+    kCpumMsrWrFn_Ia32PerfStatus,
+    kCpumMsrWrFn_Ia32PerfCtl,
+    kCpumMsrWrFn_Ia32FixedCtrN,             /**< Takes register number of start of range. */
+    kCpumMsrWrFn_Ia32PerfCapabilities,
+    kCpumMsrWrFn_Ia32FixedCtrCtrl,
+    kCpumMsrWrFn_Ia32PerfGlobalStatus,
+    kCpumMsrWrFn_Ia32PerfGlobalCtrl,
+    kCpumMsrWrFn_Ia32PerfGlobalOvfCtrl,
+    kCpumMsrWrFn_Ia32PebsEnable,
+    kCpumMsrWrFn_Ia32ClockModulation,
+    kCpumMsrWrFn_Ia32ThermInterrupt,
+    kCpumMsrWrFn_Ia32ThermStatus,
+    kCpumMsrWrFn_Ia32Therm2Ctl,
+    kCpumMsrWrFn_Ia32MiscEnable,
+    kCpumMsrWrFn_Ia32McCtlStatusAddrMiscN,  /**< Takes bank number. */
+    kCpumMsrWrFn_Ia32McNCtl2,               /**< Takes register number of start of range. */
+    kCpumMsrWrFn_Ia32DsArea,
+    kCpumMsrWrFn_Ia32TscDeadline,
+    kCpumMsrWrFn_Ia32X2ApicN,
+    kCpumMsrWrFn_Ia32DebugInterface,
+
+    kCpumMsrWrFn_Amd64Efer,
+    kCpumMsrWrFn_Amd64SyscallTarget,
+    kCpumMsrWrFn_Amd64LongSyscallTarget,
+    kCpumMsrWrFn_Amd64CompSyscallTarget,
+    kCpumMsrWrFn_Amd64SyscallFlagMask,
+    kCpumMsrWrFn_Amd64FsBase,
+    kCpumMsrWrFn_Amd64GsBase,
+    kCpumMsrWrFn_Amd64KernelGsBase,
+    kCpumMsrWrFn_Amd64TscAux,
+    kCpumMsrWrFn_IntelEblCrPowerOn,
+    kCpumMsrWrFn_IntelP4EbcHardPowerOn,
+    kCpumMsrWrFn_IntelP4EbcSoftPowerOn,
+    kCpumMsrWrFn_IntelP4EbcFrequencyId,
+    kCpumMsrWrFn_IntelFlexRatio,
+    kCpumMsrWrFn_IntelPkgCStConfigControl,
+    kCpumMsrWrFn_IntelPmgIoCaptureBase,
+    kCpumMsrWrFn_IntelLastBranchFromToN,
+    kCpumMsrWrFn_IntelLastBranchFromN,
+    kCpumMsrWrFn_IntelLastBranchToN,
+    kCpumMsrWrFn_IntelLastBranchTos,
+    kCpumMsrWrFn_IntelBblCrCtl,
+    kCpumMsrWrFn_IntelBblCrCtl3,
+    kCpumMsrWrFn_IntelI7TemperatureTarget,
+    kCpumMsrWrFn_IntelI7MsrOffCoreResponseN, /**< Takes register number. */
+    kCpumMsrWrFn_IntelI7MiscPwrMgmt,
+    kCpumMsrWrFn_IntelP6CrN,
+    kCpumMsrWrFn_IntelCpuId1FeatureMaskEcdx,
+    kCpumMsrWrFn_IntelCpuId1FeatureMaskEax,
+    kCpumMsrWrFn_IntelCpuId80000001FeatureMaskEcdx,
+    kCpumMsrWrFn_IntelI7SandyAesNiCtl,
+    kCpumMsrWrFn_IntelI7TurboRatioLimit,
+    kCpumMsrWrFn_IntelI7LbrSelect,
+    kCpumMsrWrFn_IntelI7SandyErrorControl,
+    kCpumMsrWrFn_IntelI7PowerCtl,
+    kCpumMsrWrFn_IntelI7SandyPebsNumAlt,
+    kCpumMsrWrFn_IntelI7PebsLdLat,
+    kCpumMsrWrFn_IntelI7SandyVrCurrentConfig,
+    kCpumMsrWrFn_IntelI7SandyVrMiscConfig,
+    kCpumMsrWrFn_IntelI7SandyPkgCnIrtlN,
+    kCpumMsrWrFn_IntelI7RaplPkgPowerLimit,
+    kCpumMsrWrFn_IntelI7RaplDramPowerLimit,
+    kCpumMsrWrFn_IntelI7RaplPp0PowerLimit,
+    kCpumMsrWrFn_IntelI7RaplPp0Policy,
+    kCpumMsrWrFn_IntelI7RaplPp1PowerLimit,
+    kCpumMsrWrFn_IntelI7RaplPp1Policy,
+    kCpumMsrWrFn_IntelI7IvyConfigTdpControl,
+    kCpumMsrWrFn_IntelI7IvyTurboActivationRatio,
+    kCpumMsrWrFn_IntelI7UncPerfGlobalCtrl,
+    kCpumMsrWrFn_IntelI7UncPerfGlobalStatus,
+    kCpumMsrWrFn_IntelI7UncPerfGlobalOvfCtrl,
+    kCpumMsrWrFn_IntelI7UncPerfFixedCtrCtrl,
+    kCpumMsrWrFn_IntelI7UncPerfFixedCtr,
+    kCpumMsrWrFn_IntelI7UncArbPerfCtrN,
+    kCpumMsrWrFn_IntelI7UncArbPerfEvtSelN,
+    kCpumMsrWrFn_IntelCore2EmttmCrTablesN,
+    kCpumMsrWrFn_IntelCore2SmmCStMiscInfo,
+    kCpumMsrWrFn_IntelCore1ExtConfig,
+    kCpumMsrWrFn_IntelCore1DtsCalControl,
+    kCpumMsrWrFn_IntelCore2PeciControl,
+
+    kCpumMsrWrFn_P6LastIntFromIp,
+    kCpumMsrWrFn_P6LastIntToIp,
+
+    kCpumMsrWrFn_AmdFam15hTscRate,
+    kCpumMsrWrFn_AmdFam15hLwpCfg,
+    kCpumMsrWrFn_AmdFam15hLwpCbAddr,
+    kCpumMsrWrFn_AmdFam10hMc4MiscN,
+    kCpumMsrWrFn_AmdK8PerfCtlN,
+    kCpumMsrWrFn_AmdK8PerfCtrN,
+    kCpumMsrWrFn_AmdK8SysCfg,
+    kCpumMsrWrFn_AmdK8HwCr,
+    kCpumMsrWrFn_AmdK8IorrBaseN,
+    kCpumMsrWrFn_AmdK8IorrMaskN,
+    kCpumMsrWrFn_AmdK8TopOfMemN,
+    kCpumMsrWrFn_AmdK8NbCfg1,
+    kCpumMsrWrFn_AmdK8McXcptRedir,
+    kCpumMsrWrFn_AmdK8CpuNameN,
+    kCpumMsrWrFn_AmdK8HwThermalCtrl,
+    kCpumMsrWrFn_AmdK8SwThermalCtrl,
+    kCpumMsrWrFn_AmdK8FidVidControl,
+    kCpumMsrWrFn_AmdK8McCtlMaskN,
+    kCpumMsrWrFn_AmdK8SmiOnIoTrapN,
+    kCpumMsrWrFn_AmdK8SmiOnIoTrapCtlSts,
+    kCpumMsrWrFn_AmdK8IntPendingMessage,
+    kCpumMsrWrFn_AmdK8SmiTriggerIoCycle,
+    kCpumMsrWrFn_AmdFam10hMmioCfgBaseAddr,
+    kCpumMsrWrFn_AmdFam10hTrapCtlMaybe,
+    kCpumMsrWrFn_AmdFam10hPStateControl,
+    kCpumMsrWrFn_AmdFam10hPStateStatus,
+    kCpumMsrWrFn_AmdFam10hPStateN,
+    kCpumMsrWrFn_AmdFam10hCofVidControl,
+    kCpumMsrWrFn_AmdFam10hCofVidStatus,
+    kCpumMsrWrFn_AmdFam10hCStateIoBaseAddr,
+    kCpumMsrWrFn_AmdFam10hCpuWatchdogTimer,
+    kCpumMsrWrFn_AmdK8SmmBase,
+    kCpumMsrWrFn_AmdK8SmmAddr,
+    kCpumMsrWrFn_AmdK8SmmMask,
+    kCpumMsrWrFn_AmdK8VmCr,
+    kCpumMsrWrFn_AmdK8IgnNe,
+    kCpumMsrWrFn_AmdK8SmmCtl,
+    kCpumMsrWrFn_AmdK8VmHSavePa,
+    kCpumMsrWrFn_AmdFam10hVmLockKey,
+    kCpumMsrWrFn_AmdFam10hSmmLockKey,
+    kCpumMsrWrFn_AmdFam10hLocalSmiStatus,
+    kCpumMsrWrFn_AmdFam10hOsVisWrkIdLength,
+    kCpumMsrWrFn_AmdFam10hOsVisWrkStatus,
+    kCpumMsrWrFn_AmdFam16hL2IPerfCtlN,
+    kCpumMsrWrFn_AmdFam16hL2IPerfCtrN,
+    kCpumMsrWrFn_AmdFam15hNorthbridgePerfCtlN,
+    kCpumMsrWrFn_AmdFam15hNorthbridgePerfCtrN,
+    kCpumMsrWrFn_AmdK7MicrocodeCtl,
+    kCpumMsrWrFn_AmdK7ClusterIdMaybe,
+    kCpumMsrWrFn_AmdK8CpuIdCtlStd07hEbax,
+    kCpumMsrWrFn_AmdK8CpuIdCtlStd06hEcx,
+    kCpumMsrWrFn_AmdK8CpuIdCtlStd01hEdcx,
+    kCpumMsrWrFn_AmdK8CpuIdCtlExt01hEdcx,
+    kCpumMsrWrFn_AmdK8PatchLoader,
+    kCpumMsrWrFn_AmdK7DebugStatusMaybe,
+    kCpumMsrWrFn_AmdK7BHTraceBaseMaybe,
+    kCpumMsrWrFn_AmdK7BHTracePtrMaybe,
+    kCpumMsrWrFn_AmdK7BHTraceLimitMaybe,
+    kCpumMsrWrFn_AmdK7HardwareDebugToolCfgMaybe,
+    kCpumMsrWrFn_AmdK7FastFlushCountMaybe,
+    kCpumMsrWrFn_AmdK7NodeId,
+    kCpumMsrWrFn_AmdK7DrXAddrMaskN,      /**< Takes register index. */
+    kCpumMsrWrFn_AmdK7Dr0DataMatchMaybe,
+    kCpumMsrWrFn_AmdK7Dr0DataMaskMaybe,
+    kCpumMsrWrFn_AmdK7LoadStoreCfg,
+    kCpumMsrWrFn_AmdK7InstrCacheCfg,
+    kCpumMsrWrFn_AmdK7DataCacheCfg,
+    kCpumMsrWrFn_AmdK7BusUnitCfg,
+    kCpumMsrWrFn_AmdK7DebugCtl2Maybe,
+    kCpumMsrWrFn_AmdFam15hFpuCfg,
+    kCpumMsrWrFn_AmdFam15hDecoderCfg,
+    kCpumMsrWrFn_AmdFam10hBusUnitCfg2,
+    kCpumMsrWrFn_AmdFam15hCombUnitCfg,
+    kCpumMsrWrFn_AmdFam15hCombUnitCfg2,
+    kCpumMsrWrFn_AmdFam15hCombUnitCfg3,
+    kCpumMsrWrFn_AmdFam15hExecUnitCfg,
+    kCpumMsrWrFn_AmdFam15hLoadStoreCfg2,
+    kCpumMsrWrFn_AmdFam10hIbsFetchCtl,
+    kCpumMsrWrFn_AmdFam10hIbsFetchLinAddr,
+    kCpumMsrWrFn_AmdFam10hIbsFetchPhysAddr,
+    kCpumMsrWrFn_AmdFam10hIbsOpExecCtl,
+    kCpumMsrWrFn_AmdFam10hIbsOpRip,
+    kCpumMsrWrFn_AmdFam10hIbsOpData,
+    kCpumMsrWrFn_AmdFam10hIbsOpData2,
+    kCpumMsrWrFn_AmdFam10hIbsOpData3,
+    kCpumMsrWrFn_AmdFam10hIbsDcLinAddr,
+    kCpumMsrWrFn_AmdFam10hIbsDcPhysAddr,
+    kCpumMsrWrFn_AmdFam10hIbsCtl,
+    kCpumMsrWrFn_AmdFam14hIbsBrTarget,
+
+    kCpumMsrWrFn_Gim,
+
+    /** End of valid MSR write function indexes. */
+    kCpumMsrWrFn_End
+} CPUMMSRWRFN;
+
+/**
+ * MSR range.
+ */
+typedef struct CPUMMSRRANGE
+{
+    /** The first MSR. [0] */
+    uint32_t    uFirst;
+    /** The last MSR. [4] */
+    uint32_t    uLast;
+    /** The read function (CPUMMSRRDFN). [8] */
+    uint16_t    enmRdFn;
+    /** The write function (CPUMMSRWRFN). [10] */
+    uint16_t    enmWrFn;
+    /** The offset of the 64-bit MSR value relative to the start of CPUMCPU.
+     * UINT16_MAX if not used by the read and write functions.  [12] */
+    uint16_t    offCpumCpu;
+    /** Reserved for future hacks. [14] */
+    uint16_t    fReserved;
+    /** The init/read value. [16]
+     * When enmRdFn is kCpumMsrRdFn_INIT_VALUE, this is the value returned on RDMSR.
+     * offCpumCpu must be UINT16_MAX in that case, otherwise it must be a valid
+     * offset into CPUM. */
+    uint64_t    uValue;
+    /** The bits to ignore when writing. [24]   */
+    uint64_t    fWrIgnMask;
+    /** The bits that will cause a GP(0) when writing. [32]
+     * This is always checked prior to calling the write function.  Using
+     * UINT64_MAX effectively marks the MSR as read-only. */
+    uint64_t    fWrGpMask;
+    /** The register name, if applicable. [40] */
+    char        szName[56];
+
+#ifdef VBOX_WITH_STATISTICS
+    /** The number of reads. */
+    STAMCOUNTER cReads;
+    /** The number of writes. */
+    STAMCOUNTER cWrites;
+    /** The number of times ignored bits were written. */
+    STAMCOUNTER cIgnoredBits;
+    /** The number of GPs generated. */
+    STAMCOUNTER cGps;
+#endif
+} CPUMMSRRANGE;
+#ifdef VBOX_WITH_STATISTICS
+AssertCompileSize(CPUMMSRRANGE, 128);
+#else
+AssertCompileSize(CPUMMSRRANGE, 96);
+#endif
+/** Pointer to an MSR range. */
+typedef CPUMMSRRANGE *PCPUMMSRRANGE;
+/** Pointer to a const MSR range. */
+typedef CPUMMSRRANGE const *PCCPUMMSRRANGE;
+
+
+/**
+ * CPU features and quirks.
+ * This is mostly exploded CPUID info.
+ */
+typedef struct CPUMFEATURES
+{
+    /** The CPU vendor (CPUMCPUVENDOR). */
+    uint8_t         enmCpuVendor;
+    /** The CPU family. */
+    uint8_t         uFamily;
+    /** The CPU model. */
+    uint8_t         uModel;
+    /** The CPU stepping. */
+    uint8_t         uStepping;
+    /** The microarchitecture. */
+#ifndef VBOX_FOR_DTRACE_LIB
+    CPUMMICROARCH   enmMicroarch;
+#else
+    uint32_t        enmMicroarch;
+#endif
+    /** The maximum physical address with of the CPU. */
+    uint8_t         cMaxPhysAddrWidth;
+    /** Alignment padding. */
+    uint8_t         abPadding[1];
+    /** Max size of the extended state (or FPU state if no XSAVE). */
+    uint16_t        cbMaxExtendedState;
+
+    /** Supports MSRs. */
+    uint32_t        fMsr : 1;
+    /** Supports the page size extension (4/2 MB pages). */
+    uint32_t        fPse : 1;
+    /** Supports 36-bit page size extension (4 MB pages can map memory above
+     *  4GB). */
+    uint32_t        fPse36 : 1;
+    /** Supports physical address extension (PAE). */
+    uint32_t        fPae : 1;
+    /** Page attribute table (PAT) support (page level cache control). */
+    uint32_t        fPat : 1;
+    /** Supports the FXSAVE and FXRSTOR instructions. */
+    uint32_t        fFxSaveRstor : 1;
+    /** Supports the XSAVE and XRSTOR instructions. */
+    uint32_t        fXSaveRstor : 1;
+    /** The XSAVE/XRSTOR bit in CR4 has been set (only applicable for host!). */
+    uint32_t        fOpSysXSaveRstor : 1;
+    /** Supports MMX. */
+    uint32_t        fMmx : 1;
+    /** Supports AMD extensions to MMX instructions. */
+    uint32_t        fAmdMmxExts : 1;
+    /** Supports SSE. */
+    uint32_t        fSse : 1;
+    /** Supports SSE2. */
+    uint32_t        fSse2 : 1;
+    /** Supports SSE3. */
+    uint32_t        fSse3 : 1;
+    /** Supports SSSE3. */
+    uint32_t        fSsse3 : 1;
+    /** Supports SSE4.1. */
+    uint32_t        fSse41 : 1;
+    /** Supports SSE4.2. */
+    uint32_t        fSse42 : 1;
+    /** Supports AVX. */
+    uint32_t        fAvx : 1;
+    /** Supports AVX2. */
+    uint32_t        fAvx2 : 1;
+    /** Supports AVX512 foundation. */
+    uint32_t        fAvx512Foundation : 1;
+    /** Supports RDTSC. */
+    uint32_t        fTsc : 1;
+    /** Intel SYSENTER/SYSEXIT support */
+    uint32_t        fSysEnter : 1;
+    /** First generation APIC. */
+    uint32_t        fApic : 1;
+    /** Second generation APIC. */
+    uint32_t        fX2Apic : 1;
+    /** Hypervisor present. */
+    uint32_t        fHypervisorPresent : 1;
+    /** MWAIT & MONITOR instructions supported. */
+    uint32_t        fMonitorMWait : 1;
+    /** MWAIT Extensions present. */
+    uint32_t        fMWaitExtensions : 1;
+
+    /** Supports AMD 3DNow instructions. */
+    uint32_t        f3DNow : 1;
+    /** Supports the 3DNow/AMD64 prefetch instructions (could be nops). */
+    uint32_t        f3DNowPrefetch : 1;
+
+    /** AMD64: Supports long mode. */
+    uint32_t        fLongMode : 1;
+    /** AMD64: SYSCALL/SYSRET support. */
+    uint32_t        fSysCall : 1;
+    /** AMD64: No-execute page table bit. */
+    uint32_t        fNoExecute : 1;
+    /** AMD64: Supports LAHF & SAHF instructions in 64-bit mode. */
+    uint32_t        fLahfSahf : 1;
+    /** AMD64: Supports RDTSCP. */
+    uint32_t        fRdTscP : 1;
+    /** AMD64: Supports MOV CR8 in 32-bit code (lock prefix hack). */
+    uint32_t        fMovCr8In32Bit : 1;
+
+    /** Indicates that FPU instruction and data pointers may leak.
+     * This generally applies to recent AMD CPUs, where the FPU IP and DP pointer
+     * is only saved and restored if an exception is pending. */
+    uint32_t        fLeakyFxSR : 1;
+
+    /** Alignment padding / reserved for future use. */
+    uint32_t        fPadding : 29;
+    uint32_t        auPadding[3];
+} CPUMFEATURES;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(CPUMFEATURES, 32);
+#endif
+/** Pointer to a CPU feature structure. */
+typedef CPUMFEATURES *PCPUMFEATURES;
+/** Pointer to a const CPU feature structure. */
+typedef CPUMFEATURES const *PCCPUMFEATURES;
 
 
 
@@ -367,13 +1047,11 @@ VMMDECL(uint64_t)   CPUMGetGuestDR3(PVMCPU pVCpu);
 VMMDECL(uint64_t)   CPUMGetGuestDR6(PVMCPU pVCpu);
 VMMDECL(uint64_t)   CPUMGetGuestDR7(PVMCPU pVCpu);
 VMMDECL(int)        CPUMGetGuestDRx(PVMCPU pVCpu, uint32_t iReg, uint64_t *pValue);
-VMMDECL(void)       CPUMGetGuestCpuId(PVMCPU pVCpu, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx);
-VMMDECL(uint32_t)   CPUMGetGuestCpuIdStdMax(PVM pVM);
-VMMDECL(uint32_t)   CPUMGetGuestCpuIdExtMax(PVM pVM);
-VMMDECL(uint32_t)   CPUMGetGuestCpuIdCentaurMax(PVM pVM);
+VMMDECL(void)       CPUMGetGuestCpuId(PVMCPU pVCpu, uint32_t iLeaf, uint32_t iSubLeaf,
+                                      uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx);
 VMMDECL(uint64_t)   CPUMGetGuestEFER(PVMCPU pVCpu);
-VMMDECL(int)        CPUMQueryGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue);
-VMMDECL(int)        CPUMSetGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t uValue);
+VMMDECL(VBOXSTRICTRC)   CPUMQueryGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue);
+VMMDECL(VBOXSTRICTRC)   CPUMSetGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t uValue);
 VMMDECL(CPUMCPUVENDOR)  CPUMGetGuestCpuVendor(PVM pVM);
 VMMDECL(CPUMCPUVENDOR)  CPUMGetHostCpuVendor(PVM pVM);
 /** @} */
@@ -395,6 +1073,7 @@ VMMDECL(int)        CPUMSetGuestDR3(PVMCPU pVCpu, uint64_t uDr3);
 VMMDECL(int)        CPUMSetGuestDR6(PVMCPU pVCpu, uint64_t uDr6);
 VMMDECL(int)        CPUMSetGuestDR7(PVMCPU pVCpu, uint64_t uDr7);
 VMMDECL(int)        CPUMSetGuestDRx(PVMCPU pVCpu, uint32_t iReg, uint64_t Value);
+VMM_INT_DECL(int)   CPUMSetGuestXcr0(PVMCPU pVCpu, uint64_t uNewValue);
 VMMDECL(int)        CPUMSetGuestEFlags(PVMCPU pVCpu, uint32_t eflags);
 VMMDECL(int)        CPUMSetGuestEIP(PVMCPU pVCpu, uint32_t eip);
 VMMDECL(int)        CPUMSetGuestEAX(PVMCPU pVCpu, uint32_t eax);
@@ -449,7 +1128,7 @@ VMM_INT_DECL(bool)  CPUMIsGuestInRawMode(PVMCPU pVCpu);
  * @returns true if in real mode, otherwise false.
  * @param   pCtx    Current CPU context
  */
-DECLINLINE(bool)    CPUMIsGuestInRealModeEx(PCPUMCTX pCtx)
+DECLINLINE(bool) CPUMIsGuestInRealModeEx(PCPUMCTX pCtx)
 {
     return !(pCtx->cr0 & X86_CR0_PE);
 }
@@ -483,7 +1162,7 @@ DECLINLINE(bool) CPUMIsGuestInV86ModeEx(PCPUMCTX pCtx)
  * @returns true if in paged protected mode, otherwise false.
  * @param   pVM     The VM handle.
  */
-DECLINLINE(bool)    CPUMIsGuestInPagedProtectedModeEx(PCPUMCTX pCtx)
+DECLINLINE(bool) CPUMIsGuestInPagedProtectedModeEx(PCPUMCTX pCtx)
 {
     return (pCtx->cr0 & (X86_CR0_PE | X86_CR0_PG)) == (X86_CR0_PE | X86_CR0_PG);
 }
@@ -494,7 +1173,7 @@ DECLINLINE(bool)    CPUMIsGuestInPagedProtectedModeEx(PCPUMCTX pCtx)
  * @returns true if in long mode, otherwise false.
  * @param   pCtx    Current CPU context
  */
-DECLINLINE(bool)    CPUMIsGuestInLongModeEx(PCPUMCTX pCtx)
+DECLINLINE(bool) CPUMIsGuestInLongModeEx(PCPUMCTX pCtx)
 {
     return (pCtx->msrEFER & MSR_K6_EFER_LMA) == MSR_K6_EFER_LMA;
 }
@@ -508,7 +1187,7 @@ VMM_INT_DECL(bool) CPUMIsGuestIn64BitCodeSlow(PCPUMCTX pCtx);
  * @param   pVCpu   The current virtual CPU.
  * @param   pCtx    Current CPU context
  */
-DECLINLINE(bool)    CPUMIsGuestIn64BitCodeEx(PCPUMCTX pCtx)
+DECLINLINE(bool) CPUMIsGuestIn64BitCodeEx(PCPUMCTX pCtx)
 {
     if (!(pCtx->msrEFER & MSR_K6_EFER_LMA))
         return false;
@@ -523,7 +1202,7 @@ DECLINLINE(bool)    CPUMIsGuestIn64BitCodeEx(PCPUMCTX pCtx)
  * @returns true if paging is enabled, otherwise false.
  * @param   pCtx    Current CPU context
  */
-DECLINLINE(bool)    CPUMIsGuestPagingEnabledEx(PCPUMCTX pCtx)
+DECLINLINE(bool) CPUMIsGuestPagingEnabledEx(PCPUMCTX pCtx)
 {
     return !!(pCtx->cr0 & X86_CR0_PG);
 }
@@ -534,7 +1213,7 @@ DECLINLINE(bool)    CPUMIsGuestPagingEnabledEx(PCPUMCTX pCtx)
  * @returns true if in PAE mode, otherwise false.
  * @param   pCtx    Current CPU context
  */
-DECLINLINE(bool)    CPUMIsGuestInPAEModeEx(PCPUMCTX pCtx)
+DECLINLINE(bool) CPUMIsGuestInPAEModeEx(PCPUMCTX pCtx)
 {
     /* Intel mentions EFER.LMA and EFER.LME in different parts of their spec. We shall use EFER.LMA rather
        than EFER.LME as it reflects if the CPU has entered paging with EFER.LME set.  */
@@ -622,8 +1301,8 @@ VMMDECL(PCPUMCTX)       CPUMGetHyperCtxPtr(PVMCPU pVCpu);
 VMMDECL(PCCPUMCTXCORE)  CPUMGetHyperCtxCore(PVMCPU pVCpu);
 VMMDECL(PCPUMCTX)       CPUMQueryGuestCtxPtr(PVMCPU pVCpu);
 VMMDECL(PCCPUMCTXCORE)  CPUMGetGuestCtxCore(PVMCPU pVCpu);
-VMM_INT_DECL(int)       CPUMRawEnter(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore);
-VMM_INT_DECL(int)       CPUMRawLeave(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, int rc);
+VMM_INT_DECL(int)       CPUMRawEnter(PVMCPU pVCpu);
+VMM_INT_DECL(int)       CPUMRawLeave(PVMCPU pVCpu, int rc);
 VMMDECL(uint32_t)       CPUMRawGetEFlags(PVMCPU pVCpu);
 VMMDECL(void)           CPUMRawSetEFlags(PVMCPU pVCpu, uint32_t fEfl);
 
@@ -662,11 +1341,10 @@ VMMDECL(void)           CPUMRawSetEFlags(PVMCPU pVCpu, uint32_t fEfl);
 VMMDECL(void)           CPUMSetChangedFlags(PVMCPU pVCpu, uint32_t fChangedFlags);
 VMMR3DECL(uint32_t)     CPUMR3RemEnter(PVMCPU pVCpu, uint32_t *puCpl);
 VMMR3DECL(void)         CPUMR3RemLeave(PVMCPU pVCpu, bool fNoOutOfSyncSels);
-VMMDECL(bool)           CPUMSupportsFXSR(PVM pVM);
+VMMDECL(bool)           CPUMSupportsXSave(PVM pVM);
 VMMDECL(bool)           CPUMIsHostUsingSysEnter(PVM pVM);
 VMMDECL(bool)           CPUMIsHostUsingSysCall(PVM pVM);
 VMMDECL(bool)           CPUMIsGuestFPUStateActive(PVMCPU pVCpu);
-VMMDECL(void)           CPUMDeactivateGuestFPUState(PVMCPU pVCpu);
 VMMDECL(bool)           CPUMIsGuestDebugStateActive(PVMCPU pVCpu);
 VMMDECL(bool)           CPUMIsGuestDebugStateActivePending(PVMCPU pVCpu);
 VMMDECL(void)           CPUMDeactivateGuestDebugState(PVMCPU pVCpu);
@@ -694,8 +1372,7 @@ VMMDECL(uint64_t)       CPUMGetGuestScalableBusFrequency(PVM pVM);
 
 
 #ifdef IN_RING3
-/** @defgroup grp_cpum_r3    The CPU Monitor(/Manager) API
- * @ingroup grp_cpum
+/** @defgroup grp_cpum_r3    The CPUM ring-3 API
  * @{
  */
 
@@ -709,26 +1386,38 @@ VMMR3DECL(void)         CPUMR3ResetCpu(PVM pVM, PVMCPU pVCpu);
 VMMDECL(bool)           CPUMR3IsStateRestorePending(PVM pVM);
 VMMR3DECL(void)         CPUMR3SetHWVirtEx(PVM pVM, bool fHWVirtExEnabled);
 VMMR3DECL(int)          CPUMR3SetCR4Feature(PVM pVM, RTHCUINTREG fOr, RTHCUINTREG fAnd);
-VMMR3DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdStdRCPtr(PVM pVM);
-VMMR3DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdExtRCPtr(PVM pVM);
-VMMR3DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdCentaurRCPtr(PVM pVM);
-VMMR3DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdDefRCPtr(PVM pVM);
 
+VMMR3DECL(int)              CPUMR3CpuIdInsert(PVM pVM, PCPUMCPUIDLEAF pNewLeaf);
+VMMR3DECL(int)              CPUMR3CpuIdGetLeaf(PVM pVM, PCPUMCPUIDLEAF pLeaf, uint32_t uLeaf, uint32_t uSubLeaf);
 VMMR3DECL(CPUMMICROARCH)    CPUMR3CpuIdDetermineMicroarchEx(CPUMCPUVENDOR enmVendor, uint8_t bFamily,
                                                             uint8_t bModel, uint8_t bStepping);
 VMMR3DECL(const char *)     CPUMR3MicroarchName(CPUMMICROARCH enmMicroarch);
 VMMR3DECL(int)              CPUMR3CpuIdCollectLeaves(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves);
-VMMR3DECL(int)              CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUKNOWNCPUID penmUnknownMethod, PCPUMCPUID pDefUnknown);
-VMMR3DECL(const char *)     CPUMR3CpuIdUnknownLeafMethodName(CPUMUKNOWNCPUID enmUnknownMethod);
+VMMR3DECL(int)              CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUNKNOWNCPUID penmUnknownMethod, PCPUMCPUID pDefUnknown);
+VMMR3DECL(const char *)     CPUMR3CpuIdUnknownLeafMethodName(CPUMUNKNOWNCPUID enmUnknownMethod);
 VMMR3DECL(CPUMCPUVENDOR)    CPUMR3CpuIdDetectVendorEx(uint32_t uEAX, uint32_t uEBX, uint32_t uECX, uint32_t uEDX);
 VMMR3DECL(const char *)     CPUMR3CpuVendorName(CPUMCPUVENDOR enmVendor);
 
+VMMR3DECL(int)              CPUMR3MsrRangesInsert(PVM pVM, PCCPUMMSRRANGE pNewRange);
+
+# if defined(VBOX_WITH_RAW_MODE) || defined(DOXYGEN_RUNNING)
+/** @name APIs for the CPUID raw-mode patch (legacy).
+ * @{ */
+VMMR3_INT_DECL(RCPTRTYPE(PCCPUMCPUID))     CPUMR3GetGuestCpuIdPatmDefRCPtr(PVM pVM);
+VMMR3_INT_DECL(uint32_t)                   CPUMR3GetGuestCpuIdPatmStdMax(PVM pVM);
+VMMR3_INT_DECL(uint32_t)                   CPUMR3GetGuestCpuIdPatmExtMax(PVM pVM);
+VMMR3_INT_DECL(uint32_t)                   CPUMR3GetGuestCpuIdPatmCentaurMax(PVM pVM);
+VMMR3_INT_DECL(RCPTRTYPE(PCCPUMCPUID))     CPUMR3GetGuestCpuIdPatmStdRCPtr(PVM pVM);
+VMMR3_INT_DECL(RCPTRTYPE(PCCPUMCPUID))     CPUMR3GetGuestCpuIdPatmExtRCPtr(PVM pVM);
+VMMR3_INT_DECL(RCPTRTYPE(PCCPUMCPUID))     CPUMR3GetGuestCpuIdPatmCentaurRCPtr(PVM pVM);
+/** @} */
+# endif
+
 /** @} */
 #endif /* IN_RING3 */
 
 #ifdef IN_RC
-/** @defgroup grp_cpum_gc    The CPU Monitor(/Manager) API
- * @ingroup grp_cpum
+/** @defgroup grp_cpum_rc    The CPUM Raw-mode Context API
  * @{
  */
 
@@ -767,8 +1456,7 @@ VMMDECL(void)           CPUMRCRecheckRawState(PVMCPU pVCpu, PCPUMCTXCORE pCtxCor
 #endif /* IN_RC */
 
 #ifdef IN_RING0
-/** @defgroup grp_cpum_r0    The CPU Monitor(/Manager) API
- * @ingroup grp_cpum
+/** @defgroup grp_cpum_r0    The CPUM ring-0 API
  * @{
  */
 VMMR0_INT_DECL(int)     CPUMR0ModuleInit(void);
@@ -784,7 +1472,7 @@ VMMR0_INT_DECL(bool)    CPUMR0DebugStateMaybeSaveGuest(PVMCPU pVCpu, bool fDr6);
 VMMR0_INT_DECL(void)    CPUMR0LoadGuestDebugState(PVMCPU pVCpu, bool fDr6);
 VMMR0_INT_DECL(void)    CPUMR0LoadHyperDebugState(PVMCPU pVCpu, bool fDr6);
 #ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
-VMMR0_INT_DECL(void)    CPUMR0SetLApic(PVMCPU pVCpu, RTCPUID idHostCpu);
+VMMR0_INT_DECL(void)    CPUMR0SetLApic(PVMCPU pVCpu, uint32_t iHostCpuSet);
 #endif
 
 /** @} */
diff --git a/include/VBox/vmm/cpum.mac b/include/VBox/vmm/cpum.mac
index 48d3eb7..ea4ed4e 100644
--- a/include/VBox/vmm/cpum.mac
+++ b/include/VBox/vmm/cpum.mac
@@ -3,7 +3,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2012 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -26,6 +26,52 @@
 %ifndef ___VBox_vmm_cpum_mac__
 %define ___VBox_vmm_cpum_mac__
 
+%include "iprt/asmdefs.mac"
+
+
+;;
+; The volatile XSAVE components when VBOX_WITH_KERNEL_USING_XMM is active.
+; @note ASSUMED to be at the most 32-bit in width at the moment.
+%ifdef VBOX_WITH_KERNEL_USING_XMM
+ %define CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI)
+%endif
+
+;;
+; CPUID leaf.
+; @remarks This structure is used by the patch manager and can only be extended
+;          by adding to the end of it.
+struc CPUMCPUIDLEAF
+    .uLeaf              resd    1
+    .uSubLeaf           resd    1
+    .fSubLeafMask       resd    1
+    .uEax               resd    1
+    .uEbx               resd    1
+    .uEcx               resd    1
+    .uEdx               resd    1
+    .fFlags             resd    1
+endstruc
+%define CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES RT_BIT_32(0)
+
+;;
+; For the default CPUID leaf value.
+; @remarks This is used by the patch manager and cannot be modified in any way.
+struc CPUMCPUID
+    .uEax               resd    1
+    .uEbx               resd    1
+    .uEcx               resd    1
+    .uEdx               resd    1
+endstruc
+
+
+;; @name Method used to deal with unknown CPUID leaves.
+;; @{
+%define CPUMUNKNOWNCPUID_DEFAULTS                1
+%define CPUMUNKNOWNCPUID_LAST_STD_LEAF           2
+%define CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX  3
+%define CPUMUNKNOWNCPUID_PASSTHRU                4
+;; @}
+
+
 ;;
 ; Registers frame.
 ; This is used internally in TRPM, VMMSwitcher_GuestToHost_GuestCtx
@@ -94,8 +140,9 @@ struc CPUMCTXCORE
 endstruc
 
 
+%define XSTATE_SIZE             8192
+
 struc CPUMCTX
-    .fpu                resb    512
     .eax                resq    1
     .ecx                resq    1
     .edx                resq    1
@@ -194,7 +241,14 @@ struc CPUMCTX
     .msrSFMASK          resb    8
     .msrKERNELGSBASE    resb    8
     .msrApicBase        resb    8
-    .au32SizePadding    resb    24
+    alignb 8
+    .aXcr               resq    2
+    .fXStateMask        resq    1
+    .pXStateR0      RTR0PTR_RES 1
+    .pXStateR3      RTR3PTR_RES 1
+    .pXStateRC      RTRCPTR_RES 1
+    .aoffXState         resw    64
+    alignb 64
 endstruc
 
 
diff --git a/include/VBox/vmm/cpumctx.h b/include/VBox/vmm/cpumctx.h
index c4c9df3..4d98582 100644
--- a/include/VBox/vmm/cpumctx.h
+++ b/include/VBox/vmm/cpumctx.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -246,11 +246,6 @@ typedef struct CPUMCTXCORE
 #pragma pack(1) /* for VBOXIDTR / VBOXGDTR. */
 typedef struct CPUMCTX
 {
-    /** FPU state. (16-byte alignment)
-     * @todo This doesn't have to be in X86FXSTATE on CPUs without fxsr - we need a type for the
-     *       actual format or convert it (waste of time).  */
-    X86FXSTATE      fpu;
-
     /** CPUMCTXCORE Part.
      * @{ */
 
@@ -403,12 +398,61 @@ typedef struct CPUMCTX
     uint64_t        msrApicBase;        /**< The local APIC base (IA32_APIC_BASE MSR). */
     /** @} */
 
+    /** The XCR0..XCR1 registers. */
+    uint64_t                    aXcr[2];
+    /** The mask to pass to XSAVE/XRSTOR in EDX:EAX.  If zero we use
+     *  FXSAVE/FXRSTOR (since bit 0 will always be set, we only need to test it). */
+    uint64_t                    fXStateMask;
+
+    /** Pointer to the FPU/SSE/AVX/XXXX state ring-0 mapping. */
+    R0PTRTYPE(PX86XSAVEAREA)    pXStateR0;
+    /** Pointer to the FPU/SSE/AVX/XXXX state ring-3 mapping. */
+    R3PTRTYPE(PX86XSAVEAREA)    pXStateR3;
+    /** Pointer to the FPU/SSE/AVX/XXXX state raw-mode mapping. */
+    RCPTRTYPE(PX86XSAVEAREA)    pXStateRC;
+    /** State component offsets into pXState, UINT16_MAX if not present. */
+    uint16_t                    aoffXState[64];
+
     /** Size padding. */
-    uint32_t        au32SizePadding[6];
+    uint32_t        au32SizePadding[HC_ARCH_BITS == 32 ? 13 : 11];
 } CPUMCTX;
 #pragma pack()
 
 #ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSizeAlignment(CPUMCTX, 64);
+
+/**
+ * Calculates the pointer to the given extended state component.
+ *
+ * @returns Pointer of type @a a_PtrType
+ * @param   a_pCtx          Pointer to the context.
+ * @param   a_iCompBit      The extended state component bit number.  This bit
+ *                          must be set in CPUMCTX::fXStateMask.
+ * @param   a_PtrType       The pointer type of the extended state component.
+ *
+ */
+#if defined(VBOX_STRICT) && defined(RT_COMPILER_SUPPORTS_LAMBDA)
+# define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
+    ([](PCCPUMCTX a_pLambdaCtx) -> a_PtrType \
+    { \
+        AssertCompile((a_iCompBit) < 64U); \
+        AssertMsg(a_pLambdaCtx->fXStateMask & RT_BIT_64(a_iCompBit), (#a_iCompBit "\n")); \
+        AssertMsg(a_pLambdaCtx->aoffXState[(a_iCompBit)] != UINT16_MAX, (#a_iCompBit "\n")); \
+        return (a_PtrType)((uint8_t *)a_pLambdaCtx->CTX_SUFF(pXState) + a_pLambdaCtx->aoffXState[(a_iCompBit)]); \
+    }(a_pCtx))
+#elif defined(VBOX_STRICT) && defined(__GNUC__)
+# define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
+    __extension__ (\
+    { \
+        AssertCompile((a_iCompBit) < 64U); \
+        AssertMsg((a_pCtx)->fXStateMask & RT_BIT_64(a_iCompBit), (#a_iCompBit "\n")); \
+        AssertMsg((a_pCtx)->aoffXState[(a_iCompBit)] != UINT16_MAX, (#a_iCompBit "\n")); \
+        (a_PtrType)((uint8_t *)(a_pCtx)->CTX_SUFF(pXState) + (a_pCtx)->aoffXState[(a_iCompBit)]); \
+    })
+#else
+# define CPUMCTX_XSAVE_C_PTR(a_pCtx, a_iCompBit, a_PtrType) \
+    ((a_PtrType)((uint8_t *)(a_pCtx)->CTX_SUFF(pXState) + (a_pCtx)->aoffXState[(a_iCompBit)]))
+#endif
 
 /**
  * Gets the CPUMCTXCORE part of a CPUMCTX.
@@ -416,7 +460,7 @@ typedef struct CPUMCTX
 # define CPUMCTX2CORE(pCtx) ((PCPUMCTXCORE)(void *)&(pCtx)->rax)
 
 /**
- * Gets the CPUMCTXCORE part of a CPUMCTX.
+ * Gets the CPUMCTX part from a CPUMCTXCORE.
  */
 # define CPUMCTX_FROM_CORE(a_pCtxCore) RT_FROM_MEMBER(a_pCtxCore, CPUMCTX, rax)
 
@@ -467,10 +511,10 @@ typedef const CPUMCTXMSRS *PCCPUMCTXMSRS;
  */
 typedef struct CPUMCPUID
 {
-    uint32_t eax;
-    uint32_t ebx;
-    uint32_t ecx;
-    uint32_t edx;
+    uint32_t uEax;
+    uint32_t uEbx;
+    uint32_t uEcx;
+    uint32_t uEdx;
 } CPUMCPUID;
 /** Pointer to a CPUID leaf. */
 typedef CPUMCPUID *PCPUMCPUID;
diff --git a/include/VBox/vmm/csam.h b/include/VBox/vmm/csam.h
index 99a6856..163b05c 100644
--- a/include/VBox/vmm/csam.h
+++ b/include/VBox/vmm/csam.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -72,7 +72,6 @@ VMM_INT_DECL(bool)      CSAMIsKnownDangerousInstr(PVM pVM, RTRCUINTPTR GCPtr);
 
 #ifdef IN_RING3
 /** @defgroup grp_csam_r3      The Code Scanning and Analysis API
- * @ingroup grp_csam
  * @{
  */
 
@@ -87,7 +86,7 @@ VMMR3_INT_DECL(int)     CSAMR3Reset(PVM pVM);
 VMMR3_INT_DECL(int)     CSAMR3FlushPage(PVM pVM, RTRCPTR addr);
 VMMR3_INT_DECL(int)     CSAMR3RemovePage(PVM pVM, RTRCPTR addr);
 VMMR3_INT_DECL(int)     CSAMR3CheckCode(PVM pVM, RTRCPTR pInstrGC);
-VMMR3_INT_DECL(int)     CSAMR3CheckCodeEx(PVM pVM, PCPUMCTXCORE pCtxCore, RTRCPTR pInstrGC);
+VMMR3_INT_DECL(int)     CSAMR3CheckCodeEx(PVM pVM, PCPUMCTX pCtx, RTRCPTR pInstrGC);
 VMMR3_INT_DECL(int)     CSAMR3MarkCode(PVM pVM, RTRCPTR pInstr, uint32_t cbInstr, bool fScanned);
 VMMR3_INT_DECL(int)     CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu);
 VMMR3_INT_DECL(int)     CSAMR3CheckGates(PVM pVM, uint32_t iGate, uint32_t cGates);
diff --git a/include/VBox/vmm/dbgf.h b/include/VBox/vmm/dbgf.h
index 9aa4be5..e7e7ec7 100644
--- a/include/VBox/vmm/dbgf.h
+++ b/include/VBox/vmm/dbgf.h
@@ -536,7 +536,7 @@ VMMR3DECL(int)      DBGFR3InfoStdErr(PUVM pUVM, const char *pszName, const char
 VMMR3_INT_DECL(int) DBGFR3InfoMulti(PVM pVM, const char *pszIncludePat, const char *pszExcludePat,
                                     const char *pszSepFmt, PCDBGFINFOHLP pHlp);
 
-/** @def DBGFR3InfoLog
+/** @def DBGFR3_INFO_LOG
  * Display a piece of info writing to the log if enabled.
  *
  * @param   a_pVM       The shared VM handle.
@@ -912,7 +912,7 @@ VMMR3DECL(int)      DBGFR3DisasInstrEx(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, RTGC
 VMMR3_INT_DECL(int) DBGFR3DisasInstrCurrent(PVMCPU pVCpu, char *pszOutput, uint32_t cbOutput);
 VMMR3DECL(int)      DBGFR3DisasInstrCurrentLogInternal(PVMCPU pVCpu, const char *pszPrefix);
 
-/** @def DBGFR3DisasInstrCurrentLog
+/** @def DBGFR3_DISAS_INSTR_CUR_LOG
  * Disassembles the current guest context instruction and writes it to the log.
  * All registers and data will be displayed. Addresses will be attempted resolved to symbols.
  */
@@ -928,7 +928,7 @@ VMMR3DECL(int)      DBGFR3DisasInstrCurrentLogInternal(PVMCPU pVCpu, const char
 
 VMMR3DECL(int) DBGFR3DisasInstrLogInternal(PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr, const char *pszPrefix);
 
-/** @def DBGFR3DisasInstrLog
+/** @def DBGFR3_DISAS_INSTR_LOG
  * Disassembles the specified guest context instruction and writes it to the log.
  * Addresses will be attempted resolved to symbols.
  * @thread Any EMT.
@@ -1550,6 +1550,8 @@ typedef enum DBGFOSINTERFACE
     DBGFOSINTERFACE_PROCESS,
     /** Thread info. */
     DBGFOSINTERFACE_THREAD,
+    /** Kernel message log - DBGFOSIDMESG. */
+    DBGFOSINTERFACE_DMESG,
     /** The end of the valid entries. */
     DBGFOSINTERFACE_END,
     /** The usual 32-bit type blowup. */
@@ -1657,6 +1659,9 @@ typedef struct DBGFOSREG
      *
      * This is called after pfnProbe.
      *
+     * The returned interface must be valid until pfnDestruct is called.  Two calls
+     * to this method with the same @a enmIf value must return the same pointer.
+     *
      * @returns Pointer to the interface if available, NULL if not available.
      * @param   pUVM    The user mode VM handle.
      * @param   pvData  Pointer to the instance data.
@@ -1675,6 +1680,49 @@ typedef DBGFOSREG const *PCDBGFOSREG;
 /** Magic value for DBGFOSREG::u32Magic and DBGFOSREG::u32EndMagic. (Hitomi Kanehara) */
 #define DBGFOSREG_MAGIC     0x19830808
 
+
+/**
+ * Interface for querying kernel log messages (DBGFOSINTERFACE_DMESG).
+ */
+typedef struct DBGFOSIDMESG
+{
+    /** Trailing magic (DBGFOSIDMESG_MAGIC). */
+    uint32_t    u32Magic;
+
+    /**
+     * Query the kernel log.
+     *
+     * @returns VBox status code.
+     * @retval  VERR_NOT_FOUND if the messages could not be located.
+     * @retval  VERR_INVALID_STATE if the messages was found to have unknown/invalid
+     *          format.
+     * @retval  VERR_BUFFER_OVERFLOW if the buffer isn't large enough, pcbActual
+     *          will be set to the required buffer size.  The buffer, however, will
+     *          be filled with as much data as it can hold (properly zero terminated
+     *          of course).
+     *
+     * @param   pThis       Pointer to the interface structure.
+     * @param   pUVM        The user mode VM handle.
+     * @param   fFlags      Flags reserved for future use, MBZ.
+     * @param   cMessages   The number of messages to retrieve, counting from the
+     *                      end of the log (i.e. like tail), use UINT32_MAX for all.
+     * @param   pszBuf      The output buffer.
+     * @param   cbBuf       The buffer size.
+     * @param   pcbActual   Where to store the number of bytes actually returned,
+     *                      including zero terminator.  On VERR_BUFFER_OVERFLOW this
+     *                      holds the necessary buffer size.  Optional.
+     */
+    DECLCALLBACKMEMBER(int, pfnQueryKernelLog)(struct DBGFOSIDMESG *pThis, PUVM pUVM, uint32_t fFlags, uint32_t cMessages,
+                                               char *pszBuf, size_t cbBuf, size_t *pcbActual);
+    /** Trailing magic (DBGFOSIDMESG_MAGIC). */
+    uint32_t    u32EndMagic;
+} DBGFOSIDMESG;
+/** Pointer to the interface for query kernel log messages (DBGFOSINTERFACE_DMESG). */
+typedef DBGFOSIDMESG *PDBGFOSIDMESG;
+/** Magic value for DBGFOSIDMESG::32Magic and DBGFOSIDMESG::u32EndMagic. (Kenazburo Oe) */
+#define DBGFOSIDMESG_MAGIC UINT32_C(0x19350131)
+
+
 VMMR3DECL(int)      DBGFR3OSRegister(PUVM pUVM, PCDBGFOSREG pReg);
 VMMR3DECL(int)      DBGFR3OSDeregister(PUVM pUVM, PCDBGFOSREG pReg);
 VMMR3DECL(int)      DBGFR3OSDetect(PUVM pUVM, char *pszName, size_t cchName);
@@ -1684,6 +1732,62 @@ VMMR3DECL(void *)   DBGFR3OSQueryInterface(PUVM pUVM, DBGFOSINTERFACE enmIf);
 
 VMMR3DECL(int)      DBGFR3CoreWrite(PUVM pUVM, const char *pszFilename, bool fReplaceFile);
 
+
+#ifdef IN_RING3
+/** @defgroup grp_dbgf_plug_in      The DBGF Plug-in Interface
+ * @{
+ */
+
+/** The plug-in module name prefix. */
+#define DBGF_PLUG_IN_PREFIX         "DbgPlugIn"
+
+/** The name of the plug-in entry point (FNDBGFPLUGIN) */
+#define DBGF_PLUG_IN_ENTRYPOINT     "DbgPlugInEntry"
+
+/**
+ * DBGF plug-in operations.
+ */
+typedef enum DBGFPLUGINOP
+{
+    /** The usual invalid first value. */
+    DBGFPLUGINOP_INVALID,
+    /** Initialize the plug-in for a VM, register all the stuff.
+     * The plug-in will be unloaded on failure.
+     * uArg: The full VirtualBox version, see VBox/version.h. */
+    DBGFPLUGINOP_INIT,
+    /** Terminate the plug-ing for a VM, deregister all the stuff.
+     * The plug-in will be unloaded after this call regardless of the return
+     * code. */
+    DBGFPLUGINOP_TERM,
+    /** The usual 32-bit hack. */
+    DBGFPLUGINOP_32BIT_HACK = 0x7fffffff
+} DBGFPLUGINOP;
+
+/**
+ * DBGF plug-in main entry point.
+ *
+ * @returns VBox status code.
+ *
+ * @param   enmOperation    The operation.
+ * @param   pUVM            The user mode VM handle. This may be NULL.
+ * @param   uArg            Extra argument.
+ */
+typedef DECLCALLBACK(int) FNDBGFPLUGIN(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg);
+/** Pointer to a FNDBGFPLUGIN. */
+typedef FNDBGFPLUGIN *PFNDBGFPLUGIN;
+
+/** @copydoc FNDBGFPLUGIN */
+DECLEXPORT(int) DbgPlugInEntry(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg);
+
+VMMR3DECL(int)  DBGFR3PlugInLoad(PUVM pUVM, const char *pszPlugIn, char *pszActual, size_t cbActual, PRTERRINFO pErrInfo);
+VMMR3DECL(int)  DBGFR3PlugInUnload(PUVM pUVM, const char *pszName);
+VMMR3DECL(void) DBGFR3PlugInLoadAll(PUVM pUVM);
+VMMR3DECL(void) DBGFR3PlugInUnloadAll(PUVM pUVM);
+
+/** @} */
+#endif /* IN_RING3 */
+
+
 /** @} */
 
 
diff --git a/include/VBox/vmm/em.h b/include/VBox/vmm/em.h
index d492ecf..5a57e9c 100644
--- a/include/VBox/vmm/em.h
+++ b/include/VBox/vmm/em.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -192,10 +192,6 @@ VMM_INT_DECL(VBOXSTRICTRC)      EMInterpretMWait(PVM pVM, PVMCPU pVCpu, PCPUMCTX
 VMM_INT_DECL(int)               EMInterpretMonitor(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
 VMM_INT_DECL(int)               EMInterpretDRxWrite(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegDrx, uint32_t SrcRegGen);
 VMM_INT_DECL(int)               EMInterpretDRxRead(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegGen, uint32_t SrcRegDrx);
-VMM_INT_DECL(int)               EMInterpretCRxWrite(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegCrx, uint32_t SrcRegGen);
-VMM_INT_DECL(int)               EMInterpretCRxRead(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegGen, uint32_t SrcRegCrx);
-VMM_INT_DECL(int)               EMInterpretLMSW(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint16_t u16Data);
-VMM_INT_DECL(int)               EMInterpretCLTS(PVM pVM, PVMCPU pVCpu);
 VMM_INT_DECL(int)               EMInterpretRdmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
 VMM_INT_DECL(int)               EMInterpretWrmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame);
 VMM_INT_DECL(bool)              EMShouldContinueAfterHalt(PVMCPU pVCpu, PCPUMCTX pCtx);
@@ -250,7 +246,6 @@ VMM_INT_DECL(int)               EMRemTryLock(PVM pVM);
 
 #ifdef IN_RING3
 /** @defgroup grp_em_r3     The EM Host Context Ring-3 API
- * @ingroup grp_em
  * @{
  */
 
diff --git a/include/VBox/vmm/ftm.h b/include/VBox/vmm/ftm.h
index e8702d6..487c6e4 100644
--- a/include/VBox/vmm/ftm.h
+++ b/include/VBox/vmm/ftm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -52,7 +52,6 @@ VMM_INT_DECL(int)   FTMSetCheckpoint(PVM pVM, FTMCHECKPOINTTYPE enmType);
 
 #ifdef IN_RING3
 /** @defgroup grp_ftm_r3     The FTM Host Context Ring-3 API
- * @ingroup grp_ftm
  * @{
  */
 VMMR3DECL(int)      FTMR3PowerOn(PUVM pUVM, bool fMaster, unsigned uInterval, const char *pszAddress, unsigned uPort, const char *pszPassword);
diff --git a/include/VBox/vmm/gim.h b/include/VBox/vmm/gim.h
new file mode 100644
index 0000000..bcd01b3
--- /dev/null
+++ b/include/VBox/vmm/gim.h
@@ -0,0 +1,185 @@
+/** @file
+ * GIM - Guest Interface Manager.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifndef ___VBox_vmm_gim_h
+#define ___VBox_vmm_gim_h
+
+#include <VBox/cdefs.h>
+#include <VBox/types.h>
+#include <VBox/param.h>
+
+#include <VBox/vmm/cpum.h>
+
+/** The value used to specify that VirtualBox must use the newest
+ *  implementation version of the GIM provider. */
+#define GIM_VERSION_LATEST                  UINT32_C(0)
+
+RT_C_DECLS_BEGIN
+
+/** @defgroup grp_gim   The Guest Interface Manager API
+ * @{
+ */
+
+/**
+ * GIM Provider Identifiers.
+ * @remarks Part of saved state!
+ */
+typedef enum GIMPROVIDERID
+{
+    /** None. */
+    GIMPROVIDERID_NONE = 0,
+    /** Minimal. */
+    GIMPROVIDERID_MINIMAL,
+    /** Microsoft Hyper-V. */
+    GIMPROVIDERID_HYPERV,
+    /** Linux KVM Interface. */
+    GIMPROVIDERID_KVM
+} GIMPROVIDERID;
+AssertCompileSize(GIMPROVIDERID, sizeof(uint32_t));
+
+
+/**
+ * A GIM MMIO2 region record.
+ */
+typedef struct GIMMMIO2REGION
+{
+    /** The region index. */
+    uint8_t             iRegion;
+    /** Whether an RC mapping is required. */
+    bool                fRCMapping;
+    /** Whether this region has been registered. */
+    bool                fRegistered;
+    /** Whether this region is currently mapped. */
+    bool                fMapped;
+    /** Alignment padding. */
+    uint8_t             au8Alignment0[3];
+    /** Size of the region (must be page aligned). */
+    uint32_t            cbRegion;
+    /** Alignment padding. */
+    uint32_t            u32Alignment0;
+    /** The host ring-0 address of the first page in the region. */
+    R0PTRTYPE(void *)   pvPageR0;
+    /** The host ring-3 address of the first page in the region. */
+    R3PTRTYPE(void *)   pvPageR3;
+    /** The ring-context address of the first page in the region. */
+    RCPTRTYPE(void *)   pvPageRC;
+    /** The guest-physical address of the first page in the region. */
+    RTGCPHYS            GCPhysPage;
+    /** The description of the region. */
+    char                szDescription[32];
+} GIMMMIO2REGION;
+/** Pointer to a GIM MMIO2 region. */
+typedef GIMMMIO2REGION *PGIMMMIO2REGION;
+/** Pointer to a const GIM MMIO2 region. */
+typedef GIMMMIO2REGION const *PCGIMMMIO2REGION;
+AssertCompileMemberAlignment(GIMMMIO2REGION, cbRegion, 8);
+AssertCompileMemberAlignment(GIMMMIO2REGION, pvPageR0, 8);
+
+#if 0
+/**
+ * A GIM Hypercall handler.
+ *
+ * @param   pVM             Pointer to the VMCPU.
+ * @param   pCtx            Pointer to the guest-CPU context.
+ */
+typedef DECLCALLBACK(int) FNGIMHYPERCALL(PVMCPU pVCpu, PCPUMCTX pCtx);
+/** Pointer to a GIM hypercall handler. */
+typedef FNGIMHYPERCALL *PFNGIMHYPERCALL;
+
+/**
+ * A GIM MSR-read handler.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VMCPU.
+ * @param   idMsr           The MSR being read.
+ * @param   pRange          The range that the MSR belongs to.
+ * @param   puValue         Where to store the value of the MSR.
+ */
+typedef DECLCALLBACK(int) FNGIMRDMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
+/** Pointer to a GIM MSR-read handler. */
+typedef FNGIMRDMSR *PFNGIMRDMSR;
+
+/**
+ * A GIM MSR-write handler.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VMCPU.
+ * @param   idMsr           The MSR being written.
+ * @param   pRange          The range that the MSR belongs to.
+ * @param   uValue          The value to set, ignored bits masked.
+ * @param   uRawValue       The raw value with the ignored bits not masked.
+ */
+typedef DECLCALLBACK(int) FNGIMWRMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue);
+/** Pointer to a GIM MSR-write handler. */
+typedef FNGIMWRMSR *PFNGIMWRMSR;
+#endif
+
+
+#ifdef IN_RC
+/** @defgroup grp_gim_rc  The GIM Raw-mode Context API
+ * @{
+ */
+/** @} */
+#endif /* IN_RC */
+
+#ifdef IN_RING0
+/** @defgroup grp_gim_r0  The GIM Host Context Ring-0 API
+ * @{
+ */
+VMMR0_INT_DECL(int)         GIMR0InitVM(PVM pVM);
+VMMR0_INT_DECL(int)         GIMR0TermVM(PVM pVM);
+VMMR0_INT_DECL(int)         GIMR0UpdateParavirtTsc(PVM pVM, uint64_t u64Offset);
+/** @} */
+#endif /* IN_RING0 */
+
+
+#ifdef IN_RING3
+/** @defgroup grp_gim_r3  The GIM Host Context Ring-3 API
+ * @{
+ */
+VMMR3_INT_DECL(int)         GIMR3Init(PVM pVM);
+VMMR3_INT_DECL(int)         GIMR3InitCompleted(PVM pVM);
+VMMR3_INT_DECL(int)         GIMR3Term(PVM pVM);
+VMMR3_INT_DECL(void)        GIMR3Reset(PVM pVM);
+VMMR3DECL(void)             GIMR3GimDeviceRegister(PVM pVM, PPDMDEVINS pDevIns);
+VMMR3DECL(PGIMMMIO2REGION)  GIMR3GetMmio2Regions(PVM pVM, uint32_t *pcRegions);
+/** @} */
+#endif /* IN_RING3 */
+
+VMMDECL(bool)               GIMIsEnabled(PVM pVM);
+VMMDECL(GIMPROVIDERID)      GIMGetProvider(PVM pVM);
+VMM_INT_DECL(bool)          GIMIsParavirtTscEnabled(PVM pVM);
+VMM_INT_DECL(bool)          GIMAreHypercallsEnabled(PVMCPU pVCpu);
+VMM_INT_DECL(int)           GIMHypercall(PVMCPU pVCpu, PCPUMCTX pCtx);
+VMM_INT_DECL(int)           GIMXcptUD(PVMCPU pVCpu, PCPUMCTX pCtx, PDISCPUSTATE pDis);
+VMM_INT_DECL(bool)          GIMShouldTrapXcptUD(PVMCPU pVCpu);
+VMM_INT_DECL(VBOXSTRICTRC)  GIMReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
+VMM_INT_DECL(VBOXSTRICTRC)  GIMWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue);
+/** @} */
+
+RT_C_DECLS_END
+
+#endif
+
diff --git a/include/VBox/vmm/gmm.h b/include/VBox/vmm/gmm.h
index e5db104..ba3fef8 100644
--- a/include/VBox/vmm/gmm.h
+++ b/include/VBox/vmm/gmm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2007-2012 Oracle Corporation
+ * Copyright (C) 2007-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -768,7 +768,6 @@ GMMR0DECL(int)      GMMR0ResetStatisticsReq(PVM pVM, PGMMRESETSTATISTICSSREQ pRe
 
 #ifdef IN_RING3
 /** @defgroup grp_gmm_r3    The Global Memory Manager Ring-3 API Wrappers
- * @ingroup grp_gmm
  * @{
  */
 GMMR3DECL(int)  GMMR3InitialReservation(PVM pVM, uint64_t cBasePages, uint32_t cShadowPages, uint32_t cFixedPages,
diff --git a/include/VBox/vmm/gvm.h b/include/VBox/vmm/gvm.h
index 0fe406b..7a40b37 100644
--- a/include/VBox/vmm/gvm.h
+++ b/include/VBox/vmm/gvm.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2007-2011 Oracle Corporation
+ * Copyright (C) 2007-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -32,7 +32,7 @@
 #include <iprt/thread.h>
 
 
-/** @defgroup grp_gvm   GVMCPU - The Global VMCPU Data
+/** @defgroup grp_gvmcpu GVMCPU - The Global VMCPU Data
  * @{
  */
 
diff --git a/include/VBox/vmm/hm.h b/include/VBox/vmm/hm.h
index 0be9eee..6275bbb 100644
--- a/include/VBox/vmm/hm.h
+++ b/include/VBox/vmm/hm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -143,6 +143,8 @@ VMM_INT_DECL(bool)              HMHasPendingIrq(PVM pVM);
 VMM_INT_DECL(PX86PDPE)          HMGetPaePdpes(PVMCPU pVCpu);
 VMM_INT_DECL(int)               HMAmdIsSubjectToErratum170(uint32_t *pu32Family, uint32_t *pu32Model, uint32_t *pu32Stepping);
 VMM_INT_DECL(bool)              HMSetSingleInstruction(PVMCPU pVCpu, bool fEnable);
+VMM_INT_DECL(void)              HMHypercallsEnable(PVMCPU pVCpu);
+VMM_INT_DECL(void)              HMHypercallsDisable(PVMCPU pVCpu);
 
 #ifndef IN_RC
 VMM_INT_DECL(int)               HMFlushTLB(PVMCPU pVCpu);
@@ -150,18 +152,21 @@ VMM_INT_DECL(int)               HMFlushTLBOnAllVCpus(PVM pVM);
 VMM_INT_DECL(int)               HMInvalidatePageOnAllVCpus(PVM pVM, RTGCPTR GCVirt);
 VMM_INT_DECL(int)               HMInvalidatePhysPage(PVM pVM, RTGCPHYS GCPhys);
 VMM_INT_DECL(bool)              HMIsNestedPagingActive(PVM pVM);
+VMM_INT_DECL(bool)              HMAreNestedPagingAndFullGuestExecEnabled(PVM pVM);
 VMM_INT_DECL(bool)              HMIsLongModeAllowed(PVM pVM);
+VMM_INT_DECL(bool)              HMAreMsrBitmapsAvailable(PVM pVM);
 VMM_INT_DECL(PGMMODE)           HMGetShwPagingMode(PVM pVM);
 #else /* Nops in RC: */
-# define HMFlushTLB(pVCpu)                  do { } while (0)
-# define HMIsNestedPagingActive(pVM)        false
-# define HMIsLongModeAllowed(pVM)           false
-# define HMFlushTLBOnAllVCpus(pVM)          do { } while (0)
+# define HMFlushTLB(pVCpu)                              do { } while (0)
+# define HMIsNestedPagingActive(pVM)                    false
+# define HMAreNestedPagingAndFullGuestExecEnabled(pVM)  false
+# define HMIsLongModeAllowed(pVM)                       false
+# define HMAreMsrBitmapsAvailable(pVM)                  false
+# define HMFlushTLBOnAllVCpus(pVM)                      do { } while (0)
 #endif
 
 #ifdef IN_RING0
 /** @defgroup grp_hm_r0    The VM Hardware Manager API
- * @ingroup grp_hm
  * @{
  */
 VMMR0_INT_DECL(int)             HMR0Init(void);
@@ -176,6 +181,21 @@ VMMR0_INT_DECL(void)            HMR0SavePendingIOPortWrite(PVMCPU pVCpu, RTGCPTR
                                                            unsigned uPort, unsigned uAndVal, unsigned cbSize);
 VMMR0_INT_DECL(void)            HMR0SavePendingIOPortRead(PVMCPU pVCpu, RTGCPTR GCPtrRip, RTGCPTR GCPtrRipNext,
                                                           unsigned uPort, unsigned uAndVal, unsigned cbSize);
+VMMR0_INT_DECL(int)             HMR0SetupVM(PVM pVM);
+VMMR0_INT_DECL(int)             HMR0RunGuestCode(PVM pVM, PVMCPU pVCpu);
+VMMR0_INT_DECL(int)             HMR0Enter(PVM pVM, PVMCPU pVCpu);
+VMMR0_INT_DECL(int)             HMR0EnterCpu(PVMCPU pVCpu);
+VMMR0_INT_DECL(int)             HMR0LeaveCpu(PVMCPU pVCpu);
+VMMR0_INT_DECL(void)            HMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, void *pvUser);
+VMMR0_INT_DECL(bool)            HMR0SuspendPending(void);
+
+# if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
+VMMR0_INT_DECL(int)             HMR0SaveFPUState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
+VMMR0_INT_DECL(int)             HMR0SaveDebugState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
+VMMR0_INT_DECL(int)             HMR0TestSwitcher3264(PVM pVM);
+# endif
+
+VMMR0_INT_DECL(int)             HMR0EnsureCompleteBasicContext(PVMCPU pVCpu, PCPUMCTX pMixedCtx);
 
 /** @} */
 #endif /* IN_RING0 */
@@ -183,7 +203,6 @@ VMMR0_INT_DECL(void)            HMR0SavePendingIOPortRead(PVMCPU pVCpu, RTGCPTR
 
 #ifdef IN_RING3
 /** @defgroup grp_hm_r3    The VM Hardware Manager API
- * @ingroup grp_hm
  * @{
  */
 VMMR3DECL(bool)                 HMR3IsEnabled(PUVM pUVM);
@@ -217,48 +236,6 @@ VMMR3_INT_DECL(bool)            HMR3IsVmxPreemptionTimerUsed(PVM pVM);
 /** @} */
 #endif /* IN_RING3 */
 
-#ifdef IN_RING0
-/** @addtogroup grp_hm_r0
- * @{
- */
-/** Disables preemption if required. */
-# define HM_DISABLE_PREEMPT_IF_NEEDED() \
-   RTTHREADPREEMPTSTATE PreemptStateInternal = RTTHREADPREEMPTSTATE_INITIALIZER; \
-   bool fPreemptDisabledInternal = false; \
-   if (RTThreadPreemptIsEnabled(NIL_RTTHREAD)) \
-   { \
-       Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu)); \
-       RTThreadPreemptDisable(&PreemptStateInternal); \
-       fPreemptDisabledInternal = true; \
-   }
-
-/** Restores preemption if previously disabled by HM_DISABLE_PREEMPT(). */
-# define HM_RESTORE_PREEMPT_IF_NEEDED() \
-   do \
-   { \
-        if (fPreemptDisabledInternal) \
-            RTThreadPreemptRestore(&PreemptStateInternal); \
-   } while (0)
-
-VMMR0_INT_DECL(int)             HMR0SetupVM(PVM pVM);
-VMMR0_INT_DECL(int)             HMR0RunGuestCode(PVM pVM, PVMCPU pVCpu);
-VMMR0_INT_DECL(int)             HMR0Enter(PVM pVM, PVMCPU pVCpu);
-VMMR0_INT_DECL(int)             HMR0Leave(PVM pVM, PVMCPU pVCpu);
-VMMR0_INT_DECL(int)             HMR0EnterCpu(PVMCPU pVCpu);
-VMMR0_INT_DECL(int)             HMR0LeaveCpu(PVMCPU pVCpu);
-VMMR0_INT_DECL(void)            HMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, void *pvUser);
-VMMR0_INT_DECL(bool)            HMR0SuspendPending(void);
-
-# if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
-VMMR0_INT_DECL(int)             HMR0SaveFPUState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
-VMMR0_INT_DECL(int)             HMR0SaveDebugState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
-VMMR0_INT_DECL(int)             HMR0TestSwitcher3264(PVM pVM);
-# endif
-
-/** @} */
-#endif /* IN_RING0 */
-
-
 /** @} */
 RT_C_DECLS_END
 
diff --git a/include/VBox/vmm/hm_svm.h b/include/VBox/vmm/hm_svm.h
index 7a67c38..5cd73f8 100644
--- a/include/VBox/vmm/hm_svm.h
+++ b/include/VBox/vmm/hm_svm.h
@@ -1,9 +1,9 @@
 /** @file
- * HM - SVM Structures and Definitions. (VMM)
+ * HM - SVM (AMD-V) Structures and Definitions. (VMM)
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -31,7 +31,8 @@
 #include <iprt/assert.h>
 #include <iprt/asm.h>
 
-/** @defgroup grp_svm   svm Types and Definitions
+
+/** @defgroup grp_svm   SVM (AMD-V) Types and Definitions
  * @ingroup grp_hm
  * @{
  */
@@ -262,6 +263,8 @@
 #define SVM_EXIT_MWAIT                  0x8B
 /** MWAIT instruction, when armed. */
 #define SVM_EXIT_MWAIT_ARMED            0x8C
+/** XSETBV instruction. */
+#define SVM_EXIT_XSETBV                 0x8D
 /** Nested paging: host-level page fault occurred (EXITINFO1 contains fault errorcode; EXITINFO2 contains the guest physical address causing the fault). */
 #define SVM_EXIT_NPF                    0x400
 /** AVIC: Virtual IPI delivery not completed. */
@@ -279,22 +282,22 @@
  * @{
  */
 /** Set to 1 if the task switch was caused by an IRET; else cleared to 0. */
-#define SVM_EXIT2_TASK_SWITCH_IRET                  RT_BIT_64(36)
+#define SVM_EXIT2_TASK_SWITCH_IRET            RT_BIT_64(36)
 /** Set to 1 if the task switch was caused by a far jump; else cleared to 0. */
-#define SVM_EXIT2_TASK_SWITCH_JMP                   RT_BIT_64(38)
+#define SVM_EXIT2_TASK_SWITCH_JMP             RT_BIT_64(38)
 /** Set to 1 if the task switch has an error code; else cleared to 0. */
-#define SVM_EXIT2_TASK_SWITCH_HAS_ERROR_CODE        RT_BIT_64(44)
+#define SVM_EXIT2_TASK_SWITCH_HAS_ERROR_CODE  RT_BIT_64(44)
 /** The value of EFLAGS.RF that would be saved in the outgoing TSS if the task switch were not intercepted. */
-#define SVM_EXIT2_TASK_SWITCH_EFLAGS_RF             RT_BIT_64(48)
+#define SVM_EXIT2_TASK_SWITCH_EFLAGS_RF       RT_BIT_64(48)
 /** @} */
 
 /** @name SVMVMCB.u64ExitInfo1 for MSR accesses
  * @{
  */
 /** The access was a read MSR. */
-#define SVM_EXIT1_MSR_READ                      0x0
+#define SVM_EXIT1_MSR_READ                    0x0
 /** The access was a write MSR. */
-#define SVM_EXIT1_MSR_WRITE                     0x1
+#define SVM_EXIT1_MSR_WRITE                   0x1
 /** @} */
 
 /** @name SVMVMCB.ctrl.u32InterceptCtrl1
@@ -403,13 +406,13 @@
 /** @name SVMVMCB.ctrl.u64NestedPaging
  * @{
  */
-#define SVM_NESTED_PAGING_ENABLE                RT_BIT(0)
+#define SVM_NESTED_PAGING_ENABLE              RT_BIT(0)
 /** @} */
 
 /** @name SVMVMCB.ctrl.u64IntShadow
  * @{
  */
-#define SVM_INTERRUPT_SHADOW_ACTIVE             RT_BIT(0)
+#define SVM_INTERRUPT_SHADOW_ACTIVE           RT_BIT(0)
 /** @} */
 
 
@@ -444,7 +447,6 @@
 /**
  * SVM Selector type; includes hidden parts.
  */
-#pragma pack(1)
 typedef struct
 {
     uint16_t    u16Sel;
@@ -452,12 +454,11 @@ typedef struct
     uint32_t    u32Limit;
     uint64_t    u64Base;        /**< Only lower 32 bits are implemented for CS, DS, ES & SS. */
 } SVMSEL;
-#pragma pack()
+AssertCompileSize(SVMSEL, 16);
 
 /**
  * SVM GDTR/IDTR type.
  */
-#pragma pack(1)
 typedef struct
 {
     uint16_t    u16Reserved1;
@@ -465,7 +466,7 @@ typedef struct
     uint32_t    u32Limit;       /**< Only lower 16 bits are implemented. */
     uint64_t    u64Base;
 } SVMGDTR;
-#pragma pack()
+AssertCompileSize(SVMGDTR, 16);
 typedef SVMGDTR SVMIDTR;
 
 /**
@@ -494,16 +495,16 @@ typedef union
 {
     struct
     {
-        uint32_t    u8VTPR              : 8;
-        uint32_t    u1VIrqValid         : 1;
+        uint32_t    u8VTPR              : 8;    /* V_TPR */
+        uint32_t    u1VIrqValid         : 1;    /* V_IRQ */
         uint32_t    u7Reserved          : 7;
-        uint32_t    u4VIrqPriority      : 4;
-        uint32_t    u1IgnoreTPR         : 1;
+        uint32_t    u4VIrqPriority      : 4;    /* V_INTR_PRIO */
+        uint32_t    u1IgnoreTPR         : 1;    /* V_IGN_TPR */
         uint32_t    u3Reserved          : 3;
-        uint32_t    u1VIrqMasking       : 1;
+        uint32_t    u1VIrqMasking       : 1;    /* V_INTR_MASKING */
         uint32_t    u6Reserved          : 6;
         uint32_t    u1AvicEnable        : 1;
-        uint32_t    u8VIrqVector        : 8;
+        uint32_t    u8VIrqVector        : 8;    /* V_INTR_VECTOR */
         uint32_t    u24Reserved         : 24;
     } n;
     uint64_t    u;
@@ -600,7 +601,6 @@ AssertCompileSize(SVMAVICPHYS, 8);
 /**
  * SVM VM Control Block. (VMCB)
  */
-#pragma pack(1)
 typedef struct SVMVMCB
 {
     /** Control Area. */
@@ -618,7 +618,7 @@ typedef struct SVMVMCB
         uint32_t    u32InterceptException;
         /** Offset 0x0C - Intercept control field 1. */
         uint32_t    u32InterceptCtrl1;
-        /** Offset 0x0C - Intercept control field 2. */
+        /** Offset 0x10 - Intercept control field 2. */
         uint32_t    u32InterceptCtrl2;
         /** Offset 0x14-0x3F - Reserved. */
         uint8_t     u8Reserved[0x3c - 0x14];
@@ -664,7 +664,7 @@ typedef struct SVMVMCB
         uint64_t    u64NextRIP;
         /** Offset 0xD0 - Number of bytes fetched. */
         uint8_t     cbInstrFetched;
-        /** Offset 0xD1 - Number of bytes fetched. */
+        /** Offset 0xD1 - Fetched bytes. */
         uint8_t     abInstr[15];
         /** Offset 0xE0 - AVIC APIC_BACKING_PAGE pointer. */
         SVMAVIC     AvicBackingPagePtr;
@@ -771,34 +771,88 @@ typedef struct SVMVMCB
     /** Offset 0x698-0xFFF- Reserved. */
     uint8_t     u8Reserved10[0x1000-0x698];
 } SVMVMCB;
-#pragma pack()
 /** Pointer to the SVMVMCB structure. */
 typedef SVMVMCB *PSVMVMCB;
-AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptRdCRx,    0x000);
-AssertCompileMemberOffset(SVMVMCB, ctrl.u16PauseFilterCount,  0x03e);
-AssertCompileMemberOffset(SVMVMCB, ctrl.TLBCtrl,              0x058);
-AssertCompileMemberOffset(SVMVMCB, ctrl.ExitIntInfo,          0x088);
-AssertCompileMemberOffset(SVMVMCB, ctrl.EventInject,          0x0A8);
-AssertCompileMemberOffset(SVMVMCB, ctrl.abInstr,              0x0D1);
-AssertCompileMemberOffset(SVMVMCB, ctrl.AvicBackingPagePtr,   0x0E0);
-AssertCompileMemberOffset(SVMVMCB, ctrl.AvicLogicalTablePtr,  0x0F0);
-AssertCompileMemberOffset(SVMVMCB, ctrl.AvicPhysicalTablePtr, 0x0F8);
-AssertCompileMemberOffset(SVMVMCB, guest,                     0x400);
-AssertCompileMemberOffset(SVMVMCB, guest.ES,                  0x400);
-AssertCompileMemberOffset(SVMVMCB, guest.TR,                  0x490);
-AssertCompileMemberOffset(SVMVMCB, guest.u64EFER,             0x4D0);
-AssertCompileMemberOffset(SVMVMCB, guest.u64CR4,              0x548);
-AssertCompileMemberOffset(SVMVMCB, guest.u64RIP,              0x578);
-AssertCompileMemberOffset(SVMVMCB, guest.u64RSP,              0x5D8);
-AssertCompileMemberOffset(SVMVMCB, guest.u64CR2,              0x640);
-AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved4,         0x4A0);
-AssertCompileMemberOffset(SVMVMCB, guest.u8CPL,               0x4CB);
-AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved6,         0x4D8);
-AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved7,         0x580);
-AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved9,         0x648);
-AssertCompileMemberOffset(SVMVMCB, guest.u64GPAT,             0x668);
-AssertCompileMemberOffset(SVMVMCB, guest.u64LASTEXCPTO,       0x690);
-AssertCompileMemberOffset(SVMVMCB, u8Reserved10,              0x698);
+AssertCompileMemberOffset(SVMVMCB, ctrl, 0x00);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptRdCRx, 0x00);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptWrCRx, 0x02);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptRdDRx, 0x04);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u16InterceptWrDRx, 0x06);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u32InterceptException, 0x08);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u32InterceptCtrl1, 0x0C);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u32InterceptCtrl2, 0x10);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u8Reserved, 0x14);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u16PauseFilterThreshold, 0x3c);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u16PauseFilterCount, 0x3e);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64IOPMPhysAddr, 0x40);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64MSRPMPhysAddr, 0x48);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64TSCOffset, 0x50);
+AssertCompileMemberOffset(SVMVMCB, ctrl.TLBCtrl, 0x58);
+AssertCompileMemberOffset(SVMVMCB, ctrl.IntCtrl, 0x60);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64IntShadow, 0x68);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64ExitCode, 0x70);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64ExitInfo1, 0x78);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64ExitInfo2, 0x80);
+AssertCompileMemberOffset(SVMVMCB, ctrl.ExitIntInfo, 0x88);
+AssertCompileMemberOffset(SVMVMCB, ctrl.NestedPaging, 0x90);
+AssertCompileMemberOffset(SVMVMCB, ctrl.AvicBar, 0x98);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u8Reserved2, 0xA0);
+AssertCompileMemberOffset(SVMVMCB, ctrl.EventInject, 0xA8);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64NestedPagingCR3, 0xB0);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64LBRVirt, 0xB8);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64VmcbCleanBits, 0xC0);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u64NextRIP, 0xC8);
+AssertCompileMemberOffset(SVMVMCB, ctrl.cbInstrFetched, 0xD0);
+AssertCompileMemberOffset(SVMVMCB, ctrl.abInstr, 0xD1);
+AssertCompileMemberOffset(SVMVMCB, ctrl.AvicBackingPagePtr, 0xE0);
+AssertCompileMemberOffset(SVMVMCB, ctrl.u8Reserved3, 0xE8);
+AssertCompileMemberOffset(SVMVMCB, ctrl.AvicLogicalTablePtr, 0xF0);
+AssertCompileMemberOffset(SVMVMCB, ctrl.AvicPhysicalTablePtr, 0xF8);
+AssertCompileMemberOffset(SVMVMCB, u8Reserved3, 0x100);
+AssertCompileMemberOffset(SVMVMCB, guest, 0x400);
+AssertCompileMemberOffset(SVMVMCB, guest.ES, 0x400);
+AssertCompileMemberOffset(SVMVMCB, guest.CS, 0x410);
+AssertCompileMemberOffset(SVMVMCB, guest.SS, 0x420);
+AssertCompileMemberOffset(SVMVMCB, guest.DS, 0x430);
+AssertCompileMemberOffset(SVMVMCB, guest.FS, 0x440);
+AssertCompileMemberOffset(SVMVMCB, guest.GS, 0x450);
+AssertCompileMemberOffset(SVMVMCB, guest.GDTR, 0x460);
+AssertCompileMemberOffset(SVMVMCB, guest.LDTR, 0x470);
+AssertCompileMemberOffset(SVMVMCB, guest.IDTR, 0x480);
+AssertCompileMemberOffset(SVMVMCB, guest.TR, 0x490);
+AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved4, 0x4A0);
+AssertCompileMemberOffset(SVMVMCB, guest.u8CPL, 0x4CB);
+AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved5, 0x4CC);
+AssertCompileMemberOffset(SVMVMCB, guest.u64EFER, 0x4D0);
+AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved6, 0x4D8);
+AssertCompileMemberOffset(SVMVMCB, guest.u64CR4, 0x548);
+AssertCompileMemberOffset(SVMVMCB, guest.u64CR3, 0x550);
+AssertCompileMemberOffset(SVMVMCB, guest.u64CR0, 0x558);
+AssertCompileMemberOffset(SVMVMCB, guest.u64DR7, 0x560);
+AssertCompileMemberOffset(SVMVMCB, guest.u64DR6, 0x568);
+AssertCompileMemberOffset(SVMVMCB, guest.u64RFlags, 0x570);
+AssertCompileMemberOffset(SVMVMCB, guest.u64RIP, 0x578);
+AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved7, 0x580);
+AssertCompileMemberOffset(SVMVMCB, guest.u64RSP, 0x5D8);
+AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved8, 0x5E0);
+AssertCompileMemberOffset(SVMVMCB, guest.u64RAX, 0x5F8);
+AssertCompileMemberOffset(SVMVMCB, guest.u64STAR, 0x600);
+AssertCompileMemberOffset(SVMVMCB, guest.u64LSTAR, 0x608);
+AssertCompileMemberOffset(SVMVMCB, guest.u64CSTAR, 0x610);
+AssertCompileMemberOffset(SVMVMCB, guest.u64SFMASK, 0x618);
+AssertCompileMemberOffset(SVMVMCB, guest.u64KernelGSBase, 0x620);
+AssertCompileMemberOffset(SVMVMCB, guest.u64SysEnterCS, 0x628);
+AssertCompileMemberOffset(SVMVMCB, guest.u64SysEnterESP, 0x630);
+AssertCompileMemberOffset(SVMVMCB, guest.u64SysEnterEIP, 0x638);
+AssertCompileMemberOffset(SVMVMCB, guest.u64CR2, 0x640);
+AssertCompileMemberOffset(SVMVMCB, guest.u8Reserved9, 0x648);
+AssertCompileMemberOffset(SVMVMCB, guest.u64GPAT, 0x668);
+AssertCompileMemberOffset(SVMVMCB, guest.u64DBGCTL, 0x670);
+AssertCompileMemberOffset(SVMVMCB, guest.u64BR_FROM, 0x678);
+AssertCompileMemberOffset(SVMVMCB, guest.u64BR_TO, 0x680);
+AssertCompileMemberOffset(SVMVMCB, guest.u64LASTEXCPFROM, 0x688);
+AssertCompileMemberOffset(SVMVMCB, guest.u64LASTEXCPTO, 0x690);
+AssertCompileMemberOffset(SVMVMCB, u8Reserved10, 0x698);
 AssertCompileSize(SVMVMCB, 0x1000);
 
 #ifdef IN_RING0
diff --git a/include/VBox/vmm/hm_vmx.h b/include/VBox/vmm/hm_vmx.h
index d195541..b583a5e 100644
--- a/include/VBox/vmm/hm_vmx.h
+++ b/include/VBox/vmm/hm_vmx.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -94,9 +94,10 @@
 #define HMVMXCPU_GST_VALUE(pVCpu)                     (ASMAtomicUoReadU32(&(pVCpu)->hm.s.vmx.fUpdatedGuestState))
 
 /** @name Host-state restoration flags.
+ * @note If you change these values don't forget to update the assembly
+ *       defines as well!
  * @{
  */
-/* If you change these values don't forget to update the assembly defines as well! */
 #define VMX_RESTORE_HOST_SEL_DS               RT_BIT(0)
 #define VMX_RESTORE_HOST_SEL_ES               RT_BIT(1)
 #define VMX_RESTORE_HOST_SEL_FS               RT_BIT(2)
@@ -134,6 +135,16 @@ AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr.uAddr, 16);
 AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr.uAddr, 32);
 AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase,    40);
 AssertCompileSize(VMXRESTOREHOST, 56);
+AssertCompileSizeAlignment(VMXRESTOREHOST, 8);
+
+/** @name Host-state MSR lazy-restoration flags.
+ * @{
+ */
+/** The host MSRs have been saved. */
+#define VMX_LAZY_MSRS_SAVED_HOST              RT_BIT(0)
+/** The guest MSRs are loaded and in effect. */
+#define VMX_LAZY_MSRS_LOADED_GUEST            RT_BIT(1)
+/** @} */
 
 /** @name VMX HM-error codes for VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO.
  *  UFC = Unsupported Feature Combination.
@@ -157,6 +168,10 @@ AssertCompileSize(VMXRESTOREHOST, 56);
 #define VMX_UFC_INSUFFICIENT_GUEST_MSR_STORAGE                  6
 /** Invalid VMCS size. */
 #define VMX_UFC_INVALID_VMCS_SIZE                               7
+/** Unsupported secondary processor-based VM-execution controls combo. */
+#define VMX_UFC_CTRL_PROC_EXEC2                                 8
+/** Invalid unrestricted-guest execution controls combo. */
+#define VMX_UFC_INVALID_UX_COMBO                                9
 /** @} */
 
 /** @name VMX HM-error codes for VERR_VMX_INVALID_GUEST_STATE.
@@ -194,9 +209,9 @@ AssertCompileSize(VMXRESTOREHOST, 56);
 #define VMX_IGS_EFER_MSR_RESERVED                               13
 /** VMCS' EFER MSR.LMA does not match the IA32e mode guest control. */
 #define VMX_IGS_EFER_LMA_GUEST_MODE_MISMATCH                    14
-/** VMCS' EFER MSR.LMA does not match CR0.PG of the guest when not using
- *  unrestricted guest. */
-#define VMX_IGS_EFER_LMA_PG_MISMATCH                            15
+/** VMCS' EFER MSR.LMA does not match EFER.LME of the guest when using paging
+ *  without unrestricted guest. */
+#define VMX_IGS_EFER_LMA_LME_MISMATCH                            15
 /** CS.Attr.P bit invalid. */
 #define VMX_IGS_CS_ATTR_P_INVALID                               16
 /** CS.Attr reserved bits not set to 0.  */
@@ -420,24 +435,24 @@ AssertCompileSize(VMXRESTOREHOST, 56);
 /** @name VMX VMCS-Read cache indices.
  * @{
  */
-# define VMX_VMCS_GUEST_ES_BASE_CACHE_IDX                       0
-# define VMX_VMCS_GUEST_CS_BASE_CACHE_IDX                       1
-# define VMX_VMCS_GUEST_SS_BASE_CACHE_IDX                       2
-# define VMX_VMCS_GUEST_DS_BASE_CACHE_IDX                       3
-# define VMX_VMCS_GUEST_FS_BASE_CACHE_IDX                       4
-# define VMX_VMCS_GUEST_GS_BASE_CACHE_IDX                       5
-# define VMX_VMCS_GUEST_LDTR_BASE_CACHE_IDX                     6
-# define VMX_VMCS_GUEST_TR_BASE_CACHE_IDX                       7
-# define VMX_VMCS_GUEST_GDTR_BASE_CACHE_IDX                     8
-# define VMX_VMCS_GUEST_IDTR_BASE_CACHE_IDX                     9
-# define VMX_VMCS_GUEST_RSP_CACHE_IDX                           10
-# define VMX_VMCS_GUEST_RIP_CACHE_IDX                           11
-# define VMX_VMCS_GUEST_SYSENTER_ESP_CACHE_IDX                  12
-# define VMX_VMCS_GUEST_SYSENTER_EIP_CACHE_IDX                  13
-# define VMX_VMCS_RO_EXIT_QUALIFICATION_CACHE_IDX               14
-# define VMX_VMCS_MAX_CACHE_IDX                                 (VMX_VMCS_RO_EXIT_QUALIFICATION_CACHE_IDX + 1)
-# define VMX_VMCS_GUEST_CR3_CACHE_IDX                           15
-# define VMX_VMCS_MAX_NESTED_PAGING_CACHE_IDX                   (VMX_VMCS_GUEST_CR3_CACHE_IDX + 1)
+#define VMX_VMCS_GUEST_ES_BASE_CACHE_IDX                        0
+#define VMX_VMCS_GUEST_CS_BASE_CACHE_IDX                        1
+#define VMX_VMCS_GUEST_SS_BASE_CACHE_IDX                        2
+#define VMX_VMCS_GUEST_DS_BASE_CACHE_IDX                        3
+#define VMX_VMCS_GUEST_FS_BASE_CACHE_IDX                        4
+#define VMX_VMCS_GUEST_GS_BASE_CACHE_IDX                        5
+#define VMX_VMCS_GUEST_LDTR_BASE_CACHE_IDX                      6
+#define VMX_VMCS_GUEST_TR_BASE_CACHE_IDX                        7
+#define VMX_VMCS_GUEST_GDTR_BASE_CACHE_IDX                      8
+#define VMX_VMCS_GUEST_IDTR_BASE_CACHE_IDX                      9
+#define VMX_VMCS_GUEST_RSP_CACHE_IDX                            10
+#define VMX_VMCS_GUEST_RIP_CACHE_IDX                            11
+#define VMX_VMCS_GUEST_SYSENTER_ESP_CACHE_IDX                   12
+#define VMX_VMCS_GUEST_SYSENTER_EIP_CACHE_IDX                   13
+#define VMX_VMCS_RO_EXIT_QUALIFICATION_CACHE_IDX                14
+#define VMX_VMCS_MAX_CACHE_IDX                                  (VMX_VMCS_RO_EXIT_QUALIFICATION_CACHE_IDX + 1)
+#define VMX_VMCS_GUEST_CR3_CACHE_IDX                            15
+#define VMX_VMCS_MAX_NESTED_PAGING_CACHE_IDX                    (VMX_VMCS_GUEST_CR3_CACHE_IDX + 1)
 /** @} */
 
 /** @name VMX EPT paging structures
@@ -454,7 +469,6 @@ AssertCompileSize(VMXRESTOREHOST, 56);
  * @todo uint64_t isn't safe for bitfields (gcc pedantic warnings, and IIRC,
  *       this did cause trouble with one compiler/version).
  */
-#pragma pack(1)
 typedef struct EPTPML4EBITS
 {
     /** Present bit. */
@@ -472,7 +486,6 @@ typedef struct EPTPML4EBITS
     /** Availabe for software. */
     uint64_t    u12Available    : 12;
 } EPTPML4EBITS;
-#pragma pack()
 AssertCompileSize(EPTPML4EBITS, 8);
 
 /** Bits 12-51 - - EPT - Physical Page number of the next level. */
@@ -485,7 +498,6 @@ AssertCompileSize(EPTPML4EBITS, 8);
 /**
  * EPT PML4E.
  */
-#pragma pack(1)
 typedef union EPTPML4E
 {
     /** Normal view. */
@@ -497,22 +509,20 @@ typedef union EPTPML4E
     /** 32 bit unsigned integer view. */
     uint32_t        au32[2];
 } EPTPML4E;
-#pragma pack()
+AssertCompileSize(EPTPML4E, 8);
 /** Pointer to a PML4 table entry. */
 typedef EPTPML4E *PEPTPML4E;
 /** Pointer to a const PML4 table entry. */
 typedef const EPTPML4E *PCEPTPML4E;
-AssertCompileSize(EPTPML4E, 8);
 
 /**
  * EPT PML4 Table.
  */
-#pragma pack(1)
 typedef struct EPTPML4
 {
     EPTPML4E    a[EPT_PG_ENTRIES];
 } EPTPML4;
-#pragma pack()
+AssertCompileSize(EPTPML4, 0x1000);
 /** Pointer to an EPT PML4 Table. */
 typedef EPTPML4 *PEPTPML4;
 /** Pointer to a const EPT PML4 Table. */
@@ -521,7 +531,6 @@ typedef const EPTPML4 *PCEPTPML4;
 /**
  * EPT Page Directory Pointer Entry. Bit view.
  */
-#pragma pack(1)
 typedef struct EPTPDPTEBITS
 {
     /** Present bit. */
@@ -539,7 +548,6 @@ typedef struct EPTPDPTEBITS
     /** Availabe for software. */
     uint64_t    u12Available    : 12;
 } EPTPDPTEBITS;
-#pragma pack()
 AssertCompileSize(EPTPDPTEBITS, 8);
 
 /** Bits 12-51 - - EPT - Physical Page number of the next level. */
@@ -552,7 +560,6 @@ AssertCompileSize(EPTPDPTEBITS, 8);
 /**
  * EPT Page Directory Pointer.
  */
-#pragma pack(1)
 typedef union EPTPDPTE
 {
     /** Normal view. */
@@ -564,22 +571,20 @@ typedef union EPTPDPTE
     /** 32 bit unsigned integer view. */
     uint32_t        au32[2];
 } EPTPDPTE;
-#pragma pack()
+AssertCompileSize(EPTPDPTE, 8);
 /** Pointer to an EPT Page Directory Pointer Entry. */
 typedef EPTPDPTE *PEPTPDPTE;
 /** Pointer to a const EPT Page Directory Pointer Entry. */
 typedef const EPTPDPTE *PCEPTPDPTE;
-AssertCompileSize(EPTPDPTE, 8);
 
 /**
  * EPT Page Directory Pointer Table.
  */
-#pragma pack(1)
 typedef struct EPTPDPT
 {
     EPTPDPTE    a[EPT_PG_ENTRIES];
 } EPTPDPT;
-#pragma pack()
+AssertCompileSize(EPTPDPT, 0x1000);
 /** Pointer to an EPT Page Directory Pointer Table. */
 typedef EPTPDPT *PEPTPDPT;
 /** Pointer to a const EPT Page Directory Pointer Table. */
@@ -589,7 +594,6 @@ typedef const EPTPDPT *PCEPTPDPT;
 /**
  * EPT Page Directory Table Entry. Bit view.
  */
-#pragma pack(1)
 typedef struct EPTPDEBITS
 {
     /** Present bit. */
@@ -609,7 +613,6 @@ typedef struct EPTPDEBITS
     /** Availabe for software. */
     uint64_t    u12Available    : 12;
 } EPTPDEBITS;
-#pragma pack()
 AssertCompileSize(EPTPDEBITS, 8);
 
 /** Bits 12-51 - - EPT - Physical Page number of the next level. */
@@ -622,7 +625,6 @@ AssertCompileSize(EPTPDEBITS, 8);
 /**
  * EPT 2MB Page Directory Table Entry. Bit view.
  */
-#pragma pack(1)
 typedef struct EPTPDE2MBITS
 {
     /** Present bit. */
@@ -646,7 +648,6 @@ typedef struct EPTPDE2MBITS
     /** Availabe for software. */
     uint64_t    u12Available    : 12;
 } EPTPDE2MBITS;
-#pragma pack()
 AssertCompileSize(EPTPDE2MBITS, 8);
 
 /** Bits 21-51 - - EPT - Physical Page number of the next level. */
@@ -655,7 +656,6 @@ AssertCompileSize(EPTPDE2MBITS, 8);
 /**
  * EPT Page Directory Table Entry.
  */
-#pragma pack(1)
 typedef union EPTPDE
 {
     /** Normal view. */
@@ -669,22 +669,20 @@ typedef union EPTPDE
     /** 32 bit unsigned integer view. */
     uint32_t        au32[2];
 } EPTPDE;
-#pragma pack()
+AssertCompileSize(EPTPDE, 8);
 /** Pointer to an EPT Page Directory Table Entry. */
 typedef EPTPDE *PEPTPDE;
 /** Pointer to a const EPT Page Directory Table Entry. */
 typedef const EPTPDE *PCEPTPDE;
-AssertCompileSize(EPTPDE, 8);
 
 /**
  * EPT Page Directory Table.
  */
-#pragma pack(1)
 typedef struct EPTPD
 {
     EPTPDE      a[EPT_PG_ENTRIES];
 } EPTPD;
-#pragma pack()
+AssertCompileSize(EPTPD, 0x1000);
 /** Pointer to an EPT Page Directory Table. */
 typedef EPTPD *PEPTPD;
 /** Pointer to a const EPT Page Directory Table. */
@@ -694,7 +692,6 @@ typedef const EPTPD *PCEPTPD;
 /**
  * EPT Page Table Entry. Bit view.
  */
-#pragma pack(1)
 typedef struct EPTPTEBITS
 {
     /** 0 - Present bit.
@@ -720,7 +717,6 @@ typedef struct EPTPTEBITS
     /** 63:52 - Available for software. */
     uint64_t    u12Available    : 12;
 } EPTPTEBITS;
-#pragma pack()
 AssertCompileSize(EPTPTEBITS, 8);
 
 /** Bits 12-51 - - EPT - Physical Page number of the next level. */
@@ -733,7 +729,6 @@ AssertCompileSize(EPTPTEBITS, 8);
 /**
  * EPT Page Table Entry.
  */
-#pragma pack(1)
 typedef union EPTPTE
 {
     /** Normal view. */
@@ -745,87 +740,84 @@ typedef union EPTPTE
     /** 32 bit unsigned integer view. */
     uint32_t        au32[2];
 } EPTPTE;
-#pragma pack()
+AssertCompileSize(EPTPTE, 8);
 /** Pointer to an EPT Page Directory Table Entry. */
 typedef EPTPTE *PEPTPTE;
 /** Pointer to a const EPT Page Directory Table Entry. */
 typedef const EPTPTE *PCEPTPTE;
-AssertCompileSize(EPTPTE, 8);
 
 /**
  * EPT Page Table.
  */
-#pragma pack(1)
 typedef struct EPTPT
 {
     EPTPTE      a[EPT_PG_ENTRIES];
 } EPTPT;
-#pragma pack()
+AssertCompileSize(EPTPT, 0x1000);
 /** Pointer to an extended page table. */
 typedef EPTPT *PEPTPT;
 /** Pointer to a const extended table. */
 typedef const EPTPT *PCEPTPT;
 
-/**
- * VPID flush types.
+/** @} */
+
+/** VMX VPID flush types.
+ * Warning!! Valid enum members are in accordance to the VT-x spec.
  */
 typedef enum
 {
     /** Invalidate a specific page. */
-    VMX_FLUSH_VPID_INDIV_ADDR                    = 0,
+    VMXFLUSHVPID_INDIV_ADDR                    = 0,
     /** Invalidate one context (specific VPID). */
-    VMX_FLUSH_VPID_SINGLE_CONTEXT                = 1,
+    VMXFLUSHVPID_SINGLE_CONTEXT                = 1,
     /** Invalidate all contexts (all VPIDs). */
-    VMX_FLUSH_VPID_ALL_CONTEXTS                  = 2,
+    VMXFLUSHVPID_ALL_CONTEXTS                  = 2,
     /** Invalidate a single VPID context retaining global mappings. */
-    VMX_FLUSH_VPID_SINGLE_CONTEXT_RETAIN_GLOBALS = 3,
+    VMXFLUSHVPID_SINGLE_CONTEXT_RETAIN_GLOBALS = 3,
     /** Unsupported by VirtualBox. */
-    VMX_FLUSH_VPID_NOT_SUPPORTED                 = 0xbad,
+    VMXFLUSHVPID_NOT_SUPPORTED                 = 0xbad0,
     /** Unsupported by CPU. */
-    VMX_FLUSH_VPID_NONE                          = 0xb00,
-    /** 32bit hackishness. */
-    VMX_FLUSH_VPID_32BIT_HACK                    = 0x7fffffff
-} VMX_FLUSH_VPID;
+    VMXFLUSHVPID_NONE                          = 0xbad1
+} VMXFLUSHVPID;
+AssertCompileSize(VMXFLUSHVPID, 4);
 
-/**
- * EPT flush types.
+/** VMX EPT flush types.
+ * @note Warning!! Valid enums values below are in accordance to the VT-x spec.
  */
 typedef enum
 {
     /** Invalidate one context (specific EPT). */
-    VMX_FLUSH_EPT_SINGLE_CONTEXT                = 1,
+    VMXFLUSHEPT_SINGLE_CONTEXT                 = 1,
     /* Invalidate all contexts (all EPTs) */
-    VMX_FLUSH_EPT_ALL_CONTEXTS                  = 2,
+    VMXFLUSHEPT_ALL_CONTEXTS                   = 2,
     /** Unsupported by VirtualBox.   */
-    VMX_FLUSH_EPT_NOT_SUPPORTED                 = 0xbad,
+    VMXFLUSHEPT_NOT_SUPPORTED                  = 0xbad0,
     /** Unsupported by CPU. */
-    VMX_FLUSH_EPT_NONE                          = 0xb00,
-    /** 32bit hackishness. */
-    VMX_FLUSH_EPT_32BIT_HACK                    = 0x7fffffff
-} VMX_FLUSH_EPT;
-/** @} */
+    VMXFLUSHEPT_NONE                           = 0xbad1
+} VMXFLUSHEPT;
+AssertCompileSize(VMXFLUSHEPT, 4);
 
-/** @name MSR autoload/store elements
- * @{
+/** VMX MSR autoload/store element.
+ * In accordance to VT-x spec.
  */
-#pragma pack(1)
 typedef struct
 {
+    /** The MSR Id. */
     uint32_t    u32Msr;
+    /** Reserved (MBZ). */
     uint32_t    u32Reserved;
+    /** The MSR value. */
     uint64_t    u64Value;
 } VMXAUTOMSR;
-#pragma pack()
+AssertCompileSize(VMXAUTOMSR, 16);
 /** Pointer to an MSR load/store element. */
 typedef VMXAUTOMSR *PVMXAUTOMSR;
 /** Pointer to a const MSR load/store element. */
 typedef const VMXAUTOMSR *PCVMXAUTOMSR;
-/** @} */
 
-/** @name VMX-capability qword
- * @{
+/**
+ * VMX-capability qword
  */
-#pragma pack(1)
 typedef union
 {
     struct
@@ -837,22 +829,21 @@ typedef union
         uint32_t        allowed1;
     } n;
     uint64_t            u;
-} VMX_CAPABILITY;
-#pragma pack()
-/** @} */
+} VMXCAPABILITY;
+AssertCompileSize(VMXCAPABILITY, 8);
 
-/** @name VMX MSRs.
- *  @{
+/**
+ * VMX MSRs.
  */
 typedef struct VMXMSRS
 {
     uint64_t                u64FeatureCtrl;
     uint64_t                u64BasicInfo;
-    VMX_CAPABILITY          VmxPinCtls;
-    VMX_CAPABILITY          VmxProcCtls;
-    VMX_CAPABILITY          VmxProcCtls2;
-    VMX_CAPABILITY          VmxExit;
-    VMX_CAPABILITY          VmxEntry;
+    VMXCAPABILITY           VmxPinCtls;
+    VMXCAPABILITY           VmxProcCtls;
+    VMXCAPABILITY           VmxProcCtls2;
+    VMXCAPABILITY           VmxExit;
+    VMXCAPABILITY           VmxEntry;
     uint64_t                u64Misc;
     uint64_t                u64Cr0Fixed0;
     uint64_t                u64Cr0Fixed1;
@@ -862,17 +853,17 @@ typedef struct VMXMSRS
     uint64_t                u64Vmfunc;
     uint64_t                u64EptVpidCaps;
 } VMXMSRS;
+AssertCompileSizeAlignment(VMXMSRS, 8);
 /** Pointer to a VMXMSRS struct. */
 typedef VMXMSRS *PVMXMSRS;
-/** @} */
 
 /** @name VMX EFLAGS reserved bits.
  * @{
  */
 /** And-mask for setting reserved bits to zero */
-#define VMX_EFLAGS_RESERVED_0                                   (~0xffc08028)
+#define VMX_EFLAGS_RESERVED_0                                   (X86_EFL_1 | X86_EFL_LIVE_MASK)
 /** Or-mask for setting reserved bits to 1 */
-#define VMX_EFLAGS_RESERVED_1                                   0x00000002
+#define VMX_EFLAGS_RESERVED_1                                   X86_EFL_1
 /** @} */
 
 /** @name VMX Basic Exit Reasons.
@@ -902,7 +893,7 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_EXIT_TASK_SWITCH                                    9
 /** 10 Guest software attempted to execute CPUID. */
 #define VMX_EXIT_CPUID                                          10
-/** 10 Guest software attempted to execute GETSEC. */
+/** 11 Guest software attempted to execute GETSEC. */
 #define VMX_EXIT_GETSEC                                         11
 /** 12 Guest software attempted to execute HLT. */
 #define VMX_EXIT_HLT                                            12
@@ -952,7 +943,7 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_EXIT_ERR_MSR_LOAD                                   34
 /** 36 Guest software executed MWAIT. */
 #define VMX_EXIT_MWAIT                                          36
-/** 37 VM exit due to monitor trap flag. */
+/** 37 VM-exit due to monitor trap flag. */
 #define VMX_EXIT_MTF                                            37
 /** 39 Guest software attempted to execute MONITOR. */
 #define VMX_EXIT_MONITOR                                        39
@@ -990,8 +981,21 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_EXIT_INVPCID                                        58
 /** 59 VMFUNC. Guest software attempted to execute VMFUNC. */
 #define VMX_EXIT_VMFUNC                                         59
+/** 60 ??? */
+#define VMX_EXIT_RESERVED_60                                    60
+/** 61 - RDSEED - Guest software attempted to executed RDSEED and exiting was
+ * enabled. */
+#define VMX_EXIT_RDSEED                                         61
+/** 62 ??? */
+#define VMX_EXIT_RESERVED_62                                    62
+/** 63 - XSAVES - Guest software attempted to executed XSAVES and exiting was
+ * enabled (XSAVES/XRSTORS was enabled too, of course). */
+#define VMX_EXIT_XSAVES                                         63
+/** 63 - XRSTORS - Guest software attempted to executed XRSTORS and exiting
+ * was enabled (XSAVES/XRSTORS was enabled too, of course). */
+#define VMX_EXIT_XRSTORS                                        64
 /** The maximum exit value (inclusive). */
-#define VMX_EXIT_MAX                                            (VMX_EXIT_VMFUNC)
+#define VMX_EXIT_MAX                                            (VMX_EXIT_XRSTORS)
 /** @} */
 
 
@@ -1027,11 +1031,11 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_ERROR_VMWRITE_READONLY_COMPONENT                    13
 /** VMXON executed in VMX root operation. */
 #define VMX_ERROR_VMXON_IN_VMX_ROOT_OP                          15
-/** VM entry with invalid executive-VMCS pointer. */
+/** VM-entry with invalid executive-VMCS pointer. */
 #define VMX_ERROR_VMENTRY_INVALID_VMCS_EXEC_PTR                 16
-/** VM entry with non-launched executive VMCS. */
+/** VM-entry with non-launched executive VMCS. */
 #define VMX_ERROR_VMENTRY_NON_LAUNCHED_EXEC_VMCS                17
-/** VM entry with executive-VMCS pointer not VMXON pointer. */
+/** VM-entry with executive-VMCS pointer not VMXON pointer. */
 #define VMX_ERROR_VMENTRY_EXEC_VMCS_PTR                         18
 /** VMCALL with non-clear VMCS. */
 #define VMX_ERROR_VMCALL_NON_CLEAR_VMCS                         19
@@ -1043,13 +1047,12 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_ERROR_VMXOFF_DUAL_MONITOR                           23
 /** VMCALL with invalid SMM-monitor features. */
 #define VMX_ERROR_VMCALL_INVALID_SMM_MONITOR                    24
-/** VM entry with invalid VM-execution control fields in executive VMCS. */
+/** VM-entry with invalid VM-execution control fields in executive VMCS. */
 #define VMX_ERROR_VMENTRY_INVALID_VM_EXEC_CTRL                  25
-/** VM entry with events blocked by MOV SS. */
+/** VM-entry with events blocked by MOV SS. */
 #define VMX_ERROR_VMENTRY_MOV_SS                                26
 /** Invalid operand to INVEPT/INVVPID. */
 #define VMX_ERROR_INVEPTVPID_INVALID_OPERAND                    28
-
 /** @} */
 
 
@@ -1134,7 +1137,6 @@ typedef VMXMSRS *PVMXMSRS;
 #define MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_SINGLE_CONTEXT                 RT_BIT_64(41)
 #define MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_ALL_CONTEXTS                   RT_BIT_64(42)
 #define MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_SINGLE_CONTEXT_RETAIN_GLOBALS  RT_BIT_64(43)
-
 /** @} */
 
 /** @name Extended Page Table Pointer (EPTP)
@@ -1293,9 +1295,9 @@ typedef VMXMSRS *PVMXMSRS;
 /** @name VMX_VMCS_CTRL_PIN_EXEC
  * @{
  */
-/** External interrupts cause VM exits if set; otherwise dispatched through the guest's IDT. */
+/** External interrupts cause VM-exits if set; otherwise dispatched through the guest's IDT. */
 #define VMX_VMCS_CTRL_PIN_EXEC_EXT_INT_EXIT                     RT_BIT(0)
-/** Non-maskable interrupts cause VM exits if set; otherwise dispatched through the guest's IDT. */
+/** Non-maskable interrupts cause VM-exits if set; otherwise dispatched through the guest's IDT. */
 #define VMX_VMCS_CTRL_PIN_EXEC_NMI_EXIT                         RT_BIT(3)
 /** Virtual NMIs. */
 #define VMX_VMCS_CTRL_PIN_EXEC_VIRTUAL_NMI                      RT_BIT(5)
@@ -1307,35 +1309,35 @@ typedef VMXMSRS *PVMXMSRS;
 /** @name VMX_VMCS_CTRL_PROC_EXEC
  * @{
  */
-/** VM Exit as soon as RFLAGS.IF=1 and no blocking is active. */
+/** VM-exit as soon as RFLAGS.IF=1 and no blocking is active. */
 #define VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT                 RT_BIT(2)
 /** Use timestamp counter offset. */
 #define VMX_VMCS_CTRL_PROC_EXEC_USE_TSC_OFFSETTING              RT_BIT(3)
-/** VM Exit when executing the HLT instruction. */
+/** VM-exit when executing the HLT instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC_HLT_EXIT                        RT_BIT(7)
-/** VM Exit when executing the INVLPG instruction. */
+/** VM-exit when executing the INVLPG instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC_INVLPG_EXIT                     RT_BIT(9)
-/** VM Exit when executing the MWAIT instruction. */
+/** VM-exit when executing the MWAIT instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC_MWAIT_EXIT                      RT_BIT(10)
-/** VM Exit when executing the RDPMC instruction. */
+/** VM-exit when executing the RDPMC instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC_RDPMC_EXIT                      RT_BIT(11)
-/** VM Exit when executing the RDTSC/RDTSCP instruction. */
+/** VM-exit when executing the RDTSC/RDTSCP instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT                      RT_BIT(12)
-/** VM Exit when executing the MOV to CR3 instruction. (forced to 1 on the 'first' VT-x capable CPUs; this actually includes the newest Nehalem CPUs) */
+/** VM-exit when executing the MOV to CR3 instruction. (forced to 1 on the 'first' VT-x capable CPUs; this actually includes the newest Nehalem CPUs) */
 #define VMX_VMCS_CTRL_PROC_EXEC_CR3_LOAD_EXIT                   RT_BIT(15)
-/** VM Exit when executing the MOV from CR3 instruction. (forced to 1 on the 'first' VT-x capable CPUs; this actually includes the newest Nehalem CPUs) */
+/** VM-exit when executing the MOV from CR3 instruction. (forced to 1 on the 'first' VT-x capable CPUs; this actually includes the newest Nehalem CPUs) */
 #define VMX_VMCS_CTRL_PROC_EXEC_CR3_STORE_EXIT                  RT_BIT(16)
-/** VM Exit on CR8 loads. */
+/** VM-exit on CR8 loads. */
 #define VMX_VMCS_CTRL_PROC_EXEC_CR8_LOAD_EXIT                   RT_BIT(19)
-/** VM Exit on CR8 stores. */
+/** VM-exit on CR8 stores. */
 #define VMX_VMCS_CTRL_PROC_EXEC_CR8_STORE_EXIT                  RT_BIT(20)
 /** Use TPR shadow. */
 #define VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW                  RT_BIT(21)
-/** VM Exit when virtual nmi blocking is disabled. */
+/** VM-exit when virtual NMI blocking is disabled. */
 #define VMX_VMCS_CTRL_PROC_EXEC_NMI_WINDOW_EXIT                 RT_BIT(22)
-/** VM Exit when executing a MOV DRx instruction. */
+/** VM-exit when executing a MOV DRx instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC_MOV_DR_EXIT                     RT_BIT(23)
-/** VM Exit when executing IO instructions. */
+/** VM-exit when executing IO instructions. */
 #define VMX_VMCS_CTRL_PROC_EXEC_UNCOND_IO_EXIT                  RT_BIT(24)
 /** Use IO bitmaps. */
 #define VMX_VMCS_CTRL_PROC_EXEC_USE_IO_BITMAPS                  RT_BIT(25)
@@ -1343,9 +1345,9 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_VMCS_CTRL_PROC_EXEC_MONITOR_TRAP_FLAG               RT_BIT(27)
 /** Use MSR bitmaps. */
 #define VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS                 RT_BIT(28)
-/** VM Exit when executing the MONITOR instruction. */
+/** VM-exit when executing the MONITOR instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC_MONITOR_EXIT                    RT_BIT(29)
-/** VM Exit when executing the PAUSE instruction. */
+/** VM-exit when executing the PAUSE instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC_PAUSE_EXIT                      RT_BIT(30)
 /** Determines whether the secondary processor based VM-execution controls are used. */
 #define VMX_VMCS_CTRL_PROC_EXEC_USE_SECONDARY_EXEC_CTRL         RT_BIT(31)
@@ -1366,18 +1368,27 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_VMCS_CTRL_PROC_EXEC2_VIRT_X2APIC                    RT_BIT(4)
 /** VPID supported/enabled. */
 #define VMX_VMCS_CTRL_PROC_EXEC2_VPID                           RT_BIT(5)
-/** VM Exit when executing the WBINVD instruction. */
+/** VM-exit when executing the WBINVD instruction. */
 #define VMX_VMCS_CTRL_PROC_EXEC2_WBINVD_EXIT                    RT_BIT(6)
 /** Unrestricted guest execution. */
 #define VMX_VMCS_CTRL_PROC_EXEC2_UNRESTRICTED_GUEST             RT_BIT(7)
 /** A specified nr of pause loops cause a VM-exit. */
 #define VMX_VMCS_CTRL_PROC_EXEC2_PAUSE_LOOP_EXIT                RT_BIT(10)
-/** VM Exit when executing RDRAND instructions. */
+/** VM-exit when executing RDRAND instructions. */
 #define VMX_VMCS_CTRL_PROC_EXEC2_RDRAND_EXIT                    RT_BIT(11)
 /** Enables INVPCID instructions. */
 #define VMX_VMCS_CTRL_PROC_EXEC2_INVPCID                        RT_BIT(12)
 /** Enables VMFUNC instructions. */
 #define VMX_VMCS_CTRL_PROC_EXEC2_VMFUNC                         RT_BIT(13)
+/** Enables VMCS shadowing. */
+#define VMX_VMCS_CTRL_PROC_EXEC2_VMCS_SHADOWING                 RT_BIT_64(14)
+/** VM-exit when executing RDSEED. */
+#define VMX_VMCS_CTRL_PROC_EXEC2_RDSEED_EXIT                    RT_BIT_64(16)
+/** Controls whether EPT-violations may cause \#VE instead of exits. */
+#define VMX_VMCS_CTRL_PROC_EXEC2_EPT_VE                         RT_BIT_64(18)
+/** Enables XSAVES/SRSTORS. */
+#define VMX_VMCS_CTRL_PROC_EXEC2_XSAVES                         RT_BIT_64(20)
+
 /** @} */
 
 
@@ -1392,11 +1403,11 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_VMCS_CTRL_ENTRY_ENTRY_SMM                           RT_BIT(10)
 /** Disable dual treatment of SMI and SMM; must be zero for VM-entry outside of SMM. */
 #define VMX_VMCS_CTRL_ENTRY_DEACTIVATE_DUALMON                  RT_BIT(11)
-/** Whether the guest IA32_PERF_GLOBAL_CTRL MSR is loaded on VM entry. */
+/** Whether the guest IA32_PERF_GLOBAL_CTRL MSR is loaded on VM-entry. */
 #define VMX_VMCS_CTRL_ENTRY_LOAD_GUEST_PERF_MSR                 RT_BIT(13)
-/** Whether the guest IA32_PAT MSR is loaded on VM entry. */
+/** Whether the guest IA32_PAT MSR is loaded on VM-entry. */
 #define VMX_VMCS_CTRL_ENTRY_LOAD_GUEST_PAT_MSR                  RT_BIT(14)
-/** Whether the guest IA32_EFER MSR is loaded on VM entry. */
+/** Whether the guest IA32_EFER MSR is loaded on VM-entry. */
 #define VMX_VMCS_CTRL_ENTRY_LOAD_GUEST_EFER_MSR                 RT_BIT(15)
 /** @} */
 
@@ -1408,19 +1419,19 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_VMCS_CTRL_EXIT_SAVE_DEBUG                           RT_BIT(2)
 /** Return to long mode after a VM-exit. */
 #define VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE                 RT_BIT(9)
-/** Whether the IA32_PERF_GLOBAL_CTRL MSR is loaded on VM exit. */
+/** Whether the IA32_PERF_GLOBAL_CTRL MSR is loaded on VM-exit. */
 #define VMX_VMCS_CTRL_EXIT_LOAD_PERF_MSR                        RT_BIT(12)
 /** Acknowledge external interrupts with the irq controller if one caused a VM-exit. */
 #define VMX_VMCS_CTRL_EXIT_ACK_EXT_INT                          RT_BIT(15)
-/** Whether the guest IA32_PAT MSR is saved on VM exit. */
+/** Whether the guest IA32_PAT MSR is saved on VM-exit. */
 #define VMX_VMCS_CTRL_EXIT_SAVE_GUEST_PAT_MSR                   RT_BIT(18)
-/** Whether the host IA32_PAT MSR is loaded on VM exit. */
+/** Whether the host IA32_PAT MSR is loaded on VM-exit. */
 #define VMX_VMCS_CTRL_EXIT_LOAD_HOST_PAT_MSR                    RT_BIT(19)
-/** Whether the guest IA32_EFER MSR is saved on VM exit. */
+/** Whether the guest IA32_EFER MSR is saved on VM-exit. */
 #define VMX_VMCS_CTRL_EXIT_SAVE_GUEST_EFER_MSR                  RT_BIT(20)
-/** Whether the host IA32_EFER MSR is loaded on VM exit. */
+/** Whether the host IA32_EFER MSR is loaded on VM-exit. */
 #define VMX_VMCS_CTRL_EXIT_LOAD_HOST_EFER_MSR                   RT_BIT(21)
-/** Whether the value of the VMX preemption timer is saved on every VM exit. */
+/** Whether the value of the VMX preemption timer is saved on every VM-exit. */
 #define VMX_VMCS_CTRL_EXIT_SAVE_VMX_PREEMPT_TIMER               RT_BIT(22)
 /** @} */
 
@@ -1429,113 +1440,113 @@ typedef VMXMSRS *PVMXMSRS;
  * @{
  */
 /** EPTP-switching function changes the value of the EPTP to one chosen from the EPTP list. */
-#define VMX_VMCS_CTRL_VMFUNC_EPTP_SWITCHING            RT_BIT_64(0)
+#define VMX_VMCS_CTRL_VMFUNC_EPTP_SWITCHING                     RT_BIT_64(0)
 /** @} */
 
 
-/**  @name VMCS field encoding - 32 Bits read-only fields
+/** @name VMCS field encoding - 32 Bits read-only fields
  * @{
  */
-#define VMX_VMCS32_RO_VM_INSTR_ERROR                              0x4400
-#define VMX_VMCS32_RO_EXIT_REASON                                 0x4402
-#define VMX_VMCS32_RO_EXIT_INTERRUPTION_INFO                      0x4404
-#define VMX_VMCS32_RO_EXIT_INTERRUPTION_ERROR_CODE                0x4406
-#define VMX_VMCS32_RO_IDT_INFO                                    0x4408
-#define VMX_VMCS32_RO_IDT_ERROR_CODE                              0x440A
-#define VMX_VMCS32_RO_EXIT_INSTR_LENGTH                           0x440C
-#define VMX_VMCS32_RO_EXIT_INSTR_INFO                             0x440E
+#define VMX_VMCS32_RO_VM_INSTR_ERROR                            0x4400
+#define VMX_VMCS32_RO_EXIT_REASON                               0x4402
+#define VMX_VMCS32_RO_EXIT_INTERRUPTION_INFO                    0x4404
+#define VMX_VMCS32_RO_EXIT_INTERRUPTION_ERROR_CODE              0x4406
+#define VMX_VMCS32_RO_IDT_INFO                                  0x4408
+#define VMX_VMCS32_RO_IDT_ERROR_CODE                            0x440A
+#define VMX_VMCS32_RO_EXIT_INSTR_LENGTH                         0x440C
+#define VMX_VMCS32_RO_EXIT_INSTR_INFO                           0x440E
 /** @} */
 
 /** @name VMX_VMCS32_RO_EXIT_REASON
  * @{
  */
-#define VMX_EXIT_REASON_BASIC(a)                                  ((a) & 0xffff)
+#define VMX_EXIT_REASON_BASIC(a)                                ((a) & 0xffff)
 /** @} */
 
 /** @name VMX_VMCS32_CTRL_ENTRY_INTERRUPTION_INFO
  * @{
  */
-#define VMX_ENTRY_INTERRUPTION_INFO_IS_VALID(a)                   RT_BOOL((a) & RT_BIT(31))
-#define VMX_ENTRY_INTERRUPTION_INFO_TYPE_SHIFT                    8
-#define VMX_ENTRY_INTERRUPTION_INFO_TYPE(a)                       ((a >> VMX_ENTRY_INTERRUPTION_INFO_TYPE_SHIFT) & 7)
+#define VMX_ENTRY_INTERRUPTION_INFO_IS_VALID(a)                 RT_BOOL((a) & RT_BIT(31))
+#define VMX_ENTRY_INTERRUPTION_INFO_TYPE_SHIFT                  8
+#define VMX_ENTRY_INTERRUPTION_INFO_TYPE(a)                     ((a >> VMX_ENTRY_INTERRUPTION_INFO_TYPE_SHIFT) & 7)
 /** @} */
 
 
 /** @name VMX_VMCS32_RO_EXIT_INTERRUPTION_INFO
  * @{
  */
-#define VMX_EXIT_INTERRUPTION_INFO_VECTOR(a)                      ((a) & 0xff)
-#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT                     8
-#define VMX_EXIT_INTERRUPTION_INFO_TYPE(a)                        (((a) >> VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT) & 7)
-#define VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID               RT_BIT(11)
-#define VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_IS_VALID(a)         RT_BOOL((a) & VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID)
-#define VMX_EXIT_INTERRUPTION_INFO_NMI_UNBLOCK(a)                 ((a) & RT_BIT(12))
-#define VMX_EXIT_INTERRUPTION_INFO_VALID                          RT_BIT(31)
-#define VMX_EXIT_INTERRUPTION_INFO_IS_VALID(a)                    RT_BOOL((a) & RT_BIT(31))
+#define VMX_EXIT_INTERRUPTION_INFO_VECTOR(a)                    ((a) & 0xff)
+#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT                   8
+#define VMX_EXIT_INTERRUPTION_INFO_TYPE(a)                      (((a) >> VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT) & 7)
+#define VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID             RT_BIT(11)
+#define VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_IS_VALID(a)       RT_BOOL((a) & VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID)
+#define VMX_EXIT_INTERRUPTION_INFO_NMI_UNBLOCK_IRET(a)          ((a) & RT_BIT(12))
+#define VMX_EXIT_INTERRUPTION_INFO_VALID                        RT_BIT(31)
+#define VMX_EXIT_INTERRUPTION_INFO_IS_VALID(a)                  RT_BOOL((a) & RT_BIT(31))
 /** Construct an irq event injection value from the exit interruption info value (same except that bit 12 is reserved). */
-#define VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(a)        ((a) & ~RT_BIT(12))
+#define VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(a)      ((a) & ~RT_BIT(12))
 /** @} */
 
 /** @name VMX_VMCS_RO_EXIT_INTERRUPTION_INFO_TYPE
  * @{
  */
-#define VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT                   0
-#define VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI                       2
-#define VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT                   3
-#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT                    4
-#define VMX_EXIT_INTERRUPTION_INFO_TYPE_PRIV_SW_XCPT              5
-#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_XCPT                   6
+#define VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT                 0
+#define VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI                     2
+#define VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT                 3
+#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT                  4
+#define VMX_EXIT_INTERRUPTION_INFO_TYPE_PRIV_SW_XCPT            5
+#define VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_XCPT                 6
 /** @} */
 
 /** @name VMX_VMCS32_RO_IDT_VECTORING_INFO
  * @{
  */
-#define VMX_IDT_VECTORING_INFO_VECTOR(a)                          ((a) & 0xff)
-#define VMX_IDT_VECTORING_INFO_TYPE_SHIFT                         8
-#define VMX_IDT_VECTORING_INFO_TYPE(a)                            (((a) >> VMX_IDT_VECTORING_INFO_TYPE_SHIFT) & 7)
-#define VMX_IDT_VECTORING_INFO_ERROR_CODE_VALID                   RT_BIT(11)
-#define VMX_IDT_VECTORING_INFO_ERROR_CODE_IS_VALID(a)             RT_BOOL((a) & VMX_IDT_VECTORING_INFO_ERROR_CODE_VALID)
-#define VMX_IDT_VECTORING_INFO_VALID(a)                           ((a) & RT_BIT(31))
-#define VMX_ENTRY_INT_INFO_FROM_EXIT_IDT_INFO(a)                  ((a) & ~RT_BIT(12))
+#define VMX_IDT_VECTORING_INFO_VECTOR(a)                        ((a) & 0xff)
+#define VMX_IDT_VECTORING_INFO_TYPE_SHIFT                       8
+#define VMX_IDT_VECTORING_INFO_TYPE(a)                          (((a) >> VMX_IDT_VECTORING_INFO_TYPE_SHIFT) & 7)
+#define VMX_IDT_VECTORING_INFO_ERROR_CODE_VALID                 RT_BIT(11)
+#define VMX_IDT_VECTORING_INFO_ERROR_CODE_IS_VALID(a)           RT_BOOL((a) & VMX_IDT_VECTORING_INFO_ERROR_CODE_VALID)
+#define VMX_IDT_VECTORING_INFO_VALID(a)                         ((a) & RT_BIT(31))
+#define VMX_ENTRY_INT_INFO_FROM_EXIT_IDT_INFO(a)                ((a) & ~RT_BIT(12))
 /** @} */
 
 /** @name VMX_VMCS_RO_IDT_VECTORING_INFO_TYPE
  * @{
  */
-#define VMX_IDT_VECTORING_INFO_TYPE_EXT_INT                       0
-#define VMX_IDT_VECTORING_INFO_TYPE_NMI                           2
-#define VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT                       3
-#define VMX_IDT_VECTORING_INFO_TYPE_SW_INT                        4
-#define VMX_IDT_VECTORING_INFO_TYPE_PRIV_SW_XCPT                  5
-#define VMX_IDT_VECTORING_INFO_TYPE_SW_XCPT                       6
+#define VMX_IDT_VECTORING_INFO_TYPE_EXT_INT                     0
+#define VMX_IDT_VECTORING_INFO_TYPE_NMI                         2
+#define VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT                     3
+#define VMX_IDT_VECTORING_INFO_TYPE_SW_INT                      4
+#define VMX_IDT_VECTORING_INFO_TYPE_PRIV_SW_XCPT                5
+#define VMX_IDT_VECTORING_INFO_TYPE_SW_XCPT                     6
 /** @} */
 
 
-/**  @name VMCS field encoding - 32 Bits guest state fields
+/** @name VMCS field encoding - 32 Bits guest state fields
  * @{
  */
-#define VMX_VMCS32_GUEST_ES_LIMIT                                 0x4800
-#define VMX_VMCS32_GUEST_CS_LIMIT                                 0x4802
-#define VMX_VMCS32_GUEST_SS_LIMIT                                 0x4804
-#define VMX_VMCS32_GUEST_DS_LIMIT                                 0x4806
-#define VMX_VMCS32_GUEST_FS_LIMIT                                 0x4808
-#define VMX_VMCS32_GUEST_GS_LIMIT                                 0x480A
-#define VMX_VMCS32_GUEST_LDTR_LIMIT                               0x480C
-#define VMX_VMCS32_GUEST_TR_LIMIT                                 0x480E
-#define VMX_VMCS32_GUEST_GDTR_LIMIT                               0x4810
-#define VMX_VMCS32_GUEST_IDTR_LIMIT                               0x4812
-#define VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS                         0x4814
-#define VMX_VMCS32_GUEST_CS_ACCESS_RIGHTS                         0x4816
-#define VMX_VMCS32_GUEST_SS_ACCESS_RIGHTS                         0x4818
-#define VMX_VMCS32_GUEST_DS_ACCESS_RIGHTS                         0x481A
-#define VMX_VMCS32_GUEST_FS_ACCESS_RIGHTS                         0x481C
-#define VMX_VMCS32_GUEST_GS_ACCESS_RIGHTS                         0x481E
-#define VMX_VMCS32_GUEST_LDTR_ACCESS_RIGHTS                       0x4820
-#define VMX_VMCS32_GUEST_TR_ACCESS_RIGHTS                         0x4822
-#define VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE                   0x4824
-#define VMX_VMCS32_GUEST_ACTIVITY_STATE                           0x4826
-#define VMX_VMCS32_GUEST_SYSENTER_CS                              0x482A  /**< MSR IA32_SYSENTER_CS */
-#define VMX_VMCS32_GUEST_PREEMPT_TIMER_VALUE                      0x482E
+#define VMX_VMCS32_GUEST_ES_LIMIT                               0x4800
+#define VMX_VMCS32_GUEST_CS_LIMIT                               0x4802
+#define VMX_VMCS32_GUEST_SS_LIMIT                               0x4804
+#define VMX_VMCS32_GUEST_DS_LIMIT                               0x4806
+#define VMX_VMCS32_GUEST_FS_LIMIT                               0x4808
+#define VMX_VMCS32_GUEST_GS_LIMIT                               0x480A
+#define VMX_VMCS32_GUEST_LDTR_LIMIT                             0x480C
+#define VMX_VMCS32_GUEST_TR_LIMIT                               0x480E
+#define VMX_VMCS32_GUEST_GDTR_LIMIT                             0x4810
+#define VMX_VMCS32_GUEST_IDTR_LIMIT                             0x4812
+#define VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS                       0x4814
+#define VMX_VMCS32_GUEST_CS_ACCESS_RIGHTS                       0x4816
+#define VMX_VMCS32_GUEST_SS_ACCESS_RIGHTS                       0x4818
+#define VMX_VMCS32_GUEST_DS_ACCESS_RIGHTS                       0x481A
+#define VMX_VMCS32_GUEST_FS_ACCESS_RIGHTS                       0x481C
+#define VMX_VMCS32_GUEST_GS_ACCESS_RIGHTS                       0x481E
+#define VMX_VMCS32_GUEST_LDTR_ACCESS_RIGHTS                     0x4820
+#define VMX_VMCS32_GUEST_TR_ACCESS_RIGHTS                       0x4822
+#define VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE                 0x4824
+#define VMX_VMCS32_GUEST_ACTIVITY_STATE                         0x4826
+#define VMX_VMCS32_GUEST_SYSENTER_CS                            0x482A  /**< MSR IA32_SYSENTER_CS */
+#define VMX_VMCS32_GUEST_PREEMPT_TIMER_VALUE                    0x482E
 /** @} */
 
 
@@ -1543,13 +1554,13 @@ typedef VMXMSRS *PVMXMSRS;
  * @{
  */
 /** The logical processor is active. */
-#define VMX_VMCS_GUEST_ACTIVITY_ACTIVE                           0x0
+#define VMX_VMCS_GUEST_ACTIVITY_ACTIVE                          0x0
 /** The logical processor is inactive, because executed a HLT instruction. */
-#define VMX_VMCS_GUEST_ACTIVITY_HLT                              0x1
+#define VMX_VMCS_GUEST_ACTIVITY_HLT                             0x1
 /** The logical processor is inactive, because of a triple fault or other serious error. */
-#define VMX_VMCS_GUEST_ACTIVITY_SHUTDOWN                         0x2
+#define VMX_VMCS_GUEST_ACTIVITY_SHUTDOWN                        0x2
 /** The logical processor is inactive, because it's waiting for a startup-IPI */
-#define VMX_VMCS_GUEST_ACTIVITY_SIPI_WAIT                        0x3
+#define VMX_VMCS_GUEST_ACTIVITY_SIPI_WAIT                       0x3
 /** @} */
 
 
@@ -1637,7 +1648,7 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_EXIT_QUALIFICATION_CRX_RES2(a)                      (((a) >> 12) & 0xF)
 /** 16-31: LMSW source data (else 0). */
 #define VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(a)                 (((a) >> 16) & 0xFFFF)
-/** Rest: reserved. */
+/* Rest: reserved. */
 /** @} */
 
 /** @name VMX_EXIT_QUALIFICATION_CRX_ACCESS
@@ -1726,7 +1737,7 @@ typedef VMXMSRS *PVMXMSRS;
 /** @name VMX_EXIT_APIC_ACCESS
  * @{
  */
-/** 0-11:   If the APIC-access VM exit is due to a linear access, the offset of access within the APIC page. */
+/** 0-11:   If the APIC-access VM-exit is due to a linear access, the offset of access within the APIC page. */
 #define VMX_EXIT_QUALIFICATION_APIC_ACCESS_OFFSET(a)            ((a) & 0xfff)
 /** 12-15:  Access type. */
 #define VMX_EXIT_QUALIFICATION_APIC_ACCESS_TYPE(a)              (((a) & 0xf000) >> 12)
@@ -1751,7 +1762,6 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_APIC_ACCESS_TYPE_PHYSICAL_INSTR                     15
 /** @} */
 
-/** @} */
 
 /** @name VMCS field encoding - Natural width guest state fields
  * @{
@@ -1780,6 +1790,7 @@ typedef VMXMSRS *PVMXMSRS;
 
 
 /** @name VMX_VMCS_GUEST_DEBUG_EXCEPTIONS
+ * Bits 4-11, 13 and 15-63 are reserved.
  * @{
  */
 /** Hardware breakpoint 0 was met. */
@@ -1794,8 +1805,6 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_BREAKPOINT_ENABLED      RT_BIT(12)
 /** A debug exception would have been triggered by single-step execution mode. */
 #define VMX_VMCS_GUEST_DEBUG_EXCEPTIONS_BS                      RT_BIT(14)
-/** Bits 4-11, 13 and 15-63 are reserved. */
-
 /** @} */
 
 /** @name VMCS field encoding - Natural width host state fields
@@ -1815,11 +1824,8 @@ typedef VMXMSRS *PVMXMSRS;
 #define VMX_VMCS_HOST_RIP                                       0x6C16
 /** @} */
 
-/** @} */
-
 
 /** @defgroup grp_vmx_asm   vmx assembly helpers
- * @ingroup grp_vmx
  * @{
  */
 
@@ -1859,10 +1865,10 @@ DECLINLINE(int) VMXEnable(RTHCPHYS pVMXOn)
        ".byte    0xF3, 0x0F, 0xC7, 0x34, 0x24  # VMXON [esp]    \n\t"
        "ja       2f                                             \n\t"
        "je       1f                                             \n\t"
-       "movl     $"RT_XSTR(VERR_VMX_INVALID_VMXON_PTR)", %0     \n\t"
+       "movl     $" RT_XSTR(VERR_VMX_INVALID_VMXON_PTR)", %0    \n\t"
        "jmp      2f                                             \n\t"
        "1:                                                      \n\t"
-       "movl     $"RT_XSTR(VERR_VMX_VMXON_FAILED)", %0          \n\t"
+       "movl     $" RT_XSTR(VERR_VMX_VMXON_FAILED)", %0         \n\t"
        "2:                                                      \n\t"
        "add      $8, %%esp                                      \n\t"
        :"=rm"(rc)
@@ -1952,7 +1958,7 @@ DECLINLINE(int) VMXClearVmcs(RTHCPHYS pVMCS)
        "push    %2                                              \n\t"
        ".byte   0x66, 0x0F, 0xC7, 0x34, 0x24  # VMCLEAR [esp]   \n\t"
        "jnc     1f                                              \n\t"
-       "movl    $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0       \n\t"
+       "movl    $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0      \n\t"
        "1:                                                      \n\t"
        "add     $8, %%esp                                       \n\t"
        :"=rm"(rc)
@@ -2009,7 +2015,7 @@ DECLINLINE(int) VMXActivateVmcs(RTHCPHYS pVMCS)
        "push    %2                                              \n\t"
        ".byte   0x0F, 0xC7, 0x34, 0x24  # VMPTRLD [esp]         \n\t"
        "jnc     1f                                              \n\t"
-       "movl    $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0       \n\t"
+       "movl    $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0      \n\t"
        "1:                                                      \n\t"
        "add     $8, %%esp                                       \n\t"
        :"=rm"(rc)
@@ -2079,10 +2085,10 @@ DECLINLINE(int) VMXWriteVmcs32(uint32_t idxField, uint32_t u32Val)
        ".byte  0x0F, 0x79, 0xC2        # VMWRITE eax, edx       \n\t"
        "ja     2f                                               \n\t"
        "je     1f                                               \n\t"
-       "movl   $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0        \n\t"
+       "movl   $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0       \n\t"
        "jmp    2f                                               \n\t"
        "1:                                                      \n\t"
-       "movl   $"RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0      \n\t"
+       "movl   $" RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0     \n\t"
        "2:                                                      \n\t"
        :"=rm"(rc)
        :"0"(VINF_SUCCESS),
@@ -2155,18 +2161,18 @@ VMMR0DECL(int) VMXWriteVmcs64Ex(PVMCPU pVCpu, uint32_t idxField, uint64_t u64Val
 
 #ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
 # define VMXWriteVmcsHstN(idxField, uVal)       HMVMX_IS_64BIT_HOST_MODE() ?                     \
-                                                   VMXWriteVmcs64(idxField, uVal)                 \
+                                                   VMXWriteVmcs64(idxField, uVal)                \
                                                  : VMXWriteVmcs32(idxField, uVal)
 # define VMXWriteVmcsGstN(idxField, u64Val)     (pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests) ? \
-                                                   VMXWriteVmcs64(idxField, u64Val)               \
+                                                   VMXWriteVmcs64(idxField, u64Val)              \
                                                  : VMXWriteVmcs32(idxField, u64Val)
 #elif ARCH_BITS == 32
 # define VMXWriteVmcsHstN                       VMXWriteVmcs32
 # define VMXWriteVmcsGstN(idxField, u64Val)     VMXWriteVmcs64Ex(pVCpu, idxField, u64Val)
-# else  /* ARCH_BITS == 64 */
+#else  /* ARCH_BITS == 64 */
 # define VMXWriteVmcsHstN                       VMXWriteVmcs64
 # define VMXWriteVmcsGstN                       VMXWriteVmcs64
-# endif
+#endif
 
 
 /**
@@ -2175,7 +2181,7 @@ VMMR0DECL(int) VMXWriteVmcs64Ex(PVMCPU pVCpu, uint32_t idxField, uint64_t u64Val
  * @param   enmFlush    Type of flush
  * @param   pDescriptor Descriptor
  */
-DECLASM(int) VMXR0InvEPT(VMX_FLUSH_EPT enmFlush, uint64_t *pDescriptor);
+DECLASM(int) VMXR0InvEPT(VMXFLUSHEPT enmFlush, uint64_t *pDescriptor);
 
 /**
  * Invalidate a page using invvpid
@@ -2183,7 +2189,7 @@ DECLASM(int) VMXR0InvEPT(VMX_FLUSH_EPT enmFlush, uint64_t *pDescriptor);
  * @param   enmFlush    Type of flush
  * @param   pDescriptor Descriptor
  */
-DECLASM(int) VMXR0InvVPID(VMX_FLUSH_VPID enmFlush, uint64_t *pDescriptor);
+DECLASM(int) VMXR0InvVPID(VMXFLUSHVPID enmFlush, uint64_t *pDescriptor);
 
 /**
  * Executes VMREAD
@@ -2207,14 +2213,14 @@ DECLINLINE(int) VMXReadVmcs32(uint32_t idxField, uint32_t *pData)
 # if RT_INLINE_ASM_GNU_STYLE
     int rc = VINF_SUCCESS;
     __asm__ __volatile__ (
-       "movl   $"RT_XSTR(VINF_SUCCESS)", %0                      \n\t"
+       "movl   $" RT_XSTR(VINF_SUCCESS)", %0                     \n\t"
        ".byte  0x0F, 0x78, 0xc2        # VMREAD eax, edx         \n\t"
        "ja     2f                                                \n\t"
        "je     1f                                                \n\t"
-       "movl   $"RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0         \n\t"
+       "movl   $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0        \n\t"
        "jmp    2f                                                \n\t"
        "1:                                                       \n\t"
-       "movl   $"RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0       \n\t"
+       "movl   $" RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0      \n\t"
        "2:                                                       \n\t"
        :"=&r"(rc),
         "=d"(*pData)
@@ -2340,5 +2346,7 @@ VMMR0DECL(int) VMXR0InvalidatePhysPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys);
 
 /** @} */
 
+/** @} */
+
 #endif
 
diff --git a/include/VBox/vmm/iem.h b/include/VBox/vmm/iem.h
index 3216866..3a5f249 100644
--- a/include/VBox/vmm/iem.h
+++ b/include/VBox/vmm/iem.h
@@ -50,6 +50,16 @@ typedef enum IEMMODE
 AssertCompileSize(IEMMODE, 4);
 
 
+/** @name IEM status codes.
+ *
+ * Not quite sure how this will play out in the end, just aliasing safe status
+ * codes for now.
+ *
+ * @{ */
+#define VINF_IEM_RAISED_XCPT    VINF_EM_RESCHEDULE
+/** @} */
+
+
 VMMDECL(VBOXSTRICTRC)       IEMExecOne(PVMCPU pVCpu);
 VMMDECL(VBOXSTRICTRC)       IEMExecOneEx(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint32_t *pcbWritten);
 VMMDECL(VBOXSTRICTRC)       IEMExecOneWithPrefetchedByPC(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint64_t OpcodeBytesPC,
@@ -58,7 +68,9 @@ VMMDECL(VBOXSTRICTRC)       IEMExecOneBypassEx(PVMCPU pVCpu, PCPUMCTXCORE pCtxCo
 VMMDECL(VBOXSTRICTRC)       IEMExecOneBypassWithPrefetchedByPC(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, uint64_t OpcodeBytesPC,
                                                                const void *pvOpcodeBytes, size_t cbOpcodeBytes);
 VMMDECL(VBOXSTRICTRC)       IEMExecLots(PVMCPU pVCpu);
-VMM_INT_DECL(VBOXSTRICTRC)  IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType, uint16_t uErrCode, RTGCPTR uCr2);
+VMMDECL(VBOXSTRICTRC)       IEMInjectTrpmEvent(PVMCPU pVCpu);
+VMM_INT_DECL(VBOXSTRICTRC)  IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType, uint16_t uErrCode, RTGCPTR uCr2,
+                                          uint8_t cbInstr);
 
 VMM_INT_DECL(int)           IEMBreakpointSet(PVM pVM, RTGCPTR GCPtrBp);
 VMM_INT_DECL(int)           IEMBreakpointClear(PVM pVM, RTGCPTR GCPtrBp);
@@ -69,6 +81,11 @@ VMM_INT_DECL(VBOXSTRICTRC)  IEMExecStringIoWrite(PVMCPU pVCpu, uint8_t cbValue,
                                                  bool fRepPrefix, uint8_t cbInstr, uint8_t iEffSeg);
 VMM_INT_DECL(VBOXSTRICTRC)  IEMExecStringIoRead(PVMCPU pVCpu, uint8_t cbValue, IEMMODE enmAddrMode,
                                                 bool fRepPrefix, uint8_t cbInstr);
+VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedMovCRxWrite(PVMCPU pVCpu, uint8_t cbInstr, uint8_t iCrReg, uint8_t iGReg);
+VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedMovCRxRead(PVMCPU pVCpu, uint8_t cbInstr, uint8_t iGReg, uint8_t iCrReg);
+VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedClts(PVMCPU pVCpu, uint8_t cbInstr);
+VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedLmsw(PVMCPU pVCpu, uint8_t cbInstr, uint16_t uValue);
+VMM_INT_DECL(VBOXSTRICTRC)  IEMExecDecodedXsetbv(PVMCPU pVCpu, uint8_t cbInstr);
 /** @}  */
 
 #if defined(IEM_VERIFICATION_MODE) && defined(IN_RING3)
@@ -81,8 +98,7 @@ VMM_INT_DECL(void)   IEMNotifyIOPortWriteString(PVM pVM, RTIOPORT Port, RTGCPTR
 #endif
 
 
-/** @defgroup grp_em_r3     The IEM Host Context Ring-3 API.
- * @ingroup grp_em
+/** @defgroup grp_iem_r3     The IEM Host Context Ring-3 API.
  * @{
  */
 VMMR3DECL(int)      IEMR3Init(PVM pVM);
diff --git a/include/VBox/vmm/iom.h b/include/VBox/vmm/iom.h
index a69ac4c..cd27b4a 100644
--- a/include/VBox/vmm/iom.h
+++ b/include/VBox/vmm/iom.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -236,7 +236,7 @@ typedef DECLCALLBACK(int) FNIOMMMIOREAD(PPDMDEVINS pDevIns, void *pvUser, RTGCPH
 typedef FNIOMMMIOREAD *PFNIOMMMIOREAD;
 
 /**
- * Port I/O Handler for write operations.
+ * Memory mapped I/O Handler for write operations.
  *
  * @returns VBox status code.
  *
@@ -252,7 +252,7 @@ typedef DECLCALLBACK(int) FNIOMMMIOWRITE(PPDMDEVINS pDevIns, void *pvUser, RTGCP
 typedef FNIOMMMIOWRITE *PFNIOMMMIOWRITE;
 
 /**
- * Port I/O Handler for memset operations, actually for REP STOS* instructions handling.
+ * Memory mapped I/O Handler for memset operations, actually for REP STOS* instructions handling.
  *
  * @returns VBox status code.
  *
@@ -289,7 +289,6 @@ VMMDECL(bool)           IOMIsLockWriteOwner(PVM pVM);
 
 #ifdef IN_RC
 /** @defgroup grp_iom_rc    The IOM Raw-Mode Context API
- * @ingroup grp_iom
  * @{
  */
 VMMRCDECL(VBOXSTRICTRC) IOMRCIOPortHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
@@ -300,7 +299,6 @@ VMMRCDECL(VBOXSTRICTRC) IOMRCIOPortHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE p
 
 #ifdef IN_RING3
 /** @defgroup grp_iom_r3    The IOM Host Context Ring-3 API
- * @ingroup grp_iom
  * @{
  */
 VMMR3_INT_DECL(int)  IOMR3Init(PVM pVM);
diff --git a/include/VBox/vmm/mm.h b/include/VBox/vmm/mm.h
index bcb55c1..d7117a0 100644
--- a/include/VBox/vmm/mm.h
+++ b/include/VBox/vmm/mm.h
@@ -111,6 +111,7 @@ typedef enum MMTAG
     MM_TAG_PGM,
     MM_TAG_PGM_CHUNK_MAPPING,
     MM_TAG_PGM_HANDLERS,
+    MM_TAG_PGM_HANDLER_TYPES,
     MM_TAG_PGM_MAPPINGS,
     MM_TAG_PGM_PHYS,
     MM_TAG_PGM_POOL,
@@ -141,7 +142,6 @@ typedef enum MMTAG
 
 
 /** @defgroup grp_mm_hyper  Hypervisor Memory Management
- * @ingroup grp_mm
  * @{ */
 
 VMMDECL(RTR3PTR)    MMHyperR0ToR3(PVM pVM, RTR0PTR R0Ptr);
@@ -216,6 +216,8 @@ VMMDECL(void)       MMHyperHeapDump(PVM pVM);
 #endif
 VMMDECL(size_t)     MMHyperHeapGetFreeSize(PVM pVM);
 VMMDECL(size_t)     MMHyperHeapGetSize(PVM pVM);
+VMMDECL(void *)     MMHyperHeapOffsetToPtr(PVM pVM, uint32_t offHeap);
+VMMDECL(uint32_t)   MMHyperHeapPtrToOffset(PVM pVM, void *pv);
 VMMDECL(RTGCPTR)    MMHyperGetArea(PVM pVM, size_t *pcb);
 VMMDECL(bool)       MMHyperIsInsideArea(PVM pVM, RTGCPTR GCPtr);
 
@@ -240,9 +242,8 @@ VMMDECL(int)        MMPagePhys2PageTry(PVM pVM, RTHCPHYS HCPhysPage, void **ppvP
 /** @} */
 
 
-#ifdef IN_RING3
+#if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
 /** @defgroup grp_mm_r3    The MM Host Context Ring-3 API
- * @ingroup grp_mm
  * @{
  */
 
@@ -252,6 +253,7 @@ VMMR3DECL(int)      MMR3InitPaging(PVM pVM);
 VMMR3DECL(int)      MMR3HyperInitFinalize(PVM pVM);
 VMMR3DECL(int)      MMR3Term(PVM pVM);
 VMMR3DECL(void)     MMR3TermUVM(PUVM pUVM);
+VMMR3_INT_DECL(bool) MMR3IsInitialized(PVM pVM);
 VMMR3DECL(int)      MMR3ReserveHandyPages(PVM pVM, uint32_t cHandyPages);
 VMMR3DECL(int)      MMR3IncreaseBaseReservation(PVM pVM, uint64_t cAddBasePages);
 VMMR3DECL(int)      MMR3AdjustFixedReservation(PVM pVM, int32_t cDeltaFixedPages, const char *pszDesc);
@@ -260,10 +262,10 @@ VMMR3DECL(int)      MMR3UpdateShadowReservation(PVM pVM, uint32_t cShadowPages);
 VMMR3DECL(int)      MMR3HCPhys2HCVirt(PVM pVM, RTHCPHYS HCPhys, void **ppv);
 
 /** @defgroup grp_mm_r3_hyper  Hypervisor Memory Manager (HC R3 Portion)
- * @ingroup grp_mm_r3
  * @{ */
 VMMR3DECL(int)      MMR3HyperAllocOnceNoRel(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, void **ppv);
 VMMR3DECL(int)      MMR3HyperAllocOnceNoRelEx(PVM pVM, size_t cb, uint32_t uAlignment, MMTAG enmTag, uint32_t fFlags, void **ppv);
+VMMR3DECL(int)      MMR3HyperRealloc(PVM pVM, void *pv, size_t cb, unsigned uAlignmentNew, MMTAG enmTagNew, size_t cbNew, void **ppv);
 /** @name  MMR3HyperAllocOnceNoRelEx flags
  * @{ */
 /** Must have kernel mapping.
@@ -287,14 +289,12 @@ VMMR3DECL(int)      MMR3HyperReadGCVirt(PVM pVM, void *pvDst, RTGCPTR GCPtr, siz
 
 /** @defgroup grp_mm_phys   Guest Physical Memory Manager
  * @todo retire this group, elimintating or moving MMR3PhysGetRamSize to PGMPhys.
- * @ingroup grp_mm_r3
  * @{ */
 VMMR3DECL(uint64_t) MMR3PhysGetRamSize(PVM pVM);
 /** @} */
 
 
 /** @defgroup grp_mm_page   Physical Page Pool
- * @ingroup grp_mm_r3
  * @{ */
 VMMR3DECL(void *)   MMR3PageAlloc(PVM pVM);
 VMMR3DECL(RTHCPHYS) MMR3PageAllocPhys(PVM pVM);
@@ -308,7 +308,6 @@ VMMR3DECL(RTHCPHYS) MMR3PageDummyHCPhys(PVM pVM);
 
 
 /** @defgroup grp_mm_heap   Heap Manager
- * @ingroup grp_mm_r3
  * @{ */
 VMMR3DECL(void *)   MMR3HeapAlloc(PVM pVM, MMTAG enmTag, size_t cbSize);
 VMMR3DECL(void *)   MMR3HeapAllocU(PUVM pUVM, MMTAG enmTag, size_t cbSize);
@@ -328,8 +327,7 @@ VMMR3DECL(char *)   MMR3HeapAPrintfVU(PUVM pUVM, MMTAG enmTag, const char *pszFo
 VMMR3DECL(void)     MMR3HeapFree(void *pv);
 /** @} */
 
-/** @defgroup grp_mm_heap   User-kernel Heap Manager.
- * @ingroup grp_mm_r3
+/** @defgroup grp_mm_ukheap   User-kernel Heap Manager.
  *
  * The memory is safely accessible from kernel context as well as user land.
  *
@@ -342,13 +340,12 @@ VMMR3DECL(void)     MMR3UkHeapFree(PVM pVM, void *pv, MMTAG enmTag);
 /** @} */
 
 /** @} */
-#endif /* IN_RING3 */
+#endif /* IN_RING3 || DOXYGEN_RUNNING */
 
 
 
-#ifdef IN_RC
-/** @defgroup grp_mm_gc    The MM Guest Context API
- * @ingroup grp_mm
+#if defined(IN_RC) || defined(DOXYGEN_RUNNING)
+/** @defgroup grp_mm_rc    The MM Raw-mode Context API
  * @{
  */
 
@@ -363,7 +360,7 @@ VMMRCDECL(int)      MMGCRamRead(PVM pVM, void *pDst, void *pSrc, size_t cb);
 VMMRCDECL(int)      MMGCRamWrite(PVM pVM, void *pDst, void *pSrc, size_t cb);
 
 /** @} */
-#endif /* IN_RC */
+#endif /* IN_RC || DOXYGEN_RUNNING */
 
 /** @} */
 RT_C_DECLS_END
diff --git a/include/VBox/vmm/patm.h b/include/VBox/vmm/patm.h
index 6f9adca..e2f0e40 100644
--- a/include/VBox/vmm/patm.h
+++ b/include/VBox/vmm/patm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -140,27 +140,27 @@ typedef enum
  */
 #define PATMIsEnabled(a_pVM)    ((a_pVM)->fPATMEnabled)
 
-VMMDECL(bool)           PATMIsPatchGCAddr(PVM pVM, RTRCUINTPTR pAddr);
+VMMDECL(bool)           PATMIsPatchGCAddr(PVM pVM, RTRCUINTPTR uGCAddr);
+VMMDECL(bool)           PATMIsPatchGCAddrExclHelpers(PVM pVM, RTRCUINTPTR uGCAddr);
 VMM_INT_DECL(int)       PATMReadPatchCode(PVM pVM, RTGCPTR GCPtrPatchCode, void *pvDst, size_t cbToRead, size_t *pcbRead);
 
-VMM_INT_DECL(void)      PATMRawEnter(PVM pVM, PCPUMCTXCORE pCtxCore);
-VMM_INT_DECL(void)      PATMRawLeave(PVM pVM, PCPUMCTXCORE pCtxCore, int rawRC);
-VMM_INT_DECL(uint32_t)  PATMRawGetEFlags(PVM pVM, PCCPUMCTXCORE pCtxCore);
-VMM_INT_DECL(void)      PATMRawSetEFlags(PVM pVM, PCPUMCTXCORE pCtxCore, uint32_t efl);
+VMM_INT_DECL(void)      PATMRawEnter(PVM pVM, PCPUMCTX pCtx);
+VMM_INT_DECL(void)      PATMRawLeave(PVM pVM, PCPUMCTX pCtx, int rawRC);
+VMM_INT_DECL(uint32_t)  PATMRawGetEFlags(PVM pVM, PCCPUMCTX pCtx);
+VMM_INT_DECL(void)      PATMRawSetEFlags(PVM pVM, PCPUMCTX pCtx, uint32_t efl);
 VMM_INT_DECL(RCPTRTYPE(PPATMGCSTATE)) PATMGetGCState(PVM pVM);
 VMM_INT_DECL(bool)      PATMShouldUseRawMode(PVM pVM, RTRCPTR pAddrGC);
 VMM_INT_DECL(int)       PATMSetMMIOPatchInfo(PVM pVM, RTGCPHYS GCPhys, RTRCPTR pCachedData);
 
 VMM_INT_DECL(bool)      PATMIsInt3Patch(PVM pVM, RTRCPTR pInstrGC, uint32_t *pOpcode, uint32_t *pSize);
 VMM_INT_DECL(bool)      PATMAreInterruptsEnabled(PVM pVM);
-VMM_INT_DECL(bool)      PATMAreInterruptsEnabledByCtxCore(PVM pVM, PCPUMCTXCORE pCtxCore);
+VMM_INT_DECL(bool)      PATMAreInterruptsEnabledByCtx(PVM pVM, PCPUMCTX pCtx);
 #ifdef PATM_EMULATE_SYSENTER
-VMM_INT_DECL(int)       PATMSysCall(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
+VMM_INT_DECL(int)       PATMSysCall(PVM pVM, PCPUMCTX pCtx, PDISCPUSTATE pCpu);
 #endif
 
 #ifdef IN_RC
-/** @defgroup grp_patm_rc    The Patch Manager RC API
- * @ingroup grp_patm
+/** @defgroup grp_patm_rc    The Patch Manager Raw-mode Context API
  * @{
  */
 
@@ -173,8 +173,7 @@ VMMRC_INT_DECL(int)     PATMRCHandleIllegalInstrTrap(PVM pVM, PCPUMCTXCORE pRegF
 #endif
 
 #ifdef IN_RING3
-/** @defgroup grp_patm_r3    The Patch Manager API
- * @ingroup grp_patm
+/** @defgroup grp_patm_r3    The Patch Manager Host Ring-3 Context API
  * @{
  */
 
@@ -183,15 +182,12 @@ VMMR3DECL(bool)                 PATMR3IsEnabled(PUVM pUVM);
 
 VMMR3_INT_DECL(int)             PATMR3Init(PVM pVM);
 VMMR3_INT_DECL(int)             PATMR3InitFinalize(PVM pVM);
-VMMR3_INT_DECL(void)            PATMR3Relocate(PVM pVM);
+VMMR3_INT_DECL(void)            PATMR3Relocate(PVM pVM, RTRCINTPTR offDelta);
 VMMR3_INT_DECL(int)             PATMR3Term(PVM pVM);
 VMMR3_INT_DECL(int)             PATMR3Reset(PVM pVM);
 
-VMMR3_INT_DECL(void *)          PATMR3QueryPatchMemHC(PVM pVM, uint32_t *pcb);
-VMMR3_INT_DECL(RTRCPTR)         PATMR3QueryPatchMemGC(PVM pVM, uint32_t *pcb);
 VMMR3_INT_DECL(bool)            PATMR3IsInsidePatchJump(PVM pVM, RTRCPTR pAddr, PRTGCPTR32 pPatchAddr);
 VMMR3_INT_DECL(RTRCPTR)         PATMR3QueryPatchGCPtr(PVM pVM, RTRCPTR pAddrGC);
-VMMR3_INT_DECL(bool)            PATMR3IsPatchHCAddr(PVM pVM, void *pAddrHC);
 VMMR3_INT_DECL(void *)          PATMR3GCPtrToHCPtr(PVM pVM, RTRCPTR pAddrGC);
 VMMR3_INT_DECL(PPATMGCSTATE)    PATMR3QueryGCStateHC(PVM pVM);
 VMMR3_INT_DECL(int)             PATMR3HandleTrap(PVM pVM, PCPUMCTX pCtx, RTRCPTR pEip, RTGCPTR *ppNewEip);
diff --git a/include/VBox/vmm/pdmapi.h b/include/VBox/vmm/pdmapi.h
index 321865a..9fce2db 100644
--- a/include/VBox/vmm/pdmapi.h
+++ b/include/VBox/vmm/pdmapi.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -53,12 +53,12 @@ VMMDECL(int)            PDMApicSetTPR(PVMCPU pVCpu, uint8_t u8TPR);
 VMMDECL(int)            PDMApicGetTPR(PVMCPU pVCpu, uint8_t *pu8TPR, bool *pfPending, uint8_t *pu8PendingIrq);
 VMM_INT_DECL(int)       PDMApicWriteMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t u64Value);
 VMM_INT_DECL(int)       PDMApicReadMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_t *pu64Value);
+VMM_INT_DECL(int)       PDMApicGetTimerFreq(PVM pVM, uint64_t *pu64Value);
 VMM_INT_DECL(int)       PDMVmmDevHeapR3ToGCPhys(PVM pVM, RTR3PTR pv, RTGCPHYS *pGCPhys);
 VMM_INT_DECL(bool)      PDMVmmDevHeapIsEnabled(PVM pVM);
 
 
 /** @defgroup grp_pdm_r3    The PDM Host Context Ring-3 API
- * @ingroup grp_pdm
  * @{
  */
 
@@ -163,7 +163,6 @@ VMMR3_INT_DECL(int)     PDMR3TracingQueryConfig(PVM pVM, char *pszConfig, size_t
 
 
 /** @defgroup grp_pdm_rc    The PDM Raw-Mode Context API
- * @ingroup grp_pdm
  * @{
  */
 /** @} */
@@ -171,7 +170,6 @@ VMMR3_INT_DECL(int)     PDMR3TracingQueryConfig(PVM pVM, char *pszConfig, size_t
 
 
 /** @defgroup grp_pdm_r0    The PDM Ring-0 Context API
- * @ingroup grp_pdm
  * @{
  */
 
diff --git a/include/VBox/vmm/pdmaudioifs.h b/include/VBox/vmm/pdmaudioifs.h
new file mode 100644
index 0000000..ed77904
--- /dev/null
+++ b/include/VBox/vmm/pdmaudioifs.h
@@ -0,0 +1,680 @@
+/** @file
+ * PDM - Pluggable Device Manager, audio interfaces.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifndef ___VBox_vmm_pdmaudioifs_h
+#define ___VBox_vmm_pdmaudioifs_h
+
+#include <VBox/types.h>
+#include <iprt/list.h>
+
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
+typedef struct
+{
+    int mute;
+    uint32_t r;
+    uint32_t l;
+} volume_t;
+#endif
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+typedef uint32_t PDMAUDIODRVFLAGS;
+
+/** No flags set. */
+#define PDMAUDIODRVFLAG_NONE        0
+/** Marks a primary audio driver which is critical
+ *  when running the VM. */
+#define PDMAUDIODRVFLAG_PRIMARY     RT_BIT(0)
+
+/**
+ * Audio format in signed or unsigned variants.
+ */
+typedef enum PDMAUDIOFMT
+{
+    AUD_FMT_INVALID,
+    AUD_FMT_U8,
+    AUD_FMT_S8,
+    AUD_FMT_U16,
+    AUD_FMT_S16,
+    AUD_FMT_U32,
+    AUD_FMT_S32,
+    /** Hack to blow the type up to 32-bit. */
+    AUD_FMT_32BIT_HACK = 0x7fffffff
+} PDMAUDIOFMT;
+#endif
+
+/**
+ * Audio configuration of a certain backend.
+ */
+typedef struct PDMAUDIOBACKENDCFG
+{
+    uint32_t    cbStreamOut;
+    uint32_t    cbStreamIn;
+    uint32_t    cMaxHstStrmsOut;
+    uint32_t    cMaxHstStrmsIn;
+} PDMAUDIOBACKENDCFG, *PPDMAUDIOBACKENDCFG;
+
+/**
+ * An audio sample. At the moment stereo (left + right channels) only.
+ * @todo Replace this with a more generic union
+ *       which then also could handle 2.1 or 5.1 sound.
+ */
+typedef struct PDMAUDIOSAMPLE
+{
+    int64_t i64LSample;
+    int64_t i64RSample;
+} PDMAUDIOSAMPLE, *PPDMAUDIOSAMPLE;
+
+typedef enum PDMAUDIOENDIANNESS
+{
+    /** The usual invalid endian. */
+    PDMAUDIOENDIANNESS_INVALID,
+    /** Little endian. */
+    PDMAUDIOENDIANNESS_LITTLE,
+    /** Bit endian. */
+    PDMAUDIOENDIANNESS_BIG,
+    /** Endianness doesn't have a meaning in the context. */
+    PDMAUDIOENDIANNESS_NA,
+    /** The end of the valid endian values (exclusive). */
+    PDMAUDIOENDIANNESS_END,
+    /** Hack to blow the type up to 32-bit. */
+    PDMAUDIOENDIANNESS_32BIT_HACK = 0x7fffffff
+} PDMAUDIOENDIANNESS;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+typedef struct PDMAUDIOSTREAMCFG
+{
+    /** Frequency in Hertz (Hz). */
+    uint32_t uHz;
+    /** Number of channels (2 for stereo). */
+    uint8_t cChannels;
+    /** Audio format. */
+    PDMAUDIOFMT enmFormat;
+    /** @todo Use RT_LE2H_*? */
+    PDMAUDIOENDIANNESS enmEndianness;
+} PDMAUDIOSTREAMCFG, *PPDMAUDIOSTREAMCFG;
+#endif
+
+#if defined(RT_LITTLE_ENDIAN)
+# define PDMAUDIOHOSTENDIANNESS PDMAUDIOENDIANNESS_LITTLE
+#elif defined(RT_BIG_ENDIAN)
+# define PDMAUDIOHOSTENDIANNESS PDMAUDIOENDIANNESS_BIG
+#else
+# error "Port me!"
+#endif
+
+typedef enum PDMAUDIODIR
+{
+    PDMAUDIODIR_UNKNOWN = 0,
+    PDMAUDIODIR_IN      = 1,
+    PDMAUDIODIR_OUT     = 2,
+    PDMAUDIODIR_BOTH    = 3
+} PDMAUDIODIR;
+
+typedef enum PDMAUDIOMIXERCTL
+{
+    PDMAUDIOMIXERCTL_UNKNOWN = 0,
+    PDMAUDIOMIXERCTL_VOLUME,
+    PDMAUDIOMIXERCTL_PCM,
+    PDMAUDIOMIXERCTL_LINE_IN,
+    PDMAUDIOMIXERCTL_MIC_IN,
+    /** Hack to blow the type up to 32-bit. */
+    PDMAUDIOMIXERCTL_32BIT_HACK = 0x7fffffff
+} PDMAUDIOMIXERCTL;
+
+typedef enum PDMAUDIORECSOURCE
+{
+    PDMAUDIORECSOURCE_UNKNOWN = 0,
+    PDMAUDIORECSOURCE_MIC,
+    PDMAUDIORECSOURCE_CD,
+    PDMAUDIORECSOURCE_VIDEO,
+    PDMAUDIORECSOURCE_AUX,
+    PDMAUDIORECSOURCE_LINE_IN,
+    PDMAUDIORECSOURCE_PHONE,
+    /** Hack to blow the type up to 32-bit. */
+    PDMAUDIORECSOURCE_32BIT_HACK = 0x7fffffff
+} PDMAUDIORECSOURCE;
+
+/**
+ * Audio stream commands. Used in the audio connector
+ * as well as in the actual host backends.
+ */
+typedef enum PDMAUDIOSTREAMCMD
+{
+    /** Unknown command, do not use. */
+    PDMAUDIOSTREAMCMD_UNKNOWN = 0,
+    /** Enables the stream. */
+    PDMAUDIOSTREAMCMD_ENABLE,
+    /** Disables the stream. */
+    PDMAUDIOSTREAMCMD_DISABLE,
+    /** Hack to blow the type up to 32-bit. */
+    PDMAUDIOSTREAMCMD_32BIT_HACK = 0x7fffffff
+} PDMAUDIOSTREAMCMD;
+
+/**
+ * Properties of audio streams for host/guest
+ * for in or out directions.
+ */
+typedef struct PDMPCMPROPS
+{
+    /** Sample width. Bits per sample. */
+    uint8_t     cBits;
+    /** Signed or unsigned sample. */
+    bool        fSigned;
+    /** Shift count used for faster calculation of various
+     *  values, such as the alignment, bytes to samples and so on.
+     *  Depends on number of stream channels and the stream format
+     *  being used.
+     *
+     ** @todo Use some RTAsmXXX functions instead?
+     */
+    uint8_t     cShift;
+    /** Number of audio channels. */
+    uint8_t     cChannels;
+    /** Alignment mask. */
+    uint32_t    uAlign;
+    /** Sample frequency in Hertz (Hz). */
+    uint32_t    uHz;
+    /** Bandwidth (bytes/s). */
+    uint32_t    cbPerSec;
+    /** Whether the endianness is swapped or not. */
+    bool        fSwapEndian;
+} PDMPCMPROPS, *PPDMPCMPROPS;
+
+/**
+ * Structure keeping an audio volume level.
+ */
+typedef struct PDMAUDIOVOLUME
+{
+    /** Set to @c true if this stream is muted, @c false if not. */
+    bool                   fMuted;
+    /** Left channel volume. */
+    uint32_t               uLeft;
+    /** Right channel volume. */
+    uint32_t               uRight;
+} PDMAUDIOVOLUME, *PPDMAUDIOVOLUME;
+
+/**
+ * Structure for holding rate processing information
+ * of a source + destination audio stream. This is needed
+ * because both streams can differ regarding their rates
+ * and therefore need to be treated accordingly.
+ */
+typedef struct PDMAUDIOSTRMRATE
+{
+    /** Current (absolute) offset in the output
+     *  (destination) stream. */
+    uint64_t       dstOffset;
+    /** Increment for moving dstOffset for the
+     *  destination stream. This is needed because the
+     *  source <-> destination rate might be different. */
+    uint64_t       dstInc;
+    /** Current (absolute) offset in the input
+     *  stream. */
+    uint32_t       srcOffset;
+    /** Last processed sample of the input stream.
+     *  Needed for interpolation. */
+    PDMAUDIOSAMPLE srcSampleLast;
+} PDMAUDIOSTRMRATE, *PPDMAUDIOSTRMRATE;
+
+/**
+ * Note: All internal handling is done in samples,
+ *       not in bytes!
+ */
+typedef uint32_t PDMAUDIOMIXBUFFMT;
+typedef PDMAUDIOMIXBUFFMT *PPDMAUDIOMIXBUFFMT;
+
+typedef struct PDMAUDIOMIXBUF *PPDMAUDIOMIXBUF;
+typedef struct PDMAUDIOMIXBUF
+{
+    RTLISTNODE             Node;
+    /** Name of the buffer. */
+    char                  *pszName;
+    /** Sample buffer. */
+    PPDMAUDIOSAMPLE        pSamples;
+    /** Size of the sample buffer (in samples). */
+    uint32_t               cSamples;
+    /** The current read/write position (in samples)
+     *  in the samples buffer. */
+    uint32_t               offReadWrite;
+    /**
+     * Total samples already mixed down to the parent buffer (if any). Always starting at
+     * the parent's offReadWrite position.
+     *
+     * Note: Count always is specified in parent samples, as the sample count can differ between parent
+     *       and child.
+     */
+    uint32_t               cMixed;
+    uint32_t               cProcessed;
+    /** Pointer to parent buffer (if any). */
+    PPDMAUDIOMIXBUF        pParent;
+    /** List of children mix buffers to keep in sync with (if being a parent buffer). */
+    RTLISTANCHOR           lstBuffers;
+    /** Intermediate structure for buffer conversion tasks. */
+    PPDMAUDIOSTRMRATE      pRate;
+    /** Current volume used for mixing. */
+    PDMAUDIOVOLUME         Volume;
+    /** This buffer's audio format. */
+    PDMAUDIOMIXBUFFMT      AudioFmt;
+    /**
+     * Ratio of the associated parent stream's frequency by this stream's
+     * frequency (1<<32), represented as a signed 64 bit integer.
+     *
+     * For example, if the parent stream has a frequency of 44 khZ, and this
+     * stream has a frequency of 11 kHz, the ration then would be
+     * (44/11 * (1 << 32)).
+     *
+     * Currently this does not get changed once assigned.
+     */
+    int64_t                iFreqRatio;
+    /* For quickly converting samples <-> bytes and
+     * vice versa. */
+    uint8_t                cShift;
+} PDMAUDIOMIXBUF;
+
+/**
+ * Represents an audio input on the host of a certain
+ * backend (e.g. DirectSound, PulseAudio etc).
+ *
+ * One host audio input is assigned to exactly one parent
+ * guest input stream.
+ */
+struct PDMAUDIOGSTSTRMIN;
+typedef PDMAUDIOGSTSTRMIN *PPDMAUDIOGSTSTRMIN;
+
+typedef struct PDMAUDIOHSTSTRMIN
+{
+    /** List node. */
+    RTLISTNODE             Node;
+    /** PCM properties. */
+    PDMPCMPROPS            Props;
+    /** Whether this input is enabled or not. */
+    bool                   fEnabled;
+    /** This stream's mixing buffer. */
+    PDMAUDIOMIXBUF         MixBuf;
+    /** Pointer to (parent) guest stream. */
+    PPDMAUDIOGSTSTRMIN     pGstStrmIn;
+} PDMAUDIOHSTSTRMIN, *PPDMAUDIOHSTSTRMIN;
+
+/*
+ * Represents an audio output on the host through a certain
+ * backend (e.g. DirectSound, PulseAudio etc).
+ *
+ * One host audio output can have multiple (1:N) guest outputs
+ * assigned.
+ */
+typedef struct PDMAUDIOHSTSTRMOUT
+{
+    /** List node. */
+    RTLISTNODE             Node;
+    /** Stream properites. */
+    PDMPCMPROPS            Props;
+    /** Enabled or disabled flag. */
+    bool                   fEnabled;
+    /** Whether this stream was marked as being disabled
+     *  but there are still associated guest output streams
+     *  which rely on its data. */
+    bool                   fPendingDisable;
+    /** This stream's mixing buffer. */
+    PDMAUDIOMIXBUF         MixBuf;
+    /** Associated guest output streams. */
+    RTLISTANCHOR           lstGstStrmOut;
+} PDMAUDIOHSTSTRMOUT, *PPDMAUDIOHSTSTRMOUT;
+
+/**
+ * Guest audio stream state.
+ */
+typedef struct PDMAUDIOGSTSTRMSTATE
+{
+    /** Guest audio out stream active or not. */
+    bool                   fActive;
+    /** Guest audio output stream has some samples or not. */
+    bool                   fEmpty;
+    /** Name of this stream. */
+    char                  *pszName;
+} PDMAUDIOGSTSTRMSTATE, *PPDMAUDIOGSTSTRMSTATE;
+
+/**
+ * Represents an audio input from the guest (that is, from the
+ * emulated device, e.g. Intel HDA).
+ *
+ * Each guest input can have multiple host input streams.
+ */
+typedef struct PDMAUDIOGSTSTRMIN
+{
+    /** Guest stream properites. */
+    PDMPCMPROPS            Props;
+    /** Current stream state. */
+    PDMAUDIOGSTSTRMSTATE   State;
+    /** This stream's mixing buffer. */
+    PDMAUDIOMIXBUF         MixBuf;
+    /** Pointer to associated host input stream. */
+    PPDMAUDIOHSTSTRMIN     pHstStrmIn;
+} PDMAUDIOGSTSTRMIN, *PPDMAUDIOGSTSTRMIN;
+
+/**
+ * Represents an audio output from the guest (that is, from the
+ * emulated device, e.g. Intel HDA).
+ *
+ * Each guest output is assigned to a single host output.
+ */
+typedef struct PDMAUDIOGSTSTRMOUT
+{
+    /** List node. */
+    RTLISTNODE             Node;
+    /** Guest output stream properites. */
+    PDMPCMPROPS            Props;
+    /** Current stream state. */
+    PDMAUDIOGSTSTRMSTATE   State;
+    /** This stream's mixing buffer. */
+    PDMAUDIOMIXBUF         MixBuf;
+    /** Pointer to the associated host output stream. */
+    PPDMAUDIOHSTSTRMOUT    pHstStrmOut;
+} PDMAUDIOGSTSTRMOUT, *PPDMAUDIOGSTSTRMOUT;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+
+/** Pointer to a audio connector interface. */
+typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
+/**
+ * Audio connector interface (up).
+ */
+typedef struct PDMIAUDIOCONNECTOR
+{
+    DECLR3CALLBACKMEMBER(int, pfnQueryStatus, (PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcbAvailIn, uint32_t *pcbFreeOut, uint32_t *pcSamplesLive));
+
+    /**
+     * Reads PCM audio data from the host (input).
+     *
+     * @returns VBox status code.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmIn      Pointer to guest input stream to write to.
+     * @param   pvBuf           Where to store the read data.
+     * @param   cbSize          Number of bytes to read.
+     * @param   pcbRead         Bytes of audio data read. Optional.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnRead, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn, void *pvBuf, uint32_t cbSize, uint32_t *pcbRead));
+
+    /**
+     * Writes PCM audio data to the host (output).
+     *
+     * @returns VBox status code.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmOut     Pointer to guest output stream to read from.
+     * @param   pvBuf           Audio data to be written.
+     * @param   cbSize          Number of bytes to be written.
+     * @param   pcbWritten      Bytes of audio data written. Optional.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnWrite, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut, const void *pvBuf, uint32_t cbSize, uint32_t *pcbWritten));
+
+    /**
+     * Checks whether the specified guest input stream is in a working state.
+     *
+     * @returns True if a host voice in is available, false if not.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmIn      Pointer to guest input stream to check.
+     */
+    DECLR3CALLBACKMEMBER(bool, pfnIsInputOK, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn));
+
+    /**
+     * Checks whether the specified guest output stream is in a working state.
+     *
+     * @returns True if a host voice out is available, false if not.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmOut     Pointer to guest output stream to check.
+     */
+    DECLR3CALLBACKMEMBER(bool, pfnIsOutputOK, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut));
+
+    /**
+     * Initializes the NULL audio driver as a fallback in case no host backend is available.
+     *
+     * @returns VBox status code.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnInitNull, (PPDMIAUDIOCONNECTOR pInterface));
+
+    /**
+     * Enables a specific guest output stream and starts the audio device.
+     *
+     * @returns VBox status code.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmOut     Pointer to guest output stream.
+     * @param   fEnable         Whether to enable or disable the specified output stream.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnEnableOut, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut, bool fEnable));
+
+    /**
+     * Enables a specific guest input stream and starts the audio device.
+     *
+     * @returns VBox status code.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmIn      Pointer to guest input stream.
+     * @param   fEnable         Whether to enable or disable the specified input stream.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnEnableIn, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn, bool fEnable));
+
+    /**
+     * Closes a specific guest input stream.
+     *
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmIn      Pointer to guest input stream.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnCloseIn, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn));
+
+    /**
+     * Closes a specific guest output stream.
+     *
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmOut     Pointer to guest output stream.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnCloseOut, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut));
+
+    /**
+     * Opens an input audio channel.
+     *
+     * @returns VBox status code.
+     * @param   pInterface           Pointer to the interface structure containing the called function pointer.
+     * @param   pszName              Name of the audio channel.
+     * @param   enmRecSource         Specifies the type of recording source to be opened.
+     * @param   pCfg                 Pointer to PDMAUDIOSTREAMCFG to use.
+     * @param   ppGstStrmIn          Pointer where to return the guest guest input stream on success.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnOpenIn, (PPDMIAUDIOCONNECTOR pInterface, const char *pszName,
+                                          PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg,
+                                          PPDMAUDIOGSTSTRMIN *ppGstStrmIn));
+
+    /**
+     * Opens an output audio channel.
+     *
+     * @returns VBox status code.
+     * @param   pInterface           Pointer to the interface structure containing the called function pointer.
+     * @param   pszName              Name of the audio channel.
+     * @param   pCfg                 Pointer to PDMAUDIOSTREAMCFG to use.
+     * @param   ppGstStrmOut         Pointer where to return the guest guest input stream on success.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnOpenOut, (PPDMIAUDIOCONNECTOR pInterface, const char *pszName,
+                                           PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut));
+
+    DECLR3CALLBACKMEMBER(int, pfnPlayOut, (PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcSamplesPlayed));
+
+    /**
+     * Checks whether a specific guest input stream is active or not.
+     *
+     * @returns Whether the specified stream is active or not.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmIn      Pointer to guest input stream.
+     */
+    DECLR3CALLBACKMEMBER(bool, pfnIsActiveIn, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn));
+
+    /**
+     * Checks whether a specific guest output stream is active or not.
+     *
+     * @returns Whether the specified stream is active or not.
+     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+     * @param   pGstStrmOut     Pointer to guest output stream.
+     */
+    DECLR3CALLBACKMEMBER(bool, pfnIsActiveOut, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut));
+
+} PDMIAUDIOCONNECTOR;
+
+/** PDMIAUDIOCONNECTOR interface ID. */
+#define PDMIAUDIOCONNECTOR_IID                  "a41ca770-ed07-4f57-a0a6-41377d9d484f"
+
+/** Defines all needed interface callbacks for an audio backend. */
+#define PDMAUDIO_IHOSTAUDIO_CALLBACKS(_aDrvName) \
+    pThis->IHostAudio.pfnCaptureIn  = _aDrvName##CaptureIn;  \
+    pThis->IHostAudio.pfnControlIn  = _aDrvName##ControlIn;  \
+    pThis->IHostAudio.pfnControlOut = _aDrvName##ControlOut; \
+    pThis->IHostAudio.pfnFiniIn     = _aDrvName##FiniIn;     \
+    pThis->IHostAudio.pfnFiniOut    = _aDrvName##FiniOut;    \
+    pThis->IHostAudio.pfnGetConf    = _aDrvName##GetConf;    \
+    pThis->IHostAudio.pfnInit       = _aDrvName##Init;       \
+    pThis->IHostAudio.pfnInitIn     = _aDrvName##InitIn;     \
+    pThis->IHostAudio.pfnInitOut    = _aDrvName##InitOut;    \
+    pThis->IHostAudio.pfnIsEnabled  = _aDrvName##IsEnabled;  \
+    pThis->IHostAudio.pfnPlayOut    = _aDrvName##PlayOut;    \
+    pThis->IHostAudio.pfnShutdown   = _aDrvName##Shutdown;
+
+/** Pointer to a host audio interface. */
+typedef struct PDMIHOSTAUDIO *PPDMIHOSTAUDIO;
+/**
+ * PDM host audio interface.
+ */
+typedef struct PDMIHOSTAUDIO
+{
+    /**
+     * Initialize the host-specific audio device.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnInit, (PPDMIHOSTAUDIO pInterface));
+
+    /**
+     * Shuts down the host-specific audio device.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnShutdown, (PPDMIHOSTAUDIO pInterface));
+
+    /**
+     * Initialize the host-specific audio device for input stream.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pHstStrmIn          Pointer to host input stream.
+     * @param   pStreamCfg          Pointer to stream configuration.
+     * @param   enmRecSource        Specifies the type of recording source to be initialized.
+     * @param   pcSamples           Returns how many samples the backend can handle. Optional.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnInitIn, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pStreamCfg, PDMAUDIORECSOURCE enmRecSource, uint32_t *pcSamples));
+
+    /**
+     * Initialize the host-specific output device for output stream.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pHstStrmOut         Pointer to host output stream.
+     * @param   pStreamCfg          Pointer to stream configuration.
+     * @param   pcSamples           Returns how many samples the backend can handle. Optional.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnInitOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pStreamCfg, uint32_t *pcSamples));
+
+    /**
+     * Control the host audio device for an input stream.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pHstStrmOut         Pointer to host output stream.
+     * @param   enmStreamCmd        The stream command to issue.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnControlOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut, PDMAUDIOSTREAMCMD enmStreamCmd));
+
+    /**
+     * Control the host audio device for an output stream.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pHstStrmOut         Pointer to host output stream.
+     * @param   enmStreamCmd        The stream command to issue.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnControlIn, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn, PDMAUDIOSTREAMCMD enmStreamCmd));
+
+    /**
+     * Ends the host audio input streamm.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pHstStrmIn          Pointer to host input stream.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnFiniIn, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn));
+
+    /**
+     * Ends the host output stream.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pHstStrmOut         Pointer to host output stream.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnFiniOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut));
+
+    DECLR3CALLBACKMEMBER(bool, pfnIsEnabled, (PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir));
+
+    /**
+     * Plays a host audio stream.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pHstStrmOut         Pointer to host output stream.
+     * @param   pcSamplesPlayed     Pointer to number of samples captured.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnPlayOut, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut, uint32_t *pcSamplesPlayed));
+
+    /**
+     * Records audio to input stream.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pHstStrmIn          Pointer to host input stream.
+     * @param   pcSamplesCaptured   Pointer to number of samples captured.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnCaptureIn, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn, uint32_t *pcSamplesCaptured));
+
+    /**
+     * Gets the configuration from the host audio (backend) driver.
+     *
+     * @returns VBox status code.
+     * @param   pInterface          Pointer to the interface structure containing the called function pointer.
+     * @param   pBackendCfg         Pointer where to store the backend audio configuration to.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnGetConf, (PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pBackendCfg));
+
+} PDMIHOSTAUDIO;
+#define PDMIHOSTAUDIO_IID                           "39feea4f-c824-4197-bcff-7d4a6ede7420"
+
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+#endif /* ___VBox_vmm_pdmaudioifs_h */
+
diff --git a/include/VBox/vmm/pdmdev.h b/include/VBox/vmm/pdmdev.h
index 7a964b7..58c6571 100644
--- a/include/VBox/vmm/pdmdev.h
+++ b/include/VBox/vmm/pdmdev.h
@@ -1189,6 +1189,14 @@ typedef struct PDMAPICREG
      */
     DECLR3CALLBACKMEMBER(int,  pfnLocalInterruptR3,(PPDMDEVINS pDevIns, uint8_t u8Pin, uint8_t u8Level));
 
+    /**
+     * Get the APIC timer frequency (in Hz).
+     *
+     * @returns The frequency of the APIC timer.
+     * @param   pDevIns         Device instance of the APIC.
+     */
+    DECLR3CALLBACKMEMBER(uint64_t, pfnGetTimerFreqR3, (PPDMDEVINS pDevIns));
+
     /** The name of the RC GetInterrupt entry point. */
     const char         *pszGetInterruptRC;
     /** The name of the RC HasPendingIrq entry point. */
@@ -1209,6 +1217,8 @@ typedef struct PDMAPICREG
     const char         *pszBusDeliverRC;
     /** The name of the RC LocalInterrupt entry point. */
     const char         *pszLocalInterruptRC;
+    /** The name of the RC GetTimerFreq entry point. */
+    const char         *pszGetTimerFreqRC;
 
     /** The name of the R0 GetInterrupt entry point. */
     const char         *pszGetInterruptR0;
@@ -1230,7 +1240,8 @@ typedef struct PDMAPICREG
     const char         *pszBusDeliverR0;
     /** The name of the R0 LocalInterrupt entry point. */
     const char         *pszLocalInterruptR0;
-
+    /** The name of the R0 GetTimerFreq entry point. */
+    const char         *pszGetTimerFreqR0;
 } PDMAPICREG;
 /** Pointer to an APIC registration structure. */
 typedef PDMAPICREG *PPDMAPICREG;
@@ -2414,7 +2425,7 @@ typedef struct PDMDEVHLPR3
      * is configured for the VM, in which case we'll drop the base
      * memory pages. Presently we will make no attempt to preserve
      * anything that happens to be present in the base memory that
-     * is replaced, this is of course incorrectly but it's too much
+     * is replaced, this is of course incorrect but it's too much
      * effort.
      *
      * @returns VBox status code.
@@ -3507,6 +3518,14 @@ typedef struct PDMDEVHLPR3
     DECLR3CALLBACKMEMBER(PVMCPU, pfnGetVMCPU,(PPDMDEVINS pDevIns));
 
     /**
+     * The the VM CPU ID of the current thread (restricted API).
+     *
+     * @returns The VMCPUID of the calling thread, NIL_CPUID if not EMT.
+     * @param   pDevIns             The device instance.
+     */
+    DECLR3CALLBACKMEMBER(VMCPUID, pfnGetCurrentCpuId,(PPDMDEVINS pDevIns));
+
+    /**
      * Registers the VMM device heap
      *
      * @returns VBox status code.
@@ -3645,7 +3664,7 @@ typedef R3PTRTYPE(struct PDMDEVHLPR3 *) PPDMDEVHLPR3;
 typedef R3PTRTYPE(const struct PDMDEVHLPR3 *) PCPDMDEVHLPR3;
 
 /** Current PDMDEVHLPR3 version number. */
-#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE(0xffe7, 12, 1)
+#define PDM_DEVHLPR3_VERSION                    PDM_VERSION_MAKE(0xffe7, 14, 1)
 
 
 /**
@@ -3818,6 +3837,14 @@ typedef struct PDMDEVHLPRC
     DECLRCCALLBACKMEMBER(PVMCPU, pfnGetVMCPU,(PPDMDEVINS pDevIns));
 
     /**
+     * The the VM CPU ID of the current thread (restricted API).
+     *
+     * @returns The VMCPUID of the calling thread, NIL_CPUID if not EMT.
+     * @param   pDevIns             The device instance.
+     */
+    DECLRCCALLBACKMEMBER(VMCPUID, pfnGetCurrentCpuId,(PPDMDEVINS pDevIns));
+
+    /**
      * Get the current virtual clock time in a VM. The clock frequency must be
      * queried separately.
      *
@@ -3862,7 +3889,7 @@ typedef RCPTRTYPE(struct PDMDEVHLPRC *) PPDMDEVHLPRC;
 typedef RCPTRTYPE(const struct PDMDEVHLPRC *) PCPDMDEVHLPRC;
 
 /** Current PDMDEVHLP version number. */
-#define PDM_DEVHLPRC_VERSION                    PDM_VERSION_MAKE(0xffe6, 3, 1)
+#define PDM_DEVHLPRC_VERSION                    PDM_VERSION_MAKE(0xffe6, 4, 1)
 
 
 /**
@@ -4043,6 +4070,14 @@ typedef struct PDMDEVHLPR0
     DECLR0CALLBACKMEMBER(PVMCPU, pfnGetVMCPU,(PPDMDEVINS pDevIns));
 
     /**
+     * The the VM CPU ID of the current thread (restricted API).
+     *
+     * @returns The VMCPUID of the calling thread, NIL_CPUID if not EMT.
+     * @param   pDevIns             The device instance.
+     */
+    DECLR0CALLBACKMEMBER(VMCPUID, pfnGetCurrentCpuId,(PPDMDEVINS pDevIns));
+
+    /**
      * Get the current virtual clock time in a VM. The clock frequency must be
      * queried separately.
      *
@@ -4087,7 +4122,7 @@ typedef R0PTRTYPE(struct PDMDEVHLPR0 *) PPDMDEVHLPR0;
 typedef R0PTRTYPE(const struct PDMDEVHLPR0 *) PCPDMDEVHLPR0;
 
 /** Current PDMDEVHLP version number. */
-#define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 3, 1)
+#define PDM_DEVHLPR0_VERSION                    PDM_VERSION_MAKE(0xffe5, 4, 1)
 
 
 
@@ -5144,6 +5179,14 @@ DECLINLINE(PVMCPU) PDMDevHlpGetVMCPU(PPDMDEVINS pDevIns)
 }
 
 /**
+ * @copydoc PDMDEVHLPR3::pfnGetCurrentCpuId
+ */
+DECLINLINE(VMCPUID) PDMDevHlpGetCurrentCpuId(PPDMDEVINS pDevIns)
+{
+    return pDevIns->CTX_SUFF(pHlp)->pfnGetCurrentCpuId(pDevIns);
+}
+
+/**
  * @copydoc PDMDEVHLPR3::pfnTMTimeVirtGet
  */
 DECLINLINE(uint64_t) PDMDevHlpTMTimeVirtGet(PPDMDEVINS pDevIns)
diff --git a/include/VBox/vmm/pdmdrv.h b/include/VBox/vmm/pdmdrv.h
index 57dbe96..a616312 100644
--- a/include/VBox/vmm/pdmdrv.h
+++ b/include/VBox/vmm/pdmdrv.h
@@ -188,7 +188,7 @@ typedef FNPDMDRVPOWEROFF *PFNPDMDRVPOWEROFF;
 /**
  * Attach command.
  *
- * This is called to let the drive attach to a driver at runtime.  This is not
+ * This is called to let the driver attach to a driver at runtime.  This is not
  * called during VM construction, the driver constructor have to do this by
  * calling PDMDrvHlpAttach.
  *
@@ -507,12 +507,13 @@ typedef struct PDMUSBHUBREG
      * Request the hub to attach of the specified device.
      *
      * @returns VBox status code.
-     * @param   pDrvIns     The hub instance.
-     * @param   pUsbIns     The device to attach.
-     * @param   piPort      Where to store the port number the device was attached to.
+     * @param   pDrvIns            The hub instance.
+     * @param   pUsbIns            The device to attach.
+     * @param   pszCaptureFilename Path to the file for USB traffic capturing, optional.
+     * @param   piPort             Where to store the port number the device was attached to.
      * @thread EMT.
      */
-    DECLR3CALLBACKMEMBER(int, pfnAttachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t *piPort));
+    DECLR3CALLBACKMEMBER(int, pfnAttachDevice,(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, const char *pszCaptureFilename, uint32_t *piPort));
 
     /**
      * Request the hub to detach of the specified device.
@@ -536,7 +537,7 @@ typedef struct PDMUSBHUBREG
 typedef const PDMUSBHUBREG *PCPDMUSBHUBREG;
 
 /** Current PDMUSBHUBREG version number. */
-#define PDM_USBHUBREG_VERSION                   PDM_VERSION_MAKE(0xf0fd, 1, 0)
+#define PDM_USBHUBREG_VERSION                   PDM_VERSION_MAKE(0xf0fd, 2, 0)
 
 
 /**
diff --git a/include/VBox/vmm/pdmifs.h b/include/VBox/vmm/pdmifs.h
index bd54da8..0c676eb 100644
--- a/include/VBox/vmm/pdmifs.h
+++ b/include/VBox/vmm/pdmifs.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -377,13 +377,20 @@ typedef struct PDMIMOUSECONNECTOR
      * Notifies the the downstream driver of changes to the reporting modes
      * supported by the driver
      *
-     * @param   pInterface      Pointer to the this interface.
+     * @param   pInterface      Pointer to this interface structure.
      * @param   fRelative       Whether relative mode is currently supported.
      * @param   fAbsolute       Whether absolute mode is currently supported.
      * @param   fAbsolute       Whether multi-touch mode is currently supported.
      */
     DECLR3CALLBACKMEMBER(void, pfnReportModes,(PPDMIMOUSECONNECTOR pInterface, bool fRelative, bool fAbsolute, bool fMultiTouch));
 
+    /**
+     * Flushes the mouse queue if it contains pending events.
+     *
+     * @param   pInterface      Pointer to this interface structure.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnFlushQueue,(PPDMIMOUSECONNECTOR pInterface));
+
 } PDMIMOUSECONNECTOR;
 /** PDMIMOUSECONNECTOR interface ID.  */
 #define PDMIMOUSECONNECTOR_IID                  "ce64d7bd-fa8f-41d1-a6fb-d102a2d6bffe"
@@ -398,7 +405,21 @@ typedef struct PDMIKEYBOARDPORT *PPDMIKEYBOARDPORT;
 typedef struct PDMIKEYBOARDPORT
 {
     /**
-     * Puts a keyboard event.
+     * Puts a scan code based keyboard event.
+     *
+     * This is called by the source of keyboard events. The event will be passed up
+     * until the topmost driver, which then calls the registered event handler.
+     *
+     * @returns VBox status code.  Return VERR_TRY_AGAIN if you cannot process the
+     *          event now and want it to be repeated at a later point.
+     *
+     * @param   pInterface          Pointer to this interface structure.
+     * @param   u8ScanCode          The scan code to queue.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnPutEventScan,(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode));
+
+    /**
+     * Puts a USB HID usage ID based keyboard event.
      *
      * This is called by the source of keyboard events. The event will be passed up
      * until the topmost driver, which then calls the registered event handler.
@@ -407,9 +428,9 @@ typedef struct PDMIKEYBOARDPORT
      *          event now and want it to be repeated at a later point.
      *
      * @param   pInterface          Pointer to this interface structure.
-     * @param   u8KeyCode           The keycode to queue.
+     * @param   u32UsageID          The HID usage code event to queue.
      */
-    DECLR3CALLBACKMEMBER(int, pfnPutEvent,(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode));
+    DECLR3CALLBACKMEMBER(int, pfnPutEventHid,(PPDMIKEYBOARDPORT pInterface, uint32_t u32UsageID));
 } PDMIKEYBOARDPORT;
 /** PDMIKEYBOARDPORT interface ID. */
 #define PDMIKEYBOARDPORT_IID                    "2a0844f0-410b-40ab-a6ed-6575f3aa3e29"
@@ -441,7 +462,7 @@ typedef struct PDMIKEYBOARDCONNECTOR
     /**
      * Notifies the the downstream driver about an LED change initiated by the guest.
      *
-     * @param   pInterface      Pointer to the this interface.
+     * @param   pInterface      Pointer to this interface structure.
      * @param   enmLeds         The new led mask.
      */
     DECLR3CALLBACKMEMBER(void, pfnLedStatusChange,(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds));
@@ -449,11 +470,18 @@ typedef struct PDMIKEYBOARDCONNECTOR
     /**
      * Notifies the the downstream driver of changes in driver state.
      *
-     * @param   pInterface      Pointer to the this interface.
+     * @param   pInterface      Pointer to this interface structure.
      * @param   fActive         Whether interface wishes to get "focus".
      */
     DECLR3CALLBACKMEMBER(void, pfnSetActive,(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive));
 
+    /**
+     * Flushes the keyboard queue if it contains pending events.
+     *
+     * @param   pInterface      Pointer to this interface structure.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnFlushQueue,(PPDMIKEYBOARDCONNECTOR pInterface));
+
 } PDMIKEYBOARDCONNECTOR;
 /** PDMIKEYBOARDCONNECTOR interface ID. */
 #define PDMIKEYBOARDCONNECTOR_IID               "db3f7bd5-953e-436f-9f8e-077905a92d82"
@@ -489,12 +517,13 @@ typedef struct PDMIDISPLAYPORT
      *
      * @returns VBox status code.
      * @param   pInterface          Pointer to this interface.
+     * @param   fFailOnResize       Fail is a resize is pending.
      * @thread  The emulation thread.
      */
-    DECLR3CALLBACKMEMBER(int, pfnUpdateDisplayAll,(PPDMIDISPLAYPORT pInterface));
+    DECLR3CALLBACKMEMBER(int, pfnUpdateDisplayAll,(PPDMIDISPLAYPORT pInterface, bool fFailOnResize));
 
     /**
-     * Return the current guest color depth in bits per pixel (bpp).
+     * Return the current guest resolution and color depth in bits per pixel (bpp).
      *
      * As the graphics card is able to provide display updates with the bpp
      * requested by the host, this method can be used to query the actual
@@ -503,9 +532,11 @@ typedef struct PDMIDISPLAYPORT
      * @returns VBox status code.
      * @param   pInterface         Pointer to this interface.
      * @param   pcBits             Where to store the current guest color depth.
+     * @param   pcx                Where to store the horizontal resolution.
+     * @param   pcy                Where to store the vertical resolution.
      * @thread  Any thread.
      */
-    DECLR3CALLBACKMEMBER(int, pfnQueryColorDepth,(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits));
+    DECLR3CALLBACKMEMBER(int, pfnQueryVideoMode,(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits, uint32_t *pcx, uint32_t *pcy));
 
     /**
      * Sets the refresh rate and restart the timer.
@@ -674,9 +705,9 @@ typedef struct PDMIDISPLAYPORT
 } PDMIDISPLAYPORT;
 /** PDMIDISPLAYPORT interface ID. */
 #ifdef VBOX_WITH_VMSVGA
-#define PDMIDISPLAYPORT_IID                     "e8da6d7e-8490-11e4-91d8-ab609a010f13"
+#define PDMIDISPLAYPORT_IID                     "9672e2b0-1aef-4c4d-9108-864cdb28333f"
 #else
-#define PDMIDISPLAYPORT_IID                     "db067c60-8490-11e4-8424-032afeb83818"
+#define PDMIDISPLAYPORT_IID                     "323f3412-8903-4564-b04c-cbfe0d2d1596"
 #endif
 
 
@@ -688,6 +719,7 @@ typedef struct VBVAHOSTFLAGS *PVBVAHOSTFLAGS;
 struct VBOXVDMACMD_CHROMIUM_CMD; /* <- chromium [hgsmi] command */
 struct VBOXVDMACMD_CHROMIUM_CTL; /* <- chromium [hgsmi] command */
 
+
 /** Pointer to a display connector interface. */
 typedef struct PDMIDISPLAYCONNECTOR *PPDMIDISPLAYCONNECTOR;
 struct VBOXCRCMDCTL;
@@ -1365,9 +1397,35 @@ typedef struct PDMISECKEY
      *        difficult like scrambling the memory buffer for instance.
      */
     DECLR3CALLBACKMEMBER(int, pfnKeyRelease, (PPDMISECKEY pInterface, const char *pszId));
+
+    /**
+     * Retains a password identified by the ID. The caller will only hold a reference
+     * to the password and must not modify the buffer in any way.
+     *
+     * @returns VBox status code.
+     * @param   pInterface      Pointer to this interface.
+     * @param   pszId           The alias/id for the password to retrieve.
+     * @param   ppszPassword    Where to store the pointer to the password on success.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnPasswordRetain, (PPDMISECKEY pInterface, const char *pszId,
+                                                  const char **ppszPassword));
+
+    /**
+     * Releases one reference of the password identified by the given identifier.
+     * The caller must not access the password after calling this operation.
+     *
+     * @returns VBox status code.
+     * @param   pInterface      Pointer to this interface.
+     * @param   pszId           The alias/id for the password to release.
+     *
+     * @note: It is advised to release the password whenever it is not used anymore so the entity
+     *        storing the password can do anything to make retrieving the password from memory more
+     *        difficult like scrambling the memory buffer for instance.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnPasswordRelease, (PPDMISECKEY pInterface, const char *pszId));
 } PDMISECKEY;
 /** PDMISECKEY interface ID. */
-#define PDMISECKEY_IID                           "a7336c4a-2ca0-489d-ad2d-f740f215a1e6"
+#define PDMISECKEY_IID                           "3d698355-d995-453d-960f-31566a891df2"
 
 /** Pointer to a secret key helper interface. */
 typedef struct PDMISECKEYHLP *PPDMISECKEYHLP;
@@ -2781,6 +2839,7 @@ typedef struct PDMIVMMDEVCONNECTOR
 #define PDMIVMMDEVCONNECTOR_IID                 "aff90240-a443-434e-9132-80c186ab97d4"
 
 
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
 /** Pointer to a network connector interface */
 typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
 /**
@@ -2797,7 +2856,6 @@ typedef struct PDMIAUDIOCONNECTOR
 /** PDMIAUDIOCONNECTOR interface ID. */
 #define PDMIAUDIOCONNECTOR_IID                  "85d52af5-b3aa-4b3e-b176-4b5ebfc52f47"
 
-
 /** @todo r=bird: the two following interfaces are hacks to work around the missing audio driver
  * interface. This should be addressed rather than making more temporary hacks. */
 
@@ -2950,6 +3008,7 @@ typedef struct PDMIAUDIOSNIFFERCONNECTOR
 /** PDMIAUDIOSNIFFERCONNECTOR - The Audio Sniffer Driver connector interface. */
 #define PDMIAUDIOSNIFFERCONNECTOR_IID           "9d37f543-27af-45f8-8002-8ef7abac71e4"
 
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
 /**
  * Generic status LED core.
diff --git a/include/VBox/vmm/pdmqueue.h b/include/VBox/vmm/pdmqueue.h
index 4edf16c..bcce9c1 100644
--- a/include/VBox/vmm/pdmqueue.h
+++ b/include/VBox/vmm/pdmqueue.h
@@ -149,6 +149,7 @@ VMMDECL(void)                 PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE
 VMMDECL(void)                 PDMQueueInsertEx(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem, uint64_t NanoMaxDelay);
 VMMDECL(RCPTRTYPE(PPDMQUEUE)) PDMQueueRCPtr(PPDMQUEUE pQueue);
 VMMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue);
+VMMDECL(bool)                 PDMQueueFlushIfNecessary(PPDMQUEUE pQueue);
 
 /** @} */
 
diff --git a/include/VBox/vmm/pdmusb.h b/include/VBox/vmm/pdmusb.h
index ca104b2..8b563eb 100644
--- a/include/VBox/vmm/pdmusb.h
+++ b/include/VBox/vmm/pdmusb.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -117,6 +117,11 @@ typedef const PDMUSBDESCCACHE *PCPDMUSBDESCCACHE;
  * @{ */
 /** A high-speed capable USB 2.0 device (also required to support full-speed). */
 #define PDM_USBREG_HIGHSPEED_CAPABLE        RT_BIT(0)
+/** Indicates that the device is fully emulated and is not used to pass through
+ * a host device. */
+#define PDM_USBREG_EMULATED_DEVICE          RT_BIT(1)
+/** A SuperSpeed USB 3.0 device. */
+#define PDM_USBREG_SUPERSPEED_CAPABLE       RT_BIT(2)
 /** @} */
 
 /** PDM USB Device Registration Structure,
@@ -269,9 +274,10 @@ typedef struct PDMUSBREG
      * @returns VBox status code.
      * @param   pUsbIns     The USB device instance data.
      * @param   iLUN        The logical unit which is being detached.
+     * @param   fFlags      Flags, combination of the PDM_TACH_FLAGS_* \#defines.
      * @remarks Optional.
      */
-    DECLR3CALLBACKMEMBER(int, pfnDriverAttach,(PPDMUSBINS pUsbIns, unsigned iLUN));
+    DECLR3CALLBACKMEMBER(int, pfnDriverAttach,(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags));
 
     /**
      * Driver Detach notification.
@@ -281,9 +287,10 @@ typedef struct PDMUSBREG
      *
      * @param   pUsbIns     The USB device instance data.
      * @param   iLUN        The logical unit which is being detached.
+     * @param   fFlags      Flags, combination of the PDM_TACH_FLAGS_* \#defines.
      * @remarks Optional.
      */
-    DECLR3CALLBACKMEMBER(void, pfnDriverDetach,(PPDMUSBINS pUsbIns, unsigned iLUN));
+    DECLR3CALLBACKMEMBER(void, pfnDriverDetach,(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags));
 
     /**
      * Query the base interface of a logical unit.
@@ -445,7 +452,7 @@ typedef struct PDMUSBHLP
     /**
      * Attaches a driver (chain) to the USB device.
      *
-     * The first call for a LUN this will serve as a registartion of the LUN. The pBaseInterface and
+     * The first call for a LUN this will serve as a registration of the LUN. The pBaseInterface and
      * the pszDesc string will be registered with that LUN and kept around for PDMR3QueryUSBDeviceLun().
      *
      * @returns VBox status code.
@@ -776,9 +783,8 @@ typedef struct PDMUSBINS
     uint32_t                    fTracing;
     /** The tracing ID of this device.  */
     uint32_t                    idTracing;
-    /** The USB version of the hub this device is attached to. Used to
-     * determine whether the device communicates at high-speed or full-/low-speed. */
-    uint32_t                    iUsbHubVersion;
+    /** The port/device speed. HCs and emulated devices need to know. */
+    VUSBSPEED                   enmSpeed;
 
     /** Padding to make achInstanceData aligned at 32 byte boundary. */
     uint32_t                    au32Padding[HC_ARCH_BITS == 32 ? 2 : 3];
@@ -789,7 +795,7 @@ typedef struct PDMUSBINS
 } PDMUSBINS;
 
 /** Current USBINS version number. */
-#define PDM_USBINS_VERSION                      PDM_VERSION_MAKE(0xeefd, 2, 0)
+#define PDM_USBINS_VERSION                      PDM_VERSION_MAKE(0xeefd, 3, 0)
 
 /**
  * Checks the structure versions of the USB device instance and USB device
@@ -995,6 +1001,20 @@ DECLINLINE(int) PDMUsbHlpTMTimerCreate(PPDMUSBINS pUsbIns, TMCLOCK enmClock, PFN
     return pUsbIns->pHlpR3->pfnTMTimerCreate(pUsbIns, enmClock, pfnCallback, pvUser, fFlags, pszDesc, ppTimer);
 }
 
+/**
+ * @copydoc PDMUSBHLP::pfnSSMRegister
+ */
+DECLINLINE(int) PDMUsbHlpSSMRegister(PPDMUSBINS pUsbIns, uint32_t uVersion, size_t cbGuess,
+                                     PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
+                                     PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
+                                     PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone)
+{
+    return pUsbIns->pHlpR3->pfnSSMRegister(pUsbIns, uVersion, cbGuess,
+                                           pfnLivePrep, pfnLiveExec, pfnLiveVote,
+                                           pfnSavePrep, pfnSaveExec, pfnSaveDone,
+                                           pfnLoadPrep, pfnLoadExec, pfnLoadDone);
+}
+
 #endif /* IN_RING3 */
 
 
@@ -1038,12 +1058,17 @@ typedef struct PDMUSBREGCB
  */
 typedef DECLCALLBACK(int) FNPDMVBOXUSBREGISTER(PCPDMUSBREGCB pCallbacks, uint32_t u32Version);
 
-VMMR3DECL(int)  PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pDeviceNode, PCRTUUID pUuid);
+VMMR3DECL(int)  PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pDeviceNode, PCRTUUID pUuid,
+                                             const char *pszCaptureFilename);
 VMMR3DECL(int)  PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend,
-                                          uint32_t iUsbVersion, uint32_t fMaskedIfs);
+                                          uint32_t iUsbVersion, uint32_t fMaskedIfs, const char *pszCaptureFilename);
 VMMR3DECL(int)  PDMR3UsbDetachDevice(PUVM pUVM, PCRTUUID pUuid);
 VMMR3DECL(bool) PDMR3UsbHasHub(PUVM pUVM);
-
+VMMR3DECL(int)  PDMR3UsbDriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
+                                     PPPDMIBASE ppBase);
+VMMR3DECL(int)  PDMR3UsbDriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
+                                     const char *pszDriver, unsigned iOccurance, uint32_t fFlags);
+VMMR3DECL(int)  PDMR3UsbQueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase);
 
 /** @} */
 
diff --git a/include/VBox/vmm/pgm.h b/include/VBox/vmm/pgm.h
index 7e397b2..96ce206 100644
--- a/include/VBox/vmm/pgm.h
+++ b/include/VBox/vmm/pgm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -76,40 +76,99 @@ typedef FNPGMRELOCATE *PFNPGMRELOCATE;
 
 
 /**
- * Physical page access handler type.
+ * Memory access origin.
  */
-typedef enum PGMPHYSHANDLERTYPE
+typedef enum PGMACCESSORIGIN
+{
+    /** Invalid zero value. */
+    PGMACCESSORIGIN_INVALID = 0,
+    /** IEM is access memory. */
+    PGMACCESSORIGIN_IEM,
+    /** HM is access memory. */
+    PGMACCESSORIGIN_HM,
+    /** Some device is access memory. */
+    PGMACCESSORIGIN_DEVICE,
+    /** Someone debugging is access memory. */
+    PGMACCESSORIGIN_DEBUGGER,
+    /** SELM is access memory. */
+    PGMACCESSORIGIN_SELM,
+    /** FTM is access memory. */
+    PGMACCESSORIGIN_FTM,
+    /** REM is access memory. */
+    PGMACCESSORIGIN_REM,
+    /** IOM is access memory. */
+    PGMACCESSORIGIN_IOM,
+    /** End of valid values. */
+    PGMACCESSORIGIN_END,
+    /** Type size hack. */
+    PGMACCESSORIGIN_32BIT_HACK = 0x7fffffff
+} PGMACCESSORIGIN;
+
+
+/**
+ * Physical page access handler kind.
+ */
+typedef enum PGMPHYSHANDLERKIND
 {
     /** MMIO range. Pages are not present, all access is done in interpreter or recompiler. */
-    PGMPHYSHANDLERTYPE_MMIO = 1,
+    PGMPHYSHANDLERKIND_MMIO = 1,
     /** Handler all write access to a physical page range. */
-    PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
+    PGMPHYSHANDLERKIND_WRITE,
     /** Handler all access to a physical page range. */
-    PGMPHYSHANDLERTYPE_PHYSICAL_ALL
+    PGMPHYSHANDLERKIND_ALL
 
-} PGMPHYSHANDLERTYPE;
+} PGMPHYSHANDLERKIND;
 
 /**
- * \#PF Handler callback for physical access handler ranges in RC.
- *
- * @returns VBox status code (appropriate for RC return).
- * @param   pVM         VM Handle.
- * @param   uErrorCode  CPU Error code.
- * @param   pRegFrame   Trap register frame.
- *                      NULL on DMA and other non CPU access.
- * @param   pvFault     The fault address (cr2).
- * @param   GCPhysFault The GC physical address corresponding to pvFault.
- * @param   pvUser      User argument.
+ * Guest Access type
  */
-typedef DECLCALLBACK(int) FNPGMRCPHYSHANDLER(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
-/** Pointer to PGM access callback. */
-typedef FNPGMRCPHYSHANDLER *PFNPGMRCPHYSHANDLER;
+typedef enum PGMACCESSTYPE
+{
+    /** Read access. */
+    PGMACCESSTYPE_READ = 1,
+    /** Write access. */
+    PGMACCESSTYPE_WRITE
+} PGMACCESSTYPE;
+
+
+/** @def PGM_ALL_CB_DECL
+ * Macro for declaring a handler callback for all contexts.  The handler
+ * callback is static in ring-3, and exported in RC and R0.
+ * @sa PGM_ALL_CB2_DECL.
+ */
+#if defined(IN_RC) || defined(IN_RING0)
+# ifdef __cplusplus
+#  define PGM_ALL_CB_DECL(type)     extern "C" DECLEXPORT(type)
+# else
+#  define PGM_ALL_CB_DECL(type)     DECLEXPORT(type)
+# endif
+#else
+# define PGM_ALL_CB_DECL(type)      static type
+#endif
+
+/** @def PGM_ALL_CB2_DECL
+ * Macro for declaring a handler callback for all contexts.  The handler
+ * callback is hidden in ring-3, and exported in RC and R0.
+ * @sa PGM_ALL_CB2_DECL.
+ */
+#if defined(IN_RC) || defined(IN_RING0)
+# ifdef __cplusplus
+#  define PGM_ALL_CB2_DECL(type)    extern "C" DECLEXPORT(type)
+# else
+#  define PGM_ALL_CB2_DECL(type)    DECLEXPORT(type)
+# endif
+#else
+# define PGM_ALL_CB2_DECL(type)     DECLHIDDEN(type)
+#endif
+
 
 /**
- * \#PF Handler callback for physical access handler ranges in R0.
+ * \#PF Handler callback for physical access handler ranges in RC and R0.
  *
- * @returns VBox status code (appropriate for R0 return).
+ * @returns VBox status code (appropriate for RC return).
  * @param   pVM         VM Handle.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  *                      NULL on DMA and other non CPU access.
@@ -117,20 +176,11 @@ typedef FNPGMRCPHYSHANDLER *PFNPGMRCPHYSHANDLER;
  * @param   GCPhysFault The GC physical address corresponding to pvFault.
  * @param   pvUser      User argument.
  */
-typedef DECLCALLBACK(int) FNPGMR0PHYSHANDLER(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
+typedef DECLCALLBACK(int) FNPGMRZPHYSPFHANDLER(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                               RTGCPHYS GCPhysFault, void *pvUser);
 /** Pointer to PGM access callback. */
-typedef FNPGMR0PHYSHANDLER *PFNPGMR0PHYSHANDLER;
+typedef FNPGMRZPHYSPFHANDLER *PFNPGMRZPHYSPFHANDLER;
 
-/**
- * Guest Access type
- */
-typedef enum PGMACCESSTYPE
-{
-    /** Read access. */
-    PGMACCESSTYPE_READ = 1,
-    /** Write access. */
-    PGMACCESSTYPE_WRITE
-} PGMACCESSTYPE;
 
 /**
  * \#PF Handler callback for physical access handler ranges (MMIO among others) in HC.
@@ -141,34 +191,36 @@ typedef enum PGMACCESSTYPE
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             VM Handle.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPhys          The physical address the guest is writing to.
  * @param   pvPhys          The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
+ * @param   enmOrigin       The origin of this call.
  * @param   pvUser          User argument.
- *
- * @todo    Add pVCpu, possibly replacing pVM.
  */
-typedef DECLCALLBACK(int) FNPGMR3PHYSHANDLER(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
+typedef DECLCALLBACK(int) FNPGMPHYSHANDLER(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                           PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser);
 /** Pointer to PGM access callback. */
-typedef FNPGMR3PHYSHANDLER *PFNPGMR3PHYSHANDLER;
+typedef FNPGMPHYSHANDLER *PFNPGMPHYSHANDLER;
 
 
 /**
  * Virtual access handler type.
  */
-typedef enum PGMVIRTHANDLERTYPE
+typedef enum PGMVIRTHANDLERKIND
 {
     /** Write access handled. */
-    PGMVIRTHANDLERTYPE_WRITE = 1,
+    PGMVIRTHANDLERKIND_WRITE = 1,
     /** All access handled. */
-    PGMVIRTHANDLERTYPE_ALL,
+    PGMVIRTHANDLERKIND_ALL,
     /** Hypervisor write access handled.
      * This is used to catch the guest trying to write to LDT, TSS and any other
      * system structure which the brain dead intel guys let unprivilegde code find. */
-    PGMVIRTHANDLERTYPE_HYPERVISOR
-} PGMVIRTHANDLERTYPE;
+    PGMVIRTHANDLERKIND_HYPERVISOR
+} PGMVIRTHANDLERKIND;
 
 /**
  * \#PF Handler callback for virtual access handler ranges, RC.
@@ -177,18 +229,21 @@ typedef enum PGMVIRTHANDLERTYPE
  * for ALL and WRITE handlers these will also trigger.
  *
  * @returns VBox status code (appropriate for GC return).
- * @param   pVM         VM Handle.
- * @param   uErrorCode   CPU Error code.
- * @param   pRegFrame   Trap register frame.
- * @param   pvFault     The fault address (cr2).
- * @param   pvRange     The base address of the handled virtual range.
- * @param   offRange    The offset of the access into this range.
- *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
- * @todo    Add pVCpu, possibly replacing pVM.
+ * @param   pVM             VM Handle.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
+ * @param   uErrorCode      CPU Error code (X86_TRAP_PF_XXX).
+ * @param   pRegFrame       Trap register frame.
+ * @param   pvFault         The fault address (cr2).
+ * @param   pvRange         The base address of the handled virtual range.
+ * @param   offRange        The offset of the access into this range.
+ *                          (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser          User argument.
  */
-typedef DECLCALLBACK(int) FNPGMRCVIRTHANDLER(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
+typedef DECLCALLBACK(int) FNPGMRCVIRTPFHANDLER(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                               RTGCPTR pvRange, uintptr_t offRange, void *pvUser);
 /** Pointer to PGM access callback. */
-typedef FNPGMRCVIRTHANDLER *PFNPGMRCVIRTHANDLER;
+typedef FNPGMRCVIRTPFHANDLER *PFNPGMRCVIRTPFHANDLER;
 
 /**
  * \#PF Handler callback for virtual access handler ranges, R3.
@@ -199,29 +254,35 @@ typedef FNPGMRCVIRTHANDLER *PFNPGMRCVIRTHANDLER;
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             VM Handle.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPtr           The virtual address the guest is writing to. (not correct if it's an alias!)
  * @param   pvPtr           The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
+ * @param   enmOrigin       Who is calling.
  * @param   pvUser          User argument.
- * @todo    Add pVCpu, possibly replacing pVM.
  */
-typedef DECLCALLBACK(int) FNPGMR3VIRTHANDLER(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
+typedef DECLCALLBACK(int) FNPGMR3VIRTHANDLER(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
+                                             PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser);
 /** Pointer to PGM access callback. */
 typedef FNPGMR3VIRTHANDLER *PFNPGMR3VIRTHANDLER;
 
-
 /**
  * \#PF Handler callback for invalidation of virtual access handler ranges.
  *
  * @param   pVM             VM Handle.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPtr           The virtual address the guest has changed.
+ * @param   pvUser          User argument.
  */
-typedef DECLCALLBACK(int) FNPGMR3VIRTINVALIDATE(PVM pVM, RTGCPTR GCPtr);
+typedef DECLCALLBACK(int) FNPGMR3VIRTINVALIDATE(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvUser);
 /** Pointer to PGM invalidation callback. */
 typedef FNPGMR3VIRTINVALIDATE *PFNPGMR3VIRTINVALIDATE;
 
+
 /**
  * PGMR3PhysEnumDirtyFTPages callback for syncing dirty physical pages
  *
@@ -235,6 +296,7 @@ typedef DECLCALLBACK(int) FNPGMENUMDIRTYFTPAGES(PVM pVM, RTGCPHYS GCPhys, uint8_
 /** Pointer to PGMR3PhysEnumDirtyFTPages callback. */
 typedef FNPGMENUMDIRTYFTPAGES *PFNPGMENUMDIRTYFTPAGES;
 
+
 /**
  * Paging mode.
  */
@@ -347,18 +409,24 @@ VMMDECL(PGMMODE)    PGMGetHostMode(PVM pVM);
 VMMDECL(const char *) PGMGetModeName(PGMMODE enmMode);
 VMM_INT_DECL(void)  PGMNotifyNxeChanged(PVMCPU pVCpu, bool fNxe);
 VMMDECL(bool)       PGMHasDirtyPages(PVM pVM);
-VMMDECL(int)        PGMHandlerPhysicalRegisterEx(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
-                                                 R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
-                                                 R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
-                                                 RCPTRTYPE(PFNPGMRCPHYSHANDLER) pfnHandlerRC, RTRCPTR pvUserRC,
-                                                 R3PTRTYPE(const char *) pszDesc);
+
+/** PGM physical access handler type registration handle (heap offset, valid
+ * cross contexts without needing fixing up).  Callbacks and handler type is
+ * associated with this and it is shared by all handler registrations. */
+typedef uint32_t PGMPHYSHANDLERTYPE;
+/** Pointer to a PGM physical handler type registration handle. */
+typedef PGMPHYSHANDLERTYPE *PPGMPHYSHANDLERTYPE;
+/** NIL value for PGM physical access handler type handle. */
+#define NIL_PGMPHYSHANDLERTYPE  UINT32_MAX
+VMMDECL(uint32_t)   PGMHandlerPhysicalTypeRelease(PVM pVM, PGMPHYSHANDLERTYPE hType);
+VMMDECL(uint32_t)   PGMHandlerPhysicalTypeRetain(PVM pVM, PGMPHYSHANDLERTYPE hType);
+
+VMMDECL(int)        PGMHandlerPhysicalRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast, PGMPHYSHANDLERTYPE hType,
+                                               RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, 
+                                               R3PTRTYPE(const char *) pszDesc);
 VMMDECL(int)        PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast);
 VMMDECL(int)        PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys);
-VMMDECL(int)        PGMHandlerPhysicalChangeCallbacks(PVM pVM, RTGCPHYS GCPhys,
-                                                      R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
-                                                      R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
-                                                      RCPTRTYPE(PFNPGMRCPHYSHANDLER) pfnHandlerRC, RTRCPTR pvUserRC,
-                                                      R3PTRTYPE(const char *) pszDesc);
+VMMDECL(int)        PGMHandlerPhysicalChangeUserArgs(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC);
 VMMDECL(int)        PGMHandlerPhysicalSplit(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysSplit);
 VMMDECL(int)        PGMHandlerPhysicalJoin(PVM pVM, RTGCPHYS GCPhys1, RTGCPHYS GCPhys2);
 VMMDECL(int)        PGMHandlerPhysicalPageTempOff(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage);
@@ -366,20 +434,32 @@ VMMDECL(int)        PGMHandlerPhysicalPageAlias(PVM pVM, RTGCPHYS GCPhys, RTGCPH
 VMMDECL(int)        PGMHandlerPhysicalPageAliasHC(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTHCPHYS HCPhysPageRemap);
 VMMDECL(int)        PGMHandlerPhysicalReset(PVM pVM, RTGCPHYS GCPhys);
 VMMDECL(bool)       PGMHandlerPhysicalIsRegistered(PVM pVM, RTGCPHYS GCPhys);
-VMMDECL(bool)       PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr);
+
+/** PGM virtual access handler type registration handle (heap offset, valid
+ * cross contexts without needing fixing up).  Callbacks and handler type is
+ * associated with this and it is shared by all handler registrations. */
+typedef uint32_t PGMVIRTHANDLERTYPE;
+/** Pointer to a PGM virtual handler type registration handle. */
+typedef PGMVIRTHANDLERTYPE *PPGMVIRTHANDLERTYPE;
+/** NIL value for PGM virtual access handler type handle. */
+#define NIL_PGMVIRTHANDLERTYPE  UINT32_MAX
+VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRelease(PVM pVM, PGMVIRTHANDLERTYPE hType);
+VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRetain(PVM pVM, PGMVIRTHANDLERTYPE hType);
+VMM_INT_DECL(bool)     PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr);
+
 VMMDECL(bool)       PGMPhysIsA20Enabled(PVMCPU pVCpu);
 VMMDECL(bool)       PGMPhysIsGCPhysValid(PVM pVM, RTGCPHYS GCPhys);
 VMMDECL(bool)       PGMPhysIsGCPhysNormal(PVM pVM, RTGCPHYS GCPhys);
 VMMDECL(int)        PGMPhysGCPtr2GCPhys(PVMCPU pVCpu, RTGCPTR GCPtr, PRTGCPHYS pGCPhys);
 VMMDECL(void)       PGMPhysReleasePageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock);
-VMMDECL(int)        PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead);
-VMMDECL(int)        PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite);
+VMMDECL(int)        PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
+VMMDECL(int)        PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
+VMMDECL(int)        PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
+VMMDECL(int)        PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin);
 VMMDECL(int)        PGMPhysSimpleReadGCPhys(PVM pVM, void *pvDst, RTGCPHYS GCPhysSrc, size_t cb);
 VMMDECL(int)        PGMPhysSimpleWriteGCPhys(PVM pVM, RTGCPHYS GCPhysDst, const void *pvSrc, size_t cb);
 VMMDECL(int)        PGMPhysSimpleReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
 VMMDECL(int)        PGMPhysSimpleWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
-VMMDECL(int)        PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
-VMMDECL(int)        PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
 VMMDECL(int)        PGMPhysSimpleDirtyWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb);
 VMMDECL(int)        PGMPhysInterpretedRead(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
 VMMDECL(int)        PGMPhysInterpretedReadNoHandlers(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, void *pvDst, RTGCUINTPTR GCPtrSrc, size_t cb, bool fRaiseTrap);
@@ -414,7 +494,6 @@ VMMDECL(int)        PGMSetLargePageUsage(PVM pVM, bool fUseLargePages);
 
 #ifdef IN_RC
 /** @defgroup grp_pgm_gc  The PGM Guest Context API
- * @ingroup grp_pgm
  * @{
  */
 VMMRCDECL(int)      PGMRCDynMapInit(PVM pVM);
@@ -424,7 +503,6 @@ VMMRCDECL(int)      PGMRCDynMapInit(PVM pVM);
 
 #ifdef IN_RING0
 /** @defgroup grp_pgm_r0  The PGM Host Context Ring-0 API
- * @ingroup grp_pgm
  * @{
  */
 VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PVM pVM, PVMCPU pVCpu);
@@ -450,7 +528,6 @@ VMMR0DECL(void)     PGMR0DynMapMigrateAutoSet(PVMCPU pVCpu);
 
 #ifdef IN_RING3
 /** @defgroup grp_pgm_r3  The PGM Host Context Ring-3 API
- * @ingroup grp_pgm
  * @{
  */
 VMMR3DECL(int)      PGMR3Init(PVM pVM);
@@ -475,11 +552,8 @@ VMMR3DECL(int)      PGMR3PhysGetRange(PVM pVM, uint32_t iRange, PRTGCPHYS pGCPhy
 VMMR3DECL(int)      PGMR3QueryMemoryStats(PUVM pUVM, uint64_t *pcbTotalMem, uint64_t *pcbPrivateMem, uint64_t *pcbSharedMem, uint64_t *pcbZeroMem);
 VMMR3DECL(int)      PGMR3QueryGlobalMemoryStats(PUVM pUVM, uint64_t *pcbAllocMem, uint64_t *pcbFreeMem, uint64_t *pcbBallonedMem, uint64_t *pcbSharedMem);
 
-VMMR3DECL(int)      PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb,
-                                          R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
-                                          R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
-                                          RCPTRTYPE(PFNPGMRCPHYSHANDLER) pfnHandlerRC, RTRCPTR pvUserRC,
-                                          R3PTRTYPE(const char *) pszDesc);
+VMMR3DECL(int)      PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
+                                          RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc);
 VMMR3DECL(int)      PGMR3PhysMMIODeregister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
 VMMR3DECL(int)      PGMR3PhysMMIO2Register(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS cb, uint32_t fFlags, void **ppv, const char *pszDesc);
 VMMR3DECL(int)      PGMR3PhysMMIO2Deregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion);
@@ -520,34 +594,43 @@ VMMR3DECL(int)      PGMR3MapIntermediate(PVM pVM, RTUINTPTR Addr, RTHCPHYS HCPhy
 #endif
 VMMR3DECL(int)      PGMR3MapRead(PVM pVM, void *pvDst, RTGCPTR GCPtrSrc, size_t cb);
 
-VMMR3DECL(int)      PGMR3HandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
-                                                 PFNPGMR3PHYSHANDLER pfnHandlerR3, void *pvUserR3,
-                                                 const char *pszModR0, const char *pszHandlerR0, RTR0PTR pvUserR0,
-                                                 const char *pszModRC, const char *pszHandlerRC, RTRCPTR pvUserRC, const char *pszDesc);
-VMMDECL(int)        PGMR3HandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast,
-                                                  R3PTRTYPE(PFNPGMR3VIRTINVALIDATE) pfnInvalidateR3,
-                                                  R3PTRTYPE(PFNPGMR3VIRTHANDLER) pfnHandlerR3,
-                                                  RCPTRTYPE(PFNPGMRCVIRTHANDLER) pfnHandlerRC,
-                                                  R3PTRTYPE(const char *) pszDesc);
-VMMR3DECL(int)      PGMR3HandlerVirtualRegister(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast,
-                                                PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
-                                                PFNPGMR3VIRTHANDLER pfnHandlerR3,
-                                                const char *pszHandlerRC, const char *pszModRC, const char *pszDesc);
-VMMDECL(int)        PGMHandlerVirtualChangeInvalidateCallback(PVM pVM, RTGCPTR GCPtr, R3PTRTYPE(PFNPGMR3VIRTINVALIDATE) pfnInvalidateR3);
-VMMDECL(int)        PGMHandlerVirtualDeregister(PVM pVM, RTGCPTR GCPtr);
+VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind,
+                                                       PFNPGMPHYSHANDLER pfnHandlerR3,
+                                                       R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0,
+                                                       RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC,
+                                                       const char *pszDesc, PPGMPHYSHANDLERTYPE phType);
+VMMR3DECL(int)      PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind,
+                                                     R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
+                                                     const char *pszModR0, const char *pszPfHandlerR0,
+                                                     const char *pszModRC, const char *pszPfHandlerRC, const char *pszDesc,
+                                                     PPGMPHYSHANDLERTYPE phType);
+VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegisterEx(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
+                                                      PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
+                                                      PFNPGMR3VIRTHANDLER pfnHandlerR3,
+                                                      RCPTRTYPE(FNPGMRCVIRTPFHANDLER) pfnPfHandlerRC,
+                                                      const char *pszDesc, PPGMVIRTHANDLERTYPE phType);
+VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegister(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
+                                                    PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
+                                                    PFNPGMR3VIRTHANDLER pfnHandlerR3,
+                                                    const char *pszPfHandlerRC, const char *pszDesc,
+                                                    PPGMVIRTHANDLERTYPE phType);
+VMMR3_INT_DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PVMCPU pVCpu, PGMVIRTHANDLERTYPE hType, RTGCPTR GCPtr,
+                                                RTGCPTR GCPtrLast, void *pvUserR3, RTRCPTR pvUserRC, const char *pszDesc);
+VMMR3_INT_DECL(int) PGMHandlerVirtualChangeType(PVM pVM, RTGCPTR GCPtr, PGMVIRTHANDLERTYPE hNewType);
+VMMR3_INT_DECL(int) PGMHandlerVirtualDeregister(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, bool fHypervisor);
 VMMR3DECL(int)      PGMR3PoolGrow(PVM pVM);
 
 VMMR3DECL(int)      PGMR3PhysTlbGCPhys2Ptr(PVM pVM, RTGCPHYS GCPhys, bool fWritable, void **ppv);
-VMMR3DECL(uint8_t)  PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys);
-VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys);
-VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys);
-VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys);
-VMMR3DECL(void)     PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value);
-VMMR3DECL(void)     PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value);
-VMMR3DECL(void)     PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value);
-VMMR3DECL(void)     PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value);
-VMMR3DECL(int)      PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead);
-VMMR3DECL(int)      PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, const char *pszWho);
+VMMR3DECL(uint8_t)  PGMR3PhysReadU8(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(uint16_t) PGMR3PhysReadU16(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(uint32_t) PGMR3PhysReadU32(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(uint64_t) PGMR3PhysReadU64(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(void)     PGMR3PhysWriteU8(PVM pVM, RTGCPHYS GCPhys, uint8_t Value, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(void)     PGMR3PhysWriteU16(PVM pVM, RTGCPHYS GCPhys, uint16_t Value, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(void)     PGMR3PhysWriteU32(PVM pVM, RTGCPHYS GCPhys, uint32_t Value, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(void)     PGMR3PhysWriteU64(PVM pVM, RTGCPHYS GCPhys, uint64_t Value, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(int)      PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin);
+VMMR3DECL(int)      PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin);
 VMMR3DECL(int)      PGMR3PhysGCPhys2CCPtrExternal(PVM pVM, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
 VMMR3DECL(int)      PGMR3PhysGCPhys2CCPtrReadOnlyExternal(PVM pVM, RTGCPHYS GCPhys, void const **ppv, PPGMPAGEMAPLOCK pLock);
 VMMR3DECL(int)      PGMR3PhysChunkMap(PVM pVM, uint32_t idChunk);
diff --git a/include/VBox/vmm/rem.h b/include/VBox/vmm/rem.h
index bda6e29..77fa325 100644
--- a/include/VBox/vmm/rem.h
+++ b/include/VBox/vmm/rem.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -43,9 +43,9 @@ RT_C_DECLS_BEGIN
 
 #if defined(IN_RING0) || defined(IN_RC)
 VMMDECL(void) REMNotifyInvalidatePage(PVM pVM, RTGCPTR GCPtrPage);
-VMMDECL(void) REMNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
-VMMDECL(void) REMNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
-VMMDECL(void) REMNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
+VMMDECL(void) REMNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
+VMMDECL(void) REMNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
+VMMDECL(void) REMNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
 #endif /* IN_RING0 || IN_RC */
 #ifdef IN_RC
 VMMDECL(void) REMNotifyHandlerPhysicalFlushIfAlmostFull(PVM pVM, PVMCPU pVCpu);
@@ -55,7 +55,6 @@ VMMDECL(void) REMFlushTBs(PVM pVM);
 
 #ifdef IN_RING3
 /** @defgroup grp_rem_r3   REM Host Context Ring 3 API
- * @ingroup grp_rem
  * @{
  */
 REMR3DECL(int)  REMR3Init(PVM pVM);
@@ -82,9 +81,9 @@ REMR3DECL(void) REMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb
 /** @} */
 REMR3DECL(void) REMR3NotifyPhysRomRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, void *pvCopy, bool fShadow);
 REMR3DECL(void) REMR3NotifyPhysRamDeregister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb);
-REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
-REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
-REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
+REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
+REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
+REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
 REMR3DECL(void) REMR3NotifyPendingInterrupt(PVM pVM, PVMCPU pVCpu, uint8_t u8Interrupt);
 REMR3DECL(uint32_t) REMR3QueryPendingInterrupt(PVM pVM, PVMCPU pVCpu);
 REMR3DECL(void) REMR3NotifyInterruptSet(PVM pVM, PVMCPU pVCpu);
diff --git a/include/VBox/vmm/selm.h b/include/VBox/vmm/selm.h
index 7503e73..eda5a85 100644
--- a/include/VBox/vmm/selm.h
+++ b/include/VBox/vmm/selm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -85,7 +85,6 @@ VMM_INT_DECL(void)      SELMLoadHiddenSelectorReg(PVMCPU pVCpu, PCCPUMCTX pCtx,
 
 #ifdef IN_RING3
 /** @defgroup grp_selm_r3   The Selector Monitor(/Manager) API
- * @ingroup grp_selm
  * @{
  */
 VMMR3DECL(int)          SELMR3Init(PVM pVM);
diff --git a/include/VBox/vmm/ssm.h b/include/VBox/vmm/ssm.h
index 8218930..5d7dda9 100644
--- a/include/VBox/vmm/ssm.h
+++ b/include/VBox/vmm/ssm.h
@@ -224,73 +224,78 @@ typedef struct SSMFIELD
     uint32_t            off;
     /** The size of the field. */
     uint32_t            cb;
+    /** This field was first saved by this unit version number. */
+    uint32_t            uFirstVer;
     /** Field name. */
     const char         *pszName;
 } SSMFIELD;
 
 /** Emit a SSMFIELD array entry.
  * @internal  */
-#define SSMFIELD_ENTRY_INT(Name, off, cb, enmTransformer) \
-    { (PFNSSMFIELDGETPUT)(uintptr_t)(enmTransformer), (off), (cb), Name }
+#define SSMFIELD_ENTRY_INT(Name, off, cb, enmTransformer, uFirstVer) \
+    { (PFNSSMFIELDGETPUT)(uintptr_t)(enmTransformer), (off), (cb), (uFirstVer), Name }
 /** Emit a SSMFIELD array entry.
  * @internal  */
-#define SSMFIELD_ENTRY_TF_INT(Type, Field, enmTransformer) \
-    SSMFIELD_ENTRY_INT(#Type "::" #Field, RT_OFFSETOF(Type, Field), RT_SIZEOFMEMB(Type, Field), enmTransformer)
+#define SSMFIELD_ENTRY_TF_INT(Type, Field, enmTransformer, uFirstVer) \
+    SSMFIELD_ENTRY_INT(#Type "::" #Field, RT_OFFSETOF(Type, Field), RT_SIZEOFMEMB(Type, Field), enmTransformer, uFirstVer)
 /** Emit a SSMFIELD array entry for an old field.
  * @internal  */
 #define SSMFIELD_ENTRY_OLD_INT(Field, cb, enmTransformer) \
-    SSMFIELD_ENTRY_INT("old::" #Field, UINT32_MAX / 2, (cb), enmTransformer)
+    SSMFIELD_ENTRY_INT("old::" #Field, UINT32_MAX / 2, (cb), enmTransformer, 0)
 /** Emit a SSMFIELD array entry for an alignment padding.
  * @internal  */
 #define SSMFIELD_ENTRY_PAD_INT(Type, Field, cb32, cb64, enmTransformer) \
     SSMFIELD_ENTRY_INT(#Type "::" #Field, RT_OFFSETOF(Type, Field), \
-                       (RT_SIZEOFMEMB(Type, Field) << 16) | (cb32) | ((cb64) << 8), enmTransformer)
+                       (RT_SIZEOFMEMB(Type, Field) << 16) | (cb32) | ((cb64) << 8), enmTransformer, 0)
 /** Emit a SSMFIELD array entry for an alignment padding.
  * @internal  */
 #define SSMFIELD_ENTRY_PAD_OTHER_INT(Type, Field, cb32, cb64, enmTransformer) \
-    SSMFIELD_ENTRY_INT(#Type "::" #Field, UINT32_MAX / 2, 0 | (cb32) | ((cb64) << 8), enmTransformer)
+    SSMFIELD_ENTRY_INT(#Type "::" #Field, UINT32_MAX / 2, 0 | (cb32) | ((cb64) << 8), enmTransformer, 0)
 
 /** Emit a SSMFIELD array entry. */
-#define SSMFIELD_ENTRY(Type, Field)                 SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_NO_TRANSFORMATION)
+#define SSMFIELD_ENTRY(Type, Field)                 SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_NO_TRANSFORMATION, 0)
+/** Emit a SSMFIELD array entry with first version. */
+#define SSMFIELD_ENTRY_VER(Type, Field, uFirstVer)  SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_NO_TRANSFORMATION, uFirstVer)
 /** Emit a SSMFIELD array entry for a custom made field.  This is intended
  *  for working around bitfields in old structures. */
-#define SSMFIELD_ENTRY_CUSTOM(Field, off, cb)       SSMFIELD_ENTRY_INT("custom::" #Field, off, cb, SSMFIELDTRANS_NO_TRANSFORMATION)
+#define SSMFIELD_ENTRY_CUSTOM(Field, off, cb)       SSMFIELD_ENTRY_INT("custom::" #Field, off, cb, \
+                                                                       SSMFIELDTRANS_NO_TRANSFORMATION, 0)
 /** Emit a SSMFIELD array entry for a RTGCPHYS type. */
-#define SSMFIELD_ENTRY_GCPHYS(Type, Field)          SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_GCPHYS)
+#define SSMFIELD_ENTRY_GCPHYS(Type, Field)          SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_GCPHYS, 0)
 /** Emit a SSMFIELD array entry for a RTGCPTR type. */
-#define SSMFIELD_ENTRY_GCPTR(Type, Field)           SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_GCPTR)
+#define SSMFIELD_ENTRY_GCPTR(Type, Field)           SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_GCPTR, 0)
 /** Emit a SSMFIELD array entry for a raw-mode context pointer. */
-#define SSMFIELD_ENTRY_RCPTR(Type, Field)           SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_RCPTR)
+#define SSMFIELD_ENTRY_RCPTR(Type, Field)           SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_RCPTR, 0)
 /** Emit a SSMFIELD array entry for a raw-mode context pointer. */
-#define SSMFIELD_ENTRY_RCPTR_ARRAY(Type, Field)     SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_RCPTR_ARRAY)
+#define SSMFIELD_ENTRY_RCPTR_ARRAY(Type, Field)     SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_RCPTR_ARRAY, 0)
 /** Emit a SSMFIELD array entry for a ring-0 or ring-3 pointer type that is only
  * of interest as a NULL indicator.
  *
  * This is always restored as a 0 (NULL) or 1 value.  When
  * SSMSTRUCT_FLAGS_DONT_IGNORE is set, the pointer will be saved in its
  * entirety, when clear it will be saved as a boolean. */
-#define SSMFIELD_ENTRY_HCPTR_NI(Type, Field)        SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_NI)
+#define SSMFIELD_ENTRY_HCPTR_NI(Type, Field)        SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_NI, 0)
 /** Same as SSMFIELD_ENTRY_HCPTR_NI, except it's an array of the buggers. */
-#define SSMFIELD_ENTRY_HCPTR_NI_ARRAY(Type, Field)  SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_NI_ARRAY)
+#define SSMFIELD_ENTRY_HCPTR_NI_ARRAY(Type, Field)  SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_NI_ARRAY, 0)
 /** Emit a SSMFIELD array entry for a ring-0 or ring-3 pointer type that has
  * been hacked such that it will never exceed 32-bit.  No sign extending. */
-#define SSMFIELD_ENTRY_HCPTR_HACK_U32(Type, Field)  SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_HACK_U32)
+#define SSMFIELD_ENTRY_HCPTR_HACK_U32(Type, Field)  SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_HCPTR_HACK_U32, 0)
 /** Emit a SSMFIELD array entry for loading a 32-bit field into a 64-bit
  * structure member, zero extending the value. */
-#define SSMFIELD_ENTRY_U32_ZX_U64(Type, Field)      SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_U32_ZX_U64)
+#define SSMFIELD_ENTRY_U32_ZX_U64(Type, Field)      SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_U32_ZX_U64, 0)
 
 /** Emit a SSMFIELD array entry for a field that can be ignored.
  * It is stored as zeros if SSMSTRUCT_FLAGS_DONT_IGNORE is specified to
  * SSMR3PutStructEx.  The member is never touched upon restore. */
-#define SSMFIELD_ENTRY_IGNORE(Type, Field)          SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGNORE)
+#define SSMFIELD_ENTRY_IGNORE(Type, Field)          SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGNORE, 0)
 /** Emit a SSMFIELD array entry for an ignorable RTGCPHYS type. */
-#define SSMFIELD_ENTRY_IGN_GCPHYS(Type, Field)      SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_GCPHYS)
+#define SSMFIELD_ENTRY_IGN_GCPHYS(Type, Field)      SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_GCPHYS, 0)
 /** Emit a SSMFIELD array entry for an ignorable RTGCPHYS type. */
-#define SSMFIELD_ENTRY_IGN_GCPTR(Type, Field)       SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_GCPTR)
+#define SSMFIELD_ENTRY_IGN_GCPTR(Type, Field)       SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_GCPTR, 0)
 /** Emit a SSMFIELD array entry for an ignorable raw-mode context pointer. */
-#define SSMFIELD_ENTRY_IGN_RCPTR(Type, Field)       SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_RCPTR)
+#define SSMFIELD_ENTRY_IGN_RCPTR(Type, Field)       SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_RCPTR, 0)
 /** Emit a SSMFIELD array entry for an ignorable ring-3 or/and ring-0 pointer. */
-#define SSMFIELD_ENTRY_IGN_HCPTR(Type, Field)       SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_HCPTR)
+#define SSMFIELD_ENTRY_IGN_HCPTR(Type, Field)       SSMFIELD_ENTRY_TF_INT(Type, Field, SSMFIELDTRANS_IGN_HCPTR, 0)
 
 /** Emit a SSMFIELD array entry for an old field that should be ignored now.
  * It is stored as zeros and skipped on load. */
@@ -334,13 +339,13 @@ typedef struct SSMFIELD
 # define SSMFIELD_ENTRY_PAD_HC_AUTO(cb32, cb64) \
     { \
         (PFNSSMFIELDGETPUT)(uintptr_t)(SSMFIELDTRANS_PAD_HC_AUTO), \
-        UINT32_MAX / 2,  (cb64 << 16) | (cb32) | ((cb64) << 8),  "<compiler-padding>" \
+        UINT32_MAX / 2,  (cb64 << 16) | (cb32) | ((cb64) << 8),  0, "<compiler-padding>" \
     }
 #else
 # define SSMFIELD_ENTRY_PAD_HC_AUTO(cb32, cb64) \
     { \
         (PFNSSMFIELDGETPUT)(uintptr_t)(SSMFIELDTRANS_PAD_HC_AUTO), \
-        UINT32_MAX / 2,  (cb32 << 16) | (cb32) | ((cb64) << 8),  "<compiler-padding>" \
+        UINT32_MAX / 2,  (cb32 << 16) | (cb32) | ((cb64) << 8),  0, "<compiler-padding>" \
     }
 #endif
 /** Emit a SSMFIELD array entry for an automatic compiler padding that is unique
@@ -350,21 +355,22 @@ typedef struct SSMFIELD
 # define SSMFIELD_ENTRY_PAD_MSC32_AUTO(cb) \
     { \
         (PFNSSMFIELDGETPUT)(uintptr_t)(SSMFIELDTRANS_PAD_MSC32_AUTO), \
-        UINT32_MAX / 2, ((cb) << 16) | (cb), "<msc32-padding>" \
+        UINT32_MAX / 2, ((cb) << 16) | (cb), 0, "<msc32-padding>" \
     }
 #else
 # define SSMFIELD_ENTRY_PAD_MSC32_AUTO(cb) \
     { \
         (PFNSSMFIELDGETPUT)(uintptr_t)(SSMFIELDTRANS_PAD_MSC32_AUTO), \
-        UINT32_MAX / 2, (cb), "<msc32-padding>" \
+        UINT32_MAX / 2, (cb), 0, "<msc32-padding>" \
     }
 #endif
 
 /** Emit a SSMFIELD array entry for a field with a custom callback. */
 #define SSMFIELD_ENTRY_CALLBACK(Type, Field, pfnGetPut) \
-    { (pfnGetPut), RT_OFFSETOF(Type, Field), RT_SIZEOFMEMB(Type, Field), #Type "::" #Field }
+    { (pfnGetPut), RT_OFFSETOF(Type, Field), RT_SIZEOFMEMB(Type, Field), 0, #Type "::" #Field }
 /** Emit the terminating entry of a SSMFIELD array. */
-#define SSMFIELD_ENTRY_TERM()               { (PFNSSMFIELDGETPUT)(uintptr_t)SSMFIELDTRANS_INVALID, UINT32_MAX, UINT32_MAX, NULL }
+#define SSMFIELD_ENTRY_TERM() \
+    { (PFNSSMFIELDGETPUT)(uintptr_t)SSMFIELDTRANS_INVALID, UINT32_MAX, UINT32_MAX, UINT32_MAX, NULL }
 
 
 /** @name SSMR3GetStructEx and SSMR3PutStructEx flags.
@@ -377,6 +383,11 @@ typedef struct SSMFIELD
 #define SSMSTRUCT_FLAGS_DONT_IGNORE         RT_BIT_32(2)
 /** Saved using SSMR3PutMem, don't be too strict. */
 #define SSMSTRUCT_FLAGS_SAVED_AS_MEM        RT_BIT_32(3)
+/** No introductory structure marker.  Use when splitting up structures.  */
+#define SSMSTRUCT_FLAGS_NO_LEAD_MARKER      RT_BIT_32(4)
+/** No trailing structure marker.  Use when splitting up structures.  */
+#define SSMSTRUCT_FLAGS_NO_TAIL_MARKER      RT_BIT_32(5)
+
 /** Band-aid for old SSMR3PutMem/SSMR3GetMem of structurs with host pointers.
  * @remarks This type is normally only used up to the first changes to the
  *          structures take place in order to make sure the conversion from
@@ -389,7 +400,7 @@ typedef struct SSMFIELD
 #define SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED (  SSMSTRUCT_FLAGS_DONT_IGNORE \
                                               | SSMSTRUCT_FLAGS_NO_MARKERS  | SSMSTRUCT_FLAGS_SAVED_AS_MEM)
 /** Mask of the valid bits. */
-#define SSMSTRUCT_FLAGS_VALID_MASK          UINT32_C(0x0000000f)
+#define SSMSTRUCT_FLAGS_VALID_MASK          UINT32_C(0x0000003f)
 /** @} */
 
 
@@ -1155,6 +1166,11 @@ SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t u
                     PFNSSMDRVLIVEPREP pfnLivePrep, PFNSSMDRVLIVEEXEC pfnLiveExec, PFNSSMDRVLIVEVOTE pfnLiveVote,
                     PFNSSMDRVSAVEPREP pfnSavePrep, PFNSSMDRVSAVEEXEC pfnSaveExec, PFNSSMDRVSAVEDONE pfnSaveDone,
                     PFNSSMDRVLOADPREP pfnLoadPrep, PFNSSMDRVLOADEXEC pfnLoadExec, PFNSSMDRVLOADDONE pfnLoadDone);
+VMMR3_INT_DECL(int)
+SSMR3RegisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
+                 PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
+                 PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
+                 PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone);
 VMMR3DECL(int)
 SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
                       PFNSSMINTLIVEPREP pfnLivePrep, PFNSSMINTLIVEEXEC pfnLiveExec, PFNSSMINTLIVEVOTE pfnLiveVote,
@@ -1168,6 +1184,7 @@ SSMR3RegisterExternal(PUVM pUVM, const char *pszName, uint32_t uInstance, uint32
 VMMR3DECL(int)          SSMR3RegisterStub(PVM pVM, const char *pszName, uint32_t uInstance);
 VMMR3_INT_DECL(int)     SSMR3DeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName, uint32_t uInstance);
 VMMR3_INT_DECL(int)     SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t uInstance);
+VMMR3_INT_DECL(int)     SSMR3DeregisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance);
 VMMR3DECL(int)          SSMR3DeregisterInternal(PVM pVM, const char *pszName);
 VMMR3DECL(int)          SSMR3DeregisterExternal(PVM pVM, const char *pszName);
 VMMR3DECL(int)          SSMR3Save(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamOps, void *pvStreamOpsUser, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser);
diff --git a/include/VBox/vmm/stam.h b/include/VBox/vmm/stam.h
index e7f2c55..dd24fa4 100644
--- a/include/VBox/vmm/stam.h
+++ b/include/VBox/vmm/stam.h
@@ -1097,7 +1097,6 @@ typedef const STAMRATIOU32 *PCSTAMRATIOU32;
 
 
 /** @defgroup grp_stam_r3   The STAM Host Context Ring 3 API
- * @ingroup grp_stam
  * @{
  */
 
diff --git a/include/VBox/vmm/tm.h b/include/VBox/vmm/tm.h
index 8dc5931..12a2aea 100644
--- a/include/VBox/vmm/tm.h
+++ b/include/VBox/vmm/tm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -124,6 +124,7 @@ VMM_INT_DECL(uint64_t)  TMVirtualToMilli(PVM pVM, uint64_t u64VirtualTicks);
 VMM_INT_DECL(uint64_t)  TMVirtualFromNano(PVM pVM, uint64_t u64NanoTS);
 VMM_INT_DECL(uint64_t)  TMVirtualFromMicro(PVM pVM, uint64_t u64MicroTS);
 VMM_INT_DECL(uint64_t)  TMVirtualFromMilli(PVM pVM, uint64_t u64MilliTS);
+VMM_INT_DECL(bool)      TMVirtualIsTicking(PVM pVM);
 /** @} */
 
 
@@ -132,12 +133,13 @@ VMM_INT_DECL(uint64_t)  TMVirtualFromMilli(PVM pVM, uint64_t u64MilliTS);
  */
 VMMDECL(uint64_t)       TMCpuTickGet(PVMCPU pVCpu);
 VMM_INT_DECL(uint64_t)  TMCpuTickGetNoCheck(PVMCPU pVCpu);
-VMM_INT_DECL(bool)      TMCpuTickCanUseRealTSC(PVMCPU pVCpu, uint64_t *poffRealTSC);
-VMM_INT_DECL(uint64_t)  TMCpuTickGetDeadlineAndTscOffset(PVMCPU pVCpu, bool *pfOffsettedTsc, uint64_t *poffRealTSC);
+VMM_INT_DECL(bool)      TMCpuTickCanUseRealTSC(PVM pVM, PVMCPU pVCpu, uint64_t *poffRealTSC, bool *pfParavirtTsc);
+VMM_INT_DECL(uint64_t)  TMCpuTickGetDeadlineAndTscOffset(PVM pVM, PVMCPU pVCpu, uint64_t *poffRealTSC, bool *pfOffsettedTsc, bool *pfParavirtTsc);
 VMM_INT_DECL(int)       TMCpuTickSet(PVM pVM, PVMCPU pVCpu, uint64_t u64Tick);
 VMM_INT_DECL(int)       TMCpuTickSetLastSeen(PVMCPU pVCpu, uint64_t u64LastSeenTick);
 VMM_INT_DECL(uint64_t)  TMCpuTickGetLastSeen(PVMCPU pVCpu);
 VMMDECL(uint64_t)       TMCpuTicksPerSecond(PVM pVM);
+VMM_INT_DECL(bool)      TMCpuTickIsTicking(PVMCPU pVCpu);
 /** @} */
 
 
@@ -239,13 +241,11 @@ VMMDECL(uint64_t)       TMTimerFromMilli(PTMTIMER pTimer, uint64_t cMilliSecs);
 VMMDECL(bool)           TMTimerPollBool(PVM pVM, PVMCPU pVCpu);
 VMM_INT_DECL(void)      TMTimerPollVoid(PVM pVM, PVMCPU pVCpu);
 VMM_INT_DECL(uint64_t)  TMTimerPollGIP(PVM pVM, PVMCPU pVCpu, uint64_t *pu64Delta);
-
 /** @} */
 
 
 #ifdef IN_RING3
 /** @defgroup grp_tm_r3     The TM Host Context Ring-3 API
- * @ingroup grp_tm
  * @{
  */
 VMM_INT_DECL(int)       TMR3Init(PVM pVM);
@@ -269,6 +269,10 @@ VMMR3DECL(int)          TMR3TimerSetCritSect(PTMTIMERR3 pTimer, PPDMCRITSECT pCr
 VMMR3DECL(void)         TMR3TimerQueuesDo(PVM pVM);
 VMMR3_INT_DECL(void)    TMR3VirtualSyncFF(PVM pVM, PVMCPU pVCpu);
 VMMR3_INT_DECL(PRTTIMESPEC) TMR3UtcNow(PVM pVM, PRTTIMESPEC pTime);
+
+VMMR3_INT_DECL(int)     TMR3CpuTickParavirtEnable(PVM pVM);
+VMMR3_INT_DECL(int)     TMR3CpuTickParavirtDisable(PVM pVM);
+VMMR3_INT_DECL(bool)    TMR3CpuTickIsFixedRateMonotonic(PVM pVM, bool fWithParavirtEnabled);
 /** @} */
 #endif /* IN_RING3 */
 
diff --git a/include/VBox/vmm/trpm.h b/include/VBox/vmm/trpm.h
index 7dc436c..03e9729 100644
--- a/include/VBox/vmm/trpm.h
+++ b/include/VBox/vmm/trpm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -92,7 +92,6 @@ VMMDECL(int)        TRPMRaiseXcptErrCR2(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86
 
 #ifdef IN_RING3
 /** @defgroup grp_trpm_r3   TRPM Host Context Ring 3 API
- * @ingroup grp_trpm
  * @{
  */
 VMMR3DECL(int)      TRPMR3Init(PVM pVM);
@@ -115,8 +114,7 @@ VMMR3DECL(RTRCPTR)  TRPMR3GetGuestTrapHandler(PVM pVM, unsigned iTrap);
 
 
 #ifdef IN_RC
-/** @defgroup grp_trpm_gc    The TRPM Guest Context API
- * @ingroup grp_trpm
+/** @defgroup grp_trpm_rc    The TRPM Raw-mode Context API
  * @{
  */
 
@@ -140,7 +138,6 @@ VMMRCDECL(void)     TRPMGCHyperReturnToHost(PVM pVM, int rc);
 
 #ifdef IN_RING0
 /** @defgroup grp_trpm_r0   TRPM Host Context Ring 0 API
- * @ingroup grp_trpm
  * @{
  */
 VMMR0DECL(void)     TRPMR0DispatchHostInterrupt(PVM pVM);
diff --git a/include/VBox/vmm/uvm.h b/include/VBox/vmm/uvm.h
index 3708775..b846734 100644
--- a/include/VBox/vmm/uvm.h
+++ b/include/VBox/vmm/uvm.h
@@ -142,7 +142,7 @@ typedef struct UVM
 #ifdef ___DBGFInternal_h
         struct DBGFUSERPERVM    s;
 #endif
-        uint8_t                 padding[256];
+        uint8_t                 padding[384];
     } dbgf;
 
     /** Per virtual CPU data. */
@@ -166,6 +166,14 @@ AssertCompileMemberAlignment(UVM, aCpus, 32);
                         ("a_pUVM=%p u32Magic=%#x\n", (a_pUVM), \
                          RT_VALID_ALIGNED_PTR(a_pUVM, PAGE_SIZE) ? (a_pUVM)->u32Magic : 0), \
                         (a_rc))
+/** @def UVM_ASSERT_VALID_EXT_RETURN
+ * Asserts a user mode VM handle is valid for external access.
+ */
+#define UVM_ASSERT_VALID_EXT_RETURN_VOID(a_pUVM) \
+        AssertMsgReturnVoid(    RT_VALID_ALIGNED_PTR(a_pUVM, PAGE_SIZE) \
+                            &&  (a_pUVM)->u32Magic == UVM_MAGIC, \
+                            ("a_pUVM=%p u32Magic=%#x\n", (a_pUVM), \
+                             RT_VALID_ALIGNED_PTR(a_pUVM, PAGE_SIZE) ? (a_pUVM)->u32Magic : 0))
 
 #endif
 
diff --git a/include/VBox/vmm/vm.h b/include/VBox/vmm/vm.h
index 3b6c9c5..9050e4a 100644
--- a/include/VBox/vmm/vm.h
+++ b/include/VBox/vmm/vm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -116,9 +116,12 @@ typedef struct VMCPU
     /** Which host CPU ID is this EMT running on.
      * Only valid when in RC or HMR0 with scheduling disabled. */
     RTCPUID volatile        idHostCpu;                              /* 56 / 36 */
+    /** The CPU set index corresponding to idHostCpu, UINT32_MAX if not valid.
+     * @remarks Best to make sure iHostCpuSet shares cache line with idHostCpu! */
+    uint32_t volatile       iHostCpuSet;                            /* 60 / 40 */
 
     /** Trace groups enable flags.  */
-    uint32_t                fTraceGroups;                           /* 60 / 40 */
+    uint32_t                fTraceGroups;                           /* 64 / 44 */
     /** Align the structures below bit on a 64-byte boundary and make sure it starts
      * at the same offset in both 64-bit and 32-bit builds.
      *
@@ -127,28 +130,19 @@ typedef struct VMCPU
      *          data could be lumped together at the end with a < 64 byte padding
      *          following it (to grow into and align the struct size).
      *   */
-    uint8_t                 abAlignment1[HC_ARCH_BITS == 64 ? 60 : 16+64];
+    uint8_t                 abAlignment1[HC_ARCH_BITS == 64 ? 56 : 12+64];
     /** State data for use by ad hoc profiling. */
     uint32_t                uAdHoc;
     /** Profiling samples for use by ad hoc profiling. */
     STAMPROFILEADV          aStatAdHoc[8];                          /* size: 40*8 = 320 */
 
-    /** CPUM part. */
-    union
-    {
-#ifdef ___CPUMInternal_h
-        struct CPUMCPU      s;
-#endif
-        uint8_t             padding[3584];      /* multiple of 64 */
-    } cpum;
-
     /** HM part. */
     union
     {
 #ifdef ___HMInternal_h
         struct HMCPU    s;
 #endif
-        uint8_t             padding[5568];      /* multiple of 64 */
+        uint8_t             padding[5760];      /* multiple of 64 */
     } hm;
 
     /** EM part. */
@@ -157,7 +151,7 @@ typedef struct VMCPU
 #ifdef ___EMInternal_h
         struct EMCPU        s;
 #endif
-        uint8_t             padding[1472];      /* multiple of 64 */
+        uint8_t             padding[1408];      /* multiple of 64 */
     } em;
 
     /** IEM part. */
@@ -224,8 +218,17 @@ typedef struct VMCPU
         uint8_t             padding[64];        /* multiple of 64 */
     } dbgf;
 
+    /** GIM part. */
+    union
+    {
+#ifdef ___GIMInternal_h
+        struct GIMCPU s;
+#endif
+        uint8_t             padding[64];      /* multiple of 64 */
+    } gim;
+
     /** Align the following members on page boundary. */
-    uint8_t                 abAlignment2[192];
+    uint8_t                 abAlignment2[3584];
 
     /** PGM part. */
     union
@@ -236,6 +239,15 @@ typedef struct VMCPU
         uint8_t             padding[4096];      /* multiple of 4096 */
     } pgm;
 
+    /** CPUM part. */
+    union
+    {
+#ifdef ___CPUMInternal_h
+        struct CPUMCPU      s;
+#endif
+        uint8_t             padding[4096];      /* multiple of 4096 */
+    } cpum;
+
 } VMCPU;
 
 
@@ -358,6 +370,8 @@ typedef struct VMCPU
 #define VMCPU_FF_INTERRUPT_SMI              RT_BIT_32(VMCPU_FF_INTERRUPT_SMI_BIT)
 /** PDM critical section unlocking is pending, process promptly upon return to R3. */
 #define VMCPU_FF_PDM_CRITSECT               RT_BIT_32(5)
+/** This action forces the VCPU out of the halted state. */
+#define VMCPU_FF_UNHALT                     RT_BIT_32(6)
 /** This action forces the VM to service pending requests from other
  * thread or requests which must be executed in another context. */
 #define VMCPU_FF_REQUEST                    RT_BIT_32(9)
@@ -395,6 +409,8 @@ typedef struct VMCPU
 #endif /* VBOX_WITH_RAW_MODE */
 /** Inhibit interrupts pending. See EMGetInhibitInterruptsPC(). */
 #define VMCPU_FF_INHIBIT_INTERRUPTS         RT_BIT_32(24)
+/** Block injection of non-maskable interrupts to the guest. */
+#define VMCPU_FF_BLOCK_NMIS                 RT_BIT_32(25)
 #ifdef VBOX_WITH_RAW_MODE
 /** CSAM needs to scan the page that's being executed */
 # define VMCPU_FF_CSAM_SCAN_PAGE            RT_BIT_32(26)
@@ -414,7 +430,8 @@ typedef struct VMCPU
                                                  | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_EMT_RENDEZVOUS)
 /** Externally forced VMCPU actions. Used to quit the idle/wait loop. */
 #define VMCPU_FF_EXTERNAL_HALTED_MASK           (  VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_REQUEST \
-                                                 | VMCPU_FF_INTERRUPT_NMI  | VMCPU_FF_INTERRUPT_SMI | VMCPU_FF_TIMER)
+                                                 | VMCPU_FF_INTERRUPT_NMI  | VMCPU_FF_INTERRUPT_SMI | VMCPU_FF_UNHALT \
+                                                 | VMCPU_FF_TIMER)
 
 /** High priority VM pre-execution actions. */
 #define VM_FF_HIGH_PRIORITY_PRE_MASK            (  VM_FF_CHECK_VM_STATE | VM_FF_DBGF | VM_FF_TM_VIRTUAL_SYNC \
@@ -451,7 +468,7 @@ typedef struct VMCPU
 #define VM_FF_NORMAL_PRIORITY_MASK              (  VM_FF_REQUEST | VM_FF_PDM_QUEUES | VM_FF_PDM_DMA | VM_FF_REM_HANDLER_NOTIFY \
                                                  | VM_FF_EMT_RENDEZVOUS)
 /** Normal priority VMCPU actions. */
-#define VMCPU_FF_NORMAL_PRIORITY_MASK           (VMCPU_FF_REQUEST)
+#define VMCPU_FF_NORMAL_PRIORITY_MASK           (VMCPU_FF_REQUEST | VMCPU_FF_UNHALT)
 
 /** Flags to clear before resuming guest execution. */
 #define VMCPU_FF_RESUME_GUEST_MASK              (VMCPU_FF_TO_R3)
@@ -655,10 +672,9 @@ typedef struct VMCPU
                                                       RTThreadNativeSelf(), (pVCpu) ? (pVCpu)->hNativeThreadR0 : 0, \
                                                       (pVCpu) ? (pVCpu)->idCpu : 0))
 #else
-# define VMCPU_ASSERT_EMT(pVCpu) \
-    AssertMsg(VMCPU_IS_EMT(pVCpu), \
-              ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd idCpu=%#x\n", \
-              RTThreadNativeSelf(), (pVCpu)->hNativeThread, (pVCpu)->idCpu))
+# define VMCPU_ASSERT_EMT(pVCpu)            AssertMsg(VMCPU_IS_EMT(pVCpu), \
+                                                      ("Not emulation thread! Thread=%RTnthrd ThreadEMT=%RTnthrd idCpu=%#x\n", \
+                                                      RTThreadNativeSelf(), (pVCpu)->hNativeThread, (pVCpu)->idCpu))
 #endif
 
 /** @def VM_ASSERT_EMT_RETURN
@@ -961,6 +977,18 @@ typedef struct VM
 #ifdef ___CPUMInternal_h
         struct CPUM s;
 #endif
+#ifdef ___VBox_vmm_cpum_h
+        /** Read only info exposed about the host and guest CPUs.   */
+        struct
+        {
+            /** Padding for hidden fields. */
+            uint8_t                 abHidden0[64];
+            /** Host CPU feature information. */
+            CPUMFEATURES            HostFeatures;
+            /** Guest CPU feature information. */
+            CPUMFEATURES            GuestFeatures;
+        } const ro;
+#endif
         uint8_t     padding[1536];      /* multiple of 64 */
     } cpum;
 
@@ -1108,6 +1136,14 @@ typedef struct VM
         uint8_t     padding[0x11100];   /* multiple of 64 */
     } rem;
 
+    union
+    {
+#ifdef ___GIMInternal_h
+        struct GIM s;
+#endif
+        uint8_t     padding[256];        /* multiple of 64 */
+    } gim;
+
     /* ---- begin small stuff ---- */
 
     /** VM part. */
@@ -1130,7 +1166,7 @@ typedef struct VM
 
 
     /** Padding for aligning the cpu array on a page boundary. */
-    uint8_t         abAlignment2[350];
+    uint8_t         abAlignment2[94];
 
     /* ---- end small stuff ---- */
 
diff --git a/include/VBox/vmm/vm.mac b/include/VBox/vmm/vm.mac
index 2a1be76..e8662d4 100644
--- a/include/VBox/vmm/vm.mac
+++ b/include/VBox/vmm/vm.mac
@@ -3,7 +3,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2013 Oracle Corporation
+; Copyright (C) 2006-2014 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -122,20 +122,19 @@ struc VMCPU
     .hNativeThread          RTR0PTR_RES 1
     .hNativeThreadR0        RTR0PTR_RES 1
     .idHostCpu              resd 1
+    .iHostCpuSet            resd 1
     .fTraceGroups           resd 1
 %if HC_ARCH_BITS == 32
-    .abAlignment1           resb 16+64
+    .abAlignment1           resb 12+64
 %else
-    .abAlignment1           resb 60
+    .abAlignment1           resb 56
 %endif
     .uAdHoc                 resd 1
     .aStatAdHoc             resb STAMPROFILEADV_size * 8
 
     alignb 64
-
-    .cpum                   resb 3584
-    .hm                     resb 5568
-    .em                     resb 1472
+    .hm                     resb 5760
+    .em                     resb 1408
     .iem                    resb 3072
     .trpm                   resb 128
     .tm                     resb 384
@@ -143,8 +142,13 @@ struc VMCPU
     .pdm                    resb 256
     .iom                    resb 512
     .dbgf                   resb 64
+    .gim                    resb 64
+
     alignb 4096
     .pgm                    resb 4096
+    alignb 4096
+    .cpum                   resb 4096
+    alignb 4096
 endstruc
 
 
diff --git a/include/VBox/vmm/vmcpuset.h b/include/VBox/vmm/vmcpuset.h
index 6a85daf..6f89409 100644
--- a/include/VBox/vmm/vmcpuset.h
+++ b/include/VBox/vmm/vmcpuset.h
@@ -105,7 +105,7 @@ DECLINLINE(int32_t) VMCpuSetFindLastPresentInternal(PCVMCPUSET pSet)
     return NIL_VMCPUID;
 }
 
-/** @ */
+/** @} */
 
 #endif
 
diff --git a/include/VBox/vmm/vmm.h b/include/VBox/vmm/vmm.h
index bd3cee0..20ccd04 100644
--- a/include/VBox/vmm/vmm.h
+++ b/include/VBox/vmm/vmm.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -267,11 +267,13 @@ VMM_INT_DECL(uint32_t)      VMMGetSvnRev(void);
 VMM_INT_DECL(VMMSWITCHER)   VMMGetSwitcher(PVM pVM);
 VMM_INT_DECL(bool)          VMMIsInRing3Call(PVMCPU pVCpu);
 VMM_INT_DECL(void)          VMMTrashVolatileXMMRegs(void);
+VMM_INT_DECL(int)           VMMPatchHypercall(PVM pVM, void *pvBuf, size_t cbBuf, size_t *pcbWritten);
+VMM_INT_DECL(void)          VMMHypercallsEnable(PVMCPU pVCpu);
+VMM_INT_DECL(void)          VMMHypercallsDisable(PVMCPU pVCpu);
 
 
-#ifdef IN_RING3
+#if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
 /** @defgroup grp_vmm_r3    The VMM Host Context Ring 3 API
- * @ingroup grp_vmm
  * @{
  */
 VMMR3_INT_DECL(int)     VMMR3Init(PVM pVM);
@@ -336,7 +338,6 @@ VMMR3_INT_DECL(int)     VMMR3ReadR0Stack(PVM pVM, VMCPUID idCpu, RTHCUINTPTR R0A
 
 
 /** @defgroup grp_vmm_r0    The VMM Host Context Ring 0 API
- * @ingroup grp_vmm
  * @{
  */
 
@@ -503,24 +504,22 @@ typedef struct GCFGMVALUEREQ
  */
 typedef GCFGMVALUEREQ *PGCFGMVALUEREQ;
 
-#ifdef IN_RING0
+#if defined(IN_RING0) || defined(DOXYGEN_RUNNING)
 VMMR0DECL(int)       VMMR0EntryInt(PVM pVM, VMMR0OPERATION enmOperation, void *pvArg);
 VMMR0DECL(void)      VMMR0EntryFast(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation);
 VMMR0DECL(int)       VMMR0EntryEx(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation, PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION);
-VMMR0DECL(int)       VMMR0TermVM(PVM pVM, PGVM pGVM);
+VMMR0_INT_DECL(int)  VMMR0TermVM(PVM pVM, PGVM pGVM);
 VMMR0_INT_DECL(bool) VMMR0IsLongJumpArmed(PVMCPU pVCpu);
 VMMR0_INT_DECL(bool) VMMR0IsInRing3LongJump(PVMCPU pVCpu);
-VMMR0DECL(int)       VMMR0ThreadCtxHooksCreate(PVMCPU pVCpu);
-VMMR0DECL(void)      VMMR0ThreadCtxHooksRelease(PVMCPU pVCpu);
-VMMR0DECL(bool)      VMMR0ThreadCtxHooksAreCreated(PVMCPU pVCpu);
-VMMR0DECL(int)       VMMR0ThreadCtxHooksRegister(PVMCPU pVCpu, PFNRTTHREADCTXHOOK pfnHook);
-VMMR0DECL(int)       VMMR0ThreadCtxHooksDeregister(PVMCPU pVCpu);
-VMMR0DECL(bool)      VMMR0ThreadCtxHooksAreRegistered(PVMCPU pVCpu);
+VMMR0_INT_DECL(int)  VMMR0ThreadCtxHookCreateForEmt(PVMCPU pVCpu);
+VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDestroyForEmt(PVMCPU pVCpu);
+VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDisable(PVMCPU pVCpu);
+VMMR0_INT_DECL(bool) VMMR0ThreadCtxHookIsEnabled(PVMCPU pVCpu);
 
 # ifdef LOG_ENABLED
-VMMR0DECL(void)      VMMR0LogFlushDisable(PVMCPU pVCpu);
-VMMR0DECL(void)      VMMR0LogFlushEnable(PVMCPU pVCpu);
-VMMR0DECL(bool)      VMMR0IsLogFlushDisabled(PVMCPU pVCpu);
+VMMR0_INT_DECL(void) VMMR0LogFlushDisable(PVMCPU pVCpu);
+VMMR0_INT_DECL(void) VMMR0LogFlushEnable(PVMCPU pVCpu);
+VMMR0_INT_DECL(bool) VMMR0IsLogFlushDisabled(PVMCPU pVCpu);
 # else
 #  define            VMMR0LogFlushDisable(pVCpu)     do { } while(0)
 #  define            VMMR0LogFlushEnable(pVCpu)      do { } while(0)
@@ -531,9 +530,8 @@ VMMR0DECL(bool)      VMMR0IsLogFlushDisabled(PVMCPU pVCpu);
 /** @} */
 
 
-#ifdef IN_RC
+#if defined(IN_RC) || defined(DOXYGEN_RUNNING)
 /** @defgroup grp_vmm_rc    The VMM Raw-Mode Context API
- * @ingroup grp_vmm
  * @{
  */
 VMMRCDECL(int)      VMMGCEntry(PVM pVM, unsigned uOperation, unsigned uArg, ...);
@@ -542,9 +540,8 @@ VMMRCDECL(void)     VMMGCLogFlushIfFull(PVM pVM);
 /** @} */
 #endif /* IN_RC */
 
-#if defined(IN_RC) || defined(IN_RING0)
+#if defined(IN_RC) || defined(IN_RING0) || defined(DOXYGEN_RUNNING)
 /** @defgroup grp_vmm_rz    The VMM Raw-Mode and Ring-0 Context API
- * @ingroup grp_vmm
  * @{
  */
 VMMRZDECL(int)      VMMRZCallRing3(PVM pVM, PVMCPU pVCpu, VMMCALLRING3 enmOperation, uint64_t uArg);
diff --git a/include/VBox/vscsi.h b/include/VBox/vscsi.h
index f3544cb..96249d2 100644
--- a/include/VBox/vscsi.h
+++ b/include/VBox/vscsi.h
@@ -86,6 +86,8 @@ typedef enum VSCSILUNTYPE
     VSCSILUNTYPE_SBC,
     /** CD/DVD drive (MMC) */
     VSCSILUNTYPE_MMC,
+    /** Tape drive (SSC) */
+    VSCSILUNTYPE_SSC,
     /** Last value to indicate an invalid device */
     VSCSILUNTYPE_LAST,
     /** 32bit hack */
diff --git a/include/VBox/vusb.h b/include/VBox/vusb.h
index a4a70d1..2fca4a7 100644
--- a/include/VBox/vusb.h
+++ b/include/VBox/vusb.h
@@ -57,6 +57,9 @@ RT_C_DECLS_BEGIN
 #define VUSB_DT_OTHER_SPEED_CFG         0x07
 #define VUSB_DT_INTERFACE_POWER         0x08
 #define VUSB_DT_INTERFACE_ASSOCIATION   0x0B
+#define VUSB_DT_BOS                     0x0F
+#define VUSB_DT_DEVICE_CAPABILITY       0x10
+#define VUSB_DT_SS_ENDPOINT_COMPANION   0x30
 /** @} */
 
 /** @name USB Descriptor minimum sizes (from spec)
@@ -66,6 +69,15 @@ RT_C_DECLS_BEGIN
 #define VUSB_DT_CONFIG_STRING_MIN_LEN   2
 #define VUSB_DT_INTERFACE_MIN_LEN       9
 #define VUSB_DT_ENDPOINT_MIN_LEN        7
+#define VUSB_DT_SSEP_COMPANION_MIN_LEN  6
+/** @} */
+
+/** @name USB Device Capability Type Codes (from spec)
+ * @{ */
+#define VUSB_DCT_WIRELESS_USB           0x01
+#define VUSB_DCT_USB_20_EXTENSION       0x02
+#define VUSB_DCT_SUPERSPEED_USB         0x03
+#define VUSB_DCT_CONTAINER_ID           0x04
 /** @} */
 
 
@@ -199,7 +211,7 @@ typedef struct VUSBDESCINTERFACE
     uint8_t  bInterfaceProtocol;
     uint8_t  iInterface;
 } VUSBDESCINTERFACE;
-/** Pointer to an USB interface descriptor. */
+/** Pointer to a USB interface descriptor. */
 typedef VUSBDESCINTERFACE *PVUSBDESCINTERFACE;
 /** Pointer to a const USB interface descriptor. */
 typedef const VUSBDESCINTERFACE *PCVUSBDESCINTERFACE;
@@ -217,11 +229,97 @@ typedef struct VUSBDESCENDPOINT
     uint16_t wMaxPacketSize;
     uint8_t  bInterval;
 } VUSBDESCENDPOINT;
-/** Pointer to an USB endpoint descriptor. */
+/** Pointer to a USB endpoint descriptor. */
 typedef VUSBDESCENDPOINT *PVUSBDESCENDPOINT;
 /** Pointer to a const USB endpoint descriptor. */
 typedef const VUSBDESCENDPOINT *PCVUSBDESCENDPOINT;
 
+
+/**
+ * USB SuperSpeed endpoint companion descriptor (from USB3 spec)
+ */
+typedef struct VUSBDESCSSEPCOMPANION
+{
+    uint8_t  bLength;
+    uint8_t  bDescriptorType;
+    uint8_t  bMaxBurst;
+    uint8_t  bmAttributes;
+    uint16_t wBytesPerInterval;
+} VUSBDESCSSEPCOMPANION;
+/** Pointer to a USB endpoint companion descriptor. */
+typedef VUSBDESCSSEPCOMPANION *PVUSBDESCSSEPCOMPANION;
+/** Pointer to a const USB endpoint companion descriptor. */
+typedef const VUSBDESCSSEPCOMPANION *PCVUSBDESCSSEPCOMPANION;
+
+
+/**
+ * USB Binary Device Object Store, aka BOS (from USB3 spec)
+ */
+typedef struct VUSBDESCBOS
+{
+    uint8_t  bLength;
+    uint8_t  bDescriptorType;
+    uint16_t wTotalLength;
+    uint8_t  bNumDeviceCaps;
+} VUSBDESCBOS;
+/** Pointer to a USB BOS descriptor. */
+typedef VUSBDESCBOS *PVUSBDESCBOS;
+/** Pointer to a const USB BOS descriptor. */
+typedef const VUSBDESCBOS *PCVUSBDESCBOS;
+
+
+/**
+ * Generic USB Device Capability Descriptor within BOS (from USB3 spec)
+ */
+typedef struct VUSBDESCDEVICECAP
+{
+    uint8_t  bLength;
+    uint8_t  bDescriptorType;
+    uint8_t  bDevCapabilityType;
+    uint8_t  aCapSpecific[1];
+} VUSBDESCDEVICECAP;
+/** Pointer to a USB device capability descriptor. */
+typedef VUSBDESCDEVICECAP *PVUSBDESCDEVICECAP;
+/** Pointer to a const USB device capability descriptor. */
+typedef const VUSBDESCDEVICECAP *PCVUSBDESCDEVICECAP;
+
+
+/**
+ * SuperSpeed USB Device Capability Descriptor within BOS
+ */
+typedef struct VUSBDESCSSDEVCAP
+{
+    uint8_t  bLength;
+    uint8_t  bDescriptorType;       /* DEVICE CAPABILITY */
+    uint8_t  bDevCapabilityType;    /* SUPERSPEED_USB */
+    uint8_t  bmAttributes;
+    uint16_t wSpeedsSupported;
+    uint8_t  bFunctionalitySupport;
+    uint8_t  bU1DevExitLat;
+    uint16_t wU2DevExitLat;
+} VUSBDESCSSDEVCAP;
+/** Pointer to an SS USB device capability descriptor. */
+typedef VUSBDESCSSDEVCAP *PVUSBDESCSSDEVCAP;
+/** Pointer to a const SS USB device capability descriptor. */
+typedef const VUSBDESCSSDEVCAP *PCVUSBDESCSSDEVCAP;
+
+
+/**
+ * USB 2.0 Extension Descriptor within BOS
+ */
+typedef struct VUSBDESCUSB2EXT
+{
+    uint8_t  bLength;
+    uint8_t  bDescriptorType;       /* DEVICE CAPABILITY */
+    uint8_t  bDevCapabilityType;    /* USB 2.0 EXTENSION */
+    uint8_t  bmAttributes;
+} VUSBDESCUSB2EXT;
+/** Pointer to a USB 2.0 extension capability descriptor. */
+typedef VUSBDESCUSB2EXT *PVUSBDESCUSB2EXT;
+/** Pointer to a const USB 2.0 extension capability descriptor. */
+typedef const VUSBDESCUSB2EXT *PCVUSBDESCUSB2EXT;
+
+
 #pragma pack() /* end of the byte packing. */
 
 
@@ -301,10 +399,15 @@ typedef struct VUSBDESCENDPOINTEX
     VUSBDESCENDPOINT Core;
     /** Pointer to additional descriptor bytes following what's covered by VUSBDESCENDPOINT. */
     const void *pvMore;
-    /** Pointer to additional class- or vendor-specific interface descriptors. */
+    /** Pointer to additional class- or vendor-specific endpoint descriptors. */
     const void *pvClass;
     /** Size of class- or vendor-specific descriptors. */
     uint16_t cbClass;
+    /** Pointer to SuperSpeed endpoint companion descriptor (SS endpoints only). */
+    const void *pvSsepc;
+    /** Size of SuperSpeed endpoint companion descriptor.
+     * @remark Must be non-zero for SuperSpeed endpoints. */
+    uint16_t cbSsepc;
 } VUSBDESCENDPOINTEX;
 /** Pointer to a parsed USB endpoint descriptor. */
 typedef VUSBDESCENDPOINTEX *PVUSBDESCENDPOINTEX;
@@ -377,8 +480,51 @@ typedef const VUSBSETUP *PCVUSBSETUP;
 #define VUSB_STDVER_11              RT_BIT(1)
 /** Indicates USB 2.0 support. */
 #define VUSB_STDVER_20              RT_BIT(2)
+/** Indicates USB 3.0 support. */
+#define VUSB_STDVER_30              RT_BIT(3)
 /** @} */
 
+/**
+ * USB port/device speeds.
+ */
+typedef enum VUSBSPEED
+{
+    /** Undetermined/unknown speed. */
+    VUSB_SPEED_UNKNOWN = 0,
+    /** Low-speed (LS), 1.5 Mbit/s, USB 1.0. */
+    VUSB_SPEED_LOW,
+    /** Full-speed (FS), 12 Mbit/s, USB 1.1. */
+    VUSB_SPEED_FULL,
+    /** High-speed (HS), 480 Mbit/s, USB 2.0. */
+    VUSB_SPEED_HIGH,
+    /** Variable speed, wireless USB 2.5. */
+    VUSB_SPEED_VARIABLE,
+    /** SuperSpeed (SS), 5.0 Gbit/s, USB 3.0. */
+    VUSB_SPEED_SUPER,
+    /** SuperSpeed+ (SS+), 10.0 Gbit/s, USB 3.1. */
+    VUSB_SPEED_SUPERPLUS,
+    /** The usual 32-bit hack. */
+    VUSB_SPEED_32BIT_HACK = 0x7fffffff
+} VUSBSPEED;
+
+/**
+ * VUSB transfer direction.
+ */
+typedef enum VUSBDIRECTION
+{
+    /** Setup */
+    VUSBDIRECTION_SETUP = 0,
+#define VUSB_DIRECTION_SETUP    VUSBDIRECTION_SETUP
+    /** In - Device to host. */
+    VUSBDIRECTION_IN = 1,
+#define VUSB_DIRECTION_IN       VUSBDIRECTION_IN
+    /** Out - Host to device. */
+    VUSBDIRECTION_OUT = 2,
+#define VUSB_DIRECTION_OUT  VUSBDIRECTION_OUT
+    /** Invalid direction */
+    VUSBDIRECTION_INVALID = 0x7f
+} VUSBDIRECTION;
+
 
 /** Pointer to a VBox USB device interface. */
 typedef struct VUSBIDEVICE      *PVUSBIDEVICE;
@@ -486,7 +632,6 @@ typedef struct VUSBIROOTHUBPORT
 /** VUSBIROOTHUBPORT interface ID. */
 #define VUSBIROOTHUBPORT_IID                    "e38e2978-7aa2-4860-94b6-9ef4a066d8a0"
 
-
 /** Pointer to a VUSB RootHub connector interface. */
 typedef struct VUSBIROOTHUBCONNECTOR *PVUSBIROOTHUBCONNECTOR;
 /**
@@ -559,6 +704,18 @@ typedef struct VUSBIROOTHUBCONNECTOR
     DECLR3CALLBACKMEMBER(void, pfnCancelAllUrbs,(PVUSBIROOTHUBCONNECTOR pInterface));
 
     /**
+     * Cancels and completes - with CRC failure - all URBs queued on an endpoint.
+     * This is done in response to a guest endpoint/pipe abort.
+     *
+     * @returns VBox status code.
+     * @param   pInterface  Pointer to this struct.
+     * @param   pDevice     Pointer to a USB device.
+     * @param   EndPt       Endpoint number.
+     * @param   enmDir      Endpoint direction.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnAbortEp,(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice, int EndPt, VUSBDIRECTION enmDir));
+
+    /**
      * Attach the device to the root hub.
      * The device must not be attached to any hub for this call to succeed.
      *
@@ -578,9 +735,12 @@ typedef struct VUSBIROOTHUBCONNECTOR
      */
     DECLR3CALLBACKMEMBER(int, pfnDetachDevice,(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice));
 
+    /** Alignment dummy. */
+    RTR3PTR Alignment;
+
 } VUSBIROOTHUBCONNECTOR;
 /** VUSBIROOTHUBCONNECTOR interface ID. */
-#define VUSBIROOTHUBCONNECTOR_IID               "d9a90c59-e3ff-4dff-9754-844557c3f7a0"
+#define VUSBIROOTHUBCONNECTOR_IID               "d9a90c59-e3ff-4dff-9754-844557c3f7a1"
 
 
 #ifdef IN_RING3
@@ -708,7 +868,7 @@ typedef enum VUSBDEVICESTATE
      * Next states: VUSB_DEVICE_STATE_DEFAULT, VUSB_DEVICE_STATE_DESTROYED
      */
     VUSB_DEVICE_STATE_RESET,
-    /** The device has been destroy. */
+    /** The device has been destroyed. */
     VUSB_DEVICE_STATE_DESTROYED,
     /** The usual 32-bit hack. */
     VUSB_DEVICE_STATE_32BIT_HACK = 0x7fffffff
@@ -774,9 +934,26 @@ typedef struct VUSBIDEVICE
      */
     DECLR3CALLBACKMEMBER(VUSBDEVICESTATE, pfnGetState,(PVUSBIDEVICE pInterface));
 
+    /**
+     * Returns whether the device is completely emulated.
+     *
+     * @returns true if the device is fully emulated and doesn't pass through
+     *          a host device, false otherwise.
+     * @param   pInterface      Pointer to the device interface structure.
+     */
+    DECLR3CALLBACKMEMBER(bool, pfnIsEmulated,(PVUSBIDEVICE pInterface));
+
+    /**
+     * Get the speed the device is operating at.
+     *
+     * @returns Device state.
+     * @param   pInterface      Pointer to the device interface structure.
+     */
+    DECLR3CALLBACKMEMBER(VUSBSPEED, pfnGetSpeed,(PVUSBIDEVICE pInterface));
+
 } VUSBIDEVICE;
 /** VUSBIDEVICE interface ID. */
-#define VUSBIDEVICE_IID                         "88732dd3-0ccd-4625-b040-48804ac7a217"
+#define VUSBIDEVICE_IID                         "f3facb2b-edd3-4b5b-b07e-2cc4d52a471e"
 
 
 #ifdef IN_RING3
@@ -842,6 +1019,18 @@ DECLINLINE(VUSBDEVICESTATE) VUSBIDevGetState(PVUSBIDEVICE pInterface)
 {
     return pInterface->pfnGetState(pInterface);
 }
+
+/**
+ * Returns whether the device is completely emulated.
+ *
+ * @returns true if the device is fully emulated and doesn't pass through
+ *          a host device, false otherwise.
+ * @param   pInterface      Pointer to the device interface structure.
+ */
+DECLINLINE(bool) VUSBIDevIsEmulated(PVUSBIDEVICE pInterface)
+{
+    return pInterface->pfnIsEmulated(pInterface);
+}
 #endif /* IN_RING3 */
 
 #endif /* ! RDESKTOP */
@@ -896,24 +1085,6 @@ typedef enum VUSBXFERTYPE
 
 
 /**
- * VUSB transfer direction.
- */
-typedef enum VUSBDIRECTION
-{
-    /** Setup */
-    VUSBDIRECTION_SETUP = 0,
-#define VUSB_DIRECTION_SETUP    VUSBDIRECTION_SETUP
-    /** In - Device to host. */
-    VUSBDIRECTION_IN = 1,
-#define VUSB_DIRECTION_IN       VUSBDIRECTION_IN
-    /** Out - Host to device. */
-    VUSBDIRECTION_OUT = 2,
-#define VUSB_DIRECTION_OUT  VUSBDIRECTION_OUT
-    /** Invalid direction */
-    VUSBDIRECTION_INVALID = 0x7f
-} VUSBDIRECTION;
-
-/**
  * The URB states
  */
 typedef enum VUSBURBSTATE
diff --git a/include/iprt/alloca.h b/include/iprt/alloca.h
index c47771c..404f95e 100644
--- a/include/iprt/alloca.h
+++ b/include/iprt/alloca.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -47,7 +47,7 @@
 # if !defined(RT_OS_DARWIN) && !defined(RT_OS_FREEBSD)
 #  include <malloc.h>
 # endif
-# ifdef RT_OS_SOLARIS
+# if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX)
 #  include <alloca.h>
 # endif
 #endif
diff --git a/include/iprt/asm-amd64-x86.h b/include/iprt/asm-amd64-x86.h
index fa77cb2..5d172b6 100644
--- a/include/iprt/asm-amd64-x86.h
+++ b/include/iprt/asm-amd64-x86.h
@@ -27,6 +27,7 @@
 #define ___iprt_asm_amd64_x86_h
 
 #include <iprt/types.h>
+#include <iprt/assert.h>
 #if !defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86)
 # error "Not on AMD64 or x86"
 #endif
@@ -71,6 +72,7 @@
 # if RT_INLINE_ASM_USES_INTRIN >= 15
 #  pragma intrinsic(__readeflags)
 #  pragma intrinsic(__writeeflags)
+#  pragma intrinsic(__rdtscp)
 # endif
 #endif
 
@@ -81,7 +83,8 @@
  * @{
  */
 
-/** @todo find a more proper place for this structure? */
+/** @todo find a more proper place for these structures? */
+
 #pragma pack(1)
 /** IDTR */
 typedef struct RTIDTR
@@ -94,6 +97,30 @@ typedef struct RTIDTR
 #pragma pack()
 
 #pragma pack(1)
+/** @internal */
+typedef struct RTIDTRALIGNEDINT
+{
+    /** Alignment padding.   */
+    uint8_t     au16Padding[ARCH_BITS == 64 ? 3 : 1];
+    /** The IDTR structure.  */
+    RTIDTR      Idtr;
+} RTIDTRALIGNEDINT;
+#pragma pack()
+
+/** Wrapped RTIDTR for preventing misalignment exceptions. */
+typedef union RTIDTRALIGNED
+{
+    /** Try make sure this structure has optimal alignment. */
+    uint64_t            auAlignmentHack[ARCH_BITS == 64 ? 2 : 1];
+    /** Aligned structure. */
+    RTIDTRALIGNEDINT    s;
+} RTIDTRALIGNED;
+AssertCompileSize(RTIDTRALIGNED, ARCH_BITS * 2 / 8);
+/** Pointer to a an RTIDTR alignment wrapper. */
+typedef RTIDTRALIGNED *PRIDTRALIGNED;
+
+
+#pragma pack(1)
 /** GDTR */
 typedef struct RTGDTR
 {
@@ -104,6 +131,29 @@ typedef struct RTGDTR
 } RTGDTR, *PRTGDTR;
 #pragma pack()
 
+#pragma pack(1)
+/** @internal */
+typedef struct RTGDTRALIGNEDINT
+{
+    /** Alignment padding.   */
+    uint8_t     au16Padding[ARCH_BITS == 64 ? 3 : 1];
+    /** The GDTR structure.  */
+    RTGDTR      Gdtr;
+} RTGDTRALIGNEDINT;
+#pragma pack()
+
+/** Wrapped RTGDTR for preventing misalignment exceptions. */
+typedef union RTGDTRALIGNED
+{
+    /** Try make sure this structure has optimal alignment. */
+    uint64_t            auAlignmentHack[ARCH_BITS == 64 ? 2 : 1];
+    /** Aligned structure. */
+    RTGDTRALIGNEDINT    s;
+} RTGDTRALIGNED;
+AssertCompileSize(RTGDTRALIGNED, ARCH_BITS * 2 / 8);
+/** Pointer to a an RTGDTR alignment wrapper. */
+typedef RTGDTRALIGNED *PRGDTRALIGNED;
+
 
 /**
  * Gets the content of the IDTR CPU register.
@@ -133,6 +183,29 @@ DECLINLINE(void) ASMGetIDTR(PRTIDTR pIdtr)
 
 
 /**
+ * Gets the content of the IDTR.LIMIT CPU register.
+ * @returns IDTR limit.
+ */
+#if RT_INLINE_ASM_EXTERNAL
+DECLASM(uint16_t) ASMGetIdtrLimit(void);
+#else
+DECLINLINE(uint16_t) ASMGetIdtrLimit(void)
+{
+    RTIDTRALIGNED TmpIdtr;
+# if RT_INLINE_ASM_GNU_STYLE
+    __asm__ __volatile__("sidt %0" : "=m" (TmpIdtr.s.Idtr));
+# else
+    __asm
+    {
+        sidt    [TmpIdtr.s.Idtr]
+    }
+# endif
+    return TmpIdtr.s.Idtr.cbIdt;
+}
+#endif
+
+
+/**
  * Sets the content of the IDTR CPU register.
  * @param   pIdtr   Where to load the IDTR contents from
  */
@@ -185,6 +258,35 @@ DECLINLINE(void) ASMGetGDTR(PRTGDTR pGdtr)
 }
 #endif
 
+
+/**
+ * Sets the content of the GDTR CPU register.
+ * @param   pIdtr   Where to load the GDTR contents from
+ */
+#if RT_INLINE_ASM_EXTERNAL
+DECLASM(void) ASMSetGDTR(const RTGDTR *pGdtr);
+#else
+DECLINLINE(void) ASMSetGDTR(const RTGDTR *pGdtr)
+{
+# if RT_INLINE_ASM_GNU_STYLE
+    __asm__ __volatile__("lgdt %0" : : "m" (*pGdtr));
+# else
+    __asm
+    {
+#  ifdef RT_ARCH_AMD64
+        mov     rax, [pGdtr]
+        lgdt    [rax]
+#  else
+        mov     eax, [pGdtr]
+        lgdt    [eax]
+#  endif
+    }
+# endif
+}
+#endif
+
+
+
 /**
  * Get the cs register.
  * @returns cs.
@@ -380,11 +482,11 @@ DECLINLINE(RTSEL) ASMGetLDTR(void)
 /**
  * Get the access rights for the segment selector.
  *
- * @returns The access rights on success or ~0U on failure.
+ * @returns The access rights on success or UINT32_MAX on failure.
  * @param   uSel        The selector value.
  *
- * @remarks Using ~0U for failure is chosen because valid access rights always
- *          have bits 0:7 as 0 (on both Intel & AMD).
+ * @remarks Using UINT32_MAX for failure is chosen because valid access rights
+ *          always have bits 0:7 as 0 (on both Intel & AMD).
  */
 #if RT_INLINE_ASM_EXTERNAL
 DECLASM(uint32_t) ASMGetSegAttr(uint32_t uSel);
@@ -525,6 +627,42 @@ DECLINLINE(uint64_t) ASMReadTSC(void)
 
 
 /**
+ * Gets the content of the CPU timestamp counter register and the
+ * assoicated AUX value.
+ *
+ * @returns TSC.
+ * @param   puAux   Where to store the AUX value.
+ */
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15
+DECLASM(uint64_t) ASMReadTscWithAux(uint32_t *puAux);
+#else
+DECLINLINE(uint64_t) ASMReadTscWithAux(uint32_t *puAux)
+{
+    RTUINT64U u;
+# if RT_INLINE_ASM_GNU_STYLE
+    /* rdtscp is not supported by ancient linux build VM of course :-( */
+    /*__asm__ __volatile__("rdtscp\n\t" : "=a" (u.s.Lo), "=d" (u.s.Hi), "=c" (*puAux)); */
+    __asm__ __volatile__(".byte 0x0f,0x01,0xf9\n\t" : "=a" (u.s.Lo), "=d" (u.s.Hi), "=c" (*puAux));
+# else
+#  if RT_INLINE_ASM_USES_INTRIN >= 15
+    u.u = __rdtscp(puAux);
+#  else
+    __asm
+    {
+        rdtscp
+        mov     [u.s.Lo], eax
+        mov     [u.s.Hi], edx
+        mov     eax, [puAux]
+        mov     [eax], ecx
+    }
+#  endif
+# endif
+    return u.u;
+}
+#endif
+
+
+/**
  * Performs the cpuid instruction returning all registers.
  *
  * @param   uOperator   CPUID operation (eax).
@@ -1588,6 +1726,34 @@ DECLINLINE(RTCCUINTREG) ASMGetCR8(void)
 
 
 /**
+ * Get XCR0 (eXtended feature Control Register 0).
+ * @returns xcr0.
+ */
+DECLASM(uint64_t) ASMGetXcr0(void);
+
+/**
+ * Sets the XCR0 register.
+ * @param   uXcr0   The new XCR0 value.
+ */
+DECLASM(void) ASMSetXcr0(uint64_t uXcr0);
+
+struct X86XSAVEAREA;
+/**
+ * Save extended CPU state.
+ * @param   pXStateArea     Where to save the state.
+ * @param   fComponents     Which state components to save.
+ */
+DECLASM(void) ASMXSave(struct X86XSAVEAREA *pXStateArea, uint64_t fComponents);
+
+/**
+ * Loads extended CPU state.
+ * @param   pXStateArea     Where to load the state from.
+ * @param   fComponents     Which state components to load.
+ */
+DECLASM(void) ASMXRstor(struct X86XSAVEAREA const *pXStateArea, uint64_t fComponents);
+
+
+/**
  * Enables interrupts (EFLAGS.IF).
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
@@ -1666,7 +1832,7 @@ DECLINLINE(RTCCUINTREG) ASMIntDisableFlags(void)
  *
  * @returns true / false.
  */
-DECLINLINE(RTCCUINTREG) ASMIntAreEnabled(void)
+DECLINLINE(bool) ASMIntAreEnabled(void)
 {
     RTCCUINTREG uFlags = ASMGetFlags();
     return uFlags & 0x200 /* X86_EFL_IF */ ? true : false;
diff --git a/include/iprt/asm-math.h b/include/iprt/asm-math.h
index 3818646..a83e9f0 100644
--- a/include/iprt/asm-math.h
+++ b/include/iprt/asm-math.h
@@ -321,10 +321,45 @@ DECLINLINE(int32_t) ASMModS64ByS32RetS32(int64_t i64, int32_t i32)
 
 
 /**
+ * Multiple a 32-bit by a 32-bit integer and divide the result by a 32-bit integer
+ * using a 64 bit intermediate result.
+ *
+ * @returns (u32A * u32B) / u32C.
+ * @param   u32A    The 32-bit value (A).
+ * @param   u32B    The 32-bit value to multiple by A.
+ * @param   u32C    The 32-bit value to divide A*B by.
+ *
+ * @remarks Architecture specific.
+ * @remarks Make sure the result won't ever exceed 32-bit, because hardware
+ *          exception may be raised if it does.
+ * @remarks On x86 this may be used to avoid dragging in 64-bit builtin
+ *          arithmetics functions.
+ */
+#if RT_INLINE_ASM_EXTERNAL && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
+DECLASM(uint32_t) ASMMultU32ByU32DivByU32(uint32_t u32A, uint32_t u32B, uint32_t u32C);
+#else
+DECLINLINE(uint32_t) ASMMultU32ByU32DivByU32(uint32_t u32A, uint32_t u32B, uint32_t u32C)
+{
+# if RT_INLINE_ASM_GNU_STYLE && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
+    uint32_t u32Result, u32Spill;
+    __asm__ __volatile__("mull %2\n\t"
+                         "divl %3\n\t"
+                         : "=&a" (u32Result),
+                           "=&d" (u32Spill)
+                         : "r" (u32B),
+                           "r" (u32C),
+                           "0" (u32A));
+    return u32Result;
+# else
+    return (uint32_t)(((uint64_t)u32A * u32B) / u32C);
+# endif
+}
+#endif
+
+
+/**
  * Multiple a 64-bit by a 32-bit integer and divide the result by a 32-bit integer
  * using a 96 bit intermediate result.
- * @note    Don't use 64-bit C arithmetic here since some gcc compilers generate references to
- *          __udivdi3 and __umoddi3 even if this inline function is not used.
  *
  * @returns (u64A * u32B) / u32C.
  * @param   u64A    The 64-bit value.
@@ -332,6 +367,10 @@ DECLINLINE(int32_t) ASMModS64ByS32RetS32(int64_t i64, int32_t i32)
  * @param   u32C    The 32-bit value to divide A*B by.
  *
  * @remarks Architecture specific.
+ * @remarks Make sure the result won't ever exceed 64-bit, because hardware
+ *          exception may be raised if it does.
+ * @remarks On x86 this may be used to avoid dragging in 64-bit builtin
+ *          arithmetics function.
  */
 #if RT_INLINE_ASM_EXTERNAL || !defined(__GNUC__) || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
 DECLASM(uint64_t) ASMMultU64ByU32DivByU32(uint64_t u64A, uint32_t u32B, uint32_t u32C);
@@ -343,12 +382,11 @@ DECLINLINE(uint64_t) ASMMultU64ByU32DivByU32(uint64_t u64A, uint32_t u32B, uint3
     uint64_t u64Result, u64Spill;
     __asm__ __volatile__("mulq %2\n\t"
                          "divq %3\n\t"
-                         : "=a" (u64Result),
-                           "=d" (u64Spill)
+                         : "=&a" (u64Result),
+                           "=&d" (u64Spill)
                          : "r" ((uint64_t)u32B),
                            "r" ((uint64_t)u32C),
-                           "0" (u64A),
-                           "1" (0));
+                           "0" (u64A));
     return u64Result;
 #  else
     uint32_t u32Dummy;
diff --git a/include/iprt/asm.h b/include/iprt/asm.h
index 11c61af..c0e52c1 100644
--- a/include/iprt/asm.h
+++ b/include/iprt/asm.h
@@ -141,11 +141,15 @@
  * when in PIC mode on x86.
  */
 #ifndef RT_INLINE_DONT_MIX_CMPXCHG8B_AND_PIC
-# define RT_INLINE_DONT_MIX_CMPXCHG8B_AND_PIC \
+# ifdef DOXYGEN_RUNNING
+#  define RT_INLINE_DONT_MIX_CMPXCHG8B_AND_PIC 1
+# else
+#  define RT_INLINE_DONT_MIX_CMPXCHG8B_AND_PIC \
     (   (defined(PIC) || defined(__PIC__)) \
      && defined(RT_ARCH_X86) \
      && (   RT_INLINE_ASM_GCC_4_3_X_X86 \
          || defined(RT_OS_DARWIN)) )
+# endif
 #endif
 
 
@@ -1638,8 +1642,9 @@ DECLINLINE(uint64_t) ASMAtomicReadU64(volatile uint64_t *pu64)
  *                  The memory pointed to must be writable.
  * @remark  This will fault if the memory is read-only!
  */
-#if (RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN) \
- || RT_INLINE_DONT_MIX_CMPXCHG8B_AND_PIC
+#if !defined(RT_ARCH_AMD64) \
+  && (   (RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN) \
+      || RT_INLINE_DONT_MIX_CMPXCHG8B_AND_PIC)
 DECLASM(uint64_t) ASMAtomicUoReadU64(volatile uint64_t *pu64);
 #else
 DECLINLINE(uint64_t) ASMAtomicUoReadU64(volatile uint64_t *pu64)
@@ -3265,6 +3270,83 @@ DECLINLINE(void) ASMAtomicUoAndS64(int64_t volatile *pi64, int64_t i64)
 }
 
 
+/**
+ * Atomically increment an unsigned 32-bit value, unordered.
+ *
+ * @returns the new value.
+ * @param   pu32   Pointer to the variable to increment.
+ */
+#if RT_INLINE_ASM_EXTERNAL
+DECLASM(uint32_t) ASMAtomicUoIncU32(uint32_t volatile *pu32);
+#else
+DECLINLINE(uint32_t) ASMAtomicUoIncU32(uint32_t volatile *pu32)
+{
+    uint32_t u32;
+# if RT_INLINE_ASM_GNU_STYLE
+    __asm__ __volatile__("xaddl %0, %1\n\t"
+                         : "=r" (u32),
+                           "=m" (*pu32)
+                         : "0" (1),
+                           "m" (*pu32)
+                         : "memory");
+    return u32 + 1;
+# else
+    __asm
+    {
+        mov     eax, 1
+#  ifdef RT_ARCH_AMD64
+        mov     rdx, [pu32]
+        xadd    [rdx], eax
+#  else
+        mov     edx, [pu32]
+        xadd    [edx], eax
+#  endif
+        mov     u32, eax
+    }
+    return u32 + 1;
+# endif
+}
+#endif
+
+
+/**
+ * Atomically decrement an unsigned 32-bit value, unordered.
+ *
+ * @returns the new value.
+ * @param   pu32   Pointer to the variable to decrement.
+ */
+#if RT_INLINE_ASM_EXTERNAL
+DECLASM(uint32_t) ASMAtomicUoDecU32(uint32_t volatile *pu32);
+#else
+DECLINLINE(uint32_t) ASMAtomicUoDecU32(uint32_t volatile *pu32)
+{
+    uint32_t u32;
+# if RT_INLINE_ASM_GNU_STYLE
+    __asm__ __volatile__("lock; xaddl %0, %1\n\t"
+                         : "=r" (u32),
+                           "=m" (*pu32)
+                         : "0" (-1),
+                           "m" (*pu32)
+                         : "memory");
+    return u32 - 1;
+# else
+    __asm
+    {
+        mov     eax, -1
+#  ifdef RT_ARCH_AMD64
+        mov     rdx, [pu32]
+        xadd    [rdx], eax
+#  else
+        mov     edx, [pu32]
+        xadd    [edx], eax
+#  endif
+        mov     u32, eax
+    }
+    return u32 - 1;
+# endif
+}
+#endif
+
 
 /** @def RT_ASM_PAGE_SIZE
  * We try avoid dragging in iprt/param.h here.
diff --git a/include/iprt/asmdefs.mac b/include/iprt/asmdefs.mac
index 4485ae0..56c440a 100644
--- a/include/iprt/asmdefs.mac
+++ b/include/iprt/asmdefs.mac
@@ -72,9 +72,26 @@
 %define RT_BIT(bit)        (1 << bit)
 
 ;;
+; Make the mask for the given bit.
+%define RT_BIT_32(bit)     (1 << bit)
+;;
+; Make the mask for the given bit.
+%define RT_BIT_64(bit)     (1 << bit)
+
+;;
 ; Makes a 32-bit unsigned (not type safe, but whatever) out of four byte values.
 %define RT_MAKE_U32_FROM_U8(b0, b1, b2, b3) ( (b3 << 24) | (b2 << 16) | (b1 << 8) | b0 )
 
+;; Preprocessor concatenation macro.
+%define RT_CONCAT(a_1,a_2)              a_1 %+ a_2
+
+;; Preprocessor concatenation macro, three arguments.
+%define RT_CONCAT3(a_1,a_2,a_3)         a_1 %+ a_2 %+ a_3
+
+;; Preprocessor concatenation macro, four arguments.
+%define RT_CONCAT4(a_1,a_2,a_3,a_4)     a_1 %+ a_2 %+ a_3 %+ a_4
+
+
 ;; Define ASM_FORMAT_PE64 if applicable.
 %ifdef ASM_FORMAT_PE
  %ifdef RT_ARCH_AMD64
@@ -107,6 +124,14 @@
 %endmacro
 
 ;;
+; Records an ADD xSP, %1.
+%macro SEH64_ALLOCATE_STACK 1
+ %ifdef RT_ASM_WITH_SEH64
+  [allocstack %1]
+ %endif
+%endmacro
+
+;;
 ; Ends the prologue.
 %macro SEH64_END_PROLOGUE 0
  %ifdef RT_ASM_WITH_SEH64
@@ -176,6 +201,18 @@
 %endif
 
 ;;
+; Gets the pointer to an imported object.
+%ifdef ASM_FORMAT_PE
+ %ifdef RT_ARCH_AMD64
+  %define IMP_SEG(SegOverride, name)  qword [SegOverride:IMPNAME(name) wrt rip]
+ %else
+  %define IMP_SEG(SegOverride, name)  dword [SegOverride:IMPNAME(name)]
+ %endif
+%else
+ %define IMP_SEG(SegOverride, name)   IMPNAME(name)
+%endif
+
+;;
 ; Declares an imported object for use with IMP2.
 ; @note May change the current section!
 %macro EXTERN_IMP2 1
diff --git a/include/iprt/asn1-generator-sanity.h b/include/iprt/asn1-generator-sanity.h
index d44c21b..4b36a29 100644
--- a/include/iprt/asn1-generator-sanity.h
+++ b/include/iprt/asn1-generator-sanity.h
@@ -26,4 +26,3 @@
 #define RTASN1TMPL_PASS RTASN1TMPL_PASS_CHECK_SANITY
 #include <iprt/asn1-generator-pass.h>
 
-
diff --git a/include/iprt/assert.h b/include/iprt/assert.h
index 8b9fba0..981402c 100644
--- a/include/iprt/assert.h
+++ b/include/iprt/assert.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -456,7 +456,7 @@ RT_C_DECLS_END
 #if defined(RTASSERT_QUIET) && !defined(DOXYGEN_RUNNING)
 # define RTAssertMsg1Weak(pszExpr, uLine, pszfile, pszFunction) \
                                 do { } while (0)
-# define RTAssertMsg2Weak       if (0) RTAssertMsg2Weak
+# define RTAssertMsg2Weak       if (1) {} else RTAssertMsg2Weak
 #endif
 
 /** @def RTAssertDoPanic
@@ -498,7 +498,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define Assert(expr)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -518,7 +520,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertStmt(expr, stmt)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -528,7 +532,9 @@ RT_C_DECLS_END
 #else
 # define AssertStmt(expr, stmt)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             stmt; \
         } \
@@ -546,7 +552,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertReturn(expr, rc) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -556,7 +564,9 @@ RT_C_DECLS_END
 #else
 # define AssertReturn(expr, rc) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
             return (rc); \
     } while (0)
 #endif
@@ -575,7 +585,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertReturnStmt(expr, stmt, rc) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -586,7 +598,9 @@ RT_C_DECLS_END
 #else
 # define AssertReturnStmt(expr, stmt, rc) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             stmt; \
             return (rc); \
@@ -603,7 +617,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertReturnVoid(expr) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -613,7 +629,9 @@ RT_C_DECLS_END
 #else
 # define AssertReturnVoid(expr) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
             return; \
     } while (0)
 #endif
@@ -630,7 +648,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertReturnVoidStmt(expr, stmt) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -641,7 +661,9 @@ RT_C_DECLS_END
 #else
 # define AssertReturnVoidStmt(expr, stmt) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             stmt; \
             return; \
@@ -658,7 +680,9 @@ RT_C_DECLS_END
  */
 #ifdef RT_STRICT
 # define AssertBreak(expr) \
-    if (RT_UNLIKELY(!(expr))) \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
     { \
         RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertPanic(); \
@@ -666,9 +690,10 @@ RT_C_DECLS_END
     } else do {} while (0)
 #else
 # define AssertBreak(expr) \
-    if (RT_UNLIKELY(!(expr))) \
-        break; \
-    else do {} while (0)
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else \
+        break
 #endif
 
 /** @def AssertBreakStmt
@@ -680,7 +705,10 @@ RT_C_DECLS_END
  */
 #ifdef RT_STRICT
 # define AssertBreakStmt(expr, stmt) \
-    if (RT_UNLIKELY(!(expr))) { \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
+    { \
         RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertPanic(); \
         stmt; \
@@ -688,7 +716,10 @@ RT_C_DECLS_END
     } else do {} while (0)
 #else
 # define AssertBreakStmt(expr, stmt) \
-    if (RT_UNLIKELY(!(expr))) { \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
+    { \
         stmt; \
         break; \
     } else do {} while (0)
@@ -703,7 +734,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertMsg(expr, a)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -727,7 +760,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertMsgStmt(expr, a, stmt)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -738,7 +773,9 @@ RT_C_DECLS_END
 #else
 # define AssertMsgStmt(expr, a, stmt)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             stmt; \
         } \
@@ -756,7 +793,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertMsgReturn(expr, a, rc)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -767,7 +806,9 @@ RT_C_DECLS_END
 #else
 # define AssertMsgReturn(expr, a, rc) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
             return (rc); \
     } while (0)
 #endif
@@ -787,7 +828,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertMsgReturnStmt(expr, a, stmt, rc)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -799,7 +842,9 @@ RT_C_DECLS_END
 #else
 # define AssertMsgReturnStmt(expr, a, stmt, rc) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             stmt; \
             return (rc); \
@@ -817,7 +862,9 @@ RT_C_DECLS_END
 #ifdef RT_STRICT
 # define AssertMsgReturnVoid(expr, a)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -828,7 +875,9 @@ RT_C_DECLS_END
 #else
 # define AssertMsgReturnVoid(expr, a) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
             return; \
     } while (0)
 #endif
@@ -841,12 +890,14 @@ RT_C_DECLS_END
  *
  * @param   expr    Expression which should be true.
  * @param   a       printf argument list (in parenthesis).
- * @param   stmt    Statement to execute before break in case of a failed assertion.
+ * @param   stmt    Statement to execute before return in case of a failed assertion.
  */
 #ifdef RT_STRICT
 # define AssertMsgReturnVoidStmt(expr, a, stmt)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -858,7 +909,9 @@ RT_C_DECLS_END
 #else
 # define AssertMsgReturnVoidStmt(expr, a, stmt) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             stmt; \
             return; \
@@ -875,8 +928,10 @@ RT_C_DECLS_END
  * @param   a       printf argument list (in parenthesis).
  */
 #ifdef RT_STRICT
-# define AssertMsgBreak(expr, a)  \
-    if (RT_UNLIKELY(!(expr))) \
+# define AssertMsgBreak(expr, a) \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
     { \
         RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertMsg2Weak a; \
@@ -885,9 +940,10 @@ RT_C_DECLS_END
     } else do {} while (0)
 #else
 # define AssertMsgBreak(expr, a) \
-    if (RT_UNLIKELY(!(expr))) \
-        break; \
-    else do {} while (0)
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else \
+        break
 #endif
 
 /** @def AssertMsgBreakStmt
@@ -900,7 +956,10 @@ RT_C_DECLS_END
  */
 #ifdef RT_STRICT
 # define AssertMsgBreakStmt(expr, a, stmt) \
-    if (RT_UNLIKELY(!(expr))) { \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
+    { \
         RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertMsg2Weak a; \
         RTAssertPanic(); \
@@ -909,7 +968,10 @@ RT_C_DECLS_END
     } else do {} while (0)
 #else
 # define AssertMsgBreakStmt(expr, a, stmt) \
-    if (RT_UNLIKELY(!(expr))) { \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
+    { \
         stmt; \
         break; \
     } else do {} while (0)
@@ -1195,7 +1257,9 @@ RT_C_DECLS_END
  */
 #define AssertLogRel(expr) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -1211,7 +1275,9 @@ RT_C_DECLS_END
  */
 #define AssertLogRelReturn(expr, rc) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -1227,7 +1293,9 @@ RT_C_DECLS_END
  */
 #define AssertLogRelReturnVoid(expr) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertPanic(); \
@@ -1242,7 +1310,9 @@ RT_C_DECLS_END
  * @param   expr    Expression which should be true.
  */
 #define AssertLogRelBreak(expr) \
-    if (RT_UNLIKELY(!(expr))) \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
     { \
         RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertPanic(); \
@@ -1258,7 +1328,9 @@ RT_C_DECLS_END
  * @param   stmt    Statement to execute before break in case of a failed assertion.
  */
 #define AssertLogRelBreakStmt(expr, stmt) \
-    if (RT_UNLIKELY(!(expr))) \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
     { \
         RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertPanic(); \
@@ -1275,7 +1347,9 @@ RT_C_DECLS_END
  */
 #define AssertLogRelMsg(expr, a) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else\
         { \
             RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertLogRelMsg2(a); \
@@ -1293,7 +1367,9 @@ RT_C_DECLS_END
  */
 #define AssertLogRelMsgStmt(expr, a, stmt) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else\
         { \
             RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertLogRelMsg2(a); \
@@ -1312,7 +1388,9 @@ RT_C_DECLS_END
  */
 #define AssertLogRelMsgReturn(expr, a, rc) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else\
         { \
             RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertLogRelMsg2(a); \
@@ -1334,7 +1412,9 @@ RT_C_DECLS_END
  */
 #define AssertLogRelMsgReturnStmt(expr, a, stmt, rcRet) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else\
         { \
             RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertLogRelMsg2(a); \
@@ -1353,7 +1433,9 @@ RT_C_DECLS_END
  */
 #define AssertLogRelMsgReturnVoid(expr, a) \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else\
         { \
             RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertLogRelMsg2(a); \
@@ -1370,7 +1452,9 @@ RT_C_DECLS_END
  * @param   a       printf argument list (in parenthesis).
  */
 #define AssertLogRelMsgBreak(expr, a) \
-    if (RT_UNLIKELY(!(expr))) \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
     { \
         RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertLogRelMsg2(a); \
@@ -1388,7 +1472,9 @@ RT_C_DECLS_END
  * @param   stmt    Statement to execute before break in case of a failed assertion.
  */
 #define AssertLogRelMsgBreakStmt(expr, a, stmt) \
-    if (RT_UNLIKELY(!(expr))) \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
     { \
         RTAssertLogRelMsg1(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertLogRelMsg2(a); \
@@ -1611,9 +1697,11 @@ RT_C_DECLS_END
  */
 #define AssertRelease(expr)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
-            RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
+            RTAssertMsg1Weak(#expr, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
             RTAssertReleasePanic(); \
         } \
     } while (0)
@@ -1626,7 +1714,9 @@ RT_C_DECLS_END
  */
 #define AssertReleaseReturn(expr, rc)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertReleasePanic(); \
@@ -1641,7 +1731,9 @@ RT_C_DECLS_END
  */
 #define AssertReleaseReturnVoid(expr)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertReleasePanic(); \
@@ -1656,13 +1748,13 @@ RT_C_DECLS_END
  * @param   expr    Expression which should be true.
  */
 #define AssertReleaseBreak(expr)  \
-    if { \
-        if (RT_UNLIKELY(!(expr))) \
-        { \
-            RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
-            RTAssertReleasePanic(); \
-            break; \
-        } \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
+    { \
+        RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
+        RTAssertReleasePanic(); \
+        break; \
     } else do {} while (0)
 
 /** @def AssertReleaseBreakStmt
@@ -1672,7 +1764,9 @@ RT_C_DECLS_END
  * @param   stmt    Statement to execute before break in case of a failed assertion.
  */
 #define AssertReleaseBreakStmt(expr, stmt)  \
-    if (RT_UNLIKELY(!(expr))) \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
     { \
         RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertReleasePanic(); \
@@ -1689,7 +1783,9 @@ RT_C_DECLS_END
  */
 #define AssertReleaseMsg(expr, a)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -1706,7 +1802,9 @@ RT_C_DECLS_END
  */
 #define AssertReleaseMsgReturn(expr, a, rc)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -1723,7 +1821,9 @@ RT_C_DECLS_END
  */
 #define AssertReleaseMsgReturnVoid(expr, a)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
         { \
             RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
@@ -1740,7 +1840,9 @@ RT_C_DECLS_END
  * @param   a       printf argument list (in parenthesis).
  */
 #define AssertReleaseMsgBreak(expr, a)  \
-    if (RT_UNLIKELY(!(expr))) \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
     { \
         RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertMsg2Weak a; \
@@ -1756,7 +1858,10 @@ RT_C_DECLS_END
  * @param   stmt    Statement to execute before break in case of a failed assertion.
  */
 #define AssertReleaseMsgBreakStmt(expr, a, stmt)  \
-    if (RT_UNLIKELY(!(expr))) { \
+    if (RT_LIKELY(!!(expr))) \
+    { /* likely */ } \
+    else if (1) \
+    { \
         RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
         RTAssertMsg2Weak a; \
         RTAssertReleasePanic(); \
@@ -1828,7 +1933,7 @@ RT_C_DECLS_END
  */
 #define AssertReleaseMsgFailed(a)  \
     do { \
-        RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
+        RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
         RTAssertMsg2Weak a; \
         RTAssertReleasePanic(); \
     } while (0)
@@ -1907,7 +2012,9 @@ RT_C_DECLS_END
  */
 #define AssertFatal(expr)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
             for (;;) \
             { \
                 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
@@ -1923,7 +2030,9 @@ RT_C_DECLS_END
  */
 #define AssertFatalMsg(expr, a)  \
     do { \
-        if (RT_UNLIKELY(!(expr))) \
+        if (RT_LIKELY(!!(expr))) \
+        { /* likely */ } \
+        else \
             for (;;) \
             { \
                 RTAssertMsg1Weak(#expr, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
@@ -1939,7 +2048,7 @@ RT_C_DECLS_END
     do { \
         for (;;) \
         { \
-            RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
+            RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
             RTAssertReleasePanic(); \
         } \
     } while (0)
@@ -1953,7 +2062,7 @@ RT_C_DECLS_END
     do { \
         for (;;) \
         { \
-            RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, __PRETTY_FUNCTION__); \
+            RTAssertMsg1Weak((const char *)0, __LINE__, __FILE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__); \
             RTAssertMsg2Weak a; \
             RTAssertReleasePanic(); \
         } \
diff --git a/include/iprt/avl.h b/include/iprt/avl.h
index 2347b80..65b9293 100644
--- a/include/iprt/avl.h
+++ b/include/iprt/avl.h
@@ -486,7 +486,7 @@ typedef PAVLGCPTRNODECORE     AVLGCPTRTREE;
 /** Pointer to a tree of RTGCPTR keys. */
 typedef PPAVLGCPTRNODECORE    PAVLGCPTRTREE;
 
-/** Callback function for RTAvlGCPtrDoWithAll(). 
+/** Callback function for RTAvlGCPtrDoWithAll().
  *  @returns IPRT status codes. */
 typedef DECLCALLBACK(int)   AVLGCPTRCALLBACK(PAVLGCPTRNODECORE pNode, void *pvUser);
 /** Pointer to callback function for RTAvlGCPtrDoWithAll(). */
diff --git a/include/iprt/cdefs.h b/include/iprt/cdefs.h
index 3ceae26..14d2f87 100644
--- a/include/iprt/cdefs.h
+++ b/include/iprt/cdefs.h
@@ -320,7 +320,7 @@
 /** @} */
 
 /** @def RT_OPSYS
- * Indicates which OS we're targetting. It's a \#define with is
+ * Indicates which OS we're targeting. It's a \#define with is
  * assigned one of the RT_OPSYS_XXX defines above.
  *
  * So to test if we're on FreeBSD do the following:
@@ -1158,7 +1158,7 @@
  * @remarks Don't use this macro on C++ methods.
  */
 #ifdef __GNUC__
-# define DECL_NO_INLINE(scope,type) __attribute__((noinline)) scope type
+# define DECL_NO_INLINE(scope,type) __attribute__((__noinline__)) scope type
 #elif defined(_MSC_VER)
 # define DECL_NO_INLINE(scope,type) __declspec(noinline) scope type
 #else
@@ -2637,7 +2637,7 @@
 
 
 /** Source position. */
-#define RT_SRC_POS         __FILE__, __LINE__, __PRETTY_FUNCTION__
+#define RT_SRC_POS         __FILE__, __LINE__, RT_GCC_EXTENSION __PRETTY_FUNCTION__
 
 /** Source position declaration. */
 #define RT_SRC_POS_DECL    const char *pszFile, unsigned iLine, const char *pszFunction
@@ -2687,6 +2687,17 @@
 # define RT_INLINE_ASM_USES_INTRIN 0
 #endif
 
+/** @def RT_COMPILER_SUPPORTS_LAMBDA
+ * If the defined, the compiler supports lambda expressions.   These expressions
+ * are useful for embedding assertions and type checks into macros. */
+#if defined(_MSC_VER) && defined(__cplusplus)
+# if _MSC_VER >= 1600 /* Visual C++ v10.0 / 2010 */
+#  define RT_COMPILER_SUPPORTS_LAMBDA
+# endif
+#elif defined(__GNUC__) && defined(__cplusplus)
+/* 4.5 or later, I think, if in ++11 mode... */
+#endif
+
 /** @} */
 
 
diff --git a/include/iprt/cdrom.h b/include/iprt/cdrom.h
index 927ee15..21742f5 100644
--- a/include/iprt/cdrom.h
+++ b/include/iprt/cdrom.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -30,7 +30,8 @@
 
 RT_C_DECLS_BEGIN
 
-/** @defgroup grp_cdrom     IPRT CD/DVD/BD-ROM Drive API
+/** @defgroup grp_rt_cdrom  IPRT CD/DVD/BD-ROM Drive API
+ * @ingroup grp_rt
  *
  * The user of the API is currently resposible for serializing calls to it.
  *
diff --git a/include/iprt/cpp/list.h b/include/iprt/cpp/list.h
index ca8c8f3..d3ecfaf 100644
--- a/include/iprt/cpp/list.h
+++ b/include/iprt/cpp/list.h
@@ -147,7 +147,7 @@ public:
         if (cSize > 0)
             memcpy(&p[iTo], &p1[0], sizeof(T1) * cSize);
     }
-    static inline void      erase(T2 *p, size_t /* i */) { /* Nothing to do here. */ }
+    static inline void      erase(T2 * /* p */, size_t /* i */) { /* Nothing to do here. */ }
     static inline void      eraseRange(T2 * /* p */, size_t /* cFrom */, size_t /* cSize */) { /* Nothing to do here. */ }
 };
 
diff --git a/include/iprt/cpp/ministring.h b/include/iprt/cpp/ministring.h
index 3598490..606cd9d 100644
--- a/include/iprt/cpp/ministring.h
+++ b/include/iprt/cpp/ministring.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2007-2012 Oracle Corporation
+ * Copyright (C) 2007-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -247,8 +247,8 @@ public:
              && cb > m_cch + 1
            )
         {
-            int vrc = RTStrRealloc(&m_psz, cb);
-            if (RT_SUCCESS(vrc))
+            int rc = RTStrRealloc(&m_psz, cb);
+            if (RT_SUCCESS(rc))
                 m_cbAllocated = cb;
 #ifdef RT_EXCEPTIONS_ENABLED
             else
@@ -258,6 +258,27 @@ public:
     }
 
     /**
+     * A C like version of the reserve method, i.e. return code instead of throw.
+     *
+     * @returns VINF_SUCCESS or VERR_NO_STRING_MEMORY.
+     * @param   cb              New minimum size (in bytes) of member memory buffer.
+     */
+    int reserveNoThrow(size_t cb)
+    {
+        if (    cb != m_cbAllocated
+             && cb > m_cch + 1
+           )
+        {
+            int rc = RTStrRealloc(&m_psz, cb);
+            if (RT_SUCCESS(rc))
+                m_cbAllocated = cb;
+            else
+                return rc;
+        }
+        return VINF_SUCCESS;
+    }
+
+    /**
      * Deallocates all memory.
      */
     inline void setNull()
@@ -854,6 +875,19 @@ public:
                                           SplitMode a_enmMode = RemoveEmptyParts) const;
 
     /**
+     * Joins a list of strings together using the provided separator and
+     * an optional prefix for each item in the list.
+     *
+     * @param   a_rList         The list to join.
+     * @param   a_rstrPrefix    The prefix used for appending to each item.
+     * @param   a_rstrSep       The separator used for joining.
+     * @returns joined string.
+     */
+    static RTCString joinEx(const RTCList<RTCString, RTCString *> &a_rList,
+                            const RTCString &a_rstrPrefix /* = "" */,
+                            const RTCString &a_rstrSep /* = "" */);
+
+    /**
      * Joins a list of strings together using the provided separator.
      *
      * @param   a_rList     The list to join.
@@ -863,6 +897,28 @@ public:
     static RTCString join(const RTCList<RTCString, RTCString *> &a_rList,
                           const RTCString &a_rstrSep = "");
 
+    /**
+     * Swaps two strings in a fast way.
+     *
+     * Exception safe.
+     *
+     * @param   a_rThat  The string to swap with.
+     */
+    inline void swap(RTCString &a_rThat) throw()
+    {
+        char   *pszTmp         = m_psz;
+        size_t  cchTmp         = m_cch;
+        size_t  cbAllocatedTmp = m_cbAllocated;
+
+        m_psz                  = a_rThat.m_psz;
+        m_cch                  = a_rThat.m_cch;
+        m_cbAllocated          = a_rThat.m_cbAllocated;
+
+        a_rThat.m_psz          = pszTmp;
+        a_rThat.m_cch          = cchTmp;
+        a_rThat.m_cbAllocated  = cbAllocatedTmp;
+    }
+
 protected:
 
     /**
diff --git a/include/iprt/cpp/utils.h b/include/iprt/cpp/utils.h
index 4edc8e5..1c50e8b 100644
--- a/include/iprt/cpp/utils.h
+++ b/include/iprt/cpp/utils.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -41,8 +41,6 @@
  *
  * Inherit from this class in order to prevent automatic generation
  * of the copy constructor and assignment operator in your class.
- *
- * @addtogroup grp_rt_cpp_util
  */
 class RTCNonCopyable
 {
diff --git a/include/iprt/cpuset.h b/include/iprt/cpuset.h
index 0d1e1c5..fa69a0f 100644
--- a/include/iprt/cpuset.h
+++ b/include/iprt/cpuset.h
@@ -70,6 +70,36 @@ DECLINLINE(PRTCPUSET) RTCpuSetFill(PRTCPUSET pSet)
 
 
 /**
+ * Copies one set to another.
+ *
+ * @param   pDst    Pointer to the destination set.
+ * @param   pSrc    Pointer to the source set.
+ */
+DECLINLINE(void) RTCpuSetCopy(PRTCPUSET pDst, PRTCPUSET pSrc)
+{
+    unsigned i;
+    for (i = 0; i < RT_ELEMENTS(pDst->bmSet); i++)
+        pDst->bmSet[i] = pSrc->bmSet[i];
+}
+
+
+/**
+ * ANDs the given CPU set with another.
+ *
+ * @returns pSet.
+ * @param   pSet          Pointer to the set.
+ * @param   pAndMaskSet   Pointer to the AND-mask set.
+ */
+DECLINLINE(PRTCPUSET) RTCpuSetAnd(PRTCPUSET pSet, PRTCPUSET pAndMaskSet)
+{
+    unsigned i;
+    for (i = 0; i < RT_ELEMENTS(pSet->bmSet); i++)
+        ASMAtomicAndU64((volatile uint64_t *)&pSet->bmSet[i], pAndMaskSet->bmSet[i]);
+    return pSet;
+}
+
+
+/**
  * Adds a CPU given by its identifier to the set.
  *
  * @returns 0 on success, -1 if idCpu isn't valid.
@@ -190,6 +220,22 @@ DECLINLINE(bool) RTCpuSetIsEqual(PCRTCPUSET pSet1, PCRTCPUSET pSet2)
 
 
 /**
+ * Checks if the CPU set is empty or not.
+ *
+ * @returns true / false accordingly.
+ * @param   pSet    Pointer to the set.
+ */
+DECLINLINE(bool) RTCpuSetIsEmpty(PRTCPUSET pSet)
+{
+    unsigned i;
+    for (i = 0; i < RT_ELEMENTS(pSet->bmSet); i++)
+        if (pSet->bmSet[i])
+            return false;
+    return true;
+}
+
+
+/**
  * Converts the CPU set to a 64-bit mask.
  *
  * @returns The mask.
diff --git a/include/iprt/crc.h b/include/iprt/crc.h
index 0f9fa96..deb7936 100644
--- a/include/iprt/crc.h
+++ b/include/iprt/crc.h
@@ -152,6 +152,45 @@ RTDECL(uint32_t)    RTCrcAdler32Finish(uint32_t uCrc);
 
 /** @} */
 
+
+/** @defgroup grp_rt_crc32c  CRC-32C
+ * @{ */
+/**
+ * Calculate CRC-32C for a memory block.
+ *
+ * @returns CRC-32C for the memory block.
+ * @param   pv      Pointer to the memory block.
+ * @param   cb      Size of the memory block in bytes.
+ */
+RTDECL(uint32_t)    RTCrc32C(const void *pv, size_t cb);
+
+/**
+ * Start a multiblock CRC-32 calculation.
+ *
+ * @returns Start CRC-32.
+ */
+RTDECL(uint32_t)    RTCrc32CStart(void);
+
+/**
+ * Processes a multiblock of a CRC-32C calculation.
+ *
+ * @returns Intermediate CRC-32C value.
+ * @param   uCRC32C Current CRC-32C intermediate value.
+ * @param   pv      The data block to process.
+ * @param   cb      The size of the data block in bytes.
+ */
+RTDECL(uint32_t)    RTCrc32CProcess(uint32_t uCRC32C, const void *pv, size_t cb);
+
+/**
+ * Complete a multiblock CRC-32 calculation.
+ *
+ * @returns CRC-32 value.
+ * @param   uCRC32  Current CRC-32 intermediate value.
+ */
+RTDECL(uint32_t)    RTCrc32CFinish(uint32_t uCRC32);
+
+/** @} */
+
 /** @} */
 
 RT_C_DECLS_END
diff --git a/include/iprt/crypto/rsa.h b/include/iprt/crypto/rsa.h
index 71cb042..543294e 100644
--- a/include/iprt/crypto/rsa.h
+++ b/include/iprt/crypto/rsa.h
@@ -145,4 +145,3 @@ RT_C_DECLS_END
 
 #endif
 
-
diff --git a/include/iprt/crypto/tsp.h b/include/iprt/crypto/tsp.h
index 3626917..636a89a 100644
--- a/include/iprt/crypto/tsp.h
+++ b/include/iprt/crypto/tsp.h
@@ -133,4 +133,3 @@ RT_C_DECLS_END
 
 #endif
 
-
diff --git a/include/iprt/dbg.h b/include/iprt/dbg.h
index 2dde29e..5bdce4f 100644
--- a/include/iprt/dbg.h
+++ b/include/iprt/dbg.h
@@ -106,7 +106,7 @@ typedef RTDBGSEGMENT const *PCRTDBGSEGMENT;
 
 
 /** Max length (including '\\0') of a symbol name. */
-#define RTDBG_SYMBOL_NAME_LENGTH    (384 - 8 - 8 - 8 - 4 - 4 - 8)
+#define RTDBG_SYMBOL_NAME_LENGTH    (512 - 8 - 8 - 8 - 4 - 4 - 8)
 
 /**
  * Debug symbol.
@@ -458,9 +458,34 @@ RTDECL(int) RTDbgCfgOpenDbg(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t
                             PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
 RTDECL(int) RTDbgCfgOpenDwo(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t uCrc32,
                             PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
-
 RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszFilename, PCRTUUID pUuid,
                                    PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
+RTDECL(int) RTDbgCfgOpenMachOImage(RTDBGCFG hDbgCfg, const char *pszFilename, PCRTUUID pUuid,
+                                   PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
+
+
+/** @name Static symbol cache configuration
+ * @{ */
+/** The cache subdirectory containing the UUID mappings for .dSYM bundles.
+ * The UUID mappings implemented by IPRT are splitting the image/dsym UUID up
+ * into five 4 digit parts that maps to directories and one twelve digit part
+ * that maps to a symbolic link.  The symlink points to the file in the
+ * Contents/Resources/DWARF/ directory of the .dSYM bundle for a .dSYM map, and
+ * to the image file (Contents/MacOS/bundlename for bundles) for image map.
+ *
+ * According to available documentation, both lldb and gdb are able to use these
+ * UUID maps to find debug info while debugging.  See:
+ *      http://lldb.llvm.org/symbols.html
+ */
+#define RTDBG_CACHE_UUID_MAP_DIR_DSYMS   "dsym-uuids"
+/** The cache subdirectory containing the UUID mappings for image files. */
+#define RTDBG_CACHE_UUID_MAP_DIR_IMAGES  "image-uuids"
+/** Suffix used for the cached .dSYM debug files.
+ * In .dSYM bundles only the .dSYM/Contents/Resources/DWARF/debug-file is
+ * copied into the cache, and in order to not clash with the stripped/rich image
+ * file, the cache tool slaps this suffix onto the name. */
+#define RTDBG_CACHE_DSYM_FILE_SUFFIX     ".dwarf"
+/** @} */
 
 
 /** @} */
diff --git a/include/iprt/dir.h b/include/iprt/dir.h
index 54e2359..b866c5c 100644
--- a/include/iprt/dir.h
+++ b/include/iprt/dir.h
@@ -54,7 +54,13 @@ RTDECL(bool) RTDirExists(const char *pszPath);
  * @{ */
 /** Don't allow symbolic links as part of the path.
  * @remarks this flag is currently not implemented and will be ignored. */
-#define RTDIRCREATE_FLAGS_NO_SYMLINKS  RT_BIT(0)
+#define RTDIRCREATE_FLAGS_NO_SYMLINKS                       RT_BIT(0)
+/** Set the not-content-indexed flag (default).  Windows only atm. */
+#define RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_DONT_SET      RT_BIT(1)
+/** Do not set the not-content-indexed flag.  Windows only atm. */
+#define RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_DONT_SET      RT_BIT(1)
+/** Ignore errors setting the not-content-indexed flag.  Windows only atm. */
+#define RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_NOT_CRITICAL  RT_BIT(2)
 /** @} */
 
 /**
diff --git a/include/iprt/env.h b/include/iprt/env.h
index d956a06..abb424d 100644
--- a/include/iprt/env.h
+++ b/include/iprt/env.h
@@ -80,6 +80,15 @@ RTDECL(int) RTEnvClone(PRTENV pEnv, RTENV EnvToClone);
 RTDECL(int) RTEnvDestroy(RTENV Env);
 
 /**
+ * Resets the environment block to contain zero variables.
+ *
+ * @returns IPRT status code.
+ *
+ * @param   hEnv    Environment block handle.  RTENV_DEFAULT is not supported.
+ */
+RTDECL(int) RTEnvReset(RTENV hEnv);
+
+/**
  * Get the execve/spawnve/main envp.
  *
  * All returned strings are in the current process' codepage.
@@ -113,6 +122,30 @@ RTDECL(int) RTEnvQueryUtf16Block(RTENV hEnv, PRTUTF16 *ppwszzBlock);
 RTDECL(void) RTEnvFreeUtf16Block(PRTUTF16 pwszzBlock);
 
 /**
+ * Get a sorted, UTF-8 environment block.
+ *
+ * The environment block is a sequence of putenv formatted ("NAME=VALUE" or
+ * "NAME") zero terminated strings ending with an empty string (i.e. last string
+ * has two zeros).
+ *
+ * @returns IPRT status code.
+ *
+ * @param   hEnv            Environment block handle.
+ * @param   fSorted         Whether to sort it, this will affect @a hEnv.
+ * @param   ppszzBlock      Where to return the environment block.  This must be
+ *                          freed by calling RTEnvFreeUtf8Block.
+ * @param   pcbBlock        Where to return the size of the block. Optional.
+ */
+RTDECL(int) RTEnvQueryUtf8Block(RTENV hEnv, bool fSorted, char **ppszzBlock, size_t *pcbBlock);
+
+/**
+ * Frees an environment block returned by RTEnvGetUtf8Block().
+ *
+ * @param   pszzBlock       What RTEnvGetUtf8Block returned.  NULL is ignored.
+ */
+RTDECL(void) RTEnvFreeUtf8Block(char *pszzBlock);
+
+/**
  * Checks if an environment variable exists in the default environment block.
  *
  * @returns IPRT status code. Typical error is VERR_NO_MEMORY.
@@ -157,14 +190,16 @@ RTDECL(int) RTEnvGetUtf8(const char *pszVar, char *pszValue, size_t cbValue, siz
  *
  * @returns IPRT status code.
  * @retval  VERR_ENV_VAR_NOT_FOUND if the variable was not found.
+ * @retval  VERR_ENV_VAR_UNSET if @a hEnv is an environment change record and
+ *          the variable has been recorded as unset.
  *
- * @param   Env         The environment handle.
+ * @param   hEnv        The environment handle.
  * @param   pszVar      The environment variable name.
  * @param   pszValue    Where to put the buffer.
  * @param   cbValue     The size of the value buffer.
  * @param   pcchActual  Returns the actual value string length. Optional.
  */
-RTDECL(int) RTEnvGetEx(RTENV Env, const char *pszVar, char *pszValue, size_t cbValue, size_t *pcchActual);
+RTDECL(int) RTEnvGetEx(RTENV hEnv, const char *pszVar, char *pszValue, size_t cbValue, size_t *pcchActual);
 
 /**
  * Puts an variable=value string into the environment (putenv).
@@ -256,6 +291,100 @@ RTDECL(int) RTEnvUnsetEx(RTENV Env, const char *pszVar);
  */
 RTDECL(char *) RTEnvDupEx(RTENV Env, const char *pszVar);
 
+/**
+ * Counts the variables in the environment.
+ *
+ * @returns Number of variables in the environment. UINT32_MAX on error.
+ * @param   hEnv        The environment handle.
+ *                      RTENV_DEFAULT is currently not accepted.
+ */
+RTDECL(uint32_t) RTEnvCountEx(RTENV hEnv);
+
+/**
+ * Queries an environment variable by it's index.
+ *
+ * This can be used together with RTEnvCount to enumerate the environment block.
+ *
+ * @returns IPRT status code.
+ * @retval  VERR_ENV_VAR_NOT_FOUND if the index is out of bounds, output buffers
+ *          untouched.
+ * @retval  VERR_BUFFER_OVERFLOW if one of the buffers are too small.  We'll
+ *          fill it with as much we can in RTStrCopy fashion.
+ * @retval  VINF_ENV_VAR_UNSET if @a hEnv is an environment change record and
+ *          the variable at @a iVar is recorded as being unset.
+ *
+ * @param   hEnv        The environment handle.
+ *                      RTENV_DEFAULT is currently not accepted.
+ * @param   iVar        The variable index.
+ * @param   pszVar      Variable name buffer.
+ * @param   cbVar       The size of the variable name buffer.
+ * @param   pszValue    Value buffer.
+ * @param   cbValue     The size of the value buffer.
+ */
+RTDECL(int) RTEnvGetByIndexEx(RTENV hEnv, uint32_t iVar, char *pszVar, size_t cbVar, char *pszValue, size_t cbValue);
+
+/**
+ * Leaner and meaner version of RTEnvGetByIndexEx.
+ *
+ * This can be used together with RTEnvCount to enumerate the environment block.
+ *
+ * Use with caution as the returned pointer may change by the next call using
+ * the environment handle.  Please only use this API in cases where there is no
+ * chance of races.
+ *
+ * @returns Pointer to the internal environment variable=value string on
+ *          success.  If @a hEnv is an environment change recordthe string may
+ *          also be on the "variable" form, representing an unset operation. Do
+ *          NOT change this string, it is read only!
+ *
+ *          If the index is out of range on the environment handle is invalid,
+ *          NULL is returned.
+ *
+ * @param   hEnv        The environment handle.
+ *                      RTENV_DEFAULT is currently not accepted.
+ * @param   iVar        The variable index.
+ */
+RTDECL(const char *) RTEnvGetByIndexRawEx(RTENV hEnv, uint32_t iVar);
+
+
+/**
+ * Creates an empty environment change record.
+ *
+ * This is a special environment for use with RTEnvApplyChanges and similar
+ * purposes.  The
+ *
+ * @returns IPRT status code. Typical error is VERR_NO_MEMORY.
+ *
+ * @param   phEnv       Where to store the handle of the new environment block.
+ */
+RTDECL(int) RTEnvCreateChangeRecord(PRTENV phEnv);
+
+/**
+ * Checks if @a hEnv is an environment change record.
+ *
+ * @returns true if it is, false if it's not or if the handle is invalid.
+ * @param   hEnv         The environment handle.
+ * @sa      RTEnvCreateChangeRecord.
+ */
+RTDECL(bool) RTEnvIsChangeRecord(RTENV hEnv);
+
+/**
+ * Applies changes from one environment onto another.
+ *
+ * If @a hEnvChanges is a normal environment, its content is just added to @a
+ * hEnvDst, where variables in the destination can only be overwritten. However
+ * if @a hEnvChanges is a change record environment, variables in the
+ * destination can also be removed.
+ *
+ * @returns IPRT status code. Typical error is VERR_NO_MEMORY.
+ * @param   hEnvDst     The destination environment.
+ * @param   hEnvChanges Handle to the environment containig the changes to
+ *                      apply.  As said, especially useful if it's a environment
+ *                      change record.  RTENV_DEFAULT is not supported here.
+ */
+RTDECL(int) RTEnvApplyChanges(RTENV hEnvDst, RTENV hEnvChanges);
+
+
 #endif /* IN_RING3 */
 
 /** @} */
diff --git a/include/iprt/err.h b/include/iprt/err.h
index bbb2bbe..7c533d1 100644
--- a/include/iprt/err.h
+++ b/include/iprt/err.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -43,7 +43,6 @@
  */
 
 /** @defgroup grp_rt_err_hlp        Status Code Helpers
- * @ingroup grp_rt_err
  * @{
  */
 
@@ -803,7 +802,7 @@ RT_C_DECLS_END
 #define VERR_CODE_POINT_SURROGATE           (-60)
 /** A string claiming to be UTF-8 is incorrectly encoded. */
 #define VERR_INVALID_UTF8_ENCODING          (-61)
-/** Ad string claiming to be in UTF-16 is incorrectly encoded. */
+/** A string claiming to be in UTF-16 is incorrectly encoded. */
 #define VERR_INVALID_UTF16_ENCODING         (-62)
 /** Encountered a unicode code point which cannot be represented as UTF-16. */
 #define VERR_CANT_RECODE_AS_UTF16           (-63)
@@ -817,7 +816,7 @@ RT_C_DECLS_END
 #define VERR_MEMORY_BUSY                    (-67)
 /** The timer can't be started because it's already active. */
 #define VERR_TIMER_ACTIVE                   (-68)
-/** The timer can't be stopped because i's already suspended. */
+/** The timer can't be stopped because it's already suspended. */
 #define VERR_TIMER_SUSPENDED                (-69)
 /** The operation was cancelled by the user (copy) or another thread (local ipc). */
 #define VERR_CANCELLED                      (-70)
@@ -926,6 +925,10 @@ RT_C_DECLS_END
 #define VWRN_UNABLE_TO_SATISFY_REQUIREMENTS 22406
 /** The requested allocation is too big. */
 #define VERR_ALLOCATION_TOO_BIG             (-22407)
+/** Mismatch. */
+#define VERR_MISMATCH                       (-22408)
+/** Wrong type. */
+#define VERR_WRONG_TYPE                     (-22409)
 /** @} */
 
 
@@ -1194,7 +1197,7 @@ RT_C_DECLS_END
 #define VERR_SEM_LV_WRONG_ORDER             (-368)
 /** Wrong release order detected. */
 #define VERR_SEM_LV_WRONG_RELEASE_ORDER     (-369)
-/** Attempt to recursively enter a non-recurisve lock. */
+/** Attempt to recursively enter a non-recursive lock. */
 #define VERR_SEM_LV_NESTED                  (-370)
 /** Invalid parameters passed to the lock validator. */
 #define VERR_SEM_LV_INVALID_PARAMETER       (-371)
@@ -1596,6 +1599,12 @@ RT_C_DECLS_END
 /** Unable to translate all the variables in the default environment due to
  * codeset issues (LANG / LC_ALL / LC_CTYPE). */
 #define VWRN_ENV_NOT_FULLY_TRANSLATED           (751)
+/** Invalid environment variable name. */
+#define VERR_ENV_INVALID_VAR_NAME               (-752)
+/** The environment variable is an unset record. */
+#define VINF_ENV_VAR_UNSET                      (753)
+/** The environment variable has been recorded as being unset. */
+#define VERR_ENV_VAR_UNSET                      (-753)
 /** @} */
 
 /** @name Multiprocessor Status Codes.
@@ -1605,6 +1614,10 @@ RT_C_DECLS_END
 #define VERR_CPU_OFFLINE                        (-800)
 /** The specified cpu was not found. */
 #define VERR_CPU_NOT_FOUND                      (-801)
+/** Not all of the requested CPUs showed up in the PFNRTMPWORKER. */
+#define VERR_NOT_ALL_CPUS_SHOWED                (-802)
+/** Internal processing error in the RTMp code.*/
+#define VERR_CPU_IPE_1                          (-803)
 /** @} */
 
 /** @name RTGetOpt status codes
@@ -1801,9 +1814,9 @@ RT_C_DECLS_END
 #define VERR_VFS_CHAIN_EXPECTED_ELEMENT             (-22102)
 /** The VFS object type is not known. */
 #define VERR_VFS_CHAIN_UNKNOWN_TYPE                 (-22103)
-/** Expected a left paranthese. */
+/** Expected a left parentheses. */
 #define VERR_VFS_CHAIN_EXPECTED_LEFT_PARENTHESES    (-22104)
-/** Expected a right paranthese. */
+/** Expected a right parentheses. */
 #define VERR_VFS_CHAIN_EXPECTED_RIGHT_PARENTHESES   (-22105)
 /** Expected a provider name. */
 #define VERR_VFS_CHAIN_EXPECTED_PROVIDER_NAME       (-22106)
@@ -1880,7 +1893,7 @@ RT_C_DECLS_END
 #define VERR_XAR_TOC_XML_PARSE_ERROR                (-22710)
 /** The table of content XML document does not have a toc element. */
 #define VERR_XML_TOC_ELEMENT_MISSING                (-22711)
-/** The table of content XML element (toc) has sibilings, we expected it to be
+/** The table of content XML element (toc) has siblings, we expected it to be
  *  an only child or the root element (xar). */
 #define VERR_XML_TOC_ELEMENT_HAS_SIBLINGS           (-22712)
 /** The XAR table of content digest doesn't match. */
@@ -1942,6 +1955,31 @@ RT_C_DECLS_END
 #define VERR_XAR_ARCHIVED_AND_EXTRACTED_SIZES_MISMATCH (-22739)
 /** @} */
 
+/** @name RTX509 status codes
+ * @{ */
+/** Error reading a certificate in PEM format from BIO. */
+#define VERR_X509_READING_CERT_FROM_BIO                  (-23100)
+/** Error extracting a public key from the certificate. */
+#define VERR_X509_EXTRACT_PUBKEY_FROM_CERT               (-23101)
+/** Error extracting RSA from the public key. */
+#define VERR_X509_EXTRACT_RSA_FROM_PUBLIC_KEY            (-23102)
+/** Signature verification failed. */
+#define VERR_X509_RSA_VERIFICATION_FUILURE               (-23103)
+/** Basic constraints were not found. */
+#define VERR_X509_NO_BASIC_CONSTARAINTS                  (-23104)
+/** Error getting extensions from the certificate. */
+#define VERR_X509_GETTING_EXTENSION_FROM_CERT            (-23105)
+/** Error getting a data from the extension. */
+#define VERR_X509_GETTING_DATA_FROM_EXTENSION            (-23106)
+/** Error formatting an extension. */
+#define VERR_X509_PRINT_EXTENSION_TO_BIO                 (-23107)
+/** X509 certificate verification error. */
+#define VERR_X509_CERTIFICATE_VERIFICATION_FAILURE       (-23108)
+/** X509 certificate isn't self signed. */
+#define VERR_X509_NOT_SELFSIGNED_CERTIFICATE             (-23109)
+/** Warning X509 certificate isn't self signed.  */
+#define VINF_X509_NOT_SELFSIGNED_CERTIFICATE             23109
+/** @} */
 
 /** @name RTAsn1 status codes
  * @{ */
@@ -2076,45 +2114,45 @@ RT_C_DECLS_END
 
 /** @name More RTLdr status codes.
  * @{ */
-/** Image Verficiation Failure: No Authenticode Signature. */
+/** Image Verification Failure: No Authenticode Signature. */
 #define VERR_LDRVI_NOT_SIGNED                       (-22900)
-/** Image Verficiation Warning: No Authenticode Signature, but on whitelist. */
+/** Image Verification Warning: No Authenticode Signature, but on whitelist. */
 #define VINF_LDRVI_NOT_SIGNED                       (22900)
-/** Image Verficiation Failure: Error reading image headers.  */
+/** Image Verification Failure: Error reading image headers.  */
 #define VERR_LDRVI_READ_ERROR_HDR                   (-22901)
-/** Image Verficiation Failure: Error reading section headers. */
+/** Image Verification Failure: Error reading section headers. */
 #define VERR_LDRVI_READ_ERROR_SHDRS                 (-22902)
-/** Image Verficiation Failure: Error reading authenticode signature data. */
+/** Image Verification Failure: Error reading authenticode signature data. */
 #define VERR_LDRVI_READ_ERROR_SIGNATURE             (-22903)
-/** Image Verficiation Failure: Error reading file for hashing. */
+/** Image Verification Failure: Error reading file for hashing. */
 #define VERR_LDRVI_READ_ERROR_HASH                  (-22904)
-/** Image Verficiation Failure: Error determining the file length. */
+/** Image Verification Failure: Error determining the file length. */
 #define VERR_LDRVI_FILE_LENGTH_ERROR                (-22905)
-/** Image Verficiation Failure: Error allocating memory for state data. */
+/** Image Verification Failure: Error allocating memory for state data. */
 #define VERR_LDRVI_NO_MEMORY_STATE                  (-22906)
-/** Image Verficiation Failure: Error allocating memory for authenticode
+/** Image Verification Failure: Error allocating memory for authenticode
  *  signature data. */
 #define VERR_LDRVI_NO_MEMORY_SIGNATURE              (-22907)
-/** Image Verficiation Failure: Error allocating memory for section headers. */
+/** Image Verification Failure: Error allocating memory for section headers. */
 #define VERR_LDRVI_NO_MEMORY_SHDRS                  (-22908)
-/** Image Verficiation Failure: Authenticode parsing output. */
+/** Image Verification Failure: Authenticode parsing output. */
 #define VERR_LDRVI_NO_MEMORY_PARSE_OUTPUT           (-22909)
-/** Image Verficiation Failure: Invalid security directory entry. */
+/** Image Verification Failure: Invalid security directory entry. */
 #define VERR_LDRVI_INVALID_SECURITY_DIR_ENTRY       (-22910)
-/** Image Verficiation Failure:  */
+/** Image Verification Failure:  */
 #define VERR_LDRVI_BAD_CERT_HDR_LENGTH              (-22911)
-/** Image Verficiation Failure:  */
+/** Image Verification Failure:  */
 #define VERR_LDRVI_BAD_CERT_HDR_REVISION            (-22912)
-/** Image Verficiation Failure:  */
+/** Image Verification Failure:  */
 #define VERR_LDRVI_BAD_CERT_HDR_TYPE                (-22913)
-/** Image Verficiation Failure: More than one certificate table entry.  */
+/** Image Verification Failure: More than one certificate table entry.  */
 #define VERR_LDRVI_BAD_CERT_MULTIPLE                (-22914)
 
-/** Image Verficiation Failure:  */
+/** Image Verification Failure:  */
 #define VERR_LDRVI_BAD_MZ_OFFSET                    (-22915)
-/** Image Verficiation Failure: Invalid section count. */
+/** Image Verification Failure: Invalid section count. */
 #define VERR_LDRVI_INVALID_SECTION_COUNT            (-22916)
-/** Image Verficiation Failure: Raw data offsets and sizes are out of range. */
+/** Image Verification Failure: Raw data offsets and sizes are out of range. */
 #define VERR_LDRVI_SECTION_RAW_DATA_VALUES          (-22917)
 /** Optional header magic and target machine does not match. */
 #define VERR_LDRVI_MACHINE_OPT_HDR_MAGIC_MISMATCH   (-22918)
@@ -2135,7 +2173,7 @@ RT_C_DECLS_END
 #define VERR_LDRVI_PAGE_HASH_TAB_TOO_LONG           (-22925)
 /** The page hash table is not strictly ordered by offset. */
 #define VERR_LDRVI_PAGE_HASH_TAB_NOT_STRICTLY_SORTED (-22926)
-/** The page hash table hashes data outside the defined and implict sections. */
+/** The page hash table hashes data outside the defined and implicit sections. */
 #define VERR_PAGE_HASH_TAB_HASHES_NON_SECTION_DATA  (-22927)
 /** Page hash mismatch. */
 #define VERR_LDRVI_PAGE_HASH_MISMATCH               (-22928)
@@ -2171,8 +2209,8 @@ RT_C_DECLS_END
 #define VERR_CR_X509_UNKNOWN_CERT_SIGN_ALGO         (-23005)
 /** Certificate signature algorithm mismatch. */
 #define VERR_CR_X509_CERT_SIGN_ALGO_MISMATCH        (-23006)
-/** The signature algorithm in the to-be-signed certifcate part does not match
- * the one assoicated with the signature. */
+/** The signature algorithm in the to-be-signed certificate part does not match
+ * the one associated with the signature. */
 #define VERR_CR_X509_CERT_TBS_SIGN_ALGO_MISMATCH    (-23007)
 /** Certificate extensions requires certificate version 3 or later.  */
 #define VERR_CR_X509_TBSCERT_EXTS_REQ_V3            (-23008)
@@ -2184,7 +2222,7 @@ RT_C_DECLS_END
 #define VERR_CR_X509_TBSCERT_UNSUPPORTED_VERSION    (-23011)
 /** Public key is too small. */
 #define VERR_CR_X509_PUBLIC_KEY_TOO_SMALL           (-23012)
-/** Invalid strnig tag for a X.509 name object. */
+/** Invalid string tag for a X.509 name object. */
 #define VERR_CR_X509_INVALID_NAME_STRING_TAG        (-23013)
 /** Empty string in X.509 name object. */
 #define VERR_CR_X509_NAME_EMPTY_STRING              (-23014)
@@ -2216,7 +2254,7 @@ RT_C_DECLS_END
 /** Certificate path validator: Intermediate certificate is not marked as a
  *  certificate authority (CA). */
 #define VERR_CR_X509_CPV_NOT_CA_CERT                (-23026)
-/** Certificate path validator: Intermeidate certificate is not a version 3
+/** Certificate path validator: Intermediate certificate is not a version 3
  *  certificate. */
 #define VERR_CR_X509_CPV_NOT_V3_CERT                (-23027)
 /** Certificate path validator: Invalid policy mapping (to/from anyPolicy). */
@@ -2233,7 +2271,7 @@ RT_C_DECLS_END
  *  match child issuer property. */
 #define VERR_CR_X509_CPV_ISSUER_MISMATCH            (-23032)
 /** Certificate path validator: The certificate is not valid at the
- *  specificed time. */
+ *  specified time. */
 #define VERR_CR_X509_CPV_NOT_VALID_AT_TIME          (-23033)
 /** Certificate path validator: Unexpected choice found in general subtree
  *  object (name constraints). */
@@ -2254,7 +2292,7 @@ RT_C_DECLS_END
  * @{ */
 /** Generic PKCS \#7 error. */
 #define VERR_CR_PKCS7_GENERIC_ERROR                             (-23300)
-/** Signed data verfication failed because there are zero signer infos. */
+/** Signed data verification failed because there are zero signer infos. */
 #define VERR_CR_PKCS7_NO_SIGNER_INFOS                           (-23301)
 /** Signed data certificate not found. */
 #define VERR_CR_PKCS7_SIGNED_DATA_CERT_NOT_FOUND                (-23302)
@@ -2300,7 +2338,7 @@ RT_C_DECLS_END
 #define VERR_CR_PKCS7_TOO_MANY_DIGEST_ALGORITHMS                (-22318)
 /** Error creating digest algorithm calculator. */
 #define VERR_CR_PKCS7_DIGEST_CREATE_ERROR                       (-22319)
-/** Error while calculating a digest for a PKCS \#7 verficiation operation. */
+/** Error while calculating a digest for a PKCS \#7 verification operation. */
 #define VERR_CR_PKCS7_DIGEST_CALC_ERROR                         (-22320)
 /** Unsupported PKCS \#7 signed data version. */
 #define VERR_CR_PKCS7_SIGNED_DATA_VERSION                       (-22350)
@@ -2343,7 +2381,7 @@ RT_C_DECLS_END
 #define VERR_CR_SPC_UNKNOWN_DIGEST_ALGO                         (-23405)
 /** The indirect data digest size does not match the digest algorithm. */
 #define VERR_CR_SPC_IND_DATA_DIGEST_SIZE_MISMATCH               (-23406)
-/** Exptected PE image data inside indirect data object. */
+/** Expected PE image data inside indirect data object. */
 #define VERR_CR_SPC_EXPECTED_PE_IMAGE_DATA                      (-23407)
 /** Internal SPC error: The PE image data is missing.  */
 #define VERR_CR_SPC_PEIMAGE_DATA_NOT_PRESENT                    (-23408)
@@ -2351,10 +2389,10 @@ RT_C_DECLS_END
 #define VERR_CR_SPC_BAD_MONIKER_UUID                            (-23409)
 /** Unknown SPC object moniker UUID. */
 #define VERR_CR_SPC_UNKNOWN_MONIKER_UUID                        (-23410)
-/** Internal SPC error: Bad object monker choice value. */
+/** Internal SPC error: Bad object moniker choice value. */
 #define VERR_CR_SPC_BAD_MONIKER_CHOICE                          (-23411)
 /** Internal SPC error: Bad object moniker data pointer. */
-#define VERR_CR_SPC_MONIKER_BAD_DATA                            (-23412)
+#define VERR_CR_SPC_MONIKER_BAD_DATA                             (-23412)
 /** Multiple PE image page hash tables. */
 #define VERR_CR_SPC_PEIMAGE_MULTIPLE_HASH_TABS                  (-23413)
 /** Unknown SPC PE image attribute. */
@@ -2389,7 +2427,7 @@ RT_C_DECLS_END
 #define VERR_CR_PKIX_SIGNATURE_MISMATCH             (-23509)
 /** PKIX cipher algorithm parameters are not implemented. */
 #define VERR_CR_PKIX_CIPHER_ALGO_PARAMS_NOT_IMPL    (-23510)
-/** ipher algorithm is not known to us. */
+/** Cipher algorithm is not known to us. */
 #define VERR_CR_PKIX_CIPHER_ALGO_NOT_KNOWN          (-23511)
 /** PKIX cipher algorithm is not known to OpenSSL. */
 #define VERR_CR_PKIX_OSSL_CIPHER_ALGO_NOT_KNOWN     (-23512)
@@ -2432,7 +2470,7 @@ RT_C_DECLS_END
  * @{ */
 /** OpenSSL failed to initialize the digest algorithm contextn. */
 #define VERR_CR_DIGEST_OSSL_DIGEST_INIT_ERROR       (-24200)
-/** OpenSSL failed to clone the digest algorithm contextn. */
+/** OpenSSL failed to clone the digest algorithm context. */
 #define VERR_CR_DIGEST_OSSL_DIGEST_CTX_COPY_ERROR   (-24201)
 /** @} */
 
diff --git a/include/iprt/err.mac b/include/iprt/err.mac
index ae04288..ab5fc9c 100644
--- a/include/iprt/err.mac
+++ b/include/iprt/err.mac
@@ -128,6 +128,8 @@
 %define VERR_UNABLE_TO_SATISFY_REQUIREMENTS    (-22406)
 %define VWRN_UNABLE_TO_SATISFY_REQUIREMENTS    22406
 %define VERR_ALLOCATION_TOO_BIG    (-22407)
+%define VERR_MISMATCH    (-22408)
+%define VERR_WRONG_TYPE    (-22409)
 %define VERR_FILE_IO_ERROR    (-100)
 %define VERR_OPEN_FAILED    (-101)
 %define VERR_FILE_NOT_FOUND    (-102)
@@ -176,6 +178,7 @@
 %define VERR_PATH_IS_RELATIVE    (-143)
 %define VERR_PATH_IS_NOT_RELATIVE    (-144)
 %define VERR_PATH_ZERO_LENGTH    (-145)
+%define VERR_FILE_AIO_INSUFFICIENT_EVENTS    (-146)
 %define VERR_DISK_IO_ERROR    (-150)
 %define VERR_INVALID_DRIVE    (-151)
 %define VERR_DISK_FULL    (-152)
@@ -405,6 +408,8 @@
 %define VWRN_ENV_NOT_FULLY_TRANSLATED    (751)
 %define VERR_CPU_OFFLINE    (-800)
 %define VERR_CPU_NOT_FOUND    (-801)
+%define VERR_NOT_ALL_CPUS_SHOWED    (-802)
+%define VERR_CPU_IPE_1    (-803)
 %define VERR_GETOPT_UNKNOWN_OPTION    (-825)
 %define VERR_GETOPT_REQUIRED_ARGUMENT_MISSING    (-826)
 %define VERR_GETOPT_INVALID_ARGUMENT_FORMAT    (-827)
@@ -534,6 +539,17 @@
 %define VERR_XAR_ARCHIVED_HASH_MISMATCH    (-22737)
 %define VERR_XAR_UNUSED_ARCHIVED_DATA    (-22738)
 %define VERR_XAR_ARCHIVED_AND_EXTRACTED_SIZES_MISMATCH    (-22739)
+%define VERR_X509_READING_CERT_FROM_BIO    (-23100)
+%define VERR_X509_EXTRACT_PUBKEY_FROM_CERT    (-23101)
+%define VERR_X509_EXTRACT_RSA_FROM_PUBLIC_KEY    (-23102)
+%define VERR_X509_RSA_VERIFICATION_FUILURE    (-23103)
+%define VERR_X509_NO_BASIC_CONSTARAINTS    (-23104)
+%define VERR_X509_GETTING_EXTENSION_FROM_CERT    (-23105)
+%define VERR_X509_GETTING_DATA_FROM_EXTENSION    (-23106)
+%define VERR_X509_PRINT_EXTENSION_TO_BIO    (-23107)
+%define VERR_X509_CERTIFICATE_VERIFICATION_FAILURE    (-23108)
+%define VERR_X509_NOT_SELFSIGNED_CERTIFICATE    (-23109)
+%define VINF_X509_NOT_SELFSIGNED_CERTIFICATE    23109
 %define VERR_ASN1_ERROR    (-22800)
 %define VERR_ASN1_STRING_TYPE_NOT_IMPLEMENTED    (-22801)
 %define VERR_ASN1_INVALID_UTF8_STRING_ENCODING    (-22802)
diff --git a/include/iprt/file.h b/include/iprt/file.h
index 616dace..351a994 100644
--- a/include/iprt/file.h
+++ b/include/iprt/file.h
@@ -511,8 +511,8 @@ RTDECL(bool) RTFileIsValid(RTFILE File);
 /**
  * Copies a file.
  *
- * @returns VERR_ALREADY_EXISTS if the destination file exists.
- * @returns VBox Status code.
+ * @returns IPRT status code
+ * @retval VERR_ALREADY_EXISTS if the destination file exists.
  *
  * @param   pszSrc      The path to the source file.
  * @param   pszDst      The path to the destination file.
@@ -523,7 +523,7 @@ RTDECL(int) RTFileCopy(const char *pszSrc, const char *pszDst);
 /**
  * Copies a file given the handles to both files.
  *
- * @returns VBox Status code.
+ * @returns IPRT status code
  *
  * @param   FileSrc     The source file. The file position is unaltered.
  * @param   FileDst     The destination file.
@@ -547,8 +547,8 @@ RTDECL(int) RTFileCopyByHandles(RTFILE FileSrc, RTFILE FileDst);
 /**
  * Copies a file.
  *
- * @returns VERR_ALREADY_EXISTS if the destination file exists.
- * @returns VBox Status code.
+ * @returns IPRT status code
+ * @retval  VERR_ALREADY_EXISTS if the destination file exists.
  *
  * @param   pszSrc      The path to the source file.
  * @param   pszDst      The path to the destination file.
@@ -574,6 +574,77 @@ RTDECL(int) RTFileCopyEx(const char *pszSrc, const char *pszDst, uint32_t fFlags
  */
 RTDECL(int) RTFileCopyByHandlesEx(RTFILE FileSrc, RTFILE FileDst, PFNRTPROGRESS pfnProgress, void *pvUser);
 
+
+/**
+ * Compares two file given the paths to both files.
+ *
+ * @returns IPRT status code.
+ * @retval  VINF_SUCCESS if equal.
+ * @retval  VERR_NOT_EQUAL if not equal.
+ *
+ * @param   pszFile1    The path to the first file.
+ * @param   pszFile2    The path to the second file.
+ */
+RTDECL(int) RTFileCompare(const char *pszFile1, const char *pszFile2);
+
+/**
+ * Compares two file given the handles to both files.
+ *
+ * @returns IPRT status code.
+ * @retval  VINF_SUCCESS if equal.
+ * @retval  VERR_NOT_EQUAL if not equal.
+ *
+ * @param   hFile1      The first file.  Undefined return position.
+ * @param   hFile2      The second file.  Undefined return position.
+ */
+RTDECL(int) RTFileCompareByHandles(RTFILE hFile1, RTFILE hFile2);
+
+/** Flags for RTFileCompareEx().
+ * @{ */
+/** Do not use RTFILE_O_DENY_WRITE on the first file. */
+#define RTFILECOMP_FLAGS_NO_DENY_WRITE_FILE1  RT_BIT(0)
+/** Do not use RTFILE_O_DENY_WRITE on the second file. */
+#define RTFILECOMP_FLAGS_NO_DENY_WRITE_FILE2  RT_BIT(1)
+/** Do not use RTFILE_O_DENY_WRITE on either of the two files. */
+#define RTFILECOMP_FLAGS_NO_DENY_WRITE      ( RTFILECOMP_FLAGS_NO_DENY_WRITE_FILE1 | RTFILECOMP_FLAGS_NO_DENY_WRITE_FILE2 )
+/** */
+#define RTFILECOMP_FLAGS_MASK               UINT32_C(0x00000003)
+/** @} */
+
+/**
+ * Compares two files, extended version with progress callback.
+ *
+ * @returns IPRT status code.
+ * @retval  VINF_SUCCESS if equal.
+ * @retval  VERR_NOT_EQUAL if not equal.
+ *
+ * @param   pszFile1    The path to the source file.
+ * @param   pszFile2    The path to the destination file. This file will be
+ *                      created.
+ * @param   fFlags      Flags, any of the RTFILECOMP_FLAGS_ \#defines.
+ * @param   pfnProgress Pointer to callback function for reporting progress.
+ * @param   pvUser      User argument to pass to pfnProgress along with the completion percentage.
+ */
+RTDECL(int) RTFileCompareEx(const char *pszFile1, const char *pszFile2, uint32_t fFlags, PFNRTPROGRESS pfnProgress, void *pvUser);
+
+/**
+ * Compares two files given their handles, extended version with progress
+ * callback.
+ *
+ * @returns IPRT status code.
+ * @retval  VINF_SUCCESS if equal.
+ * @retval  VERR_NOT_EQUAL if not equal.
+ *
+ * @param   hFile1      The first file.  Undefined return position.
+ * @param   hFile2      The second file.  Undefined return position.
+ *
+ * @param   fFlags      Flags, any of the RTFILECOMP_FLAGS_ \#defines, flags
+ *                      related to opening of the files will be ignored.
+ * @param   pfnProgress Pointer to callback function for reporting progress.
+ * @param   pvUser      User argument to pass to pfnProgress along with the completion percentage.
+ */
+RTDECL(int) RTFileCompareByHandlesEx(RTFILE hFile1, RTFILE hFile2, uint32_t fFlags, PFNRTPROGRESS pfnProgress, void *pvUser);
+
 /**
  * Renames a file.
  *
diff --git a/include/iprt/filesystem.h b/include/iprt/filesystem.h
index 82ab146..46b15e7 100644
--- a/include/iprt/filesystem.h
+++ b/include/iprt/filesystem.h
@@ -32,7 +32,11 @@
 
 RT_C_DECLS_BEGIN
 
-/** @defgroup grp_filesystem           IPRT Filesystem VFS
+/** @defgroup grp_rt_filesystem           IPRT Filesystem VFS
+ *
+ * @todo r=bird: WRONG WRONG WRONG FILE. We already have a file system API in
+ * IPRT, it is RTFs*, see @ref grp_rt_fs.  NOBODY ADDS ANY NEW APIS HERE!!
+ *
  * @{
  */
 
diff --git a/include/iprt/ldr.h b/include/iprt/ldr.h
index af94813..525f1b3 100644
--- a/include/iprt/ldr.h
+++ b/include/iprt/ldr.h
@@ -1001,6 +1001,7 @@ typedef enum RTLDRPROP
      * @remarks This generally starts with a PKCS \#7 Content structure, the
      *          SignedData bit is found a few levels down into this as per RFC. */
     RTLDRPROP_PKCS7_SIGNED_DATA,
+
     /** Query whether code signature checks are enabled.  */
     RTLDRPROP_SIGNATURE_CHECKS_ENFORCED,
 
diff --git a/include/iprt/linux/sysfs.h b/include/iprt/linux/sysfs.h
index c486279..631ad22 100644
--- a/include/iprt/linux/sysfs.h
+++ b/include/iprt/linux/sysfs.h
@@ -207,13 +207,8 @@ RTDECL(ssize_t) RTLinuxSysFsGetLinkDestV(char *pszBuf, size_t cchBuf, const char
 RTDECL(ssize_t) RTLinuxSysFsGetLinkDest(char *pszBuf, size_t cchBuf, const char *pszFormat, ...);
 
 /**
- * Find the path of a device node under /dev, given then device number.
- *
- * This function will recursively search under /dev until it finds a device node
- * matching @a devnum, and store the path into @a pszBuf.  The caller may
- * provide an expected path in pszSuggestion, which will be tried before
- * searching, but due to the variance in Linux systems it can be hard to always
- * correctly predict the path.
+ * Check the path of a device node under /dev, given the device number and a
+ * pattern and store the path into @a pszBuf.
  *
  * @returns The length of the returned string on success, -1 and errno on
  *          failure.
@@ -223,21 +218,17 @@ RTDECL(ssize_t) RTLinuxSysFsGetLinkDest(char *pszBuf, size_t cchBuf, const char
  *                         RTFS_TYPE_DEV_BLOCK are valid values.
  * @param   pszBuf         Where to store the path.
  * @param   cchBuf         The size of the buffer.
- * @param   pszSuggestion  The expected path format of the device node, either
- *                         absolute or relative to "/dev". (Optional)
+ * @param   pszPattern     The expected path format of the device node, either
+ *                         absolute or relative to "/dev".
  * @param   va             Format args.
  */
-RTDECL(ssize_t) RTLinuxFindDevicePathV(dev_t DevNum, RTFMODE fMode, char *pszBuf, size_t cchBuf,
-                                       const char *pszSuggestion, va_list va);
+RTDECL(ssize_t) RTLinuxCheckDevicePathV(dev_t DevNum, RTFMODE fMode,
+                                        char *pszBuf, size_t cchBuf,
+                                        const char *pszPattern, va_list va);
 
 /**
- * Find the path of a device node under /dev, given the device number.
- *
- * This function will recursively search under /dev until it finds a device node
- * matching @a devnum, and store the path into @a pszBuf.  The caller may
- * provide an expected path in pszSuggestion, which will be tried before
- * searching, but due to the variance in Linux systems it can be hard to always
- * correctly predict the path.
+ * Check the path of a device node under /dev, given the device number and a
+ * pattern and store the path into @a pszBuf.
  *
  * @returns The length of the returned string on success, -1 and errno on
  *          failure.
@@ -247,12 +238,13 @@ RTDECL(ssize_t) RTLinuxFindDevicePathV(dev_t DevNum, RTFMODE fMode, char *pszBuf
  *                          RTFS_TYPE_DEV_BLOCK are valid values
  * @param   pszBuf          Where to store the path.
  * @param   cchBuf          The size of the buffer.
- * @param   pszSuggestion   The expected path format of the device node, either
- *                          absolute or relative to "/dev". (Optional)
+ * @param   pszPattern      The expected path format of the device node, either
+ *                          absolute or relative to "/dev".
  * @param   ...             Format args.
  */
-RTDECL(ssize_t) RTLinuxFindDevicePath(dev_t DevNum, RTFMODE fMode, char *pszBuf, size_t cchBuf,
-                                      const char *pszSuggestion, ...);
+RTDECL(ssize_t) RTLinuxCheckDevicePath(dev_t DevNum, RTFMODE fMode,
+                                       char *pszBuf, size_t cchBuf,
+                                       const char *pszPattern, ...);
 
 /** @} */
 
diff --git a/include/iprt/list-off32.h b/include/iprt/list-off32.h
new file mode 100644
index 0000000..9026772
--- /dev/null
+++ b/include/iprt/list-off32.h
@@ -0,0 +1,502 @@
+/** @file
+ * IPRT - Generic Doubly Linked List, using 32-bit offset instead of pointers.
+ */
+
+/*
+ * Copyright (C) 2010-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifndef ___iprt_list_off32_h
+#define ___iprt_list_off32_h
+
+#include <iprt/types.h>
+
+/* @defgroup grp_rt_list_off32 RTListOff32 - Generic Doubly Linked List based on 32-bit offset.
+ * @ingroup grp_rt
+ *
+ * This is the same as @link grp_rt_list, except that instead of pointers we
+ * use 32-bit offsets.  The list implementation is circular, with a dummy node
+ * as anchor.  Be careful with the dummy node when walking the list.
+ *
+ * @{
+ */
+
+RT_C_DECLS_BEGIN
+
+/**
+ * A list node of a doubly linked list.
+ */
+typedef struct RTLISTOFF32NODE
+{
+    /** Offset to the next list node, relative to this structure. */
+    int32_t offNext;
+    /** Offset to the previous list node, relative to this structure. */
+    int32_t offPrev;
+} RTLISTOFF32NODE;
+/** Pointer to a list node. */
+typedef RTLISTOFF32NODE *PRTLISTOFF32NODE;
+/** Pointer to a const list node. */
+typedef RTLISTOFF32NODE const *PCRTLISTOFF32NODE;
+/** Pointer to a list node pointer. */
+typedef PRTLISTOFF32NODE *PPRTLISTOFF32NODE;
+
+/** The anchor (head/tail) of a doubly linked list.
+ *
+ * @remarks Please always use this instead of RTLISTOFF32NODE to indicate a list
+ *          head/tail.  It makes the code so much easier to read.  Also,
+ *          always mention the actual list node type(s) in the comment.
+ * @remarks Must be allocated in a similar manner as the nodes, so as to
+ *          keep it within a 32-bit distance from them.
+ */
+typedef RTLISTOFF32NODE RTLISTOFF32ANCHOR;
+/** Pointer to a doubly linked list anchor. */
+typedef RTLISTOFF32ANCHOR *PRTLISTOFF32ANCHOR;
+/** Pointer to a const doubly linked list anchor. */
+typedef RTLISTOFF32ANCHOR const *PCRTLISTOFF32ANCHOR;
+
+
+/**
+ * Initialize a list.
+ *
+ * @param   pList               Pointer to an unitialised list.
+ */
+DECLINLINE(void) RTListOff32Init(PRTLISTOFF32NODE pList)
+{
+    pList->offNext = 0;
+    pList->offPrev = 0;
+}
+
+/**
+ * Internal macro for converting an offset to a pointer.
+ * @returns PRTLISTOFF32NODE
+ * @param   a_pNode             The node the offset is relative to.
+ * @param   a_off               The offset.
+ */
+#define RTLISTOFF32_TO_PTR(a_pNode, a_off)          ((PRTLISTOFF32NODE)((intptr_t)(a_pNode) + (a_off)))
+
+/**
+ * Internal macro for getting the pointer to the next node.
+ * @returns PRTLISTOFF32NODE
+ * @param   a_pNode             The node the offset is relative to.
+ */
+#define RTLISTOFF32_NEXT_PTR(a_pNode)               RTLISTOFF32_TO_PTR(a_pNode, (a_pNode)->offNext)
+
+/**
+ * Internal macro for getting the pointer to the previous node.
+ * @returns PRTLISTOFF32NODE
+ * @param   a_pNode             The node the offset is relative to.
+ */
+#define RTLISTOFF32_PREV_PTR(a_pNode)               RTLISTOFF32_TO_PTR(a_pNode, (a_pNode)->offPrev)
+
+/**
+ * Internal macro for converting an a pointer to an offset.
+ * @returns offset
+ * @param   a_pNode             The node the offset is relative to.
+ * @param   a_pOtherNode        The pointer to convert.
+ */
+#define RTLISTOFF32_TO_OFF(a_pNode, a_pOtherNode)   ((int32_t)((intptr_t)(a_pOtherNode) - (intptr_t)(a_pNode)))
+
+/**
+ * Internal macro for getting the pointer to the next node.
+ * @returns PRTLISTOFF32NODE
+ * @param   a_pNode             The node which offNext member should be set.
+ * @param   a_pNewNext          Pointer to the new next node.
+ */
+#define RTLISTOFF32_SET_NEXT_PTR(a_pNode, a_pNewNext) \
+    do { (a_pNode)->offNext = RTLISTOFF32_TO_OFF(a_pNode, a_pNewNext); } while (0)
+
+/**
+ * Internal macro for getting the pointer to the previous node.
+ * @returns PRTLISTOFF32NODE
+ * @param   a_pNode             The node which offPrev member should be set.
+ * @param   a_pNewPrev          Pointer to the new previous node.
+ */
+#define RTLISTOFF32_SET_PREV_PTR(a_pNode, a_pNewPrev) \
+    do { (a_pNode)->offPrev = RTLISTOFF32_TO_OFF(a_pNode, a_pNewPrev); } while (0)
+
+
+
+/**
+ * Append a node to the end of the list.
+ *
+ * @param   pList               The list to append the node to.
+ * @param   pNode               The node to append.
+ */
+DECLINLINE(void) RTListOff32Append(PRTLISTOFF32NODE pList, PRTLISTOFF32NODE pNode)
+{
+    PRTLISTOFF32NODE pLast = RTLISTOFF32_PREV_PTR(pList);
+    RTLISTOFF32_SET_NEXT_PTR(pLast, pNode);
+    RTLISTOFF32_SET_PREV_PTR(pNode, pLast);
+    RTLISTOFF32_SET_NEXT_PTR(pNode, pList);
+    RTLISTOFF32_SET_PREV_PTR(pList, pNode);
+}
+
+/**
+ * Add a node as the first element of the list.
+ *
+ * @param   pList               The list to prepend the node to.
+ * @param   pNode               The node to prepend.
+ */
+DECLINLINE(void) RTListOff32Prepend(PRTLISTOFF32NODE pList, PRTLISTOFF32NODE pNode)
+{
+    PRTLISTOFF32NODE pFirst = RTLISTOFF32_NEXT_PTR(pList);
+    RTLISTOFF32_SET_PREV_PTR(pFirst, pNode);
+    RTLISTOFF32_SET_NEXT_PTR(pNode, pFirst);
+    RTLISTOFF32_SET_PREV_PTR(pNode, pList);
+    RTLISTOFF32_SET_NEXT_PTR(pList, pNode);
+}
+
+/**
+ * Inserts a node after the specified one.
+ *
+ * @param   pCurNode            The current node.
+ * @param   pNewNode            The node to insert.
+ */
+DECLINLINE(void) RTListOff32NodeInsertAfter(PRTLISTOFF32NODE pCurNode, PRTLISTOFF32NODE pNewNode)
+{
+    RTListOff32Prepend(pCurNode, pNewNode);
+}
+
+/**
+ * Inserts a node before the specified one.
+ *
+ * @param   pCurNode            The current node.
+ * @param   pNewNode            The node to insert.
+ */
+DECLINLINE(void) RTListOff32NodeInsertBefore(PRTLISTOFF32NODE pCurNode, PRTLISTOFF32NODE pNewNode)
+{
+    RTListOff32Append(pCurNode, pNewNode);
+}
+
+/**
+ * Remove a node from a list.
+ *
+ * @param   pNode               The node to remove.
+ */
+DECLINLINE(void) RTListOff32NodeRemove(PRTLISTOFF32NODE pNode)
+{
+    PRTLISTOFF32NODE pPrev = RTLISTOFF32_PREV_PTR(pNode);
+    PRTLISTOFF32NODE pNext = RTLISTOFF32_NEXT_PTR(pNode);
+
+    RTLISTOFF32_SET_NEXT_PTR(pPrev, pNext);
+    RTLISTOFF32_SET_PREV_PTR(pNext, pPrev);
+
+    /* poison */
+    pNode->offNext = INT32_MAX / 2;
+    pNode->offPrev = INT32_MAX / 2;
+}
+
+/**
+ * Checks if a node is the last element in the list.
+ *
+ * @retval  @c true if the node is the last element in the list.
+ * @retval  @c false otherwise
+ *
+ * @param   pList               The list.
+ * @param   pNode               The node to check.
+ */
+#define RTListOff32NodeIsLast(pList, pNode)  (RTLISTOFF32_NEXT_PTR(pNode) == (pList))
+
+/**
+ * Checks if a node is the first element in the list.
+ *
+ * @retval  @c true if the node is the first element in the list.
+ * @retval  @c false otherwise.
+ *
+ * @param   pList               The list.
+ * @param   pNode               The node to check.
+ */
+#define RTListOff32NodeIsFirst(pList, pNode) (RTLISTOFF32_PREV_PTR(pNode) == (pList))
+
+/**
+ * Checks if a type converted node is actually the dummy element (@a pList).
+ *
+ * @retval  @c true if the node is the dummy element in the list.
+ * @retval  @c false otherwise.
+ *
+ * @param   pList               The list.
+ * @param   pNodeStruct         The node structure to check.  Typically
+ *                              something obtained from RTListOff32NodeGetNext()
+ *                              or RTListOff32NodeGetPrev().  This is NOT a
+ *                              PRTLISTOFF32NODE but something that contains a
+ *                              RTLISTOFF32NODE member!
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member.
+ */
+#define RTListOff32NodeIsDummy(pList, pNode, Type, Member) \
+         ( (pNode) == RT_FROM_MEMBER((pList), Type, Member) )
+/** @copydoc RTListOff32NodeIsDummy */
+#define RTListOff32NodeIsDummyCpp(pList, pNode, Type, Member) \
+         ( (pNode) == RT_FROM_CPP_MEMBER((pList), Type, Member) )
+
+/**
+ * Checks if a list is empty.
+ *
+ * @retval  @c true if the list is empty.
+ * @retval  @c false otherwise.
+ *
+ * @param   pList               The list to check.
+ */
+#define RTListOff32IsEmpty(pList)   ((pList)->offNext == 0)
+
+/**
+ * Returns the next node in the list.
+ *
+ * @returns The next node.
+ *
+ * @param   pCurNode            The current node.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member.
+ */
+#define RTListOff32NodeGetNext(pCurNode, Type, Member) \
+    RT_FROM_MEMBER(RTLISTOFF32_NEXT_PTR(pCurNode), Type, Member)
+/** @copydoc RTListOff32NodeGetNext */
+#define RTListOff32NodeGetNextCpp(pCurNode, Type, Member) \
+    RT_FROM_CPP_MEMBER(RTLISTOFF32_NEXT_PTR(pCurNode), Type, Member)
+
+/**
+ * Returns the previous node in the list.
+ *
+ * @returns The previous node.
+ *
+ * @param   pCurNode            The current node.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member.
+ */
+#define RTListOff32NodeGetPrev(pCurNode, Type, Member) \
+    RT_FROM_MEMBER(RTLISTOFF32_PREV_PTR(pCurNode), Type, Member)
+/** @copydoc RTListOff32NodeGetPrev */
+#define RTListOff32NodeGetPrevCpp(pCurNode, Type, Member) \
+    RT_FROM_CPP_MEMBER(RTLISTOFF32_PREV_PTR(pCurNode), Type, Member)
+
+/**
+ * Returns the first element in the list (checks for empty list).
+ *
+ * @retval  Pointer to the first list element.
+ * @retval  NULL if the list is empty.
+ *
+ * @param   pList               List to get the first element from.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member.
+ */
+#define RTListOff32GetFirst(pList, Type, Member) \
+    ((pList)->offNext != 0 ? RTListOff32NodeGetNext(pList, Type, Member) : NULL)
+/** @copydoc RTListOff32GetFirst */
+#define RTListOff32GetFirstCpp(pList, Type, Member) \
+    ((pList)->offNext != 0 ? RTListOff32NodeGetNextCpp(pList, Type, Member) : NULL)
+
+/**
+ * Returns the last element in the list (checks for empty list).
+ *
+ * @retval  Pointer to the last list element.
+ * @retval  NULL if the list is empty.
+ *
+ * @param   pList               List to get the last element from.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member.
+ */
+#define RTListOff32GetLast(pList, Type, Member) \
+    ((pList)->offPrev != 0 ? RTListOff32NodeGetPrev(pList, Type, Member) : NULL)
+/** @copydoc RTListOff32GetLast */
+#define RTListOff32GetLastCpp(pList, Type, Member) \
+    ((pList)->offPrev != 0 ? RTListOff32NodeGetPrevCpp(pList, Type, Member) : NULL)
+
+/**
+ * Returns the next node in the list or NULL if the end has been reached.
+ *
+ * @returns The next node or NULL.
+ *
+ * @param   pList               The list @a pCurNode is linked on.
+ * @param   pCurNode            The current node, of type @a Type.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member.
+ */
+#define RTListOff32GetNext(pList, pCurNode, Type, Member) \
+    ( RTLISTOFF32_NEXT_PTR(&(pCurNode)->Member) != (pList) \
+      ? RT_FROM_MEMBER(RTLISTOFF32_NEXT_PTR(&(pCurNode)->Member), Type, Member) : NULL )
+/** @copydoc RTListOff32GetNext */
+#define RTListOff32GetNextCpp(pList, pCurNode, Type, Member) \
+    ( RTLISTOFF32_NEXT_PTR(&(pCurNode)->Member) != (pList) \
+      ? RT_FROM_CPP_MEMBER(RTLISTOFF32_NEXT_PTR(&(pCurNode)->Member), Type, Member) : NULL )
+
+/**
+ * Returns the previous node in the list or NULL if the start has been reached.
+ *
+ * @returns The previous node or NULL.
+ *
+ * @param   pList               The list @a pCurNode is linked on.
+ * @param   pCurNode            The current node, of type @a Type.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member.
+ */
+#define RTListOff32GetPrev(pList, pCurNode, Type, Member) \
+    ( RTLISTOFF32_PREV_PTR(&(pCurNode)->Member) != (pList) \
+      ? RT_FROM_MEMBER(RTLISTOFF32_PREV_PTR(&(pCurNode)->Member), Type, Member) : NULL )
+/** @copydoc RTListOff32GetPrev */
+#define RTListOff32GetPrevCpp(pList, pCurNode, Type, Member) \
+    ( RTLISTOFF32_PREV_PTR(&(pCurNode)->Member) != (pList) \
+      ? RT_FROM_CPP_MEMBER(RTLISTOFF32_PREV_PTR(&(pCurNode)->Member), Type, Member) : NULL )
+
+/**
+ * Enumerate the list in head to tail order.
+ *
+ * @param   pList               List to enumerate.
+ * @param   pIterator           The iterator variable name.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member name.
+ */
+#define RTListOff32ForEach(pList, pIterator, Type, Member) \
+    for (pIterator = RTListOff32NodeGetNext(pList, Type, Member); \
+         !RTListOff32NodeIsDummy(pList, pIterator, Type, Member); \
+         pIterator = RT_FROM_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member) )
+/** @copydoc RTListOff32ForEach */
+#define RTListOff32ForEachCpp(pList, pIterator, Type, Member) \
+    for (pIterator = RTListOff32NodeGetNextCpp(pList, Type, Member); \
+         !RTListOff32NodeIsDummyCpp(pList, pIterator, Type, Member); \
+         pIterator = RT_FROM_CPP_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member) )
+
+
+/**
+ * Enumerate the list in head to tail order, safe against removal of the
+ * current node.
+ *
+ * @param   pList               List to enumerate.
+ * @param   pIterator           The iterator variable name.
+ * @param   pIterNext           The name of the variable saving the pointer to
+ *                              the next element.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member name.
+ */
+#define RTListOff32ForEachSafe(pList, pIterator, pIterNext, Type, Member) \
+    for (pIterator = RTListOff32NodeGetNext(pList, Type, Member), \
+         pIterNext = RT_FROM_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member); \
+         !RTListOff32NodeIsDummy(pList, pIterator, Type, Member); \
+         pIterator = pIterNext, \
+         pIterNext = RT_FROM_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member) )
+/** @copydoc RTListOff32ForEachSafe */
+#define RTListOff32ForEachSafeCpp(pList, pIterator, pIterNext, Type, Member) \
+    for (pIterator = RTListOff32NodeGetNextCpp(pList, Type, Member), \
+         pIterNext = RT_FROM_CPP_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member); \
+         !RTListOff32NodeIsDummyCpp(pList, pIterator, Type, Member); \
+         pIterator = pIterNext, \
+         pIterNext = RT_FROM_CPP_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member) )
+
+
+/**
+ * Enumerate the list in reverse order (tail to head).
+ *
+ * @param   pList               List to enumerate.
+ * @param   pIterator           The iterator variable name.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member name.
+ */
+#define RTListOff32ForEachReverse(pList, pIterator, Type, Member) \
+    for (pIterator = RTListOff32NodeGetPrev(pList, Type, Member); \
+         !RTListOff32NodeIsDummy(pList, pIterator, Type, Member); \
+         pIterator = RT_FROM_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member) )
+/** @copydoc RTListOff32ForEachReverse */
+#define RTListOff32ForEachReverseCpp(pList, pIterator, Type, Member) \
+    for (pIterator = RTListOff32NodeGetPrevCpp(pList, Type, Member); \
+         !RTListOff32NodeIsDummyCpp(pList, pIterator, Type, Member); \
+         pIterator = RT_FROM_CPP_MEMBER(RTLISTOFF32_PREV_PTR(&(pIterator)->Member), Type, Member) )
+
+
+/**
+ * Enumerate the list in reverse order (tail to head).
+ *
+ * @param   pList               List to enumerate.
+ * @param   pIterator           The iterator variable name.
+ * @param   pIterPrev           The name of the variable saving the pointer to
+ *                              the previous element.
+ * @param   Type                Structure the list node is a member of.
+ * @param   Member              The list node member name.
+ */
+#define RTListOff32ForEachReverseSafe(pList, pIterator, pIterPrev, Type, Member) \
+    for (pIterator = RTListOff32NodeGetPrev(pList, Type, Member), \
+         pIterPrev = RT_FROM_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member); \
+         !RTListOff32NodeIsDummy(pList, pIterator, Type, Member); \
+         pIterator = pIterPrev, \
+         pIterPrev = RT_FROM_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member) )
+/** @copydoc RTListOff32ForEachReverseSafe */
+#define RTListOff32ForEachReverseSafeCpp(pList, pIterator, pIterPrev, Type, Member) \
+    for (pIterator = RTListOff32NodeGetPrevCpp(pList, Type, Member), \
+         pIterPrev = RT_FROM_CPP_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member); \
+         !RTListOff32NodeIsDummyCpp(pList, pIterator, Type, Member); \
+         pIterator = pIterPrev, \
+         pIterPrev = RT_FROM_CPP_MEMBER(RTLISTOFF32_NEXT_PTR(&(pIterator)->Member), Type, Member) )
+
+
+/**
+ * Move the given list to a new list header.
+ *
+ * @param   pListDst            The new list.
+ * @param   pListSrc            The list to move.
+ */
+DECLINLINE(void) RTListOff32Move(PRTLISTOFF32NODE pListDst, PRTLISTOFF32NODE pListSrc)
+{
+    if (!RTListOff32IsEmpty(pListSrc))
+    {
+        PRTLISTOFF32NODE pFirst = RTLISTOFF32_NEXT_PTR(pListSrc);
+        PRTLISTOFF32NODE pLast  = RTLISTOFF32_PREV_PTR(pListSrc);
+
+        RTLISTOFF32_SET_NEXT_PTR(pListDst, pFirst);
+        RTLISTOFF32_SET_PREV_PTR(pListDst, pLast);
+
+        /* Adjust the first and last element links */
+        RTLISTOFF32_SET_NEXT_PTR(pLast, pListDst);
+        RTLISTOFF32_SET_PREV_PTR(pFirst, pListDst);
+
+        /* Finally remove the elements from the source list */
+        RTListOff32Init(pListSrc);
+    }
+}
+
+/**
+ * List concatenation.
+ *
+ * @returns nothing.
+ * @param   pListDst            The destination list.
+ * @param   pListSrc            The source list to concatenate.
+ */
+DECLINLINE(void) RTListOff32Concatenate(PRTLISTOFF32ANCHOR pListDst, PRTLISTOFF32ANCHOR pListSrc)
+{
+    if (!RTListOff32IsEmpty(pListSrc))
+    {
+        PRTLISTOFF32NODE pFirstSrc = RTLISTOFF32_NEXT_PTR(pListSrc);
+        PRTLISTOFF32NODE pLastSrc  = RTLISTOFF32_PREV_PTR(pListSrc);
+        PRTLISTOFF32NODE pLastDst  = RTLISTOFF32_PREV_PTR(pListDst);
+
+        RTLISTOFF32_SET_NEXT_PTR(pLastDst, pFirstSrc);
+        RTLISTOFF32_SET_PREV_PTR(pFirstSrc, pLastDst);
+
+        RTLISTOFF32_SET_NEXT_PTR(pLastSrc, pListDst);
+        RTLISTOFF32_SET_PREV_PTR(pListDst, pLastSrc);
+
+        /* Finally remove the elements from the source list */
+        RTListOff32Init(pListSrc);
+    }
+}
+
+RT_C_DECLS_END
+
+/** @} */
+
+#endif
+
diff --git a/include/iprt/localipc.h b/include/iprt/localipc.h
index 3719662..60ee139 100644
--- a/include/iprt/localipc.h
+++ b/include/iprt/localipc.h
@@ -1,9 +1,9 @@
 /** @file
- * IPRT - TCP/IP.
+ * IPRT - Local IPC Server & Client.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -23,15 +23,15 @@
  * terms and conditions of either the GPL or the CDDL or both.
  */
 
-#ifndef ___iprt_tcp_h
-#define ___iprt_tcp_h
+#ifndef ___iprt_localipc_h
+#define ___iprt_localipc_h
 
 #include <iprt/cdefs.h>
 #include <iprt/types.h>
 #include <iprt/thread.h>
 
 #ifdef IN_RING0
-# error "There are no RTFile APIs available Ring-0 Host Context!"
+# error "There are no RTLocalIpc APIs available Ring-0 Host Context!"
 #endif
 
 
@@ -65,10 +65,9 @@ typedef RTLOCALIPCSESSION              *PRTLOCALIPCSESSION;
  * @retval  VINF_SUCCESS on success and *phServer containing the instance handle.
  *
  * @param   phServer    Where to put the server instance handle.
- * @param   pszName     The servier name. This must be unique and not
- *                      include any special chars or slashes. It will
- *                      be morphed into a unique platform specific
- *                      identifier.
+ * @param   pszName     The server name.  This must be unique and not include
+ *                      any special chars or slashes. It will be morphed into a
+ *                      unique platform specific identifier.
  * @param   fFlags      Flags, see RTLOCALIPC_FLAGS_*.
  */
 RTDECL(int) RTLocalIpcServerCreate(PRTLOCALIPCSERVER phServer, const char *pszName, uint32_t fFlags);
diff --git a/include/iprt/log.h b/include/iprt/log.h
index f3b3b63..46751f8 100644
--- a/include/iprt/log.h
+++ b/include/iprt/log.h
@@ -255,7 +255,7 @@ typedef FNRTLOGPREFIX *PFNRTLOGPREFIX;
 
 
 /**
- * Logger instance structure for GC.
+ * Logger instance structure for raw-mode context (RC).
  */
 struct RTLOGGERRC
 {
@@ -457,6 +457,8 @@ typedef enum RTLOGDEST
     RTLOGDEST_DEBUGGER      = 0x00000008,
     /** Log to com port. */
     RTLOGDEST_COM           = 0x00000010,
+    /** Log a memory ring buffer. */
+    RTLOGDEST_RINGBUF       = 0x00000020,
     /** Just a dummy flag to be used when no other flag applies. */
     RTLOGDEST_DUMMY         = 0x20000000,
     /** Log to a user defined output stream. */
@@ -1128,7 +1130,7 @@ RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, c
  */
 #ifdef LOG_USE_C99
 # define LogRelFunc(a) \
-    _LogRelIt(LOG_REL_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP, LOG_FN_FMT ": %M", __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
+    _LogRelIt(LOG_REL_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP, LOG_FN_FMT ": %M", RT_GCC_EXTENSION __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 # define LogFunc(a) \
            _LogIt(LOG_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP, LOG_FN_FMT ": %M", __PRETTY_FUNCTION__, _LogRemoveParentheseis a )
 #else
diff --git a/include/iprt/mangling.h b/include/iprt/mangling.h
index 6b6fcb0..1b81a35 100644
--- a/include/iprt/mangling.h
+++ b/include/iprt/mangling.h
@@ -10,7 +10,7 @@
  */
 
 /*
- * Copyright (C) 2011-2013 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -53,24 +53,36 @@
 # define ASMAtomicCmpXchgU64_EndProc                    RT_MANGLER(ASMAtomicCmpXchgU64_EndProc)
 # define ASMAtomicReadU64                               RT_MANGLER(ASMAtomicReadU64)        /* not-some-systems... */
 # define ASMAtomicReadU64_EndProc                       RT_MANGLER(ASMAtomicReadU64_EndProc)
-# define ASMAtomicUoReadU64                             RT_MANGLER(ASMAtomicUoReadU64)      /* not-some-systems... */
-# define ASMAtomicUoReadU64_EndProc                     RT_MANGLER(ASMAtomicUoReadU64_EndProc)
-# define ASMAtomicUoAndU64                              RT_MANGLER(ASMAtomicUoAndU64)       /* not-some-systems... */
-# define ASMAtomicUoAndU64_EndProc                      RT_MANGLER(ASMAtomicUoAndU64_EndProc)
 # define ASMAtomicUoAndU32                              RT_MANGLER(ASMAtomicUoAndU32)       /* not-some-systems... */
 # define ASMAtomicUoAndU32_EndProc                      RT_MANGLER(ASMAtomicUoAndU32_EndProc)
-# define ASMAtomicUoOrU64                               RT_MANGLER(ASMAtomicUoOrU64)        /* not-some-systems... */
-# define ASMAtomicUoOrU64_EndProc                       RT_MANGLER(ASMAtomicUoOrU64_EndProc)
+# define ASMAtomicUoAndU64                              RT_MANGLER(ASMAtomicUoAndU64)       /* not-some-systems... */
+# define ASMAtomicUoAndU64_EndProc                      RT_MANGLER(ASMAtomicUoAndU64_EndProc)
+# define ASMAtomicUoDecU32                              RT_MANGLER(ASMAtomicUoDecU32)       /* not-some-systems... */
+# define ASMAtomicUoDecU32_EndProc                      RT_MANGLER(ASMAtomicUoDecU32_EndProc)
+# define ASMAtomicUoIncU32                              RT_MANGLER(ASMAtomicUoIncU32)       /* not-some-systems... */
+# define ASMAtomicUoIncU32_EndProc                      RT_MANGLER(ASMAtomicUoIncU32_EndProc)
 # define ASMAtomicUoOrU32                               RT_MANGLER(ASMAtomicUoOrU32)        /* not-some-systems... */
 # define ASMAtomicUoOrU32_EndProc                       RT_MANGLER(ASMAtomicUoOrU32_EndProc)
+# define ASMAtomicUoOrU64                               RT_MANGLER(ASMAtomicUoOrU64)        /* not-some-systems... */
+# define ASMAtomicUoOrU64_EndProc                       RT_MANGLER(ASMAtomicUoOrU64_EndProc)
+# define ASMAtomicUoReadU64                             RT_MANGLER(ASMAtomicUoReadU64)      /* not-some-systems... */
+# define ASMAtomicUoReadU64_EndProc                     RT_MANGLER(ASMAtomicUoReadU64_EndProc)
 # define ASMAtomicXchgU64                               RT_MANGLER(ASMAtomicXchgU64)        /* not-some-systems... */
 # define ASMAtomicXchgU64_EndProc                       RT_MANGLER(ASMAtomicXchgU64_EndProc)
+# define ASMCpuIdExSlow                                 RT_MANGLER(ASMCpuIdExSlow)
+# define ASMCpuIdExSlow_EndProc                         RT_MANGLER(ASMCpuIdExSlow_EndProc)
+# define ASMGetXcr0                                     RT_MANGLER(ASMGetXcr0)
+# define ASMGetXcr0_EndProc                             RT_MANGLER(ASMGetXcr0_EndProc)
 # define ASMRdMsrEx                                     RT_MANGLER(ASMRdMsrEx)
 # define ASMRdMsrEx_EndProc                             RT_MANGLER(ASMRdMsrEx_EndProc)
+# define ASMSetXcr0                                     RT_MANGLER(ASMSetXcr0)
+# define ASMSetXcr0_EndProc                             RT_MANGLER(ASMSetXcr0_EndProc)
 # define ASMWrMsrEx                                     RT_MANGLER(ASMWrMsrEx)
 # define ASMWrMsrEx_EndProc                             RT_MANGLER(ASMWrMsrEx_EndProc)
-# define ASMCpuIdExSlow                                 RT_MANGLER(ASMCpuIdExSlow)
-# define ASMCpuIdExSlow_EndProc                         RT_MANGLER(ASMCpuIdExSlow_EndProc)
+# define ASMXRstor                                      RT_MANGLER(ASMXRstor)
+# define ASMXRstor_EndProc                              RT_MANGLER(ASMXRstor_EndProc)
+# define ASMXSave                                       RT_MANGLER(ASMXSave)
+# define ASMXSave_EndProc                               RT_MANGLER(ASMXSave_EndProc)
 # define RTAssertAreQuiet                               RT_MANGLER(RTAssertAreQuiet)
 # define RTAssertMayPanic                               RT_MANGLER(RTAssertMayPanic)
 # define RTAssertMsg1                                   RT_MANGLER(RTAssertMsg1)
@@ -320,6 +332,10 @@
 # define RTCrc32Finish                                  RT_MANGLER(RTCrc32Finish)
 # define RTCrc32Process                                 RT_MANGLER(RTCrc32Process)
 # define RTCrc32Start                                   RT_MANGLER(RTCrc32Start)
+# define RTCrc32C                                       RT_MANGLER(RTCrc32C)
+# define RTCrc32CFinish                                 RT_MANGLER(RTCrc32CFinish)
+# define RTCrc32CProcess                                RT_MANGLER(RTCrc32CProcess)
+# define RTCrc32CStart                                  RT_MANGLER(RTCrc32CStart)
 # define RTCrc64                                        RT_MANGLER(RTCrc64)
 # define RTCrc64Finish                                  RT_MANGLER(RTCrc64Finish)
 # define RTCrc64Process                                 RT_MANGLER(RTCrc64Process)
@@ -395,6 +411,7 @@
 # define RTDbgCfgQueryUInt                              RT_MANGLER(RTDbgCfgQueryUInt)
 # define RTDbgCfgOpenDbg                                RT_MANGLER(RTDbgCfgOpenDbg)
 # define RTDbgCfgOpenDsymBundle                         RT_MANGLER(RTDbgCfgOpenDsymBundle)
+# define RTDbgCfgOpenMachOImage                         RT_MANGLER(RTDbgCfgOpenMachOImage)
 # define RTDbgCfgOpenDwo                                RT_MANGLER(RTDbgCfgOpenDwo)
 # define RTDbgCfgOpenPdb70                              RT_MANGLER(RTDbgCfgOpenPdb70)
 # define RTDbgCfgOpenPdb20                              RT_MANGLER(RTDbgCfgOpenPdb20)
@@ -490,25 +507,34 @@
 # define RTDvmVolumeSetQueryBlockStatusCallback         RT_MANGLER(RTDvmVolumeSetQueryBlockStatusCallback)
 # define RTDvmVolumeTypeGetDescr                        RT_MANGLER(RTDvmVolumeTypeGetDescr)
 # define RTDvmVolumeCreateVfsFile                       RT_MANGLER(RTDvmVolumeCreateVfsFile)
+# define RTEnvApplyChanges                              RT_MANGLER(RTEnvApplyChanges)
 # define RTEnvClone                                     RT_MANGLER(RTEnvClone)
+# define RTEnvCountEx                                   RT_MANGLER(RTEnvCountEx)
 # define RTEnvCreate                                    RT_MANGLER(RTEnvCreate)
+# define RTEnvCreateChangeRecord                        RT_MANGLER(RTEnvCreateChangeRecord)
 # define RTEnvDestroy                                   RT_MANGLER(RTEnvDestroy)
 # define RTEnvDupEx                                     RT_MANGLER(RTEnvDupEx)
 # define RTEnvExist                                     RT_MANGLER(RTEnvExist)
 # define RTEnvExistsBad                                 RT_MANGLER(RTEnvExistsBad)
 # define RTEnvExistsUtf8                                RT_MANGLER(RTEnvExistsUtf8)
 # define RTEnvExistEx                                   RT_MANGLER(RTEnvExistEx)
+# define RTEnvFreeUtf8Block                             RT_MANGLER(RTEnvFreeUtf8Block)
 # define RTEnvFreeUtf16Block                            RT_MANGLER(RTEnvFreeUtf16Block)
 # define RTEnvGet                                       RT_MANGLER(RTEnvGet)
 # define RTEnvGetBad                                    RT_MANGLER(RTEnvGetBad)
+# define RTEnvGetByIndexEx                              RT_MANGLER(RTEnvGetByIndexEx)
+# define RTEnvGetByIndexRawEx                           RT_MANGLER(RTEnvGetByIndexRawEx)
 # define RTEnvGetUtf8                                   RT_MANGLER(RTEnvGetUtf8)
 # define RTEnvGetEx                                     RT_MANGLER(RTEnvGetEx)
 # define RTEnvGetExecEnvP                               RT_MANGLER(RTEnvGetExecEnvP)
+# define RTEnvIsChangeRecord                            RT_MANGLER(RTEnvIsChangeRecord)
 # define RTEnvPut                                       RT_MANGLER(RTEnvPut)
 # define RTEnvPutBad                                    RT_MANGLER(RTEnvPutBad)
 # define RTEnvPutUtf8                                   RT_MANGLER(RTEnvPutUtf8)
 # define RTEnvPutEx                                     RT_MANGLER(RTEnvPutEx)
 # define RTEnvQueryUtf16Block                           RT_MANGLER(RTEnvQueryUtf16Block)
+# define RTEnvQueryUtf8Block                            RT_MANGLER(RTEnvQueryUtf8Block)
+# define RTEnvReset                                     RT_MANGLER(RTEnvReset)
 # define RTEnvSet                                       RT_MANGLER(RTEnvSet)
 # define RTEnvSetBad                                    RT_MANGLER(RTEnvSetBad)
 # define RTEnvSetUtf8                                   RT_MANGLER(RTEnvSetUtf8)
@@ -683,10 +709,12 @@
 # define RTLdrOpenkLdr                                  RT_MANGLER(RTLdrOpenkLdr)
 # define RTLdrRelocate                                  RT_MANGLER(RTLdrRelocate)
 # define RTLdrRvaToSegOffset                            RT_MANGLER(RTLdrRvaToSegOffset)
+# define RTLdrQueryForwarderInfo                        RT_MANGLER(RTLdrQueryForwarderInfo)
+# define RTLdrQueryProp                                 RT_MANGLER(RTLdrQueryProp)
 # define RTLdrSegOffsetToRva                            RT_MANGLER(RTLdrSegOffsetToRva)
 # define RTLdrSize                                      RT_MANGLER(RTLdrSize)
-# define RTLinuxFindDevicePath                          RT_MANGLER(RTLinuxFindDevicePath)
-# define RTLinuxFindDevicePathV                         RT_MANGLER(RTLinuxFindDevicePathV)
+# define RTLinuxCheckDevicePath                         RT_MANGLER(RTLinuxCheckDevicePath)
+# define RTLinuxCheckDevicePathV                        RT_MANGLER(RTLinuxCheckDevicePathV)
 # define RTLinuxSysFsClose                              RT_MANGLER(RTLinuxSysFsClose)
 # define RTLinuxSysFsExists                             RT_MANGLER(RTLinuxSysFsExists)
 # define RTLinuxSysFsExistsV                            RT_MANGLER(RTLinuxSysFsExistsV)
@@ -932,6 +960,8 @@
 # define RTMpCpuId                                      RT_MANGLER(RTMpCpuId)
 # define RTMpCpuIdFromSetIndex                          RT_MANGLER(RTMpCpuIdFromSetIndex)
 # define RTMpCpuIdToSetIndex                            RT_MANGLER(RTMpCpuIdToSetIndex)
+# define RTMpCurSetIndex                                RT_MANGLER(RTMpCurSetIndex)
+# define RTMpCurSetIndexAndId                           RT_MANGLER(RTMpCurSetIndexAndId)
 # define RTMpGetArraySize                               RT_MANGLER(RTMpGetArraySize)
 # define RTMpGetCount                                   RT_MANGLER(RTMpGetCount)
 # define RTMpGetCurFrequency                            RT_MANGLER(RTMpGetCurFrequency)
@@ -953,7 +983,10 @@
 # define RTMpNotificationDeregister                     RT_MANGLER(RTMpNotificationDeregister) /* r0drv */
 # define RTMpNotificationRegister                       RT_MANGLER(RTMpNotificationRegister)   /* r0drv */
 # define RTMpOnAll                                      RT_MANGLER(RTMpOnAll)                  /* r0drv */
+# define RTMpOnAllIsConcurrentSafe                      RT_MANGLER(RTMpOnAllIsConcurrentSafe)  /* r0drv */
 # define RTMpOnOthers                                   RT_MANGLER(RTMpOnOthers)               /* r0drv */
+# define RTMpOnPair                                     RT_MANGLER(RTMpOnPair)                 /* r0drv */
+# define RTMpOnPairIsConcurrentExecSupported            RT_MANGLER(RTMpOnPairIsConcurrentExecSupported) /* r0drv */
 # define RTMpOnSpecific                                 RT_MANGLER(RTMpOnSpecific)             /* r0drv */
 # define RTMpPokeCpu                                    RT_MANGLER(RTMpPokeCpu)                /* r0drv */
 # define RTMsgError                                     RT_MANGLER(RTMsgError)
@@ -990,8 +1023,11 @@
 # define RTNetUDPChecksum                               RT_MANGLER(RTNetUDPChecksum)
 # define RTNetStrToMacAddr                              RT_MANGLER(RTNetStrToMacAddr)
 # define RTNetIsIPv4AddrStr                             RT_MANGLER(RTNetIsIPv4AddrStr)
+# define RTNetStrToIPv4AddrEx                           RT_MANGLER(RTNetStrToIPv4AddrEx)
 # define RTNetStrToIPv4Addr                             RT_MANGLER(RTNetStrToIPv4Addr)
 # define RTNetIsIPv6AddrStr                             RT_MANGLER(RTNetIsIPv6AddrStr)
+# define RTNetStrToIPv6AddrEx                           RT_MANGLER(RTNetStrToIPv6AddrEx)
+# define RTNetStrToIPv6Addr                             RT_MANGLER(RTNetStrToIPv6Addr)
 # define RTOnceSlow                                     RT_MANGLER(RTOnceSlow)
 # define RTOnceReset                                    RT_MANGLER(RTOnceReset)
 # define RTPathAbs                                      RT_MANGLER(RTPathAbs)
@@ -1013,14 +1049,14 @@
 # define RTPathExecDir                                  RT_MANGLER(RTPathExecDir)
 # define RTPathExists                                   RT_MANGLER(RTPathExists)
 # define RTPathExistsEx                                 RT_MANGLER(RTPathExistsEx)
-# define RTPathExt                                      RT_MANGLER(RTPathExt)
+# define RTPathSuffix                                   RT_MANGLER(RTPathSuffix)
 # define RTPathFilename                                 RT_MANGLER(RTPathFilename)
 # define RTPathFilenameEx                               RT_MANGLER(RTPathFilenameEx)
 # define RTPathGetCurrent                               RT_MANGLER(RTPathGetCurrent)
 # define RTPathGetCurrentDrive                          RT_MANGLER(RTPathGetCurrentDrive)
 # define RTPathGetCurrentOnDrive                        RT_MANGLER(RTPathGetCurrentOnDrive)
 # define RTPathGetMode                                  RT_MANGLER(RTPathGetMode)
-# define RTPathHasExt                                   RT_MANGLER(RTPathHasExt)
+# define RTPathHasSuffix                                RT_MANGLER(RTPathHasSuffix)
 # define RTPathHasPath                                  RT_MANGLER(RTPathHasPath)
 # define RTPathIsSame                                   RT_MANGLER(RTPathIsSame)
 # define RTPathJoin                                     RT_MANGLER(RTPathJoin)
@@ -1048,7 +1084,7 @@
 # define RTPathSplitReassemble                          RT_MANGLER(RTPathSplitReassemble)
 # define RTPathStartsWith                               RT_MANGLER(RTPathStartsWith)
 # define RTPathStartsWithRoot                           RT_MANGLER(RTPathStartsWithRoot)
-# define RTPathStripExt                                 RT_MANGLER(RTPathStripExt)
+# define RTPathStripSuffix                              RT_MANGLER(RTPathStripSuffix)
 # define RTPathStripFilename                            RT_MANGLER(RTPathStripFilename)
 # define RTPathStripTrailingSlash                       RT_MANGLER(RTPathStripTrailingSlash)
 # define RTPathTemp                                     RT_MANGLER(RTPathTemp)
@@ -1199,6 +1235,7 @@
 # define RTReqRelease                                   RT_MANGLER(RTReqRelease)
 # define RTReqRetain                                    RT_MANGLER(RTReqRetain)
 # define RTReqWait                                      RT_MANGLER(RTReqWait)
+# define RTRSAVerify                                    RT_MANGLER(RTRSAVerify)
 # define RTReqGetStatus                                 RT_MANGLER(RTReqGetStatus)
 # define RTS3BucketsDestroy                             RT_MANGLER(RTS3BucketsDestroy)
 # define RTS3Create                                     RT_MANGLER(RTS3Create)
@@ -1383,7 +1420,6 @@
 # define RTSpinlockCreate                               RT_MANGLER(RTSpinlockCreate)
 # define RTSpinlockDestroy                              RT_MANGLER(RTSpinlockDestroy)
 # define RTSpinlockRelease                              RT_MANGLER(RTSpinlockRelease)
-# define RTSpinlockReleaseNoInts                        RT_MANGLER(RTSpinlockReleaseNoInts)
 # define RTStrAAppendExNVTag                            RT_MANGLER(RTStrAAppendExNVTag)
 # define RTStrAAppendNTag                               RT_MANGLER(RTStrAAppendNTag)
 # define RTStrAAppendTag                                RT_MANGLER(RTStrAAppendTag)
@@ -1453,6 +1489,7 @@
 # define RTStrmError                                    RT_MANGLER(RTStrmError)
 # define RTStrmFlush                                    RT_MANGLER(RTStrmFlush)
 # define RTStrmGetCh                                    RT_MANGLER(RTStrmGetCh)
+# define RTStrmInputGetEchoChars                        RT_MANGLER(RTStrmInputGetEchoChars)
 # define RTStrmGetLine                                  RT_MANGLER(RTStrmGetLine)
 # define RTStrmOpen                                     RT_MANGLER(RTStrmOpen)
 # define RTStrmOpenF                                    RT_MANGLER(RTStrmOpenF)
@@ -1464,6 +1501,7 @@
 # define RTStrmPutStr                                   RT_MANGLER(RTStrmPutStr)
 # define RTStrmReadEx                                   RT_MANGLER(RTStrmReadEx)
 # define RTStrmRewind                                   RT_MANGLER(RTStrmRewind)
+# define RTStrmInputSetEchoChars                        RT_MANGLER(RTStrmInputSetEchoChars)
 # define RTStrmSetMode                                  RT_MANGLER(RTStrmSetMode)
 # define RTStrmWriteEx                                  RT_MANGLER(RTStrmWriteEx)
 # define RTStrNCmp                                      RT_MANGLER(RTStrNCmp)
@@ -1543,32 +1581,13 @@
 # define RTSystemQueryTotalRam                          RT_MANGLER(RTSystemQueryTotalRam)
 # define RTSystemShutdown                               RT_MANGLER(RTSystemShutdown)
 # define RTTarClose                                     RT_MANGLER(RTTarClose)
-# define RTTarCreate                                    RT_MANGLER(RTTarCreate)
-# define RTTarCurrentFile                               RT_MANGLER(RTTarCurrentFile)
-# define RTTarExtractAll                                RT_MANGLER(RTTarExtractAll)
-# define RTTarExtractFiles                              RT_MANGLER(RTTarExtractFiles)
-# define RTTarExtractFileToBuf                          RT_MANGLER(RTTarExtractFileToBuf)
 # define RTTarFileClose                                 RT_MANGLER(RTTarFileClose)
-# define RTTarFileExists                                RT_MANGLER(RTTarFileExists)
-# define RTTarFileGetMode                               RT_MANGLER(RTTarFileGetMode)
-# define RTTarFileGetOwner                              RT_MANGLER(RTTarFileGetOwner)
 # define RTTarFileGetSize                               RT_MANGLER(RTTarFileGetSize)
-# define RTTarFileGetTime                               RT_MANGLER(RTTarFileGetTime)
 # define RTTarFileOpen                                  RT_MANGLER(RTTarFileOpen)
-# define RTTarFileOpenCurrentFile                       RT_MANGLER(RTTarFileOpenCurrentFile)
-# define RTTarFileRead                                  RT_MANGLER(RTTarFileRead)
 # define RTTarFileReadAt                                RT_MANGLER(RTTarFileReadAt)
-# define RTTarFileSeek                                  RT_MANGLER(RTTarFileSeek)
-# define RTTarFileSetMode                               RT_MANGLER(RTTarFileSetMode)
-# define RTTarFileSetOwner                              RT_MANGLER(RTTarFileSetOwner)
 # define RTTarFileSetSize                               RT_MANGLER(RTTarFileSetSize)
-# define RTTarFileSetTime                               RT_MANGLER(RTTarFileSetTime)
-# define RTTarFileTell                                  RT_MANGLER(RTTarFileTell)
-# define RTTarFileWrite                                 RT_MANGLER(RTTarFileWrite)
 # define RTTarFileWriteAt                               RT_MANGLER(RTTarFileWriteAt)
-# define RTTarList                                      RT_MANGLER(RTTarList)
 # define RTTarOpen                                      RT_MANGLER(RTTarOpen)
-# define RTTarSeekNextFile                              RT_MANGLER(RTTarSeekNextFile)
 # define RTTcpClientCancelConnect                       RT_MANGLER(RTTcpClientCancelConnect)
 # define RTTcpClientClose                               RT_MANGLER(RTTcpClientClose)
 # define RTTcpClientCloseEx                             RT_MANGLER(RTTcpClientCloseEx)
@@ -1662,12 +1681,11 @@
 # define RTThreadCreate                                 RT_MANGLER(RTThreadCreate)
 # define RTThreadCreateF                                RT_MANGLER(RTThreadCreateF)
 # define RTThreadCreateV                                RT_MANGLER(RTThreadCreateV)
-# define RTThreadCtxHooksAreRegistered                  RT_MANGLER(RTThreadCtxHooksAreRegistered)  /* r0drv */
-# define RTThreadCtxHooksCreate                         RT_MANGLER(RTThreadCtxHooksCreate)         /* r0drv */
-# define RTThreadCtxHooksDeregister                     RT_MANGLER(RTThreadCtxHooksDeregister)     /* r0drv */
-# define RTThreadCtxHooksRegister                       RT_MANGLER(RTThreadCtxHooksRegister)       /* r0drv */
-# define RTThreadCtxHooksRelease                        RT_MANGLER(RTThreadCtxHooksRelease)        /* r0drv */
-# define RTThreadCtxHooksRetain                         RT_MANGLER(RTThreadCtxHooksRetain)         /* r0drv */
+# define RTThreadCtxHookIsEnabled                       RT_MANGLER(RTThreadCtxHookIsEnabled)    /* r0drv */
+# define RTThreadCtxHookCreate                          RT_MANGLER(RTThreadCtxHookCreate)       /* r0drv */
+# define RTThreadCtxHookDestroy                         RT_MANGLER(RTThreadCtxHookDestroy)      /* r0drv */
+# define RTThreadCtxHookDisable                         RT_MANGLER(RTThreadCtxHookDisable)      /* r0drv */
+# define RTThreadCtxHookEnable                          RT_MANGLER(RTThreadCtxHookEnable)       /* r0drv */
 # define RTThreadFromNative                             RT_MANGLER(RTThreadFromNative)
 # define RTThreadGetAffinity                            RT_MANGLER(RTThreadGetAffinity)
 # define RTThreadGetExecutionTimeMilli                  RT_MANGLER(RTThreadGetExecutionTimeMilli)
@@ -1720,10 +1738,42 @@
 # define RTTimeLocalNow                                 RT_MANGLER(RTTimeLocalNow)
 # define RTTimeMilliTS                                  RT_MANGLER(RTTimeMilliTS)
 # define RTTimeNanoTS                                   RT_MANGLER(RTTimeNanoTS)
-# define RTTimeNanoTSLegacyAsync                        RT_MANGLER(RTTimeNanoTSLegacyAsync)
-# define RTTimeNanoTSLegacySync                         RT_MANGLER(RTTimeNanoTSLegacySync)
-# define RTTimeNanoTSLFenceAsync                        RT_MANGLER(RTTimeNanoTSLFenceAsync)
-# define RTTimeNanoTSLFenceSync                         RT_MANGLER(RTTimeNanoTSLFenceSync)
+# define RTTimeNanoTSLegacyAsync                                RT_MANGLER(RTTimeNanoTSLegacyAsync)
+# define RTTimeNanoTSLegacyAsync_EndProc                        RT_MANGLER(RTTimeNanoTSLegacyAsync_EndProc)
+# define RTTimeNanoTSLegacyAsyncUseApicId                       RT_MANGLER(RTTimeNanoTSLegacyAsyncUseApicId)
+# define RTTimeNanoTSLegacyAsyncUseApicId_EndProc               RT_MANGLER(RTTimeNanoTSLegacyAsyncUseApicId_EndProc)
+# define RTTimeNanoTSLegacyAsyncUseRdtscp                       RT_MANGLER(RTTimeNanoTSLegacyAsyncUseRdtscp)
+# define RTTimeNanoTSLegacyAsyncUseRdtscp_EndProc               RT_MANGLER(RTTimeNanoTSLegacyAsyncUseRdtscp_EndProc)
+# define RTTimeNanoTSLegacyAsyncUseIdtrLim                      RT_MANGLER(RTTimeNanoTSLegacyAsyncUseIdtrLim)
+# define RTTimeNanoTSLegacyAsyncUseIdtrLim_EndProc              RT_MANGLER(RTTimeNanoTSLegacyAsyncUseIdtrLim_EndProc)
+# define RTTimeNanoTSLegacySyncInvarNoDelta                     RT_MANGLER(RTTimeNanoTSLegacySyncInvarNoDelta)
+# define RTTimeNanoTSLegacySyncInvarNoDelta_EndProc             RT_MANGLER(RTTimeNanoTSLegacySyncInvarNoDelta_EndProc)
+# define RTTimeNanoTSLegacySyncInvarWithDelta                   RT_MANGLER(RTTimeNanoTSLegacySyncInvarWithDelta)
+# define RTTimeNanoTSLegacySyncInvarWithDelta_EndProc           RT_MANGLER(RTTimeNanoTSLegacySyncInvarWithDelta_EndProc)
+# define RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId          RT_MANGLER(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId)
+# define RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId_EndProc  RT_MANGLER(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId_EndProc)
+# define RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp          RT_MANGLER(RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp)
+# define RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp_EndProc  RT_MANGLER(RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp_EndProc)
+# define RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim         RT_MANGLER(RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim)
+# define RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim_EndProc RT_MANGLER(RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim_EndProc)
+# define RTTimeNanoTSLFenceAsync                                RT_MANGLER(RTTimeNanoTSLFenceAsync)
+# define RTTimeNanoTSLFenceAsync_EndProc                        RT_MANGLER(RTTimeNanoTSLFenceAsync_EndProc)
+# define RTTimeNanoTSLFenceAsyncUseApicId                       RT_MANGLER(RTTimeNanoTSLFenceAsyncUseApicId)
+# define RTTimeNanoTSLFenceAsyncUseApicId_EndProc               RT_MANGLER(RTTimeNanoTSLFenceAsyncUseApicId_EndProc)
+# define RTTimeNanoTSLFenceAsyncUseRdtscp                       RT_MANGLER(RTTimeNanoTSLFenceAsyncUseRdtscp)
+# define RTTimeNanoTSLFenceAsyncUseRdtscp_EndProc               RT_MANGLER(RTTimeNanoTSLFenceAsyncUseRdtscp_EndProc)
+# define RTTimeNanoTSLFenceAsyncUseIdtrLim                      RT_MANGLER(RTTimeNanoTSLFenceAsyncUseIdtrLim)
+# define RTTimeNanoTSLFenceAsyncUseIdtrLim_EndProc              RT_MANGLER(RTTimeNanoTSLFenceAsyncUseIdtrLim_EndProc)
+# define RTTimeNanoTSLFenceSyncInvarNoDelta                     RT_MANGLER(RTTimeNanoTSLFenceSyncInvarNoDelta)
+# define RTTimeNanoTSLFenceSyncInvarNoDelta_EndProc             RT_MANGLER(RTTimeNanoTSLFenceSyncInvarNoDelta_EndProc)
+# define RTTimeNanoTSLFenceSyncInvarWithDelta                   RT_MANGLER(RTTimeNanoTSLFenceSyncInvarWithDelta)
+# define RTTimeNanoTSLFenceSyncInvarWithDelta_EndProc           RT_MANGLER(RTTimeNanoTSLFenceSyncInvarWithDelta_EndProc)
+# define RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId          RT_MANGLER(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId)
+# define RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId_EndProc  RT_MANGLER(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId_EndProc)
+# define RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp          RT_MANGLER(RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp)
+# define RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp_EndProc  RT_MANGLER(RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp_EndProc)
+# define RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim         RT_MANGLER(RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim)
+# define RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim_EndProc RT_MANGLER(RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim_EndProc)
 # define RTTimeNormalize                                RT_MANGLER(RTTimeNormalize)
 # define RTTimeNow                                      RT_MANGLER(RTTimeNow)
 # define RTTimeProgramMicroTS                           RT_MANGLER(RTTimeProgramMicroTS)
@@ -1930,6 +1980,9 @@
 # define RTVfsSymlinkSetTimes                           RT_MANGLER(RTVfsSymlinkSetTimes)
 # define RTVfsUtilDummyPollOne                          RT_MANGLER(RTVfsUtilDummyPollOne)
 # define RTVfsUtilPumpIoStreams                         RT_MANGLER(RTVfsUtilPumpIoStreams)
+# define RTX509PrepareOpenSSL                           RT_MANGLER(RTX509PrepareOpenSSL)
+# define RTX509CertificateVerify                        RT_MANGLER(RTX509CertificateVerify)
+# define RTX509GetErrorDescription                      RT_MANGLER(RTX509GetErrorDescription)
 # define RTZipBlockCompress                             RT_MANGLER(RTZipBlockCompress)
 # define RTZipBlockDecompress                           RT_MANGLER(RTZipBlockDecompress)
 # define RTZipCompCreate                                RT_MANGLER(RTZipCompCreate)
@@ -1941,12 +1994,12 @@
 # define RTZipDecompress                                RT_MANGLER(RTZipDecompress)
 # define RTZipGzipCompressIoStream                      RT_MANGLER(RTZipGzipCompressIoStream)
 # define RTZipGzipDecompressIoStream                    RT_MANGLER(RTZipGzipDecompressIoStream)
+# define RTZipPkzipFsStreamFromIoStream                 RT_MANGLER(RTZipPkzipFsStreamFromIoStream)
+# define RTZipPkzipMemDecompress                        RT_MANGLER(RTZipPkzipMemDecompress)
 # define RTZipTarCmd                                    RT_MANGLER(RTZipTarCmd)
 # define RTZipUnzipCmd                                  RT_MANGLER(RTZipUnzipCmd)
 # define RTZipTarFsStreamFromIoStream                   RT_MANGLER(RTZipTarFsStreamFromIoStream)
 # define RTZipXarFsStreamFromIoStream                   RT_MANGLER(RTZipXarFsStreamFromIoStream)
-# define RTZipPkzipFsStreamFromIoStream                 RT_MANGLER(RTZipPkzipFsStreamFromIoStream)
-# define RTZipPkzipMemDecompress                        RT_MANGLER(RTZipPkzipMemDecompress)
 
 /* sort/merge into the above later: */
 # define RTAsn1ContentAllocZ                            RT_MANGLER(RTAsn1ContentAllocZ)
@@ -2840,8 +2893,6 @@
 # define RTErrInfoAddV                                  RT_MANGLER(RTErrInfoAddV)
 # define RTLdrHashImage                                 RT_MANGLER(RTLdrHashImage)
 # define RTLdrOpenWithReader                            RT_MANGLER(RTLdrOpenWithReader)
-# define RTLdrQueryForwarderInfo                        RT_MANGLER(RTLdrQueryForwarderInfo)
-# define RTLdrQueryProp                                 RT_MANGLER(RTLdrQueryProp)
 # define RTLdrQueryPropEx                               RT_MANGLER(RTLdrQueryPropEx)
 # define RTLdrVerifySignature                           RT_MANGLER(RTLdrVerifySignature)
 # define RTBigNumAdd                                    RT_MANGLER(RTBigNumAdd)
diff --git a/include/iprt/mem.h b/include/iprt/mem.h
index 2b56d19..9b86806 100644
--- a/include/iprt/mem.h
+++ b/include/iprt/mem.h
@@ -505,91 +505,6 @@ RTDECL(int) RTMemProtect(void *pv, size_t cb, unsigned fProtect) RT_NO_THROW;
  */
 RTDECL(void) RTMemWipeThoroughly(void *pv, size_t cb, size_t cMinPasses) RT_NO_THROW;
 
-/**
- * Allocate locked memory with default tag - extended version.
- *
- * @returns IPRT status code.
- * @param   cb      The amount of memory to allocate.
- * @param   ppv     Where to store the pointer to the allocated memory on success.
- */
-#define RTMemLockedAllocEx(cb, ppv) RTMemLockedAllocExTag((cb), RTMEM_TAG, (ppv))
-
-/**
- * Allocate locked memory - extended version.
- *
- * @returns IPRT status code.
- * @param   cb      The amount of memory to allocate.
- * @param   pszTag  Allocation tag used for statistics and such.
- * @param   ppv     Where to store the pointer to the allocated memory on success.
- */
-RTDECL(int) RTMemLockedAllocExTag(size_t cb, const char *pszTag, void **ppv) RT_NO_THROW;
-
-/**
- * Allocate zeroed locked memory with default tag - extended version.
- *
- * @returns IPRT status code.
- * @param   cb      The amount of memory to allocate.
- * @param   ppv     Where to store the pointer to the allocated memory on success.
- */
-#define RTMemLockedAllocZEx(cb, ppv) RTMemLockedAllocZExTag((cb), RTMEM_TAG, (ppv))
-
-/**
- * Allocate zeroed locked memory - extended version.
- *
- * @returns IPRT status code.
- * @param   cb      The amount of memory to allocate.
- * @param   pszTag  Allocation tag used for statistics and such.
- * @param   ppv     Where to store the pointer to the allocated memory on success.
- */
-RTDECL(int) RTMemLockedAllocZExTag(size_t cb, const char *pszTag, void **ppv) RT_NO_THROW;
-
-/**
- * Allocate locked memory with the default tag - shortcut for RTMemLockedAllocExTag().
- *
- * @returns Pointer to allocated memory on success.
- * @returns NULL on failure (use RTMemLockedAllocExTag() if the specific reason is required)
- * @param   cb      The amount of memory to allocate.
- */
-#define RTMemLockedAlloc(cb) RTMemLockedAllocTag((cb), RTMEM_TAG)
-
-/**
- * Allocate locked memory - shortcut for RTMemLockedAllocExTag().
- *
- * @returns Pointer to allocated memory on success.
- * @returns NULL on failure (use RTMemLockedAllocExTag() if the specific reason is required)
- * @param   cb      The amount of memory to allocate.
- * @param   pszTag  Allocation tag used for statistics and such.
- */
-RTDECL(void *) RTMemLockedAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
-
-/**
- * Allocate locked zeroed memory with the default tag - shortcut for RTMemLockedAllocZExTag().
- *
- * @returns Pointer to allocated memory on success.
- * @returns NULL on failure (use RTMemLockedAllocZExTag() if the specific reason is required)
- * @param   cb      The amount of memory to allocate.
- */
-#define RTMemLockedAllocZ(cb) RTMemLockedAllocZTag((cb), RTMEM_TAG)
-
-/**
- * Allocate locked zeroed memory - shortcut for RTMemLockedAllocZExTag().
- *
- * @returns Pointer to allocated memory on success.
- * @returns NULL on failure (use RTMemLockedAllocZExTag() if the specific reason is required)
- * @param   cb      The amount of memory to allocate.
- * @param   pszTag  Allocation tag used for statistics and such.
- */
-RTDECL(void *) RTMemLockedAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW;
-
-/**
- * Frees memory allocated with any of the RTMemLockedAlloc* API.
- *
- * @returns nothing.
- * @param   pv    Pointer to the memory block to free.
- */
-RTDECL(void) RTMemLockedFree(void *pv) RT_NO_THROW;
-
-
 #ifdef IN_RING0
 
 /**
diff --git a/include/iprt/mp.h b/include/iprt/mp.h
index 23ababc..53a0e39 100644
--- a/include/iprt/mp.h
+++ b/include/iprt/mp.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2008-2010 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -49,6 +49,25 @@ RT_C_DECLS_BEGIN
 RTDECL(RTCPUID) RTMpCpuId(void);
 
 /**
+ * Get the CPU set index of the CPU executing the call.
+ *
+ * Same scheduling warnings as for RTMpCpuId().
+ *
+ * @returns CPU set index.
+ */
+RTDECL(int) RTMpCurSetIndex(void);
+
+/**
+ * Get the CPU set index and identifier of the CPU executing the call.
+ *
+ * Same scheduling warnings as for RTMpCpuId().
+ *
+ * @returns CPU set index.
+ * @param   pidCpu      Where to return the CPU identifier. (not optional)
+ */
+RTDECL(int) RTMpCurSetIndexAndId(PRTCPUID pidCpu);
+
+/**
  * Converts a CPU identifier to a CPU set index.
  *
  * This may or may not validate the presence of the CPU.
@@ -215,7 +234,8 @@ RTDECL(uint32_t) RTMpGetMaxFrequency(RTCPUID idCpu);
  * The CPU must be online.
  *
  * @returns IPRT status code.
- * @param   idCpu       The identifier of the CPU.
+ * @param   idCpu       The identifier of the CPU.  NIL_RTCPUID can be used to
+ *                      indicate the current CPU.
  * @param   pszBuf      The output buffer.
  * @param   cbBuf       The size of the output buffer.
  */
@@ -244,6 +264,30 @@ typedef DECLCALLBACK(void) FNRTMPWORKER(RTCPUID idCpu, void *pvUser1, void *pvUs
 /** Pointer to a FNRTMPWORKER. */
 typedef FNRTMPWORKER *PFNRTMPWORKER;
 
+/** @name RTMPON_F_XXX - RTMpOn flags.
+ * @{ */
+/** Caller doesn't care if pfnWorker is executed at the same time on the
+ *  specified CPUs or not, as long as it gets executed. */
+#define RTMPON_F_WHATEVER_EXEC      0
+/** The caller insists on pfnWorker being executed more or less concurrently
+ * on the specified CPUs. */
+#define RTMPON_F_CONCURRENT_EXEC    RT_BIT_32(1)
+/** Mask of valid bits. */
+#define RTMPON_F_VALID_MASK         UINT32_C(0x00000001)
+/** @}*/
+
+/**
+ * Checks if the RTMpOnAll() is safe with regards to all threads executing
+ * concurrently.
+ *
+ * If for instance, the RTMpOnAll() is implemented in a way where the threads
+ * might cause a classic deadlock, it is considered -not- concurrent safe.
+ * Windows currently is one such platform where it isn't safe.
+ *
+ * @returns true if RTMpOnAll() is concurrent safe, false otherwise.
+ */
+RTDECL(bool) RTMpOnAllIsConcurrentSafe(void);
+
 /**
  * Executes a function on each (online) CPU in the system.
  *
@@ -296,6 +340,40 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
 
 /**
+ * Executes a function on two specific CPUs in the system.
+ *
+ * @returns IPRT status code.
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_NOT_SUPPORTED if this kind of operation isn't supported by the
+ *          system or if the specified modifier flag isn't supported.
+ * @retval  VERR_CPU_OFFLINE if one or more of the CPUs are offline (see
+ *          remarks).
+ * @retval  VERR_CPU_NOT_FOUND if on or both of the CPUs weren't found.
+ * @retval  VERR_NOT_ALL_CPUS_SHOWED if one of the CPUs didn't show.
+ *
+ * @param   idCpu1          The id of the first CPU.
+ * @param   idCpu2          The id of the second CPU.
+ * @param   fFlags          Combination of RTMPON_F_XXX flags.
+ * @param   pfnWorker       The worker function.
+ * @param   pvUser1         The first user argument for the worker.
+ * @param   pvUser2         The second user argument for the worker.
+ *
+ * @remarks There is a possible race between one (or both) of the CPUs going
+ *          offline while setting up the call.  The worker function must take
+ *          this into account.
+ */
+RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2);
+
+/**
+ * Indicates whether RTMpOnPair supports running the pfnWorker concurrently on
+ * both CPUs using RTMPON_F_CONCURRENT_EXEC.
+ *
+ * @returns true if supported, false if not.
+ */
+RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void);
+
+
+/**
  * Pokes the specified CPU.
  *
  * This should cause the execution on the CPU to be interrupted and forcing it
@@ -330,8 +408,20 @@ typedef enum RTMPEVENT
 /**
  * Notification callback.
  *
- * The context this is called in differs a bit from platform to
- * platform, so be careful while in here.
+ * The context this is called in differs a bit from platform to platform, so be
+ * careful while in here.
+ *
+ * On Windows we're running with IRQL=PASSIVE_LEVEL (reschedulable) according to
+ * the KeRegisterProcessorChangeCallback documentation - unrestricted API
+ * access. Probably not being called on the onlined/offlined CPU...
+ *
+ * On Solaris we're holding the cpu_lock, IPL/SPL/PIL is not yet known, however
+ * we will most likely -not- be firing on the CPU going offline/online.
+ *
+ * On Linux it looks like we're called with preemption enabled on any CPU and
+ * not necessarily on the CPU going offline/online.
+ *
+ * There is no callbacks for darwin at the moment, due to lack of suitable KPI.
  *
  * @param   idCpu       The CPU this applies to.
  * @param   enmEvent    The event.
diff --git a/include/iprt/net.h b/include/iprt/net.h
index a0b0de3..97f6795 100644
--- a/include/iprt/net.h
+++ b/include/iprt/net.h
@@ -65,21 +65,34 @@ typedef RTNETADDRIPV4 const *PCRTNETADDRIPV4;
  * Tests if the given string is an IPv4 address.
  *
  * @returns boolean.
- * @param   pszAddress          String which may be an IPv4 address.
+ * @param   pcszAddr        String which may be an IPv4 address.
  */
-RTDECL(bool) RTNetIsIPv4AddrStr(const char *pszAddress);
+RTDECL(bool) RTNetIsIPv4AddrStr(const char *pcszAddr);
 
 /**
- * Converts an stringified IPv4 address into the RTNETADDRIPV4 representation.
+ * Parses dotted-decimal IPv4 address into RTNETADDRIPV4 representation.
  *
  * @returns VINF_SUCCESS on success, VERR_INVALID_PARAMETER on
  *          failure.
  *
- * @param   pszAddr         The value to convert.
+ * @param   pcszAddr        The value to convert.
+ * @param   ppszNext        Where to store the pointer to the first char
+ *                            following the address. (Optional)
  * @param   pAddr           Where to store the result.
  */
-RTDECL(int) RTNetStrToIPv4Addr(const char *pszAddr, PRTNETADDRIPV4 pAddr);
+RTDECL(int) RTNetStrToIPv4AddrEx(const char *pcszAddr, PRTNETADDRIPV4 pAddr, char **ppszNext);
 
+/**
+ * Parses dotted-decimal IPv4 address into RTNETADDRIPV4 representation.
+ * Leading and trailing whitespace is ignored.
+ *
+ * @returns VINF_SUCCESS on success, VERR_INVALID_PARAMETER on
+ *          failure.
+ *
+ * @param   pcszAddr        The value to convert.
+ * @param   pAddr           Where to store the result.
+ */
+RTDECL(int) RTNetStrToIPv4Addr(const char *pcszAddr, PRTNETADDRIPV4 pAddr);
 
 /**
  * IPv6 address.
@@ -99,6 +112,33 @@ typedef RTNETADDRIPV6 const *PCRTNETADDRIPV6;
  */
 RTDECL(bool) RTNetIsIPv6AddrStr(const char *pszAddress);
 
+/**
+ * Parses IPv6 address into RTNETADDRIPV6 representation.
+ *
+ * @returns VINF_SUCCESS on success, VERR_INVALID_PARAMETER on
+ *          failure.
+ *
+ * @param   pcszAddr        The value to convert.
+ * @param   ppszNext        Where to store the pointer to the first char
+ *                            following the address. (Optional)
+ * @param   pAddr           Where to store the result.
+ */
+RTDECL(int) RTNetStrToIPv6AddrEx(const char *pcszAddr, PRTNETADDRIPV6 pAddr, char **ppszNext);
+
+/**
+ * Parses IPv6 address into RTNETADDRIPV6 representation.
+ * Leading and trailing whitespace is ignored.
+ *
+ * @returns VINF_SUCCESS on success, VERR_INVALID_PARAMETER on
+ *          failure.
+ *
+ * @param   pcszAddr        The value to convert.
+ * @param   ppszZone        Where to store the pointer to the first char
+ *                            of the zone id.  NULL is stored if there is
+ *                            no zone id.
+ * @param   pAddr           Where to store the result.
+ */
+RTDECL(int) RTNetStrToIPv6Addr(const char *pcszAddr, PRTNETADDRIPV6 pAddr, char **ppszZone);
 
 /**
  * IPX address.
@@ -887,7 +927,7 @@ typedef struct RTNETARPIPV4
     RTNETADDRIPV4   ar_spa;
     /** The target hardware address. */
     RTMAC           ar_tha;
-    /** The arget protocol address. */
+    /** The target protocol address. */
     RTNETADDRIPV4   ar_tpa;
 } RTNETARPIPV4;
 #pragma pack()
diff --git a/include/iprt/nt/nt.h b/include/iprt/nt/nt.h
index bdafa38..26b14aa 100644
--- a/include/iprt/nt/nt.h
+++ b/include/iprt/nt/nt.h
@@ -71,6 +71,9 @@
 #define _PEB_LDR_DATA              Incomplete__PEB_LDR_DATA
 #define PEB_LDR_DATA               Incomplete_PEB_LDR_DATA
 #define PPEB_LDR_DATA              Incomplete_PPEB_LDR_DATA
+#define _KUSER_SHARED_DATA         Incomplete__KUSER_SHARED_DATA
+#define KUSER_SHARED_DATA          Incomplete_KUSER_SHARED_DATA
+#define PKUSER_SHARED_DATA         Incomplete_PKUSER_SHARED_DATA
 
 
 
@@ -208,6 +211,9 @@
 #undef _PEB_LDR_DATA
 #undef PEB_LDR_DATA
 #undef PPEB_LDR_DATA
+#undef _KUSER_SHARED_DATA
+#undef KUSER_SHARED_DATA
+#undef PKUSER_SHARED_DATA
 
 
 #include <iprt/types.h>
@@ -216,7 +222,7 @@
 
 /** @name Useful macros
  * @{ */
-/** Indicates that we're targetting native NT in the current source. */
+/** Indicates that we're targeting native NT in the current source. */
 #define RTNT_USE_NATIVE_NT              1
 /** Initializes a IO_STATUS_BLOCK. */
 #define RTNT_IO_STATUS_BLOCK_INITIALIZER  { STATUS_FAILED_DRIVER_ENTRY, ~(uintptr_t)42 }
@@ -394,6 +400,21 @@ typedef struct _CLIENT_ID
 typedef CLIENT_ID *PCLIENT_ID;
 #endif
 
+/** Extended affinity type, introduced in Windows 7 (?). */
+typedef struct _KAFFINITY_EX
+{
+    /** Count of valid bitmap entries. */
+    uint16_t                Count;
+    /** Count of allocated bitmap entries. */
+    uint16_t                Size;
+    /** Reserved / aligmment padding. */
+    uint32_t                Reserved;
+    /** Bitmap where one bit corresponds to a CPU. */
+    uintptr_t               Bitmap[20];
+} KAFFINITY_EX;
+typedef KAFFINITY_EX *PKAFFINITY_EX;
+typedef KAFFINITY_EX const *PCKAFFINITY_EX;
+
 /** @name User Shared Data
  * @{ */
 
@@ -441,45 +462,46 @@ typedef struct _XSTATE_CONFIGURATION
 } XSTATE_CONFIGURATION;
 typedef XSTATE_CONFIGURATION *PXSTATE_CONFIGURATION;
 # endif
+#endif /* IPRT_NT_USE_WINTERNL */
 
 typedef struct _KUSER_SHARED_DATA
 {
-    ULONG                   TickCountLowDeprecated;
-    ULONG                   TickCountMultiplier;
-    KSYSTEM_TIME volatile   InterruptTime;
-    KSYSTEM_TIME volatile   SystemTime;
-    KSYSTEM_TIME volatile   TimeZoneBias;
-    USHORT                  ImageNumberLow;
-    USHORT                  ImageNumberHigh;
-    WCHAR                   NtSystemRoot[260];
-    ULONG                   MaxStackTraceDepth;
-    ULONG                   CryptoExponent;
-    ULONG                   TimeZoneId;
-    ULONG                   LargePageMinimum;
-    ULONG                   AitSamplingValue;
-    ULONG                   AppCompatFlag;
-    ULONGLONG               RNGSeedVersion;
-    ULONG                   GlobalValidationRunlevel;
-    LONG volatile           TimeZoneBiasStamp;
-    ULONG                   Reserved2;
-    NT_PRODUCT_TYPE         NtProductType;
-    BOOLEAN                 ProductTypeIsValid;
-    BOOLEAN                 Reserved0[1];
-    USHORT                  NativeProcessorArchitecture;
-    ULONG                   NtMajorVersion;
-    ULONG                   NtMinorVersion;
-    BOOLEAN                 ProcessorFeatures[PROCESSOR_FEATURE_MAX];
-    ULONG                   Reserved1;
-    ULONG                   Reserved3;
-    ULONG volatile          TimeSlip;
-    ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
-    ULONG                   AltArchitecturePad[1];
-    LARGE_INTEGER           SystemExpirationDate;
-    ULONG                   SuiteMask;
-    BOOLEAN                 KdDebuggerEnabled;
-    union
+    ULONG                   TickCountLowDeprecated;                     /**< 0x000 */
+    ULONG                   TickCountMultiplier;                        /**< 0x004 */
+    KSYSTEM_TIME volatile   InterruptTime;                              /**< 0x008 */
+    KSYSTEM_TIME volatile   SystemTime;                                 /**< 0x014 */
+    KSYSTEM_TIME volatile   TimeZoneBias;                               /**< 0x020 */
+    USHORT                  ImageNumberLow;                             /**< 0x02c */
+    USHORT                  ImageNumberHigh;                            /**< 0x02e */
+    WCHAR                   NtSystemRoot[260];                          /**< 0x030 */
+    ULONG                   MaxStackTraceDepth;                         /**< 0x238 */
+    ULONG                   CryptoExponent;                             /**< 0x23c */
+    ULONG                   TimeZoneId;                                 /**< 0x240 */
+    ULONG                   LargePageMinimum;                           /**< 0x244 */
+    ULONG                   AitSamplingValue;                           /**< 0x248 */
+    ULONG                   AppCompatFlag;                              /**< 0x24c */
+    ULONGLONG               RNGSeedVersion;                             /**< 0x250 */
+    ULONG                   GlobalValidationRunlevel;                   /**< 0x258 */
+    LONG volatile           TimeZoneBiasStamp;                          /**< 0x25c*/
+    ULONG                   Reserved2;                                  /**< 0x260 */
+    NT_PRODUCT_TYPE         NtProductType;                              /**< 0x264 */
+    BOOLEAN                 ProductTypeIsValid;                         /**< 0x268 */
+    BOOLEAN                 Reserved0[1];                               /**< 0x269 */
+    USHORT                  NativeProcessorArchitecture;                /**< 0x26a */
+    ULONG                   NtMajorVersion;                             /**< 0x26c */
+    ULONG                   NtMinorVersion;                             /**< 0x270 */
+    BOOLEAN                 ProcessorFeatures[PROCESSOR_FEATURE_MAX];   /**< 0x274 */
+    ULONG                   Reserved1;                                  /**< 0x2b4 */
+    ULONG                   Reserved3;                                  /**< 0x2b8 */
+    ULONG volatile          TimeSlip;                                   /**< 0x2bc */
+    ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;              /**< 0x2c0 */
+    ULONG                   AltArchitecturePad[1];                      /**< 0x2c4 */
+    LARGE_INTEGER           SystemExpirationDate;                       /**< 0x2c8 */
+    ULONG                   SuiteMask;                                  /**< 0x2d0 */
+    BOOLEAN                 KdDebuggerEnabled;                          /**< 0x2d4 */
+    union                                                               /**< 0x2d5 */
     {
-        UCHAR               MitigationPolicies;
+        UCHAR               MitigationPolicies;                         /**< 0x2d5 */
         struct
         {
             UCHAR           NXSupportPolicy  : 2;
@@ -488,17 +510,17 @@ typedef struct _KUSER_SHARED_DATA
             UCHAR           Reserved  : 2;
         };
     };
-    UCHAR                   Reserved6[2];
-    ULONG volatile          ActiveConsoleId;
-    ULONG volatile          DismountCount;
-    ULONG                   ComPlusPackage;
-    ULONG                   LastSystemRITEventTickCount;
-    ULONG                   NumberOfPhysicalPages;
-    BOOLEAN                 SafeBootMode;
-    UCHAR                   Reserved12[3];
-    union
+    UCHAR                   Reserved6[2];                               /**< 0x2d6 */
+    ULONG volatile          ActiveConsoleId;                            /**< 0x2d8 */
+    ULONG volatile          DismountCount;                              /**< 0x2dc */
+    ULONG                   ComPlusPackage;                             /**< 0x2e0 */
+    ULONG                   LastSystemRITEventTickCount;                /**< 0x2e4 */
+    ULONG                   NumberOfPhysicalPages;                      /**< 0x2e8 */
+    BOOLEAN                 SafeBootMode;                               /**< 0x2ec */
+    UCHAR                   Reserved12[3];                              /**< 0x2ed */
+    union                                                               /**< 0x2f0 */
     {
-        ULONG               SharedDataFlags;
+        ULONG               SharedDataFlags;                            /**< 0x2f0 */
         struct
         {
             ULONG           DbgErrorPortPresent  : 1;
@@ -512,57 +534,87 @@ typedef struct _KUSER_SHARED_DATA
             ULONG           SpareBits  : 24;
         };
     };
-    ULONG                   DataFlagsPad[1];
-    ULONGLONG               TestRetInstruction;
-    LONGLONG                QpcFrequency;
-    ULONGLONG               SystemCallPad[3];
-    union
+    ULONG                   DataFlagsPad[1];                            /**< 0x2f4 */
+    ULONGLONG               TestRetInstruction;                         /**< 0x2f8 */
+    LONGLONG                QpcFrequency;                               /**< 0x300 */
+    ULONGLONG               SystemCallPad[3];                           /**< 0x308 */
+    union                                                               /**< 0x320 */
     {
-        ULONG64 volatile    TickCountQuad;
-        KSYSTEM_TIME volatile TickCount;
-        struct
+        ULONG64 volatile    TickCountQuad;                              /**< 0x320 */
+        KSYSTEM_TIME volatile TickCount;                                /**< 0x320 */
+        struct                                                          /**< 0x320 */
         {
-            ULONG           ReservedTickCountOverlay[3];
-            ULONG           TickCountPad[1];
+            ULONG           ReservedTickCountOverlay[3];                /**< 0x320 */
+            ULONG           TickCountPad[1];                            /**< 0x32c */
         };
     };
-    ULONG                   Cookie;
-    ULONG                   CookiePad[1];
-    LONGLONG                ConsoleSessionForegroundProcessId;
-    ULONGLONG               TimeUpdateLock;
-    ULONGLONG               BaselineSystemTimeQpc;
-    ULONGLONG               BaselineInterruptTimeQpc;
-    ULONGLONG               QpcSystemTimeIncrement;
-    ULONGLONG               QpcInterruptTimeIncrement;
-    ULONG                   QpcSystemTimeIncrement32;
-    ULONG                   QpcInterruptTimeIncrement32;
-    UCHAR                   QpcSystemTimeIncrementShift;
-    UCHAR                   QpcInterruptTimeIncrementShift;
-    UCHAR                   Reserved8[14];
-    USHORT                  UserModeGlobalLogger[16];
-    ULONG                   ImageFileExecutionOptions;
-    ULONG                   LangGenerationCount;
-    ULONGLONG               Reserved4;
-    ULONGLONG volatile      InterruptTimeBias;
-    ULONGLONG volatile      QpcBias;
-    ULONG volatile          ActiveProcessorCount;
-    UCHAR volatile          ActiveGroupCount;
-    UCHAR                   Reserved9;
-    union
+    ULONG                   Cookie;                                     /**< 0x330 */
+    ULONG                   CookiePad[1];                               /**< 0x334 */
+    LONGLONG                ConsoleSessionForegroundProcessId;          /**< 0x338 */
+    ULONGLONG               TimeUpdateLock;                             /**< 0x340 */
+    ULONGLONG               BaselineSystemTimeQpc;                      /**< 0x348 */
+    ULONGLONG               BaselineInterruptTimeQpc;                   /**< 0x350 */
+    ULONGLONG               QpcSystemTimeIncrement;                     /**< 0x358 */
+    ULONGLONG               QpcInterruptTimeIncrement;                  /**< 0x360 */
+    ULONG                   QpcSystemTimeIncrement32;                   /**< 0x368 */
+    ULONG                   QpcInterruptTimeIncrement32;                /**< 0x36c */
+    UCHAR                   QpcSystemTimeIncrementShift;                /**< 0x370 */
+    UCHAR                   QpcInterruptTimeIncrementShift;             /**< 0x371 */
+    UCHAR                   Reserved8[14];                              /**< 0x372 */
+    USHORT                  UserModeGlobalLogger[16];                   /**< 0x380 */
+    ULONG                   ImageFileExecutionOptions;                  /**< 0x3a0 */
+    ULONG                   LangGenerationCount;                        /**< 0x3a4 */
+    ULONGLONG               Reserved4;                                  /**< 0x3a8 */
+    ULONGLONG volatile      InterruptTimeBias;                          /**< 0x3b0 */
+    ULONGLONG volatile      QpcBias;                                    /**< 0x3b8 */
+    ULONG volatile          ActiveProcessorCount;                       /**< 0x3c0 */
+    UCHAR volatile          ActiveGroupCount;                           /**< 0x3c4 */
+    UCHAR                   Reserved9;                                  /**< 0x3c5 */
+    union                                                               /**< 0x3c6 */
     {
-        USHORT              QpcData;
-        struct
+        USHORT              QpcData;                                    /**< 0x3c6 */
+        struct                                                          /**< 0x3c6 */
         {
-            BOOLEAN volatile QpcBypassEnabled;
-            UCHAR           QpcShift;
+            BOOLEAN volatile QpcBypassEnabled;                          /**< 0x3c6 */
+            UCHAR           QpcShift;                                   /**< 0x3c7 */
         };
     };
-    LARGE_INTEGER           TimeZoneBiasEffectiveStart;
-    LARGE_INTEGER           TimeZoneBiasEffectiveEnd;
-    XSTATE_CONFIGURATION    XState;
+    LARGE_INTEGER           TimeZoneBiasEffectiveStart;                 /**< 0x3c8 */
+    LARGE_INTEGER           TimeZoneBiasEffectiveEnd;                   /**< 0x3d0 */
+    XSTATE_CONFIGURATION    XState;                                     /**< 0x3d8 */
 } KUSER_SHARED_DATA;
 typedef KUSER_SHARED_DATA *PKUSER_SHARED_DATA;
-#endif /* IPRT_NT_USE_WINTERNL */
+AssertCompileMemberOffset(KUSER_SHARED_DATA, InterruptTime,             0x008);
+AssertCompileMemberOffset(KUSER_SHARED_DATA, SystemTime,                0x014);
+AssertCompileMemberOffset(KUSER_SHARED_DATA, NtSystemRoot,              0x030);
+AssertCompileMemberOffset(KUSER_SHARED_DATA, LargePageMinimum,          0x244);
+AssertCompileMemberOffset(KUSER_SHARED_DATA, Reserved1,                 0x2b4);
+AssertCompileMemberOffset(KUSER_SHARED_DATA, TestRetInstruction,        0x2f8);
+AssertCompileMemberOffset(KUSER_SHARED_DATA, Cookie,                    0x330);
+AssertCompileMemberOffset(KUSER_SHARED_DATA, ImageFileExecutionOptions, 0x3a0);
+AssertCompileMemberOffset(KUSER_SHARED_DATA, XState,                    0x3d8);
+/** @def MM_SHARED_USER_DATA_VA
+ * Read only userland mapping of KUSER_SHARED_DATA. */
+#ifndef MM_SHARED_USER_DATA_VA
+# if ARCH_BITS == 32
+#  define MM_SHARED_USER_DATA_VA        UINT32_C(0x7ffe0000)
+# elif ARCH_BITS == 64
+#  define MM_SHARED_USER_DATA_VA        UINT64_C(0x7ffe0000)
+# else
+#  error "Unsupported/undefined ARCH_BITS value."
+# endif
+#endif
+/** @def KI_USER_SHARED_DATA
+ * Read write kernel mapping of KUSER_SHARED_DATA. */
+#ifndef KI_USER_SHARED_DATA
+# ifdef RT_ARCH_X86
+#  define KI_USER_SHARED_DATA           UINT32_C(0xffdf0000)
+# elif defined(RT_ARCH_AMD64)
+#  define KI_USER_SHARED_DATA           UINT64_C(0xfffff78000000000)
+# else
+#  error "PORT ME - KI_USER_SHARED_DATA"
+# endif
+#endif
 /** @} */
 
 
@@ -2139,6 +2191,44 @@ RT_C_DECLS_END
  * @{ */
 RT_C_DECLS_BEGIN
 
+typedef ULONG KEPROCESSORINDEX; /**< Bitmap indexes != process numbers, apparently. */
+
+NTSYSAPI VOID     NTAPI KeInitializeAffinityEx(PKAFFINITY_EX pAffinity);
+typedef  VOID    (NTAPI *PFNKEINITIALIZEAFFINITYEX)(PKAFFINITY_EX pAffinity);
+NTSYSAPI VOID     NTAPI KeAddProcessorAffinityEx(PKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+typedef  VOID    (NTAPI *PFNKEADDPROCESSORAFFINITYEX)(PKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+NTSYSAPI VOID     NTAPI KeRemoveProcessorAffinityEx(PKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+typedef  VOID    (NTAPI *PFNKEREMOVEPROCESSORAFFINITYEX)(PKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+NTSYSAPI BOOLEAN  NTAPI KeInterlockedSetProcessorAffinityEx(PKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+typedef  BOOLEAN (NTAPI *PFNKEINTERLOCKEDSETPROCESSORAFFINITYEX)(PKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+NTSYSAPI BOOLEAN  NTAPI KeInterlockedClearProcessorAffinityEx(PKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+typedef  BOOLEAN (NTAPI *PFNKEINTERLOCKEDCLEARPROCESSORAFFINITYEX)(PKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+NTSYSAPI BOOLEAN  NTAPI KeCheckProcessorAffinityEx(PCKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+typedef  BOOLEAN (NTAPI *PFNKECHECKPROCESSORAFFINITYEX)(PCKAFFINITY_EX pAffinity, KEPROCESSORINDEX idxProcessor);
+NTSYSAPI VOID     NTAPI KeCopyAffinityEx(PKAFFINITY_EX pDst, PCKAFFINITY_EX pSrc);
+typedef  VOID    (NTAPI *PFNKECOPYAFFINITYEX)(PKAFFINITY_EX pDst, PCKAFFINITY_EX pSrc);
+NTSYSAPI VOID     NTAPI KeComplementAffinityEx(PKAFFINITY_EX pResult, PCKAFFINITY_EX pIn);
+typedef  VOID    (NTAPI *PFNKECOMPLEMENTAFFINITYEX)(PKAFFINITY_EX pResult, PCKAFFINITY_EX pIn);
+NTSYSAPI BOOLEAN  NTAPI KeAndAffinityEx(PCKAFFINITY_EX pIn1, PCKAFFINITY_EX pIn2, PKAFFINITY_EX pResult OPTIONAL);
+typedef  BOOLEAN (NTAPI *PFNKEANDAFFINITYEX)(PCKAFFINITY_EX pIn1, PCKAFFINITY_EX pIn2, PKAFFINITY_EX pResult OPTIONAL);
+NTSYSAPI BOOLEAN  NTAPI KeOrAffinityEx(PCKAFFINITY_EX pIn1, PCKAFFINITY_EX pIn2, PKAFFINITY_EX pResult OPTIONAL);
+typedef  BOOLEAN (NTAPI *PFNKEORAFFINITYEX)(PCKAFFINITY_EX pIn1, PCKAFFINITY_EX pIn2, PKAFFINITY_EX pResult OPTIONAL);
+/** Works like anding the complemented subtrahend with the minuend. */
+NTSYSAPI BOOLEAN  NTAPI KeSubtractAffinityEx(PCKAFFINITY_EX pMinuend, PCKAFFINITY_EX pSubtrahend, PKAFFINITY_EX pResult OPTIONAL);
+typedef  BOOLEAN (NTAPI *PFNKESUBTRACTAFFINITYEX)(PCKAFFINITY_EX pMinuend, PCKAFFINITY_EX pSubtrahend, PKAFFINITY_EX pResult OPTIONAL);
+NTSYSAPI BOOLEAN  NTAPI KeIsEqualAffinityEx(PCKAFFINITY_EX pLeft, PCKAFFINITY_EX pRight);
+typedef  BOOLEAN (NTAPI *PFNKEISEQUALAFFINITYEX)(PCKAFFINITY_EX pLeft, PCKAFFINITY_EX pRight);
+NTSYSAPI BOOLEAN  NTAPI KeIsEmptyAffinityEx(PCKAFFINITY_EX pAffinity);
+typedef  BOOLEAN (NTAPI *PFNKEISEMPTYAFFINITYEX)(PCKAFFINITY_EX pAffinity);
+NTSYSAPI BOOLEAN  NTAPI KeIsSubsetAffinityEx(PCKAFFINITY_EX pSubset, PCKAFFINITY_EX pSuperSet);
+typedef  BOOLEAN (NTAPI *PFNKEISSUBSETAFFINITYEX)(PCKAFFINITY_EX pSubset, PCKAFFINITY_EX pSuperSet);
+NTSYSAPI ULONG    NTAPI KeCountSetBitsAffinityEx(PCKAFFINITY_EX pAffinity);
+typedef  ULONG   (NTAPI *PFNKECOUNTSETAFFINITYEX)(PCKAFFINITY_EX pAffinity);
+NTSYSAPI KEPROCESSORINDEX  NTAPI KeFindFirstSetLeftAffinityEx(PCKAFFINITY_EX pAffinity);
+typedef  KEPROCESSORINDEX (NTAPI *PFNKEFINDFIRSTSETLEFTAFFINITYEX)(PCKAFFINITY_EX pAffinity);
+typedef  NTSTATUS (NTAPI *PFNKEGETPROCESSORNUMBERFROMINDEX)(KEPROCESSORINDEX idxProcessor, PPROCESSOR_NUMBER pProcNumber);
+typedef  KEPROCESSORINDEX (NTAPI *PFNKEGETPROCESSORINDEXFROMNUMBER)(const PROCESSOR_NUMBER *pProcNumber);
+
 NTSYSAPI BOOLEAN  NTAPI ObFindHandleForObject(PEPROCESS pProcess, PVOID pvObject, POBJECT_TYPE pObjectType,
                                               PVOID pvOptionalConditions, PHANDLE phFound);
 NTSYSAPI NTSTATUS NTAPI ObReferenceObjectByName(PUNICODE_STRING pObjectPath, ULONG fAttributes, PACCESS_STATE pAccessState,
@@ -2151,6 +2241,9 @@ NTSYSAPI ULONG    NTAPI PsGetProcessSessionId(PEPROCESS);
 extern DECLIMPORT(POBJECT_TYPE *) LpcPortObjectType;            /**< In vista+ this is the ALPC port object type. */
 extern DECLIMPORT(POBJECT_TYPE *) LpcWaitablePortObjectType;    /**< In vista+ this is the ALPC port object type. */
 
+typedef VOID (NTAPI *PFNHALREQUESTIPI_PRE_W7)(KAFFINITY TargetSet);
+typedef VOID (NTAPI *PFNHALREQUESTIPI_W7PLUS)(ULONG uUsuallyZero, PCKAFFINITY_EX pTargetSet);
+
 RT_C_DECLS_END
 /** @ */
 #endif /* IN_RING0 */
@@ -2362,6 +2455,9 @@ NTSYSAPI ULONG NTAPI    RtlGetLastWin32Error(VOID);
 NTSYSAPI VOID NTAPI     RtlSetLastWin32Error(ULONG uError);
 NTSYSAPI VOID NTAPI     RtlSetLastWin32ErrorAndNtStatusFromNtStatus(NTSTATUS rcNt);
 NTSYSAPI VOID NTAPI     RtlRestoreLastWin32Error(ULONG uError);
+NTSYSAPI BOOLEAN NTAPI  RtlQueryPerformanceCounter(PLARGE_INTEGER);
+NTSYSAPI uint64_t NTAPI RtlGetSystemTimePrecise(VOID);
+typedef uint64_t (NTAPI * PFNRTLGETSYSTEMTIMEPRECISE)(VOID);
 
 RT_C_DECLS_END
 /** @} */
diff --git a/include/iprt/path.h b/include/iprt/path.h
index d147d95..7e42754 100644
--- a/include/iprt/path.h
+++ b/include/iprt/path.h
@@ -341,11 +341,11 @@ RTDECL(char *) RTPathAbsExDup(const char *pszBase, const char *pszPath);
 RTDECL(void) RTPathStripFilename(char *pszPath);
 
 /**
- * Strips the extension from a path.
+ * Strips the last suffix from a path.
  *
- * @param   pszPath     Path which extension should be stripped.
+ * @param   pszPath     Path which suffix should be stripped.
  */
-RTDECL(void) RTPathStripExt(char *pszPath);
+RTDECL(void) RTPathStripSuffix(char *pszPath);
 
 /**
  * Strips the trailing slashes of a path name.
@@ -422,24 +422,27 @@ RTDECL(char *) RTPathFilename(const char *pszPath);
 RTDECL(char *) RTPathFilenameEx(const char *pszPath, uint32_t fFlags);
 
 /**
- * Finds the extension part of in a path.
+ * Finds the suffix part of in a path (last dot and onwards).
  *
- * @returns Pointer to extension within pszPath.
- * @returns NULL if no extension.
- * @param   pszPath     Path to find extension in.
+ * @returns Pointer to suffix within pszPath.
+ * @returns NULL if no suffix
+ * @param   pszPath     Path to find suffix in.
+ *
+ * @remarks IPRT terminology: A suffix includes the dot, the extension starts
+ *          after the dot. For instance suffix '.txt' and extension 'txt'.
  */
-RTDECL(char *) RTPathExt(const char *pszPath);
+RTDECL(char *) RTPathSuffix(const char *pszPath);
 
 /**
- * Checks if a path has an extension.
+ * Checks if a path has an extension / suffix.
  *
- * @returns true if extension present.
- * @returns false if no extension.
+ * @returns true if extension / suffix present.
+ * @returns false if no extension / suffix.
  * @param   pszPath     Path to check.
  */
-RTDECL(bool) RTPathHasExt(const char *pszPath);
-/** Misspelled, don't use.  */
-#define RTPathHaveExt   RTPathHasExt
+RTDECL(bool) RTPathHasSuffix(const char *pszPath);
+/** Same thing, different name.  */
+#define RTPathHasExt RTPathHasSuffix
 
 /**
  * Checks if a path includes more than a filename.
diff --git a/include/iprt/queueatomic.h b/include/iprt/queueatomic.h
index b5de948..dfd2094 100644
--- a/include/iprt/queueatomic.h
+++ b/include/iprt/queueatomic.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -29,7 +29,7 @@
 #include <iprt/types.h>
 #include <iprt/asm.h>
 
-/** @defgroup grp_rt_list    RTQueueAtomic - Generic Work Queue
+/** @defgroup grp_rt_queueatomic RTQueueAtomic - Generic Work Queue
  * @ingroup grp_rt
  *
  * Implementation of a lockless work queue for threaded environments.
@@ -121,3 +121,4 @@ RT_C_DECLS_END
 /** @} */
 
 #endif
+
diff --git a/include/iprt/socket.h b/include/iprt/socket.h
index a498ad3..8cd6c2d 100644
--- a/include/iprt/socket.h
+++ b/include/iprt/socket.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -39,7 +39,7 @@
 
 RT_C_DECLS_BEGIN
 
-/** @defgroup grp_rt_tcp    RTSocket - Network Sockets
+/** @defgroup grp_rt_socket RTSocket - Network Sockets
  * @ingroup grp_rt
  * @{
  */
diff --git a/include/iprt/spinlock.h b/include/iprt/spinlock.h
index 1ca3dfc..6c48e2d 100644
--- a/include/iprt/spinlock.h
+++ b/include/iprt/spinlock.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -83,9 +83,6 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock);
  */
 RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock);
 
-/* Temporarily, only for checking the spinlock creation flags. */
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock);
-
 
 /** @} */
 
diff --git a/include/iprt/stream.h b/include/iprt/stream.h
index cba8a86..fce84c2 100644
--- a/include/iprt/stream.h
+++ b/include/iprt/stream.h
@@ -126,6 +126,26 @@ RTR3DECL(int) RTStrmClearError(PRTSTREAM pStream);
 RTR3DECL(int) RTStrmSetMode(PRTSTREAM pStream, int fBinary, int fCurrentCodeSet);
 
 /**
+ * Returns the current echo mode.
+ * This works only for standard input streams.
+ *
+ * @returns iprt status code.
+ * @param   pStream         The stream.
+ * @param   pfEchoChars     Where to store the flag whether typed characters are echoed.
+ */
+RTR3DECL(int) RTStrmInputGetEchoChars(PRTSTREAM pStream, bool *pfEchoChars);
+
+/**
+ * Changes the behavior for echoing inpit characters on the command line.
+ * This works only for standard input streams.
+ *
+ * @returns iprt status code.
+ * @param   pStream         The stream.
+ * @param   fEchoChars      Flag whether echoing typed characters is wanted.
+ */
+RTR3DECL(int) RTStrmInputSetEchoChars(PRTSTREAM pStream, bool fEchoChars);
+
+/**
  * Rewinds the stream.
  *
  * Stream errors will be reset on success.
diff --git a/include/iprt/string.h b/include/iprt/string.h
index 60d2346..55ed7a7 100644
--- a/include/iprt/string.h
+++ b/include/iprt/string.h
@@ -2601,7 +2601,6 @@ RTDECL(int) RTStrVersionCompare(const char *pszVer1, const char *pszVer2);
 
 
 /** @defgroup rt_str_conv   String To/From Number Conversions
- * @ingroup grp_rt_str
  * @{ */
 
 /**
@@ -3043,7 +3042,6 @@ RTDECL(int) RTStrConvertHexBytes(char const *pszHex, void *pv, size_t cb, uint32
 
 
 /** @defgroup rt_str_space  Unique String Space
- * @ingroup grp_rt_str
  * @{
  */
 
@@ -3165,7 +3163,6 @@ RTDECL(int) RTStrSpaceEnumerate(PRTSTRSPACE pStrSpace, PFNRTSTRSPACECALLBACK pfn
 
 
 /** @defgroup rt_str_hash       Sting hashing
- * @ingroup grp_rt_str
  * @{ */
 
 /**
@@ -3214,7 +3211,6 @@ RTDECL(uint32_t)    RTStrHash1ExNV(size_t cPairs, va_list va);
 
 
 /** @defgroup rt_str_utf16      UTF-16 String Manipulation
- * @ingroup grp_rt_str
  * @{
  */
 
@@ -4060,7 +4056,6 @@ RTDECL(int) RTUtf16PrintHexBytes(PRTUTF16 pwszBuf, size_t cwcBuf, void const *pv
 
 
 /** @defgroup rt_str_latin1     Latin-1 (ISO-8859-1) String Manipulation
- * @ingroup grp_rt_str
  * @{
  */
 
diff --git a/include/iprt/tar.h b/include/iprt/tar.h
index 0b85af3..1884cb8 100644
--- a/include/iprt/tar.h
+++ b/include/iprt/tar.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2009-2010 Oracle Corporation
+ * Copyright (C) 2009-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -34,6 +34,10 @@ RT_C_DECLS_BEGIN
 
 /** @defgroup grp_rt_tar    RTTar - Tar archive I/O
  * @ingroup grp_rt
+ *
+ * @deprecated  Only used for legacy code and writing.  Migrate new code to the
+ *              VFS interface, add the write part when needed.
+ *
  * @{
  */
 
@@ -56,47 +60,19 @@ typedef RTTARFILE                               *PRTTARFILE;
 #define RTTAR_NAME_MAX                           99
 
 /**
- * Opens a Tar archive.
+ * Creates a Tar archive.
  *
- * Use the mask to specify the access type. In create mode the target file
- * have not to exists.
+ * Use the mask to specify the access type.
  *
  * @returns IPRT status code.
  *
  * @param   phTar          Where to store the RTTAR handle.
- * @param   pszTarname     The file name of the tar archive to open.
+ * @param   pszTarname     The file name of the tar archive to create.  Should
+ *                         not exist.
  * @param   fMode          Open flags, i.e a combination of the RTFILE_O_* defines.
  *                         The ACCESS, ACTION and DENY flags are mandatory!
- * @param   fStream        Open the file in stream mode. Within this mode no
- *                         seeking is allowed. Use this together with
- *                         RTTarFileCurrent, RTTarFileOpenCurrent,
- *                         RTTarFileSeekNextFile and the read method to
- *                         sequential read a tar file. Currently ignored with
- *                         RTFILE_O_WRITE.
- */
-RTR3DECL(int) RTTarOpen(PRTTAR phTar, const char *pszTarname, uint32_t fMode, bool fStream);
-
-#if 0
-/**
- * Opens a Tar archive by handle.
- *
- * Use the mask to specify the access type. In create mode the target file
- * have not to exists.
- *
- * @returns IPRT status code.
- *
- * @param   phTar          Where to store the RTTAR handle.
- * @param   hFile          The file handle of the tar file.  This is expected
- *                         to be a regular file at the moment.
- * @param   fStream        Open the file in stream mode. Within this mode no
- *                         seeking is allowed.  Use this together with
- *                         RTTarFileCurrent, RTTarFileOpenCurrent,
- *                         RTTarFileSeekNextFile and the read method to
- *                         sequential read a tar file.  Currently ignored with
- *                         RTFILE_O_WRITE.
  */
-RTR3DECL(int) RTTarOpenByHandle(PRTTAR phTar, RTFILE hFile, uint32_t fMode, bool fStream);
-#endif
+RTR3DECL(int) RTTarOpen(PRTTAR phTar, const char *pszTarname, uint32_t fMode);
 
 /**
  * Close the Tar archive.
@@ -138,42 +114,6 @@ RTR3DECL(int) RTTarFileOpen(RTTAR hTar, PRTTARFILE phFile, const char *pszFilena
 RTR3DECL(int) RTTarFileClose(RTTARFILE hFile);
 
 /**
- * Changes the read & write position in a file.
- *
- * @returns IPRT status code.
- *
- * @param   hFile          Handle to the file.
- * @param   offSeek        Offset to seek.
- * @param   uMethod        Seek method, i.e. one of the RTFILE_SEEK_* defines.
- * @param   poffActual     Where to store the new file position.
- *                         NULL is allowed.
- */
-RTR3DECL(int) RTTarFileSeek(RTTARFILE hFile, uint64_t offSeek, unsigned uMethod, uint64_t *poffActual);
-
-/**
- * Gets the current file position.
- *
- * @returns File offset.
- * @returns UINT64_MAX on failure.
- *
- * @param   hFile          Handle to the file.
- */
-RTR3DECL(uint64_t) RTTarFileTell(RTTARFILE hFile);
-
-/**
- * Read bytes from a file.
- *
- * @returns IPRT status code.
- *
- * @param   hFile          Handle to the file.
- * @param   pvBuf          Where to put the bytes we read.
- * @param   cbToRead       How much to read.
- * @param   *pcbRead       How much we actually read .
- *                         If NULL an error will be returned for a partial read.
- */
-RTR3DECL(int) RTTarFileRead(RTTARFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead);
-
-/**
  * Read bytes from a file at a given offset.
  * This function may modify the file position.
  *
@@ -183,25 +123,12 @@ RTR3DECL(int) RTTarFileRead(RTTARFILE hFile, void *pvBuf, size_t cbToRead, size_
  * @param   off            Where to read.
  * @param   pvBuf          Where to put the bytes we read.
  * @param   cbToRead       How much to read.
- * @param   *pcbRead       How much we actually read .
- *                         If NULL an error will be returned for a partial read.
+ * @param   pcbRead        Where to return how much we actually read.  If NULL
+ *                         an error will be returned for a partial read.
  */
 RTR3DECL(int) RTTarFileReadAt(RTTARFILE hFile, uint64_t off, void *pvBuf, size_t cbToRead, size_t *pcbRead);
 
 /**
- * Write bytes to a file.
- *
- * @returns IPRT status code.
- *
- * @param   hFile          Handle to the file.
- * @param   pvBuf          What to write.
- * @param   cbToWrite      How much to write.
- * @param   *pcbWritten    How much we actually wrote.
- *                         If NULL an error will be returned for a partial write.
- */
-RTR3DECL(int) RTTarFileWrite(RTTARFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
-
-/**
  * Write bytes to a file at a given offset.
  * This function may modify the file position.
  *
@@ -211,8 +138,8 @@ RTR3DECL(int) RTTarFileWrite(RTTARFILE hFile, const void *pvBuf, size_t cbToWrit
  * @param   off            Where to write.
  * @param   pvBuf          What to write.
  * @param   cbToWrite      How much to write.
- * @param   *pcbWritten    How much we actually wrote.
- *                         If NULL an error will be returned for a partial write.
+ * @param   pcbWritten     Where to return how much we actually wrote.  If NULL
+ *                         an error will be returned for a partial write.
  */
 RTR3DECL(int) RTTarFileWriteAt(RTTARFILE hFile, uint64_t off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
 
@@ -236,225 +163,9 @@ RTR3DECL(int) RTTarFileGetSize(RTTARFILE hFile, uint64_t *pcbSize);
  */
 RTR3DECL(int) RTTarFileSetSize(RTTARFILE hFile, uint64_t cbSize);
 
-/**
- * Gets the mode flags of an open file.
- *
- * @returns IPRT status code.
- *
- * @param   hFile          Handle to the file.
- * @param   pfMode         Where to store the file mode, see @ref grp_rt_fs for details.
- */
-RTR3DECL(int) RTTarFileGetMode(RTTARFILE hFile, uint32_t *pfMode);
-
-/**
- * Changes the mode flags of an open file.
- *
- * @returns IPRT status code.
- *
- * @param   hFile          Handle to the file.
- * @param   fMode          The new file mode, see @ref grp_rt_fs for details.
- */
-RTR3DECL(int) RTTarFileSetMode(RTTARFILE hFile, uint32_t fMode);
-
-/**
- * Gets the modification timestamp of the file.
- *
- * @returns IPRT status code.
- *
- * @param   pFile           Handle to the file.
- * @param   pTime           Where to store the time.
- */
-RTR3DECL(int) RTTarFileGetTime(RTTARFILE hFile, PRTTIMESPEC pTime);
-
-/**
- * Sets the modification timestamp of the file.
- *
- * @returns IPRT status code.
- *
- * @param   pFile           Handle to the file.
- * @param   pTime           The time to store.
- */
-RTR3DECL(int) RTTarFileSetTime(RTTARFILE hFile, PRTTIMESPEC pTime);
-
-/**
- * Gets the owner and/or group of an open file.
- *
- * @returns IPRT status code.
- *
- * @param   hFile           Handle to the file.
- * @param   pUid            Where to store the owner user id. NULL is ok.
- * @param   pGid            Where to store the group id. NULL is ok.
- */
-RTR3DECL(int) RTTarFileGetOwner(RTTARFILE hFile, uint32_t *pUid, uint32_t *pGid);
-
-/**
- * Changes the owner and/or group of an open file.
- *
- * @returns IPRT status code.
- *
- * @param   hFile           Handle to the file.
- * @param   uid             The new file owner user id. Use -1 (or ~0) to leave this unchanged.
- * @param   gid             The new group id. Use -1 (or ~0) to leave this unchanged.
- */
-RTR3DECL(int) RTTarFileSetOwner(RTTARFILE hFile, uint32_t uid, uint32_t gid);
-
-/******************************************************************************
- *   Convenience Functions                                                    *
- ******************************************************************************/
-
-/**
- * Check if the specified file exists in the Tar archive.
- *
- * (The matching is case sensitive.)
- *
- * @note    Currently only regular files are supported.
- *
- * @returns IPRT status code.
- * @retval  VINF_SUCCESS when the file exists in the Tar archive.
- * @retval  VERR_FILE_NOT_FOUND when the file not exists in the Tar archive.
- *
- * @param   pszTarFile      Tar file to check.
- * @param   pszFile         Filename to check for.
- *
- * @todo    This is predicate function which SHALL return bool!
- */
-RTR3DECL(int) RTTarFileExists(const char *pszTarFile, const char *pszFile);
-
-/**
- * Create a file list from a Tar archive.
- *
- * @note    Currently only regular files are supported.
- *
- * @returns IPRT status code.
- *
- * @param   pszTarFile      Tar file to list files from.
- * @param   ppapszFiles     On success an array with array with the filenames is
- *                          returned. The names must be freed with RTStrFree and
- *                          the array with RTMemFree.
- * @param   pcFiles         On success the number of entries in ppapszFiles.
- */
-RTR3DECL(int) RTTarList(const char *pszTarFile, char ***ppapszFiles, size_t *pcFiles);
-
-/**
- * Extract a file from a Tar archive into a memory buffer.
- *
- * The caller is responsible for the deletion of the returned memory buffer.
- *
- * (The matching is case sensitive.)
- *
- * @note    Currently only regular files are supported. Also some of the header
- *          fields are not used (uid, gid, uname, gname, mtime).
- *
- * @returns IPRT status code.
- *
- * @param   pszTarFile           Tar file to extract files from.
- * @param   ppBuf                The buffer which will held the extracted data.
- * @param   pcbSize              The size (in bytes) of ppBuf after successful
- *                               extraction.
- * @param   pszFile              The file to extract.
- * @param   pfnProgressCallback  Progress callback function. Optional.
- * @param   pvUser               User defined data for the progress
- *                               callback. Optional.
- */
-RTR3DECL(int) RTTarExtractFileToBuf(const char *pszTarFile, void **ppvBuf, size_t *pcbSize, const char *pszFile,
-                                    PFNRTPROGRESS pfnProgressCallback, void *pvUser);
-
-/**
- * Extract a set of files from a Tar archive.
- *
- * Also note that this function is atomic. If an error occurs all previously
- * extracted files will be deleted.
- *
- * (The matching is case sensitive.)
- *
- * @note    Currently only regular files are supported. Also some of the header
- *          fields are not used (uid, gid, uname, gname, mtime).
- *
- * @returns IPRT status code.
- *
- * @param   pszTarFile           Tar file to extract files from.
- * @param   pszOutputDir         Where to store the extracted files. Must exist.
- * @param   papszFiles           Which files should be extracted.
- * @param   cFiles               The number of files in papszFiles.
- * @param   pfnProgressCallback  Progress callback function. Optional.
- * @param   pvUser               User defined data for the progress
- *                               callback. Optional.
- */
-RTR3DECL(int) RTTarExtractFiles(const char *pszTarFile, const char *pszOutputDir, const char * const *papszFiles, size_t cFiles, PFNRTPROGRESS pfnProgressCallback, void *pvUser);
-
-/**
- * Extract all files of the archive.
- *
- * @note    Currently only regular files are supported. Also some of the header
- *          fields are not used (uid, gid, uname, gname, mtime).
- *
- * @returns IPRT status code.
- *
- * @param   pszTarFile           Tar file to extract the files from.
- * @param   pszOutputDir         Where to store the extracted files. Must exist.
- * @param   pfnProgressCallback  Progress callback function. Optional.
- * @param   pvUser               User defined data for the progress
- *                               callback. Optional.
- */
-RTR3DECL(int) RTTarExtractAll(const char *pszTarFile, const char *pszOutputDir, PFNRTPROGRESS pfnProgressCallback, void *pvUser);
-
-/**
- * Create a Tar archive out of the given files.
- *
- * @note Currently only regular files are supported.
- *
- * @returns IPRT status code.
- *
- * @param   pszTarFile           Where to create the Tar archive.
- * @param   papszFiles           Which files should be included.
- * @param   cFiles               The number of files in papszFiles.
- * @param   pfnProgressCallback  Progress callback function. Optional.
- * @param   pvUser               User defined data for the progress
- *                               callback. Optional.
- */
-RTR3DECL(int) RTTarCreate(const char *pszTarFile, const char * const *papszFiles, size_t cFiles, PFNRTPROGRESS pfnProgressCallback, void *pvUser);
-
-/******************************************************************************
- *   Streaming Functions                                                      *
- ******************************************************************************/
-
-/**
- * Return the filename where RTTar currently stays at.
- *
- * @returns IPRT status code.
- *
- * @param   hTar           Handle to the RTTAR interface.
- * @param   ppszFilename   On success the filename.
- */
-RTR3DECL(int) RTTarCurrentFile(RTTAR hTar, char **ppszFilename);
-
-/**
- * Jumps to the next file from the current RTTar position.
- *
- * @returns IPRT status code.
- *
- * @param   hTar           Handle to the RTTAR interface.
- */
-RTR3DECL(int) RTTarSeekNextFile(RTTAR hTar);
-
-/**
- * Opens the file where RTTar currently stays at.
- *
- * @returns IPRT status code.
- *
- * @param   hTar           Handle to the RTTAR interface.
- * @param   phFile         Where to store the handle to the opened file.
- * @param   ppszFilename   On success the filename.
- * @param   fOpen          Open flags, i.e a combination of the RTFILE_O_* defines.
- *                         The ACCESS, ACTION flags are mandatory! Currently
- *                         only RTFILE_O_OPEN | RTFILE_O_READ is supported.
- */
-RTR3DECL(int) RTTarFileOpenCurrentFile(RTTAR hTar, PRTTARFILE phFile, char **ppszFilename, uint32_t fOpen);
-
-
 /** @} */
 
 RT_C_DECLS_END
 
-#endif /* ___iprt_tar_h */
+#endif
 
diff --git a/include/iprt/tcp.h b/include/iprt/tcp.h
index 987b1ff..c960ae9 100644
--- a/include/iprt/tcp.h
+++ b/include/iprt/tcp.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/include/iprt/test.h b/include/iprt/test.h
index 1788531..b84d1b6 100644
--- a/include/iprt/test.h
+++ b/include/iprt/test.h
@@ -1125,7 +1125,7 @@ RTR3DECL(int) RTTestIFailureDetails(const char *pszFormat, ...);
     if (!(expr)) { \
         RTTestIFailed("line %u: %s", __LINE__, #expr); \
         break; \
-    } do {} while (0)
+    } else do {} while (0)
 
 
 /** @def RTTESTI_CHECK_MSG
@@ -1144,6 +1144,23 @@ RTR3DECL(int) RTTestIFailureDetails(const char *pszFormat, ...);
             RTTestIFailureDetails DetailsArgs; \
          } \
     } while (0)
+/** @def RTTESTI_CHECK_MSG_BREAK
+ * Check whether a boolean expression holds true, returns on false.
+ *
+ * If the expression is false, call RTTestIFailed giving the line number and
+ * expression.
+ *
+ * @param   expr            The expression to evaluate.
+ * @param   DetailsArgs     Argument list for RTTestIFailureDetails, including
+ *                          parenthesis.
+ * @param   rcRet           What to return on failure.
+ */
+#define RTTESTI_CHECK_MSG_BREAK(expr, DetailsArgs) \
+    if (!(expr)) { \
+        RTTestIFailed("line %u: %s", __LINE__, #expr); \
+        RTTestIFailureDetails DetailsArgs; \
+        break; \
+    } else do {} while (0)
 /** @def RTTESTI_CHECK_MSG_RET
  * Check whether a boolean expression holds true, returns on false.
  *
@@ -1180,7 +1197,6 @@ RTR3DECL(int) RTTestIFailureDetails(const char *pszFormat, ...);
          } \
     } while (0)
 
-
 /** @def RTTESTI_CHECK_RC
  * Check whether an expression returns a specific IPRT style status code.
  *
@@ -1255,8 +1271,6 @@ RTR3DECL(int) RTTestIFailureDetails(const char *pszFormat, ...);
             break; \
         } \
     } else do {} while (0)
-
-
 /** @def RTTESTI_CHECK_RC_OK
  * Check whether a IPRT style status code indicates success.
  *
@@ -1272,6 +1286,22 @@ RTR3DECL(int) RTTestIFailureDetails(const char *pszFormat, ...);
             RTTestIFailed("line %u: %s: %Rrc", __LINE__, #rcExpr, rcCheck); \
         } \
     } while (0)
+/** @def RTTESTI_CHECK_RC_OK_BREAK
+ * Check whether a IPRT style status code indicates success.
+ *
+ * If a different status code is return, call RTTestIFailed giving the line
+ * number, expression, actual and expected status codes, then break.
+ *
+ * @param   rcExpr          The expression resulting in an IPRT status code.
+ */
+#define RTTESTI_CHECK_RC_OK_BREAK(rcExpr) \
+    do { \
+        int rcCheck = (rcExpr); \
+        if (RT_FAILURE(rcCheck)) { \
+            RTTestIFailed("line %u: %s: %Rrc", __LINE__, #rcExpr, rcCheck); \
+            break; \
+        } \
+    } while (0)
 /** @def RTTESTI_CHECK_RC_OK_RET
  * Check whether a IPRT style status code indicates success.
  *
diff --git a/include/iprt/thread.h b/include/iprt/thread.h
index 17a80d0..fac023c 100644
--- a/include/iprt/thread.h
+++ b/include/iprt/thread.h
@@ -141,7 +141,7 @@ typedef enum RTTHREADTYPE
     /** Message pump thread.
      * Thread pumping messages from one thread/process to another
      * thread/process. The workload is very small, most of the time
-     * it's blocked waiting for messages to be procduced or processed.
+     * it's blocked waiting for messages to be produced or processed.
      * This type of thread will be favored after I/O threads.
      */
     RTTHREADTYPE_MSG_PUMP,
@@ -587,106 +587,104 @@ RTDECL(bool) RTThreadIsInInterrupt(RTTHREAD hThread);
 
 
 /**
- * Thread-context events.
+ * Thread context swithcing events.
  */
 typedef enum RTTHREADCTXEVENT
 {
-    /** This thread is about to be preempted. */
-    RTTHREADCTXEVENT_PREEMPTING = 0,
-    /** This thread has just been resumed. */
-    RTTHREADCTXEVENT_RESUMED,
+    /** This thread is being scheduled out on the current CPU (includes preemption,
+     * waiting, sleep and whatever else may trigger scheduling). */
+    RTTHREADCTXEVENT_OUT = 0,
+    /** This thread is being scheduled in on the current CPU and will resume
+     * execution. */
+    RTTHREADCTXEVENT_IN,
     /** The usual 32-bit size hack. */
     RTTHREADCTXEVENT_32BIT_HACK = 0x7fffffff
 } RTTHREADCTXEVENT;
 
 /**
- * Thread-context hook.
+ * Thread context switching hook callback.
+ *
+ * This hook function is called when a thread is scheduled and preempted.  Check
+ * @a enmEvent to see which it is.  Since the function is being called from
+ * hooks inside the scheduler, it is limited what you can do from this function.
+ * Do NOT acquire locks, sleep or yield the thread for instance.  IRQ safe
+ * spinlocks are fine though.
  *
  * @returns IPRT status code.
- * @param   enmEvent    The thread-context event.
+ * @param   enmEvent    The thread-context event.  Please quitely ignore unknown
+ *                      events, we may add more (thread exit, ++) later.
  * @param   pvUser      User argument.
- *
- * @remarks This function may be called under different contexts, i.e. with
- *          different locks held, with/without preemption disabled depending on
- *          the event in @a enmEvent.
  */
 typedef DECLCALLBACK(void) FNRTTHREADCTXHOOK(RTTHREADCTXEVENT enmEvent, void *pvUser);
-/** Pointer to a thread-context hook. */
+/** Pointer to a context switching hook. */
 typedef FNRTTHREADCTXHOOK *PFNRTTHREADCTXHOOK;
 
 /**
- * Initializes a thread-context hook for the current thread.
+ * Initializes a thread context switching hook for the current thread.
  *
- * This must be called once per-thread before using RTThreadCtxHooksRegister().
+ * The hook is created as disabled, use RTThreadCtxHookEnable to enable it.
  *
  * @returns IPRT status code.
- * @param   phThreadCtx         Where to store the thread-context handle.
- *
- * @remarks This must be called with preemption enabled!
- */
-RTDECL(int) RTThreadCtxHooksCreate(PRTTHREADCTX phThreadCtx);
-
-/**
- * Retains a new reference to a thread-context hook.
- *
- * @returns New reference count.
- *          UINT32_MAX is returned if the handle is invalid (asserted).
- * @param   phThreadCtx         Pointer to the thread-context handle.
- *
- * @remarks This can be called from any thread. Can be called with preemption
- *          disabled.
+ * @param   phCtxHook       Where to store the hook handle.
+ * @param   fFlags          Reserved for future extensions, must be zero.
+ * @param   pfnCallback     Pointer to a the hook function (callback) that
+ *                          should be called for all context switching events
+ *                          involving the current thread.
+ * @param   pvUser          User argument that will be passed to @a pfnCallback.
+ * @remarks Preemption must be enabled.
  */
-RTDECL(uint32_t) RTThreadCtxHooksRetain(RTTHREADCTX hThreadCtx);
+RTDECL(int) RTThreadCtxHookCreate(PRTTHREADCTXHOOK phCtxHook, uint32_t fFlags, PFNRTTHREADCTXHOOK pfnCallback, void *pvUser);
 
 /**
- * Releases a reference to a thread-context hook.
+ * Destroys a thread context switching hook.
  *
- * @returns New reference count.
- * @retval  0 if the thread-context hook was freed or @a hThreadCtx is
- *          NIL_RTTHREADCTX.
- * @retval  UINT32_MAX is returned if the handle is invalid (asserted).
+ * Caller must make sure the hook is disabled before the final reference is
+ * released.  Recommended to call this on the owning thread, otherwise the
+ * memory backing it may on some systems only be released when the thread
+ * terminates.
  *
- * @param   hThreadCtx          The thread-context handle.
+ * @returns IPRT status code.
  *
- * @remarks This can be called from any thread but must be called with
- *          preemption enabled!
+ * @param   hCtxHook        The context hook handle.  NIL_RTTHREADCTXHOOK is
+ *                          ignored and the function will return VINF_SUCCESS.
+ * @remarks Preemption must be enabled.
+ * @remarks Do not call from FNRTTHREADCTXHOOK.
  */
-RTDECL(uint32_t) RTThreadCtxHooksRelease(RTTHREADCTX hThreadCtx);
+RTDECL(int) RTThreadCtxHookDestroy(RTTHREADCTXHOOK hCtxHook);
 
 /**
- * Registers a thread-context hook for the current thread to receive
- * notifications for all supported thread-context events.
+ * Enables the context switching hooks for the current thread.
  *
  * @returns IPRT status code.
- * @param   hThreadCtx          The thread-context handle.
- * @param   pfnThreadHook       Pointer to a thread-context hook (a callback)
- *                              for all thread-context events.
- * @param   pvUser              User argument (optional, can be NULL).
- *
- * @remarks Can be called with preemption disabled.
+ * @param   hCtxHook        The context hook handle.
+ * @remarks Should be called with preemption disabled.
  */
-RTDECL(int) RTThreadCtxHooksRegister(RTTHREADCTX hThreadCtx, PFNRTTHREADCTXHOOK pfnThreadHook, void *pvUser);
+RTDECL(int) RTThreadCtxHookEnable(RTTHREADCTXHOOK hCtxHook);
 
 /**
- * Deregisters the thread-context hook for the current thread.
+ * Disables the thread context switching hook for the current thread.
  *
- * @returns IPRT status code.
- * @param   hThreadCtx          The thread-context handle.
+ * Will not assert or fail if called twice or with a NIL handle.
  *
- * @remarks Can be called with preemption disabled.
+ * @returns IPRT status code.
+ * @param   hCtxHook        The context hook handle. NIL_RTTHREADCTXHOOK is
+ *                          ignored and the function wil return VINF_SUCCESS.
+ * @remarks Should be called with preemption disabled.
+ * @remarks Do not call from FNRTTHREADCTXHOOK.
  */
-RTDECL(int) RTThreadCtxHooksDeregister(RTTHREADCTX hThreadCtx);
+RTDECL(int) RTThreadCtxHookDisable(RTTHREADCTXHOOK hCtxHook);
 
 /**
- * Are thread-context hooks registered for the thread?
+ * Is the thread context switching hook enabled?
  *
  * @returns true if registered, false if not supported or not registered.
- * @param   hThreadCtx          The thread-context handle.
+ * @param   hCtxHook        The context hook handle.   NIL_RTTHREADCTXHOOK is
+ *                          ignored and the function will return false.
  *
- * @remarks Can be called from any thread (but possibility of races when
- *          it's not the current thread!)
+ * @remarks Can be called from any thread, though is naturally subject to races
+ *          when not called from the thread associated with the hook.
  */
-RTDECL(bool) RTThreadCtxHooksAreRegistered(RTTHREADCTX hThreadCtx);
+RTDECL(bool) RTThreadCtxHookIsEnabled(RTTHREADCTXHOOK hCtxHook);
 
 # endif /* IN_RING0 */
 
diff --git a/include/iprt/time.h b/include/iprt/time.h
index a0021ba..a582564 100644
--- a/include/iprt/time.h
+++ b/include/iprt/time.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -92,7 +92,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSetNano(PRTTIMESPEC pTime, int64_t i64Nano)
  */
 DECLINLINE(int64_t) RTTimeSpecGetMicro(PCRTTIMESPEC pTime)
 {
-    return pTime->i64NanosecondsRelativeToUnixEpoch / 1000;
+    return pTime->i64NanosecondsRelativeToUnixEpoch / RT_NS_1US;
 }
 
 
@@ -105,7 +105,7 @@ DECLINLINE(int64_t) RTTimeSpecGetMicro(PCRTTIMESPEC pTime)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecSetMicro(PRTTIMESPEC pTime, int64_t i64Micro)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch = i64Micro * 1000;
+    pTime->i64NanosecondsRelativeToUnixEpoch = i64Micro * RT_NS_1US;
     return pTime;
 }
 
@@ -118,7 +118,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSetMicro(PRTTIMESPEC pTime, int64_t i64Micro)
  */
 DECLINLINE(int64_t) RTTimeSpecGetMilli(PCRTTIMESPEC pTime)
 {
-    return pTime->i64NanosecondsRelativeToUnixEpoch / 1000000;
+    return pTime->i64NanosecondsRelativeToUnixEpoch / RT_NS_1MS;
 }
 
 
@@ -131,7 +131,7 @@ DECLINLINE(int64_t) RTTimeSpecGetMilli(PCRTTIMESPEC pTime)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecSetMilli(PRTTIMESPEC pTime, int64_t i64Milli)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch = i64Milli * 1000000;
+    pTime->i64NanosecondsRelativeToUnixEpoch = i64Milli * RT_NS_1MS;
     return pTime;
 }
 
@@ -144,7 +144,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSetMilli(PRTTIMESPEC pTime, int64_t i64Milli)
  */
 DECLINLINE(int64_t) RTTimeSpecGetSeconds(PCRTTIMESPEC pTime)
 {
-    return pTime->i64NanosecondsRelativeToUnixEpoch / 1000000000;
+    return pTime->i64NanosecondsRelativeToUnixEpoch / RT_NS_1SEC;
 }
 
 
@@ -157,7 +157,7 @@ DECLINLINE(int64_t) RTTimeSpecGetSeconds(PCRTTIMESPEC pTime)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecSetSeconds(PRTTIMESPEC pTime, int64_t i64Seconds)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch = i64Seconds * 1000000000;
+    pTime->i64NanosecondsRelativeToUnixEpoch = i64Seconds * RT_NS_1SEC;
     return pTime;
 }
 
@@ -226,7 +226,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecAddNano(PRTTIMESPEC pTime, int64_t i64Nano)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecAddMicro(PRTTIMESPEC pTime, int64_t i64Micro)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch += i64Micro * 1000;
+    pTime->i64NanosecondsRelativeToUnixEpoch += i64Micro * RT_NS_1US;
     return pTime;
 }
 
@@ -240,7 +240,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecAddMicro(PRTTIMESPEC pTime, int64_t i64Micro)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecAddMilli(PRTTIMESPEC pTime, int64_t i64Milli)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch += i64Milli * 1000000;
+    pTime->i64NanosecondsRelativeToUnixEpoch += i64Milli * RT_NS_1MS;
     return pTime;
 }
 
@@ -254,7 +254,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecAddMilli(PRTTIMESPEC pTime, int64_t i64Milli)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecAddSeconds(PRTTIMESPEC pTime, int64_t i64Seconds)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch += i64Seconds * 1000000000;
+    pTime->i64NanosecondsRelativeToUnixEpoch += i64Seconds * RT_NS_1SEC;
     return pTime;
 }
 
@@ -296,7 +296,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSubNano(PRTTIMESPEC pTime, int64_t i64Nano)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecSubMicro(PRTTIMESPEC pTime, int64_t i64Micro)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch -= i64Micro * 1000;
+    pTime->i64NanosecondsRelativeToUnixEpoch -= i64Micro * RT_NS_1US;
     return pTime;
 }
 
@@ -310,7 +310,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSubMicro(PRTTIMESPEC pTime, int64_t i64Micro)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecSubMilli(PRTTIMESPEC pTime, int64_t i64Milli)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch -= i64Milli * 1000000;
+    pTime->i64NanosecondsRelativeToUnixEpoch -= i64Milli * RT_NS_1MS;
     return pTime;
 }
 
@@ -324,11 +324,34 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSubMilli(PRTTIMESPEC pTime, int64_t i64Milli)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecSubSeconds(PRTTIMESPEC pTime, int64_t i64Seconds)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch -= i64Seconds * 100000000;
+    pTime->i64NanosecondsRelativeToUnixEpoch -= i64Seconds * RT_NS_1SEC;
     return pTime;
 }
 
 
+/**
+ * Gives the time in seconds and nanoseconds.
+ *
+ * @returns pTime.
+ * @param   pTime           The time spec to interpret.
+ * @param   *pi32Seconds    Where to store the time period in seconds.
+ * @param   *pi32Nano       Where to store the time period in nanoseconds.
+ */
+DECLINLINE(void) RTTimeSpecGetSecondsAndNano(PRTTIMESPEC pTime, int32_t *pi32Seconds, int32_t *pi32Nano)
+{
+    int64_t i64 = RTTimeSpecGetNano(pTime);
+    int32_t i32Nano = (int32_t)(i64 % RT_NS_1SEC);
+    i64 /= RT_NS_1SEC;
+    if (i32Nano < 0)
+    {
+        i32Nano += RT_NS_1SEC;
+        i64--;
+    }
+    *pi32Seconds = (int32_t)i64;
+    *pi32Nano    = i32Nano;
+}
+
+
 /* PORTME: Add struct timeval guard macro here. */
 #if defined(RTTIME_INCL_TIMEVAL) || defined(_STRUCT_TIMEVAL) || defined(_SYS__TIMEVAL_H_) || defined(_SYS_TIME_H) || defined(_TIMEVAL) || defined(_LINUX_TIME_H)
 /**
@@ -341,11 +364,11 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSubSeconds(PRTTIMESPEC pTime, int64_t i64Secon
 DECLINLINE(struct timeval *) RTTimeSpecGetTimeval(PCRTTIMESPEC pTime, struct timeval *pTimeval)
 {
     int64_t i64 = RTTimeSpecGetMicro(pTime);
-    int32_t i32Micro = (int32_t)(i64 % 1000000);
-    i64 /= 1000000;
+    int32_t i32Micro = (int32_t)(i64 % RT_US_1SEC);
+    i64 /= RT_US_1SEC;
     if (i32Micro < 0)
     {
-        i32Micro += 1000000;
+        i32Micro += RT_US_1SEC;
         i64--;
     }
     pTimeval->tv_sec = (time_t)i64;
@@ -379,11 +402,11 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSetTimeval(PRTTIMESPEC pTime, const struct tim
 DECLINLINE(struct timespec *) RTTimeSpecGetTimespec(PCRTTIMESPEC pTime, struct timespec *pTimespec)
 {
     int64_t i64 = RTTimeSpecGetNano(pTime);
-    int32_t i32Nano = (int32_t)(i64 % 1000000000);
-    i64 /= 1000000000;
+    int32_t i32Nano = (int32_t)(i64 % RT_NS_1SEC);
+    i64 /= RT_NS_1SEC;
     if (i32Nano < 0)
     {
-        i32Nano += 1000000000;
+        i32Nano += RT_NS_1SEC;
         i64--;
     }
     pTimespec->tv_sec = (time_t)i64;
@@ -481,7 +504,7 @@ DECLINLINE(PRTTIMESPEC) RTTimeSpecSetNtFileTime(PRTTIMESPEC pTime, const FILETIM
 DECLINLINE(int64_t) RTTimeSpecGetDosSeconds(PCRTTIMESPEC pTime)
 {
     return (pTime->i64NanosecondsRelativeToUnixEpoch - RTTIME_OFFSET_DOS_TIME)
-        / 1000000000;
+        / RT_NS_1SEC;
 }
 
 
@@ -494,7 +517,7 @@ DECLINLINE(int64_t) RTTimeSpecGetDosSeconds(PCRTTIMESPEC pTime)
  */
 DECLINLINE(PRTTIMESPEC) RTTimeSpecSetDosSeconds(PRTTIMESPEC pTime, int64_t i64Seconds)
 {
-    pTime->i64NanosecondsRelativeToUnixEpoch = i64Seconds * 1000000000
+    pTime->i64NanosecondsRelativeToUnixEpoch = i64Seconds * RT_NS_1SEC
         + RTTIME_OFFSET_DOS_TIME;
     return pTime;
 }
@@ -839,8 +862,18 @@ typedef struct RTTIMENANOTSDATA
      */
     DECLCALLBACKMEMBER(uint64_t, pfnRediscover)(PRTTIMENANOTSDATA pData);
 
-    /** Just a dummy alignment member. */
-    void               *pvDummy;
+    /**
+     * Callback for when some CPU index related stuff goes wrong.
+     *
+     * @returns Nanosecond timestamp.
+     * @param   pData           Pointer to this structure.
+     * @param   idApic          The APIC ID if available, otherwise (UINT16_MAX-1).
+     * @param   iCpuSet         The CPU set index if available, otherwise
+     *                          (UINT16_MAX-1).
+     * @param   iGipCpu         The GIP CPU array index if available, otherwise
+     *                          (UINT16_MAX-1).
+     */
+    DECLCALLBACKMEMBER(uint64_t, pfnBadCpuIndex)(PRTTIMENANOTSDATA pData, uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu);
 
     /** Number of 1ns steps because of overshooting the period. */
     uint32_t            c1nsSteps;
@@ -861,7 +894,7 @@ typedef struct RTTIMENANOTSDATAR3
     R3PTRTYPE(uint64_t volatile  *) pu64Prev;
     DECLR3CALLBACKMEMBER(void, pfnBad,(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS));
     DECLR3CALLBACKMEMBER(uint64_t, pfnRediscover,(PRTTIMENANOTSDATA pData));
-    RTR3PTR             pvDummy;
+    DECLR3CALLBACKMEMBER(uint64_t, pfnBadCpuIndex,(PRTTIMENANOTSDATA pData, uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu));
     uint32_t            c1nsSteps;
     uint32_t            cExpired;
     uint32_t            cBadPrev;
@@ -880,7 +913,7 @@ typedef struct RTTIMENANOTSDATAR0
     R0PTRTYPE(uint64_t volatile  *) pu64Prev;
     DECLR0CALLBACKMEMBER(void, pfnBad,(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS));
     DECLR0CALLBACKMEMBER(uint64_t, pfnRediscover,(PRTTIMENANOTSDATA pData));
-    RTR0PTR             pvDummy;
+    DECLR0CALLBACKMEMBER(uint64_t, pfnBadCpuIndex,(PRTTIMENANOTSDATA pData, uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu));
     uint32_t            c1nsSteps;
     uint32_t            cExpired;
     uint32_t            cBadPrev;
@@ -899,7 +932,7 @@ typedef struct RTTIMENANOTSDATARC
     RCPTRTYPE(uint64_t volatile  *) pu64Prev;
     DECLRCCALLBACKMEMBER(void, pfnBad,(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS));
     DECLRCCALLBACKMEMBER(uint64_t, pfnRediscover,(PRTTIMENANOTSDATA pData));
-    RCPTRTYPE(void *)   pvDummy;
+    DECLRCCALLBACKMEMBER(uint64_t, pfnBadCpuIndex,(PRTTIMENANOTSDATA pData, uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu));
     uint32_t            c1nsSteps;
     uint32_t            cExpired;
     uint32_t            cBadPrev;
@@ -913,11 +946,28 @@ typedef RTTIMENANOTSDATA RTTIMENANOTSDATARC;
 typedef DECLCALLBACK(uint64_t) FNTIMENANOTSINTERNAL(PRTTIMENANOTSDATA pData);
 /** Pointer to an internal RTTimeNanoTS worker (assembly). */
 typedef FNTIMENANOTSINTERNAL *PFNTIMENANOTSINTERNAL;
-
-RTDECL(uint64_t) RTTimeNanoTSLegacySync(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLegacySyncInvarNoDelta(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLFenceSyncInvarNoDelta(PRTTIMENANOTSDATA pData);
+#ifdef IN_RING3
+RTDECL(uint64_t) RTTimeNanoTSLegacyAsyncUseApicId(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLegacyAsyncUseRdtscp(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLegacyAsyncUseIdtrLim(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLFenceAsyncUseApicId(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLFenceAsyncUseRdtscp(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLFenceAsyncUseIdtrLim(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim(PRTTIMENANOTSDATA pData);
+#else
 RTDECL(uint64_t) RTTimeNanoTSLegacyAsync(PRTTIMENANOTSDATA pData);
-RTDECL(uint64_t) RTTimeNanoTSLFenceSync(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLegacySyncInvarWithDelta(PRTTIMENANOTSDATA pData);
 RTDECL(uint64_t) RTTimeNanoTSLFenceAsync(PRTTIMENANOTSDATA pData);
+RTDECL(uint64_t) RTTimeNanoTSLFenceSyncInvarWithDelta(PRTTIMENANOTSDATA pData);
+#endif
+
 /** @} */
 
 
diff --git a/include/iprt/timer.h b/include/iprt/timer.h
index 54e63a7..01126dc 100644
--- a/include/iprt/timer.h
+++ b/include/iprt/timer.h
@@ -122,28 +122,31 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
 /** Any CPU is fine. (Must be 0.) */
 #define RTTIMER_FLAGS_CPU_ANY       UINT32_C(0)
 /** One specific CPU */
-#define RTTIMER_FLAGS_CPU_SPECIFIC  RT_BIT(8)
+#define RTTIMER_FLAGS_CPU_SPECIFIC  RT_BIT(16)
 /** Omni timer, run on all online CPUs.
  * @remarks The timer callback isn't necessarily running at the time same time on each CPU. */
 #define RTTIMER_FLAGS_CPU_ALL       ( RTTIMER_FLAGS_CPU_MASK | RTTIMER_FLAGS_CPU_SPECIFIC )
 /** CPU mask. */
-#define RTTIMER_FLAGS_CPU_MASK      UINT32_C(0xff)
+#define RTTIMER_FLAGS_CPU_MASK      UINT32_C(0xffff)
 /** Desire a high resolution timer that works with RTTimerChangeInterval and
  * isn't subject to RTTimerGetSystemGranularity rounding.
  * @remarks This is quietly ignored if the feature isn't supported. */
-#define RTTIMER_FLAGS_HIGH_RES      RT_BIT(9)
+#define RTTIMER_FLAGS_HIGH_RES      RT_BIT(17)
 /** Convert a CPU set index (0-based) to RTTimerCreateEx flags.
  * This will automatically OR in the RTTIMER_FLAGS_CPU_SPECIFIC flag. */
 #define RTTIMER_FLAGS_CPU(iCpu)     ( (iCpu) | RTTIMER_FLAGS_CPU_SPECIFIC )
 /** Macro that validates the flags. */
 #define RTTIMER_FLAGS_ARE_VALID(fFlags) \
-    ( !((fFlags) & ~((fFlags) & RTTIMER_FLAGS_CPU_SPECIFIC ? UINT32_C(0x3ff) : UINT32_C(0x300))) )
+    ( !((fFlags) & ~((fFlags) & RTTIMER_FLAGS_CPU_SPECIFIC ? UINT32_C(0x3ffff) : UINT32_C(0x30000))) )
 /** @} */
 
 /**
  * Stops and destroys a running timer.
  *
  * @returns iprt status code.
+ * @retval  VERR_INVALID_CONTEXT if executing at the wrong IRQL (windows), PIL
+ *          (solaris), or similar.  Portable code does not destroy timers with
+ *          preemption (or interrupts) disabled.
  * @param   pTimer      Timer to stop and destroy. NULL is ok.
  */
 RTDECL(int) RTTimerDestroy(PRTTIMER pTimer);
@@ -193,6 +196,7 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer);
  * @returns IPRT status code.
  * @retval  VERR_INVALID_HANDLE if pTimer isn't valid.
  * @retval  VERR_NOT_SUPPORTED if not supported.
+ * @retval  VERR_INVALID_STATE if not a periodic timer.
  *
  * @param   pTimer              The timer to activate.
  * @param   u64NanoInterval     The interval between timer ticks specified in
diff --git a/include/iprt/types.h b/include/iprt/types.h
index cac8de9..125f824 100644
--- a/include/iprt/types.h
+++ b/include/iprt/types.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -78,7 +78,7 @@ RT_C_DECLS_END
      * Kludge for compiling 32-bit code on a 64-bit FreeBSD:
      *  FreeBSD declares uint64_t and int64_t wrong (long unsigned and long int
      *  though they need to be long long unsigned and long long int). These
-     *  defines conflict with our decleration in stdint.h. Adding the defines
+     *  defines conflict with our declaration in stdint.h. Adding the defines
      *  below omits the definitions in the system header.
      */
 #  include <stddef.h>
@@ -759,7 +759,6 @@ typedef const struct RTTIMESPEC *PCRTTIMESPEC;
 
 
 /** @defgroup grp_rt_types_both  Common Guest and Host Context Basic Types
- * @ingroup grp_rt_types
  * @{
  */
 
@@ -949,7 +948,6 @@ typedef const RTFAR64 *PCRTFAR64;
 
 
 /** @defgroup grp_rt_types_hc  Host Context Basic Types
- * @ingroup grp_rt_types
  * @{
  */
 
@@ -1228,7 +1226,6 @@ typedef const RTR0UINTREG  *PCRTR0UINTREG;
 
 
 /** @defgroup grp_rt_types_gc  Guest Context Basic Types
- * @ingroup grp_rt_types
  * @{
  */
 
@@ -1430,7 +1427,6 @@ typedef const RTGCUINTREG      *PCRTGCUINTREG;
 /** @} */
 
 /** @defgroup grp_rt_types_rc  Raw mode Context Basic Types
- * @ingroup grp_rt_types
  * @{
  */
 
@@ -1482,7 +1478,6 @@ typedef uint32_t        RTRCUINTPTR;
 
 
 /** @defgroup grp_rt_types_cc  Current Context Basic Types
- * @ingroup grp_rt_types
  * @{
  */
 
@@ -1580,14 +1575,14 @@ typedef RTCRDIGEST                                 *PRTCRDIGEST;
 typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT *) RTCRPKIXENCRYPTION;
 /** Pointer to a public key encryption schema handle. */
 typedef RTCRPKIXENCRYPTION                         *PRTCRPKIXENCRYPTION;
-/** NIL publick key encryption schema handle */
+/** NIL public key encryption schema handle */
 #define NIL_RTCRPKIXENCRYPTION                      (0)
 
 /** Public key signature schema handle. */
 typedef R3R0PTRTYPE(struct RTCRPKIXSIGNATUREINT *)  RTCRPKIXSIGNATURE;
 /** Pointer to a public key signature schema handle. */
 typedef RTCRPKIXSIGNATURE                          *PRTCRPKIXSIGNATURE;
-/** NIL publick key signature schema handle */
+/** NIL public key signature schema handle */
 #define NIL_RTCRPKIXSIGNATURE                       (0)
 
 /** X.509 certificate paths builder & validator handle. */
@@ -1767,12 +1762,12 @@ typedef RTTHREAD                                   *PRTTHREAD;
 /** Nil thread handle. */
 #define NIL_RTTHREAD                                0
 
-/** Thread-context handle.*/
-typedef R0PTRTYPE(struct RTTHREADCTXINT *)          RTTHREADCTX;
-/** Pointer to thread handle. */
-typedef RTTHREADCTX                                *PRTTHREADCTX;
-/** Nil thread-context handle. */
-#define NIL_RTTHREADCTX                             0
+/** Thread context switching hook handle.   */
+typedef R0PTRTYPE(struct RTTHREADCTXHOOKINT *)      RTTHREADCTXHOOK;
+/** Pointer to Thread context switching hook handle. */
+typedef RTTHREADCTXHOOK                            *PRTTHREADCTXHOOK;
+/** Nil Thread context switching hook handle. */
+#define NIL_RTTHREADCTXHOOK                         ((RTTHREADCTXHOOK)0)
 
 /** A TLS index. */
 typedef RTHCINTPTR                                  RTTLS;
@@ -1787,7 +1782,7 @@ typedef RTTLS const                                *PCRTTLS;
  * @remarks This is not a R3/R0 type like most other handles!
  */
 typedef struct RTTRACEBUFINT                        *RTTRACEBUF;
-/** Poiner to a trace buffer handle. */
+/** Pointer to a trace buffer handle. */
 typedef RTTRACEBUF                                  *PRTTRACEBUF;
 /** Nil trace buffer handle. */
 #define NIL_RTTRACEBUF                              ((RTTRACEBUF)0)
@@ -1840,7 +1835,7 @@ typedef RTCPUID const                              *PCRTCPUID;
 #endif
 /** A CPU set.
  * @note    Treat this as an opaque type and always use RTCpuSet* for
- *          manupulating it. */
+ *          manipulating it. */
 typedef struct RTCPUSET
 {
     /** The bitmap.  */
@@ -1871,7 +1866,7 @@ typedef RTTIMERLR                                  *PRTTIMERLR;
 typedef R3R0PTRTYPE(struct RTRANDINT *)             RTRAND;
 /** Pointer to a random number generator handle. */
 typedef RTRAND                                     *PRTRAND;
-/** NIL random number genrator handle value. */
+/** NIL random number generator handle value. */
 #define NIL_RTRAND                                  ((RTRAND)0)
 
 /** Debug address space handle. */
@@ -2314,10 +2309,10 @@ typedef struct RTLOCKVALRECEXCL        *PRTLOCKVALRECEXCL;
 /** Pointer to a record of one ownership share.
  * The structure definition is found in iprt/lockvalidator.h.  */
 typedef struct RTLOCKVALRECSHRD        *PRTLOCKVALRECSHRD;
-/** Pointer to a lock validator source poisition.
+/** Pointer to a lock validator source position.
  * The structure definition is found in iprt/lockvalidator.h.  */
 typedef struct RTLOCKVALSRCPOS         *PRTLOCKVALSRCPOS;
-/** Pointer to a const lock validator source poisition.
+/** Pointer to a const lock validator source position.
  * The structure definition is found in iprt/lockvalidator.h.  */
 typedef struct RTLOCKVALSRCPOS const   *PCRTLOCKVALSRCPOS;
 
diff --git a/include/iprt/uint128.h b/include/iprt/uint128.h
index 9a321b9..540cfdb 100644
--- a/include/iprt/uint128.h
+++ b/include/iprt/uint128.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2011 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -36,7 +36,7 @@
 
 RT_C_DECLS_BEGIN
 
-/** @defgroup grp_rt_once       RTUInt128 - 128-bit Unsigned Integer Methods
+/** @defgroup grp_rt_uint128 RTUInt128 - 128-bit Unsigned Integer Methods
  * @ingroup grp_rt
  * @{
  */
diff --git a/include/iprt/uri.h b/include/iprt/uri.h
index 5696e5a..8c70b54 100644
--- a/include/iprt/uri.h
+++ b/include/iprt/uri.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2011 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -44,7 +44,8 @@ RT_C_DECLS_BEGIN
  */
 
 /**
- * Creates a generic URI.
+ * Creates a generic URI. The returned pointer must be freed
+ * using RTStrFree().
  *
  * @returns the new URI on success, NULL otherwise.
  * @param   pszScheme           The URI scheme.
@@ -107,7 +108,6 @@ RTR3DECL(char *) RTUriFragment(const char *pszUri);
 /** @defgroup grp_rt_uri_file   RTUriFile - Uri file parsing and creation
  * Adds file: scheme support to the generic RTUri interface. This is partly
  * documented in http://datatracker.ietf.org/doc/rfc1738/.
- * @ingroup grp_rt_uri
  * @{
  */
 
@@ -119,7 +119,8 @@ RTR3DECL(char *) RTUriFragment(const char *pszUri);
 #define URI_FILE_FORMAT_WIN   UINT32_C(2)
 
 /**
- * Creates a file URI.
+ * Creates a file URI. The returned pointer must be freed
+ * using RTStrFree().
  *
  * @see RTUriCreate
  *
diff --git a/include/iprt/vfs.h b/include/iprt/vfs.h
index 787c1b3..b58c67c 100644
--- a/include/iprt/vfs.h
+++ b/include/iprt/vfs.h
@@ -129,7 +129,7 @@ RTDECL(int)         RTVfsGetAttachment(RTVFS hVfs, uint32_t iOrdinal, PRTVFS *ph
 RTDECL(int)         RTVfsIsRangeInUse(RTVFS hVfs, uint64_t off, size_t cb,
                                       bool *pfUsed);
 
-/** @defgroup grp_vfs_dir           VFS Base Object API
+/** @defgroup grp_vfs_obj           VFS Base Object API
  * @{
  */
 
diff --git a/include/iprt/vfslowlevel.h b/include/iprt/vfslowlevel.h
index c077016..8a13945 100644
--- a/include/iprt/vfslowlevel.h
+++ b/include/iprt/vfslowlevel.h
@@ -1152,7 +1152,7 @@ RTDECL(int)             RTVfsChainSpecParse(const char *pszSpec, uint32_t fFlags
 #define RTVFSCHAIN_PF_TRAILING_ACTION_OPTIONAL  RT_BIT_32(2)
 /** Mask of valid flags. */
 #define RTVFSCHAIN_PF_VALID_MASK                UINT32_C(0x00000007)
-/** @}*/
+/** @} */
 
 /**
  * Frees a parsed chain specification.
diff --git a/include/iprt/x509-branch-collision.h b/include/iprt/x509-branch-collision.h
new file mode 100644
index 0000000..7651529
--- /dev/null
+++ b/include/iprt/x509-branch-collision.h
@@ -0,0 +1,81 @@
+/** @file
+ * IPRT - X509 functions
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifndef ___iprt_x509_h
+#define ___iprt_x509_h
+
+#include <iprt/types.h>
+#include <iprt/manifest.h>
+#include <openssl/x509v3.h>
+
+RT_C_DECLS_BEGIN
+
+/** @defgroup grp_rt_x509   RTX509 - X509 Functions
+ * @ingroup grp_rt
+ * @{
+ */
+
+/**
+ * Preparation before start to work with openssl
+ *
+ * @todo This should return a status and check that X509 code seems sane.  This
+ *       would allow dynamic linking if necessary at some point.
+ */
+RTDECL(int) RTX509PrepareOpenSSL(void);
+
+/**
+ * Verify RSA signature for the given memory buffer.
+ *
+ * @returns iprt status code.
+ *
+ * @param   pvBuf                 Memory buffer containing a RSA
+ *                                signature
+ * @param   cbSize                The amount of data (in bytes)
+ * @param   pManifestDigestIn     string contains manifest
+ *                                digest
+ * @param   digestType            Type of digest
+ */
+RTDECL(int) RTRSAVerify(void *pvBuf, unsigned int cbSize,  const char* pManifestDigestIn, RTDIGESTTYPE digestType);
+
+/**
+ * Verify X509 certificate for the given memory buffer.
+ *
+ * @returns iprt status code.
+ *
+ * @param   pvBuf                 Memory buffer containing X509
+ *                                certificate
+ * @param   cbSize                The amount of data (in bytes)
+ */
+RTDECL(int) RTX509CertificateVerify(void *pvBuf, unsigned int cbSize);
+
+/** @todo document me. */
+RTDECL(unsigned long) RTX509GetErrorDescription(char** pErrorDesc);
+
+/** @} */
+
+RT_C_DECLS_END
+
+#endif /* ___iprt_x509_h */
+
diff --git a/include/iprt/x86.h b/include/iprt/x86.h
index b451c77..ac67262 100644
--- a/include/iprt/x86.h
+++ b/include/iprt/x86.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -76,7 +76,7 @@ typedef struct X86EFLAGSBITS
     unsigned    u1DF : 1;
     /** Bit 11 - OF - Overflow flag - Status flag. */
     unsigned    u1OF : 1;
-    /** Bit 12-13 - IOPL - I/O prvilege level flag - System flag. */
+    /** Bit 12-13 - IOPL - I/O privilege level flag - System flag. */
     unsigned    u2IOPL : 2;
     /** Bit 14 - NT - Nested task flag - System flag. */
     unsigned    u1NT : 1;
@@ -184,7 +184,7 @@ typedef const X86RFLAGS *PCX86RFLAGS;
 /** Bit 11 - OF - Overflow flag - Status flag. */
 #define X86_EFL_OF          RT_BIT(11)
 #define X86_EFL_OF_BIT      11
-/** Bit 12-13 - IOPL - I/O prvilege level flag - System flag. */
+/** Bit 12-13 - IOPL - I/O privilege level flag - System flag. */
 #define X86_EFL_IOPL        (RT_BIT(12) | RT_BIT(13))
 /** Bit 14 - NT - Nested task flag - System flag. */
 #define X86_EFL_NT          RT_BIT(14)
@@ -206,7 +206,7 @@ typedef const X86RFLAGS *PCX86RFLAGS;
 #define X86_EFL_RA1_MASK    RT_BIT_32(1)
 /** IOPL shift. */
 #define X86_EFL_IOPL_SHIFT  12
-/** The the IOPL level from the flags. */
+/** The IOPL level from the flags. */
 #define X86_EFL_GET_IOPL(efl)   (((efl) >> X86_EFL_IOPL_SHIFT) & 3)
 /** Bits restored by popf */
 #define X86_EFL_POPF_BITS       (  X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_TF | X86_EFL_IF \
@@ -336,7 +336,7 @@ typedef struct X86CPUIDFEATEDX
     unsigned    u1CMOV : 1;
     /** Bit 16 - PAT - Page Attribute Table. */
     unsigned    u1PAT : 1;
-    /** Bit 17 - PSE-36 - 36-bit Page Size Extention. */
+    /** Bit 17 - PSE-36 - 36-bit Page Size Extension. */
     unsigned    u1PSE36 : 1;
     /** Bit 18 - PSN - Processor Serial Number. */
     unsigned    u1PSN : 1;
@@ -419,6 +419,9 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CPUID_FEATURE_ECX_SSSE3     RT_BIT(9)
 /** ECX Bit 10 - CNTX-ID - L1 Context ID. */
 #define X86_CPUID_FEATURE_ECX_CNTXID    RT_BIT(10)
+/** ECX Bit 11 - SDBG - Sillicon debug interface (IA32_DEBUG_INTERFACE MSR).
+ * See figure 3-6 and table 3-10, in intel Vol. 2A. from 2015-01-01. */
+#define X86_CPUID_FEATURE_ECX_SDBG      RT_BIT(11)
 /** ECX Bit 12 - FMA. */
 #define X86_CPUID_FEATURE_ECX_FMA       RT_BIT(12)
 /** ECX Bit 13 - CX16 - CMPXCHG16B. */
@@ -491,7 +494,7 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CPUID_FEATURE_EDX_CMOV      RT_BIT(15)
 /** Bit 16 - PAT - Page Attribute Table. */
 #define X86_CPUID_FEATURE_EDX_PAT       RT_BIT(16)
-/** Bit 17 - PSE-36 - 36-bit Page Size Extention. */
+/** Bit 17 - PSE-36 - 36-bit Page Size Extension. */
 #define X86_CPUID_FEATURE_EDX_PSE36     RT_BIT(17)
 /** Bit 18 - PSN - Processor Serial Number. */
 #define X86_CPUID_FEATURE_EDX_PSN       RT_BIT(18)
@@ -499,7 +502,7 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CPUID_FEATURE_EDX_CLFSH     RT_BIT(19)
 /** Bit 21 - DS - Debug Store. */
 #define X86_CPUID_FEATURE_EDX_DS        RT_BIT(21)
-/** Bit 22 - ACPI - Termal Monitor and Software Controlled Clock Facilities. */
+/** Bit 22 - ACPI - Thermal Monitor and Software Controlled Clock Facilities. */
 #define X86_CPUID_FEATURE_EDX_ACPI      RT_BIT(22)
 /** Bit 23 - MMX - Intel MMX Technology. */
 #define X86_CPUID_FEATURE_EDX_MMX       RT_BIT(23)
@@ -582,6 +585,9 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CPUID_STEXT_FEATURE_EBX_AVX512CD          RT_BIT(28)
 /** EBX Bit 29 - SHA - Supports Secure Hash Algorithm extensions. */
 #define X86_CPUID_STEXT_FEATURE_EBX_SHA               RT_BIT(29)
+
+/** ECX Bit 0 - PREFETCHWT1 - Supports the PREFETCHWT1 instruction. */
+#define X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1       RT_BIT(0)
 /** @} */
 
 
@@ -638,7 +644,7 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CPUID_AMD_FEATURE_EDX_CMOV      RT_BIT(15)
 /** Bit 16 - PAT - Page Attribute Table. */
 #define X86_CPUID_AMD_FEATURE_EDX_PAT       RT_BIT(16)
-/** Bit 17 - PSE-36 - 36-bit Page Size Extention. */
+/** Bit 17 - PSE-36 - 36-bit Page Size Extension. */
 #define X86_CPUID_AMD_FEATURE_EDX_PSE36     RT_BIT(17)
 /** Bit 22 - AXMMX - AMD Extensions to MMX Instructions. */
 #define X86_CPUID_AMD_FEATURE_EDX_AXMMX     RT_BIT(22)
@@ -653,7 +659,7 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 /** Bit 31 - 3DNOW - AMD 3DNow. */
 #define X86_CPUID_AMD_FEATURE_EDX_3DNOW     RT_BIT(31)
 
-/** Bit 1 - CMPL - Core multi-processing legacy mode. */
+/** Bit 1 - CmpLegacy - Core multi-processing legacy mode. */
 #define X86_CPUID_AMD_FEATURE_ECX_CMPL      RT_BIT(1)
 /** Bit 2 - SVM - AMD VM extensions. */
 #define X86_CPUID_AMD_FEATURE_ECX_SVM       RT_BIT(2)
@@ -673,13 +679,23 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CPUID_AMD_FEATURE_ECX_OSVW      RT_BIT(9)
 /** Bit 10 - IBS - Instruct based sampling. */
 #define X86_CPUID_AMD_FEATURE_ECX_IBS       RT_BIT(10)
-/** Bit 11 - SSE5 - SSE5 instruction support. */
-#define X86_CPUID_AMD_FEATURE_ECX_SSE5      RT_BIT(11)
+/** Bit 11 - XOP - Extended operation support (see APM6). */
+#define X86_CPUID_AMD_FEATURE_ECX_XOP       RT_BIT(11)
 /** Bit 12 - SKINIT - AMD SKINIT: SKINIT, STGI, and DEV support. */
 #define X86_CPUID_AMD_FEATURE_ECX_SKINIT    RT_BIT(12)
 /** Bit 13 - WDT - AMD Watchdog timer support. */
 #define X86_CPUID_AMD_FEATURE_ECX_WDT       RT_BIT(13)
-
+/** Bit 15 - LWP - Lightweight profiling support. */
+#define X86_CPUID_AMD_FEATURE_ECX_LWP       RT_BIT(15)
+/** Bit 16 - FMA4 - Four operand FMA instruction support. */
+#define X86_CPUID_AMD_FEATURE_ECX_FMA4      RT_BIT(16)
+/** Bit 19 - NodeId - Indicates support for
+ * MSR_C001_100C[NodeId,NodesPerProcessr]. */
+#define X86_CPUID_AMD_FEATURE_ECX_NODEID    RT_BIT(19)
+/** Bit 21 - TBM - Trailing bit manipulation instruction support. */
+#define X86_CPUID_AMD_FEATURE_ECX_TBM       RT_BIT(21)
+/** Bit 22 - TopologyExtensions - . */
+#define X86_CPUID_AMD_FEATURE_ECX_TOPOEXT   RT_BIT(22)
 /** @} */
 
 
@@ -705,6 +721,14 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CPUID_AMD_ADVPOWER_EDX_HWPSTATE  RT_BIT(7)
 /** Bit 8 - TSCINVAR - TSC Invariant. */
 #define X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR  RT_BIT(8)
+/** Bit 9 - CPB - TSC Invariant. */
+#define X86_CPUID_AMD_ADVPOWER_EDX_CPB       RT_BIT(9)
+/** Bit 10 - EffFreqRO - MPERF/APERF. */
+#define X86_CPUID_AMD_ADVPOWER_EDX_EFRO      RT_BIT(10)
+/** Bit 11 - PFI - Processor feedback interface (see EAX). */
+#define X86_CPUID_AMD_ADVPOWER_EDX_PFI       RT_BIT(11)
+/** Bit 12 - PA - Processor accumulator (MSR c001_007a). */
+#define X86_CPUID_AMD_ADVPOWER_EDX_PA        RT_BIT(12)
 /** @} */
 
 
@@ -781,8 +805,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CR4_PGE                         RT_BIT(7)
 /** Bit 8 - PCE - Performance-Monitoring Counter Enable. */
 #define X86_CR4_PCE                         RT_BIT(8)
-/** Bit 9 - OSFSXR - Operating System Support for FXSAVE and FXRSTORE instruction. */
-#define X86_CR4_OSFSXR                      RT_BIT(9)
+/** Bit 9 - OSFXSR - Operating System Support for FXSAVE and FXRSTORE instructions. */
+#define X86_CR4_OSFXSR                      RT_BIT(9)
 /** Bit 10 - OSXMMEEXCPT - Operating System Support for Unmasked SIMD Floating-Point Exceptions. */
 #define X86_CR4_OSXMMEEXCPT                 RT_BIT(10)
 /** Bit 13 - VMXE - VMX mode is enabled. */
@@ -798,6 +822,8 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 #define X86_CR4_SMEP                        RT_BIT(20)
 /** Bit 21 - SMAP - Supervisor-mode Access Prevention enabled. */
 #define X86_CR4_SMAP                        RT_BIT(21)
+/** Bit 22 - PKE - Protection Key Enable. */
+#define X86_CR4_PKE                         RT_BIT(22)
 /** @} */
 
 
@@ -861,9 +887,20 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 /** L0, L1, L2, and L3.  */
 #define X86_DR7_GE_ALL                      UINT64_C(0x00000000000000aa)
 
+/** Bit 12 - IR (ICE) - Interrupt redirection on Pentium.  When set, the in
+ * Circuit Emulator (ICE) will break emulation on breakpoints and stuff.
+ * May cause CPU hang if enabled without ICE attached when the ICEBP/INT1
+ * instruction is executed.
+ * @see http://www.rcollins.org/secrets/DR7.html  */
+#define X86_DR7_ICE_IR                      RT_BIT(12)
 /** Bit 13 - GD - General detect enable. Enables emulators to get exceptions when
  * any DR register is accessed. */
 #define X86_DR7_GD                          RT_BIT(13)
+/** Bit 14 - TR1 (ICE) - Code discontinuity trace for use with ICE on
+ *  Pentium. */
+#define X86_DR7_ICE_TR1                     RT_BIT(14)
+/** Bit 15 - TR2 (ICE) - Controls unknown ICE trace feature of the pentium. */
+#define X86_DR7_ICE_TR2                     RT_BIT(15)
 /** Bit 16 & 17 - R/W0 - Read write field 0. Values X86_DR7_RW_*. */
 #define X86_DR7_RW0_MASK                    (3 << 16)
 /** Bit 18 & 19 - LEN0 - Length field 0. Values X86_DR7_LEN_*. */
@@ -883,7 +920,7 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 
 /** Bits which reads as 1s. */
 #define X86_DR7_RA1_MASK                    (RT_BIT(10))
-/** Bits which reads as zeros. */
+/** Bits which reads as zeros.  These are related to ICE (bits 12, 14, 15). */
 #define X86_DR7_RAZ_MASK                    UINT64_C(0x0000d800)
 /** Bits which must be 0s when writing to DR7. */
 #define X86_DR7_MBZ_MASK                    UINT64_C(0xffffffff00000000)
@@ -921,7 +958,7 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
  */
 #define X86_DR7_RW(iBp, fRw)                ( (fRw) << ((iBp) * 4 + 16) )
 
-/** Fetch the the R/Wx bits for a given breakpoint (so it can be compared with
+/** Fetch the R/Wx bits for a given breakpoint (so it can be compared with
  * one of the X86_DR7_RW_XXX constants).
  *
  * @returns X86_DR7_RW_XXX
@@ -933,9 +970,10 @@ typedef const X86CPUIDFEATEDX *PCX86CPUIDFEATEDX;
 /** R/W0, R/W1, R/W2, and R/W3. */
 #define X86_DR7_RW_ALL_MASKS                UINT32_C(0x33330000)
 
+#ifndef VBOX_FOR_DTRACE_LIB
 /** Checks if there are any I/O breakpoint types configured in the RW
  * registers.  Does NOT check if these are enabled, sorry. */
-#define X86_DR7_ANY_RW_IO(uDR7) \
+# define X86_DR7_ANY_RW_IO(uDR7) \
     (   (    UINT32_C(0x22220000) & (uDR7) ) /* any candidates? */ \
      && ( ( (UINT32_C(0x22220000) & (uDR7) ) >> 1 )  &  ~(uDR7) ) )
 AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x33330000)) == 0);
@@ -947,6 +985,7 @@ AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00010000)) == 0);
 AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00020000)) == 1);
 AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00030000)) == 0);
 AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00040000)) == 0);
+#endif /* !VBOX_FOR_DTRACE_LIB */
 
 /** @name Length values.
  * @{ */
@@ -1089,7 +1128,7 @@ AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00040000)) == 0);
  * The 16th bit whether flex ratio is being used, in which case bits 15:8
  * holds a ratio that Apple takes for TSC granularity.
  *
- * @note This MSR conflics the P4 MSR_MCG_R12 register. */
+ * @note This MSR conflicts the P4 MSR_MCG_R12 register. */
 #define MSR_FLEX_RATIO                      0x194
 /** Performance state value and starting with Intel core more.
  * Apple uses the >=core features to determine TSC granularity on older CPUs. */
@@ -1230,6 +1269,8 @@ AssertCompile(X86_DR7_ANY_RW_IO(UINT32_C(0x00040000)) == 0);
 #define  MSR_K6_EFER_LMSLE                   RT_BIT(13)
 /** Bit 14 - FFXSR - Fast FXSAVE / FXRSTOR (skip XMM*). (R/W) */
 #define  MSR_K6_EFER_FFXSR                   RT_BIT(14)
+/** Bit 15 - TCE - Translation Cache Extension. (R/W) */
+#define  MSR_K6_EFER_TCE                     RT_BIT(15)
 /** K6 STAR - SYSCALL/RET targets. */
 #define MSR_K6_STAR                         UINT32_C(0xc0000081)
 /** Shift value for getting the SYSRET CS and SS value. */
@@ -2180,6 +2221,29 @@ typedef const X86PML4 *PCX86PML4;
 
 /** @} */
 
+/**
+ * 32-bit protected mode FSTENV image.
+ */
+typedef struct X86FSTENV32P
+{
+    uint16_t    FCW;
+    uint16_t    padding1;
+    uint16_t    FSW;
+    uint16_t    padding2;
+    uint16_t    FTW;
+    uint16_t    padding3;
+    uint32_t    FPUIP;
+    uint16_t    FPUCS;
+    uint16_t    FOP;
+    uint32_t    FPUDP;
+    uint16_t    FPUDS;
+    uint16_t    padding4;
+} X86FSTENV32P;
+/** Pointer to a 32-bit protected mode FSTENV image. */
+typedef X86FSTENV32P *PX86FSTENV32P;
+/** Pointer to a const 32-bit protected mode FSTENV image. */
+typedef X86FSTENV32P const *PCX86FSTENV32P;
+
 
 /**
  * 80-bit MMX/FPU register type.
@@ -2188,11 +2252,125 @@ typedef struct X86FPUMMX
 {
     uint8_t reg[10];
 } X86FPUMMX;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86FPUMMX, 10);
+#endif
 /** Pointer to a 80-bit MMX/FPU register type. */
 typedef X86FPUMMX *PX86FPUMMX;
 /** Pointer to a const 80-bit MMX/FPU register type. */
 typedef const X86FPUMMX *PCX86FPUMMX;
 
+/** FPU (x87) register. */
+typedef union X86FPUREG
+{
+    /** MMX view. */
+    uint64_t    mmx;
+    /** FPU view - todo. */
+    X86FPUMMX   fpu;
+    /** Extended precision floating point view. */
+    RTFLOAT80U  r80;
+    /** Extended precision floating point view v2 */
+    RTFLOAT80U2 r80Ex;
+    /** 8-bit view. */
+    uint8_t     au8[16];
+    /** 16-bit view. */
+    uint16_t    au16[8];
+    /** 32-bit view. */
+    uint32_t    au32[4];
+    /** 64-bit view. */
+    uint64_t    au64[2];
+    /** 128-bit view. (yeah, very helpful) */
+    uint128_t   au128[1];
+} X86FPUREG;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86FPUREG, 16);
+#endif
+/** Pointer to a FPU register. */
+typedef X86FPUREG *PX86FPUREG;
+/** Pointer to a const FPU register. */
+typedef X86FPUREG const *PCX86FPUREG;
+
+/**
+ * XMM register union.
+ */
+typedef union X86XMMREG
+{
+    /** XMM Register view *. */
+    uint128_t   xmm;
+    /** 8-bit view. */
+    uint8_t     au8[16];
+    /** 16-bit view. */
+    uint16_t    au16[8];
+    /** 32-bit view. */
+    uint32_t    au32[4];
+    /** 64-bit view. */
+    uint64_t    au64[2];
+    /** 128-bit view. (yeah, very helpful) */
+    uint128_t   au128[1];
+} X86XMMREG;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XMMREG, 16);
+#endif
+/** Pointer to an XMM register state. */
+typedef X86XMMREG *PX86XMMREG;
+/** Pointer to a const XMM register state. */
+typedef X86XMMREG const *PCX86XMMREG;
+
+/**
+ * YMM register union.
+ */
+typedef union X86YMMREG
+{
+    /** 8-bit view. */
+    uint8_t     au8[32];
+    /** 16-bit view. */
+    uint16_t    au16[16];
+    /** 32-bit view. */
+    uint32_t    au32[8];
+    /** 64-bit view. */
+    uint64_t    au64[4];
+    /** 128-bit view. (yeah, very helpful) */
+    uint128_t   au128[2];
+    /** XMM sub register view. */
+    X86XMMREG   aXmm[2];
+} X86YMMREG;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86YMMREG, 32);
+#endif
+/** Pointer to an YMM register state. */
+typedef X86YMMREG *PX86YMMREG;
+/** Pointer to a const YMM register state. */
+typedef X86YMMREG const *PCX86YMMREG;
+
+/**
+ * ZMM register union.
+ */
+typedef union X86ZMMREG
+{
+    /** 8-bit view. */
+    uint8_t     au8[64];
+    /** 16-bit view. */
+    uint16_t    au16[32];
+    /** 32-bit view. */
+    uint32_t    au32[16];
+    /** 64-bit view. */
+    uint64_t    au64[8];
+    /** 128-bit view. (yeah, very helpful) */
+    uint128_t   au128[4];
+    /** XMM sub register view. */
+    X86XMMREG   aXmm[4];
+    /** YMM sub register view. */
+    X86YMMREG   aYmm[2];
+} X86ZMMREG;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86ZMMREG, 64);
+#endif
+/** Pointer to an ZMM register state. */
+typedef X86ZMMREG *PX86ZMMREG;
+/** Pointer to a const ZMM register state. */
+typedef X86ZMMREG const *PCX86ZMMREG;
+
+
 /**
  * 32-bit FPU state (aka FSAVE/FRSTOR Memory Region).
  * @todo verify this...
@@ -2223,28 +2401,8 @@ typedef struct X86FPUSTATE
     uint32_t    FPUOO;
     /** 0x18 - FOS. */
     uint32_t    FPUOS;
-    /** 0x1c */
-    union
-    {
-        /** MMX view. */
-        uint64_t    mmx;
-        /** FPU view - todo. */
-        X86FPUMMX   fpu;
-        /** Extended precision floating point view. */
-        RTFLOAT80U  r80;
-        /** Extended precision floating point view v2. */
-        RTFLOAT80U2 r80Ex;
-        /** 8-bit view. */
-        uint8_t     au8[16];
-        /** 16-bit view. */
-        uint16_t    au16[8];
-        /** 32-bit view. */
-        uint32_t    au32[4];
-        /** 64-bit view. */
-        uint64_t    au64[2];
-        /** 128-bit view. (yeah, very helpful) */
-        uint128_t   au128[1];
-    } regs[8];
+    /** 0x1c - FPU register. */
+    X86FPUREG   regs[8];
 } X86FPUSTATE;
 #pragma pack()
 /** Pointer to a FPU state. */
@@ -2281,44 +2439,10 @@ typedef struct X86FXSTATE
     uint32_t    MXCSR;
     /** 0x1c */
     uint32_t    MXCSR_MASK;
-    /** 0x20 */
-    union
-    {
-        /** MMX view. */
-        uint64_t    mmx;
-        /** FPU view - todo. */
-        X86FPUMMX   fpu;
-        /** Extended precision floating point view. */
-        RTFLOAT80U  r80;
-        /** Extended precision floating point view v2 */
-        RTFLOAT80U2 r80Ex;
-        /** 8-bit view. */
-        uint8_t     au8[16];
-        /** 16-bit view. */
-        uint16_t    au16[8];
-        /** 32-bit view. */
-        uint32_t    au32[4];
-        /** 64-bit view. */
-        uint64_t    au64[2];
-        /** 128-bit view. (yeah, very helpful) */
-        uint128_t   au128[1];
-    } aRegs[8];
-    /* - offset 160 - */
-    union
-    {
-        /** XMM Register view *. */
-        uint128_t   xmm;
-        /** 8-bit view. */
-        uint8_t     au8[16];
-        /** 16-bit view. */
-        uint16_t    au16[8];
-        /** 32-bit view. */
-        uint32_t    au32[4];
-        /** 64-bit view. */
-        uint64_t    au64[2];
-        /** 128-bit view. (yeah, very helpful) */
-        uint128_t   au128[1];
-    } aXMM[16]; /* 8 registers in 32 bits mode; 16 in long mode */
+    /** 0x20 - FPU registers. */
+    X86FPUREG   aRegs[8];
+    /** 0xA0 - XMM registers - 8 registers in 32 bits mode, 16 in long mode. */
+    X86XMMREG   aXMM[16];
     /* - offset 416 - */
     uint32_t    au32RsrvdRest[(464 - 416) / sizeof(uint32_t)];
     /* - offset 464 - Software usable reserved bits. */
@@ -2334,10 +2458,13 @@ typedef const X86FXSTATE *PCX86FXSTATE;
  *  magic. Don't forget to update x86.mac if you change this! */
 #define X86_OFF_FXSTATE_RSVD            0x1d0
 /** The 32-bit magic used to recognize if this a 32-bit FPU state. Don't
- *  forget to update x86.mac if you change this! */
+ *  forget to update x86.mac if you change this!
+ * @todo r=bird: This has nothing what-so-ever to do here.... */
 #define X86_FXSTATE_RSVD_32BIT_MAGIC    0x32b3232b
+#ifndef VBOX_FOR_DTRACE_LIB
 AssertCompileSize(X86FXSTATE, 512);
 AssertCompileMemberOffset(X86FXSTATE, au32RsrvdForSoftware, X86_OFF_FXSTATE_RSVD);
+#endif
 
 /** @name FPU status word flags.
  * @{ */
@@ -2430,53 +2557,294 @@ AssertCompileMemberOffset(X86FXSTATE, au32RsrvdForSoftware, X86_OFF_FXSTATE_RSVD
 /** @name SSE MXCSR
  * @{ */
 /** Exception Flag: Invalid operation.  */
-#define X86_MSXCR_IE          RT_BIT(0)
+#define X86_MXSCR_IE          RT_BIT(0)
 /** Exception Flag: Denormalized operand.  */
-#define X86_MSXCR_DE          RT_BIT(1)
+#define X86_MXSCR_DE          RT_BIT(1)
 /** Exception Flag: Zero divide.  */
-#define X86_MSXCR_ZE          RT_BIT(2)
+#define X86_MXSCR_ZE          RT_BIT(2)
 /** Exception Flag: Overflow.  */
-#define X86_MSXCR_OE          RT_BIT(3)
+#define X86_MXSCR_OE          RT_BIT(3)
 /** Exception Flag: Underflow.  */
-#define X86_MSXCR_UE          RT_BIT(4)
+#define X86_MXSCR_UE          RT_BIT(4)
 /** Exception Flag: Precision.  */
-#define X86_MSXCR_PE          RT_BIT(5)
+#define X86_MXSCR_PE          RT_BIT(5)
 
 /** Denormals are zero. */
-#define X86_MSXCR_DAZ         RT_BIT(6)
+#define X86_MXSCR_DAZ         RT_BIT(6)
 
 /** Exception Mask: Invalid operation. */
-#define X86_MSXCR_IM          RT_BIT(7)
+#define X86_MXSCR_IM          RT_BIT(7)
 /** Exception Mask: Denormalized operand. */
-#define X86_MSXCR_DM          RT_BIT(8)
+#define X86_MXSCR_DM          RT_BIT(8)
 /** Exception Mask: Zero divide.  */
-#define X86_MSXCR_ZM          RT_BIT(9)
+#define X86_MXSCR_ZM          RT_BIT(9)
 /** Exception Mask: Overflow.  */
-#define X86_MSXCR_OM          RT_BIT(10)
+#define X86_MXSCR_OM          RT_BIT(10)
 /** Exception Mask: Underflow.  */
-#define X86_MSXCR_UM          RT_BIT(11)
+#define X86_MXSCR_UM          RT_BIT(11)
 /** Exception Mask: Precision.  */
-#define X86_MSXCR_PM          RT_BIT(12)
+#define X86_MXSCR_PM          RT_BIT(12)
 
 /** Rounding control mask. */
-#define X86_MSXCR_RC_MASK     UINT16_C(0x6000)
+#define X86_MXSCR_RC_MASK     UINT16_C(0x6000)
 /** Rounding control: To nearest. */
-#define X86_MSXCR_RC_NEAREST  UINT16_C(0x0000)
+#define X86_MXSCR_RC_NEAREST  UINT16_C(0x0000)
 /** Rounding control: Down. */
-#define X86_MSXCR_RC_DOWN     UINT16_C(0x2000)
+#define X86_MXSCR_RC_DOWN     UINT16_C(0x2000)
 /** Rounding control: Up. */
-#define X86_MSXCR_RC_UP       UINT16_C(0x4000)
+#define X86_MXSCR_RC_UP       UINT16_C(0x4000)
 /** Rounding control: Towards zero. */
-#define X86_MSXCR_RC_ZERO     UINT16_C(0x6000)
+#define X86_MXSCR_RC_ZERO     UINT16_C(0x6000)
 
 /** Flush-to-zero for masked underflow.  */
-#define X86_MSXCR_FZ          RT_BIT(15)
+#define X86_MXSCR_FZ          RT_BIT(15)
+
+/** Misaligned Exception Mask (AMD MISALIGNSSE).  */
+#define X86_MXSCR_MM          RT_BIT(17)
+/** @} */
+
+/**
+ * XSAVE header.
+ */
+typedef struct X86XSAVEHDR
+{
+    /** XTATE_BV - Bitmap indicating whether a component is in the state. */
+    uint64_t        bmXState;
+    /** XCOMP_BC - Bitmap used by instructions applying structure compaction. */
+    uint64_t        bmXComp;
+    /** Reserved for furture extensions, probably MBZ. */
+    uint64_t        au64Reserved[6];
+} X86XSAVEHDR;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVEHDR, 64);
+#endif
+/** Pointer to an XSAVE header. */
+typedef X86XSAVEHDR *PX86XSAVEHDR;
+/** Pointer to a const XSAVE header. */
+typedef X86XSAVEHDR const *PCX86XSAVEHDR;
+
+
+/**
+ * The high 128-bit YMM register state (XSAVE_C_YMM).
+ * (The lower 128-bits being in X86FXSTATE.)
+ */
+typedef struct X86XSAVEYMMHI
+{
+    /** 16 registers in 64-bit mode, 8 in 32-bit mode. */
+    X86XMMREG       aYmmHi[16];
+} X86XSAVEYMMHI;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVEYMMHI, 256);
+#endif
+/** Pointer to a high 128-bit YMM register state. */
+typedef X86XSAVEYMMHI *PX86XSAVEYMMHI;
+/** Pointer to a const high 128-bit YMM register state. */
+typedef X86XSAVEYMMHI const *PCX86XSAVEYMMHI;
+
+/**
+ * Intel MPX bound registers state (XSAVE_C_BNDREGS).
+ */
+typedef struct X86XSAVEBNDREGS
+{
+    /** Array of registers (BND0...BND3). */
+    struct
+    {
+        /** Lower bound. */
+        uint64_t    uLowerBound;
+        /** Upper bound. */
+        uint64_t    uUpperBound;
+    } aRegs[4];
+} X86XSAVEBNDREGS;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVEBNDREGS, 64);
+#endif
+/** Pointer to a MPX bound register state. */
+typedef X86XSAVEBNDREGS *PX86XSAVEBNDREGS;
+/** Pointer to a const MPX bound register state. */
+typedef X86XSAVEBNDREGS const *PCX86XSAVEBNDREGS;
+
+/**
+ * Intel MPX bound config and status register state (XSAVE_C_BNDCSR).
+ */
+typedef struct X86XSAVEBNDCFG
+{
+    uint64_t        fConfig;
+    uint64_t        fStatus;
+} X86XSAVEBNDCFG;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVEBNDCFG, 16);
+#endif
+/** Pointer to a MPX bound config and status register state. */
+typedef X86XSAVEBNDCFG *PX86XSAVEBNDCFG;
+/** Pointer to a const MPX bound config and status register state. */
+typedef X86XSAVEBNDCFG *PCX86XSAVEBNDCFG;
+
+/**
+ * AVX-512 opmask state (XSAVE_C_OPMASK).
+ */
+typedef struct X86XSAVEOPMASK
+{
+    /** The K0..K7 values. */
+    uint64_t    aKRegs[8];
+} X86XSAVEOPMASK;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVEOPMASK, 64);
+#endif
+/** Pointer to a AVX-512 opmask state. */
+typedef X86XSAVEOPMASK *PX86XSAVEOPMASK;
+/** Pointer to a const AVX-512 opmask state. */
+typedef X86XSAVEOPMASK const *PCX86XSAVEOPMASK;
+
+/**
+ * ZMM0-15 upper 256 bits introduced in AVX-512 (XSAVE_C_ZMM_HI256).
+ */
+typedef struct X86XSAVEZMMHI256
+{
+    /** Upper 256-bits of ZMM0-15. */
+    X86YMMREG   aHi256Regs[16];
+} X86XSAVEZMMHI256;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVEZMMHI256, 512);
+#endif
+/** Pointer to a state comprising the upper 256-bits of ZMM0-15. */
+typedef X86XSAVEZMMHI256 *PX86XSAVEZMMHI256;
+/** Pointer to a const state comprising the upper 256-bits of ZMM0-15. */
+typedef X86XSAVEZMMHI256 const *PCX86XSAVEZMMHI256;
+
+/**
+ * ZMM16-31 register state introduced in AVX-512 (XSAVE_C_ZMM_16HI).
+ */
+typedef struct X86XSAVEZMM16HI
+{
+    /** ZMM16 thru ZMM31. */
+    X86ZMMREG   aRegs[16];
+} X86XSAVEZMM16HI;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVEZMM16HI, 1024);
+#endif
+/** Pointer to a state comprising ZMM16-32. */
+typedef X86XSAVEZMM16HI *PX86XSAVEZMM16HI;
+/** Pointer to a const state comprising ZMM16-32. */
+typedef X86XSAVEZMM16HI const *PCX86XSAVEZMM16HI;
+
+/**
+ * AMD Light weight profiling state (XSAVE_C_LWP).
+ *
+ * We probably won't play with this as AMD seems to be dropping from their "zen"
+ * processor micro architecture.
+ */
+typedef struct X86XSAVELWP
+{
+    /** Details when needed. */
+    uint64_t        auLater[128/8];
+} X86XSAVELWP;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVELWP, 128);
+#endif
+
+
 
-/** Misaligned Exception Mask.  */
-#define X86_MSXCR_MM          RT_BIT(16)
+typedef struct X86XSAVEAREA
+{
+    /** The x87 and SSE region (or legacy region if you like).  */
+    X86FXSTATE      x87;
+    /** The XSAVE header. */
+    X86XSAVEHDR     Hdr;
+    /** Beyond the header, there isn't really a fixed layout, but we can
+       generally assume the YMM (AVX) register extensions are present and
+       follows immediately. */
+    union
+    {
+        /** This is a typical layout on intel CPUs (good for debuggers). */
+        struct
+        {
+            X86XSAVEYMMHI       YmmHi;
+            X86XSAVEBNDREGS     BndRegs;
+            X86XSAVEBNDCFG      BndCfg;
+            uint8_t             abFudgeToMatchDocs[0xB0];
+            X86XSAVEOPMASK      Opmask;
+            X86XSAVEZMMHI256    ZmmHi256;
+            X86XSAVEZMM16HI     Zmm16Hi;
+        } Intel;
+
+        /** This is a typical layout on AMD Bulldozer type CPUs (good for debuggers). */
+        struct
+        {
+            X86XSAVEYMMHI       YmmHi;
+            X86XSAVELWP         Lwp;
+        } AmdBd;
+
+        /** To enbling static deployments that have a reasonable chance of working for
+         * the next 3-6 CPU generations without running short on space, we allocate a
+         * lot of extra space here, making the structure a round 8KB in size.  This
+         * leaves us 7616 bytes for extended state.  The skylake xeons are likely to use
+         * 2112 of these, leaving us with 5504 bytes for future Intel generations. */
+        uint8_t         ab[8192 - 512 - 64];
+    } u;
+} X86XSAVEAREA;
+#ifndef VBOX_FOR_DTRACE_LIB
+AssertCompileSize(X86XSAVEAREA, 8192);
+AssertCompileMemberSize(X86XSAVEAREA, u.Intel, 0x840 /*2112 => total 0xa80 (2688) */);
+AssertCompileMemberOffset(X86XSAVEAREA, Hdr,                0x200);
+AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.YmmHi,      0x240);
+AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.BndRegs,    0x340);
+AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.BndCfg,     0x380);
+AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.Opmask,     0x440 /* 1088 */);
+AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.ZmmHi256,   0x480 /* 1152 */);
+AssertCompileMemberOffset(X86XSAVEAREA, u.Intel.Zmm16Hi,    0x680 /* 1664 */);
+#endif
+/** Pointer to a XSAVE area. */
+typedef X86XSAVEAREA *PX86XSAVEAREA;
+/** Pointer to a const XSAVE area. */
+typedef X86XSAVEAREA const *PCX86XSAVEAREA;
+
+
+/** @name XSAVE_C_XXX - XSAVE State Components Bits.
+ * @{ */
+/** Bit 0 - x87 - Legacy FPU state (bit number) */
+#define XSAVE_C_X87_BIT         0
+/** Bit 0 - x87 - Legacy FPU state. */
+#define XSAVE_C_X87             RT_BIT_64(XSAVE_C_X87_BIT)
+/** Bit 1 - SSE - 128-bit SSE state (bit number). */
+#define XSAVE_C_SSE_BIT         1
+/** Bit 1 - SSE - 128-bit SSE state. */
+#define XSAVE_C_SSE             RT_BIT_64(XSAVE_C_SSE_BIT)
+/** Bit 2 - YMM_Hi128 - Upper 128 bits of YMM0-15 (AVX) (bit number). */
+#define XSAVE_C_YMM_BIT         2
+/** Bit 2 - YMM_Hi128 - Upper 128 bits of YMM0-15 (AVX). */
+#define XSAVE_C_YMM             RT_BIT_64(XSAVE_C_YMM_BIT)
+/** Bit 3 - BNDREGS - MPX bound register state (bit number). */
+#define XSAVE_C_BNDREGS_BIT     3
+/** Bit 3 - BNDREGS - MPX bound register state. */
+#define XSAVE_C_BNDREGS         RT_BIT_64(XSAVE_C_BNDREGS_BIT)
+/** Bit 4 - BNDCSR - MPX bound config and status state (bit number). */
+#define XSAVE_C_BNDCSR_BIT      4
+/** Bit 4 - BNDCSR - MPX bound config and status state. */
+#define XSAVE_C_BNDCSR          RT_BIT_64(XSAVE_C_BNDCSR_BIT)
+/** Bit 5 - Opmask - opmask state (bit number). */
+#define XSAVE_C_OPMASK_BIT      5
+/** Bit 5 - Opmask - opmask state. */
+#define XSAVE_C_OPMASK          RT_BIT_64(XSAVE_C_OPMASK_BIT)
+/** Bit 6 - ZMM_Hi256 - Upper 256 bits of ZMM0-15 (AVX-512) (bit number). */
+#define XSAVE_C_ZMM_HI256_BIT   6
+/** Bit 6 - ZMM_Hi256 - Upper 256 bits of ZMM0-15 (AVX-512). */
+#define XSAVE_C_ZMM_HI256       RT_BIT_64(XSAVE_C_ZMM_HI256_BIT)
+/** Bit 7 - Hi16_ZMM - 512-bits ZMM16-31 state (AVX-512) (bit number). */
+#define XSAVE_C_ZMM_16HI_BIT    7
+/** Bit 7 - Hi16_ZMM - 512-bits ZMM16-31 state (AVX-512). */
+#define XSAVE_C_ZMM_16HI        RT_BIT_64(XSAVE_C_ZMM_16HI_BIT)
+/** Bit 9 - PKRU - Protection-key state (bit number). */
+#define XSAVE_C_PKRU_BIT        9
+/** Bit 9 - PKRU - Protection-key state. */
+#define XSAVE_C_PKRU            RT_BIT_64(XSAVE_C_PKRU_BIT)
+/** Bit 62 - LWP - Lightweight Profiling (AMD) (bit number). */
+#define XSAVE_C_LWP_BIT         62
+/** Bit 62 - LWP - Lightweight Profiling (AMD). */
+#define XSAVE_C_LWP             RT_BIT_64(XSAVE_C_LWP_BIT)
 /** @} */
 
 
+
 /** @name Selector Descriptor
  * @{
  */
@@ -2491,7 +2859,7 @@ typedef struct X86DESCATTRBITS
     unsigned    u4Type : 4;
     /** 04 - Descriptor Type. System(=0) or code/data selector */
     unsigned    u1DescType : 1;
-    /** 05 - Descriptor Privelege level. */
+    /** 05 - Descriptor Privilege level. */
     unsigned    u2Dpl : 2;
     /** 07 - Flags selector present(=1) or not. */
     unsigned    u1Present : 1;
@@ -2562,7 +2930,7 @@ typedef struct X86DESCGENERIC
     unsigned    u4Type : 4;
     /** 2c - Descriptor Type. System(=0) or code/data selector */
     unsigned    u1DescType : 1;
-    /** 2d - Descriptor Privelege level. */
+    /** 2d - Descriptor Privilege level. */
     unsigned    u2Dpl : 2;
     /** 2f - Flags selector present(=1) or not. */
     unsigned    u1Present : 1;
@@ -2624,7 +2992,7 @@ typedef struct X86DESCGATE
     unsigned    u4Type : 4;
     /** 2c - Descriptor Type (0 = system). */
     unsigned    u1DescType : 1;
-    /** 2d - Descriptor Privelege level. */
+    /** 2d - Descriptor Privilege level. */
     unsigned    u2Dpl : 2;
     /** 2f - Flags selector present(=1) or not. */
     unsigned    u1Present : 1;
@@ -2724,7 +3092,7 @@ typedef struct X86DESC64GENERIC
     unsigned    u4Type : 4;
     /** Descriptor Type. System(=0) or code/data selector */
     unsigned    u1DescType : 1;
-    /** Descriptor Privelege level. */
+    /** Descriptor Privilege level. */
     unsigned    u2Dpl : 2;
     /** Flags selector present(=1) or not. */
     unsigned    u1Present : 1;
@@ -2773,7 +3141,7 @@ typedef struct X86DESC64SYSTEM
     unsigned    u4Type          : 4;
     /** Descriptor Type. System(=0) or code/data selector */
     unsigned    u1DescType      : 1;
-    /** Descriptor Privelege level. */
+    /** Descriptor Privilege level. */
     unsigned    u2Dpl           : 2;
     /** Flags selector present(=1) or not. */
     unsigned    u1Present       : 1;
@@ -2821,7 +3189,7 @@ typedef struct X86DESC64GATE
     unsigned    u4Type : 4;
     /** Descriptor Type (0 = system). */
     unsigned    u1DescType : 1;
-    /** Descriptor Privelege level. */
+    /** Descriptor Privilege level. */
     unsigned    u2Dpl : 2;
     /** Flags selector present(=1) or not. */
     unsigned    u1Present : 1;
@@ -3054,6 +3422,16 @@ typedef PCX86DESC   PCX86DESCHC;
  */
 
 /**
+ * The minimum TSS descriptor limit for 286 tasks.
+ */
+#define X86_SEL_TYPE_SYS_286_TSS_LIMIT_MIN      0x2b
+
+/**
+ * The minimum TSS descriptor segment limit for 386 tasks.
+ */
+#define X86_SEL_TYPE_SYS_386_TSS_LIMIT_MIN      0x67
+
+/**
  * 16-bit Task Segment (TSS).
  */
 #pragma pack(1)
@@ -3105,7 +3483,7 @@ typedef struct X86TSS16
     RTSEL       selLdt;
 } X86TSS16;
 #ifndef VBOX_FOR_DTRACE_LIB
-AssertCompileSize(X86TSS16, 44);
+AssertCompileSize(X86TSS16, X86_SEL_TYPE_SYS_286_TSS_LIMIT_MIN + 1);
 #endif
 #pragma pack()
 /** Pointer to a 16-bit task segment. */
@@ -3195,7 +3573,6 @@ typedef X86TSS32 *PX86TSS32;
 /** Pointer to const task segment. */
 typedef const X86TSS32 *PCX86TSS32;
 
-
 /**
  * 64-bit Task segment.
  */
@@ -3324,7 +3701,7 @@ typedef enum X86XCPT
     X86_XCPT_MC = 0x12,
     /** \#XF - SIMD Floating-Pointer Exception. */
     X86_XCPT_XF = 0x13,
-    /** \#VE - Virtualzation Exception. */
+    /** \#VE - Virtualization Exception. */
     X86_XCPT_VE = 0x14,
     /** \#SX - Security Exception. */
     X86_XCPT_SX = 0x1f
@@ -3366,6 +3743,8 @@ typedef const X86XCPT *PCX86XCPT;
 #define X86_TRAP_PF_RSVD            RT_BIT(3)
 /** Bit 4 - I/D - Instruction fetch (set) / Data access (clear) - PAE + NXE. */
 #define X86_TRAP_PF_ID              RT_BIT(4)
+/** Bit 5 - PK - Protection-key violation (AMD64 mode only). */
+#define X86_TRAP_PF_PK              RT_BIT(5)
 /** @} */
 
 #pragma pack(1)
diff --git a/include/iprt/x86.mac b/include/iprt/x86.mac
index 62f4967..4580c32 100644
--- a/include/iprt/x86.mac
+++ b/include/iprt/x86.mac
@@ -67,6 +67,7 @@
 %define X86_CPUID_FEATURE_ECX_TM2       RT_BIT(8)
 %define X86_CPUID_FEATURE_ECX_SSSE3     RT_BIT(9)
 %define X86_CPUID_FEATURE_ECX_CNTXID    RT_BIT(10)
+%define X86_CPUID_FEATURE_ECX_SDBG      RT_BIT(11)
 %define X86_CPUID_FEATURE_ECX_FMA       RT_BIT(12)
 %define X86_CPUID_FEATURE_ECX_CX16      RT_BIT(13)
 %define X86_CPUID_FEATURE_ECX_TPRUPDATE RT_BIT(14)
@@ -141,6 +142,7 @@
 %define X86_CPUID_STEXT_FEATURE_EBX_AVX512ER          RT_BIT(27)
 %define X86_CPUID_STEXT_FEATURE_EBX_AVX512CD          RT_BIT(28)
 %define X86_CPUID_STEXT_FEATURE_EBX_SHA               RT_BIT(29)
+%define X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1       RT_BIT(0)
 %define X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF     RT_BIT(0)
 %define X86_CPUID_EXT_FEATURE_EDX_SYSCALL       RT_BIT(11)
 %define X86_CPUID_EXT_FEATURE_EDX_NX            RT_BIT(20)
@@ -179,9 +181,14 @@
 %define X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF  RT_BIT(8)
 %define X86_CPUID_AMD_FEATURE_ECX_OSVW      RT_BIT(9)
 %define X86_CPUID_AMD_FEATURE_ECX_IBS       RT_BIT(10)
-%define X86_CPUID_AMD_FEATURE_ECX_SSE5      RT_BIT(11)
+%define X86_CPUID_AMD_FEATURE_ECX_XOP       RT_BIT(11)
 %define X86_CPUID_AMD_FEATURE_ECX_SKINIT    RT_BIT(12)
 %define X86_CPUID_AMD_FEATURE_ECX_WDT       RT_BIT(13)
+%define X86_CPUID_AMD_FEATURE_ECX_LWP       RT_BIT(15)
+%define X86_CPUID_AMD_FEATURE_ECX_FMA4      RT_BIT(16)
+%define X86_CPUID_AMD_FEATURE_ECX_NODEID    RT_BIT(19)
+%define X86_CPUID_AMD_FEATURE_ECX_TBM       RT_BIT(21)
+%define X86_CPUID_AMD_FEATURE_ECX_TOPOEXT   RT_BIT(22)
 %define X86_CPUID_AMD_ADVPOWER_EDX_TS        RT_BIT(0)
 %define X86_CPUID_AMD_ADVPOWER_EDX_FID       RT_BIT(1)
 %define X86_CPUID_AMD_ADVPOWER_EDX_VID       RT_BIT(2)
@@ -191,6 +198,10 @@
 %define X86_CPUID_AMD_ADVPOWER_EDX_MC        RT_BIT(6)
 %define X86_CPUID_AMD_ADVPOWER_EDX_HWPSTATE  RT_BIT(7)
 %define X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR  RT_BIT(8)
+%define X86_CPUID_AMD_ADVPOWER_EDX_CPB       RT_BIT(9)
+%define X86_CPUID_AMD_ADVPOWER_EDX_EFRO      RT_BIT(10)
+%define X86_CPUID_AMD_ADVPOWER_EDX_PFI       RT_BIT(11)
+%define X86_CPUID_AMD_ADVPOWER_EDX_PA        RT_BIT(12)
 %define X86_CR0_PE                          RT_BIT(0)
 %define X86_CR0_PROTECTION_ENABLE           RT_BIT(0)
 %define X86_CR0_MP                          RT_BIT(1)
@@ -227,7 +238,7 @@
 %define X86_CR4_MCE                         RT_BIT(6)
 %define X86_CR4_PGE                         RT_BIT(7)
 %define X86_CR4_PCE                         RT_BIT(8)
-%define X86_CR4_OSFSXR                      RT_BIT(9)
+%define X86_CR4_OSFXSR                      RT_BIT(9)
 %define X86_CR4_OSXMMEEXCPT                 RT_BIT(10)
 %define X86_CR4_VMXE                        RT_BIT(13)
 %define X86_CR4_SMXE                        RT_BIT(14)
@@ -260,7 +271,10 @@
 %define X86_DR7_GE                          RT_BIT(9)
 %define X86_DR7_LE_ALL                      0x0000000000000055
 %define X86_DR7_GE_ALL                      0x00000000000000aa
+%define X86_DR7_ICE_IR                      RT_BIT(12)
 %define X86_DR7_GD                          RT_BIT(13)
+%define X86_DR7_ICE_TR1                     RT_BIT(14)
+%define X86_DR7_ICE_TR2                     RT_BIT(15)
 %define X86_DR7_RW0_MASK                    (3 << 16)
 %define X86_DR7_LEN0_MASK                   (3 << 18)
 %define X86_DR7_RW1_MASK                    (3 << 20)
@@ -282,8 +296,10 @@
 %define X86_DR7_RW(iBp, fRw)                ( (fRw) << ((iBp) * 4 + 16) )
 %define X86_DR7_GET_RW(uDR7, iBp)            ( ( (uDR7) >> ((iBp) * 4 + 16) ) & 3 )
 %define X86_DR7_RW_ALL_MASKS                0x33330000
-%define X86_DR7_ANY_RW_IO(uDR7) \
+%ifndef VBOX_FOR_DTRACE_LIB
+ %define X86_DR7_ANY_RW_IO(uDR7) \
     (   (    0x22220000 & (uDR7) )
+%endif
 %define X86_DR7_LEN_BYTE                    0
 %define X86_DR7_LEN_WORD                    1
 %define X86_DR7_LEN_QWORD                   2
@@ -420,6 +436,7 @@
 %define  MSR_K6_EFER_SVME                    RT_BIT(12)
 %define  MSR_K6_EFER_LMSLE                   RT_BIT(13)
 %define  MSR_K6_EFER_FFXSR                   RT_BIT(14)
+%define  MSR_K6_EFER_TCE                     RT_BIT(15)
 %define MSR_K6_STAR                         0xc0000081
 %define  MSR_K6_STAR_SYSRET_CS_SS_SHIFT     48
 %define  MSR_K6_STAR_SYSCALL_CS_SS_SHIFT    32
@@ -582,8 +599,20 @@
 %define X86_PML4E_NX                        RT_BIT_64(63)
 %define X86_PML4_SHIFT              39
 %define X86_PML4_MASK               0x1ff
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
 %define X86_OFF_FXSTATE_RSVD            0x1d0
 %define X86_FXSTATE_RSVD_32BIT_MAGIC    0x32b3232b
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
 %define X86_FSW_IE          RT_BIT(0)
 %define X86_FSW_DE          RT_BIT(1)
 %define X86_FSW_ZE          RT_BIT(2)
@@ -623,26 +652,53 @@
 %define X86_FCW_RC_UP       0x0800
 %define X86_FCW_RC_ZERO     0x0c00
 %define X86_FCW_ZERO_MASK   0xf080
-%define X86_MSXCR_IE          RT_BIT(0)
-%define X86_MSXCR_DE          RT_BIT(1)
-%define X86_MSXCR_ZE          RT_BIT(2)
-%define X86_MSXCR_OE          RT_BIT(3)
-%define X86_MSXCR_UE          RT_BIT(4)
-%define X86_MSXCR_PE          RT_BIT(5)
-%define X86_MSXCR_DAZ         RT_BIT(6)
-%define X86_MSXCR_IM          RT_BIT(7)
-%define X86_MSXCR_DM          RT_BIT(8)
-%define X86_MSXCR_ZM          RT_BIT(9)
-%define X86_MSXCR_OM          RT_BIT(10)
-%define X86_MSXCR_UM          RT_BIT(11)
-%define X86_MSXCR_PM          RT_BIT(12)
-%define X86_MSXCR_RC_MASK     0x6000
-%define X86_MSXCR_RC_NEAREST  0x0000
-%define X86_MSXCR_RC_DOWN     0x2000
-%define X86_MSXCR_RC_UP       0x4000
-%define X86_MSXCR_RC_ZERO     0x6000
-%define X86_MSXCR_FZ          RT_BIT(15)
-%define X86_MSXCR_MM          RT_BIT(16)
+%define X86_MXSCR_IE          RT_BIT(0)
+%define X86_MXSCR_DE          RT_BIT(1)
+%define X86_MXSCR_ZE          RT_BIT(2)
+%define X86_MXSCR_OE          RT_BIT(3)
+%define X86_MXSCR_UE          RT_BIT(4)
+%define X86_MXSCR_PE          RT_BIT(5)
+%define X86_MXSCR_DAZ         RT_BIT(6)
+%define X86_MXSCR_IM          RT_BIT(7)
+%define X86_MXSCR_DM          RT_BIT(8)
+%define X86_MXSCR_ZM          RT_BIT(9)
+%define X86_MXSCR_OM          RT_BIT(10)
+%define X86_MXSCR_UM          RT_BIT(11)
+%define X86_MXSCR_PM          RT_BIT(12)
+%define X86_MXSCR_RC_MASK     0x6000
+%define X86_MXSCR_RC_NEAREST  0x0000
+%define X86_MXSCR_RC_DOWN     0x2000
+%define X86_MXSCR_RC_UP       0x4000
+%define X86_MXSCR_RC_ZERO     0x6000
+%define X86_MXSCR_FZ          RT_BIT(15)
+%define X86_MXSCR_MM          RT_BIT(17)
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%ifndef VBOX_FOR_DTRACE_LIB
+%endif
+%define XSAVE_C_X87         RT_BIT_64(0)
+%define XSAVE_C_SSE         RT_BIT_64(1)
+%define XSAVE_C_YMM         RT_BIT_64(2)
+%define XSAVE_C_BNDREGS     RT_BIT_64(3)
+%define XSAVE_C_BNDCSR      RT_BIT_64(4)
+%define XSAVE_C_OPMASK      RT_BIT_64(5)
+%define XSAVE_C_ZMM_HI256   RT_BIT_64(6)
+%define XSAVE_C_ZMM_16HI    RT_BIT_64(7)
+%define XSAVE_C_LWP         RT_BIT_64(62)
 %ifndef VBOX_FOR_DTRACE_LIB
 %endif
 %define X86DESCATTR_TYPE            0x0000000f
@@ -746,6 +802,8 @@
 %define X86_DESC_AVL                        RT_BIT(20)
 %define X86_DESC_DB                         RT_BIT(22)
 %define X86_DESC_G                          RT_BIT(23)
+%define X86_SEL_TYPE_SYS_286_TSS_LIMIT_MIN      0x2b
+%define X86_SEL_TYPE_SYS_386_TSS_LIMIT_MIN      0x67
 %ifndef VBOX_FOR_DTRACE_LIB
 %endif
 %ifndef VBOX_FOR_DTRACE_LIB
diff --git a/include/iprt/zip.h b/include/iprt/zip.h
index 4e30293..375f536 100644
--- a/include/iprt/zip.h
+++ b/include/iprt/zip.h
@@ -218,21 +218,6 @@ RTDECL(int)     RTZipBlockDecompress(RTZIPTYPE enmType, uint32_t fFlags,
 
 
 /**
- * Opens a zip decompression I/O stream.
- *
- * @returns IPRT status code.
- *
- * @param   hVfsIosIn           The compressed input stream (must be readable).
- *                              The reference is not consumed, instead another
- *                              one is retained.
- * @param   fFlags              Flags, MBZ.
- * @param   phVfsIosUnzip       Where to return the handle to the gunzipped I/O
- *                              stream (read).
- */
-RTDECL(int) RTZipDecompressIoStream(RTVFSIOSTREAM hVfsIosIn, uint32_t fFlags, PRTVFSIOSTREAM phVfsIosUnzip);
-
-
-/**
  * Opens a gzip decompression I/O stream.
  *
  * @returns IPRT status code.
diff --git a/src/Makefile.kmk b/src/Makefile.kmk
index 3dd7848..97ff704 100644
--- a/src/Makefile.kmk
+++ b/src/Makefile.kmk
@@ -36,9 +36,6 @@ else if !defined(VBOX_ONLY_BUILD)
  ifneq ($(wildcard $(PATH_SUB_CURRENT)/apps),)
   include $(PATH_SUB_CURRENT)/apps/Makefile.kmk
  endif
- ifdef VBOX_WITH_TESTSUITE
-  include $(PATH_SUB_CURRENT)/tests/Makefile.kmk
- endif
 endif # !VBOX_ONLY_BUILD
 
 include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/Additions/Makefile.kmk b/src/VBox/Additions/Makefile.kmk
index 413408a..3bd893c 100644
--- a/src/VBox/Additions/Makefile.kmk
+++ b/src/VBox/Additions/Makefile.kmk
@@ -47,7 +47,7 @@ VBOX_WITH_ADDITIONS_ISO.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) = 1
 # Include sub-makefiles.
 include $(PATH_SUB_CURRENT)/common/Makefile.kmk
 
-ifndef VBOX_ONLY_TESTSUITE
+ifndef VBOX_ONLY_VALIDATIONKIT
  ifdef VBOX_WITH_X11_ADDITIONS
   include $(PATH_SUB_CURRENT)/x11/Makefile.kmk
  endif
@@ -160,7 +160,7 @@ ifndef VBOX_ONLY_TESTSUITE
  ifndef VBOX_WITHOUT_ADDITIONS_ISO
   PACKING += $(VBOX_PATH_ADDITIONS_ISO)/VBoxGuestAdditions.zip
  endif
-endif # !VBOX_ONLY_TESTSUITE
+endif # !VBOX_ONLY_VALIDATIONKIT
 
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/Additions/common/Makefile.kmk b/src/VBox/Additions/common/Makefile.kmk
index a14519e..9468c9b 100644
--- a/src/VBox/Additions/common/Makefile.kmk
+++ b/src/VBox/Additions/common/Makefile.kmk
@@ -19,7 +19,7 @@ SUB_DEPTH = ../../../..
 include $(KBUILD_PATH)/subheader.kmk
 
 # Include sub-makefile.
-ifndef VBOX_ONLY_TESTSUITE
+ifndef VBOX_ONLY_VALIDATIONKIT
  include $(PATH_SUB_CURRENT)/VBoxGuestLib/Makefile.kmk
  include $(PATH_SUB_CURRENT)/VBoxControl/Makefile.kmk
  include $(PATH_SUB_CURRENT)/VBoxGuest/Makefile.kmk
@@ -30,6 +30,6 @@ ifndef VBOX_ONLY_TESTSUITE
  ifdef VBOX_WITH_PAM
   include $(PATH_SUB_CURRENT)/pam/Makefile.kmk
  endif
-endif # !VBOX_ONLY_TESTSUITE
+endif # !VBOX_ONLY_VALIDATIONKIT
 
 include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp b/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
index 69f2879..707b1da 100644
--- a/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
+++ b/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
@@ -21,6 +21,7 @@
 #include <iprt/alloca.h>
 #include <iprt/cpp/autores.h>
 #include <iprt/buildconfig.h>
+#include <iprt/getopt.h>
 #include <iprt/initterm.h>
 #include <iprt/mem.h>
 #include <iprt/message.h>
@@ -90,6 +91,7 @@ enum VBoxControlUsage
 #if !defined(VBOX_CONTROL_TEST)
     WRITE_CORE_DUMP,
 #endif
+    WRITE_LOG,
     TAKE_SNAPSHOT,
     SAVE_STATE,
     SUSPEND,
@@ -99,7 +101,7 @@ enum VBoxControlUsage
     USAGE_ALL = UINT32_MAX
 };
 
-static void usage(enum VBoxControlUsage eWhich = USAGE_ALL)
+static RTEXITCODE usage(enum VBoxControlUsage eWhich = USAGE_ALL)
 {
     RTPrintf("Usage:\n\n");
     doUsage("print version number and exit", g_pszProgName, "[-V|--version]");
@@ -147,6 +149,8 @@ static void usage(enum VBoxControlUsage eWhich = USAGE_ALL)
     if (eWhich == WRITE_CORE_DUMP || eWhich == USAGE_ALL)
         doUsage("", g_pszProgName, "writecoredump");
 #endif
+    if (eWhich == WRITE_LOG || eWhich == USAGE_ALL)
+        doUsage("", g_pszProgName, "writelog [-n|--no-newline] [--] <msg>");
     if (eWhich == TAKE_SNAPSHOT || eWhich == USAGE_ALL)
         doUsage("", g_pszProgName, "takesnapshot");
     if (eWhich == SAVE_STATE || eWhich == USAGE_ALL)
@@ -159,10 +163,25 @@ static void usage(enum VBoxControlUsage eWhich = USAGE_ALL)
         doUsage("[command]", g_pszProgName, "help");
     if (eWhich == VERSION   || eWhich == USAGE_ALL)
         doUsage("", g_pszProgName, "version");
+
+    return RTEXITCODE_SUCCESS;
 }
 
 /** @} */
 
+
+/**
+ * Implementation of the '--version' option.
+ *
+ * @returns RTEXITCODE_SUCCESS
+ */
+static RTEXITCODE printVersion(void)
+{
+    RTPrintf("%sr%u\n", VBOX_VERSION_STRING, RTBldCfgRevision());
+    return RTEXITCODE_SUCCESS;
+}
+
+
 /**
  * Displays an error message.
  *
@@ -172,6 +191,7 @@ static void usage(enum VBoxControlUsage eWhich = USAGE_ALL)
  */
 static RTEXITCODE VBoxControlError(const char *pszFormat, ...)
 {
+    /** @todo prefix with current command. */
     va_list va;
     va_start(va, pszFormat);
     RTMsgErrorV(pszFormat, va);
@@ -181,6 +201,20 @@ static RTEXITCODE VBoxControlError(const char *pszFormat, ...)
 
 
 /**
+ * Displays a getopt error.
+ *
+ * @returns RTEXITCODE_FAILURE.
+ * @param   ch          The RTGetOpt return value.
+ * @param   pValueUnion The RTGetOpt return data.
+ */
+static RTEXITCODE VBoxCtrlGetOptError(int ch, PCRTGETOPTUNION pValueUnion)
+{
+    /** @todo prefix with current command. */
+    return RTGetOptPrintError(ch, pValueUnion);
+}
+
+
+/**
  * Displays an syntax error message.
  *
  * @returns RTEXITCODE_FAILURE.
@@ -189,6 +223,7 @@ static RTEXITCODE VBoxControlError(const char *pszFormat, ...)
  */
 static RTEXITCODE VBoxControlSyntaxError(const char *pszFormat, ...)
 {
+    /** @todo prefix with current command. */
     va_list va;
     va_start(va, pszFormat);
     RTMsgErrorV(pszFormat, va);
@@ -1723,6 +1758,69 @@ static RTEXITCODE handleDpc(int argc, char *argv[])
 
 
 /**
+ * @callback_method_impl{FNVBOXCTRLCMDHANDLER, Command: writelog}
+ */
+static RTEXITCODE handleWriteLog(int argc, char *argv[])
+{
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--no-newline", 'n', RTGETOPT_REQ_NOTHING },
+    };
+    bool fNoNewline = false;
+
+    RTGETOPTSTATE GetOptState;
+    int rc = RTGetOptInit(&GetOptState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions),
+                          0 /*iFirst*/, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    if (RT_SUCCESS(rc))
+    {
+        RTGETOPTUNION   ValueUnion;
+        int             ch;
+        while ((ch = RTGetOpt(&GetOptState, &ValueUnion)) != 0)
+        {
+            switch (ch)
+            {
+                case VINF_GETOPT_NOT_OPTION:
+                {
+                    size_t cch = strlen(ValueUnion.psz);
+                    if (   fNoNewline
+                        || (cch > 0 && ValueUnion.psz[cch - 1] == '\n') )
+                        rc = VbglR3WriteLog(ValueUnion.psz, cch);
+                    else
+                    {
+                        char *pszDup = (char *)RTMemDupEx(ValueUnion.psz, cch, 2);
+                        if (RT_SUCCESS(rc))
+                        {
+                            pszDup[cch++] = '\n';
+                            pszDup[cch]   = '\0';
+                            rc = VbglR3WriteLog(pszDup, cch);
+                            RTMemFree(pszDup);
+                        }
+                        else
+                            rc = VERR_NO_MEMORY;
+                    }
+                    if (RT_FAILURE(rc))
+                        return VBoxControlError("VbglR3WriteLog: %Rrc", rc);
+                    break;
+                }
+
+                case 'n':
+                    fNoNewline = true;
+                    break;
+
+                case 'h': return usage(WRITE_LOG);
+                case 'V': return printVersion();
+                default:
+                    return VBoxCtrlGetOptError(ch, &ValueUnion);
+            }
+        }
+    }
+    else
+        return VBoxControlError("RTGetOptInit: %Rrc", rc);
+    return RTEXITCODE_SUCCESS;
+}
+
+
+/**
  * @callback_method_impl{FNVBOXCTRLCMDHANDLER, Command: takesnapshot}
  */
 static RTEXITCODE handleTakeSnapshot(int argc, char *argv[])
@@ -1765,8 +1863,7 @@ static RTEXITCODE handleVersion(int argc, char *argv[])
 {
     if (argc)
         return VBoxControlSyntaxError("getversion does not take any arguments");
-    RTPrintf("%sr%u\n", VBOX_VERSION_STRING, RTBldCfgRevision());
-    return RTEXITCODE_SUCCESS;
+    return printVersion();
 }
 
 /**
@@ -1812,6 +1909,7 @@ struct COMMANDHANDLER
 #ifdef VBOX_WITH_DPC_LATENCY_CHECKER
     { "dpc",                    handleDpc },
 #endif
+    { "writelog",               handleWriteLog },
     { "takesnapshot",           handleTakeSnapshot },
     { "savestate",              handleSaveState },
     { "suspend",                handleSuspend },
@@ -1857,7 +1955,7 @@ int main(int argc, char **argv)
            )
         {
             /* Print version number, and do nothing else. */
-            RTPrintf("%sr%u\n", VBOX_VERSION_STRING, RTBldCfgRevision());
+            printVersion();
             fOnlyInfo = true;
             fShowLogo = false;
             done = true;
diff --git a/src/VBox/Additions/common/VBoxControl/VBoxControl.rc b/src/VBox/Additions/common/VBoxControl/VBoxControl.rc
index c9d1dd8..0dd2366 100644
--- a/src/VBox/Additions/common/VBoxControl/VBoxControl.rc
+++ b/src/VBox/Additions/common/VBoxControl/VBoxControl.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x2L
-   FILESUBTYPE          0x0L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DLL
+   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox Guest Additions Utility\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxControl\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
          VALUE "OriginalFilename", "VBoxControl.exe\0"
-         VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp b/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp
index 11185a7..adc3e2e 100644
--- a/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp
+++ b/src/VBox/Additions/common/VBoxControl/testcase/tstVBoxControl.cpp
@@ -199,3 +199,10 @@ VBGLR3DECL(int)     VbglR3GuestPropWait(uint32_t u32ClientId,
 }
 
 #endif
+
+VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cch)
+{
+    NOREF(pch); NOREF(cch);
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Additions/common/VBoxGuest/Makefile.kmk b/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
index 1bcc2c0..36eb364 100644
--- a/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
+++ b/src/VBox/Additions/common/VBoxGuest/Makefile.kmk
@@ -86,8 +86,7 @@ if1of ($(KBUILD_TARGET), darwin freebsd haiku $(if $(defined VBOX_WITH_ADDITION_
    VBoxGuest_SOURCES    = VBoxGuest-$(KBUILD_TARGET).c
   endif
   VBoxGuest_SOURCES     += \
-  	VBoxGuest.cpp \
-  	VBoxGuest2.cpp
+  	VBoxGuest.cpp
   ifeq ($(KBUILD_TARGET), win)
    VBoxGuest_SOURCES += \
   	VBoxGuest-$(KBUILD_TARGET)-pnp.cpp \
@@ -136,11 +135,9 @@ if1of ($(KBUILD_TARGET), darwin freebsd haiku $(if $(defined VBOX_WITH_ADDITION_
   	$(PATH_ROOT)/src/VBox/Runtime/include # for the os2ddk
   VBoxGuestLibOs2Hack_SOURCES = \
   	VBoxGuest-os2.cpp \
-  	VBoxGuest.cpp \
-  	VBoxGuest2.cpp
+  	VBoxGuest.cpp
  endif # OS/2
 
- VBoxGuest2.cpp_DEFS    = VBOX_SVN_REV=$(VBOX_SVN_REV)
  VBoxGuest.cpp_DEFS     = VBOX_SVN_REV=$(VBOX_SVN_REV)
 
  ifeq ($(KBUILD_TARGET),win)
@@ -154,7 +151,6 @@ if1of ($(KBUILD_TARGET), darwin freebsd haiku $(if $(defined VBOX_WITH_ADDITION_
   VBoxGuestNT_DEFS    = $(VBoxGuest_DEFS) TARGET_NT4
   VBoxGuestNT_SOURCES = \
   	VBoxGuest.cpp \
-  	VBoxGuest2.cpp \
   	VBoxGuest-$(KBUILD_TARGET).cpp \
   	VBoxGuest-$(KBUILD_TARGET)-legacy.cpp \
   	win/VBoxGuest.rc
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxDev-haiku.c b/src/VBox/Additions/common/VBoxGuest/VBoxDev-haiku.c
index 8216332..1194da0 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxDev-haiku.c
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxDev-haiku.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -112,7 +112,7 @@ static status_t VBoxGuestHaikuOpen(const char *name, uint32 flags, void **cookie
     /*
      * Create a new session.
      */
-    rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
+    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         Log((DRIVER_NAME ":VBoxGuestHaikuOpen success: g_DevExt=%p pSession=%p rc=%d pid=%d\n",&g_DevExt, pSession, rc,(int)RTProcSelf()));
@@ -171,7 +171,7 @@ static status_t VBoxGuestHaikuFree(void *cookie)
      */
     if (VALID_PTR(pSession))
     {
-        VBoxGuestCloseSession(&g_DevExt, pSession);
+        VbgdCommonCloseSession(&g_DevExt, pSession);
         ASMAtomicDecU32(&cUsers);
     }
     else
@@ -254,7 +254,7 @@ static status_t VBoxGuestHaikuIOCtl(void *cookie, uint32 op, void *data, size_t
      * Process the IOCtl.
      */
     size_t cbDataReturned;
-    rc = VBoxGuestCommonIOCtl(op, &g_DevExt, pSession, pvBuf, len, &cbDataReturned);
+    rc = VbgdCommonIoCtl(op, &g_DevExt, pSession, pvBuf, len, &cbDataReturned);
     if (RT_SUCCESS(rc))
     {
         rc = 0;
@@ -275,7 +275,7 @@ static status_t VBoxGuestHaikuIOCtl(void *cookie, uint32 op, void *data, size_t
     }
     else
     {
-        Log((DRIVER_NAME ":VBoxGuestHaikuIOCtl: VBoxGuestCommonIOCtl failed. rc=%d\n", rc));
+        Log((DRIVER_NAME ":VBoxGuestHaikuIOCtl: VbgdCommonIoCtl failed. rc=%d\n", rc));
         rc = EFAULT;
     }
     RTMemTmpFree(pvBuf);
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-darwin.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-darwin.cpp
index 3a5cb79..e473ff0 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-darwin.cpp
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-darwin.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -69,6 +69,21 @@
 #define DEVICE_NAME_USR     "vboxguestu"
 
 
+/** PINFO() - always does printf(). */
+#define PINFO(fmt, args...) \
+    printf(fmt "\n", ## args)
+
+/** PDEBUG() - does printf() with extra debug data on DEBUG build and keep silence on a release one. */
+#if DEBUG
+# define MODULE_NAME "VBoxGuest"
+# define PDEBUG(fmt, args...) \
+  do { \
+      printf(MODULE_NAME ": DEBUG: %s:%d %s(): " fmt "\n", __FILE__, __LINE__, __FUNCTION__, ## args); \
+  } while (0)
+#else
+# define PDEBUG(fmt, args...) do {} while (0)
+#endif
+
 
 /*******************************************************************************
 *   Internal Functions                                                         *
@@ -110,10 +125,14 @@ private:
     bool disableVmmDevInterrupts(void);
     bool isVmmDev(IOPCIDevice *pIOPCIDevice);
 
+protected:
+    IOWorkLoop                *m_pWorkLoop;
+
 public:
     virtual bool start(IOService *pProvider);
     virtual void stop(IOService *pProvider);
     virtual bool terminate(IOOptionBits fOptions);
+    IOWorkLoop * getWorkLoop();
 };
 
 OSDefineMetaClassAndStructors(org_virtualbox_VBoxGuest, IOService);
@@ -209,6 +228,13 @@ static bool volatile        g_fInstantiated     = 0;
 /** The notifier handle for the sleep callback handler. */
 static IONotifier          *g_pSleepNotifier    = NULL;
 
+/* States of atimic variable aimed to protect dynamic object allocation in SMP environment. */
+#define VBOXGUEST_OBJECT_UNINITIALIZED  (0)
+#define VBOXGUEST_OBJECT_INITIALIZING   (1)
+#define VBOXGUEST_OBJECT_INITIALIZED    (2)
+#define VBOXGUEST_OBJECT_INVALID        (3)
+/** Atomic variable used to protect work loop allocation when multiple threads attempt to obtain it. */
+static uint8_t volatile     g_fWorkLoopCreated  = VBOXGUEST_OBJECT_UNINITIALIZED;
 
 
 /**
@@ -216,20 +242,18 @@ static IONotifier          *g_pSleepNotifier    = NULL;
  */
 static kern_return_t    VbgdDarwinStart(struct kmod_info *pKModInfo, void *pvData)
 {
-#ifdef DEBUG
-    printf("VbgdDarwinStart\n");
-#endif
-
     /*
      * Initialize IPRT.
      */
     int rc = RTR0Init(0);
     if (RT_FAILURE(rc))
     {
-        printf("VBoxGuest: RTR0Init failed with rc=%d\n", rc);
+        PDEBUG("VBoxGuest: RTR0Init failed with rc=%d\n", rc);
         return KMOD_RETURN_FAILURE;
     }
 
+    PDEBUG("VBoxGuest: driver loaded\n");
+
     return KMOD_RETURN_SUCCESS;
 }
 
@@ -279,9 +303,9 @@ static int VbgdDarwinCharDevInit(void)
 static kern_return_t VbgdDarwinStop(struct kmod_info *pKModInfo, void *pvData)
 {
     RTR0TermForced();
-#ifdef DEBUG
-    printf("VbgdDarwinStop - done\n");
-#endif
+
+    PDEBUG("VBoxGuest: driver unloaded\n");
+
     return KMOD_RETURN_SUCCESS;
 }
 
@@ -429,7 +453,7 @@ static int VbgdDarwinIOCtl(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags, st
      */
     RTSpinlockAcquire(g_Spinlock);
     pSession = g_apSessionHashTab[iHash];
-    while (pSession && pSession->Process != Process /*later: && pSession->fUnrestricted == fUnrestricted*/ && pSession->fOpened)
+    while (pSession && pSession->Process != Process && (/*later: pSession->fUnrestricted != fUnrestricted ||*/  !pSession->fOpened))
         pSession = pSession->pNextHash;
     RTSpinlockRelease(g_Spinlock);
     if (!pSession)
@@ -535,7 +559,7 @@ static int VbgdDarwinIOCtlSlow(PVBOXGUESTSESSION pSession, u_long iCmd, caddr_t
      * Process the IOCtl.
      */
     size_t cbReqRet = 0;
-    int rc = VBoxGuestCommonIOCtl(iCmd, &g_DevExt, pSession, pvReqData, cbReq, &cbReqRet);
+    int rc = VbgdCommonIoCtl(iCmd, &g_DevExt, pSession, pvReqData, cbReq, &cbReqRet);
     if (RT_SUCCESS(rc))
     {
         /*
@@ -592,7 +616,7 @@ static int VbgdDarwinIOCtlSlow(PVBOXGUESTSESSION pSession, u_long iCmd, caddr_t
 #include "VBoxGuestIDC-unix.c.h"
 
 
-void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
+void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 {
     NOREF(pDevExt);
 }
@@ -648,29 +672,73 @@ static int VbgdDarwinErr2DarwinErr(int rc)
  *
  */
 
+
+IOWorkLoop *
+org_virtualbox_VBoxGuest::getWorkLoop()
+{
+    /* Handle the case when work loop was not created yet */
+    if(ASMAtomicCmpXchgU8(&g_fWorkLoopCreated, VBOXGUEST_OBJECT_INITIALIZING, VBOXGUEST_OBJECT_UNINITIALIZED))
+    {
+        m_pWorkLoop = IOWorkLoop::workLoop();
+        if (m_pWorkLoop)
+        {
+            /* Notify the rest of threads about the fact that work
+             * loop was successully allocated and can be safely used */
+            PDEBUG("created new work loop\n");
+            ASMAtomicWriteU8(&g_fWorkLoopCreated, VBOXGUEST_OBJECT_INITIALIZED);
+        }
+        else
+        {
+            /* Notify the rest of threads about the fact that there was
+             * an error during allocation of a work loop */
+            PDEBUG("unable new work loop\n");
+            ASMAtomicWriteU8(&g_fWorkLoopCreated, VBOXGUEST_OBJECT_UNINITIALIZED);
+        }
+    }
+    else
+    {
+        /* Handle the case when work loop is currently being
+         * created or it was previously failed to create */
+        uint8_t fWorkLoopCreated = VBOXGUEST_OBJECT_INVALID;
+        while (fWorkLoopCreated != VBOXGUEST_OBJECT_INITIALIZED
+            && fWorkLoopCreated != VBOXGUEST_OBJECT_UNINITIALIZED)
+        {
+            fWorkLoopCreated = ASMAtomicReadU8(&g_fWorkLoopCreated);
+            thread_block(0);
+        }
+        if (fWorkLoopCreated == VBOXGUEST_OBJECT_INITIALIZED)
+            PDEBUG("returned existing work loop");
+        else
+            PDEBUG("work loop was not allocated correctly");
+    }
+
+    return m_pWorkLoop;
+}
+
+
 /**
- * Just a plug
+ * Perform pending wake ups in work loop context.
  */
 static void
-interruptHandler(OSObject *pOwner, IOInterruptEventSource *pSrc, int cInts)
+deferredInterruptHandler(OSObject *pOwner, IOInterruptEventSource *pSrc, int cInts)
 {
-    NOREF(pOwner);
-    NOREF(pSrc);
-    NOREF(cInts);
+    NOREF(pOwner); NOREF(pSrc); NOREF(cInts);
+
+    VbgdCommonWaitDoWakeUps(&g_DevExt);
 }
 
 /**
  * Callback triggered when interrupt occurs.
  */
 static bool
-checkForInterrupt(OSObject *pOwner, IOFilterInterruptEventSource *pSrc)
+directInterruptHandler(OSObject *pOwner, IOFilterInterruptEventSource *pSrc)
 {
     if (!pSrc)
         return false;
 
-    bool fTaken = VBoxGuestCommonISR(&g_DevExt);
-    if (!fTaken)
-        printf("VBoxGuestCommonISR error\n");
+    bool fTaken = VbgdCommonISR(&g_DevExt);
+    if (!fTaken) /** @todo r=bird: This looks bogus as we might actually be sharing interrupts with someone. */
+        PDEBUG("VbgdCommonISR error\n");
 
     return fTaken;
 }
@@ -678,14 +746,14 @@ checkForInterrupt(OSObject *pOwner, IOFilterInterruptEventSource *pSrc)
 bool
 org_virtualbox_VBoxGuest::setupVmmDevInterrupts(IOService *pProvider)
 {
-    IOWorkLoop *pWorkLoop = (IOWorkLoop *)getWorkLoop();
+    IOWorkLoop *pWorkLoop = getWorkLoop();
 
     if (!pWorkLoop)
         return false;
 
     m_pInterruptSrc = IOFilterInterruptEventSource::filterInterruptEventSource(this,
-                                                                               &interruptHandler,
-                                                                               &checkForInterrupt,
+                                                                               &deferredInterruptHandler,
+                                                                               &directInterruptHandler,
                                                                                pProvider);
 
     if (kIOReturnSuccess != pWorkLoop->addEventSource(m_pInterruptSrc))
@@ -779,16 +847,16 @@ bool org_virtualbox_VBoxGuest::start(IOService *pProvider)
                         cbMMIO     = m_pMap->getLength();
                     }
 
-                    int rc = VBoxGuestInitDevExt(&g_DevExt,
-                                                 IOPortBase,
-                                                 pvMMIOBase,
-                                                 cbMMIO,
+                    int rc = VbgdCommonInitDevExt(&g_DevExt,
+                                                  IOPortBase,
+                                                  pvMMIOBase,
+                                                  cbMMIO,
 #if ARCH_BITS == 64
-                                                 VBOXOSTYPE_MacOS_x64,
+                                                  VBOXOSTYPE_MacOS_x64,
 #else
-                                                 VBOXOSTYPE_MacOS,
+                                                  VBOXOSTYPE_MacOS,
 #endif
-                                                 0);
+                                                  0);
                     if (RT_SUCCESS(rc))
                     {
                         rc = VbgdDarwinCharDevInit();
@@ -798,7 +866,7 @@ bool org_virtualbox_VBoxGuest::start(IOService *pProvider)
                             {
                                 /* register the service. */
                                 registerService();
-                                LogRel(("VBoxGuest: Successfully started I/O kit class instance.\n"));
+                                LogRel(("VBoxGuest: IOService started\n"));
                                 return true;
                             }
 
@@ -808,7 +876,7 @@ bool org_virtualbox_VBoxGuest::start(IOService *pProvider)
                         else
                             LogRel(("VBoxGuest: Failed to initialize character device (rc=%d).\n", rc));
 
-                        VBoxGuestDeleteDevExt(&g_DevExt);
+                        VbgdCommonDeleteDevExt(&g_DevExt);
                     }
                     else
                         LogRel(("VBoxGuest: Failed to initialize common code (rc=%d).\n", rc));
@@ -843,16 +911,18 @@ bool org_virtualbox_VBoxGuest::start(IOService *pProvider)
  */
 void org_virtualbox_VBoxGuest::stop(IOService *pProvider)
 {
-    LogFlow(("org_virtualbox_VBoxGuest::stop([%p], %p)\n", this, pProvider));
+    /* Do not use Log*() here (in IOService instance) because its instance
+     * already terminated in BSD's module unload callback! */
+    PDEBUG("org_virtualbox_VBoxGuest::stop([%p], %p)\n", this, pProvider);
 
     AssertReturnVoid(ASMAtomicReadBool(&g_fInstantiated));
 
     /* Low level termination should be performed only once */
     if (!disableVmmDevInterrupts())
-        LogRel(("vboxguest: unable to unregister interrupt handler\n"));
+        PDEBUG("VBoxGuest: unable to unregister interrupt handler\n");
 
     VbgdDarwinCharDevRemove();
-    VBoxGuestDeleteDevExt(&g_DevExt);
+    VbgdCommonDeleteDevExt(&g_DevExt);
 
     if (m_pMap)
     {
@@ -864,7 +934,7 @@ void org_virtualbox_VBoxGuest::stop(IOService *pProvider)
 
     ASMAtomicWriteBool(&g_fInstantiated, false);
 
-    LogRel(("vboxguest module unloaded\n"));
+    PINFO("VBoxGuest: IOService stopped\n");
 }
 
 
@@ -876,15 +946,18 @@ void org_virtualbox_VBoxGuest::stop(IOService *pProvider)
  */
 bool org_virtualbox_VBoxGuest::terminate(IOOptionBits fOptions)
 {
+    /* Do not use Log*() here (in IOService instance) because its instance
+     * already terminated in BSD's module unload callback! */
+
     bool fRc;
-    LogFlow(("org_virtualbox_VBoxGuest::terminate: reference_count=%d g_cSessions=%d (fOptions=%#x)\n",
-             KMOD_INFO_NAME.reference_count, ASMAtomicUoReadS32(&g_cSessions), fOptions));
+    PDEBUG("org_virtualbox_VBoxGuest::terminate: reference_count=%d g_cSessions=%d (fOptions=%#x)\n",
+             KMOD_INFO_NAME.reference_count, ASMAtomicUoReadS32(&g_cSessions), fOptions);
     if (    KMOD_INFO_NAME.reference_count != 0
         ||  ASMAtomicUoReadS32(&g_cSessions))
         fRc = false;
     else
         fRc = IOService::terminate(fOptions);
-    LogFlow(("org_virtualbox_SupDrv::terminate: returns %d\n", fRc));
+    PDEBUG("org_virtualbox_SupDrv::terminate: returns %d\n", fRc);
     return fRc;
 }
 
@@ -946,7 +1019,7 @@ bool org_virtualbox_VBoxGuestClient::start(IOService *pProvider)
             /*
              * Create a new session.
              */
-            int rc = VBoxGuestCreateUserSession(&g_DevExt, &m_pSession);
+            int rc = VbgdCommonCreateUserSession(&g_DevExt, &m_pSession);
             if (RT_SUCCESS(rc))
             {
                 m_pSession->fOpened = false;
@@ -984,7 +1057,7 @@ bool org_virtualbox_VBoxGuestClient::start(IOService *pProvider)
                 }
 
                 LogFlow(("org_virtualbox_VBoxGuestClient::start: already got a session for this process (%p)\n", pCur));
-                VBoxGuestCloseSession(&g_DevExt, m_pSession);
+                VbgdCommonCloseSession(&g_DevExt, m_pSession);
             }
 
             m_pSession = NULL;
@@ -1060,7 +1133,7 @@ bool org_virtualbox_VBoxGuestClient::start(IOService *pProvider)
     /*
      * Close the session.
      */
-    VBoxGuestCloseSession(&g_DevExt, pSession);
+    VbgdCommonCloseSession(&g_DevExt, pSession);
 }
 
 
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c
index 1552f71..eb2e392 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2007-2011 Oracle Corporation
+ * Copyright (C) 2007-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -219,7 +219,7 @@ static int VBoxGuestFreeBSDOpen(struct cdev *pDev, int fOpen, struct thread *pTd
     /*
      * Create a new session.
      */
-    rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
+    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         if (ASMAtomicCmpXchgPtr(&pDev->si_drv1, pSession, (void *)0x42))
@@ -229,7 +229,7 @@ static int VBoxGuestFreeBSDOpen(struct cdev *pDev, int fOpen, struct thread *pTd
             return 0;
         }
 
-        VBoxGuestCloseSession(&g_DevExt, pSession);
+        VbgdCommonCloseSession(&g_DevExt, pSession);
     }
 
     LogRel((DEVICE_NAME ":VBoxGuestFreeBSDOpen: failed. rc=%d\n", rc));
@@ -250,7 +250,7 @@ static int VBoxGuestFreeBSDClose(struct cdev *pDev, int fFile, int DevType, stru
      */
     if (VALID_PTR(pSession))
     {
-        VBoxGuestCloseSession(&g_DevExt, pSession);
+        VbgdCommonCloseSession(&g_DevExt, pSession);
         if (!ASMAtomicCmpXchgPtr(&pDev->si_drv1, NULL, pSession))
             Log(("VBoxGuestFreeBSDClose: si_drv1=%p expected %p!\n", pDev->si_drv1, pSession));
         ASMAtomicDecU32(&cUsers);
@@ -331,7 +331,7 @@ static int VBoxGuestFreeBSDIOCtl(struct cdev *pDev, u_long ulCmd, caddr_t pvData
      * Process the IOCtl.
      */
     size_t cbDataReturned;
-    rc = VBoxGuestCommonIOCtl(ulCmd, &g_DevExt, pSession, pvBuf, ReqWrap->cbData, &cbDataReturned);
+    rc = VbgdCommonIoCtl(ulCmd, &g_DevExt, pSession, pvBuf, ReqWrap->cbData, &cbDataReturned);
     if (RT_SUCCESS(rc))
     {
         rc = 0;
@@ -352,7 +352,7 @@ static int VBoxGuestFreeBSDIOCtl(struct cdev *pDev, u_long ulCmd, caddr_t pvData
     }
     else
     {
-        Log((DEVICE_NAME ":VBoxGuestFreeBSDIOCtl: VBoxGuestCommonIOCtl failed. rc=%d\n", rc));
+        Log((DEVICE_NAME ":VBoxGuestFreeBSDIOCtl: VbgdCommonIoCtl failed. rc=%d\n", rc));
         rc = EFAULT;
     }
     RTMemTmpFree(pvBuf);
@@ -419,7 +419,7 @@ static int VBoxGuestFreeBSDDetach(device_t pDevice)
     if (pState->pIOPortRes)
         bus_release_resource(pDevice, SYS_RES_IOPORT, pState->iIOPortResId, pState->pIOPortRes);
 
-    VBoxGuestDeleteDevExt(&g_DevExt);
+    VbgdCommonDeleteDevExt(&g_DevExt);
 
     RTR0Term();
 
@@ -436,12 +436,12 @@ static int VBoxGuestFreeBSDISR(void *pvState)
 {
     LogFlow((DEVICE_NAME ":VBoxGuestFreeBSDISR pvState=%p\n", pvState));
 
-    bool fOurIRQ = VBoxGuestCommonISR(&g_DevExt);
+    bool fOurIRQ = VbgdCommonISR(&g_DevExt);
 
     return fOurIRQ ? 0 : 1;
 }
 
-void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
+void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 {
     LogFlow((DEVICE_NAME "::NativeISRMousePollEvent:\n"));
 
@@ -545,14 +545,14 @@ static int VBoxGuestFreeBSDAttach(device_t pDevice)
             /*
              * Call the common device extension initializer.
              */
-            rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase,
-                                     pState->pMMIOBase, pState->VMMDevMemSize,
+            rc = VbgdCommonInitDevExt(&g_DevExt, pState->uIOPortBase,
+                                      pState->pMMIOBase, pState->VMMDevMemSize,
 #if ARCH_BITS == 64
-                                     VBOXOSTYPE_FreeBSD_x64,
+                                      VBOXOSTYPE_FreeBSD_x64,
 #else
-                                     VBOXOSTYPE_FreeBSD,
+                                      VBOXOSTYPE_FreeBSD,
 #endif
-                                     VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
+                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
             if (RT_SUCCESS(rc))
             {
                 /*
@@ -577,8 +577,8 @@ static int VBoxGuestFreeBSDAttach(device_t pDevice)
                     VBoxGuestFreeBSDRemoveIRQ(pDevice, pState);
                 }
                 else
-                    printf((DEVICE_NAME ":VBoxGuestInitDevExt failed.\n"));
-                VBoxGuestDeleteDevExt(&g_DevExt);
+                    printf((DEVICE_NAME ":VbgdCommonInitDevExt failed.\n"));
+                VbgdCommonDeleteDevExt(&g_DevExt);
             }
             else
                 printf((DEVICE_NAME ":VBoxGuestFreeBSDAddIRQ failed.\n"));
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku-stubs.c b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku-stubs.c
index ee2b9e3..e802e02 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku-stubs.c
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku-stubs.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2014 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,7 +20,7 @@
  *
  * VirtualBox Guest Additions for Haiku.
  * Copyright (c) 2011 Mike Smith <mike at scgtrp.net>
- *                    Fran�ois Revol <revol at free.fr>
+ *                    François Revol <revol at free.fr>
  *
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
@@ -67,7 +67,7 @@
 
 struct vboxguest_module_info *g_VBoxGuest;
 
-size_t RTLogBackdoorPrintf(const char *pszFormat, ...)
+RTDECL(size_t) RTLogBackdoorPrintf(const char *pszFormat, ...)
 {
     va_list args;
     size_t cb;
@@ -78,277 +78,277 @@ size_t RTLogBackdoorPrintf(const char *pszFormat, ...)
 
     return cb;
 }
-size_t RTLogBackdoorPrintfV(const char *pszFormat, va_list args)
+RTDECL(size_t) RTLogBackdoorPrintfV(const char *pszFormat, va_list args)
 {
     return g_VBoxGuest->_RTLogBackdoorPrintfV(pszFormat, args);
 }
-int RTLogSetDefaultInstanceThread(PRTLOGGER pLogger, uintptr_t uKey)
+RTDECL(int) RTLogSetDefaultInstanceThread(PRTLOGGER pLogger, uintptr_t uKey)
 {
     return g_VBoxGuest->_RTLogSetDefaultInstanceThread(pLogger, uKey);
 }
-int RTMemAllocExTag(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv)
+RTDECL(int) RTMemAllocExTag(size_t cb, size_t cbAlignment, uint32_t fFlags, const char *pszTag, void **ppv)
 {
     return g_VBoxGuest->_RTMemAllocExTag(cb, cbAlignment, fFlags, pszTag, ppv);
 }
-void* RTMemContAlloc(PRTCCPHYS pPhys, size_t cb)
+RTR0DECL(void*) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb)
 {
     return g_VBoxGuest->_RTMemContAlloc(pPhys, cb);
 }
-void RTMemContFree(void *pv, size_t cb)
+RTR0DECL(void) RTMemContFree(void *pv, size_t cb)
 {
     g_VBoxGuest->_RTMemContFree(pv, cb);
 }
-void RTMemFreeEx(void *pv, size_t cb)
+RTDECL(void) RTMemFreeEx(void *pv, size_t cb)
 {
     g_VBoxGuest->_RTMemFreeEx(pv, cb);
 }
-bool RTMpIsCpuPossible(RTCPUID idCpu)
+RTDECL(bool) RTMpIsCpuPossible(RTCPUID idCpu)
 {
     return g_VBoxGuest->_RTMpIsCpuPossible(idCpu);
 }
-int RTMpNotificationDeregister(PFNRTMPNOTIFICATION pfnCallback, void *pvUser)
+RTDECL(int) RTMpNotificationDeregister(PFNRTMPNOTIFICATION pfnCallback, void *pvUser)
 {
     return g_VBoxGuest->_RTMpNotificationDeregister(pfnCallback, pvUser);
 }
-int RTMpNotificationRegister(PFNRTMPNOTIFICATION pfnCallback, void *pvUser)
+RTDECL(int) RTMpNotificationRegister(PFNRTMPNOTIFICATION pfnCallback, void *pvUser)
 {
     return g_VBoxGuest->_RTMpNotificationRegister(pfnCallback, pvUser);
 }
-int RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
     return g_VBoxGuest->_RTMpOnAll(pfnWorker, pvUser1, pvUser2);
 }
-int RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
     return g_VBoxGuest->_RTMpOnOthers(pfnWorker, pvUser1, pvUser2);
 }
-int RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
     return g_VBoxGuest->_RTMpOnSpecific(idCpu, pfnWorker, pvUser1, pvUser2);
 }
-int RTPowerNotificationDeregister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser)
+RTDECL(int) RTPowerNotificationDeregister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser)
 {
     return g_VBoxGuest->_RTPowerNotificationDeregister(pfnCallback, pvUser);
 }
-int RTPowerNotificationRegister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser)
+RTDECL(int) RTPowerNotificationRegister(PFNRTPOWERNOTIFICATION pfnCallback, void *pvUser)
 {
     return g_VBoxGuest->_RTPowerNotificationRegister(pfnCallback, pvUser);
 }
-int RTPowerSignalEvent(RTPOWEREVENT enmEvent)
+RTDECL(int) RTPowerSignalEvent(RTPOWEREVENT enmEvent)
 {
     return g_VBoxGuest->_RTPowerSignalEvent(enmEvent);
 }
-void RTR0AssertPanicSystem(void)
+RTR0DECL(void) RTR0AssertPanicSystem(void)
 {
     g_VBoxGuest->_RTR0AssertPanicSystem();
 }
-int RTR0Init(unsigned fReserved)
+RTR0DECL(int) RTR0Init(unsigned fReserved)
 {
     return g_VBoxGuest->_RTR0Init(fReserved);
 }
-void* RTR0MemObjAddress(RTR0MEMOBJ MemObj)
+RTR0DECL(void*) RTR0MemObjAddress(RTR0MEMOBJ MemObj)
 {
     return g_VBoxGuest->_RTR0MemObjAddress(MemObj);
 }
-RTR3PTR RTR0MemObjAddressR3(RTR0MEMOBJ MemObj)
+RTR0DECL(RTR3PTR) RTR0MemObjAddressR3(RTR0MEMOBJ MemObj)
 {
     return g_VBoxGuest->_RTR0MemObjAddressR3(MemObj);
 }
-int RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
+RTR0DECL(int) RTR0MemObjAllocContTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjAllocContTag(pMemObj, cb, fExecutable, pszTag);
 }
-int RTR0MemObjAllocLowTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
+RTR0DECL(int) RTR0MemObjAllocLowTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjAllocLowTag(pMemObj, cb, fExecutable, pszTag);
 }
-int RTR0MemObjAllocPageTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
+RTR0DECL(int) RTR0MemObjAllocPageTag(PRTR0MEMOBJ pMemObj, size_t cb, bool fExecutable, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjAllocPageTag(pMemObj, cb, fExecutable, pszTag);
 }
-int RTR0MemObjAllocPhysExTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment, const char *pszTag)
+RTR0DECL(int) RTR0MemObjAllocPhysExTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjAllocPhysExTag(pMemObj, cb, PhysHighest, uAlignment, pszTag);
 }
-int RTR0MemObjAllocPhysNCTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag)
+RTR0DECL(int) RTR0MemObjAllocPhysNCTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjAllocPhysNCTag(pMemObj, cb, PhysHighest, pszTag);
 }
-int RTR0MemObjAllocPhysTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag)
+RTR0DECL(int) RTR0MemObjAllocPhysTag(PRTR0MEMOBJ pMemObj, size_t cb, RTHCPHYS PhysHighest, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjAllocPhysTag(pMemObj, cb, PhysHighest, pszTag);
 }
-int RTR0MemObjEnterPhysTag(PRTR0MEMOBJ pMemObj, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy, const char *pszTag)
+RTR0DECL(int) RTR0MemObjEnterPhysTag(PRTR0MEMOBJ pMemObj, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjEnterPhysTag(pMemObj, Phys, cb, uCachePolicy, pszTag);
 }
-int RTR0MemObjFree(RTR0MEMOBJ MemObj, bool fFreeMappings)
+RTR0DECL(int) RTR0MemObjFree(RTR0MEMOBJ MemObj, bool fFreeMappings)
 {
     return g_VBoxGuest->_RTR0MemObjFree(MemObj, fFreeMappings);
 }
-RTHCPHYS RTR0MemObjGetPagePhysAddr(RTR0MEMOBJ MemObj, size_t iPage)
+RTR0DECL(RTHCPHYS) RTR0MemObjGetPagePhysAddr(RTR0MEMOBJ MemObj, size_t iPage)
 {
     return g_VBoxGuest->_RTR0MemObjGetPagePhysAddr(MemObj, iPage);
 }
-bool RTR0MemObjIsMapping(RTR0MEMOBJ MemObj)
+RTR0DECL(bool) RTR0MemObjIsMapping(RTR0MEMOBJ MemObj)
 {
     return g_VBoxGuest->_RTR0MemObjIsMapping(MemObj);
 }
-int RTR0MemObjLockKernelTag(PRTR0MEMOBJ pMemObj, void *pv, size_t cb, uint32_t fAccess, const char *pszTag)
+RTR0DECL(int) RTR0MemObjLockKernelTag(PRTR0MEMOBJ pMemObj, void *pv, size_t cb, uint32_t fAccess, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjLockKernelTag(pMemObj, pv, cb, fAccess, pszTag);
 }
-int RTR0MemObjLockUserTag(PRTR0MEMOBJ pMemObj, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process, const char *pszTag)
+RTR0DECL(int) RTR0MemObjLockUserTag(PRTR0MEMOBJ pMemObj, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjLockUserTag(pMemObj, R3Ptr, cb, fAccess, R0Process, pszTag);
 }
-int RTR0MemObjMapKernelExTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt, size_t offSub, size_t cbSub, const char *pszTag)
+RTR0DECL(int) RTR0MemObjMapKernelExTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt, size_t offSub, size_t cbSub, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjMapKernelExTag(pMemObj, MemObjToMap, pvFixed, uAlignment, fProt, offSub, cbSub, pszTag);
 }
-int RTR0MemObjMapKernelTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt, const char *pszTag)
+RTR0DECL(int) RTR0MemObjMapKernelTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, void *pvFixed, size_t uAlignment, unsigned fProt, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjMapKernelTag(pMemObj, MemObjToMap, pvFixed, uAlignment, fProt, pszTag);
 }
-int RTR0MemObjMapUserTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process, const char *pszTag)
+RTR0DECL(int) RTR0MemObjMapUserTag(PRTR0MEMOBJ pMemObj, RTR0MEMOBJ MemObjToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjMapUserTag(pMemObj, MemObjToMap, R3PtrFixed, uAlignment, fProt, R0Process, pszTag);
 }
-int RTR0MemObjProtect(RTR0MEMOBJ hMemObj, size_t offSub, size_t cbSub, uint32_t fProt)
+RTR0DECL(int) RTR0MemObjProtect(RTR0MEMOBJ hMemObj, size_t offSub, size_t cbSub, uint32_t fProt)
 {
     return g_VBoxGuest->_RTR0MemObjProtect(hMemObj, offSub, cbSub, fProt);
 }
-int RTR0MemObjReserveKernelTag(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment, const char *pszTag)
+RTR0DECL(int) RTR0MemObjReserveKernelTag(PRTR0MEMOBJ pMemObj, void *pvFixed, size_t cb, size_t uAlignment, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjReserveKernelTag(pMemObj, pvFixed, cb, uAlignment, pszTag);
 }
-int RTR0MemObjReserveUserTag(PRTR0MEMOBJ pMemObj, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process, const char *pszTag)
+RTR0DECL(int) RTR0MemObjReserveUserTag(PRTR0MEMOBJ pMemObj, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process, const char *pszTag)
 {
     return g_VBoxGuest->_RTR0MemObjReserveUserTag(pMemObj, R3PtrFixed, cb, uAlignment, R0Process, pszTag);
 }
-size_t RTR0MemObjSize(RTR0MEMOBJ MemObj)
+RTR0DECL(size_t) RTR0MemObjSize(RTR0MEMOBJ MemObj)
 {
     return g_VBoxGuest->_RTR0MemObjSize(MemObj);
 }
-RTR0PROCESS RTR0ProcHandleSelf(void)
+RTR0DECL(RTR0PROCESS) RTR0ProcHandleSelf(void)
 {
     return g_VBoxGuest->_RTR0ProcHandleSelf();
 }
-void RTR0Term(void)
+RTR0DECL(void) RTR0Term(void)
 {
     g_VBoxGuest->_RTR0Term();
 }
-void RTR0TermForced(void)
+RTR0DECL(void) RTR0TermForced(void)
 {
     g_VBoxGuest->_RTR0TermForced();
 }
-RTPROCESS RTProcSelf(void)
+RTDECL(RTPROCESS) RTProcSelf(void)
 {
     return g_VBoxGuest->_RTProcSelf();
 }
-uint32_t RTSemEventGetResolution(void)
+RTDECL(uint32_t) RTSemEventGetResolution(void)
 {
     return g_VBoxGuest->_RTSemEventGetResolution();
 }
-uint32_t RTSemEventMultiGetResolution(void)
+RTDECL(uint32_t) RTSemEventMultiGetResolution(void)
 {
     return g_VBoxGuest->_RTSemEventMultiGetResolution();
 }
-int RTSemEventMultiWaitEx(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout)
+RTDECL(int) RTSemEventMultiWaitEx(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout)
 {
     return g_VBoxGuest->_RTSemEventMultiWaitEx(hEventMultiSem, fFlags, uTimeout);
 }
-int RTSemEventMultiWaitExDebug(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout, RTHCUINTPTR uId, RT_SRC_POS_DECL)
+RTDECL(int) RTSemEventMultiWaitExDebug(RTSEMEVENTMULTI hEventMultiSem, uint32_t fFlags, uint64_t uTimeout, RTHCUINTPTR uId, RT_SRC_POS_DECL)
 {
     return g_VBoxGuest->_RTSemEventMultiWaitExDebug(hEventMultiSem, fFlags, uTimeout, uId, pszFile, iLine, pszFunction);
 }
-int RTSemEventWaitEx(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout)
+RTDECL(int) RTSemEventWaitEx(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout)
 {
     return g_VBoxGuest->_RTSemEventWaitEx(hEventSem, fFlags, uTimeout);
 }
-int RTSemEventWaitExDebug(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout, RTHCUINTPTR uId, RT_SRC_POS_DECL)
+RTDECL(int) RTSemEventWaitExDebug(RTSEMEVENT hEventSem, uint32_t fFlags, uint64_t uTimeout, RTHCUINTPTR uId, RT_SRC_POS_DECL)
 {
     return g_VBoxGuest->_RTSemEventWaitExDebug(hEventSem, fFlags, uTimeout, uId, pszFile, iLine, pszFunction);
 }
-bool RTThreadIsInInterrupt(RTTHREAD hThread)
+RTDECL(bool) RTThreadIsInInterrupt(RTTHREAD hThread)
 {
     return g_VBoxGuest->_RTThreadIsInInterrupt(hThread);
 }
-void RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState)
+RTDECL(void) RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState)
 {
     g_VBoxGuest->_RTThreadPreemptDisable(pState);
 }
-bool RTThreadPreemptIsEnabled(RTTHREAD hThread)
+RTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread)
 {
     return g_VBoxGuest->_RTThreadPreemptIsEnabled(hThread);
 }
-bool RTThreadPreemptIsPending(RTTHREAD hThread)
+RTDECL(bool) RTThreadPreemptIsPending(RTTHREAD hThread)
 {
     return g_VBoxGuest->_RTThreadPreemptIsPending(hThread);
 }
-bool RTThreadPreemptIsPendingTrusty(void)
+RTDECL(bool) RTThreadPreemptIsPendingTrusty(void)
 {
     return g_VBoxGuest->_RTThreadPreemptIsPendingTrusty();
 }
-bool RTThreadPreemptIsPossible(void)
+RTDECL(bool) RTThreadPreemptIsPossible(void)
 {
     return g_VBoxGuest->_RTThreadPreemptIsPossible();
 }
-void RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState)
+RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState)
 {
     g_VBoxGuest->_RTThreadPreemptRestore(pState);
 }
-uint32_t RTTimerGetSystemGranularity(void)
+RTDECL(uint32_t) RTTimerGetSystemGranularity(void)
 {
     return g_VBoxGuest->_RTTimerGetSystemGranularity();
 }
-int RTTimerReleaseSystemGranularity(uint32_t u32Granted)
+RTDECL(int) RTTimerReleaseSystemGranularity(uint32_t u32Granted)
 {
     return g_VBoxGuest->_RTTimerReleaseSystemGranularity(u32Granted);
 }
-int RTTimerRequestSystemGranularity(uint32_t u32Request, uint32_t *pu32Granted)
+RTDECL(int) RTTimerRequestSystemGranularity(uint32_t u32Request, uint32_t *pu32Granted)
 {
     return g_VBoxGuest->_RTTimerRequestSystemGranularity(u32Request, pu32Granted);
 }
-void RTSpinlockAcquire(RTSPINLOCK Spinlock)
+RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)
 {
     g_VBoxGuest->_RTSpinlockAcquire(Spinlock);
 }
-void RTSpinlockRelease(RTSPINLOCK Spinlock)
+RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
 {
     g_VBoxGuest->_RTSpinlockRelease(Spinlock);
 }
-void* RTMemTmpAllocTag(size_t cb, const char *pszTag)
+RTDECL(void*) RTMemTmpAllocTag(size_t cb, const char *pszTag)
 {
     return g_VBoxGuest->_RTMemTmpAllocTag(cb, pszTag);
 }
-void RTMemTmpFree(void *pv)
+RTDECL(void) RTMemTmpFree(void *pv)
 {
     g_VBoxGuest->_RTMemTmpFree(pv);
 }
-PRTLOGGER RTLogDefaultInstance(void)
+RTDECL(PRTLOGGER) RTLogDefaultInstance(void)
 {
     return g_VBoxGuest->_RTLogDefaultInstance();
 }
-PRTLOGGER RTLogRelDefaultInstance(void)
+RTDECL(PRTLOGGER) RTLogRelDefaultInstance(void)
 {
     return g_VBoxGuest->_RTLogRelDefaultInstance();
 }
-int RTErrConvertToErrno(int iErr)
+RTDECL(int) RTErrConvertToErrno(int iErr)
 {
     return g_VBoxGuest->_RTErrConvertToErrno(iErr);
 }
-int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, void *pvData, size_t cbData, size_t *pcbDataReturned)
+int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, void *pvData, size_t cbData, size_t *pcbDataReturned)
 {
-    return g_VBoxGuest->_VBoxGuestCommonIOCtl(iFunction, pDevExt, pSession, pvData, cbData, pcbDataReturned);
+    return g_VBoxGuest->_VbgdCommonIoCtl(iFunction, pDevExt, pSession, pvData, cbData, pcbDataReturned);
 }
-int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
+int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
 {
-    return g_VBoxGuest->_VBoxGuestCreateUserSession(pDevExt, ppSession);
+    return g_VBoxGuest->_VbgdCommonCreateUserSession(pDevExt, ppSession);
 }
-void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
-    g_VBoxGuest->_VBoxGuestCloseSession(pDevExt, pSession);
+    g_VBoxGuest->_VbgdCommonCloseSession(pDevExt, pSession);
 }
 void* VBoxGuestIDCOpen(uint32_t *pu32Version)
 {
@@ -362,54 +362,54 @@ int VBoxGuestIDCCall(void *pvSession, unsigned iCmd, void *pvData, size_t cbData
 {
     return g_VBoxGuest->_VBoxGuestIDCCall(pvSession, iCmd, pvData, cbData, pcbDataReturned);
 }
-void RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
+RTDECL(void) RTAssertMsg1Weak(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
 {
     g_VBoxGuest->_RTAssertMsg1Weak(pszExpr, uLine, pszFile, pszFunction);
 }
-void RTAssertMsg2Weak(const char *pszFormat, ...)
+RTDECL(void) RTAssertMsg2Weak(const char *pszFormat, ...)
 {
     va_list va;
     va_start(va, pszFormat);
     RTAssertMsg2WeakV(pszFormat, va);
     va_end(va);
 }
-void RTAssertMsg2WeakV(const char *pszFormat, va_list va)
+RTDECL(void) RTAssertMsg2WeakV(const char *pszFormat, va_list va)
 {
     g_VBoxGuest->_RTAssertMsg2WeakV(pszFormat, va);
 }
-bool RTAssertShouldPanic(void)
+RTDECL(bool) RTAssertShouldPanic(void)
 {
     return g_VBoxGuest->_RTAssertShouldPanic();
 }
-int RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx)
+RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx)
 {
     return g_VBoxGuest->_RTSemFastMutexCreate(phFastMtx);
 }
-int RTSemFastMutexDestroy(RTSEMFASTMUTEX hFastMtx)
+RTDECL(int) RTSemFastMutexDestroy(RTSEMFASTMUTEX hFastMtx)
 {
     return g_VBoxGuest->_RTSemFastMutexDestroy(hFastMtx);
 }
-int RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx)
+RTDECL(int) RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx)
 {
     return g_VBoxGuest->_RTSemFastMutexRelease(hFastMtx);
 }
-int RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx)
+RTDECL(int) RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx)
 {
     return g_VBoxGuest->_RTSemFastMutexRequest(hFastMtx);
 }
-int RTSemMutexCreate(PRTSEMMUTEX phFastMtx)
+RTDECL(int) RTSemMutexCreate(PRTSEMMUTEX phFastMtx)
 {
     return g_VBoxGuest->_RTSemMutexCreate(phFastMtx);
 }
-int RTSemMutexDestroy(RTSEMMUTEX hFastMtx)
+RTDECL(int) RTSemMutexDestroy(RTSEMMUTEX hFastMtx)
 {
     return g_VBoxGuest->_RTSemMutexDestroy(hFastMtx);
 }
-int RTSemMutexRelease(RTSEMMUTEX hFastMtx)
+RTDECL(int) RTSemMutexRelease(RTSEMMUTEX hFastMtx)
 {
     return g_VBoxGuest->_RTSemMutexRelease(hFastMtx);
 }
-int RTSemMutexRequest(RTSEMMUTEX hFastMtx, RTMSINTERVAL cMillies)
+RTDECL(int) RTSemMutexRequest(RTSEMMUTEX hFastMtx, RTMSINTERVAL cMillies)
 {
     return g_VBoxGuest->_RTSemMutexRequest(hFastMtx, cMillies);
 }
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c
index a35329b..6cd995a 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2014 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,7 +20,7 @@
  *
  * VirtualBox Guest Additions for Haiku.
  * Copyright (c) 2011 Mike Smith <mike at scgtrp.net>
- *                    Fran�ois Revol <revol at free.fr>
+ *                    François Revol <revol at free.fr>
  *
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
@@ -178,9 +178,9 @@ static struct vboxguest_module_info g_VBoxGuest =
     RTLogDefaultInstance,
     RTLogRelDefaultInstance,
     RTErrConvertToErrno,
-    VBoxGuestCommonIOCtl,
-    VBoxGuestCreateUserSession,
-    VBoxGuestCloseSession,
+    VbgdCommonIoCtl,
+    VbgdCommonCreateUserSession,
+    VbgdCommonCloseSession,
     VBoxGuestIDCOpen,
     VBoxGuestIDCClose,
     VBoxGuestIDCCall,
@@ -277,7 +277,7 @@ static status_t VBoxGuestHaikuDetach(void)
     if (pState->iVMMDevMemAreaId)
         delete_area(pState->iVMMDevMemAreaId);
 
-    VBoxGuestDeleteDevExt(&g_DevExt);
+    VbgdCommonDeleteDevExt(&g_DevExt);
 
 #ifdef DO_LOG
     RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
@@ -303,14 +303,14 @@ static int32 VBoxGuestHaikuISR(void *pvState)
 {
     LogFlow((MODULE_NAME ":VBoxGuestHaikuISR pvState=%p\n", pvState));
 
-    bool fOurIRQ = VBoxGuestCommonISR(&g_DevExt);
+    bool fOurIRQ = VbgdCommonISR(&g_DevExt);
     if (fOurIRQ)
         return B_HANDLED_INTERRUPT;
     return B_UNHANDLED_INTERRUPT;
 }
 
 
-void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
+void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 {
     LogFlow((MODULE_NAME "::NativeISRMousePollEvent:\n"));
 
@@ -445,13 +445,13 @@ static status_t VBoxGuestHaikuAttach(const pci_info *pDevice)
             /*
              * Call the common device extension initializer.
              */
-            rc = VBoxGuestInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, pState->VMMDevMemSize,
+            rc = VbgdCommonInitDevExt(&g_DevExt, pState->uIOPortBase, pState->pMMIOBase, pState->VMMDevMemSize,
 #if ARCH_BITS == 64
-                                     VBOXOSTYPE_Haiku_x64,
+                                      VBOXOSTYPE_Haiku_x64,
 #else
-                                     VBOXOSTYPE_Haiku,
+                                      VBOXOSTYPE_Haiku,
 #endif
-                                     VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
+                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
             if (RT_SUCCESS(rc))
             {
                 /*
@@ -465,8 +465,8 @@ static status_t VBoxGuestHaikuAttach(const pci_info *pDevice)
                     return B_OK;
                 }
 
-                LogRel((MODULE_NAME ":VBoxGuestInitDevExt failed.\n"));
-                VBoxGuestDeleteDevExt(&g_DevExt);
+                LogRel((MODULE_NAME ":VbgdCommonInitDevExt failed.\n"));
+                VbgdCommonDeleteDevExt(&g_DevExt);
             }
             else
                 LogRel((MODULE_NAME ":VBoxGuestHaikuAddIRQ failed.\n"));
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.h b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.h
index 8678028..4a243d2 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.h
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-haiku.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2014 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -181,10 +181,10 @@ struct vboxguest_module_info
     PRTLOGGER(*_RTLogDefaultInstance)(void);
     PRTLOGGER(*_RTLogRelDefaultInstance)(void);
     int (*_RTErrConvertToErrno)(int iErr);
-    int (*_VBoxGuestCommonIOCtl)(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+    int (*_VbgdCommonIoCtl)(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
                                  void *pvData, size_t cbData, size_t *pcbDataReturned);
-    int (*_VBoxGuestCreateUserSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
-    void (*_VBoxGuestCloseSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+    int (*_VbgdCommonCreateUserSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
+    void (*_VbgdCommonCloseSession)(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
     void* (*_VBoxGuestIDCOpen)(uint32_t *pu32Version);
     int (*_VBoxGuestIDCClose)(void *pvSession);
     int (*_VBoxGuestIDCCall)(void *pvSession, unsigned iCmd, void *pvData, size_t cbData, size_t *pcbDataReturned);
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
index 5464a95..e39676c 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c
@@ -1,4 +1,4 @@
-/* $Rev: 97220 $ */
+/* $Rev: 98753 $ */
 /** @file
  * VBoxGuest - Linux specifics.
  *
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -340,7 +340,7 @@ static irqreturn_t vboxguestLinuxISR(int iIrrq, void *pvDevId)
 static irqreturn_t vboxguestLinuxISR(int iIrrq, void *pvDevId, struct pt_regs *pRegs)
 #endif
 {
-    bool fTaken = VBoxGuestCommonISR(&g_DevExt);
+    bool fTaken = VbgdCommonISR(&g_DevExt);
     return IRQ_RETVAL(fTaken);
 }
 
@@ -385,9 +385,9 @@ static void vboxguestLinuxTermISR(void)
  * our kernel session. */
 static int vboxguestLinuxSetMouseStatus(uint32_t fStatus)
 {
-    return VBoxGuestCommonIOCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &g_DevExt,
-                                g_pKernelSession, &fStatus, sizeof(fStatus),
-                                NULL);
+    return VbgdCommonIoCtl(VBOXGUEST_IOCTL_SET_MOUSE_STATUS, &g_DevExt,
+                           g_pKernelSession, &fStatus, sizeof(fStatus),
+                           NULL);
 }
 
 
@@ -594,18 +594,18 @@ static int __init vboxguestLinuxModInit(void)
 # warning "huh? which arch + version is this?"
             VBOXOSTYPE enmOsType = VBOXOSTYPE_Linux;
 #endif
-            rc = VBoxGuestInitDevExt(&g_DevExt,
-                                     g_IOPortBase,
-                                     g_pvMMIOBase,
-                                     g_cbMMIO,
-                                     enmOSType,
-                                     VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
+            rc = VbgdCommonInitDevExt(&g_DevExt,
+                                      g_IOPortBase,
+                                      g_pvMMIOBase,
+                                      g_cbMMIO,
+                                      enmOSType,
+                                      VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
             if (RT_SUCCESS(rc))
             {
                 /*
                  * Create the kernel session for this driver.
                  */
-                rc = VBoxGuestCreateKernelSession(&g_DevExt,
+                rc = VbgdCommonCreateKernelSession(&g_DevExt,
                                                   &g_pKernelSession);
                 if (RT_SUCCESS(rc))
                 {
@@ -641,13 +641,13 @@ static int __init vboxguestLinuxModInit(void)
                         rc = RTErrConvertFromErrno(rc);
                     }
 #endif
-                    VBoxGuestCloseSession(&g_DevExt, g_pKernelSession);
+                    VbgdCommonCloseSession(&g_DevExt, g_pKernelSession);
                 }
-                VBoxGuestDeleteDevExt(&g_DevExt);
+                VbgdCommonDeleteDevExt(&g_DevExt);
             }
             else
             {
-                LogRel((DEVICE_NAME ": VBoxGuestInitDevExt failed with rc=%Rrc\n", rc));
+                LogRel((DEVICE_NAME ": VbgdCommonInitDevExt failed with rc=%Rrc\n", rc));
                 rc = RTErrConvertFromErrno(rc);
             }
             vboxguestLinuxTermISR();
@@ -678,8 +678,8 @@ static void __exit vboxguestLinuxModExit(void)
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
     vboxguestLinuxTermInputDevice();
 #endif
-    VBoxGuestCloseSession(&g_DevExt, g_pKernelSession);
-    VBoxGuestDeleteDevExt(&g_DevExt);
+    VbgdCommonCloseSession(&g_DevExt, g_pKernelSession);
+    VbgdCommonDeleteDevExt(&g_DevExt);
     vboxguestLinuxTermISR();
     pci_unregister_driver(&g_PciDriver);
     RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
@@ -704,7 +704,7 @@ static int vboxguestLinuxOpen(struct inode *pInode, struct file *pFilp)
      * Call common code to create the user session. Associate it with
      * the file so we can access it in the other methods.
      */
-    rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
+    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         pFilp->private_data = pSession;
@@ -735,7 +735,7 @@ static int vboxguestLinuxRelease(struct inode *pInode, struct file *pFilp)
      * the file pointer didn't get left on the polling queue. */
     vboxguestFAsync(-1, pFilp, 0);
 #endif
-    VBoxGuestCloseSession(&g_DevExt, (PVBOXGUESTSESSION)pFilp->private_data);
+    VbgdCommonCloseSession(&g_DevExt, (PVBOXGUESTSESSION)pFilp->private_data);
     pFilp->private_data = NULL;
     return 0;
 }
@@ -786,7 +786,7 @@ static int vboxguestLinuxIOCtl(struct inode *pInode, struct file *pFilp, unsigne
          * Process the IOCtl.
          */
         size_t cbDataReturned;
-        rc = VBoxGuestCommonIOCtl(uCmd, &g_DevExt, pSession, pvBuf, cbData, &cbDataReturned);
+        rc = VbgdCommonIoCtl(uCmd, &g_DevExt, pSession, pvBuf, cbData, &cbDataReturned);
 
         /*
          * Copy ioctl data and output buffer back to user space.
@@ -881,7 +881,7 @@ static unsigned int vboxguestPoll(struct file *pFile, poll_table *pPt)
  *
  * @remarks This is probably not really used as X11 lets the driver do its own
  *          event reading. The poll condition is therefore also cleared when we
- *          see VMMDevReq_GetMouseStatus in VBoxGuestCommonIOCtl_VMMRequest.
+ *          see VMMDevReq_GetMouseStatus in VbgdCommonIoCtl_VMMRequest.
  */
 static ssize_t vboxguestRead(struct file *pFile, char *pbBuf, size_t cbRead, loff_t *poff)
 {
@@ -905,7 +905,7 @@ static ssize_t vboxguestRead(struct file *pFile, char *pbBuf, size_t cbRead, lof
 }
 
 
-void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
+void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 {
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
     int rc;
@@ -916,9 +916,9 @@ void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
      * Wake up everyone that's in a poll() and post anyone that has
      * subscribed to async notifications.
      */
-    Log3(("VBoxGuestNativeISRMousePollEvent: wake_up_all\n"));
+    Log3(("VbgdNativeISRMousePollEvent: wake_up_all\n"));
     wake_up_all(&g_PollEventQueue);
-    Log3(("VBoxGuestNativeISRMousePollEvent: kill_fasync\n"));
+    Log3(("VbgdNativeISRMousePollEvent: kill_fasync\n"));
     kill_fasync(&g_pFAsyncQueue, SIGIO, POLL_IN);
 #ifdef VBOXGUEST_WITH_INPUT_DRIVER
     /* Report events to the kernel input device */
@@ -937,7 +937,7 @@ void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 # endif
     }
 #endif
-    Log3(("VBoxGuestNativeISRMousePollEvent: done\n"));
+    Log3(("VbgdNativeISRMousePollEvent: done\n"));
 }
 
 
@@ -966,7 +966,6 @@ static int vboxguestLinuxParamLogGrpSet(const char *pszValue, struct kernel_para
     return 0;
 }
 
-
 /** log and dbg_log parameter getter. */
 static int vboxguestLinuxParamLogGrpGet(char *pszBuf, struct kernel_param *pParam)
 {
@@ -992,7 +991,6 @@ static int vboxguestLinuxParamLogFlagsSet(const char *pszValue, struct kernel_pa
     return 0;
 }
 
-
 /** log and dbg_log_flags parameter getter. */
 static int vboxguestLinuxParamLogFlagsGet(char *pszBuf, struct kernel_param *pParam)
 {
@@ -1018,7 +1016,6 @@ static int vboxguestLinuxParamLogDstSet(const char *pszValue, struct kernel_para
     return 0;
 }
 
-
 /** log and dbg_log_dest parameter getter. */
 static int vboxguestLinuxParamLogDstGet(char *pszBuf, struct kernel_param *pParam)
 {
@@ -1029,6 +1026,33 @@ static int vboxguestLinuxParamLogDstGet(char *pszBuf, struct kernel_param *pPara
     return strlen(pszBuf);
 }
 
+
+/** r3_log_to_host parameter setter. */
+static int vboxguestLinuxParamR3LogToHostSet(const char *pszValue, struct kernel_param *pParam)
+{
+    if (    pszValue == NULL
+        || *pszValue == '\0'
+        || *pszValue == 'n'
+        || *pszValue == 'N'
+        || *pszValue == 'd'
+        || *pszValue == 'D'
+        || (   (*pszValue == 'o' || *pszValue == 'O')
+            && (*pszValue == 'f' || *pszValue == 'F') )
+       )
+        g_DevExt.fLoggingEnabled = false;
+    else
+        g_DevExt.fLoggingEnabled = true;
+    return 0;
+}
+
+/** r3_log_to_host parameter getter. */
+static int vboxguestLinuxParamR3LogToHostGet(char *pszBuf, struct kernel_param *pParam)
+{
+    strcpy(pszBuf, g_DevExt.fLoggingEnabled ? "enabled" : "disabled");
+    return strlen(pszBuf);
+}
+
+
 /*
  * Define module parameters.
  */
@@ -1040,6 +1064,7 @@ module_param_call(dbg_log,        vboxguestLinuxParamLogGrpSet,   vboxguestLinux
 module_param_call(dbg_log_flags,  vboxguestLinuxParamLogFlagsSet, vboxguestLinuxParamLogFlagsGet, NULL, 0664);
 module_param_call(dbg_log_dest,   vboxguestLinuxParamLogDstSet,   vboxguestLinuxParamLogDstGet,   NULL, 0664);
 # endif
+module_param_call(r3_log_to_host, vboxguestLinuxParamR3LogToHostSet, vboxguestLinuxParamR3LogToHostGet, NULL, 0664);
 
 #endif /* 2.6.0 and later */
 
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp
index 5fae1ab..446556b 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-os2.cpp
@@ -149,15 +149,13 @@ DECLASM(int) VBoxGuestOS2Init(const char *pszArgs)
              * Initialize the device extension.
              */
             if (g_MemMapMMIO != NIL_RTR0MEMOBJ)
-                rc = VBoxGuestInitDevExt(&g_DevExt, g_IOPortBase,
-                                         RTR0MemObjAddress(g_MemMapMMIO),
-                                         RTR0MemObjSize(g_MemMapMMIO),
-                                         vboxGuestOS2DetectVersion(),
-                                         0);
+                rc = VbgdCommonInitDevExt(&g_DevExt, g_IOPortBase,
+                                          RTR0MemObjAddress(g_MemMapMMIO),
+                                          RTR0MemObjSize(g_MemMapMMIO),
+                                          vboxGuestOS2DetectVersion(),
+                                          0);
             else
-                rc = VBoxGuestInitDevExt(&g_DevExt, g_IOPortBase, NULL, 0,
-                                         vboxGuestOS2DetectVersion(),
-                                         0);
+                rc = VbgdCommonInitDevExt(&g_DevExt, g_IOPortBase, NULL, 0, vboxGuestOS2DetectVersion(), 0);
             if (RT_SUCCESS(rc))
             {
                 /*
@@ -200,7 +198,7 @@ DECLASM(int) VBoxGuestOS2Init(const char *pszArgs)
                 }
                 else
                     g_cchInitText = RTStrPrintf(&g_szInitText[0], g_cchInitTextMax, "VBoxGuest.sys: RTSpinlockCreate failed, rc=%Rrc\n", rc);
-                VBoxGuestDeleteDevExt(&g_DevExt);
+                VbgdCommonDeleteDevExt(&g_DevExt);
             }
             else
                 g_cchInitText = RTStrPrintf(&g_szInitText[0], g_cchInitTextMax, "VBoxGuest.sys: VBoxGuestOS2InitDevExt failed, rc=%Rrc\n", rc);
@@ -360,7 +358,7 @@ DECLASM(int) VBoxGuestOS2Open(uint16_t sfn)
     /*
      * Create a new session.
      */
-    rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
+    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         pSession->sfn = sfn;
@@ -431,7 +429,7 @@ DECLASM(int) VBoxGuestOS2Close(uint16_t sfn)
     /*
      * Close the session.
      */
-    VBoxGuestCloseSession(&g_DevExt, pSession);
+    VbgdCommonCloseSession(&g_DevExt, pSession);
     return 0;
 }
 
@@ -464,7 +462,7 @@ DECLASM(int) VBoxGuestOS2IOCtlFast(uint16_t sfn, uint8_t iFunction, int32_t *prc
     /*
      * Dispatch the fast IOCtl.
      */
-    *prc = VBoxGuestCommonIOCtlFast(iFunction, &g_DevExt, pSession);
+    *prc = VbgdCommonIoCtlFast(iFunction, &g_DevExt, pSession);
     return 0;
 }
 
@@ -496,12 +494,12 @@ DECLASM(int) VBoxGuestOS2IDCService(uint32_t u32Session, unsigned iFunction, voi
     switch (iFunction)
     {
         default:
-            rc = VBoxGuestCommonIOCtl(iFunction, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
+            rc = VbgdCommonIoCtl(iFunction, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
             break;
 
         case VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT:
             pSession->sfn = 0;
-            VBoxGuestCloseSession(&g_DevExt, pSession);
+            VbgdCommonCloseSession(&g_DevExt, pSession);
             rc = VINF_SUCCESS;
             break;
     }
@@ -517,7 +515,7 @@ DECLASM(int) VBoxGuestOS2IDCService(uint32_t u32Session, unsigned iFunction, voi
 DECLASM(PVBOXGUESTSESSION) VBoxGuestOS2IDCConnect(void)
 {
     PVBOXGUESTSESSION pSession;
-    int rc = VBoxGuestCreateKernelSession(&g_DevExt, &pSession);
+    int rc = VbgdCommonCreateKernelSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         pSession->sfn = 0xffff;
@@ -599,7 +597,7 @@ DECLASM(int) VBoxGuestOS2IOCtl(uint16_t sfn, uint8_t iCat, uint8_t iFunction, vo
          * Process the IOCtl.
          */
         size_t cbDataReturned;
-        rc = VBoxGuestCommonIOCtl(iFunction, &g_DevExt, pSession, pvParm, *pcbParm, &cbDataReturned);
+        rc = VbgdCommonIoCtl(iFunction, &g_DevExt, pSession, pvParm, *pcbParm, &cbDataReturned);
 
         /*
          * Unlock the buffers.
@@ -638,11 +636,11 @@ DECLASM(bool) VBoxGuestOS2ISR(void)
 {
     Log(("VBoxGuestOS2ISR\n"));
 
-    return VBoxGuestCommonISR(&g_DevExt);
+    return VbgdCommonISR(&g_DevExt);
 }
 
 
-void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
+void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 {
     /* No polling on OS/2 */
     NOREF(pDevExt);
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c
index d709229..f34435a 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2007-2012 Oracle Corporation
+ * Copyright (C) 2007-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -74,6 +74,7 @@ static int VBoxGuestSolarisPoll(dev_t Dev, short fEvents, int fAnyYet, short *pR
 static int VBoxGuestSolarisGetInfo(dev_info_t *pDip, ddi_info_cmd_t enmCmd, void *pArg, void **ppResult);
 static int VBoxGuestSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd);
 static int VBoxGuestSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd);
+static int VBoxGuestSolarisQuiesce(dev_info_t *pDip);
 
 static int VBoxGuestSolarisAddIRQ(dev_info_t *pDip);
 static void VBoxGuestSolarisRemoveIRQ(dev_info_t *pDip);
@@ -121,7 +122,8 @@ static struct dev_ops g_VBoxGuestSolarisDevOps =
     nodev,                  /* reset */
     &g_VBoxGuestSolarisCbOps,
     (struct bus_ops *)0,
-    nodev                   /* power */
+    nodev,                  /* power */
+    VBoxGuestSolarisQuiesce
 };
 
 /**
@@ -326,13 +328,13 @@ static int VBoxGuestSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd)
                                 /*
                                  * Call the common device extension initializer.
                                  */
-                                rc = VBoxGuestInitDevExt(&g_DevExt, g_uIOPortBase, g_pMMIOBase, g_cbMMIO,
+                                rc = VbgdCommonInitDevExt(&g_DevExt, g_uIOPortBase, g_pMMIOBase, g_cbMMIO,
 #if ARCH_BITS == 64
-                                                         VBOXOSTYPE_Solaris_x64,
+                                                          VBOXOSTYPE_Solaris_x64,
 #else
-                                                         VBOXOSTYPE_Solaris,
+                                                          VBOXOSTYPE_Solaris,
 #endif
-                                                         VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
+                                                          VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
                                 if (RT_SUCCESS(rc))
                                 {
                                     rc = ddi_create_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO, 0 /* fFlags */);
@@ -344,10 +346,10 @@ static int VBoxGuestSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd)
                                     }
 
                                     LogRel((DEVICE_NAME "::Attach: ddi_create_minor_node failed.\n"));
-                                    VBoxGuestDeleteDevExt(&g_DevExt);
+                                    VbgdCommonDeleteDevExt(&g_DevExt);
                                 }
                                 else
-                                    LogRel((DEVICE_NAME "::Attach: VBoxGuestInitDevExt failed.\n"));
+                                    LogRel((DEVICE_NAME "::Attach: VbgdCommonInitDevExt failed.\n"));
                                 VBoxGuestSolarisRemoveIRQ(pDip);
                             }
                             else
@@ -401,7 +403,7 @@ static int VBoxGuestSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd)
             ddi_regs_map_free(&g_PciIOHandle);
             ddi_regs_map_free(&g_PciMMIOHandle);
             ddi_remove_minor_node(pDip, NULL);
-            VBoxGuestDeleteDevExt(&g_DevExt);
+            VbgdCommonDeleteDevExt(&g_DevExt);
             g_pDip = NULL;
             return DDI_SUCCESS;
         }
@@ -419,6 +421,29 @@ static int VBoxGuestSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd)
 
 
 /**
+ * Quiesce entry point, called by solaris kernel for disabling the device from
+ * generating any interrupts or doing in-bound DMA.
+ *
+ * @param   pDip            The module structure instance.
+ *
+ * @return  corresponding solaris error code.
+ */
+static int VBoxGuestSolarisQuiesce(dev_info_t *pDip)
+{
+    for (int i = 0; i < g_cIntrAllocated; i++)
+    {
+        int rc = ddi_intr_disable(g_pIntr[i]);
+        if (rc != DDI_SUCCESS)
+            return DDI_FAILURE;
+    }
+
+    /** @todo What about HGCM/HGSMI touching guest-memory? */
+
+    return DDI_SUCCESS;
+}
+
+
+/**
  * Info entry point, called by solaris kernel for obtaining driver info.
  *
  * @param   pDip            The module structure instance (do not use).
@@ -489,7 +514,7 @@ static int VBoxGuestSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred
     /*
      * Create a new session.
      */
-    rc = VBoxGuestCreateUserSession(&g_DevExt, &pSession);
+    rc = VbgdCommonCreateUserSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         pState->pvProcRef = proc_ref();
@@ -502,7 +527,7 @@ static int VBoxGuestSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred
     /* Failed, clean up. */
     ddi_soft_state_free(g_pVBoxGuestSolarisState, iOpenInstance);
 
-    LogRel((DEVICE_NAME "::Open: VBoxGuestCreateUserSession failed. rc=%d\n", rc));
+    LogRel((DEVICE_NAME "::Open: VbgdCommonCreateUserSession failed. rc=%d\n", rc));
     return EFAULT;
 }
 
@@ -533,7 +558,7 @@ static int VBoxGuestSolarisClose(dev_t Dev, int flag, int fType, cred_t *pCred)
     /*
      * Close the session.
      */
-    VBoxGuestCloseSession(&g_DevExt, pSession);
+    VbgdCommonCloseSession(&g_DevExt, pSession);
     return 0;
 }
 
@@ -668,7 +693,7 @@ static int VBoxGuestSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArg, int Mode, cr
      * Process the IOCtl.
      */
     size_t cbDataReturned = 0;
-    rc = VBoxGuestCommonIOCtl(Cmd, &g_DevExt, pSession, pvBuf, ReqWrap.cbData, &cbDataReturned);
+    rc = VbgdCommonIoCtl(Cmd, &g_DevExt, pSession, pvBuf, ReqWrap.cbData, &cbDataReturned);
     if (RT_SUCCESS(rc))
     {
         rc = 0;
@@ -695,7 +720,7 @@ static int VBoxGuestSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArg, int Mode, cr
          * VBOXGUEST_IOCTL_CANCEL_ALL_EVENTS can return VERR_INTERRUPTED and possibly more in the future;
          * which are not really failures that require logging.
          */
-        Log((DEVICE_NAME "::IOCtl: VBoxGuestCommonIOCtl failed. Cmd=%#x rc=%d\n", Cmd, rc));
+        Log((DEVICE_NAME "::IOCtl: VbgdCommonIoCtl failed. Cmd=%#x rc=%d\n", Cmd, rc));
         if (rc == VERR_PERMISSION_DENIED)   /* RTErrConvertToErrno() below will ring-0 debug assert if we don't do this. */
             rc = VERR_ACCESS_DENIED;
         rc = RTErrConvertToErrno(rc);
@@ -868,14 +893,14 @@ static uint_t VBoxGuestSolarisISR(caddr_t Arg)
     LogFlow((DEVICE_NAME "::ISR:\n"));
 
     mutex_enter(&g_IrqMtx);
-    bool fOurIRQ = VBoxGuestCommonISR(&g_DevExt);
+    bool fOurIRQ = VbgdCommonISR(&g_DevExt);
     mutex_exit(&g_IrqMtx);
 
     return fOurIRQ ? DDI_INTR_CLAIMED : DDI_INTR_UNCLAIMED;
 }
 
 
-void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
+void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 {
     LogFlow((DEVICE_NAME "::NativeISRMousePollEvent:\n"));
 
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp
index 3dd5544..df766a1 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp
index 73ec6ff..4c3e20e 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -275,7 +275,7 @@ NTSTATUS vbgdNtPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp)
             Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Removing device ...\n"));
 
             /* Destroy device extension and clean up everything else. */
-            VBoxGuestDeleteDevExt(&pDevExt->Core);
+            VbgdCommonDeleteDevExt(&pDevExt->Core);
 
             /* Remove DOS device + symbolic link. */
             UNICODE_STRING win32Name;
@@ -466,7 +466,7 @@ NTSTATUS vbgdNtPower(PDEVICE_OBJECT pDevObj, PIRP pIrp)
                                     && pDevExt->LastSystemPowerAction == PowerActionHibernate)
                                 {
                                     Log(("VBoxGuest::vbgdNtGuestPower: Returning from hibernation!\n"));
-                                    int rc = VBoxGuestReinitDevExtAfterHibernation(&pDevExt->Core,
+                                    int rc = VbgdCommonReinitDevExtAfterHibernation(&pDevExt->Core,
                                                                                    vbgdNtVersionToOSType(g_enmVbgdNtVer));
                                     if (RT_FAILURE(rc))
                                         Log(("VBoxGuest::vbgdNtGuestPower: Cannot re-init VMMDev chain, rc = %d!\n", rc));
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
index 26809fe..48fff37 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -425,11 +425,11 @@ NTSTATUS vbgdNtInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STR
             LogFunc(("pvMMIOBase=0x%p, pDevExt=0x%p, pDevExt->Core.pVMMDevMemory=0x%p\n",
                      pvMMIOBase, pDevExt, pDevExt ? pDevExt->Core.pVMMDevMemory : NULL));
 
-            int vrc = VBoxGuestInitDevExt(&pDevExt->Core,
-                                          pDevExt->Core.IOPortBase,
-                                          pvMMIOBase, cbMMIO,
-                                          vbgdNtVersionToOSType(g_enmVbgdNtVer),
-                                          VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
+            int vrc = VbgdCommonInitDevExt(&pDevExt->Core,
+                                           pDevExt->Core.IOPortBase,
+                                           pvMMIOBase, cbMMIO,
+                                           vbgdNtVersionToOSType(g_enmVbgdNtVer),
+                                           VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
             if (RT_FAILURE(vrc))
             {
                 LogFunc(("Could not init device extension, rc=%Rrc\n", vrc));
@@ -514,7 +514,7 @@ NTSTATUS vbgdNtInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STR
 
 #ifdef VBOX_WITH_HGCM
     LogFunc(("Allocating kernel session data ...\n"));
-    int vrc = VBoxGuestCreateKernelSession(&pDevExt->Core, &pDevExt->pKernelSession);
+    int vrc = VbgdCommonCreateKernelSession(&pDevExt->Core, &pDevExt->pKernelSession);
     if (RT_FAILURE(vrc))
     {
         LogFunc(("Failed to allocated kernel session data, rc=%Rrc\n", rc));
@@ -567,7 +567,7 @@ NTSTATUS vbgdNtCleanup(PDEVICE_OBJECT pDevObj)
 #ifdef VBOX_WITH_HGCM
         if (pDevExt->pKernelSession)
         {
-            VBoxGuestCloseSession(pDevExt, pDevExt->pKernelSession);
+            VbgdCommonCloseSession(pDevExt, pDevExt->pKernelSession);
             pDevExt->pKernelSession = NULL;
         }
 #endif
@@ -607,7 +607,7 @@ static void vbgdNtUnload(PDRIVER_OBJECT pDrvObj)
 
     /* Destroy device extension and clean up everything else. */
     if (pDrvObj->DeviceObject && pDrvObj->DeviceObject->DeviceExtension)
-        VBoxGuestDeleteDevExt((PVBOXGUESTDEVEXT)pDrvObj->DeviceObject->DeviceExtension);
+        VbgdCommonDeleteDevExt((PVBOXGUESTDEVEXT)pDrvObj->DeviceObject->DeviceExtension);
 
     /*
      * I don't think it's possible to unload a driver which processes have
@@ -672,12 +672,12 @@ static NTSTATUS vbgdNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp)
                  * Create a session object if we have a valid file object. This session object
                  * exists for every R3 process.
                  */
-                vrc = VBoxGuestCreateUserSession(&pDevExt->Core, &pSession);
+                vrc = VbgdCommonCreateUserSession(&pDevExt->Core, &pSession);
             }
             else
             {
                 /* ... otherwise we've been called from R0! */
-                vrc = VBoxGuestCreateKernelSession(&pDevExt->Core, &pSession);
+                vrc = VbgdCommonCreateKernelSession(&pDevExt->Core, &pSession);
             }
             if (RT_SUCCESS(vrc))
                 pFileObj->FsContext = pSession;
@@ -714,7 +714,7 @@ static NTSTATUS vbgdNtClose(PDEVICE_OBJECT pDevObj, PIRP pIrp)
     /* Close both, R0 and R3 sessions. */
     PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)pFileObj->FsContext;
     if (pSession)
-        VBoxGuestCloseSession(&pDevExt->Core, pSession);
+        VbgdCommonCloseSession(&pDevExt->Core, pSession);
 #endif
 
     pFileObj->FsContext = NULL;
@@ -772,10 +772,10 @@ static NTSTATUS vbgdNtIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp)
          * Process the common IOCtls.
          */
         size_t cbDataReturned;
-        int vrc = VBoxGuestCommonIOCtl(uCmd, &pDevExt->Core, pSession, pBuf, cbData, &cbDataReturned);
+        int vrc = VbgdCommonIoCtl(uCmd, &pDevExt->Core, pSession, pBuf, cbData, &cbDataReturned);
 
-        Log(("VBoxGuest::vbgdNtGuestDeviceControl: rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n",
-             vrc, pBuf, cbData, cbDataReturned));
+        LogFlowFunc(("rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n",
+                     vrc, pBuf, cbData, cbDataReturned));
 
         if (RT_SUCCESS(vrc))
         {
@@ -975,7 +975,7 @@ void vbgdNtDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pCont
 
     /* Process the wake-up list we were asked by the scheduling a DPC
      * in vbgdNtIsrHandler(). */
-    VBoxGuestWaitDoWakeUps(&pDevExt->Core);
+    VbgdCommonWaitDoWakeUps(&pDevExt->Core);
 }
 
 
@@ -995,7 +995,7 @@ BOOLEAN vbgdNtIsrHandler(PKINTERRUPT pInterrupt, PVOID pServiceContext)
     /*Log3Func(("pDevExt=0x%p, pVMMDevMemory=0x%p\n", pDevExt, pDevExt ? pDevExt->pVMMDevMemory : NULL));*/
 
     /* Enter the common ISR routine and do the actual work. */
-    BOOLEAN fIRQTaken = VBoxGuestCommonISR(&pDevExt->Core);
+    BOOLEAN fIRQTaken = VbgdCommonISR(&pDevExt->Core);
 
     /* If we need to wake up some events we do that in a DPC to make
      * sure we're called at the right IRQL. */
@@ -1018,7 +1018,7 @@ BOOLEAN vbgdNtIsrHandler(PKINTERRUPT pInterrupt, PVOID pServiceContext)
  *
  * @param pDevExt     Device extension structure.
  */
-void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
+void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt)
 {
     NOREF(pDevExt);
     /* nothing to do here - i.e. since we can not KeSetEvent from ISR level,
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h
index 8491a20..caca294 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
index 2952a42..71006ec 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
@@ -30,7 +30,6 @@
 *******************************************************************************/
 #define LOG_GROUP   LOG_GROUP_DEFAULT
 #include "VBoxGuestInternal.h"
-#include "VBoxGuest2.h"
 #include <VBox/VMMDev.h> /* for VMMDEV_RAM_SIZE */
 #include <VBox/log.h>
 #include <iprt/mem.h>
@@ -42,6 +41,7 @@
 #include <iprt/process.h>
 #include <iprt/assert.h>
 #include <iprt/param.h>
+#include <iprt/timer.h>
 #ifdef VBOX_WITH_HGCM
 # include <iprt/thread.h>
 #endif
@@ -60,247 +60,38 @@
 
 
 /*******************************************************************************
-*   Internal Functions                                                         *
+*   Defined Constants And Macros                                               *
 *******************************************************************************/
-#ifdef VBOX_WITH_HGCM
-static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User);
-#endif
-
-static int VBoxGuestCommonGuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fOrMask, uint32_t fNotMask, VBOXGUESTCAPSACQUIRE_FLAGS enmFlags);
-
 #define VBOXGUEST_ACQUIRE_STYLE_EVENTS (VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST | VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST)
 
-/** Return the mask of VMM device events that this session is allowed to see,
- *  ergo, all events except those in "acquire" mode which have not been acquired
- *  by this session. */
-DECLINLINE(uint32_t) VBoxGuestCommonGetHandledEventsLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
-{
-    if (!pDevExt->u32AcquireModeGuestCaps)
-        return VMMDEV_EVENT_VALID_EVENT_MASK;
-
-    /** @note VMMDEV_EVENT_VALID_EVENT_MASK should actually be the mask of valid
-     *        capabilities, but that doesn't affect this code. */
-    uint32_t u32AllowedGuestCaps = pSession->u32AquiredGuestCaps | (VMMDEV_EVENT_VALID_EVENT_MASK & ~pDevExt->u32AcquireModeGuestCaps);
-    uint32_t u32CleanupEvents = VBOXGUEST_ACQUIRE_STYLE_EVENTS;
-    if (u32AllowedGuestCaps & VMMDEV_GUEST_SUPPORTS_GRAPHICS)
-        u32CleanupEvents &= ~VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST;
-    if (u32AllowedGuestCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS)
-        u32CleanupEvents &= ~VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST;
-
-    return VMMDEV_EVENT_VALID_EVENT_MASK & ~u32CleanupEvents;
-}
-
-DECLINLINE(uint32_t) VBoxGuestCommonGetAndCleanPendingEventsLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fReqEvents)
-{
-    uint32_t fMatches = pDevExt->f32PendingEvents & fReqEvents & VBoxGuestCommonGetHandledEventsLocked(pDevExt, pSession);
-    if (fMatches)
-        ASMAtomicAndU32(&pDevExt->f32PendingEvents, ~fMatches);
-    return fMatches;
-}
-
-/** Puts a capability in "acquire" or "set" mode and returns the mask of
- * capabilities currently in the other mode.  Once a capability has been put in
- * one of the two modes it can no longer be removed from that mode. */
-DECLINLINE(bool) VBoxGuestCommonGuestCapsModeSet(PVBOXGUESTDEVEXT pDevExt, uint32_t fCaps, bool fAcquire, uint32_t *pu32OtherVal)
-{
-    uint32_t *pVal = fAcquire ? &pDevExt->u32AcquireModeGuestCaps : &pDevExt->u32SetModeGuestCaps;
-    const uint32_t fNotVal = !fAcquire ? pDevExt->u32AcquireModeGuestCaps : pDevExt->u32SetModeGuestCaps;
-    bool fResult = true;
-    RTSpinlockAcquire(pDevExt->EventSpinlock);
-
-    if (!(fNotVal & fCaps))
-        *pVal |= fCaps;
-    else
-    {
-        AssertMsgFailed(("trying to change caps mode\n"));
-        fResult = false;
-    }
-
-    RTSpinlockRelease(pDevExt->EventSpinlock);
-
-    if (pu32OtherVal)
-        *pu32OtherVal = fNotVal;
-    return fResult;
-}
-
-
-/**
- * Sets the interrupt filter mask during initialization and termination.
- *
- * This will ASSUME that we're the ones in carge over the mask, so
- * we'll simply clear all bits we don't set.
- *
- * @returns VBox status code (ignored).
- * @param   fMask       The new mask.
- */
-static int vboxGuestSetFilterMask(VMMDevCtlGuestFilterMask *pReq,
-                                  uint32_t fMask)
-{
-    int rc;
-
-    pReq->u32OrMask = fMask;
-    pReq->u32NotMask = ~fMask;
-    rc = VbglGRPerform(&pReq->header);
-    if (RT_FAILURE(rc))
-        LogRel(("vboxGuestSetFilterMask: failed with rc=%Rrc\n", rc));
-    return rc;
-}
-
-
-/**
- * Sets the guest capabilities to the host.
- *
- * This will ASSUME that we're the ones in charge of the mask, so
- * we'll simply clear all bits we don't set.
- *
- * @returns VBox status code.
- * @param   fMask       The new mask.
- */
-static int vboxGuestSetCapabilities(VMMDevReqGuestCapabilities2 *pReq,
-                                    uint32_t fMask)
-{
-    int rc;
-
-    pReq->u32OrMask = fMask;
-    pReq->u32NotMask = ~fMask;
-    rc = VbglGRPerform(&pReq->header);
-    if (RT_FAILURE(rc))
-        LogRelFunc(("failed with rc=%Rrc\n", rc));
-    return rc;
-}
-
-
-/**
- * Sets the mouse status to the host.
- *
- * This will ASSUME that we're the ones in charge of the mask, so
- * we'll simply clear all bits we don't set.
- *
- * @returns VBox status code.
- * @param   fMask       The new mask.
- */
-static int vboxGuestSetMouseStatus(VMMDevReqMouseStatus *pReq, uint32_t fMask)
-{
-    int rc;
-
-    pReq->mouseFeatures = fMask;
-    pReq->pointerXPos   = 0;
-    pReq->pointerYPos   = 0;
-    rc = VbglGRPerform(&pReq->header);
-    if (RT_FAILURE(rc))
-        LogRelFunc(("failed with rc=%Rrc\n", rc));
-    return rc;
-}
-
-
-/** Host flags to be updated by a given invocation of the
- * vboxGuestUpdateHostFlags() method. */
-enum
-{
-    HostFlags_FilterMask   = 1,
-    HostFlags_Capabilities = 2,
-    HostFlags_MouseStatus  = 4,
-    HostFlags_All          = 7,
-    HostFlags_SizeHack = (unsigned)-1
-};
-
-
-static int vboxGuestGetHostFlagsFromSessions(PVBOXGUESTDEVEXT pDevExt,
-                                             PVBOXGUESTSESSION pSession,
-                                             uint32_t *pfFilterMask,
-                                             uint32_t *pfCapabilities,
-                                             uint32_t *pfMouseStatus)
-{
-    PVBOXGUESTSESSION pIterator;
-    uint32_t fFilterMask = 0, fCapabilities = 0, fMouseStatus = 0;
-    unsigned cSessions = 0;
-    int rc = VINF_SUCCESS;
-
-    RTListForEach(&pDevExt->SessionList, pIterator, VBOXGUESTSESSION, ListNode)
-    {
-        fFilterMask   |= pIterator->fFilterMask;
-        fCapabilities |= pIterator->fCapabilities;
-        fMouseStatus  |= pIterator->fMouseStatus;
-        ++cSessions;
-    }
-    if (!cSessions)
-        if (fFilterMask | fCapabilities | fMouseStatus)
-            rc = VERR_INTERNAL_ERROR;
-    if (cSessions == 1 && pSession)
-        if (   fFilterMask   != pSession->fFilterMask
-            || fCapabilities != pSession->fCapabilities
-            || fMouseStatus  != pSession->fMouseStatus)
-            rc = VERR_INTERNAL_ERROR;
-    if (cSessions > 1 && pSession)
-        if (   ~fFilterMask   & pSession->fFilterMask
-            || ~fCapabilities & pSession->fCapabilities
-            || ~fMouseStatus  & pSession->fMouseStatus)
-            rc = VERR_INTERNAL_ERROR;
-    *pfFilterMask = fFilterMask;
-    *pfCapabilities = fCapabilities;
-    *pfMouseStatus = fMouseStatus;
-    return rc;
-}
-
-
-/** Check which host flags in a given category are being asserted by some guest
- * session and assert exactly those on the host which are being asserted by one
- * or more sessions.  pCallingSession is purely for sanity checking and can be
- * NULL.
- * @note Takes the session spin-lock.
- */
-static int vboxGuestUpdateHostFlags(PVBOXGUESTDEVEXT pDevExt,
-                                    PVBOXGUESTSESSION pSession,
-                                    unsigned enmFlags)
-{
-    int rc;
-    VMMDevCtlGuestFilterMask    *pFilterReq = NULL;
-    VMMDevReqGuestCapabilities2 *pCapabilitiesReq = NULL;
-    VMMDevReqMouseStatus        *pStatusReq = NULL;
-    uint32_t fFilterMask = 0, fCapabilities = 0, fMouseStatus = 0;
 
-    rc = VbglGRAlloc((VMMDevRequestHeader **)&pFilterReq, sizeof(*pFilterReq),
-                     VMMDevReq_CtlGuestFilterMask);
-    if (RT_SUCCESS(rc))
-        rc = VbglGRAlloc((VMMDevRequestHeader **)&pCapabilitiesReq,
-                         sizeof(*pCapabilitiesReq),
-                         VMMDevReq_SetGuestCapabilities);
-    if (RT_SUCCESS(rc))
-        rc = VbglGRAlloc((VMMDevRequestHeader **)&pStatusReq,
-                         sizeof(*pStatusReq), VMMDevReq_SetMouseStatus);
-    RTSpinlockAcquire(pDevExt->SessionSpinlock);
-    if (RT_SUCCESS(rc))
-        rc = vboxGuestGetHostFlagsFromSessions(pDevExt, pSession, &fFilterMask,
-                                               &fCapabilities, &fMouseStatus);
-    if (RT_SUCCESS(rc))
-    {
-        fFilterMask |= pDevExt->fFixedEvents;
-        /* Since VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR is inverted in the session
-         * capabilities we invert it again before sending it to the host. */
-        fMouseStatus ^= VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR;
-        if (enmFlags & HostFlags_FilterMask)
-            vboxGuestSetFilterMask(pFilterReq, fFilterMask);
-        fCapabilities |= pDevExt->u32GuestCaps;
-        if (enmFlags & HostFlags_Capabilities)
-            vboxGuestSetCapabilities(pCapabilitiesReq, fCapabilities);
-        if (enmFlags & HostFlags_MouseStatus)
-            vboxGuestSetMouseStatus(pStatusReq, fMouseStatus);
-    }
-    RTSpinlockRelease(pDevExt->SessionSpinlock);
-    if (pFilterReq)
-        VbglGRFree(&pFilterReq->header);
-    if (pCapabilitiesReq)
-        VbglGRFree(&pCapabilitiesReq->header);
-    if (pStatusReq)
-        VbglGRFree(&pStatusReq->header);
-    return rc;
-}
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+#ifdef VBOX_WITH_HGCM
+static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdrNonVolatile, void *pvUser, uint32_t u32User);
+#endif
+static int      vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+static void     vbgdBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker);
+static uint32_t vbgdGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+static int      vbgdResetEventFilterOnHost(PVBOXGUESTDEVEXT pDevExt, uint32_t fFixedEvents);
+static int      vbgdResetMouseStatusOnHost(PVBOXGUESTDEVEXT pDevExt);
+static int      vbgdResetCapabilitiesOnHost(PVBOXGUESTDEVEXT pDevExt);
+static int      vbgdSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                          uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination);
+static int      vbgdSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                          uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination);
+static int      vbgdSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                           uint32_t fOrMask, uint32_t fNoMask, bool fSessionTermination);
+static int      vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fOrMask,
+                                               uint32_t fNotMask, VBOXGUESTCAPSACQUIRE_FLAGS enmFlags, bool fSessionTermination);
+static int      vbgdDispatchEventsLocked(PVBOXGUESTDEVEXT pDevExt, uint32_t fEvents);
 
 
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
-static const uint32_t cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]);
+static const uint32_t g_cbChangeMemBalloonReq = RT_OFFSETOF(VMMDevChangeMemBalloon, aPhysPage[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES]);
 
 #if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS)
 /**
@@ -336,7 +127,7 @@ PFNRT g_apfnVBoxGuestIPRTDeps[] =
  * @returns VBox status code (ignored).
  * @param   pDevExt     The device extension.
  */
-static int vboxGuestInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
+static int vbgdInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
 {
     /*
      * Query the required space.
@@ -359,7 +150,7 @@ static int vboxGuestInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
      * instance in VT-x and AMD-V mode.
      */
     if (pReq->hypervisorSize == 0)
-        Log(("vboxGuestInitFixateGuestMappings: nothing to do\n"));
+        Log(("vbgdInitFixateGuestMappings: nothing to do\n"));
     else
     {
         /*
@@ -371,7 +162,7 @@ static int vboxGuestInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
         RTR0MEMOBJ  ahTries[5];
         uint32_t    iTry;
         bool        fBitched = false;
-        Log(("vboxGuestInitFixateGuestMappings: cbHypervisor=%#x\n", cbHypervisor));
+        Log(("vbgdInitFixateGuestMappings: cbHypervisor=%#x\n", cbHypervisor));
         for (iTry = 0; iTry < RT_ELEMENTS(ahTries); iTry++)
         {
             /*
@@ -466,11 +257,11 @@ static int vboxGuestInitFixateGuestMappings(PVBOXGUESTDEVEXT pDevExt)
 
 
 /**
- * Undo what vboxGuestInitFixateGuestMappings did.
+ * Undo what vbgdInitFixateGuestMappings did.
  *
  * @param   pDevExt     The device extension.
  */
-static void vboxGuestTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
+static void vbgdTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
 {
     if (pDevExt->hGuestMappings != NIL_RTR0PTR)
     {
@@ -493,13 +284,119 @@ static void vboxGuestTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
             AssertRC(rc);
         }
         else
-            LogRel(("vboxGuestTermUnfixGuestMappings: Failed to unfix the guest mappings! rc=%Rrc\n", rc));
+            LogRel(("vbgdTermUnfixGuestMappings: Failed to unfix the guest mappings! rc=%Rrc\n", rc));
 
         pDevExt->hGuestMappings = NIL_RTR0MEMOBJ;
     }
 }
 
 
+
+/**
+ * Report the guest information to the host.
+ *
+ * @returns IPRT status code.
+ * @param   enmOSType       The OS type to report.
+ */
+static int vbgdReportGuestInfo(VBOXOSTYPE enmOSType)
+{
+    /*
+     * Allocate and fill in the two guest info reports.
+     */
+    VMMDevReportGuestInfo2 *pReqInfo2 = NULL;
+    VMMDevReportGuestInfo  *pReqInfo1 = NULL;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo2, sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2);
+    Log(("vbgdReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
+    if (RT_SUCCESS(rc))
+    {
+        pReqInfo2->guestInfo.additionsMajor    = VBOX_VERSION_MAJOR;
+        pReqInfo2->guestInfo.additionsMinor    = VBOX_VERSION_MINOR;
+        pReqInfo2->guestInfo.additionsBuild    = VBOX_VERSION_BUILD;
+        pReqInfo2->guestInfo.additionsRevision = VBOX_SVN_REV;
+        pReqInfo2->guestInfo.additionsFeatures = 0; /* (no features defined yet) */
+        RTStrCopy(pReqInfo2->guestInfo.szName, sizeof(pReqInfo2->guestInfo.szName), VBOX_VERSION_STRING);
+
+        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo1, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo);
+        Log(("vbgdReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
+        if (RT_SUCCESS(rc))
+        {
+            pReqInfo1->guestInfo.interfaceVersion = VMMDEV_VERSION;
+            pReqInfo1->guestInfo.osType           = enmOSType;
+
+            /*
+             * There are two protocols here:
+             *      1. Info2 + Info1. Supported by >=3.2.51.
+             *      2. Info1 and optionally Info2. The old protocol.
+             *
+             * We try protocol 1 first.  It will fail with VERR_NOT_SUPPORTED
+             * if not supported by the VMMDev (message ordering requirement).
+             */
+            rc = VbglGRPerform(&pReqInfo2->header);
+            Log(("vbgdReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
+            if (RT_SUCCESS(rc))
+            {
+                rc = VbglGRPerform(&pReqInfo1->header);
+                Log(("vbgdReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
+            }
+            else if (   rc == VERR_NOT_SUPPORTED
+                     || rc == VERR_NOT_IMPLEMENTED)
+            {
+                rc = VbglGRPerform(&pReqInfo1->header);
+                Log(("vbgdReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
+                if (RT_SUCCESS(rc))
+                {
+                    rc = VbglGRPerform(&pReqInfo2->header);
+                    Log(("vbgdReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
+                    if (rc == VERR_NOT_IMPLEMENTED)
+                        rc = VINF_SUCCESS;
+                }
+            }
+            VbglGRFree(&pReqInfo1->header);
+        }
+        VbglGRFree(&pReqInfo2->header);
+    }
+
+    return rc;
+}
+
+
+/**
+ * Report the guest driver status to the host.
+ *
+ * @returns IPRT status code.
+ * @param   fActive         Flag whether the driver is now active or not.
+ */
+static int vbgdReportDriverStatus(bool fActive)
+{
+    /*
+     * Report guest status of the VBox driver to the host.
+     */
+    VMMDevReportGuestStatus *pReq2 = NULL;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq2, sizeof(*pReq2), VMMDevReq_ReportGuestStatus);
+    Log(("vbgdReportDriverStatus: VbglGRAlloc VMMDevReportGuestStatus completed with rc=%Rrc\n", rc));
+    if (RT_SUCCESS(rc))
+    {
+        pReq2->guestStatus.facility = VBoxGuestFacilityType_VBoxGuestDriver;
+        pReq2->guestStatus.status = fActive ?
+                                    VBoxGuestFacilityStatus_Active
+                                  : VBoxGuestFacilityStatus_Inactive;
+        pReq2->guestStatus.flags = 0;
+        rc = VbglGRPerform(&pReq2->header);
+        Log(("vbgdReportDriverStatus: VbglGRPerform VMMDevReportGuestStatus completed with fActive=%d, rc=%Rrc\n",
+             fActive ? 1 : 0, rc));
+        if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */
+            rc = VINF_SUCCESS;
+        VbglGRFree(&pReq2->header);
+    }
+
+    return rc;
+}
+
+
+/** @name Memory Ballooning
+ * @{
+ */
+
 /**
  * Inflate the balloon by one chunk represented by an R0 memory object.
  *
@@ -509,7 +406,7 @@ static void vboxGuestTermUnfixGuestMappings(PVBOXGUESTDEVEXT pDevExt)
  * @param   pMemObj     Pointer to the R0 memory object.
  * @param   pReq        The pre-allocated request for performing the VMMDev call.
  */
-static int vboxGuestBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
+static int vbgdBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
 {
     uint32_t iPage;
     int rc;
@@ -521,12 +418,12 @@ static int vboxGuestBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *
     }
 
     pReq->fInflate = true;
-    pReq->header.size = cbChangeMemBalloonReq;
+    pReq->header.size = g_cbChangeMemBalloonReq;
     pReq->cPages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES;
 
     rc = VbglGRPerform(&pReq->header);
     if (RT_FAILURE(rc))
-        LogRel(("vboxGuestBalloonInflate: VbglGRPerform failed. rc=%Rrc\n", rc));
+        LogRel(("vbgdBalloonInflate: VbglGRPerform failed. rc=%Rrc\n", rc));
     return rc;
 }
 
@@ -541,7 +438,7 @@ static int vboxGuestBalloonInflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *
  *                      The memory object will be freed afterwards.
  * @param   pReq        The pre-allocated request for performing the VMMDev call.
  */
-static int vboxGuestBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
+static int vbgdBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *pReq)
 {
     uint32_t iPage;
     int rc;
@@ -553,20 +450,20 @@ static int vboxGuestBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *
     }
 
     pReq->fInflate = false;
-    pReq->header.size = cbChangeMemBalloonReq;
+    pReq->header.size = g_cbChangeMemBalloonReq;
     pReq->cPages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES;
 
     rc = VbglGRPerform(&pReq->header);
     if (RT_FAILURE(rc))
     {
-        LogRel(("vboxGuestBalloonDeflate: VbglGRPerform failed. rc=%Rrc\n", rc));
+        LogRel(("vbgdBalloonDeflate: VbglGRPerform failed. rc=%Rrc\n", rc));
         return rc;
     }
 
     rc = RTR0MemObjFree(*pMemObj, true);
     if (RT_FAILURE(rc))
     {
-        LogRel(("vboxGuestBalloonDeflate: RTR0MemObjFree(%p,true) -> %Rrc; this is *BAD*!\n", *pMemObj, rc));
+        LogRel(("vbgdBalloonDeflate: RTR0MemObjFree(%p,true) -> %Rrc; this is *BAD*!\n", *pMemObj, rc));
         return rc;
     }
 
@@ -578,8 +475,7 @@ static int vboxGuestBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *
 /**
  * Inflate/deflate the memory balloon and notify the host.
  *
- * This is a worker used by VBoxGuestCommonIOCtl_CheckMemoryBalloon - it takes
- * the mutex.
+ * This is a worker used by vbgdIoCtl_CheckMemoryBalloon - it takes the mutex.
  *
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
@@ -588,7 +484,7 @@ static int vboxGuestBalloonDeflate(PRTR0MEMOBJ pMemObj, VMMDevChangeMemBalloon *
  * @param   pfHandleInR3    Where to return the handle-in-ring3 indicator
  *                          (VINF_SUCCESS if set).
  */
-static int vboxGuestSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonChunks, uint32_t *pfHandleInR3)
+static int vbgdSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBalloonChunks, uint32_t *pfHandleInR3)
 {
     int rc = VINF_SUCCESS;
 
@@ -599,7 +495,7 @@ static int vboxGuestSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBal
 
         if (cBalloonChunks > pDevExt->MemBalloon.cMaxChunks)
         {
-            LogRel(("vboxGuestSetBalloonSizeKernel: illegal balloon size %u (max=%u)\n",
+            LogRel(("vbgdSetBalloonSizeKernel: illegal balloon size %u (max=%u)\n",
                     cBalloonChunks, pDevExt->MemBalloon.cMaxChunks));
             return VERR_INVALID_PARAMETER;
         }
@@ -613,12 +509,12 @@ static int vboxGuestSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBal
             pDevExt->MemBalloon.paMemObj = (PRTR0MEMOBJ)RTMemAllocZ(sizeof(RTR0MEMOBJ) * pDevExt->MemBalloon.cMaxChunks);
             if (!pDevExt->MemBalloon.paMemObj)
             {
-                LogRel(("vboxGuestSetBalloonSizeKernel: no memory for paMemObj!\n"));
+                LogRel(("vbgdSetBalloonSizeKernel: no memory for paMemObj!\n"));
                 return VERR_NO_MEMORY;
             }
         }
 
-        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
+        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
         if (RT_FAILURE(rc))
             return rc;
 
@@ -645,7 +541,7 @@ static int vboxGuestSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBal
                     break;
                 }
 
-                rc = vboxGuestBalloonInflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
+                rc = vbgdBalloonInflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
                 if (RT_FAILURE(rc))
                 {
                     Log(("vboxGuestSetBalloonSize(inflate): failed, rc=%Rrc!\n", rc));
@@ -661,7 +557,7 @@ static int vboxGuestSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBal
             /* deflate */
             for (i = pDevExt->MemBalloon.cChunks; i-- > cBalloonChunks;)
             {
-                rc = vboxGuestBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
+                rc = vbgdBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
                 if (RT_FAILURE(rc))
                 {
                     Log(("vboxGuestSetBalloonSize(deflate): failed, rc=%Rrc!\n", rc));
@@ -685,32 +581,9 @@ static int vboxGuestSetBalloonSizeKernel(PVBOXGUESTDEVEXT pDevExt, uint32_t cBal
 
 
 /**
- * Helper to reinit the VBoxVMM communication after hibernation.
- *
- * @returns VBox status code.
- * @param   pDevExt         The device extension.
- * @param   enmOSType       The OS type.
- */
-int VBoxGuestReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType)
-{
-    int rc = VBoxGuestReportGuestInfo(enmOSType);
-    if (RT_SUCCESS(rc))
-    {
-        rc = VBoxGuestReportDriverStatus(true /* Driver is active */);
-        if (RT_FAILURE(rc))
-            Log(("VBoxGuestReinitDevExtAfterHibernation: could not report guest driver status, rc=%Rrc\n", rc));
-    }
-    else
-        Log(("VBoxGuestReinitDevExtAfterHibernation: could not report guest information to host, rc=%Rrc\n", rc));
-    LogFlow(("VBoxGuestReinitDevExtAfterHibernation: returned with rc=%Rrc\n", rc));
-    return rc;
-}
-
-
-/**
  * Inflate/deflate the balloon by one chunk.
  *
- * Worker for VBoxGuestCommonIOCtl_ChangeMemoryBalloon - it takes the mutex.
+ * Worker for vbgdIoCtl_ChangeMemoryBalloon - it takes the mutex.
  *
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
@@ -719,8 +592,7 @@ int VBoxGuestReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE e
  *                          balloon.
  * @param   fInflate        Inflate if true, deflate if false.
  */
-static int vboxGuestSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                           uint64_t u64ChunkAddr, bool fInflate)
+static int vbgdSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint64_t u64ChunkAddr, bool fInflate)
 {
     VMMDevChangeMemBalloon *pReq;
     int rc = VINF_SUCCESS;
@@ -790,7 +662,7 @@ static int vboxGuestSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
     /*
      * Try inflate / default the balloon as requested.
      */
-    rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
+    rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
     if (RT_FAILURE(rc))
         return rc;
 
@@ -800,7 +672,7 @@ static int vboxGuestSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
                                 RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS);
         if (RT_SUCCESS(rc))
         {
-            rc = vboxGuestBalloonInflate(pMemObj, pReq);
+            rc = vbgdBalloonInflate(pMemObj, pReq);
             if (RT_SUCCESS(rc))
                 pDevExt->MemBalloon.cChunks++;
             else
@@ -813,7 +685,7 @@ static int vboxGuestSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
     }
     else
     {
-        rc = vboxGuestBalloonDeflate(pMemObj, pReq);
+        rc = vbgdBalloonDeflate(pMemObj, pReq);
         if (RT_SUCCESS(rc))
             pDevExt->MemBalloon.cChunks--;
         else
@@ -834,7 +706,7 @@ static int vboxGuestSetBalloonSizeFromUser(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
  * @param   pDevExt     The device extension.
  * @param   pDevExt     The session.  Can be NULL at unload.
  */
-static void vboxGuestCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+static void vbgdCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
     RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);
     if (    pDevExt->MemBalloon.pOwner == pSession
@@ -843,16 +715,16 @@ static void vboxGuestCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
         if (pDevExt->MemBalloon.paMemObj)
         {
             VMMDevChangeMemBalloon *pReq;
-            int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
+            int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, g_cbChangeMemBalloonReq, VMMDevReq_ChangeMemBalloon);
             if (RT_SUCCESS(rc))
             {
                 uint32_t i;
                 for (i = pDevExt->MemBalloon.cChunks; i-- > 0;)
                 {
-                    rc = vboxGuestBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
+                    rc = vbgdBalloonDeflate(&pDevExt->MemBalloon.paMemObj[i], pReq);
                     if (RT_FAILURE(rc))
                     {
-                        LogRel(("vboxGuestCloseMemBalloon: Deflate failed with rc=%Rrc.  Will leak %u chunks.\n",
+                        LogRel(("vbgdCloseMemBalloon: Deflate failed with rc=%Rrc.  Will leak %u chunks.\n",
                                 rc, pDevExt->MemBalloon.cChunks));
                         break;
                     }
@@ -862,7 +734,7 @@ static void vboxGuestCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
                 VbglGRFree(&pReq->header);
             }
             else
-                LogRel(("vboxGuestCloseMemBalloon: Failed to allocate VMMDev request buffer (rc=%Rrc).  Will leak %u chunks.\n",
+                LogRel(("vbgdCloseMemBalloon: Failed to allocate VMMDev request buffer (rc=%Rrc).  Will leak %u chunks.\n",
                         rc, pDevExt->MemBalloon.cChunks));
             RTMemFree(pDevExt->MemBalloon.paMemObj);
             pDevExt->MemBalloon.paMemObj = NULL;
@@ -873,60 +745,214 @@ static void vboxGuestCloseMemBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION
     RTSemFastMutexRelease(pDevExt->MemBalloon.hMtx);
 }
 
+/** @} */
+
+
+
+/** @name Heartbeat
+ * @{
+ */
 
 /**
- * Initializes the VBoxGuest device extension when the
- * device driver is loaded.
- *
- * The native code locates the VMMDev on the PCI bus and retrieve
- * the MMIO and I/O port ranges, this function will take care of
- * mapping the MMIO memory (if present). Upon successful return
- * the native code should set up the interrupt handler.
+ * Sends heartbeat to host.
  *
  * @returns VBox status code.
- *
- * @param   pDevExt         The device extension. Allocated by the native code.
- * @param   IOPortBase      The base of the I/O port range.
- * @param   pvMMIOBase      The base of the MMIO memory mapping.
- *                          This is optional, pass NULL if not present.
- * @param   cbMMIO          The size of the MMIO memory mapping.
- *                          This is optional, pass 0 if not present.
- * @param   enmOSType       The guest OS type to report to the VMMDev.
- * @param   fFixedEvents    Events that will be enabled upon init and no client
- *                          will ever be allowed to mask.
  */
-int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
-                        void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fFixedEvents)
+static int vbgdHeartbeatSend(PVBOXGUESTDEVEXT pDevExt)
 {
-    int rc, rc2;
+    int rc;
+    if (pDevExt->pReqGuestHeartbeat)
+    {
+        rc = VbglGRPerform(pDevExt->pReqGuestHeartbeat);
+        Log(("vbgdHeartbeatSend: VbglGRPerform vbgdHeartbeatSend completed with rc=%Rrc\n", rc));
+    }
+    else
+        rc = VERR_INVALID_STATE;
+    return rc;
+}
 
-#ifdef VBOX_GUESTDRV_WITH_RELEASE_LOGGER
-    /*
-     * Create the release log.
-     */
-    static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
-    PRTLOGGER pRelLogger;
-    rc = RTLogCreate(&pRelLogger, 0 /*fFlags*/, "all", "VBOXGUEST_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups,
-                     RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER, NULL);
+
+/**
+ * Callback for heartbeat timer.
+ */
+static DECLCALLBACK(void) vbgdHeartbeatTimerHandler(PRTTIMER hTimer, void *pvUser, uint64_t iTick)
+{
+    PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
+    int rc;
+    AssertReturnVoid(pDevExt);
+
+    rc = vbgdHeartbeatSend(pDevExt);
+    if (RT_FAILURE(rc))
+        Log(("HB Timer: vbgdHeartbeatSend failed: rc=%Rrc\n", rc));
+
+    NOREF(hTimer); NOREF(iTick);
+}
+
+
+/**
+ * Configure the host to check guest's heartbeat
+ * and get heartbeat interval from the host.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         The device extension.
+ * @param   fEnabled        Set true to enable guest heartbeat checks on host.
+ */
+static int vbgdHeartbeatHostConfigure(PVBOXGUESTDEVEXT pDevExt, bool fEnabled)
+{
+    VMMDevReqHeartbeat *pReq;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_HeartbeatConfigure);
+    Log(("vbgdHeartbeatHostConfigure: VbglGRAlloc vbgdHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
     if (RT_SUCCESS(rc))
-        RTLogRelSetDefaultInstance(pRelLogger);
-    /** @todo Add native hook for getting logger config parameters and setting
-     *        them.  On linux we should use the module parameter stuff... */
-#endif
+    {
+        pReq->fEnabled = fEnabled;
+        pReq->cNsInterval = 0;
+        rc = VbglGRPerform(&pReq->header);
+        Log(("vbgdHeartbeatHostConfigure: VbglGRPerform vbgdHeartbeatHostConfigure completed with rc=%Rrc\n", rc));
+        pDevExt->cNsHeartbeatInterval = pReq->cNsInterval;
+        VbglGRFree(&pReq->header);
+    }
+    return rc;
+}
 
-    /*
-     * Adjust fFixedEvents.
-     */
-#ifdef VBOX_WITH_HGCM
-    fFixedEvents |= VMMDEV_EVENT_HGCM;
-#endif
 
+/**
+ * Initializes the heartbeat timer.
+ *
+ * This feature may be disabled by the host.
+ *
+ * @returns VBox status (ignored).
+ * @param   pDevExt             The device extension.
+ */
+static int vbgdHeartbeatInit(PVBOXGUESTDEVEXT pDevExt)
+{
     /*
-     * Initialize the data.
+     * Make sure that heartbeat checking is disabled.
      */
-    pDevExt->IOPortBase = IOPortBase;
-    pDevExt->pVMMDevMemory = NULL;
-    pDevExt->fFixedEvents = fFixedEvents;
+    int rc = vbgdHeartbeatHostConfigure(pDevExt, false);
+    if (RT_SUCCESS(rc))
+    {
+        rc = vbgdHeartbeatHostConfigure(pDevExt, true);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Preallocate the request to use it from the timer callback because:
+             *    1) on Windows VbglGRAlloc must be called at IRQL <= APC_LEVEL
+             *       and the timer callback runs at DISPATCH_LEVEL;
+             *    2) avoid repeated allocations.
+             */
+            rc = VbglGRAlloc(&pDevExt->pReqGuestHeartbeat, sizeof(*pDevExt->pReqGuestHeartbeat), VMMDevReq_GuestHeartbeat);
+            if (RT_SUCCESS(rc))
+            {
+                LogRel(("VbgdCommonInitDevExt: Setting up heartbeat to trigger every %RU64 milliseconds\n",
+                        pDevExt->cNsHeartbeatInterval / RT_NS_1MS));
+                rc = RTTimerCreateEx(&pDevExt->pHeartbeatTimer, pDevExt->cNsHeartbeatInterval, 0 /*fFlags*/,
+                                     (PFNRTTIMER)vbgdHeartbeatTimerHandler, pDevExt);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = RTTimerStart(pDevExt->pHeartbeatTimer, 0);
+                    if (RT_SUCCESS(rc))
+                        return VINF_SUCCESS;
+
+                    LogRel(("VbgdCommonInitDevExt: Heartbeat timer failed to start, rc=%Rrc\n", rc));
+                }
+                else
+                    LogRel(("VbgdCommonInitDevExt: Failed to create heartbeat timer: %Rrc\n", rc));
+
+                VbglGRFree(pDevExt->pReqGuestHeartbeat);
+                pDevExt->pReqGuestHeartbeat = NULL;
+            }
+            else
+                LogRel(("VbgdCommonInitDevExt: VbglGRAlloc(VMMDevReq_GuestHeartbeat): %Rrc\n", rc));
+
+            LogRel(("VbgdCommonInitDevExt: Failed to set up the timer, guest heartbeat is disabled\n"));
+            vbgdHeartbeatHostConfigure(pDevExt, false);
+        }
+        else
+            LogRel(("VbgdCommonInitDevExt: Failed to configure host for heartbeat checking: rc=%Rrc\n", rc));
+    }
+    return rc;
+}
+
+/** @} */
+
+
+/**
+ * Helper to reinit the VMMDev communication after hibernation.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         The device extension.
+ * @param   enmOSType       The OS type.
+ *
+ * @todo Call this on all platforms, not just windows.
+ */
+int VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType)
+{
+    int rc = vbgdReportGuestInfo(enmOSType);
+    if (RT_SUCCESS(rc))
+    {
+        rc = vbgdReportDriverStatus(true /* Driver is active */);
+        if (RT_FAILURE(rc))
+            Log(("VbgdCommonReinitDevExtAfterHibernation: could not report guest driver status, rc=%Rrc\n", rc));
+    }
+    else
+        Log(("VbgdCommonReinitDevExtAfterHibernation: could not report guest information to host, rc=%Rrc\n", rc));
+    LogFlow(("VbgdCommonReinitDevExtAfterHibernation: returned with rc=%Rrc\n", rc));
+    return rc;
+}
+
+
+/**
+ * Initializes the VBoxGuest device extension when the
+ * device driver is loaded.
+ *
+ * The native code locates the VMMDev on the PCI bus and retrieve
+ * the MMIO and I/O port ranges, this function will take care of
+ * mapping the MMIO memory (if present). Upon successful return
+ * the native code should set up the interrupt handler.
+ *
+ * @returns VBox status code.
+ *
+ * @param   pDevExt         The device extension. Allocated by the native code.
+ * @param   IOPortBase      The base of the I/O port range.
+ * @param   pvMMIOBase      The base of the MMIO memory mapping.
+ *                          This is optional, pass NULL if not present.
+ * @param   cbMMIO          The size of the MMIO memory mapping.
+ *                          This is optional, pass 0 if not present.
+ * @param   enmOSType       The guest OS type to report to the VMMDev.
+ * @param   fFixedEvents    Events that will be enabled upon init and no client
+ *                          will ever be allowed to mask.
+ */
+int VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
+                         void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fFixedEvents)
+{
+    int rc, rc2;
+
+#ifdef VBOX_GUESTDRV_WITH_RELEASE_LOGGER
+    /*
+     * Create the release log.
+     */
+    static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
+    PRTLOGGER pRelLogger;
+    rc = RTLogCreate(&pRelLogger, 0 /*fFlags*/, "all", "VBOXGUEST_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups,
+                     RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER, NULL);
+    if (RT_SUCCESS(rc))
+        RTLogRelSetDefaultInstance(pRelLogger);
+    /** @todo Add native hook for getting logger config parameters and setting
+     *        them.  On linux we should use the module parameter stuff... */
+#endif
+
+    /*
+     * Adjust fFixedEvents.
+     */
+#ifdef VBOX_WITH_HGCM
+    fFixedEvents |= VMMDEV_EVENT_HGCM;
+#endif
+
+    /*
+     * Initialize the data.
+     */
+    pDevExt->IOPortBase = IOPortBase;
+    pDevExt->pVMMDevMemory = NULL;
     pDevExt->hGuestMappings = NIL_RTR0MEMOBJ;
     pDevExt->EventSpinlock = NIL_RTSPINLOCK;
     pDevExt->pIrqAckEvents = NULL;
@@ -941,6 +967,7 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
     RTListInit(&pDevExt->WokenUpList);
     RTListInit(&pDevExt->FreeList);
     RTListInit(&pDevExt->SessionList);
+    pDevExt->cSessions = 0;
     pDevExt->fLoggingEnabled = false;
     pDevExt->f32PendingEvents = 0;
     pDevExt->u32MousePosChangedSeq = 0;
@@ -953,6 +980,20 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
     pDevExt->MemBalloon.pOwner = NULL;
     pDevExt->MouseNotifyCallback.pfnNotify = NULL;
     pDevExt->MouseNotifyCallback.pvUser = NULL;
+    pDevExt->pReqGuestHeartbeat = NULL;
+
+    pDevExt->fFixedEvents = fFixedEvents;
+    vbgdBitUsageTrackerClear(&pDevExt->EventFilterTracker);
+    pDevExt->fEventFilterHost = UINT32_MAX;  /* forces a report */
+
+    vbgdBitUsageTrackerClear(&pDevExt->MouseStatusTracker);
+    pDevExt->fMouseStatusHost = UINT32_MAX;  /* forces a report */
+
+    pDevExt->fAcquireModeGuestCaps = 0;
+    pDevExt->fSetModeGuestCaps = 0;
+    pDevExt->fAcquiredGuestCaps = 0;
+    vbgdBitUsageTrackerClear(&pDevExt->SetGuestCapsTracker);
+    pDevExt->fGuestCapsHost = UINT32_MAX; /* forces a report */
 
     /*
      * If there is an MMIO region validate the version and size.
@@ -966,18 +1007,14 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
             &&  pVMMDev->u32Size <= cbMMIO)
         {
             pDevExt->pVMMDevMemory = pVMMDev;
-            Log(("VBoxGuestInitDevExt: VMMDevMemory: mapping=%p size=%#RX32 (%#RX32) version=%#RX32\n",
+            Log(("VbgdCommonInitDevExt: VMMDevMemory: mapping=%p size=%#RX32 (%#RX32) version=%#RX32\n",
                  pVMMDev, pVMMDev->u32Size, cbMMIO, pVMMDev->u32Version));
         }
         else /* try live without it. */
-            LogRel(("VBoxGuestInitDevExt: Bogus VMMDev memory; u32Version=%RX32 (expected %RX32) u32Size=%RX32 (expected <= %RX32)\n",
+            LogRel(("VbgdCommonInitDevExt: Bogus VMMDev memory; u32Version=%RX32 (expected %RX32) u32Size=%RX32 (expected <= %RX32)\n",
                     pVMMDev->u32Version, VMMDEV_MEMORY_VERSION, pVMMDev->u32Size, cbMMIO));
     }
 
-    pDevExt->u32AcquireModeGuestCaps = 0;
-    pDevExt->u32SetModeGuestCaps = 0;
-    pDevExt->u32GuestCaps = 0;
-
     /*
      * Create the wait and session spinlocks as well as the ballooning mutex.
      */
@@ -986,7 +1023,7 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
         rc = RTSpinlockCreate(&pDevExt->SessionSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxGuestSession");
     if (RT_FAILURE(rc))
     {
-        LogRel(("VBoxGuestInitDevExt: failed to create spinlock, rc=%Rrc!\n", rc));
+        LogRel(("VbgdCommonInitDevExt: failed to create spinlock, rc=%Rrc!\n", rc));
         if (pDevExt->EventSpinlock != NIL_RTSPINLOCK)
             RTSpinlockDestroy(pDevExt->EventSpinlock);
         return rc;
@@ -995,7 +1032,7 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
     rc = RTSemFastMutexCreate(&pDevExt->MemBalloon.hMtx);
     if (RT_FAILURE(rc))
     {
-        LogRel(("VBoxGuestInitDevExt: failed to create mutex, rc=%Rrc!\n", rc));
+        LogRel(("VbgdCommonInitDevExt: failed to create mutex, rc=%Rrc!\n", rc));
         RTSpinlockDestroy(pDevExt->SessionSpinlock);
         RTSpinlockDestroy(pDevExt->EventSpinlock);
         return rc;
@@ -1015,40 +1052,57 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
             pDevExt->PhysIrqAckEvents = VbglPhysHeapGetPhysAddr(pDevExt->pIrqAckEvents);
             Assert(pDevExt->PhysIrqAckEvents != 0);
 
-            rc = VBoxGuestReportGuestInfo(enmOSType);
+            rc = vbgdReportGuestInfo(enmOSType);
             if (RT_SUCCESS(rc))
             {
-                /* Set the fixed event and disable the guest graphics capability
-                 * by default. The guest specific graphics driver will re-enable
-                 * the graphics capability if and when appropriate. */
-                rc = vboxGuestUpdateHostFlags(pDevExt, NULL,
-                                                HostFlags_FilterMask
-                                              | HostFlags_Capabilities);
+                /*
+                 * Set the fixed event and make sure the host doesn't have any lingering
+                 * the guest capabilities or mouse status bits set.
+                 */
+                rc = vbgdResetEventFilterOnHost(pDevExt, pDevExt->fFixedEvents);
                 if (RT_SUCCESS(rc))
                 {
-                    vboxGuestInitFixateGuestMappings(pDevExt);
-
-                    rc = VBoxGuestReportDriverStatus(true /* Driver is active */);
-                    if (RT_FAILURE(rc))
-                        LogRel(("VBoxGuestInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc));
-
-                    LogFlowFunc(("VBoxGuestInitDevExt: returns success\n"));
-                    return VINF_SUCCESS;
+                    rc = vbgdResetCapabilitiesOnHost(pDevExt);
+                    if (RT_SUCCESS(rc))
+                    {
+                        rc = vbgdResetMouseStatusOnHost(pDevExt);
+                        if (RT_SUCCESS(rc))
+                        {
+                            /*
+                             * Initialize stuff which may fail without requiring the driver init to fail.
+                             */
+                            vbgdInitFixateGuestMappings(pDevExt);
+                            vbgdHeartbeatInit(pDevExt);
+
+                            /*
+                             * Done!
+                             */
+                            rc = vbgdReportDriverStatus(true /* Driver is active */);
+                            if (RT_FAILURE(rc))
+                                LogRel(("VbgdCommonInitDevExt: VBoxReportGuestDriverStatus failed, rc=%Rrc\n", rc));
+
+                            LogFlowFunc(("VbgdCommonInitDevExt: returns success\n"));
+                            return VINF_SUCCESS;
+                        }
+                        LogRel(("VbgdCommonInitDevExt: failed to clear mouse status: rc=%Rrc\n", rc));
+                    }
+                    else
+                        LogRel(("VbgdCommonInitDevExt: failed to clear guest capabilities: rc=%Rrc\n", rc));
                 }
-
-                LogRel(("VBoxGuestInitDevExt: failed to set host flags, rc=%Rrc\n", rc));
+                else
+                    LogRel(("VbgdCommonInitDevExt: failed to set fixed event filter: rc=%Rrc\n", rc));
             }
             else
-                LogRel(("VBoxGuestInitDevExt: VBoxReportGuestInfo failed, rc=%Rrc\n", rc));
+                LogRel(("VbgdCommonInitDevExt: VBoxReportGuestInfo failed: rc=%Rrc\n", rc));
             VbglGRFree((VMMDevRequestHeader *)pDevExt->pIrqAckEvents);
         }
         else
-            LogRel(("VBoxGuestInitDevExt: VBoxGRAlloc failed, rc=%Rrc\n", rc));
+            LogRel(("VbgdCommonInitDevExt: VBoxGRAlloc failed: rc=%Rrc\n", rc));
 
         VbglTerminate();
     }
     else
-        LogRel(("VBoxGuestInitDevExt: VbglInit failed, rc=%Rrc\n", rc));
+        LogRel(("VbgdCommonInitDevExt: VbglInit failed: rc=%Rrc\n", rc));
 
     rc2 = RTSemFastMutexDestroy(pDevExt->MemBalloon.hMtx); AssertRC(rc2);
     rc2 = RTSpinlockDestroy(pDevExt->EventSpinlock); AssertRC(rc2);
@@ -1066,7 +1120,7 @@ int VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase,
  * Deletes all the items in a wait chain.
  * @param   pList       The head of the chain.
  */
-static void VBoxGuestDeleteWaitList(PRTLISTNODE pList)
+static void vbgdDeleteWaitList(PRTLISTNODE pList)
 {
     while (!RTListIsEmpty(pList))
     {
@@ -1090,16 +1144,29 @@ static void VBoxGuestDeleteWaitList(PRTLISTNODE pList)
  *
  * @param   pDevExt         The device extension.
  */
-void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
+void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
 {
     int rc2;
-    Log(("VBoxGuestDeleteDevExt:\n"));
+    Log(("VbgdCommonDeleteDevExt:\n"));
     Log(("VBoxGuest: The additions driver is terminating.\n"));
 
     /*
+     * Stop and destroy HB timer and
+     * disable host heartbeat checking.
+     */
+    if (pDevExt->pHeartbeatTimer)
+    {
+        RTTimerDestroy(pDevExt->pHeartbeatTimer);
+        vbgdHeartbeatHostConfigure(pDevExt, false);
+    }
+
+    VbglGRFree(pDevExt->pReqGuestHeartbeat);
+    pDevExt->pReqGuestHeartbeat = NULL;
+
+    /*
      * Clean up the bits that involves the host first.
      */
-    vboxGuestTermUnfixGuestMappings(pDevExt);
+    vbgdTermUnfixGuestMappings(pDevExt);
     if (!RTListIsEmpty(&pDevExt->SessionList))
     {
         LogRelFunc(("session list not empty!\n"));
@@ -1107,8 +1174,11 @@ void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
     }
     /* Update the host flags (mouse status etc) not to reflect this session. */
     pDevExt->fFixedEvents = 0;
-    vboxGuestUpdateHostFlags(pDevExt, NULL, HostFlags_All);
-    vboxGuestCloseMemBalloon(pDevExt, (PVBOXGUESTSESSION)NULL);
+    vbgdResetEventFilterOnHost(pDevExt, 0 /*fFixedEvents*/);
+    vbgdResetCapabilitiesOnHost(pDevExt);
+    vbgdResetMouseStatusOnHost(pDevExt);
+
+    vbgdCloseMemBalloon(pDevExt, (PVBOXGUESTSESSION)NULL);
 
     /*
      * Cleanup all the other resources.
@@ -1117,15 +1187,15 @@ void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
     rc2 = RTSpinlockDestroy(pDevExt->SessionSpinlock); AssertRC(rc2);
     rc2 = RTSemFastMutexDestroy(pDevExt->MemBalloon.hMtx); AssertRC(rc2);
 
-    VBoxGuestDeleteWaitList(&pDevExt->WaitList);
+    vbgdDeleteWaitList(&pDevExt->WaitList);
 #ifdef VBOX_WITH_HGCM
-    VBoxGuestDeleteWaitList(&pDevExt->HGCMWaitList);
+    vbgdDeleteWaitList(&pDevExt->HGCMWaitList);
 #endif
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-    VBoxGuestDeleteWaitList(&pDevExt->WakeUpList);
+    vbgdDeleteWaitList(&pDevExt->WakeUpList);
 #endif
-    VBoxGuestDeleteWaitList(&pDevExt->WokenUpList);
-    VBoxGuestDeleteWaitList(&pDevExt->FreeList);
+    vbgdDeleteWaitList(&pDevExt->WokenUpList);
+    vbgdDeleteWaitList(&pDevExt->FreeList);
 
     VbglTerminate();
 
@@ -1146,18 +1216,18 @@ void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt)
  * Creates a VBoxGuest user session.
  *
  * The native code calls this when a ring-3 client opens the device.
- * Use VBoxGuestCreateKernelSession when a ring-0 client connects.
+ * Use VbgdCommonCreateKernelSession when a ring-0 client connects.
  *
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
  * @param   ppSession       Where to store the session on success.
  */
-int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
+int VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
 {
     PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)RTMemAllocZ(sizeof(*pSession));
     if (RT_UNLIKELY(!pSession))
     {
-        LogRel(("VBoxGuestCreateUserSession: no memory!\n"));
+        LogRel(("VbgdCommonCreateUserSession: no memory!\n"));
         return VERR_NO_MEMORY;
     }
 
@@ -1166,10 +1236,11 @@ int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSe
     pSession->pDevExt = pDevExt;
     RTSpinlockAcquire(pDevExt->SessionSpinlock);
     RTListAppend(&pDevExt->SessionList, &pSession->ListNode);
+    pDevExt->cSessions++;
     RTSpinlockRelease(pDevExt->SessionSpinlock);
 
     *ppSession = pSession;
-    LogFlow(("VBoxGuestCreateUserSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
+    LogFlow(("VbgdCommonCreateUserSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
              pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
     return VINF_SUCCESS;
 }
@@ -1179,18 +1250,18 @@ int VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSe
  * Creates a VBoxGuest kernel session.
  *
  * The native code calls this when a ring-0 client connects to the device.
- * Use VBoxGuestCreateUserSession when a ring-3 client opens the device.
+ * Use VbgdCommonCreateUserSession when a ring-3 client opens the device.
  *
  * @returns VBox status code.
  * @param   pDevExt         The device extension.
  * @param   ppSession       Where to store the session on success.
  */
-int VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
+int VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession)
 {
     PVBOXGUESTSESSION pSession = (PVBOXGUESTSESSION)RTMemAllocZ(sizeof(*pSession));
     if (RT_UNLIKELY(!pSession))
     {
-        LogRel(("VBoxGuestCreateKernelSession: no memory!\n"));
+        LogRel(("VbgdCommonCreateKernelSession: no memory!\n"));
         return VERR_NO_MEMORY;
     }
 
@@ -1199,15 +1270,15 @@ int VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *pp
     pSession->pDevExt = pDevExt;
     RTSpinlockAcquire(pDevExt->SessionSpinlock);
     RTListAppend(&pDevExt->SessionList, &pSession->ListNode);
+    pDevExt->cSessions++;
     RTSpinlockRelease(pDevExt->SessionSpinlock);
 
     *ppSession = pSession;
-    LogFlow(("VBoxGuestCreateKernelSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
+    LogFlow(("VbgdCommonCreateKernelSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
              pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
     return VINF_SUCCESS;
 }
 
-static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
 
 /**
  * Closes a VBoxGuest session.
@@ -1215,18 +1286,25 @@ static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PV
  * @param   pDevExt         The device extension.
  * @param   pSession        The session to close (and free).
  */
-void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
-    unsigned i; NOREF(i);
-    LogFlow(("VBoxGuestCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
+#ifdef VBOX_WITH_HGCM
+    unsigned i;
+#endif
+    LogFlow(("VbgdCommonCloseSession: pSession=%p proc=%RTproc (%d) r0proc=%p\n",
              pSession, pSession->Process, (int)pSession->Process, (uintptr_t)pSession->R0Process)); /** @todo %RTr0proc */
 
     RTSpinlockAcquire(pDevExt->SessionSpinlock);
     RTListNodeRemove(&pSession->ListNode);
+    pDevExt->cSessions--;
     RTSpinlockRelease(pDevExt->SessionSpinlock);
-    VBoxGuestCommonGuestCapsAcquire(pDevExt, pSession, 0, UINT32_MAX, VBOXGUESTCAPSACQUIRE_FLAGS_NONE);
+    vbgdAcquireSessionCapabilities(pDevExt, pSession, 0, UINT32_MAX, VBOXGUESTCAPSACQUIRE_FLAGS_NONE,
+                                   true /*fSessionTermination*/);
+    vbgdSetSessionCapabilities(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
+    vbgdSetSessionEventFilter(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
+    vbgdSetSessionMouseStatus(pDevExt, pSession, 0 /*fOrMask*/, UINT32_MAX /*fNotMask*/, true /*fSessionTermination*/);
 
-    VBoxGuestCommonIOCtl_CancelAllWaitEvents(pDevExt, pSession);
+    vbgdIoCtl_CancelAllWaitEvents(pDevExt, pSession);
 
 #ifdef VBOX_WITH_HGCM
     for (i = 0; i < RT_ELEMENTS(pSession->aHGCMClientIds); i++)
@@ -1236,22 +1314,16 @@ void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
             Info.result = 0;
             Info.u32ClientID = pSession->aHGCMClientIds[i];
             pSession->aHGCMClientIds[i] = 0;
-            Log(("VBoxGuestCloseSession: disconnecting client id %#RX32\n", Info.u32ClientID));
-            VbglR0HGCMInternalDisconnect(&Info, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
+            Log(("VbgdCommonCloseSession: disconnecting client id %#RX32\n", Info.u32ClientID));
+            VbglR0HGCMInternalDisconnect(&Info, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
         }
 #endif
 
     pSession->pDevExt = NULL;
     pSession->Process = NIL_RTPROCESS;
     pSession->R0Process = NIL_RTR0PROCESS;
-    vboxGuestCloseMemBalloon(pDevExt, pSession);
+    vbgdCloseMemBalloon(pDevExt, pSession);
     RTMemFree(pSession);
-    /* Update the host flags (mouse status etc) not to reflect this session. */
-    vboxGuestUpdateHostFlags(pDevExt, NULL, HostFlags_All
-#ifdef RT_OS_WINDOWS
-                & (~HostFlags_MouseStatus)
-#endif
-            );
 }
 
 
@@ -1262,7 +1334,7 @@ void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
  * @param   pDevExt         The device extension.
  * @param   pSession        The session that's allocating this. Can be NULL.
  */
-static PVBOXGUESTWAIT VBoxGuestWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+static PVBOXGUESTWAIT vbgdWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
     /*
      * Allocate it one way or the other.
@@ -1285,14 +1357,14 @@ static PVBOXGUESTWAIT VBoxGuestWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
         pWait = (PVBOXGUESTWAIT)RTMemAlloc(sizeof(*pWait));
         if (!pWait)
         {
-            LogRelMax(32, ("VBoxGuestWaitAlloc: out-of-memory!\n"));
+            LogRelMax(32, ("vbgdWaitAlloc: out-of-memory!\n"));
             return NULL;
         }
 
         rc = RTSemEventMultiCreate(&pWait->Event);
         if (RT_FAILURE(rc))
         {
-            LogRelMax(32, ("VBoxGuestCommonIOCtl: RTSemEventMultiCreate failed with rc=%Rrc!\n", rc));
+            LogRelMax(32, ("VbgdCommonIoCtl: RTSemEventMultiCreate failed with rc=%Rrc!\n", rc));
             RTMemFree(pWait);
             return NULL;
         }
@@ -1328,7 +1400,7 @@ static PVBOXGUESTWAIT VBoxGuestWaitAlloc(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
  * @param   pDevExt         The device extension.
  * @param   pWait           The wait-for-event entry to free.
  */
-static void VBoxGuestWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
+static void vbgdWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
 {
     pWait->fReqEvents = 0;
     pWait->fResEvents = 0;
@@ -1354,10 +1426,10 @@ static void VBoxGuestWaitFreeLocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWa
  * @param   pDevExt         The device extension.
  * @param   pWait           The wait-for-event entry to free.
  */
-static void VBoxGuestWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
+static void vbgdWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT pWait)
 {
     RTSpinlockAcquire(pDevExt->EventSpinlock);
-    VBoxGuestWaitFreeLocked(pDevExt, pWait);
+    vbgdWaitFreeLocked(pDevExt, pWait);
     RTSpinlockRelease(pDevExt->EventSpinlock);
 }
 
@@ -1371,7 +1443,7 @@ static void VBoxGuestWaitFreeUnlocked(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTWAIT p
  *
  * @param   pDevExt         The device extension.
  */
-void VBoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
+void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
 {
     if (!RTListIsEmpty(&pDevExt->WakeUpList))
     {
@@ -1398,7 +1470,7 @@ void VBoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
             else
             {
                 pWait->fFreeMe = false;
-                VBoxGuestWaitFreeLocked(pDevExt, pWait);
+                vbgdWaitFreeLocked(pDevExt, pWait);
             }
         }
         RTSpinlockRelease(pDevExt->EventSpinlock);
@@ -1408,38 +1480,6 @@ void VBoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt)
 
 
 /**
- * Modifies the guest capabilities.
- *
- * Should be called during driver init and termination.
- *
- * @returns VBox status code.
- * @param   fOr             The Or mask (what to enable).
- * @param   fNot            The Not mask (what to disable).
- */
-int VBoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot)
-{
-    VMMDevReqGuestCapabilities2 *pReq;
-    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetGuestCapabilities);
-    if (RT_FAILURE(rc))
-    {
-        Log(("VBoxGuestSetGuestCapabilities: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
-             sizeof(*pReq), sizeof(*pReq), rc));
-        return rc;
-    }
-
-    pReq->u32OrMask = fOr;
-    pReq->u32NotMask = fNot;
-
-    rc = VbglGRPerform(&pReq->header);
-    if (RT_FAILURE(rc))
-        Log(("VBoxGuestSetGuestCapabilities: VbglGRPerform failed, rc=%Rrc!\n", rc));
-
-    VbglGRFree(&pReq->header);
-    return rc;
-}
-
-
-/**
  * Implements the fast (no input or output) type of IOCtls.
  *
  * This is currently just a placeholder stub inherited from the support driver code.
@@ -1449,9 +1489,9 @@ int VBoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot)
  * @param   pDevExt     The device extension.
  * @param   pSession    The session.
  */
-int  VBoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+int  VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
-    LogFlow(("VBoxGuestCommonIOCtlFast: iFunction=%#x pDevExt=%p pSession=%p\n", iFunction, pDevExt, pSession));
+    LogFlow(("VbgdCommonIoCtlFast: iFunction=%#x pDevExt=%p pSession=%p\n", iFunction, pDevExt, pSession));
 
     NOREF(iFunction);
     NOREF(pDevExt);
@@ -1468,9 +1508,9 @@ int  VBoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBO
  * @param   pInfo           The request info.
  * @param   pcbDataReturned (out) contains the number of bytes to return.
  */
-static int VBoxGuestCommonIOCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *pInfo, size_t *pcbDataReturned)
+static int vbgdIoCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGuestPortInfo *pInfo, size_t *pcbDataReturned)
 {
-    LogFlow(("VBoxGuestCommonIOCtl: GETVMMDEVPORT\n"));
+    LogFlow(("VBOXGUEST_IOCTL_GETVMMDEVPORT\n"));
 
     pInfo->portAddress = pDevExt->IOPortBase;
     pInfo->pVMMDevMemory = (VMMDevMemory *)pDevExt->pVMMDevMemory;
@@ -1488,9 +1528,9 @@ static int VBoxGuestCommonIOCtl_GetVMMDevPort(PVBOXGUESTDEVEXT pDevExt, VBoxGues
  * @param   pDevExt         The device extension.
  * @param   pNotify         The new callback information.
  */
-int VBoxGuestCommonIOCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify)
+int vbgdIoCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGuestMouseSetNotifyCallback *pNotify)
 {
-    LogFlow(("VBoxGuestCommonIOCtl: SET_MOUSE_NOTIFY_CALLBACK\n"));
+    LogFlow(("VBOXGUEST_IOCTL_SET_MOUSE_NOTIFY_CALLBACK: pfnNotify=%p pvUser=%p\n", pNotify->pfnNotify, pNotify->pvUser));
 
     RTSpinlockAcquire(pDevExt->EventSpinlock);
     pDevExt->MouseNotifyCallback = *pNotify;
@@ -1501,26 +1541,29 @@ int VBoxGuestCommonIOCtl_SetMouseNotifyCallback(PVBOXGUESTDEVEXT pDevExt, VBoxGu
 
 
 /**
- * Worker VBoxGuestCommonIOCtl_WaitEvent.
+ * Worker vbgdIoCtl_WaitEvent.
  *
  * The caller enters the spinlock, we leave it.
  *
  * @returns VINF_SUCCESS if we've left the spinlock and can return immediately.
  */
-DECLINLINE(int) WaitEventCheckCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestWaitEventInfo *pInfo,
-                                        int iEvent, const uint32_t fReqEvents)
+DECLINLINE(int) vbdgCheckWaitEventCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                            VBoxGuestWaitEventInfo *pInfo, int iEvent, const uint32_t fReqEvents)
 {
-    uint32_t fMatches = VBoxGuestCommonGetAndCleanPendingEventsLocked(pDevExt, pSession, fReqEvents);
+    uint32_t fMatches = pDevExt->f32PendingEvents & fReqEvents;
+    if (fMatches & VBOXGUEST_ACQUIRE_STYLE_EVENTS)
+        fMatches &= vbgdGetAllowedEventMaskForSession(pDevExt, pSession);
     if (fMatches || pSession->fPendingCancelWaitEvents)
     {
+        ASMAtomicAndU32(&pDevExt->f32PendingEvents, ~fMatches);
         RTSpinlockRelease(pDevExt->EventSpinlock);
 
         pInfo->u32EventFlagsOut = fMatches;
         pInfo->u32Result = VBOXGUEST_WAITEVENT_OK;
         if (fReqEvents & ~((uint32_t)1 << iEvent))
-            LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));
+            LogFlow(("VBOXGUEST_IOCTL_WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));
         else
-            LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));
+            LogFlow(("VBOXGUEST_IOCTL_WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));
         pSession->fPendingCancelWaitEvents = false;
         return VINF_SUCCESS;
     }
@@ -1530,8 +1573,8 @@ DECLINLINE(int) WaitEventCheckCondition(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESS
 }
 
 
-static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                          VBoxGuestWaitEventInfo *pInfo,  size_t *pcbDataReturned, bool fInterruptible)
+static int vbgdIoCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                               VBoxGuestWaitEventInfo *pInfo,  size_t *pcbDataReturned, bool fInterruptible)
 {
     const uint32_t  fReqEvents = pInfo->u32EventMaskIn;
     uint32_t        fResEvents;
@@ -1550,7 +1593,7 @@ static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
     iEvent = ASMBitFirstSetU32(fReqEvents) - 1;
     if (RT_UNLIKELY(iEvent < 0))
     {
-        LogRel(("VBoxGuestCommonIOCtl: WAITEVENT: Invalid input mask %#x!!\n", fReqEvents));
+        LogRel(("VBOXGUEST_IOCTL_WAITEVENT: Invalid input mask %#x!!\n", fReqEvents));
         return VERR_INVALID_PARAMETER;
     }
 
@@ -1558,18 +1601,18 @@ static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
      * Check the condition up front, before doing the wait-for-event allocations.
      */
     RTSpinlockAcquire(pDevExt->EventSpinlock);
-    rc = WaitEventCheckCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
+    rc = vbdgCheckWaitEventCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
     if (rc == VINF_SUCCESS)
         return rc;
 
     if (!pInfo->u32TimeoutIn)
     {
         pInfo->u32Result = VBOXGUEST_WAITEVENT_TIMEOUT;
-        LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns VERR_TIMEOUT\n"));
+        LogFlow(("VBOXGUEST_IOCTL_WAITEVENT: returns VERR_TIMEOUT\n"));
         return VERR_TIMEOUT;
     }
 
-    pWait = VBoxGuestWaitAlloc(pDevExt, pSession);
+    pWait = vbgdWaitAlloc(pDevExt, pSession);
     if (!pWait)
         return VERR_NO_MEMORY;
     pWait->fReqEvents = fReqEvents;
@@ -1581,10 +1624,10 @@ static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
      */
     RTSpinlockAcquire(pDevExt->EventSpinlock);
     RTListAppend(&pDevExt->WaitList, &pWait->ListNode);
-    rc = WaitEventCheckCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
+    rc = vbdgCheckWaitEventCondition(pDevExt, pSession, pInfo, iEvent, fReqEvents);
     if (rc == VINF_SUCCESS)
     {
-        VBoxGuestWaitFreeUnlocked(pDevExt, pWait);
+        vbgdWaitFreeUnlocked(pDevExt, pWait);
         return rc;
     }
 
@@ -1608,7 +1651,7 @@ static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
      */
     RTSpinlockAcquire(pDevExt->EventSpinlock);
     fResEvents = pWait->fResEvents;
-    VBoxGuestWaitFreeLocked(pDevExt, pWait);
+    vbgdWaitFreeLocked(pDevExt, pWait);
     RTSpinlockRelease(pDevExt->EventSpinlock);
 
     /*
@@ -1620,9 +1663,9 @@ static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
         pInfo->u32EventFlagsOut = fResEvents;
         pInfo->u32Result = VBOXGUEST_WAITEVENT_OK;
         if (fReqEvents & ~((uint32_t)1 << iEvent))
-            LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));
+            LogFlow(("VBOXGUEST_IOCTL_WAITEVENT: returns %#x\n", pInfo->u32EventFlagsOut));
         else
-            LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));
+            LogFlow(("VBOXGUEST_IOCTL_WAITEVENT: returns %#x/%d\n", pInfo->u32EventFlagsOut, iEvent));
         rc = VINF_SUCCESS;
     }
     else if (   fResEvents == UINT32_MAX
@@ -1630,29 +1673,29 @@ static int VBoxGuestCommonIOCtl_WaitEvent(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSE
     {
         pInfo->u32Result = VBOXGUEST_WAITEVENT_INTERRUPTED;
         rc = VERR_INTERRUPTED;
-        LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns VERR_INTERRUPTED\n"));
+        LogFlow(("VBOXGUEST_IOCTL_WAITEVENT: returns VERR_INTERRUPTED\n"));
     }
     else if (rc == VERR_TIMEOUT)
     {
         pInfo->u32Result = VBOXGUEST_WAITEVENT_TIMEOUT;
-        LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns VERR_TIMEOUT (2)\n"));
+        LogFlow(("VBOXGUEST_IOCTL_WAITEVENT: returns VERR_TIMEOUT (2)\n"));
     }
     else
     {
         if (RT_SUCCESS(rc))
         {
-            LogRelMax(32, ("VBoxGuestCommonIOCtl: WAITEVENT: returns %Rrc but no events!\n", rc));
+            LogRelMax(32, ("VBOXGUEST_IOCTL_WAITEVENT: returns %Rrc but no events!\n", rc));
             rc = VERR_INTERNAL_ERROR;
         }
         pInfo->u32Result = VBOXGUEST_WAITEVENT_ERROR;
-        LogFlow(("VBoxGuestCommonIOCtl: WAITEVENT: returns %Rrc\n", rc));
+        LogFlow(("VBOXGUEST_IOCTL_WAITEVENT: returns %Rrc\n", rc));
     }
 
     return rc;
 }
 
 
-static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+static int vbgdIoCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
 {
     PVBOXGUESTWAIT          pWait;
     PVBOXGUESTWAIT          pSafe;
@@ -1663,7 +1706,7 @@ static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PV
      * WAITEVENT loop. */
     bool                    fCancelledOne = false;
 
-    LogFlow(("VBoxGuestCommonIOCtl: CANCEL_ALL_WAITEVENTS\n"));
+    LogFlow(("VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS\n"));
 
     /*
      * Walk the event list and wake up anyone with a matching session.
@@ -1691,12 +1734,13 @@ static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PV
     NOREF(rc);
 
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-    VBoxGuestWaitDoWakeUps(pDevExt);
+    VbgdCommonWaitDoWakeUps(pDevExt);
 #endif
 
     return VINF_SUCCESS;
 }
 
+
 /**
  * Checks if the VMM request is allowed in the context of the given session.
  *
@@ -1705,8 +1749,8 @@ static int VBoxGuestCommonIOCtl_CancelAllWaitEvents(PVBOXGUESTDEVEXT pDevExt, PV
  * @param   enmType             The request type.
  * @param   pReqHdr             The request.
  */
-static int VBoxGuestCheckIfVMMReqAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VMMDevRequestType enmType,
-                                         VMMDevRequestHeader const *pReqHdr)
+static int vbgdCheckIfVmmReqIsAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VMMDevRequestType enmType,
+                                      VMMDevRequestHeader const *pReqHdr)
 {
     /*
      * Categorize the request being made.
@@ -1733,6 +1777,7 @@ static int VBoxGuestCheckIfVMMReqAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
         case VMMDevReq_HGCMCancel:
         case VMMDevReq_HGCMCancel2:
 #endif /* VBOX_WITH_HGCM */
+        case VMMDevReq_SetGuestCapabilities:
         default:
             enmRequired = kLevel_NoOne;
             break;
@@ -1772,27 +1817,6 @@ static int VBoxGuestCheckIfVMMReqAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
             break;
 
         /*
-         * Anyone. But not for CapsAcquire mode
-         */
-        case VMMDevReq_SetGuestCapabilities:
-        {
-            VMMDevReqGuestCapabilities2 *pCaps = (VMMDevReqGuestCapabilities2*)pReqHdr;
-            uint32_t fAcquireCaps = 0;
-            if (!VBoxGuestCommonGuestCapsModeSet(pDevExt, pCaps->u32OrMask, false, &fAcquireCaps))
-            {
-                AssertFailed();
-                LogRel(("VBoxDrv: calling caps set for acquired caps %d\n", pCaps->u32OrMask));
-                enmRequired = kLevel_NoOne;
-                break;
-            }
-            /* hack to adjust the notcaps.
-             * @todo: move to a better place
-             * user-mode apps are allowed to pass any mask to the notmask,
-             * the driver cleans up them accordingly */
-            pCaps->u32NotMask &= ~fAcquireCaps;
-            /* do not break, make it fall through to the below enmRequired setting */
-        }
-        /*
          * Anyone.
          */
         case VMMDevReq_GetMouseStatus:
@@ -1870,8 +1894,8 @@ static int VBoxGuestCheckIfVMMReqAllowed(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSES
     return VERR_PERMISSION_DENIED;
 }
 
-static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                           VMMDevRequestHeader *pReqHdr, size_t cbData, size_t *pcbDataReturned)
+static int vbgdIoCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                VMMDevRequestHeader *pReqHdr, size_t cbData, size_t *pcbDataReturned)
 {
     int                     rc;
     VMMDevRequestHeader    *pReqCopy;
@@ -1883,32 +1907,32 @@ static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
     const uint32_t          cbReq     = pReqHdr->size;
     const uint32_t          cbMinSize = (uint32_t)vmmdevGetRequestSize(enmType);
 
-    LogFlow(("VBoxGuestCommonIOCtl: VMMREQUEST type %d\n", pReqHdr->requestType));
+    LogFlow(("VBOXGUEST_IOCTL_VMMREQUEST: type %d\n", pReqHdr->requestType));
 
     if (cbReq < cbMinSize)
     {
-        LogRel(("VBoxGuestCommonIOCtl: VMMREQUEST: invalid hdr size %#x, expected >= %#x; type=%#x!!\n",
+        LogRel(("VBOXGUEST_IOCTL_VMMREQUEST: invalid hdr size %#x, expected >= %#x; type=%#x!!\n",
                 cbReq, cbMinSize, enmType));
         return VERR_INVALID_PARAMETER;
     }
     if (cbReq > cbData)
     {
-        LogRel(("VBoxGuestCommonIOCtl: VMMREQUEST: invalid size %#x, expected >= %#x (hdr); type=%#x!!\n",
+        LogRel(("VBOXGUEST_IOCTL_VMMREQUEST: invalid size %#x, expected >= %#x (hdr); type=%#x!!\n",
                 cbData, cbReq, enmType));
         return VERR_INVALID_PARAMETER;
     }
     rc = VbglGRVerify(pReqHdr, cbData);
     if (RT_FAILURE(rc))
     {
-        Log(("VBoxGuestCommonIOCtl: VMMREQUEST: invalid header: size %#x, expected >= %#x (hdr); type=%#x; rc=%Rrc!!\n",
+        Log(("VBOXGUEST_IOCTL_VMMREQUEST: invalid header: size %#x, expected >= %#x (hdr); type=%#x; rc=%Rrc!!\n",
              cbData, cbReq, enmType, rc));
         return rc;
     }
 
-    rc = VBoxGuestCheckIfVMMReqAllowed(pDevExt, pSession, enmType, pReqHdr);
+    rc = vbgdCheckIfVmmReqIsAllowed(pDevExt, pSession, enmType, pReqHdr);
     if (RT_FAILURE(rc))
     {
-        Log(("VBoxGuestCommonIOCtl: VMMREQUEST: Operation not allowed! type=%#x rc=%Rrc\n", enmType, rc));
+        Log(("VBOXGUEST_IOCTL_VMMREQUEST: Operation not allowed! type=%#x rc=%Rrc\n", enmType, rc));
         return rc;
     }
 
@@ -1922,7 +1946,7 @@ static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
     rc = VbglGRAlloc(&pReqCopy, cbReq, enmType);
     if (RT_FAILURE(rc))
     {
-        Log(("VBoxGuestCommonIOCtl: VMMREQUEST: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
+        Log(("VBOXGUEST_IOCTL_VMMREQUEST: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
              cbReq, cbReq, rc));
         return rc;
     }
@@ -1932,8 +1956,8 @@ static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
         pSession->u32MousePosChangedSeq = ASMAtomicUoReadU32(&pDevExt->u32MousePosChangedSeq);
 
     rc = VbglGRPerform(pReqCopy);
-    if (    RT_SUCCESS(rc)
-        &&  RT_SUCCESS(pReqCopy->rc))
+    if (   RT_SUCCESS(rc)
+        && RT_SUCCESS(pReqCopy->rc))
     {
         Assert(rc != VINF_HGCM_ASYNC_EXECUTE);
         Assert(pReqCopy->rc != VINF_HGCM_ASYNC_EXECUTE);
@@ -1943,10 +1967,10 @@ static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
             *pcbDataReturned = cbReq;
     }
     else if (RT_FAILURE(rc))
-        Log(("VBoxGuestCommonIOCtl: VMMREQUEST: VbglGRPerform - rc=%Rrc!\n", rc));
+        Log(("VBOXGUEST_IOCTL_VMMREQUEST: VbglGRPerform - rc=%Rrc!\n", rc));
     else
     {
-        Log(("VBoxGuestCommonIOCtl: VMMREQUEST: request execution failed; VMMDev rc=%Rrc!\n", pReqCopy->rc));
+        Log(("VBOXGUEST_IOCTL_VMMREQUEST: request execution failed; VMMDev rc=%Rrc!\n", pReqCopy->rc));
         rc = pReqCopy->rc;
     }
 
@@ -1955,76 +1979,13 @@ static int VBoxGuestCommonIOCtl_VMMRequest(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTS
 }
 
 
-static int VBoxGuestCommonIOCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt,
-                                              PVBOXGUESTSESSION pSession,
-                                              VBoxGuestFilterMaskInfo *pInfo)
-{
-    int rc;
-
-    if ((pInfo->u32OrMask | pInfo->u32NotMask) & ~VMMDEV_EVENT_VALID_EVENT_MASK)
-        return VERR_INVALID_PARAMETER;
-    RTSpinlockAcquire(pDevExt->SessionSpinlock);
-    pSession->fFilterMask |= pInfo->u32OrMask;
-    pSession->fFilterMask &= ~pInfo->u32NotMask;
-    RTSpinlockRelease(pDevExt->SessionSpinlock);
-    rc = vboxGuestUpdateHostFlags(pDevExt, pSession, HostFlags_FilterMask);
-    return rc;
-}
-
-
-static int VBoxGuestCommonIOCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt,
-                                            PVBOXGUESTSESSION pSession,
-                                            VBoxGuestSetCapabilitiesInfo *pInfo)
-{
-    int rc;
-
-    if (  (pInfo->u32OrMask | pInfo->u32NotMask)
-        & ~VMMDEV_GUEST_CAPABILITIES_MASK)
-        return VERR_INVALID_PARAMETER;
-    RTSpinlockAcquire(pDevExt->SessionSpinlock);
-    pSession->fCapabilities |= pInfo->u32OrMask;
-    pSession->fCapabilities &= ~pInfo->u32NotMask;
-    RTSpinlockRelease(pDevExt->SessionSpinlock);
-    rc = vboxGuestUpdateHostFlags(pDevExt, pSession, HostFlags_Capabilities);
-    return rc;
-}
-
-
-/**
- * Sets the mouse status features for this session and updates them
- * globally.
- *
- * @returns VBox status code.
- *
- * @param   pDevExt             The device extention.
- * @param   pSession            The session.
- * @param   fFeatures           New bitmap of enabled features.
- */
-static int vboxGuestCommonIOCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt,
-                                               PVBOXGUESTSESSION pSession,
-                                               uint32_t fFeatures)
-{
-    int rc;
-
-    if (fFeatures & ~VMMDEV_MOUSE_GUEST_MASK)
-        return VERR_INVALID_PARAMETER;
-    /* Since this is more of a negative feature we invert it to get the real
-     * feature (when the guest does not need the host cursor). */
-    fFeatures ^= VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR;
-    RTSpinlockAcquire(pDevExt->SessionSpinlock);
-    pSession->fMouseStatus = fFeatures;
-    RTSpinlockRelease(pDevExt->SessionSpinlock);
-    rc = vboxGuestUpdateHostFlags(pDevExt, pSession, HostFlags_MouseStatus);
-    return rc;
-}
-
 #ifdef VBOX_WITH_HGCM
 
 AssertCompile(RT_INDEFINITE_WAIT == (uint32_t)RT_INDEFINITE_WAIT); /* assumed by code below */
 
-/** Worker for VBoxGuestHGCMAsyncWaitCallback*. */
-static int VBoxGuestHGCMAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHdr, PVBOXGUESTDEVEXT pDevExt,
-                                                 bool fInterruptible, uint32_t cMillies)
+/** Worker for vbgdHgcmAsyncWaitCallback*. */
+static int vbgdHgcmAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile *pHdr, PVBOXGUESTDEVEXT pDevExt,
+                                           bool fInterruptible, uint32_t cMillies)
 {
     int rc;
 
@@ -2046,7 +2007,7 @@ static int VBoxGuestHGCMAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile
         }
         RTSpinlockRelease(pDevExt->EventSpinlock);
 
-        pWait = VBoxGuestWaitAlloc(pDevExt, NULL);
+        pWait = vbgdWaitAlloc(pDevExt, NULL);
         if (pWait)
             break;
         if (fInterruptible)
@@ -2065,7 +2026,7 @@ static int VBoxGuestHGCMAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile
     RTListAppend(&pDevExt->HGCMWaitList, &pWait->ListNode);
     if ((pHdr->fu32Flags & VBOX_HGCM_REQ_DONE) != 0)
     {
-        VBoxGuestWaitFreeLocked(pDevExt, pWait);
+        vbgdWaitFreeLocked(pDevExt, pWait);
         RTSpinlockRelease(pDevExt->EventSpinlock);
         return VINF_SUCCESS;
     }
@@ -2081,13 +2042,13 @@ static int VBoxGuestHGCMAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile
     /*
      * Unlink, free and return.
      */
-    if (    RT_FAILURE(rc)
-        &&  rc != VERR_TIMEOUT
-        &&  (    !fInterruptible
-             ||  rc != VERR_INTERRUPTED))
-        LogRel(("VBoxGuestHGCMAsyncWaitCallback: wait failed! %Rrc\n", rc));
+    if (   RT_FAILURE(rc)
+        && rc != VERR_TIMEOUT
+        && (   !fInterruptible
+            || rc != VERR_INTERRUPTED))
+        LogRel(("vbgdHgcmAsyncWaitCallback: wait failed! %Rrc\n", rc));
 
-    VBoxGuestWaitFreeUnlocked(pDevExt, pWait);
+    vbgdWaitFreeUnlocked(pDevExt, pWait);
     return rc;
 }
 
@@ -2095,39 +2056,33 @@ static int VBoxGuestHGCMAsyncWaitCallbackWorker(VMMDevHGCMRequestHeader volatile
 /**
  * This is a callback for dealing with async waits.
  *
- * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent.
+ * It operates in a manner similar to vbgdIoCtl_WaitEvent.
  */
-static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
+static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallback(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
-    LogFlow(("VBoxGuestHGCMAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType));
-    return VBoxGuestHGCMAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr,
-                                                pDevExt,
-                                                false /* fInterruptible */,
-                                                u32User  /* cMillies */);
+    LogFlow(("vbgdHgcmAsyncWaitCallback: requestType=%d\n", pHdr->header.requestType));
+    return vbgdHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt,
+                                           false /* fInterruptible */, u32User  /* cMillies */);
 }
 
 
 /**
  * This is a callback for dealing with async waits with a timeout.
  *
- * It operates in a manner similar to VBoxGuestCommonIOCtl_WaitEvent.
+ * It operates in a manner similar to vbgdIoCtl_WaitEvent.
  */
-static DECLCALLBACK(int) VBoxGuestHGCMAsyncWaitCallbackInterruptible(VMMDevHGCMRequestHeader *pHdr,
-                                                                      void *pvUser, uint32_t u32User)
+static DECLCALLBACK(int) vbgdHgcmAsyncWaitCallbackInterruptible(VMMDevHGCMRequestHeader *pHdr, void *pvUser, uint32_t u32User)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pvUser;
-    LogFlow(("VBoxGuestHGCMAsyncWaitCallbackInterruptible: requestType=%d\n", pHdr->header.requestType));
-    return VBoxGuestHGCMAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr,
-                                                pDevExt,
-                                                true /* fInterruptible */,
-                                                u32User /* cMillies */ );
-
+    LogFlow(("vbgdHgcmAsyncWaitCallbackInterruptible: requestType=%d\n", pHdr->header.requestType));
+    return vbgdHgcmAsyncWaitCallbackWorker((VMMDevHGCMRequestHeader volatile *)pHdr, pDevExt,
+                                           true /* fInterruptible */, u32User /* cMillies */);
 }
 
 
-static int VBoxGuestCommonIOCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                            VBoxGuestHGCMConnectInfo *pInfo, size_t *pcbDataReturned)
+static int vbgdIoCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                 VBoxGuestHGCMConnectInfo *pInfo, size_t *pcbDataReturned)
 {
     int rc;
 
@@ -2136,14 +2091,14 @@ static int VBoxGuestCommonIOCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUEST
      * call is performed in an ASYNC fashion. The function is not able
      * to deal with cancelled requests.
      */
-    Log(("VBoxGuestCommonIOCtl: HGCM_CONNECT: %.128s\n",
+    Log(("VBOXGUEST_IOCTL_HGCM_CONNECT: %.128s\n",
          pInfo->Loc.type == VMMDevHGCMLoc_LocalHost || pInfo->Loc.type == VMMDevHGCMLoc_LocalHost_Existing
          ? pInfo->Loc.u.host.achName : "<not local host>"));
 
-    rc = VbglR0HGCMInternalConnect(pInfo, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
+    rc = VbglR0HGCMInternalConnect(pInfo, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
     if (RT_SUCCESS(rc))
     {
-        Log(("VBoxGuestCommonIOCtl: HGCM_CONNECT: u32Client=%RX32 result=%Rrc (rc=%Rrc)\n",
+        Log(("VBOXGUEST_IOCTL_HGCM_CONNECT: u32Client=%RX32 result=%Rrc (rc=%Rrc)\n",
              pInfo->u32ClientID, pInfo->result, rc));
         if (RT_SUCCESS(pInfo->result))
         {
@@ -2163,10 +2118,10 @@ static int VBoxGuestCommonIOCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUEST
             if (i >= RT_ELEMENTS(pSession->aHGCMClientIds))
             {
                 VBoxGuestHGCMDisconnectInfo Info;
-                LogRelMax(32, ("VBoxGuestCommonIOCtl: HGCM_CONNECT: too many HGCMConnect calls for one session!\n"));
+                LogRelMax(32, ("VBOXGUEST_IOCTL_HGCM_CONNECT: too many HGCMConnect calls for one session!\n"));
                 Info.result = 0;
                 Info.u32ClientID = pInfo->u32ClientID;
-                VbglR0HGCMInternalDisconnect(&Info, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
+                VbglR0HGCMInternalDisconnect(&Info, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
                 return VERR_TOO_MANY_OPEN_FILES;
             }
         }
@@ -2179,8 +2134,8 @@ static int VBoxGuestCommonIOCtl_HGCMConnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUEST
 }
 
 
-static int VBoxGuestCommonIOCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestHGCMDisconnectInfo *pInfo,
-                                               size_t *pcbDataReturned)
+static int vbgdIoCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                    VBoxGuestHGCMDisconnectInfo *pInfo, size_t *pcbDataReturned)
 {
     /*
      * Validate the client id and invalidate its entry while we're in the call.
@@ -2198,7 +2153,7 @@ static int VBoxGuestCommonIOCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGU
     RTSpinlockRelease(pDevExt->SessionSpinlock);
     if (i >= RT_ELEMENTS(pSession->aHGCMClientIds))
     {
-        LogRelMax(32, ("VBoxGuestCommonIOCtl: HGCM_DISCONNECT: u32Client=%RX32\n", u32ClientId));
+        LogRelMax(32, ("VBOXGUEST_IOCTL_HGCM_DISCONNECT: u32Client=%RX32\n", u32ClientId));
         return VERR_INVALID_HANDLE;
     }
 
@@ -2207,11 +2162,11 @@ static int VBoxGuestCommonIOCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGU
      * call is performed in an ASYNC fashion. The function is not able
      * to deal with cancelled requests.
      */
-    Log(("VBoxGuestCommonIOCtl: HGCM_DISCONNECT: u32Client=%RX32\n", pInfo->u32ClientID));
-    rc = VbglR0HGCMInternalDisconnect(pInfo, VBoxGuestHGCMAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
+    Log(("VBOXGUEST_IOCTL_HGCM_DISCONNECT: u32Client=%RX32\n", pInfo->u32ClientID));
+    rc = VbglR0HGCMInternalDisconnect(pInfo, vbgdHgcmAsyncWaitCallback, pDevExt, RT_INDEFINITE_WAIT);
     if (RT_SUCCESS(rc))
     {
-        LogFlow(("VBoxGuestCommonIOCtl: HGCM_DISCONNECT: result=%Rrc\n", pInfo->result));
+        LogFlow(("VBOXGUEST_IOCTL_HGCM_DISCONNECT: result=%Rrc\n", pInfo->result));
         if (pcbDataReturned)
             *pcbDataReturned = sizeof(*pInfo);
     }
@@ -2226,11 +2181,9 @@ static int VBoxGuestCommonIOCtl_HGCMDisconnect(PVBOXGUESTDEVEXT pDevExt, PVBOXGU
 }
 
 
-static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt,
-                                         PVBOXGUESTSESSION pSession,
-                                         VBoxGuestHGCMCallInfo *pInfo,
-                                         uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData,
-                                         size_t cbExtra, size_t cbData, size_t *pcbDataReturned)
+static int vbgdIoCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestHGCMCallInfo *pInfo,
+                              uint32_t cMillies, bool fInterruptible, bool f32bit, bool fUserData,
+                              size_t cbExtra, size_t cbData, size_t *pcbDataReturned)
 {
     const uint32_t  u32ClientId = pInfo->u32ClientID;
     uint32_t        fFlags;
@@ -2243,7 +2196,7 @@ static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt,
      */
     if (pInfo->cParms > 4096) /* (Just make sure it doesn't overflow the next check.) */
     {
-        LogRel(("VBoxGuestCommonIOCtl: HGCM_CALL: cParm=%RX32 is not sane\n", pInfo->cParms));
+        LogRel(("VBOXGUEST_IOCTL_HGCM_CALL: cParm=%RX32 is not sane\n", pInfo->cParms));
         return VERR_INVALID_PARAMETER;
     }
 
@@ -2256,7 +2209,7 @@ static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt,
         cbActual += pInfo->cParms * sizeof(HGCMFunctionParameter);
     if (cbData < cbActual)
     {
-        LogRel(("VBoxGuestCommonIOCtl: HGCM_CALL: cbData=%#zx (%zu) required size is %#zx (%zu)\n",
+        LogRel(("VBOXGUEST_IOCTL_HGCM_CALL: cbData=%#zx (%zu) required size is %#zx (%zu)\n",
                cbData, cbData, cbActual, cbActual));
         return VERR_INVALID_PARAMETER;
     }
@@ -2271,7 +2224,7 @@ static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt,
     RTSpinlockRelease(pDevExt->SessionSpinlock);
     if (RT_UNLIKELY(i >= RT_ELEMENTS(pSession->aHGCMClientIds)))
     {
-        LogRelMax(32, ("VBoxGuestCommonIOCtl: HGCM_CALL: Invalid handle. u32Client=%RX32\n", u32ClientId));
+        LogRelMax(32, ("VBOXGUEST_IOCTL_HGCM_CALL: Invalid handle. u32Client=%RX32\n", u32ClientId));
         return VERR_INVALID_HANDLE;
     }
 
@@ -2281,28 +2234,28 @@ static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt,
      * deal with cancelled requests, so we let user more requests
      * be interruptible (should add a flag for this later I guess).
      */
-    LogFlow(("VBoxGuestCommonIOCtl: HGCM_CALL: u32Client=%RX32\n", pInfo->u32ClientID));
+    LogFlow(("VBOXGUEST_IOCTL_HGCM_CALL: u32Client=%RX32\n", pInfo->u32ClientID));
     fFlags = !fUserData && pSession->R0Process == NIL_RTR0PROCESS ? VBGLR0_HGCMCALL_F_KERNEL : VBGLR0_HGCMCALL_F_USER;
     uint32_t cbInfo = (uint32_t)(cbData - cbExtra);
 #ifdef RT_ARCH_AMD64
     if (f32bit)
     {
         if (fInterruptible)
-            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallbackInterruptible, pDevExt, cMillies);
+            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies);
         else
-            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallback, pDevExt, cMillies);
+            rc = VbglR0HGCMInternalCall32(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallback, pDevExt, cMillies);
     }
     else
 #endif
     {
         if (fInterruptible)
-            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallbackInterruptible, pDevExt, cMillies);
+            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallbackInterruptible, pDevExt, cMillies);
         else
-            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, VBoxGuestHGCMAsyncWaitCallback, pDevExt, cMillies);
+            rc = VbglR0HGCMInternalCall(pInfo, cbInfo, fFlags, vbgdHgcmAsyncWaitCallback, pDevExt, cMillies);
     }
     if (RT_SUCCESS(rc))
     {
-        LogFlow(("VBoxGuestCommonIOCtl: HGCM_CALL: result=%Rrc\n", pInfo->result));
+        LogFlow(("VBOXGUEST_IOCTL_HGCM_CALL: result=%Rrc\n", pInfo->result));
         if (pcbDataReturned)
             *pcbDataReturned = cbActual;
     }
@@ -2310,9 +2263,9 @@ static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt,
     {
         if (   rc != VERR_INTERRUPTED
             && rc != VERR_TIMEOUT)
-            LogRelMax(32, ("VBoxGuestCommonIOCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));
+            LogRelMax(32, ("VBOXGUEST_IOCTL_HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));
         else
-            Log(("VBoxGuestCommonIOCtl: HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));
+            Log(("VBOXGUEST_IOCTL_HGCM_CALL: %s Failed. rc=%Rrc.\n", f32bit ? "32" : "64", rc));
     }
     return rc;
 }
@@ -2334,19 +2287,19 @@ static int VBoxGuestCommonIOCtl_HGCMCall(PVBOXGUESTDEVEXT pDevExt,
  * @param   pcbDataReturned     Where to store the amount of returned data. Can
  *                              be NULL.
  */
-static int VBoxGuestCommonIOCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                                   VBoxGuestCheckBalloonInfo *pInfo, size_t *pcbDataReturned)
+static int vbgdIoCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                        VBoxGuestCheckBalloonInfo *pInfo, size_t *pcbDataReturned)
 {
     VMMDevGetMemBalloonChangeRequest *pReq;
     int rc;
 
-    LogFlow(("VBoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON\n"));
+    LogFlow(("VBOXGUEST_IOCTL_CHECK_BALLOON:\n"));
     rc = RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);
     AssertRCReturn(rc, rc);
 
     /*
      * The first user trying to query/change the balloon becomes the
-     * owner and owns it until the session is closed (vboxGuestCloseMemBalloon).
+     * owner and owns it until the session is closed (vbgdCloseMemBalloon).
      */
     if (   pDevExt->MemBalloon.pOwner != pSession
         && pDevExt->MemBalloon.pOwner == NULL)
@@ -2372,7 +2325,7 @@ static int VBoxGuestCommonIOCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVB
                 pInfo->cBalloonChunks = pReq->cBalloonChunks;
                 pInfo->fHandleInR3    = false;
 
-                rc = vboxGuestSetBalloonSizeKernel(pDevExt, pReq->cBalloonChunks, &pInfo->fHandleInR3);
+                rc = vbgdSetBalloonSizeKernel(pDevExt, pReq->cBalloonChunks, &pInfo->fHandleInR3);
                 /* Ignore various out of memory failures. */
                 if (   rc == VERR_NO_MEMORY
                     || rc == VERR_NO_PHYS_MEMORY
@@ -2383,7 +2336,7 @@ static int VBoxGuestCommonIOCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVB
                     *pcbDataReturned = sizeof(VBoxGuestCheckBalloonInfo);
             }
             else
-                LogRel(("VBoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON: VbglGRPerform failed. rc=%Rrc\n", rc));
+                LogRel(("VBOXGUEST_IOCTL_CHECK_BALLOON: VbglGRPerform failed. rc=%Rrc\n", rc));
             VbglGRFree(&pReq->header);
         }
     }
@@ -2391,7 +2344,7 @@ static int VBoxGuestCommonIOCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVB
         rc = VERR_PERMISSION_DENIED;
 
     RTSemFastMutexRelease(pDevExt->MemBalloon.hMtx);
-    LogFlow(("VBoxGuestCommonIOCtl: CHECK_MEMORY_BALLOON returns %Rrc\n", rc));
+    LogFlow(("VBOXGUEST_IOCTL_CHECK_BALLOON returns %Rrc\n", rc));
     return rc;
 }
 
@@ -2407,12 +2360,12 @@ static int VBoxGuestCommonIOCtl_CheckMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVB
  * @param   pcbDataReturned     Where to store the amount of returned data. Can
  *                              be NULL.
  */
-static int VBoxGuestCommonIOCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                                                    VBoxGuestChangeBalloonInfo *pInfo, size_t *pcbDataReturned)
+static int vbgdIoCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                         VBoxGuestChangeBalloonInfo *pInfo, size_t *pcbDataReturned)
 {
     int rc;
+    LogFlow(("VBOXGUEST_IOCTL_CHANGE_BALLOON: fInflate=%RTbool u64ChunkAddr=%#RX64\n", pInfo->fInflate, pInfo->u64ChunkAddr));
 
-    LogFlow(("VBoxGuestCommonIOCtl: CHANGE_BALLOON\n"));
     rc = RTSemFastMutexRequest(pDevExt->MemBalloon.hMtx);
     AssertRCReturn(rc, rc);
 
@@ -2420,7 +2373,7 @@ static int VBoxGuestCommonIOCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PV
     {
         /*
          * The first user trying to query/change the balloon becomes the
-         * owner and owns it until the session is closed (vboxGuestCloseMemBalloon).
+         * owner and owns it until the session is closed (vbgdCloseMemBalloon).
          */
         if (   pDevExt->MemBalloon.pOwner != pSession
             && pDevExt->MemBalloon.pOwner == NULL)
@@ -2428,7 +2381,7 @@ static int VBoxGuestCommonIOCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PV
 
         if (pDevExt->MemBalloon.pOwner == pSession)
         {
-            rc = vboxGuestSetBalloonSizeFromUser(pDevExt, pSession, pInfo->u64ChunkAddr, !!pInfo->fInflate);
+            rc = vbgdSetBalloonSizeFromUser(pDevExt, pSession, pInfo->u64ChunkAddr, !!pInfo->fInflate);
             if (pcbDataReturned)
                 *pcbDataReturned = 0;
         }
@@ -2451,31 +2404,29 @@ static int VBoxGuestCommonIOCtl_ChangeMemoryBalloon(PVBOXGUESTDEVEXT pDevExt, PV
  * @param pDevExt               The device extension.
  * @param pInfo                 The output buffer.
  */
-static int VBoxGuestCommonIOCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo)
+static int vbgdIoCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo)
 {
     VMMDevReqWriteCoreDump *pReq = NULL;
     int rc;
+    LogFlow(("VBOXGUEST_IOCTL_WRITE_CORE_DUMP\n"));
 
-    LogFlow(("VBoxGuestCommonIOCtl: WRITE_CORE_DUMP\n"));
     rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_WriteCoreDump);
-    if (RT_FAILURE(rc))
+    if (RT_SUCCESS(rc))
     {
-        Log(("VBoxGuestCommonIOCtl: WRITE_CORE_DUMP: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
-             sizeof(*pReq), sizeof(*pReq), rc));
-        return rc;
-    }
-
-    pReq->fFlags = pInfo->fFlags;
-    rc = VbglGRPerform(&pReq->header);
-    if (RT_FAILURE(rc))
-        Log(("VBoxGuestCommonIOCtl: WRITE_CORE_DUMP: VbglGRPerform failed, rc=%Rrc!\n", rc));
+        pReq->fFlags = pInfo->fFlags;
+        rc = VbglGRPerform(&pReq->header);
+        if (RT_FAILURE(rc))
+            Log(("VBOXGUEST_IOCTL_WRITE_CORE_DUMP: VbglGRPerform failed, rc=%Rrc!\n", rc));
 
-    VbglGRFree(&pReq->header);
+        VbglGRFree(&pReq->header);
+    }
+    else
+        Log(("VBOXGUEST_IOCTL_WRITE_CORE_DUMP: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
+             sizeof(*pReq), sizeof(*pReq), rc));
     return rc;
 }
 
 
-
 /**
  * Guest backdoor logging.
  *
@@ -2486,10 +2437,8 @@ static int VBoxGuestCommonIOCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGues
  * @param   cbData              Size of the buffer.
  * @param   pcbDataReturned     Where to store the amount of returned data. Can be NULL.
  */
-static int VBoxGuestCommonIOCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned, bool fUserSession)
+static int vbgdIoCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned, bool fUserSession)
 {
-    NOREF(pch);
-    NOREF(cbData);
     if (pDevExt->fLoggingEnabled)
         RTLogBackdoorPrintf("%.*s", cbData, pch);
     else if (!fUserSession)
@@ -2502,190 +2451,871 @@ static int VBoxGuestCommonIOCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, s
 }
 
 
-static bool VBoxGuestCommonGuestCapsValidateValues(uint32_t fCaps)
+/** @name Guest Capabilities, Mouse Status and Event Filter
+ * @{
+ */
+
+/**
+ * Clears a bit usage tracker (init time).
+ *
+ * @param   pTracker            The tracker to clear.
+ */
+static void vbgdBitUsageTrackerClear(PVBOXGUESTBITUSAGETRACER pTracker)
 {
-    if (fCaps & (~(VMMDEV_GUEST_SUPPORTS_SEAMLESS | VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING | VMMDEV_GUEST_SUPPORTS_GRAPHICS)))
-        return false;
+    uint32_t iBit;
+    AssertCompile(sizeof(pTracker->acPerBitUsage) == 32 * sizeof(uint32_t));
 
-    return true;
+    for (iBit = 0; iBit < 32; iBit++)
+        pTracker->acPerBitUsage[iBit] = 0;
+    pTracker->fMask = 0;
 }
 
 
-/** Check whether any unreported VMM device events should be reported to any of
- * the currently listening sessions.  In addition, report any events in
- * @a fGenFakeEvents.
- * @note This is called by GUEST_CAPS_ACQUIRE in case any pending events can now
- *       be dispatched to the session which acquired capabilities.  The fake
- *       events are a hack to wake up threads in that session which would not
- *       otherwise be woken.
- * @todo Why not just use CANCEL_ALL_WAITEVENTS to do the waking up rather than
- *       adding additional code to the driver?
- * @todo Why does acquiring capabilities block and unblock events?  Capabilities
- *       are supposed to control what is reported to the host, we already have
- *       separate requests for blocking and unblocking events. */
-static void VBoxGuestCommonCheckEvents(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fGenFakeEvents)
+#ifdef VBOX_STRICT
+/**
+ * Checks that pTracker->fMask is correct and that the usage values are within
+ * the valid range.
+ *
+ * @param   pTracker            The tracker.
+ * @param   cMax                Max valid usage value.
+ * @param   pszWhat             Identifies the tracker in assertions.
+ */
+static void vbgdBitUsageTrackerCheckMask(PCVBOXGUESTBITUSAGETRACER pTracker, uint32_t cMax, const char *pszWhat)
 {
-    RTSpinlockAcquire(pDevExt->EventSpinlock);
-    uint32_t fEvents = fGenFakeEvents | pDevExt->f32PendingEvents;
-    PVBOXGUESTWAIT  pWait;
-    PVBOXGUESTWAIT  pSafe;
+    uint32_t fMask = 0;
+    uint32_t iBit;
+    AssertCompile(sizeof(pTracker->acPerBitUsage) == 32 * sizeof(uint32_t));
 
-    RTListForEachSafe(&pDevExt->WaitList, pWait, pSafe, VBOXGUESTWAIT, ListNode)
-    {
-        uint32_t fHandledEvents = VBoxGuestCommonGetHandledEventsLocked(pDevExt, pWait->pSession);
-        if (    (pWait->fReqEvents & fEvents & fHandledEvents)
-                    &&  !pWait->fResEvents)
+    for (iBit = 0; iBit < 32; iBit++)
+        if (pTracker->acPerBitUsage[iBit])
         {
-            pWait->fResEvents = pWait->fReqEvents & fEvents & fHandledEvents;
-            Assert(!(fGenFakeEvents & pWait->fResEvents) || pSession == pWait->pSession);
-            fEvents &= ~pWait->fResEvents;
-            RTListNodeRemove(&pWait->ListNode);
-#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-            RTListAppend(&pDevExt->WakeUpList, &pWait->ListNode);
-#else
-            RTListAppend(&pDevExt->WokenUpList, &pWait->ListNode);
-            int rc = RTSemEventMultiSignal(pWait->Event);
-            AssertRC(rc);
-#endif
-            if (!fEvents)
-                break;
+            fMask |= RT_BIT_32(iBit);
+            AssertMsg(pTracker->acPerBitUsage[iBit] <= cMax,
+                      ("%s: acPerBitUsage[%u]=%#x cMax=%#x\n", pszWhat, iBit, pTracker->acPerBitUsage[iBit], cMax));
         }
-    }
-    ASMAtomicWriteU32(&pDevExt->f32PendingEvents, fEvents);
-
-    RTSpinlockRelease(pDevExt->EventSpinlock);
 
-#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-    VBoxGuestWaitDoWakeUps(pDevExt);
-#endif
+    AssertMsg(fMask == pTracker->fMask, ("%s: %#x vs %#x\n", pszWhat, fMask, pTracker->fMask));
 }
+#endif
 
-/** Switch the capabilities in @a fOrMask to "acquire" mode if they are not
- * already in "set" mode.  If @a enmFlags is not set to
- * VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE, also try to acquire those
- * capabilities for the current session and release those in @a fNotFlag. */
-static int VBoxGuestCommonGuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fOrMask, uint32_t fNotMask, VBOXGUESTCAPSACQUIRE_FLAGS enmFlags)
+
+/**
+ * Applies a change to the bit usage tracker.
+ *
+ *
+ * @returns true if the mask changed, false if not.
+ * @param   pTracker            The bit usage tracker.
+ * @param   fChanged            The bits to change.
+ * @param   fPrevious           The previous value of the bits.
+ * @param   cMax                The max valid usage value for assertions.
+ * @param   pszWhat             Identifies the tracker in assertions.
+ */
+static bool vbgdBitUsageTrackerChange(PVBOXGUESTBITUSAGETRACER pTracker, uint32_t fChanged, uint32_t fPrevious,
+                                      uint32_t cMax, const char *pszWhat)
 {
-    uint32_t fSetCaps = 0;
+    bool fGlobalChange = false;
+    AssertCompile(sizeof(pTracker->acPerBitUsage) == 32 * sizeof(uint32_t));
 
-    if (!VBoxGuestCommonGuestCapsValidateValues(fOrMask))
+    while (fChanged)
     {
-        LogRel(("VBoxGuestCommonGuestCapsAcquire: pSession(0x%p), OR(0x%x), NOT(0x%x), flags(0x%x) -- invalid fOrMask\n",
-                pSession, fOrMask, fNotMask, enmFlags));
-        return VERR_INVALID_PARAMETER;
-    }
+        uint32_t const iBit     = ASMBitFirstSetU32(fChanged) - 1;
+        uint32_t const fBitMask = RT_BIT_32(iBit);
+        Assert(iBit < 32); Assert(fBitMask & fChanged);
 
-    if (   enmFlags != VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE
-        && enmFlags != VBOXGUESTCAPSACQUIRE_FLAGS_NONE)
-    {
-        LogRel(("VBoxGuestCommonGuestCapsAcquire: pSession(0x%p), OR(0x%x), NOT(0x%x), flags(0x%x) -- invalid enmFlags %d\n",
-                pSession, fOrMask, fNotMask, enmFlags));
-        return VERR_INVALID_PARAMETER;
+        if (fBitMask & fPrevious)
+        {
+            pTracker->acPerBitUsage[iBit] -= 1;
+            AssertMsg(pTracker->acPerBitUsage[iBit] <= cMax,
+                      ("%s: acPerBitUsage[%u]=%#x cMax=%#x\n", pszWhat, iBit, pTracker->acPerBitUsage[iBit], cMax));
+            if (pTracker->acPerBitUsage[iBit] == 0)
+            {
+                fGlobalChange = true;
+                pTracker->fMask &= ~fBitMask;
+            }
+        }
+        else
+        {
+            pTracker->acPerBitUsage[iBit] += 1;
+            AssertMsg(pTracker->acPerBitUsage[iBit] > 0 && pTracker->acPerBitUsage[iBit] <= cMax,
+                      ("pTracker->acPerBitUsage[%u]=%#x cMax=%#x\n", pszWhat, iBit, pTracker->acPerBitUsage[iBit], cMax));
+            if (pTracker->acPerBitUsage[iBit] == 1)
+            {
+                fGlobalChange = true;
+                pTracker->fMask |= fBitMask;
+            }
+        }
+
+        fChanged &= ~fBitMask;
     }
 
-    if (!VBoxGuestCommonGuestCapsModeSet(pDevExt, fOrMask, true, &fSetCaps))
-    {
-        LogRel(("VBoxGuestCommonGuestCapsAcquire: pSession(0x%p), OR(0x%x), NOT(0x%x), flags(0x%x) -- calling caps acquire for set caps\n",
-                pSession, fOrMask, fNotMask, enmFlags));
-        return VERR_INVALID_STATE;
+#ifdef VBOX_STRICT
+    vbgdBitUsageTrackerCheckMask(pTracker, cMax, pszWhat);
+#endif
+    NOREF(pszWhat); NOREF(cMax);
+    return fGlobalChange;
+}
+
+
+/**
+ * Init and termination worker for resetting the (host) event filter on the host
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         The device extension.
+ * @param   fFixedEvents    Fixed events (init time).
+ */
+static int vbgdResetEventFilterOnHost(PVBOXGUESTDEVEXT pDevExt, uint32_t fFixedEvents)
+{
+    VMMDevCtlGuestFilterMask *pReq;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_CtlGuestFilterMask);
+    if (RT_SUCCESS(rc))
+    {
+        pReq->u32NotMask = UINT32_MAX & ~fFixedEvents;
+        pReq->u32OrMask  = fFixedEvents;
+        rc = VbglGRPerform(&pReq->header);
+        if (RT_FAILURE(rc))
+            LogRelFunc(("failed with rc=%Rrc\n", rc));
+        VbglGRFree(&pReq->header);
     }
+    return rc;
+}
 
-    if (enmFlags & VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE)
+
+/**
+ * Changes the event filter mask for the given session.
+ *
+ * This is called in response to VBOXGUEST_IOCTL_CTL_FILTER_MASK as well as to
+ * do session cleanup.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt             The device extension.
+ * @param   pSession            The session.
+ * @param   fOrMask             The events to add.
+ * @param   fNotMask            The events to remove.
+ * @param   fSessionTermination Set if we're called by the session cleanup code.
+ *                              This tweaks the error handling so we perform
+ *                              proper session cleanup even if the host
+ *                              misbehaves.
+ *
+ * @remarks Takes the session spinlock.
+ */
+static int vbgdSetSessionEventFilter(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                     uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
+{
+    VMMDevCtlGuestFilterMask   *pReq;
+    uint32_t                    fChanged;
+    uint32_t                    fPrevious;
+    int                         rc;
+
+    /*
+     * Preallocate a request buffer so we can do all in one go without leaving the spinlock.
+     */
+    rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_CtlGuestFilterMask);
+    if (RT_SUCCESS(rc))
+    { /* nothing */ }
+    else if (!fSessionTermination)
     {
-        Log(("VBoxGuestCommonGuestCapsAcquire: pSession(0x%p), OR(0x%x), NOT(0x%x), flags(0x%x) -- configured acquire caps: 0x%x\n",
-             pSession, fOrMask, fNotMask, enmFlags));
-        return VINF_SUCCESS;
+        LogRel(("vbgdSetSessionFilterMask: VbglGRAlloc failure: %Rrc\n", rc));
+        return rc;
     }
+    else
+        pReq = NULL; /* Ignore failure, we must do session cleanup. */
 
-    /* the fNotMask no need to have all values valid,
-     * invalid ones will simply be ignored */
-    uint32_t fCurrentOwnedCaps;
-    uint32_t fSessionNotCaps;
-    uint32_t fSessionOrCaps;
-    uint32_t fOtherConflictingCaps;
 
-    fNotMask &= ~fOrMask;
+    RTSpinlockAcquire(pDevExt->SessionSpinlock);
 
-    RTSpinlockAcquire(pDevExt->EventSpinlock);
+    /*
+     * Apply the changes to the session mask.
+     */
+    fPrevious = pSession->fEventFilter;
+    pSession->fEventFilter |= fOrMask;
+    pSession->fEventFilter &= ~fNotMask;
 
-    fCurrentOwnedCaps      = pSession->u32AquiredGuestCaps;
-    fSessionNotCaps        = fCurrentOwnedCaps & fNotMask;
-    fSessionOrCaps         = fOrMask & ~fCurrentOwnedCaps;
-    fOtherConflictingCaps  = pDevExt->u32GuestCaps & ~fCurrentOwnedCaps;
-    fOtherConflictingCaps &= fSessionOrCaps;
+    /*
+     * If anything actually changed, update the global usage counters.
+     */
+    fChanged = fPrevious ^ pSession->fEventFilter;
+    if (fChanged)
+    {
+        bool fGlobalChange = vbgdBitUsageTrackerChange(&pDevExt->EventFilterTracker, fChanged, fPrevious,
+                                                       pDevExt->cSessions, "EventFilterTracker");
 
-    if (!fOtherConflictingCaps)
+        /*
+         * If there are global changes, update the event filter on the host.
+         */
+        if (fGlobalChange || pDevExt->fEventFilterHost == UINT32_MAX)
+        {
+            Assert(pReq || fSessionTermination);
+            if (pReq)
+            {
+                pReq->u32OrMask = pDevExt->fFixedEvents | pDevExt->EventFilterTracker.fMask;
+                if (pReq->u32OrMask == pDevExt->fEventFilterHost)
+                    rc = VINF_SUCCESS;
+                else
+                {
+                    pDevExt->fEventFilterHost = pReq->u32OrMask;
+                    pReq->u32NotMask = ~pReq->u32OrMask;
+                    rc = VbglGRPerform(&pReq->header);
+                    if (RT_FAILURE(rc))
+                    {
+                        /*
+                         * Failed, roll back (unless it's session termination time).
+                         */
+                        pDevExt->fEventFilterHost = UINT32_MAX;
+                        if (!fSessionTermination)
+                        {
+                            vbgdBitUsageTrackerChange(&pDevExt->EventFilterTracker, fChanged, pSession->fEventFilter,
+                                                      pDevExt->cSessions, "EventFilterTracker");
+                            pSession->fEventFilter = fPrevious;
+                        }
+                    }
+                }
+            }
+            else
+                rc = VINF_SUCCESS;
+        }
+    }
+
+    RTSpinlockRelease(pDevExt->SessionSpinlock);
+    if (pReq)
+        VbglGRFree(&pReq->header);
+    return rc;
+}
+
+
+/**
+ * Handle VBOXGUEST_IOCTL_CTL_FILTER_MASK.
+ *
+ * @returns VBox status code.
+ *
+ * @param   pDevExt             The device extension.
+ * @param   pSession            The session.
+ * @param   pInfo               The request.
+ */
+static int vbgdIoCtl_CtlFilterMask(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestFilterMaskInfo *pInfo)
+{
+    LogFlow(("VBOXGUEST_IOCTL_CTL_FILTER_MASK: or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));
+
+    if ((pInfo->u32OrMask | pInfo->u32NotMask) & ~VMMDEV_EVENT_VALID_EVENT_MASK)
+    {
+        Log(("VBOXGUEST_IOCTL_CTL_FILTER_MASK: or=%#x not=%#x: Invalid masks!\n", pInfo->u32OrMask, pInfo->u32NotMask));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    return vbgdSetSessionEventFilter(pDevExt, pSession, pInfo->u32OrMask, pInfo->u32NotMask, false /*fSessionTermination*/);
+}
+
+
+/**
+ * Init and termination worker for set mouse feature status to zero on the host.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         The device extension.
+ */
+static int vbgdResetMouseStatusOnHost(PVBOXGUESTDEVEXT pDevExt)
+{
+    VMMDevReqMouseStatus *pReq;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetMouseStatus);
+    if (RT_SUCCESS(rc))
+    {
+        pReq->mouseFeatures = 0;
+        pReq->pointerXPos   = 0;
+        pReq->pointerYPos   = 0;
+        rc = VbglGRPerform(&pReq->header);
+        if (RT_FAILURE(rc))
+            LogRelFunc(("failed with rc=%Rrc\n", rc));
+        VbglGRFree(&pReq->header);
+    }
+    return rc;
+}
+
+
+/**
+ * Changes the mouse status mask for the given session.
+ *
+ * This is called in response to VBOXGUEST_IOCTL_SET_MOUSE_STATUS as well as to
+ * do session cleanup.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt             The device extension.
+ * @param   pSession            The session.
+ * @param   fOrMask             The status flags to add.
+ * @param   fNotMask            The status flags to remove.
+ * @param   fSessionTermination Set if we're called by the session cleanup code.
+ *                              This tweaks the error handling so we perform
+ *                              proper session cleanup even if the host
+ *                              misbehaves.
+ *
+ * @remarks Takes the session spinlock.
+ */
+static int vbgdSetSessionMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                     uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
+{
+    VMMDevReqMouseStatus   *pReq;
+    uint32_t                fChanged;
+    uint32_t                fPrevious;
+    int                     rc;
+
+    /*
+     * Preallocate a request buffer so we can do all in one go without leaving the spinlock.
+     */
+    rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetMouseStatus);
+    if (RT_SUCCESS(rc))
+    { /* nothing */ }
+    else if (!fSessionTermination)
     {
-        if (fSessionOrCaps)
+        LogRel(("vbgdSetSessionMouseStatus: VbglGRAlloc failure: %Rrc\n", rc));
+        return rc;
+    }
+    else
+        pReq = NULL; /* Ignore failure, we must do session cleanup. */
+
+
+    RTSpinlockAcquire(pDevExt->SessionSpinlock);
+
+    /*
+     * Apply the changes to the session mask.
+     */
+    fPrevious = pSession->fMouseStatus;
+    pSession->fMouseStatus |= fOrMask;
+    pSession->fMouseStatus &= ~fNotMask;
+
+    /*
+     * If anything actually changed, update the global usage counters.
+     */
+    fChanged = fPrevious ^ pSession->fMouseStatus;
+    if (fChanged)
+    {
+        bool fGlobalChange = vbgdBitUsageTrackerChange(&pDevExt->MouseStatusTracker, fChanged, fPrevious,
+                                                       pDevExt->cSessions, "MouseStatusTracker");
+
+        /*
+         * If there are global changes, update the event filter on the host.
+         */
+        if (fGlobalChange || pDevExt->fMouseStatusHost == UINT32_MAX)
         {
-            pSession->u32AquiredGuestCaps |= fSessionOrCaps;
-            pDevExt->u32GuestCaps |= fSessionOrCaps;
+            Assert(pReq || fSessionTermination);
+            if (pReq)
+            {
+                pReq->mouseFeatures = pDevExt->MouseStatusTracker.fMask;
+                if (pReq->mouseFeatures == pDevExt->fMouseStatusHost)
+                    rc = VINF_SUCCESS;
+                else
+                {
+                    pDevExt->fMouseStatusHost = pReq->mouseFeatures;
+                    pReq->pointerXPos = 0;
+                    pReq->pointerYPos = 0;
+                    rc = VbglGRPerform(&pReq->header);
+                    if (RT_FAILURE(rc))
+                    {
+                        /*
+                         * Failed, roll back (unless it's session termination time).
+                         */
+                        pDevExt->fMouseStatusHost = UINT32_MAX;
+                        if (!fSessionTermination)
+                        {
+                            vbgdBitUsageTrackerChange(&pDevExt->MouseStatusTracker, fChanged, pSession->fMouseStatus,
+                                                      pDevExt->cSessions, "MouseStatusTracker");
+                            pSession->fMouseStatus = fPrevious;
+                        }
+                    }
+                }
+            }
+            else
+                rc = VINF_SUCCESS;
         }
+    }
+
+    RTSpinlockRelease(pDevExt->SessionSpinlock);
+    if (pReq)
+        VbglGRFree(&pReq->header);
+    return rc;
+}
+
+
+/**
+ * Sets the mouse status features for this session and updates them globally.
+ *
+ * @returns VBox status code.
+ *
+ * @param   pDevExt             The device extention.
+ * @param   pSession            The session.
+ * @param   fFeatures           New bitmap of enabled features.
+ */
+static int vbgdIoCtl_SetMouseStatus(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, uint32_t fFeatures)
+{
+    LogFlow(("VBOXGUEST_IOCTL_SET_MOUSE_STATUS: features=%#x\n", fFeatures));
+
+    if (fFeatures & ~VMMDEV_MOUSE_GUEST_MASK)
+        return VERR_INVALID_PARAMETER;
+
+    return vbgdSetSessionMouseStatus(pDevExt, pSession, fFeatures, ~fFeatures, false /*fSessionTermination*/);
+}
+
 
-        if (fSessionNotCaps)
+/**
+ * Return the mask of VMM device events that this session is allowed to see (wrt
+ * to "acquire" mode guest capabilities).
+ *
+ * The events associated with guest capabilities in "acquire" mode will be
+ * restricted to sessions which has acquired the respective capabilities.
+ * If someone else tries to wait for acquired events, they won't be woken up
+ * when the event becomes pending.  Should some other thread in the session
+ * acquire the capability while the corresponding event is pending, the waiting
+ * thread will woken up.
+ *
+ * @returns Mask of events valid for the given session.
+ * @param   pDevExt             The device extension.
+ * @param   pSession            The session.
+ *
+ * @remarks Needs only be called when dispatching events in the
+ *          VBOXGUEST_ACQUIRE_STYLE_EVENTS mask.
+ */
+static uint32_t vbgdGetAllowedEventMaskForSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession)
+{
+    uint32_t fAcquireModeGuestCaps;
+    uint32_t fAcquiredGuestCaps;
+    uint32_t fAllowedEvents;
+
+    /*
+     * Note! Reads pSession->fAcquiredGuestCaps and pDevExt->fAcquireModeGuestCaps
+     *       WITHOUT holding VBOXGUESTDEVEXT::SessionSpinlock.
+     */
+    fAcquireModeGuestCaps = ASMAtomicUoReadU32(&pDevExt->fAcquireModeGuestCaps);
+    if (fAcquireModeGuestCaps == 0)
+        return VMMDEV_EVENT_VALID_EVENT_MASK;
+    fAcquiredGuestCaps = ASMAtomicUoReadU32(&pSession->fAcquiredGuestCaps);
+
+    /*
+     * Calculate which events to allow according to the cap config and caps
+     * acquired by the session.
+     */
+    fAllowedEvents = VMMDEV_EVENT_VALID_EVENT_MASK;
+    if (   !(fAcquiredGuestCaps   & VMMDEV_GUEST_SUPPORTS_GRAPHICS)
+        && (fAcquireModeGuestCaps & VMMDEV_GUEST_SUPPORTS_GRAPHICS))
+        fAllowedEvents &= ~VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST;
+
+    if (   !(fAcquiredGuestCaps   & VMMDEV_GUEST_SUPPORTS_SEAMLESS)
+        && (fAcquireModeGuestCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS))
+        fAllowedEvents &= ~VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST;
+
+    return fAllowedEvents;
+}
+
+
+/**
+ * Init and termination worker for set guest capabilities to zero on the host.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         The device extension.
+ */
+static int vbgdResetCapabilitiesOnHost(PVBOXGUESTDEVEXT pDevExt)
+{
+    VMMDevReqGuestCapabilities2 *pReq;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetGuestCapabilities);
+    if (RT_SUCCESS(rc))
+    {
+        pReq->u32NotMask = UINT32_MAX;
+        pReq->u32OrMask  = 0;
+        rc = VbglGRPerform(&pReq->header);
+
+        if (RT_FAILURE(rc))
+            LogRelFunc(("failed with rc=%Rrc\n", rc));
+        VbglGRFree(&pReq->header);
+    }
+    return rc;
+}
+
+
+/**
+ * Sets the guest capabilities to the host while holding the lock.
+ *
+ * This will ASSUME that we're the ones in charge of the mask, so
+ * we'll simply clear all bits we don't set.
+ *
+ * @returns VBox status code.
+ * @param   fMask       The new mask.
+ */
+static int vbgdUpdateCapabilitiesOnHostWithReqAndLock(PVBOXGUESTDEVEXT pDevExt, VMMDevReqGuestCapabilities2 *pReq)
+{
+    int rc;
+
+    pReq->u32OrMask = pDevExt->fAcquiredGuestCaps | pDevExt->SetGuestCapsTracker.fMask;
+    if (pReq->u32OrMask == pDevExt->fGuestCapsHost)
+        rc = VINF_SUCCESS;
+    else
+    {
+        pDevExt->fGuestCapsHost = pReq->u32OrMask;
+        pReq->u32NotMask = ~pReq->u32OrMask;
+        rc = VbglGRPerform(&pReq->header);
+        if (RT_FAILURE(rc))
+            pDevExt->fGuestCapsHost = UINT32_MAX;
+    }
+
+    return rc;
+}
+
+
+/**
+ * Switch a set of capabilities into "acquire" mode and (maybe) acquire them for
+ * the given session.
+ *
+ * This is called in response to VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE as well as
+ * to do session cleanup.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt             The device extension.
+ * @param   pSession            The session.
+ * @param   fOrMask             The capabilities to add .
+ * @param   fNotMask            The capabilities to remove.  Ignored in
+ *                              VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE.
+ * @param   enmFlags            Confusing operation modifier.
+ *                              VBOXGUESTCAPSACQUIRE_FLAGS_NONE means to both
+ *                              configure and acquire/release the capabilities.
+ *                              VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE
+ *                              means only configure capabilities in the
+ *                              @a fOrMask capabilities for "acquire" mode.
+ * @param   fSessionTermination Set if we're called by the session cleanup code.
+ *                              This tweaks the error handling so we perform
+ *                              proper session cleanup even if the host
+ *                              misbehaves.
+ *
+ * @remarks Takes both the session and event spinlocks.
+ */
+static int vbgdAcquireSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                          uint32_t fOrMask, uint32_t fNotMask, VBOXGUESTCAPSACQUIRE_FLAGS enmFlags,
+                                          bool fSessionTermination)
+{
+    uint32_t fCurrentOwnedCaps;
+    uint32_t fSessionRemovedCaps;
+    uint32_t fSessionAddedCaps;
+    uint32_t fOtherConflictingCaps;
+    VMMDevReqGuestCapabilities2 *pReq = NULL;
+    int rc;
+
+
+    /*
+     * Validate and adjust input.
+     */
+    if (fOrMask & ~(  VMMDEV_GUEST_SUPPORTS_SEAMLESS
+                    | VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING
+                    | VMMDEV_GUEST_SUPPORTS_GRAPHICS ) )
+    {
+        LogRel(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x -- invalid fOrMask\n",
+                pSession, fOrMask, fNotMask, enmFlags));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    if (   enmFlags != VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE
+        && enmFlags != VBOXGUESTCAPSACQUIRE_FLAGS_NONE)
+    {
+        LogRel(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: invalid enmFlags %d\n",
+                pSession, fOrMask, fNotMask, enmFlags));
+        return VERR_INVALID_PARAMETER;
+    }
+    Assert(!fOrMask || !fSessionTermination);
+
+    /* The fNotMask no need to have all values valid, invalid ones will simply be ignored. */
+    fNotMask &= ~fOrMask;
+
+    /*
+     * Preallocate a update request if we're about to do more than just configure
+     * the capability mode.
+     */
+    if (enmFlags != VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE)
+    {
+        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetGuestCapabilities);
+        if (RT_SUCCESS(rc))
+        { /* do nothing */ }
+        else if (!fSessionTermination)
         {
-            pSession->u32AquiredGuestCaps &= ~fSessionNotCaps;
-            pDevExt->u32GuestCaps &= ~fSessionNotCaps;
+            LogRel(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: VbglGRAlloc failure: %Rrc\n",
+                    pSession, fOrMask, fNotMask, enmFlags, rc));
+            return rc;
         }
+        else
+            pReq = NULL; /* Ignore failure, we must do session cleanup. */
     }
 
-    RTSpinlockRelease(pDevExt->EventSpinlock);
+    /*
+     * Try switch the capabilities in the OR mask into "acquire" mode.
+     *
+     * Note! We currently ignore anyone which may already have "set" the capabilities
+     *       in fOrMask.  Perhaps not the best way to handle it, but it's simple...
+     */
+    RTSpinlockAcquire(pDevExt->EventSpinlock);
 
-    if (fOtherConflictingCaps)
+    if (!(pDevExt->fSetModeGuestCaps & fOrMask))
+        pDevExt->fAcquireModeGuestCaps |= fOrMask;
+    else
     {
-        Log(("VBoxGuestCommonGuestCapsAcquire: Caps 0x%x were busy\n", fOtherConflictingCaps));
-        return VERR_RESOURCE_BUSY;
+        RTSpinlockRelease(pDevExt->EventSpinlock);
+
+        if (pReq)
+            VbglGRFree(&pReq->header);
+        AssertMsgFailed(("Trying to change caps mode: %#x\n", fOrMask));
+        LogRel(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: calling caps acquire for set caps\n",
+                pSession, fOrMask, fNotMask, enmFlags));
+        return VERR_INVALID_STATE;
     }
 
-    /* now do host notification outside the lock */
-    if (!fSessionOrCaps && !fSessionNotCaps)
+    /*
+     * If we only wanted to switch the capabilities into "acquire" mode, we're done now.
+     */
+    if (enmFlags & VBOXGUESTCAPSACQUIRE_FLAGS_CONFIG_ACQUIRE_MODE)
     {
-        /* no changes, return */
+        RTSpinlockRelease(pDevExt->EventSpinlock);
+
+        Assert(!pReq);
+        Log(("vbgdAcquireSessionCapabilities: pSession=%p fOrMask=%#x fNotMask=%#x enmFlags=%#x: configured acquire caps: 0x%x\n",
+             pSession, fOrMask, fNotMask, enmFlags));
         return VINF_SUCCESS;
     }
+    Assert(pReq || fSessionTermination);
 
-    int rc = VBoxGuestSetGuestCapabilities(fSessionOrCaps, fSessionNotCaps);
-    if (RT_FAILURE(rc))
+    /*
+     * Caller wants to acquire/release the capabilities too.
+     *
+     * Note! The mode change of the capabilities above won't be reverted on
+     *       failure, this is intentional.
+     */
+    fCurrentOwnedCaps      = pSession->fAcquiredGuestCaps;
+    fSessionRemovedCaps    = fCurrentOwnedCaps & fNotMask;
+    fSessionAddedCaps      = fOrMask & ~fCurrentOwnedCaps;
+    fOtherConflictingCaps  = pDevExt->fAcquiredGuestCaps & ~fCurrentOwnedCaps;
+    fOtherConflictingCaps &= fSessionAddedCaps;
+
+    if (!fOtherConflictingCaps)
     {
-        LogRel(("VBoxGuestCommonGuestCapsAcquire: VBoxGuestSetGuestCapabilities failed, rc=%Rrc\n", rc));
+        if (fSessionAddedCaps)
+        {
+            pSession->fAcquiredGuestCaps |= fSessionAddedCaps;
+            pDevExt->fAcquiredGuestCaps  |= fSessionAddedCaps;
+        }
 
-        /* Failure branch
-         * this is generally bad since e.g. failure to release the caps may result in other sessions not being able to use it
-         * so we are not trying to restore the caps back to their values before the VBoxGuestCommonGuestCapsAcquire call,
-         * but just pretend everithing is OK.
-         * @todo: better failure handling mechanism? */
-    }
+        if (fSessionRemovedCaps)
+        {
+            pSession->fAcquiredGuestCaps &= ~fSessionRemovedCaps;
+            pDevExt->fAcquiredGuestCaps  &= ~fSessionRemovedCaps;
+        }
 
-    /* success! */
-    uint32_t fGenFakeEvents = 0;
+        /*
+         * If something changes (which is very likely), tell the host.
+         */
+        if (fSessionAddedCaps || fSessionRemovedCaps || pDevExt->fGuestCapsHost == UINT32_MAX)
+        {
+            Assert(pReq || fSessionTermination);
+            if (pReq)
+            {
+                rc = vbgdUpdateCapabilitiesOnHostWithReqAndLock(pDevExt, pReq);
+                if (RT_FAILURE(rc) && !fSessionTermination)
+                {
+                    /* Failed, roll back. */
+                    if (fSessionAddedCaps)
+                    {
+                        pSession->fAcquiredGuestCaps &= ~fSessionAddedCaps;
+                        pDevExt->fAcquiredGuestCaps  &= ~fSessionAddedCaps;
+                    }
+                    if (fSessionRemovedCaps)
+                    {
+                        pSession->fAcquiredGuestCaps |= fSessionRemovedCaps;
+                        pDevExt->fAcquiredGuestCaps  |= fSessionRemovedCaps;
+                    }
 
-    if (fSessionOrCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS)
+                    RTSpinlockRelease(pDevExt->EventSpinlock);
+                    LogRel(("vbgdAcquireSessionCapabilities: vbgdUpdateCapabilitiesOnHostWithReqAndLock failed: rc=%Rrc\n", rc));
+                    VbglGRFree(&pReq->header);
+                    return rc;
+                }
+            }
+        }
+    }
+    else
     {
-        /* generate the seamless change event so that the r3 app could synch with the seamless state
-         * although this introduces a false alarming of r3 client, it still solve the problem of
-         * client state inconsistency in multiuser environment */
-        fGenFakeEvents |= VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST;
+        RTSpinlockRelease(pDevExt->EventSpinlock);
+
+        Log(("vbgdAcquireSessionCapabilities: Caps %#x were busy\n", fOtherConflictingCaps));
+        VbglGRFree(&pReq->header);
+        return VERR_RESOURCE_BUSY;
     }
 
-    /* since the acquire filter mask has changed, we need to process events in any way to ensure they go from pending events field
-     * to the proper (un-filtered) entries */
-    VBoxGuestCommonCheckEvents(pDevExt, pSession, fGenFakeEvents);
+    RTSpinlockRelease(pDevExt->EventSpinlock);
+    if (pReq)
+        VbglGRFree(&pReq->header);
+
+    /*
+     * If we added a capability, check if that means some other thread in our
+     * session should be unblocked because there are events pending.
+     *
+     * HACK ALERT! When the seamless support capability is added we generate a
+     *             seamless change event so that the ring-3 client can sync with
+     *             the seamless state. Although this introduces a spurious
+     *             wakeups of the ring-3 client, it solves the problem of client
+     *             state inconsistency in multiuser environment (on Windows).
+     */
+    if (fSessionAddedCaps)
+    {
+        uint32_t fGenFakeEvents = 0;
+        if (fSessionAddedCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS)
+            fGenFakeEvents |= VMMDEV_EVENT_SEAMLESS_MODE_CHANGE_REQUEST;
+
+        RTSpinlockAcquire(pDevExt->EventSpinlock);
+        if (fGenFakeEvents || pDevExt->f32PendingEvents)
+            vbgdDispatchEventsLocked(pDevExt, fGenFakeEvents);
+        RTSpinlockRelease(pDevExt->EventSpinlock);
+
+#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
+        VbgdCommonWaitDoWakeUps(pDevExt);
+#endif
+    }
 
     return VINF_SUCCESS;
 }
 
 
-static int VBoxGuestCommonIOCTL_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestCapsAquire *pAcquire)
+/**
+ * Handle VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE.
+ *
+ * @returns VBox status code.
+ *
+ * @param   pDevExt             The device extension.
+ * @param   pSession            The session.
+ * @param   pAcquire            The request.
+ */
+static int vbgdIoCtl_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestCapsAquire *pAcquire)
 {
-    int rc = VBoxGuestCommonGuestCapsAcquire(pDevExt, pSession, pAcquire->u32OrMask, pAcquire->u32NotMask, pAcquire->enmFlags);
+    int rc;
+    LogFlow(("VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE: or=%#x not=%#x flags=%#x\n",
+             pAcquire->u32OrMask, pAcquire->u32NotMask, pAcquire->enmFlags));
+
+    rc = vbgdAcquireSessionCapabilities(pDevExt, pSession, pAcquire->u32OrMask, pAcquire->u32NotMask, pAcquire->enmFlags,
+                                        false /*fSessionTermination*/);
     if (RT_FAILURE(rc))
-        LogRel(("VBoxGuestCommonIOCtl: GUEST_CAPS_ACQUIRE failed rc=%Rrc\n", rc));
+        LogRel(("VbgdCommonIoCtl: GUEST_CAPS_ACQUIRE failed rc=%Rrc\n", rc));
     pAcquire->rc = rc;
     return VINF_SUCCESS;
 }
 
 
 /**
+ * Sets the guest capabilities for a session.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt             The device extension.
+ * @param   pSession            The session.
+ * @param   fOrMask             The capabilities to add.
+ * @param   fNotMask            The capabilities to remove.
+ * @param   fSessionTermination Set if we're called by the session cleanup code.
+ *                              This tweaks the error handling so we perform
+ *                              proper session cleanup even if the host
+ *                              misbehaves.
+ *
+ * @remarks Takes the session spinlock.
+ */
+static int vbgdSetSessionCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                                      uint32_t fOrMask, uint32_t fNotMask, bool fSessionTermination)
+{
+    /*
+     * Preallocate a request buffer so we can do all in one go without leaving the spinlock.
+     */
+    VMMDevReqGuestCapabilities2 *pReq;
+    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_SetGuestCapabilities);
+    if (RT_SUCCESS(rc))
+    { /* nothing */ }
+    else if (!fSessionTermination)
+    {
+        LogRel(("vbgdSetSessionCapabilities: VbglGRAlloc failure: %Rrc\n", rc));
+        return rc;
+    }
+    else
+        pReq = NULL; /* Ignore failure, we must do session cleanup. */
+
+
+    RTSpinlockAcquire(pDevExt->SessionSpinlock);
+
+#ifndef VBOXGUEST_DISREGARD_ACQUIRE_MODE_GUEST_CAPS
+    /*
+     * Capabilities in "acquire" mode cannot be set via this API.
+     * (Acquire mode is only used on windows at the time of writing.)
+     */
+    if (!(fOrMask & pDevExt->fAcquireModeGuestCaps))
+#endif
+    {
+        /*
+         * Apply the changes to the session mask.
+         */
+        uint32_t fChanged;
+        uint32_t fPrevious = pSession->fCapabilities;
+        pSession->fCapabilities |= fOrMask;
+        pSession->fCapabilities &= ~fNotMask;
+
+        /*
+         * If anything actually changed, update the global usage counters.
+         */
+        fChanged = fPrevious ^ pSession->fCapabilities;
+        if (fChanged)
+        {
+            bool fGlobalChange = vbgdBitUsageTrackerChange(&pDevExt->SetGuestCapsTracker, fChanged, fPrevious,
+                                                           pDevExt->cSessions, "SetGuestCapsTracker");
+
+            /*
+             * If there are global changes, update the capabilities on the host.
+             */
+            if (fGlobalChange || pDevExt->fGuestCapsHost == UINT32_MAX)
+            {
+                Assert(pReq || fSessionTermination);
+                if (pReq)
+                {
+                    rc = vbgdUpdateCapabilitiesOnHostWithReqAndLock(pDevExt, pReq);
+
+                    /* On failure, roll back (unless it's session termination time). */
+                    if (RT_FAILURE(rc) && !fSessionTermination)
+                    {
+                        vbgdBitUsageTrackerChange(&pDevExt->SetGuestCapsTracker, fChanged, pSession->fCapabilities,
+                                                  pDevExt->cSessions, "SetGuestCapsTracker");
+                        pSession->fCapabilities = fPrevious;
+                    }
+                }
+            }
+        }
+    }
+#ifndef VBOXGUEST_DISREGARD_ACQUIRE_MODE_GUEST_CAPS
+    else
+        rc = VERR_RESOURCE_BUSY;
+#endif
+
+    RTSpinlockRelease(pDevExt->SessionSpinlock);
+    if (pReq)
+        VbglGRFree(&pReq->header);
+    return rc;
+}
+
+
+/**
+ * Handle VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES.
+ *
+ * @returns VBox status code.
+ *
+ * @param   pDevExt             The device extension.
+ * @param   pSession            The session.
+ * @param   pInfo               The request.
+ */
+static int vbgdIoCtl_SetCapabilities(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession, VBoxGuestSetCapabilitiesInfo *pInfo)
+{
+    int rc;
+    LogFlow(("VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES: or=%#x not=%#x\n", pInfo->u32OrMask, pInfo->u32NotMask));
+
+    if (!((pInfo->u32OrMask | pInfo->u32NotMask) & ~VMMDEV_GUEST_CAPABILITIES_MASK))
+        rc = vbgdSetSessionCapabilities(pDevExt, pSession, pInfo->u32OrMask, pInfo->u32NotMask, false /*fSessionTermination*/);
+    else
+        rc = VERR_INVALID_PARAMETER;
+
+    return rc;
+}
+
+/** @} */
+
+
+/**
  * Common IOCtl for user to kernel and kernel to kernel communication.
  *
  * This function only does the basic validation and then invokes
@@ -2700,11 +3330,11 @@ static int VBoxGuestCommonIOCTL_GuestCapsAcquire(PVBOXGUESTDEVEXT pDevExt, PVBOX
  * @param   cbData              The max size of the data buffer.
  * @param   pcbDataReturned     Where to store the amount of returned data. Can be NULL.
  */
-int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                         void *pvData, size_t cbData, size_t *pcbDataReturned)
+int VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                    void *pvData, size_t cbData, size_t *pcbDataReturned)
 {
     int rc;
-    LogFlow(("VBoxGuestCommonIOCtl: iFunction=%#x pDevExt=%p pSession=%p pvData=%p cbData=%zu\n",
+    LogFlow(("VbgdCommonIoCtl: iFunction=%#x pDevExt=%p pSession=%p pvData=%p cbData=%zu\n",
              iFunction, pDevExt, pSession, pvData, cbData));
 
     /*
@@ -2762,7 +3392,7 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
     if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_VMMREQUEST(0)))
     {
         CHECKRET_MIN_SIZE("VMMREQUEST", sizeof(VMMDevRequestHeader));
-        rc = VBoxGuestCommonIOCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned);
+        rc = vbgdIoCtl_VMMRequest(pDevExt, pSession, (VMMDevRequestHeader *)pvData, cbData, pcbDataReturned);
     }
 #ifdef VBOX_WITH_HGCM
     /*
@@ -2772,51 +3402,51 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
     {
         bool fInterruptible = pSession->R0Process != NIL_RTR0PROCESS;
         CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
-        rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
-                                           fInterruptible, false /*f32bit*/, false /* fUserData */,
-                                           0, cbData, pcbDataReturned);
+        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
+                                fInterruptible, false /*f32bit*/, false /* fUserData */,
+                                0, cbData, pcbDataReturned);
     }
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED(0)))
     {
         VBoxGuestHGCMCallInfoTimed *pInfo = (VBoxGuestHGCMCallInfoTimed *)pvData;
         CHECKRET_MIN_SIZE("HGCM_CALL_TIMED", sizeof(VBoxGuestHGCMCallInfoTimed));
-        rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
-                                           !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
-                                           false /*f32bit*/, false /* fUserData */,
-                                           RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
+        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
+                                !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
+                                false /*f32bit*/, false /* fUserData */,
+                                RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
     }
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(0)))
     {
         bool fInterruptible = true;
         CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
-        rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
-                                           fInterruptible, false /*f32bit*/, true /* fUserData */,
-                                           0, cbData, pcbDataReturned);
+        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
+                                fInterruptible, false /*f32bit*/, true /* fUserData */,
+                                0, cbData, pcbDataReturned);
     }
 # ifdef RT_ARCH_AMD64
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_32(0)))
     {
         bool fInterruptible = pSession->R0Process != NIL_RTR0PROCESS;
         CHECKRET_MIN_SIZE("HGCM_CALL", sizeof(VBoxGuestHGCMCallInfo));
-        rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
-                                           fInterruptible, true /*f32bit*/, false /* fUserData */,
-                                           0, cbData, pcbDataReturned);
+        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, (VBoxGuestHGCMCallInfo *)pvData, RT_INDEFINITE_WAIT,
+                                fInterruptible, true /*f32bit*/, false /* fUserData */,
+                                0, cbData, pcbDataReturned);
     }
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(0)))
     {
         CHECKRET_MIN_SIZE("HGCM_CALL_TIMED", sizeof(VBoxGuestHGCMCallInfoTimed));
         VBoxGuestHGCMCallInfoTimed *pInfo = (VBoxGuestHGCMCallInfoTimed *)pvData;
-        rc = VBoxGuestCommonIOCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
-                                           !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
-                                           true /*f32bit*/, false /* fUserData */,
-                                           RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
+        rc = vbgdIoCtl_HGCMCall(pDevExt, pSession, &pInfo->info, pInfo->u32Timeout,
+                                !!pInfo->fInterruptible || pSession->R0Process != NIL_RTR0PROCESS,
+                                true /*f32bit*/, false /* fUserData */,
+                                RT_OFFSETOF(VBoxGuestHGCMCallInfoTimed, info), cbData, pcbDataReturned);
     }
 # endif
 #endif /* VBOX_WITH_HGCM */
     else if (VBOXGUEST_IOCTL_STRIP_SIZE(iFunction) == VBOXGUEST_IOCTL_STRIP_SIZE(VBOXGUEST_IOCTL_LOG(0)))
     {
         CHECKRET_MIN_SIZE("LOG", 1);
-        rc = VBoxGuestCommonIOCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned, pSession->fUserSession);
+        rc = vbgdIoCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned, pSession->fUserSession);
     }
     else
     {
@@ -2825,34 +3455,31 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
             case VBOXGUEST_IOCTL_GETVMMDEVPORT:
                 CHECKRET_RING0("GETVMMDEVPORT");
                 CHECKRET_MIN_SIZE("GETVMMDEVPORT", sizeof(VBoxGuestPortInfo));
-                rc = VBoxGuestCommonIOCtl_GetVMMDevPort(pDevExt, (VBoxGuestPortInfo *)pvData, pcbDataReturned);
+                rc = vbgdIoCtl_GetVMMDevPort(pDevExt, (VBoxGuestPortInfo *)pvData, pcbDataReturned);
                 break;
 
 #ifndef RT_OS_WINDOWS  /* Windows has its own implementation of this. */
             case VBOXGUEST_IOCTL_SET_MOUSE_NOTIFY_CALLBACK:
                 CHECKRET_RING0("SET_MOUSE_NOTIFY_CALLBACK");
                 CHECKRET_SIZE("SET_MOUSE_NOTIFY_CALLBACK", sizeof(VBoxGuestMouseSetNotifyCallback));
-                rc = VBoxGuestCommonIOCtl_SetMouseNotifyCallback(pDevExt, (VBoxGuestMouseSetNotifyCallback *)pvData);
+                rc = vbgdIoCtl_SetMouseNotifyCallback(pDevExt, (VBoxGuestMouseSetNotifyCallback *)pvData);
                 break;
 #endif
 
             case VBOXGUEST_IOCTL_WAITEVENT:
                 CHECKRET_MIN_SIZE("WAITEVENT", sizeof(VBoxGuestWaitEventInfo));
-                rc = VBoxGuestCommonIOCtl_WaitEvent(pDevExt, pSession, (VBoxGuestWaitEventInfo *)pvData,
+                rc = vbgdIoCtl_WaitEvent(pDevExt, pSession, (VBoxGuestWaitEventInfo *)pvData,
                                                     pcbDataReturned, pSession->R0Process != NIL_RTR0PROCESS);
                 break;
 
             case VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS:
-                if (cbData != 0)
-                    rc = VERR_INVALID_PARAMETER;
-                rc = VBoxGuestCommonIOCtl_CancelAllWaitEvents(pDevExt, pSession);
+                CHECKRET_SIZE("CANCEL_ALL_WAITEVENTS", 0);
+                rc = vbgdIoCtl_CancelAllWaitEvents(pDevExt, pSession);
                 break;
 
             case VBOXGUEST_IOCTL_CTL_FILTER_MASK:
-                CHECKRET_MIN_SIZE("CTL_FILTER_MASK",
-                                  sizeof(VBoxGuestFilterMaskInfo));
-                rc = VBoxGuestCommonIOCtl_CtlFilterMask(pDevExt, pSession,
-                                             (VBoxGuestFilterMaskInfo *)pvData);
+                CHECKRET_MIN_SIZE("CTL_FILTER_MASK", sizeof(VBoxGuestFilterMaskInfo));
+                rc = vbgdIoCtl_CtlFilterMask(pDevExt, pSession, (VBoxGuestFilterMaskInfo *)pvData);
                 break;
 
 #ifdef VBOX_WITH_HGCM
@@ -2861,7 +3488,7 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
             case VBOXGUEST_IOCTL_HGCM_CONNECT_32:
 # endif
                 CHECKRET_MIN_SIZE("HGCM_CONNECT", sizeof(VBoxGuestHGCMConnectInfo));
-                rc = VBoxGuestCommonIOCtl_HGCMConnect(pDevExt, pSession, (VBoxGuestHGCMConnectInfo *)pvData, pcbDataReturned);
+                rc = vbgdIoCtl_HGCMConnect(pDevExt, pSession, (VBoxGuestHGCMConnectInfo *)pvData, pcbDataReturned);
                 break;
 
             case VBOXGUEST_IOCTL_HGCM_DISCONNECT:
@@ -2869,29 +3496,28 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
             case VBOXGUEST_IOCTL_HGCM_DISCONNECT_32:
 # endif
                 CHECKRET_MIN_SIZE("HGCM_DISCONNECT", sizeof(VBoxGuestHGCMDisconnectInfo));
-                rc = VBoxGuestCommonIOCtl_HGCMDisconnect(pDevExt, pSession, (VBoxGuestHGCMDisconnectInfo *)pvData, pcbDataReturned);
+                rc = vbgdIoCtl_HGCMDisconnect(pDevExt, pSession, (VBoxGuestHGCMDisconnectInfo *)pvData, pcbDataReturned);
                 break;
 #endif /* VBOX_WITH_HGCM */
 
             case VBOXGUEST_IOCTL_CHECK_BALLOON:
                 CHECKRET_MIN_SIZE("CHECK_MEMORY_BALLOON", sizeof(VBoxGuestCheckBalloonInfo));
-                rc = VBoxGuestCommonIOCtl_CheckMemoryBalloon(pDevExt, pSession, (VBoxGuestCheckBalloonInfo *)pvData, pcbDataReturned);
+                rc = vbgdIoCtl_CheckMemoryBalloon(pDevExt, pSession, (VBoxGuestCheckBalloonInfo *)pvData, pcbDataReturned);
                 break;
 
             case VBOXGUEST_IOCTL_CHANGE_BALLOON:
                 CHECKRET_MIN_SIZE("CHANGE_MEMORY_BALLOON", sizeof(VBoxGuestChangeBalloonInfo));
-                rc = VBoxGuestCommonIOCtl_ChangeMemoryBalloon(pDevExt, pSession, (VBoxGuestChangeBalloonInfo *)pvData, pcbDataReturned);
+                rc = vbgdIoCtl_ChangeMemoryBalloon(pDevExt, pSession, (VBoxGuestChangeBalloonInfo *)pvData, pcbDataReturned);
                 break;
 
             case VBOXGUEST_IOCTL_WRITE_CORE_DUMP:
                 CHECKRET_MIN_SIZE("WRITE_CORE_DUMP", sizeof(VBoxGuestWriteCoreDump));
-                rc = VBoxGuestCommonIOCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);
+                rc = vbgdIoCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);
                 break;
 
             case VBOXGUEST_IOCTL_SET_MOUSE_STATUS:
                 CHECKRET_SIZE("SET_MOUSE_STATUS", sizeof(uint32_t));
-                rc = vboxGuestCommonIOCtl_SetMouseStatus(pDevExt, pSession,
-                                                         *(uint32_t *)pvData);
+                rc = vbgdIoCtl_SetMouseStatus(pDevExt, pSession, *(uint32_t *)pvData);
                 break;
 
 #ifdef VBOX_WITH_DPC_LATENCY_CHECKER
@@ -2903,20 +3529,18 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
 
             case VBOXGUEST_IOCTL_GUEST_CAPS_ACQUIRE:
                 CHECKRET_SIZE("GUEST_CAPS_ACQUIRE", sizeof(VBoxGuestCapsAquire));
-                rc = VBoxGuestCommonIOCTL_GuestCapsAcquire(pDevExt, pSession, (VBoxGuestCapsAquire*)pvData);
+                rc = vbgdIoCtl_GuestCapsAcquire(pDevExt, pSession, (VBoxGuestCapsAquire *)pvData);
                 *pcbDataReturned = sizeof(VBoxGuestCapsAquire);
                 break;
 
             case VBOXGUEST_IOCTL_SET_GUEST_CAPABILITIES:
-                CHECKRET_MIN_SIZE("SET_GUEST_CAPABILITIES",
-                                  sizeof(VBoxGuestSetCapabilitiesInfo));
-                rc = VBoxGuestCommonIOCtl_SetCapabilities(pDevExt, pSession,
-                                        (VBoxGuestSetCapabilitiesInfo *)pvData);
+                CHECKRET_MIN_SIZE("SET_GUEST_CAPABILITIES", sizeof(VBoxGuestSetCapabilitiesInfo));
+                rc = vbgdIoCtl_SetCapabilities(pDevExt, pSession, (VBoxGuestSetCapabilitiesInfo *)pvData);
                 break;
 
             default:
             {
-                LogRel(("VBoxGuestCommonIOCtl: Unknown request iFunction=%#x stripped size=%#x\n",
+                LogRel(("VbgdCommonIoCtl: Unknown request iFunction=%#x stripped size=%#x\n",
                         iFunction, VBOXGUEST_IOCTL_STRIP_SIZE(iFunction)));
                 rc = VERR_NOT_SUPPORTED;
                 break;
@@ -2924,11 +3548,58 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
         }
     }
 
-    LogFlow(("VBoxGuestCommonIOCtl: returns %Rrc *pcbDataReturned=%zu\n", rc, pcbDataReturned ? *pcbDataReturned : 0));
+    LogFlow(("VbgdCommonIoCtl: returns %Rrc *pcbDataReturned=%zu\n", rc, pcbDataReturned ? *pcbDataReturned : 0));
     return rc;
 }
 
 
+/**
+ * Used by VbgdCommonISR as well as the acquire guest capability code.
+ *
+ * @returns VINF_SUCCESS on success. On failure, ORed together
+ *          RTSemEventMultiSignal errors (completes processing despite errors).
+ * @param   pDevExt             The VBoxGuest device extension.
+ * @param   fEvents             The events to dispatch.
+ */
+static int vbgdDispatchEventsLocked(PVBOXGUESTDEVEXT pDevExt, uint32_t fEvents)
+{
+    PVBOXGUESTWAIT  pWait;
+    PVBOXGUESTWAIT  pSafe;
+    int             rc = VINF_SUCCESS;
+
+    fEvents |= pDevExt->f32PendingEvents;
+
+    RTListForEachSafe(&pDevExt->WaitList, pWait, pSafe, VBOXGUESTWAIT, ListNode)
+    {
+        uint32_t fHandledEvents = pWait->fReqEvents & fEvents;
+        if (    fHandledEvents != 0
+            &&  !pWait->fResEvents)
+        {
+            /* Does this one wait on any of the events we're dispatching?  We do a quick
+               check first, then deal with VBOXGUEST_ACQUIRE_STYLE_EVENTS as applicable. */
+            if (fHandledEvents & VBOXGUEST_ACQUIRE_STYLE_EVENTS)
+                fHandledEvents &= vbgdGetAllowedEventMaskForSession(pDevExt, pWait->pSession);
+            if (fHandledEvents)
+            {
+                pWait->fResEvents = pWait->fReqEvents & fEvents & fHandledEvents;
+                fEvents &= ~pWait->fResEvents;
+                RTListNodeRemove(&pWait->ListNode);
+#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
+                RTListAppend(&pDevExt->WakeUpList, &pWait->ListNode);
+#else
+                RTListAppend(&pDevExt->WokenUpList, &pWait->ListNode);
+                rc |= RTSemEventMultiSignal(pWait->Event);
+#endif
+                if (!fEvents)
+                    break;
+            }
+        }
+    }
+
+    ASMAtomicWriteU32(&pDevExt->f32PendingEvents, fEvents);
+    return rc;
+}
+
 
 /**
  * Common interrupt service routine.
@@ -2938,12 +3609,12 @@ int VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUES
  * @returns true if it was our interrupt, false if it wasn't.
  * @param   pDevExt     The VBoxGuest device extension.
  */
-bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt)
+bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt)
 {
-    bool                            fMousePositionChanged = false;
-    VMMDevEvents volatile          *pReq                  = pDevExt->pIrqAckEvents;
-    int                             rc                    = 0;
-    bool                            fOurIrq;
+    VMMDevEvents volatile  *pReq                  = pDevExt->pIrqAckEvents;
+    bool                    fMousePositionChanged = false;
+    int                     rc                    = 0;
+    bool                    fOurIrq;
 
     /*
      * Make sure we've initialized the device extension.
@@ -2973,7 +3644,7 @@ bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt)
             PVBOXGUESTWAIT  pWait;
             PVBOXGUESTWAIT  pSafe;
 
-            Log3(("VBoxGuestCommonISR: acknowledge events succeeded %#RX32\n", fEvents));
+            Log3(("VbgdCommonISR: acknowledge events succeeded %#RX32\n", fEvents));
 
             /*
              * VMMDEV_EVENT_MOUSE_POSITION_CHANGED can only be polled for.
@@ -3015,44 +3686,24 @@ bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt)
             /*
              * Normal FIFO waiter evaluation.
              */
-            fEvents |= pDevExt->f32PendingEvents;
-            RTListForEachSafe(&pDevExt->WaitList, pWait, pSafe, VBOXGUESTWAIT, ListNode)
-            {
-                uint32_t fHandledEvents = VBoxGuestCommonGetHandledEventsLocked(pDevExt, pWait->pSession);
-                if (    (pWait->fReqEvents & fEvents & fHandledEvents)
-                    &&  !pWait->fResEvents)
-                {
-                    pWait->fResEvents = pWait->fReqEvents & fEvents & fHandledEvents;
-                    fEvents &= ~pWait->fResEvents;
-                    RTListNodeRemove(&pWait->ListNode);
-#ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-                    RTListAppend(&pDevExt->WakeUpList, &pWait->ListNode);
-#else
-                    RTListAppend(&pDevExt->WokenUpList, &pWait->ListNode);
-                    rc |= RTSemEventMultiSignal(pWait->Event);
-#endif
-                    if (!fEvents)
-                        break;
-                }
-            }
-            ASMAtomicWriteU32(&pDevExt->f32PendingEvents, fEvents);
+            rc |= vbgdDispatchEventsLocked(pDevExt, fEvents);
         }
         else /* something is serious wrong... */
-            Log(("VBoxGuestCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n",
+            Log(("VbgdCommonISR: acknowledge events failed rc=%Rrc (events=%#x)!!\n",
                  pReq->header.rc, pReq->events));
     }
     else
-        Log3(("VBoxGuestCommonISR: not ours\n"));
+        Log3(("VbgdCommonISR: not ours\n"));
 
     RTSpinlockRelease(pDevExt->EventSpinlock);
 
-#if defined(VBOXGUEST_USE_DEFERRED_WAKE_UP) && !defined(RT_OS_WINDOWS)
+#if defined(VBOXGUEST_USE_DEFERRED_WAKE_UP) && !defined(RT_OS_DARWIN) && !defined(RT_OS_WINDOWS)
     /*
      * Do wake-ups.
      * Note. On Windows this isn't possible at this IRQL, so a DPC will take
-     *       care of it.
+     *       care of it.  Same on darwin, doing it in the work loop callback.
      */
-    VBoxGuestWaitDoWakeUps(pDevExt);
+    VbgdCommonWaitDoWakeUps(pDevExt);
 #endif
 
     /*
@@ -3062,7 +3713,7 @@ bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt)
     if (fMousePositionChanged)
     {
         ASMAtomicIncU32(&pDevExt->u32MousePosChangedSeq);
-        VBoxGuestNativeISRMousePollEvent(pDevExt);
+        VbgdNativeISRMousePollEvent(pDevExt);
     }
 
     Assert(rc == 0);
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp b/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp
deleted file mode 100644
index ef3fd21..0000000
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $Id: VBoxGuest2.cpp $ */
-/** @file
- * VBoxGuest - Guest Additions Driver, bits shared with the windows code.
- */
-
-/*
- * Copyright (C) 2011-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#include <iprt/string.h>
-#include <VBox/err.h>
-#include <VBox/log.h>
-#include <VBox/VBoxGuestLib.h>
-#include <VBox/version.h>
-#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
-# include "revision-generated.h"
-#endif
-#include "VBoxGuest2.h"
-
-/** @todo Remove and merge this file with VBoxGuest.cpp when the Windows driver
-  *       also will be built from the common sources. */
-
-/**
- * Report the guest information to the host.
- *
- * @returns IPRT status code.
- * @param   enmOSType       The OS type to report.
- */
-int VBoxGuestReportGuestInfo(VBOXOSTYPE enmOSType)
-{
-    /*
-     * Allocate and fill in the two guest info reports.
-     */
-    VMMDevReportGuestInfo2 *pReqInfo2 = NULL;
-    VMMDevReportGuestInfo  *pReqInfo1 = NULL;
-    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo2, sizeof (VMMDevReportGuestInfo2), VMMDevReq_ReportGuestInfo2);
-    Log(("VBoxGuestReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
-    if (RT_SUCCESS(rc))
-    {
-        pReqInfo2->guestInfo.additionsMajor    = VBOX_VERSION_MAJOR;
-        pReqInfo2->guestInfo.additionsMinor    = VBOX_VERSION_MINOR;
-        pReqInfo2->guestInfo.additionsBuild    = VBOX_VERSION_BUILD;
-        pReqInfo2->guestInfo.additionsRevision = VBOX_SVN_REV;
-        pReqInfo2->guestInfo.additionsFeatures = 0; /* (no features defined yet) */
-        RTStrCopy(pReqInfo2->guestInfo.szName, sizeof(pReqInfo2->guestInfo.szName), VBOX_VERSION_STRING);
-
-        rc = VbglGRAlloc((VMMDevRequestHeader **)&pReqInfo1, sizeof (VMMDevReportGuestInfo), VMMDevReq_ReportGuestInfo);
-        Log(("VBoxGuestReportGuestInfo: VbglGRAlloc VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
-        if (RT_SUCCESS(rc))
-        {
-            pReqInfo1->guestInfo.interfaceVersion = VMMDEV_VERSION;
-            pReqInfo1->guestInfo.osType           = enmOSType;
-
-            /*
-             * There are two protocols here:
-             *      1. Info2 + Info1. Supported by >=3.2.51.
-             *      2. Info1 and optionally Info2. The old protocol.
-             *
-             * We try protocol 1 first.  It will fail with VERR_NOT_SUPPORTED
-             * if not supported by the VMMDev (message ordering requirement).
-             */
-            rc = VbglGRPerform(&pReqInfo2->header);
-            Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
-            if (RT_SUCCESS(rc))
-            {
-                rc = VbglGRPerform(&pReqInfo1->header);
-                Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
-            }
-            else if (   rc == VERR_NOT_SUPPORTED
-                     || rc == VERR_NOT_IMPLEMENTED)
-            {
-                rc = VbglGRPerform(&pReqInfo1->header);
-                Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo completed with rc=%Rrc\n", rc));
-                if (RT_SUCCESS(rc))
-                {
-                    rc = VbglGRPerform(&pReqInfo2->header);
-                    Log(("VBoxGuestReportGuestInfo: VbglGRPerform VMMDevReportGuestInfo2 completed with rc=%Rrc\n", rc));
-                    if (rc == VERR_NOT_IMPLEMENTED)
-                        rc = VINF_SUCCESS;
-                }
-            }
-            VbglGRFree(&pReqInfo1->header);
-        }
-        VbglGRFree(&pReqInfo2->header);
-    }
-
-    return rc;
-}
-
-
-/**
- * Report the guest driver status to the host.
- *
- * @returns IPRT status code.
- * @param   fActive         Flag whether the driver is now active or not.
- */
-int VBoxGuestReportDriverStatus(bool fActive)
-{
-    /*
-     * Report guest status of the VBox driver to the host.
-     */
-    VMMDevReportGuestStatus *pReq2 = NULL;
-    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq2, sizeof(*pReq2), VMMDevReq_ReportGuestStatus);
-    Log(("VBoxGuestReportDriverStatus: VbglGRAlloc VMMDevReportGuestStatus completed with rc=%Rrc\n", rc));
-    if (RT_SUCCESS(rc))
-    {
-        pReq2->guestStatus.facility = VBoxGuestFacilityType_VBoxGuestDriver;
-        pReq2->guestStatus.status = fActive ?
-                                    VBoxGuestFacilityStatus_Active
-                                  : VBoxGuestFacilityStatus_Inactive;
-        pReq2->guestStatus.flags = 0;
-        rc = VbglGRPerform(&pReq2->header);
-        Log(("VBoxGuestReportDriverStatus: VbglGRPerform VMMDevReportGuestStatus completed with fActive=%d, rc=%Rrc\n",
-             fActive ? 1 : 0, rc));
-        if (rc == VERR_NOT_IMPLEMENTED) /* Compatibility with older hosts. */
-            rc = VINF_SUCCESS;
-        VbglGRFree(&pReq2->header);
-    }
-
-    return rc;
-}
-
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.h b/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.h
deleted file mode 100644
index f79fa81..0000000
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $Id: VBoxGuest2.h $ */
-/** @file
- * VBoxGuest - Guest Additions Driver, bits shared with the windows code.
- */
-
-/*
- * Copyright (C) 2010-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-#ifndef ___VBoxGuest2_h
-#define ___VBoxGuest2_h
-
-#include <VBox/ostypes.h>
-
-RT_C_DECLS_BEGIN
-
-int VBoxGuestReportGuestInfo(VBOXOSTYPE enmOSType);
-int VBoxGuestReportDriverStatus(bool fActive);
-
-RT_C_DECLS_END
-
-#endif
-
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm b/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm
index 008dd62..698eb7b 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuestA-os2.asm
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2007-2013 Oracle Corporation
+; Copyright (C) 2007-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h b/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h
index de0a512..f6bac0f 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h
@@ -1,4 +1,4 @@
-/* $Rev: 84795 $ */
+/* $Rev: 98751 $ */
 /** @file
  * VBoxGuest - Inter Driver Communication, unix implementation.
  *
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -68,7 +68,7 @@ DECLEXPORT(void *) VBOXCALL VBoxGuestIDCOpen(uint32_t *pu32Version)
     mutex_exit(&g_LdiMtx);
 #endif
 
-    rc = VBoxGuestCreateKernelSession(&g_DevExt, &pSession);
+    rc = VbgdCommonCreateKernelSession(&g_DevExt, &pSession);
     if (RT_SUCCESS(rc))
     {
         *pu32Version = VMMDEV_VERSION;
@@ -88,7 +88,7 @@ DECLEXPORT(void *) VBOXCALL VBoxGuestIDCOpen(uint32_t *pu32Version)
     mutex_exit(&g_LdiMtx);
 #endif
 
-    LogRel(("VBoxGuestIDCOpen: VBoxGuestCreateKernelSession failed. rc=%d\n", rc));
+    LogRel(("VBoxGuestIDCOpen: VbgdCommonCreateKernelSession failed. rc=%d\n", rc));
     return NULL;
 }
 
@@ -105,7 +105,7 @@ DECLEXPORT(int) VBOXCALL VBoxGuestIDCClose(void *pvSession)
     LogFlow(("VBoxGuestIDCClose:\n"));
 
     AssertPtrReturn(pSession, VERR_INVALID_POINTER);
-    VBoxGuestCloseSession(&g_DevExt, pSession);
+    VbgdCommonCloseSession(&g_DevExt, pSession);
 
 #ifdef RT_OS_SOLARIS
     mutex_enter(&g_LdiMtx);
@@ -143,6 +143,6 @@ DECLEXPORT(int) VBOXCALL VBoxGuestIDCCall(void *pvSession, unsigned iCmd, void *
     AssertMsgReturn(pSession->pDevExt == &g_DevExt,
                     ("SC: %p != %p\n", pSession->pDevExt, &g_DevExt), VERR_INVALID_HANDLE);
 
-    return VBoxGuestCommonIOCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
+    return VbgdCommonIoCtl(iCmd, &g_DevExt, pSession, pvData, cbData, pcbDataReturned);
 }
 
diff --git a/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h b/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
index f681f40..0d43f38 100644
--- a/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
+++ b/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -31,13 +31,14 @@
 #include <iprt/list.h>
 #include <iprt/semaphore.h>
 #include <iprt/spinlock.h>
+#include <iprt/timer.h>
 #include <VBox/VMMDev.h>
 #include <VBox/VBoxGuest.h>
 #include <VBox/VBoxGuestLib.h>
 
 /** @def VBOXGUEST_USE_WAKE_UP_LIST
  * Defer wake-up of waiting thread when defined. */
-#if defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(DOXYGEN_RUNNING)
+#if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) || defined(DOXYGEN_RUNNING)
 # define VBOXGUEST_USE_DEFERRED_WAKE_UP
 #endif
 
@@ -63,11 +64,11 @@ typedef struct VBOXGUESTWAIT
     /** The events we received. */
     uint32_t volatile           fResEvents;
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-    /** Set by VBoxGuestWaitDoWakeUps before leaving the spinlock to call
+    /** Set by VbgdCommonWaitDoWakeUps before leaving the spinlock to call
      *  RTSemEventMultiSignal. */
     bool volatile               fPendingWakeUp;
     /** Set by the requestor thread if it got the spinlock before the
-     * signaller.  Deals with the race in VBoxGuestWaitDoWakeUps. */
+     * signaller.  Deals with the race in VbgdCommonWaitDoWakeUps. */
     bool volatile               fFreeMe;
 #endif
     /** The event semaphore. */
@@ -107,6 +108,25 @@ typedef struct VBOXGUESTMEMBALLOON
 /** Pointer to a memory balloon. */
 typedef VBOXGUESTMEMBALLOON *PVBOXGUESTMEMBALLOON;
 
+
+/**
+ * Per bit usage tracker for a uint32_t mask.
+ *
+ * Used for optimal handling of guest properties, mouse status and event filter.
+ */
+typedef struct VBOXGUESTBITUSAGETRACER
+{
+    /** Per bit usage counters. */
+    uint32_t        acPerBitUsage[32];
+    /** The current mask according to acPerBitUsage. */
+    uint32_t        fMask;
+} VBOXGUESTBITUSAGETRACER;
+/** Pointer to a per bit usage tracker.  */
+typedef VBOXGUESTBITUSAGETRACER *PVBOXGUESTBITUSAGETRACER;
+/** Pointer to a const per bit usage tracker.  */
+typedef VBOXGUESTBITUSAGETRACER const *PCVBOXGUESTBITUSAGETRACER;
+
+
 /**
  * VBox guest device (data) extension.
  */
@@ -116,8 +136,6 @@ typedef struct VBOXGUESTDEVEXT
     RTIOPORT                    IOPortBase;
     /** Pointer to the mapping of the VMMDev adapter memory. */
     VMMDevMemory volatile      *pVMMDevMemory;
-    /** Events we won't permit anyone to filter out. */
-    uint32_t                    fFixedEvents;
     /** The memory object reserving space for the guest mappings. */
     RTR0MEMOBJ                  hGuestMappings;
     /** Spinlock protecting the signaling and resetting of the wait-for-event
@@ -161,6 +179,8 @@ typedef struct VBOXGUESTDEVEXT
      * but do not search it, so a list data type should be fine.  Use under the
      * #SessionSpinlock lock. */
     RTLISTANCHOR                SessionList;
+    /** Number of session. */
+    uint32_t                    cSessions;
     /** Flag indicating whether logging to the release log
      *  is enabled. */
     bool                        fLoggingEnabled;
@@ -168,16 +188,55 @@ typedef struct VBOXGUESTDEVEXT
     VBOXGUESTMEMBALLOON         MemBalloon;
     /** Callback and user data for a kernel mouse handler. */
     VBoxGuestMouseSetNotifyCallback MouseNotifyCallback;
+
+    /** @name Host Event Filtering
+     * @{ */
+    /** Events we won't permit anyone to filter out. */
+    uint32_t                    fFixedEvents;
+    /** Usage counters for the host events. (Fixed events are not included.) */
+    VBOXGUESTBITUSAGETRACER     EventFilterTracker;
+    /** The event filter last reported to the host (UINT32_MAX on failure). */
+    uint32_t                    fEventFilterHost;
+    /** @} */
+
+    /** @name Mouse Status
+     * @{ */
+    /** Usage counters for the mouse statuses (VMMDEV_MOUSE_XXX). */
+    VBOXGUESTBITUSAGETRACER     MouseStatusTracker;
+    /** The mouse status last reported to the host (UINT32_MAX on failure). */
+    uint32_t                    fMouseStatusHost;
+    /** @} */
+
+    /** @name Guest Capabilities
+     * @{ */
     /** Guest capabilities which have been set to "acquire" mode.  This means
      * that only one session can use them at a time, and that they will be
-     * automatically cleaned up if that session exits without doing so. */
-    uint32_t                    u32AcquireModeGuestCaps;
+     * automatically cleaned up if that session exits without doing so.
+     *
+     * Protected by VBOXGUESTDEVEXT::SessionSpinlock, but is unfortunately read
+     * without holding the lock in a couple of places. */
+    uint32_t volatile           fAcquireModeGuestCaps;
     /** Guest capabilities which have been set to "set" mode.  This just means
      * that they have been blocked from ever being set to "acquire" mode. */
-    uint32_t                    u32SetModeGuestCaps;
+    uint32_t                    fSetModeGuestCaps;
     /** Mask of all capabilities which are currently acquired by some session
      * and as such reported to the host. */
-    uint32_t                    u32GuestCaps;
+    uint32_t                    fAcquiredGuestCaps;
+    /** Usage counters for guest capabilities in "set" mode. Indexed by
+     *  capability bit number, one count per session using a capability. */
+    VBOXGUESTBITUSAGETRACER     SetGuestCapsTracker;
+    /** The guest capabilities last reported to the host (UINT32_MAX on failure). */
+    uint32_t                    fGuestCapsHost;
+    /** @} */
+
+    /** Heartbeat timer which fires with interval
+      * cNsHearbeatInterval and its handler sends
+      * VMMDevReq_GuestHeartbeat to VMMDev. */
+    PRTTIMER                    pHeartbeatTimer;
+    /** Heartbeat timer interval in nanoseconds. */
+    uint64_t                    cNsHeartbeatInterval;
+    /** Preallocated VMMDevReq_GuestHeartbeat request. */
+    VMMDevRequestHeader         *pReqGuestHeartbeat;
 } VBOXGUESTDEVEXT;
 /** Pointer to the VBoxGuest driver data. */
 typedef VBOXGUESTDEVEXT *PVBOXGUESTDEVEXT;
@@ -216,13 +275,17 @@ typedef struct VBOXGUESTSESSION
     /** The last consumed VMMDEV_EVENT_MOUSE_POSITION_CHANGED sequence number.
      * Used to implement polling.  */
     uint32_t volatile           u32MousePosChangedSeq;
-    /** VMMDev events requested.  An event type requested in any guest session
-     * will be added to the host filter.
-     * Use under the VBOXGUESTDEVEXT#SessionSpinlock lock. */
-    uint32_t                    fFilterMask;
-    /** Capabilities supported.  A capability enabled in any guest session will
-     * be enabled for the host.
-     * Use under the VBOXGUESTDEVEXT#SessionSpinlock lock. */
+    /** Host events requested by the session.
+     * An event type requested in any guest session will be added to the host
+     * filter.  Protected by VBOXGUESTDEVEXT::SessionSpinlock. */
+    uint32_t                    fEventFilter;
+    /** Guest capabilities held in "acquired" by this session.
+     * Protected by VBOXGUESTDEVEXT::SessionSpinlock, but is unfortunately read
+     * without holding the lock in a couple of places. */
+    uint32_t volatile           fAcquiredGuestCaps;
+    /** Guest capabilities in "set" mode for this session.
+     * These accumulated for sessions via VBOXGUESTDEVEXT::acGuestCapsSet and
+     * reported to the host.  Protected by VBOXGUESTDEVEXT::SessionSpinlock.  */
     uint32_t                    fCapabilities;
     /** Mouse features supported.  A feature enabled in any guest session will
      * be enabled for the host.
@@ -239,9 +302,6 @@ typedef struct VBOXGUESTSESSION
     /** Whether this session has been opened or not. */
     bool                        fOpened;
 #endif
-    /** Mask of guest capabilities acquired by this session.  These will all be
-     *  reported to the host. */
-    uint32_t                    u32AquiredGuestCaps;
     /** Whether a CANCEL_ALL_WAITEVENTS is pending.  This happens when
      * CANCEL_ALL_WAITEVENTS is called, but no call to WAITEVENT is in process
      * in the current session.  In that case the next call will be interrupted
@@ -253,30 +313,22 @@ typedef struct VBOXGUESTSESSION
 
 RT_C_DECLS_BEGIN
 
-int  VBoxGuestInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO, VBOXOSTYPE enmOSType, uint32_t fEvents);
-bool VBoxGuestCommonISR(PVBOXGUESTDEVEXT pDevExt);
-void VBoxGuestDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
-int  VBoxGuestReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType);
-int  VBoxGuestSetGuestCapabilities(uint32_t fOr, uint32_t fNot);
+int  VbgdCommonInitDevExt(PVBOXGUESTDEVEXT pDevExt, uint16_t IOPortBase, void *pvMMIOBase, uint32_t cbMMIO,
+                          VBOXOSTYPE enmOSType, uint32_t fEvents);
+bool VbgdCommonISR(PVBOXGUESTDEVEXT pDevExt);
+void VbgdCommonDeleteDevExt(PVBOXGUESTDEVEXT pDevExt);
+int  VbgdCommonReinitDevExtAfterHibernation(PVBOXGUESTDEVEXT pDevExt, VBOXOSTYPE enmOSType);
 #ifdef VBOXGUEST_USE_DEFERRED_WAKE_UP
-void VBoxGuestWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt);
+void VbgdCommonWaitDoWakeUps(PVBOXGUESTDEVEXT pDevExt);
 #endif
 
-int  VBoxGuestCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
-int  VBoxGuestCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
-void VBoxGuestCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+int  VbgdCommonCreateUserSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
+int  VbgdCommonCreateKernelSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION *ppSession);
+void VbgdCommonCloseSession(PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
 
-int  VBoxGuestCommonIOCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
-int  VBoxGuestCommonIOCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
-                          void *pvData, size_t cbData, size_t *pcbDataReturned);
-
-#if defined(RT_OS_SOLARIS) \
- || defined(RT_OS_FREEBSD) \
- || defined(RT_OS_LINUX)
-DECLVBGL(void *) VBoxGuestNativeServiceOpen(uint32_t *pu32Version);
-DECLVBGL(void)   VBoxGuestNativeServiceClose(void *pvOpaque);
-DECLVBGL(int)    VBoxGuestNativeServiceCall(void *pvOpaque, unsigned int iCmd, void *pvData, size_t cbSize, size_t *pcbReturn);
-#endif
+int  VbgdCommonIoCtlFast(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession);
+int  VbgdCommonIoCtl(unsigned iFunction, PVBOXGUESTDEVEXT pDevExt, PVBOXGUESTSESSION pSession,
+                     void *pvData, size_t cbData, size_t *pcbDataReturned);
 
 /**
  * ISR callback for notifying threads polling for mouse events.
@@ -286,7 +338,7 @@ DECLVBGL(int)    VBoxGuestNativeServiceCall(void *pvOpaque, unsigned int iCmd, v
  *
  * @param   pDevExt     The device extension.
  */
-void VBoxGuestNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt);
+void VbgdNativeISRMousePollEvent(PVBOXGUESTDEVEXT pDevExt);
 
 
 #ifdef VBOX_WITH_DPC_LATENCY_CHECKER
diff --git a/src/VBox/Additions/common/VBoxGuest/freebsd/Makefile b/src/VBox/Additions/common/VBoxGuest/freebsd/Makefile
index e53c03c..d57e753 100644
--- a/src/VBox/Additions/common/VBoxGuest/freebsd/Makefile
+++ b/src/VBox/Additions/common/VBoxGuest/freebsd/Makefile
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -26,7 +26,6 @@ CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBO
 
 SRCS = \
 	VBoxGuest.c \
-	VBoxGuest2.c \
 	VBoxGuest-freebsd.c \
 	GenericRequest.c \
 	HGCMInternal.c \
@@ -150,7 +149,8 @@ SRCS += \
 	spinlock-r0drv-freebsd.c \
 	thread-r0drv-freebsd.c \
 	thread2-r0drv-freebsd.c \
-	time-r0drv-freebsd.c
+	time-r0drv-freebsd.c \
+	timer-r0drv-freebsd.c
 
 .PATH:	${.CURDIR}/r0drv/generic
 SRCS += \
diff --git a/src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest b/src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest
index bcf74f2..cfdc546 100755
--- a/src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest
+++ b/src/VBox/Additions/common/VBoxGuest/freebsd/files_vboxguest
@@ -5,7 +5,7 @@
 #
 
 #
-# Copyright (C) 2007-2010 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -75,8 +75,6 @@ FILES_VBOXGUEST_NOBIN=" \
     ${PATH_ROOT}/include/VBox/version.h=>include/VBox/version.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp=>VBoxGuest.c \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuest-freebsd.c=>VBoxGuest-freebsd.c \
-    ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp=>VBoxGuest2.c \
-    ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.h=>VBoxGuest2.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h=>VBoxGuestIDC-unix.c.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h=>VBoxGuestInternal.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/freebsd/Makefile=>Makefile \
diff --git a/src/VBox/Additions/common/VBoxGuest/linux/Makefile b/src/VBox/Additions/common/VBoxGuest/linux/Makefile
index aaa50e1..5fffd0e 100644
--- a/src/VBox/Additions/common/VBoxGuest/linux/Makefile
+++ b/src/VBox/Additions/common/VBoxGuest/linux/Makefile
@@ -1,10 +1,10 @@
-# $Revision: 97163 $
+# $Revision: 98752 $
 ## @file
 # VirtualBox Guest Additions Module Makefile.
 #
 
 #
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -24,7 +24,6 @@ MOD_NAME = vboxguest
 MOD_OBJS   = \
 	VBoxGuest-linux.o \
 	VBoxGuest.o \
-	VBoxGuest2.o \
 	GenericRequest.o \
 	HGCMInternal.o \
 	Init.o \
@@ -52,6 +51,7 @@ MOD_OBJS   = \
 	r0drv/linux/thread-r0drv-linux.o \
 	r0drv/linux/thread2-r0drv-linux.o \
 	r0drv/linux/time-r0drv-linux.o \
+	r0drv/linux/timer-r0drv-linux.o \
 	r0drv/linux/RTLogWriteDebugger-r0drv-linux.o \
 	r0drv/generic/semspinmutex-r0drv-generic.o \
 	common/alloc/alloc.o \
@@ -85,11 +85,13 @@ MOD_OBJS   = \
 	generic/RTAssertShouldPanic-generic.o \
         generic/RTLogWriteStdErr-stub-generic.o \
         generic/RTLogWriteStdOut-stub-generic.o \
+	generic/RTMpGetCoreCount-generic.o \
 	generic/RTSemEventWait-2-ex-generic.o \
 	generic/RTSemEventWaitNoResume-2-ex-generic.o \
 	generic/RTSemEventMultiWait-2-ex-generic.o \
 	generic/RTSemEventMultiWaitNoResume-2-ex-generic.o \
 	generic/errvars-generic.o \
+	generic/mppresent-generic.o \
 	VBox/log-vbox.o \
 	VBox/logbackdoor.o
 ifeq ($(BUILD_TARGET_ARCH),x86)
diff --git a/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest b/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest
index 26faae0..4a4649d 100755
--- a/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest
+++ b/src/VBox/Additions/common/VBoxGuest/linux/files_vboxguest
@@ -5,7 +5,7 @@
 #
 
 #
-# Copyright (C) 2007-2012 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -51,6 +51,7 @@ FILES_VBOXGUEST_NOBIN=" \
     ${PATH_ROOT}/include/iprt/string.h=>include/iprt/string.h \
     ${PATH_ROOT}/include/iprt/thread.h=>include/iprt/thread.h \
     ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
+    ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \
     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
     ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \
@@ -69,8 +70,6 @@ FILES_VBOXGUEST_NOBIN=" \
     ${PATH_ROOT}/include/VBox/version.h=>include/VBox/version.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp=>VBoxGuest.c \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c=>VBoxGuest-linux.c \
-    ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.cpp=>VBoxGuest2.c \
-    ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuest2.h=>VBoxGuest2.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuestIDC-unix.c.h=>VBoxGuestIDC-unix.c.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h=>VBoxGuestInternal.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxGuest/linux/Makefile=>Makefile \
@@ -140,11 +139,13 @@ FILES_VBOXGUEST_NOBIN=" \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTAssertShouldPanic-generic.cpp=>generic/RTAssertShouldPanic-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTLogWriteStdErr-stub-generic.cpp=>generic/RTLogWriteStdErr-stub-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTLogWriteStdOut-stub-generic.cpp=>generic/RTLogWriteStdOut-stub-generic.c \
+    ${PATH_ROOT}/src/VBox/Runtime/generic/RTMpGetCoreCount-generic.cpp=>generic/RTMpGetCoreCount-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTSemEventWait-2-ex-generic.cpp=>generic/RTSemEventWait-2-ex-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTSemEventWaitNoResume-2-ex-generic.cpp=>generic/RTSemEventWaitNoResume-2-ex-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTSemEventMultiWait-2-ex-generic.cpp=>generic/RTSemEventMultiWait-2-ex-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp=>generic/RTSemEventMultiWaitNoResume-2-ex-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/errvars-generic.cpp=>generic/errvars-generic.c \
+    ${PATH_ROOT}/src/VBox/Runtime/generic/mppresent-generic.cpp=>generic/mppresent-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.cpp=>r0drv/alloc-r0drv.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/alloc-r0drv.h=>r0drv/alloc-r0drv.h \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/initterm-r0drv.cpp=>r0drv/initterm-r0drv.c \
@@ -171,6 +172,7 @@ FILES_VBOXGUEST_NOBIN=" \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c=>r0drv/linux/thread-r0drv-linux.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c=>r0drv/linux/thread2-r0drv-linux.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c=>r0drv/linux/time-r0drv-linux.c \
+    ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c=>r0drv/linux/timer-r0drv-linux.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h=>r0drv/linux/waitqueue-r0drv-linux.h \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/RTLogWriteDebugger-r0drv-linux.c=>r0drv/linux/RTLogWriteDebugger-r0drv-linux.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c=>r0drv/generic/semspinmutex-r0drv-generic.c \
diff --git a/src/VBox/Additions/common/VBoxGuest/win/VBoxGuest.rc b/src/VBox/Additions/common/VBoxGuest/win/VBoxGuest.rc
index 0b2920e..80c4d0b 100644
--- a/src/VBox/Additions/common/VBoxGuest/win/VBoxGuest.rc
+++ b/src/VBox/Additions/common/VBoxGuest/win/VBoxGuest.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x2L
-   FILESUBTYPE          0x0L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DLL
+   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox Guest Driver\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxGuest\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
          VALUE "OriginalFilename", "VBoxGuest.sys\0"
-         VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Additions/common/VBoxGuestLib/GenericRequest.cpp b/src/VBox/Additions/common/VBoxGuestLib/GenericRequest.cpp
index cae7a8f..0d7eade 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/GenericRequest.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/GenericRequest.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 87431 $ */
+/* $Id: GenericRequest.cpp $ */
 /** @file
  * VBoxGuestLibR0 - Generic VMMDev request management.
  */
@@ -36,13 +36,13 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
 
     if (!pReq || cbReq < sizeof (VMMDevRequestHeader))
     {
-        dprintf(("VbglGRVerify: Invalid parameter: pReq = %p, cbReq = %d\n", pReq, cbReq));
+        dprintf(("VbglGRVerify: Invalid parameter: pReq = %p, cbReq = %zu\n", pReq, cbReq));
         return VERR_INVALID_PARAMETER;
     }
 
     if (pReq->size > cbReq)
     {
-        dprintf(("VbglGRVerify: request size %d > buffer size %d\n", pReq->size, cbReq));
+        dprintf(("VbglGRVerify: request size %u > buffer size %zu\n", pReq->size, cbReq));
         return VERR_INVALID_PARAMETER;
     }
 
@@ -51,7 +51,7 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
 
     if (cbReq < cbReqExpected)
     {
-        dprintf(("VbglGRVerify: buffer size %d < expected size %d\n", cbReq, cbReqExpected));
+        dprintf(("VbglGRVerify: buffer size %zu < expected size %zu\n", cbReq, cbReqExpected));
         return VERR_INVALID_PARAMETER;
     }
 
@@ -62,7 +62,7 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
          */
         if (pReq->size != cbReqExpected)
         {
-            dprintf(("VbglGRVerify: request size %d != expected size %d\n", pReq->size, cbReqExpected));
+            dprintf(("VbglGRVerify: request size %u != expected size %zu\n", pReq->size, cbReqExpected));
             return VERR_INVALID_PARAMETER;
         }
 
@@ -90,13 +90,13 @@ DECLVBGL(int) VbglGRVerify (const VMMDevRequestHeader *pReq, size_t cbReq)
     {
         if (cbReq > VMMDEV_MAX_VMMDEVREQ_SIZE)
         {
-            dprintf(("VbglGRVerify: VMMDevReq_LogString: buffer size %d too big\n", cbReq));
+            dprintf(("VbglGRVerify: VMMDevReq_LogString: buffer size %zu too big\n", cbReq));
             return VERR_BUFFER_OVERFLOW; /* @todo is this error code ok? */
         }
     }
     else
     {
-        dprintf(("VbglGRVerify: request size %d > buffer size %d\n", pReq->size, cbReq));
+        dprintf(("VbglGRVerify: request size %u > buffer size %zu\n", pReq->size, cbReq));
         return VERR_IO_BAD_LENGTH; /* @todo is this error code ok? */
     }
 
diff --git a/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp b/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp
index ff1cc31..c434c85 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/HGCM.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 97151 $ */
+/* $Id: HGCM.cpp $ */
 /** @file
  * VBoxGuestLib - Host-Guest Communication Manager.
  *
diff --git a/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp b/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp
index 6bfac26..7521f88 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 97150 $ */
+/* $Id: HGCMInternal.cpp $ */
 /** @file
  * VBoxGuestLib - Host-Guest Communication Manager internal functions, implemented by VBoxGuest
  */
@@ -207,7 +207,7 @@ static int vbglR0HGCMInternalPreprocessCall(VBoxGuestHGCMCallInfo const *pCallIn
                 break;
 
             case VMMDevHGCMParmType_64bit:
-                Log4(("GstHGCMCall: parm=%u type=64bit: %#018x\n", iParm, pSrcParm->u.value64));
+                Log4(("GstHGCMCall: parm=%u type=64bit: %#018RX64\n", iParm, pSrcParm->u.value64));
                 break;
 
             case VMMDevHGCMParmType_PageList:
diff --git a/src/VBox/Additions/common/VBoxGuestLib/Init.cpp b/src/VBox/Additions/common/VBoxGuestLib/Init.cpp
index 5298ffe..7a9ada0 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/Init.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/Init.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 89635 $ */
+/* $Id: Init.cpp $ */
 /** @file
  * VBoxGuestLibR0 - Library initialization.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk b/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
index 8428ed3..ae0a3c9 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
+++ b/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk
@@ -30,7 +30,7 @@ include $(KBUILD_PATH)/subheader.kmk
 #
 # Target config.
 #
-if defined(VBOX_WITH_ADDITION_DRIVERS) && !defined(VBOX_ONLY_TESTSUITE)
+if defined(VBOX_WITH_ADDITION_DRIVERS) && !defined(VBOX_ONLY_VALIDATIONKIT)
  LIBRARIES += \
  	VBoxGuestR0Lib \
  	VBoxGuestR0LibBase
@@ -38,7 +38,7 @@ endif
 LIBRARIES += \
 	VBoxGuestR3Lib \
 	VBoxGuestR3LibShared
-ifndef VBOX_ONLY_TESTSUITE
+ifndef VBOX_ONLY_VALIDATIONKIT
  if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd)
   LIBRARIES += \
   	VBoxGuestR3LibXFree86
diff --git a/src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp b/src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp
index 85722cf..e6bca47 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/Mouse.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 97151 $ */
+/* $Id: Mouse.cpp $ */
 /** @file
  * VBoxGuestLibR0 - Mouse Integration.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/PhysHeap.cpp b/src/VBox/Additions/common/VBoxGuestLib/PhysHeap.cpp
index 1f1d24f..414e6b8 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/PhysHeap.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/PhysHeap.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 85891 $ */
+/* $Id: PhysHeap.cpp $ */
 /** @file
  * VBoxGuestLibR0 - Physical memory heap.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/SysHlp.cpp b/src/VBox/Additions/common/VBoxGuestLib/SysHlp.cpp
index 008c5e1..188c8e0 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/SysHlp.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/SysHlp.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 83575 $ */
+/* $Id: SysHlp.cpp $ */
 /** @file
  * VBoxGuestLibR0 - IDC with VBoxGuest and HGCM helpers.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/SysHlp.h b/src/VBox/Additions/common/VBoxGuestLib/SysHlp.h
index 6860364..844b014 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/SysHlp.h
+++ b/src/VBox/Additions/common/VBoxGuestLib/SysHlp.h
@@ -1,4 +1,4 @@
-/* $Revision: 83575 $ */
+/* $Id: SysHlp.h $ */
 /** @file
  * VBoxGuestLibR0 - System dependent helpers internal header.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBGLInternal.h b/src/VBox/Additions/common/VBoxGuestLib/VBGLInternal.h
index 6fe015d..e519af8 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VBGLInternal.h
+++ b/src/VBox/Additions/common/VBoxGuestLib/VBGLInternal.h
@@ -1,4 +1,4 @@
-/* Id: 73443 $ */
+/* $Id: VBGLInternal.h $ */
 /** @file
  * VBoxGuestLibR0 - Internal header.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestLog.h b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestLog.h
index fccd343..7e7f6c4 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestLog.h
+++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestLog.h
@@ -1,3 +1,4 @@
+/* $Id: VBoxGuestLog.h $ */
 /** @file
  * VBoxGuestLibR0 - Guest Logging facility.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.cpp
index 893b471..4115eb4 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.cpp
@@ -1,3 +1,4 @@
+/* $Id: VBoxGuestR0LibCrOgl.cpp $ */
 /** @file
  * VBoxGuestLib - Central calls header.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.h b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.h
index ae0eac2..2136293 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.h
+++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibCrOgl.h
@@ -1,3 +1,4 @@
+/* $Id: VBoxGuestR0LibCrOgl.h $ */
 /** @file
  * VBoxGuestLib - Central calls header.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.c b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.c
index adbc159..a4e44bd 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.c
+++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.c
@@ -1,4 +1,4 @@
-/* $Revision: 97149 $ */
+/* $Id: VBoxGuestR0LibSharedFolders.c $ */
 /** @file
  * VBoxGuestR0LibSharedFolders - Ring 0 Shared Folders calls.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.h b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.h
index 5e5c957..1ba1bcd 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.h
+++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.h
@@ -1,3 +1,4 @@
+/* $Id: VBoxGuestR0LibSharedFolders.h $ */
 /** @file
  * VBoxGuestLib - Central calls header.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp
index a7f378f..f2d84f7 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibDragAndDrop.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -37,18 +37,17 @@
 #include <iprt/cpp/list.h>
 #include <iprt/cpp/ministring.h>
 
-#include "VBGLR3Internal.h"
-#include "VBox/HostServices/DragAndDropSvc.h"
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
 
-#define VERBOSE 1
+#include <VBox/VBoxGuestLib.h>
+#include <VBox/GuestHost/DragAndDrop.h>
+#include <VBox/HostServices/DragAndDropSvc.h>
 
-#if defined(VERBOSE) && defined(DEBUG_poetzsch)
-# include <iprt/stream.h>
-# define DO(s) RTPrintf s
-#else
-# define DO(s) do {} while(0)
-//# define DO(s) Log s
-#endif
+#include "VBGLR3Internal.h"
 
 /* Here all the communication with the host over HGCM is handled platform
  * neutral. Also the receiving of URIs content (directory trees and files) is
@@ -56,85 +55,46 @@
  *
  * Todo:
  * - Sending dirs/files in the G->H case
- * - Maybe the EOL converting of text mime-types (not fully sure, eventually
+ * - Maybe the EOL converting of text MIME types (not fully sure, eventually
  *   better done on the host side)
  */
 
-/* Not really used at the moment (only one client is possible): */
-uint32_t g_clientId = 0;
-
 /******************************************************************************
  *    Private internal functions                                              *
  ******************************************************************************/
 
-static int vbglR3DnDCreateDropDir(char* pszDropDir, size_t cbSize)
+static int vbglR3DnDQueryNextHostMessageType(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t *puMsg, uint32_t *pcParms, bool fWait)
 {
-    /* Validate input */
-    AssertPtrReturn(pszDropDir, VERR_INVALID_POINTER);
-    AssertReturn(cbSize,        VERR_INVALID_PARAMETER);
-
-    /* Get the users document directory (usually $HOME/Documents). */
-    int rc = RTPathUserDocuments(pszDropDir, cbSize);
-    if (RT_FAILURE(rc))
-        return rc;
-    /* Append our base drop directory. */
-    rc = RTPathAppend(pszDropDir, cbSize, "VirtualBox Dropped Files");
-    if (RT_FAILURE(rc))
-        return rc;
-    /* Create it when necessary. */
-    if (!RTDirExists(pszDropDir))
-    {
-        rc = RTDirCreateFullPath(pszDropDir, RTFS_UNIX_IRWXU);
-        if (RT_FAILURE(rc))
-            return rc;
-    }
-    /* The actually drop directory consist of the current time stamp and a
-     * unique number when necessary. */
-    char pszTime[64];
-    RTTIMESPEC time;
-    if (!RTTimeSpecToString(RTTimeNow(&time), pszTime, sizeof(pszTime)))
-        return VERR_BUFFER_OVERFLOW;
-    rc = RTPathAppend(pszDropDir, cbSize, pszTime);
-    if (RT_FAILURE(rc))
-        return rc;
-
-    /* Create it (only accessible by the current user) */
-    return RTDirCreateUniqueNumbered(pszDropDir, cbSize, RTFS_UNIX_IRWXU, 3, '-');
-}
-
-static int vbglR3DnDQueryNextHostMessageType(uint32_t uClientId, uint32_t *puMsg, uint32_t *pcParms, bool fWait)
-{
-    /* Validate input */
+    AssertPtrReturn(pCtx,    VERR_INVALID_POINTER);
     AssertPtrReturn(puMsg,   VERR_INVALID_POINTER);
     AssertPtrReturn(pcParms, VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDNEXTMSGMSG Msg;
     RT_ZERO(Msg);
     Msg.hdr.result      = VERR_WRONG_ORDER;
-    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG;
     Msg.hdr.cParms      = 3;
-    /* Initialize parameter */
+
     Msg.msg.SetUInt32(0);
     Msg.num_parms.SetUInt32(0);
-    Msg.block.SetUInt32(fWait);
-    /* Do request */
+    Msg.block.SetUInt32(fWait ? 1 : 0);
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
     {
         rc = Msg.hdr.result;
         if (RT_SUCCESS(rc))
         {
-            /* Fetch results */
             rc = Msg.msg.GetUInt32(puMsg);         AssertRC(rc);
             rc = Msg.num_parms.GetUInt32(pcParms); AssertRC(rc);
         }
     }
+
     return rc;
 }
 
-static int vbglR3DnDHGProcessActionMessage(uint32_t  uClientId,
+static int vbglR3DnDHGProcessActionMessage(PVBGLR3GUESTDNDCMDCTX pCtx,
                                            uint32_t  uMsg,
                                            uint32_t *puScreenId,
                                            uint32_t *puX,
@@ -145,7 +105,7 @@ static int vbglR3DnDHGProcessActionMessage(uint32_t  uClientId,
                                            uint32_t  cbFormats,
                                            uint32_t *pcbFormatsRecv)
 {
-    /* Validate input */
+    AssertPtrReturn(pCtx,           VERR_INVALID_POINTER);
     AssertPtrReturn(puScreenId,     VERR_INVALID_POINTER);
     AssertPtrReturn(puX,            VERR_INVALID_POINTER);
     AssertPtrReturn(puY,            VERR_INVALID_POINTER);
@@ -155,13 +115,12 @@ static int vbglR3DnDHGProcessActionMessage(uint32_t  uClientId,
     AssertReturn(cbFormats,         VERR_INVALID_PARAMETER);
     AssertPtrReturn(pcbFormatsRecv, VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDHGACTIONMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = uMsg;
     Msg.hdr.cParms      = 7;
-    /* Initialize parameter */
+
     Msg.uScreenId.SetUInt32(0);
     Msg.uX.SetUInt32(0);
     Msg.uY.SetUInt32(0);
@@ -169,106 +128,109 @@ static int vbglR3DnDHGProcessActionMessage(uint32_t  uClientId,
     Msg.uAllActions.SetUInt32(0);
     Msg.pvFormats.SetPtr(pszFormats, cbFormats);
     Msg.cFormats.SetUInt32(0);
-    /* Do request */
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
     {
         rc = Msg.hdr.result;
         if (RT_SUCCESS(rc))
         {
-            /* Fetch results */
             rc = Msg.uScreenId.GetUInt32(puScreenId);     AssertRC(rc);
             rc = Msg.uX.GetUInt32(puX);                   AssertRC(rc);
             rc = Msg.uY.GetUInt32(puY);                   AssertRC(rc);
             rc = Msg.uDefAction.GetUInt32(puDefAction);   AssertRC(rc);
             rc = Msg.uAllActions.GetUInt32(puAllActions); AssertRC(rc);
             rc = Msg.cFormats.GetUInt32(pcbFormatsRecv);  AssertRC(rc);
-            /* A little bit paranoia */
+
             AssertReturn(cbFormats >= *pcbFormatsRecv, VERR_TOO_MUCH_DATA);
         }
     }
+
     return rc;
 }
 
-static int vbglR3DnDHGProcessLeaveMessage(uint32_t uClientId)
+static int vbglR3DnDHGProcessLeaveMessage(PVBGLR3GUESTDNDCMDCTX pCtx)
 {
-    /* Initialize header */
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
     DragAndDropSvc::VBOXDNDHGLEAVEMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_HG_EVT_LEAVE;
     Msg.hdr.cParms      = 0;
-    /* Do request */
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
         rc = Msg.hdr.result;
+
     return rc;
 }
 
-static int vbglR3DnDHGProcessCancelMessage(uint32_t uClientId)
+static int vbglR3DnDHGProcessCancelMessage(PVBGLR3GUESTDNDCMDCTX pCtx)
 {
-    /* Initialize header */
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
     DragAndDropSvc::VBOXDNDHGCANCELMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_HG_EVT_CANCEL;
     Msg.hdr.cParms      = 0;
-    /* Do request */
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
         rc = Msg.hdr.result;
+
     return rc;
 }
 
-static int vbglR3DnDHGProcessSendDirMessage(uint32_t  uClientId,
+static int vbglR3DnDHGProcessSendDirMessage(PVBGLR3GUESTDNDCMDCTX pCtx,
                                             char     *pszDirname,
                                             uint32_t  cbDirname,
                                             uint32_t *pcbDirnameRecv,
                                             uint32_t *pfMode)
 {
-    /* Validate input */
+    AssertPtrReturn(pCtx,           VERR_INVALID_POINTER);
     AssertPtrReturn(pszDirname,     VERR_INVALID_POINTER);
     AssertReturn(cbDirname,         VERR_INVALID_PARAMETER);
     AssertPtrReturn(pcbDirnameRecv, VERR_INVALID_POINTER);
     AssertPtrReturn(pfMode,         VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDHGSENDDIRMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_HG_SND_DIR;
     Msg.hdr.cParms      = 3;
-    /* Initialize parameter */
+
     Msg.pvName.SetPtr(pszDirname, cbDirname);
-    Msg.cName.SetUInt32(0);
+    Msg.cbName.SetUInt32(0);
     Msg.fMode.SetUInt32(0);
-    /* Do request */
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
     {
         rc = Msg.hdr.result;
         if (RT_SUCCESS(Msg.hdr.result))
         {
-            /* Fetch results */
-            rc = Msg.cName.GetUInt32(pcbDirnameRecv); AssertRC(rc);
-            rc = Msg.fMode.GetUInt32(pfMode);         AssertRC(rc);
-            /* A little bit paranoia */
+            rc = Msg.cbName.GetUInt32(pcbDirnameRecv); AssertRC(rc);
+            rc = Msg.fMode.GetUInt32(pfMode);          AssertRC(rc);
+
             AssertReturn(cbDirname >= *pcbDirnameRecv, VERR_TOO_MUCH_DATA);
         }
     }
+
     return rc;
 }
 
-static int vbglR3DnDHGProcessSendFileMessage(uint32_t  uClientId,
-                                             char     *pszFilename,
-                                             uint32_t  cbFilename,
-                                             uint32_t *pcbFilenameRecv,
-                                             void     *pvData,
-                                             uint32_t  cbData,
-                                             uint32_t *pcbDataRecv,
-                                             uint32_t *pfMode)
+static int vbglR3DnDHGProcessSendFileMessage(PVBGLR3GUESTDNDCMDCTX pCtx,
+                                             char                 *pszFilename,
+                                             uint32_t              cbFilename,
+                                             uint32_t             *pcbFilenameRecv,
+                                             void                 *pvData,
+                                             uint32_t              cbData,
+                                             uint32_t             *pcbDataRecv,
+                                             uint32_t             *pfMode)
 {
-    /* Validate input */
+    AssertPtrReturn(pCtx,            VERR_INVALID_POINTER);
     AssertPtrReturn(pszFilename,     VERR_INVALID_POINTER);
     AssertReturn(cbFilename,         VERR_INVALID_PARAMETER);
     AssertPtrReturn(pcbFilenameRecv, VERR_INVALID_POINTER);
@@ -277,227 +239,443 @@ static int vbglR3DnDHGProcessSendFileMessage(uint32_t  uClientId,
     AssertPtrReturn(pcbDataRecv,     VERR_INVALID_POINTER);
     AssertPtrReturn(pfMode,          VERR_INVALID_POINTER);
 
-    /* Initialize header */
-    DragAndDropSvc::VBOXDNDHGSENDFILEMSG Msg;
+    DragAndDropSvc::VBOXDNDHGSENDFILEDATAMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = uClientId;
-    Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_HG_SND_FILE;
-    Msg.hdr.cParms      = 5;
-    /* Initialize parameter */
-    Msg.pvName.SetPtr(pszFilename, cbFilename);
-    Msg.cName.SetUInt32(0);
-    Msg.pvData.SetPtr(pvData, cbData);
-    Msg.cData.SetUInt32(0);
-    Msg.fMode.SetUInt32(0);
-    /* Do request */
+    Msg.hdr.u32ClientID = pCtx->uClientID;
+    Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA;
+
+    if (pCtx->uProtocol <= 1)
+    {
+        Msg.u.v1.pvName.SetPtr(pszFilename, cbFilename);
+        Msg.u.v1.cbName.SetUInt32(cbFilename);
+        Msg.u.v1.pvData.SetPtr(pvData, cbData);
+        Msg.u.v1.cbData.SetUInt32(cbData);
+        Msg.u.v1.fMode.SetUInt32(0);
+
+        Msg.hdr.cParms = 5;
+    }
+    else
+    {
+        Msg.u.v2.uContext.SetUInt32(0); /** @todo Not used yet. */
+        Msg.u.v2.pvData.SetPtr(pvData, cbData);
+        Msg.u.v2.cbData.SetUInt32(cbData);
+
+        Msg.hdr.cParms = 3;
+    }
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
     {
         rc = Msg.hdr.result;
         if (RT_SUCCESS(rc))
         {
-            /* Fetch results */
-            rc = Msg.cName.GetUInt32(pcbFilenameRecv); AssertRC(rc);
-            rc = Msg.cData.GetUInt32(pcbDataRecv);     AssertRC(rc);
-            rc = Msg.fMode.GetUInt32(pfMode);          AssertRC(rc);
-            /* A little bit paranoia */
-            AssertReturn(cbFilename >= *pcbFilenameRecv, VERR_TOO_MUCH_DATA);
-            AssertReturn(cbData     >= *pcbDataRecv,     VERR_TOO_MUCH_DATA);
+            if (pCtx->uProtocol <= 1)
+            {
+                rc = Msg.u.v1.cbName.GetUInt32(pcbFilenameRecv); AssertRC(rc);
+                rc = Msg.u.v1.cbData.GetUInt32(pcbDataRecv);     AssertRC(rc);
+                rc = Msg.u.v1.fMode.GetUInt32(pfMode);           AssertRC(rc);
+
+                AssertReturn(cbFilename >= *pcbFilenameRecv, VERR_TOO_MUCH_DATA);
+                AssertReturn(cbData     >= *pcbDataRecv,     VERR_TOO_MUCH_DATA);
+            }
+            else
+            {
+                rc = Msg.u.v2.cbData.GetUInt32(pcbDataRecv);     AssertRC(rc);
+                AssertReturn(cbData     >= *pcbDataRecv,     VERR_TOO_MUCH_DATA);
+            }
         }
     }
+
+    LogFlowFuncLeaveRC(rc);
     return rc;
 }
 
-static int vbglR3DnDHGProcessURIMessages(uint32_t   uClientId,
-                                         uint32_t  *puScreenId,
-                                         char      *pszFormat,
-                                         uint32_t   cbFormat,
-                                         uint32_t  *pcbFormatRecv,
-                                         void     **ppvData,
-                                         uint32_t   cbData,
-                                         size_t    *pcbDataRecv)
+static int vbglR3DnDHGProcessSendFileHdrMessage(PVBGLR3GUESTDNDCMDCTX  pCtx,
+                                                char                  *pszFilename,
+                                                uint32_t               cbFilename,
+                                                uint32_t              *puFlags,
+                                                uint32_t              *pfMode,
+                                                uint64_t              *pcbTotal)
 {
-    /* Make a string list out of the uri data. */
-    RTCList<RTCString> uriList = RTCString(static_cast<char*>(*ppvData), *pcbDataRecv - 1).split("\r\n");
-    if (uriList.isEmpty())
-        return VINF_SUCCESS;
+    AssertPtrReturn(pCtx,        VERR_INVALID_POINTER);
+    AssertPtrReturn(pszFilename, VERR_INVALID_POINTER);
+    AssertReturn(cbFilename,     VERR_INVALID_PARAMETER);
+    AssertPtrReturn(puFlags,     VERR_INVALID_POINTER);
+    AssertPtrReturn(pfMode,      VERR_INVALID_POINTER);
+    AssertReturn(pcbTotal,       VERR_INVALID_POINTER);
 
-    uint32_t cbTmpData = _1M * 10;
-    void *pvTmpData = RTMemAlloc(cbTmpData);
-    if (!pvTmpData)
-        return VERR_NO_MEMORY;
+    DragAndDropSvc::VBOXDNDHGSENDFILEHDRMSG Msg;
+    RT_ZERO(Msg);
+    Msg.hdr.u32ClientID = pCtx->uClientID;
+    Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR;
 
-    /* Create and query the drop target directory. */
-    char pszDropDir[RTPATH_MAX];
-    int rc = vbglR3DnDCreateDropDir(pszDropDir, sizeof(pszDropDir));
-    if (RT_FAILURE(rc))
+    int rc;
+
+    if (pCtx->uProtocol <= 1)
     {
-        RTMemFree(pvTmpData);
-        return rc;
+        rc = VERR_NOT_SUPPORTED;
+    }
+    else
+    {
+        Msg.uContext.SetUInt32(0); /** @todo Not used yet. */
+        Msg.pvName.SetPtr(pszFilename, cbFilename);
+        Msg.cbName.SetUInt32(cbFilename);
+        Msg.uFlags.SetUInt32(0);
+        Msg.fMode.SetUInt32(0);
+        Msg.cbTotal.SetUInt64(0);
+
+        Msg.hdr.cParms = 6;
+
+        rc = VINF_SUCCESS;
     }
 
-    /* Patch the old drop data with the new drop directory, so the drop target
-     * can find the files. */
-    RTCList<RTCString> guestUriList;
-    for (size_t i = 0; i < uriList.size(); ++i)
+    if (RT_SUCCESS(rc))
+        rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
+    if (RT_SUCCESS(rc))
     {
-        const RTCString &strUri = uriList.at(i);
-        /* Query the path component of a file URI. If this hasn't a
-         * file scheme, null is returned. */
-        if (char *pszFilePath = RTUriFilePath(strUri.c_str(), URI_FILE_FORMAT_AUTO))
+        rc = Msg.hdr.result;
+        if (RT_SUCCESS(rc))
         {
-            RTCString strFullPath = RTCString().printf("%s%c%s", pszDropDir, RTPATH_SLASH, pszFilePath);
-            char *pszNewUri = RTUriFileCreate(strFullPath.c_str());
-            if (pszNewUri)
-            {
-                guestUriList.append(pszNewUri);
-                RTStrFree(pszNewUri);
-            }
+            /** @todo Get context ID. */
+            rc = Msg.uFlags.GetUInt32(puFlags);   AssertRC(rc);
+            rc = Msg.fMode.GetUInt32(pfMode);     AssertRC(rc);
+            rc = Msg.cbTotal.GetUInt64(pcbTotal); AssertRC(rc);
         }
-        else
-            guestUriList.append(strUri);
     }
 
-    /* Cleanup the old data and write the new data back to the event. */
-    RTMemFree(*ppvData);
-    RTCString newData = RTCString::join(guestUriList, "\r\n") + "\r\n";
-    *ppvData = RTStrDupN(newData.c_str(), newData.length());
-    *pcbDataRecv = newData.length() + 1;
-
-    /* Lists for holding created files & directories in the case of a
-     * rollback. */
-    RTCList<RTCString> guestDirList;
-    RTCList<RTCString> guestFileList;
-    char pszPathname[RTPATH_MAX];
-    uint32_t cbPathname = 0;
-    bool fLoop = true;
-    do
+    return rc;
+}
+
+static int vbglR3DnDHGProcessURIMessages(PVBGLR3GUESTDNDCMDCTX  pCtx,
+                                         uint32_t              *puScreenId,
+                                         char                  *pszFormat,
+                                         uint32_t               cbFormat,
+                                         uint32_t              *pcbFormatRecv,
+                                         void                 **ppvData,
+                                         uint32_t               cbData,
+                                         size_t                *pcbDataRecv)
+{
+    AssertPtrReturn(pCtx,        VERR_INVALID_POINTER);
+    AssertPtrReturn(ppvData,     VERR_INVALID_POINTER);
+    AssertPtrReturn(cbData,      VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pcbDataRecv, VERR_INVALID_POINTER);
+
+    void    *pvData        = *ppvData;
+    uint32_t cbDataRecv    = 0;
+    uint64_t cbDataToRead  = *pcbDataRecv;
+    uint64_t cbDataWritten = 0;
+
+    int rc = VINF_SUCCESS;
+
+    /* Allocate temp buffer. */
+    uint32_t cbTmpData = _64K; /** @todo Make this configurable? */
+    void *pvTmpData = RTMemAlloc(cbTmpData);
+    if (!pvTmpData)
+        return VERR_NO_MEMORY;
+
+    /* Create and query the (unique) drop target directory in the user's temporary directory. */
+    DNDDIRDROPPEDFILES dirDroppedFiles;
+    const char *pszDropDir;
+    rc = DnDDirDroppedFilesCreateAndOpenTemp(&dirDroppedFiles);
+    if (RT_SUCCESS(rc))
+        pszDropDir = DnDDirDroppedFilesGetDirAbs(&dirDroppedFiles);
+
+    DnDURIList lstURI;
+    DnDURIObject objFile(DnDURIObject::File);
+
+    char szPathName[RTPATH_MAX] = { 0 };
+    uint32_t cbPathName = 0;
+    uint32_t fFlags = 0;
+    uint32_t fMode = 0;
+
+    while (RT_SUCCESS(rc))
     {
         uint32_t uNextMsg;
         uint32_t cNextParms;
-        rc = vbglR3DnDQueryNextHostMessageType(uClientId, &uNextMsg, &cNextParms, false);
-        DO(("%Rrc - %d\n", rc , uNextMsg));
+        rc = vbglR3DnDQueryNextHostMessageType(pCtx, &uNextMsg, &cNextParms, false /* fWait */);
         if (RT_SUCCESS(rc))
         {
-            switch(uNextMsg)
+            LogFlowFunc(("uNextMsg=%RU32, cNextParms=%RU32\n", uNextMsg, cNextParms));
+
+            switch (uNextMsg)
             {
                 case DragAndDropSvc::HOST_DND_HG_SND_DIR:
                 {
-                    uint32_t fMode = 0;
-                    rc = vbglR3DnDHGProcessSendDirMessage(uClientId,
-                                                          pszPathname,
-                                                          sizeof(pszPathname),
-                                                          &cbPathname,
+                    rc = vbglR3DnDHGProcessSendDirMessage(pCtx,
+                                                          szPathName,
+                                                          sizeof(szPathName),
+                                                          &cbPathName,
                                                           &fMode);
-                    if (RT_SUCCESS(rc))
+                    LogFlowFunc(("HOST_DND_HG_SND_DIR pszPathName=%s, cbPathName=%RU32, fMode=0x%x, rc=%Rrc\n",
+                                 szPathName, cbPathName, fMode, rc));
+
+                    char *pszPathAbs = RTPathJoinA(pszDropDir, szPathName);
+                    if (pszPathAbs)
                     {
-                        DO(("Got drop dir: %s - %o - %Rrc\n", pszPathname, fMode, rc));
-                        char *pszNewDir = RTPathJoinA(pszDropDir, pszPathname);
-                        rc = RTDirCreate(pszNewDir, (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRWXU, 0);
-                        if (!guestDirList.contains(pszNewDir))
-                            guestDirList.append(pszNewDir);
+                        rc = RTDirCreate(pszPathAbs, (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRWXU, 0);
+                        if (RT_SUCCESS(rc))
+                            rc = DnDDirDroppedAddDir(&dirDroppedFiles, pszPathAbs);
+
+                        RTStrFree(pszPathAbs);
                     }
+                    else
+                        rc = VERR_NO_MEMORY;
                     break;
                 }
-                case DragAndDropSvc::HOST_DND_HG_SND_FILE:
+                case DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR:
+                case DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA:
                 {
-                    uint32_t cbDataRecv;
-                    uint32_t fMode = 0;
-                    rc = vbglR3DnDHGProcessSendFileMessage(uClientId,
-                                                           pszPathname,
-                                                           sizeof(pszPathname),
-                                                           &cbPathname,
-                                                           pvTmpData,
-                                                           cbTmpData,
-                                                           &cbDataRecv,
-                                                           &fMode);
-                    if (RT_SUCCESS(rc))
+                    if (uNextMsg == DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR)
+                        rc = vbglR3DnDHGProcessSendFileHdrMessage(pCtx,
+                                                                  szPathName,
+                                                                  sizeof(szPathName),
+                                                                  &fFlags,
+                                                                  &fMode,
+                                                                  &cbDataToRead);
+                    else
+                        rc = vbglR3DnDHGProcessSendFileMessage(pCtx,
+                                                               szPathName,
+                                                               sizeof(szPathName),
+                                                               &cbPathName,
+                                                               pvTmpData,
+                                                               cbTmpData,
+                                                               &cbDataRecv,
+                                                               &fMode);
+                    if (   RT_SUCCESS(rc)
+                        && (   uNextMsg == DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR
+                             /* Protocol v1 always sends the file name, so try opening every time. */
+                            || pCtx->uProtocol <= 1)
+                       )
                     {
-                        char *pszNewFile = RTPathJoinA(pszDropDir, pszPathname);
-                        DO(("Got drop file: %s - %d - %o - %Rrc\n", pszPathname, cbDataRecv, fMode, rc));
-                        RTFILE hFile;
-                        rc = RTFileOpen(&hFile, pszNewFile, RTFILE_O_WRITE | RTFILE_O_APPEND | RTFILE_O_DENY_ALL | RTFILE_O_OPEN_CREATE);
+                        char *pszPathAbs = RTPathJoinA(pszDropDir, szPathName);
+                        if (pszPathAbs)
+                        {
+                            LogFlowFunc(("Opening pszPathName=%s, cbPathName=%RU32, fMode=0x%x, cbSize=%RU64\n",
+                                         szPathName, cbPathName, fMode, cbDataToRead));
+
+                            uint64_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_ALL;
+                            if (pCtx->uProtocol <= 1)
+                                fOpen |= RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND;
+                            else
+                                fOpen |= RTFILE_O_CREATE_REPLACE;
+
+                            /* Is there already a file open, e.g. in transfer? */
+                            if (!objFile.IsOpen())
+                            {
+
+                                RTCString strPathAbs(pszPathAbs);
+                                rc = objFile.OpenEx(strPathAbs, DnDURIObject::File, DnDURIObject::Target, fOpen,
+                                                    (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR);
+                                if (RT_SUCCESS(rc))
+                                {
+                                    rc = DnDDirDroppedAddFile(&dirDroppedFiles, strPathAbs.c_str());
+                                    if (RT_SUCCESS(rc))
+                                    {
+                                        cbDataWritten = 0;
+
+                                        if (pCtx->uProtocol >= 2) /* Set the expected file size. */
+                                            objFile.SetSize(cbDataToRead);
+                                    }
+                                }
+                            }
+                            else
+                                rc = VERR_WRONG_ORDER;
+
+                            RTStrFree(pszPathAbs);
+                        }
+                        else
+                            rc = VERR_NO_MEMORY;
+                    }
+
+                    if (   RT_SUCCESS(rc)
+                        && uNextMsg == DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA)
+                    {
+                        bool fClose = false;
+
+                        uint32_t cbWritten;
+                        rc = objFile.Write(pvTmpData, cbDataRecv, &cbWritten);
                         if (RT_SUCCESS(rc))
                         {
-                            rc = RTFileSeek(hFile, 0, RTFILE_SEEK_END, NULL);
-                            if (RT_SUCCESS(rc))
+                            if (pCtx->uProtocol >= 2)
                             {
-                                rc = RTFileWrite(hFile, pvTmpData, cbDataRecv, 0);
-                                /* Valid UNIX mode? */
-                                if (   RT_SUCCESS(rc)
-                                    && (fMode & RTFS_UNIX_MASK))
-                                    rc = RTFileSetMode(hFile, (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR);
+                                /* Data transfer complete? Close the file. */
+                                fClose = objFile.IsComplete();
                             }
-                            RTFileClose(hFile);
-                            if (!guestFileList.contains(pszNewFile))
-                                guestFileList.append(pszNewFile);
+                            else
+                                fClose = true; /* Always close the file after each chunk. */
+
+                            cbDataWritten += cbWritten;
+                            Assert(cbDataWritten <= cbDataToRead);
+                        }
+
+                        if (fClose)
+                        {
+                            LogFlowFunc(("Closing file\n"));
+                            objFile.Close();
                         }
                     }
                     break;
                 }
                 case DragAndDropSvc::HOST_DND_HG_EVT_CANCEL:
                 {
-                    rc = vbglR3DnDHGProcessCancelMessage(uClientId);
+                    rc = vbglR3DnDHGProcessCancelMessage(pCtx);
                     if (RT_SUCCESS(rc))
                         rc = VERR_CANCELLED;
-                    /* Break out of the loop. */
+                    break;
                 }
-                default: fLoop = false; break;
+                default:
+                    LogFlowFunc(("Message %RU32 not supported\n", uNextMsg));
+                    rc = VERR_NOT_SUPPORTED;
+                    break;
             }
-        } else
-        {
-            if (rc == VERR_NO_DATA)
-                rc = VINF_SUCCESS;
-            break;
+
+#if 0 /* Not used yet. */
+            if (pCtx->uProtocol >= XXX)
+            {
+                /*
+                 * Send the progress back to the host.
+                 */
+                uint32_t uStatus;
+                int guestRc;
+                uint8_t uPercent;
+                switch (rc)
+                {
+                    case VINF_SUCCESS:
+                    {
+                        if (!cbData)
+                            cbData = 1;
+                        uPercent = cbDataWritten * 100 / (cbDataToRead ? cbDataToRead : 1);
+                        uStatus  = uPercent >= 100 ?
+                                   DragAndDropSvc::DND_PROGRESS_COMPLETE : DragAndDropSvc::DND_PROGRESS_RUNNING;
+                        guestRc  = VINF_SUCCESS;
+                        break;
+                    }
+
+                    case VERR_CANCELLED:
+                    {
+                        uStatus  = DragAndDropSvc::DND_PROGRESS_CANCELLED;
+                        uPercent = 100;
+                        guestRc  = VINF_SUCCESS;
+                        break;
+                    }
+
+                    default:
+                    {
+                        uStatus  = DragAndDropSvc::DND_PROGRESS_ERROR;
+                        uPercent = 100;
+                        guestRc  = rc;
+                        break;
+                    }
+                }
+
+                int rc2 = VbglR3DnDHGSetProgress(pCtx, uStatus, uPercent, guestRc);
+                LogFlowFunc(("cbDataWritten=%RU64 / cbDataToRead=%RU64 => %RU8%% (uStatus=%ld, %Rrc), rc=%Rrc\n", cbDataWritten, cbDataToRead,
+                              uPercent, uStatus, guestRc, rc2));
+                if (RT_SUCCESS(rc))
+                    rc = rc2;
+
+                /* All data transferred? */
+                if (   RT_SUCCESS(rc)
+                    && uPercent == 100)
+                {
+                    rc = VINF_EOF;
+                    break;
+                }
+            }
+#endif
         }
-    }while(fLoop);
 
-    RTMemFree(pvTmpData);
-    /* Cleanup on failure or if the user has canceled. */
+        if (RT_FAILURE(rc))
+            break;
+
+    } /* while */
+
+    LogFlowFunc(("Loop ended with %Rrc\n", rc));
+
+    /* All URI data processed? */
+    if (rc == VERR_NO_DATA)
+        rc = VINF_SUCCESS;
+
+    if (pvTmpData)
+        RTMemFree(pvTmpData);
+
+    /* Cleanup on failure or if the user has canceled the operation or
+     * something else went wrong. */
     if (RT_FAILURE(rc))
     {
-        /* Remove any stuff created. */
-        for (size_t i = 0; i < guestFileList.size(); ++i)
-            RTFileDelete(guestFileList.at(i).c_str());
-        for (size_t i = 0; i < guestDirList.size(); ++i)
-            RTDirRemove(guestDirList.at(i).c_str());
-        RTDirRemove(pszDropDir);
+        int rc2 = DnDDirDroppedFilesRollback(&dirDroppedFiles);
+        AssertRC(rc2); /* Not fatal, don't report back to host. */
+    }
+    else
+    {
+        /*
+         * Patch the old drop data with the new drop directory, so the drop target can find the files.
+         */
+        rc = lstURI.RootFromURIData(pvData, cbDataToRead, 0 /* fFlags */);
+        if (RT_SUCCESS(rc))
+        {
+            /* Cleanup the old data and write the new data back to the event. */
+            RTMemFree(pvData);
+
+            RTCString strData = lstURI.RootToString(pszDropDir);
+            LogFlowFunc(("cbDataToRead: %zu -> %zu\n", cbDataToRead, strData.length() + 1));
+
+            pvData       = RTStrDupN(strData.c_str(), strData.length());
+            cbDataToRead = strData.length() + 1;
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            *ppvData     = pvData;
+            *pcbDataRecv = cbDataToRead;
+        }
+
+        /** @todo Compare the URI list with the dirs/files we really transferred. */
     }
 
+    /*
+     * Close the dropped files directory.
+     * Don't try to remove it here, however, as the files are being needed
+     * by the client's drag'n drop operation lateron.
+     */
+    int rc2 = DnDDirDroppedFilesClose(&dirDroppedFiles, false);
+    if (RT_FAILURE(rc2)) /* Not fatal, don't report back to host. */
+        LogFlowFunc(("Closing dropped files directory failed with %Rrc\n", rc2));
+
+    LogFlowFuncLeaveRC(rc);
     return rc;
 }
 
-static int vbglR3DnDHGProcessDataMessageInternal(uint32_t  uClientId,
+static int vbglR3DnDHGProcessDataMessageInternal(PVBGLR3GUESTDNDCMDCTX pCtx,
                                                  uint32_t *puScreenId,
                                                  char     *pszFormat,
                                                  uint32_t  cbFormat,
                                                  uint32_t *pcbFormatRecv,
                                                  void     *pvData,
                                                  uint32_t  cbData,
-                                                 uint32_t *pcbDataRecv)
+                                                 uint32_t *pcbDataTotal)
 {
-    /* Validate input */
+    AssertPtrReturn(pCtx,          VERR_INVALID_POINTER);
     AssertPtrReturn(puScreenId,    VERR_INVALID_POINTER);
     AssertPtrReturn(pszFormat,     VERR_INVALID_POINTER);
     AssertReturn(cbFormat,         VERR_INVALID_PARAMETER);
     AssertPtrReturn(pcbFormatRecv, VERR_INVALID_POINTER);
     AssertPtrReturn(pvData,        VERR_INVALID_POINTER);
     AssertReturn(cbData,           VERR_INVALID_PARAMETER);
-    AssertPtrReturn(pcbDataRecv,   VERR_INVALID_POINTER);
+    AssertPtrReturn(pcbDataTotal,  VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDHGSENDDATAMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_HG_SND_DATA;
     Msg.hdr.cParms      = 5;
-    /* Initialize parameter */
+
     Msg.uScreenId.SetUInt32(0);
     Msg.pvFormat.SetPtr(pszFormat, cbFormat);
     Msg.cFormat.SetUInt32(0);
     Msg.pvData.SetPtr(pvData, cbData);
-    Msg.cData.SetUInt32(0);
-    /* Do request */
+    Msg.cbData.SetUInt32(0);
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
     {
@@ -505,38 +683,42 @@ static int vbglR3DnDHGProcessDataMessageInternal(uint32_t  uClientId,
         if (   RT_SUCCESS(rc)
             || rc == VERR_BUFFER_OVERFLOW)
         {
-            /* Fetch results */
             rc = Msg.uScreenId.GetUInt32(puScreenId);  AssertRC(rc);
+
+            /*
+             * In case of VERR_BUFFER_OVERFLOW get the data sizes required
+             * for the format + data blocks.
+             */
             rc = Msg.cFormat.GetUInt32(pcbFormatRecv); AssertRC(rc);
-            rc = Msg.cData.GetUInt32(pcbDataRecv);     AssertRC(rc);
-            /* A little bit paranoia */
+            rc = Msg.cbData.GetUInt32(pcbDataTotal); AssertRC(rc);
+
             AssertReturn(cbFormat >= *pcbFormatRecv, VERR_TOO_MUCH_DATA);
-            AssertReturn(cbData   >= *pcbDataRecv,   VERR_TOO_MUCH_DATA);
+            AssertReturn(cbData   >= *pcbDataTotal, VERR_TOO_MUCH_DATA);
         }
     }
+
     return rc;
 }
 
-static int vbglR3DnDHGProcessMoreDataMessageInternal(uint32_t  uClientId,
+static int vbglR3DnDHGProcessMoreDataMessageInternal(PVBGLR3GUESTDNDCMDCTX pCtx,
                                                      void     *pvData,
                                                      uint32_t  cbData,
-                                                     uint32_t *pcbDataRecv)
+                                                     uint32_t *pcbDataTotal)
 {
-    /* Validate input */
-    AssertPtrReturn(pvData,      VERR_INVALID_POINTER);
-    AssertReturn(cbData,         VERR_INVALID_PARAMETER);
-    AssertPtrReturn(pcbDataRecv, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCtx,         VERR_INVALID_POINTER);
+    AssertPtrReturn(pvData,       VERR_INVALID_POINTER);
+    AssertReturn(cbData,          VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pcbDataTotal, VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDHGSENDMOREDATAMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = g_clientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_HG_SND_MORE_DATA;
     Msg.hdr.cParms      = 2;
-    /* Initialize parameter */
+
     Msg.pvData.SetPtr(pvData, cbData);
-    Msg.cData.SetUInt32(0);
-    /* Do request */
+    Msg.cbData.SetUInt32(0);
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
     {
@@ -544,63 +726,75 @@ static int vbglR3DnDHGProcessMoreDataMessageInternal(uint32_t  uClientId,
         if (   RT_SUCCESS(rc)
             || rc == VERR_BUFFER_OVERFLOW)
         {
-            /* Fetch results */
-            rc = Msg.cData.GetUInt32(pcbDataRecv); AssertRC(rc);
-            /* A little bit paranoia */
-            AssertReturn(cbData >= *pcbDataRecv, VERR_TOO_MUCH_DATA);
+            rc = Msg.cbData.GetUInt32(pcbDataTotal); AssertRC(rc);
+            AssertReturn(cbData >= *pcbDataTotal, VERR_TOO_MUCH_DATA);
         }
     }
     return rc;
 }
 
-static int vbglR3DnDHGProcessSendDataMessages(uint32_t  uClientId,
-                                              uint32_t *puScreenId,
-                                              char     *pszFormat,
-                                              uint32_t  cbFormat,
-                                              uint32_t *pcbFormatRecv,
-                                              void    **ppvData,
-                                              uint32_t  cbData,
-                                              size_t   *pcbDataRecv)
+static int vbglR3DnDHGProcessSendDataMessageLoop(PVBGLR3GUESTDNDCMDCTX pCtx,
+                                                 uint32_t *puScreenId,
+                                                 char     *pszFormat,
+                                                 uint32_t  cbFormat,
+                                                 uint32_t *pcbFormatRecv,
+                                                 void    **ppvData,
+                                                 uint32_t  cbData,
+                                                 size_t   *pcbDataRecv)
 {
-    uint32_t cbDataRecv = 0;
-    int rc = vbglR3DnDHGProcessDataMessageInternal(uClientId,
+    AssertPtrReturn(pCtx,          VERR_INVALID_POINTER);
+    AssertPtrReturn(puScreenId,    VERR_INVALID_POINTER);
+    AssertPtrReturn(pszFormat,     VERR_INVALID_POINTER);
+    AssertPtrReturn(pcbFormatRecv, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppvData,       VERR_INVALID_POINTER);
+    /* pcbDataRecv is optional. */
+
+    uint32_t cbDataReq = 0;
+    int rc = vbglR3DnDHGProcessDataMessageInternal(pCtx,
                                                    puScreenId,
                                                    pszFormat,
                                                    cbFormat,
                                                    pcbFormatRecv,
                                                    *ppvData,
                                                    cbData,
-                                                   &cbDataRecv);
+                                                   &cbDataReq);
+    uint32_t cbDataTotal = cbDataReq;
+    void *pvData = *ppvData;
+
+    LogFlowFunc(("HOST_DND_HG_SND_DATA cbDataReq=%RU32, rc=%Rrc\n", cbDataTotal, rc));
 
-    size_t cbAllDataRecv = cbDataRecv;
     while (rc == VERR_BUFFER_OVERFLOW)
     {
         uint32_t uNextMsg;
         uint32_t cNextParms;
-        rc = vbglR3DnDQueryNextHostMessageType(uClientId, &uNextMsg, &cNextParms, false);
+        rc = vbglR3DnDQueryNextHostMessageType(pCtx, &uNextMsg, &cNextParms, false);
         if (RT_SUCCESS(rc))
         {
             switch(uNextMsg)
             {
                 case DragAndDropSvc::HOST_DND_HG_SND_MORE_DATA:
                 {
-                    *ppvData = RTMemRealloc(*ppvData, cbAllDataRecv + cbData);
-                    if (!*ppvData)
+                    /** @todo r=andy Don't use reallocate here; can go wrong with *really* big URI lists.
+                     *               Instead send as many URI entries as possible per chunk and add those entries
+                     *               to our to-process list for immediata processing. Repeat the step after processing then. */
+                    LogFlowFunc(("HOST_DND_HG_SND_MORE_DATA cbDataTotal: %RU32 -> %RU32\n", cbDataReq, cbDataReq + cbData));
+                    pvData = RTMemRealloc(*ppvData, cbDataTotal + cbData);
+                    if (!pvData)
                     {
                         rc = VERR_NO_MEMORY;
                         break;
                     }
-                    rc = vbglR3DnDHGProcessMoreDataMessageInternal(uClientId,
-                                                                   &((char*)*ppvData)[cbAllDataRecv],
+                    rc = vbglR3DnDHGProcessMoreDataMessageInternal(pCtx,
+                                                                   &((char *)pvData)[cbDataTotal],
                                                                    cbData,
-                                                                   &cbDataRecv);
-                    cbAllDataRecv += cbDataRecv;
+                                                                   &cbDataReq);
+                    cbDataTotal += cbDataReq;
                     break;
                 }
                 case DragAndDropSvc::HOST_DND_HG_EVT_CANCEL:
                 default:
                 {
-                    rc = vbglR3DnDHGProcessCancelMessage(uClientId);
+                    rc = vbglR3DnDHGProcessCancelMessage(pCtx);
                     if (RT_SUCCESS(rc))
                         rc = VERR_CANCELLED;
                     break;
@@ -608,13 +802,18 @@ static int vbglR3DnDHGProcessSendDataMessages(uint32_t  uClientId,
             }
         }
     }
+
     if (RT_SUCCESS(rc))
-        *pcbDataRecv = cbAllDataRecv;
+    {
+        *ppvData         = pvData;
+        if (pcbDataRecv)
+            *pcbDataRecv = cbDataTotal;
+    }
 
     return rc;
 }
 
-static int vbglR3DnDHGProcessSendDataMessage(uint32_t   uClientId,
+static int vbglR3DnDHGProcessSendDataMessage(PVBGLR3GUESTDNDCMDCTX pCtx,
                                              uint32_t  *puScreenId,
                                              char      *pszFormat,
                                              uint32_t   cbFormat,
@@ -623,19 +822,32 @@ static int vbglR3DnDHGProcessSendDataMessage(uint32_t   uClientId,
                                              uint32_t   cbData,
                                              size_t    *pcbDataRecv)
 {
-    int rc = vbglR3DnDHGProcessSendDataMessages(uClientId,
-                                                puScreenId,
-                                                pszFormat,
-                                                cbFormat,
-                                                pcbFormatRecv,
-                                                ppvData,
-                                                cbData,
-                                                pcbDataRecv);
+    AssertPtrReturn(pCtx,          VERR_INVALID_POINTER);
+    AssertPtrReturn(puScreenId,    VERR_INVALID_POINTER);
+    AssertPtrReturn(pszFormat,     VERR_INVALID_POINTER);
+    AssertPtrReturn(pcbFormatRecv, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppvData,       VERR_INVALID_POINTER);
+
+    int rc = vbglR3DnDHGProcessSendDataMessageLoop(pCtx,
+                                                   puScreenId,
+                                                   pszFormat,
+                                                   cbFormat,
+                                                   pcbFormatRecv,
+                                                   ppvData,
+                                                   cbData,
+                                                   pcbDataRecv);
     if (RT_SUCCESS(rc))
     {
-        /* Check if this is a uri-event */
-        if (RTStrNICmp(pszFormat, "text/uri-list", *pcbFormatRecv) == 0)
-            rc = vbglR3DnDHGProcessURIMessages(uClientId,
+        /* Check if this is an URI event. If so, let VbglR3 do all the actual
+         * data transfer + file/directory creation internally without letting
+         * the caller know.
+         *
+         * This keeps the actual (guest OS-)dependent client (like VBoxClient /
+         * VBoxTray) small by not having too much redundant code. */
+        AssertPtr(pcbFormatRecv);
+        if (DnDMIMEHasFileURLs(pszFormat, *pcbFormatRecv))
+        {
+            rc = vbglR3DnDHGProcessURIMessages(pCtx,
                                                puScreenId,
                                                pszFormat,
                                                cbFormat,
@@ -643,74 +855,85 @@ static int vbglR3DnDHGProcessSendDataMessage(uint32_t   uClientId,
                                                ppvData,
                                                cbData,
                                                pcbDataRecv);
+        }
+        else
+            rc = VERR_NOT_SUPPORTED;
+
+        if (RT_FAILURE(rc))
+        {
+            if (RT_FAILURE(rc))
+            {
+                int rc2 = VbglR3DnDHGSetProgress(pCtx, DragAndDropSvc::DND_PROGRESS_ERROR, 100 /* Percent */, rc);
+                AssertRC(rc2);
+            }
+        }
     }
+
     return rc;
 }
 
-static int vbglR3DnDGHProcessRequestPendingMessage(uint32_t  uClientId,
+static int vbglR3DnDGHProcessRequestPendingMessage(PVBGLR3GUESTDNDCMDCTX pCtx,
                                                    uint32_t *puScreenId)
 {
-    /* Validate input */
+    AssertPtrReturn(pCtx,       VERR_INVALID_POINTER);
     AssertPtrReturn(puScreenId, VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDGHREQPENDINGMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_GH_REQ_PENDING;
     Msg.hdr.cParms      = 1;
-    /* Initialize parameter */
+
     Msg.uScreenId.SetUInt32(0);
-    /* Do request */
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
     {
         rc = Msg.hdr.result;
         if (RT_SUCCESS(rc))
         {
-            /* Fetch results */
             rc = Msg.uScreenId.GetUInt32(puScreenId); AssertRC(rc);
         }
     }
+
     return rc;
 }
 
-static int vbglR3DnDGHProcessDroppedMessage(uint32_t  uClientId,
+static int vbglR3DnDGHProcessDroppedMessage(PVBGLR3GUESTDNDCMDCTX pCtx,
                                             char     *pszFormat,
                                             uint32_t  cbFormat,
                                             uint32_t *pcbFormatRecv,
                                             uint32_t *puAction)
 {
-    /* Validate input */
+    AssertPtrReturn(pCtx,          VERR_INVALID_POINTER);
     AssertPtrReturn(pszFormat,     VERR_INVALID_POINTER);
     AssertReturn(cbFormat,         VERR_INVALID_PARAMETER);
     AssertPtrReturn(pcbFormatRecv, VERR_INVALID_POINTER);
     AssertPtrReturn(puAction,      VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDGHDROPPEDMSG Msg;
     RT_ZERO(Msg);
-    Msg.hdr.u32ClientID = uClientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::HOST_DND_GH_EVT_DROPPED;
     Msg.hdr.cParms      = 3;
-    /* Initialize parameter */
+
     Msg.pvFormat.SetPtr(pszFormat, cbFormat);
     Msg.cFormat.SetUInt32(0);
     Msg.uAction.SetUInt32(0);
-    /* Do request */
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
     {
         rc = Msg.hdr.result;
         if (RT_SUCCESS(rc))
         {
-            /* Fetch results */
             rc = Msg.cFormat.GetUInt32(pcbFormatRecv); AssertRC(rc);
             rc = Msg.uAction.GetUInt32(puAction);      AssertRC(rc);
-            /* A little bit paranoia */
+
             AssertReturn(cbFormat >= *pcbFormatRecv, VERR_TOO_MUCH_DATA);
         }
     }
+
     return rc;
 }
 
@@ -718,300 +941,607 @@ static int vbglR3DnDGHProcessDroppedMessage(uint32_t  uClientId,
  *    Public functions                                                        *
  ******************************************************************************/
 
-/**
- * Initialize Drag & Drop.
- *
- * This will enable the Drag & Drop events.
- *
- * @returns VBox status code.
- */
-VBGLR3DECL(int) VbglR3DnDInit(void)
-{
-    return VbglR3DnDConnect(&g_clientId);
-}
-
-/**
- * Terminate Drag and Drop.
- *
- * This will Drag and Drop events.
- *
- * @returns VBox status.
- */
-VBGLR3DECL(int) VbglR3DnDTerm(void)
+VBGLR3DECL(int) VbglR3DnDConnect(PVBGLR3GUESTDNDCMDCTX pCtx)
 {
-    return VbglR3DnDDisconnect(g_clientId);
-}
-
-VBGLR3DECL(int) VbglR3DnDConnect(uint32_t *pu32ClientId)
-{
-    /* Validate input */
-    AssertPtrReturn(pu32ClientId, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
 
     /* Initialize header */
     VBoxGuestHGCMConnectInfo Info;
     RT_ZERO(Info.Loc.u);
     Info.result      = VERR_WRONG_ORDER;
     Info.u32ClientID = UINT32_MAX;  /* try make valgrind shut up. */
-    /* Initialize parameter */
     Info.Loc.type    = VMMDevHGCMLoc_LocalHost_Existing;
+
     int rc = RTStrCopy(Info.Loc.u.host.achName, sizeof(Info.Loc.u.host.achName), "VBoxDragAndDropSvc");
-    if (RT_FAILURE(rc)) return rc;
-    /* Do request */
+    if (RT_FAILURE(rc))
+        return rc;
+
     rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CONNECT, &Info, sizeof(Info));
     if (RT_SUCCESS(rc))
     {
         rc = Info.result;
-        if (RT_SUCCESS(rc))
-            *pu32ClientId = Info.u32ClientID;
+        if (rc == VERR_HGCM_SERVICE_NOT_FOUND)
+            rc = VINF_PERMISSION_DENIED;
+
+        /* Set the protocol version to use. */
+        pCtx->uProtocol = 2;
+
+        Assert(Info.u32ClientID);
+        pCtx->uClientID = Info.u32ClientID;
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Try sending the connect message to tell the protocol version to use.
+         * Note: This might fail when the Guest Additions run on an older VBox host (< VBox 5.0) which
+         *       does not implement this command.
+         */
+        DragAndDropSvc::VBOXDNDCONNECTPMSG Msg;
+        RT_ZERO(Msg);
+        Msg.hdr.result      = VERR_WRONG_ORDER;
+        Msg.hdr.u32ClientID = pCtx->uClientID;
+        Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_CONNECT;
+        Msg.hdr.cParms      = 2;
+
+        Msg.uProtocol.SetUInt32(pCtx->uProtocol);
+        Msg.uFlags.SetUInt32(0); /* Unused at the moment. */
+
+        int rc2 = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
+        if (RT_SUCCESS(rc2))
+            rc2 = Msg.hdr.result; /* Not fatal. */
+
+        LogFlowFunc(("Connection request ended with rc=%Rrc\n", rc2));
     }
-    if (rc == VERR_HGCM_SERVICE_NOT_FOUND)
-        rc = VINF_PERMISSION_DENIED;
+
+    LogFlowFunc(("uClient=%RU32, uProtocol=%RU32, rc=%Rrc\n", pCtx->uClientID, pCtx->uProtocol, rc));
     return rc;
 }
 
-VBGLR3DECL(int) VbglR3DnDDisconnect(uint32_t u32ClientId)
+VBGLR3DECL(int) VbglR3DnDDisconnect(PVBGLR3GUESTDNDCMDCTX pCtx)
 {
-    /* Initialize header */
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
     VBoxGuestHGCMDisconnectInfo Info;
     Info.result      = VERR_WRONG_ORDER;
-    Info.u32ClientID = u32ClientId;
-    /* Do request */
+    Info.u32ClientID = pCtx->uClientID;
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_DISCONNECT, &Info, sizeof(Info));
     if (RT_SUCCESS(rc))
         rc = Info.result;
+
     return rc;
 }
 
-VBGLR3DECL(int) VbglR3DnDProcessNextMessage(CPVBGLR3DNDHGCMEVENT pEvent)
+VBGLR3DECL(int) VbglR3DnDProcessNextMessage(PVBGLR3GUESTDNDCMDCTX pCtx, CPVBGLR3DNDHGCMEVENT pEvent)
 {
-    /* Validate input */
+    AssertPtrReturn(pCtx,   VERR_INVALID_POINTER);
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
 
     uint32_t       uMsg       = 0;
     uint32_t       uNumParms  = 0;
     const uint32_t ccbFormats = _64K;
-    const uint32_t ccbData    = _1M;
-    int rc = vbglR3DnDQueryNextHostMessageType(g_clientId, &uMsg, &uNumParms, true);
+    const uint32_t ccbData    = _64K;
+    int rc = vbglR3DnDQueryNextHostMessageType(pCtx, &uMsg, &uNumParms,
+                                               true /* fWait */);
     if (RT_SUCCESS(rc))
     {
-        DO(("Got message %d\n", uMsg));
+        pEvent->uType = uMsg;
+
         switch(uMsg)
         {
             case DragAndDropSvc::HOST_DND_HG_EVT_ENTER:
             case DragAndDropSvc::HOST_DND_HG_EVT_MOVE:
             case DragAndDropSvc::HOST_DND_HG_EVT_DROPPED:
             {
-                pEvent->uType = uMsg;
                 pEvent->pszFormats = static_cast<char*>(RTMemAlloc(ccbFormats));
                 if (!pEvent->pszFormats)
-                    return VERR_NO_MEMORY;
-                rc = vbglR3DnDHGProcessActionMessage(g_clientId,
-                                                     uMsg,
-                                                     &pEvent->uScreenId,
-                                                     &pEvent->u.a.uXpos,
-                                                     &pEvent->u.a.uYpos,
-                                                     &pEvent->u.a.uDefAction,
-                                                     &pEvent->u.a.uAllActions,
-                                                     pEvent->pszFormats,
-                                                     ccbFormats,
-                                                     &pEvent->cbFormats);
+                    rc = VERR_NO_MEMORY;
+
+                if (RT_SUCCESS(rc))
+                    rc = vbglR3DnDHGProcessActionMessage(pCtx,
+                                                         uMsg,
+                                                         &pEvent->uScreenId,
+                                                         &pEvent->u.a.uXpos,
+                                                         &pEvent->u.a.uYpos,
+                                                         &pEvent->u.a.uDefAction,
+                                                         &pEvent->u.a.uAllActions,
+                                                         pEvent->pszFormats,
+                                                         ccbFormats,
+                                                         &pEvent->cbFormats);
                 break;
             }
             case DragAndDropSvc::HOST_DND_HG_EVT_LEAVE:
             {
-                pEvent->uType = uMsg;
-                rc = vbglR3DnDHGProcessLeaveMessage(g_clientId);
+                rc = vbglR3DnDHGProcessLeaveMessage(pCtx);
                 break;
             }
             case DragAndDropSvc::HOST_DND_HG_SND_DATA:
             {
-                pEvent->uType = uMsg;
                 pEvent->pszFormats = static_cast<char*>(RTMemAlloc(ccbFormats));
                 if (!pEvent->pszFormats)
-                    return VERR_NO_MEMORY;
-                pEvent->u.b.pvData = RTMemAlloc(ccbData);
-                if (!pEvent->u.b.pvData)
+                    rc = VERR_NO_MEMORY;
+
+                if (RT_SUCCESS(rc))
                 {
-                    RTMemFree(pEvent->pszFormats);
-                    pEvent->pszFormats = NULL;
-                    return VERR_NO_MEMORY;
+                    pEvent->u.b.pvData = RTMemAlloc(ccbData);
+                    if (!pEvent->u.b.pvData)
+                    {
+                        RTMemFree(pEvent->pszFormats);
+                        pEvent->pszFormats = NULL;
+
+                        rc = VERR_NO_MEMORY;
+                    }
                 }
-                rc = vbglR3DnDHGProcessSendDataMessage(g_clientId,
-                                                       &pEvent->uScreenId,
-                                                       pEvent->pszFormats,
-                                                       ccbFormats,
-                                                       &pEvent->cbFormats,
-                                                       &pEvent->u.b.pvData,
-                                                       ccbData,
-                                                       &pEvent->u.b.cbData);
+
+                if (RT_SUCCESS(rc))
+                    rc = vbglR3DnDHGProcessSendDataMessage(pCtx,
+                                                           &pEvent->uScreenId,
+                                                           pEvent->pszFormats,
+                                                           ccbFormats,
+                                                           &pEvent->cbFormats,
+                                                           &pEvent->u.b.pvData,
+                                                           ccbData,
+                                                           &pEvent->u.b.cbData);
+                break;
+            }
+            case DragAndDropSvc::HOST_DND_HG_SND_MORE_DATA:
+            case DragAndDropSvc::HOST_DND_HG_SND_DIR:
+            case DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA:
+            {
+                /*
+                 * All messages in this case are handled internally
+                 * by vbglR3DnDHGProcessSendDataMessage() and must
+                 * be specified by a preceding HOST_DND_HG_SND_DATA call.
+                 */
+                rc = VERR_WRONG_ORDER;
+                break;
+            }
+            case DragAndDropSvc::HOST_DND_HG_EVT_CANCEL:
+            {
+                rc = vbglR3DnDHGProcessCancelMessage(pCtx);
                 break;
             }
 #ifdef VBOX_WITH_DRAG_AND_DROP_GH
             case DragAndDropSvc::HOST_DND_GH_REQ_PENDING:
             {
-                pEvent->uType = uMsg;
-                rc = vbglR3DnDGHProcessRequestPendingMessage(g_clientId,
-                                                             &pEvent->uScreenId);
+                rc = vbglR3DnDGHProcessRequestPendingMessage(pCtx, &pEvent->uScreenId);
                 break;
             }
             case DragAndDropSvc::HOST_DND_GH_EVT_DROPPED:
             {
-                pEvent->uType = uMsg;
                 pEvent->pszFormats = static_cast<char*>(RTMemAlloc(ccbFormats));
                 if (!pEvent->pszFormats)
-                    return VERR_NO_MEMORY;
-                rc = vbglR3DnDGHProcessDroppedMessage(g_clientId,
-                                                      pEvent->pszFormats,
-                                                      ccbFormats,
-                                                      &pEvent->cbFormats,
-                                                      &pEvent->u.a.uDefAction);
+                    rc = VERR_NO_MEMORY;
+
+                if (RT_SUCCESS(rc))
+                    rc = vbglR3DnDGHProcessDroppedMessage(pCtx,
+                                                          pEvent->pszFormats,
+                                                          ccbFormats,
+                                                          &pEvent->cbFormats,
+                                                          &pEvent->u.a.uDefAction);
                 break;
             }
-#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
-            case DragAndDropSvc::HOST_DND_HG_EVT_CANCEL:
+#endif
+            default:
             {
-                pEvent->uType = uMsg;
-                rc = vbglR3DnDHGProcessCancelMessage(g_clientId);
-                if (RT_SUCCESS(rc))
-                    rc = VERR_CANCELLED;
+                rc = VERR_NOT_SUPPORTED;
                 break;
             }
-            default: AssertMsgFailedReturn(("Message %u isn't expected in this context", uMsg), VERR_INVALID_PARAMETER); break;
         }
     }
+
     return rc;
 }
 
-VBGLR3DECL(int) VbglR3DnDHGAcknowledgeOperation(uint32_t uAction)
+VBGLR3DECL(int) VbglR3DnDHGAcknowledgeOperation(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uAction)
 {
-    DO(("ACK: %u\n", uAction));
-    /* Initialize header */
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
     DragAndDropSvc::VBOXDNDHGACKOPMSG Msg;
     RT_ZERO(Msg);
     Msg.hdr.result      = VERR_WRONG_ORDER;
-    Msg.hdr.u32ClientID = g_clientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_HG_ACK_OP;
     Msg.hdr.cParms      = 1;
-    /* Initialize parameter */
+
     Msg.uAction.SetUInt32(uAction);
-    /* Do request */
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
         rc = Msg.hdr.result;
+
     return rc;
 }
 
-VBGLR3DECL(int) VbglR3DnDHGRequestData(const char* pcszFormat)
+VBGLR3DECL(int) VbglR3DnDHGRequestData(PVBGLR3GUESTDNDCMDCTX pCtx, const char* pcszFormat)
 {
-    DO(("DATA_REQ: '%s'\n", pcszFormat));
-    /* Validate input */
-    AssertPtrReturn(pcszFormat, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pCtx,       VERR_INVALID_POINTER);
+    AssertPtrReturn(pcszFormat, VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDHGREQDATAMSG Msg;
     RT_ZERO(Msg);
     Msg.hdr.result      = VERR_WRONG_ORDER;
-    Msg.hdr.u32ClientID = g_clientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_HG_REQ_DATA;
     Msg.hdr.cParms      = 1;
-    /* Do request */
+
     Msg.pFormat.SetPtr((void*)pcszFormat, (uint32_t)strlen(pcszFormat) + 1);
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
         rc = Msg.hdr.result;
+
     return rc;
 }
 
-VBGLR3DECL(int) VbglR3DnDGHAcknowledgePending(uint32_t uDefAction, uint32_t uAllActions, const char* pcszFormat)
+VBGLR3DECL(int) VbglR3DnDHGSetProgress(PVBGLR3GUESTDNDCMDCTX pCtx, uint32_t uStatus, uint8_t uPercent, int rcErr)
 {
-    DO(("PEND: %u: %u (%s)\n", uDefAction, uAllActions, pcszFormat));
-    /* Validate input */
-    AssertPtrReturn(pcszFormat, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    DragAndDropSvc::VBOXDNDHGEVTPROGRESSMSG Msg;
+    RT_ZERO(Msg);
+    Msg.hdr.result      = VERR_WRONG_ORDER;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
+    Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_HG_EVT_PROGRESS;
+    Msg.hdr.cParms      = 3;
+
+    Msg.uStatus.SetUInt32(uStatus);
+    Msg.uPercent.SetUInt32(uPercent);
+    Msg.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
+
+    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
+    if (RT_SUCCESS(rc))
+        rc = Msg.hdr.result;
+
+    return rc;
+}
+
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+VBGLR3DECL(int) VbglR3DnDGHAcknowledgePending(PVBGLR3GUESTDNDCMDCTX pCtx,
+                                              uint32_t uDefAction, uint32_t uAllActions, const char* pcszFormats)
+{
+    AssertPtrReturn(pCtx,        VERR_INVALID_POINTER);
+    AssertPtrReturn(pcszFormats, VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDGHACKPENDINGMSG Msg;
     RT_ZERO(Msg);
     Msg.hdr.result      = VERR_WRONG_ORDER;
-    Msg.hdr.u32ClientID = g_clientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_ACK_PENDING;
     Msg.hdr.cParms      = 3;
-    /* Initialize parameter */
+
     Msg.uDefAction.SetUInt32(uDefAction);
     Msg.uAllActions.SetUInt32(uAllActions);
-    Msg.pFormat.SetPtr((void*)pcszFormat, static_cast<uint32_t>(strlen(pcszFormat) + 1));
-    /* Do request */
+    Msg.pFormat.SetPtr((void*)pcszFormats, (uint32_t)strlen(pcszFormats) + 1);
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
         rc = Msg.hdr.result;
+
     return rc;
 }
 
-VBGLR3DECL(int) VbglR3DnDGHSendData(void *pvData, uint32_t cbData)
+static int vbglR3DnDGHSendDataInternal(PVBGLR3GUESTDNDCMDCTX pCtx,
+                                       void *pvData, uint32_t cbData, uint32_t cbAdditionalData)
 {
-    DO(("DATA: %x (%u)\n", pvData, cbData));
-    /* Validate input */
+    AssertPtrReturn(pCtx,   VERR_INVALID_POINTER);
     AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     AssertReturn(cbData,    VERR_INVALID_PARAMETER);
+    /* cbAdditionalData is optional. */
 
-    /* Todo: URI support. Currently only data is send over to the host. For URI
-     * support basically the same as in the H->G case (see
-     * HostServices/DragAndDrop/dndmanager.h/cpp) has to be done:
-     * 1. Parse the urilist
-     * 2. Recursively send "create dir" and "transfer file" msg to the host
-     * 3. Patch the urilist by removing all base dirnames
-     * 4. On the host all needs to received and the urilist patched afterwards
-     *    to point to the new location
-     */
-
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDGHSENDDATAMSG Msg;
     RT_ZERO(Msg);
     Msg.hdr.result      = VERR_WRONG_ORDER;
-    Msg.hdr.u32ClientID = g_clientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_SND_DATA;
     Msg.hdr.cParms      = 2;
-    Msg.uSize.SetUInt32(cbData);
-    int rc          = VINF_SUCCESS;
-    uint32_t cbMax  = _1M;
-    uint32_t cbSend = 0;
-    while(cbSend < cbData)
-    {
-        /* Initialize parameter */
-        uint32_t cbToSend = RT_MIN(cbData - cbSend, cbMax);
-        Msg.pData.SetPtr(static_cast<uint8_t*>(pvData) + cbSend, cbToSend);
-        /* Do request */
+
+    /* Total amount of bytes to send (including this data block). */
+    Msg.cbTotalBytes.SetUInt32(cbData + cbAdditionalData);
+
+    int rc = VINF_SUCCESS;
+
+    uint32_t cbCurChunk;
+    uint32_t cbMaxChunk = _64K; /** @todo Transfer max. 64K chunks per message. Configurable? */
+    uint32_t cbSent     = 0;
+
+    while (cbSent < cbData)
+    {
+        cbCurChunk = RT_MIN(cbData - cbSent, cbMaxChunk);
+        Msg.pvData.SetPtr(static_cast<uint8_t *>(pvData) + cbSent, cbCurChunk);
+
         rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
         if (RT_SUCCESS(rc))
-        {
             rc = Msg.hdr.result;
-            /* Did the host cancel the event? */
-            if (rc == VERR_CANCELLED)
-                break;
+
+        if (RT_FAILURE(rc))
+            break;
+
+        cbSent += cbCurChunk;
+    }
+
+    if (RT_SUCCESS(rc))
+        Assert(cbSent == cbData);
+
+    LogFlowFunc(("Returning rc=%Rrc, cbData=%RU32, cbAddtionalData=%RU32, cbSent=%RU32\n",
+                 rc, cbData, cbAdditionalData, cbSent));
+    return rc;
+}
+
+static int vbglR3DnDGHSendDir(PVBGLR3GUESTDNDCMDCTX pCtx, DnDURIObject &obj)
+{
+    AssertPtrReturn(pCtx,                                  VERR_INVALID_POINTER);
+    AssertReturn(obj.GetType() == DnDURIObject::Directory, VERR_INVALID_PARAMETER);
+
+    DragAndDropSvc::VBOXDNDGHSENDDIRMSG Msg;
+    RT_ZERO(Msg);
+    Msg.hdr.result      = VERR_WRONG_ORDER;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
+    Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_SND_DIR;
+    Msg.hdr.cParms      = 3;
+
+    RTCString strPath = obj.GetDestPath();
+    LogFlowFunc(("strDir=%s (%zu), fMode=0x%x\n",
+                 strPath.c_str(), strPath.length(), obj.GetMode()));
+
+    Msg.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)(strPath.length() + 1));
+    Msg.cbName.SetUInt32((uint32_t)(strPath.length() + 1));
+    Msg.fMode.SetUInt32(obj.GetMode());
+
+    int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
+    if (RT_SUCCESS(rc))
+        rc = Msg.hdr.result;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static int vbglR3DnDGHSendFile(PVBGLR3GUESTDNDCMDCTX pCtx, DnDURIObject &obj)
+{
+    AssertPtrReturn(pCtx,                             VERR_INVALID_POINTER);
+    AssertReturn(obj.GetType() == DnDURIObject::File, VERR_INVALID_PARAMETER);
+
+    uint32_t cbBuf = _64K; /** @todo Make this configurable? */
+    void *pvBuf = RTMemAlloc(cbBuf); /** @todo Make this buffer part of PVBGLR3GUESTDNDCMDCTX? */
+    if (!pvBuf)
+        return VERR_NO_MEMORY;
+
+    RTCString strPath = obj.GetDestPath();
+
+    int rc = obj.Open(DnDURIObject::Source, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
+    if (RT_FAILURE(rc))
+    {
+        LogFunc(("Opening file \"%s\" failed with rc=%Rrc\n", obj.GetSourcePath().c_str(), rc));
+        return rc;
+    }
+
+    LogFlowFunc(("strFile=%s (%zu), cbSize=%RU64, fMode=0x%x\n", strPath.c_str(), strPath.length(), obj.GetSize(), obj.GetMode()));
+    LogFlowFunc(("uProtocol=%RU32, uClientID=%RU32\n", pCtx->uProtocol, pCtx->uClientID));
+
+    if (pCtx->uProtocol >= 2) /* Protocol version 2 and up sends a file header first. */
+    {
+        DragAndDropSvc::VBOXDNDGHSENDFILEHDRMSG MsgHdr;
+        RT_ZERO(MsgHdr);
+        MsgHdr.hdr.result      = VERR_WRONG_ORDER;
+        MsgHdr.hdr.u32ClientID = pCtx->uClientID;
+        MsgHdr.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_SND_FILE_HDR;
+        MsgHdr.hdr.cParms      = 6;
+
+        MsgHdr.uContext.SetUInt32(0); /* Context ID; unused at the moment. */
+        MsgHdr.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)(strPath.length() + 1));
+        MsgHdr.cbName.SetUInt32((uint32_t)(strPath.length() + 1));
+        MsgHdr.uFlags.SetUInt32(0);   /* Flags; unused at the moment. */
+        MsgHdr.fMode.SetUInt32(obj.GetMode());
+        MsgHdr.cbTotal.SetUInt64(obj.GetSize());
+
+        rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(MsgHdr)), &MsgHdr, sizeof(MsgHdr));
+        if (RT_SUCCESS(rc))
+            rc = MsgHdr.hdr.result;
+
+        LogFlowFunc(("Sending file header resulted in %Rrc\n", rc));
+    }
+    else
+        rc = VINF_SUCCESS;
+
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Send the actual file data, chunk by chunk.
+         */
+        DragAndDropSvc::VBOXDNDGHSENDFILEDATAMSG Msg;
+        RT_ZERO(Msg);
+        Msg.hdr.result      = VERR_WRONG_ORDER;
+        Msg.hdr.u32ClientID = pCtx->uClientID;
+        Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_SND_FILE_DATA;
+
+        if (pCtx->uProtocol <= 1)
+        {
+            Msg.hdr.cParms  = 5;
+
+            Msg.u.v1.pvName.SetPtr((void *)strPath.c_str(), (uint32_t)(strPath.length() + 1));
+            Msg.u.v1.cbName.SetUInt32((uint32_t)(strPath.length() + 1));
+            Msg.u.v1.fMode.SetUInt32(obj.GetMode());
         }
         else
+        {
+            /* Only send context ID, file chunk + chunk size. */
+            Msg.hdr.cParms  = 3;
+
+            Msg.u.v2.uContext.SetUInt32(0); /** @todo Set context ID. */
+        }
+
+        uint64_t cbToReadTotal  = obj.GetSize();
+        uint64_t cbWrittenTotal = 0;
+        while (cbToReadTotal)
+        {
+            uint32_t cbToRead = RT_MIN(cbToReadTotal, cbBuf);
+            uint32_t cbRead   = 0;
+            if (cbToRead)
+                rc = obj.Read(pvBuf, cbToRead, &cbRead);
+
+            LogFlowFunc(("cbToReadTotal=%RU64, cbToRead=%RU32, cbRead=%RU32, rc=%Rrc\n",
+                         cbToReadTotal, cbToRead, cbRead, rc));
+
+            if (   RT_SUCCESS(rc)
+                && cbRead)
+            {
+                if (pCtx->uProtocol <= 1)
+                {
+                    Msg.u.v1.pvData.SetPtr(pvBuf, cbRead);
+                    Msg.u.v1.cbData.SetUInt32(cbRead);
+                }
+                else
+                {
+                    Msg.u.v2.pvData.SetPtr(pvBuf, cbRead);
+                    Msg.u.v2.cbData.SetUInt32(cbRead);
+                }
+
+                rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
+                if (RT_SUCCESS(rc))
+                    rc = Msg.hdr.result;
+            }
+
+            if (RT_FAILURE(rc))
+            {
+                LogFlowFunc(("Reading failed with rc=%Rrc\n", rc));
+                break;
+            }
+
+            Assert(cbRead  <= cbToReadTotal);
+            cbToReadTotal  -= cbRead;
+            cbWrittenTotal += cbRead;
+
+            LogFlowFunc(("%RU64/%RU64 -- %RU8%%\n", cbWrittenTotal, obj.GetSize(), cbWrittenTotal * 100 / obj.GetSize()));
+        };
+    }
+
+    obj.Close();
+
+    RTMemFree(pvBuf);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static int vbglR3DnDGHSendURIObject(PVBGLR3GUESTDNDCMDCTX pCtx, DnDURIObject &obj)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    int rc;
+
+    switch (obj.GetType())
+    {
+        case DnDURIObject::Directory:
+            rc = vbglR3DnDGHSendDir(pCtx, obj);
+            break;
+
+        case DnDURIObject::File:
+            rc = vbglR3DnDGHSendFile(pCtx, obj);
+            break;
+
+        default:
+            AssertMsgFailed(("URI type %ld not implemented\n", obj.GetType()));
+            rc = VERR_NOT_IMPLEMENTED;
             break;
-        cbSend += cbToSend;
-//        RTThreadSleep(500);
     }
+
     return rc;
 }
 
-VBGLR3DECL(int) VbglR3DnDGHErrorEvent(int rcOp)
+static int vbglR3DnDGHProcessURIMessages(PVBGLR3GUESTDNDCMDCTX pCtx,
+                                         const void *pvData, uint32_t cbData)
 {
-    DO(("GH_ERROR\n"));
+    AssertPtrReturn(pCtx,   VERR_INVALID_POINTER);
+    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
+    AssertReturn(cbData,    VERR_INVALID_PARAMETER);
+
+    RTCList<RTCString> lstPaths =
+        RTCString((const char *)pvData, cbData).split("\r\n");
+
+    DnDURIList lstURI;
+    int rc = lstURI.AppendURIPathsFromList(lstPaths, 0 /* fFlags */);
+    if (RT_SUCCESS(rc))
+    {
+        /* Send metadata; in this case it's the (non-recursive) file/directory
+         * URI list the host needs to know to initialize the drag'n drop operation. */
+        RTCString strRootDest = lstURI.RootToString();
+        Assert(strRootDest.isNotEmpty());
+
+        void *pvToSend = (void *)strRootDest.c_str();
+        uint32_t cbToSend = (uint32_t)strRootDest.length() + 1;
+
+        rc = vbglR3DnDGHSendDataInternal(pCtx, pvToSend, cbToSend,
+                                         /* Include total bytes of all file paths,
+                                          * file sizes etc. */
+                                         lstURI.TotalBytes());
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        while (!lstURI.IsEmpty())
+        {
+            DnDURIObject &nextObj = lstURI.First();
+
+            rc = vbglR3DnDGHSendURIObject(pCtx, nextObj);
+            if (RT_FAILURE(rc))
+                break;
+
+            lstURI.RemoveFirst();
+        }
+    }
+
+    return rc;
+}
+
+VBGLR3DECL(int) VbglR3DnDGHSendData(PVBGLR3GUESTDNDCMDCTX pCtx, const char *pszFormat, void *pvData, uint32_t cbData)
+{
+    AssertPtrReturn(pCtx,      VERR_INVALID_POINTER);
+    AssertPtrReturn(pszFormat, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvData,    VERR_INVALID_POINTER);
+    AssertReturn(cbData,       VERR_INVALID_PARAMETER);
+
+    LogFlowFunc(("pszFormat=%s, pvData=%p, cbData=%RU32\n", pszFormat, pvData, cbData));
+
+    int rc;
+    if (DnDMIMEHasFileURLs(pszFormat, strlen(pszFormat)))
+    {
+        rc = vbglR3DnDGHProcessURIMessages(pCtx, pvData, cbData);
+    }
+    else
+    {
+        rc = vbglR3DnDGHSendDataInternal(pCtx, pvData, cbData, 0 /* cbAdditionalData */);
+    }
+
+    if (RT_FAILURE(rc))
+    {
+        int rc2 = VbglR3DnDGHSendError(pCtx, rc);
+        if (RT_FAILURE(rc2))
+            LogFlowFunc(("Unable to send error (%Rrc) to host, rc=%Rrc\n", rc, rc2));
+    }
+
+    return rc;
+}
+
+VBGLR3DECL(int) VbglR3DnDGHSendError(PVBGLR3GUESTDNDCMDCTX pCtx, int rcErr)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
 
-    /* Initialize header */
     DragAndDropSvc::VBOXDNDGHEVTERRORMSG Msg;
     RT_ZERO(Msg);
     Msg.hdr.result      = VERR_WRONG_ORDER;
-    Msg.hdr.u32ClientID = g_clientId;
+    Msg.hdr.u32ClientID = pCtx->uClientID;
     Msg.hdr.u32Function = DragAndDropSvc::GUEST_DND_GH_EVT_ERROR;
     Msg.hdr.cParms      = 1;
-    /* Initialize parameter */
-    Msg.uRC.SetUInt32(rcOp);
-    /* Do request */
+
+    Msg.rc.SetUInt32((uint32_t)rcErr); /* uint32_t vs. int. */
+
     int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg));
     if (RT_SUCCESS(rc))
         rc = Msg.hdr.result;
+
+    LogFlowFunc(("Sending error %Rrc returned with rc=%Rrc\n", rcErr, rc));
     return rc;
 }
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
+
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
index c385e8d..dbdc3ba 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibVideo.cpp
@@ -485,7 +485,7 @@ VBGLR3DECL(int) VbglR3RetrieveVideoMode(unsigned cScreen,
     if (RT_SUCCESS(rc))
     {
         char c1, c2;
-        cMatches = sscanf(szModeParms, "%ux%ux%u%c%ux%u,%u%c", &cx, &cy, &cBits,
+        cMatches = sscanf(szModeParms, "%5ux%5ux%2u%c%5ux%5u,%1u%c", &cx, &cy, &cBits,
                           &c1, &x, &y, &fEnabled, &c2);
         if ((cMatches == 7 && c1 == ',') || cMatches == 3)
             rc = VINF_SUCCESS;
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VMMDev.cpp b/src/VBox/Additions/common/VBoxGuestLib/VMMDev.cpp
index beda4bb..ad629dd 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VMMDev.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/VMMDev.cpp
@@ -1,3 +1,4 @@
+/* $Id: VMMDev.cpp $ */
 /** @file
  * VBoxGuestLibR0 - VMMDev device related functions.
  */
diff --git a/src/VBox/Additions/common/VBoxGuestLib/VbglR0CanUsePhysPageList.cpp b/src/VBox/Additions/common/VBoxGuestLib/VbglR0CanUsePhysPageList.cpp
index e8ecf07..4e93f6a 100644
--- a/src/VBox/Additions/common/VBoxGuestLib/VbglR0CanUsePhysPageList.cpp
+++ b/src/VBox/Additions/common/VBoxGuestLib/VbglR0CanUsePhysPageList.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 83618 $ */
+/* $Id: VbglR0CanUsePhysPageList.cpp $ */
 /** @file
  * VBoxGuestLibR0 - Physical memory heap.
  */
diff --git a/src/VBox/Additions/common/VBoxService/Makefile.kmk b/src/VBox/Additions/common/VBoxService/Makefile.kmk
index 8a42bab..996f63a 100644
--- a/src/VBox/Additions/common/VBoxService/Makefile.kmk
+++ b/src/VBox/Additions/common/VBoxService/Makefile.kmk
@@ -52,9 +52,6 @@ ifdef VBOX_WITH_MEMBALLOON
 endif
 if1of ($(KBUILD_TARGET), win)
  VBoxService_DEFS        += VBOXSERVICE_PAGE_SHARING
- ifdef VBOX_WITH_MMR
-  VBoxService_DEFS       += VBOX_WITH_MMR
- endif
 endif
 if1of ($(KBUILD_TARGET), linux)
  VBoxService_DEFS        += VBOXSERVICE_CPUHOTPLUG
diff --git a/src/VBox/Additions/common/VBoxService/VBoxService-win.rc b/src/VBox/Additions/common/VBoxService/VBoxService-win.rc
index 91db5f5..db18d7c 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxService-win.rc
+++ b/src/VBox/Additions/common/VBoxService/VBoxService-win.rc
@@ -22,26 +22,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x2L
-   FILESUBTYPE          0x0L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DLL
+   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox Guest Additions Service\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxService\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
          VALUE "OriginalFilename", "VBoxService.exe\0"
-         VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Additions/common/VBoxService/VBoxService.cpp b/src/VBox/Additions/common/VBoxService/VBoxService.cpp
index 341e8fc..6a8f3d8 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxService.cpp
+++ b/src/VBox/Additions/common/VBoxService/VBoxService.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2007-2012 Oracle Corporation
+ * Copyright (C) 2007-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -41,6 +41,7 @@
 #include <iprt/asm.h>
 #include <iprt/buildconfig.h>
 #include <iprt/initterm.h>
+#include <iprt/file.h>
 #ifdef DEBUG
 # include <iprt/memtracker.h>
 #endif
@@ -261,7 +262,12 @@ int VBoxServiceLogCreate(const char *pszLogFile)
 #endif
     char szError[RTPATH_MAX + 128] = "";
     int rc = RTLogCreateEx(&g_pLoggerRelease, fFlags, "all",
-                           "VBOXSERVICE_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups,
+#ifdef DEBUG
+                           "VBOXSERVICE_LOG",
+#else
+                           "VBOXSERVICE_RELEASE_LOG",
+#endif
+                           RT_ELEMENTS(s_apszGroups), s_apszGroups,
                            RTLOGDEST_STDOUT | RTLOGDEST_USER,
                            VBoxServiceLogHeaderFooter, g_cHistory, g_uHistoryFileSize, g_uHistoryFileTime,
                            szError, sizeof(szError), pszLogFile);
@@ -789,7 +795,6 @@ void VBoxServiceMainWait(void)
 int main(int argc, char **argv)
 {
     RTEXITCODE rcExit;
-    bool fUserSession = false;
 
     /*
      * Init globals and such.
@@ -814,6 +819,7 @@ int main(int argc, char **argv)
         return rcExit;
 #endif
 
+    bool fUserSession = false;
 #ifdef VBOX_WITH_GUEST_CONTROL
     /*
      * Check if we're the specially spawned VBoxService.exe process that
@@ -831,20 +837,15 @@ int main(int argc, char **argv)
      * do to some initial stuff with it.
      */
     if (fUserSession)
-    {
-        VBoxServiceVerbose(2, "Calling VbgR3InitUser()\n");
         rc = VbglR3InitUser();
-    }
     else
-    {
-        VBoxServiceVerbose(2, "Calling VbgR3Init()\n");
         rc = VbglR3Init();
-    }
+
     if (RT_FAILURE(rc))
     {
         if (rc == VERR_ACCESS_DENIED)
             return RTMsgErrorExit(RTEXITCODE_FAILURE, "Insufficient privileges to start %s! Please start with Administrator/root privileges!\n",
-                                    g_pszProgName);
+                                  g_pszProgName);
         return RTMsgErrorExit(RTEXITCODE_FAILURE, "VbglR3Init failed with rc=%Rrc\n", rc);
     }
 
@@ -1032,7 +1033,7 @@ int main(int argc, char **argv)
 
     rc = VBoxServiceLogCreate(strlen(g_szLogFile) ? g_szLogFile : NULL);
     if (RT_FAILURE(rc))
-        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to create release log (%s, %Rrc)",
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to create release log \"%s\", rc=%Rrc\n",
                               strlen(g_szLogFile) ? g_szLogFile : "<None>", rc);
 
     /* Call pre-init if we didn't do it already. */
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
index cd6d5ee..3848ce6 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
+++ b/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -201,12 +201,13 @@ DECLCALLBACK(int) VBoxServiceControlWorker(bool volatile *pfShutdown)
     uint32_t cbScratchBuf = _64K; /** @todo Make buffer size configurable via guest properties/argv! */
     AssertReturn(RT_IS_POWER_OF_TWO(cbScratchBuf), VERR_INVALID_PARAMETER);
     uint8_t *pvScratchBuf = (uint8_t*)RTMemAlloc(cbScratchBuf);
-    AssertPtrReturn(pvScratchBuf, VERR_NO_MEMORY);
+    AssertReturn(pvScratchBuf, VERR_NO_MEMORY);
 
     VBGLR3GUESTCTRLCMDCTX ctxHost = { g_uControlSvcClientID };
     /* Set default protocol version to 1. */
     ctxHost.uProtocol = 1;
 
+    int cRetrievalFailed = 0; /* Number of failed message retrievals in a row. */
     for (;;)
     {
         VBoxServiceVerbose(3, "Waiting for host msg ...\n");
@@ -216,15 +217,60 @@ DECLCALLBACK(int) VBoxServiceControlWorker(bool volatile *pfShutdown)
         if (rc == VERR_TOO_MUCH_DATA)
         {
 #ifdef DEBUG
-            VBoxServiceVerbose(4, "Message requires %ld parameters, but only 2 supplied -- retrying request (no error!)...\n", cParms);
+            VBoxServiceVerbose(4, "Message requires %ld parameters, but only 2 supplied -- retrying request (no error!)...\n",
+                               cParms);
 #endif
             rc = VINF_SUCCESS; /* Try to get "real" message in next block below. */
         }
         else if (RT_FAILURE(rc))
-            VBoxServiceVerbose(3, "Getting host message failed with %Rrc\n", rc); /* VERR_GEN_IO_FAILURE seems to be normal if ran into timeout. */
+        {
+            /* Note: VERR_GEN_IO_FAILURE seems to be normal if ran into timeout. */
+            VBoxServiceError("Getting host message failed with %Rrc\n", rc);
+
+            /* Check for VM session change. */
+            uint64_t idNewSession = g_idControlSession;
+            int rc2 = VbglR3GetSessionId(&idNewSession);
+            if (   RT_SUCCESS(rc2)
+                && (idNewSession != g_idControlSession))
+            {
+                VBoxServiceVerbose(1, "The VM session ID changed\n");
+                g_idControlSession = idNewSession;
+
+                /* Close all opened guest sessions -- all context IDs, sessions etc.
+                 * are now invalid. */
+                rc2 = GstCntlSessionClose(&g_Session);
+                AssertRC(rc2);
+
+                /* Do a reconnect. */
+                VBoxServiceVerbose(1, "Reconnecting to HGCM service ...\n");
+                rc2 = VbglR3GuestCtrlConnect(&g_uControlSvcClientID);
+                if (RT_SUCCESS(rc2))
+                {
+                    VBoxServiceVerbose(3, "Guest control service client ID=%RU32\n",
+                                       g_uControlSvcClientID);
+                    cRetrievalFailed = 0;
+                    continue; /* Skip waiting. */
+                }
+                else
+                {
+                    VBoxServiceError("Unable to re-connect to HGCM service, rc=%Rrc, bailing out\n", rc);
+                    break;
+                }
+            }
+
+            if (++cRetrievalFailed > 16) /** @todo Make this configurable? */
+            {
+                VBoxServiceError("Too many failed attempts in a row to get next message, bailing out\n");
+                break;
+            }
+
+            RTThreadSleep(1000); /* Wait a bit before retrying. */
+        }
+
         if (RT_SUCCESS(rc))
         {
             VBoxServiceVerbose(4, "Msg=%RU32 (%RU32 parms) retrieved\n", uMsg, cParms);
+            cRetrievalFailed = 0; /* Reset failed retrieval count. */
 
             /* Set number of parameters for current host context. */
             ctxHost.uNumParms = cParms;
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
index 3e0cc38..2c00c3a 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
+++ b/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
@@ -1500,6 +1500,8 @@ static int gstcntlProcessProcessWorker(PVBOXSERVICECTRLPROCESS pProcess)
     /*
      * Prepare environment variables list.
      */
+/** @todo r=bird: you don't need to prepare this, do you? Why don't you replace
+ * the brilliant RTStrAPrintf call with RTEnvPutEx and drop the papszEnv related code? */
     char **papszEnv = NULL;
     uint32_t uNumEnvVars = 0; /* Initialize in case of failing ... */
     if (RT_SUCCESS(rc))
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
index d96b13a..384c103 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
+++ b/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -141,6 +141,9 @@ static int gstcntlSessionHandleDirRemove(PVBOXSERVICECTRLSESSION pSession,
     {
         uint32_t uFlagsRemRec = 0;
         bool fRecursive = false;
+/** @todo r=bird: Unnecessary variable fRecursive.  You can check for
+ * DIRREMOVE_FLAG_RECURSIVE directly in the flags when deciding which API to
+ * call. */
 
         if (!(uFlags & ~DIRREMOVE_FLAG_VALID_MASK))
         {
@@ -150,7 +153,11 @@ static int gstcntlSessionHandleDirRemove(PVBOXSERVICECTRLSESSION pSession,
                  *       Play safe here. */
                 fRecursive = true;
             }
-
+/** @todo r=bird: Understand how APIs you use work (read docs, check constant,
+ * check code). If you check the actual values of RTDIRRMREC_F_CONTENT_AND_DIR
+ * and RTDIRRMREC_F_CONTENT_ONLY, you'd notice that the first one is 0 and the
+ * second is 1.  This code is a little confused about how it all works, though
+ * it ends up doing the right thing as if by accident almost. */
             if (uFlags & DIRREMOVE_FLAG_CONTENT_AND_DIR)
             {
                 /* Setting direct value is intentional. */
@@ -169,6 +176,8 @@ static int gstcntlSessionHandleDirRemove(PVBOXSERVICECTRLSESSION pSession,
         VBoxServiceVerbose(4, "[Dir %s]: Removing with uFlags=0x%x, fRecursive=%RTbool\n",
                            szDir, uFlags, fRecursive);
 
+/** @todo r=bird: Convoluted code flow. It would be shorter and easier to
+ * read if you moved this code up and into the flags-are-valid if body. */
         if (RT_SUCCESS(rc))
         {
             /** @todo Add own recursive function (or a new IPRT function w/ callback?) to
@@ -1258,9 +1267,16 @@ static DECLCALLBACK(int) gstcntlSessionThread(RTTHREAD ThreadSelf, void *pvUser)
 
         if (!fProcessAlive)
         {
-            VBoxServiceVerbose(2, "Guest session ID=%RU32 process terminated with rc=%Rrc, reason=%ld, status=%d\n",
+            VBoxServiceVerbose(2, "Guest session process (ID=%RU32) terminated with rc=%Rrc, reason=%ld, status=%d\n",
                                uSessionID, rcWait,
                                ProcessStatus.enmReason, ProcessStatus.iStatus);
+            if (ProcessStatus.iStatus == RTEXITCODE_INIT)
+            {
+                VBoxServiceError("Guest session process (ID=%RU32) failed to initialize. Here some hints:\n",
+                                 uSessionID);
+                VBoxServiceError("- Is logging enabled and the output directory is read-only by the guest session user?\n");
+                /** @todo Add more here. */
+            }
         }
     }
 
@@ -1763,9 +1779,11 @@ int GstCntlSessionProcessStartAllowed(const PVBOXSERVICECTRLSESSION pSession,
 
 
 /**
- * Creates a guest session. This will spawn a new VBoxService.exe instance under
- * behalf of the given user which then will act as a session host. On successful
- * open, the session will be added to the given session thread list.
+ * Creates a guest session.
+ *
+ * This will spawn a new VBoxService.exe instance under behalf of the given user
+ * which then will act as a session host. On successful open, the session will
+ * be added to the given session thread list.
  *
  * @return  IPRT status code.
  * @param   pList                   Which list to use to store the session thread in.
@@ -1816,7 +1834,7 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
 
         /* Is this an anonymous session? */
         /* Anonymous sessions run with the same privileges as the main VBoxService executable. */
-        bool fAnonymous = !RT_BOOL(strlen(pSessionThread->StartupInfo.szUser));
+        bool const fAnonymous = pSessionThread->StartupInfo.szUser[0] == '\0';
         if (fAnonymous)
         {
             Assert(!strlen(pSessionThread->StartupInfo.szPassword));
@@ -1845,11 +1863,43 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
         rc = RTCritSectInit(&pSessionThread->CritSect);
         AssertRC(rc);
 
-        /* Fork child doing the actual session handling. */
+        /*
+         * Spawn a child process for doing the actual session handling.
+         */
         char szExeName[RTPATH_MAX];
         char *pszExeName = RTProcGetExecutablePath(szExeName, sizeof(szExeName));
         if (pszExeName)
         {
+/** @todo r=bird: A while back we had this variant in the guest props code:
+ *  @code
+ *      int rc = RTStrPrintf(....);
+ *      if (RT_SUCCESS(rc))
+ *  @endcode
+ *
+ *  Here we've got a new variant:
+ *  @code
+ *      if (!RTStrPrintf(szBuf, sizeof(szBuf),...))
+ *         return VERR_BUFFER_OVERFLOW;
+ *  @endcode
+ *  ... which is just as pointless.
+ *
+ *  According to the doxygen docs in iprt/string.h, RTStrPrintf returns "The
+ *  length of the returned string (in pszBuffer) excluding the terminator".
+ *
+ *  Which admittedly makes it a real bitch to check for buffer overflows, but is
+ *  a great help preventing memory corruption by careless use of the returned
+ *  value if it was outside the buffer range (negative error codes or required
+ *  buffer size).  We should probably add a new string formatter which API which
+ *  returns VERR_BUFFER_OVERFLOW on overflow and optionally a required buffer
+ *  size that you can use here...
+ *
+ *  However in most cases you don't need to because you make things way to
+ *  complicated (see the log file name mangling for instance).
+ *
+ *  Here, you just need to format two or three (#ifdef DEBUG) 32-bit numbers
+ *  which are no brainers, while the szUser can be used as is.  The trick is to
+ *  pass the and option and the option value separately.
+ */
             char szParmUserName[GUESTPROCESS_MAX_USER_LEN + 32];
             if (!fAnonymous)
             {
@@ -1875,7 +1925,7 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
             {
                 rc = VERR_BUFFER_OVERFLOW;
             }
-#endif /* DEBUG */
+#endif
             if (RT_SUCCESS(rc))
             {
                 int iOptIdx = 0; /* Current index in argument vector. */
@@ -1887,7 +1937,7 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
                 papszArgs[iOptIdx++] = szParmSessionProto;
 #ifdef DEBUG
                 papszArgs[iOptIdx++] = szParmThreadId;
-#endif /* DEBUG */
+#endif
                 if (!fAnonymous)
                     papszArgs[iOptIdx++] = szParmUserName;
 
@@ -1914,20 +1964,21 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
                     char *pszLogFile = RTStrDup(g_szLogFile);
                     if (pszLogFile)
                     {
-                        char *pszLogExt = NULL;
-                        if (RTPathHasExt(pszLogFile))
-                            pszLogExt = RTStrDup(RTPathExt(pszLogFile));
-                        RTPathStripExt(pszLogFile);
-                        char *pszLogSuffix;
+                        char *pszLogSuff = NULL;
+                        if (RTPathHasSuffix(pszLogFile))
+                            pszLogSuff = RTStrDup(RTPathSuffix(pszLogFile));
+                        RTPathStripSuffix(pszLogFile);
+                        char *pszLogNewSuffix;
 #ifndef DEBUG
-                        if (RTStrAPrintf(&pszLogSuffix, "-%RU32-%s",
+                        if (RTStrAPrintf(&pszLogNewSuffix, "-%RU32-%s",
                                          pSessionStartupInfo->uSessionID,
                                          pSessionStartupInfo->szUser) < 0)
                         {
                             rc2 = VERR_NO_MEMORY;
                         }
-#else
-                        if (RTStrAPrintf(&pszLogSuffix, "-%RU32-%RU32-%s",
+#else /* DEBUG */
+                        /* Include the session thread ID in the log file name. */
+                        if (RTStrAPrintf(&pszLogNewSuffix, "-%RU32-%RU32-%s",
                                          pSessionStartupInfo->uSessionID,
                                          s_uCtrlSessionThread,
                                          pSessionStartupInfo->szUser) < 0)
@@ -1937,9 +1988,9 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
 #endif /* DEBUG */
                         else
                         {
-                            rc2 = RTStrAAppend(&pszLogFile, pszLogSuffix);
-                            if (RT_SUCCESS(rc2) && pszLogExt)
-                                rc2 = RTStrAAppend(&pszLogFile, pszLogExt);
+                            rc2 = RTStrAAppend(&pszLogFile, pszLogNewSuffix);
+                            if (RT_SUCCESS(rc2) && pszLogSuff)
+                                rc2 = RTStrAAppend(&pszLogFile, pszLogSuff);
                             if (RT_SUCCESS(rc2))
                             {
                                 if (!RTStrPrintf(szParmLogFile, sizeof(szParmLogFile),
@@ -1948,13 +1999,13 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
                                     rc2 = VERR_BUFFER_OVERFLOW;
                                 }
                             }
-                            RTStrFree(pszLogSuffix);
+                            RTStrFree(pszLogNewSuffix);
                         }
                         if (RT_FAILURE(rc2))
                             VBoxServiceError("Error building session logfile string for session %RU32 (user %s), rc=%Rrc\n",
                                              pSessionStartupInfo->uSessionID, pSessionStartupInfo->szUser, rc2);
-                        if (pszLogExt)
-                            RTStrFree(pszLogExt);
+                        if (pszLogSuff)
+                            RTStrFree(pszLogSuff);
                         RTStrFree(pszLogFile);
                     }
                     if (RT_SUCCESS(rc2))
@@ -1971,6 +2022,12 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
                 if (   RT_SUCCESS(rc)
                     && g_Session.uFlags & VBOXSERVICECTRLSESSION_FLAG_DUMPSTDOUT)
                 {
+/** @todo r=bird: This amazing code can be replaced by
+ *  @code
+ *    papszArgs[iOptIdx++] = "--dump-stdout";
+ *  @endcode
+ *  which doesn't even need braces.
+ */
                     if (!RTStrPrintf(szParmDumpStdOut, sizeof(szParmDumpStdOut), "--dump-stdout"))
                         rc = VERR_BUFFER_OVERFLOW;
                     if (RT_SUCCESS(rc))
@@ -2000,6 +2057,19 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
                 uint32_t uProcFlags = RTPROC_FLAGS_SERVICE
                                     | RTPROC_FLAGS_HIDDEN; /** @todo More flags from startup info? */
 
+                /*
+                 * Create the session process' environment block.
+                 */
+                RTENV hEnv = NIL_RTENV;
+                if (RT_SUCCESS(rc))
+                {
+                    /** @todo At the moment a session process does not have the ability to use the
+                     *        per-session environment variables itself, only the session's guest
+                     *        processes do so. Implement that later, also needs tweaking of
+                     *        VbglR3GuestCtrlSessionGetOpen(). */
+                    rc = RTEnvClone(&hEnv, RTENV_DEFAULT);
+                }
+
 #if 0 /* Pipe handling not needed (yet). */
                 /* Setup pipes. */
                 rc = GstcntlProcessSetupPipe("|", 0 /*STDIN_FILENO*/,
@@ -2027,15 +2097,11 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
                         }
 
                         if (RT_SUCCESS(rc))
-                        {
-                            /* Fork the thing. */
-                            /** @todo Do we need a custom environment block? */
-                            rc = RTProcCreateEx(pszExeName, papszArgs, RTENV_DEFAULT, uProcFlags,
+                            rc = RTProcCreateEx(pszExeName, papszArgs, hEnv, uProcFlags,
                                                 pSession->StdIn.phChild, pSession->StdOut.phChild, pSession->StdErr.phChild,
                                                 !fAnonymous ? pSession->StartupInfo.szUser : NULL,
                                                 !fAnonymous ? pSession->StartupInfo.szPassword : NULL,
                                                 &pSession->hProcess);
-                        }
 
                         if (RT_SUCCESS(rc))
                         {
@@ -2065,8 +2131,7 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
                     {
                         hStdOutAndErr.enmType = RTHANDLETYPE_FILE;
 
-                        /** @todo Set custom/cloned guest session environment block. */
-                        rc = RTProcCreateEx(pszExeName, papszArgs, RTENV_DEFAULT, uProcFlags,
+                        rc = RTProcCreateEx(pszExeName, papszArgs, hEnv, uProcFlags,
                                             &hStdIn, &hStdOutAndErr, &hStdOutAndErr,
                                             !fAnonymous ? pSessionThread->StartupInfo.szUser : NULL,
                                             !fAnonymous ? pSessionThread->StartupInfo.szPassword : NULL,
@@ -2078,6 +2143,8 @@ int GstCntlSessionThreadCreate(PRTLISTANCHOR pList,
                     RTFileClose(hStdIn.u.hFile);
                 }
 #endif
+                if (hEnv != NIL_RTENV)
+                    RTEnvDestroy(hEnv);
             }
         }
         else
@@ -2208,8 +2275,9 @@ int GstCntlSessionThreadDestroy(PVBOXSERVICECTRLSESSIONTHREAD pThread, uint32_t
 }
 
 /**
- * Close all formerly opened guest session threads.
- * Note: Caller is responsible for locking!
+ * Close all open guest session threads.
+ *
+ * @note    Caller is responsible for locking!
  *
  * @return  IPRT status code.
  * @param   pList                   Which list to close the session threads for.
@@ -2225,13 +2293,13 @@ int GstCntlSessionThreadDestroyAll(PRTLISTANCHOR pList, uint32_t uFlags)
         if (RT_FAILURE(rc))
             VBoxServiceError("Cancelling pending waits failed; rc=%Rrc\n", rc);*/
 
-    PVBOXSERVICECTRLSESSIONTHREAD pSessionThread
-         = RTListGetFirst(pList, VBOXSERVICECTRLSESSIONTHREAD, Node);
+/** @todo r=bird: Why don't you use RTListForEachSafe here?? */
+    PVBOXSERVICECTRLSESSIONTHREAD pSessionThread = RTListGetFirst(pList, VBOXSERVICECTRLSESSIONTHREAD, Node);
     while (pSessionThread)
     {
         PVBOXSERVICECTRLSESSIONTHREAD pSessionThreadNext =
             RTListGetNext(pList, pSessionThread, VBOXSERVICECTRLSESSIONTHREAD, Node);
-        bool fLast = RTListNodeIsLast(pList, &pSessionThread->Node);
+        bool fLast = RTListNodeIsLast(pList, &pSessionThread->Node); /** @todo r=bird: This isn't necessary, pSessionThreadNext will be NULL! */
 
         int rc2 = GstCntlSessionThreadDestroy(pSessionThread, uFlags);
         if (RT_FAILURE(rc2))
@@ -2251,6 +2319,9 @@ int GstCntlSessionThreadDestroyAll(PRTLISTANCHOR pList, uint32_t uFlags)
     return rc;
 }
 
+/** @todo r=bird: This isn't a fork in the tranditional unix sense, so please
+ * don't confuse any unix guys by using the term.
+ * GstCntlSessionChildMain would be a good name.  */
 RTEXITCODE VBoxServiceControlSessionForkInit(int argc, char **argv)
 {
     static const RTGETOPTDEF s_aOptions[] =
@@ -2282,19 +2353,18 @@ RTEXITCODE VBoxServiceControlSessionForkInit(int argc, char **argv)
     g_Session.StartupInfo.uProtocol  = UINT32_MAX;
     g_Session.StartupInfo.uSessionID = UINT32_MAX;
 
-    int rc = VINF_SUCCESS;
-
-    while (   (ch = RTGetOpt(&GetState, &ValueUnion))
-           && RT_SUCCESS(rc))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
             case VBOXSERVICESESSIONOPT_LOG_FILE:
-                if (!RTStrPrintf(g_szLogFile, sizeof(g_szLogFile), "%s", ValueUnion.psz))
-                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "Unable to set logfile name to '%s'",
-                                          ValueUnion.psz);
+            {
+                int rc = RTStrCopy(g_szLogFile, sizeof(g_szLogFile), ValueUnion.psz);
+                if (RT_FAILURE(rc))
+                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "Error copying log file name: %Rrc", rc);
                 break;
+            }
 #ifdef DEBUG
             case VBOXSERVICESESSIONOPT_DUMP_STDOUT:
                 uSessionFlags |= VBOXSERVICECTRLSESSION_FLAG_DUMPSTDOUT;
@@ -2305,7 +2375,7 @@ RTEXITCODE VBoxServiceControlSessionForkInit(int argc, char **argv)
                 break;
 #endif
             case VBOXSERVICESESSIONOPT_USERNAME:
-                /** @todo Information not needed right now, skip. */
+                /* Information not needed right now, skip. */
                 break;
 
             case VBOXSERVICESESSIONOPT_SESSION_ID:
@@ -2318,7 +2388,7 @@ RTEXITCODE VBoxServiceControlSessionForkInit(int argc, char **argv)
 
 #ifdef DEBUG
             case VBOXSERVICESESSIONOPT_THREAD_ID:
-                /* Not handled. */
+                /* Not handled. Mainly for processs listing. */
                 break;
 #endif
             /** @todo Implement help? */
@@ -2329,17 +2399,15 @@ RTEXITCODE VBoxServiceControlSessionForkInit(int argc, char **argv)
 
             case VINF_GETOPT_NOT_OPTION:
                 /* Ignore; might be "guestsession" main command. */
+                /** @todo r=bird: We DO NOT ignore stuff on the command line! */
                 break;
 
             default:
                 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown command '%s'", ValueUnion.psz);
-                break; /* Never reached. */
         }
     }
 
-    if (RT_FAILURE(rc))
-        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Initialization failed with rc=%Rrc", rc);
-
+    /* Check that we've got all the required options. */
     if (g_Session.StartupInfo.uProtocol == UINT32_MAX)
         return RTMsgErrorExit(RTEXITCODE_SYNTAX, "No protocol version specified");
 
@@ -2347,14 +2415,14 @@ RTEXITCODE VBoxServiceControlSessionForkInit(int argc, char **argv)
         return RTMsgErrorExit(RTEXITCODE_SYNTAX, "No session ID specified");
 
     /* Init the session object. */
-    rc = GstCntlSessionInit(&g_Session, uSessionFlags);
+    int rc = GstCntlSessionInit(&g_Session, uSessionFlags);
     if (RT_FAILURE(rc))
-        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize session object, rc=%Rrc\n", rc);
+        return RTMsgErrorExit(RTEXITCODE_INIT, "Failed to initialize session object, rc=%Rrc\n", rc);
 
-    rc = VBoxServiceLogCreate(strlen(g_szLogFile) ? g_szLogFile : NULL);
+    rc = VBoxServiceLogCreate(g_szLogFile[0] ? g_szLogFile : NULL);
     if (RT_FAILURE(rc))
-        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to create release log (%s, %Rrc)",
-                              strlen(g_szLogFile) ? g_szLogFile : "<None>", rc);
+        return RTMsgErrorExit(RTEXITCODE_INIT, "Failed to create log file \"%s\", rc=%Rrc\n",
+                              g_szLogFile[0] ? g_szLogFile : "<None>", rc);
 
     RTEXITCODE rcExit = gstcntlSessionForkWorker(&g_Session);
 
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp
index 6dbb74b..b8506f5 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp
+++ b/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp
@@ -1090,37 +1090,44 @@ static RTEXITCODE VBoxServiceToolboxRm(int argc, char **argv)
     {
         for (int i = argc - cNonOptions; i < argc; ++i)
         {
-            /* I'm sure this isn't the most effective way, but I hope it will
-             * be readable and reliable code. */
-            if (RTDirExists(argv[i]) && !RTSymlinkExists(argv[i]))
+            RTFSOBJINFO Info;
+            int rc2 = RTPathQueryInfoEx(argv[i], &Info, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK);
+            if (RT_SUCCESS(rc))
             {
-                if (!(fFlags & VBOXSERVICETOOLBOXRMFLAG_RECURSIVE))
-                    toolboxRmReport("Cannot remove directory '%s' as the '-R' option was not specified.\n",
-                                    argv[i], true, VERR_INVALID_PARAMETER,
-                                    fOutputFlags, &rc);
+                if (RTFS_IS_SYMLINK(Info.Attr.fMode))
+                {
+                    rc2 = RTSymlinkDelete(argv[i], 0 /*fFlags*/);
+                    toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2, fOutputFlags, NULL);
+                    toolboxRmReport("The following error occurred while removing symlink '%s': %Rrc.\n",
+                                    argv[i], RT_FAILURE(rc2), rc2, fOutputFlags, &rc);
+                }
+                else if (RTFS_IS_DIRECTORY(Info.Attr.fMode))
+                {
+                    if (!(fFlags & VBOXSERVICETOOLBOXRMFLAG_RECURSIVE))
+                        toolboxRmReport("Cannot remove directory '%s' as the '-R' option was not specified.\n",
+                                        argv[i], true, VERR_INVALID_PARAMETER, fOutputFlags, &rc);
+                    else
+                    {
+                        rc2 = RTDirRemoveRecursive(argv[i], RTDIRRMREC_F_CONTENT_AND_DIR);
+                        toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2, fOutputFlags, NULL);
+                        toolboxRmReport("The following error occurred while removing directory '%s': %Rrc.\n",
+                                        argv[i], RT_FAILURE(rc2), rc2, fOutputFlags, &rc);
+                    }
+                }
                 else
                 {
-                    int rc2 = RTDirRemoveRecursive(argv[i],
-                                                   RTDIRRMREC_F_CONTENT_AND_DIR);
-                    toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2,
-                                    fOutputFlags, NULL);
-                    toolboxRmReport("The following error occurred while removing directory '%s': %Rrc.\n",
-                                    argv[i], RT_FAILURE(rc2), rc2,
-                                    fOutputFlags, &rc);
+                    rc2 = RTFileDelete(argv[i]);
+                    toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2, fOutputFlags, NULL);
+                    toolboxRmReport("The following error occurred while removing file '%s': %Rrc.\n",
+                                    argv[i], RT_FAILURE(rc2), rc2, fOutputFlags, &rc);
                 }
             }
-            else if (RTPathExists(argv[i]) || RTSymlinkExists(argv[i]))
-            {
-                int rc2 = RTFileDelete(argv[i]);
-                toolboxRmReport("", argv[i], RT_SUCCESS(rc2), rc2,
-                                fOutputFlags, NULL);
-                toolboxRmReport("The following error occurred while removing file '%s': %Rrc.\n",
-                                argv[i], RT_FAILURE(rc2), rc2, fOutputFlags,
-                                &rc);
-            }
+            else if (   rc2 == VERR_FILE_NOT_FOUND
+                     || rc2 == VERR_PATH_NOT_FOUND)
+                toolboxRmReport("File '%s' does not exist (%Rrc).\n", argv[i], true, rc2, fOutputFlags, &rc);
             else
-                toolboxRmReport("File '%s' does not exist.\n", argv[i],
-                                true, VERR_FILE_NOT_FOUND, fOutputFlags, &rc);
+                toolboxRmReport("The following error occurred while checkin '%s' before removal: %Rrc.\n",
+                                argv[i], true, rc2, fOutputFlags, &rc);
         }
 
         if (fOutputFlags & VBOXSERVICETOOLBOXOUTPUTFLAG_PARSEABLE) /* Output termination. */
@@ -1519,6 +1526,7 @@ static RTEXITCODE VBoxServiceToolboxStat(int argc, char **argv)
     int rc = VINF_SUCCESS;
     bool fVerbose = false;
     uint32_t fOutputFlags = VBOXSERVICETOOLBOXOUTPUTFLAG_LONG; /* Use long mode by default. */
+    uint32_t fQueryInfoFlags = RTPATH_F_ON_LINK;
 
     /* Init file list. */
     RTLISTANCHOR fileList;
@@ -1531,11 +1539,15 @@ static RTEXITCODE VBoxServiceToolboxStat(int argc, char **argv)
         switch (ch)
         {
             case 'f':
-            case 'L':
                 RTMsgError("Sorry, option '%s' is not implemented yet!\n", ValueUnion.pDef->pszLong);
                 rc = VERR_INVALID_PARAMETER;
                 break;
 
+            case 'L':
+                fQueryInfoFlags &= ~RTPATH_F_ON_LINK;
+                fQueryInfoFlags |= RTPATH_F_FOLLOW_LINK;
+                break;
+
             case VBOXSERVICETOOLBOXOPT_MACHINE_READABLE:
                 fOutputFlags |= VBOXSERVICETOOLBOXOUTPUTFLAG_PARSEABLE;
                 break;
@@ -1555,6 +1567,11 @@ static RTEXITCODE VBoxServiceToolboxStat(int argc, char **argv)
 
             case VINF_GETOPT_NOT_OPTION:
                 {
+/** @todo r=bird: The whole fileList is unecessary because you're using
+ * RTGETOPTINIT_FLAGS_OPTS_FIRST.  You can obviously do the processing right
+ * here, but you could also just drop down and rewind GetState.iNext by one and
+ * continue there. */
+
                     /* Add file(s) to buffer. This enables processing multiple files
                      * at once.
                      *
@@ -1584,13 +1601,13 @@ static RTEXITCODE VBoxServiceToolboxStat(int argc, char **argv)
         RTListForEach(&fileList, pNodeIt, VBOXSERVICETOOLBOXPATHENTRY, Node)
         {
             RTFSOBJINFO objInfo;
-            int rc2 = RTPathQueryInfoEx(pNodeIt->pszName, &objInfo,
-                                        RTFSOBJATTRADD_UNIX, RTPATH_F_ON_LINK /* @todo Follow link? */);
+            int rc2 = RTPathQueryInfoEx(pNodeIt->pszName, &objInfo, RTFSOBJATTRADD_UNIX, fQueryInfoFlags);
             if (RT_FAILURE(rc2))
             {
+/** @todo r=bird: You can get a number of other errors here, like access denied. */
                 if (!(fOutputFlags & VBOXSERVICETOOLBOXOUTPUTFLAG_PARSEABLE))
-                    RTMsgError("Cannot stat for '%s': No such file or directory\n",
-                               pNodeIt->pszName);
+                    RTMsgError("Cannot stat for '%s': No such file or directory (%Rrc)\n",
+                               pNodeIt->pszName, rc);
                 rc = VERR_FILE_NOT_FOUND;
                 /* Do not break here -- process every element in the list
                  * and keep failing rc. */
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
index fae5f14..b0dbc2d 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
+++ b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
@@ -1267,16 +1267,10 @@ int VBoxServiceWinGetComponentVersions(uint32_t uClientID)
         { szSysDir, "VBoxTray.exe" },
         { szSysDir, "VBoxGINA.dll" },
         { szSysDir, "VBoxCredProv.dll" },
-# ifdef VBOX_WITH_MMR
-        { szSysDir, "VBoxMMR.exe" },
-# endif /* VBOX_WITH_MMR */
 
  /* On 64-bit we don't yet have the OpenGL DLLs in native format.
     So just enumerate the 32-bit files in the SYSWOW directory. */
 # ifdef RT_ARCH_AMD64
-#  ifdef VBOX_WITH_MMR
-        { szSysWowDir, "VBoxMMRHook.dll" },
-#  endif /* VBOX_WITH_MMR */
         { szSysWowDir, "VBoxOGLarrayspu.dll" },
         { szSysWowDir, "VBoxOGLcrutil.dll" },
         { szSysWowDir, "VBoxOGLerrorspu.dll" },
@@ -1285,9 +1279,6 @@ int VBoxServiceWinGetComponentVersions(uint32_t uClientID)
         { szSysWowDir, "VBoxOGLfeedbackspu.dll" },
         { szSysWowDir, "VBoxOGL.dll" },
 # else  /* !RT_ARCH_AMD64 */
-#  ifdef VBOX_WITH_MMR
-        { szSysDir, "VBoxMMRHook.dll" },
-#  endif /* VBOX_WITH_MMR */
         { szSysDir, "VBoxOGLarrayspu.dll" },
         { szSysDir, "VBoxOGLcrutil.dll" },
         { szSysDir, "VBoxOGLerrorspu.dll" },
diff --git a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
index 5f6894a..f49043f 100644
--- a/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
+++ b/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
@@ -43,6 +43,9 @@
 # if !defined(RT_OS_OS2) && !defined(RT_OS_FREEBSD) && !defined(RT_OS_HAIKU)
 #  include <utmpx.h> /* @todo FreeBSD 9 should have this. */
 # endif
+# ifdef RT_OS_OS2
+#  include <net/if_dl.h>
+# endif
 # ifdef RT_OS_SOLARIS
 #  include <sys/sockio.h>
 #  include <net/if_arp.h>
@@ -545,7 +548,7 @@ static int vboxserviceVMInfoWriteUsers(void)
 
     /* Allocate a first array to hold 32 users max. */
     char **papszUsers = (char **)RTMemAllocZ(cListSize * sizeof(char *));
-    if (papszUsers == NULL)
+    if (!papszUsers)
         rc = VERR_NO_MEMORY;
 
     /* Process all entries in the utmp file.
@@ -564,7 +567,7 @@ static int vboxserviceVMInfoWriteUsers(void)
         {
             cListSize += 32;
             void *pvNew = RTMemRealloc(papszUsers, cListSize * sizeof(char*));
-            AssertPtrBreakStmt(pvNew, cListSize -= 32);
+            AssertBreakStmt(pvNew, cListSize -= 32);
             papszUsers = (char **)pvNew;
         }
 
@@ -897,9 +900,9 @@ static int vboxserviceVMInfoWriteUsers(void)
  */
 static int vboxserviceVMInfoWriteNetwork(void)
 {
-    int rc = VINF_SUCCESS;
-    uint32_t  cIfacesReport = 0;
-    char szPropPath[256];
+    int         rc = VINF_SUCCESS;
+    uint32_t    cIfsReported = 0;
+    char        szPropPath[256];
 
 #ifdef RT_OS_WINDOWS
     IP_ADAPTER_INFO *pAdpInfo = NULL;
@@ -989,18 +992,18 @@ static int vboxserviceVMInfoWriteNetwork(void)
         Assert(pAddress);
         char szIp[32];
         RTStrPrintf(szIp, sizeof(szIp), "%s", inet_ntoa(pAddress->sin_addr));
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/IP", cIfacesReport);
+        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/IP", cIfsReported);
         VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szIp);
 
         pAddress = (sockaddr_in *) & (InterfaceList[i].iiBroadcastAddress);
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Broadcast", cIfacesReport);
+        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Broadcast", cIfsReported);
         VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
 
         pAddress = (sockaddr_in *)&(InterfaceList[i].iiNetmask);
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Netmask", cIfacesReport);
+        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Netmask", cIfsReported);
         VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
 
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/Status", cIfacesReport);
+        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/Status", cIfsReported);
         VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, nFlags & IFF_UP ? "Up" : "Down");
 
 # ifndef TARGET_NT4
@@ -1009,7 +1012,7 @@ static int vboxserviceVMInfoWriteNetwork(void)
             if (!strcmp(pAdp->IpAddressList.IpAddress.String, szIp))
                 break;
 
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/MAC", cIfacesReport);
+        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/MAC", cIfsReported);
         if (pAdp)
         {
             char szMac[32];
@@ -1022,7 +1025,7 @@ static int vboxserviceVMInfoWriteNetwork(void)
             VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, NULL);
 # endif /* !TARGET_NT4 */
 
-        cIfacesReport++;
+        cIfsReported++;
     }
     if (pAdpInfo)
         RTMemFree(pAdpInfo);
@@ -1050,8 +1053,8 @@ static int vboxserviceVMInfoWriteNetwork(void)
     {
         /*
          * Only AF_INET and no loopback interfaces
-         * @todo: IPv6 interfaces
          */
+        /** @todo: IPv6 interfaces */
         if (   pIfCurr->ifa_addr->sa_family == AF_INET
             && !(pIfCurr->ifa_flags & IFF_LOOPBACK))
         {
@@ -1060,19 +1063,19 @@ static int vboxserviceVMInfoWriteNetwork(void)
             memset(szInetAddr, 0, NI_MAXHOST);
             getnameinfo(pIfCurr->ifa_addr, sizeof(struct sockaddr_in),
                         szInetAddr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
-            RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/IP", cIfacesReport);
+            RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/IP", cIfsReported);
             VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szInetAddr);
 
             memset(szInetAddr, 0, NI_MAXHOST);
             getnameinfo(pIfCurr->ifa_broadaddr, sizeof(struct sockaddr_in),
                         szInetAddr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
-            RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Broadcast", cIfacesReport);
+            RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Broadcast", cIfsReported);
             VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szInetAddr);
 
             memset(szInetAddr, 0, NI_MAXHOST);
             getnameinfo(pIfCurr->ifa_netmask, sizeof(struct sockaddr_in),
                         szInetAddr, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
-            RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Netmask", cIfacesReport);
+            RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Netmask", cIfsReported);
             VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szInetAddr);
 
             /* Search for the AF_LINK interface of the current AF_INET one and get the mac. */
@@ -1089,16 +1092,16 @@ static int vboxserviceVMInfoWriteNetwork(void)
                     pu8Mac = (uint8_t *)LLADDR(pLinkAddress);
                     RTStrPrintf(szMac, sizeof(szMac), "%02X%02X%02X%02X%02X%02X",
                                 pu8Mac[0], pu8Mac[1], pu8Mac[2], pu8Mac[3],  pu8Mac[4], pu8Mac[5]);
-                    RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/MAC", cIfacesReport);
+                    RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/MAC", cIfsReported);
                     VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szMac);
                     break;
                 }
             }
 
-            RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/Status", cIfacesReport);
+            RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/Status", cIfsReported);
             VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, pIfCurr->ifa_flags & IFF_UP ? "Up" : "Down");
 
-            cIfacesReport++;
+            cIfsReported++;
         }
     }
 
@@ -1106,6 +1109,12 @@ static int vboxserviceVMInfoWriteNetwork(void)
     freeifaddrs(pIfHead);
 
 #else /* !RT_OS_WINDOWS && !RT_OS_FREEBSD */
+    /*
+     * Use SIOCGIFCONF to get a list of interface/protocol configurations.
+     *
+     * See "UNIX Network Programming Volume 1" by W. R. Stevens, section 17.6
+     * for details on this ioctl.
+     */
     int sd = socket(AF_INET, SOCK_DGRAM, 0);
     if (sd < 0)
     {
@@ -1114,130 +1123,224 @@ static int vboxserviceVMInfoWriteNetwork(void)
         return rc;
     }
 
-    ifconf ifcfg;
-    char buffer[1024] = {0};
-    ifcfg.ifc_len = sizeof(buffer);
-    ifcfg.ifc_buf = buffer;
-    if (ioctl(sd, SIOCGIFCONF, &ifcfg) < 0)
-    {
-        close(sd);
-        rc = RTErrConvertFromErrno(errno);
-        VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFCONF) on socket: Error %Rrc\n", rc);
-        return rc;
-    }
-
-    ifreq* ifrequest = ifcfg.ifc_req;
-    int cIfacesSystem = ifcfg.ifc_len / sizeof(ifreq);
-
-    for (int i = 0; i < cIfacesSystem; ++i)
+    /* Call SIOCGIFCONF with the right sized buffer (remember the size). */
+    static int      s_cbBuf = 256; // 1024
+    int             cbBuf   = s_cbBuf;
+    char           *pchBuf;
+    struct ifconf   IfConf;
+    rc = VINF_SUCCESS;
+    for (;;)
     {
-        sockaddr_in *pAddress;
-        if (ioctl(sd, SIOCGIFFLAGS, &ifrequest[i]) < 0)
+        pchBuf = (char *)RTMemTmpAllocZ(cbBuf);
+        if (!pchBuf)
         {
-            rc = RTErrConvertFromErrno(errno);
-            VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFFLAGS) on socket: Error %Rrc\n", rc);
+            rc = VERR_NO_TMP_MEMORY;
             break;
         }
-        if (ifrequest[i].ifr_flags & IFF_LOOPBACK) /* Skip the loopback device. */
-            continue;
-
-        bool fIfUp = !!(ifrequest[i].ifr_flags & IFF_UP);
-        pAddress = ((sockaddr_in *)&ifrequest[i].ifr_addr);
-        Assert(pAddress);
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/IP", cIfacesReport);
-        VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
 
-        if (ioctl(sd, SIOCGIFBRDADDR, &ifrequest[i]) < 0)
+        IfConf.ifc_len = cbBuf;
+        IfConf.ifc_buf = pchBuf;
+        if (ioctl(sd, SIOCGIFCONF, &IfConf) >= 0)
+        {
+            /* Hard to anticipate how space an address might possibly take, so
+               making some generous assumptions here to avoid performing the
+               query twice with different buffer sizes. */
+            if (IfConf.ifc_len + 128 < cbBuf)
+                break;
+        }
+        else if (errno != EOVERFLOW)
         {
             rc = RTErrConvertFromErrno(errno);
-            VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFBRDADDR) on socket: Error %Rrc\n", rc);
             break;
         }
-        pAddress = (sockaddr_in *)&ifrequest[i].ifr_broadaddr;
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Broadcast", cIfacesReport);
-        VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
 
-        if (ioctl(sd, SIOCGIFNETMASK, &ifrequest[i]) < 0)
+        /* grow the buffer */
+        s_cbBuf = cbBuf *= 2;
+        RTMemFree(pchBuf);
+    }
+    if (RT_FAILURE(rc))
+    {
+        close(sd);
+        RTMemTmpFree(pchBuf);
+        VBoxServiceError("VMInfo/Network: Error doing SIOCGIFCONF (cbBuf=%d): %Rrc\n", cbBuf, rc);
+        return rc;
+    }
+
+    /*
+     * Iterate the interface/protocol configurations.
+     *
+     * Note! The current code naively assumes one IPv4 address per interface.
+     *       This means that guest assigning more than one address to an
+     *       interface will get multiple entries for one physical interface.
+     */
+# ifdef RT_OS_OS2
+    struct ifreq   *pPrevLinkAddr = NULL;
+# endif
+    struct ifreq   *pCur   = IfConf.ifc_req;
+    size_t          cbLeft = IfConf.ifc_len;
+    while (cbLeft >= sizeof(*pCur))
+    {
+# if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX)
+        /* These two do not provide the sa_len member but only support address
+         * families which do not need extra bytes on the end. */
+#  define SA_LEN(pAddr) sizeof(struct sockaddr)
+# elif !defined(SA_LEN)
+#  define SA_LEN(pAddr) (pAddr)->sa_len
+# endif
+        /* Figure the size of the current request. */
+        size_t cbCur = RT_OFFSETOF(struct ifreq, ifr_addr)
+                     + SA_LEN(&pCur->ifr_addr);
+        cbCur = RT_MAX(cbCur, sizeof(struct ifreq));
+# if defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX)
+        Assert(pCur->ifr_addr.sa_family == AF_INET);
+# endif
+        AssertBreak(cbCur <= cbLeft);
+
+# ifdef RT_OS_OS2
+        /* On OS/2 we get the MAC address in the AF_LINK that the BSD 4.4 stack
+           emits.  We boldly ASSUME these always comes first. */
+        if (   pCur->ifr_addr.sa_family == AF_LINK
+            && ((struct sockaddr_dl *)&pCur->ifr_addr)->sdl_alen == 6)
+            pPrevLinkAddr = pCur;
+# endif
+
+        /* Skip it if it's not the kind of address we're looking for. */
+        struct ifreq IfReqTmp;
+        bool         fIfUp = false;
+        bool         fSkip = false;
+        if (pCur->ifr_addr.sa_family != AF_INET)
+            fSkip = true;
+        else
         {
-            rc = RTErrConvertFromErrno(errno);
-            VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFNETMASK) on socket: Error %Rrc\n", rc);
-            break;
+            /* Get the interface flags so we can detect loopback and check if it's up. */
+            IfReqTmp = *pCur;
+            if (ioctl(sd, SIOCGIFFLAGS, &IfReqTmp) < 0)
+            {
+                rc = RTErrConvertFromErrno(errno);
+                VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFFLAGS,%s) on socket: Error %Rrc\n", pCur->ifr_name, rc);
+                break;
+            }
+            fIfUp = !!(IfReqTmp.ifr_flags & IFF_UP);
+            if (IfReqTmp.ifr_flags & IFF_LOOPBACK) /* Skip the loopback device. */
+                fSkip = true;
         }
+        if (!fSkip)
+        {
+            size_t offSubProp = RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32", cIfsReported);
+
+            sockaddr_in *pAddress = (sockaddr_in *)&pCur->ifr_addr;
+            strcpy(&szPropPath[offSubProp], "/V4/IP");
+            VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
+
+            /* Get the broadcast address. */
+            IfReqTmp = *pCur;
+            if (ioctl(sd, SIOCGIFBRDADDR, &IfReqTmp) < 0)
+            {
+                rc = RTErrConvertFromErrno(errno);
+                VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFBRDADDR) on socket: Error %Rrc\n", rc);
+                break;
+            }
+            pAddress = (sockaddr_in *)&IfReqTmp.ifr_broadaddr;
+            strcpy(&szPropPath[offSubProp], "/V4/Broadcast");
+            VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
+
+            /* Get the net mask. */
+            IfReqTmp = *pCur;
+            if (ioctl(sd, SIOCGIFNETMASK, &IfReqTmp) < 0)
+            {
+                rc = RTErrConvertFromErrno(errno);
+                VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFNETMASK) on socket: Error %Rrc\n", rc);
+                break;
+            }
 # if defined(RT_OS_OS2) || defined(RT_OS_SOLARIS)
-        pAddress = (sockaddr_in *)&ifrequest[i].ifr_addr;
+            pAddress = (sockaddr_in *)&IfReqTmp.ifr_addr;
 # else
-        pAddress = (sockaddr_in *)&ifrequest[i].ifr_netmask;
+            pAddress = (sockaddr_in *)&IfReqTmp.ifr_netmask;
 # endif
-
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/V4/Netmask", cIfacesReport);
-        VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
+            strcpy(&szPropPath[offSubProp], "/V4/Netmask");
+            VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", inet_ntoa(pAddress->sin_addr));
 
 # if defined(RT_OS_SOLARIS)
-        /*
-         * "ifreq" is obsolete on Solaris. We use the recommended "lifreq".
-         * We might fail if the interface has not been assigned an IP address.
-         * That doesn't matter; as long as it's plumbed we can pick it up.
-         * But, if it has not acquired an IP address we cannot obtain it's MAC
-         * address this way, so we just use all zeros there.
-         */
-        RTMAC IfMac;
-        RT_ZERO(IfMac);
-        struct lifreq IfReq;
-        RT_ZERO(IfReq);
-        AssertCompile(sizeof(IfReq.lifr_name) >= sizeof(ifrequest[i].ifr_name));
-        strncpy(IfReq.lifr_name, ifrequest[i].ifr_name, sizeof(ifrequest[i].ifr_name));
-        if (ioctl(sd, SIOCGLIFADDR, &IfReq) >= 0)
-        {
-            struct arpreq ArpReq;
-            RT_ZERO(ArpReq);
-            memcpy(&ArpReq.arp_pa, &IfReq.lifr_addr, sizeof(struct sockaddr_in));
+            /*
+             * "ifreq" is obsolete on Solaris. We use the recommended "lifreq".
+             * We might fail if the interface has not been assigned an IP address.
+             * That doesn't matter; as long as it's plumbed we can pick it up.
+             * But, if it has not acquired an IP address we cannot obtain it's MAC
+             * address this way, so we just use all zeros there.
+             */
+            RTMAC           IfMac;
+            struct lifreq   IfReq;
+            RT_ZERO(IfReq);
+            AssertCompile(sizeof(IfReq.lifr_name) >= sizeof(pCur->ifr_name));
+            strncpy(IfReq.lifr_name, pCur->ifr_name, sizeof(pCur->ifr_name));
+            if (ioctl(sd, SIOCGLIFADDR, &IfReq) >= 0)
+            {
+                struct arpreq ArpReq;
+                RT_ZERO(ArpReq);
+                memcpy(&ArpReq.arp_pa, &IfReq.lifr_addr, sizeof(struct sockaddr_in));
 
-            if (ioctl(sd, SIOCGARP, &ArpReq) >= 0)
-                memcpy(&IfMac, ArpReq.arp_ha.sa_data, sizeof(IfMac));
+                if (ioctl(sd, SIOCGARP, &ArpReq) >= 0)
+                    memcpy(&IfMac, ArpReq.arp_ha.sa_data, sizeof(IfMac));
+                else
+                {
+                    rc = RTErrConvertFromErrno(errno);
+                    VBoxServiceError("VMInfo/Network: failed to ioctl(SIOCGARP) on socket: Error %Rrc\n", rc);
+                    break;
+                }
+            }
+            else
+            {
+                VBoxServiceVerbose(2, "VMInfo/Network: Interface \"%s\" has no assigned IP address, skipping ...\n", pCur->ifr_name);
+                continue;
+            }
+# elif defined(RT_OS_OS2)
+            RTMAC   IfMac;
+            if (   pPrevLinkAddr
+                && strncmp(pCur->ifr_name, pPrevLinkAddr->ifr_name, sizeof(pCur->ifr_name)) == 0)
+            {
+                struct sockaddr_dl *pDlAddr = (struct sockaddr_dl *)&pPrevLinkAddr->ifr_addr;
+                IfMac = *(PRTMAC)&pDlAddr->sdl_data[pDlAddr->sdl_nlen];
+            }
             else
+                RT_ZERO(IfMac);
+#else
+            if (ioctl(sd, SIOCGIFHWADDR, &IfReqTmp) < 0)
             {
                 rc = RTErrConvertFromErrno(errno);
-                VBoxServiceError("VMInfo/Network: failed to ioctl(SIOCGARP) on socket: Error %Rrc\n", rc);
+                VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFHWADDR) on socket: Error %Rrc\n", rc);
                 break;
             }
-        }
-        else
-        {
-            VBoxServiceVerbose(2, "VMInfo/Network: Interface %d has no assigned IP address, skipping ...\n", i);
-            continue;
-        }
-# else
-#  ifndef RT_OS_OS2 /** @todo port this to OS/2 */
-        if (ioctl(sd, SIOCGIFHWADDR, &ifrequest[i]) < 0)
-        {
-            rc = RTErrConvertFromErrno(errno);
-            VBoxServiceError("VMInfo/Network: Failed to ioctl(SIOCGIFHWADDR) on socket: Error %Rrc\n", rc);
-            break;
-        }
-#  endif
+            RTMAC IfMac = *(PRTMAC)&IfReqTmp.ifr_hwaddr.sa_data[0];
 # endif
+            strcpy(&szPropPath[offSubProp], "/MAC");
+            VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%02X%02X%02X%02X%02X%02X",
+                                       IfMac.au8[0], IfMac.au8[1], IfMac.au8[2], IfMac.au8[3], IfMac.au8[4], IfMac.au8[5]);
+
+            strcpy(&szPropPath[offSubProp], "/Status");
+            VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, fIfUp ? "Up" : "Down");
+
+            /* The name. */
+            int rc2 = RTStrValidateEncodingEx(pCur->ifr_name, sizeof(pCur->ifr_name), 0);
+            if (RT_SUCCESS(rc2))
+            {
+                strcpy(&szPropPath[offSubProp], "/Name");
+                VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%.*s", sizeof(pCur->ifr_name), pCur->ifr_name);
+            }
 
-# ifndef RT_OS_OS2 /** @todo port this to OS/2 */
-        char szMac[32];
-#  if defined(RT_OS_SOLARIS)
-        uint8_t *pu8Mac = IfMac.au8;
-#  else
-        uint8_t *pu8Mac = (uint8_t*)&ifrequest[i].ifr_hwaddr.sa_data[0];        /* @todo see above */
-#  endif
-        RTStrPrintf(szMac, sizeof(szMac), "%02X%02X%02X%02X%02X%02X",
-                    pu8Mac[0], pu8Mac[1], pu8Mac[2], pu8Mac[3],  pu8Mac[4], pu8Mac[5]);
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/MAC", cIfacesReport);
-        VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, "%s", szMac);
-# endif /* !OS/2*/
-
-        RTStrPrintf(szPropPath, sizeof(szPropPath), "/VirtualBox/GuestInfo/Net/%RU32/Status", cIfacesReport);
-        VBoxServicePropCacheUpdate(&g_VMInfoPropCache, szPropPath, fIfUp ? "Up" : "Down");
-        cIfacesReport++;
-    } /* For all interfaces */
+            cIfsReported++;
+        }
+
+        /*
+         * Next interface/protocol configuration.
+         */
+        pCur = (struct ifreq *)((uintptr_t)pCur + cbCur);
+        cbLeft -= cbCur;
+    }
 
+    RTMemTmpFree(pchBuf);
     close(sd);
     if (RT_FAILURE(rc))
-        VBoxServiceError("VMInfo/Network: Network enumeration for interface %RU32 failed with error %Rrc\n", cIfacesReport, rc);
+        VBoxServiceError("VMInfo/Network: Network enumeration for interface %RU32 failed with error %Rrc\n", cIfsReported, rc);
 
 #endif /* !RT_OS_WINDOWS */
 
@@ -1248,16 +1351,16 @@ static int vboxserviceVMInfoWriteNetwork(void)
      */
 
     /* Get former count. */
-    uint32_t cIfacesReportOld;
-    rc = VBoxServiceReadPropUInt32(g_uVMInfoGuestPropSvcClientID, g_pszPropCacheValNetCount, &cIfacesReportOld,
+    uint32_t cIfsReportedOld;
+    rc = VBoxServiceReadPropUInt32(g_uVMInfoGuestPropSvcClientID, g_pszPropCacheValNetCount, &cIfsReportedOld,
                                    0 /* Min */, UINT32_MAX /* Max */);
     if (   RT_SUCCESS(rc)
-        && cIfacesReportOld > cIfacesReport) /* Are some ifaces not around anymore? */
+        && cIfsReportedOld > cIfsReported) /* Are some ifaces not around anymore? */
     {
         VBoxServiceVerbose(3, "VMInfo/Network: Stale interface data detected (%RU32 old vs. %RU32 current)\n",
-                           cIfacesReportOld, cIfacesReport);
+                           cIfsReportedOld, cIfsReported);
 
-        uint32_t uIfaceDeleteIdx = cIfacesReport;
+        uint32_t uIfaceDeleteIdx = cIfsReported;
         do
         {
             VBoxServiceVerbose(3, "VMInfo/Network: Deleting stale data of interface %d ...\n", uIfaceDeleteIdx);
@@ -1277,7 +1380,7 @@ static int vboxserviceVMInfoWriteNetwork(void)
      * properties are no longer valid.
      */
     VBoxServicePropCacheUpdate(&g_VMInfoPropCache, g_pszPropCacheValNetCount, "%RU32",
-                               cIfacesReport);
+                               cIfsReported);
 
     /* Don't fail here; just report everything we got. */
     return VINF_SUCCESS;
diff --git a/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp b/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
index 776fba9..c44e0da 100644
--- a/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
+++ b/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
@@ -334,18 +334,17 @@ RTDECL(void) VBoxHGSMIGetBaseMappingInfo(uint32_t cbVRAM,
 RTDECL(int) VBoxHGSMISetupGuestContext(PHGSMIGUESTCOMMANDCONTEXT pCtx,
                                        void *pvGuestHeapMemory,
                                        uint32_t cbGuestHeapMemory,
-                                       uint32_t offVRAMGuestHeapMemory)
+                                       uint32_t offVRAMGuestHeapMemory,
+                                       const HGSMIENV *pEnv)
 {
     /** @todo should we be using a fixed ISA port value here? */
     pCtx->port = (RTIOPORT)VGA_PORT_HGSMI_GUEST;
 #ifdef VBOX_WDDM_MINIPORT
     return VBoxSHGSMIInit(&pCtx->heapCtx, pvGuestHeapMemory,
-                          cbGuestHeapMemory, offVRAMGuestHeapMemory,
-                          false /*fOffsetBased*/);
+                          cbGuestHeapMemory, offVRAMGuestHeapMemory, pEnv);
 #else
     return HGSMIHeapSetup(&pCtx->heapCtx, pvGuestHeapMemory,
-                          cbGuestHeapMemory, offVRAMGuestHeapMemory,
-                          false /*fOffsetBased*/);
+                          cbGuestHeapMemory, offVRAMGuestHeapMemory, pEnv);
 #endif
 }
 
diff --git a/src/VBox/Additions/common/crOpenGL/Makefile.kmk b/src/VBox/Additions/common/crOpenGL/Makefile.kmk
index 1827856..d1b2264 100644
--- a/src/VBox/Additions/common/crOpenGL/Makefile.kmk
+++ b/src/VBox/Additions/common/crOpenGL/Makefile.kmk
@@ -24,15 +24,8 @@ include $(KBUILD_PATH)/subheader.kmk
 BLDDIRS += \
 	$(VBOX_PATH_CROGL_GENFILES)/
 
-DLLS.win += \
-    VBoxOGL \
-    VBoxOGLarrayspu \
-    VBoxOGLpassthroughspu \
-    VBoxOGLpackspu \
-    VBoxOGLfeedbackspu
-
-if1of ($(KBUILD_TARGET), linux solaris freebsd)
-DLLS += \
+if1of ($(KBUILD_TARGET), win linux solaris freebsd)
+ DLLS += \
     VBoxOGL \
     VBoxOGLarrayspu \
     VBoxOGLpassthroughspu \
@@ -213,6 +206,11 @@ VBoxOGL_LIBS = \
 	$(VBOX_LIB_VBGL_R3_SHARED) \
 	$(VBOX_LIB_OGL_CRUTIL) \
 	$(PATH_STAGE_LIB)/additions/VBoxOGLspuload$(VBOX_SUFF_LIB)
+
+VBoxOGL_LIBS.win += \
+	$(PATH_STAGE_LIB)/additions/VBoxDispMpLogger$(VBOX_SUFF_LIB) \
+	$(PATH_STAGE_LIB)/additions/VBoxCrHgsmi$(VBOX_SUFF_LIB)
+
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGL_LIBS += \
  	$(PATH_STAGE_LIB)/libXcomposite.so \
@@ -248,6 +246,12 @@ VBoxOGL-x86_LIBS = $(VBOX_LIB_IPRT_GUEST_R3_SHARED_X86) \
 	$(VBOX_LIB_VBGL_R3_SHARED_X86) \
 	$(VBOX_LIB_OGL_CRUTIL_X86) \
 	$(PATH_STAGE_LIB)/additions/VBoxOGLspuload-x86$(VBOX_SUFF_LIB)
+
+VBoxOGL-x86_LIBS.win += \
+	$(PATH_STAGE_LIB)/additions/VBoxDispMpLogger-x86$(VBOX_SUFF_LIB) \
+	$(PATH_STAGE_LIB)/additions/VBoxCrHgsmi-x86$(VBOX_SUFF_LIB)
+
+
 VBoxOGL-x86_SOURCES.win = $(subst cropengl.def,cropengl-x86.def,$(VBoxOGL_SOURCES.win))
 VBoxOGL-x86_CLEAN.win = $(subst cropengl.def,cropengl-x86.def,$(VBoxOGL_CLEAN.win))
 VBoxOGL-x86_DEFS = $(VBoxOGL_DEFS) VBOX_WDDM_WOW64
diff --git a/src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc b/src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc
index fe7f561..2f00b00 100644
--- a/src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc
+++ b/src/VBox/Additions/common/crOpenGL/VBoxCROGL.rc
@@ -21,30 +21,32 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x3L
-   FILESUBTYPE          0x4L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DRV
+   FILESUBTYPE      VFT2_DRV_DISPLAY
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxCROGL\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOX_WDDM_WOW64
          VALUE "OriginalFilename", "VBoxCROGL-x86.dll\0"
 #else
          VALUE "OriginalFilename", "VBoxCROGL.dll\0"
 #endif
-         VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Additions/common/crOpenGL/array/arrayspu.rc b/src/VBox/Additions/common/crOpenGL/array/arrayspu.rc
index 2d3b993..83f4f3e 100644
--- a/src/VBox/Additions/common/crOpenGL/array/arrayspu.rc
+++ b/src/VBox/Additions/common/crOpenGL/array/arrayspu.rc
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2010 Oracle Corporation
+ * Copyright (C) 2009-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -21,30 +21,31 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x3L
-   FILESUBTYPE          0x4L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DRV
+   FILESUBTYPE      VFT2_DRV_DISPLAY
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxOGLarrayspu\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOX_WDDM_WOW64
          VALUE "OriginalFilename", "VBoxOGLarrayspu-x86.dll\0"
 #else
          VALUE "OriginalFilename", "VBoxOGLarrayspu.dll\0"
 #endif
-         VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Additions/common/crOpenGL/context.c b/src/VBox/Additions/common/crOpenGL/context.c
index fc8962c..ef46107 100644
--- a/src/VBox/Additions/common/crOpenGL/context.c
+++ b/src/VBox/Additions/common/crOpenGL/context.c
@@ -476,8 +476,7 @@ static DECLCALLBACK(void) stubContextDtor(void*pvContext)
  * CreateContext() function too.
  */
     ContextInfo *
-stubNewContext( const char *dpyName, GLint visBits, ContextType type,
-    unsigned long shareCtx
+stubNewContext(char *dpyName, GLint visBits, ContextType type, unsigned long shareCtx
 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
         , struct VBOXUHGSMI *pHgsmi
 #endif
@@ -691,7 +690,7 @@ InstantiateNativeContext( WindowInfo *window, ContextInfo *context )
 #ifdef WINDOWS
 
 void
-stubGetWindowGeometry(const WindowInfo *window, int *x, int *y,
+stubGetWindowGeometry(WindowInfo *window, int *x, int *y,
                       unsigned int *w, unsigned int *h )
 {
     RECT rect;
@@ -1130,7 +1129,7 @@ GLboolean stubCtxCreate(ContextInfo *context)
         spuConnection = stub.spu->dispatch_table.VBoxConCreate(context->pHgsmi);
         if (!spuConnection)
         {
-            crWarning("VBoxConCreate failed");
+            crError("VBoxConCreate failed");
             return GL_FALSE;
         }
         context->spuConnection = spuConnection;
@@ -1392,10 +1391,10 @@ stubDestroyContext( unsigned long contextId )
     crHashtableLock(stub.contextTable);
 
     context = (ContextInfo *) crHashtableSearch(stub.contextTable, contextId);
-
-    CRASSERT(context);
-
-    stubDestroyContextLocked(context);
+    if (context)
+        stubDestroyContextLocked(context);
+    else
+        crError("No context.");
 
 #ifdef CHROMIUM_THREADSAFE
     if (stubGetCurrentContext() == context) {
diff --git a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc
index 36f5fa5..05c482a 100644
--- a/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc
+++ b/src/VBox/Additions/common/crOpenGL/feedback/feedbackspu.rc
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2010 Oracle Corporation
+ * Copyright (C) 2009-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -21,30 +21,31 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x3L
-   FILESUBTYPE          0x4L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DRV
+   FILESUBTYPE      VFT2_DRV_DISPLAY
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxOGLfeedbackpu\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOX_WDDM_WOW64
          VALUE "OriginalFilename", "VBoxOGLfeedbackpu-x86.dll\0"
 #else
          VALUE "OriginalFilename", "VBoxOGLfeedbackpu.dll\0"
 #endif
-         VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Additions/common/crOpenGL/icd_drv.c b/src/VBox/Additions/common/crOpenGL/icd_drv.c
index d1a23f9..32039c7 100644
--- a/src/VBox/Additions/common/crOpenGL/icd_drv.c
+++ b/src/VBox/Additions/common/crOpenGL/icd_drv.c
@@ -22,6 +22,11 @@
 #include "stub.h"
 #include "cr_mem.h"
 
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+# include <VBox/VBoxCrHgsmi.h>
+# include <VBox/VBoxUhgsmi.h>
+#endif
+
 #include <windows.h>
 
 //TODO: consider
@@ -109,27 +114,33 @@ BOOL APIENTRY DrvValidateVersion(DWORD version)
 //we're not going to change icdTable at runtime, so callback is unused
 PICDTABLE APIENTRY DrvSetContext(HDC hdc, HGLRC hglrc, void *callback)
 {
-    ContextInfo *context;
-    WindowInfo *window;
-    BOOL ret;
+    ContextInfo *pContext;
+    WindowInfo  *pWindowInfo;
+    BOOL ret = false;
 
     CR_DDI_PROLOGUE();
 
-    /*crDebug( "DrvSetContext called(0x%x, 0x%x)", hdc, hglrc );*/
     (void) (callback);
 
     crHashtableLock(stub.windowTable);
     crHashtableLock(stub.contextTable);
 
-    context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
-    window = stubGetWindowInfo(hdc);
-
-    ret = stubMakeCurrent(window, context);
+    pContext = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
+    if (pContext)
+    {
+        pWindowInfo = stubGetWindowInfo(hdc);
+        if (pWindowInfo)
+            ret = stubMakeCurrent(pWindowInfo, pContext);
+        else
+            crError("no window info available.");
+    }
+    else
+        crError("No context found.");
 
     crHashtableUnlock(stub.contextTable);
     crHashtableUnlock(stub.windowTable);
 
-    return ret ? &icdTable:NULL;
+    return ret ? &icdTable : NULL;
 }
 
 BOOL APIENTRY DrvSetPixelFormat(HDC hdc, int iPixelFormat)
@@ -148,6 +159,9 @@ HGLRC APIENTRY DrvCreateContext(HDC hdc)
 {
     char dpyName[MAX_DPY_NAME];
     ContextInfo *context;
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+    PVBOXUHGSMI pHgsmi = NULL;
+#endif
 
     CR_DDI_PROLOGUE();
 
@@ -163,9 +177,13 @@ HGLRC APIENTRY DrvCreateContext(HDC hdc)
         desiredVisual |= ComputeVisBits( hdc );
 #endif
 
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+    pHgsmi = VBoxCrHgsmiCreate();
+#endif
+
     context = stubNewContext(dpyName, desiredVisual, UNDECIDED, 0
 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
-        , NULL
+        , pHgsmi
 #endif
             );
     if (!context)
@@ -294,10 +312,32 @@ int APIENTRY DrvDescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes, LPPI
 
 BOOL APIENTRY DrvDeleteContext(HGLRC hglrc)
 {
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+    ContextInfo *pContext;
+    PVBOXUHGSMI pHgsmi = NULL;
+#endif
+
     CR_DDI_PROLOGUE();
-    /*crDebug( "DrvDeleteContext(0x%x) called", hglrc );*/
+    crDebug( "DrvDeleteContext(0x%x) called", hglrc );
+
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+    crHashtableLock(stub.contextTable);
+
+    pContext = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc);
+    if (pContext)
+        pHgsmi = pContext->pHgsmi;
+
+    crHashtableUnlock(stub.contextTable);
+#endif
+
     stubDestroyContext( (unsigned long) hglrc );
-    return 1;
+
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+    if (pHgsmi)
+        VBoxCrHgsmiDestroy(pHgsmi);
+#endif
+
+    return true;
 }
 
 BOOL APIENTRY DrvCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
diff --git a/src/VBox/Additions/common/crOpenGL/load.c b/src/VBox/Additions/common/crOpenGL/load.c
index 5864aea..d10a22a 100644
--- a/src/VBox/Additions/common/crOpenGL/load.c
+++ b/src/VBox/Additions/common/crOpenGL/load.c
@@ -1459,6 +1459,9 @@ BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
             crNetFreeConnection(ns.conn);
         }
 
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+        VBoxCrHgsmiInit();
+#endif
         break;
     }
 
@@ -1473,6 +1476,11 @@ BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
             stub.spu->dispatch_table.VBoxDetachThread();
         }
 
+        
+#if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
+        VBoxCrHgsmiTerm();
+#endif
+
         stubSPUSafeTearDown();
 
 #ifdef CHROMIUM_THREADSAFE
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu.rc b/src/VBox/Additions/common/crOpenGL/pack/packspu.rc
index 7b726f6..1aec4ef 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu.rc
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu.rc
@@ -21,30 +21,31 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x3L
-   FILESUBTYPE          0x4L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DRV
+   FILESUBTYPE      VFT2_DRV_DISPLAY
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxOGLpackspu\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOX_WDDM_WOW64
          VALUE "OriginalFilename", "VBoxOGLpackspu-x86.dll\0"
 #else
          VALUE "OriginalFilename", "VBoxOGLpackspu.dll\0"
 #endif
-         VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
index fe95ddf..9c4926d 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_context.c
@@ -453,29 +453,34 @@ void PACKSPU_APIENTRY packspu_DestroyContext( GLint ctx )
     CRASSERT(slot >= 0);
     CRASSERT(slot < pack_spu.numContexts);
 
-    context = &(pack_spu.context[slot]);
+    context = (slot >= 0 && slot < pack_spu.numContexts) ? &(pack_spu.context[slot]) : NULL;
+    curContext = curThread ? curThread->currentContext : NULL;
 
-    if (CRPACKSPU_IS_WDDM_CRHGSMI())
+    if (context)
     {
-        thread = context->currentThread;
-        crPackSetContext(thread->packer);
-        CRASSERT(!(thread->packer == curPacker) == !(thread == curThread));
-    }
-    CRASSERT(thread);
-    curContext = curThread ? curThread->currentContext : NULL;
+        if (CRPACKSPU_IS_WDDM_CRHGSMI())
+        {
+            thread = context->currentThread;
+            if (thread)
+            {
+                crPackSetContext(thread->packer);
+                CRASSERT(!(thread->packer == curPacker) == !(thread == curThread));
+            }
+        }
 
-    if (pack_spu.swap)
-        crPackDestroyContextSWAP( context->serverCtx );
-    else
-        crPackDestroyContext( context->serverCtx );
+        if (pack_spu.swap)
+            crPackDestroyContextSWAP( context->serverCtx );
+        else
+            crPackDestroyContext( context->serverCtx );
 
-    crStateDestroyContext( context->clientState );
+        crStateDestroyContext( context->clientState );
 
-    context->clientState = NULL;
-    context->serverCtx = 0;
-    context->currentThread = NULL;
+        context->clientState = NULL;
+        context->serverCtx = 0;
+        context->currentThread = NULL;
 
-    crMemset (&context->zvaBufferInfo, 0, sizeof (context->zvaBufferInfo));
+        crMemset (&context->zvaBufferInfo, 0, sizeof (context->zvaBufferInfo));
+    }
 
     if (curContext == context)
     {
@@ -502,9 +507,9 @@ void PACKSPU_APIENTRY packspu_DestroyContext( GLint ctx )
 
 void PACKSPU_APIENTRY packspu_MakeCurrent( GLint window, GLint nativeWindow, GLint ctx )
 {
-    ThreadInfo *thread;
+    ThreadInfo *thread = NULL;
     GLint serverCtx;
-    ContextInfo *newCtx;
+    ContextInfo *newCtx = NULL;
 
     if (!CRPACKSPU_IS_WDDM_CRHGSMI())
     {
@@ -527,6 +532,7 @@ void PACKSPU_APIENTRY packspu_MakeCurrent( GLint window, GLint nativeWindow, GLi
         CRASSERT(slot < pack_spu.numContexts);
 
         newCtx = &pack_spu.context[slot];
+        CRASSERT(newCtx);
         CRASSERT(newCtx->clientState);  /* verify valid */
 
         if (CRPACKSPU_IS_WDDM_CRHGSMI())
@@ -538,6 +544,7 @@ void PACKSPU_APIENTRY packspu_MakeCurrent( GLint window, GLint nativeWindow, GLi
         }
         else
         {
+            CRASSERT(thread);
             if (newCtx->fAutoFlush)
             {
                 if (newCtx->currentThread && newCtx->currentThread != thread)
diff --git a/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c b/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
index 51c0f91..158157a 100644
--- a/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
+++ b/src/VBox/Additions/common/crOpenGL/pack/packspu_init.c
@@ -42,6 +42,11 @@ packSPUInit( int id, SPU *child, SPU *self,
     crInitMutex(&_PackMutex);
 #endif
 
+#ifdef CHROMIUM_THREADSAFE
+    crInitTSD(&_PackerTSD);
+    crInitTSD(&_PackTSD);
+#endif
+
     pack_spu.id = id;
 
     packspuSetVBoxConfiguration( child );
@@ -98,15 +103,14 @@ packSPUCleanup(void)
         }
     }
 
+#ifdef CHROMIUM_THREADSAFE
     crFreeTSD(&_PackerTSD);
     crFreeTSD(&_PackTSD);
-    
-#ifdef CHROMIUM_THREADSAFE
     crUnlockMutex(&_PackMutex);
 # ifndef WINDOWS
     crFreeMutex(&_PackMutex);
 # endif
-#endif
+#endif /* CHROMIUM_THREADSAFE */
     return 1;
 }
 
diff --git a/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu.rc b/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu.rc
index 9569ed3..ebe6296 100644
--- a/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu.rc
+++ b/src/VBox/Additions/common/crOpenGL/passthrough/passthroughspu.rc
@@ -21,30 +21,31 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x3L
-   FILESUBTYPE          0x4L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DRV
+   FILESUBTYPE      VFT2_DRV_DISPLAY
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxOGLpassthroughspu\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOX_WDDM_WOW64
          VALUE "OriginalFilename", "VBoxOGLpassthroughspu-x86.dll\0"
 #else
          VALUE "OriginalFilename", "VBoxOGLpassthroughspu.dll\0"
 #endif
-         VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Additions/common/crOpenGL/stub.c b/src/VBox/Additions/common/crOpenGL/stub.c
index 5f0f374..9c2707b 100644
--- a/src/VBox/Additions/common/crOpenGL/stub.c
+++ b/src/VBox/Additions/common/crOpenGL/stub.c
@@ -42,7 +42,7 @@ Display* stubGetWindowDisplay(WindowInfo *pWindow)
 /**
  * Returns -1 on error
  */
-GLint APIENTRY crCreateContext( const char *dpyName, GLint visBits )
+GLint APIENTRY crCreateContext(char *dpyName, GLint visBits)
 {
     ContextInfo *context;
     stubInit();
diff --git a/src/VBox/Additions/common/crOpenGL/stub.h b/src/VBox/Additions/common/crOpenGL/stub.h
index 56c0b35..f26061d 100644
--- a/src/VBox/Additions/common/crOpenGL/stub.h
+++ b/src/VBox/Additions/common/crOpenGL/stub.h
@@ -336,7 +336,7 @@ extern void stubCheckXExtensions(WindowInfo *pWindow);
 #endif
 
 
-extern ContextInfo *stubNewContext( const char *dpyName, GLint visBits, ContextType type, unsigned long shareCtx
+extern ContextInfo *stubNewContext(char *dpyName, GLint visBits, ContextType type, unsigned long shareCtx
 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST)
         , struct VBOXUHGSMI *pHgsmi
 #endif
diff --git a/src/VBox/Additions/common/crOpenGL/wgl.c b/src/VBox/Additions/common/crOpenGL/wgl.c
index 83fcf5b..a015ced 100644
--- a/src/VBox/Additions/common/crOpenGL/wgl.c
+++ b/src/VBox/Additions/common/crOpenGL/wgl.c
@@ -7,6 +7,7 @@
 #include "cr_error.h"
 #include "cr_spu.h"
 #include "cr_environment.h"
+#include "cr_mem.h"
 #include "stub.h"
 
 /* I *know* most of the parameters are unused, dammit. */
@@ -353,7 +354,7 @@ DECLEXPORT(BOOL) WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 )
 
 DECLEXPORT(HGLRC) WINAPI VBoxCreateContext( HDC hdc, struct VBOXUHGSMI *pHgsmi )
 {
-    char dpyName[MAX_DPY_NAME];
+    char *dpyName;
     ContextInfo *context;
 
     CR_DDI_PROLOGUE();
@@ -362,7 +363,12 @@ DECLEXPORT(HGLRC) WINAPI VBoxCreateContext( HDC hdc, struct VBOXUHGSMI *pHgsmi )
 
     CRASSERT(stub.contextTable);
 
-    sprintf(dpyName, "%d", hdc);
+    dpyName = crCalloc(MAX_DPY_NAME);
+    if (dpyName)
+    {
+        crMemset(dpyName, 0, MAX_DPY_NAME);
+        sprintf(dpyName, "%d", hdc);
+    }
 #ifndef VBOX_CROGL_USE_VBITS_SUPERSET
     if (stub.haveNativeOpenGL)
         desiredVisual |= ComputeVisBits( hdc );
@@ -375,6 +381,9 @@ DECLEXPORT(HGLRC) WINAPI VBoxCreateContext( HDC hdc, struct VBOXUHGSMI *pHgsmi )
         , NULL
 #endif
             );
+    /* Not needed any more. */
+    crFree(dpyName);
+
     if (!context)
         return 0;
 
diff --git a/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c b/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c
index 6b36783..3536f82 100644
--- a/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c
+++ b/src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c
@@ -134,8 +134,8 @@ static int vboxvfs_mount(struct mount *mp, struct thread *td)
     if (!pShFlShareName)
         return VERR_NO_MEMORY;
 
-    pShFlShareName->u16Length = cbShFlShareName;
-    pShFlShareName->u16Size   = cbShFlShareName + 1;
+    pShFlShareName->u16Length = cbShare;
+    pShFlShareName->u16Size   = cbShare + 1;
     memcpy (pShFlShareName->String.utf8, pszShare, cbShare + 1);
 
     rc = vboxCallMapFolder (&g_vboxSFClient, pShFlShareName, &pShFlGlobalInfo->map);
diff --git a/src/VBox/Additions/haiku/VBoxVideo/accelerant/Makefile.kmk b/src/VBox/Additions/haiku/VBoxVideo/accelerant/Makefile.kmk
index 397f64f..3264f29 100644
--- a/src/VBox/Additions/haiku/VBoxVideo/accelerant/Makefile.kmk
+++ b/src/VBox/Additions/haiku/VBoxVideo/accelerant/Makefile.kmk
@@ -57,7 +57,7 @@ vboxvideo.accelerant_SOURCES  = \
 
 vboxvideo.accelerant_LIBS     = \
 	be device \
-	$(VBOX_LIB_IPRT_GUEST_R3) \
+	$(VBOX_LIB_IPRT_GUEST_R3_SHARED) \
 	$(VBOX_LIB_VBGL_R3) \
 	/system/servers/app_server
 
diff --git a/src/VBox/Additions/linux/Makefile.kmk b/src/VBox/Additions/linux/Makefile.kmk
index 0af9e7c..ab642cf 100644
--- a/src/VBox/Additions/linux/Makefile.kmk
+++ b/src/VBox/Additions/linux/Makefile.kmk
@@ -488,4 +488,3 @@ $(PATH_STAGE_BIN)/additions/VBoxLinuxAdditions.run: \
 		"VirtualBox $(VBOX_VERSION_STRING) Guest Additions for Linux" \
 		/bin/sh ./install.sh "\$$0 1> /dev/null"
 
-
diff --git a/src/VBox/Additions/linux/drm/Makefile.kmk b/src/VBox/Additions/linux/drm/Makefile.kmk
index e95b0f7..f6d6801 100644
--- a/src/VBox/Additions/linux/drm/Makefile.kmk
+++ b/src/VBox/Additions/linux/drm/Makefile.kmk
@@ -61,18 +61,6 @@ vboxvideo_drm_DEFS            = \
 	KBUILD_MODNAME=KBUILD_STR\(vboxvideo\) \
 	KBUILD_BASENAME=KBUILD_STR\(vboxvideo\) \
 	DEBUG_HASH=2 DEBUG_HASH2=3
-# detect fc6 2.6.18
-vboxvideo_drm_DEFS           += \
-	$(foreach inc,$(VBOX_LINUX_INCS),\
-		$(if $(wildcard $(inc)/linux/utsrelease.h),\
-		 $(if $(shell if grep -q '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h;\
-		               then echo yes; fi),KERNEL_FC6,),))
-# detect rhel5 2.6.18
-vboxvideo_drm_DEFS           += \
-	$(foreach inc,$(VBOX_LINUX_INCS),\
-		$(if $(wildcard $(inc)/linux/utsrelease.h),\
-		 $(if $(shell if grep -q '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h;\
-		               then echo yes; fi),KERNEL_FC6,),))
 if !defined(VBOX_WITH_GUEST_KMS_DRIVER)
  vboxvideo_drm_SOURCES         = vboxvideo_drm.c
 else
@@ -84,6 +72,7 @@ else
    ../../common/VBoxVideo/Modesetting.cpp \
    ../../common/VBoxVideo/VBVABase.cpp \
    ../../../GuestHost/HGSMI/HGSMICommon.cpp \
+   ../../../GuestHost/HGSMI/HGSMIMemAlloc.cpp \
    ../../../Runtime/common/alloc/heapoffset.cpp \
  	vbox_drv.c \
  	vbox_fb.c \
diff --git a/src/VBox/Additions/linux/drm/Makefile.module.kms b/src/VBox/Additions/linux/drm/Makefile.module.kms
index 80cbd98..c09ef61 100644
--- a/src/VBox/Additions/linux/drm/Makefile.module.kms
+++ b/src/VBox/Additions/linux/drm/Makefile.module.kms
@@ -20,8 +20,9 @@ include $(obj)/Makefile.include.header
 
 MOD_NAME   = vboxvideo
 
-MOD_OBJS   = HGSMIBase.o HGSMICommon.o heapoffset.o Modesetting.o vbox_drv.o \
-             vbox_fb.o vbox_main.o vbox_mode.o vbox_ttm.o VBVABase.o
+MOD_OBJS   = HGSMIBase.o HGSMICommon.o HGSMIMemAlloc.o heapoffset.o \
+             Modesetting.o vbox_drv.o vbox_fb.o vbox_main.o vbox_mode.o \
+             vbox_ttm.o VBVABase.o
 
 ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxvideo),)
  MANGLING := $(KBUILD_EXTMOD)/vboxvideo/include/VBox/VBoxGuestMangling.h
diff --git a/src/VBox/Additions/linux/drm/files_vboxvideo_drv b/src/VBox/Additions/linux/drm/files_vboxvideo_drv
index 67b6c4e..8d81597 100755
--- a/src/VBox/Additions/linux/drm/files_vboxvideo_drv
+++ b/src/VBox/Additions/linux/drm/files_vboxvideo_drv
@@ -25,6 +25,7 @@ FILES_VBOXVIDEO_DRM_NOBIN=" \
     ${PATH_ROOT}/include/iprt/cdefs.h=>include/iprt/cdefs.h \
     ${PATH_ROOT}/include/iprt/err.h=>include/iprt/err.h \
     ${PATH_ROOT}/include/iprt/heap.h=>include/iprt/heap.h \
+    ${PATH_ROOT}/include/iprt/list.h=>include/iprt/list.h \
     ${PATH_ROOT}/include/iprt/log.h=>include/iprt/log.h \
     ${PATH_ROOT}/include/iprt/param.h=>include/iprt/param.h \
     ${PATH_ROOT}/include/iprt/stdarg.h=>include/iprt/stdarg.h \
@@ -48,6 +49,8 @@ FILES_VBOXVIDEO_DRM_NOBIN=" \
     ${PATH_ROOT}/include/VBox/HGSMI/HGSMI.h=>include/VBox/HGSMI/HGSMI.h \
     ${PATH_ROOT}/include/VBox/HGSMI/HGSMIChannels.h=>include/VBox/HGSMI/HGSMIChannels.h \
     ${PATH_ROOT}/include/VBox/HGSMI/HGSMIChSetup.h=>include/VBox/HGSMI/HGSMIChSetup.h \
+    ${PATH_ROOT}/include/VBox/HGSMI/HGSMIDefs.h=>include/VBox/HGSMI/HGSMIDefs.h \
+    ${PATH_ROOT}/include/VBox/HGSMI/HGSMIMemAlloc.h=>include/VBox/HGSMI/HGSMIMemAlloc.h \
     ${PATH_ROOT}/include/VBox/Hardware/VBoxVideoVBE.h=>include/VBox/Hardware/VBoxVideoVBE.h \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp=>HGSMIBase.c \
     ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp=>Modesetting.c \
@@ -59,6 +62,7 @@ FILES_VBOXVIDEO_DRM_NOBIN=" \
     ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_mode.c=>vbox_mode.c \
     ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_ttm.c=>vbox_ttm.c \
     ${PATH_ROOT}/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp=>HGSMICommon.c \
+    ${PATH_ROOT}/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp=>HGSMIMemAlloc.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/alloc/heapoffset.cpp=>heapoffset.c \
     ${PATH_ROOT}/src/VBox/Runtime/include/internal/iprt.h=>include/internal/iprt.h \
     ${PATH_ROOT}/src/VBox/Runtime/include/internal/magics.h=>include/internal/magics.h \
diff --git a/src/VBox/Additions/linux/drm/vbox_drv.c b/src/VBox/Additions/linux/drm/vbox_drv.c
index df7997f..33a0df3 100644
--- a/src/VBox/Additions/linux/drm/vbox_drv.c
+++ b/src/VBox/Additions/linux/drm/vbox_drv.c
@@ -47,6 +47,8 @@
  */
 #include "vbox_drv.h"
 
+#include <VBox/VBoxGuest.h>
+
 #include <linux/module.h>
 #include <linux/console.h>
 
@@ -60,86 +62,92 @@ module_param_named(modeset, vbox_modeset, int, 0400);
 
 static struct drm_driver driver;
 
-static DEFINE_PCI_DEVICE_TABLE(pciidlist) = {
-	{0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{0, 0, 0},
+static DEFINE_PCI_DEVICE_TABLE(pciidlist) =
+{
+    {0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+    {0, 0, 0},
 };
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
 static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
-	return drm_get_pci_dev(pdev, ent, &driver);
+    return drm_get_pci_dev(pdev, ent, &driver);
 }
 
 
-static void
-vbox_pci_remove(struct pci_dev *pdev)
+static void vbox_pci_remove(struct pci_dev *pdev)
 {
-	struct drm_device *dev = pci_get_drvdata(pdev);
+    struct drm_device *dev = pci_get_drvdata(pdev);
 
-	drm_put_dev(dev);
+    drm_put_dev(dev);
 }
 
 
-static struct pci_driver vbox_pci_driver = {
-	.name = DRIVER_NAME,
-	.id_table = pciidlist,
-	.probe = vbox_pci_probe,
-	.remove = vbox_pci_remove,
+static struct pci_driver vbox_pci_driver =
+{
+    .name = DRIVER_NAME,
+    .id_table = pciidlist,
+    .probe = vbox_pci_probe,
+    .remove = vbox_pci_remove,
 };
 
-static const struct file_operations vbox_fops = {
-	.owner = THIS_MODULE,
-	.open = drm_open,
-	.release = drm_release,
-	.unlocked_ioctl = drm_ioctl,
-	.mmap = vbox_mmap,
-	.poll = drm_poll,
-	.fasync = drm_fasync,
+
+static const struct file_operations vbox_fops =
+{
+    .owner = THIS_MODULE,
+    .open = drm_open,
+    .release = drm_release,
+    .unlocked_ioctl = drm_ioctl,
+    .mmap = vbox_mmap,
+    .poll = drm_poll,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+    .fasync = drm_fasync,
+#endif
 #ifdef CONFIG_COMPAT
-	.compat_ioctl = drm_compat_ioctl,
+    .compat_ioctl = drm_compat_ioctl,
 #endif
-	.read = drm_read,
+    .read = drm_read,
 };
 
-static struct drm_driver driver = {
-	.driver_features = DRIVER_USE_MTRR | DRIVER_MODESET | DRIVER_GEM,
-	.dev_priv_size = 0,
-
-	.load = vbox_driver_load,
-	.unload = vbox_driver_unload,
-
-	.fops = &vbox_fops,
-	.name = DRIVER_NAME,
-	.desc = DRIVER_DESC,
-	.date = DRIVER_DATE,
-	.major = DRIVER_MAJOR,
-	.minor = DRIVER_MINOR,
-	.patchlevel = DRIVER_PATCHLEVEL,
-
-	.gem_init_object = vbox_gem_init_object,
-	.gem_free_object = vbox_gem_free_object,
-	.dumb_create = vbox_dumb_create,
-	.dumb_map_offset = vbox_dumb_mmap_offset,
-	.dumb_destroy = vbox_dumb_destroy,
+static struct drm_driver driver =
+{
+    .driver_features = DRIVER_MODESET | DRIVER_GEM,
+    .dev_priv_size = 0,
+
+    .load = vbox_driver_load,
+    .unload = vbox_driver_unload,
+    .lastclose = vbox_driver_lastclose,
+
+    .fops = &vbox_fops,
+    .name = DRIVER_NAME,
+    .desc = DRIVER_DESC,
+    .date = DRIVER_DATE,
+    .major = DRIVER_MAJOR,
+    .minor = DRIVER_MINOR,
+    .patchlevel = DRIVER_PATCHLEVEL,
+
+    .gem_free_object = vbox_gem_free_object,
+    .dumb_create = vbox_dumb_create,
+    .dumb_map_offset = vbox_dumb_mmap_offset,
+    .dumb_destroy = vbox_dumb_destroy,
 
 };
 
 static int __init vbox_init(void)
 {
 #ifdef CONFIG_VGA_CONSOLE
-	if (vgacon_text_force() && vbox_modeset == -1)
-		return -EINVAL;
+    if (vgacon_text_force() && vbox_modeset == -1)
+        return -EINVAL;
 #endif
 
-	if (vbox_modeset == 0)
-		return -EINVAL;
-	return drm_pci_init(&driver, &vbox_pci_driver);
+    if (vbox_modeset == 0)
+        return -EINVAL;
+    return drm_pci_init(&driver, &vbox_pci_driver);
 }
 static void __exit vbox_exit(void)
 {
-	drm_pci_exit(&driver, &vbox_pci_driver);
+    drm_pci_exit(&driver, &vbox_pci_driver);
 }
 
 module_init(vbox_init);
diff --git a/src/VBox/Additions/linux/drm/vbox_drv.h b/src/VBox/Additions/linux/drm/vbox_drv.h
index 523710c..ab1791c 100644
--- a/src/VBox/Additions/linux/drm/vbox_drv.h
+++ b/src/VBox/Additions/linux/drm/vbox_drv.h
@@ -50,6 +50,8 @@
 
 #include <VBox/VBoxVideoGuest.h>
 
+#include <iprt/log.h>
+
 #include "the-linux-kernel.h"
 
 #include <drm/drmP.h>
@@ -75,73 +77,92 @@
 #define DRIVER_MINOR        0
 #define DRIVER_PATCHLEVEL   0
 
+#define VBOX_MAX_CURSOR_WIDTH  64
+#define VBOX_MAX_CURSOR_HEIGHT 64
+
 struct vbox_fbdev;
 
-struct vbox_private {
-	struct drm_device *dev;
+struct vbox_private
+{
+    struct drm_device *dev;
 
-	void __iomem *vram;
+    void __iomem *vram;
     HGSMIGUESTCOMMANDCONTEXT Ctx;
     struct VBVABUFFERCONTEXT *paVBVACtx;
     bool fAnyX;
     unsigned cCrtcs;
-	bool vga2_clone;
-	uint32_t vram_size;
+    bool vga2_clone;
+    /** Amount of available VRAM, including space used for buffers. */
+    uint32_t full_vram_size;
+    /** Amount of available VRAM, not including space used for buffers. */
+    uint32_t vram_size;
 
-	struct vbox_fbdev *fbdev;
+    struct vbox_fbdev *fbdev;
 
-	int fb_mtrr;
+    int fb_mtrr;
 
-	struct {
-		struct drm_global_reference mem_global_ref;
-		struct ttm_bo_global_ref bo_global_ref;
-		struct ttm_bo_device bdev;
-	} ttm;
+    struct
+    {
+        struct drm_global_reference mem_global_ref;
+        struct ttm_bo_global_ref bo_global_ref;
+        struct ttm_bo_device bdev;
+    } ttm;
 
-	struct drm_gem_object *cursor_cache;
-	uint64_t cursor_cache_gpu_addr;
-	struct ttm_bo_kmap_obj cache_kmap;
-	int next_cursor;
+    spinlock_t dev_lock;
 };
 
 int vbox_driver_load(struct drm_device *dev, unsigned long flags);
 int vbox_driver_unload(struct drm_device *dev);
+void vbox_driver_lastclose(struct drm_device *pDev);
 
 struct vbox_gem_object;
 
-struct vbox_connector {
-	struct drm_connector base;
+struct vbox_connector
+{
+    struct drm_connector base;
+    char szName[32];
+    /** Device attribute for sysfs file used for receiving mode hints from user
+     * space. */
+    struct device_attribute deviceAttribute;
+    struct
+    {
+        uint16_t cX;
+        uint16_t cY;
+    } modeHint;
 };
 
-struct vbox_crtc {
-	struct drm_crtc base;
-	bool fBlanked;
-	unsigned crtc_id;
-	struct drm_gem_object *cursor_bo;
-	uint64_t cursor_addr;
-	int cursor_width, cursor_height;
-	u8 offset_x, offset_y;
+struct vbox_crtc
+{
+    struct drm_crtc base;
+    bool fBlanked;
+    unsigned crtc_id;
+    uint32_t offFB;
+    struct drm_gem_object *cursor_bo;
+    uint64_t cursor_addr;
+    int cursor_width, cursor_height;
+    u8 offset_x, offset_y;
 };
 
-struct vbox_encoder {
-	struct drm_encoder base;
+struct vbox_encoder
+{
+    struct drm_encoder base;
 };
 
-struct vbox_framebuffer {
-	struct drm_framebuffer base;
-	struct drm_gem_object *obj;
-	uint64_t offBase;
+struct vbox_framebuffer
+{
+    struct drm_framebuffer base;
+    struct drm_gem_object *obj;
 };
 
-struct vbox_fbdev {
-	struct drm_fb_helper helper;
-	struct vbox_framebuffer afb;
-	struct list_head fbdev_list;
-	void *sysram;
-	int size;
-	struct ttm_bo_kmap_obj mapping;
-	int x1, y1, x2, y2; /* dirty rect */
-	spinlock_t dirty_lock;
+struct vbox_fbdev
+{
+    struct drm_fb_helper helper;
+    struct vbox_framebuffer afb;
+    struct list_head fbdev_list;
+    void *sysram;
+    int size;
+    struct ttm_bo_kmap_obj mapping;
+    int x1, y1, x2, y2; /* dirty rect */
 };
 
 #define to_vbox_crtc(x) container_of(x, struct vbox_crtc, base)
@@ -151,6 +172,7 @@ struct vbox_fbdev {
 
 extern int vbox_mode_init(struct drm_device *dev);
 extern void vbox_mode_fini(struct drm_device *dev);
+extern void VBoxRefreshModes(struct drm_device *pDev);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
 # define DRM_MODE_FB_CMD drm_mode_fb_cmd
@@ -158,47 +180,56 @@ extern void vbox_mode_fini(struct drm_device *dev);
 # define DRM_MODE_FB_CMD drm_mode_fb_cmd2
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
+# define CRTC_FB(crtc) (crtc)->fb
+#else
+# define CRTC_FB(crtc) (crtc)->primary->fb
+#endif
+
+void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
+                                       struct drm_clip_rect *pRects,
+                                       unsigned cRects);
+
 int vbox_framebuffer_init(struct drm_device *dev,
-			 struct vbox_framebuffer *vbox_fb,
-			 struct DRM_MODE_FB_CMD *mode_cmd,
-			 struct drm_gem_object *obj);
+             struct vbox_framebuffer *vbox_fb,
+             struct DRM_MODE_FB_CMD *mode_cmd,
+             struct drm_gem_object *obj);
 
 int vbox_fbdev_init(struct drm_device *dev);
 void vbox_fbdev_fini(struct drm_device *dev);
 void vbox_fbdev_set_suspend(struct drm_device *dev, int state);
 
-struct vbox_bo {
-	struct ttm_buffer_object bo;
-	struct ttm_placement placement;
-	struct ttm_bo_kmap_obj kmap;
-	struct drm_gem_object gem;
-	u32 placements[3];
-	int pin_count;
+struct vbox_bo
+{
+    struct ttm_buffer_object bo;
+    struct ttm_placement placement;
+    struct ttm_bo_kmap_obj kmap;
+    struct drm_gem_object gem;
+    u32 placements[3];
+    int pin_count;
 };
 #define gem_to_vbox_bo(gobj) container_of((gobj), struct vbox_bo, gem)
 
-static inline struct vbox_bo *
-vbox_bo(struct ttm_buffer_object *bo)
+static inline struct vbox_bo * vbox_bo(struct ttm_buffer_object *bo)
 {
-	return container_of(bo, struct vbox_bo, bo);
+    return container_of(bo, struct vbox_bo, bo);
 }
 
 
 #define to_vbox_obj(x) container_of(x, struct vbox_gem_object, base)
 
 extern int vbox_dumb_create(struct drm_file *file,
-			   struct drm_device *dev,
-			   struct drm_mode_create_dumb *args);
+               struct drm_device *dev,
+               struct drm_mode_create_dumb *args);
 extern int vbox_dumb_destroy(struct drm_file *file,
-			    struct drm_device *dev,
-			    uint32_t handle);
+                struct drm_device *dev,
+                uint32_t handle);
 
-extern int vbox_gem_init_object(struct drm_gem_object *obj);
 extern void vbox_gem_free_object(struct drm_gem_object *obj);
 extern int vbox_dumb_mmap_offset(struct drm_file *file,
-				struct drm_device *dev,
-				uint32_t handle,
-				uint64_t *offset);
+                struct drm_device *dev,
+                uint32_t handle,
+                uint64_t *offset);
 
 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 
@@ -206,11 +237,11 @@ int vbox_mm_init(struct vbox_private *vbox);
 void vbox_mm_fini(struct vbox_private *vbox);
 
 int vbox_bo_create(struct drm_device *dev, int size, int align,
-		  uint32_t flags, struct vbox_bo **pvboxbo);
+          uint32_t flags, struct vbox_bo **pvboxbo);
 
 int vbox_gem_create(struct drm_device *dev,
-		   u32 size, bool iskernel,
-		   struct drm_gem_object **obj);
+           u32 size, bool iskernel,
+           struct drm_gem_object **obj);
 
 int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr);
 int vbox_bo_unpin(struct vbox_bo *bo);
diff --git a/src/VBox/Additions/linux/drm/vbox_fb.c b/src/VBox/Additions/linux/drm/vbox_fb.c
new file mode 100644
index 0000000..1b998f0
--- /dev/null
+++ b/src/VBox/Additions/linux/drm/vbox_fb.c
@@ -0,0 +1,484 @@
+/** @file $Id: vbox_fb.c $
+ *
+ * VirtualBox Additions Linux kernel video driver
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on
+ * ast_fb.c
+ * with the following copyright and permission notice:
+ *
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie <airlied at redhat.com>
+ */
+/* Include from most specific to most general to be able to override things. */
+#include "vbox_drv.h"
+#include <VBox/VBoxVideo.h>
+#include <VBox/VMMDev.h>
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/tty.h>
+#include <linux/sysrq.h>
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+
+
+#include <drm/drmP.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_fb_helper.h>
+#include "vbox_drv.h"
+
+/** This is called whenever there is a virtual console switch.  We do two things
+ * here.  First we re-set all video modes in case the last console owner
+ * programmed the card directly.  Second we disable VBVA in case the new console
+ * owner is about to programme the card directly and doesn't know about VBVA.
+ * We re-enable VBVA if necessary when we get dirty rectangle information, as
+ * the owner should not be sending that if they plan to programme the card
+ * themselves. */
+static int VBoxSetPar(struct fb_info *pInfo)
+{
+    struct vbox_fbdev *pVFBDev = pInfo->par;
+    struct drm_device *pDev;
+    struct vbox_private *pVBox;
+    unsigned i;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    pDev = pVFBDev->helper.dev;
+    pVBox = pDev->dev_private;
+    VBoxRefreshModes(pDev);
+    for (i = 0; i < pVBox->cCrtcs; ++i)
+        VBoxVBVADisable(&pVBox->paVBVACtx[i], &pVBox->Ctx, i);
+    return drm_fb_helper_set_par(pInfo);
+}
+
+/**
+ * Tell the host about dirty rectangles to update.
+ */
+static void vbox_dirty_update(struct vbox_fbdev *afbdev,
+                 int x, int y, int width, int height)
+{
+    struct drm_device *dev = afbdev->helper.dev;
+    struct vbox_private *vbox = dev->dev_private;
+    int i;
+
+    struct drm_gem_object *obj;
+    struct vbox_bo *bo;
+    int src_offset, dst_offset;
+    int bpp = (afbdev->afb.base.bits_per_pixel + 7)/8;
+    int ret;
+    bool unmap = false;
+    bool store_for_later = false;
+    int x2, y2;
+    unsigned long flags;
+    struct drm_clip_rect rect;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    obj = afbdev->afb.obj;
+    bo = gem_to_vbox_bo(obj);
+
+    /*
+     * try and reserve the BO, if we fail with busy
+     * then the BO is being moved and we should
+     * store up the damage until later.
+     */
+    ret = vbox_bo_reserve(bo, true);
+    if (ret)
+    {
+        if (ret != -EBUSY)
+            return;
+
+        store_for_later = true;
+    }
+
+    x2 = x + width - 1;
+    y2 = y + height - 1;
+    spin_lock_irqsave(&vbox->dev_lock, flags);
+
+    if (afbdev->y1 < y)
+        y = afbdev->y1;
+    if (afbdev->y2 > y2)
+        y2 = afbdev->y2;
+    if (afbdev->x1 < x)
+        x = afbdev->x1;
+    if (afbdev->x2 > x2)
+        x2 = afbdev->x2;
+
+    if (store_for_later)
+    {
+        afbdev->x1 = x;
+        afbdev->x2 = x2;
+        afbdev->y1 = y;
+        afbdev->y2 = y2;
+        spin_unlock_irqrestore(&vbox->dev_lock, flags);
+        LogFunc(("vboxvideo: %d\n", __LINE__));
+        return;
+    }
+
+    afbdev->x1 = afbdev->y1 = INT_MAX;
+    afbdev->x2 = afbdev->y2 = 0;
+    spin_unlock_irqrestore(&vbox->dev_lock, flags);
+
+    if (!bo->kmap.virtual)
+    {
+        ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
+        if (ret)
+        {
+            DRM_ERROR("failed to kmap fb updates\n");
+            vbox_bo_unreserve(bo);
+            return;
+        }
+        unmap = true;
+    }
+    for (i = y; i <= y2; i++)
+    {
+        /* assume equal stride for now */
+        src_offset = dst_offset = i * afbdev->afb.base.pitches[0] + (x * bpp);
+        memcpy_toio(bo->kmap.virtual + src_offset, (char *)afbdev->sysram + src_offset, (x2 - x + 1) * bpp);
+    }
+    /* Not sure why the original code subtracted 1 here, but I will keep it that
+     * way to avoid unnecessary differences. */
+    rect.x1 = x;
+    rect.x2 = x2 + 1;
+    rect.y1 = y;
+    rect.y2 = y2 + 1;
+    vbox_framebuffer_dirty_rectangles(&afbdev->afb.base, &rect, 1);
+    if (unmap)
+        ttm_bo_kunmap(&bo->kmap);
+
+    vbox_bo_unreserve(bo);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+}
+
+static void vbox_fillrect(struct fb_info *info,
+             const struct fb_fillrect *rect)
+{
+    struct vbox_fbdev *afbdev = info->par;
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    sys_fillrect(info, rect);
+    vbox_dirty_update(afbdev, rect->dx, rect->dy, rect->width,
+             rect->height);
+}
+
+static void vbox_copyarea(struct fb_info *info,
+             const struct fb_copyarea *area)
+{
+    struct vbox_fbdev *afbdev = info->par;
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    sys_copyarea(info, area);
+    vbox_dirty_update(afbdev, area->dx, area->dy, area->width,
+             area->height);
+}
+
+static void vbox_imageblit(struct fb_info *info,
+              const struct fb_image *image)
+{
+    struct vbox_fbdev *afbdev = info->par;
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    sys_imageblit(info, image);
+    vbox_dirty_update(afbdev, image->dx, image->dy, image->width,
+             image->height);
+}
+
+static struct fb_ops vboxfb_ops =
+{
+    .owner = THIS_MODULE,
+    .fb_check_var = drm_fb_helper_check_var,
+    .fb_set_par = VBoxSetPar,
+    .fb_fillrect = vbox_fillrect,
+    .fb_copyarea = vbox_copyarea,
+    .fb_imageblit = vbox_imageblit,
+    .fb_pan_display = drm_fb_helper_pan_display,
+    .fb_blank = drm_fb_helper_blank,
+    .fb_setcmap = drm_fb_helper_setcmap,
+    .fb_debug_enter = drm_fb_helper_debug_enter,
+    .fb_debug_leave = drm_fb_helper_debug_leave,
+};
+
+static int vboxfb_create_object(struct vbox_fbdev *afbdev,
+                   struct DRM_MODE_FB_CMD *mode_cmd,
+                   struct drm_gem_object **gobj_p)
+{
+    struct drm_device *dev = afbdev->helper.dev;
+    u32 bpp, depth;
+    u32 size;
+    struct drm_gem_object *gobj;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+    __u32 pitch = mode_cmd->pitch;
+#else
+    __u32 pitch = mode_cmd->pitches[0];
+#endif
+
+    int ret = 0;
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
+
+    size = pitch * mode_cmd->height;
+    ret = vbox_gem_create(dev, size, true, &gobj);
+    if (ret)
+        return ret;
+
+    *gobj_p = gobj;
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return ret;
+}
+
+static int vboxfb_create(struct vbox_fbdev *afbdev,
+            struct drm_fb_helper_surface_size *sizes)
+{
+    struct drm_device *dev = afbdev->helper.dev;
+    struct DRM_MODE_FB_CMD mode_cmd;
+    struct drm_framebuffer *fb;
+    struct fb_info *info;
+    __u32 pitch;
+    unsigned int fb_pitch;
+    int size, ret;
+    struct device *device = &dev->pdev->dev;
+    void *sysram;
+    struct drm_gem_object *gobj = NULL;
+    struct vbox_bo *bo = NULL;
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    mode_cmd.width = sizes->surface_width;
+    mode_cmd.height = sizes->surface_height;
+    pitch = mode_cmd.width * ((sizes->surface_bpp + 7) / 8);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+    mode_cmd.bpp = sizes->surface_bpp;
+    mode_cmd.depth = sizes->surface_depth;
+    mode_cmd.pitch = pitch;
+#else
+    mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
+                                                      sizes->surface_depth);
+    mode_cmd.pitches[0] = pitch;
+#endif
+
+    size = pitch * mode_cmd.height;
+
+    ret = vboxfb_create_object(afbdev, &mode_cmd, &gobj);
+    if (ret)
+    {
+        DRM_ERROR("failed to create fbcon backing object %d\n", ret);
+        return ret;
+    }
+    bo = gem_to_vbox_bo(gobj);
+
+    sysram = vmalloc(size);
+    if (!sysram)
+        return -ENOMEM;
+
+    info = framebuffer_alloc(0, device);
+    if (!info)
+    {
+        ret = -ENOMEM;
+        goto out;
+    }
+    info->par = afbdev;
+
+    ret = vbox_framebuffer_init(dev, &afbdev->afb, &mode_cmd, gobj);
+    if (ret)
+        goto out;
+
+    afbdev->sysram = sysram;
+    afbdev->size = size;
+
+    fb = &afbdev->afb.base;
+    afbdev->helper.fb = fb;
+    afbdev->helper.fbdev = info;
+
+    strcpy(info->fix.id, "vboxdrmfb");
+
+    /* The last flag forces a mode set on VT switches even if the kernel does
+     * not think it is needed. */
+    info->flags =   FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT
+                  | FBINFO_MISC_ALWAYS_SETPAR;
+    info->fbops = &vboxfb_ops;
+
+    ret = fb_alloc_cmap(&info->cmap, 256, 0);
+    if (ret)
+    {
+        ret = -ENOMEM;
+        goto out;
+    }
+
+    /* This seems to be done for safety checking that the framebuffer is not
+     * registered twice by different drivers. */
+    info->apertures = alloc_apertures(1);
+    if (!info->apertures)
+    {
+        ret = -ENOMEM;
+        goto out;
+    }
+    info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
+    info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
+
+    drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth);
+    drm_fb_helper_fill_var(info, &afbdev->helper, sizes->fb_width, sizes->fb_height);
+
+    info->screen_base = sysram;
+    info->screen_size = size;
+
+    info->pixmap.flags = FB_PIXMAP_SYSTEM;
+
+    DRM_DEBUG_KMS("allocated %dx%d\n",
+              fb->width, fb->height);
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return 0;
+out:
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return ret;
+}
+
+static void vbox_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
+                   u16 blue, int regno)
+{
+
+}
+
+static void vbox_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
+                   u16 *blue, int regno)
+{
+    *red = regno;
+    *green = regno;
+    *blue = regno;
+}
+
+static int vbox_find_or_create_single(struct drm_fb_helper *helper,
+                      struct drm_fb_helper_surface_size *sizes)
+{
+    struct vbox_fbdev *afbdev = (struct vbox_fbdev *)helper;
+    int new_fb = 0;
+    int ret;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    if (!helper->fb)
+    {
+        ret = vboxfb_create(afbdev, sizes);
+        if (ret)
+            return ret;
+        new_fb = 1;
+    }
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return new_fb;
+}
+
+static struct drm_fb_helper_funcs vbox_fb_helper_funcs =
+{
+    .gamma_set = vbox_fb_gamma_set,
+    .gamma_get = vbox_fb_gamma_get,
+    .fb_probe = vbox_find_or_create_single,
+};
+
+static void vbox_fbdev_destroy(struct drm_device *dev,
+                  struct vbox_fbdev *afbdev)
+{
+    struct fb_info *info;
+    struct vbox_framebuffer *afb = &afbdev->afb;
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    if (afbdev->helper.fbdev)
+    {
+        info = afbdev->helper.fbdev;
+        unregister_framebuffer(info);
+        if (info->cmap.len)
+            fb_dealloc_cmap(&info->cmap);
+        framebuffer_release(info);
+    }
+
+    if (afb->obj)
+    {
+        drm_gem_object_unreference_unlocked(afb->obj);
+        afb->obj = NULL;
+    }
+    drm_fb_helper_fini(&afbdev->helper);
+
+    vfree(afbdev->sysram);
+    drm_framebuffer_cleanup(&afb->base);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+}
+
+int vbox_fbdev_init(struct drm_device *dev)
+{
+    struct vbox_private *vbox = dev->dev_private;
+    struct vbox_fbdev *afbdev;
+    int ret;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    afbdev = kzalloc(sizeof(struct vbox_fbdev), GFP_KERNEL);
+    if (!afbdev)
+        return -ENOMEM;
+
+    vbox->fbdev = afbdev;
+    afbdev->helper.funcs = &vbox_fb_helper_funcs;
+    ret = drm_fb_helper_init(dev, &afbdev->helper, vbox->cCrtcs, vbox->cCrtcs);
+    if (ret)
+    {
+        kfree(afbdev);
+        return ret;
+    }
+
+    drm_fb_helper_single_add_all_connectors(&afbdev->helper);
+    drm_fb_helper_initial_config(&afbdev->helper, 32);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return 0;
+}
+
+void vbox_fbdev_fini(struct drm_device *dev)
+{
+    struct vbox_private *vbox = dev->dev_private;
+
+    if (!vbox->fbdev)
+        return;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    vbox_fbdev_destroy(dev, vbox->fbdev);
+    kfree(vbox->fbdev);
+    vbox->fbdev = NULL;
+}
+
+void vbox_fbdev_set_suspend(struct drm_device *dev, int state)
+{
+    struct vbox_private *vbox = dev->dev_private;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    if (!vbox->fbdev)
+        return;
+
+    fb_set_suspend(vbox->fbdev->helper.fbdev, state);
+}
diff --git a/src/VBox/Additions/linux/drm/vbox_main.c b/src/VBox/Additions/linux/drm/vbox_main.c
new file mode 100644
index 0000000..705ebb3
--- /dev/null
+++ b/src/VBox/Additions/linux/drm/vbox_main.c
@@ -0,0 +1,533 @@
+/** @file $Id: vbox_main.c $
+ *
+ * VirtualBox Additions Linux kernel video driver
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on
+ * ast_main.c
+ * with the following copyright and permission notice:
+ *
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie <airlied at redhat.com>
+ */
+#include "vbox_drv.h"
+
+#include <VBox/VBoxVideoGuest.h>
+#include <VBox/VBoxVideo.h>
+
+#include <drm/drm_fb_helper.h>
+#include <drm/drm_crtc_helper.h>
+
+static void vbox_user_framebuffer_destroy(struct drm_framebuffer *fb)
+{
+    struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
+    if (vbox_fb->obj)
+        drm_gem_object_unreference_unlocked(vbox_fb->obj);
+
+    LogFunc(("vboxvideo: %d: vbox_fb=%p, vbox_fb->obj=%p\n", __LINE__,
+             vbox_fb, vbox_fb->obj));
+    drm_framebuffer_cleanup(fb);
+    kfree(fb);
+}
+
+static int vbox_user_framebuffer_create_handle(struct drm_framebuffer *fb,
+                          struct drm_file *file,
+                          unsigned int *handle)
+{
+    return -EINVAL;
+}
+
+/** Send information about dirty rectangles to VBVA.  If necessary we enable
+ * VBVA first, as this is normally disabled after a mode set in case a user
+ * takes over the console that is not aware of VBVA (i.e. the VESA BIOS). */
+void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
+                                       struct drm_clip_rect *pRects,
+                                       unsigned cRects)
+{
+    struct vbox_private *vbox = fb->dev->dev_private;
+    unsigned i;
+    unsigned long flags;
+
+    LogFunc(("vboxvideo: %d: fb=%p, cRects=%u, vbox=%p\n", __LINE__, fb,
+             cRects, vbox));
+    spin_lock_irqsave(&vbox->dev_lock, flags);
+    for (i = 0; i < cRects; ++i)
+    {
+        struct drm_crtc *crtc;
+        list_for_each_entry(crtc, &fb->dev->mode_config.crtc_list, head)
+        {
+            unsigned iCrtc = to_vbox_crtc(crtc)->crtc_id;
+            struct VBVABUFFER *pVBVA = vbox->paVBVACtx[iCrtc].pVBVA;
+            VBVACMDHDR cmdHdr;
+
+            if (!pVBVA)
+            {
+                pVBVA = (struct VBVABUFFER *) (  ((uint8_t *)vbox->vram)
+                                               + vbox->vram_size
+                                               + iCrtc * VBVA_MIN_BUFFER_SIZE);
+                if (!VBoxVBVAEnable(&vbox->paVBVACtx[iCrtc], &vbox->Ctx, pVBVA, iCrtc))
+                    AssertReleaseMsgFailed(("VBoxVBVAEnable failed - heap allocation error, very old host or driver error.\n"));
+            }
+            if (   CRTC_FB(crtc) != fb
+                || pRects[i].x1 >   crtc->x
+                                  + crtc->hwmode.hdisplay
+                || pRects[i].y1 >   crtc->y
+                                  + crtc->hwmode.vdisplay
+                || pRects[i].x2 < crtc->x
+                || pRects[i].y2 < crtc->y)
+                continue;
+            cmdHdr.x = (int16_t)pRects[i].x1;
+            cmdHdr.y = (int16_t)pRects[i].y1;
+            cmdHdr.w = (uint16_t)pRects[i].x2 - pRects[i].x1;
+            cmdHdr.h = (uint16_t)pRects[i].y2 - pRects[i].y1;
+            if (VBoxVBVABufferBeginUpdate(&vbox->paVBVACtx[iCrtc],
+                                          &vbox->Ctx))
+            {
+                VBoxVBVAWrite(&vbox->paVBVACtx[iCrtc], &vbox->Ctx, &cmdHdr,
+                              sizeof(cmdHdr));
+                VBoxVBVABufferEndUpdate(&vbox->paVBVACtx[iCrtc]);
+            }
+        }
+    }
+    spin_unlock_irqrestore(&vbox->dev_lock, flags);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+}
+
+static int vbox_user_framebuffer_dirty(struct drm_framebuffer *fb,
+                                       struct drm_file *file_priv,
+                                       unsigned flags, unsigned color,
+                                       struct drm_clip_rect *pRects,
+                                       unsigned cRects)
+{
+    LogFunc(("vboxvideo: %d, flags=%u\n", __LINE__, flags));
+    vbox_framebuffer_dirty_rectangles(fb, pRects, cRects);
+    return 0;
+}
+
+static const struct drm_framebuffer_funcs vbox_fb_funcs =
+{
+    .destroy = vbox_user_framebuffer_destroy,
+    .create_handle = vbox_user_framebuffer_create_handle,
+    .dirty = vbox_user_framebuffer_dirty,
+};
+
+
+int vbox_framebuffer_init(struct drm_device *dev,
+             struct vbox_framebuffer *vbox_fb,
+             struct DRM_MODE_FB_CMD *mode_cmd,
+             struct drm_gem_object *obj)
+{
+    int ret;
+
+    LogFunc(("vboxvideo: %d: dev=%p, vbox_fb=%p, obj=%p\n", __LINE__, dev,
+             vbox_fb, obj));
+    drm_helper_mode_fill_fb_struct(&vbox_fb->base, mode_cmd);
+    vbox_fb->obj = obj;
+    ret = drm_framebuffer_init(dev, &vbox_fb->base, &vbox_fb_funcs);
+    if (ret)
+    {
+        DRM_ERROR("framebuffer init failed %d\n", ret);
+        LogFunc(("vboxvideo: %d\n", __LINE__));
+        return ret;
+    }
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return 0;
+}
+
+static struct drm_framebuffer *
+vbox_user_framebuffer_create(struct drm_device *dev,
+           struct drm_file *filp,
+           struct drm_mode_fb_cmd2 *mode_cmd)
+{
+    struct drm_gem_object *obj;
+    struct vbox_framebuffer *vbox_fb;
+    int ret;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    obj = drm_gem_object_lookup(dev, filp, mode_cmd->handles[0]);
+    if (obj == NULL)
+        return ERR_PTR(-ENOENT);
+
+    vbox_fb = kzalloc(sizeof(*vbox_fb), GFP_KERNEL);
+    if (!vbox_fb)
+    {
+        drm_gem_object_unreference_unlocked(obj);
+        return ERR_PTR(-ENOMEM);
+    }
+
+    ret = vbox_framebuffer_init(dev, vbox_fb, mode_cmd, obj);
+    if (ret)
+    {
+        drm_gem_object_unreference_unlocked(obj);
+        kfree(vbox_fb);
+        return ERR_PTR(ret);
+    }
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return &vbox_fb->base;
+}
+
+static const struct drm_mode_config_funcs vbox_mode_funcs =
+{
+    .fb_create = vbox_user_framebuffer_create,
+};
+
+static void disableVBVA(struct vbox_private *pVBox)
+{
+    unsigned i;
+
+    if (pVBox->paVBVACtx)
+    {
+        for (i = 0; i < pVBox->cCrtcs; ++i)
+            VBoxVBVADisable(&pVBox->paVBVACtx[i], &pVBox->Ctx, i);
+        kfree(pVBox->paVBVACtx);
+        pVBox->paVBVACtx = NULL;
+    }
+}
+
+static int vbox_vbva_init(struct vbox_private *vbox)
+{
+    unsigned i;
+    bool fRC = true;
+    LogFunc(("vboxvideo: %d: vbox=%p, vbox->cCrtcs=%u, vbox->paVBVACtx=%p\n",
+             __LINE__, vbox, (unsigned)vbox->cCrtcs, vbox->paVBVACtx));
+    if (!vbox->paVBVACtx)
+    {
+        vbox->paVBVACtx = kzalloc(  sizeof(struct VBVABUFFERCONTEXT)
+                                  * vbox->cCrtcs,
+                                  GFP_KERNEL);
+        if (!vbox->paVBVACtx)
+            return -ENOMEM;
+    }
+    /* Take a command buffer for each screen from the end of usable VRAM. */
+    vbox->vram_size -= vbox->cCrtcs * VBVA_MIN_BUFFER_SIZE;
+    for (i = 0; i < vbox->cCrtcs; ++i)
+        VBoxVBVASetupBufferContext(&vbox->paVBVACtx[i],
+                                   vbox->vram_size + i * VBVA_MIN_BUFFER_SIZE,
+                                   VBVA_MIN_BUFFER_SIZE);
+    LogFunc(("vboxvideo: %d: vbox->paVBVACtx=%p, vbox->vram_size=%u\n",
+             __LINE__, vbox->paVBVACtx, (unsigned)vbox->vram_size));
+    return 0;
+}
+
+
+/** Allocation function for the HGSMI heap and data. */
+static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb)
+{
+    NOREF(pvEnv);
+    return kmalloc(cb, GFP_KERNEL);
+}
+
+
+/** Free function for the HGSMI heap and data. */
+static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv)
+{
+    NOREF(pvEnv);
+    kfree(pv);
+}
+
+
+/** Pointers to the HGSMI heap and data manipulation functions. */
+static HGSMIENV g_hgsmiEnv =
+{
+    NULL,
+    hgsmiEnvAlloc,
+    hgsmiEnvFree
+};
+
+
+/** Set up our heaps and data exchange buffers in VRAM before handing the rest
+ *  to the memory manager. */
+static int setupAcceleration(struct vbox_private *pVBox, uint32_t *poffBase)
+{
+    uint32_t offBase, offGuestHeap, cbGuestHeap;
+    void *pvGuestHeap;
+
+    VBoxHGSMIGetBaseMappingInfo(pVBox->full_vram_size, &offBase, NULL,
+                                &offGuestHeap, &cbGuestHeap, NULL);
+    if (poffBase)
+        *poffBase = offBase;
+    pvGuestHeap =   ((uint8_t *)pVBox->vram) + offBase + offGuestHeap;
+    if (RT_FAILURE(VBoxHGSMISetupGuestContext(&pVBox->Ctx, pvGuestHeap,
+                                              cbGuestHeap,
+                                              offBase + offGuestHeap,
+                                              &g_hgsmiEnv)))
+        return -ENOMEM;
+    /* Reduce available VRAM size to reflect the guest heap. */
+    pVBox->vram_size = offBase;
+    /* Linux drm represents monitors as a 32-bit array. */
+    pVBox->cCrtcs = RT_MIN(VBoxHGSMIGetMonitorCount(&pVBox->Ctx), 32);
+    return vbox_vbva_init(pVBox);
+}
+
+
+int vbox_driver_load(struct drm_device *dev, unsigned long flags)
+{
+    struct vbox_private *vbox;
+    int ret = 0;
+    uint32_t offBase;
+
+    LogFunc(("vboxvideo: %d: dev=%p\n", __LINE__, dev));
+    if (!VBoxHGSMIIsSupported())
+        return -ENODEV;
+    vbox = kzalloc(sizeof(struct vbox_private), GFP_KERNEL);
+    if (!vbox)
+        return -ENOMEM;
+
+    dev->dev_private = vbox;
+    vbox->dev = dev;
+
+    spin_lock_init(&vbox->dev_lock);
+    /* I hope this won't interfere with the memory manager. */
+    vbox->vram = pci_iomap(dev->pdev, 0, 0);
+    if (!vbox->vram)
+    {
+        ret = -EIO;
+        goto out_free;
+    }
+    vbox->full_vram_size = VBoxVideoGetVRAMSize();
+    vbox->fAnyX = VBoxVideoAnyWidthAllowed();
+    DRM_INFO("VRAM %08x\n", vbox->full_vram_size);
+
+    ret = setupAcceleration(vbox, &offBase);
+    if (ret)
+        goto out_free;
+
+    ret = vbox_mm_init(vbox);
+    if (ret)
+        goto out_free;
+
+    drm_mode_config_init(dev);
+
+    dev->mode_config.funcs = (void *)&vbox_mode_funcs;
+    dev->mode_config.min_width = 64;
+    dev->mode_config.min_height = 64;
+    dev->mode_config.preferred_depth = 24;
+    dev->mode_config.max_width = VBE_DISPI_MAX_XRES;
+    dev->mode_config.max_height = VBE_DISPI_MAX_YRES;
+
+    ret = vbox_mode_init(dev);
+    if (ret)
+        goto out_free;
+
+    ret = vbox_fbdev_init(dev);
+    if (ret)
+        goto out_free;
+    LogFunc(("vboxvideo: %d: vbox=%p, vbox->vram=%p, vbox->full_vram_size=%u\n",
+             __LINE__, vbox, vbox->vram, (unsigned)vbox->full_vram_size));
+    return 0;
+out_free:
+    if (vbox->vram)
+        pci_iounmap(dev->pdev, vbox->vram);
+    kfree(vbox);
+    dev->dev_private = NULL;
+    LogFunc(("vboxvideo: %d: ret=%d\n", __LINE__, ret));
+    return ret;
+}
+
+int vbox_driver_unload(struct drm_device *dev)
+{
+    struct vbox_private *vbox = dev->dev_private;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    vbox_mode_fini(dev);
+    vbox_fbdev_fini(dev);
+    drm_mode_config_cleanup(dev);
+
+    disableVBVA(vbox);
+    vbox_mm_fini(vbox);
+    pci_iounmap(dev->pdev, vbox->vram);
+    kfree(vbox);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return 0;
+}
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
+static bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper
+                                                          *pHelper)
+{
+       bool rc;
+
+       drm_modeset_lock_all(pHelper->dev);
+       rc = drm_fb_helper_restore_fbdev_mode(pHelper);
+       drm_modeset_unlock_all(pHelper->dev);
+       return rc;
+}
+#endif
+
+
+void vbox_driver_lastclose(struct drm_device *pDev)
+{
+    struct vbox_private *pVBox = pDev->dev_private;
+
+    if (pVBox->fbdev)
+        drm_fb_helper_restore_fbdev_mode_unlocked(&pVBox->fbdev->helper);
+}
+
+
+int vbox_gem_create(struct drm_device *dev,
+           u32 size, bool iskernel,
+           struct drm_gem_object **obj)
+{
+    struct vbox_bo *vboxbo;
+    int ret;
+
+    LogFunc(("vboxvideo: %d: dev=%p, size=%u, iskernel=%u\n", __LINE__,
+             dev, (unsigned)size, (unsigned)iskernel));
+    *obj = NULL;
+
+    size = roundup(size, PAGE_SIZE);
+    if (size == 0)
+        return -EINVAL;
+
+    ret = vbox_bo_create(dev, size, 0, 0, &vboxbo);
+    if (ret)
+    {
+        if (ret != -ERESTARTSYS)
+            DRM_ERROR("failed to allocate GEM object\n");
+        return ret;
+    }
+    *obj = &vboxbo->gem;
+    LogFunc(("vboxvideo: %d: obj=%p\n", __LINE__, obj));
+    return 0;
+}
+
+int vbox_dumb_create(struct drm_file *file,
+            struct drm_device *dev,
+            struct drm_mode_create_dumb *args)
+{
+    int ret;
+    struct drm_gem_object *gobj;
+    u32 handle;
+
+    LogFunc(("vboxvideo: %d: args->width=%u, args->height=%u, args->bpp=%u\n",
+             __LINE__, (unsigned)args->width, (unsigned)args->height,
+             (unsigned)args->bpp));
+    args->pitch = args->width * ((args->bpp + 7) / 8);
+    args->size = args->pitch * args->height;
+
+    ret = vbox_gem_create(dev, args->size, false,
+                 &gobj);
+    if (ret)
+        return ret;
+
+    ret = drm_gem_handle_create(file, gobj, &handle);
+    drm_gem_object_unreference_unlocked(gobj);
+    if (ret)
+        return ret;
+
+    args->handle = handle;
+    LogFunc(("vboxvideo: %d: args->handle=%u\n", __LINE__,
+             (unsigned)args->handle));
+    return 0;
+}
+
+int vbox_dumb_destroy(struct drm_file *file,
+             struct drm_device *dev,
+             uint32_t handle)
+{
+    LogFunc(("vboxvideo: %d: dev=%p, handle=%u\n", __LINE__, dev,
+             (unsigned)handle));
+    return drm_gem_handle_delete(file, handle);
+}
+
+void vbox_bo_unref(struct vbox_bo **bo)
+{
+    struct ttm_buffer_object *tbo;
+
+    if ((*bo) == NULL)
+        return;
+
+    LogFunc(("vboxvideo: %d: bo=%p\n", __LINE__, bo));
+    tbo = &((*bo)->bo);
+    ttm_bo_unref(&tbo);
+    if (tbo == NULL)
+        *bo = NULL;
+
+}
+void vbox_gem_free_object(struct drm_gem_object *obj)
+{
+    struct vbox_bo *vbox_bo = gem_to_vbox_bo(obj);
+
+    LogFunc(("vboxvideo: %d: vbox_bo=%p\n", __LINE__, vbox_bo));
+    if (!vbox_bo)
+        return;
+    vbox_bo_unref(&vbox_bo);
+}
+
+
+static inline u64 vbox_bo_mmap_offset(struct vbox_bo *bo)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
+    return bo->bo.addr_space_offset;
+#else
+    return drm_vma_node_offset_addr(&bo->bo.vma_node);
+#endif
+}
+int
+vbox_dumb_mmap_offset(struct drm_file *file,
+             struct drm_device *dev,
+             uint32_t handle,
+             uint64_t *offset)
+{
+    struct drm_gem_object *obj;
+    int ret;
+    struct vbox_bo *bo = NULL;
+
+    LogFunc(("vboxvideo: %d: dev=%p, handle=%u\n", __LINE__,
+             dev, (unsigned)handle));
+    mutex_lock(&dev->struct_mutex);
+    obj = drm_gem_object_lookup(dev, file, handle);
+    if (obj == NULL)
+    {
+        ret = -ENOENT;
+        goto out_unlock;
+    }
+
+    bo = gem_to_vbox_bo(obj);
+    *offset = vbox_bo_mmap_offset(bo);
+
+    drm_gem_object_unreference(obj);
+    ret = 0;
+out_unlock:
+    mutex_unlock(&dev->struct_mutex);
+    LogFunc(("vboxvideo: %d: bo=%p, offset=%llu\n", __LINE__,
+             bo, (unsigned long long)*offset));
+    return ret;
+
+}
diff --git a/src/VBox/Additions/linux/drm/vbox_mode.c b/src/VBox/Additions/linux/drm/vbox_mode.c
new file mode 100644
index 0000000..ec0ae54
--- /dev/null
+++ b/src/VBox/Additions/linux/drm/vbox_mode.c
@@ -0,0 +1,727 @@
+/** @file $Id: vbox_mode.c $
+ *
+ * VirtualBox Additions Linux kernel video driver
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on
+ * ast_mode.c
+ * with the following copyright and permission notice:
+ *
+ * Copyright 2012 Red Hat Inc.
+ * Parts based on xf86-video-vbox
+ * Copyright (c) 2005 ASPEED Technology Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie <airlied at redhat.com>
+ */
+#include "vbox_drv.h"
+
+#include <VBox/VBoxVideo.h>
+
+#include <linux/export.h>
+#include <drm/drm_crtc_helper.h>
+
+static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
+                            uint32_t handle, uint32_t width, uint32_t height,
+                            int32_t hot_x, int32_t hot_y);
+static int vbox_cursor_move(struct drm_crtc *crtc, int x, int y);
+
+/** Set a graphics mode.  Poke any required values into registers, do an HGSMI
+ * mode set and tell the host we support advanced graphics functions.
+ */
+static void vbox_do_modeset(struct drm_crtc *crtc,
+                            const struct drm_display_mode *mode)
+{
+    struct vbox_crtc   *vbox_crtc = to_vbox_crtc(crtc);
+    struct vbox_private *vbox;
+    int width, height, cBPP, pitch;
+    unsigned iCrtc;
+    uint16_t fFlags;
+
+    LogFunc(("vboxvideo: %d: vbox_crtc=%p, CRTC_FB(crtc)=%p\n", __LINE__,
+             vbox_crtc, CRTC_FB(crtc)));
+    vbox = crtc->dev->dev_private;
+    width = mode->hdisplay ? mode->hdisplay : 640;
+    height = mode->vdisplay ? mode->vdisplay : 480;
+    iCrtc = vbox_crtc->crtc_id;
+    cBPP = crtc->enabled ? CRTC_FB(crtc)->bits_per_pixel : 32;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
+    pitch = crtc->enabled ? CRTC_FB(crtc)->pitch : width * cBPP / 8;
+#else
+    pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * cBPP / 8;
+#endif
+    /* if (vbox_crtc->crtc_id == 0 && crtc->enabled)
+        VBoxVideoSetModeRegisters(width, height, pitch * 8 / cBPP,
+                                  CRTC_FB(crtc)->bits_per_pixel, 0,
+                                  crtc->x, crtc->y); */
+    fFlags = VBVA_SCREEN_F_ACTIVE;
+    fFlags |= (crtc->enabled ? 0 : VBVA_SCREEN_F_DISABLED);
+    VBoxHGSMIProcessDisplayInfo(&vbox->Ctx, vbox_crtc->crtc_id,
+                                crtc->x, crtc->y,
+                                crtc->x * cBPP / 8 + crtc->y * pitch,
+                                pitch, width, height,
+                                vbox_crtc->fBlanked ? 0 : cBPP, fFlags);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+}
+
+static int vbox_set_view(struct drm_crtc *crtc)
+{
+    struct vbox_crtc   *vbox_crtc = to_vbox_crtc(crtc);
+    struct vbox_private *vbox = crtc->dev->dev_private;
+    void *p;
+
+    LogFunc(("vboxvideo: %d: vbox_crtc=%p\n", __LINE__, vbox_crtc));
+    /* Tell the host about the view.  This design originally targeted the
+     * Windows XP driver architecture and assumed that each screen would have
+     * a dedicated frame buffer with the command buffer following it, the whole
+     * being a "view".  The host works out which screen a command buffer belongs
+     * to by checking whether it is in the first view, then whether it is in the
+     * second and so on.  The first match wins.  We cheat around this by making
+     * the first view be the managed memory plus the first command buffer, the
+     * second the same plus the second buffer and so on. */
+    p = VBoxHGSMIBufferAlloc(&vbox->Ctx, sizeof(VBVAINFOVIEW), HGSMI_CH_VBVA,
+                             VBVA_INFO_VIEW);
+    if (p)
+    {
+        VBVAINFOVIEW *pInfo = (VBVAINFOVIEW *)p;
+        pInfo->u32ViewIndex = vbox_crtc->crtc_id;
+        pInfo->u32ViewOffset = vbox_crtc->offFB;
+        pInfo->u32ViewSize =   vbox->vram_size - vbox_crtc->offFB
+                             + vbox_crtc->crtc_id * VBVA_MIN_BUFFER_SIZE;
+        pInfo->u32MaxScreenSize = vbox->vram_size - vbox_crtc->offFB;
+        VBoxHGSMIBufferSubmit(&vbox->Ctx, p);
+        VBoxHGSMIBufferFree(&vbox->Ctx, p);
+    }
+    else
+        return -ENOMEM;
+    LogFunc(("vboxvideo: %d: p=%p\n", __LINE__, p));
+    return 0;
+}
+
+static void vbox_crtc_load_lut(struct drm_crtc *crtc)
+{
+
+}
+
+static void vbox_crtc_dpms(struct drm_crtc *crtc, int mode)
+{
+    struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
+    struct vbox_private *vbox = crtc->dev->dev_private;
+    unsigned long flags;
+
+    LogFunc(("vboxvideo: %d: vbox_crtc=%p, mode=%d\n", __LINE__, vbox_crtc,
+             mode));
+    switch (mode)
+    {
+    case DRM_MODE_DPMS_ON:
+        vbox_crtc->fBlanked = false;
+        break;
+    case DRM_MODE_DPMS_STANDBY:
+    case DRM_MODE_DPMS_SUSPEND:
+    case DRM_MODE_DPMS_OFF:
+        vbox_crtc->fBlanked = true;
+        break;
+    }
+    spin_lock_irqsave(&vbox->dev_lock, flags);
+    vbox_do_modeset(crtc, &crtc->hwmode);
+    spin_unlock_irqrestore(&vbox->dev_lock, flags);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+}
+
+static bool vbox_crtc_mode_fixup(struct drm_crtc *crtc,
+                const struct drm_display_mode *mode,
+                struct drm_display_mode *adjusted_mode)
+{
+    return true;
+}
+
+static int vbox_crtc_do_set_base(struct drm_crtc *crtc,
+                struct drm_framebuffer *fb,
+                int x, int y, int atomic)
+{
+    struct vbox_private *vbox = crtc->dev->dev_private;
+    struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
+    struct drm_gem_object *obj;
+    struct vbox_framebuffer *vbox_fb;
+    struct vbox_bo *bo;
+    int ret;
+    u64 gpu_addr;
+
+    LogFunc(("vboxvideo: %d: fb=%p, vbox_crtc=%p\n", __LINE__, fb, vbox_crtc));
+
+    vbox_fb = to_vbox_framebuffer(CRTC_FB(crtc));
+    obj = vbox_fb->obj;
+    bo = gem_to_vbox_bo(obj);
+
+    ret = vbox_bo_reserve(bo, false);
+    if (ret)
+        return ret;
+
+    ret = vbox_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr);
+    if (ret)
+    {
+        vbox_bo_unreserve(bo);
+        return ret;
+    }
+
+    if (&vbox->fbdev->afb == vbox_fb)
+    {
+        /* if pushing console in kmap it */
+        ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
+        if (ret)
+            DRM_ERROR("failed to kmap fbcon\n");
+    }
+    vbox_bo_unreserve(bo);
+
+    /* vbox_set_start_address_crt1(crtc, (u32)gpu_addr); */
+    vbox_crtc->offFB = gpu_addr;
+
+    LogFunc(("vboxvideo: %d: vbox_fb=%p, obj=%p, bo=%p, gpu_addr=%u\n",
+             __LINE__, vbox_fb, obj, bo, (unsigned)gpu_addr));
+    return 0;
+}
+
+static int vbox_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
+                 struct drm_framebuffer *old_fb)
+{
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return vbox_crtc_do_set_base(crtc, old_fb, x, y, 0);
+}
+
+static int vbox_crtc_mode_set(struct drm_crtc *crtc,
+                 struct drm_display_mode *mode,
+                 struct drm_display_mode *adjusted_mode,
+                 int x, int y,
+                 struct drm_framebuffer *old_fb)
+{
+    struct vbox_private *vbox = crtc->dev->dev_private;
+    unsigned long flags;
+    int rc = 0;
+
+    LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox));
+    vbox_crtc_mode_set_base(crtc, x, y, old_fb);
+    spin_lock_irqsave(&vbox->dev_lock, flags);
+    rc = vbox_set_view(crtc);
+    if (!rc)
+        vbox_do_modeset(crtc, mode);
+    spin_unlock_irqrestore(&vbox->dev_lock, flags);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return rc;
+}
+
+static void vbox_crtc_disable(struct drm_crtc *crtc)
+{
+
+}
+
+static void vbox_crtc_prepare(struct drm_crtc *crtc)
+{
+
+}
+
+static void vbox_crtc_commit(struct drm_crtc *crtc)
+{
+
+}
+
+
+static const struct drm_crtc_helper_funcs vbox_crtc_helper_funcs =
+{
+    .dpms = vbox_crtc_dpms,
+    .mode_fixup = vbox_crtc_mode_fixup,
+    .mode_set = vbox_crtc_mode_set,
+    /* .mode_set_base = vbox_crtc_mode_set_base, */
+    .disable = vbox_crtc_disable,
+    .load_lut = vbox_crtc_load_lut,
+    .prepare = vbox_crtc_prepare,
+    .commit = vbox_crtc_commit,
+
+};
+
+static void vbox_crtc_reset(struct drm_crtc *crtc)
+{
+
+}
+
+
+static void vbox_crtc_destroy(struct drm_crtc *crtc)
+{
+    drm_crtc_cleanup(crtc);
+    kfree(crtc);
+}
+
+static const struct drm_crtc_funcs vbox_crtc_funcs =
+{
+    .cursor_move = vbox_cursor_move,
+#ifdef DRM_IOCTL_MODE_CURSOR2
+    .cursor_set2 = vbox_cursor_set2,
+#endif
+    .reset = vbox_crtc_reset,
+    .set_config = drm_crtc_helper_set_config,
+    /* .gamma_set = vbox_crtc_gamma_set, */
+    .destroy = vbox_crtc_destroy,
+};
+
+int vbox_crtc_init(struct drm_device *pDev, unsigned i)
+{
+    struct vbox_crtc *pCrtc;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    pCrtc = kzalloc(sizeof(struct vbox_crtc), GFP_KERNEL);
+    if (!pCrtc)
+        return -ENOMEM;
+    pCrtc->crtc_id = i;
+
+    drm_crtc_init(pDev, &pCrtc->base, &vbox_crtc_funcs);
+    drm_mode_crtc_set_gamma_size(&pCrtc->base, 256);
+    drm_crtc_helper_add(&pCrtc->base, &vbox_crtc_helper_funcs);
+    LogFunc(("vboxvideo: %d: pCrtc=%p\n", __LINE__, pCrtc));
+
+    return 0;
+}
+
+
+static void vbox_encoder_destroy(struct drm_encoder *encoder)
+{
+    LogFunc(("vboxvideo: %d: encoder=%p\n", __LINE__, encoder));
+    drm_encoder_cleanup(encoder);
+    kfree(encoder);
+}
+
+
+static struct drm_encoder *vbox_best_single_encoder(struct drm_connector *connector)
+{
+    int enc_id = connector->encoder_ids[0];
+    struct drm_mode_object *obj;
+    struct drm_encoder *encoder;
+
+    LogFunc(("vboxvideo: %d: connector=%p\n", __LINE__, connector));
+    /* pick the encoder ids */
+    if (enc_id)
+    {
+        obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER);
+        if (!obj)
+            return NULL;
+        encoder = obj_to_encoder(obj);
+        LogFunc(("vboxvideo: %d: encoder=%p\n", __LINE__, encoder));
+        return encoder;
+    }
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return NULL;
+}
+
+
+static const struct drm_encoder_funcs vbox_enc_funcs =
+{
+    .destroy = vbox_encoder_destroy,
+};
+
+static void vbox_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+
+}
+
+static bool vbox_mode_fixup(struct drm_encoder *encoder,
+               const struct drm_display_mode *mode,
+               struct drm_display_mode *adjusted_mode)
+{
+    return true;
+}
+
+static void vbox_encoder_mode_set(struct drm_encoder *encoder,
+                   struct drm_display_mode *mode,
+                   struct drm_display_mode *adjusted_mode)
+{
+}
+
+static void vbox_encoder_prepare(struct drm_encoder *encoder)
+{
+
+}
+
+static void vbox_encoder_commit(struct drm_encoder *encoder)
+{
+
+}
+
+
+static const struct drm_encoder_helper_funcs vbox_enc_helper_funcs =
+{
+    .dpms = vbox_encoder_dpms,
+    .mode_fixup = vbox_mode_fixup,
+    .prepare = vbox_encoder_prepare,
+    .commit = vbox_encoder_commit,
+    .mode_set = vbox_encoder_mode_set,
+};
+
+struct drm_encoder *vbox_encoder_init(struct drm_device *dev, unsigned i)
+{
+    struct vbox_encoder *vbox_encoder;
+
+    LogFunc(("vboxvideo: %d: dev=%d\n", __LINE__));
+    vbox_encoder = kzalloc(sizeof(struct vbox_encoder), GFP_KERNEL);
+    if (!vbox_encoder)
+        return NULL;
+
+    drm_encoder_init(dev, &vbox_encoder->base, &vbox_enc_funcs,
+             DRM_MODE_ENCODER_DAC);
+    drm_encoder_helper_add(&vbox_encoder->base, &vbox_enc_helper_funcs);
+
+    vbox_encoder->base.possible_crtcs = 1 << i;
+    LogFunc(("vboxvideo: %d: vbox_encoder=%p\n", __LINE__, vbox_encoder));
+    return &vbox_encoder->base;
+}
+
+static int vbox_get_modes(struct drm_connector *pConnector)
+{
+    struct vbox_connector *pVBoxConnector = NULL;
+    struct drm_display_mode *pMode = NULL;
+    unsigned cModes = 0;
+
+    LogFunc(("vboxvideo: %d: pConnector=%p\n", __LINE__, pConnector));
+    pVBoxConnector = to_vbox_connector(pConnector);
+    cModes = drm_add_modes_noedid(pConnector, 1024, 768);
+    if (pVBoxConnector->modeHint.cX && pVBoxConnector->modeHint.cY)
+    {
+        pMode = drm_cvt_mode(pConnector->dev, pVBoxConnector->modeHint.cX,
+                             pVBoxConnector->modeHint.cY, 60, false, false,
+                             false);
+        if (pMode)
+        {
+            pMode->type |= DRM_MODE_TYPE_PREFERRED;
+            drm_mode_probed_add(pConnector, pMode);
+            ++cModes;
+        }
+    }
+    return cModes;
+}
+
+static int vbox_mode_valid(struct drm_connector *connector,
+              struct drm_display_mode *mode)
+{
+    return MODE_OK;
+}
+
+static void vbox_connector_destroy(struct drm_connector *pConnector)
+{
+    struct vbox_connector *pVBoxConnector = NULL;
+
+    LogFunc(("vboxvideo: %d: connector=%p\n", __LINE__, pConnector));
+    pVBoxConnector = to_vbox_connector(pConnector);
+    device_remove_file(pConnector->dev->dev, &pVBoxConnector->deviceAttribute);
+    drm_sysfs_connector_remove(pConnector);
+    drm_connector_cleanup(pConnector);
+    kfree(pConnector);
+}
+
+static enum drm_connector_status
+vbox_connector_detect(struct drm_connector *connector, bool force)
+{
+    return connector_status_connected;
+}
+
+static const struct drm_connector_helper_funcs vbox_connector_helper_funcs =
+{
+    .mode_valid = vbox_mode_valid,
+    .get_modes = vbox_get_modes,
+    .best_encoder = vbox_best_single_encoder,
+};
+
+static const struct drm_connector_funcs vbox_connector_funcs =
+{
+    .dpms = drm_helper_connector_dpms,
+    .detect = vbox_connector_detect,
+    .fill_modes = drm_helper_probe_single_connector_modes,
+    .destroy = vbox_connector_destroy,
+};
+
+ssize_t vbox_connector_write_sysfs(struct device *pDev,
+                                   struct device_attribute *pAttr,
+                                   const char *psz, size_t cch)
+{
+    struct vbox_connector *pVBoxConnector;
+    struct drm_device *pDrmDev;
+    struct vbox_private *pVBox;
+    int cX, cY;
+    char ch;
+
+    LogFunc(("vboxvideo: %d: pDev=%p, pAttr=%p, psz=%s, cch=%llu\n", __LINE__,
+             pDev, pAttr, psz, (unsigned long long)cch));
+    pVBoxConnector = container_of(pAttr, struct vbox_connector,
+                                  deviceAttribute);
+    pDrmDev = pVBoxConnector->base.dev;
+    pVBox = pDrmDev->dev_private;
+    if (sscanf(psz, "%5dx%5d\n%c", &cX, &cY, &ch) != 2)
+        return -EINVAL;
+    if (   cX < 64 || cX > VBE_DISPI_MAX_XRES
+        || cY < 64 || cY > VBE_DISPI_MAX_YRES)
+        return -EINVAL;
+    pVBoxConnector->modeHint.cX = (uint16_t)cX;
+    pVBoxConnector->modeHint.cY = (uint16_t)cY;
+    drm_helper_hpd_irq_event(pVBoxConnector->base.dev);
+    if (pVBox->fbdev)
+        drm_fb_helper_hotplug_event(&pVBox->fbdev->helper);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    return cch;
+}
+
+int vbox_connector_init(struct drm_device *pDev, unsigned cScreen,
+                        struct drm_encoder *pEncoder)
+{
+    struct vbox_connector *pVBoxConnector;
+    struct drm_connector *pConnector;
+    int rc;
+
+    LogFunc(("vboxvideo: %d: pDev=%p, pEncoder=%p\n", __LINE__, pDev,
+             pEncoder));
+    pVBoxConnector = kzalloc(sizeof(struct vbox_connector), GFP_KERNEL);
+    if (!pVBoxConnector)
+        return -ENOMEM;
+
+    pConnector = &pVBoxConnector->base;
+
+    /*
+     * Set up the sysfs file we use for getting video mode hints from user
+     * space.
+     */
+    snprintf(pVBoxConnector->szName, sizeof(pVBoxConnector->szName),
+             "vbox_screen_%u", cScreen);
+    pVBoxConnector->deviceAttribute.attr.name = pVBoxConnector->szName;
+    pVBoxConnector->deviceAttribute.attr.mode = S_IWUSR;
+    pVBoxConnector->deviceAttribute.show      = NULL;
+    pVBoxConnector->deviceAttribute.store     = vbox_connector_write_sysfs;
+    rc = device_create_file(pDev->dev, &pVBoxConnector->deviceAttribute);
+    if (rc < 0)
+    {
+        kfree(pVBoxConnector);
+        return rc;
+    }
+    drm_connector_init(pDev, pConnector, &vbox_connector_funcs,
+                       DRM_MODE_CONNECTOR_VGA);
+    drm_connector_helper_add(pConnector, &vbox_connector_helper_funcs);
+
+    pConnector->interlace_allowed = 0;
+    pConnector->doublescan_allowed = 0;
+
+    drm_sysfs_connector_add(pConnector);
+
+    /* The connector supports hot-plug detection: we promise to call
+     * "drm_helper_hpd_irq_event" when hot-plugging occurs. */
+    pConnector->polled = DRM_CONNECTOR_POLL_HPD;
+
+    drm_mode_connector_attach_encoder(pConnector, pEncoder);
+
+    LogFunc(("vboxvideo: %d: pConnector=%p\n", __LINE__, pConnector));
+    return 0;
+}
+
+#if 0
+/* allocate cursor cache and pin at start of VRAM */
+int vbox_cursor_init(struct drm_device *dev)
+{
+    struct vbox_private *vbox = dev->dev_private;
+    int size;
+    int ret;
+    struct drm_gem_object *obj;
+    struct vbox_bo *bo;
+    uint64_t gpu_addr;
+
+    size = (AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE) * AST_DEFAULT_HWC_NUM;
+
+    ret = vbox_gem_create(dev, size, true, &obj);
+    if (ret)
+        return ret;
+    bo = gem_to_vbox_bo(obj);
+    ret = vbox_bo_reserve(bo, false);
+    if (unlikely(ret != 0))
+        goto fail;
+
+    ret = vbox_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr);
+    vbox_bo_unreserve(bo);
+    if (ret)
+        goto fail;
+
+    /* kmap the object */
+    ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &vbox->cache_kmap);
+    if (ret)
+        goto fail;
+
+    vbox->cursor_cache = obj;
+    vbox->cursor_cache_gpu_addr = gpu_addr;
+    DRM_DEBUG_KMS("pinned cursor cache at %llx\n", vbox->cursor_cache_gpu_addr);
+    return 0;
+fail:
+    return ret;
+}
+
+void vbox_cursor_fini(struct drm_device *dev)
+{
+    struct vbox_private *vbox = dev->dev_private;
+    ttm_bo_kunmap(&vbox->cache_kmap);
+    drm_gem_object_unreference_unlocked(vbox->cursor_cache);
+}
+#endif
+
+int vbox_mode_init(struct drm_device *pDev)
+{
+    struct vbox_private *pVBox = pDev->dev_private;
+    struct drm_encoder *pEncoder;
+    unsigned i;
+    /* vbox_cursor_init(dev); */
+    LogFunc(("vboxvideo: %d: pDev=%p\n", __LINE__, pDev));
+    for (i = 0; i < pVBox->cCrtcs; ++i)
+    {
+        vbox_crtc_init(pDev, i);
+        pEncoder = vbox_encoder_init(pDev, i);
+        if (pEncoder)
+            vbox_connector_init(pDev, i, pEncoder);
+    }
+    return 0;
+}
+
+void vbox_mode_fini(struct drm_device *dev)
+{
+    /* vbox_cursor_fini(dev); */
+}
+
+
+void VBoxRefreshModes(struct drm_device *pDev)
+{
+    struct vbox_private *vbox = pDev->dev_private;
+    struct drm_crtc *crtci;
+    unsigned long flags;
+
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+    spin_lock_irqsave(&vbox->dev_lock, flags);
+    list_for_each_entry(crtci, &pDev->mode_config.crtc_list, head)
+        vbox_do_modeset(crtci, &crtci->hwmode);
+    spin_unlock_irqrestore(&vbox->dev_lock, flags);
+    LogFunc(("vboxvideo: %d\n", __LINE__));
+}
+
+
+/** Copy the ARGB image and generate the mask, which is needed in case the host
+ *  does not support ARGB cursors.  The mask is a 1BPP bitmap with the bit set
+ *  if the corresponding alpha value in the ARGB image is greater than 0xF0. */
+static void copy_cursor_image(u8 *src, u8 *dst, int width, int height,
+                              size_t cbMask)
+{
+    unsigned i, j;
+    size_t cbLine = (width + 7) / 8;
+
+    memcpy(dst + cbMask, src, width * height * 4);
+    for (i = 0; i < height; ++i)
+        for (j = 0; j < width; ++j)
+            if (((uint32_t *)src)[i * width + j] > 0xf0000000)
+                dst[i * cbLine + j / 8] |= (0x80 >> (j % 8));
+}
+
+static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
+                            uint32_t handle, uint32_t width, uint32_t height,
+                            int32_t hot_x, int32_t hot_y)
+{
+    struct vbox_private *vbox = crtc->dev->dev_private;
+    struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
+    struct drm_gem_object *obj;
+    struct vbox_bo *bo;
+    int ret, rc;
+    struct ttm_bo_kmap_obj uobj_map;
+    u8 *src;
+    u8 *dst = NULL;
+    size_t cbData, cbMask;
+    bool src_isiomem;
+
+    if (!handle) {
+        /* Hide cursor. */
+        VBoxHGSMIUpdatePointerShape(&vbox->Ctx, 0, 0, 0, 0, 0, NULL, 0);
+        return 0;
+    }
+    if (   width > VBOX_MAX_CURSOR_WIDTH || height > VBOX_MAX_CURSOR_HEIGHT
+        || width == 0 || hot_x > width || height == 0 || hot_y > height)
+        return -EINVAL;
+
+    obj = drm_gem_object_lookup(crtc->dev, file_priv, handle);
+    if (obj)
+    {
+        bo = gem_to_vbox_bo(obj);
+        ret = vbox_bo_reserve(bo, false);
+        if (!ret)
+        {
+            /* The mask must be calculated based on the alpha channel, one bit
+             * per ARGB word, and must be 32-bit padded. */
+            cbMask  = ((width + 7) / 8 * height + 3) & ~3;
+            cbData = width * height * 4 + cbMask;
+            dst = kmalloc(cbData, GFP_KERNEL);
+            if (dst)
+            {
+                ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map);
+                if (!ret)
+                {
+                    src = ttm_kmap_obj_virtual(&uobj_map, &src_isiomem);
+                    if (!src_isiomem)
+                    {
+                        uint32_t fFlags =   VBOX_MOUSE_POINTER_VISIBLE
+                                          | VBOX_MOUSE_POINTER_SHAPE
+                                          | VBOX_MOUSE_POINTER_ALPHA;
+                        copy_cursor_image(src, dst, width, height, cbMask);
+                        rc = VBoxHGSMIUpdatePointerShape(&vbox->Ctx, fFlags,
+                                                         hot_x, hot_y, width,
+                                                         height, dst, cbData);
+                        ret = RTErrConvertToErrno(rc);
+                    }
+                    else
+                        DRM_ERROR("src cursor bo should be in main memory\n");
+                    ttm_bo_kunmap(&uobj_map);
+                }
+                kfree(dst);
+            }
+            vbox_bo_unreserve(bo);
+        }
+        drm_gem_object_unreference_unlocked(obj);
+    }
+    else
+    {
+        DRM_ERROR("Cannot find cursor object %x for crtc\n", handle);
+        ret = -ENOENT;
+    }
+    return ret;
+}
+
+static int vbox_cursor_move(struct drm_crtc *crtc,
+               int x, int y)
+{
+    return 0;
+}
diff --git a/src/VBox/Additions/linux/drm/vbox_ttm.c b/src/VBox/Additions/linux/drm/vbox_ttm.c
new file mode 100644
index 0000000..3f04f20
--- /dev/null
+++ b/src/VBox/Additions/linux/drm/vbox_ttm.c
@@ -0,0 +1,513 @@
+/** @file $Id: vbox_ttm.c $
+ *
+ * VirtualBox Additions Linux kernel video driver
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on
+ * ast_ttm.c
+ * with the following copyright and permission notice:
+ *
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+/*
+ * Authors: Dave Airlie <airlied at redhat.com>
+ */
+#include "vbox_drv.h"
+#include <ttm/ttm_page_alloc.h>
+
+static inline struct vbox_private *
+vbox_bdev(struct ttm_bo_device *bd)
+{
+    return container_of(bd, struct vbox_private, ttm.bdev);
+}
+
+static int
+vbox_ttm_mem_global_init(struct drm_global_reference *ref)
+{
+    return ttm_mem_global_init(ref->object);
+}
+
+static void
+vbox_ttm_mem_global_release(struct drm_global_reference *ref)
+{
+    ttm_mem_global_release(ref->object);
+}
+
+/**
+ * Adds the vbox memory manager object/structures to the global memory manager.
+ */
+static int vbox_ttm_global_init(struct vbox_private *vbox)
+{
+    struct drm_global_reference *global_ref;
+    int r;
+
+    global_ref = &vbox->ttm.mem_global_ref;
+    global_ref->global_type = DRM_GLOBAL_TTM_MEM;
+    global_ref->size = sizeof(struct ttm_mem_global);
+    global_ref->init = &vbox_ttm_mem_global_init;
+    global_ref->release = &vbox_ttm_mem_global_release;
+    r = drm_global_item_ref(global_ref);
+    if (r != 0)
+    {
+        DRM_ERROR("Failed setting up TTM memory accounting "
+              "subsystem.\n");
+        return r;
+    }
+
+    vbox->ttm.bo_global_ref.mem_glob =
+        vbox->ttm.mem_global_ref.object;
+    global_ref = &vbox->ttm.bo_global_ref.ref;
+    global_ref->global_type = DRM_GLOBAL_TTM_BO;
+    global_ref->size = sizeof(struct ttm_bo_global);
+    global_ref->init = &ttm_bo_global_init;
+    global_ref->release = &ttm_bo_global_release;
+    r = drm_global_item_ref(global_ref);
+    if (r != 0)
+    {
+        DRM_ERROR("Failed setting up TTM BO subsystem.\n");
+        drm_global_item_unref(&vbox->ttm.mem_global_ref);
+        return r;
+    }
+    return 0;
+}
+
+/**
+ * Removes the vbox memory manager object from the global memory manager.
+ */
+void
+vbox_ttm_global_release(struct vbox_private *vbox)
+{
+    if (vbox->ttm.mem_global_ref.release == NULL)
+        return;
+
+    drm_global_item_unref(&vbox->ttm.bo_global_ref.ref);
+    drm_global_item_unref(&vbox->ttm.mem_global_ref);
+    vbox->ttm.mem_global_ref.release = NULL;
+}
+
+
+static void vbox_bo_ttm_destroy(struct ttm_buffer_object *tbo)
+{
+    struct vbox_bo *bo;
+
+    bo = container_of(tbo, struct vbox_bo, bo);
+
+    drm_gem_object_release(&bo->gem);
+    kfree(bo);
+}
+
+bool vbox_ttm_bo_is_vbox_bo(struct ttm_buffer_object *bo)
+{
+    if (bo->destroy == &vbox_bo_ttm_destroy)
+        return true;
+    return false;
+}
+
+static int
+vbox_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
+             struct ttm_mem_type_manager *man)
+{
+    switch (type)
+    {
+    case TTM_PL_SYSTEM:
+        man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
+        man->available_caching = TTM_PL_MASK_CACHING;
+        man->default_caching = TTM_PL_FLAG_CACHED;
+        break;
+    case TTM_PL_VRAM:
+        man->func = &ttm_bo_manager_func;
+        man->flags = TTM_MEMTYPE_FLAG_FIXED |
+            TTM_MEMTYPE_FLAG_MAPPABLE;
+        man->available_caching = TTM_PL_FLAG_UNCACHED |
+            TTM_PL_FLAG_WC;
+        man->default_caching = TTM_PL_FLAG_WC;
+        break;
+    default:
+        DRM_ERROR("Unsupported memory type %u\n", (unsigned)type);
+        return -EINVAL;
+    }
+    return 0;
+}
+
+static void
+vbox_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl)
+{
+    struct vbox_bo *vboxbo = vbox_bo(bo);
+
+    if (!vbox_ttm_bo_is_vbox_bo(bo))
+        return;
+
+    vbox_ttm_placement(vboxbo, TTM_PL_FLAG_SYSTEM);
+    *pl = vboxbo->placement;
+}
+
+static int vbox_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp)
+{
+    return 0;
+}
+
+static int vbox_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
+                  struct ttm_mem_reg *mem)
+{
+    struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
+    struct vbox_private *vbox = vbox_bdev(bdev);
+
+    mem->bus.addr = NULL;
+    mem->bus.offset = 0;
+    mem->bus.size = mem->num_pages << PAGE_SHIFT;
+    mem->bus.base = 0;
+    mem->bus.is_iomem = false;
+    if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE))
+        return -EINVAL;
+    switch (mem->mem_type)
+    {
+    case TTM_PL_SYSTEM:
+        /* system memory */
+        return 0;
+    case TTM_PL_VRAM:
+        mem->bus.offset = mem->start << PAGE_SHIFT;
+        mem->bus.base = pci_resource_start(vbox->dev->pdev, 0);
+        mem->bus.is_iomem = true;
+        break;
+    default:
+        return -EINVAL;
+        break;
+    }
+    return 0;
+}
+
+static void vbox_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
+{
+}
+
+static int vbox_bo_move(struct ttm_buffer_object *bo,
+               bool evict, bool interruptible,
+               bool no_wait_gpu,
+               struct ttm_mem_reg *new_mem)
+{
+    int r;
+    r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
+    return r;
+}
+
+
+static void vbox_ttm_backend_destroy(struct ttm_tt *tt)
+{
+    ttm_tt_fini(tt);
+    kfree(tt);
+}
+
+static struct ttm_backend_func vbox_tt_backend_func =
+{
+    .destroy = &vbox_ttm_backend_destroy,
+};
+
+
+struct ttm_tt *vbox_ttm_tt_create(struct ttm_bo_device *bdev,
+                 unsigned long size, uint32_t page_flags,
+                 struct page *dummy_read_page)
+{
+    struct ttm_tt *tt;
+
+    tt = kzalloc(sizeof(struct ttm_tt), GFP_KERNEL);
+    if (tt == NULL)
+        return NULL;
+    tt->func = &vbox_tt_backend_func;
+    if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page))
+    {
+        kfree(tt);
+        return NULL;
+    }
+    return tt;
+}
+
+static int vbox_ttm_tt_populate(struct ttm_tt *ttm)
+{
+    return ttm_pool_populate(ttm);
+}
+
+static void vbox_ttm_tt_unpopulate(struct ttm_tt *ttm)
+{
+    ttm_pool_unpopulate(ttm);
+}
+
+struct ttm_bo_driver vbox_bo_driver =
+{
+    .ttm_tt_create = vbox_ttm_tt_create,
+    .ttm_tt_populate = vbox_ttm_tt_populate,
+    .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate,
+    .init_mem_type = vbox_bo_init_mem_type,
+    .evict_flags = vbox_bo_evict_flags,
+    .move = vbox_bo_move,
+    .verify_access = vbox_bo_verify_access,
+    .io_mem_reserve = &vbox_ttm_io_mem_reserve,
+    .io_mem_free = &vbox_ttm_io_mem_free,
+};
+
+int vbox_mm_init(struct vbox_private *vbox)
+{
+    int ret;
+    struct drm_device *dev = vbox->dev;
+    struct ttm_bo_device *bdev = &vbox->ttm.bdev;
+
+    ret = vbox_ttm_global_init(vbox);
+    if (ret)
+        return ret;
+
+    ret = ttm_bo_device_init(&vbox->ttm.bdev,
+                 vbox->ttm.bo_global_ref.ref.object,
+                 &vbox_bo_driver,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)
+                 dev->anon_inode->i_mapping,
+#endif
+                 DRM_FILE_PAGE_OFFSET,
+                 true);
+    if (ret)
+    {
+        DRM_ERROR("Error initialising bo driver; %d\n", ret);
+        return ret;
+    }
+
+    ret = ttm_bo_init_mm(bdev, TTM_PL_VRAM,
+                 vbox->vram_size >> PAGE_SHIFT);
+    if (ret)
+    {
+        DRM_ERROR("Failed ttm VRAM init: %d\n", ret);
+        return ret;
+    }
+
+#ifdef DRM_MTRR_WC
+    vbox->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 0),
+                    pci_resource_len(dev->pdev, 0),
+                    DRM_MTRR_WC);
+#else
+    vbox->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
+                    pci_resource_len(dev->pdev, 0));
+#endif
+
+    return 0;
+}
+
+void vbox_mm_fini(struct vbox_private *vbox)
+{
+    struct drm_device *dev = vbox->dev;
+    ttm_bo_device_release(&vbox->ttm.bdev);
+
+    vbox_ttm_global_release(vbox);
+
+    if (vbox->fb_mtrr >= 0)
+    {
+#ifdef DRM_MTRR_WC
+        drm_mtrr_del(vbox->fb_mtrr,
+                 pci_resource_start(dev->pdev, 0),
+                 pci_resource_len(dev->pdev, 0), DRM_MTRR_WC);
+#else
+        arch_phys_wc_del(vbox->fb_mtrr);
+#endif
+        vbox->fb_mtrr = -1;
+    }
+}
+
+void vbox_ttm_placement(struct vbox_bo *bo, int domain)
+{
+    u32 c = 0;
+    bo->placement.fpfn = 0;
+    bo->placement.lpfn = 0;
+    bo->placement.placement = bo->placements;
+    bo->placement.busy_placement = bo->placements;
+    if (domain & TTM_PL_FLAG_VRAM)
+        bo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
+    if (domain & TTM_PL_FLAG_SYSTEM)
+        bo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
+    if (!c)
+        bo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
+    bo->placement.num_placement = c;
+    bo->placement.num_busy_placement = c;
+}
+
+int vbox_bo_reserve(struct vbox_bo *bo, bool no_wait)
+{
+    int ret;
+
+    ret = ttm_bo_reserve(&bo->bo, true, no_wait, false, 0);
+    if (ret)
+    {
+        if (ret != -ERESTARTSYS && ret != -EBUSY)
+            DRM_ERROR("reserve failed %p\n", bo);
+        return ret;
+    }
+    return 0;
+}
+
+void vbox_bo_unreserve(struct vbox_bo *bo)
+{
+    ttm_bo_unreserve(&bo->bo);
+}
+
+int vbox_bo_create(struct drm_device *dev, int size, int align,
+          uint32_t flags, struct vbox_bo **pvboxbo)
+{
+    struct vbox_private *vbox = dev->dev_private;
+    struct vbox_bo *vboxbo;
+    size_t acc_size;
+    int ret;
+
+    vboxbo = kzalloc(sizeof(struct vbox_bo), GFP_KERNEL);
+    if (!vboxbo)
+        return -ENOMEM;
+
+    ret = drm_gem_object_init(dev, &vboxbo->gem, size);
+    if (ret)
+    {
+        kfree(vboxbo);
+        return ret;
+    }
+
+    vboxbo->bo.bdev = &vbox->ttm.bdev;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
+    vboxbo->bo.bdev->dev_mapping = dev->dev_mapping;
+#endif
+
+    vbox_ttm_placement(vboxbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
+
+    acc_size = ttm_bo_dma_acc_size(&vbox->ttm.bdev, size,
+                       sizeof(struct vbox_bo));
+
+    ret = ttm_bo_init(&vbox->ttm.bdev, &vboxbo->bo, size,
+              ttm_bo_type_device, &vboxbo->placement,
+              align >> PAGE_SHIFT, false, NULL, acc_size,
+              NULL, vbox_bo_ttm_destroy);
+    if (ret)
+        return ret;
+
+    *pvboxbo = vboxbo;
+    return 0;
+}
+
+static inline u64 vbox_bo_gpu_offset(struct vbox_bo *bo)
+{
+    return bo->bo.offset;
+}
+
+int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr)
+{
+    int i, ret;
+
+    if (bo->pin_count)
+    {
+        bo->pin_count++;
+        if (gpu_addr)
+            *gpu_addr = vbox_bo_gpu_offset(bo);
+        return 0;
+    }
+
+    vbox_ttm_placement(bo, pl_flag);
+    for (i = 0; i < bo->placement.num_placement; i++)
+        bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
+    ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
+    if (ret)
+        return ret;
+
+    bo->pin_count = 1;
+    if (gpu_addr)
+        *gpu_addr = vbox_bo_gpu_offset(bo);
+    return 0;
+}
+
+int vbox_bo_unpin(struct vbox_bo *bo)
+{
+    int i, ret;
+    if (!bo->pin_count)
+    {
+        DRM_ERROR("unpin bad %p\n", bo);
+        return 0;
+    }
+    bo->pin_count--;
+    if (bo->pin_count)
+        return 0;
+
+    for (i = 0; i < bo->placement.num_placement ; i++)
+        bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT;
+    ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
+    if (ret)
+        return ret;
+
+    return 0;
+}
+
+/* Move a vbox-owned buffer object to system memory if no one else has it
+ * pinned.  The caller must have pinned it previously, and this call will
+ * release the caller's pin. */
+int vbox_bo_push_sysram(struct vbox_bo *bo)
+{
+    int i, ret;
+    if (!bo->pin_count)
+    {
+        DRM_ERROR("unpin bad %p\n", bo);
+        return 0;
+    }
+    bo->pin_count--;
+    if (bo->pin_count)
+        return 0;
+
+    if (bo->kmap.virtual)
+        ttm_bo_kunmap(&bo->kmap);
+
+    vbox_ttm_placement(bo, TTM_PL_FLAG_SYSTEM);
+    for (i = 0; i < bo->placement.num_placement ; i++)
+        bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
+
+    ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
+    if (ret)
+    {
+        DRM_ERROR("pushing to VRAM failed\n");
+        return ret;
+    }
+    return 0;
+}
+
+int vbox_mmap(struct file *filp, struct vm_area_struct *vma)
+{
+    struct drm_file *file_priv;
+    struct vbox_private *vbox;
+
+    if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
+        return drm_mmap(filp, vma);
+
+    file_priv = filp->private_data;
+    vbox = file_priv->minor->dev->dev_private;
+    return ttm_bo_mmap(filp, vma, &vbox->ttm.bdev);
+}
diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drm.c b/src/VBox/Additions/linux/drm/vboxvideo_drm.c
index ca5b2b7..e29ff17 100644
--- a/src/VBox/Additions/linux/drm/vboxvideo_drm.c
+++ b/src/VBox/Additions/linux/drm/vboxvideo_drm.c
@@ -49,52 +49,18 @@
  *    Gareth Hughes <gareth at valinux.com>
  */
 
-#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
-# include <generated/autoconf.h>
-#else
-# ifndef AUTOCONF_INCLUDED
-#  include <linux/autoconf.h>
-# endif
-#endif
-#include <linux/module.h>
 #include "version-generated.h"
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
-
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
-#  ifdef RHEL_RELEASE_CODE
-#   if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 1)
-#    define DRM_RHEL61
-#   endif
-#   if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 3)
-#    define DRM_FOPS_AS_POINTER
-#   endif
-#   if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4)
-#    define DRM_NO_RECLAIM_BUFFERS
-#   endif
-#  endif
-# endif
-
-#include "drm/drmP.h"
+#include <linux/module.h>
+#include <linux/version.h>
+#include <drm/drmP.h>
 #include "vboxvideo_drm.h"
 
-# ifndef RHEL_RELEASE_CODE
-#  if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 39) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
-#   if defined(DRM_MODE_OBJECT_PLANE) && defined(DRM_IOCTL_MODE_ADDFB2)
-#    define DRM_FOPS_AS_POINTER
-#   endif
-#  endif
-# endif
-
-#ifdef CONFIG_SUSE_KERNEL
-/* This is to cover the SLES 11 SP3 kernel back-ports. */
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,61)
-#  if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)
-#    define DRM_FOPS_AS_POINTER
-#    define DRM_NO_RECLAIM_BUFFERS
-#  endif
-# endif
+/* This definition and the file-operations-as-pointer change were both added in
+ * kernel 3.3.  All back-ports of the structure change to distribution kernels
+ * that I have checked also back-ported the definition at the same time. */
+#ifdef DRM_IOCTL_MODE_ADDFB2
+# define DRM_FOPS_AS_POINTER
 #endif
 
 /* The first of these was introduced when drm was generalised to work with
@@ -114,7 +80,8 @@ int vboxvideo_driver_load(struct drm_device * dev, unsigned long flags)
 {
     return 0;
 }
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER)
+
+#ifdef DRM_FOPS_AS_POINTER
 /* since linux-3.3.0-rc1 drm_driver::fops is pointer */
 static struct file_operations driver_fops =
 {
@@ -136,21 +103,13 @@ static struct drm_driver driver =
 {
     /* .driver_features = DRIVER_USE_MTRR, */
     .load = vboxvideo_driver_load,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) && !defined(DRM_NO_RECLAIM_BUFFERS)
-    .reclaim_buffers = drm_core_reclaim_buffers,
-#endif
-    /* As of Linux 2.6.37, always the internal functions are used. */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) && !defined(DRM_RHEL61)
-    .get_map_ofs = drm_core_get_map_ofs,
-    .get_reg_ofs = drm_core_get_reg_ofs,
-#endif
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
     /* If this is missing a warning gets printed to dmesg.  We will not
      * attempt to make kernels work to which the change (915b4d11b) got back-
      * ported, as the problem is only cosmetic. */
     .set_busid = drm_pci_set_busid,
 #endif
-# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(DRM_FOPS_AS_POINTER)
+# ifndef DRM_FOPS_AS_POINTER
     .fops =
     {
         .owner = THIS_MODULE,
@@ -158,7 +117,7 @@ static struct drm_driver driver =
         .release = drm_release,
         /* This was changed with Linux 2.6.33 but Fedora backported this
          * change to their 2.6.32 kernel. */
-#if defined(DRM_UNLOCKED) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
+#if defined(DRM_UNLOCKED)
         .unlocked_ioctl = drm_ioctl,
 #else
         .ioctl = drm_ioctl,
@@ -166,7 +125,7 @@ static struct drm_driver driver =
         .mmap = drm_mmap,
         .poll = drm_poll,
     },
-#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER) */
+#else /* defined(DRM_FOPS_AS_POINTER) */
     .fops = &driver_fops,
 #endif
 #ifndef DRM_NEW_BUS_INIT
@@ -215,9 +174,6 @@ module_exit(vboxvideo_exit);
 
 MODULE_AUTHOR(DRIVER_AUTHOR);
 MODULE_DESCRIPTION(DRIVER_DESC);
-
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */
-
 #ifdef MODULE_VERSION
 MODULE_VERSION(VBOX_VERSION_STRING);
 #endif
diff --git a/src/VBox/Additions/linux/installer/vboxadd-x11.sh b/src/VBox/Additions/linux/installer/vboxadd-x11.sh
index dc3b6dc..a5ba75a 100755
--- a/src/VBox/Additions/linux/installer/vboxadd-x11.sh
+++ b/src/VBox/Additions/linux/installer/vboxadd-x11.sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# Linux Additions X11 setup init script ($Revision: 100166 $)
+# Linux Additions X11 setup init script ($Revision: 97014 $)
 #
 
 #
@@ -298,9 +298,12 @@ setup()
         test -c /dev/psaux && nopsaux="";;
     esac
     # Should we use the VMSVGA driver instead of VBoxVideo?
+    if grep 80eebeef /proc/bus/pci/devices > /dev/null; then
     vmsvga=""
-    if ! grep 80eebeef /proc/bus/pci/devices > /dev/null; then
+    elif grep 15ad0405 /proc/bus/pci/devices > /dev/null; then
         vmsvga="--vmsvga"
+    else
+        dox11config=""
     fi
     # The video driver to install for X.Org 6.9+
     vboxvideo_src=
diff --git a/src/VBox/Additions/linux/installer/vboxadd.sh b/src/VBox/Additions/linux/installer/vboxadd.sh
index 239bf5d..4601084 100755
--- a/src/VBox/Additions/linux/installer/vboxadd.sh
+++ b/src/VBox/Additions/linux/installer/vboxadd.sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# Linux Additions kernel module init script ($Revision: 99217 $)
+# Linux Additions kernel module init script ($Revision: 99216 $)
 #
 
 #
diff --git a/src/VBox/Additions/linux/lightdm-greeter/vbox-greeter.cpp b/src/VBox/Additions/linux/lightdm-greeter/vbox-greeter.cpp
index 179f0fc..84a763c 100644
--- a/src/VBox/Additions/linux/lightdm-greeter/vbox-greeter.cpp
+++ b/src/VBox/Additions/linux/lightdm-greeter/vbox-greeter.cpp
@@ -1035,7 +1035,9 @@ int main(int argc, char **argv)
     uint32_t uLogonDlgBgColor = 0; /* The greeter's dialog color. */
     uint32_t uLogonDlgBtnColor = 0; /* The greeter's button color. */
 
+#ifdef VBOX_GREETER_WITH_PNG_SUPPORT
     char szBannerPath[RTPATH_MAX];
+#endif
 
     /* By default most UI elements are shown. */
     uint32_t uOptsUI = VBOX_GREETER_UI_SHOW_RESTART
diff --git a/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c b/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c
index 9ec00b8..43d53d2 100644
--- a/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c
+++ b/src/VBox/Additions/solaris/DRM/vboxvideo_drm.c
@@ -184,7 +184,6 @@ static int VBoxVideoSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd)
     LogFlow((DEVICE_NAME ":VBoxVideoSolarisAttach pDip=%p enmCmd=%d\n", pDip, enmCmd));
     cmn_err(CE_NOTE, DEVICE_NAME ":attach\n");
 
-    int rc = -1;
     switch (enmCmd)
     {
         case DDI_ATTACH:
diff --git a/src/VBox/Additions/solaris/Makefile.kmk b/src/VBox/Additions/solaris/Makefile.kmk
index eea2f30..b7f8adf 100644
--- a/src/VBox/Additions/solaris/Makefile.kmk
+++ b/src/VBox/Additions/solaris/Makefile.kmk
@@ -161,7 +161,7 @@ SOLARIS_ADD_STRIP_BINS = \
 	VBoxClient \
 	VBoxService \
 	VBoxControl \
-	vboxfsmount	\
+	vboxfsmount \
 	vboxfs \
 	vboxmslnk \
 	$(if ($VBOX_WITH_PAM),pam_vbox.so,) \
diff --git a/src/VBox/Additions/solaris/Mouse/vboxmslnk.c b/src/VBox/Additions/solaris/Mouse/vboxmslnk.c
index a1fdde8..e388944 100644
--- a/src/VBox/Additions/solaris/Mouse/vboxmslnk.c
+++ b/src/VBox/Additions/solaris/Mouse/vboxmslnk.c
@@ -109,7 +109,7 @@ void handleArgs(int argc, char *argv[], int *pfNoLogo)
                "All rights reserved.\n\n");
     if (fShowUsage)
     {
-        printf("Usage:\n  -V|--version  print the tool vesion.\n"
+        printf("Usage:\n  -V|--version  print the tool version.\n"
                "  --nologo      do not display the logo text and only output the connection\n"
                "                ID number needed to disable pointer integration\n"
                "                again.\n"
@@ -118,3 +118,4 @@ void handleArgs(int argc, char *argv[], int *pfNoLogo)
     }
     *pfNoLogo = fNoLogo;
 }
+
diff --git a/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk b/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk
index e249b33..066e577 100644
--- a/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk
+++ b/src/VBox/Additions/solaris/SharedFolders/Makefile.kmk
@@ -67,9 +67,7 @@ SYSMODS.solaris      += vboxfs_s10
 vboxfs_s10_TEMPLATE      = VBOXGUESTR0
 vboxfs_s10_DEFS          = VBOX_WITH_HGCM VBOX_VFS_SOLARIS_10U6 VBOX_SVN_REV=$(VBOX_SVN_REV)
 vboxfs_s10_DEPS         += $(VBOX_SVN_REV_KMK)
-vboxfs_s10_INCS         := \
-	solaris10/ \
-	.
+vboxfs_s10_INCS         := solaris10/
 vboxfs_s10_SOURCES       = \
 	vboxfs_vfs.c \
 	vboxfs_vnode.c \
diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h b/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h
index 0c9478d..6596a3a 100644
--- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h
+++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h
@@ -65,7 +65,7 @@ extern void sfprov_disconnect(sfp_connection_t *);
  *
  * sfprov_unmount() unmounts the mounted file system. It returns 0 on
  * success and any relevant errno on failure.
- * 
+ *
  * spf_mount_t is the representation of an active mount point.
  */
 typedef struct spf_mount_t {
diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c
index 7f2e7bd..c6c7251 100644
--- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c
+++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vfs.c
@@ -239,7 +239,7 @@ sf_pn_get(char *rawpath, struct mounta *uap, char **outpath)
 	return (0);
 }
 
-static void 
+static void
 sffs_print(sffs_data_t *sffs)
 {
 	cmn_err(CE_NOTE, "sffs_data_t at 0x%p\n", sffs);
diff --git a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c
index d82e2ac..8acaec4 100644
--- a/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c
+++ b/src/VBox/Additions/solaris/SharedFolders/vboxfs_vnode.c
@@ -998,6 +998,9 @@ sffs_read(
 		return (EINVAL);
 	if (uio->uio_loffset >= MAXOFFSET_T)
 	{
+		/** @todo r=ramshankar: this is busted, kthread_t->t_procp has different
+		 *  	  offsets between S10 and S11. Fix ASAP. */
+		/* Raise psignal if the limit is exceeded. */
 		proc_t *p = ttoproc(curthread);
 		mutex_enter(&p->p_lock);
 		(void) rctl_action(rctlproc_legacy[RLIMIT_FSIZE], p->p_rctls,
@@ -1095,6 +1098,9 @@ sffs_write(
 		limit = MAXOFFSET_T;
 
 	if (uiop->uio_loffset >= limit) {
+		/** @todo r=ramshankar: this is busted, kthread_t->t_procp has different
+		 *  	  offsets between S10 and S11. Fix ASAP. */
+		/* Raise psignal if the limit is exceeded. */
 		proc_t *p = ttoproc(curthread);
 		mutex_enter(&p->p_lock);
 		(void) rctl_action(rctlproc_legacy[RLIMIT_FSIZE], p->p_rctls,
diff --git a/src/VBox/Additions/x11/VBoxClient/Makefile.kmk b/src/VBox/Additions/x11/VBoxClient/Makefile.kmk
index ece98ee..d9bfb02 100644
--- a/src/VBox/Additions/x11/VBoxClient/Makefile.kmk
+++ b/src/VBox/Additions/x11/VBoxClient/Makefile.kmk
@@ -47,7 +47,15 @@ VBoxClient_LIBS = \
 	X11 \
 	Xrandr \
 	Xt
-#	Xtst
+
+ifdef VBOX_WITH_DRAG_AND_DROP
+ ifdef VBOX_DND_WITH_XTEST
+ VBoxClient_DEFS += VBOX_DND_WITH_XTEST
+ VBoxClient_LIBS += \
+	Xtst
+ endif
+endif
+
 # These are static replacements for gcc-specific parts of libstdc++
 VBoxClient_LIBS += \
 	supc++ \
@@ -71,6 +79,8 @@ ifdef VBOX_WITH_DRAG_AND_DROP
 	$(if $(VBOX_WITH_DRAG_AND_DROP_GH),VBOX_WITH_DRAG_AND_DROP_GH,)
  VBoxClient_SOURCES += \
 	draganddrop.cpp
+ VBoxClient_LIBS     += \
+	$(PATH_STAGE_LIB)/additions/VBoxDnDGuestR3Lib$(VBOX_SUFF_LIB)
 endif
 
 ifdef VBOX_X11_SEAMLESS_GUEST
diff --git a/src/VBox/Additions/x11/VBoxClient/VBoxClient.h b/src/VBox/Additions/x11/VBoxClient/VBoxClient.h
index 2ca8f1d..646d698 100644
--- a/src/VBox/Additions/x11/VBoxClient/VBoxClient.h
+++ b/src/VBox/Additions/x11/VBoxClient/VBoxClient.h
@@ -1,3 +1,4 @@
+/* $Id: VBoxClient.h $ */
 /** @file
  *
  * VirtualBox additions user session daemon.
diff --git a/src/VBox/Additions/x11/VBoxClient/display.cpp b/src/VBox/Additions/x11/VBoxClient/display.cpp
index dcff5f3..45c66dd 100644
--- a/src/VBox/Additions/x11/VBoxClient/display.cpp
+++ b/src/VBox/Additions/x11/VBoxClient/display.cpp
@@ -328,7 +328,7 @@ static int init(struct VBCLSERVICE **ppInterface)
 {
     struct DISPLAYSTATE *pSelf = getStateFromInterface(ppInterface);
     int rc;
-    
+
     if (pSelf->mfInit)
         return VERR_WRONG_ORDER;
     rc = initDisplay(pSelf);
@@ -386,7 +386,7 @@ struct VBCLSERVICE vbclDisplayInterface =
     run,
     pause,
     resume,
-    cleanup    
+    cleanup
 };
 
 struct VBCLSERVICE **VBClGetDisplayService()
diff --git a/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp b/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
index 3f90e34..0a1b4b3 100644
--- a/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
+++ b/src/VBox/Additions/x11/VBoxClient/draganddrop.cpp
@@ -1,9 +1,10 @@
+/* $Id: draganddrop.cpp $ */
 /** @file
  * X11 guest client - Drag and Drop.
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -14,15 +15,16 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#include <errno.h>
-#include <poll.h>
-
 #include <X11/Xlib.h>
+#include <X11/Xutil.h>
 #include <X11/Xatom.h>
-//#include <X11/extensions/XTest.h>
+#ifdef VBOX_DND_WITH_XTEST
+# include <X11/extensions/XTest.h>
+#endif
 
-#include <iprt/thread.h>
 #include <iprt/asm.h>
+#include <iprt/critsect.h>
+#include <iprt/thread.h>
 #include <iprt/time.h>
 
 #include <iprt/cpp/mtlist.h>
@@ -30,6 +32,10 @@
 
 #include <limits.h>
 
+# ifdef LOG_GROUP
+ # undef LOG_GROUP
+# endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
 #include <VBox/log.h>
 #include <VBox/VBoxGuestLib.h>
 
@@ -37,6 +43,12 @@
 
 #include "VBoxClient.h"
 
+/* Enable this define to see the proxy window(s) when debugging
+ * their behavior. Don't have this enabled in release builds! */
+#ifdef DEBUG
+//# define VBOX_DND_DEBUG_WND
+#endif
+
 /* For X11 guest xDnD is used. See http://www.acc.umu.se/~vatten/XDND.html for
  * a walk trough.
  *
@@ -57,36 +69,24 @@
  *
  * G->H:
  * This is a lot more trickery than H->G. When a pending event from HGCM
- * arrives, we asks if there is currently an owner of the XdndSelection
+ * arrives, we ask if there currently is an owner of the XdndSelection
  * property. If so, our proxy window is shown (1x1, but without backing store)
  * and some mouse event is triggered. This should be followed by an XdndEnter
  * event send to the proxy window. From this event we can fetch the necessary
- * info of the mime-types and allowed actions and send this back to the host.
+ * info of the MIME types and allowed actions and send this back to the host.
  * On a drop request from the host, we query for the selection and should get
  * the data in the specified mime-type. This data is send back to the host.
  * After that we send a XdndLeave event to the source window.
- * Todo:
- * - this isn't finished, yet. Currently the mouse isn't correctly released
- * in the guest (both, when the drop was successfully or canceled).
- * - cancel (e.g. with the ESC key) doesn't work
  *
- * Todo:
- * - XdndProxy window support
- * - INCR support
- * - make this much more robust for crashes of the other party
- * - really check for the Xdnd version and the supported features
+ * To-do:
+ * - Cancelling (e.g. with ESC key) doesn't work.
+ *
+ * To-do:
+ * - INCR (incremental transfers) support.
+ * - Make this much more robust for crashes of the other party.
+ * - Really check for the Xdnd version and the supported features.
  */
 
-#define VERBOSE 1
-
-#if defined(VERBOSE) && defined(DEBUG_poetzsch)
-# include <iprt/stream.h>
-# define DO(s) RTPrintf s
-#else
-# define DO(s) do {} while (0)
-//# define DO(s) Log s
-#endif
-
 #define VBOX_XDND_VERSION    (4)
 #define VBOX_MAX_XPROPERTIES (LONG_MAX-1)
 
@@ -156,13 +156,14 @@ class xHelpers
 {
 public:
 
-    static xHelpers *instance(Display *pDisplay = 0)
+    static xHelpers *getInstance(Display *pDisplay = 0)
     {
         if (!m_pInstance)
         {
-            AssertPtrReturn(pDisplay, 0);
+            AssertPtrReturn(pDisplay, NULL);
             m_pInstance = new xHelpers(pDisplay);
         }
+
         return m_pInstance;
     }
 
@@ -192,7 +193,7 @@ public:
         return format;
     }
 
-    RTCString xErrorToString(int xrc) const;
+    RTCString xErrorToString(int xRc) const;
     Window applicationWindowBelowCursor(Window parentWin) const;
 
 private:
@@ -213,7 +214,7 @@ private:
 };
 
 /* Some xHelpers convenience defines. */
-#define gX11 xHelpers::instance()
+#define gX11 xHelpers::getInstance()
 #define xAtom(xa) gX11->xAtom((xa))
 #define xAtomToString(xa) gX11->xAtomToString((xa))
 
@@ -260,70 +261,72 @@ const char *xHelpers::m_xAtomNames[] =
     "dndstop"
 };
 
-RTCString xHelpers::xErrorToString(int xrc) const
+RTCString xHelpers::xErrorToString(int xRc) const
 {
-    switch (xrc)
+    switch (xRc)
     {
-        case Success:           return RTCStringFmt("%d (Success)", xrc); break;
-        case BadRequest:        return RTCStringFmt("%d (BadRequest)", xrc); break;
-        case BadValue:          return RTCStringFmt("%d (BadValue)", xrc); break;
-        case BadWindow:         return RTCStringFmt("%d (BadWindow)", xrc); break;
-        case BadPixmap:         return RTCStringFmt("%d (BadPixmap)", xrc); break;
-        case BadAtom:           return RTCStringFmt("%d (BadAtom)", xrc); break;
-        case BadCursor:         return RTCStringFmt("%d (BadCursor)", xrc); break;
-        case BadFont:           return RTCStringFmt("%d (BadFont)", xrc); break;
-        case BadMatch:          return RTCStringFmt("%d (BadMatch)", xrc); break;
-        case BadDrawable:       return RTCStringFmt("%d (BadDrawable)", xrc); break;
-        case BadAccess:         return RTCStringFmt("%d (BadAccess)", xrc); break;
-        case BadAlloc:          return RTCStringFmt("%d (BadAlloc)", xrc); break;
-        case BadColor:          return RTCStringFmt("%d (BadColor)", xrc); break;
-        case BadGC:             return RTCStringFmt("%d (BadGC)", xrc); break;
-        case BadIDChoice:       return RTCStringFmt("%d (BadIDChoice)", xrc); break;
-        case BadName:           return RTCStringFmt("%d (BadName)", xrc); break;
-        case BadLength:         return RTCStringFmt("%d (BadLength)", xrc); break;
-        case BadImplementation: return RTCStringFmt("%d (BadImplementation)", xrc); break;
+        case Success:           return RTCStringFmt("%d (Success)", xRc);           break;
+        case BadRequest:        return RTCStringFmt("%d (BadRequest)", xRc);        break;
+        case BadValue:          return RTCStringFmt("%d (BadValue)", xRc);          break;
+        case BadWindow:         return RTCStringFmt("%d (BadWindow)", xRc);         break;
+        case BadPixmap:         return RTCStringFmt("%d (BadPixmap)", xRc);         break;
+        case BadAtom:           return RTCStringFmt("%d (BadAtom)", xRc);           break;
+        case BadCursor:         return RTCStringFmt("%d (BadCursor)", xRc);         break;
+        case BadFont:           return RTCStringFmt("%d (BadFont)", xRc);           break;
+        case BadMatch:          return RTCStringFmt("%d (BadMatch)", xRc);          break;
+        case BadDrawable:       return RTCStringFmt("%d (BadDrawable)", xRc);       break;
+        case BadAccess:         return RTCStringFmt("%d (BadAccess)", xRc);         break;
+        case BadAlloc:          return RTCStringFmt("%d (BadAlloc)", xRc);          break;
+        case BadColor:          return RTCStringFmt("%d (BadColor)", xRc);          break;
+        case BadGC:             return RTCStringFmt("%d (BadGC)", xRc);             break;
+        case BadIDChoice:       return RTCStringFmt("%d (BadIDChoice)", xRc);       break;
+        case BadName:           return RTCStringFmt("%d (BadName)", xRc);           break;
+        case BadLength:         return RTCStringFmt("%d (BadLength)", xRc);         break;
+        case BadImplementation: return RTCStringFmt("%d (BadImplementation)", xRc); break;
     }
-    return RTCStringFmt("%d (unknown)", xrc);
+    return RTCStringFmt("%d (unknown)", xRc);
 }
 
-/* Todo: make this iterative */
-Window xHelpers::applicationWindowBelowCursor(Window parentWin) const
+/** todo Make this iterative. */
+Window xHelpers::applicationWindowBelowCursor(Window wndParent) const
 {
     /* No parent, nothing to do. */
-    if(parentWin == 0)
+    if(wndParent == 0)
         return 0;
 
-    Window appWin = 0;
+    Window wndApp = 0;
     int cProps = -1;
     /* Fetch all x11 window properties of the parent window. */
-    Atom *pProps = XListProperties(m_pDisplay, parentWin, &cProps);
+    Atom *pProps = XListProperties(m_pDisplay, wndParent, &cProps);
     if (cProps > 0)
     {
         /* We check the window for the WM_STATE property. */
-        for(int i = 0; i < cProps; ++i)
-            if(pProps[i] == xAtom(XA_WM_STATE))
+        for (int i = 0; i < cProps; ++i)
+            if (pProps[i] == xAtom(XA_WM_STATE))
             {
                 /* Found it. */
-                appWin = parentWin;
+                wndApp = wndParent;
                 break;
             }
         /* Cleanup */
         XFree(pProps);
     }
 
-    if (!appWin)
+    if (!wndApp)
     {
-        Window childWin, wtmp;
+        Window wndChild, wndTemp;
         int tmp;
         unsigned int utmp;
+
         /* Query the next child window of the parent window at the current
          * mouse position. */
-        XQueryPointer(m_pDisplay, parentWin, &wtmp, &childWin, &tmp, &tmp, &tmp, &tmp, &utmp);
+        XQueryPointer(m_pDisplay, wndParent, &wndTemp, &wndChild, &tmp, &tmp, &tmp, &tmp, &utmp);
+
         /* Recursive call our self to dive into the child tree. */
-        appWin = applicationWindowBelowCursor(childWin);
+        wndApp = applicationWindowBelowCursor(wndChild);
     }
 
-    return appWin;
+    return wndApp;
 }
 
 /*******************************************************************************
@@ -332,38 +335,62 @@ Window xHelpers::applicationWindowBelowCursor(Window parentWin) const
  *
  ******************************************************************************/
 
+#ifdef DEBUG
+# define VBOX_DND_FN_DECL_LOG(x) inline x
+#else
+# define VBOX_DND_FN_DECL_LOG(x) x
+#endif
+
+#define VBoxDnDAtomList RTCList<Atom> 
+
 /* For now only one DragInstance will exits when the app is running. In the
- * future the support for having more than one D&D operation supported at the
+ * future the support for having more than one drag and drop operation supported at the
  * time will be necessary. */
 class DragInstance
 {
 public:
+
     enum State
     {
-        Uninitialized,
+        Uninitialized = 0,
         Initialized,
         Dragging,
-        Dropped
+        Dropped,
+        State_32BIT_Hack = 0x7fffffff
     };
 
     enum Mode
     {
-        Unknown,
+        Unknown = 0,
         HG,
-        GH
+        GH,
+        Mode_32Bit_Hack = 0x7fffffff
     };
 
     DragInstance(Display *pDisplay, DragAndDropService *pParent);
+
+public:
+
     int  init(uint32_t u32ScreenId);
-    void uninit();
-    void reset();
+    void uninit(void);
+    void reset(void);
+
+    /* Logging. */
+    VBOX_DND_FN_DECL_LOG(void) logError(const char *pszFormat, ...);
+
+    /* X11 message processing. */
+    int onX11ClientMessage(const XEvent &e);
+    int onX11SelectionNotify(const XEvent &e);
+    int onX11SelectionRequest(const XEvent &e);
+    int onX11Event(const XEvent &e);
+    bool waitForX11Msg(XEvent &evX, int iType, RTMSINTERVAL uTimeoutMS = 100);
+    bool waitForX11ClientMsg(XClientMessageEvent &evMsg, Atom aType, RTMSINTERVAL uTimeoutMS = 100);
 
     /* H->G */
     int  hgEnter(const RTCList<RTCString> &formats, uint32_t actions);
+    int  hgLeave(void);
     int  hgMove(uint32_t u32xPos, uint32_t u32yPos, uint32_t action);
-    int  hgX11ClientMessage(const XEvent& e);
     int  hgDrop();
-    int  hgX11SelectionRequest(const XEvent& e);
     int  hgDataReceived(void *pvData, uint32_t cData);
 
 #ifdef VBOX_WITH_DRAG_AND_DROP_GH
@@ -372,43 +399,57 @@ public:
     int  ghDropped(const RTCString &strFormat, uint32_t action);
 #endif
 
-    /* X11 helpers */
-    int  moveCursor(uint32_t u32xPos, uint32_t u32yPos);
-    void sendButtonEvent(Window w, int rx, int ry, int button, bool fPress) const;
-    void showProxyWin(int &rx, int &ry) const;
-    void hideProxyWin() const;
-    void registerForEvents(Window w) const;
-
-    void setActionsWindowProperty(Window win, const RTCList<Atom> &actionList) const;
-    void clearActionsWindowProperty(Window win) const;
-    void setFormatsWindowProperty(Window win, Atom property) const;
-    void clearFormatsWindowProperty(Window win) const;
-
-    RTCList<Atom>        toAtomList(const RTCList<RTCString> &formatList) const;
-    RTCList<Atom>        toAtomList(void *pvData, uint32_t cData) const;
-    static Atom          toX11Action(uint32_t uAction);
-    static RTCList<Atom> toX11Actions(uint32_t uActions);
-    static uint32_t      toHGCMAction(Atom atom);
-    static uint32_t      toHGCMActions(const RTCList<Atom> &actionsList);
-
-    /* Member vars */
-    DragAndDropService *m_pParent;
-    Display            *m_pDisplay;
-    int                 m_screenId;
-    Screen             *m_pScreen;
-    Window              m_rootWin;
-    Window              m_proxyWin;
-    Window              m_curWin;
-    long                m_curVer;
-    RTCList<Atom>       m_formats;
-    RTCList<Atom>       m_actions;
-
-    XEvent              m_selEvent;
-
-    Mode                m_mode;
-    State               m_state;
-
-    static const RTCList<RTCString> m_sstrStringMimeTypes;
+    /* X11 helpers. */
+    int  mouseCursorMove(int iPosX, int iPosY) const;
+    void mouseButtonSet(Window wndDest, int rx, int ry, int iButton, bool fPress);
+    int proxyWinShow(int *piRootX = NULL, int *piRootY = NULL, bool fMouseMove = false) const;
+    int proxyWinHide(void);
+
+    void wndXDnDClearActionList(Window wndThis) const;
+    void wndXDnDClearTypeList(Window wndThis) const;
+    int wndXDnDGetActionList(Window wndThis, VBoxDnDAtomList &lstActions) const;
+    int wndXDnDGetTypeList(Window wndThis, VBoxDnDAtomList &lstTypes) const;
+    int wndXDnDSetActionList(Window wndThis, const VBoxDnDAtomList &lstActions) const;
+    int wndXDnDSetFormatList(Window wndThis, Atom property, const VBoxDnDAtomList &lstFormats) const;
+
+    int                    toAtomList(const RTCList<RTCString> &lstFormats, VBoxDnDAtomList &lstAtoms) const;
+    int                    toAtomList(const void *pvData, uint32_t cbData, VBoxDnDAtomList &lstAtoms) const;
+    static Atom            toAtomAction(uint32_t uAction);
+    static int             toAtomActions(uint32_t uActions, VBoxDnDAtomList &lstAtoms);
+    static uint32_t        toHGCMAction(Atom atom);
+    static uint32_t        toHGCMActions(const RTCList<Atom> &actionsList);
+
+protected:
+
+    /** The instance's own DnD context. */
+    VBGLR3GUESTDNDCMDCTX        m_dndCtx;
+    DragAndDropService         *m_pParent;
+    Display                    *m_pDisplay;
+    int                         m_screenId;
+    Screen                     *m_pScreen;
+    Window                      m_wndRoot;
+    Window                      m_wndProxy;
+    Window                      m_wndCur;
+    long                        m_curVer;
+    VBoxDnDAtomList             m_lstFormats;
+    VBoxDnDAtomList             m_lstActions;
+    /** Deferred host to guest selection event for sending to the
+     *  target window as soon as data from the host arrived. */
+    XEvent                      m_eventHgSelection;
+    /** Current operation mode. */
+    Mode                        m_enmMode;
+    /** Current state of operation mode. */
+    State                       m_enmState;
+    /** The instance's own X event queue. */
+    RTCMTList<XEvent>           m_eventQueue;
+    /** Critical section for providing serialized access to list
+     *  event queue's contents. */
+    RTCRITSECT                  m_eventQueueCS;
+    /** Event for notifying this instance in case of a new
+     *  event. */
+    RTSEMEVENT                  m_hEventSem;
+    /** List of allowed formats. */
+    RTCList<RTCString>          m_lstAllowedFormats;
 };
 
 /*******************************************************************************
@@ -420,50 +461,39 @@ public:
 class DragAndDropService
 {
 public:
-    DragAndDropService()
+    DragAndDropService(void)
       : m_pDisplay(0)
       , m_hHGCMThread(NIL_RTTHREAD)
       , m_hX11Thread(NIL_RTTHREAD)
       , m_hEventSem(NIL_RTSEMEVENT)
       , m_pCurDnD(0)
+      , m_fSrvStopping(false)
     {}
 
     int run(bool fDaemonised = false);
 
 private:
-    int x11DragAndDropInit();
+
+    int x11DragAndDropInit(void);
     static int hgcmEventThread(RTTHREAD hThread, void *pvUser);
     static int x11EventThread(RTTHREAD hThread, void *pvUser);
 
-    bool waitForXMsg(XEvent &ecm, int type, uint32_t uiMaxMS = 100);
     void clearEventQueue();
-    /* Usually XCheckMaskEvent could be used for queering selected x11 events.
-     * Unfortunately this doesn't work exactly with the events we need. So we
-     * use this predicate method below and XCheckIfEvent. */
-    static Bool isDnDRespondEvent(Display * /* pDisplay */, XEvent *pEvent, char *pUser)
-    {
-        if (!pEvent)
-            return False;
-        if (   pEvent->type == SelectionClear
-            || pEvent->type == ClientMessage
-            || pEvent->type == MotionNotify
-            || pEvent->type == SelectionRequest)
-//            || (   pEvent->type == ClientMessage
-//                && reinterpret_cast<XClientMessageEvent*>(pEvent)->window == reinterpret_cast<Window>(pUser))
-//            || (   pEvent->type == SelectionRequest
-//                && reinterpret_cast<XSelectionRequestEvent*>(pEvent)->requestor == reinterpret_cast<Window>(pUser)))
-            return True;
-        return False;
-    }
 
     /* Private member vars */
     Display             *m_pDisplay;
 
-    RTCMTList<DnDEvent>  m_eventQueue;
+    /** Our (thread-safe) event queue with
+     *  mixed events (DnD HGCM / X11). */
+    RTCMTList<DnDEvent>    m_eventQueue;
+    /** Critical section for providing serialized access to list
+     *  event queue's contents. */
+    RTCRITSECT           m_eventQueueCS;
     RTTHREAD             m_hHGCMThread;
     RTTHREAD             m_hX11Thread;
     RTSEMEVENT           m_hEventSem;
     DragInstance        *m_pCurDnD;
+    bool                 m_fSrvStopping;
 
     friend class DragInstance;
 };
@@ -475,950 +505,1581 @@ private:
  ******************************************************************************/
 
 DragInstance::DragInstance(Display *pDisplay, DragAndDropService *pParent)
-  : m_pParent(pParent)
-  , m_pDisplay(pDisplay)
-  , m_pScreen(0)
-  , m_rootWin(0)
-  , m_proxyWin(0)
-  , m_curWin(0)
-  , m_curVer(-1)
-  , m_mode(Unknown)
-  , m_state(Uninitialized)
+    : m_pParent(pParent)
+    , m_pDisplay(pDisplay)
+    , m_pScreen(0)
+    , m_wndRoot(0)
+    , m_wndProxy(0)
+    , m_wndCur(0)
+    , m_curVer(-1)
+    , m_enmMode(Unknown)
+    , m_enmState(Uninitialized)
 {
     uninit();
 }
 
-void DragInstance::uninit()
+void DragInstance::uninit(void)
 {
     reset();
-    if (m_proxyWin != 0)
-        XDestroyWindow(m_pDisplay, m_proxyWin);
-    m_state    = Uninitialized;
+    if (m_wndProxy != 0)
+        XDestroyWindow(m_pDisplay, m_wndProxy);
+
+    VbglR3DnDDisconnect(&m_dndCtx);
+
+    m_enmState    = Uninitialized;
     m_screenId = -1;
     m_pScreen  = 0;
-    m_rootWin  = 0;
-    m_proxyWin = 0;
+    m_wndRoot  = 0;
+    m_wndProxy = 0;
 }
 
-void DragInstance::reset()
+void DragInstance::reset(void)
 {
+    LogFlowFuncEnter();
+
     /* Hide the proxy win. */
-    hideProxyWin();
+    proxyWinHide();
+
     /* If we are currently the Xdnd selection owner, clear that. */
     Window w = XGetSelectionOwner(m_pDisplay, xAtom(XA_XdndSelection));
-    if (w == m_proxyWin)
+    if (w == m_wndProxy)
         XSetSelectionOwner(m_pDisplay, xAtom(XA_XdndSelection), None, CurrentTime);
-    /* Clear any other DnD specific data on the proxy win. */
-    clearFormatsWindowProperty(m_proxyWin);
-    clearActionsWindowProperty(m_proxyWin);
+
+    /* Clear any other DnD specific data on the proxy window. */
+    wndXDnDClearTypeList(m_wndProxy);
+    wndXDnDClearActionList(m_wndProxy);
+
     /* Reset the internal state. */
-    m_formats.clear();
-    m_curWin = 0;
-    m_curVer = -1;
-    m_state  = Initialized;
+    m_lstActions.clear();
+    m_lstFormats.clear();
+    m_wndCur    = 0;
+    m_curVer    = -1;
+    m_enmState  = Initialized;
+    m_enmMode   = Unknown;
+    m_eventQueue.clear();
 }
 
-const RTCList<RTCString> DragInstance::m_sstrStringMimeTypes = RTCList<RTCString>()
-    /* Uri's */
-    << "text/uri-list"
-    /* Text */
-    << "text/plain;charset=utf-8"
-    << "UTF8_STRING"
-    << "text/plain"
-    << "COMPOUND_TEXT"
-    << "TEXT"
-    << "STRING"
-    /* OpenOffice formates */
-    << "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\""
-    << "application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"";
-
 int DragInstance::init(uint32_t u32ScreenId)
 {
-    int rc = VINF_SUCCESS;
+    int rc;
+
     do
     {
         uninit();
-        /* Enough screens configured in the x11 server? */
+
+        rc = VbglR3DnDConnect(&m_dndCtx);
+        if (RT_FAILURE(rc))
+            break;
+
+        rc = RTSemEventCreate(&m_hEventSem);
+        if (RT_FAILURE(rc))
+            break;
+
+        rc = RTCritSectInit(&m_eventQueueCS);
+        if (RT_FAILURE(rc))
+            break;
+
+        /*
+         * Enough screens configured in the x11 server?
+         */
         if ((int)u32ScreenId > ScreenCount(m_pDisplay))
         {
-            rc = VERR_GENERAL_FAILURE;
+            rc = VERR_INVALID_PARAMETER;
             break;
         }
+#if 0
         /* Get the screen number from the x11 server. */
-//        pDrag->screen = ScreenOfDisplay(m_pDisplay, u32ScreenId);
-//        if (!pDrag->screen)
-//        {
-//            rc = VERR_GENERAL_FAILURE;
-//            break;
-//        }
+        pDrag->screen = ScreenOfDisplay(m_pDisplay, u32ScreenId);
+        if (!pDrag->screen)
+        {
+            rc = VERR_GENERAL_FAILURE;
+            break;
+        }
+#endif
         m_screenId = u32ScreenId;
+
         /* Now query the corresponding root window of this screen. */
-        m_rootWin = RootWindow(m_pDisplay, m_screenId);
-        if (!m_rootWin)
+        m_wndRoot = RootWindow(m_pDisplay, m_screenId);
+        if (!m_wndRoot)
         {
             rc = VERR_GENERAL_FAILURE;
             break;
         }
-        /* Create an invisible window which will act as proxy for the DnD
+
+        /*
+         * Create an invisible window which will act as proxy for the DnD
          * operation. This window will be used for both the GH and HG
-         * direction. */
+         * direction.
+         */
         XSetWindowAttributes attr;
         RT_ZERO(attr);
-        attr.do_not_propagate_mask = 0;
+        attr.event_mask            =   EnterWindowMask  | LeaveWindowMask
+                                     | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
         attr.override_redirect     = True;
-//        attr.background_pixel      = WhitePixel(m_pDisplay, m_screenId);
-        m_proxyWin = XCreateWindow(m_pDisplay, m_rootWin, 0, 0, 1, 1, 0,
-                                   CopyFromParent, InputOnly, CopyFromParent,
-                                   CWOverrideRedirect | CWDontPropagate,
-                                   &attr);
-
-//        m_proxyWin = XCreateSimpleWindow(m_pDisplay, m_rootWin, 0, 0, 50, 50, 0, WhitePixel(m_pDisplay, m_screenId), WhitePixel(m_pDisplay, m_screenId));
-
-        if (!m_proxyWin)
+        attr.do_not_propagate_mask = NoEventMask;
+#ifdef VBOX_DND_DEBUG_WND
+        attr.background_pixel      = XWhitePixel(m_pDisplay, m_screenId);
+        attr.border_pixel          = XBlackPixel(m_pDisplay, m_screenId); 
+        m_wndProxy = XCreateWindow(m_pDisplay, m_wndRoot                     /* Parent */,
+                                   100, 100,                                 /* Position */
+                                   100, 100,                                 /* Width + height */
+                                   2,                                        /* Border width */
+                                   CopyFromParent,                           /* Depth */
+                                   InputOutput,                              /* Class */
+                                   CopyFromParent,                           /* Visual */
+                                     CWBackPixel 
+                                   | CWBorderPixel
+                                   | CWOverrideRedirect
+                                   | CWDontPropagate,                        /* Value mask */
+                                   &attr);                                   /* Attributes for value mask */       
+#else
+        m_wndProxy = XCreateWindow(m_pDisplay, m_wndRoot                 /* Parent */,
+                                   0, 0,                                 /* Position */
+                                   1, 1,                                 /* Width + height */
+                                   0,                                    /* Border width */
+                                   CopyFromParent,                       /* Depth */
+                                   InputOnly,                            /* Class */
+                                   CopyFromParent,                       /* Visual */
+                                   CWOverrideRedirect | CWDontPropagate, /* Value mask */
+                                   &attr);                               /* Attributes for value mask */
+#endif
+        if (!m_wndProxy)
         {
+            LogRel(("DnD: Error creating proxy window\n"));
             rc = VERR_GENERAL_FAILURE;
             break;
         }
+
+#ifdef VBOX_DND_DEBUG_WND
+        XFlush(m_pDisplay);
+        XMapWindow(m_pDisplay, m_wndProxy);
+        XRaiseWindow(m_pDisplay, m_wndProxy);
+        XFlush(m_pDisplay);
+#endif
+        LogFlowThisFunc(("Created proxy window 0x%x at m_wndRoot=0x%x ...\n", m_wndProxy, m_wndRoot));
+
+        /* Set the window's name for easier lookup. */
+        XStoreName(m_pDisplay, m_wndProxy, "VBoxClientWndDnD");
+
         /* Make the new window Xdnd aware. */
         Atom ver = VBOX_XDND_VERSION;
-        XChangeProperty(m_pDisplay, m_proxyWin, xAtom(XA_XdndAware), XA_ATOM, 32, PropModeReplace,
+        XChangeProperty(m_pDisplay, m_wndProxy, xAtom(XA_XdndAware), XA_ATOM, 32, PropModeReplace,
                         reinterpret_cast<unsigned char*>(&ver), 1);
     } while (0);
 
-    m_state = Initialized;
+    if (RT_SUCCESS(rc))
+    {
+        m_enmState = Initialized;
+    }
+    else
+        LogRel(("DnD: Initializing drag instance for screen %RU32 failed with rc=%Rrc\n",
+                u32ScreenId, rc));
 
+    LogFlowFuncLeaveRC(rc);
     return rc;
 }
 
-/*
- * Host -> Guest
- */
+VBOX_DND_FN_DECL_LOG(void) DragInstance::logError(const char *pszFormat, ...)
+{
+    va_list args;
+    va_start(args, pszFormat);
+    char *psz = NULL;
+    RTStrAPrintfV(&psz, pszFormat, args);
+    va_end(args);
 
-int DragInstance::hgEnter(const RTCList<RTCString> &formats, uint32_t actions)
+    AssertPtr(psz);
+    LogFlowFunc(("%s", psz));
+    LogRel2(("DnD: %s", psz));
+
+    RTStrFree(psz);
+}
+
+int DragInstance::onX11ClientMessage(const XEvent &e)
 {
-    int rc = VINF_SUCCESS;
+    AssertReturn(e.type == ClientMessage, VERR_INVALID_PARAMETER);
 
-    reset();
-    DO(("DnD_ENTR: formats=%u: ", formats.size()));
-#if defined(VERBOSE) && defined(DEBUG_poetzsch)
-    for (size_t i = 0; i < formats.size(); ++i)
-        DO(("'%s' ", formats.at(i).c_str()));
-#endif /* DEBUG */
-    DO(("\n"));
+    LogFlowThisFunc(("mode=%d, state=%d\n", m_enmMode, m_enmState));
+    LogFlowThisFunc(("Event wnd=%#x, msg=%s\n", e.xclient.window, xAtomToString(e.xclient.message_type).c_str()));
 
-    m_formats = toAtomList(formats);
+    int rc;
+
+    switch (m_enmMode)
+    {
+        case HG:
+        {
+            /* 
+             * Client messages are used to inform us about the status of a XdndAware
+             * window, in response of some events we send to them. 
+             */ 
+            if (   e.xclient.message_type == xAtom(XA_XdndStatus)
+                && m_wndCur               == static_cast<Window>(e.xclient.data.l[0]))
+            {
+                /* 
+                 * The XdndStatus message tell us if the window will accept the DnD
+                 * event and with which action. We immediately send this info down to
+                 * the host as a response of a previous DnD message. 
+                 */ 
+                LogFlowThisFunc(("XA_XdndStatus: wnd=%#x, accept=%RTbool, action=%s\n",
+                                 e.xclient.data.l[0],
+                                 ASMBitTest(&e.xclient.data.l[1], 0),
+                                 xAtomToString(e.xclient.data.l[4]).c_str()));
+
+                uint32_t uAction = DND_IGNORE_ACTION;
+                /** @todo Compare this with the allowed actions. */
+                if (ASMBitTest(&e.xclient.data.l[1], 0))
+                    uAction = toHGCMAction(static_cast<Atom>(e.xclient.data.l[4]));
+
+                rc = VbglR3DnDHGAcknowledgeOperation(&m_dndCtx, uAction);
+            }
+            else if (e.xclient.message_type == xAtom(XA_XdndFinished))
+            {
+                rc = VINF_SUCCESS;
 
-    /* If we have more than 3 formats we have to use the type list extension. */
-    if (m_formats.size() > 3)
-        setFormatsWindowProperty(m_proxyWin, xAtom(XA_XdndTypeList));
+                /* This message is sent on an un/successful DnD drop request. */
+                LogFlowThisFunc(("XA_XdndFinished: wnd=%#x, success=%RTbool, action=%s\n",
+                                 e.xclient.data.l[0],
+                                 ASMBitTest(&e.xclient.data.l[1], 0),
+                                 xAtomToString(e.xclient.data.l[2]).c_str()));
 
-    /* Announce the possible actions */
-    setActionsWindowProperty(m_proxyWin, toX11Actions(actions));
+                proxyWinHide();
+            }
+            else
+            {
+                LogFlowThisFunc(("Unhandled: wnd=%#x, msg=%s\n",
+                                 e.xclient.data.l[0], xAtomToString(e.xclient.message_type).c_str()));
+                rc = VERR_NOT_SUPPORTED;
+            }
 
-    /* Set the DnD selection owner to our window. */
-    XSetSelectionOwner(m_pDisplay, xAtom(XA_XdndSelection), m_proxyWin, CurrentTime);
+            break;
+        }
 
-    m_mode  = HG;
-    m_state = Dragging;
+        case GH:
+        case Unknown: /* Mode not set (yet), just add what we got. */
+        {
+            m_eventQueue.append(e);
+            rc = RTSemEventSignal(m_hEventSem);
+            break;
+        }
+       
+        default:
+        {
+            AssertMsgFailed(("Drag and drop mode not implemented: %RU32\n", m_enmMode));
+            rc = VERR_NOT_IMPLEMENTED;
+            break;
+        }
+    }
 
+    LogFlowThisFunc(("Returning rc=%Rrc\n", rc));
     return rc;
 }
 
-int DragInstance::hgMove(uint32_t u32xPos, uint32_t u32yPos, uint32_t action)
+int DragInstance::onX11SelectionNotify(const XEvent &e)
 {
-    DO(("DnD_MOVE: "));
-
-    if (   m_mode  != HG
-        || m_state != Dragging)
-        return VERR_INVALID_STATE;
-
-    int rc  = VINF_SUCCESS;
-    int xrc = Success;
+    AssertReturn(e.type == SelectionNotify, VERR_INVALID_PARAMETER);
 
-    /* Move the mouse cursor within the guest. */
-    moveCursor(u32xPos, u32yPos);
+    LogFlowThisFunc(("m_mode=%d, m_state=%d\n", m_enmMode, m_enmState));
 
-    Window newWin = None; /* Default to _no_ window below the cursor. */
-    long   newVer = -1;   /* This means the current window is _not_ XdndAware. */
+    int rc;
 
-    /* Search for the application window below the cursor. */
-    newWin = gX11->applicationWindowBelowCursor(m_rootWin);
-    if (newWin != None)
+    switch (m_enmMode)
     {
-        /* Temp stuff for the XGetWindowProperty call. */
-        Atom atmp;
-        int fmt;
-        unsigned long cItems, cbRemaining;
-        unsigned char *pcData = NULL;
-        /* Query the XdndAware property from the window. We are interested in
-         * the version and if it is XdndAware at all. */
-        xrc = XGetWindowProperty(m_pDisplay, newWin, xAtom(XA_XdndAware), 0, 2, False, AnyPropertyType, &atmp, &fmt, &cItems, &cbRemaining, &pcData);
-        if (RT_UNLIKELY(xrc != Success))
-            DO(("DnD_MOVE: error in getting the window property (%s)\n", gX11->xErrorToString(xrc).c_str()));
-        else
+        case GH:
         {
-            if (RT_UNLIKELY(pcData == NULL || fmt != 32 || cItems != 1))
-                DO(("Prop=error[data=%#x,fmt=%u,items=%u] ", pcData, fmt, cItems));
-            else
+            if (m_enmState == Dropped)
             {
-                newVer = reinterpret_cast<long*>(pcData)[0];
-                DO(("XdndAware=%u ", newVer));
+                m_eventQueue.append(e);
+                rc = RTSemEventSignal(m_hEventSem);
             }
-            XFree(pcData);
+            break;
+        }
+
+        default:
+        {
+            LogFlowThisFunc(("Unhandled: wnd=%#x, msg=%s\n",
+                             e.xclient.data.l[0], xAtomToString(e.xclient.message_type).c_str()));
+            rc = VERR_INVALID_STATE;
+            break;
         }
     }
 
-    if (newWin != m_curWin && m_curVer != -1)
+    LogFlowThisFunc(("Returning rc=%Rrc\n", rc));
+    return rc;
+}
+
+int DragInstance::onX11SelectionRequest(const XEvent &e)
+{
+    AssertReturn(e.type == SelectionRequest, VERR_INVALID_PARAMETER);
+
+    LogFlowThisFunc(("m_mode=%d, m_state=%d\n", m_enmMode, m_enmState));
+    LogFlowThisFunc(("Event owner=%#x, requestor=%#x, selection=%s, target=%s, prop=%s, time=%u\n",
+                     e.xselectionrequest.owner,
+                     e.xselectionrequest.requestor,
+                     xAtomToString(e.xselectionrequest.selection).c_str(),
+                     xAtomToString(e.xselectionrequest.target).c_str(),
+                     xAtomToString(e.xselectionrequest.property).c_str(),
+                     e.xselectionrequest.time));
+    int rc;
+
+    bool fSendEvent  = false;
+    Atom atmTarget   = None;
+    Atom atmProperty = None;
+
+    switch (m_enmMode)
     {
-        DO(("leave=%#x ", m_curWin));
+        case HG:
+        {
+            rc = VINF_SUCCESS;
+
+#ifdef DEBUG
+            XTextProperty propName;
+            XGetWMName(m_pDisplay, e.xselectionrequest.requestor, &propName);
+#endif
+            /*
+             * A window is asking for some data. Normally here the data would be copied
+             * into the selection buffer and send to the requestor. Obviously we can't
+             * do that, because we first need to ask the host for the data of the
+             * requested MIME type. This is done and later answered with the correct
+             * data -- see DragInstance::hgDataReceived().
+             */
+
+            /* Is the requestor asking for the possible MIME types? */
+            if (e.xselectionrequest.target == xAtom(XA_TARGETS))
+            {
+                LogFlowThisFunc(("wnd=%#x '%s' asking for target list\n", 
+                                 e.xselectionrequest.requestor, propName.value));
 
-        /* We left the current XdndAware window. Announce this to the window. */
+                /* If so, set the window property with the formats on the requestor
+                 * window. */
+                rc = wndXDnDSetFormatList(e.xselectionrequest.requestor, e.xselectionrequest.property, m_lstFormats);
+                if (RT_SUCCESS(rc)) 
+                {
+                    atmTarget   = e.xselectionrequest.target;
+                    atmProperty = e.xselectionrequest.property;
 
-        XClientMessageEvent m;
-        RT_ZERO(m);
-        m.type         = ClientMessage;
-        m.display      = m_pDisplay;
-        m.window       = m_curWin;
-        m.message_type = xAtom(XA_XdndLeave);
-        m.format       = 32;
-        m.data.l[0]    = m_proxyWin;
+                    fSendEvent  = true;
+                }
+            }
+            /* Is the requestor asking for a specific MIME type (we support)? */
+            else if (m_lstFormats.contains(e.xselectionrequest.target))
+            {
+                LogFlowThisFunc(("wnd=%#x '%s' asking for data, format=%s\n",
+                                 e.xselectionrequest.requestor, propName.value, 
+                                 xAtomToString(e.xselectionrequest.target).c_str()));
 
-        xrc = XSendEvent(m_pDisplay, m_curWin, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
-        if (RT_UNLIKELY(xrc == 0))
-            DO(("DnD_MOVE: error sending xevent\n"));
-    }
+                /* If so, we need to inform the host about this request. Save the
+                 * selection request event for later use. */
+                if (m_enmState != Dropped)
+                {
+                    LogFlowThisFunc(("Wrong state (%RU32), refusing request\n", m_enmState));
 
-    if (newWin != m_curWin && newVer != -1)
-    {
-        DO(("enter=%#x ", newWin));
+                    atmTarget   = None;
+                    atmProperty = e.xselectionrequest.property;
 
-        /* We enter a new window. Announce the XdndEnter event to the new
-         * window. The first three mime types are attached to the event (the
-         * others could be requested by the XdndTypeList property from the
-         * window itself). */
+                    fSendEvent  = true;
+                }
+                else
+                {
+                    LogFlowThisFunc(("Saving selection notify message of wnd=%#x '%s'\n", 
+                                     e.xselectionrequest.requestor, propName.value));
 
-        XClientMessageEvent m;
-        RT_ZERO(m);
-        m.type         = ClientMessage;
-        m.display      = m_pDisplay;
-        m.window       = newWin;
-        m.message_type = xAtom(XA_XdndEnter);
-        m.format       = 32;
-        m.data.l[0]    = m_proxyWin;
-        m.data.l[1]    = RT_MAKE_U32_FROM_U8(m_formats.size() > 3 ? 1 : 0, 0, 0, RT_MIN(VBOX_XDND_VERSION, newVer));
-        m.data.l[2]    = m_formats.value(0, None);
-        m.data.l[3]    = m_formats.value(1, None);
-        m.data.l[4]    = m_formats.value(2, None);
-
-        xrc = XSendEvent(m_pDisplay, newWin, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
-        if (RT_UNLIKELY(xrc == 0))
-            DO(("DnD_MOVE: error sending xevent\n"));
-    }
+                    memcpy(&m_eventHgSelection, &e, sizeof(XEvent));
 
-    if (newVer != -1)
-    {
-        DO(("move=%#x pos=%ux%u ", newWin, u32xPos, u32yPos));
+                    RTCString strFormat = xAtomToString(e.xselectionrequest.target);
+                    Assert(strFormat.isNotEmpty());
 
-        /* Send a XdndPosition event with the proposed action to the guest. */
+                    rc = VbglR3DnDHGRequestData(&m_dndCtx, strFormat.c_str());
+                    LogFlowThisFunc(("Requested data from host as \"%s\", rc=%Rrc\n", strFormat.c_str(), rc));
+                }
+            }
+            /* Anything else. */
+            else
+            {
+                LogFlowThisFunc(("Refusing unknown command of wnd=%#x '%s'\n", e.xselectionrequest.requestor, propName.value));
 
-        Atom pa = toX11Action(action);
-        DO(("action='%s' ", xAtomToString(pa).c_str()));
+                /* We don't understand this request message and therefore answer with an
+                 * refusal messages. */
+                fSendEvent = true;
+            }
 
-        XClientMessageEvent m;
-        RT_ZERO(m);
-        m.type         = ClientMessage;
-        m.display      = m_pDisplay;
-        m.window       = newWin;
-        m.message_type = xAtom(XA_XdndPosition);
-        m.format       = 32;
-        m.data.l[0]    = m_proxyWin;
-        m.data.l[2]    = RT_MAKE_U32(u32yPos, u32xPos);
-        m.data.l[3]    = CurrentTime;
-        m.data.l[4]    = pa;
-
-        xrc = XSendEvent(m_pDisplay, newWin, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
-        if (RT_UNLIKELY(xrc == 0))
-            DO(("DnD_MOVE: error sending xevent\n"));
-    }
-    if (newWin == None && newVer == -1)
-        /* No window to process, so send a ignore ack event to the host. */
-        rc = VbglR3DnDHGAcknowledgeOperation(DND_IGNORE_ACTION);
+            if (   RT_SUCCESS(rc)
+                && fSendEvent)
+            {
+                XEvent s;
+                RT_ZERO(s);
+                s.xselection.type      = SelectionNotify;
+                s.xselection.display   = e.xselection.display;
+                s.xselection.time      = e.xselectionrequest.time;
+                s.xselection.selection = e.xselectionrequest.selection;
+                s.xselection.requestor = e.xselectionrequest.requestor;
+                s.xselection.target    = atmTarget;
+                s.xselection.property  = atmProperty;
+
+                int xRc = XSendEvent(e.xselection.display, e.xselectionrequest.requestor, False, 0, &s);
+                if (RT_UNLIKELY(xRc == 0))
+                    logError("Error sending SelectionNotify(1) event to wnd=%#x: %s\n", e.xselectionrequest.requestor,
+                             gX11->xErrorToString(xRc).c_str());
+            }
 
-    m_curWin = newWin;
-    m_curVer = RT_MIN(VBOX_XDND_VERSION, newVer);
+#ifdef DEBUG
+            if (propName.value)
+                XFree(propName.value);
+#endif
+            break;
+        }
 
-    DO(("\n"));
+        default:
+        {
+            LogFlowThisFunc(("Unhandled message for wnd=%#x: %s\n",
+                             e.xclient.data.l[0], xAtomToString(e.xclient.message_type).c_str()));
+            rc = VERR_INVALID_STATE;
+            break;
+        }
+    }
 
+    LogFlowThisFunc(("Returning rc=%Rrc\n", rc));
     return rc;
 }
 
-int DragInstance::hgX11ClientMessage(const XEvent& e)
+int DragInstance::onX11Event(const XEvent &e)
 {
-    if (   m_mode  != HG)
-//        || m_state != Dragging)
-        return VERR_INVALID_STATE;
+    int rc;
 
-    /* Client messages are used to inform us about the status of a XdndAware
-     * window, in response of some events we send to them. */
-    int rc = VINF_SUCCESS;
-    if (   e.xclient.message_type == xAtom(XA_XdndStatus)
-        && m_curWin               == static_cast<Window>(e.xclient.data.l[0]))
-    {
-        /* The XdndStatus message tell us if the window will accept the DnD
-         * event and with which action. We immediately send this info down to
-         * the host as a response of a previous DnD message. */
-        DO(("DnD_STAT: win=%#x,accept=%RTbool,action='%s'\n",
-            e.xclient.data.l[0],
-            ASMBitTest(&e.xclient.data.l[1], 0),
-            xAtomToString(e.xclient.data.l[4]).c_str()));
-        uint32_t uAction = DND_IGNORE_ACTION;
-        /* Todo: compare this with the allowed actions. */
-        if (ASMBitTest(&e.xclient.data.l[1], 0))
-            uAction = toHGCMAction(static_cast<Atom>(e.xclient.data.l[4]));
-        rc = VbglR3DnDHGAcknowledgeOperation(uAction);
-    }
-    else if (e.xclient.message_type == xAtom(XA_XdndFinished))
+    LogFlowThisFunc(("X11 event, type=%d\n", e.type));
+    switch (e.type)
     {
-        /* This message is send on a un/successful DnD drop request. */
-        DO(("DnD_FINI: win=%#x,success=%RTbool,action='%s'\n",
-            e.xclient.data.l[0],
-            ASMBitTest(&e.xclient.data.l[1], 0),
-            xAtomToString(e.xclient.data.l[2]).c_str()));
-        reset();
-    }
-    else
-        DO(("DnD_CLI: win=%#x,msg='%s'\n", e.xclient.data.l[0], xAtomToString(e.xclient.message_type).c_str()));
-    return rc;
-}
+        case ButtonPress:
+            LogFlowThisFunc(("ButtonPress\n"));
+            rc = VINF_SUCCESS;
+            break;
 
-int DragInstance::hgDrop()
-{
-    DO(("DnD_DROP: win=%#x\n", m_curWin));
+        case ButtonRelease:
+            LogFlowThisFunc(("ButtonRelease\n"));
+            rc = VINF_SUCCESS;
+            break;
 
-    if (   m_mode  != HG
-        || m_state != Dragging)
-        return VERR_INVALID_STATE;
+        case ClientMessage:
+            rc = onX11ClientMessage(e);
+            break;
 
-    int rc = VINF_SUCCESS;
+        case SelectionClear:
+           LogFlowThisFunc(("SelectionClear\n"));
+           reset();
+           rc = VINF_SUCCESS;
+           break;
 
-    /* Send a drop event to the current window and reset our DnD status. */
-    XClientMessageEvent m;
-    RT_ZERO(m);
-    m.type         = ClientMessage;
-    m.display      = m_pDisplay;
-    m.window       = m_curWin;
-    m.message_type = xAtom(XA_XdndDrop);
-    m.format       = 32;
-    m.data.l[0]    = m_proxyWin;
-    m.data.l[2]    = CurrentTime;
+        case SelectionNotify:
+            rc = onX11SelectionNotify(e);
+            break;
 
-    int xrc = XSendEvent(m_pDisplay, m_curWin, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
-    if (RT_UNLIKELY(xrc == 0))
-        DO(("DnD_DROP: error sending xevent\n"));
+        case SelectionRequest:
+            rc = onX11SelectionRequest(e);
+            break;
 
-    m_curWin = None;
-    m_curVer = -1;
+        /*case MotionNotify:
+          hide();
+          break;*/
 
-    m_state = Dropped;
+        default:
+            rc = VERR_NOT_IMPLEMENTED;
+            break;
+    }
 
+    LogFlowThisFunc(("rc=%Rrc\n", rc));
     return rc;
 }
 
-int DragInstance::hgX11SelectionRequest(const XEvent& e)
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+bool DragInstance::waitForX11Msg(XEvent &evX, int iType, RTMSINTERVAL uTimeoutMS /* = 100 */)
 {
-    AssertReturn(e.type == SelectionRequest, VERR_INVALID_PARAMETER);
+    LogFlowThisFunc(("iType=%d, uTimeoutMS=%RU32, cEventQueue=%zu\n", iType, uTimeoutMS, m_eventQueue.size()));
 
-    if (   m_mode  != HG)
-//        || m_state != D)
-        return VERR_INVALID_STATE;
+    bool fFound = false;
+    const uint64_t uiStart = RTTimeMilliTS();
 
-    DO(("DnD_SELR: owner=%#x,requestor=%#x,sel_atom='%s',tar_atom='%s',prop_atom='%s',time=%u\n",
-        e.xselectionrequest.owner,
-        e.xselectionrequest.requestor,
-        xAtomToString(e.xselectionrequest.selection).c_str(),
-        xAtomToString(e.xselectionrequest.target).c_str(),
-        xAtomToString(e.xselectionrequest.property).c_str(),
-        e.xselectionrequest.time));
+    do
+    {
+        /* Check if there is a client message in the queue. */
+        for (size_t i = 0; i < m_eventQueue.size(); i++)
+        {
+            int rc2 = RTCritSectEnter(&m_eventQueueCS);
+            if (RT_SUCCESS(rc2))
+            {
+                XEvent e = m_eventQueue.at(i);
 
-    int rc = VINF_SUCCESS;
+                fFound = e.type == iType;
+                if (fFound)
+                {
+                    m_eventQueue.removeAt(i);
+                    evX = e;
+                }
 
-    /* A window is asking for some data. Normally here the data would be copied
-     * into the selection buffer and send to the requestor. Obviously we can't
-     * do that, cause we first need to ask the host for the data of the
-     * requested mime type. This is done and later answered with the correct
-     * data (s. dataReceived). */
+                rc2 = RTCritSectLeave(&m_eventQueueCS);
+                AssertRC(rc2);
 
-    /* Is the requestor asking for the possible mime types? */
-    if(e.xselectionrequest.target == xAtom(XA_TARGETS))
-    {
-        DO(("DnD_SELR: ask for target list\n"));
-        /* If so, set the window property with the formats on the requestor
-         * window. */
-        setFormatsWindowProperty(e.xselectionrequest.requestor, e.xselectionrequest.property);
-        XEvent s;
-        RT_ZERO(s);
-        s.xselection.type      = SelectionNotify;
-        s.xselection.display   = e.xselection.display;
-        s.xselection.time      = e.xselectionrequest.time;
-        s.xselection.selection = e.xselectionrequest.selection;
-        s.xselection.requestor = e.xselectionrequest.requestor;
-        s.xselection.target    = e.xselectionrequest.target;
-        s.xselection.property  = e.xselectionrequest.property;
-        int xrc = XSendEvent(e.xselection.display, e.xselectionrequest.requestor, False, 0, &s);
-        if (RT_UNLIKELY(xrc == 0))
-            DO(("DnD_SELR: error sending xevent\n"));
-    }
-    /* Is the requestor asking for a specific mime type (we support)? */
-    else if(m_formats.contains(e.xselectionrequest.target))
-    {
-        DO(("DnD_SELR: ask for data (format='%s')\n", xAtomToString(e.xselectionrequest.target).c_str()));
-        /* If so, we need to inform the host about this request. Save the
-         * selection request event for later use. */
-        if (   m_state != Dropped)
-            //        || m_curWin != e.xselectionrequest.requestor)
-        {
-            DO(("DnD_SELR: refuse\n"));
-            XEvent s;
-            RT_ZERO(s);
-            s.xselection.type      = SelectionNotify;
-            s.xselection.display   = e.xselection.display;
-            s.xselection.time      = e.xselectionrequest.time;
-            s.xselection.selection = e.xselectionrequest.selection;
-            s.xselection.requestor = e.xselectionrequest.requestor;
-            s.xselection.target    = None;
-            s.xselection.property  = e.xselectionrequest.property;
-            int xrc = XSendEvent(e.xselection.display, e.xselectionrequest.requestor, False, 0, &s);
-            if (RT_UNLIKELY(xrc == 0))
-                DO(("DnD_SELR: error sending xevent\n"));
+                if (fFound)
+                    break;
+            }
         }
-        else
+
+        if (fFound)
+            break;
+
+        int rc2 = RTSemEventWait(m_hEventSem, 25 /* ms */);
+        if (   RT_FAILURE(rc2)
+            && rc2 != VERR_TIMEOUT)
         {
-            memcpy(&m_selEvent, &e, sizeof(XEvent));
-            rc = VbglR3DnDHGRequestData(xAtomToString(e.xselectionrequest.target).c_str());
+            LogFlowFunc(("Waiting failed with rc=%Rrc\n", rc2));
+            break;
         }
     }
-    /* Anything else. */
-    else
-    {
-        DO(("DnD_SELR: refuse\n"));
-        /* We don't understand this request message and therefore answer with an
-         * refusal messages. */
-        XEvent s;
-        RT_ZERO(s);
-        s.xselection.type      = SelectionNotify;
-        s.xselection.display   = e.xselection.display;
-        s.xselection.time      = e.xselectionrequest.time;
-        s.xselection.selection = e.xselectionrequest.selection;
-        s.xselection.requestor = e.xselectionrequest.requestor;
-        s.xselection.target    = None; /* default is refusing */
-        s.xselection.property  = None; /* default is refusing */
-        int xrc = XSendEvent(e.xselection.display, e.xselectionrequest.requestor, False, 0, &s);
-        if (RT_UNLIKELY(xrc == 0))
-            DO(("DnD_SELR: error sending xevent\n"));
-    }
+    while (RTTimeMilliTS() - uiStart < uTimeoutMS);
 
-    return rc;
+    LogFlowThisFunc(("Returning fFound=%RTbool, msRuntime=%RU64\n", fFound, RTTimeMilliTS() - uiStart));
+    return fFound;
 }
 
-int DragInstance::hgDataReceived(void *pvData, uint32_t cData)
+bool DragInstance::waitForX11ClientMsg(XClientMessageEvent &evMsg, Atom aType,
+                                       RTMSINTERVAL uTimeoutMS /*= 100 */)
 {
-    if (   m_mode  != HG
-        || m_state != Dropped)
-        return VERR_INVALID_STATE;
+    LogFlowThisFunc(("aType=%s, uTimeoutMS=%RU32, cEventQueue=%zu\n",
+                     xAtomToString(aType).c_str(), uTimeoutMS, m_eventQueue.size()));
 
-    if (RT_UNLIKELY(   pvData == NULL
-                    || cData  == 0))
-        return VERR_INVALID_PARAMETER;
+    bool fFound = false;
+    const uint64_t uiStart = RTTimeMilliTS();
+    do
+    {
+        /* Check if there is a client message in the queue. */
+        for (size_t i = 0; i < m_eventQueue.size(); i++)
+        {
+            int rc2 = RTCritSectEnter(&m_eventQueueCS);
+            if (RT_SUCCESS(rc2))
+            {
+                XEvent e = m_eventQueue.at(i);
+                if (e.type == ClientMessage)
+                {
+                    m_eventQueue.removeAt(i);
+                    evMsg = e.xclient;
 
-    if (RT_UNLIKELY(m_state != Dropped))
-        return VERR_INVALID_STATE;
+                    fFound = true;
+                }
 
-    /* Make a copy of the data. The xserver will become the new owner. */
-    void *pvNewData = RTMemAlloc(cData);
-    if (RT_UNLIKELY(!pvNewData))
-        return VERR_NO_MEMORY;
-    memcpy(pvNewData, pvData, cData);
+                rc2 = RTCritSectLeave(&m_eventQueueCS);
+                AssertRC(rc2);
 
-    /* The host send us the DnD data in the requested mime type. This allows us
-     * to fill the XdndSelection property of the requestor window with the data
-     * and afterwards inform him about the new status. */
-    XEvent s;
-    RT_ZERO(s);
-    s.xselection.type      = SelectionNotify;
-    s.xselection.display   = m_selEvent.xselection.display;
-//    s.xselection.owner     = m_selEvent.xselectionrequest.owner;
-    s.xselection.time      = m_selEvent.xselectionrequest.time;
-    s.xselection.selection = m_selEvent.xselectionrequest.selection;
-    s.xselection.requestor = m_selEvent.xselectionrequest.requestor;
-    s.xselection.target    = m_selEvent.xselectionrequest.target;
-    s.xselection.property  = m_selEvent.xselectionrequest.property;
-
-    DO(("DnD_SEND: owner=%#x,requestor=%#x,sel_atom='%s',tar_atom='%s',prop_atom='%s',time=%u\n",
-        m_selEvent.xselectionrequest.owner,
-        s.xselection.requestor,
-        xAtomToString(s.xselection.selection).c_str(),
-        xAtomToString(s.xselection.target).c_str(),
-        xAtomToString(s.xselection.property).c_str(),
-        s.xselection.time));
+                if (fFound)
+                    break;
+            }
+        }
 
-    /* Fill up the property with the data. */
-    XChangeProperty(s.xselection.display, s.xselection.requestor, s.xselection.property, s.xselection.target, 8, PropModeReplace,
-                    reinterpret_cast<const unsigned char*>(pvNewData), cData);
-    int xrc = XSendEvent(s.xselection.display, s.xselection.requestor, True, 0, &s);
-    if (RT_UNLIKELY(xrc == 0))
-        DO(("DnD_SEND: error sending xevent\n"));
+        if (fFound)
+            break;
 
-    return VINF_SUCCESS;
-}
+        int rc2 = RTSemEventWait(m_hEventSem, 25 /* ms */);
+        if (   RT_FAILURE(rc2)
+            && rc2 != VERR_TIMEOUT)
+        {
+            LogFlowFunc(("Waiting failed with rc=%Rrc\n", rc2));
+            break;
+        }
+    }
+    while (RTTimeMilliTS() - uiStart < uTimeoutMS);
 
+    LogFlowThisFunc(("Returning fFound=%RTbool, msRuntime=%RU64\n", fFound, RTTimeMilliTS() - uiStart));
+    return fFound;
+}
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
 
-#ifdef VBOX_WITH_DRAG_AND_DROP_GH
 /*
- * Guest -> Host
+ * Host -> Guest
  */
 
-int DragInstance::ghIsDnDPending()
+int DragInstance::hgEnter(const RTCList<RTCString> &formats, uint32_t uActions)
+{
+    LogFlowThisFunc(("mode=%RU32, state=%RU32\n", m_enmMode, m_enmState));
+
+    if (m_enmMode != Unknown) 
+        return VERR_INVALID_STATE;
+
+    reset();
+
+#ifdef DEBUG
+    LogFlowThisFunc(("uActions=0x%x, lstFormats=%zu: ", uActions, formats.size()));
+    for (size_t i = 0; i < formats.size(); ++i)
+        LogFlow(("'%s' ", formats.at(i).c_str()));
+    LogFlow(("\n"));
+#endif
+
+    int rc;
+
+    do
+    {
+        rc = toAtomList(formats, m_lstFormats);
+        if (RT_FAILURE(rc))
+            break;
+
+        /* If we have more than 3 formats we have to use the type list extension. */
+        if (m_lstFormats.size() > 3)
+        {
+            rc = wndXDnDSetFormatList(m_wndProxy, xAtom(XA_XdndTypeList), m_lstFormats);
+            if (RT_FAILURE(rc))
+                break;
+        }
+
+        /* Announce the possible actions. */
+        VBoxDnDAtomList lstActions;
+        rc = toAtomActions(uActions, lstActions);
+        if (RT_FAILURE(rc))
+            break;
+        rc = wndXDnDSetActionList(m_wndProxy, lstActions);
+
+        /* Set the DnD selection owner to our window. */
+        XSetSelectionOwner(m_pDisplay, xAtom(XA_XdndSelection), m_wndProxy, CurrentTime);
+
+        m_enmMode  = HG;
+        m_enmState = Dragging;
+
+    } while (0);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int DragInstance::hgLeave(void)
+{
+    if (m_enmMode == HG)
+        reset();
+
+    return VINF_SUCCESS;
+}
+
+int DragInstance::hgMove(uint32_t u32xPos, uint32_t u32yPos, uint32_t uAction)
+{
+    LogFlowThisFunc(("mode=%RU32, state=%RU32\n", m_enmMode, m_enmState));
+    LogFlowThisFunc(("u32xPos=%RU32, u32yPos=%RU32, uAction=%RU32\n", u32xPos, u32yPos, uAction));
+
+    if (   m_enmMode  != HG
+        || m_enmState != Dragging)
+    {
+        return VERR_INVALID_STATE;
+    }
+
+    int rc  = VINF_SUCCESS;
+    int xRc = Success;
+
+    /* Move the mouse cursor within the guest. */
+    mouseCursorMove(u32xPos, u32yPos);
+
+    long newVer = -1; /* This means the current window is _not_ XdndAware. */
+
+    /* Search for the application window below the cursor. */
+    Window wndCursor = gX11->applicationWindowBelowCursor(m_wndRoot);
+    if (wndCursor != None)
+    {
+        /* Temp stuff for the XGetWindowProperty call. */
+        Atom atmp;
+        int fmt;
+        unsigned long cItems, cbRemaining;
+        unsigned char *pcData = NULL;
+
+        /* Query the XdndAware property from the window. We are interested in
+         * the version and if it is XdndAware at all. */
+        xRc = XGetWindowProperty(m_pDisplay, wndCursor, xAtom(XA_XdndAware),
+                                 0, 2, False, AnyPropertyType,
+                                 &atmp, &fmt, &cItems, &cbRemaining, &pcData);
+
+        if (RT_UNLIKELY(xRc != Success))
+            logError("Error getting properties of cursor window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str());
+        else
+        {
+            if (RT_UNLIKELY(pcData == NULL || fmt != 32 || cItems != 1))
+                LogFlowThisFunc(("Wrong properties: pcData=%#x, iFmt=%d, cItems=%ul\n", pcData, fmt, cItems));
+            else
+            {
+                newVer = reinterpret_cast<long*>(pcData)[0];
+#ifdef DEBUG
+                XTextProperty propName;
+                if (XGetWMName(m_pDisplay, wndCursor, &propName))
+                {
+                    LogFlowThisFunc(("Current: wndCursor=%#x '%s', XdndAware=%ld\n", wndCursor, propName.value, newVer));
+                    XFree(propName.value);
+                }
+#endif
+            }
+
+            XFree(pcData);
+        }
+    }
+
+    /*
+     * Is the window under the cursor another one than our current one? 
+     * Cancel the current drop. 
+     */
+    if (   wndCursor != m_wndCur
+        && m_curVer  != -1)
+    {
+        LogFlowThisFunc(("XA_XdndLeave: window=%#x\n", m_wndCur));
+
+        /* We left the current XdndAware window. Announce this to the current indow. */
+        XClientMessageEvent m;
+        RT_ZERO(m);
+        m.type         = ClientMessage;
+        m.display      = m_pDisplay;
+        m.window       = m_wndCur;
+        m.message_type = xAtom(XA_XdndLeave);
+        m.format       = 32;
+        m.data.l[0]    = m_wndProxy;                    /* Source window. */
+
+        xRc = XSendEvent(m_pDisplay, m_wndCur, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
+        if (RT_UNLIKELY(xRc == 0))
+            logError("Error sending XA_XdndLeave event to old window=%#x: %s\n", m_wndCur, gX11->xErrorToString(xRc).c_str());
+    }
+
+    /*
+     * Do we have a new window which now is under the cursor?
+     */
+    if (   wndCursor != m_wndCur
+        && newVer    != -1)
+    {
+        LogFlowThisFunc(("XA_XdndEnter: window=%#x\n", wndCursor));
+
+        /*
+         * We enter a new window. Announce the XdndEnter event to the new
+         * window. The first three mime types are attached to the event (the
+         * others could be requested by the XdndTypeList property from the
+         * window itself).
+         */
+        XClientMessageEvent m;
+        RT_ZERO(m);
+        m.type         = ClientMessage;
+        m.display      = m_pDisplay;
+        m.window       = wndCursor;
+        m.message_type = xAtom(XA_XdndEnter);
+        m.format       = 32;
+        m.data.l[0]    = m_wndProxy;                    /* Source window. */
+        m.data.l[1]    = RT_MAKE_U32_FROM_U8(
+                         /* Bit 0 is set if the source supports more than three data types. */
+                         m_lstFormats.size() > 3 ? 1 : 0,
+                         /* Reserved for future use. */
+                         0, 0,
+                         /* Protocol version to use. */
+                         RT_MIN(VBOX_XDND_VERSION, newVer));
+        m.data.l[2]    = m_lstFormats.value(0, None);   /* First data type to use. */
+        m.data.l[3]    = m_lstFormats.value(1, None);   /* Second data type to use. */
+        m.data.l[4]    = m_lstFormats.value(2, None);   /* Third data type to use. */
+
+        xRc = XSendEvent(m_pDisplay, wndCursor, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
+        if (RT_UNLIKELY(xRc == 0))
+            logError("Error sending XA_XdndEnter event to window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str());
+    }
+
+    if (newVer != -1)
+    {
+        LogFlowThisFunc(("XA_XdndPosition: xPos=%RU32, yPos=%RU32 to window=%#x\n", u32xPos, u32yPos, wndCursor));
+
+        /*
+         * Send a XdndPosition event with the proposed action to the guest.
+         */
+        Atom pa = toAtomAction(uAction);
+        LogFlowThisFunc(("strAction=%s\n", xAtomToString(pa).c_str()));
+
+        XClientMessageEvent m;
+        RT_ZERO(m);
+        m.type         = ClientMessage;
+        m.display      = m_pDisplay;
+        m.window       = wndCursor;
+        m.message_type = xAtom(XA_XdndPosition);
+        m.format       = 32;
+        m.data.l[0]    = m_wndProxy;                    /* X window ID of source window. */
+        m.data.l[2]    = RT_MAKE_U32(u32yPos, u32xPos); /* Cursor coordinates relative to the root window. */
+        m.data.l[3]    = CurrentTime;                   /* Timestamp for retrieving data. */
+        m.data.l[4]    = pa;                            /* Actions requested by the user. */
+
+        xRc = XSendEvent(m_pDisplay, wndCursor, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
+        if (RT_UNLIKELY(xRc == 0))
+            logError("Error sending XA_XdndPosition event to current window=%#x: %s\n", wndCursor, gX11->xErrorToString(xRc).c_str());
+    }
+
+    if (   wndCursor == None
+        && newVer    == -1)
+    {
+        /* No window to process, so send a ignore ack event to the host. */
+        rc = VbglR3DnDHGAcknowledgeOperation(&m_dndCtx, DND_IGNORE_ACTION);
+    }
+    else
+    {
+        m_wndCur = wndCursor;
+        m_curVer = RT_MIN(VBOX_XDND_VERSION, newVer);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int DragInstance::hgDrop(void)
+{
+    LogFlowThisFunc(("wndCur=%#x, wndProxy=%#x, mode=%RU32, state=%RU32\n", m_wndProxy, m_wndCur, m_enmMode, m_enmState));
+
+    if (   m_enmMode  != HG
+        || m_enmState != Dragging)
+    {
+        return VERR_INVALID_STATE;
+    }
+
+    int rc = VINF_SUCCESS;
+
+    /* 
+     * Send a drop event to the current window and reset our DnD status.
+     */
+    XClientMessageEvent m;
+    RT_ZERO(m);
+    m.type         = ClientMessage;
+    m.display      = m_pDisplay;
+    m.window       = m_wndCur;
+    m.message_type = xAtom(XA_XdndDrop);
+    m.format       = 32;
+    m.data.l[0]    = m_wndProxy;                        /* Source window. */
+    m.data.l[2]    = CurrentTime;                       /* Timestamp. */
+
+    int xRc = XSendEvent(m_pDisplay, m_wndCur, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
+    if (RT_UNLIKELY(xRc == 0))
+        logError("Error sending XA_XdndDrop event to current window=%#x: %s\n", m_wndCur, gX11->xErrorToString(xRc).c_str());
+
+    m_wndCur = None;
+    m_curVer = -1;
+
+    m_enmState = Dropped;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int DragInstance::hgDataReceived(void *pvData, uint32_t cbData)
+{
+    LogFlowThisFunc(("mode=%RU32, state=%RU32\n", m_enmMode, m_enmState));
+
+    if (   m_enmMode  != HG
+        || m_enmState != Dropped)
+    {
+        return VERR_INVALID_STATE;
+    }
+
+    if (RT_UNLIKELY(   pvData == NULL
+                    || cbData  == 0))
+    {
+        return VERR_INVALID_PARAMETER;
+    }
+
+    /* Make a copy of the data. The X server will become the new owner. */
+    void *pvNewData = RTMemAlloc(cbData);
+    if (RT_UNLIKELY(!pvNewData))
+        return VERR_NO_MEMORY;
+
+    memcpy(pvNewData, pvData, cbData);
+
+    /*
+     * The host has sent us the DnD data in the requested MIME type. This allows us
+     * to fill the XdndSelection property of the requestor window with the data
+     * and afterwards inform the host about the new status.
+     */
+    XEvent s;
+    RT_ZERO(s);
+    s.xselection.type      = SelectionNotify;
+    s.xselection.display   = m_eventHgSelection.xselection.display;
+//    s.xselection.owner     = m_selEvent.xselectionrequest.owner;
+    s.xselection.time      = m_eventHgSelection.xselectionrequest.time;
+    s.xselection.selection = m_eventHgSelection.xselectionrequest.selection;
+    s.xselection.requestor = m_eventHgSelection.xselectionrequest.requestor;
+    s.xselection.target    = m_eventHgSelection.xselectionrequest.target;
+    s.xselection.property  = m_eventHgSelection.xselectionrequest.property;
+
+    LogFlowThisFunc(("owner=%#x, requestor=%#x, sel_atom=%s, target_atom=%s, prop_atom=%s, time=%u\n",
+                     m_eventHgSelection.xselectionrequest.owner,
+                     s.xselection.requestor,
+                     xAtomToString(s.xselection.selection).c_str(),
+                     xAtomToString(s.xselection.target).c_str(),
+                     xAtomToString(s.xselection.property).c_str(),
+                     s.xselection.time));
+
+    /* Fill up the property with the data. */
+    XChangeProperty(s.xselection.display, s.xselection.requestor, s.xselection.property, s.xselection.target, 8, PropModeReplace,
+                    reinterpret_cast<const unsigned char*>(pvNewData), cbData);
+    int xRc = XSendEvent(s.xselection.display, s.xselection.requestor, True, 0, &s);
+    if (RT_UNLIKELY(xRc == 0))
+        logError("Error sending SelectionNotify(2) event to window=%#x: %s\n",
+                 s.xselection.requestor, gX11->xErrorToString(xRc).c_str());
+
+    /* We're finally done, reset. */
+    reset();
+
+    return VINF_SUCCESS;
+}
+
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+int DragInstance::ghIsDnDPending(void)
 {
+    LogFlowThisFunc(("mode=%RU32, state=%RU32\n", m_enmMode, m_enmState));
+
+    if (m_enmMode == HG)
+        return VERR_INVALID_STATE;
+
     int rc = VINF_SUCCESS;
-    Window w = XGetSelectionOwner(m_pDisplay, xAtom(XA_XdndSelection));
-    DO(("Checking pending %X %X\n", w, m_proxyWin));
-    /* Is there someone own the Xdnd selection which aren't we. */
-    if (   w
-        && w != m_proxyWin)
+    Window wndSelection = XGetSelectionOwner(m_pDisplay, xAtom(XA_XdndSelection));
+    LogFlowThisFunc(("Checking pending wndSelection=%#x, wndProxy=%#x\n", wndSelection, m_wndProxy));
+
+    /* Is this another window which has a Xdnd selection than our current one? */
+    if (   wndSelection
+        && wndSelection != m_wndProxy)
     {
         /* Map the window on the current cursor position, which should provoke
          * an XdndEnter event. */
-        int rx, ry;
-        showProxyWin(rx, ry);
+        proxyWinShow(NULL, NULL, true);
+
         XEvent e;
-        if (m_pParent->waitForXMsg(e, ClientMessage))
+        if (waitForX11Msg(e, ClientMessage))
         {
-            int xrc = Success;
-            XClientMessageEvent *clme = reinterpret_cast<XClientMessageEvent*>(&e);
-            DO(("next X event %s\n", gX11->xAtomToString(clme->message_type).c_str()));
-            if (clme->message_type == xAtom(XA_XdndEnter))
+            bool fAcceptDrop = false;
+
+            int xRc;
+            XClientMessageEvent *pEventClient = reinterpret_cast<XClientMessageEvent*>(&e);
+            AssertPtr(pEventClient);
+
+            LogFlowThisFunc(("Received event=%s\n",
+                             gX11->xAtomToString(pEventClient->message_type).c_str()));
+
+            if (pEventClient->message_type == xAtom(XA_XdndEnter))
             {
-                Atom type = None;
-                int f;
-                unsigned long n, a;
-                unsigned char *ret = 0;
+                LogFlowThisFunc(("XA_XdndEnter\n"));
+
+                /*
+                 * Prepare everything for our new window.
+                 */
                 reset();
 
-                m_formats.clear();
-                m_actions.clear();
-                m_curWin = w;
-                DO(("XA_XdndEnter\n"));
-                /* Check if the mime types are in the msg itself or if we need
+                /*
+                 * Update our state and the window handle to process.
+                 */
+                m_enmMode   = GH;
+                m_enmState  = Dragging;
+                m_wndCur    = wndSelection;
+                Assert(m_wndCur == (Window)pEventClient->data.l[0]);
+#ifdef DEBUG
+                XWindowAttributes xwa;
+                XGetWindowAttributes(m_pDisplay, m_wndCur, &xwa);
+                LogFlowThisFunc(("m_wndCur=%#x, x=%d, y=%d, width=%d, height=%d\n",
+                                 m_wndCur, xwa.x, xwa.y, xwa.width, xwa.height));
+#endif
+                /* Check if the MIME types are in the message itself or if we need
                  * to fetch the XdndTypeList property from the window. */
-                if (!ASMBitTest(&clme->data.l[1], 0))
+                if (!ASMBitTest(&pEventClient->data.l[1], 0))
                 {
                     for (int i = 2; i < 5; ++i)
                     {
-                        DO(("receive list msg: %s\n", gX11->xAtomToString(clme->data.l[i]).c_str()));
-                        m_formats.append(clme->data.l[i]);
+                        LogFlowThisFunc(("Received format via message: %s\n",
+                                         gX11->xAtomToString(pEventClient->data.l[i]).c_str()));
+
+                        m_lstFormats.append(pEventClient->data.l[i]);
                     }
                 }
                 else
                 {
-                    xrc = XGetWindowProperty(m_pDisplay, w, xAtom(XA_XdndTypeList), 0, VBOX_MAX_XPROPERTIES, False, XA_ATOM, &type, &f, &n, &a, &ret);
-                    if (   xrc == Success
-                        && n > 0
-                        && ret)
-                    {
-                        Atom *data = reinterpret_cast<Atom*>(ret);
-                        for (int i = 0; i < RT_MIN(VBOX_MAX_XPROPERTIES, n); ++i)
-                        {
-                            DO(("receive list: %s\n", gX11->xAtomToString(data[i]).c_str()));
-                            m_formats.append(data[i]);
-                        }
-                        XFree(ret);
-                    }
-                }
-                /* Fetch the possible list of actions, if this property is set. */
-                xrc = XGetWindowProperty(m_pDisplay, w, xAtom(XA_XdndActionList), 0, VBOX_MAX_XPROPERTIES, False, XA_ATOM, &type, &f, &n, &a, &ret);
-                if (   xrc == Success
-                    && n > 0
-                    && ret)
-                {
-                    Atom *data = reinterpret_cast<Atom*>(ret);
-                    for (int i = 0; i < RT_MIN(VBOX_MAX_XPROPERTIES, n); ++i)
-                    {
-                        DO(("receive actions: %s\n", gX11->xAtomToString(data[i]).c_str()));
-                        m_actions.append(data[i]);
-                    }
-                    XFree(ret);
+                    rc = wndXDnDGetTypeList(wndSelection, m_lstFormats);
                 }
 
-                m_state = Dragging;
-                m_mode  = GH;
-                /* Acknowledge the event by sending a Status msg back to the
-                 * window. */
-                XClientMessageEvent m;
-                RT_ZERO(m);
-                m.type         = ClientMessage;
-                m.display      = m_pDisplay;
-                m.window       = clme->data.l[0];
-                m.message_type = xAtom(XA_XdndStatus);
-                m.format       = 32;
-                m.data.l[0]    = m_proxyWin;
-                m.data.l[1]    = 1;
-                m.data.l[4]    = xAtom(XA_XdndActionCopy);
-                xrc = XSendEvent(m_pDisplay, clme->data.l[0], False, 0, reinterpret_cast<XEvent*>(&m));
-                if (RT_UNLIKELY(xrc == 0))
-                    DO(("DnD_PNDG: error sending xevent\n"));
+                /*
+                 * Fetch the actions.
+                 */
+                rc = wndXDnDGetActionList(wndSelection, m_lstActions);
+               
+                fAcceptDrop = true;
             }
-            else if (clme->message_type == xAtom(XA_XdndPosition))
+            /* Did the source tell us where the cursor currently is? */
+            else if (pEventClient->message_type == xAtom(XA_XdndPosition))
             {
-                DO(("XA_XdndPosition\n"));
+                LogFlowThisFunc(("XA_XdndPosition\n"));
+                fAcceptDrop = true;
+            }
+            else if (pEventClient->message_type == xAtom(XA_XdndLeave))
+            {
+                LogFlowThisFunc(("XA_XdndLeave\n"));
+            }
+
+            if (fAcceptDrop)
+            {
+                /* Reply with a XdndStatus message to tell the source whether
+                 * the data can be dropped or not. */
                 XClientMessageEvent m;
                 RT_ZERO(m);
                 m.type         = ClientMessage;
                 m.display      = m_pDisplay;
-                m.window       = clme->data.l[0];
+                m.window       = m_wndCur;
                 m.message_type = xAtom(XA_XdndStatus);
                 m.format       = 32;
-                m.data.l[0]    = m_proxyWin;
-                m.data.l[1]    = 1;
-                m.data.l[4]    = clme->data.l[4];
-                xrc = XSendEvent(m_pDisplay, clme->data.l[0], False, 0, reinterpret_cast<XEvent*>(&m));
-                if (RT_UNLIKELY(xrc == 0))
-                    DO(("DnD_PNDG: error sending xevent\n"));
-            }
-            else if (clme->message_type == xAtom(XA_XdndLeave))
-            {
+                m.data.l[0]    = m_wndProxy;
+                m.data.l[1]    = RT_BIT(0); /* Accept the drop. */
+                m.data.l[4]    = xAtom(XA_XdndActionCopy); /** @todo Make the accepted action configurable. */
+
+                xRc = XSendEvent(m_pDisplay, m_wndCur,
+                                 False, 0, reinterpret_cast<XEvent*>(&m));
+                if (RT_UNLIKELY(xRc == 0))
+                {
+                    logError("Error sending position XA_XdndStatus event to current window=%#x: %s\n",
+                              m_wndCur, gX11->xErrorToString(xRc).c_str());
+                }
             }
         }
-        hideProxyWin();
 
-        rc = VbglR3DnDGHAcknowledgePending(DND_COPY_ACTION, toHGCMActions(m_actions), gX11->xAtomListToString(m_formats).c_str());
+        /* Do we need to acknowledge at least one format to the host? */
+        if (!m_lstFormats.isEmpty())
+        {
+            RTCString strFormats = gX11->xAtomListToString(m_lstFormats);
+            uint32_t uDefAction = DND_COPY_ACTION; /** @todo Handle default action! */
+            uint32_t uAllActions = toHGCMActions(m_lstActions);
+
+            rc = VbglR3DnDGHAcknowledgePending(&m_dndCtx, uDefAction, uAllActions, strFormats.c_str());
+            LogFlowThisFunc(("Acknowledging m_uClientID=%RU32, allActions=0x%x, strFormats=%s, rc=%Rrc\n",
+                             m_dndCtx.uClientID, uAllActions, strFormats.c_str(), rc));
+        }
     }
+
+    LogFlowFuncLeaveRC(rc);
     return rc;
 }
 
-int DragInstance::ghDropped(const RTCString &strFormat, uint32_t action)
+int DragInstance::ghDropped(const RTCString &strFormat, uint32_t uAction)
 {
-    DO(("DND_DRO: format='%s' action=%d\n", strFormat.c_str(), action));
+    LogFlowThisFunc(("mode=%RU32, state=%RU32, strFormat=%s, uAction=%RU32\n", 
+                     m_enmMode, m_enmState, strFormat.c_str(), uAction));
+
+    if (   m_enmMode  != GH
+        || m_enmState != Dragging)
+    {
+        return VERR_INVALID_STATE;
+    }
+
     int rc = VINF_SUCCESS;
 
+    m_enmState = Dropped;
+
     /* Show the proxy window, so that the source will find it. */
-    int rx, ry;
-    showProxyWin(rx, ry);
+    int iRootX, iRootY;
+    proxyWinShow(&iRootX, &iRootY);
     XFlush(m_pDisplay);
+
+#ifdef DEBUG
+    XWindowAttributes xwa;
+    XGetWindowAttributes(m_pDisplay, m_wndCur, &xwa);
+    LogFlowThisFunc(("wndCur=%#x, x=%d, y=%d, width=%d, height=%d\n", m_wndCur, xwa.x, xwa.y, xwa.width, xwa.height));
+#endif
+
     /* We send a fake release event to the current window, cause
      * this should have the grab. */
-    sendButtonEvent(m_curWin, rx, ry, 1, false);
-    /* The fake button release event, should lead to an XdndDrop event from the
-     * source. Because of the showing of the proxy window, sometimes other Xdnd
-     * events occurs before, like a XdndPosition event. We are not interested
-     * in those, so try to get the right one. */
-    XEvent e;
-    XClientMessageEvent *clme = 0;
-    RT_ZERO(e);
-    int tries = 3;
-    do
+    mouseButtonSet(m_wndCur /* Destination window */, iRootX, iRootY,
+                   1 /* Button */, false /* fPress */);
+
+    /** 
+     * The fake button release event above should lead to a XdndDrop event from the
+     * source. Because of showing our proxy window, other Xdnd events can
+     * occur before, e.g. a XdndPosition event. We are not interested
+     * in those, so just try to get the right one. 
+     */ 
+
+    XClientMessageEvent evDnDDrop;
+    bool fDrop = waitForX11ClientMsg(evDnDDrop, xAtom(XA_XdndDrop), 5 * 1000 /* Timeout in ms */);
+    if (fDrop)
     {
-        if (m_pParent->waitForXMsg(e, ClientMessage))
-        {
-            if (reinterpret_cast<XClientMessageEvent*>(&e)->message_type == xAtom(XA_XdndDrop))
-            {
-                clme = reinterpret_cast<XClientMessageEvent*>(&e);
-                break;
-            }
-        }
-    } while (tries--);
-    if (clme)
-    {
-        /* Make some paranoid checks. */
-        if (clme->message_type == xAtom(XA_XdndDrop))
+        LogFlowThisFunc(("XA_XdndDrop\n"));
+
+        /* Request to convert the selection in the specific format and
+         * place it to our proxy window as property. */
+        Window wndSource = evDnDDrop.data.l[0]; /* Source window which has sent the message. */
+        Assert(wndSource == m_wndCur);
+        Atom aFormat  = gX11->stringToxAtom(strFormat.c_str());
+
+        XConvertSelection(m_pDisplay, xAtom(XA_XdndSelection), aFormat, xAtom(XA_XdndSelection),
+                          m_wndProxy, evDnDDrop.data.l[2]);
+
+        /* Wait for the selection notify event. */
+        XEvent evSelNotify;
+        RT_ZERO(evSelNotify);
+        if (waitForX11Msg(evSelNotify, SelectionNotify))
         {
-            /* Request to convert the selection in the specific format and
-             * place it to our proxy window as property. */
-            Window srcWin = m_curWin;//clme->data.l[0];
-            Atom aFormat  = gX11->stringToxAtom(strFormat.c_str());
-            XConvertSelection(m_pDisplay, xAtom(XA_XdndSelection), aFormat, xAtom(XA_XdndSelection), m_proxyWin, clme->data.l[2]);
-            /* Wait for the selection notify event. */
-            RT_ZERO(e);
-            if (m_pParent->waitForXMsg(e, SelectionNotify))
+            bool fCancel = false;
+
+            /* Make some paranoid checks. */
+            if (   evSelNotify.xselection.type      == SelectionNotify
+                && evSelNotify.xselection.display   == m_pDisplay
+                && evSelNotify.xselection.selection == xAtom(XA_XdndSelection)
+                && evSelNotify.xselection.requestor == m_wndProxy
+                && evSelNotify.xselection.target    == aFormat)
             {
-                /* Make some paranoid checks. */
-                if (   e.xselection.type      == SelectionNotify
-                    && e.xselection.display   == m_pDisplay
-                    && e.xselection.selection == xAtom(XA_XdndSelection)
-                    && e.xselection.requestor == m_proxyWin
-                    && e.xselection.target    == aFormat)
+                LogFlowThisFunc(("Selection notfiy (from wnd=%#x)\n", m_wndCur));
+
+                Atom aPropType;
+                int iPropFormat;
+                unsigned long cItems, cbRemaining;
+                unsigned char *pcData = NULL;
+                int xRc = XGetWindowProperty(m_pDisplay, m_wndProxy,
+                                             xAtom(XA_XdndSelection)  /* Property */,
+                                             0                        /* Offset */,
+                                             VBOX_MAX_XPROPERTIES     /* Length of 32-bit multiples */,
+                                             True                     /* Delete property? */,
+                                             AnyPropertyType,         /* Property type */
+                                             &aPropType, &iPropFormat, &cItems, &cbRemaining, &pcData);
+                if (RT_UNLIKELY(xRc != Success))
+                    LogFlowThisFunc(("Error getting XA_XdndSelection property of proxy window=%#x: %s\n", 
+                                     m_wndProxy, gX11->xErrorToString(xRc).c_str()));
+
+                LogFlowThisFunc(("strType=%s, iPropFormat=%d, cItems=%RU32, cbRemaining=%RU32\n",
+                                 gX11->xAtomToString(aPropType).c_str(), iPropFormat, cItems, cbRemaining));
+
+                if (   aPropType   != None
+                    && pcData      != NULL
+                    && iPropFormat >= 8
+                    && cItems      >  0
+                    && cbRemaining == 0)
                 {
-                    DO(("DND_DRO: selection notfiy (from: %x)\n", m_curWin));
-                    Atom type;
-                    int format;
-                    unsigned long cItems, cbRemaining;
-                    unsigned char *ucData = 0;
-                    XGetWindowProperty(m_pDisplay, m_proxyWin, xAtom(XA_XdndSelection),
-                                       0, VBOX_MAX_XPROPERTIES, True, AnyPropertyType,
-                                       &type, &format, &cItems, &cbRemaining, &ucData);
-                    DO(("DND_DRO: %s %d %d %s\n", gX11->xAtomToString(type).c_str(), cItems, format, ucData));
-                    if (   type        != None
-                        && ucData      != NULL
-                        && format      >= 8
-                        && cItems      >  0
-                        && cbRemaining == 0)
+                    size_t cbData = cItems * (iPropFormat / 8);
+                    LogFlowThisFunc(("cbData=%zu\n", cbData));
+
+                    /* For whatever reason some of the string MIME types are not
+                     * zero terminated. Check that and correct it when necessary,
+                     * because the guest side wants this in any case. */
+                    if (   m_lstAllowedFormats.contains(strFormat)
+                        && pcData[cbData - 1] != '\0')
                     {
-                        size_t cbData = cItems * (format / 8);
-                        /* For whatever reason some of the string mime-types are not
-                         * zero terminated. Check that and correct it when necessary,
-                         * cause the guest side wants this always. */
-                        if (   m_sstrStringMimeTypes.contains(strFormat)
-                            && ucData[cbData - 1] != '\0')
+                        unsigned char *pvDataTmp = static_cast<unsigned char*>(RTMemAlloc(cbData + 1));
+                        if (pvDataTmp)
                         {
-                            DO(("rebuild %u\n", cbData));
-                            unsigned char *ucData1 = static_cast<unsigned char*>(RTMemAlloc(cbData + 1));
-                            if (ucData1)
-                            {
-                                memcpy(ucData1, ucData, cbData);
-                                ucData1[cbData++] = '\0';
-                                /* Got the data and its fully transfered. */
-                                rc = VbglR3DnDGHSendData(ucData1, cbData);
-                                RTMemFree(ucData1);
-                            }
-                            else
-                                rc = VERR_NO_MEMORY;
+                            memcpy(pvDataTmp, pcData, cbData);
+                            pvDataTmp[cbData++] = '\0';
+
+                            rc = VbglR3DnDGHSendData(&m_dndCtx, strFormat.c_str(), pvDataTmp, cbData);
+                            RTMemFree(pvDataTmp);
                         }
                         else
-                            /* Just send the data to the host. */
-                            rc = VbglR3DnDGHSendData(ucData, cbData);
+                            rc = VERR_NO_MEMORY;
+                    }
+                    else
+                    {
+                        /* Send the raw data to the host. */
+                        rc = VbglR3DnDGHSendData(&m_dndCtx, strFormat.c_str(), pcData, cbData);
+                    }
 
-                        DO(("send responce\n"));
-                        /* Confirm the result of the transfer to the source window. */
+                    LogFlowThisFunc(("Sent strFormat=%s, rc=%Rrc\n", strFormat.c_str(), rc));
+
+                    if (RT_SUCCESS(rc))
+                    {
+                        /* Confirm the result of the transfer to the target window. */
                         XClientMessageEvent m;
                         RT_ZERO(m);
                         m.type         = ClientMessage;
                         m.display      = m_pDisplay;
-                        m.window       = srcWin;
+                        m.window       = wndSource;
                         m.message_type = xAtom(XA_XdndFinished);
                         m.format       = 32;
-                        m.data.l[0]    = m_proxyWin;
-                        m.data.l[1]    = RT_SUCCESS(rc) ?                   1 : 0;    /* Confirm or deny success */
-                        m.data.l[2]    = RT_SUCCESS(rc) ? toX11Action(action) : None; /* Action used on success */
-
-                        int xrc = XSendEvent(m_pDisplay, srcWin, True, NoEventMask, reinterpret_cast<XEvent*>(&m));
-                        if (RT_UNLIKELY(xrc == 0))
-                            DO(("DnD_DRO: error sending xevent\n"));
+                        m.data.l[0]    = m_wndProxy;                   /* Target window. */
+                        m.data.l[1]    = 0;                            /* Don't accept the drop to not make the guest stuck. */
+                        m.data.l[2]    = RT_SUCCESS(rc) 
+                                       ? toAtomAction(uAction) : None; /* Action used on success */
+
+                        xRc = XSendEvent(m_pDisplay, wndSource, True, NoEventMask, reinterpret_cast<XEvent*>(&m));
+                        if (RT_UNLIKELY(xRc == 0))
+                            LogFlowThisFunc(("Error sending XA_XdndFinished event to proxy window=%#x: %s\n", 
+                                             m_wndProxy, gX11->xErrorToString(xRc).c_str()));
                     }
                     else
+                        fCancel = true;
+                }
+                else
+                {
+                    if (aPropType == xAtom(XA_INCR))
                     {
-                        if (type == xAtom(XA_INCR))
-                        {
-                            /* Todo: */
-                            AssertMsgFailed(("Incrementally transfers are not supported, yet\n"));
-                            rc = VERR_NOT_IMPLEMENTED;
-                        }
-                        else
-                        {
-                            AssertMsgFailed(("Not supported data type\n"));
-                            rc = VERR_INVALID_PARAMETER;
-                        }
-                        /* Cancel this. */
-                        XClientMessageEvent m;
-                        RT_ZERO(m);
-                        m.type         = ClientMessage;
-                        m.display      = m_pDisplay;
-                        m.window       = srcWin;
-                        m.message_type = xAtom(XA_XdndFinished);
-                        m.format       = 32;
-                        m.data.l[0]    = m_proxyWin;
-                        m.data.l[1]    = 0;
-                        m.data.l[2]    = None;
-                        int xrc = XSendEvent(m_pDisplay, srcWin, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
-                        if (RT_UNLIKELY(xrc == 0))
-                            DO(("DnD_DRO: error sending xevent\n"));
-                        m_curWin = 0;
+                        /** @todo Support incremental transfers. */
+                        AssertMsgFailed(("Incrementally transfers are not supported yet\n"));
+                        rc = VERR_NOT_IMPLEMENTED;
                     }
-                    /* Cleanup */
-                    if (ucData)
-                        XFree(ucData);
+                    else
+                    {
+                        LogFlowFunc(("Not supported data type: %s\n", gX11->xAtomToString(aPropType).c_str()));
+                        rc = VERR_NOT_SUPPORTED;
+                    }
+
+                    fCancel = true;
                 }
-                else
-                    rc = VERR_INVALID_PARAMETER;
+
+                if (fCancel)
+                {
+                    LogFlowFunc(("Cancelling drop ...\n"));
+
+                    /* Cancel the operation -- inform the source window. */
+                    XClientMessageEvent m;
+                    RT_ZERO(m);
+                    m.type         = ClientMessage;
+                    m.display      = m_pDisplay;
+                    m.window       = m_wndProxy;
+                    m.message_type = xAtom(XA_XdndLeave);
+                    m.format       = 32;
+                    m.data.l[0]    = wndSource;         /* Source window. */
+
+                    xRc = XSendEvent(m_pDisplay, wndSource, False, NoEventMask, reinterpret_cast<XEvent*>(&m));
+                    if (RT_UNLIKELY(xRc == 0))
+                    {
+                        logError("Error sending XA_XdndLeave event to proxy window=%#x: %s\n",
+                                  m_wndProxy, gX11->xErrorToString(xRc).c_str());
+                    }
+                }
+
+                /* Cleanup. */
+                if (pcData)
+                    XFree(pcData);
             }
             else
-                rc = VERR_TIMEOUT;
+                rc = VERR_INVALID_PARAMETER;
         }
         else
-            rc = VERR_WRONG_ORDER;
+            rc = VERR_TIMEOUT;
     }
     else
         rc = VERR_TIMEOUT;
 
-    /* Inform the host on error */
+    /* Inform the host on error. */
     if (RT_FAILURE(rc))
-        VbglR3DnDGHErrorEvent(rc);
+    {
+        int rc2 = VbglR3DnDGHSendError(&m_dndCtx, rc);
+        AssertRC(rc2);
+    }
 
     /* At this point, we have either successfully transfered any data or not.
-     * So reset our internal state, cause we are done. */
+     * So reset our internal state because we are done here for this transaction. */
     reset();
 
+    LogFlowFuncLeaveRC(rc);
     return rc;
 }
-
 #endif /* VBOX_WITH_DRAG_AND_DROP_GH */
 
 /*
  * Helpers
  */
 
-int DragInstance::moveCursor(uint32_t u32xPos, uint32_t u32yPos)
+int DragInstance::mouseCursorMove(int iPosX, int iPosY) const
 {
+    int iScreenID = XDefaultScreen(m_pDisplay);
+    /** @todo What about multiple screens? Test this! */
+
+    const int iScrX = DisplayWidth(m_pDisplay, iScreenID);
+    const int iScrY = XDisplayHeight(m_pDisplay, iScreenID);
+
+    iPosX = RT_CLAMP(iPosX, 0, iScrX);
+    iPosY = RT_CLAMP(iPosY, 0, iScrY);
+
+    LogFlowThisFunc(("iPosX=%d, iPosY=%d\n", iPosX, iPosY));
+
     /* Move the guest pointer to the DnD position, so we can find the window
      * below that position. */
-    XWarpPointer(m_pDisplay, None, m_rootWin, 0, 0, 0, 0, u32xPos, u32yPos);
+    XWarpPointer(m_pDisplay, None, m_wndRoot, 0, 0, 0, 0, iPosX, iPosY);
     return VINF_SUCCESS;
 }
 
-void DragInstance::sendButtonEvent(Window w, int rx, int ry, int button, bool fPress) const
+void DragInstance::mouseButtonSet(Window wndDest, int rx, int ry, int iButton, bool fPress)
 {
-//    XTestFakeMotionEvent(m_pDisplay, -1, rx, ry, CurrentTime);
-//    XTestFakeMotionEvent(m_pDisplay, -1, rx + 1, ry + 1, CurrentTime);
-//    int rc = XTestFakeButtonEvent(m_pDisplay, 1, False, CurrentTime);
-//    if (rc != 0)
+    LogFlowThisFunc(("wndDest=%#x, rx=%d, ry=%d, iBtn=%d, fPress=%RTbool\n",
+                     wndDest, rx, ry, iButton, fPress));
+
+#ifdef VBOX_DND_WITH_XTEST
+    /** @todo Make this check run only once. */
+    int ev, er, ma, mi;
+    if (XTestQueryExtension(m_pDisplay, &ev, &er, &ma, &mi))
+    {
+        LogFlowThisFunc(("XText extension available\n"));
+
+        int xRc = XTestFakeButtonEvent(m_pDisplay, 1, fPress ? True : False, CurrentTime);
+        if (RT_UNLIKELY(xRc == 0))
+            logError("Error sending XTestFakeButtonEvent event: %s\n", gX11->xErrorToString(xRc).c_str());
+        XFlush(m_pDisplay);
+    }
+    else
     {
-        XButtonEvent be;
-        RT_ZERO(be);
-        be.display      = m_pDisplay;
-        be.root         = m_rootWin;
-        be.window       = w;
-        be.subwindow    = None;
-        be.same_screen  = True;
-        be.time         = CurrentTime;
-        be.button       = button;
-        be.state       |= button == 1 ? Button1MotionMask :
-                          button == 2 ? Button2MotionMask :
-                          button == 3 ? Button3MotionMask :
-                          button == 4 ? Button4MotionMask :
-                          button == 5 ? Button5MotionMask : 0;
-        be.type         = fPress ? ButtonPress : ButtonRelease;
-        be.x_root       = rx;
-        be.y_root       = ry;
-        XTranslateCoordinates(m_pDisplay, be.root, be.window, be.x_root, be.y_root, &be.x, &be.y, &be.subwindow);
-        int xrc = XSendEvent(m_pDisplay, be.window, True, ButtonPressMask, reinterpret_cast<XEvent*>(&be));
-        if (RT_UNLIKELY(xrc == 0))
-            DO(("DnD_BTN: error sending xevent\n"));
+#endif
+        LogFlowThisFunc(("XText extension not available or disabled\n"));
+
+        XButtonEvent eBtn;
+        RT_ZERO(eBtn);
+
+        eBtn.display      = m_pDisplay;
+        eBtn.root         = m_wndRoot;
+        eBtn.window       = wndDest;
+        eBtn.subwindow    = None;
+        eBtn.same_screen  = True;
+        eBtn.time         = CurrentTime;
+        eBtn.button       = iButton;
+        eBtn.state       |= iButton == 1 ? Button1Mask /*:
+                            iButton == 2 ? Button2MotionMask :
+                            iButton == 3 ? Button3MotionMask :
+                            iButton == 4 ? Button4MotionMask :
+                            iButton == 5 ? Button5MotionMask*/ : 0;
+        eBtn.type         = fPress ? ButtonPress : ButtonRelease;
+        eBtn.send_event   = False;
+        eBtn.x_root       = rx;
+        eBtn.y_root       = ry;
+
+        //XTranslateCoordinates(m_pDisplay, eBtn.root, eBtn.window, eBtn.x_root, eBtn.y_root, &eBtn.x, &eBtn.y, &eBtn.subwindow);
+#if 0
+        int xRc = XSendEvent(m_pDisplay, eBtn.window, True /* fPropagate */,
+                               fPress
+                             ? ButtonPressMask : ButtonReleaseMask,
+                             reinterpret_cast<XEvent*>(&eBtn));
+#else
+        int xRc = XSendEvent(m_pDisplay, eBtn.window, False /* fPropagate */,
+                             0 /* Mask */, reinterpret_cast<XEvent*>(&eBtn));
+        if (RT_UNLIKELY(xRc == 0))
+            logError("Error sending XButtonEvent event to window=%#x: %s\n", wndDest, gX11->xErrorToString(xRc).c_str());
+#endif
+
+#ifdef DEBUG
+        Window wndTemp, wndChild;
+        int wx, wy; unsigned int mask;
+        XQueryPointer(m_pDisplay, m_wndRoot, &wndTemp, &wndChild, &rx, &ry, &wx, &wy, &mask);
+        LogFlowThisFunc(("cursorRootX=%d, cursorRootY=%d\n", rx, ry));
+#endif
+
+#ifdef VBOX_DND_WITH_XTEST
     }
+#endif
+}
+
+int DragInstance::proxyWinShow(int *piRootX /*= NULL*/,
+                               int *piRootY /*= NULL*/,
+                               bool fMouseMove /*= false */) const
+{
+    /* piRootX is optional. */
+    /* piRootY is optional. */
+
+    LogFlowThisFuncEnter();
+
+    int rc = VINF_SUCCESS;
+
+#if 0 
+    XTestGrabControl(m_pDisplay, False);
+#endif
+
+    /* Get the mouse pointer position and determine if we're on the same screen as the root window
+     * and return the current child window beneath our mouse pointer, if any. */
+    int iRootX, iRootY;
+    int iChildX, iChildY;
+    unsigned int iMask;
+    Window wndRoot, wndChild;
+    Bool fInRootWnd = XQueryPointer(m_pDisplay, m_wndRoot, &wndRoot, &wndChild,
+                                    &iRootX, &iRootY,
+                                    &iChildX, &iChildY, &iMask);
+
+    LogFlowThisFunc(("fInRootWnd=%RTbool, wndRoot=0x%x, wndChild=0x%x, iRootX=%d, iRootY=%d\n",
+                     RT_BOOL(fInRootWnd), wndRoot, wndChild, iRootX, iRootY));
+
+    if (piRootX)
+        *piRootX = iRootX;
+    if (piRootY)
+        *piRootY = iRootY;
+
+    XSynchronize(m_pDisplay, True /* Enable sync */);
+
+    /* Bring our proxy window into foreground. */
+    XMapWindow(m_pDisplay, m_wndProxy);
+    XRaiseWindow(m_pDisplay, m_wndProxy);
+
+    /* Spawn our proxy window over the entire screen, making it an easy drop target for the host's cursor. */
+    int iScreenID = XDefaultScreen(m_pDisplay);
+    XMoveResizeWindow(m_pDisplay, m_wndProxy, 0, 0, XDisplayWidth(m_pDisplay, iScreenID), XDisplayHeight(m_pDisplay, iScreenID));
+    /** @todo What about multiple screens? Test this! */
+
+    if (fMouseMove)
+        rc = mouseCursorMove(iRootX, iRootY);
+
+    XSynchronize(m_pDisplay, False /* Disable sync */);
+
+#if 0 
+    XTestGrabControl(m_pDisplay, True);
+#endif
 
+    return rc;
+}
+
+int DragInstance::proxyWinHide(void)
+{
+    LogFlowFuncEnter();
+
+#ifndef VBOX_DND_DEBUG_WND
+    XUnmapWindow(m_pDisplay, m_wndProxy);
+#endif
+    m_eventQueue.clear();
+
+    return VINF_SUCCESS; /** @todo Add error checking. */
 }
 
-void DragInstance::showProxyWin(int &rx, int &ry) const
+void DragInstance::wndXDnDClearActionList(Window wndThis) const
 {
-    int cx, cy;
-    unsigned int m;
-    Window r, c;
-//    XTestGrabControl(m_pDisplay, False);
-    XQueryPointer(m_pDisplay, m_rootWin, &r, &c, &rx, &ry, &cx, &cy, &m);
-    XSynchronize(m_pDisplay, True);
-    XMapWindow(m_pDisplay, m_proxyWin);
-    XRaiseWindow(m_pDisplay, m_proxyWin);
-    XMoveResizeWindow(m_pDisplay, m_proxyWin, rx, ry, 1, 1);
-    XWarpPointer(m_pDisplay, None, m_rootWin, 0, 0, 0, 0, rx , ry);
-    XSynchronize(m_pDisplay, False);
-//    XTestGrabControl(m_pDisplay, True);
+    XDeleteProperty(m_pDisplay, wndThis, xAtom(XA_XdndActionList));
 }
 
-void DragInstance::hideProxyWin() const
+void DragInstance::wndXDnDClearTypeList(Window wndThis) const
 {
-    XUnmapWindow(m_pDisplay, m_proxyWin);
+    XDeleteProperty(m_pDisplay, wndThis, xAtom(XA_XdndTypeList));
 }
 
-/* Currently, not used */
-void DragInstance::registerForEvents(Window w) const
+int DragInstance::wndXDnDGetActionList(Window wndThis, VBoxDnDAtomList &lstActions) const
 {
-//    if (w == m_proxyWin)
-//        return;
-
-    DO(("%x\n", w));
-//    XSelectInput(m_pDisplay, w, Button1MotionMask | Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask);//| SubstructureNotifyMask);
-//    XSelectInput(m_pDisplay, w, ButtonMotionMask); //PointerMotionMask);
-    XSelectInput(m_pDisplay, w, PointerMotionMask); //PointerMotionMask);
-    Window hRealRoot, hParent;
-    Window *phChildrenRaw = NULL;
-    unsigned cChildren;
-    if (XQueryTree(m_pDisplay, w, &hRealRoot, &hParent, &phChildrenRaw, &cChildren))
+    Atom iActType = None;
+    int iActFmt;
+    unsigned long cItems, cbData;
+    unsigned char *pcbData = NULL;
+
+    /* Fetch the possible list of actions, if this property is set. */
+    int xRc = XGetWindowProperty(m_pDisplay, wndThis,
+                                 xAtom(XA_XdndActionList),
+                                 0, VBOX_MAX_XPROPERTIES,
+                                 False, XA_ATOM, &iActType, &iActFmt, &cItems, &cbData, &pcbData);
+    if (xRc != Success)
     {
-        for (unsigned i = 0; i < cChildren; ++i)
-            registerForEvents(phChildrenRaw[i]);
-        XFree(phChildrenRaw);
+        LogFlowThisFunc(("Error getting XA_XdndActionList atoms from window=%#x: %s\n", 
+                         wndThis, gX11->xErrorToString(xRc).c_str()));
+        return VERR_NOT_FOUND;
+    }
+
+    if (   cItems > 0 
+        && pcbData)
+    {
+        Atom *paData = reinterpret_cast<Atom *>(pcbData);
+
+        for (unsigned i = 0; i < RT_MIN(VBOX_MAX_XPROPERTIES, cItems); i++)
+        {
+            LogFlowThisFunc(("Received action: %s\n",
+                             gX11->xAtomToString(paData[i]).c_str()));
+
+            lstActions.append(paData[i]);
+        }
+
+        XFree(pcbData);
     }
+
+    return VINF_SUCCESS;
 }
 
-void DragInstance::setActionsWindowProperty(Window win, const RTCList<Atom> &actionList) const
+int DragInstance::wndXDnDGetTypeList(Window wndThis, VBoxDnDAtomList &lstTypes) const
 {
-    if (actionList.isEmpty())
-        return;
+    Atom iActType = None;
+    int iActFmt;
+    unsigned long cItems, cbData;
+    unsigned char *pcbData = NULL;
+
+    int xRc = XGetWindowProperty(m_pDisplay, wndThis,
+                             xAtom(XA_XdndTypeList),
+                             0, VBOX_MAX_XPROPERTIES,
+                             False, XA_ATOM, &iActType, &iActFmt, &cItems, &cbData, &pcbData);
+    if (xRc != Success)
+    {
+        LogFlowThisFunc(("Error getting XA_XdndTypeList atoms from window=%#x: %s\n", 
+                         wndThis, gX11->xErrorToString(xRc).c_str()));
+        return VERR_NOT_FOUND;
+    }
+
+    if (   cItems > 0 
+        && pcbData)
+    {
+        Atom *paData = reinterpret_cast<Atom*>(pcbData);
 
-    XChangeProperty(m_pDisplay, win, xAtom(XA_XdndActionList), XA_ATOM, 32, PropModeReplace,
-                    reinterpret_cast<const unsigned char*>(actionList.raw()), actionList.size());
+        for (unsigned i = 0; i < RT_MIN(VBOX_MAX_XPROPERTIES, cItems); i++)
+        {
+            LogFlowThisFunc(("Received format via XdndTypeList: %s\n",
+                             gX11->xAtomToString(paData[i]).c_str()));
+
+            lstTypes.append(paData[i]);
+        }
+
+        XFree(pcbData);
+    }
+
+    return VINF_SUCCESS;
 }
 
-void DragInstance::clearActionsWindowProperty(Window win) const
+int DragInstance::wndXDnDSetActionList(Window wndThis, const VBoxDnDAtomList &lstActions) const
 {
-    XDeleteProperty(m_pDisplay, win, xAtom(XA_XdndActionList));
+    if (lstActions.isEmpty())
+        return VINF_SUCCESS;
+
+    XChangeProperty(m_pDisplay, wndThis,
+                    xAtom(XA_XdndActionList),
+                    XA_ATOM, 32, PropModeReplace,
+                    reinterpret_cast<const unsigned char*>(lstActions.raw()),
+                    lstActions.size());
+
+    return VINF_SUCCESS;
 }
 
-void DragInstance::setFormatsWindowProperty(Window win, Atom property) const
+int DragInstance::wndXDnDSetFormatList(Window wndThis, Atom property, const VBoxDnDAtomList &lstFormats) const
 {
-    if (m_formats.isEmpty())
-        return;
+    if (lstFormats.isEmpty())
+        return VINF_SUCCESS;
 
     /* We support TARGETS and the data types. */
-    RTCList<Atom> targets(m_formats.size() + 1);
-    targets.append(xAtom(XA_TARGETS));
-    targets.append(m_formats);
+    VBoxDnDAtomList lstFormatsExt(lstFormats.size() + 1);
+    lstFormatsExt.append(xAtom(XA_TARGETS));
+    lstFormatsExt.append(lstFormats);
 
     /* Add the property with the property data to the window. */
-    XChangeProperty(m_pDisplay, win, property, XA_ATOM, 32, PropModeReplace,
-                    reinterpret_cast<const unsigned char*>(targets.raw()), targets.size());
-}
+    XChangeProperty(m_pDisplay, wndThis, property,
+                    XA_ATOM, 32, PropModeReplace,
+                    reinterpret_cast<const unsigned char*>(lstFormatsExt.raw()),
+                    lstFormatsExt.size());
 
-void DragInstance::clearFormatsWindowProperty(Window win) const
-{
-    XDeleteProperty(m_pDisplay, win, xAtom(XA_XdndTypeList));
+    return VINF_SUCCESS;
 }
 
-RTCList<Atom> DragInstance::toAtomList(const RTCList<RTCString> &formatList) const
-{
-    RTCList<Atom> atomList;
-    for (size_t i = 0; i < formatList.size(); ++i)
-        atomList.append(XInternAtom(m_pDisplay, formatList.at(i).c_str(), False));
+int DragInstance::toAtomList(const RTCList<RTCString> &lstFormats, VBoxDnDAtomList &lstAtoms) const
+{    
+    for (size_t i = 0; i < lstFormats.size(); ++i)
+        lstAtoms.append(XInternAtom(m_pDisplay, lstFormats.at(i).c_str(), False));
 
-    return atomList;
+    return VINF_SUCCESS;
 }
 
-RTCList<Atom> DragInstance::toAtomList(void *pvData, uint32_t cData) const
+int DragInstance::toAtomList(const void *pvData, uint32_t cbData, VBoxDnDAtomList &lstAtoms) const
 {
-    if (   !pvData
-        || !cData)
-        return RTCList<Atom>();
-    char *pszStr = (char*)pvData;
-    uint32_t cStr = cData;
+    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
+    AssertReturn(cbData, VERR_INVALID_PARAMETER);
 
-    RTCList<Atom> atomList;
-    while (cStr > 0)
+    const char *pszStr = (char *)pvData;
+    uint32_t cbStr = cbData;
+
+    int rc = VINF_SUCCESS;
+
+    RTCList<Atom> lstAtom;
+    while (cbStr)
     {
-        size_t cSize = RTStrNLen(pszStr, cStr);
+        size_t cbSize = RTStrNLen(pszStr, cbStr);
+
         /* Create a copy with max N chars, so that we are on the save side,
          * even if the data isn't zero terminated. */
-        char *pszTmp = RTStrDupN(pszStr, cSize);
-        DO(("f: %s\n", pszTmp));
-        atomList.append(XInternAtom(m_pDisplay, pszTmp, False));
+        char *pszTmp = RTStrDupN(pszStr, cbSize);
+        if (!pszTmp)
+        {
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        lstAtom.append(XInternAtom(m_pDisplay, pszTmp, False));
         RTStrFree(pszTmp);
-        pszStr += cSize + 1;
-        cStr   -= cSize + 1;
+
+        pszStr  += cbSize + 1;
+        cbStr   -= cbSize + 1;
     }
 
-    return atomList;
+    return rc;
 }
 
 /* static */
-Atom DragInstance::toX11Action(uint32_t uAction)
+Atom DragInstance::toAtomAction(uint32_t uAction)
 {
-    /* Ignore is None */
+    /* Ignore is None. */
     return (isDnDCopyAction(uAction) ? xAtom(XA_XdndActionCopy) :
             isDnDMoveAction(uAction) ? xAtom(XA_XdndActionMove) :
             isDnDLinkAction(uAction) ? xAtom(XA_XdndActionLink) :
@@ -1426,29 +2087,30 @@ Atom DragInstance::toX11Action(uint32_t uAction)
 }
 
 /* static */
-RTCList<Atom> DragInstance::toX11Actions(uint32_t uActions)
+int DragInstance::toAtomActions(uint32_t uActions, VBoxDnDAtomList &lstAtoms)
 {
-    RTCList<Atom> actionList;
     if (hasDnDCopyAction(uActions))
-        actionList.append(xAtom(XA_XdndActionCopy));
+        lstAtoms.append(xAtom(XA_XdndActionCopy));
     if (hasDnDMoveAction(uActions))
-        actionList.append(xAtom(XA_XdndActionMove));
+        lstAtoms.append(xAtom(XA_XdndActionMove));
     if (hasDnDLinkAction(uActions))
-        actionList.append(xAtom(XA_XdndActionLink));
+        lstAtoms.append(xAtom(XA_XdndActionLink));
 
-    return actionList;
+    return VINF_SUCCESS;
 }
 
 /* static */
 uint32_t DragInstance::toHGCMAction(Atom atom)
 {
     uint32_t uAction = DND_IGNORE_ACTION;
+
     if (atom == xAtom(XA_XdndActionCopy))
         uAction = DND_COPY_ACTION;
     else if (atom == xAtom(XA_XdndActionMove))
         uAction = DND_MOVE_ACTION;
     else if (atom == xAtom(XA_XdndActionLink))
         uAction = DND_LINK_ACTION;
+
     return uAction;
 }
 
@@ -1456,245 +2118,267 @@ uint32_t DragInstance::toHGCMAction(Atom atom)
 uint32_t DragInstance::toHGCMActions(const RTCList<Atom> &actionsList)
 {
     uint32_t uActions = DND_IGNORE_ACTION;
+
     for (size_t i = 0; i < actionsList.size(); ++i)
         uActions |= toHGCMAction(actionsList.at(i));
+
     return uActions;
 }
 
-/*******************************************************************************
- *
- * DragAndDropService Implementation
- *
- ******************************************************************************/
-
-RTCList<RTCString> toStringList(void *pvData, uint32_t cData)
+/** @todo Replace by DnDURIList?  */
+RTCList<RTCString> toStringList(const void *pvData, uint32_t cbData)
 {
     if (   !pvData
-        || !cData)
+        || !cbData)
         return RTCList<RTCString>();
-    char *pszStr = (char*)pvData;
-    uint32_t cStr = cData;
 
-    RTCList<RTCString> strList;
-    while (cStr > 0)
+    const char *pszStr = (char*)pvData;
+    uint32_t cbStr = cbData;
+
+    RTCList<RTCString> lstString;
+    while (cbStr > 0)
     {
-        size_t cSize = RTStrNLen(pszStr, cStr);
+        size_t cbSize = RTStrNLen(pszStr, cbStr);
+
         /* Create a copy with max N chars, so that we are on the save side,
          * even if the data isn't zero terminated. */
-        char *pszTmp = RTStrDupN(pszStr, cSize);
-        strList.append(pszTmp);
+        char *pszTmp = RTStrDupN(pszStr, cbSize);
+        lstString.append(pszTmp);
         RTStrFree(pszTmp);
-        pszStr += cSize + 1;
-        cStr   -= cSize + 1;
-    }
-
-    return strList;
-}
-
-#ifdef VBOX_WITH_DRAG_AND_DROP_GH
-
-bool DragAndDropService::waitForXMsg(XEvent &ecm, int type, uint32_t uiMaxMS /* = 100 */)
-{
-    const uint64_t uiStart = RTTimeProgramMilliTS();
-    do
-    {
-        if (!m_eventQueue.isEmpty())
-        {
-            DO(("new msg size %d\n", m_eventQueue.size()));
-            /* Check if there is a client message in the queue. */
-            for (size_t i = 0; i < m_eventQueue.size(); ++i)
-            {
-                DnDEvent e = m_eventQueue.at(i);
-                if(   e.type     == DnDEvent::X11_Type)
-                    DO(("new msg\n"));
-                if(   e.type     == DnDEvent::X11_Type
-                   && e.x11.type == type)
-                {
-                    m_eventQueue.removeAt(i);
-                    ecm = e.x11;
-                    return true;
-                }
-            }
-        }
-        int rc = RTSemEventWait(m_hEventSem, 25);
-//        if (RT_FAILURE(rc))
-//            return false;
+        pszStr  += cbSize + 1;
+        cbStr   -= cbSize + 1;
     }
-    while (RTTimeProgramMilliTS() - uiStart < uiMaxMS);
 
-    return false;
+    return lstString;
 }
 
-#endif
-
-void DragAndDropService::clearEventQueue()
+/** @todo Is this function really needed?  */
+void DragAndDropService::clearEventQueue(void)
 {
+    LogFlowThisFuncEnter();
     m_eventQueue.clear();
 }
 
+/*******************************************************************************
+ * DragAndDropService implementation.
+ ******************************************************************************/
+
 int DragAndDropService::run(bool fDaemonised /* = false */)
 {
-    int rc = VINF_SUCCESS;
-    LogRelFlowFunc(("\n"));
+    LogFlowThisFunc(("fDaemonised=%RTbool\n", fDaemonised));
 
+    int rc;
     do
     {
-        /* Initialise the guest library. */
-        rc = VbglR3InitUser();
-        if (RT_FAILURE(rc))
-            VBClFatalError(("Failed to connect to the VirtualBox kernel service, rc=%Rrc\n", rc));
-        /* Initialize our service */
-        rc = VbglR3DnDInit();
-        /* Not RT_FAILURE: VINF_PERMISSION_DENIED is host service not present. */
-        if (rc != VINF_SUCCESS)
-            break;
-
-        /* Initialize X11 DND */
+        /* Initialize X11 DnD. */
         rc = x11DragAndDropInit();
         if (RT_FAILURE(rc))
             break;
 
         m_pCurDnD = new DragInstance(m_pDisplay, this);
+        if (!m_pCurDnD)
+        {
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
         /* Note: For multiple screen support in VBox it is not necessary to use
          * another screen number than zero. Maybe in the future it will become
          * necessary if VBox supports multiple X11 screens. */
-        m_pCurDnD->init(0);
-        /* Loop over new events */
+        rc = m_pCurDnD->init(0);
+        if (RT_FAILURE(rc))
+            break;
+
+        LogRel(("DnD: Started\n"));
+
+        /* Enter the main event processing loop. */
         do
         {
             DnDEvent e;
             RT_ZERO(e);
-            if (m_eventQueue.isEmpty())
-                rc = RTSemEventWait(m_hEventSem, RT_INDEFINITE_WAIT);
-            if (!m_eventQueue.isEmpty())
+
+            LogFlowFunc(("Waiting for new event ...\n"));
+            rc = RTSemEventWait(m_hEventSem, RT_INDEFINITE_WAIT);
+            if (RT_FAILURE(rc))
+                break;
+
+            AssertMsg(m_eventQueue.size(),
+                      ("Event queue is empty when it shouldn't\n"));
+
+            e = m_eventQueue.first();
+            m_eventQueue.removeFirst();
+
+            if (e.type == DnDEvent::HGCM_Type)
             {
-                e = m_eventQueue.first();
-                m_eventQueue.removeFirst();
-                DO(("new msg %d\n", e.type));
-                if (e.type == DnDEvent::HGCM_Type)
+                LogFlowThisFunc(("HGCM event, type=%RU32\n", e.hgcm.uType));
+                switch (e.hgcm.uType)
                 {
-                    switch (e.hgcm.uType)
+                    case DragAndDropSvc::HOST_DND_HG_EVT_ENTER:
                     {
-                        case DragAndDropSvc::HOST_DND_HG_EVT_ENTER:
+                        if (e.hgcm.cbFormats)
                         {
-                            RTCList<RTCString> formats = RTCString(e.hgcm.pszFormats, e.hgcm.cbFormats - 1).split("\r\n");
-                            m_pCurDnD->hgEnter(formats, e.hgcm.u.a.uAllActions);
+                            RTCList<RTCString> lstFormats = RTCString(e.hgcm.pszFormats, e.hgcm.cbFormats - 1).split("\r\n");
+                            rc = m_pCurDnD->hgEnter(lstFormats, e.hgcm.u.a.uAllActions);
                             /* Enter is always followed by a move event. */
                         }
-                        case DragAndDropSvc::HOST_DND_HG_EVT_MOVE:
-                        {
-                            m_pCurDnD->hgMove(e.hgcm.u.a.uXpos, e.hgcm.u.a.uYpos, e.hgcm.u.a.uDefAction);
-                            break;
-                        }
-                        case DragAndDropSvc::HOST_DND_HG_EVT_LEAVE:
-                        {
-                            m_pCurDnD->reset();
-                            /* Not sure if this is really right! */
-                            clearEventQueue();
-                            break;
-                        }
-                        case DragAndDropSvc::HOST_DND_HG_EVT_DROPPED:
-                        {
-                            m_pCurDnD->hgDrop();
-                            break;
-                        }
-                        case DragAndDropSvc::HOST_DND_HG_SND_DATA:
-                        {
-                            m_pCurDnD->hgDataReceived(e.hgcm.u.b.pvData, e.hgcm.u.b.cbData);
-                            break;
-                        }
-#ifdef VBOX_WITH_DRAG_AND_DROP_GH
-                        case DragAndDropSvc::HOST_DND_GH_REQ_PENDING:
-                        {
-                            m_pCurDnD->ghIsDnDPending();
-                            break;
-                        }
-                        case DragAndDropSvc::HOST_DND_GH_EVT_DROPPED:
+                        else
                         {
-                            m_pCurDnD->ghDropped(e.hgcm.pszFormats, e.hgcm.u.a.uDefAction);
-                            /* Not sure if this is really right! */
-                            clearEventQueue();
+                            rc = VERR_INVALID_PARAMETER;
                             break;
                         }
-#endif
+                        /* Not breaking unconditionally is intentional. See comment above. */
                     }
-                    /* Some messages require cleanup. */
-                    switch (e.hgcm.uType)
+                    case DragAndDropSvc::HOST_DND_HG_EVT_MOVE:
                     {
-                        case DragAndDropSvc::HOST_DND_HG_EVT_ENTER:
-                        case DragAndDropSvc::HOST_DND_HG_EVT_MOVE:
-                        case DragAndDropSvc::HOST_DND_HG_EVT_DROPPED:
+                        rc = m_pCurDnD->hgMove(e.hgcm.u.a.uXpos, e.hgcm.u.a.uYpos, e.hgcm.u.a.uDefAction);
+                        break;
+                    }
+                    case DragAndDropSvc::HOST_DND_HG_EVT_LEAVE:
+                    {
+                        rc = m_pCurDnD->hgLeave();
+                        break;
+                    }
+                    case DragAndDropSvc::HOST_DND_HG_EVT_DROPPED:
+                    {
+                        rc = m_pCurDnD->hgDrop();
+                        break;
+                    }
+                    case DragAndDropSvc::HOST_DND_HG_SND_DATA:
+                    {
+                        rc = m_pCurDnD->hgDataReceived(e.hgcm.u.b.pvData, e.hgcm.u.b.cbData);
+                        break;
+                    }
 #ifdef VBOX_WITH_DRAG_AND_DROP_GH
-                        case DragAndDropSvc::HOST_DND_GH_EVT_DROPPED:
+                    case DragAndDropSvc::HOST_DND_GH_REQ_PENDING:
+                    {
+                        rc = m_pCurDnD->ghIsDnDPending();
+                        break;
+                    }
+                    case DragAndDropSvc::HOST_DND_GH_EVT_DROPPED:
+                    {
+                        rc = m_pCurDnD->ghDropped(e.hgcm.pszFormats, e.hgcm.u.a.uDefAction);
+                        break;
+                    }
 #endif
-                        {
-                            if (e.hgcm.pszFormats)
-                                RTMemFree(e.hgcm.pszFormats);
-                            break;
-                        }
-                        case DragAndDropSvc::HOST_DND_HG_SND_DATA:
-                        {
-                            if (e.hgcm.pszFormats)
-                                RTMemFree(e.hgcm.pszFormats);
-                            if (e.hgcm.u.b.pvData)
-                                RTMemFree(e.hgcm.u.b.pvData);
-                            break;
-                        }
+                    default:
+                    {
+                        LogFlowThisFunc(("Unsupported message: %RU32\n", e.hgcm.uType));
+                        rc = VERR_NOT_SUPPORTED;
+                        break;
                     }
+                }
+
+                LogFlowFunc(("Message %RU32 processed with %Rrc\n", e.hgcm.uType, rc));
+                if (   RT_FAILURE(rc)
+                    /* 
+                     * Note: The hgXXX and ghXXX functions of the DnD instance above may return 
+                     *       VERR_INVALID_STATE in case we're not in the expected state they want
+                     *       to operate in. As the user might drag content back and forth to/from
+                     *       the host/guest we don't want to reset the overall state here in case
+                     *       a VERR_INVALID_STATE occurs. Just continue in our initially set mode.
+                     */
+                    && rc != VERR_INVALID_STATE)
+                {
+                    m_pCurDnD->logError("Error: Processing message %RU32 failed with %Rrc\n", e.hgcm.uType, rc);
 
+                    /* If anything went wrong, do a reset and start over. */
+                    m_pCurDnD->reset();
                 }
-                else if(e.type == DnDEvent::X11_Type)
+
+                /* Some messages require cleanup. */
+                switch (e.hgcm.uType)
                 {
-                    DO(("X11 type: %u\n", e.x11.type));
-                    /* Now the X11 event stuff */
-                    switch (e.x11.type)
+                    case DragAndDropSvc::HOST_DND_HG_EVT_ENTER:
+                    case DragAndDropSvc::HOST_DND_HG_EVT_MOVE:
+                    case DragAndDropSvc::HOST_DND_HG_EVT_DROPPED:
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+                    case DragAndDropSvc::HOST_DND_GH_EVT_DROPPED:
+#endif
                     {
-                        case SelectionRequest: m_pCurDnD->hgX11SelectionRequest(e.x11); break;
-                        case ClientMessage:    m_pCurDnD->hgX11ClientMessage(e.x11); break;
-                        case SelectionClear:   DO(("DnD_CLER\n")); break;
-//                      case MotionNotify: m_pCurDnD->hide(); break;
+                        if (e.hgcm.pszFormats)
+                            RTMemFree(e.hgcm.pszFormats);
+                        break;
                     }
+
+                    case DragAndDropSvc::HOST_DND_HG_SND_DATA:
+                    {
+                        if (e.hgcm.pszFormats)
+                            RTMemFree(e.hgcm.pszFormats);
+                        if (e.hgcm.u.b.pvData)
+                            RTMemFree(e.hgcm.u.b.pvData);
+                        break;
+                    }
+
+                    default:
+                        break;
                 }
             }
+            else if (e.type == DnDEvent::X11_Type)
+            {
+                m_pCurDnD->onX11Event(e.x11);
+            }
+            else
+                AssertMsgFailed(("Unknown event queue type %d\n", e.type));
+
+            /*
+             * Make sure that any X11 requests have actually been sent to the
+             * server, since we are waiting for responses using poll() on
+             * another thread which will not automatically trigger flushing. 
+             */ 
             XFlush(m_pDisplay);
-        } while (1);
+
+        } while (!ASMAtomicReadBool(&m_fSrvStopping));
+
     } while (0);
 
-    LogRelFlowFunc(("returning %Rrc\n", rc));
+    LogRel(("DnD: Stopped with rc=%Rrc\n", rc));
     return rc;
 }
 
-int DragAndDropService::x11DragAndDropInit()
+int DragAndDropService::x11DragAndDropInit(void)
 {
+    /* Initialise the guest library. */
+    int rc = VbglR3InitUser();
+    if (RT_FAILURE(rc))
+        VBClFatalError(("Failed to connect to the VirtualBox kernel service, rc=%Rrc\n", rc));
+
     /* Connect to the x11 server. */
     m_pDisplay = XOpenDisplay(NULL);
     if (!m_pDisplay)
-        /* todo: correct errors */
+        /** @todo Correct errors. */
         return VERR_NOT_FOUND;
 
-    xHelpers::instance(m_pDisplay);
+    xHelpers *pHelpers = xHelpers::getInstance(m_pDisplay);
+    if (!pHelpers)
+        return VERR_NO_MEMORY;
 
-    int rc = VINF_SUCCESS;
     do
     {
-        /* Signal a new event to our main loop. */
         rc = RTSemEventCreate(&m_hEventSem);
         if (RT_FAILURE(rc))
             break;
+
+        rc = RTCritSectInit(&m_eventQueueCS);
+        if (RT_FAILURE(rc))
+            break;
+
         /* Event thread for events coming from the HGCM device. */
         rc = RTThreadCreate(&m_hHGCMThread, hgcmEventThread, this,
                             0, RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE,
-                            "HGCM-NOTIFY");
+                            "dndHGCM");
         if (RT_FAILURE(rc))
             break;
+
         /* Event thread for events coming from the x11 system. */
         rc = RTThreadCreate(&m_hX11Thread, x11EventThread, this,
                             0, RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE,
-                            "X11-NOTIFY");
+                            "dndX11");
     } while (0);
 
     /* No clean-up code for now, as we have no good way of testing it and things
      * should get cleaned up when the user process/X11 client exits. */
+    if (RT_FAILURE(rc))
+        LogRel(("DnD: Failed to start, rc=%Rrc\n", rc));
 
     return rc;
 }
@@ -1704,23 +2388,61 @@ int DragAndDropService::hgcmEventThread(RTTHREAD hThread, void *pvUser)
 {
     AssertPtrReturn(pvUser, VERR_INVALID_PARAMETER);
     DragAndDropService *pThis = static_cast<DragAndDropService*>(pvUser);
+    AssertPtr(pThis);
+
+    /* This thread has an own DnD context, e.g. an own client ID. */
+    VBGLR3GUESTDNDCMDCTX dndCtx;
+
+    int rc = VbglR3DnDConnect(&dndCtx);
+    if (RT_FAILURE(rc))
+        LogRel(("DnD: Unable to connect to drag and drop service, rc=%Rrc\n", rc));
+    /* Not RT_FAILURE: VINF_PERMISSION_DENIED is host service not present. */
+    if (rc != VINF_SUCCESS)
+        return rc;
+
+    /* Number of invalid messages skipped in a row. */
+    int cMsgSkippedInvalid = 0;
     DnDEvent e;
+
     do
     {
         RT_ZERO(e);
         e.type = DnDEvent::HGCM_Type;
-        /* Wait for new events */
-        int rc = VbglR3DnDProcessNextMessage(&e.hgcm);
-        if (RT_SUCCESS(rc))
+
+        /* Wait for new events. */
+        rc = VbglR3DnDProcessNextMessage(&dndCtx, &e.hgcm);
+        if (   RT_SUCCESS(rc)
+            || rc == VERR_CANCELLED)
         {
+            cMsgSkippedInvalid = 0; /* Reset skipped messages count. */
             pThis->m_eventQueue.append(e);
+
             rc = RTSemEventSignal(pThis->m_hEventSem);
             if (RT_FAILURE(rc))
-                return rc;
+                break;
+        }
+        else
+        {
+            LogFlowFunc(("Processing next message failed with rc=%Rrc\n", rc));
+
+            /* Old(er) hosts either are broken regarding DnD support or otherwise
+             * don't support the stuff we do on the guest side, so make sure we
+             * don't process invalid messages forever. */
+            if (rc == VERR_INVALID_PARAMETER)
+                cMsgSkippedInvalid++;
+            if (cMsgSkippedInvalid > 32)
+            {
+                LogRel(("DnD: Too many invalid/skipped messages from host, exiting ...\n"));
+                break;
+            }
         }
-    } while (1);
 
-    return VINF_SUCCESS;
+    } while (!ASMAtomicReadBool(&pThis->m_fSrvStopping));
+
+    VbglR3DnDDisconnect(&dndCtx);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
 }
 
 /* static */
@@ -1728,46 +2450,75 @@ int DragAndDropService::x11EventThread(RTTHREAD hThread, void *pvUser)
 {
     AssertPtrReturn(pvUser, VERR_INVALID_PARAMETER);
     DragAndDropService *pThis = static_cast<DragAndDropService*>(pvUser);
+    AssertPtr(pThis);
+
+    int rc = VINF_SUCCESS;
+
     DnDEvent e;
     do
     {
-        /* Wait for new events. We can't use XIfEvent here, because this locks
+        /*
+         * Wait for new events. We can't use XIfEvent here, cause this locks
          * the window connection with a mutex and if no X11 events occurs this
-         * blocks any other calls we made to X11. So instead poll for new events
-         * on the connection file descriptor. */
-        /** @todo Make sure the locking is right - Xlib displays should never be
-         * used from two threads at once. */
+         * blocks any other calls we made to X11. So instead check for new
+         * events and if there are not any new one, sleep for a certain amount
+         * of time.
+         */
         if (XEventsQueued(pThis->m_pDisplay, QueuedAfterFlush) > 0)
         {
             RT_ZERO(e);
             e.type = DnDEvent::X11_Type;
+
+            /* XNextEvent will block until a new X event becomes available. */
             XNextEvent(pThis->m_pDisplay, &e.x11);
             {
-                /* Appending makes a copy of the event structure. */
-                pThis->m_eventQueue.append(e);
-                int rc = RTSemEventSignal(pThis->m_hEventSem);
-                if (RT_FAILURE(rc))
-                    return rc;
+#ifdef DEBUG
+                switch (e.x11.type)
+                {
+                    case ClientMessage:
+                    {
+                        XClientMessageEvent *pEvent = reinterpret_cast<XClientMessageEvent*>(&e);
+                        AssertPtr(pEvent);
+
+                        RTCString strType = xAtomToString(pEvent->message_type);
+                        LogFlowFunc(("ClientMessage: %s (%RU32), serial=%RU32, wnd=%#x\n", strType.c_str(),
+                                     pEvent->message_type, pEvent->serial, pEvent->window));
+
+                        if (pEvent->message_type == xAtom(XA_XdndPosition))
+                        {
+                            int32_t dwPos = pEvent->data.l[2];
+                            int32_t dwAction = pEvent->data.l[4];
+
+                            LogFlowFunc(("XA_XdndPosition x=%RI32, y=%RI32, dwAction=%RI32\n",
+                                         RT_HIWORD(dwPos), RT_LOWORD(dwPos), dwAction));
+                        }
+                        else if (pEvent->message_type == xAtom(XA_XdndDrop))
+                        {
+                            LogFlowFunc(("XA_XdndDrop\n"));
+                        }
+
+                        break;
+                    }
+
+                    default:
+                        LogFlowFunc(("Received X event type=%d\n", e.x11.type));
+                        break;
+                }
+#endif
+                /* At the moment we only have one drag instance. */
+                DragInstance *pInstance = pThis->m_pCurDnD;
+                AssertPtr(pInstance);
+
+                pInstance->onX11Event(e.x11);
             }
         }
         else
-        {
-            struct pollfd pollFD;
+            RTThreadSleep(25 /* ms */);
 
-            pollFD.fd = ConnectionNumber(pThis->m_pDisplay);
-            pollFD.events = POLLIN | POLLPRI;
-            if (   (poll(&pollFD, 1, -1) < 0 && errno != EINTR)
-                || pollFD.revents & POLLNVAL)
-            {
-                LogRel(("X11 event thread: poll failed, stopping.\n"));
-                /** @todo Just stop the whole service.  What use is it just
-                 *        to stop one thread? */
-                return RTErrConvertFromErrno(errno);
-            }
-        }
-    } while (1);
+    } while (!ASMAtomicReadBool(&pThis->m_fSrvStopping));
 
-    return VINF_SUCCESS;
+    LogFlowFuncLeaveRC(rc);
+    return rc;
 }
 
 /** Drag and drop magic number, start of a UUID. */
@@ -1781,7 +2532,7 @@ struct DRAGANDDROPSERVICE
     /** The service interface. */
     struct VBCLSERVICE *pInterface;
     /** Magic number for sanity checks. */
-    uint32_t magic;
+    uint32_t uMagic;
     /** Service object. */
     DragAndDropService mDragAndDrop;
 };
@@ -1795,7 +2546,7 @@ static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised)
 {
     struct DRAGANDDROPSERVICE *pSelf = (struct DRAGANDDROPSERVICE *)ppInterface;
 
-    if (pSelf->magic != DRAGANDDROPSERVICE_MAGIC)
+    if (pSelf->uMagic != DRAGANDDROPSERVICE_MAGIC)
         VBClFatalError(("Bad display service object!\n"));
     return pSelf->mDragAndDrop.run(fDaemonised);
 }
@@ -1816,7 +2567,7 @@ struct VBCLSERVICE vbclDragAndDropInterface =
     cleanup
 };
 
-/* Static factory */
+/* Static factory. */
 struct VBCLSERVICE **VBClGetDragAndDropService(void)
 {
     struct DRAGANDDROPSERVICE *pService =
@@ -1825,7 +2576,8 @@ struct VBCLSERVICE **VBClGetDragAndDropService(void)
     if (!pService)
         VBClFatalError(("Out of memory\n"));
     pService->pInterface = &vbclDragAndDropInterface;
-    pService->magic = DRAGANDDROPSERVICE_MAGIC;
+    pService->uMagic = DRAGANDDROPSERVICE_MAGIC;
     new(&pService->mDragAndDrop) DragAndDropService();
     return &pService->pInterface;
 }
+
diff --git a/src/VBox/Additions/x11/VBoxClient/hostversion.cpp b/src/VBox/Additions/x11/VBoxClient/hostversion.cpp
index ebc111e..8b25a0a 100644
--- a/src/VBox/Additions/x11/VBoxClient/hostversion.cpp
+++ b/src/VBox/Additions/x11/VBoxClient/hostversion.cpp
@@ -1,3 +1,4 @@
+/* $Id: hostversion.cpp $ */
 /** @file
  * X11 guest client - host version check.
  */
@@ -43,7 +44,7 @@ static int showNotify(const char *pcHeader, const char *pcBody)
 # ifdef VBOX_WITH_DBUS
     DBusConnection *conn;
     DBusMessage* msg = NULL;
-    conn = dbus_bus_get (DBUS_BUS_SESSON, NULL);
+    conn = dbus_bus_get (DBUS_BUS_SESSION, NULL);
     if (conn == NULL)
     {
         LogRelFlowFunc(("Could not retrieve D-BUS session bus!\n"));
@@ -208,7 +209,7 @@ struct VBCLSERVICE vbclHostVersionInterface =
     run,
     VBClServiceDefaultHandler, /* pause */
     VBClServiceDefaultHandler, /* resume */
-    VBClServiceDefaultCleanup    
+    VBClServiceDefaultCleanup
 };
 
 struct HOSTVERSIONSERVICE
diff --git a/src/VBox/Additions/x11/VBoxClient/main.cpp b/src/VBox/Additions/x11/VBoxClient/main.cpp
index 2b071ac..554da55 100644
--- a/src/VBox/Additions/x11/VBoxClient/main.cpp
+++ b/src/VBox/Additions/x11/VBoxClient/main.cpp
@@ -1,3 +1,4 @@
+/* $Id: main.cpp $ */
 /** @file
  *
  * VirtualBox Guest Service:
@@ -5,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -28,6 +29,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xatom.h>
 
+#include <iprt/buildconfig.h>
 #include <iprt/critsect.h>
 #include <iprt/env.h>
 #include <iprt/file.h>
@@ -208,7 +210,7 @@ static int pfnMonitorThread(RTTHREAD self, void *pvUser)
 {
     Display *pDisplay;
     bool fHasVT = true;
-    
+
     pDisplay = XOpenDisplay(NULL);
     if (!pDisplay)
         VBClFatalError(("Failed to open the X11 display\n"));
@@ -248,18 +250,20 @@ void vboxClientUsage(const char *pcszFileName)
              "--checkhostversion|"
 #endif
              "--seamless [-d|--nodaemon]\n", pcszFileName);
-    RTPrintf("Start the VirtualBox X Window System guest services.\n\n");
+    RTPrintf("Starts the VirtualBox X Window System guest services.\n\n");
     RTPrintf("Options:\n");
-    RTPrintf("  --clipboard        start the shared clipboard service\n");
+    RTPrintf("  --clipboard        starts the shared clipboard service\n");
 #ifdef VBOX_WITH_DRAG_AND_DROP
-    RTPrintf("  --draganddrop      start the drag and drop service\n");
+    RTPrintf("  --draganddrop      starts the drag and drop service\n");
 #endif
-    RTPrintf("  --display          start the display management service\n");
+    RTPrintf("  --display          starts the display management service\n");
 #ifdef VBOX_WITH_GUEST_PROPS
-    RTPrintf("  --checkhostversion start the host version notifier service\n");
+    RTPrintf("  --checkhostversion starts the host version notifier service\n");
 #endif
-    RTPrintf("  --seamless         start the seamless windows service\n");
-    RTPrintf("  -d, --nodaemon     continue running as a system service\n");
+    RTPrintf("  --seamless         starts the seamless windows service\n");
+    RTPrintf("  -d, --nodaemon     continues running as a system service\n");
+    RTPrintf("  -h, --help         shows this help text\n");
+    RTPrintf("  -V, --version      shows version information\n");
     RTPrintf("\n");
     exit(0);
 }
@@ -346,6 +350,11 @@ int main(int argc, char *argv[])
             vboxClientUsage(pcszFileName);
             return 0;
         }
+        else if (!strcmp(argv[i], "-V") || !strcmp(argv[i], "--version"))
+        {
+            RTPrintf("%sr%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr());
+            return 0;
+        }
         else
         {
             RTPrintf("%s: unrecognized option `%s'\n", pcszFileName, argv[i]);
diff --git a/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp b/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp
index 8bf275c..e396fa3 100644
--- a/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp
+++ b/src/VBox/Additions/x11/VBoxClient/seamless-x11.cpp
@@ -1,3 +1,4 @@
+/* $Id: seamless-x11.cpp $ */
 /** @file
  * X11 Seamless mode.
  */
diff --git a/src/VBox/Additions/x11/VBoxClient/seamless-x11.h b/src/VBox/Additions/x11/VBoxClient/seamless-x11.h
index 46a5d41..98e7549 100644
--- a/src/VBox/Additions/x11/VBoxClient/seamless-x11.h
+++ b/src/VBox/Additions/x11/VBoxClient/seamless-x11.h
@@ -1,3 +1,4 @@
+/* $Id: seamless-x11.h $ */
 /** @file
  *
  * Seamless mode:
diff --git a/src/VBox/Additions/x11/VBoxClient/seamless.cpp b/src/VBox/Additions/x11/VBoxClient/seamless.cpp
index d349f1e..b55a560 100644
--- a/src/VBox/Additions/x11/VBoxClient/seamless.cpp
+++ b/src/VBox/Additions/x11/VBoxClient/seamless.cpp
@@ -1,3 +1,4 @@
+/* $Id: seamless.cpp $ */
 /** @file
  * X11 Guest client - seamless mode: main logic, communication with the host and
  * wrapper interface for the main code of the VBoxClient deamon.  The
@@ -417,7 +418,7 @@ struct VBCLSERVICE vbclSeamlessInterface =
     run,
     pause,
     resume,
-    cleanup    
+    cleanup
 };
 
 struct VBCLSERVICE **VBClGetSeamlessService()
diff --git a/src/VBox/Additions/x11/VBoxClient/seamless.h b/src/VBox/Additions/x11/VBoxClient/seamless.h
index 1a567eb..fe4e6b1 100644
--- a/src/VBox/Additions/x11/VBoxClient/seamless.h
+++ b/src/VBox/Additions/x11/VBoxClient/seamless.h
@@ -1,3 +1,4 @@
+/* $Id: seamless.h $ */
 /** @file
  * X11 Guest client - seamless mode, missing proper description while using the
  * potentially confusing word 'host'.
@@ -62,7 +63,7 @@ private:
      * @a nextStateChangeEvent call to return immediately.
      */
     int cancelEvent(void);
-    
+
     /** Thread function to monitor X11 window configuration changes. */
     static DECLCALLBACK(int) x11MonitorThread(RTTHREAD self, void *pvUser);
 
@@ -71,7 +72,7 @@ private:
 
     /** Helper to stop the X11 monitor thread again. */
     int stopX11MonitorThread(void);
-    
+
     /** Is the service currently actively monitoring X11 windows? */
     bool isX11MonitorThreadRunning()
     {
diff --git a/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp b/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp
index d877ffb..e53f8b3 100644
--- a/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp
+++ b/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp
@@ -1,3 +1,4 @@
+/* $Id: tstSeamlessX11-auto.cpp $ */
 /** @file
  * Automated test of the X11 seamless Additions code.
  * @todo Better separate test data from implementation details!
diff --git a/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp b/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp
index d9782dd..b9c995e 100644
--- a/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp
+++ b/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp
@@ -1,3 +1,4 @@
+/* $Id: tstSeamlessX11.cpp $ */
 /** @file
  * Linux seamless guest additions simulator in host.
  */
diff --git a/src/VBox/Additions/x11/undefined_xorg b/src/VBox/Additions/x11/undefined_xorg
index ea788cf..4949a71 100644
--- a/src/VBox/Additions/x11/undefined_xorg
+++ b/src/VBox/Additions/x11/undefined_xorg
@@ -125,8 +125,8 @@ strchr
 strcmp
 strcpy
 strlen
-__strncat_chk
 strncat
+__strncat_chk
 strncmp
 strncpy
 __strncpy_chk
diff --git a/src/VBox/Additions/x11/vboxmouse/vboxmouse.c b/src/VBox/Additions/x11/vboxmouse/vboxmouse.c
index 7b32aea..242234c 100644
--- a/src/VBox/Additions/x11/vboxmouse/vboxmouse.c
+++ b/src/VBox/Additions/x11/vboxmouse/vboxmouse.c
@@ -1,3 +1,4 @@
+/* $Id: vboxmouse.c $ */
 /** @file
  * VirtualBox X11 Guest Additions, mouse driver for X.Org server 1.5
  */
diff --git a/src/VBox/Additions/x11/vboxvideo/Makefile.kmk b/src/VBox/Additions/x11/vboxvideo/Makefile.kmk
index 2468aac..fcf60b2 100644
--- a/src/VBox/Additions/x11/vboxvideo/Makefile.kmk
+++ b/src/VBox/Additions/x11/vboxvideo/Makefile.kmk
@@ -113,6 +113,7 @@ vboxvideo_drv_SOURCES = \
 	$(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp \
 	$(PATH_ROOT)/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp \
 	$(PATH_ROOT)/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp \
+	$(PATH_ROOT)/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp \
 	$(PATH_ROOT)/src/VBox/Runtime/common/alloc/heapsimple.cpp \
 	$(PATH_ROOT)/src/VBox/Runtime/common/alloc/heapoffset.cpp
  # Any global symbols in the driver object files will be added to XFree86's
diff --git a/src/VBox/Additions/x11/vboxvideo/pointer.c b/src/VBox/Additions/x11/vboxvideo/pointer.c
index 06d10a2..59905f6 100644
--- a/src/VBox/Additions/x11/vboxvideo/pointer.c
+++ b/src/VBox/Additions/x11/vboxvideo/pointer.c
@@ -1,3 +1,4 @@
+/* $Id: pointer.c $ */
 /** @file
  * VirtualBox X11 Additions graphics driver utility functions
  */
diff --git a/src/VBox/Additions/x11/vboxvideo/undefined b/src/VBox/Additions/x11/vboxvideo/undefined
deleted file mode 100644
index 84a570e..0000000
--- a/src/VBox/Additions/x11/vboxvideo/undefined
+++ /dev/null
@@ -1,216 +0,0 @@
-ChangeWindowProperty
-CheckExtension
-DRI2CloseScreen
-DRI2ScreenInit
-DRICloseScreen
-DRICreateInfoRec
-DRICreatePCIBusID
-DRIDestroyInfoRec
-DRIFinishScreenInit
-DRILock
-DRIQueryVersion
-DRIScreenInit
-DRIUnlock
-ErrorF
-FatalError
-GlxSetVisualConfigs
-LoaderRefSymLists
-LookupWindow
-MakeAtom
-PixmapWidthPaddingInfo
-ProcVector
-RRChangeOutputProperty
-SecurityLookupWindow
-SwappedProcVector
-ShadowFBInit2
-VErrorF
-WindowTable
-XNFcalloc
-XNFstrdup
-Xalloc
-Xfree
-calloc
-chdir
-chmod
-chown
-close
-__ctype_mask
-drmClose
-drmDropMaster
-drmFreeVersion
-drmGetVersion
-drmIoctl
-drmSetMaster
-fbPictureInit
-fbScreenInit
-fchmod
-fchown
-fcntl
-fflush
-flock
-fprintf
-__fprintf_chk
-fputs
-free
-fstat
-fsync
-ftruncate
-ftruncate64
-futimes
-fwrite
-getcwd
-getenv
-geteuid
-getpwuid_r
-iconv
-iconv_close
-iconv_open
-ioctl
-isspace
-lchown
-lseek
-lseek64
-lstat
-malloc
-memalign
-memchr
-memcmp
-memcpy
-__memcpy_chk
-memmove
-memset
-miClearVisualTypes
-miCreateDefColormap
-miDCInitialize
-miInitializeBackingStore
-miSetPixmapDepths
-miSetVisualTypes
-mmap64
-mprotect
-munmap
-nanosleep
-nl_langinfo
-open
-open64
-pciTag
-pci_device_map_range
-pci_device_unmap_range
-posix_memalign
-pthread_self
-pthread_sigmask
-pthread_yield
-putenv
-read
-realloc
-realpath
-__realpath_chk
-rename
-resVgaShared
-screenInfo
-serverGeneration
-setenv
-sigdelset
-sigfillset
-snprintf
-__snprintf_chk
-sprintf
-__sprintf_chk
-sscanf
-stat
-stderr
-strchr
-strcmp
-strcpy
-strlen
-strncmp
-strncpy
-__strncpy_chk
-strpbrk
-strstr
-strtoul
-__strtoul_internal
-symlink
-tolower
-unlink
-unsetenv
-utimes
-vfprintf
-__vfprintf_chk
-vsnprintf
-__vsnprintf_chk
-vgaHWFreeHWRec
-vgaHWGetHWRec
-vgaHWGetIOBase
-vgaHWGetIndex
-vgaHWRestore
-vgaHWSave
-vgaHWSetStdFuncs
-write
-xf86AddDriver
-xf86ConfigPciEntity
-xf86CreateCursorInfoRec
-xf86CrtcConfigInit
-xf86CrtcConfigPrivateIndex
-xf86CrtcCreate
-xf86CrtcScreenInit
-xf86CrtcSetSizeRange
-xf86DPMSInit
-xf86DPMSSet
-xf86DestroyCursorInfoRec
-xf86DrvMsg
-xf86GetEntityInfo
-xf86GetPciInfoForEntity
-xf86GetPciVideoInfo
-xf86GetPointerScreenFuncs
-xf86HandleColormaps
-xf86InitCursor
-xf86InitialConfiguration
-xf86InterpretEDID
-xf86LoadSubModule
-xf86LoaderCheckSymbol
-xf86LoaderReqSymLists
-xf86MapPciMem
-xf86MatchDevice
-xf86MatchPciInstances
-xf86ModesAdd
-xf86Msg
-xf86OutputCreate
-xf86OutputSetEDID
-xf86OutputUseScreenMonitor
-xf86PrintChipsets
-xf86PrintDepthBpp
-xf86PrintModes
-xf86RegisterRootWindowProperty
-xf86SaveScreen
-xf86ScreenToScrn
-xf86Screens
-xf86ScrnToScreen
-xf86SetBackingStore
-xf86SetBlackWhitePixels
-xf86SetDefaultVisual
-xf86SetDepthBpp
-xf86SetDesiredModes
-xf86SetDpi
-xf86SetGamma
-xf86SetModeDefaultName
-xf86SetSingleMode
-xf86SetWeight
-xf86ShowUnusedOptions
-xf86UnMapVidMem
-xf86calloc
-xf86close
-xf86errno
-xf86free
-xf86ioctl
-xf86isspace
-xf86memchr
-xf86memcpy
-xf86memset
-xf86open
-xf86sprintf
-xf86sscanf
-xf86strcmp
-xf86strcpy
-xf86strlen
-xf86strtoul
-xf86vsnprintf
diff --git a/src/VBox/Additions/x11/vboxvideo/vboxvideo.c b/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
index 17f37e7..6ad038f 100644
--- a/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
+++ b/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
@@ -313,7 +313,11 @@ static void setModeRandR11(ScrnInfoPtr pScrn, DisplayModePtr pMode, bool fLimite
         pScrn->virtualY = pMode->VDisplay;
     }
     else
+    {
+        xf86ScrnToScreen(pScrn)->width = pMode->HDisplay;
+        xf86ScrnToScreen(pScrn)->height = pMode->VDisplay;
         adjustScreenPixmap(pScrn, pMode->HDisplay, pMode->VDisplay);
+    }
     if (pMode->HDisplay != 0 && pMode->VDisplay != 0)
         vbvxSetMode(pScrn, 0, pMode->HDisplay, pMode->VDisplay, 0, 0, true, true, &frameBuffer);
     pScrn->currentMode = pMode;
diff --git a/src/VBox/Additions/x11/vboxvideo/vboxvideo.h b/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
index ff40a78..9f265e4 100644
--- a/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
+++ b/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
@@ -1,3 +1,4 @@
+/* $Id: vboxvideo.h $ */
 /** @file
  *
  * VirtualBox X11 Additions graphics driver
@@ -95,7 +96,7 @@ if (!(expr)) \
 { \
     vbvxMsg("\nAssertion failed!\n\n"); \
     vbvxMsg("%s\n", #expr); \
-    vbvxMsg("at %s (%s:%d)\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); \
+    vbvxMsg("at %s (%s:%d)\n", RT_GCC_EXTENSION __PRETTY_FUNCTION__, __FILE__, __LINE__); \
     vbvxMsg out; \
     vbvxAbortServer(); \
 }
diff --git a/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c b/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c
index 1471a1b..33abb17 100644
--- a/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c
+++ b/src/VBox/Additions/x11/vboxvideo/vboxvideo_dri.c
@@ -181,7 +181,7 @@ Bool VBOXDRIScreenInit(ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox)
         || (pVBox->cbFBMax == 0))
     {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "%s: preconditions failed\n",
-                   __PRETTY_FUNCTION__);
+                   RT_GCC_EXTENSION __PRETTY_FUNCTION__);
         rc = FALSE;
     }
     /* Check that the GLX, DRI, and DRM modules have been loaded by testing for
diff --git a/src/VBox/Additions/x11/vboxvideo/vbva.c b/src/VBox/Additions/x11/vboxvideo/vbva.c
index 42c532e..5ed517f 100644
--- a/src/VBox/Additions/x11/vboxvideo/vbva.c
+++ b/src/VBox/Additions/x11/vboxvideo/vbva.c
@@ -1,3 +1,4 @@
+/* $Id: vbva.c $ */
 /** @file
  * VirtualBox X11 Additions graphics driver 2D acceleration functions
  */
@@ -88,6 +89,25 @@ void vbvxHandleDirtyRect(ScrnInfoPtr pScrn, int iRects, BoxPtr aRects)
     }
 }
 
+static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb)
+{
+    NOREF(pvEnv);
+    return calloc(1, cb);
+}
+
+static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv)
+{
+    NOREF(pvEnv);
+    free(pv);
+}
+
+static HGSMIENV g_hgsmiEnv =
+{
+    NULL,
+    hgsmiEnvAlloc,
+    hgsmiEnvFree
+};
+
 /**
  * Calculate the location in video RAM of and initialise the heap for guest to
  * host messages.  In the VirtualBox 4.3 and earlier Guest Additions this
@@ -103,7 +123,7 @@ void vbvxSetUpHGSMIHeapInGuest(VBOXPtr pVBox, uint32_t cbVRAM)
     VBoxHGSMIGetBaseMappingInfo(cbVRAM, &offVRAMBaseMapping, NULL, &offGuestHeapMemory, &cbGuestHeapMemory, NULL);
     pvGuestHeapMemory = ((uint8_t *)pVBox->base) + offVRAMBaseMapping + offGuestHeapMemory;
     rc = VBoxHGSMISetupGuestContext(&pVBox->guestCtx, pvGuestHeapMemory, cbGuestHeapMemory,
-                                    offVRAMBaseMapping + offGuestHeapMemory);
+                                    offVRAMBaseMapping + offGuestHeapMemory, &g_hgsmiEnv);
     VBVXASSERT(RT_SUCCESS(rc), ("Failed to set up the guest-to-host message buffer heap, rc=%d\n", rc));
     pVBox->cbView = offVRAMBaseMapping;
 }
diff --git a/src/VBox/Debugger/DBGCCmdHlp.cpp b/src/VBox/Debugger/DBGCCmdHlp.cpp
index fbe94f9..8e924ab 100644
--- a/src/VBox/Debugger/DBGCCmdHlp.cpp
+++ b/src/VBox/Debugger/DBGCCmdHlp.cpp
@@ -77,7 +77,7 @@ static size_t dbgcStringOutputInQuotes(PFNRTSTROUTPUT pfnOutput, void *pvArgOutp
         size_t cchSub = pchQuote - psz + 1;
         cchOutput += pfnOutput(pvArgOutput, psz, cchSub);
         cchOutput += pfnOutput(pvArgOutput, &chQuote, 1);
-        cchSub -= cchSub;
+        cch    -= cchSub;
         psz    += cchSub;
     }
 
diff --git a/src/VBox/Debugger/DBGCCommands.cpp b/src/VBox/Debugger/DBGCCommands.cpp
index 6992c54..545237a 100644
--- a/src/VBox/Debugger/DBGCCommands.cpp
+++ b/src/VBox/Debugger/DBGCCommands.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -51,6 +51,7 @@ static FNDBGCCMD dbgcCmdHelp;
 static FNDBGCCMD dbgcCmdQuit;
 static FNDBGCCMD dbgcCmdStop;
 static FNDBGCCMD dbgcCmdDetect;
+static FNDBGCCMD dbgcCmdDmesg;
 static FNDBGCCMD dbgcCmdCpu;
 static FNDBGCCMD dbgcCmdInfo;
 static FNDBGCCMD dbgcCmdLog;
@@ -68,7 +69,6 @@ static FNDBGCCMD dbgcCmdLoadVars;
 static FNDBGCCMD dbgcCmdShowVars;
 static FNDBGCCMD dbgcCmdLoadPlugIn;
 static FNDBGCCMD dbgcCmdUnloadPlugIn;
-static FNDBGCCMD dbgcCmdShowPlugIns;
 static FNDBGCCMD dbgcCmdHarakiri;
 static FNDBGCCMD dbgcCmdEcho;
 static FNDBGCCMD dbgcCmdRunScript;
@@ -108,6 +108,14 @@ static const DBGCVARDESC    g_aArgCpu[] =
 };
 
 
+/** 'dmesg' arguments. */
+static const DBGCVARDESC    g_aArgDmesg[] =
+{
+    /* cTimesMin,   cTimesMax,  enmCategory,            fFlags,                         pszName,        pszDescription */
+    {  0,           1,     DBGCVAR_CAT_NUMBER_NO_RANGE, 0,                              "messages",     "Limit the output to the last N messages. (optional)" },
+};
+
+
 /** 'help' arguments. */
 static const DBGCVARDESC    g_aArgHelp[] =
 {
@@ -231,6 +239,7 @@ const DBGCCMD    g_aDbgcCmds[] =
     { "exit",       0,        0,        NULL,                0,                            0, dbgcCmdQuit,      "",                     "Exits the debugger." },
     { "format",     1,        1,        &g_aArgAny[0],       RT_ELEMENTS(g_aArgAny),       0, dbgcCmdFormat,    "",                     "Evaluates an expression and formats it." },
     { "detect",     0,        0,        NULL,                0,                            0, dbgcCmdDetect,    "",                     "Detects or re-detects the guest os and starts the OS specific digger." },
+    { "dmesg",      0,        1,        &g_aArgDmesg[0],     RT_ELEMENTS(g_aArgDmesg),     0, dbgcCmdDmesg,     "[N last messages]",    "Displays the guest os kernel messages, if available." },
     { "harakiri",   0,        0,        NULL,                0,                            0, dbgcCmdHarakiri,  "",                     "Kills debugger process." },
     { "help",       0,        ~0U,      &g_aArgHelp[0],      RT_ELEMENTS(g_aArgHelp),      0, dbgcCmdHelp,      "[cmd/op [..]]",        "Display help. For help about info items try 'info help'." },
     { "info",       1,        2,        &g_aArgInfo[0],      RT_ELEMENTS(g_aArgInfo),      0, dbgcCmdInfo,      "<info> [args]",        "Display info register in the DBGF. For a list of info items try 'info help'." },
@@ -256,7 +265,6 @@ const DBGCCMD    g_aDbgcCmds[] =
     { "runscript",  1,        1,        &g_aArgFilename[0],  RT_ELEMENTS(g_aArgFilename),  0, dbgcCmdRunScript, "<filename>",           "Runs the command listed in the script. Lines starting with '#' "
                                                                                                                                         "(after removing blanks) are comment. blank lines are ignored. Stops on failure." },
     { "set",        2,        2,        &g_aArgSet[0],       RT_ELEMENTS(g_aArgSet),       0, dbgcCmdSet,       "<var> <value>",        "Sets a global variable." },
-    { "showplugins",0,        0,        NULL,                0,                            0, dbgcCmdShowPlugIns,"",                     "List loaded plugins." },
     { "showvars",   0,        0,        NULL,                0,                            0, dbgcCmdShowVars,  "",                     "List all the defined variables." },
     { "stop",       0,        0,        NULL,                0,                            0, dbgcCmdStop,      "",                     "Stop execution." },
     { "unload",     1,       ~0U,       &g_aArgUnload[0],    RT_ELEMENTS(g_aArgUnload),    0, dbgcCmdUnload,    "<modname1> [modname2..N]", "Unloads one or more modules in the current address space." },
@@ -1002,6 +1010,66 @@ static DECLCALLBACK(int) dbgcCmdDetect(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM
 
 
 /**
+ * @interface_method_impl{FNDBCCMD, The 'dmesg' command.}
+ */
+static DECLCALLBACK(int) dbgcCmdDmesg(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
+{
+    /* check that the parser did what it's supposed to do. */
+    if (cArgs > 1)
+        return DBGCCmdHlpPrintf(pCmdHlp, "parser error\n");
+    uint32_t cMessages = UINT32_MAX;
+    if (cArgs == 1)
+    {
+        if (paArgs[0].enmType != DBGCVAR_TYPE_NUMBER)
+            return DBGCCmdHlpPrintf(pCmdHlp, "parser error\n");
+        cMessages = paArgs[0].u.u64Number <= UINT32_MAX ? (uint32_t)paArgs[0].u.u64Number : UINT32_MAX;
+    }
+
+    /*
+     * Query the interface.
+     */
+    int rc;
+    PDBGFOSIDMESG pDmesg = (PDBGFOSIDMESG)DBGFR3OSQueryInterface(pUVM, DBGFOSINTERFACE_DMESG);
+    if (pDmesg)
+    {
+        size_t  cbActual;
+        size_t  cbBuf  = _512K;
+        char   *pszBuf = (char *)RTMemAlloc(cbBuf);
+        if (pszBuf)
+        {
+            rc = pDmesg->pfnQueryKernelLog(pDmesg, pUVM, 0 /*fFlags*/, cMessages, pszBuf, cbBuf, &cbActual);
+
+            uint32_t cTries = 10;
+            while (rc == VERR_BUFFER_OVERFLOW && cbBuf < 16*_1M && cTries-- > 0)
+            {
+                RTMemFree(pszBuf);
+                cbBuf = RT_ALIGN_Z(cbActual + _4K, _4K);
+                pszBuf = (char *)RTMemAlloc(cbBuf);
+                if (RT_UNLIKELY(!pszBuf))
+                {
+                    rc = DBGCCmdHlpFail(pCmdHlp, pCmd, "Error allocating %#zu bytes.\n", cbBuf);
+                    break;
+                }
+                rc = pDmesg->pfnQueryKernelLog(pDmesg, pUVM, 0 /*fFlags*/, cMessages, pszBuf, cbBuf, &cbActual);
+            }
+            if (RT_SUCCESS(rc))
+                rc = DBGCCmdHlpPrintf(pCmdHlp, "%s\n", pszBuf);
+            else if (rc == VERR_BUFFER_OVERFLOW && pszBuf)
+                rc = DBGCCmdHlpPrintf(pCmdHlp, "%s\nWarning: incomplete\n", pszBuf);
+            else
+                rc = DBGCCmdHlpFail(pCmdHlp, pCmd, "pfnQueryKernelLog failed: %Rrc\n", rc);
+            RTMemFree(pszBuf);
+        }
+        else
+            rc = DBGCCmdHlpFail(pCmdHlp, pCmd, "Error allocating %#zu bytes.\n", cbBuf);
+    }
+    else
+        rc = DBGCCmdHlpFail(pCmdHlp, pCmd, "The dmesg interface isn't implemented by guest OS.\n");
+    return rc;
+}
+
+
+/**
  * @interface_method_impl{FNDBCCMD, The 'cpu' command.}
  */
 static DECLCALLBACK(int) dbgcCmdCpu(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
@@ -1023,7 +1091,7 @@ static DECLCALLBACK(int) dbgcCmdCpu(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pU
         VMCPUID cCpus = DBGFR3CpuGetCount(pUVM);
         if (paArgs[0].u.u64Number >= cCpus)
             rc = DBGCCmdHlpPrintf(pCmdHlp, "error: idCpu %u is out of range! Highest ID is %u.\n",
-                                    paArgs[0].u.u64Number, cCpus);
+                                    paArgs[0].u.u64Number, cCpus-1);
         else
         {
             rc = DBGCCmdHlpPrintf(pCmdHlp, "Changed CPU from %u to %u.\n",
@@ -1496,7 +1564,7 @@ static DECLCALLBACK(int) dbgcCmdSet(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pU
                                 paArgs[0].u.pszString);
 
     while (RT_C_IS_ALNUM(*pszVar) || *pszVar == '_')
-        *pszVar++;
+        pszVar++;
     if (*pszVar)
         return DBGCCmdHlpPrintf(pCmdHlp,
                                 "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*]'!",
@@ -1677,303 +1745,6 @@ static DECLCALLBACK(int) dbgcCmdShowVars(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PU
 
 
 /**
- * Extracts the plugin name from a plugin specifier that may or may not include
- * path and/or suffix.
- *
- * @returns VBox status code.
- *
- * @param   pszDst      Where to return the name. At least DBGCPLUGIN_MAX_NAME
- *                      worth of buffer space.
- * @param   pszPlugIn   The plugin specifier to parse.
- */
-static int dbgcPlugInExtractName(char *pszDst, const char *pszPlugIn)
-{
-    /*
-     * Parse out the name stopping at the extension.
-     */
-    const char *pszName = RTPathFilename(pszPlugIn);
-    if (!pszName || !*pszName)
-        return VERR_INVALID_NAME;
-    if (!RTStrNICmp(pszName, DBGC_PLUG_IN_PREFIX, sizeof(DBGC_PLUG_IN_PREFIX) - 1))
-    {
-        pszName += sizeof(DBGC_PLUG_IN_PREFIX) - 1;
-        if (!*pszName)
-            return VERR_INVALID_NAME;
-    }
-
-    int         ch;
-    size_t      cchName = 0;
-    while (   (ch = pszName[cchName]) != '\0'
-           && ch != '.')
-    {
-        if (    !RT_C_IS_ALPHA(ch)
-            &&  (   !RT_C_IS_DIGIT(ch)
-                 || cchName == 0))
-            return VERR_INVALID_NAME;
-        cchName++;
-    }
-
-    if (cchName >= DBGCPLUGIN_MAX_NAME)
-        return VERR_OUT_OF_RANGE;
-
-    /*
-     * We're very picky about the extension if there is no path.
-     */
-    if (    ch == '.'
-        &&  !RTPathHavePath(pszPlugIn)
-        &&  RTStrICmp(&pszName[cchName], RTLdrGetSuff()))
-        return VERR_INVALID_NAME;
-
-    /*
-     * Copy it.
-     */
-    memcpy(pszDst, pszName, cchName);
-    pszDst[cchName] = '\0';
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Locate a plug-in in list.
- *
- * @returns Pointer to the plug-in tracking structure.
- * @param   pDbgc               Pointer to the DBGC instance data.
- * @param   pszName             The name of the plug-in we're looking for.
- * @param   ppPrev              Where to optionally return the pointer to the
- *                              previous list member.
- */
-static PDBGCPLUGIN dbgcPlugInLocate(PDBGC pDbgc, const char *pszName, PDBGCPLUGIN *ppPrev)
-{
-    PDBGCPLUGIN pPrev = NULL;
-    PDBGCPLUGIN pCur  = pDbgc->pPlugInHead;
-    while (pCur)
-    {
-        if (!RTStrICmp(pCur->szName, pszName))
-        {
-            if (ppPrev)
-                *ppPrev = pPrev;
-            return pCur;
-        }
-
-        /* advance */
-        pPrev = pCur;
-        pCur  = pCur->pNext;
-    }
-    return NULL;
-}
-
-
-/**
- * Try load the specified plug-in module.
- *
- * @returns VINF_SUCCESS on success, path error or loader error on failure.
- *
- * @param   pPlugIn     The plugin tracing record.
- * @param   pszModule   Module name.
- */
-static int dbgcPlugInTryLoad(PDBGCPLUGIN pPlugIn, const char *pszModule)
-{
-    /*
-     * Load it and try resolve the entry point.
-     */
-    int rc = RTLdrLoad(pszModule, &pPlugIn->hLdrMod);
-    if (RT_SUCCESS(rc))
-    {
-        rc = RTLdrGetSymbol(pPlugIn->hLdrMod, DBGC_PLUG_IN_ENTRYPOINT, (void **)&pPlugIn->pfnEntry);
-        if (RT_SUCCESS(rc))
-            return VINF_SUCCESS;
-        LogRel(("DBGC: RTLdrGetSymbol('%s', '%s',) -> %Rrc\n", pszModule, DBGC_PLUG_IN_ENTRYPOINT, rc));
-
-        RTLdrClose(pPlugIn->hLdrMod);
-        pPlugIn->hLdrMod = NIL_RTLDRMOD;
-    }
-    return rc;
-}
-
-
-/**
- * RTPathTraverseList callback.
- *
- * @returns See FNRTPATHTRAVERSER.
- *
- * @param   pchPath     See FNRTPATHTRAVERSER.
- * @param   cchPath     See FNRTPATHTRAVERSER.
- * @param   pvUser1     The plug-in specifier.
- * @param   pvUser2     The plug-in tracking record.
- */
-static DECLCALLBACK(int) dbgcPlugInLoadCallback(const char *pchPath, size_t cchPath, void *pvUser1, void *pvUser2)
-{
-    PDBGCPLUGIN pPlugIn   = (PDBGCPLUGIN)pvUser2;
-    const char *pszPlugIn = (const char *)pvUser1;
-
-    /*
-     * Join the path and the specified plug-in module name, first with the
-     * prefix and then without it.
-     */
-    size_t      cchModule = cchPath + 1 + strlen(pszPlugIn) + sizeof(DBGC_PLUG_IN_PREFIX) + 8;
-    char       *pszModule = (char *)alloca(cchModule);
-    AssertReturn(pszModule, VERR_TRY_AGAIN);
-    memcpy(pszModule, pchPath, cchPath);
-    pszModule[cchPath] = '\0';
-
-    int rc = RTPathAppend(pszModule, cchModule, DBGC_PLUG_IN_PREFIX);
-    AssertRCReturn(rc, VERR_TRY_AGAIN);
-    strcat(pszModule, pszPlugIn);
-    rc = dbgcPlugInTryLoad(pPlugIn, pszModule);
-    if (RT_SUCCESS(rc))
-        return VINF_SUCCESS;
-
-    pszModule[cchPath] = '\0';
-    rc = RTPathAppend(pszModule, cchModule, pszPlugIn);
-    AssertRCReturn(rc, VERR_TRY_AGAIN);
-    rc = dbgcPlugInTryLoad(pPlugIn, pszModule);
-    if (RT_SUCCESS(rc))
-        return VINF_SUCCESS;
-
-    return VERR_TRY_AGAIN;
-}
-
-
-/**
- * Loads a plug-in.
- *
- * @returns VBox status code. If pCmd is specified, it's the return from
- *          DBGCCmdHlpFail.
- * @param   pDbgc               The DBGC instance data.
- * @param   pszName             The plug-in name.
- * @param   pszPlugIn           The plug-in module name.
- * @param   pCmd                The command pointer if invoked by the user, NULL
- *                              if invoked from elsewhere.
- */
-static int dbgcPlugInLoad(PDBGC pDbgc, const char *pszName, const char *pszPlugIn, PCDBGCCMD pCmd)
-{
-    PDBGCCMDHLP pCmdHlp = &pDbgc->CmdHlp;
-
-    /*
-     * Try load it.  If specified with a path, we're assuming the user
-     * wants to load a plug-in from some specific location.  Otherwise
-     * search for it.
-     */
-    PDBGCPLUGIN pPlugIn = (PDBGCPLUGIN)RTMemAllocZ(sizeof(*pPlugIn));
-    if (!pPlugIn)
-        return pCmd
-             ? DBGCCmdHlpFail(pCmdHlp, pCmd, "out of memory\n")
-             : VERR_NO_MEMORY;
-    strcpy(pPlugIn->szName, pszName);
-
-    int rc;
-    if (RTPathHavePath(pszPlugIn))
-        rc = dbgcPlugInTryLoad(pPlugIn, pszPlugIn);
-    else
-    {
-        /* 1. The private architecture directory. */
-        char szPath[4*_1K];
-        rc = RTPathAppPrivateArch(szPath, sizeof(szPath));
-        if (RT_SUCCESS(rc))
-            rc = RTPathTraverseList(szPath, '\0', dbgcPlugInLoadCallback, (void *)pszPlugIn, pPlugIn);
-        if (RT_FAILURE(rc))
-        {
-            /* 2. The DBGC PLUGIN_PATH variable. */
-            DBGCVAR PathVar;
-            int rc2 = DBGCCmdHlpEval(pCmdHlp, &PathVar, "$PLUGIN_PATH");
-            if (    RT_SUCCESS(rc2)
-                &&  PathVar.enmType == DBGCVAR_TYPE_STRING)
-                rc = RTPathTraverseList(PathVar.u.pszString, ';', dbgcPlugInLoadCallback, (void *)pszPlugIn, pPlugIn);
-            if (RT_FAILURE_NP(rc))
-            {
-                /* 3. The DBGC_PLUGIN_PATH environment variable. */
-                rc2 = RTEnvGetEx(RTENV_DEFAULT, "DBGC_PLUGIN_PATH", szPath, sizeof(szPath), NULL);
-                if (RT_SUCCESS(rc2))
-                    rc = RTPathTraverseList(szPath, ';', dbgcPlugInLoadCallback, (void *)pszPlugIn, pPlugIn);
-            }
-        }
-    }
-    if (RT_FAILURE(rc))
-    {
-        RTMemFree(pPlugIn);
-        return pCmd
-            ? DBGCCmdHlpFail(pCmdHlp, pCmd, "could not find/load '%s'\n", pszPlugIn)
-            : rc;
-    }
-
-    /*
-     * Try initialize it.
-     */
-    rc = pPlugIn->pfnEntry(DBGCPLUGINOP_INIT, pDbgc->pUVM, VBOX_VERSION);
-    if (RT_FAILURE(rc))
-    {
-        RTLdrClose(pPlugIn->hLdrMod);
-        RTMemFree(pPlugIn);
-        return pCmd
-            ? DBGCCmdHlpFail(pCmdHlp, pCmd, "initialization of plug-in '%s' failed with rc=%Rrc\n", pszPlugIn, rc)
-            : rc;
-    }
-
-    /*
-     * Link it and we're good.
-     */
-    pPlugIn->pNext = pDbgc->pPlugInHead;
-    pDbgc->pPlugInHead = pPlugIn;
-    DBGCCmdHlpPrintf(pCmdHlp, "Loaded plug-in '%s'.\n", pPlugIn->szName);
-    return VINF_SUCCESS;
-}
-
-
-
-
-/**
- * Automatically load plug-ins from the architecture private directory of
- * VirtualBox.
- *
- * This is called during console init.
- *
- * @param   pDbgc       The DBGC instance data.
- */
-void dbgcPlugInAutoLoad(PDBGC pDbgc)
-{
-    /*
-     * Open the architecture specific directory with a filter on our prefix
-     * and names including a dot.
-     */
-    const char *pszSuff = RTLdrGetSuff();
-    size_t      cchSuff = strlen(pszSuff);
-
-    char szPath[RTPATH_MAX];
-    int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - cchSuff);
-    AssertRCReturnVoid(rc);
-    size_t offDir = strlen(szPath);
-
-    rc = RTPathAppend(szPath, sizeof(szPath) - cchSuff, DBGC_PLUG_IN_PREFIX "*");
-    AssertRCReturnVoid(rc);
-    strcat(szPath, pszSuff);
-
-    PRTDIR pDir;
-    rc = RTDirOpenFiltered(&pDir, szPath, RTDIRFILTER_WINNT, 0);
-    if (RT_SUCCESS(rc))
-    {
-        /*
-         * Now read it and try load each of the plug-in modules.
-         */
-        RTDIRENTRY DirEntry;
-        while (RT_SUCCESS(RTDirRead(pDir, &DirEntry, NULL)))
-        {
-            szPath[offDir] = '\0';
-            rc = RTPathAppend(szPath, sizeof(szPath), DirEntry.szName);
-            if (RT_SUCCESS(rc))
-            {
-                char szName[DBGCPLUGIN_MAX_NAME];
-                rc = dbgcPlugInExtractName(szName, DirEntry.szName);
-                if (RT_SUCCESS(rc))
-                    dbgcPlugInLoad(pDbgc, szName, szPath, NULL /*pCmd*/);
-            }
-        }
-
-        RTDirClose(pDir);
-    }
-}
-
-
-/**
  * @interface_method_impl{FNDBCCMD, The 'loadplugin' command.}
  */
 static DECLCALLBACK(int) dbgcCmdLoadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
@@ -1985,23 +1756,20 @@ static DECLCALLBACK(int) dbgcCmdLoadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp,
      */
     for (unsigned i = 0; i < cArgs; i++)
     {
-        const char *pszPlugIn = paArgs[i].u.pszString;
-
-        /* Extract the plug-in name. */
-        char szName[DBGCPLUGIN_MAX_NAME];
-        int rc = dbgcPlugInExtractName(szName, pszPlugIn);
-        if (RT_FAILURE(rc))
-            return DBGCCmdHlpFail(pCmdHlp, pCmd, "Malformed plug-in name: '%s'\n", pszPlugIn);
-
-        /* Loaded? */
-        PDBGCPLUGIN pPlugIn = dbgcPlugInLocate(pDbgc, szName, NULL);
-        if (pPlugIn)
-            return DBGCCmdHlpFail(pCmdHlp, pCmd, "'%s' is already loaded\n", szName);
-
-        /* Load it. */
-        rc = dbgcPlugInLoad(pDbgc, szName, pszPlugIn, pCmd);
-        if (RT_FAILURE(rc))
-            return rc;
+        char            szPlugIn[128];
+        RTERRINFOSTATIC ErrInfo;
+        szPlugIn[0] = '\0';
+        int rc = DBGFR3PlugInLoad(pDbgc->pUVM, paArgs[i].u.pszString, szPlugIn, sizeof(szPlugIn), RTErrInfoInitStatic(&ErrInfo));
+        if (RT_SUCCESS(rc))
+            DBGCCmdHlpPrintf(pCmdHlp, "Loaded plug-in '%s' (%s)\n", szPlugIn, paArgs[i].u.pszString);
+        else if (rc == VERR_ALREADY_EXISTS)
+            DBGCCmdHlpPrintf(pCmdHlp, "A plug-in named '%s' is already loaded\n", szPlugIn);
+        else if (szPlugIn[0])
+            return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3PlugInLoad failed for '%s' ('%s'): %s",
+                                    szPlugIn, paArgs[i].u.pszString, ErrInfo.szMsg);
+        else
+            return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3PlugInLoad failed for '%s': %s",
+                                    paArgs[i].u.pszString, ErrInfo.szMsg);
     }
 
     return VINF_SUCCESS;
@@ -2009,31 +1777,6 @@ static DECLCALLBACK(int) dbgcCmdLoadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp,
 
 
 /**
- * Unload all plug-ins.
- *
- * @param   pDbgc       The DBGC instance data.
- */
-void dbgcPlugInUnloadAll(PDBGC pDbgc)
-{
-    while (pDbgc->pPlugInHead)
-    {
-        PDBGCPLUGIN pPlugIn = pDbgc->pPlugInHead;
-        pDbgc->pPlugInHead = pPlugIn->pNext;
-
-        if (    pDbgc->pVM /* prevents trouble during destruction. */
-            &&  pDbgc->pVM->enmVMState < VMSTATE_DESTROYING)
-        {
-            pPlugIn->pfnEntry(DBGCPLUGINOP_TERM, pDbgc->pUVM, 0);
-            RTLdrClose(pPlugIn->hLdrMod);
-        }
-        pPlugIn->hLdrMod = NIL_RTLDRMOD;
-
-        RTMemFree(pPlugIn);
-    }
-}
-
-
-/**
  * @interface_method_impl{FNDBCCMD, The 'unload' command.}
  */
 static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
@@ -2041,37 +1784,17 @@ static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp
     PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
 
     /*
-     * Loop thru the plugin names.
+     * Loop thru the given plug-in names.
      */
     for (unsigned i = 0; i < cArgs; i++)
     {
-        const char *pszPlugIn = paArgs[i].u.pszString;
-
-        /* Extract the plug-in name. */
-        char szName[DBGCPLUGIN_MAX_NAME];
-        int rc = dbgcPlugInExtractName(szName, pszPlugIn);
-        if (RT_FAILURE(rc))
-            return DBGCCmdHlpFail(pCmdHlp, pCmd, "Malformed plug-in name: '%s'\n", pszPlugIn);
-
-        /* Loaded? */
-        PDBGCPLUGIN pPrevPlugIn;
-        PDBGCPLUGIN pPlugIn = dbgcPlugInLocate(pDbgc, szName, &pPrevPlugIn);
-        if (!pPlugIn)
-            return DBGCCmdHlpFail(pCmdHlp, pCmd, "'%s' is not\n", szName);
-
-        /*
-         * Terminate and unload it.
-         */
-        pPlugIn->pfnEntry(DBGCPLUGINOP_TERM, pDbgc->pUVM, 0);
-        RTLdrClose(pPlugIn->hLdrMod);
-        pPlugIn->hLdrMod = NIL_RTLDRMOD;
-
-        if (pPrevPlugIn)
-            pPrevPlugIn->pNext = pPlugIn->pNext;
+        int rc = DBGFR3PlugInUnload(pDbgc->pUVM, paArgs[i].u.pszString);
+        if (RT_SUCCESS(rc))
+            DBGCCmdHlpPrintf(pCmdHlp, "Unloaded plug-in '%s'\n", paArgs[i].u.pszString);
+        else if (rc == VERR_NOT_FOUND)
+            return DBGCCmdHlpFail(pCmdHlp, pCmd, "'%s' was not found\n", paArgs[i].u.pszString);
         else
-            pDbgc->pPlugInHead = pPlugIn->pNext;
-        RTMemFree(pPlugIn->pNext);
-        DBGCCmdHlpPrintf(pCmdHlp, "Unloaded plug-in '%s'\n", szName);
+            return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3PlugInUnload failed for '%s'", paArgs[i].u.pszString);
     }
 
     return VINF_SUCCESS;
@@ -2079,29 +1802,6 @@ static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp
 
 
 /**
- * @interface_method_impl{FNDBCCMD, The 'showplugins' command.}
- */
-static DECLCALLBACK(int) dbgcCmdShowPlugIns(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
-{
-    PDBGC       pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
-    PDBGCPLUGIN pPlugIn = pDbgc->pPlugInHead;
-    if (!pPlugIn)
-        return DBGCCmdHlpPrintf(pCmdHlp, "No plug-ins loaded\n");
-
-    DBGCCmdHlpPrintf(pCmdHlp, "Plug-ins: %s", pPlugIn->szName);
-    for (;;)
-    {
-        pPlugIn = pPlugIn->pNext;
-        if (!pPlugIn)
-            break;
-        DBGCCmdHlpPrintf(pCmdHlp, ", %s", pPlugIn->szName);
-    }
-    return DBGCCmdHlpPrintf(pCmdHlp, "\n");
-}
-
-
-
-/**
  * @interface_method_impl{FNDBCCMD, The 'harakiri' command.}
  */
 static DECLCALLBACK(int) dbgcCmdHarakiri(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
diff --git a/src/VBox/Debugger/DBGCEmulateCodeView.cpp b/src/VBox/Debugger/DBGCEmulateCodeView.cpp
index d8c6e9a..6268c93 100644
--- a/src/VBox/Debugger/DBGCEmulateCodeView.cpp
+++ b/src/VBox/Debugger/DBGCEmulateCodeView.cpp
@@ -881,17 +881,17 @@ static void dbgcCmdUnassambleHelpListNear(PUVM pUVM, PDBGCCMDHLP pCmdHlp, RTDBGA
         if (!offDispSym)
         {
             DBGCCmdHlpPrintf(pCmdHlp, "%s:\n", Symbol.szName);
-            *pcbCallAgain = Symbol.cb;
+            *pcbCallAgain = !Symbol.cb ? 64 : Symbol.cb;
         }
         else if (offDispSym > 0)
         {
             DBGCCmdHlpPrintf(pCmdHlp, "%s+%#llx:\n", Symbol.szName, (uint64_t)offDispSym);
-            *pcbCallAgain = Symbol.cb > (RTGCUINTPTR)offDispSym ? Symbol.cb - (RTGCUINTPTR)offDispSym : 1;
+            *pcbCallAgain = !Symbol.cb ? 64 : Symbol.cb > (RTGCUINTPTR)offDispSym ? Symbol.cb - (RTGCUINTPTR)offDispSym : 1;
         }
         else
         {
             DBGCCmdHlpPrintf(pCmdHlp, "%s-%#llx:\n", Symbol.szName, (uint64_t)-offDispSym);
-            *pcbCallAgain = (RTGCUINTPTR)-offDispSym + Symbol.cb;
+            *pcbCallAgain = !Symbol.cb ? 64 : (RTGCUINTPTR)-offDispSym + Symbol.cb;
         }
     }
     else
@@ -1272,7 +1272,7 @@ static DECLCALLBACK(int) dbgcCmdListSource(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp,
 
                         rc = DBGCCmdHlpPrintf(pCmdHlp, "         %4d: %s\n", Line.uLineNo - cBefore - 1, szLine);
                         szLine[0] = '\0';
-                        fgets(szLine, sizeof(szLine), phFile);
+                        (void)fgets(szLine, sizeof(szLine), phFile);
                         cLines++;
                     }
                     /* print the actual line */
diff --git a/src/VBox/Debugger/DBGCInternal.h b/src/VBox/Debugger/DBGCInternal.h
index 46f7b71..2a2fa9c 100644
--- a/src/VBox/Debugger/DBGCInternal.h
+++ b/src/VBox/Debugger/DBGCInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -65,27 +65,6 @@ typedef struct DBGCNAMEDVAR
 typedef DBGCNAMEDVAR *PDBGCNAMEDVAR;
 
 
-/** The max length of a plug-in name, zero terminator included. */
-#define DBGCPLUGIN_MAX_NAME     32
-
-/**
- * Plug-in tracking record.
- */
-typedef struct DBGCPLUGIN
-{
-    /** Pointer to the next plug-in. */
-    struct DBGCPLUGIN  *pNext;
-    /** The loader handle.  */
-    RTLDRMOD            hLdrMod;
-    /** The plug-in entry point. */
-    PFNDBGCPLUGIN       pfnEntry;
-    /** The plug-in name (variable length).  */
-    char                szName[DBGCPLUGIN_MAX_NAME];
-} DBGCPLUGIN;
-/** Pointer to plug-in tracking record. */
-typedef DBGCPLUGIN *PDBGCPLUGIN;
-
-
 /**
  * Debugger console status
  */
@@ -158,9 +137,6 @@ typedef struct DBGC
      * and unset using command with those names. */
     PDBGCNAMEDVAR      *papVars;
 
-    /** The list of plug-in. (singly linked) */
-    PDBGCPLUGIN         pPlugInHead;
-
     /** The list of breakpoints. (singly linked) */
     PDBGCBP             pFirstBp;
 
@@ -397,9 +373,6 @@ DECLCALLBACK(int) dbgcOpAddrHostPhys(PDBGC pDbgc, PCDBGCVAR pArg, DBGCVARCAT enm
 
 void    dbgcInitCmdHlp(PDBGC pDbgc);
 
-void    dbgcPlugInAutoLoad(PDBGC pDbgc);
-void    dbgcPlugInUnloadAll(PDBGC pDbgc);
-
 /* For tstDBGCParser: */
 int     dbgcCreate(PDBGC *ppDbgc, PDBGCBACK pBack, unsigned fFlags);
 int     dbgcRun(PDBGC pDbgc);
diff --git a/src/VBox/Debugger/DBGCPlugInDiggers.rc b/src/VBox/Debugger/DBGCPlugInDiggers.rc
deleted file mode 100644
index dd78cfd..0000000
--- a/src/VBox/Debugger/DBGCPlugInDiggers.rc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id: DBGCPlugInDiggers.rc $ */
-/** @file
- * DBGCPlugInDiggers - Resource file containing version info.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      VFT2_UNKNOWN
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904b0" // Lang=US English, CharSet=Unicode
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox Debugger Plug-in\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     "DBGCPlugInDiggers\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", "DBGCPlugInDiggers.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1200
-  END
-END
diff --git a/src/VBox/Debugger/DBGConsole.cpp b/src/VBox/Debugger/DBGConsole.cpp
index 0784855..aa17721 100644
--- a/src/VBox/Debugger/DBGConsole.cpp
+++ b/src/VBox/Debugger/DBGConsole.cpp
@@ -967,9 +967,6 @@ void dbgcDestroy(PDBGC pDbgc)
 
     }
 
-    /* Unload all plug-ins. */
-    dbgcPlugInUnloadAll(pDbgc);
-
     /* Detach from the VM. */
     if (pDbgc->pUVM)
         DBGFR3Detach(pDbgc->pUVM);
@@ -1049,7 +1046,7 @@ DBGDECL(int) DBGCCreate(PUVM pUVM, PDBGCBACK pBack, unsigned fFlags)
     if (RT_SUCCESS(rc))
     {
         if (pVM)
-            dbgcPlugInAutoLoad(pDbgc);
+            DBGFR3PlugInLoadAll(pDbgc->pUVM);
         rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL, "VBoxDbg> ");
         if (RT_SUCCESS(rc))
         {
diff --git a/src/VBox/Debugger/DBGPlugInDarwin.cpp b/src/VBox/Debugger/DBGPlugInDarwin.cpp
index 0898b5c..f454568 100644
--- a/src/VBox/Debugger/DBGPlugInDarwin.cpp
+++ b/src/VBox/Debugger/DBGPlugInDarwin.cpp
@@ -37,6 +37,48 @@
 /** @name Internal Darwin structures
  * @{ */
 
+/**
+ * 32-bit darwin kernel module info structure (kmod_info_t).
+ */
+typedef struct OSX32_kmod_info
+{
+    uint32_t    next;
+    int32_t     info_version;
+    uint32_t    id;
+    char        name[64];
+    char        version[64];
+    int32_t     reference_count;
+    uint32_t    reference_list;         /**< Points to kmod_reference_t. */
+    uint32_t    address;                /**< Where in memory the kext is loaded. */
+    uint32_t    size;
+    uint32_t    hdr_size;
+    uint32_t    start;                  /**< Address of kmod_start_func_t. */
+    uint32_t    stop;                   /**< Address of kmod_stop_func_t. */
+} OSX32_kmod_info_t;
+
+/**
+ * 32-bit darwin kernel module info structure (kmod_info_t).
+ */
+#pragma pack(1)
+typedef struct OSX64_kmod_info
+{
+    uint64_t    next;
+    int32_t     info_version;
+    uint32_t    id;
+    char        name[64];
+    char        version[64];
+    int32_t     reference_count;
+    uint64_t    reference_list;         /**< Points to kmod_reference_t. Misaligned, duh. */
+    uint64_t    address;                /**< Where in memory the kext is loaded. */
+    uint64_t    size;
+    uint64_t    hdr_size;
+    uint64_t    start;                  /**< Address of kmod_start_func_t. */
+    uint64_t    stop;                   /**< Address of kmod_stop_func_t. */
+} OSX64_kmod_info_t;
+#pragma pack()
+
+/** The value of the info_version field. */
+#define OSX_KMOD_INFO_VERSION   INT32_C(1)
 
 /** @} */
 
@@ -50,12 +92,18 @@ typedef struct DBGDIGGERDARWIN
      * (For fending off illegal interface method calls.) */
     bool fValid;
 
+    /** Set if 64-bit kernel, clear if 32-bit.
+     *  Set during probing. */
+    bool f64Bit;
     /** The address of an kernel version string (there are several).
      * This is set during probing. */
     DBGFADDRESS AddrKernelVersion;
     /** Kernel base address.
      * This is set during probing. */
     DBGFADDRESS AddrKernel;
+
+    /** The kernel message log interface. */
+    DBGFOSIDMESG IDmesg;
 } DBGDIGGERDARWIN;
 /** Pointer to the linux guest OS digger instance data. */
 typedef DBGDIGGERDARWIN *PDBGDIGGERDARWIN;
@@ -64,11 +112,13 @@ typedef DBGDIGGERDARWIN *PDBGDIGGERDARWIN;
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-/** Validates a 32-bit linux kernel address */
-#define DARWIN32_VALID_ADDRESS(Addr)    ((Addr) > UINT32_C(0x80000000) && (Addr) < UINT32_C(0xfffff000))
-
-/** The max kernel size. */
-#define DARWIN_MAX_KERNEL_SIZE          0x0f000000
+/** Validates a 32-bit darwin kernel address */
+#define OSX32_VALID_ADDRESS(Addr)    ((Addr) > UINT32_C(0x00001000) && (Addr) < UINT32_C(0xfffff000))
+/** Validates a 64-bit darwin kernel address */
+#define OSX64_VALID_ADDRESS(Addr)    ((Addr) > UINT64_C(0xffff800000000000) && (Addr) < UINT64_C(0xfffffffffffff000))
+/** Validates a 32-bit or 64-bit darwin kernel address. */
+#define OSX_VALID_ADDRESS(a_f64Bits, a_Addr) \
+    ((a_f64Bits) ? OSX64_VALID_ADDRESS(a_Addr) : OSX32_VALID_ADDRESS(a_Addr))
 
 /** AppleOsX on little endian ASCII systems. */
 #define DIG_DARWIN_MOD_TAG              UINT64_C(0x58734f656c707041)
@@ -80,16 +130,175 @@ typedef DBGDIGGERDARWIN *PDBGDIGGERDARWIN;
 static DECLCALLBACK(int)  dbgDiggerDarwinInit(PUVM pUVM, void *pvData);
 
 
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
-/** Table of common linux kernel addresses. */
-static uint64_t g_au64LnxKernelAddresses[] =
+/**
+ * @interface_method_impl{DBGFOSIDMESG,pfnQueryKernelLog}
+ */
+static DECLCALLBACK(int) dbgDiggerDarwinIDmsg_QueryKernelLog(PDBGFOSIDMESG pThis, PUVM pUVM, uint32_t fFlags, uint32_t cMessages,
+                                                             char *pszBuf, size_t cbBuf, size_t *pcbActual)
 {
-    UINT64_C(0xc0100000),
-    UINT64_C(0x90100000),
-    UINT64_C(0xffffffff80200000)
-};
+    PDBGDIGGERDARWIN pData = RT_FROM_MEMBER(pThis, DBGDIGGERDARWIN, IDmesg);
+
+    if (cMessages < 1)
+        return VERR_INVALID_PARAMETER;
+
+    /*
+     * The 'msgbufp' variable points to a struct msgbuf (bsd/kern/subr_log.c).
+     */
+    RTDBGAS  hAs = DBGFR3AsResolveAndRetain(pUVM, DBGF_AS_KERNEL);
+    RTDBGMOD hMod;
+    int rc = RTDbgAsModuleByName(hAs, "mach_kernel", 0, &hMod);
+    if (RT_FAILURE(rc))
+        return VERR_NOT_FOUND;
+    RTDbgAsRelease(hAs);
+
+    DBGFADDRESS Addr;
+    RTGCPTR     GCPtrMsgBufP = 0;
+    RTDBGSYMBOL SymInfo;
+    rc = RTDbgModSymbolByName(hMod, "_msgbufp", &SymInfo);
+    if (RT_SUCCESS(rc))
+    {
+        rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, DBGFR3AddrFromFlat(pUVM, &Addr, SymInfo.Value + pData->AddrKernel.FlatPtr),
+                           &GCPtrMsgBufP, pData->f64Bit ? sizeof(uint64_t) : sizeof(uint32_t));
+        if (RT_FAILURE(rc))
+        {
+            Log(("dbgDiggerDarwinIDmsg_QueryKernelLog: failed to read _msgbufp at %RGv: %Rrc\n", Addr.FlatPtr, rc));
+            return VERR_NOT_FOUND;
+        }
+        if (!OSX_VALID_ADDRESS(pData->f64Bit, GCPtrMsgBufP))
+        {
+            Log(("dbgDiggerDarwinIDmsg_QueryKernelLog: Invalid address for _msgbufp: %RGv\n", GCPtrMsgBufP));
+            return VERR_NOT_FOUND;
+        }
+    }
+    else
+    {
+        rc = RTDbgModSymbolByName(hMod, "_msgbuf", &SymInfo);
+        if (RT_FAILURE(rc))
+        {
+            Log(("dbgDiggerDarwinIDmsg_QueryKernelLog: failed to find _msgbufp and _msgbuf: %Rrc\n", rc));
+            return VERR_NOT_FOUND;
+        }
+        GCPtrMsgBufP = SymInfo.Value + pData->AddrKernel.FlatPtr;
+        if (!OSX_VALID_ADDRESS(pData->f64Bit, GCPtrMsgBufP))
+        {
+            Log(("dbgDiggerDarwinIDmsg_QueryKernelLog: Invalid address for _msgbuf: %RGv\n", GCPtrMsgBufP));
+            return VERR_NOT_FOUND;
+        }
+    }
+
+    /*
+     * Read the msgbuf structure.
+     */
+    struct
+    {
+        uint32_t msg_magic;
+        uint32_t msg_size;
+        uint32_t msg_bufx;
+        uint32_t msg_bufr;
+        uint64_t msg_bufc; /**< Size depends on windows size. */
+    } MsgBuf;
+    rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, DBGFR3AddrFromFlat(pUVM, &Addr, GCPtrMsgBufP),
+                       &MsgBuf, sizeof(MsgBuf) - (pData->f64Bit ? 0 : sizeof(uint32_t)) );
+    if (RT_FAILURE(rc))
+    {
+        Log(("dbgDiggerDarwinIDmsg_QueryKernelLog: failed to read msgbuf struct at %RGv: %Rrc\n", Addr.FlatPtr, rc));
+        return VERR_NOT_FOUND;
+    }
+    if (!pData->f64Bit)
+        MsgBuf.msg_bufc &= UINT32_MAX;
+
+    /*
+     * Validate the structure.
+     */
+    if (   MsgBuf.msg_magic != UINT32_C(0x63061)
+        || MsgBuf.msg_size < UINT32_C(4096)
+        || MsgBuf.msg_size > 16*_1M
+        || MsgBuf.msg_bufx > MsgBuf.msg_size
+        || MsgBuf.msg_bufr > MsgBuf.msg_size
+        || !OSX_VALID_ADDRESS(pData->f64Bit, MsgBuf.msg_bufc) )
+    {
+        Log(("dbgDiggerDarwinIDmsg_QueryKernelLog: Invalid MsgBuf data: magic=%#x size=%#x bufx=%#x bufr=%#x bufc=%RGv\n",
+             MsgBuf.msg_magic, MsgBuf.msg_size, MsgBuf.msg_bufx, MsgBuf.msg_bufr, MsgBuf.msg_bufc));
+        return VERR_INVALID_STATE;
+    }
+
+    /*
+     * Read the buffer.
+     */
+    char *pchMsgBuf = (char *)RTMemAlloc(MsgBuf.msg_size);
+    if (!pchMsgBuf)
+    {
+        Log(("dbgDiggerDarwinIDmsg_QueryKernelLog: Failed to allocate %#x bytes of memory for the log buffer\n",
+             MsgBuf.msg_size));
+        return VERR_INVALID_STATE;
+    }
+    rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, DBGFR3AddrFromFlat(pUVM, &Addr, MsgBuf.msg_bufc), pchMsgBuf, MsgBuf.msg_size);
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Copy it out raw.
+         */
+        uint32_t offDst = 0;
+        if (MsgBuf.msg_bufr < MsgBuf.msg_bufx)
+        {
+            /* Single chunk between the read and write offsets. */
+            uint32_t cbToCopy = MsgBuf.msg_bufx - MsgBuf.msg_bufr;
+            if (cbToCopy < cbBuf)
+            {
+                memcpy(pszBuf, &pchMsgBuf[MsgBuf.msg_bufr], cbToCopy);
+                pszBuf[cbToCopy] = '\0';
+                rc = VINF_SUCCESS;
+            }
+            else
+            {
+                if (cbBuf)
+                {
+                    memcpy(pszBuf, &pchMsgBuf[MsgBuf.msg_bufr], cbBuf - 1);
+                    pszBuf[cbBuf - 1] = '\0';
+                }
+                rc = VERR_BUFFER_OVERFLOW;
+            }
+            offDst = cbToCopy + 1;
+        }
+        else
+        {
+            /* Two chunks, read offset to end, start to write offset. */
+            uint32_t cbFirst  = MsgBuf.msg_size - MsgBuf.msg_bufr;
+            uint32_t cbSecond = MsgBuf.msg_bufx;
+            if (cbFirst + cbSecond < cbBuf)
+            {
+                memcpy(pszBuf, &pchMsgBuf[MsgBuf.msg_bufr], cbFirst);
+                memcpy(&pszBuf[cbFirst], pchMsgBuf, cbSecond);
+                offDst = cbFirst + cbSecond;
+                pszBuf[offDst++] = '\0';
+                rc = VINF_SUCCESS;
+            }
+            else
+            {
+                offDst = cbFirst + cbSecond + 1;
+                if (cbFirst < cbBuf)
+                {
+                    memcpy(pszBuf, &pchMsgBuf[MsgBuf.msg_bufr], cbFirst);
+                    memcpy(&pszBuf[cbFirst], pchMsgBuf, cbBuf - cbFirst);
+                    pszBuf[cbBuf - 1] = '\0';
+                }
+                else if (cbBuf)
+                {
+                    memcpy(pszBuf, &pchMsgBuf[MsgBuf.msg_bufr], cbBuf - 1);
+                    pszBuf[cbBuf - 1] = '\0';
+                }
+                rc = VERR_BUFFER_OVERFLOW;
+            }
+        }
+
+        if (pcbActual)
+            *pcbActual = offDst;
+    }
+    else
+        Log(("dbgDiggerDarwinIDmsg_QueryKernelLog: Error reading %#x bytes at %RGv: %Rrc\n", MsgBuf.msg_size, MsgBuf.msg_bufc));
+    RTMemFree(pchMsgBuf);
+    return rc;
+}
 
 
 /**
@@ -97,7 +306,15 @@ static uint64_t g_au64LnxKernelAddresses[] =
  */
 static DECLCALLBACK(void *) dbgDiggerDarwinQueryInterface(PUVM pUVM, void *pvData, DBGFOSINTERFACE enmIf)
 {
-    return NULL;
+    PDBGDIGGERDARWIN pThis = (PDBGDIGGERDARWIN)pvData;
+    switch (enmIf)
+    {
+        case DBGFOSINTERFACE_DMESG:
+            return &pThis->IDmesg;
+
+        default:
+            return NULL;
+    }
 }
 
 
@@ -171,7 +388,7 @@ static bool dbgDiggerDarwinIsValidSegOrSectName(const char *pszName, size_t cbNa
     size_t off = 0;
     while (off < cbName && (ch = pszName[off]))
     {
-        if (RT_C_IS_CNTRL(ch) || ch > 127)
+        if (RT_C_IS_CNTRL(ch) || ch >= 127)
             return false;
         off++;
     }
@@ -192,7 +409,7 @@ static bool dbgDiggerDarwinIsValidSegOrSectName(const char *pszName, size_t cbNa
 }
 
 
-static int dbgDiggerDarwinAddModule(PDBGDIGGERDARWIN pThis, PUVM pUVM, uint64_t uModAddr, const char *pszName)
+static int dbgDiggerDarwinAddModule(PDBGDIGGERDARWIN pThis, PUVM pUVM, uint64_t uModAddr, const char *pszName, bool *pf64Bit)
 {
     union
     {
@@ -239,7 +456,7 @@ static int dbgDiggerDarwinAddModule(PDBGDIGGERDARWIN pThis, PUVM pUVM, uint64_t
     /*
      * Process the load commands.
      */
-    RTDBGSEGMENT    aSegs[12];
+    RTDBGSEGMENT    aSegs[24];
     uint32_t        cSegs  = 0;
     RTUUID          Uuid   = RTUUID_INITIALIZE_NULL;
     uint32_t        cLeft  = uBuf.Hdr32.ncmds;
@@ -271,7 +488,7 @@ static int dbgDiggerDarwinAddModule(PDBGDIGGERDARWIN pThis, PUVM pUVM, uint64_t
                 if (!dbgDiggerDarwinIsValidSegOrSectName(uLCmd.pSeg32->segname, sizeof(uLCmd.pSeg32->segname)))
                     return VERR_INVALID_NAME;
                 if (!strcmp(uLCmd.pSeg32->segname, "__LINKEDIT"))
-                    continue; /* This usually is discarded or not loaded at all. */
+                    break; /* This usually is discarded or not loaded at all. */
                 if (cSegs >= RT_ELEMENTS(aSegs))
                     return VERR_BUFFER_OVERFLOW;
                 aSegs[cSegs].Address = uLCmd.pSeg32->vmaddr;
@@ -290,7 +507,7 @@ static int dbgDiggerDarwinAddModule(PDBGDIGGERDARWIN pThis, PUVM pUVM, uint64_t
                 if (!dbgDiggerDarwinIsValidSegOrSectName(uLCmd.pSeg64->segname, sizeof(uLCmd.pSeg64->segname)))
                     return VERR_INVALID_NAME;
                 if (!strcmp(uLCmd.pSeg64->segname, "__LINKEDIT"))
-                    continue; /* This usually is discarded or not loaded at all. */
+                    break; /* This usually is discarded or not loaded at all. */
                 if (cSegs >= RT_ELEMENTS(aSegs))
                     return VERR_BUFFER_OVERFLOW;
                 aSegs[cSegs].Address = uLCmd.pSeg64->vmaddr;
@@ -387,10 +604,24 @@ static int dbgDiggerDarwinAddModule(PDBGDIGGERDARWIN pThis, PUVM pUVM, uint64_t
     {
         uint64_t uRvaNext = 0;
         uint32_t cLinked  = 0;
-        for (iSeg = 0; iSeg < cSegs; iSeg++)
+        iSeg = cSegs;
+        while (iSeg-- > 0) /* HACK: Map in reverse order to avoid replacing __TEXT. */
             if (aSegs[iSeg].cb)
             {
-                int rc2 = RTDbgAsModuleLinkSeg(hAs, hMod, iSeg, aSegs[iSeg].Address, RTDBGASLINK_FLAGS_REPLACE /*fFlags*/);
+                /* Find matching segment in the debug module. */
+                uint32_t iDbgSeg = 0;
+                while (iDbgSeg < cSegs)
+                {
+                    RTDBGSEGMENT SegInfo;
+                    int rc3 = RTDbgModSegmentByIndex(hMod, iDbgSeg, &SegInfo);
+                    if (RT_SUCCESS(rc3) && !strcmp(SegInfo.szName, aSegs[iSeg].szName))
+                        break;
+                    iDbgSeg++;
+                }
+                AssertMsgStmt(iDbgSeg < cSegs, ("%s\n", aSegs[iSeg].szName), continue);
+
+                /* Map it. */
+                int rc2 = RTDbgAsModuleLinkSeg(hAs, hMod, iDbgSeg, aSegs[iSeg].Address, RTDBGASLINK_FLAGS_REPLACE /*fFlags*/);
                 if (RT_SUCCESS(rc2))
                     cLinked++;
                 else if (RT_SUCCESS(rc))
@@ -401,12 +632,40 @@ static int dbgDiggerDarwinAddModule(PDBGDIGGERDARWIN pThis, PUVM pUVM, uint64_t
     }
     else
         rc = VERR_INTERNAL_ERROR;
+
     RTDbgModRelease(hMod);
     RTDbgAsRelease(hAs);
 
+    if (pf64Bit)
+        *pf64Bit = f64Bit;
     return rc;
 }
 
+
+static bool dbgDiggerDarwinIsValidName(const char *pszName)
+{
+    char ch;
+    while ((ch = *pszName++) != '\0')
+    {
+        if (ch < 0x20 || ch >= 127)
+            return false;
+    }
+    return true;
+}
+
+
+static bool dbgDiggerDarwinIsValidVersion(const char *pszVersion)
+{
+    char ch;
+    while ((ch = *pszVersion++) != '\0')
+    {
+        if (ch < 0x20 || ch >= 127)
+            return false;
+    }
+    return true;
+}
+
+
 /**
  * @copydoc DBGFOSREG::pfnInit
  */
@@ -416,12 +675,168 @@ static DECLCALLBACK(int)  dbgDiggerDarwinInit(PUVM pUVM, void *pvData)
     Assert(!pThis->fValid);
 
     /*
-     * Add the kernel module (and later the other kernel modules we can find).
+     * Add the kernel module.
      */
-    int rc = dbgDiggerDarwinAddModule(pThis, pUVM, pThis->AddrKernel.FlatPtr, "mach_kernel");
+    bool f64Bit;
+    int rc = dbgDiggerDarwinAddModule(pThis, pUVM, pThis->AddrKernel.FlatPtr, "mach_kernel", &f64Bit);
     if (RT_SUCCESS(rc))
     {
-        /** @todo  */
+        /*
+         * The list of modules can be found at the 'kmod' symbol, that means
+         * that we currently require some kind of symbol file for the kernel
+         * to be loaded at this point.
+         *
+         * Note! Could also use the 'gLoadedKextSummaries', but I don't think
+         *       it's any easier to find without any kernel map than 'kmod'.
+         */
+        RTDBGSYMBOL SymInfo;
+        rc = DBGFR3AsSymbolByName(pUVM, DBGF_AS_KERNEL, "mach_kernel!kmod", &SymInfo, NULL);
+        if (RT_FAILURE(rc))
+            rc = DBGFR3AsSymbolByName(pUVM, DBGF_AS_KERNEL, "mach_kernel!_kmod", &SymInfo, NULL);
+        if (RT_SUCCESS(rc))
+        {
+            DBGFADDRESS AddrModInfo;
+            DBGFR3AddrFromFlat(pUVM, &AddrModInfo, SymInfo.Value);
+
+            /* Read the variable. */
+            RTUINT64U uKmodValue = { 0 };
+            if (f64Bit)
+                rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &AddrModInfo, &uKmodValue.u, sizeof(uKmodValue.u));
+            else
+                rc = DBGFR3MemRead (pUVM, 0 /*idCpu*/, &AddrModInfo, &uKmodValue.s.Lo, sizeof(uKmodValue.s.Lo));
+            if (RT_SUCCESS(rc))
+            {
+                DBGFR3AddrFromFlat(pUVM, &AddrModInfo, uKmodValue.u);
+
+                /* Walk the list of modules. */
+                uint32_t cIterations = 0;
+                while (AddrModInfo.FlatPtr != 0)
+                {
+                    /* Some extra loop conditions... */
+                    if (!OSX_VALID_ADDRESS(f64Bit, AddrModInfo.FlatPtr))
+                    {
+                        Log(("OSXDig: Invalid kmod_info pointer: %RGv\n", AddrModInfo.FlatPtr));
+                        break;
+                    }
+                    if (AddrModInfo.FlatPtr == uKmodValue.u && cIterations != 0)
+                    {
+                        Log(("OSXDig: kmod_info list looped back to the start.\n"));
+                        break;
+                    }
+                    if (cIterations++ >= 2048)
+                    {
+                        Log(("OSXDig: Too many mod_info loops (%u)\n", cIterations));
+                        break;
+                    }
+
+                    /*
+                     * Read the kmod_info_t structure.
+                     */
+                    union
+                    {
+                        OSX64_kmod_info_t   Info64;
+                        OSX32_kmod_info_t   Info32;
+                    } uMod;
+                    RT_ZERO(uMod);
+                    rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &AddrModInfo, &uMod,
+                                       f64Bit ? sizeof(uMod.Info64) : sizeof(uMod.Info32));
+                    if (RT_FAILURE(rc))
+                    {
+                        Log(("OSXDig: Error reading kmod_info structure at %RGv: %Rrc\n", AddrModInfo.FlatPtr, rc));
+                        break;
+                    }
+
+                    /*
+                     * Validate the kmod_info_t structure.
+                     */
+                    int32_t iInfoVer = f64Bit ? uMod.Info64.info_version : uMod.Info32.info_version;
+                    if (iInfoVer != OSX_KMOD_INFO_VERSION)
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad info_version %d\n", AddrModInfo.FlatPtr, iInfoVer));
+                        break;
+                    }
+
+                    const char *pszName = f64Bit ? uMod.Info64.name : uMod.Info32.name;
+                    if (   !*pszName
+                        || !RTStrEnd(pszName, sizeof(uMod.Info64.name))
+                        || !dbgDiggerDarwinIsValidName(pszName) )
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad name '%.*s'\n", AddrModInfo.FlatPtr,
+                             sizeof(uMod.Info64.name), pszName));
+                        break;
+                    }
+
+                    const char *pszVersion = f64Bit ? uMod.Info64.version : uMod.Info32.version;
+                    if (   !RTStrEnd(pszVersion, sizeof(uMod.Info64.version))
+                        || !dbgDiggerDarwinIsValidVersion(pszVersion) )
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad version '%.*s'\n", AddrModInfo.FlatPtr,
+                             sizeof(uMod.Info64.version), pszVersion));
+                        break;
+                    }
+
+                    int32_t cRefs = f64Bit ? uMod.Info64.reference_count : uMod.Info32.reference_count;
+                    if (cRefs < -1 || cRefs > 16384)
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad reference_count %d\n", AddrModInfo.FlatPtr, cRefs));
+                        break;
+                    }
+
+                    uint64_t uImageAddr = f64Bit ? uMod.Info64.address : uMod.Info32.address;
+                    if (!OSX_VALID_ADDRESS(f64Bit, uImageAddr))
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad address %#llx\n", AddrModInfo.FlatPtr, uImageAddr));
+                        break;
+                    }
+
+                    uint64_t cbImage = f64Bit ? uMod.Info64.size : uMod.Info32.size;
+                    if (cbImage > 64U*_1M)
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad size %#llx\n", AddrModInfo.FlatPtr, cbImage));
+                        break;
+                    }
+
+                    uint64_t cbHdr = f64Bit ? uMod.Info64.hdr_size : uMod.Info32.hdr_size;
+                    if (cbHdr > 16U*_1M)
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad hdr_size %#llx\n", AddrModInfo.FlatPtr, cbHdr));
+                        break;
+                    }
+
+                    uint64_t uStartAddr = f64Bit ? uMod.Info64.start : uMod.Info32.start;
+                    if (!uStartAddr && !OSX_VALID_ADDRESS(f64Bit, uStartAddr))
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad start function %#llx\n", AddrModInfo.FlatPtr, uStartAddr));
+                        break;
+                    }
+
+                    uint64_t uStopAddr = f64Bit ? uMod.Info64.stop : uMod.Info32.stop;
+                    if (!uStopAddr && !OSX_VALID_ADDRESS(f64Bit, uStopAddr))
+                    {
+                        Log(("OSXDig: kmod_info @%RGv: Bad stop function %#llx\n", AddrModInfo.FlatPtr, uStopAddr));
+                        break;
+                    }
+
+                    /*
+                     * Try add the module.
+                     */
+                    Log(("OSXDig: kmod_info @%RGv: '%s' ver '%s', image @%#llx LB %#llx cbHdr=%#llx\n", AddrModInfo.FlatPtr,
+                         pszName, pszVersion, uImageAddr, cbImage, cbHdr));
+                    rc = dbgDiggerDarwinAddModule(pThis, pUVM, uImageAddr, pszName, NULL);
+
+
+                    /*
+                     * Advance to the next kmod_info entry.
+                     */
+                    DBGFR3AddrFromFlat(pUVM, &AddrModInfo, f64Bit ? uMod.Info64.next : uMod.Info32.next);
+                }
+            }
+            else
+                Log(("OSXDig: Error reading the 'kmod' variable: %Rrc\n", rc));
+        }
+        else
+            Log(("OSXDig: Failed to locate the 'kmod' variable in mach_kernel.\n"));
+
         pThis->fValid = true;
         return VINF_SUCCESS;
     }
@@ -500,7 +915,7 @@ static DECLCALLBACK(bool)  dbgDiggerDarwinProbe(PUVM pUVM, void *pvData)
             if (uBuf.Hdr32.ncmds > 256)
                 continue;
             AssertCompileMembersSameSizeAndOffset(mach_header_64_t, sizeofcmds, mach_header_32_t, sizeofcmds);
-            if (uBuf.Hdr32.sizeofcmds > X86_PAGE_4K_SIZE - sizeof(mach_header_64_t))
+            if (uBuf.Hdr32.sizeofcmds > X86_PAGE_4K_SIZE * 2 - sizeof(mach_header_64_t))
                 continue;
 
             /* Seems good enough for now.
@@ -508,6 +923,7 @@ static DECLCALLBACK(bool)  dbgDiggerDarwinProbe(PUVM pUVM, void *pvData)
                If the above causes false positives, check the segments and make
                sure there is a kernel version string in the right one. */
             pThis->AddrKernel = KernelAddr;
+            pThis->f64Bit     = f64Bit;
 
             /*
              * Finally, find the kernel version string.
@@ -537,6 +953,12 @@ static DECLCALLBACK(void)  dbgDiggerDarwinDestruct(PUVM pUVM, void *pvData)
  */
 static DECLCALLBACK(int)  dbgDiggerDarwinConstruct(PUVM pUVM, void *pvData)
 {
+    PDBGDIGGERDARWIN pThis = (PDBGDIGGERDARWIN)pvData;
+
+    pThis->IDmesg.u32Magic = DBGFOSIDMESG_MAGIC;
+    pThis->IDmesg.pfnQueryKernelLog = dbgDiggerDarwinIDmsg_QueryKernelLog;
+    pThis->IDmesg.u32EndMagic = DBGFOSIDMESG_MAGIC;
+
     return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/Debugger/DBGPlugInDiggers.cpp b/src/VBox/Debugger/DBGPlugInDiggers.cpp
index f01626d..7b2e4ee 100644
--- a/src/VBox/Debugger/DBGPlugInDiggers.cpp
+++ b/src/VBox/Debugger/DBGPlugInDiggers.cpp
@@ -1,10 +1,10 @@
 /* $Id: DBGPlugInDiggers.cpp $ */
 /** @file
- * DBGPlugInDiggers - Debugger and Guest OS Digger Plug-in.
+ * DbfPlugInDiggers - Debugger and Guest OS Digger Plug-in.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -27,7 +27,7 @@
 #include <VBox/err.h>
 
 
-DECLEXPORT(int) DBGCPlugInEntry(DBGCPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg)
+DECLEXPORT(int) DbgPlugInEntry(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg)
 {
     static PCDBGFOSREG s_aPlugIns[] =
     {
@@ -41,7 +41,7 @@ DECLEXPORT(int) DBGCPlugInEntry(DBGCPLUGINOP enmOperation, PUVM pUVM, uintptr_t
 
     switch (enmOperation)
     {
-        case DBGCPLUGINOP_INIT:
+        case DBGFPLUGINOP_INIT:
         {
             if (uArg != VBOX_VERSION)
                 return VERR_VERSION_MISMATCH;
@@ -60,7 +60,7 @@ DECLEXPORT(int) DBGCPlugInEntry(DBGCPLUGINOP enmOperation, PUVM pUVM, uintptr_t
             return VINF_SUCCESS;
         }
 
-        case DBGCPLUGINOP_TERM:
+        case DBGFPLUGINOP_TERM:
         {
             for (unsigned i = 0; i < RT_ELEMENTS(s_aPlugIns); i++)
             {
diff --git a/src/VBox/Debugger/DBGPlugInLinux.cpp b/src/VBox/Debugger/DBGPlugInLinux.cpp
index bbe5df3..cd285da 100644
--- a/src/VBox/Debugger/DBGPlugInLinux.cpp
+++ b/src/VBox/Debugger/DBGPlugInLinux.cpp
@@ -48,26 +48,99 @@ typedef struct DBGDIGGERLINUX
     /** Whether the information is valid or not.
      * (For fending off illegal interface method calls.) */
     bool fValid;
+    /** Set if 64-bit, clear if 32-bit.  */
+    bool f64Bit;
 
     /** The address of the linux banner.
      * This is set during probing. */
     DBGFADDRESS AddrLinuxBanner;
     /** Kernel base address.
-     * This is set during probing. */
+     * This is set during probing, refined during kallsyms parsing. */
     DBGFADDRESS AddrKernelBase;
+    /** The kernel size.   */
+    uint32_t    cbKernel;
+
+    /** The number of kernel symbols (kallsyms_num_syms).
+     * This is set during init.  */
+    uint32_t   cKernelSymbols;
+    /** The size of the kernel name table (sizeof(kallsyms_names)).   */
+    uint32_t   cbKernelNames;
+    /** Number of entries in the kernel_markers table. */
+    uint32_t   cKernelNameMarkers;
+    /** The size of the kernel symbol token table. */
+    uint32_t   cbKernelTokenTable;
+    /** The address of the encoded kernel symbol names (kallsyms_names). */
+    DBGFADDRESS AddrKernelNames;
+    /** The address of the kernel symbol addresses (kallsyms_addresses). */
+    DBGFADDRESS AddrKernelAddresses;
+    /** The address of the kernel symbol name markers (kallsyms_markers). */
+    DBGFADDRESS AddrKernelNameMarkers;
+    /** The address of the kernel symbol token table (kallsyms_token_table). */
+    DBGFADDRESS AddrKernelTokenTable;
+    /** The address of the kernel symbol token index table (kallsyms_token_index). */
+    DBGFADDRESS AddrKernelTokenIndex;
+
+    /** The kernel message log interface. */
+    DBGFOSIDMESG    IDmesg;
 } DBGDIGGERLINUX;
 /** Pointer to the linux guest OS digger instance data. */
 typedef DBGDIGGERLINUX *PDBGDIGGERLINUX;
 
 
+/**
+ * The current printk_log structure.
+ */
+typedef struct LNXPRINTKHDR
+{
+    /** Monotonic timestamp. */
+    uint64_t nsTimestamp;
+    /** The total size of this message record. */
+    uint16_t cbTotal;
+    /** The size of the text part (immediately follows the header). */
+    uint16_t cbText;
+    /** The size of the optional dictionary part (follows the text). */
+    uint16_t cbDict;
+    /** The syslog facility number. */
+    uint8_t  bFacility;
+    /** First 5 bits are internal flags, next 3 bits are log level. */
+    uint8_t  fFlagsAndLevel;
+} LNXPRINTKHDR;
+AssertCompileSize(LNXPRINTKHDR, 2*sizeof(uint64_t));
+/** Pointer to linux printk_log header. */
+typedef LNXPRINTKHDR *PLNXPRINTKHDR;
+/** Pointer to linux const printk_log header. */
+typedef LNXPRINTKHDR const *PCLNXPRINTKHDR;
+
+
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
 /** Validates a 32-bit linux kernel address */
 #define LNX32_VALID_ADDRESS(Addr)       ((Addr) > UINT32_C(0x80000000) && (Addr) < UINT32_C(0xfffff000))
+/** Validates a 64-bit linux kernel address */
+#define LNX64_VALID_ADDRESS(Addr)       ((Addr) > UINT64_C(0xffff800000000000) && (Addr) < UINT64_C(0xfffffffffffff000))
 
 /** The max kernel size. */
-#define LNX_MAX_KERNEL_SIZE         0x0f000000
+#define LNX_MAX_KERNEL_SIZE                 UINT32_C(0x0f000000)
+
+/** The maximum size we expect for kallsyms_names. */
+#define LNX_MAX_KALLSYMS_NAMES_SIZE         UINT32_C(0x200000)
+/** The maximum size we expect for kallsyms_token_table. */
+#define LNX_MAX_KALLSYMS_TOKEN_TABLE_SIZE   UINT32_C(0x10000)
+/** The minimum number of symbols we expect in kallsyms_num_syms. */
+#define LNX_MIN_KALLSYMS_SYMBOLS            UINT32_C(2048)
+/** The maximum number of symbols we expect in kallsyms_num_syms. */
+#define LNX_MAX_KALLSYMS_SYMBOLS            UINT32_C(1048576)
+/** The min length an encoded symbol in kallsyms_names is expected to have. */
+#define LNX_MIN_KALLSYMS_ENC_LENGTH         UINT8_C(1)
+/** The max length an encoded symbol in kallsyms_names is expected to have.
+ * @todo check real life here.  */
+#define LNX_MAX_KALLSYMS_ENC_LENGTH         UINT8_C(28)
+/** The approximate maximum length of a string token. */
+#define LNX_MAX_KALLSYMS_TOKEN_LEN          UINT16_C(32)
+
+/** Module tag for linux ('linuxmod' on little endian ASCII systems). */
+#define DIG_LNX_MOD_TAG                     UINT64_C(0x545f5d78758e898c)
 
 
 /*******************************************************************************
@@ -89,11 +162,258 @@ static uint64_t g_au64LnxKernelAddresses[] =
 
 
 /**
+ * @interface_method_impl{DBGFOSIDMESG,pfnQueryKernelLog}
+ */
+static DECLCALLBACK(int) dbgDiggerLinuxIDmsg_QueryKernelLog(PDBGFOSIDMESG pThis, PUVM pUVM, uint32_t fFlags, uint32_t cMessages,
+                                                            char *pszBuf, size_t cbBuf, size_t *pcbActual)
+{
+    PDBGDIGGERLINUX pData = RT_FROM_MEMBER(pThis, DBGDIGGERLINUX, IDmesg);
+
+    if (cMessages < 1)
+        return VERR_INVALID_PARAMETER;
+
+    /*
+     * Resolve the symbols we need and read their values.
+     */
+    RTDBGAS  hAs = DBGFR3AsResolveAndRetain(pUVM, DBGF_AS_KERNEL);
+    RTDBGMOD hMod;
+    int rc = RTDbgAsModuleByName(hAs, "vmlinux", 0, &hMod);
+    if (RT_FAILURE(rc))
+        return VERR_NOT_FOUND;
+    RTDbgAsRelease(hAs);
+
+    RTGCPTR  GCPtrLogBuf;
+    uint32_t cbLogBuf;
+    uint32_t idxFirst;
+    uint32_t idxNext;
+
+    struct { void *pvVar; uint32_t cbHost, cbGuest; const char *pszSymbol; } aSymbols[] =
+    {
+        { &GCPtrLogBuf, sizeof(GCPtrLogBuf),    pData->f64Bit ? sizeof(uint64_t) : sizeof(uint32_t),   "log_buf" },
+        { &cbLogBuf,    sizeof(cbLogBuf),       sizeof(cbLogBuf),                                      "log_buf_len" },
+        { &idxFirst,    sizeof(idxFirst),       sizeof(idxFirst),                                      "log_first_idx" },
+        { &idxNext,     sizeof(idxNext),        sizeof(idxNext),                                       "log_next_idx" },
+    };
+    for (uint32_t i = 0; i < RT_ELEMENTS(aSymbols); i++)
+    {
+        RTDBGSYMBOL SymInfo;
+        rc = RTDbgModSymbolByName(hMod, aSymbols[i].pszSymbol, &SymInfo);
+        if (RT_SUCCESS(rc))
+        {
+            RT_BZERO(aSymbols[i].pvVar, aSymbols[i].cbHost);
+            Assert(aSymbols[i].cbHost >= aSymbols[i].cbGuest);
+            DBGFADDRESS Addr;
+            rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/,
+                               DBGFR3AddrFromFlat(pUVM, &Addr, (RTGCPTR)SymInfo.Value + pData->AddrKernelBase.FlatPtr),
+                               aSymbols[i].pvVar,  aSymbols[i].cbGuest);
+            if (RT_SUCCESS(rc))
+                continue;
+            Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: Reading '%s' at %RGv: %Rrc\n", aSymbols[i].pszSymbol, Addr.FlatPtr, rc));
+        }
+        else
+            Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: Error looking up '%s': %Rrc\n", aSymbols[i].pszSymbol, rc));
+        RTDbgModRelease(hMod);
+        return VERR_NOT_FOUND;
+    }
+
+    /*
+     * Check if the values make sense.
+     */
+    if (pData->f64Bit ? !LNX64_VALID_ADDRESS(GCPtrLogBuf) : !LNX32_VALID_ADDRESS(GCPtrLogBuf))
+    {
+        Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: 'log_buf' value %RGv is not valid.\n", GCPtrLogBuf));
+        return VERR_NOT_FOUND;
+    }
+    if (   cbLogBuf < 4096
+        || !RT_IS_POWER_OF_TWO(cbLogBuf)
+        || cbLogBuf > 16*_1M)
+    {
+        Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: 'log_buf_len' value %#x is not valid.\n", cbLogBuf));
+        return VERR_NOT_FOUND;
+    }
+    uint32_t const cbLogAlign = 4;
+    if (   idxFirst > cbLogBuf - sizeof(LNXPRINTKHDR)
+        || (idxFirst & (cbLogAlign - 1)) != 0)
+    {
+        Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: 'log_first_idx' value %#x is not valid.\n", idxFirst));
+        return VERR_NOT_FOUND;
+    }
+    if (   idxNext > cbLogBuf - sizeof(LNXPRINTKHDR)
+        || (idxNext & (cbLogAlign - 1)) != 0)
+    {
+        Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: 'log_next_idx' value %#x is not valid.\n", idxNext));
+        return VERR_NOT_FOUND;
+    }
+
+    /*
+     * Read the whole log buffer.
+     */
+    uint8_t *pbLogBuf = (uint8_t *)RTMemAlloc(cbLogBuf);
+    if (!pbLogBuf)
+    {
+        Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: Failed to allocate %#x bytes for log buffer\n", cbLogBuf));
+        return VERR_NO_MEMORY;
+    }
+    DBGFADDRESS Addr;
+    rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, DBGFR3AddrFromFlat(pUVM, &Addr, GCPtrLogBuf), pbLogBuf, cbLogBuf);
+    if (RT_FAILURE(rc))
+    {
+        Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: Error reading %#x bytes of log buffer at %RGv: %Rrc\n",
+             cbLogBuf, Addr.FlatPtr, rc));
+        RTMemFree(pbLogBuf);
+        return VERR_NOT_FOUND;
+    }
+
+    /*
+     * Count the messages in the buffer while doing some basic validation.
+     */
+    uint32_t const cbUsed = idxFirst == idxNext ? cbLogBuf /* could be empty... */
+                          : idxFirst < idxNext  ? idxNext - idxFirst : cbLogBuf - idxFirst + idxNext;
+    uint32_t cbLeft    = cbUsed;
+    uint32_t offCur    = idxFirst;
+    uint32_t cLogMsgs  = 0;
+
+    while (cbLeft > 0)
+    {
+        PCLNXPRINTKHDR pHdr = (PCLNXPRINTKHDR)&pbLogBuf[offCur];
+        if (!pHdr->cbTotal)
+        {
+            /* Wrap around packet, most likely... */
+            if (cbLogBuf - offCur >= cbLeft)
+                break;
+            offCur = 0;
+            pHdr = (PCLNXPRINTKHDR)&pbLogBuf[offCur];
+        }
+        if (RT_UNLIKELY(   pHdr->cbTotal > cbLogBuf - sizeof(*pHdr) - offCur
+                        || pHdr->cbTotal > cbLeft
+                        || (pHdr->cbTotal & (cbLogAlign - 1)) != 0
+                        || pHdr->cbTotal < (uint32_t)pHdr->cbText + (uint32_t)pHdr->cbDict + sizeof(*pHdr) ))
+        {
+            Log(("dbgDiggerLinuxIDmsg_QueryKernelLog: Invalid printk_log record at %#x: cbTotal=%#x cbText=%#x cbDict=%#x cbLogBuf=%#x cbLeft=%#x\n",
+                 offCur, pHdr->cbTotal, pHdr->cbText, pHdr->cbDict, cbLogBuf, cbLeft));
+            rc = VERR_INVALID_STATE;
+            break;
+        }
+
+        if (pHdr->cbText > 0)
+            cLogMsgs++;
+
+        /* next */
+        offCur += pHdr->cbTotal;
+        cbLeft -= pHdr->cbTotal;
+    }
+    if (RT_FAILURE(rc))
+    {
+        RTMemFree(pbLogBuf);
+        return rc;
+    }
+
+    /*
+     * Copy the messages into the output buffer.
+     */
+    offCur = idxFirst;
+    cbLeft = cbUsed;
+
+    /* Skip messages that the caller doesn't want. */
+    if (cMessages < cLogMsgs)
+    {
+        uint32_t cToSkip = cLogMsgs - cMessages;
+        while (cToSkip > 0)
+        {
+            PCLNXPRINTKHDR pHdr = (PCLNXPRINTKHDR)&pbLogBuf[offCur];
+            if (!pHdr->cbTotal)
+            {
+                offCur = 0;
+                pHdr = (PCLNXPRINTKHDR)&pbLogBuf[offCur];
+            }
+            if (pHdr->cbText > 0)
+                cToSkip--;
+
+            /* next */
+            offCur += pHdr->cbTotal;
+            cbLeft -= pHdr->cbTotal;
+        }
+    }
+
+    /* Now copy the messages. */
+    size_t offDst = 0;
+    while (cbLeft > 0)
+    {
+        PCLNXPRINTKHDR pHdr = (PCLNXPRINTKHDR)&pbLogBuf[offCur];
+        if (!pHdr->cbTotal)
+        {
+            if (cbLogBuf - offCur >= cbLeft)
+                break;
+            offCur = 0;
+            pHdr = (PCLNXPRINTKHDR)&pbLogBuf[offCur];
+        }
+
+        if (pHdr->cbText > 0)
+        {
+            char  *pchText = (char *)(pHdr + 1);
+            size_t cchText = RTStrNLen(pchText, pHdr->cbText);
+            if (offDst + cchText < cbBuf)
+            {
+                memcpy(&pszBuf[offDst], pHdr + 1, cchText);
+                pszBuf[offDst + cchText] = '\n';
+            }
+            else if (offDst < cbBuf)
+                memcpy(&pszBuf[offDst], pHdr + 1, cbBuf - offDst);
+            offDst += cchText + 1;
+        }
+
+        /* next */
+        offCur += pHdr->cbTotal;
+        cbLeft -= pHdr->cbTotal;
+    }
+
+    /* Done with the buffer. */
+    RTMemFree(pbLogBuf);
+
+    /* Make sure we've reserved a char for the terminator. */
+    if (!offDst)
+        offDst = 1;
+
+    /* Set return size value. */
+    if (pcbActual)
+        *pcbActual = offDst;
+
+    /*
+     * All VBox strings are UTF-8 and bad things may in theory happen if we
+     * pass bad UTF-8 to code which assumes it's all valid.  So, we enforce
+     * UTF-8 upon the guest kernel messages here even if they (probably) have
+     * no defined code set in reality.
+     */
+    if (offDst <= cbBuf)
+    {
+        pszBuf[offDst - 1] = '\0';
+        RTStrPurgeEncoding(pszBuf);
+        return VINF_SUCCESS;
+    }
+
+    if (cbBuf)
+    {
+        pszBuf[cbBuf - 1] = '\0';
+        RTStrPurgeEncoding(pszBuf);
+    }
+    return VERR_BUFFER_OVERFLOW;
+}
+
+
+/**
  * @copydoc DBGFOSREG::pfnQueryInterface
  */
 static DECLCALLBACK(void *) dbgDiggerLinuxQueryInterface(PUVM pUVM, void *pvData, DBGFOSINTERFACE enmIf)
 {
-    return NULL;
+    PDBGDIGGERLINUX pThis = (PDBGDIGGERLINUX)pvData;
+    switch (enmIf)
+    {
+        case DBGFOSINTERFACE_DMESG:
+            return &pThis->IDmesg;
+
+        default:
+            return NULL;
+    }
 }
 
 
@@ -155,25 +475,675 @@ static DECLCALLBACK(int)  dbgDiggerLinuxRefresh(PUVM pUVM, void *pvData)
 
 
 /**
+ * Worker for dbgDiggerLinuxFindStartOfNamesAndSymbolCount that update the
+ * digger data.
+ *
+ * @returns VINF_SUCCESS.
+ * @param   pThis               The Linux digger data to update.
+ * @param   pAddrKernelNames    The kallsyms_names address.
+ * @param   cKernelSymbols      The number of kernel symbol.
+ * @param   cbAddress           The guest address size.
+ */
+static int dbgDiggerLinuxFoundStartOfNames(PDBGDIGGERLINUX pThis, PCDBGFADDRESS pAddrKernelNames,
+                                           uint32_t cKernelSymbols, uint32_t cbAddress)
+{
+    pThis->cKernelSymbols = cKernelSymbols;
+    pThis->AddrKernelNames = *pAddrKernelNames;
+    pThis->AddrKernelAddresses = *pAddrKernelNames;
+    DBGFR3AddrSub(&pThis->AddrKernelAddresses, (cKernelSymbols + 1) * cbAddress);
+
+    Log(("dbgDiggerLinuxFoundStartOfNames: AddrKernelAddresses=%RGv\n"
+         "dbgDiggerLinuxFoundStartOfNames: cKernelSymbols=%#x (at %RGv)\n"
+         "dbgDiggerLinuxFoundStartOfNames: AddrKernelName=%RGv\n",
+         pThis->AddrKernelAddresses.FlatPtr,
+         pThis->cKernelSymbols, pThis->AddrKernelNames.FlatPtr - cbAddress,
+         pThis->AddrKernelNames.FlatPtr));
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Tries to find the address of the kallsyms_names, kallsyms_num_syms and
+ * kallsyms_addresses symbols.
+ *
+ * The kallsyms_num_syms is read and stored in pThis->cKernelSymbols, while the
+ * addresses of the other two are stored as pThis->AddrKernelNames and
+ * pThis->AddrKernelAddresses.
+ *
+ * @returns VBox status code, success indicating that all three variables have
+ *          been found and taken down.
+ * @param   pUVM                The user mode VM handle.
+ * @param   pThis               The Linux digger data.
+ * @param   pHitAddr            An address we think is inside kallsyms_names.
+ */
+static int dbgDiggerLinuxFindStartOfNamesAndSymbolCount(PUVM pUVM, PDBGDIGGERLINUX pThis, PCDBGFADDRESS pHitAddr)
+{
+    /*
+     * Search backwards in chunks.
+     */
+    union
+    {
+        uint8_t  ab[0x1000];
+        uint32_t au32[0x1000 / sizeof(uint32_t)];
+        uint64_t au64[0x1000 / sizeof(uint64_t)];
+    } uBuf;
+    uint32_t        cbLeft  = LNX_MAX_KALLSYMS_NAMES_SIZE;
+    uint32_t        cbBuf   = pHitAddr->FlatPtr & (sizeof(uBuf) - 1);
+    DBGFADDRESS     CurAddr = *pHitAddr;
+    DBGFR3AddrSub(&CurAddr, cbBuf);
+    cbBuf += sizeof(uint64_t) - 1;      /* In case our kobj hit is in the first 4/8 bytes. */
+    for (;;)
+    {
+        int rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &CurAddr, &uBuf, sizeof(uBuf));
+        if (RT_FAILURE(rc))
+            return rc;
+
+        /*
+         * We assume that the three symbols are aligned on guest pointer boundrary.
+         *
+         * The boundrary between the two tables should be noticable as the number
+         * is unlikely to be more than 16 millions, there will be at least one zero
+         * byte where it is, 64-bit will have 5 zero bytes.  Zero bytes aren't all
+         * that common in the kallsyms_names table.
+         *
+         * Also the kallsyms_names table starts with a length byte, which means
+         * we're likely to see a byte in the range 1..31.
+         *
+         * The kallsyms_addresses are mostly sorted (except for the start where the
+         * absolute symbols are), so we'll spot a bunch of kernel addresses
+         * immediately preceeding the kallsyms_num_syms field.
+         *
+         * Lazy bird: If kallsyms_num_syms is on a buffer boundrary, we skip
+         *            the check for kernel addresses preceeding it.
+         */
+        if (pThis->f64Bit)
+        {
+            uint32_t i = cbBuf / sizeof(uint64_t);
+            while (i-- > 0)
+                if (   uBuf.au64[i] <= LNX_MAX_KALLSYMS_SYMBOLS
+                    && uBuf.au64[i] >= LNX_MIN_KALLSYMS_SYMBOLS)
+                {
+                    uint8_t *pb = (uint8_t *)&uBuf.au64[i + 1];
+                    if (   pb[0] <= LNX_MAX_KALLSYMS_ENC_LENGTH
+                        && pb[0] >= LNX_MIN_KALLSYMS_ENC_LENGTH)
+                    {
+                        if (   (i <= 0 || LNX64_VALID_ADDRESS(uBuf.au64[i - 1]))
+                            && (i <= 1 || LNX64_VALID_ADDRESS(uBuf.au64[i - 2]))
+                            && (i <= 2 || LNX64_VALID_ADDRESS(uBuf.au64[i - 3])))
+                            return dbgDiggerLinuxFoundStartOfNames(pThis,
+                                                                   DBGFR3AddrAdd(&CurAddr, (i + 1) * sizeof(uint64_t)),
+                                                                   (uint32_t)uBuf.au64[i], sizeof(uint64_t));
+                    }
+                }
+        }
+        else
+        {
+            uint32_t i = cbBuf / sizeof(uint32_t);
+            while (i-- > 0)
+                if (   uBuf.au32[i] <= LNX_MAX_KALLSYMS_SYMBOLS
+                    && uBuf.au32[i] >= LNX_MIN_KALLSYMS_SYMBOLS)
+                {
+                    uint8_t *pb = (uint8_t *)&uBuf.au32[i + 1];
+                    if (   pb[0] <= LNX_MAX_KALLSYMS_ENC_LENGTH
+                        && pb[0] >= LNX_MIN_KALLSYMS_ENC_LENGTH)
+                    {
+                        if (   (i <= 0 || LNX32_VALID_ADDRESS(uBuf.au32[i - 1]))
+                            && (i <= 1 || LNX32_VALID_ADDRESS(uBuf.au32[i - 2]))
+                            && (i <= 2 || LNX32_VALID_ADDRESS(uBuf.au32[i - 3])))
+                            return dbgDiggerLinuxFoundStartOfNames(pThis,
+                                                                   DBGFR3AddrAdd(&CurAddr, (i + 1) * sizeof(uint32_t)),
+                                                                   uBuf.au32[i], sizeof(uint32_t));
+                    }
+                }
+        }
+
+        /*
+         * Advance
+         */
+        if (RT_UNLIKELY(cbLeft <= sizeof(uBuf)))
+        {
+            Log(("dbgDiggerLinuxFindStartOfNamesAndSymbolCount: failed (pHitAddr=%RGv)\n", pHitAddr->FlatPtr));
+            return VERR_NOT_FOUND;
+        }
+        cbLeft -= sizeof(uBuf);
+        DBGFR3AddrSub(&CurAddr, sizeof(uBuf));
+        cbBuf = sizeof(uBuf);
+    }
+}
+
+
+/**
+ * Worker for dbgDiggerLinuxFindEndNames that records the findings.
+ *
+ * @returns VINF_SUCCESS
+ * @param   pThis           The linux digger data to update.
+ * @param   pAddrMarkers    The address of the marker (kallsyms_markers).
+ * @param   cbMarkerEntry   The size of a marker entry (32-bit or 64-bit).
+ */
+static int dbgDiggerLinuxFoundMarkers(PDBGDIGGERLINUX pThis, PCDBGFADDRESS pAddrMarkers, uint32_t cbMarkerEntry)
+{
+    pThis->cbKernelNames         = pAddrMarkers->FlatPtr - pThis->AddrKernelNames.FlatPtr - 1;
+    pThis->AddrKernelNameMarkers = *pAddrMarkers;
+    pThis->cKernelNameMarkers    = RT_ALIGN_32(pThis->cKernelSymbols, 256) / 256;
+    pThis->AddrKernelTokenTable  = *pAddrMarkers;
+    DBGFR3AddrAdd(&pThis->AddrKernelTokenTable, pThis->cKernelNameMarkers * cbMarkerEntry);
+
+    Log(("dbgDiggerLinuxFoundMarkers: AddrKernelNames=%RGv cbKernelNames=%#x\n"
+         "dbgDiggerLinuxFoundMarkers: AddrKernelNameMarkers=%RGv cKernelNameMarkers=%#x\n"
+         "dbgDiggerLinuxFoundMarkers: AddrKernelTokenTable=%RGv\n",
+         pThis->AddrKernelNames.FlatPtr, pThis->cbKernelNames,
+         pThis->AddrKernelNameMarkers.FlatPtr, pThis->cKernelNameMarkers,
+         pThis->AddrKernelTokenTable.FlatPtr));
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Tries to find the end of kallsyms_names and thereby the start of
+ * kallsyms_markers and kallsyms_token_table.
+ *
+ * The kallsyms_names size is stored in pThis->cbKernelNames, the addresses of
+ * the two other symbols in pThis->AddrKernelNameMarkers and
+ * pThis->AddrKernelTokenTable.  The number of marker entries is stored in
+ * pThis->cKernelNameMarkers.
+ *
+ * @returns VBox status code, success indicating that all three variables have
+ *          been found and taken down.
+ * @param   pUVM                The user mode VM handle.
+ * @param   pThis               The Linux digger data.
+ * @param   pHitAddr            An address we think is inside kallsyms_names.
+ */
+static int dbgDiggerLinuxFindEndOfNamesAndMore(PUVM pUVM, PDBGDIGGERLINUX pThis, PCDBGFADDRESS pHitAddr)
+{
+    /*
+     * Search forward in chunks.
+     */
+    union
+    {
+        uint8_t  ab[0x1000];
+        uint32_t au32[0x1000 / sizeof(uint32_t)];
+        uint64_t au64[0x1000 / sizeof(uint64_t)];
+    } uBuf;
+    bool            fPendingZeroHit = false;
+    uint32_t        cbLeft  = LNX_MAX_KALLSYMS_NAMES_SIZE + sizeof(uBuf);
+    uint32_t        offBuf  = pHitAddr->FlatPtr & (sizeof(uBuf) - 1);
+    DBGFADDRESS     CurAddr = *pHitAddr;
+    DBGFR3AddrSub(&CurAddr, offBuf);
+    for (;;)
+    {
+        int rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &CurAddr, &uBuf, sizeof(uBuf));
+        if (RT_FAILURE(rc))
+            return rc;
+
+        /*
+         * The kallsyms_names table is followed by kallsyms_markers we assume,
+         * using sizeof(unsigned long) alignment like the preceeding symbols.
+         *
+         * The kallsyms_markers table has entried sizeof(unsigned long) and
+         * contains offsets into kallsyms_names.  The kallsyms_markers used to
+         * index kallsyms_names and reduce seek time when looking up the name
+         * of an address/symbol.  Each entry in kallsyms_markers covers 256
+         * symbol names.
+         *
+         * Because of this, the first entry is always zero and all the entries
+         * are ascending.  It also follows that the size of the table can be
+         * calculated from kallsyms_num_syms.
+         *
+         * Note! We could also have walked kallsyms_names by skipping
+         *       kallsyms_num_syms names, but this is faster and we will
+         *       validate the encoded names later.
+         */
+        if (pThis->f64Bit)
+        {
+            if (   RT_UNLIKELY(fPendingZeroHit)
+                && uBuf.au64[0] >= (LNX_MIN_KALLSYMS_ENC_LENGTH + 1) * 256
+                && uBuf.au64[0] <= (LNX_MAX_KALLSYMS_ENC_LENGTH + 1) * 256)
+                return dbgDiggerLinuxFoundMarkers(pThis, DBGFR3AddrSub(&CurAddr, sizeof(uint64_t)), sizeof(uint64_t));
+
+            uint32_t const cEntries = sizeof(uBuf) / sizeof(uint64_t);
+            for (uint32_t i = offBuf / sizeof(uint64_t); i < cEntries; i++)
+                if (uBuf.au64[i] == 0)
+                {
+                    if (RT_UNLIKELY(i + 1 >= cEntries))
+                    {
+                        fPendingZeroHit = true;
+                        break;
+                    }
+                    if (   uBuf.au64[i + 1] >= (LNX_MIN_KALLSYMS_ENC_LENGTH + 1) * 256
+                        && uBuf.au64[i + 1] <= (LNX_MAX_KALLSYMS_ENC_LENGTH + 1) * 256)
+                        return dbgDiggerLinuxFoundMarkers(pThis, DBGFR3AddrAdd(&CurAddr, i * sizeof(uint64_t)), sizeof(uint64_t));
+                }
+        }
+        else
+        {
+            if (   RT_UNLIKELY(fPendingZeroHit)
+                && uBuf.au32[0] >= (LNX_MIN_KALLSYMS_ENC_LENGTH + 1) * 256
+                && uBuf.au32[0] <= (LNX_MAX_KALLSYMS_ENC_LENGTH + 1) * 256)
+                return dbgDiggerLinuxFoundMarkers(pThis, DBGFR3AddrSub(&CurAddr, sizeof(uint32_t)), sizeof(uint32_t));
+
+            uint32_t const cEntries = sizeof(uBuf) / sizeof(uint32_t);
+            for (uint32_t i = offBuf / sizeof(uint32_t); i < cEntries; i++)
+                if (uBuf.au32[i] == 0)
+                {
+                    if (RT_UNLIKELY(i + 1 >= cEntries))
+                    {
+                        fPendingZeroHit = true;
+                        break;
+                    }
+                    if (   uBuf.au32[i + 1] >= (LNX_MIN_KALLSYMS_ENC_LENGTH + 1) * 256
+                        && uBuf.au32[i + 1] <= (LNX_MAX_KALLSYMS_ENC_LENGTH + 1) * 256)
+                        return dbgDiggerLinuxFoundMarkers(pThis, DBGFR3AddrAdd(&CurAddr, i * sizeof(uint32_t)), sizeof(uint32_t));
+                }
+        }
+
+        /*
+         * Advance
+         */
+        if (RT_UNLIKELY(cbLeft <= sizeof(uBuf)))
+        {
+            Log(("dbgDiggerLinuxFindEndOfNamesAndMore: failed (pHitAddr=%RGv)\n", pHitAddr->FlatPtr));
+            return VERR_NOT_FOUND;
+        }
+        cbLeft -= sizeof(uBuf);
+        DBGFR3AddrAdd(&CurAddr, sizeof(uBuf));
+        offBuf = 0;
+    }
+}
+
+
+/**
+ * Locates the kallsyms_token_index table.
+ *
+ * Storing the address in pThis->AddrKernelTokenIndex and the size of the token
+ * table in pThis->cbKernelTokenTable.
+ *
+ * @returns VBox status code.
+ * @param   pUVM                The user mode VM handle.
+ * @param   pThis               The Linux digger data.
+ */
+static int dbgDiggerLinuxFindTokenIndex(PUVM pUVM, PDBGDIGGERLINUX pThis)
+{
+    /*
+     * The kallsyms_token_table is very much like a string table.  Due to the
+     * nature of the compression algorithm it is reasonably short (one example
+     * here is 853 bytes), so we'll not be reading it in chunks but in full.
+     * To be on the safe side, we read 8KB, ASSUMING we won't run into unmapped
+     * memory or any other nasty stuff...
+     */
+    union
+    {
+        uint8_t  ab[0x2000];
+        uint16_t au16[0x2000 / sizeof(uint16_t)];
+    } uBuf;
+    DBGFADDRESS CurAddr = pThis->AddrKernelTokenTable;
+    int rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &CurAddr, &uBuf, sizeof(uBuf));
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /*
+     * We've got two choices here, either walk the string table or look for
+     * the next structure, kallsyms_token_index.
+     *
+     * The token index is a table of 256 uint16_t entries (index by bytes
+     * from kallsyms_names) that gives offsets in kallsyms_token_table.  It
+     * starts with a zero entry and the following entries are sorted in
+     * ascending order.  The range of the entries are reasonably small since
+     * kallsyms_token_table is small.
+     *
+     * The alignment seems to be sizeof(unsigned long), just like
+     * kallsyms_token_table.
+     *
+     * So, we start by looking for a zero 16-bit entry.
+     */
+    uint32_t cIncr = (pThis->f64Bit ? sizeof(uint64_t) : sizeof(uint32_t)) / sizeof(uint16_t);
+
+    for (uint32_t i = 0; i < sizeof(uBuf) / sizeof(uint16_t) - 16; i += cIncr)
+        if (   uBuf.au16[i] == 0
+            && uBuf.au16[i + 1] >  0
+            && uBuf.au16[i + 1] <= LNX_MAX_KALLSYMS_TOKEN_LEN
+            && (uint16_t)(uBuf.au16[i + 2] - uBuf.au16[i + 1] - 1U) <= (uint16_t)LNX_MAX_KALLSYMS_TOKEN_LEN
+            && (uint16_t)(uBuf.au16[i + 3] - uBuf.au16[i + 2] - 1U) <= (uint16_t)LNX_MAX_KALLSYMS_TOKEN_LEN
+            && (uint16_t)(uBuf.au16[i + 4] - uBuf.au16[i + 3] - 1U) <= (uint16_t)LNX_MAX_KALLSYMS_TOKEN_LEN
+            && (uint16_t)(uBuf.au16[i + 5] - uBuf.au16[i + 4] - 1U) <= (uint16_t)LNX_MAX_KALLSYMS_TOKEN_LEN
+            && (uint16_t)(uBuf.au16[i + 6] - uBuf.au16[i + 5] - 1U) <= (uint16_t)LNX_MAX_KALLSYMS_TOKEN_LEN
+            )
+        {
+            pThis->AddrKernelTokenIndex = CurAddr;
+            DBGFR3AddrAdd(&pThis->AddrKernelTokenIndex, i * sizeof(uint16_t));
+            pThis->cbKernelTokenTable = i * sizeof(uint16_t);
+            return VINF_SUCCESS;
+        }
+
+    Log(("dbgDiggerLinuxFindTokenIndex: Failed (%RGv..%RGv)\n", CurAddr.FlatPtr, CurAddr.FlatPtr + (RTGCUINTPTR)sizeof(uBuf)));
+    return VERR_NOT_FOUND;
+}
+
+
+/**
+ * Loads the kernel symbols from the kallsyms tables.
+ *
+ * @returns VBox status code.
+ * @param   pUVM                The user mode VM handle.
+ * @param   pThis               The Linux digger data.
+ */
+static int dbgDiggerLinuxLoadKernelSymbols(PUVM pUVM, PDBGDIGGERLINUX pThis)
+{
+    /*
+     * Allocate memory for temporary table copies, reading the tables as we go.
+     */
+    uint32_t const cbGuestAddr = pThis->f64Bit ? sizeof(uint64_t) : sizeof(uint32_t);
+    void *pvAddresses = RTMemAllocZ(pThis->cKernelSymbols * cbGuestAddr);
+    int rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &pThis->AddrKernelAddresses, pvAddresses, pThis->cKernelSymbols * cbGuestAddr);
+    if (RT_SUCCESS(rc))
+    {
+        uint8_t *pbNames = (uint8_t *)RTMemAllocZ(pThis->cbKernelNames);
+        rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &pThis->AddrKernelNames, pbNames, pThis->cbKernelNames);
+        if (RT_SUCCESS(rc))
+        {
+            char *pszzTokens = (char *)RTMemAllocZ(pThis->cbKernelTokenTable);
+            rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &pThis->AddrKernelTokenTable, pszzTokens, pThis->cbKernelTokenTable);
+            if (RT_SUCCESS(rc))
+            {
+                uint16_t *paoffTokens = (uint16_t *)RTMemAllocZ(256 * sizeof(uint16_t));
+                rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &pThis->AddrKernelTokenIndex, paoffTokens, 256 * sizeof(uint16_t));
+                if (RT_SUCCESS(rc))
+                {
+                    /*
+                     * Figure out the kernel start and end.
+                     */
+                    RTGCUINTPTR uKernelStart = pThis->AddrKernelAddresses.FlatPtr;
+                    RTGCUINTPTR uKernelEnd   = pThis->AddrKernelTokenIndex.FlatPtr + 256 * sizeof(uint16_t);
+                    uint32_t    i;
+                    if (cbGuestAddr == sizeof(uint64_t))
+                    {
+                        uint64_t *pauAddrs = (uint64_t *)pvAddresses;
+                        for (i = 0; i < pThis->cKernelSymbols; i++)
+                            if (   pauAddrs[i] < uKernelStart
+                                && LNX64_VALID_ADDRESS(pauAddrs[i])
+                                && uKernelStart - pauAddrs[i] < LNX_MAX_KERNEL_SIZE)
+                                uKernelStart = pauAddrs[i];
+
+                        for (i = pThis->cKernelSymbols - 1; i > 0; i--)
+                            if (   pauAddrs[i] > uKernelEnd
+                                && LNX64_VALID_ADDRESS(pauAddrs[i])
+                                && pauAddrs[i] - uKernelEnd < LNX_MAX_KERNEL_SIZE)
+                                uKernelEnd = pauAddrs[i];
+                    }
+                    else
+                    {
+                        uint32_t *pauAddrs = (uint32_t *)pvAddresses;
+                        for (i = 0; i < pThis->cKernelSymbols; i++)
+                            if (   pauAddrs[i] < uKernelStart
+                                && LNX32_VALID_ADDRESS(pauAddrs[i])
+                                && uKernelStart - pauAddrs[i] < LNX_MAX_KERNEL_SIZE)
+                                uKernelStart = pauAddrs[i];
+
+                        for (i = pThis->cKernelSymbols - 1; i > 0; i--)
+                            if (   pauAddrs[i] > uKernelEnd
+                                && LNX32_VALID_ADDRESS(pauAddrs[i])
+                                && pauAddrs[i] - uKernelEnd < LNX_MAX_KERNEL_SIZE)
+                                uKernelEnd = pauAddrs[i];
+                    }
+
+                    RTGCUINTPTR cbKernel = uKernelEnd - uKernelStart;
+                    pThis->cbKernel = (uint32_t)cbKernel;
+                    DBGFR3AddrFromFlat(pUVM, &pThis->AddrKernelBase, uKernelStart);
+                    Log(("dbgDiggerLinuxLoadKernelSymbols: uKernelStart=%RGv cbKernel=%#x\n", uKernelStart, cbKernel));
+
+                    /*
+                     * Create a module for the kernel.
+                     */
+                    RTDBGMOD hMod;
+                    rc = RTDbgModCreate(&hMod, "vmlinux", cbKernel, 0 /*fFlags*/);
+                    if (RT_SUCCESS(rc))
+                    {
+                        rc = RTDbgModSetTag(hMod, DIG_LNX_MOD_TAG); AssertRC(rc);
+                        rc = VINF_SUCCESS;
+
+                        /*
+                         * Enumerate the symbols.
+                         */
+                        uint8_t const  *pbCurAddr = (uint8_t const *)pvAddresses;
+                        uint32_t        offName   = 0;
+                        uint32_t        cLeft = pThis->cKernelSymbols;
+                        while (cLeft-- > 0 && RT_SUCCESS(rc))
+                        {
+                            /* Decode the symbol name first. */
+                            if (RT_LIKELY(offName < pThis->cbKernelNames))
+                            {
+                                uint8_t cbName = pbNames[offName++];
+                                if (RT_LIKELY(offName + cbName <= pThis->cbKernelNames))
+                                {
+                                    char     szSymbol[4096];
+                                    uint32_t offSymbol = 0;
+                                    while (cbName-- > 0)
+                                    {
+                                        uint8_t  bEnc     = pbNames[offName++];
+                                        uint16_t offToken = paoffTokens[bEnc];
+                                        if (RT_LIKELY(offToken < pThis->cbKernelTokenTable))
+                                        {
+                                            const char *pszToken = &pszzTokens[offToken];
+                                            char ch;
+                                            while ((ch = *pszToken++) != '\0')
+                                                if (offSymbol < sizeof(szSymbol) - 1)
+                                                    szSymbol[offSymbol++] = ch;
+                                        }
+                                        else
+                                        {
+                                            rc = VERR_INVALID_UTF8_ENCODING;
+                                            break;
+                                        }
+                                    }
+                                    szSymbol[offSymbol < sizeof(szSymbol) ? offSymbol : sizeof(szSymbol) - 1] = '\0';
+
+                                    /* The address. */
+                                    RTGCUINTPTR uSymAddr = cbGuestAddr == sizeof(uint64_t)
+                                                         ? *(uint64_t *)pbCurAddr : *(uint32_t *)pbCurAddr;
+                                    pbCurAddr += cbGuestAddr;
+
+                                    /* Add it without the type char. */
+                                    if (uSymAddr - uKernelStart <= cbKernel)
+                                    {
+                                        rc = RTDbgModSymbolAdd(hMod, &szSymbol[1], RTDBGSEGIDX_RVA, uSymAddr - uKernelStart,
+                                                               0 /*cb*/, 0 /*fFlags*/, NULL);
+                                        if (RT_FAILURE(rc))
+                                        {
+                                            if (   rc == VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE
+                                                || rc == VERR_DBG_INVALID_RVA
+                                                || rc == VERR_DBG_ADDRESS_CONFLICT
+                                                || rc == VERR_DBG_DUPLICATE_SYMBOL)
+                                            {
+                                                Log2(("dbgDiggerLinuxLoadKernelSymbols: RTDbgModSymbolAdd(,%s,) failed %Rrc (ignored)\n", szSymbol, rc));
+                                                rc = VINF_SUCCESS;
+                                            }
+                                            else
+                                                Log(("dbgDiggerLinuxLoadKernelSymbols: RTDbgModSymbolAdd(,%s,) failed %Rrc\n", szSymbol, rc));
+                                        }
+                                    }
+                                }
+                                else
+                                {
+                                    rc = VERR_END_OF_STRING;
+                                    Log(("dbgDiggerLinuxLoadKernelSymbols: offName=%#x cLeft=%#x cbName=%#x cbKernelNames=%#x\n",
+                                         offName, cLeft, cbName, pThis->cbKernelNames));
+                                }
+                            }
+                            else
+                            {
+                                rc = VERR_END_OF_STRING;
+                                Log(("dbgDiggerLinuxLoadKernelSymbols: offName=%#x cLeft=%#x cbKernelNames=%#x\n",
+                                     offName, cLeft, pThis->cbKernelNames));
+                            }
+                        }
+
+                        /*
+                         * Link the module into the address space.
+                         */
+                        if (RT_SUCCESS(rc))
+                        {
+                            RTDBGAS hAs = DBGFR3AsResolveAndRetain(pUVM, DBGF_AS_KERNEL);
+                            if (hAs != NIL_RTDBGAS)
+                                rc = RTDbgAsModuleLink(hAs, hMod, uKernelStart, RTDBGASLINK_FLAGS_REPLACE);
+                            else
+                                rc = VERR_INTERNAL_ERROR;
+                            RTDbgAsRelease(hAs);
+                        }
+                        else
+                            Log(("dbgDiggerLinuxFindTokenIndex: Failed: %Rrc\n", rc));
+                        RTDbgModRelease(hMod);
+                    }
+                    else
+                        Log(("dbgDiggerLinuxFindTokenIndex: RTDbgModCreate failed: %Rrc\n", rc));
+                }
+                else
+                    Log(("dbgDiggerLinuxFindTokenIndex: Reading token index at %RGv failed: %Rrc\n",
+                         pThis->AddrKernelTokenIndex.FlatPtr, rc));
+                RTMemFree(paoffTokens);
+            }
+            else
+                Log(("dbgDiggerLinuxFindTokenIndex: Reading token table at %RGv failed: %Rrc\n",
+                     pThis->AddrKernelTokenTable.FlatPtr, rc));
+            RTMemFree(pszzTokens);
+        }
+        else
+            Log(("dbgDiggerLinuxFindTokenIndex: Reading encoded names at %RGv failed: %Rrc\n",
+                 pThis->AddrKernelNames.FlatPtr, rc));
+        RTMemFree(pbNames);
+    }
+    else
+        Log(("dbgDiggerLinuxFindTokenIndex: Reading symbol addresses at %RGv failed: %Rrc\n",
+             pThis->AddrKernelAddresses.FlatPtr, rc));
+    RTMemFree(pvAddresses);
+    return rc;
+}
+
+
+/**
+ * Checks if there is a likely kallsyms_names fragment at pHitAddr.
+ *
+ * @returns true if it's a likely fragment, false if not.
+ * @param   pUVM                The user mode VM handle.
+ * @param   pHitAddr            The address where paNeedle was found.
+ * @param   pabNeedle           The fragment we've been searching for.
+ * @param   cbNeedle            The length of the fragment.
+ */
+static bool dbgDiggerLinuxIsLikelyNameFragment(PUVM pUVM, PCDBGFADDRESS pHitAddr, uint8_t const *pabNeedle, uint8_t cbNeedle)
+{
+    /*
+     * Examples of lead and tail bytes of our choosen needle in a randomly
+     * picked kernel:
+     *         k  o  b  j
+     *     22  6b 6f 62 6a  aa
+     *     fc  6b 6f 62 6a  aa
+     *     82  6b 6f 62 6a  5f      - ascii trail byte (_).
+     *     ee  6b 6f 62 6a  aa
+     *     fc  6b 6f 62 6a  5f      - ascii trail byte (_).
+     *  0a 74  6b 6f 62 6a  5f ea   - ascii lead (t) and trail (_) bytes.
+     *  0b 54  6b 6f 62 6a  aa      - ascii lead byte (T).
+     * ... omitting 29 samples similar to the last two ...
+     *     d8  6b 6f 62 6a  aa
+     *     d8  6b 6f 62 6a  aa
+     *     d8  6b 6f 62 6a  aa
+     *     d8  6b 6f 62 6a  aa
+     *  f9 5f  6b 6f 62 6a  5f 94   - ascii lead and trail bytes (_)
+     *  f9 5f  6b 6f 62 6a  0c      - ascii lead byte (_).
+     *     fd  6b 6f 62 6a  0f
+     *  ... enough.
+     */
+    uint8_t         abBuf[32];
+    DBGFADDRESS     ReadAddr = *pHitAddr;
+    DBGFR3AddrSub(&ReadAddr, 2);
+    int rc = DBGFR3MemRead(pUVM, 0 /*idCpu*/, &ReadAddr, abBuf, 2 + cbNeedle + 2);
+    if (RT_SUCCESS(rc))
+    {
+        if (memcmp(&abBuf[2], pabNeedle, cbNeedle) == 0) /* paranoia */
+        {
+            uint8_t const bLead = abBuf[1] == '_' || abBuf[1] == 'T' || abBuf[1] == 't' ? abBuf[0] : abBuf[1];
+            uint8_t const offTail = 2 + cbNeedle;
+            uint8_t const bTail = abBuf[offTail] == '_' ? abBuf[offTail] : abBuf[offTail + 1];
+            if (   bLead >= 1 && (bLead < 0x20 || bLead >= 0x80)
+                && bTail >= 1 && (bTail < 0x20 || bTail >= 0x80))
+                return true;
+            Log(("dbgDiggerLinuxIsLikelyNameFragment: failed at %RGv: bLead=%#x bTail=%#x (offTail=%#x)\n",
+                 pHitAddr->FlatPtr, bLead, bTail, offTail));
+        }
+        else
+            Log(("dbgDiggerLinuxIsLikelyNameFragment: failed at %RGv: Needle changed!\n", pHitAddr->FlatPtr));
+    }
+    else
+        Log(("dbgDiggerLinuxIsLikelyNameFragment: failed at %RGv: %Rrc\n", pHitAddr->FlatPtr, rc));
+
+    return false;
+}
+
+
+/**
  * @copydoc DBGFOSREG::pfnInit
  */
 static DECLCALLBACK(int)  dbgDiggerLinuxInit(PUVM pUVM, void *pvData)
 {
     PDBGDIGGERLINUX pThis = (PDBGDIGGERLINUX)pvData;
     Assert(!pThis->fValid);
-#if 0  /* later */
-    int rc;
 
     /*
-     * Algorithm to find the ksymtab:
-     *  1. Find a known export string in kstrtab ("init_task", "enable_hlt" or something).
-     *  2. Search for the address its at, this should give you the corresponding ksymtab entry.
-     *  3. Search backwards assuming that kstrtab is corresponding to ksymtab.
+     * Assume 64-bit kernels all live way beyond 32-bit address space.
      */
-    DBGFADDRESS AddrKernelKsymTab;
+    pThis->f64Bit = pThis->AddrLinuxBanner.FlatPtr > UINT32_MAX;
 
+    /*
+     * Go looking for the kallsyms table.  If it's there, it will be somewhere
+     * after the linux_banner symbol, so use it for starting the search.
+     */
+    DBGFADDRESS CurAddr = pThis->AddrLinuxBanner;
+    uint32_t    cbLeft  = LNX_MAX_KERNEL_SIZE;
+    while (cbLeft > 4096)
+    {
+        static const uint8_t s_abNeedle[] = "kobj";
+        DBGFADDRESS          HitAddr;
+        int rc = DBGFR3MemScan(pUVM, 0 /*idCpu*/, &CurAddr, cbLeft, 1 /*uAlign*/,
+                               s_abNeedle, sizeof(s_abNeedle) - 1, &HitAddr);
+        if (RT_FAILURE(rc))
+            break;
+        if (dbgDiggerLinuxIsLikelyNameFragment(pUVM, &HitAddr, s_abNeedle, sizeof(s_abNeedle) - 1))
+        {
+            /* There will be another hit near by. */
+            DBGFR3AddrAdd(&HitAddr, 1);
+            rc = DBGFR3MemScan(pUVM, 0 /*idCpu*/, &HitAddr, LNX_MAX_KALLSYMS_NAMES_SIZE, 1 /*uAlign*/,
+                               s_abNeedle, sizeof(s_abNeedle) - 1, &HitAddr);
+            if (   RT_SUCCESS(rc)
+                && dbgDiggerLinuxIsLikelyNameFragment(pUVM, &HitAddr, s_abNeedle, sizeof(s_abNeedle) - 1))
+            {
+                /*
+                 * We've got a very likely candidate for a location inside kallsyms_names.
+                 * Try find the start of it, that is to say, try find kallsyms_num_syms.
+                 * kallsyms_num_syms is aligned on sizeof(unsigned long) boundrary
+                 */
+                rc = dbgDiggerLinuxFindStartOfNamesAndSymbolCount(pUVM, pThis, &HitAddr);
+                if (RT_SUCCESS(rc))
+                    rc = dbgDiggerLinuxFindEndOfNamesAndMore(pUVM, pThis, &HitAddr);
+                if (RT_SUCCESS(rc))
+                    rc = dbgDiggerLinuxFindTokenIndex(pUVM, pThis);
+                if (RT_SUCCESS(rc))
+                    rc = dbgDiggerLinuxLoadKernelSymbols(pUVM, pThis);
+                if (RT_SUCCESS(rc))
+                    break;
+            }
+        }
+
+        /*
+         * Advance.
+         */
+        RTGCUINTPTR cbDistance = HitAddr.FlatPtr - CurAddr.FlatPtr + sizeof(s_abNeedle) - 1;
+        if (RT_UNLIKELY(cbDistance >= cbLeft))
+        {
+            Log(("dbgDiggerLinuxInit: Failed to find kallsyms\n"));
+            break;
+        }
+        cbLeft -= cbDistance;
+        DBGFR3AddrAdd(&CurAddr, cbDistance);
+
+    }
 
-#endif
     pThis->fValid = true;
     return VINF_SUCCESS;
 }
@@ -189,8 +1159,8 @@ static DECLCALLBACK(bool)  dbgDiggerLinuxProbe(PUVM pUVM, void *pvData)
     /*
      * Look for "Linux version " at the start of the rodata segment.
      * Hope that this comes before any message buffer or other similar string.
-     *                                                                       .
-     * Note! Only Linux version 2.x.y, where x in {0..6}.                                                                      .
+     *
+     * Note! Only Linux version 2.x.y, where x in {0..6}.
      */
     for (unsigned i = 0; i < RT_ELEMENTS(g_au64LnxKernelAddresses); i++)
     {
@@ -250,6 +1220,11 @@ static DECLCALLBACK(void)  dbgDiggerLinuxDestruct(PUVM pUVM, void *pvData)
  */
 static DECLCALLBACK(int)  dbgDiggerLinuxConstruct(PUVM pUVM, void *pvData)
 {
+    PDBGDIGGERLINUX pThis = (PDBGDIGGERLINUX)pvData;
+    pThis->IDmesg.u32Magic = DBGFOSIDMESG_MAGIC;
+    pThis->IDmesg.pfnQueryKernelLog = dbgDiggerLinuxIDmsg_QueryKernelLog;
+    pThis->IDmesg.u32EndMagic = DBGFOSIDMESG_MAGIC;
+
     return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/Debugger/Makefile.kmk b/src/VBox/Debugger/Makefile.kmk
index 3e9d1fd..c41d165 100644
--- a/src/VBox/Debugger/Makefile.kmk
+++ b/src/VBox/Debugger/Makefile.kmk
@@ -27,9 +27,6 @@ ifdef VBOX_WITH_DEBUGGER
   PROGRAMS += tstDBGCParser
  endif
 endif # VBOX_WITH_DEBUGGER
-ifndef VBOX_OSE
- INSTALLS.win.x86 += dbghelp
-endif
 
 
 #
@@ -56,9 +53,9 @@ Debugger_SOURCES   = \
 #
 # The diggers plug-in.
 #
-DLLS += DBGCPlugInDiggers
-DBGCPlugInDiggers_TEMPLATE = VBOXR3
-DBGCPlugInDiggers_SOURCES = \
+DLLS += DbgPlugInDiggers
+DbgPlugInDiggers_TEMPLATE = VBOXR3
+DbgPlugInDiggers_SOURCES = \
 	DBGPlugInDiggers.cpp \
 	DBGPlugInDarwin.cpp \
 	DBGPlugInLinux.cpp \
@@ -66,12 +63,11 @@ DBGCPlugInDiggers_SOURCES = \
 	DBGPlugInWinNt.cpp \
 	DBGPlugInOS2.cpp \
 	DBGPlugInCommonELF.cpp
-DBGCPlugInDiggers_SOURCES.win = \
-	DBGCPlugInDiggers.rc
-DBGCPlugInDiggers_LIBS = \
+DbgPlugInDiggers_LIBS = \
 	$(if-expr "$(LIB_VMM)" == "$(VBOX_LIB_VMM_LAZY)",$(LIB_REM),) \
 	$(VBOX_LIB_VMM_LAZY) \
 	$(LIB_RUNTIME)
+$(call VBOX_SET_VER_INFO_DLL,DbgPlugInDiggers,VirtualBox Debugger Guest OS Digger Plug-in)
 
 
 #
@@ -109,12 +105,11 @@ VBoxDbg_SOURCES = \
 	VBoxDbgBase.cpp \
 	VBoxDbgConsole.cpp \
 	VBoxDbgStatsQt4.cpp
-VBoxDbg_SOURCES.win = \
-	VBoxDbg.rc
 VBoxDbg_LIBS = \
 	$(VBOX_LIB_VMM_LAZY)
 VBoxDbg_LDFLAGS.darwin = \
 	-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDbg.dylib
+$(call VBOX_SET_VER_INFO_DLL,VBoxDbg,VirtualBox Debugger GUI)
 
  ifdef VBOX_WITH_TESTCASES
 #
@@ -140,13 +135,5 @@ tstVBoxDbg_LIBS        += \
 endif # Qt4
 
 
-#
-# Install the dbghelp.dll binary.
-#
-dbghelp_INST = bin/
-dbghelp_SOURCES.x86 = win32/dbghelp.dll
-dbghelp_SOURCES.amd64 = win64/dbghelp.dll
-
-
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/Debugger/VBoxDbg.cpp b/src/VBox/Debugger/VBoxDbg.cpp
index bc3287e..351d604 100644
--- a/src/VBox/Debugger/VBoxDbg.cpp
+++ b/src/VBox/Debugger/VBoxDbg.cpp
@@ -20,6 +20,11 @@
 *******************************************************************************/
 #define LOG_GROUP LOG_GROUP_DBGG
 #define VBOX_COM_NO_ATL
+#ifdef RT_OS_WINDOWS
+# include <VirtualBox.h>
+#else /* !RT_OS_WINDOWS */
+# include <VirtualBox_XPCOM.h>
+#endif /* !RT_OS_WINDOWS */
 #include <VBox/dbggui.h>
 #include <VBox/vmm/vm.h>
 #include <VBox/err.h>
diff --git a/src/VBox/Debugger/VBoxDbg.rc b/src/VBox/Debugger/VBoxDbg.rc
deleted file mode 100644
index 28827e7..0000000
--- a/src/VBox/Debugger/VBoxDbg.rc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id: VBoxDbg.rc $ */
-/** @file
- * VBoxDbg - Resource file containing version info.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      VFT2_UNKNOWN
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904b0" // Lang=US English, CharSet=Unicode
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox Debugger\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     "VBoxDbg\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", "VBoxDbg.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1200
-  END
-END
diff --git a/src/VBox/Debugger/VBoxDbgConsole.cpp b/src/VBox/Debugger/VBoxDbgConsole.cpp
index 80b5a6d..9df624e 100644
--- a/src/VBox/Debugger/VBoxDbgConsole.cpp
+++ b/src/VBox/Debugger/VBoxDbgConsole.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Debugger/VBoxDbgConsole.h b/src/VBox/Debugger/VBoxDbgConsole.h
index f659721..97826c8 100644
--- a/src/VBox/Debugger/VBoxDbgConsole.h
+++ b/src/VBox/Debugger/VBoxDbgConsole.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Debugger/VBoxDbgStatsQt4.cpp b/src/VBox/Debugger/VBoxDbgStatsQt4.cpp
index 6637c4b..a13733b 100644
--- a/src/VBox/Debugger/VBoxDbgStatsQt4.cpp
+++ b/src/VBox/Debugger/VBoxDbgStatsQt4.cpp
@@ -2166,11 +2166,13 @@ VBoxDbgStatsModel::strValueTimes(PCDBGGUISTATSNODE pNode)
         case STAMTYPE_RATIO_U32:
         case STAMTYPE_RATIO_U32_RESET:
         {
-            formatNumber(sz, pNode->Data.RatioU32.u32A);
-            char *psz = strchr(sz, '\0');
-            *psz++ = ':';
-            formatNumber(psz, pNode->Data.RatioU32.u32B);
-            return psz;
+            char szTmp[64];
+            char *psz  = formatNumber(szTmp, pNode->Data.RatioU32.u32A);
+            size_t off = strlen(psz);
+            memcpy(sz, psz, off);
+            sz[off++] = ':';
+            strcpy(&sz[off], formatNumber(szTmp, pNode->Data.RatioU32.u32B));
+            return sz;
         }
 
         case STAMTYPE_CALLBACK:
@@ -3031,7 +3033,14 @@ VBoxDbgStatsView::actAdjColumns()
 VBoxDbgStats::VBoxDbgStats(VBoxDbgGui *a_pDbgGui, const char *pszPat/* = NULL*/, unsigned uRefreshRate/* = 0*/, QWidget *pParent/* = NULL*/)
     : VBoxDbgBaseWindow(a_pDbgGui, pParent), m_PatStr(pszPat), m_pPatCB(NULL), m_uRefreshRate(0), m_pTimer(NULL), m_pView(NULL)
 {
-    setWindowTitle("VBoxDbg - Statistics");
+    /* Assign window-title: */
+    if (parent())
+    {
+        setWindowTitle(QString("%1 - Statistics").arg(parentWidget()->windowTitle()));
+        parent()->installEventFilter(this);
+    }
+    else
+        setWindowTitle("VBoxDbg - Statistics");
 
     /*
      * On top, a horizontal box with the pattern field, buttons and refresh interval.
@@ -3143,6 +3152,24 @@ VBoxDbgStats::closeEvent(QCloseEvent *a_pCloseEvt)
 }
 
 
+bool VBoxDbgStats::eventFilter(QObject *pWatched, QEvent *pEvent)
+{
+    /* Skip events which are not related to our parent: */
+    if (pWatched != parent())
+        return VBoxDbgBaseWindow::eventFilter(pWatched, pEvent);
+
+    /* Depending on event-type: */
+    switch (pEvent->type())
+    {
+        case QEvent::WindowTitleChange: setWindowTitle(QString("%1 - Statistics").arg(parentWidget()->windowTitle())); break;
+        default: break;
+    }
+
+    /* Call to base-class: */
+    return VBoxDbgBaseWindow::eventFilter(pWatched, pEvent);
+}
+
+
 void
 VBoxDbgStats::apply(const QString &Str)
 {
diff --git a/src/VBox/Debugger/VBoxDbgStatsQt4.h b/src/VBox/Debugger/VBoxDbgStatsQt4.h
index 2b8a2fc..822c2fe 100644
--- a/src/VBox/Debugger/VBoxDbgStatsQt4.h
+++ b/src/VBox/Debugger/VBoxDbgStatsQt4.h
@@ -200,6 +200,14 @@ protected:
      */
     virtual void closeEvent(QCloseEvent *a_pCloseEvt);
 
+    /**
+     * Event filter for various purposes.
+     *
+     * @param  pWatched         The object event came to.
+     * @param  pEvent           The event being handled.
+     */
+    virtual bool eventFilter(QObject *pWatched, QEvent *pEvent);
+
 protected slots:
     /** Apply the activated combobox pattern. */
     void apply(const QString &Str);
diff --git a/src/VBox/Debugger/testcase/tstDBGCStubs.cpp b/src/VBox/Debugger/testcase/tstDBGCStubs.cpp
index 395f5d8..9b46b68 100644
--- a/src/VBox/Debugger/testcase/tstDBGCStubs.cpp
+++ b/src/VBox/Debugger/testcase/tstDBGCStubs.cpp
@@ -293,6 +293,10 @@ VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, size_t cchN
 {
     return VERR_INTERNAL_ERROR;
 }
+VMMR3DECL(void *) DBGFR3OSQueryInterface(PUVM pUVM, DBGFOSINTERFACE enmIf)
+{
+    return NULL;
+}
 
 VMMR3DECL(int) DBGFR3SelQueryInfo(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo)
 {
@@ -317,6 +321,18 @@ VMMR3DECL(int) DBGFR3CoreWrite(PUVM pUVM, const char *pszFilename, bool fReplace
     return VERR_INTERNAL_ERROR;
 }
 
+VMMR3DECL(int)  DBGFR3PlugInLoad(PUVM pUVM, const char *pszPlugIn, char *pszActual, size_t cbActual, PRTERRINFO pErrInfo)
+{
+    return VERR_INTERNAL_ERROR;
+}
+VMMR3DECL(int)  DBGFR3PlugInUnload(PUVM pUVM, const char *pszName)
+{
+    return VERR_INTERNAL_ERROR;
+}
+VMMR3DECL(void) DBGFR3PlugInLoadAll(PUVM pUVM)
+{
+}
+
 
 //////////////////////////////////////////////////////////////////////////
 // The rest should eventually be replaced by DBGF calls and eliminated. //
diff --git a/src/VBox/Devices/Audio/AudioMixBuffer.cpp b/src/VBox/Devices/Audio/AudioMixBuffer.cpp
new file mode 100644
index 0000000..958e851
--- /dev/null
+++ b/src/VBox/Devices/Audio/AudioMixBuffer.cpp
@@ -0,0 +1,1486 @@
+/* $Id: AudioMixBuffer.cpp $ */
+/** @file
+ * VBox audio: Audio mixing buffer for converting reading/writing audio
+ *             samples.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*
+ * DEBUG_DUMP_PCM_DATA enables dumping the raw PCM data
+ * to a file on the host. Be sure to adjust the dumping path
+ * to your needs before using this!
+ */
+#ifdef DEBUG
+//# define DEBUG_DUMP_PCM_DATA
+#endif
+
+#include <iprt/asm-math.h>
+#include <iprt/assert.h>
+#ifdef DEBUG_DUMP_PCM_DATA
+# include <iprt/file.h>
+#endif
+#include <iprt/mem.h>
+#include <iprt/string.h> /* For RT_BZERO. */
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+#ifdef TESTCASE
+# define LOG_ENABLED
+# include <iprt/stream.h>
+#endif
+#include <VBox/err.h>
+
+#include "AudioMixBuffer.h"
+
+#if 0
+# define AUDMIXBUF_LOG(x) LogFlowFunc(x)
+#else
+# if defined(TESTCASE)
+#  define AUDMIXBUF_LOG(x) LogFunc(x)
+# else
+#  define AUDMIXBUF_LOG(x) do {} while (0)
+# endif
+#endif
+
+
+/*
+ *   Soft Volume Control
+ *
+ * The external code supplies an 8-bit volume (attenuation) value in the
+ * 0 .. 255 range. This represents 0 to -96dB attenuation where an input
+ * value of 0 corresponds to -96dB and 255 corresponds to 0dB (unchanged).
+ *
+ * Each step thus correspons to 96 / 256 or 0.375dB. Every 6dB (16 steps)
+ * represents doubling the sample value.
+ *
+ * For internal use, the volume control needs to be converted to a 16-bit
+ * (sort of) exponential value between 1 and 65536. This is used with fixed
+ * point arithmetic such that 65536 means 1.0 and 1 means 1/65536.
+ *
+ * For actual volume calculation, 33.31 fixed point is used. Maximum (or
+ * unattenuated) volume is represented as 0x40000000; conveniently, this
+ * value fits into a uint32_t.
+ *
+ * To enable fast processing, the maximum volume must be a power of two
+ * and must not have a sign when converted to int32_t. While 0x80000000
+ * violates these constraints, 0x40000000 does not.
+ */
+
+
+/**   Logarithmic/exponential volume conversion table. */
+uint32_t aVolumeConv[256] = {
+        1,     1,     1,     1,     1,     1,     1,     1, /*   7 */
+        1,     2,     2,     2,     2,     2,     2,     2, /*  15 */
+        2,     2,     2,     2,     2,     3,     3,     3, /*  23 */
+        3,     3,     3,     3,     4,     4,     4,     4, /*  31 */
+        4,     4,     5,     5,     5,     5,     5,     6, /*  39 */
+        6,     6,     6,     7,     7,     7,     8,     8, /*  47 */
+        8,     9,     9,    10,    10,    10,    11,    11, /*  55 */
+       12,    12,    13,    13,    14,    15,    15,    16, /*  63 */
+       17,    17,    18,    19,    20,    21,    22,    23, /*  71 */
+       24,    25,    26,    27,    28,    29,    31,    32, /*  79 */
+       33,    35,    36,    38,    40,    41,    43,    45, /*  87 */
+       47,    49,    52,    54,    56,    59,    61,    64, /*  95 */
+       67,    70,    73,    76,    79,    83,    87,    91, /* 103 */
+       95,    99,   103,   108,   112,   117,   123,   128, /* 111 */
+      134,   140,   146,   152,   159,   166,   173,   181, /* 119 */
+      189,   197,   206,   215,   225,   235,   245,   256, /* 127 */
+      267,   279,   292,   304,   318,   332,   347,   362, /* 135 */
+      378,   395,   412,   431,   450,   470,   490,   512, /* 143 */
+      535,   558,   583,   609,   636,   664,   693,   724, /* 151 */
+      756,   790,   825,   861,   899,   939,   981,  1024, /* 159 */
+     1069,  1117,  1166,  1218,  1272,  1328,  1387,  1448, /* 167 */
+     1512,  1579,  1649,  1722,  1798,  1878,  1961,  2048, /* 175 */
+     2139,  2233,  2332,  2435,  2543,  2656,  2774,  2896, /* 183 */
+     3025,  3158,  3298,  3444,  3597,  3756,  3922,  4096, /* 191 */
+     4277,  4467,  4664,  4871,  5087,  5312,  5547,  5793, /* 199 */
+     6049,  6317,  6597,  6889,  7194,  7512,  7845,  8192, /* 207 */
+     8555,  8933,  9329,  9742, 10173, 10624, 11094, 11585, /* 215 */
+    12098, 12634, 13193, 13777, 14387, 15024, 15689, 16384, /* 223 */
+    17109, 17867, 18658, 19484, 20347, 21247, 22188, 23170, /* 231 */
+    24196, 25268, 26386, 27554, 28774, 30048, 31379, 32768, /* 239 */
+    34219, 35734, 37316, 38968, 40693, 42495, 44376, 46341, /* 247 */
+    48393, 50535, 52773, 55109, 57549, 60097, 62757, 65536, /* 255 */
+};
+
+/* Bit shift for fixed point conversion. */
+#define VOL_SHIFT       30
+
+/* Internal representation of 0dB volume (1.0 in fixed point). */
+#define VOL_0DB         (1 << VOL_SHIFT)
+
+AssertCompile(VOL_0DB <= 0x40000000);   /* Must always hold. */
+AssertCompile(VOL_0DB == 0x40000000);   /* For now -- when only attenuation is used. */
+
+/**
+ * Structure for holding sample conversion parameters for
+ * the audioMixBufConvFromXXX / audioMixBufConvToXXX macros.
+ */
+typedef struct AUDMIXBUF_CONVOPTS
+{
+    /** Number of audio samples to convert. */
+    uint32_t       cSamples;
+    /** Volume to apply during conversion. Pass 0
+     *  to convert the original values. May not apply to
+     *  all conversion functions. */
+    PDMAUDIOVOLUME Volume;
+} AUDMIXBUF_CONVOPTS, *PAUDMIXBUF_CONVOPTS;
+
+/*
+ * When running the audio testcases we want to verfiy
+ * the macro-generated routines separately, so unmark them as being
+ * inlined + static.
+ */
+#ifdef TESTCASE
+# define AUDMIXBUF_MACRO_FN
+#else
+# define AUDMIXBUF_MACRO_FN static inline
+#endif
+
+#ifdef DEBUG
+static uint64_t s_cSamplesMixedTotal = 0;
+#endif
+
+static void audioMixBufFreeBuf(PPDMAUDIOMIXBUF pMixBuf);
+static inline void audioMixBufPrint(PPDMAUDIOMIXBUF pMixBuf);
+
+typedef uint32_t (AUDMIXBUF_FN_CONVFROM) (PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, const PAUDMIXBUF_CONVOPTS pOpts);
+typedef AUDMIXBUF_FN_CONVFROM *PAUDMIXBUF_FN_CONVFROM;
+
+typedef void (AUDMIXBUF_FN_CONVTO) (void *pvDst, const PPDMAUDIOSAMPLE paSrc, const PAUDMIXBUF_CONVOPTS pOpts);
+typedef AUDMIXBUF_FN_CONVTO *PAUDMIXBUF_FN_CONVTO;
+
+/* Can return VINF_TRY_AGAIN for getting next pointer at beginning (circular) */
+int audioMixBufAcquire(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamplesToRead,
+                       PPDMAUDIOSAMPLE *ppvSamples, uint32_t *pcSamplesRead)
+{
+    AssertPtrReturn(pMixBuf, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppvSamples, VERR_INVALID_POINTER);
+    AssertPtrReturn(pcSamplesRead, VERR_INVALID_POINTER);
+
+    int rc;
+
+    if (!cSamplesToRead)
+    {
+        *pcSamplesRead = 0;
+        return VINF_SUCCESS;
+    }
+
+    uint32_t cSamplesRead;
+    if (pMixBuf->offReadWrite + cSamplesToRead > pMixBuf->cSamples)
+    {
+        cSamplesRead = pMixBuf->cSamples - pMixBuf->offReadWrite;
+        rc = VINF_TRY_AGAIN;
+    }
+    else
+    {
+        cSamplesRead = cSamplesToRead;
+        rc = VINF_SUCCESS;
+    }
+
+    *ppvSamples = &pMixBuf->pSamples[pMixBuf->offReadWrite];
+    AssertPtr(ppvSamples);
+
+    pMixBuf->offReadWrite = (pMixBuf->offReadWrite + cSamplesRead) % pMixBuf->cSamples;
+    Assert(pMixBuf->offReadWrite <= pMixBuf->cSamples);
+    pMixBuf->cProcessed -= RT_MIN(cSamplesRead, pMixBuf->cProcessed);
+
+    *pcSamplesRead = cSamplesRead;
+
+    return rc;
+}
+
+/**
+ * Clears (zeroes) the buffer by a certain amount of (processed) samples and
+ * keeps track to eventually assigned children buffers.
+ *
+ * @param   pMixBuf
+ * @param   cSamplesToClear
+ */
+void audioMixBufFinish(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamplesToClear)
+{
+    AUDMIXBUF_LOG(("cSamples=%RU32\n", cSamplesToClear));
+    AUDMIXBUF_LOG(("%s: offReadWrite=%RU32, cProcessed=%RU32\n",
+                   pMixBuf->pszName, pMixBuf->offReadWrite, pMixBuf->cProcessed));
+
+    PPDMAUDIOMIXBUF pIter;
+    RTListForEach(&pMixBuf->lstBuffers, pIter, PDMAUDIOMIXBUF, Node)
+    {
+        AUDMIXBUF_LOG(("\t%s: cMixed=%RU32 -> %RU32\n",
+                       pIter->pszName, pIter->cMixed, pIter->cMixed - cSamplesToClear));
+
+        pIter->cMixed -= RT_MIN(pIter->cMixed, cSamplesToClear);
+        pIter->offReadWrite = 0;
+    }
+
+    uint32_t cLeft = RT_MIN(cSamplesToClear, pMixBuf->cSamples);
+    uint32_t offClear;
+
+    if (cLeft > pMixBuf->offReadWrite) /* Zero end of buffer first (wrap-around). */
+    {
+        AUDMIXBUF_LOG(("Clearing1: %RU32 - %RU32\n",
+                       (pMixBuf->cSamples - (cLeft - pMixBuf->offReadWrite)),
+                        pMixBuf->cSamples));
+
+        RT_BZERO(pMixBuf->pSamples + (pMixBuf->cSamples - (cLeft - pMixBuf->offReadWrite)),
+                 (cLeft - pMixBuf->offReadWrite) * sizeof(PDMAUDIOSAMPLE));
+
+        cLeft -= cLeft - pMixBuf->offReadWrite;
+        offClear = 0;
+    }
+    else
+        offClear = pMixBuf->offReadWrite - cLeft;
+
+    if (cLeft)
+    {
+        AUDMIXBUF_LOG(("Clearing2: %RU32 - %RU32\n",
+                       offClear, offClear + cLeft));
+        RT_BZERO(pMixBuf->pSamples + offClear, cLeft * sizeof(PDMAUDIOSAMPLE));
+    }
+}
+
+void audioMixBufDestroy(PPDMAUDIOMIXBUF pMixBuf)
+{
+    if (!pMixBuf)
+        return;
+
+    audioMixBufUnlink(pMixBuf);
+
+    if (pMixBuf->pszName)
+    {
+        AUDMIXBUF_LOG(("%s\n", pMixBuf->pszName));
+
+        RTStrFree(pMixBuf->pszName);
+        pMixBuf->pszName = NULL;
+    }
+
+    if (pMixBuf->pRate)
+    {
+        RTMemFree(pMixBuf->pRate);
+        pMixBuf->pRate = NULL;
+    }
+
+    audioMixBufFreeBuf(pMixBuf);
+}
+
+/** @todo Rename this function! Too confusing in combination with audioMixBufFreeBuf(). */
+uint32_t audioMixBufFree(PPDMAUDIOMIXBUF pMixBuf)
+{
+    AssertPtrReturn(pMixBuf, 0);
+
+    uint32_t cFree;
+    if (pMixBuf->pParent)
+    {
+        /*
+         * As a linked child buffer we want to know how many samples
+         * already have been consumed by the parent.
+         */
+        Assert(pMixBuf->cMixed <= pMixBuf->pParent->cSamples);
+        cFree = pMixBuf->pParent->cSamples - pMixBuf->cMixed;
+    }
+    else
+        cFree = pMixBuf->cSamples - pMixBuf->cProcessed;
+
+    AUDMIXBUF_LOG(("%s: cFree=%RU32\n", pMixBuf->pszName, cFree));
+    return cFree;
+}
+
+uint32_t audioMixBufFreeBytes(PPDMAUDIOMIXBUF pMixBuf)
+{
+    return AUDIOMIXBUF_S2B(pMixBuf, audioMixBufFree(pMixBuf));
+}
+
+static int audioMixBufAllocBuf(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamples)
+{
+    AssertPtrReturn(pMixBuf, VERR_INVALID_POINTER);
+    AssertReturn(cSamples, VERR_INVALID_PARAMETER);
+
+    AUDMIXBUF_LOG(("%s: cSamples=%RU32\n", pMixBuf->pszName, cSamples));
+
+    size_t cbSamples = cSamples * sizeof(PDMAUDIOSAMPLE);
+    if (!cbSamples)
+        return VERR_INVALID_PARAMETER;
+
+    pMixBuf->pSamples = (PPDMAUDIOSAMPLE)RTMemAllocZ(cbSamples);
+    if (!pMixBuf->pSamples)
+        return VERR_NO_MEMORY;
+
+    pMixBuf->cSamples = cSamples;
+
+    return VINF_SUCCESS;
+}
+
+/** Note: Enabling this will generate huge logs! */
+//#define DEBUG_MACROS
+
+#ifdef DEBUG_MACROS
+# define AUDMIXBUF_MACRO_LOG(x) AUDMIXBUF_LOG(x)
+#elif defined(TESTCASE)
+# define AUDMIXBUF_MACRO_LOG(x) RTPrintf x
+#else
+# define AUDMIXBUF_MACRO_LOG(x) do {} while (0)
+#endif
+
+/**
+ * Macro for generating the conversion routines from/to different formats.
+ * Be careful what to pass in/out, as most of the macros are optimized for speed and
+ * thus don't do any bounds checking!
+ *
+ * Note: Currently does not handle any endianness conversion yet!
+ */
+#define AUDMIXBUF_CONVERT(_aName, _aType, _aMin, _aMax, _aSigned, _aShift) \
+    /* Clips a specific output value to a single sample value. */ \
+    AUDMIXBUF_MACRO_FN int64_t audioMixBufClipFrom##_aName(_aType aVal) \
+    { \
+        if (_aSigned) \
+            return ((int64_t) aVal) << (32 - _aShift); \
+        return ((int64_t) aVal - ((_aMax >> 1) + 1)) << (32 - _aShift); \
+    } \
+    \
+    /* Clips a single sample value to a specific output value. */ \
+    AUDMIXBUF_MACRO_FN _aType audioMixBufClipTo##_aName(int64_t iVal) \
+    { \
+        if (iVal >= 0x7fffffff) \
+            return _aMax; \
+        else if (iVal < -INT64_C(0x80000000)) \
+            return _aMin; \
+        \
+        if (_aSigned) \
+            return (_aType) (iVal >> (32 - _aShift)); \
+        return ((_aType) ((iVal >> (32 - _aShift)) + ((_aMax >> 1) + 1))); \
+    } \
+    \
+    AUDMIXBUF_MACRO_FN uint32_t audioMixBufConvFrom##_aName##Stereo(PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, \
+                                                                    const PAUDMIXBUF_CONVOPTS pOpts) \
+    { \
+        _aType *pSrc = (_aType *)pvSrc; \
+        uint32_t cSamples = (uint32_t)RT_MIN(pOpts->cSamples, cbSrc / sizeof(_aType)); \
+        AUDMIXBUF_MACRO_LOG(("cSamples=%RU32, sizeof(%zu), lVol=%RU32, rVol=%RU32\n", \
+                             pOpts->cSamples, sizeof(_aType), pOpts->Volume.uLeft, pOpts->Volume.uRight)); \
+        for (uint32_t i = 0; i < cSamples; i++) \
+        { \
+            AUDMIXBUF_MACRO_LOG(("%p: l=%RI16, r=%RI16\n", paDst, *pSrc, *(pSrc + 1))); \
+            paDst->i64LSample = ASMMult2xS32RetS64((int32_t)audioMixBufClipFrom##_aName(*pSrc++), pOpts->Volume.uLeft ) >> VOL_SHIFT; \
+            paDst->i64RSample = ASMMult2xS32RetS64((int32_t)audioMixBufClipFrom##_aName(*pSrc++), pOpts->Volume.uRight) >> VOL_SHIFT; \
+            AUDMIXBUF_MACRO_LOG(("\t-> l=%RI64, r=%RI64\n", paDst->i64LSample, paDst->i64RSample)); \
+            paDst++; \
+        } \
+        \
+        return cSamples; \
+    } \
+    \
+    AUDMIXBUF_MACRO_FN uint32_t audioMixBufConvFrom##_aName##Mono(PPDMAUDIOSAMPLE paDst, const void *pvSrc, uint32_t cbSrc, \
+                                                                  const PAUDMIXBUF_CONVOPTS pOpts) \
+    { \
+        _aType *pSrc = (_aType *)pvSrc; \
+        uint32_t cSamples = (uint32_t)RT_MIN(pOpts->cSamples, cbSrc / sizeof(_aType)); \
+        AUDMIXBUF_MACRO_LOG(("cSamples=%RU32, sizeof(%zu), lVol=%RU32, rVol=%RU32\n", \
+                             cSamples, sizeof(_aType), pOpts->Volume.uLeft, pOpts->Volume.uRight)); \
+        for (uint32_t i = 0; i < cSamples; i++) \
+        { \
+            AUDMIXBUF_MACRO_LOG(("%p: s=%RI16\n", paDst, *pSrc)); \
+            paDst->i64LSample = ASMMult2xS32RetS64((int32_t)audioMixBufClipFrom##_aName(*pSrc), pOpts->Volume.uLeft) >> VOL_SHIFT; \
+            paDst->i64RSample = ASMMult2xS32RetS64((int32_t)audioMixBufClipFrom##_aName(*pSrc), pOpts->Volume.uRight) >> VOL_SHIFT; \
+            ++pSrc; \
+            AUDMIXBUF_MACRO_LOG(("\t-> l=%RI64, r=%RI64\n", paDst->i64LSample, paDst->i64RSample)); \
+            paDst++; \
+        } \
+        \
+        return cSamples; \
+    } \
+    \
+    AUDMIXBUF_MACRO_FN void audioMixBufConvTo##_aName##Stereo(void *pvDst, const PPDMAUDIOSAMPLE paSrc, \
+                                                              const PAUDMIXBUF_CONVOPTS pOpts) \
+    { \
+        PPDMAUDIOSAMPLE pSrc = paSrc; \
+        _aType *pDst = (_aType *)pvDst; \
+        _aType l, r; \
+        uint32_t cSamples = pOpts->cSamples; \
+        while (cSamples--) \
+        { \
+            AUDMIXBUF_MACRO_LOG(("%p: l=%RI64, r=%RI64\n", pSrc, pSrc->i64LSample, pSrc->i64RSample)); \
+            l = audioMixBufClipTo##_aName(pSrc->i64LSample); \
+            r = audioMixBufClipTo##_aName(pSrc->i64RSample); \
+            AUDMIXBUF_MACRO_LOG(("\t-> l=%RI16, r=%RI16\n", l, r)); \
+            *pDst++ = l; \
+            *pDst++ = r; \
+            pSrc++; \
+        } \
+    } \
+    \
+    AUDMIXBUF_MACRO_FN void audioMixBufConvTo##_aName##Mono(void *pvDst, const PPDMAUDIOSAMPLE paSrc, \
+                                                            const PAUDMIXBUF_CONVOPTS pOpts) \
+    { \
+        PPDMAUDIOSAMPLE pSrc = paSrc; \
+        _aType *pDst = (_aType *)pvDst; \
+        uint32_t cSamples = pOpts->cSamples; \
+        while (cSamples--) \
+        { \
+            *pDst++ = audioMixBufClipTo##_aName((pSrc->i64LSample + pSrc->i64RSample) / 2); \
+            pSrc++; \
+        } \
+    }
+
+/* audioMixBufConvXXXS8: 8 bit, signed. */
+AUDMIXBUF_CONVERT(S8 /* Name */,  int8_t,   INT8_MIN  /* Min */, INT8_MAX   /* Max */, true  /* fSigned */, 8  /* cShift */)
+/* audioMixBufConvXXXU8: 8 bit, unsigned. */
+AUDMIXBUF_CONVERT(U8 /* Name */,  uint8_t,  0         /* Min */, UINT8_MAX  /* Max */, false /* fSigned */, 8  /* cShift */)
+/* audioMixBufConvXXXS16: 16 bit, signed. */
+AUDMIXBUF_CONVERT(S16 /* Name */, int16_t,  INT16_MIN /* Min */, INT16_MAX  /* Max */, true  /* fSigned */, 16 /* cShift */)
+/* audioMixBufConvXXXU16: 16 bit, unsigned. */
+AUDMIXBUF_CONVERT(U16 /* Name */, uint16_t, 0         /* Min */, UINT16_MAX /* Max */, false /* fSigned */, 16 /* cShift */)
+/* audioMixBufConvXXXS32: 32 bit, signed. */
+AUDMIXBUF_CONVERT(S32 /* Name */, int32_t,  INT32_MIN /* Min */, INT32_MAX  /* Max */, true  /* fSigned */, 32 /* cShift */)
+/* audioMixBufConvXXXU32: 32 bit, unsigned. */
+AUDMIXBUF_CONVERT(U32 /* Name */, uint32_t, 0         /* Min */, UINT32_MAX /* Max */, false /* fSigned */, 32 /* cShift */)
+
+#undef AUDMIXBUF_CONVERT
+
+#define AUDMIXBUF_MIXOP(_aName, _aOp) \
+    AUDMIXBUF_MACRO_FN void audioMixBufOp##_aName(PPDMAUDIOSAMPLE paDst, uint32_t cDstSamples, \
+                                                  PPDMAUDIOSAMPLE paSrc, uint32_t cSrcSamples, \
+                                                  PPDMAUDIOSTRMRATE pRate, \
+                                                  uint32_t *pcDstWritten, uint32_t *pcSrcRead) \
+    { \
+        AUDMIXBUF_MACRO_LOG(("cSrcSamples=%RU32, cDstSamples=%RU32\n", cSrcSamples, cDstSamples)); \
+        AUDMIXBUF_MACRO_LOG(("pRate=%p: srcOffset=0x%RX32 (%RU32), dstOffset=0x%RX32 (%RU32), dstInc=0x%RX64 (%RU64)\n", \
+                             pRate, pRate->srcOffset, pRate->srcOffset, \
+                             (uint32_t)(pRate->dstOffset >> 32), (uint32_t)(pRate->dstOffset >> 32), \
+                             pRate->dstInc, pRate->dstInc)); \
+        \
+        if (pRate->dstInc == (UINT64_C(1) + UINT32_MAX)) /* No conversion needed? */ \
+        { \
+            uint32_t cSamples = RT_MIN(cSrcSamples, cDstSamples); \
+            AUDMIXBUF_MACRO_LOG(("cSamples=%RU32\n", cSamples)); \
+            for (uint32_t i = 0; i < cSamples; i++) \
+            { \
+                paDst[i].i64LSample _aOp paSrc[i].i64LSample; \
+                paDst[i].i64RSample _aOp paSrc[i].i64RSample; \
+            } \
+            \
+            if (pcDstWritten) \
+                *pcDstWritten = cSamples; \
+            if (pcSrcRead) \
+                *pcSrcRead = cSamples; \
+            return; \
+        } \
+        \
+        PPDMAUDIOSAMPLE paSrcStart = paSrc; \
+        PPDMAUDIOSAMPLE paSrcEnd   = paSrc + cSrcSamples; \
+        PPDMAUDIOSAMPLE paDstStart = paDst; \
+        PPDMAUDIOSAMPLE paDstEnd   = paDst + cDstSamples; \
+        PDMAUDIOSAMPLE  samCur = { 0 }; \
+        PDMAUDIOSAMPLE  samOut; \
+        PDMAUDIOSAMPLE  samLast    = pRate->srcSampleLast; \
+        uint64_t        lDelta = 0; \
+        \
+        AUDMIXBUF_MACRO_LOG(("Start: paDstEnd=%p - paDstStart=%p -> %zu\n", paDstEnd, paDst, paDstEnd - paDstStart)); \
+        AUDMIXBUF_MACRO_LOG(("Start: paSrcEnd=%p - paSrcStart=%p -> %zu\n", paSrcEnd, paSrc, paSrcEnd - paSrcStart)); \
+        \
+        while (paDst < paDstEnd) \
+        { \
+            Assert(paSrc <= paSrcEnd); \
+            Assert(paDst <= paDstEnd); \
+            if (paSrc == paSrcEnd) \
+                break; \
+            \
+            lDelta = 0; \
+            while (pRate->srcOffset <= (pRate->dstOffset >> 32)) \
+            { \
+                Assert(paSrc <= paSrcEnd); \
+                samLast = *paSrc++; \
+                pRate->srcOffset++; \
+                lDelta++; \
+                if (paSrc == paSrcEnd) \
+                    break; \
+            } \
+            \
+            Assert(paSrc <= paSrcEnd); \
+            if (paSrc == paSrcEnd) \
+                break; \
+            \
+            samCur = *paSrc; \
+            \
+            /* Interpolate. */ \
+            int64_t iDstOffInt = pRate->dstOffset & UINT32_MAX; \
+            \
+            samOut.i64LSample = (samLast.i64LSample * ((int64_t) (INT64_C(1) << 32) - iDstOffInt) + samCur.i64LSample * iDstOffInt) >> 32; \
+            samOut.i64RSample = (samLast.i64RSample * ((int64_t) (INT64_C(1) << 32) - iDstOffInt) + samCur.i64RSample * iDstOffInt) >> 32; \
+            \
+            paDst->i64LSample _aOp samOut.i64LSample; \
+            paDst->i64RSample _aOp samOut.i64RSample; \
+            \
+            AUDMIXBUF_MACRO_LOG(("\tlDelta=0x%RX64 (%RU64), iDstOffInt=0x%RX64 (%RI64), l=%RI64, r=%RI64 (cur l=%RI64, r=%RI64)\n", \
+                                 lDelta, lDelta, iDstOffInt, iDstOffInt, \
+                                 paDst->i64LSample, paDst->i64RSample, \
+                                 samCur.i64LSample, samCur.i64RSample)); \
+            \
+            paDst++; \
+            pRate->dstOffset += pRate->dstInc; \
+            \
+            AUDMIXBUF_MACRO_LOG(("\t\tpRate->dstOffset=0x%RX32 (%RU32)\n", pRate->dstOffset, pRate->dstOffset >> 32)); \
+            \
+        } \
+        \
+        AUDMIXBUF_MACRO_LOG(("End: paDst=%p - paDstStart=%p -> %zu\n", paDst, paDstStart, paDst - paDstStart)); \
+        AUDMIXBUF_MACRO_LOG(("End: paSrc=%p - paSrcStart=%p -> %zu\n", paSrc, paSrcStart, paSrc - paSrcStart)); \
+        \
+        pRate->srcSampleLast = samLast; \
+        \
+        AUDMIXBUF_MACRO_LOG(("pRate->srcSampleLast l=%RI64, r=%RI64, lDelta=0x%RX64 (%RU64)\n", \
+                              pRate->srcSampleLast.i64LSample, pRate->srcSampleLast.i64RSample, lDelta, lDelta)); \
+        \
+        if (pcDstWritten) \
+            *pcDstWritten = paDst - paDstStart; \
+        if (pcSrcRead) \
+            *pcSrcRead = paSrc - paSrcStart; \
+    }
+
+/* audioMixBufOpAssign: Assigns values from source buffer to destination bufffer, overwriting the destination. */
+AUDMIXBUF_MIXOP(Assign /* Name */,  = /* Operation */)
+/* audioMixBufOpBlend: Blends together the values from both, the source and the destination buffer. */
+AUDMIXBUF_MIXOP(Blend  /* Name */, += /* Operation */)
+
+#undef AUDMIXBUF_MIXOP
+#undef AUDMIXBUF_MACRO_LOG
+
+/** Dummy conversion used when the source is muted. */
+AUDMIXBUF_MACRO_FN uint32_t audioMixBufConvFromSilence(PPDMAUDIOSAMPLE paDst, const void *pvSrc,
+                                                       uint32_t cbSrc, const PAUDMIXBUF_CONVOPTS pOpts)
+{
+    /* Internally zero always corresponds to silence. */
+    memset(paDst, 0, pOpts->cSamples * sizeof(paDst[0]));
+    return pOpts->cSamples;
+}
+
+/**
+ *
+ ** @todo Speed up the lookup by binding it to the actual stream state.
+ *
+ * @return  PAUDMIXBUF_FN_CONVFROM
+ * @param   enmFmt      The source audio stream format
+ * @param   fMuted      Flag determining whether the source is muted
+ */
+static inline PAUDMIXBUF_FN_CONVFROM audioMixBufConvFromLookup(PDMAUDIOMIXBUFFMT enmFmt, bool fMuted)
+{
+    if (fMuted)
+        return audioMixBufConvFromSilence;
+
+    if (AUDMIXBUF_FMT_SIGNED(enmFmt))
+    {
+        if (AUDMIXBUF_FMT_CHANNELS(enmFmt) == 2)
+        {
+            switch (AUDMIXBUF_FMT_BITS_PER_SAMPLE(enmFmt))
+            {
+                case 8:  return audioMixBufConvFromS8Stereo;
+                case 16: return audioMixBufConvFromS16Stereo;
+                case 32: return audioMixBufConvFromS32Stereo;
+                default: return NULL;
+            }
+        }
+        else if (AUDMIXBUF_FMT_CHANNELS(enmFmt) == 1)
+        {
+            switch (AUDMIXBUF_FMT_BITS_PER_SAMPLE(enmFmt))
+            {
+                case 8:  return audioMixBufConvFromS8Mono;
+                case 16: return audioMixBufConvFromS16Mono;
+                case 32: return audioMixBufConvFromS32Mono;
+                default: return NULL;
+            }
+        }
+    }
+    else /* Unsigned */
+    {
+        if (AUDMIXBUF_FMT_CHANNELS(enmFmt) == 2)
+        {
+            switch (AUDMIXBUF_FMT_BITS_PER_SAMPLE(enmFmt))
+            {
+                case 8:  return audioMixBufConvFromU8Stereo;
+                case 16: return audioMixBufConvFromU16Stereo;
+                case 32: return audioMixBufConvFromU32Stereo;
+                default: return NULL;
+            }
+        }
+        else if (AUDMIXBUF_FMT_CHANNELS(enmFmt) == 1)
+        {
+            switch (AUDMIXBUF_FMT_BITS_PER_SAMPLE(enmFmt))
+            {
+                case 8:  return audioMixBufConvFromU8Mono;
+                case 16: return audioMixBufConvFromU16Mono;
+                case 32: return audioMixBufConvFromU32Mono;
+                default: return NULL;
+            }
+        }
+    }
+
+    return NULL;
+}
+
+/**
+ *
+ ** @todo Speed up the lookup by binding it to the actual stream state.
+ *
+ * @return  PAUDMIXBUF_FN_CONVTO
+ * @param   enmFmt
+ */
+static inline PAUDMIXBUF_FN_CONVTO audioMixBufConvToLookup(PDMAUDIOMIXBUFFMT enmFmt)
+{
+    if (AUDMIXBUF_FMT_SIGNED(enmFmt))
+    {
+        if (AUDMIXBUF_FMT_CHANNELS(enmFmt) == 2)
+        {
+            switch (AUDMIXBUF_FMT_BITS_PER_SAMPLE(enmFmt))
+            {
+                case 8:  return audioMixBufConvToS8Stereo;
+                case 16: return audioMixBufConvToS16Stereo;
+                case 32: return audioMixBufConvToS32Stereo;
+                default: return NULL;
+            }
+        }
+        else if (AUDMIXBUF_FMT_CHANNELS(enmFmt) == 1)
+        {
+            switch (AUDMIXBUF_FMT_BITS_PER_SAMPLE(enmFmt))
+            {
+                case 8:  return audioMixBufConvToS8Mono;
+                case 16: return audioMixBufConvToS16Mono;
+                case 32: return audioMixBufConvToS32Mono;
+                default: return NULL;
+            }
+        }
+    }
+    else /* Unsigned */
+    {
+        if (AUDMIXBUF_FMT_CHANNELS(enmFmt) == 2)
+        {
+            switch (AUDMIXBUF_FMT_BITS_PER_SAMPLE(enmFmt))
+            {
+                case 8:  return audioMixBufConvToU8Stereo;
+                case 16: return audioMixBufConvToU16Stereo;
+                case 32: return audioMixBufConvToU32Stereo;
+                default: return NULL;
+            }
+        }
+        else if (AUDMIXBUF_FMT_CHANNELS(enmFmt) == 1)
+        {
+            switch (AUDMIXBUF_FMT_BITS_PER_SAMPLE(enmFmt))
+            {
+                case 8:  return audioMixBufConvToU8Mono;
+                case 16: return audioMixBufConvToU16Mono;
+                case 32: return audioMixBufConvToU32Mono;
+                default: return NULL;
+            }
+        }
+    }
+
+    return NULL;
+}
+
+static void audioMixBufFreeBuf(PPDMAUDIOMIXBUF pMixBuf)
+{
+    if (pMixBuf)
+    {
+        if (pMixBuf->pSamples)
+        {
+            RTMemFree(pMixBuf->pSamples);
+            pMixBuf->pSamples = NULL;
+        }
+
+        pMixBuf->cSamples = 0;
+    }
+}
+
+int audioMixBufInit(PPDMAUDIOMIXBUF pMixBuf, const char *pszName, PPDMPCMPROPS pProps, uint32_t cSamples)
+{
+    AssertPtrReturn(pMixBuf, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pProps,  VERR_INVALID_POINTER);
+
+    pMixBuf->pParent = NULL;
+    RTListInit(&pMixBuf->lstBuffers);
+
+    pMixBuf->pSamples = NULL;
+    pMixBuf->cSamples = 0;
+
+    pMixBuf->offReadWrite = 0;
+    pMixBuf->cMixed       = 0;
+    pMixBuf->cProcessed   = 0;
+
+    /* Set initial volume to max. */
+    pMixBuf->Volume.fMuted = false;
+    pMixBuf->Volume.uLeft  = VOL_0DB;
+    pMixBuf->Volume.uRight = VOL_0DB;
+
+    /* Prevent division by zero.
+     * Do a 1:1 conversion according to AUDIOMIXBUF_S2B_RATIO. */
+    pMixBuf->iFreqRatio = 1 << 20;
+
+    pMixBuf->pRate = NULL;
+
+    pMixBuf->AudioFmt = AUDMIXBUF_AUDIO_FMT_MAKE(pProps->uHz,
+                                                 pProps->cChannels,
+                                                 pProps->cBits,
+                                                 pProps->fSigned);
+    pMixBuf->cShift = pProps->cShift;
+    pMixBuf->pszName = RTStrDup(pszName);
+    if (!pMixBuf->pszName)
+        return VERR_NO_MEMORY;
+
+    AUDMIXBUF_LOG(("%s: uHz=%RU32, cChan=%RU8, cBits=%RU8, fSigned=%RTbool\n",
+                   pMixBuf->pszName,
+                   AUDMIXBUF_FMT_SAMPLE_FREQ(pMixBuf->AudioFmt),
+                   AUDMIXBUF_FMT_CHANNELS(pMixBuf->AudioFmt),
+                   AUDMIXBUF_FMT_BITS_PER_SAMPLE(pMixBuf->AudioFmt),
+                   RT_BOOL(AUDMIXBUF_FMT_SIGNED(pMixBuf->AudioFmt))));
+
+    return audioMixBufAllocBuf(pMixBuf, cSamples);
+}
+
+bool audioMixBufIsEmpty(PPDMAUDIOMIXBUF pMixBuf)
+{
+    AssertPtrReturn(pMixBuf, true);
+
+    if (pMixBuf->pParent)
+        return (pMixBuf->cMixed == 0);
+    return (pMixBuf->cProcessed == 0);
+}
+
+int audioMixBufLinkTo(PPDMAUDIOMIXBUF pMixBuf, PPDMAUDIOMIXBUF pParent)
+{
+    AssertPtrReturn(pMixBuf, VERR_INVALID_POINTER);
+    AssertPtrReturn(pParent, VERR_INVALID_POINTER);
+
+    AssertMsgReturn(AUDMIXBUF_FMT_SAMPLE_FREQ(pParent->AudioFmt),
+                    ("Parent sample frequency (Hz) not set\n"), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(AUDMIXBUF_FMT_SAMPLE_FREQ(pMixBuf->AudioFmt),
+                    ("Buffer sample frequency (Hz) not set\n"), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(pMixBuf != pParent,
+                    ("Circular linking not allowed\n"), VERR_INVALID_PARAMETER);
+
+    if (pMixBuf->pParent) /* Already linked? */
+    {
+        AUDMIXBUF_LOG(("%s: Already linked to \"%s\"\n",
+                       pMixBuf->pszName, pMixBuf->pParent->pszName));
+        return VERR_ACCESS_DENIED;
+    }
+
+    RTListAppend(&pParent->lstBuffers, &pMixBuf->Node);
+    pMixBuf->pParent = pParent;
+
+    /* Calculate the frequency ratio. */
+    pMixBuf->iFreqRatio = ((int64_t)AUDMIXBUF_FMT_SAMPLE_FREQ(pParent->AudioFmt) << 32)
+                        /           AUDMIXBUF_FMT_SAMPLE_FREQ(pMixBuf->AudioFmt);
+
+    if (pMixBuf->iFreqRatio == 0) /* Catch division by zero. */
+        pMixBuf->iFreqRatio = 1 << 20; /* Do a 1:1 conversion instead. */
+
+    uint32_t cSamples = (uint32_t)RT_MIN(  ((uint64_t)pParent->cSamples << 32)
+                                         / pMixBuf->iFreqRatio, _64K /* 64K samples max. */);
+    if (!cSamples)
+        cSamples = pParent->cSamples;
+
+    int rc = VINF_SUCCESS;
+
+    if (cSamples != pMixBuf->cSamples)
+    {
+        AUDMIXBUF_LOG(("%s: Reallocating samples %RU32 -> %RU32\n",
+                       pMixBuf->pszName, pMixBuf->cSamples, cSamples));
+
+        uint32_t cbSamples = cSamples * sizeof(PDMAUDIOSAMPLE);
+        Assert(cbSamples);
+        pMixBuf->pSamples = (PPDMAUDIOSAMPLE)RTMemRealloc(pMixBuf->pSamples, cbSamples);
+        if (!pMixBuf->pSamples)
+            rc = VERR_NO_MEMORY;
+
+        if (RT_SUCCESS(rc))
+        {
+            pMixBuf->cSamples = cSamples;
+
+            /* Make sure to zero the reallocated buffer so that it can be
+             * used properly when blending with another buffer later. */
+            RT_BZERO(pMixBuf->pSamples, cbSamples);
+        }
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        if (!pMixBuf->pRate)
+        {
+            /* Create rate conversion. */
+            pMixBuf->pRate = (PPDMAUDIOSTRMRATE)RTMemAllocZ(sizeof(PDMAUDIOSTRMRATE));
+            if (!pMixBuf->pRate)
+                return VERR_NO_MEMORY;
+        }
+        else
+            RT_BZERO(pMixBuf->pRate, sizeof(PDMAUDIOSTRMRATE));
+
+        pMixBuf->pRate->dstInc = ((uint64_t)AUDMIXBUF_FMT_SAMPLE_FREQ(pMixBuf->AudioFmt) << 32)
+                               /            AUDMIXBUF_FMT_SAMPLE_FREQ(pParent->AudioFmt);
+
+        AUDMIXBUF_LOG(("uThisHz=%RU32, uParentHz=%RU32, iFreqRatio=0x%RX64 (%RI64), uRateInc=0x%RX64 (%RU64), cSamples=%RU32 (%RU32 parent)\n",
+                       AUDMIXBUF_FMT_SAMPLE_FREQ(pMixBuf->AudioFmt),
+                       AUDMIXBUF_FMT_SAMPLE_FREQ(pParent->AudioFmt),
+                       pMixBuf->iFreqRatio, pMixBuf->iFreqRatio,
+                       pMixBuf->pRate->dstInc, pMixBuf->pRate->dstInc,
+                       pMixBuf->cSamples,
+                       pParent->cSamples));
+        AUDMIXBUF_LOG(("%s (%RU32Hz) -> %s (%RU32Hz)\n",
+                       pMixBuf->pszName, AUDMIXBUF_FMT_SAMPLE_FREQ(pMixBuf->AudioFmt),
+                       pMixBuf->pParent->pszName, AUDMIXBUF_FMT_SAMPLE_FREQ(pParent->AudioFmt)));
+    }
+
+    return rc;
+}
+
+uint32_t audioMixBufMixed(PPDMAUDIOMIXBUF pMixBuf)
+{
+    AssertPtrReturn(pMixBuf, 0);
+
+    AssertMsgReturn(VALID_PTR(pMixBuf->pParent),
+                              ("Buffer is not linked to a parent buffer\n"),
+                              0);
+
+    AUDMIXBUF_LOG(("%s: cMixed=%RU32\n", pMixBuf->pszName, pMixBuf->cMixed));
+    return pMixBuf->cMixed;
+}
+
+static int audioMixBufMixTo(PPDMAUDIOMIXBUF pDst, PPDMAUDIOMIXBUF pSrc, uint32_t cSamples, uint32_t *pcProcessed)
+{
+    AssertPtrReturn(pDst, VERR_INVALID_POINTER);
+    AssertPtrReturn(pSrc, VERR_INVALID_POINTER);
+    /* pcProcessed is optional. */
+
+    /* Live samples indicate how many samples there are in the source buffer
+     * which have not been processed yet by the destination buffer. */
+    uint32_t cLive = pSrc->cMixed;
+    if (cLive >= pDst->cSamples)
+        AUDMIXBUF_LOG(("Destination buffer \"%s\" full (%RU32 samples max), live samples = %RU32\n",
+                       pDst->pszName, pDst->cSamples, cLive));
+
+    /* Dead samples are the number of samples in the destination buffer which
+     * will not be needed, that is, are not needed in order to process the live
+     * samples of the source buffer. */
+    uint32_t cDead = pDst->cSamples - cLive;
+
+    uint32_t cToReadTotal = (uint32_t)RT_MIN(cSamples, AUDIOMIXBUF_S2S_RATIO(pSrc, cDead));
+    uint32_t offRead = 0;
+
+    uint32_t cReadTotal = 0;
+    uint32_t cWrittenTotal = 0;
+    uint32_t offWrite = (pDst->offReadWrite + cLive) % pDst->cSamples;
+
+    AUDMIXBUF_LOG(("pSrc=%s (%RU32 samples), pDst=%s (%RU32 samples), cLive=%RU32, cDead=%RU32, cToReadTotal=%RU32, offWrite=%RU32\n",
+                   pSrc->pszName, pSrc->cSamples, pDst->pszName, pDst->cSamples, cLive, cDead, cToReadTotal, offWrite));
+
+    uint32_t cToRead, cToWrite;
+    uint32_t cWritten, cRead;
+
+    while (cToReadTotal)
+    {
+        cDead = pDst->cSamples - cLive;
+
+        cToRead  = cToReadTotal;
+        cToWrite = RT_MIN(cDead, pDst->cSamples - offWrite);
+        if (!cToWrite)
+        {
+            AUDMIXBUF_LOG(("Warning: Destination buffer \"%s\" full\n", pDst->pszName));
+            break;
+        }
+
+        Assert(offWrite + cToWrite <= pDst->cSamples);
+        Assert(offRead + cToRead <= pSrc->cSamples);
+
+        AUDMIXBUF_LOG(("\t%RU32Hz -> %RU32Hz\n", AUDMIXBUF_FMT_SAMPLE_FREQ(pSrc->AudioFmt), AUDMIXBUF_FMT_SAMPLE_FREQ(pDst->AudioFmt)));
+        AUDMIXBUF_LOG(("\tcDead=%RU32, offWrite=%RU32, cToWrite=%RU32, offRead=%RU32, cToRead=%RU32\n",
+                       cDead, offWrite, cToWrite, offRead, cToRead));
+
+        audioMixBufOpBlend(pDst->pSamples + offWrite, cToWrite,
+                           pSrc->pSamples + offRead, cToRead,
+                           pSrc->pRate, &cWritten, &cRead);
+
+        AUDMIXBUF_LOG(("\t\tcWritten=%RU32, cRead=%RU32\n", cWritten, cRead));
+
+        cReadTotal    += cRead;
+        cWrittenTotal += cWritten;
+
+        offRead += cRead;
+        Assert(cToReadTotal >= cRead);
+        cToReadTotal -= cRead;
+
+        offWrite = (offWrite + cWritten) % pDst->cSamples;
+
+        cLive += cWritten;
+    }
+
+    pSrc->cMixed     += cWrittenTotal;
+    pDst->cProcessed += cWrittenTotal;
+#ifdef DEBUG
+    s_cSamplesMixedTotal += cWrittenTotal;
+    audioMixBufPrint(pDst);
+#endif
+
+    if (pcProcessed)
+        *pcProcessed = cReadTotal;
+
+    AUDMIXBUF_LOG(("cReadTotal=%RU32 (pcProcessed), cWrittenTotal=%RU32, cSrcMixed=%RU32, cDstProc=%RU32\n",
+                   cReadTotal, cWrittenTotal, pSrc->cMixed, pDst->cProcessed));
+    return VINF_SUCCESS;
+}
+
+int audioMixBufMixToChildren(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamples,
+                             uint32_t *pcProcessed)
+{
+    int rc = VINF_SUCCESS;
+
+    uint32_t cProcessed;
+    uint32_t cProcessedMax = 0;
+
+    PPDMAUDIOMIXBUF pIter;
+    RTListForEach(&pMixBuf->lstBuffers, pIter, PDMAUDIOMIXBUF, Node)
+    {
+        rc = audioMixBufMixTo(pIter, pMixBuf, cSamples, &cProcessed);
+        if (RT_FAILURE(rc))
+            break;
+
+        cProcessedMax = RT_MAX(cProcessedMax, cProcessed);
+    }
+
+    if (pcProcessed)
+        *pcProcessed = cProcessedMax;
+
+    return rc;
+}
+
+int audioMixBufMixToParent(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamples,
+                           uint32_t *pcProcessed)
+{
+    AssertMsgReturn(VALID_PTR(pMixBuf->pParent),
+                    ("Buffer is not linked to a parent buffer\n"),
+                    VERR_INVALID_PARAMETER);
+
+    return audioMixBufMixTo(pMixBuf->pParent, pMixBuf, cSamples, pcProcessed);
+}
+
+static inline void audioMixBufPrint(PPDMAUDIOMIXBUF pMixBuf)
+{
+#ifdef DEBUG_DISABLED
+    PPDMAUDIOMIXBUF pParent = pMixBuf;
+    if (pMixBuf->pParent)
+        pParent = pMixBuf->pParent;
+
+    AUDMIXBUF_LOG(("********************************************\n"));
+    AUDMIXBUF_LOG(("%s: offReadWrite=%RU32, cProcessed=%RU32, cMixed=%RU32 (BpS=%RU32)\n",
+                   pParent->pszName,
+                   pParent->offReadWrite, pParent->cProcessed, pParent->cMixed,
+                   AUDIOMIXBUF_S2B(pParent, 1)));
+
+    PPDMAUDIOMIXBUF pIter;
+    RTListForEach(&pParent->lstBuffers, pIter, PDMAUDIOMIXBUF, Node)
+    {
+        AUDMIXBUF_LOG(("\t%s: offReadWrite=%RU32, cProcessed=%RU32, cMixed=%RU32 (BpS=%RU32)\n",
+                       pIter->pszName,
+                       pIter->offReadWrite, pIter->cProcessed, pIter->cMixed,
+                       AUDIOMIXBUF_S2B(pIter, 1)));
+    }
+    AUDMIXBUF_LOG(("Total samples mixed: %RU64\n", s_cSamplesMixedTotal));
+    AUDMIXBUF_LOG(("********************************************\n"));
+#endif
+}
+
+/**
+ * Returns the total number of samples processed.
+ *
+ * @return  uint32_t
+ * @param   pMixBuf
+ */
+uint32_t audioMixBufProcessed(PPDMAUDIOMIXBUF pMixBuf)
+{
+    AssertPtrReturn(pMixBuf, 0);
+
+    AUDMIXBUF_LOG(("%s: cProcessed=%RU32\n", pMixBuf->pszName, pMixBuf->cProcessed));
+    return pMixBuf->cProcessed;
+}
+
+int audioMixBufReadAt(PPDMAUDIOMIXBUF pMixBuf,
+                      uint32_t offSamples,
+                      void *pvBuf, uint32_t cbBuf,
+                      uint32_t *pcbRead)
+{
+    return audioMixBufReadAtEx(pMixBuf, pMixBuf->AudioFmt,
+                               offSamples, pvBuf, cbBuf, pcbRead);
+}
+
+int audioMixBufReadAtEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt,
+                        uint32_t offSamples,
+                        void *pvBuf, uint32_t cbBuf,
+                        uint32_t *pcbRead)
+{
+    AssertPtrReturn(pMixBuf, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    /* pcbRead is optional. */
+
+    uint32_t cDstSamples = pMixBuf->cSamples;
+    uint32_t cLive = pMixBuf->cProcessed;
+
+    uint32_t cDead = cDstSamples - cLive;
+    uint32_t cToProcess = (uint32_t)AUDIOMIXBUF_S2S_RATIO(pMixBuf, cDead);
+    cToProcess = RT_MIN(cToProcess, AUDIOMIXBUF_B2S(pMixBuf, cbBuf));
+
+    AUDMIXBUF_LOG(("%s: offSamples=%RU32, cLive=%RU32, cDead=%RU32, cToProcess=%RU32\n",
+                   pMixBuf->pszName, offSamples, cLive, cDead, cToProcess));
+
+    int rc;
+    if (cToProcess)
+    {
+        PAUDMIXBUF_FN_CONVTO pConv = audioMixBufConvToLookup(enmFmt);
+        if (pConv)
+        {
+            AUDMIXBUF_CONVOPTS convOpts = { cToProcess, pMixBuf->Volume };
+            pConv(pvBuf, pMixBuf->pSamples + offSamples, &convOpts);
+
+            rc = VINF_SUCCESS;
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
+
+        audioMixBufPrint(pMixBuf);
+    }
+    else
+        rc = VINF_SUCCESS;
+
+    if (RT_SUCCESS(rc))
+    {
+        if (pcbRead)
+            *pcbRead = AUDIOMIXBUF_S2B(pMixBuf, cToProcess);
+    }
+
+    AUDMIXBUF_LOG(("cbRead=%RU32, rc=%Rrc\n", AUDIOMIXBUF_S2B(pMixBuf, cToProcess), rc));
+    return rc;
+}
+
+int audioMixBufReadCirc(PPDMAUDIOMIXBUF pMixBuf,
+                        void *pvBuf, uint32_t cbBuf, uint32_t *pcRead)
+{
+    return audioMixBufReadCircEx(pMixBuf, pMixBuf->AudioFmt,
+                                 pvBuf, cbBuf, pcRead);
+}
+
+int audioMixBufReadCircEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt,
+                          void *pvBuf, uint32_t cbBuf, uint32_t *pcRead)
+{
+    AssertPtrReturn(pMixBuf, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    AssertReturn(cbBuf, VERR_INVALID_PARAMETER);
+    /* pcbRead is optional. */
+
+    if (!cbBuf)
+        return VINF_SUCCESS;
+
+    uint32_t cToRead = RT_MIN(AUDIOMIXBUF_B2S(pMixBuf, cbBuf), pMixBuf->cProcessed);
+
+    AUDMIXBUF_LOG(("%s: pvBuf=%p, cbBuf=%zu (%RU32 samples), cToRead=%RU32\n",
+                   pMixBuf->pszName, pvBuf, cbBuf, AUDIOMIXBUF_B2S(pMixBuf, cbBuf), cToRead));
+
+    if (!cToRead)
+    {
+        audioMixBufPrint(pMixBuf);
+
+        if (pcRead)
+            *pcRead = 0;
+        return VINF_SUCCESS;
+    }
+
+    PAUDMIXBUF_FN_CONVTO pConv = audioMixBufConvToLookup(enmFmt);
+    if (!pConv) /* Audio format not supported. */
+        return VERR_NOT_SUPPORTED;
+
+    PPDMAUDIOSAMPLE pSamplesSrc1 = pMixBuf->pSamples + pMixBuf->offReadWrite;
+    uint32_t cLenSrc1 = cToRead;
+
+    PPDMAUDIOSAMPLE pSamplesSrc2 = NULL;
+    uint32_t cLenSrc2 = 0;
+
+    uint32_t offRead = pMixBuf->offReadWrite + cToRead;
+
+    /*
+     * Do we need to wrap around to read all requested data, that is,
+     * starting at the beginning of our circular buffer? This then will
+     * be the optional second part to do.
+     */
+    if (offRead >= pMixBuf->cSamples)
+    {
+        Assert(pMixBuf->offReadWrite <= pMixBuf->cSamples);
+        cLenSrc1 = pMixBuf->cSamples - pMixBuf->offReadWrite;
+
+        pSamplesSrc2 = pMixBuf->pSamples;
+        Assert(cToRead >= cLenSrc1);
+        cLenSrc2 = RT_MIN(cToRead - cLenSrc1, pMixBuf->cSamples);
+
+        /* Save new read offset. */
+        offRead = cLenSrc2;
+    }
+
+    AUDMIXBUF_CONVOPTS convOpts;
+    convOpts.Volume = pMixBuf->Volume;
+
+    /* Anything to do at all? */
+    int rc = VINF_SUCCESS;
+    if (cLenSrc1)
+    {
+        convOpts.cSamples = cLenSrc1;
+
+        AUDMIXBUF_LOG(("P1: offRead=%RU32, cToRead=%RU32\n", pMixBuf->offReadWrite, cLenSrc1));
+        pConv(pvBuf, pSamplesSrc1, &convOpts);
+    }
+
+    /* Second part present? */
+    if (   RT_LIKELY(RT_SUCCESS(rc))
+        && cLenSrc2)
+    {
+        AssertPtr(pSamplesSrc2);
+
+        convOpts.cSamples = cLenSrc2;
+
+        AUDMIXBUF_LOG(("P2: cToRead=%RU32, offWrite=%RU32 (%zu bytes)\n", cLenSrc2, cLenSrc1,
+                       AUDIOMIXBUF_S2B(pMixBuf, cLenSrc1)));
+        pConv((uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenSrc1), pSamplesSrc2, &convOpts);
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+#ifdef DEBUG_DUMP_PCM_DATA
+        RTFILE fh;
+        rc = RTFileOpen(&fh, "c:\\temp\\mixbuf_readcirc.pcm",
+                        RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
+        if (RT_SUCCESS(rc))
+        {
+            RTFileWrite(fh, pvBuf, AUDIOMIXBUF_S2B(pMixBuf, cLenSrc1 + cLenSrc2), NULL);
+            RTFileClose(fh);
+        }
+#endif
+        pMixBuf->offReadWrite  = offRead % pMixBuf->cSamples;
+        pMixBuf->cProcessed   -= RT_MIN(cLenSrc1 + cLenSrc2, pMixBuf->cProcessed);
+
+        if (pcRead)
+            *pcRead = cLenSrc1 + cLenSrc2;
+    }
+
+    audioMixBufPrint(pMixBuf);
+
+    AUDMIXBUF_LOG(("cRead=%RU32 (%zu bytes), rc=%Rrc\n",
+                   cLenSrc1 + cLenSrc2,
+                   AUDIOMIXBUF_S2B(pMixBuf, cLenSrc1 + cLenSrc2), rc));
+    return rc;
+}
+
+void audioMixBufReset(PPDMAUDIOMIXBUF pMixBuf)
+{
+    AssertPtrReturnVoid(pMixBuf);
+
+    AUDMIXBUF_LOG(("%s\n", pMixBuf->pszName));
+
+    pMixBuf->offReadWrite = 0;
+    pMixBuf->cMixed       = 0;
+    pMixBuf->cProcessed   = 0;
+
+    if (pMixBuf->cSamples)
+        RT_BZERO(pMixBuf->pSamples, pMixBuf->cSamples * sizeof(PDMAUDIOSAMPLE));
+}
+
+void audioMixBufSetVolume(PPDMAUDIOMIXBUF pMixBuf, PPDMAUDIOVOLUME pVol)
+{
+    AssertPtrReturnVoid(pMixBuf);
+    AssertPtrReturnVoid(pVol);
+
+    LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32\n", pMixBuf->pszName, pVol->uLeft, pVol->uRight));
+
+    pMixBuf->Volume.fMuted = pVol->fMuted;
+    //@todo: Ensure that the input is in the correct range/initialized!
+    pMixBuf->Volume.uLeft  = aVolumeConv[pVol->uLeft  & 0xFF] * (VOL_0DB >> 16);
+    pMixBuf->Volume.uRight = aVolumeConv[pVol->uRight & 0xFF] * (VOL_0DB >> 16);
+
+    LogFlowFunc(("\t-> lVol=%#RX32, rVol=%#RX32\n", pMixBuf->Volume.uLeft, pMixBuf->Volume.uRight));
+}
+
+uint32_t audioMixBufSize(PPDMAUDIOMIXBUF pMixBuf)
+{
+    return pMixBuf->cSamples;
+}
+
+/**
+ * Returns the maximum amount of bytes this buffer can hold.
+ *
+ * @return  uint32_t
+ * @param   pMixBuf
+ */
+uint32_t audioMixBufSizeBytes(PPDMAUDIOMIXBUF pMixBuf)
+{
+    return AUDIOMIXBUF_S2B(pMixBuf, pMixBuf->cSamples);
+}
+
+void audioMixBufUnlink(PPDMAUDIOMIXBUF pMixBuf)
+{
+    if (!pMixBuf || !pMixBuf->pszName)
+        return;
+
+    AUDMIXBUF_LOG(("%s\n", pMixBuf->pszName));
+
+    if (pMixBuf->pParent)
+    {
+        AUDMIXBUF_LOG(("%s: Unlinking from parent \"%s\"\n",
+                       pMixBuf->pszName, pMixBuf->pParent->pszName));
+
+        RTListNodeRemove(&pMixBuf->Node);
+
+        /* Make sure to reset the parent mixing buffer each time it gets linked
+         * to a new child. */
+        audioMixBufReset(pMixBuf->pParent);
+        pMixBuf->pParent = NULL;
+    }
+
+    PPDMAUDIOMIXBUF pIter;
+    while (!RTListIsEmpty(&pMixBuf->lstBuffers))
+    {
+        pIter = RTListGetFirst(&pMixBuf->lstBuffers, PDMAUDIOMIXBUF, Node);
+
+        AUDMIXBUF_LOG(("\tUnlinking \"%s\"\n", pIter->pszName));
+
+        audioMixBufReset(pIter->pParent);
+        pIter->pParent = NULL;
+
+        RTListNodeRemove(&pIter->Node);
+    }
+
+    if (pMixBuf->pRate)
+    {
+        pMixBuf->pRate->dstOffset = pMixBuf->pRate->srcOffset = 0;
+        pMixBuf->pRate->dstInc = 0;
+    }
+
+    pMixBuf->iFreqRatio = 1; /* Prevent division by zero. */
+}
+
+int audioMixBufWriteAt(PPDMAUDIOMIXBUF pMixBuf,
+                       uint32_t offSamples,
+                       const void *pvBuf, uint32_t cbBuf,
+                       uint32_t *pcWritten)
+{
+    return audioMixBufWriteAtEx(pMixBuf, pMixBuf->AudioFmt,
+                                offSamples, pvBuf, cbBuf, pcWritten);
+}
+
+/**
+ * TODO
+ *
+ * @return  IPRT status code.
+ * @return  int
+ * @param   pMixBuf
+ * @param   enmFmt
+ * @param   offSamples
+ * @param   pvBuf
+ * @param   cbBuf
+ * @param   pcWritten           Returns number of samples written. Optional.
+ */
+int audioMixBufWriteAtEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt,
+                         uint32_t offSamples,
+                         const void *pvBuf, uint32_t cbBuf,
+                         uint32_t *pcWritten)
+{
+    AssertPtrReturn(pMixBuf, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    /* pcWritten is optional. */
+
+    uint32_t cDstSamples = pMixBuf->pParent
+                         ? pMixBuf->pParent->cSamples : pMixBuf->cSamples;
+    uint32_t cLive = pMixBuf->cProcessed;
+
+    uint32_t cDead = cDstSamples - cLive;
+    uint32_t cToProcess = (uint32_t)AUDIOMIXBUF_S2S_RATIO(pMixBuf, cDead);
+    cToProcess = RT_MIN(cToProcess, AUDIOMIXBUF_B2S(pMixBuf, cbBuf));
+
+    AUDMIXBUF_LOG(("%s: offSamples=%RU32, cLive=%RU32, cDead=%RU32, cToProcess=%RU32\n",
+                   pMixBuf->pszName, offSamples, cLive, cDead, cToProcess));
+
+    if (offSamples + cToProcess > pMixBuf->cSamples)
+        return VERR_BUFFER_OVERFLOW;
+
+    PAUDMIXBUF_FN_CONVFROM pConv = audioMixBufConvFromLookup(enmFmt, pMixBuf->Volume.fMuted);
+    if (!pConv)
+        return VERR_NOT_SUPPORTED;
+
+    int rc;
+    uint32_t cWritten;
+
+#ifdef DEBUG_DUMP_PCM_DATA
+    RTFILE fh;
+    rc = RTFileOpen(&fh, "c:\\temp\\mixbuf_writeat.pcm",
+                    RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
+    if (RT_SUCCESS(rc))
+    {
+        RTFileWrite(fh, pvBuf, cbBuf, NULL);
+        RTFileClose(fh);
+    }
+#endif
+
+    if (cToProcess)
+    {
+        AUDMIXBUF_CONVOPTS convOpts = { cToProcess, pMixBuf->Volume };
+
+        cWritten = pConv(pMixBuf->pSamples + offSamples, pvBuf, cbBuf, &convOpts);
+        audioMixBufPrint(pMixBuf);
+
+        rc = cWritten ? VINF_SUCCESS : VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+    else
+    {
+        cWritten = 0;
+        rc = VINF_SUCCESS;
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        if (pcWritten)
+            *pcWritten = cWritten;
+    }
+
+    AUDMIXBUF_LOG(("cWritten=%RU32, rc=%Rrc\n", cWritten, rc));
+    return rc;
+}
+
+int audioMixBufWriteCirc(PPDMAUDIOMIXBUF pMixBuf,
+                         const void *pvBuf, uint32_t cbBuf,
+                         uint32_t *pcWritten)
+{
+    return audioMixBufWriteCircEx(pMixBuf, pMixBuf->AudioFmt, pvBuf, cbBuf, pcWritten);
+}
+
+int audioMixBufWriteCircEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt,
+                           const void *pvBuf, uint32_t cbBuf,
+                           uint32_t *pcWritten)
+{
+    AssertPtrReturn(pMixBuf, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    /* pcbWritten is optional. */
+
+    if (!cbBuf)
+    {
+        if (pcWritten)
+            *pcWritten = 0;
+        return VINF_SUCCESS;
+    }
+
+    PPDMAUDIOMIXBUF pParent = pMixBuf->pParent;
+
+    AUDMIXBUF_LOG(("%s: enmFmt=%ld, pBuf=%p, cbBuf=%zu, pParent=%p (%RU32)\n",
+                   pMixBuf->pszName, enmFmt, pvBuf, cbBuf, pParent, pParent ? pParent->cSamples : 0));
+
+    if (   pParent
+        && pParent->cSamples <= pMixBuf->cMixed)
+    {
+        if (pcWritten)
+            *pcWritten = 0;
+
+        AUDMIXBUF_LOG(("%s: Parent buffer %s is full\n",
+                       pMixBuf->pszName, pMixBuf->pParent->pszName));
+
+        return VINF_SUCCESS;
+    }
+
+    PAUDMIXBUF_FN_CONVFROM pConv = audioMixBufConvFromLookup(enmFmt, pMixBuf->Volume.fMuted);
+    if (!pConv)
+        return VERR_NOT_SUPPORTED;
+
+    int rc = VINF_SUCCESS;
+
+    uint32_t cToWrite = AUDIOMIXBUF_B2S(pMixBuf, cbBuf);
+    AssertMsg(cToWrite, ("cToWrite is 0 (cbBuf=%zu)\n", cbBuf));
+
+    PPDMAUDIOSAMPLE pSamplesDst1 = pMixBuf->pSamples + pMixBuf->offReadWrite;
+    uint32_t cLenDst1 = cToWrite;
+
+    PPDMAUDIOSAMPLE pSamplesDst2 = NULL;
+    uint32_t cLenDst2 = 0;
+
+    uint32_t offWrite = pMixBuf->offReadWrite + cToWrite;
+
+    /*
+     * Do we need to wrap around to write all requested data, that is,
+     * starting at the beginning of our circular buffer? This then will
+     * be the optional second part to do.
+     */
+    if (offWrite >= pMixBuf->cSamples)
+    {
+        Assert(pMixBuf->offReadWrite <= pMixBuf->cSamples);
+        cLenDst1 = pMixBuf->cSamples - pMixBuf->offReadWrite;
+
+        pSamplesDst2 = pMixBuf->pSamples;
+        Assert(cToWrite >= cLenDst1);
+        cLenDst2 = RT_MIN(cToWrite - cLenDst1, pMixBuf->cSamples);
+
+        /* Save new read offset. */
+        offWrite = cLenDst2;
+    }
+
+    uint32_t cWrittenTotal = 0;
+
+    AUDMIXBUF_CONVOPTS convOpts;
+    convOpts.Volume = pMixBuf->Volume;
+
+    /* Anything to do at all? */
+    if (cLenDst1)
+    {
+        convOpts.cSamples = cLenDst1;
+        cWrittenTotal = pConv(pSamplesDst1, pvBuf, cbBuf, &convOpts);
+    }
+
+    /* Second part present? */
+    if (   RT_LIKELY(RT_SUCCESS(rc))
+        && cLenDst2)
+    {
+        AssertPtr(pSamplesDst2);
+
+        convOpts.cSamples = cLenDst2;
+        cWrittenTotal += pConv(pSamplesDst2, (uint8_t *)pvBuf + AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), cbBuf, &convOpts);
+    }
+
+#ifdef DEBUG_DUMP_PCM_DATA
+        RTFILE fh;
+        RTFileOpen(&fh, "c:\\temp\\mixbuf_writeex.pcm",
+                   RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
+        RTFileWrite(fh, pSamplesDst1, AUDIOMIXBUF_S2B(pMixBuf, cLenDst1), NULL);
+        RTFileClose(fh);
+#endif
+
+    AUDMIXBUF_LOG(("cLenDst1=%RU32, cLenDst2=%RU32, offWrite=%RU32\n",
+                   cLenDst1, cLenDst2, offWrite));
+
+    if (RT_SUCCESS(rc))
+    {
+        pMixBuf->offReadWrite = offWrite % pMixBuf->cSamples;
+        pMixBuf->cProcessed = RT_MIN(pMixBuf->cProcessed + cLenDst1 + cLenDst2,
+                                     pMixBuf->cSamples /* Max */);
+        if (pcWritten)
+            *pcWritten = cLenDst1 + cLenDst2;
+    }
+
+    audioMixBufPrint(pMixBuf);
+
+    AUDMIXBUF_LOG(("cWritten=%RU32 (%zu bytes), rc=%Rrc\n",
+                   cLenDst1 + cLenDst2,
+                   AUDIOMIXBUF_S2B(pMixBuf, cLenDst1 + cLenDst2), rc));
+    return rc;
+}
diff --git a/src/VBox/Devices/Audio/AudioMixBuffer.h b/src/VBox/Devices/Audio/AudioMixBuffer.h
new file mode 100644
index 0000000..a2e3207
--- /dev/null
+++ b/src/VBox/Devices/Audio/AudioMixBuffer.h
@@ -0,0 +1,79 @@
+/* $Id: AudioMixBuffer.h $ */
+/** @file
+ * VBox audio: TODO
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef AUDIO_MIXBUF_H
+#define AUDIO_MIXBUF_H
+
+#include <iprt/cdefs.h>
+#include <VBox/vmm/pdmaudioifs.h>
+
+/** Constructs 32 bit value for given frequency, number of channels, bits per sample and signed bit.
+ *  Note: This currently matches 1:1 the VRDE encoding -- this might change in the future, so better don't rely on this fact! */
+#define AUDMIXBUF_AUDIO_FMT_MAKE(freq, c, bps, s) ((((s) & 0x1) << 28) + (((bps) & 0xFF) << 20) + (((c) & 0xF) << 16) + ((freq) & 0xFFFF))
+
+/** Decodes frequency (Hz). */
+#define AUDMIXBUF_FMT_SAMPLE_FREQ(a) ((a) & 0xFFFF)
+/** Decodes number of channels. */
+#define AUDMIXBUF_FMT_CHANNELS(a) (((a) >> 16) & 0xF)
+/** Decodes signed bit. */
+#define AUDMIXBUF_FMT_SIGNED(a) (((a) >> 28) & 0x1)
+/** Decodes number of bits per sample. */
+#define AUDMIXBUF_FMT_BITS_PER_SAMPLE(a) (((a) >> 20) & 0xFF)
+/** Decodes number of bytes per sample. */
+#define AUDMIXBUF_FMT_BYTES_PER_SAMPLE(a) ((AUDMIXBUF_AUDIO_FMT_BITS_PER_SAMPLE(a) + 7) / 8)
+
+/** Converts samples to bytes. */
+#define AUDIOMIXBUF_S2B(pBuf, samples) ((samples) << (pBuf)->cShift)
+/** Converts samples to bytes, respecting the conversion ratio to
+ *  a linked buffer. */
+#define AUDIOMIXBUF_S2B_RATIO(pBuf, samples) ((((int64_t) samples << 32) / (pBuf)->iFreqRatio) << (pBuf)->cShift)
+/** Converts bytes to samples, *not* taking the conversion ratio
+ *  into account. */
+#define AUDIOMIXBUF_B2S(pBuf, cb)  (cb >> (pBuf)->cShift)
+/** Converts number of samples according to the buffer's ratio. */
+#define AUDIOMIXBUF_S2S_RATIO(pBuf, samples)  (((int64_t) samples << 32) / (pBuf)->iFreqRatio)
+
+
+int audioMixBufAcquire(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamplesToRead, PPDMAUDIOSAMPLE *ppvSamples, uint32_t *pcSamplesRead);
+inline uint32_t audioMixBufBytesToSamples(PPDMAUDIOMIXBUF pMixBuf);
+void audioMixBufDestroy(PPDMAUDIOMIXBUF pMixBuf);
+void audioMixBufFinish(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamplesToClear);
+uint32_t audioMixBufFree(PPDMAUDIOMIXBUF pMixBuf);
+uint32_t audioMixBufFreeBytes(PPDMAUDIOMIXBUF pMixBuf);
+int audioMixBufInit(PPDMAUDIOMIXBUF pMixBuf, const char *pszName, PPDMPCMPROPS pProps, uint32_t cSamples);
+bool audioMixBufIsEmpty(PPDMAUDIOMIXBUF pMixBuf);
+int audioMixBufLinkTo(PPDMAUDIOMIXBUF pMixBuf, PPDMAUDIOMIXBUF pParent);
+uint32_t audioMixBufMixed(PPDMAUDIOMIXBUF pMixBuf);
+int audioMixBufMixToChildren(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamples, uint32_t *pcProcessed);
+int audioMixBufMixToParent(PPDMAUDIOMIXBUF pMixBuf, uint32_t cSamples, uint32_t *pcProcessed);
+uint32_t audioMixBufProcessed(PPDMAUDIOMIXBUF pMixBuf);
+int audioMixBufReadAt(PPDMAUDIOMIXBUF pMixBuf, uint32_t offSamples, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead);
+int audioMixBufReadAtEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt, uint32_t offSamples, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead);
+int audioMixBufReadCirc(PPDMAUDIOMIXBUF pMixBuf, void *pvBuf, uint32_t cbBuf, uint32_t *pcRead);
+int audioMixBufReadCircEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt, void *pvBuf, uint32_t cbBuf, uint32_t *pcRead);
+void audioMixBufReset(PPDMAUDIOMIXBUF pMixBuf);
+void audioMixBufSetVolume(PPDMAUDIOMIXBUF pMixBuf, PPDMAUDIOVOLUME pVol);
+uint32_t audioMixBufSize(PPDMAUDIOMIXBUF pMixBuf);
+uint32_t audioMixBufSizeBytes(PPDMAUDIOMIXBUF pMixBuf);
+void audioMixBufUnlink(PPDMAUDIOMIXBUF pMixBuf);
+int audioMixBufWriteAt(PPDMAUDIOMIXBUF pMixBuf, uint32_t offSamples, const void *pvBuf, uint32_t cbBuf, uint32_t *pcWritten);
+int audioMixBufWriteAtEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt, uint32_t offSamples, const void *pvBuf, uint32_t cbBuf, uint32_t *pcWritten);
+int audioMixBufWriteCirc(PPDMAUDIOMIXBUF pMixBuf, const void *pvBuf, uint32_t cbBuf, uint32_t *pcWritten);
+int audioMixBufWriteCircEx(PPDMAUDIOMIXBUF pMixBuf, PDMAUDIOMIXBUFFMT enmFmt, const void *pvBuf, uint32_t cbBuf, uint32_t *pcWritten);
+
+#endif /* AUDIO_MIXBUF_H */
+
diff --git a/src/VBox/Devices/Audio/AudioMixer.cpp b/src/VBox/Devices/Audio/AudioMixer.cpp
new file mode 100644
index 0000000..336ac0c
--- /dev/null
+++ b/src/VBox/Devices/Audio/AudioMixer.cpp
@@ -0,0 +1,476 @@
+/* $Id: AudioMixer.cpp $ */
+/** @file
+ * VBox audio: Mixing routines, mainly used by the various audio device
+ *             emulations to achieve proper multiplexing from/to attached
+ *             devices LUNs.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "AudioMixer.h"
+#include "AudioMixBuffer.h"
+
+#include <VBox/vmm/pdm.h>
+#include <VBox/err.h>
+#include <VBox/vmm/mm.h>
+#include <VBox/vmm/pdmaudioifs.h>
+
+#include <iprt/alloc.h>
+#include <iprt/asm-math.h>
+#include <iprt/assert.h>
+#include <iprt/string.h>
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+
+static int audioMixerUpdateSinkVolume(PAUDMIXSINK pSink, const PPDMAUDIOVOLUME pVolMaster);
+
+
+int audioMixerAddSink(PAUDIOMIXER pMixer, const char *pszName, AUDMIXSINKDIR enmDir, PAUDMIXSINK *ppSink)
+{
+    AssertPtrReturn(pMixer, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    /** ppSink is optional. */
+
+    int rc = VINF_SUCCESS;
+
+    PAUDMIXSINK pSink = (PAUDMIXSINK)RTMemAllocZ(sizeof(AUDMIXSINK));
+    if (pSink)
+    {
+        pSink->pszName = RTStrDup(pszName);
+        if (!pSink->pszName)
+            rc = VERR_NO_MEMORY;
+
+        if (RT_SUCCESS(rc))
+        {
+            pSink->pParent  = pMixer;
+            pSink->cStreams = 0;
+            pSink->enmDir   = enmDir;
+            RTListInit(&pSink->lstStreams);
+
+            /* Set initial volume to max. */
+            pSink->Volume.fMuted = false;
+            pSink->Volume.uLeft  = 0x7F;
+            pSink->Volume.uRight = 0x7F;
+
+            RTListAppend(&pMixer->lstSinks, &pSink->Node);
+            pMixer->cSinks++;
+
+            LogFlowFunc(("pMixer=%p, pSink=%p, cSinks=%RU8\n",
+                         pMixer, pSink, pMixer->cSinks));
+
+            if (ppSink)
+                *ppSink = pSink;
+        }
+        else
+            RTMemFree(pSink);
+    }
+    else
+        rc = VERR_NO_MEMORY;
+
+    return rc;
+}
+
+int audioMixerAddStreamIn(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOGSTSTRMIN pStream,
+                          uint32_t uFlags, PAUDMIXSTREAM *ppStream)
+{
+    AssertPtrReturn(pSink, VERR_INVALID_POINTER);
+    AssertPtrReturn(pStream, VERR_INVALID_POINTER);
+    /** @todo Add flag validation. */
+    /* ppStream is optional. */
+
+    int rc;
+
+    if (pSink->cStreams == UINT8_MAX) /* 255 streams per sink max. */
+        return VERR_TOO_MUCH_DATA;
+
+    PAUDMIXSTREAM pMixStream
+        = (PAUDMIXSTREAM)RTMemAllocZ(sizeof(AUDMIXSTREAM));
+    if (pMixStream)
+    {
+        pMixStream->pConn = pConnector;
+        pMixStream->pIn   = pStream;
+        /** @todo Process flags. */
+
+        RTListAppend(&pSink->lstStreams, &pMixStream->Node);
+        pSink->cStreams++;
+
+        LogFlowFunc(("%s: pStream=%p, cStreams=%RU8\n",
+                     pSink->pszName, pMixStream, pSink->cStreams));
+
+        if (ppStream)
+            *ppStream = pMixStream;
+
+        rc = VINF_SUCCESS;
+    }
+    else
+        rc = VERR_NO_MEMORY;
+
+    return rc;
+}
+
+int audioMixerAddStreamOut(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOGSTSTRMOUT pStream,
+                           uint32_t uFlags, PAUDMIXSTREAM *ppStream)
+{
+    AssertPtrReturn(pSink, VERR_INVALID_POINTER);
+    AssertPtrReturn(pStream, VERR_INVALID_POINTER);
+    /** @todo Add flag validation. */
+    /* ppStream is optional. */
+
+    int rc;
+
+    if (pSink->cStreams == UINT8_MAX) /* 255 streams per sink max. */
+        return VERR_TOO_MUCH_DATA;
+
+    PAUDMIXSTREAM pMixStream
+        = (PAUDMIXSTREAM)RTMemAllocZ(sizeof(AUDMIXSTREAM));
+    if (pMixStream)
+    {
+        pMixStream->pConn = pConnector;
+        pMixStream->pOut  = pStream;
+        /** @todo Process flags. */
+
+        RTListAppend(&pSink->lstStreams, &pMixStream->Node);
+        pSink->cStreams++;
+
+        LogFlowFunc(("%s: pStream=%p, cStreams=%RU8\n",
+                     pSink->pszName, pMixStream, pSink->cStreams));
+
+        if (ppStream)
+            *ppStream = pMixStream;
+
+        rc = VINF_SUCCESS;
+    }
+    else
+        rc = VERR_NO_MEMORY;
+
+    return rc;
+}
+
+int audioMixerControlStream(PAUDIOMIXER pMixer, PAUDMIXSTREAM pHandle)
+{
+    return VERR_NOT_IMPLEMENTED;
+}
+
+int audioMixerCreate(const char *pszName, uint32_t uFlags, PAUDIOMIXER *ppMixer)
+{
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    /** @todo Add flag validation. */
+    AssertPtrReturn(ppMixer, VERR_INVALID_POINTER);
+
+    int rc = VINF_SUCCESS;
+
+    PAUDIOMIXER pMixer = (PAUDIOMIXER)RTMemAllocZ(sizeof(AUDIOMIXER));
+    if (pMixer)
+    {
+        pMixer->pszName = RTStrDup(pszName);
+        if (!pMixer->pszName)
+            rc = VERR_NO_MEMORY;
+
+        if (RT_SUCCESS(rc))
+        {
+            pMixer->cSinks = 0;
+            RTListInit(&pMixer->lstSinks);
+
+            pMixer->VolMaster.fMuted = false;
+            pMixer->VolMaster.uLeft  = UINT32_MAX;
+            pMixer->VolMaster.uRight = UINT32_MAX;
+
+            LogFlowFunc(("Created %p ...\n", pMixer));
+
+            *ppMixer = pMixer;
+        }
+        else
+            RTMemFree(pMixer);
+    }
+    else
+        rc = VERR_NO_MEMORY;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+void audioMixerDestroy(PAUDIOMIXER pMixer)
+{
+    if (pMixer)
+    {
+        LogFlowFunc(("Destroying %s ...\n", pMixer->pszName));
+
+        PAUDMIXSINK pSink = RTListGetFirst(&pMixer->lstSinks, AUDMIXSINK, Node);
+        while (pSink)
+        {
+            PAUDMIXSINK pNext = RTListNodeGetNext(&pSink->Node, AUDMIXSINK, Node);
+            bool fLast = RTListNodeIsLast(&pMixer->lstSinks, &pSink->Node);
+
+            audioMixerRemoveSink(pMixer, pSink);
+
+            if (fLast)
+                break;
+
+            pSink = pNext;
+        }
+
+        Assert(pMixer->cSinks == 0);
+
+        RTStrFree(pMixer->pszName);
+
+        RTMemFree(pMixer);
+    }
+}
+
+static void audioMixerDestroySink(PAUDMIXSINK pSink)
+{
+    AssertPtrReturnVoid(pSink);
+    if (!pSink)
+        return;
+
+    RTStrFree(pSink->pszName);
+
+    RTMemFree(pSink);
+}
+
+static void audioMixerDestroyStream(PAUDMIXSTREAM pStream)
+{
+    AssertPtrReturnVoid(pStream);
+    if (!pStream)
+        return;
+
+    RTMemFree(pStream);
+}
+
+uint32_t audioMixerGetStreamCount(PAUDIOMIXER pMixer)
+{
+    AssertPtrReturn(pMixer, 0);
+
+    uint32_t cStreams = 0;
+
+    PAUDMIXSINK pSink;
+    RTListForEach(&pMixer->lstSinks, pSink, AUDMIXSINK, Node)
+        cStreams += pSink->cStreams;
+
+    return cStreams;
+}
+
+void audioMixerInvalidate(PAUDIOMIXER pMixer)
+{
+    AssertPtrReturnVoid(pMixer);
+
+    LogFlowFunc(("%s: Invalidating ...\n", pMixer->pszName));
+
+    /* Propagate new master volume to all connected sinks. */
+    PAUDMIXSINK pSink;
+    RTListForEach(&pMixer->lstSinks, pSink, AUDMIXSINK, Node)
+    {
+        int rc2 = audioMixerUpdateSinkVolume(pSink, &pMixer->VolMaster);
+        AssertRC(rc2);
+    }
+}
+
+int audioMixerProcessSinkIn(PAUDMIXSINK pSink, AUDMIXOP enmOp, void *pvBuf, uint32_t cbBuf, uint32_t *pcbProcessed)
+{
+    AssertPtrReturn(pSink, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    AssertReturn(cbBuf, VERR_INVALID_PARAMETER);
+    /* pcbProcessed is optional. */
+
+    /** @todo Handle mixing operation enmOp! */
+
+    uint8_t *pvMixBuf = (uint8_t *)RTMemAlloc(cbBuf);
+    if (!pvMixBuf)
+        return VERR_NO_MEMORY;
+
+    int rc = VERR_NOT_FOUND;
+    uint32_t cbProcessed = 0;
+
+    LogFlowFunc(("%s: pvBuf=%p, cbBuf=%zu\n", pSink->pszName, pvBuf, cbBuf));
+
+    PAUDMIXSTREAM pStream;
+    RTListForEach(&pSink->lstStreams, pStream, AUDMIXSTREAM, Node)
+    {
+        /** @todo Support output sinks as well! */
+        if (!pStream->pConn->pfnIsActiveIn(pStream->pConn, pStream->pIn))
+            continue;
+
+        uint32_t cbTotalRead = 0;
+        uint32_t cbToRead = cbBuf;
+
+        while (cbToRead)
+        {
+            uint32_t cbRead;
+            AssertPtr(pStream->pConn);
+            rc = pStream->pConn->pfnRead(pStream->pConn, pStream->pIn,
+                                         (uint8_t *)pvMixBuf + cbTotalRead, cbToRead, &cbRead);
+            if (   RT_FAILURE(rc)
+                || !cbRead)
+                break;
+
+            AssertBreakStmt(cbRead <= cbToRead, rc = VERR_BUFFER_OVERFLOW);
+            cbToRead -= cbRead;
+            cbTotalRead += cbRead;
+        }
+
+        if (RT_FAILURE(rc))
+            continue;
+
+        cbProcessed = RT_MAX(cbProcessed, cbTotalRead);
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        memcpy(pvBuf, pvMixBuf, cbProcessed); /* @todo Use an intermediate mixing buffer per sink! */
+
+        if (pcbProcessed)
+            *pcbProcessed = cbProcessed;
+    }
+
+    RTMemFree(pvMixBuf);
+
+    LogFlowFunc(("cbProcessed=%RU32, rc=%Rrc\n", cbProcessed, rc));
+    return rc;
+}
+
+int audioMixerProcessSinkOut(PAUDMIXSINK pSink, AUDMIXOP enmOp, const void *pvBuf, uint32_t cbBuf, uint32_t *pcbProcessed)
+{
+    return VERR_NOT_IMPLEMENTED;
+}
+
+void audioMixerRemoveSink(PAUDIOMIXER pMixer, PAUDMIXSINK pSink)
+{
+    AssertPtrReturnVoid(pMixer);
+    if (!pSink)
+        return;
+
+    PAUDMIXSTREAM pStream = RTListGetFirst(&pSink->lstStreams, AUDMIXSTREAM, Node);
+    while (pStream)
+    {
+        PAUDMIXSTREAM pNext = RTListNodeGetNext(&pStream->Node, AUDMIXSTREAM, Node);
+        bool fLast = RTListNodeIsLast(&pSink->lstStreams, &pStream->Node);
+
+        audioMixerRemoveStream(pSink, pStream);
+
+        if (fLast)
+            break;
+
+        pStream = pNext;
+    }
+
+    Assert(pSink->cStreams == 0);
+
+    RTListNodeRemove(&pSink->Node);
+    Assert(pMixer->cSinks);
+    pMixer->cSinks--;
+
+    LogFlowFunc(("%s: pSink=%s, cSinks=%RU8\n",
+                 pMixer->pszName, pSink->pszName, pMixer->cSinks));
+
+    audioMixerDestroySink(pSink);
+}
+
+void audioMixerRemoveStream(PAUDMIXSINK pSink, PAUDMIXSTREAM pStream)
+{
+    AssertPtrReturnVoid(pSink);
+    if (!pStream)
+        return;
+
+    Assert(pSink->cStreams);
+    RTListNodeRemove(&pStream->Node);
+    pSink->cStreams--;
+
+    const char *pszStream = pSink->enmDir == AUDMIXSINKDIR_INPUT
+                          ? pStream->pIn->MixBuf.pszName : pStream->pOut->MixBuf.pszName;
+
+    LogFlowFunc(("%s: pStream=%s, cStreams=%RU8\n",
+                 pSink->pszName, pszStream, pSink->cStreams));
+
+    audioMixerDestroyStream(pStream);
+}
+
+int audioMixerSetDeviceFormat(PAUDIOMIXER pMixer, PPDMAUDIOSTREAMCFG pCfg)
+{
+    AssertPtrReturn(pMixer, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    /** @todo Perform a deep copy, if needed. */
+    pMixer->devFmt = *pCfg;
+
+    return VINF_SUCCESS;
+}
+
+static int audioMixerUpdateSinkVolume(PAUDMIXSINK pSink, const PPDMAUDIOVOLUME pVolMaster)
+{
+    AssertPtrReturn(pSink,      VERR_INVALID_POINTER);
+    AssertPtrReturn(pVolMaster, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("Master fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
+                  pVolMaster->fMuted, pVolMaster->uLeft, pVolMaster->uRight));
+    LogFlowFunc(("%s: fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
+                  pSink->pszName, pSink->Volume.fMuted, pSink->Volume.uLeft, pSink->Volume.uRight));
+
+    /** @todo Very crude implementation for now -- needs more work! */
+
+    PDMAUDIOVOLUME volSink;
+    volSink.fMuted  = pVolMaster->fMuted || pSink->Volume.fMuted;
+    volSink.uLeft   = (pSink->Volume.uLeft  * pVolMaster->uLeft)  / UINT8_MAX;
+    volSink.uRight  = (pSink->Volume.uRight * pVolMaster->uRight) / UINT8_MAX;
+
+    LogFlowFunc(("\t-> fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
+                  volSink.fMuted, volSink.uLeft, volSink.uRight));
+
+    bool fOut = pSink->enmDir == AUDMIXSINKDIR_OUTPUT;
+
+    /* Propagate new sink volume to all streams in the sink. */
+    PAUDMIXSTREAM pStream;
+    RTListForEach(&pSink->lstStreams, pStream, AUDMIXSTREAM, Node)
+    {
+        if (fOut)
+            audioMixBufSetVolume(&pStream->pOut->MixBuf, &volSink);
+        else
+            audioMixBufSetVolume(&pStream->pIn->MixBuf,  &volSink);
+    }
+
+    return VINF_SUCCESS;
+}
+
+/** Set the master volume of the mixer. */
+int audioMixerSetMasterVolume(PAUDIOMIXER pMixer, PPDMAUDIOVOLUME pVol)
+{
+    AssertPtrReturn(pMixer, VERR_INVALID_POINTER);
+    AssertPtrReturn(pVol,   VERR_INVALID_POINTER);
+
+    pMixer->VolMaster = *pVol;
+
+    LogFlowFunc(("%s: lVol=%RU32, rVol=%RU32 => fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n",
+                 pMixer->pszName, pVol->uLeft, pVol->uRight,
+                 pMixer->VolMaster.fMuted, pMixer->VolMaster.uLeft, pMixer->VolMaster.uRight));
+
+    audioMixerInvalidate(pMixer);
+    return VINF_SUCCESS;
+}
+
+/** Set the volume of an individual sink. */
+int audioMixerSetSinkVolume(PAUDMIXSINK pSink, PPDMAUDIOVOLUME pVol)
+{
+    AssertPtrReturn(pSink, VERR_INVALID_POINTER);
+    AssertPtrReturn(pVol,  VERR_INVALID_POINTER);
+    AssertPtr(pSink->pParent);
+
+    LogFlowFunc(("%s: fMuted=%RTbool, lVol=%RU32, rVol=%RU32\n", pSink->pszName, pVol->fMuted, pVol->uLeft, pVol->uRight));
+
+    pSink->Volume = *pVol;
+
+    return audioMixerUpdateSinkVolume(pSink, &pSink->pParent->VolMaster);
+}
diff --git a/src/VBox/Devices/Audio/AudioMixer.h b/src/VBox/Devices/Audio/AudioMixer.h
new file mode 100644
index 0000000..0b029f3
--- /dev/null
+++ b/src/VBox/Devices/Audio/AudioMixer.h
@@ -0,0 +1,111 @@
+/* $Id: AudioMixer.h $ */
+/** @file
+ * VBox audio: Mixing routines, mainly used by the various audio device
+ *             emulations to achieve proper multiplexing from/to attached
+ *             devices LUNs.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef AUDIO_MIXER_H
+#define AUDIO_MIXER_H
+
+#include <iprt/cdefs.h>
+#include <VBox/vmm/pdmaudioifs.h>
+
+typedef struct AUDIOMIXER
+{
+    /** Mixer name. */
+    char                   *pszName;
+    /** Format the mixer should convert/output
+     *  data to so that the underlying device emulation
+     *  can work with it. */
+    PDMAUDIOSTREAMCFG       devFmt;
+    /** The master volume of this mixer. */
+    PDMAUDIOVOLUME          VolMaster;
+    /* List of audio mixer sinks. */
+    RTLISTANCHOR            lstSinks;
+    /** Number of used audio sinks. */
+    uint8_t                 cSinks;
+} AUDIOMIXER, *PAUDIOMIXER;
+
+typedef struct AUDMIXSTREAM
+{
+    RTLISTNODE              Node;
+    PPDMIAUDIOCONNECTOR     pConn;
+    union
+    {
+        PPDMAUDIOGSTSTRMIN  pIn;
+        PPDMAUDIOGSTSTRMOUT pOut;
+    };
+} AUDMIXSTREAM, *PAUDMIXSTREAM;
+
+typedef enum AUDMIXSINKDIR
+{
+    AUDMIXSINKDIR_UNKNOWN = 0,
+    AUDMIXSINKDIR_INPUT,
+    AUDMIXSINKDIR_OUTPUT,
+    /** The usual 32-bit hack. */
+    AUDMIXSINKDIR_32BIT_HACK = 0x7fffffff
+} AUDMIXSINKDIR;
+
+typedef struct AUDMIXSINK
+{
+    RTLISTNODE              Node;
+    /** Name of this sink. */
+    char                   *pszName;
+    /** The sink direction, that is,
+     *  if this sink handles input or output. */
+    AUDMIXSINKDIR           enmDir;
+    /** Pointer to mixer object this sink is bound
+     *  to. */
+    PAUDIOMIXER             pParent;
+    /** Number of streams assigned. */
+    uint8_t                 cStreams;
+    /** List of assigned streams. */
+    RTLISTANCHOR            lstStreams;
+    /** This sink's mixing buffer. */
+    PDMAUDIOMIXBUF          MixBuf;
+    /** The volume of this sink. The volume always will
+     *  be combined with the mixer's master volume. */
+    PDMAUDIOVOLUME          Volume;
+} AUDMIXSINK, *PAUDMIXSINK;
+
+typedef enum AUDMIXOP
+{
+    AUDMIXOP_NONE = 0,
+    AUDMIXOP_COPY,
+    AUDMIXOP_BLEND,
+    /** The usual 32-bit hack. */
+    AUDMIXOP_32BIT_HACK = 0x7fffffff
+} AUDMIXOP;
+
+
+int audioMixerAddSink(PAUDIOMIXER pMixer, const char *pszName, AUDMIXSINKDIR enmDir, PAUDMIXSINK *ppSink);
+int audioMixerAddStreamIn(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOGSTSTRMIN pStream, uint32_t uFlags, PAUDMIXSTREAM *ppStream);
+int audioMixerAddStreamOut(PAUDMIXSINK pSink, PPDMIAUDIOCONNECTOR pConnector, PPDMAUDIOGSTSTRMOUT pStream, uint32_t uFlags, PAUDMIXSTREAM *ppStream);
+int audioMixerControlStream(AUDMIXSTREAM pHandle); /** @todo Implement me. */
+int audioMixerCreate(const char *pszName, uint32_t uFlags, PAUDIOMIXER *ppMixer);
+void audioMixerDestroy(PAUDIOMIXER pMixer);
+uint32_t audioMixerGetStreamCount(PAUDIOMIXER pMixer);
+void audioMixerInvalidate(PAUDIOMIXER pMixer);
+int audioMixerProcessSinkIn(PAUDMIXSINK pSink, AUDMIXOP enmOp, void *pvBuf, uint32_t cbBuf, uint32_t *pcbProcessed);
+int audioMixerProcessSinkOut(PAUDMIXSINK pSink, AUDMIXOP enmOp, const void *pvBuf, uint32_t cbBuf, uint32_t *pcbProcessed);
+void audioMixerRemoveSink(PAUDIOMIXER pMixer, PAUDMIXSINK pSink);
+void audioMixerRemoveStream(PAUDMIXSINK pMixer, PAUDMIXSTREAM pStream);
+int audioMixerSetDeviceFormat(PAUDIOMIXER pMixer, PPDMAUDIOSTREAMCFG pCfg);
+int audioMixerSetMasterVolume(PAUDIOMIXER pMixer, PPDMAUDIOVOLUME pVol);
+int audioMixerSetSinkVolume(PAUDMIXSINK pSink, PPDMAUDIOVOLUME pVol);
+
+#endif /* AUDIO_MIXER_H */
+
diff --git a/src/VBox/Devices/Audio/DevIchAc97.cpp b/src/VBox/Devices/Audio/DevIchAc97.cpp
index 84ac678..c2daf62 100644
--- a/src/VBox/Devices/Audio/DevIchAc97.cpp
+++ b/src/VBox/Devices/Audio/DevIchAc97.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,36 +18,56 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
-#define LOG_GROUP LOG_GROUP_DEV_AUDIO
 #include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pdmaudioifs.h>
+
 #include <iprt/assert.h>
-#include <iprt/uuid.h>
-#include <iprt/string.h>
+#ifdef IN_RING3
+# include <iprt/mem.h>
+# include <iprt/string.h>
+# include <iprt/uuid.h>
+#endif
 
 #include "VBoxDD.h"
 
-extern "C" {
-#include "audio.h"
-}
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# include "AudioMixer.h"
+#else
+ extern "C" {
+  #include "audio.h"
+ }
+#endif
 
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
 
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
 #undef LOG_VOICES
-#ifndef VBOX
-//#define USE_MIXER
-#else
-# define USE_MIXER
-#endif
+
+#ifdef DEBUG
+//#define DEBUG_LUN
+# ifdef DEBUG_LUN
+#  define DEBUG_LUN_NUM 1
+# endif
+#endif /* DEBUG */
 
 #define AC97_SSM_VERSION 1
 
-#ifndef VBOX
-# define SOFT_VOLUME
+#ifdef VBOX
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+#  define SOFT_VOLUME /** @todo Get rid of this crap. */
+# else
+#  undef  SOFT_VOLUME
+# endif
 #else
-# undef  SOFT_VOLUME
+# define  SOFT_VOLUME
 #endif
+
 #define SR_FIFOE RT_BIT(4)          /* rwc, fifo error */
 #define SR_BCIS  RT_BIT(3)          /* rwc, buffer completion interrupt status */
 #define SR_LVBCI RT_BIT(2)          /* rwc, last valid buffer completion interrupt */
@@ -130,7 +150,7 @@ enum
 {
     AC97_Reset                     = 0x00,
     AC97_Master_Volume_Mute        = 0x02,
-    AC97_Headphone_Volume_Mute     = 0x04,
+    AC97_Headphone_Volume_Mute     = 0x04, /** Also known as AUX, see table 16, section 5.7. */
     AC97_Master_Volume_Mono_Mute   = 0x06,
     AC97_Master_Tone_RL            = 0x08,
     AC97_PC_BEEP_Volume_Mute       = 0x0A,
@@ -166,6 +186,9 @@ enum
 /*******************************************************************************
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
+/**
+ * Buffer descriptor.
+ */
 typedef struct BD
 {
     uint32_t addr;
@@ -182,19 +205,70 @@ typedef struct AC97BusMasterRegs
     uint8_t  piv;               /**< ro 0, prefetched index value */
     uint8_t  cr;                /**< rw 0, control register */
     int      bd_valid;          /**< initialized? */
-    BD       bd;
+    BD       bd;                /**< buffer descriptor */
 } AC97BusMasterRegs;
 /** Pointer to a AC97 bus master register. */
 typedef AC97BusMasterRegs *PAC97BMREG;
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+typedef struct AC97INPUTSTREAM
+{
+    /** PCM line input stream. */
+    R3PTRTYPE(PPDMAUDIOGSTSTRMIN)      pStrmIn;
+    /** Mixer handle for line input stream. */
+    R3PTRTYPE(PAUDMIXSTREAM)           phStrmIn;
+} AC97INPUTSTREAM, *PAC97INPUTSTREAM;
+
+typedef struct AC97OUTPUTSTREAM
+{
+    /** PCM output stream. */
+    R3PTRTYPE(PPDMAUDIOGSTSTRMOUT)     pStrmOut;
+    /** Mixer handle for output stream. */
+    R3PTRTYPE(PAUDMIXSTREAM)           phStrmOut;
+} AC97OUTPUTSTREAM, *PAC97OUTPUTSTREAM;
+
+/**
+ * Struct for maintaining a host backend driver.
+ */
+typedef struct AC97STATE *PAC97STATE;
+typedef struct AC97DRIVER
+{
+    union
+    {
+        /** Node for storing this driver in our device driver
+         *  list of AC97STATE. */
+        RTLISTNODE                     Node;
+        struct
+        {
+            R3PTRTYPE(void *)          dummy1;
+            R3PTRTYPE(void *)          dummy2;
+        } dummy;
+    };
+
+    /** Pointer to AC97 controller (state). */
+    R3PTRTYPE(PAC97STATE)              pAC97State;
+    /** Driver flags. */
+    PDMAUDIODRVFLAGS                   Flags;
+    uint32_t                           PaddingFlags;
+    /** LUN # to which this driver has been assigned. */
+    uint8_t                            uLUN;
+    uint8_t                            Padding[5];
+    /** Audio connector interface to the underlying
+     *  host backend. */
+    R3PTRTYPE(PPDMIAUDIOCONNECTOR)     pConnector;
+    /** Stream for line input. */
+    AC97INPUTSTREAM                    LineIn;
+    /** Stream for mic input. */
+    AC97INPUTSTREAM                    MicIn;
+    /** Stream for output. */
+    AC97OUTPUTSTREAM                   Out;
+} AC97DRIVER, *PAC97DRIVER;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
 typedef struct AC97STATE
 {
     /** The PCI device state. */
     PCIDevice               PciDev;
-
-    /** Audio stuff.  */
-    QEMUSoundCard           card;
-
     /** Global Control (Bus Master Control Register) */
     uint32_t                glob_cnt;
     /** Global Status (Bus Master Control Register) */
@@ -205,28 +279,56 @@ typedef struct AC97STATE
     /** Bus Master Control Registers for PCM in, PCM out, and Mic in */
     AC97BusMasterRegs       bm_regs[3];
     uint8_t                 mixer_data[256];
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /** The emulation timer for handling the attached
+     *  LUN drivers. */
+    PTMTIMERR3              pTimer;
+    /** Timer ticks for handling the LUN drivers. */
+    uint64_t                uTicks;
+# ifdef VBOX_WITH_STATISTICS
+    STAMPROFILE             StatTimer;
+    STAMCOUNTER             StatBytesRead;
+    STAMCOUNTER             StatBytesWritten;
+# endif
+    /** List of associated LUN drivers. */
+    RTLISTANCHOR            lstDrv;
+    /** The device' software mixer. */
+    R3PTRTYPE(PAUDIOMIXER)  pMixer;
+    /** Audio sink for PCM output. */
+    R3PTRTYPE(PAUDMIXSINK)  pSinkOutput;
+    /** Audio sink for line input. */
+    R3PTRTYPE(PAUDMIXSINK)  pSinkLineIn;
+    /** Audio sink for microphone input. */
+    R3PTRTYPE(PAUDMIXSINK)  pSinkMicIn;
+#else
+    QEMUSoundCard           card;
     /** PCM in */
     SWVoiceIn              *voice_pi;
     /** PCM out */
     SWVoiceOut             *voice_po;
     /** Mic in */
     SWVoiceIn              *voice_mc;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
     uint8_t                 silence[128];
     int                     bup_flag;
     /** Pointer to the device instance. */
     PPDMDEVINSR3            pDevIns;
-    /** Pointer to the connector of the attached audio driver. */
-    PPDMIAUDIOCONNECTOR     pDrv;
     /** Pointer to the attached audio driver. */
     PPDMIBASE               pDrvBase;
     /** The base interface for LUN\#0. */
     PDMIBASE                IBase;
     /** Base port of the I/O space region. */
     RTIOPORT                IOPortBase[2];
+    /** Pointer to temporary scratch read/write buffer. */
+    R3PTRTYPE(uint8_t *)    pvReadWriteBuf;
+    /** Size of the temporary scratch read/write buffer. */
+    uint32_t                cbReadWriteBuf;
 } AC97STATE;
 /** Pointer to the AC97 device state. */
 typedef AC97STATE *PAC97STATE;
 
+#ifndef VBOX_DEVICE_STRUCT_TESTCASE
+
 #define ICHAC97STATE_2_DEVINS(a_pAC97)   ((a_pAC97)->pDevIns)
 
 enum
@@ -267,44 +369,49 @@ enum
 
 #define GET_BM(a_idx)   ( ((a_idx) >> 4) & 3 )
 
-static void po_callback(void *opaque, int free);
-static void pi_callback(void *opaque, int avail);
-static void mc_callback(void *opaque, int avail);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static DECLCALLBACK(void) ichac97Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser);
+static int ichac97TransferAudio(PAC97STATE pThis, int index, uint32_t cbElapsed);
+#else
+static void ichac97OutputCallback(void *pvContext, int cbFree);
+static void ichac97InputCallback(void *pvContext, int cbAvail);
+static void ichac97MicInCallback(void *pvContext, int cbAvail);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
-static void warm_reset(PAC97STATE pThis)
+static void ichac97WarmReset(PAC97STATE pThis)
 {
     NOREF(pThis);
 }
 
-static void cold_reset(PAC97STATE pThis)
+static void ichac97ColdReset(PAC97STATE pThis)
 {
     NOREF(pThis);
 }
 
-/** Fetch Buffer Descriptor at _CIV */
-static void fetch_bd(PAC97STATE pThis, PAC97BMREG pReg)
+/** Fetches the buffer descriptor at _CIV. */
+static void ichac97FetchBufDesc(PAC97STATE pThis, PAC97BMREG pReg)
 {
     PPDMDEVINS pDevIns = ICHAC97STATE_2_DEVINS(pThis);
-    uint8_t b[8];
+    uint32_t u32[2];
 
-    PDMDevHlpPhysRead(pDevIns, pReg->bdbar + pReg->civ * 8, b, sizeof(b));
+    PDMDevHlpPhysRead(pDevIns, pReg->bdbar + pReg->civ * 8, &u32[0], sizeof(u32));
     pReg->bd_valid   = 1;
 #if !defined(RT_ARCH_X86) && !defined(RT_ARCH_AMD64)
 # error Please adapt the code (audio buffers are little endian)!
 #else
-    pReg->bd.addr    = (*(uint32_t *) &b[0]) & ~3;
-    pReg->bd.ctl_len = (*(uint32_t *) &b[4]);
+    pReg->bd.addr    = RT_H2LE_U32(u32[0] & ~3);
+    pReg->bd.ctl_len = RT_H2LE_U32(u32[1]);
 #endif
     pReg->picb       = pReg->bd.ctl_len & 0xffff;
-    Log(("ac97: bd %2d addr=%#x ctl=%#06x len=%#x(%d bytes)\n",
-         pReg->civ, pReg->bd.addr, pReg->bd.ctl_len >> 16,
-         pReg->bd.ctl_len & 0xffff, (pReg->bd.ctl_len & 0xffff) << 1));
+    LogFlowFunc(("bd %2d addr=%#x ctl=%#06x len=%#x(%d bytes)\n",
+                  pReg->civ, pReg->bd.addr, pReg->bd.ctl_len >> 16,
+                  pReg->bd.ctl_len & 0xffff, (pReg->bd.ctl_len & 0xffff) << 1));
 }
 
 /**
  * Update the BM status register
  */
-static void update_sr(PAC97STATE pThis, PAC97BMREG pReg, uint32_t new_sr)
+static void ichac97UpdateStatus(PAC97STATE pThis, PAC97BMREG pReg, uint32_t new_sr)
 {
     PPDMDEVINS  pDevIns = ICHAC97STATE_2_DEVINS(pThis);
     int event = 0;
@@ -335,8 +442,8 @@ static void update_sr(PAC97STATE pThis, PAC97BMREG pReg, uint32_t new_sr)
 
     pReg->sr = new_sr;
 
-    Log(("ac97: IOC%d LVB%d sr=%#x event=%d level=%d\n",
-         pReg->sr & SR_BCIS, pReg->sr & SR_LVBCI, pReg->sr, event, level));
+    LogFlowFunc(("IOC%d LVB%d sr=%#x event=%d level=%d\n",
+                 pReg->sr & SR_BCIS, pReg->sr & SR_LVBCI, pReg->sr, event, level));
 
     if (event)
     {
@@ -345,13 +452,44 @@ static void update_sr(PAC97STATE pThis, PAC97BMREG pReg, uint32_t new_sr)
         else
             pThis->glob_sta &= ~masks[pReg - pThis->bm_regs];
 
-        Log(("ac97: set irq level=%d\n", !!level));
+        LogFlowFunc(("set irq level=%d\n", !!level));
         PDMDevHlpPCISetIrq(pDevIns, 0, !!level);
     }
 }
 
-static void voice_set_active(PAC97STATE pThis, int bm_index, int on)
+static void ichac97StreamSetActive(PAC97STATE pThis, int bm_index, int on)
 {
+    AssertPtrReturnVoid(pThis);
+
+    LogFlowFunc(("index=%d, on=%d\n", bm_index, on));
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PAC97DRIVER pDrv;
+    switch (bm_index)
+    {
+        case PI_INDEX:
+             RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                pDrv->pConnector->pfnEnableIn(pDrv->pConnector,
+                                              pDrv->LineIn.pStrmIn, RT_BOOL(on));
+            break;
+
+        case PO_INDEX:
+            RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                pDrv->pConnector->pfnEnableOut(pDrv->pConnector,
+                                               pDrv->Out.pStrmOut, RT_BOOL(on));
+            break;
+
+        case MC_INDEX:
+            RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                pDrv->pConnector->pfnEnableIn(pDrv->pConnector,
+                                              pDrv->MicIn.pStrmIn, RT_BOOL(on));
+            break;
+
+        default:
+            AssertMsgFailed(("Wrong index %d\n", bm_index));
+            break;
+    }
+#else
     switch (bm_index)
     {
         case PI_INDEX: AUD_set_active_in( pThis->voice_pi, on); break;
@@ -359,30 +497,30 @@ static void voice_set_active(PAC97STATE pThis, int bm_index, int on)
         case MC_INDEX: AUD_set_active_in( pThis->voice_mc, on); break;
         default:       AssertFailed (); break;
     }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 }
 
-static void reset_bm_regs(PAC97STATE pThis, PAC97BMREG pReg)
+static void ichac97ResetBMRegs(PAC97STATE pThis, PAC97BMREG pReg)
 {
-    Log(("ac97: reset_bm_regs\n"));
+    LogFlowFunc(("reset_bm_regs\n"));
     pReg->bdbar    = 0;
     pReg->civ      = 0;
     pReg->lvi      = 0;
     /** @todo do we need to do that? */
-    update_sr(pThis, pReg, SR_DCH);
+    ichac97UpdateStatus(pThis, pReg, SR_DCH);
     pReg->picb     = 0;
     pReg->piv      = 0;
     pReg->cr       = pReg->cr & CR_DONT_CLEAR_MASK;
     pReg->bd_valid = 0;
-
-    voice_set_active(pThis, pReg - pThis->bm_regs, 0);
-    memset(pThis->silence, 0, sizeof(pThis->silence));
+    ichac97StreamSetActive(pThis, pReg - pThis->bm_regs, 0);
+    RT_ZERO(pThis->silence);
 }
 
-static void mixer_store(PAC97STATE pThis, uint32_t i, uint16_t v)
+static void ichac97MixerStore(PAC97STATE pThis, uint32_t i, uint16_t v)
 {
     if (i + 2 > sizeof(pThis->mixer_data))
     {
-        Log(("ac97: mixer_store: index %d out of bounds %d\n", i, sizeof(pThis->mixer_data)));
+        LogFlowFunc(("mixer_store: index %d out of bounds %d\n", i, sizeof(pThis->mixer_data)));
         return;
     }
 
@@ -390,13 +528,13 @@ static void mixer_store(PAC97STATE pThis, uint32_t i, uint16_t v)
     pThis->mixer_data[i + 1] = v >> 8;
 }
 
-static uint16_t mixer_load(PAC97STATE pThis, uint32_t i)
+static uint16_t ichac97MixerLoad(PAC97STATE pThis, uint32_t i)
 {
     uint16_t val;
 
     if (i + 2 > sizeof(pThis->mixer_data))
     {
-        Log(("ac97: mixer_store: index %d out of bounds %d\n", i, sizeof(pThis->mixer_data)));
+        LogFlowFunc(("mixer_store: index %d out of bounds %d\n", i, sizeof(pThis->mixer_data)));
         val = 0xffff;
     }
     else
@@ -405,12 +543,180 @@ static uint16_t mixer_load(PAC97STATE pThis, uint32_t i)
     return val;
 }
 
-static void open_voice(PAC97STATE pThis, int index, int freq)
+static void ichac97OpenStream(PAC97STATE pThis, int index, uint16_t freq)
 {
-    audsettings_t as;
+    LogFlowFunc(("index=%d, freq=%RU16\n", index, freq));
+
+    int rc;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PAC97DRIVER pDrv;
+    uint8_t uLUN = 0;
+
+    if (freq)
+    {
+        PDMAUDIOSTREAMCFG streamCfg;
+        RT_ZERO(streamCfg);
+        streamCfg.uHz           = freq;
+        streamCfg.cChannels     = 2;
+        streamCfg.enmFormat     = AUD_FMT_S16;
+        streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+        char *pszDesc;
+
+        switch (index)
+        {
+            case PI_INDEX: /* Line input. */
+            {
+                RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                {
+                    if (RTStrAPrintf(&pszDesc, "[LUN#%RU8] ac97.pi", uLUN) <= 0)
+                    {
+                        rc = VERR_NO_MEMORY;
+                        break;
+                    }
+
+                    rc = pDrv->pConnector->pfnOpenIn(pDrv->pConnector,
+                                                     pszDesc, PDMAUDIORECSOURCE_LINE_IN, &streamCfg, &pDrv->LineIn.pStrmIn);
+                    LogFlowFunc(("LUN#%RU8: Opened line input with rc=%Rrc\n", uLUN, rc));
+                    if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */
+                    {
+                        audioMixerRemoveStream(pThis->pSinkLineIn, pDrv->LineIn.phStrmIn);
+                        rc = audioMixerAddStreamIn(pThis->pSinkLineIn,
+                                                   pDrv->pConnector, pDrv->LineIn.pStrmIn,
+                                                   0 /* uFlags */,
+                                                   &pDrv->LineIn.phStrmIn);
+                    }
+
+                    RTStrFree(pszDesc);
+                    uLUN++;
+                }
+                break;
+            }
+
+            case PO_INDEX: /* Output. */
+            {
+                RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                {
+                    if (RTStrAPrintf(&pszDesc, "[LUN#%RU8] ac97.po", uLUN) <= 0)
+                    {
+                        rc = VERR_NO_MEMORY;
+                        break;
+                    }
+
+                    rc = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszDesc, &streamCfg, &pDrv->Out.pStrmOut);
+                    LogFlowFunc(("LUN#%RU8: Opened output with rc=%Rrc\n", uLUN, rc));
+                    if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */
+                    {
+                        audioMixerRemoveStream(pThis->pSinkOutput, pDrv->Out.phStrmOut);
+                        rc = audioMixerAddStreamOut(pThis->pSinkOutput,
+                                                    pDrv->pConnector, pDrv->Out.pStrmOut,
+                                                    0 /* uFlags */,
+                                                    &pDrv->Out.phStrmOut);
+                    }
+
+                    RTStrFree(pszDesc);
+                    uLUN++;
+                }
+                break;
+            }
+
+            case MC_INDEX: /* Mic in */
+            {
+                RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                {
+                    if (RTStrAPrintf(&pszDesc, "[LUN#%RU8] ac97.mc", uLUN) <= 0)
+                    {
+                        rc = VERR_NO_MEMORY;
+                        break;
+                    }
+
+                    rc = pDrv->pConnector->pfnOpenIn(pDrv->pConnector,
+                                                     pszDesc, PDMAUDIORECSOURCE_MIC, &streamCfg, &pDrv->MicIn.pStrmIn);
+                    LogFlowFunc(("LUN#%RU8: Opened mic input with rc=%Rrc\n", uLUN, rc));
+                    if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */
+                    {
+                        audioMixerRemoveStream(pThis->pSinkMicIn, pDrv->MicIn.phStrmIn);
+                        rc = audioMixerAddStreamIn(pThis->pSinkMicIn,
+                                                   pDrv->pConnector, pDrv->MicIn.pStrmIn,
+                                                   0 /* uFlags */,
+                                                   &pDrv->MicIn.phStrmIn);
+                    }
+
+                    RTStrFree(pszDesc);
+                    uLUN++;
+                }
+                break;
+            }
+
+            default:
+                AssertMsgFailed(("Unsupported index %d\n", index));
+                rc = VERR_NOT_SUPPORTED;
+                break;
+        }
+    }
+    else
+    {
+        switch (index)
+        {
+            case PI_INDEX:
+            {
+                RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                {
+                    pDrv->pConnector->pfnCloseIn(pDrv->pConnector, pDrv->LineIn.pStrmIn);
+                    audioMixerRemoveStream(pThis->pSinkLineIn, pDrv->LineIn.phStrmIn);
+
+                    pDrv->LineIn.pStrmIn  = NULL;
+                    pDrv->LineIn.phStrmIn = NULL;
+                }
+
+                LogFlowFunc(("Closed line input\n"));
+                break;
+            }
+
+            case PO_INDEX:
+            {
+                RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                {
+                    pDrv->pConnector->pfnCloseOut(pDrv->pConnector, pDrv->Out.pStrmOut);
+                    audioMixerRemoveStream(pThis->pSinkOutput, pDrv->Out.phStrmOut);
+
+                    pDrv->Out.pStrmOut  = NULL;
+                    pDrv->Out.phStrmOut = NULL;
+                }
+
+                LogFlowFunc(("Closed output\n"));
+                break;
+            }
+
+            case MC_INDEX:
+            {
+                RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+                {
+                    pDrv->pConnector->pfnCloseIn(pDrv->pConnector, pDrv->MicIn.pStrmIn);
+                    audioMixerRemoveStream(pThis->pSinkMicIn, pDrv->MicIn.phStrmIn);
+
+                    pDrv->MicIn.pStrmIn  = NULL;
+                    pDrv->MicIn.phStrmIn = NULL;
+                }
+
+                LogFlowFunc(("Closed microphone input\n"));
+                break;
+            }
+
+            default:
+                AssertMsgFailed(("Unsupported index %d\n", index));
+                break;
+        }
 
+        rc = VINF_SUCCESS;
+    }
+
+    audioMixerInvalidate(pThis->pMixer);
+#else
     if (freq)
     {
+        audsettings_t as;
         as.freq       = freq;
         as.nchannels  = 2;
         as.fmt        = AUD_FMT_S16;
@@ -419,24 +725,27 @@ static void open_voice(PAC97STATE pThis, int index, int freq)
         switch (index)
         {
             case PI_INDEX: /* PCM in */
-                pThis->voice_pi = AUD_open_in(&pThis->card, pThis->voice_pi, "ac97.pi", pThis, pi_callback, &as);
+                pThis->voice_pi = AUD_open_in(&pThis->card, pThis->voice_pi, "ac97.pi", pThis, ichac97InputCallback, &as);
 #ifdef LOG_VOICES
                 LogRel(("AC97: open PI freq=%d (%s)\n", freq, pThis->voice_pi ? "ok" : "FAIL"));
 #endif
+                rc = pThis->voice_pi ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
                 break;
 
             case PO_INDEX: /* PCM out */
-                pThis->voice_po = AUD_open_out(&pThis->card, pThis->voice_po, "ac97.po", pThis, po_callback, &as);
+                pThis->voice_po = AUD_open_out(&pThis->card, pThis->voice_po, "ac97.po", pThis, ichac97OutputCallback, &as);
 #ifdef LOG_VOICES
                 LogRel(("AC97: open PO freq=%d (%s)\n", freq, pThis->voice_po ? "ok" : "FAIL"));
 #endif
+                rc = pThis->voice_po ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
                 break;
 
             case MC_INDEX: /* Mic in */
-                pThis->voice_mc = AUD_open_in(&pThis->card, pThis->voice_mc, "ac97.mc", pThis, mc_callback, &as);
+                pThis->voice_mc = AUD_open_in(&pThis->card, pThis->voice_mc, "ac97.mc", pThis, ichac97MicInCallback, &as);
 #ifdef LOG_VOICES
                 LogRel(("AC97: open MC freq=%d (%s)\n", freq, pThis->voice_mc ? "ok" : "FAIL"));
 #endif
+                rc = pThis->voice_mc ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
                 break;
         }
     }
@@ -446,66 +755,142 @@ static void open_voice(PAC97STATE pThis, int index, int freq)
         {
             case PI_INDEX:
                 AUD_close_in(&pThis->card, pThis->voice_pi);
+                pThis->voice_pi = NULL;
 #ifdef LOG_VOICES
                 LogRel(("AC97: Closing PCM IN\n"));
 #endif
-                pThis->voice_pi = NULL;
                 break;
 
             case PO_INDEX:
                 AUD_close_out(&pThis->card, pThis->voice_po);
+                pThis->voice_po = NULL;
 #ifdef LOG_VOICES
                 LogRel(("AC97: Closing PCM OUT\n"));
 #endif
-                pThis->voice_po = NULL;
                 break;
 
             case MC_INDEX:
                 AUD_close_in(&pThis->card, pThis->voice_mc);
+                pThis->voice_mc = NULL;
 #ifdef LOG_VOICES
                 LogRel(("AC97: Closing MIC IN\n"));
 #endif
-                pThis->voice_mc = NULL;
                 break;
         }
+
+        rc = VINF_SUCCESS;
     }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    LogFlowFuncLeaveRC(rc);
 }
 
-static void reset_voices(PAC97STATE pThis, uint8_t active[LAST_INDEX])
+/** @todo r=andy D'oh, pretty bad argument handling -- fix this! */
+static void ichac97ResetStreams(PAC97STATE pThis, uint8_t active[LAST_INDEX])
 {
-    uint16_t freq;
+    uint16_t uFreq = ichac97MixerLoad(pThis, AC97_PCM_LR_ADC_Rate);
+    bool fEnable = RT_BOOL(active[PI_INDEX]);
+    LogFlowFunc(("Input ADC uFreq=%RU16, fEnabled=%RTbool\n", uFreq, fEnable));
+
+    ichac97OpenStream(pThis, PI_INDEX, uFreq);
 
-    freq = mixer_load(pThis, AC97_PCM_LR_ADC_Rate);
-    open_voice(pThis, PI_INDEX, freq);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PAC97DRIVER pDrv;
+    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+        pDrv->pConnector->pfnEnableIn(pDrv->pConnector, pDrv->LineIn.pStrmIn, fEnable);
+#else
     AUD_set_active_in(pThis->voice_pi, active[PI_INDEX]);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    uFreq = ichac97MixerLoad(pThis, AC97_PCM_Front_DAC_Rate);
+    fEnable = RT_BOOL(active[PO_INDEX]);
+    LogFlowFunc(("Output DAC uFreq=%RU16, fEnabled=%RTbool\n", uFreq, fEnable));
 
-    freq = mixer_load(pThis, AC97_PCM_Front_DAC_Rate);
-    open_voice(pThis, PO_INDEX, freq);
+    ichac97OpenStream(pThis, PO_INDEX, uFreq);
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+        pDrv->pConnector->pfnEnableOut(pDrv->pConnector, pDrv->Out.pStrmOut, fEnable);
+#else
     AUD_set_active_out(pThis->voice_po, active[PO_INDEX]);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    uFreq = ichac97MixerLoad(pThis, AC97_MIC_ADC_Rate);
+    fEnable = RT_BOOL(active[MC_INDEX]);
+    LogFlowFunc(("Mic ADC uFreq=%RU16, fEnabled=%RTbool\n", uFreq, fEnable));
 
-    freq = mixer_load(pThis, AC97_MIC_ADC_Rate);
-    open_voice(pThis, MC_INDEX, freq);
+    ichac97OpenStream(pThis, MC_INDEX, uFreq);
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+        pDrv->pConnector->pfnEnableIn(pDrv->pConnector, pDrv->MicIn.pStrmIn, fEnable);
+#else
     AUD_set_active_in(pThis->voice_mc, active[MC_INDEX]);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 }
 
-#ifdef USE_MIXER
-
-static void set_volume(PAC97STATE pThis, int index, audmixerctl_t mt, uint32_t val)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static void ichac97SetVolume(PAC97STATE pThis, int index, PDMAUDIOMIXERCTL mt, uint32_t val)
+#else
+static void ichac97SetVolume(PAC97STATE pThis, int index, audmixerctl_t mt, uint32_t val)
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 {
     int mute = (val >> MUTE_SHIFT) & 1;
-    uint8_t rvol = VOL_MASK - (val & VOL_MASK);
-    uint8_t lvol = VOL_MASK - ((val >> 8) & VOL_MASK);
-    rvol = 255 * rvol / VOL_MASK;
-    lvol = 255 * lvol / VOL_MASK;
+    uint8_t rvol = val & VOL_MASK;
+    uint8_t lvol = (val >> 8) & VOL_MASK;
+
+    /* For the master volume, 0 corresponds to 0dB gain. But for the other
+     * volume controls, 0 corresponds to +12dB and 8 to 0dB. */
+    if (mt != PDMAUDIOMIXERCTL_VOLUME)
+    {
+        /* NB: Currently there is no gain support, only attenuation. */
+        lvol = lvol < 8 ? 0 : lvol - 8;
+        rvol = rvol < 8 ? 0 : rvol - 8;
+    }
 
-# ifdef SOFT_VOLUME
+    /* AC'97 has 1.5dB steps; we use 0.375dB steps. */
+    rvol = 255 - rvol * 4;
+    lvol = 255 - lvol * 4;
+
+    LogFunc(("mt=%ld, val=%RX32, mute=%RTbool\n", mt, val, RT_BOOL(mute)));
+
+#ifdef SOFT_VOLUME
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    if (pThis->pMixer) /* Device can be in reset state, so no mixer available. */
+    {
+        PDMAUDIOVOLUME vol = { RT_BOOL(mute), lvol, rvol };
+        switch (mt)
+        {
+            case PDMAUDIOMIXERCTL_VOLUME:
+                audioMixerSetMasterVolume(pThis->pMixer, &vol);
+                break;
+
+            case PDMAUDIOMIXERCTL_PCM:
+                audioMixerSetSinkVolume(pThis->pSinkOutput, &vol);
+                break;
+
+            case PDMAUDIOMIXERCTL_MIC_IN:
+                audioMixerSetSinkVolume(pThis->pSinkMicIn, &vol);
+                break;
+
+            case PDMAUDIOMIXERCTL_LINE_IN:
+                audioMixerSetSinkVolume(pThis->pSinkLineIn, &vol);
+                break;
+
+            default:
+                break;
+        }
+    }
+# else /* !VBOX_WITH_PDM_AUDIO_DRIVER */
     if (index == AC97_Master_Volume_Mute)
         AUD_set_volume_out(pThis->voice_po, mute, lvol, rvol);
     else
         AUD_set_volume(mt, &mute, &lvol, &rvol);
-# else
+# endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+#else /* !SOFT_VOLUME */
     AUD_set_volume(mt, &mute, &lvol, &rvol);
-# endif
+#endif /* SOFT_VOLUME */
 
     rvol = VOL_MASK - ((VOL_MASK * rvol) / 255);
     lvol = VOL_MASK - ((VOL_MASK * lvol) / 255);
@@ -523,157 +908,261 @@ static void set_volume(PAC97STATE pThis, int index, audmixerctl_t mt, uint32_t v
     if (val & RT_BIT(13))
         val |= RT_BIT(12) | RT_BIT(11) | RT_BIT(10) | RT_BIT(9) | RT_BIT(8);
 
-    mixer_store(pThis, index, val);
+    ichac97MixerStore(pThis, index, val);
 }
 
-static audrecsource_t ac97_to_aud_record_source(uint8_t i)
+static PDMAUDIORECSOURCE ichac97IndextoRecSource(uint8_t i)
 {
     switch (i)
     {
-        case REC_MIC:     return AUD_REC_MIC;
-        case REC_CD:      return AUD_REC_CD;
-        case REC_VIDEO:   return AUD_REC_VIDEO;
-        case REC_AUX:     return AUD_REC_AUX;
-        case REC_LINE_IN: return AUD_REC_LINE_IN;
-        case REC_PHONE:   return AUD_REC_PHONE;
+        case REC_MIC:     return PDMAUDIORECSOURCE_MIC;
+        case REC_CD:      return PDMAUDIORECSOURCE_CD;
+        case REC_VIDEO:   return PDMAUDIORECSOURCE_VIDEO;
+        case REC_AUX:     return PDMAUDIORECSOURCE_AUX;
+        case REC_LINE_IN: return PDMAUDIORECSOURCE_LINE_IN;
+        case REC_PHONE:   return PDMAUDIORECSOURCE_PHONE;
         default:
-            Log(("ac97: Unknown record source %d, using MIC\n", i));
-            return AUD_REC_MIC;
+            break;
     }
+
+    LogFlowFunc(("Unknown record source %d, using MIC\n", i));
+    return PDMAUDIORECSOURCE_MIC;
 }
 
-static uint8_t aud_to_ac97_record_source(audrecsource_t rs)
+static uint8_t ichac97RecSourceToIndex(PDMAUDIORECSOURCE rs)
 {
     switch (rs)
     {
-        case AUD_REC_MIC:     return REC_MIC;
-        case AUD_REC_CD:      return REC_CD;
-        case AUD_REC_VIDEO:   return REC_VIDEO;
-        case AUD_REC_AUX:     return REC_AUX;
-        case AUD_REC_LINE_IN: return REC_LINE_IN;
-        case AUD_REC_PHONE:   return REC_PHONE;
+        case PDMAUDIORECSOURCE_MIC:     return REC_MIC;
+        case PDMAUDIORECSOURCE_CD:      return REC_CD;
+        case PDMAUDIORECSOURCE_VIDEO:   return REC_VIDEO;
+        case PDMAUDIORECSOURCE_AUX:     return REC_AUX;
+        case PDMAUDIORECSOURCE_LINE_IN: return REC_LINE_IN;
+        case PDMAUDIORECSOURCE_PHONE:   return REC_PHONE;
         default:
-            Log(("ac97: Unknown audio recording source %d using MIC\n", rs));
-            return REC_MIC;
+            break;
     }
+
+    LogFlowFunc(("Unknown audio recording source %d using MIC\n", rs));
+    return REC_MIC;
 }
 
-static void record_select(PAC97STATE pThis, uint32_t val)
+static void ichac97RecordSelect(PAC97STATE pThis, uint32_t val)
 {
     uint8_t rs = val & REC_MASK;
     uint8_t ls = (val >> 8) & REC_MASK;
-    audrecsource_t ars = ac97_to_aud_record_source(rs);
-    audrecsource_t als = ac97_to_aud_record_source(ls);
-    AUD_set_record_source(&als, &ars);
-    rs = aud_to_ac97_record_source(ars);
-    ls = aud_to_ac97_record_source(als);
-    mixer_store(pThis, AC97_Record_Select, rs | (ls << 8));
+    PDMAUDIORECSOURCE ars = ichac97IndextoRecSource(rs);
+    PDMAUDIORECSOURCE als = ichac97IndextoRecSource(ls);
+    //AUD_set_record_source(&als, &ars);
+    rs = ichac97RecSourceToIndex(ars);
+    ls = ichac97RecSourceToIndex(als);
+    ichac97MixerStore(pThis, AC97_Record_Select, rs | (ls << 8));
 }
 
-#endif /* USE_MIXER */
-
-static void mixer_reset(PAC97STATE pThis)
+static void ichac97MixerReset(PAC97STATE pThis)
 {
-    uint8_t active[LAST_INDEX];
+    LogFlowFuncEnter();
 
-    Log(("ac97: mixer_reset\n"));
-    memset(pThis->mixer_data, 0, sizeof(pThis->mixer_data));
-    memset(active, 0, sizeof(active));
-    mixer_store(pThis, AC97_Reset                   , 0x0000); /* 6940 */
-    mixer_store(pThis, AC97_Master_Volume_Mono_Mute , 0x8000);
-    mixer_store(pThis, AC97_PC_BEEP_Volume_Mute     , 0x0000);
-
-    mixer_store(pThis, AC97_Phone_Volume_Mute       , 0x8008);
-    mixer_store(pThis, AC97_Mic_Volume_Mute         , 0x8008);
-    mixer_store(pThis, AC97_CD_Volume_Mute          , 0x8808);
-    mixer_store(pThis, AC97_Aux_Volume_Mute         , 0x8808);
-    mixer_store(pThis, AC97_Record_Gain_Mic_Mute    , 0x8000);
-    mixer_store(pThis, AC97_General_Purpose         , 0x0000);
-    mixer_store(pThis, AC97_3D_Control              , 0x0000);
-    mixer_store(pThis, AC97_Powerdown_Ctrl_Stat     , 0x000f);
+    RT_ZERO(pThis->mixer_data);
 
-    /*
-     * Sigmatel 9700 (STAC9700)
-     */
-    mixer_store(pThis, AC97_Vendor_ID1              , 0x8384);
-    mixer_store(pThis, AC97_Vendor_ID2              , 0x7600); /* 7608 */
-
-    mixer_store(pThis, AC97_Extended_Audio_ID       , 0x0809);
-    mixer_store(pThis, AC97_Extended_Audio_Ctrl_Stat, 0x0009);
-    mixer_store(pThis, AC97_PCM_Front_DAC_Rate      , 0xbb80);
-    mixer_store(pThis, AC97_PCM_Surround_DAC_Rate   , 0xbb80);
-    mixer_store(pThis, AC97_PCM_LFE_DAC_Rate        , 0xbb80);
-    mixer_store(pThis, AC97_PCM_LR_ADC_Rate         , 0xbb80);
-    mixer_store(pThis, AC97_MIC_ADC_Rate            , 0xbb80);
-
-#ifdef USE_MIXER
-    record_select(pThis, 0);
-    set_volume(pThis, AC97_Master_Volume_Mute,  AUD_MIXER_VOLUME,  0x8000);
-    set_volume(pThis, AC97_PCM_Out_Volume_Mute, AUD_MIXER_PCM,     0x8808);
-    set_volume(pThis, AC97_Line_In_Volume_Mute, AUD_MIXER_LINE_IN, 0x8808);
-#else
-    mixer_store(pThis, AC97_Record_Select, 0);
-    mixer_store(pThis, AC97_Master_Volume_Mute,  0x8000);
-    mixer_store(pThis, AC97_PCM_Out_Volume_Mute, 0x8808);
-    mixer_store(pThis, AC97_Line_In_Volume_Mute, 0x8808);
-#endif
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PAC97DRIVER pDrv;
+
+    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+    {
+        pDrv->Out.phStrmOut   = NULL;
+        pDrv->LineIn.phStrmIn = NULL;
+        pDrv->MicIn.phStrmIn  = NULL;
+    }
 
-    reset_voices(pThis, active);
+    pThis->pSinkOutput = NULL;
+    pThis->pSinkLineIn = NULL;
+    pThis->pSinkMicIn  = NULL;
+
+    if (pThis->pMixer)
+    {
+        audioMixerDestroy(pThis->pMixer);
+        pThis->pMixer = NULL;
+    }
+
+    int rc2 = audioMixerCreate("AC'97 Mixer", 0 /* uFlags */, &pThis->pMixer);
+    if (RT_SUCCESS(rc2))
+    {
+        /* Set a default audio format for our mixer. */
+        PDMAUDIOSTREAMCFG streamCfg;
+        streamCfg.uHz           = 41000;
+        streamCfg.cChannels     = 2;
+        streamCfg.enmFormat     = AUD_FMT_S16;
+        streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+        rc2 = audioMixerSetDeviceFormat(pThis->pMixer, &streamCfg);
+        AssertRC(rc2);
+
+        /* Add all required audio sinks. */
+        rc2 = audioMixerAddSink(pThis->pMixer, "[Playback] PCM Output",
+                               AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput);
+        AssertRC(rc2);
+
+        rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Line In",
+                                AUDMIXSINKDIR_INPUT, &pThis->pSinkLineIn);
+        AssertRC(rc2);
+
+        rc2 = audioMixerAddSink(pThis->pMixer, "[Recording] Microphone In",
+                                AUDMIXSINKDIR_INPUT, &pThis->pSinkMicIn);
+        AssertRC(rc2);
+    }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    ichac97MixerStore(pThis, AC97_Reset                   , 0x0000); /* 6940 */
+    ichac97MixerStore(pThis, AC97_Master_Volume_Mono_Mute , 0x8000);
+    ichac97MixerStore(pThis, AC97_PC_BEEP_Volume_Mute     , 0x0000);
+
+    ichac97MixerStore(pThis, AC97_Phone_Volume_Mute       , 0x8008);
+    ichac97MixerStore(pThis, AC97_Mic_Volume_Mute         , 0x8008);
+    ichac97MixerStore(pThis, AC97_CD_Volume_Mute          , 0x8808);
+    ichac97MixerStore(pThis, AC97_Aux_Volume_Mute         , 0x8808);
+    ichac97MixerStore(pThis, AC97_Record_Gain_Mic_Mute    , 0x8000);
+    ichac97MixerStore(pThis, AC97_General_Purpose         , 0x0000);
+    ichac97MixerStore(pThis, AC97_3D_Control              , 0x0000);
+    ichac97MixerStore(pThis, AC97_Powerdown_Ctrl_Stat     , 0x000f);
+
+    ichac97MixerStore(pThis, AC97_Extended_Audio_ID       , 0x0809);
+    ichac97MixerStore(pThis, AC97_Extended_Audio_Ctrl_Stat, 0x0009);
+    ichac97MixerStore(pThis, AC97_PCM_Front_DAC_Rate      , 0xbb80);
+    ichac97MixerStore(pThis, AC97_PCM_Surround_DAC_Rate   , 0xbb80);
+    ichac97MixerStore(pThis, AC97_PCM_LFE_DAC_Rate        , 0xbb80);
+    ichac97MixerStore(pThis, AC97_PCM_LR_ADC_Rate         , 0xbb80);
+    ichac97MixerStore(pThis, AC97_MIC_ADC_Rate            , 0xbb80);
+
+    if (PCIDevGetSubSystemVendorId(&pThis->PciDev) == 0x1028)
+    {
+        /* Analog Devices 1980 (AD1980) */
+        ichac97MixerStore(pThis, AC97_Vendor_ID1              , 0x4144);
+        ichac97MixerStore(pThis, AC97_Vendor_ID2              , 0x5370);
+    }
+    else
+    {
+        /* Sigmatel 9700 (STAC9700) */
+        ichac97MixerStore(pThis, AC97_Vendor_ID1              , 0x8384);
+        ichac97MixerStore(pThis, AC97_Vendor_ID2              , 0x7600); /* 7608 */
+    }
+    ichac97RecordSelect(pThis, 0);
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    ichac97SetVolume(pThis, AC97_Master_Volume_Mute,  PDMAUDIOMIXERCTL_VOLUME,  0x8000);
+    ichac97SetVolume(pThis, AC97_PCM_Out_Volume_Mute, PDMAUDIOMIXERCTL_PCM,     0x8808);
+    ichac97SetVolume(pThis, AC97_Line_In_Volume_Mute, PDMAUDIOMIXERCTL_LINE_IN, 0x8808);
+# else
+    ichac97SetVolume(pThis, AC97_Master_Volume_Mute,  AUD_MIXER_VOLUME,  0x8000);
+    ichac97SetVolume(pThis, AC97_PCM_Out_Volume_Mute, AUD_MIXER_PCM,     0x8808);
+    ichac97SetVolume(pThis, AC97_Line_In_Volume_Mute, AUD_MIXER_LINE_IN, 0x8808);
+# endif
+
+    /* Reset all streams. */
+    uint8_t active[LAST_INDEX] = { 0 };
+    ichac97ResetStreams(pThis, active);
 }
 
-static int write_audio(PAC97STATE pThis, PAC97BMREG pReg, int max, int *stop)
+/**
+ * Writes data from the device to the host backends.
+ *
+ * @return  IPRT status code.
+ * @return  int
+ * @param   pThis
+ * @param   pReg
+ * @param   cbMax
+ * @param   pcbWritten
+ */
+static int ichac97WriteAudio(PAC97STATE pThis, PAC97BMREG pReg, uint32_t cbMax, uint32_t *pcbWritten)
 {
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pReg, VERR_INVALID_POINTER);
+    AssertReturn(cbMax, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pcbWritten, VERR_INVALID_POINTER);
+
     PPDMDEVINS  pDevIns = ICHAC97STATE_2_DEVINS(pThis);
-    uint8_t     tmpbuf[4096];
-    uint32_t    addr = pReg->bd.addr;
-    uint32_t    temp = pReg->picb << 1;
-    uint32_t    written = 0;
-    int         to_copy = 0;
 
-    temp = audio_MIN(temp, (uint32_t)max);
-    if (!temp)
+    uint32_t    addr           = pReg->bd.addr;
+    uint32_t    cbWrittenTotal = 0;
+    uint32_t    cbToRead;
+
+    uint32_t cbToWrite = RT_MIN((uint32_t)(pReg->picb << 1), cbMax);
+    if (!cbToWrite)
     {
-        *stop = 1;
-        return 0;
+        *pcbWritten = 0;
+        return VINF_EOF;
     }
 
-    while (temp)
+    int rc = VINF_SUCCESS;
+
+    LogFlowFunc(("pReg=%p, cbMax=%RU32, cbToWrite=%RU32\n", pReg, cbMax, cbToWrite));
+
+    while (cbToWrite)
     {
-        int copied;
-        to_copy = audio_MIN(temp, sizeof(tmpbuf));
-        PDMDevHlpPhysRead(pDevIns, addr, tmpbuf, to_copy);
-        copied = AUD_write(pThis->voice_po, tmpbuf, to_copy);
-        Log(("ac97: write_audio max=%x to_copy=%x copied=%x\n", max, to_copy, copied));
-        if (!copied)
+        uint32_t cbWrittenMin = UINT32_MAX;
+
+        cbToRead = RT_MIN(cbToWrite, pThis->cbReadWriteBuf);
+        PDMDevHlpPhysRead(pDevIns, addr, pThis->pvReadWriteBuf, cbToRead); /** @todo Check rc? */
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        uint32_t cbWritten;
+
+        /* Just multiplex the output to the connected backends.
+         * No need to utilize the virtual mixer here (yet). */
+        PAC97DRIVER pDrv;
+        RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
         {
-            *stop = 1;
+            int rc2 = pDrv->pConnector->pfnWrite(pDrv->pConnector, pDrv->Out.pStrmOut,
+                                                 pThis->pvReadWriteBuf, cbToRead, &cbWritten);
+            AssertRCBreak(rc);
+            if (RT_FAILURE(rc2))
+                continue;
+
+            cbWrittenMin = RT_MIN(cbWrittenMin, cbWritten);
+            LogFlowFunc(("\tLUN#%RU8: cbWritten=%RU32, cWrittenMin=%RU32\n", pDrv->uLUN, cbWritten, cbWrittenMin));
+        }
+#else
+        cbWrittenMin = AUD_write(pThis->voice_po, pThis->pvReadWriteBuf, cbToRead);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+        LogFlowFunc(("\tcbToRead=%RU32, cbWrittenMin=%RU32, cbToWrite=%RU32, cbLeft=%RU32\n",
+                     cbToRead, cbWrittenMin, cbToWrite, cbToWrite - cbWrittenMin));
+
+        if (!cbWrittenMin)
+        {
+            rc = VINF_EOF;
             break;
         }
-        temp    -= copied;
-        addr    += copied;
-        written += copied;
+
+        Assert(cbWrittenMin != UINT32_MAX);
+        Assert(cbToWrite >= cbWrittenMin);
+        cbToWrite      -= cbWrittenMin;
+        addr           += cbWrittenMin;
+        cbWrittenTotal += cbWrittenMin;
     }
 
-    if (!temp)
+    pReg->bd.addr = addr;
+
+    if (RT_SUCCESS(rc))
     {
-        if (to_copy < 4)
+        if (!cbToWrite) /* All data written? */
         {
-            Log(("ac97: whoops\n"));
-            pThis->last_samp = 0;
+            if (cbToRead < 4)
+            {
+                AssertMsgFailed(("Unable to save last written sample, cbToRead < 4 (is %RU32)\n", cbToRead));
+                pThis->last_samp = 0;
+            }
+            else
+                pThis->last_samp = *(uint32_t *)&pThis->pvReadWriteBuf[cbToRead - 4];
         }
-        else
-            pThis->last_samp = *(uint32_t *)&tmpbuf[to_copy - 4];
+
+        *pcbWritten = cbWrittenTotal;
     }
 
-    pReg->bd.addr = addr;
-    return written;
+    LogFlowFunc(("cbWrittenTotal=%RU32, rc=%Rrc\n", cbWrittenTotal, rc));
+    return rc;
 }
 
-static void write_bup(PAC97STATE pThis, int elapsed)
+static void ichac97WriteBUP(PAC97STATE pThis, uint32_t cbElapsed)
 {
-    int written = 0;
-
-    Log(("ac97: write_bup\n"));
     if (!(pThis->bup_flag & BUP_SET))
     {
         if (pThis->bup_flag & BUP_LAST)
@@ -684,43 +1173,113 @@ static void write_bup(PAC97STATE pThis, int elapsed)
                 *p++ = pThis->last_samp;
         }
         else
-            memset(pThis->silence, 0, sizeof(pThis->silence));
+            RT_ZERO(pThis->silence);
 
         pThis->bup_flag |= BUP_SET;
     }
 
-    while (elapsed)
+    while (cbElapsed)
     {
-        unsigned int temp = audio_MIN((unsigned int)elapsed, sizeof(pThis->silence));
-        while (temp)
+        uint32_t cbWrittenMin = UINT32_MAX;
+
+        uint32_t cbToWrite = RT_MIN(cbElapsed, (uint32_t)sizeof(pThis->silence));
+        while (cbToWrite)
         {
-            int copied = AUD_write(pThis->voice_po, pThis->silence, temp);
-            if (!copied)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            PAC97DRIVER pDrv;
+            uint32_t cbWritten;
+            RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+            {
+                int rc2 = pDrv->pConnector->pfnWrite(pDrv->pConnector, pDrv->Out.pStrmOut,
+                                                     pThis->silence, cbToWrite, &cbWritten);
+                if (RT_FAILURE(rc2))
+                    continue;
+
+                cbWrittenMin = RT_MIN(cbWrittenMin, cbWritten);
+            }
+#else
+            cbWrittenMin = AUD_write(pThis->voice_po, pThis->silence, cbToWrite);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+            if (!cbWrittenMin)
                 return;
-            temp    -= copied;
-            elapsed -= copied;
-            written += copied;
+
+            Assert(cbToWrite >= cbWrittenMin);
+            cbToWrite -= cbWrittenMin;
+            Assert(cbElapsed >= cbWrittenMin);
+            cbElapsed -= cbWrittenMin;
         }
     }
 }
 
-static int read_audio(PAC97STATE pThis, PAC97BMREG pReg, int max, int *stop)
+static int ichac97ReadAudio(PAC97STATE pThis, PAC97BMREG pReg, uint32_t cbMax, uint32_t *pcbRead)
 {
-    PPDMDEVINS  pDevIns = ICHAC97STATE_2_DEVINS(pThis);
-    uint8_t     tmpbuf[4096];
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pReg, VERR_INVALID_POINTER);
+    AssertReturn(cbMax, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pcbRead, VERR_INVALID_POINTER);
+
+    PPDMDEVINS pDevIns = ICHAC97STATE_2_DEVINS(pThis);
+
+    int rc;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /* Select audio sink to process. */
+    PAUDMIXSINK pSink = (pReg - pThis->bm_regs) == MC_INDEX ? pThis->pSinkMicIn : pThis->pSinkLineIn;
+    AssertPtr(pSink);
+
+    uint32_t cbRead = 0;
+
+    uint32_t cbMixBuf = cbMax;
+    uint32_t cbToRead = RT_MIN((uint32_t)(pReg->picb << 1), cbMixBuf);
+
+    if (!cbToRead)
+    {
+        *pcbRead = 0;
+        return VINF_EOF;
+    }
+
+    uint8_t *pvMixBuf = (uint8_t *)RTMemAlloc(cbMixBuf);
+    if (pvMixBuf)
+    {
+        rc = audioMixerProcessSinkIn(pSink, AUDMIXOP_BLEND, pvMixBuf, cbToRead, &cbRead);
+        if (   RT_SUCCESS(rc)
+            && cbRead)
+        {
+            PDMDevHlpPCIPhysWrite(pDevIns, pReg->bd.addr, pvMixBuf, cbRead);
+            pReg->bd.addr += cbRead;
+        }
+
+        RTMemFree(pvMixBuf);
+    }
+    else
+        rc = VERR_NO_MEMORY;
+
+    if (RT_SUCCESS(rc))
+    {
+        Assert(cbRead);
+        *pcbRead = cbRead;
+    }
+
+    return rc;
+#else
+    rc = VINF_SUCCESS;
+
     uint32_t    addr = pReg->bd.addr;
     uint32_t    temp = pReg->picb << 1;
     uint32_t    nread = 0;
     int         to_copy = 0;
+
     SWVoiceIn  *voice = (pReg - pThis->bm_regs) == MC_INDEX ? pThis->voice_mc : pThis->voice_pi;
 
-    temp = audio_MIN(temp, (uint32_t)max);
+    temp = audio_MIN(temp, (uint32_t)cbMax);
     if (!temp)
     {
-        *stop = 1;
-        return 0;
+        *pcbRead = 0;
+        return VINF_EOF;
     }
 
+    uint8_t tmpbuf[4096];
     while (temp)
     {
         int acquired;
@@ -728,7 +1287,7 @@ static int read_audio(PAC97STATE pThis, PAC97BMREG pReg, int max, int *stop)
         acquired = AUD_read(voice, tmpbuf, to_copy);
         if (!acquired)
         {
-            *stop = 1;
+            rc = VERR_GENERAL_FAILURE; /* Not worth fixing anymore. */
             break;
         }
         PDMDevHlpPCIPhysWrite(pDevIns, addr, tmpbuf, acquired);
@@ -738,115 +1297,242 @@ static int read_audio(PAC97STATE pThis, PAC97BMREG pReg, int max, int *stop)
     }
 
     pReg->bd.addr = addr;
-    return nread;
+
+    if (RT_SUCCESS(rc))
+        *pcbRead = nread;
+
+    return rc;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 }
 
-static void transfer_audio(PAC97STATE pThis, int index, int elapsed)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static DECLCALLBACK(void) ichac97Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
 {
-    PAC97BMREG pReg = &pThis->bm_regs[index];
-    int written = 0;
-    int stop = 0;
+    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
+    AssertPtrReturnVoid(pThis);
+
+    STAM_PROFILE_START(&pThis->StatTimer, a);
+
+    int rc = VINF_SUCCESS;
+
+    uint32_t cbInMax  = 0;
+    uint32_t cbOutMin = UINT32_MAX;
 
-    if (pReg->sr & SR_DCH)
+    PAC97DRIVER pDrv;
+
+    uint32_t cbIn, cbOut, cSamplesLive;
+    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+    {
+        rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
+                                              &cbIn, &cbOut, &cSamplesLive);
+        if (RT_SUCCESS(rc))
+        {
+#ifdef DEBUG_TIMER
+            LogFlowFunc(("\tLUN#%RU8: [1] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
+#endif
+            if (cSamplesLive)
+            {
+                uint32_t cSamplesPlayed;
+                int rc2 = pDrv->pConnector->pfnPlayOut(pDrv->pConnector, &cSamplesPlayed);
+#ifdef DEBUG_TIMER
+                if (RT_SUCCESS(rc2))
+                    LogFlowFunc(("LUN#%RU8: cSamplesLive=%RU32, cSamplesPlayed=%RU32\n",
+                                 pDrv->uLUN, cSamplesLive, cSamplesPlayed));
+#endif
+                if (cSamplesPlayed)
+                {
+                    rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
+                                                          &cbIn, &cbOut, &cSamplesLive);
+#ifdef DEBUG_TIMER
+                    if (RT_SUCCESS(rc))
+                        LogFlowFunc(("\tLUN#%RU8: [2] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
+#endif
+                }
+            }
+
+            cbInMax  = RT_MAX(cbInMax, cbIn);
+            cbOutMin = RT_MIN(cbOutMin, cbOut);
+        }
+    }
+
+#ifdef DEBUG_TIMER
+    LogFlowFunc(("cbInMax=%RU32, cbOutMin=%RU32\n", cbInMax, cbOutMin));
+#endif
+
+    if (cbOutMin == UINT32_MAX)
+        cbOutMin = 0;
+
+    /*
+     * Playback.
+     */
+    if (cbOutMin)
+    {
+        Assert(cbOutMin != UINT32_MAX);
+        ichac97TransferAudio(pThis, PO_INDEX, cbOutMin); /** @todo Add rc! */
+    }
+
+    /*
+     * Recording.
+     */
+    if (cbInMax)
+        ichac97TransferAudio(pThis, PI_INDEX, cbInMax); /** @todo Add rc! */
+
+    TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->uTicks);
+
+    STAM_PROFILE_STOP(&pThis->StatTimer, a);
+}
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+static int ichac97TransferAudio(PAC97STATE pThis, int index, uint32_t cbElapsed)
+{
+    LogFlowFunc(("pThis=%p, index=%d, cbElapsed=%RU32\n", pThis, index, cbElapsed));
+
+    PAC97BMREG pReg = &pThis->bm_regs[index];
+    if (pReg->sr & SR_DCH) /* Controller halted? */
     {
         if (pReg->cr & CR_RPBM)
         {
             switch (index)
             {
                 case PO_INDEX:
-                    write_bup(pThis, elapsed);
+                    ichac97WriteBUP(pThis, cbElapsed);
+                    break;
+
+                default:
                     break;
             }
         }
-        return;
+
+        return VINF_SUCCESS;
     }
 
-    while ((elapsed >> 1) && !stop)
-    {
-        int temp;
+    int rc = VINF_SUCCESS;
+    uint32_t cbWrittenTotal = 0;
 
+    while (cbElapsed >> 1)
+    {
         if (!pReg->bd_valid)
         {
-            Log(("ac97: invalid bd\n"));
-            fetch_bd(pThis, pReg);
+            LogFlowFunc(("Invalid buffer descriptor, fetching next one ...\n"));
+            ichac97FetchBufDesc(pThis, pReg);
         }
 
-        if (!pReg->picb)
+        if (!pReg->picb) /* Got a new buffer descriptor, that is, the position is 0? */
         {
-            Log(("ac97: fresh bd %d is empty %#x %#x, skipping\n", pReg->civ, pReg->bd.addr, pReg->bd.ctl_len));
+            LogFlowFunc(("Fresh buffer descriptor %RU8 is empty, addr=%#x, len=%#x, skipping\n",
+                         pReg->civ, pReg->bd.addr, pReg->bd.ctl_len));
             if (pReg->civ == pReg->lvi)
             {
                 pReg->sr |= SR_DCH; /* CELV? */
                 pThis->bup_flag = 0;
+
+                rc = VINF_EOF;
                 break;
             }
+
             pReg->sr &= ~SR_CELV;
             pReg->civ = pReg->piv;
             pReg->piv = (pReg->piv + 1) % 32;
-            fetch_bd(pThis, pReg);
+
+            ichac97FetchBufDesc(pThis, pReg);
             continue;
         }
 
+        uint32_t cbTransferred;
         switch (index)
         {
             case PO_INDEX:
-                temp = write_audio(pThis, pReg, elapsed, &stop);
-                written += temp;
-                elapsed -= temp;
-                Assert((temp & 1) == 0);    /* Else the following shift won't work */
-                pReg->picb -= (temp >> 1);
+            {
+                rc = ichac97WriteAudio(pThis, pReg, cbElapsed, &cbTransferred);
+                if (   RT_SUCCESS(rc)
+                    && cbTransferred)
+                {
+                    cbWrittenTotal += cbTransferred;
+                    Assert(cbElapsed >= cbTransferred);
+                    cbElapsed      -= cbTransferred;
+                    Assert((cbTransferred & 1) == 0);    /* Else the following shift won't work */
+                    pReg->picb     -= (cbTransferred >> 1);
+                }
                 break;
+            }
 
             case PI_INDEX:
             case MC_INDEX:
-                temp = read_audio(pThis, pReg, elapsed, &stop);
-                elapsed -= temp;
-                Assert((temp & 1) == 0);    /* Else the following shift won't work */
-                pReg->picb -= (temp >> 1);
+            {
+                rc = ichac97ReadAudio(pThis, pReg, cbElapsed, &cbTransferred);
+                if (   RT_SUCCESS(rc)
+                    && cbTransferred)
+                {
+                    Assert(cbElapsed >= cbTransferred);
+                    cbElapsed  -= cbTransferred;
+                    Assert((cbTransferred & 1) == 0);    /* Else the following shift won't work */
+                    pReg->picb -= (cbTransferred >> 1);
+                }
+                break;
+            }
+
+            default:
+                AssertMsgFailed(("Index %ld not supported\n", index));
+                rc = VERR_NOT_SUPPORTED;
                 break;
         }
 
-        Log(("pReg->picb = %d\n", pReg->picb));
+        LogFlowFunc(("pReg->picb=%#x, cbWrittenTotal=%RU32\n", pReg->picb, cbWrittenTotal));
 
         if (!pReg->picb)
         {
             uint32_t new_sr = pReg->sr & ~SR_CELV;
 
             if (pReg->bd.ctl_len & BD_IOC)
+            {
                 new_sr |= SR_BCIS;
+            }
 
             if (pReg->civ == pReg->lvi)
             {
-                Log(("ac97: Underrun civ (%d) == lvi (%d)\n", pReg->civ, pReg->lvi));
+                LogFlowFunc(("Underrun civ (%RU8) == lvi (%RU8)\n", pReg->civ, pReg->lvi));
                 new_sr |= SR_LVBCI | SR_DCH | SR_CELV;
-                stop = 1;
                 pThis->bup_flag = (pReg->bd.ctl_len & BD_BUP) ? BUP_LAST : 0;
+
+                rc = VINF_EOF;
             }
             else
             {
                 pReg->civ = pReg->piv;
                 pReg->piv = (pReg->piv + 1) % 32;
-                fetch_bd(pThis, pReg);
+                ichac97FetchBufDesc(pThis, pReg);
             }
-            update_sr(pThis, pReg, new_sr);
+
+            ichac97UpdateStatus(pThis, pReg, new_sr);
+        }
+
+        if (   RT_FAILURE(rc)
+            || rc == VINF_EOF) /* All data processed? */
+        {
+            break;
         }
     }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
 }
 
-static void pi_callback(void *opaque, int avail)
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
+static void ichac97InputCallback(void *pvContext, int cbAvail)
 {
-    transfer_audio((AC97STATE *)opaque, PI_INDEX, avail);
+    ichac97TransferAudio((AC97STATE *)pvContext, PI_INDEX, cbAvail);
 }
 
-static void mc_callback(void *opaque, int avail)
+static void ichac97MicInCallback(void *pvContext, int cbAvail)
 {
-    transfer_audio((AC97STATE *)opaque, MC_INDEX, avail);
+    ichac97TransferAudio((AC97STATE *)pvContext, MC_INDEX, cbAvail);
 }
 
-static void po_callback(void *opaque, int free)
+static void ichac97OutputCallback(void *pvContext, int cbFree)
 {
-    transfer_audio((AC97STATE *)opaque, PO_INDEX, free);
+    ichac97TransferAudio((AC97STATE *)pvContext, PO_INDEX, cbFree);
 }
+#endif
 
 /**
  * @callback_method_impl{FNIOMIOPORTIN}
@@ -867,7 +1553,7 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
             {
                 case CAS:
                     /* Codec Access Semaphore Register */
-                    Log(("ac97: CAS %d\n", pThis->cas));
+                    LogFlowFunc(("CAS %d\n", pThis->cas));
                     *pu32 = pThis->cas;
                     pThis->cas = 1;
                     break;
@@ -877,7 +1563,7 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                     /* Current Index Value Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->civ;
-                    Log(("ac97: CIV[%d] -> %#x\n", GET_BM(index), *pu32));
+                    LogFlowFunc(("CIV[%d] -> %#x\n", GET_BM(index), *pu32));
                     break;
                 case PI_LVI:
                 case PO_LVI:
@@ -885,7 +1571,7 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                     /* Last Valid Index Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->lvi;
-                    Log(("ac97: LVI[%d] -> %#x\n", GET_BM(index), *pu32));
+                    LogFlowFunc(("LVI[%d] -> %#x\n", GET_BM(index), *pu32));
                     break;
                 case PI_PIV:
                 case PO_PIV:
@@ -893,7 +1579,7 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                     /* Prefetched Index Value Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->piv;
-                    Log(("ac97: PIV[%d] -> %#x\n", GET_BM(index), *pu32));
+                    LogFlowFunc(("PIV[%d] -> %#x\n", GET_BM(index), *pu32));
                     break;
                 case PI_CR:
                 case PO_CR:
@@ -901,7 +1587,7 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                     /* Control Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->cr;
-                    Log(("ac97: CR[%d] -> %#x\n", GET_BM(index), *pu32));
+                    LogFlowFunc(("CR[%d] -> %#x\n", GET_BM(index), *pu32));
                     break;
                 case PI_SR:
                 case PO_SR:
@@ -909,10 +1595,10 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                     /* Status Register (lower part) */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->sr & 0xff;
-                    Log(("ac97: SRb[%d] -> %#x\n", GET_BM(index), *pu32));
+                    LogFlowFunc(("SRb[%d] -> %#x\n", GET_BM(index), *pu32));
                     break;
                 default:
-                    Log(("ac97: U nabm readb %#x -> %#x\n", Port, *pu32));
+                    LogFlowFunc(("U nabm readb %#x -> %#x\n", Port, *pu32));
                     break;
             }
             break;
@@ -932,7 +1618,7 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                     /* Status Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->sr;
-                    Log(("ac97: SR[%d] -> %#x\n", GET_BM(index), *pu32));
+                    LogFlowFunc(("SR[%d] -> %#x\n", GET_BM(index), *pu32));
                     break;
                 case PI_PICB:
                 case PO_PICB:
@@ -940,10 +1626,10 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                     /* Position in Current Buffer Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->picb;
-                    Log(("ac97: PICB[%d] -> %#x\n", GET_BM(index), *pu32));
+                    LogFlowFunc(("PICB[%d] -> %#x\n", GET_BM(index), *pu32));
                     break;
                 default:
-                    Log(("ac97: U nabm readw %#x -> %#x\n", Port, *pu32));
+                    LogFlowFunc(("U nabm readw %#x -> %#x\n", Port, *pu32));
                     break;
             }
             break;
@@ -963,7 +1649,7 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                     /* Buffer Descriptor Base Address Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->bdbar;
-                    Log(("ac97: BMADDR[%d] -> %#x\n", GET_BM(index), *pu32));
+                    LogFlowFunc(("BMADDR[%d] -> %#x\n", GET_BM(index), *pu32));
                     break;
                 case PI_CIV:
                 case PO_CIV:
@@ -973,7 +1659,7 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                      *                Status Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->civ | (pReg->lvi << 8) | (pReg->sr << 16);
-                    Log(("ac97: CIV LVI SR[%d] -> %#x, %#x, %#x\n", GET_BM(index), pReg->civ, pReg->lvi, pReg->sr));
+                    LogFlowFunc(("CIV LVI SR[%d] -> %#x, %#x, %#x\n", GET_BM(index), pReg->civ, pReg->lvi, pReg->sr));
                     break;
                 case PI_PICB:
                 case PO_PICB:
@@ -983,20 +1669,20 @@ static DECLCALLBACK(int) ichac97IOPortNABMRead(PPDMDEVINS pDevIns, void *pvUser,
                      *                Control Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     *pu32 = pReg->picb | (pReg->piv << 16) | (pReg->cr << 24);
-                    Log(("ac97: PICB PIV CR[%d] -> %#x %#x %#x %#x\n", GET_BM(index), *pu32, pReg->picb, pReg->piv, pReg->cr));
+                    LogFlowFunc(("PICB PIV CR[%d] -> %#x %#x %#x %#x\n", GET_BM(index), *pu32, pReg->picb, pReg->piv, pReg->cr));
                     break;
                 case GLOB_CNT:
                     /* Global Control */
                     *pu32 = pThis->glob_cnt;
-                    Log(("ac97: glob_cnt -> %#x\n", *pu32));
+                    LogFlowFunc(("glob_cnt -> %#x\n", *pu32));
                     break;
                 case GLOB_STA:
                     /* Global Status */
                     *pu32 = pThis->glob_sta | GS_S0CR;
-                    Log(("ac97: glob_sta -> %#x\n", *pu32));
+                    LogFlowFunc(("glob_sta -> %#x\n", *pu32));
                     break;
                 default:
-                    Log(("ac97: U nabm readl %#x -> %#x\n", Port, *pu32));
+                    LogFlowFunc(("U nabm readl %#x -> %#x\n", Port, *pu32));
                     break;
             }
             break;
@@ -1033,10 +1719,10 @@ static DECLCALLBACK(int) ichac97IOPortNABMWrite(PPDMDEVINS pDevIns, void *pvUser
                         pReg->sr &= ~(SR_DCH | SR_CELV);
                         pReg->civ = pReg->piv;
                         pReg->piv = (pReg->piv + 1) % 32;
-                        fetch_bd(pThis, pReg);
+                        ichac97FetchBufDesc(pThis, pReg);
                     }
                     pReg->lvi = u32 % 32;
-                    Log(("ac97: LVI[%d] <- %#x\n", GET_BM(index), u32));
+                    LogFlowFunc(("LVI[%d] <- %#x\n", GET_BM(index), u32));
                     break;
                 case PI_CR:
                 case PO_CR:
@@ -1044,25 +1730,25 @@ static DECLCALLBACK(int) ichac97IOPortNABMWrite(PPDMDEVINS pDevIns, void *pvUser
                     /* Control Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     if (u32 & CR_RR)
-                        reset_bm_regs(pThis, pReg);
+                        ichac97ResetBMRegs(pThis, pReg);
                     else
                     {
                         pReg->cr = u32 & CR_VALID_MASK;
                         if (!(pReg->cr & CR_RPBM))
                         {
-                            voice_set_active(pThis, pReg - pThis->bm_regs, 0);
+                            ichac97StreamSetActive(pThis, pReg - pThis->bm_regs, 0);
                             pReg->sr |= SR_DCH;
                         }
                         else
                         {
                             pReg->civ = pReg->piv;
                             pReg->piv = (pReg->piv + 1) % 32;
-                            fetch_bd(pThis, pReg);
+                            ichac97FetchBufDesc(pThis, pReg);
                             pReg->sr &= ~SR_DCH;
-                            voice_set_active(pThis, pReg - pThis->bm_regs, 1);
+                            ichac97StreamSetActive(pThis, pReg - pThis->bm_regs, 1);
                         }
                     }
-                    Log(("ac97: CR[%d] <- %#x (cr %#x)\n", GET_BM(index), u32, pReg->cr));
+                    LogFlowFunc(("CR[%d] <- %#x (cr %#x)\n", GET_BM(index), u32, pReg->cr));
                     break;
                 case PI_SR:
                 case PO_SR:
@@ -1070,11 +1756,11 @@ static DECLCALLBACK(int) ichac97IOPortNABMWrite(PPDMDEVINS pDevIns, void *pvUser
                     /* Status Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     pReg->sr |= u32 & ~(SR_RO_MASK | SR_WCLEAR_MASK);
-                    update_sr(pThis, pReg, pReg->sr & ~(u32 & SR_WCLEAR_MASK));
-                    Log(("ac97: SR[%d] <- %#x (sr %#x)\n", GET_BM(index), u32, pReg->sr));
+                    ichac97UpdateStatus(pThis, pReg, pReg->sr & ~(u32 & SR_WCLEAR_MASK));
+                    LogFlowFunc(("SR[%d] <- %#x (sr %#x)\n", GET_BM(index), u32, pReg->sr));
                     break;
                 default:
-                    Log(("ac97: U nabm writeb %#x <- %#x\n", Port, u32));
+                    LogFlowFunc(("U nabm writeb %#x <- %#x\n", Port, u32));
                     break;
             }
             break;
@@ -1092,11 +1778,11 @@ static DECLCALLBACK(int) ichac97IOPortNABMWrite(PPDMDEVINS pDevIns, void *pvUser
                     /* Status Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     pReg->sr |= u32 & ~(SR_RO_MASK | SR_WCLEAR_MASK);
-                    update_sr(pThis, pReg, pReg->sr & ~(u32 & SR_WCLEAR_MASK));
-                    Log(("ac97: SR[%d] <- %#x (sr %#x)\n", GET_BM(index), u32, pReg->sr));
+                    ichac97UpdateStatus(pThis, pReg, pReg->sr & ~(u32 & SR_WCLEAR_MASK));
+                    LogFlowFunc(("SR[%d] <- %#x (sr %#x)\n", GET_BM(index), u32, pReg->sr));
                     break;
                 default:
-                    Log(("ac97: U nabm writew %#x <- %#x\n", Port, u32));
+                    LogFlowFunc(("U nabm writew %#x <- %#x\n", Port, u32));
                     break;
             }
             break;
@@ -1114,26 +1800,26 @@ static DECLCALLBACK(int) ichac97IOPortNABMWrite(PPDMDEVINS pDevIns, void *pvUser
                     /* Buffer Descriptor list Base Address Register */
                     pReg = &pThis->bm_regs[GET_BM(index)];
                     pReg->bdbar = u32 & ~3;
-                    Log(("ac97: BDBAR[%d] <- %#x (bdbar %#x)\n", GET_BM(index), u32, pReg->bdbar));
+                    LogFlowFunc(("BDBAR[%d] <- %#x (bdbar %#x)\n", GET_BM(index), u32, pReg->bdbar));
                     break;
                 case GLOB_CNT:
                     /* Global Control */
                     if (u32 & GC_WR)
-                        warm_reset(pThis);
+                        ichac97WarmReset(pThis);
                     if (u32 & GC_CR)
-                        cold_reset(pThis);
+                        ichac97ColdReset(pThis);
                     if (!(u32 & (GC_WR | GC_CR)))
                         pThis->glob_cnt = u32 & GC_VALID_MASK;
-                    Log(("ac97: glob_cnt <- %#x (glob_cnt %#x)\n", u32, pThis->glob_cnt));
+                    LogFlowFunc(("glob_cnt <- %#x (glob_cnt %#x)\n", u32, pThis->glob_cnt));
                     break;
                 case GLOB_STA:
                     /* Global Status */
                     pThis->glob_sta &= ~(u32 & GS_WCLEAR_MASK);
                     pThis->glob_sta |= (u32 & ~(GS_WCLEAR_MASK | GS_RO_MASK)) & GS_VALID_MASK;
-                    Log(("ac97: glob_sta <- %#x (glob_sta %#x)\n", u32, pThis->glob_sta));
+                    LogFlowFunc(("glob_sta <- %#x (glob_sta %#x)\n", u32, pThis->glob_sta));
                     break;
                 default:
-                    Log(("ac97: U nabm writel %#x <- %#x\n", Port, u32));
+                    LogFlowFunc(("U nabm writel %#x <- %#x\n", Port, u32));
                     break;
             }
             break;
@@ -1157,7 +1843,7 @@ static DECLCALLBACK(int) ichac97IOPortNAMRead(PPDMDEVINS pDevIns, void *pvUser,
     {
         case 1:
         {
-            Log(("ac97: U nam readb %#x\n", Port));
+            LogFlowFunc(("U nam readb %#x\n", Port));
             pThis->cas = 0;
             *pu32 = ~0U;
             break;
@@ -1171,8 +1857,8 @@ static DECLCALLBACK(int) ichac97IOPortNAMRead(PPDMDEVINS pDevIns, void *pvUser,
             switch (index)
             {
                 default:
-                    *pu32 = mixer_load(pThis, index);
-                    Log(("ac97: nam readw %#x -> %#x\n", Port, *pu32));
+                    *pu32 = ichac97MixerLoad(pThis, index);
+                    LogFlowFunc(("nam readw %#x -> %#x\n", Port, *pu32));
                     break;
             }
             break;
@@ -1180,7 +1866,7 @@ static DECLCALLBACK(int) ichac97IOPortNAMRead(PPDMDEVINS pDevIns, void *pvUser,
 
         case 4:
         {
-            Log(("ac97: U nam readl %#x\n", Port));
+            LogFlowFunc(("U nam readl %#x\n", Port));
             pThis->cas = 0;
             *pu32 = ~0U;
             break;
@@ -1195,7 +1881,8 @@ static DECLCALLBACK(int) ichac97IOPortNAMRead(PPDMDEVINS pDevIns, void *pvUser,
 /**
  * @callback_method_impl{FNIOMIOPORTOUT}
  */
-static DECLCALLBACK(int) ichac97IOPortNAMWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
+static DECLCALLBACK(int) ichac97IOPortNAMWrite(PPDMDEVINS pDevIns,
+                                               void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
 {
     PAC97STATE pThis = (PAC97STATE)pvUser;
 
@@ -1203,7 +1890,7 @@ static DECLCALLBACK(int) ichac97IOPortNAMWrite(PPDMDEVINS pDevIns, void *pvUser,
     {
         case 1:
         {
-            Log(("ac97: U nam writeb %#x <- %#x\n", Port, u32));
+            LogFlowFunc(("U nam writeb %#x <- %#x\n", Port, u32));
             pThis->cas = 0;
             break;
         }
@@ -1215,90 +1902,93 @@ static DECLCALLBACK(int) ichac97IOPortNAMWrite(PPDMDEVINS pDevIns, void *pvUser,
             switch (index)
             {
                 case AC97_Reset:
-                    mixer_reset(pThis);
+                    ichac97MixerReset(pThis);
                     break;
                 case AC97_Powerdown_Ctrl_Stat:
                     u32 &= ~0xf;
-                    u32 |= mixer_load(pThis, index) & 0xf;
-                    mixer_store(pThis, index, u32);
+                    u32 |= ichac97MixerLoad(pThis, index) & 0xf;
+                    ichac97MixerStore(pThis, index, u32);
                     break;
-#ifdef USE_MIXER
                 case AC97_Master_Volume_Mute:
-                    set_volume(pThis, index, AUD_MIXER_VOLUME, u32);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    ichac97SetVolume(pThis, index, PDMAUDIOMIXERCTL_VOLUME, u32);
+#else
+                    ichac97SetVolume(pThis, index, AUD_MIXER_VOLUME, u32);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
                     break;
                 case AC97_PCM_Out_Volume_Mute:
-                    set_volume(pThis, index, AUD_MIXER_PCM, u32);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    ichac97SetVolume(pThis, index, PDMAUDIOMIXERCTL_PCM, u32);
+#else
+                    ichac97SetVolume(pThis, index, AUD_MIXER_PCM, u32);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
                     break;
                 case AC97_Line_In_Volume_Mute:
-                    set_volume(pThis, index, AUD_MIXER_LINE_IN, u32);
-                    break;
-                case AC97_Record_Select:
-                    record_select(pThis, u32);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    ichac97SetVolume(pThis, index, PDMAUDIOMIXERCTL_LINE_IN, u32);
+#else
+                    ichac97SetVolume(pThis, index, AUD_MIXER_LINE_IN, u32);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
                     break;
-#else  /* !USE_MIXER */
-                case AC97_Master_Volume_Mute:
-                case AC97_PCM_Out_Volume_Mute:
-                case AC97_Line_In_Volume_Mute:
                 case AC97_Record_Select:
-                    mixer_store(pThis, index, u32);
+                    ichac97RecordSelect(pThis, u32);
                     break;
-#endif /* !USE_MIXER */
                 case AC97_Vendor_ID1:
                 case AC97_Vendor_ID2:
-                    Log(("ac97: Attempt to write vendor ID to %#x\n", u32));
+                    LogFlowFunc(("Attempt to write vendor ID to %#x\n", u32));
                     break;
                 case AC97_Extended_Audio_ID:
-                    Log(("ac97: Attempt to write extended audio ID to %#x\n", u32));
+                    LogFlowFunc(("Attempt to write extended audio ID to %#x\n", u32));
                     break;
                 case AC97_Extended_Audio_Ctrl_Stat:
                     if (!(u32 & EACS_VRA))
                     {
-                        mixer_store(pThis, AC97_PCM_Front_DAC_Rate, 0xbb80);
-                        mixer_store(pThis, AC97_PCM_LR_ADC_Rate,    0xbb80);
-                        open_voice(pThis, PI_INDEX, 48000);
-                        open_voice(pThis, PO_INDEX, 48000);
+                        ichac97MixerStore(pThis, AC97_PCM_Front_DAC_Rate, 0xbb80);
+                        ichac97MixerStore(pThis, AC97_PCM_LR_ADC_Rate,    0xbb80);
+                        ichac97OpenStream(pThis, PI_INDEX, 48000);
+                        ichac97OpenStream(pThis, PO_INDEX, 48000);
                     }
                     if (!(u32 & EACS_VRM))
                     {
-                        mixer_store(pThis, AC97_MIC_ADC_Rate, 0xbb80);
-                        open_voice(pThis, MC_INDEX, 48000);
+                        ichac97MixerStore(pThis, AC97_MIC_ADC_Rate, 0xbb80);
+                        ichac97OpenStream(pThis, MC_INDEX, 48000);
                     }
-                    Log(("ac97: Setting extended audio control to %#x\n", u32));
-                    mixer_store(pThis, AC97_Extended_Audio_Ctrl_Stat, u32);
+                    LogFlowFunc(("Setting extended audio control to %#x\n", u32));
+                    ichac97MixerStore(pThis, AC97_Extended_Audio_Ctrl_Stat, u32);
                     break;
                 case AC97_PCM_Front_DAC_Rate:
-                    if (mixer_load(pThis, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA)
+                    if (ichac97MixerLoad(pThis, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA)
                     {
-                        mixer_store(pThis, index, u32);
-                        Log(("ac97: Set front DAC rate to %d\n", u32));
-                        open_voice(pThis, PO_INDEX, u32);
+                        ichac97MixerStore(pThis, index, u32);
+                        LogFlowFunc(("Set front DAC rate to %d\n", u32));
+                        ichac97OpenStream(pThis, PO_INDEX, u32);
                     }
                     else
-                        Log(("ac97: Attempt to set front DAC rate to %d, but VRA is not set\n", u32));
+                        LogFlowFunc(("Attempt to set front DAC rate to %d, but VRA is not set\n", u32));
                     break;
                 case AC97_MIC_ADC_Rate:
-                    if (mixer_load(pThis, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM)
+                    if (ichac97MixerLoad(pThis, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRM)
                     {
-                        mixer_store(pThis, index, u32);
-                        Log(("ac97: Set MIC ADC rate to %d\n", u32));
-                        open_voice(pThis, MC_INDEX, u32);
+                        ichac97MixerStore(pThis, index, u32);
+                        LogFlowFunc(("Set MIC ADC rate to %d\n", u32));
+                        ichac97OpenStream(pThis, MC_INDEX, u32);
                     }
                     else
-                        Log(("ac97: Attempt to set MIC ADC rate to %d, but VRM is not set\n", u32));
+                        LogFlowFunc(("Attempt to set MIC ADC rate to %d, but VRM is not set\n", u32));
                     break;
                 case AC97_PCM_LR_ADC_Rate:
-                    if (mixer_load(pThis, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA)
+                    if (ichac97MixerLoad(pThis, AC97_Extended_Audio_Ctrl_Stat) & EACS_VRA)
                     {
-                        mixer_store(pThis, index, u32);
-                        Log(("ac97: Set front LR ADC rate to %d\n", u32));
-                        open_voice(pThis, PI_INDEX, u32);
+                        ichac97MixerStore(pThis, index, u32);
+                        LogFlowFunc(("Set front LR ADC rate to %d\n", u32));
+                        ichac97OpenStream(pThis, PI_INDEX, u32);
                     }
                     else
-                        Log(("ac97: Attempt to set LR ADC rate to %d, but VRA is not set\n", u32));
+                        LogFlowFunc(("Attempt to set LR ADC rate to %d, but VRA is not set\n", u32));
                     break;
                 default:
-                    Log(("ac97: U nam writew %#x <- %#x\n", Port, u32));
-                    mixer_store(pThis, index, u32);
+                    LogFlowFunc(("U nam writew %#x <- %#x\n", Port, u32));
+                    ichac97MixerStore(pThis, index, u32);
                     break;
             }
             break;
@@ -1306,7 +1996,7 @@ static DECLCALLBACK(int) ichac97IOPortNAMWrite(PPDMDEVINS pDevIns, void *pvUser,
 
         case 4:
         {
-            Log(("ac97: U nam writel %#x <- %#x\n", Port, u32));
+            LogFlowFunc(("U nam writel %#x <- %#x\n", Port, u32));
             pThis->cas = 0;
             break;
         }
@@ -1315,6 +2005,7 @@ static DECLCALLBACK(int) ichac97IOPortNAMWrite(PPDMDEVINS pDevIns, void *pvUser,
             AssertMsgFailed(("Port=%#x cb=%d u32=%#x\n", Port, cb, u32));
             break;
     }
+
     return VINF_SUCCESS;
 }
 
@@ -1348,7 +2039,7 @@ static DECLCALLBACK(int) ichac97IOPortMap(PPCIDEVICE pPciDev, int iRegion, RTGCP
     return VINF_SUCCESS;
 }
 
-
+#ifdef IN_RING3
 /**
  * @callback_method_impl{FNSSMDEVSAVEEXEC}
  */
@@ -1377,9 +2068,23 @@ static DECLCALLBACK(int) ichac97SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     SSMR3PutMem(pSSM, pThis->mixer_data, sizeof(pThis->mixer_data));
 
     uint8_t active[LAST_INDEX];
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PAC97DRIVER pDrv;
+    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+    {
+        PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector;
+        AssertPtr(pCon);
+        active[PI_INDEX] = pCon->pfnIsActiveIn (pCon, pDrv->LineIn.pStrmIn) ? 1 : 0;
+        active[PO_INDEX] = pCon->pfnIsActiveOut(pCon, pDrv->Out.pStrmOut)   ? 1 : 0;
+        active[MC_INDEX] = pCon->pfnIsActiveIn (pCon, pDrv->MicIn.pStrmIn)  ? 1 : 0;
+    }
+#else
     active[PI_INDEX] = AUD_is_active_in( pThis->voice_pi) ? 1 : 0;
     active[PO_INDEX] = AUD_is_active_out(pThis->voice_po) ? 1 : 0;
     active[MC_INDEX] = AUD_is_active_in( pThis->voice_mc) ? 1 : 0;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
     SSMR3PutMem(pSSM, active, sizeof(active));
 
     return VINF_SUCCESS;
@@ -1419,15 +2124,19 @@ static DECLCALLBACK(int) ichac97LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, ui
     uint8_t active[LAST_INDEX];
     SSMR3GetMem(pSSM, active, sizeof(active));
 
-#ifdef USE_MIXER
-    record_select(pThis, mixer_load(pThis, AC97_Record_Select));
-# define V_(a, b) set_volume(pThis, a, b, mixer_load(pThis, a))
+    ichac97RecordSelect(pThis, ichac97MixerLoad(pThis, AC97_Record_Select));
+# define V_(a, b) ichac97SetVolume(pThis, a, b, ichac97MixerLoad(pThis, a))
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    V_(AC97_Master_Volume_Mute,  PDMAUDIOMIXERCTL_VOLUME);
+    V_(AC97_PCM_Out_Volume_Mute, PDMAUDIOMIXERCTL_PCM);
+    V_(AC97_Line_In_Volume_Mute, PDMAUDIOMIXERCTL_LINE_IN);
+# else
     V_(AC97_Master_Volume_Mute,  AUD_MIXER_VOLUME);
     V_(AC97_PCM_Out_Volume_Mute, AUD_MIXER_PCM);
     V_(AC97_Line_In_Volume_Mute, AUD_MIXER_LINE_IN);
+# endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 # undef V_
-#endif /* USE_MIXER */
-    reset_voices(pThis, active);
+    ichac97ResetStreams(pThis, active);
 
     pThis->bup_flag = 0;
     pThis->last_samp = 0;
@@ -1455,24 +2164,137 @@ static DECLCALLBACK(void *) ichac97QueryInterface(struct PDMIBASE *pInterface, c
  * @remarks The original sources didn't install a reset handler, but it seems to
  *          make sense to me so we'll do it.
  */
-static DECLCALLBACK(void)  ac97Reset(PPDMDEVINS pDevIns)
+static DECLCALLBACK(void) ac97Reset(PPDMDEVINS pDevIns)
 {
     PAC97STATE pThis = PDMINS_2_DATA(pDevIns, AC97STATE *);
 
     /*
      * Reset the device state (will need pDrv later).
      */
-    reset_bm_regs(pThis, &pThis->bm_regs[0]);
-    reset_bm_regs(pThis, &pThis->bm_regs[1]);
-    reset_bm_regs(pThis, &pThis->bm_regs[2]);
+    ichac97ResetBMRegs(pThis, &pThis->bm_regs[0]);
+    ichac97ResetBMRegs(pThis, &pThis->bm_regs[1]);
+    ichac97ResetBMRegs(pThis, &pThis->bm_regs[2]);
 
     /*
      * Reset the mixer too. The Windows XP driver seems to rely on
      * this. At least it wants to read the vendor id before it resets
      * the codec manually.
      */
-    mixer_reset(pThis);
+    ichac97MixerReset(pThis);
+}
+
+
+/**
+ * @interface_method_impl{PDMDEVREG,pfnDestruct}
+ */
+static DECLCALLBACK(int) ichac97Destruct(PPDMDEVINS pDevIns)
+{
+    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
+
+    LogFlowFuncEnter();
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PAC97DRIVER pDrv;
+    while (!RTListIsEmpty(&pThis->lstDrv))
+    {
+        pDrv = RTListGetFirst(&pThis->lstDrv, AC97DRIVER, Node);
+
+        RTListNodeRemove(&pDrv->Node);
+        RTMemFree(pDrv);
+    }
+
+    if (pThis->pMixer)
+    {
+        audioMixerDestroy(pThis->pMixer);
+        pThis->pMixer = NULL;
+    }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    if (pThis->pvReadWriteBuf)
+    {
+        RTMemFree(pThis->pvReadWriteBuf);
+        pThis->pvReadWriteBuf = NULL;
+        pThis->cbReadWriteBuf = 0;
+    }
+
+    LogFlowFuncLeave();
+    return VINF_SUCCESS;
+}
+
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+/**
+ * Attach command.
+ *
+ * This is called to let the device attach to a driver for a specified LUN
+ * during runtime. This is not called during VM construction, the device
+ * constructor have to attach to all the available drivers.
+ *
+ * @returns VBox status code.
+ * @param   pDevIns     The device instance.
+ * @param   uLUN        The logical unit which is being detached.
+ * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
+ */
+static DECLCALLBACK(int) ichac97Attach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
+{
+    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
+
+    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
+                    ("AC'97 device does not support hotplugging\n"),
+                    VERR_INVALID_PARAMETER);
+
+    /*
+     * Attach driver.
+     */
+    char *pszDesc = NULL;
+    if (RTStrAPrintf(&pszDesc, "Audio driver port (AC'97) for LUN #%u", uLUN) <= 0)
+        AssertMsgReturn(pszDesc,
+                        ("Not enough memory for AC'97 driver port description of LUN #%u\n", uLUN),
+                        VERR_NO_MEMORY);
+
+    int rc = PDMDevHlpDriverAttach(pDevIns, uLUN,
+                                   &pThis->IBase, &pThis->pDrvBase, pszDesc);
+    if (RT_SUCCESS(rc))
+    {
+        PAC97DRIVER pDrv = (PAC97DRIVER)RTMemAllocZ(sizeof(AC97DRIVER));
+        if (pDrv)
+        {
+            pDrv->pConnector = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIAUDIOCONNECTOR);
+            AssertMsg(pDrv->pConnector != NULL,
+                      ("Configuration error: LUN #%u has no host audio interface, rc=%Rrc\n",
+                      uLUN, rc));
+            pDrv->pAC97State = pThis;
+            pDrv->uLUN = uLUN;
+
+            /*
+             * For now we always set the driver at LUN 0 as our primary
+             * host backend. This might change in the future.
+             */
+            if (pDrv->uLUN == 0)
+                pDrv->Flags |= PDMAUDIODRVFLAG_PRIMARY;
+
+            LogFunc(("LUN#%RU8: pCon=%p, drvFlags=0x%x\n", uLUN, pDrv->pConnector, pDrv->Flags));
+
+            /* Attach to driver list. */
+            RTListAppend(&pThis->lstDrv, &pDrv->Node);
+        }
+        else
+            rc = VERR_NO_MEMORY;
+    }
+    else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
+    {
+        LogFunc(("No attached driver for LUN #%u\n", uLUN));
+    }
+    else if (RT_FAILURE(rc))
+        AssertMsgFailed(("Failed to attach AC'97 LUN #%u (\"%s\"), rc=%Rrc\n",
+                        uLUN, pszDesc, rc));
+
+    RTStrFree(pszDesc);
+
+    LogFunc(("iLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));
+    return rc;
 }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
 
 /**
@@ -1480,8 +2302,12 @@ static DECLCALLBACK(void)  ac97Reset(PPDMDEVINS pDevIns)
  */
 static DECLCALLBACK(int) ichac97Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
 {
-    AC97STATE  *pThis = PDMINS_2_DATA(pDevIns, AC97STATE *);
-    int             rc;
+    PAC97STATE pThis = PDMINS_2_DATA(pDevIns, PAC97STATE);
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /* NB: This must be done *before* any possible failure (and running the destructor). */
+    RTListInit(&pThis->lstDrv);
+#endif
 
     Assert(iInstance == 0);
     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
@@ -1489,9 +2315,35 @@ static DECLCALLBACK(int) ichac97Construct(PPDMDEVINS pDevIns, int iInstance, PCF
     /*
      * Validations.
      */
-    if (!CFGMR3AreValuesValid(pCfg, "\0"))
+    if (!CFGMR3AreValuesValid(pCfg, "Type\0"))
         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
-                                N_("Invalid configuration for the AC97 device"));
+                                N_("Invalid configuration for the AC'97 device"));
+
+    /*
+     * Determine the chip type.
+     */
+    char szType[20];
+    int rc = CFGMR3QueryStringDef(pCfg, "Type", &szType[0], sizeof(szType), "STAC9700");
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
+                                N_("AC'97 configuration error: Querying \"Type\" as string failed"));
+
+    /*
+     * The AD1980 codec (with corresponding PCI subsystem vendor ID) is whitelisted
+     * in the Linux kernel; Linux makes no attempt to measure the data rate and assumes
+     * 48 kHz rate, which is exactly what we need.
+     */
+    bool fChipAD1980 = false;
+    if (!strcmp(szType, "STAC9700"))
+        fChipAD1980 = false;
+    else if (!strcmp(szType, "AD1980"))
+        fChipAD1980 = true;
+    else
+    {
+        return PDMDevHlpVMSetError(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, RT_SRC_POS,
+                                   N_("AC'97 configuration error: The \"Type\" value \"%s\" is unsupported"),
+                                   szType);
+    }
 
     /*
      * Initialize data (most of it anyway).
@@ -1514,11 +2366,20 @@ static DECLCALLBACK(int) ichac97Construct(PPDMDEVINS pDevIns, int iInstance, PCF
                                true /* fIoSpace */, false /* fPrefetchable */, false /* f64Bit */, 0x00000000); Assert(pThis->PciDev.config[0x10] == 0x01); Assert(pThis->PciDev.config[0x11] == 0x00); Assert(pThis->PciDev.config[0x12] == 0x00); Assert(pThis->PciDev.config[0x13] == 0x00);
     PCIDevSetBaseAddress      (&pThis->PciDev, 1,       /* 14 rw - nabmbar - native audio bus mastering. */
                                true /* fIoSpace */, false /* fPrefetchable */, false /* f64Bit */, 0x00000000); Assert(pThis->PciDev.config[0x14] == 0x01); Assert(pThis->PciDev.config[0x15] == 0x00); Assert(pThis->PciDev.config[0x16] == 0x00); Assert(pThis->PciDev.config[0x17] == 0x00);
-    PCIDevSetSubSystemVendorId(&pThis->PciDev, 0x8086); /* 2c ro - intel.) */              Assert(pThis->PciDev.config[0x2c] == 0x86); Assert(pThis->PciDev.config[0x2d] == 0x80);
-    PCIDevSetSubSystemId      (&pThis->PciDev, 0x0000); /* 2e ro. */                       Assert(pThis->PciDev.config[0x2e] == 0x00); Assert(pThis->PciDev.config[0x2f] == 0x00);
     PCIDevSetInterruptLine    (&pThis->PciDev, 0x00);   /* 3c rw. */                       Assert(pThis->PciDev.config[0x3c] == 0x00);
     PCIDevSetInterruptPin     (&pThis->PciDev, 0x01);   /* 3d ro - INTA#. */               Assert(pThis->PciDev.config[0x3d] == 0x01);
 
+    if (fChipAD1980)
+    {
+        PCIDevSetSubSystemVendorId(&pThis->PciDev, 0x1028); /* 2c ro - Dell.) */
+        PCIDevSetSubSystemId      (&pThis->PciDev, 0x0177); /* 2e ro. */
+    }
+    else
+    {
+        PCIDevSetSubSystemVendorId(&pThis->PciDev, 0x8086); /* 2c ro - Intel.) */
+        PCIDevSetSubSystemId      (&pThis->PciDev, 0x0000); /* 2e ro. */
+    }
+
     /*
      * Register the PCI device, it's I/O regions, the timer and the
      * saved state item.
@@ -1542,19 +2403,112 @@ static DECLCALLBACK(int) ichac97Construct(PPDMDEVINS pDevIns, int iInstance, PCF
     /*
      * Attach driver.
      */
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    uint8_t uLUN;
+    for (uLUN = 0; uLUN < UINT8_MAX; uLUN)
+    {
+        LogFunc(("Trying to attach driver for LUN #%RU8 ...\n", uLUN));
+        rc = ichac97Attach(pDevIns, uLUN, PDM_TACH_FLAGS_NOT_HOT_PLUG);
+        if (RT_FAILURE(rc))
+        {
+            if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
+                rc = VINF_SUCCESS;
+            break;
+        }
+
+        uLUN++;
+    }
+
+    LogFunc(("cLUNs=%RU8, rc=%Rrc\n", uLUN, rc));
+#else
     rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Audio Driver Port");
     if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
-        Log(("ac97: No attached driver!\n"));
+        LogFunc(("ac97: No attached driver!\n"));
     else if (RT_FAILURE(rc))
     {
         AssertMsgFailed(("Failed to attach AC97 LUN #0! rc=%Rrc\n", rc));
         return rc;
     }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
     AUD_register_card("ICH0", &pThis->card);
-
+#endif
     ac97Reset(pDevIns);
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PAC97DRIVER pDrv;
+    uLUN = 0;
+    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+    {
+        if (!pDrv->pConnector->pfnIsInputOK(pDrv->pConnector, pDrv->LineIn.pStrmIn))
+            LogRel(("AC97: WARNING: Unable to open PCM line input for LUN #%RU32!\n", uLUN));
+        if (!pDrv->pConnector->pfnIsOutputOK(pDrv->pConnector, pDrv->Out.pStrmOut))
+            LogRel(("AC97: WARNING: Unable to open PCM output for LUN #%RU32!\n", uLUN));
+        if (!pDrv->pConnector->pfnIsInputOK(pDrv->pConnector, pDrv->MicIn.pStrmIn))
+            LogRel(("AC97: WARNING: Unable to open PCM microphone input for LUN #%RU32!\n", uLUN));
+
+        uLUN++;
+    }
+
+    RTListForEach(&pThis->lstDrv, pDrv, AC97DRIVER, Node)
+    {
+        /*
+         * Only primary drivers are critical for the VM to run. Everything else
+         * might not worth showing an own error message box in the GUI.
+         */
+        if (!(pDrv->Flags & PDMAUDIODRVFLAG_PRIMARY))
+            continue;
+
+        PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector;
+        AssertPtr(pCon);
+        if (   !pCon->pfnIsInputOK (pCon, pDrv->LineIn.pStrmIn)
+            && !pCon->pfnIsOutputOK(pCon, pDrv->Out.pStrmOut)
+            && !pCon->pfnIsInputOK (pCon, pDrv->MicIn.pStrmIn))
+        {
+            LogRel(("AC97: Falling back to NULL driver\n"));
+
+            /* Was not able initialize *any* stream.
+             * Select the NULL audio driver instead. */
+            pCon->pfnCloseIn (pCon, pDrv->LineIn.pStrmIn);
+            pCon->pfnCloseOut(pCon, pDrv->Out.pStrmOut);
+            pCon->pfnCloseIn (pCon, pDrv->MicIn.pStrmIn);
+
+            pDrv->Out.pStrmOut = NULL;
+            pDrv->LineIn.pStrmIn = NULL;
+            pDrv->MicIn.pStrmIn = NULL;
+
+            pCon->pfnInitNull(pCon);
+            ac97Reset(pDevIns);
+
+            PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
+                N_("No audio devices could be opened. Selecting the NULL audio backend "
+                   "with the consequence that no sound is audible"));
+        }
+        else if (   !pCon->pfnIsInputOK (pCon, pDrv->LineIn.pStrmIn)
+                 || !pCon->pfnIsOutputOK(pCon, pDrv->Out.pStrmOut)
+                 || !pCon->pfnIsInputOK (pCon, pDrv->MicIn.pStrmIn))
+        {
+            char   szMissingStreams[255];
+            size_t len = 0;
+            if (!pCon->pfnIsInputOK (pCon, pDrv->LineIn.pStrmIn))
+                len = RTStrPrintf(szMissingStreams,
+                                  sizeof(szMissingStreams), "PCM Input");
+            if (!pCon->pfnIsOutputOK(pCon, pDrv->Out.pStrmOut))
+                len += RTStrPrintf(szMissingStreams + len,
+                                   sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");
+            if (!pCon->pfnIsInputOK (pCon, pDrv->MicIn.pStrmIn))
+                len += RTStrPrintf(szMissingStreams + len,
+                                   sizeof(szMissingStreams) - len, len ? ", PCM Microphone" : "PCM Microphone");
+
+            PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
+                N_("Some AC'97 audio streams (%s) could not be opened. Guest applications generating audio "
+                "output or depending on audio input may hang. Make sure your host audio device "
+                "is working properly. Check the logfile for error messages of the audio "
+                "subsystem"), szMissingStreams);
+        }
+    }
+#else
     if (!AUD_is_host_voice_in_ok(pThis->voice_pi))
         LogRel(("AC97: WARNING: Unable to open PCM IN!\n"));
     if (!AUD_is_host_voice_in_ok(pThis->voice_mc))
@@ -1566,10 +2520,10 @@ static DECLCALLBACK(int) ichac97Construct(PPDMDEVINS pDevIns, int iInstance, PCF
         && !AUD_is_host_voice_out_ok(pThis->voice_po)
         && !AUD_is_host_voice_in_ok( pThis->voice_mc))
     {
-        /* Was not able initialize *any* voice. Select the NULL audio driver instead */
-        AUD_close_in( &pThis->card, pThis->voice_pi);
+        AUD_close_in(&pThis->card, pThis->voice_pi);
         AUD_close_out(&pThis->card, pThis->voice_po);
-        AUD_close_in( &pThis->card, pThis->voice_mc);
+        AUD_close_in(&pThis->card, pThis->voice_mc);
+
         pThis->voice_po = NULL;
         pThis->voice_pi = NULL;
         pThis->voice_mc = NULL;
@@ -1599,6 +2553,49 @@ static DECLCALLBACK(int) ichac97Construct(PPDMDEVINS pDevIns, int iInstance, PCF
                "is working properly. Check the logfile for error messages of the audio "
                "subsystem"), szMissingVoices);
     }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    if (RT_SUCCESS(rc))
+    {
+        pThis->cbReadWriteBuf = _4K; /** @todo Make this configurable. */
+        pThis->pvReadWriteBuf = (uint8_t *)RTMemAllocZ(pThis->cbReadWriteBuf);
+        if (!pThis->pvReadWriteBuf)
+            rc = VERR_NO_MEMORY;
+    }
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    if (RT_SUCCESS(rc))
+    {
+        /* Start the emulation timer. */
+        rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ichac97Timer, pThis,
+                                    TMTIMER_FLAGS_NO_CRIT_SECT, "DevIchAc97", &pThis->pTimer);
+        AssertRCReturn(rc, rc);
+
+        if (RT_SUCCESS(rc))
+        {
+            pThis->uTicks = PDMDevHlpTMTimeVirtGetFreq(pDevIns) / 200; /** Hz. @todo Make this configurable! */
+            if (pThis->uTicks < 100)
+                pThis->uTicks = 100;
+            LogFunc(("Timer ticks=%RU64\n", pThis->uTicks));
+
+            /* Fire off timer. */
+            TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->uTicks);
+        }
+    }
+
+# ifdef VBOX_WITH_STATISTICS
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Register statistics.
+         */
+        PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTimer,            STAMTYPE_PROFILE, "/Devices/AC97/Timer",             STAMUNIT_TICKS_PER_CALL, "Profiling ichac97Timer.");
+        PDMDevHlpSTAMRegister(pDevIns, &pThis->StatBytesRead,        STAMTYPE_COUNTER, "/Devices/AC97/BytesRead"   ,      STAMUNIT_BYTES,          "Bytes read from AC97 emulation.");
+        PDMDevHlpSTAMRegister(pDevIns, &pThis->StatBytesWritten,     STAMTYPE_COUNTER, "/Devices/AC97/BytesWritten",      STAMUNIT_BYTES,          "Bytes written to AC97 emulation.");
+    }
+# endif
+
+#endif
 
     return VINF_SUCCESS;
 }
@@ -1629,7 +2626,7 @@ const PDMDEVREG g_DeviceICHAC97 =
     /* pfnConstruct */
     ichac97Construct,
     /* pfnDestruct */
-    NULL,
+    ichac97Destruct,
     /* pfnRelocate */
     NULL,
     /* pfnMemSetup */
@@ -1657,3 +2654,6 @@ const PDMDEVREG g_DeviceICHAC97 =
     /* u32VersionEnd */
     PDM_DEVREG_VERSION
 };
+
+#endif /* !IN_RING3 */
+#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
diff --git a/src/VBox/Devices/Audio/DevIchHda.cpp b/src/VBox/Devices/Audio/DevIchHda.cpp
index 0ea477a..e411a1b 100644
--- a/src/VBox/Devices/Audio/DevIchHda.cpp
+++ b/src/VBox/Devices/Audio/DevIchHda.cpp
@@ -8,7 +8,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -22,8 +22,8 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
-#define LOG_GROUP LOG_GROUP_DEV_AUDIO
 #include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pdmaudioifs.h>
 #include <VBox/version.h>
 
 #include <iprt/assert.h>
@@ -34,21 +34,37 @@
 # include <iprt/string.h>
 # include <iprt/mem.h>
 #endif
+#include <iprt/list.h>
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
 
 #include "VBoxDD.h"
 
-extern "C" {
-#include "audio.h"
-}
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# include "AudioMixer.h"
+#else
+ extern "C" {
+  #include "audio.h"
+ }
+#endif
 #include "DevIchHdaCodec.h"
 
-
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
 //#define HDA_AS_PCI_EXPRESS
 #define VBOX_WITH_INTEL_HDA
 
+#if (defined(DEBUG) && defined(DEBUG_andy))
+/* Enables experimental support for separate mic-in handling.
+   Do not enable this yet for regular builds, as this needs more testing first! */
+# define VBOX_WITH_HDA_MIC_IN
+#endif
+
 #if defined(VBOX_WITH_HP_HDA)
 /* HP Pavilion dv4t-1300 */
 # define HDA_PCI_VENDOR_ID 0x103c
@@ -73,21 +89,31 @@ extern "C" {
  * writes 1, hw sets it to 1 (after completion), sw reads 1, sw writes 0). */
 #define BIRD_THINKS_CORBRP_IS_MOSTLY_RO
 
-#define HDA_NREGS 112
+#define HDA_NREGS           114
+#define HDA_NREGS_SAVED     112
+
+/**
+ *  NB: Register values stored in memory (au32Regs[]) are indexed through
+ *  the HDA_RMX_xxx macros (also HDA_MEM_IND_NAME()). On the other hand, the
+ *  register descriptors in g_aHdaRegMap[] are indexed through the
+ *  HDA_REG_xxx macros (also HDA_REG_IND_NAME()).
+ *
+ *  The au32Regs[] layout is kept unchanged for saved state
+ *  compatibility. */
+
 /* Registers */
-#define HDA_REG_IND_NAME(x)                 ICH6_HDA_REG_##x
-#define HDA_REG_FIELD_NAME(reg, x)          ICH6_HDA_##reg##_##x
-#define HDA_REG_FIELD_MASK(reg, x)          ICH6_HDA_##reg##_##x##_MASK
-#define HDA_REG_FIELD_FLAG_MASK(reg, x)     RT_BIT(ICH6_HDA_##reg##_##x##_SHIFT)
-#define HDA_REG_FIELD_SHIFT(reg, x)         ICH6_HDA_##reg##_##x##_SHIFT
-#define HDA_REG_IND(pThis, x)               ((pThis)->au32Regs[(x)])
+#define HDA_REG_IND_NAME(x)                 HDA_REG_##x
+#define HDA_MEM_IND_NAME(x)                 HDA_RMX_##x
+#define HDA_REG_FIELD_MASK(reg, x)          HDA_##reg##_##x##_MASK
+#define HDA_REG_FIELD_FLAG_MASK(reg, x)     RT_BIT(HDA_##reg##_##x##_SHIFT)
+#define HDA_REG_FIELD_SHIFT(reg, x)         HDA_##reg##_##x##_SHIFT
+#define HDA_REG_IND(pThis, x)               ((pThis)->au32Regs[g_aHdaRegMap[x].mem_idx])
 #define HDA_REG(pThis, x)                   (HDA_REG_IND((pThis), HDA_REG_IND_NAME(x)))
-#define HDA_REG_VALUE(pThis, reg, val)      (HDA_REG((pThis),reg) & (((HDA_REG_FIELD_MASK(reg, val))) << (HDA_REG_FIELD_SHIFT(reg, val))))
 #define HDA_REG_FLAG_VALUE(pThis, reg, val) (HDA_REG((pThis),reg) & (((HDA_REG_FIELD_FLAG_MASK(reg, val)))))
-#define HDA_REG_SVALUE(pThis, reg, val)     (HDA_REG_VALUE(pThis, reg, val) >> (HDA_REG_FIELD_SHIFT(reg, val)))
 
-#define ICH6_HDA_REG_GCAP 0 /* range 0x00-0x01*/
-#define GCAP(pThis) (HDA_REG((pThis), GCAP))
+
+#define HDA_REG_GCAP                0 /* range 0x00-0x01*/
+#define HDA_RMX_GCAP                0
 /* GCAP HDASpec 3.3.2 This macro encodes the following information about HDA in a compact manner:
  * oss (15:12) - number of output streams supported
  * iss (11:8)  - number of input streams supported
@@ -101,325 +127,401 @@ extern "C" {
      | (((bss) & 0x1F) << 3)    \
      | (((bds) & 0x3)  << 2)    \
      | ((b64sup) & 1))
-#define ICH6_HDA_REG_VMIN           1 /* range 0x02 */
-#define VMIN(pThis)                 (HDA_REG((pThis), VMIN))
-
-#define ICH6_HDA_REG_VMAJ           2 /* range 0x03 */
-#define VMAJ(pThis)                 (HDA_REG((pThis), VMAJ))
-
-#define ICH6_HDA_REG_OUTPAY         3 /* range 0x04-0x05 */
-#define OUTPAY(pThis)               (HDA_REG((pThis), OUTPAY))
-
-#define ICH6_HDA_REG_INPAY          4 /* range 0x06-0x07 */
-#define INPAY(pThis)                (HDA_REG((pThis), INPAY))
-
-#define ICH6_HDA_REG_GCTL           (5)
-#define ICH6_HDA_GCTL_RST_SHIFT     (0)
-#define ICH6_HDA_GCTL_FSH_SHIFT     (1)
-#define ICH6_HDA_GCTL_UR_SHIFT      (8)
-#define GCTL(pThis)                 (HDA_REG((pThis), GCTL))
-
-#define ICH6_HDA_REG_WAKEEN         6 /* 0x0C */
-#define WAKEEN(pThis)               (HDA_REG((pThis), WAKEEN))
-
-#define ICH6_HDA_REG_STATESTS       7 /* range 0x0E */
-#define STATESTS(pThis)             (HDA_REG((pThis), STATESTS))
-#define ICH6_HDA_STATES_SCSF        0x7
-
-#define ICH6_HDA_REG_GSTS           8 /* range 0x10-0x11*/
-#define ICH6_HDA_GSTS_FSH_SHIFT     (1)
-#define GSTS(pThis)                 (HDA_REG(pThis, GSTS))
-
-#define ICH6_HDA_REG_INTCTL         9 /* 0x20 */
-#define ICH6_HDA_INTCTL_GIE_SHIFT   31
-#define ICH6_HDA_INTCTL_CIE_SHIFT   30
-#define ICH6_HDA_INTCTL_S0_SHIFT    (0)
-#define ICH6_HDA_INTCTL_S1_SHIFT    (1)
-#define ICH6_HDA_INTCTL_S2_SHIFT    (2)
-#define ICH6_HDA_INTCTL_S3_SHIFT    (3)
-#define ICH6_HDA_INTCTL_S4_SHIFT    (4)
-#define ICH6_HDA_INTCTL_S5_SHIFT    (5)
-#define ICH6_HDA_INTCTL_S6_SHIFT    (6)
-#define ICH6_HDA_INTCTL_S7_SHIFT    (7)
-#define INTCTL(pThis)               (HDA_REG((pThis), INTCTL))
-#define INTCTL_GIE(pThis)           (HDA_REG_FLAG_VALUE(pThis, INTCTL, GIE))
-#define INTCTL_CIE(pThis)           (HDA_REG_FLAG_VALUE(pThis, INTCTL, CIE))
+
+#define HDA_REG_VMIN                1 /* 0x02 */
+#define HDA_RMX_VMIN                1
+
+#define HDA_REG_VMAJ                2 /* 0x03 */
+#define HDA_RMX_VMAJ                2
+
+#define HDA_REG_OUTPAY              3 /* 0x04-0x05 */
+#define HDA_RMX_OUTPAY              3
+
+#define HDA_REG_INPAY               4 /* 0x06-0x07 */
+#define HDA_RMX_INPAY               4
+
+#define HDA_REG_GCTL                5 /* 0x08-0x0B */
+#define HDA_RMX_GCTL                5
+#define HDA_GCTL_RST_SHIFT          0
+#define HDA_GCTL_FSH_SHIFT          1
+#define HDA_GCTL_UR_SHIFT           8
+
+#define HDA_REG_WAKEEN              6 /* 0x0C */
+#define HDA_RMX_WAKEEN              6
+
+#define HDA_REG_STATESTS            7 /* 0x0E */
+#define HDA_RMX_STATESTS            7
+#define HDA_STATES_SCSF             0x7
+
+#define HDA_REG_GSTS                8 /* 0x10-0x11*/
+#define HDA_RMX_GSTS                8
+#define HDA_GSTS_FSH_SHIFT          1
+
+#define HDA_REG_OUTSTRMPAY          9  /* 0x18 */
+#define HDA_RMX_OUTSTRMPAY          112
+
+#define HDA_REG_INSTRMPAY           10 /* 0x1a */
+#define HDA_RMX_INSTRMPAY           113
+
+#define HDA_REG_INTCTL              11 /* 0x20 */
+#define HDA_RMX_INTCTL              9
+#define HDA_INTCTL_GIE_SHIFT        31
+#define HDA_INTCTL_CIE_SHIFT        30
+#define HDA_INTCTL_S0_SHIFT         0
+#define HDA_INTCTL_S1_SHIFT         1
+#define HDA_INTCTL_S2_SHIFT         2
+#define HDA_INTCTL_S3_SHIFT         3
+#define HDA_INTCTL_S4_SHIFT         4
+#define HDA_INTCTL_S5_SHIFT         5
+#define HDA_INTCTL_S6_SHIFT         6
+#define HDA_INTCTL_S7_SHIFT         7
 #define INTCTL_SX(pThis, X)         (HDA_REG_FLAG_VALUE((pThis), INTCTL, S##X))
-#define INTCTL_SALL(pThis)          (INTCTL((pThis)) & 0xFF)
+
+#define HDA_REG_INTSTS              12 /* 0x24 */
+#define HDA_RMX_INTSTS              10
+#define HDA_INTSTS_GIS_SHIFT        31
+#define HDA_INTSTS_CIS_SHIFT        30
+#define HDA_INTSTS_S0_SHIFT         0
+#define HDA_INTSTS_S1_SHIFT         1
+#define HDA_INTSTS_S2_SHIFT         2
+#define HDA_INTSTS_S3_SHIFT         3
+#define HDA_INTSTS_S4_SHIFT         4
+#define HDA_INTSTS_S5_SHIFT         5
+#define HDA_INTSTS_S6_SHIFT         6
+#define HDA_INTSTS_S7_SHIFT         7
+#define HDA_INTSTS_S_MASK(num)      RT_BIT(HDA_REG_FIELD_SHIFT(S##num))
+
+#define HDA_REG_WALCLK              13 /* 0x24 */
+#define HDA_RMX_WALCLK              /* Not defined! */
 
 /* Note: The HDA specification defines a SSYNC register at offset 0x38. The
  * ICH6/ICH9 datahseet defines SSYNC at offset 0x34. The Linux HDA driver matches
  * the datasheet.
  */
-#define ICH6_HDA_REG_SSYNC          12 /* 0x34 */
-#define SSYNC(pThis)                (HDA_REG((pThis), SSYNC))
-
-#define ICH6_HDA_REG_INTSTS         10 /* 0x24 */
-#define ICH6_HDA_INTSTS_GIS_SHIFT   (31)
-#define ICH6_HDA_INTSTS_CIS_SHIFT   (30)
-#define ICH6_HDA_INTSTS_S0_SHIFT    (0)
-#define ICH6_HDA_INTSTS_S1_SHIFT    (1)
-#define ICH6_HDA_INTSTS_S2_SHIFT    (2)
-#define ICH6_HDA_INTSTS_S3_SHIFT    (3)
-#define ICH6_HDA_INTSTS_S4_SHIFT    (4)
-#define ICH6_HDA_INTSTS_S5_SHIFT    (5)
-#define ICH6_HDA_INTSTS_S6_SHIFT    (6)
-#define ICH6_HDA_INTSTS_S7_SHIFT    (7)
-#define ICH6_HDA_INTSTS_S_MASK(num) RT_BIT(HDA_REG_FIELD_SHIFT(S##num))
-#define INTSTS(pThis)               (HDA_REG((pThis), INTSTS))
-#define INTSTS_GIS(pThis)           (HDA_REG_FLAG_VALUE((pThis), INTSTS, GIS)
-#define INTSTS_CIS(pThis)           (HDA_REG_FLAG_VALUE((pThis), INTSTS, CIS)
-#define INTSTS_SX(pThis, X)         (HDA_REG_FLAG_VALUE(pThis), INTSTS, S##X)
-#define INTSTS_SANY(pThis)          (INTSTS((pThis)) & 0xFF)
-
-#define ICH6_HDA_REG_CORBLBASE      13 /* 0x40 */
-#define CORBLBASE(pThis)            (HDA_REG((pThis), CORBLBASE))
-#define ICH6_HDA_REG_CORBUBASE      14 /* 0x44 */
-#define CORBUBASE(pThis)            (HDA_REG((pThis), CORBUBASE))
-#define ICH6_HDA_REG_CORBWP         15 /* 48 */
-#define ICH6_HDA_REG_CORBRP         16 /* 4A */
-#define ICH6_HDA_CORBRP_RST_SHIFT   15
-#define ICH6_HDA_CORBRP_WP_SHIFT    0
-#define ICH6_HDA_CORBRP_WP_MASK     0xFF
-
-#define CORBRP(pThis)               (HDA_REG(pThis, CORBRP))
-#define CORBWP(pThis)               (HDA_REG(pThis, CORBWP))
-
-#define ICH6_HDA_REG_CORBCTL        17 /* 0x4C */
-#define ICH6_HDA_CORBCTL_DMA_SHIFT  (1)
-#define ICH6_HDA_CORBCTL_CMEIE_SHIFT (0)
-
-#define CORBCTL(pThis)              (HDA_REG(pThis, CORBCTL))
-
-
-#define ICH6_HDA_REG_CORBSTS        18 /* 0x4D */
-#define CORBSTS(pThis)              (HDA_REG(pThis, CORBSTS))
-#define ICH6_HDA_CORBSTS_CMEI_SHIFT (0)
-
-#define ICH6_HDA_REG_CORBSIZE       19 /* 0x4E */
-#define ICH6_HDA_CORBSIZE_SZ_CAP    0xF0
-#define ICH6_HDA_CORBSIZE_SZ        0x3
-#define CORBSIZE_SZ(pThis)          (HDA_REG(pThis, ICH6_HDA_REG_CORBSIZE) & ICH6_HDA_CORBSIZE_SZ)
-#define CORBSIZE_SZ_CAP(pThis)      (HDA_REG(pThis, ICH6_HDA_REG_CORBSIZE) & ICH6_HDA_CORBSIZE_SZ_CAP)
+#define HDA_REG_SSYNC               14 /* 0x34 */
+#define HDA_RMX_SSYNC               12
+
+#define HDA_REG_CORBLBASE           15 /* 0x40 */
+#define HDA_RMX_CORBLBASE           13
+
+#define HDA_REG_CORBUBASE           16 /* 0x44 */
+#define HDA_RMX_CORBUBASE           14
+
+#define HDA_REG_CORBWP              17 /* 0x48 */
+#define HDA_RMX_CORBWP              15
+
+#define HDA_REG_CORBRP              18 /* 0x4A */
+#define HDA_RMX_CORBRP              16
+#define HDA_CORBRP_RST_SHIFT        15
+#define HDA_CORBRP_WP_SHIFT         0
+#define HDA_CORBRP_WP_MASK          0xFF
+
+#define HDA_REG_CORBCTL             19 /* 0x4C */
+#define HDA_RMX_CORBCTL             17
+#define HDA_CORBCTL_DMA_SHIFT       1
+#define HDA_CORBCTL_CMEIE_SHIFT     0
+
+#define HDA_REG_CORBSTS             20 /* 0x4D */
+#define HDA_RMX_CORBSTS             18
+#define HDA_CORBSTS_CMEI_SHIFT      0
+
+#define HDA_REG_CORBSIZE            21 /* 0x4E */
+#define HDA_RMX_CORBSIZE            19
+#define HDA_CORBSIZE_SZ_CAP         0xF0
+#define HDA_CORBSIZE_SZ             0x3
 /* till ich 10 sizes of CORB and RIRB are hardcoded to 256 in real hw */
 
-#define ICH6_HDA_REG_RIRLBASE       20 /* 0x50 */
-#define RIRLBASE(pThis)             (HDA_REG((pThis), RIRLBASE))
-
-#define ICH6_HDA_REG_RIRUBASE       21 /* 0x54 */
-#define RIRUBASE(pThis)             (HDA_REG((pThis), RIRUBASE))
-
-#define ICH6_HDA_REG_RIRBWP         22 /* 0x58 */
-#define ICH6_HDA_RIRBWP_RST_SHIFT   (15)
-#define ICH6_HDA_RIRBWP_WP_MASK     0xFF
-#define RIRBWP(pThis)              (HDA_REG(pThis, RIRBWP))
-
-#define ICH6_HDA_REG_RINTCNT        23 /* 0x5A */
-#define RINTCNT(pThis)              (HDA_REG((pThis), RINTCNT))
-#define RINTCNT_N(pThis)            (RINTCNT((pThis)) & 0xff)
-
-#define ICH6_HDA_REG_RIRBCTL        24 /* 0x5C */
-#define ICH6_HDA_RIRBCTL_RIC_SHIFT  (0)
-#define ICH6_HDA_RIRBCTL_DMA_SHIFT  (1)
-#define ICH6_HDA_ROI_DMA_SHIFT      (2)
-#define RIRBCTL(pThis)              (HDA_REG((pThis), RIRBCTL))
-#define RIRBCTL_RIRB_RIC(pThis)     (HDA_REG_FLAG_VALUE(pThis, RIRBCTL, RIC))
-#define RIRBCTL_RIRB_DMA(pThis)     (HDA_REG_FLAG_VALUE((pThis), RIRBCTL, DMA)
-#define RIRBCTL_ROI(pThis)          (HDA_REG_FLAG_VALUE((pThis), RIRBCTL, ROI))
-
-#define ICH6_HDA_REG_RIRBSTS        25 /* 0x5D */
-#define ICH6_HDA_RIRBSTS_RINTFL_SHIFT (0)
-#define ICH6_HDA_RIRBSTS_RIRBOIS_SHIFT (2)
-#define RIRBSTS(pThis)              (HDA_REG(pThis, RIRBSTS))
-#define RIRBSTS_RINTFL(pThis)       (HDA_REG_FLAG_VALUE(pThis, RIRBSTS, RINTFL))
-#define RIRBSTS_RIRBOIS(pThis)      (HDA_REG_FLAG_VALUE(pThis, RIRBSTS, RIRBOIS))
-
-#define ICH6_HDA_REG_RIRBSIZE       26 /* 0x5E */
-#define ICH6_HDA_RIRBSIZE_SZ_CAP    0xF0
-#define ICH6_HDA_RIRBSIZE_SZ        0x3
-
-#define RIRBSIZE_SZ(pThis)          (HDA_REG(pThis, ICH6_HDA_REG_RIRBSIZE) & ICH6_HDA_RIRBSIZE_SZ)
-#define RIRBSIZE_SZ_CAP(pThis)      (HDA_REG(pThis, ICH6_HDA_REG_RIRBSIZE) & ICH6_HDA_RIRBSIZE_SZ_CAP)
-
-
-#define ICH6_HDA_REG_IC             27 /* 0x60 */
-#define IC(pThis)                   (HDA_REG(pThis, IC))
-#define ICH6_HDA_REG_IR             28 /* 0x64 */
-#define IR(pThis)                   (HDA_REG(pThis, IR))
-#define ICH6_HDA_REG_IRS            29 /* 0x68 */
-#define ICH6_HDA_IRS_ICB_SHIFT      (0)
-#define ICH6_HDA_IRS_IRV_SHIFT      (1)
-#define IRS(pThis)                  (HDA_REG(pThis, IRS))
-#define IRS_ICB(pThis)              (HDA_REG_FLAG_VALUE(pThis, IRS, ICB))
-#define IRS_IRV(pThis)              (HDA_REG_FLAG_VALUE(pThis, IRS, IRV))
-
-#define ICH6_HDA_REG_DPLBASE        30 /* 0x70 */
+#define HDA_REG_RIRBLBASE           22 /* 0x50 */
+#define HDA_RMX_RIRBLBASE           20
+
+#define HDA_REG_RIRBUBASE           23 /* 0x54 */
+#define HDA_RMX_RIRBUBASE           21
+
+#define HDA_REG_RIRBWP              24 /* 0x58 */
+#define HDA_RMX_RIRBWP              22
+#define HDA_RIRBWP_RST_SHIFT        15
+#define HDA_RIRBWP_WP_MASK          0xFF
+
+#define HDA_REG_RINTCNT             25 /* 0x5A */
+#define HDA_RMX_RINTCNT             23
+#define RINTCNT_N(pThis)            (HDA_REG(pThis, RINTCNT) & 0xff)
+
+#define HDA_REG_RIRBCTL             26 /* 0x5C */
+#define HDA_RMX_RIRBCTL             24
+#define HDA_RIRBCTL_RIC_SHIFT       0
+#define HDA_RIRBCTL_DMA_SHIFT       1
+#define HDA_ROI_DMA_SHIFT           2
+
+#define HDA_REG_RIRBSTS             27 /* 0x5D */
+#define HDA_RMX_RIRBSTS             25
+#define HDA_RIRBSTS_RINTFL_SHIFT    0
+#define HDA_RIRBSTS_RIRBOIS_SHIFT   2
+
+#define HDA_REG_RIRBSIZE            28 /* 0x5E */
+#define HDA_RMX_RIRBSIZE            26
+#define HDA_RIRBSIZE_SZ_CAP         0xF0
+#define HDA_RIRBSIZE_SZ             0x3
+
+#define RIRBSIZE_SZ(pThis)          (HDA_REG(pThis, HDA_REG_RIRBSIZE) & HDA_RIRBSIZE_SZ)
+#define RIRBSIZE_SZ_CAP(pThis)      (HDA_REG(pThis, HDA_REG_RIRBSIZE) & HDA_RIRBSIZE_SZ_CAP)
+
+
+#define HDA_REG_IC                  29 /* 0x60 */
+#define HDA_RMX_IC                  27
+
+#define HDA_REG_IR                  30 /* 0x64 */
+#define HDA_RMX_IR                  28
+
+#define HDA_REG_IRS                 31 /* 0x68 */
+#define HDA_RMX_IRS                 29
+#define HDA_IRS_ICB_SHIFT           0
+#define HDA_IRS_IRV_SHIFT           1
+
+#define HDA_REG_DPLBASE             32 /* 0x70 */
+#define HDA_RMX_DPLBASE             30
 #define DPLBASE(pThis)              (HDA_REG((pThis), DPLBASE))
-#define ICH6_HDA_REG_DPUBASE        31 /* 0x74 */
+
+#define HDA_REG_DPUBASE             33 /* 0x74 */
+#define HDA_RMX_DPUBASE             31
 #define DPUBASE(pThis)              (HDA_REG((pThis), DPUBASE))
 #define DPBASE_ENABLED              1
 #define DPBASE_ADDR_MASK            (~(uint64_t)0x7f)
 
-#define HDA_STREAM_REG_DEF(name, num)           (ICH6_HDA_REG_SD##num##name)
-#define HDA_STREAM_REG(pThis, name, num)        (HDA_REG((pThis), N_(HDA_STREAM_REG_DEF(name, num))))
-/* Note: sdnum here _MUST_ be stream reg number [0,7] */
-#define HDA_STREAM_REG2(pThis, name, sdnum)     (HDA_REG_IND((pThis), ICH6_HDA_REG_SD0##name + (sdnum) * 10))
-
-#define ICH6_HDA_REG_SD0CTL         32 /* 0x80 */
-#define ICH6_HDA_REG_SD1CTL         (HDA_STREAM_REG_DEF(CTL, 0) + 10) /* 0xA0 */
-#define ICH6_HDA_REG_SD2CTL         (HDA_STREAM_REG_DEF(CTL, 0) + 20) /* 0xC0 */
-#define ICH6_HDA_REG_SD3CTL         (HDA_STREAM_REG_DEF(CTL, 0) + 30) /* 0xE0 */
-#define ICH6_HDA_REG_SD4CTL         (HDA_STREAM_REG_DEF(CTL, 0) + 40) /* 0x100 */
-#define ICH6_HDA_REG_SD5CTL         (HDA_STREAM_REG_DEF(CTL, 0) + 50) /* 0x120 */
-#define ICH6_HDA_REG_SD6CTL         (HDA_STREAM_REG_DEF(CTL, 0) + 60) /* 0x140 */
-#define ICH6_HDA_REG_SD7CTL         (HDA_STREAM_REG_DEF(CTL, 0) + 70) /* 0x160 */
+#define HDA_STREAM_REG_DEF(name, num)           (HDA_REG_SD##num##name)
+#define HDA_STREAM_RMX_DEF(name, num)           (HDA_RMX_SD##num##name)
+/* Note: sdnum here _MUST_ be stream reg number [0,7]. */
+#define HDA_STREAM_REG(pThis, name, sdnum)      (HDA_REG_IND((pThis), HDA_REG_SD0##name + (sdnum) * 10))
+
+#define HDA_REG_SD0CTL              34 /* 0x80 */
+#define HDA_REG_SD1CTL              (HDA_STREAM_REG_DEF(CTL, 0) + 10) /* 0xA0 */
+#define HDA_REG_SD2CTL              (HDA_STREAM_REG_DEF(CTL, 0) + 20) /* 0xC0 */
+#define HDA_REG_SD3CTL              (HDA_STREAM_REG_DEF(CTL, 0) + 30) /* 0xE0 */
+#define HDA_REG_SD4CTL              (HDA_STREAM_REG_DEF(CTL, 0) + 40) /* 0x100 */
+#define HDA_REG_SD5CTL              (HDA_STREAM_REG_DEF(CTL, 0) + 50) /* 0x120 */
+#define HDA_REG_SD6CTL              (HDA_STREAM_REG_DEF(CTL, 0) + 60) /* 0x140 */
+#define HDA_REG_SD7CTL              (HDA_STREAM_REG_DEF(CTL, 0) + 70) /* 0x160 */
+#define HDA_RMX_SD0CTL              32
+#define HDA_RMX_SD1CTL              (HDA_STREAM_RMX_DEF(CTL, 0) + 10)
+#define HDA_RMX_SD2CTL              (HDA_STREAM_RMX_DEF(CTL, 0) + 20)
+#define HDA_RMX_SD3CTL              (HDA_STREAM_RMX_DEF(CTL, 0) + 30)
+#define HDA_RMX_SD4CTL              (HDA_STREAM_RMX_DEF(CTL, 0) + 40)
+#define HDA_RMX_SD5CTL              (HDA_STREAM_RMX_DEF(CTL, 0) + 50)
+#define HDA_RMX_SD6CTL              (HDA_STREAM_RMX_DEF(CTL, 0) + 60)
+#define HDA_RMX_SD7CTL              (HDA_STREAM_RMX_DEF(CTL, 0) + 70)
 
 #define SD(func, num)               SD##num##func
 #define SDCTL(pThis, num)           HDA_REG((pThis), SD(CTL, num))
 #define SDCTL_NUM(pThis, num)       ((SDCTL((pThis), num) & HDA_REG_FIELD_MASK(SDCTL,NUM)) >> HDA_REG_FIELD_SHIFT(SDCTL, NUM))
-#define ICH6_HDA_SDCTL_NUM_MASK     (0xF)
-#define ICH6_HDA_SDCTL_NUM_SHIFT    (20)
-#define ICH6_HDA_SDCTL_DIR_SHIFT    (19)
-#define ICH6_HDA_SDCTL_TP_SHIFT     (18)
-#define ICH6_HDA_SDCTL_STRIPE_MASK  (0x3)
-#define ICH6_HDA_SDCTL_STRIPE_SHIFT (16)
-#define ICH6_HDA_SDCTL_DEIE_SHIFT   (4)
-#define ICH6_HDA_SDCTL_FEIE_SHIFT   (3)
-#define ICH6_HDA_SDCTL_ICE_SHIFT    (2)
-#define ICH6_HDA_SDCTL_RUN_SHIFT    (1)
-#define ICH6_HDA_SDCTL_SRST_SHIFT   (0)
-
-#define ICH6_HDA_REG_SD0STS         33 /* 0x83 */
-#define ICH6_HDA_REG_SD1STS         (HDA_STREAM_REG_DEF(STS, 0) + 10) /* 0xA3 */
-#define ICH6_HDA_REG_SD2STS         (HDA_STREAM_REG_DEF(STS, 0) + 20) /* 0xC3 */
-#define ICH6_HDA_REG_SD3STS         (HDA_STREAM_REG_DEF(STS, 0) + 30) /* 0xE3 */
-#define ICH6_HDA_REG_SD4STS         (HDA_STREAM_REG_DEF(STS, 0) + 40) /* 0x103 */
-#define ICH6_HDA_REG_SD5STS         (HDA_STREAM_REG_DEF(STS, 0) + 50) /* 0x123 */
-#define ICH6_HDA_REG_SD6STS         (HDA_STREAM_REG_DEF(STS, 0) + 60) /* 0x143 */
-#define ICH6_HDA_REG_SD7STS         (HDA_STREAM_REG_DEF(STS, 0) + 70) /* 0x163 */
+#define HDA_SDCTL_NUM_MASK          0xF
+#define HDA_SDCTL_NUM_SHIFT         20
+#define HDA_SDCTL_DIR_SHIFT         19
+#define HDA_SDCTL_TP_SHIFT          18
+#define HDA_SDCTL_STRIPE_MASK       0x3
+#define HDA_SDCTL_STRIPE_SHIFT      16
+#define HDA_SDCTL_DEIE_SHIFT        4
+#define HDA_SDCTL_FEIE_SHIFT        3
+#define HDA_SDCTL_ICE_SHIFT         2
+#define HDA_SDCTL_RUN_SHIFT         1
+#define HDA_SDCTL_SRST_SHIFT        0
+
+#define HDA_REG_SD0STS              35 /* 0x83 */
+#define HDA_REG_SD1STS              (HDA_STREAM_REG_DEF(STS, 0) + 10) /* 0xA3 */
+#define HDA_REG_SD2STS              (HDA_STREAM_REG_DEF(STS, 0) + 20) /* 0xC3 */
+#define HDA_REG_SD3STS              (HDA_STREAM_REG_DEF(STS, 0) + 30) /* 0xE3 */
+#define HDA_REG_SD4STS              (HDA_STREAM_REG_DEF(STS, 0) + 40) /* 0x103 */
+#define HDA_REG_SD5STS              (HDA_STREAM_REG_DEF(STS, 0) + 50) /* 0x123 */
+#define HDA_REG_SD6STS              (HDA_STREAM_REG_DEF(STS, 0) + 60) /* 0x143 */
+#define HDA_REG_SD7STS              (HDA_STREAM_REG_DEF(STS, 0) + 70) /* 0x163 */
+#define HDA_RMX_SD0STS              33
+#define HDA_RMX_SD1STS              (HDA_STREAM_RMX_DEF(STS, 0) + 10)
+#define HDA_RMX_SD2STS              (HDA_STREAM_RMX_DEF(STS, 0) + 20)
+#define HDA_RMX_SD3STS              (HDA_STREAM_RMX_DEF(STS, 0) + 30)
+#define HDA_RMX_SD4STS              (HDA_STREAM_RMX_DEF(STS, 0) + 40)
+#define HDA_RMX_SD5STS              (HDA_STREAM_RMX_DEF(STS, 0) + 50)
+#define HDA_RMX_SD6STS              (HDA_STREAM_RMX_DEF(STS, 0) + 60)
+#define HDA_RMX_SD7STS              (HDA_STREAM_RMX_DEF(STS, 0) + 70)
 
 #define SDSTS(pThis, num)           HDA_REG((pThis), SD(STS, num))
-#define ICH6_HDA_SDSTS_FIFORDY_SHIFT (5)
-#define ICH6_HDA_SDSTS_DE_SHIFT     (4)
-#define ICH6_HDA_SDSTS_FE_SHIFT     (3)
-#define ICH6_HDA_SDSTS_BCIS_SHIFT   (2)
-
-#define ICH6_HDA_REG_SD0LPIB        34 /* 0x84 */
-#define ICH6_HDA_REG_SD1LPIB        (HDA_STREAM_REG_DEF(LPIB, 0) + 10) /* 0xA4 */
-#define ICH6_HDA_REG_SD2LPIB        (HDA_STREAM_REG_DEF(LPIB, 0) + 20) /* 0xC4 */
-#define ICH6_HDA_REG_SD3LPIB        (HDA_STREAM_REG_DEF(LPIB, 0) + 30) /* 0xE4 */
-#define ICH6_HDA_REG_SD4LPIB        (HDA_STREAM_REG_DEF(LPIB, 0) + 40) /* 0x104 */
-#define ICH6_HDA_REG_SD5LPIB        (HDA_STREAM_REG_DEF(LPIB, 0) + 50) /* 0x124 */
-#define ICH6_HDA_REG_SD6LPIB        (HDA_STREAM_REG_DEF(LPIB, 0) + 60) /* 0x144 */
-#define ICH6_HDA_REG_SD7LPIB        (HDA_STREAM_REG_DEF(LPIB, 0) + 70) /* 0x164 */
-
-#define SDLPIB(pThis, num)          HDA_REG((pThis), SD(LPIB, num))
-
-#define ICH6_HDA_REG_SD0CBL         35 /* 0x88 */
-#define ICH6_HDA_REG_SD1CBL         (HDA_STREAM_REG_DEF(CBL, 0) + 10) /* 0xA8 */
-#define ICH6_HDA_REG_SD2CBL         (HDA_STREAM_REG_DEF(CBL, 0) + 20) /* 0xC8 */
-#define ICH6_HDA_REG_SD3CBL         (HDA_STREAM_REG_DEF(CBL, 0) + 30) /* 0xE8 */
-#define ICH6_HDA_REG_SD4CBL         (HDA_STREAM_REG_DEF(CBL, 0) + 40) /* 0x108 */
-#define ICH6_HDA_REG_SD5CBL         (HDA_STREAM_REG_DEF(CBL, 0) + 50) /* 0x128 */
-#define ICH6_HDA_REG_SD6CBL         (HDA_STREAM_REG_DEF(CBL, 0) + 60) /* 0x148 */
-#define ICH6_HDA_REG_SD7CBL         (HDA_STREAM_REG_DEF(CBL, 0) + 70) /* 0x168 */
-
-#define SDLCBL(pThis, num)          HDA_REG((pThis), SD(CBL, num))
-
-#define ICH6_HDA_REG_SD0LVI         36 /* 0x8C */
-#define ICH6_HDA_REG_SD1LVI         (HDA_STREAM_REG_DEF(LVI, 0) + 10) /* 0xAC */
-#define ICH6_HDA_REG_SD2LVI         (HDA_STREAM_REG_DEF(LVI, 0) + 20) /* 0xCC */
-#define ICH6_HDA_REG_SD3LVI         (HDA_STREAM_REG_DEF(LVI, 0) + 30) /* 0xEC */
-#define ICH6_HDA_REG_SD4LVI         (HDA_STREAM_REG_DEF(LVI, 0) + 40) /* 0x10C */
-#define ICH6_HDA_REG_SD5LVI         (HDA_STREAM_REG_DEF(LVI, 0) + 50) /* 0x12C */
-#define ICH6_HDA_REG_SD6LVI         (HDA_STREAM_REG_DEF(LVI, 0) + 60) /* 0x14C */
-#define ICH6_HDA_REG_SD7LVI         (HDA_STREAM_REG_DEF(LVI, 0) + 70) /* 0x16C */
-
-#define SDLVI(pThis, num)           HDA_REG((pThis), SD(LVI, num))
-
-#define ICH6_HDA_REG_SD0FIFOW       37 /* 0x8E */
-#define ICH6_HDA_REG_SD1FIFOW       (HDA_STREAM_REG_DEF(FIFOW, 0) + 10) /* 0xAE */
-#define ICH6_HDA_REG_SD2FIFOW       (HDA_STREAM_REG_DEF(FIFOW, 0) + 20) /* 0xCE */
-#define ICH6_HDA_REG_SD3FIFOW       (HDA_STREAM_REG_DEF(FIFOW, 0) + 30) /* 0xEE */
-#define ICH6_HDA_REG_SD4FIFOW       (HDA_STREAM_REG_DEF(FIFOW, 0) + 40) /* 0x10E */
-#define ICH6_HDA_REG_SD5FIFOW       (HDA_STREAM_REG_DEF(FIFOW, 0) + 50) /* 0x12E */
-#define ICH6_HDA_REG_SD6FIFOW       (HDA_STREAM_REG_DEF(FIFOW, 0) + 60) /* 0x14E */
-#define ICH6_HDA_REG_SD7FIFOW       (HDA_STREAM_REG_DEF(FIFOW, 0) + 70) /* 0x16E */
+#define HDA_SDSTS_FIFORDY_SHIFT     5
+#define HDA_SDSTS_DE_SHIFT          4
+#define HDA_SDSTS_FE_SHIFT          3
+#define HDA_SDSTS_BCIS_SHIFT        2
+
+#define HDA_REG_SD0LPIB             36 /* 0x84 */
+#define HDA_REG_SD1LPIB             (HDA_STREAM_REG_DEF(LPIB, 0) + 10) /* 0xA4 */
+#define HDA_REG_SD2LPIB             (HDA_STREAM_REG_DEF(LPIB, 0) + 20) /* 0xC4 */
+#define HDA_REG_SD3LPIB             (HDA_STREAM_REG_DEF(LPIB, 0) + 30) /* 0xE4 */
+#define HDA_REG_SD4LPIB             (HDA_STREAM_REG_DEF(LPIB, 0) + 40) /* 0x104 */
+#define HDA_REG_SD5LPIB             (HDA_STREAM_REG_DEF(LPIB, 0) + 50) /* 0x124 */
+#define HDA_REG_SD6LPIB             (HDA_STREAM_REG_DEF(LPIB, 0) + 60) /* 0x144 */
+#define HDA_REG_SD7LPIB             (HDA_STREAM_REG_DEF(LPIB, 0) + 70) /* 0x164 */
+#define HDA_RMX_SD0LPIB             34
+#define HDA_RMX_SD1LPIB             (HDA_STREAM_RMX_DEF(LPIB, 0) + 10)
+#define HDA_RMX_SD2LPIB             (HDA_STREAM_RMX_DEF(LPIB, 0) + 20)
+#define HDA_RMX_SD3LPIB             (HDA_STREAM_RMX_DEF(LPIB, 0) + 30)
+#define HDA_RMX_SD4LPIB             (HDA_STREAM_RMX_DEF(LPIB, 0) + 40)
+#define HDA_RMX_SD5LPIB             (HDA_STREAM_RMX_DEF(LPIB, 0) + 50)
+#define HDA_RMX_SD6LPIB             (HDA_STREAM_RMX_DEF(LPIB, 0) + 60)
+#define HDA_RMX_SD7LPIB             (HDA_STREAM_RMX_DEF(LPIB, 0) + 70)
+
+#define HDA_REG_SD0CBL              37 /* 0x88 */
+#define HDA_REG_SD1CBL              (HDA_STREAM_REG_DEF(CBL, 0) + 10) /* 0xA8 */
+#define HDA_REG_SD2CBL              (HDA_STREAM_REG_DEF(CBL, 0) + 20) /* 0xC8 */
+#define HDA_REG_SD3CBL              (HDA_STREAM_REG_DEF(CBL, 0) + 30) /* 0xE8 */
+#define HDA_REG_SD4CBL              (HDA_STREAM_REG_DEF(CBL, 0) + 40) /* 0x108 */
+#define HDA_REG_SD5CBL              (HDA_STREAM_REG_DEF(CBL, 0) + 50) /* 0x128 */
+#define HDA_REG_SD6CBL              (HDA_STREAM_REG_DEF(CBL, 0) + 60) /* 0x148 */
+#define HDA_REG_SD7CBL              (HDA_STREAM_REG_DEF(CBL, 0) + 70) /* 0x168 */
+#define HDA_RMX_SD0CBL              35
+#define HDA_RMX_SD1CBL              (HDA_STREAM_RMX_DEF(CBL, 0) + 10)
+#define HDA_RMX_SD2CBL              (HDA_STREAM_RMX_DEF(CBL, 0) + 20)
+#define HDA_RMX_SD3CBL              (HDA_STREAM_RMX_DEF(CBL, 0) + 30)
+#define HDA_RMX_SD4CBL              (HDA_STREAM_RMX_DEF(CBL, 0) + 40)
+#define HDA_RMX_SD5CBL              (HDA_STREAM_RMX_DEF(CBL, 0) + 50)
+#define HDA_RMX_SD6CBL              (HDA_STREAM_RMX_DEF(CBL, 0) + 60)
+#define HDA_RMX_SD7CBL              (HDA_STREAM_RMX_DEF(CBL, 0) + 70)
+
+
+#define HDA_REG_SD0LVI              38 /* 0x8C */
+#define HDA_REG_SD1LVI              (HDA_STREAM_REG_DEF(LVI, 0) + 10) /* 0xAC */
+#define HDA_REG_SD2LVI              (HDA_STREAM_REG_DEF(LVI, 0) + 20) /* 0xCC */
+#define HDA_REG_SD3LVI              (HDA_STREAM_REG_DEF(LVI, 0) + 30) /* 0xEC */
+#define HDA_REG_SD4LVI              (HDA_STREAM_REG_DEF(LVI, 0) + 40) /* 0x10C */
+#define HDA_REG_SD5LVI              (HDA_STREAM_REG_DEF(LVI, 0) + 50) /* 0x12C */
+#define HDA_REG_SD6LVI              (HDA_STREAM_REG_DEF(LVI, 0) + 60) /* 0x14C */
+#define HDA_REG_SD7LVI              (HDA_STREAM_REG_DEF(LVI, 0) + 70) /* 0x16C */
+#define HDA_RMX_SD0LVI              36
+#define HDA_RMX_SD1LVI              (HDA_STREAM_RMX_DEF(LVI, 0) + 10)
+#define HDA_RMX_SD2LVI              (HDA_STREAM_RMX_DEF(LVI, 0) + 20)
+#define HDA_RMX_SD3LVI              (HDA_STREAM_RMX_DEF(LVI, 0) + 30)
+#define HDA_RMX_SD4LVI              (HDA_STREAM_RMX_DEF(LVI, 0) + 40)
+#define HDA_RMX_SD5LVI              (HDA_STREAM_RMX_DEF(LVI, 0) + 50)
+#define HDA_RMX_SD6LVI              (HDA_STREAM_RMX_DEF(LVI, 0) + 60)
+#define HDA_RMX_SD7LVI              (HDA_STREAM_RMX_DEF(LVI, 0) + 70)
+
+#define HDA_REG_SD0FIFOW            39 /* 0x8E */
+#define HDA_REG_SD1FIFOW            (HDA_STREAM_REG_DEF(FIFOW, 0) + 10) /* 0xAE */
+#define HDA_REG_SD2FIFOW            (HDA_STREAM_REG_DEF(FIFOW, 0) + 20) /* 0xCE */
+#define HDA_REG_SD3FIFOW            (HDA_STREAM_REG_DEF(FIFOW, 0) + 30) /* 0xEE */
+#define HDA_REG_SD4FIFOW            (HDA_STREAM_REG_DEF(FIFOW, 0) + 40) /* 0x10E */
+#define HDA_REG_SD5FIFOW            (HDA_STREAM_REG_DEF(FIFOW, 0) + 50) /* 0x12E */
+#define HDA_REG_SD6FIFOW            (HDA_STREAM_REG_DEF(FIFOW, 0) + 60) /* 0x14E */
+#define HDA_REG_SD7FIFOW            (HDA_STREAM_REG_DEF(FIFOW, 0) + 70) /* 0x16E */
+#define HDA_RMX_SD0FIFOW            37
+#define HDA_RMX_SD1FIFOW            (HDA_STREAM_RMX_DEF(FIFOW, 0) + 10)
+#define HDA_RMX_SD2FIFOW            (HDA_STREAM_RMX_DEF(FIFOW, 0) + 20)
+#define HDA_RMX_SD3FIFOW            (HDA_STREAM_RMX_DEF(FIFOW, 0) + 30)
+#define HDA_RMX_SD4FIFOW            (HDA_STREAM_RMX_DEF(FIFOW, 0) + 40)
+#define HDA_RMX_SD5FIFOW            (HDA_STREAM_RMX_DEF(FIFOW, 0) + 50)
+#define HDA_RMX_SD6FIFOW            (HDA_STREAM_RMX_DEF(FIFOW, 0) + 60)
+#define HDA_RMX_SD7FIFOW            (HDA_STREAM_RMX_DEF(FIFOW, 0) + 70)
 
 /*
  * ICH6 datasheet defined limits for FIFOW values (18.2.38)
  */
-#define HDA_SDFIFOW_8B              (0x2)
-#define HDA_SDFIFOW_16B             (0x3)
-#define HDA_SDFIFOW_32B             (0x4)
-#define SDFIFOW(pThis, num)         HDA_REG((pThis), SD(FIFOW, num))
-
-#define ICH6_HDA_REG_SD0FIFOS       38 /* 0x90 */
-#define ICH6_HDA_REG_SD1FIFOS       (HDA_STREAM_REG_DEF(FIFOS, 0) + 10) /* 0xB0 */
-#define ICH6_HDA_REG_SD2FIFOS       (HDA_STREAM_REG_DEF(FIFOS, 0) + 20) /* 0xD0 */
-#define ICH6_HDA_REG_SD3FIFOS       (HDA_STREAM_REG_DEF(FIFOS, 0) + 30) /* 0xF0 */
-#define ICH6_HDA_REG_SD4FIFOS       (HDA_STREAM_REG_DEF(FIFOS, 0) + 40) /* 0x110 */
-#define ICH6_HDA_REG_SD5FIFOS       (HDA_STREAM_REG_DEF(FIFOS, 0) + 50) /* 0x130 */
-#define ICH6_HDA_REG_SD6FIFOS       (HDA_STREAM_REG_DEF(FIFOS, 0) + 60) /* 0x150 */
-#define ICH6_HDA_REG_SD7FIFOS       (HDA_STREAM_REG_DEF(FIFOS, 0) + 70) /* 0x170 */
+#define HDA_SDFIFOW_8B              0x2
+#define HDA_SDFIFOW_16B             0x3
+#define HDA_SDFIFOW_32B             0x4
+
+#define HDA_REG_SD0FIFOS            40 /* 0x90 */
+#define HDA_REG_SD1FIFOS            (HDA_STREAM_REG_DEF(FIFOS, 0) + 10) /* 0xB0 */
+#define HDA_REG_SD2FIFOS            (HDA_STREAM_REG_DEF(FIFOS, 0) + 20) /* 0xD0 */
+#define HDA_REG_SD3FIFOS            (HDA_STREAM_REG_DEF(FIFOS, 0) + 30) /* 0xF0 */
+#define HDA_REG_SD4FIFOS            (HDA_STREAM_REG_DEF(FIFOS, 0) + 40) /* 0x110 */
+#define HDA_REG_SD5FIFOS            (HDA_STREAM_REG_DEF(FIFOS, 0) + 50) /* 0x130 */
+#define HDA_REG_SD6FIFOS            (HDA_STREAM_REG_DEF(FIFOS, 0) + 60) /* 0x150 */
+#define HDA_REG_SD7FIFOS            (HDA_STREAM_REG_DEF(FIFOS, 0) + 70) /* 0x170 */
+#define HDA_RMX_SD0FIFOS            38
+#define HDA_RMX_SD1FIFOS            (HDA_STREAM_RMX_DEF(FIFOS, 0) + 10)
+#define HDA_RMX_SD2FIFOS            (HDA_STREAM_RMX_DEF(FIFOS, 0) + 20)
+#define HDA_RMX_SD3FIFOS            (HDA_STREAM_RMX_DEF(FIFOS, 0) + 30)
+#define HDA_RMX_SD4FIFOS            (HDA_STREAM_RMX_DEF(FIFOS, 0) + 40)
+#define HDA_RMX_SD5FIFOS            (HDA_STREAM_RMX_DEF(FIFOS, 0) + 50)
+#define HDA_RMX_SD6FIFOS            (HDA_STREAM_RMX_DEF(FIFOS, 0) + 60)
+#define HDA_RMX_SD7FIFOS            (HDA_STREAM_RMX_DEF(FIFOS, 0) + 70)
 
 /*
  * ICH6 datasheet defines limits for FIFOS registers (18.2.39)
  * formula: size - 1
  * Other values not listed are not supported.
  */
-#define HDA_SDONFIFO_16B            (0x0F) /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
-#define HDA_SDONFIFO_32B            (0x1F) /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
-#define HDA_SDONFIFO_64B            (0x3F) /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
-#define HDA_SDONFIFO_128B           (0x7F) /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
-#define HDA_SDONFIFO_192B           (0xBF) /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
-#define HDA_SDONFIFO_256B           (0xFF) /* 20-, 24-bit Output Streams */
-#define HDA_SDINFIFO_120B           (0x77) /* 8-, 16-, 20-, 24-, 32-bit Input Streams */
-#define HDA_SDINFIFO_160B           (0x9F) /* 20-, 24-bit Input Streams Streams */
+#define HDA_SDONFIFO_16B            0x0F /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
+#define HDA_SDONFIFO_32B            0x1F /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
+#define HDA_SDONFIFO_64B            0x3F /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
+#define HDA_SDONFIFO_128B           0x7F /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
+#define HDA_SDONFIFO_192B           0xBF /* 8-, 16-, 20-, 24-, 32-bit Output Streams */
+#define HDA_SDONFIFO_256B           0xFF /* 20-, 24-bit Output Streams */
+#define HDA_SDINFIFO_120B           0x77 /* 8-, 16-, 20-, 24-, 32-bit Input Streams */
+#define HDA_SDINFIFO_160B           0x9F /* 20-, 24-bit Input Streams Streams */
 #define SDFIFOS(pThis, num)         HDA_REG((pThis), SD(FIFOS, num))
 
-#define ICH6_HDA_REG_SD0FMT         39 /* 0x92 */
-#define ICH6_HDA_REG_SD1FMT         (HDA_STREAM_REG_DEF(FMT, 0) + 10) /* 0xB2 */
-#define ICH6_HDA_REG_SD2FMT         (HDA_STREAM_REG_DEF(FMT, 0) + 20) /* 0xD2 */
-#define ICH6_HDA_REG_SD3FMT         (HDA_STREAM_REG_DEF(FMT, 0) + 30) /* 0xF2 */
-#define ICH6_HDA_REG_SD4FMT         (HDA_STREAM_REG_DEF(FMT, 0) + 40) /* 0x112 */
-#define ICH6_HDA_REG_SD5FMT         (HDA_STREAM_REG_DEF(FMT, 0) + 50) /* 0x132 */
-#define ICH6_HDA_REG_SD6FMT         (HDA_STREAM_REG_DEF(FMT, 0) + 60) /* 0x152 */
-#define ICH6_HDA_REG_SD7FMT         (HDA_STREAM_REG_DEF(FMT, 0) + 70) /* 0x172 */
+#define HDA_REG_SD0FMT              41 /* 0x92 */
+#define HDA_REG_SD1FMT              (HDA_STREAM_REG_DEF(FMT, 0) + 10) /* 0xB2 */
+#define HDA_REG_SD2FMT              (HDA_STREAM_REG_DEF(FMT, 0) + 20) /* 0xD2 */
+#define HDA_REG_SD3FMT              (HDA_STREAM_REG_DEF(FMT, 0) + 30) /* 0xF2 */
+#define HDA_REG_SD4FMT              (HDA_STREAM_REG_DEF(FMT, 0) + 40) /* 0x112 */
+#define HDA_REG_SD5FMT              (HDA_STREAM_REG_DEF(FMT, 0) + 50) /* 0x132 */
+#define HDA_REG_SD6FMT              (HDA_STREAM_REG_DEF(FMT, 0) + 60) /* 0x152 */
+#define HDA_REG_SD7FMT              (HDA_STREAM_REG_DEF(FMT, 0) + 70) /* 0x172 */
+#define HDA_RMX_SD0FMT              39
+#define HDA_RMX_SD1FMT              (HDA_STREAM_RMX_DEF(FMT, 0) + 10)
+#define HDA_RMX_SD2FMT              (HDA_STREAM_RMX_DEF(FMT, 0) + 20)
+#define HDA_RMX_SD3FMT              (HDA_STREAM_RMX_DEF(FMT, 0) + 30)
+#define HDA_RMX_SD4FMT              (HDA_STREAM_RMX_DEF(FMT, 0) + 40)
+#define HDA_RMX_SD5FMT              (HDA_STREAM_RMX_DEF(FMT, 0) + 50)
+#define HDA_RMX_SD6FMT              (HDA_STREAM_RMX_DEF(FMT, 0) + 60)
+#define HDA_RMX_SD7FMT              (HDA_STREAM_RMX_DEF(FMT, 0) + 70)
 
 #define SDFMT(pThis, num)           (HDA_REG((pThis), SD(FMT, num)))
-#define ICH6_HDA_SDFMT_BASE_RATE_SHIFT (14)
-#define ICH6_HDA_SDFMT_MULT_SHIFT   (11)
-#define ICH6_HDA_SDFMT_MULT_MASK    (0x7)
-#define ICH6_HDA_SDFMT_DIV_SHIFT    (8)
-#define ICH6_HDA_SDFMT_DIV_MASK     (0x7)
-#define ICH6_HDA_SDFMT_BITS_SHIFT   (4)
-#define ICH6_HDA_SDFMT_BITS_MASK    (0x7)
+#define HDA_SDFMT_BASE_RATE_SHIFT   14
+#define HDA_SDFMT_MULT_SHIFT        11
+#define HDA_SDFMT_MULT_MASK         0x7
+#define HDA_SDFMT_DIV_SHIFT         8
+#define HDA_SDFMT_DIV_MASK          0x7
+#define HDA_SDFMT_BITS_SHIFT        4
+#define HDA_SDFMT_BITS_MASK         0x7
 #define SDFMT_BASE_RATE(pThis, num) ((SDFMT(pThis, num) & HDA_REG_FIELD_FLAG_MASK(SDFMT, BASE_RATE)) >> HDA_REG_FIELD_SHIFT(SDFMT, BASE_RATE))
 #define SDFMT_MULT(pThis, num)      ((SDFMT((pThis), num) & HDA_REG_FIELD_MASK(SDFMT,MULT)) >> HDA_REG_FIELD_SHIFT(SDFMT, MULT))
 #define SDFMT_DIV(pThis, num)       ((SDFMT((pThis), num) & HDA_REG_FIELD_MASK(SDFMT,DIV)) >> HDA_REG_FIELD_SHIFT(SDFMT, DIV))
 
-#define ICH6_HDA_REG_SD0BDPL        40 /* 0x98 */
-#define ICH6_HDA_REG_SD1BDPL        (HDA_STREAM_REG_DEF(BDPL, 0) + 10) /* 0xB8 */
-#define ICH6_HDA_REG_SD2BDPL        (HDA_STREAM_REG_DEF(BDPL, 0) + 20) /* 0xD8 */
-#define ICH6_HDA_REG_SD3BDPL        (HDA_STREAM_REG_DEF(BDPL, 0) + 30) /* 0xF8 */
-#define ICH6_HDA_REG_SD4BDPL        (HDA_STREAM_REG_DEF(BDPL, 0) + 40) /* 0x118 */
-#define ICH6_HDA_REG_SD5BDPL        (HDA_STREAM_REG_DEF(BDPL, 0) + 50) /* 0x138 */
-#define ICH6_HDA_REG_SD6BDPL        (HDA_STREAM_REG_DEF(BDPL, 0) + 60) /* 0x158 */
-#define ICH6_HDA_REG_SD7BDPL        (HDA_STREAM_REG_DEF(BDPL, 0) + 70) /* 0x178 */
+#define HDA_REG_SD0BDPL             42 /* 0x98 */
+#define HDA_REG_SD1BDPL             (HDA_STREAM_REG_DEF(BDPL, 0) + 10) /* 0xB8 */
+#define HDA_REG_SD2BDPL             (HDA_STREAM_REG_DEF(BDPL, 0) + 20) /* 0xD8 */
+#define HDA_REG_SD3BDPL             (HDA_STREAM_REG_DEF(BDPL, 0) + 30) /* 0xF8 */
+#define HDA_REG_SD4BDPL             (HDA_STREAM_REG_DEF(BDPL, 0) + 40) /* 0x118 */
+#define HDA_REG_SD5BDPL             (HDA_STREAM_REG_DEF(BDPL, 0) + 50) /* 0x138 */
+#define HDA_REG_SD6BDPL             (HDA_STREAM_REG_DEF(BDPL, 0) + 60) /* 0x158 */
+#define HDA_REG_SD7BDPL             (HDA_STREAM_REG_DEF(BDPL, 0) + 70) /* 0x178 */
+#define HDA_RMX_SD0BDPL             40
+#define HDA_RMX_SD1BDPL             (HDA_STREAM_RMX_DEF(BDPL, 0) + 10)
+#define HDA_RMX_SD2BDPL             (HDA_STREAM_RMX_DEF(BDPL, 0) + 20)
+#define HDA_RMX_SD3BDPL             (HDA_STREAM_RMX_DEF(BDPL, 0) + 30)
+#define HDA_RMX_SD4BDPL             (HDA_STREAM_RMX_DEF(BDPL, 0) + 40)
+#define HDA_RMX_SD5BDPL             (HDA_STREAM_RMX_DEF(BDPL, 0) + 50)
+#define HDA_RMX_SD6BDPL             (HDA_STREAM_RMX_DEF(BDPL, 0) + 60)
+#define HDA_RMX_SD7BDPL             (HDA_STREAM_RMX_DEF(BDPL, 0) + 70)
+
+#define HDA_REG_SD0BDPU             43 /* 0x9C */
+#define HDA_REG_SD1BDPU             (HDA_STREAM_REG_DEF(BDPU, 0) + 10) /* 0xBC */
+#define HDA_REG_SD2BDPU             (HDA_STREAM_REG_DEF(BDPU, 0) + 20) /* 0xDC */
+#define HDA_REG_SD3BDPU             (HDA_STREAM_REG_DEF(BDPU, 0) + 30) /* 0xFC */
+#define HDA_REG_SD4BDPU             (HDA_STREAM_REG_DEF(BDPU, 0) + 40) /* 0x11C */
+#define HDA_REG_SD5BDPU             (HDA_STREAM_REG_DEF(BDPU, 0) + 50) /* 0x13C */
+#define HDA_REG_SD6BDPU             (HDA_STREAM_REG_DEF(BDPU, 0) + 60) /* 0x15C */
+#define HDA_REG_SD7BDPU             (HDA_STREAM_REG_DEF(BDPU, 0) + 70) /* 0x17C */
+#define HDA_RMX_SD0BDPU             41
+#define HDA_RMX_SD1BDPU             (HDA_STREAM_RMX_DEF(BDPU, 0) + 10)
+#define HDA_RMX_SD2BDPU             (HDA_STREAM_RMX_DEF(BDPU, 0) + 20)
+#define HDA_RMX_SD3BDPU             (HDA_STREAM_RMX_DEF(BDPU, 0) + 30)
+#define HDA_RMX_SD4BDPU             (HDA_STREAM_RMX_DEF(BDPU, 0) + 40)
+#define HDA_RMX_SD5BDPU             (HDA_STREAM_RMX_DEF(BDPU, 0) + 50)
+#define HDA_RMX_SD6BDPU             (HDA_STREAM_RMX_DEF(BDPU, 0) + 60)
+#define HDA_RMX_SD7BDPU             (HDA_STREAM_RMX_DEF(BDPU, 0) + 70)
+
+#define HDA_CODEC_CAD_SHIFT         28
+/* Encodes the (required) LUN into a codec command. */
+#define HDA_CODEC_CMD(cmd, lun)     ((cmd) | (lun << HDA_CODEC_CAD_SHIFT))
 
-#define SDBDPL(pThis, num)          HDA_REG((pThis), SD(BDPL, num))
-
-#define ICH6_HDA_REG_SD0BDPU        41 /* 0x9C */
-#define ICH6_HDA_REG_SD1BDPU        (HDA_STREAM_REG_DEF(BDPU, 0) + 10) /* 0xBC */
-#define ICH6_HDA_REG_SD2BDPU        (HDA_STREAM_REG_DEF(BDPU, 0) + 20) /* 0xDC */
-#define ICH6_HDA_REG_SD3BDPU        (HDA_STREAM_REG_DEF(BDPU, 0) + 30) /* 0xFC */
-#define ICH6_HDA_REG_SD4BDPU        (HDA_STREAM_REG_DEF(BDPU, 0) + 40) /* 0x11C */
-#define ICH6_HDA_REG_SD5BDPU        (HDA_STREAM_REG_DEF(BDPU, 0) + 50) /* 0x13C */
-#define ICH6_HDA_REG_SD6BDPU        (HDA_STREAM_REG_DEF(BDPU, 0) + 60) /* 0x15C */
-#define ICH6_HDA_REG_SD7BDPU        (HDA_STREAM_REG_DEF(BDPU, 0) + 70) /* 0x17C */
-
-#define SDBDPU(pThis, num)          HDA_REG((pThis), SD(BDPU, num))
 
 
 /*******************************************************************************
@@ -448,6 +550,65 @@ typedef struct HDASTREAMTRANSFERDESC
     uint32_t u32Fifos;
 } HDASTREAMTRANSFERDESC, *PHDASTREAMTRANSFERDESC;
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+typedef struct HDAINPUTSTREAM
+{
+    /** PCM line input stream. */
+    R3PTRTYPE(PPDMAUDIOGSTSTRMIN)      pStrmIn;
+    /** Mixer handle for line input stream. */
+    R3PTRTYPE(PAUDMIXSTREAM)           phStrmIn;
+} HDAINPUTSTREAM, *PHDAINPUTSTREAM;
+
+typedef struct HDAOUTPUTSTREAM
+{
+    /** PCM output stream. */
+    R3PTRTYPE(PPDMAUDIOGSTSTRMOUT)     pStrmOut;
+    /** Mixer handle for line output stream. */
+    R3PTRTYPE(PAUDMIXSTREAM)           phStrmOut;
+} HDAOUTPUTSTREAM, *PHDAOUTPUTSTREAM;
+
+/**
+ * Struct for maintaining a host backend driver.
+ * This driver must be associated to one, and only one,
+ * HDA codec. The HDA controller does the actual multiplexing
+ * of HDA codec data to various host backend drivers then.
+ *
+ * This HDA device uses a timer in order to synchronize all
+ * read/write accesses across all attached LUNs / backends.
+ */
+typedef struct HDADRIVER
+{
+    union
+    {
+        /** Node for storing this driver in our device driver
+         *  list of HDASTATE. */
+        RTLISTNODE                     Node;
+        struct
+        {
+            R3PTRTYPE(void *)          dummy1;
+            R3PTRTYPE(void *)          dummy2;
+        } dummy;
+    };
+
+    /** Pointer to HDA controller (state). */
+    R3PTRTYPE(PHDASTATE)               pHDAState;
+    /** Driver flags. */
+    PDMAUDIODRVFLAGS                   Flags;
+    uint8_t                            u32Padding0[3];
+    /** LUN to which this driver has been assigned. */
+    uint8_t                            uLUN;
+    /** Audio connector interface to the underlying
+     *  host backend. */
+    R3PTRTYPE(PPDMIAUDIOCONNECTOR)     pConnector;
+    /** Stream for line input. */
+    HDAINPUTSTREAM                     LineIn;
+    /** Stream for mic input. */
+    HDAINPUTSTREAM                     MicIn;
+    /** Stream for output. */
+    HDAOUTPUTSTREAM                    Out;
+} HDADRIVER, *PHDADRIVER;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
 /**
  * ICH Intel HD Audio Controller state.
  */
@@ -464,8 +625,6 @@ typedef struct HDASTATE
 
     uint32_t                           u32Padding;
 
-    /** Pointer to the connector of the attached audio driver. */
-    R3PTRTYPE(PPDMIAUDIOCONNECTOR)     pDrv;
     /** Pointer to the attached audio driver. */
     R3PTRTYPE(PPDMIBASE)               pDrvBase;
     /** The base interface for LUN\#0. */
@@ -478,16 +637,16 @@ typedef struct HDASTATE
     uint64_t                           u64CORBBase;
     uint64_t                           u64RIRBBase;
     uint64_t                           u64DPBase;
-    /** pointer to CORB buf */
+    /** Pointer to CORB buffer. */
     R3PTRTYPE(uint32_t *)              pu32CorbBuf;
-    /** size in bytes of CORB buf */
+    /** Size in bytes of CORB buffer. */
     uint32_t                           cbCorbBuf;
     uint32_t                           u32Padding2;
-    /** pointer on RIRB buf */
+    /** Pointer to RIRB buffer. */
     R3PTRTYPE(uint64_t *)              pu64RirbBuf;
-    /** size in bytes of RIRB buf */
+    /** Size in bytes of RIRB buffer. */
     uint32_t                           cbRirbBuf;
-    /** indicates if HDA in reset. */
+    /** Indicates if HDA is in reset. */
     bool                               fInReset;
     /** Interrupt on completion */
     bool                               fCviIoc;
@@ -495,12 +654,49 @@ typedef struct HDASTATE
     bool                               fR0Enabled;
     /** Flag whether the RC part is enabled. */
     bool                               fRCEnabled;
-    /** The HDA codec state. */
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /** The emulation timer for handling the attached
+     *  LUN drivers. */
+    PTMTIMERR3                         pTimer;
+    /** Timer ticks for handling the LUN drivers. */
+    uint64_t                           uTicks;
+# ifdef VBOX_WITH_STATISTICS
+    STAMPROFILE                        StatTimer;
+    STAMCOUNTER                        StatBytesRead;
+    STAMCOUNTER                        StatBytesWritten;
+# endif
+    /** Pointer to HDA codec to use. */
     R3PTRTYPE(PHDACODEC)               pCodec;
+    union
+    {
+        /** List of associated LUN drivers. */
+        RTLISTANCHOR                   lstDrv;
+        struct
+        {
+            R3PTRTYPE(void *)          dummy1;
+            R3PTRTYPE(void *)          dummy2;
+        } dummy;
+    };
+    /** The device' software mixer. */
+    R3PTRTYPE(PAUDIOMIXER)             pMixer;
+    /** Audio sink for PCM output. */
+    R3PTRTYPE(PAUDMIXSINK)             pSinkOutput;
+    /** Audio mixer sink for line input. */
+    R3PTRTYPE(PAUDMIXSINK)             pSinkLineIn;
+    /** Audio mixer sink for microphone input. */
+    R3PTRTYPE(PAUDMIXSINK)             pSinkMicIn;
+#else /* !VBOX_WITH_PDM_AUDIO_DRIVER */
+    /** The HDA codec to use. */
+    R3PTRTYPE(PHDACODEC)               pCodec;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
     uint64_t                           u64BaseTS;
     /** 1.2.3.4.5.6.7. - someone please tell me what I'm counting! - .8.9.10... */
     uint8_t                            u8Counter;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    uint8_t                            au8Padding[7];
+#else
     uint8_t                            au8Padding[7];
+#endif
 } HDASTATE;
 /** Pointer to the ICH Intel HD Audio Controller state. */
 typedef HDASTATE *PHDASTATE;
@@ -517,13 +713,11 @@ typedef HDASTATE *PHDASTATE;
 #ifndef VBOX_DEVICE_STRUCT_TESTCASE
 static FNPDMDEVRESET hdaReset;
 
-static int hdaRegReadUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
-static int hdaRegWriteUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
-static int hdaRegReadGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
+static int hdaRegReadUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
+static int hdaRegWriteUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
 static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
 static int hdaRegReadSTATESTS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
 static int hdaRegWriteSTATESTS(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
-static int hdaRegReadGCAP(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
 static int hdaRegReadINTSTS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
 static int hdaRegReadWALCLK(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
 static int hdaRegWriteINTSTS(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
@@ -536,7 +730,6 @@ static int hdaRegWriteRIRBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
 static int hdaRegReadIRS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
 static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
-static int hdaRegReadSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
 
 static int hdaRegWriteSDSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
 static int hdaRegWriteSDLVI(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
@@ -555,6 +748,13 @@ static int hdaRegWriteU16(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
 static int hdaRegReadU8(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
 static int hdaRegWriteU8(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static DECLCALLBACK(void) hdaTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser);
+static int hdaTransfer(PHDASTATE pThis, ENMSOUNDSOURCE enmSrc, uint32_t cbAvail);
+#else
+static int hdaTransfer(PHDACODEC pCodec, ENMSOUNDSOURCE enmSource, int cbAvail);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
 #ifdef IN_RING3
 DECLINLINE(void) hdaInitTransferDescriptor(PHDASTATE pThis, PHDABDLEDESC pBdle, uint8_t u8Strm,
                                            PHDASTREAMTRANSFERDESC pStreamDesc);
@@ -568,6 +768,7 @@ static void dump_bd(PHDASTATE pThis, PHDABDLEDESC pBdle, uint64_t u64BaseDMA);
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
+
 /* see 302349 p 6.2*/
 static const struct HDAREGDESC
 {
@@ -583,143 +784,147 @@ static const struct HDAREGDESC
     int       (*pfnRead)(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
     /** Write callback. */
     int       (*pfnWrite)(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
+    /** Index into the register storage array. */
+    uint32_t    mem_idx;
     /** Abbreviated name. */
     const char *abbrev;
-    /** Full name. */
-    const char *name;
 } g_aHdaRegMap[HDA_NREGS] =
+
+/* Turn a short register name into an memory index and a stringized name. */
+#define RA(abbrev)  HDA_MEM_IND_NAME(abbrev), #abbrev
+/* Same as above for an input stream ('I' prefixed). */
+#define IA(abbrev)  HDA_MEM_IND_NAME(abbrev), "I"#abbrev
+/* Same as above for an output stream ('O' prefixed). */
+#define OA(abbrev)  HDA_MEM_IND_NAME(abbrev), "O"#abbrev
+/* Same as above for a register *not* stored in memory. */
+#define UA(abbrev)  0, #abbrev
+
 {
-    /* offset  size     read mask   write mask         read callback         write callback         abbrev      full name                     */
-    /*-------  -------  ----------  ----------  -----------------------  ------------------------ ----------    ------------------------------*/
-    { 0x00000, 0x00002, 0x0000FFFB, 0x00000000, hdaRegReadGCAP         , hdaRegWriteUnimplemented, "GCAP"      , "Global Capabilities" },
-    { 0x00002, 0x00001, 0x000000FF, 0x00000000, hdaRegReadU8           , hdaRegWriteUnimplemented, "VMIN"      , "Minor Version" },
-    { 0x00003, 0x00001, 0x000000FF, 0x00000000, hdaRegReadU8           , hdaRegWriteUnimplemented, "VMAJ"      , "Major Version" },
-    { 0x00004, 0x00002, 0x0000FFFF, 0x00000000, hdaRegReadU16          , hdaRegWriteUnimplemented, "OUTPAY"    , "Output Payload Capabilities" },
-    { 0x00006, 0x00002, 0x0000FFFF, 0x00000000, hdaRegReadU16          , hdaRegWriteUnimplemented, "INPAY"     , "Input Payload Capabilities" },
-    { 0x00008, 0x00004, 0x00000103, 0x00000103, hdaRegReadGCTL         , hdaRegWriteGCTL         , "GCTL"      , "Global Control" },
-    { 0x0000c, 0x00002, 0x00007FFF, 0x00007FFF, hdaRegReadU16          , hdaRegWriteU16          , "WAKEEN"    , "Wake Enable" },
-    { 0x0000e, 0x00002, 0x00000007, 0x00000007, hdaRegReadU8           , hdaRegWriteSTATESTS     , "STATESTS"  , "State Change Status" },
-    { 0x00010, 0x00002, 0xFFFFFFFF, 0x00000000, hdaRegReadUnimplemented, hdaRegWriteUnimplemented, "GSTS"      , "Global Status" },
-    { 0x00020, 0x00004, 0xC00000FF, 0xC00000FF, hdaRegReadU32          , hdaRegWriteU32          , "INTCTL"    , "Interrupt Control" },
-    { 0x00024, 0x00004, 0xC00000FF, 0x00000000, hdaRegReadINTSTS       , hdaRegWriteUnimplemented, "INTSTS"    , "Interrupt Status" },
-    { 0x00030, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadWALCLK       , hdaRegWriteUnimplemented, "WALCLK"    , "Wall Clock Counter" },
+    /* offset  size     read mask   write mask         read callback         write callback         abbrev     */
+    /*-------  -------  ----------  ----------  -----------------------  ------------------------ ----------   */
+    { 0x00000, 0x00002, 0x0000FFFB, 0x00000000, hdaRegReadU16          , hdaRegWriteUnimpl     , RA(GCAP)      }, /* Global Capabilities */
+    { 0x00002, 0x00001, 0x000000FF, 0x00000000, hdaRegReadU8           , hdaRegWriteUnimpl     , RA(VMIN)      }, /* Minor Version */
+    { 0x00003, 0x00001, 0x000000FF, 0x00000000, hdaRegReadU8           , hdaRegWriteUnimpl     , RA(VMAJ)      }, /* Major Version */
+    { 0x00004, 0x00002, 0x0000FFFF, 0x00000000, hdaRegReadU16          , hdaRegWriteUnimpl     , RA(OUTPAY)    }, /* Output Payload Capabilities */
+    { 0x00006, 0x00002, 0x0000FFFF, 0x00000000, hdaRegReadU16          , hdaRegWriteUnimpl     , RA(INPAY)     }, /* Input Payload Capabilities */
+    { 0x00008, 0x00004, 0x00000103, 0x00000103, hdaRegReadU32          , hdaRegWriteGCTL       , RA(GCTL)      }, /* Global Control */
+    { 0x0000c, 0x00002, 0x00007FFF, 0x00007FFF, hdaRegReadU16          , hdaRegWriteU16        , RA(WAKEEN)    }, /* Wake Enable */
+    { 0x0000e, 0x00002, 0x00000007, 0x00000007, hdaRegReadU8           , hdaRegWriteSTATESTS   , RA(STATESTS)  }, /* State Change Status */
+    { 0x00010, 0x00002, 0xFFFFFFFF, 0x00000000, hdaRegReadUnimpl       , hdaRegWriteUnimpl     , RA(GSTS)      }, /* Global Status */
+    { 0x00018, 0x00002, 0x0000FFFF, 0x00000000, hdaRegReadU16          , hdaRegWriteUnimpl     , RA(OUTSTRMPAY)}, /* Output Stream Payload Capability */
+    { 0x0001A, 0x00002, 0x0000FFFF, 0x00000000, hdaRegReadU16          , hdaRegWriteUnimpl     , RA(INSTRMPAY) }, /* Input Stream Payload Capability */
+    { 0x00020, 0x00004, 0xC00000FF, 0xC00000FF, hdaRegReadU32          , hdaRegWriteU32        , RA(INTCTL)    }, /* Interrupt Control */
+    { 0x00024, 0x00004, 0xC00000FF, 0x00000000, hdaRegReadINTSTS       , hdaRegWriteUnimpl     , RA(INTSTS)    }, /* Interrupt Status */
+    { 0x00030, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadWALCLK       , hdaRegWriteUnimpl     , UA(WALCLK)    }, /* Wall Clock Counter */
     /// @todo r=michaln: Doesn't the SSYNC register need to actually stop the stream(s)?
-    { 0x00034, 0x00004, 0x000000FF, 0x000000FF, hdaRegReadU32          , hdaRegWriteU32          , "SSYNC"     , "Stream Synchronization" },
-    { 0x00040, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteBase         , "CORBLBASE" , "CORB Lower Base Address" },
-    { 0x00044, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteBase         , "CORBUBASE" , "CORB Upper Base Address" },
-    { 0x00048, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteCORBWP       , "CORBWP"    , "CORB Write Pointer" },
-#ifdef OLD_REGISTER_TABLE
-    { 0x0004A, 0x00002, 0x000000FF, 0x000080FF, hdaRegReadU8           , hdaRegWriteCORBRP       , "CORBRP"    , "CORB Read Pointer" },
-#else /** @todo 18.2.17 indicates that the 15th bit can be read as well as and written. hdaRegReadU8 is wrong, a special reader should be used. */
-    { 0x0004A, 0x00002, 0x000080FF, 0x000080FF, hdaRegReadU16          , hdaRegWriteCORBRP       , "CORBRP"    , "CORB Read Pointer" },
-#endif
-    { 0x0004C, 0x00001, 0x00000003, 0x00000003, hdaRegReadU8           , hdaRegWriteCORBCTL      , "CORBCTL"   , "CORB Control" },
-    { 0x0004D, 0x00001, 0x00000001, 0x00000001, hdaRegReadU8           , hdaRegWriteCORBSTS      , "CORBSTS"   , "CORB Status" },
-    { 0x0004E, 0x00001, 0x000000F3, 0x00000000, hdaRegReadU8           , hdaRegWriteUnimplemented, "CORBSIZE"  , "CORB Size" },
-    { 0x00050, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteBase         , "RIRBLBASE" , "RIRB Lower Base Address" },
-    { 0x00054, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteBase         , "RIRBUBASE" , "RIRB Upper Base Address" },
-    { 0x00058, 0x00002, 0x000000FF, 0x00008000, hdaRegReadU8           , hdaRegWriteRIRBWP       , "RIRBWP"    , "RIRB Write Pointer" },
-    { 0x0005A, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteU16          , "RINTCNT"   , "Response Interrupt Count" },
-    { 0x0005C, 0x00001, 0x00000007, 0x00000007, hdaRegReadU8           , hdaRegWriteU8           , "RIRBCTL"   , "RIRB Control" },
-    { 0x0005D, 0x00001, 0x00000005, 0x00000005, hdaRegReadU8           , hdaRegWriteRIRBSTS      , "RIRBSTS"   , "RIRB Status" },
-    { 0x0005E, 0x00001, 0x000000F3, 0x00000000, hdaRegReadU8           , hdaRegWriteUnimplemented, "RIRBSIZE"  , "RIRB Size" },
-    { 0x00060, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "IC"        , "Immediate Command" },
-    { 0x00064, 0x00004, 0x00000000, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteUnimplemented, "IR"        , "Immediate Response" },
-#ifdef OLD_REGISTER_TABLE
-    { 0x00068, 0x00004, 0x00000002, 0x00000002, hdaRegReadIRS          , hdaRegWriteIRS          , "IRS"       , "Immediate Command Status" },
-#else /* 18.2.30 as well as the table says 16-bit. Linux accesses it as a 16-bit register. */
-    { 0x00068, 0x00002, 0x00000002, 0x00000002, hdaRegReadIRS          , hdaRegWriteIRS          , "IRS"       , "Immediate Command Status" },
-#endif
-    { 0x00070, 0x00004, 0xFFFFFFFF, 0xFFFFFF81, hdaRegReadU32          , hdaRegWriteBase         , "DPLBASE"   , "DMA Position Lower Base" },
-    { 0x00074, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteBase         , "DPUBASE"   , "DMA Position Upper Base" },
-
-    { 0x00080, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL        , "ISD0CTL"  , "Input Stream Descriptor 0 (ICD0) Control" },
-    { 0x00083, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS        , "ISD0STS"  , "ISD0 Status" },
-    { 0x00084, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32          , "ISD0LPIB" , "ISD0 Link Position In Buffer" },
-    { 0x00088, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "ISD0CBL"  , "ISD0 Cyclic Buffer Length" },
-    { 0x0008C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI        , "ISD0LVI"  , "ISD0 Last Valid Index" },
-    { 0x0008E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW      , "ISD0FIFOW", "ISD0 FIFO Watermark" },
-    { 0x00090, 0x00002, 0x000000FF, 0x00000000, hdaRegReadU16          , hdaRegWriteU16          , "ISD0FIFOS", "ISD0 FIFO Size" },
-    { 0x00092, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT        , "ISD0FMT"  , "ISD0 Format" },
-    { 0x00098, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL       , "ISD0BDPL" , "ISD0 Buffer Descriptor List Pointer-Lower Base Address" },
-    { 0x0009C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU       , "ISD0BDPU" , "ISD0 Buffer Descriptor List Pointer-Upper Base Address" },
-
-    { 0x000A0, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL        , "ISD1CTL"  , "Input Stream Descriptor 1 (ISD1) Control" },
-    { 0x000A3, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS        , "ISD1STS"  , "ISD1 Status" },
-    { 0x000A4, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32          , "ISD1LPIB" , "ISD1 Link Position In Buffer" },
-    { 0x000A8, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "ISD1CBL"  , "ISD1 Cyclic Buffer Length" },
-    { 0x000AC, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI        , "ISD1LVI"  , "ISD1 Last Valid Index" },
-    { 0x000AE, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW      , "ISD1FIFOW", "ISD1 FIFO Watermark" },
-    { 0x000B0, 0x00002, 0x000000FF, 0x00000000, hdaRegReadU16          , hdaRegWriteU16          , "ISD1FIFOS", "ISD1 FIFO Size" },
-    { 0x000B2, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT        , "ISD1FMT"  , "ISD1 Format" },
-    { 0x000B8, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL       , "ISD1BDPL" , "ISD1 Buffer Descriptor List Pointer-Lower Base Address" },
-    { 0x000BC, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU       , "ISD1BDPU" , "ISD1 Buffer Descriptor List Pointer-Upper Base Address" },
-
-    { 0x000C0, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL        , "ISD2CTL"  , "Input Stream Descriptor 2 (ISD2) Control" },
-    { 0x000C3, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS        , "ISD2STS"  , "ISD2 Status" },
-    { 0x000C4, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32          , "ISD2LPIB" , "ISD2 Link Position In Buffer" },
-    { 0x000C8, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "ISD2CBL"  , "ISD2 Cyclic Buffer Length" },
-    { 0x000CC, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI        , "ISD2LVI"  , "ISD2 Last Valid Index" },
-    { 0x000CE, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW      , "ISD2FIFOW", "ISD2 FIFO Watermark" },
-    { 0x000D0, 0x00002, 0x000000FF, 0x00000000, hdaRegReadU16          , hdaRegWriteU16          , "ISD2FIFOS", "ISD2 FIFO Size" },
-    { 0x000D2, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT        , "ISD2FMT"  , "ISD2 Format" },
-    { 0x000D8, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL       , "ISD2BDPL" , "ISD2 Buffer Descriptor List Pointer-Lower Base Address" },
-    { 0x000DC, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU       , "ISD2BDPU" , "ISD2 Buffer Descriptor List Pointer-Upper Base Address" },
-
-    { 0x000E0, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL        , "ISD3CTL"  , "Input Stream Descriptor 3 (ISD3) Control" },
-    { 0x000E3, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS        , "ISD3STS"  , "ISD3 Status" },
-    { 0x000E4, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32          , "ISD3LPIB" , "ISD3 Link Position In Buffer" },
-    { 0x000E8, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "ISD3CBL"  , "ISD3 Cyclic Buffer Length" },
-    { 0x000EC, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI        , "ISD3LVI"  , "ISD3 Last Valid Index" },
-    { 0x000EE, 0x00002, 0x00000005, 0x00000005, hdaRegReadU16          , hdaRegWriteU16          , "ISD3FIFOW", "ISD3 FIFO Watermark" },
-    { 0x000F0, 0x00002, 0x000000FF, 0x00000000, hdaRegReadU16          , hdaRegWriteU16          , "ISD3FIFOS", "ISD3 FIFO Size" },
-    { 0x000F2, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT        , "ISD3FMT"  , "ISD3 Format" },
-    { 0x000F8, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL       , "ISD3BDPL" , "ISD3 Buffer Descriptor List Pointer-Lower Base Address" },
-    { 0x000FC, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU       , "ISD3BDPU" , "ISD3 Buffer Descriptor List Pointer-Upper Base Address" },
-
-    { 0x00100, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadSDCTL        , hdaRegWriteSDCTL        , "OSD0CTL"  , "Input Stream Descriptor 0 (OSD0) Control" },
-    { 0x00103, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS        , "OSD0STS"  , "OSD0 Status" },
-    { 0x00104, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32          , "OSD0LPIB" , "OSD0 Link Position In Buffer" },
-    { 0x00108, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "OSD0CBL"  , "OSD0 Cyclic Buffer Length" },
-    { 0x0010C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI        , "OSD0LVI"  , "OSD0 Last Valid Index" },
-    { 0x0010E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW      , "OSD0FIFOW", "OSD0 FIFO Watermark" },
-    { 0x00110, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteSDFIFOS      , "OSD0FIFOS", "OSD0 FIFO Size" },
-    { 0x00112, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT        , "OSD0FMT"  , "OSD0 Format" },
-    { 0x00118, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL       , "OSD0BDPL" , "OSD0 Buffer Descriptor List Pointer-Lower Base Address" },
-    { 0x0011C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU       , "OSD0BDPU" , "OSD0 Buffer Descriptor List Pointer-Upper Base Address" },
-
-    { 0x00120, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL        , "OSD1CTL"  , "Input Stream Descriptor 0 (OSD1) Control" },
-    { 0x00123, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS        , "OSD1STS"  , "OSD1 Status" },
-    { 0x00124, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32          , "OSD1LPIB" , "OSD1 Link Position In Buffer" },
-    { 0x00128, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "OSD1CBL"  , "OSD1 Cyclic Buffer Length" },
-    { 0x0012C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI        , "OSD1LVI"  , "OSD1 Last Valid Index" },
-    { 0x0012E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW      , "OSD1FIFOW", "OSD1 FIFO Watermark" },
-    { 0x00130, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteSDFIFOS      , "OSD1FIFOS", "OSD1 FIFO Size" },
-    { 0x00132, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT        , "OSD1FMT"  , "OSD1 Format" },
-    { 0x00138, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL       , "OSD1BDPL" , "OSD1 Buffer Descriptor List Pointer-Lower Base Address" },
-    { 0x0013C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU       , "OSD1BDPU" , "OSD1 Buffer Descriptor List Pointer-Upper Base Address" },
-
-    { 0x00140, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL        , "OSD2CTL"  , "Input Stream Descriptor 0 (OSD2) Control" },
-    { 0x00143, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS        , "OSD2STS"  , "OSD2 Status" },
-    { 0x00144, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32          , "OSD2LPIB" , "OSD2 Link Position In Buffer" },
-    { 0x00148, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "OSD2CBL"  , "OSD2 Cyclic Buffer Length" },
-    { 0x0014C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI        , "OSD2LVI"  , "OSD2 Last Valid Index" },
-    { 0x0014E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW      , "OSD2FIFOW", "OSD2 FIFO Watermark" },
-    { 0x00150, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteSDFIFOS      , "OSD2FIFOS", "OSD2 FIFO Size" },
-    { 0x00152, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT        , "OSD2FMT"  , "OSD2 Format" },
-    { 0x00158, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL       , "OSD2BDPL" , "OSD2 Buffer Descriptor List Pointer-Lower Base Address" },
-    { 0x0015C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU       , "OSD2BDPU" , "OSD2 Buffer Descriptor List Pointer-Upper Base Address" },
-
-    { 0x00160, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL        , "OSD3CTL"  , "Input Stream Descriptor 0 (OSD3) Control" },
-    { 0x00163, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS        , "OSD3STS"  , "OSD3 Status" },
-    { 0x00164, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32          , "OSD3LPIB" , "OSD3 Link Position In Buffer" },
-    { 0x00168, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32          , "OSD3CBL"  , "OSD3 Cyclic Buffer Length" },
-    { 0x0016C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI        , "OSD3LVI"  , "OSD3 Last Valid Index" },
-    { 0x0016E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW      , "OSD3FIFOW", "OSD3 FIFO Watermark" },
-    { 0x00170, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteSDFIFOS      , "OSD3FIFOS", "OSD3 FIFO Size" },
-    { 0x00172, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT        , "OSD3FMT"  , "OSD3 Format" },
-    { 0x00178, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL       , "OSD3BDPL" , "OSD3 Buffer Descriptor List Pointer-Lower Base Address" },
-    { 0x0017C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU       , "OSD3BDPU" , "OSD3 Buffer Descriptor List Pointer-Upper Base Address" },
+    { 0x00034, 0x00004, 0x000000FF, 0x000000FF, hdaRegReadU32          , hdaRegWriteU32        , RA(SSYNC)     }, /* Stream Synchronization */
+    { 0x00040, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteBase       , RA(CORBLBASE) }, /* CORB Lower Base Address */
+    { 0x00044, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteBase       , RA(CORBUBASE) }, /* CORB Upper Base Address */
+    { 0x00048, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteCORBWP     , RA(CORBWP)    }, /* CORB Write Pointer */
+    { 0x0004A, 0x00002, 0x000080FF, 0x000080FF, hdaRegReadU16          , hdaRegWriteCORBRP     , RA(CORBRP)    }, /* CORB Read Pointer */
+    { 0x0004C, 0x00001, 0x00000003, 0x00000003, hdaRegReadU8           , hdaRegWriteCORBCTL    , RA(CORBCTL)   }, /* CORB Control */
+    { 0x0004D, 0x00001, 0x00000001, 0x00000001, hdaRegReadU8           , hdaRegWriteCORBSTS    , RA(CORBSTS)   }, /* CORB Status */
+    { 0x0004E, 0x00001, 0x000000F3, 0x00000000, hdaRegReadU8           , hdaRegWriteUnimpl     , RA(CORBSIZE)  }, /* CORB Size */
+    { 0x00050, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteBase       , RA(RIRBLBASE) }, /* RIRB Lower Base Address */
+    { 0x00054, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteBase       , RA(RIRBUBASE) }, /* RIRB Upper Base Address */
+    { 0x00058, 0x00002, 0x000000FF, 0x00008000, hdaRegReadU8           , hdaRegWriteRIRBWP     , RA(RIRBWP)    }, /* RIRB Write Pointer */
+    { 0x0005A, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteU16        , RA(RINTCNT)   }, /* Response Interrupt Count */
+    { 0x0005C, 0x00001, 0x00000007, 0x00000007, hdaRegReadU8           , hdaRegWriteU8         , RA(RIRBCTL)   }, /* RIRB Control */
+    { 0x0005D, 0x00001, 0x00000005, 0x00000005, hdaRegReadU8           , hdaRegWriteRIRBSTS    , RA(RIRBSTS)   }, /* RIRB Status */
+    { 0x0005E, 0x00001, 0x000000F3, 0x00000000, hdaRegReadU8           , hdaRegWriteUnimpl     , RA(RIRBSIZE)  }, /* RIRB Size */
+    { 0x00060, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , RA(IC)        }, /* Immediate Command */
+    { 0x00064, 0x00004, 0x00000000, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteUnimpl     , RA(IR)        }, /* Immediate Response */
+    { 0x00068, 0x00002, 0x00000002, 0x00000002, hdaRegReadIRS          , hdaRegWriteIRS        , RA(IRS)       }, /* Immediate Command Status */
+    { 0x00070, 0x00004, 0xFFFFFFFF, 0xFFFFFF81, hdaRegReadU32          , hdaRegWriteBase       , RA(DPLBASE)   }, /* MA Position Lower Base */
+    { 0x00074, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteBase       , RA(DPUBASE)   }, /* DMA Position Upper Base */
+
+    { 0x00080, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL      , IA(SD0CTL)    }, /* Input Stream Descriptor 0 (ICD0) Control */
+    { 0x00083, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS      , IA(SD0STS)    }, /* ISD0 Status */
+    { 0x00084, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32        , IA(SD0LPIB)   }, /* ISD0 Link Position In Buffer */
+    { 0x00088, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , IA(SD0CBL)    }, /* ISD0 Cyclic Buffer Length */
+    { 0x0008C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI      , IA(SD0LVI)    }, /* ISD0 Last Valid Index */
+    { 0x0008E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW    , IA(SD0FIFOW)  }, /* ISD0 FIFO Watermark */
+    { 0x00090, 0x00002, 0x000000FF, 0x00000000, hdaRegReadU16          , hdaRegWriteU16        , IA(SD0FIFOS)  }, /* ISD0 FIFO Size */
+    { 0x00092, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT      , IA(SD0FMT)    }, /* ISD0 Format */
+    { 0x00098, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL     , IA(SD0BDPL)   }, /* ISD0 Buffer Descriptor List Pointer-Lower Base Address */
+    { 0x0009C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU     , IA(SD0BDPU)   }, /* ISD0 Buffer Descriptor List Pointer-Upper Base Address */
+
+    { 0x000A0, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL      , IA(SD1CTL)    }, /* Input Stream Descriptor 1 (ISD1) Control */
+    { 0x000A3, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS      , IA(SD1STS)    }, /* ISD1 Status */
+    { 0x000A4, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32        , IA(SD1LPIB)   }, /* ISD1 Link Position In Buffer */
+    { 0x000A8, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , IA(SD1CBL)    }, /* ISD1 Cyclic Buffer Length */
+    { 0x000AC, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI      , IA(SD1LVI)    }, /* ISD1 Last Valid Index */
+    { 0x000AE, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW    , IA(SD1FIFOW)  }, /* ISD1 FIFO Watermark */
+    { 0x000B0, 0x00002, 0x000000FF, 0x00000000, hdaRegReadU16          , hdaRegWriteU16        , IA(SD1FIFOS)  }, /* ISD1 FIFO Size */
+    { 0x000B2, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT      , IA(SD1FMT)    }, /* ISD1 Format */
+    { 0x000B8, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL     , IA(SD1BDPL)   }, /* ISD1 Buffer Descriptor List Pointer-Lower Base Address */
+    { 0x000BC, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU     , IA(SD1BDPU)   }, /* ISD1 Buffer Descriptor List Pointer-Upper Base Address */
+
+    { 0x000C0, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL      , IA(SD2CTL)    }, /* Input Stream Descriptor 2 (ISD2) Control */
+    { 0x000C3, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS      , IA(SD2STS)    }, /* ISD2 Status */
+    { 0x000C4, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32        , IA(SD2LPIB)   }, /* ISD2 Link Position In Buffer */
+    { 0x000C8, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , IA(SD2CBL)    }, /* ISD2 Cyclic Buffer Length */
+    { 0x000CC, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI      , IA(SD2LVI)    }, /* ISD2 Last Valid Index */
+    { 0x000CE, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW    , IA(SD2FIFOW)  }, /* ISD2 FIFO Watermark */
+    { 0x000D0, 0x00002, 0x000000FF, 0x00000000, hdaRegReadU16          , hdaRegWriteU16        , IA(SD2FIFOS)  }, /* ISD2 FIFO Size */
+    { 0x000D2, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT      , IA(SD2FMT)    }, /* ISD2 Format */
+    { 0x000D8, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL     , IA(SD2BDPL)   }, /* ISD2 Buffer Descriptor List Pointer-Lower Base Address */
+    { 0x000DC, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU     , IA(SD2BDPU)   }, /* ISD2 Buffer Descriptor List Pointer-Upper Base Address */
+
+    { 0x000E0, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL      , IA(SD3CTL)    }, /* Input Stream Descriptor 3 (ISD3) Control */
+    { 0x000E3, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS      , IA(SD3STS)    }, /* ISD3 Status */
+    { 0x000E4, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32        , IA(SD3LPIB)   }, /* ISD3 Link Position In Buffer */
+    { 0x000E8, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , IA(SD3CBL)    }, /* ISD3 Cyclic Buffer Length */
+    { 0x000EC, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI      , IA(SD3LVI)    }, /* ISD3 Last Valid Index */
+    { 0x000EE, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW    , IA(SD3FIFOW)  }, /* ISD3 FIFO Watermark */
+    { 0x000F0, 0x00002, 0x000000FF, 0x00000000, hdaRegReadU16          , hdaRegWriteU16        , IA(SD3FIFOS)  }, /* ISD3 FIFO Size */
+    { 0x000F2, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT      , IA(SD3FMT)    }, /* ISD3 Format */
+    { 0x000F8, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL     , IA(SD3BDPL)   }, /* ISD3 Buffer Descriptor List Pointer-Lower Base Address */
+    { 0x000FC, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU     , IA(SD3BDPU)   }, /* ISD3 Buffer Descriptor List Pointer-Upper Base Address */
+
+    { 0x00100, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL      , OA(SD4CTL)    }, /* Output Stream Descriptor 4 (OSD4) Control */
+    { 0x00103, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS      , OA(SD4STS)    }, /* OSD4 Status */
+    { 0x00104, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32        , OA(SD4LPIB)   }, /* OSD4 Link Position In Buffer */
+    { 0x00108, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , OA(SD4CBL)    }, /* OSD4 Cyclic Buffer Length */
+    { 0x0010C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI      , OA(SD4LVI)    }, /* OSD4 Last Valid Index */
+    { 0x0010E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW    , OA(SD4FIFOW)  }, /* OSD4 FIFO Watermark */
+    { 0x00110, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteSDFIFOS    , OA(SD4FIFOS)  }, /* OSD4 FIFO Size */
+    { 0x00112, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT      , OA(SD4FMT)    }, /* OSD4 Format */
+    { 0x00118, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL     , OA(SD4BDPL)   }, /* OSD4 Buffer Descriptor List Pointer-Lower Base Address */
+    { 0x0011C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU     , OA(SD4BDPU)   }, /* OSD4 Buffer Descriptor List Pointer-Upper Base Address */
+
+    { 0x00120, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL      , OA(SD5CTL)    }, /* Output Stream Descriptor 5 (OSD5) Control */
+    { 0x00123, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS      , OA(SD5STS)    }, /* OSD5 Status */
+    { 0x00124, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32        , OA(SD5LPIB)   }, /* OSD5 Link Position In Buffer */
+    { 0x00128, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , OA(SD5CBL)    }, /* OSD5 Cyclic Buffer Length */
+    { 0x0012C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI      , OA(SD5LVI)    }, /* OSD5 Last Valid Index */
+    { 0x0012E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW    , OA(SD5FIFOW)  }, /* OSD5 FIFO Watermark */
+    { 0x00130, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteSDFIFOS    , OA(SD5FIFOS)  }, /* OSD5 FIFO Size */
+    { 0x00132, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT      , OA(SD5FMT)    }, /* OSD5 Format */
+    { 0x00138, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL     , OA(SD5BDPL)   }, /* OSD5 Buffer Descriptor List Pointer-Lower Base Address */
+    { 0x0013C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU     , OA(SD5BDPU)   }, /* OSD5 Buffer Descriptor List Pointer-Upper Base Address */
+
+    { 0x00140, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL      , OA(SD6CTL)    }, /* Output Stream Descriptor 6 (OSD6) Control */
+    { 0x00143, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS      , OA(SD6STS)    }, /* OSD6 Status */
+    { 0x00144, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32        , OA(SD6LPIB)   }, /* OSD6 Link Position In Buffer */
+    { 0x00148, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , OA(SD6CBL)    }, /* OSD6 Cyclic Buffer Length */
+    { 0x0014C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI      , OA(SD6LVI)    }, /* OSD6 Last Valid Index */
+    { 0x0014E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW    , OA(SD6FIFOW)  }, /* OSD6 FIFO Watermark */
+    { 0x00150, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteSDFIFOS    , OA(SD6FIFOS)  }, /* OSD6 FIFO Size */
+    { 0x00152, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT      , OA(SD6FMT)    }, /* OSD6 Format */
+    { 0x00158, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL     , OA(SD6BDPL)   }, /* OSD6 Buffer Descriptor List Pointer-Lower Base Address */
+    { 0x0015C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU     , OA(SD6BDPU)   }, /* OSD6 Buffer Descriptor List Pointer-Upper Base Address */
+
+    { 0x00160, 0x00003, 0x00FF001F, 0x00F0001F, hdaRegReadU24          , hdaRegWriteSDCTL      , OA(SD7CTL)    }, /* Output Stream Descriptor 7 (OSD7) Control */
+    { 0x00163, 0x00001, 0x0000001C, 0x0000003C, hdaRegReadU8           , hdaRegWriteSDSTS      , OA(SD7STS)    }, /* OSD7 Status */
+    { 0x00164, 0x00004, 0xFFFFFFFF, 0x00000000, hdaRegReadU32          , hdaRegWriteU32        , OA(SD7LPIB)   }, /* OSD7 Link Position In Buffer */
+    { 0x00168, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteU32        , OA(SD7CBL)    }, /* OSD7 Cyclic Buffer Length */
+    { 0x0016C, 0x00002, 0x0000FFFF, 0x0000FFFF, hdaRegReadU16          , hdaRegWriteSDLVI      , OA(SD7LVI)    }, /* OSD7 Last Valid Index */
+    { 0x0016E, 0x00002, 0x00000007, 0x00000007, hdaRegReadU16          , hdaRegWriteSDFIFOW    , OA(SD7FIFOW)  }, /* OSD7 FIFO Watermark */
+    { 0x00170, 0x00002, 0x000000FF, 0x000000FF, hdaRegReadU16          , hdaRegWriteSDFIFOS    , OA(SD7FIFOS)  }, /* OSD7 FIFO Size */
+    { 0x00172, 0x00002, 0x00007F7F, 0x00007F7F, hdaRegReadU16          , hdaRegWriteSDFMT      , OA(SD7FMT)    }, /* OSD7 Format */
+    { 0x00178, 0x00004, 0xFFFFFF80, 0xFFFFFF80, hdaRegReadU32          , hdaRegWriteSDBDPL     , OA(SD7BDPL)   }, /* OSD7 Buffer Descriptor List Pointer-Lower Base Address */
+    { 0x0017C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, hdaRegReadU32          , hdaRegWriteSDBDPU     , OA(SD7BDPU)   }, /* OSD7 Buffer Descriptor List Pointer-Upper Base Address */
 };
 
 /**
@@ -734,14 +939,14 @@ static const struct
     int         idxAlias;
 } g_aHdaRegAliases[] =
 {
-    { 0x2084, HDA_REG_IND_NAME(SD0LPIB) },
-    { 0x20a4, HDA_REG_IND_NAME(SD1LPIB) },
-    { 0x20c4, HDA_REG_IND_NAME(SD2LPIB) },
-    { 0x20e4, HDA_REG_IND_NAME(SD3LPIB) },
-    { 0x2104, HDA_REG_IND_NAME(SD4LPIB) },
-    { 0x2124, HDA_REG_IND_NAME(SD5LPIB) },
-    { 0x2144, HDA_REG_IND_NAME(SD6LPIB) },
-    { 0x2164, HDA_REG_IND_NAME(SD7LPIB) },
+    { 0x2084, HDA_REG_SD0LPIB },
+    { 0x20a4, HDA_REG_SD1LPIB },
+    { 0x20c4, HDA_REG_SD2LPIB },
+    { 0x20e4, HDA_REG_SD3LPIB },
+    { 0x2104, HDA_REG_SD4LPIB },
+    { 0x2124, HDA_REG_SD5LPIB },
+    { 0x2144, HDA_REG_SD6LPIB },
+    { 0x2164, HDA_REG_SD7LPIB },
 };
 
 #ifdef IN_RING3
@@ -796,13 +1001,13 @@ DECLINLINE(void) hdaUpdatePosBuf(PHDASTATE pThis, PHDASTREAMTRANSFERDESC pStream
 DECLINLINE(uint32_t) hdaFifoWToSz(PHDASTATE pThis, PHDASTREAMTRANSFERDESC pStreamDesc)
 {
 #if 0
-    switch(HDA_STREAM_REG2(pThis, FIFOW, pStreamDesc->u8Strm))
+    switch(HDA_STREAM_REG(pThis, FIFOW, pStreamDesc->u8Strm))
     {
         case HDA_SDFIFOW_8B: return 8;
         case HDA_SDFIFOW_16B: return 16;
         case HDA_SDFIFOW_32B: return 32;
         default:
-            AssertMsgFailed(("hda: unsupported value (%x) in SDFIFOW(,%d)\n", HDA_REG_IND(pThis, pStreamDesc->u8Strm), pStreamDesc->u8Strm));
+            AssertMsgFailed(("unsupported value (%x) in SDFIFOW(,%d)\n", HDA_REG_IND(pThis, pStreamDesc->u8Strm), pStreamDesc->u8Strm));
     }
 #endif
     return 0;
@@ -814,19 +1019,19 @@ static int hdaProcessInterrupt(PHDASTATE pThis)
         (   INTCTL_SX((pThis), num) \
          && (SDSTS(pThis, num) & HDA_REG_FIELD_FLAG_MASK(SDSTS, BCIS)))
     bool fIrq = false;
-    if (   INTCTL_CIE(pThis)
-       && (   RIRBSTS_RINTFL(pThis)
-           || RIRBSTS_RIRBOIS(pThis)
-           || (STATESTS(pThis) & WAKEEN(pThis))))
+    if (   HDA_REG_FLAG_VALUE(pThis, INTCTL, CIE)
+       && (   HDA_REG_FLAG_VALUE(pThis, RIRBSTS, RINTFL)
+           || HDA_REG_FLAG_VALUE(pThis, RIRBSTS, RIRBOIS)
+           || (HDA_REG(pThis, STATESTS) & HDA_REG(pThis, WAKEEN))))
         fIrq = true;
 
     if (   IS_INTERRUPT_OCCURED_AND_ENABLED(pThis, 0)
         || IS_INTERRUPT_OCCURED_AND_ENABLED(pThis, 4))
         fIrq = true;
 
-    if (INTCTL_GIE(pThis))
+    if (HDA_REG_FLAG_VALUE(pThis, INTCTL, GIE))
     {
-        Log(("hda: irq %s\n", fIrq ? "asserted" : "deasserted"));
+        LogFunc(("irq %s\n", fIrq ? "asserted" : "deasserted"));
         PDMDevHlpPCISetIrq(pThis->CTX_SUFF(pDevIns), 0 , fIrq);
     }
     return VINF_SUCCESS;
@@ -953,21 +1158,21 @@ static int hdaCmdSync(PHDASTATE pThis, bool fLocal)
         uint8_t i = 0;
         do
         {
-            Log(("hda: corb%02x: ", i));
+            LogFunc(("corb%02x: ", i));
             uint8_t j = 0;
             do
             {
                 const char *prefix;
-                if ((i + j) == CORBRP(pThis))
+                if ((i + j) == HDA_REG(pThis, CORBRP));
                     prefix = "[R]";
-                else if ((i + j) == CORBWP(pThis))
+                else if ((i + j) == HDA_REG(pThis, CORBWP));
                     prefix = "[W]";
                 else
                     prefix = "   "; /* three spaces */
-                Log(("%s%08x", prefix, pThis->pu32CorbBuf[i + j]));
+                LogFunc(("%s%08x", prefix, pThis->pu32CorbBuf[i + j]));
                 j++;
             } while (j < 8);
-            Log(("\n"));
+            LogFunc(("\n"));
             i += 8;
         } while(i != 0);
 #endif
@@ -981,17 +1186,17 @@ static int hdaCmdSync(PHDASTATE pThis, bool fLocal)
 #ifdef DEBUG_CMD_BUFFER
         uint8_t i = 0;
         do {
-            Log(("hda: rirb%02x: ", i));
+            LogFunc(("rirb%02x: ", i));
             uint8_t j = 0;
             do {
                 const char *prefix;
-                if ((i + j) == RIRBWP(pThis))
+                if ((i + j) == HDA_REG(pThis, RIRBWP))
                     prefix = "[W]";
                 else
                     prefix = "   ";
-                Log((" %s%016lx", prefix, pThis->pu64RirbBuf[i + j]));
+                LogFunc((" %s%016lx", prefix, pThis->pu64RirbBuf[i + j]));
             } while (++j < 8);
-            Log(("\n"));
+            LogFunc(("\n"));
             i += 8;
         } while (i != 0);
 #endif
@@ -1011,11 +1216,12 @@ static int hdaCORBCmdProcess(PHDASTATE pThis)
     rc = hdaCmdSync(pThis, true);
     if (RT_FAILURE(rc))
         AssertRCReturn(rc, rc);
-    corbRp = CORBRP(pThis);
-    corbWp = CORBWP(pThis);
-    rirbWp = RIRBWP(pThis);
+    corbRp = HDA_REG(pThis, CORBRP);
+    corbWp = HDA_REG(pThis, CORBWP);
+    rirbWp = HDA_REG(pThis, RIRBWP);
     Assert((corbWp != corbRp));
-    Log(("hda: CORB(RP:%x, WP:%x) RIRBWP:%x\n", CORBRP(pThis), CORBWP(pThis), RIRBWP(pThis)));
+    LogFlowFunc(("CORB(RP:%x, WP:%x) RIRBWP:%x\n", HDA_REG(pThis, CORBRP),
+                 HDA_REG(pThis, CORBWP), HDA_REG(pThis, RIRBWP)));
     while (corbRp != corbWp)
     {
         uint32_t cmd;
@@ -1023,25 +1229,27 @@ static int hdaCORBCmdProcess(PHDASTATE pThis)
         pfn = NULL;
         corbRp++;
         cmd = pThis->pu32CorbBuf[corbRp];
-        rc = pThis->pCodec->pfnLookup(pThis->pCodec, cmd, &pfn);
+
+        rc = pThis->pCodec->pfnLookup(pThis->pCodec,
+                                      HDA_CODEC_CMD(cmd, 0 /* Codec index */),
+                                      &pfn);
+        if (RT_SUCCESS(rc))
+        {
+            rc = pfn(pThis->pCodec,
+                     HDA_CODEC_CMD(cmd, 0 /* LUN */), &resp);
+        }
+
         if (RT_FAILURE(rc))
             AssertRCReturn(rc, rc);
         Assert(pfn);
         (rirbWp)++;
 
-        if (RT_LIKELY(pfn))
-            rc = pfn(pThis->pCodec, cmd, &resp);
-        else
-            rc = VERR_INVALID_FUNCTION;
-
-        if (RT_FAILURE(rc))
-            AssertRCReturn(rc, rc);
-        Log(("hda: verb:%08x->%016lx\n", cmd, resp));
+        LogFunc(("verb:%08x->%016lx\n", cmd, resp));
         if (   (resp & CODEC_RESPONSE_UNSOLICITED)
             && !HDA_REG_FLAG_VALUE(pThis, GCTL, UR))
         {
-            Log(("hda: unexpected unsolicited response.\n"));
-            pThis->au32Regs[ICH6_HDA_REG_CORBRP] = corbRp;
+            LogFunc(("unexpected unsolicited response.\n"));
+            HDA_REG(pThis, CORBRP) = corbRp;
             return rc;
         }
         pThis->pu64RirbBuf[rirbWp] = resp;
@@ -1049,13 +1257,14 @@ static int hdaCORBCmdProcess(PHDASTATE pThis)
         if (pThis->u8Counter == RINTCNT_N(pThis))
             break;
     }
-    pThis->au32Regs[ICH6_HDA_REG_CORBRP] = corbRp;
-    pThis->au32Regs[ICH6_HDA_REG_RIRBWP] = rirbWp;
+    HDA_REG(pThis, CORBRP) = corbRp;
+    HDA_REG(pThis, RIRBWP) = rirbWp;
     rc = hdaCmdSync(pThis, false);
-    Log(("hda: CORB(RP:%x, WP:%x) RIRBWP:%x\n", CORBRP(pThis), CORBWP(pThis), RIRBWP(pThis)));
-    if (RIRBCTL_RIRB_RIC(pThis))
+    LogFunc(("CORB(RP:%x, WP:%x) RIRBWP:%x\n", HDA_REG(pThis, CORBRP),
+         HDA_REG(pThis, CORBWP), HDA_REG(pThis, RIRBWP)));
+    if (HDA_REG_FLAG_VALUE(pThis, RIRBCTL, RIC))
     {
-        RIRBSTS((pThis)) |= HDA_REG_FIELD_FLAG_MASK(RIRBSTS,RINTFL);
+        HDA_REG(pThis, RIRBSTS) |= HDA_REG_FIELD_FLAG_MASK(RIRBSTS,RINTFL);
         pThis->u8Counter = 0;
         rc = hdaProcessInterrupt(pThis);
     }
@@ -1067,38 +1276,38 @@ static int hdaCORBCmdProcess(PHDASTATE pThis)
 
 static void hdaStreamReset(PHDASTATE pThis, PHDABDLEDESC pBdle, PHDASTREAMTRANSFERDESC pStreamDesc, uint8_t u8Strm)
 {
-    Log(("hda: reset of stream (%d) started\n", u8Strm));
+    LogFunc(("reset of stream (%d) started\n", u8Strm));
     Assert((   pThis
             && pBdle
             && pStreamDesc
             && u8Strm <= 7));
-    memset(pBdle, 0, sizeof(HDABDLEDESC));
+    RT_BZERO(pBdle, sizeof(HDABDLEDESC));
     *pStreamDesc->pu32Lpib = 0;
     *pStreamDesc->pu32Sts = 0;
     /* According to the ICH6 datasheet, 0x40000 is the default value for stream descriptor register 23:20
      * bits are reserved for stream number 18.2.33, resets SDnCTL except SRCT bit */
-    HDA_STREAM_REG2(pThis, CTL, u8Strm) = 0x40000 | (HDA_STREAM_REG2(pThis, CTL, u8Strm) & HDA_REG_FIELD_FLAG_MASK(SDCTL, SRST));
+    HDA_STREAM_REG(pThis, CTL, u8Strm) = 0x40000 | (HDA_STREAM_REG(pThis, CTL, u8Strm) & HDA_REG_FIELD_FLAG_MASK(SDCTL, SRST));
 
     /* ICH6 defines default values (0x77 for input and 0xBF for output descriptors) of FIFO size. 18.2.39 */
-    HDA_STREAM_REG2(pThis, FIFOS, u8Strm) =  u8Strm < 4 ? HDA_SDINFIFO_120B : HDA_SDONFIFO_192B;
-    HDA_STREAM_REG2(pThis, FIFOW, u8Strm) = u8Strm < 4 ? HDA_SDFIFOW_8B : HDA_SDFIFOW_32B;
-    HDA_STREAM_REG2(pThis, CBL, u8Strm) = 0;
-    HDA_STREAM_REG2(pThis, LVI, u8Strm) = 0;
-    HDA_STREAM_REG2(pThis, FMT, u8Strm) = 0;
-    HDA_STREAM_REG2(pThis, BDPU, u8Strm) = 0;
-    HDA_STREAM_REG2(pThis, BDPL, u8Strm) = 0;
-    Log(("hda: reset of stream (%d) finished\n", u8Strm));
+    HDA_STREAM_REG(pThis, FIFOS, u8Strm) =  u8Strm < 4 ? HDA_SDINFIFO_120B : HDA_SDONFIFO_192B;
+    HDA_STREAM_REG(pThis, FIFOW, u8Strm) = u8Strm < 4 ? HDA_SDFIFOW_8B : HDA_SDFIFOW_32B;
+    HDA_STREAM_REG(pThis, CBL, u8Strm) = 0;
+    HDA_STREAM_REG(pThis, LVI, u8Strm) = 0;
+    HDA_STREAM_REG(pThis, FMT, u8Strm) = 0;
+    HDA_STREAM_REG(pThis, BDPU, u8Strm) = 0;
+    HDA_STREAM_REG(pThis, BDPL, u8Strm) = 0;
+    LogFunc(("reset of stream (%d) finished\n", u8Strm));
 }
 
 /* Register access handlers. */
 
-static int hdaRegReadUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
+static int hdaRegReadUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
 {
     *pu32Value = 0;
     return VINF_SUCCESS;
 }
 
-static int hdaRegWriteUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
+static int hdaRegWriteUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
     return VINF_SUCCESS;
 }
@@ -1106,7 +1315,7 @@ static int hdaRegWriteUnimplemented(PHDASTATE pThis, uint32_t iReg, uint32_t u32
 /* U8 */
 static int hdaRegReadU8(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
 {
-    Assert(((pThis->au32Regs[iReg] & g_aHdaRegMap[iReg].readable) & 0xffffff00) == 0);
+    Assert(((pThis->au32Regs[g_aHdaRegMap[iReg].mem_idx] & g_aHdaRegMap[iReg].readable) & 0xffffff00) == 0);
     return hdaRegReadU32(pThis, iReg, pu32Value);
 }
 
@@ -1119,7 +1328,7 @@ static int hdaRegWriteU8(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 /* U16 */
 static int hdaRegReadU16(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
 {
-    Assert(((pThis->au32Regs[iReg] & g_aHdaRegMap[iReg].readable) & 0xffff0000) == 0);
+    Assert(((pThis->au32Regs[g_aHdaRegMap[iReg].mem_idx] & g_aHdaRegMap[iReg].readable) & 0xffff0000) == 0);
     return hdaRegReadU32(pThis, iReg, pu32Value);
 }
 
@@ -1132,7 +1341,7 @@ static int hdaRegWriteU16(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 /* U24 */
 static int hdaRegReadU24(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
 {
-    Assert(((pThis->au32Regs[iReg] & g_aHdaRegMap[iReg].readable) & 0xff000000) == 0);
+    Assert(((pThis->au32Regs[g_aHdaRegMap[iReg].mem_idx] & g_aHdaRegMap[iReg].readable) & 0xff000000) == 0);
     return hdaRegReadU32(pThis, iReg, pu32Value);
 }
 
@@ -1145,20 +1354,19 @@ static int hdaRegWriteU24(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 /* U32 */
 static int hdaRegReadU32(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
 {
-    *pu32Value = pThis->au32Regs[iReg] & g_aHdaRegMap[iReg].readable;
+    uint32_t    iRegMem = g_aHdaRegMap[iReg].mem_idx;
+
+    *pu32Value = pThis->au32Regs[iRegMem] & g_aHdaRegMap[iReg].readable;
     return VINF_SUCCESS;
 }
 
 static int hdaRegWriteU32(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
-    pThis->au32Regs[iReg]  = (u32Value & g_aHdaRegMap[iReg].writable)
-                           | (pThis->au32Regs[iReg] & ~g_aHdaRegMap[iReg].writable);
-    return VINF_SUCCESS;
-}
+    uint32_t    iRegMem = g_aHdaRegMap[iReg].mem_idx;
 
-static int hdaRegReadGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
-{
-    return hdaRegReadU32(pThis, iReg, pu32Value);
+    pThis->au32Regs[iRegMem]  = (u32Value & g_aHdaRegMap[iReg].writable)
+                              | (pThis->au32Regs[iRegMem] & ~g_aHdaRegMap[iReg].writable);
+    return VINF_SUCCESS;
 }
 
 static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
@@ -1166,7 +1374,7 @@ static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
     if (u32Value & HDA_REG_FIELD_FLAG_MASK(GCTL, RST))
     {
         /* exit reset state */
-        GCTL(pThis) |= HDA_REG_FIELD_FLAG_MASK(GCTL, RST);
+        HDA_REG(pThis, GCTL) |= HDA_REG_FIELD_FLAG_MASK(GCTL, RST);
         pThis->fInReset = false;
     }
     else
@@ -1176,12 +1384,12 @@ static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
         if (   HDA_REG_FLAG_VALUE(pThis, CORBCTL, DMA)
             || HDA_REG_FLAG_VALUE(pThis, RIRBCTL, DMA))
         {
-            Log(("hda: HDA enters in reset with DMA(RIRB:%s, CORB:%s)\n",
+            LogFunc(("HDA enters in reset with DMA(RIRB:%s, CORB:%s)\n",
                 HDA_REG_FLAG_VALUE(pThis, CORBCTL, DMA) ? "on" : "off",
                 HDA_REG_FLAG_VALUE(pThis, RIRBCTL, DMA) ? "on" : "off"));
         }
         hdaReset(pThis->CTX_SUFF(pDevIns));
-        GCTL(pThis) &= ~HDA_REG_FIELD_FLAG_MASK(GCTL, RST);
+        HDA_REG(pThis, GCTL) &= ~HDA_REG_FIELD_FLAG_MASK(GCTL, RST);
         pThis->fInReset = true;
 #else
         return VINF_IOM_R3_MMIO_WRITE;
@@ -1190,7 +1398,7 @@ static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
     if (u32Value & HDA_REG_FIELD_FLAG_MASK(GCTL, FSH))
     {
         /* Flush: GSTS:1 set,  see 6.2.6*/
-        GSTS(pThis) |= HDA_REG_FIELD_FLAG_MASK(GSTS, FSH); /* set the flush state */
+        HDA_REG(pThis, GSTS) |= HDA_REG_FIELD_FLAG_MASK(GSTS, FSH); /* set the flush state */
         /* DPLBASE and DPUBASE should be initialized with initial value (see 6.2.6)*/
     }
     return VINF_SUCCESS;
@@ -1198,19 +1406,21 @@ static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 
 static int hdaRegWriteSTATESTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
-    uint32_t v = pThis->au32Regs[iReg];
-    uint32_t nv = u32Value & ICH6_HDA_STATES_SCSF;
-    pThis->au32Regs[iReg] &= ~(v & nv); /* write of 1 clears corresponding bit */
+    uint32_t iRegMem = g_aHdaRegMap[iReg].mem_idx;
+
+    uint32_t v = pThis->au32Regs[iRegMem];
+    uint32_t nv = u32Value & HDA_STATES_SCSF;
+    pThis->au32Regs[iRegMem] &= ~(v & nv); /* write of 1 clears corresponding bit */
     return VINF_SUCCESS;
 }
 
 static int hdaRegReadINTSTS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
 {
     uint32_t v = 0;
-    if (   RIRBSTS_RIRBOIS(pThis)
-        || RIRBSTS_RINTFL(pThis)
+    if (   HDA_REG_FLAG_VALUE(pThis, RIRBSTS, RIRBOIS)
+        || HDA_REG_FLAG_VALUE(pThis, RIRBSTS, RINTFL)
         || HDA_REG_FLAG_VALUE(pThis, CORBSTS, CMEI)
-        || STATESTS(pThis))
+        || HDA_REG(pThis, STATESTS))
         v |= RT_BIT(30);
 #define HDA_IS_STREAM_EVENT(pThis, stream)             \
        (   (SDSTS((pThis),stream) & HDA_REG_FIELD_FLAG_MASK(SDSTS, DE))  \
@@ -1238,15 +1448,10 @@ static int hdaRegReadWALCLK(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
     return VINF_SUCCESS;
 }
 
-static int hdaRegReadGCAP(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
-{
-    return hdaRegReadU16(pThis, iReg, pu32Value);
-}
-
 static int hdaRegWriteCORBRP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
     if (u32Value & HDA_REG_FIELD_FLAG_MASK(CORBRP, RST))
-        CORBRP(pThis) = 0;
+        HDA_REG(pThis, CORBRP) = 0;
 #ifndef BIRD_THINKS_CORBRP_IS_MOSTLY_RO
     else
         return hdaRegWriteU8(pThis, iReg, u32Value);
@@ -1259,7 +1464,7 @@ static int hdaRegWriteCORBCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 #ifdef IN_RING3
     int rc = hdaRegWriteU8(pThis, iReg, u32Value);
     AssertRC(rc);
-    if (   CORBWP(pThis) != CORBRP(pThis)
+    if (   HDA_REG(pThis, CORBWP) != HDA_REG(pThis, CORBRP)
         && HDA_REG_FLAG_VALUE(pThis, CORBCTL, DMA) != 0)
         return hdaCORBCmdProcess(pThis);
     return rc;
@@ -1270,8 +1475,8 @@ static int hdaRegWriteCORBCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 
 static int hdaRegWriteCORBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
-    uint32_t v = CORBSTS(pThis);
-    CORBSTS(pThis) &= ~(v & u32Value);
+    uint32_t v = HDA_REG(pThis, CORBSTS);
+    HDA_REG(pThis, CORBSTS) &= ~(v & u32Value);
     return VINF_SUCCESS;
 }
 
@@ -1282,7 +1487,7 @@ static int hdaRegWriteCORBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
     rc = hdaRegWriteU16(pThis, iReg, u32Value);
     if (RT_FAILURE(rc))
         AssertRCReturn(rc, rc);
-    if (CORBWP(pThis) == CORBRP(pThis))
+    if (HDA_REG(pThis, CORBWP) == HDA_REG(pThis, CORBRP))
         return VINF_SUCCESS;
     if (!HDA_REG_FLAG_VALUE(pThis, CORBCTL, DMA))
         return VINF_SUCCESS;
@@ -1293,11 +1498,6 @@ static int hdaRegWriteCORBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 #endif
 }
 
-static int hdaRegReadSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
-{
-    return hdaRegReadU24(pThis, iReg, pu32Value);
-}
-
 static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
     bool fRun     = RT_BOOL(u32Value & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN));
@@ -1312,7 +1512,7 @@ static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
          * from reset
          */
         Assert((!fReset));
-        Log(("hda: guest initiated exit of stream reset.\n"));
+        LogFunc(("guest initiated exit of stream reset.\n"));
     }
     else if (fReset)
     {
@@ -1326,19 +1526,27 @@ static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
         Assert((!fInRun && !fRun));
         switch (iReg)
         {
-            case ICH6_HDA_REG_SD0CTL:
+            case HDA_REG_SD0CTL:
                 u8Strm = 0;
                 pBdle = &pThis->StInBdle;
                 break;
-            case ICH6_HDA_REG_SD4CTL:
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# ifdef VBOX_WITH_HDA_MIC_IN
+            case HDA_REG_SD2CTL:
+                u8Strm = 2;
+                pBdle = &pThis->StMicBdle;
+                break;
+# endif
+#endif
+            case HDA_REG_SD4CTL:
                 u8Strm = 4;
                 pBdle = &pThis->StOutBdle;
                 break;
             default:
-                Log(("hda: changing SRST bit on non-attached stream\n"));
+                LogFunc(("changing SRST bit on non-attached stream\n"));
                 return hdaRegWriteU24(pThis, iReg, u32Value);
         }
-        Log(("hda: guest initiated enter to stream reset.\n"));
+        LogFunc(("guest initiated enter to stream reset.\n"));
         hdaInitTransferDescriptor(pThis, pBdle, u8Strm, &StreamDesc);
         hdaStreamReset(pThis, pBdle, &StreamDesc, u8Strm);
 #else
@@ -1353,22 +1561,47 @@ static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
             || (fRun && !fInRun))
         {
             Assert((!fReset && !fInReset));
+
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            PHDADRIVER pDrv;
+# endif
             switch (iReg)
             {
-                case ICH6_HDA_REG_SD0CTL:
+                case HDA_REG_SD0CTL:
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+                        pDrv->pConnector->pfnEnableIn(pDrv->pConnector,
+                                                      pDrv->LineIn.pStrmIn, fRun);
+# else
                     AUD_set_active_in(pThis->pCodec->SwVoiceIn, fRun);
+# endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
                     break;
-                case ICH6_HDA_REG_SD4CTL:
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+#  ifdef VBOX_WITH_HDA_MIC_IN
+                case HDA_REG_SD2CTL:
+                    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+                        pDrv->pConnector->pfnEnableIn(pDrv->pConnector,
+                                                      pDrv->MicIn.pStrmIn, fRun);
+#  endif
+# endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+                    break;
+                case HDA_REG_SD4CTL:
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+                        pDrv->pConnector->pfnEnableOut(pDrv->pConnector,
+                                                       pDrv->Out.pStrmOut, fRun);
+# else
                     AUD_set_active_out(pThis->pCodec->SwVoiceOut, fRun);
+# endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
                     break;
                 default:
-                    Log(("hda: changing RUN bit on non-attached stream\n"));
+                    AssertMsgFailed(("Changing RUN bit on non-attached stream, register %RU32\n", iReg));
                     break;
             }
         }
-#else
+#else /* !IN_RING3 */
         return VINF_IOM_R3_MMIO_WRITE;
-#endif
+#endif /* IN_RING3 */
     }
 
     return hdaRegWriteU24(pThis, iReg, u32Value);
@@ -1400,7 +1633,7 @@ static int hdaRegWriteSDFIFOW(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
         case HDA_SDFIFOW_32B:
             return hdaRegWriteU16(pThis, iReg, u32Value);
         default:
-            Log(("hda: Attempt to store unsupported value(%x) in SDFIFOW\n", u32Value));
+            LogFunc(("Attempt to store unsupported value(%x) in SDFIFOW\n", u32Value));
             return hdaRegWriteU16(pThis, iReg, HDA_SDFIFOW_32B);
     }
     return VINF_SUCCESS;
@@ -1415,16 +1648,16 @@ static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
     switch (iReg)
     {
         /* SDInFIFOS is RO, n=0-3 */
-        case ICH6_HDA_REG_SD0FIFOS:
-        case ICH6_HDA_REG_SD1FIFOS:
-        case ICH6_HDA_REG_SD2FIFOS:
-        case ICH6_HDA_REG_SD3FIFOS:
-            Log(("hda: Guest tries change value of FIFO size of Input Stream\n"));
-            return VINF_SUCCESS;
-        case ICH6_HDA_REG_SD4FIFOS:
-        case ICH6_HDA_REG_SD5FIFOS:
-        case ICH6_HDA_REG_SD6FIFOS:
-        case ICH6_HDA_REG_SD7FIFOS:
+        case HDA_REG_SD0FIFOS:
+        case HDA_REG_SD1FIFOS:
+        case HDA_REG_SD2FIFOS:
+        case HDA_REG_SD3FIFOS:
+            LogFunc(("Guest tries change value of FIFO size of input stream\n"));
+            break;
+        case HDA_REG_SD4FIFOS:
+        case HDA_REG_SD5FIFOS:
+        case HDA_REG_SD6FIFOS:
+        case HDA_REG_SD7FIFOS:
             switch(u32Value)
             {
                 case HDA_SDONFIFO_16B:
@@ -1435,35 +1668,48 @@ static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
                     return hdaRegWriteU16(pThis, iReg, u32Value);
 
                 case HDA_SDONFIFO_256B:
-                    Log(("hda: 256-bit is unsupported, HDA is switched into 192-bit mode\n"));
+                    LogFunc(("256-bit is unsupported, HDA is switched into 192-bit mode\n"));
                 default:
                     return hdaRegWriteU16(pThis, iReg, HDA_SDONFIFO_192B);
             }
-            return VINF_SUCCESS;
+            break;
         default:
-            AssertMsgFailed(("Something weird happened with register lookup routine"));
+            AssertMsgFailed(("Something weird happened with register lookup routine\n"));
     }
+
     return VINF_SUCCESS;
 }
 
 #ifdef IN_RING3
-static void hdaSdFmtToAudSettings(uint32_t u32SdFmt, audsettings_t *pAudSetting)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static int hdaSdFmtToAudSettings(uint32_t u32SdFmt, PPDMAUDIOSTREAMCFG pCfg)
+#else
+static int hdaSdFmtToAudSettings(uint32_t u32SdFmt, audsettings_t *pCfg)
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 {
-    Assert((pAudSetting));
-#define EXTRACT_VALUE(v, mask, shift) ((v & ((mask) << (shift))) >> (shift))
-    uint32_t u32Hz = (u32SdFmt & ICH6_HDA_SDFMT_BASE_RATE_SHIFT) ? 44100 : 48000;
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+# define EXTRACT_VALUE(v, mask, shift) ((v & ((mask) << (shift))) >> (shift))
+
+    int rc = VINF_SUCCESS;
+
+    uint32_t u32Hz = (u32SdFmt & HDA_SDFMT_BASE_RATE_SHIFT) ? 44100 : 48000;
     uint32_t u32HzMult = 1;
     uint32_t u32HzDiv = 1;
-    switch (EXTRACT_VALUE(u32SdFmt, ICH6_HDA_SDFMT_MULT_MASK, ICH6_HDA_SDFMT_MULT_SHIFT))
+
+    switch (EXTRACT_VALUE(u32SdFmt, HDA_SDFMT_MULT_MASK, HDA_SDFMT_MULT_SHIFT))
     {
         case 0: u32HzMult = 1; break;
         case 1: u32HzMult = 2; break;
         case 2: u32HzMult = 3; break;
         case 3: u32HzMult = 4; break;
         default:
-            Log(("hda: unsupported multiplier %x\n", u32SdFmt));
+            LogFunc(("Unsupported multiplier %x\n",
+                     EXTRACT_VALUE(u32SdFmt, HDA_SDFMT_MULT_MASK, HDA_SDFMT_MULT_SHIFT)));
+            rc = VERR_NOT_SUPPORTED;
+            break;
     }
-    switch (EXTRACT_VALUE(u32SdFmt, ICH6_HDA_SDFMT_DIV_MASK, ICH6_HDA_SDFMT_DIV_SHIFT))
+    switch (EXTRACT_VALUE(u32SdFmt, HDA_SDFMT_DIV_MASK, HDA_SDFMT_DIV_SHIFT))
     {
         case 0: u32HzDiv = 1; break;
         case 1: u32HzDiv = 2; break;
@@ -1473,36 +1719,75 @@ static void hdaSdFmtToAudSettings(uint32_t u32SdFmt, audsettings_t *pAudSetting)
         case 5: u32HzDiv = 6; break;
         case 6: u32HzDiv = 7; break;
         case 7: u32HzDiv = 8; break;
+        default:
+            LogFunc(("Unsupported divisor %x\n",
+                     EXTRACT_VALUE(u32SdFmt, HDA_SDFMT_DIV_MASK, HDA_SDFMT_DIV_SHIFT)));
+            rc = VERR_NOT_SUPPORTED;
+            break;
     }
-    pAudSetting->freq = u32Hz * u32HzMult / u32HzDiv;
 
-    switch (EXTRACT_VALUE(u32SdFmt, ICH6_HDA_SDFMT_BITS_MASK, ICH6_HDA_SDFMT_BITS_SHIFT))
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PDMAUDIOFMT enmFmt = AUD_FMT_S16; /* Default to 16-bit signed. */
+#else
+    audfmt_e enmFmt = AUD_FMT_S16; /* Default to 16-bit signed. */
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    switch (EXTRACT_VALUE(u32SdFmt, HDA_SDFMT_BITS_MASK, HDA_SDFMT_BITS_SHIFT))
     {
         case 0:
-            Log(("hda: %s requested 8-bit\n", __FUNCTION__));
-            pAudSetting->fmt = AUD_FMT_S8;
+            LogFunc(("%s requested 8-bit\n", __FUNCTION__));
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            enmFmt = AUD_FMT_S8;
+#else
+            enmFmt = AUD_FMT_S8;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
             break;
         case 1:
-            Log(("hda: %s requested 16-bit\n", __FUNCTION__));
-            pAudSetting->fmt = AUD_FMT_S16;
+            LogFunc(("%s requested 16-bit\n", __FUNCTION__));
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            enmFmt = AUD_FMT_S16;
+#else
+            enmFmt = AUD_FMT_S16;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
             break;
         case 2:
-            Log(("hda: %s requested 20-bit\n", __FUNCTION__));
+            LogFunc(("%s requested 20-bit\n", __FUNCTION__));
             break;
         case 3:
-            Log(("hda: %s requested 24-bit\n", __FUNCTION__));
+            LogFunc(("%s requested 24-bit\n", __FUNCTION__));
             break;
         case 4:
-            Log(("hda: %s requested 32-bit\n", __FUNCTION__));
-            pAudSetting->fmt = AUD_FMT_S32;
+            LogFunc(("%s requested 32-bit\n", __FUNCTION__));
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            enmFmt = AUD_FMT_S32;
+#else
+            enmFmt = AUD_FMT_S32;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
             break;
         default:
-            AssertMsgFailed(("Unsupported"));
+            AssertMsgFailed(("Unsupported bits shift %x\n",
+                             EXTRACT_VALUE(u32SdFmt, HDA_SDFMT_BITS_MASK, HDA_SDFMT_BITS_SHIFT)));
+            rc = VERR_NOT_SUPPORTED;
+            break;
     }
-    pAudSetting->nchannels = (u32SdFmt & 0xf) + 1;
-    pAudSetting->fmt = AUD_FMT_S16;
-    pAudSetting->endianness = 0;
-#undef EXTRACT_VALUE
+
+    if (RT_SUCCESS(rc))
+    {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        pCfg->uHz = u32Hz * u32HzMult / u32HzDiv;
+        pCfg->cChannels = (u32SdFmt & 0xf) + 1;
+        pCfg->enmFormat = enmFmt;
+        pCfg->enmEndianness = PDMAUDIOHOSTENDIANNESS;
+#else
+        pCfg->nchannels = (u32SdFmt & 0xf) + 1;
+        pCfg->fmt = enmFmt;
+        pCfg->endianness = 0;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+    }
+
+# undef EXTRACT_VALUE
+
+    return rc;
 }
 #endif
 
@@ -1510,25 +1795,36 @@ static int hdaRegWriteSDFMT(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
 #ifdef IN_RING3
 # ifdef VBOX_WITH_HDA_CODEC_EMU
-    /** @todo a bit more investigation is required here. */
-    int rc = 0;
-    audsettings_t as;
-    /* no reason to reopen voice with same settings */
+    /* No reason to reopen voice with same settings. */
     if (u32Value == HDA_REG_IND(pThis, iReg))
         return VINF_SUCCESS;
-    hdaSdFmtToAudSettings(u32Value, &as);
+
+    PDMAUDIOSTREAMCFG as;
+    int rc = hdaSdFmtToAudSettings(u32Value, &as);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    PHDADRIVER pDrv;
     switch (iReg)
     {
-        case ICH6_HDA_REG_SD0FMT:
-            rc = hdaCodecOpenVoice(pThis->pCodec, PI_INDEX, &as);
+        case HDA_REG_SD0FMT:
+            RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+                rc = hdaCodecOpenStream(pThis->pCodec, PI_INDEX, &as);
             break;
-        case ICH6_HDA_REG_SD4FMT:
-            rc = hdaCodecOpenVoice(pThis->pCodec, PO_INDEX, &as);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# ifdef VBOX_WITH_HDA_MIC_IN
+        case HDA_REG_SD2FMT:
+            RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+                rc = hdaCodecOpenStream(pThis->pCodec, MC_INDEX, &as);
             break;
+# endif
+#endif
         default:
-            Log(("HDA: attempt to change format on %d\n", iReg));
-            rc = 0;
+            LogFunc(("Warning: Attempt to change format on register %d\n", iReg));
+            break;
     }
+
+    /** @todo r=andy rc gets lost; needs fixing. */
     return hdaRegWriteU16(pThis, iReg, u32Value);
 # else
     return hdaRegWriteU16(pThis, iReg, u32Value);
@@ -1558,9 +1854,9 @@ static int hdaRegReadIRS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
 {
     int rc = VINF_SUCCESS;
     /* regarding 3.4.3 we should mark IRS as busy in case CORB is active */
-    if (   CORBWP(pThis) != CORBRP(pThis)
+    if (   HDA_REG(pThis, CORBWP) != HDA_REG(pThis, CORBRP)
         || HDA_REG_FLAG_VALUE(pThis, CORBCTL, DMA))
-        IRS(pThis) = HDA_REG_FIELD_FLAG_MASK(IRS, ICB);  /* busy */
+        HDA_REG(pThis, IRS) = HDA_REG_FIELD_FLAG_MASK(IRS, ICB);  /* busy */
 
     rc = hdaRegReadU32(pThis, iReg, pu32Value);
     return rc;
@@ -1568,40 +1864,45 @@ static int hdaRegReadIRS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
 
 static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
-    int                         rc  = VINF_SUCCESS;
+    int rc = VINF_SUCCESS;
 
     /*
-     * if guest set the ICB bit of IRS register, HDA should process the verb in IC register,
+     * If the guest set the ICB bit of IRS register, HDA should process the verb in IC register,
      * write the response to IR register, and set the IRV (valid in case of success) bit of IRS register.
      */
     if (   u32Value & HDA_REG_FIELD_FLAG_MASK(IRS, ICB)
-        && !IRS_ICB(pThis))
+        && !HDA_REG_FLAG_VALUE(pThis, IRS, ICB))
     {
 #ifdef IN_RING3
         PFNHDACODECVERBPROCESSOR    pfn = NULL;
         uint64_t                    resp;
-        uint32_t cmd = IC(pThis);
-        if (CORBWP(pThis) != CORBRP(pThis))
+        uint32_t cmd = HDA_REG(pThis, IC);
+        if (HDA_REG(pThis, CORBWP) != HDA_REG(pThis, CORBRP))
         {
             /*
              * 3.4.3 defines behavior of immediate Command status register.
              */
-            LogRel(("hda: guest attempted process immediate verb (%x) with active CORB\n", cmd));
+            LogRel(("guest attempted process immediate verb (%x) with active CORB\n", cmd));
             return rc;
         }
-        IRS(pThis) = HDA_REG_FIELD_FLAG_MASK(IRS, ICB);  /* busy */
-        Log(("hda: IC:%x\n", cmd));
-        rc = pThis->pCodec->pfnLookup(pThis->pCodec, cmd, &pfn);
+        HDA_REG(pThis, IRS) = HDA_REG_FIELD_FLAG_MASK(IRS, ICB);  /* busy */
+        LogFunc(("IC:%x\n", cmd));
+
+        rc = pThis->pCodec->pfnLookup(pThis->pCodec,
+                                      HDA_CODEC_CMD(cmd, 0 /* LUN */),
+                                      &pfn);
         if (RT_FAILURE(rc))
             AssertRCReturn(rc, rc);
-        rc = pfn(pThis->pCodec, cmd, &resp);
+        rc = pfn(pThis->pCodec,
+                 HDA_CODEC_CMD(cmd, 0 /* LUN */), &resp);
         if (RT_FAILURE(rc))
             AssertRCReturn(rc, rc);
-        IR(pThis) = (uint32_t)resp;
-        Log(("hda: IR:%x\n", IR(pThis)));
-        IRS(pThis) = HDA_REG_FIELD_FLAG_MASK(IRS, IRV);  /* result is ready  */
-        IRS(pThis) &= ~HDA_REG_FIELD_FLAG_MASK(IRS, ICB); /* busy is clear */
-#else
+
+        HDA_REG(pThis, IR) = (uint32_t)resp;
+        LogFunc(("IR:%x\n", HDA_REG(pThis, IR)));
+        HDA_REG(pThis, IRS) = HDA_REG_FIELD_FLAG_MASK(IRS, IRV);  /* result is ready  */
+        HDA_REG(pThis, IRS) &= ~HDA_REG_FIELD_FLAG_MASK(IRS, ICB); /* busy is clear */
+#else /* !IN_RING3 */
         rc = VINF_IOM_R3_MMIO_WRITE;
 #endif
         return rc;
@@ -1610,8 +1911,8 @@ static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
      * Once the guest read the response, it should clean the IRV bit of the IRS register.
      */
     if (   u32Value & HDA_REG_FIELD_FLAG_MASK(IRS, IRV)
-        && IRS_IRV(pThis))
-        IRS(pThis) &= ~HDA_REG_FIELD_FLAG_MASK(IRS, IRV);
+        && HDA_REG_FLAG_VALUE(pThis, IRS, IRV))
+        HDA_REG(pThis, IRS) &= ~HDA_REG_FIELD_FLAG_MASK(IRS, IRV);
     return rc;
 }
 
@@ -1619,7 +1920,7 @@ static int hdaRegWriteRIRBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
     if (u32Value & HDA_REG_FIELD_FLAG_MASK(RIRBWP, RST))
     {
-        RIRBWP(pThis) = 0;
+        HDA_REG(pThis, RIRBWP) = 0;
     }
     /* The remaining bits are O, see 6.2.22 */
     return VINF_SUCCESS;
@@ -1627,47 +1928,52 @@ static int hdaRegWriteRIRBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 
 static int hdaRegWriteBase(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
+    uint32_t iRegMem = g_aHdaRegMap[iReg].mem_idx;
     int rc = hdaRegWriteU32(pThis, iReg, u32Value);
     if (RT_FAILURE(rc))
         AssertRCReturn(rc, rc);
+
     switch(iReg)
     {
-        case ICH6_HDA_REG_CORBLBASE:
+        case HDA_REG_CORBLBASE:
             pThis->u64CORBBase &= UINT64_C(0xFFFFFFFF00000000);
-            pThis->u64CORBBase |= pThis->au32Regs[iReg];
+            pThis->u64CORBBase |= pThis->au32Regs[iRegMem];
             break;
-        case ICH6_HDA_REG_CORBUBASE:
+        case HDA_REG_CORBUBASE:
             pThis->u64CORBBase &= UINT64_C(0x00000000FFFFFFFF);
-            pThis->u64CORBBase |= ((uint64_t)pThis->au32Regs[iReg] << 32);
+            pThis->u64CORBBase |= ((uint64_t)pThis->au32Regs[iRegMem] << 32);
             break;
-        case ICH6_HDA_REG_RIRLBASE:
+        case HDA_REG_RIRBLBASE:
             pThis->u64RIRBBase &= UINT64_C(0xFFFFFFFF00000000);
-            pThis->u64RIRBBase |= pThis->au32Regs[iReg];
+            pThis->u64RIRBBase |= pThis->au32Regs[iRegMem];
             break;
-        case ICH6_HDA_REG_RIRUBASE:
+        case HDA_REG_RIRBUBASE:
             pThis->u64RIRBBase &= UINT64_C(0x00000000FFFFFFFF);
-            pThis->u64RIRBBase |= ((uint64_t)pThis->au32Regs[iReg] << 32);
+            pThis->u64RIRBBase |= ((uint64_t)pThis->au32Regs[iRegMem] << 32);
             break;
-        case ICH6_HDA_REG_DPLBASE:
+        case HDA_REG_DPLBASE:
             /** @todo: first bit has special meaning */
             pThis->u64DPBase &= UINT64_C(0xFFFFFFFF00000000);
-            pThis->u64DPBase |= pThis->au32Regs[iReg];
+            pThis->u64DPBase |= pThis->au32Regs[iRegMem];
             break;
-        case ICH6_HDA_REG_DPUBASE:
+        case HDA_REG_DPUBASE:
             pThis->u64DPBase &= UINT64_C(0x00000000FFFFFFFF);
-            pThis->u64DPBase |= ((uint64_t)pThis->au32Regs[iReg] << 32);
+            pThis->u64DPBase |= ((uint64_t)pThis->au32Regs[iRegMem] << 32);
             break;
         default:
             AssertMsgFailed(("Invalid index"));
+            break;
     }
-    Log(("hda: CORB base:%llx RIRB base: %llx DP base: %llx\n", pThis->u64CORBBase, pThis->u64RIRBBase, pThis->u64DPBase));
+
+    LogFunc(("CORB base:%llx RIRB base: %llx DP base: %llx\n",
+             pThis->u64CORBBase, pThis->u64RIRBBase, pThis->u64DPBase));
     return rc;
 }
 
 static int hdaRegWriteRIRBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
 {
-    uint8_t v = RIRBSTS(pThis);
-    RIRBSTS(pThis) &= ~(v & u32Value);
+    uint8_t v = HDA_REG(pThis, RIRBSTS);
+    HDA_REG(pThis, RIRBSTS) &= ~(v & u32Value);
 
     return hdaProcessInterrupt(pThis);
 }
@@ -1691,14 +1997,14 @@ static void dump_bd(PHDASTATE pThis, PHDABDLEDESC pBdle, uint64_t u64BaseDMA)
         addr = *(uint64_t *)bdle;
         len = *(uint32_t *)&bdle[8];
         ioc = *(uint32_t *)&bdle[12];
-        Log(("hda: %s bdle[%d] a:%llx, len:%d, ioc:%d\n",  (i == pBdle->u32BdleCvi? "[C]": "   "), i, addr, len, ioc & 0x1));
+        LogFunc(("%s bdle[%d] a:%llx, len:%d, ioc:%d\n",  (i == pBdle->u32BdleCvi? "[C]": "   "), i, addr, len, ioc & 0x1));
         sum += len;
     }
-    Log(("hda: sum: %d\n", sum));
+    LogFunc(("sum: %d\n", sum));
     for (i = 0; i < 8; ++i)
     {
         PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), (pThis->u64DPBase & DPBASE_ADDR_MASK) + i*8, &counter, sizeof(&counter));
-        Log(("hda: %s stream[%d] counter=%x\n", i == SDCTL_NUM(pThis, 4) || i == SDCTL_NUM(pThis, 0)? "[C]": "   ",
+        LogFunc(("%s stream[%d] counter=%x\n", i == SDCTL_NUM(pThis, 4) || i == SDCTL_NUM(pThis, 0)? "[C]": "   ",
              i , counter));
     }
 #endif
@@ -1723,12 +2029,11 @@ static void hdaFetchBdle(PHDASTATE pThis, PHDABDLEDESC pBdle, PHDASTREAMTRANSFER
 DECLINLINE(uint32_t) hdaCalculateTransferBufferLength(PHDABDLEDESC pBdle, PHDASTREAMTRANSFERDESC pStreamDesc,
                                                       uint32_t u32SoundBackendBufferBytesAvail, uint32_t u32CblLimit)
 {
-    uint32_t cb2Copy;
     /*
      * Number of bytes depends on the current position in buffer (u32BdleCviLen-u32BdleCviPos)
      */
     Assert((pBdle->u32BdleCviLen >= pBdle->u32BdleCviPos)); /* sanity */
-    cb2Copy = pBdle->u32BdleCviLen - pBdle->u32BdleCviPos;
+    uint32_t cb2Copy = pBdle->u32BdleCviLen - pBdle->u32BdleCviPos;
     /*
      * we may increase the counter in range of [0, FIFOS + 1]
      */
@@ -1748,18 +2053,24 @@ DECLINLINE(uint32_t) hdaCalculateTransferBufferLength(PHDABDLEDESC pBdle, PHDAST
 DECLINLINE(void) hdaBackendWriteTransferReported(PHDABDLEDESC pBdle, uint32_t cbArranged2Copy, uint32_t cbCopied,
                                                  uint32_t *pu32DMACursor, uint32_t *pu32BackendBufferCapacity)
 {
-    Log(("hda:hdaBackendWriteTransferReported: cbArranged2Copy: %d, cbCopied: %d, pu32DMACursor: %d, pu32BackendBufferCapacity:%d\n",
-        cbArranged2Copy, cbCopied, pu32DMACursor ? *pu32DMACursor : 0, pu32BackendBufferCapacity ? *pu32BackendBufferCapacity : 0));
+    LogFunc(("cbArranged2Copy: %d, cbCopied: %d, pu32DMACursor: %d, pu32BackendBufferCapacity:%d\n",
+             cbArranged2Copy, cbCopied, pu32DMACursor ? *pu32DMACursor : 0, pu32BackendBufferCapacity ? *pu32BackendBufferCapacity : 0));
     Assert((cbCopied));
+    AssertPtr(pu32DMACursor);
     Assert((pu32BackendBufferCapacity && *pu32BackendBufferCapacity));
     /* Assertion!!! Fewer than cbUnderFifoW bytes were copied.
      * Probably we need to move the buffer, but it is rather hard to imagine a situation
      * where it might happen.
      */
-    Assert((cbCopied == pBdle->cbUnderFifoW + cbArranged2Copy)); /* we assume that we write the entire buffer including unreported bytes */
+    AssertMsg((cbCopied == pBdle->cbUnderFifoW + cbArranged2Copy), /* we assume that we write the entire buffer including unreported bytes */
+              ("cbCopied=%RU32 != pBdle->cbUnderFifoW=%RU32 + cbArranged2Copy=%RU32\n",
+               cbCopied, pBdle->cbUnderFifoW, cbArranged2Copy));
     if (   pBdle->cbUnderFifoW
         && pBdle->cbUnderFifoW <= cbCopied)
-        Log(("hda:hdaBackendWriteTransferReported: CVI resetting cbUnderFifoW:%d(pos:%d, len:%d)\n", pBdle->cbUnderFifoW, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
+    {
+        LogFunc(("CVI resetting cbUnderFifoW:%d(pos:%d, len:%d)\n",
+                 pBdle->cbUnderFifoW, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
+    }
 
     pBdle->cbUnderFifoW -= RT_MIN(pBdle->cbUnderFifoW, cbCopied);
     Assert((!pBdle->cbUnderFifoW)); /* Assert!!! Incorrect assumption */
@@ -1772,8 +2083,8 @@ DECLINLINE(void) hdaBackendWriteTransferReported(PHDABDLEDESC pBdle, uint32_t cb
     *pu32DMACursor += cbCopied;
     /* Decrease the backend counter by the number of bytes we copied to the backend */
     *pu32BackendBufferCapacity -= cbCopied;
-    Log(("hda:hdaBackendWriteTransferReported: CVI(pos:%d, len:%d), pu32DMACursor: %d, pu32BackendBufferCapacity:%d\n",
-        pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, *pu32DMACursor, *pu32BackendBufferCapacity));
+    LogFunc(("CVI(pos:%d, len:%d), pu32DMACursor: %d, pu32BackendBufferCapacity:%d\n",
+             pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, *pu32DMACursor, *pu32BackendBufferCapacity));
 }
 
 DECLINLINE(void) hdaBackendReadTransferReported(PHDABDLEDESC pBdle, uint32_t cbArranged2Copy, uint32_t cbCopied,
@@ -1782,23 +2093,23 @@ DECLINLINE(void) hdaBackendReadTransferReported(PHDABDLEDESC pBdle, uint32_t cbA
     Assert((cbCopied, cbArranged2Copy));
     *pu32BackendBufferCapacity -= cbCopied;
     pBdle->u32BdleCviPos += cbCopied;
-    Log(("hda:hdaBackendReadTransferReported: CVI resetting cbUnderFifoW:%d(pos:%d, len:%d)\n", pBdle->cbUnderFifoW, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
+    LogFunc(("CVI resetting cbUnderFifoW:%d(pos:%d, len:%d)\n", pBdle->cbUnderFifoW, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
     *pu32DMACursor += cbCopied + pBdle->cbUnderFifoW;
     pBdle->cbUnderFifoW = 0;
-    Log(("hda:hdaBackendReadTransferReported: CVI(pos:%d, len:%d), pu32DMACursor: %d, pu32BackendBufferCapacity:%d\n",
+    LogFunc(("CVI(pos:%d, len:%d), pu32DMACursor: %d, pu32BackendBufferCapacity:%d\n",
         pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, pu32DMACursor ? *pu32DMACursor : 0, pu32BackendBufferCapacity ? *pu32BackendBufferCapacity : 0));
 }
 
 DECLINLINE(void) hdaBackendTransferUnreported(PHDASTATE pThis, PHDABDLEDESC pBdle, PHDASTREAMTRANSFERDESC pStreamDesc,
                                               uint32_t cbCopied, uint32_t *pu32BackendBufferCapacity)
 {
-    Log(("hda:hdaBackendTransferUnreported: CVI (cbUnderFifoW:%d, pos:%d, len:%d)\n", pBdle->cbUnderFifoW, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
+    LogFunc(("CVI (cbUnderFifoW:%d, pos:%d, len:%d)\n", pBdle->cbUnderFifoW, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
     pBdle->u32BdleCviPos += cbCopied;
     pBdle->cbUnderFifoW += cbCopied;
     /* In case of a read transaction we're always copying from the backend buffer */
     if (pu32BackendBufferCapacity)
         *pu32BackendBufferCapacity -= cbCopied;
-    Log(("hda:hdaBackendTransferUnreported: CVI (cbUnderFifoW:%d, pos:%d, len:%d)\n", pBdle->cbUnderFifoW, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
+    LogFunc(("CVI (cbUnderFifoW:%d, pos:%d, len:%d)\n", pBdle->cbUnderFifoW, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
     Assert((pBdle->cbUnderFifoW <= hdaFifoWToSz(pThis, pStreamDesc)));
 }
 
@@ -1842,7 +2153,6 @@ DECLINLINE(void) hdaStreamCounterUpdate(PHDASTATE pThis, PHDABDLEDESC pBdle, PHD
         Assert((*pStreamDesc->pu32Lpib <= pStreamDesc->u32Cbl));
 
         hdaUpdatePosBuf(pThis, pStreamDesc);
-
     }
 }
 
@@ -1873,93 +2183,207 @@ static bool hdaDoNextTransferCycle(PHDASTATE pThis, PHDABDLEDESC pBdle, PHDASTRE
     return fDoNextTransferLoop;
 }
 
-/*
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+/**
  * hdaReadAudio - copies samples from audio backend to DMA.
- * Note: this function writes to the DMA buffer immediately, but "reports bytes" when all conditions are met (FIFOW)
+ * Note: This function writes to the DMA buffer immediately,
+ *       but "reports bytes" when all conditions are met (FIFOW).
  */
-static uint32_t hdaReadAudio(PHDASTATE pThis, PHDASTREAMTRANSFERDESC pStreamDesc, uint32_t *pu32Avail, bool *fStop, uint32_t u32CblLimit)
+static int hdaReadAudio(PHDASTATE pThis, PAUDMIXSINK pSink,
+                        PHDASTREAMTRANSFERDESC pStreamDesc,
+                        uint32_t u32CblLimit, uint32_t *pcbAvail, uint32_t *pcbRead)
+{
+    PHDABDLEDESC pBdle = &pThis->StInBdle; /** @todo Add support for mic in. */
+
+    int rc;
+    uint32_t cbTransferred = 0;
+
+    LogFlowFunc(("CVI(pos:%d, len:%d)\n", pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
+
+    uint32_t cb2Copy = hdaCalculateTransferBufferLength(pBdle, pStreamDesc, *pcbAvail, u32CblLimit);
+    if (!cb2Copy)
+    {
+        /* If we enter here we can't report "unreported bits". */
+        rc = VERR_NO_DATA;
+    }
+    else
+    {
+        uint32_t cbRead = 0;
+        rc = audioMixerProcessSinkIn(pSink, AUDMIXOP_BLEND, pBdle->au8HdaBuffer, cb2Copy, &cbRead);
+        if (RT_SUCCESS(rc))
+        {
+            Assert(cbRead);
+
+            /*
+             * Write the HDA DMA buffer.
+             */
+            PDMDevHlpPCIPhysWrite(pThis->CTX_SUFF(pDevIns),
+                                  pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos,
+                                  pBdle->au8HdaBuffer, cbRead);
+
+            /* Don't see any reason why cb2Copy would differ from cbRead. */
+            Assert((cbRead == cb2Copy && (*pcbAvail) >= cb2Copy)); /* sanity */
+
+            if (pBdle->cbUnderFifoW + cbRead > hdaFifoWToSz(pThis, 0))
+                hdaBackendReadTransferReported(pBdle, cb2Copy, cbRead, &cbTransferred, pcbAvail);
+            else
+            {
+                hdaBackendTransferUnreported(pThis, pBdle, pStreamDesc, cbRead, pcbAvail);
+                rc = VERR_NO_DATA;
+            }
+        }
+    }
+
+    Assert((cbTransferred <= (SDFIFOS(pThis, 0) + 1)));
+    LogFunc(("CVI(pos:%RU32, len:%RU32), cbTransferred=%RU32, rc=%Rrc\n",
+             pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, cbTransferred, rc));
+
+    if (RT_SUCCESS(rc))
+        *pcbRead = cbTransferred;
+
+    return rc;
+}
+#else
+static int hdaReadAudio(PHDASTATE pThis, PHDASTREAMTRANSFERDESC pStreamDesc,
+                        uint32_t u32CblLimit, uint32_t *pu32Avail, uint32_t *pcbRead)
 {
     PHDABDLEDESC pBdle = &pThis->StInBdle;
+
     uint32_t cbTransferred = 0;
     uint32_t cb2Copy = 0;
     uint32_t cbBackendCopy = 0;
 
+    int rc;
+
     Log(("hda:ra: CVI(pos:%d, len:%d)\n", pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
 
     cb2Copy = hdaCalculateTransferBufferLength(pBdle, pStreamDesc, *pu32Avail, u32CblLimit);
     if (!cb2Copy)
+    {
         /* if we enter here we can't report "unreported bits" */
-        *fStop = true;
+        rc = VINF_EOF;
+    }
     else
     {
         /*
          * read from backend input line to the last unreported position or at the begining.
          */
         cbBackendCopy = AUD_read(pThis->pCodec->SwVoiceIn, pBdle->au8HdaBuffer, cb2Copy);
+
         /*
          * write the HDA DMA buffer
          */
-        PDMDevHlpPCIPhysWrite(pThis->CTX_SUFF(pDevIns), pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos, pBdle->au8HdaBuffer, cbBackendCopy);
+        PDMDevHlpPCIPhysWrite(pThis->CTX_SUFF(pDevIns), pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos, pBdle->au8HdaBuffer,
+                              cbBackendCopy);
 
         /* Don't see any reason why cb2Copy would differ from cbBackendCopy */
         Assert((cbBackendCopy == cb2Copy && (*pu32Avail) >= cb2Copy)); /* sanity */
 
         if (pBdle->cbUnderFifoW + cbBackendCopy > hdaFifoWToSz(pThis, 0))
+        {
             hdaBackendReadTransferReported(pBdle, cb2Copy, cbBackendCopy, &cbTransferred, pu32Avail);
+            rc = VINF_SUCCESS;
+        }
         else
         {
             hdaBackendTransferUnreported(pThis, pBdle, pStreamDesc, cbBackendCopy, pu32Avail);
-            *fStop = true;
+            rc = VINF_EOF;
         }
     }
 
     Assert((cbTransferred <= (SDFIFOS(pThis, 0) + 1)));
     Log(("hda:ra: CVI(pos:%d, len:%d) cbTransferred: %d\n", pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, cbTransferred));
-    return cbTransferred;
+
+    if (pcbRead)
+        *pcbRead = cbTransferred;
+
+    return rc;
 }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
-static uint32_t hdaWriteAudio(PHDASTATE pThis, PHDASTREAMTRANSFERDESC pStreamDesc, uint32_t *pu32Avail, bool *fStop, uint32_t u32CblLimit)
+static int hdaWriteAudio(PHDASTATE pThis, PHDASTREAMTRANSFERDESC pStreamDesc, uint32_t u32CblLimit,
+                         uint32_t *pcbAvail, uint32_t *pcbWritten)
 {
     PHDABDLEDESC pBdle = &pThis->StOutBdle;
+
+    int rc = VINF_SUCCESS;
+
     uint32_t cbTransferred = 0;
-    uint32_t cb2Copy = 0; /* local byte counter (on local buffer) */
-    uint32_t cbBackendCopy = 0; /* local byte counter, how many bytes copied to backend */
+    uint32_t cbWrittenMin = 0; /* local byte counter, how many bytes copied to backend */
 
-    Log(("hda:wa: CVI(cvi:%d, pos:%d, len:%d)\n", pBdle->u32BdleCvi, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
+    LogFunc(("CVI(cvi:%RU32, pos:%RU32, len:%RU32)\n", pBdle->u32BdleCvi, pBdle->u32BdleCviPos, pBdle->u32BdleCviLen));
 
-    cb2Copy = hdaCalculateTransferBufferLength(pBdle, pStreamDesc, *pu32Avail, u32CblLimit);
+    /* Local byte counter (on local buffer). */
+    uint32_t cb2Copy = hdaCalculateTransferBufferLength(pBdle, pStreamDesc, *pcbAvail, u32CblLimit);
 
     /*
      * Copy from DMA to the corresponding hdaBuffer (if there are any bytes from the
      * previous unreported transfer we write at offset 'pBdle->cbUnderFifoW').
      */
     if (!cb2Copy)
-        *fStop = true;
+    {
+        rc = VINF_EOF;
+    }
     else
     {
-        PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos, pBdle->au8HdaBuffer + pBdle->cbUnderFifoW, cb2Copy);
+        PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns),
+                          pBdle->u64BdleCviAddr + pBdle->u32BdleCviPos,
+                          pBdle->au8HdaBuffer + pBdle->cbUnderFifoW, cb2Copy);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        STAM_COUNTER_ADD(&pThis->StatBytesRead, cb2Copy);
+#endif
+
         /*
-         * Write to audio backend. we should ensure that we have enough bytes to copy to the backend.
+         * Write to audio backend. We should ensure that we have enough bytes to copy to the backend.
          */
         if (cb2Copy + pBdle->cbUnderFifoW >= hdaFifoWToSz(pThis, pStreamDesc))
         {
-            /*
-             * Feed the newly fetched samples, including unreported ones, to the backend.
-             */
-            cbBackendCopy = AUD_write (pThis->pCodec->SwVoiceOut, pBdle->au8HdaBuffer, cb2Copy + pBdle->cbUnderFifoW);
-            hdaBackendWriteTransferReported(pBdle, cb2Copy, cbBackendCopy, &cbTransferred, pu32Avail);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            uint32_t cbWritten;
+            cbWrittenMin = UINT32_MAX;
+
+            PHDADRIVER pDrv;
+            RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+            {
+                if (pDrv->pConnector->pfnIsActiveOut(pDrv->pConnector, pDrv->Out.pStrmOut))
+                {
+                    int rc2 = pDrv->pConnector->pfnWrite(pDrv->pConnector, pDrv->Out.pStrmOut,
+                                                         pBdle->au8HdaBuffer, cb2Copy + pBdle->cbUnderFifoW,
+                                                         &cbWritten);
+                    if (RT_FAILURE(rc2))
+                        continue;
+                }
+                else /* Stream disabled, just assume all was copied. */
+                    cbWritten = cb2Copy;
+
+                cbWrittenMin = RT_MIN(cbWrittenMin, cbWritten);
+                LogFlowFunc(("\tLUN#%RU8: cbWritten=%RU32, cWrittenMin=%RU32\n", pDrv->uLUN, cbWritten, cbWrittenMin));
+            }
+
+            if (cbWrittenMin == UINT32_MAX)
+                cbWrittenMin = 0;
+#else
+            cbWrittenMin = AUD_write (pThis->pCodec->SwVoiceOut, pBdle->au8HdaBuffer, cb2Copy + pBdle->cbUnderFifoW);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+            hdaBackendWriteTransferReported(pBdle, cb2Copy, cbWrittenMin, &cbTransferred, pcbAvail);
         }
         else
         {
-            /* Not enough bytes to be processed and reported, we'll try our luck next time around */
+            /* Not enough bytes to be processed and reported, we'll try our luck next time around. */
             hdaBackendTransferUnreported(pThis, pBdle, pStreamDesc, cb2Copy, NULL);
-            *fStop = true;
+            rc = VINF_EOF;
         }
     }
 
     Assert(cbTransferred <= SDFIFOS(pThis, 4) + 1);
-    Log(("hda:wa: CVI(pos:%d, len:%d, cbTransferred:%d)\n", pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, cbTransferred));
-    return cbTransferred;
+    LogFunc(("CVI(pos:%RU32, len:%RU32, cbTransferred:%RU32), rc=%Rrc\n",
+             pBdle->u32BdleCviPos, pBdle->u32BdleCviLen, cbTransferred, rc));
+
+    if (RT_SUCCESS(rc))
+        *pcbWritten = cbTransferred;
+
+    return rc;
 }
 
 /**
@@ -1967,7 +2391,7 @@ static uint32_t hdaWriteAudio(PHDASTATE pThis, PHDASTREAMTRANSFERDESC pStreamDes
  */
 DECLCALLBACK(int) hdaCodecReset(PHDACODEC pCodec)
 {
-    PHDASTATE pThis = (PHDASTATE)pCodec->pvHDAState;
+    PHDASTATE pThis = pCodec->pHDAState;
     NOREF(pThis);
     return VINF_SUCCESS;
 }
@@ -1977,98 +2401,343 @@ DECLINLINE(void) hdaInitTransferDescriptor(PHDASTATE pThis, PHDABDLEDESC pBdle,
 {
     Assert(pThis); Assert(pBdle); Assert(pStreamDesc); Assert(u8Strm <= 7);
 
-    memset(pStreamDesc, 0, sizeof(HDASTREAMTRANSFERDESC));
+    RT_BZERO(pStreamDesc, sizeof(HDASTREAMTRANSFERDESC));
     pStreamDesc->u8Strm     = u8Strm;
-    pStreamDesc->u32Ctl     = HDA_STREAM_REG2(pThis, CTL, u8Strm);
-    pStreamDesc->u64BaseDMA = RT_MAKE_U64(HDA_STREAM_REG2(pThis, BDPL, u8Strm),
-                                          HDA_STREAM_REG2(pThis, BDPU, u8Strm));
-    pStreamDesc->pu32Lpib   = &HDA_STREAM_REG2(pThis, LPIB, u8Strm);
-    pStreamDesc->pu32Sts    = &HDA_STREAM_REG2(pThis, STS, u8Strm);
-    pStreamDesc->u32Cbl     = HDA_STREAM_REG2(pThis, CBL, u8Strm);
-    pStreamDesc->u32Fifos   = HDA_STREAM_REG2(pThis, FIFOS, u8Strm);
+    pStreamDesc->u32Ctl     = HDA_STREAM_REG(pThis, CTL, u8Strm);
+    pStreamDesc->u64BaseDMA = RT_MAKE_U64(HDA_STREAM_REG(pThis, BDPL, u8Strm),
+                                          HDA_STREAM_REG(pThis, BDPU, u8Strm));
+    pStreamDesc->pu32Lpib   = &HDA_STREAM_REG(pThis, LPIB, u8Strm);
+    pStreamDesc->pu32Sts    = &HDA_STREAM_REG(pThis, STS, u8Strm);
+    pStreamDesc->u32Cbl     = HDA_STREAM_REG(pThis, CBL, u8Strm);
+    pStreamDesc->u32Fifos   = HDA_STREAM_REG(pThis, FIFOS, u8Strm);
 
-    pBdle->u32BdleMaxCvi    = HDA_STREAM_REG2(pThis, LVI, u8Strm);
+    pBdle->u32BdleMaxCvi    = HDA_STREAM_REG(pThis, LVI, u8Strm);
 
 #ifdef LOG_ENABLED
     if (   pBdle
         && pBdle->u32BdleMaxCvi)
     {
-        Log(("Initialization of transfer descriptor:\n"));
+        LogFunc(("Initialization of transfer descriptor:\n"));
         dump_bd(pThis, pBdle, pStreamDesc->u64BaseDMA);
     }
 #endif
 }
 
+static DECLCALLBACK(void) hdaCloseIn(PHDASTATE pThis, PDMAUDIORECSOURCE enmRecSource)
+{
+    NOREF(pThis);
+    NOREF(enmRecSource);
+    LogFlowFuncEnter();
+}
 
-/**
- * @interface_method_impl{HDACODEC,pfnTransfer}
- */
-static DECLCALLBACK(void) hdaTransfer(PHDACODEC pCodec, ENMSOUNDSOURCE src, int avail)
+static DECLCALLBACK(void) hdaCloseOut(PHDASTATE pThis)
+{
+    NOREF(pThis);
+    LogFlowFuncEnter();
+}
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static DECLCALLBACK(int) hdaOpenIn(PHDASTATE pThis,
+                                   const char *pszName, PDMAUDIORECSOURCE enmRecSource,
+                                   PPDMAUDIOSTREAMCFG pCfg)
 {
-    PHDASTATE       pThis  = (PHDASTATE)pCodec->pvHDAState;
-    uint8_t         u8Strm = 0;
-    PHDABDLEDESC    pBdle  = NULL;
+    PAUDMIXSINK pSink;
 
-    switch (src)
+    switch (enmRecSource)
     {
-        case PO_INDEX:
+# ifdef VBOX_WITH_HDA_MIC_IN
+        case PDMAUDIORECSOURCE_MIC:
+            pSink = pThis->pSinkMicIn;
+            break;
+# endif
+        case PDMAUDIORECSOURCE_LINE_IN:
+            pSink = pThis->pSinkLineIn;
+            break;
+        default:
+            AssertMsgFailed(("Audio source %ld not supported\n", enmRecSource));
+            return VERR_NOT_SUPPORTED;
+    }
+
+    int rc = VINF_SUCCESS;
+    char *pszDesc;
+
+    PHDADRIVER pDrv;
+    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+    {
+        if (RTStrAPrintf(&pszDesc, "[LUN#%RU8] %s", pDrv->uLUN, pszName) <= 0)
         {
-            u8Strm = 4;
-            pBdle = &pThis->StOutBdle;
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        rc = pDrv->pConnector->pfnOpenIn(pDrv->pConnector, pszDesc, enmRecSource, pCfg, &pDrv->LineIn.pStrmIn);
+        LogFlowFunc(("LUN#%RU8: Opened input \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc));
+        if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */
+        {
+            audioMixerRemoveStream(pSink, pDrv->LineIn.phStrmIn);
+            rc = audioMixerAddStreamIn(pSink,
+                                       pDrv->pConnector, pDrv->LineIn.pStrmIn,
+                                       0 /* uFlags */, &pDrv->LineIn.phStrmIn);
+        }
+
+        RTStrFree(pszDesc);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) hdaOpenOut(PHDASTATE pThis,
+                                    const char *pszName, PPDMAUDIOSTREAMCFG pCfg)
+{
+    int rc = VINF_SUCCESS;
+    char *pszDesc;
+
+    PHDADRIVER pDrv;
+    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+    {
+        if (RTStrAPrintf(&pszDesc, "[LUN#%RU8] %s", pDrv->uLUN, pszName) <= 0)
+        {
+            rc = VERR_NO_MEMORY;
             break;
         }
+
+        rc = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszDesc, pCfg, &pDrv->Out.pStrmOut);
+        LogFlowFunc(("LUN#%RU8: Opened output \"%s\", with rc=%Rrc\n", pDrv->uLUN, pszDesc, rc));
+        if (rc == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */
+        {
+            audioMixerRemoveStream(pThis->pSinkOutput, pDrv->Out.phStrmOut);
+            rc = audioMixerAddStreamOut(pThis->pSinkOutput,
+                                        pDrv->pConnector, pDrv->Out.pStrmOut,
+                                        0 /* uFlags */, &pDrv->Out.phStrmOut);
+        }
+
+        RTStrFree(pszDesc);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) hdaSetVolume(PHDASTATE pThis, ENMSOUNDSOURCE enmSource,
+                                      bool fMute, uint8_t uVolLeft, uint8_t uVolRight)
+{
+    int             rc = VINF_SUCCESS;
+    PDMAUDIOVOLUME  vol = { fMute, uVolLeft, uVolRight };
+    PAUDMIXSINK     pSink;
+
+    /* Convert the audio source to corresponding sink. */
+    switch (enmSource) {
+    case PO_INDEX:
+        pSink = pThis->pSinkOutput;
+        break;
+    case PI_INDEX:
+        pSink = pThis->pSinkLineIn;
+        break;
+    case MC_INDEX:
+        pSink = pThis->pSinkMicIn;
+        break;
+    default:
+        AssertFailedReturn(VERR_INVALID_PARAMETER);
+    }
+
+    /* Set the volume. Codec already converted it to the correct range. */
+    audioMixerSetSinkVolume(pSink, &vol);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static DECLCALLBACK(void) hdaTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
+{
+    PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
+    AssertPtr(pThis);
+
+    STAM_PROFILE_START(&pThis->StatTimer, a);
+
+    int rc = VINF_SUCCESS;
+
+    uint32_t cbInMax  = 0;
+    uint32_t cbOutMin = UINT32_MAX;
+
+    PHDADRIVER pDrv;
+
+    uint32_t cbIn, cbOut, cSamplesLive;
+    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+    {
+        rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
+                                              &cbIn, &cbOut, &cSamplesLive);
+        if (RT_SUCCESS(rc))
+        {
+#ifdef DEBUG_TIMER
+            LogFlowFunc(("\tLUN#%RU8: [1] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
+#endif
+            if (cSamplesLive)
+            {
+                uint32_t cSamplesPlayed;
+                int rc2 = pDrv->pConnector->pfnPlayOut(pDrv->pConnector, &cSamplesPlayed);
+                if (RT_SUCCESS(rc2))
+                    LogFlowFunc(("LUN#%RU8: cSamplesLive=%RU32, cSamplesPlayed=%RU32\n",
+                                 pDrv->uLUN, cSamplesLive, cSamplesPlayed));
+
+                rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
+                                                      &cbIn, &cbOut, &cSamplesLive);
+#ifdef DEBUG_TIMER
+                if (RT_SUCCESS(rc))
+                    LogFlowFunc(("\tLUN#%RU8: [2] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
+#endif
+            }
+
+            cbInMax  = RT_MAX(cbInMax, cbIn);
+            cbOutMin = RT_MIN(cbOutMin, cbOut);
+        }
+    }
+
+#ifdef DEBUG_TIMER
+    LogFlowFunc(("cbInMax=%RU32, cbOutMin=%RU32\n", cbInMax, cbOutMin));
+#endif
+
+    if (cbOutMin == UINT32_MAX)
+        cbOutMin = 0;
+
+    /*
+     * Playback.
+     */
+    if (cbOutMin)
+    {
+        Assert(cbOutMin != UINT32_MAX);
+        hdaTransfer(pThis, PO_INDEX, cbOutMin); /** @todo Add rc! */
+    }
+
+    /*
+     * Recording.
+     */
+    if (cbInMax)
+        hdaTransfer(pThis, PI_INDEX, cbInMax); /** @todo Add rc! */
+
+    TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->uTicks);
+
+    STAM_PROFILE_STOP(&pThis->StatTimer, a);
+}
+
+static DECLCALLBACK(int) hdaTransfer(PHDASTATE pThis,
+                                     ENMSOUNDSOURCE enmSrc, uint32_t cbAvail)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("pThis=%p, cbAvail=%RU32\n", pThis, cbAvail));
+#else
+static DECLCALLBACK(int) hdaTransfer(PHDACODEC pCodec, ENMSOUNDSOURCE enmSrc, uint32_t cbAvail)
+{
+    AssertPtrReturn(pCodec, VERR_INVALID_POINTER);
+    PHDASTATE pThis = pCodec->pHDAState;
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    uint8_t      u8Strm;
+    PHDABDLEDESC pBdle;
+
+    switch (enmSrc)
+    {
         case PI_INDEX:
         {
             u8Strm = 0;
             pBdle = &pThis->StInBdle;
             break;
         }
+
+#ifdef VBOX_WITH_HDA_MIC_IN
+        case MC_INDEX:
+        {
+            u8Strm = 2;
+            pBdle = &pThis->StMicBdle;
+            break;
+        }
+#endif
+        case PO_INDEX:
+        {
+            u8Strm = 4;
+            pBdle = &pThis->StOutBdle;
+            break;
+        }
+
         default:
-            return;
+            AssertMsgFailed(("Unknown source index %ld\n", enmSrc));
+            return VERR_NOT_SUPPORTED;
     }
 
     HDASTREAMTRANSFERDESC StreamDesc;
     hdaInitTransferDescriptor(pThis, pBdle, u8Strm, &StreamDesc);
 
-    bool fStop = false;
-    while (avail && !fStop)
+    int rc = VINF_EOF;
+    while (cbAvail)
     {
         Assert(   (StreamDesc.u32Ctl & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN))
-               && avail
+               && cbAvail
                && StreamDesc.u64BaseDMA);
 
         /* Fetch the Buffer Descriptor Entry (BDE). */
-
         if (hdaIsTransferCountersOverlapped(pThis, pBdle, &StreamDesc))
             hdaFetchBdle(pThis, pBdle, &StreamDesc);
+
         *StreamDesc.pu32Sts |= HDA_REG_FIELD_FLAG_MASK(SDSTS, FIFORDY);
-        Assert((avail >= 0 && (StreamDesc.u32Cbl >= (*StreamDesc.pu32Lpib)))); /* sanity */
+        Assert((StreamDesc.u32Cbl >= (*StreamDesc.pu32Lpib))); /* sanity */
         uint32_t u32CblLimit = StreamDesc.u32Cbl - (*StreamDesc.pu32Lpib);
         Assert((u32CblLimit > hdaFifoWToSz(pThis, &StreamDesc)));
-        Log(("hda: CBL=%d, LPIB=%d\n", StreamDesc.u32Cbl, *StreamDesc.pu32Lpib));
-        uint32_t cb;
-        switch (src)
+
+        LogFunc(("CBL=%RU32, LPIB=%RU32\n", StreamDesc.u32Cbl, *StreamDesc.pu32Lpib));
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        PAUDMIXSINK pSink;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+        uint32_t cbWritten = 0;
+        switch (enmSrc)
         {
+            case PI_INDEX:
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                pSink = pThis->pSinkLineIn;
+                rc = hdaReadAudio(pThis, pSink, &StreamDesc, u32CblLimit, &cbAvail, &cbWritten);
+#else
+                rc = hdaReadAudio(pThis, &StreamDesc, u32CblLimit, (uint32_t *)&cbAvail, &cbWritten);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+                break;
             case PO_INDEX:
-                cb = hdaWriteAudio(pThis, &StreamDesc, (uint32_t *)&avail, &fStop, u32CblLimit);
+                rc = hdaWriteAudio(pThis, &StreamDesc, u32CblLimit, &cbAvail, &cbWritten);
                 break;
-            case PI_INDEX:
-                cb = hdaReadAudio(pThis, &StreamDesc, (uint32_t *)&avail, &fStop, u32CblLimit);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# ifdef VBOX_WITH_HDA_MIC_IN
+            case MC_INDEX:
+                pSink = pThis->pSinkMicIn;
+                rc = hdaReadAudio(pThis, pSink, &StreamDesc, u32CblLimit, &cbAvail, &cbWritten);
                 break;
+# endif
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
             default:
-                cb = 0;
-                fStop = true;
-                AssertMsgFailed(("Unsupported"));
+                AssertMsgFailed(("Unsupported source index %ld\n", enmSrc));
+                rc = VERR_NOT_SUPPORTED;
+                break;
         }
-        Assert(cb <= StreamDesc.u32Fifos + 1);
+        Assert(cbWritten <= StreamDesc.u32Fifos + 1);
         *StreamDesc.pu32Sts &= ~HDA_REG_FIELD_FLAG_MASK(SDSTS, FIFORDY);
 
         /* Process end of buffer condition. */
-        hdaStreamCounterUpdate(pThis, pBdle, &StreamDesc, cb);
-        fStop = !fStop ? !hdaDoNextTransferCycle(pThis, pBdle, &StreamDesc) : fStop;
+        hdaStreamCounterUpdate(pThis, pBdle, &StreamDesc, cbWritten);
+
+        if (!hdaDoNextTransferCycle(pThis, pBdle, &StreamDesc))
+            break;
+
+        if (   RT_FAILURE(rc)
+            || rc == VINF_EOF) /* All data processed? */
+        {
+            break;
+        }
     }
+
+    return rc;
 }
-#endif
+#endif /* IN_RING3 */
 
 /* MMIO callbacks */
 
@@ -2088,33 +2757,33 @@ PDMBOTHCBDECL(int) hdaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhys
      * Look up and log.
      */
     uint32_t        offReg = GCPhysAddr - pThis->MMIOBaseAddr;
-    int             idxReg = hdaRegLookup(pThis, offReg);
+    int             idxRegDsc = hdaRegLookup(pThis, offReg);    /* Register descriptor index. */
 #ifdef LOG_ENABLED
     unsigned const  cbLog     = cb;
     uint32_t        offRegLog = offReg;
 #endif
 
-    Log(("hdaMMIORead: offReg=%#x cb=%#x\n", offReg, cb));
+    LogFunc(("offReg=%#x cb=%#x\n", offReg, cb));
 #define NEW_READ_CODE
 #ifdef NEW_READ_CODE
     Assert(cb == 4); Assert((offReg & 3) == 0);
 
-    if (pThis->fInReset && idxReg != ICH6_HDA_REG_GCTL)
-        Log(("hda: access to registers except GCTL is blocked while reset\n"));
+    if (pThis->fInReset && idxRegDsc != HDA_REG_GCTL)
+        LogFunc(("access to registers except GCTL is blocked while reset\n"));
 
-    if (idxReg == -1)
-        LogRel(("hda: Invalid read access @0x%x(of bytes:%d)\n", offReg, cb));
+    if (idxRegDsc == -1)
+        LogRel(("Invalid read access @0x%x(of bytes:%d)\n", offReg, cb));
 
-    if (idxReg != -1)
+    if (idxRegDsc != -1)
     {
         /* ASSUMES gapless DWORD at end of map. */
-        if (g_aHdaRegMap[idxReg].size == 4)
+        if (g_aHdaRegMap[idxRegDsc].size == 4)
         {
             /*
              * Straight forward DWORD access.
              */
-            rc = g_aHdaRegMap[idxReg].pfnRead(pThis, idxReg, (uint32_t *)pv);
-            Log(("hda: read %s => %x (%Rrc)\n", g_aHdaRegMap[idxReg].abbrev, *(uint32_t *)pv, rc));
+            rc = g_aHdaRegMap[idxRegDsc].pfnRead(pThis, idxRegDsc, (uint32_t *)pv);
+            LogFunc(("read %s => %x (%Rrc)\n", g_aHdaRegMap[idxRegDsc].abbrev, *(uint32_t *)pv, rc));
         }
         else
         {
@@ -2126,19 +2795,19 @@ PDMBOTHCBDECL(int) hdaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhys
             unsigned cbLeft   = 4;
             do
             {
-                uint32_t const  cbReg        = g_aHdaRegMap[idxReg].size;
+                uint32_t const  cbReg        = g_aHdaRegMap[idxRegDsc].size;
                 uint32_t        u32Tmp       = 0;
 
-                rc = g_aHdaRegMap[idxReg].pfnRead(pThis, idxReg, &u32Tmp);
-                Log(("hda: read %s[%db] => %x (%Rrc)*\n", g_aHdaRegMap[idxReg].abbrev, cbReg, u32Tmp, rc));
+                rc = g_aHdaRegMap[idxRegDsc].pfnRead(pThis, idxRegDsc, &u32Tmp);
+                LogFunc(("read %s[%db] => %x (%Rrc)*\n", g_aHdaRegMap[idxRegDsc].abbrev, cbReg, u32Tmp, rc));
                 if (rc != VINF_SUCCESS)
                     break;
                 u32Value |= (u32Tmp & g_afMasks[cbReg]) << ((4 - cbLeft) * 8);
 
                 cbLeft -= cbReg;
                 offReg += cbReg;
-                idxReg++;
-            } while (cbLeft > 0 && g_aHdaRegMap[idxReg].offset == offReg);
+                idxRegDsc++;
+            } while (cbLeft > 0 && g_aHdaRegMap[idxRegDsc].offset == offReg);
 
             if (rc == VINF_SUCCESS)
                 *(uint32_t *)pv = u32Value;
@@ -2149,16 +2818,16 @@ PDMBOTHCBDECL(int) hdaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhys
     else
     {
         rc = VINF_IOM_MMIO_UNUSED_FF;
-        Log(("hda: hole at %x is accessed for read\n", offReg));
+        LogFunc(("hole at %x is accessed for read\n", offReg));
     }
 #else
-    if (idxReg != -1)
+    if (idxRegDsc != -1)
     {
         /** @todo r=bird: Accesses crossing register boundraries aren't handled
          *        right from what I can tell?  If they are, please explain
          *        what the rules are. */
         uint32_t mask = 0;
-        uint32_t shift = (g_aHdaRegMap[idxReg].offset - offReg) % sizeof(uint32_t) * 8;
+        uint32_t shift = (g_aHdaRegMap[idxRegDsc].offset - offReg) % sizeof(uint32_t) * 8;
         uint32_t u32Value = 0;
         switch(cb)
         {
@@ -2174,25 +2843,25 @@ PDMBOTHCBDECL(int) hdaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhys
 #if 0
         /* Cross-register access. Mac guest hits this assert doing assumption 4 byte access to 3 byte registers e.g. {I,O}SDnCTL
          */
-        //Assert((cb <= g_aHdaRegMap[idxReg].size - (offReg - g_aHdaRegMap[idxReg].offset)));
-        if (cb > g_aHdaRegMap[idxReg].size - (offReg - g_aHdaRegMap[idxReg].offset))
+        //Assert((cb <= g_aHdaRegMap[idxRegDsc].size - (offReg - g_aHdaRegMap[idxRegDsc].offset)));
+        if (cb > g_aHdaRegMap[idxRegDsc].size - (offReg - g_aHdaRegMap[idxRegDsc].offset))
         {
-            int off = cb - (g_aHdaRegMap[idxReg].size - (offReg - g_aHdaRegMap[idxReg].offset));
+            int off = cb - (g_aHdaRegMap[idxRegDsc].size - (offReg - g_aHdaRegMap[idxRegDsc].offset));
             rc = hdaMMIORead(pDevIns, pvUser, GCPhysAddr + cb - off, (char *)pv + cb - off, off);
             if (RT_FAILURE(rc))
                 AssertRCReturn (rc, rc);
         }
-        //Assert(((offReg - g_aHdaRegMap[idxReg].offset) == 0));
+        //Assert(((offReg - g_aHdaRegMap[idxRegDsc].offset) == 0));
 #endif
         mask <<= shift;
-        rc = g_aHdaRegMap[idxReg].pfnRead(pThis, idxReg, &u32Value);
+        rc = g_aHdaRegMap[idxRegDsc].pfnRead(pThis, idxRegDsc, &u32Value);
         *(uint32_t *)pv |= (u32Value & mask);
-        Log(("hda: read %s[%x/%x]\n", g_aHdaRegMap[idxReg].abbrev, u32Value, *(uint32_t *)pv));
+        LogFunc(("read %s[%x/%x]\n", g_aHdaRegMap[idxRegDsc].abbrev, u32Value, *(uint32_t *)pv));
     }
     else
     {
         *(uint32_t *)pv = 0xFF;
-        Log(("hda: hole at %x is accessed for read\n", offReg));
+        LogFunc(("hole at %x is accessed for read\n", offReg));
         rc = VINF_SUCCESS;
     }
 #endif
@@ -2202,27 +2871,28 @@ PDMBOTHCBDECL(int) hdaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhys
      */
 #ifdef LOG_ENABLED
     if (cbLog == 4)
-        Log(("hdaMMIORead: @%#05x -> %#010x %Rrc\n", offRegLog, *(uint32_t *)pv, rc));
+        LogFunc(("@%#05x -> %#010x %Rrc\n", offRegLog, *(uint32_t *)pv, rc));
     else if (cbLog == 2)
-        Log(("hdaMMIORead: @%#05x -> %#06x %Rrc\n", offRegLog, *(uint16_t *)pv, rc));
+        LogFunc(("@%#05x -> %#06x %Rrc\n", offRegLog, *(uint16_t *)pv, rc));
     else if (cbLog == 1)
-        Log(("hdaMMIORead: @%#05x -> %#04x %Rrc\n", offRegLog, *(uint8_t *)pv, rc));
+        LogFunc(("@%#05x -> %#04x %Rrc\n", offRegLog, *(uint8_t *)pv, rc));
 #endif
     return rc;
 }
 
 
-DECLINLINE(int) hdaWriteReg(PHDASTATE pThis, int idxReg, uint32_t u32Value, char const *pszLog)
+DECLINLINE(int) hdaWriteReg(PHDASTATE pThis, int idxRegDsc, uint32_t u32Value, char const *pszLog)
 {
-    if (pThis->fInReset && idxReg != ICH6_HDA_REG_GCTL)
-        Log(("hda: access to registers except GCTL is blocked while reset\n"));  /** @todo where is this enforced? */
+    if (pThis->fInReset && idxRegDsc != HDA_REG_GCTL)
+        LogFunc(("access to registers except GCTL is blocked while reset\n"));  /** @todo where is this enforced? */
 
+    uint32_t idxRegMem = g_aHdaRegMap[idxRegDsc].mem_idx;
 #ifdef LOG_ENABLED
-    uint32_t const u32CurValue = pThis->au32Regs[idxReg];
+    uint32_t const u32CurValue = pThis->au32Regs[idxRegMem];
 #endif
-    int rc = g_aHdaRegMap[idxReg].pfnWrite(pThis, idxReg, u32Value);
-    Log(("hda: write %#x -> %s[%db]; %x => %x%s\n", u32Value, g_aHdaRegMap[idxReg].abbrev,
-         g_aHdaRegMap[idxReg].size, u32CurValue, pThis->au32Regs[idxReg], pszLog));
+    int rc = g_aHdaRegMap[idxRegDsc].pfnWrite(pThis, idxRegDsc, u32Value);
+    LogFunc(("write %#x -> %s[%db]; %x => %x%s\n", u32Value, g_aHdaRegMap[idxRegDsc].abbrev,
+         g_aHdaRegMap[idxRegDsc].size, u32CurValue, pThis->au32Regs[idxRegMem], pszLog));
     return rc;
 }
 
@@ -2237,7 +2907,7 @@ PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
 
     /*
      * The behavior of accesses that aren't aligned on natural boundraries is
-     * undefined. Just reject them out right.
+     * undefined. Just reject them outright.
      */
     /** @todo IOM could check this, it could also split the 8 byte accesses for us. */
     Assert(cb == 1 || cb == 2 || cb == 4 || cb == 8);
@@ -2245,10 +2915,11 @@ PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
         return PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "misaligned write access: GCPhysAddr=%RGp cb=%u\n", GCPhysAddr, cb);
 
     /*
-     * Lookup and log the access.
+     * Look up and log the access.
      */
     uint32_t    offReg = GCPhysAddr - pThis->MMIOBaseAddr;
-    int         idxReg = hdaRegLookup(pThis, offReg);
+    int         idxRegDsc = hdaRegLookup(pThis, offReg);
+    uint32_t    idxRegMem = idxRegDsc != -1 ? g_aHdaRegMap[idxRegDsc].mem_idx : UINT32_MAX;
     uint64_t    u64Value;
     if (cb == 4)        u64Value = *(uint32_t const *)pv;
     else if (cb == 2)   u64Value = *(uint16_t const *)pv;
@@ -2261,19 +2932,19 @@ PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
     }
 
 #ifdef LOG_ENABLED
-    uint32_t const u32LogOldValue = idxReg != -1 ? pThis->au32Regs[idxReg] : UINT32_MAX;
+    uint32_t const u32LogOldValue = idxRegDsc >= 0 ? pThis->au32Regs[idxRegMem] : UINT32_MAX;
     uint32_t const offRegLog = offReg;
-    int      const idxRegLog = idxReg;
-    if (idxReg == -1)
-        Log(("hdaMMIOWrite: @%#05x u32=%#010x cb=%d\n", offReg, *(uint32_t const *)pv, cb));
+    int      const idxRegLog = idxRegMem;
+    if (idxRegDsc == -1)
+        LogFunc(("@%#05x u32=%#010x cb=%d\n", offReg, *(uint32_t const *)pv, cb));
     else if (cb == 4)
-        Log(("hdaMMIOWrite: @%#05x u32=%#010x %s\n", offReg, *(uint32_t *)pv, g_aHdaRegMap[idxReg].abbrev));
+        LogFunc(("@%#05x u32=%#010x %s\n", offReg, *(uint32_t *)pv, g_aHdaRegMap[idxRegDsc].abbrev));
     else if (cb == 2)
-        Log(("hdaMMIOWrite: @%#05x u16=%#06x (%#010x) %s\n", offReg, *(uint16_t *)pv, *(uint32_t *)pv, g_aHdaRegMap[idxReg].abbrev));
+        LogFunc(("@%#05x u16=%#06x (%#010x) %s\n", offReg, *(uint16_t *)pv, *(uint32_t *)pv, g_aHdaRegMap[idxRegDsc].abbrev));
     else if (cb == 1)
-        Log(("hdaMMIOWrite: @%#05x u8=%#04x (%#010x) %s\n", offReg, *(uint8_t *)pv, *(uint32_t *)pv, g_aHdaRegMap[idxReg].abbrev));
-    if (idxReg != -1 && g_aHdaRegMap[idxReg].size != cb)
-        Log(("hdaMMIOWrite: size=%d != cb=%d!!\n", g_aHdaRegMap[idxReg].size, cb));
+        LogFunc(("@%#05x u8=%#04x (%#010x) %s\n", offReg, *(uint8_t *)pv, *(uint32_t *)pv, g_aHdaRegMap[idxRegDsc].abbrev));
+    if (idxRegDsc >= 0 && g_aHdaRegMap[idxRegDsc].size != cb)
+        LogFunc(("size=%d != cb=%d!!\n", g_aHdaRegMap[idxRegDsc].size, cb));
 #endif
 
 #define NEW_WRITE_CODE
@@ -2281,8 +2952,12 @@ PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
     /*
      * Try for a direct hit first.
      */
-    if (idxReg != -1 && g_aHdaRegMap[idxReg].size == cb)
-        rc = hdaWriteReg(pThis, idxReg, u64Value, "");
+    if (idxRegDsc != -1 && g_aHdaRegMap[idxRegDsc].size == cb)
+    {
+        rc = hdaWriteReg(pThis, idxRegDsc, u64Value, "");
+        LogFunc(("@%#05x %#x -> %#x\n", offRegLog, u32LogOldValue,
+             idxRegLog != -1 ? pThis->au32Regs[idxRegLog] : UINT32_MAX));
+    }
     /*
      * Partial or multiple register access, loop thru the requested memory.
      */
@@ -2292,35 +2967,40 @@ PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
            value and fill in missing bits. Natural alignment rules means we
            will only see 1 or 2 byte accesses of this kind, so no risk of
            shifting out input values. */
-        if (idxReg == -1 && (idxReg = hdaRegLookupWithin(pThis, offReg)) != -1)
+        if (idxRegDsc == -1 && (idxRegDsc = hdaRegLookupWithin(pThis, offReg)) != -1)
         {
-            uint32_t const cbBefore = offReg - g_aHdaRegMap[idxReg].offset; Assert(cbBefore > 0 && cbBefore < 4);
+            uint32_t const cbBefore = offReg - g_aHdaRegMap[idxRegDsc].offset; Assert(cbBefore > 0 && cbBefore < 4);
             offReg    -= cbBefore;
+            idxRegMem = g_aHdaRegMap[idxRegDsc].mem_idx;
             u64Value <<= cbBefore * 8;
-            u64Value  |= pThis->au32Regs[idxReg] & g_afMasks[cbBefore];
-            Log(("hdaMMIOWrite: Within register, supplied %u leading bits: %#llx -> %#llx ...\n",
+            u64Value  |= pThis->au32Regs[idxRegMem] & g_afMasks[cbBefore];
+            LogFunc(("Within register, supplied %u leading bits: %#llx -> %#llx ...\n",
                  cbBefore * 8, ~g_afMasks[cbBefore] & u64Value, u64Value));
         }
 
-        /* Loop thru the write area, it may covert multiple registers. */
+        /* Loop thru the write area, it may cover multiple registers. */
         rc = VINF_SUCCESS;
         for (;;)
         {
             uint32_t cbReg;
-            if (idxReg != -1)
+            if (idxRegDsc != -1)
             {
-                cbReg = g_aHdaRegMap[idxReg].size;
+                idxRegMem = g_aHdaRegMap[idxRegDsc].mem_idx;
+                cbReg = g_aHdaRegMap[idxRegDsc].size;
                 if (cb < cbReg)
                 {
-                    u64Value |= pThis->au32Regs[idxReg] & g_afMasks[cbReg] & ~g_afMasks[cb];
-                    Log(("hdaMMIOWrite: Supplying missing bits (%#x): %#llx -> %#llx ...\n",
+                    u64Value |= pThis->au32Regs[idxRegMem] & g_afMasks[cbReg] & ~g_afMasks[cb];
+                    LogFunc(("Supplying missing bits (%#x): %#llx -> %#llx ...\n",
                          g_afMasks[cbReg] & ~g_afMasks[cb], u64Value & g_afMasks[cb], u64Value));
                 }
-                rc = hdaWriteReg(pThis, idxReg, u64Value, "*");
+                uint32_t u32LogOldVal = pThis->au32Regs[idxRegMem];
+                rc = hdaWriteReg(pThis, idxRegDsc, u64Value, "*");
+                LogFunc(("@%#05x %#x -> %#x\n", offRegLog, u32LogOldVal,
+                     pThis->au32Regs[idxRegMem]));
             }
             else
             {
-                LogRel(("hda: Invalid write access @0x%x!\n", offReg));
+                LogRel(("HDA: Invalid write access @0x%x!\n", offReg));
                 cbReg = 1;
             }
             if (rc != VINF_SUCCESS)
@@ -2332,19 +3012,19 @@ PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
             offReg += cbReg;
             cb     -= cbReg;
             u64Value >>= cbReg * 8;
-            if (idxReg == -1)
-                idxReg = hdaRegLookup(pThis, offReg);
+            if (idxRegDsc == -1)
+                idxRegDsc = hdaRegLookup(pThis, offReg);
             else
             {
-                idxReg++;
-                if (   (unsigned)idxReg >= RT_ELEMENTS(g_aHdaRegMap)
-                    || g_aHdaRegMap[idxReg].offset != offReg)
-                    idxReg = -1;
+                idxRegDsc++;
+                if (   (unsigned)idxRegDsc >= RT_ELEMENTS(g_aHdaRegMap)
+                    || g_aHdaRegMap[idxRegDsc].offset != offReg)
+                    idxRegDsc = -1;
             }
         }
     }
 #else
-    if (idxReg != -1)
+    if (idxRegDsc != -1)
     {
         /** @todo r=bird: This looks like code for handling unaligned register
          * accesses.  If it isn't, then add a comment explaining what you're
@@ -2359,7 +3039,7 @@ PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
          * the code.
          *
          */
-        uint32_t u32CurValue = pThis->au32Regs[idxReg];
+        uint32_t u32CurValue = pThis->au32Regs[idxRegMem];
         uint32_t u32NewValue;
         uint32_t mask;
         switch (cb)
@@ -2383,21 +3063,22 @@ PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
                 AssertFailedReturn(VERR_INTERNAL_ERROR_4); /* shall not happen. */
         }
         /* cross-register access, see corresponding comment in hdaMMIORead */
-        uint32_t shift = (g_aHdaRegMap[idxReg].offset - offReg) % sizeof(uint32_t) * 8;
+        uint32_t shift = (g_aHdaRegMap[idxRegDsc].offset - offReg) % sizeof(uint32_t) * 8;
         mask <<= shift;
         u32NewValue <<= shift;
         u32NewValue &= mask;
         u32NewValue |= (u32CurValue & ~mask);
 
-        rc = g_aHdaRegMap[idxReg].pfnWrite(pThis, idxReg, u32NewValue);
-        Log(("hda: write %s:(%x) %x => %x\n", g_aHdaRegMap[idxReg].abbrev, u32NewValue,
-             u32CurValue, pThis->au32Regs[idxReg]));
+        rc = g_aHdaRegMap[idxRegDsc].pfnWrite(pThis, idxRegDsc, u32NewValue);
+        LogFunc(("write %s:(%x) %x => %x\n", g_aHdaRegMap[idxRegDsc].abbrev, u32NewValue,
+             u32CurValue, pThis->au32Regs[idxRegMem]));
     }
     else
         rc = VINF_SUCCESS;
-#endif
-    Log(("hdaMMIOWrite: @%#05x %#x -> %#x\n", offRegLog, u32LogOldValue,
+
+    LogFunc(("@%#05x %#x -> %#x\n", offRegLog, u32LogOldValue,
          idxRegLog != -1 ? pThis->au32Regs[idxRegLog] : UINT32_MAX));
+#endif
     return rc;
 }
 
@@ -2430,7 +3111,7 @@ static DECLCALLBACK(int) hdaPciIoRegionMap(PPCIDEVICE pPciDev, int iRegion, RTGC
                                IOMMMIO_FLAGS_READ_PASSTHRU |
 #endif
                                IOMMMIO_FLAGS_WRITE_PASSTHRU,
-                               hdaMMIOWrite, hdaMMIORead, "ICH6_HDA");
+                               hdaMMIOWrite, hdaMMIORead, "HDA");
 
     if (RT_FAILURE(rc))
         return rc;
@@ -2464,11 +3145,12 @@ static DECLCALLBACK(int) hdaPciIoRegionMap(PPCIDEVICE pPciDev, int iRegion, RTGC
 static DECLCALLBACK(int) hdaSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
 {
     PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
+
     /* Save Codec nodes states */
     hdaCodecSaveState(pThis->pCodec, pSSM);
 
     /* Save MMIO registers */
-    AssertCompile(RT_ELEMENTS(pThis->au32Regs) == 112);
+    AssertCompile(RT_ELEMENTS(pThis->au32Regs) >= HDA_NREGS_SAVED);
     SSMR3PutU32(pSSM, RT_ELEMENTS(pThis->au32Regs));
     SSMR3PutMem(pSSM, pThis->au32Regs, sizeof(pThis->au32Regs));
 
@@ -2520,14 +3202,13 @@ static DECLCALLBACK(int) hdaLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32
         case HDA_SSM_VERSION_2:
         case HDA_SSM_VERSION_3:
             cRegs = 112;
-            AssertCompile(RT_ELEMENTS(pThis->au32Regs) == 112);
+            AssertCompile(RT_ELEMENTS(pThis->au32Regs) >= HDA_NREGS_SAVED);
             break;
 
         case HDA_SSM_VERSION:
             rc = SSMR3GetU32(pSSM, &cRegs); AssertRCReturn(rc, rc);
-            AssertLogRelMsgReturn(cRegs == RT_ELEMENTS(pThis->au32Regs),
-                                  ("cRegs is %d, expected %d\n", cRegs, RT_ELEMENTS(pThis->au32Regs)),
-                                  VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
+            if (cRegs != RT_ELEMENTS(pThis->au32Regs))
+                LogRel(("HDA: SSM version cRegs is %RU32, expected %RU32\n", cRegs, RT_ELEMENTS(pThis->au32Regs)));
             break;
 
         default:
@@ -2540,31 +3221,59 @@ static DECLCALLBACK(int) hdaLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32
         SSMR3Skip(pSSM, sizeof(uint32_t) * (cRegs - RT_ELEMENTS(pThis->au32Regs)));
     }
     else
-    {
-        RT_ZERO(pThis->au32Regs);
         SSMR3GetMem(pSSM, pThis->au32Regs, sizeof(uint32_t) * cRegs);
-    }
 
     /*
-     * Load HDA dma counters.
+     * Load HDA DMA counters.
      */
     uint32_t   fFlags   = uVersion <= HDA_SSM_VERSION_2 ? SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED : 0;
     PCSSMFIELD paFields = uVersion <= HDA_SSM_VERSION_2 ? g_aHdaBDLEDescFieldsOld              : g_aHdaBDLEDescFields;
-    SSMR3GetStructEx(pSSM, &pThis->StOutBdle, sizeof(pThis->StOutBdle), fFlags, paFields, NULL);
-    SSMR3GetStructEx(pSSM, &pThis->StMicBdle, sizeof(pThis->StMicBdle), fFlags, paFields, NULL);
+    rc = SSMR3GetStructEx(pSSM, &pThis->StOutBdle, sizeof(pThis->StOutBdle), fFlags, paFields, NULL);
+    AssertRCReturn(rc, rc);
+    rc = SSMR3GetStructEx(pSSM, &pThis->StMicBdle, sizeof(pThis->StMicBdle), fFlags, paFields, NULL);
+    AssertRCReturn(rc, rc);
     rc = SSMR3GetStructEx(pSSM, &pThis->StInBdle, sizeof(pThis->StInBdle), fFlags, paFields, NULL);
     AssertRCReturn(rc, rc);
 
     /*
      * Update stuff after the state changes.
      */
+    bool fEnableIn    = RT_BOOL(SDCTL(pThis, 0) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN));
+#ifdef VBOX_WITH_HDA_MIC_IN
+    bool fEnableMicIn = RT_BOOL(SDCTL(pThis, 2) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN));
+#else
+    bool fEnableMicIn = fEnableIn; /* Mic In == Line In */
+#endif
+    bool fEnableOut   = RT_BOOL(SDCTL(pThis, 4) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN));
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PHDADRIVER pDrv;
+    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+    {
+        rc = pDrv->pConnector->pfnEnableIn(pDrv->pConnector, pDrv->LineIn.pStrmIn, fEnableIn);
+        if (RT_FAILURE(rc))
+            break;
+        rc = pDrv->pConnector->pfnEnableIn(pDrv->pConnector, pDrv->MicIn.pStrmIn, fEnableMicIn);
+        if (RT_FAILURE(rc))
+            break;
+        rc = pDrv->pConnector->pfnEnableOut(pDrv->pConnector, pDrv->Out.pStrmOut, fEnableOut);
+        if (RT_FAILURE(rc))
+            break;
+    }
+#else
     AUD_set_active_in(pThis->pCodec->SwVoiceIn, SDCTL(pThis, 0) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN));
     AUD_set_active_out(pThis->pCodec->SwVoiceOut, SDCTL(pThis, 4) & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN));
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
-    pThis->u64CORBBase = RT_MAKE_U64(CORBLBASE(pThis), CORBUBASE(pThis));
-    pThis->u64RIRBBase = RT_MAKE_U64(RIRLBASE(pThis), RIRUBASE(pThis));
-    pThis->u64DPBase   = RT_MAKE_U64(DPLBASE(pThis), DPUBASE(pThis));
-    return VINF_SUCCESS;
+    if (RT_SUCCESS(rc))
+    {
+        pThis->u64CORBBase = RT_MAKE_U64(HDA_REG(pThis, CORBLBASE), HDA_REG(pThis, CORBUBASE));
+        pThis->u64RIRBBase = RT_MAKE_U64(HDA_REG(pThis, RIRBLBASE), HDA_REG(pThis, RIRBUBASE));
+        pThis->u64DPBase   = RT_MAKE_U64(HDA_REG(pThis, DPLBASE), HDA_REG(pThis, DPUBASE));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
 }
 
 
@@ -2583,10 +3292,10 @@ hdaFormatStrmCtl(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
     return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
                        "SDCTL(raw: %#x, strm:%#x, dir:%RTbool, tp:%RTbool strip:%x, deie:%RTbool, ioce:%RTbool, run:%RTbool, srst:%RTbool)",
                        sdCtl,
-                       (sdCtl & HDA_REG_FIELD_MASK(SDCTL, NUM)) >> ICH6_HDA_SDCTL_NUM_SHIFT,
+                       (sdCtl & HDA_REG_FIELD_MASK(SDCTL, NUM)) >> HDA_SDCTL_NUM_SHIFT,
                        RT_BOOL(sdCtl & HDA_REG_FIELD_FLAG_MASK(SDCTL, DIR)),
                        RT_BOOL(sdCtl & HDA_REG_FIELD_FLAG_MASK(SDCTL, TP)),
-                       (sdCtl & HDA_REG_FIELD_MASK(SDCTL, STRIPE)) >> ICH6_HDA_SDCTL_STRIPE_SHIFT,
+                       (sdCtl & HDA_REG_FIELD_MASK(SDCTL, STRIPE)) >> HDA_SDCTL_STRIPE_SHIFT,
                        RT_BOOL(sdCtl & HDA_REG_FIELD_FLAG_MASK(SDCTL, DEIE)),
                        RT_BOOL(sdCtl & HDA_REG_FIELD_FLAG_MASK(SDCTL, ICE)),
                        RT_BOOL(sdCtl & HDA_REG_FIELD_FLAG_MASK(SDCTL, RUN)),
@@ -2675,7 +3384,7 @@ static void hdaDbgPrintRegister(PHDASTATE pThis, PCDBGFINFOHLP pHlp, int iHdaInd
     Assert(   pThis
            && iHdaIndex >= 0
            && iHdaIndex < HDA_NREGS);
-    pHlp->pfnPrintf(pHlp, "hda: %s: 0x%x\n", g_aHdaRegMap[iHdaIndex].abbrev, pThis->au32Regs[iHdaIndex]);
+    pHlp->pfnPrintf(pHlp, "%s: 0x%x\n", g_aHdaRegMap[iHdaIndex].abbrev, pThis->au32Regs[g_aHdaRegMap[iHdaIndex].mem_idx]);
 }
 
 
@@ -2700,10 +3409,10 @@ static void hdaDbgPrintStream(PHDASTATE pThis, PCDBGFINFOHLP pHlp, int iHdaStrmI
            && iHdaStrmIndex >= 0
            && iHdaStrmIndex < 7);
     pHlp->pfnPrintf(pHlp, "Dump of %d HDA Stream:\n", iHdaStrmIndex);
-    pHlp->pfnPrintf(pHlp, "SD%dCTL: %R[sdctl]\n", iHdaStrmIndex, HDA_STREAM_REG2(pThis, CTL, iHdaStrmIndex));
-    pHlp->pfnPrintf(pHlp, "SD%dCTS: %R[sdsts]\n", iHdaStrmIndex, HDA_STREAM_REG2(pThis, STS, iHdaStrmIndex));
-    pHlp->pfnPrintf(pHlp, "SD%dFIFOS: %R[sdfifos]\n", iHdaStrmIndex, HDA_STREAM_REG2(pThis, FIFOS, iHdaStrmIndex));
-    pHlp->pfnPrintf(pHlp, "SD%dFIFOW: %R[sdfifow]\n", iHdaStrmIndex, HDA_STREAM_REG2(pThis, FIFOW, iHdaStrmIndex));
+    pHlp->pfnPrintf(pHlp, "SD%dCTL: %R[sdctl]\n", iHdaStrmIndex, HDA_STREAM_REG(pThis, CTL, iHdaStrmIndex));
+    pHlp->pfnPrintf(pHlp, "SD%dCTS: %R[sdsts]\n", iHdaStrmIndex, HDA_STREAM_REG(pThis, STS, iHdaStrmIndex));
+    pHlp->pfnPrintf(pHlp, "SD%dFIFOS: %R[sdfifos]\n", iHdaStrmIndex, HDA_STREAM_REG(pThis, FIFOS, iHdaStrmIndex));
+    pHlp->pfnPrintf(pHlp, "SD%dFIFOW: %R[sdfifow]\n", iHdaStrmIndex, HDA_STREAM_REG(pThis, FIFOW, iHdaStrmIndex));
 }
 
 
@@ -2728,16 +3437,18 @@ static DECLCALLBACK(void) hdaInfoStream(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp,
             hdaDbgPrintStream(pThis, pHlp, iHdaStrmIndex);
 }
 
+
 /**
  * @callback_method_impl{FNDBGFHANDLERDEV}
  */
 static DECLCALLBACK(void) hdaInfoCodecNodes(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
 {
     PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
+
     if (pThis->pCodec->pfnCodecDbgListNodes)
         pThis->pCodec->pfnCodecDbgListNodes(pThis->pCodec, pHlp, pszArgs);
     else
-        pHlp->pfnPrintf(pHlp, "Codec implementation doesn't provide corresponding callback.\n");
+        pHlp->pfnPrintf(pHlp, "Codec implementation doesn't provide corresponding callback\n");
 }
 
 
@@ -2747,10 +3458,11 @@ static DECLCALLBACK(void) hdaInfoCodecNodes(PPDMDEVINS pDevIns, PCDBGFINFOHLP pH
 static DECLCALLBACK(void) hdaInfoCodecSelector(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
 {
     PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
+
     if (pThis->pCodec->pfnCodecDbgSelector)
         pThis->pCodec->pfnCodecDbgSelector(pThis->pCodec, pHlp, pszArgs);
     else
-        pHlp->pfnPrintf(pHlp, "Codec implementation doesn't provide corresponding callback.\n");
+        pHlp->pfnPrintf(pHlp, "Codec implementation doesn't provide corresponding callback\n");
 }
 
 
@@ -2780,31 +3492,48 @@ static DECLCALLBACK(void *) hdaQueryInterface(struct PDMIBASE *pInterface, const
  * @remark  The original sources didn't install a reset handler, but it seems to
  *          make sense to me so we'll do it.
  */
-static DECLCALLBACK(void)  hdaReset(PPDMDEVINS pDevIns)
+static DECLCALLBACK(void) hdaReset(PPDMDEVINS pDevIns)
 {
     PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
-    GCAP(pThis) = HDA_MAKE_GCAP(4,4,0,0,1); /* see 6.2.1 */
-    VMIN(pThis) = 0x00;       /* see 6.2.2 */
-    VMAJ(pThis) = 0x01;       /* see 6.2.3 */
-    VMAJ(pThis) = 0x01;       /* see 6.2.3 */
-    OUTPAY(pThis) = 0x003C;   /* see 6.2.4 */
-    INPAY(pThis)  = 0x001D;   /* see 6.2.5 */
-    pThis->au32Regs[ICH6_HDA_REG_CORBSIZE] = 0x42; /* see 6.2.1 */
-    pThis->au32Regs[ICH6_HDA_REG_RIRBSIZE] = 0x42; /* see 6.2.1 */
-    CORBRP(pThis) = 0x0;
-    RIRBWP(pThis) = 0x0;
-
-    Log(("hda: inter HDA reset.\n"));
+    HDA_REG(pThis, GCAP)     = HDA_MAKE_GCAP(4,4,0,0,1); /* see 6.2.1 */
+    HDA_REG(pThis, VMIN)     = 0x00;    /* see 6.2.2 */
+    HDA_REG(pThis, VMAJ)     = 0x01;    /* see 6.2.3 */
+    HDA_REG(pThis, OUTPAY)   = 0x003C;  /* see 6.2.4 */
+    HDA_REG(pThis, INPAY)    = 0x001D;  /* see 6.2.5 */
+    HDA_REG(pThis, CORBSIZE) = 0x42;    /* see 6.2.1 */
+    HDA_REG(pThis, RIRBSIZE) = 0x42;    /* see 6.2.1 */
+    HDA_REG(pThis, CORBRP)   = 0x0;
+    HDA_REG(pThis, RIRBWP)   = 0x0;
+
+    LogFunc(("Resetting ...\n"));
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /* Stop any audio currently playing. */
+    PHDADRIVER pDrv;
+    RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
+    {
+        pDrv->pConnector->pfnEnableIn(pDrv->pConnector, pDrv->LineIn.pStrmIn, false /* Disable */);
+        /* Ignore rc. */
+        pDrv->pConnector->pfnEnableIn(pDrv->pConnector, pDrv->MicIn.pStrmIn, false /* Disable */);
+        /* Ditto. */
+        pDrv->pConnector->pfnEnableOut(pDrv->pConnector, pDrv->Out.pStrmOut, false /* Disable */);
+        /* Ditto. */
+    }
+#else
+    AUD_set_active_in(pThis->pCodec->SwVoiceIn, false);
+    AUD_set_active_out(pThis->pCodec->SwVoiceOut, false);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
     pThis->cbCorbBuf = 256 * sizeof(uint32_t);
 
     if (pThis->pu32CorbBuf)
-        memset(pThis->pu32CorbBuf, 0, pThis->cbCorbBuf);
+        RT_BZERO(pThis->pu32CorbBuf, pThis->cbCorbBuf);
     else
         pThis->pu32CorbBuf = (uint32_t *)RTMemAllocZ(pThis->cbCorbBuf);
 
     pThis->cbRirbBuf = 256 * sizeof(uint64_t);
     if (pThis->pu64RirbBuf)
-        memset(pThis->pu64RirbBuf, 0, pThis->cbRirbBuf);
+        RT_BZERO(pThis->pu64RirbBuf, pThis->cbRirbBuf);
     else
         pThis->pu64RirbBuf = (uint64_t *)RTMemAllocZ(pThis->cbRirbBuf);
 
@@ -2817,26 +3546,29 @@ static DECLCALLBACK(void)  hdaReset(PPDMDEVINS pDevIns)
         PHDABDLEDESC pBdle = NULL;
         if (u8Strm == 0)
             pBdle = &pThis->StInBdle;
+# ifdef VBOX_WITH_HDA_MIC_IN
+        else if (u8Strm == 2)
+            pBdle = &pThis->StMicBdle;
+# endif
         else if(u8Strm == 4)
             pBdle = &pThis->StOutBdle;
         else
         {
-            memset(&StEmptyBdle, 0, sizeof(HDABDLEDESC));
+            RT_ZERO(StEmptyBdle);
             pBdle = &StEmptyBdle;
         }
         hdaInitTransferDescriptor(pThis, pBdle, u8Strm, &StreamDesc);
         /* hdaStreamReset prevents changing the SRST bit, so we force it to zero here. */
-        HDA_STREAM_REG2(pThis, CTL, u8Strm) = 0;
+        HDA_STREAM_REG(pThis, CTL, u8Strm) = 0;
         hdaStreamReset(pThis, pBdle, &StreamDesc, u8Strm);
     }
 
-    /* emulation of codec "wake up" (HDA spec 5.5.1 and 6.5)*/
-    STATESTS(pThis) = 0x1;
+    /* Emulation of codec "wake up" (HDA spec 5.5.1 and 6.5). */
+    HDA_REG(pThis, STATESTS) = 0x1;
 
-    Log(("hda: reset finished\n"));
+    LogRel(("HDA: Reset\n"));
 }
 
-
 /**
  * @interface_method_impl{PDMDEVREG,pfnDestruct}
  */
@@ -2844,6 +3576,23 @@ static DECLCALLBACK(int) hdaDestruct(PPDMDEVINS pDevIns)
 {
     PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PHDADRIVER pDrv;
+    while (!RTListIsEmpty(&pThis->lstDrv))
+    {
+        pDrv = RTListGetFirst(&pThis->lstDrv, HDADRIVER, Node);
+
+        RTListNodeRemove(&pDrv->Node);
+        RTMemFree(pDrv);
+    }
+
+    if (pThis->pMixer)
+    {
+        audioMixerDestroy(pThis->pMixer);
+        pThis->pMixer = NULL;
+    }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
     if (pThis->pCodec)
     {
         int rc = hdaCodecDestruct(pThis->pCodec);
@@ -2862,14 +3611,94 @@ static DECLCALLBACK(int) hdaDestruct(PPDMDEVINS pDevIns)
     return VINF_SUCCESS;
 }
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+/**
+ * Attach command.
+ *
+ * This is called to let the device attach to a driver for a specified LUN
+ * during runtime. This is not called during VM construction, the device
+ * constructor have to attach to all the available drivers.
+ *
+ * @returns VBox status code.
+ * @param   pDevIns     The device instance.
+ * @param   uLUN        The logical unit which is being detached.
+ * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
+ */
+static DECLCALLBACK(int) hdaAttach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
+{
+    PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
+
+    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
+                    ("HDA device does not support hotplugging\n"),
+                    VERR_INVALID_PARAMETER);
+
+    /*
+     * Attach driver.
+     */
+    char *pszDesc = NULL;
+    if (RTStrAPrintf(&pszDesc, "Audio driver port (HDA) for LUN#%u", uLUN) <= 0)
+        AssertMsgReturn(pszDesc,
+                        ("Not enough memory for HDA driver port description of LUN #%u\n", uLUN),
+                        VERR_NO_MEMORY);
+
+    int rc = PDMDevHlpDriverAttach(pDevIns, uLUN,
+                                   &pThis->IBase, &pThis->pDrvBase, pszDesc);
+    if (RT_SUCCESS(rc))
+    {
+        PHDADRIVER pDrv = (PHDADRIVER)RTMemAllocZ(sizeof(HDADRIVER));
+        if (pDrv)
+        {
+            pDrv->pConnector = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIAUDIOCONNECTOR);
+            AssertMsg(pDrv->pConnector != NULL,
+                      ("Configuration error: LUN#%u has no host audio interface, rc=%Rrc\n",
+                      uLUN, rc));
+            pDrv->pHDAState = pThis;
+            pDrv->uLUN      = uLUN;
+
+            /*
+             * For now we always set the driver at LUN 0 as our primary
+             * host backend. This might change in the future.
+             */
+            if (pDrv->uLUN == 0)
+                pDrv->Flags |= PDMAUDIODRVFLAG_PRIMARY;
+
+            LogFunc(("LUN#%u: pCon=%p, drvFlags=0x%x\n", uLUN, pDrv->pConnector, pDrv->Flags));
+
+            /* Attach to driver list. */
+            RTListAppend(&pThis->lstDrv, &pDrv->Node);
+        }
+        else
+            rc = VERR_NO_MEMORY;
+    }
+    else if (   rc == VERR_PDM_NO_ATTACHED_DRIVER
+             || rc == VERR_PDM_CFG_MISSING_DRIVER_NAME)
+    {
+        LogFunc(("No attached driver for LUN #%u\n", uLUN));
+    }
+    else if (RT_FAILURE(rc))
+        AssertMsgFailed(("Failed to attach HDA LUN #%u (\"%s\"), rc=%Rrc\n",
+                        uLUN, pszDesc, rc));
+
+    RTStrFree(pszDesc);
+
+    LogFunc(("uLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));
+    return rc;
+}
+
+static DECLCALLBACK(void) hdaDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags)
+{
+    NOREF(pDevIns); NOREF(iLUN); NOREF(fFlags);
+
+    LogFlowFuncEnter();
+}
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
 /**
  * @interface_method_impl{PDMDEVREG,pfnConstruct}
  */
 static DECLCALLBACK(int) hdaConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle)
 {
-    PHDASTATE   pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
-    int         rc;
-
+    PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
     Assert(iInstance == 0);
     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
 
@@ -2881,7 +3710,7 @@ static DECLCALLBACK(int) hdaConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNO
         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
                                 N_ ("Invalid configuration for the Intel HDA device"));
 
-    rc = CFGMR3QueryBoolDef(pCfgHandle, "RCEnabled", &pThis->fRCEnabled, false);
+    int rc = CFGMR3QueryBoolDef(pCfgHandle, "RCEnabled", &pThis->fRCEnabled, false);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("HDA configuration error: failed to read RCEnabled as boolean"));
@@ -3005,6 +3834,64 @@ static DECLCALLBACK(int) hdaConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNO
     if (RT_FAILURE(rc))
         return rc;
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    RTListInit(&pThis->lstDrv);
+
+    uint8_t uLUN;
+    for (uLUN = 0; uLUN < UINT8_MAX; uLUN)
+    {
+        LogFunc(("Trying to attach driver for LUN #%RU32 ...\n", uLUN));
+        rc = hdaAttach(pDevIns, uLUN, PDM_TACH_FLAGS_NOT_HOT_PLUG);
+        if (RT_FAILURE(rc))
+        {
+            if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
+                rc = VINF_SUCCESS;
+
+            break;
+        }
+
+        uLUN++;
+    }
+
+    LogFunc(("cLUNs=%RU8, rc=%Rrc\n", uLUN, rc));
+
+    if (RT_SUCCESS(rc))
+    {
+        rc = audioMixerCreate("HDA Mixer", 0 /* uFlags */, &pThis->pMixer);
+        if (RT_SUCCESS(rc))
+        {
+            /* Set a default audio format for our mixer. */
+            PDMAUDIOSTREAMCFG streamCfg;
+            streamCfg.uHz           = 41000;
+            streamCfg.cChannels     = 2;
+            streamCfg.enmFormat     = AUD_FMT_S16;
+            streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+            rc = audioMixerSetDeviceFormat(pThis->pMixer, &streamCfg);
+            AssertRC(rc);
+
+            /* Add all required audio sinks. */
+            rc = audioMixerAddSink(pThis->pMixer, "[Playback] PCM Output",
+                                   AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput);
+            AssertRC(rc);
+
+            rc = audioMixerAddSink(pThis->pMixer, "[Recording] Line In",
+                                   AUDMIXSINKDIR_INPUT, &pThis->pSinkLineIn);
+            AssertRC(rc);
+
+            rc = audioMixerAddSink(pThis->pMixer, "[Recording] Microphone In",
+                                   AUDMIXSINKDIR_INPUT, &pThis->pSinkMicIn);
+            AssertRC(rc);
+
+            /* There is no master volume control. Set the master to max. */
+            PDMAUDIOVOLUME vol = { false, 255, 255 };
+            rc = audioMixerSetMasterVolume(pThis->pMixer, &vol);
+            AssertRC(rc);
+        }
+    }
+
+    LogFunc(("cLUNs=%RU8, rc=%Rrc\n", uLUN, rc));
+#else
     /*
      * Attach driver.
      */
@@ -3016,105 +3903,162 @@ static DECLCALLBACK(int) hdaConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNO
         AssertMsgFailed(("Failed to attach Intel HDA LUN #0! rc=%Rrc\n", rc));
         return rc;
     }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
-    /* Construct codec state. */
-    pThis->pCodec = (PHDACODEC)RTMemAllocZ(sizeof(HDACODEC));
-    if (!pThis->pCodec)
-        return PDMDEV_SET_ERROR(pDevIns, VERR_NO_MEMORY, N_("HDA: Out of memory allocating codec state"));
-
-    pThis->pCodec->pvHDAState = pThis;
-    rc = hdaCodecConstruct(pDevIns, pThis->pCodec, pCfgHandle);
-    if (RT_FAILURE(rc))
-        AssertRCReturn(rc, rc);
-
-    /* ICH6 datasheet defines 0 values for SVID and SID (18.1.14-15), which together with values returned for
-       verb F20 should provide device/codec recognition. */
-    Assert(pThis->pCodec->u16VendorId);
-    Assert(pThis->pCodec->u16DeviceId);
-    PCIDevSetSubSystemVendorId(&pThis->PciDev, pThis->pCodec->u16VendorId); /* 2c ro - intel.) */
-    PCIDevSetSubSystemId(      &pThis->PciDev, pThis->pCodec->u16DeviceId); /* 2e ro. */
-
-    hdaReset(pDevIns);
-    pThis->pCodec->id = 0;
-    pThis->pCodec->pfnTransfer = hdaTransfer;
-    pThis->pCodec->pfnReset = hdaCodecReset;
-
-    /*
-     * 18.2.6,7 defines that values of this registers might be cleared on power on/reset
-     * hdaReset shouldn't affects these registers.
-     */
-    WAKEEN(pThis) = 0x0;
-    STATESTS(pThis) = 0x0;
+    if (RT_SUCCESS(rc))
+    {
+        /* Construct codec. */
+        pThis->pCodec = (PHDACODEC)RTMemAllocZ(sizeof(HDACODEC));
+        if (!pThis->pCodec)
+            return PDMDEV_SET_ERROR(pDevIns, VERR_NO_MEMORY, N_("Out of memory allocating HDA codec state"));
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        /* Audio driver callbacks for multiplexing. */
+        pThis->pCodec->pfnCloseIn   = hdaCloseIn;
+        pThis->pCodec->pfnCloseOut  = hdaCloseOut;
+        pThis->pCodec->pfnOpenIn    = hdaOpenIn;
+        pThis->pCodec->pfnOpenOut   = hdaOpenOut;
+        pThis->pCodec->pfnSetVolume = hdaSetVolume;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+        pThis->pCodec->pHDAState = pThis; /* Assign HDA controller state to codec. */
+
+        /* Construct the codec. */
+        rc = hdaCodecConstruct(pDevIns, pThis->pCodec, 0 /* Codec index */, pCfgHandle);
+        if (RT_FAILURE(rc))
+            AssertRCReturn(rc, rc);
 
-    /*
-     * Debug and string formatter types.
-     */
-    PDMDevHlpDBGFInfoRegister(pDevIns, "hda",         "HDA info. (hda [register case-insensitive])",    hdaInfo);
-    PDMDevHlpDBGFInfoRegister(pDevIns, "hdastrm",     "HDA stream info. (hdastrm [stream number])",     hdaInfoStream);
-    PDMDevHlpDBGFInfoRegister(pDevIns, "hdcnodes",    "HDA codec nodes.",                               hdaInfoCodecNodes);
-    PDMDevHlpDBGFInfoRegister(pDevIns, "hdcselector", "HDA codec's selector states [node number].",     hdaInfoCodecSelector);
+        /* ICH6 datasheet defines 0 values for SVID and SID (18.1.14-15), which together with values returned for
+           verb F20 should provide device/codec recognition. */
+        Assert(pThis->pCodec->u16VendorId);
+        Assert(pThis->pCodec->u16DeviceId);
+        PCIDevSetSubSystemVendorId(&pThis->PciDev, pThis->pCodec->u16VendorId); /* 2c ro - intel.) */
+        PCIDevSetSubSystemId(      &pThis->PciDev, pThis->pCodec->u16DeviceId); /* 2e ro. */
 
-    rc = RTStrFormatTypeRegister("sdctl",   hdaFormatStrmCtl,   NULL);
-    AssertRC(rc);
-    rc = RTStrFormatTypeRegister("sdsts",   hdaFormatStrmSts,   NULL);
-    AssertRC(rc);
-    rc = RTStrFormatTypeRegister("sdfifos", hdaFormatStrmFifos, NULL);
-    AssertRC(rc);
-    rc = RTStrFormatTypeRegister("sdfifow", hdaFormatStrmFifow, NULL);
-    AssertRC(rc);
-#if 0
-    rc = RTStrFormatTypeRegister("sdfmt", printHdaStrmFmt, NULL);
-    AssertRC(rc);
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
+        pThis->pCodec->pfnTransfer = hdaTransfer;
 #endif
+        pThis->pCodec->pfnReset    = hdaCodecReset;
+    }
 
-    /*
-     * Some debug assertions.
-     */
-    for (unsigned i = 0; i < RT_ELEMENTS(g_aHdaRegMap); i++)
+    if (RT_SUCCESS(rc))
     {
-        struct HDAREGDESC const *pReg     = &g_aHdaRegMap[i];
-        struct HDAREGDESC const *pNextReg = i + 1 < RT_ELEMENTS(g_aHdaRegMap) ?  &g_aHdaRegMap[i + 1] : NULL;
+        hdaReset(pDevIns);
+
+        /*
+         * 18.2.6,7 defines that values of this registers might be cleared on power on/reset
+         * hdaReset shouldn't affects these registers.
+         */
+        HDA_REG(pThis, WAKEEN)   = 0x0;
+        HDA_REG(pThis, STATESTS) = 0x0;
 
-        /* binary search order. */
-        AssertReleaseMsg(!pNextReg || pReg->offset + pReg->size <= pNextReg->offset,
-                         ("[%#x] = {%#x LB %#x}  vs. [%#x] = {%#x LB %#x}\n",
-                          i, pReg->offset, pReg->size, i + 1, pNextReg->offset, pNextReg->size));
+        /*
+         * Debug and string formatter types.
+         */
+        PDMDevHlpDBGFInfoRegister(pDevIns, "hda",         "HDA info. (hda [register case-insensitive])",    hdaInfo);
+        PDMDevHlpDBGFInfoRegister(pDevIns, "hdastrm",     "HDA stream info. (hdastrm [stream number])",     hdaInfoStream);
+        PDMDevHlpDBGFInfoRegister(pDevIns, "hdcnodes",    "HDA codec nodes.",                               hdaInfoCodecNodes);
+        PDMDevHlpDBGFInfoRegister(pDevIns, "hdcselector", "HDA codec's selector states [node number].",     hdaInfoCodecSelector);
 
-        /* alignment. */
-        AssertReleaseMsg(   pReg->size == 1
-                         || (pReg->size == 2 && (pReg->offset & 1) == 0)
-                         || (pReg->size == 3 && (pReg->offset & 3) == 0)
-                         || (pReg->size == 4 && (pReg->offset & 3) == 0),
-                         ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
+        rc = RTStrFormatTypeRegister("sdctl",   hdaFormatStrmCtl,   NULL);
+        AssertRC(rc);
+        rc = RTStrFormatTypeRegister("sdsts",   hdaFormatStrmSts,   NULL);
+        AssertRC(rc);
+        rc = RTStrFormatTypeRegister("sdfifos", hdaFormatStrmFifos, NULL);
+        AssertRC(rc);
+        rc = RTStrFormatTypeRegister("sdfifow", hdaFormatStrmFifow, NULL);
+        AssertRC(rc);
+    #if 0
+        rc = RTStrFormatTypeRegister("sdfmt", printHdaStrmFmt, NULL);
+        AssertRC(rc);
+    #endif
 
-        /* registers are packed into dwords - with 3 exceptions with gaps at the end of the dword. */
-        AssertRelease(((pReg->offset + pReg->size) & 3) == 0 || pNextReg);
-        if (pReg->offset & 3)
+        /*
+         * Some debug assertions.
+         */
+        for (unsigned i = 0; i < RT_ELEMENTS(g_aHdaRegMap); i++)
         {
-            struct HDAREGDESC const *pPrevReg = i > 0 ?  &g_aHdaRegMap[i - 1] : NULL;
-            AssertReleaseMsg(pPrevReg, ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
-            if (pPrevReg)
-                AssertReleaseMsg(pPrevReg->offset + pPrevReg->size == pReg->offset,
-                                 ("[%#x] = {%#x LB %#x}  vs. [%#x] = {%#x LB %#x}\n",
-                                  i - 1, pPrevReg->offset, pPrevReg->size, i + 1, pReg->offset, pReg->size));
+            struct HDAREGDESC const *pReg     = &g_aHdaRegMap[i];
+            struct HDAREGDESC const *pNextReg = i + 1 < RT_ELEMENTS(g_aHdaRegMap) ?  &g_aHdaRegMap[i + 1] : NULL;
+
+            /* binary search order. */
+            AssertReleaseMsg(!pNextReg || pReg->offset + pReg->size <= pNextReg->offset,
+                             ("[%#x] = {%#x LB %#x}  vs. [%#x] = {%#x LB %#x}\n",
+                              i, pReg->offset, pReg->size, i + 1, pNextReg->offset, pNextReg->size));
+
+            /* alignment. */
+            AssertReleaseMsg(   pReg->size == 1
+                             || (pReg->size == 2 && (pReg->offset & 1) == 0)
+                             || (pReg->size == 3 && (pReg->offset & 3) == 0)
+                             || (pReg->size == 4 && (pReg->offset & 3) == 0),
+                             ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
+
+            /* registers are packed into dwords - with 3 exceptions with gaps at the end of the dword. */
+            AssertRelease(((pReg->offset + pReg->size) & 3) == 0 || pNextReg);
+            if (pReg->offset & 3)
+            {
+                struct HDAREGDESC const *pPrevReg = i > 0 ?  &g_aHdaRegMap[i - 1] : NULL;
+                AssertReleaseMsg(pPrevReg, ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
+                if (pPrevReg)
+                    AssertReleaseMsg(pPrevReg->offset + pPrevReg->size == pReg->offset,
+                                     ("[%#x] = {%#x LB %#x}  vs. [%#x] = {%#x LB %#x}\n",
+                                      i - 1, pPrevReg->offset, pPrevReg->size, i + 1, pReg->offset, pReg->size));
+            }
+    #if 0
+            if ((pReg->offset + pReg->size) & 3)
+            {
+                AssertReleaseMsg(pNextReg, ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
+                if (pNextReg)
+                    AssertReleaseMsg(pReg->offset + pReg->size == pNextReg->offset,
+                                     ("[%#x] = {%#x LB %#x}  vs. [%#x] = {%#x LB %#x}\n",
+                                      i, pReg->offset, pReg->size, i + 1,  pNextReg->offset, pNextReg->size));
+            }
+    #endif
+
+            /* The final entry is a full DWORD, no gaps! Allows shortcuts. */
+            AssertReleaseMsg(pNextReg || ((pReg->offset + pReg->size) & 3) == 0,
+                             ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
         }
-#if 0
-        if ((pReg->offset + pReg->size) & 3)
+    }
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    if (RT_SUCCESS(rc))
+    {
+        /* Start the emulation timer. */
+        rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, hdaTimer, pThis,
+                                    TMTIMER_FLAGS_NO_CRIT_SECT, "DevIchHda", &pThis->pTimer);
+        AssertRCReturn(rc, rc);
+
+        if (RT_SUCCESS(rc))
         {
-            AssertReleaseMsg(pNextReg, ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
-            if (pNextReg)
-                AssertReleaseMsg(pReg->offset + pReg->size == pNextReg->offset,
-                                 ("[%#x] = {%#x LB %#x}  vs. [%#x] = {%#x LB %#x}\n",
-                                  i, pReg->offset, pReg->size, i + 1,  pNextReg->offset, pNextReg->size));
+            /** @todo Investigate why sounds is getting corrupted if the "ticks" value is too
+             *        low, e.g. "PDMDevHlpTMTimeVirtGetFreq / 200". */
+            pThis->uTicks = PDMDevHlpTMTimeVirtGetFreq(pDevIns) / 500; /** @todo Make this configurable! */
+            if (pThis->uTicks < 100)
+                pThis->uTicks = 100;
+            LogFunc(("Timer ticks=%RU64\n", pThis->uTicks));
+
+            /* Fire off timer. */
+            TMTimerSet(pThis->pTimer, TMTimerGet(pThis->pTimer) + pThis->uTicks);
         }
-#endif
+    }
 
-        /* The final entry is a full dword, no gaps! Allows shortcuts. */
-        AssertReleaseMsg(pNextReg || ((pReg->offset + pReg->size) & 3) == 0,
-                         ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
+# ifdef VBOX_WITH_STATISTICS
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Register statistics.
+         */
+        PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTimer,            STAMTYPE_PROFILE, "/Devices/HDA/Timer",             STAMUNIT_TICKS_PER_CALL, "Profiling hdaTimer.");
+        PDMDevHlpSTAMRegister(pDevIns, &pThis->StatBytesRead,        STAMTYPE_COUNTER, "/Devices/HDA/BytesRead"   ,      STAMUNIT_BYTES,          "Bytes read from HDA emulation.");
+        PDMDevHlpSTAMRegister(pDevIns, &pThis->StatBytesWritten,     STAMTYPE_COUNTER, "/Devices/HDA/BytesWritten",      STAMUNIT_BYTES,          "Bytes written to HDA emulation.");
     }
+# endif
 
-    return VINF_SUCCESS;
+#endif
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
 }
 
 /**
diff --git a/src/VBox/Devices/Audio/DevIchHdaCodec.cpp b/src/VBox/Devices/Audio/DevIchHdaCodec.cpp
index e5f414b..ebb14d5 100644
--- a/src/VBox/Devices/Audio/DevIchHdaCodec.cpp
+++ b/src/VBox/Devices/Audio/DevIchHdaCodec.cpp
@@ -8,7 +8,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -23,8 +23,9 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
-#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+//#define LOG_GROUP LOG_GROUP_DEV_AUDIO
 #include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pdmaudioifs.h>
 #include <iprt/assert.h>
 #include <iprt/uuid.h>
 #include <iprt/string.h>
@@ -33,9 +34,11 @@
 #include <iprt/cpp/utils.h>
 
 #include "VBoxDD.h"
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
 extern "C" {
 #include "audio.h"
 }
+#endif
 #include "DevIchHdaCodec.h"
 
 
@@ -43,10 +46,14 @@ extern "C" {
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
 /* PRM 5.3.1 */
+/** Codec address mask. */
 #define CODEC_CAD_MASK              0xF0000000
+/** Codec address shift. */
 #define CODEC_CAD_SHIFT             28
 #define CODEC_DIRECT_MASK           RT_BIT(27)
+/** Node ID mask. */
 #define CODEC_NID_MASK              0x07F00000
+/** Node ID shift. */
 #define CODEC_NID_SHIFT             20
 #define CODEC_VERBDATA_MASK         0x000FFFFF
 #define CODEC_VERB_4BIT_CMD         0x000FFFF0
@@ -56,7 +63,7 @@ extern "C" {
 #define CODEC_VERB_16BIT_CMD        0x000F0000
 #define CODEC_VERB_16BIT_DATA       0x0000FFFF
 
-#define CODEC_CAD(cmd) ((cmd) & CODEC_CAD_MASK)
+#define CODEC_CAD(cmd) (((cmd) & CODEC_CAD_MASK) >> CODEC_CAD_SHIFT)
 #define CODEC_DIRECT(cmd) ((cmd) & CODEC_DIRECT_MASK)
 #define CODEC_NID(cmd) ((((cmd) & CODEC_NID_MASK)) >> CODEC_NID_SHIFT)
 #define CODEC_VERBDATA(cmd) ((cmd) & CODEC_VERBDATA_MASK)
@@ -695,8 +702,6 @@ typedef union CODECNODE
     CODECSAVEDSTATENODE SavedState;
 } CODECNODE, *PCODECNODE;
 AssertNodeSize(CODECNODE, 60 + 6);
-
-
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
@@ -739,19 +744,8 @@ static SSMFIELD const g_aCodecNodeFieldsV1[] =
     SSMFIELD_ENTRY_TERM()
 };
 
-static DECLCALLBACK(void) dbgNodes(PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs)
-{
-    for (int i = 1; i < 12; i++)
-    {
-        PCODECNODE pNode = &pThis->paNodes[i];
-        AMPLIFIER *pAmp = &pNode->dac.B_params;
 
-        uint8_t lVol = AMPLIFIER_REGISTER(*pAmp, AMPLIFIER_OUT, AMPLIFIER_LEFT, 0) & 0x7f;
-        uint8_t rVol = AMPLIFIER_REGISTER(*pAmp, AMPLIFIER_OUT, AMPLIFIER_RIGHT, 0) & 0x7f;
 
-        pHlp->pfnPrintf(pHlp, "0x%x: lVol=%RU8, rVol=%RU8\n", i, lVol, rVol);
-    }
-}
 
 static int stac9220ResetNode(PHDACODEC pThis, uint8_t nodenum, PCODECNODE pNode)
 {
@@ -772,8 +766,8 @@ static int stac9220ResetNode(PHDACODEC pThis, uint8_t nodenum, PCODECNODE pNode)
                                             | CODEC_F00_0C_CAP_TRIGGER_REQUIRED
                                             | CODEC_F00_0C_CAP_IMPENDANCE_SENSE;//(17 << 8)|RT_BIT(6)|RT_BIT(5)|RT_BIT(2)|RT_BIT(1)|RT_BIT(0);
             pNode->node.au32F00_param[0x0B] = CODEC_F00_0B_PCM;
-            pNode->node.au32F00_param[0x0D] = CODEC_MAKE_F00_0D(1, 0x0, 0x7F, 0x7F);
-            pNode->node.au32F00_param[0x12] = CODEC_MAKE_F00_12(1, 0x2, 0x7F, 0x7F);
+            pNode->node.au32F00_param[0x0D] = CODEC_MAKE_F00_0D(1, 0x5, 0xE, 0);//RT_BIT(31)|(0x5 << 16)|(0xE)<<8;
+            pNode->node.au32F00_param[0x12] = RT_BIT(31)|(0x2 << 16)|(0x7f << 8)|0x7f;
             pNode->node.au32F00_param[0x11] = CODEC_MAKE_F00_11(1, 1, 0, 0, 4);//0xc0000004;
             pNode->node.au32F00_param[0x0F] = CODEC_F00_0F_D3|CODEC_F00_0F_D2|CODEC_F00_0F_D1|CODEC_F00_0F_D0;
             pNode->afg.u32F05_param = CODEC_MAKE_F05(0, 0, 0, CODEC_F05_D2, CODEC_F05_D2);//0x2 << 4| 0x2; /* PS-Act: D3, PS->Set D3  */
@@ -1010,6 +1004,7 @@ static int stac9220ResetNode(PHDACODEC pThis, uint8_t nodenum, PCODECNODE pNode)
                                          | CODEC_F00_09_CAP_OUT_AMP_PRESENT
                                          | CODEC_F00_09_CAP_LSB;//(3<<20)|RT_BIT(8)|RT_BIT(3)|RT_BIT(2)|RT_BIT(0);
             pNode->node.au32F00_param[0xe] = CODEC_MAKE_F00_0E(0, 0x7);
+            pNode->node.au32F00_param[0x12] = (0x27 << 16)|(0x4 << 8);
             /* STAC 9220 v10 6.21-22.{4,5} both(left and right) out amplefiers inited with 0*/
             memset(pNode->adcmux.B_params, 0, AMPLIFIER_SIZE);
             pNode->node.au32F02_param[0] = RT_MAKE_U32_FROM_U8(0xe, 0x15, 0xf, 0xb);
@@ -1019,6 +1014,7 @@ static int stac9220ResetNode(PHDACODEC pThis, uint8_t nodenum, PCODECNODE pNode)
             pNode->node.au32F00_param[9] = CODEC_MAKE_F00_09(CODEC_F00_09_TYPE_BEEP_GEN, 0, 0)
                                          | CODEC_F00_09_CAP_AMP_FMT_OVERRIDE
                                          | CODEC_F00_09_CAP_OUT_AMP_PRESENT;//(7 << 20) | RT_BIT(3) | RT_BIT(2);
+            pNode->node.au32F00_param[0x12] = (0x17 << 16)|(0x3 << 8)| 0x3;
             pNode->pcbeep.u32F0a_param = 0;
             memset(pNode->pcbeep.B_params, 0, AMPLIFIER_SIZE);
             break;
@@ -1096,12 +1092,13 @@ static int stac9220Construct(PHDACODEC pThis)
 {
     unconst(pThis->cTotalNodes) = 0x1C;
     pThis->pfnCodecNodeReset = stac9220ResetNode;
-    pThis->pfnCodecDbgListNodes = dbgNodes;
     pThis->u16VendorId = 0x8384;
     pThis->u16DeviceId = 0x7680;
     pThis->u8BSKU = 0x76;
     pThis->u8AssemblyId = 0x80;
     pThis->paNodes = (PCODECNODE)RTMemAllocZ(sizeof(CODECNODE) * pThis->cTotalNodes);
+    if (!pThis->paNodes)
+        return VERR_NO_MEMORY;
     pThis->fInReset = false;
 #define STAC9220WIDGET(type) pThis->au8##type##s = g_abStac9220##type##s
     STAC9220WIDGET(Port);
@@ -1169,56 +1166,38 @@ DECLISNODEOFTYPE(Reserved)
 /*
  * Misc helpers.
  */
-
-/* 2 ^^ (i / 32.0) -- more or less */
-static uint8_t aVolConv[256] = {
-    0,     0,     0,     0,     0,     0,     0,     0, /*   8 */
-    0,     0,     0,     0,     0,     0,     0,     0, /*  16 */
-    0,     0,     1,     1,     1,     1,     1,     1, /*  24 */
-    1,     1,     1,     1,     1,     1,     1,     1, /*  32 */
-    1,     1,     1,     1,     1,     1,     1,     1, /*  40 */
-    1,     1,     2,     2,     2,     2,     2,     2, /*  48 */
-    2,     2,     2,     2,     2,     2,     2,     2, /*  56 */
-    2,     3,     3,     3,     3,     3,     3,     3, /*  64 */
-    3,     3,     3,     3,     3,     4,     4,     4, /*  72 */
-    4,     4,     4,     4,     4,     4,     5,     5, /*  80 */
-    5,     5,     5,     5,     5,     5,     6,     6, /*  88 */
-    6,     6,     6,     6,     6,     7,     7,     7, /*  96 */
-    7,     7,     8,     8,     8,     8,     8,     9, /* 104 */
-    9,     9,     9,     9,    10,    10,    10,    10, /* 112 */
-   11,    11,    11,    11,    12,    12,    12,    12, /* 120 */
-   13,    13,    13,    14,    14,    14,    15,    15, /* 128 */
-   15,    16,    16,    16,    17,    17,    18,    18, /* 136 */
-   18,    19,    19,    20,    20,    21,    21,    22, /* 144 */
-   22,    23,    23,    24,    24,    25,    25,    26, /* 152 */
-   26,    27,    28,    28,    29,    30,    30,    31, /* 160 */
-   32,    32,    33,    34,    35,    35,    36,    37, /* 168 */
-   38,    39,    40,    40,    41,    42,    43,    44, /* 176 */
-   45,    46,    47,    48,    49,    51,    52,    53, /* 184 */
-   54,    55,    56,    58,    59,    60,    62,    63, /* 192 */
-   64,    66,    67,    69,    70,    72,    73,    75, /* 200 */
-   77,    78,    80,    82,    84,    86,    88,    90, /* 208 */
-   91,    94,    96,    98,   100,   102,   104,   107, /* 216 */
-  109,   111,   114,   116,   119,   122,   124,   127, /* 224 */
-  130,   133,   136,   139,   142,   145,   148,   151, /* 232 */
-  155,   158,   161,   165,   169,   172,   176,   180, /* 240 */
-  184,   188,   192,   196,   201,   205,   210,   214, /* 248 */
-  219,   224,   229,   234,   239,   244,   250,   255, /* 256 */
-};
-
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static int hdaCodecToAudVolume(PHDACODEC pThis, AMPLIFIER *pAmp, PDMAUDIOMIXERCTL mt)
+#else
 static int hdaCodecToAudVolume(AMPLIFIER *pAmp, audmixerctl_t mt)
+#endif
 {
     uint32_t dir = AMPLIFIER_OUT;
+    ENMSOUNDSOURCE enmSrc;
     switch (mt)
     {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        case PDMAUDIOMIXERCTL_PCM:
+            enmSrc = PO_INDEX;
+#else
         case AUD_MIXER_VOLUME:
         case AUD_MIXER_PCM:
+#endif
             dir = AMPLIFIER_OUT;
             break;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        case PDMAUDIOMIXERCTL_LINE_IN:
+            enmSrc = PI_INDEX;
+#else
         case AUD_MIXER_LINE_IN:
+#endif
             dir = AMPLIFIER_IN;
             break;
+        default:
+            AssertMsgFailedReturn(("Invalid mixer control %ld\n", mt), VERR_INVALID_PARAMETER);
+            break;
     }
+
     int mute = AMPLIFIER_REGISTER(*pAmp, dir, AMPLIFIER_LEFT, 0) & RT_BIT(7);
     mute |= AMPLIFIER_REGISTER(*pAmp, dir, AMPLIFIER_RIGHT, 0) & RT_BIT(7);
     mute >>=7;
@@ -1226,17 +1205,20 @@ static int hdaCodecToAudVolume(AMPLIFIER *pAmp, audmixerctl_t mt)
     uint8_t lVol = AMPLIFIER_REGISTER(*pAmp, dir, AMPLIFIER_LEFT, 0) & 0x7f;
     uint8_t rVol = AMPLIFIER_REGISTER(*pAmp, dir, AMPLIFIER_RIGHT, 0) & 0x7f;
 
-    /* The HDA codec has a 0 to -96dB range in 128 steps. We have a 0 to -46dB
-     * range in 256 steps. Adjust the volume control.
+    /* The STAC9220 volume controls have 0 to -96dB attenuation range in 128 steps.
+     * We have 0 to -96dB range in 256 steps. HDA volume setting of 127 must map
+     * to 255 internally (0dB), while HDA volume setting of 0 (-96dB) should map
+     * to 1 (rather than zero) internally.
      */
-    uint8_t lAdjVol = 255 - (lVol < 64 ? 254 : (127 - lVol) * 4);
-    uint8_t rAdjVol = 255 - (rVol < 64 ? 254 : (127 - rVol) * 4);
-    /* The internal volume control isn't logarithmic. Try to fudge things a bit. */
-    uint8_t lMixVol = aVolConv[lAdjVol];
-    uint8_t rMixVol = aVolConv[rAdjVol];
-    LogFlowFunc(("mt=%ld, lVol=%RU8, rVol=%RU8, lMixVol=%RU8, rMixVol=%RU8\n", mt, lVol, rVol, lMixVol, rMixVol));
-
-    AUD_set_volume(mt, &mute, &lMixVol, &rMixVol);
+    lVol = (lVol + 1) * (2 * 255) / 256;
+    rVol = (rVol + 1) * (2 * 255) / 256;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /** @todo In SetVolume no passing audmixerctl_in as its not used in DrvAudio.cpp. */
+    pThis->pfnSetVolume(pThis->pHDAState, enmSrc, RT_BOOL(mute), lVol, rVol);
+#else
+    AUD_set_volume(mt, &mute, &lVol, &rVol);
+#endif
     return VINF_SUCCESS;
 }
 
@@ -1264,7 +1246,7 @@ DECLINLINE(void) hdaCodecSetRegisterU16(uint32_t *pu32Reg, uint32_t u32Cmd, uint
 
 static DECLCALLBACK(int) vrbProcUnimplemented(PHDACODEC pThis, uint32_t cmd, uint64_t *pResp)
 {
-    Log(("vrbProcUnimplemented: cmd(raw:%x: cad:%x, d:%c, nid:%x, verb:%x)\n", cmd,
+    LogFlowFunc(("cmd(raw:%x: cad:%x, d:%c, nid:%x, verb:%x)\n", cmd,
         CODEC_CAD(cmd), CODEC_DIRECT(cmd) ? 'N' : 'Y', CODEC_NID(cmd), CODEC_VERBDATA(cmd)));
     *pResp = 0;
     return VINF_SUCCESS;
@@ -1285,7 +1267,7 @@ static DECLCALLBACK(int) vrbProcGetAmplifier(PHDACODEC pThis, uint32_t cmd, uint
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1340,7 +1322,7 @@ static DECLCALLBACK(int) vrbProcSetAmplifier(PHDACODEC pThis, uint32_t cmd, uint
     Assert(CODEC_CAD(cmd) == pThis->id);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1376,7 +1358,12 @@ static DECLCALLBACK(int) vrbProcSetAmplifier(PHDACODEC pThis, uint32_t cmd, uint
         if (fIsRight)
             hdaCodecSetRegisterU8(&AMPLIFIER_REGISTER(*pAmplifier, AMPLIFIER_IN, AMPLIFIER_RIGHT, u8Index), cmd, 0);
 
+        /** @todo Fix ID of u8AdcVolsLineIn! */
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        hdaCodecToAudVolume(pThis, pAmplifier, PDMAUDIOMIXERCTL_LINE_IN);
+#else
         hdaCodecToAudVolume(pAmplifier, AUD_MIXER_LINE_IN);
+#endif
     }
     if (fIsOut)
     {
@@ -1385,7 +1372,12 @@ static DECLCALLBACK(int) vrbProcSetAmplifier(PHDACODEC pThis, uint32_t cmd, uint
         if (fIsRight)
             hdaCodecSetRegisterU8(&AMPLIFIER_REGISTER(*pAmplifier, AMPLIFIER_OUT, AMPLIFIER_RIGHT, u8Index), cmd, 0);
 
-        hdaCodecToAudVolume(pAmplifier, AUD_MIXER_PCM);
+        /** @todo Fix ID of u8DacLineOut! */
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        hdaCodecToAudVolume(pThis, pAmplifier, PDMAUDIOMIXERCTL_PCM);
+#else
+        hdaCodecToAudVolume(pAmplifier, AUD_MIXER_VOLUME);
+#endif
     }
 
     return VINF_SUCCESS;
@@ -1396,13 +1388,13 @@ static DECLCALLBACK(int) vrbProcGetParameter(PHDACODEC pThis, uint32_t cmd, uint
     Assert(CODEC_CAD(cmd) == pThis->id);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     Assert((cmd & CODEC_VERB_8BIT_DATA) < CODECNODE_F00_PARAM_LENGTH);
     if ((cmd & CODEC_VERB_8BIT_DATA) >= CODECNODE_F00_PARAM_LENGTH)
     {
-        Log(("HdaCodec: invalid F00 parameter %d\n", (cmd & CODEC_VERB_8BIT_DATA)));
+        LogFlowFunc(("invalid F00 parameter %d\n", (cmd & CODEC_VERB_8BIT_DATA)));
         return VINF_SUCCESS;
     }
     *pResp = pThis->paNodes[CODEC_NID(cmd)].node.au32F00_param[cmd & CODEC_VERB_8BIT_DATA];
@@ -1416,7 +1408,7 @@ static DECLCALLBACK(int) vrbProcGetConSelectCtrl(PHDACODEC pThis, uint32_t cmd,
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1439,7 +1431,7 @@ static DECLCALLBACK(int) vrbProcSetConSelectCtrl(PHDACODEC pThis, uint32_t cmd,
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1467,7 +1459,7 @@ static DECLCALLBACK(int) vrbProcGetPinCtrl(PHDACODEC pThis, uint32_t cmd, uint64
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1495,7 +1487,7 @@ static DECLCALLBACK(int) vrbProcSetPinCtrl(PHDACODEC pThis, uint32_t cmd, uint64
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1526,7 +1518,7 @@ static DECLCALLBACK(int) vrbProcGetUnsolicitedEnabled(PHDACODEC pThis, uint32_t
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1554,7 +1546,7 @@ static DECLCALLBACK(int) vrbProcSetUnsolicitedEnabled(PHDACODEC pThis, uint32_t
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1584,7 +1576,7 @@ static DECLCALLBACK(int) vrbProcGetPinSense(PHDACODEC pThis, uint32_t cmd, uint6
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1604,7 +1596,7 @@ static DECLCALLBACK(int) vrbProcSetPinSense(PHDACODEC pThis, uint32_t cmd, uint6
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1626,13 +1618,13 @@ static DECLCALLBACK(int) vrbProcGetConnectionListEntry(PHDACODEC pThis, uint32_t
     *pResp = 0;
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     Assert((cmd & CODEC_VERB_8BIT_DATA) < CODECNODE_F02_PARAM_LENGTH);
     if ((cmd & CODEC_VERB_8BIT_DATA) >= CODECNODE_F02_PARAM_LENGTH)
     {
-        Log(("HdaCodec: access to invalid F02 index %d\n", (cmd & CODEC_VERB_8BIT_DATA)));
+        LogFlowFunc(("access to invalid F02 index %d\n", (cmd & CODEC_VERB_8BIT_DATA)));
         return VINF_SUCCESS;
     }
     *pResp = pThis->paNodes[CODEC_NID(cmd)].node.au32F02_param[cmd & CODEC_VERB_8BIT_DATA];
@@ -1646,7 +1638,7 @@ static DECLCALLBACK(int) vrbProcGetProcessingState(PHDACODEC pThis, uint32_t cmd
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1662,7 +1654,7 @@ static DECLCALLBACK(int) vrbProcSetProcessingState(PHDACODEC pThis, uint32_t cmd
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1678,7 +1670,7 @@ static DECLCALLBACK(int) vrbProcGetDigitalConverter(PHDACODEC pThis, uint32_t cm
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1695,7 +1687,7 @@ static int codecSetDigitalConverter(PHDACODEC pThis, uint32_t cmd, uint8_t u8Off
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1725,7 +1717,7 @@ static DECLCALLBACK(int) vrbProcGetSubId(PHDACODEC pThis, uint32_t cmd, uint64_t
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     if (CODEC_NID(cmd) == 1 /* AFG */)
@@ -1741,7 +1733,7 @@ static int codecSetSubIdX(PHDACODEC pThis, uint32_t cmd, uint8_t u8Offset)
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     uint32_t *pu32Reg;
@@ -1789,14 +1781,14 @@ static DECLCALLBACK(int) vrbProcReset(PHDACODEC pThis, uint32_t cmd, uint64_t *p
         && pThis->pfnCodecNodeReset)
     {
         uint8_t i;
-        Log(("HdaCodec: enters reset\n"));
+        LogFlowFunc(("enters reset\n"));
         Assert(pThis->pfnCodecNodeReset);
         for (i = 0; i < pThis->cTotalNodes; ++i)
         {
             pThis->pfnCodecNodeReset(pThis, i, &pThis->paNodes[i]);
         }
         pThis->fInReset = false;
-        Log(("HdaCodec: exits reset\n"));
+        LogFlowFunc(("exits reset\n"));
     }
     *pResp = 0;
     return VINF_SUCCESS;
@@ -1809,7 +1801,7 @@ static DECLCALLBACK(int) vrbProcGetPowerState(PHDACODEC pThis, uint32_t cmd, uin
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1849,7 +1841,7 @@ static DECLCALLBACK(int) vrbProcSetPowerState(PHDACODEC pThis, uint32_t cmd, uin
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1915,7 +1907,7 @@ static DECLCALLBACK(int) vrbProcGetStreamId(PHDACODEC pThis, uint32_t cmd, uint6
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1938,7 +1930,7 @@ static DECLCALLBACK(int) vrbProcSetStreamId(PHDACODEC pThis, uint32_t cmd, uint6
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1965,7 +1957,7 @@ static DECLCALLBACK(int) vrbProcGetConverterFormat(PHDACODEC pThis, uint32_t cmd
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -1986,7 +1978,7 @@ static DECLCALLBACK(int) vrbProcSetConverterFormat(PHDACODEC pThis, uint32_t cmd
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -2008,7 +2000,7 @@ static DECLCALLBACK(int) vrbProcGetEAPD_BTLEnabled(PHDACODEC pThis, uint32_t cmd
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -2028,7 +2020,7 @@ static DECLCALLBACK(int) vrbProcSetEAPD_BTLEnabled(PHDACODEC pThis, uint32_t cmd
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
 
@@ -2054,7 +2046,7 @@ static DECLCALLBACK(int) vrbProcGetVolumeKnobCtrl(PHDACODEC pThis, uint32_t cmd,
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -2070,7 +2062,7 @@ static DECLCALLBACK(int) vrbProcSetVolumeKnobCtrl(PHDACODEC pThis, uint32_t cmd,
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     uint32_t *pu32Reg = NULL;
@@ -2090,7 +2082,7 @@ static DECLCALLBACK(int) vrbProcGetGPIOUnsolisted(PHDACODEC pThis, uint32_t cmd,
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -2107,7 +2099,7 @@ static DECLCALLBACK(int) vrbProcSetGPIOUnsolisted(PHDACODEC pThis, uint32_t cmd,
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     uint32_t *pu32Reg = NULL;
@@ -2127,7 +2119,7 @@ static DECLCALLBACK(int) vrbProcGetConfig(PHDACODEC pThis, uint32_t cmd, uint64_
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     *pResp = 0;
@@ -2152,7 +2144,7 @@ static int codecSetConfigX(PHDACODEC pThis, uint32_t cmd, uint8_t u8Offset)
     Assert(CODEC_NID(cmd) < pThis->cTotalNodes);
     if (CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
-        Log(("HdaCodec: invalid node address %d\n", CODEC_NID(cmd)));
+        LogFlowFunc(("invalid node address %d\n", CODEC_NID(cmd)));
         return VINF_SUCCESS;
     }
     uint32_t *pu32Reg = NULL;
@@ -2257,14 +2249,14 @@ static int codecLookup(PHDACODEC pThis, uint32_t cmd, PPFNHDACODECVERBPROCESSOR
 {
     Assert(CODEC_CAD(cmd) == pThis->id);
     if (hdaCodecIsReservedNode(pThis, CODEC_NID(cmd)))
-        Log(("HdaCodec: cmd %x was addressed to reserved node\n", cmd));
+        LogFlowFunc(("cmd %x was addressed to reserved node\n", cmd));
 
     if (   CODEC_VERBDATA(cmd) == 0
         || CODEC_NID(cmd) >= pThis->cTotalNodes)
     {
         *pfn = vrbProcUnimplemented;
         /// @todo r=michaln: There needs to be a counter to avoid log flooding (see e.g. DevRTC.cpp)
-        Log(("HdaCodec: cmd %x was ignored\n", cmd));
+        LogFlowFunc(("cmd %x was ignored\n", cmd));
         return VINF_SUCCESS;
     }
 
@@ -2278,10 +2270,11 @@ static int codecLookup(PHDACODEC pThis, uint32_t cmd, PPFNHDACODECVERBPROCESSOR
     }
 
     *pfn = vrbProcUnimplemented;
-    Log(("HdaCodec: callback for %x wasn't found\n", CODEC_VERBDATA(cmd)));
+    LogFlowFunc(("callback for %x wasn't found\n", CODEC_VERBDATA(cmd)));
     return VINF_SUCCESS;
 }
 
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
 static void pi_callback(void *opaque, int avail)
 {
     PHDACODEC pThis = (PHDACODEC)opaque;
@@ -2293,8 +2286,7 @@ static void po_callback(void *opaque, int avail)
     PHDACODEC pThis = (PHDACODEC)opaque;
     pThis->pfnTransfer(pThis, PO_INDEX, avail);
 }
-
-
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
 /*
  * APIs exposed to DevHDA.
@@ -2309,32 +2301,55 @@ static void po_callback(void *opaque, int avail)
  * @todo Probably passed settings should be verified (if AFG's declared proposed
  *       format) before enabling.
  */
-int hdaCodecOpenVoice(PHDACODEC pThis, ENMSOUNDSOURCE enmSoundSource, audsettings_t *pAudioSettings)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+int hdaCodecOpenStream(PHDACODEC pThis, ENMSOUNDSOURCE enmSoundSource, PPDMAUDIOSTREAMCFG pCfg)
+#else
+int hdaCodecOpenStream(PHDACODEC pThis, ENMSOUNDSOURCE enmSoundSource, audsettings_t *pAudioSettings)
+#endif
 {
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
     int rc;
-    Assert(pThis && pAudioSettings);
-    if (   !pThis
-        || !pAudioSettings)
-        return -1;
+
     switch (enmSoundSource)
     {
         case PI_INDEX:
-            pThis->SwVoiceIn = AUD_open_in(&pThis->card, pThis->SwVoiceIn, "hda.in", pThis, pi_callback, pAudioSettings);
-            rc = pThis->SwVoiceIn ? 0 : 1;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                rc = pThis->pfnOpenIn(pThis->pHDAState, "hda.in",
+                                      PDMAUDIORECSOURCE_LINE_IN, pCfg);
+#else
+                pThis->SwVoiceIn = AUD_open_in(&pThis->card, pThis->SwVoiceIn, "hda.in", pThis, pi_callback, pAudioSettings);
+                rc = pThis->SwVoiceIn ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
+#endif
             break;
+
         case PO_INDEX:
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            rc = pThis->pfnOpenOut(pThis->pHDAState, "hda.out", pCfg);
+#else
             pThis->SwVoiceOut = AUD_open_out(&pThis->card, pThis->SwVoiceOut, "hda.out", pThis, po_callback, pAudioSettings);
-            rc = pThis->SwVoiceOut ? 0 : 1;
+            rc = pThis->SwVoiceOut ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
+#endif
             break;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# ifdef VBOX_WITH_HDA_MIC_IN
+        case MC_INDEX:
+            rc = pThis->pfnOpenIn(pThis->pHDAState, "hda.mc",
+                                  PDMAUDIORECSOURCE_MIC, pCfg);
+            break;
+# endif
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
         default:
-            return -1;
+            AssertMsgFailed(("Index %ld not implemented\n", enmSoundSource));
+            rc = VERR_NOT_IMPLEMENTED;
     }
-    if (!rc)
-        LogRel(("HdaCodec: can't open %s fmt(freq: %d)\n", enmSoundSource == PI_INDEX? "in" : "out", pAudioSettings->freq));
+
+    LogFlowFuncLeaveRC(rc);
     return rc;
 }
 
-
 int hdaCodecSaveState(PHDACODEC pThis, PSSMHANDLE pSSM)
 {
     AssertLogRelMsgReturn(pThis->cTotalNodes == 0x1c, ("cTotalNodes=%#x, should be 0x1c", pThis->cTotalNodes),
@@ -2346,7 +2361,6 @@ int hdaCodecSaveState(PHDACODEC pThis, PSSMHANDLE pSSM)
     return VINF_SUCCESS;
 }
 
-
 int hdaCodecLoadState(PHDACODEC pThis, PSSMHANDLE pSSM, uint32_t uVersion)
 {
     PCSSMFIELD pFields;
@@ -2401,25 +2415,44 @@ int hdaCodecLoadState(PHDACODEC pThis, PSSMHANDLE pSSM, uint32_t uVersion)
      * Update stuff after changing the state.
      */
     if (hdaCodecIsDacNode(pThis, pThis->u8DacLineOut))
-        hdaCodecToAudVolume(&pThis->paNodes[pThis->u8DacLineOut].dac.B_params, AUD_MIXER_PCM);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        hdaCodecToAudVolume(pThis, &pThis->paNodes[pThis->u8DacLineOut].dac.B_params, PDMAUDIOMIXERCTL_PCM);
+#else
+        hdaCodecToAudVolume(&pThis->paNodes[pThis->u8DacLineOut].dac.B_params, AUD_MIXER_VOLUME);
+#endif
     else if (hdaCodecIsSpdifOutNode(pThis, pThis->u8DacLineOut))
-        hdaCodecToAudVolume(&pThis->paNodes[pThis->u8DacLineOut].spdifout.B_params, AUD_MIXER_PCM);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        hdaCodecToAudVolume(pThis, &pThis->paNodes[pThis->u8DacLineOut].spdifout.B_params, PDMAUDIOMIXERCTL_PCM);
+    hdaCodecToAudVolume(pThis, &pThis->paNodes[pThis->u8AdcVolsLineIn].adcvol.B_params, PDMAUDIOMIXERCTL_LINE_IN);
+#else
+        hdaCodecToAudVolume(&pThis->paNodes[pThis->u8DacLineOut].spdifout.B_params, AUD_MIXER_VOLUME);
     hdaCodecToAudVolume(&pThis->paNodes[pThis->u8AdcVolsLineIn].adcvol.B_params, AUD_MIXER_LINE_IN);
+#endif
 
     return VINF_SUCCESS;
 }
 
-
 int hdaCodecDestruct(PHDACODEC pThis)
 {
-    RTMemFree(pThis->paNodes);
-    pThis->paNodes = NULL;
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    if (pThis->paNodes)
+    {
+        RTMemFree(pThis->paNodes);
+        pThis->paNodes = NULL;
+    }
+
     return VINF_SUCCESS;
 }
 
-
-int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PCFGMNODE pCfg)
+int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis,
+                      uint16_t uLUN, PCFGMNODE pCfg)
 {
+    AssertPtrReturn(pDevIns, VERR_INVALID_POINTER);
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    pThis->id        = uLUN;
     pThis->paVerbs   = &g_aCodecVerbs[0];
     pThis->cVerbs    = RT_ELEMENTS(g_aCodecVerbs);
     pThis->pfnLookup = codecLookup;
@@ -2434,8 +2467,15 @@ int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PCFGMNODE pCfg)
     pThis->paNodes[1].node.au32F00_param[5] = CODEC_MAKE_F00_05(1, CODEC_F00_05_AFG);
     pThis->paNodes[1].afg.u32F20_param = CODEC_MAKE_F20(pThis->u16VendorId, pThis->u8BSKU, pThis->u8AssemblyId);
 
-    /// @todo r=michaln: Was this meant to be 'HDA' or something like that? (AC'97 was on ICH0)
-    AUD_register_card ("ICH0", &pThis->card);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /* 44.1 kHz. */
+    PDMAUDIOSTREAMCFG as;
+    as.uHz           = 44100;
+    as.cChannels     = 2;
+    as.enmFormat     = AUD_FMT_S16;
+    as.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+#else
+    AUD_register_card("ICH0", &pThis->card);
 
     /* 44.1 kHz */
     audsettings_t as;
@@ -2443,24 +2483,36 @@ int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PCFGMNODE pCfg)
     as.nchannels = 2;
     as.fmt = AUD_FMT_S16;
     as.endianness = 0;
+#endif
 
     pThis->paNodes[1].node.au32F00_param[0xA] = CODEC_F00_0A_16_BIT;
-    hdaCodecOpenVoice(pThis, PI_INDEX, &as);
-    hdaCodecOpenVoice(pThis, PO_INDEX, &as);
+
+    hdaCodecOpenStream(pThis, PI_INDEX, &as);
+    hdaCodecOpenStream(pThis, PO_INDEX, &as);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# ifdef VBOX_WITH_HDA_MIC_IN
+    hdaCodecOpenStream(pThis, MC_INDEX, &as);
+# endif
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
     pThis->paNodes[1].node.au32F00_param[0xA] |= CODEC_F00_0A_44_1KHZ;
 
     uint8_t i;
     Assert(pThis->paNodes);
     Assert(pThis->pfnCodecNodeReset);
+
     for (i = 0; i < pThis->cTotalNodes; ++i)
-    {
         pThis->pfnCodecNodeReset(pThis, i, &pThis->paNodes[i]);
-    }
 
-    hdaCodecToAudVolume(&pThis->paNodes[pThis->u8DacLineOut].dac.B_params, AUD_MIXER_PCM);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    hdaCodecToAudVolume(pThis, &pThis->paNodes[pThis->u8DacLineOut].dac.B_params, PDMAUDIOMIXERCTL_PCM);
+    hdaCodecToAudVolume(pThis, &pThis->paNodes[pThis->u8AdcVolsLineIn].adcvol.B_params, PDMAUDIOMIXERCTL_LINE_IN);
+
+
+#else
+    hdaCodecToAudVolume(&pThis->paNodes[pThis->u8DacLineOut].dac.B_params, AUD_MIXER_VOLUME);
     hdaCodecToAudVolume(&pThis->paNodes[pThis->u8AdcVolsLineIn].adcvol.B_params, AUD_MIXER_LINE_IN);
 
-    /* If no host voices were created, then fallback to nul audio. */
     if (!AUD_is_host_voice_in_ok(pThis->SwVoiceIn))
         LogRel (("HDA: WARNING: Unable to open PCM IN!\n"));
     if (!AUD_is_host_voice_out_ok(pThis->SwVoiceOut))
@@ -2469,11 +2521,12 @@ int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PCFGMNODE pCfg)
     if (   !AUD_is_host_voice_in_ok(pThis->SwVoiceIn)
         && !AUD_is_host_voice_out_ok(pThis->SwVoiceOut))
     {
-        /* Was not able initialize *any* voice. Select the NULL audio driver instead */
-        AUD_close_in  (&pThis->card, pThis->SwVoiceIn);
-        AUD_close_out (&pThis->card, pThis->SwVoiceOut);
+        AUD_close_in(&pThis->card, pThis->SwVoiceIn);
+        AUD_close_out(&pThis->card, pThis->SwVoiceOut);
+
         pThis->SwVoiceOut = NULL;
         pThis->SwVoiceIn = NULL;
+
         AUD_init_null ();
 
         PDMDevHlpVMSetRuntimeError (pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
@@ -2485,6 +2538,7 @@ int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PCFGMNODE pCfg)
     {
         char   szMissingVoices[128];
         size_t len = 0;
+
         if (!AUD_is_host_voice_in_ok(pThis->SwVoiceIn))
             len = RTStrPrintf (szMissingVoices, sizeof(szMissingVoices), "PCM_in");
         if (!AUD_is_host_voice_out_ok(pThis->SwVoiceOut))
@@ -2496,6 +2550,7 @@ int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PCFGMNODE pCfg)
                 "is working properly. Check the logfile for error messages of the audio "
                 "subsystem"), szMissingVoices);
     }
+#endif
 
     return VINF_SUCCESS;
 }
diff --git a/src/VBox/Devices/Audio/DevIchHdaCodec.h b/src/VBox/Devices/Audio/DevIchHdaCodec.h
index 384bef9..d5d62a9 100644
--- a/src/VBox/Devices/Audio/DevIchHdaCodec.h
+++ b/src/VBox/Devices/Audio/DevIchHdaCodec.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,10 +18,15 @@
 #ifndef DEV_CODEC_H
 #define DEV_CODEC_H
 
+/** The ICH HDA (Intel) controller. */
+typedef struct HDASTATE *PHDASTATE;
 /** The ICH HDA (Intel) codec state. */
-typedef struct HDACODEC HDACODEC;
-/** Pointer to the Intel ICH HDA codec state. */
-typedef HDACODEC *PHDACODEC;
+typedef struct HDACODEC HDACODEC, *PHDACODEC;
+/** The HDA host driver backend. */
+typedef struct HDADRIVER HDADRIVER, *PHDADRIVER;
+typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
+typedef struct PDMAUDIOGSTSTRMOUT *PPDMAUDIOGSTSTRMOUT;
+typedef struct PDMAUDIOGSTSTRMIN  *PPDMAUDIOGSTSTRMIN;
 
 /**
  * Verb processor method.
@@ -63,7 +68,6 @@ typedef enum
     LAST_INDEX
 } ENMSOUNDSOURCE;
 
-
 typedef struct HDACODEC
 {
     uint16_t                id;
@@ -71,6 +75,11 @@ typedef struct HDACODEC
     uint16_t                u16DeviceId;
     uint8_t                 u8BSKU;
     uint8_t                 u8AssemblyId;
+    /* List of assigned HDA drivers to this codec.
+     * A driver only can be assigned to one codec
+     * at a time. */
+    RTLISTANCHOR            lstDrv;
+
 #ifndef VBOX_WITH_HDA_CODEC_EMU
     CODECVERB const        *paVerbs;
     int                     cVerbs;
@@ -78,47 +87,62 @@ typedef struct HDACODEC
     PCODECEMU               pCodecBackend;
 #endif
     PCODECNODE              paNodes;
-    QEMUSoundCard           card;
-    /** PCM in */
-    SWVoiceIn               *SwVoiceIn;
-    /** PCM out */
-    SWVoiceOut              *SwVoiceOut;
-    void                   *pvHDAState;
+    /** Pointer to HDA state (controller) this
+     *  codec is assigned to. */
+    PHDASTATE               pHDAState;
     bool                    fInReset;
 #ifndef VBOX_WITH_HDA_CODEC_EMU
     const uint8_t           cTotalNodes;
-    const uint8_t           *au8Ports;
-    const uint8_t           *au8Dacs;
-    const uint8_t           *au8AdcVols;
-    const uint8_t           *au8Adcs;
-    const uint8_t           *au8AdcMuxs;
-    const uint8_t           *au8Pcbeeps;
-    const uint8_t           *au8SpdifIns;
-    const uint8_t           *au8SpdifOuts;
-    const uint8_t           *au8DigInPins;
-    const uint8_t           *au8DigOutPins;
-    const uint8_t           *au8Cds;
-    const uint8_t           *au8VolKnobs;
-    const uint8_t           *au8Reserveds;
+    const uint8_t          *au8Ports;
+    const uint8_t          *au8Dacs;
+    const uint8_t          *au8AdcVols;
+    const uint8_t          *au8Adcs;
+    const uint8_t          *au8AdcMuxs;
+    const uint8_t          *au8Pcbeeps;
+    const uint8_t          *au8SpdifIns;
+    const uint8_t          *au8SpdifOuts;
+    const uint8_t          *au8DigInPins;
+    const uint8_t          *au8DigOutPins;
+    const uint8_t          *au8Cds;
+    const uint8_t          *au8VolKnobs;
+    const uint8_t          *au8Reserveds;
     const uint8_t           u8AdcVolsLineIn;
     const uint8_t           u8DacLineOut;
 #endif
-    DECLR3CALLBACKMEMBER(int, pfnProcess, (PHDACODEC pCodec));
-    DECLR3CALLBACKMEMBER(void, pfnTransfer, (PHDACODEC pCodec, ENMSOUNDSOURCE, int avail));
-    /* These callbacks are set by Codec implementation. */
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /* Callbacks to the HDA controller, mostly used for multiplexing to the various host backends. */
+    DECLR3CALLBACKMEMBER(void, pfnCloseIn, (PHDASTATE pThis, PDMAUDIORECSOURCE enmRecSource));
+    DECLR3CALLBACKMEMBER(void, pfnCloseOut, (PHDASTATE pThis));
+    DECLR3CALLBACKMEMBER(int, pfnOpenIn, (PHDASTATE pThis, const char *pszName, PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg));
+    DECLR3CALLBACKMEMBER(int, pfnOpenOut, (PHDASTATE pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg));
+    DECLR3CALLBACKMEMBER(int, pfnSetVolume, (PHDASTATE pThis, ENMSOUNDSOURCE enmSource, bool fMute, uint8_t uVolLeft, uint8_t uVolRight));
+#else
+    QEMUSoundCard           card;
+    /** PCM in */
+    SWVoiceIn              *SwVoiceIn;
+    /** PCM out */
+    SWVoiceOut             *SwVoiceOut;
+    /* Callbacks for host driver backends. */
+    DECLR3CALLBACKMEMBER(int, pfnTransfer, (PHDACODEC pCodec, ENMSOUNDSOURCE enmSource, uint32_t cbAvail));
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+    /* Callbacks by codec implementation. */
     DECLR3CALLBACKMEMBER(int, pfnLookup, (PHDACODEC pThis, uint32_t verb, PPFNHDACODECVERBPROCESSOR));
     DECLR3CALLBACKMEMBER(int, pfnReset, (PHDACODEC pThis));
     DECLR3CALLBACKMEMBER(int, pfnCodecNodeReset, (PHDACODEC pThis, uint8_t, PCODECNODE));
-    /* These callbacks are set by codec implementation to answer debugger requests. */
+    /* Callbacks by codec implementation to answer debugger requests. */
     DECLR3CALLBACKMEMBER(void, pfnCodecDbgListNodes, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
     DECLR3CALLBACKMEMBER(void, pfnCodecDbgSelector, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
 } CODECState;
 
-int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, PCFGMNODE pCfg);
+int hdaCodecConstruct(PPDMDEVINS pDevIns, PHDACODEC pThis, uint16_t uLUN, PCFGMNODE pCfg);
 int hdaCodecDestruct(PHDACODEC pThis);
 int hdaCodecSaveState(PHDACODEC pThis, PSSMHANDLE pSSM);
 int hdaCodecLoadState(PHDACODEC pThis, PSSMHANDLE pSSM, uint32_t uVersion);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+int hdaCodecOpenStream(PHDACODEC pThis, PDMAUDIORECSOURCE enmRecSource, PDMAUDIOSTREAMCFG *pAudioSettings);
+#else
 int hdaCodecOpenVoice(PHDACODEC pThis, ENMSOUNDSOURCE enmSoundSource, audsettings_t *pAudioSettings);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
 #define HDA_SSM_VERSION   4
 #define HDA_SSM_VERSION_1 1
@@ -135,3 +159,4 @@ struct CODECEMU
 };
 # endif
 #endif
+
diff --git a/src/VBox/Devices/Audio/DevSB16.cpp b/src/VBox/Devices/Audio/DevSB16.cpp
index 6c3f4be..c09f435 100644
--- a/src/VBox/Devices/Audio/DevSB16.cpp
+++ b/src/VBox/Devices/Audio/DevSB16.cpp
@@ -2,12 +2,22 @@
 /** @file
  * DevSB16 - VBox SB16 Audio Controller.
  *
- * (r3917 sb16.c)
- *
  * @todo hiccups on NT4 and Win98.
  */
 
 /*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on: sb16.c from QEMU AUDIO subsystem (r3917).
  * QEMU Soundblaster 16 emulation
  *
  * Copyright (c) 2003-2005 Vassili Karpov (malc)
@@ -31,72 +41,37 @@
  * THE SOFTWARE.
  */
 
-#define LOG_GROUP LOG_GROUP_DEV_AUDIO
-#include <VBox/vmm/pdmdev.h>
 #include <iprt/assert.h>
-#include <iprt/string.h>
-#include <iprt/uuid.h>
-#include "vl_vbox.h"
-
-extern "C" {
-#include "audio.h"
-}
-
-#ifndef VBOX
+#ifdef IN_RING3
+# include <iprt/mem.h>
+# include <iprt/string.h>
+# include <iprt/uuid.h>
+#endif
 
-#define LENOFA(a) ((int) (sizeof(a)/sizeof(a[0])))
+#include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pdmaudioifs.h>
 
-#define dolog(...) AUD_log ("sb16", __VA_ARGS__)
+#include "VBoxDD.h"
 
-/* #define DEBUG */
-/* #define DEBUG_SB16_MOST */
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
 
-#ifdef DEBUG
-#define ldebug(...) dolog (__VA_ARGS__)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# include "AudioMixer.h"
 #else
-#define ldebug(...)
+ extern "C" {
+  #include "audio.h"
+ }
 #endif
 
-#else /* VBOX */
-
 /** Current saved state version. */
 #define SB16_SAVE_STATE_VERSION         2
-/** The version used in VirtualBox version 3.0 and earlier. This didn't include
- * the config dump. */
+/** The version used in VirtualBox version 3.0 and earlier. This didn't include the config dump. */
 #define SB16_SAVE_STATE_VERSION_VBOX_30 1
 
-DECLINLINE(void) dolog (const char *fmt, ...)
-{
-    va_list ap;
-    va_start (ap, fmt);
-    AUD_vlog ("sb16", fmt, ap);
-    va_end (ap);
-}
-
-# ifdef DEBUG
-static void ldebug (const char *fmt, ...)
-{
-    va_list ap;
-
-    va_start (ap, fmt);
-    AUD_vlog ("sb16", fmt, ap);
-    va_end (ap);
-}
-# else
-DECLINLINE(void) ldebug (const char *fmt, ...)
-{
-    (void)fmt;
-}
-# endif
-
-#endif /* VBOX */
-
-#ifndef VBOX
-#define IO_READ_PROTO(name)                             \
-    uint32_t name (void *opaque, uint32_t nport)
-#define IO_WRITE_PROTO(name)                                    \
-    void name (void *opaque, uint32_t nport, uint32_t val)
-#else  /* VBOX */
 #define IO_READ_PROTO(name)                                             \
     DECLCALLBACK(int) name (PPDMDEVINS pDevIns, void *opaque,       \
                             RTIOPORT nport, uint32_t *pu32, unsigned cb)
@@ -104,30 +79,59 @@ DECLINLINE(void) ldebug (const char *fmt, ...)
 #define IO_WRITE_PROTO(name)                                            \
     DECLCALLBACK(int) name (PPDMDEVINS pDevIns, void *opaque,       \
                             RTIOPORT nport, uint32_t val, unsigned cb)
-#endif /* VBOX */
 
 static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.";
 
-#ifndef VBOX
-static struct {
-    int ver_lo;
-    int ver_hi;
-    int irq;
-    int dma;
-    int hdma;
-    int port;
-} conf = {5, 4, 5, 1, 5, 0x220};
-#endif /* !VBOX */
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+typedef struct SB16OUTPUTSTREAM
+{
+    /** PCM output stream. */
+    R3PTRTYPE(PPDMAUDIOGSTSTRMOUT)     pStrmOut;
+    /** Mixer handle for output stream. */
+    R3PTRTYPE(PAUDMIXSTREAM)           phStrmOut;
+} SB16OUTPUTSTREAM, *PSB16OUTPUTSTREAM;
 
-typedef struct SB16State {
+/**
+ * Struct for maintaining a host backend driver.
+ */
+typedef struct SB16STATE *PSB16STATE;
+typedef struct SB16DRIVER
+{
+    union
+    {
+        /** Node for storing this driver in our device driver
+         *  list of SB16STATE. */
+        RTLISTNODE                     Node;
+        struct
+        {
+            R3PTRTYPE(void *)          dummy1;
+            R3PTRTYPE(void *)          dummy2;
+        } dummy;
+    };
+
+    /** Pointer to SB16 controller (state). */
+    R3PTRTYPE(PSB16STATE)              pSB16State;
+    /** Driver flags. */
+    PDMAUDIODRVFLAGS                   Flags;
+    uint32_t                           PaddingFlags;
+    /** LUN # to which this driver has been assigned. */
+    uint8_t                            uLUN;
+    uint8_t                            Padding[5];
+    /** Audio connector interface to the underlying
+     *  host backend. */
+    R3PTRTYPE(PPDMIAUDIOCONNECTOR)     pConnector;
+    /** Stream for output. */
+    SB16OUTPUTSTREAM                   Out;
+} SB16DRIVER, *PSB16DRIVER;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+typedef struct SB16STATE
+{
 #ifdef VBOX
-    PPDMDEVINSR3 pDevIns;
-#endif
-    QEMUSoundCard card;
-#ifndef VBOX
-    qemu_irq *pic;
-#endif
-#ifdef VBOX /* lazy bird */
+    /** Pointer to the device instance. */
+    PPDMDEVINSR3        pDevIns;
+    /** Pointer to the connector of the attached audio driver. */
+    PPDMIAUDIOCONNECTOR pDrv;
     int irqCfg;
     int dmaCfg;
     int hdmaCfg;
@@ -145,7 +149,12 @@ typedef struct SB16State {
     int fmt_stereo;
     int fmt_signed;
     int fmt_bits;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PDMAUDIOFMT fmt;
+#else
     audfmt_e fmt;
+    QEMUSoundCard card;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
     int dma_auto;
     int block_size;
     int fifo;
@@ -156,7 +165,7 @@ typedef struct SB16State {
     int cmd;
     int use_hdma;
     int highspeed;
-    int can_write;
+    int can_write; /** @todo Value never gets 0? */
 
     int v2x6;
 
@@ -175,689 +184,803 @@ typedef struct SB16State {
     uint8_t last_read_byte;
     int nzero;
 
-    int left_till_irq;
+    int left_till_irq; /** Note: Can be < 0. */
 
     int dma_running;
     int bytes_per_second;
     int align;
-    int audio_free;
-    SWVoiceOut *voice;
 
-#ifndef VBOX
-    QEMUTimer *aux_ts;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    RTLISTANCHOR                   lstDrv;
+    /** The device' software mixer. */
+    R3PTRTYPE(PAUDIOMIXER)         pMixer;
+    /** Audio sink for PCM output. */
+    R3PTRTYPE(PAUDMIXSINK)         pSinkOutput;
+    /** The emulation timer for handling I/O of the attached LUN drivers. */
+    PTMTIMERR3                     pTimerIO;
+    /** Timer ticks for handling the LUN drivers. */
+    uint64_t                       uTicksIO;
 #else
-    PTMTIMER  pTimer;
+    uint32_t audio_free;
+    SWVoiceOut *voice;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    PTMTIMER  pTimerIRQ;
     PPDMIBASE pDrvBase;
     /** LUN\#0: Base interface. */
     PDMIBASE  IBase;
-#endif
+
     /* mixer state */
     int mixer_nreg;
     uint8_t mixer_regs[256];
-} SB16State;
+} SB16STATE, *PSB16STATE;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static int sb16OpenOut(PSB16STATE pThis, PPDMAUDIOSTREAMCFG pCfg);
+#endif
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+/**
+ * Attach command.
+ *
+ * This is called to let the device attach to a driver for a specified LUN
+ * during runtime. This is not called during VM construction, the device
+ * constructor have to attach to all the available drivers.
+ *
+ * @returns VBox status code.
+ * @param   pDevIns     The device instance.
+ * @param   uLUN        The logical unit which is being detached.
+ * @param   fFlags      Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
+ */
+static DECLCALLBACK(int) sb16Attach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
+{
+    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
+
+    AssertMsgReturn(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
+                    ("AC'97 device does not support hotplugging\n"),
+                    VERR_INVALID_PARAMETER);
+
+    /*
+     * Attach driver.
+     */
+    char *pszDesc = NULL;
+    if (RTStrAPrintf(&pszDesc, "Audio driver port (SB16) for LUN #%u", uLUN) <= 0)
+        AssertMsgReturn(pszDesc,
+                        ("Not enough memory for SB16 driver port description of LUN #%u\n", uLUN),
+                        VERR_NO_MEMORY);
+
+    int rc = PDMDevHlpDriverAttach(pDevIns, uLUN,
+                                   &pThis->IBase, &pThis->pDrvBase, pszDesc);
+    if (RT_SUCCESS(rc))
+    {
+        PSB16DRIVER pDrv = (PSB16DRIVER)RTMemAllocZ(sizeof(SB16DRIVER));
+        if (pDrv)
+        {
+            pDrv->pConnector = PDMIBASE_QUERY_INTERFACE(pThis->pDrvBase, PDMIAUDIOCONNECTOR);
+            AssertMsg(pDrv->pConnector != NULL,
+                      ("Configuration error: LUN #%u has no host audio interface, rc=%Rrc\n",
+                      uLUN, rc));
+            pDrv->pSB16State = pThis;
+            pDrv->uLUN = uLUN;
+
+            /*
+             * For now we always set the driver at LUN 0 as our primary
+             * host backend. This might change in the future.
+             */
+            if (pDrv->uLUN == 0)
+                pDrv->Flags |= PDMAUDIODRVFLAG_PRIMARY;
+
+            LogFunc(("LUN#%RU8: pCon=%p, drvFlags=0x%x\n", uLUN, pDrv->pConnector, pDrv->Flags));
+
+            /* Attach to driver list. */
+            RTListAppend(&pThis->lstDrv, &pDrv->Node);
+        }
+        else
+            rc = VERR_NO_MEMORY;
+    }
+    else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
+    {
+        LogFunc(("No attached driver for LUN #%u\n", uLUN));
+    }
+    else if (RT_FAILURE(rc))
+        AssertMsgFailed(("Failed to attach SB16 LUN #%u (\"%s\"), rc=%Rrc\n",
+                        uLUN, pszDesc, rc));
+
+    RTStrFree(pszDesc);
 
-static void SB_audio_callback (void *opaque, int free);
+    LogFunc(("iLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));
+    return rc;
+}
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static void sb16AudioCallback(void *pvContext, uint32_t cbFree);
+#else
+static void sb16AudioCallback(void *pvContext, int cbFree);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
-static int magic_of_irq (int irq)
+static int magic_of_irq(int irq)
 {
-    switch (irq) {
-    case 5:
-        return 2;
-    case 7:
-        return 4;
-    case 9:
-        return 1;
-    case 10:
-        return 8;
-    default:
-        dolog ("bad irq %d\n", irq);
-        return 2;
+    switch (irq)
+    {
+        case 5:
+            return 2;
+        case 7:
+            return 4;
+        case 9:
+            return 1;
+        case 10:
+            return 8;
+        default:
+            break;
     }
+
+    LogFlowFunc(("bad irq %d\n", irq));
+    return 2;
 }
 
-static int irq_of_magic (int magic)
+static int irq_of_magic(int magic)
 {
-    switch (magic) {
-    case 1:
-        return 9;
-    case 2:
-        return 5;
-    case 4:
-        return 7;
-    case 8:
-        return 10;
-    default:
-        dolog ("bad irq magic %d\n", magic);
-        return -1;
+    switch (magic)
+    {
+        case 1:
+            return 9;
+        case 2:
+            return 5;
+        case 4:
+            return 7;
+        case 8:
+            return 10;
+        default:
+            break;
     }
+
+    LogFlowFunc(("bad irq magic %d\n", magic));
+    return -1;
 }
 
-#if 0
-static void log_dsp (SB16State *dsp)
+#ifdef DEBUG
+static inline void log_dsp(PSB16STATE pThis)
 {
-    ldebug ("%s:%s:%d:%s:dmasize=%d:freq=%d:const=%d:speaker=%d\n",
-            dsp->fmt_stereo ? "Stereo" : "Mono",
-            dsp->fmt_signed ? "Signed" : "Unsigned",
-            dsp->fmt_bits,
-            dsp->dma_auto ? "Auto" : "Single",
-            dsp->block_size,
-            dsp->freq,
-            dsp->time_const,
-            dsp->speaker);
+    LogFlowFunc(("%s:%s:%d:%s:dmasize=%d:freq=%d:const=%d:speaker=%d\n",
+                 pThis->fmt_stereo ? "Stereo" : "Mono",
+                 pThis->fmt_signed ? "Signed" : "Unsigned",
+                 pThis->fmt_bits,
+                 pThis->dma_auto ? "Auto" : "Single",
+                 pThis->block_size,
+                 pThis->freq,
+                 pThis->time_const,
+                 pThis->speaker));
 }
 #endif
 
-static void speaker (SB16State *s, int on)
+static void sb16SpeakerControl(PSB16STATE pThis, int on)
 {
-    s->speaker = on;
-    /* AUD_enable (s->voice, on); */
+    pThis->speaker = on;
+    /* AUD_enable (pThis->voice, on); */
 }
 
-static void control (SB16State *s, int hold)
+static void sb16Control(PSB16STATE pThis, int hold)
 {
-    int dma = s->use_hdma ? s->hdma : s->dma;
-    s->dma_running = hold;
+    int dma = pThis->use_hdma ? pThis->hdma : pThis->dma;
+    pThis->dma_running = hold;
 
-    ldebug ("hold %d high %d dma %d\n", hold, s->use_hdma, dma);
+    LogFlowFunc(("hold %d high %d dma %d\n", hold, pThis->use_hdma, dma));
 
-#ifndef VBOX
-    if (hold) {
-        DMA_hold_DREQ (dma);
-        AUD_set_active_out (s->voice, 1);
-    }
-    else {
-        DMA_release_DREQ (dma);
-        AUD_set_active_out (s->voice, 0);
-    }
-#else  /* VBOX */
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PSB16DRIVER pDrv;
+# endif
     if (hold)
     {
-        PDMDevHlpDMASetDREQ (s->pDevIns, dma, 1);
-        PDMDevHlpDMASchedule (s->pDevIns);
-        AUD_set_active_out (s->voice, 1);
+        PDMDevHlpDMASetDREQ (pThis->pDevIns, dma, 1);
+        PDMDevHlpDMASchedule (pThis->pDevIns);
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+            pDrv->pConnector->pfnEnableOut(pDrv->pConnector,
+                                           pDrv->Out.pStrmOut, true /* fEnable */);
+# else
+        AUD_set_active_out (pThis->voice, 1);
+# endif
     }
     else
     {
-        PDMDevHlpDMASetDREQ (s->pDevIns, dma, 0);
-        AUD_set_active_out (s->voice, 0);
+        PDMDevHlpDMASetDREQ (pThis->pDevIns, dma, 0);
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+            pDrv->pConnector->pfnEnableOut(pDrv->pConnector,
+                                           pDrv->Out.pStrmOut, false /* fEnable */);
+# else
+        AUD_set_active_out (pThis->voice, 0);
+# endif
     }
-#endif /* VBOX */
 }
 
-#ifndef VBOX
-static void aux_timer (void *opaque)
-{
-    SB16State *s = opaque;
-    s->can_write = 1;
-    qemu_irq_raise (s->pic[s->irq]);
-}
-#else  /* VBOX */
-static DECLCALLBACK(void) sb16Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvThis)
+static DECLCALLBACK(void) sb16TimerIRQ(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvThis)
 {
-    SB16State *s = (SB16State *)pvThis;
-    s->can_write = 1;
-    PDMDevHlpISASetIrq(s->pDevIns, s->irq, 1);
+    PSB16STATE pThis = (PSB16STATE)pvThis;
+    pThis->can_write = 1;
+    PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
 }
-#endif /* VBOX */
 
 #define DMA8_AUTO 1
 #define DMA8_HIGH 2
 
-static void continue_dma8 (SB16State *s)
+static void continue_dma8(PSB16STATE pThis)
 {
-    if (s->freq > 0) {
-        audsettings_t as;
-
-        s->audio_free = 0;
-
-        as.freq = s->freq;
-        as.nchannels = 1 << s->fmt_stereo;
-        as.fmt = s->fmt;
-        as.endianness = 0;
-
-        s->voice = AUD_open_out (
-            &s->card,
-            s->voice,
+    if (pThis->freq > 0)
+    {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        PDMAUDIOSTREAMCFG streamCfg;
+        streamCfg.uHz           = pThis->freq;
+        streamCfg.cChannels     = 1 << pThis->fmt_stereo;
+        streamCfg.enmFormat     = pThis->fmt;
+        streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+        int rc = sb16OpenOut(pThis, &streamCfg);
+        AssertRC(rc);
+#else
+        pThis->audio_free = 0;
+
+        audsettings_t streamCfg;
+        streamCfg.freq = pThis->freq;
+        streamCfg.nchannels = 1 << pThis->fmt_stereo;
+        streamCfg.fmt = pThis->fmt;
+        streamCfg.endianness = 0;
+        pThis->voice = AUD_open_out (
+            &pThis->card,
+            pThis->voice,
             "sb16",
-            s,
-            SB_audio_callback,
-            &as
+            pThis,
+            sb16AudioCallback,
+            &streamCfg
             );
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
     }
 
-    control (s, 1);
+    sb16Control(pThis, 1);
 }
 
-static void dma_cmd8 (SB16State *s, int mask, int dma_len)
+static void dma_cmd8(PSB16STATE pThis, int mask, int dma_len)
 {
-    s->fmt = AUD_FMT_U8;
-    s->use_hdma = 0;
-    s->fmt_bits = 8;
-    s->fmt_signed = 0;
-    s->fmt_stereo = (s->mixer_regs[0x0e] & 2) != 0;
-    if (-1 == s->time_const) {
-        if (s->freq <= 0)
-            s->freq = 11025;
+    pThis->fmt        = AUD_FMT_U8;
+    pThis->use_hdma   = 0;
+    pThis->fmt_bits   = 8;
+    pThis->fmt_signed = 0;
+    pThis->fmt_stereo = (pThis->mixer_regs[0x0e] & 2) != 0;
+
+    if (-1 == pThis->time_const)
+    {
+        if (pThis->freq <= 0)
+            pThis->freq = 11025;
     }
-    else {
-        int tmp = (256 - s->time_const);
-        s->freq = (1000000 + (tmp / 2)) / tmp;
+    else
+    {
+        int tmp = (256 - pThis->time_const);
+        pThis->freq = (1000000 + (tmp / 2)) / tmp;
     }
 
-    if (dma_len != -1) {
-        s->block_size = dma_len << s->fmt_stereo;
+    if (dma_len != -1)
+    {
+        pThis->block_size = dma_len << pThis->fmt_stereo;
     }
-    else {
+    else
+    {
         /* This is apparently the only way to make both Act1/PL
            and SecondReality/FC work
 
+           r=andy Wow, actually someone who remembers Future Crew :-)
+
            Act1 sets block size via command 0x48 and it's an odd number
            SR does the same with even number
            Both use stereo, and Creatives own documentation states that
            0x48 sets block size in bytes less one.. go figure */
-        s->block_size &= ~s->fmt_stereo;
+        pThis->block_size &= ~pThis->fmt_stereo;
     }
 
-    s->freq >>= s->fmt_stereo;
-    s->left_till_irq = s->block_size;
-    s->bytes_per_second = (s->freq << s->fmt_stereo);
-    /* s->highspeed = (mask & DMA8_HIGH) != 0; */
-    s->dma_auto = (mask & DMA8_AUTO) != 0;
-    s->align = (1 << s->fmt_stereo) - 1;
+    pThis->freq >>= pThis->fmt_stereo;
+    pThis->left_till_irq = pThis->block_size;
+    pThis->bytes_per_second = (pThis->freq << pThis->fmt_stereo);
+    /* pThis->highspeed = (mask & DMA8_HIGH) != 0; */
+    pThis->dma_auto = (mask & DMA8_AUTO) != 0;
+    pThis->align = (1 << pThis->fmt_stereo) - 1;
 
-    if (s->block_size & s->align) {
-        dolog ("warning: misaligned block size %d, alignment %d\n",
-               s->block_size, s->align + 1);
-    }
+    if (pThis->block_size & pThis->align)
+        LogFlowFunc(("warning: misaligned block size %d, alignment %d\n",
+                     pThis->block_size, pThis->align + 1));
 
-    ldebug ("freq %d, stereo %d, sign %d, bits %d, "
-            "dma %d, auto %d, fifo %d, high %d\n",
-            s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits,
-            s->block_size, s->dma_auto, s->fifo, s->highspeed);
+    LogFlowFunc(("freq %d, stereo %d, sign %d, bits %d, dma %d, auto %d, fifo %d, high %d\n",
+                 pThis->freq, pThis->fmt_stereo, pThis->fmt_signed, pThis->fmt_bits,
+                 pThis->block_size, pThis->dma_auto, pThis->fifo, pThis->highspeed));
 
-    continue_dma8 (s);
-    speaker (s, 1);
+    continue_dma8(pThis);
+    sb16SpeakerControl(pThis, 1);
 }
 
-static void dma_cmd (SB16State *s, uint8_t cmd, uint8_t d0, int dma_len)
+static void dma_cmd(PSB16STATE pThis, uint8_t cmd, uint8_t d0, int dma_len)
 {
-    s->use_hdma = cmd < 0xc0;
-    s->fifo = (cmd >> 1) & 1;
-    s->dma_auto = (cmd >> 2) & 1;
-    s->fmt_signed = (d0 >> 4) & 1;
-    s->fmt_stereo = (d0 >> 5) & 1;
-
-    switch (cmd >> 4) {
-    case 11:
-        s->fmt_bits = 16;
-        break;
-
-    case 12:
-        s->fmt_bits = 8;
-        break;
+    pThis->use_hdma   = cmd < 0xc0;
+    pThis->fifo       = (cmd >> 1) & 1;
+    pThis->dma_auto   = (cmd >> 2) & 1;
+    pThis->fmt_signed = (d0 >> 4) & 1;
+    pThis->fmt_stereo = (d0 >> 5) & 1;
+
+    switch (cmd >> 4)
+    {
+        case 11:
+            pThis->fmt_bits = 16;
+            break;
+
+        case 12:
+            pThis->fmt_bits = 8;
+            break;
     }
 
-    if (-1 != s->time_const) {
+    if (-1 != pThis->time_const)
+    {
 #if 1
-        int tmp = 256 - s->time_const;
-        s->freq = (1000000 + (tmp / 2)) / tmp;
+        int tmp = 256 - pThis->time_const;
+        pThis->freq = (1000000 + (tmp / 2)) / tmp;
 #else
-        /* s->freq = 1000000 / ((255 - s->time_const) << s->fmt_stereo); */
-        s->freq = 1000000 / ((255 - s->time_const));
+        /* pThis->freq = 1000000 / ((255 - pThis->time_const) << pThis->fmt_stereo); */
+        pThis->freq = 1000000 / ((255 - pThis->time_const));
 #endif
-        s->time_const = -1;
+        pThis->time_const = -1;
     }
 
-    s->block_size = dma_len + 1;
-    s->block_size <<= ((s->fmt_bits == 16) ? 1 : 0);
-    if (!s->dma_auto) {
-        /* It is clear that for DOOM and auto-init this value
-           shouldn't take stereo into account, while Miles Sound Systems
-           setsound.exe with single transfer mode wouldn't work without it
-           wonders of SB16 yet again */
-        s->block_size <<= s->fmt_stereo;
+    pThis->block_size = dma_len + 1;
+    pThis->block_size <<= ((pThis->fmt_bits == 16) ? 1 : 0);
+    if (!pThis->dma_auto)
+    {
+        /*
+         * It is clear that for DOOM and auto-init this value
+         * shouldn't take stereo into account, while Miles Sound Systems
+         * setsound.exe with single transfer mode wouldn't work without it
+         * wonders of SB16 yet again.
+         */
+        pThis->block_size <<= pThis->fmt_stereo;
     }
 
-    ldebug ("freq %d, stereo %d, sign %d, bits %d, "
-            "dma %d, auto %d, fifo %d, high %d\n",
-            s->freq, s->fmt_stereo, s->fmt_signed, s->fmt_bits,
-            s->block_size, s->dma_auto, s->fifo, s->highspeed);
+    LogFlowFunc(("freq %d, stereo %d, sign %d, bits %d, dma %d, auto %d, fifo %d, high %d\n",
+                 pThis->freq, pThis->fmt_stereo, pThis->fmt_signed, pThis->fmt_bits,
+                 pThis->block_size, pThis->dma_auto, pThis->fifo, pThis->highspeed));
 
-    if (16 == s->fmt_bits) {
-        if (s->fmt_signed) {
-            s->fmt = AUD_FMT_S16;
-        }
-        else {
-            s->fmt = AUD_FMT_U16;
-        }
-    }
-    else {
-        if (s->fmt_signed) {
-            s->fmt = AUD_FMT_S8;
-        }
-        else {
-            s->fmt = AUD_FMT_U8;
-        }
-    }
+    if (16 == pThis->fmt_bits)
+        pThis->fmt = pThis->fmt_signed ? AUD_FMT_S16 : AUD_FMT_U16;
+    else
+        pThis->fmt = pThis->fmt_signed ? AUD_FMT_S8 : AUD_FMT_U8;
 
-    s->left_till_irq = s->block_size;
+    pThis->left_till_irq = pThis->block_size;
 
-    s->bytes_per_second = (s->freq << s->fmt_stereo) << ((s->fmt_bits == 16) ? 1 : 0);
-    s->highspeed = 0;
-    s->align = (1 << (s->fmt_stereo + (s->fmt_bits == 16))) - 1;
-    if (s->block_size & s->align) {
-        dolog ("warning: misaligned block size %d, alignment %d\n",
-               s->block_size, s->align + 1);
+    pThis->bytes_per_second = (pThis->freq << pThis->fmt_stereo) << ((pThis->fmt_bits == 16) ? 1 : 0);
+    pThis->highspeed = 0;
+    pThis->align = (1 << (pThis->fmt_stereo + (pThis->fmt_bits == 16))) - 1;
+    if (pThis->block_size & pThis->align)
+    {
+        LogFlowFunc(("warning: misaligned block size %d, alignment %d\n",
+                     pThis->block_size, pThis->align + 1));
     }
 
-    if (s->freq) {
-        audsettings_t as;
-
-        s->audio_free = 0;
-
-        as.freq = s->freq;
-        as.nchannels = 1 << s->fmt_stereo;
-        as.fmt = s->fmt;
-        as.endianness = 0;
-
-        s->voice = AUD_open_out (
-            &s->card,
-            s->voice,
+    if (pThis->freq)
+    {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        PDMAUDIOSTREAMCFG streamCfg;
+        streamCfg.uHz           = pThis->freq;
+        streamCfg.cChannels     = 1 << pThis->fmt_stereo;
+        streamCfg.enmFormat     = pThis->fmt;
+        streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+        int rc = sb16OpenOut(pThis, &streamCfg);
+        AssertRC(rc);
+#else
+        pThis->audio_free = 0;
+
+        audsettings_t streamCfg;
+        streamCfg.freq = pThis->freq;
+        streamCfg.nchannels = 1 << pThis->fmt_stereo;
+        streamCfg.fmt = pThis->fmt;
+        streamCfg.endianness = 0;
+        pThis->voice = AUD_open_out (
+            &pThis->card,
+            pThis->voice,
             "sb16",
-            s,
-            SB_audio_callback,
-            &as
+            pThis,
+            sb16AudioCallback,
+            &streamCfg
             );
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
     }
 
-    control (s, 1);
-    speaker (s, 1);
+    sb16Control(pThis, 1);
+    sb16SpeakerControl(pThis, 1);
 }
 
-static inline void dsp_out_data (SB16State *s, uint8_t val)
+static inline void dsp_out_data (PSB16STATE pThis, uint8_t val)
 {
-    ldebug ("outdata %#x\n", val);
-    if ((size_t) s->out_data_len < sizeof (s->out_data)) {
-        s->out_data[s->out_data_len++] = val;
+    LogFlowFunc(("outdata %#x\n", val));
+    if ((size_t) pThis->out_data_len < sizeof (pThis->out_data)) {
+        pThis->out_data[pThis->out_data_len++] = val;
     }
 }
 
-static inline uint8_t dsp_get_data (SB16State *s)
+static inline uint8_t dsp_get_data (PSB16STATE pThis)
 {
-    if (s->in_index) {
-        return s->in2_data[--s->in_index];
+    if (pThis->in_index) {
+        return pThis->in2_data[--pThis->in_index];
     }
     else {
-        dolog ("buffer underflow\n");
+        LogFlowFunc(("buffer underflow\n"));
         return 0;
     }
 }
 
-static void command (SB16State *s, uint8_t cmd)
+static void sb16HandleCommand(PSB16STATE pThis, uint8_t cmd)
 {
-    ldebug ("command %#x\n", cmd);
+    LogFlowFunc(("command %#x\n", cmd));
 
-    if (cmd > 0xaf && cmd < 0xd0) {
-        if (cmd & 8) {
-            dolog ("ADC not yet supported (command %#x)\n", cmd);
-        }
+    if (cmd > 0xaf && cmd < 0xd0)
+    {
+        if (cmd & 8) /** @todo Handle recording. */
+            LogFlowFunc(("ADC not yet supported (command %#x)\n", cmd));
 
-        switch (cmd >> 4) {
-        case 11:
-        case 12:
-            break;
-        default:
-            dolog ("%#x wrong bits\n", cmd);
+        switch (cmd >> 4)
+        {
+            case 11:
+            case 12:
+                break;
+            default:
+                LogFlowFunc(("%#x wrong bits\n", cmd));
         }
-        s->needed_bytes = 3;
+
+        pThis->needed_bytes = 3;
     }
-    else {
-        s->needed_bytes = 0;
+    else
+    {
+        pThis->needed_bytes = 0;
 
-        switch (cmd) {
-        case 0x03:
-            dsp_out_data (s, 0x10); /* s->csp_param); */
-            goto warn;
+        switch (cmd)
+        {
+            case 0x03:
+                dsp_out_data(pThis, 0x10); /* pThis->csp_param); */
+                goto warn;
 
-        case 0x04:
-            s->needed_bytes = 1;
-            goto warn;
+            case 0x04:
+                pThis->needed_bytes = 1;
+                goto warn;
 
-        case 0x05:
-            s->needed_bytes = 2;
-            goto warn;
+            case 0x05:
+                pThis->needed_bytes = 2;
+                goto warn;
 
-        case 0x08:
-            /* __asm__ ("int3"); */
-            goto warn;
+            case 0x08:
+                /* __asm__ ("int3"); */
+                goto warn;
 
-        case 0x0e:
-            s->needed_bytes = 2;
-            goto warn;
+            case 0x0e:
+                pThis->needed_bytes = 2;
+                goto warn;
 
-        case 0x09:
-            dsp_out_data (s, 0xf8);
-            goto warn;
+            case 0x09:
+                dsp_out_data(pThis, 0xf8);
+                goto warn;
 
-        case 0x0f:
-            s->needed_bytes = 1;
-            goto warn;
+            case 0x0f:
+                pThis->needed_bytes = 1;
+                goto warn;
 
-        case 0x10:
-            s->needed_bytes = 1;
-            goto warn;
+            case 0x10:
+                pThis->needed_bytes = 1;
+                goto warn;
 
-        case 0x14:
-            s->needed_bytes = 2;
-            s->block_size = 0;
-            break;
+            case 0x14:
+                pThis->needed_bytes = 2;
+                pThis->block_size = 0;
+                break;
 
-        case 0x1c:              /* Auto-Initialize DMA DAC, 8-bit */
-            dma_cmd8 (s, DMA8_AUTO, -1);
-            break;
+            case 0x1c:              /* Auto-Initialize DMA DAC, 8-bit */
+                dma_cmd8(pThis, DMA8_AUTO, -1);
+                break;
 
-        case 0x20:              /* Direct ADC, Juice/PL */
-            dsp_out_data (s, 0xff);
-            goto warn;
+            case 0x20:              /* Direct ADC, Juice/PL */
+                dsp_out_data(pThis, 0xff);
+                goto warn;
 
-        case 0x35:
-            dolog ("0x35 - MIDI command not implemented\n");
-            break;
+            case 0x35:
+                LogFlowFunc(("0x35 - MIDI command not implemented\n"));
+                break;
 
-        case 0x40:
-            s->freq = -1;
-            s->time_const = -1;
-            s->needed_bytes = 1;
-            break;
+            case 0x40:
+                pThis->freq = -1;
+                pThis->time_const = -1;
+                pThis->needed_bytes = 1;
+                break;
 
-        case 0x41:
-            s->freq = -1;
-            s->time_const = -1;
-            s->needed_bytes = 2;
-            break;
+            case 0x41:
+                pThis->freq = -1;
+                pThis->time_const = -1;
+                pThis->needed_bytes = 2;
+                break;
 
-        case 0x42:
-            s->freq = -1;
-            s->time_const = -1;
-            s->needed_bytes = 2;
-            goto warn;
+            case 0x42:
+                pThis->freq = -1;
+                pThis->time_const = -1;
+                pThis->needed_bytes = 2;
+                goto warn;
 
-        case 0x45:
-            dsp_out_data (s, 0xaa);
-            goto warn;
+            case 0x45:
+                dsp_out_data(pThis, 0xaa);
+                goto warn;
 
-        case 0x47:                /* Continue Auto-Initialize DMA 16bit */
-            break;
+            case 0x47:                /* Continue Auto-Initialize DMA 16bit */
+                break;
 
-        case 0x48:
-            s->needed_bytes = 2;
-            break;
+            case 0x48:
+                pThis->needed_bytes = 2;
+                break;
 
-        case 0x74:
-            s->needed_bytes = 2; /* DMA DAC, 4-bit ADPCM */
-            dolog ("0x75 - DMA DAC, 4-bit ADPCM not implemented\n");
-            break;
+            case 0x74:
+                pThis->needed_bytes = 2; /* DMA DAC, 4-bit ADPCM */
+                LogFlowFunc(("0x75 - DMA DAC, 4-bit ADPCM not implemented\n"));
+                break;
 
-        case 0x75:              /* DMA DAC, 4-bit ADPCM Reference */
-            s->needed_bytes = 2;
-            dolog ("0x74 - DMA DAC, 4-bit ADPCM Reference not implemented\n");
-            break;
+            case 0x75:              /* DMA DAC, 4-bit ADPCM Reference */
+                pThis->needed_bytes = 2;
+                LogFlowFunc(("0x74 - DMA DAC, 4-bit ADPCM Reference not implemented\n"));
+                break;
 
-        case 0x76:              /* DMA DAC, 2.6-bit ADPCM */
-            s->needed_bytes = 2;
-            dolog ("0x74 - DMA DAC, 2.6-bit ADPCM not implemented\n");
-            break;
+            case 0x76:              /* DMA DAC, 2.6-bit ADPCM */
+                pThis->needed_bytes = 2;
+                LogFlowFunc(("0x74 - DMA DAC, 2.6-bit ADPCM not implemented\n"));
+                break;
 
-        case 0x77:              /* DMA DAC, 2.6-bit ADPCM Reference */
-            s->needed_bytes = 2;
-            dolog ("0x74 - DMA DAC, 2.6-bit ADPCM Reference not implemented\n");
-            break;
+            case 0x77:              /* DMA DAC, 2.6-bit ADPCM Reference */
+                pThis->needed_bytes = 2;
+                LogFlowFunc(("0x74 - DMA DAC, 2.6-bit ADPCM Reference not implemented\n"));
+                break;
 
-        case 0x7d:
-            dolog ("0x7d - Autio-Initialize DMA DAC, 4-bit ADPCM Reference\n");
-            dolog ("not implemented\n");
-            break;
+            case 0x7d:
+                LogFlowFunc(("0x7d - Autio-Initialize DMA DAC, 4-bit ADPCM Reference\n"));
+                LogFlowFunc(("not implemented\n"));
+                break;
 
-        case 0x7f:
-            dolog (
-                "0x7d - Autio-Initialize DMA DAC, 2.6-bit ADPCM Reference\n"
-                );
-            dolog ("not implemented\n");
-            break;
+            case 0x7f:
+                LogFlowFunc(("0x7d - Autio-Initialize DMA DAC, 2.6-bit ADPCM Reference\n"));
+                LogFlowFunc(("not implemented\n"));
+                break;
 
-        case 0x80:
-            s->needed_bytes = 2;
-            break;
+            case 0x80:
+                pThis->needed_bytes = 2;
+                break;
 
-        case 0x90:
-        case 0x91:
-            dma_cmd8 (s, (((cmd & 1) == 0) ? 1 : 0) | DMA8_HIGH, -1);
-            break;
+            case 0x90:
+            case 0x91:
+                dma_cmd8(pThis, (((cmd & 1) == 0) ? 1 : 0) | DMA8_HIGH, -1);
+                break;
 
-        case 0xd0:              /* halt DMA operation. 8bit */
-            control (s, 0);
-            break;
+            case 0xd0:              /* halt DMA operation. 8bit */
+                sb16Control(pThis, 0);
+                break;
 
-        case 0xd1:              /* speaker on */
-            speaker (s, 1);
-            break;
+            case 0xd1:              /* speaker on */
+                sb16SpeakerControl(pThis, 1);
+                break;
 
-        case 0xd3:              /* speaker off */
-            speaker (s, 0);
-            break;
+            case 0xd3:              /* speaker off */
+                sb16SpeakerControl(pThis, 0);
+                break;
 
-        case 0xd4:              /* continue DMA operation. 8bit */
-            /* KQ6 (or maybe Sierras audblst.drv in general) resets
-               the frequency between halt/continue */
-            continue_dma8 (s);
-            break;
+            case 0xd4:              /* continue DMA operation. 8bit */
+                /* KQ6 (or maybe Sierras audblst.drv in general) resets
+                   the frequency between halt/continue */
+                continue_dma8(pThis);
+                break;
 
-        case 0xd5:              /* halt DMA operation. 16bit */
-            control (s, 0);
-            break;
+            case 0xd5:              /* halt DMA operation. 16bit */
+                sb16Control(pThis, 0);
+                break;
 
-        case 0xd6:              /* continue DMA operation. 16bit */
-            control (s, 1);
-            break;
+            case 0xd6:              /* continue DMA operation. 16bit */
+                sb16Control(pThis, 1);
+                break;
 
-        case 0xd9:              /* exit auto-init DMA after this block. 16bit */
-            s->dma_auto = 0;
-            break;
+            case 0xd9:              /* exit auto-init DMA after this block. 16bit */
+                pThis->dma_auto = 0;
+                break;
 
-        case 0xda:              /* exit auto-init DMA after this block. 8bit */
-            s->dma_auto = 0;
-            break;
+            case 0xda:              /* exit auto-init DMA after this block. 8bit */
+                pThis->dma_auto = 0;
+                break;
 
-        case 0xe0:              /* DSP identification */
-            s->needed_bytes = 1;
-            break;
+            case 0xe0:              /* DSP identification */
+                pThis->needed_bytes = 1;
+                break;
 
-        case 0xe1:
-            dsp_out_data (s, s->ver & 0xff);
-            dsp_out_data (s, s->ver >> 8);
-            break;
+            case 0xe1:
+                dsp_out_data(pThis, pThis->ver & 0xff);
+                dsp_out_data(pThis, pThis->ver >> 8);
+                break;
 
-        case 0xe2:
-            s->needed_bytes = 1;
-            goto warn;
+            case 0xe2:
+                pThis->needed_bytes = 1;
+                goto warn;
 
-        case 0xe3:
+            case 0xe3:
             {
-                int i;
-                for (i = sizeof (e3) - 1; i >= 0; --i)
-                    dsp_out_data (s, e3[i]);
+                for (int i = sizeof (e3) - 1; i >= 0; --i)
+                    dsp_out_data(pThis, e3[i]);
+
+                break;
             }
-            break;
 
-        case 0xe4:              /* write test reg */
-            s->needed_bytes = 1;
-            break;
+            case 0xe4:              /* write test reg */
+                pThis->needed_bytes = 1;
+                break;
 
-        case 0xe7:
-            dolog ("Attempt to probe for ESS (0xe7)?\n");
-            break;
+            case 0xe7:
+                LogFlowFunc(("Attempt to probe for ESS (0xe7)?\n"));
+                break;
 
-        case 0xe8:              /* read test reg */
-            dsp_out_data (s, s->test_reg);
-            break;
+            case 0xe8:              /* read test reg */
+                dsp_out_data(pThis, pThis->test_reg);
+                break;
 
-        case 0xf2:
-        case 0xf3:
-            dsp_out_data (s, 0xaa);
-            s->mixer_regs[0x82] |= (cmd == 0xf2) ? 1 : 2;
-#ifndef VBOX
-            qemu_irq_raise (s->pic[s->irq]);
-#else
-            PDMDevHlpISASetIrq(s->pDevIns, s->irq, 1);
-#endif
-            break;
+            case 0xf2:
+            case 0xf3:
+                dsp_out_data(pThis, 0xaa);
+                pThis->mixer_regs[0x82] |= (cmd == 0xf2) ? 1 : 2;
+                PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
+                break;
 
-        case 0xf9:
-            s->needed_bytes = 1;
-            goto warn;
+            case 0xf8:
+                /* Undocumented, used by old Creative diagnostic programs. */
+                dsp_out_data (pThis, 0);
+                goto warn;
 
-        case 0xfa:
-            dsp_out_data (s, 0);
-            goto warn;
+            case 0xf9:
+                pThis->needed_bytes = 1;
+                goto warn;
 
-        case 0xfc:              /* FIXME */
-            dsp_out_data (s, 0);
-            goto warn;
+            case 0xfa:
+                dsp_out_data (pThis, 0);
+                goto warn;
 
-        default:
-            dolog ("Unrecognized command %#x\n", cmd);
-            break;
+            case 0xfc:              /* FIXME */
+                dsp_out_data (pThis, 0);
+                goto warn;
+
+            default:
+                LogFlowFunc(("Unrecognized command %#x\n", cmd));
+                break;
         }
     }
 
-    if (!s->needed_bytes) {
-        ldebug ("\n");
-    }
+    if (!pThis->needed_bytes)
+        LogFlow(("\n"));
+
+exit:
+
+     if (!pThis->needed_bytes)
+        pThis->cmd = -1;
+     else
+        pThis->cmd = cmd;
 
- exit:
-    if (!s->needed_bytes) {
-        s->cmd = -1;
-    }
-    else {
-        s->cmd = cmd;
-    }
     return;
 
- warn:
-    dolog ("warning: command %#x,%d is not truly understood yet\n",
-           cmd, s->needed_bytes);
+warn:
+    LogFlowFunc(("warning: command %#x,%d is not truly understood yet\n",
+                 cmd, pThis->needed_bytes));
     goto exit;
-
 }
 
-static uint16_t dsp_get_lohi (SB16State *s)
+static uint16_t dsp_get_lohi (PSB16STATE pThis)
 {
-    uint8_t hi = dsp_get_data (s);
-    uint8_t lo = dsp_get_data (s);
+    uint8_t hi = dsp_get_data (pThis);
+    uint8_t lo = dsp_get_data (pThis);
     return (hi << 8) | lo;
 }
 
-static uint16_t dsp_get_hilo (SB16State *s)
+static uint16_t dsp_get_hilo (PSB16STATE pThis)
 {
-    uint8_t lo = dsp_get_data (s);
-    uint8_t hi = dsp_get_data (s);
+    uint8_t lo = dsp_get_data (pThis);
+    uint8_t hi = dsp_get_data (pThis);
     return (hi << 8) | lo;
 }
 
-static void complete (SB16State *s)
+static void complete(PSB16STATE pThis)
 {
     int d0, d1, d2;
-    ldebug ("complete command %#x, in_index %d, needed_bytes %d\n",
-            s->cmd, s->in_index, s->needed_bytes);
+    LogFlowFunc(("complete command %#x, in_index %d, needed_bytes %d\n",
+            pThis->cmd, pThis->in_index, pThis->needed_bytes));
 
-    if (s->cmd > 0xaf && s->cmd < 0xd0) {
-        d2 = dsp_get_data (s);
-        d1 = dsp_get_data (s);
-        d0 = dsp_get_data (s);
+    if (pThis->cmd > 0xaf && pThis->cmd < 0xd0)
+    {
+        d2 = dsp_get_data (pThis);
+        d1 = dsp_get_data (pThis);
+        d0 = dsp_get_data (pThis);
 
-        if (s->cmd & 8) {
-            dolog ("ADC params cmd = %#x d0 = %d, d1 = %d, d2 = %d\n",
-                   s->cmd, d0, d1, d2);
-        }
-        else {
-            ldebug ("cmd = %#x d0 = %d, d1 = %d, d2 = %d\n",
-                    s->cmd, d0, d1, d2);
-            dma_cmd (s, s->cmd, d0, d1 + (d2 << 8));
+        if (pThis->cmd & 8)
+            LogFlowFunc(("ADC params cmd = %#x d0 = %d, d1 = %d, d2 = %d\n", pThis->cmd, d0, d1, d2));
+        else
+        {
+            LogFlowFunc(("cmd = %#x d0 = %d, d1 = %d, d2 = %d\n", pThis->cmd, d0, d1, d2));
+            dma_cmd(pThis, pThis->cmd, d0, d1 + (d2 << 8));
         }
     }
-    else {
-        switch (s->cmd) {
+    else
+    {
+        switch (pThis->cmd)
+        {
         case 0x04:
-            s->csp_mode = dsp_get_data (s);
-            s->csp_reg83r = 0;
-            s->csp_reg83w = 0;
-            ldebug ("CSP command 0x04: mode=%#x\n", s->csp_mode);
+            pThis->csp_mode = dsp_get_data (pThis);
+            pThis->csp_reg83r = 0;
+            pThis->csp_reg83w = 0;
+            LogFlowFunc(("CSP command 0x04: mode=%#x\n", pThis->csp_mode));
             break;
 
         case 0x05:
-            s->csp_param = dsp_get_data (s);
-            s->csp_value = dsp_get_data (s);
-            ldebug ("CSP command 0x05: param=%#x value=%#x\n",
-                    s->csp_param,
-                    s->csp_value);
+            pThis->csp_param = dsp_get_data (pThis);
+            pThis->csp_value = dsp_get_data (pThis);
+            LogFlowFunc(("CSP command 0x05: param=%#x value=%#x\n",
+                    pThis->csp_param,
+                    pThis->csp_value));
             break;
 
         case 0x0e:
-            d0 = dsp_get_data (s);
-            d1 = dsp_get_data (s);
-            ldebug ("write CSP register %d <- %#x\n", d1, d0);
-            if (d1 == 0x83) {
-                ldebug ("0x83[%d] <- %#x\n", s->csp_reg83r, d0);
-                s->csp_reg83[s->csp_reg83r % 4] = d0;
-                s->csp_reg83r += 1;
-            }
-            else {
-                s->csp_regs[d1] = d0;
+        {
+            d0 = dsp_get_data(pThis);
+            d1 = dsp_get_data(pThis);
+            LogFlowFunc(("write CSP register %d <- %#x\n", d1, d0));
+            if (d1 == 0x83)
+            {
+                LogFlowFunc(("0x83[%d] <- %#x\n", pThis->csp_reg83r, d0));
+                pThis->csp_reg83[pThis->csp_reg83r % 4] = d0;
+                pThis->csp_reg83r += 1;
             }
+            else
+                pThis->csp_regs[d1] = d0;
             break;
+        }
 
         case 0x0f:
-            d0 = dsp_get_data (s);
-            ldebug ("read CSP register %#x -> %#x, mode=%#x\n",
-                    d0, s->csp_regs[d0], s->csp_mode);
-            if (d0 == 0x83) {
-                ldebug ("0x83[%d] -> %#x\n",
-                        s->csp_reg83w,
-                        s->csp_reg83[s->csp_reg83w % 4]);
-                dsp_out_data (s, s->csp_reg83[s->csp_reg83w % 4]);
-                s->csp_reg83w += 1;
-            }
-            else {
-                dsp_out_data (s, s->csp_regs[d0]);
+            d0 = dsp_get_data(pThis);
+            LogFlowFunc(("read CSP register %#x -> %#x, mode=%#x\n", d0, pThis->csp_regs[d0], pThis->csp_mode));
+            if (d0 == 0x83)
+            {
+                LogFlowFunc(("0x83[%d] -> %#x\n",
+                        pThis->csp_reg83w,
+                        pThis->csp_reg83[pThis->csp_reg83w % 4]));
+                dsp_out_data (pThis, pThis->csp_reg83[pThis->csp_reg83w % 4]);
+                pThis->csp_reg83w += 1;
             }
+            else
+                dsp_out_data(pThis, pThis->csp_regs[d0]);
             break;
 
         case 0x10:
-            d0 = dsp_get_data (s);
-            dolog ("cmd 0x10 d0=%#x\n", d0);
+            d0 = dsp_get_data(pThis);
+            LogFlowFunc(("cmd 0x10 d0=%#x\n", d0));
             break;
 
         case 0x14:
-            dma_cmd8 (s, 0, dsp_get_lohi (s) + 1);
+            dma_cmd8(pThis, 0, dsp_get_lohi (pThis) + 1);
             break;
 
         case 0x40:
-            s->time_const = dsp_get_data (s);
-            ldebug ("set time const %d\n", s->time_const);
+            pThis->time_const = dsp_get_data(pThis);
+            LogFlowFunc(("set time const %d\n", pThis->time_const));
             break;
 
         case 0x42:              /* FT2 sets output freq with this, go figure */
 #if 0
-            dolog ("cmd 0x42 might not do what it think it should\n");
+            LogFlowFunc(("cmd 0x42 might not do what it think it should\n"));
 #endif
         case 0x41:
-            s->freq = dsp_get_hilo (s);
-            ldebug ("set freq %d\n", s->freq);
+            pThis->freq = dsp_get_hilo(pThis);
+            LogFlowFunc(("set freq %d\n", pThis->freq));
             break;
 
         case 0x48:
-            s->block_size = dsp_get_lohi (s) + 1;
-            ldebug ("set dma block len %d\n", s->block_size);
+            pThis->block_size = dsp_get_lohi(pThis) + 1;
+            LogFlowFunc(("set dma block len %d\n", pThis->block_size));
             break;
 
         case 0x74:
@@ -868,502 +991,608 @@ static void complete (SB16State *s)
             break;
 
         case 0x80:
-            {
-                int freq, samples, bytes;
-                uint64_t ticks;
-
-                freq = s->freq > 0 ? s->freq : 11025;
-                samples = dsp_get_lohi (s) + 1;
-                bytes = samples << s->fmt_stereo << ((s->fmt_bits == 16) ? 1 : 0);
-#ifndef VBOX
-                ticks = (bytes * ticks_per_sec) / freq;
-                if (ticks < ticks_per_sec / 1024) {
-                    qemu_irq_raise (s->pic[s->irq]);
-                }
-                else {
-                    if (s->aux_ts) {
-                        qemu_mod_timer (
-                            s->aux_ts,
-                            qemu_get_clock (vm_clock) + ticks
-                            );
-                    }
-                }
-                ldebug ("mix silence %d %d %" PRId64 "\n", samples, bytes, ticks);
-#else  /* VBOX */
-                ticks = (bytes * TMTimerGetFreq(s->pTimer)) / freq;
-                if (ticks < TMTimerGetFreq(s->pTimer) / 1024)
-                    PDMDevHlpISASetIrq(s->pDevIns, s->irq, 1);
-                else
-                    TMTimerSet(s->pTimer, TMTimerGet(s->pTimer) + ticks);
-                ldebug ("mix silence %d %d % %RU64\n", samples, bytes, ticks);
-#endif /* VBOX */
-            }
+        {
+            int freq, samples, bytes;
+            uint64_t ticks;
+
+            freq = pThis->freq > 0 ? pThis->freq : 11025;
+            samples = dsp_get_lohi (pThis) + 1;
+            bytes = samples << pThis->fmt_stereo << ((pThis->fmt_bits == 16) ? 1 : 0);
+            ticks = (bytes * TMTimerGetFreq(pThis->pTimerIRQ)) / freq;
+            if (ticks < TMTimerGetFreq(pThis->pTimerIRQ) / 1024)
+                PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
+            else
+                TMTimerSet(pThis->pTimerIRQ, TMTimerGet(pThis->pTimerIRQ) + ticks);
+            LogFlowFunc(("mix silence %d %d % %RU64\n", samples, bytes, ticks));
             break;
+        }
 
         case 0xe0:
-            d0 = dsp_get_data (s);
-            s->out_data_len = 0;
-            ldebug ("E0 data = %#x\n", d0);
-            dsp_out_data (s, ~d0);
+            d0 = dsp_get_data(pThis);
+            pThis->out_data_len = 0;
+            LogFlowFunc(("E0 data = %#x\n", d0));
+            dsp_out_data(pThis, ~d0);
             break;
 
         case 0xe2:
-            d0 = dsp_get_data (s);
-            ldebug ("E2 = %#x\n", d0);
+            d0 = dsp_get_data(pThis);
+            LogFlow(("SB16:E2 = %#x\n", d0));
             break;
 
         case 0xe4:
-            s->test_reg = dsp_get_data (s);
+            pThis->test_reg = dsp_get_data(pThis);
             break;
 
         case 0xf9:
-            d0 = dsp_get_data (s);
-            ldebug ("command 0xf9 with %#x\n", d0);
+            d0 = dsp_get_data(pThis);
+            LogFlowFunc(("command 0xf9 with %#x\n", d0));
             switch (d0) {
             case 0x0e:
-                dsp_out_data (s, 0xff);
+                dsp_out_data(pThis, 0xff);
                 break;
 
             case 0x0f:
-                dsp_out_data (s, 0x07);
+                dsp_out_data(pThis, 0x07);
                 break;
 
             case 0x37:
-                dsp_out_data (s, 0x38);
+                dsp_out_data(pThis, 0x38);
                 break;
 
             default:
-                dsp_out_data (s, 0x00);
+                dsp_out_data(pThis, 0x00);
                 break;
             }
             break;
 
         default:
-            dolog ("complete: unrecognized command %#x\n", s->cmd);
+            LogFlowFunc(("complete: unrecognized command %#x\n", pThis->cmd));
             return;
         }
     }
 
-    ldebug ("\n");
-    s->cmd = -1;
+    LogFlow(("\n"));
+    pThis->cmd = -1;
     return;
 }
 
-static void legacy_reset (SB16State *s)
+static uint8_t sb16MixRegToVol(PSB16STATE pThis, int reg)
 {
-    audsettings_t as;
+    /* The SB16 mixer has a 0 to -62dB range in 32 levels (2dB each step).
+     * We use a 0 to -96dB range in 256 levels (0.375dB each step).
+     * Only the top 5 bits of a mixer register are used.
+     */
+    uint8_t steps = 31 - (pThis->mixer_regs[reg] >> 3);
+    uint8_t vol   = 255 - steps * 16 / 3;   /* (2dB*8) / (0.375dB*8) */
+    return vol;
+}
 
-    s->freq = 11025;
-    s->fmt_signed = 0;
-    s->fmt_bits = 8;
-    s->fmt_stereo = 0;
+static void sb16SetMasterVolume(PSB16STATE pThis)
+{
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /* There's no mute switch, only volume controls. */
+    uint8_t lvol = sb16MixRegToVol(pThis, 0x30);
+    uint8_t rvol = sb16MixRegToVol(pThis, 0x31);
+    PDMAUDIOVOLUME vol = { false, lvol, rvol };
+    audioMixerSetMasterVolume(pThis->pMixer, &vol);
+#else
+    int     mute = 0;
+    uint8_t lvol = pThis->mixer_regs[0x30];
+    uint8_t rvol = pThis->mixer_regs[0x31];
 
-    as.freq = s->freq;
-    as.nchannels = 1;
-    as.fmt = AUD_FMT_U8;
-    as.endianness = 0;
+    AUD_set_volume(AUD_MIXER_VOLUME, &mute, &lvol, &rvol);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+}
+
+static void sb16SetPcmOutVolume(PSB16STATE pThis)
+{
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    /* There's no mute switch, only volume controls. */
+    uint8_t lvol = sb16MixRegToVol(pThis, 0x32);
+    uint8_t rvol = sb16MixRegToVol(pThis, 0x33);
+    PDMAUDIOVOLUME vol = { false, lvol, rvol };
+    audioMixerSetSinkVolume(pThis->pSinkOutput, &vol);
+#else
+    int     mute = 0;
+    uint8_t lvol = pThis->mixer_regs[0x32];
+    uint8_t rvol = pThis->mixer_regs[0x33];
+
+    AUD_set_volume(AUD_MIXER_PCM, &mute, &lvol, &rvol);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+}
 
-    s->voice = AUD_open_out (
-        &s->card,
-        s->voice,
+static void sb16ResetLegacy(PSB16STATE pThis)
+{
+    pThis->freq       = 11025;
+    pThis->fmt_signed = 0;
+    pThis->fmt_bits   = 8;
+    pThis->fmt_stereo = 0;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PDMAUDIOSTREAMCFG streamCfg;
+    streamCfg.uHz           = pThis->freq;
+    streamCfg.cChannels     = 1; /* Mono */
+    streamCfg.enmFormat     = AUD_FMT_U8;
+    streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+    int rc = sb16OpenOut(pThis, &streamCfg);
+    AssertRC(rc);
+#else
+    audsettings_t streamCfg;
+    streamCfg.freq = pThis->freq;
+    streamCfg.nchannels = 1;
+    streamCfg.fmt = AUD_FMT_U8;
+    streamCfg.endianness = 0;
+    pThis->voice = AUD_open_out (
+        &pThis->card,
+        pThis->voice,
         "sb16",
-        s,
-        SB_audio_callback,
-        &as
+        pThis,
+        sb16AudioCallback,
+        &streamCfg
         );
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
     /* Not sure about that... */
-    /* AUD_set_active_out (s->voice, 1); */
+    /* AUD_set_active_out (pThis->voice, 1); */
 }
 
-static void reset (SB16State *s)
+static void sb16Reset(PSB16STATE pThis)
 {
-#ifndef VBOX
-    qemu_irq_lower (s->pic[s->irq]);
-    if (s->dma_auto) {
-        qemu_irq_raise (s->pic[s->irq]);
-        qemu_irq_lower (s->pic[s->irq]);
-    }
-#else  /* VBOX */
-    PDMDevHlpISASetIrq(s->pDevIns, s->irq, 0);
-    if (s->dma_auto) {
-        PDMDevHlpISASetIrq(s->pDevIns, s->irq, 1);
-        PDMDevHlpISASetIrq(s->pDevIns, s->irq, 0);
+    PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
+    if (pThis->dma_auto)
+    {
+        PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
+        PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
     }
-#endif /* VBOX */
-
-    s->mixer_regs[0x82] = 0;
-    s->dma_auto = 0;
-    s->in_index = 0;
-    s->out_data_len = 0;
-    s->left_till_irq = 0;
-    s->needed_bytes = 0;
-    s->block_size = -1;
-    s->nzero = 0;
-    s->highspeed = 0;
-    s->v2x6 = 0;
-    s->cmd = -1;
-
-    dsp_out_data(s, 0xaa);
-    speaker (s, 0);
-    control (s, 0);
-    legacy_reset (s);
+
+    pThis->mixer_regs[0x82] = 0;
+    pThis->dma_auto = 0;
+    pThis->in_index = 0;
+    pThis->out_data_len = 0;
+    pThis->left_till_irq = 0;
+    pThis->needed_bytes = 0;
+    pThis->block_size = -1;
+    pThis->nzero = 0;
+    pThis->highspeed = 0;
+    pThis->v2x6 = 0;
+    pThis->cmd = -1;
+
+    dsp_out_data(pThis, 0xaa);
+    sb16SpeakerControl(pThis, 0);
+    sb16Control(pThis, 0);
+    sb16ResetLegacy(pThis);
 }
 
-static IO_WRITE_PROTO (dsp_write)
+static IO_WRITE_PROTO(dsp_write)
 {
-    SB16State *s = (SB16State*)opaque;
-    int iport = nport - s->port;
+    PSB16STATE pThis = (PSB16STATE)opaque;
+    int iport = nport - pThis->port;
 
-    ldebug ("write %#x <- %#x\n", nport, val);
-    switch (iport) {
-    case 0x06:
-        switch (val) {
-        case 0x00:
-            if (s->v2x6 == 1) {
-                if (0 && s->highspeed) {
-                    s->highspeed = 0;
-#ifndef VBOX
-                    qemu_irq_lower (s->pic[s->irq]);
-#else
-                    PDMDevHlpISASetIrq(s->pDevIns, s->irq, 0);
-#endif
-                    control (s, 0);
-                }
-                else {
-                    reset (s);
+    LogFlowFunc(("write %#x <- %#x\n", nport, val));
+    switch (iport)
+    {
+        case 0x06:
+            switch (val)
+            {
+                case 0x00:
+                {
+                    if (pThis->v2x6 == 1)
+                    {
+                        if (0 && pThis->highspeed)
+                        {
+                            pThis->highspeed = 0;
+                            PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
+                            sb16Control(pThis, 0);
+                        }
+                        else
+                            sb16Reset(pThis);
+                    }
+                    pThis->v2x6 = 0;
+                    break;
                 }
-            }
-            s->v2x6 = 0;
-            break;
 
-        case 0x01:
-        case 0x03:              /* FreeBSD kludge */
-            s->v2x6 = 1;
-            break;
+                case 0x01:
+                case 0x03:              /* FreeBSD kludge */
+                    pThis->v2x6 = 1;
+                    break;
 
-        case 0xc6:
-            s->v2x6 = 0;        /* Prince of Persia, csp.sys, diagnose.exe */
-            break;
+                case 0xc6:
+                    pThis->v2x6 = 0;    /* Prince of Persia, csp.sys, diagnose.exe */
+                    break;
 
-        case 0xb8:              /* Panic */
-            reset (s);
-            break;
+                case 0xb8:              /* Panic */
+                    sb16Reset(pThis);
+                    break;
 
-        case 0x39:
-            dsp_out_data (s, 0x38);
-            reset (s);
-            s->v2x6 = 0x39;
-            break;
+                case 0x39:
+                    dsp_out_data(pThis, 0x38);
+                    sb16Reset(pThis);
+                    pThis->v2x6 = 0x39;
+                    break;
 
-        default:
-            s->v2x6 = val;
+                default:
+                    pThis->v2x6 = val;
+                    break;
+            }
             break;
-        }
-        break;
-
-    case 0x0c:                  /* write data or command | write status */
-/*         if (s->highspeed) */
-/*             break; */
 
-        if (0 == s->needed_bytes) {
-            command (s, val);
+        case 0x0c:                      /* Write data or command | write status */
 #if 0
-            if (0 == s->needed_bytes) {
-                log_dsp (s);
-            }
+            if (pThis->highspeed)
+                break;
+#endif
+            if (0 == pThis->needed_bytes)
+            {
+                sb16HandleCommand(pThis, val);
+#if 0
+                if (0 == pThis->needed_bytes) {
+                    log_dsp (pThis);
+                }
 #endif
-        }
-        else {
-            if (s->in_index == sizeof (s->in2_data)) {
-                dolog ("in data overrun\n");
             }
-            else {
-                s->in2_data[s->in_index++] = val;
-                if (s->in_index == s->needed_bytes) {
-                    s->needed_bytes = 0;
-                    complete (s);
+            else
+            {
+                if (pThis->in_index == sizeof (pThis->in2_data))
+                {
+                    LogFlowFunc(("in data overrun\n"));
+                }
+                else
+                {
+                    pThis->in2_data[pThis->in_index++] = val;
+                    if (pThis->in_index == pThis->needed_bytes)
+                    {
+                        pThis->needed_bytes = 0;
+                        complete (pThis);
 #if 0
-                    log_dsp (s);
+                        log_dsp (pThis);
 #endif
+                    }
                 }
             }
-        }
-        break;
+            break;
 
-    default:
-        ldebug ("(nport=%#x, val=%#x)\n", nport, val);
-        break;
+        default:
+            LogFlowFunc(("nport=%#x, val=%#x)\n", nport, val));
+            break;
     }
 
-#ifdef VBOX
     return VINF_SUCCESS;
-#endif
 }
 
-static IO_READ_PROTO (dsp_read)
+static IO_READ_PROTO(dsp_read)
 {
-    SB16State *s = (SB16State*)opaque;
+    PSB16STATE pThis = (PSB16STATE)opaque;
     int iport, retval, ack = 0;
 
-    iport = nport - s->port;
-#ifdef VBOX
+    iport = nport - pThis->port;
+
     /** @todo reject non-byte access?
      *  The spec does not mention a non-byte access so we should check how real hardware behaves. */
-#endif
 
-    switch (iport) {
-    case 0x06:                  /* reset */
-        retval = 0xff;
-        break;
+    switch (iport)
+    {
+        case 0x06:                  /* reset */
+            retval = 0xff;
+            break;
 
-    case 0x0a:                  /* read data */
-        if (s->out_data_len) {
-            retval = s->out_data[--s->out_data_len];
-            s->last_read_byte = retval;
-        }
-        else {
-            if (s->cmd != -1) {
-                dolog ("empty output buffer for command %#x\n",
-                       s->cmd);
+        case 0x0a:                  /* read data */
+            if (pThis->out_data_len)
+            {
+                retval = pThis->out_data[--pThis->out_data_len];
+                pThis->last_read_byte = retval;
             }
-            retval = s->last_read_byte;
-            /* goto error; */
-        }
-        break;
-
-    case 0x0c:                  /* 0 can write */
-        retval = s->can_write ? 0 : 0x80;
-        break;
-
-    case 0x0d:                  /* timer interrupt clear */
-        /* dolog ("timer interrupt clear\n"); */
-        retval = 0;
-        break;
-
-    case 0x0e:                  /* data available status | irq 8 ack */
-        retval = (!s->out_data_len || s->highspeed) ? 0 : 0x80;
-        if (s->mixer_regs[0x82] & 1) {
-            ack = 1;
-            s->mixer_regs[0x82] &= ~1;
-#ifndef VBOX
-            qemu_irq_lower (s->pic[s->irq]);
-#else
-            PDMDevHlpISASetIrq(s->pDevIns, s->irq, 0);
-#endif
-        }
-        break;
-
-    case 0x0f:                  /* irq 16 ack */
-        retval = 0xff;
-        if (s->mixer_regs[0x82] & 2) {
-            ack = 1;
-            s->mixer_regs[0x82] &= ~2;
-#ifndef VBOX
-            qemu_irq_lower (s->pic[s->irq]);
-#else
-            PDMDevHlpISASetIrq(s->pDevIns, s->irq, 0);
-#endif
-        }
-        break;
+            else
+            {
+                if (pThis->cmd != -1)
+                    LogFlowFunc(("empty output buffer for command %#x\n", pThis->cmd));
+                retval = pThis->last_read_byte;
+                /* goto error; */
+            }
+            break;
 
-    default:
-        goto error;
-    }
+        case 0x0c:                  /* 0 can write */
+            retval = pThis->can_write ? 0 : 0x80;
+            break;
+
+        case 0x0d:                  /* timer interrupt clear */
+            /* LogFlowFunc(("timer interrupt clear\n")); */
+            retval = 0;
+            break;
 
-    if (!ack) {
-        ldebug ("read %#x -> %#x\n", nport, retval);
+        case 0x0e:                  /* data available status | irq 8 ack */
+            retval = (!pThis->out_data_len || pThis->highspeed) ? 0 : 0x80;
+            if (pThis->mixer_regs[0x82] & 1)
+            {
+                ack = 1;
+                pThis->mixer_regs[0x82] &= ~1;
+                PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
+            }
+            break;
+
+        case 0x0f:                  /* irq 16 ack */
+            retval = 0xff;
+            if (pThis->mixer_regs[0x82] & 2)
+            {
+                ack = 1;
+                pThis->mixer_regs[0x82] &= ~2;
+               PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
+            }
+            break;
+
+        default:
+            goto error;
     }
 
-#ifndef VBOX
-    return retval;
-#else
+    if (!ack)
+        LogFlowFunc(("read %#x -> %#x\n", nport, retval));
+
     *pu32 = retval;
     return VINF_SUCCESS;
-#endif
 
  error:
-    dolog ("warning: dsp_read %#x error\n", nport);
-#ifndef VBOX
-    return 0xff;
-#else
+    LogFlowFunc(("warning: dsp_read %#x error\n", nport));
     return VERR_IOM_IOPORT_UNUSED;
-#endif
 }
 
-static void reset_mixer (SB16State *s)
+static void sb16MixerReset(PSB16STATE pThis)
 {
-    int i;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PSB16DRIVER pDrv;
 
-    memset (s->mixer_regs, 0xff, 0x7f);
-    memset (s->mixer_regs + 0x83, 0xff, sizeof (s->mixer_regs) - 0x83);
+    RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+        pDrv->Out.phStrmOut = NULL;
 
-    s->mixer_regs[0x02] = 4;    /* master volume 3bits */
-    s->mixer_regs[0x06] = 4;    /* MIDI volume 3bits */
-    s->mixer_regs[0x08] = 0;    /* CD volume 3bits */
-    s->mixer_regs[0x0a] = 0;    /* voice volume 2bits */
+    pThis->pSinkOutput = NULL;
+
+    if (pThis->pMixer)
+    {
+        audioMixerDestroy(pThis->pMixer);
+        pThis->pMixer = NULL;
+    }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    memset (pThis->mixer_regs, 0xff, 0x7f);
+    memset (pThis->mixer_regs + 0x83, 0xff, sizeof (pThis->mixer_regs) - 0x83);
+
+    pThis->mixer_regs[0x02] = 4;    /* master volume 3bits */
+    pThis->mixer_regs[0x06] = 4;    /* MIDI volume 3bits */
+    pThis->mixer_regs[0x08] = 0;    /* CD volume 3bits */
+    pThis->mixer_regs[0x0a] = 0;    /* voice volume 2bits */
 
     /* d5=input filt, d3=lowpass filt, d1,d2=input source */
-    s->mixer_regs[0x0c] = 0;
+    pThis->mixer_regs[0x0c] = 0;
 
     /* d5=output filt, d1=stereo switch */
-    s->mixer_regs[0x0e] = 0;
+    pThis->mixer_regs[0x0e] = 0;
 
     /* voice volume L d5,d7, R d1,d3 */
-    s->mixer_regs[0x04] = (4 << 5) | (4 << 1);
+    pThis->mixer_regs[0x04] = (12 << 4) | 12;
     /* master ... */
-    s->mixer_regs[0x22] = (4 << 5) | (4 << 1);
+    pThis->mixer_regs[0x22] = (12 << 4) | 12;
     /* MIDI ... */
-    s->mixer_regs[0x26] = (4 << 5) | (4 << 1);
+    pThis->mixer_regs[0x26] = (12 << 4) | 12;
+
+    /* master/voice/MIDI L/R volume */
+    for (int i = 0x30; i < 0x36; i++)
+        pThis->mixer_regs[i] = 24 << 3; /* -14 dB */
 
-    for (i = 0x30; i < 0x48; i++) {
-        s->mixer_regs[i] = 0x20;
+    /* treble/bass */
+    for (int i = 0x44; i < 0x48; i++)
+        pThis->mixer_regs[i] = 0x80;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    int rc2 = audioMixerCreate("SB16 Mixer", 0 /* uFlags */, &pThis->pMixer);
+    if (RT_SUCCESS(rc2))
+    {
+        /* Set a default audio format for our mixer. */
+        PDMAUDIOSTREAMCFG streamCfg;
+        streamCfg.uHz           = 41000;
+        streamCfg.cChannels     = 2;
+        streamCfg.enmFormat     = AUD_FMT_S16;
+        streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+        rc2 = audioMixerSetDeviceFormat(pThis->pMixer, &streamCfg);
+        AssertRC(rc2);
+
+        /* Add all required audio sinks. */
+        rc2 = audioMixerAddSink(pThis->pMixer, "[Playback] PCM Output",
+                                AUDMIXSINKDIR_OUTPUT, &pThis->pSinkOutput);
+        AssertRC(rc2);
     }
+#endif
+
+    /* Update the master (mixer) and PCM out volumes. */
+    sb16SetMasterVolume(pThis);
+    sb16SetPcmOutVolume(pThis);
 }
 
 static IO_WRITE_PROTO(mixer_write_indexb)
 {
-    SB16State *s = (SB16State*)opaque;
+    PSB16STATE pThis = (PSB16STATE)opaque;
     (void) nport;
-    s->mixer_nreg = val;
+    pThis->mixer_nreg = val;
 
-#ifdef VBOX
     return VINF_SUCCESS;
+}
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+uint32_t popcount (uint32_t u) /** @todo r=andy WTF? */
+{
+    u = ((u&0x55555555) + ((u>>1)&0x55555555));
+    u = ((u&0x33333333) + ((u>>2)&0x33333333));
+    u = ((u&0x0f0f0f0f) + ((u>>4)&0x0f0f0f0f));
+    u = ((u&0x00ff00ff) + ((u>>8)&0x00ff00ff));
+    u = ( u&0x0000ffff) + (u>>16);
+    return u;
+}
+
+uint32_t lsbindex (uint32_t u)
+{
+    return popcount ((u & -(int32_t)u) - 1);
+}
 #endif
+
+/* Convert SB16 to SB Pro mixer volume (left). */
+static inline void sb16ConvVolumeL(PSB16STATE pThis, unsigned reg, uint8_t val)
+{
+    /* High nibble in SBP mixer. */
+    pThis->mixer_regs[reg] = (pThis->mixer_regs[reg] & 0x0f) | (val & 0xf0);
+}
+
+/* Convert SB16 to SB Pro mixer volume (right). */
+static inline void sb16ConvVolumeR(PSB16STATE pThis, unsigned reg, uint8_t val)
+{
+    /* Low nibble in SBP mixer. */
+    pThis->mixer_regs[reg] = (pThis->mixer_regs[reg] & 0xf0) | (val >> 4);
 }
 
 static IO_WRITE_PROTO(mixer_write_datab)
 {
-    SB16State   *s = (SB16State*)opaque;
-    bool        update_master = false;
-    bool        update_voice  = false;
+    PSB16STATE  pThis = (PSB16STATE)opaque;
+    bool        fUpdateMaster = false;
+    bool        fUpdateStream = false;
 
     (void) nport;
-    ldebug ("mixer_write [%#x] <- %#x\n", s->mixer_nreg, val);
-
-    switch (s->mixer_nreg) {
-    case 0x00:
-        reset_mixer(s);
-        /* And update the actual volume, too. */
-        update_master = true;
-        update_voice  = true;
-        break;
-
-    case 0x04:
-        /* Translate from old style voice volume (L/R). */
-        s->mixer_regs[0x32] = val & 0xff;
-        s->mixer_regs[0x33] = val << 4;
-        update_voice = true;
-        break;
-
-    case 0x22:
-        /* Translate from old style master volume (L/R). */
-        s->mixer_regs[0x30] = val & 0xff;
-        s->mixer_regs[0x31] = val << 4;
-        update_master = true;
-        break;
-
-    case 0x30:
-        /* Translate to old style master volume (L). */
-        s->mixer_regs[0x22] = (s->mixer_regs[0x22] & 0x0f) | val;
-        update_master = true;
-        break;
-
-    case 0x31:
-        /* Translate to old style master volume (R). */
-        s->mixer_regs[0x22] = (s->mixer_regs[0x22] & 0xf0) | (val >> 4);
-        update_master = true;
-        break;
-
-    case 0x32:
-        /* Translate to old style voice volume (L). */
-        s->mixer_regs[0x04] = (s->mixer_regs[0x04] & 0x0f) | val;
-        update_voice = true;
-        break;
-
-    case 0x33:
-        /* Translate to old style voice volume (R). */
-        s->mixer_regs[0x04] = (s->mixer_regs[0x04] & 0xf0) | (val >> 4);
-        update_voice = true;
-        break;
-
-    case 0x80:
+    LogFlowFunc(("mixer_write [%#x] <- %#x\n", pThis->mixer_nreg, val));
+
+    switch (pThis->mixer_nreg)
+    {
+        case 0x00:
+            sb16MixerReset(pThis);
+            /* And update the actual volume, too. */
+            fUpdateMaster = true;
+            fUpdateStream = true;
+            break;
+
+        case 0x04:
+            /* Translate from old style stream volume (L/R). */
+            pThis->mixer_regs[0x32] = (val & 0xf0) >> 3;
+            pThis->mixer_regs[0x33] = (val & 0x0f) << 1;
+            fUpdateStream = true;
+            break;
+
+        case 0x22:
+            /* Translate from old style master volume (L/R). */
+            pThis->mixer_regs[0x30] = (val & 0xf0) >> 3;
+            pThis->mixer_regs[0x31] = (val & 0x0f) << 1;
+            fUpdateMaster = true;
+            break;
+
+        case 0x26:
+            /* Translate from old style MIDI volume (L/R). */
+            pThis->mixer_regs[0x34] = (val & 0xf0) >> 3;
+            pThis->mixer_regs[0x35] = (val & 0x0f) << 1;
+            break;
+
+        case 0x28:
+            /* Translate from old style CD volume (L/R). */
+            pThis->mixer_regs[0x36] = (val & 0xf0) >> 3;
+            pThis->mixer_regs[0x37] = (val & 0x0f) << 1;
+            break;
+
+        case 0x2E:
+            /* Translate from old style line volume (L/R). */
+            pThis->mixer_regs[0x38] = (val & 0xf0) >> 3;
+            pThis->mixer_regs[0x39] = (val & 0x0f) << 1;
+            break;
+
+        case 0x30:  /* Translate to old style master volume (L). */
+            sb16ConvVolumeL(pThis, 0x22, val);
+            fUpdateMaster = true;
+            break;
+
+        case 0x31:  /* Translate to old style master volume (R). */
+            sb16ConvVolumeR(pThis, 0x22, val);
+            fUpdateMaster = true;
+            break;
+
+        case 0x32:  /* Translate to old style voice volume (L). */
+            sb16ConvVolumeL(pThis, 0x04, val);
+            fUpdateStream = true;
+            break;
+
+        case 0x33:  /* Translate to old style voice volume (R). */
+            sb16ConvVolumeR(pThis, 0x04, val);
+            fUpdateStream = true;
+            break;
+
+        case 0x34:  /* Translate to old style MIDI volume (L). */
+            sb16ConvVolumeL(pThis, 0x26, val);
+            break;
+
+        case 0x35:  /* Translate to old style MIDI volume (R). */
+            sb16ConvVolumeR(pThis, 0x26, val);
+            break;
+
+        case 0x36:  /* Translate to old style CD volume (L). */
+            sb16ConvVolumeL(pThis, 0x28, val);
+            break;
+
+        case 0x37:  /* Translate to old style CD volume (R). */
+            sb16ConvVolumeR(pThis, 0x28, val);
+            break;
+
+        case 0x38:  /* Translate to old style line volume (L). */
+            sb16ConvVolumeL(pThis, 0x2E, val);
+            break;
+
+        case 0x39:  /* Translate to old style line volume (R). */
+            sb16ConvVolumeR(pThis, 0x2E, val);
+            break;
+
+        case 0x80:
         {
-            int irq = irq_of_magic (val);
-            ldebug ("setting irq to %d (val=%#x)\n", irq, val);
-            if (irq > 0) {
-                s->irq = irq;
-            }
+            int irq = irq_of_magic(val);
+            LogFlowFunc(("setting irq to %d (val=%#x)\n", irq, val));
+            if (irq > 0)
+                pThis->irq = irq;
+            break;
         }
-        break;
 
-    case 0x81:
+        case 0x81:
         {
             int dma, hdma;
 
             dma = lsbindex (val & 0xf);
             hdma = lsbindex (val & 0xf0);
-            if (dma != s->dma || hdma != s->hdma) {
-                dolog (
-                    "attempt to change DMA "
-                    "8bit %d(%d), 16bit %d(%d) (val=%#x)\n",
-                    dma, s->dma, hdma, s->hdma, val);
-            }
+            if (dma != pThis->dma || hdma != pThis->hdma)
+                LogFlow(("SB16: attempt to change DMA 8bit %d(%d), 16bit %d(%d) (val=%#x)\n",
+                         dma, pThis->dma, hdma, pThis->hdma, val));
 #if 0
-            s->dma = dma;
-            s->hdma = hdma;
+            pThis->dma = dma;
+            pThis->hdma = hdma;
 #endif
+            break;
         }
-        break;
 
-    case 0x82:
-        dolog ("attempt to write into IRQ status register (val=%#x)\n",
-               val);
-#ifdef VBOX
-        return VINF_SUCCESS;
-#endif
+        case 0x82:
+            LogFlowFunc(("attempt to write into IRQ status register (val=%#x)\n", val));
+            return VINF_SUCCESS;
 
-    default:
-        if (s->mixer_nreg >= 0x80) {
-            ldebug ("attempt to write mixer[%#x] <- %#x\n", s->mixer_nreg, val);
-        }
-        break;
+        default:
+            if (pThis->mixer_nreg >= 0x80)
+                LogFlowFunc(("attempt to write mixer[%#x] <- %#x\n", pThis->mixer_nreg, val));
+            break;
     }
 
-    s->mixer_regs[s->mixer_nreg] = val;
+    pThis->mixer_regs[pThis->mixer_nreg] = val;
 
-#ifdef VBOX
     /* Update the master (mixer) volume. */
-    if (update_master)
-    {
-        int     mute = 0;
-        uint8_t lvol = s->mixer_regs[0x30];
-        uint8_t rvol = s->mixer_regs[0x31];
-        AUD_set_volume(AUD_MIXER_VOLUME, &mute, &lvol, &rvol);
-    }
-    /* Update the voice (PCM) volume. */
-    if (update_voice)
-    {
-        int     mute = 0;
-        uint8_t lvol = s->mixer_regs[0x32];
-        uint8_t rvol = s->mixer_regs[0x33];
-        AUD_set_volume(AUD_MIXER_PCM, &mute, &lvol, &rvol);
-    }
-#endif /* VBOX */
+    if (fUpdateMaster)
+        sb16SetMasterVolume(pThis);
+
+    /* Update the stream (PCM) volume. */
+    if (fUpdateStream)
+        sb16SetPcmOutVolume(pThis);
 
-#ifdef VBOX
     return VINF_SUCCESS;
-#endif
 }
 
 static IO_WRITE_PROTO(mixer_write)
 {
-#ifndef VBOX
-    mixer_write_indexb (opaque, nport, val & 0xff);
-    mixer_write_datab (opaque, nport, (val >> 8) & 0xff);
-#else  /* VBOX */
-    SB16State *s = (SB16State*)opaque;
-    int iport = nport - s->port;
+    PSB16STATE pThis = (PSB16STATE)opaque;
+    int iport = nport - pThis->port;
     switch (cb)
     {
         case 1:
@@ -1386,385 +1615,423 @@ static IO_WRITE_PROTO(mixer_write)
             break;
     }
     return VINF_SUCCESS;
-#endif /* VBOX */
 }
 
 static IO_READ_PROTO(mixer_read)
 {
-    SB16State *s = (SB16State*)opaque;
+    PSB16STATE pThis = (PSB16STATE)opaque;
 
     (void) nport;
 #ifndef DEBUG_SB16_MOST
-    if (s->mixer_nreg != 0x82) {
-        ldebug ("mixer_read[%#x] -> %#x\n",
-                s->mixer_nreg, s->mixer_regs[s->mixer_nreg]);
+    if (pThis->mixer_nreg != 0x82) {
+        LogFlowFunc(("mixer_read[%#x] -> %#x\n",
+                pThis->mixer_nreg, pThis->mixer_regs[pThis->mixer_nreg]));
     }
 #else
-    ldebug ("mixer_read[%#x] -> %#x\n",
-            s->mixer_nreg, s->mixer_regs[s->mixer_nreg]);
+    LogFlowFunc(("mixer_read[%#x] -> %#x\n",
+            pThis->mixer_nreg, pThis->mixer_regs[pThis->mixer_nreg]));
 #endif
-#ifndef VBOX
-    return s->mixer_regs[s->mixer_nreg];
-#else
-    *pu32 = s->mixer_regs[s->mixer_nreg];
+    *pu32 = pThis->mixer_regs[pThis->mixer_nreg];
     return VINF_SUCCESS;
-#endif
 }
 
-static int write_audio (SB16State *s, int nchan, int dma_pos,
-                        int dma_len, int len)
+static int sb16WriteAudio(PSB16STATE pThis, int nchan, uint32_t dma_pos,
+                          uint32_t dma_len, int len)
 {
-    int temp, net;
-    uint8_t tmpbuf[4096];
+    uint8_t     tmpbuf[_4K]; /** @todo Have a buffer on the heap. */
+    uint32_t    cbToWrite = len;
+    uint32_t    cbWrittenTotal = 0;
 
-    temp = len;
-    net = 0;
+    while (cbToWrite)
+    {
+        uint32_t cbWrittenMin = UINT32_MAX;
+        uint32_t cbToRead;
+        uint32_t cbRead;
 
-    while (temp) {
-        int left = dma_len - dma_pos;
-#ifndef VBOX
-        int copied;
-        size_t to_copy;
-#else
-        uint32_t copied;
-        uint32_t to_copy;
-#endif
+        cbToRead = RT_MIN(dma_len - dma_pos, cbToWrite);
+        if (cbToRead > sizeof(tmpbuf))
+            cbToRead = sizeof(tmpbuf);
 
-        to_copy = audio_MIN (temp, left);
-        if (to_copy > sizeof (tmpbuf)) {
-            to_copy = sizeof (tmpbuf);
-        }
+        int rc = PDMDevHlpDMAReadMemory(pThis->pDevIns, nchan, tmpbuf, dma_pos, cbToRead, &cbRead);
+        AssertMsgRC(rc, ("DMAReadMemory -> %Rrc\n", rc));
 
-#ifndef VBOX
-        copied = DMA_read_memory (nchan, tmpbuf, dma_pos, to_copy);
-#else
-        int rc = PDMDevHlpDMAReadMemory(s->pDevIns, nchan, tmpbuf, dma_pos,
-                                        to_copy, &copied);
-        AssertMsgRC (rc, ("DMAReadMemory -> %Rrc\n", rc));
-#endif
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        uint32_t cbWritten;
 
-        copied = AUD_write (s->voice, tmpbuf, copied);
+        /* Just multiplex the output to the connected backends.
+         * No need to utilize the virtual mixer here (yet). */
+        PSB16DRIVER pDrv;
+        RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+        {
+            int rc2 = pDrv->pConnector->pfnWrite(pDrv->pConnector, pDrv->Out.pStrmOut,
+                                                 tmpbuf, cbToRead, &cbWritten);
+            AssertRCBreak(rc);
+            if (RT_FAILURE(rc2))
+                continue;
+
+            cbWrittenMin = RT_MIN(cbWrittenMin, cbWritten);
+            LogFlowFunc(("\tLUN#%RU8: cbWritten=%RU32, cWrittenMin=%RU32\n", pDrv->uLUN, cbWritten, cbWrittenMin));
+        }
+#else
+        cbWrittenMin = AUD_write (pThis->voice, tmpbuf, cbToRead);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
-        temp -= copied;
-        dma_pos = (dma_pos + copied) % dma_len;
-        net += copied;
+        Assert(cbToWrite >= cbWrittenMin);
+        cbToWrite      -= cbWrittenMin;
+        dma_pos         = (dma_pos + cbWrittenMin) % dma_len;
+        cbWrittenTotal += cbWrittenMin;
 
-        if (!copied) {
+        if (!cbRead || !cbWrittenMin)
             break;
-        }
     }
 
-    return net;
+    return cbWrittenTotal;
 }
 
-#ifndef VBOX
-static int SB_read_DMA (void *opaque, int nchan, int dma_pos, int dma_len)
-#else
-static DECLCALLBACK(uint32_t) SB_read_DMA (PPDMDEVINS pDevIns, void *opaque, unsigned nchan, uint32_t dma_pos, uint32_t dma_len)
-#endif
+static DECLCALLBACK(uint32_t) sb16DMARead(PPDMDEVINS pDevIns, void *opaque, unsigned nchan, uint32_t dma_pos, uint32_t dma_len)
 {
-    SB16State *s = (SB16State*)opaque;
+    PSB16STATE pThis = (PSB16STATE)opaque;
     int till, copy, written, free;
 
-    if (s->block_size <= 0) {
-        dolog ("invalid block size=%d nchan=%d dma_pos=%d dma_len=%d\n",
-               s->block_size, nchan, dma_pos, dma_len);
+    if (pThis->block_size <= 0)
+    {
+        LogFlowFunc(("invalid block size=%d nchan=%d dma_pos=%d dma_len=%d\n",
+                     pThis->block_size, nchan, dma_pos, dma_len));
         return dma_pos;
     }
 
-    if (s->left_till_irq < 0) {
-        s->left_till_irq = s->block_size;
+    if (pThis->left_till_irq < 0)
+        pThis->left_till_irq = pThis->block_size;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PSB16DRIVER pDrv;
+
+    uint32_t cbOutMin = UINT32_MAX;
+    uint32_t cbOut;
+    RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+    {
+        int rc2 = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
+                                                   NULL /* pcbIn */, &cbOut, NULL /* pcSamplesLive */);
+        if (RT_SUCCESS(rc2))
+            cbOutMin = RT_MIN(cbOutMin, cbOut);
     }
 
-    if (s->voice) {
-        free = s->audio_free & ~s->align;
-        if ((free <= 0) || !dma_len) {
+    LogFlowFunc(("cbOutMin=%RU32\n", cbOutMin));
+    if (cbOutMin == UINT32_MAX)
+    {
+        free = dma_len;
+    }
+    else
+    {
+        free = cbOutMin & ~pThis->align; /** @todo int vs. uint32. */
+        if ((free <= 0) || !dma_len)
             return dma_pos;
-        }
     }
-    else {
-        free = dma_len;
+#else
+    if (pThis->voice)
+    {
+        free = pThis->audio_free & ~pThis->align;
+        if ((free <= 0) || !dma_len)
+            return dma_pos;
     }
+    else
+        free = dma_len;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
     copy = free;
-    till = s->left_till_irq;
+    till = pThis->left_till_irq;
 
 #ifdef DEBUG_SB16_MOST
-    dolog ("pos:%06d %d till:%d len:%d\n",
-           dma_pos, free, till, dma_len);
+    LogFlowFunc(("pos:%06d %d till:%d len:%d\n", dma_pos, free, till, dma_len));
 #endif
 
-    if (copy >= till) {
-        if (0 == s->dma_auto) {
+    if (copy >= till)
+    {
+        if (0 == pThis->dma_auto)
+        {
             copy = till;
-        } else {
-            if( copy >= till + s->block_size ) {
-                copy = till;    /* Make sure we won't skip IRQs. */
-            }
+        }
+        else
+        {
+            if (copy >= till + pThis->block_size)
+                copy = till; /* Make sure we won't skip IRQs. */
         }
     }
 
-    written = write_audio (s, nchan, dma_pos, dma_len, copy);
+    written = sb16WriteAudio(pThis, nchan, dma_pos, dma_len, copy);
     dma_pos = (dma_pos + written) % dma_len;
-    s->left_till_irq -= written;
+    pThis->left_till_irq -= written;
 
-    if (s->left_till_irq <= 0) {
-        s->mixer_regs[0x82] |= (nchan & 4) ? 2 : 1;
-#ifndef VBOX
-        qemu_irq_raise (s->pic[s->irq]);
-#else
-        PDMDevHlpISASetIrq(s->pDevIns, s->irq, 1);
-#endif
-        if (0 == s->dma_auto) {
-            control (s, 0);
-            speaker (s, 0);
+    if (pThis->left_till_irq <= 0)
+    {
+        pThis->mixer_regs[0x82] |= (nchan & 4) ? 2 : 1;
+        PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 1);
+        if (0 == pThis->dma_auto)
+        {
+            sb16Control(pThis, 0);
+            sb16SpeakerControl(pThis, 0);
         }
     }
 
 #ifdef DEBUG_SB16_MOST
-    ldebug ("pos %5d free %5d size %5d till % 5d copy %5d written %5d size %5d\n",
-            dma_pos, free, dma_len, s->left_till_irq, copy, written,
-            s->block_size);
+    LogFlowFunc(("pos %5d free %5d size %5d till % 5d copy %5d written %5d size %5d\n",
+                 dma_pos, free, dma_len, pThis->left_till_irq, copy, written,
+                 pThis->block_size));
 #endif
 
-    while (s->left_till_irq <= 0) {
-        s->left_till_irq = s->block_size + s->left_till_irq;
-    }
+    while (pThis->left_till_irq <= 0)
+        pThis->left_till_irq += pThis->block_size;
 
     return dma_pos;
 }
 
-static void SB_audio_callback (void *opaque, int free)
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
+static void sb16AudioCallback(void *pvContext, int cbFree)
 {
-    SB16State *s = (SB16State*)opaque;
-    s->audio_free = free;
-#ifdef VBOX
+    PSB16STATE pState = (PSB16STATE)pvContext;
+    AssertPtrReturnVoid(pState);
+    pState->audio_free = cbFree;
     /* New space available, see if we can transfer more. There is no cyclic DMA timer in VBox. */
-    PDMDevHlpDMASchedule (s->pDevIns);
-#endif
+    PDMDevHlpDMASchedule(pState->pDevIns);
 }
-
-static void SB_save (QEMUFile *f, void *opaque)
-{
-#ifndef VBOX
-    SB16State *s = opaque;
 #else
-    SB16State *s = (SB16State *)opaque;
-#endif
-
-    qemu_put_be32 (f, s->irq);
-    qemu_put_be32 (f, s->dma);
-    qemu_put_be32 (f, s->hdma);
-    qemu_put_be32 (f, s->port);
-    qemu_put_be32 (f, s->ver);
-    qemu_put_be32 (f, s->in_index);
-    qemu_put_be32 (f, s->out_data_len);
-    qemu_put_be32 (f, s->fmt_stereo);
-    qemu_put_be32 (f, s->fmt_signed);
-    qemu_put_be32 (f, s->fmt_bits);
-    qemu_put_be32s (f, &s->fmt);
-    qemu_put_be32 (f, s->dma_auto);
-    qemu_put_be32 (f, s->block_size);
-    qemu_put_be32 (f, s->fifo);
-    qemu_put_be32 (f, s->freq);
-    qemu_put_be32 (f, s->time_const);
-    qemu_put_be32 (f, s->speaker);
-    qemu_put_be32 (f, s->needed_bytes);
-    qemu_put_be32 (f, s->cmd);
-    qemu_put_be32 (f, s->use_hdma);
-    qemu_put_be32 (f, s->highspeed);
-    qemu_put_be32 (f, s->can_write);
-    qemu_put_be32 (f, s->v2x6);
-
-    qemu_put_8s (f, &s->csp_param);
-    qemu_put_8s (f, &s->csp_value);
-    qemu_put_8s (f, &s->csp_mode);
-    qemu_put_8s (f, &s->csp_param);
-    qemu_put_buffer (f, s->csp_regs, 256);
-    qemu_put_8s (f, &s->csp_index);
-    qemu_put_buffer (f, s->csp_reg83, 4);
-    qemu_put_be32 (f, s->csp_reg83r);
-    qemu_put_be32 (f, s->csp_reg83w);
-
-    qemu_put_buffer (f, s->in2_data, sizeof (s->in2_data));
-    qemu_put_buffer (f, s->out_data, sizeof (s->out_data));
-    qemu_put_8s (f, &s->test_reg);
-    qemu_put_8s (f, &s->last_read_byte);
-
-    qemu_put_be32 (f, s->nzero);
-    qemu_put_be32 (f, s->left_till_irq);
-    qemu_put_be32 (f, s->dma_running);
-    qemu_put_be32 (f, s->bytes_per_second);
-    qemu_put_be32 (f, s->align);
-
-    qemu_put_be32 (f, s->mixer_nreg);
-    qemu_put_buffer (f, s->mixer_regs, 256);
-}
-
-static int SB_load (QEMUFile *f, void *opaque, int version_id)
+static DECLCALLBACK(void) sb16TimerIO(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
 {
-#ifndef VBOX
-    SB16State *s = opaque;
+    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
+    AssertPtrReturnVoid(pThis);
 
-    if (version_id != 1) {
-        return -EINVAL;
-    }
-#else
-    SB16State *s = (SB16State *)opaque;
-#endif
+    int rc = VINF_SUCCESS;
 
-    s->irq=qemu_get_be32 (f);
-    s->dma=qemu_get_be32 (f);
-    s->hdma=qemu_get_be32 (f);
-    s->port=qemu_get_be32 (f);
-    s->ver=qemu_get_be32 (f);
-    s->in_index=qemu_get_be32 (f);
-    s->out_data_len=qemu_get_be32 (f);
-    s->fmt_stereo=qemu_get_be32 (f);
-    s->fmt_signed=qemu_get_be32 (f);
-    s->fmt_bits=qemu_get_be32 (f);
-    qemu_get_be32s (f, (uint32_t*)&s->fmt);
-    s->dma_auto=qemu_get_be32 (f);
-    s->block_size=qemu_get_be32 (f);
-    s->fifo=qemu_get_be32 (f);
-    s->freq=qemu_get_be32 (f);
-    s->time_const=qemu_get_be32 (f);
-    s->speaker=qemu_get_be32 (f);
-    s->needed_bytes=qemu_get_be32 (f);
-    s->cmd=qemu_get_be32 (f);
-    s->use_hdma=qemu_get_be32 (f);
-    s->highspeed=qemu_get_be32 (f);
-    s->can_write=qemu_get_be32 (f);
-    s->v2x6=qemu_get_be32 (f);
-
-    qemu_get_8s (f, &s->csp_param);
-    qemu_get_8s (f, &s->csp_value);
-    qemu_get_8s (f, &s->csp_mode);
-    qemu_get_8s (f, &s->csp_param);
-    qemu_get_buffer (f, s->csp_regs, 256);
-    qemu_get_8s (f, &s->csp_index);
-    qemu_get_buffer (f, s->csp_reg83, 4);
-    s->csp_reg83r=qemu_get_be32 (f);
-    s->csp_reg83w=qemu_get_be32 (f);
-
-    qemu_get_buffer (f, s->in2_data, sizeof (s->in2_data));
-    qemu_get_buffer (f, s->out_data, sizeof (s->out_data));
-    qemu_get_8s (f, &s->test_reg);
-    qemu_get_8s (f, &s->last_read_byte);
-
-    s->nzero=qemu_get_be32 (f);
-    s->left_till_irq=qemu_get_be32 (f);
-    s->dma_running=qemu_get_be32 (f);
-    s->bytes_per_second=qemu_get_be32 (f);
-    s->align=qemu_get_be32 (f);
-
-    s->mixer_nreg=qemu_get_be32 (f);
-    qemu_get_buffer (f, s->mixer_regs, 256);
-
-    if (s->voice) {
-        AUD_close_out (&s->card, s->voice);
-        s->voice = NULL;
-    }
+    uint32_t cbInMax  = 0;
+    uint32_t cbOutMin = UINT32_MAX;
 
-    if (s->dma_running) {
-        if (s->freq) {
-            audsettings_t as;
+    PSB16DRIVER pDrv;
 
-            s->audio_free = 0;
+    uint32_t cbIn, cbOut, cSamplesLive;
+    RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+    {
+        rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
+                                              &cbIn, &cbOut, &cSamplesLive);
+        if (RT_SUCCESS(rc))
+        {
+            LogFlowFunc(("\tLUN#%RU8: [1] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
 
-            as.freq = s->freq;
-            as.nchannels = 1 << s->fmt_stereo;
-            as.fmt = s->fmt;
-            as.endianness = 0;
+            if (cSamplesLive)
+            {
+                uint32_t cSamplesPlayed;
+                int rc2 = pDrv->pConnector->pfnPlayOut(pDrv->pConnector, &cSamplesPlayed);
+                if (RT_SUCCESS(rc2))
+                    LogFlowFunc(("LUN#%RU8: cSamplesLive=%RU32, cSamplesPlayed=%RU32\n",
+                                 pDrv->uLUN, cSamplesLive, cSamplesPlayed));
+
+                if (cSamplesPlayed)
+                {
+                    rc = pDrv->pConnector->pfnQueryStatus(pDrv->pConnector,
+                                                          &cbIn, &cbOut, &cSamplesLive);
+                    if (RT_SUCCESS(rc))
+                        LogFlowFunc(("\tLUN#%RU8: [2] cbIn=%RU32, cbOut=%RU32\n", pDrv->uLUN, cbIn, cbOut));
+                }
+            }
 
-            s->voice = AUD_open_out (
-                &s->card,
-                s->voice,
-                "sb16",
-                s,
-                SB_audio_callback,
-                &as
-                );
+            cbInMax  = RT_MAX(cbInMax, cbIn);
+            cbOutMin = RT_MIN(cbOutMin, cbOut);
         }
+    }
+
+    LogFlowFunc(("cbInMax=%RU32, cbOutMin=%RU32\n", cbInMax, cbOutMin));
+
+    if (cbOutMin == UINT32_MAX)
+        cbOutMin = 0;
 
-        control (s, 1);
-        speaker (s, s->speaker);
+    /*
+     * Playback.
+     */
+    if (cbOutMin)
+    {
+        Assert(cbOutMin != UINT32_MAX);
+
+        /* New space available, see if we can transfer more. */
+        PDMDevHlpDMASchedule(pThis->pDevIns);
     }
 
-#ifdef VBOX
-    return VINF_SUCCESS;
-#endif
+    /*
+     * Recording.
+     */
+    /** @todo Implement recording. */
+
+    TMTimerSet(pThis->pTimerIO, TMTimerGet(pThis->pTimerIO) + pThis->uTicksIO);
 }
+#endif /* !VBOX_WITH_PDM_AUDIO_DRIVER */
 
-#ifndef VBOX
-int SB16_init (AudioState *audio, qemu_irq *pic)
+static void sb16Save(PSSMHANDLE pSSM, PSB16STATE pThis)
 {
-    SB16State *s;
-    int i;
-    static const uint8_t dsp_write_ports[] = {0x6, 0xc};
-    static const uint8_t dsp_read_ports[] = {0x6, 0xa, 0xc, 0xd, 0xe, 0xf};
-
-    if (!audio) {
-        dolog ("No audio state\n");
-        return -1;
-    }
+    SSMR3PutS32(pSSM, pThis->irq);
+    SSMR3PutS32(pSSM, pThis->dma);
+    SSMR3PutS32(pSSM, pThis->hdma);
+    SSMR3PutS32(pSSM, pThis->port);
+    SSMR3PutS32(pSSM, pThis->ver);
+    SSMR3PutS32(pSSM, pThis->in_index);
+    SSMR3PutS32(pSSM, pThis->out_data_len);
+    SSMR3PutS32(pSSM, pThis->fmt_stereo);
+    SSMR3PutS32(pSSM, pThis->fmt_signed);
+    SSMR3PutS32(pSSM, pThis->fmt_bits);
+
+    SSMR3PutU32(pSSM, pThis->fmt);
+
+    SSMR3PutS32(pSSM, pThis->dma_auto);
+    SSMR3PutS32(pSSM, pThis->block_size);
+    SSMR3PutS32(pSSM, pThis->fifo);
+    SSMR3PutS32(pSSM, pThis->freq);
+    SSMR3PutS32(pSSM, pThis->time_const);
+    SSMR3PutS32(pSSM, pThis->speaker);
+    SSMR3PutS32(pSSM, pThis->needed_bytes);
+    SSMR3PutS32(pSSM, pThis->cmd);
+    SSMR3PutS32(pSSM, pThis->use_hdma);
+    SSMR3PutS32(pSSM, pThis->highspeed);
+    SSMR3PutS32(pSSM, pThis->can_write);
+    SSMR3PutS32(pSSM, pThis->v2x6);
+
+    SSMR3PutU8 (pSSM, pThis->csp_param);
+    SSMR3PutU8 (pSSM, pThis->csp_value);
+    SSMR3PutU8 (pSSM, pThis->csp_mode);
+    SSMR3PutU8 (pSSM, pThis->csp_param); /* Bug compatible! */
+    SSMR3PutMem(pSSM, pThis->csp_regs, 256);
+    SSMR3PutU8 (pSSM, pThis->csp_index);
+    SSMR3PutMem(pSSM, pThis->csp_reg83, 4);
+    SSMR3PutS32(pSSM, pThis->csp_reg83r);
+    SSMR3PutS32(pSSM, pThis->csp_reg83w);
+
+    SSMR3PutMem(pSSM, pThis->in2_data, sizeof (pThis->in2_data));
+    SSMR3PutMem(pSSM, pThis->out_data, sizeof (pThis->out_data));
+    SSMR3PutU8 (pSSM, pThis->test_reg);
+    SSMR3PutU8 (pSSM, pThis->last_read_byte);
+
+    SSMR3PutS32(pSSM, pThis->nzero);
+    SSMR3PutS32(pSSM, pThis->left_till_irq);
+    SSMR3PutS32(pSSM, pThis->dma_running);
+    SSMR3PutS32(pSSM, pThis->bytes_per_second);
+    SSMR3PutS32(pSSM, pThis->align);
+
+    SSMR3PutS32(pSSM, pThis->mixer_nreg);
+    SSMR3PutMem(pSSM, pThis->mixer_regs, 256);
 
-    s = qemu_mallocz (sizeof (*s));
-    if (!s) {
-        dolog ("Could not allocate memory for SB16 (%zu bytes)\n",
-               sizeof (*s));
-        return -1;
-    }
+}
 
-    s->cmd = -1;
-    s->pic = pic;
-    s->irq = conf.irq;
-    s->dma = conf.dma;
-    s->hdma = conf.hdma;
-    s->port = conf.port;
-    s->ver = conf.ver_lo | (conf.ver_hi << 8);
-
-    s->mixer_regs[0x80] = magic_of_irq (s->irq);
-    s->mixer_regs[0x81] = (1 << s->dma) | (1 << s->hdma);
-    s->mixer_regs[0x82] = 2 << 5;
-
-    s->csp_regs[5] = 1;
-    s->csp_regs[9] = 0xf8;
-
-    reset_mixer (s);
-    s->aux_ts = qemu_new_timer (vm_clock, aux_timer, s);
-    if (!s->aux_ts) {
-        dolog ("warning: Could not create auxiliary timer\n");
+static int sb16Load(PSSMHANDLE pSSM, PSB16STATE pThis, int version_id)
+{
+    SSMR3GetS32(pSSM, &pThis->irq);
+    SSMR3GetS32(pSSM, &pThis->dma);
+    SSMR3GetS32(pSSM, &pThis->hdma);
+    SSMR3GetS32(pSSM, &pThis->port);
+    SSMR3GetS32(pSSM, &pThis->ver);
+    SSMR3GetS32(pSSM, &pThis->in_index);
+    SSMR3GetS32(pSSM, &pThis->out_data_len);
+    SSMR3GetS32(pSSM, &pThis->fmt_stereo);
+    SSMR3GetS32(pSSM, &pThis->fmt_signed);
+    SSMR3GetS32(pSSM, &pThis->fmt_bits);
+
+    SSMR3GetU32(pSSM, (uint32_t *)&pThis->fmt);
+
+    SSMR3GetS32(pSSM, &pThis->dma_auto);
+    SSMR3GetS32(pSSM, &pThis->block_size);
+    SSMR3GetS32(pSSM, &pThis->fifo);
+    SSMR3GetS32(pSSM, &pThis->freq);
+    SSMR3GetS32(pSSM, &pThis->time_const);
+    SSMR3GetS32(pSSM, &pThis->speaker);
+    SSMR3GetS32(pSSM, &pThis->needed_bytes);
+    SSMR3GetS32(pSSM, &pThis->cmd);
+    SSMR3GetS32(pSSM, &pThis->use_hdma);
+    SSMR3GetS32(pSSM, &pThis->highspeed);
+    SSMR3GetS32(pSSM, &pThis->can_write);
+    SSMR3GetS32(pSSM, &pThis->v2x6);
+
+    SSMR3GetU8 (pSSM, &pThis->csp_param);
+    SSMR3GetU8 (pSSM, &pThis->csp_value);
+    SSMR3GetU8 (pSSM, &pThis->csp_mode);
+    SSMR3GetU8 (pSSM, &pThis->csp_param);   /* Bug compatible! */
+    SSMR3GetMem(pSSM, pThis->csp_regs, 256);
+    SSMR3GetU8 (pSSM, &pThis->csp_index);
+    SSMR3GetMem(pSSM, pThis->csp_reg83, 4);
+    SSMR3GetS32(pSSM, &pThis->csp_reg83r);
+    SSMR3GetS32(pSSM, &pThis->csp_reg83w);
+
+    SSMR3GetMem(pSSM, pThis->in2_data, sizeof (pThis->in2_data));
+    SSMR3GetMem(pSSM, pThis->out_data, sizeof (pThis->out_data));
+    SSMR3GetU8 (pSSM, &pThis->test_reg);
+    SSMR3GetU8 (pSSM, &pThis->last_read_byte);
+
+    SSMR3GetS32(pSSM, &pThis->nzero);
+    SSMR3GetS32(pSSM, &pThis->left_till_irq);
+    SSMR3GetS32(pSSM, &pThis->dma_running);
+    SSMR3GetS32(pSSM, &pThis->bytes_per_second);
+    SSMR3GetS32(pSSM, &pThis->align);
+
+    SSMR3GetS32(pSSM, &pThis->mixer_nreg);
+    SSMR3GetMem(pSSM, pThis->mixer_regs, 256);
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+#if 0
+    PSB16DRIVER pDrv;
+    RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+    {
+        if (pDrv->Out.pStrmOut)
+        {
+            pDrv->pConnector->pfnCloseOut(pThis->pDrv, pDrv->Out.pStrmOut);
+            pDrv->Out.pStrmOut = NULL;
+        }
     }
+#endif
+#else
+    AUD_close_out (&pThis->card, pThis->voice);
+    pThis->voice = NULL;
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
 
-    for (i = 0; i < LENOFA (dsp_write_ports); i++) {
-        register_ioport_write (s->port + dsp_write_ports[i], 1, 1, dsp_write, s);
-    }
+    if (pThis->dma_running)
+    {
+        if (pThis->freq)
+        {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            PDMAUDIOSTREAMCFG streamCfg;
+            streamCfg.uHz           = pThis->freq;
+            streamCfg.cChannels     = 1 << pThis->fmt_stereo;
+            streamCfg.enmFormat     = pThis->fmt;
+            streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+            int rc = sb16OpenOut(pThis, &streamCfg);
+            AssertRC(rc);
+#else
+            pThis->audio_free = 0;
 
-    for (i = 0; i < LENOFA (dsp_read_ports); i++) {
-        register_ioport_read (s->port + dsp_read_ports[i], 1, 1, dsp_read, s);
-    }
+            audsettings_t as;
+            as.freq = pThis->freq;
+            as.nchannels = 1 << pThis->fmt_stereo;
+            as.fmt = pThis->fmt;
+            as.endianness = 0;
+            pThis->voice = AUD_open_out (
+                &pThis->card,
+                pThis->voice,
+                "sb16",
+                pThis,
+                sb16AudioCallback,
+                &as
+                );
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+        }
 
-    register_ioport_write (s->port + 0x4, 1, 1, mixer_write_indexb, s);
-    register_ioport_write (s->port + 0x4, 1, 2, mixer_write_indexw, s);
-    register_ioport_read (s->port + 0x5, 1, 1, mixer_read, s);
-    register_ioport_write (s->port + 0x5, 1, 1, mixer_write_datab, s);
+        sb16Control(pThis, 1);
+        sb16SpeakerControl(pThis, pThis->speaker);
+    }
 
-    DMA_register_channel (s->hdma, SB_read_DMA, s);
-    DMA_register_channel (s->dma, SB_read_DMA, s);
-    s->can_write = 1;
+    /* Update the master (mixer) and PCM out volumes. */
+    sb16SetMasterVolume(pThis);
+    sb16SetPcmOutVolume(pThis);
 
-    register_savevm ("sb16", 0, 1, SB_save, SB_load, s);
-    AUD_register_card (audio, "sb16", &s->card);
-    return 0;
+    return VINF_SUCCESS;
 }
 
-#else /* VBOX */
-
-
-static DECLCALLBACK(int) sb16LiveExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
+static DECLCALLBACK(int) sb16LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass)
 {
-    SB16State *pThis = PDMINS_2_DATA (pDevIns, SB16State *);
+    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
 
     SSMR3PutS32(pSSM, pThis->irqCfg);
     SSMR3PutS32(pSSM, pThis->dmaCfg);
@@ -1774,19 +2041,18 @@ static DECLCALLBACK(int) sb16LiveExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint
     return VINF_SSM_DONT_CALL_AGAIN;
 }
 
-static DECLCALLBACK(int) sb16SaveExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
+static DECLCALLBACK(int) sb16SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
 {
-    SB16State *pThis = PDMINS_2_DATA (pDevIns, SB16State *);
+    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
 
-    sb16LiveExec (pDevIns, pSSM, 0);
-    SB_save (pSSM, pThis);
+    sb16LiveExec(pDevIns, pSSM, 0);
+    sb16Save(pSSM, pThis);
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(int) sb16LoadExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM,
-                                       uint32_t uVersion, uint32_t uPass)
+static DECLCALLBACK(int) sb16LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
 {
-    SB16State *pThis = PDMINS_2_DATA (pDevIns, SB16State *);
+    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
 
     AssertMsgReturn(    uVersion == SB16_SAVE_STATE_VERSION
                     ||  uVersion == SB16_SAVE_STATE_VERSION_VBOX_30,
@@ -1810,7 +2076,8 @@ static DECLCALLBACK(int) sb16LoadExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM,
             || dma  != pThis->dmaCfg
             || hdma != pThis->hdmaCfg
             || port != pThis->portCfg
-            || ver  != pThis->verCfg )
+            || ver  != pThis->verCfg)
+        {
             return SSMR3SetCfgError(pSSM, RT_SRC_POS,
                                     N_("config changed: irq=%x/%x dma=%x/%x hdma=%x/%x port=%x/%x ver=%x/%x (saved/config)"),
                                     irq,  pThis->irqCfg,
@@ -1818,30 +2085,137 @@ static DECLCALLBACK(int) sb16LoadExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM,
                                     hdma, pThis->hdmaCfg,
                                     port, pThis->portCfg,
                                     ver,  pThis->verCfg);
+        }
     }
+
     if (uPass != SSM_PASS_FINAL)
         return VINF_SUCCESS;
 
-    SB_load(pSSM, pThis, uVersion);
+    sb16Load(pSSM, pThis, uVersion);
     return VINF_SUCCESS;
 }
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+static int sb16OpenOut(PSB16STATE pThis, PPDMAUDIOSTREAMCFG pCfg)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    int rc = VINF_SUCCESS;
+
+    PSB16DRIVER pDrv;
+    uint8_t uLUN = 0;
+    char *pszDesc;
+    RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+    {
+        if (RTStrAPrintf(&pszDesc, "[LUN#%RU8] sb16.po", uLUN) <= 0)
+        {
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        int rc2 = pDrv->pConnector->pfnOpenOut(pDrv->pConnector, pszDesc, pCfg, &pDrv->Out.pStrmOut);
+        LogFlowFunc(("LUN#%RU8: Opened output with rc=%Rrc\n", uLUN, rc));
+        if (rc2 == VINF_SUCCESS) /* Note: Could return VWRN_ALREADY_EXISTS. */
+        {
+            audioMixerRemoveStream(pThis->pSinkOutput, pDrv->Out.phStrmOut);
+            rc = audioMixerAddStreamOut(pThis->pSinkOutput,
+                                        pDrv->pConnector, pDrv->Out.pStrmOut,
+                                        0 /* uFlags */,
+                                        &pDrv->Out.phStrmOut);
+        }
+
+        RTStrFree(pszDesc);
+
+        if (RT_FAILURE(rc2))
+        {
+            if (RT_SUCCESS(rc))
+                rc = rc2;
+            break;
+        }
+
+        uLUN++;
+    }
+    /* Ensure volume gets propagated. */
+    audioMixerInvalidate(pThis->pMixer);
+
+    return rc;
+}
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+/**
+ * @interface_method_impl{PDMDEVREG,pfnReset}
+ */
+static DECLCALLBACK(void) sb16DevReset(PPDMDEVINS pDevIns)
+{
+    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
+
+    /* Bring back the device to initial state, and especially make
+     * sure there's no interrupt or DMA activity.
+     */
+    PDMDevHlpISASetIrq(pThis->pDevIns, pThis->irq, 0);
+
+    pThis->mixer_regs[0x82] = 0;
+    pThis->csp_regs[5]      = 1;
+    pThis->csp_regs[9]      = 0xf8;
+
+    pThis->dma_auto = 0;
+    pThis->in_index = 0;
+    pThis->out_data_len = 0;
+    pThis->left_till_irq = 0;
+    pThis->needed_bytes = 0;
+    pThis->block_size = -1;
+    pThis->nzero = 0;
+    pThis->highspeed = 0;
+    pThis->v2x6 = 0;
+    pThis->cmd = -1;
+
+    sb16MixerReset(pThis);
+    sb16SpeakerControl(pThis, 0);
+    sb16Control(pThis, 0);
+    sb16ResetLegacy(pThis);
+}
+
 /**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
-static DECLCALLBACK(void *) sb16QueryInterface (struct PDMIBASE *pInterface,
-                                                const char *pszIID)
+static DECLCALLBACK(void *) sb16QueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
 {
-    SB16State *pThis = RT_FROM_MEMBER(pInterface, SB16State, IBase);
+    PSB16STATE pThis = RT_FROM_MEMBER(pInterface, SB16STATE, IBase);
     Assert(&pThis->IBase == pInterface);
 
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->IBase);
     return NULL;
 }
 
-static DECLCALLBACK(int) sb16Construct (PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle)
+/**
+ * @interface_method_impl{PDMDEVREG,pfnDestruct}
+ */
+static DECLCALLBACK(int) sb16Destruct(PPDMDEVINS pDevIns)
+{
+    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PSB16DRIVER pDrv;
+
+    RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+        pDrv->Out.phStrmOut = NULL;
+
+    pThis->pSinkOutput = NULL;
+
+    if (pThis->pMixer)
+    {
+        audioMixerDestroy(pThis->pMixer);
+        pThis->pMixer = NULL;
+    }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) sb16Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfgHandle)
 {
-    SB16State *s = PDMINS_2_DATA(pDevIns, SB16State *);
+    PSB16STATE pThis = PDMINS_2_DATA(pDevIns, PSB16STATE);
     int rc;
 
     /*
@@ -1861,105 +2235,197 @@ static DECLCALLBACK(int) sb16Construct (PPDMDEVINS pDevIns, int iInstance, PCFGM
     /*
      * Read config data.
      */
-    rc = CFGMR3QuerySIntDef(pCfgHandle, "IRQ", &s->irq, 5);
+    rc = CFGMR3QuerySIntDef(pCfgHandle, "IRQ", &pThis->irq, 5);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("Configuration error: Failed to get the \"IRQ\" value"));
-    s->irqCfg  = s->irq;
+    pThis->irqCfg  = pThis->irq;
 
-    rc = CFGMR3QuerySIntDef(pCfgHandle, "DMA", &s->dma, 1);
+    rc = CFGMR3QuerySIntDef(pCfgHandle, "DMA", &pThis->dma, 1);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("Configuration error: Failed to get the \"DMA\" value"));
-    s->dmaCfg  = s->dma;
+    pThis->dmaCfg  = pThis->dma;
 
-    rc = CFGMR3QuerySIntDef(pCfgHandle, "DMA16", &s->hdma, 5);
+    rc = CFGMR3QuerySIntDef(pCfgHandle, "DMA16", &pThis->hdma, 5);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("Configuration error: Failed to get the \"DMA16\" value"));
-    s->hdmaCfg = s->hdma;
+    pThis->hdmaCfg = pThis->hdma;
 
     RTIOPORT Port;
     rc = CFGMR3QueryPortDef(pCfgHandle, "Port", &Port, 0x220);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("Configuration error: Failed to get the \"Port\" value"));
-    s->port    = Port;
-    s->portCfg = Port;
+    pThis->port    = Port;
+    pThis->portCfg = Port;
 
     uint16_t u16Version;
     rc = CFGMR3QueryU16Def(pCfgHandle, "Version", &u16Version, 0x0405);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("Configuration error: Failed to get the \"Version\" value"));
-    s->ver     = u16Version;
-    s->verCfg  = u16Version;
+    pThis->ver     = u16Version;
+    pThis->verCfg  = u16Version;
 
     /*
      * Init instance data.
      */
-    s->pDevIns                 = pDevIns;
-    s->IBase.pfnQueryInterface = sb16QueryInterface;
-    s->cmd                     = -1;
+    pThis->pDevIns                 = pDevIns;
+    pThis->IBase.pfnQueryInterface = sb16QueryInterface;
+    pThis->cmd                     = -1;
 
-    s->mixer_regs[0x80]        = magic_of_irq (s->irq);
-    s->mixer_regs[0x81]        = (1 << s->dma) | (1 << s->hdma);
-    s->mixer_regs[0x82]        = 2 << 5;
+    pThis->mixer_regs[0x80]        = magic_of_irq (pThis->irq);
+    pThis->mixer_regs[0x81]        = (1 << pThis->dma) | (1 << pThis->hdma);
+    pThis->mixer_regs[0x82]        = 2 << 5;
 
-    s->csp_regs[5]             = 1;
-    s->csp_regs[9]             = 0xf8;
+    pThis->csp_regs[5]             = 1;
+    pThis->csp_regs[9]             = 0xf8;
 
-    reset_mixer(s);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    RTListInit(&pThis->lstDrv);
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+    sb16MixerReset(pThis);
 
     /*
-     * Create timer, register & attach stuff.
+     * Create timer(s), register & attach stuff.
      */
-    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, sb16Timer, s,
-                                TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "SB16 timer", &s->pTimer);
+    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, sb16TimerIRQ, pThis,
+                                TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "SB16 IRQ timer", &pThis->pTimerIRQ);
     if (RT_FAILURE(rc))
-        AssertMsgFailedReturn(("pfnTMTimerCreate -> %Rrc\n", rc), rc);
+        AssertMsgFailedReturn(("Error creating IRQ timer, rc=%Rrc\n", rc), rc);
 
-    rc = PDMDevHlpIOPortRegister(pDevIns, s->port + 0x04,  2, s,
+    rc = PDMDevHlpIOPortRegister(pDevIns, pThis->port + 0x04,  2, pThis,
                                  mixer_write, mixer_read, NULL, NULL, "SB16");
     if (RT_FAILURE(rc))
         return rc;
-    rc = PDMDevHlpIOPortRegister(pDevIns, s->port + 0x06, 10, s,
+    rc = PDMDevHlpIOPortRegister(pDevIns, pThis->port + 0x06, 10, pThis,
                                  dsp_write, dsp_read, NULL, NULL, "SB16");
     if (RT_FAILURE(rc))
         return rc;
 
-    rc = PDMDevHlpDMARegister(pDevIns, s->hdma, SB_read_DMA, s);
+    rc = PDMDevHlpDMARegister(pDevIns, pThis->hdma, sb16DMARead, pThis);
     if (RT_FAILURE(rc))
         return rc;
-    rc = PDMDevHlpDMARegister(pDevIns, s->dma, SB_read_DMA, s);
+    rc = PDMDevHlpDMARegister(pDevIns, pThis->dma, sb16DMARead, pThis);
     if (RT_FAILURE(rc))
         return rc;
 
-    s->can_write = 1;
+    pThis->can_write = 1;
 
-    rc = PDMDevHlpSSMRegister3(pDevIns, SB16_SAVE_STATE_VERSION, sizeof(*s), sb16LiveExec, sb16SaveExec, sb16LoadExec);
+    rc = PDMDevHlpSSMRegister3(pDevIns, SB16_SAVE_STATE_VERSION, sizeof(SB16STATE), sb16LiveExec, sb16SaveExec, sb16LoadExec);
     if (RT_FAILURE(rc))
         return rc;
 
-    rc = PDMDevHlpDriverAttach(pDevIns, 0, &s->IBase, &s->pDrvBase, "Audio Driver Port");
+    /*
+     * Attach driver.
+     */
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    uint8_t uLUN;
+    for (uLUN = 0; uLUN < UINT8_MAX; uLUN)
+    {
+        LogFunc(("Trying to attach driver for LUN #%RU8 ...\n", uLUN));
+        rc = sb16Attach(pDevIns, uLUN, PDM_TACH_FLAGS_NOT_HOT_PLUG);
+        if (RT_FAILURE(rc))
+        {
+            if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
+                rc = VINF_SUCCESS;
+            break;
+        }
+
+        uLUN++;
+    }
+
+    LogFunc(("cLUNs=%RU8, rc=%Rrc\n", uLUN, rc));
+#else
+    rc = PDMDevHlpDriverAttach(pDevIns, 0, &pThis->IBase, &pThis->pDrvBase, "Audio Driver Port");
     if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
-        Log(("sb16: No attached driver!\n"));
+        LogFunc(("SB16: No attached driver!\n"));
     else if (RT_FAILURE(rc))
-        AssertMsgFailedReturn(("Failed to attach SB16 LUN #0! rc=%Rrc\n", rc), rc);
+    {
+        AssertMsgFailed(("Failed to attach SB16 LUN #0! rc=%Rrc\n", rc));
+        return rc;
+    }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    sb16ResetLegacy(pThis);
+
+    PSB16DRIVER pDrv;
+    uLUN = 0;
+    RTListForEach(&pThis->lstDrv, pDrv, SB16DRIVER, Node)
+    {
+        PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector;
+        AssertPtr(pCon);
+
+        bool fIsOK = pCon->pfnIsOutputOK(pCon, pDrv->Out.pStrmOut);
+        if (fIsOK)
+        {
+            rc = pCon->pfnEnableOut(pCon, pDrv->Out.pStrmOut, true /* fEnable */);
+            fIsOK = RT_SUCCESS(rc);
+        }
+
+        if (!fIsOK)
+        {
+            /*
+             * Only primary drivers are critical for the VM to run. Everything else
+             * might not worth showing an own error message box in the GUI.
+             */
+            if (!(pDrv->Flags & PDMAUDIODRVFLAG_PRIMARY))
+                continue;
+
+            LogRel(("SB16: Warning: Unable to enable/use output for LUN#%RU8\n", uLUN));
+
+            pCon->pfnCloseOut(pCon, pDrv->Out.pStrmOut);
+            pDrv->Out.pStrmOut = NULL;
+
+            pThis->pDrv->pfnInitNull(pThis->pDrv);
+
+            PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
+                N_("No audio devices could be opened. Selecting the NULL audio backend "
+                   "with the consequence that no sound is audible"));
+        }
+
+        uLUN++;
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, sb16TimerIO, pThis,
+                                    TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "SB16 IO timer", &pThis->pTimerIO);
+        if (RT_FAILURE(rc))
+            AssertMsgFailedReturn(("Error creating I/O timer, rc=%Rrc\n", rc), rc);
+        else
+        {
+            pThis->uTicksIO = PDMDevHlpTMTimeVirtGetFreq(pDevIns) / 200; /** Hz. @todo Make this configurable! */
+            if (pThis->uTicksIO < 100)
+                pThis->uTicksIO = 100;
+            LogFunc(("I/O timer ticks=%RU64\n", pThis->uTicksIO));
 
-    AUD_register_card("sb16", &s->card);
-    legacy_reset(s);
+            /* Fire off timer. */
+            TMTimerSet(pThis->pTimerIO, TMTimerGet(pThis->pTimerIO) + pThis->uTicksIO);
+        }
+    }
+#else
+    AUD_register_card("sb16", &pThis->card);
+    sb16ResetLegacy(pThis);
 
-    if (!AUD_is_host_voice_out_ok(s->voice))
+    if (!AUD_is_host_voice_out_ok(pThis->voice))
     {
         LogRel (("SB16: WARNING: Unable to open PCM OUT!\n"));
-        AUD_close_out(&s->card, s->voice);
-        s->voice = NULL;
+        AUD_close_out (&pThis->card, pThis->voice);
+        pThis->voice = NULL;
+
         AUD_init_null();
+
         PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
             N_("No audio devices could be opened. Selecting the NULL audio backend "
                "with the consequence that no sound is audible"));
     }
+#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
+
     return VINF_SUCCESS;
 }
 
@@ -1982,11 +2448,11 @@ const PDMDEVREG g_DeviceSB16 =
     /* cMaxInstances */
     1,
     /* cbInstance */
-    sizeof(SB16State),
+    sizeof(SB16STATE),
     /* pfnConstruct */
     sb16Construct,
     /* pfnDestruct */
-    NULL,
+    sb16Destruct,
     /* pfnRelocate */
     NULL,
     /* pfnMemSetup */
@@ -1994,7 +2460,7 @@ const PDMDEVREG g_DeviceSB16 =
     /* pfnPowerOn */
     NULL,
     /* pfnReset */
-    NULL,
+    sb16DevReset,
     /* pfnSuspend */
     NULL,
     /* pfnResume */
@@ -2014,6 +2480,3 @@ const PDMDEVREG g_DeviceSB16 =
     /* u32VersionEnd */
     PDM_DEVREG_VERSION
 };
-
-#endif /* VBOX */
-
diff --git a/src/VBox/Devices/Audio/DrvAudio.cpp b/src/VBox/Devices/Audio/DrvAudio.cpp
new file mode 100644
index 0000000..463ac22
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvAudio.cpp
@@ -0,0 +1,1947 @@
+/* $Id: DrvAudio.cpp $ */
+/** @file
+ * Intermediate audio driver header.
+ *
+ * @remarks Intermediate audio driver having audio device as one of the sink and
+ *          host backend as other.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on: audio.c from QEMU AUDIO subsystem.
+ *
+ * QEMU Audio subsystem
+ *
+ * Copyright (c) 2003-2005 Vassili Karpov (malc)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <VBox/vmm/pdm.h>
+#include <VBox/err.h>
+#include <VBox/vmm/mm.h>
+#include <VBox/vmm/pdmaudioifs.h>
+
+#include <iprt/alloc.h>
+#include <iprt/asm-math.h>
+#include <iprt/assert.h>
+#include <iprt/circbuf.h>
+#include <iprt/string.h>
+#include <iprt/uuid.h>
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+#include "VBoxDD.h"
+
+#include <ctype.h>
+#include <stdlib.h>
+
+#include "DrvAudio.h"
+#include "AudioMixBuffer.h"
+
+static int drvAudioDestroyGstIn(PDRVAUDIO pThis, PPDMAUDIOGSTSTRMIN pGstStrmIn);
+
+static int drvAudioAllocHstIn(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOHSTSTRMIN *ppHstStrmIn);
+static int drvAudioDestroyHstIn(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMIN pHstStrmIn);
+
+int drvAudioAddHstOut(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOHSTSTRMOUT *ppHstStrmOut)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut;
+
+    int rc;
+    if (   conf.fixed_out.enabled /** @todo Get rid of these settings! */
+        && conf.fixed_out.greedy)
+    {
+        rc = drvAudioAllocHstOut(pThis, pszName, pCfg, &pHstStrmOut);
+    }
+    else
+        rc = VERR_NOT_FOUND;
+
+    if (RT_FAILURE(rc))
+    {
+        pHstStrmOut = drvAudioFindSpecificOut(pThis, NULL, pCfg);
+        if (!pHstStrmOut)
+        {
+            rc = drvAudioAllocHstOut(pThis, pszName, pCfg, &pHstStrmOut);
+            if (RT_FAILURE(rc))
+                pHstStrmOut = drvAudioFindAnyHstOut(pThis, NULL /* pHstStrmOut */);
+        }
+
+        rc = pHstStrmOut ? VINF_SUCCESS : rc;
+    }
+
+    if (RT_SUCCESS(rc))
+        *ppHstStrmOut = pHstStrmOut;
+
+    return rc;
+}
+
+static PDMAUDIOFMT drvAudioGetConfFormat(PCFGMNODE pCfgHandle, const char *pszKey,
+                                         PDMAUDIOFMT enmDefault, bool *pfDefault)
+{
+    if (   pCfgHandle == NULL
+        || pszKey == NULL)
+    {
+        *pfDefault = true;
+        return enmDefault;
+    }
+
+    char *pszValue = NULL;
+    int rc = CFGMR3QueryStringAlloc(pCfgHandle, pszKey, &pszValue);
+    if (RT_FAILURE(rc))
+    {
+        *pfDefault = true;
+        return enmDefault;
+    }
+
+    PDMAUDIOFMT fmt = drvAudioHlpStringToFormat(pszValue);
+    if (fmt == AUD_FMT_INVALID)
+    {
+         *pfDefault = true;
+        return enmDefault;
+    }
+
+    *pfDefault = false;
+    return fmt;
+}
+
+static int drvAudioGetConfInt(PCFGMNODE pCfgHandle, const char *pszKey,
+                              int iDefault, bool *pfDefault)
+{
+
+    if (   pCfgHandle == NULL
+        || pszKey == NULL)
+    {
+        *pfDefault = true;
+        return iDefault;
+    }
+
+    uint64_t u64Data = 0;
+    int rc = CFGMR3QueryInteger(pCfgHandle, pszKey, &u64Data);
+    if (RT_FAILURE(rc))
+    {
+        *pfDefault = true;
+        return iDefault;
+
+    }
+
+    *pfDefault = false;
+    return u64Data;
+}
+
+static const char *drvAudioGetConfStr(PCFGMNODE pCfgHandle, const char *pszKey,
+                                      const char *pszDefault, bool *pfDefault)
+{
+    if (   pCfgHandle == NULL
+        || pszKey == NULL)
+    {
+        *pfDefault = true;
+        return pszDefault;
+    }
+
+    char *pszValue = NULL;
+    int rc = CFGMR3QueryStringAlloc(pCfgHandle, pszKey, &pszValue);
+    if (RT_FAILURE(rc))
+    {
+        *pfDefault = true;
+        return pszDefault;
+    }
+
+    *pfDefault = false;
+    return pszValue;
+}
+
+static int drvAudioProcessOptions(PCFGMNODE pCfgHandle, const char *pszPrefix, struct audio_option *opt)
+{
+    AssertPtrReturn(pCfgHandle, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszPrefix, VERR_INVALID_POINTER);
+    AssertPtrReturn(opt, VERR_INVALID_POINTER);
+
+    PCFGMNODE pCfgChildHandle = NULL;
+    PCFGMNODE pCfgChildChildHandle = NULL;
+
+   /* If pCfgHandle is NULL, let NULL be passed to get int and get string functions..
+    * The getter function will return default values.
+    */
+    if (pCfgHandle != NULL)
+    {
+       /* If its audio general setting, need to traverse to one child node.
+        * /Devices/ichac97/0/LUN#0/Config/Audio
+        */
+       if(!strncmp(pszPrefix, "AUDIO", 5)) /** @todo Use a #define */
+       {
+            pCfgChildHandle = CFGMR3GetFirstChild(pCfgHandle);
+            if(pCfgChildHandle)
+                pCfgHandle = pCfgChildHandle;
+        }
+        else
+        {
+            /* If its driver specific configuration , then need to traverse two level deep child
+             * child nodes. for eg. in case of DirectSoundConfiguration item
+             * /Devices/ichac97/0/LUN#0/Config/Audio/DirectSoundConfig
+             */
+            pCfgChildHandle = CFGMR3GetFirstChild(pCfgHandle);
+            if (pCfgChildHandle)
+            {
+                pCfgChildChildHandle = CFGMR3GetFirstChild(pCfgChildHandle);
+                if (pCfgChildChildHandle)
+                    pCfgHandle = pCfgChildChildHandle;
+            }
+        }
+    }
+
+    for (; opt->name; opt++)
+    {
+        LogFlowFunc(("Option value pointer for `%s' is not set\n",
+                     opt->name));
+        if (!opt->valp) {
+            LogFlowFunc(("Option value pointer for `%s' is not set\n",
+                   opt->name));
+            continue;
+        }
+
+        bool fUseDefault;
+
+        switch (opt->tag)
+        {
+            case AUD_OPT_BOOL:
+            case AUD_OPT_INT:
+            {
+                int *intp = (int *)opt->valp;
+                *intp = drvAudioGetConfInt(pCfgHandle, opt->name, *intp, &fUseDefault);
+
+                break;
+            }
+
+            case AUD_OPT_FMT:
+            {
+                PDMAUDIOFMT *fmtp = (PDMAUDIOFMT *)opt->valp;
+                *fmtp = drvAudioGetConfFormat(pCfgHandle, opt->name, *fmtp, &fUseDefault);
+
+                break;
+            }
+
+            case AUD_OPT_STR:
+            {
+                const char **strp = (const char **)opt->valp;
+                *strp = drvAudioGetConfStr(pCfgHandle, opt->name, *strp, &fUseDefault);
+
+                break;
+            }
+
+            default:
+                LogFlowFunc(("Bad value tag for option `%s' - %d\n", opt->name, opt->tag));
+                fUseDefault = false;
+                break;
+        }
+
+        if (!opt->overridenp)
+            opt->overridenp = &opt->overriden;
+
+        *opt->overridenp = !fUseDefault;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static bool drvAudioStreamCfgIsValid(PPDMAUDIOSTREAMCFG pCfg)
+{
+    bool fValid = (   pCfg->cChannels == 1
+                   || pCfg->cChannels == 2); /* Either stereo (2) or mono (1), per stream. */
+
+    fValid |= (   pCfg->enmEndianness == PDMAUDIOENDIANNESS_LITTLE
+               || pCfg->enmEndianness == PDMAUDIOENDIANNESS_BIG);
+
+    if (fValid)
+    {
+        switch (pCfg->enmFormat)
+        {
+            case AUD_FMT_S8:
+            case AUD_FMT_U8:
+            case AUD_FMT_S16:
+            case AUD_FMT_U16:
+            case AUD_FMT_S32:
+            case AUD_FMT_U32:
+                break;
+            default:
+                fValid = false;
+                break;
+        }
+    }
+
+    /** @todo Check for defined frequencies supported. */
+    fValid |= pCfg->uHz > 0;
+
+#ifdef DEBUG
+    drvAudioStreamCfgPrint(pCfg);
+#endif
+
+    LogFlowFunc(("pCfg=%p, fValid=%RTbool\n", pCfg, fValid));
+    return fValid;
+}
+
+void audio_pcm_info_clear_buf(PPDMPCMPROPS pPCMInfo, void *pvBuf, int len)
+{
+    if (!len)
+        return;
+
+    if (pPCMInfo->fSigned)
+    {
+        memset (pvBuf, 0, len << pPCMInfo->cShift);
+    }
+    else
+    {
+        switch (pPCMInfo->cBits)
+        {
+
+        case 8:
+            memset (pvBuf, 0x80, len << pPCMInfo->cShift);
+            break;
+
+        case 16:
+            {
+                int i;
+                uint16_t *p = (uint16_t *)pvBuf;
+                int shift = pPCMInfo->cChannels - 1;
+                short s = INT16_MAX;
+
+                if (pPCMInfo->fSwapEndian)
+                    s = RT_BSWAP_U16(s);
+
+                for (i = 0; i < len << shift; i++)
+                    p[i] = s;
+            }
+            break;
+
+        case 32:
+            {
+                int i;
+                uint32_t *p = (uint32_t *)pvBuf;
+                int shift = pPCMInfo->cChannels - 1;
+                int32_t s = INT32_MAX;
+
+                if (pPCMInfo->fSwapEndian)
+                    s = RT_BSWAP_U32(s);
+
+                for (i = 0; i < len << shift; i++)
+                    p[i] = s;
+            }
+            break;
+
+        default:
+            LogFlowFunc(("audio_pcm_info_clear_buf: invalid bits %d\n", pPCMInfo->cBits));
+            break;
+        }
+    }
+}
+
+int drvAudioDestroyHstOut(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("%s\n", pHstStrmOut->MixBuf.pszName));
+
+    int rc;
+    if (RTListIsEmpty(&pHstStrmOut->lstGstStrmOut))
+    {
+        rc = pThis->pHostDrvAudio->pfnFiniOut(pThis->pHostDrvAudio, pHstStrmOut);
+        if (RT_SUCCESS(rc))
+        {
+            drvAudioHstOutFreeRes(pHstStrmOut);
+
+            /* Remove from driver instance list. */
+            RTListNodeRemove(&pHstStrmOut->Node);
+
+            RTMemFree(pHstStrmOut);
+            pThis->cFreeOutputStreams++;
+            return VINF_SUCCESS;
+        }
+    }
+    else
+    {
+        rc = VERR_ACCESS_DENIED;
+        LogFlowFunc(("[%s] Still is being used, rc=%Rrc\n", pHstStrmOut->MixBuf.pszName, rc));
+    }
+
+    return rc;
+}
+
+int drvAudioDestroyGstOut(PDRVAUDIO pThis, PPDMAUDIOGSTSTRMOUT pGstStrmOut)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    if (pGstStrmOut)
+    {
+        drvAudioGstOutFreeRes(pGstStrmOut);
+
+        if (pGstStrmOut->pHstStrmOut)
+        {
+            /* Unregister from parent first. */
+            RTListNodeRemove(&pGstStrmOut->Node);
+
+            /* Try destroying the associated host output stream. This could
+             * be skipped if there are other guest output streams with this
+             * host stream. */
+            drvAudioDestroyHstOut(pThis, pGstStrmOut->pHstStrmOut);
+        }
+
+        RTMemFree(pGstStrmOut);
+    }
+
+    return VINF_SUCCESS;
+}
+
+PPDMAUDIOHSTSTRMIN drvAudioFindNextHstIn(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    if (pHstStrmIn)
+    {
+        if (RTListNodeIsLast(&pThis->lstHstStrmIn, &pHstStrmIn->Node))
+            return NULL;
+
+        return RTListNodeGetNext(&pHstStrmIn->Node, PDMAUDIOHSTSTRMIN, Node);
+    }
+
+    return RTListGetFirst(&pThis->lstHstStrmIn, PDMAUDIOHSTSTRMIN, Node);
+}
+
+PPDMAUDIOHSTSTRMIN drvAudioFindNextEnabledHstIn(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    while ((pHstStrmIn = drvAudioFindNextHstIn(pThis, pHstStrmIn)))
+        if (pHstStrmIn->fEnabled)
+            return pHstStrmIn;
+
+    return NULL;
+}
+
+PPDMAUDIOHSTSTRMIN drvAudioFindNextEqHstIn(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                           PPDMAUDIOSTREAMCFG pCfg)
+{
+    while ((pHstStrmIn = drvAudioFindNextHstIn(pThis, pHstStrmIn)))
+        if (drvAudioPCMPropsAreEqual(&pHstStrmIn->Props, pCfg))
+            return pHstStrmIn;
+
+    return NULL;
+}
+
+static int drvAudioHstInAdd(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PDMAUDIORECSOURCE enmRecSource,
+                            PPDMAUDIOHSTSTRMIN *ppHstStrmIn)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppHstStrmIn, VERR_INVALID_POINTER);
+
+    PPDMAUDIOHSTSTRMIN pHstStrmIn;
+    int rc = drvAudioAllocHstIn(pThis, pszName, pCfg, enmRecSource, &pHstStrmIn);
+    if (RT_SUCCESS(rc))
+        *ppHstStrmIn = pHstStrmIn;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int drvAudioGstOutInit(PPDMAUDIOGSTSTRMOUT pGstStrmOut, PPDMAUDIOHSTSTRMOUT pHostStrmOut,
+                       const char *pszName, PPDMAUDIOSTREAMCFG pCfg)
+{
+    AssertPtrReturn(pGstStrmOut,  VERR_INVALID_POINTER);
+    AssertPtrReturn(pHostStrmOut, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName,      VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg,         VERR_INVALID_POINTER);
+
+    int rc = drvAudioStreamCfgToProps(pCfg, &pGstStrmOut->Props);
+    if (RT_SUCCESS(rc))
+    {
+        char *pszTemp;
+        if (RTStrAPrintf(&pszTemp, "%s (Guest)", pszName) <= 0)
+            return VERR_NO_MEMORY;
+
+        rc = audioMixBufInit(&pGstStrmOut->MixBuf, pszTemp, &pGstStrmOut->Props, audioMixBufSize(&pHostStrmOut->MixBuf));
+        if (RT_SUCCESS(rc))
+            rc = audioMixBufLinkTo(&pGstStrmOut->MixBuf, &pHostStrmOut->MixBuf);
+
+        RTStrFree(pszTemp);
+
+        if (RT_SUCCESS(rc))
+        {
+            pGstStrmOut->State.fActive = false;
+            pGstStrmOut->State.fEmpty  = true;
+
+            pGstStrmOut->State.pszName = RTStrDup(pszName);
+            if (!pGstStrmOut->State.pszName)
+                return VERR_NO_MEMORY;
+
+            pGstStrmOut->pHstStrmOut = pHostStrmOut;
+        }
+    }
+
+    LogFlowFunc(("pszName=%s, rc=%Rrc\n", pszName, rc));
+    return rc;
+}
+
+int drvAudioAllocHstOut(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOHSTSTRMOUT *ppHstStrmOut)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    if (!pThis->cFreeOutputStreams)
+    {
+        LogFlowFunc(("Maximum number of host output streams reached\n"));
+        return VERR_NO_MORE_HANDLES;
+    }
+
+    /* Validate backend configuration. */
+    if (!pThis->BackendCfg.cbStreamOut)
+    {
+        LogFlowFunc(("Backend output configuration not valid, bailing out\n"));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut = (PPDMAUDIOHSTSTRMOUT)RTMemAllocZ(pThis->BackendCfg.cbStreamOut);
+    if (!pHstStrmOut)
+    {
+        LogFlowFunc(("Error allocating host output stream with %zu bytes\n",
+                     pThis->BackendCfg.cbStreamOut));
+        return VERR_NO_MEMORY;
+    }
+
+    int rc;
+    bool fInitialized = false;
+
+    do
+    {
+        RTListInit(&pHstStrmOut->lstGstStrmOut);
+
+        uint32_t cSamples;
+        rc = pThis->pHostDrvAudio->pfnInitOut(pThis->pHostDrvAudio, pHstStrmOut, pCfg, &cSamples);
+        if (RT_FAILURE(rc))
+        {
+            LogFlowFunc(("Initializing host backend failed with rc=%Rrc\n", rc));
+            break;
+        }
+
+        fInitialized = true;
+
+        char *pszTemp;
+        if (RTStrAPrintf(&pszTemp, "%s (Host)", pszName) <= 0)
+        {
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        rc = audioMixBufInit(&pHstStrmOut->MixBuf, pszTemp, &pHstStrmOut->Props, cSamples);
+        if (RT_SUCCESS(rc))
+        {
+            RTListPrepend(&pThis->lstHstStrmOut, &pHstStrmOut->Node);
+            pThis->cFreeOutputStreams--;
+        }
+
+        RTStrFree(pszTemp);
+
+    } while (0);
+
+    if (RT_FAILURE(rc))
+    {
+        if (fInitialized)
+        {
+            int rc2 = pThis->pHostDrvAudio->pfnFiniOut(pThis->pHostDrvAudio, pHstStrmOut);
+            AssertRC(rc2);
+        }
+
+        drvAudioHstOutFreeRes(pHstStrmOut);
+        RTMemFree(pHstStrmOut);
+    }
+    else
+        *ppHstStrmOut = pHstStrmOut;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int drvAudioCreateStreamPairOut(PDRVAUDIO pThis, const char *pszName,
+                                PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    /*
+     * Try figuring out which audio stream configuration this backend
+     * should use. If fixed output is enabled the backend will be tied
+     * to a fixed rate (in Hz, among other parameters), regardless of
+     * what the backend could do else.
+     */
+    PPDMAUDIOSTREAMCFG pBackendCfg;
+    if (conf.fixed_out.enabled)
+        pBackendCfg = &conf.fixed_out.settings;
+    else
+        pBackendCfg = pCfg;
+
+    AssertPtrReturn(pBackendCfg, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("Using fixed audio output settings: %RTbool\n",
+                 RT_BOOL(conf.fixed_out.enabled)));
+
+    PPDMAUDIOGSTSTRMOUT pGstStrmOut =
+        (PPDMAUDIOGSTSTRMOUT)RTMemAllocZ(sizeof(PDMAUDIOGSTSTRMOUT));
+    if (!pGstStrmOut)
+    {
+        LogFlowFunc(("Failed to allocate memory for guest output stream \"%s\"\n", pszName));
+        return VERR_NO_MEMORY;
+    }
+
+    /*
+     * The host stream always will get the backend audio stream configuration.
+     */
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut;
+    int rc = drvAudioAddHstOut(pThis, pszName, pBackendCfg, &pHstStrmOut);
+    if (RT_FAILURE(rc))
+    {
+        LogFlowFunc(("Error adding host output stream \"%s\", rc=%Rrc\n", pszName, rc));
+
+        RTMemFree(pGstStrmOut);
+        return rc;
+    }
+
+    /*
+     * The guest stream always will get the audio stream configuration told
+     * by the device emulation (which in turn was/could be set by the guest OS).
+     */
+    rc = drvAudioGstOutInit(pGstStrmOut, pHstStrmOut, pszName, pCfg);
+    if (RT_SUCCESS(rc))
+    {
+        RTListPrepend(&pHstStrmOut->lstGstStrmOut, &pGstStrmOut->Node);
+
+        if (ppGstStrmOut)
+            *ppGstStrmOut = pGstStrmOut;
+    }
+
+    if (RT_FAILURE(rc))
+        drvAudioDestroyGstOut(pThis, pGstStrmOut);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static int drvAudioCreateStreamPairIn(PDRVAUDIO pThis, const char *pszName, PDMAUDIORECSOURCE enmRecSource,
+                                      PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMIN *ppGstStrmIn)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+
+/*
+     * Try figuring out which audio stream configuration this backend
+     * should use for the audio input data. If fixed input is enabled
+     * the backend will be tied to a fixed rate (in Hz, among other parameters),
+     * regardless of what the backend initially wanted to use.
+     */
+    PPDMAUDIOSTREAMCFG pBackendCfg;
+    if (conf.fixed_in.enabled)
+        pBackendCfg = &conf.fixed_in.settings;
+    else
+        pBackendCfg = pCfg;
+
+    AssertPtrReturn(pBackendCfg, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("Using fixed audio input settings: %RTbool\n",
+                 RT_BOOL(conf.fixed_in.enabled)));
+
+    PPDMAUDIOGSTSTRMIN pGstStrmIn = (PPDMAUDIOGSTSTRMIN)RTMemAllocZ(sizeof(PDMAUDIOGSTSTRMIN));
+    if (!pGstStrmIn)
+        return VERR_NO_MEMORY;
+
+    /*
+     * The host stream always will get the backend audio stream configuration.
+     */
+    PPDMAUDIOHSTSTRMIN pHstStrmIn;
+    int rc = drvAudioHstInAdd(pThis, pszName, pBackendCfg, enmRecSource, &pHstStrmIn);
+    if (RT_FAILURE(rc))
+    {
+        LogFunc(("Failed to add host audio input stream \"%s\", rc=%Rrc\n", pszName, rc));
+
+        RTMemFree(pGstStrmIn);
+        return rc;
+    }
+
+    /*
+     * The guest stream always will get the audio stream configuration told
+     * by the device emulation (which in turn was/could be set by the guest OS).
+     */
+    rc = drvAudioGstInInit(pGstStrmIn, pHstStrmIn, pszName, pCfg);
+    if (RT_SUCCESS(rc))
+    {
+        pHstStrmIn->pGstStrmIn = pGstStrmIn;
+
+        if (ppGstStrmIn)
+            *ppGstStrmIn = pGstStrmIn;
+    }
+    else
+        drvAudioDestroyGstIn(pThis, pGstStrmIn);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/**
+ * Initializes a guest input stream.
+ *
+ * @return  IPRT status code.
+ * @param   pGstStrmIn          Pointer to guest stream to initialize.
+ * @param   pHstStrmIn          Pointer to host input stream to associate this guest
+ *                              stream with.
+ * @param   pszName             Pointer to stream name to use for this stream.
+ * @param   pCfg                Pointer to stream configuration to use.
+ */
+int drvAudioGstInInit(PPDMAUDIOGSTSTRMIN pGstStrmIn, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                      const char *pszName, PPDMAUDIOSTREAMCFG pCfg)
+{
+    AssertPtrReturn(pGstStrmIn, VERR_INVALID_POINTER);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    int rc = drvAudioStreamCfgToProps(pCfg, &pGstStrmIn->Props);
+    if (RT_SUCCESS(rc))
+    {
+        char *pszTemp;
+        if (RTStrAPrintf(&pszTemp, "%s (Guest)", pszName) <= 0)
+            return VERR_NO_MEMORY;
+
+        rc = audioMixBufInit(&pGstStrmIn->MixBuf, pszTemp, &pGstStrmIn->Props, audioMixBufSize(&pHstStrmIn->MixBuf));
+        if (RT_SUCCESS(rc))
+            rc = audioMixBufLinkTo(&pHstStrmIn->MixBuf, &pGstStrmIn->MixBuf);
+
+        RTStrFree(pszTemp);
+
+        if (RT_SUCCESS(rc))
+        {
+#ifdef DEBUG
+            drvAudioStreamCfgPrint(pCfg);
+#endif
+            pGstStrmIn->State.fActive = false;
+            pGstStrmIn->State.fEmpty  = true;
+
+            pGstStrmIn->State.pszName = RTStrDup(pszName);
+            if (!pGstStrmIn->State.pszName)
+                return VERR_NO_MEMORY;
+
+            pGstStrmIn->pHstStrmIn = pHstStrmIn;
+        }
+    }
+
+    LogFlowFunc(("pszName=%s, rc=%Rrc\n", pszName, rc));
+    return rc;
+}
+
+static int drvAudioAllocHstIn(PDRVAUDIO pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg,
+                              PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOHSTSTRMIN *ppHstStrmIn)
+{
+    if (!pThis->cFreeInputStreams)
+    {
+        LogFlowFunc(("No more input streams free to use, bailing out\n"));
+        return VERR_NO_MORE_HANDLES;
+    }
+
+    /* Validate backend configuration. */
+    if (!pThis->BackendCfg.cbStreamIn)
+    {
+        LogFlowFunc(("Backend input configuration not valid, bailing out\n"));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    PPDMAUDIOHSTSTRMIN pHstStrmIn =
+        (PPDMAUDIOHSTSTRMIN)RTMemAllocZ(pThis->BackendCfg.cbStreamIn);
+    if (!pHstStrmIn)
+    {
+        LogFlowFunc(("Error allocating host innput stream with %RU32 bytes\n",
+                     pThis->BackendCfg.cbStreamOut));
+        return VERR_NO_MEMORY;
+    }
+
+    int rc;
+    bool fInitialized = false;
+
+    do
+    {
+        uint32_t cSamples;
+        rc = pThis->pHostDrvAudio->pfnInitIn(pThis->pHostDrvAudio, pHstStrmIn,
+                                             pCfg, enmRecSource, &cSamples);
+        if (RT_FAILURE(rc))
+        {
+            LogFlowFunc(("Initializing host backend failed with rc=%Rrc\n", rc));
+            break;
+        }
+
+        fInitialized = true;
+
+        char *pszTemp;
+        if (RTStrAPrintf(&pszTemp, "%s (Host)", pszName) <= 0)
+        {
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        rc = audioMixBufInit(&pHstStrmIn->MixBuf, pszTemp, &pHstStrmIn->Props, cSamples);
+        if (RT_SUCCESS(rc))
+        {
+            RTListPrepend(&pThis->lstHstStrmIn, &pHstStrmIn->Node);
+            pThis->cFreeInputStreams--;
+        }
+
+        RTStrFree(pszTemp);
+
+    } while (0);
+
+    if (RT_FAILURE(rc))
+    {
+        if (fInitialized)
+        {
+            int rc2 = pThis->pHostDrvAudio->pfnFiniIn(pThis->pHostDrvAudio,
+                                                      pHstStrmIn);
+            AssertRC(rc2);
+        }
+
+        drvAudioHstInFreeRes(pHstStrmIn);
+        RTMemFree(pHstStrmIn);
+    }
+    else
+        *ppHstStrmIn = pHstStrmIn;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/**
+ * Writes VM audio output data from the guest stream into the host stream.
+ * The attached host driver backend then will play out the audio in a
+ * later step then.
+ *
+ * @return  IPRT status code.
+ * @return  int
+ * @param   pThis
+ * @param   pGstStrmOut
+ * @param   pvBuf
+ * @param   cbBuf
+ * @param   pcbWritten
+ */
+int drvAudioWrite(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut,
+                  const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten)
+{
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    AssertPtrReturn(pGstStrmOut, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    AssertReturn(cbBuf, VERR_INVALID_PARAMETER);
+    /* pcbWritten is optional. */
+
+    if (!pThis->pHostDrvAudio->pfnIsEnabled(pThis->pHostDrvAudio, PDMAUDIODIR_OUT))
+        return VERR_NOT_AVAILABLE;
+
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut = pGstStrmOut->pHstStrmOut;
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    AssertMsg(pGstStrmOut->pHstStrmOut->fEnabled,
+              ("Writing to disabled host output stream \"%s\" not possible\n",
+              pHstStrmOut->MixBuf.pszName));
+
+    /*
+     * First, write data from the device emulation into our
+     * guest mixing buffer.
+     */
+    uint32_t cWritten;
+    int rc = audioMixBufWriteAt(&pGstStrmOut->MixBuf, 0 /* Offset in samples */, pvBuf, cbBuf, &cWritten);
+
+    /*
+     * Second, mix the guest mixing buffer with the host mixing
+     * buffer so that the host backend can play the data lateron.
+     */
+    uint32_t cMixed;
+    if (   RT_SUCCESS(rc)
+        && cWritten)
+    {
+        rc = audioMixBufMixToParent(&pGstStrmOut->MixBuf, cWritten, &cMixed);
+    }
+    else
+        cMixed = 0;
+
+    if (RT_SUCCESS(rc))
+    {
+        /* Return the number of samples which actually have been mixed
+         * down to the parent, regardless how much samples were written
+         * into the children buffer. */
+        if (pcbWritten)
+            *pcbWritten = AUDIOMIXBUF_S2B(&pGstStrmOut->MixBuf, cMixed);
+    }
+
+    LogFlowFunc(("%s -> %s: Written pvBuf=%p, cbBuf=%zu, cWritten=%RU32 (%RU32 bytes), cMixed=%RU32, rc=%Rrc\n",
+                 pGstStrmOut->MixBuf.pszName, pHstStrmOut->MixBuf.pszName, pvBuf, cbBuf, cWritten,
+                 AUDIOMIXBUF_S2B(&pGstStrmOut->MixBuf, cWritten), cMixed, rc));
+    return rc;
+}
+
+PPDMAUDIOHSTSTRMOUT drvAudioFindAnyHstOut(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    if (pHstStrmOut)
+    {
+        if (RTListNodeIsLast(&pThis->lstHstStrmOut, &pHstStrmOut->Node))
+            return NULL;
+
+        return RTListNodeGetNext(&pHstStrmOut->Node, PDMAUDIOHSTSTRMOUT, Node);
+    }
+
+    return RTListGetFirst(&pThis->lstHstStrmOut, PDMAUDIOHSTSTRMOUT, Node);
+}
+
+PPDMAUDIOHSTSTRMOUT drvAudioHstFindAnyEnabledOut(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMOUT pHostStrmOut)
+{
+    while ((pHostStrmOut = drvAudioFindAnyHstOut(pThis, pHostStrmOut)))
+    {
+        if (pHostStrmOut->fEnabled)
+            return pHostStrmOut;
+    }
+
+    return NULL;
+}
+
+PPDMAUDIOHSTSTRMOUT drvAudioFindSpecificOut(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                            PPDMAUDIOSTREAMCFG pCfg)
+{
+    while ((pHstStrmOut = drvAudioFindAnyHstOut(pThis, pHstStrmOut)))
+    {
+        if (drvAudioPCMPropsAreEqual(&pHstStrmOut->Props, pCfg))
+            return pHstStrmOut;
+    }
+
+    return NULL;
+}
+
+int drvAudioDestroyHstIn(PDRVAUDIO pThis, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("%s\n", pHstStrmIn->MixBuf.pszName));
+
+    int rc;
+    if (!pHstStrmIn->pGstStrmIn) /* No parent anymore? */
+    {
+        rc = pThis->pHostDrvAudio->pfnFiniIn(pThis->pHostDrvAudio, pHstStrmIn);
+        if (RT_SUCCESS(rc))
+        {
+            drvAudioHstInFreeRes(pHstStrmIn);
+
+            /* Remove from driver instance list. */
+            RTListNodeRemove(&pHstStrmIn->Node);
+
+            RTMemFree(pHstStrmIn);
+            pThis->cFreeInputStreams++;
+        }
+    }
+    else
+    {
+        rc = VERR_ACCESS_DENIED;
+        LogFlowFunc(("[%s] Still is being used, rc=%Rrc\n", pHstStrmIn->MixBuf.pszName, rc));
+    }
+
+    return rc;
+}
+
+static int drvAudioDestroyGstIn(PDRVAUDIO pThis, PPDMAUDIOGSTSTRMIN pGstStrmIn)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("%s\n", pGstStrmIn->MixBuf.pszName));
+
+    if (pGstStrmIn)
+    {
+        drvAudioGstInFreeRes(pGstStrmIn);
+
+        if (pGstStrmIn->pHstStrmIn)
+        {
+            /* Unlink child. */
+            pGstStrmIn->pHstStrmIn->pGstStrmIn = NULL;
+
+            /* Try destroying the associated host input stream. This could
+             * be skipped if there are other guest input streams with this
+             * host stream. */
+            drvAudioDestroyHstIn(pThis, pGstStrmIn->pHstStrmIn);
+        }
+
+        RTMemFree(pGstStrmIn);
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioQueryStatus(PPDMIAUDIOCONNECTOR pInterface,
+                                             uint32_t *pcbAvailIn, uint32_t *pcbFreeOut,
+                                             uint32_t *pcSamplesLive)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    /* pcbAvailIn is optional. */
+    /* pcbFreeOut is optional. */
+    /* pcSamplesLive is optional. */
+
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+
+    if (!pThis->pHostDrvAudio->pfnIsEnabled(pThis->pHostDrvAudio, PDMAUDIODIR_OUT))
+        return VERR_NOT_AVAILABLE;
+
+    int rc = VINF_SUCCESS;
+    uint32_t cSamplesLive = 0;
+
+    /*
+     * Playback.
+     */
+    uint32_t cbFreeOut = UINT32_MAX;
+
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut = NULL;
+    while ((pHstStrmOut = drvAudioHstFindAnyEnabledOut(pThis, pHstStrmOut)))
+    {
+        uint32_t cStreamsLive;
+        cSamplesLive = drvAudioHstOutSamplesLive(pHstStrmOut, &cStreamsLive);
+        if (!cStreamsLive)
+            cSamplesLive = 0;
+
+        /* Has this stream marked as disabled but there still were guest streams relying
+         * on it? Check if this stream now can be closed and do so, if possible. */
+        if (   pHstStrmOut->fPendingDisable
+            && !cStreamsLive)
+        {
+            /* Stop playing the current (pending) stream. */
+            int rc2 = pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut,
+                                                          PDMAUDIOSTREAMCMD_DISABLE);
+            if (RT_SUCCESS(rc2))
+            {
+                pHstStrmOut->fEnabled        = false;
+                pHstStrmOut->fPendingDisable = false;
+
+                LogFunc(("[%s] Disabling stream\n", pHstStrmOut->MixBuf.pszName));
+            }
+            else
+                LogFunc(("[%s] Backend vetoed against closing output stream, rc=%Rrc\n", pHstStrmOut->MixBuf.pszName, rc2));
+
+            continue;
+        }
+
+        LogFlowFunc(("[%s] cSamplesLive=%RU32\n", pHstStrmOut->MixBuf.pszName, cSamplesLive));
+
+        /*
+         * No live samples to play at the moment?
+         *
+         * Tell the device emulation for each connected guest stream how many
+         * bytes are free so that the device emulation can continue writing data to
+         * these streams.
+         */
+        PPDMAUDIOGSTSTRMOUT pGstStrmOut;
+        uint32_t cbFree2 = UINT32_MAX;
+        RTListForEach(&pHstStrmOut->lstGstStrmOut, pGstStrmOut, PDMAUDIOGSTSTRMOUT, Node)
+        {
+            if (pGstStrmOut->State.fActive)
+            {
+                /* Tell the sound device emulation how many samples are free
+                 * so that it can start writing PCM data to us. */
+                cbFree2 = RT_MIN(cbFree2, AUDIOMIXBUF_S2B_RATIO(&pGstStrmOut->MixBuf,
+                                                                audioMixBufFree(&pGstStrmOut->MixBuf)));
+
+                LogFlowFunc(("\t[%s] cbFree=%RU32\n", pGstStrmOut->MixBuf.pszName, cbFree2));
+            }
+        }
+
+        cbFreeOut = RT_MIN(cbFreeOut, cbFree2);
+    }
+
+    /*
+     * Recording.
+     */
+    uint32_t cbAvailIn = 0;
+
+    PPDMAUDIOHSTSTRMIN pHstStrmIn = NULL;
+    while ((pHstStrmIn = drvAudioFindNextEnabledHstIn(pThis, pHstStrmIn)))
+    {
+        /* Call the host backend to capture the audio input data. */
+        uint32_t cSamplesCaptured;
+        int rc2 = pThis->pHostDrvAudio->pfnCaptureIn(pThis->pHostDrvAudio, pHstStrmIn,
+                                                     &cSamplesCaptured);
+        if (RT_FAILURE(rc2))
+            continue;
+
+        PPDMAUDIOGSTSTRMIN pGstStrmIn = pHstStrmIn->pGstStrmIn;
+        AssertPtrBreak(pGstStrmIn);
+
+        if (pGstStrmIn->State.fActive)
+        {
+            cbAvailIn = RT_MAX(cbAvailIn, AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf,
+                                                          audioMixBufMixed(&pHstStrmIn->MixBuf)));
+
+            LogFlowFunc(("\t[%s] cbFree=%RU32\n", pHstStrmIn->MixBuf.pszName, cbAvailIn));
+        }
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        if (cbFreeOut == UINT32_MAX)
+            cbFreeOut = 0;
+
+        if (pcbAvailIn)
+            *pcbAvailIn = cbAvailIn;
+
+        if (pcbFreeOut)
+            *pcbFreeOut = cbFreeOut;
+
+        if (pcSamplesLive)
+            *pcSamplesLive = cSamplesLive;
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvAudioPlayOut(PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcSamplesPlayed)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    /* pcSamplesPlayed is optional. */
+
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+
+    int rc = VINF_SUCCESS;
+    uint32_t cSamplesPlayedMax = 0;
+
+    /*
+     * Process all enabled host output streams.
+     */
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut = NULL;
+    while ((pHstStrmOut = drvAudioHstFindAnyEnabledOut(pThis, pHstStrmOut)))
+    {
+#if 0
+        uint32_t cStreamsLive;
+        uint32_t cSamplesLive = drvAudioHstOutSamplesLive(pHstStrmOut, &cStreamsLive);
+        if (!cStreamsLive)
+            cSamplesLive = 0;
+
+        /* Has this stream marked as disabled but there still were guest streams relying
+         * on it? Check if this stream now can be closed and do so, if possible. */
+        if (   pHstStrmOut->fPendingDisable
+            && !cStreamsLive)
+        {
+            /* Stop playing the current (pending) stream. */
+            int rc2 = pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut,
+                                                          PDMAUDIOSTREAMCMD_DISABLE);
+            if (RT_SUCCESS(rc2))
+            {
+                pHstStrmOut->fEnabled        = false;
+                pHstStrmOut->fPendingDisable = false;
+
+                LogFunc(("\t%p: Disabling stream\n", pHstStrmOut));
+            }
+            else
+                LogFunc(("\t%p: Backend vetoed against closing output stream, rc=%Rrc\n",
+                         pHstStrmOut, rc2));
+
+            continue;
+        }
+#endif
+
+        uint32_t cSamplesPlayed = 0;
+        int rc2 = pThis->pHostDrvAudio->pfnPlayOut(pThis->pHostDrvAudio, pHstStrmOut,
+                                                   &cSamplesPlayed);
+        if (RT_SUCCESS(rc2))
+            cSamplesPlayedMax = RT_MAX(cSamplesPlayed, cSamplesPlayedMax);
+
+        LogFlowFunc(("\t[%s] cSamplesPlayed=%RU32, rc=%Rrc\n", pHstStrmOut->MixBuf.pszName, cSamplesPlayed, rc2));
+
+        bool fNeedsCleanup = false;
+
+        PPDMAUDIOGSTSTRMOUT pGstStrmOut;
+        RTListForEach(&pHstStrmOut->lstGstStrmOut, pGstStrmOut, PDMAUDIOGSTSTRMOUT, Node)
+        {
+            if (   !pGstStrmOut->State.fActive
+                && pGstStrmOut->State.fEmpty)
+                continue;
+
+            if (audioMixBufIsEmpty(&pGstStrmOut->MixBuf))
+            {
+                pGstStrmOut->State.fEmpty = true;
+                fNeedsCleanup |= !pGstStrmOut->State.fActive;
+            }
+        }
+
+        if (fNeedsCleanup)
+        {
+            RTListForEach(&pHstStrmOut->lstGstStrmOut, pGstStrmOut, PDMAUDIOGSTSTRMOUT, Node)
+            {
+                if (!pGstStrmOut->State.fActive)
+                    drvAudioDestroyGstOut(pThis, pGstStrmOut);
+            }
+        }
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = cSamplesPlayedMax;
+    }
+
+    return rc;
+}
+
+static int drvAudioHostInit(PCFGMNODE pCfgHandle, PDRVAUDIO pThis)
+{
+    /* pCfgHandle is optional. */
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    NOREF(pCfgHandle);
+
+    LogFlowFuncEnter();
+
+    int rc = pThis->pHostDrvAudio->pfnInit(pThis->pHostDrvAudio);
+    if (RT_FAILURE(rc))
+    {
+        LogFlowFunc(("Initialization of lower driver failed with rc=%Rrc\n", rc));
+        return rc;
+    }
+
+    uint32_t cMaxHstStrmsOut = pThis->BackendCfg.cMaxHstStrmsOut;
+    uint32_t cbHstStrmsOut = pThis->BackendCfg.cbStreamOut;
+
+    if (cbHstStrmsOut)
+    {
+        pThis->cFreeOutputStreams = 1; /** @todo Make this configurable. */
+        if (pThis->cFreeOutputStreams > cMaxHstStrmsOut)
+        {
+            LogRel(("Audio: Warning: %RU32 output streams were requested, host driver only supports %RU32\n",
+                    pThis->cFreeOutputStreams, cMaxHstStrmsOut));
+            pThis->cFreeOutputStreams = cMaxHstStrmsOut;
+        }
+    }
+    else
+        pThis->cFreeOutputStreams = 0;
+
+    uint32_t cMaxHstStrmsIn = pThis->BackendCfg.cMaxHstStrmsIn;
+    uint32_t cbHstStrmIn = pThis->BackendCfg.cbStreamIn;
+
+    if (cbHstStrmIn)
+    {
+        /*
+         * Note:
+         *  - Our AC'97 emulation has two inputs, line (P.IN) and microphone (P.MIC).
+         ** @todo Document HDA.
+         */
+        pThis->cFreeInputStreams = 2; /** @todo Make this configurable. */
+        if (pThis->cFreeInputStreams > cMaxHstStrmsIn)
+        {
+            LogRel(("Audio: Warning: %RU32 input streams were requested, host driver only supports %RU32\n",
+                    pThis->cFreeInputStreams, cMaxHstStrmsIn));
+            pThis->cFreeInputStreams = cMaxHstStrmsIn;
+        }
+    }
+    else
+        pThis->cFreeInputStreams = 0;
+
+    LogFlowFunc(("cMaxHstStrmsOut=%RU32 (cb=%RU32), cMaxHstStrmsIn=%RU32 (cb=%RU32)\n",
+                 cMaxHstStrmsOut, cbHstStrmsOut, cMaxHstStrmsIn, cbHstStrmIn));
+
+    LogFlowFunc(("cFreeInputStreams=%RU8, cFreeOutputStreams=%RU8\n",
+                 pThis->cFreeInputStreams, pThis->cFreeOutputStreams));
+
+    LogFlowFuncLeave();
+    return VINF_SUCCESS;
+}
+
+static void drvAudioStateHandler(PPDMDRVINS pDrvIns, PDMAUDIOSTREAMCMD enmCmd)
+{
+    PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
+
+    LogFlowFunc(("enmCmd=%ld\n", enmCmd));
+
+    if (!pThis->pHostDrvAudio)
+        return;
+
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut = NULL;
+    while ((pHstStrmOut = drvAudioHstFindAnyEnabledOut(pThis, pHstStrmOut)))
+        pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, enmCmd);
+
+    PPDMAUDIOHSTSTRMIN pHstStrmIn = NULL;
+    while ((pHstStrmIn = drvAudioFindNextEnabledHstIn(pThis, pHstStrmIn)))
+        pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, enmCmd);
+}
+
+static struct audio_option audio_options[] =
+{
+    /* DAC */
+    {"DACFixedSettings", AUD_OPT_BOOL, &conf.fixed_out.enabled,
+     "Use fixed settings for host DAC", NULL, 0},
+
+    {"DACFixedFreq", AUD_OPT_INT, &conf.fixed_out.settings.uHz,
+     "Frequency for fixed host DAC", NULL, 0},
+
+    {"DACFixedFmt", AUD_OPT_FMT, &conf.fixed_out.settings.enmFormat,
+     "Format for fixed host DAC", NULL, 0},
+
+    {"DACFixedChannels", AUD_OPT_INT, &conf.fixed_out.settings.cChannels,
+     "Number of channels for fixed DAC (1 - mono, 2 - stereo)", NULL, 0},
+
+    {"DACVoices", AUD_OPT_INT, &conf.fixed_out.cStreams, /** @todo Rename! */
+     "Number of streams for DAC", NULL, 0},
+
+    /* ADC */
+    {"ADCFixedSettings", AUD_OPT_BOOL, &conf.fixed_in.enabled,
+     "Use fixed settings for host ADC", NULL, 0},
+
+    {"ADCFixedFreq", AUD_OPT_INT, &conf.fixed_in.settings.uHz,
+     "Frequency for fixed host ADC", NULL, 0},
+
+    {"ADCFixedFmt", AUD_OPT_FMT, &conf.fixed_in.settings.enmFormat,
+     "Format for fixed host ADC", NULL, 0},
+
+    {"ADCFixedChannels", AUD_OPT_INT, &conf.fixed_in.settings.cChannels,
+     "Number of channels for fixed ADC (1 - mono, 2 - stereo)", NULL, 0},
+
+    {"ADCVoices", AUD_OPT_INT, &conf.fixed_in.cStreams, /** @todo Rename! */
+     "Number of streams for ADC", NULL, 0},
+
+    /* Misc */
+    {"TimerFreq", AUD_OPT_INT, &conf.period.hz,
+     "Timer frequency in Hz (0 - use lowest possible)", NULL, 0},
+
+    {"PLIVE", AUD_OPT_BOOL, &conf.plive,
+     "(undocumented)", NULL, 0}, /** @todo What is this? */
+
+    NULL
+};
+
+static DECLCALLBACK(int) drvAudioInit(PCFGMNODE pCfgHandle, PPDMDRVINS pDrvIns)
+{
+    AssertPtrReturn(pCfgHandle, VERR_INVALID_POINTER);
+    AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);
+
+    PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
+    LogFlowFunc(("pDrvAudio=%p, pDrvIns=%p\n", pThis, pDrvIns));
+
+    RTListInit(&pThis->lstHstStrmIn);
+    RTListInit(&pThis->lstHstStrmOut);
+
+    int rc = VINF_SUCCESS;
+
+    /* Get the configuration data from the selected backend (if available). */
+    AssertPtr(pThis->pHostDrvAudio);
+    if (RT_LIKELY(pThis->pHostDrvAudio->pfnGetConf))
+        rc = pThis->pHostDrvAudio->pfnGetConf(pThis->pHostDrvAudio, &pThis->BackendCfg);
+
+    if (RT_SUCCESS(rc))
+    {
+        rc = drvAudioProcessOptions(pCfgHandle, "AUDIO", audio_options);
+        /** @todo Check for invalid options? */
+
+        pThis->cFreeOutputStreams = conf.fixed_out.cStreams;
+        pThis->cFreeInputStreams  = conf.fixed_in.cStreams;
+
+        if (!pThis->cFreeOutputStreams)
+            pThis->cFreeOutputStreams = 1;
+
+        if (!pThis->cFreeInputStreams)
+            pThis->cFreeInputStreams = 1;
+    }
+
+    /*
+     * If everything went well, initialize the lower driver.
+     */
+    if (RT_SUCCESS(rc))
+        rc = drvAudioHostInit(pCfgHandle, pThis);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvAudioInitNull(PPDMIAUDIOCONNECTOR pInterface)
+{
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+    NOREF(pThis);
+
+    LogRel(("Audio: Using NULL driver; no sound will be audible\n"));
+
+    /* Nothing to do here yet. */
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioRead(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn,
+                                      void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead)
+{
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    AssertPtrReturn(pGstStrmIn, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    AssertReturn(cbBuf, VERR_INVALID_PARAMETER);
+    /* pcbWritten is optional. */
+
+    if (!pThis->pHostDrvAudio->pfnIsEnabled(pThis->pHostDrvAudio, PDMAUDIODIR_IN))
+    {
+        if (pcbRead)
+            *pcbRead = 0;
+        return VINF_SUCCESS;
+    }
+
+    PPDMAUDIOHSTSTRMIN pHstStrmIn = pGstStrmIn->pHstStrmIn;
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    AssertMsg(pGstStrmIn->pHstStrmIn->fEnabled,
+              ("Reading from disabled host input stream \"%s\" not possible\n", pGstStrmIn->MixBuf.pszName));
+
+    /*
+     * Read from the parent buffer (that is, the guest buffer) which
+     * should have the audio data in the format the guest needs.
+     */
+    uint32_t cRead;
+    int rc = audioMixBufReadCirc(&pGstStrmIn->MixBuf,
+                                 pvBuf, cbBuf, &cRead);
+    if (RT_SUCCESS(rc))
+    {
+        audioMixBufFinish(&pGstStrmIn->MixBuf, cRead);
+
+        if (pcbRead)
+            *pcbRead = AUDIOMIXBUF_S2B(&pGstStrmIn->MixBuf, cRead);
+    }
+
+    LogFlowFunc(("cRead=%RU32 (%RU32 bytes), rc=%Rrc\n",
+                 cRead, AUDIOMIXBUF_S2B(&pGstStrmIn->MixBuf, cRead), rc));
+    return rc;
+}
+
+static DECLCALLBACK(int) drvAudioEnableOut(PPDMIAUDIOCONNECTOR pInterface,
+                                           PPDMAUDIOGSTSTRMOUT pGstStrmOut, bool fEnable)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    /* pGstStrmOut is optional. */
+
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+
+    if (pGstStrmOut)
+    {
+        PPDMAUDIOHSTSTRMOUT pHstStrmOut = pGstStrmOut->pHstStrmOut;
+        AssertPtr(pHstStrmOut);
+
+        LogFlowFunc(("%s: fEnable=%RTbool\n", pGstStrmOut->MixBuf.pszName, fEnable));
+
+        if (pGstStrmOut->State.fActive != fEnable)
+        {
+            if (fEnable)
+            {
+                pHstStrmOut->fPendingDisable = false;
+                if (!pHstStrmOut->fEnabled)
+                {
+                    pHstStrmOut->fEnabled = true;
+                    pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut,
+                                                        PDMAUDIOSTREAMCMD_ENABLE);
+                    /** @todo Check rc. */
+                }
+            }
+            else
+            {
+                if (pHstStrmOut->fEnabled)
+                {
+                    uint32_t cGstStrmsActive = 0;
+
+                    PPDMAUDIOGSTSTRMOUT pIter;
+                    RTListForEach(&pHstStrmOut->lstGstStrmOut, pIter, PDMAUDIOGSTSTRMOUT, Node)
+                    {
+                        if (pIter->State.fActive)
+                            cGstStrmsActive++;
+                    }
+
+                    pHstStrmOut->fPendingDisable = cGstStrmsActive == 1;
+                }
+            }
+
+            pGstStrmOut->State.fActive = fEnable;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioEnableIn(PPDMIAUDIOCONNECTOR pInterface,
+                                          PPDMAUDIOGSTSTRMIN pGstStrmIn, bool fEnable)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    /* pGstStrmIn is optional. */
+
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+
+    if (pGstStrmIn)
+    {
+        PPDMAUDIOHSTSTRMIN pHstStrmIn = pGstStrmIn->pHstStrmIn;
+        AssertPtr(pHstStrmIn);
+
+        LogFlowFunc(("%s: fEnable=%RTbool\n", pGstStrmIn->MixBuf.pszName, fEnable));
+
+        if (pGstStrmIn->State.fActive != fEnable)
+        {
+            if (fEnable)
+            {
+                if (!pHstStrmIn->fEnabled)
+                {
+                    int rc2 = pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn,
+                                                                 PDMAUDIOSTREAMCMD_ENABLE);
+                    if (RT_LIKELY(RT_SUCCESS(rc2)))
+                        pHstStrmIn->fEnabled = true;
+                    else
+                        LogFlowFunc(("Error opening host input stream in backend, rc=%Rrc\n", rc2));
+                }
+            }
+            else
+            {
+                if (pHstStrmIn->fEnabled)
+                {
+                    int rc2 = pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn,
+                                                                 PDMAUDIOSTREAMCMD_DISABLE);
+                    if (RT_LIKELY(RT_SUCCESS(rc2))) /* Did the backend veto? */
+                        pHstStrmIn->fEnabled = false;
+                    else
+                        LogFlowFunc(("Backend vetoed closing input stream, rc=%Rrc\n", rc2));
+                }
+            }
+
+            pGstStrmIn->State.fActive = fEnable;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(bool) drvAudioIsInputOK(PPDMIAUDIOCONNECTOR pInterface,
+                                            PPDMAUDIOGSTSTRMIN  pGstStrmIn)
+{
+    return (pGstStrmIn != NULL);
+}
+
+static DECLCALLBACK(bool) drvAudioIsOutputOK(PPDMIAUDIOCONNECTOR pInterface,
+                                             PPDMAUDIOGSTSTRMOUT pGstStrmOut)
+{
+    return (pGstStrmOut != NULL);
+}
+
+static DECLCALLBACK(int) drvAudioOpenIn(PPDMIAUDIOCONNECTOR pInterface, const char *pszName,
+                                        PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg,
+                                        PPDMAUDIOGSTSTRMIN *ppGstStrmIn)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppGstStrmIn, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppGstStrmIn, VERR_INVALID_POINTER);
+
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+
+    LogFlowFunc(("pszName=%s, pCfg=%p\n", pszName, pCfg));
+
+    if (!drvAudioStreamCfgIsValid(pCfg))
+    {
+        LogFunc(("Input stream configuration is not valid, bailing out\n"));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    PPDMAUDIOGSTSTRMIN pGstStrmIn = *ppGstStrmIn;
+    if (   pGstStrmIn
+        && drvAudioPCMPropsAreEqual(&pGstStrmIn->Props, pCfg))
+    {
+        LogFunc(("[%s] Exists and matches required configuration, skipping creation\n",
+                 pGstStrmIn->MixBuf.pszName));
+        return VWRN_ALREADY_EXISTS;
+    }
+
+    if (   !conf.fixed_in.enabled
+        && pGstStrmIn)
+    {
+        drvAudioDestroyGstIn(pThis, pGstStrmIn);
+        pGstStrmIn = NULL;
+    }
+
+    int rc;
+
+    if (pGstStrmIn)
+    {
+        PPDMAUDIOHSTSTRMIN pHstStrmIn = pGstStrmIn->pHstStrmIn;
+        AssertPtr(pHstStrmIn);
+
+        drvAudioGstInFreeRes(pGstStrmIn);
+
+        char *pszTemp;
+        if (RTStrAPrintf(&pszTemp, "%s (Guest)", pszName) <= 0)
+        {
+            RTMemFree(pGstStrmIn);
+            return VERR_NO_MEMORY;
+        }
+
+        rc = drvAudioGstInInit(pGstStrmIn, pHstStrmIn, pszName, pCfg);
+
+        RTStrFree(pszTemp);
+    }
+    else
+        rc = drvAudioCreateStreamPairIn(pThis, pszName, enmRecSource, pCfg, &pGstStrmIn);
+
+    if (pGstStrmIn)
+        *ppGstStrmIn = pGstStrmIn;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+DECLCALLBACK(int) drvAudioOpenOut(PPDMIAUDIOCONNECTOR pInterface, const char *pszName,
+                                  PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppGstStrmOut, VERR_INVALID_POINTER);
+
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+
+    LogFlowFunc(("pszName=%s, pCfg=%p\n", pszName, pCfg));
+
+    if (!drvAudioStreamCfgIsValid(pCfg))
+    {
+        LogFunc(("Output stream configuration is not valid, bailing out\n"));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    PPDMAUDIOGSTSTRMOUT pGstStrmOut = *ppGstStrmOut;
+    if (   pGstStrmOut
+        && drvAudioPCMPropsAreEqual(&pGstStrmOut->Props, pCfg))
+    {
+        LogFunc(("[%s] Exists and matches required configuration, skipping creation\n",
+                 pGstStrmOut->MixBuf.pszName));
+        return VWRN_ALREADY_EXISTS;
+    }
+
+#if 0
+    /* Any live samples that need to be updated after
+     * we set the new parameters? */
+    PPDMAUDIOGSTSTRMOUT pOldGstStrmOut = NULL;
+    uint32_t cLiveSamples = 0;
+
+    if (   conf.plive
+        && pGstStrmOut
+        && (   !pGstStrmOut->State.fActive
+            && !pGstStrmOut->State.fEmpty))
+    {
+        cLiveSamples = pGstStrmOut->cTotalSamplesWritten;
+        if (cLiveSamples)
+        {
+            pOldGstStrmOut = pGstStrmOut;
+            pGstStrmOut = NULL;
+        }
+    }
+#endif
+
+    if (   pGstStrmOut
+        && !conf.fixed_out.enabled)
+    {
+        drvAudioDestroyGstOut(pThis, pGstStrmOut);
+        pGstStrmOut = NULL;
+    }
+
+    int rc;
+    if (pGstStrmOut)
+    {
+        PPDMAUDIOHSTSTRMOUT pHstStrmOut = pGstStrmOut->pHstStrmOut;
+        AssertPtr(pHstStrmOut);
+
+        drvAudioGstOutFreeRes(pGstStrmOut);
+
+        rc = drvAudioGstOutInit(pGstStrmOut, pHstStrmOut, pszName, pCfg);
+    }
+    else
+    {
+        rc = drvAudioCreateStreamPairOut(pThis, pszName, pCfg, &pGstStrmOut);
+        if (RT_FAILURE(rc))
+            LogFunc(("Failed to create output stream \"%s\", rc=%Rrc\n", pszName, rc));
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        AssertPtr(pGstStrmOut);
+        *ppGstStrmOut = pGstStrmOut;
+#if 0
+        /* Update remaining live samples with new rate. */
+        if (cLiveSamples)
+        {
+            AssertPtr(pOldGstStrmOut);
+
+            uint32_t cSamplesMixed =
+                (cLiveSamples << pOldGstStrmOut->Props.cShift)
+                * pOldGstStrmOut->Props.cbPerSec
+                / (*ppGstStrmOut)->Props.cbPerSec;
+
+            pGstStrmOut->cTotalSamplesWritten += cSamplesMixed;
+        }
+#endif
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(bool) drvAudioIsActiveIn(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn)
+{
+    return pGstStrmIn ? pGstStrmIn->State.fActive : false;
+}
+
+static DECLCALLBACK(bool) drvAudioIsActiveOut(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut)
+{
+    return pGstStrmOut ? pGstStrmOut->State.fActive : false;
+}
+
+static DECLCALLBACK(void) drvAudioCloseIn(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn)
+{
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+    if (pGstStrmIn)
+        drvAudioDestroyGstIn(pThis, pGstStrmIn);
+}
+
+DECLCALLBACK(void) drvAudioCloseOut(PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut)
+{
+    PDRVAUDIO pThis = PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface);
+    if (pGstStrmOut)
+        drvAudioDestroyGstOut(pThis, pGstStrmOut);
+}
+
+/********************************************************************/
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) drvAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    LogFlowFunc(("pInterface=%p, pszIID=%s\n", pInterface, pszIID));
+
+    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVAUDIO  pThis   = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
+
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIAUDIOCONNECTOR, &pThis->IAudioConnector);
+
+    return NULL;
+}
+
+/**
+ * Power Off notification.
+ *
+ * @param   pDrvIns     The driver instance data.
+ */
+static DECLCALLBACK(void) drvAudioPowerOff(PPDMDRVINS pDrvIns)
+{
+    drvAudioStateHandler(pDrvIns, PDMAUDIOSTREAMCMD_DISABLE);
+}
+
+/**
+ * Destructs an audio driver instance.
+ *
+ * Most VM resources are freed by the VM. This callback is provided so that any non-VM
+ * resources can be freed correctly.
+ *
+ * @param   pDrvIns     The driver instance data.
+ */
+static DECLCALLBACK(void) drvAudioDestruct(PPDMDRVINS pDrvIns)
+{
+    LogFlowFuncEnter();
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
+
+    PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
+
+    /* Tear down all host output streams. */
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut = NULL;
+    while ((pHstStrmOut = drvAudioFindAnyHstOut(pThis, pHstStrmOut)))
+    {
+        pThis->pHostDrvAudio->pfnControlOut(pThis->pHostDrvAudio, pHstStrmOut, PDMAUDIOSTREAMCMD_DISABLE);
+        pThis->pHostDrvAudio->pfnFiniOut(pThis->pHostDrvAudio, pHstStrmOut);
+    }
+
+    /* Tear down all host input streams. */
+    PPDMAUDIOHSTSTRMIN pHstStrmIn = NULL;
+    while ((pHstStrmIn = drvAudioFindNextHstIn(pThis, pHstStrmIn)))
+    {
+        pThis->pHostDrvAudio->pfnControlIn(pThis->pHostDrvAudio, pHstStrmIn, PDMAUDIOSTREAMCMD_DISABLE);
+        pThis->pHostDrvAudio->pfnFiniIn(pThis->pHostDrvAudio, pHstStrmIn);
+    }
+
+    if (pThis->pHostDrvAudio->pfnShutdown)
+        pThis->pHostDrvAudio->pfnShutdown(pThis->pHostDrvAudio);
+
+    LogFlowFuncLeave();
+}
+
+/**
+ * Constructs an audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(int) drvAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle, uint32_t fFlags)
+{
+    LogFlowFunc(("pDrvIns=%#p, pCfgHandle=%#p, fFlags=%x\n", pDrvIns, pCfgHandle, fFlags));
+
+    PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                                   = pDrvIns;
+    /* IBase. */
+    pDrvIns->IBase.pfnQueryInterface                 = drvAudioQueryInterface;
+    /* IAudio. */
+    pThis->IAudioConnector.pfnQueryStatus            = drvAudioQueryStatus;
+    pThis->IAudioConnector.pfnRead                   = drvAudioRead;
+    pThis->IAudioConnector.pfnWrite                  = drvAudioWrite;
+    pThis->IAudioConnector.pfnIsInputOK              = drvAudioIsInputOK;
+    pThis->IAudioConnector.pfnIsOutputOK             = drvAudioIsOutputOK;
+    pThis->IAudioConnector.pfnInitNull               = drvAudioInitNull;
+    pThis->IAudioConnector.pfnEnableOut              = drvAudioEnableOut;
+    pThis->IAudioConnector.pfnEnableIn               = drvAudioEnableIn;
+    pThis->IAudioConnector.pfnCloseIn                = drvAudioCloseIn;
+    pThis->IAudioConnector.pfnCloseOut               = drvAudioCloseOut;
+    pThis->IAudioConnector.pfnOpenIn                 = drvAudioOpenIn;
+    pThis->IAudioConnector.pfnOpenOut                = drvAudioOpenOut;
+    pThis->IAudioConnector.pfnPlayOut                = drvAudioPlayOut;
+    pThis->IAudioConnector.pfnIsActiveIn             = drvAudioIsActiveIn;
+    pThis->IAudioConnector.pfnIsActiveOut            = drvAudioIsActiveOut;
+
+    /*
+     * Attach driver below and query its connector interface.
+     */
+    PPDMIBASE pDownBase;
+    int rc = PDMDrvHlpAttach(pDrvIns, fFlags, &pDownBase);
+    if (RT_FAILURE(rc))
+    {
+        LogRel(("Audio: Failed to attach to driver %p below (flags=0x%x), rc=%Rrc\n",
+                pDrvIns, fFlags, rc));
+        return rc;
+    }
+
+    pThis->pHostDrvAudio = PDMIBASE_QUERY_INTERFACE(pDownBase, PDMIHOSTAUDIO);
+    if (!pThis->pHostDrvAudio)
+    {
+        LogRel(("Audio: Failed to query interface for underlying host driver\n"));
+        return PDMDRV_SET_ERROR(pDrvIns, VERR_PDM_MISSING_INTERFACE_BELOW,
+                                N_("Host audio backend missing or invalid"));
+    }
+
+#ifdef DEBUG_andy
+    CFGMR3Dump(pCfgHandle);
+#endif
+
+    rc = drvAudioInit(pCfgHandle, pDrvIns);
+    if (RT_SUCCESS(rc))
+    {
+        pThis->fTerminate = false;
+        pThis->pDrvIns    = pDrvIns;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/**
+ * Suspend notification.
+ *
+ * @param   pDrvIns     The driver instance data.
+ */
+static DECLCALLBACK(void) drvAudioSuspend(PPDMDRVINS pDrvIns)
+{
+    drvAudioStateHandler(pDrvIns, PDMAUDIOSTREAMCMD_DISABLE);
+}
+
+/**
+ * Resume notification.
+ *
+ * @param   pDrvIns     The driver instance data.
+ */
+static DECLCALLBACK(void) drvAudioResume(PPDMDRVINS pDrvIns)
+{
+    drvAudioStateHandler(pDrvIns, PDMAUDIOSTREAMCMD_ENABLE);
+}
+
+/**
+ * Audio driver registration record.
+ */
+const PDMDRVREG g_DrvAUDIO =
+{
+    /* u32Version */
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "AUDIO",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "Audio connector driver",
+    /* fFlags */
+    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    2,
+    /* cbInstance */
+    sizeof(DRVAUDIO),
+    /* pfnConstruct */
+    drvAudioConstruct,
+    /* pfnDestruct */
+    drvAudioDestruct,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    drvAudioSuspend,
+    /* pfnResume */
+    drvAudioResume,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    drvAudioPowerOff,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
diff --git a/src/VBox/Devices/Audio/DrvAudio.h b/src/VBox/Devices/Audio/DrvAudio.h
new file mode 100644
index 0000000..fa30217
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvAudio.h
@@ -0,0 +1,200 @@
+/* $Id: DrvAudio.h $ */
+/** @file
+ * Intermediate audio driver header.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on: audio.h
+ *
+ * QEMU Audio subsystem header
+ *
+ * Copyright (c) 2003-2005 Vassili Karpov (malc)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef DRV_AUDIO_H
+#define DRV_AUDIO_H
+
+#include <limits.h>
+
+#include <iprt/circbuf.h>
+
+#include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pdm.h>
+#include <VBox/vmm/pdmaudioifs.h>
+
+typedef enum
+{
+    AUD_OPT_INT,
+    AUD_OPT_FMT,
+    AUD_OPT_STR,
+    AUD_OPT_BOOL
+} audio_option_tag_e;
+
+typedef struct audio_option
+{
+    const char *name;
+    audio_option_tag_e tag;
+    void *valp;
+    const char *descr;
+    int *overridenp;
+    int overriden;
+} audio_option;
+
+/**
+ * Audio driver instance data.
+ *
+ * @implements PDMIAUDIOCONNECTOR
+ */
+typedef struct DRVAUDIO
+{
+    /** Input/output processing thread. */
+    RTTHREAD                hThread;
+    /** Event for input/ouput processing. */
+    RTSEMEVENT              hEvent;
+    /** Shutdown indicator. */
+    bool                    fTerminate;
+    /** The audio interface presented to the device/driver above us. */
+    PDMIAUDIOCONNECTOR      IAudioConnector;
+    /** Pointer to the driver instance. */
+    PPDMDRVINS              pDrvIns;
+    /** Pointer to audio driver below us. */
+    PPDMIHOSTAUDIO          pHostDrvAudio;
+    RTLISTANCHOR            lstHstStrmIn;
+    RTLISTANCHOR            lstHstStrmOut;
+    /** Max. number of free input streams. */
+    uint8_t                 cFreeInputStreams;
+    /** Max. number of free output streams. */
+    uint8_t                 cFreeOutputStreams;
+    /** Audio configuration settings retrieved
+     *  from the backend. */
+    PDMAUDIOBACKENDCFG      BackendCfg;
+
+} DRVAUDIO, *PDRVAUDIO;
+
+/** Makes a PDRVBLOCK out of a PPDMIBLOCK. */
+#define PDMIAUDIOCONNECTOR_2_DRVAUDIO(pInterface) \
+    ( (PDRVAUDIO)((uintptr_t)pInterface - RT_OFFSETOF(DRVAUDIO, IAudioConnector)) )
+
+//const char *drvAudioHlpFormatToString(PDMAUDIOFMT fmt);
+const char *drvAudioRecSourceToString(PDMAUDIORECSOURCE enmRecSource);
+PDMAUDIOFMT drvAudioHlpStringToFormat(const char *pszFormat);
+
+bool drvAudioPCMPropsAreEqual(PPDMPCMPROPS info, PPDMAUDIOSTREAMCFG pCfg);
+int drvAudioStreamCfgToProps(PPDMAUDIOSTREAMCFG pCfg, PPDMPCMPROPS pProps);
+void drvAudioStreamCfgPrint(PPDMAUDIOSTREAMCFG pCfg);
+
+/* AUDIO IN function declarations. */
+void drvAudioHlpPcmSwFreeResourcesIn(PPDMAUDIOGSTSTRMIN pGstStrmIn);
+void drvAudioGstInFreeRes(PPDMAUDIOGSTSTRMIN pGstStrmIn);
+void drvAudioGstInRemove(PPDMAUDIOGSTSTRMIN pGstStrmIn);
+uint32_t drvAudioHstInFindMinCaptured(PPDMAUDIOHSTSTRMIN pHstStrmIn);
+void drvAudioHstInFreeRes(PPDMAUDIOHSTSTRMIN pHstStrmIn);
+uint32_t drvAudioHstInGetFree(PPDMAUDIOHSTSTRMIN pHstStrmIn);
+uint32_t drvAudioHstInGetLive(PPDMAUDIOHSTSTRMIN pHstStrmIn);
+void drvAudioGstInRemove(PPDMAUDIOGSTSTRMIN pGstStrmIn);
+int  drvAudioGstInInit(PPDMAUDIOGSTSTRMIN pGstStrmIn, PPDMAUDIOHSTSTRMIN pHstStrmIn, const char *pszName, PPDMAUDIOSTREAMCFG pCfg);
+
+PPDMAUDIOHSTSTRMIN drvAudioFindNextHstIn(PDRVAUDIO pDrvAudio, PPDMAUDIOHSTSTRMIN pHstStrmIn);
+PPDMAUDIOHSTSTRMIN drvAudioFindNextEnabledHstIn(PDRVAUDIO pDrvAudio, PPDMAUDIOHSTSTRMIN pHstStrmIn);
+PPDMAUDIOHSTSTRMIN drvAudioFindNextEqHstIn(PDRVAUDIO pDrvAudio, PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg);
+
+/* AUDIO OUT function declarations. */
+int  drvAudioGstOutAlloc(PPDMAUDIOGSTSTRMOUT pGstStrmOut);
+void drvAudioGstOutFreeRes(PPDMAUDIOGSTSTRMOUT pGstStrmOut);
+void drvAudioHstOutFreeRes(PPDMAUDIOHSTSTRMOUT pHstStrmOut);
+int  drvAudioDestroyGstOut(PDRVAUDIO pDrvAudio, PPDMAUDIOGSTSTRMOUT pGstStrmOut);
+void drvAudioDestroyHstOut(PDRVAUDIO pDrvAudio, PDMAUDIOHSTSTRMOUT pHstStrmOut);
+int  drvAudioGstOutInit(PPDMAUDIOGSTSTRMOUT pGstStrmOut, PPDMAUDIOHSTSTRMOUT pHstStrmOut, const char *pszName, PPDMAUDIOSTREAMCFG pCfg);
+
+PPDMAUDIOHSTSTRMOUT drvAudioFindAnyHstOut(PDRVAUDIO pDrvAudio, PPDMAUDIOHSTSTRMOUT pHstStrmOut);
+PPDMAUDIOHSTSTRMOUT drvAudioHstFindAnyEnabledOut(PDRVAUDIO pDrvAudio, PPDMAUDIOHSTSTRMOUT pHstStrmOut);
+PPDMAUDIOHSTSTRMOUT drvAudioFindSpecificOut(PDRVAUDIO pDrvAudio, PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg);
+int drvAudioAllocHstOut(PDRVAUDIO pDrvAudio, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOHSTSTRMOUT *ppHstStrmOut);
+int drvAudioHlpPcmHwAddOut(PDRVAUDIO pDrvAudio, PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOHSTSTRMOUT *ppHstStrmOut);
+int drvAudioHlpPcmCreateVoicePairOut(PDRVAUDIO pDrvAudio, const char *pszName, PPDMAUDIOSTREAMCFG pCfg, PPDMAUDIOGSTSTRMOUT *ppGstStrmOut);
+
+/* Common functions between DrvAudio and backends (host audio drivers). */
+int  drvAudioAttachCapture(PDRVAUDIO pDrvAudio, PPDMAUDIOHSTSTRMOUT pHstStrmOut);
+void drvAudioDetachCapture(PPDMAUDIOHSTSTRMOUT pHstStrmOut);
+uint32_t drvAudioHstOutSamplesLive(PPDMAUDIOHSTSTRMOUT pHstStrmOut, uint32_t *pcStreamsLive);
+
+void audio_pcm_info_clear_buf(PPDMPCMPROPS pPCMInfo, void *pvBuf, int len);
+
+typedef struct fixed_settings
+{
+    int enabled;
+    int cStreams;
+    int greedy;
+    PDMAUDIOSTREAMCFG settings;
+} fixed_settings;
+
+static struct {
+    struct fixed_settings fixed_out;
+    struct fixed_settings fixed_in;
+    union {
+        int hz;
+        int64_t ticks;
+    } period;
+    int plive;
+} conf = {
+
+    /* Fixed output settings. */
+    {                           /* DAC fixed settings */
+        1,                      /* enabled */
+        1,                      /* cStreams */
+        1,                      /* greedy */
+        {
+            44100,              /* freq */
+            2,                  /* nchannels */
+            AUD_FMT_S16,        /* fmt */
+            PDMAUDIOHOSTENDIANNESS
+        }
+    },
+
+    /* Fixed input settings. */
+    {                           /* ADC fixed settings */
+        1,                      /* enabled */
+        2,                      /* cStreams */
+        1,                      /* greedy */
+        {
+            44100,              /* freq */
+            2,                  /* nchannels */
+            AUD_FMT_S16,        /* fmt */
+            PDMAUDIOHOSTENDIANNESS
+        }
+    },
+
+    { 200 },                    /* frequency (in Hz) */
+    0,                          /* plive */ /** @todo Disable pending live? */
+};
+#endif /* DRV_AUDIO_H */
+
diff --git a/src/VBox/Devices/Audio/DrvAudioCommon.cpp b/src/VBox/Devices/Audio/DrvAudioCommon.cpp
new file mode 100644
index 0000000..2be7151
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvAudioCommon.cpp
@@ -0,0 +1,486 @@
+/* $Id: DrvAudioCommon.cpp $ */
+/** @file
+ * Intermedia audio driver, common routines. These are also used
+ * in the drivers which are bound to Main, e.g. the VRDE or the
+ * video audio recording drivers.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on: audio_template.h from QEMU AUDIO subsystem.
+ *
+ * QEMU Audio subsystem header
+ *
+ * Copyright (c) 2005 Vassili Karpov (malc)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <iprt/asm-math.h>
+#include <iprt/assert.h>
+#include <iprt/uuid.h>
+#include <iprt/string.h>
+#include <iprt/alloc.h>
+
+#include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pdm.h>
+#include <VBox/err.h>
+#include <VBox/vmm/mm.h>
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+#include <ctype.h>
+#include <stdlib.h>
+
+#include "DrvAudio.h"
+#include "AudioMixBuffer.h"
+
+bool drvAudioPCMPropsAreEqual(PPDMPCMPROPS pProps, PPDMAUDIOSTREAMCFG pCfg);
+
+const char *drvAudioRecSourceToString(PDMAUDIORECSOURCE enmRecSource)
+{
+    switch (enmRecSource)
+    {
+        case PDMAUDIORECSOURCE_MIC:     return "Microphone In";
+        case PDMAUDIORECSOURCE_CD:      return "CD";
+        case PDMAUDIORECSOURCE_VIDEO:   return "Video";
+        case PDMAUDIORECSOURCE_AUX:     return "AUX";
+        case PDMAUDIORECSOURCE_LINE_IN: return "Line In";
+        case PDMAUDIORECSOURCE_PHONE:   return "Phone";
+        default:
+            break;
+    }
+
+    AssertMsgFailed(("Bogus recording source %ld\n", enmRecSource));
+    return "Unknown";
+}
+
+const char *drvAudioHlpFormatToString(PDMAUDIOFMT enmFormat)
+{
+    switch (enmFormat)
+    {
+        case AUD_FMT_U8:
+            return "U8";
+
+        case AUD_FMT_U16:
+            return "U16";
+
+        case AUD_FMT_U32:
+            return "U32";
+
+        case AUD_FMT_S8:
+            return "S8";
+
+        case AUD_FMT_S16:
+            return "S16";
+
+        case AUD_FMT_S32:
+            return "S32";
+
+        default:
+            break;
+    }
+
+    AssertMsgFailed(("Bogus audio format %ld\n", enmFormat));
+    return "Invalid";
+}
+
+PDMAUDIOFMT drvAudioHlpStringToFormat(const char *pszFormat)
+{
+    if (!RTStrICmp(pszFormat, "u8"))
+        return AUD_FMT_U8;
+    else if (!RTStrICmp(pszFormat, "u16"))
+        return AUD_FMT_U16;
+    else if (!RTStrICmp(pszFormat, "u32"))
+        return AUD_FMT_U32;
+    else if (!RTStrICmp(pszFormat, "s8"))
+        return AUD_FMT_S8;
+    else if (!RTStrICmp(pszFormat, "s16"))
+        return AUD_FMT_S16;
+    else if (!RTStrICmp(pszFormat, "s32"))
+        return AUD_FMT_S32;
+
+    AssertMsgFailed(("Bogus audio format \"%s\"\n", pszFormat));
+    return AUD_FMT_INVALID;
+}
+
+/*********************************** In Stream Functions **********************************************/
+
+void drvAudioGstInFreeRes(PPDMAUDIOGSTSTRMIN pGstStrmIn)
+{
+    AssertPtrReturnVoid(pGstStrmIn);
+
+    if (pGstStrmIn->State.pszName)
+    {
+        RTStrFree(pGstStrmIn->State.pszName);
+        pGstStrmIn->State.pszName = NULL;
+    }
+
+    audioMixBufDestroy(&pGstStrmIn->MixBuf);
+}
+
+void drvAudioHstInFreeRes(PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    AssertPtrReturnVoid(pHstStrmIn);
+    audioMixBufDestroy(&pHstStrmIn->MixBuf);
+}
+
+void drvAudioGstOutFreeRes(PPDMAUDIOGSTSTRMOUT pGstStrmOut)
+{
+    if (!pGstStrmOut)
+        return;
+
+    if (pGstStrmOut->State.pszName)
+    {
+        RTStrFree(pGstStrmOut->State.pszName);
+        pGstStrmOut->State.pszName = NULL;
+    }
+
+    audioMixBufDestroy(&pGstStrmOut->MixBuf);
+}
+
+#if 0
+
+/**
+ * Finds the minimum number of not yet captured samples of all
+ * attached guest input streams for a certain host input stream.
+ *
+ * @return  uint32_t            Minimum number of not yet captured samples.
+ *                              UINT32_MAX if none found.
+ * @param   pHstStrmIn          Host input stream to check for.
+ */
+inline uint32_t drvAudioHstInFindMinCaptured(PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    AssertPtrReturn(pHstStrmIn, 0);
+    uint32_t cMinSamples = UINT32_MAX;
+
+    PPDMAUDIOGSTSTRMIN pGstStrmIn;
+    RTListForEach(&pHstStrmIn->lstGstStrmIn, pGstStrmIn, PDMAUDIOGSTSTRMIN, Node)
+    {
+        if (pGstStrmIn->State.fActive)
+            cMinSamples = RT_MIN(cMinSamples, audioMixBufMixed(&pGstStrmIn->MixBuf));
+    }
+
+#ifdef DEBUG_andy
+    LogFlowFunc(("cMinSamples=%RU32\n", cMinSamples));
+#endif
+    return cMinSamples;
+}
+
+uint32_t drvAudioHstInGetFree(PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    AssertPtrReturn(pHstStrmIn, 0);
+
+    return audioMixBufSize(&pHstStrmIn->MixBuf) - drvAudioHstInGetLive(pHstStrmIn);
+}
+
+uint32_t drvAudioHstInGetLive(PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    AssertPtrReturn(pHstStrmIn, 0);
+
+    uint32_t cMinSamplesCaptured = drvAudioHstInFindMinCaptured(pHstStrmIn);
+    uint32_t cSamplesCaptured = audioMixBufMixed(&pHstStrmIn->MixBuf);
+
+    Assert(cSamplesCaptured >= cMinSamplesCaptured);
+    uint32_t cSamplesLive = cSamplesCaptured - cMinSamplesCaptured;
+    Assert(cSamplesLive <= audioMixBufSize(&pHstStrmIn->MixBuf));
+
+#ifdef DEBUG_andy
+    LogFlowFunc(("cSamplesLive=%RU32\n", cSamplesLive));
+#endif
+    return cSamplesLive;
+}
+#endif
+
+void drvAudioHstOutFreeRes(PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    AssertPtrReturnVoid(pHstStrmOut);
+    audioMixBufDestroy(&pHstStrmOut->MixBuf);
+}
+
+#if 0
+/**
+ * Returns the number of live sample data (in bytes) of a certain
+ * guest input stream.
+ *
+ * @return  uint32_t            Live sample data (in bytes), 0 if none.
+ * @param   pGstStrmIn          Guest input stream to check for.
+ */
+uint32_t drvAudioGstInGetLiveBytes(PPDMAUDIOGSTSTRMIN pGstStrmIn)
+{
+    AssertPtrReturn(pGstStrmIn, 0);
+    AssertPtrReturn(pGstStrmIn->pHstStrmIn, 0);
+
+    Assert(pGstStrmIn->pHstStrmIn->cTotalSamplesCaptured >= pGstStrmIn->cTotalHostSamplesRead);
+    uint32_t cSamplesLive = pGstStrmIn->pHstStrmIn->cTotalSamplesCaptured - pGstStrmIn->cTotalHostSamplesRead;
+    if (!cSamplesLive)
+        return 0;
+    Assert(cSamplesLive <= pGstStrmIn->pHstStrmIn->cSamples);
+
+    /** @todo Document / refactor this! */
+    return (((int64_t) cSamplesLive << 32) / pGstStrmIn->State.uFreqRatio) << pGstStrmIn->Props.cShift;
+}
+
+
+/**
+ * Returns the total number of unused sample data (in bytes) of a certain
+ * guest output stream.
+ *
+ * @return  uint32_t            Number of unused sample data (in bytes), 0 if all used up.
+ * @param   pGstStrmOut         Guest output stream to check for.
+ */
+uint32_t drvAudioGstOutGetFreeBytes(PPDMAUDIOGSTSTRMOUT pGstStrmOut)
+{
+    AssertPtrReturn(pGstStrmOut, 0);
+
+    Assert(pGstStrmOut->cTotalSamplesWritten <= pGstStrmOut->pHstStrmOut->cSamples);
+    uint32_t cSamplesFree =   pGstStrmOut->pHstStrmOut->cSamples
+                            - pGstStrmOut->cTotalSamplesWritten;
+    if (!cSamplesFree)
+        return 0;
+
+    /** @todo Document / refactor this! */
+    return (((int64_t) cSamplesFree << 32) / pGstStrmOut->State.uFreqRatio) << pGstStrmOut->Props.cShift;
+}
+#endif
+
+bool drvAudioPCMPropsAreEqual(PPDMPCMPROPS pProps, PPDMAUDIOSTREAMCFG pCfg)
+{
+    int cBits = 8;
+    bool fSigned = false;
+
+    switch (pCfg->enmFormat)
+    {
+        case AUD_FMT_S8:
+            fSigned = true;
+        case AUD_FMT_U8:
+            break;
+
+        case AUD_FMT_S16:
+            fSigned = true;
+        case AUD_FMT_U16:
+            cBits = 16;
+            break;
+
+        case AUD_FMT_S32:
+            fSigned = true;
+        case AUD_FMT_U32:
+            cBits = 32;
+            break;
+
+        default:
+            AssertMsgFailed(("Unknown format %ld\n", pCfg->enmFormat));
+            break;
+    }
+
+    bool fEqual =    pProps->uHz         == pCfg->uHz
+                  && pProps->cChannels   == pCfg->cChannels
+                  && pProps->fSigned     == fSigned
+                  && pProps->cBits       == cBits
+                  && pProps->fSwapEndian == !(pCfg->enmEndianness == PDMAUDIOHOSTENDIANNESS);
+
+    LogFlowFunc(("fEqual=%RTbool\n", fEqual));
+    return fEqual;
+}
+
+int drvAudioStreamCfgToProps(PPDMAUDIOSTREAMCFG pCfg, PPDMPCMPROPS pProps)
+{
+    int rc = VINF_SUCCESS;
+
+    int cBits = 8, cShift = 0;
+    bool fSigned = false;
+
+    switch (pCfg->enmFormat)
+    {
+        case AUD_FMT_S8:
+            fSigned = true;
+        case AUD_FMT_U8:
+            break;
+
+        case AUD_FMT_S16:
+            fSigned = true;
+        case AUD_FMT_U16:
+            cBits = 16;
+            cShift = 1;
+            break;
+
+        case AUD_FMT_S32:
+            fSigned = true;
+        case AUD_FMT_U32:
+            cBits = 32;
+            cShift = 2;
+            break;
+
+        default:
+            AssertMsgFailed(("Unknown format %ld\n", pCfg->enmFormat));
+            rc = VERR_NOT_SUPPORTED;
+            break;
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        pProps->uHz         = pCfg->uHz;
+        pProps->cBits       = cBits;
+        pProps->fSigned     = fSigned;
+        pProps->cChannels   = pCfg->cChannels;
+        pProps->cShift      = (pCfg->cChannels == 2) + cShift;
+        pProps->uAlign      = (1 << pProps->cShift) - 1;
+        pProps->cbPerSec    = pProps->uHz << pProps->cShift;
+        pProps->fSwapEndian = pCfg->enmEndianness != PDMAUDIOHOSTENDIANNESS;
+    }
+
+#ifdef DEBUG
+    drvAudioStreamCfgPrint(pCfg);
+#endif
+
+    LogFlowFunc(("rc=%Rrc\n", rc));
+    return rc;
+}
+
+void drvAudioStreamCfgPrint(PPDMAUDIOSTREAMCFG pCfg)
+{
+    LogFlowFunc(("uHz=%RU32, cChannels=%RU8, enmFormat=",
+                 pCfg->uHz, pCfg->cChannels));
+
+    switch (pCfg->enmFormat)
+    {
+        case AUD_FMT_S8:
+            LogFlow(("S8"));
+            break;
+        case AUD_FMT_U8:
+            LogFlow(("U8"));
+            break;
+        case AUD_FMT_S16:
+            LogFlow(("S16"));
+            break;
+        case AUD_FMT_U16:
+            LogFlow(("U16"));
+            break;
+        case AUD_FMT_S32:
+            LogFlow(("S32"));
+            break;
+        case AUD_FMT_U32:
+            LogFlow(("U32"));
+            break;
+        default:
+            LogFlow(("invalid(%d)", pCfg->enmFormat));
+            break;
+    }
+
+    LogFlow((", endianness="));
+    switch (pCfg->enmEndianness)
+    {
+        case PDMAUDIOENDIANNESS_LITTLE:
+            LogFlow(("little\n"));
+            break;
+        case PDMAUDIOENDIANNESS_BIG:
+            LogFlow(("big\n"));
+            break;
+        default:
+            LogFlow(("invalid\n"));
+            break;
+    }
+}
+
+/**
+ * Returns the minimum number of live samples already written to all associated
+ * guest output streams of a specific host output stream.
+ *
+ * @return  uint32_t                Minimum number of total live samples already written to all
+ *                                  associated guest output streams, UINT32_MAX if none found.
+ * @param   pHstStrmOut             Host output stream to search in.
+ * @param   pcStreamsLive           Returns the number of live guest streams associated to
+ *                                  this host output stream. Optional.
+ */
+static uint32_t drvAudioHstOutMinSamplesMixed(PPDMAUDIOHSTSTRMOUT pHstStrmOut, uint32_t *pcStreamsLive)
+{
+    AssertPtrReturn(pHstStrmOut, 0);
+    /* pcStreamsLive is optional. */
+
+    uint32_t cStreamsLive = 0;
+    uint32_t cMinSamplesMixed = UINT32_MAX;
+    uint32_t cSamples;
+
+    PPDMAUDIOGSTSTRMOUT pGstStrmOut;
+    RTListForEach(&pHstStrmOut->lstGstStrmOut, pGstStrmOut, PDMAUDIOGSTSTRMOUT, Node)
+    {
+        if (    pGstStrmOut->State.fActive
+            || !pGstStrmOut->State.fEmpty)
+        {
+            cSamples = audioMixBufMixed(&pGstStrmOut->MixBuf);
+            cMinSamplesMixed = RT_MIN(cMinSamplesMixed, cSamples);
+
+            cStreamsLive++;
+        }
+    }
+
+    if (pcStreamsLive)
+        *pcStreamsLive = cStreamsLive;
+
+    return cMinSamplesMixed;
+}
+
+/**
+ * Finds the number of live (guest) samples of a specific host output stream.
+ *
+ * @return  uint32_t                Minimum number of live host output samples processed
+ *                                  by all connected guest output streams.
+ * @param   pHstStrmOut             Host output stream to search in.
+ * @param   pcStreamsLive           Number of associated guest live streams. Optional.
+ */
+uint32_t drvAudioHstOutSamplesLive(PPDMAUDIOHSTSTRMOUT pHstStrmOut, uint32_t *pcStreamsLive)
+{
+    AssertPtrReturn(pHstStrmOut, 0);
+    /* pcStreamsLive is optional. */
+
+    uint32_t cStreamsLive;
+    uint32_t cSamplesMin = drvAudioHstOutMinSamplesMixed(pHstStrmOut, &cStreamsLive);
+
+    if (pcStreamsLive)
+        *pcStreamsLive = cStreamsLive;
+
+    if (cStreamsLive) /* Any live streams at all? */
+    {
+        if (   cSamplesMin == UINT32_MAX
+            || cSamplesMin > audioMixBufSize(&pHstStrmOut->MixBuf))
+        {
+            LogFlowFunc(("Error: cSamplesMin=%RU32\n", cSamplesMin));
+            return 0;
+        }
+
+        return cSamplesMin;
+    }
+
+    return 0;
+}
+
diff --git a/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp b/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp
new file mode 100644
index 0000000..19455bd
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvHostALSAAudio.cpp
@@ -0,0 +1,1399 @@
+/* $Id: DrvHostALSAAudio.cpp $ */
+/** @file
+ * VBox audio devices: ALSA audio driver.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on: alsaaudio.c
+ *
+ * QEMU ALSA audio driver
+ *
+ * Copyright (c) 2005 Vassili Karpov (malc)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+
+#include <iprt/alloc.h>
+#include <iprt/uuid.h> /* For PDMIBASE_2_PDMDRV. */
+#include <VBox/vmm/pdmaudioifs.h>
+
+RT_C_DECLS_BEGIN
+ #include "alsa_stubs.h"
+ #include "alsa_mangling.h"
+RT_C_DECLS_END
+
+#include <alsa/asoundlib.h>
+
+#include "DrvAudio.h"
+#include "AudioMixBuffer.h"
+
+#include "VBoxDD.h"
+#include "vl_vbox.h"
+
+
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+typedef struct ALSAAUDIOSTREAMIN
+{
+    PDMAUDIOHSTSTRMIN   pStreamIn;
+    snd_pcm_t          *phPCM;
+    void               *pvBuf;
+    size_t              cbBuf;
+} ALSAAUDIOSTREAMIN, *PALSAAUDIOSTREAMIN;
+
+typedef struct ALSAAUDIOSTREAMOUT
+{
+    PDMAUDIOHSTSTRMOUT  pStreamOut;
+    snd_pcm_t          *phPCM;
+    void               *pvBuf;
+    size_t              cbBuf;
+} ALSAAUDIOSTREAMOUT, *PALSAAUDIOSTREAMOUT;
+
+/* latency = period_size * periods / (rate * bytes_per_frame) */
+
+typedef struct ALSAAUDIOCFG
+{
+    int size_in_usec_in;
+    int size_in_usec_out;
+    const char *pcm_name_in;
+    const char *pcm_name_out;
+    unsigned int buffer_size_in;
+    unsigned int period_size_in;
+    unsigned int buffer_size_out;
+    unsigned int period_size_out;
+    unsigned int threshold;
+
+    int buffer_size_in_overriden;
+    int period_size_in_overriden;
+
+    int buffer_size_out_overriden;
+    int period_size_out_overriden;
+
+} ALSAAUDIOCFG, *PALSAAUDIOCFG;
+
+static int drvHostALSAAudioRecover(snd_pcm_t *phPCM);
+
+static ALSAAUDIOCFG s_ALSAConf =
+{
+#ifdef HIGH_LATENCY
+    1,
+    1,
+#else
+    0,
+    0,
+#endif
+    "default",
+    "default",
+#ifdef HIGH_LATENCY
+    400000,
+    400000 / 4,
+    400000,
+    400000 / 4,
+#else
+# define DEFAULT_BUFFER_SIZE 1024
+# define DEFAULT_PERIOD_SIZE 256
+    DEFAULT_BUFFER_SIZE * 4,
+    DEFAULT_PERIOD_SIZE * 4,
+    DEFAULT_BUFFER_SIZE,
+    DEFAULT_PERIOD_SIZE,
+#endif
+    0,
+    0,
+    0,
+    0,
+    0
+};
+
+/**
+ * Host Alsa audio driver instance data.
+ * @implements PDMIAUDIOCONNECTOR
+ */
+typedef struct DRVHOSTALSAAUDIO
+{
+    /** Pointer to the driver instance structure. */
+    PPDMDRVINS         pDrvIns;
+    /** Pointer to host audio interface. */
+    PDMIHOSTAUDIO      IHostAudio;
+    /** Error count for not flooding the release log.
+     *  UINT32_MAX for unlimited logging. */
+    uint32_t           cLogErrors;
+} DRVHOSTALSAAUDIO, *PDRVHOSTALSAAUDIO;
+
+typedef struct ALSAAUDIOSTREAMCFG
+{
+    unsigned int freq;
+    snd_pcm_format_t fmt;
+    int nchannels;
+    unsigned long buffer_size;
+    unsigned long period_size;
+    snd_pcm_uframes_t samples;
+} ALSAAUDIOSTREAMCFG, *PALSAAUDIOSTREAMCFG;
+
+static int drvHostALSAAudioClose(snd_pcm_t **pphPCM)
+{
+    if (!pphPCM || !*pphPCM)
+        return VINF_SUCCESS;
+
+    int rc;
+    int rc2 = snd_pcm_close(*pphPCM);
+    if (rc2)
+    {
+        LogRel(("ALSA: Closing PCM descriptor failed: %s\n",
+                 snd_strerror(rc2)));
+        rc = VERR_GENERAL_FAILURE; /** @todo */
+    }
+    else
+    {
+        *pphPCM = NULL;
+        rc = VINF_SUCCESS;
+    }
+
+    return rc;
+}
+
+static snd_pcm_format_t drvHostALSAAudioFmtToALSA(PDMAUDIOFMT fmt)
+{
+    switch (fmt)
+    {
+        case AUD_FMT_S8:
+            return SND_PCM_FORMAT_S8;
+
+        case AUD_FMT_U8:
+            return SND_PCM_FORMAT_U8;
+
+        case AUD_FMT_S16:
+            return SND_PCM_FORMAT_S16_LE;
+
+        case AUD_FMT_U16:
+            return SND_PCM_FORMAT_U16_LE;
+
+        case AUD_FMT_S32:
+            return SND_PCM_FORMAT_S32_LE;
+
+        case AUD_FMT_U32:
+            return SND_PCM_FORMAT_U32_LE;
+
+        default:
+            break;
+    }
+
+    AssertMsgFailed(("Format %ld not supported\n", fmt));
+    return SND_PCM_FORMAT_U8;
+}
+
+static int drvHostALSAAudioALSAToFmt(snd_pcm_format_t fmt,
+                                     PDMAUDIOFMT *pFmt, PDMAUDIOENDIANNESS *pEndianness)
+{
+    AssertPtrReturn(pFmt, VERR_INVALID_POINTER);
+    /* pEndianness is optional. */
+
+    switch (fmt)
+    {
+        case SND_PCM_FORMAT_S8:
+            *pFmt = AUD_FMT_S8;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case SND_PCM_FORMAT_U8:
+            *pFmt = AUD_FMT_U8;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case SND_PCM_FORMAT_S16_LE:
+            *pFmt = AUD_FMT_S16;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case SND_PCM_FORMAT_U16_LE:
+            *pFmt = AUD_FMT_U16;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case SND_PCM_FORMAT_S16_BE:
+            *pFmt = AUD_FMT_S16;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_BIG;
+            break;
+
+        case SND_PCM_FORMAT_U16_BE:
+            *pFmt = AUD_FMT_U16;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_BIG;
+            break;
+
+        case SND_PCM_FORMAT_S32_LE:
+            *pFmt = AUD_FMT_S32;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case SND_PCM_FORMAT_U32_LE:
+            *pFmt = AUD_FMT_U32;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case SND_PCM_FORMAT_S32_BE:
+            *pFmt = AUD_FMT_S32;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_BIG;
+            break;
+
+        case SND_PCM_FORMAT_U32_BE:
+            *pFmt = AUD_FMT_U32;
+            if (pEndianness)
+                *pEndianness = PDMAUDIOENDIANNESS_BIG;
+            break;
+
+        default:
+            AssertMsgFailed(("Format %ld not supported\n", fmt));
+            return VERR_NOT_SUPPORTED;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int drvHostALSAAudioALSAGetShift(snd_pcm_format_t fmt, unsigned *puShift)
+{
+    AssertPtrReturn(puShift, VERR_INVALID_POINTER);
+
+    switch (fmt)
+    {
+        case SND_PCM_FORMAT_S8:
+        case SND_PCM_FORMAT_U8:
+            *puShift = 0;
+            break;
+
+        case SND_PCM_FORMAT_S16_LE:
+        case SND_PCM_FORMAT_U16_LE:
+        case SND_PCM_FORMAT_S16_BE:
+        case SND_PCM_FORMAT_U16_BE:
+            *puShift = 1;
+            break;
+
+        case SND_PCM_FORMAT_S32_LE:
+        case SND_PCM_FORMAT_U32_LE:
+        case SND_PCM_FORMAT_S32_BE:
+        case SND_PCM_FORMAT_U32_BE:
+            *puShift = 2;
+            break;
+
+        default:
+            AssertMsgFailed(("Format %ld not supported\n", fmt));
+            return VERR_NOT_SUPPORTED;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int drvHostALSAAudioSetThreshold(snd_pcm_t *phPCM,
+                                        snd_pcm_uframes_t threshold)
+{
+    snd_pcm_sw_params_t *pSWParms = NULL;
+    snd_pcm_sw_params_alloca(&pSWParms);
+    if (!pSWParms)
+        return VERR_NO_MEMORY;
+
+    int rc;
+    do
+    {
+        int err = snd_pcm_sw_params_current(phPCM, pSWParms);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to get current software parameters for threshold: %s\n",
+                    snd_strerror(err)));
+            rc = VERR_ACCESS_DENIED;
+            break;
+        }
+
+        err = snd_pcm_sw_params_set_start_threshold(phPCM, pSWParms, threshold);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to set software threshold to %ld: %s\n",
+                    threshold, snd_strerror(err)));
+            rc = VERR_ACCESS_DENIED;
+            break;
+        }
+
+        err = snd_pcm_sw_params(phPCM, pSWParms);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to set new software parameters for threshold: %s\n",
+                    snd_strerror(err)));
+            rc = VERR_ACCESS_DENIED;
+            break;
+        }
+
+        LogFlowFunc(("Setting threshold to %RU32\n", threshold));
+        rc = VINF_SUCCESS;
+    }
+    while (0);
+
+    return rc;
+}
+
+static int drvHostALSAAudioOpen(bool fIn,
+                                PALSAAUDIOSTREAMCFG pCfgReq,
+                                PALSAAUDIOSTREAMCFG pCfgObt,
+                                snd_pcm_t **pphPCM)
+{
+    snd_pcm_t *phPCM = NULL;
+    int rc;
+
+    unsigned int cChannels = pCfgReq->nchannels;
+    unsigned int uFreq = pCfgReq->freq;
+    snd_pcm_uframes_t obt_buffer_size;
+
+    do
+    {
+        const char *pszDev = fIn ? s_ALSAConf.pcm_name_in : s_ALSAConf.pcm_name_out;
+        if (!pszDev)
+        {
+            LogRel(("ALSA: Invalid or no %s device name set\n",
+                    fIn ? "input" : "output"));
+            rc = VERR_INVALID_PARAMETER;
+            break;
+        }
+
+        int err = snd_pcm_open(&phPCM, pszDev,
+                               fIn ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
+                               SND_PCM_NONBLOCK);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to open \"%s\" as %s: %s\n", pszDev,
+                    fIn ? "ADC" : "DAC", snd_strerror(err)));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        snd_pcm_hw_params_t *pHWParms;
+        snd_pcm_hw_params_alloca(&pHWParms); /** @todo Check for successful allocation? */
+        err = snd_pcm_hw_params_any(phPCM, pHWParms);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to initialize hardware parameters: %s\n",
+                    snd_strerror(err)));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        err = snd_pcm_hw_params_set_access(phPCM, pHWParms,
+                                           SND_PCM_ACCESS_RW_INTERLEAVED);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to set access type: %s\n", snd_strerror(err)));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        err = snd_pcm_hw_params_set_format(phPCM, pHWParms, pCfgReq->fmt);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to set audio format to %d: %s\n",
+                    pCfgReq->fmt, snd_strerror(err)));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        err = snd_pcm_hw_params_set_rate_near(phPCM, pHWParms, &uFreq, 0);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to set frequency to %dHz: %s\n",
+                    pCfgReq->freq, snd_strerror(err)));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        err = snd_pcm_hw_params_set_channels_near(phPCM, pHWParms, &cChannels);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to set number of channels to %d\n", pCfgReq->nchannels));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        if (   cChannels != 1
+            && cChannels != 2)
+        {
+            LogRel(("ALSA: Number of audio channels (%u) not supported\n", cChannels));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        unsigned int period_size = pCfgReq->period_size;
+        unsigned int buffer_size = pCfgReq->buffer_size;
+
+        if (   !((fIn && s_ALSAConf.size_in_usec_in)
+            ||  (!fIn && s_ALSAConf.size_in_usec_out)))
+        {
+            if (!buffer_size)
+            {
+                buffer_size = DEFAULT_BUFFER_SIZE;
+                period_size = DEFAULT_PERIOD_SIZE;
+            }
+        }
+
+        if (buffer_size)
+        {
+            if (   ( fIn && s_ALSAConf.size_in_usec_in)
+                || (!fIn && s_ALSAConf.size_in_usec_out))
+            {
+                if (period_size)
+                {
+                    err = snd_pcm_hw_params_set_period_time_near(phPCM, pHWParms,
+                                                                 &period_size, 0);
+                    if (err < 0)
+                    {
+                        LogRel(("ALSA: Failed to set period time %d\n", pCfgReq->period_size));
+                        rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                        break;
+                    }
+                }
+
+                err = snd_pcm_hw_params_set_buffer_time_near(phPCM, pHWParms,
+                                                             &buffer_size, 0);
+                if (err < 0)
+                {
+                    LogRel(("ALSA: Failed to set buffer time %d\n", pCfgReq->buffer_size));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                    break;
+                }
+            }
+            else
+            {
+                snd_pcm_uframes_t period_size_f = (snd_pcm_uframes_t)period_size;
+                snd_pcm_uframes_t buffer_size_f = (snd_pcm_uframes_t)buffer_size;
+
+                snd_pcm_uframes_t minval;
+
+                if (period_size_f)
+                {
+                    minval = period_size_f;
+
+                    int dir = 0;
+                    err = snd_pcm_hw_params_get_period_size_min(pHWParms,
+                                                                &minval, &dir);
+                    if (err < 0)
+                    {
+                        LogRel(("ALSA: Could not determine minimal period size\n"));
+                        rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                        break;
+                    }
+                    else
+                    {
+                        LogFunc(("Minimal period size is: %ld\n", minval));
+                        if (period_size_f < minval)
+                        {
+                            if (   ( fIn && s_ALSAConf.period_size_in_overriden)
+                                || (!fIn && s_ALSAConf.period_size_out_overriden))
+                            {
+                                LogFunc(("Period size %RU32 is less than minimal period size %RU32\n",
+                                         period_size_f, minval));
+                            }
+
+                            period_size_f = minval;
+                        }
+                    }
+
+                    err = snd_pcm_hw_params_set_period_size_near(phPCM, pHWParms,
+                                                                 &period_size_f, 0);
+                    LogFunc(("Period size is: %RU32\n", period_size_f));
+                    if (err < 0)
+                    {
+                        LogRel(("ALSA: Failed to set period size %d (%s)\n",
+                                period_size_f, snd_strerror(err)));
+                        rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                        break;
+                    }
+                }
+
+                /* Calculate default buffer size here since it might have been changed
+                 * in the _near functions */
+                buffer_size_f = 4 * period_size_f;
+
+                minval = buffer_size_f;
+                err = snd_pcm_hw_params_get_buffer_size_min(pHWParms, &minval);
+                if (err < 0)
+                {
+                    LogRel(("ALSA: Could not retrieve minimal buffer size\n"));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                    break;
+                }
+                else
+                {
+                    LogFunc(("Minimal buffer size is: %RU32\n", minval));
+                    if (buffer_size_f < minval)
+                    {
+                        if (   ( fIn && s_ALSAConf.buffer_size_in_overriden)
+                            || (!fIn && s_ALSAConf.buffer_size_out_overriden))
+                        {
+                            LogFunc(("Buffer size %RU32 is less than minimal buffer size %RU32\n",
+                                     buffer_size_f, minval));
+                        }
+
+                        buffer_size_f = minval;
+                    }
+                }
+
+                err = snd_pcm_hw_params_set_buffer_size_near(phPCM,
+                                                             pHWParms, &buffer_size_f);
+                LogFunc(("Buffer size is: %RU32\n", buffer_size_f));
+                if (err < 0)
+                {
+                    LogRel(("ALSA: Failed to set buffer size %d: %s\n",
+                            buffer_size_f, snd_strerror(err)));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                    break;
+                }
+            }
+        }
+        else
+            LogFunc(("Warning: Buffer size is not set\n"));
+
+        err = snd_pcm_hw_params(phPCM, pHWParms);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to apply audio parameters\n"));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        err = snd_pcm_hw_params_get_buffer_size(pHWParms, &obt_buffer_size);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to get buffer size\n"));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        snd_pcm_uframes_t obt_period_size;
+        int dir = 0;
+        err = snd_pcm_hw_params_get_period_size(pHWParms, &obt_period_size, &dir);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Failed to get period size\n"));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        LogFunc(("Freq=%dHz, period size=%RU32, buffer size=%RU32\n",
+                 pCfgReq->freq, obt_period_size, obt_buffer_size));
+
+        err = snd_pcm_prepare(phPCM);
+        if (err < 0)
+        {
+            LogRel(("ALSA: Could not prepare hPCM %p\n", (void *)phPCM));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        if (   !fIn
+            && s_ALSAConf.threshold)
+        {
+            unsigned uShift;
+            rc = drvHostALSAAudioALSAGetShift(pCfgReq->fmt, &uShift);
+            if (RT_SUCCESS(rc))
+            {
+                int bytes_per_sec = uFreq
+                    << (cChannels == 2)
+                    << uShift;
+
+                snd_pcm_uframes_t threshold
+                    = (s_ALSAConf.threshold * bytes_per_sec) / 1000;
+
+                rc = drvHostALSAAudioSetThreshold(phPCM, threshold);
+            }
+        }
+        else
+            rc = VINF_SUCCESS;
+    }
+    while (0);
+
+    if (RT_SUCCESS(rc))
+    {
+        pCfgObt->fmt       = pCfgReq->fmt;
+        pCfgObt->nchannels = cChannels;
+        pCfgObt->freq      = uFreq;
+        pCfgObt->samples   = obt_buffer_size;
+
+        *pphPCM = phPCM;
+    }
+    else
+        drvHostALSAAudioClose(&phPCM);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+#ifdef DEBUG
+static void drvHostALSAAudioErrorHandler(const char *file, int line, const char *function,
+                                         int err, const char *fmt, ...)
+{
+    /** @todo Implement me! */
+}
+#endif
+
+static int drvHostALSAAudioGetAvail(snd_pcm_t *phPCM, snd_pcm_sframes_t *pFramesAvail)
+{
+    AssertPtrReturn(phPCM, VERR_INVALID_POINTER);
+    AssertPtrReturn(pFramesAvail, VERR_INVALID_POINTER);
+
+    int rc;
+
+    snd_pcm_sframes_t framesAvail;
+    framesAvail = snd_pcm_avail_update(phPCM);
+    if (framesAvail < 0)
+    {
+        if (framesAvail == -EPIPE)
+        {
+            rc = drvHostALSAAudioRecover(phPCM);
+            if (RT_SUCCESS(rc))
+                framesAvail = snd_pcm_avail_update(phPCM);
+        }
+        else
+            rc = VERR_ACCESS_DENIED; /** @todo Find a better rc. */
+    }
+    else
+        rc = VINF_SUCCESS;
+
+    if (framesAvail >= 0)
+        *pFramesAvail = framesAvail;
+
+    return rc;
+}
+
+static int drvHostALSAAudioRecover(snd_pcm_t *phPCM)
+{
+    AssertPtrReturn(phPCM, VERR_INVALID_POINTER);
+
+    int err = snd_pcm_prepare(phPCM);
+    if (err < 0)
+    {
+        LogFunc(("Failed to recover stream %p: %s\n",
+                 phPCM, snd_strerror(err)));
+        return VERR_ACCESS_DENIED; /** @todo Find a better rc. */
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int drvHostALSAAudioResume(snd_pcm_t *phPCM)
+{
+    AssertPtrReturn(phPCM, VERR_INVALID_POINTER);
+
+    int err = snd_pcm_resume(phPCM);
+    if (err < 0)
+    {
+        LogFunc(("Failed to resume stream %p: %s\n",
+                 phPCM, snd_strerror(err)));
+        return VERR_ACCESS_DENIED; /** @todo Find a better rc. */
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int drvHostALSAAudioStreamCtl(snd_pcm_t *phPCM, bool fPause)
+{
+    int err;
+    if (fPause)
+    {
+        err = snd_pcm_drop(phPCM);
+        if (err < 0)
+        {
+            LogFlow(("Error stopping stream %p: %s\n",
+                     phPCM, snd_strerror(err)));
+            return VERR_ACCESS_DENIED;
+        }
+    }
+    else
+    {
+        err = snd_pcm_prepare (phPCM);
+        if (err < 0)
+        {
+            LogFlow(("Error preparing stream %p: %s\n",
+                     phPCM, snd_strerror(err)));
+            return VERR_ACCESS_DENIED;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioInit(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+
+    LogFlowFuncEnter();
+
+    int rc = audioLoadAlsaLib();
+    if (RT_FAILURE(rc))
+        LogRel(("ALSA: Failed to load the ALSA shared library, rc=%Rrc\n", rc));
+    else
+    {
+#ifdef DEBUG
+        snd_lib_error_set_handler(drvHostALSAAudioErrorHandler);
+#endif
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioCaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                   uint32_t *pcSamplesCaptured)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    PALSAAUDIOSTREAMIN pThisStrmIn = (PALSAAUDIOSTREAMIN)pHstStrmIn;
+
+    snd_pcm_sframes_t cAvail;
+    int rc = drvHostALSAAudioGetAvail(pThisStrmIn->phPCM, &cAvail);
+    if (RT_FAILURE(rc))
+    {
+        LogFunc(("Error getting number of captured frames, rc=%Rrc\n", rc));
+        return rc;
+    }
+
+    if (!cAvail) /* No data yet? */
+    {
+        snd_pcm_state_t state = snd_pcm_state(pThisStrmIn->phPCM);
+        switch (state)
+        {
+            case SND_PCM_STATE_PREPARED:
+                cAvail = audioMixBufFree(&pHstStrmIn->MixBuf);
+                break;
+
+            case SND_PCM_STATE_SUSPENDED:
+            {
+                rc = drvHostALSAAudioResume(pThisStrmIn->phPCM);
+                if (RT_FAILURE(rc))
+                    break;
+
+                LogFlow(("Resuming suspended input stream\n"));
+                break;
+            }
+
+            default:
+                LogFlow(("No frames available, state=%d\n", state));
+                break;
+        }
+
+        if (!cAvail)
+        {
+            if (pcSamplesCaptured)
+                *pcSamplesCaptured = 0;
+            return VINF_SUCCESS;
+        }
+    }
+
+    Assert(cAvail);
+    size_t cbToRead = AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf, cAvail);
+
+    LogFlowFunc(("cbToRead=%zu, cAvail=%RI32\n", cbToRead, cAvail));
+
+    uint32_t cWrittenTotal = 0;
+    snd_pcm_uframes_t cToRead;
+    snd_pcm_sframes_t cRead;
+
+    while (   cbToRead
+           && RT_SUCCESS(rc))
+    {
+        cToRead = RT_MIN(AUDIOMIXBUF_B2S(&pHstStrmIn->MixBuf, cbToRead),
+                         AUDIOMIXBUF_B2S(&pHstStrmIn->MixBuf, pThisStrmIn->cbBuf));
+        AssertBreakStmt(cToRead, rc = VERR_NO_DATA);
+        cRead = snd_pcm_readi(pThisStrmIn->phPCM, pThisStrmIn->pvBuf, cToRead);
+        if (cRead <= 0)
+        {
+            switch (cRead)
+            {
+                case 0:
+                {
+                    LogFunc(("No input frames available\n"));
+                    rc = VERR_ACCESS_DENIED;
+                    break;
+                }
+
+                case -EAGAIN:
+                    /*
+                     * Don't set error here because EAGAIN means there are no further frames
+                     * available at the moment, try later. As we might have read some frames
+                     * already these need to be processed instead.
+                     */
+                    cbToRead = 0;
+                    break;
+
+                case -EPIPE:
+                {
+                    rc = drvHostALSAAudioRecover(pThisStrmIn->phPCM);
+                    if (RT_FAILURE(rc))
+                        break;
+
+                    LogFlowFunc(("Recovered from capturing\n"));
+                    continue;
+                }
+
+                default:
+                    LogFunc(("Failed to read input frames: %s\n", snd_strerror(cRead)));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+                    break;
+            }
+        }
+        else
+        {
+            uint32_t cWritten;
+            rc = audioMixBufWriteCirc(&pHstStrmIn->MixBuf,
+                                      pThisStrmIn->pvBuf, AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf, cRead),
+                                      &cWritten);
+            if (RT_FAILURE(rc))
+                break;
+
+            uint32_t cbWritten = AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf, cWritten);
+
+            Assert(cbToRead >= cbWritten);
+            cbToRead -= cbWritten;
+            cWrittenTotal += cWritten;
+        }
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cProcessed = 0;
+        if (cWrittenTotal)
+            rc = audioMixBufMixToParent(&pHstStrmIn->MixBuf, cWrittenTotal,
+                                        &cProcessed);
+
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = cWrittenTotal;
+
+        LogFlowFunc(("cWrittenTotal=%RU32 (%RU32 processed), rc=%Rrc\n",
+                     cWrittenTotal, cProcessed, rc));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                 uint32_t *pcSamplesPlayed)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    PALSAAUDIOSTREAMOUT pThisStrmOut = (PALSAAUDIOSTREAMOUT)pHstStrmOut;
+
+    int rc = VINF_SUCCESS;
+    uint32_t cbReadTotal = 0;
+
+    do
+    {
+        snd_pcm_sframes_t cAvail;
+        rc = drvHostALSAAudioGetAvail(pThisStrmOut->phPCM, &cAvail);
+        if (RT_FAILURE(rc))
+        {
+            LogFunc(("Error getting number of playback frames, rc=%Rrc\n", rc));
+            break;
+        }
+
+        size_t cbToRead = RT_MIN(AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf,
+                                                 cAvail),
+                                 AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf,
+                                                 drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */)));
+        LogFlowFunc(("cbToRead=%zu, cbAvail=%zu\n",
+                     cbToRead, AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cAvail)));
+
+        uint32_t cRead, cbRead;
+        snd_pcm_sframes_t cWritten;
+        while (cbToRead)
+        {
+            rc = audioMixBufReadCirc(&pHstStrmOut->MixBuf, pThisStrmOut->pvBuf, cbToRead, &cRead);
+            if (RT_FAILURE(rc))
+                break;
+
+            cbRead = AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cRead);
+            AssertBreak(cbRead);
+
+            cWritten = snd_pcm_writei(pThisStrmOut->phPCM, pThisStrmOut->pvBuf, cRead);
+            if (cWritten <= 0)
+            {
+                switch (cWritten)
+                {
+                    case 0:
+                    {
+                        LogFunc(("Failed to write %RI32 frames\n", cRead));
+                        rc = VERR_ACCESS_DENIED;
+                        break;
+                    }
+
+                    case -EPIPE:
+                    {
+                        rc = drvHostALSAAudioRecover(pThisStrmOut->phPCM);
+                        if (RT_FAILURE(rc))
+                            break;
+
+                        LogFlowFunc(("Recovered from playback\n"));
+                        continue;
+                    }
+
+                    case -ESTRPIPE:
+                    {
+                        /* Stream was suspended and waiting for a recovery. */
+                        rc = drvHostALSAAudioResume(pThisStrmOut->phPCM);
+                        if (RT_FAILURE(rc))
+                        {
+                            LogRel(("ALSA: Failed to resume output stream\n"));
+                            break;
+                        }
+
+                        LogFlowFunc(("Resumed suspended output stream\n"));
+                        continue;
+                    }
+
+                    default:
+                        LogFlowFunc(("Failed to write %RI32 output frames, rc=%Rrc\n",
+                                     cRead, rc));
+                        rc = VERR_GENERAL_FAILURE; /** @todo */
+                        break;
+                }
+            }
+
+            if (RT_FAILURE(rc))
+                break;
+
+            Assert(cbToRead >= cRead);
+            cbToRead -= cbRead;
+            cbReadTotal += cbRead;
+        }
+    }
+    while (0);
+
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cReadTotal = AUDIOMIXBUF_B2S(&pHstStrmOut->MixBuf, cbReadTotal);
+        if (cReadTotal)
+            audioMixBufFinish(&pHstStrmOut->MixBuf, cReadTotal);
+
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = cReadTotal;
+
+        LogFlowFunc(("cReadTotal=%RU32 (%RU32 bytes), rc=%Rrc\n",
+                     cReadTotal, cbReadTotal, rc));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    PALSAAUDIOSTREAMIN pThisStrmIn = (PALSAAUDIOSTREAMIN)pHstStrmIn;
+
+    drvHostALSAAudioClose(&pThisStrmIn->phPCM);
+
+    if (pThisStrmIn->pvBuf)
+    {
+        RTMemFree(pThisStrmIn->pvBuf);
+        pThisStrmIn->pvBuf = NULL;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    PALSAAUDIOSTREAMOUT pThisStrmOut = (PALSAAUDIOSTREAMOUT)pHstStrmOut;
+
+    drvHostALSAAudioClose(&pThisStrmOut->phPCM);
+
+    if (pThisStrmOut->pvBuf)
+    {
+        RTMemFree(pThisStrmOut->pvBuf);
+        pThisStrmOut->pvBuf = NULL;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioInitOut(PPDMIHOSTAUDIO pInterface,
+                                                 PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
+                                                 uint32_t *pcSamples)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    PALSAAUDIOSTREAMOUT pThisStrmOut = (PALSAAUDIOSTREAMOUT)pHstStrmOut;
+    snd_pcm_t *phPCM = NULL;
+
+    int rc;
+
+    do
+    {
+        ALSAAUDIOSTREAMCFG req;
+        req.fmt         = drvHostALSAAudioFmtToALSA(pCfg->enmFormat);
+        req.freq        = pCfg->uHz;
+        req.nchannels   = pCfg->cChannels;
+        req.period_size = s_ALSAConf.period_size_out;
+        req.buffer_size = s_ALSAConf.buffer_size_out;
+
+        ALSAAUDIOSTREAMCFG obt;
+        rc = drvHostALSAAudioOpen(false /* false */, &req, &obt, &phPCM);
+        if (RT_FAILURE(rc))
+            break;
+
+        PDMAUDIOFMT enmFormat;
+        PDMAUDIOENDIANNESS enmEnd;
+        rc = drvHostALSAAudioALSAToFmt(obt.fmt, &enmFormat, &enmEnd);
+        if (RT_FAILURE(rc))
+            break;
+
+        PDMAUDIOSTREAMCFG streamCfg;
+        streamCfg.uHz           = obt.freq;
+        streamCfg.cChannels     = obt.nchannels;
+        streamCfg.enmFormat     = enmFormat;
+        streamCfg.enmEndianness = enmEnd;
+
+        rc = drvAudioStreamCfgToProps(&streamCfg, &pHstStrmOut->Props);
+        if (RT_FAILURE(rc))
+            break;
+
+        AssertBreakStmt(obt.samples, rc = VERR_INVALID_PARAMETER);
+        size_t cbBuf = obt.samples * (1 << pHstStrmOut->Props.cShift);
+        AssertBreakStmt(cbBuf, rc = VERR_INVALID_PARAMETER);
+        pThisStrmOut->pvBuf = RTMemAlloc(cbBuf);
+        if (!pThisStrmOut->pvBuf)
+        {
+            LogRel(("ALSA: Not enough memory for output DAC buffer (%RU32 samples, each %d bytes)\n",
+                    obt.samples, 1 << pHstStrmOut->Props.cShift));
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        pThisStrmOut->cbBuf       = cbBuf;
+        pThisStrmOut->phPCM       = phPCM;
+
+        if (pcSamples)
+            *pcSamples = obt.samples;
+    }
+    while (0);
+
+    if (RT_FAILURE(rc))
+        drvHostALSAAudioClose(&phPCM);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioInitIn(PPDMIHOSTAUDIO pInterface,
+                                                PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg,
+                                                PDMAUDIORECSOURCE enmRecSource,
+                                                uint32_t *pcSamples)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    int rc;
+
+    PALSAAUDIOSTREAMIN pThisStrmIn = (PALSAAUDIOSTREAMIN)pHstStrmIn;
+    snd_pcm_t *phPCM = NULL;
+
+    do
+    {
+        ALSAAUDIOSTREAMCFG req;
+        req.fmt         = drvHostALSAAudioFmtToALSA(pCfg->enmFormat);
+        req.freq        = pCfg->uHz;
+        req.nchannels   = pCfg->cChannels;
+        req.period_size = s_ALSAConf.period_size_in;
+        req.buffer_size = s_ALSAConf.buffer_size_in;
+
+        ALSAAUDIOSTREAMCFG obt;
+        rc = drvHostALSAAudioOpen(true /* fIn */, &req, &obt, &phPCM);
+        if (RT_FAILURE(rc))
+            break;
+
+        PDMAUDIOFMT enmFormat;
+        PDMAUDIOENDIANNESS enmEnd;
+        rc = drvHostALSAAudioALSAToFmt(obt.fmt, &enmFormat, &enmEnd);
+        if (RT_FAILURE(rc))
+            break;
+
+        PDMAUDIOSTREAMCFG streamCfg;
+        streamCfg.uHz           = obt.freq;
+        streamCfg.cChannels     = obt.nchannels;
+        streamCfg.enmFormat     = enmFormat;
+        streamCfg.enmEndianness = enmEnd;
+
+        rc = drvAudioStreamCfgToProps(&streamCfg, &pHstStrmIn->Props);
+        if (RT_FAILURE(rc))
+            break;
+
+        AssertBreakStmt(obt.samples, rc = VERR_INVALID_PARAMETER);
+        size_t cbBuf = obt.samples * (1 << pHstStrmIn->Props.cShift);
+        AssertBreakStmt(cbBuf, rc = VERR_INVALID_PARAMETER);
+        pThisStrmIn->pvBuf = RTMemAlloc(cbBuf);
+        if (!pThisStrmIn->pvBuf)
+        {
+            LogRel(("ALSA: Not enough memory for input ADC buffer (%RU32 samples, each %d bytes)\n",
+                    obt.samples, 1 << pHstStrmIn->Props.cShift));
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        pThisStrmIn->cbBuf       = cbBuf;
+        pThisStrmIn->phPCM       = phPCM;
+
+        if (pcSamples)
+            *pcSamples = obt.samples;
+    }
+    while (0);
+
+    if (RT_FAILURE(rc))
+        drvHostALSAAudioClose(&phPCM);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(bool) drvHostALSAAudioIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
+{
+    NOREF(pInterface);
+    NOREF(enmDir);
+    return true; /* Always all enabled. */
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                   PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+    PALSAAUDIOSTREAMIN pThisStrmIn = (PALSAAUDIOSTREAMIN)pHstStrmIn;
+
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    int rc;
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+            rc = drvHostALSAAudioStreamCtl(pThisStrmIn->phPCM, false /* fStop */);
+            break;
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+            rc = drvHostALSAAudioStreamCtl(pThisStrmIn->phPCM, true /* fStop */);
+            break;
+
+        default:
+            AssertMsgFailed(("Invalid command %ld\n", enmStreamCmd));
+            rc = VERR_INVALID_PARAMETER;
+            break;
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioControlOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                    PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+    PALSAAUDIOSTREAMOUT pThisStrmOut = (PALSAAUDIOSTREAMOUT)pHstStrmOut;
+
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    int rc;
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+            rc = drvHostALSAAudioStreamCtl(pThisStrmOut->phPCM, false /* fStop */);
+            break;
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+            rc = drvHostALSAAudioStreamCtl(pThisStrmOut->phPCM, true /* fStop */);
+            break;
+
+        default:
+            AssertMsgFailed(("Invalid command %ld\n", enmStreamCmd));
+            rc = VERR_INVALID_PARAMETER;
+            break;
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostALSAAudioGetConf(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pCfg)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    pCfg->cbStreamOut = sizeof(ALSAAUDIOSTREAMOUT);
+    pCfg->cbStreamIn = sizeof(ALSAAUDIOSTREAMIN);
+    pCfg->cMaxHstStrmsOut = INT_MAX;
+    pCfg->cMaxHstStrmsIn = INT_MAX;
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(void) drvHostALSAAudioShutdown(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+}
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) drvHostALSAAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTALSAAUDIO  pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTALSAAUDIO);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+
+    return NULL;
+}
+
+/**
+ * Construct a DirectSound Audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(int) drvHostAlsaAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    PDRVHOSTALSAAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTALSAAUDIO);
+    LogRel(("Audio: Initializing ALSA driver\n"));
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                   = pDrvIns;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface = drvHostALSAAudioQueryInterface;
+    /* IHostAudio */
+    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostALSAAudio);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Char driver registration record.
+ */
+const PDMDRVREG g_DrvHostALSAAudio =
+{
+    /* u32Version */
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "ALSAAudio",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "ALSA host audio driver",
+    /* fFlags */
+     PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVHOSTALSAAUDIO),
+    /* pfnConstruct */
+    drvHostAlsaAudioConstruct,
+    /* pfnDestruct */
+    NULL,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
+
+static struct audio_option alsa_options[] =
+{
+    {"DACSizeInUsec", AUD_OPT_BOOL, &s_ALSAConf.size_in_usec_out,
+     "DAC period/buffer size in microseconds (otherwise in frames)", NULL, 0},
+    {"DACPeriodSize", AUD_OPT_INT, &s_ALSAConf.period_size_out,
+     "DAC period size", &s_ALSAConf.period_size_out_overriden, 0},
+    {"DACBufferSize", AUD_OPT_INT, &s_ALSAConf.buffer_size_out,
+     "DAC buffer size", &s_ALSAConf.buffer_size_out_overriden, 0},
+
+    {"ADCSizeInUsec", AUD_OPT_BOOL, &s_ALSAConf.size_in_usec_in,
+     "ADC period/buffer size in microseconds (otherwise in frames)", NULL, 0},
+    {"ADCPeriodSize", AUD_OPT_INT, &s_ALSAConf.period_size_in,
+     "ADC period size", &s_ALSAConf.period_size_in_overriden, 0},
+    {"ADCBufferSize", AUD_OPT_INT, &s_ALSAConf.buffer_size_in,
+     "ADC buffer size", &s_ALSAConf.buffer_size_in_overriden, 0},
+
+    {"Threshold", AUD_OPT_INT, &s_ALSAConf.threshold,
+     "(undocumented)", NULL, 0},
+
+    {"DACDev", AUD_OPT_STR, &s_ALSAConf.pcm_name_out,
+     "DAC device name (for instance dmix)", NULL, 0},
+
+    {"ADCDev", AUD_OPT_STR, &s_ALSAConf.pcm_name_in,
+     "ADC device name", NULL, 0},
+
+    NULL
+};
+
diff --git a/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp b/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
new file mode 100644
index 0000000..8908142
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvHostCoreAudio.cpp
@@ -0,0 +1,2076 @@
+/* $Id: DrvHostCoreAudio.cpp $ */
+/** @file
+ * VBox audio devices: Mac OS X CoreAudio audio driver.
+ */
+
+/*
+ * Copyright (C) 2010-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#include "DrvAudio.h"
+#include "AudioMixBuffer.h"
+
+#include <iprt/asm.h>
+#include <iprt/cdefs.h>
+#include <iprt/circbuf.h>
+#include <iprt/mem.h>
+
+#include "vl_vbox.h"
+#include <iprt/uuid.h>
+
+#include <CoreAudio/CoreAudio.h>
+#include <CoreServices/CoreServices.h>
+#include <AudioUnit/AudioUnit.h>
+#include <AudioToolbox/AudioConverter.h>
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+/* TODO:
+ * - Maybe make sure the threads are immediately stopped if playing/recording stops.
+ */
+
+/*
+ * Most of this is based on:
+ * http://developer.apple.com/mac/library/technotes/tn2004/tn2097.html
+ * http://developer.apple.com/mac/library/technotes/tn2002/tn2091.html
+ * http://developer.apple.com/mac/library/qa/qa2007/qa1533.html
+ * http://developer.apple.com/mac/library/qa/qa2001/qa1317.html
+ * http://developer.apple.com/mac/library/documentation/AudioUnit/Reference/AUComponentServicesReference/Reference/reference.html
+ */
+
+/**
+ * Host Coreaudio driver instance data.
+ * @implements PDMIAUDIOCONNECTOR
+ */
+typedef struct DRVHOSTCOREAUDIO
+{
+    /** Pointer to the driver instance structure. */
+    PPDMDRVINS    pDrvIns;
+    /** Pointer to host audio interface. */
+    PDMIHOSTAUDIO IHostAudio;
+} DRVHOSTCOREAUDIO, *PDRVHOSTCOREAUDIO;
+
+/*******************************************************************************
+ *
+ * Helper function section
+ *
+ ******************************************************************************/
+
+#ifdef DEBUG
+static void drvHostCoreAudioPrintASBDesc(const char *pszDesc, const AudioStreamBasicDescription *pStreamDesc)
+{
+    char pszSampleRate[32];
+    Log(("%s AudioStreamBasicDescription:\n", pszDesc));
+    LogFlowFunc(("Format ID: %RU32 (%c%c%c%c)\n", pStreamDesc->mFormatID,
+                 RT_BYTE4(pStreamDesc->mFormatID), RT_BYTE3(pStreamDesc->mFormatID),
+                 RT_BYTE2(pStreamDesc->mFormatID), RT_BYTE1(pStreamDesc->mFormatID)));
+    LogFlowFunc(("Flags: %RU32", pStreamDesc->mFormatFlags));
+    if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsFloat)
+        Log((" Float"));
+    if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsBigEndian)
+        Log((" BigEndian"));
+    if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsSignedInteger)
+        Log((" SignedInteger"));
+    if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsPacked)
+        Log((" Packed"));
+    if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsAlignedHigh)
+        Log((" AlignedHigh"));
+    if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsNonInterleaved)
+        Log((" NonInterleaved"));
+    if (pStreamDesc->mFormatFlags & kAudioFormatFlagIsNonMixable)
+        Log((" NonMixable"));
+    if (pStreamDesc->mFormatFlags & kAudioFormatFlagsAreAllClear)
+        Log((" AllClear"));
+    Log(("\n"));
+    snprintf(pszSampleRate, 32, "%.2f", (float)pStreamDesc->mSampleRate); /** @todo r=andy Use RTStrPrint*. */
+    LogFlowFunc(("SampleRate      : %s\n", pszSampleRate));
+    LogFlowFunc(("ChannelsPerFrame: %RU32\n", pStreamDesc->mChannelsPerFrame));
+    LogFlowFunc(("FramesPerPacket : %RU32\n", pStreamDesc->mFramesPerPacket));
+    LogFlowFunc(("BitsPerChannel  : %RU32\n", pStreamDesc->mBitsPerChannel));
+    LogFlowFunc(("BytesPerFrame   : %RU32\n", pStreamDesc->mBytesPerFrame));
+    LogFlowFunc(("BytesPerPacket  : %RU32\n", pStreamDesc->mBytesPerPacket));
+}
+#endif /* DEBUG */
+
+static void drvHostCoreAudioPCMInfoToASBDesc(PDMPCMPROPS *pPcmProperties, AudioStreamBasicDescription *pStreamDesc)
+{
+    pStreamDesc->mFormatID         = kAudioFormatLinearPCM;
+    pStreamDesc->mFormatFlags      = kAudioFormatFlagIsPacked;
+    pStreamDesc->mFramesPerPacket  = 1;
+    pStreamDesc->mSampleRate       = (Float64)pPcmProperties->uHz;
+    pStreamDesc->mChannelsPerFrame = pPcmProperties->cChannels;
+    pStreamDesc->mBitsPerChannel   = pPcmProperties->cBits;
+    if (pPcmProperties->fSigned)
+        pStreamDesc->mFormatFlags |= kAudioFormatFlagIsSignedInteger;
+    pStreamDesc->mBytesPerFrame    = pStreamDesc->mChannelsPerFrame * (pStreamDesc->mBitsPerChannel / 8);
+    pStreamDesc->mBytesPerPacket   = pStreamDesc->mFramesPerPacket * pStreamDesc->mBytesPerFrame;
+}
+
+static OSStatus drvHostCoreAudioSetFrameBufferSize(AudioDeviceID deviceID, bool fInput, UInt32 cReqSize, UInt32 *pcActSize)
+{
+    AudioObjectPropertyScope propScope = fInput
+                                       ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
+    AudioObjectPropertyAddress propAdr = { kAudioDevicePropertyBufferFrameSize, propScope,
+                                           kAudioObjectPropertyElementMaster };
+
+    /* First try to set the new frame buffer size. */
+    OSStatus err = AudioObjectSetPropertyData(deviceID, &propAdr, NULL, 0, sizeof(cReqSize), &cReqSize);
+
+    /* Check if it really was set. */
+    UInt32 cSize = sizeof(*pcActSize);
+    err = AudioObjectGetPropertyData(deviceID, &propAdr, 0, NULL, &cSize, pcActSize);
+    if (RT_UNLIKELY(err != noErr))
+        return err;
+
+    /* If both sizes are the same, we are done. */
+    if (cReqSize == *pcActSize)
+        return noErr;
+
+    /* If not we have to check the limits of the device. First get the size of
+       the buffer size range property. */
+    propAdr.mSelector = kAudioDevicePropertyBufferSizeRange;
+    err = AudioObjectGetPropertyDataSize(deviceID, &propAdr, 0, NULL, &cSize);
+    if (RT_UNLIKELY(err != noErr))
+        return err;
+
+    Assert(cSize);
+    AudioValueRange *pRange = (AudioValueRange *)RTMemAllocZ(cSize);
+    if (pRange)
+    {
+        err = AudioObjectGetPropertyData(deviceID, &propAdr, 0, NULL, &cSize, pRange);
+        if (err == noErr)
+        {
+            Float64 cMin = -1;
+            Float64 cMax = -1;
+            for (size_t a = 0; a < cSize / sizeof(AudioValueRange); a++)
+            {
+                /* Search for the absolute minimum. */
+                if (   pRange[a].mMinimum < cMin
+                    || cMin == -1)
+                    cMin = pRange[a].mMinimum;
+
+                /* Search for the best maximum which isn't bigger than cReqSize. */
+                if (pRange[a].mMaximum < cReqSize)
+                {
+                    if (pRange[a].mMaximum > cMax)
+                        cMax = pRange[a].mMaximum;
+                }
+            }
+            if (cMax == -1)
+                cMax = cMin;
+            cReqSize = cMax;
+
+            /* First try to set the new frame buffer size. */
+            propAdr.mSelector = kAudioDevicePropertyBufferFrameSize;
+            err = AudioObjectSetPropertyData(deviceID, &propAdr, 0, NULL, sizeof(cReqSize), &cReqSize);
+            if (err == noErr)
+            {
+                /* Check if it really was set. */
+                cSize = sizeof(*pcActSize);
+                err = AudioObjectGetPropertyData(deviceID, &propAdr, 0, NULL, &cSize, pcActSize);
+            }
+        }
+
+        RTMemFree(pRange);
+    }
+    else
+        err = notEnoughMemoryErr;
+
+    return err;
+}
+
+DECL_FORCE_INLINE(bool) drvHostCoreAudioIsRunning(AudioDeviceID deviceID)
+{
+    AudioObjectPropertyAddress propAdr = { kAudioDevicePropertyDeviceIsRunning, kAudioObjectPropertyScopeGlobal,
+                                           kAudioObjectPropertyElementMaster };
+    UInt32 uFlag = 0;
+    UInt32 uSize = sizeof(uFlag);
+    OSStatus err = AudioObjectGetPropertyData(deviceID, &propAdr, 0, NULL, &uSize, &uFlag);
+    if (err != kAudioHardwareNoError)
+        LogRel(("CoreAudio: Could not determine whether the device is running (%RI32)\n", err));
+
+    return (uFlag >= 1);
+}
+
+static int drvHostCoreAudioCFStringToCString(const CFStringRef pCFString, char **ppszString)
+{
+    CFIndex cLen = CFStringGetLength(pCFString) + 1;
+    char *pszResult = (char *)RTMemAllocZ(cLen * sizeof(char));
+    if (!CFStringGetCString(pCFString, pszResult, cLen, kCFStringEncodingUTF8))
+    {
+        RTMemFree(pszResult);
+        return VERR_NOT_FOUND;
+    }
+
+    *ppszString = pszResult;
+    return VINF_SUCCESS;
+}
+
+static AudioDeviceID drvHostCoreAudioDeviceUIDtoID(const char* pszUID)
+{
+    /* Create a CFString out of our CString. */
+    CFStringRef strUID = CFStringCreateWithCString(NULL, pszUID, kCFStringEncodingMacRoman);
+
+    /* Fill the translation structure. */
+    AudioDeviceID deviceID;
+
+    AudioValueTranslation translation;
+    translation.mInputData      = &strUID;
+    translation.mInputDataSize  = sizeof(CFStringRef);
+    translation.mOutputData     = &deviceID;
+    translation.mOutputDataSize = sizeof(AudioDeviceID);
+
+    /* Fetch the translation from the UID to the device ID. */
+    AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDeviceForUID, kAudioObjectPropertyScopeGlobal,
+                                           kAudioObjectPropertyElementMaster };
+
+    UInt32 uSize = sizeof(AudioValueTranslation);
+    OSStatus err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propAdr, 0, NULL, &uSize, &translation);
+
+    /* Release the temporary CFString */
+    CFRelease(strUID);
+
+    if (RT_LIKELY(err == noErr))
+        return deviceID;
+
+    /* Return the unknown device on error. */
+    return kAudioDeviceUnknown;
+}
+
+/*******************************************************************************
+ *
+ * Global structures section
+ *
+ ******************************************************************************/
+
+/* Initialization status indicator used for the recreation of the AudioUnits. */
+#define CA_STATUS_UNINIT    UINT32_C(0) /* The device is uninitialized */
+#define CA_STATUS_IN_INIT   UINT32_C(1) /* The device is currently initializing */
+#define CA_STATUS_INIT      UINT32_C(2) /* The device is initialized */
+#define CA_STATUS_IN_UNINIT UINT32_C(3) /* The device is currently uninitializing */
+#define CA_STATUS_REINIT    UINT32_C(4) /* The device has to be reinitialized */
+
+/* Error code which indicates "End of data" */
+static const OSStatus caConverterEOFDErr = 0x656F6664; /* 'eofd' */
+
+typedef struct COREAUDIOSTREAMOUT
+{
+    /** Host stream out. */
+    PDMAUDIOHSTSTRMOUT          streamOut;
+    /* Stream description which is default on the device */
+    AudioStreamBasicDescription deviceFormat;
+    /* Stream description which is selected for using by VBox */
+    AudioStreamBasicDescription streamFormat;
+    /* The audio device ID of the currently used device */
+    AudioDeviceID               deviceID;
+    /* The AudioUnit used */
+    AudioUnit                   audioUnit;
+    /* A ring buffer for transferring data to the playback thread. */
+    PRTCIRCBUF                  pBuf;
+    /* Temporary buffer for copying over audio data into Core Audio. */
+    void                       *pvPCMBuf;
+    /** Size of the temporary buffer. */
+    size_t                      cbPCMBuf;
+    /* Initialization status tracker. Used when some of the device parameters
+     * or the device itself is changed during the runtime. */
+    volatile uint32_t           status;
+    /** Flag whether the "default device changed" listener was registered. */
+    bool                        fDefDevChgListReg;
+} COREAUDIOSTREAMOUT, *PCOREAUDIOSTREAMOUT;
+
+typedef struct COREAUDIOSTREAMIN
+{
+    /** Host stream in. */
+    PDMAUDIOHSTSTRMIN           streamIn;
+    /* Stream description which is default on the device */
+    AudioStreamBasicDescription deviceFormat;
+    /* Stream description which is selected for using by VBox */
+    AudioStreamBasicDescription streamFormat;
+    /* The audio device ID of the currently used device */
+    AudioDeviceID               deviceID;
+    /* The AudioUnit used */
+    AudioUnit                   audioUnit;
+    /* The audio converter if necessary */
+    AudioConverterRef           converter;
+    /* A temporary position value used in the caConverterCallback function */
+    uint32_t                    rpos;
+    /* The ratio between the device & the stream sample rate */
+    Float64                     sampleRatio;
+    /* An extra buffer used for render the audio data in the recording thread */
+    AudioBufferList             bufferList;
+    /* A ring buffer for transferring data from the recording thread */
+    PRTCIRCBUF                  pBuf;
+    /* Initialization status tracker. Used when some of the device parameters
+     * or the device itself is changed during the runtime. */
+    volatile uint32_t           status;
+    /** Flag whether the "default device changed" listener was registered. */
+    bool                        fDefDevChgListReg;
+} COREAUDIOSTREAMIN, *PCOREAUDIOSTREAMIN;
+
+static int drvHostCoreAudioControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn, PDMAUDIOSTREAMCMD enmStreamCmd);
+static int drvHostCoreAudioInitInput(PPDMAUDIOHSTSTRMIN pHstStrmIn, uint32_t *pcSamples);
+static int drvHostCoreAudioFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn);
+static int drvHostCoreAudioReinitInput(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn);
+
+static int drvHostCoreAudioControlOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut, PDMAUDIOSTREAMCMD enmStreamCmd);
+static int drvHostCoreAudioInitOutput(PPDMAUDIOHSTSTRMOUT pHstStrmOut, uint32_t *pcSamples);
+static int drvHostCoreAudioFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut);
+static int drvHostCoreAudioReinitOutput(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut);
+static OSStatus drvHostCoreAudioPlaybackAudioDevicePropertyChanged(AudioObjectID propertyID, UInt32 nAddresses, const AudioObjectPropertyAddress properties[], void *pvUser);
+static OSStatus drvHostCoreAudioPlaybackCallback(void *pvUser, AudioUnitRenderActionFlags *pActionFlags, const AudioTimeStamp *pAudioTS, UInt32 uBusID, UInt32 cFrames, AudioBufferList* pBufData);
+
+/* Callback for getting notified when the default input/output device has been changed. */
+static DECLCALLBACK(OSStatus) drvHostCoreAudioDefaultDeviceChanged(AudioObjectID propertyID,
+                                                                   UInt32 nAddresses,
+                                                                   const AudioObjectPropertyAddress properties[],
+                                                                   void *pvUser)
+{
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pvUser;
+
+    OSStatus err = noErr;
+
+    switch (propertyID)
+    {
+        case kAudioHardwarePropertyDefaultInputDevice:
+        {
+            /* This listener is called on every change of the hardware
+             * device. So check if the default device has really changed. */
+            AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultInputDevice,
+                                                   kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+
+            UInt32 uSize = sizeof(pStreamIn->deviceID);
+            UInt32 uResp;
+            err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propAdr, 0, NULL, &uSize, &uResp);
+
+            if (err == noErr)
+            {
+                if (pStreamIn->deviceID != uResp)
+                {
+                    LogRel(("CoreAudio: Default input device has changed\n"));
+
+                    /* We move the reinitialization to the next input event.
+                     * This make sure this thread isn't blocked and the
+                     * reinitialization is done when necessary only. */
+                    ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_REINIT);
+                }
+            }
+            break;
+        }
+
+        default:
+            break;
+    }
+
+    return noErr;
+}
+
+static int drvHostCoreAudioReinitInput(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    PPDMDRVINS pDrvIns      = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
+
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pHstStrmIn;
+
+    drvHostCoreAudioFiniIn(pInterface, &pStreamIn->streamIn);
+
+    drvHostCoreAudioInitInput(&pStreamIn->streamIn, NULL /* pcSamples */);
+    drvHostCoreAudioControlIn(pInterface, &pStreamIn->streamIn, PDMAUDIOSTREAMCMD_ENABLE);
+
+    return VINF_SUCCESS;
+}
+
+static int drvHostCoreAudioReinitOutput(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    PPDMDRVINS pDrvIns      = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
+
+    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pHstStrmOut;
+
+    drvHostCoreAudioFiniOut(pInterface, &pStreamOut->streamOut);
+
+    drvHostCoreAudioInitOutput(&pStreamOut->streamOut, NULL /* pcSamples */);
+    drvHostCoreAudioControlOut(pInterface, &pStreamOut->streamOut, PDMAUDIOSTREAMCMD_ENABLE);
+
+    return VINF_SUCCESS;
+}
+
+/* Callback for getting notified when some of the properties of an audio device has changed. */
+static DECLCALLBACK(OSStatus) drvHostCoreAudioRecordingAudioDevicePropertyChanged(AudioObjectID                     propertyID,
+                                                                                  UInt32                            cAdresses,
+                                                                                  const AudioObjectPropertyAddress  aProperties[],
+                                                                                  void                             *pvUser)
+{
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pvUser;
+
+    switch (propertyID)
+    {
+#ifdef DEBUG
+        case kAudioDeviceProcessorOverload:
+        {
+            LogFunc(("Processor overload detected!\n"));
+            break;
+        }
+#endif /* DEBUG */
+        case kAudioDevicePropertyNominalSampleRate:
+        {
+            LogRel(("CoreAudio: Recording sample rate changed\n"));
+
+            /* We move the reinitialization to the next input event.
+             * This make sure this thread isn't blocked and the
+             * reinitialization is done when necessary only. */
+            ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_REINIT);
+            break;
+        }
+
+        default:
+            break;
+    }
+
+    return noErr;
+}
+
+/* Callback to convert audio input data from one format to another. */
+static DECLCALLBACK(OSStatus) drvHostCoreAudioConverterCallback(AudioConverterRef              converterID,
+                                                                UInt32                        *pcPackets,
+                                                                AudioBufferList               *pBufData,
+                                                                AudioStreamPacketDescription **ppPacketDesc,
+                                                                void                          *pvUser)
+{
+    /** @todo Check incoming pointers. */
+
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pvUser;
+
+    /** @todo Check converter ID? */
+
+    const AudioBufferList *pBufferList = &pStreamIn->bufferList;
+
+    if (ASMAtomicReadU32(&pStreamIn->status) != CA_STATUS_INIT)
+        return noErr;
+
+    /** @todo In principle we had to check here if the source is non interleaved, and if so,
+     *        so go through all buffers not only the first one like now. */
+
+    /* Use the lower one of the packets to process & the available packets in the buffer. */
+    Assert(pBufferList->mBuffers[0].mDataByteSize >= pStreamIn->rpos);
+    UInt32 cSize = RT_MIN(*pcPackets * pStreamIn->deviceFormat.mBytesPerPacket,
+                          pBufferList->mBuffers[0].mDataByteSize - pStreamIn->rpos);
+
+    /* Set the new size on output, so the caller know what we have processed. */
+    Assert(pStreamIn->deviceFormat.mBytesPerPacket);
+    *pcPackets = cSize / pStreamIn->deviceFormat.mBytesPerPacket;
+
+    OSStatus err;
+
+    /* If no data is available anymore we return with an error code. This error code will be returned
+     * from AudioConverterFillComplexBuffer. */
+    if (*pcPackets == 0)
+    {
+        pBufData->mBuffers[0].mDataByteSize = 0;
+        pBufData->mBuffers[0].mData         = NULL;
+
+        err = caConverterEOFDErr;
+    }
+    else
+    {
+        pBufData->mBuffers[0].mNumberChannels = pBufferList->mBuffers[0].mNumberChannels;
+        pBufData->mBuffers[0].mDataByteSize   = cSize;
+        pBufData->mBuffers[0].mData           = (uint8_t *)pBufferList->mBuffers[0].mData + pStreamIn->rpos;
+
+        pStreamIn->rpos += cSize;
+
+        err = noErr;
+    }
+
+    return err;
+}
+
+/* Callback to feed audio input buffer. */
+static DECLCALLBACK(OSStatus) drvHostCoreAudioRecordingCallback(void                       *pvUser,
+                                                                AudioUnitRenderActionFlags *pActionFlags,
+                                                                const AudioTimeStamp       *pAudioTS,
+                                                                UInt32                      uBusID,
+                                                                UInt32                      cFrames,
+                                                                AudioBufferList            *pBufData)
+{
+    PCOREAUDIOSTREAMIN pStreamIn  = (PCOREAUDIOSTREAMIN)pvUser;
+    PPDMAUDIOHSTSTRMIN pHstStrmIN = &pStreamIn->streamIn;
+
+    if (ASMAtomicReadU32(&pStreamIn->status) != CA_STATUS_INIT)
+        return noErr;
+
+    /* If nothing is pending return immediately. */
+    if (cFrames == 0)
+        return noErr;
+
+    OSStatus err = noErr;
+    int rc = VINF_SUCCESS;
+
+    do
+    {
+        /* Are we using a converter? */
+        if (pStreamIn->converter)
+        {
+            /* First, render the data as usual. */
+            pStreamIn->bufferList.mBuffers[0].mNumberChannels = pStreamIn->deviceFormat.mChannelsPerFrame;
+            pStreamIn->bufferList.mBuffers[0].mDataByteSize   = pStreamIn->deviceFormat.mBytesPerFrame * cFrames;
+            AssertBreakStmt(pStreamIn->bufferList.mBuffers[0].mDataByteSize, rc = VERR_INVALID_PARAMETER);
+            pStreamIn->bufferList.mBuffers[0].mData           = RTMemAlloc(pStreamIn->bufferList.mBuffers[0].mDataByteSize);
+            if (!pStreamIn->bufferList.mBuffers[0].mData)
+            {
+                rc = VERR_NO_MEMORY;
+                break;
+            }
+
+            err = AudioUnitRender(pStreamIn->audioUnit, pActionFlags, pAudioTS, uBusID, cFrames, &pStreamIn->bufferList);
+            if (err != noErr)
+            {
+                LogFlowFunc(("Failed rendering audio data (%RI32)\n", err));
+                rc = VERR_IO_GEN_FAILURE; /** @todo Improve this. */
+                break;
+            }
+
+            size_t cbAvail = RT_MIN(RTCircBufFree(pStreamIn->pBuf), pStreamIn->bufferList.mBuffers[0].mDataByteSize);
+
+            /* Initialize the temporary output buffer */
+            AudioBufferList tmpList;
+            tmpList.mNumberBuffers = 1;
+            tmpList.mBuffers[0].mNumberChannels = pStreamIn->streamFormat.mChannelsPerFrame;
+
+            /* Iterate as long as data is available. */
+            uint8_t *puDst = NULL;
+            while (cbAvail)
+            {
+                /* Try to acquire the necessary space from the ring buffer. */
+                size_t cbToWrite = 0;
+                RTCircBufAcquireWriteBlock(pStreamIn->pBuf, cbAvail, (void **)&puDst, &cbToWrite);
+                if (!cbToWrite)
+                    break;
+
+                /* Now set how much space is available for output. */
+                Assert(pStreamIn->streamFormat.mBytesPerPacket);
+
+                UInt32 ioOutputDataPacketSize = cbToWrite / pStreamIn->streamFormat.mBytesPerPacket;
+
+                /* Set our ring buffer as target. */
+                tmpList.mBuffers[0].mDataByteSize = cbToWrite;
+                tmpList.mBuffers[0].mData         = puDst;
+
+                AudioConverterReset(pStreamIn->converter);
+
+                err = AudioConverterFillComplexBuffer(pStreamIn->converter, drvHostCoreAudioConverterCallback, pStreamIn,
+                                                      &ioOutputDataPacketSize, &tmpList, NULL);
+                if(   err != noErr
+                   && err != caConverterEOFDErr)
+                {
+                    LogFlowFunc(("Failed to convert audio data (%RI32:%c%c%c%c)\n", err,
+                                 RT_BYTE4(err), RT_BYTE3(err), RT_BYTE2(err), RT_BYTE1(err)));
+                    rc = VERR_IO_GEN_FAILURE;
+                    break;
+                }
+
+                /* Check in any case what processed size is returned. It could be less than we expected. */
+                cbToWrite = ioOutputDataPacketSize * pStreamIn->streamFormat.mBytesPerPacket;
+
+                /* Release the ring buffer, so the main thread could start reading this data. */
+                RTCircBufReleaseWriteBlock(pStreamIn->pBuf, cbToWrite);
+
+                /* If the error is "End of Data" it means there is no data anymore
+                 * which could be converted. So end here now. */
+                if (err == caConverterEOFDErr)
+                    break;
+
+                Assert(cbAvail >= cbToWrite);
+                cbAvail -= cbToWrite;
+            }
+        }
+        else /* No converter being used. */
+        {
+            pStreamIn->bufferList.mBuffers[0].mNumberChannels = pStreamIn->streamFormat.mChannelsPerFrame;
+            pStreamIn->bufferList.mBuffers[0].mDataByteSize   = pStreamIn->streamFormat.mBytesPerFrame * cFrames;
+            AssertBreakStmt(pStreamIn->bufferList.mBuffers[0].mDataByteSize, rc = VERR_INVALID_PARAMETER);
+            pStreamIn->bufferList.mBuffers[0].mData           = RTMemAlloc(pStreamIn->bufferList.mBuffers[0].mDataByteSize);
+            if (!pStreamIn->bufferList.mBuffers[0].mData)
+            {
+                rc = VERR_NO_MEMORY;
+                break;
+            }
+
+            err = AudioUnitRender(pStreamIn->audioUnit, pActionFlags, pAudioTS, uBusID, cFrames, &pStreamIn->bufferList);
+            if (err != noErr)
+            {
+                LogFlowFunc(("Failed rendering audio data (%RI32)\n", err));
+                rc = VERR_IO_GEN_FAILURE; /** @todo Improve this. */
+                break;
+            }
+
+            size_t cbAvail = RT_MIN(RTCircBufFree(pStreamIn->pBuf), pStreamIn->bufferList.mBuffers[0].mDataByteSize);
+
+            /* Iterate as long as data is available. */
+            uint8_t *puDst = NULL;
+            uint32_t cbWrittenTotal = 0;
+            while(cbAvail)
+            {
+                /* Try to acquire the necessary space from the ring buffer. */
+                size_t cbToWrite = 0;
+                RTCircBufAcquireWriteBlock(pStreamIn->pBuf, cbAvail, (void **)&puDst, &cbToWrite);
+                if (!cbToWrite)
+                    break;
+
+                /* Copy the data from the core audio buffer to the ring buffer. */
+                memcpy(puDst, (uint8_t *)pStreamIn->bufferList.mBuffers[0].mData + cbWrittenTotal, cbToWrite);
+
+                /* Release the ring buffer, so the main thread could start reading this data. */
+                RTCircBufReleaseWriteBlock(pStreamIn->pBuf, cbToWrite);
+
+                cbWrittenTotal += cbToWrite;
+
+                Assert(cbAvail >= cbToWrite);
+                cbAvail -= cbToWrite;
+            }
+        }
+
+    } while (0);
+
+    if (pStreamIn->bufferList.mBuffers[0].mData)
+    {
+        RTMemFree(pStreamIn->bufferList.mBuffers[0].mData);
+        pStreamIn->bufferList.mBuffers[0].mData = NULL;
+    }
+
+    return err;
+}
+
+/** @todo Eventually split up this function, as this already is huge! */
+static int drvHostCoreAudioInitInput(PPDMAUDIOHSTSTRMIN pHstStrmIn, uint32_t *pcSamples)
+{
+    OSStatus err = noErr;
+
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pHstStrmIn;
+
+    ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_IN_INIT);
+
+    UInt32 uSize = 0;
+    if (pStreamIn->deviceID == kAudioDeviceUnknown)
+    {
+        /* Fetch the default audio input device currently in use. */
+        AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultInputDevice,
+                                               kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+        uSize = sizeof(pStreamIn->deviceID);
+        err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propAdr, 0, NULL, &uSize,  &pStreamIn->deviceID);
+        if (err != noErr)
+        {
+            LogRel(("CoreAudio: Unable to determine default input device (%RI32)\n", err));
+            return VERR_NOT_FOUND;
+        }
+    }
+
+    /*
+     * Try to get the name of the input device and log it. It's not fatal if it fails.
+     */
+    CFStringRef strTemp;
+
+    AudioObjectPropertyAddress propAdr = { kAudioObjectPropertyName, kAudioObjectPropertyScopeGlobal,
+                                           kAudioObjectPropertyElementMaster };
+    uSize = sizeof(CFStringRef);
+    err = AudioObjectGetPropertyData(pStreamIn->deviceID, &propAdr, 0, NULL, &uSize, &strTemp);
+    if (err == noErr)
+    {
+        char *pszDevName = NULL;
+        err = drvHostCoreAudioCFStringToCString(strTemp, &pszDevName);
+        if (err == noErr)
+        {
+            CFRelease(strTemp);
+
+            /* Get the device' UUID. */
+            propAdr.mSelector = kAudioDevicePropertyDeviceUID;
+            err = AudioObjectGetPropertyData(pStreamIn->deviceID, &propAdr, 0, NULL, &uSize, &strTemp);
+            if (err == noErr)
+            {
+                char *pszUID = NULL;
+                err = drvHostCoreAudioCFStringToCString(strTemp, &pszUID);
+                if (err == noErr)
+                {
+                    CFRelease(strTemp);
+                    LogRel(("CoreAudio: Using input device: %s (UID: %s)\n", pszDevName, pszUID));
+
+                    RTMemFree(pszUID);
+                }
+            }
+
+            RTMemFree(pszDevName);
+        }
+    }
+    else
+        LogRel(("CoreAudio: Unable to determine input device name (%RI32)\n", err));
+
+    /* Get the default frames buffer size, so that we can setup our internal buffers. */
+    UInt32 cFrames;
+    uSize = sizeof(cFrames);
+    propAdr.mSelector = kAudioDevicePropertyBufferFrameSize;
+    propAdr.mScope    = kAudioDevicePropertyScopeInput;
+    err = AudioObjectGetPropertyData(pStreamIn->deviceID, &propAdr, 0, NULL, &uSize, &cFrames);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to determine frame buffer size of the audio input device (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Set the frame buffer size and honor any minimum/maximum restrictions on the device. */
+    err = drvHostCoreAudioSetFrameBufferSize(pStreamIn->deviceID, true /* fInput */, cFrames, &cFrames);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to set frame buffer size for the audio input device (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    ComponentDescription cd;
+    RT_ZERO(cd);
+    cd.componentType         = kAudioUnitType_Output;
+    cd.componentSubType      = kAudioUnitSubType_HALOutput;
+    cd.componentManufacturer = kAudioUnitManufacturer_Apple;
+
+    /* Try to find the default HAL output component. */
+    Component cp = FindNextComponent(NULL, &cd);
+    if (cp == 0)
+    {
+        LogRel(("CoreAudio: Failed to find HAL output component\n")); /** @todo Return error value? */
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Open the default HAL output component. */
+    err = OpenAComponent(cp, &pStreamIn->audioUnit);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to open output component (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Switch the I/O mode for input to on. */
+    UInt32 uFlag = 1;
+    err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input,
+                               1, &uFlag, sizeof(uFlag));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to disable input I/O mode for input stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Switch the I/O mode for input to off. This is important, as this is a pure input stream. */
+    uFlag = 0;
+    err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output,
+                               0, &uFlag, sizeof(uFlag));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to disable output I/O mode for input stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Set the default audio input device as the device for the new AudioUnit. */
+    err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global,
+                               0, &pStreamIn->deviceID, sizeof(pStreamIn->deviceID));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to set current device (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /*
+     * CoreAudio will inform us on a second thread for new incoming audio data.
+     * Therefor register a callback function which will process the new data.
+     */
+    AURenderCallbackStruct cb;
+    RT_ZERO(cb);
+    cb.inputProc       = drvHostCoreAudioRecordingCallback;
+    cb.inputProcRefCon = pStreamIn;
+
+    err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global,
+                               0, &cb, sizeof(cb));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to register input callback (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Fetch the current stream format of the device. */
+    uSize = sizeof(pStreamIn->deviceFormat);
+    err = AudioUnitGetProperty(pStreamIn->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
+                               1, &pStreamIn->deviceFormat, &uSize);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to get device format (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Create an AudioStreamBasicDescription based on our required audio settings. */
+    drvHostCoreAudioPCMInfoToASBDesc(&pStreamIn->streamIn.Props, &pStreamIn->streamFormat);
+
+#ifdef DEBUG
+    drvHostCoreAudioPrintASBDesc("CoreAudio: Input device", &pStreamIn->deviceFormat);
+    drvHostCoreAudioPrintASBDesc("CoreAudio: Input stream", &pStreamIn->streamFormat);
+#endif /* DEBUG */
+
+    /* If the frequency of the device is different from the requested one we
+     * need a converter. The same count if the number of channels is different. */
+    if (   pStreamIn->deviceFormat.mSampleRate       != pStreamIn->streamFormat.mSampleRate
+        || pStreamIn->deviceFormat.mChannelsPerFrame != pStreamIn->streamFormat.mChannelsPerFrame)
+    {
+        err = AudioConverterNew(&pStreamIn->deviceFormat, &pStreamIn->streamFormat, &pStreamIn->converter);
+        if (RT_UNLIKELY(err != noErr))
+        {
+            LogRel(("CoreAudio: Failed to create the audio converte(%RI32). Input Format=%d, Output Foramt=%d\n",
+                     err, pStreamIn->deviceFormat, pStreamIn->streamFormat));
+            return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+        }
+
+        if (   pStreamIn->deviceFormat.mChannelsPerFrame == 1 /* Mono */
+            && pStreamIn->streamFormat.mChannelsPerFrame == 2 /* Stereo */)
+        {
+            /*
+             * If the channel count is different we have to tell this the converter
+             * and supply a channel mapping. For now we only support mapping
+             * from mono to stereo. For all other cases the core audio defaults
+             * are used, which means dropping additional channels in most
+             * cases.
+             */
+            const SInt32 channelMap[2] = {0, 0}; /* Channel map for mono -> stereo, */
+
+            err = AudioConverterSetProperty(pStreamIn->converter, kAudioConverterChannelMap, sizeof(channelMap), channelMap);
+            if (err != noErr)
+            {
+                LogRel(("CoreAudio: Failed to set channel mapping for the audio input converter (%RI32)\n", err));
+                return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+            }
+        }
+
+        /* Set the new input format description for the stream. */
+        err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
+                                   1, &pStreamIn->deviceFormat, sizeof(pStreamIn->deviceFormat));
+        if (err != noErr)
+        {
+            LogRel(("CoreAudio: Failed to set input format for input stream (%RI32)\n", err));
+            return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+        }
+#if 0
+        /* Set sample rate converter quality to maximum */
+        uFlag = kAudioConverterQuality_Max;
+        err = AudioConverterSetProperty(pStreamIn->converter, kAudioConverterSampleRateConverterQuality,
+                                        sizeof(uFlag), &uFlag);
+        if (err != noErr)
+            LogRel(("CoreAudio: Failed to set input audio converter quality to the maximum (%RI32)\n", err));
+#endif
+        LogRel(("CoreAudio: Input converter is active\n"));
+    }
+
+    /* Set the new output format description for the stream. */
+    err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output,
+                               1, &pStreamIn->deviceFormat, sizeof(pStreamIn->deviceFormat));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to set output format for input stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /*
+     * Also set the frame buffer size off the device on our AudioUnit. This
+     * should make sure that the frames count which we receive in the render
+     * thread is as we like.
+     */
+    err = AudioUnitSetProperty(pStreamIn->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global,
+                               1, &cFrames, sizeof(cFrames));
+    if (err != noErr)    {
+        LogRel(("CoreAudio: Failed to set maximum frame buffer size for input stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Finally initialize the new AudioUnit. */
+    err = AudioUnitInitialize(pStreamIn->audioUnit);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to initialize audio unit for input stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    uSize = sizeof(pStreamIn->deviceFormat);
+    err = AudioUnitGetProperty(pStreamIn->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output,
+                               1, &pStreamIn->deviceFormat, &uSize);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to get input device format (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /*
+     * There are buggy devices (e.g. my Bluetooth headset) which doesn't honor
+     * the frame buffer size set in the previous calls. So finally get the
+     * frame buffer size after the AudioUnit was initialized.
+     */
+    uSize = sizeof(cFrames);
+    err = AudioUnitGetProperty(pStreamIn->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice,kAudioUnitScope_Global,
+                               0, &cFrames, &uSize);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to get maximum frame buffer size from input audio device (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Calculate the ratio between the device and the stream sample rate. */
+    pStreamIn->sampleRatio = pStreamIn->streamFormat.mSampleRate / pStreamIn->deviceFormat.mSampleRate;
+
+    /* Set to zero first */
+    pStreamIn->pBuf = NULL;
+    /* Create the AudioBufferList structure with one buffer. */
+    pStreamIn->bufferList.mNumberBuffers = 1;
+    /* Initialize the buffer to nothing. */
+    pStreamIn->bufferList.mBuffers[0].mNumberChannels = pStreamIn->streamFormat.mChannelsPerFrame;
+    pStreamIn->bufferList.mBuffers[0].mDataByteSize = 0;
+    pStreamIn->bufferList.mBuffers[0].mData = NULL;
+
+    int rc = VINF_SUCCESS;
+
+    /*
+     * Make sure that the ring buffer is big enough to hold the recording
+     * data. Compare the maximum frames per slice value with the frames
+     * necessary when using the converter where the sample rate could differ.
+     * The result is always multiplied by the channels per frame to get the
+     * samples count.
+     */
+    UInt32 cSamples = cFrames * pStreamIn->streamFormat.mChannelsPerFrame;
+    if (!cSamples)
+    {
+        LogRel(("CoreAudio: Failed to determine samples buffer count input stream\n"));
+        rc = VERR_INVALID_PARAMETER;
+    }
+
+    /* Create the internal ring buffer. */
+    if (RT_SUCCESS(rc))
+        rc = RTCircBufCreate(&pStreamIn->pBuf, cSamples << pHstStrmIn->Props.cShift);
+    if (RT_SUCCESS(rc))
+    {
+#ifdef DEBUG
+        propAdr.mSelector = kAudioDeviceProcessorOverload;
+        propAdr.mScope    = kAudioUnitScope_Global;
+        err = AudioObjectAddPropertyListener(pStreamIn->deviceID, &propAdr,
+                                             drvHostCoreAudioRecordingAudioDevicePropertyChanged, (void *)pStreamIn);
+        if (RT_UNLIKELY(err != noErr))
+            LogRel(("CoreAudio: Failed to add the processor overload listener for input stream (%RI32)\n", err));
+#endif /* DEBUG */
+        propAdr.mSelector = kAudioDevicePropertyNominalSampleRate;
+        propAdr.mScope    = kAudioUnitScope_Global;
+        err = AudioObjectAddPropertyListener(pStreamIn->deviceID, &propAdr,
+                                             drvHostCoreAudioRecordingAudioDevicePropertyChanged, (void *)pStreamIn);
+        /* Not fatal. */
+        if (RT_UNLIKELY(err != noErr))
+            LogRel(("CoreAudio: Failed to register sample rate changed listener for input stream (%RI32)\n", err));
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_INIT);
+
+        if (pcSamples)
+            *pcSamples = cSamples;
+    }
+    else
+    {
+        AudioUnitUninitialize(pStreamIn->audioUnit);
+
+        if (pStreamIn->pBuf)
+        {
+            RTCircBufDestroy(pStreamIn->pBuf);
+            pStreamIn->pBuf = NULL;
+        }
+    }
+
+    LogFunc(("cSamples=%RU32, rc=%Rrc\n", cSamples, rc));
+    return rc;
+}
+
+/** @todo Eventually split up this function, as this already is huge! */
+static int drvHostCoreAudioInitOutput(PPDMAUDIOHSTSTRMOUT pHstStrmOut, uint32_t *pcSamples)
+{
+    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pHstStrmOut;
+
+    ASMAtomicXchgU32(&pStreamOut->status, CA_STATUS_IN_INIT);
+
+    OSStatus err = noErr;
+
+    UInt32 uSize = 0;
+    if (pStreamOut->deviceID == kAudioDeviceUnknown)
+    {
+        /* Fetch the default audio input device currently in use. */
+        AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultOutputDevice,
+                                               kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster };
+        uSize = sizeof(pStreamOut->deviceID);
+        err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propAdr, 0, NULL, &uSize, &pStreamOut->deviceID);
+        if (err != noErr)
+        {
+            LogRel(("CoreAudio: Unable to determine default output device (%RI32)\n", err));
+            return VERR_NOT_FOUND;
+        }
+    }
+
+    /*
+     * Try to get the name of the output device and log it. It's not fatal if it fails.
+     */
+    CFStringRef strTemp;
+
+    AudioObjectPropertyAddress propAdr = { kAudioObjectPropertyName, kAudioObjectPropertyScopeGlobal,
+                                           kAudioObjectPropertyElementMaster };
+    uSize = sizeof(CFStringRef);
+    err = AudioObjectGetPropertyData(pStreamOut->deviceID, &propAdr, 0, NULL, &uSize, &strTemp);
+    if (err == noErr)
+    {
+        char *pszDevName = NULL;
+        err = drvHostCoreAudioCFStringToCString(strTemp, &pszDevName);
+        if (err == noErr)
+        {
+            CFRelease(strTemp);
+
+            /* Get the device' UUID. */
+            propAdr.mSelector = kAudioDevicePropertyDeviceUID;
+            err = AudioObjectGetPropertyData(pStreamOut->deviceID, &propAdr, 0, NULL, &uSize, &strTemp);
+            if (err == noErr)
+            {
+                char *pszUID = NULL;
+                err = drvHostCoreAudioCFStringToCString(strTemp, &pszUID);
+                if (err == noErr)
+                {
+                    CFRelease(strTemp);
+                    LogRel(("CoreAudio: Using output device: %s (UID: %s)\n", pszDevName, pszUID));
+
+                    RTMemFree(pszUID);
+                }
+            }
+
+            RTMemFree(pszDevName);
+        }
+    }
+    else
+        LogRel(("CoreAudio: Unable to determine output device name (%RI32)\n", err));
+
+    /* Get the default frames buffer size, so that we can setup our internal buffers. */
+    UInt32 cFrames;
+    uSize = sizeof(cFrames);
+    propAdr.mSelector = kAudioDevicePropertyBufferFrameSize;
+    propAdr.mScope    = kAudioDevicePropertyScopeInput;
+    err = AudioObjectGetPropertyData(pStreamOut->deviceID, &propAdr, 0, NULL, &uSize, &cFrames);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to determine frame buffer size of the audio output device (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Set the frame buffer size and honor any minimum/maximum restrictions on the device. */
+    err = drvHostCoreAudioSetFrameBufferSize(pStreamOut->deviceID, false /* fInput */, cFrames, &cFrames);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to set frame buffer size for the audio output device (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    ComponentDescription cd;
+    RT_ZERO(cd);
+    cd.componentType         = kAudioUnitType_Output;
+    cd.componentSubType      = kAudioUnitSubType_HALOutput;
+    cd.componentManufacturer = kAudioUnitManufacturer_Apple;
+
+    /* Try to find the default HAL output component. */
+    Component cp = FindNextComponent(NULL, &cd);
+    if (cp == 0)
+    {
+        LogRel(("CoreAudio: Failed to find HAL output component\n")); /** @todo Return error value? */
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Open the default HAL output component. */
+    err = OpenAComponent(cp, &pStreamOut->audioUnit);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to open output component (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Switch the I/O mode for output to on. */
+    UInt32 uFlag = 1;
+    err = AudioUnitSetProperty(pStreamOut->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output,
+                               0, &uFlag, sizeof(uFlag));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to disable I/O mode for output stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Set the default audio output device as the device for the new AudioUnit. */
+    err = AudioUnitSetProperty(pStreamOut->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global,
+                               0, &pStreamOut->deviceID, sizeof(pStreamOut->deviceID));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to set current device for output stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /*
+     * CoreAudio will inform us on a second thread for new incoming audio data.
+     * Therefor register a callback function which will process the new data.
+     */
+    AURenderCallbackStruct cb;
+    RT_ZERO(cb);
+    cb.inputProc       = drvHostCoreAudioPlaybackCallback; /* pvUser */
+    cb.inputProcRefCon = pStreamOut;
+
+    err = AudioUnitSetProperty(pStreamOut->audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
+                               0, &cb, sizeof(cb));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to register output callback (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Fetch the current stream format of the device. */
+    uSize = sizeof(pStreamOut->deviceFormat);
+    err = AudioUnitGetProperty(pStreamOut->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
+                               0, &pStreamOut->deviceFormat, &uSize);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to get device format (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Create an AudioStreamBasicDescription based on our required audio settings. */
+    drvHostCoreAudioPCMInfoToASBDesc(&pStreamOut->streamOut.Props, &pStreamOut->streamFormat);
+
+#ifdef DEBUG
+    drvHostCoreAudioPrintASBDesc("CoreAudio: Output device", &pStreamOut->deviceFormat);
+    drvHostCoreAudioPrintASBDesc("CoreAudio: Output format", &pStreamOut->streamFormat);
+#endif /* DEBUG */
+
+    /* Set the new output format description for the stream. */
+    err = AudioUnitSetProperty(pStreamOut->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
+                               0, &pStreamOut->streamFormat, sizeof(pStreamOut->streamFormat));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to set stream format for output stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    uSize = sizeof(pStreamOut->deviceFormat);
+    err = AudioUnitGetProperty(pStreamOut->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,
+                               0, &pStreamOut->deviceFormat, &uSize);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to retrieve device format for output stream (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /*
+     * Also set the frame buffer size off the device on our AudioUnit. This
+     * should make sure that the frames count which we receive in the render
+     * thread is as we like.
+     */
+    err = AudioUnitSetProperty(pStreamOut->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global,
+                               0, &cFrames, sizeof(cFrames));
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to set maximum frame buffer size for output AudioUnit (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* Finally initialize the new AudioUnit. */
+    err = AudioUnitInitialize(pStreamOut->audioUnit);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to initialize the output audio device (%RI32)\n", err));
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /*
+     * There are buggy devices (e.g. my Bluetooth headset) which doesn't honor
+     * the frame buffer size set in the previous calls. So finally get the
+     * frame buffer size after the AudioUnit was initialized.
+     */
+    uSize = sizeof(cFrames);
+    err = AudioUnitGetProperty(pStreamOut->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global,
+                               0, &cFrames, &uSize);
+    if (err != noErr)
+    {
+        LogRel(("CoreAudio: Failed to get maximum frame buffer size from output audio device (%RI32)\n", err));
+
+        AudioUnitUninitialize(pStreamOut->audioUnit);
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /*
+     * Make sure that the ring buffer is big enough to hold the recording
+     * data. Compare the maximum frames per slice value with the frames
+     * necessary when using the converter where the sample rate could differ.
+     * The result is always multiplied by the channels per frame to get the
+     * samples count.
+     */
+    int rc = VINF_SUCCESS;
+
+    UInt32 cSamples = cFrames * pStreamOut->streamFormat.mChannelsPerFrame;
+    if (!cSamples)
+    {
+        LogRel(("CoreAudio: Failed to determine samples buffer count output stream\n"));
+        rc = VERR_INVALID_PARAMETER;
+    }
+
+    /* Create the internal ring buffer. */
+    rc = RTCircBufCreate(&pStreamOut->pBuf, cSamples << pHstStrmOut->Props.cShift);
+    if (RT_SUCCESS(rc))
+    {
+        /* Allocate temporary buffer. */
+        pStreamOut->cbPCMBuf = _4K; /** @todo Make this configurable. */
+        pStreamOut->pvPCMBuf = RTMemAlloc(pStreamOut->cbPCMBuf);
+        if (!pStreamOut->pvPCMBuf)
+            rc = VERR_NO_MEMORY;
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Register callbacks.
+         */
+#ifdef DEBUG
+        propAdr.mSelector = kAudioDeviceProcessorOverload;
+        propAdr.mScope    = kAudioUnitScope_Global;
+        err = AudioObjectAddPropertyListener(pStreamOut->deviceID, &propAdr,
+                                             drvHostCoreAudioPlaybackAudioDevicePropertyChanged, (void *)pStreamOut);
+        if (err != noErr)
+            LogRel(("CoreAudio: Failed to register processor overload listener for output stream (%RI32)\n", err));
+#endif /* DEBUG */
+
+        propAdr.mSelector = kAudioDevicePropertyNominalSampleRate;
+        propAdr.mScope    = kAudioUnitScope_Global;
+        err = AudioObjectAddPropertyListener(pStreamOut->deviceID, &propAdr,
+                                             drvHostCoreAudioPlaybackAudioDevicePropertyChanged, (void *)pStreamOut);
+        /* Not fatal. */
+        if (err != noErr)
+            LogRel(("CoreAudio: Failed to register sample rate changed listener for output stream (%RI32)\n", err));
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        ASMAtomicXchgU32(&pStreamOut->status, CA_STATUS_INIT);
+
+        if (pcSamples)
+            *pcSamples = cSamples;
+    }
+    else
+    {
+        AudioUnitUninitialize(pStreamOut->audioUnit);
+
+        if (pStreamOut->pBuf)
+        {
+            RTCircBufDestroy(pStreamOut->pBuf);
+            pStreamOut->pBuf = NULL;
+        }
+    }
+
+    LogFunc(("cSamples=%RU32, rc=%Rrc\n", cSamples, rc));
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioInit(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+
+    LogFlowFuncEnter();
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioCaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                   uint32_t *pcSamplesCaptured)
+{
+    PPDMDRVINS pDrvIns      = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
+
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pHstStrmIn;
+
+    size_t csReads = 0;
+    char *pcSrc;
+    PPDMAUDIOSAMPLE psDst;
+
+    /* Check if the audio device should be reinitialized. If so do it. */
+    if (ASMAtomicReadU32(&pStreamIn->status) == CA_STATUS_REINIT)
+        drvHostCoreAudioReinitInput(pInterface, &pStreamIn->streamIn);
+
+    if (ASMAtomicReadU32(&pStreamIn->status) != CA_STATUS_INIT)
+    {
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = 0;
+        return VINF_SUCCESS;
+    }
+
+    int rc = VINF_SUCCESS;
+    uint32_t cbWrittenTotal = 0;
+
+    do
+    {
+        size_t cbBuf = audioMixBufSizeBytes(&pHstStrmIn->MixBuf);
+        size_t cbToWrite = RT_MIN(cbBuf, RTCircBufFree(pStreamIn->pBuf));
+        LogFlowFunc(("cbToWrite=%zu\n", cbToWrite));
+
+        uint32_t cWritten, cbWritten;
+        uint8_t *puBuf;
+        size_t   cbToRead;
+
+        while (cbToWrite)
+        {
+            /* Try to acquire the necessary block from the ring buffer. */
+            RTCircBufAcquireReadBlock(pStreamIn->pBuf, cbToWrite, (void **)&puBuf, &cbToRead);
+            if (!cbToRead)
+            {
+                RTCircBufReleaseReadBlock(pStreamIn->pBuf, cbToRead);
+                break;
+            }
+
+            rc = audioMixBufWriteCirc(&pHstStrmIn->MixBuf, puBuf, cbToRead, &cWritten);
+            if (RT_FAILURE(rc))
+                break;
+
+            cbWritten = AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf, cWritten);
+
+            /* Release the read buffer, so it could be used for new data. */
+            RTCircBufReleaseReadBlock(pStreamIn->pBuf, cbWritten);
+
+            Assert(cbToWrite >= cbWritten);
+            cbToWrite -= cbWritten;
+            cbWrittenTotal += cbWritten;
+        }
+    }
+    while (0);
+
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cWrittenTotal = AUDIOMIXBUF_B2S(&pHstStrmIn->MixBuf, cbWrittenTotal);
+        if (cWrittenTotal)
+            audioMixBufFinish(&pHstStrmIn->MixBuf, cWrittenTotal);
+
+        LogFlowFunc(("cWrittenTotal=%RU32 (%RU32 bytes)\n", cWrittenTotal, cbWrittenTotal));
+
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = cWrittenTotal;
+    }
+
+    return rc;
+}
+
+/* Callback for getting notified when some of the properties of an audio device has changed. */
+static DECLCALLBACK(OSStatus) drvHostCoreAudioPlaybackAudioDevicePropertyChanged(AudioObjectID propertyID,
+                                                                                 UInt32 nAddresses,
+                                                                                 const AudioObjectPropertyAddress properties[],
+                                                                                 void *pvUser)
+{
+    switch (propertyID)
+    {
+#ifdef DEBUG
+        case kAudioDeviceProcessorOverload:
+        {
+            Log2(("CoreAudio: [Output] Processor overload detected!\n"));
+            break;
+        }
+#endif /* DEBUG */
+        default:
+            break;
+    }
+
+    return noErr;
+}
+
+/* Callback to feed audio output buffer. */
+static DECLCALLBACK(OSStatus) drvHostCoreAudioPlaybackCallback(void                       *pvUser,
+                                                               AudioUnitRenderActionFlags *pActionFlags,
+                                                               const AudioTimeStamp       *pAudioTS,
+                                                               UInt32                      uBusID,
+                                                               UInt32                      cFrames,
+                                                               AudioBufferList            *pBufData)
+{
+    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pvUser;
+    PPDMAUDIOHSTSTRMOUT pHstStrmOut = &pStreamOut->streamOut;
+
+    if (ASMAtomicReadU32(&pStreamOut->status) != CA_STATUS_INIT)
+    {
+        pBufData->mBuffers[0].mDataByteSize = 0;
+        return noErr;
+    }
+
+    /* How much space is used in the ring buffer? */
+    size_t cbDataAvail = RT_MIN(RTCircBufUsed(pStreamOut->pBuf), pBufData->mBuffers[0].mDataByteSize);
+    if (!cbDataAvail)
+    {
+        pBufData->mBuffers[0].mDataByteSize = 0;
+        return noErr;
+    }
+
+    uint8_t *pbSrc = NULL;
+    size_t cbRead = 0;
+    size_t cbToRead;
+    while (cbDataAvail)
+    {
+        /* Try to acquire the necessary block from the ring buffer. */
+        RTCircBufAcquireReadBlock(pStreamOut->pBuf, cbDataAvail, (void **)&pbSrc, &cbToRead);
+
+        /* Break if nothing is used anymore. */
+        if (!cbToRead)
+            break;
+
+        /* Copy the data from our ring buffer to the core audio buffer. */
+        memcpy((uint8_t *)pBufData->mBuffers[0].mData + cbRead, pbSrc, cbToRead);
+
+        /* Release the read buffer, so it could be used for new data. */
+        RTCircBufReleaseReadBlock(pStreamOut->pBuf, cbToRead);
+
+        /* Move offset. */
+        cbRead += cbToRead;
+        Assert(pBufData->mBuffers[0].mDataByteSize >= cbRead);
+
+        Assert(cbToRead <= cbDataAvail);
+        cbDataAvail -= cbToRead;
+    }
+
+    /* Write the bytes to the core audio buffer which where really written. */
+    pBufData->mBuffers[0].mDataByteSize = cbRead;
+
+    LogFlowFunc(("CoreAudio: [Output] Read %zu / %zu bytes\n", cbRead, cbDataAvail));
+
+    return noErr;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                 uint32_t *pcSamplesPlayed)
+{
+    PPDMDRVINS pDrvIns      = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
+
+    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pHstStrmOut;
+
+    /* Check if the audio device should be reinitialized. If so do it. */
+    if (ASMAtomicReadU32(&pStreamOut->status) == CA_STATUS_REINIT)
+        drvHostCoreAudioReinitOutput(pInterface, &pStreamOut->streamOut);
+
+    /* Not much else to do here. */
+
+    uint32_t cLive = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
+    if (!cLive) /* Not samples to play? Bail out. */
+    {
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = 0;
+        return VINF_SUCCESS;
+    }
+
+    int rc = VINF_SUCCESS;
+    uint32_t cbReadTotal = 0;
+
+    do
+    {
+        size_t cbBuf = RT_MIN(audioMixBufSizeBytes(&pHstStrmOut->MixBuf), pStreamOut->cbPCMBuf);
+        size_t cbToRead = RT_MIN(cbBuf, RTCircBufFree(pStreamOut->pBuf));
+        LogFlowFunc(("cbToRead=%zu\n", cbToRead));
+
+        uint32_t cRead, cbRead;
+        uint8_t *puBuf;
+        size_t   cbToWrite;
+
+        while (cbToRead)
+        {
+            rc = audioMixBufReadCirc(&pHstStrmOut->MixBuf,
+                                     pStreamOut->pvPCMBuf, cbToRead, &cRead);
+            if (   RT_FAILURE(rc)
+                || !cRead)
+                break;
+
+            cbRead = AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cRead);
+
+            /* Try to acquire the necessary space from the ring buffer. */
+            RTCircBufAcquireWriteBlock(pStreamOut->pBuf, cbRead, (void **)&puBuf, &cbToWrite);
+            if (!cbToWrite)
+            {
+                RTCircBufReleaseWriteBlock(pStreamOut->pBuf, cbToWrite);
+                break;
+            }
+
+            /* Transfer data into stream's own ring buffer. The playback will operate on this
+             * own ring buffer separately. */
+            Assert(cbToWrite <= cbRead);
+            memcpy(puBuf, pStreamOut->pvPCMBuf, cbToWrite);
+
+            /* Release the ring buffer, so the read thread could start reading this data. */
+            RTCircBufReleaseWriteBlock(pStreamOut->pBuf, cbToWrite);
+
+            Assert(cbToRead >= cRead);
+            cbToRead -= cbRead;
+            cbReadTotal += cbRead;
+        }
+    }
+    while (0);
+
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cReadTotal = AUDIOMIXBUF_B2S(&pHstStrmOut->MixBuf, cbReadTotal);
+        if (cReadTotal)
+            audioMixBufFinish(&pHstStrmOut->MixBuf, cReadTotal);
+
+        LogFlowFunc(("cReadTotal=%RU32 (%RU32 bytes)\n", cReadTotal, cbReadTotal));
+
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = cReadTotal;
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioControlOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                    PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pHstStrmOut;
+
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    uint32_t uStatus = ASMAtomicReadU32(&pStreamOut->status);
+    if (!(   uStatus == CA_STATUS_INIT
+          || uStatus == CA_STATUS_REINIT))
+    {
+        return VINF_SUCCESS;
+    }
+
+    int rc = VINF_SUCCESS;
+    OSStatus err;
+
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+        {
+            /* Only start the device if it is actually stopped */
+            if (!drvHostCoreAudioIsRunning(pStreamOut->deviceID))
+            {
+                err = AudioUnitReset(pStreamOut->audioUnit, kAudioUnitScope_Input, 0);
+                if (err != noErr)
+                {
+                    LogRel(("CoreAudio: Failed to reset AudioUnit (%RI32)\n", err));
+                    /* Keep going. */
+                }
+                RTCircBufReset(pStreamOut->pBuf);
+
+                err = AudioOutputUnitStart(pStreamOut->audioUnit);
+                if (RT_UNLIKELY(err != noErr))
+                {
+                    LogRel(("CoreAudio: Failed to start playback (%RI32)\n", err));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+                }
+            }
+            break;
+        }
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+        {
+            /* Only stop the device if it is actually running */
+            if (drvHostCoreAudioIsRunning(pStreamOut->deviceID))
+            {
+                err = AudioOutputUnitStop(pStreamOut->audioUnit);
+                if (err != noErr)
+                {
+                    LogRel(("CoreAudio: Failed to stop playback (%RI32)\n", err));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+                    break;
+                }
+
+                err = AudioUnitReset(pStreamOut->audioUnit, kAudioUnitScope_Input, 0);
+                if (err != noErr)
+                {
+                    LogRel(("CoreAudio: Failed to reset AudioUnit (%RI32)\n", err));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+                }
+            }
+            break;
+        }
+
+        default:
+            rc = VERR_NOT_SUPPORTED;
+            break;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                   PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pHstStrmIn;
+
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    uint32_t uStatus = ASMAtomicReadU32(&pStreamIn->status);
+    if (!(   uStatus == CA_STATUS_INIT
+          || uStatus == CA_STATUS_REINIT))
+    {
+        return VINF_SUCCESS;
+    }
+
+    int rc = VINF_SUCCESS;
+    OSStatus err;
+
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+        {
+            /* Only start the device if it is actually stopped */
+            if (!drvHostCoreAudioIsRunning(pStreamIn->deviceID))
+            {
+                RTCircBufReset(pStreamIn->pBuf);
+                err = AudioOutputUnitStart(pStreamIn->audioUnit);
+                if (err != noErr)
+                {
+                    LogRel(("CoreAudio: Failed to start recording (%RI32)\n", err));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+                    break;
+                }
+            }
+
+            if (err != noErr)
+            {
+                LogRel(("CoreAudio: Failed to start recording (%RI32)\n", err));
+                rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+            }
+            break;
+        }
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+        {
+            /* Only stop the device if it is actually running */
+            if (drvHostCoreAudioIsRunning(pStreamIn->deviceID))
+            {
+                err = AudioOutputUnitStop(pStreamIn->audioUnit);
+                if (err != noErr)
+                {
+                    LogRel(("CoreAudio: Failed to stop recording (%RI32)\n", err));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+                    break;
+                }
+
+                err = AudioUnitReset(pStreamIn->audioUnit, kAudioUnitScope_Input, 0);
+                if (err != noErr)
+                {
+                    LogRel(("CoreAudio: Failed to reset AudioUnit (%RI32)\n", err));
+                    rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+                    break;
+                }
+            }
+            break;
+        }
+
+        default:
+            rc = VERR_NOT_SUPPORTED;
+            break;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN) pHstStrmIn;
+
+    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTCOREAUDIO  pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
+
+    LogFlowFuncEnter();
+
+    uint32_t status = ASMAtomicReadU32(&pStreamIn->status);
+    if (!(   status == CA_STATUS_INIT
+          || status == CA_STATUS_REINIT))
+    {
+        return VINF_SUCCESS;
+    }
+
+    OSStatus err = noErr;
+
+    int rc = drvHostCoreAudioControlIn(pInterface, &pStreamIn->streamIn, PDMAUDIOSTREAMCMD_DISABLE);
+    if (RT_SUCCESS(rc))
+    {
+        ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_IN_UNINIT);
+
+        /*
+         * Unregister input device callbacks.
+         */
+        AudioObjectPropertyAddress propAdr = { kAudioDeviceProcessorOverload, kAudioUnitScope_Global,
+                                               kAudioObjectPropertyElementMaster };
+#ifdef DEBUG
+        err = AudioObjectRemovePropertyListener(pStreamIn->deviceID, &propAdr,
+                                                drvHostCoreAudioRecordingAudioDevicePropertyChanged, NULL);
+        /* Not Fatal */
+        if (RT_UNLIKELY(err != noErr))
+            LogRel(("CoreAudio: Failed to remove the processor overload listener (%RI32)\n", err));
+#endif /* DEBUG */
+
+        propAdr.mSelector = kAudioDevicePropertyNominalSampleRate;
+        err = AudioObjectRemovePropertyListener(pStreamIn->deviceID, &propAdr,
+                                                drvHostCoreAudioRecordingAudioDevicePropertyChanged, NULL);
+        /* Not Fatal */
+        if (RT_UNLIKELY(err != noErr))
+            LogRel(("CoreAudio: Failed to remove the sample rate changed listener (%RI32)\n", err));
+
+        if (pStreamIn->fDefDevChgListReg)
+        {
+            propAdr.mSelector = kAudioHardwarePropertyDefaultInputDevice;
+            err = AudioObjectRemovePropertyListener(pStreamIn->deviceID, &propAdr,
+                                                    drvHostCoreAudioDefaultDeviceChanged, NULL);
+            if (RT_LIKELY(err == noErr))
+            {
+                pStreamIn->fDefDevChgListReg = false;
+            }
+            else
+                LogRel(("CoreAudio: [Output] Failed to remove the default input device changed listener (%RI32)\n", err));
+        }
+
+        if (pStreamIn->converter)
+        {
+            AudioConverterDispose(pStreamIn->converter);
+            pStreamIn->converter = NULL;
+        }
+
+        err = AudioUnitUninitialize(pStreamIn->audioUnit);
+        if (RT_LIKELY(err == noErr))
+        {
+            err = CloseComponent(pStreamIn->audioUnit);
+            if (RT_LIKELY(err == noErr))
+            {
+                RTCircBufDestroy(pStreamIn->pBuf);
+
+                pStreamIn->audioUnit   = NULL;
+                pStreamIn->deviceID    = kAudioDeviceUnknown;
+                pStreamIn->pBuf        = NULL;
+                pStreamIn->sampleRatio = 1;
+                pStreamIn->rpos        = 0;
+
+                ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_UNINIT);
+            }
+            else
+            {
+                LogRel(("CoreAudio: Failed to close the AudioUnit (%RI32)\n", err));
+                rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+            }
+        }
+        else
+        {
+            LogRel(("CoreAudio: Failed to uninitialize the AudioUnit (%RI32)\n", err));
+            rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+        }
+    }
+    else
+    {
+        LogRel(("CoreAudio: Failed to stop recording (%RI32)\n", err));
+        rc = VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    PPDMDRVINS pDrvIns      = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
+
+    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pHstStrmOut;
+
+    LogFlowFuncEnter();
+
+    uint32_t status = ASMAtomicReadU32(&pStreamOut->status);
+    if (!(   status == CA_STATUS_INIT
+          || status == CA_STATUS_REINIT))
+    {
+        return VINF_SUCCESS;
+    }
+
+    int rc = drvHostCoreAudioControlOut(pInterface, &pStreamOut->streamOut, PDMAUDIOSTREAMCMD_DISABLE);
+    if (RT_SUCCESS(rc))
+    {
+        ASMAtomicXchgU32(&pStreamOut->status, CA_STATUS_IN_UNINIT);
+
+        OSStatus err;
+        if (pStreamOut->fDefDevChgListReg)
+        {
+            AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultOutputDevice, kAudioUnitScope_Global,
+                                                   kAudioObjectPropertyElementMaster };
+            err = AudioObjectRemovePropertyListener(pStreamOut->deviceID, &propAdr,
+                                                    drvHostCoreAudioDefaultDeviceChanged, NULL);
+            if (RT_LIKELY(err == noErr))
+            {
+                pStreamOut->fDefDevChgListReg = false;
+            }
+            else
+                LogRel(("CoreAudio: [Output] Failed to remove the default playback device changed listener (%RI32)\n", err));
+        }
+
+        err = AudioUnitUninitialize(pStreamOut->audioUnit);
+        if (err == noErr)
+        {
+            err = CloseComponent(pStreamOut->audioUnit);
+            if (err == noErr)
+            {
+                RTCircBufDestroy(pStreamOut->pBuf);
+                pStreamOut->pBuf      = NULL;
+
+                pStreamOut->audioUnit = NULL;
+                pStreamOut->deviceID  = kAudioDeviceUnknown;
+
+                if (pStreamOut->pvPCMBuf)
+                {
+                    RTMemFree(pStreamOut->pvPCMBuf);
+                    pStreamOut->pvPCMBuf = NULL;
+                    pStreamOut->cbPCMBuf = 0;
+                }
+
+                ASMAtomicXchgU32(&pStreamOut->status, CA_STATUS_UNINIT);
+            }
+            else
+                LogRel(("CoreAudio: Failed to close the AudioUnit (%RI32)\n", err));
+        }
+        else
+            LogRel(("CoreAudio: Failed to uninitialize the AudioUnit (%RI32)\n", err));
+    }
+    else
+        LogRel(("CoreAudio: Failed to stop playback, rc=%Rrc\n", rc));
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioInitIn(PPDMIHOSTAUDIO pInterface,
+                                                PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg,
+                                                PDMAUDIORECSOURCE enmRecSource,
+                                                uint32_t *pcSamples)
+{
+    PCOREAUDIOSTREAMIN pStreamIn = (PCOREAUDIOSTREAMIN)pHstStrmIn;
+
+    LogFlowFunc(("enmRecSource=%ld\n"));
+
+    ASMAtomicXchgU32(&pStreamIn->status, CA_STATUS_UNINIT);
+
+    pStreamIn->audioUnit   = NULL;
+    pStreamIn->deviceID    = kAudioDeviceUnknown;
+    pStreamIn->converter   = NULL;
+    pStreamIn->sampleRatio = 1;
+    pStreamIn->rpos        = 0;
+
+    bool fDeviceByUser = false;
+
+    /* Initialize the hardware info section with the audio settings */
+    int rc = drvAudioStreamCfgToProps(pCfg, &pStreamIn->streamIn.Props);
+    if (RT_SUCCESS(rc))
+    {
+#if 0
+        /* Try to find the audio device set by the user */
+        if (DeviceUID.pszInputDeviceUID)
+        {
+            pStreamIn->deviceID = drvHostCoreAudioDeviceUIDtoID(DeviceUID.pszInputDeviceUID);
+            /* Not fatal */
+            if (pStreamIn->deviceID == kAudioDeviceUnknown)
+                LogRel(("CoreAudio: Unable to find input device %s. Falling back to the default audio device. \n", DeviceUID.pszInputDeviceUID));
+            else
+                fDeviceByUser = true;
+        }
+#endif
+        rc = drvHostCoreAudioInitInput(&pStreamIn->streamIn, pcSamples);
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        /* When the devices isn't forced by the user, we want default device change notifications. */
+        if (!fDeviceByUser)
+        {
+            AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal,
+                                                   kAudioObjectPropertyElementMaster };
+            OSStatus err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &propAdr,
+                                                          drvHostCoreAudioDefaultDeviceChanged, (void *)pStreamIn);
+            /* Not fatal. */
+            if (RT_LIKELY(err == noErr))
+            {
+                pStreamIn->fDefDevChgListReg = true;
+            }
+            else
+                LogRel(("CoreAudio: Failed to add the default input device changed listener (%RI32)\n", err));
+        }
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioInitOut(PPDMIHOSTAUDIO pInterface,
+                                                 PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
+                                                 uint32_t *pcSamples)
+{
+    PCOREAUDIOSTREAMOUT pStreamOut = (PCOREAUDIOSTREAMOUT)pHstStrmOut;
+
+    OSStatus err = noErr;
+    int rc = 0;
+    bool fDeviceByUser = false; /* use we a device which was set by the user? */
+
+    LogFlowFuncEnter();
+
+    ASMAtomicXchgU32(&pStreamOut->status, CA_STATUS_UNINIT);
+
+    pStreamOut->audioUnit = NULL;
+    pStreamOut->deviceID  = kAudioDeviceUnknown;
+
+    /* Initialize the hardware info section with the audio settings */
+    drvAudioStreamCfgToProps(pCfg, &pStreamOut->streamOut.Props);
+
+#if 0
+    /* Try to find the audio device set by the user. Use
+     * export VBOX_COREAUDIO_OUTPUT_DEVICE_UID=AppleHDAEngineOutput:0
+     * to set it. */
+    if (DeviceUID.pszOutputDeviceUID)
+    {
+        pStreamOut->audioDeviceId = drvHostCoreAudioDeviceUIDtoID(DeviceUID.pszOutputDeviceUID);
+        /* Not fatal */
+        if (pStreamOut->audioDeviceId == kAudioDeviceUnknown)
+            LogRel(("CoreAudio: Unable to find output device %s. Falling back to the default audio device. \n", DeviceUID.pszOutputDeviceUID));
+        else
+            fDeviceByUser = true;
+    }
+#endif
+
+    rc = drvHostCoreAudioInitOutput(pHstStrmOut, pcSamples);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /* When the devices isn't forced by the user, we want default device change notifications. */
+    if (!fDeviceByUser)
+    {
+        AudioObjectPropertyAddress propAdr = { kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal,
+                                               kAudioObjectPropertyElementMaster };
+        err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &propAdr,
+                                             drvHostCoreAudioDefaultDeviceChanged, (void *)pStreamOut);
+        /* Not fatal. */
+        if (RT_LIKELY(err == noErr))
+        {
+            pStreamOut->fDefDevChgListReg = true;
+        }
+        else
+            LogRel(("CoreAudio: Failed to add the default output device changed listener (%RI32)\n", err));
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(bool) drvHostCoreAudioIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
+{
+    NOREF(pInterface);
+    NOREF(enmDir);
+    return true; /* Always all enabled. */
+}
+
+static DECLCALLBACK(int) drvHostCoreAudioGetConf(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pAudioConf)
+{
+    pAudioConf->cbStreamOut     = sizeof(COREAUDIOSTREAMOUT);
+    pAudioConf->cbStreamIn      = sizeof(COREAUDIOSTREAMIN);
+    pAudioConf->cMaxHstStrmsOut = 1;
+    pAudioConf->cMaxHstStrmsIn  = 2;
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(void) drvHostCoreAudioShutdown(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+}
+
+static DECLCALLBACK(void *) drvHostCoreAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTCOREAUDIO  pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+
+    return NULL;
+}
+
+ /* Construct a DirectSound Audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(int) drvHostCoreAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    PDRVHOSTCOREAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTCOREAUDIO);
+    LogRel(("Audio: Initializing Core Audio driver\n"));
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                   = pDrvIns;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface = drvHostCoreAudioQueryInterface;
+    /* IHostAudio */
+    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostCoreAudio);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Char driver registration record.
+ */
+const PDMDRVREG g_DrvHostCoreAudio =
+{
+    /* u32Version */
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "CoreAudio",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "Core Audio host driver",
+    /* fFlags */
+     PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVHOSTCOREAUDIO),
+    /* pfnConstruct */
+    drvHostCoreAudioConstruct,
+    /* pfnDestruct */
+    NULL,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
+
diff --git a/src/VBox/Devices/Audio/DrvHostDSound.cpp b/src/VBox/Devices/Audio/DrvHostDSound.cpp
new file mode 100644
index 0000000..dc654a1
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvHostDSound.cpp
@@ -0,0 +1,1685 @@
+/* $Id: DrvHostDSound.cpp $ */
+/** @file
+ * Windows host backend driver using DirectSound.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ */
+
+#include <dsound.h>
+
+#include <iprt/alloc.h>
+#include <iprt/uuid.h>
+
+#include "AudioMixBuffer.h"
+#include "DrvAudio.h"
+#include "VBoxDD.h"
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+#define DSLOG(a) do { LogRel2(a); } while(0)
+#define DSLOGF(a) do { LogRel3(a); } while(0)
+#define DSLOGREL(a)                 \
+    do {                            \
+        static int8_t scLogged = 0; \
+        if (scLogged < 8) {         \
+            ++scLogged;             \
+            LogRel(a);              \
+        }                           \
+        else {                      \
+            DSLOG(a);               \
+        }                           \
+    } while (0)
+
+typedef struct DSOUNDHOSTCFG
+{
+    DWORD   cbBufferIn;
+    DWORD   cbBufferOut;
+    RTUUID  uuidPlay;
+    LPCGUID pGuidPlay;
+    RTUUID  uuidCapture;
+    LPCGUID pGuidCapture;
+} DSOUNDHOSTCFG, *PDSOUNDHOSTCFG;
+
+typedef struct DRVHOSTDSOUND
+{
+    /** Pointer to the driver instance structure. */
+    PPDMDRVINS    pDrvIns;
+    /** Pointer to host audio interface. */
+    PDMIHOSTAUDIO IHostAudio;
+    /** List of found host input devices. */
+    RTLISTANCHOR  lstDevInput;
+    /** List of found host output devices. */
+    RTLISTANCHOR  lstDevOutput;
+    /** Configuration options. */
+    DSOUNDHOSTCFG cfg;
+} DRVHOSTDSOUND, *PDRVHOSTDSOUND;
+
+typedef struct DSOUNDSTREAMOUT
+{
+    PDMAUDIOHSTSTRMOUT  hw; /* Always must come first! */
+    LPDIRECTSOUND       pDS;
+    LPDIRECTSOUNDBUFFER pDSB;
+    DWORD               cbPlayWritePos;
+    DWORD               csPlaybackBufferSize;
+    bool                fReinitPlayPos;
+    PDMAUDIOSTREAMCFG   streamCfg;
+} DSOUNDSTREAMOUT, *PDSOUNDSTREAMOUT;
+
+typedef struct DSOUNDSTREAMIN
+{
+    PDMAUDIOHSTSTRMIN          hw; /* Always must come first! */
+    LPDIRECTSOUNDCAPTURE       pDSC;
+    LPDIRECTSOUNDCAPTUREBUFFER pDSCB;
+    DWORD                      csCaptureReadPos;
+    DWORD                      csCaptureBufferSize;
+    HRESULT                    hrLastCaptureIn;
+    PDMAUDIORECSOURCE          enmRecSource;
+    PDMAUDIOSTREAMCFG          streamCfg;
+} DSOUNDSTREAMIN, *PDSOUNDSTREAMIN;
+
+/**
+ * Callback context for enumeration callbacks
+ */
+typedef struct DSOUNDENUMCBCTX
+{
+    PDRVHOSTDSOUND      pDrv;
+    PPDMAUDIOBACKENDCFG pCfg;
+} DSOUNDENUMCBCTX, *PDSOUNDENUMCBCTX;
+
+typedef struct DSOUNDDEV
+{
+    RTLISTNODE  Node;
+    char       *pszName;
+    GUID        Guid;
+} DSOUNDDEV, *PDSOUNDDEV;
+
+/** Makes DRVHOSTDSOUND out of PDMIHOSTAUDIO. */
+#define PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface) \
+    ( (PDRVHOSTDSOUND)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTDSOUND, IHostAudio)) )
+
+static void dsoundDevRemove(PDSOUNDDEV pDev);
+
+static DWORD dsoundRingDistance(DWORD offEnd, DWORD offBegin, DWORD cSize)
+{
+    return offEnd >= offBegin ? offEnd - offBegin : cSize - offBegin + offEnd;
+}
+
+static int dsoundWaveFmtFromCfg(PPDMAUDIOSTREAMCFG pCfg, PWAVEFORMATEX pFmt)
+{
+    RT_BZERO(pFmt, sizeof(WAVEFORMATEX));
+    pFmt->wFormatTag      = WAVE_FORMAT_PCM;
+    pFmt->nChannels       = pCfg->cChannels;
+    pFmt->nSamplesPerSec  = pCfg->uHz;
+    pFmt->nAvgBytesPerSec = pCfg->uHz << (pCfg->cChannels == 2 ? 1: 0);
+    pFmt->nBlockAlign     = 1 << (pCfg->cChannels == 2 ? 1: 0);
+    pFmt->cbSize          = 0; /* No extra data specified. */
+
+    switch (pCfg->enmFormat)
+    {
+        case AUD_FMT_S8:
+        case AUD_FMT_U8:
+            pFmt->wBitsPerSample = 8;
+            break;
+
+        case AUD_FMT_S16:
+        case AUD_FMT_U16:
+            pFmt->wBitsPerSample = 16;
+            pFmt->nAvgBytesPerSec <<= 1;
+            pFmt->nBlockAlign <<= 1;
+            break;
+
+        case AUD_FMT_S32:
+        case AUD_FMT_U32:
+            pFmt->wBitsPerSample = 32;
+            pFmt->nAvgBytesPerSec <<= 2;
+            pFmt->nBlockAlign <<= 2;
+            break;
+
+        default:
+            AssertMsgFailed(("Wave format %ld not supported\n", pCfg->enmFormat));
+            return VERR_NOT_SUPPORTED;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static void dsoundFreeDeviceLists(PDRVHOSTDSOUND pThis)
+{
+    PDSOUNDDEV pDev;
+    while (!RTListIsEmpty(&pThis->lstDevInput))
+    {
+        pDev = RTListGetFirst(&pThis->lstDevInput, DSOUNDDEV, Node);
+        dsoundDevRemove(pDev);
+    }
+
+    while (!RTListIsEmpty(&pThis->lstDevOutput))
+    {
+        pDev = RTListGetFirst(&pThis->lstDevOutput, DSOUNDDEV, Node);
+        dsoundDevRemove(pDev);
+    }
+}
+
+static int dsoundPlayRestore(LPDIRECTSOUNDBUFFER pDSB)
+{
+    HRESULT hr = IDirectSoundBuffer_Restore(pDSB);
+    if (SUCCEEDED(hr))
+        return VINF_SUCCESS;
+
+    DSLOGREL(("DSound: restore playback buffer %Rhrc\n", hr));
+    return VERR_INVALID_STATE;
+}
+
+static int dsoundUnlockOutput(LPDIRECTSOUNDBUFFER pDSB,
+                              LPVOID pv1, LPVOID pv2,
+                              DWORD cb1, DWORD cb2)
+{
+    HRESULT hr = IDirectSoundBuffer_Unlock(pDSB, pv1, cb1, pv2, cb2);
+    if (SUCCEEDED(hr))
+        return VINF_SUCCESS;
+
+    DSLOG(("DSound: Unable to unlock output buffer, hr=%Rhrc\n", hr));
+    return VERR_ACCESS_DENIED;
+}
+
+static int dsoundUnlockInput(LPDIRECTSOUNDCAPTUREBUFFER pDSCB,
+                             LPVOID pv1, LPVOID pv2,
+                             DWORD cb1, DWORD cb2)
+{
+    HRESULT hr = IDirectSoundCaptureBuffer_Unlock(pDSCB, pv1, cb1, pv2, cb2);
+    if (SUCCEEDED(hr))
+        return VINF_SUCCESS;
+
+    DSLOG(("DSound: Unable to unlock input buffer, hr=%Rhrc\n", hr));
+    return VERR_ACCESS_DENIED;
+}
+
+static int dsoundLockOutput(LPDIRECTSOUNDBUFFER pDSB, PDMPCMPROPS *pProps,
+                            DWORD dwOffset, DWORD dwBytes,
+                            LPVOID *ppv1, LPVOID *ppv2,
+                            DWORD *pcb1, DWORD *pcb2,
+                            DWORD dwFlags)
+{
+    int rc = VINF_SUCCESS;
+
+    LPVOID pv1 = NULL;
+    LPVOID pv2 = NULL;
+    DWORD cb1 = 0;
+    DWORD cb2 = 0;
+
+    HRESULT hr = IDirectSoundBuffer_Lock(pDSB, dwOffset, dwBytes, &pv1, &cb1, &pv2, &cb2, dwFlags);
+    if (hr == DSERR_BUFFERLOST)
+    {
+        rc = dsoundPlayRestore(pDSB);
+        if (RT_SUCCESS(rc))
+        {
+            hr = IDirectSoundBuffer_Lock(pDSB, dwOffset, dwBytes, &pv1, &cb1, &pv2, &cb2, dwFlags);
+        }
+    }
+
+    if (FAILED(hr) || RT_FAILURE(rc))
+    {
+        DSLOG(("DSound: Unable to lock output buffer, hr=%Rhrc\n", hr));
+        return RT_SUCCESS(rc) ? VERR_ACCESS_DENIED: rc;
+    }
+
+    if (   (pv1 && (cb1 & pProps->uAlign))
+        || (pv2 && (cb2 & pProps->uAlign)))
+    {
+        DSLOG(("DSound: lock output returned misaligned buffer: cb1=%d, cb2=%d\n", cb1, cb2));
+        dsoundUnlockOutput(pDSB, pv1, pv2, cb1, cb2);
+        return VERR_INVALID_STATE;
+    }
+
+    *ppv1 = pv1;
+    *ppv2 = pv2;
+    *pcb1 = cb1;
+    *pcb2 = cb2;
+
+    return VINF_SUCCESS;
+}
+
+static int dsoundLockInput(LPDIRECTSOUNDCAPTUREBUFFER pDSCB, PPDMPCMPROPS pProps,
+                           DWORD dwOffset, DWORD dwBytes,
+                           LPVOID *ppv1, LPVOID *ppv2,
+                           DWORD *pcb1, DWORD *pcb2,
+                           DWORD dwFlags)
+{
+    LPVOID pv1 = NULL;
+    LPVOID pv2 = NULL;
+    DWORD cb1 = 0;
+    DWORD cb2 = 0;
+
+    HRESULT hr = IDirectSoundCaptureBuffer_Lock(pDSCB, dwOffset, dwBytes,
+                                            &pv1, &cb1, &pv2, &cb2, dwFlags);
+    if (FAILED(hr))
+    {
+        DSLOG(("DSound: Unable to lock capturing buffer, hr=%Rhrc\n", hr));
+        return VERR_ACCESS_DENIED;
+    }
+
+    if (   (pv1 && (cb1 & pProps->uAlign))
+        || (pv2 && (cb2 & pProps->uAlign)))
+    {
+        DSLOG(("DSound: lock input returned misaligned buffer: cb1=%d, cb2=%d\n", cb1, cb2));
+        dsoundUnlockInput(pDSCB, pv1, pv2, cb1, cb2);
+        return VERR_INVALID_PARAMETER;
+    }
+
+    *ppv1 = pv1;
+    *ppv2 = pv2;
+    *pcb1 = cb1;
+    *pcb2 = cb2;
+
+    return VINF_SUCCESS;
+}
+
+
+/*
+ * DirectSound playback
+ */
+
+static void dsoundPlayInterfaceRelease(PDSOUNDSTREAMOUT pDSoundStrmOut)
+{
+    if (pDSoundStrmOut->pDS)
+    {
+        IDirectSound_Release(pDSoundStrmOut->pDS);
+        pDSoundStrmOut->pDS = NULL;
+    }
+}
+
+static int dsoundPlayInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMOUT pDSoundStrmOut)
+{
+    if (pDSoundStrmOut->pDS != NULL)
+    {
+        DSLOG(("DSound: DirectSound instance already exists\n"));
+        return VINF_SUCCESS;
+    }
+
+    HRESULT hr = CoCreateInstance(CLSID_DirectSound, NULL, CLSCTX_ALL,
+                                  IID_IDirectSound, (void **)&pDSoundStrmOut->pDS);
+    if (FAILED(hr))
+    {
+        DSLOGREL(("DSound: DirectSound create instance %Rhrc\n", hr));
+    }
+    else
+    {
+        hr = IDirectSound_Initialize(pDSoundStrmOut->pDS, pThis->cfg.pGuidPlay);
+        if (SUCCEEDED(hr))
+        {
+            HWND hwnd = GetDesktopWindow();
+            hr = IDirectSound_SetCooperativeLevel(pDSoundStrmOut->pDS, hwnd, DSSCL_PRIORITY);
+            if (FAILED (hr))
+            {
+                DSLOGREL(("DSound: set cooperative level for window %p %Rhrc\n", hwnd, hr));
+            }
+        }
+        if (FAILED(hr))
+        {
+            if (hr == DSERR_NODRIVER)
+            {
+                DSLOGREL(("DSound: DirectSound playback is currently unavailable\n"));
+            }
+            else
+            {
+                DSLOGREL(("DSound: DirectSound initialize %Rhrc\n", hr));
+            }
+            dsoundPlayInterfaceRelease(pDSoundStrmOut);
+        }
+    }
+
+    return SUCCEEDED(hr) ? VINF_SUCCESS: VERR_NOT_SUPPORTED;
+}
+
+static void dsoundPlayClose(PDSOUNDSTREAMOUT pDSoundStrmOut)
+{
+    DSLOG(("DSound: playback close %p buffer %p\n", pDSoundStrmOut, pDSoundStrmOut->pDSB));
+
+    if (pDSoundStrmOut->pDSB)
+    {
+        HRESULT hr = IDirectSoundBuffer_Stop(pDSoundStrmOut->pDSB);
+        if (FAILED(hr))
+        {
+            DSLOGREL(("DSound: playback close Stop %Rhrc\n", hr));
+        }
+
+        IDirectSoundBuffer_Release(pDSoundStrmOut->pDSB);
+        pDSoundStrmOut->pDSB = NULL;
+    }
+
+    dsoundPlayInterfaceRelease(pDSoundStrmOut);
+}
+
+static int dsoundPlayOpen(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMOUT pDSoundStrmOut)
+{
+    DSLOG(("DSound: playback open %p size %u bytes, freq %u, chan %u, bits %u, sign %d\n",
+           pDSoundStrmOut,
+           pThis->cfg.cbBufferOut,
+           pDSoundStrmOut->hw.Props.uHz,
+           pDSoundStrmOut->hw.Props.cChannels,
+           pDSoundStrmOut->hw.Props.cBits,
+           pDSoundStrmOut->hw.Props.fSigned));
+
+    if (pDSoundStrmOut->pDSB != NULL)
+    {
+        /* Should not happen but be forgiving. */
+        DSLOGREL(("DSound: DirectSoundBuffer already exists\n"));
+        dsoundPlayClose(pDSoundStrmOut);
+    }
+
+    WAVEFORMATEX wfx;
+    int rc = dsoundWaveFmtFromCfg(&pDSoundStrmOut->streamCfg, &wfx);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    rc = dsoundPlayInterfaceCreate(pThis, pDSoundStrmOut);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    HRESULT hr = S_OK;
+
+    do /* To use breaks. */
+    {
+        DSBUFFERDESC bd;
+        RT_ZERO(bd);
+        bd.dwSize = sizeof(bd);
+        bd.lpwfxFormat = &wfx;
+        bd.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2;
+        bd.dwBufferBytes = pThis->cfg.cbBufferOut;
+        hr = IDirectSound_CreateSoundBuffer(pDSoundStrmOut->pDS,
+                                            &bd, &pDSoundStrmOut->pDSB, NULL);
+        if (FAILED(hr))
+        {
+            DSLOGREL(("DSound: playback CreateSoundBuffer %Rhrc\n", hr));
+            break;
+        }
+
+        /* Query the actual parameters. */
+
+        hr = IDirectSoundBuffer_GetFormat(pDSoundStrmOut->pDSB, &wfx, sizeof(wfx), NULL);
+        if (FAILED(hr))
+        {
+            DSLOGREL(("DSound: playback GetFormat %Rhrc\n", hr));
+            break;
+        }
+
+        DSBCAPS bc;
+        RT_ZERO(bc);
+        bc.dwSize = sizeof(bc);
+        hr = IDirectSoundBuffer_GetCaps(pDSoundStrmOut->pDSB, &bc);
+        if (FAILED(hr))
+        {
+            DSLOGREL(("DSound: playback GetCaps %Rhrc\n", hr));
+            break;
+        }
+
+        DSLOG(("DSound: playback format: size %d bytes\n"
+                "  tag             = %d\n"
+                "  nChannels       = %d\n"
+                "  nSamplesPerSec  = %d\n"
+                "  nAvgBytesPerSec = %d\n"
+                "  nBlockAlign     = %d\n"
+                "  wBitsPerSample  = %d\n"
+                "  cbSize          = %d\n",
+                bc.dwBufferBytes,
+                wfx.wFormatTag,
+                wfx.nChannels,
+                wfx.nSamplesPerSec,
+                wfx.nAvgBytesPerSec,
+                wfx.nBlockAlign,
+                wfx.wBitsPerSample,
+                wfx.cbSize));
+
+        if (bc.dwBufferBytes & pDSoundStrmOut->hw.Props.uAlign)
+        {
+            DSLOGREL(("DSound: playback GetCaps returned misaligned buffer size %ld, alignment %d\n",
+                      bc.dwBufferBytes, pDSoundStrmOut->hw.Props.uAlign + 1));
+        }
+
+        if (bc.dwBufferBytes != pThis->cfg.cbBufferOut)
+        {
+            DSLOGREL(("DSound: playback buffer size mismatch dsound %d, requested %d bytes\n",
+                      bc.dwBufferBytes, pThis->cfg.cbBufferOut));
+        }
+
+        /* Initial state.
+         * dsoundPlayStart initializes part of it to make sure that Stop/Start continues with a correct
+         * playback buffer position.
+         */
+        pDSoundStrmOut->csPlaybackBufferSize = bc.dwBufferBytes >> pDSoundStrmOut->hw.Props.cShift;
+        DSLOG(("DSound: playback open csPlaybackBufferSize %d samples\n", pDSoundStrmOut->csPlaybackBufferSize));
+    } while (0);
+
+    if (SUCCEEDED(hr))
+        return VINF_SUCCESS;
+
+    dsoundPlayClose(pDSoundStrmOut);
+    return VERR_NOT_SUPPORTED;
+}
+
+static void dsoundPlayClearSamples(PDSOUNDSTREAMOUT pDSoundStrmOut)
+{
+    LPVOID pv1, pv2;
+    DWORD cb1, cb2;
+    int rc = dsoundLockOutput(pDSoundStrmOut->pDSB, &pDSoundStrmOut->hw.Props,
+                              0, pDSoundStrmOut->csPlaybackBufferSize << pDSoundStrmOut->hw.Props.cShift,
+                              &pv1, &pv2, &cb1, &cb2, DSBLOCK_ENTIREBUFFER);
+    if (RT_SUCCESS(rc))
+    {
+        int len1 = cb1 >> pDSoundStrmOut->hw.Props.cShift;
+        int len2 = cb2 >> pDSoundStrmOut->hw.Props.cShift;
+
+        if (pv1 && len1)
+            audio_pcm_info_clear_buf(&pDSoundStrmOut->hw.Props, pv1, len1);
+
+        if (pv2 && len2)
+            audio_pcm_info_clear_buf(&pDSoundStrmOut->hw.Props, pv2, len2);
+
+        dsoundUnlockOutput(pDSoundStrmOut->pDSB, pv1, pv2, cb1, cb2);
+    }
+}
+
+static int dsoundPlayGetStatus(LPDIRECTSOUNDBUFFER pDSB, DWORD *pStatus)
+{
+    int rc = VINF_SUCCESS;
+
+    DWORD dwStatus = 0;
+    HRESULT hr = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus);
+    if (SUCCEEDED(hr))
+    {
+        if ((dwStatus & DSBSTATUS_BUFFERLOST) != 0)
+        {
+            rc = dsoundPlayRestore(pDSB);
+            if (RT_SUCCESS(rc))
+            {
+                hr = IDirectSoundBuffer_GetStatus(pDSB, &dwStatus);
+            }
+        }
+    }
+
+    if (FAILED(hr))
+    {
+        DSLOG(("DSound: playback GetStatus %Rhrc\n", hr));
+        if (RT_SUCCESS(rc))
+        {
+            rc = VERR_NOT_SUPPORTED;
+        }
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        *pStatus = dwStatus;
+    }
+
+    return rc;
+}
+
+static void dsoundPlayStop(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMOUT pDSoundStrmOut)
+{
+    if (pDSoundStrmOut->pDSB != NULL)
+    {
+        DWORD dwStatus;
+        /* This performs some restore, so call it anyway and ignore result. */
+        dsoundPlayGetStatus(pDSoundStrmOut->pDSB, &dwStatus);
+
+        DSLOG(("DSound: playback stop\n"));
+
+        HRESULT hr = IDirectSoundBuffer_Stop(pDSoundStrmOut->pDSB);
+        if (FAILED(hr))
+        {
+            DSLOG(("DSound: stop playback buffer %Rhrc\n", hr));
+        }
+    }
+}
+
+static int dsoundPlayStart(PDSOUNDSTREAMOUT pDSoundStrmOut)
+{
+    int rc = VINF_SUCCESS;
+
+    if (pDSoundStrmOut->pDSB != NULL)
+    {
+        DWORD dwStatus;
+        int rc = dsoundPlayGetStatus(pDSoundStrmOut->pDSB, &dwStatus);
+        if (RT_FAILURE(rc))
+        {
+            DSLOG(("DSound: playback start GetStatus %Rrc\n", rc));
+        }
+        else
+        {
+            if (dwStatus & DSBSTATUS_PLAYING)
+            {
+                DSLOG(("DSound: already playing\n"));
+            }
+            else
+            {
+                dsoundPlayClearSamples(pDSoundStrmOut);
+
+                pDSoundStrmOut->fReinitPlayPos = true;
+
+                DSLOG(("DSound: playback start\n"));
+
+                HRESULT hr = IDirectSoundBuffer_Play(pDSoundStrmOut->pDSB, 0, 0, DSBPLAY_LOOPING);
+                if (FAILED(hr))
+                {
+                    DSLOGREL(("DSound: playback start %Rhrc\n", hr));
+                    rc = VERR_NOT_SUPPORTED;
+                }
+            }
+        }
+    }
+    else
+    {
+        rc = VERR_INVALID_STATE;
+    }
+
+    return rc;
+}
+
+/*
+ * DirectSoundCapture
+ */
+
+static LPCGUID dsoundCaptureSelectDevice(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMIN pDSoundStrmIn)
+{
+    LPCGUID pGUID = pThis->cfg.pGuidCapture;
+
+    if (!pGUID)
+    {
+        PDSOUNDDEV pDev = NULL;
+
+        switch (pDSoundStrmIn->enmRecSource)
+        {
+            case PDMAUDIORECSOURCE_MIC:
+            {
+                RTListForEach(&pThis->lstDevInput, pDev, DSOUNDDEV, Node)
+                {
+                    if (RTStrIStr(pDev->pszName, "Mic") == 0) /** @todo what is with non en_us windows versions? */
+                        break;
+                }
+            } break;
+
+            case PDMAUDIORECSOURCE_LINE_IN:
+            default:
+                /* Try opening the default device (NULL). */
+                break;
+        }
+
+        if (pDev)
+        {
+            DSLOG(("DSound: Guest \"%s\" is using host \"%s\"\n",
+                   drvAudioRecSourceToString(pDSoundStrmIn->enmRecSource), pDev->pszName));
+
+            pGUID = &pDev->Guid;
+        }
+    }
+
+    return pGUID;
+}
+
+static void dsoundCaptureInterfaceRelease(PDSOUNDSTREAMIN pDSoundStrmIn)
+{
+    if (pDSoundStrmIn->pDSC)
+    {
+        IDirectSoundCapture_Release(pDSoundStrmIn->pDSC);
+        pDSoundStrmIn->pDSC = NULL;
+    }
+}
+
+static int dsoundCaptureInterfaceCreate(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMIN pDSoundStrmIn)
+{
+    if (pDSoundStrmIn->pDSC != NULL)
+    {
+        DSLOG(("DSound: DirectSoundCapture instance already exists\n"));
+        return VINF_SUCCESS;
+    }
+
+    HRESULT hr = CoCreateInstance(CLSID_DirectSoundCapture, NULL, CLSCTX_ALL,
+                                  IID_IDirectSoundCapture, (void **)&pDSoundStrmIn->pDSC);
+    if (FAILED(hr))
+    {
+        DSLOGREL(("DSound: DirectSoundCapture create instance %Rhrc\n", hr));
+    }
+    else
+    {
+        LPCGUID pGUID = dsoundCaptureSelectDevice(pThis, pDSoundStrmIn);
+        hr = IDirectSoundCapture_Initialize(pDSoundStrmIn->pDSC, pGUID);
+        if (FAILED(hr))
+        {
+            if (hr == DSERR_NODRIVER)
+            {
+                DSLOGREL(("DSound: DirectSound capture is currently unavailable\n"));
+            }
+            else
+            {
+                DSLOGREL(("DSound: DirectSoundCapture initialize %Rhrc\n", hr));
+            }
+            dsoundCaptureInterfaceRelease(pDSoundStrmIn);
+        }
+    }
+
+    return SUCCEEDED(hr) ? VINF_SUCCESS: VERR_NOT_SUPPORTED;
+}
+
+static void dsoundCaptureClose(PDSOUNDSTREAMIN pDSoundStrmIn)
+{
+    DSLOG(("DSound: capture close %p buffer %p\n", pDSoundStrmIn, pDSoundStrmIn->pDSCB));
+
+    if (pDSoundStrmIn->pDSCB)
+    {
+        HRESULT hr = IDirectSoundCaptureBuffer_Stop(pDSoundStrmIn->pDSCB);
+        if (FAILED (hr))
+        {
+            DSLOG(("DSound: close capture buffer stop %Rhrc\n", hr));
+        }
+
+        IDirectSoundCaptureBuffer_Release(pDSoundStrmIn->pDSCB);
+        pDSoundStrmIn->pDSCB = NULL;
+    }
+
+    dsoundCaptureInterfaceRelease(pDSoundStrmIn);
+}
+
+static int dsoundCaptureOpen(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMIN pDSoundStrmIn)
+{
+    DSLOG(("DSound: capture open %p size %u bytes freq %u, chan %u, bits %u, sign %d\n",
+           pDSoundStrmIn,
+           pThis->cfg.cbBufferIn,
+           pDSoundStrmIn->hw.Props.uHz,
+           pDSoundStrmIn->hw.Props.cChannels,
+           pDSoundStrmIn->hw.Props.cBits,
+           pDSoundStrmIn->hw.Props.fSigned));
+
+    if (pDSoundStrmIn->pDSCB != NULL)
+    {
+        /* Should not happen but be forgiving. */
+        DSLOGREL(("DSound: DirectSoundCaptureBuffer already exists\n"));
+        dsoundCaptureClose(pDSoundStrmIn);
+    }
+
+    WAVEFORMATEX wfx;
+    int rc = dsoundWaveFmtFromCfg(&pDSoundStrmIn->streamCfg, &wfx);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    rc = dsoundCaptureInterfaceCreate(pThis, pDSoundStrmIn);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    HRESULT hr = S_OK;
+
+    do /* To use breaks. */
+    {
+        DSCBUFFERDESC bd;
+        RT_ZERO(bd);
+        bd.dwSize = sizeof(bd);
+        bd.lpwfxFormat = &wfx;
+        bd.dwBufferBytes = pThis->cfg.cbBufferIn;
+        hr = IDirectSoundCapture_CreateCaptureBuffer(pDSoundStrmIn->pDSC,
+                                                     &bd, &pDSoundStrmIn->pDSCB, NULL);
+
+        if (FAILED(hr))
+        {
+            DSLOGREL(("DSound: create capture buffer %Rhrc\n", hr));
+            pDSoundStrmIn->pDSCB = NULL;
+            break;
+        }
+
+        /* Query the actual parameters. */
+
+        DWORD cbReadPos = 0;
+        hr = IDirectSoundCaptureBuffer_GetCurrentPosition(pDSoundStrmIn->pDSCB, NULL, &cbReadPos);
+        if (FAILED(hr))
+        {
+            cbReadPos = 0;
+            DSLOG(("DSound: open GetCurrentPosition %Rhrc\n", hr));
+        }
+
+        RT_ZERO(wfx);
+        hr = IDirectSoundCaptureBuffer_GetFormat(pDSoundStrmIn->pDSCB, &wfx, sizeof(wfx), NULL);
+        if (FAILED(hr))
+        {
+            DSLOGREL(("DSound: capture buffer GetFormat %Rhrc\n", hr));
+            break;
+        }
+
+        DSCBCAPS bc;
+        RT_ZERO(bc);
+        bc.dwSize = sizeof(bc);
+        hr = IDirectSoundCaptureBuffer_GetCaps(pDSoundStrmIn->pDSCB, &bc);
+        if (FAILED (hr))
+        {
+            DSLOGREL(("DSound: capture buffer GetCaps %Rhrc\n", hr));
+            break;
+        }
+
+        DSLOG(("DSound: capture buffer format: size %d bytes\n"
+                "  tag             = %d\n"
+                "  nChannels       = %d\n"
+                "  nSamplesPerSec  = %d\n"
+                "  nAvgBytesPerSec = %d\n"
+                "  nBlockAlign     = %d\n"
+                "  wBitsPerSample  = %d\n"
+                "  cbSize          = %d\n",
+                bc.dwBufferBytes,
+                wfx.wFormatTag,
+                wfx.nChannels,
+                wfx.nSamplesPerSec,
+                wfx.nAvgBytesPerSec,
+                wfx.nBlockAlign,
+                wfx.wBitsPerSample,
+                wfx.cbSize));
+
+        if (bc.dwBufferBytes & pDSoundStrmIn->hw.Props.uAlign)
+        {
+            DSLOGREL(("DSound: GetCaps returned misaligned buffer size %ld, alignment %d\n",
+                      bc.dwBufferBytes, pDSoundStrmIn->hw.Props.uAlign + 1));
+        }
+
+        if (bc.dwBufferBytes != pThis->cfg.cbBufferIn)
+        {
+            DSLOGREL(("DSound: buffer size mismatch dsound %u, requested %u bytes\n",
+                      bc.dwBufferBytes, pThis->cfg.cbBufferIn));
+        }
+
+        /* Initial state: reading at the initial capture position. */
+        pDSoundStrmIn->csCaptureReadPos = cbReadPos >> pDSoundStrmIn->hw.Props.cShift;
+        pDSoundStrmIn->csCaptureBufferSize = bc.dwBufferBytes >> pDSoundStrmIn->hw.Props.cShift;
+        DSLOG(("DSound: capture open csCaptureReadPos %d, csCaptureBufferSize %d samples\n",
+               pDSoundStrmIn->csCaptureReadPos, pDSoundStrmIn->csCaptureBufferSize));
+
+        pDSoundStrmIn->hrLastCaptureIn = S_OK;
+    } while (0);
+
+    if (SUCCEEDED(hr))
+        return VINF_SUCCESS;
+
+    dsoundCaptureClose(pDSoundStrmIn);
+    return VERR_NOT_SUPPORTED;
+}
+
+static void dsoundCaptureStop(PDSOUNDSTREAMIN pDSoundStrmIn)
+{
+    if (pDSoundStrmIn->pDSCB)
+    {
+        DSLOG(("DSound: capture stop\n"));
+
+        HRESULT hr = IDirectSoundCaptureBuffer_Stop(pDSoundStrmIn->pDSCB);
+        if (FAILED(hr))
+        {
+            DSLOG(("DSound: stop capture buffer %Rhrc\n", hr));
+        }
+    }
+}
+
+static int dsoundCaptureStart(PDRVHOSTDSOUND pThis, PDSOUNDSTREAMIN pDSoundStrmIn)
+{
+    HRESULT hr;
+
+    if (pDSoundStrmIn->pDSCB != NULL)
+    {
+        DWORD dwStatus;
+        hr = IDirectSoundCaptureBuffer_GetStatus(pDSoundStrmIn->pDSCB, &dwStatus);
+        if (FAILED(hr))
+        {
+            DSLOG(("DSound: start GetStatus %Rhrc\n", hr));
+        }
+        else
+        {
+            if (dwStatus & DSCBSTATUS_CAPTURING)
+            {
+                DSLOG(("DSound: already capturing\n"));
+            }
+            else
+            {
+                DSLOG(("DSound: capture start\n"));
+
+                hr = IDirectSoundCaptureBuffer_Start(pDSoundStrmIn->pDSCB, DSCBSTART_LOOPING);
+                if (FAILED (hr))
+                {
+                    DSLOGREL(("DSound: start %Rhrc\n", hr));
+                }
+            }
+        }
+    }
+    else
+    {
+        hr = E_FAIL;
+    }
+
+    return SUCCEEDED(hr) ? VINF_SUCCESS: VERR_NOT_SUPPORTED;
+}
+
+static int dsoundDevAdd(PRTLISTANCHOR pList, LPGUID lpGUID,
+                        LPCWSTR lpwstrDescription, PDSOUNDDEV *ppDev)
+{
+    AssertPtrReturn(pList, VERR_INVALID_POINTER);
+    AssertPtrReturn(lpGUID, VERR_INVALID_POINTER);
+    AssertPtrReturn(lpwstrDescription, VERR_INVALID_POINTER);
+
+    PDSOUNDDEV pDev = (PDSOUNDDEV)RTMemAlloc(sizeof(DSOUNDDEV));
+    if (!pDev)
+        return VERR_NO_MEMORY;
+
+    int rc = RTUtf16ToUtf8(lpwstrDescription, &pDev->pszName);
+    if (RT_SUCCESS(rc))
+        memcpy(&pDev->Guid, lpGUID, sizeof(GUID));
+
+    if (RT_SUCCESS(rc))
+        RTListAppend(pList, &pDev->Node);
+
+    if (ppDev)
+        *ppDev = pDev;
+
+    return rc;
+}
+
+static void dsoundDevRemove(PDSOUNDDEV pDev)
+{
+    if (pDev)
+    {
+        RTStrFree(pDev->pszName);
+        pDev->pszName = NULL;
+
+        RTListNodeRemove(&pDev->Node);
+
+        RTMemFree(pDev);
+    }
+}
+
+static char *dsoundGUIDToUtf8StrA(LPCGUID lpGUID)
+{
+    LPOLESTR lpOLEStr;
+    HRESULT hr = StringFromCLSID(*lpGUID, &lpOLEStr);
+    if (SUCCEEDED(hr))
+    {
+        char *pszGUID;
+        int rc = RTUtf16ToUtf8(lpOLEStr, &pszGUID);
+        CoTaskMemFree(lpOLEStr);
+
+        return RT_SUCCESS(rc) ? pszGUID : NULL;
+    }
+
+    return NULL;
+}
+
+static void dsoundLogDevice(const char *pszType, LPGUID lpGUID, LPCWSTR lpwstrDescription, LPCWSTR lpwstrModule)
+{
+    char *pszGUID = dsoundGUIDToUtf8StrA(lpGUID);
+
+    DSLOG(("DSound: %s: GUID: %s [%ls] (Module: %ls)\n",
+           pszType, pszGUID? pszGUID: "no GUID", lpwstrDescription, lpwstrModule));
+
+    RTStrFree(pszGUID);
+}
+
+static BOOL CALLBACK dsoundEnumCallback(LPGUID lpGUID, LPCWSTR lpwstrDescription,
+                                        LPCWSTR lpwstrModule, LPVOID lpContext)
+{
+    PDSOUNDENUMCBCTX pCtx = (PDSOUNDENUMCBCTX)lpContext;
+    AssertPtrReturn(pCtx, FALSE);
+    AssertPtrReturn(pCtx->pDrv, FALSE);
+    AssertPtrReturn(pCtx->pCfg, FALSE);
+
+    if (!lpGUID)
+        return TRUE;
+
+    dsoundLogDevice("Output", lpGUID, lpwstrDescription, lpwstrModule);
+
+    int rc = dsoundDevAdd(&pCtx->pDrv->lstDevOutput,
+                          lpGUID, lpwstrDescription, NULL /* ppDev */);
+    if (RT_FAILURE(rc))
+        return FALSE; /* Abort enumeration. */
+
+    pCtx->pCfg->cMaxHstStrmsOut++;
+
+    return TRUE;
+}
+
+static BOOL CALLBACK dsoundCaptureEnumCallback(LPGUID lpGUID, LPCWSTR lpwstrDescription,
+                                               LPCWSTR lpwstrModule, LPVOID lpContext)
+{
+    PDSOUNDENUMCBCTX pCtx = (PDSOUNDENUMCBCTX)lpContext;
+    AssertPtrReturn(pCtx, FALSE);
+    AssertPtrReturn(pCtx->pDrv, FALSE);
+    AssertPtrReturn(pCtx->pCfg, FALSE);
+
+    if (!lpGUID)
+        return TRUE;
+
+    dsoundLogDevice("Input", lpGUID, lpwstrDescription, lpwstrModule);
+
+    int rc = dsoundDevAdd(&pCtx->pDrv->lstDevInput,
+                                 lpGUID, lpwstrDescription, NULL /* ppDev */);
+    if (RT_FAILURE(rc))
+        return FALSE; /* Abort enumeration. */
+
+    pCtx->pCfg->cMaxHstStrmsIn++;
+
+    return TRUE;
+}
+
+
+/*
+ * PDMIHOSTAUDIO
+ */
+
+static DECLCALLBACK(int) drvHostDSoundInitOut(PPDMIHOSTAUDIO pInterface,
+                                              PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
+                                              uint32_t *pcSamples)
+{
+    LogFlowFunc(("pHstStrmOut=%p, pCfg=%p\n", pHstStrmOut, pCfg));
+
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+    PDSOUNDSTREAMOUT pDSoundStrmOut = (PDSOUNDSTREAMOUT)pHstStrmOut;
+
+    pDSoundStrmOut->streamCfg = *pCfg;
+    pDSoundStrmOut->streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+    int rc = drvAudioStreamCfgToProps(&pDSoundStrmOut->streamCfg, &pDSoundStrmOut->hw.Props);
+    if (RT_SUCCESS(rc))
+    {
+        pDSoundStrmOut->pDS = NULL;
+        pDSoundStrmOut->pDSB = NULL;
+        pDSoundStrmOut->cbPlayWritePos = 0;
+        pDSoundStrmOut->fReinitPlayPos = true;
+        pDSoundStrmOut->csPlaybackBufferSize = 0;
+
+        if (pcSamples)
+            *pcSamples = pThis->cfg.cbBufferOut >> pHstStrmOut->Props.cShift;
+
+        /* Try to open playback in case the device is already there. */
+        dsoundPlayOpen(pThis, pDSoundStrmOut);
+    }
+    else
+    {
+        RT_ZERO(pDSoundStrmOut->streamCfg);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostDSoundControlOut(PPDMIHOSTAUDIO pInterface,
+                                                 PPDMAUDIOHSTSTRMOUT pHstStrmOut, PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("pHstStrmOut=%p, cmd=%d\n", pHstStrmOut, enmStreamCmd));
+
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+    PDSOUNDSTREAMOUT pDSoundStrmOut = (PDSOUNDSTREAMOUT)pHstStrmOut;
+
+    int rc = VINF_SUCCESS;
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+        {
+            /* Try to start playback. If it fails, then reopen and try again. */
+            rc = dsoundPlayStart(pDSoundStrmOut);
+            if (RT_FAILURE(rc))
+            {
+                dsoundPlayClose(pDSoundStrmOut);
+                dsoundPlayOpen(pThis, pDSoundStrmOut);
+
+                rc = dsoundPlayStart(pDSoundStrmOut);
+            }
+        } break;
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+        {
+            dsoundPlayStop(pThis, pDSoundStrmOut);
+        } break;
+
+        default:
+        {
+            AssertMsgFailed(("Invalid command %ld\n", enmStreamCmd));
+            rc = VERR_INVALID_PARAMETER;
+        } break;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+
+static DECLCALLBACK(int) drvHostDSoundPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                              uint32_t *pcSamplesPlayed)
+{
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+    PDSOUNDSTREAMOUT pDSoundStrmOut = (PDSOUNDSTREAMOUT)pHstStrmOut;
+    LPDIRECTSOUNDBUFFER pDSB = pDSoundStrmOut->pDSB;
+
+    int rc = VINF_SUCCESS;
+
+    if (!pDSB)
+    {
+        if (pcSamplesPlayed) /** @todo single point of return */
+            *pcSamplesPlayed = 0;
+        return VINF_SUCCESS;
+    }
+
+    int cShift = pHstStrmOut->Props.cShift;
+    DWORD cbBuffer = pDSoundStrmOut->csPlaybackBufferSize << cShift;
+
+    DWORD cbPlayPos, cbWritePos;
+    HRESULT hr = IDirectSoundBuffer_GetCurrentPosition(pDSB, &cbPlayPos, &cbWritePos);
+    if (hr == DSERR_BUFFERLOST)
+    {
+        rc = dsoundPlayRestore(pDSB);
+        if (RT_FAILURE(rc))
+        {
+            if (pcSamplesPlayed)
+                *pcSamplesPlayed = 0;
+            return VINF_SUCCESS;
+        }
+
+        hr = IDirectSoundBuffer_GetCurrentPosition(pDSB, &cbPlayPos, &cbWritePos);
+        if (hr == DSERR_BUFFERLOST)
+        {
+            /* Avoid log flooding if the error is still there. */
+            if (pcSamplesPlayed)
+                *pcSamplesPlayed = 0;
+            return VINF_SUCCESS;
+        }
+    }
+    if (FAILED (hr))
+    {
+        DSLOG(("DSound: get playback buffer position %Rhrc\n", hr));
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = 0;
+        return VINF_SUCCESS;
+    }
+
+    DWORD cbFree;
+    DWORD cbPlayWritePos;
+    if (pDSoundStrmOut->fReinitPlayPos)
+    {
+        pDSoundStrmOut->fReinitPlayPos = false;
+
+        pDSoundStrmOut->cbPlayWritePos = cbWritePos;
+
+        cbPlayWritePos = pDSoundStrmOut->cbPlayWritePos;
+        cbFree = cbBuffer - dsoundRingDistance(cbWritePos, cbPlayPos, cbBuffer);
+    }
+    else
+    {
+        if (pDSoundStrmOut->cbPlayWritePos == cbPlayPos)
+        {
+            /* Full buffer. */
+            if (pcSamplesPlayed)
+                *pcSamplesPlayed = 0;
+            return VINF_SUCCESS;
+        }
+
+        cbPlayWritePos = pDSoundStrmOut->cbPlayWritePos;
+        cbFree = dsoundRingDistance(cbPlayPos, cbPlayWritePos, cbBuffer);
+    }
+
+    uint32_t csLive = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
+    uint32_t cbLive = csLive << cShift;
+
+    /* Do not write more than available space in the DirectSound playback buffer. */
+    cbLive = RT_MIN(cbFree, cbLive);
+
+    cbLive &= ~pHstStrmOut->Props.uAlign;
+    if (cbLive == 0 || cbLive > cbBuffer)
+    {
+        DSLOG(("DSound: cbLive=%d cbBuffer=%d cbPlayWritePos=%d cbPlayPos=%d\n",
+              cbLive, cbBuffer, cbPlayWritePos, cbPlayPos));
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = 0;
+        return VINF_SUCCESS;
+    }
+
+    LPVOID pv1, pv2;
+    DWORD cb1, cb2;
+    rc = dsoundLockOutput(pDSB, &pHstStrmOut->Props, cbPlayWritePos, cbLive,
+                          &pv1, &pv2, &cb1, &cb2, 0 /* dwFlags */);
+    if (RT_FAILURE(rc))
+    {
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = 0;
+        return VINF_SUCCESS;
+    }
+
+    DWORD len1 = cb1 >> cShift;
+    DWORD len2 = cb2 >> cShift;
+
+    uint32_t cReadTotal = 0;
+    uint32_t cRead = 0;
+
+    if (pv1 && cb1)
+    {
+        rc = audioMixBufReadCirc(&pHstStrmOut->MixBuf, pv1, cb1, &cRead);
+        if (RT_SUCCESS(rc))
+            cReadTotal += cRead;
+    }
+
+    if (   RT_SUCCESS(rc)
+        && cReadTotal == len1
+        && pv2 && cb2)
+    {
+        rc = audioMixBufReadCirc(&pHstStrmOut->MixBuf, pv2, cb2, &cRead);
+        if (RT_SUCCESS(rc))
+            cReadTotal += cRead;
+    }
+
+    dsoundUnlockOutput(pDSB, pv1, pv2, cb1, cb2);
+
+    pDSoundStrmOut->cbPlayWritePos = (cbPlayWritePos + (cReadTotal << cShift)) % cbBuffer;
+
+    DSLOGF(("DSound: PlayOut %RU32 (%RU32 samples) out of %d%s, ds write pos %d -> %d, rc=%Rrc\n",
+            AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cReadTotal), cReadTotal, cbLive,
+            cbLive != AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cReadTotal) ? " !!!": "",
+            cbPlayWritePos, pDSoundStrmOut->cbPlayWritePos, rc));
+
+    if (cReadTotal)
+    {
+        audioMixBufFinish(&pHstStrmOut->MixBuf, cReadTotal);
+        rc = VINF_SUCCESS; /* Played something. */
+    }
+
+    if (pcSamplesPlayed)
+        *pcSamplesPlayed = cReadTotal;
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostDSoundFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+    PDSOUNDSTREAMOUT pDSoundStrmOut = (PDSOUNDSTREAMOUT)pHstStrmOut;
+
+    dsoundPlayClose(pDSoundStrmOut);
+
+    pDSoundStrmOut->cbPlayWritePos = 0;
+    pDSoundStrmOut->fReinitPlayPos = true;
+    pDSoundStrmOut->csPlaybackBufferSize = 0;
+    RT_ZERO(pDSoundStrmOut->streamCfg);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostDSoundInitIn(PPDMIHOSTAUDIO pInterface,
+                                             PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg,
+                                             PDMAUDIORECSOURCE enmRecSource,
+                                             uint32_t *pcSamples)
+{
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+    PDSOUNDSTREAMIN pDSoundStrmIn = (PDSOUNDSTREAMIN)pHstStrmIn;
+
+    LogFlowFunc(("pHstStrmIn=%p, pAudioSettings=%p, enmRecSource=%ld\n",
+                 pHstStrmIn, pCfg, enmRecSource));
+
+    pDSoundStrmIn->streamCfg = *pCfg;
+    pDSoundStrmIn->streamCfg.enmEndianness = PDMAUDIOHOSTENDIANNESS;
+
+    /** @todo caller should already init Props? */
+    int rc = drvAudioStreamCfgToProps(&pDSoundStrmIn->streamCfg, &pHstStrmIn->Props);
+    if (RT_SUCCESS(rc))
+    {
+        /* Init the stream structure and save relevant information to it. */
+        pDSoundStrmIn->csCaptureReadPos = 0;
+        pDSoundStrmIn->csCaptureBufferSize = 0;
+        pDSoundStrmIn->pDSC = NULL;
+        pDSoundStrmIn->pDSCB = NULL;
+        pDSoundStrmIn->enmRecSource = enmRecSource;
+        pDSoundStrmIn->hrLastCaptureIn = S_OK;
+
+        if (pcSamples)
+            *pcSamples = pThis->cfg.cbBufferIn >> pHstStrmIn->Props.cShift;
+
+        /* Try to open capture in case the device is already there. */
+        dsoundCaptureOpen(pThis, pDSoundStrmIn);
+    }
+    else
+    {
+        RT_ZERO(pDSoundStrmIn->streamCfg);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostDSoundControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("pHstStrmIn=%p, enmStreamCmd=%ld\n", pHstStrmIn, enmStreamCmd));
+
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+    PDSOUNDSTREAMIN pDSoundStrmIn = (PDSOUNDSTREAMIN)pHstStrmIn;
+
+    int rc = VINF_SUCCESS;
+
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+        {
+            /* Try to start capture. If it fails, then reopen and try again. */
+            rc = dsoundCaptureStart(pThis, pDSoundStrmIn);
+            if (RT_FAILURE(rc))
+            {
+                dsoundCaptureClose(pDSoundStrmIn);
+                dsoundCaptureOpen(pThis, pDSoundStrmIn);
+
+                rc = dsoundCaptureStart(pThis, pDSoundStrmIn);
+            }
+        } break;
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+        {
+            dsoundCaptureStop(pDSoundStrmIn);
+        } break;
+
+        default:
+        {
+            AssertMsgFailed(("Invalid command %ld\n", enmStreamCmd));
+            rc = VERR_INVALID_PARAMETER;
+        } break;
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostDSoundCaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                uint32_t *pcSamplesCaptured)
+{
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+    PDSOUNDSTREAMIN pDSoundStrmIn = (PDSOUNDSTREAMIN)pHstStrmIn;
+    LPDIRECTSOUNDCAPTUREBUFFER pDSCB = pDSoundStrmIn->pDSCB;
+
+    int rc;
+
+    if (pDSCB == NULL)
+    {
+        if (pcSamplesCaptured) /** @todo single point of return */
+            *pcSamplesCaptured = 0;
+        return VINF_SUCCESS;
+    }
+
+    /* Get DirectSound capture position in bytes. */
+    DWORD cbReadPos;
+    HRESULT hr = IDirectSoundCaptureBuffer_GetCurrentPosition(pDSCB, NULL, &cbReadPos);
+    if (FAILED(hr))
+    {
+        if (hr != pDSoundStrmIn->hrLastCaptureIn)
+        {
+            DSLOGREL(("DSound: CaptureIn GetCurrentPosition %Rhrc\n", hr));
+            pDSoundStrmIn->hrLastCaptureIn = hr;
+        }
+
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = 0;
+        return VINF_SUCCESS;
+    }
+    pDSoundStrmIn->hrLastCaptureIn = hr;
+
+    if (cbReadPos & pHstStrmIn->Props.uAlign)
+    {
+        DSLOG(("DSound: CaptureIn misaligned read position %d(%d)\n", cbReadPos, pHstStrmIn->Props.uAlign));
+    }
+
+    /* Capture position in samples. */
+    int csReadPos = cbReadPos >> pHstStrmIn->Props.cShift;
+
+    /* Number of samples available in the DirectSound capture buffer. */
+    DWORD csCaptured = dsoundRingDistance(csReadPos, pDSoundStrmIn->csCaptureReadPos, pDSoundStrmIn->csCaptureBufferSize);
+    if (csCaptured == 0)
+    {
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = 0;
+        return VINF_SUCCESS;
+    }
+
+    /* Using as an intermediate not circular buffer. */
+    audioMixBufReset(&pHstStrmIn->MixBuf);
+
+    /* Get number of free samples in the mix buffer and check that is has free space */
+    uint32_t csMixFree = audioMixBufFree(&pHstStrmIn->MixBuf);
+    if (csMixFree == 0)
+    {
+        DSLOG(("DSound: capture mix buffer full\n"));
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = 0;
+        return VINF_SUCCESS;
+    }
+
+    DSLOGF(("DSound: CaptureIn csMixFree = %u, csReadPos = %d, csCaptureReadPos = %d, csCaptured = %u\n",
+            csMixFree, csReadPos, pDSoundStrmIn->csCaptureReadPos, csCaptured));
+
+    /* No need to fetch more samples than mix buffer can receive. */
+    csCaptured = RT_MIN(csCaptured, csMixFree);
+
+    /* Lock relevant range in the DirectSound capture buffer. */
+    LPVOID pv1, pv2;
+    DWORD cb1, cb2;
+    rc = dsoundLockInput(pDSCB, &pHstStrmIn->Props,
+                         pDSoundStrmIn->csCaptureReadPos << pHstStrmIn->Props.cShift,
+                         csCaptured << pHstStrmIn->Props.cShift,
+                         &pv1, &pv2, &cb1, &cb2,
+                         0 /* dwFlags */);
+    if (RT_FAILURE(rc))
+    {
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = 0;
+        return VINF_SUCCESS;
+    }
+
+    DWORD len1 = cb1 >> pHstStrmIn->Props.cShift;
+    DWORD len2 = cb2 >> pHstStrmIn->Props.cShift;
+
+    uint32_t csWrittenTotal = 0;
+    uint32_t csWritten;
+    if (pv1 && len1)
+    {
+        rc = audioMixBufWriteAt(&pHstStrmIn->MixBuf, 0 /* offWrite */,
+                                pv1, cb1, &csWritten);
+        if (RT_SUCCESS(rc))
+            csWrittenTotal += csWritten;
+    }
+
+    if (   RT_SUCCESS(rc)
+        && csWrittenTotal == len1
+        && pv2 && len2)
+    {
+        rc = audioMixBufWriteAt(&pHstStrmIn->MixBuf, csWrittenTotal,
+                                pv2, cb2, &csWritten);
+        if (RT_SUCCESS(rc))
+            csWrittenTotal += csWritten;
+    }
+
+    dsoundUnlockInput(pDSCB, pv1, pv2, cb1, cb2);
+
+    uint32_t csProcessed = 0;
+    if (csWrittenTotal != 0)
+    {
+        /* Captured something. */
+        rc = audioMixBufMixToParent(&pHstStrmIn->MixBuf, csWrittenTotal,
+                                    &csProcessed);
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        pDSoundStrmIn->csCaptureReadPos = (pDSoundStrmIn->csCaptureReadPos + csProcessed) % pDSoundStrmIn->csCaptureBufferSize;
+        DSLOGF(("DSound: CaptureIn %d (%d+%d), processed %d/%d\n",
+                csCaptured, len1, len2, csProcessed, csWrittenTotal));
+    }
+
+    if (pcSamplesCaptured)
+        *pcSamplesCaptured = csProcessed;
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostDSoundFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+    PDSOUNDSTREAMIN pDSoundStrmIn = (PDSOUNDSTREAMIN)pHstStrmIn;
+
+    dsoundCaptureClose(pDSoundStrmIn);
+
+    pDSoundStrmIn->csCaptureReadPos = 0;
+    pDSoundStrmIn->csCaptureBufferSize = 0;
+    RT_ZERO(pDSoundStrmIn->streamCfg);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(bool) drvHostDSoundIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
+{
+    NOREF(pInterface);
+    NOREF(enmDir);
+    return true; /* Always all enabled. */
+}
+
+static DECLCALLBACK(int) drvHostDSoundGetConf(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pCfg)
+{
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    dsoundFreeDeviceLists(pThis);
+
+    pCfg->cbStreamOut = sizeof(DSOUNDSTREAMOUT);
+    pCfg->cbStreamIn  = sizeof(DSOUNDSTREAMIN);
+
+    pCfg->cMaxHstStrmsOut = 0;
+    pCfg->cMaxHstStrmsIn  = 0;
+
+    DSOUNDENUMCBCTX ctx = { pThis, pCfg };
+
+    HRESULT hr = DirectSoundEnumerateW(&dsoundEnumCallback, &ctx);
+    if (FAILED(hr))
+        DSLOG(("DSound: Enumerating host playback devices failed %Rhrc\n", hr));
+
+    DSLOGREL(("DSound: Found %RU32 host playback devices\n", pCfg->cMaxHstStrmsOut));
+    if (pCfg->cMaxHstStrmsOut == 0)
+        pCfg->cMaxHstStrmsOut = 1; /* Support at least one stream. */
+
+    hr = DirectSoundCaptureEnumerateW(&dsoundCaptureEnumCallback, &ctx);
+    if (FAILED(hr))
+        DSLOG(("DSound: Enumerating host capturing devices failed %Rhrc\n", hr));
+
+    DSLOGREL(("DSound: Found %RU32 host capturing devices\n", pCfg->cMaxHstStrmsIn));
+    if (pCfg->cMaxHstStrmsIn < 2)
+    {
+        DSLOGREL(("DSound: Adjusting the number of host capturing devices from %RU32 to 2\n", pCfg->cMaxHstStrmsIn));
+        pCfg->cMaxHstStrmsIn = 2; /* Support at least two streams (line in + mic). */
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(void) drvHostDSoundShutdown(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+}
+
+static DECLCALLBACK(int) drvHostDSoundInit(PPDMIHOSTAUDIO pInterface)
+{
+    PDRVHOSTDSOUND pThis = PDMIHOSTAUDIO_2_DRVHOSTDSOUND(pInterface);
+
+    LogFlowFuncEnter();
+
+    /* Verify that IDirectSound is available. */
+    LPDIRECTSOUND pDirectSound = NULL;
+    HRESULT hr = CoCreateInstance(CLSID_DirectSound, NULL, CLSCTX_ALL,
+                                  IID_IDirectSound, (void **)&pDirectSound);
+    if (SUCCEEDED(hr))
+        IDirectSound_Release(pDirectSound);
+    else
+        DSLOGREL(("DSound: not available %Rhrc\n", hr));
+
+    int rc = SUCCEEDED(hr) ? VINF_SUCCESS: VERR_NOT_SUPPORTED;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(void *) drvHostDSoundQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDRVINS     pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTDSOUND pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTDSOUND);
+
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+    return NULL;
+}
+
+static int dsoundConfigQueryStringAlloc(PCFGMNODE pNode, const char *pszName, char **ppszString)
+{
+    size_t cbString;
+    int rc = CFGMR3QuerySize(pNode, pszName, &cbString);
+    if (RT_SUCCESS(rc))
+    {
+        char *pszString = RTStrAlloc(cbString);
+        if (pszString)
+        {
+            rc = CFGMR3QueryString(pNode, pszName, pszString, cbString);
+            if (RT_SUCCESS(rc))
+                *ppszString = pszString;
+            else
+                RTStrFree(pszString);
+        }
+        else
+            rc = VERR_NO_MEMORY;
+    }
+    return rc;
+}
+
+static LPCGUID dsoundConfigQueryGUID(PCFGMNODE pCfg, const char *pszName, RTUUID *pUuid)
+{
+    LPCGUID pGuid = NULL;
+
+    char *pszGuid = NULL;
+    dsoundConfigQueryStringAlloc(pCfg, pszName, &pszGuid);
+    if (pszGuid)
+    {
+        int rc = RTUuidFromStr(pUuid, pszGuid);
+        if (RT_SUCCESS(rc))
+            pGuid = (LPCGUID)&pUuid;
+        else
+            DSLOGREL(("DSound: Parse DirectSound %s %Rrc\n", pszName, rc));
+
+        RTStrFree(pszGuid);
+    }
+
+    return pGuid;
+}
+
+static void dSoundConfigInit(PDRVHOSTDSOUND pThis, PCFGMNODE pCfg)
+{
+    unsigned int uBufsizeOut, uBufsizeIn;
+
+    CFGMR3QueryUIntDef(pCfg, "BufsizeOut", &uBufsizeOut, _16K);
+    CFGMR3QueryUIntDef(pCfg, "BufsizeIn",  &uBufsizeIn,  _16K);
+    pThis->cfg.cbBufferOut = uBufsizeOut;
+    pThis->cfg.cbBufferIn  = uBufsizeIn;
+
+    pThis->cfg.pGuidPlay    = dsoundConfigQueryGUID(pCfg, "DeviceGuidOut", &pThis->cfg.uuidPlay);
+    pThis->cfg.pGuidCapture = dsoundConfigQueryGUID(pCfg, "DeviceGuidIn",  &pThis->cfg.uuidCapture);
+
+    DSLOG(("DSound: BufsizeOut %u, BufsizeIn %u, DeviceGuidOut {%RTuuid}, DeviceGuidIn {%RTuuid}\n",
+           pThis->cfg.cbBufferOut,
+           pThis->cfg.cbBufferIn,
+           &pThis->cfg.uuidPlay,
+           &pThis->cfg.uuidCapture));
+}
+
+static DECLCALLBACK(void) drvHostDSoundDestruct(PPDMDRVINS pDrvIns)
+{
+    PDRVHOSTDSOUND pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTDSOUND);
+
+    LogFlowFuncEnter();
+
+    CoUninitialize();
+
+    LogFlowFuncLeave();
+}
+
+/**
+ * Construct a DirectSound Audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(int) drvHostDSoundConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    PDRVHOSTDSOUND pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTDSOUND);
+    DSLOGREL(("Audio: Initializing DirectSound audio driver\n"));
+
+    HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+    if (FAILED(hr))
+    {
+        DSLOGREL(("DSound: COM initialize %Rhrc\n", hr));
+        return VERR_NOT_SUPPORTED;
+    }
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                    = pDrvIns;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface  = drvHostDSoundQueryInterface;
+    /* IHostAudio */
+    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostDSound);
+
+    RTListInit(&pThis->lstDevInput);
+    RTListInit(&pThis->lstDevOutput);
+
+    /*
+     * Initialize configuration values.
+     */
+    dSoundConfigInit(pThis, pCfg);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * PDM driver registration.
+ */
+const PDMDRVREG g_DrvHostDSound =
+{
+    /* u32Version */
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "DSoundAudio",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "DirectSound Audio host driver",
+    /* fFlags */
+     PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVHOSTDSOUND),
+    /* pfnConstruct */
+    drvHostDSoundConstruct,
+    /* pfnDestruct */
+    drvHostDSoundDestruct,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
diff --git a/src/VBox/Devices/Audio/DrvHostNullAudio.cpp b/src/VBox/Devices/Audio/DrvHostNullAudio.cpp
new file mode 100644
index 0000000..fa1107a
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvHostNullAudio.cpp
@@ -0,0 +1,318 @@
+/* $Id: DrvHostNullAudio.cpp $ */
+/** @file
+ * NULL audio driver -- also acts as a fallback if no
+ * other backend is available.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ *
+ * This code is based on: noaudio.c QEMU based code.
+ *
+ * QEMU Timer based audio emulation
+ *
+ * Copyright (c) 2004-2005 Vassili Karpov (malc)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "DrvAudio.h"
+#include "AudioMixBuffer.h"
+
+#include "VBoxDD.h"
+#include "vl_vbox.h"
+
+#include <iprt/alloc.h>
+#include <iprt/uuid.h> /* For PDMIBASE_2_PDMDRV. */
+#include <VBox/vmm/pdmaudioifs.h>
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+typedef struct NULLAUDIOSTREAMOUT
+{
+    /** Note: Always must come first! */
+    PDMAUDIOHSTSTRMOUT hw;
+    uint64_t u64TicksLast;
+} NULLAUDIOSTREAMOUT;
+
+typedef struct NULLAUDIOSTREAMIN
+{
+    /** Note: Always must come first! */
+    PDMAUDIOHSTSTRMIN hw;
+} NULLAUDIOSTREAMIN;
+
+/**
+ * NULL audio driver instance data.
+ * @implements PDMIAUDIOCONNECTOR
+ */
+typedef struct DRVHOSTNULLAUDIO
+{
+    /** Pointer to the driver instance structure. */
+    PPDMDRVINS    pDrvIns;
+    /** Pointer to host audio interface. */
+    PDMIHOSTAUDIO IHostAudio;
+} DRVHOSTNULLAUDIO, *PDRVHOSTNULLAUDIO;
+
+/*******************************************PDM_AUDIO_DRIVER******************************/
+
+
+static DECLCALLBACK(int) drvHostNullAudioGetConf(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pCfg)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    pCfg->cbStreamOut = sizeof(NULLAUDIOSTREAMOUT);
+    pCfg->cbStreamIn  = sizeof(NULLAUDIOSTREAMIN);
+
+    pCfg->cMaxHstStrmsOut = 1; /* Output */
+    pCfg->cMaxHstStrmsIn  = 2; /* Line input + microphone input. */
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostNullAudioInit(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostNullAudioInitIn(PPDMIHOSTAUDIO pInterface,
+                                                PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg,
+                                                PDMAUDIORECSOURCE enmRecSource,
+                                                uint32_t *pcSamples)
+{
+    NOREF(pInterface);
+    NOREF(enmRecSource);
+
+    /* Just adopt the wanted stream configuration. */
+    int rc = drvAudioStreamCfgToProps(pCfg, &pHstStrmIn->Props);
+    if (RT_SUCCESS(rc))
+    {
+        if (pcSamples)
+            *pcSamples = _1K;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostNullAudioInitOut(PPDMIHOSTAUDIO pInterface,
+                                                 PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
+                                                 uint32_t *pcSamples)
+{
+    NOREF(pInterface);
+
+    /* Just adopt the wanted stream configuration. */
+    int rc = drvAudioStreamCfgToProps(pCfg, &pHstStrmOut->Props);
+    if (RT_SUCCESS(rc))
+    {
+        NULLAUDIOSTREAMOUT *pNullStrmOut = (NULLAUDIOSTREAMOUT *)pHstStrmOut;
+        pNullStrmOut->u64TicksLast = 0;
+        if (pcSamples)
+            *pcSamples = _1K;
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(bool) drvHostNullAudioIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
+{
+    NOREF(pInterface);
+    NOREF(enmDir);
+    return true; /* Always all enabled. */
+}
+
+static DECLCALLBACK(int) drvHostNullAudioPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                 uint32_t *pcSamplesPlayed)
+{
+    PDRVHOSTNULLAUDIO pDrv = RT_FROM_MEMBER(pInterface, DRVHOSTNULLAUDIO, IHostAudio);
+    NULLAUDIOSTREAMOUT *pNullStrmOut = (NULLAUDIOSTREAMOUT *)pHstStrmOut;
+
+    /* Consume as many samples as would be played at the current frequency since last call. */
+    uint32_t csLive = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
+    uint64_t u64TicksNow = PDMDrvHlpTMGetVirtualTime(pDrv->pDrvIns);
+    uint64_t u64TicksElapsed = u64TicksNow  - pNullStrmOut->u64TicksLast;
+    uint64_t u64TicksFreq = PDMDrvHlpTMGetVirtualFreq(pDrv->pDrvIns);
+
+    /* Remember when samples were consumed. */
+    pNullStrmOut->u64TicksLast = u64TicksNow;
+
+    /* Minimize the rounding error by adding 0.5: samples = int((u64TicksElapsed * samplesFreq) / u64TicksFreq + 0.5).
+     * If rounding is not taken into account then the playback rate will be consistently lower that expected.
+     */
+    uint64_t cSamplesPlayed = (2 * u64TicksElapsed * pHstStrmOut->Props.uHz + u64TicksFreq) / u64TicksFreq / 2;
+
+    /* Don't play more than available. */
+    if (cSamplesPlayed > csLive)
+        cSamplesPlayed = csLive;
+
+    audioMixBufFinish(&pHstStrmOut->MixBuf, cSamplesPlayed);
+
+    if (pcSamplesPlayed)
+        *pcSamplesPlayed = cSamplesPlayed;
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostNullAudioCaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                   uint32_t *pcSamplesCaptured)
+{
+    /* Never capture anything. */
+    if (pcSamplesCaptured)
+        *pcSamplesCaptured = 0;
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostNullAudioControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                   PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    NOREF(pInterface);
+    NOREF(pHstStrmIn);
+    NOREF(enmStreamCmd);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostNullAudioControlOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                    PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    NOREF(pInterface);
+    NOREF(pHstStrmOut);
+    NOREF(enmStreamCmd);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostNullAudioFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostNullAudioFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    return VINF_SUCCESS;
+}
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) drvHostNullAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDRVINS        pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTNULLAUDIO pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTNULLAUDIO);
+
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+    return NULL;
+}
+
+static DECLCALLBACK(void) drvHostNullAudioShutdown(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+}
+
+/**
+ * Constructs a Null audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(int) drvHostNullAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);
+    /* pCfg is optional. */
+
+    PDRVHOSTNULLAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTNULLAUDIO);
+    LogRel(("Audio: Initializing NULL driver\n"));
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                   = pDrvIns;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface = drvHostNullAudioQueryInterface;
+    /* IHostAudio */
+    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostNullAudio);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Char driver registration record.
+ */
+const PDMDRVREG g_DrvHostNullAudio =
+{
+    /* u32Version */
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "NullAudio",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "NULL audio host driver",
+    /* fFlags */
+    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVHOSTNULLAUDIO),
+    /* pfnConstruct */
+    drvHostNullAudioConstruct,
+    /* pfnDestruct */
+    NULL,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
+
diff --git a/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp b/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp
new file mode 100644
index 0000000..853fea7
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp
@@ -0,0 +1,997 @@
+/* $Id */
+/** @file
+ * OSS (Open Sound System) host audio backend.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ * --------------------------------------------------------------------
+ */
+#include "DrvAudio.h"
+#include "AudioMixBuffer.h"
+
+#include "VBoxDD.h"
+#include "vl_vbox.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/soundcard.h>
+#include <unistd.h>
+
+#include <iprt/alloc.h>
+#include <iprt/uuid.h> /* For PDMIBASE_2_PDMDRV. */
+#include <VBox/vmm/pdmaudioifs.h>
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+
+/**
+ * OSS host audio driver instance data.
+ * @implements PDMIAUDIOCONNECTOR
+ */
+typedef struct DRVHOSTOSSAUDIO
+{
+    /** Pointer to the driver instance structure. */
+    PPDMDRVINS         pDrvIns;
+    /** Pointer to host audio interface. */
+    PDMIHOSTAUDIO      IHostAudio;
+    /** Error count for not flooding the release log.
+     *  UINT32_MAX for unlimited logging. */
+    uint32_t           cLogErrors;
+} DRVHOSTOSSAUDIO, *PDRVHOSTOSSAUDIO;
+
+typedef struct OSSAUDIOSTREAMCFG
+{
+    PDMAUDIOFMT       enmFormat;
+    PDMAUDIOENDIANNESS enmENDIANNESS;
+    uint16_t          uFreq;
+    uint8_t           cChannels;
+    uint16_t          cFragments;
+    uint32_t          cbFragmentSize;
+} OSSAUDIOSTREAMCFG, *POSSAUDIOSTREAMCFG;
+
+typedef struct OSSAUDIOSTREAMIN
+{
+    /** Note: Always must come first! */
+    PDMAUDIOHSTSTRMIN  pStreamIn;
+    int                hFile;
+    int                cFragments;
+    int                cbFragmentSize;
+    void              *pvBuf;
+    size_t             cbBuf;
+    int                old_optr;
+} OSSAUDIOSTREAMIN, *POSSAUDIOSTREAMIN;
+
+typedef struct OSSAUDIOSTREAMOUT
+{
+    /** Note: Always must come first! */
+    PDMAUDIOHSTSTRMOUT  pStreamOut;
+    int                 hFile;
+    int                 cFragments;
+    int                 cbFragmentSize;
+#ifndef RT_OS_L4
+    bool                fMemMapped;
+#endif
+    void               *pvPCMBuf;
+    int                 old_optr;
+} OSSAUDIOSTREAMOUT, *POSSAUDIOSTREAMOUT;
+
+typedef struct OSSAUDIOCFG
+{
+#ifndef RT_OS_L4
+    bool try_mmap;
+#endif
+    int nfrags;
+    int fragsize;
+    const char *devpath_out;
+    const char *devpath_in;
+    int debug;
+} OSSAUDIOCFG, *POSSAUDIOCFG;
+
+static OSSAUDIOCFG s_OSSConf =
+{
+#ifndef RT_OS_L4
+    false,
+#endif
+    4,
+    4096,
+    "/dev/dsp",
+    "/dev/dsp",
+    0
+};
+
+
+/* http://www.df.lth.se/~john_e/gems/gem002d.html */
+static uint32_t popcount(uint32_t u)
+{
+    u = ((u&0x55555555) + ((u>>1)&0x55555555));
+    u = ((u&0x33333333) + ((u>>2)&0x33333333));
+    u = ((u&0x0f0f0f0f) + ((u>>4)&0x0f0f0f0f));
+    u = ((u&0x00ff00ff) + ((u>>8)&0x00ff00ff));
+    u = ( u&0x0000ffff) + (u>>16);
+    return u;
+}
+
+static uint32_t lsbindex(uint32_t u)
+{
+    return popcount ((u&-u)-1);
+}
+
+static int drvHostOSSAudioFmtToOSS(PDMAUDIOFMT fmt)
+{
+    switch (fmt)
+    {
+        case AUD_FMT_S8:
+            return AFMT_S8;
+
+        case AUD_FMT_U8:
+            return AFMT_U8;
+
+        case AUD_FMT_S16:
+            return AFMT_S16_LE;
+
+        case AUD_FMT_U16:
+            return AFMT_U16_LE;
+
+        default:
+            break;
+    }
+
+    AssertMsgFailed(("Format %ld not supported\n", fmt));
+    return AFMT_U8;
+}
+
+static int drvHostOSSAudioOSSToFmt(int fmt,
+                                   PDMAUDIOFMT *pFmt, PDMAUDIOENDIANNESS *pENDIANNESS)
+{
+    switch (fmt)
+    {
+        case AFMT_S8:
+            *pFmt = AUD_FMT_S8;
+            if (pENDIANNESS)
+                *pENDIANNESS = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case AFMT_U8:
+            *pFmt = AUD_FMT_U8;
+            if (pENDIANNESS)
+                *pENDIANNESS = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case AFMT_S16_LE:
+            *pFmt = AUD_FMT_S16;
+            if (pENDIANNESS)
+                *pENDIANNESS = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case AFMT_U16_LE:
+            *pFmt = AUD_FMT_U16;
+            if (pENDIANNESS)
+                *pENDIANNESS = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case AFMT_S16_BE:
+            *pFmt = AUD_FMT_S16;
+            if (pENDIANNESS)
+                *pENDIANNESS = PDMAUDIOENDIANNESS_BIG;
+            break;
+
+        case AFMT_U16_BE:
+            *pFmt = AUD_FMT_U16;
+            if (pENDIANNESS)
+                *pENDIANNESS = PDMAUDIOENDIANNESS_BIG;
+            break;
+
+        default:
+            AssertMsgFailed(("Format %ld not supported\n", fmt));
+            return VERR_NOT_SUPPORTED;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int drvHostOSSAudioClose(int *phFile)
+{
+    if (!phFile || !*phFile)
+        return VINF_SUCCESS;
+
+    int rc;
+    if (close(*phFile))
+    {
+        LogRel(("OSS: Closing descriptor failed: %s\n",
+                strerror(errno)));
+        rc = VERR_GENERAL_FAILURE; /** @todo */
+    }
+    else
+    {
+        *phFile = -1;
+        rc = VINF_SUCCESS;
+    }
+
+    return rc;
+}
+
+static int drvHostOSSAudioOpen(bool fIn,
+                               POSSAUDIOSTREAMCFG pReq, POSSAUDIOSTREAMCFG pObt,
+                               int *phFile)
+{
+    AssertPtrReturn(pReq, VERR_INVALID_POINTER);
+    AssertPtrReturn(pObt, VERR_INVALID_POINTER);
+    AssertPtrReturn(phFile, VERR_INVALID_POINTER);
+
+    int rc;
+    int hFile;
+
+    do
+    {
+        const char *pszDev = fIn ? s_OSSConf.devpath_in : s_OSSConf.devpath_out;
+        if (!pszDev)
+        {
+            LogRel(("OSS: Invalid or no %s device name set\n",
+                    fIn ? "input" : "output"));
+            rc = VERR_INVALID_PARAMETER;
+            break;
+        }
+
+        hFile = open(pszDev, (fIn ? O_RDONLY : O_WRONLY) | O_NONBLOCK);
+        if (hFile == -1)
+        {
+            LogRel(("OSS: Failed to open %s: %s\n", pszDev, strerror(errno)));
+            rc = RTErrConvertFromErrno(errno);
+            break;
+        }
+
+        int iFormat = drvHostOSSAudioFmtToOSS(pReq->enmFormat);
+        if (ioctl(hFile, SNDCTL_DSP_SAMPLESIZE, &iFormat))
+        {
+            LogRel(("OSS: Failed to set audio format to %ld\n",
+                    iFormat, strerror(errno)));
+            rc = RTErrConvertFromErrno(errno);
+            break;
+        }
+
+        int cChannels = pReq->cChannels;
+        if (ioctl(hFile, SNDCTL_DSP_CHANNELS, &cChannels))
+        {
+            LogRel(("OSS: Failed to set number of audio channels (%d): %s\n",
+                     pReq->cChannels, strerror(errno)));
+            rc = RTErrConvertFromErrno(errno);
+            break;
+        }
+
+        int freq = pReq->uFreq;
+        if (ioctl(hFile, SNDCTL_DSP_SPEED, &freq))
+        {
+            LogRel(("OSS: Failed to set audio frequency (%dHZ): %s\n",
+                    pReq->uFreq, strerror(errno)));
+            rc = RTErrConvertFromErrno(errno);
+            break;
+        }
+
+        /* Obsolete on Solaris (using O_NONBLOCK is sufficient). */
+#if !(defined(VBOX) && defined(RT_OS_SOLARIS))
+        if (ioctl(hFile, SNDCTL_DSP_NONBLOCK))
+        {
+            LogRel(("OSS: Failed to set non-blocking mode: %s\n",
+                    strerror(errno)));
+            rc = RTErrConvertFromErrno(errno);
+            break;
+        }
+#endif
+        int mmmmssss = (pReq->cFragments << 16) | lsbindex(pReq->cbFragmentSize);
+        if (ioctl(hFile, SNDCTL_DSP_SETFRAGMENT, &mmmmssss))
+        {
+            LogRel(("OSS: Failed to set %RU16 fragments to %RU32 bytes each: %s\n",
+                    pReq->cFragments, pReq->cbFragmentSize, strerror(errno)));
+            rc = RTErrConvertFromErrno(errno);
+            break;
+        }
+
+        audio_buf_info abinfo;
+        if (ioctl(hFile, fIn ? SNDCTL_DSP_GETISPACE : SNDCTL_DSP_GETOSPACE,
+                  &abinfo))
+        {
+            LogRel(("OSS: Failed to retrieve buffer length: %s\n", strerror(errno)));
+            rc = RTErrConvertFromErrno(errno);
+            break;
+        }
+
+        rc = drvHostOSSAudioOSSToFmt(iFormat,
+                                     &pObt->enmFormat, &pObt->enmENDIANNESS);
+        if (RT_SUCCESS(rc))
+        {
+            pObt->cChannels      = cChannels;
+            pObt->uFreq          = freq;
+            pObt->cFragments     = abinfo.fragstotal;
+            pObt->cbFragmentSize = abinfo.fragsize;
+
+            *phFile = hFile;
+        }
+    }
+    while (0);
+
+    if (RT_FAILURE(rc))
+        drvHostOSSAudioClose(&hFile);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                   PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    NOREF(pInterface);
+    NOREF(pHstStrmIn);
+    NOREF(enmStreamCmd);
+
+    /** @todo Nothing to do here right now!? */
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioControlOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                   PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    POSSAUDIOSTREAMOUT pThisStrmOut = (POSSAUDIOSTREAMOUT)pHstStrmOut;
+
+#ifdef RT_OS_L4
+    return VINF_SUCCESS;
+#else
+    if (!pThisStrmOut->fMemMapped)
+        return VINF_SUCCESS;
+#endif
+
+    int rc = VINF_SUCCESS;
+    int mask;
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+        {
+            audio_pcm_info_clear_buf(&pHstStrmOut->Props,
+                                     pThisStrmOut->pvPCMBuf, audioMixBufSize(&pHstStrmOut->MixBuf));
+
+            mask = PCM_ENABLE_OUTPUT;
+            if (ioctl(pThisStrmOut->hFile, SNDCTL_DSP_SETTRIGGER, &mask) < 0)
+            {
+                LogRel(("OSS: Failed to enable output stream: %s\n", strerror(errno)));
+                rc = RTErrConvertFromErrno(errno);
+            }
+
+            break;
+        }
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+        {
+            mask = 0;
+            if (ioctl(pThisStrmOut->hFile, SNDCTL_DSP_SETTRIGGER, &mask) < 0)
+            {
+                LogRel(("OSS: Failed to disable output stream: %s\n", strerror(errno)));
+                rc = RTErrConvertFromErrno(errno);
+            }
+
+            break;
+        }
+
+        default:
+            AssertMsgFailed(("Invalid command %ld\n", enmStreamCmd));
+            rc = VERR_INVALID_PARAMETER;
+            break;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioInit(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+
+    LogFlowFuncEnter();
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioCaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                  uint32_t *pcSamplesCaptured)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    POSSAUDIOSTREAMIN pThisStrmIn = (POSSAUDIOSTREAMIN)pHstStrmIn;
+
+    int rc = VINF_SUCCESS;
+    size_t cbToRead = RT_MIN(pThisStrmIn->cbBuf,
+                             audioMixBufFreeBytes(&pHstStrmIn->MixBuf));
+
+    LogFlowFunc(("cbToRead=%zu\n", cbToRead));
+
+    uint32_t cWrittenTotal = 0;
+    uint32_t cbTemp;
+    ssize_t  cbRead;
+    size_t   offWrite = 0;
+
+    while (cbToRead)
+    {
+        cbTemp = RT_MIN(cbToRead, pThisStrmIn->cbBuf);
+        AssertBreakStmt(cbTemp, rc = VERR_NO_DATA);
+        cbRead = read(pThisStrmIn->hFile, (uint8_t *)pThisStrmIn->pvBuf + offWrite, cbTemp);
+
+        LogFlowFunc(("cbRead=%zi, cbTemp=%RU32, cbToRead=%zu\n",
+                     cbRead, cbTemp, cbToRead));
+
+        if (cbRead < 0)
+        {
+            switch (errno)
+            {
+                case 0:
+                {
+                    LogFunc(("Failed to read %z frames\n", cbRead));
+                    rc = VERR_ACCESS_DENIED;
+                    break;
+                }
+
+                case EINTR:
+                case EAGAIN:
+                    rc = VERR_NO_DATA;
+                    break;
+
+                default:
+                    LogFlowFunc(("Failed to read %zu input frames, rc=%Rrc\n",
+                                 cbTemp, rc));
+                    rc = VERR_GENERAL_FAILURE; /** @todo */
+                    break;
+            }
+
+            if (RT_FAILURE(rc))
+                break;
+        }
+        else if (cbRead)
+        {
+            uint32_t cWritten;
+            rc = audioMixBufWriteCirc(&pHstStrmIn->MixBuf,
+                                      pThisStrmIn->pvBuf, cbRead,
+                                      &cWritten);
+            if (RT_FAILURE(rc))
+                break;
+
+            uint32_t cbWritten = AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf, cWritten);
+
+            Assert(cbToRead >= cbWritten);
+            cbToRead      -= cbWritten;
+            offWrite      += cbWritten;
+            cWrittenTotal += cWritten;
+        }
+        else /* No more data, try next round. */
+            break;
+    }
+
+    if (rc == VERR_NO_DATA)
+        rc = VINF_SUCCESS;
+
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cProcessed = 0;
+        if (cWrittenTotal)
+            rc = audioMixBufMixToParent(&pHstStrmIn->MixBuf, cWrittenTotal,
+                                        &cProcessed);
+
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = cWrittenTotal;
+
+        LogFlowFunc(("cWrittenTotal=%RU32 (%RU32 processed), rc=%Rrc\n",
+                     cWrittenTotal, cProcessed, rc));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    POSSAUDIOSTREAMIN pThisStrmIn = (POSSAUDIOSTREAMIN)pHstStrmIn;
+
+    LogFlowFuncEnter();
+
+    if (pThisStrmIn->pvBuf)
+    {
+        RTMemFree(pThisStrmIn->pvBuf);
+        pThisStrmIn->pvBuf = NULL;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    POSSAUDIOSTREAMOUT pThisStrmOut = (POSSAUDIOSTREAMOUT)pHstStrmOut;
+
+    LogFlowFuncEnter();
+
+#ifndef RT_OS_L4
+    if (!pThisStrmOut->fMemMapped)
+    {
+        if (pThisStrmOut->pvPCMBuf)
+        {
+            RTMemFree(pThisStrmOut->pvPCMBuf);
+            pThisStrmOut->pvPCMBuf = NULL;
+        }
+    }
+#endif
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioGetConf(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pCfg)
+{
+    NOREF(pInterface);
+
+    pCfg->cbStreamOut = sizeof(OSSAUDIOSTREAMOUT);
+    pCfg->cbStreamIn = sizeof(OSSAUDIOSTREAMIN);
+    pCfg->cMaxHstStrmsOut = INT_MAX;
+    pCfg->cMaxHstStrmsIn = INT_MAX;
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioInitIn(PPDMIHOSTAUDIO pInterface,
+                                               PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg,
+                                               PDMAUDIORECSOURCE enmRecSource,
+                                               uint32_t *pcSamples)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    POSSAUDIOSTREAMIN pThisStrmIn = (POSSAUDIOSTREAMIN)pHstStrmIn;
+
+    int rc;
+    int hFile = -1;
+
+    do
+    {
+        uint32_t cSamples;
+
+        OSSAUDIOSTREAMCFG reqStream, obtStream;
+        reqStream.enmFormat      = pCfg->enmFormat;
+        reqStream.uFreq          = pCfg->uHz;
+        reqStream.cChannels      = pCfg->cChannels;
+        reqStream.cFragments     = s_OSSConf.nfrags;
+        reqStream.cbFragmentSize = s_OSSConf.fragsize;
+
+        rc = drvHostOSSAudioOpen(true /* fIn */,
+                                 &reqStream, &obtStream, &hFile);
+        if (RT_SUCCESS(rc))
+        {
+            if (obtStream.cFragments * obtStream.cbFragmentSize & pHstStrmIn->Props.uAlign)
+                LogRel(("OSS: Warning: Misaligned DAC output buffer: Size = %zu, Alignment = %u\n",
+                        obtStream.cFragments * obtStream.cbFragmentSize,
+                        pHstStrmIn->Props.uAlign + 1));
+
+            pThisStrmIn->hFile = hFile;
+
+            PDMAUDIOSTREAMCFG streamCfg;
+            streamCfg.enmFormat     = obtStream.enmFormat;
+            streamCfg.uHz           = obtStream.uFreq;
+            streamCfg.cChannels     = pCfg->cChannels;
+            streamCfg.enmEndianness = obtStream.enmENDIANNESS;
+
+            rc = drvAudioStreamCfgToProps(&streamCfg, &pHstStrmIn->Props);
+            if (RT_SUCCESS(rc))
+            {
+                cSamples = (obtStream.cFragments * obtStream.cbFragmentSize)
+                           >> pHstStrmIn->Props.cShift;
+                if (!cSamples)
+                    rc = VERR_INVALID_PARAMETER;
+            }
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            size_t cbBuf = cSamples * (1 << pHstStrmIn->Props.cShift);
+            pThisStrmIn->pvBuf = RTMemAlloc(cbBuf);
+            if (!pThisStrmIn->pvBuf)
+            {
+                LogRel(("OSS: Failed allocating ADC buffer with %RU32 samples, each %d bytes\n",
+                        cSamples, 1 << pHstStrmIn->Props.cShift));
+                rc = VERR_NO_MEMORY;
+            }
+
+            pThisStrmIn->cbBuf = cbBuf;
+
+            if (pcSamples)
+                *pcSamples = cSamples;
+        }
+
+    } while (0);
+
+    if (RT_FAILURE(rc))
+        drvHostOSSAudioClose(&hFile);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioInitOut(PPDMIHOSTAUDIO pInterface,
+                                                PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
+                                                uint32_t *pcSamples)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    POSSAUDIOSTREAMOUT pThisStrmOut = (POSSAUDIOSTREAMOUT)pHstStrmOut;
+
+    int rc;
+    int hFile = -1;
+
+    do
+    {
+        uint32_t cSamples;
+
+        OSSAUDIOSTREAMCFG reqStream, obtStream;
+        reqStream.enmFormat      = pCfg->enmFormat;
+        reqStream.uFreq          = pCfg->uHz;
+        reqStream.cChannels      = pCfg->cChannels;
+        reqStream.cFragments     = s_OSSConf.nfrags;
+        reqStream.cbFragmentSize = s_OSSConf.fragsize;
+
+        rc = drvHostOSSAudioOpen(false /* fIn */,
+                                 &reqStream, &obtStream, &hFile);
+        if (RT_SUCCESS(rc))
+        {
+            if (obtStream.cFragments * obtStream.cbFragmentSize & pHstStrmOut->Props.uAlign)
+                LogRel(("OSS: Warning: Misaligned DAC output buffer: Size = %zu, Alignment = %u\n",
+                        obtStream.cFragments * obtStream.cbFragmentSize,
+                        pHstStrmOut->Props.uAlign + 1));
+
+            pThisStrmOut->hFile = hFile;
+
+            PDMAUDIOSTREAMCFG streamCfg;
+            streamCfg.enmFormat     = obtStream.enmFormat;
+            streamCfg.uHz           = obtStream.uFreq;
+            streamCfg.cChannels     = pCfg->cChannels;
+            streamCfg.enmEndianness = obtStream.enmENDIANNESS;
+
+            rc = drvAudioStreamCfgToProps(&streamCfg, &pHstStrmOut->Props);
+            if (RT_SUCCESS(rc))
+                cSamples = (obtStream.cFragments * obtStream.cbFragmentSize)
+                           >> pHstStrmOut->Props.cShift;
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+#ifndef RT_OS_L4
+            pThisStrmOut->fMemMapped = false;
+            if (s_OSSConf.try_mmap)
+            {
+                pThisStrmOut->pvPCMBuf = mmap(0, cSamples << pHstStrmOut->Props.cShift,
+                                              PROT_READ | PROT_WRITE, MAP_SHARED, hFile, 0);
+                if (pThisStrmOut->pvPCMBuf == MAP_FAILED)
+                {
+                    LogRel(("OSS: Failed to memory map %zu bytes of DAC output file: %s\n",
+                            cSamples << pHstStrmOut->Props.cShift, strerror(errno)));
+                    rc = RTErrConvertFromErrno(errno);
+                    break;
+                }
+                else
+                {
+                    int mask = 0;
+                    if (ioctl(hFile, SNDCTL_DSP_SETTRIGGER, &mask) < 0)
+                    {
+                        LogRel(("OSS: Failed to retrieve initial trigger mask: %s\n",
+                                strerror(errno)));
+                        rc = RTErrConvertFromErrno(errno);
+                        /* Note: No break here, need to unmap file first! */
+                    }
+                    else
+                    {
+                        mask = PCM_ENABLE_OUTPUT;
+                        if (ioctl (hFile, SNDCTL_DSP_SETTRIGGER, &mask) < 0)
+                        {
+                            LogRel(("OSS: Failed to retrieve PCM_ENABLE_OUTPUT mask: %s\n",
+                                    strerror(errno)));
+                            rc = RTErrConvertFromErrno(errno);
+                            /* Note: No break here, need to unmap file first! */
+                        }
+                        else
+                            pThisStrmOut->fMemMapped = true;
+                    }
+
+                    if (!pThisStrmOut->fMemMapped)
+                    {
+                        int rc2 = munmap(pThisStrmOut->pvPCMBuf,
+                                         cSamples << pHstStrmOut->Props.cShift);
+                        if (rc2)
+                            LogRel(("OSS: Failed to unmap DAC output file: %s\n",
+                                    strerror(errno)));
+
+                        break;
+                    }
+                }
+            }
+#endif /* !RT_OS_L4 */
+
+            /* Memory mapping failed above? Try allocating an own buffer. */
+#ifndef RT_OS_L4
+            if (!pThisStrmOut->fMemMapped)
+            {
+#endif
+                LogFlowFunc(("cSamples=%RU32\n", cSamples));
+                pThisStrmOut->pvPCMBuf = RTMemAlloc(cSamples * (1 << pHstStrmOut->Props.cShift));
+                if (!pThisStrmOut->pvPCMBuf)
+                {
+                    LogRel(("OSS: Failed allocating DAC buffer with %RU32 samples, each %d bytes\n",
+                            cSamples, 1 << pHstStrmOut->Props.cShift));
+                    rc = VERR_NO_MEMORY;
+                    break;
+                }
+#ifndef RT_OS_L4
+            }
+#endif
+            if (pcSamples)
+                *pcSamples = cSamples;
+        }
+
+    } while (0);
+
+    if (RT_FAILURE(rc))
+        drvHostOSSAudioClose(&hFile);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(bool) drvHostOSSAudioIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
+{
+    NOREF(pInterface);
+    NOREF(enmDir);
+    return true; /* Always all enabled. */
+}
+
+static DECLCALLBACK(int) drvHostOSSAudioPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                uint32_t *pcSamplesPlayed)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    POSSAUDIOSTREAMOUT pThisStrmOut = (POSSAUDIOSTREAMOUT)pHstStrmOut;
+
+    int rc = VINF_SUCCESS;
+    uint32_t cbReadTotal = 0;
+    count_info cntinfo;
+
+    do
+    {
+        size_t cbBuf = audioMixBufSizeBytes(&pHstStrmOut->MixBuf);
+
+        uint32_t cLive = drvAudioHstOutSamplesLive(pHstStrmOut,
+                                                   NULL /* pcStreamsLive */);
+        uint32_t cToRead;
+
+#ifndef RT_OS_L4
+        if (pThisStrmOut->fMemMapped)
+        {
+            /* Get current playback pointer. */
+            int rc2 = ioctl(pThisStrmOut->hFile, SNDCTL_DSP_GETOPTR, &cntinfo);
+            if (!rc2)
+            {
+                LogRel(("OSS: Failed to retrieve current playback pointer: %s\n",
+                        strerror(errno)));
+                rc = RTErrConvertFromErrno(errno);
+                break;
+            }
+
+            /* Nothing to play? */
+            if (cntinfo.ptr == pThisStrmOut->old_optr)
+                break;
+
+            int cbData;
+            if (cntinfo.ptr > pThisStrmOut->old_optr)
+                cbData = cntinfo.ptr - pThisStrmOut->old_optr;
+            else
+                cbData = cbBuf + cntinfo.ptr - pThisStrmOut->old_optr;
+            Assert(cbData);
+
+            cToRead = RT_MIN((uint32_t)AUDIOMIXBUF_B2S(&pHstStrmOut->MixBuf, cbData),
+                             cLive);
+        }
+        else
+        {
+#endif
+            audio_buf_info abinfo;
+            int rc2 = ioctl(pThisStrmOut->hFile, SNDCTL_DSP_GETOSPACE, &abinfo);
+            if (rc2 < 0)
+            {
+                LogRel(("OSS: Failed to retrieve current playback buffer: %s\n",
+                        strerror(errno)));
+                rc = RTErrConvertFromErrno(errno);
+                break;
+            }
+
+            if ((size_t)abinfo.bytes > cbBuf)
+            {
+                LogFlowFunc(("Warning: Invalid available size, size=%d, bufsize=%d\n",
+                             abinfo.bytes, cbBuf));
+                abinfo.bytes = cbBuf;
+                /* Keep going. */
+            }
+
+            if (abinfo.bytes < 0)
+            {
+                LogFlowFunc(("Warning: Invalid available size, size=%d, bufsize=%d\n",
+                             abinfo.bytes, cbBuf));
+                rc = VERR_INVALID_PARAMETER;
+                break;
+            }
+
+            cToRead = RT_MIN((uint32_t)AUDIOMIXBUF_B2S(&pHstStrmOut->MixBuf, abinfo.bytes),
+                             cLive);
+            if (!cToRead)
+                break;
+#ifndef RT_OS_L4
+        }
+#endif
+        size_t cbToRead = AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cToRead);
+        LogFlowFunc(("cbToRead=%zu\n", cbToRead));
+
+        uint32_t cRead, cbRead;
+        while (cbToRead)
+        {
+            rc = audioMixBufReadCirc(&pHstStrmOut->MixBuf,
+                                     pThisStrmOut->pvPCMBuf, cbToRead, &cRead);
+            if (RT_FAILURE(rc))
+                break;
+
+            cbRead = AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cRead);
+            ssize_t cbWritten = write(pThisStrmOut->hFile, pThisStrmOut->pvPCMBuf,
+                                      cbRead);
+            if (cbWritten == -1)
+            {
+                LogRel(("OSS: Failed writing output data %s\n", strerror(errno)));
+                rc = RTErrConvertFromErrno(errno);
+                break;
+            }
+
+            Assert(cbToRead >= cRead);
+            cbToRead -= cbRead;
+            cbReadTotal += cbRead;
+        }
+
+#ifndef RT_OS_L4
+        /* Update read pointer. */
+        if (pThisStrmOut->fMemMapped)
+            pThisStrmOut->old_optr = cntinfo.ptr;
+#endif
+
+    } while(0);
+
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cReadTotal = AUDIOMIXBUF_B2S(&pHstStrmOut->MixBuf, cbReadTotal);
+        if (cReadTotal)
+            audioMixBufFinish(&pHstStrmOut->MixBuf, cReadTotal);
+
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = cReadTotal;
+
+        LogFlowFunc(("cReadTotal=%RU32 (%RU32 bytes), rc=%Rrc\n",
+                     cReadTotal, cbReadTotal, rc));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(void) drvHostOSSAudioShutdown(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+}
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) drvHostOSSAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTOSSAUDIO  pThis   = PDMINS_2_DATA(pDrvIns, PDRVHOSTOSSAUDIO);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+
+    return NULL;
+}
+
+/**
+ * Constructs an OSS audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(int) drvHostOSSAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    PDRVHOSTOSSAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTOSSAUDIO);
+    LogRel(("Audio: Initializing OSS driver\n"));
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                   = pDrvIns;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface = drvHostOSSAudioQueryInterface;
+    /* IHostAudio */
+    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostOSSAudio);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Char driver registration record.
+ */
+const PDMDRVREG g_DrvHostOSSAudio =
+{
+    /* u32Version */
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "OSSAudio",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "OSS audio host driver",
+    /* fFlags */
+    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVHOSTOSSAUDIO),
+    /* pfnConstruct */
+    drvHostOSSAudioConstruct,
+    /* pfnDestruct */
+    NULL,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
diff --git a/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp b/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp
new file mode 100644
index 0000000..e6a4807
--- /dev/null
+++ b/src/VBox/Devices/Audio/DrvHostPulseAudio.cpp
@@ -0,0 +1,1226 @@
+/* $Id: DrvHostPulseAudio.cpp $ */
+/** @file
+ * VBox audio devices: Pulse Audio audio driver.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+
+#include <stdio.h>
+
+#include <iprt/alloc.h>
+#include <iprt/mem.h>
+#include <iprt/uuid.h>
+
+RT_C_DECLS_BEGIN
+ #include "pulse_mangling.h"
+ #include "pulse_stubs.h"
+RT_C_DECLS_END
+
+#include <pulse/pulseaudio.h>
+#include "vl_vbox.h"
+
+#include "DrvAudio.h"
+#include "AudioMixBuffer.h"
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+#define VBOX_PULSEAUDIO_MAX_LOG_REL_ERRORS 32 /** @todo Make this configurable thru driver options. */
+
+#ifndef PA_STREAM_NOFLAGS
+# define PA_STREAM_NOFLAGS (pa_context_flags_t)0x0000U /* since 0.9.19 */
+#endif
+
+#ifndef PA_CONTEXT_NOFLAGS
+# define PA_CONTEXT_NOFLAGS (pa_context_flags_t)0x0000U /* since 0.9.19 */
+#endif
+
+/*
+ * We use a g_pMainLoop in a separate thread g_pContext. We have to call functions for
+ * manipulating objects either from callback functions or we have to protect
+ * these functions by pa_threaded_mainloop_lock() / pa_threaded_mainloop_unlock().
+ */
+static struct pa_threaded_mainloop *g_pMainLoop;
+static struct pa_context           *g_pContext;
+
+/**
+ * Host Pulse audio driver instance data.
+ * @implements PDMIAUDIOCONNECTOR
+ */
+typedef struct DRVHOSTPULSEAUDIO
+{
+    /** Pointer to the driver instance structure. */
+    PPDMDRVINS         pDrvIns;
+    /** Pointer to host audio interface. */
+    PDMIHOSTAUDIO      IHostAudio;
+    /** Error count for not flooding the release log.
+     *  UINT32_MAX for unlimited logging. */
+    uint32_t           cLogErrors;
+} DRVHOSTPULSEAUDIO, *PDRVHOSTPULSEAUDIO;
+
+typedef struct PULSEAUDIOSTREAM
+{
+    /** Must come first, as this struct might be
+     *  casted to one of these structs. */
+    union
+    {
+        PDMAUDIOHSTSTRMIN  In;
+        PDMAUDIOHSTSTRMOUT Out;
+    } hw;
+    /** Pointer to driver instance. */
+    PDRVHOSTPULSEAUDIO     pDrv;
+    /** DAC/ADC buffer. */
+    void                  *pvPCMBuf;
+    /** Size (in bytes) of DAC/ADC buffer. */
+    uint32_t               cbPCMBuf;
+    /** Pointer to opaque PulseAudio stream. */
+    pa_stream             *pStream;
+    /** Pulse sample format and attribute specification. */
+    pa_sample_spec         SampleSpec;
+    /** Pulse playback and buffer metrics. */
+    pa_buffer_attr         BufAttr;
+    int                    fOpSuccess;
+    /** Pointer to Pulse sample peeking buffer. */
+    const uint8_t         *pu8PeekBuf;
+    /** Current size (in bytes) of peeking data in
+     *  buffer. */
+    size_t                 cbPeekBuf;
+    /** Our offset (in bytes) in peeking buffer. */
+    size_t                 offPeekBuf;
+    pa_operation          *pDrainOp;
+} PULSEAUDIOSTREAM, *PPULSEAUDIOSTREAM;
+
+/* The desired buffer length in milliseconds. Will be the target total stream
+ * latency on newer version of pulse. Apparent latency can be less (or more.)
+ */
+typedef struct PULSEAUDIOCFG
+{
+    RTMSINTERVAL buffer_msecs_out;
+    RTMSINTERVAL buffer_msecs_in;
+} PULSEAUDIOCFG, *PPULSEAUDIOCFG;
+
+static PULSEAUDIOCFG s_pulseCfg =
+{
+    100, /* buffer_msecs_out */
+    100  /* buffer_msecs_in */
+};
+
+/** Makes DRVHOSTPULSEAUDIO out of PDMIHOSTAUDIO. */
+#define PDMIHOSTAUDIO_2_DRVHOSTPULSEAUDIO(pInterface) \
+    ( (PDRVHOSTPULSEAUDIO)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTPULSEAUDIO, IHostAudio)) )
+
+static int  drvHostPulseAudioError(PDRVHOSTPULSEAUDIO pThis, const char *szMsg);
+static void drvHostPulseAudioCbSuccess(pa_stream *pStream, int fSuccess, void *pvContext);
+
+static pa_sample_format_t drvHostPulseAudioFmtToPulse(PDMAUDIOFMT fmt)
+{
+    switch (fmt)
+    {
+        case AUD_FMT_U8:
+            return PA_SAMPLE_U8;
+
+        case AUD_FMT_S16:
+            return PA_SAMPLE_S16LE;
+
+#ifdef PA_SAMPLE_S32LE
+        case AUD_FMT_S32:
+            return PA_SAMPLE_S32LE;
+#endif
+        default:
+            break;
+    }
+
+    AssertMsgFailed(("Format %ld not supported\n", fmt));
+    return PA_SAMPLE_U8;
+}
+
+static int drvHostPulseAudioPulseToFmt(pa_sample_format_t pulsefmt,
+                                       PDMAUDIOFMT *pFmt, PDMAUDIOENDIANNESS *pEndianness)
+{
+    switch (pulsefmt)
+    {
+        case PA_SAMPLE_U8:
+            *pFmt = AUD_FMT_U8;
+            *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case PA_SAMPLE_S16LE:
+            *pFmt = AUD_FMT_S16;
+            *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+
+        case PA_SAMPLE_S16BE:
+            *pFmt = AUD_FMT_S16;
+            *pEndianness = PDMAUDIOENDIANNESS_BIG;
+            break;
+
+#ifdef PA_SAMPLE_S32LE
+        case PA_SAMPLE_S32LE:
+            *pFmt = AUD_FMT_S32;
+            *pEndianness = PDMAUDIOENDIANNESS_LITTLE;
+            break;
+#endif
+
+#ifdef PA_SAMPLE_S32BE
+        case PA_SAMPLE_S32BE:
+            *pFmt = AUD_FMT_S32;
+            *pEndianness = PDMAUDIOENDIANNESS_BIG;
+            break;
+#endif
+
+        default:
+            AssertMsgFailed(("Format %ld not supported\n", pulsefmt));
+            return VERR_NOT_SUPPORTED;
+    }
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Synchronously wait until an operation completed.
+ */
+static int drvHostPulseAudioWaitFor(pa_operation *pOP, RTMSINTERVAL cMsTimeout)
+{
+    AssertPtrReturn(pOP, VERR_INVALID_POINTER);
+
+    int rc = VINF_SUCCESS;
+    if (pOP)
+    {
+        uint64_t u64StartMs = RTTimeMilliTS();
+        uint64_t u64ElapsedMs;
+
+        while (pa_operation_get_state(pOP) == PA_OPERATION_RUNNING)
+        {
+            pa_threaded_mainloop_wait(g_pMainLoop);
+
+            u64ElapsedMs = RTTimeMilliTS() - u64StartMs;
+            if (u64ElapsedMs >= cMsTimeout)
+            {
+                rc = VERR_TIMEOUT;
+                break;
+            }
+        }
+
+        pa_operation_unref(pOP);
+    }
+
+    return rc;
+}
+
+/**
+ * Context status changed.
+ */
+static void drvHostPulseAudioCbCtxState(pa_context *pContext, void *pvContext)
+{
+    AssertPtrReturnVoid(pContext);
+
+    PPULSEAUDIOSTREAM pStrm = (PPULSEAUDIOSTREAM)pvContext;
+    NOREF(pStrm);
+
+    switch (pa_context_get_state(pContext))
+    {
+        case PA_CONTEXT_READY:
+        case PA_CONTEXT_TERMINATED:
+            pa_threaded_mainloop_signal(g_pMainLoop, 0);
+            break;
+
+        case PA_CONTEXT_FAILED:
+            LogRel(("PulseAudio: Audio input/output stopped!\n"));
+            pa_threaded_mainloop_signal(g_pMainLoop, 0);
+            break;
+
+        default:
+            break;
+    }
+}
+
+/**
+ * Callback called when our pa_stream_drain operation was completed.
+ */
+static void drvHostPulseAudioCbStreamDrain(pa_stream *pStream, int fSuccess, void *pvContext)
+{
+    AssertPtrReturnVoid(pStream);
+
+    PPULSEAUDIOSTREAM pStrm = (PPULSEAUDIOSTREAM)pvContext;
+    AssertPtrReturnVoid(pStrm);
+
+    pStrm->fOpSuccess = fSuccess;
+    if (fSuccess)
+    {
+        pa_operation_unref(pa_stream_cork(pStream, 1,
+                                          drvHostPulseAudioCbSuccess, pvContext));
+    }
+    else
+        drvHostPulseAudioError(pStrm->pDrv, "Failed to drain stream");
+
+    pa_operation_unref(pStrm->pDrainOp);
+    pStrm->pDrainOp = NULL;
+}
+
+/**
+ * Stream status changed.
+ */
+static void drvHostPulseAudioCbStreamState(pa_stream *pStream, void *pvContext)
+{
+    AssertPtrReturnVoid(pStream);
+    NOREF(pvContext);
+
+    switch (pa_stream_get_state(pStream))
+    {
+        case PA_STREAM_READY:
+        case PA_STREAM_FAILED:
+        case PA_STREAM_TERMINATED:
+            pa_threaded_mainloop_signal(g_pMainLoop, 0 /* fWait */);
+            break;
+
+        default:
+            break;
+    }
+}
+
+static void drvHostPulseAudioCbSuccess(pa_stream *pStream, int fSuccess, void *pvContext)
+{
+    AssertPtrReturnVoid(pStream);
+
+    PPULSEAUDIOSTREAM pStrm = (PPULSEAUDIOSTREAM)pvContext;
+    AssertPtrReturnVoid(pStrm);
+
+    pStrm->fOpSuccess = fSuccess;
+
+    if (fSuccess)
+    {
+        pa_threaded_mainloop_signal(g_pMainLoop, 0 /* fWait */);
+    }
+    else
+         drvHostPulseAudioError(pStrm->pDrv, "Failed to finish stream operation");
+}
+
+static int drvHostPulseAudioOpen(bool fIn, const char *pszName,
+                                 pa_sample_spec *pSampleSpec, pa_buffer_attr *pBufAttr,
+                                 pa_stream **ppStream)
+{
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    AssertPtrReturn(pSampleSpec, VERR_INVALID_POINTER);
+    AssertPtrReturn(pBufAttr, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppStream, VERR_INVALID_POINTER);
+
+    if (!pa_sample_spec_valid(pSampleSpec))
+    {
+        LogRel(("PulseAudio: Unsupported sample specification for stream \"%s\"\n",
+                pszName));
+        return VERR_NOT_SUPPORTED;
+    }
+
+    int rc = VINF_SUCCESS;
+
+    pa_stream *pStream = NULL;
+    uint32_t   flags = PA_STREAM_NOFLAGS;
+
+    LogFunc(("Opening \"%s\", rate=%dHz, channels=%d, format=%s\n",
+             pszName, pSampleSpec->rate, pSampleSpec->channels,
+             pa_sample_format_to_string(pSampleSpec->format)));
+
+    pa_threaded_mainloop_lock(g_pMainLoop);
+
+    do
+    {
+        if (!(pStream = pa_stream_new(g_pContext, pszName, pSampleSpec,
+                                      NULL /* pa_channel_map */)))
+        {
+            LogRel(("PulseAudio: Could not create stream \"%s\"\n", pszName));
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        pa_stream_set_state_callback(pStream, drvHostPulseAudioCbStreamState, NULL);
+
+#if PA_API_VERSION >= 12
+        /* XXX */
+        flags |= PA_STREAM_ADJUST_LATENCY;
+#endif
+
+#if 0
+        /* Not applicable as we don't use pa_stream_get_latency() and pa_stream_get_time(). */
+        flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE;
+#endif
+        /* No input/output right away after the stream was started. */
+        flags |= PA_STREAM_START_CORKED;
+
+        if (fIn)
+        {
+            LogFunc(("Input stream attributes: maxlength=%d fragsize=%d\n",
+                     pBufAttr->maxlength, pBufAttr->fragsize));
+
+            if (pa_stream_connect_record(pStream, /*dev=*/NULL, pBufAttr, (pa_stream_flags_t)flags) < 0)
+            {
+                LogRel(("PulseAudio: Could not connect input stream \"%s\": %s\n",
+                        pszName, pa_strerror(pa_context_errno(g_pContext))));
+                rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                break;
+            }
+        }
+        else
+        {
+            LogFunc(("Output buffer attributes: maxlength=%d tlength=%d prebuf=%d minreq=%d\n",
+                     pBufAttr->maxlength, pBufAttr->tlength, pBufAttr->prebuf, pBufAttr->minreq));
+
+            if (pa_stream_connect_playback(pStream, /*dev=*/NULL, pBufAttr, (pa_stream_flags_t)flags,
+                                           /*cvolume=*/NULL, /*sync_stream=*/NULL) < 0)
+            {
+                LogRel(("PulseAudio: Could not connect playback stream \"%s\": %s\n",
+                        pszName, pa_strerror(pa_context_errno(g_pContext))));
+                rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                break;
+            }
+        }
+
+        /* Wait until the stream is ready. */
+        pa_stream_state_t sstate;
+        for (;;)
+        {
+            pa_threaded_mainloop_wait(g_pMainLoop);
+
+            sstate = pa_stream_get_state(pStream);
+            if (sstate == PA_STREAM_READY)
+                break;
+            else if (   sstate == PA_STREAM_FAILED
+                     || sstate == PA_STREAM_TERMINATED)
+            {
+                LogRel(("PulseAudio: Failed to initialize stream \"%s\" (state %ld)\n",
+                        pszName, sstate));
+                rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                break;
+            }
+        }
+
+        if (RT_FAILURE(rc))
+            break;
+
+        const pa_buffer_attr *pBufAttrObtained = pa_stream_get_buffer_attr(pStream);
+        AssertPtr(pBufAttrObtained);
+        memcpy(pBufAttr, pBufAttrObtained, sizeof(pa_buffer_attr));
+
+        if (fIn)
+            LogFunc(("Obtained record buffer attributes: maxlength=%RU32, fragsize=%RU32\n",
+                     pBufAttr->maxlength, pBufAttr->fragsize));
+        else
+            LogFunc(("Obtained playback buffer attributes: maxlength=%d, tlength=%d, prebuf=%d, minreq=%d\n",
+                     pBufAttr->maxlength, pBufAttr->tlength, pBufAttr->prebuf, pBufAttr->minreq));
+
+        pa_threaded_mainloop_unlock(g_pMainLoop);
+    }
+    while (0);
+
+    if (RT_FAILURE(rc))
+    {
+        if (pStream)
+            pa_stream_disconnect(pStream);
+
+        pa_threaded_mainloop_unlock(g_pMainLoop);
+
+        if (pStream)
+            pa_stream_unref(pStream);
+    }
+    else
+        *ppStream = pStream;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioInit(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+
+    LogFlowFuncEnter();
+
+    int rc = audioLoadPulseLib();
+    if (RT_FAILURE(rc))
+    {
+        LogRel(("PulseAudio: Failed to load the PulseAudio shared library! Error %Rrc\n", rc));
+        return rc;
+    }
+
+    bool fLocked = false;
+
+    do
+    {
+        if (!(g_pMainLoop = pa_threaded_mainloop_new()))
+        {
+            LogRel(("PulseAudio: Failed to allocate main loop: %s\n",
+                     pa_strerror(pa_context_errno(g_pContext))));
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        if (!(g_pContext = pa_context_new(pa_threaded_mainloop_get_api(g_pMainLoop), "VirtualBox")))
+        {
+            LogRel(("PulseAudio: Failed to allocate context: %s\n",
+                     pa_strerror(pa_context_errno(g_pContext))));
+            rc = VERR_NO_MEMORY;
+            break;
+        }
+
+        if (pa_threaded_mainloop_start(g_pMainLoop) < 0)
+        {
+            LogRel(("PulseAudio: Failed to start threaded mainloop: %s\n",
+                     pa_strerror(pa_context_errno(g_pContext))));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        pa_context_set_state_callback(g_pContext, drvHostPulseAudioCbCtxState, NULL);
+        pa_threaded_mainloop_lock(g_pMainLoop);
+        fLocked = true;
+
+        if (pa_context_connect(g_pContext, NULL /* pszServer */,
+                               PA_CONTEXT_NOFLAGS, NULL) < 0)
+        {
+            LogRel(("PulseAudio: Failed to connect to server: %s\n",
+                     pa_strerror(pa_context_errno(g_pContext))));
+            rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+            break;
+        }
+
+        /* Wait until the g_pContext is ready */
+        for (;;)
+        {
+            pa_context_state_t cstate;
+            pa_threaded_mainloop_wait(g_pMainLoop);
+
+            cstate = pa_context_get_state(g_pContext);
+            if (cstate == PA_CONTEXT_READY)
+                break;
+            else if (   cstate == PA_CONTEXT_TERMINATED
+                     || cstate == PA_CONTEXT_FAILED)
+            {
+                LogRel(("PulseAudio: Failed to initialize context (state %d)\n", cstate));
+                rc = VERR_GENERAL_FAILURE; /** @todo Find a better rc. */
+                break;
+            }
+        }
+
+        pa_threaded_mainloop_unlock(g_pMainLoop);
+    }
+    while (0);
+
+    if (RT_FAILURE(rc))
+    {
+        if (g_pMainLoop)
+        {
+            if (fLocked)
+                pa_threaded_mainloop_unlock(g_pMainLoop);
+
+            if (g_pMainLoop)
+                pa_threaded_mainloop_stop(g_pMainLoop);
+        }
+
+        if (g_pContext)
+        {
+            pa_context_disconnect(g_pContext);
+            pa_context_unref(g_pContext);
+            g_pContext = NULL;
+        }
+
+        if (g_pMainLoop)
+        {
+            pa_threaded_mainloop_free(g_pMainLoop);
+            g_pMainLoop = NULL;
+        }
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioInitOut(PPDMIHOSTAUDIO pInterface,
+                                                  PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
+                                                  uint32_t *pcSamples)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+    /* pcSamples is optional. */
+
+    PPULSEAUDIOSTREAM pThisStrmOut = (PPULSEAUDIOSTREAM)pHstStrmOut;
+
+    LogFlowFuncEnter();
+
+    pThisStrmOut->pDrainOp            = NULL;
+
+    pThisStrmOut->SampleSpec.format   = drvHostPulseAudioFmtToPulse(pCfg->enmFormat);
+    pThisStrmOut->SampleSpec.rate     = pCfg->uHz;
+    pThisStrmOut->SampleSpec.channels = pCfg->cChannels;
+
+    /* Note that setting maxlength to -1 does not work on PulseAudio servers
+     * older than 0.9.10. So use the suggested value of 3/2 of tlength */
+    pThisStrmOut->BufAttr.tlength     =   (pa_bytes_per_second(&pThisStrmOut->SampleSpec)
+                                        * s_pulseCfg.buffer_msecs_out) / 1000;
+    pThisStrmOut->BufAttr.maxlength   = (pThisStrmOut->BufAttr.tlength * 3) / 2;
+    pThisStrmOut->BufAttr.prebuf      = -1; /* Same as tlength */
+    pThisStrmOut->BufAttr.minreq      = -1; /* Pulse should set something sensible for minreq on it's own */
+
+    /* Note that the struct BufAttr is updated to the obtained values after this call! */
+    int rc = drvHostPulseAudioOpen(false /* fIn */, "pa.out", &pThisStrmOut->SampleSpec, &pThisStrmOut->BufAttr,
+                                   &pThisStrmOut->pStream);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    PDMAUDIOSTREAMCFG streamCfg;
+    rc = drvHostPulseAudioPulseToFmt(pThisStrmOut->SampleSpec.format,
+                                     &streamCfg.enmFormat, &streamCfg.enmEndianness);
+    if (RT_FAILURE(rc))
+    {
+        LogRel(("PulseAudio: Cannot find audio output format %ld\n", pThisStrmOut->SampleSpec.format));
+        return rc;
+    }
+
+    streamCfg.uHz       = pThisStrmOut->SampleSpec.rate;
+    streamCfg.cChannels = pThisStrmOut->SampleSpec.channels;
+
+    rc = drvAudioStreamCfgToProps(&streamCfg, &pHstStrmOut->Props);
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cbBuf  = RT_MIN(pThisStrmOut->BufAttr.tlength * 2,
+                                 pThisStrmOut->BufAttr.maxlength); /** @todo Make this configurable! */
+        if (cbBuf)
+        {
+            pThisStrmOut->pvPCMBuf = RTMemAllocZ(cbBuf);
+            if (pThisStrmOut->pvPCMBuf)
+            {
+                pThisStrmOut->cbPCMBuf = cbBuf;
+
+                uint32_t cSamples = cbBuf >> pHstStrmOut->Props.cShift;
+                if (pcSamples)
+                    *pcSamples = cSamples;
+
+                LogFunc(("cbBuf=%RU32, cSamples=%RU32\n", cbBuf, cSamples));
+            }
+            else
+                rc = VERR_NO_MEMORY;
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(bool) drvHostPulseAudioIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
+{
+    NOREF(pInterface);
+    NOREF(enmDir);
+    return true; /* Always all enabled. */
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioInitIn(PPDMIHOSTAUDIO pInterface,
+                                                 PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg,
+                                                 PDMAUDIORECSOURCE enmRecSource,
+                                                 uint32_t *pcSamples)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+    /* pcSamples is optional. */
+
+    PPULSEAUDIOSTREAM pThisStrmIn = (PPULSEAUDIOSTREAM)pHstStrmIn;
+
+    LogFunc(("enmRecSrc=%ld\n", enmRecSource));
+
+    pThisStrmIn->SampleSpec.format   = drvHostPulseAudioFmtToPulse(pCfg->enmFormat);
+    pThisStrmIn->SampleSpec.rate     = pCfg->uHz;
+    pThisStrmIn->SampleSpec.channels = pCfg->cChannels;
+
+    /* XXX check these values */
+    pThisStrmIn->BufAttr.fragsize    = (pa_bytes_per_second(&pThisStrmIn->SampleSpec)
+                                   * s_pulseCfg.buffer_msecs_in) / 1000;
+    pThisStrmIn->BufAttr.maxlength   = (pThisStrmIn->BufAttr.fragsize * 3) / 2;
+    /* Note: Other members of pa_buffer_attr are ignored for record streams. */
+
+    int rc = drvHostPulseAudioOpen(true /* fIn */, "pa.in", &pThisStrmIn->SampleSpec, &pThisStrmIn->BufAttr,
+                                   &pThisStrmIn->pStream);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    PDMAUDIOSTREAMCFG streamCfg;
+    rc = drvHostPulseAudioPulseToFmt(pThisStrmIn->SampleSpec.format, &streamCfg.enmFormat,
+                                     &streamCfg.enmEndianness);
+    if (RT_FAILURE(rc))
+    {
+        LogRel(("PulseAudio: Cannot find audio capture format %ld\n", pThisStrmIn->SampleSpec.format));
+        return rc;
+    }
+
+    streamCfg.uHz       = pThisStrmIn->SampleSpec.rate;
+    streamCfg.cChannels = pThisStrmIn->SampleSpec.channels;
+
+    rc = drvAudioStreamCfgToProps(&streamCfg, &pHstStrmIn->Props);
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cSamples = RT_MIN(pThisStrmIn->BufAttr.fragsize * 10, pThisStrmIn->BufAttr.maxlength)
+                            >> pHstStrmIn->Props.cShift;
+        LogFunc(("cShift=%RU8, cSamples=%RU32\n", pHstStrmIn->Props.cShift, cSamples));
+
+        if (pcSamples)
+            *pcSamples = cSamples;
+
+        pThisStrmIn->pu8PeekBuf = NULL;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioCaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                    uint32_t *pcSamplesCaptured)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+    /* pcSamplesPlayed is optional. */
+
+    PPULSEAUDIOSTREAM pThisStrmIn = (PPULSEAUDIOSTREAM)pHstStrmIn;
+
+    /* We should only call pa_stream_readable_size() once and trust the first value. */
+    pa_threaded_mainloop_lock(g_pMainLoop);
+    size_t cbAvail = pa_stream_readable_size(pThisStrmIn->pStream);
+    pa_threaded_mainloop_unlock(g_pMainLoop);
+
+    if (cbAvail == (size_t)-1)
+        return drvHostPulseAudioError(pThisStrmIn->pDrv, "Failed to determine input data size");
+
+    /* If the buffer was not dropped last call, add what remains. */
+    if (pThisStrmIn->pu8PeekBuf)
+    {
+        Assert(pThisStrmIn->cbPeekBuf >= pThisStrmIn->offPeekBuf);
+        cbAvail += (pThisStrmIn->cbPeekBuf - pThisStrmIn->offPeekBuf);
+    }
+
+    if (!cbAvail) /* No data? Bail out. */
+    {
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = 0;
+        return VINF_SUCCESS;
+    }
+
+    int rc = VINF_SUCCESS;
+    size_t cbToRead = RT_MIN(cbAvail, audioMixBufFreeBytes(&pHstStrmIn->MixBuf));
+
+    LogFlowFunc(("cbToRead=%zu, cbAvail=%zu, offPeekBuf=%zu, cbPeekBuf=%zu\n",
+                 cbToRead, cbAvail, pThisStrmIn->offPeekBuf, pThisStrmIn->cbPeekBuf));
+
+    size_t offWrite = 0;
+    uint32_t cWrittenTotal = 0;
+
+    while (cbToRead)
+    {
+        /* If there is no data, do another peek. */
+        if (!pThisStrmIn->pu8PeekBuf)
+        {
+            pa_threaded_mainloop_lock(g_pMainLoop);
+            pa_stream_peek(pThisStrmIn->pStream,
+                           (const void**)&pThisStrmIn->pu8PeekBuf, &pThisStrmIn->cbPeekBuf);
+            pa_threaded_mainloop_unlock(g_pMainLoop);
+
+            pThisStrmIn->offPeekBuf = 0;
+
+            /* No data anymore?
+             * Note: If there's a data hole (cbPeekBuf then contains the length of the hole)
+             *       we need to drop the stream lateron. */
+            if (   !pThisStrmIn->pu8PeekBuf
+                && !pThisStrmIn->cbPeekBuf)
+            {
+                break;
+            }
+        }
+
+        Assert(pThisStrmIn->cbPeekBuf >= pThisStrmIn->offPeekBuf);
+        size_t cbToWrite = RT_MIN(pThisStrmIn->cbPeekBuf - pThisStrmIn->offPeekBuf, cbToRead);
+
+        LogFlowFunc(("cbToRead=%zu, cbToWrite=%zu, offPeekBuf=%zu, cbPeekBuf=%zu, pu8PeekBuf=%p\n",
+                     cbToRead, cbToWrite,
+                     pThisStrmIn->offPeekBuf, pThisStrmIn->cbPeekBuf, pThisStrmIn->pu8PeekBuf));
+
+        if (cbToWrite)
+        {
+            uint32_t cWritten;
+            rc = audioMixBufWriteCirc(&pHstStrmIn->MixBuf,
+                                      pThisStrmIn->pu8PeekBuf + pThisStrmIn->offPeekBuf,
+                                      cbToWrite, &cWritten);
+            if (RT_FAILURE(rc))
+                break;
+
+            uint32_t cbWritten = AUDIOMIXBUF_S2B(&pHstStrmIn->MixBuf, cWritten);
+
+            Assert(cbToRead >= cbWritten);
+            cbToRead -= cbWritten;
+            cWrittenTotal += cWritten;
+            pThisStrmIn->offPeekBuf += cbWritten;
+        }
+
+        if (/* Nothing to write anymore? Drop the buffer. */
+               !cbToWrite
+            /* Was there a hole in the peeking buffer? Drop it. */
+            || !pThisStrmIn->pu8PeekBuf
+            /* If the buffer is done, drop it. */
+            || pThisStrmIn->offPeekBuf == pThisStrmIn->cbPeekBuf)
+        {
+            pa_threaded_mainloop_lock(g_pMainLoop);
+            pa_stream_drop(pThisStrmIn->pStream);
+            pa_threaded_mainloop_unlock(g_pMainLoop);
+
+            pThisStrmIn->pu8PeekBuf = NULL;
+        }
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cProcessed = 0;
+        if (cWrittenTotal)
+            rc = audioMixBufMixToParent(&pHstStrmIn->MixBuf, cWrittenTotal,
+                                        &cProcessed);
+
+        if (pcSamplesCaptured)
+            *pcSamplesCaptured = cWrittenTotal;
+
+        LogFlowFunc(("cWrittenTotal=%RU32 (%RU32 processed), rc=%Rrc\n",
+                     cWrittenTotal, cProcessed, rc));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                  uint32_t *pcSamplesPlayed)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+    /* pcSamplesPlayed is optional. */
+
+    PPULSEAUDIOSTREAM pThisStrmOut = (PPULSEAUDIOSTREAM)pHstStrmOut;
+
+    int rc = VINF_SUCCESS;
+    uint32_t cbReadTotal = 0;
+
+    uint32_t cLive = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
+    if (!cLive)
+    {
+        LogFlowFunc(("%p: No live samples, skipping\n", pHstStrmOut));
+
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = 0;
+        return VINF_SUCCESS;
+    }
+
+    pa_threaded_mainloop_lock(g_pMainLoop);
+
+    do
+    {
+        size_t cbWriteable = pa_stream_writable_size(pThisStrmOut->pStream);
+        if (cbWriteable == (size_t)-1)
+        {
+            rc = drvHostPulseAudioError(pThisStrmOut->pDrv, "Failed to determine output data size");
+            break;
+        }
+
+        size_t cbLive   = AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cLive);
+        size_t cbToRead = RT_MIN(cbWriteable, cbLive);
+
+        LogFlowFunc(("cbToRead=%zu, cbWriteable=%zu, cbLive=%zu\n",
+                     cbToRead, cbWriteable, cbLive));
+
+        uint32_t cRead, cbRead;
+        while (cbToRead)
+        {
+            rc = audioMixBufReadCirc(&pHstStrmOut->MixBuf, pThisStrmOut->pvPCMBuf,
+                                     RT_MIN(cbToRead, pThisStrmOut->cbPCMBuf), &cRead);
+            if (   !cRead
+                || RT_FAILURE(rc))
+            {
+                break;
+            }
+
+            cbRead = AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cRead);
+            if (pa_stream_write(pThisStrmOut->pStream, pThisStrmOut->pvPCMBuf, cbRead, NULL /* Cleanup callback */,
+                                0, PA_SEEK_RELATIVE) < 0)
+            {
+                rc = drvHostPulseAudioError(pThisStrmOut->pDrv, "Failed to write to output stream");
+                break;
+            }
+
+            Assert(cbToRead >= cRead);
+            cbToRead    -= cbRead;
+            cbReadTotal += cbRead;
+
+            LogFlowFunc(("\tcRead=%RU32 (%zu bytes) cbReadTotal=%RU32, cbToRead=%RU32\n",
+                         cRead, AUDIOMIXBUF_S2B(&pHstStrmOut->MixBuf, cRead), cbReadTotal, cbToRead));
+        }
+
+    } while (0);
+
+    pa_threaded_mainloop_unlock(g_pMainLoop);
+
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cReadTotal = AUDIOMIXBUF_B2S(&pHstStrmOut->MixBuf, cbReadTotal);
+        if (cReadTotal)
+            audioMixBufFinish(&pHstStrmOut->MixBuf, cReadTotal);
+
+        if (pcSamplesPlayed)
+            *pcSamplesPlayed = cReadTotal;
+
+        LogFlowFunc(("cReadTotal=%RU32 (%RU32 bytes), rc=%Rrc\n", cReadTotal, cbReadTotal, rc));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/** @todo Implement va handling. */
+static int drvHostPulseAudioError(PDRVHOSTPULSEAUDIO pThis, const char *szMsg)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+    AssertPtrReturn(szMsg, VERR_INVALID_POINTER);
+
+    if (pThis->cLogErrors++ < VBOX_PULSEAUDIO_MAX_LOG_REL_ERRORS)
+    {
+        int rc2 = pa_context_errno(g_pContext);
+        LogRel(("PulseAudio: %s: %s\n", szMsg, pa_strerror(rc2)));
+    }
+
+    /** @todo Implement some PulseAudio -> IPRT mapping here. */
+    return VERR_GENERAL_FAILURE;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    LogFlowFuncEnter();
+
+    PPULSEAUDIOSTREAM pThisStrmIn = (PPULSEAUDIOSTREAM)pHstStrmIn;
+    if (pThisStrmIn->pStream)
+    {
+        pa_threaded_mainloop_lock(g_pMainLoop);
+        pa_stream_disconnect(pThisStrmIn->pStream);
+        pa_stream_unref(pThisStrmIn->pStream);
+        pa_threaded_mainloop_unlock(g_pMainLoop);
+
+        pThisStrmIn->pStream = NULL;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    LogFlowFuncEnter();
+
+    PPULSEAUDIOSTREAM pThisStrmOut = (PPULSEAUDIOSTREAM)pHstStrmOut;
+    if (pThisStrmOut->pStream)
+    {
+        pa_threaded_mainloop_lock(g_pMainLoop);
+        pa_stream_disconnect(pThisStrmOut->pStream);
+        pa_stream_unref(pThisStrmOut->pStream);
+        pa_threaded_mainloop_unlock(g_pMainLoop);
+
+        pThisStrmOut->pStream = NULL;
+    }
+
+    if (pThisStrmOut->pvPCMBuf)
+    {
+        RTMemFree(pThisStrmOut->pvPCMBuf);
+        pThisStrmOut->pvPCMBuf = NULL;
+
+        pThisStrmOut->cbPCMBuf = 0;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioControlOut(PPDMIHOSTAUDIO pInterface,
+                                                     PPDMAUDIOHSTSTRMOUT pHstStrmOut, PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+
+    PPULSEAUDIOSTREAM pThisStrmOut = (PPULSEAUDIOSTREAM)pHstStrmOut;
+    int rc = VINF_SUCCESS;
+
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+        {
+            pa_threaded_mainloop_lock(g_pMainLoop);
+
+            if (   pThisStrmOut->pDrainOp
+                && pa_operation_get_state(pThisStrmOut->pDrainOp) != PA_OPERATION_DONE)
+            {
+                pa_operation_cancel(pThisStrmOut->pDrainOp);
+                pa_operation_unref(pThisStrmOut->pDrainOp);
+
+                pThisStrmOut->pDrainOp = NULL;
+            }
+            else
+            {
+                /* This should return immediately. */
+                rc = drvHostPulseAudioWaitFor(pa_stream_cork(pThisStrmOut->pStream, 0,
+                                                             drvHostPulseAudioCbSuccess, pThisStrmOut),
+                                              15 * 1000 /* 15s timeout */);
+            }
+
+            pa_threaded_mainloop_unlock(g_pMainLoop);
+            break;
+        }
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+        {
+            /* Pause audio output (the Pause bit of the AC97 x_CR register is set).
+             * Note that we must return immediately from here! */
+            pa_threaded_mainloop_lock(g_pMainLoop);
+            if (!pThisStrmOut->pDrainOp)
+            {
+                /* This should return immediately. */
+                rc = drvHostPulseAudioWaitFor(pa_stream_trigger(pThisStrmOut->pStream,
+                                                                drvHostPulseAudioCbSuccess, pThisStrmOut),
+                                              15 * 1000 /* 15s timeout */);
+                if (RT_LIKELY(RT_SUCCESS(rc)))
+                    pThisStrmOut->pDrainOp = pa_stream_drain(pThisStrmOut->pStream,
+                                                             drvHostPulseAudioCbStreamDrain, pThisStrmOut);
+            }
+            pa_threaded_mainloop_unlock(g_pMainLoop);
+            break;
+        }
+
+        default:
+            AssertMsgFailed(("Invalid command %ld\n", enmStreamCmd));
+            rc = VERR_INVALID_PARAMETER;
+            break;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                                    PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    PPULSEAUDIOSTREAM pThisStrmIn = (PPULSEAUDIOSTREAM)pHstStrmIn;
+    int rc = VINF_SUCCESS;
+
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    switch (enmStreamCmd)
+    {
+        case PDMAUDIOSTREAMCMD_ENABLE:
+        {
+            pa_threaded_mainloop_lock(g_pMainLoop);
+            /* This should return immediately. */
+            rc = drvHostPulseAudioWaitFor(pa_stream_cork(pThisStrmIn->pStream, 0 /* Play / resume */,
+                                                         drvHostPulseAudioCbSuccess, pThisStrmIn),
+                                          15 * 1000 /* 15s timeout */);
+            pa_threaded_mainloop_unlock(g_pMainLoop);
+            break;
+        }
+
+        case PDMAUDIOSTREAMCMD_DISABLE:
+        {
+            pa_threaded_mainloop_lock(g_pMainLoop);
+            if (pThisStrmIn->pu8PeekBuf) /* Do we need to drop the peek buffer?*/
+            {
+                pa_stream_drop(pThisStrmIn->pStream);
+                pThisStrmIn->pu8PeekBuf = NULL;
+            }
+            /* This should return immediately. */
+            rc = drvHostPulseAudioWaitFor(pa_stream_cork(pThisStrmIn->pStream, 1 /* Stop / pause */,
+                                                         drvHostPulseAudioCbSuccess, pThisStrmIn),
+                                          15 * 1000 /* 15s timeout */);
+            pa_threaded_mainloop_unlock(g_pMainLoop);
+            break;
+        }
+
+        default:
+            AssertMsgFailed(("Invalid command %ld\n", enmStreamCmd));
+            rc = VERR_INVALID_PARAMETER;
+            break;
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvHostPulseAudioGetConf(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pCfg)
+{
+    NOREF(pInterface);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    pCfg->cbStreamOut = sizeof(PULSEAUDIOSTREAM);
+    pCfg->cbStreamIn = sizeof(PULSEAUDIOSTREAM);
+    pCfg->cMaxHstStrmsOut = INT_MAX;
+    pCfg->cMaxHstStrmsIn = INT_MAX;
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(void) drvHostPulseAudioShutdown(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+
+    LogFlowFuncEnter();
+
+    if (g_pMainLoop)
+        pa_threaded_mainloop_stop(g_pMainLoop);
+
+    if (g_pContext)
+    {
+        pa_context_disconnect(g_pContext);
+        pa_context_unref(g_pContext);
+        g_pContext = NULL;
+    }
+
+    if (g_pMainLoop)
+    {
+        pa_threaded_mainloop_free(g_pMainLoop);
+        g_pMainLoop = NULL;
+    }
+
+    LogFlowFuncLeave();
+}
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) drvHostPulseAudioQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    AssertPtrReturn(pInterface, NULL);
+    AssertPtrReturn(pszIID, NULL);
+
+    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVHOSTPULSEAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPULSEAUDIO);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+
+    return NULL;
+}
+
+/**
+ * Constructs a PulseAudio Audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(int) drvHostPulseAudioConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);
+    /* pCfg is optional. */
+
+    PDRVHOSTPULSEAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTPULSEAUDIO);
+    LogRel(("Audio: Initializing PulseAudio driver\n"));
+
+    pThis->pDrvIns                   = pDrvIns;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface = drvHostPulseAudioQueryInterface;
+    /* IHostAudio */
+    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvHostPulseAudio);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Destructs a PulseAudio Audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(void) drvHostPulseAudioDestruct(PPDMDRVINS pDrvIns)
+{
+    NOREF(pDrvIns);
+    LogFlowFuncEnter();
+}
+
+/**
+ * Char driver registration record.
+ */
+const PDMDRVREG g_DrvHostPulseAudio =
+{
+    /* u32Version */
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "PulseAudio",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "Pulse Audio host driver",
+    /* fFlags */
+     PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVHOSTPULSEAUDIO),
+    /* pfnConstruct */
+    drvHostPulseAudioConstruct,
+    /* pfnDestruct */
+    drvHostPulseAudioDestruct,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
+
+static struct audio_option pulse_options[] =
+{
+    {"DAC_MS", AUD_OPT_INT, &s_pulseCfg.buffer_msecs_out,
+     "DAC period size in milliseconds", NULL, 0},
+    {"ADC_MS", AUD_OPT_INT, &s_pulseCfg.buffer_msecs_in,
+     "ADC period size in milliseconds", NULL, 0},
+
+    NULL
+};
+
diff --git a/src/VBox/Devices/Audio/audio.c b/src/VBox/Devices/Audio/audio.c
index 784d84b..3aeecc8 100644
--- a/src/VBox/Devices/Audio/audio.c
+++ b/src/VBox/Devices/Audio/audio.c
@@ -1697,7 +1697,7 @@ static int AUD_init (PCFGMNODE pCfgHandle, PPDMDRVINS pDrvIns, const char *drvna
         s->nb_hw_voices_in = 0;
     }
 
-    LogRel(("Audio: Trying driver '%s'.\n", drvname));
+    LogRel(("Audio: Trying driver '%s'\n", drvname));
 
     if (drvname) {
         int found = 0;
diff --git a/src/VBox/Devices/Audio/coreaudio.c b/src/VBox/Devices/Audio/coreaudio.c
index 1dec4f3..9cd2434 100644
--- a/src/VBox/Devices/Audio/coreaudio.c
+++ b/src/VBox/Devices/Audio/coreaudio.c
@@ -299,7 +299,7 @@ static OSStatus caSetFrameBufferSize(AudioDeviceID device, bool fInput, UInt32 c
     if (RT_UNLIKELY(err != noErr))
         return err;
     pRange = RTMemAllocZ(cSize);
-    if (RT_VALID_PTR(pRange))
+    if (pRange)
     {
         err = AudioDeviceGetProperty(device,
                                      0,
@@ -492,8 +492,6 @@ typedef struct caVoiceOut
     /* Initialization status tracker. Used when some of the device parameters
      * or the device itself is changed during the runtime. */
     volatile uint32_t status;
-    /** Flag whether the "default device changed" listener was registered. */
-    bool              fDefDevChgListReg;
 } caVoiceOut;
 
 typedef struct caVoiceIn
@@ -521,8 +519,6 @@ typedef struct caVoiceIn
     /* Initialization status tracker. Used when some of the device parameters
      * or the device itself is changed during the runtime. */
     volatile uint32_t status;
-    /** Flag whether the "default device changed" listener was registered. */
-    bool              fDefDevChgListReg;
 } caVoiceIn;
 
 #ifdef CA_EXTENSIVE_LOGGING
@@ -1111,15 +1107,6 @@ static void coreaudio_fini_out(HWVoiceOut *hw)
         if (RT_UNLIKELY(err != noErr))
             LogRel(("CoreAudio: [Output] Failed to remove the processor overload listener (%RI32)\n", err));
 #endif /* DEBUG */
-
-        if (caVoice->fDefDevChgListReg)
-        {
-            err = AudioHardwareRemovePropertyListener(kAudioHardwarePropertyDefaultOutputDevice,
-                                                      caPlaybackDefaultDeviceChanged);
-            if (RT_UNLIKELY(err != noErr))
-                LogRel(("CoreAudio: [Output] Failed to remove the default playback device changed listener (%RI32)\n", err));
-        }
-
         err = AudioUnitUninitialize(caVoice->audioUnit);
         if (RT_LIKELY(err == noErr))
         {
@@ -1188,8 +1175,6 @@ static int coreaudio_init_out(HWVoiceOut *hw, audsettings_t *as)
         /* Not Fatal */
         if (RT_UNLIKELY(err != noErr))
             LogRel(("CoreAudio: [Output] Failed to add the default device changed listener (%RI32)\n", err));
-        else
-            caVoice->fDefDevChgListReg = true;
     }
 
     Log(("CoreAudio: [Output] HW samples: %d\n", hw->samples));
@@ -2053,15 +2038,6 @@ static void coreaudio_fini_in(HWVoiceIn *hw)
         /* Not Fatal */
         if (RT_UNLIKELY(err != noErr))
             LogRel(("CoreAudio: [Input] Failed to remove the sample rate changed listener (%RI32)\n", err));
-
-        if (caVoice->fDefDevChgListReg)
-        {
-            err = AudioHardwareRemovePropertyListener(kAudioHardwarePropertyDefaultInputDevice,
-                                                      caRecordingDefaultDeviceChanged);
-            if (RT_UNLIKELY(err != noErr))
-                LogRel(("CoreAudio: [Output] Failed to remove the default input device changed listener (%RI32)\n", err));
-        }
-
         if (caVoice->converter)
         {
             AudioConverterDispose(caVoice->converter);
@@ -2138,8 +2114,6 @@ static int coreaudio_init_in(HWVoiceIn *hw, audsettings_t *as)
         /* Not Fatal */
         if (RT_UNLIKELY(err != noErr))
             LogRel(("CoreAudio: [Input] Failed to add the default device changed listener (%RI32)\n", err));
-        else
-            caVoice->fDefDevChgListReg = true;
     }
 
     Log(("CoreAudio: [Input] HW samples: %d\n", hw->samples));
diff --git a/src/VBox/Devices/Audio/dsound_template.h b/src/VBox/Devices/Audio/dsound_template.h
index c64e40d..7fbda13 100644
--- a/src/VBox/Devices/Audio/dsound_template.h
+++ b/src/VBox/Devices/Audio/dsound_template.h
@@ -168,21 +168,12 @@ static void dsound_fini_in (HWVoiceIn *hw)
 #else
 static void dsound_fini_out (HWVoiceOut *hw)
 {
-    HRESULT hr;
     DSoundVoiceOut *ds = (DSoundVoiceOut *) hw;
-
-    if (ds->FIELD) {
-        hr = glue (IFACE, _Stop) (ds->FIELD);
-        if (FAILED (hr)) {
-            dsound_logerr (hr, "Could not stop " NAME "\n");
-        }
-
-        hr = glue (IFACE, _Release) (ds->FIELD);
-        if (FAILED (hr)) {
-            dsound_logerr (hr, "Could not release " NAME "\n");
-        }
-        ds->FIELD = NULL;
-    }
+    dsoundPlayClose (ds);
+    ds->old_pos = 0;
+    ds->first_time = 1;
+    ds->playback_buffer_size = 0;
+    memset (&ds->as, 0, sizeof(ds->as));
 }
 #endif
 
@@ -193,6 +184,7 @@ static int dsound_init_in (HWVoiceIn *hw, audsettings_t *as)
 
     ds->last_read_pos = 0;
     ds->capture_buffer_size = 0;
+    ds->dsound_capture = NULL;
     ds->dsound_capture_buffer = NULL;
     ds->as = *as;
 
@@ -208,91 +200,23 @@ static int dsound_init_in (HWVoiceIn *hw, audsettings_t *as)
 #else
 static int dsound_init_out (HWVoiceOut *hw, audsettings_t *as)
 {
-    int err;
-    HRESULT hr;
-    dsound *s = &glob_dsound;
-    WAVEFORMATEX wfx;
-    audsettings_t obt_as;
-    const char *typ = "DAC";
     DSoundVoiceOut *ds = (DSoundVoiceOut *) hw;
-    DSBUFFERDESC bd;
-    DSBCAPS bc;
-
-    err = waveformat_from_audio_settings (&wfx, as);
-    if (err) {
-        return -1;
-    }
-
-    memset (&bd, 0, sizeof (bd));
-    bd.dwSize = sizeof (bd);
-    bd.lpwfxFormat = &wfx;
-    bd.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2;
-    bd.dwBufferBytes = conf.bufsize_out;
-    hr = IDirectSound_CreateSoundBuffer (
-        s->dsound,
-        &bd,
-        &ds->dsound_buffer,
-        NULL
-        );
-
-    if (FAILED (hr)) {
-        dsound_logerr2 (hr, typ, "Could not create " NAME "\n");
-        return -1;
-    }
-
-    hr = glue (IFACE, _GetFormat) (ds->FIELD, &wfx, sizeof (wfx), NULL);
-    if (FAILED (hr)) {
-        dsound_logerr2 (hr, typ, "Could not get " NAME " format\n");
-        goto fail0;
-    }
-
-#ifdef DEBUG_DSOUND
-    dolog (NAME "\n");
-    print_wave_format (&wfx);
-#endif
-
-    memset (&bc, 0, sizeof (bc));
-    bc.dwSize = sizeof (bc);
-
-    hr = glue (IFACE, _GetCaps) (ds->FIELD, &bc);
-    if (FAILED (hr)) {
-        dsound_logerr2 (hr, typ, "Could not get " NAME " format\n");
-        goto fail0;
-    }
-
-    err = waveformat_to_audio_settings (&wfx, &obt_as);
-    if (err) {
-        goto fail0;
-    }
 
+    ds->dsound = NULL;
+    ds->dsound_buffer = NULL;
+    ds->old_pos = 0;
     ds->first_time = 1;
-    obt_as.endianness = 0;
-    audio_pcm_init_info (&hw->info, &obt_as);
+    ds->playback_buffer_size = 0;
+    ds->as = *as;
 
-    if (bc.dwBufferBytes & hw->info.align) {
-        dolog (
-            "GetCaps returned misaligned buffer size %ld, alignment %d\n",
-            bc.dwBufferBytes, hw->info.align + 1
-            );
-    }
-    hw->samples = bc.dwBufferBytes >> hw->info.shift;
+    /* Init default settings. */
+    audio_pcm_init_info (&hw->info, &ds->as);
+    hw->samples = conf.bufsize_out >> hw->info.shift;
 
-#ifdef DEBUG_DSOUND
-    dolog ("caps %ld, desc %ld\n",
-           bc.dwBufferBytes, bd.dwBufferBytes);
+    /* Try to open playback in case the device is already there. */
+    dsoundPlayOpen (ds);
 
-    dolog ("bufsize %d, freq %d, chan %d, bits %d, sign %d\n",
-           hw->samples << hw->info.shift,
-           hw->info.freq,
-           hw->info.nchannels,
-           hw->info.bits,
-           hw->info.sign);
-#endif
     return 0;
-
- fail0:
-    glue (dsound_fini_, TYPE) (hw);
-    return -1;
 }
 #endif
 
diff --git a/src/VBox/Devices/Audio/dsoundaudio.c b/src/VBox/Devices/Audio/dsoundaudio.c
index c4033c5..3271e83 100644
--- a/src/VBox/Devices/Audio/dsoundaudio.c
+++ b/src/VBox/Devices/Audio/dsoundaudio.c
@@ -59,8 +59,6 @@
 #define AUDIO_CAP "dsound"
 #include "audio_int.h"
 
-/* #define DEBUG_DSOUND */
-
 #define DSLOGF(a) do { LogRel2(a); } while(0)
 #define DSLOGREL(a)                 \
     do {                            \
@@ -78,10 +76,8 @@ static struct {
     int lock_retries;
     int restore_retries;
     int getstatus_retries;
-    int set_primary;
     int bufsize_in;
     int bufsize_out;
-    audsettings_t settings;
     int latency_millis;
     char *device_guid_out;
     char *device_guid_in;
@@ -89,24 +85,16 @@ static struct {
     1,
     1,
     1,
-    0,
     16384,
     16384,
-    {
-        44100,
-        2,
-        AUD_FMT_S16
-    },
     10,
     NULL,
     NULL
 };
 
 typedef struct {
-    LPDIRECTSOUND dsound;
-    LPDIRECTSOUNDCAPTURE dsound_capture;
-    LPDIRECTSOUNDBUFFER dsound_primary_buffer;
-    audsettings_t settings;
+    RTUUID devguid_play;
+    LPCGUID devguidp_play;
     RTUUID devguid_capture;
     LPCGUID devguidp_capture;
 } dsound;
@@ -115,25 +103,26 @@ static dsound glob_dsound;
 
 typedef struct {
     HWVoiceOut hw;
+    LPDIRECTSOUND dsound;
     LPDIRECTSOUNDBUFFER dsound_buffer;
     DWORD old_pos;
     int first_time;
-#ifdef DEBUG_DSOUND
-    DWORD old_ppos;
-    DWORD played;
-    DWORD mixed;
-#endif
+    int playback_buffer_size;
+    audsettings_t as;
 } DSoundVoiceOut;
 
 typedef struct {
     HWVoiceIn hw;
     int last_read_pos;
     int capture_buffer_size;
+    LPDIRECTSOUNDCAPTURE dsound_capture;
     LPDIRECTSOUNDCAPTUREBUFFER dsound_capture_buffer;
     audsettings_t as;
     HRESULT hr_last_run_in;
 } DSoundVoiceIn;
 
+static void dsound_clear_sample (DSoundVoiceOut *ds);
+
 static void dsound_log_hresult (HRESULT hr)
 {
     const char *str = "BUG";
@@ -312,19 +301,6 @@ static DWORD millis_to_bytes (struct audio_pcm_info *info, DWORD millis)
     return (millis * info->bytes_per_second) / 1000;
 }
 
-#ifdef DEBUG_DSOUND
-static void print_wave_format (WAVEFORMATEX *wfx)
-{
-    dolog ("tag             = %d\n", wfx->wFormatTag);
-    dolog ("nChannels       = %d\n", wfx->nChannels);
-    dolog ("nSamplesPerSec  = %ld\n", wfx->nSamplesPerSec);
-    dolog ("nAvgBytesPerSec = %ld\n", wfx->nAvgBytesPerSec);
-    dolog ("nBlockAlign     = %d\n", wfx->nBlockAlign);
-    dolog ("wBitsPerSample  = %d\n", wfx->wBitsPerSample);
-    dolog ("cbSize          = %d\n", wfx->cbSize);
-}
-#endif
-
 static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb)
 {
     HRESULT hr;
@@ -341,12 +317,12 @@ static int dsound_restore_out (LPDIRECTSOUNDBUFFER dsb)
             continue;
 
         default:
-            dsound_logerr (hr, "Could not restore playback buffer\n");
+            DSLOGREL(("DSound: restore playback buffer %Rhrc\n", hr));
             return -1;
         }
     }
 
-    dolog ("%d attempts to restore playback buffer failed\n", i);
+    DSLOGF(("DSound: %d attempts to restore playback buffer failed\n", i));
     return -1;
 }
 
@@ -443,41 +419,307 @@ static int waveformat_to_audio_settings (WAVEFORMATEX *wfx, audsettings_t *as)
     return 0;
 }
 
-static void dsoundCaptureInterfaceRelease (dsound *s)
+/*
+ * DirectSound playback
+ */
+
+static void dsoundPlayInterfaceRelease (DSoundVoiceOut *ds)
+{
+    if (ds->dsound) {
+        IDirectSound_Release (ds->dsound);
+        ds->dsound = NULL;
+    }
+}
+
+static int dsoundPlayInterfaceCreate (DSoundVoiceOut *ds)
+{
+    dsound *s = &glob_dsound;
+
+    HRESULT hr;
+
+    if (ds->dsound != NULL) {
+        DSLOGF(("DSound: DirectSound instance already exists\n"));
+        return 0;
+    }
+
+    hr = CoCreateInstance (&CLSID_DirectSound, NULL, CLSCTX_ALL,
+                           &IID_IDirectSound, (void **) &ds->dsound);
+    if (FAILED (hr)) {
+        DSLOGREL(("DSound: DirectSound create instance %Rhrc\n", hr));
+    }
+    else {
+        hr = IDirectSound_Initialize (ds->dsound, s->devguidp_play);
+        if (SUCCEEDED(hr)) {
+            HWND hwnd = GetDesktopWindow ();
+            hr = IDirectSound_SetCooperativeLevel (ds->dsound, hwnd, DSSCL_PRIORITY);
+            if (FAILED (hr)) {
+                DSLOGREL(("DSound: set cooperative level for window %p %Rhrc\n", hwnd, hr));
+            }
+        }
+        if (FAILED (hr)) {
+            if (hr == DSERR_NODRIVER) {
+                DSLOGREL(("DSound: DirectSound playback is currently unavailable\n"));
+            }
+            else {
+                DSLOGREL(("DSound: DirectSound initialize %Rhrc\n", hr));
+            }
+            dsoundPlayInterfaceRelease (ds);
+        }
+    }
+
+    return SUCCEEDED (hr)? 0: -1;
+}
+
+static void dsoundPlayClose (DSoundVoiceOut *ds)
+{
+    dsound *s = &glob_dsound;
+
+    HRESULT hr;
+
+    DSLOGF(("DSound: playback close %p buffer %p\n", ds, ds->dsound_buffer));
+
+    if (ds->dsound_buffer) {
+        hr = IDirectSoundBuffer_Stop (ds->dsound_buffer);
+        if (FAILED (hr)) {
+            DSLOGREL(("DSound: playback close Stop %Rhrc\n", hr));
+        }
+
+        IDirectSoundBuffer_Release (ds->dsound_buffer);
+        ds->dsound_buffer = NULL;
+    }
+
+    dsoundPlayInterfaceRelease (ds);
+}
+
+static int dsoundPlayOpen (DSoundVoiceOut *ds)
+{
+    dsound *s = &glob_dsound;
+
+    int err;
+    HRESULT hr;
+    WAVEFORMATEX wfx;
+    DSBUFFERDESC bd;
+    DSBCAPS bc;
+
+    DSLOGF(("DSound: playback open %p size %d samples, freq %d, chan %d, bits %d, sign %d\n",
+            ds,
+            ds->hw.samples,
+            ds->hw.info.freq,
+            ds->hw.info.nchannels,
+            ds->hw.info.bits,
+            ds->hw.info.sign));
+
+    if (ds->dsound_buffer != NULL) {
+        /* Should not happen but be forgiving. */
+        DSLOGREL(("DSound: DirectSoundBuffer already exists\n"));
+        dsoundPlayClose (ds);
+    }
+
+    err = waveformat_from_audio_settings (&wfx, &ds->as);
+    if (err) {
+        return err;
+    }
+
+    err = dsoundPlayInterfaceCreate (ds);
+    if (err) {
+        return err;
+    }
+
+    memset (&bd, 0, sizeof (bd));
+    bd.dwSize = sizeof (bd);
+    bd.lpwfxFormat = &wfx;
+    bd.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2;
+    bd.dwBufferBytes = ds->hw.samples << ds->hw.info.shift;
+    hr = IDirectSound_CreateSoundBuffer (ds->dsound,
+                                         &bd, &ds->dsound_buffer, NULL);
+    if (FAILED (hr)) {
+        DSLOGREL(("DSound: playback CreateSoundBuffer %Rhrc\n", hr));
+        goto fail0;
+    }
+
+    /* Query the actual parameters. */
+
+    hr = IDirectSoundBuffer_GetFormat (ds->dsound_buffer, &wfx, sizeof (wfx), NULL);
+    if (FAILED (hr)) {
+        DSLOGREL(("DSound: playback GetFormat %Rhrc\n", hr));
+        goto fail0;
+    }
+
+    memset (&bc, 0, sizeof (bc));
+    bc.dwSize = sizeof (bc);
+    hr = IDirectSoundBuffer_GetCaps (ds->dsound_buffer, &bc);
+    if (FAILED (hr)) {
+        DSLOGREL(("DSound: playback GetCaps %Rhrc\n", hr));
+        goto fail0;
+    }
+
+    DSLOGF(("DSound: playback format: size %d bytes\n"
+            "  tag             = %d\n"
+            "  nChannels       = %d\n"
+            "  nSamplesPerSec  = %d\n"
+            "  nAvgBytesPerSec = %d\n"
+            "  nBlockAlign     = %d\n"
+            "  wBitsPerSample  = %d\n"
+            "  cbSize          = %d\n",
+            bc.dwBufferBytes,
+            wfx.wFormatTag,
+            wfx.nChannels,
+            wfx.nSamplesPerSec,
+            wfx.nAvgBytesPerSec,
+            wfx.nBlockAlign,
+            wfx.wBitsPerSample,
+            wfx.cbSize));
+
+    if (bc.dwBufferBytes & ds->hw.info.align) {
+        DSLOGREL(("DSound: playback GetCaps returned misaligned buffer size %ld, alignment %d\n",
+                  bc.dwBufferBytes, ds->hw.info.align + 1));
+    }
+
+    if (ds->hw.samples != 0 && ds->hw.samples != (bc.dwBufferBytes >> ds->hw.info.shift)) {
+        DSLOGREL(("DSound: playback buffer size mismatch dsound %d, hw %d bytes\n",
+                  bc.dwBufferBytes, ds->hw.samples << ds->hw.info.shift));
+    }
+
+    /* Initial state.
+     * dsoundPlayStart initializes part of it to make sure that Stop/Start continues with a correct
+     * playback buffer position.
+     */
+    ds->playback_buffer_size = bc.dwBufferBytes >> ds->hw.info.shift;
+    DSLOGF(("DSound: playback open playback_buffer_size %d\n", ds->playback_buffer_size));
+
+    return 0;
+
+ fail0:
+    dsoundPlayClose (ds);
+    return -1;
+}
+
+static int dsoundPlayGetStatus (DSoundVoiceOut *ds, DWORD *statusp)
+{
+    HRESULT hr;
+    DWORD status;
+    int i;
+
+    if (ds->dsound_buffer != NULL) {
+        for (i = 0; i < RT_MAX(conf.getstatus_retries, 1); ++i) {
+            hr = IDirectSoundBuffer_GetStatus (ds->dsound_buffer, &status);
+            if (FAILED (hr)) {
+                DSLOGF(("DSound: playback start GetStatus %Rhrc\n", hr));
+                break;
+            }
+
+            if ((status & DSBSTATUS_BUFFERLOST) == 0) {
+                break;
+            }
+
+            if (dsound_restore_out (ds->dsound_buffer)) {
+                hr = E_FAIL;
+                break;
+            }
+        }
+    }
+    else
+    {
+        hr = E_FAIL;
+    }
+
+    if (SUCCEEDED (hr)) {
+        *statusp = status;
+        return 0;
+    }
+    return -1;
+}
+
+static void dsoundPlayStop (DSoundVoiceOut *ds)
 {
-    if (s->dsound_capture) {
-        HRESULT hr = IDirectSoundCapture_Release (s->dsound_capture);
+    HRESULT hr;
+    DWORD status;
+
+    if (ds->dsound_buffer != NULL) {
+        /* This performs some restore, so call it anyway and ignore result. */
+        dsoundPlayGetStatus (ds, &status);
+
+        hr = IDirectSoundBuffer_Stop (ds->dsound_buffer);
         if (FAILED (hr)) {
-            DSLOGF(("DSound: DirectSoundCapture release %Rhrc\n", hr));
+            DSLOGF(("DSound: stop playback buffer %Rhrc\n", hr));
         }
-        s->dsound_capture = NULL;
     }
 }
 
-static int dsoundCaptureInterfaceCreate (dsound *s)
+static int dsoundPlayStart (DSoundVoiceOut *ds)
 {
     HRESULT hr;
+    DWORD status;
+
+    if (ds->dsound_buffer != NULL) {
+        if (dsoundPlayGetStatus (ds, &status)) {
+            DSLOGF(("DSound: playback start GetStatus failed\n"));
+            hr = E_FAIL;
+        }
+        else {
+            if (status & DSBSTATUS_PLAYING) {
+                DSLOGF(("DSound: already playing\n"));
+            }
+            else {
+                dsound_clear_sample (ds);
+
+                /* Reinit the playback buffer position. */
+                ds->first_time = 1;
+
+                DSLOGF(("DSound: playback start\n"));
+
+                hr = IDirectSoundBuffer_Play (ds->dsound_buffer, 0, 0, DSBPLAY_LOOPING);
+                if (FAILED (hr)) {
+                    DSLOGREL(("DSound: playback start %Rhrc\n", hr));
+                }
+            }
+        }
+    }
+    else {
+        hr = E_FAIL;
+    }
 
-    if (s->dsound_capture != NULL) {
+    return SUCCEEDED (hr)? 0: -1;
+}
+
+/*
+ * DirectSoundCapture
+ */
+
+static void dsoundCaptureInterfaceRelease (DSoundVoiceIn *ds)
+{
+    if (ds->dsound_capture) {
+        IDirectSoundCapture_Release (ds->dsound_capture);
+        ds->dsound_capture = NULL;
+    }
+}
+
+static int dsoundCaptureInterfaceCreate (DSoundVoiceIn *ds)
+{
+    dsound *s = &glob_dsound;
+
+    HRESULT hr;
+
+    if (ds->dsound_capture != NULL) {
         DSLOGF(("DSound: DirectSoundCapture instance already exists\n"));
-        return -1;
+        return 0;
     }
 
     hr = CoCreateInstance (&CLSID_DirectSoundCapture, NULL, CLSCTX_ALL,
-                           &IID_IDirectSoundCapture, (void **) &s->dsound_capture);
+                           &IID_IDirectSoundCapture, (void **) &ds->dsound_capture);
     if (FAILED (hr)) {
         DSLOGREL(("DSound: DirectSoundCapture create instance %Rhrc\n", hr));
     }
     else {
-        hr = IDirectSoundCapture_Initialize (s->dsound_capture, s->devguidp_capture);
+        hr = IDirectSoundCapture_Initialize (ds->dsound_capture, s->devguidp_capture);
         if (FAILED (hr)) {
             if (hr == DSERR_NODRIVER) {
-                DSLOGREL(("DSound: DirectSoundCapture not available\n"));
+                DSLOGREL(("DSound: DirectSound capture is currently unavailable\n"));
             }
             else {
                 DSLOGREL(("DSound: DirectSoundCapture initialize %Rhrc\n", hr));
             }
-            dsoundCaptureInterfaceRelease (s);
+            dsoundCaptureInterfaceRelease (ds);
         }
     }
 
@@ -496,14 +738,11 @@ static void dsoundCaptureClose (DSoundVoiceIn *ds)
             DSLOGF(("DSound: close capture buffer stop %Rhrc\n", hr));
         }
 
-        hr = IDirectSoundCaptureBuffer_Release (ds->dsound_capture_buffer);
-        if (FAILED (hr)) {
-            DSLOGF(("DSound: close capture buffer release %Rhrc\n", hr));
-        }
+        IDirectSoundCaptureBuffer_Release (ds->dsound_capture_buffer);
         ds->dsound_capture_buffer = NULL;
     }
 
-    dsoundCaptureInterfaceRelease (s);
+    dsoundCaptureInterfaceRelease (ds);
 }
 
 static int dsoundCaptureOpen (DSoundVoiceIn *ds)
@@ -536,7 +775,7 @@ static int dsoundCaptureOpen (DSoundVoiceIn *ds)
         return err;
     }
 
-    err = dsoundCaptureInterfaceCreate (s);
+    err = dsoundCaptureInterfaceCreate (ds);
     if (err) {
         return err;
     }
@@ -545,7 +784,7 @@ static int dsoundCaptureOpen (DSoundVoiceIn *ds)
     bd.dwSize = sizeof (bd);
     bd.lpwfxFormat = &wfx;
     bd.dwBufferBytes = ds->hw.samples << ds->hw.info.shift;
-    hr = IDirectSoundCapture_CreateCaptureBuffer (s->dsound_capture,
+    hr = IDirectSoundCapture_CreateCaptureBuffer (ds->dsound_capture,
                                                   &bd, &ds->dsound_capture_buffer, NULL);
 
     if (FAILED (hr)) {
@@ -608,7 +847,7 @@ static int dsoundCaptureOpen (DSoundVoiceIn *ds)
     ds->hw.wpos = 0;
     ds->last_read_pos = rpos >> ds->hw.info.shift;
     ds->capture_buffer_size = bc.dwBufferBytes >> ds->hw.info.shift;
-    DSLOGF(("DSound: open last_read_pos %d, capture_buffer_size %d\n", ds->last_read_pos, ds->capture_buffer_size));
+    DSLOGF(("DSound: capture open last_read_pos %d, capture_buffer_size %d\n", ds->last_read_pos, ds->capture_buffer_size));
 
     ds->hr_last_run_in = S_OK;
 
@@ -644,6 +883,9 @@ static int dsoundCaptureStart (DSoundVoiceIn *ds)
                 DSLOGF(("DSound: already capturing\n"));
             }
             else {
+                /** @todo Fill the capture beffer with silence here. */
+
+                DSLOGF(("DSound: capture start\n"));
                 hr = IDirectSoundCaptureBuffer_Start (ds->dsound_capture_buffer, DSCBSTART_LOOPING);
                 if (FAILED (hr)) {
                     DSLOGREL(("DSound: start %Rhrc\n", hr));
@@ -663,44 +905,6 @@ static int dsoundCaptureStart (DSoundVoiceIn *ds)
 #include "dsound_template.h"
 #undef DSBTYPE_IN
 
-static int dsound_get_status_out (LPDIRECTSOUNDBUFFER dsb, DWORD *statusp)
-{
-    HRESULT hr;
-    int i;
-
-    for (i = 0; i < conf.getstatus_retries; ++i) {
-        hr = IDirectSoundBuffer_GetStatus (dsb, statusp);
-        if (FAILED (hr)) {
-            dsound_logerr (hr, "Could not get playback buffer status\n");
-            return -1;
-        }
-
-        if (*statusp & DSERR_BUFFERLOST) {
-            if (dsound_restore_out (dsb)) {
-                return -1;
-            }
-            continue;
-        }
-        break;
-    }
-
-    return 0;
-}
-
-static int dsound_get_status_in (LPDIRECTSOUNDCAPTUREBUFFER dscb,
-                                 DWORD *statusp)
-{
-    HRESULT hr;
-
-    hr = IDirectSoundCaptureBuffer_GetStatus (dscb, statusp);
-    if (FAILED (hr)) {
-        dsound_logerr (hr, "Could not get capture buffer status\n");
-        return -1;
-    }
-
-    return 0;
-}
-
 static void dsound_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len)
 {
     int src_len1 = dst_len;
@@ -718,29 +922,27 @@ static void dsound_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len)
 
     if (src_len1) {
         hw->clip (dst, src1, src_len1);
-//        mixeng_sniff_and_clear (hw, src1, dst, src_len1);
     }
 
     if (src_len2) {
         dst = advance (dst, src_len1 << hw->info.shift);
         hw->clip (dst, src2, src_len2);
-//        mixeng_sniff_and_clear (hw, src2, dst, src_len2);
     }
 
     hw->rpos = pos % hw->samples;
 }
 
-static void dsound_clear_sample (HWVoiceOut *hw, LPDIRECTSOUNDBUFFER dsb)
+static void dsound_clear_sample (DSoundVoiceOut *ds)
 {
     int err;
     LPVOID p1, p2;
     DWORD blen1, blen2, len1, len2;
 
     err = dsound_lock_out (
-        dsb,
-        &hw->info,
+        ds->dsound_buffer,
+        &ds->hw.info,
         0,
-        hw->samples << hw->info.shift,
+        ds->playback_buffer_size << ds->hw.info.shift,
         &p1, &p2,
         &blen1, &blen2,
         1
@@ -749,186 +951,39 @@ static void dsound_clear_sample (HWVoiceOut *hw, LPDIRECTSOUNDBUFFER dsb)
         return;
     }
 
-    len1 = blen1 >> hw->info.shift;
-    len2 = blen2 >> hw->info.shift;
-
-#ifdef DEBUG_DSOUND
-    dolog ("clear %p,%ld,%ld %p,%ld,%ld\n",
-           p1, blen1, len1,
-           p2, blen2, len2);
-#endif
+    len1 = blen1 >> ds->hw.info.shift;
+    len2 = blen2 >> ds->hw.info.shift;
 
     if (p1 && len1) {
-        audio_pcm_info_clear_buf (&hw->info, p1, len1);
+        audio_pcm_info_clear_buf (&ds->hw.info, p1, len1);
     }
 
     if (p2 && len2) {
-        audio_pcm_info_clear_buf (&hw->info, p2, len2);
+        audio_pcm_info_clear_buf (&ds->hw.info, p2, len2);
     }
 
-    dsound_unlock_out (dsb, p1, p2, blen1, blen2);
-}
-
-static void dsound_close (dsound *s)
-{
-    HRESULT hr;
-
-    if (s->dsound_primary_buffer) {
-        hr = IDirectSoundBuffer_Release (s->dsound_primary_buffer);
-        if (FAILED (hr)) {
-            dsound_logerr (hr, "Could not release primary buffer\n");
-        }
-        s->dsound_primary_buffer = NULL;
-    }
-}
-
-static int dsound_open (dsound *s)
-{
-    int err;
-    HRESULT hr;
-    WAVEFORMATEX wfx;
-    DSBUFFERDESC dsbd;
-    HWND hwnd;
-
-    hwnd = GetDesktopWindow ();
-    hr = IDirectSound_SetCooperativeLevel (
-        s->dsound,
-        hwnd,
-        DSSCL_PRIORITY
-        );
-
-    if (FAILED (hr)) {
-#ifndef VBOX
-        dsound_logerr (hr, "Could not set cooperative level for window %p\n",
-                       hwnd);
-#else
-        LogRel(("DSound: Could not set cooperative level for window %p\n", hwnd));
-        dsound_log_hresult(hr);
-#endif
-        return -1;
-    }
-
-    if (!conf.set_primary) {
-        return 0;
-    }
-
-    err = waveformat_from_audio_settings (&wfx, &conf.settings);
-    if (err) {
-        return -1;
-    }
-
-    memset (&dsbd, 0, sizeof (dsbd));
-    dsbd.dwSize = sizeof (dsbd);
-    dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
-    dsbd.dwBufferBytes = 0;
-    dsbd.lpwfxFormat = NULL;
-
-    hr = IDirectSound_CreateSoundBuffer (
-        s->dsound,
-        &dsbd,
-        &s->dsound_primary_buffer,
-        NULL
-        );
-    if (FAILED (hr)) {
-#ifndef VBOX
-        dsound_logerr (hr, "Could not create primary playback buffer\n");
-#else
-        LogRel(("DSound: Could not create primary playback buffer\n"));
-        dsound_log_hresult(hr);
-#endif
-        return -1;
-    }
-
-    hr = IDirectSoundBuffer_SetFormat (s->dsound_primary_buffer, &wfx);
-    if (FAILED (hr)) {
-#ifndef VBOX
-        dsound_logerr (hr, "Could not set primary playback buffer format\n");
-#else
-        LogRel(("DSound: Could not set primary playback buffer format\n"));
-        dsound_log_hresult(hr);
-#endif
-    }
-
-    hr = IDirectSoundBuffer_GetFormat (
-        s->dsound_primary_buffer,
-        &wfx,
-        sizeof (wfx),
-        NULL
-        );
-    if (FAILED (hr)) {
-#ifndef VBOX
-        dsound_logerr (hr, "Could not get primary playback buffer format\n");
-#else
-        LogRel(("DSound: Could not get primary playback buffer format\n"));
-        dsound_log_hresult(hr);
-#endif
-        goto fail0;
-    }
-
-#ifdef DEBUG_DSOUND
-    dolog ("Primary\n");
-    print_wave_format (&wfx);
-#endif
-
-    err = waveformat_to_audio_settings (&wfx, &s->settings);
-    if (err) {
-        goto fail0;
-    }
-
-    return 0;
-
- fail0:
-    dsound_close (s);
-    return -1;
+    dsound_unlock_out (ds->dsound_buffer, p1, p2, blen1, blen2);
 }
 
 static int dsound_ctl_out (HWVoiceOut *hw, int cmd, ...)
 {
-    HRESULT hr;
-    DWORD status;
     DSoundVoiceOut *ds = (DSoundVoiceOut *) hw;
-    LPDIRECTSOUNDBUFFER dsb = ds->dsound_buffer;
-
-    if (!dsb) {
-        dolog ("Attempt to control voice without a buffer\n");
-        return 0;
-    }
 
     switch (cmd) {
     case VOICE_ENABLE:
-        if (dsound_get_status_out (dsb, &status)) {
-            return -1;
-        }
+        /* Try to start playback. If it fails, then reopen and try again. */
+        if (dsoundPlayStart (ds)) {
+            dsoundPlayClose (ds);
+            dsoundPlayOpen (ds);
 
-        if (status & DSBSTATUS_PLAYING) {
-            dolog ("warning: Voice is already playing\n");
-            return 0;
-        }
-
-        dsound_clear_sample (hw, dsb);
-
-        hr = IDirectSoundBuffer_Play (dsb, 0, 0, DSBPLAY_LOOPING);
-        if (FAILED (hr)) {
-            dsound_logerr (hr, "Could not start playing buffer\n");
-            return -1;
+            if (dsoundPlayStart (ds)) {
+                return -1;
+            }
         }
         break;
 
     case VOICE_DISABLE:
-        if (dsound_get_status_out (dsb, &status)) {
-            return -1;
-        }
-
-        if (status & DSBSTATUS_PLAYING) {
-            hr = IDirectSoundBuffer_Stop (dsb);
-            if (FAILED (hr)) {
-                dsound_logerr (hr, "Could not stop playing buffer\n");
-                return -1;
-            }
-        }
-        else {
-            dolog ("warning: Voice is not playing\n");
-        }
+        dsoundPlayStop (ds);
         break;
     }
     return 0;
@@ -954,29 +1009,29 @@ static int dsound_run_out (HWVoiceOut *hw)
     int bufsize;
 
     if (!dsb) {
-        dolog ("Attempt to run empty with playback buffer\n");
+        DSLOGF(("DSound: run_out no playback buffer\n"));
         return 0;
     }
 
     hwshift = hw->info.shift;
-    bufsize = hw->samples << hwshift;
+    bufsize = ds->playback_buffer_size << hwshift;
 
     live = audio_pcm_hw_get_live_out (hw);
 
     hr = IDirectSoundBuffer_GetCurrentPosition (
         dsb,
         &ppos,
-        ds->first_time ? &wpos : NULL
+        &wpos
         );
     if (hr == DSERR_BUFFERLOST) {
         if (dsound_restore_out(dsb))
             return 0;
-        hr = IDirectSoundBuffer_GetCurrentPosition(dsb, &ppos, ds->first_time ? &wpos : NULL);
+        hr = IDirectSoundBuffer_GetCurrentPosition(dsb, &ppos, &wpos);
         if (hr == DSERR_BUFFERLOST)
             return 0;   // Avoid log flooding if the error is still there.
     }
     if (FAILED (hr)) {
-        dsound_logerr (hr, "Could not get playback buffer position\n");
+        DSLOGF(("DSound: get playback buffer position %Rhrc\n", hr));
         return 0;
     }
 
@@ -985,34 +1040,27 @@ static int dsound_run_out (HWVoiceOut *hw)
     if (ds->first_time) {
         if (conf.latency_millis) {
             DWORD cur_blat;
+            DWORD conf_blat;
 
+            conf_blat = millis_to_bytes (&hw->info, conf.latency_millis);
             cur_blat = audio_ring_dist (wpos, ppos, bufsize);
-            ds->first_time = 0;
             old_pos = wpos;
-            old_pos +=
-                millis_to_bytes (&hw->info, conf.latency_millis) - cur_blat;
+            if (conf_blat > cur_blat) /* Do not write before wpos. */
+               old_pos += conf_blat - cur_blat;
             old_pos %= bufsize;
             old_pos &= ~hw->info.align;
         }
         else {
             old_pos = wpos;
         }
-#ifdef DEBUG_DSOUND
-        ds->played = 0;
-        ds->mixed = 0;
-#endif
+        ds->first_time = 0;
     }
     else {
         if (ds->old_pos == ppos) {
-#ifdef DEBUG_DSOUND
-            dolog ("old_pos == ppos\n");
-#endif
+            /* Full buffer. */
             return 0;
         }
 
-#ifdef DEBUG_DSOUND
-        ds->played += audio_ring_dist (ds->old_pos, ppos, bufsize);
-#endif
         old_pos = ds->old_pos;
     }
 
@@ -1026,8 +1074,8 @@ static int dsound_run_out (HWVoiceOut *hw)
     }
 
     if (audio_bug (AUDIO_FUNC, len < 0 || len > bufsize)) {
-        dolog ("len=%d bufsize=%d old_pos=%ld ppos=%ld\n",
-               len, bufsize, old_pos, ppos);
+        DSLOGF(("DSound: error len=%d bufsize=%d old_pos=%ld ppos=%ld\n",
+               len, bufsize, old_pos, ppos));
         return 0;
     }
 
@@ -1036,9 +1084,6 @@ static int dsound_run_out (HWVoiceOut *hw)
         return 0;
     }
 
-#ifdef DEBUG_DSOUND
-    ds->old_ppos = ppos;
-#endif
     err = dsound_lock_out (
         dsb,
         &hw->info,
@@ -1067,15 +1112,6 @@ static int dsound_run_out (HWVoiceOut *hw)
     dsound_unlock_out (dsb, p1, p2, blen1, blen2);
     ds->old_pos = (old_pos + (decr << hwshift)) % bufsize;
 
-#ifdef DEBUG_DSOUND
-    ds->mixed += decr << hwshift;
-
-    dolog ("played %lu mixed %lu diff %ld sec %f\n",
-           ds->played,
-           ds->mixed,
-           ds->mixed - ds->played,
-           abs (ds->mixed - ds->played) / (double) hw->info.bytes_per_second);
-#endif
     return decr;
 }
 
@@ -1205,97 +1241,46 @@ static int dsound_run_in (HWVoiceIn *hw)
     return decr;
 }
 
-static void dsound_audio_fini (void *opaque)
+static int dsoundIsAvailable (void)
 {
-    HRESULT hr;
-    dsound *s = opaque;
-
-    if (!s->dsound) {
-        goto dsound_audio_fini_exit;
-    }
-
-    hr = IDirectSound_Release (s->dsound);
-    if (FAILED (hr)) {
-        dsound_logerr (hr, "Could not release DirectSound\n");
-    }
-    s->dsound = NULL;
-
-    if (!s->dsound_capture) {
-        goto dsound_audio_fini_exit;
+    LPDIRECTSOUND dsound;
+    HRESULT hr = CoCreateInstance (&CLSID_DirectSound, NULL, CLSCTX_ALL,
+                                   &IID_IDirectSound, (void **) &dsound);
+    if (SUCCEEDED(hr)) {
+        IDirectSound_Release (dsound);
+        return 1;
     }
 
-    hr = IDirectSoundCapture_Release (s->dsound_capture);
-    if (FAILED (hr)) {
-        dsound_logerr (hr, "Could not release DirectSoundCapture\n");
-    }
-    s->dsound_capture = NULL;
+    DSLOGREL(("DSound: is unavailable %Rhrc\n", hr));
+    return 0;
+}
 
-dsound_audio_fini_exit:
+static void dsound_audio_fini (void *opaque)
+{
+    dsound *s = opaque;
+    NOREF(s);
     CoUninitialize();
 }
 
 static void *dsound_audio_init (void)
 {
-    int err;
     HRESULT hr;
     dsound *s = &glob_dsound;
-    RTUUID devguid;
-    LPCGUID devguidp;
 
     hr = CoInitializeEx (NULL, COINIT_MULTITHREADED);
     if (FAILED (hr)) {
-#ifndef VBOX
-        dsound_logerr (hr, "Could not initialize COM\n");
-#else
-        LogRel(("DSound: Could not initialize COM\n"));
-        dsound_log_hresult(hr);
-#endif
-        return NULL;
-    }
-
-    hr = CoCreateInstance (
-        &CLSID_DirectSound,
-        NULL,
-        CLSCTX_ALL,
-        &IID_IDirectSound,
-        (void **) &s->dsound
-        );
-    if (FAILED (hr)) {
-#ifndef VBOX
-        dsound_logerr (hr, "Could not create DirectSound instance\n");
-#else
-        LogRel(("DSound: Could not create DirectSound instance\n"));
-        dsound_log_hresult(hr);
-#endif
-        CoUninitialize();
+        DSLOGREL(("DSound: COM initialize %Rhrc\n", hr));
         return NULL;
     }
 
     if (conf.device_guid_out) {
-        hr = RTUuidFromStr(&devguid, conf.device_guid_out);
-        if (FAILED (hr)) {
+        int rc = RTUuidFromStr(&s->devguid_play, conf.device_guid_out);
+        if (FAILED (rc)) {
             LogRel(("DSound: Could not parse DirectSound output device GUID\n"));
         }
-        devguidp = (LPCGUID)&devguid;
+        s->devguidp_play = (LPCGUID)&s->devguid_play;
     } else {
-        devguidp = NULL;
-    }
-    hr = IDirectSound_Initialize (s->dsound, devguidp);
-    if (FAILED (hr)) {
-#ifndef VBOX
-        dsound_logerr (hr, "Could not initialize DirectSound\n");
-#else
-        LogRel(("DSound: Could not initialize DirectSound\n"));
-        dsound_log_hresult(hr);
-#endif
-
-        hr = IDirectSound_Release (s->dsound);
-        if (FAILED (hr)) {
-            dsound_logerr (hr, "Could not release DirectSound\n");
-        }
-        s->dsound = NULL;
-        CoUninitialize();
-        return NULL;
+        s->devguidp_play = NULL;
     }
 
     if (conf.device_guid_in) {
@@ -1308,13 +1293,12 @@ static void *dsound_audio_init (void)
         s->devguidp_capture = NULL;
     }
 
-    err = dsound_open (s);
-    if (err) {
-        dsound_audio_fini (s);
-        return NULL;
-    }
+    /* Check that DSound interface is available. */
+    if (dsoundIsAvailable ())
+        return s;
 
-    return s;
+    dsound_audio_fini (s);
+    return NULL;
 }
 
 static struct audio_option dsound_options[] = {
@@ -1324,16 +1308,8 @@ static struct audio_option dsound_options[] = {
      "Number of times to attempt restoring the buffer", NULL, 0},
     {"GetStatusRetries", AUD_OPT_INT, &conf.getstatus_retries,
      "Number of times to attempt getting status of the buffer", NULL, 0},
-    {"SetPrimary", AUD_OPT_BOOL, &conf.set_primary,
-     "Set the parameters of primary buffer", NULL, 0},
     {"LatencyMillis", AUD_OPT_INT, &conf.latency_millis,
      "(undocumented)", NULL, 0},
-    {"PrimaryFreq", AUD_OPT_INT, &conf.settings.freq,
-     "Primary buffer frequency", NULL, 0},
-    {"PrimaryChannels", AUD_OPT_INT, &conf.settings.nchannels,
-     "Primary buffer number of channels (1 - mono, 2 - stereo)", NULL, 0},
-    {"PrimaryFmt", AUD_OPT_FMT, &conf.settings.fmt,
-     "Primary buffer format", NULL, 0},
     {"BufsizeOut", AUD_OPT_INT, &conf.bufsize_out,
      "(undocumented)", NULL, 0},
     {"BufsizeIn", AUD_OPT_INT, &conf.bufsize_in,
diff --git a/src/VBox/Devices/Audio/mixeng.c b/src/VBox/Devices/Audio/mixeng.c
index 574cf30..c000604 100644
--- a/src/VBox/Devices/Audio/mixeng.c
+++ b/src/VBox/Devices/Audio/mixeng.c
@@ -25,14 +25,18 @@
 
 #include "VBoxDD.h"
 #include "vl_vbox.h"
-#include "audio.h"
 #ifdef VBOX
 # include <iprt/asm-math.h>
 # include <iprt/mem.h>
 #endif
 
 #define AUDIO_CAP "mixeng"
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+#include "DrvAudio.h"
+#else
+#include "audio.h"
 #include "audio_int.h"
+#endif
 
 #ifndef VBOX
 #define NOVOL
@@ -308,11 +312,14 @@ struct rate {
  */
 void *st_rate_start (int inrate, int outrate)
 {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    struct rate *rate = (struct rate *)RTMemAllocZ(1 * sizeof (*rate));
+#else
     struct rate *rate = audio_calloc (AUDIO_FUNC, 1, sizeof (*rate));
+#endif
 
     if (!rate) {
-        dolog ("Could not allocate resampler (%" FMTZ "u bytes)\n",
-               sizeof (*rate));
+        LogFlow(("Could not allocate resampler %u bytes)\n", sizeof (*rate)));
         return NULL;
     }
 
@@ -337,16 +344,34 @@ void *st_rate_start (int inrate, int outrate)
 
 void st_rate_stop (void *opaque)
 {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    RTMemFree(opaque);
+#else
     qemu_free (opaque);
+#endif
 }
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+void mixeng_clear(PPDMHOSTSTEREOSAMPLE buf, int len)
+{
+    memset (buf, 0, len * sizeof (PDMHOSTSTEREOSAMPLE));
+}
+#else
 void mixeng_clear (st_sample_t *buf, int len)
 {
     memset (buf, 0, len * sizeof (st_sample_t));
 }
+#endif
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+void mixeng_sniff_and_clear (PPDMHOSTVOICEOUT hw, PPDMHOSTSTEREOSAMPLE src, int len)
+#else
 void mixeng_sniff_and_clear (HWVoiceOut *hw, st_sample_t *src, int len)
+#endif
 {
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
+    LogFlow(("mixeng: sniffer_run_out\n"));
     sniffer_run_out (hw, src, len);
+#endif
     mixeng_clear (src, len);
 }
diff --git a/src/VBox/Devices/Audio/mixeng.h b/src/VBox/Devices/Audio/mixeng.h
index 55915cb..c6d15e8 100644
--- a/src/VBox/Devices/Audio/mixeng.h
+++ b/src/VBox/Devices/Audio/mixeng.h
@@ -28,7 +28,9 @@ struct HWVoiceOut;
 
 #ifdef VBOX
 /* use faster ASMMult2xS32RetS64 */
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
 typedef struct { int mute;  uint32_t r; uint32_t l; } volume_t;
+#endif
 typedef struct { int64_t l; int64_t r; } st_sample_t;
 #else /* !VBOX */
 #ifdef FLOAT_MIXENG
@@ -40,9 +42,10 @@ typedef struct { int mute; int64_t r; int64_t l; } volume_t;
 typedef struct { int64_t l; int64_t r; } st_sample_t;
 #endif
 #endif /* VBOX */
-
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
 typedef void (t_sample) (st_sample_t *dst, const void *src,
                          int samples, volume_t *vol);
+#endif
 typedef void (f_sample) (void *dst, const st_sample_t *src, int samples);
 
 extern t_sample *mixeng_conv[2][2][2][3];
@@ -54,7 +57,12 @@ void st_rate_flow (void *opaque, st_sample_t *ibuf, st_sample_t *obuf,
 void st_rate_flow_mix (void *opaque, st_sample_t *ibuf, st_sample_t *obuf,
                        int *isamp, int *osamp);
 void st_rate_stop (void *opaque);
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+void mixeng_clear(PPDMHOSTSTEREOSAMPLE buf, int len);
+void mixeng_sniff_and_clear(PPDMHOSTVOICEOUT hw, PPDMHOSTSTEREOSAMPLE src, int len);
+# else
 void mixeng_clear (st_sample_t *buf, int len);
 void mixeng_sniff_and_clear (struct HWVoiceOut *hw, st_sample_t *src, int len);
+# endif
 
 #endif  /* mixeng.h */
diff --git a/src/VBox/Devices/Audio/mixeng_template.h b/src/VBox/Devices/Audio/mixeng_template.h
index 554f2de..8b1bc27 100644
--- a/src/VBox/Devices/Audio/mixeng_template.h
+++ b/src/VBox/Devices/Audio/mixeng_template.h
@@ -113,9 +113,17 @@ static inline IN_T glue (clip_, ET) (int64_t v)
 #endif
 
 static void glue (glue (conv_, ET), _to_stereo)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    (PPDMHOSTSTEREOSAMPLE dst, const void *src, int samples, volume_t *vol)
+#else
     (st_sample_t *dst, const void *src, int samples, volume_t *vol)
+#endif
 {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PPDMHOSTSTEREOSAMPLE out = dst;
+#else
     st_sample_t *out = dst;
+#endif
     IN_T *in = (IN_T *) src;
 #ifndef NOVOL
     if (vol->mute) {
@@ -126,16 +134,29 @@ static void glue (glue (conv_, ET), _to_stereo)
     (void) vol;
 #endif
     while (samples--) {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        out->u64LSample = VOL (glue (conv_, ET) (*in++), vol->l);
+        out->u64RSample = VOL (glue (conv_, ET) (*in++), vol->r);
+#else
         out->l = VOL (glue (conv_, ET) (*in++), vol->l);
         out->r = VOL (glue (conv_, ET) (*in++), vol->r);
+#endif
         out += 1;
     }
 }
 
 static void glue (glue (conv_, ET), _to_mono)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    (PPDMHOSTSTEREOSAMPLE dst, const void *src, int samples, volume_t *vol)
+#else
     (st_sample_t *dst, const void *src, int samples, volume_t *vol)
+#endif
 {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    PPDMHOSTSTEREOSAMPLE out = dst;
+#else
     st_sample_t *out = dst;
+#endif
     IN_T *in = (IN_T *) src;
 #ifndef NOVOL
     if (vol->mute) {
@@ -146,8 +167,14 @@ static void glue (glue (conv_, ET), _to_mono)
     (void) vol;
 #endif
     while (samples--) {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        out->u64LSample = VOL (glue (conv_, ET) (in[0]), vol->l);
+        out->u64RSample = out->u64LSample;
+#else
         out->l = VOL (glue (conv_, ET) (in[0]), vol->l);
         out->r = out->l;
+
+#endif
         out += 1;
         in += 1;
     }
diff --git a/src/VBox/Devices/Audio/pulseaudio.c b/src/VBox/Devices/Audio/pulseaudio.c
index af78018..e152057 100644
--- a/src/VBox/Devices/Audio/pulseaudio.c
+++ b/src/VBox/Devices/Audio/pulseaudio.c
@@ -256,7 +256,7 @@ static int pulse_open (int fIn, pa_stream **ppStream, pa_sample_spec *pSampleSpe
                 fIn ? "pcm_in" : "pcm_out",
                 stream_name ? ")" : "");
 
-    LogRel(("Pulse: open %s rate=%dHz channels=%d format=%s\n",
+    LogRel(("Pulse: Open %s rate=%dHz channels=%d format=%s\n",
                 fIn ? "PCM_IN" : "PCM_OUT", pSampleSpec->rate, pSampleSpec->channels,
                 pa_sample_format_to_string(pSampleSpec->format)));
 
@@ -336,12 +336,12 @@ static int pulse_open (int fIn, pa_stream **ppStream, pa_sample_spec *pSampleSpe
 
     if (fIn)
     {
-        LogRel(("Pulse:  Obtained record buffer attributes: maxlength=%d fragsize=%d\n",
+        LogRel(("Pulse: Obtained record buffer attributes: maxlength=%d fragsize=%d\n",
             pBufAttr->maxlength, pBufAttr->fragsize));
     }
     else
     {
-        LogRel(("Pulse:  Obtained playback buffer attributes: maxlength=%d tlength=%d prebuf=%d minreq=%d\n",
+        LogRel(("Pulse: Obtained playback buffer attributes: maxlength=%d tlength=%d prebuf=%d minreq=%d\n",
             pBufAttr->maxlength, pBufAttr->tlength, pBufAttr->prebuf, pBufAttr->minreq));
     }
 
diff --git a/src/VBox/Devices/Audio/testcase/Makefile.kmk b/src/VBox/Devices/Audio/testcase/Makefile.kmk
new file mode 100644
index 0000000..e5c064b
--- /dev/null
+++ b/src/VBox/Devices/Audio/testcase/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# Sub-Makefile for the audio testcases.
+#
+
+#
+# Copyright (C) 2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+if defined(VBOX_WITH_TESTCASES) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_SDK) && defined(VBOX_WITH_PDM_AUDIO_DRIVER)
+
+ PROGRAMS += tstAudioMixBuffer
+ TESTING  += $(tstAudioMixBuffer_0_OUTDIR)/tstAudioMixBuffer.run
+
+ tstAudioMixBuffer_TEMPLATE = VBOXR3TSTEXE
+ tstAudioMixBuffer_DEFS    += TESTCASE VBOX_WITH_PDM_AUDIO_DRIVER
+ tstAudioMixBuffer_SOURCES  = \
+	tstAudioMixBuffer.cpp \
+	../AudioMixBuffer.cpp \
+	../DrvAudioCommon.cpp
+ tstAudioMixBuffer_LIBS     = $(LIB_RUNTIME)
+
+ $$(tstAudioMixBuffer_0_OUTDIR)/tstAudioMixBuffer.run: $$(tstAudioMixBuffer_1_STAGE_TARGET)
+	export VBOX_LOG_DEST=nofile; $(tstAudioMixBuffer_1_STAGE_TARGET) quiet
+	$(QUIET)$(APPEND) -t "$@" "done"
+
+endif
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp b/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
new file mode 100644
index 0000000..a47e9cb
--- /dev/null
+++ b/src/VBox/Devices/Audio/testcase/tstAudioMixBuffer.cpp
@@ -0,0 +1,592 @@
+/* $Id: tstAudioMixBuffer.cpp $ */
+/** @file
+ * Audio testcase - Mixing buffer.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/err.h>
+#include <iprt/initterm.h>
+#include <iprt/mem.h>
+#include <iprt/rand.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+
+
+#include "../AudioMixBuffer.h"
+#include "../DrvAudio.h"
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+
+static int tstSingle(RTTEST hTest)
+{
+    RTTestSubF(hTest, "Single buffer");
+
+    PDMAUDIOSTREAMCFG config =
+    {
+        44100,                   /* Hz */
+        2                        /* Channels */,
+        AUD_FMT_S16              /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+    PDMPCMPROPS props;
+
+    int rc = drvAudioStreamCfgToProps(&config, &props);
+    AssertRC(rc);
+
+    uint32_t cBufSize = _1K;
+
+    /*
+     * General stuff.
+     */
+    PDMAUDIOMIXBUF mb;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&mb, "Single", &props, cBufSize));
+    RTTESTI_CHECK(audioMixBufSize(&mb) == cBufSize);
+    RTTESTI_CHECK(AUDIOMIXBUF_B2S(&mb, audioMixBufSizeBytes(&mb)) == cBufSize);
+    RTTESTI_CHECK(AUDIOMIXBUF_S2B(&mb, audioMixBufSize(&mb)) == audioMixBufSizeBytes(&mb));
+    RTTESTI_CHECK(audioMixBufFree(&mb) == cBufSize);
+    RTTESTI_CHECK(AUDIOMIXBUF_S2B(&mb, audioMixBufFree(&mb)) == audioMixBufFreeBytes(&mb));
+
+    /*
+     * Absolute writes.
+     */
+    uint32_t read  = 0, written = 0, written_abs = 0;
+    int8_t  samples8 [2] = { 0x12, 0x34 };
+    int16_t samples16[2] = { 0xAA, 0xBB };
+    int32_t samples32[2] = { 0xCC, 0xDD };
+    int64_t samples64[2] = { 0xEE, 0xFF };
+
+    RTTESTI_CHECK_RC_OK(audioMixBufWriteAt(&mb, 0, &samples8, sizeof(samples8), &written));
+    RTTESTI_CHECK(written == 0 /* Samples */);
+
+    RTTESTI_CHECK_RC_OK(audioMixBufWriteAt(&mb, 0, &samples16, sizeof(samples16), &written));
+    RTTESTI_CHECK(written == 1 /* Samples */);
+
+    RTTESTI_CHECK_RC_OK(audioMixBufWriteAt(&mb, 2, &samples32, sizeof(samples32), &written));
+    RTTESTI_CHECK(written == 2 /* Samples */);
+    written_abs = 0;
+
+    /* Beyond buffer. */
+    RTTESTI_CHECK_RC(audioMixBufWriteAt(&mb, audioMixBufSize(&mb) + 1, &samples16, sizeof(samples16),
+                                        &written), VERR_BUFFER_OVERFLOW);
+
+    /*
+     * Circular writes.
+     */
+    uint32_t cToWrite = audioMixBufSize(&mb) - written_abs - 1; /* -1 as padding plus -2 samples for above. */
+    for (uint32_t i = 0; i < cToWrite; i++)
+    {
+        RTTESTI_CHECK_RC_OK(audioMixBufWriteCirc(&mb, &samples16, sizeof(samples16), &written));
+        RTTESTI_CHECK(written == 1);
+    }
+    RTTESTI_CHECK(!audioMixBufIsEmpty(&mb));
+    RTTESTI_CHECK(audioMixBufFree(&mb) == 1);
+    RTTESTI_CHECK(audioMixBufFreeBytes(&mb) == AUDIOMIXBUF_S2B(&mb, 1U));
+    RTTESTI_CHECK(audioMixBufProcessed(&mb) == cToWrite + written_abs /* + last absolute write */);
+
+    RTTESTI_CHECK_RC_OK(audioMixBufWriteCirc(&mb, &samples16, sizeof(samples16), &written));
+    RTTESTI_CHECK(written == 1);
+    RTTESTI_CHECK(audioMixBufFree(&mb) == 0);
+    RTTESTI_CHECK(audioMixBufFreeBytes(&mb) == AUDIOMIXBUF_S2B(&mb, 0));
+    RTTESTI_CHECK(audioMixBufProcessed(&mb) == cBufSize);
+
+    /* Circular reads. */
+    uint32_t cToRead = audioMixBufSize(&mb) - written_abs - 1;
+    for (uint32_t i = 0; i < cToWrite; i++)
+    {
+        RTTESTI_CHECK_RC_OK(audioMixBufReadCirc(&mb, &samples16, sizeof(samples16), &read));
+        RTTESTI_CHECK(read == 1);
+        audioMixBufFinish(&mb, read);
+    }
+    RTTESTI_CHECK(!audioMixBufIsEmpty(&mb));
+    RTTESTI_CHECK(audioMixBufFree(&mb) == audioMixBufSize(&mb) - written_abs - 1);
+    RTTESTI_CHECK(audioMixBufFreeBytes(&mb) == AUDIOMIXBUF_S2B(&mb, cBufSize - written_abs - 1));
+    RTTESTI_CHECK(audioMixBufProcessed(&mb) == cBufSize - cToRead + written_abs);
+
+    RTTESTI_CHECK_RC_OK(audioMixBufReadCirc(&mb, &samples16, sizeof(samples16), &read));
+    RTTESTI_CHECK(read == 1);
+    audioMixBufFinish(&mb, read);
+    RTTESTI_CHECK(audioMixBufFree(&mb) == cBufSize - written_abs);
+    RTTESTI_CHECK(audioMixBufFreeBytes(&mb) == AUDIOMIXBUF_S2B(&mb, cBufSize - written_abs));
+    RTTESTI_CHECK(audioMixBufProcessed(&mb) == written_abs);
+
+    audioMixBufDestroy(&mb);
+
+    return RTTestSubErrorCount(hTest) ? VERR_GENERAL_FAILURE : VINF_SUCCESS;
+}
+
+static int tstParentChild(RTTEST hTest)
+{
+    RTTestSubF(hTest, "2 Children -> Parent");
+
+    uint32_t cBufSize = _1K;
+
+    PDMAUDIOSTREAMCFG cfg_p =
+    {
+        44100,                   /* Hz */
+        2                        /* Channels */,
+        AUD_FMT_S16              /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+    PDMPCMPROPS props;
+
+    int rc = drvAudioStreamCfgToProps(&cfg_p, &props);
+    AssertRC(rc);
+
+    PDMAUDIOMIXBUF parent;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&parent, "Parent", &props, cBufSize));
+
+    PDMAUDIOSTREAMCFG cfg_c1 = /* Upmixing to parent */
+    {
+        22100,                   /* Hz */
+        2                        /* Channels */,
+        AUD_FMT_S16              /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+
+    rc = drvAudioStreamCfgToProps(&cfg_c1, &props);
+    AssertRC(rc);
+
+    PDMAUDIOMIXBUF child1;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&child1, "Child1", &props, cBufSize));
+    RTTESTI_CHECK_RC_OK(audioMixBufLinkTo(&child1, &parent));
+
+    PDMAUDIOSTREAMCFG cfg_c2 = /* Downmixing to parent */
+    {
+        48000,                   /* Hz */
+        2                        /* Channels */,
+        AUD_FMT_S16              /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+
+    rc = drvAudioStreamCfgToProps(&cfg_c2, &props);
+    AssertRC(rc);
+
+    PDMAUDIOMIXBUF child2;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&child2, "Child2", &props, cBufSize));
+    RTTESTI_CHECK_RC_OK(audioMixBufLinkTo(&child2, &parent));
+
+    /*
+     * Writing + mixing from child/children -> parent, sequential.
+     */
+    uint32_t cbBuf = _1K;
+    char pvBuf[_1K];
+    int16_t samples[32] = { 0xAA, 0xBB };
+    uint32_t read , written, mixed, temp;
+
+    uint32_t cChild1Free     = cBufSize;
+    uint32_t cChild1Mixed    = 0;
+    uint32_t cSamplesParent1 = 16;
+    uint32_t cSamplesChild1  = 16;
+
+    uint32_t cChild2Free     = cBufSize;
+    uint32_t cChild2Mixed    = 0;
+    uint32_t cSamplesParent2 = 16;
+    uint32_t cSamplesChild2  = 16;
+
+    uint32_t t = RTRandU32() % 64;
+
+    for (uint32_t i = 0; i < t; i++)
+    {
+        RTTestPrintf(hTest, RTTESTLVL_DEBUG, "i=%RU32\n", i);
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufWriteAt(&child1, 0, &samples, sizeof(samples), &written));
+        RTTESTI_CHECK_MSG_BREAK(written == cSamplesChild1, ("Child1: Expected %RU32 written samples, got %RU32\n", cSamplesChild1, written));
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufMixToParent(&child1, written, &mixed));
+        temp = audioMixBufProcessed(&parent) - audioMixBufMixed(&child2);
+        RTTESTI_CHECK_MSG_BREAK(audioMixBufMixed(&child1) == temp, ("Child1: Expected %RU32 mixed samples, got %RU32\n", audioMixBufMixed(&child1), temp));
+
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufWriteAt(&child2, 0, &samples, sizeof(samples), &written));
+        RTTESTI_CHECK_MSG_BREAK(written == cSamplesChild2, ("Child2: Expected %RU32 written samples, got %RU32\n", cSamplesChild2, written));
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufMixToParent(&child2, written, &mixed));
+        temp = audioMixBufProcessed(&parent) - audioMixBufMixed(&child1);
+        RTTESTI_CHECK_MSG_BREAK(audioMixBufMixed(&child2) == temp, ("Child2: Expected %RU32 mixed samples, got %RU32\n", audioMixBufMixed(&child2), temp));
+    }
+
+    RTTESTI_CHECK(audioMixBufProcessed(&parent) == audioMixBufMixed(&child1) + audioMixBufMixed(&child2));
+
+    for (;;)
+    {
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufReadCirc(&parent, pvBuf, cbBuf, &read));
+        if (!read)
+            break;
+        audioMixBufFinish(&parent, read);
+    }
+
+    RTTESTI_CHECK(audioMixBufProcessed(&parent) == 0);
+    RTTESTI_CHECK(audioMixBufMixed(&child1) == 0);
+    RTTESTI_CHECK(audioMixBufMixed(&child2) == 0);
+
+    audioMixBufDestroy(&parent);
+    audioMixBufDestroy(&child1);
+    audioMixBufDestroy(&child2);
+
+    return RTTestSubErrorCount(hTest) ? VERR_GENERAL_FAILURE : VINF_SUCCESS;
+}
+
+/* Test 8-bit sample conversion (8-bit -> internal -> 8-bit). */
+static int tstConversion8(RTTEST hTest)
+{
+    unsigned        i;
+    uint32_t        cBufSize = 256;
+    PDMPCMPROPS     props;
+
+
+    RTTestSubF(hTest, "Sample conversion");
+
+    PDMAUDIOSTREAMCFG cfg_p =
+    {
+        44100,                   /* Hz */
+        1                        /* Channels */,
+        AUD_FMT_U8               /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+
+    int rc = drvAudioStreamCfgToProps(&cfg_p, &props);
+    AssertRC(rc);
+
+    PDMAUDIOMIXBUF parent;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&parent, "Parent", &props, cBufSize));
+
+    /* Child uses half the sample rate; that ensures the mixing engine can't
+     * take shortcuts and performs conversion. Because conversion to double
+     * the sample rate effectively inserts one additional sample between every
+     * two source samples, N source samples will be converted to N * 2 - 1
+     * samples. However, the last source sample will be saved for later
+     * interpolation and not immediately output.
+     */
+    PDMAUDIOSTREAMCFG cfg_c =   /* Upmixing to parent */
+    {
+        22050,                   /* Hz */
+        1                        /* Channels */,
+        AUD_FMT_U8               /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+
+    rc = drvAudioStreamCfgToProps(&cfg_c, &props);
+    AssertRC(rc);
+
+    PDMAUDIOMIXBUF child;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&child, "Child", &props, cBufSize));
+    RTTESTI_CHECK_RC_OK(audioMixBufLinkTo(&child, &parent));
+
+    /* 8-bit unsigned samples. Often used with SB16 device. */
+    uint8_t     samples[16]  = { 0xAA, 0xBB, 0, 1, 43, 125, 126, 127,
+                                 128, 129, 130, 131, 132, UINT8_MAX - 1, UINT8_MAX, 0 };
+
+    /*
+     * Writing + mixing from child -> parent, sequential.
+     */
+    uint32_t    cbBuf = 256;
+    char        achBuf[256];
+    uint32_t    read, written, mixed, temp;
+
+    uint32_t cChildFree     = cBufSize;
+    uint32_t cChildMixed    = 0;
+    uint32_t cSamplesChild  = 16;
+    uint32_t cSamplesParent = cSamplesChild * 2 - 2;
+    uint32_t cSamplesRead   = 0;
+
+    /**** 8-bit unsigned samples ****/
+    RTTestPrintf(hTest, RTTESTLVL_DEBUG, "Conversion test %uHz %uch 8-bit\n", cfg_c.uHz, cfg_c.cChannels);
+    RTTESTI_CHECK_RC_OK(audioMixBufWriteAt(&child, 0, &samples, sizeof(samples), &written));
+    RTTESTI_CHECK_MSG(written == cSamplesChild, ("Child: Expected %RU32 written samples, got %RU32\n", cSamplesChild, written));
+    RTTESTI_CHECK_RC_OK(audioMixBufMixToParent(&child, written, &mixed));
+    temp = audioMixBufProcessed(&parent);
+    RTTESTI_CHECK_MSG(audioMixBufMixed(&child) == temp, ("Child: Expected %RU32 mixed samples, got %RU32\n", audioMixBufMixed(&child), temp));
+
+    RTTESTI_CHECK(audioMixBufProcessed(&parent) == audioMixBufMixed(&child));
+
+    for (;;)
+    {
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufReadCirc(&parent, achBuf, cbBuf, &read));
+        if (!read)
+            break;
+        cSamplesRead += read;
+        audioMixBufFinish(&parent, read);
+    }
+    RTTESTI_CHECK_MSG(cSamplesRead == cSamplesParent, ("Parent: Expected %RU32 mixed samples, got %RU32\n", cSamplesParent, cSamplesRead));
+
+    /* Check that the samples came out unharmed. Every other sample is interpolated and we ignore it. */
+    /* NB: This also checks that the default volume setting is 0dB attenuation. */
+    uint8_t *pSrc8 = &samples[0];
+    uint8_t *pDst8 = (uint8_t *)achBuf;
+
+    for (i = 0; i < cSamplesChild - 1; ++i)
+    {
+        RTTESTI_CHECK_MSG(*pSrc8 == *pDst8, ("index %u: Dst=%d, Src=%d\n", i, *pDst8, *pSrc8));
+        pSrc8 += 1;
+        pDst8 += 2;
+    }
+
+    RTTESTI_CHECK(audioMixBufProcessed(&parent) == 0);
+    RTTESTI_CHECK(audioMixBufMixed(&child) == 0);
+
+    audioMixBufDestroy(&parent);
+    audioMixBufDestroy(&child);
+
+    return RTTestSubErrorCount(hTest) ? VERR_GENERAL_FAILURE : VINF_SUCCESS;
+}
+
+/* Test 16-bit sample conversion (16-bit -> internal -> 16-bit). */
+static int tstConversion16(RTTEST hTest)
+{
+    unsigned        i;
+    uint32_t        cBufSize = 256;
+    PDMPCMPROPS     props;
+
+
+    RTTestSubF(hTest, "Sample conversion 16-bit");
+
+    PDMAUDIOSTREAMCFG cfg_p =
+    {
+        44100,                   /* Hz */
+        1                        /* Channels */,
+        AUD_FMT_S16              /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+
+    int rc = drvAudioStreamCfgToProps(&cfg_p, &props);
+    AssertRC(rc);
+
+    PDMAUDIOMIXBUF parent;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&parent, "Parent", &props, cBufSize));
+
+    PDMAUDIOSTREAMCFG cfg_c =   /* Upmixing to parent */
+    {
+        22050,                   /* Hz */
+        1                        /* Channels */,
+        AUD_FMT_S16              /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+
+    rc = drvAudioStreamCfgToProps(&cfg_c, &props);
+    AssertRC(rc);
+
+    PDMAUDIOMIXBUF child;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&child, "Child", &props, cBufSize));
+    RTTESTI_CHECK_RC_OK(audioMixBufLinkTo(&child, &parent));
+
+    /* 16-bit signed. More or less exclusively used as output, and usually as input, too. */
+    int16_t     samples[16] = { 0xAA, 0xBB, INT16_MIN, INT16_MIN + 1, INT16_MIN / 2, -3, -2, -1,
+                                0, 1, 2, 3, INT16_MAX / 2, INT16_MAX - 1, INT16_MAX, 0 };
+
+    /*
+     * Writing + mixing from child -> parent, sequential.
+     */
+    uint32_t    cbBuf = 256;
+    char        achBuf[256];
+    uint32_t    read, written, mixed, temp;
+
+    uint32_t cChildFree     = cBufSize;
+    uint32_t cChildMixed    = 0;
+    uint32_t cSamplesChild  = 16;
+    uint32_t cSamplesParent = cSamplesChild * 2 - 2;
+    uint32_t cSamplesRead   = 0;
+
+    /**** 16-bit signed samples ****/
+    RTTestPrintf(hTest, RTTESTLVL_DEBUG, "Conversion test %uHz %uch 16-bit\n", cfg_c.uHz, cfg_c.cChannels);
+    RTTESTI_CHECK_RC_OK(audioMixBufWriteAt(&child, 0, &samples, sizeof(samples), &written));
+    RTTESTI_CHECK_MSG(written == cSamplesChild, ("Child: Expected %RU32 written samples, got %RU32\n", cSamplesChild, written));
+    RTTESTI_CHECK_RC_OK(audioMixBufMixToParent(&child, written, &mixed));
+    temp = audioMixBufProcessed(&parent);
+    RTTESTI_CHECK_MSG(audioMixBufMixed(&child) == temp, ("Child: Expected %RU32 mixed samples, got %RU32\n", audioMixBufMixed(&child), temp));
+
+    RTTESTI_CHECK(audioMixBufProcessed(&parent) == audioMixBufMixed(&child));
+
+    for (;;)
+    {
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufReadCirc(&parent, achBuf, cbBuf, &read));
+        if (!read)
+            break;
+        cSamplesRead += read;
+        audioMixBufFinish(&parent, read);
+    }
+    RTTESTI_CHECK_MSG(cSamplesRead == cSamplesParent, ("Parent: Expected %RU32 mixed samples, got %RU32\n", cSamplesParent, cSamplesRead));
+
+    /* Check that the samples came out unharmed. Every other sample is interpolated and we ignore it. */
+    /* NB: This also checks that the default volume setting is 0dB attenuation. */
+    int16_t *pSrc16 = &samples[0];
+    int16_t *pDst16 = (int16_t *)achBuf;
+
+    for (i = 0; i < cSamplesChild - 1; ++i)
+    {
+        RTTESTI_CHECK_MSG(*pSrc16 == *pDst16, ("index %u: Dst=%d, Src=%d\n", i, *pDst16, *pSrc16));
+        pSrc16 += 1;
+        pDst16 += 2;
+    }
+
+    RTTESTI_CHECK(audioMixBufProcessed(&parent) == 0);
+    RTTESTI_CHECK(audioMixBufMixed(&child) == 0);
+    
+    audioMixBufDestroy(&parent);
+    audioMixBufDestroy(&child);
+
+    return RTTestSubErrorCount(hTest) ? VERR_GENERAL_FAILURE : VINF_SUCCESS;
+}
+
+/* Test volume control. */
+static int tstVolume(RTTEST hTest)
+{
+    unsigned        i;
+    uint32_t        cBufSize = 256;
+    PDMPCMPROPS     props;
+
+
+    RTTestSubF(hTest, "Volume control");
+
+    /* Same for parent/child. */
+    PDMAUDIOSTREAMCFG cfg =
+    {
+        44100,                   /* Hz */
+        2                        /* Channels */,
+        AUD_FMT_S16              /* Format */,
+        PDMAUDIOENDIANNESS_LITTLE /* ENDIANNESS */
+    };
+
+    int rc = drvAudioStreamCfgToProps(&cfg, &props);
+    AssertRC(rc);
+
+    PDMAUDIOVOLUME vol = { false, 0, 0 };   /* Not muted. */
+    PDMAUDIOMIXBUF parent;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&parent, "Parent", &props, cBufSize));
+
+    PDMAUDIOMIXBUF child;
+    RTTESTI_CHECK_RC_OK(audioMixBufInit(&child, "Child", &props, cBufSize));
+    RTTESTI_CHECK_RC_OK(audioMixBufLinkTo(&child, &parent));
+
+    /* A few 16-bit signed samples. */
+    int16_t     samples[16] = { INT16_MIN, INT16_MIN + 1, -128, -64, -4, -1, 0, 1,
+                                2, 255, 256, INT16_MAX / 2, INT16_MAX - 2, INT16_MAX - 1, INT16_MAX, 0 };
+
+    /*
+     * Writing + mixing from child -> parent.
+     */
+    uint32_t    cbBuf = 256;
+    char        achBuf[256];
+    uint32_t    read, written, mixed;
+
+    uint32_t cChildFree     = cBufSize;
+    uint32_t cChildMixed    = 0;
+    uint32_t cSamplesChild  = 8;
+    uint32_t cSamplesParent = cSamplesChild;
+    uint32_t cSamplesRead;
+    int16_t *pSrc16;
+    int16_t *pDst16;
+
+    /**** Volume control test ****/
+    RTTestPrintf(hTest, RTTESTLVL_DEBUG, "Volume control test %uHz %uch \n", cfg.uHz, cfg.cChannels);
+
+    /* 1) Full volume/0dB attenuation (255). */
+    vol.uLeft = vol.uRight = 255;
+    audioMixBufSetVolume(&child, &vol);
+
+    RTTESTI_CHECK_RC_OK(audioMixBufWriteAt(&child, 0, &samples, sizeof(samples), &written));
+    RTTESTI_CHECK_MSG(written == cSamplesChild, ("Child: Expected %RU32 written samples, got %RU32\n", cSamplesChild, written));
+    RTTESTI_CHECK_RC_OK(audioMixBufMixToParent(&child, written, &mixed));
+
+    cSamplesRead = 0;
+    for (;;)
+    {
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufReadCirc(&parent, achBuf, cbBuf, &read));
+        if (!read)
+            break;
+        cSamplesRead += read;
+        audioMixBufFinish(&parent, read);
+    }
+    RTTESTI_CHECK_MSG(cSamplesRead == cSamplesParent, ("Parent: Expected %RU32 mixed samples, got %RU32\n", cSamplesParent, cSamplesRead));
+
+    /* Check that at 0dB the samples came out unharmed. */
+    pSrc16 = &samples[0];
+    pDst16 = (int16_t *)achBuf;
+
+    for (i = 0; i < cSamplesParent * 2 /* stereo */; ++i)
+    {
+        RTTESTI_CHECK_MSG(*pSrc16 == *pDst16, ("index %u: Dst=%d, Src=%d\n", i, *pDst16, *pSrc16));
+        ++pSrc16;
+        ++pDst16;
+    }
+    audioMixBufReset(&child);
+
+    /* 2) Half volume/-6dB attenuation (16 steps down). */
+    vol.uLeft = vol.uRight = 255 - 16;
+    audioMixBufSetVolume(&child, &vol);
+
+    RTTESTI_CHECK_RC_OK(audioMixBufWriteAt(&child, 0, &samples, sizeof(samples), &written));
+    RTTESTI_CHECK_MSG(written == cSamplesChild, ("Child: Expected %RU32 written samples, got %RU32\n", cSamplesChild, written));
+    RTTESTI_CHECK_RC_OK(audioMixBufMixToParent(&child, written, &mixed));
+
+    cSamplesRead = 0;
+    for (;;)
+    {
+        RTTESTI_CHECK_RC_OK_BREAK(audioMixBufReadCirc(&parent, achBuf, cbBuf, &read));
+        if (!read)
+            break;
+        cSamplesRead += read;
+        audioMixBufFinish(&parent, read);
+    }
+    RTTESTI_CHECK_MSG(cSamplesRead == cSamplesParent, ("Parent: Expected %RU32 mixed samples, got %RU32\n", cSamplesParent, cSamplesRead));
+
+    /* Check that at -6dB the sample values are halved. */
+    pSrc16 = &samples[0];
+    pDst16 = (int16_t *)achBuf;
+
+    for (i = 0; i < cSamplesParent * 2 /* stereo */; ++i)
+    {
+        /* Watch out! For negative values, x >> 1 is not the same as x / 2. */
+        RTTESTI_CHECK_MSG(*pSrc16 >> 1 == *pDst16, ("index %u: Dst=%d, Src=%d\n", i, *pDst16, *pSrc16));
+        ++pSrc16;
+        ++pDst16;
+    }
+
+    audioMixBufDestroy(&parent);
+    audioMixBufDestroy(&child);
+
+    return RTTestSubErrorCount(hTest) ? VERR_GENERAL_FAILURE : VINF_SUCCESS;
+}
+
+int main(int argc, char **argv)
+{
+    RTR3InitExe(argc, &argv, 0);
+
+    /*
+     * Initialize IPRT and create the test.
+     */
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("tstAudioMixBuffer", &hTest);
+    if (rc)
+        return rc;
+    RTTestBanner(hTest);
+
+    rc = tstSingle(hTest);
+    if (RT_SUCCESS(rc))
+        rc = tstParentChild(hTest);
+    if (RT_SUCCESS(rc))
+        rc = tstConversion8(hTest);
+    if (RT_SUCCESS(rc))
+        rc = tstConversion16(hTest);
+    if (RT_SUCCESS(rc))
+        rc = tstVolume(hTest);
+
+    /*
+     * Summary
+     */
+    return RTTestSummaryAndDestroy(hTest);
+}
diff --git a/src/VBox/Devices/BiosCommonCode/MakeAlternativeSource.cpp b/src/VBox/Devices/BiosCommonCode/MakeAlternativeSource.cpp
index 497009f..952fbf5 100644
--- a/src/VBox/Devices/BiosCommonCode/MakeAlternativeSource.cpp
+++ b/src/VBox/Devices/BiosCommonCode/MakeAlternativeSource.cpp
@@ -970,40 +970,17 @@ static bool disCode(uint32_t uFlatAddr, uint32_t cb, bool fIs16Bit)
         }
         /* Work arounds for switch tables and such (disas assertions). */
         else if (    0
-#if 0
-                 || (   pb[0] == 0x11   /* int13_cdemu switch */
-                     && pb[1] == 0xda
-                     && pb[2] == 0x05
-                     && pb[3] == 0xff
-                     && pb[4] == 0xff
-                    )
-#endif
-                 || (   pb[0] == 0xb0
-                     && pb[1] == 0x58
-                     && pb[2] == 0xc8
-                     && pb[3] == 0x58
-                     && pb[4] == 0xc8
-                     && pb[5] == 0x58
-                    )
-                 || (   pb[0] == 0x50
+                 || (   pb[0] == 0x50   /* int13_cdemu switch */
                      && pb[1] == 0x4e
                      && pb[2] == 0x49
                      && pb[3] == 0x48
                      && pb[4] == 0x47
-                     && pb[5] == 0x46
                     )
-                 || (   pb[0] == 0x29
-                     && pb[1] == 0x65
-                     && pb[2] == 0x4b
-                     && pb[3] == 0x65
-                     && pb[4] == 0x6e
-                     && pb[5] == 0x65
-                    )
-                 || (   pb[0] == 0xff   /* _pci16_function switch */
-                     && pb[1] == 0x91
-                     && pb[2] == 0x19
+                 || (   pb[0] == 0x67   /* _pci16_function switch */
+                     && pb[1] == 0x92
+                     && pb[2] == 0x81
                      && pb[3] == 0x92
-                     && pb[4] == 0x2c
+                     && pb[4] == 0x94
                      && pb[5] == 0x92
                      )
                  || (   pb[0] == 0xa3   /* _int1a_function switch */
@@ -1025,25 +1002,19 @@ static bool disCode(uint32_t uFlatAddr, uint32_t cb, bool fIs16Bit)
                      && pb[2] == 0x8d
                      && pb[3] == 0xbb
                      && pb[4] == 0x8c
-                     && pb[5] == 0x2f
-                     )
-                 || (   pb[0] == 0xec   /* _int15_function switch */
+                     && pb[5] == 0x2f)
+                 || (   pb[0] == 0xec  /* _int15_function switch */
                      && pb[1] == 0xe9
                      && pb[2] == 0xd8
                      && pb[3] == 0xc1
                      && pb[4] == 0xc0
-                     && pb[5] == 0xbf
-                     && pb[6] == 0x91
-                    )
-                 || (   pb[0] == 0x00
-                     && pb[1] == 0xe0
-                     && pb[2] == 0x94
-                     && pb[3] == 0xe2
-                     && pb[4] == 0x94
-                     && pb[5] == 0xe6
-                     && pb[6] == 0x94
-                     && pb[7] == 0xe6
-                    )
+                     && pb[5] == 0xbf)
+                 || (   pb[0] == 0x21   /* _int15_function32 switch */
+                     && pb[1] == 0x66
+                     && pb[2] == 0x43
+                     && pb[3] == 0x66
+                     && pb[4] == 0x66
+                     && pb[5] == 0x66)
                  || 0
                  )
             return disByteData(uFlatAddr, cb);
diff --git a/src/VBox/Devices/BiosCommonCode/Makefile.kmk b/src/VBox/Devices/BiosCommonCode/Makefile.kmk
index 6f49d58..514580b 100644
--- a/src/VBox/Devices/BiosCommonCode/Makefile.kmk
+++ b/src/VBox/Devices/BiosCommonCode/Makefile.kmk
@@ -26,7 +26,7 @@ MakeAlternativeSource_TEMPLATE = VBoxAdvBldProg
 MakeAlternativeSource_DEFS     = IN_DIS
 MakeAlternativeSource_SOURCES  = MakeAlternativeSource.cpp
 MakeAlternativeSource_LIBS     = \
-	$(PATH_STAGE_LIB)/DisasmBldProg$(VBOX_SUFF_LIB)
+	$(PATH_STAGE_LIB)/DisasmBldProg$(VBOX_HOSTSUFF_LIB)
 
 
 include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/Devices/Bus/DevPCI.cpp b/src/VBox/Devices/Bus/DevPCI.cpp
index 5b16ec1..d038295 100644
--- a/src/VBox/Devices/Bus/DevPCI.cpp
+++ b/src/VBox/Devices/Bus/DevPCI.cpp
@@ -1497,7 +1497,7 @@ static DECLCALLBACK(int) pciR3CommonLoadExec(PPCIBUS pBus, PSSMHANDLE pSSM, uint
         {
             if (pBus->devices[i])
             {
-                LogRel(("New device in slot %#x, %s (vendor=%#06x device=%#06x)\n", i, pBus->devices[i]->name,
+                LogRel(("PCI: New device in slot %#x, %s (vendor=%#06x device=%#06x)\n", i, pBus->devices[i]->name,
                         PCIDevGetVendorId(pBus->devices[i]), PCIDevGetDeviceId(pBus->devices[i])));
                 if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
                     return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("New device in slot %#x, %s (vendor=%#06x device=%#06x)"),
@@ -1527,7 +1527,7 @@ static DECLCALLBACK(int) pciR3CommonLoadExec(PPCIBUS pBus, PSSMHANDLE pSSM, uint
         pDev = pBus->devices[i];
         if (!pDev)
         {
-            LogRel(("Device in slot %#x has been removed! vendor=%#06x device=%#06x\n", i,
+            LogRel(("PCI: Device in slot %#x has been removed! vendor=%#06x device=%#06x\n", i,
                     PCIDevGetVendorId(&DevTmp), PCIDevGetDeviceId(&DevTmp)));
             if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
                 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device in slot %#x has been removed! vendor=%#06x device=%#06x"),
diff --git a/src/VBox/Devices/Bus/DevPciIch9.cpp b/src/VBox/Devices/Bus/DevPciIch9.cpp
index cb0e947..28dfa7d 100644
--- a/src/VBox/Devices/Bus/DevPciIch9.cpp
+++ b/src/VBox/Devices/Bus/DevPciIch9.cpp
@@ -99,7 +99,7 @@ typedef struct
     uint32_t            Alignment0;
 #endif
 
-     /** Config register. */
+    /** Value latched in Configuration Address Port (0CF8h) */
     uint32_t            uConfigReg;
 
     /** I/O APIC irq levels */
@@ -123,6 +123,9 @@ typedef struct
 } ICH9PCIGLOBALS, *PICH9PCIGLOBALS;
 
 
+/**
+ * PCI configuration space address.
+ */
 typedef struct
 {
     uint8_t  iBus;
@@ -229,18 +232,22 @@ PDMBOTHCBDECL(void) ich9pcibridgeSetIrq(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev,
     ich9pciSetIrqInternal(PCIROOTBUS_2_PCIGLOBALS(pBus), uDevFnBridge, pPciDev, iIrqPinBridge, iLevel, uTagSrc);
 }
 
+
 /**
  * Port I/O Handler for PCI address OUT operations.
  *
+ * Emulates writes to Configuration Address Port at 0CF8h for
+ * Configuration Mechanism #1.
+ *
  * @returns VBox status code.
  *
- * @param   pDevIns     The device instance.
+ * @param   pDevIns     ICH9 device instance.
  * @param   pvUser      User argument - ignored.
  * @param   uPort       Port number used for the OUT operation.
  * @param   u32         The value to output.
  * @param   cb          The value size in bytes.
  */
-PDMBOTHCBDECL(int)  ich9pciIOPortAddressWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
+PDMBOTHCBDECL(int) ich9pciIOPortAddressWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
 {
     LogFlow(("ich9pciIOPortAddressWrite: Port=%#x u32=%#x cb=%d\n", Port, u32, cb));
     NOREF(pvUser);
@@ -248,49 +255,67 @@ PDMBOTHCBDECL(int)  ich9pciIOPortAddressWrite(PPDMDEVINS pDevIns, void *pvUser,
     {
         PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
 
+        /*
+         * bits [1:0] are hard-wired, read-only and must return zeroes
+         * when read.
+         */
+        u32 &= ~3;
+
         PCI_LOCK(pDevIns, VINF_IOM_R3_IOPORT_WRITE);
-        pThis->uConfigReg = u32 & ~3; /* Bits 0-1 are reserved and we silently clear them */
+        pThis->uConfigReg = u32;
         PCI_UNLOCK(pDevIns);
     }
 
     return VINF_SUCCESS;
 }
 
+
 /**
  * Port I/O Handler for PCI address IN operations.
  *
+ * Emulates reads from Configuration Address Port at 0CF8h for
+ * Configuration Mechanism #1.
+ *
  * @returns VBox status code.
  *
- * @param   pDevIns     The device instance.
+ * @param   pDevIns     ICH9 device instance.
  * @param   pvUser      User argument - ignored.
  * @param   uPort       Port number used for the IN operation.
  * @param   pu32        Where to store the result.
  * @param   cb          Number of bytes read.
  */
-PDMBOTHCBDECL(int)  ich9pciIOPortAddressRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
+PDMBOTHCBDECL(int) ich9pciIOPortAddressRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
 {
     NOREF(pvUser);
     if (cb == 4)
     {
         PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
+
         PCI_LOCK(pDevIns, VINF_IOM_R3_IOPORT_READ);
         *pu32 = pThis->uConfigReg;
         PCI_UNLOCK(pDevIns);
+
         LogFlow(("ich9pciIOPortAddressRead: Port=%#x cb=%d -> %#x\n", Port, cb, *pu32));
         return VINF_SUCCESS;
     }
 
     Log(("ich9pciIOPortAddressRead: Port=%#x cb=%d VERR_IOM_IOPORT_UNUSED\n", Port, cb));
-
     return VERR_IOM_IOPORT_UNUSED;
 }
 
+
+/*
+ * Perform configuration space write.
+ */
 static int ich9pciDataWriteAddr(PICH9PCIGLOBALS pGlobals, PciAddress* pAddr,
                                 uint32_t val, int cb, int rcReschedule)
 {
     int rc = VINF_SUCCESS;
+#ifdef IN_RING3
+    NOREF(rcReschedule);
+#endif
 
-    if (pAddr->iBus != 0)
+    if (pAddr->iBus != 0)       /* forward to subordinate bus */
     {
         if (pGlobals->aPciBus.cBridges)
         {
@@ -302,22 +327,17 @@ static int ich9pciDataWriteAddr(PICH9PCIGLOBALS pGlobals, PciAddress* pAddr,
                 pBridgeDevice->Int.s.pfnBridgeConfigWrite(pBridgeDevice->pDevIns, pAddr->iBus, pAddr->iDeviceFunc,
                                                           pAddr->iRegister, val, cb);
             }
-            else
-            {
-                // do nothing, bridge not found
-            }
-            NOREF(rcReschedule);
 #else
             rc = rcReschedule;
 #endif
         }
     }
-    else
+    else                    /* forward to directly connected device */
     {
-        if (pGlobals->aPciBus.apDevices[pAddr->iDeviceFunc])
+        R3PTRTYPE(PCIDevice *) aDev = pGlobals->aPciBus.apDevices[pAddr->iDeviceFunc];
+        if (aDev)
         {
 #ifdef IN_RING3
-            R3PTRTYPE(PCIDevice *) aDev = pGlobals->aPciBus.apDevices[pAddr->iDeviceFunc];
             aDev->Int.s.pfnConfigWrite(aDev, pAddr->iRegister, val, cb);
 #else
             rc = rcReschedule;
@@ -328,54 +348,60 @@ static int ich9pciDataWriteAddr(PICH9PCIGLOBALS pGlobals, PciAddress* pAddr,
     Log2(("ich9pciDataWriteAddr: %02x:%02x:%02x reg %x(%d) %x %Rrc\n",
           pAddr->iBus, pAddr->iDeviceFunc >> 3, pAddr->iDeviceFunc & 0x7, pAddr->iRegister,
           cb, val, rc));
-
     return rc;
 }
 
+
+/*
+ * Decode value latched in Configuration Address Port and perform
+ * requsted write to the target configuration space register.
+ *
+ * XXX: This code should be probably moved to its only caller
+ * (ich9pciIOPortDataWrite) to avoid prolifiration of confusingly
+ * similarly named functions.
+ */
 static int ich9pciDataWrite(PICH9PCIGLOBALS pGlobals, uint32_t addr, uint32_t val, int len)
 {
-    PciAddress aPciAddr;
-
     LogFlow(("ich9pciDataWrite: config=%08x val=%08x len=%d\n", pGlobals->uConfigReg, val, len));
 
+    /* Configuration space mapping enabled? */
     if (!(pGlobals->uConfigReg & (1 << 31)))
         return VINF_SUCCESS;
 
-    if ((pGlobals->uConfigReg & 0x3) != 0)
-        return VINF_SUCCESS;
-
-    /* Compute destination device */
+    /* Decode target device and configuration space register */
+    PciAddress aPciAddr;
     ich9pciStateToPciAddr(pGlobals, addr, &aPciAddr);
 
+    /* Perform configuration space write */
     return ich9pciDataWriteAddr(pGlobals, &aPciAddr, val, len, VINF_IOM_R3_IOPORT_WRITE);
 }
 
-static void ich9pciNoMem(void* ptr, int cb)
-{
-    for (int i = 0; i < cb; i++)
-        ((uint8_t*)ptr)[i] = 0xff;
-}
 
 /**
  * Port I/O Handler for PCI data OUT operations.
  *
+ * Emulates writes to Configuration Data Port at 0CFCh for
+ * Configuration Mechanism #1.
+ *
  * @returns VBox status code.
  *
- * @param   pDevIns     The device instance.
+ * @param   pDevIns     ICH9 device instance.
  * @param   pvUser      User argument - ignored.
  * @param   uPort       Port number used for the OUT operation.
  * @param   u32         The value to output.
  * @param   cb          The value size in bytes.
  */
-PDMBOTHCBDECL(int)  ich9pciIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
+PDMBOTHCBDECL(int) ich9pciIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb)
 {
     LogFlow(("ich9pciIOPortDataWrite: Port=%#x u32=%#x cb=%d\n", Port, u32, cb));
     NOREF(pvUser);
     int rc = VINF_SUCCESS;
     if (!(Port % cb))
     {
+        PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
+
         PCI_LOCK(pDevIns, VINF_IOM_R3_IOPORT_WRITE);
-        rc = ich9pciDataWrite(PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS), Port, u32, cb);
+        rc = ich9pciDataWrite(pThis, Port, u32, cb);
         PCI_UNLOCK(pDevIns);
     }
     else
@@ -383,12 +409,26 @@ PDMBOTHCBDECL(int)  ich9pciIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTI
     return rc;
 }
 
+
+static void ich9pciNoMem(void* ptr, int cb)
+{
+    for (int i = 0; i < cb; i++)
+        ((uint8_t*)ptr)[i] = 0xff;
+}
+
+
+/*
+ * Perform configuration space read.
+ */
 static int ich9pciDataReadAddr(PICH9PCIGLOBALS pGlobals, PciAddress* pPciAddr, int cb,
                                uint32_t *pu32, int rcReschedule)
 {
     int rc = VINF_SUCCESS;
+#ifdef IN_RING3
+    NOREF(rcReschedule);
+#endif
 
-    if (pPciAddr->iBus != 0)
+    if (pPciAddr->iBus != 0)    /* forward to subordinate bus */
     {
         if (pGlobals->aPciBus.cBridges)
         {
@@ -401,19 +441,19 @@ static int ich9pciDataReadAddr(PICH9PCIGLOBALS pGlobals, PciAddress* pPciAddr, i
             }
             else
                 ich9pciNoMem(pu32, cb);
-            NOREF(rcReschedule);
 #else
             rc = rcReschedule;
 #endif
-        } else
+        }
+        else
             ich9pciNoMem(pu32, cb);
     }
-    else
+    else                    /* forward to directly connected device */
     {
-        if (pGlobals->aPciBus.apDevices[pPciAddr->iDeviceFunc])
+        R3PTRTYPE(PCIDevice *) aDev = pGlobals->aPciBus.apDevices[pPciAddr->iDeviceFunc];
+        if (aDev)
         {
 #ifdef IN_RING3
-            R3PTRTYPE(PCIDevice *) aDev = pGlobals->aPciBus.apDevices[pPciAddr->iDeviceFunc];
             *pu32 = aDev->Int.s.pfnConfigRead(aDev, pPciAddr->iRegister, cb);
 #else
             rc = rcReschedule;
@@ -426,49 +466,62 @@ static int ich9pciDataReadAddr(PICH9PCIGLOBALS pGlobals, PciAddress* pPciAddr, i
     Log3(("ich9pciDataReadAddr: %02x:%02x:%02x reg %x(%d) gave %x %Rrc\n",
           pPciAddr->iBus, pPciAddr->iDeviceFunc >> 3, pPciAddr->iDeviceFunc & 0x7, pPciAddr->iRegister,
           cb, *pu32, rc));
-
     return rc;
 }
 
+
+/*
+ * Decode value latched in Configuration Address Port and perform
+ * requsted read from the target configuration space register.
+ *
+ * XXX: This code should be probably moved to its only caller
+ * (ich9pciIOPortDataRead) to avoid prolifiration of confusingly
+ * similarly named functions.
+ */
 static int ich9pciDataRead(PICH9PCIGLOBALS pGlobals, uint32_t addr, int cb, uint32_t *pu32)
 {
-    PciAddress aPciAddr;
-
     LogFlow(("ich9pciDataRead: config=%x cb=%d\n",  pGlobals->uConfigReg, cb));
 
     *pu32 = 0xffffffff;
 
+    /* Configuration space mapping enabled? */
     if (!(pGlobals->uConfigReg & (1 << 31)))
         return VINF_SUCCESS;
 
-    if ((pGlobals->uConfigReg & 0x3) != 0)
-        return VINF_SUCCESS;
-
-    /* Compute destination device */
+    /* Decode target device and configuration space register */
+    PciAddress aPciAddr;
     ich9pciStateToPciAddr(pGlobals, addr, &aPciAddr);
 
+    /* Perform configuration space read */
     return ich9pciDataReadAddr(pGlobals, &aPciAddr, cb, pu32, VINF_IOM_R3_IOPORT_READ);
 }
 
+
 /**
  * Port I/O Handler for PCI data IN operations.
  *
+ * Emulates reads from Configuration Data Port at 0CFCh for
+ * Configuration Mechanism #1.
+ *
  * @returns VBox status code.
  *
- * @param   pDevIns     The device instance.
+ * @param   pDevIns     ICH9 device instance.
  * @param   pvUser      User argument - ignored.
  * @param   uPort       Port number used for the IN operation.
  * @param   pu32        Where to store the result.
  * @param   cb          Number of bytes read.
  */
-PDMBOTHCBDECL(int)  ich9pciIOPortDataRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
+PDMBOTHCBDECL(int) ich9pciIOPortDataRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
 {
     NOREF(pvUser);
     if (!(Port % cb))
     {
+        PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
+
         PCI_LOCK(pDevIns, VINF_IOM_R3_IOPORT_READ);
-        int rc = ich9pciDataRead(PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS), Port, cb, pu32);
+        int rc = ich9pciDataRead(pThis, Port, cb, pu32);
         PCI_UNLOCK(pDevIns);
+
         LogFlow(("ich9pciIOPortDataRead: Port=%#x cb=%#x -> %#x (%Rrc)\n", Port, cb, *pu32, rc));
         return rc;
     }
@@ -476,6 +529,7 @@ PDMBOTHCBDECL(int)  ich9pciIOPortDataRead(PPDMDEVINS pDevIns, void *pvUser, RTIO
     return VERR_IOM_IOPORT_UNUSED;
 }
 
+
 /* Compute mapping of PCI slot and IRQ number to APIC interrupt line */
 DECLINLINE(int) ich9pciSlot2ApicIrq(uint8_t uSlot, int irq_num)
 {
@@ -553,22 +607,25 @@ static void ich9pciApicSetIrq(PICH9PCIBUS pBus, uint8_t uDevFn, PCIDevice *pPciD
 static void ich9pciSetIrqInternal(PICH9PCIGLOBALS pGlobals, uint8_t uDevFn, PPCIDEVICE pPciDev,
                                   int iIrq, int iLevel, uint32_t uTagSrc)
 {
-
-    if (PCIDevIsIntxDisabled(pPciDev))
+    /* If MSI or MSI-X is enabled, PCI INTx# signals are disabled regardless of the PCI command
+     * register interrupt bit state.
+     * PCI 3.0 (section 6.8) forbids MSI and MSI-X to be enabled at the same time and makes
+     * that undefined behavior. We check for MSI first, then MSI-X.
+     */
+    if (MsiIsEnabled(pPciDev))
     {
-        if (MsiIsEnabled(pPciDev))
-        {
-            LogFlowFunc(("PCI Dev %p : MSI\n", pPciDev));
-            PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
-            MsiNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);
-        }
+        Assert(!MsixIsEnabled(pPciDev));    /* Not allowed -- see note above. */
+        LogFlowFunc(("PCI Dev %p : MSI\n", pPciDev));
+        PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
+        MsiNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);
+        return;
+    }
 
-        if (MsixIsEnabled(pPciDev))
-        {
-            LogFlowFunc(("PCI Dev %p : MSI-X\n", pPciDev));
-            PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
-            MsixNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);
-        }
+    if (MsixIsEnabled(pPciDev))
+    {
+        LogFlowFunc(("PCI Dev %p : MSI-X\n", pPciDev));
+        PPDMDEVINS pDevIns = pGlobals->aPciBus.CTX_SUFF(pDevIns);
+        MsixNotify(pDevIns, pGlobals->aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);
         return;
     }
 
@@ -596,10 +653,24 @@ static void ich9pciSetIrqInternal(PICH9PCIGLOBALS pGlobals, uint8_t uDevFn, PPCI
     }
 }
 
-PDMBOTHCBDECL(int)  ich9pciMcfgMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb)
+
+/**
+ * Memory mapped I/O Handler for write operations.
+ *
+ * Emulates writes to configuration space.
+ *
+ * @returns VBox status code.
+ *
+ * @param   pDevIns     The device instance.
+ * @param   pvUser      User argument.
+ * @param   GCPhysAddr  Physical address (in GC) where the read starts.
+ * @param   pv          Where to fetch the result.
+ * @param   cb          Number of bytes to write.
+ * @remarks Caller enters the device critical section.
+ */
+PDMBOTHCBDECL(int) ich9pciMcfgMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb)
 {
     PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
-    PciAddress aDest;
     uint32_t u32 = 0;
     NOREF(pvUser);
 
@@ -607,6 +678,8 @@ PDMBOTHCBDECL(int)  ich9pciMcfgMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCP
 
     PCI_LOCK(pDevIns, VINF_IOM_R3_MMIO_WRITE);
 
+    /* Decode target device and configuration space register */
+    PciAddress aDest;
     ich9pciPhysToPciAddr(pGlobals, GCPhysAddr, &aDest);
 
     switch (cb)
@@ -624,16 +697,32 @@ PDMBOTHCBDECL(int)  ich9pciMcfgMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCP
             Assert(false);
             break;
     }
+
+    /* Perform configuration space write */
     int rc = ich9pciDataWriteAddr(pGlobals, &aDest, u32, cb, VINF_IOM_R3_MMIO_WRITE);
     PCI_UNLOCK(pDevIns);
 
     return rc;
 }
 
-PDMBOTHCBDECL(int)  ich9pciMcfgMMIORead (PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
+
+/**
+ * Memory mapped I/O Handler for read operations.
+ *
+ * Emulates reads from configuration space.
+ *
+ * @returns VBox status code.
+ *
+ * @param   pDevIns     The device instance.
+ * @param   pvUser      User argument.
+ * @param   GCPhysAddr  Physical address (in GC) where the read starts.
+ * @param   pv          Where to store the result.
+ * @param   cb          Number of bytes read.
+ * @remarks Caller enters the device critical section.
+ */
+PDMBOTHCBDECL(int) ich9pciMcfgMMIORead (PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
 {
     PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS);
-    PciAddress  aDest;
     uint32_t    rv;
     NOREF(pvUser);
 
@@ -641,8 +730,11 @@ PDMBOTHCBDECL(int)  ich9pciMcfgMMIORead (PPDMDEVINS pDevIns, void *pvUser, RTGCP
 
     PCI_LOCK(pDevIns, VINF_IOM_R3_MMIO_READ);
 
+    /* Decode target device and configuration space register */
+    PciAddress aDest;
     ich9pciPhysToPciAddr(pGlobals, GCPhysAddr, &aDest);
 
+    /* Perform configuration space read */
     int rc = ich9pciDataReadAddr(pGlobals, &aDest, cb, &rv, VINF_IOM_R3_MMIO_READ);
 
     if (RT_SUCCESS(rc))
@@ -1351,7 +1443,7 @@ static DECLCALLBACK(int) ich9pciR3CommonLoadExec(PICH9PCIBUS pBus, PSSMHANDLE pS
             pDev = pBus->apDevices[i];
             if (pDev)
             {
-                LogRel(("New device in slot %#x, %s (vendor=%#06x device=%#06x)\n", i, pDev->name,
+                LogRel(("PCI: New device in slot %#x, %s (vendor=%#06x device=%#06x)\n", i, pDev->name,
                         PCIDevGetVendorId(pDev), PCIDevGetDeviceId(pDev)));
                 if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
                 {
@@ -1395,7 +1487,7 @@ static DECLCALLBACK(int) ich9pciR3CommonLoadExec(PICH9PCIBUS pBus, PSSMHANDLE pS
         pDev = pBus->apDevices[i];
         if (!pDev)
         {
-            LogRel(("Device in slot %#x has been removed! vendor=%#06x device=%#06x\n", i,
+            LogRel(("PCI: Device in slot %#x has been removed! vendor=%#06x device=%#06x\n", i,
                     PCIDevGetVendorId(&DevTmp), PCIDevGetDeviceId(&DevTmp)));
             if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
             {
@@ -1477,35 +1569,42 @@ static DECLCALLBACK(int) ich9pcibridgeR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE
     return ich9pciR3CommonLoadExec(pThis, pSSM, uVersion, uPass);
 }
 
+
+/*
+ * Perform imeediate read of configuration space register.
+ * Cannot be rescheduled, as already in R3.
+ */
 static uint32_t ich9pciConfigRead(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t len)
 {
-    /* Will only work in LSB case */
-    uint32_t   u32Val;
     PciAddress aPciAddr;
-
     aPciAddr.iBus = uBus;
     aPciAddr.iDeviceFunc = uDevFn;
     aPciAddr.iRegister = addr;
 
-    /* cannot be rescheduled, as already in R3 */
+    uint32_t u32Val;
     int rc = ich9pciDataReadAddr(pGlobals, &aPciAddr, len, &u32Val, VERR_INTERNAL_ERROR);
     AssertRC(rc);
+
     return u32Val;
 }
 
+
+/*
+ * Perform imeediate write to configuration space register.
+ * Cannot be rescheduled, as already in R3.
+ */
 static void ich9pciConfigWrite(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val, uint32_t len)
 {
     PciAddress aPciAddr;
-
     aPciAddr.iBus = uBus;
     aPciAddr.iDeviceFunc = uDevFn;
     aPciAddr.iRegister = addr;
 
-    /* cannot be rescheduled, as already in R3 */
     int rc = ich9pciDataWriteAddr(pGlobals, &aPciAddr, val, len, VERR_INTERNAL_ERROR);
     AssertRC(rc);
 }
 
+
 static void ich9pciSetRegionAddress(PICH9PCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, int iRegion, uint64_t addr)
 {
     uint32_t uReg = ich9pciGetRegionReg(iRegion);
@@ -1841,11 +1940,16 @@ static DECLCALLBACK(int) ich9pciFakePCIBIOS(PPDMDEVINS pDevIns)
     return VINF_SUCCESS;
 }
 
+
+/*
+ * Configuration space read callback (PCIDEVICEINT::pfnConfigRead) for
+ * connected devices.
+ */
 static DECLCALLBACK(uint32_t) ich9pciConfigReadDev(PCIDevice *aDev, uint32_t u32Address, unsigned len)
 {
     if ((u32Address + len) > 256 && (u32Address + len) < 4096)
     {
-        LogRel(("Read from extended register %d fallen back to generic code\n",
+        LogRel(("PCI: Read from extended register %d fallen back to generic code\n",
                 u32Address));
         return 0;
     }
@@ -1884,6 +1988,7 @@ static DECLCALLBACK(uint32_t) ich9pciConfigReadDev(PCIDevice *aDev, uint32_t u32
     }
 }
 
+
 DECLINLINE(void) ich9pciWriteBarByte(PCIDevice *aDev, int iRegion, int iOffset, uint8_t u8Val)
 {
     PCIIORegion * pRegion = &aDev->Int.s.aIORegions[iRegion];
@@ -1893,10 +1998,10 @@ DECLINLINE(void) ich9pciWriteBarByte(PCIDevice *aDev, int iRegion, int iOffset,
          iRegion, iOffset, u8Val, iRegionSize));
 
     if (iOffset > 3)
-        Assert((aDev->Int.s.aIORegions[iRegion].type & PCI_ADDRESS_SPACE_BAR64) != 0);
+        Assert((pRegion->type & PCI_ADDRESS_SPACE_BAR64) != 0);
 
     /* Check if we're writing to upper part of 64-bit BAR. */
-    if (aDev->Int.s.aIORegions[iRegion].type == 0xff)
+    if (pRegion->type == 0xff)
     {
         ich9pciWriteBarByte(aDev, iRegion-1, iOffset+4, u8Val);
         return;
@@ -1927,9 +2032,13 @@ DECLINLINE(void) ich9pciWriteBarByte(PCIDevice *aDev, int iRegion, int iOffset,
     PCIDevSetByte(aDev, uAddr, u8Val);
 }
 
+
 /**
- * See paragraph 7.5 of PCI Express specification (p. 349) for definition of
- * registers and their writability policy.
+ * Configuration space write callback (PCIDEVICEINT::pfnConfigWrite)
+ * for connected devices.
+ *
+ * See paragraph 7.5 of PCI Express specification (p. 349) for
+ * definition of registers and their writability policy.
  */
 static DECLCALLBACK(void) ich9pciConfigWriteDev(PCIDevice *aDev, uint32_t u32Address,
                                                 uint32_t val, unsigned len)
@@ -1938,7 +2047,7 @@ static DECLCALLBACK(void) ich9pciConfigWriteDev(PCIDevice *aDev, uint32_t u32Add
 
     if ((u32Address + len) > 256 && (u32Address + len) < 4096)
     {
-        LogRel(("Write to extended register %d fallen back to generic code\n",
+        LogRel(("PCI: Write to extended register %d fallen back to generic code\n",
                 u32Address));
         return;
     }
@@ -2142,7 +2251,10 @@ static bool hasHardAssignedDevsInSlot(PICH9PCIBUS pBus, int iSlot)
 
 static int ich9pciRegisterInternal(PICH9PCIBUS pBus, int iDev, PPCIDEVICE pPciDev, const char *pszName)
 {
-    PciAddress aPosition = {0, 0, 0};
+    PciAddress aPosition;
+    aPosition.iBus = 0;
+    aPosition.iDeviceFunc = 0;
+    aPosition.iRegister = 0;
 
     /*
      * Find device position
diff --git a/src/VBox/Devices/Bus/SrvPciRawR0.cpp b/src/VBox/Devices/Bus/SrvPciRawR0.cpp
index 678a2ba..4835bd4 100644
--- a/src/VBox/Devices/Bus/SrvPciRawR0.cpp
+++ b/src/VBox/Devices/Bus/SrvPciRawR0.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -114,7 +114,7 @@ static DECLCALLBACK(bool) pcirawr0Isr(void* pContext, int32_t iHostIrq)
 
     RTSpinlockAcquire(pThis->hSpinlock);
     pThis->iPendingIrq = iHostIrq;
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     /**
      * @todo RTSemEventSignal() docs claims that it's platform-dependent
@@ -871,7 +871,7 @@ static int pcirawr0GetIrq(PSUPDRVSESSION    pSession,
     iPendingIrq = pDev->iPendingIrq;
     pDev->iPendingIrq = 0;
     fTerminate = pDev->fTerminate;
-    RTSpinlockReleaseNoInts(pDev->hSpinlock);
+    RTSpinlockRelease(pDev->hSpinlock);
 
     /* Block until new IRQs arrives */
     if (!fTerminate)
@@ -887,7 +887,7 @@ static int pcirawr0GetIrq(PSUPDRVSESSION    pSession,
                     RTSpinlockAcquire(pDev->hSpinlock);
                     iPendingIrq = pDev->iPendingIrq;
                     pDev->iPendingIrq = 0;
-                    RTSpinlockReleaseNoInts(pDev->hSpinlock);
+                    RTSpinlockRelease(pDev->hSpinlock);
                 }
                 else
                     rc = VERR_INTERRUPTED;
diff --git a/src/VBox/Devices/EFI/DevEFI.cpp b/src/VBox/Devices/EFI/DevEFI.cpp
index 1d937cf..55e5179 100644
--- a/src/VBox/Devices/EFI/DevEFI.cpp
+++ b/src/VBox/Devices/EFI/DevEFI.cpp
@@ -220,7 +220,7 @@ typedef struct DEVEFI
     uint64_t                u64CpuFrequency;
     /** GOP mode. */
     uint32_t                u32GopMode;
-    /** Uga mode horisontal resolution. */
+    /** Uga mode horizontal resolution. */
     uint32_t                cxUgaResolution;
     /** Uga mode vertical resolution. */
     uint32_t                cyUgaResolution;
@@ -682,10 +682,8 @@ static int nvramWriteVariableOpAdd(PDEVEFI pThis)
         /*
          * Too many variables.
          */
-        static unsigned s_cWarnings = 0;
-        if (s_cWarnings++ < 5)
-            LogRel(("EFI: Too many variables (%RTuuid::'%s' fAttrib=%#x cbValue=%#x)\n", &pThis->NVRAM.VarOpBuf.uuid,
-                    pThis->NVRAM.VarOpBuf.szName, pThis->NVRAM.VarOpBuf.fAttributes, pThis->NVRAM.VarOpBuf.cbValue));
+        LogRelMax(5, ("EFI: Too many variables (%RTuuid::'%s' fAttrib=%#x cbValue=%#x)\n", &pThis->NVRAM.VarOpBuf.uuid,
+                  pThis->NVRAM.VarOpBuf.szName, pThis->NVRAM.VarOpBuf.fAttributes, pThis->NVRAM.VarOpBuf.cbValue));
         pThis->NVRAM.u32Status = EFI_VARIABLE_OP_STATUS_ERROR;
         Log(("nvramWriteVariableOpAdd: Too many variabled.\n"));
     }
@@ -1075,7 +1073,7 @@ static uint32_t efiInfoSize(PDEVEFI pThis)
         case EFI_INFO_INDEX_STACK_SIZE:
         case EFI_INFO_INDEX_GOP_MODE:
         case EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION:
-        case EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION:
+        case EFI_INFO_INDEX_UGA_HORIZONTAL_RESOLUTION:
             return 4;
         case EFI_INFO_INDEX_BOOT_ARGS:
             return (uint32_t)RTStrNLen(pThis->szBootArgs, sizeof(pThis->szBootArgs)) + 1;
@@ -1157,7 +1155,7 @@ static uint8_t efiInfoNextByte(PDEVEFI pThis)
         case EFI_INFO_INDEX_BOOT_ARGS:          return efiInfoNextByteBuf(pThis, pThis->szBootArgs, sizeof(pThis->szBootArgs));
         case EFI_INFO_INDEX_DEVICE_PROPS:       return efiInfoNextByteBuf(pThis, pThis->pbDeviceProps, pThis->cbDeviceProps);
         case EFI_INFO_INDEX_GOP_MODE:           return efiInfoNextByteU32(pThis, pThis->u32GopMode);
-        case EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION:  return efiInfoNextByteU32(pThis, pThis->cxUgaResolution);
+        case EFI_INFO_INDEX_UGA_HORIZONTAL_RESOLUTION:  return efiInfoNextByteU32(pThis, pThis->cxUgaResolution);
         case EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION:    return efiInfoNextByteU32(pThis, pThis->cyUgaResolution);
 
         /* Keep in sync with value in EfiThunk.asm */
@@ -1528,12 +1526,7 @@ static DECLCALLBACK(int) efiIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPO
             if (u32 > EFIDBGPOINT_INVALID && u32 < EFIDBGPOINT_END)
             {
                 /* For now, just log it. */
-                static uint64_t s_cDbgPointLogged = 0;
-                if (s_cDbgPointLogged < 1024)
-                {
-                    s_cDbgPointLogged++;
-                    LogRel(("EFI: debug point %s\n", efiDbgPointName((EFIDBGPOINT)u32)));
-                }
+                LogRelMax(1024, ("EFI: debug point %s\n", efiDbgPointName((EFIDBGPOINT)u32)));
                 rc = VINF_SUCCESS;
             }
             else
@@ -1630,7 +1623,7 @@ static DECLCALLBACK(int) efiLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32
     for (uint32_t i = 0; i < pThis->NVRAM.cVariables; i++)
     {
         PEFIVAR pEfiVar = (PEFIVAR)RTMemAllocZ(sizeof(EFIVAR));
-        AssertPtrReturn(pEfiVar, VERR_NO_MEMORY);
+        AssertReturn(pEfiVar, VERR_NO_MEMORY);
 
         rc = SSMR3GetStructEx(pSSM, pEfiVar, sizeof(EFIVAR), 0, g_aEfiVariableDescFields, NULL);
         if (RT_SUCCESS(rc))
diff --git a/src/VBox/Devices/EFI/DevEFI.h b/src/VBox/Devices/EFI/DevEFI.h
index 409bec7..dafb614 100644
--- a/src/VBox/Devices/EFI/DevEFI.h
+++ b/src/VBox/Devices/EFI/DevEFI.h
@@ -66,7 +66,7 @@ typedef enum
     EFI_INFO_INDEX_CPU_FREQUENCY,
     EFI_INFO_INDEX_TSC_FREQUENCY,
     EFI_INFO_INDEX_GOP_MODE,
-    EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION,
+    EFI_INFO_INDEX_UGA_HORIZONTAL_RESOLUTION,
     EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION,
     EFI_INFO_INDEX_END
 } EfiInfoIndex;
diff --git a/src/VBox/Devices/EFI/DevSmc.cpp b/src/VBox/Devices/EFI/DevSmc.cpp
index ed0b602..fb29ec4 100644
--- a/src/VBox/Devices/EFI/DevSmc.cpp
+++ b/src/VBox/Devices/EFI/DevSmc.cpp
@@ -10,7 +10,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -60,7 +60,7 @@
 
 /** The first Apple SMC port. */
 #define SMC_PORT_FIRST                          0x0300
-/** The number of registers (also ports).  */
+/** The number of registers (also ports). */
 #define SMC_REG_COUNT                           0x0020
 
 /** The data register. */
@@ -357,7 +357,7 @@ static const DEVSMCKEYDESC g_aSmcKeys[] =
 static RTONCE   g_SmcR0Once = RTONCE_INITIALIZER;
 /** Indicates whether we've successfully queried the OSK* keys. */
 static bool     g_fHaveOsk = false;
-/** The OSK0 and OSK1 values.   */
+/** The OSK0 and OSK1 values. */
 static uint8_t  g_abOsk0And1[32+32];
 
 
@@ -1351,7 +1351,7 @@ static DECLCALLBACK(int) smcSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
 {
     PDEVSMC pThis = PDMINS_2_DATA(pDevIns, PDEVSMC);
 
-    /** @todo  */
+    /** @todo */
 
     return VINF_SUCCESS;
 }
@@ -1374,7 +1374,7 @@ static DECLCALLBACK(int) smcLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32
      */
     if (uVersion == SMC_SAVED_STATE_VERSION)
     {
-        /** @todo  */
+        /** @todo */
     }
 
     return VINF_SUCCESS;
diff --git a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiSpec.h b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiSpec.h
index 757024c..cf2d202 100644
--- a/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiSpec.h
+++ b/src/VBox/Devices/EFI/Firmware/MdePkg/Include/Uefi/UefiSpec.h
@@ -1796,17 +1796,20 @@ typedef struct {
   ///
   /// The table header for the EFI Boot Services Table.
   ///
+/* 64: 0 */
   EFI_TABLE_HEADER                Hdr;
 
   //
   // Task Priority Services
   //
+/* 64: 3*8 */
   EFI_RAISE_TPL                   RaiseTPL;
   EFI_RESTORE_TPL                 RestoreTPL;
 
   //
   // Memory Services
   //
+/* 64: 5*8 */
   EFI_ALLOCATE_PAGES              AllocatePages;
   EFI_FREE_PAGES                  FreePages;
   EFI_GET_MEMORY_MAP              GetMemoryMap;
@@ -1816,6 +1819,7 @@ typedef struct {
   //
   // Event & Timer Services
   //
+/* 64: 10*8 = 0x50 (80) */
   EFI_CREATE_EVENT                  CreateEvent;
   EFI_SET_TIMER                     SetTimer;
   EFI_WAIT_FOR_EVENT                WaitForEvent;
@@ -1826,10 +1830,12 @@ typedef struct {
   //
   // Protocol Handler Services
   //
+/* 64: 16*8 = 0x80 (128) */
   EFI_INSTALL_PROTOCOL_INTERFACE    InstallProtocolInterface;
   EFI_REINSTALL_PROTOCOL_INTERFACE  ReinstallProtocolInterface;
   EFI_UNINSTALL_PROTOCOL_INTERFACE  UninstallProtocolInterface;
   EFI_HANDLE_PROTOCOL               HandleProtocol;
+/* 64: 20*8 = 0xA0 (160) */
   VOID                              *Reserved;
   EFI_REGISTER_PROTOCOL_NOTIFY      RegisterProtocolNotify;
   EFI_LOCATE_HANDLE                 LocateHandle;
@@ -1839,6 +1845,7 @@ typedef struct {
   //
   // Image Services
   //
+/* 64: 25*8 = 0xC8 (200) */
   EFI_IMAGE_LOAD                    LoadImage;
   EFI_IMAGE_START                   StartImage;
   EFI_EXIT                          Exit;
@@ -1848,6 +1855,7 @@ typedef struct {
   //
   // Miscellaneous Services
   //
+/* 64: 30*8 = 0xF0 (240) */
   EFI_GET_NEXT_MONOTONIC_COUNT      GetNextMonotonicCount;
   EFI_STALL                         Stall;
   EFI_SET_WATCHDOG_TIMER            SetWatchdogTimer;
@@ -1855,12 +1863,14 @@ typedef struct {
   //
   // DriverSupport Services
   //
+/* 64: 33*8 = 0x108 (264) */
   EFI_CONNECT_CONTROLLER            ConnectController;
   EFI_DISCONNECT_CONTROLLER         DisconnectController;
 
   //
   // Open and Close Protocol Services
   //
+/* 64: 35*8 = 0x118 (280) */
   EFI_OPEN_PROTOCOL                 OpenProtocol;
   EFI_CLOSE_PROTOCOL                CloseProtocol;
   EFI_OPEN_PROTOCOL_INFORMATION     OpenProtocolInformation;
@@ -1868,6 +1878,7 @@ typedef struct {
   //
   // Library Services
   //
+/* 64: 38*8 = 0x130 (304) */
   EFI_PROTOCOLS_PER_HANDLE          ProtocolsPerHandle;
   EFI_LOCATE_HANDLE_BUFFER          LocateHandleBuffer;
   EFI_LOCATE_PROTOCOL               LocateProtocol;
@@ -1877,14 +1888,17 @@ typedef struct {
   //
   // 32-bit CRC Services
   //
+/* 64: 43*8 = 0x158 (344) */
   EFI_CALCULATE_CRC32               CalculateCrc32;
 
   //
   // Miscellaneous Services
   //
+/* 64: 44*8 = 0x160 (352) */
   EFI_COPY_MEM                      CopyMem;
   EFI_SET_MEM                       SetMem;
   EFI_CREATE_EVENT_EX               CreateEventEx;
+/* 64: 47*8 = 0x178 (376) */
 } EFI_BOOT_SERVICES;
 
 ///
diff --git a/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c b/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
index b98b577..0fc305d 100644
--- a/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/src/VBox/Devices/EFI/Firmware/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -79,7 +79,7 @@ VBoxConsoleSwitchMode (
     {
         UINT32 H = 1027;
         UINT32 V = 768;
-        GetVmVariable(EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION, (CHAR8 *)&H, sizeof(UINT32));
+        GetVmVariable(EFI_INFO_INDEX_UGA_HORIZONTAL_RESOLUTION, (CHAR8 *)&H, sizeof(UINT32));
         GetVmVariable(EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION, (CHAR8 *)&V, sizeof(UINT32));
         r = Uga->SetMode(Uga, H, V, 32, 60);
     }
@@ -107,7 +107,7 @@ VBoxConsoleInit()
     gBS->CreateEventEx(EVT_NOTIFY_SIGNAL, TPL_NOTIFY, VBoxConsoleSwitchMode, NULL, &gEfiEventReadyToBootGuid, &event);
     return EFI_SUCCESS;
 }
-#endif /* !VBOX */
+#endif /* VBOX */
 
 
 //
diff --git a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxAppleSim/VBoxAppleSim.c b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxAppleSim/VBoxAppleSim.c
index c74be67..85adfc1 100644
--- a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxAppleSim/VBoxAppleSim.c
+++ b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxAppleSim/VBoxAppleSim.c
@@ -32,6 +32,7 @@
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/UefiLib.h>
+#include <Library/PrintLib.h>
 
 #include <Protocol/DevicePathToText.h>
 
@@ -63,92 +64,124 @@ InitializeConsoleSim (IN EFI_HANDLE           ImageHandle,
 
 
 /*
- *   Internal Functions                                                        *
+ * Internal Functions
  */
 static UINT32
-GetVmVariable(UINT32 Variable, CHAR8* Buffer, UINT32 Size )
+GetVmVariable(UINT32 Variable, CHAR8 *pbBuf, UINT32 cbBuf)
 {
-    UINT32 VarLen, i;
-
+    UINT32 cbVar, offBuf;
 
     ASMOutU32(EFI_INFO_PORT, Variable);
-    VarLen = ASMInU32(EFI_INFO_PORT);
+    cbVar = ASMInU32(EFI_INFO_PORT);
 
-    for (i=0; i < VarLen && i < Size; i++)
-    {
-        Buffer[i] = ASMInU8(EFI_INFO_PORT);
-    }
+    for (offBuf = 0; offBuf < cbVar && offBuf < cbBuf; offBuf++)
+        pbBuf[offBuf] = ASMInU8(EFI_INFO_PORT);
 
-    return VarLen;
+    return cbVar;
 }
 
 /*
  * GUIDs
  */
+/** The EFI variable GUID for the 'FirmwareFeatures' and friends.
+ * Also known as AppleFirmwareVariableGuid in other sources. */
 EFI_GUID gEfiAppleNvramGuid = {
     0x4D1EDE05, 0x38C7, 0x4A6A, {0x9C, 0xC6, 0x4B, 0xCC, 0xA8, 0xB3, 0x8C, 0x14 }
 };
 
+/** The EFI variable GUID for the 'boot-args' variable and others.
+ * Also known as AppleNVRAMVariableGuid in other sources. */
 EFI_GUID gEfiAppleBootGuid = {
     0x7C436110, 0xAB2A, 0x4BBB, {0xA8, 0x80, 0xFE, 0x41, 0x99, 0x5C, 0x9F, 0x82}
 };
 
-EFI_GUID gEfiAppleVarGuid = {
-    0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}
-};
-
-EFI_GUID gEfiUnknown1ProtocolGuid = {
-    0xDD8E06AC, 0x00E2, 0x49A9, {0x88, 0x8F, 0xFA, 0x46, 0xDE, 0xD4, 0x0A, 0x52}
-};
 
 /*
- * Typedefs
+ * Device Properoty protocol implementation hack.
  */
-typedef struct _APPLE_GETVAR_PROTOCOL APPLE_GETVAR_PROTOCOL;
 
-typedef
-EFI_STATUS
-(EFIAPI *APPLE_GETVAR_PROTOCOL_GET_DEVICE_PROPS) (
-    IN     APPLE_GETVAR_PROTOCOL   *This,
-    IN     CHAR8                   *Buffer,
-    IN OUT UINT32                  *BufferSize);
+/** gEfiAppleVarGuid is aka AppleDevicePropertyProtocolGuid in other sources. */
+EFI_GUID gEfiAppleVarGuid = {
+    0x91BD12FE, 0xF6C3, 0x44FB, {0xA5, 0xB7, 0x51, 0x22, 0xAB, 0x30, 0x3A, 0xE0}
+};
 
+/** APPLE_GETVAR_PROTOCOL is aka APPLE_DEVICE_PROPERTY_PROTOCOL in other sources. */
+typedef struct _APPLE_GETVAR_PROTOCOL APPLE_GETVAR_PROTOCOL;
 
 struct _APPLE_GETVAR_PROTOCOL
 {
-    UINT64      Magic;
-    EFI_STATUS(EFIAPI *Unknown0)(IN VOID *);
-    EFI_STATUS(EFIAPI *Unknown1)(IN VOID *);
-    EFI_STATUS(EFIAPI *Unknown2)(IN VOID *);
-    APPLE_GETVAR_PROTOCOL_GET_DEVICE_PROPS  GetDevProps;
+    /** Magic value or some version thingy. boot.efi doesn't check this, I think. */
+    UINT64  u64Magic;
+
+    EFI_STATUS (EFIAPI *pfnUnknown0)(IN APPLE_GETVAR_PROTOCOL *This, IN VOID *pvArg1, IN VOID *pvArg2,
+                                     IN VOID *pvArg3, IN VOID *pvArg4);
+    EFI_STATUS (EFIAPI *pfnUnknown1)(IN APPLE_GETVAR_PROTOCOL *This, IN VOID *pvArg1, IN VOID *pvArg2,
+                                     IN VOID *pvArg3, IN VOID *pvArg4);
+    EFI_STATUS (EFIAPI *pfnUnknown2)(IN APPLE_GETVAR_PROTOCOL *This, IN VOID *pvArg1, IN VOID *pvArg2);
+
+    EFI_STATUS (EFIAPI *pfnGetDevProps)(IN APPLE_GETVAR_PROTOCOL *This, IN CHAR8 *pbBuf, IN OUT UINT32 *pcbBuf);
 };
+/** The value of APPLE_GETVAR_PROTOCOL::u64Magic. */
+#define APPLE_GETVAR_PROTOCOL_MAGIC     0x10000
 
+EFI_STATUS EFIAPI
+AppleGetVar_Unknown0(IN APPLE_GETVAR_PROTOCOL *This, IN VOID *pvArg1, IN VOID *pvArg2,
+                     IN VOID *pvArg3, IN VOID *pvArg4)
+{
+    CHAR8 szMsg[128];
+    AsciiSPrint(szMsg, sizeof(szMsg), "AppleGetVar_Unknown0: pvArg1=%p pvArg2=%p pvArg3=%p pvArg4=%p",
+                pvArg1, pvArg2, pvArg3, pvArg4);
+    DebugAssert(__FILE__, __LINE__, szMsg);
+    return EFI_UNSUPPORTED;
+}
 
-#define IMPL_STUB(iface, num)                                   \
-    EFI_STATUS EFIAPI                                           \
-    iface##Unknown##num(IN  VOID   *This)                       \
-    {                                                           \
-        Print(L"Unknown%d of %a called", num, #iface);          \
-        /*DebugAssert(__FILE__, __LINE__, __FUNCTION__);*/      \
-        return EFI_SUCCESS;                                     \
-    }
+EFI_STATUS EFIAPI
+AppleGetVar_Unknown1(IN APPLE_GETVAR_PROTOCOL *This, IN VOID *pvArg1, IN VOID *pvArg2,
+                     IN VOID *pvArg3, IN VOID *pvArg4)
+{
+    CHAR8 szMsg[128];
+    AsciiSPrint(szMsg, sizeof(szMsg), "AppleGetVar_Unknown1: pvArg1=%p pvArg2=%p pvArg3=%p pvArg4=%p",
+                pvArg1, pvArg2, pvArg3, pvArg4);
+    DebugAssert(__FILE__, __LINE__, szMsg);
+    return EFI_UNSUPPORTED;
+}
 
-IMPL_STUB(GetVar, 0)
-IMPL_STUB(GetVar, 1)
-IMPL_STUB(GetVar, 2)
+EFI_STATUS EFIAPI
+AppleGetVar_Unknown2(IN APPLE_GETVAR_PROTOCOL *This, IN VOID *pvArg1, IN VOID *pvArg2)
+{
+    CHAR8 szMsg[80];
+    AsciiSPrint(szMsg, sizeof(szMsg), "AppleGetVar_Unknown2: pvArg1=%p pvArg2=%p", pvArg1, pvArg2);
+    DebugAssert(__FILE__, __LINE__, szMsg);
+    return EFI_UNSUPPORTED;
+}
 
 
+/**
+ * This method obtains the 'device-properties' that get exposed by
+ * AppleEFIFirmware and parsed by AppleACPIPlatform.
+ *
+ * Check out the data in the IORegisteryExplorer, the device-properties property
+ * under IODeviceTree:/efi.
+ *
+ * @retval  EFI_SUCCESS, check *pcbBuf or the number of bytes actually returned.
+ * @retval  EFI_BUFFER_TOO_SMALL, check *pcbBuf for the necessary buffer size.
+ * @param   pThis   Not used.
+ * @param   pbBuf   The output buffer.
+ * @param   pcbBuf  On input, the varible pointed to contains the size of the
+ *                  buffer.  The size is generally 4KB from what we've observed.
+ *                  On output, it contains the amount of data available, this
+ *                  is always set.
+ */
 EFI_STATUS EFIAPI
-GetDeviceProps(IN     APPLE_GETVAR_PROTOCOL   *This,
-               IN     CHAR8                   *Buffer,
-               IN OUT UINT32                  *BufferSize)
+AppleGetVar_GetDeviceProps(IN APPLE_GETVAR_PROTOCOL *pThis, OUT CHAR8 *pbBuf, IN OUT UINT32 *pcbBuf)
 {
-    UINT32 BufLen = *BufferSize, DataLen;
+    UINT32 cbBuf = *pcbBuf;
+    UINT32 cbActual;
 
-    DataLen = GetVmVariable(EFI_INFO_INDEX_DEVICE_PROPS, Buffer, BufLen);
-    *BufferSize = DataLen;
+    cbActual = GetVmVariable(EFI_INFO_INDEX_DEVICE_PROPS, pbBuf, cbBuf);
+    *pcbBuf = cbActual;
 
-    if (DataLen > BufLen)
+    if (cbActual > cbBuf)
         return EFI_BUFFER_TOO_SMALL;
 
     return EFI_SUCCESS;
@@ -156,16 +189,30 @@ GetDeviceProps(IN     APPLE_GETVAR_PROTOCOL   *This,
 
 APPLE_GETVAR_PROTOCOL gPrivateVarHandler =
 {
-    /* Magic = */ 0, /** @todo figure out what's here on a real system? */
-    GetVarUnknown0,
-    GetVarUnknown1,
-    GetVarUnknown2,
-    GetDeviceProps
+    /* Magic = */ APPLE_GETVAR_PROTOCOL_MAGIC,
+    AppleGetVar_Unknown0,
+    AppleGetVar_Unknown1,
+    AppleGetVar_Unknown2,
+    AppleGetVar_GetDeviceProps
+};
+
+
+/*
+ * Unknown Protocol #1.
+ */
+
+/** This seems to be related to graphics/display... */
+EFI_GUID gEfiUnknown1ProtocolGuid =
+{
+    0xDD8E06AC, 0x00E2, 0x49A9, {0x88, 0x8F, 0xFA, 0x46, 0xDE, 0xD4, 0x0A, 0x52}
 };
 
 EFI_STATUS EFIAPI
 UnknownHandlerImpl()
 {
+#ifdef DEBUG
+    ASSERT(0);
+#endif
     Print(L"Unknown called\n");
     return EFI_SUCCESS;
 }
@@ -194,22 +241,6 @@ EFI_STATUS (EFIAPI *gUnknownProtoHandler[])() =
 };
 
 EFI_STATUS EFIAPI
-SetPrivateVarProto(IN EFI_HANDLE ImageHandle, EFI_BOOT_SERVICES * bs)
-{
-    EFI_STATUS  rc;
-
-    rc = gBS->InstallMultipleProtocolInterfaces (
-        &ImageHandle,
-        &gEfiAppleVarGuid,
-        &gPrivateVarHandler,
-        NULL
-                                                 );
-    ASSERT_EFI_ERROR (rc);
-
-    return EFI_SUCCESS;
-}
-
-EFI_STATUS EFIAPI
 SetProperVariables(IN EFI_HANDLE ImageHandle, EFI_RUNTIME_SERVICES * rs)
 {
      EFI_STATUS          rc;
@@ -219,11 +250,13 @@ SetProperVariables(IN EFI_HANDLE ImageHandle, EFI_RUNTIME_SERVICES * rs)
 
      // -legacy acpi=0xffffffff acpi_debug=0xfffffff panic_io_port=0xef11 io=0xfffffffe trace=4096  io=0xffffffef -v serial=2 serialbaud=9600
      // 0x10 makes kdb default, thus 0x15e for kdb, 0x14e for gdb
+     // usb=0x800 is required to work around default behavior of the Apple xHCI driver which rejects high-speed
+     // USB devices and tries to force them to EHCI when running on the Intel Panther Point chipset.
 
      //static const CHAR8  vBootArgs[]      = "debug=0x15e keepsyms=1 acpi=0xffffffff acpi_debug=0xff acpi_level=7 -v -x32 -s"; // or just "debug=0x8 -legacy"
      // 0x14e for serial output
-     //static const CHAR8  vDefBootArgs[]      = "debug=0x146 keepsyms=1 -v -serial=0x1";
-     static const CHAR8  vDefBootArgs[]      = "keepsyms=1 -v -serial=0x1";
+     //static const CHAR8  vDefBootArgs[]      = "debug=0x146 usb=0x800 keepsyms=1 -v -serial=0x1";
+     static const CHAR8  vDefBootArgs[]      = "usb=0x800 keepsyms=1 -v -serial=0x1";
      CHAR8  vBootArgs[256];
      UINT32 BootArgsLen;
 
@@ -273,28 +306,23 @@ VBoxInitAppleSim(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
     UINT64              CPUFrequency;
 
     rc = SetProperVariables(ImageHandle, SystemTable->RuntimeServices);
-    ASSERT_EFI_ERROR (rc);
+    ASSERT_EFI_ERROR(rc);
 
-    rc = SetPrivateVarProto(ImageHandle, gBS);
-    ASSERT_EFI_ERROR (rc);
+    rc = gBS->InstallMultipleProtocolInterfaces(&ImageHandle, &gEfiAppleVarGuid, &gPrivateVarHandler, NULL);
+    ASSERT_EFI_ERROR(rc);
 
-    GetVmVariable(EFI_INFO_INDEX_FSB_FREQUENCY, (CHAR8*)&FSBFrequency, sizeof FSBFrequency);
-    GetVmVariable(EFI_INFO_INDEX_TSC_FREQUENCY, (CHAR8*)&TSCFrequency, sizeof TSCFrequency);
-    GetVmVariable(EFI_INFO_INDEX_CPU_FREQUENCY, (CHAR8*)&CPUFrequency, sizeof CPUFrequency);
+    GetVmVariable(EFI_INFO_INDEX_FSB_FREQUENCY, (CHAR8 *)&FSBFrequency, sizeof(FSBFrequency));
+    GetVmVariable(EFI_INFO_INDEX_TSC_FREQUENCY, (CHAR8 *)&TSCFrequency, sizeof(TSCFrequency));
+    GetVmVariable(EFI_INFO_INDEX_CPU_FREQUENCY, (CHAR8 *)&CPUFrequency, sizeof(CPUFrequency));
 
     rc = CpuUpdateDataHub(gBS, FSBFrequency, TSCFrequency, CPUFrequency);
-    ASSERT_EFI_ERROR (rc);
+    ASSERT_EFI_ERROR(rc);
 
     rc = InitializeConsoleSim(ImageHandle, SystemTable);
-    ASSERT_EFI_ERROR (rc);
-
-    rc = gBS->InstallMultipleProtocolInterfaces (
-                                                 &ImageHandle,
-                                                 &gEfiUnknown1ProtocolGuid,
-                                                 gUnknownProtoHandler,
-                                                 NULL
-                                                 );
-    ASSERT_EFI_ERROR (rc);
+    ASSERT_EFI_ERROR(rc);
+
+    rc = gBS->InstallMultipleProtocolInterfaces(&ImageHandle, &gEfiUnknown1ProtocolGuid, gUnknownProtoHandler, NULL);
+    ASSERT_EFI_ERROR(rc);
 
     return EFI_SUCCESS;
 }
diff --git a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c
index 82df4f8..e98500b 100644
--- a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c
+++ b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxConsoleDxe/VBoxConsole.c
@@ -79,7 +79,7 @@ ConsoleSwitchMode (
     {
         UINT32 H = 1027;
         UINT32 V = 768;
-        GetVmVariable(EFI_INFO_INDEX_UGA_HORISONTAL_RESOLUTION, (CHAR8 *)&H, sizeof(UINT32));
+        GetVmVariable(EFI_INFO_INDEX_UGA_HORIZONTAL_RESOLUTION, (CHAR8 *)&H, sizeof(UINT32));
         GetVmVariable(EFI_INFO_INDEX_UGA_VERTICAL_RESOLUTION, (CHAR8 *)&V, sizeof(UINT32));
         r = Uga->SetMode(Uga, H, V, 32, 60);
     }
diff --git a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxPkg.dec b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxPkg.dec
index 60158fe..3ddf4ab 100644
--- a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxPkg.dec
+++ b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxPkg.dec
@@ -49,6 +49,7 @@
         gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0|UINT32|0x00001003
         gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0|UINT32|0x00001004
         gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0|UINT32|0x00001005
+        gVBoxVgaPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion|0x0002000a|UINT32|0x00010003
 
 ## XXX - boot mode - gEfiNt32PkgTokenSpaceGuid.PcdWinNtBootMode|1|UINT32|0x00001006
 
diff --git a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/ComponentName.c b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/ComponentName.c
index 127b272..f98137b 100644
--- a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/ComponentName.c
+++ b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/ComponentName.c
@@ -60,12 +60,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gVBoxVgaComponentName
 
 
 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVBoxVgaDriverNameTable[] = {
-  { "eng;en", L"Cirrus Logic 5430 Driver" },
+  { "eng;en", L"VirtualBox SVGA Driver" },
   { NULL , NULL }
 };
 
 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mVBoxVgaControllerNameTable[] = {
-  { "eng;en", L"Cirrus Logic 5430 PCI Adapter" },
+  { "eng;en", L"VirtualBox SVGA PCI Adapter" },
   { NULL , NULL }
 };
 
diff --git a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.c b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.c
index 8bae7f2..82bb167 100644
--- a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.c
+++ b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.c
@@ -514,12 +514,10 @@ VBoxVgaControllerDriverStart (
                       &Private->Handle,
                       &gEfiGraphicsOutputProtocolGuid,
                       &Private->GraphicsOutput,
-#if 0
                       &gEfiEdidDiscoveredProtocolGuid,
                       &Private->EdidDiscovered,
                       &gEfiEdidActiveProtocolGuid,
                       &Private->EdidActive,
-#endif
                       NULL
                       );
     }
@@ -897,8 +895,8 @@ DrawLogo (
   )
 {
   DEBUG((DEBUG_INFO, "UGA is %a GOP is %a\n",
-        FeaturePcdGet(PcdSupportGop) ? "on" : "off",
-        FeaturePcdGet(PcdSupportUga) ? "on" : "off"
+        FeaturePcdGet(PcdSupportUga) ? "on" : "off",
+        FeaturePcdGet(PcdSupportGop) ? "on" : "off"
   ));
 }
 
@@ -997,6 +995,7 @@ InitializeGraphicsMode (
   ClearScreen (Private);
 }
 
+/** Aka know as AppleGraphInfoProtocolGuid in other sources. */
 #define EFI_UNKNOWN_2_PROTOCOL_GUID \
   { 0xE316E100, 0x0751, 0x4C49, {0x90, 0x56, 0x48, 0x6C, 0x7E, 0x47, 0x29, 0x03} }
 
@@ -1061,7 +1060,6 @@ InitializeVBoxVga (
              );
   ASSERT_EFI_ERROR (Status);
 
-#if 0
   //
   // Install EFI Driver Supported EFI Version Protocol required for
   // EFI drivers that are on PCI and other plug in cards.
@@ -1071,18 +1069,11 @@ InitializeVBoxVga (
                   &ImageHandle,
                   &gEfiDriverSupportedEfiVersionProtocolGuid,
                   &gVBoxVgaDriverSupportedEfiVersion,
+                  &gEfiAppleFrameBufferInfoGuid,
+                  &gAppleFrameBufferInfo,
                   NULL
                   );
   ASSERT_EFI_ERROR (Status);
-#endif
-  Status = gBS->InstallMultipleProtocolInterfaces (
-      &ImageHandle,
-      &gEfiAppleFrameBufferInfoGuid,
-      &gAppleFrameBufferInfo,
-      NULL
-                                                   );
-  ASSERT_EFI_ERROR (Status);
-
 
   return Status;
 }
diff --git a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf
index c774736..cc53b76 100644
--- a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf
+++ b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaDxe.inf
@@ -61,8 +61,8 @@
 
   ENTRY_POINT                    = InitializeVBoxVga
 
-  PCI_VENDOR_ID  = 0x1013
-  PCI_DEVICE_ID  = 0x00A8
+  PCI_VENDOR_ID  = 0x80EE
+  PCI_DEVICE_ID  = 0xBEEF
   PCI_CLASS_CODE = 0x030000
   PCI_REVISION   = 0x00
   COMPRESS       = TRUE
@@ -115,3 +115,6 @@
 [FeaturePcd.common]
   gVBoxVgaPkgTokenSpaceGuid.PcdSupportGop
   gVBoxVgaPkgTokenSpaceGuid.PcdSupportUga
+
+[Pcd]
+  gVBoxVgaPkgTokenSpaceGuid.PcdDriverSupportedEfiVersion
diff --git a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c
index f267e4f..f4db97a 100644
--- a/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c
+++ b/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c
@@ -1,6 +1,6 @@
 /* $Id: VBoxVgaGraphicsOutput.c $ */
 /** @file
- * LegacyBiosMpTable.h
+ * VBoxVgaGraphicsOutput.c
  */
 
 /*
diff --git a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd
index 6d4d015..9c1178a 100644
Binary files a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd and b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI32.fd differ
diff --git a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd
index 9eeb19c..be17d03 100644
Binary files a/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd and b/src/VBox/Devices/EFI/FirmwareBin/VBoxEFI64.fd differ
diff --git a/src/VBox/Devices/GIMDev/GIMDev.cpp b/src/VBox/Devices/GIMDev/GIMDev.cpp
new file mode 100644
index 0000000..e2725df
--- /dev/null
+++ b/src/VBox/Devices/GIMDev/GIMDev.cpp
@@ -0,0 +1,227 @@
+/* $Id: GIMDev.cpp $ */
+/** @file
+ * Guest Interface Manager Device.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_DEV_GIM
+#include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/gim.h>
+#include <VBox/vmm/vm.h>
+
+#include "VBoxDD.h"
+
+/**
+ * GIM device.
+ */
+typedef struct GIMDEV
+{
+    /** Pointer to the device instance - R3 Ptr. */
+    PPDMDEVINSR3                    pDevInsR3;
+    /** Pointer to the device instance - R0 Ptr. */
+    PPDMDEVINSR0                    pDevInsR0;
+    /** Pointer to the device instance - RC Ptr. */
+    PPDMDEVINSRC                    pDevInsRC;
+    /** Alignment. */
+    RTRCPTR                         Alignment0;
+} GIMDEV;
+/** Pointer to the GIM device state. */
+typedef GIMDEV *PGIMDEV;
+
+
+#ifndef VBOX_DEVICE_STRUCT_TESTCASE
+
+#ifdef IN_RING3
+/**
+ * @interface_method_impl{PDMDEVREG,pfnConstruct}
+ */
+static DECLCALLBACK(int) gimdevR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
+{
+    Assert(iInstance == 0);
+    PGIMDEV pThis = PDMINS_2_DATA(pDevIns, PGIMDEV);
+    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
+
+    /*
+     * Initialize relevant state bits.
+     */
+    pThis->pDevInsR3  = pDevIns;
+    pThis->pDevInsR0  = PDMDEVINS_2_R0PTR(pDevIns);
+    pThis->pDevInsRC  = PDMDEVINS_2_RCPTR(pDevIns);
+
+    /*
+     * Register ourselves with the GIM VMM component.
+     */
+    PVM pVM = PDMDevHlpGetVM(pDevIns);
+    GIMR3GimDeviceRegister(pVM, pDevIns);
+
+    /*
+     * Get the MMIO2 regions from the GIM provider.
+     */
+    uint32_t cRegions = 0;
+    PGIMMMIO2REGION pRegionsR3 = GIMR3GetMmio2Regions(pVM, &cRegions);
+    if (   cRegions
+        && pRegionsR3)
+    {
+        /*
+         * Register the MMIO2 regions.
+         */
+        PGIMMMIO2REGION pCur = pRegionsR3;
+        for (uint32_t i = 0; i < cRegions; i++, pCur++)
+        {
+            Assert(!pCur->fRegistered);
+            int rc = PDMDevHlpMMIO2Register(pDevIns, pCur->iRegion, pCur->cbRegion, 0 /* fFlags */, &pCur->pvPageR3,
+                                            pCur->szDescription);
+            if (RT_FAILURE(rc))
+                return rc;
+
+            pCur->fRegistered = true;
+
+#if defined(VBOX_WITH_2X_4GB_ADDR_SPACE)
+            RTR0PTR pR0Mapping = 0;
+            rc = PDMDevHlpMMIO2MapKernel(pDevIns, pCur->iRegion, 0 /* off */, pCur->cbRegion, pCur->szDescription,
+                                         &pR0Mapping);
+            AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMapMMIO2IntoR0(%#x,) -> %Rrc\n", pCur->cbRegion, rc), rc);
+            pCur->pvPageR0 = pR0Mapping;
+#else
+            pCur->pvPageR0 = (RTR0PTR)pCur->pvPageR3;
+#endif
+
+            /*
+             * Map into RC if required.
+             */
+            if (pCur->fRCMapping)
+            {
+                RTRCPTR pRCMapping = 0;
+                rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, pCur->iRegion, 0 /* off */, pCur->cbRegion, pCur->szDescription,
+                                              &pRCMapping);
+                AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMMHyperMapMMIO2(%#x,) -> %Rrc\n", pCur->cbRegion, rc), rc);
+                pCur->pvPageRC = pRCMapping;
+            }
+            else
+                pCur->pvPageRC = NIL_RTRCPTR;
+
+            LogRel(("GIMDev: Registered %s\n", pCur->szDescription));
+        }
+    }
+
+    /** @todo Register SSM: PDMDevHlpSSMRegister(). */
+    /** @todo Register statistics: STAM_REG(). */
+    /** @todo Register DBGFInfo: PDMDevHlpDBGFInfoRegister(). */
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * @interface_method_impl{PDMDEVREG,pfnDestruct}
+ */
+static DECLCALLBACK(int) gimdevR3Destruct(PPDMDEVINS pDevIns)
+{
+    PGIMDEV  pThis    = PDMINS_2_DATA(pDevIns, PGIMDEV);
+    PVM      pVM      = PDMDevHlpGetVM(pDevIns);
+    uint32_t cRegions = 0;
+
+    PGIMMMIO2REGION pCur = GIMR3GetMmio2Regions(pVM, &cRegions);
+    for (uint32_t i = 0; i < cRegions; i++, pCur++)
+    {
+        int rc = PDMDevHlpMMIO2Deregister(pDevIns, pCur->iRegion);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * @interface_method_impl{PDMDEVREG,pfnRelocate}
+ */
+static DECLCALLBACK(void) gimdevR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
+{
+    NOREF(pDevIns);
+    NOREF(offDelta);
+}
+
+
+/**
+ * @interface_method_impl{PDMDEVREG,pfnReset}
+ */
+static DECLCALLBACK(void) gimdevR3Reset(PPDMDEVINS pDevIns)
+{
+    NOREF(pDevIns);
+    /* We do not deregister any MMIO2 regions as the regions are expected to be static. */
+}
+
+
+/**
+ * The device registration structure.
+ */
+const PDMDEVREG g_DeviceGIMDev =
+{
+    /* u32Version */
+    PDM_DEVREG_VERSION,
+    /* szName */
+    "GIMDev",
+    /* szRCMod */
+    "VBoxDDGC.gc",
+    /* szR0Mod */
+    "VBoxDDR0.r0",
+    /* pszDescription */
+    "VirtualBox GIM Device",
+    /* fFlags */
+    PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_R0 | PDM_DEVREG_FLAGS_RC,
+    /* fClass */
+    PDM_DEVREG_CLASS_MISC,
+    /* cMaxInstances */
+    1,
+    /* cbInstance */
+    sizeof(GIMDEV),
+    /* pfnConstruct */
+    gimdevR3Construct,
+    /* pfnDestruct */
+    gimdevR3Destruct,
+    /* pfnRelocate */
+    gimdevR3Relocate,
+    /* pfnMemSetup */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    gimdevR3Reset,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnQueryInterface. */
+    NULL,
+    /* pfnInitComplete */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32VersionEnd */
+    PDM_DEVREG_VERSION
+};
+#endif /* IN_RING3 */
+
+#endif  /* VBOX_DEVICE_STRUCT_TESTCASE */
+
diff --git a/src/VBox/Devices/Graphics/BIOS/Makefile.kmk b/src/VBox/Devices/Graphics/BIOS/Makefile.kmk
index 35f4255..9a5d677 100644
--- a/src/VBox/Devices/Graphics/BIOS/Makefile.kmk
+++ b/src/VBox/Devices/Graphics/BIOS/Makefile.kmk
@@ -39,9 +39,9 @@ ifdef VBOX_WITH_OPEN_WATCOM
  	 clname CODE  \
 	  segment VGAROM segaddr=0xC000 \
  	  segment _TEXT  segaddr=0xC000 offset=0xA00 \
- 	  segment VBE32  segaddr=0xC000 offset=0x4600 \
+ 	  segment VBE32  segaddr=0xC000 offset=0x4400 \
  	 clname DATA \
- 	  segment _DATA  segaddr=0xC000 offset=0x4800 \
+ 	  segment _DATA  segaddr=0xC000 offset=0x4600 \
 
  #
  # Updates the alternative source file.
diff --git a/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm b/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm
index 1d85bd3..ca31a7e 100644
--- a/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm
+++ b/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.asm
@@ -164,11 +164,11 @@
 
 
 
-section VGAROM progbits vstart=0x0 align=1 ; size=0x93c class=CODE group=AUTO
+section VGAROM progbits vstart=0x0 align=1 ; size=0x992 class=CODE group=AUTO
     db  055h, 0aah, 040h, 0e9h, 062h, 00ah, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 049h, 042h
     db  04dh, 000h
-vgabios_int10_handler:                       ; 0xc0022 LB 0x585
+vgabios_int10_handler:                       ; 0xc0022 LB 0x54e
     pushfw                                    ; 9c
     cmp ah, 00fh                              ; 80 fc 0f
     jne short 0002eh                          ; 75 06
@@ -222,38 +222,38 @@ vgabios_int10_handler:                       ; 0xc0022 LB 0x585
     jne short 000e5h                          ; 75 3f
     cmp AL, strict byte 003h                  ; 3c 03
     jne short 000afh                          ; 75 05
-    call 007b7h                               ; e8 0a 07
+    call 0080dh                               ; e8 60 07
     jmp short 000f3h                          ; eb 44
     cmp AL, strict byte 005h                  ; 3c 05
     jne short 000b8h                          ; 75 05
-    call 007dch                               ; e8 26 07
+    call 00832h                               ; e8 7c 07
     jmp short 000f3h                          ; eb 3b
     cmp AL, strict byte 006h                  ; 3c 06
     jne short 000c1h                          ; 75 05
-    call 00809h                               ; e8 4a 07
+    call 0085fh                               ; e8 a0 07
     jmp short 000f3h                          ; eb 32
     cmp AL, strict byte 007h                  ; 3c 07
     jne short 000cah                          ; 75 05
-    call 00856h                               ; e8 8e 07
+    call 008ach                               ; e8 e4 07
     jmp short 000f3h                          ; eb 29
     cmp AL, strict byte 008h                  ; 3c 08
     jne short 000d3h                          ; 75 05
-    call 0088ah                               ; e8 b9 07
+    call 008e0h                               ; e8 0f 08
     jmp short 000f3h                          ; eb 20
     cmp AL, strict byte 009h                  ; 3c 09
     jne short 000dch                          ; 75 05
-    call 008c1h                               ; e8 e7 07
+    call 00917h                               ; e8 3d 08
     jmp short 000f3h                          ; eb 17
     cmp AL, strict byte 00ah                  ; 3c 0a
     jne short 000e5h                          ; 75 05
-    call 00925h                               ; e8 42 08
+    call 0097bh                               ; e8 98 08
     jmp short 000f3h                          ; eb 0e
     push ES                                   ; 06
     push DS                                   ; 1e
     pushaw                                    ; 60
     mov bx, 0c000h                            ; bb 00 c0
     mov ds, bx                                ; 8e db
-    call 03040h                               ; e8 50 2f
+    call 03007h                               ; e8 17 2f
     popaw                                     ; 61
     pop DS                                    ; 1f
     pop ES                                    ; 07
@@ -947,13 +947,24 @@ vgabios_int10_handler:                       ; 0xc0022 LB 0x585
     ; mov al, ah                                ; 8a c4
     pop DS                                    ; 1f
     retn                                      ; c3
-    add byte [bx+si], al                      ; 00 00
-    add byte [bx+si], al                      ; 00 00
-    add byte [bx+si+052h], dl                 ; 00 50 52
+    times 0x5 db 0
+do_out_dx_ax:                                ; 0xc0570 LB 0x7
+    xchg ah, al                               ; 86 c4
+    out DX, AL                                ; ee
+    xchg ah, al                               ; 86 c4
+    out DX, AL                                ; ee
+    retn                                      ; c3
+do_in_ax_dx:                                 ; 0xc0577 LB 0x40
+    in AL, DX                                 ; ec
+    xchg ah, al                               ; 86 c4
+    in AL, DX                                 ; ec
+    retn                                      ; c3
+    push ax                                   ; 50
+    push dx                                   ; 52
     mov dx, 003dah                            ; ba da 03
     in AL, DX                                 ; ec
     test AL, strict byte 008h                 ; a8 08
-    je short 00575h                           ; 74 fb
+    je short 00581h                           ; 74 fb
     pop dx                                    ; 5a
     pop ax                                    ; 58
     retn                                      ; c3
@@ -962,114 +973,114 @@ vgabios_int10_handler:                       ; 0xc0022 LB 0x585
     mov dx, 003dah                            ; ba da 03
     in AL, DX                                 ; ec
     test AL, strict byte 008h                 ; a8 08
-    jne short 00582h                          ; 75 fb
+    jne short 0058eh                          ; 75 fb
     pop dx                                    ; 5a
     pop ax                                    ; 58
     retn                                      ; c3
     push dx                                   ; 52
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00003h                ; b8 03 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 d0 ff
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 d1 ff
     cmp AL, strict byte 004h                  ; 3c 04
-    jbe short 005a5h                          ; 76 0b
+    jbe short 005b5h                          ; 76 0b
     db  08ah, 0e0h
     ; mov ah, al                                ; 8a e0
     shr ah, 003h                              ; c0 ec 03
     test AL, strict byte 007h                 ; a8 07
-    je short 005a5h                           ; 74 02
+    je short 005b5h                           ; 74 02
     db  0feh, 0c4h
     ; inc ah                                    ; fe c4
     pop dx                                    ; 5a
     retn                                      ; c3
-_dispi_get_max_bpp:                          ; 0xc05a7 LB 0x22
+_dispi_get_max_bpp:                          ; 0xc05b7 LB 0x26
     push dx                                   ; 52
     push bx                                   ; 53
-    call 005d9h                               ; e8 2d 00
+    call 005f1h                               ; e8 35 00
     db  08bh, 0d8h
     ; mov bx, ax                                ; 8b d8
     or ax, strict byte 00002h                 ; 83 c8 02
-    call 005c9h                               ; e8 15 00
+    call 005ddh                               ; e8 19 00
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00003h                ; b8 03 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 a3 ff
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 a4 ff
     push ax                                   ; 50
     db  08bh, 0c3h
     ; mov ax, bx                                ; 8b c3
-    call 005c9h                               ; e8 04 00
+    call 005ddh                               ; e8 04 00
     pop ax                                    ; 58
     pop bx                                    ; 5b
     pop dx                                    ; 5a
     retn                                      ; c3
-dispi_set_enable_:                           ; 0xc05c9 LB 0x1e
+dispi_set_enable_:                           ; 0xc05dd LB 0x26
     push dx                                   ; 52
     push ax                                   ; 50
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00004h                ; b8 04 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 88 ff
     pop ax                                    ; 58
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 81 ff
     pop dx                                    ; 5a
     retn                                      ; c3
     push dx                                   ; 52
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00004h                ; b8 04 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 75 ff
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 76 ff
     pop dx                                    ; 5a
     retn                                      ; c3
-dispi_set_bank_:                             ; 0xc05e7 LB 0x1e
+dispi_set_bank_:                             ; 0xc0603 LB 0x26
     push dx                                   ; 52
     push ax                                   ; 50
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00005h                ; b8 05 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 62 ff
     pop ax                                    ; 58
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 5b ff
     pop dx                                    ; 5a
     retn                                      ; c3
     push dx                                   ; 52
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00005h                ; b8 05 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 4f ff
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 50 ff
     pop dx                                    ; 5a
     retn                                      ; c3
-_dispi_set_bank_farcall:                     ; 0xc0605 LB 0xbe
+_dispi_set_bank_farcall:                     ; 0xc0629 LB 0xe4
     cmp bx, 00100h                            ; 81 fb 00 01
-    je short 00629h                           ; 74 1e
+    je short 00653h                           ; 74 24
     db  00bh, 0dbh
     ; or bx, bx                                 ; 0b db
-    jne short 00637h                          ; 75 28
+    jne short 00665h                          ; 75 32
     db  08bh, 0c2h
     ; mov ax, dx                                ; 8b c2
     push dx                                   ; 52
     push ax                                   ; 50
     mov ax, strict word 00005h                ; b8 05 00
     mov dx, 001ceh                            ; ba ce 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 30 ff
     pop ax                                    ; 58
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
-    in ax, DX                                 ; ed
+    call 00570h                               ; e8 29 ff
+    call 00577h                               ; e8 2d ff
     pop dx                                    ; 5a
     db  03bh, 0d0h
     ; cmp dx, ax                                ; 3b d0
-    jne short 00637h                          ; 75 12
+    jne short 00665h                          ; 75 16
     mov ax, strict word 0004fh                ; b8 4f 00
     retf                                      ; cb
     mov ax, strict word 00005h                ; b8 05 00
     mov dx, 001ceh                            ; ba ce 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 14 ff
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 15 ff
     db  08bh, 0d0h
     ; mov dx, ax                                ; 8b d0
     retf                                      ; cb
@@ -1079,36 +1090,36 @@ _dispi_set_bank_farcall:                     ; 0xc0605 LB 0xbe
     push ax                                   ; 50
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00008h                ; b8 08 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 fc fe
     pop ax                                    ; 58
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 f5 fe
     pop dx                                    ; 5a
     retn                                      ; c3
     push dx                                   ; 52
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00008h                ; b8 08 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 e9 fe
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 ea fe
     pop dx                                    ; 5a
     retn                                      ; c3
     push dx                                   ; 52
     push ax                                   ; 50
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00009h                ; b8 09 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 d6 fe
     pop ax                                    ; 58
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 cf fe
     pop dx                                    ; 5a
     retn                                      ; c3
     push dx                                   ; 52
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00009h                ; b8 09 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 c3 fe
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 c4 fe
     pop dx                                    ; 5a
     retn                                      ; c3
     push ax                                   ; 50
@@ -1116,9 +1127,9 @@ _dispi_set_bank_farcall:                     ; 0xc0605 LB 0xbe
     push dx                                   ; 52
     db  08bh, 0d8h
     ; mov bx, ax                                ; 8b d8
-    call 0058ah                               ; e8 0b ff
+    call 00596h                               ; e8 d9 fe
     cmp AL, strict byte 004h                  ; 3c 04
-    jnbe short 00685h                         ; 77 02
+    jnbe short 006c3h                         ; 77 02
     shr bx, 1                                 ; d1 eb
     shr bx, 003h                              ; c1 eb 03
     mov dx, 003d4h                            ; ba d4 03
@@ -1130,41 +1141,41 @@ _dispi_set_bank_farcall:                     ; 0xc0605 LB 0xbe
     pop bx                                    ; 5b
     pop ax                                    ; 58
     retn                                      ; c3
-    call 00677h                               ; e8 e0 ff
+    call 006b5h                               ; e8 e0 ff
     push dx                                   ; 52
     push ax                                   ; 50
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00006h                ; b8 06 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 90 fe
     pop ax                                    ; 58
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 89 fe
     pop dx                                    ; 5a
     retn                                      ; c3
     push dx                                   ; 52
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00006h                ; b8 06 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 7d fe
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 7e fe
     pop dx                                    ; 5a
     retn                                      ; c3
     push dx                                   ; 52
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00007h                ; b8 07 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 6b fe
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 6c fe
     pop dx                                    ; 5a
     retn                                      ; c3
-_vga_compat_setup:                           ; 0xc06c3 LB 0xe1
+_vga_compat_setup:                           ; 0xc070d LB 0xed
     push ax                                   ; 50
     push dx                                   ; 52
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00001h                ; b8 01 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 58 fe
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 59 fe
     push ax                                   ; 50
     mov dx, 003d4h                            ; ba d4 03
     mov ax, strict word 00011h                ; b8 11 00
@@ -1178,12 +1189,12 @@ _vga_compat_setup:                           ; 0xc06c3 LB 0xe1
     mov AL, strict byte 001h                  ; b0 01
     out DX, ax                                ; ef
     pop ax                                    ; 58
-    call 00677h                               ; e8 90 ff
+    call 006b5h                               ; e8 80 ff
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00002h                ; b8 02 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 32 fe
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 33 fe
     dec ax                                    ; 48
     push ax                                   ; 50
     mov dx, 003d4h                            ; ba d4 03
@@ -1198,10 +1209,10 @@ _vga_compat_setup:                           ; 0xc06c3 LB 0xe1
     in AL, DX                                 ; ec
     and AL, strict byte 0bdh                  ; 24 bd
     test ah, 001h                             ; f6 c4 01
-    je short 0070bh                           ; 74 02
+    je short 0075dh                           ; 74 02
     or AL, strict byte 002h                   ; 0c 02
     test ah, 002h                             ; f6 c4 02
-    je short 00712h                           ; 74 02
+    je short 00764h                           ; 74 02
     or AL, strict byte 040h                   ; 0c 40
     out DX, AL                                ; ee
     mov dx, 003d4h                            ; ba d4 03
@@ -1238,11 +1249,11 @@ _vga_compat_setup:                           ; 0xc06c3 LB 0xe1
     out DX, ax                                ; ef
     mov dx, 001ceh                            ; ba ce 01
     mov ax, strict word 00003h                ; b8 03 00
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 c2 fd
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 c3 fd
     cmp AL, strict byte 008h                  ; 3c 08
-    jc short 007a2h                           ; 72 40
+    jc short 007f8h                           ; 72 40
     mov dx, 003d4h                            ; ba d4 03
     mov AL, strict byte 014h                  ; b0 14
     out DX, AL                                ; ee
@@ -1279,7 +1290,7 @@ _vga_compat_setup:                           ; 0xc06c3 LB 0xe1
     out DX, AL                                ; ee
     pop dx                                    ; 5a
     pop ax                                    ; 58
-_vbe_has_vbe_display:                        ; 0xc07a4 LB 0x13
+_vbe_has_vbe_display:                        ; 0xc07fa LB 0x13
     push DS                                   ; 1e
     push bx                                   ; 53
     mov ax, strict word 00040h                ; b8 40 00
@@ -1292,18 +1303,18 @@ _vbe_has_vbe_display:                        ; 0xc07a4 LB 0x13
     pop bx                                    ; 5b
     pop DS                                    ; 1f
     retn                                      ; c3
-vbe_biosfn_return_current_mode:              ; 0xc07b7 LB 0x25
+vbe_biosfn_return_current_mode:              ; 0xc080d LB 0x25
     push DS                                   ; 1e
     mov ax, strict word 00040h                ; b8 40 00
     mov ds, ax                                ; 8e d8
-    call 005d9h                               ; e8 19 fe
+    call 005f1h                               ; e8 db fd
     and ax, strict byte 00001h                ; 83 e0 01
-    je short 007ceh                           ; 74 09
+    je short 00824h                           ; 74 09
     mov bx, 000bah                            ; bb ba 00
     mov ax, word [bx]                         ; 8b 07
     db  08bh, 0d8h
     ; mov bx, ax                                ; 8b d8
-    jne short 007d7h                          ; 75 09
+    jne short 0082dh                          ; 75 09
     mov bx, strict word 00049h                ; bb 49 00
     mov al, byte [bx]                         ; 8a 07
     db  08ah, 0d8h
@@ -1313,138 +1324,138 @@ vbe_biosfn_return_current_mode:              ; 0xc07b7 LB 0x25
     mov ax, strict word 0004fh                ; b8 4f 00
     pop DS                                    ; 1f
     retn                                      ; c3
-vbe_biosfn_display_window_control:           ; 0xc07dc LB 0x2d
+vbe_biosfn_display_window_control:           ; 0xc0832 LB 0x2d
     cmp bl, 000h                              ; 80 fb 00
-    jne short 00805h                          ; 75 24
+    jne short 0085bh                          ; 75 24
     cmp bh, 001h                              ; 80 ff 01
-    je short 007fch                           ; 74 16
-    jc short 007ech                           ; 72 04
+    je short 00852h                           ; 74 16
+    jc short 00842h                           ; 72 04
     mov ax, 00100h                            ; b8 00 01
     retn                                      ; c3
     db  08bh, 0c2h
     ; mov ax, dx                                ; 8b c2
-    call 005e7h                               ; e8 f6 fd
-    call 005f7h                               ; e8 03 fe
+    call 00603h                               ; e8 bc fd
+    call 00617h                               ; e8 cd fd
     db  03bh, 0c2h
     ; cmp ax, dx                                ; 3b c2
-    jne short 00805h                          ; 75 0d
+    jne short 0085bh                          ; 75 0d
     mov ax, strict word 0004fh                ; b8 4f 00
     retn                                      ; c3
-    call 005f7h                               ; e8 f8 fd
+    call 00617h                               ; e8 c2 fd
     db  08bh, 0d0h
     ; mov dx, ax                                ; 8b d0
     mov ax, strict word 0004fh                ; b8 4f 00
     retn                                      ; c3
     mov ax, 0014fh                            ; b8 4f 01
     retn                                      ; c3
-vbe_biosfn_set_get_logical_scan_line_length: ; 0xc0809 LB 0x4d
+vbe_biosfn_set_get_logical_scan_line_length: ; 0xc085f LB 0x4d
     db  08bh, 0c1h
     ; mov ax, cx                                ; 8b c1
     cmp bl, 001h                              ; 80 fb 01
-    je short 00834h                           ; 74 24
+    je short 0088ah                           ; 74 24
     cmp bl, 002h                              ; 80 fb 02
-    je short 0081bh                           ; 74 06
-    jc short 00831h                           ; 72 1a
+    je short 00871h                           ; 74 06
+    jc short 00887h                           ; 72 1a
     mov ax, 00100h                            ; b8 00 01
     retn                                      ; c3
     push ax                                   ; 50
-    call 0058ah                               ; e8 6b fd
+    call 00596h                               ; e8 21 fd
     db  032h, 0ffh
     ; xor bh, bh                                ; 32 ff
     db  08ah, 0dch
     ; mov bl, ah                                ; 8a dc
     db  00ah, 0dbh
     ; or bl, bl                                 ; 0a db
-    jne short 0082ch                          ; 75 05
+    jne short 00882h                          ; 75 05
     sal ax, 003h                              ; c1 e0 03
     mov BL, strict byte 001h                  ; b3 01
     db  033h, 0d2h
     ; xor dx, dx                                ; 33 d2
     pop ax                                    ; 58
     div bx                                    ; f7 f3
-    call 00694h                               ; e8 60 fe
-    call 0058ah                               ; e8 53 fd
+    call 006d2h                               ; e8 48 fe
+    call 00596h                               ; e8 09 fd
     db  032h, 0ffh
     ; xor bh, bh                                ; 32 ff
     db  08ah, 0dch
     ; mov bl, ah                                ; 8a dc
-    call 006a7h                               ; e8 69 fe
+    call 006e9h                               ; e8 55 fe
     db  08bh, 0c8h
     ; mov cx, ax                                ; 8b c8
     db  00ah, 0dbh
     ; or bl, bl                                 ; 0a db
-    jne short 00849h                          ; 75 05
+    jne short 0089fh                          ; 75 05
     shr ax, 003h                              ; c1 e8 03
     mov BL, strict byte 001h                  ; b3 01
     mul bx                                    ; f7 e3
     db  08bh, 0d8h
     ; mov bx, ax                                ; 8b d8
-    call 006b5h                               ; e8 65 fe
+    call 006fbh                               ; e8 55 fe
     db  08bh, 0d0h
     ; mov dx, ax                                ; 8b d0
     mov ax, strict word 0004fh                ; b8 4f 00
     retn                                      ; c3
-vbe_biosfn_set_get_display_start:            ; 0xc0856 LB 0x34
+vbe_biosfn_set_get_display_start:            ; 0xc08ac LB 0x34
     cmp bl, 080h                              ; 80 fb 80
-    je short 00866h                           ; 74 0b
+    je short 008bch                           ; 74 0b
     cmp bl, 001h                              ; 80 fb 01
-    je short 0087ah                           ; 74 1a
-    jc short 0086ch                           ; 72 0a
+    je short 008d0h                           ; 74 1a
+    jc short 008c2h                           ; 72 0a
     mov ax, 00100h                            ; b8 00 01
     retn                                      ; c3
-    call 0057dh                               ; e8 14 fd
-    call 00570h                               ; e8 04 fd
+    call 00589h                               ; e8 ca fc
+    call 0057ch                               ; e8 ba fc
     db  08bh, 0c1h
     ; mov ax, cx                                ; 8b c1
-    call 0063bh                               ; e8 ca fd
+    call 00669h                               ; e8 a2 fd
     db  08bh, 0c2h
     ; mov ax, dx                                ; 8b c2
-    call 00659h                               ; e8 e3 fd
+    call 0068fh                               ; e8 c3 fd
     mov ax, strict word 0004fh                ; b8 4f 00
     retn                                      ; c3
-    call 0064bh                               ; e8 ce fd
+    call 0067dh                               ; e8 aa fd
     db  08bh, 0c8h
     ; mov cx, ax                                ; 8b c8
-    call 00669h                               ; e8 e7 fd
+    call 006a3h                               ; e8 cb fd
     db  08bh, 0d0h
     ; mov dx, ax                                ; 8b d0
     db  032h, 0ffh
     ; xor bh, bh                                ; 32 ff
     mov ax, strict word 0004fh                ; b8 4f 00
     retn                                      ; c3
-vbe_biosfn_set_get_dac_palette_format:       ; 0xc088a LB 0x37
+vbe_biosfn_set_get_dac_palette_format:       ; 0xc08e0 LB 0x37
     cmp bl, 001h                              ; 80 fb 01
-    je short 008adh                           ; 74 1e
-    jc short 00895h                           ; 72 04
+    je short 00903h                           ; 74 1e
+    jc short 008ebh                           ; 72 04
     mov ax, 00100h                            ; b8 00 01
     retn                                      ; c3
-    call 005d9h                               ; e8 41 fd
+    call 005f1h                               ; e8 03 fd
     cmp bh, 006h                              ; 80 ff 06
-    je short 008a7h                           ; 74 0a
+    je short 008fdh                           ; 74 0a
     cmp bh, 008h                              ; 80 ff 08
-    jne short 008bdh                          ; 75 1b
+    jne short 00913h                          ; 75 1b
     or ax, strict byte 00020h                 ; 83 c8 20
-    jne short 008aah                          ; 75 03
+    jne short 00900h                          ; 75 03
     and ax, strict byte 0ffdfh                ; 83 e0 df
-    call 005c9h                               ; e8 1c fd
+    call 005ddh                               ; e8 da fc
     mov BH, strict byte 006h                  ; b7 06
-    call 005d9h                               ; e8 27 fd
+    call 005f1h                               ; e8 e9 fc
     and ax, strict byte 00020h                ; 83 e0 20
-    je short 008b9h                           ; 74 02
+    je short 0090fh                           ; 74 02
     mov BH, strict byte 008h                  ; b7 08
     mov ax, strict word 0004fh                ; b8 4f 00
     retn                                      ; c3
     mov ax, 0014fh                            ; b8 4f 01
     retn                                      ; c3
-vbe_biosfn_set_get_palette_data:             ; 0xc08c1 LB 0x64
+vbe_biosfn_set_get_palette_data:             ; 0xc0917 LB 0x64
     test bl, bl                               ; 84 db
-    je short 008d4h                           ; 74 0f
+    je short 0092ah                           ; 74 0f
     cmp bl, 001h                              ; 80 fb 01
-    je short 008fch                           ; 74 32
+    je short 00952h                           ; 74 32
     cmp bl, 003h                              ; 80 fb 03
-    jbe short 00921h                          ; 76 52
+    jbe short 00977h                          ; 76 52
     cmp bl, 080h                              ; 80 fb 80
-    jne short 0091dh                          ; 75 49
+    jne short 00973h                          ; 75 49
     pushad                                    ; 66 60
     push DS                                   ; 1e
     push ES                                   ; 06
@@ -1463,7 +1474,7 @@ vbe_biosfn_set_get_palette_data:             ; 0xc08c1 LB 0x64
     out DX, AL                                ; ee
     rol eax, 008h                             ; 66 c1 c0 08
     out DX, AL                                ; ee
-    loop 008e2h                               ; e2 ed
+    loop 00938h                               ; e2 ed
     pop DS                                    ; 1f
     popad                                     ; 66 61
     mov ax, strict word 0004fh                ; b8 4f 00
@@ -1482,29 +1493,29 @@ vbe_biosfn_set_get_palette_data:             ; 0xc08c1 LB 0x64
     sal eax, 008h                             ; 66 c1 e0 08
     in AL, DX                                 ; ec
     stosd                                     ; 66 ab
-    loop 00907h                               ; e2 ee
+    loop 0095dh                               ; e2 ee
     popad                                     ; 66 61
-    jmp short 008f8h                          ; eb db
+    jmp short 0094eh                          ; eb db
     mov ax, 0014fh                            ; b8 4f 01
     retn                                      ; c3
     mov ax, 0024fh                            ; b8 4f 02
     retn                                      ; c3
-vbe_biosfn_return_protected_mode_interface: ; 0xc0925 LB 0x17
+vbe_biosfn_return_protected_mode_interface: ; 0xc097b LB 0x17
     test bl, bl                               ; 84 db
-    jne short 00938h                          ; 75 0f
+    jne short 0098eh                          ; 75 0f
     mov di, 0c000h                            ; bf 00 c0
     mov es, di                                ; 8e c7
-    mov di, 04600h                            ; bf 00 46
+    mov di, 04400h                            ; bf 00 44
     mov cx, 00115h                            ; b9 15 01
     mov ax, strict word 0004fh                ; b8 4f 00
     retn                                      ; c3
     mov ax, 0014fh                            ; b8 4f 01
     retn                                      ; c3
 
-  ; Padding 0xc4 bytes at 0xc093c
-  times 196 db 0
+  ; Padding 0x6e bytes at 0xc0992
+  times 110 db 0
 
-section _TEXT progbits vstart=0xa00 align=1 ; size=0x2f80 class=CODE group=AUTO
+section _TEXT progbits vstart=0xa00 align=1 ; size=0x2f57 class=CODE group=AUTO
 set_int_vector_:                             ; 0xc0a00 LB 0x1a
     push bx                                   ; 53
     push bp                                   ; 55
@@ -1558,7 +1569,7 @@ _vgabios_init_func:                          ; 0xc0a68 LB 0x20
     mov bp, sp                                ; 89 e5
     call 00a1ah                               ; e8 ac ff
     call 00a36h                               ; e8 c5 ff
-    call 034afh                               ; e8 3b 2a
+    call 03482h                               ; e8 0e 2a
     mov dx, strict word 00022h                ; ba 22 00
     mov ax, strict word 00010h                ; b8 10 00
     call 00a00h                               ; e8 83 ff
@@ -1585,7 +1596,7 @@ vga_get_cursor_pos_:                         ; 0xc0a88 LB 0x43
     jmp short 00ac4h                          ; eb 21
     mov dx, strict word 00060h                ; ba 60 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 e7 24
+    call 02f5ah                               ; e8 ae 24
     push SS                                   ; 16
     pop ES                                    ; 07
     mov word [es:si], ax                      ; 26 89 04
@@ -1593,7 +1604,7 @@ vga_get_cursor_pos_:                         ; 0xc0a88 LB 0x43
     add dx, dx                                ; 01 d2
     add dx, strict byte 00050h                ; 83 c2 50
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 d4 24
+    call 02f5ah                               ; e8 9b 24
     push SS                                   ; 16
     pop ES                                    ; 07
     mov word [es:bx], ax                      ; 26 89 07
@@ -1614,9 +1625,9 @@ vga_read_char_attr_:                         ; 0xc0acb LB 0xa8
     mov si, dx                                ; 89 d6
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 95 24
+    call 02f3eh                               ; e8 5c 24
     xor ah, ah                                ; 30 e4
-    call 02f50h                               ; e8 69 24
+    call 02f17h                               ; e8 30 24
     mov ch, al                                ; 88 c5
     cmp AL, strict byte 0ffh                  ; 3c ff
     je short 00b5ah                           ; 74 6d
@@ -1632,15 +1643,15 @@ vga_read_char_attr_:                         ; 0xc0acb LB 0xa8
     mov word [bp-00ch], ax                    ; 89 46 f4
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 64 24
+    call 02f3eh                               ; e8 2b 24
     movzx di, al                              ; 0f b6 f8
     inc di                                    ; 47
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 73 24
+    call 02f5ah                               ; e8 3a 24
     movzx bx, ch                              ; 0f b6 dd
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04830h], 000h                ; 80 bf 30 48 00
+    cmp byte [bx+04635h], 000h                ; 80 bf 35 46 00
     jne short 00b5ah                          ; 75 2d
     mov dx, ax                                ; 89 c2
     imul dx, di                               ; 0f af d7
@@ -1656,8 +1667,8 @@ vga_read_char_attr_:                         ; 0xc0acb LB 0xa8
     add ax, ax                                ; 01 c0
     mov dx, cx                                ; 89 ca
     add dx, ax                                ; 01 c2
-    mov ax, word [bx+04833h]                  ; 8b 87 33 48
-    call 02f93h                               ; e8 3c 24
+    mov ax, word [bx+04638h]                  ; 8b 87 38 46
+    call 02f5ah                               ; e8 03 24
     mov word [ss:si], ax                      ; 36 89 04
     lea sp, [bp-008h]                         ; 8d 66 f8
     pop di                                    ; 5f
@@ -1694,7 +1705,7 @@ vga_get_font_info_:                          ; 0xc0b73 LB 0x82
     jmp word [cs:di+00b63h]                   ; 2e ff a5 63 0b
     mov dx, strict word 0007ch                ; ba 7c 00
     xor ax, ax                                ; 31 c0
-    call 02fafh                               ; e8 19 24
+    call 02f76h                               ; e8 e0 23
     push SS                                   ; 16
     pop ES                                    ; 07
     mov di, word [bp-006h]                    ; 8b 7e fa
@@ -1702,14 +1713,14 @@ vga_get_font_info_:                          ; 0xc0b73 LB 0x82
     mov word [es:si], dx                      ; 26 89 14
     mov dx, 00085h                            ; ba 85 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 cd 23
+    call 02f3eh                               ; e8 94 23
     xor ah, ah                                ; 30 e4
     push SS                                   ; 16
     pop ES                                    ; 07
     mov word [es:bx], ax                      ; 26 89 07
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 bd 23
+    call 02f3eh                               ; e8 84 23
     xor ah, ah                                ; 30 e4
     push SS                                   ; 16
     pop ES                                    ; 07
@@ -1722,18 +1733,18 @@ vga_get_font_info_:                          ; 0xc0b73 LB 0x82
     retn 00002h                               ; c2 02 00
     mov dx, 0010ch                            ; ba 0c 01
     jmp short 00b91h                          ; eb bf
-    mov ax, 05dafh                            ; b8 af 5d
+    mov ax, 05bf2h                            ; b8 f2 5b
     mov dx, 0c000h                            ; ba 00 c0
     jmp short 00b96h                          ; eb bc
-    mov ax, 055afh                            ; b8 af 55
+    mov ax, 053f2h                            ; b8 f2 53
     jmp short 00bd5h                          ; eb f6
-    mov ax, 059afh                            ; b8 af 59
+    mov ax, 057f2h                            ; b8 f2 57
     jmp short 00bd5h                          ; eb f1
-    mov ax, 07bafh                            ; b8 af 7b
+    mov ax, 079f2h                            ; b8 f2 79
     jmp short 00bd5h                          ; eb ec
-    mov ax, 06bafh                            ; b8 af 6b
+    mov ax, 069f2h                            ; b8 f2 69
     jmp short 00bd5h                          ; eb e7
-    mov ax, 07cdch                            ; b8 dc 7c
+    mov ax, 07b1fh                            ; b8 1f 7b
     jmp short 00bd5h                          ; eb e2
     jmp short 00bc4h                          ; eb cf
 vga_read_pixel_:                             ; 0xc0bf5 LB 0x139
@@ -1747,17 +1758,17 @@ vga_read_pixel_:                             ; 0xc0bf5 LB 0x139
     mov di, cx                                ; 89 cf
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 6a 23
+    call 02f3eh                               ; e8 31 23
     xor ah, ah                                ; 30 e4
-    call 02f50h                               ; e8 3e 23
+    call 02f17h                               ; e8 05 23
     mov cl, al                                ; 88 c1
     cmp AL, strict byte 0ffh                  ; 3c ff
     je near 00d27h                            ; 0f 84 0d 01
     movzx bx, al                              ; 0f b6 d8
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04830h], 000h                ; 80 bf 30 48 00
+    cmp byte [bx+04635h], 000h                ; 80 bf 35 46 00
     je near 00d27h                            ; 0f 84 fe 00
-    mov bl, byte [bx+04831h]                  ; 8a 9f 31 48
+    mov bl, byte [bx+04636h]                  ; 8a 9f 36 46
     cmp bl, 003h                              ; 80 fb 03
     jc short 00c43h                           ; 72 11
     jbe short 00c4bh                          ; 76 17
@@ -1771,7 +1782,7 @@ vga_read_pixel_:                             ; 0xc0bf5 LB 0x139
     jmp near 00d22h                           ; e9 d7 00
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 3f 23
+    call 02f5ah                               ; e8 06 23
     imul ax, word [bp-00ah]                   ; 0f af 46 f6
     mov bx, si                                ; 89 f3
     shr bx, 003h                              ; c1 eb 03
@@ -1792,7 +1803,7 @@ vga_read_pixel_:                             ; 0xc0bf5 LB 0x139
     out DX, ax                                ; ef
     mov dx, bx                                ; 89 da
     mov ax, 0a000h                            ; b8 00 a0
-    call 02f77h                               ; e8 e9 22
+    call 02f3eh                               ; e8 b0 22
     and al, byte [bp-008h]                    ; 22 46 f8
     test al, al                               ; 84 c0
     jbe short 00c9eh                          ; 76 09
@@ -1813,10 +1824,10 @@ vga_read_pixel_:                             ; 0xc0bf5 LB 0x139
     add bh, 020h                              ; 80 c7 20
     mov dx, bx                                ; 89 da
     mov ax, 0b800h                            ; b8 00 b8
-    call 02f77h                               ; e8 b4 22
+    call 02f3eh                               ; e8 7b 22
     movzx bx, cl                              ; 0f b6 d9
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04832h], 002h                ; 80 bf 32 48 02
+    cmp byte [bx+04637h], 002h                ; 80 bf 37 46 02
     jne short 00cebh                          ; 75 1b
     mov cx, si                                ; 89 f1
     xor ch, ch                                ; 30 ed
@@ -1843,13 +1854,13 @@ vga_read_pixel_:                             ; 0xc0bf5 LB 0x139
     jmp short 00d24h                          ; eb 20
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 86 22
+    call 02f5ah                               ; e8 4d 22
     sal ax, 003h                              ; c1 e0 03
     imul ax, word [bp-00ah]                   ; 0f af 46 f6
     mov dx, si                                ; 89 f2
     add dx, ax                                ; 01 c2
     mov ax, 0a000h                            ; b8 00 a0
-    call 02f77h                               ; e8 59 22
+    call 02f3eh                               ; e8 20 22
     mov ch, al                                ; 88 c5
     jmp short 00d24h                          ; eb 02
     xor ch, ch                                ; 30 ed
@@ -1956,14 +1967,14 @@ biosfn_set_cursor_shape_:                    ; 0xc0dba LB 0xa4
     add bx, si                                ; 01 f3
     mov dx, strict word 00060h                ; ba 60 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 c0 21
+    call 02f68h                               ; e8 87 21
     mov dx, 00089h                            ; ba 89 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 8d 21
+    call 02f3eh                               ; e8 54 21
     mov bl, al                                ; 88 c3
     mov dx, 00085h                            ; ba 85 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 9e 21
+    call 02f5ah                               ; e8 65 21
     mov dx, ax                                ; 89 c2
     test bl, 001h                             ; f6 c3 01
     je short 00e33h                           ; 74 37
@@ -1994,7 +2005,7 @@ biosfn_set_cursor_shape_:                    ; 0xc0dba LB 0xa4
     mov cl, al                                ; 88 c1
     mov dx, strict word 00063h                ; ba 63 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 57 21
+    call 02f5ah                               ; e8 1e 21
     mov bx, ax                                ; 89 c3
     mov AL, strict byte 00ah                  ; b0 0a
     mov dx, bx                                ; 89 da
@@ -2033,19 +2044,19 @@ biosfn_set_cursor_pos_:                      ; 0xc0e5e LB 0xa2
     add dx, strict byte 00050h                ; 83 c2 50
     mov bx, cx                                ; 89 cb
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 20 21
+    call 02f68h                               ; e8 e7 20
     mov dx, strict word 00062h                ; ba 62 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 ed 20
+    call 02f3eh                               ; e8 b4 20
     cmp al, byte [bp-008h]                    ; 3a 46 f8
     jne short 00ef8h                          ; 75 69
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 fb 20
+    call 02f5ah                               ; e8 c2 20
     mov bx, ax                                ; 89 c3
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 d4 20
+    call 02f3eh                               ; e8 9b 20
     xor ah, ah                                ; 30 e4
     mov dx, ax                                ; 89 c2
     inc dx                                    ; 42
@@ -2065,7 +2076,7 @@ biosfn_set_cursor_pos_:                      ; 0xc0e5e LB 0xa2
     add si, bx                                ; 01 de
     mov dx, strict word 00063h                ; ba 63 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 bd 20
+    call 02f5ah                               ; e8 84 20
     mov bx, ax                                ; 89 c3
     mov AL, strict byte 00eh                  ; b0 0e
     mov dx, bx                                ; 89 da
@@ -2104,9 +2115,9 @@ biosfn_set_active_page_:                     ; 0xc0f00 LB 0xdc
     jnbe near 00fd2h                          ; 0f 87 c0 00
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 5c 20
+    call 02f3eh                               ; e8 23 20
     xor ah, ah                                ; 30 e4
-    call 02f50h                               ; e8 30 20
+    call 02f17h                               ; e8 f7 1f
     mov ch, al                                ; 88 c5
     cmp AL, strict byte 0ffh                  ; 3c ff
     je near 00fd2h                            ; 0f 84 aa 00
@@ -2117,15 +2128,15 @@ biosfn_set_active_page_:                     ; 0xc0f00 LB 0xdc
     movzx bx, ch                              ; 0f b6 dd
     mov si, bx                                ; 89 de
     sal si, 003h                              ; c1 e6 03
-    cmp byte [si+04830h], 000h                ; 80 bc 30 48 00
+    cmp byte [si+04635h], 000h                ; 80 bc 35 46 00
     jne short 00f83h                          ; 75 40
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 47 20
+    call 02f5ah                               ; e8 0e 20
     mov bx, ax                                ; 89 c3
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 20 20
+    call 02f3eh                               ; e8 e7 1f
     xor ah, ah                                ; 30 e4
     inc ax                                    ; 40
     mov si, bx                                ; 89 de
@@ -2139,19 +2150,19 @@ biosfn_set_active_page_:                     ; 0xc0f00 LB 0xdc
     imul bx, di                               ; 0f af df
     mov dx, strict word 0004eh                ; ba 4e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 2a 20
+    call 02f68h                               ; e8 f1 1f
     or si, 000ffh                             ; 81 ce ff 00
     lea bx, [si+001h]                         ; 8d 5c 01
     imul bx, di                               ; 0f af df
     jmp short 00f95h                          ; eb 12
-    movzx bx, byte [bx+048afh]                ; 0f b6 9f af 48
+    movzx bx, byte [bx+046b4h]                ; 0f b6 9f b4 46
     sal bx, 006h                              ; c1 e3 06
     movzx ax, cl                              ; 0f b6 c1
-    mov bx, word [bx+048c6h]                  ; 8b 9f c6 48
+    mov bx, word [bx+046cbh]                  ; 8b 9f cb 46
     imul bx, ax                               ; 0f af d8
     mov dx, strict word 00063h                ; ba 63 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 f5 1f
+    call 02f5ah                               ; e8 bc 1f
     mov si, ax                                ; 89 c6
     mov AL, strict byte 00ch                  ; b0 0c
     mov dx, si                                ; 89 f2
@@ -2172,7 +2183,7 @@ biosfn_set_active_page_:                     ; 0xc0f00 LB 0xdc
     mov bx, si                                ; 89 f3
     mov dx, strict word 00062h                ; ba 62 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 bb 1f
+    call 02f4ch                               ; e8 82 1f
     mov dx, word [bp-00eh]                    ; 8b 56 f2
     mov ax, si                                ; 89 f0
     call 00e5eh                               ; e8 8c fe
@@ -2184,7 +2195,7 @@ biosfn_set_active_page_:                     ; 0xc0f00 LB 0xdc
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
+biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x391
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -2193,10 +2204,10 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     push si                                   ; 56
     push di                                   ; 57
     sub sp, strict byte 00010h                ; 83 ec 10
-    mov byte [bp-00eh], al                    ; 88 46 f2
+    mov byte [bp-00ch], al                    ; 88 46 f4
     and AL, strict byte 080h                  ; 24 80
     mov byte [bp-010h], al                    ; 88 46 f0
-    call 007a4h                               ; e8 b2 f7
+    call 007fah                               ; e8 08 f8
     test ax, ax                               ; 85 c0
     je short 01002h                           ; 74 0c
     mov AL, strict byte 007h                  ; b0 07
@@ -2205,63 +2216,66 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     xor al, al                                ; 30 c0
     mov dx, 003c5h                            ; ba c5 03
     out DX, AL                                ; ee
-    and byte [bp-00eh], 07fh                  ; 80 66 f2 7f
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 02f50h                               ; e8 43 1f
+    and byte [bp-00ch], 07fh                  ; 80 66 f4 7f
+    cmp byte [bp-00ch], 007h                  ; 80 7e f4 07
+    jne short 01010h                          ; 75 04
+    mov byte [bp-00ch], 000h                  ; c6 46 f4 00
+    movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
+    call 02f17h                               ; e8 00 1f
     mov byte [bp-012h], al                    ; 88 46 ee
     cmp AL, strict byte 0ffh                  ; 3c ff
-    je near 01359h                            ; 0f 84 43 03
+    je near 01363h                            ; 0f 84 43 03
     movzx si, al                              ; 0f b6 f0
-    mov al, byte [si+048afh]                  ; 8a 84 af 48
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov al, byte [si+046b4h]                  ; 8a 84 b4 46
+    mov byte [bp-00eh], al                    ; 88 46 f2
     movzx bx, al                              ; 0f b6 d8
     sal bx, 006h                              ; c1 e3 06
-    movzx ax, byte [bx+048c3h]                ; 0f b6 87 c3 48
+    movzx ax, byte [bx+046c8h]                ; 0f b6 87 c8 46
     mov word [bp-018h], ax                    ; 89 46 e8
-    movzx ax, byte [bx+048c4h]                ; 0f b6 87 c4 48
+    movzx ax, byte [bx+046c9h]                ; 0f b6 87 c9 46
     mov word [bp-016h], ax                    ; 89 46 ea
-    movzx ax, byte [bx+048c5h]                ; 0f b6 87 c5 48
+    movzx ax, byte [bx+046cah]                ; 0f b6 87 ca 46
     mov word [bp-014h], ax                    ; 89 46 ec
     mov dx, 00087h                            ; ba 87 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 30 1f
+    call 02f3eh                               ; e8 ed 1e
     mov dx, 00088h                            ; ba 88 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 27 1f
+    call 02f3eh                               ; e8 e4 1e
     mov dx, 00089h                            ; ba 89 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 1e 1f
+    call 02f3eh                               ; e8 db 1e
     mov ah, al                                ; 88 c4
     test AL, strict byte 008h                 ; a8 08
-    jne near 010ebh                           ; 0f 85 8a 00
+    jne near 010f5h                           ; 0f 85 8a 00
     mov bx, si                                ; 89 f3
     sal bx, 003h                              ; c1 e3 03
-    mov al, byte [bx+04835h]                  ; 8a 87 35 48
+    mov al, byte [bx+0463ah]                  ; 8a 87 3a 46
     mov dx, 003c6h                            ; ba c6 03
     out DX, AL                                ; ee
     xor al, al                                ; 30 c0
     mov dx, 003c8h                            ; ba c8 03
     out DX, AL                                ; ee
-    mov bl, byte [bx+04836h]                  ; 8a 9f 36 48
+    mov bl, byte [bx+0463bh]                  ; 8a 9f 3b 46
     cmp bl, 001h                              ; 80 fb 01
-    jc short 0108bh                           ; 72 0e
-    jbe short 01094h                          ; 76 15
+    jc short 01095h                           ; 72 0e
+    jbe short 0109eh                          ; 76 15
     cmp bl, 003h                              ; 80 fb 03
-    je short 0109eh                           ; 74 1a
+    je short 010a8h                           ; 74 1a
     cmp bl, 002h                              ; 80 fb 02
-    je short 01099h                           ; 74 10
-    jmp short 010a1h                          ; eb 16
+    je short 010a3h                           ; 74 10
+    jmp short 010abh                          ; eb 16
     test bl, bl                               ; 84 db
-    jne short 010a1h                          ; 75 12
-    mov di, 05043h                            ; bf 43 50
-    jmp short 010a1h                          ; eb 0d
-    mov di, 05103h                            ; bf 03 51
-    jmp short 010a1h                          ; eb 08
-    mov di, 051c3h                            ; bf c3 51
-    jmp short 010a1h                          ; eb 03
-    mov di, 05283h                            ; bf 83 52
+    jne short 010abh                          ; 75 12
+    mov di, 04e48h                            ; bf 48 4e
+    jmp short 010abh                          ; eb 0d
+    mov di, 04f08h                            ; bf 08 4f
+    jmp short 010abh                          ; eb 08
+    mov di, 04fc8h                            ; bf c8 4f
+    jmp short 010abh                          ; eb 03
+    mov di, 05088h                            ; bf 88 50
     xor bx, bx                                ; 31 db
-    jmp short 010b4h                          ; eb 0f
+    jmp short 010beh                          ; eb 0f
     xor al, al                                ; 30 c0
     mov dx, 003c9h                            ; ba c9 03
     out DX, AL                                ; ee
@@ -2269,13 +2283,13 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     out DX, AL                                ; ee
     inc bx                                    ; 43
     cmp bx, 00100h                            ; 81 fb 00 01
-    jnc short 010deh                          ; 73 2a
+    jnc short 010e8h                          ; 73 2a
     movzx si, byte [bp-012h]                  ; 0f b6 76 ee
     sal si, 003h                              ; c1 e6 03
-    movzx si, byte [si+04836h]                ; 0f b6 b4 36 48
-    movzx dx, byte [si+048bfh]                ; 0f b6 94 bf 48
+    movzx si, byte [si+0463bh]                ; 0f b6 b4 3b 46
+    movzx dx, byte [si+046c4h]                ; 0f b6 94 c4 46
     cmp bx, dx                                ; 39 d3
-    jnbe short 010a5h                         ; 77 dc
+    jnbe short 010afh                         ; 77 dc
     imul si, bx, strict byte 00003h           ; 6b f3 03
     add si, di                                ; 01 fe
     mov al, byte [si]                         ; 8a 04
@@ -2285,30 +2299,30 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     out DX, AL                                ; ee
     mov al, byte [si+002h]                    ; 8a 44 02
     out DX, AL                                ; ee
-    jmp short 010adh                          ; eb cf
+    jmp short 010b7h                          ; eb cf
     test ah, 002h                             ; f6 c4 02
-    je short 010ebh                           ; 74 08
+    je short 010f5h                           ; 74 08
     mov dx, 00100h                            ; ba 00 01
     xor ax, ax                                ; 31 c0
-    call 00d2eh                               ; e8 43 fc
+    call 00d2eh                               ; e8 39 fc
     mov dx, 003dah                            ; ba da 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     xor bx, bx                                ; 31 db
-    jmp short 010fah                          ; eb 05
+    jmp short 01104h                          ; eb 05
     cmp bx, strict byte 00013h                ; 83 fb 13
-    jnbe short 01111h                         ; 77 17
+    jnbe short 0111bh                         ; 77 17
     mov al, bl                                ; 88 d8
     mov dx, 003c0h                            ; ba c0 03
     out DX, AL                                ; ee
-    movzx si, byte [bp-00ch]                  ; 0f b6 76 f4
+    movzx si, byte [bp-00eh]                  ; 0f b6 76 f2
     sal si, 006h                              ; c1 e6 06
     add si, bx                                ; 01 de
-    mov al, byte [si+048e6h]                  ; 8a 84 e6 48
+    mov al, byte [si+046ebh]                  ; 8a 84 eb 46
     out DX, AL                                ; ee
     inc bx                                    ; 43
-    jmp short 010f5h                          ; eb e4
+    jmp short 010ffh                          ; eb e4
     mov AL, strict byte 014h                  ; b0 14
     mov dx, 003c0h                            ; ba c0 03
     out DX, AL                                ; ee
@@ -2320,63 +2334,63 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     mov dx, 003c5h                            ; ba c5 03
     out DX, AL                                ; ee
     mov bx, strict word 00001h                ; bb 01 00
-    jmp short 0112eh                          ; eb 05
+    jmp short 01138h                          ; eb 05
     cmp bx, strict byte 00004h                ; 83 fb 04
-    jnbe short 01148h                         ; 77 1a
+    jnbe short 01152h                         ; 77 1a
     mov al, bl                                ; 88 d8
     mov dx, 003c4h                            ; ba c4 03
     out DX, AL                                ; ee
-    movzx si, byte [bp-00ch]                  ; 0f b6 76 f4
+    movzx si, byte [bp-00eh]                  ; 0f b6 76 f2
     sal si, 006h                              ; c1 e6 06
     add si, bx                                ; 01 de
-    mov al, byte [si+048c7h]                  ; 8a 84 c7 48
+    mov al, byte [si+046cch]                  ; 8a 84 cc 46
     mov dx, 003c5h                            ; ba c5 03
     out DX, AL                                ; ee
     inc bx                                    ; 43
-    jmp short 01129h                          ; eb e1
+    jmp short 01133h                          ; eb e1
     xor bx, bx                                ; 31 db
-    jmp short 01151h                          ; eb 05
+    jmp short 0115bh                          ; eb 05
     cmp bx, strict byte 00008h                ; 83 fb 08
-    jnbe short 0116bh                         ; 77 1a
+    jnbe short 01175h                         ; 77 1a
     mov al, bl                                ; 88 d8
     mov dx, 003ceh                            ; ba ce 03
     out DX, AL                                ; ee
-    movzx si, byte [bp-00ch]                  ; 0f b6 76 f4
+    movzx si, byte [bp-00eh]                  ; 0f b6 76 f2
     sal si, 006h                              ; c1 e6 06
     add si, bx                                ; 01 de
-    mov al, byte [si+048fah]                  ; 8a 84 fa 48
+    mov al, byte [si+046ffh]                  ; 8a 84 ff 46
     mov dx, 003cfh                            ; ba cf 03
     out DX, AL                                ; ee
     inc bx                                    ; 43
-    jmp short 0114ch                          ; eb e1
+    jmp short 01156h                          ; eb e1
     movzx bx, byte [bp-012h]                  ; 0f b6 5e ee
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04831h], 001h                ; 80 bf 31 48 01
-    jne short 0117eh                          ; 75 05
+    cmp byte [bx+04636h], 001h                ; 80 bf 36 46 01
+    jne short 01188h                          ; 75 05
     mov dx, 003b4h                            ; ba b4 03
-    jmp short 01181h                          ; eb 03
+    jmp short 0118bh                          ; eb 03
     mov dx, 003d4h                            ; ba d4 03
     mov si, dx                                ; 89 d6
     mov ax, strict word 00011h                ; b8 11 00
     out DX, ax                                ; ef
     xor bx, bx                                ; 31 db
-    jmp short 01190h                          ; eb 05
+    jmp short 0119ah                          ; eb 05
     cmp bx, strict byte 00018h                ; 83 fb 18
-    jnbe short 011abh                         ; 77 1b
+    jnbe short 011b5h                         ; 77 1b
     mov al, bl                                ; 88 d8
     mov dx, si                                ; 89 f2
     out DX, AL                                ; ee
-    movzx cx, byte [bp-00ch]                  ; 0f b6 4e f4
+    movzx cx, byte [bp-00eh]                  ; 0f b6 4e f2
     sal cx, 006h                              ; c1 e1 06
     mov di, cx                                ; 89 cf
     add di, bx                                ; 01 df
     lea dx, [si+001h]                         ; 8d 54 01
-    mov al, byte [di+048cdh]                  ; 8a 85 cd 48
+    mov al, byte [di+046d2h]                  ; 8a 85 d2 46
     out DX, AL                                ; ee
     inc bx                                    ; 43
-    jmp short 0118bh                          ; eb e0
+    jmp short 01195h                          ; eb e0
     mov bx, cx                                ; 89 cb
-    mov al, byte [bx+048cch]                  ; 8a 87 cc 48
+    mov al, byte [bx+046d1h]                  ; 8a 87 d1 46
     mov dx, 003c2h                            ; ba c2 03
     out DX, AL                                ; ee
     mov AL, strict byte 020h                  ; b0 20
@@ -2387,29 +2401,29 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 01226h                          ; 75 5f
+    jne short 01230h                          ; 75 5f
     movzx bx, byte [bp-012h]                  ; 0f b6 5e ee
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04830h], 000h                ; 80 bf 30 48 00
-    jne short 011e8h                          ; 75 13
-    mov es, [bx+04833h]                       ; 8e 87 33 48
+    cmp byte [bx+04635h], 000h                ; 80 bf 35 46 00
+    jne short 011f2h                          ; 75 13
+    mov es, [bx+04638h]                       ; 8e 87 38 46
     mov cx, 04000h                            ; b9 00 40
     mov ax, 00720h                            ; b8 20 07
     xor di, di                                ; 31 ff
     cld                                       ; fc
-    jcxz 011e6h                               ; e3 02
+    jcxz 011f0h                               ; e3 02
     rep stosw                                 ; f3 ab
-    jmp short 01226h                          ; eb 3e
-    cmp byte [bp-00eh], 00dh                  ; 80 7e f2 0d
-    jnc short 01200h                          ; 73 12
-    mov es, [bx+04833h]                       ; 8e 87 33 48
+    jmp short 01230h                          ; eb 3e
+    cmp byte [bp-00ch], 00dh                  ; 80 7e f4 0d
+    jnc short 0120ah                          ; 73 12
+    mov es, [bx+04638h]                       ; 8e 87 38 46
     mov cx, 04000h                            ; b9 00 40
     xor ax, ax                                ; 31 c0
     xor di, di                                ; 31 ff
     cld                                       ; fc
-    jcxz 011feh                               ; e3 02
+    jcxz 01208h                               ; e3 02
     rep stosw                                 ; f3 ab
-    jmp short 01226h                          ; eb 26
+    jmp short 01230h                          ; eb 26
     mov AL, strict byte 002h                  ; b0 02
     mov dx, 003c4h                            ; ba c4 03
     out DX, AL                                ; ee
@@ -2420,98 +2434,98 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     mov word [bp-01ah], ax                    ; 89 46 e6
     mov AL, strict byte 00fh                  ; b0 0f
     out DX, AL                                ; ee
-    mov es, [bx+04833h]                       ; 8e 87 33 48
+    mov es, [bx+04638h]                       ; 8e 87 38 46
     mov cx, 08000h                            ; b9 00 80
     xor ax, ax                                ; 31 c0
     xor di, di                                ; 31 ff
     cld                                       ; fc
-    jcxz 01222h                               ; e3 02
+    jcxz 0122ch                               ; e3 02
     rep stosw                                 ; f3 ab
     mov al, byte [bp-01ah]                    ; 8a 46 e6
     out DX, AL                                ; ee
-    movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
+    movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 52 1d
+    call 02f4ch                               ; e8 0f 1d
     mov bx, word [bp-018h]                    ; 8b 5e e8
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 62 1d
-    movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
+    call 02f68h                               ; e8 1f 1d
+    movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
     sal bx, 006h                              ; c1 e3 06
-    mov bx, word [bx+048c6h]                  ; 8b 9f c6 48
+    mov bx, word [bx+046cbh]                  ; 8b 9f cb 46
     mov dx, strict word 0004ch                ; ba 4c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 4e 1d
+    call 02f68h                               ; e8 0b 1d
     mov bx, si                                ; 89 f3
     mov dx, strict word 00063h                ; ba 63 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 43 1d
+    call 02f68h                               ; e8 00 1d
     movzx bx, byte [bp-016h]                  ; 0f b6 5e ea
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 1a 1d
+    call 02f4ch                               ; e8 d7 1c
     mov bx, word [bp-014h]                    ; 8b 5e ec
     mov dx, 00085h                            ; ba 85 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 2a 1d
+    call 02f68h                               ; e8 e7 1c
     mov al, byte [bp-010h]                    ; 8a 46 f0
     or AL, strict byte 060h                   ; 0c 60
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00087h                            ; ba 87 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 fd 1c
+    call 02f4ch                               ; e8 ba 1c
     mov bx, 000f9h                            ; bb f9 00
     mov dx, 00088h                            ; ba 88 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 f1 1c
+    call 02f4ch                               ; e8 ae 1c
     mov dx, 00089h                            ; ba 89 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 da 1c
+    call 02f3eh                               ; e8 97 1c
     and AL, strict byte 07fh                  ; 24 7f
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00089h                            ; ba 89 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 da 1c
+    call 02f4ch                               ; e8 97 1c
     mov bx, strict word 00008h                ; bb 08 00
     mov dx, 0008ah                            ; ba 8a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 ce 1c
+    call 02f4ch                               ; e8 8b 1c
     mov cx, ds                                ; 8c d9
-    mov bx, 05593h                            ; bb 93 55
+    mov bx, 053d6h                            ; bb d6 53
     mov dx, 000a8h                            ; ba a8 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fc1h                               ; e8 fc 1c
+    call 02f88h                               ; e8 b9 1c
     xor bx, bx                                ; 31 db
     mov dx, strict word 00065h                ; ba 65 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 b5 1c
+    call 02f4ch                               ; e8 72 1c
     xor bx, bx                                ; 31 db
     mov dx, strict word 00066h                ; ba 66 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 aa 1c
+    call 02f4ch                               ; e8 67 1c
     movzx bx, byte [bp-012h]                  ; 0f b6 5e ee
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04830h], 000h                ; 80 bf 30 48 00
-    jne short 012f2h                          ; 75 09
+    cmp byte [bx+04635h], 000h                ; 80 bf 35 46 00
+    jne short 012fch                          ; 75 09
     mov dx, strict word 00007h                ; ba 07 00
     mov ax, strict word 00006h                ; b8 06 00
-    call 00dbah                               ; e8 c8 fa
+    call 00dbah                               ; e8 be fa
     xor bx, bx                                ; 31 db
-    jmp short 012fbh                          ; eb 05
+    jmp short 01305h                          ; eb 05
     cmp bx, strict byte 00008h                ; 83 fb 08
-    jnc short 01306h                          ; 73 0b
+    jnc short 01310h                          ; 73 0b
     movzx ax, bl                              ; 0f b6 c3
     xor dx, dx                                ; 31 d2
-    call 00e5eh                               ; e8 5b fb
+    call 00e5eh                               ; e8 51 fb
     inc bx                                    ; 43
-    jmp short 012f6h                          ; eb f0
+    jmp short 01300h                          ; eb f0
     xor ax, ax                                ; 31 c0
-    call 00f00h                               ; e8 f5 fb
+    call 00f00h                               ; e8 eb fb
     movzx bx, byte [bp-012h]                  ; 0f b6 5e ee
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04830h], 000h                ; 80 bf 30 48 00
-    jne short 01329h                          ; 75 10
+    cmp byte [bx+04635h], 000h                ; 80 bf 35 46 00
+    jne short 01333h                          ; 75 10
     xor bl, bl                                ; 30 db
     mov AL, strict byte 004h                  ; b0 04
     mov AH, strict byte 011h                  ; b4 11
@@ -2520,24 +2534,24 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     mov AL, strict byte 003h                  ; b0 03
     mov AH, strict byte 011h                  ; b4 11
     int 010h                                  ; cd 10
-    mov dx, 059afh                            ; ba af 59
+    mov dx, 057f2h                            ; ba f2 57
     mov ax, strict word 0001fh                ; b8 1f 00
-    call 00a00h                               ; e8 ce f6
+    call 00a00h                               ; e8 c4 f6
     mov ax, word [bp-014h]                    ; 8b 46 ec
     cmp ax, strict word 00010h                ; 3d 10 00
-    je short 01354h                           ; 74 1a
+    je short 0135eh                           ; 74 1a
     cmp ax, strict word 0000eh                ; 3d 0e 00
-    je short 0134fh                           ; 74 10
+    je short 01359h                           ; 74 10
     cmp ax, strict word 00008h                ; 3d 08 00
-    jne short 01359h                          ; 75 15
-    mov dx, 055afh                            ; ba af 55
+    jne short 01363h                          ; 75 15
+    mov dx, 053f2h                            ; ba f2 53
     mov ax, strict word 00043h                ; b8 43 00
-    call 00a00h                               ; e8 b3 f6
-    jmp short 01359h                          ; eb 0a
-    mov dx, 05dafh                            ; ba af 5d
-    jmp short 01347h                          ; eb f3
-    mov dx, 06bafh                            ; ba af 6b
-    jmp short 01347h                          ; eb ee
+    call 00a00h                               ; e8 a9 f6
+    jmp short 01363h                          ; eb 0a
+    mov dx, 05bf2h                            ; ba f2 5b
+    jmp short 01351h                          ; eb f3
+    mov dx, 069f2h                            ; ba f2 69
+    jmp short 01351h                          ; eb ee
     lea sp, [bp-00ah]                         ; 8d 66 f6
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -2546,7 +2560,7 @@ biosfn_set_video_mode_:                      ; 0xc0fdc LB 0x387
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-vgamem_copy_pl4_:                            ; 0xc1363 LB 0x76
+vgamem_copy_pl4_:                            ; 0xc136d LB 0x76
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -2572,7 +2586,7 @@ vgamem_copy_pl4_:                            ; 0xc1363 LB 0x76
     out DX, ax                                ; ef
     xor bl, bl                                ; 30 db
     cmp bl, byte [bp+006h]                    ; 3a 5e 06
-    jnc short 013c9h                          ; 73 29
+    jnc short 013d3h                          ; 73 29
     movzx cx, bh                              ; 0f b6 cf
     movzx si, bl                              ; 0f b6 f3
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
@@ -2584,14 +2598,14 @@ vgamem_copy_pl4_:                            ; 0xc1363 LB 0x76
     mov dx, 0a000h                            ; ba 00 a0
     mov es, dx                                ; 8e c2
     cld                                       ; fc
-    jcxz 013c5h                               ; e3 06
+    jcxz 013cfh                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
     pop DS                                    ; 1f
     db  0feh, 0c3h
     ; inc bl                                    ; fe c3
-    jmp short 0139bh                          ; eb d2
+    jmp short 013a5h                          ; eb d2
     mov ax, strict word 00005h                ; b8 05 00
     mov dx, 003ceh                            ; ba ce 03
     out DX, ax                                ; ef
@@ -2600,7 +2614,7 @@ vgamem_copy_pl4_:                            ; 0xc1363 LB 0x76
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-vgamem_fill_pl4_:                            ; 0xc13d9 LB 0x61
+vgamem_fill_pl4_:                            ; 0xc13e3 LB 0x61
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push di                                   ; 57
@@ -2621,7 +2635,7 @@ vgamem_fill_pl4_:                            ; 0xc13d9 LB 0x61
     out DX, ax                                ; ef
     xor bl, bl                                ; 30 db
     cmp bl, byte [bp+004h]                    ; 3a 5e 04
-    jnc short 0142bh                          ; 73 22
+    jnc short 01435h                          ; 73 22
     movzx cx, byte [bp-004h]                  ; 0f b6 4e fc
     movzx ax, byte [bp+006h]                  ; 0f b6 46 06
     movzx dx, bl                              ; 0f b6 d3
@@ -2631,11 +2645,11 @@ vgamem_fill_pl4_:                            ; 0xc13d9 LB 0x61
     mov dx, 0a000h                            ; ba 00 a0
     mov es, dx                                ; 8e c2
     cld                                       ; fc
-    jcxz 01427h                               ; e3 02
+    jcxz 01431h                               ; e3 02
     rep stosb                                 ; f3 aa
     db  0feh, 0c3h
     ; inc bl                                    ; fe c3
-    jmp short 01404h                          ; eb d9
+    jmp short 0140eh                          ; eb d9
     mov ax, strict word 00005h                ; b8 05 00
     mov dx, 003ceh                            ; ba ce 03
     out DX, ax                                ; ef
@@ -2643,7 +2657,7 @@ vgamem_fill_pl4_:                            ; 0xc13d9 LB 0x61
     pop di                                    ; 5f
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-vgamem_copy_cga_:                            ; 0xc143a LB 0xa4
+vgamem_copy_cga_:                            ; 0xc1444 LB 0xa4
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -2668,9 +2682,9 @@ vgamem_copy_cga_:                            ; 0xc143a LB 0xa4
     mov word [bp-008h], si                    ; 89 76 f8
     xor bl, bl                                ; 30 db
     cmp bl, byte [bp+006h]                    ; 3a 5e 06
-    jnc short 014d5h                          ; 73 61
+    jnc short 014dfh                          ; 73 61
     test bl, 001h                             ; f6 c3 01
-    je short 014aah                           ; 74 31
+    je short 014b4h                           ; 74 31
     movzx cx, bh                              ; 0f b6 cf
     movzx si, bl                              ; 0f b6 f3
     sar si, 1                                 ; d1 fe
@@ -2685,12 +2699,12 @@ vgamem_copy_cga_:                            ; 0xc143a LB 0xa4
     mov dx, 0b800h                            ; ba 00 b8
     mov es, dx                                ; 8e c2
     cld                                       ; fc
-    jcxz 014a8h                               ; e3 06
+    jcxz 014b2h                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
     pop DS                                    ; 1f
-    jmp short 014d1h                          ; eb 27
+    jmp short 014dbh                          ; eb 27
     movzx cx, bh                              ; 0f b6 cf
     movzx ax, bl                              ; 0f b6 c3
     sar ax, 1                                 ; d1 f8
@@ -2703,20 +2717,20 @@ vgamem_copy_cga_:                            ; 0xc143a LB 0xa4
     mov dx, 0b800h                            ; ba 00 b8
     mov es, dx                                ; 8e c2
     cld                                       ; fc
-    jcxz 014d1h                               ; e3 06
+    jcxz 014dbh                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
     pop DS                                    ; 1f
     db  0feh, 0c3h
     ; inc bl                                    ; fe c3
-    jmp short 0146fh                          ; eb 9a
+    jmp short 01479h                          ; eb 9a
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-vgamem_fill_cga_:                            ; 0xc14de LB 0x8a
+vgamem_fill_cga_:                            ; 0xc14e8 LB 0x8a
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -2735,9 +2749,9 @@ vgamem_fill_cga_:                            ; 0xc14de LB 0x8a
     add si, dx                                ; 01 d6
     xor bl, bl                                ; 30 db
     cmp bl, byte [bp+004h]                    ; 3a 5e 04
-    jnc short 0155fh                          ; 73 57
+    jnc short 01569h                          ; 73 57
     test bl, 001h                             ; f6 c3 01
-    je short 0153ch                           ; 74 2f
+    je short 01546h                           ; 74 2f
     movzx cx, byte [bp-006h]                  ; 0f b6 4e fa
     movzx ax, byte [bp+006h]                  ; 0f b6 46 06
     movzx dx, bl                              ; 0f b6 d3
@@ -2752,9 +2766,9 @@ vgamem_fill_cga_:                            ; 0xc14de LB 0x8a
     mov dx, 0b800h                            ; ba 00 b8
     mov es, dx                                ; 8e c2
     cld                                       ; fc
-    jcxz 0153ah                               ; e3 02
+    jcxz 01544h                               ; e3 02
     rep stosb                                 ; f3 aa
-    jmp short 0155bh                          ; eb 1f
+    jmp short 01565h                          ; eb 1f
     movzx cx, byte [bp-006h]                  ; 0f b6 4e fa
     movzx ax, byte [bp+006h]                  ; 0f b6 46 06
     movzx di, bl                              ; 0f b6 fb
@@ -2765,17 +2779,17 @@ vgamem_fill_cga_:                            ; 0xc14de LB 0x8a
     mov dx, 0b800h                            ; ba 00 b8
     mov es, dx                                ; 8e c2
     cld                                       ; fc
-    jcxz 0155bh                               ; e3 02
+    jcxz 01565h                               ; e3 02
     rep stosb                                 ; f3 aa
     db  0feh, 0c3h
     ; inc bl                                    ; fe c3
-    jmp short 01503h                          ; eb a4
+    jmp short 0150dh                          ; eb a4
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-biosfn_scroll_:                              ; 0xc1568 LB 0x506
+biosfn_scroll_:                              ; 0xc1572 LB 0x506
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -2786,49 +2800,49 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     mov byte [bp-008h], bl                    ; 88 5e f8
     mov byte [bp-006h], cl                    ; 88 4e fa
     cmp bl, byte [bp+004h]                    ; 3a 5e 04
-    jnbe near 01a65h                          ; 0f 87 e2 04
+    jnbe near 01a6fh                          ; 0f 87 e2 04
     cmp cl, byte [bp+006h]                    ; 3a 4e 06
-    jnbe near 01a65h                          ; 0f 87 db 04
+    jnbe near 01a6fh                          ; 0f 87 db 04
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 e4 19
+    call 02f3eh                               ; e8 a1 19
     xor ah, ah                                ; 30 e4
-    call 02f50h                               ; e8 b8 19
+    call 02f17h                               ; e8 75 19
     mov byte [bp-00eh], al                    ; 88 46 f2
     cmp AL, strict byte 0ffh                  ; 3c ff
-    je near 01a65h                            ; 0f 84 c4 04
+    je near 01a6fh                            ; 0f 84 c4 04
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 cd 19
+    call 02f3eh                               ; e8 8a 19
     movzx cx, al                              ; 0f b6 c8
     inc cx                                    ; 41
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 dc 19
+    call 02f5ah                               ; e8 99 19
     mov word [bp-016h], ax                    ; 89 46 ea
     cmp byte [bp+008h], 0ffh                  ; 80 7e 08 ff
-    jne short 015cch                          ; 75 0c
+    jne short 015d6h                          ; 75 0c
     mov dx, strict word 00062h                ; ba 62 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 ae 19
+    call 02f3eh                               ; e8 6b 19
     mov byte [bp+008h], al                    ; 88 46 08
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     cmp ax, cx                                ; 39 c8
-    jc short 015dbh                           ; 72 07
+    jc short 015e5h                           ; 72 07
     mov al, cl                                ; 88 c8
     db  0feh, 0c8h
     ; dec al                                    ; fe c8
     mov byte [bp+004h], al                    ; 88 46 04
     movzx ax, byte [bp+006h]                  ; 0f b6 46 06
     cmp ax, word [bp-016h]                    ; 3b 46 ea
-    jc short 015ech                           ; 72 08
+    jc short 015f6h                           ; 72 08
     mov al, byte [bp-016h]                    ; 8a 46 ea
     db  0feh, 0c8h
     ; dec al                                    ; fe c8
     mov byte [bp+006h], al                    ; 88 46 06
     movzx ax, byte [bp-010h]                  ; 0f b6 46 f0
     cmp ax, cx                                ; 39 c8
-    jbe short 015f8h                          ; 76 04
+    jbe short 01602h                          ; 76 04
     mov byte [bp-010h], 000h                  ; c6 46 f0 00
     mov al, byte [bp+006h]                    ; 8a 46 06
     sub al, byte [bp-006h]                    ; 2a 46 fa
@@ -2846,8 +2860,8 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     mov word [bp-01ah], ax                    ; 89 46 e6
     mov ax, word [bp-016h]                    ; 8b 46 ea
     imul ax, cx                               ; 0f af c1
-    cmp byte [di+04830h], 000h                ; 80 bd 30 48 00
-    jne near 017c7h                           ; 0f 85 9f 01
+    cmp byte [di+04635h], 000h                ; 80 bd 35 46 00
+    jne near 017d1h                           ; 0f 85 9f 01
     mov dx, ax                                ; 89 c2
     add dx, ax                                ; 01 c2
     or dl, 0ffh                               ; 80 ca ff
@@ -2855,41 +2869,41 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     inc dx                                    ; 42
     imul bx, dx                               ; 0f af da
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 01677h                          ; 75 3a
+    jne short 01681h                          ; 75 3a
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    jne short 01677h                          ; 75 34
+    jne short 01681h                          ; 75 34
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    jne short 01677h                          ; 75 2e
+    jne short 01681h                          ; 75 2e
     movzx dx, byte [bp+004h]                  ; 0f b6 56 04
     cmp dx, word [bp-01ah]                    ; 3b 56 e6
-    jne short 01677h                          ; 75 25
+    jne short 01681h                          ; 75 25
     movzx dx, byte [bp+006h]                  ; 0f b6 56 06
     cmp dx, word [bp-018h]                    ; 3b 56 e8
-    jne short 01677h                          ; 75 1c
+    jne short 01681h                          ; 75 1c
     movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
     sal dx, 008h                              ; c1 e2 08
     add dx, strict byte 00020h                ; 83 c2 20
-    mov es, [di+04833h]                       ; 8e 85 33 48
+    mov es, [di+04638h]                       ; 8e 85 38 46
     mov cx, ax                                ; 89 c1
     mov ax, dx                                ; 89 d0
     mov di, bx                                ; 89 df
     cld                                       ; fc
-    jcxz 01674h                               ; e3 02
+    jcxz 0167eh                               ; e3 02
     rep stosw                                 ; f3 ab
-    jmp near 01a65h                           ; e9 ee 03
+    jmp near 01a6fh                           ; e9 ee 03
     cmp byte [bp+00ah], 001h                  ; 80 7e 0a 01
-    jne near 0171ch                           ; 0f 85 9d 00
+    jne near 01726h                           ; 0f 85 9d 00
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     mov word [bp-014h], ax                    ; 89 46 ec
     movzx dx, byte [bp+004h]                  ; 0f b6 56 04
     cmp dx, word [bp-014h]                    ; 3b 56 ec
-    jc near 01a65h                            ; 0f 82 d4 03
+    jc near 01a6fh                            ; 0f 82 d4 03
     movzx ax, byte [bp-010h]                  ; 0f b6 46 f0
     add ax, word [bp-014h]                    ; 03 46 ec
     cmp ax, dx                                ; 39 d0
-    jnbe short 016a2h                         ; 77 06
+    jnbe short 016ach                         ; 77 06
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 016d5h                          ; 75 33
+    jne short 016dfh                          ; 75 33
     movzx cx, byte [bp-012h]                  ; 0f b6 4e ee
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     sal ax, 008h                              ; c1 e0 08
@@ -2903,11 +2917,11 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     add di, dx                                ; 01 d7
     movzx si, byte [bp-00eh]                  ; 0f b6 76 f2
     sal si, 003h                              ; c1 e6 03
-    mov es, [si+04833h]                       ; 8e 84 33 48
+    mov es, [si+04638h]                       ; 8e 84 38 46
     cld                                       ; fc
-    jcxz 016d3h                               ; e3 02
+    jcxz 016ddh                               ; e3 02
     rep stosw                                 ; f3 ab
-    jmp short 01716h                          ; eb 41
+    jmp short 01720h                          ; eb 41
     movzx dx, byte [bp-012h]                  ; 0f b6 56 ee
     mov word [bp-01ch], dx                    ; 89 56 e4
     mov dx, ax                                ; 89 c2
@@ -2917,7 +2931,7 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     add dx, dx                                ; 01 d2
     movzx si, byte [bp-00eh]                  ; 0f b6 76 f2
     sal si, 003h                              ; c1 e6 03
-    mov ax, word [si+04833h]                  ; 8b 84 33 48
+    mov ax, word [si+04638h]                  ; 8b 84 38 46
     mov si, word [bp-014h]                    ; 8b 76 ec
     imul si, word [bp-016h]                   ; 0f af 76 ea
     add cx, si                                ; 01 f1
@@ -2929,25 +2943,25 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     mov dx, ax                                ; 89 c2
     mov es, ax                                ; 8e c0
     cld                                       ; fc
-    jcxz 01716h                               ; e3 06
+    jcxz 01720h                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsw                                 ; f3 a5
     pop DS                                    ; 1f
     inc word [bp-014h]                        ; ff 46 ec
-    jmp near 01686h                           ; e9 6a ff
+    jmp near 01690h                           ; e9 6a ff
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     mov word [bp-014h], ax                    ; 89 46 ec
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jnbe near 01a65h                          ; 0f 87 37 03
+    jnbe near 01a6fh                          ; 0f 87 37 03
     movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
     movzx ax, byte [bp-010h]                  ; 0f b6 46 f0
     add ax, dx                                ; 01 d0
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jnbe short 01743h                         ; 77 06
+    jnbe short 0174dh                         ; 77 06
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 01776h                          ; 75 33
+    jne short 01780h                          ; 75 33
     movzx cx, byte [bp-012h]                  ; 0f b6 4e ee
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     sal ax, 008h                              ; c1 e0 08
@@ -2961,11 +2975,11 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     add di, dx                                ; 01 d7
     movzx si, byte [bp-00eh]                  ; 0f b6 76 f2
     sal si, 003h                              ; c1 e6 03
-    mov es, [si+04833h]                       ; 8e 84 33 48
+    mov es, [si+04638h]                       ; 8e 84 38 46
     cld                                       ; fc
-    jcxz 01774h                               ; e3 02
+    jcxz 0177eh                               ; e3 02
     rep stosw                                 ; f3 ab
-    jmp short 017b6h                          ; eb 40
+    jmp short 017c0h                          ; eb 40
     movzx cx, byte [bp-012h]                  ; 0f b6 4e ee
     movzx ax, byte [bp-010h]                  ; 0f b6 46 f0
     mov dx, word [bp-014h]                    ; 8b 56 ec
@@ -2976,7 +2990,7 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     add dx, dx                                ; 01 d2
     movzx si, byte [bp-00eh]                  ; 0f b6 76 f2
     sal si, 003h                              ; c1 e6 03
-    mov ax, word [si+04833h]                  ; 8b 84 33 48
+    mov ax, word [si+04638h]                  ; 8b 84 38 46
     mov si, word [bp-014h]                    ; 8b 76 ec
     imul si, word [bp-016h]                   ; 0f af 76 ea
     add di, si                                ; 01 f7
@@ -2986,44 +3000,44 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     mov dx, ax                                ; 89 c2
     mov es, ax                                ; 8e c0
     cld                                       ; fc
-    jcxz 017b6h                               ; e3 06
+    jcxz 017c0h                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsw                                 ; f3 a5
     pop DS                                    ; 1f
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jc near 01a65h                            ; 0f 82 a4 02
+    jc near 01a6fh                            ; 0f 82 a4 02
     dec word [bp-014h]                        ; ff 4e ec
-    jmp near 01723h                           ; e9 5c ff
-    movzx bx, byte [si+048afh]                ; 0f b6 9c af 48
+    jmp near 0172dh                           ; e9 5c ff
+    movzx bx, byte [si+046b4h]                ; 0f b6 9c b4 46
     sal bx, 006h                              ; c1 e3 06
-    mov dl, byte [bx+048c5h]                  ; 8a 97 c5 48
+    mov dl, byte [bx+046cah]                  ; 8a 97 ca 46
     mov byte [bp-00ah], dl                    ; 88 56 f6
-    mov bl, byte [di+04831h]                  ; 8a 9d 31 48
+    mov bl, byte [di+04636h]                  ; 8a 9d 36 46
     cmp bl, 004h                              ; 80 fb 04
-    je short 017eeh                           ; 74 0f
+    je short 017f8h                           ; 74 0f
     cmp bl, 003h                              ; 80 fb 03
-    je short 017eeh                           ; 74 0a
+    je short 017f8h                           ; 74 0a
     cmp bl, 002h                              ; 80 fb 02
-    je near 0192dh                            ; 0f 84 42 01
-    jmp near 01a65h                           ; e9 77 02
+    je near 01937h                            ; 0f 84 42 01
+    jmp near 01a6fh                           ; e9 77 02
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 01846h                          ; 75 52
+    jne short 01850h                          ; 75 52
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    jne short 01846h                          ; 75 4c
+    jne short 01850h                          ; 75 4c
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    jne short 01846h                          ; 75 46
+    jne short 01850h                          ; 75 46
     movzx dx, byte [bp+004h]                  ; 0f b6 56 04
     mov ax, cx                                ; 89 c8
     dec ax                                    ; 48
     cmp dx, ax                                ; 39 c2
-    jne short 01846h                          ; 75 3b
+    jne short 01850h                          ; 75 3b
     movzx dx, byte [bp+006h]                  ; 0f b6 56 06
     mov ax, word [bp-016h]                    ; 8b 46 ea
     dec ax                                    ; 48
     cmp dx, ax                                ; 39 c2
-    jne short 01846h                          ; 75 2f
+    jne short 01850h                          ; 75 2f
     mov ax, 00205h                            ; b8 05 02
     mov dx, 003ceh                            ; ba ce 03
     out DX, ax                                ; ef
@@ -3033,27 +3047,27 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
     sal bx, 003h                              ; c1 e3 03
-    mov es, [bx+04833h]                       ; 8e 87 33 48
+    mov es, [bx+04638h]                       ; 8e 87 38 46
     xor di, di                                ; 31 ff
     cld                                       ; fc
-    jcxz 0183fh                               ; e3 02
+    jcxz 01849h                               ; e3 02
     rep stosb                                 ; f3 aa
     mov ax, strict word 00005h                ; b8 05 00
     out DX, ax                                ; ef
-    jmp near 01a65h                           ; e9 1f 02
+    jmp near 01a6fh                           ; e9 1f 02
     cmp byte [bp+00ah], 001h                  ; 80 7e 0a 01
-    jne short 018b5h                          ; 75 69
+    jne short 018bfh                          ; 75 69
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     mov word [bp-014h], ax                    ; 89 46 ec
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jc near 01a65h                            ; 0f 82 07 02
+    jc near 01a6fh                            ; 0f 82 07 02
     movzx dx, byte [bp-010h]                  ; 0f b6 56 f0
     add dx, word [bp-014h]                    ; 03 56 ec
     cmp dx, ax                                ; 39 c2
-    jnbe short 0186fh                         ; 77 06
+    jnbe short 01879h                         ; 77 06
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 0188eh                          ; 75 1f
+    jne short 01898h                          ; 75 1f
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     push ax                                   ; 50
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
@@ -3062,8 +3076,8 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     movzx bx, byte [bp-012h]                  ; 0f b6 5e ee
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
-    call 013d9h                               ; e8 4d fb
-    jmp short 018b0h                          ; eb 22
+    call 013e3h                               ; e8 4d fb
+    jmp short 018bah                          ; eb 22
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     push ax                                   ; 50
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
@@ -3074,21 +3088,21 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     add al, byte [bp-010h]                    ; 02 46 f0
     movzx dx, al                              ; 0f b6 d0
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
-    call 01363h                               ; e8 b3 fa
+    call 0136dh                               ; e8 b3 fa
     inc word [bp-014h]                        ; ff 46 ec
-    jmp short 01853h                          ; eb 9e
+    jmp short 0185dh                          ; eb 9e
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     mov word [bp-014h], ax                    ; 89 46 ec
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jnbe near 01a65h                          ; 0f 87 9e 01
+    jnbe near 01a6fh                          ; 0f 87 9e 01
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     movzx dx, byte [bp-010h]                  ; 0f b6 56 f0
     add ax, dx                                ; 01 d0
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jnbe short 018dch                         ; 77 06
+    jnbe short 018e6h                         ; 77 06
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 018fbh                          ; 75 1f
+    jne short 01905h                          ; 75 1f
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     push ax                                   ; 50
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
@@ -3097,8 +3111,8 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     movzx bx, byte [bp-012h]                  ; 0f b6 5e ee
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
-    call 013d9h                               ; e8 e0 fa
-    jmp short 0191dh                          ; eb 22
+    call 013e3h                               ; e8 e0 fa
+    jmp short 01927h                          ; eb 22
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     push ax                                   ; 50
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
@@ -3109,54 +3123,54 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     movzx bx, al                              ; 0f b6 d8
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
-    call 01363h                               ; e8 46 fa
+    call 0136dh                               ; e8 46 fa
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jc near 01a65h                            ; 0f 82 3d 01
+    jc near 01a6fh                            ; 0f 82 3d 01
     dec word [bp-014h]                        ; ff 4e ec
-    jmp short 018bch                          ; eb 8f
-    mov dl, byte [di+04832h]                  ; 8a 95 32 48
+    jmp short 018c6h                          ; eb 8f
+    mov dl, byte [di+04637h]                  ; 8a 95 37 46
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 01974h                          ; 75 3d
+    jne short 0197eh                          ; 75 3d
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    jne short 01974h                          ; 75 37
+    jne short 0197eh                          ; 75 37
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    jne short 01974h                          ; 75 31
+    jne short 0197eh                          ; 75 31
     movzx bx, byte [bp+004h]                  ; 0f b6 5e 04
     cmp bx, word [bp-01ah]                    ; 3b 5e e6
-    jne short 01974h                          ; 75 28
+    jne short 0197eh                          ; 75 28
     movzx bx, byte [bp+006h]                  ; 0f b6 5e 06
     cmp bx, word [bp-018h]                    ; 3b 5e e8
-    jne short 01974h                          ; 75 1f
+    jne short 0197eh                          ; 75 1f
     movzx bx, byte [bp-00ah]                  ; 0f b6 5e f6
     imul ax, bx                               ; 0f af c3
     movzx cx, dl                              ; 0f b6 ca
     imul cx, ax                               ; 0f af c8
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
-    mov es, [di+04833h]                       ; 8e 85 33 48
+    mov es, [di+04638h]                       ; 8e 85 38 46
     xor di, di                                ; 31 ff
     cld                                       ; fc
-    jcxz 01971h                               ; e3 02
+    jcxz 0197bh                               ; e3 02
     rep stosb                                 ; f3 aa
-    jmp near 01a65h                           ; e9 f1 00
+    jmp near 01a6fh                           ; e9 f1 00
     cmp dl, 002h                              ; 80 fa 02
-    jne short 01982h                          ; 75 09
+    jne short 0198ch                          ; 75 09
     sal byte [bp-006h], 1                     ; d0 66 fa
     sal byte [bp-012h], 1                     ; d0 66 ee
     sal word [bp-016h], 1                     ; d1 66 ea
     cmp byte [bp+00ah], 001h                  ; 80 7e 0a 01
-    jne short 019f1h                          ; 75 69
+    jne short 019fbh                          ; 75 69
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     mov word [bp-014h], ax                    ; 89 46 ec
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jc near 01a65h                            ; 0f 82 cb 00
+    jc near 01a6fh                            ; 0f 82 cb 00
     movzx dx, byte [bp-010h]                  ; 0f b6 56 f0
     add dx, word [bp-014h]                    ; 03 56 ec
     cmp dx, ax                                ; 39 c2
-    jnbe short 019abh                         ; 77 06
+    jnbe short 019b5h                         ; 77 06
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 019cah                          ; 75 1f
+    jne short 019d4h                          ; 75 1f
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     push ax                                   ; 50
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
@@ -3165,8 +3179,8 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     movzx bx, byte [bp-012h]                  ; 0f b6 5e ee
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
-    call 014deh                               ; e8 16 fb
-    jmp short 019ech                          ; eb 22
+    call 014e8h                               ; e8 16 fb
+    jmp short 019f6h                          ; eb 22
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     push ax                                   ; 50
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
@@ -3177,21 +3191,21 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     add al, byte [bp-010h]                    ; 02 46 f0
     movzx dx, al                              ; 0f b6 d0
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
-    call 0143ah                               ; e8 4e fa
+    call 01444h                               ; e8 4e fa
     inc word [bp-014h]                        ; ff 46 ec
-    jmp short 0198fh                          ; eb 9e
+    jmp short 01999h                          ; eb 9e
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     mov word [bp-014h], ax                    ; 89 46 ec
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jnbe short 01a65h                         ; 77 64
+    jnbe short 01a6fh                         ; 77 64
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     movzx dx, byte [bp-010h]                  ; 0f b6 56 f0
     add ax, dx                                ; 01 d0
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jnbe short 01a16h                         ; 77 06
+    jnbe short 01a20h                         ; 77 06
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 01a35h                          ; 75 1f
+    jne short 01a3fh                          ; 75 1f
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     push ax                                   ; 50
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
@@ -3200,8 +3214,8 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     movzx bx, byte [bp-012h]                  ; 0f b6 5e ee
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
-    call 014deh                               ; e8 ab fa
-    jmp short 01a57h                          ; eb 22
+    call 014e8h                               ; e8 ab fa
+    jmp short 01a61h                          ; eb 22
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     push ax                                   ; 50
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
@@ -3212,18 +3226,18 @@ biosfn_scroll_:                              ; 0xc1568 LB 0x506
     movzx bx, al                              ; 0f b6 d8
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
-    call 0143ah                               ; e8 e3 f9
+    call 01444h                               ; e8 e3 f9
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jc short 01a65h                           ; 72 05
+    jc short 01a6fh                           ; 72 05
     dec word [bp-014h]                        ; ff 4e ec
-    jmp short 019f8h                          ; eb 93
+    jmp short 01a02h                          ; eb 93
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00008h                               ; c2 08 00
-write_gfx_char_pl4_:                         ; 0xc1a6e LB 0xeb
+write_gfx_char_pl4_:                         ; 0xc1a78 LB 0xeb
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -3232,14 +3246,14 @@ write_gfx_char_pl4_:                         ; 0xc1a6e LB 0xeb
     mov byte [bp-006h], dl                    ; 88 56 fa
     mov ah, bl                                ; 88 dc
     cmp byte [bp+006h], 010h                  ; 80 7e 06 10
-    je short 01a8ch                           ; 74 0b
+    je short 01a96h                           ; 74 0b
     cmp byte [bp+006h], 00eh                  ; 80 7e 06 0e
-    jne short 01a91h                          ; 75 0a
-    mov di, 05dafh                            ; bf af 5d
-    jmp short 01a94h                          ; eb 08
-    mov di, 06bafh                            ; bf af 6b
-    jmp short 01a94h                          ; eb 03
-    mov di, 055afh                            ; bf af 55
+    jne short 01a9bh                          ; 75 0a
+    mov di, 05bf2h                            ; bf f2 5b
+    jmp short 01a9eh                          ; eb 08
+    mov di, 069f2h                            ; bf f2 69
+    jmp short 01a9eh                          ; eb 03
+    mov di, 053f2h                            ; bf f2 53
     movzx si, cl                              ; 0f b6 f1
     movzx bx, byte [bp+006h]                  ; 0f b6 5e 06
     imul si, bx                               ; 0f af f3
@@ -3258,28 +3272,28 @@ write_gfx_char_pl4_:                         ; 0xc1a6e LB 0xeb
     mov dx, 003ceh                            ; ba ce 03
     out DX, ax                                ; ef
     test byte [bp-006h], 080h                 ; f6 46 fa 80
-    je short 01acfh                           ; 74 06
+    je short 01ad9h                           ; 74 06
     mov ax, 01803h                            ; b8 03 18
     out DX, ax                                ; ef
-    jmp short 01ad3h                          ; eb 04
+    jmp short 01addh                          ; eb 04
     mov ax, strict word 00003h                ; b8 03 00
     out DX, ax                                ; ef
     xor ch, ch                                ; 30 ed
     cmp ch, byte [bp+006h]                    ; 3a 6e 06
-    jnc short 01b41h                          ; 73 67
+    jnc short 01b4bh                          ; 73 67
     movzx si, ch                              ; 0f b6 f5
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     imul si, ax                               ; 0f af f0
     add si, word [bp-00eh]                    ; 03 76 f2
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
-    jmp short 01b00h                          ; eb 13
+    jmp short 01b0ah                          ; eb 13
     xor bx, bx                                ; 31 db
     mov dx, si                                ; 89 f2
     mov ax, 0a000h                            ; b8 00 a0
-    call 02f85h                               ; e8 8e 14
+    call 02f4ch                               ; e8 4b 14
     inc byte [bp-008h]                        ; fe 46 f8
     cmp byte [bp-008h], 008h                  ; 80 7e f8 08
-    jnc short 01b3dh                          ; 73 3d
+    jnc short 01b47h                          ; 73 3d
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     mov cl, al                                ; 88 c1
     mov ax, 00080h                            ; b8 80 00
@@ -3292,21 +3306,21 @@ write_gfx_char_pl4_:                         ; 0xc1a6e LB 0xeb
     out DX, ax                                ; ef
     mov dx, si                                ; 89 f2
     mov ax, 0a000h                            ; b8 00 a0
-    call 02f77h                               ; e8 56 14
+    call 02f3eh                               ; e8 13 14
     movzx ax, ch                              ; 0f b6 c5
     add ax, word [bp-00ah]                    ; 03 46 f6
     mov bx, di                                ; 89 fb
     add bx, ax                                ; 01 c3
     movzx ax, byte [bx]                       ; 0f b6 07
     test word [bp-00ch], ax                   ; 85 46 f4
-    je short 01aedh                           ; 74 ba
+    je short 01af7h                           ; 74 ba
     mov al, byte [bp-006h]                    ; 8a 46 fa
     and AL, strict byte 00fh                  ; 24 0f
     movzx bx, al                              ; 0f b6 d8
-    jmp short 01aefh                          ; eb b2
+    jmp short 01af9h                          ; eb b2
     db  0feh, 0c5h
     ; inc ch                                    ; fe c5
-    jmp short 01ad5h                          ; eb 94
+    jmp short 01adfh                          ; eb 94
     mov ax, 0ff08h                            ; b8 08 ff
     mov dx, 003ceh                            ; ba ce 03
     out DX, ax                                ; ef
@@ -3319,14 +3333,14 @@ write_gfx_char_pl4_:                         ; 0xc1a6e LB 0xeb
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-write_gfx_char_cga_:                         ; 0xc1b59 LB 0x11e
+write_gfx_char_cga_:                         ; 0xc1b63 LB 0x11e
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     push di                                   ; 57
     sub sp, strict byte 00008h                ; 83 ec 08
     mov byte [bp-008h], dl                    ; 88 56 f8
-    mov si, 055afh                            ; be af 55
+    mov si, 053f2h                            ; be f2 53
     xor bh, bh                                ; 30 ff
     movzx di, byte [bp+006h]                  ; 0f b6 7e 06
     imul di, bx                               ; 0f af fb
@@ -3337,39 +3351,39 @@ write_gfx_char_cga_:                         ; 0xc1b59 LB 0x11e
     movzx di, al                              ; 0f b6 f8
     sal di, 003h                              ; c1 e7 03
     mov byte [bp-006h], 000h                  ; c6 46 fa 00
-    jmp near 01bd9h                           ; e9 50 00
+    jmp near 01be3h                           ; e9 50 00
     xor al, al                                ; 30 c0
     xor ah, ah                                ; 30 e4
-    jmp short 01b9ah                          ; eb 0b
+    jmp short 01ba4h                          ; eb 0b
     or al, bl                                 ; 08 d8
     shr ch, 1                                 ; d0 ed
     db  0feh, 0c4h
     ; inc ah                                    ; fe c4
     cmp ah, 008h                              ; 80 fc 08
-    jnc short 01bc2h                          ; 73 28
+    jnc short 01bcch                          ; 73 28
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     add bx, di                                ; 01 fb
     add bx, si                                ; 01 f3
     movzx bx, byte [bx]                       ; 0f b6 1f
     movzx dx, ch                              ; 0f b6 d5
     test bx, dx                               ; 85 d3
-    je short 01b91h                           ; 74 e5
+    je short 01b9bh                           ; 74 e5
     mov CL, strict byte 007h                  ; b1 07
     sub cl, ah                                ; 28 e1
     mov bl, byte [bp-008h]                    ; 8a 5e f8
     and bl, 001h                              ; 80 e3 01
     sal bl, CL                                ; d2 e3
     test byte [bp-008h], 080h                 ; f6 46 f8 80
-    je short 01b8fh                           ; 74 d1
+    je short 01b99h                           ; 74 d1
     xor al, bl                                ; 30 d8
-    jmp short 01b91h                          ; eb cf
+    jmp short 01b9bh                          ; eb cf
     movzx bx, al                              ; 0f b6 d8
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     mov ax, 0b800h                            ; b8 00 b8
-    call 02f85h                               ; e8 b7 13
+    call 02f4ch                               ; e8 74 13
     inc byte [bp-006h]                        ; fe 46 fa
     cmp byte [bp-006h], 008h                  ; 80 7e fa 08
-    jnc near 01c6eh                           ; 0f 83 95 00
+    jnc near 01c78h                           ; 0f 83 95 00
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
     sar ax, 1                                 ; d1 f8
     imul ax, ax, strict byte 00050h           ; 6b c0 50
@@ -3377,41 +3391,41 @@ write_gfx_char_cga_:                         ; 0xc1b59 LB 0x11e
     add bx, ax                                ; 01 c3
     mov word [bp-00ah], bx                    ; 89 5e f6
     test byte [bp-006h], 001h                 ; f6 46 fa 01
-    je short 01bf4h                           ; 74 04
+    je short 01bfeh                           ; 74 04
     add byte [bp-009h], 020h                  ; 80 46 f7 20
     mov CH, strict byte 080h                  ; b5 80
     cmp byte [bp+006h], 001h                  ; 80 7e 06 01
-    jne short 01c0dh                          ; 75 11
+    jne short 01c17h                          ; 75 11
     test byte [bp-008h], ch                   ; 84 6e f8
-    je short 01b89h                           ; 74 88
+    je short 01b93h                           ; 74 88
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     mov ax, 0b800h                            ; b8 00 b8
-    call 02f77h                               ; e8 6d 13
-    jmp near 01b8bh                           ; e9 7e ff
+    call 02f3eh                               ; e8 2a 13
+    jmp near 01b95h                           ; e9 7e ff
     test ch, ch                               ; 84 ed
-    jbe short 01bceh                          ; 76 bd
+    jbe short 01bd8h                          ; 76 bd
     test byte [bp-008h], 080h                 ; f6 46 f8 80
-    je short 01c22h                           ; 74 0b
+    je short 01c2ch                           ; 74 0b
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     mov ax, 0b800h                            ; b8 00 b8
-    call 02f77h                               ; e8 57 13
-    jmp short 01c24h                          ; eb 02
+    call 02f3eh                               ; e8 14 13
+    jmp short 01c2eh                          ; eb 02
     xor al, al                                ; 30 c0
     xor ah, ah                                ; 30 e4
-    jmp short 01c33h                          ; eb 0b
+    jmp short 01c3dh                          ; eb 0b
     or al, bl                                 ; 08 d8
     shr ch, 1                                 ; d0 ed
     db  0feh, 0c4h
     ; inc ah                                    ; fe c4
     cmp ah, 004h                              ; 80 fc 04
-    jnc short 01c5dh                          ; 73 2a
+    jnc short 01c67h                          ; 73 2a
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     add bx, di                                ; 01 fb
     add bx, si                                ; 01 f3
     movzx dx, byte [bx]                       ; 0f b6 17
     movzx bx, ch                              ; 0f b6 dd
     test bx, dx                               ; 85 d3
-    je short 01c2ah                           ; 74 e5
+    je short 01c34h                           ; 74 e5
     mov CL, strict byte 003h                  ; b1 03
     sub cl, ah                                ; 28 e1
     mov bl, byte [bp-008h]                    ; 8a 5e f8
@@ -3419,28 +3433,28 @@ write_gfx_char_cga_:                         ; 0xc1b59 LB 0x11e
     add cl, cl                                ; 00 c9
     sal bl, CL                                ; d2 e3
     test byte [bp-008h], 080h                 ; f6 46 f8 80
-    je short 01c28h                           ; 74 cf
+    je short 01c32h                           ; 74 cf
     xor al, bl                                ; 30 d8
-    jmp short 01c2ah                          ; eb cd
+    jmp short 01c34h                          ; eb cd
     movzx bx, al                              ; 0f b6 d8
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     mov ax, 0b800h                            ; b8 00 b8
-    call 02f85h                               ; e8 1c 13
+    call 02f4ch                               ; e8 d9 12
     inc word [bp-00ah]                        ; ff 46 f6
-    jmp short 01c0dh                          ; eb 9f
+    jmp short 01c17h                          ; eb 9f
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-write_gfx_char_lin_:                         ; 0xc1c77 LB 0x91
+write_gfx_char_lin_:                         ; 0xc1c81 LB 0x91
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     push di                                   ; 57
     sub sp, strict byte 00008h                ; 83 ec 08
     mov byte [bp-006h], dl                    ; 88 56 fa
-    mov di, 055afh                            ; bf af 55
+    mov di, 053f2h                            ; bf f2 53
     movzx dx, cl                              ; 0f b6 d1
     movzx cx, byte [bp+004h]                  ; 0f b6 4e 04
     imul cx, dx                               ; 0f af ca
@@ -3452,9 +3466,9 @@ write_gfx_char_lin_:                         ; 0xc1c77 LB 0x91
     movzx si, al                              ; 0f b6 f0
     sal si, 003h                              ; c1 e6 03
     xor cl, cl                                ; 30 c9
-    jmp short 01ce2h                          ; eb 3b
+    jmp short 01cech                          ; eb 3b
     cmp ch, 008h                              ; 80 fd 08
-    jnc short 01cdbh                          ; 73 2f
+    jnc short 01ce5h                          ; 73 2f
     xor al, al                                ; 30 c0
     movzx dx, cl                              ; 0f b6 d1
     add dx, si                                ; 01 f2
@@ -3463,21 +3477,21 @@ write_gfx_char_lin_:                         ; 0xc1c77 LB 0x91
     movzx dx, byte [bx]                       ; 0f b6 17
     movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
     test dx, bx                               ; 85 da
-    je short 01cc5h                           ; 74 03
+    je short 01ccfh                           ; 74 03
     mov al, byte [bp-006h]                    ; 8a 46 fa
     movzx bx, al                              ; 0f b6 d8
     movzx dx, ch                              ; 0f b6 d5
     add dx, word [bp-00ah]                    ; 03 56 f6
     mov ax, 0a000h                            ; b8 00 a0
-    call 02f85h                               ; e8 b1 12
+    call 02f4ch                               ; e8 6e 12
     shr byte [bp-008h], 1                     ; d0 6e f8
     db  0feh, 0c5h
     ; inc ch                                    ; fe c5
-    jmp short 01ca7h                          ; eb cc
+    jmp short 01cb1h                          ; eb cc
     db  0feh, 0c1h
     ; inc cl                                    ; fe c1
     cmp cl, 008h                              ; 80 f9 08
-    jnc short 01cffh                          ; 73 1d
+    jnc short 01d09h                          ; 73 1d
     movzx bx, cl                              ; 0f b6 d9
     movzx dx, byte [bp+004h]                  ; 0f b6 56 04
     imul dx, bx                               ; 0f af d3
@@ -3487,13 +3501,13 @@ write_gfx_char_lin_:                         ; 0xc1c77 LB 0x91
     mov word [bp-00ah], bx                    ; 89 5e f6
     mov byte [bp-008h], 080h                  ; c6 46 f8 80
     xor ch, ch                                ; 30 ed
-    jmp short 01cach                          ; eb ad
+    jmp short 01cb6h                          ; eb ad
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00002h                               ; c2 02 00
-biosfn_write_char_attr_:                     ; 0xc1d08 LB 0x168
+biosfn_write_char_attr_:                     ; 0xc1d12 LB 0x168
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -3505,17 +3519,17 @@ biosfn_write_char_attr_:                     ; 0xc1d08 LB 0x168
     mov si, cx                                ; 89 ce
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 53 12
+    call 02f3eh                               ; e8 10 12
     xor ah, ah                                ; 30 e4
-    call 02f50h                               ; e8 27 12
+    call 02f17h                               ; e8 e4 11
     mov cl, al                                ; 88 c1
     mov byte [bp-006h], al                    ; 88 46 fa
     cmp AL, strict byte 0ffh                  ; 3c ff
-    je near 01e69h                            ; 0f 84 35 01
+    je near 01e73h                            ; 0f 84 35 01
     movzx ax, byte [bp-010h]                  ; 0f b6 46 f0
     lea bx, [bp-01ch]                         ; 8d 5e e4
     lea dx, [bp-01ah]                         ; 8d 56 e6
-    call 00a88h                               ; e8 47 ed
+    call 00a88h                               ; e8 3d ed
     mov al, byte [bp-01ch]                    ; 8a 46 e4
     mov byte [bp-00ch], al                    ; 88 46 f4
     mov ax, word [bp-01ch]                    ; 8b 46 e4
@@ -3524,19 +3538,19 @@ biosfn_write_char_attr_:                     ; 0xc1d08 LB 0x168
     mov byte [bp-00ah], al                    ; 88 46 f6
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 1c 12
+    call 02f3eh                               ; e8 d9 11
     xor ah, ah                                ; 30 e4
     inc ax                                    ; 40
     mov word [bp-018h], ax                    ; 89 46 e8
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 29 12
+    call 02f5ah                               ; e8 e6 11
     mov word [bp-016h], ax                    ; 89 46 ea
     movzx bx, cl                              ; 0f b6 d9
     mov di, bx                                ; 89 df
     sal di, 003h                              ; c1 e7 03
-    cmp byte [di+04830h], 000h                ; 80 bd 30 48 00
-    jne short 01dc3h                          ; 75 47
+    cmp byte [di+04635h], 000h                ; 80 bd 35 46 00
+    jne short 01dcdh                          ; 75 47
     mov bx, word [bp-018h]                    ; 8b 5e e8
     imul bx, ax                               ; 0f af d8
     add bx, bx                                ; 01 db
@@ -3556,39 +3570,39 @@ biosfn_write_char_attr_:                     ; 0xc1d08 LB 0x168
     add ax, bx                                ; 01 d8
     mov word [bp-01ah], ax                    ; 89 46 e6
     mov ax, word [bp-01ah]                    ; 8b 46 e6
-    mov es, [di+04833h]                       ; 8e 85 33 48
+    mov es, [di+04638h]                       ; 8e 85 38 46
     mov cx, si                                ; 89 f1
     mov di, dx                                ; 89 d7
     cld                                       ; fc
-    jcxz 01dc0h                               ; e3 02
+    jcxz 01dcah                               ; e3 02
     rep stosw                                 ; f3 ab
-    jmp near 01e69h                           ; e9 a6 00
-    movzx bx, byte [bx+048afh]                ; 0f b6 9f af 48
+    jmp near 01e73h                           ; e9 a6 00
+    movzx bx, byte [bx+046b4h]                ; 0f b6 9f b4 46
     sal bx, 006h                              ; c1 e3 06
-    mov al, byte [bx+048c5h]                  ; 8a 87 c5 48
+    mov al, byte [bx+046cah]                  ; 8a 87 ca 46
     mov byte [bp-008h], al                    ; 88 46 f8
-    mov al, byte [di+04832h]                  ; 8a 85 32 48
+    mov al, byte [di+04637h]                  ; 8a 85 37 46
     mov byte [bp-014h], al                    ; 88 46 ec
     dec si                                    ; 4e
     cmp si, strict byte 0ffffh                ; 83 fe ff
-    je near 01e69h                            ; 0f 84 88 00
+    je near 01e73h                            ; 0f 84 88 00
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     cmp ax, word [bp-016h]                    ; 3b 46 ea
-    jnc near 01e69h                           ; 0f 83 7d 00
+    jnc near 01e73h                           ; 0f 83 7d 00
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     sal bx, 003h                              ; c1 e3 03
-    mov al, byte [bx+04831h]                  ; 8a 87 31 48
+    mov al, byte [bx+04636h]                  ; 8a 87 36 46
     cmp AL, strict byte 003h                  ; 3c 03
-    jc short 01e07h                           ; 72 0c
-    jbe short 01e0dh                          ; 76 10
+    jc short 01e11h                           ; 72 0c
+    jbe short 01e17h                          ; 76 10
     cmp AL, strict byte 005h                  ; 3c 05
-    je short 01e4bh                           ; 74 4a
+    je short 01e55h                           ; 74 4a
     cmp AL, strict byte 004h                  ; 3c 04
-    je short 01e0dh                           ; 74 08
-    jmp short 01e63h                          ; eb 5c
+    je short 01e17h                           ; 74 08
+    jmp short 01e6dh                          ; eb 5c
     cmp AL, strict byte 002h                  ; 3c 02
-    je short 01e2ch                           ; 74 21
-    jmp short 01e63h                          ; eb 56
+    je short 01e36h                           ; 74 21
+    jmp short 01e6dh                          ; eb 56
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     push ax                                   ; 50
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
@@ -3597,8 +3611,8 @@ biosfn_write_char_attr_:                     ; 0xc1d08 LB 0x168
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     movzx dx, byte [bp-012h]                  ; 0f b6 56 ee
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 01a6eh                               ; e8 44 fc
-    jmp short 01e63h                          ; eb 37
+    call 01a78h                               ; e8 44 fc
+    jmp short 01e6dh                          ; eb 37
     movzx ax, byte [bp-014h]                  ; 0f b6 46 ec
     push ax                                   ; 50
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
@@ -3607,23 +3621,23 @@ biosfn_write_char_attr_:                     ; 0xc1d08 LB 0x168
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     movzx dx, byte [bp-012h]                  ; 0f b6 56 ee
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 01b59h                               ; e8 10 fd
-    jmp short 01e63h                          ; eb 18
+    call 01b63h                               ; e8 10 fd
+    jmp short 01e6dh                          ; eb 18
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
     push ax                                   ; 50
     movzx cx, byte [bp-00ah]                  ; 0f b6 4e f6
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     movzx dx, byte [bp-012h]                  ; 0f b6 56 ee
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 01c77h                               ; e8 14 fe
+    call 01c81h                               ; e8 14 fe
     inc byte [bp-00ch]                        ; fe 46 f4
-    jmp near 01dd9h                           ; e9 70 ff
+    jmp near 01de3h                           ; e9 70 ff
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_write_char_only_:                     ; 0xc1e70 LB 0x16f
+biosfn_write_char_only_:                     ; 0xc1e7a LB 0x16f
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -3635,17 +3649,17 @@ biosfn_write_char_only_:                     ; 0xc1e70 LB 0x16f
     mov si, cx                                ; 89 ce
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 eb 10
+    call 02f3eh                               ; e8 a8 10
     xor ah, ah                                ; 30 e4
-    call 02f50h                               ; e8 bf 10
+    call 02f17h                               ; e8 7c 10
     mov cl, al                                ; 88 c1
     mov byte [bp-00eh], al                    ; 88 46 f2
     cmp AL, strict byte 0ffh                  ; 3c ff
-    je near 01fd8h                            ; 0f 84 3c 01
+    je near 01fe2h                            ; 0f 84 3c 01
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
     lea bx, [bp-01ch]                         ; 8d 5e e4
     lea dx, [bp-01ah]                         ; 8d 56 e6
-    call 00a88h                               ; e8 df eb
+    call 00a88h                               ; e8 d5 eb
     mov al, byte [bp-01ch]                    ; 8a 46 e4
     mov byte [bp-00ch], al                    ; 88 46 f4
     mov ax, word [bp-01ch]                    ; 8b 46 e4
@@ -3654,19 +3668,19 @@ biosfn_write_char_only_:                     ; 0xc1e70 LB 0x16f
     mov byte [bp-010h], al                    ; 88 46 f0
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 b4 10
+    call 02f3eh                               ; e8 71 10
     xor ah, ah                                ; 30 e4
     inc ax                                    ; 40
     mov word [bp-018h], ax                    ; 89 46 e8
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 c1 10
+    call 02f5ah                               ; e8 7e 10
     mov word [bp-016h], ax                    ; 89 46 ea
     movzx di, cl                              ; 0f b6 f9
     mov bx, di                                ; 89 fb
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04830h], 000h                ; 80 bf 30 48 00
-    jne short 01f2eh                          ; 75 4a
+    cmp byte [bx+04635h], 000h                ; 80 bf 35 46 00
+    jne short 01f38h                          ; 75 4a
     mov dx, word [bp-018h]                    ; 8b 56 e8
     imul dx, ax                               ; 0f af d0
     add dx, dx                                ; 01 d2
@@ -3683,44 +3697,44 @@ biosfn_write_char_only_:                     ; 0xc1e70 LB 0x16f
     add cx, bx                                ; 01 d9
     dec si                                    ; 4e
     cmp si, strict byte 0ffffh                ; 83 fe ff
-    je near 01fd8h                            ; 0f 84 c6 00
+    je near 01fe2h                            ; 0f 84 c6 00
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
     movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
     sal bx, 003h                              ; c1 e3 03
-    mov di, word [bx+04833h]                  ; 8b bf 33 48
+    mov di, word [bx+04638h]                  ; 8b bf 38 46
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, di                                ; 89 f8
-    call 02f85h                               ; e8 5b 10
+    call 02f4ch                               ; e8 18 10
     inc cx                                    ; 41
     inc cx                                    ; 41
-    jmp short 01f0ah                          ; eb dc
-    movzx di, byte [di+048afh]                ; 0f b6 bd af 48
+    jmp short 01f14h                          ; eb dc
+    movzx di, byte [di+046b4h]                ; 0f b6 bd b4 46
     sal di, 006h                              ; c1 e7 06
-    mov al, byte [di+048c5h]                  ; 8a 85 c5 48
+    mov al, byte [di+046cah]                  ; 8a 85 ca 46
     mov byte [bp-00ah], al                    ; 88 46 f6
-    mov al, byte [bx+04832h]                  ; 8a 87 32 48
+    mov al, byte [bx+04637h]                  ; 8a 87 37 46
     mov byte [bp-008h], al                    ; 88 46 f8
     dec si                                    ; 4e
     cmp si, strict byte 0ffffh                ; 83 fe ff
-    je near 01fd8h                            ; 0f 84 8c 00
+    je near 01fe2h                            ; 0f 84 8c 00
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     cmp ax, word [bp-016h]                    ; 3b 46 ea
-    jnc near 01fd8h                           ; 0f 83 81 00
+    jnc near 01fe2h                           ; 0f 83 81 00
     movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
     sal bx, 003h                              ; c1 e3 03
-    mov bl, byte [bx+04831h]                  ; 8a 9f 31 48
+    mov bl, byte [bx+04636h]                  ; 8a 9f 36 46
     cmp bl, 003h                              ; 80 fb 03
-    jc short 01f75h                           ; 72 0e
-    jbe short 01f7ch                          ; 76 13
+    jc short 01f7fh                           ; 72 0e
+    jbe short 01f86h                          ; 76 13
     cmp bl, 005h                              ; 80 fb 05
-    je short 01fbah                           ; 74 4c
+    je short 01fc4h                           ; 74 4c
     cmp bl, 004h                              ; 80 fb 04
-    je short 01f7ch                           ; 74 09
-    jmp short 01fd2h                          ; eb 5d
+    je short 01f86h                           ; 74 09
+    jmp short 01fdch                          ; eb 5d
     cmp bl, 002h                              ; 80 fb 02
-    je short 01f9bh                           ; 74 21
-    jmp short 01fd2h                          ; eb 56
+    je short 01fa5h                           ; 74 21
+    jmp short 01fdch                          ; eb 56
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     push ax                                   ; 50
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
@@ -3729,8 +3743,8 @@ biosfn_write_char_only_:                     ; 0xc1e70 LB 0x16f
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
-    call 01a6eh                               ; e8 d5 fa
-    jmp short 01fd2h                          ; eb 37
+    call 01a78h                               ; e8 d5 fa
+    jmp short 01fdch                          ; eb 37
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     push ax                                   ; 50
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
@@ -3739,23 +3753,23 @@ biosfn_write_char_only_:                     ; 0xc1e70 LB 0x16f
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
-    call 01b59h                               ; e8 a1 fb
-    jmp short 01fd2h                          ; eb 18
+    call 01b63h                               ; e8 a1 fb
+    jmp short 01fdch                          ; eb 18
     movzx ax, byte [bp-016h]                  ; 0f b6 46 ea
     push ax                                   ; 50
     movzx cx, byte [bp-010h]                  ; 0f b6 4e f0
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
-    call 01c77h                               ; e8 a5 fc
+    call 01c81h                               ; e8 a5 fc
     inc byte [bp-00ch]                        ; fe 46 f4
-    jmp near 01f44h                           ; e9 6c ff
+    jmp near 01f4eh                           ; e9 6c ff
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_write_pixel_:                         ; 0xc1fdf LB 0x16a
+biosfn_write_pixel_:                         ; 0xc1fe9 LB 0x16a
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -3764,31 +3778,31 @@ biosfn_write_pixel_:                         ; 0xc1fdf LB 0x16a
     mov word [bp-00ah], bx                    ; 89 5e f6
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 82 0f
+    call 02f3eh                               ; e8 3f 0f
     xor ah, ah                                ; 30 e4
-    call 02f50h                               ; e8 56 0f
+    call 02f17h                               ; e8 13 0f
     mov byte [bp-004h], al                    ; 88 46 fc
     cmp AL, strict byte 0ffh                  ; 3c ff
-    je near 02121h                            ; 0f 84 1e 01
+    je near 0212bh                            ; 0f 84 1e 01
     movzx bx, al                              ; 0f b6 d8
     sal bx, 003h                              ; c1 e3 03
-    cmp byte [bx+04830h], 000h                ; 80 bf 30 48 00
-    je near 02121h                            ; 0f 84 0f 01
-    mov al, byte [bx+04831h]                  ; 8a 87 31 48
+    cmp byte [bx+04635h], 000h                ; 80 bf 35 46 00
+    je near 0212bh                            ; 0f 84 0f 01
+    mov al, byte [bx+04636h]                  ; 8a 87 36 46
     cmp AL, strict byte 003h                  ; 3c 03
-    jc short 02029h                           ; 72 0f
-    jbe short 02030h                          ; 76 14
+    jc short 02033h                           ; 72 0f
+    jbe short 0203ah                          ; 76 14
     cmp AL, strict byte 005h                  ; 3c 05
-    je near 02127h                            ; 0f 84 05 01
+    je near 02131h                            ; 0f 84 05 01
     cmp AL, strict byte 004h                  ; 3c 04
-    je short 02030h                           ; 74 0a
-    jmp near 02121h                           ; e9 f8 00
+    je short 0203ah                           ; 74 0a
+    jmp near 0212bh                           ; e9 f8 00
     cmp AL, strict byte 002h                  ; 3c 02
-    je short 02095h                           ; 74 68
-    jmp near 02121h                           ; e9 f1 00
+    je short 0209fh                           ; 74 68
+    jmp near 0212bh                           ; e9 f1 00
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 5a 0f
+    call 02f5ah                               ; e8 17 0f
     imul ax, cx                               ; 0f af c1
     mov bx, word [bp-00ah]                    ; 8b 5e f6
     shr bx, 003h                              ; c1 eb 03
@@ -3807,16 +3821,16 @@ biosfn_write_pixel_:                         ; 0xc1fdf LB 0x16a
     out DX, ax                                ; ef
     mov dx, bx                                ; 89 da
     mov ax, 0a000h                            ; b8 00 a0
-    call 02f77h                               ; e8 0e 0f
+    call 02f3eh                               ; e8 cb 0e
     test byte [bp-006h], 080h                 ; f6 46 fa 80
-    je short 02076h                           ; 74 07
+    je short 02080h                           ; 74 07
     mov ax, 01803h                            ; b8 03 18
     mov dx, 003ceh                            ; ba ce 03
     out DX, ax                                ; ef
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     mov dx, word [bp-008h]                    ; 8b 56 f8
     mov ax, 0a000h                            ; b8 00 a0
-    call 02f85h                               ; e8 02 0f
+    call 02f4ch                               ; e8 bf 0e
     mov ax, 0ff08h                            ; b8 08 ff
     mov dx, 003ceh                            ; ba ce 03
     out DX, ax                                ; ef
@@ -3824,30 +3838,30 @@ biosfn_write_pixel_:                         ; 0xc1fdf LB 0x16a
     out DX, ax                                ; ef
     mov ax, strict word 00003h                ; b8 03 00
     out DX, ax                                ; ef
-    jmp near 02121h                           ; e9 8c 00
+    jmp near 0212bh                           ; e9 8c 00
     mov ax, cx                                ; 89 c8
     shr ax, 1                                 ; d1 e8
     imul ax, ax, strict byte 00050h           ; 6b c0 50
-    cmp byte [bx+04832h], 002h                ; 80 bf 32 48 02
-    jne short 020abh                          ; 75 08
+    cmp byte [bx+04637h], 002h                ; 80 bf 37 46 02
+    jne short 020b5h                          ; 75 08
     mov bx, word [bp-00ah]                    ; 8b 5e f6
     shr bx, 002h                              ; c1 eb 02
-    jmp short 020b1h                          ; eb 06
+    jmp short 020bbh                          ; eb 06
     mov bx, word [bp-00ah]                    ; 8b 5e f6
     shr bx, 003h                              ; c1 eb 03
     add bx, ax                                ; 01 c3
     mov word [bp-008h], bx                    ; 89 5e f8
     test cl, 001h                             ; f6 c1 01
-    je short 020bfh                           ; 74 04
+    je short 020c9h                           ; 74 04
     add byte [bp-007h], 020h                  ; 80 46 f9 20
     mov dx, word [bp-008h]                    ; 8b 56 f8
     mov ax, 0b800h                            ; b8 00 b8
-    call 02f77h                               ; e8 af 0e
+    call 02f3eh                               ; e8 6c 0e
     mov bl, al                                ; 88 c3
     movzx si, byte [bp-004h]                  ; 0f b6 76 fc
     sal si, 003h                              ; c1 e6 03
-    cmp byte [si+04832h], 002h                ; 80 bc 32 48 02
-    jne short 020f1h                          ; 75 19
+    cmp byte [si+04637h], 002h                ; 80 bc 37 46 02
+    jne short 020fbh                          ; 75 19
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     and AL, strict byte 003h                  ; 24 03
     mov AH, strict byte 003h                  ; b4 03
@@ -3858,7 +3872,7 @@ biosfn_write_pixel_:                         ; 0xc1fdf LB 0x16a
     and bh, 003h                              ; 80 e7 03
     sal bh, CL                                ; d2 e7
     mov AL, strict byte 003h                  ; b0 03
-    jmp short 02104h                          ; eb 13
+    jmp short 0210eh                          ; eb 13
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     and AL, strict byte 007h                  ; 24 07
     mov CL, strict byte 007h                  ; b1 07
@@ -3869,23 +3883,23 @@ biosfn_write_pixel_:                         ; 0xc1fdf LB 0x16a
     mov AL, strict byte 001h                  ; b0 01
     sal al, CL                                ; d2 e0
     test byte [bp-006h], 080h                 ; f6 46 fa 80
-    je short 02110h                           ; 74 04
+    je short 0211ah                           ; 74 04
     xor bl, bh                                ; 30 fb
-    jmp short 02116h                          ; eb 06
+    jmp short 02120h                          ; eb 06
     not al                                    ; f6 d0
     and bl, al                                ; 20 c3
     or bl, bh                                 ; 08 fb
     xor bh, bh                                ; 30 ff
     mov dx, word [bp-008h]                    ; 8b 56 f8
     mov ax, 0b800h                            ; b8 00 b8
-    call 02f85h                               ; e8 64 0e
+    call 02f4ch                               ; e8 21 0e
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 63 0e
+    call 02f5ah                               ; e8 20 0e
     sal ax, 003h                              ; c1 e0 03
     imul cx, ax                               ; 0f af c8
     mov ax, word [bp-00ah]                    ; 8b 46 f6
@@ -3894,34 +3908,34 @@ biosfn_write_pixel_:                         ; 0xc1fdf LB 0x16a
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     mov dx, ax                                ; 89 c2
     mov ax, 0a000h                            ; b8 00 a0
-    jmp short 0211eh                          ; eb d5
-biosfn_write_teletype_:                      ; 0xc2149 LB 0x284
+    jmp short 02128h                          ; eb d5
+biosfn_write_teletype_:                      ; 0xc2153 LB 0x241
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     sub sp, strict byte 00016h                ; 83 ec 16
     mov byte [bp-00ch], al                    ; 88 46 f4
-    mov byte [bp-004h], dl                    ; 88 56 fc
-    mov byte [bp-006h], bl                    ; 88 5e fa
-    mov byte [bp-010h], cl                    ; 88 4e f0
+    mov byte [bp-006h], dl                    ; 88 56 fa
+    mov byte [bp-004h], bl                    ; 88 5e fc
+    mov byte [bp-00eh], cl                    ; 88 4e f2
     cmp dl, 0ffh                              ; 80 fa ff
-    jne short 0216dh                          ; 75 0c
+    jne short 02177h                          ; 75 0c
     mov dx, strict word 00062h                ; ba 62 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 0d 0e
-    mov byte [bp-004h], al                    ; 88 46 fc
+    call 02f3eh                               ; e8 ca 0d
+    mov byte [bp-006h], al                    ; 88 46 fa
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 01 0e
+    call 02f3eh                               ; e8 be 0d
     xor ah, ah                                ; 30 e4
-    call 02f50h                               ; e8 d5 0d
-    mov byte [bp-00eh], al                    ; 88 46 f2
+    call 02f17h                               ; e8 92 0d
+    mov byte [bp-010h], al                    ; 88 46 f0
     cmp AL, strict byte 0ffh                  ; 3c ff
-    je near 023c7h                            ; 0f 84 43 02
-    movzx ax, byte [bp-004h]                  ; 0f b6 46 fc
+    je near 0238eh                            ; 0f 84 00 02
+    movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
     lea bx, [bp-018h]                         ; 8d 5e e8
     lea dx, [bp-016h]                         ; 8d 56 ea
-    call 00a88h                               ; e8 f7 e8
+    call 00a88h                               ; e8 ed e8
     mov al, byte [bp-018h]                    ; 8a 46 e8
     mov byte [bp-008h], al                    ; 88 46 f8
     mov ax, word [bp-018h]                    ; 8b 46 e8
@@ -3930,191 +3944,167 @@ biosfn_write_teletype_:                      ; 0xc2149 LB 0x284
     mov byte [bp-00ah], al                    ; 88 46 f6
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 cc 0d
+    call 02f3eh                               ; e8 89 0d
     xor ah, ah                                ; 30 e4
     inc ax                                    ; 40
     mov word [bp-014h], ax                    ; 89 46 ec
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 d9 0d
+    call 02f5ah                               ; e8 96 0d
     mov word [bp-012h], ax                    ; 89 46 ee
     mov al, byte [bp-00ch]                    ; 8a 46 f4
-    cmp AL, strict byte 009h                  ; 3c 09
-    jc short 021d0h                           ; 72 0c
-    jbe short 021f7h                          ; 76 31
+    cmp AL, strict byte 008h                  ; 3c 08
+    jc short 021dch                           ; 72 0e
+    jbe short 021e4h                          ; 76 14
     cmp AL, strict byte 00dh                  ; 3c 0d
-    je short 021eah                           ; 74 20
+    je short 021f2h                           ; 74 1e
     cmp AL, strict byte 00ah                  ; 3c 0a
-    je short 021f1h                           ; 74 23
-    jmp short 02238h                          ; eb 68
-    cmp AL, strict byte 008h                  ; 3c 08
-    je short 021dch                           ; 74 08
+    je near 022e4h                            ; 0f 84 0a 01
+    jmp short 021f9h                          ; eb 1d
     cmp AL, strict byte 007h                  ; 3c 07
-    je near 02314h                            ; 0f 84 3a 01
-    jmp short 02238h                          ; eb 5c
+    je near 022e7h                            ; 0f 84 05 01
+    jmp short 021f9h                          ; eb 15
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    jbe near 02314h                           ; 0f 86 30 01
+    jbe near 022e7h                           ; 0f 86 fb 00
     dec byte [bp-008h]                        ; fe 4e f8
-    jmp near 02314h                           ; e9 2a 01
+    jmp near 022e7h                           ; e9 f5 00
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
-    jmp near 02314h                           ; e9 23 01
-    inc byte [bp-00ah]                        ; fe 46 f6
-    jmp near 02314h                           ; e9 1d 01
-    movzx cx, byte [bp-010h]                  ; 0f b6 4e f0
-    movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
-    movzx si, byte [bp-004h]                  ; 0f b6 76 fc
-    mov dx, si                                ; 89 f2
-    mov ax, strict word 00020h                ; b8 20 00
-    call 02149h                               ; e8 3e ff
-    lea bx, [bp-018h]                         ; 8d 5e e8
-    lea dx, [bp-016h]                         ; 8d 56 ea
-    mov ax, si                                ; 89 f0
-    call 00a88h                               ; e8 72 e8
-    mov al, byte [bp-018h]                    ; 8a 46 e8
-    mov byte [bp-008h], al                    ; 88 46 f8
-    mov ax, word [bp-018h]                    ; 8b 46 e8
-    xor al, al                                ; 30 c0
-    shr ax, 008h                              ; c1 e8 08
-    mov byte [bp-00ah], al                    ; 88 46 f6
-    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
-    mov bx, strict word 00008h                ; bb 08 00
-    cwd                                       ; 99
-    idiv bx                                   ; f7 fb
-    test dx, dx                               ; 85 d2
-    je short 021f7h                           ; 74 c2
-    jmp near 02314h                           ; e9 dc 00
-    movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
+    jmp near 022e7h                           ; e9 ee 00
+    movzx bx, byte [bp-010h]                  ; 0f b6 5e f0
     mov si, bx                                ; 89 de
     sal si, 003h                              ; c1 e6 03
-    cmp byte [si+04830h], 000h                ; 80 bc 30 48 00
-    jne short 02293h                          ; 75 4b
+    cmp byte [si+04635h], 000h                ; 80 bc 35 46 00
+    jne short 02256h                          ; 75 4d
     mov ax, word [bp-012h]                    ; 8b 46 ee
     imul ax, word [bp-014h]                   ; 0f af 46 ec
     add ax, ax                                ; 01 c0
     or AL, strict byte 0ffh                   ; 0c ff
-    movzx dx, byte [bp-004h]                  ; 0f b6 56 fc
-    inc ax                                    ; 40
-    imul dx, ax                               ; 0f af d0
-    movzx cx, byte [bp-00ah]                  ; 0f b6 4e f6
-    imul cx, word [bp-012h]                   ; 0f af 4e ee
-    movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
-    add cx, bx                                ; 01 d9
-    add cx, cx                                ; 01 c9
-    add cx, dx                                ; 01 d1
+    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
+    mov cx, ax                                ; 89 c1
+    inc cx                                    ; 41
+    imul cx, dx                               ; 0f af ca
+    movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
+    imul ax, word [bp-012h]                   ; 0f af 46 ee
+    movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
+    add ax, dx                                ; 01 d0
+    add ax, ax                                ; 01 c0
+    add cx, ax                                ; 01 c1
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
-    mov ax, word [si+04833h]                  ; 8b 84 33 48
+    mov ax, word [si+04638h]                  ; 8b 84 38 46
     mov dx, cx                                ; 89 ca
-    call 02f85h                               ; e8 0b 0d
-    cmp byte [bp-010h], 003h                  ; 80 7e f0 03
-    jne near 02311h                           ; 0f 85 8f 00
-    movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
+    call 02f4ch                               ; e8 0f 0d
+    cmp byte [bp-00eh], 003h                  ; 80 7e f2 03
+    jne near 022d4h                           ; 0f 85 8f 00
+    movzx bx, byte [bp-004h]                  ; 0f b6 5e fc
     mov dx, cx                                ; 89 ca
     inc dx                                    ; 42
-    mov ax, word [si+04833h]                  ; 8b 84 33 48
-    call 02f85h                               ; e8 f5 0c
-    jmp near 02311h                           ; e9 7e 00
-    movzx bx, byte [bx+048afh]                ; 0f b6 9f af 48
+    mov ax, word [si+04638h]                  ; 8b 84 38 46
+    call 02f4ch                               ; e8 f9 0c
+    jmp near 022d4h                           ; e9 7e 00
+    movzx bx, byte [bx+046b4h]                ; 0f b6 9f b4 46
     sal bx, 006h                              ; c1 e3 06
-    mov ah, byte [bx+048c5h]                  ; 8a a7 c5 48
-    mov dl, byte [si+04832h]                  ; 8a 94 32 48
-    mov al, byte [si+04831h]                  ; 8a 84 31 48
+    mov ah, byte [bx+046cah]                  ; 8a a7 ca 46
+    mov dl, byte [si+04637h]                  ; 8a 94 37 46
+    mov al, byte [si+04636h]                  ; 8a 84 36 46
     cmp AL, strict byte 003h                  ; 3c 03
-    jc short 022b7h                           ; 72 0c
-    jbe short 022bdh                          ; 76 10
+    jc short 0227ah                           ; 72 0c
+    jbe short 02280h                          ; 76 10
     cmp AL, strict byte 005h                  ; 3c 05
-    je short 022f9h                           ; 74 48
+    je short 022bch                           ; 74 48
     cmp AL, strict byte 004h                  ; 3c 04
-    je short 022bdh                           ; 74 08
-    jmp short 02311h                          ; eb 5a
+    je short 02280h                           ; 74 08
+    jmp short 022d4h                          ; eb 5a
     cmp AL, strict byte 002h                  ; 3c 02
-    je short 022dbh                           ; 74 20
-    jmp short 02311h                          ; eb 54
+    je short 0229eh                           ; 74 20
+    jmp short 022d4h                          ; eb 54
     movzx ax, ah                              ; 0f b6 c4
     push ax                                   ; 50
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
     push ax                                   ; 50
     movzx cx, byte [bp-00ah]                  ; 0f b6 4e f6
     movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
-    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
+    movzx dx, byte [bp-004h]                  ; 0f b6 56 fc
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
-    call 01a6eh                               ; e8 95 f7
-    jmp short 02311h                          ; eb 36
+    call 01a78h                               ; e8 dc f7
+    jmp short 022d4h                          ; eb 36
     movzx ax, dl                              ; 0f b6 c2
     push ax                                   ; 50
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
     push ax                                   ; 50
     movzx cx, byte [bp-00ah]                  ; 0f b6 4e f6
     movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
-    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
+    movzx dx, byte [bp-004h]                  ; 0f b6 56 fc
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
-    call 01b59h                               ; e8 62 f8
-    jmp short 02311h                          ; eb 18
+    call 01b63h                               ; e8 a9 f8
+    jmp short 022d4h                          ; eb 18
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
     push ax                                   ; 50
     movzx cx, byte [bp-00ah]                  ; 0f b6 4e f6
     movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
-    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
+    movzx dx, byte [bp-004h]                  ; 0f b6 56 fc
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
-    call 01c77h                               ; e8 66 f9
+    call 01c81h                               ; e8 ad f9
     inc byte [bp-008h]                        ; fe 46 f8
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     cmp ax, word [bp-012h]                    ; 3b 46 ee
-    jne short 02324h                          ; 75 07
+    jne short 022e7h                          ; 75 07
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
     inc byte [bp-00ah]                        ; fe 46 f6
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jne near 023abh                           ; 0f 85 7c 00
-    movzx si, byte [bp-00eh]                  ; 0f b6 76 f2
+    jne near 02372h                           ; 0f 85 80 00
+    movzx si, byte [bp-010h]                  ; 0f b6 76 f0
     sal si, 003h                              ; c1 e6 03
-    mov bl, byte [bp-014h]                    ; 8a 5e ec
-    db  0feh, 0cbh
-    ; dec bl                                    ; fe cb
-    mov bh, byte [bp-012h]                    ; 8a 7e ee
+    mov bh, byte [bp-014h]                    ; 8a 7e ec
     db  0feh, 0cfh
     ; dec bh                                    ; fe cf
-    cmp byte [si+04830h], 000h                ; 80 bc 30 48 00
-    jne short 0238dh                          ; 75 46
+    mov bl, byte [bp-012h]                    ; 8a 5e ee
+    db  0feh, 0cbh
+    ; dec bl                                    ; fe cb
+    cmp byte [si+04635h], 000h                ; 80 bc 35 46 00
+    jne short 02354h                          ; 75 4a
     mov ax, word [bp-012h]                    ; 8b 46 ee
     imul ax, word [bp-014h]                   ; 0f af 46 ec
     add ax, ax                                ; 01 c0
     or AL, strict byte 0ffh                   ; 0c ff
-    movzx dx, byte [bp-004h]                  ; 0f b6 56 fc
-    inc ax                                    ; 40
-    imul dx, ax                               ; 0f af d0
+    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
+    mov cx, ax                                ; 89 c1
+    inc cx                                    ; 41
+    imul cx, dx                               ; 0f af ca
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     dec ax                                    ; 48
     imul ax, word [bp-012h]                   ; 0f af 46 ee
-    movzx cx, byte [bp-008h]                  ; 0f b6 4e f8
-    add cx, ax                                ; 01 c1
-    add cx, cx                                ; 01 c9
-    add dx, cx                                ; 01 ca
+    movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
+    add ax, dx                                ; 01 d0
+    add ax, ax                                ; 01 c0
+    mov dx, cx                                ; 89 ca
+    add dx, ax                                ; 01 c2
     inc dx                                    ; 42
-    mov ax, word [si+04833h]                  ; 8b 84 33 48
-    call 02f77h                               ; e8 02 0c
+    mov ax, word [si+04638h]                  ; 8b 84 38 46
+    call 02f3eh                               ; e8 02 0c
     push strict byte 00001h                   ; 6a 01
-    movzx dx, byte [bp-004h]                  ; 0f b6 56 fc
-    push dx                                   ; 52
-    movzx dx, bh                              ; 0f b6 d7
+    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
     push dx                                   ; 52
     movzx dx, bl                              ; 0f b6 d3
     push dx                                   ; 52
+    movzx dx, bh                              ; 0f b6 d7
+    push dx                                   ; 52
     movzx dx, al                              ; 0f b6 d0
     xor cx, cx                                ; 31 c9
     xor bx, bx                                ; 31 db
-    jmp short 023a2h                          ; eb 15
+    jmp short 02369h                          ; eb 15
     push strict byte 00001h                   ; 6a 01
-    movzx ax, byte [bp-004h]                  ; 0f b6 46 fc
-    push ax                                   ; 50
-    movzx ax, bh                              ; 0f b6 c7
+    movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
     push ax                                   ; 50
     movzx ax, bl                              ; 0f b6 c3
     push ax                                   ; 50
+    movzx ax, bh                              ; 0f b6 c7
+    push ax                                   ; 50
     xor cx, cx                                ; 31 c9
     xor bx, bx                                ; 31 db
     xor dx, dx                                ; 31 d2
     mov ax, strict word 00001h                ; b8 01 00
-    call 01568h                               ; e8 c0 f1
+    call 01572h                               ; e8 03 f2
     dec byte [bp-00ah]                        ; fe 4e f6
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     mov word [bp-018h], ax                    ; 89 46 e8
@@ -4122,13 +4112,13 @@ biosfn_write_teletype_:                      ; 0xc2149 LB 0x284
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     add word [bp-018h], ax                    ; 01 46 e8
     mov dx, word [bp-018h]                    ; 8b 56 e8
-    movzx ax, byte [bp-004h]                  ; 0f b6 46 fc
-    call 00e5eh                               ; e8 97 ea
+    movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
+    call 00e5eh                               ; e8 d0 ea
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-get_font_access_:                            ; 0xc23cd LB 0x2c
+get_font_access_:                            ; 0xc2394 LB 0x2c
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
@@ -4152,7 +4142,7 @@ get_font_access_:                            ; 0xc23cd LB 0x2c
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-release_font_access_:                        ; 0xc23f9 LB 0x3c
+release_font_access_:                        ; 0xc23c0 LB 0x3c
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
@@ -4184,7 +4174,7 @@ release_font_access_:                        ; 0xc23f9 LB 0x3c
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-set_scan_lines_:                             ; 0xc2435 LB 0xbf
+set_scan_lines_:                             ; 0xc23fc LB 0xbf
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -4195,7 +4185,7 @@ set_scan_lines_:                             ; 0xc2435 LB 0xbf
     mov bl, al                                ; 88 c3
     mov dx, strict word 00063h                ; ba 63 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 4b 0b
+    call 02f5ah                               ; e8 4b 0b
     mov dx, ax                                ; 89 c2
     mov si, ax                                ; 89 c6
     mov AL, strict byte 009h                  ; b0 09
@@ -4212,22 +4202,22 @@ set_scan_lines_:                             ; 0xc2435 LB 0xbf
     or al, ah                                 ; 08 e0
     out DX, AL                                ; ee
     cmp bl, 008h                              ; 80 fb 08
-    jne short 0246ch                          ; 75 08
+    jne short 02433h                          ; 75 08
     mov dx, strict word 00007h                ; ba 07 00
     mov ax, strict word 00006h                ; b8 06 00
-    jmp short 02479h                          ; eb 0d
+    jmp short 02440h                          ; eb 0d
     mov al, bl                                ; 88 d8
     sub AL, strict byte 003h                  ; 2c 03
     movzx dx, al                              ; 0f b6 d0
     mov al, bl                                ; 88 d8
     sub AL, strict byte 004h                  ; 2c 04
     xor ah, ah                                ; 30 e4
-    call 00dbah                               ; e8 3e e9
+    call 00dbah                               ; e8 77 e9
     movzx di, bl                              ; 0f b6 fb
     mov bx, di                                ; 89 fb
     mov dx, 00085h                            ; ba 85 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 17 0b
+    call 02f68h                               ; e8 17 0b
     mov AL, strict byte 012h                  ; b0 12
     mov dx, si                                ; 89 f2
     out DX, AL                                ; ee
@@ -4262,17 +4252,17 @@ set_scan_lines_:                             ; 0xc2435 LB 0xbf
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 b7 0a
+    call 02f4ch                               ; e8 b7 0a
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 bc 0a
+    call 02f5ah                               ; e8 bc 0a
     movzx dx, cl                              ; 0f b6 d1
     mov bx, ax                                ; 89 c3
     imul bx, dx                               ; 0f af da
     add bx, bx                                ; 01 db
     mov dx, strict word 0004ch                ; ba 4c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 b7 0a
+    call 02f68h                               ; e8 b7 0a
     lea sp, [bp-00ah]                         ; 8d 66 f6
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -4281,7 +4271,7 @@ set_scan_lines_:                             ; 0xc2435 LB 0xbf
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_load_text_user_pat_:                  ; 0xc24f4 LB 0x7d
+biosfn_load_text_user_pat_:                  ; 0xc24bb LB 0x7d
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -4291,7 +4281,7 @@ biosfn_load_text_user_pat_:                  ; 0xc24f4 LB 0x7d
     mov word [bp-00ch], dx                    ; 89 56 f4
     mov word [bp-008h], bx                    ; 89 5e f8
     mov word [bp-00ah], cx                    ; 89 4e f6
-    call 023cdh                               ; e8 c2 fe
+    call 02394h                               ; e8 c2 fe
     mov al, byte [bp+006h]                    ; 8a 46 06
     and AL, strict byte 003h                  ; 24 03
     xor ah, ah                                ; 30 e4
@@ -4305,7 +4295,7 @@ biosfn_load_text_user_pat_:                  ; 0xc24f4 LB 0x7d
     mov word [bp-00eh], bx                    ; 89 5e f2
     xor bx, bx                                ; 31 db
     cmp bx, word [bp-00ah]                    ; 3b 5e f6
-    jnc short 02558h                          ; 73 2b
+    jnc short 0251fh                          ; 73 2b
     movzx cx, byte [bp+008h]                  ; 0f b6 4e 08
     mov si, bx                                ; 89 de
     imul si, cx                               ; 0f af f1
@@ -4318,24 +4308,24 @@ biosfn_load_text_user_pat_:                  ; 0xc24f4 LB 0x7d
     mov ax, 0a000h                            ; b8 00 a0
     mov es, ax                                ; 8e c0
     cld                                       ; fc
-    jcxz 02555h                               ; e3 06
+    jcxz 0251ch                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
     pop DS                                    ; 1f
     inc bx                                    ; 43
-    jmp short 02528h                          ; eb d0
-    call 023f9h                               ; e8 9e fe
+    jmp short 024efh                          ; eb d0
+    call 023c0h                               ; e8 9e fe
     cmp byte [bp-006h], 010h                  ; 80 7e fa 10
-    jc short 02568h                           ; 72 07
+    jc short 0252fh                           ; 72 07
     movzx ax, byte [bp+008h]                  ; 0f b6 46 08
-    call 02435h                               ; e8 cd fe
+    call 023fch                               ; e8 cd fe
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00006h                               ; c2 06 00
-biosfn_load_text_8_14_pat_:                  ; 0xc2571 LB 0x70
+biosfn_load_text_8_14_pat_:                  ; 0xc2538 LB 0x70
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -4345,7 +4335,7 @@ biosfn_load_text_8_14_pat_:                  ; 0xc2571 LB 0x70
     push ax                                   ; 50
     push ax                                   ; 50
     mov byte [bp-00ah], al                    ; 88 46 f6
-    call 023cdh                               ; e8 4d fe
+    call 02394h                               ; e8 4d fe
     mov al, dl                                ; 88 d0
     and AL, strict byte 003h                  ; 24 03
     xor ah, ah                                ; 30 e4
@@ -4358,31 +4348,31 @@ biosfn_load_text_8_14_pat_:                  ; 0xc2571 LB 0x70
     add bx, ax                                ; 01 c3
     mov word [bp-00ch], bx                    ; 89 5e f4
     xor bx, bx                                ; 31 db
-    jmp short 025a3h                          ; eb 06
+    jmp short 0256ah                          ; eb 06
     cmp bx, 00100h                            ; 81 fb 00 01
-    jnc short 025c9h                          ; 73 26
+    jnc short 02590h                          ; 73 26
     imul si, bx, strict byte 0000eh           ; 6b f3 0e
     mov di, bx                                ; 89 df
     sal di, 005h                              ; c1 e7 05
     add di, word [bp-00ch]                    ; 03 7e f4
-    add si, 05dafh                            ; 81 c6 af 5d
+    add si, 05bf2h                            ; 81 c6 f2 5b
     mov cx, strict word 0000eh                ; b9 0e 00
     mov dx, 0c000h                            ; ba 00 c0
     mov ax, 0a000h                            ; b8 00 a0
     mov es, ax                                ; 8e c0
     cld                                       ; fc
-    jcxz 025c6h                               ; e3 06
+    jcxz 0258dh                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
     pop DS                                    ; 1f
     inc bx                                    ; 43
-    jmp short 0259dh                          ; eb d4
-    call 023f9h                               ; e8 2d fe
+    jmp short 02564h                          ; eb d4
+    call 023c0h                               ; e8 2d fe
     cmp byte [bp-00ah], 010h                  ; 80 7e f6 10
-    jc short 025d8h                           ; 72 06
+    jc short 0259fh                           ; 72 06
     mov ax, strict word 0000eh                ; b8 0e 00
-    call 02435h                               ; e8 5d fe
+    call 023fch                               ; e8 5d fe
     lea sp, [bp-008h]                         ; 8d 66 f8
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -4390,7 +4380,7 @@ biosfn_load_text_8_14_pat_:                  ; 0xc2571 LB 0x70
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_load_text_8_8_pat_:                   ; 0xc25e1 LB 0x72
+biosfn_load_text_8_8_pat_:                   ; 0xc25a8 LB 0x72
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -4400,7 +4390,7 @@ biosfn_load_text_8_8_pat_:                   ; 0xc25e1 LB 0x72
     push ax                                   ; 50
     push ax                                   ; 50
     mov byte [bp-00ah], al                    ; 88 46 f6
-    call 023cdh                               ; e8 dd fd
+    call 02394h                               ; e8 dd fd
     mov al, dl                                ; 88 d0
     and AL, strict byte 003h                  ; 24 03
     xor ah, ah                                ; 30 e4
@@ -4413,32 +4403,32 @@ biosfn_load_text_8_8_pat_:                   ; 0xc25e1 LB 0x72
     add bx, ax                                ; 01 c3
     mov word [bp-00ch], bx                    ; 89 5e f4
     xor bx, bx                                ; 31 db
-    jmp short 02613h                          ; eb 06
+    jmp short 025dah                          ; eb 06
     cmp bx, 00100h                            ; 81 fb 00 01
-    jnc short 0263bh                          ; 73 28
+    jnc short 02602h                          ; 73 28
     mov si, bx                                ; 89 de
     sal si, 003h                              ; c1 e6 03
     mov di, bx                                ; 89 df
     sal di, 005h                              ; c1 e7 05
     add di, word [bp-00ch]                    ; 03 7e f4
-    add si, 055afh                            ; 81 c6 af 55
+    add si, 053f2h                            ; 81 c6 f2 53
     mov cx, strict word 00008h                ; b9 08 00
     mov dx, 0c000h                            ; ba 00 c0
     mov ax, 0a000h                            ; b8 00 a0
     mov es, ax                                ; 8e c0
     cld                                       ; fc
-    jcxz 02638h                               ; e3 06
+    jcxz 025ffh                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
     pop DS                                    ; 1f
     inc bx                                    ; 43
-    jmp short 0260dh                          ; eb d2
-    call 023f9h                               ; e8 bb fd
+    jmp short 025d4h                          ; eb d2
+    call 023c0h                               ; e8 bb fd
     cmp byte [bp-00ah], 010h                  ; 80 7e f6 10
-    jc short 0264ah                           ; 72 06
+    jc short 02611h                           ; 72 06
     mov ax, strict word 00008h                ; b8 08 00
-    call 02435h                               ; e8 eb fd
+    call 023fch                               ; e8 eb fd
     lea sp, [bp-008h]                         ; 8d 66 f8
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -4446,7 +4436,7 @@ biosfn_load_text_8_8_pat_:                   ; 0xc25e1 LB 0x72
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_load_text_8_16_pat_:                  ; 0xc2653 LB 0x72
+biosfn_load_text_8_16_pat_:                  ; 0xc261a LB 0x72
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -4456,7 +4446,7 @@ biosfn_load_text_8_16_pat_:                  ; 0xc2653 LB 0x72
     push ax                                   ; 50
     push ax                                   ; 50
     mov byte [bp-00ah], al                    ; 88 46 f6
-    call 023cdh                               ; e8 6b fd
+    call 02394h                               ; e8 6b fd
     mov al, dl                                ; 88 d0
     and AL, strict byte 003h                  ; 24 03
     xor ah, ah                                ; 30 e4
@@ -4469,32 +4459,32 @@ biosfn_load_text_8_16_pat_:                  ; 0xc2653 LB 0x72
     add bx, ax                                ; 01 c3
     mov word [bp-00ch], bx                    ; 89 5e f4
     xor bx, bx                                ; 31 db
-    jmp short 02685h                          ; eb 06
+    jmp short 0264ch                          ; eb 06
     cmp bx, 00100h                            ; 81 fb 00 01
-    jnc short 026adh                          ; 73 28
+    jnc short 02674h                          ; 73 28
     mov si, bx                                ; 89 de
     sal si, 004h                              ; c1 e6 04
     mov di, bx                                ; 89 df
     sal di, 005h                              ; c1 e7 05
     add di, word [bp-00ch]                    ; 03 7e f4
-    add si, 06bafh                            ; 81 c6 af 6b
+    add si, 069f2h                            ; 81 c6 f2 69
     mov cx, strict word 00010h                ; b9 10 00
     mov dx, 0c000h                            ; ba 00 c0
     mov ax, 0a000h                            ; b8 00 a0
     mov es, ax                                ; 8e c0
     cld                                       ; fc
-    jcxz 026aah                               ; e3 06
+    jcxz 02671h                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
     pop DS                                    ; 1f
     inc bx                                    ; 43
-    jmp short 0267fh                          ; eb d2
-    call 023f9h                               ; e8 49 fd
+    jmp short 02646h                          ; eb d2
+    call 023c0h                               ; e8 49 fd
     cmp byte [bp-00ah], 010h                  ; 80 7e f6 10
-    jc short 026bch                           ; 72 06
+    jc short 02683h                           ; 72 06
     mov ax, strict word 00010h                ; b8 10 00
-    call 02435h                               ; e8 79 fd
+    call 023fch                               ; e8 79 fd
     lea sp, [bp-008h]                         ; 8d 66 f8
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -4502,47 +4492,47 @@ biosfn_load_text_8_16_pat_:                  ; 0xc2653 LB 0x72
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_load_gfx_8_8_chars_:                  ; 0xc26c5 LB 0x5
+biosfn_load_gfx_8_8_chars_:                  ; 0xc268c LB 0x5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_load_gfx_user_chars_:                 ; 0xc26ca LB 0x7
+biosfn_load_gfx_user_chars_:                 ; 0xc2691 LB 0x7
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     pop bp                                    ; 5d
     retn 00002h                               ; c2 02 00
-biosfn_load_gfx_8_14_chars_:                 ; 0xc26d1 LB 0x5
+biosfn_load_gfx_8_14_chars_:                 ; 0xc2698 LB 0x5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_load_gfx_8_8_dd_chars_:               ; 0xc26d6 LB 0x5
+biosfn_load_gfx_8_8_dd_chars_:               ; 0xc269d LB 0x5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_load_gfx_8_16_chars_:                 ; 0xc26db LB 0x5
+biosfn_load_gfx_8_16_chars_:                 ; 0xc26a2 LB 0x5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_alternate_prtsc_:                     ; 0xc26e0 LB 0x5
+biosfn_alternate_prtsc_:                     ; 0xc26a7 LB 0x5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_switch_video_interface_:              ; 0xc26e5 LB 0x5
+biosfn_switch_video_interface_:              ; 0xc26ac LB 0x5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_enable_video_refresh_control_:        ; 0xc26ea LB 0x5
+biosfn_enable_video_refresh_control_:        ; 0xc26b1 LB 0x5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_write_string_:                        ; 0xc26ef LB 0x9c
+biosfn_write_string_:                        ; 0xc26b6 LB 0x9c
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -4556,9 +4546,9 @@ biosfn_write_string_:                        ; 0xc26ef LB 0x9c
     movzx ax, dl                              ; 0f b6 c2
     lea bx, [bp-00eh]                         ; 8d 5e f2
     lea dx, [bp-00ch]                         ; 8d 56 f4
-    call 00a88h                               ; e8 77 e3
+    call 00a88h                               ; e8 b0 e3
     cmp byte [bp+004h], 0ffh                  ; 80 7e 04 ff
-    jne short 02728h                          ; 75 11
+    jne short 026efh                          ; 75 11
     mov al, byte [bp-00eh]                    ; 8a 46 f2
     mov byte [bp+006h], al                    ; 88 46 06
     mov ax, word [bp-00eh]                    ; 8b 46 f2
@@ -4570,39 +4560,39 @@ biosfn_write_string_:                        ; 0xc26ef LB 0x9c
     movzx ax, byte [bp+006h]                  ; 0f b6 46 06
     add dx, ax                                ; 01 c2
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
-    call 00e5eh                               ; e8 22 e7
+    call 00e5eh                               ; e8 5b e7
     dec si                                    ; 4e
     cmp si, strict byte 0ffffh                ; 83 fe ff
-    je short 02772h                           ; 74 30
+    je short 02739h                           ; 74 30
     mov dx, di                                ; 89 fa
     inc di                                    ; 47
     mov ax, word [bp+008h]                    ; 8b 46 08
-    call 02f77h                               ; e8 2c 08
+    call 02f3eh                               ; e8 2c 08
     mov cl, al                                ; 88 c1
     test byte [bp-00ah], 002h                 ; f6 46 f6 02
-    je short 0275fh                           ; 74 0c
+    je short 02726h                           ; 74 0c
     mov dx, di                                ; 89 fa
     inc di                                    ; 47
     mov ax, word [bp+008h]                    ; 8b 46 08
-    call 02f77h                               ; e8 1b 08
+    call 02f3eh                               ; e8 1b 08
     mov byte [bp-006h], al                    ; 88 46 fa
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
     movzx ax, cl                              ; 0f b6 c1
     mov cx, strict word 00003h                ; b9 03 00
-    call 02149h                               ; e8 d9 f9
-    jmp short 0273ch                          ; eb ca
+    call 02153h                               ; e8 1c fa
+    jmp short 02703h                          ; eb ca
     test byte [bp-00ah], 001h                 ; f6 46 f6 01
-    jne short 02782h                          ; 75 0a
+    jne short 02749h                          ; 75 0a
     mov dx, word [bp-00eh]                    ; 8b 56 f2
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
-    call 00e5eh                               ; e8 dc e6
+    call 00e5eh                               ; e8 15 e7
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00008h                               ; c2 08 00
-biosfn_read_state_info_:                     ; 0xc278b LB 0x101
+biosfn_read_state_info_:                     ; 0xc2752 LB 0x101
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -4611,10 +4601,10 @@ biosfn_read_state_info_:                     ; 0xc278b LB 0x101
     push dx                                   ; 52
     push bx                                   ; 53
     mov cx, ds                                ; 8c d9
-    mov bx, 05583h                            ; bb 83 55
+    mov bx, 05388h                            ; bb 88 53
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02fc1h                               ; e8 20 08
+    call 02f88h                               ; e8 20 08
     mov di, word [bp-00ah]                    ; 8b 7e f6
     add di, strict byte 00004h                ; 83 c7 04
     mov cx, strict word 0001eh                ; b9 1e 00
@@ -4622,7 +4612,7 @@ biosfn_read_state_info_:                     ; 0xc278b LB 0x101
     mov dx, strict word 00040h                ; ba 40 00
     mov es, [bp-008h]                         ; 8e 46 f8
     cld                                       ; fc
-    jcxz 027bch                               ; e3 06
+    jcxz 02783h                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
@@ -4634,71 +4624,71 @@ biosfn_read_state_info_:                     ; 0xc278b LB 0x101
     mov dx, strict word 00040h                ; ba 40 00
     mov es, [bp-008h]                         ; 8e 46 f8
     cld                                       ; fc
-    jcxz 027d7h                               ; e3 06
+    jcxz 0279eh                               ; e3 06
     push DS                                   ; 1e
     mov ds, dx                                ; 8e da
     rep movsb                                 ; f3 a4
     pop DS                                    ; 1f
     mov dx, 0008ah                            ; ba 8a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 97 07
+    call 02f3eh                               ; e8 97 07
     movzx bx, al                              ; 0f b6 d8
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 00025h                ; 83 c2 25
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 96 07
+    call 02f4ch                               ; e8 96 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 00026h                ; 83 c2 26
     xor bx, bx                                ; 31 db
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 88 07
+    call 02f4ch                               ; e8 88 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 00027h                ; 83 c2 27
     mov bx, strict word 00010h                ; bb 10 00
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 79 07
+    call 02f4ch                               ; e8 79 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 00028h                ; 83 c2 28
     xor bx, bx                                ; 31 db
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 6b 07
+    call 02f4ch                               ; e8 6b 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 00029h                ; 83 c2 29
     mov bx, strict word 00008h                ; bb 08 00
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 5c 07
+    call 02f4ch                               ; e8 5c 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 0002ah                ; 83 c2 2a
     mov bx, strict word 00002h                ; bb 02 00
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 4d 07
+    call 02f4ch                               ; e8 4d 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 0002bh                ; 83 c2 2b
     xor bx, bx                                ; 31 db
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 3f 07
+    call 02f4ch                               ; e8 3f 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 0002ch                ; 83 c2 2c
     xor bx, bx                                ; 31 db
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 31 07
+    call 02f4ch                               ; e8 31 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 00031h                ; 83 c2 31
     mov bx, strict word 00003h                ; bb 03 00
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 22 07
+    call 02f4ch                               ; e8 22 07
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, strict byte 00032h                ; 83 c2 32
     xor bx, bx                                ; 31 db
     mov ax, word [bp-008h]                    ; 8b 46 f8
-    call 02f85h                               ; e8 14 07
+    call 02f4ch                               ; e8 14 07
     mov di, word [bp-00ah]                    ; 8b 7e f6
     add di, strict byte 00033h                ; 83 c7 33
     mov cx, strict word 0000dh                ; b9 0d 00
     xor ax, ax                                ; 31 c0
     mov es, [bp-008h]                         ; 8e 46 f8
     cld                                       ; fc
-    jcxz 02884h                               ; e3 02
+    jcxz 0284bh                               ; e3 02
     rep stosb                                 ; f3 aa
     lea sp, [bp-006h]                         ; 8d 66 fa
     pop di                                    ; 5f
@@ -4706,36 +4696,36 @@ biosfn_read_state_info_:                     ; 0xc278b LB 0x101
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_read_video_state_size2_:              ; 0xc288c LB 0x23
+biosfn_read_video_state_size2_:              ; 0xc2853 LB 0x23
     push dx                                   ; 52
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov dx, ax                                ; 89 c2
     xor ax, ax                                ; 31 c0
     test dl, 001h                             ; f6 c2 01
-    je short 0289ch                           ; 74 03
+    je short 02863h                           ; 74 03
     mov ax, strict word 00046h                ; b8 46 00
     test dl, 002h                             ; f6 c2 02
-    je short 028a4h                           ; 74 03
+    je short 0286bh                           ; 74 03
     add ax, strict word 0002ah                ; 05 2a 00
     test dl, 004h                             ; f6 c2 04
-    je short 028ach                           ; 74 03
+    je short 02873h                           ; 74 03
     add ax, 00304h                            ; 05 04 03
     pop bp                                    ; 5d
     pop dx                                    ; 5a
     retn                                      ; c3
-vga_get_video_state_size_:                   ; 0xc28af LB 0x12
+vga_get_video_state_size_:                   ; 0xc2876 LB 0x12
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     mov bx, dx                                ; 89 d3
-    call 0288ch                               ; e8 d4 ff
+    call 02853h                               ; e8 d4 ff
     mov word [ss:bx], ax                      ; 36 89 07
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
+biosfn_save_video_state_:                    ; 0xc2888 LB 0x369
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -4748,10 +4738,10 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     mov cx, bx                                ; 89 d9
     mov dx, strict word 00063h                ; ba 63 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 bc 06
+    call 02f5ah                               ; e8 bc 06
     mov di, ax                                ; 89 c7
     test byte [bp-00ch], 001h                 ; f6 46 f4 01
-    je near 02a44h                            ; 0f 84 63 01
+    je near 02a0bh                            ; 0f 84 63 01
     mov dx, 003c4h                            ; ba c4 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -4759,7 +4749,7 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 94 06
+    call 02f4ch                               ; e8 94 06
     inc cx                                    ; 41
     mov dx, di                                ; 89 fa
     in AL, DX                                 ; ec
@@ -4768,7 +4758,7 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 84 06
+    call 02f4ch                               ; e8 84 06
     inc cx                                    ; 41
     mov dx, 003ceh                            ; ba ce 03
     in AL, DX                                 ; ec
@@ -4777,7 +4767,7 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 73 06
+    call 02f4ch                               ; e8 73 06
     inc cx                                    ; 41
     mov dx, 003dah                            ; ba da 03
     in AL, DX                                 ; ec
@@ -4791,7 +4781,7 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 58 06
+    call 02f4ch                               ; e8 58 06
     inc cx                                    ; 41
     mov dx, 003cah                            ; ba ca 03
     in AL, DX                                 ; ec
@@ -4800,13 +4790,13 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 47 06
+    call 02f4ch                               ; e8 47 06
     mov ax, strict word 00001h                ; b8 01 00
     mov word [bp-00ah], ax                    ; 89 46 f6
     add cx, ax                                ; 01 c1
-    jmp short 0294eh                          ; eb 06
+    jmp short 02915h                          ; eb 06
     cmp word [bp-00ah], strict byte 00004h    ; 83 7e f6 04
-    jnbe short 0296bh                         ; 77 1d
+    jnbe short 02932h                         ; 77 1d
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     mov dx, 003c4h                            ; ba c4 03
     out DX, AL                                ; ee
@@ -4817,10 +4807,10 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 20 06
+    call 02f4ch                               ; e8 20 06
     inc cx                                    ; 41
     inc word [bp-00ah]                        ; ff 46 f6
-    jmp short 02948h                          ; eb dd
+    jmp short 0290fh                          ; eb dd
     xor al, al                                ; 30 c0
     mov dx, 003c4h                            ; ba c4 03
     out DX, AL                                ; ee
@@ -4831,12 +4821,12 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 04 06
+    call 02f4ch                               ; e8 04 06
     mov word [bp-00ah], strict word 00000h    ; c7 46 f6 00 00
     inc cx                                    ; 41
-    jmp short 0298fh                          ; eb 06
+    jmp short 02956h                          ; eb 06
     cmp word [bp-00ah], strict byte 00018h    ; 83 7e f6 18
-    jnbe short 029abh                         ; 77 1c
+    jnbe short 02972h                         ; 77 1c
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     mov dx, di                                ; 89 fa
     out DX, AL                                ; ee
@@ -4847,14 +4837,14 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 e0 05
+    call 02f4ch                               ; e8 e0 05
     inc cx                                    ; 41
     inc word [bp-00ah]                        ; ff 46 f6
-    jmp short 02989h                          ; eb de
+    jmp short 02950h                          ; eb de
     mov word [bp-00ah], strict word 00000h    ; c7 46 f6 00 00
-    jmp short 029b8h                          ; eb 06
+    jmp short 0297fh                          ; eb 06
     cmp word [bp-00ah], strict byte 00013h    ; 83 7e f6 13
-    jnbe short 029e1h                         ; 77 29
+    jnbe short 029a8h                         ; 77 29
     mov dx, 003dah                            ; ba da 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -4871,18 +4861,18 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 aa 05
+    call 02f4ch                               ; e8 aa 05
     inc cx                                    ; 41
     inc word [bp-00ah]                        ; ff 46 f6
-    jmp short 029b2h                          ; eb d1
+    jmp short 02979h                          ; eb d1
     mov dx, 003dah                            ; ba da 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov word [bp-00ah], strict word 00000h    ; c7 46 f6 00 00
-    jmp short 029f4h                          ; eb 06
+    jmp short 029bbh                          ; eb 06
     cmp word [bp-00ah], strict byte 00008h    ; 83 7e f6 08
-    jnbe short 02a11h                         ; 77 1d
+    jnbe short 029d8h                         ; 77 1d
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     mov dx, 003ceh                            ; ba ce 03
     out DX, AL                                ; ee
@@ -4893,195 +4883,195 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 7a 05
+    call 02f4ch                               ; e8 7a 05
     inc cx                                    ; 41
     inc word [bp-00ah]                        ; ff 46 f6
-    jmp short 029eeh                          ; eb dd
+    jmp short 029b5h                          ; eb dd
     mov bx, di                                ; 89 fb
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 87 05
+    call 02f68h                               ; e8 87 05
     inc cx                                    ; 41
     inc cx                                    ; 41
     xor bx, bx                                ; 31 db
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 60 05
+    call 02f4ch                               ; e8 60 05
     inc cx                                    ; 41
     xor bx, bx                                ; 31 db
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 56 05
+    call 02f4ch                               ; e8 56 05
     inc cx                                    ; 41
     xor bx, bx                                ; 31 db
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 4c 05
+    call 02f4ch                               ; e8 4c 05
     inc cx                                    ; 41
     xor bx, bx                                ; 31 db
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 42 05
+    call 02f4ch                               ; e8 42 05
     inc cx                                    ; 41
     test byte [bp-00ch], 002h                 ; f6 46 f4 02
-    je near 02bb3h                            ; 0f 84 67 01
+    je near 02b7ah                            ; 0f 84 67 01
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 22 05
+    call 02f3eh                               ; e8 22 05
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 26 05
+    call 02f4ch                               ; e8 26 05
     inc cx                                    ; 41
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 2a 05
+    call 02f5ah                               ; e8 2a 05
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 2f 05
+    call 02f68h                               ; e8 2f 05
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, strict word 0004ch                ; ba 4c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 16 05
+    call 02f5ah                               ; e8 16 05
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 1b 05
+    call 02f68h                               ; e8 1b 05
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, strict word 00063h                ; ba 63 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 02 05
+    call 02f5ah                               ; e8 02 05
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 07 05
+    call 02f68h                               ; e8 07 05
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 d2 04
+    call 02f3eh                               ; e8 d2 04
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 d6 04
+    call 02f4ch                               ; e8 d6 04
     inc cx                                    ; 41
     mov dx, 00085h                            ; ba 85 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 da 04
+    call 02f5ah                               ; e8 da 04
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 df 04
+    call 02f68h                               ; e8 df 04
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, 00087h                            ; ba 87 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 aa 04
+    call 02f3eh                               ; e8 aa 04
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 ae 04
+    call 02f4ch                               ; e8 ae 04
     inc cx                                    ; 41
     mov dx, 00088h                            ; ba 88 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 96 04
+    call 02f3eh                               ; e8 96 04
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 9a 04
+    call 02f4ch                               ; e8 9a 04
     inc cx                                    ; 41
     mov dx, 00089h                            ; ba 89 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 82 04
+    call 02f3eh                               ; e8 82 04
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 86 04
+    call 02f4ch                               ; e8 86 04
     inc cx                                    ; 41
     mov dx, strict word 00060h                ; ba 60 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 8a 04
+    call 02f5ah                               ; e8 8a 04
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 8f 04
+    call 02f68h                               ; e8 8f 04
     mov word [bp-00ah], strict word 00000h    ; c7 46 f6 00 00
     inc cx                                    ; 41
     inc cx                                    ; 41
-    jmp short 02b21h                          ; eb 06
+    jmp short 02ae8h                          ; eb 06
     cmp word [bp-00ah], strict byte 00008h    ; 83 7e f6 08
-    jnc short 02b3fh                          ; 73 1e
+    jnc short 02b06h                          ; 73 1e
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, dx                                ; 01 d2
     add dx, strict byte 00050h                ; 83 c2 50
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 64 04
+    call 02f5ah                               ; e8 64 04
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 69 04
+    call 02f68h                               ; e8 69 04
     inc cx                                    ; 41
     inc cx                                    ; 41
     inc word [bp-00ah]                        ; ff 46 f6
-    jmp short 02b1bh                          ; eb dc
+    jmp short 02ae2h                          ; eb dc
     mov dx, strict word 0004eh                ; ba 4e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f93h                               ; e8 4b 04
+    call 02f5ah                               ; e8 4b 04
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 50 04
+    call 02f68h                               ; e8 50 04
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, strict word 00062h                ; ba 62 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f77h                               ; e8 1b 04
+    call 02f3eh                               ; e8 1b 04
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 1f 04
+    call 02f4ch                               ; e8 1f 04
     inc cx                                    ; 41
     mov dx, strict word 0007ch                ; ba 7c 00
     xor ax, ax                                ; 31 c0
-    call 02f93h                               ; e8 24 04
+    call 02f5ah                               ; e8 24 04
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 29 04
+    call 02f68h                               ; e8 29 04
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, strict word 0007eh                ; ba 7e 00
     xor ax, ax                                ; 31 c0
-    call 02f93h                               ; e8 11 04
+    call 02f5ah                               ; e8 11 04
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 16 04
+    call 02f68h                               ; e8 16 04
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, 0010ch                            ; ba 0c 01
     xor ax, ax                                ; 31 c0
-    call 02f93h                               ; e8 fe 03
+    call 02f5ah                               ; e8 fe 03
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 03 04
+    call 02f68h                               ; e8 03 04
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, 0010eh                            ; ba 0e 01
     xor ax, ax                                ; 31 c0
-    call 02f93h                               ; e8 eb 03
+    call 02f5ah                               ; e8 eb 03
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 f0 03
+    call 02f68h                               ; e8 f0 03
     inc cx                                    ; 41
     inc cx                                    ; 41
     test byte [bp-00ch], 004h                 ; f6 46 f4 04
-    je short 02c20h                           ; 74 67
+    je short 02be7h                           ; 74 67
     mov dx, 003c7h                            ; ba c7 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -5089,7 +5079,7 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 bc 03
+    call 02f4ch                               ; e8 bc 03
     inc cx                                    ; 41
     mov dx, 003c8h                            ; ba c8 03
     in AL, DX                                 ; ec
@@ -5098,7 +5088,7 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 ab 03
+    call 02f4ch                               ; e8 ab 03
     inc cx                                    ; 41
     mov dx, 003c6h                            ; ba c6 03
     in AL, DX                                 ; ec
@@ -5107,16 +5097,16 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 9a 03
+    call 02f4ch                               ; e8 9a 03
     inc cx                                    ; 41
     xor al, al                                ; 30 c0
     mov dx, 003c8h                            ; ba c8 03
     out DX, AL                                ; ee
     xor ah, ah                                ; 30 e4
     mov word [bp-00ah], ax                    ; 89 46 f6
-    jmp short 02c00h                          ; eb 07
+    jmp short 02bc7h                          ; eb 07
     cmp word [bp-00ah], 00300h                ; 81 7e f6 00 03
-    jnc short 02c16h                          ; 73 16
+    jnc short 02bddh                          ; 73 16
     mov dx, 003c9h                            ; ba c9 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -5124,14 +5114,14 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 75 03
+    call 02f4ch                               ; e8 75 03
     inc cx                                    ; 41
     inc word [bp-00ah]                        ; ff 46 f6
-    jmp short 02bf9h                          ; eb e3
+    jmp short 02bc0h                          ; eb e3
     xor bx, bx                                ; 31 db
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 66 03
+    call 02f4ch                               ; e8 66 03
     inc cx                                    ; 41
     mov ax, cx                                ; 89 c8
     lea sp, [bp-006h]                         ; 8d 66 fa
@@ -5140,7 +5130,7 @@ biosfn_save_video_state_:                    ; 0xc28c1 LB 0x369
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
+biosfn_restore_video_state_:                 ; 0xc2bf1 LB 0x326
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -5151,37 +5141,37 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     mov si, dx                                ; 89 d6
     mov cx, bx                                ; 89 d9
     test byte [bp-00eh], 001h                 ; f6 46 f2 01
-    je near 02d8ah                            ; 0f 84 4a 01
+    je near 02d51h                            ; 0f 84 4a 01
     mov dx, 003dah                            ; ba da 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     lea dx, [bx+040h]                         ; 8d 57 40
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 45 03
+    call 02f5ah                               ; e8 45 03
     mov di, ax                                ; 89 c7
     mov word [bp-008h], strict word 00001h    ; c7 46 f8 01 00
     lea cx, [bx+005h]                         ; 8d 4f 05
-    jmp short 02c60h                          ; eb 06
+    jmp short 02c27h                          ; eb 06
     cmp word [bp-008h], strict byte 00004h    ; 83 7e f8 04
-    jnbe short 02c78h                         ; 77 18
+    jnbe short 02c3fh                         ; 77 18
     mov al, byte [bp-008h]                    ; 8a 46 f8
     mov dx, 003c4h                            ; ba c4 03
     out DX, AL                                ; ee
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 09 03
+    call 02f3eh                               ; e8 09 03
     mov dx, 003c5h                            ; ba c5 03
     out DX, AL                                ; ee
     inc cx                                    ; 41
     inc word [bp-008h]                        ; ff 46 f8
-    jmp short 02c5ah                          ; eb e2
+    jmp short 02c21h                          ; eb e2
     xor al, al                                ; 30 c0
     mov dx, 003c4h                            ; ba c4 03
     out DX, AL                                ; ee
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 f2 02
+    call 02f3eh                               ; e8 f2 02
     mov dx, 003c5h                            ; ba c5 03
     out DX, AL                                ; ee
     inc cx                                    ; 41
@@ -5189,22 +5179,22 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     mov dx, di                                ; 89 fa
     out DX, ax                                ; ef
     mov word [bp-008h], strict word 00000h    ; c7 46 f8 00 00
-    jmp short 02c9dh                          ; eb 06
+    jmp short 02c64h                          ; eb 06
     cmp word [bp-008h], strict byte 00018h    ; 83 7e f8 18
-    jnbe short 02cbah                         ; 77 1d
+    jnbe short 02c81h                         ; 77 1d
     cmp word [bp-008h], strict byte 00011h    ; 83 7e f8 11
-    je short 02cb4h                           ; 74 11
+    je short 02c7bh                           ; 74 11
     mov al, byte [bp-008h]                    ; 8a 46 f8
     mov dx, di                                ; 89 fa
     out DX, AL                                ; ee
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 c7 02
+    call 02f3eh                               ; e8 c7 02
     lea dx, [di+001h]                         ; 8d 55 01
     out DX, AL                                ; ee
     inc cx                                    ; 41
     inc word [bp-008h]                        ; ff 46 f8
-    jmp short 02c97h                          ; eb dd
+    jmp short 02c5eh                          ; eb dd
     mov dx, 003cch                            ; ba cc 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -5212,7 +5202,7 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     and AL, strict byte 0feh                  ; 24 fe
     mov word [bp-00ah], ax                    ; 89 46 f6
     cmp di, 003d4h                            ; 81 ff d4 03
-    jne short 02ccfh                          ; 75 04
+    jne short 02c96h                          ; 75 04
     or byte [bp-00ah], 001h                   ; 80 4e f6 01
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     mov dx, 003c2h                            ; ba c2 03
@@ -5223,12 +5213,12 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     mov dx, cx                                ; 89 ca
     add dx, strict byte 0fff9h                ; 83 c2 f9
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 92 02
+    call 02f3eh                               ; e8 92 02
     lea dx, [di+001h]                         ; 8d 55 01
     out DX, AL                                ; ee
     lea dx, [bx+003h]                         ; 8d 57 03
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 86 02
+    call 02f3eh                               ; e8 86 02
     xor ah, ah                                ; 30 e4
     mov word [bp-00ch], ax                    ; 89 46 f4
     mov dx, 003dah                            ; ba da 03
@@ -5236,9 +5226,9 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov word [bp-008h], strict word 00000h    ; c7 46 f8 00 00
-    jmp short 02d09h                          ; eb 06
+    jmp short 02cd0h                          ; eb 06
     cmp word [bp-008h], strict byte 00013h    ; 83 7e f8 13
-    jnbe short 02d27h                         ; 77 1e
+    jnbe short 02ceeh                         ; 77 1e
     mov ax, word [bp-00ch]                    ; 8b 46 f4
     and ax, strict word 00020h                ; 25 20 00
     or ax, word [bp-008h]                     ; 0b 46 f8
@@ -5246,12 +5236,12 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     out DX, AL                                ; ee
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 5a 02
+    call 02f3eh                               ; e8 5a 02
     mov dx, 003c0h                            ; ba c0 03
     out DX, AL                                ; ee
     inc cx                                    ; 41
     inc word [bp-008h]                        ; ff 46 f8
-    jmp short 02d03h                          ; eb dc
+    jmp short 02ccah                          ; eb dc
     mov al, byte [bp-00ch]                    ; 8a 46 f4
     mov dx, 003c0h                            ; ba c0 03
     out DX, AL                                ; ee
@@ -5260,212 +5250,212 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov word [bp-008h], strict word 00000h    ; c7 46 f8 00 00
-    jmp short 02d41h                          ; eb 06
+    jmp short 02d08h                          ; eb 06
     cmp word [bp-008h], strict byte 00008h    ; 83 7e f8 08
-    jnbe short 02d59h                         ; 77 18
+    jnbe short 02d20h                         ; 77 18
     mov al, byte [bp-008h]                    ; 8a 46 f8
     mov dx, 003ceh                            ; ba ce 03
     out DX, AL                                ; ee
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 28 02
+    call 02f3eh                               ; e8 28 02
     mov dx, 003cfh                            ; ba cf 03
     out DX, AL                                ; ee
     inc cx                                    ; 41
     inc word [bp-008h]                        ; ff 46 f8
-    jmp short 02d3bh                          ; eb e2
+    jmp short 02d02h                          ; eb e2
     add cx, strict byte 00006h                ; 83 c1 06
     mov dx, bx                                ; 89 da
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 14 02
+    call 02f3eh                               ; e8 14 02
     mov dx, 003c4h                            ; ba c4 03
     out DX, AL                                ; ee
     inc bx                                    ; 43
     mov dx, bx                                ; 89 da
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 08 02
+    call 02f3eh                               ; e8 08 02
     mov dx, di                                ; 89 fa
     out DX, AL                                ; ee
     inc bx                                    ; 43
     mov dx, bx                                ; 89 da
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 fd 01
+    call 02f3eh                               ; e8 fd 01
     mov dx, 003ceh                            ; ba ce 03
     out DX, AL                                ; ee
     lea dx, [bx+002h]                         ; 8d 57 02
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 f1 01
+    call 02f3eh                               ; e8 f1 01
     lea dx, [di+006h]                         ; 8d 55 06
     out DX, AL                                ; ee
     test byte [bp-00eh], 002h                 ; f6 46 f2 02
-    je near 02ef9h                            ; 0f 84 67 01
+    je near 02ec0h                            ; 0f 84 67 01
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 de 01
+    call 02f3eh                               ; e8 de 01
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00049h                ; ba 49 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 e0 01
+    call 02f4ch                               ; e8 e0 01
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 e6 01
+    call 02f5ah                               ; e8 e6 01
     mov bx, ax                                ; 89 c3
     mov dx, strict word 0004ah                ; ba 4a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 e9 01
+    call 02f68h                               ; e8 e9 01
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 d2 01
+    call 02f5ah                               ; e8 d2 01
     mov bx, ax                                ; 89 c3
     mov dx, strict word 0004ch                ; ba 4c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 d5 01
+    call 02f68h                               ; e8 d5 01
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 be 01
+    call 02f5ah                               ; e8 be 01
     mov bx, ax                                ; 89 c3
     mov dx, strict word 00063h                ; ba 63 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 c1 01
+    call 02f68h                               ; e8 c1 01
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 8e 01
+    call 02f3eh                               ; e8 8e 01
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00084h                            ; ba 84 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 90 01
+    call 02f4ch                               ; e8 90 01
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 96 01
+    call 02f5ah                               ; e8 96 01
     mov bx, ax                                ; 89 c3
     mov dx, 00085h                            ; ba 85 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 99 01
+    call 02f68h                               ; e8 99 01
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 66 01
+    call 02f3eh                               ; e8 66 01
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00087h                            ; ba 87 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 68 01
+    call 02f4ch                               ; e8 68 01
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 52 01
+    call 02f3eh                               ; e8 52 01
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00088h                            ; ba 88 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 54 01
+    call 02f4ch                               ; e8 54 01
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 3e 01
+    call 02f3eh                               ; e8 3e 01
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00089h                            ; ba 89 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 40 01
+    call 02f4ch                               ; e8 40 01
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 46 01
+    call 02f5ah                               ; e8 46 01
     mov bx, ax                                ; 89 c3
     mov dx, strict word 00060h                ; ba 60 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 49 01
+    call 02f68h                               ; e8 49 01
     mov word [bp-008h], strict word 00000h    ; c7 46 f8 00 00
     inc cx                                    ; 41
     inc cx                                    ; 41
-    jmp short 02e67h                          ; eb 06
+    jmp short 02e2eh                          ; eb 06
     cmp word [bp-008h], strict byte 00008h    ; 83 7e f8 08
-    jnc short 02e85h                          ; 73 1e
+    jnc short 02e4ch                          ; 73 1e
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 25 01
+    call 02f5ah                               ; e8 25 01
     mov bx, ax                                ; 89 c3
     mov dx, word [bp-008h]                    ; 8b 56 f8
     add dx, dx                                ; 01 d2
     add dx, strict byte 00050h                ; 83 c2 50
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 23 01
+    call 02f68h                               ; e8 23 01
     inc cx                                    ; 41
     inc cx                                    ; 41
     inc word [bp-008h]                        ; ff 46 f8
-    jmp short 02e61h                          ; eb dc
+    jmp short 02e28h                          ; eb dc
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 07 01
+    call 02f5ah                               ; e8 07 01
     mov bx, ax                                ; 89 c3
     mov dx, strict word 0004eh                ; ba 4e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 0a 01
+    call 02f68h                               ; e8 0a 01
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 d7 00
+    call 02f3eh                               ; e8 d7 00
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00062h                ; ba 62 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 d9 00
+    call 02f4ch                               ; e8 d9 00
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 df 00
+    call 02f5ah                               ; e8 df 00
     mov bx, ax                                ; 89 c3
     mov dx, strict word 0007ch                ; ba 7c 00
     xor ax, ax                                ; 31 c0
-    call 02fa1h                               ; e8 e3 00
+    call 02f68h                               ; e8 e3 00
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 cc 00
+    call 02f5ah                               ; e8 cc 00
     mov bx, ax                                ; 89 c3
     mov dx, strict word 0007eh                ; ba 7e 00
     xor ax, ax                                ; 31 c0
-    call 02fa1h                               ; e8 d0 00
+    call 02f68h                               ; e8 d0 00
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 b9 00
+    call 02f5ah                               ; e8 b9 00
     mov bx, ax                                ; 89 c3
     mov dx, 0010ch                            ; ba 0c 01
     xor ax, ax                                ; 31 c0
-    call 02fa1h                               ; e8 bd 00
+    call 02f68h                               ; e8 bd 00
     inc cx                                    ; 41
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f93h                               ; e8 a6 00
+    call 02f5ah                               ; e8 a6 00
     mov bx, ax                                ; 89 c3
     mov dx, 0010eh                            ; ba 0e 01
     xor ax, ax                                ; 31 c0
-    call 02fa1h                               ; e8 aa 00
+    call 02f68h                               ; e8 aa 00
     inc cx                                    ; 41
     inc cx                                    ; 41
     test byte [bp-00eh], 004h                 ; f6 46 f2 04
-    je short 02f46h                           ; 74 47
+    je short 02f0dh                           ; 74 47
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 70 00
+    call 02f3eh                               ; e8 70 00
     xor ah, ah                                ; 30 e4
     mov word [bp-00ah], ax                    ; 89 46 f6
     inc cx                                    ; 41
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 63 00
+    call 02f3eh                               ; e8 63 00
     mov dx, 003c6h                            ; ba c6 03
     out DX, AL                                ; ee
     inc cx                                    ; 41
@@ -5474,17 +5464,17 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     out DX, AL                                ; ee
     xor ah, ah                                ; 30 e4
     mov word [bp-008h], ax                    ; 89 46 f8
-    jmp short 02f2dh                          ; eb 07
+    jmp short 02ef4h                          ; eb 07
     cmp word [bp-008h], 00300h                ; 81 7e f8 00 03
-    jnc short 02f3eh                          ; 73 11
+    jnc short 02f05h                          ; 73 11
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 43 00
+    call 02f3eh                               ; e8 43 00
     mov dx, 003c9h                            ; ba c9 03
     out DX, AL                                ; ee
     inc cx                                    ; 41
     inc word [bp-008h]                        ; ff 46 f8
-    jmp short 02f26h                          ; eb e8
+    jmp short 02eedh                          ; eb e8
     inc cx                                    ; 41
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     mov dx, 003c8h                            ; ba c8 03
@@ -5496,7 +5486,7 @@ biosfn_restore_video_state_:                 ; 0xc2c2a LB 0x326
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-find_vga_entry_:                             ; 0xc2f50 LB 0x27
+find_vga_entry_:                             ; 0xc2f17 LB 0x27
     push bx                                   ; 53
     push dx                                   ; 52
     push bp                                   ; 55
@@ -5504,22 +5494,22 @@ find_vga_entry_:                             ; 0xc2f50 LB 0x27
     mov dl, al                                ; 88 c2
     mov AH, strict byte 0ffh                  ; b4 ff
     xor al, al                                ; 30 c0
-    jmp short 02f63h                          ; eb 06
+    jmp short 02f2ah                          ; eb 06
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     cmp AL, strict byte 00fh                  ; 3c 0f
-    jnbe short 02f71h                         ; 77 0e
+    jnbe short 02f38h                         ; 77 0e
     movzx bx, al                              ; 0f b6 d8
     sal bx, 003h                              ; c1 e3 03
-    cmp dl, byte [bx+0482fh]                  ; 3a 97 2f 48
-    jne short 02f5dh                          ; 75 ee
+    cmp dl, byte [bx+04634h]                  ; 3a 97 34 46
+    jne short 02f24h                          ; 75 ee
     mov ah, al                                ; 88 c4
     mov al, ah                                ; 88 e0
     pop bp                                    ; 5d
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     retn                                      ; c3
-read_byte_:                                  ; 0xc2f77 LB 0xe
+read_byte_:                                  ; 0xc2f3e LB 0xe
     push bx                                   ; 53
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -5529,7 +5519,7 @@ read_byte_:                                  ; 0xc2f77 LB 0xe
     pop bp                                    ; 5d
     pop bx                                    ; 5b
     retn                                      ; c3
-write_byte_:                                 ; 0xc2f85 LB 0xe
+write_byte_:                                 ; 0xc2f4c LB 0xe
     push si                                   ; 56
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -5539,7 +5529,7 @@ write_byte_:                                 ; 0xc2f85 LB 0xe
     pop bp                                    ; 5d
     pop si                                    ; 5e
     retn                                      ; c3
-read_word_:                                  ; 0xc2f93 LB 0xe
+read_word_:                                  ; 0xc2f5a LB 0xe
     push bx                                   ; 53
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -5549,7 +5539,7 @@ read_word_:                                  ; 0xc2f93 LB 0xe
     pop bp                                    ; 5d
     pop bx                                    ; 5b
     retn                                      ; c3
-write_word_:                                 ; 0xc2fa1 LB 0xe
+write_word_:                                 ; 0xc2f68 LB 0xe
     push si                                   ; 56
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -5559,7 +5549,7 @@ write_word_:                                 ; 0xc2fa1 LB 0xe
     pop bp                                    ; 5d
     pop si                                    ; 5e
     retn                                      ; c3
-read_dword_:                                 ; 0xc2faf LB 0x12
+read_dword_:                                 ; 0xc2f76 LB 0x12
     push bx                                   ; 53
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -5570,7 +5560,7 @@ read_dword_:                                 ; 0xc2faf LB 0x12
     pop bp                                    ; 5d
     pop bx                                    ; 5b
     retn                                      ; c3
-write_dword_:                                ; 0xc2fc1 LB 0x7f
+write_dword_:                                ; 0xc2f88 LB 0x7f
     push si                                   ; 56
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -5592,26 +5582,27 @@ write_dword_:                                ; 0xc2fc1 LB 0x7f
     push ES                                   ; 06
     add ax, 00304h                            ; 05 04 03
     add al, byte [bx+di]                      ; 02 01
-    add byte [bp+di], al                      ; 00 03
-    xor AL, strict byte 06eh                  ; 34 6e
-    xor byte [si-03fd0h], ch                  ; 30 ac 30 c0
-    xor cl, dl                                ; 30 d1
-    xor ch, ah                                ; 30 e5
-    xor dh, dh                                ; 30 f6
-    xor byte [bx+si], al                      ; 30 00
-    xor word [bp+si], di                      ; 31 3a
-    xor word [04f31h], di                     ; 31 3e 31 4f
-    xor word [si+031h], bp                    ; 31 6c 31
-    mov word [bx+di], si                      ; 89 31
-    test ax, 0c631h                           ; a9 31 c6
-    xor bp, bx                                ; 31 dd
-    xor cx, bp                                ; 31 e9
-    xor sp, ax                                ; 31 c4
-    db  032h, 0ffh
-    ; xor bh, bh                                ; 32 ff
-    xor ch, byte [bx]                         ; 32 2f
-    xor ax, word [si+033h]                    ; 33 44 33
-    xchg byte [bp+di], dh                     ; 86 33
+    add dl, cl                                ; 00 ca
+    xor si, word [di]                         ; 33 35
+    xor byte [bp+di+030h], dh                 ; 30 73 30
+    xchg word [bx+si], si                     ; 87 30
+    cbw                                       ; 98
+    xor byte [si-042d0h], ch                  ; 30 ac 30 bd
+    xor bh, al                                ; 30 c7
+    xor byte [bx+di], al                      ; 30 01
+    xor word [di], ax                         ; 31 05
+    xor word [03331h], dx                     ; 31 16 31 33
+    xor word [bx+si+031h], dx                 ; 31 50 31
+    jo short 02ffch                           ; 70 31
+    lea si, [bx+di]                           ; 8d 31
+    movsb                                     ; a4
+    xor word [bx+si-074cfh], si               ; 31 b0 31 8b
+    db  032h, 0c6h
+    ; xor al, dh                                ; 32 c6
+    db  032h, 0f6h
+    ; xor dh, dh                                ; 32 f6
+    xor cl, byte [bp+di]                      ; 32 0b
+    xor cx, word [di+033h]                    ; 33 4d 33
     xor byte [si], ah                         ; 30 24
     and sp, word [bp+si]                      ; 23 22
     and word [bx+si], sp                      ; 21 20
@@ -5619,21 +5610,20 @@ write_dword_:                                ; 0xc2fc1 LB 0x7f
     adc word [bx+si], dx                      ; 11 10
     add AL, strict byte 002h                  ; 04 02
     add word [bx+si], ax                      ; 01 00
-    add si, word [si]                         ; 03 34
-    or dh, byte [bp+si]                       ; 0a 32
-    xor byte [bp+si], dh                      ; 30 32
-    inc cx                                    ; 41
-    xor dl, byte [bp+si+032h]                 ; 32 52 32
-    or dh, byte [bp+si]                       ; 0a 32
-    xor byte [bp+si], dh                      ; 30 32
-    inc cx                                    ; 41
-    xor dl, byte [bp+si+032h]                 ; 32 52 32
-    arpl word [bp+si], si                     ; 63 32
-    outsw                                     ; 6f
-    xor cl, byte [bp+si-06aceh]               ; 32 8a 32 95
-    xor ah, byte [bx+si-054ceh]               ; 32 a0 32 ab
-    db  032h
-_int10_func:                                 ; 0xc3040 LB 0x3ca
+    retf 0d133h                               ; ca 33 d1
+    xor di, si                                ; 31 f7
+    xor word [bx+si], cx                      ; 31 08
+    xor bl, byte [bx+di]                      ; 32 19
+    db  032h, 0d1h
+    ; xor dl, cl                                ; 32 d1
+    xor di, si                                ; 31 f7
+    xor word [bx+si], cx                      ; 31 08
+    xor bl, byte [bx+di]                      ; 32 19
+    xor ch, byte [bp+si]                      ; 32 2a
+    xor dh, byte [05132h]                     ; 32 36 32 51
+    xor bl, byte [si+032h]                    ; 32 5c 32
+    xor dh, byte [edx+032h]                   ; 67 32 72 32
+_int10_func:                                 ; 0xc3007 LB 0x3ca
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -5643,72 +5633,72 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     mov ax, word [bp+012h]                    ; 8b 46 12
     shr ax, 008h                              ; c1 e8 08
     cmp ax, strict word 0004fh                ; 3d 4f 00
-    jnbe near 03403h                          ; 0f 87 ad 03
+    jnbe near 033cah                          ; 0f 87 ad 03
     push CS                                   ; 0e
     pop ES                                    ; 07
     mov cx, strict word 00016h                ; b9 16 00
-    mov di, 02fd3h                            ; bf d3 2f
+    mov di, 02f9ah                            ; bf 9a 2f
     repne scasb                               ; f2 ae
     sal cx, 1                                 ; d1 e1
     mov di, cx                                ; 89 cf
-    mov ax, word [cs:di+02fe8h]               ; 2e 8b 85 e8 2f
+    mov ax, word [cs:di+02fafh]               ; 2e 8b 85 af 2f
     mov cl, byte [bp+012h]                    ; 8a 4e 12
     jmp ax                                    ; ff e0
     mov al, byte [bp+012h]                    ; 8a 46 12
     xor ah, ah                                ; 30 e4
-    call 00fdch                               ; e8 66 df
+    call 00fdch                               ; e8 9f df
     mov ax, word [bp+012h]                    ; 8b 46 12
     and ax, strict word 0007fh                ; 25 7f 00
     cmp ax, strict word 00007h                ; 3d 07 00
-    je short 03096h                           ; 74 15
+    je short 0305dh                           ; 74 15
     cmp ax, strict word 00006h                ; 3d 06 00
-    je short 0308dh                           ; 74 07
+    je short 03054h                           ; 74 07
     cmp ax, strict word 00005h                ; 3d 05 00
-    jbe short 03096h                          ; 76 0b
-    jmp short 0309fh                          ; eb 12
+    jbe short 0305dh                          ; 76 0b
+    jmp short 03066h                          ; eb 12
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor al, al                                ; 30 c0
     or AL, strict byte 03fh                   ; 0c 3f
-    jmp short 030a6h                          ; eb 10
+    jmp short 0306dh                          ; eb 10
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor al, al                                ; 30 c0
     or AL, strict byte 030h                   ; 0c 30
-    jmp short 030a6h                          ; eb 07
+    jmp short 0306dh                          ; eb 07
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor al, al                                ; 30 c0
     or AL, strict byte 020h                   ; 0c 20
     mov word [bp+012h], ax                    ; 89 46 12
-    jmp near 03403h                           ; e9 57 03
+    jmp near 033cah                           ; e9 57 03
     mov al, byte [bp+010h]                    ; 8a 46 10
     movzx dx, al                              ; 0f b6 d0
     mov ax, word [bp+010h]                    ; 8b 46 10
     shr ax, 008h                              ; c1 e8 08
     xor ah, ah                                ; 30 e4
-    call 00dbah                               ; e8 fd dc
-    jmp near 03403h                           ; e9 43 03
+    call 00dbah                               ; e8 36 dd
+    jmp near 033cah                           ; e9 43 03
     mov dx, word [bp+00eh]                    ; 8b 56 0e
     mov ax, word [bp+00ch]                    ; 8b 46 0c
     shr ax, 008h                              ; c1 e8 08
     xor ah, ah                                ; 30 e4
-    call 00e5eh                               ; e8 90 dd
-    jmp near 03403h                           ; e9 32 03
+    call 00e5eh                               ; e8 c9 dd
+    jmp near 033cah                           ; e9 32 03
     lea bx, [bp+00eh]                         ; 8d 5e 0e
     lea dx, [bp+010h]                         ; 8d 56 10
     mov ax, word [bp+00ch]                    ; 8b 46 0c
     shr ax, 008h                              ; c1 e8 08
     xor ah, ah                                ; 30 e4
-    call 00a88h                               ; e8 a6 d9
-    jmp near 03403h                           ; e9 1e 03
+    call 00a88h                               ; e8 df d9
+    jmp near 033cah                           ; e9 1e 03
     xor ax, ax                                ; 31 c0
     mov word [bp+012h], ax                    ; 89 46 12
     mov word [bp+00ch], ax                    ; 89 46 0c
     mov word [bp+010h], ax                    ; 89 46 10
     mov word [bp+00eh], ax                    ; 89 46 0e
-    jmp near 03403h                           ; e9 0d 03
+    jmp near 033cah                           ; e9 0d 03
     mov al, cl                                ; 88 c8
     xor ah, ah                                ; 30 e4
-    call 00f00h                               ; e8 03 de
-    jmp near 03403h                           ; e9 03 03
+    call 00f00h                               ; e8 3c de
+    jmp near 033cah                           ; e9 03 03
     mov ax, strict word 00001h                ; b8 01 00
     push ax                                   ; 50
     mov ax, 000ffh                            ; b8 ff 00
@@ -5730,16 +5720,16 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     movzx dx, al                              ; 0f b6 d0
     mov al, byte [bp+012h]                    ; 8a 46 12
     xor ah, ah                                ; 30 e4
-    call 01568h                               ; e8 31 e4
-    jmp near 03403h                           ; e9 c9 02
+    call 01572h                               ; e8 74 e4
+    jmp near 033cah                           ; e9 c9 02
     xor ax, ax                                ; 31 c0
-    jmp short 03103h                          ; eb c5
+    jmp short 030cah                          ; eb c5
     lea dx, [bp+012h]                         ; 8d 56 12
     mov ax, word [bp+00ch]                    ; 8b 46 0c
     shr ax, 008h                              ; c1 e8 08
     xor ah, ah                                ; 30 e4
-    call 00acbh                               ; e8 7f d9
-    jmp near 03403h                           ; e9 b4 02
+    call 00acbh                               ; e8 b8 d9
+    jmp near 033cah                           ; e9 b4 02
     mov cx, word [bp+010h]                    ; 8b 4e 10
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     movzx bx, al                              ; 0f b6 d8
@@ -5748,8 +5738,8 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     movzx dx, al                              ; 0f b6 d0
     mov al, byte [bp+012h]                    ; 8a 46 12
     xor ah, ah                                ; 30 e4
-    call 01d08h                               ; e8 9f eb
-    jmp near 03403h                           ; e9 97 02
+    call 01d12h                               ; e8 e2 eb
+    jmp near 033cah                           ; e9 97 02
     mov cx, word [bp+010h]                    ; 8b 4e 10
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     movzx bx, al                              ; 0f b6 d8
@@ -5758,8 +5748,8 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     movzx dx, al                              ; 0f b6 d0
     mov al, byte [bp+012h]                    ; 8a 46 12
     xor ah, ah                                ; 30 e4
-    call 01e70h                               ; e8 ea ec
-    jmp near 03403h                           ; e9 7a 02
+    call 01e7ah                               ; e8 2d ed
+    jmp near 033cah                           ; e9 7a 02
     mov cx, word [bp+00eh]                    ; 8b 4e 0e
     mov bx, word [bp+010h]                    ; 8b 5e 10
     mov al, byte [bp+012h]                    ; 8a 46 12
@@ -5769,8 +5759,8 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     mov word [bp-006h], ax                    ; 89 46 fa
     mov al, byte [bp-006h]                    ; 8a 46 fa
     xor ah, ah                                ; 30 e4
-    call 01fdfh                               ; e8 39 ee
-    jmp near 03403h                           ; e9 5a 02
+    call 01fe9h                               ; e8 7c ee
+    jmp near 033cah                           ; e9 5a 02
     lea cx, [bp+012h]                         ; 8d 4e 12
     mov bx, word [bp+00eh]                    ; 8b 5e 0e
     mov dx, word [bp+010h]                    ; 8b 56 10
@@ -5779,32 +5769,32 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     mov word [bp-006h], ax                    ; 89 46 fa
     mov al, byte [bp-006h]                    ; 8a 46 fa
     xor ah, ah                                ; 30 e4
-    call 00bf5h                               ; e8 32 da
-    jmp near 03403h                           ; e9 3d 02
+    call 00bf5h                               ; e8 6b da
+    jmp near 033cah                           ; e9 3d 02
     mov cx, strict word 00002h                ; b9 02 00
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     movzx bx, al                              ; 0f b6 d8
     mov dx, 000ffh                            ; ba ff 00
     mov al, byte [bp+012h]                    ; 8a 46 12
     xor ah, ah                                ; 30 e4
-    call 02149h                               ; e8 6f ef
-    jmp near 03403h                           ; e9 26 02
+    call 02153h                               ; e8 b2 ef
+    jmp near 033cah                           ; e9 26 02
     mov dx, word [bp+010h]                    ; 8b 56 10
     mov ax, word [bp+00ch]                    ; 8b 46 0c
-    call 00d2eh                               ; e8 48 db
-    jmp near 03403h                           ; e9 1a 02
+    call 00d2eh                               ; e8 81 db
+    jmp near 033cah                           ; e9 1a 02
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     cmp ax, strict word 00030h                ; 3d 30 00
-    jnbe near 03403h                          ; 0f 87 0e 02
+    jnbe near 033cah                          ; 0f 87 0e 02
     push CS                                   ; 0e
     pop ES                                    ; 07
     mov cx, strict word 0000fh                ; b9 0f 00
-    mov di, 03014h                            ; bf 14 30
+    mov di, 02fdbh                            ; bf db 2f
     repne scasb                               ; f2 ae
     sal cx, 1                                 ; d1 e1
     mov di, cx                                ; 89 cf
-    mov ax, word [cs:di+03022h]               ; 2e 8b 85 22 30
+    mov ax, word [cs:di+02fe9h]               ; 2e 8b 85 e9 2f
     jmp ax                                    ; ff e0
     mov ax, word [bp+00ch]                    ; 8b 46 0c
     shr ax, 008h                              ; c1 e8 08
@@ -5819,30 +5809,30 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     mov cx, word [bp+010h]                    ; 8b 4e 10
     mov bx, word [bp+008h]                    ; 8b 5e 08
     mov dx, word [bp+016h]                    ; 8b 56 16
-    call 024f4h                               ; e8 c7 f2
-    jmp near 03403h                           ; e9 d3 01
+    call 024bbh                               ; e8 c7 f2
+    jmp near 033cah                           ; e9 d3 01
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     movzx dx, al                              ; 0f b6 d0
     mov al, byte [bp+012h]                    ; 8a 46 12
     xor ah, ah                                ; 30 e4
-    call 02571h                               ; e8 33 f3
-    jmp near 03403h                           ; e9 c2 01
+    call 02538h                               ; e8 33 f3
+    jmp near 033cah                           ; e9 c2 01
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     movzx dx, al                              ; 0f b6 d0
     mov al, byte [bp+012h]                    ; 8a 46 12
     xor ah, ah                                ; 30 e4
-    call 025e1h                               ; e8 92 f3
-    jmp near 03403h                           ; e9 b1 01
+    call 025a8h                               ; e8 92 f3
+    jmp near 033cah                           ; e9 b1 01
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     movzx dx, al                              ; 0f b6 d0
     mov al, byte [bp+012h]                    ; 8a 46 12
     xor ah, ah                                ; 30 e4
-    call 02653h                               ; e8 f3 f3
-    jmp near 03403h                           ; e9 a0 01
+    call 0261ah                               ; e8 f3 f3
+    jmp near 033cah                           ; e9 a0 01
     mov dx, word [bp+008h]                    ; 8b 56 08
     mov ax, word [bp+016h]                    ; 8b 46 16
-    call 026c5h                               ; e8 59 f4
-    jmp near 03403h                           ; e9 94 01
+    call 0268ch                               ; e8 59 f4
+    jmp near 033cah                           ; e9 94 01
     mov al, byte [bp+00eh]                    ; 8a 46 0e
     xor ah, ah                                ; 30 e4
     push ax                                   ; 50
@@ -5851,20 +5841,20 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     mov bx, word [bp+010h]                    ; 8b 5e 10
     mov dx, word [bp+008h]                    ; 8b 56 08
     mov ax, word [bp+016h]                    ; 8b 46 16
-    call 026cah                               ; e8 43 f4
-    jmp near 03403h                           ; e9 79 01
+    call 02691h                               ; e8 43 f4
+    jmp near 033cah                           ; e9 79 01
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     xor ah, ah                                ; 30 e4
-    call 026d1h                               ; e8 3f f4
-    jmp near 03403h                           ; e9 6e 01
+    call 02698h                               ; e8 3f f4
+    jmp near 033cah                           ; e9 6e 01
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     xor ah, ah                                ; 30 e4
-    call 026d6h                               ; e8 39 f4
-    jmp near 03403h                           ; e9 63 01
+    call 0269dh                               ; e8 39 f4
+    jmp near 033cah                           ; e9 63 01
     mov al, byte [bp+00ch]                    ; 8a 46 0c
     xor ah, ah                                ; 30 e4
-    call 026dbh                               ; e8 33 f4
-    jmp near 03403h                           ; e9 58 01
+    call 026a2h                               ; e8 33 f4
+    jmp near 033cah                           ; e9 58 01
     lea ax, [bp+00eh]                         ; 8d 46 0e
     push ax                                   ; 50
     lea cx, [bp+010h]                         ; 8d 4e 10
@@ -5872,30 +5862,30 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     lea dx, [bp+016h]                         ; 8d 56 16
     mov ax, word [bp+00ch]                    ; 8b 46 0c
     shr ax, 008h                              ; c1 e8 08
-    call 00b73h                               ; e8 b2 d8
-    jmp near 03403h                           ; e9 3f 01
+    call 00b73h                               ; e8 eb d8
+    jmp near 033cah                           ; e9 3f 01
     mov ax, word [bp+00ch]                    ; 8b 46 0c
     xor ah, ah                                ; 30 e4
     cmp ax, strict word 00036h                ; 3d 36 00
-    je short 032f6h                           ; 74 28
+    je short 032bdh                           ; 74 28
     cmp ax, strict word 00035h                ; 3d 35 00
-    je short 032e0h                           ; 74 0d
+    je short 032a7h                           ; 74 0d
     cmp ax, strict word 00020h                ; 3d 20 00
-    jne near 03403h                           ; 0f 85 29 01
-    call 026e0h                               ; e8 03 f4
-    jmp near 03403h                           ; e9 23 01
+    jne near 033cah                           ; 0f 85 29 01
+    call 026a7h                               ; e8 03 f4
+    jmp near 033cah                           ; e9 23 01
     movzx ax, cl                              ; 0f b6 c1
     mov bx, word [bp+00eh]                    ; 8b 5e 0e
     mov dx, word [bp+016h]                    ; 8b 56 16
-    call 026e5h                               ; e8 f9 f3
+    call 026ach                               ; e8 f9 f3
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor al, al                                ; 30 c0
     or AL, strict byte 012h                   ; 0c 12
-    jmp near 030a6h                           ; e9 b0 fd
+    jmp near 0306dh                           ; e9 b0 fd
     mov al, cl                                ; 88 c8
     xor ah, ah                                ; 30 e4
-    call 026eah                               ; e8 ed f3
-    jmp short 032ech                          ; eb ed
+    call 026b1h                               ; e8 ed f3
+    jmp short 032b3h                          ; eb ed
     push word [bp+008h]                       ; ff 76 08
     push word [bp+016h]                       ; ff 76 16
     mov al, byte [bp+00eh]                    ; 8a 46 0e
@@ -5912,94 +5902,94 @@ _int10_func:                                 ; 0xc3040 LB 0x3ca
     movzx dx, al                              ; 0f b6 d0
     movzx ax, cl                              ; 0f b6 c1
     mov cx, word [bp+010h]                    ; 8b 4e 10
-    call 026efh                               ; e8 c3 f3
-    jmp near 03403h                           ; e9 d4 00
+    call 026b6h                               ; e8 c3 f3
+    jmp near 033cah                           ; e9 d4 00
     mov bx, si                                ; 89 f3
     mov dx, word [bp+016h]                    ; 8b 56 16
     mov ax, word [bp+00ch]                    ; 8b 46 0c
-    call 0278bh                               ; e8 51 f4
+    call 02752h                               ; e8 51 f4
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor al, al                                ; 30 c0
     or AL, strict byte 01bh                   ; 0c 1b
-    jmp near 030a6h                           ; e9 62 fd
+    jmp near 0306dh                           ; e9 62 fd
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     cmp ax, strict word 00002h                ; 3d 02 00
-    je short 03370h                           ; 74 22
+    je short 03337h                           ; 74 22
     cmp ax, strict word 00001h                ; 3d 01 00
-    je short 03362h                           ; 74 0f
+    je short 03329h                           ; 74 0f
     test ax, ax                               ; 85 c0
-    jne short 0337ch                          ; 75 25
+    jne short 03343h                          ; 75 25
     lea dx, [bp+00ch]                         ; 8d 56 0c
     mov ax, word [bp+010h]                    ; 8b 46 10
-    call 028afh                               ; e8 4f f5
-    jmp short 0337ch                          ; eb 1a
+    call 02876h                               ; e8 4f f5
+    jmp short 03343h                          ; eb 1a
     mov bx, word [bp+00ch]                    ; 8b 5e 0c
     mov dx, word [bp+016h]                    ; 8b 56 16
     mov ax, word [bp+010h]                    ; 8b 46 10
-    call 028c1h                               ; e8 53 f5
-    jmp short 0337ch                          ; eb 0c
+    call 02888h                               ; e8 53 f5
+    jmp short 03343h                          ; eb 0c
     mov bx, word [bp+00ch]                    ; 8b 5e 0c
     mov dx, word [bp+016h]                    ; 8b 56 16
     mov ax, word [bp+010h]                    ; 8b 46 10
-    call 02c2ah                               ; e8 ae f8
+    call 02bf1h                               ; e8 ae f8
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor al, al                                ; 30 c0
     or AL, strict byte 01ch                   ; 0c 1c
-    jmp near 030a6h                           ; e9 20 fd
-    call 007a4h                               ; e8 1b d4
+    jmp near 0306dh                           ; e9 20 fd
+    call 007fah                               ; e8 aa d4
     test ax, ax                               ; 85 c0
-    je near 033feh                            ; 0f 84 6f 00
+    je near 033c5h                            ; 0f 84 6f 00
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     cmp ax, strict word 00002h                ; 3d 02 00
-    jc short 033ach                           ; 72 13
-    jbe short 033d2h                          ; 76 37
+    jc short 03373h                           ; 72 13
+    jbe short 03399h                          ; 76 37
     cmp ax, strict word 0000ah                ; 3d 0a 00
-    je short 033f7h                           ; 74 57
+    je short 033beh                           ; 74 57
     cmp ax, strict word 00009h                ; 3d 09 00
-    je short 033f7h                           ; 74 52
+    je short 033beh                           ; 74 52
     cmp ax, strict word 00004h                ; 3d 04 00
-    je short 033e2h                           ; 74 38
-    jmp short 033f7h                          ; eb 4b
+    je short 033a9h                           ; 74 38
+    jmp short 033beh                          ; eb 4b
     cmp ax, strict word 00001h                ; 3d 01 00
-    je short 033c2h                           ; 74 11
+    je short 03389h                           ; 74 11
     test ax, ax                               ; 85 c0
-    jne short 033f7h                          ; 75 42
+    jne short 033beh                          ; 75 42
     mov bx, si                                ; 89 f3
     mov dx, word [bp+016h]                    ; 8b 56 16
     lea ax, [bp+012h]                         ; 8d 46 12
-    call 03530h                               ; e8 70 01
-    jmp short 03403h                          ; eb 41
+    call 03503h                               ; e8 7c 01
+    jmp short 033cah                          ; eb 41
     mov cx, si                                ; 89 f1
     mov bx, word [bp+016h]                    ; 8b 5e 16
     mov dx, word [bp+010h]                    ; 8b 56 10
     lea ax, [bp+012h]                         ; 8d 46 12
-    call 03659h                               ; e8 89 02
-    jmp short 03403h                          ; eb 31
+    call 0362ch                               ; e8 95 02
+    jmp short 033cah                          ; eb 31
     mov cx, si                                ; 89 f1
     mov bx, word [bp+016h]                    ; 8b 5e 16
     mov dx, word [bp+00ch]                    ; 8b 56 0c
     lea ax, [bp+012h]                         ; 8d 46 12
-    call 0370dh                               ; e8 2d 03
-    jmp short 03403h                          ; eb 21
+    call 036e4h                               ; e8 3d 03
+    jmp short 033cah                          ; eb 21
     lea ax, [bp+00ch]                         ; 8d 46 0c
     push ax                                   ; 50
     mov cx, word [bp+016h]                    ; 8b 4e 16
     mov bx, word [bp+00eh]                    ; 8b 5e 0e
     mov dx, word [bp+010h]                    ; 8b 56 10
     lea ax, [bp+012h]                         ; 8d 46 12
-    call 038f4h                               ; e8 ff 04
-    jmp short 03403h                          ; eb 0c
+    call 038cbh                               ; e8 0f 05
+    jmp short 033cah                          ; eb 0c
     mov word [bp+012h], 00100h                ; c7 46 12 00 01
-    jmp short 03403h                          ; eb 05
+    jmp short 033cah                          ; eb 05
     mov word [bp+012h], 00100h                ; c7 46 12 00 01
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-dispi_set_xres_:                             ; 0xc340a LB 0x1b
+dispi_set_xres_:                             ; 0xc33d1 LB 0x1f
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6007,16 +5997,16 @@ dispi_set_xres_:                             ; 0xc340a LB 0x1b
     mov bx, ax                                ; 89 c3
     mov ax, strict word 00001h                ; b8 01 00
     mov dx, 001ceh                            ; ba ce 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 8f d1
     mov ax, bx                                ; 89 d8
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 87 d1
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-dispi_set_yres_:                             ; 0xc3425 LB 0x1b
+dispi_set_yres_:                             ; 0xc33f0 LB 0x1f
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6024,16 +6014,16 @@ dispi_set_yres_:                             ; 0xc3425 LB 0x1b
     mov bx, ax                                ; 89 c3
     mov ax, strict word 00002h                ; b8 02 00
     mov dx, 001ceh                            ; ba ce 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 70 d1
     mov ax, bx                                ; 89 d8
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 68 d1
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-dispi_set_bpp_:                              ; 0xc3440 LB 0x1b
+dispi_set_bpp_:                              ; 0xc340f LB 0x1f
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6041,16 +6031,16 @@ dispi_set_bpp_:                              ; 0xc3440 LB 0x1b
     mov bx, ax                                ; 89 c3
     mov ax, strict word 00003h                ; b8 03 00
     mov dx, 001ceh                            ; ba ce 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 51 d1
     mov ax, bx                                ; 89 d8
     mov dx, 001cfh                            ; ba cf 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 49 d1
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-in_word_:                                    ; 0xc345b LB 0x12
+in_word_:                                    ; 0xc342e LB 0x12
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6063,7 +6053,7 @@ in_word_:                                    ; 0xc345b LB 0x12
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-in_byte_:                                    ; 0xc346d LB 0x14
+in_byte_:                                    ; 0xc3440 LB 0x14
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6078,7 +6068,7 @@ in_byte_:                                    ; 0xc346d LB 0x14
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-dispi_get_id_:                               ; 0xc3481 LB 0x14
+dispi_get_id_:                               ; 0xc3454 LB 0x14
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
@@ -6091,7 +6081,7 @@ dispi_get_id_:                               ; 0xc3481 LB 0x14
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-dispi_set_id_:                               ; 0xc3495 LB 0x1a
+dispi_set_id_:                               ; 0xc3468 LB 0x1a
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6108,28 +6098,28 @@ dispi_set_id_:                               ; 0xc3495 LB 0x1a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-vbe_init_:                                   ; 0xc34af LB 0x2c
+vbe_init_:                                   ; 0xc3482 LB 0x2c
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     push dx                                   ; 52
     mov ax, 0b0c0h                            ; b8 c0 b0
-    call 03495h                               ; e8 db ff
-    call 03481h                               ; e8 c4 ff
+    call 03468h                               ; e8 db ff
+    call 03454h                               ; e8 c4 ff
     cmp ax, 0b0c0h                            ; 3d c0 b0
-    jne short 034d4h                          ; 75 12
+    jne short 034a7h                          ; 75 12
     mov bx, strict word 00001h                ; bb 01 00
     mov dx, 000b9h                            ; ba b9 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 b7 fa
+    call 02f4ch                               ; e8 ab fa
     mov ax, 0b0c4h                            ; b8 c4 b0
-    call 03495h                               ; e8 c1 ff
+    call 03468h                               ; e8 c1 ff
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-mode_info_find_mode_:                        ; 0xc34db LB 0x55
+mode_info_find_mode_:                        ; 0xc34ae LB 0x55
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6140,30 +6130,30 @@ mode_info_find_mode_:                        ; 0xc34db LB 0x55
     mov si, dx                                ; 89 d6
     xor dx, dx                                ; 31 d2
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 6d ff
+    call 0342eh                               ; e8 6d ff
     cmp ax, 077cch                            ; 3d cc 77
-    jne short 03525h                          ; 75 32
+    jne short 034f8h                          ; 75 32
     mov bx, strict word 00004h                ; bb 04 00
     mov dx, bx                                ; 89 da
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 5d ff
+    call 0342eh                               ; e8 5d ff
     mov cx, ax                                ; 89 c1
     cmp cx, strict byte 0ffffh                ; 83 f9 ff
-    je short 03525h                           ; 74 20
+    je short 034f8h                           ; 74 20
     lea dx, [bx+002h]                         ; 8d 57 02
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 4d ff
+    call 0342eh                               ; e8 4d ff
     lea dx, [bx+044h]                         ; 8d 57 44
     cmp cx, di                                ; 39 f9
-    jne short 03521h                          ; 75 0c
+    jne short 034f4h                          ; 75 0c
     test si, si                               ; 85 f6
-    jne short 0351dh                          ; 75 04
+    jne short 034f0h                          ; 75 04
     mov ax, bx                                ; 89 d8
-    jmp short 03527h                          ; eb 0a
+    jmp short 034fah                          ; eb 0a
     test AL, strict byte 080h                 ; a8 80
-    jne short 03519h                          ; 75 f8
+    jne short 034ech                          ; 75 f8
     mov bx, dx                                ; 89 d3
-    jmp short 034f8h                          ; eb d3
+    jmp short 034cbh                          ; eb d3
     xor ax, ax                                ; 31 c0
     lea sp, [bp-008h]                         ; 8d 66 f8
     pop di                                    ; 5f
@@ -6172,7 +6162,7 @@ mode_info_find_mode_:                        ; 0xc34db LB 0x55
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-vbe_biosfn_return_controller_information_: ; 0xc3530 LB 0x129
+vbe_biosfn_return_controller_information_: ; 0xc3503 LB 0x129
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -6183,36 +6173,36 @@ vbe_biosfn_return_controller_information_: ; 0xc3530 LB 0x129
     mov di, dx                                ; 89 d7
     mov word [bp-00ah], bx                    ; 89 5e f6
     mov word [bp-00ch], strict word 00022h    ; c7 46 f4 22 00
-    call 005a7h                               ; e8 5f d0
+    call 005b7h                               ; e8 9c d0
     mov word [bp-010h], ax                    ; 89 46 f0
     mov bx, word [bp-00ah]                    ; 8b 5e f6
     mov word [bp-008h], di                    ; 89 7e f8
     xor dx, dx                                ; 31 d2
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 02 ff
+    call 0342eh                               ; e8 02 ff
     cmp ax, 077cch                            ; 3d cc 77
-    je short 03568h                           ; 74 0a
+    je short 0353bh                           ; 74 0a
     push SS                                   ; 16
     pop ES                                    ; 07
     mov word [es:si], 00100h                  ; 26 c7 04 00 01
-    jmp near 03651h                           ; e9 e9 00
+    jmp near 03624h                           ; e9 e9 00
     mov cx, strict word 00004h                ; b9 04 00
     mov word [bp-00eh], strict word 00000h    ; c7 46 f2 00 00
     mov es, [bp-008h]                         ; 8e 46 f8
     cmp word [es:bx+002h], 03245h             ; 26 81 7f 02 45 32
-    jne short 03582h                          ; 75 07
+    jne short 03555h                          ; 75 07
     cmp word [es:bx], 04256h                  ; 26 81 3f 56 42
-    je short 03591h                           ; 74 0f
+    je short 03564h                           ; 74 0f
     cmp word [es:bx+002h], 04153h             ; 26 81 7f 02 53 41
-    jne short 03596h                          ; 75 0c
+    jne short 03569h                          ; 75 0c
     cmp word [es:bx], 04556h                  ; 26 81 3f 56 45
-    jne short 03596h                          ; 75 05
+    jne short 03569h                          ; 75 05
     mov word [bp-00eh], strict word 00001h    ; c7 46 f2 01 00
     mov es, [bp-008h]                         ; 8e 46 f8
     db  066h, 026h, 0c7h, 007h, 056h, 045h, 053h, 041h
     ; mov dword [es:bx], strict dword 041534556h ; 66 26 c7 07 56 45 53 41
     mov word [es:bx+004h], 00200h             ; 26 c7 47 04 00 02
-    mov word [es:bx+006h], 07e20h             ; 26 c7 47 06 20 7e
+    mov word [es:bx+006h], 07c64h             ; 26 c7 47 06 64 7c
     mov [es:bx+008h], ds                      ; 26 8c 5f 08
     db  066h, 026h, 0c7h, 047h, 00ah, 001h, 000h, 000h, 000h
     ; mov dword [es:bx+00ah], strict dword 000000001h ; 66 26 c7 47 0a 01 00 00 00
@@ -6222,45 +6212,45 @@ vbe_biosfn_return_controller_information_: ; 0xc3530 LB 0x129
     mov word [es:bx+00eh], ax                 ; 26 89 47 0e
     mov dx, strict word 0ffffh                ; ba ff ff
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 8a fe
+    call 0342eh                               ; e8 8a fe
     mov es, [bp-008h]                         ; 8e 46 f8
     mov word [es:bx+012h], ax                 ; 26 89 47 12
     cmp word [bp-00eh], strict byte 00000h    ; 83 7e f2 00
-    je short 03602h                           ; 74 24
+    je short 035d5h                           ; 74 24
     mov word [es:bx+014h], strict word 00003h ; 26 c7 47 14 03 00
-    mov word [es:bx+016h], 07e35h             ; 26 c7 47 16 35 7e
+    mov word [es:bx+016h], 07c79h             ; 26 c7 47 16 79 7c
     mov [es:bx+018h], ds                      ; 26 8c 5f 18
-    mov word [es:bx+01ah], 07e48h             ; 26 c7 47 1a 48 7e
+    mov word [es:bx+01ah], 07c8ch             ; 26 c7 47 1a 8c 7c
     mov [es:bx+01ch], ds                      ; 26 8c 5f 1c
-    mov word [es:bx+01eh], 07e69h             ; 26 c7 47 1e 69 7e
+    mov word [es:bx+01eh], 07cadh             ; 26 c7 47 1e ad 7c
     mov [es:bx+020h], ds                      ; 26 8c 5f 20
     mov dx, cx                                ; 89 ca
     add dx, strict byte 0001bh                ; 83 c2 1b
     mov ax, 003b6h                            ; b8 b6 03
-    call 0346dh                               ; e8 60 fe
+    call 03440h                               ; e8 60 fe
     xor ah, ah                                ; 30 e4
     cmp ax, word [bp-010h]                    ; 3b 46 f0
-    jnbe short 0362dh                         ; 77 19
+    jnbe short 03600h                         ; 77 19
     mov dx, cx                                ; 89 ca
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 3f fe
+    call 0342eh                               ; e8 3f fe
     mov bx, ax                                ; 89 c3
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, word [bp-00ch]                    ; 03 56 f4
     mov ax, di                                ; 89 f8
-    call 02fa1h                               ; e8 78 f9
+    call 02f68h                               ; e8 6c f9
     add word [bp-00ch], strict byte 00002h    ; 83 46 f4 02
     add cx, strict byte 00044h                ; 83 c1 44
     mov dx, cx                                ; 89 ca
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 23 fe
+    call 0342eh                               ; e8 23 fe
     mov bx, ax                                ; 89 c3
     cmp ax, strict word 0ffffh                ; 3d ff ff
-    jne short 03602h                          ; 75 c3
+    jne short 035d5h                          ; 75 c3
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     add dx, word [bp-00ch]                    ; 03 56 f4
     mov ax, di                                ; 89 f8
-    call 02fa1h                               ; e8 57 f9
+    call 02f68h                               ; e8 4b f9
     push SS                                   ; 16
     pop ES                                    ; 07
     mov word [es:si], strict word 0004fh      ; 26 c7 04 4f 00
@@ -6270,7 +6260,7 @@ vbe_biosfn_return_controller_information_: ; 0xc3530 LB 0x129
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-vbe_biosfn_return_mode_information_:         ; 0xc3659 LB 0xb4
+vbe_biosfn_return_mode_information_:         ; 0xc362c LB 0xb8
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -6286,63 +6276,63 @@ vbe_biosfn_return_mode_information_:         ; 0xc3659 LB 0xb4
     ; setne dl                                  ; 0f 95 c2
     xor dh, dh                                ; 30 f6
     and ah, 001h                              ; 80 e4 01
-    call 034dbh                               ; e8 65 fe
+    call 034aeh                               ; e8 65 fe
     mov word [bp-008h], ax                    ; 89 46 f8
     test ax, ax                               ; 85 c0
-    je near 036fbh                            ; 0f 84 7c 00
+    je near 036d2h                            ; 0f 84 80 00
     mov cx, 00100h                            ; b9 00 01
     xor ax, ax                                ; 31 c0
     mov di, word [bp-006h]                    ; 8b 7e fa
     mov es, bx                                ; 8e c3
     cld                                       ; fc
-    jcxz 0368eh                               ; e3 02
+    jcxz 03661h                               ; e3 02
     rep stosb                                 ; f3 aa
     xor cx, cx                                ; 31 c9
-    jmp short 03697h                          ; eb 05
+    jmp short 0366ah                          ; eb 05
     cmp cx, strict byte 00042h                ; 83 f9 42
-    jnc short 036b4h                          ; 73 1d
+    jnc short 03687h                          ; 73 1d
     mov dx, word [bp-008h]                    ; 8b 56 f8
     inc dx                                    ; 42
     inc dx                                    ; 42
     add dx, cx                                ; 01 ca
     mov ax, 003b6h                            ; b8 b6 03
-    call 0346dh                               ; e8 c9 fd
+    call 03440h                               ; e8 c9 fd
     movzx bx, al                              ; 0f b6 d8
     mov dx, word [bp-006h]                    ; 8b 56 fa
     add dx, cx                                ; 01 ca
     mov ax, si                                ; 89 f0
-    call 02f85h                               ; e8 d4 f8
+    call 02f4ch                               ; e8 c8 f8
     inc cx                                    ; 41
-    jmp short 03692h                          ; eb de
+    jmp short 03665h                          ; eb de
     mov dx, word [bp-006h]                    ; 8b 56 fa
     inc dx                                    ; 42
     inc dx                                    ; 42
     mov ax, si                                ; 89 f0
-    call 02f77h                               ; e8 b9 f8
+    call 02f3eh                               ; e8 ad f8
     test AL, strict byte 001h                 ; a8 01
-    je short 036deh                           ; 74 1c
+    je short 036b1h                           ; 74 1c
     mov dx, word [bp-006h]                    ; 8b 56 fa
     add dx, strict byte 0000ch                ; 83 c2 0c
-    mov bx, 00605h                            ; bb 05 06
+    mov bx, 00629h                            ; bb 29 06
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 d1 f8
+    call 02f68h                               ; e8 c5 f8
     mov dx, word [bp-006h]                    ; 8b 56 fa
     add dx, strict byte 0000eh                ; 83 c2 0e
     mov bx, 0c000h                            ; bb 00 c0
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 c3 f8
+    call 02f68h                               ; e8 b7 f8
     mov ax, strict word 0000bh                ; b8 0b 00
     mov dx, 001ceh                            ; ba ce 01
-    out DX, ax                                ; ef
+    call 00570h                               ; e8 b6 ce
     mov dx, 001cfh                            ; ba cf 01
-    in ax, DX                                 ; ed
+    call 00577h                               ; e8 b7 ce
     mov dx, word [bp-006h]                    ; 8b 56 fa
     add dx, strict byte 0002ah                ; 83 c2 2a
     mov bx, ax                                ; 89 c3
     mov ax, si                                ; 89 f0
-    call 02fa1h                               ; e8 ab f8
+    call 02f68h                               ; e8 9b f8
     mov ax, strict word 0004fh                ; b8 4f 00
-    jmp short 036feh                          ; eb 03
+    jmp short 036d5h                          ; eb 03
     mov ax, 00100h                            ; b8 00 01
     push SS                                   ; 16
     pop ES                                    ; 07
@@ -6353,7 +6343,7 @@ vbe_biosfn_return_mode_information_:         ; 0xc3659 LB 0xb4
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-vbe_biosfn_set_mode_:                        ; 0xc370d LB 0xe9
+vbe_biosfn_set_mode_:                        ; 0xc36e4 LB 0xe9
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -6367,75 +6357,75 @@ vbe_biosfn_set_mode_:                        ; 0xc370d LB 0xe9
     movzx dx, al                              ; 0f b6 d0
     mov ax, dx                                ; 89 d0
     test dx, dx                               ; 85 d2
-    je short 0372dh                           ; 74 03
+    je short 03704h                           ; 74 03
     mov dx, strict word 00040h                ; ba 40 00
     mov byte [bp-006h], dl                    ; 88 56 fa
     test byte [bp-009h], 080h                 ; f6 46 f7 80
-    je short 0373bh                           ; 74 05
+    je short 03712h                           ; 74 05
     mov dx, 00080h                            ; ba 80 00
-    jmp short 0373dh                          ; eb 02
+    jmp short 03714h                          ; eb 02
     xor dx, dx                                ; 31 d2
     mov byte [bp-008h], dl                    ; 88 56 f8
     and byte [bp-009h], 001h                  ; 80 66 f7 01
     cmp word [bp-00ah], 00100h                ; 81 7e f6 00 01
-    jnc short 0375dh                          ; 73 12
+    jnc short 03734h                          ; 73 12
     xor ax, ax                                ; 31 c0
-    call 005c9h                               ; e8 79 ce
+    call 005ddh                               ; e8 b6 ce
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
-    call 00fdch                               ; e8 85 d8
+    call 00fdch                               ; e8 ae d8
     mov ax, strict word 0004fh                ; b8 4f 00
-    jmp near 037ech                           ; e9 8f 00
+    jmp near 037c3h                           ; e9 8f 00
     mov dx, ax                                ; 89 c2
     mov ax, word [bp-00ah]                    ; 8b 46 f6
-    call 034dbh                               ; e8 76 fd
+    call 034aeh                               ; e8 72 fd
     mov bx, ax                                ; 89 c3
     test ax, ax                               ; 85 c0
-    je near 037e9h                            ; 0f 84 7c 00
+    je near 037c0h                            ; 0f 84 7c 00
     lea dx, [bx+014h]                         ; 8d 57 14
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 e5 fc
+    call 0342eh                               ; e8 e1 fc
     mov cx, ax                                ; 89 c1
     lea dx, [bx+016h]                         ; 8d 57 16
     mov ax, 003b6h                            ; b8 b6 03
-    call 0345bh                               ; e8 da fc
+    call 0342eh                               ; e8 d6 fc
     mov di, ax                                ; 89 c7
     lea dx, [bx+01bh]                         ; 8d 57 1b
     mov ax, 003b6h                            ; b8 b6 03
-    call 0346dh                               ; e8 e1 fc
+    call 03440h                               ; e8 dd fc
     mov bl, al                                ; 88 c3
     mov dl, al                                ; 88 c2
     xor ax, ax                                ; 31 c0
-    call 005c9h                               ; e8 34 ce
+    call 005ddh                               ; e8 71 ce
     cmp bl, 004h                              ; 80 fb 04
-    jne short 037a0h                          ; 75 06
+    jne short 03777h                          ; 75 06
     mov ax, strict word 0006ah                ; b8 6a 00
-    call 00fdch                               ; e8 3c d8
+    call 00fdch                               ; e8 65 d8
     movzx ax, dl                              ; 0f b6 c2
-    call 03440h                               ; e8 9a fc
+    call 0340fh                               ; e8 92 fc
     mov ax, cx                                ; 89 c8
-    call 0340ah                               ; e8 5f fc
+    call 033d1h                               ; e8 4f fc
     mov ax, di                                ; 89 f8
-    call 03425h                               ; e8 75 fc
+    call 033f0h                               ; e8 69 fc
     xor ax, ax                                ; 31 c0
-    call 005e7h                               ; e8 32 ce
+    call 00603h                               ; e8 77 ce
     mov al, byte [bp-008h]                    ; 8a 46 f8
     or AL, strict byte 001h                   ; 0c 01
     movzx dx, al                              ; 0f b6 d0
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
     or ax, dx                                 ; 09 d0
-    call 005c9h                               ; e8 03 ce
-    call 006c3h                               ; e8 fa ce
+    call 005ddh                               ; e8 40 ce
+    call 0070dh                               ; e8 6d cf
     mov bx, word [bp-00ah]                    ; 8b 5e f6
     mov dx, 000bah                            ; ba ba 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02fa1h                               ; e8 cc f7
+    call 02f68h                               ; e8 bc f7
     mov al, byte [bp-008h]                    ; 8a 46 f8
     or AL, strict byte 060h                   ; 0c 60
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00087h                            ; ba 87 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 02f85h                               ; e8 9f f7
-    jmp near 03757h                           ; e9 6e ff
+    call 02f4ch                               ; e8 8f f7
+    jmp near 0372eh                           ; e9 6e ff
     mov ax, 00100h                            ; b8 00 01
     mov word [ss:si], ax                      ; 36 89 04
     lea sp, [bp-004h]                         ; 8d 66 fc
@@ -6443,13 +6433,13 @@ vbe_biosfn_set_mode_:                        ; 0xc370d LB 0xe9
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-vbe_biosfn_read_video_state_size_:           ; 0xc37f6 LB 0x8
+vbe_biosfn_read_video_state_size_:           ; 0xc37cd LB 0x8
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov ax, strict word 00012h                ; b8 12 00
     pop bp                                    ; 5d
     retn                                      ; c3
-vbe_biosfn_save_video_state_:                ; 0xc37fe LB 0x5b
+vbe_biosfn_save_video_state_:                ; 0xc37d5 LB 0x5b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6468,17 +6458,17 @@ vbe_biosfn_save_video_state_:                ; 0xc37fe LB 0x5b
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, di                                ; 89 f8
-    call 02fa1h                               ; e8 80 f7
+    call 02f68h                               ; e8 70 f7
     inc cx                                    ; 41
     inc cx                                    ; 41
     test byte [bp-00ah], 001h                 ; f6 46 f6 01
-    je short 03850h                           ; 74 27
+    je short 03827h                           ; 74 27
     mov si, strict word 00001h                ; be 01 00
-    jmp short 03833h                          ; eb 05
+    jmp short 0380ah                          ; eb 05
     cmp si, strict byte 00009h                ; 83 fe 09
-    jnbe short 03850h                         ; 77 1d
+    jnbe short 03827h                         ; 77 1d
     cmp si, strict byte 00004h                ; 83 fe 04
-    je short 0384dh                           ; 74 15
+    je short 03824h                           ; 74 15
     mov ax, si                                ; 89 f0
     mov dx, 001ceh                            ; ba ce 01
     out DX, ax                                ; ef
@@ -6487,11 +6477,11 @@ vbe_biosfn_save_video_state_:                ; 0xc37fe LB 0x5b
     mov bx, ax                                ; 89 c3
     mov dx, cx                                ; 89 ca
     mov ax, di                                ; 89 f8
-    call 02fa1h                               ; e8 56 f7
+    call 02f68h                               ; e8 46 f7
     inc cx                                    ; 41
     inc cx                                    ; 41
     inc si                                    ; 46
-    jmp short 0382eh                          ; eb de
+    jmp short 03805h                          ; eb de
     lea sp, [bp-008h]                         ; 8d 66 f8
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -6499,7 +6489,7 @@ vbe_biosfn_save_video_state_:                ; 0xc37fe LB 0x5b
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-vbe_biosfn_restore_video_state_:             ; 0xc3859 LB 0x9b
+vbe_biosfn_restore_video_state_:             ; 0xc3830 LB 0x9b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6508,25 +6498,25 @@ vbe_biosfn_restore_video_state_:             ; 0xc3859 LB 0x9b
     push ax                                   ; 50
     mov cx, ax                                ; 89 c1
     mov bx, dx                                ; 89 d3
-    call 02f93h                               ; e8 2c f7
+    call 02f5ah                               ; e8 1c f7
     mov word [bp-008h], ax                    ; 89 46 f8
     inc bx                                    ; 43
     inc bx                                    ; 43
     test byte [bp-008h], 001h                 ; f6 46 f8 01
-    jne short 03882h                          ; 75 10
+    jne short 03859h                          ; 75 10
     mov ax, strict word 00004h                ; b8 04 00
     mov dx, 001ceh                            ; ba ce 01
     out DX, ax                                ; ef
     mov ax, word [bp-008h]                    ; 8b 46 f8
     mov dx, 001cfh                            ; ba cf 01
     out DX, ax                                ; ef
-    jmp short 038ech                          ; eb 6a
+    jmp short 038c3h                          ; eb 6a
     mov ax, strict word 00001h                ; b8 01 00
     mov dx, 001ceh                            ; ba ce 01
     out DX, ax                                ; ef
     mov dx, bx                                ; 89 da
     mov ax, cx                                ; 89 c8
-    call 02f93h                               ; e8 03 f7
+    call 02f5ah                               ; e8 f3 f6
     mov dx, 001cfh                            ; ba cf 01
     out DX, ax                                ; ef
     inc bx                                    ; 43
@@ -6536,7 +6526,7 @@ vbe_biosfn_restore_video_state_:             ; 0xc3859 LB 0x9b
     out DX, ax                                ; ef
     mov dx, bx                                ; 89 da
     mov ax, cx                                ; 89 c8
-    call 02f93h                               ; e8 ef f6
+    call 02f5ah                               ; e8 df f6
     mov dx, 001cfh                            ; ba cf 01
     out DX, ax                                ; ef
     inc bx                                    ; 43
@@ -6546,7 +6536,7 @@ vbe_biosfn_restore_video_state_:             ; 0xc3859 LB 0x9b
     out DX, ax                                ; ef
     mov dx, bx                                ; 89 da
     mov ax, cx                                ; 89 c8
-    call 02f93h                               ; e8 db f6
+    call 02f5ah                               ; e8 cb f6
     mov dx, 001cfh                            ; ba cf 01
     out DX, ax                                ; ef
     inc bx                                    ; 43
@@ -6558,28 +6548,28 @@ vbe_biosfn_restore_video_state_:             ; 0xc3859 LB 0x9b
     mov dx, 001cfh                            ; ba cf 01
     out DX, ax                                ; ef
     mov si, strict word 00005h                ; be 05 00
-    jmp short 038d6h                          ; eb 05
+    jmp short 038adh                          ; eb 05
     cmp si, strict byte 00009h                ; 83 fe 09
-    jnbe short 038ech                         ; 77 16
+    jnbe short 038c3h                         ; 77 16
     mov ax, si                                ; 89 f0
     mov dx, 001ceh                            ; ba ce 01
     out DX, ax                                ; ef
     mov dx, bx                                ; 89 da
     mov ax, cx                                ; 89 c8
-    call 02f93h                               ; e8 b0 f6
+    call 02f5ah                               ; e8 a0 f6
     mov dx, 001cfh                            ; ba cf 01
     out DX, ax                                ; ef
     inc bx                                    ; 43
     inc bx                                    ; 43
     inc si                                    ; 46
-    jmp short 038d1h                          ; eb e5
+    jmp short 038a8h                          ; eb e5
     lea sp, [bp-006h]                         ; 8d 66 fa
     pop si                                    ; 5e
     pop cx                                    ; 59
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-vbe_biosfn_save_restore_state_:              ; 0xc38f4 LB 0x8c
+vbe_biosfn_save_restore_state_:              ; 0xc38cb LB 0x8c
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -6592,48 +6582,48 @@ vbe_biosfn_save_restore_state_:              ; 0xc38f4 LB 0x8c
     mov di, strict word 0004fh                ; bf 4f 00
     xor ah, ah                                ; 30 e4
     cmp ax, strict word 00002h                ; 3d 02 00
-    je short 03953h                           ; 74 45
+    je short 0392ah                           ; 74 45
     cmp ax, strict word 00001h                ; 3d 01 00
-    je short 03937h                           ; 74 24
+    je short 0390eh                           ; 74 24
     test ax, ax                               ; 85 c0
-    jne short 0396fh                          ; 75 58
+    jne short 03946h                          ; 75 58
     mov ax, word [bp-006h]                    ; 8b 46 fa
-    call 0288ch                               ; e8 6f ef
+    call 02853h                               ; e8 5f ef
     mov cx, ax                                ; 89 c1
     test byte [bp-006h], 008h                 ; f6 46 fa 08
-    je short 0392ah                           ; 74 05
-    call 037f6h                               ; e8 ce fe
+    je short 03901h                           ; 74 05
+    call 037cdh                               ; e8 ce fe
     add ax, cx                                ; 01 c8
     add ax, strict word 0003fh                ; 05 3f 00
     shr ax, 006h                              ; c1 e8 06
     push SS                                   ; 16
     pop ES                                    ; 07
     mov word [es:bx], ax                      ; 26 89 07
-    jmp short 03972h                          ; eb 3b
+    jmp short 03949h                          ; eb 3b
     push SS                                   ; 16
     pop ES                                    ; 07
     mov bx, word [es:bx]                      ; 26 8b 1f
     mov dx, cx                                ; 89 ca
     mov ax, word [bp-006h]                    ; 8b 46 fa
-    call 028c1h                               ; e8 7d ef
+    call 02888h                               ; e8 6d ef
     test byte [bp-006h], 008h                 ; f6 46 fa 08
-    je short 03972h                           ; 74 28
+    je short 03949h                           ; 74 28
     mov dx, ax                                ; 89 c2
     mov ax, cx                                ; 89 c8
-    call 037feh                               ; e8 ad fe
-    jmp short 03972h                          ; eb 1f
+    call 037d5h                               ; e8 ad fe
+    jmp short 03949h                          ; eb 1f
     push SS                                   ; 16
     pop ES                                    ; 07
     mov bx, word [es:bx]                      ; 26 8b 1f
     mov dx, cx                                ; 89 ca
     mov ax, word [bp-006h]                    ; 8b 46 fa
-    call 02c2ah                               ; e8 ca f2
+    call 02bf1h                               ; e8 ba f2
     test byte [bp-006h], 008h                 ; f6 46 fa 08
-    je short 03972h                           ; 74 0c
+    je short 03949h                           ; 74 0c
     mov dx, ax                                ; 89 c2
     mov ax, cx                                ; 89 c8
-    call 03859h                               ; e8 ec fe
-    jmp short 03972h                          ; eb 03
+    call 03830h                               ; e8 ec fe
+    jmp short 03949h                          ; eb 03
     mov di, 00100h                            ; bf 00 01
     push SS                                   ; 16
     pop ES                                    ; 07
@@ -6644,11 +6634,11 @@ vbe_biosfn_save_restore_state_:              ; 0xc38f4 LB 0x8c
     pop bp                                    ; 5d
     retn 00002h                               ; c2 02 00
 
-  ; Padding 0xc80 bytes at 0xc3980
-  times 3200 db 0
+  ; Padding 0xaa9 bytes at 0xc3957
+  times 2729 db 0
 
-section VBE32 progbits vstart=0x4600 align=1 ; size=0x115 class=CODE group=AUTO
-vesa_pm_start:                               ; 0xc4600 LB 0x114
+section VBE32 progbits vstart=0x4400 align=1 ; size=0x115 class=CODE group=AUTO
+vesa_pm_start:                               ; 0xc4400 LB 0x114
     sbb byte [bx+si], al                      ; 18 00
     dec di                                    ; 4f
     add byte [bx+si], dl                      ; 00 10
@@ -6679,20 +6669,20 @@ vesa_pm_start:                               ; 0xc4600 LB 0x114
     pop edx                                   ; 66 5a
     db  066h, 03bh, 0d0h
     ; cmp edx, eax                              ; 66 3b d0
-    jne short 0464ah                          ; 75 05
+    jne short 0444ah                          ; 75 05
     mov eax, strict dword 066c3004fh          ; 66 b8 4f 00 c3 66
     mov ax, 0014fh                            ; b8 4f 01
     retn                                      ; c3
     cmp bl, 080h                              ; 80 fb 80
-    je short 0465eh                           ; 74 0a
+    je short 0445eh                           ; 74 0a
     cmp bl, 000h                              ; 80 fb 00
-    je short 0466eh                           ; 74 15
+    je short 0446eh                           ; 74 15
     mov eax, strict dword 052c30100h          ; 66 b8 00 01 c3 52
     mov edx, strict dword 0a8ec03dah          ; 66 ba da 03 ec a8
     or byte [di-005h], dh                     ; 08 75 fb
     in AL, DX                                 ; ec
     test AL, strict byte 008h                 ; a8 08
-    je short 04668h                           ; 74 fb
+    je short 04468h                           ; 74 fb
     pop dx                                    ; 5a
     push ax                                   ; 50
     push cx                                   ; 51
@@ -6722,7 +6712,7 @@ vesa_pm_start:                               ; 0xc4600 LB 0x114
     ; movzx si, ax                              ; 0f b7 f0
     pop ax                                    ; 58
     cmp si, strict byte 00004h                ; 83 fe 04
-    je short 046c7h                           ; 74 17
+    je short 044c7h                           ; 74 17
     add si, strict byte 00007h                ; 83 c6 07
     shr si, 003h                              ; c1 ee 03
     imul cx, si                               ; 0f af ce
@@ -6736,7 +6726,7 @@ vesa_pm_start:                               ; 0xc4600 LB 0x114
     db  033h, 0d2h
     ; xor dx, dx                                ; 33 d2
     div si                                    ; f7 f6
-    jmp short 046d3h                          ; eb 0c
+    jmp short 044d3h                          ; eb 0c
     shr cx, 1                                 ; d1 e9
     db  033h, 0d2h
     ; xor dx, dx                                ; 33 d2
@@ -6771,16 +6761,16 @@ vesa_pm_start:                               ; 0xc4600 LB 0x114
     pop ax                                    ; 58
     mov eax, strict dword 066c3004fh          ; 66 b8 4f 00 c3 66
     mov ax, 0014fh                            ; b8 4f 01
-vesa_pm_end:                                 ; 0xc4714 LB 0x1
+vesa_pm_end:                                 ; 0xc4514 LB 0x1
     retn                                      ; c3
 
-  ; Padding 0xeb bytes at 0xc4715
+  ; Padding 0xeb bytes at 0xc4515
   times 235 db 0
 
-section _DATA progbits vstart=0x4800 align=1 ; size=0x36e1 class=DATA group=DGROUP
-_msg_vga_init:                               ; 0xc4800 LB 0x2f
-    db  'Oracle VM VirtualBox Version 4.3.28 VGA BIOS', 00dh, 00ah, 000h
-_vga_modes:                                  ; 0xc482f LB 0x80
+section _DATA progbits vstart=0x4600 align=1 ; size=0x372a class=DATA group=DGROUP
+_msg_vga_init:                               ; 0xc4600 LB 0x34
+    db  'Oracle VM VirtualBox Version 5.0.0_BETA4 VGA BIOS', 00dh, 00ah, 000h
+_vga_modes:                                  ; 0xc4634 LB 0x80
     db  000h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 001h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h
     db  002h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h, 003h, 000h, 000h, 004h, 000h, 0b8h, 0ffh, 002h
     db  004h, 001h, 002h, 002h, 000h, 0b8h, 0ffh, 001h, 005h, 001h, 002h, 002h, 000h, 0b8h, 0ffh, 001h
@@ -6789,11 +6779,11 @@ _vga_modes:                                  ; 0xc482f LB 0x80
     db  00fh, 001h, 003h, 001h, 000h, 0a0h, 0ffh, 000h, 010h, 001h, 004h, 004h, 000h, 0a0h, 0ffh, 002h
     db  011h, 001h, 003h, 001h, 000h, 0a0h, 0ffh, 002h, 012h, 001h, 004h, 004h, 000h, 0a0h, 0ffh, 002h
     db  013h, 001h, 005h, 008h, 000h, 0a0h, 0ffh, 003h, 06ah, 001h, 004h, 004h, 000h, 0a0h, 0ffh, 002h
-_line_to_vpti:                               ; 0xc48af LB 0x10
+_line_to_vpti:                               ; 0xc46b4 LB 0x10
     db  017h, 017h, 018h, 018h, 004h, 005h, 006h, 007h, 00dh, 00eh, 011h, 012h, 01ah, 01bh, 01ch, 01dh
-_dac_regs:                                   ; 0xc48bf LB 0x4
+_dac_regs:                                   ; 0xc46c4 LB 0x4
     dd  0ff3f3f3fh
-_video_param_table:                          ; 0xc48c3 LB 0x780
+_video_param_table:                          ; 0xc46c8 LB 0x780
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
@@ -6914,7 +6904,7 @@ _video_param_table:                          ; 0xc48c3 LB 0x780
     db  072h, 0f0h, 000h, 060h, 000h, 000h, 000h, 000h, 000h, 000h, 059h, 08dh, 057h, 032h, 000h, 057h
     db  073h, 0e3h, 0ffh, 000h, 001h, 002h, 003h, 004h, 005h, 014h, 007h, 038h, 039h, 03ah, 03bh, 03ch
     db  03dh, 03eh, 03fh, 001h, 000h, 00fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 005h, 00fh, 0ffh
-_palette0:                                   ; 0xc5043 LB 0xc0
+_palette0:                                   ; 0xc4e48 LB 0xc0
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah
     db  02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah
@@ -6927,7 +6917,7 @@ _palette0:                                   ; 0xc5043 LB 0xc0
     db  02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah
     db  02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 02ah, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh
     db  03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh, 03fh
-_palette1:                                   ; 0xc5103 LB 0xc0
+_palette1:                                   ; 0xc4f08 LB 0xc0
     db  000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah, 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah
     db  000h, 02ah, 02ah, 015h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah
     db  000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah, 000h, 02ah, 02ah, 015h, 000h, 02ah, 02ah, 02ah
@@ -6940,7 +6930,7 @@ _palette1:                                   ; 0xc5103 LB 0xc0
     db  015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh, 015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh
     db  015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh
     db  015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh
-_palette2:                                   ; 0xc51c3 LB 0xc0
+_palette2:                                   ; 0xc4fc8 LB 0xc0
     db  000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah, 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah
     db  000h, 02ah, 02ah, 02ah, 000h, 02ah, 02ah, 02ah, 000h, 000h, 015h, 000h, 000h, 03fh, 000h, 02ah
     db  015h, 000h, 02ah, 03fh, 02ah, 000h, 015h, 02ah, 000h, 03fh, 02ah, 02ah, 015h, 02ah, 02ah, 03fh
@@ -6953,7 +6943,7 @@ _palette2:                                   ; 0xc51c3 LB 0xc0
     db  015h, 015h, 000h, 015h, 015h, 02ah, 015h, 03fh, 000h, 015h, 03fh, 02ah, 03fh, 015h, 000h, 03fh
     db  015h, 02ah, 03fh, 03fh, 000h, 03fh, 03fh, 02ah, 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh
     db  015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh
-_palette3:                                   ; 0xc5283 LB 0x300
+_palette3:                                   ; 0xc5088 LB 0x300
     db  000h, 000h, 000h, 000h, 000h, 02ah, 000h, 02ah, 000h, 000h, 02ah, 02ah, 02ah, 000h, 000h, 02ah
     db  000h, 02ah, 02ah, 015h, 000h, 02ah, 02ah, 02ah, 015h, 015h, 015h, 015h, 015h, 03fh, 015h, 03fh
     db  015h, 015h, 03fh, 03fh, 03fh, 015h, 015h, 03fh, 015h, 03fh, 03fh, 03fh, 015h, 03fh, 03fh, 03fh
@@ -7002,12 +6992,19 @@ _palette3:                                   ; 0xc5283 LB 0x300
     db  00bh, 010h, 00bh, 00bh, 010h, 00ch, 00bh, 010h, 00dh, 00bh, 010h, 00fh, 00bh, 010h, 010h, 00bh
     db  00fh, 010h, 00bh, 00dh, 010h, 00bh, 00ch, 010h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-_static_functionality:                       ; 0xc5583 LB 0x10
+_static_functionality:                       ; 0xc5388 LB 0x10
     db  0ffh, 0e0h, 00fh, 000h, 000h, 000h, 000h, 007h, 002h, 008h, 0e7h, 00ch, 000h, 000h, 000h, 000h
-_video_save_pointer_table:                   ; 0xc5593 LB 0x1c
-    db  0c3h, 048h, 000h, 0c0h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-_vgafont8:                                   ; 0xc55af LB 0x800
+_dcc_table:                                  ; 0xc5398 LB 0x24
+    db  010h, 001h, 007h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h
+_secondary_save_area:                        ; 0xc53bc LB 0x1a
+    db  01ah, 000h, 098h, 053h, 000h, 0c0h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+_video_save_pointer_table:                   ; 0xc53d6 LB 0x1c
+    db  0c8h, 046h, 000h, 0c0h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  0bch, 053h, 000h, 0c0h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+_vgafont8:                                   ; 0xc53f2 LB 0x800
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07eh, 081h, 0a5h, 081h, 0bdh, 099h, 081h, 07eh
     db  07eh, 0ffh, 0dbh, 0ffh, 0c3h, 0e7h, 0ffh, 07eh, 06ch, 0feh, 0feh, 0feh, 07ch, 038h, 010h, 000h
     db  010h, 038h, 07ch, 0feh, 07ch, 038h, 010h, 000h, 038h, 07ch, 038h, 0feh, 0feh, 07ch, 038h, 07ch
@@ -7136,7 +7133,7 @@ _vgafont8:                                   ; 0xc55af LB 0x800
     db  000h, 000h, 000h, 000h, 018h, 000h, 000h, 000h, 00fh, 00ch, 00ch, 00ch, 0ech, 06ch, 03ch, 01ch
     db  078h, 06ch, 06ch, 06ch, 06ch, 000h, 000h, 000h, 070h, 018h, 030h, 060h, 078h, 000h, 000h, 000h
     db  000h, 000h, 03ch, 03ch, 03ch, 03ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-_vgafont14:                                  ; 0xc5daf LB 0xe00
+_vgafont14:                                  ; 0xc5bf2 LB 0xe00
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  07eh, 081h, 0a5h, 081h, 081h, 0bdh, 099h, 081h, 07eh, 000h, 000h, 000h, 000h, 000h, 07eh, 0ffh
     db  0dbh, 0ffh, 0ffh, 0c3h, 0e7h, 0ffh, 07eh, 000h, 000h, 000h, 000h, 000h, 000h, 06ch, 0feh, 0feh
@@ -7361,7 +7358,7 @@ _vgafont14:                                  ; 0xc5daf LB 0xe00
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 070h, 0d8h, 030h, 060h, 0c8h, 0f8h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07ch, 07ch, 07ch, 07ch, 07ch, 07ch, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-_vgafont16:                                  ; 0xc6baf LB 0x1000
+_vgafont16:                                  ; 0xc69f2 LB 0x1000
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 07eh, 081h, 0a5h, 081h, 081h, 0bdh, 099h, 081h, 081h, 07eh, 000h, 000h, 000h, 000h
     db  000h, 000h, 07eh, 0ffh, 0dbh, 0ffh, 0ffh, 0c3h, 0e7h, 0ffh, 0ffh, 07eh, 000h, 000h, 000h, 000h
@@ -7618,7 +7615,7 @@ _vgafont16:                                  ; 0xc6baf LB 0x1000
     db  000h, 070h, 0d8h, 030h, 060h, 0c8h, 0f8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 07ch, 07ch, 07ch, 07ch, 07ch, 07ch, 07ch, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-_vgafont14alt:                               ; 0xc7baf LB 0x12d
+_vgafont14alt:                               ; 0xc79f2 LB 0x12d
     db  01dh, 000h, 000h, 000h, 000h, 024h, 066h, 0ffh, 066h, 024h, 000h, 000h, 000h, 000h, 000h, 022h
     db  000h, 063h, 063h, 063h, 022h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 02bh, 000h
     db  000h, 000h, 018h, 018h, 018h, 0ffh, 018h, 018h, 018h, 000h, 000h, 000h, 000h, 02dh, 000h, 000h
@@ -7638,7 +7635,7 @@ _vgafont14alt:                               ; 0xc7baf LB 0x12d
     db  000h, 0fch, 066h, 066h, 07ch, 062h, 066h, 06fh, 066h, 066h, 0f3h, 000h, 000h, 000h, 0f1h, 000h
     db  000h, 018h, 018h, 018h, 0ffh, 018h, 018h, 018h, 000h, 0ffh, 000h, 000h, 000h, 0f6h, 000h, 000h
     db  018h, 018h, 000h, 000h, 0ffh, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h
-_vgafont16alt:                               ; 0xc7cdc LB 0x144
+_vgafont16alt:                               ; 0xc7b1f LB 0x145
     db  01dh, 000h, 000h, 000h, 000h, 000h, 024h, 066h, 0ffh, 066h, 024h, 000h, 000h, 000h, 000h, 000h
     db  000h, 030h, 000h, 000h, 03ch, 066h, 0c3h, 0c3h, 0dbh, 0dbh, 0c3h, 0c3h, 066h, 03ch, 000h, 000h
     db  000h, 000h, 04dh, 000h, 000h, 0c3h, 0e7h, 0ffh, 0ffh, 0dbh, 0c3h, 0c3h, 0c3h, 0c3h, 0c3h, 000h
@@ -7659,34 +7656,59 @@ _vgafont16alt:                               ; 0xc7cdc LB 0x144
     db  09eh, 000h, 0fch, 066h, 066h, 07ch, 062h, 066h, 06fh, 066h, 066h, 066h, 0f3h, 000h, 000h, 000h
     db  000h, 0abh, 000h, 0c0h, 0c0h, 0c2h, 0c6h, 0cch, 018h, 030h, 060h, 0ceh, 09bh, 006h, 00ch, 01fh
     db  000h, 000h, 0ach, 000h, 0c0h, 0c0h, 0c2h, 0c6h, 0cch, 018h, 030h, 066h, 0ceh, 096h, 03eh, 006h
-    db  006h, 000h, 000h, 000h
-_vbebios_copyright:                          ; 0xc7e20 LB 0x15
+    db  006h, 000h, 000h, 000h, 000h
+_vbebios_copyright:                          ; 0xc7c64 LB 0x15
     db  'VirtualBox VESA BIOS', 000h
-_vbebios_vendor_name:                        ; 0xc7e35 LB 0x13
+_vbebios_vendor_name:                        ; 0xc7c79 LB 0x13
     db  'Oracle Corporation', 000h
-_vbebios_product_name:                       ; 0xc7e48 LB 0x21
+_vbebios_product_name:                       ; 0xc7c8c LB 0x21
     db  'Oracle VM VirtualBox VBE Adapter', 000h
-_vbebios_product_revision:                   ; 0xc7e69 LB 0x24
-    db  'Oracle VM VirtualBox Version 4.3.28', 000h
-_vbebios_info_string:                        ; 0xc7e8d LB 0x2b
+_vbebios_product_revision:                   ; 0xc7cad LB 0x29
+    db  'Oracle VM VirtualBox Version 5.0.0_BETA4', 000h
+_vbebios_info_string:                        ; 0xc7cd6 LB 0x2b
     db  'VirtualBox VBE Display Adapter enabled', 00dh, 00ah, 00dh, 00ah, 000h
-_no_vbebios_info_string:                     ; 0xc7eb8 LB 0x29
+_no_vbebios_info_string:                     ; 0xc7d01 LB 0x29
     db  'No VirtualBox VBE support available!', 00dh, 00ah, 00dh, 00ah, 000h
 
-  ; Padding 0x1 bytes at 0xc7ee1
-    db  001h
+section CONST progbits vstart=0x7d2a align=1 ; size=0x0 class=DATA group=DGROUP
 
-section CONST progbits vstart=0x7ee2 align=1 ; size=0x0 class=DATA group=DGROUP
+section CONST2 progbits vstart=0x7d2a align=1 ; size=0x0 class=DATA group=DGROUP
 
-section CONST2 progbits vstart=0x7ee2 align=1 ; size=0x0 class=DATA group=DGROUP
-
-  ; Padding 0x11e bytes at 0xc7ee2
-    db  000h, 000h, 000h, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 02fh, 068h, 06fh, 06dh, 065h
-    db  02fh, 066h, 06dh, 033h, 02fh, 073h, 072h, 063h, 02fh, 076h, 062h, 06fh, 078h, 02dh, 034h, 02eh
-    db  033h, 02fh, 06fh, 075h, 074h, 02fh, 06ch, 069h, 06eh, 075h, 078h, 02eh, 061h, 06dh, 064h, 036h
-    db  034h, 02fh, 072h, 065h, 06ch, 065h, 061h, 073h, 065h, 02fh, 06fh, 062h, 06ah, 02fh, 056h, 042h
-    db  06fh, 078h, 056h, 067h, 061h, 042h, 069h, 06fh, 073h, 02fh, 056h, 042h, 06fh, 078h, 056h, 067h
-    db  061h, 042h, 069h, 06fh, 073h, 02eh, 073h, 079h, 06dh, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+  ; Padding 0x2d6 bytes at 0xc7d2a
+    db  001h, 000h, 000h, 000h, 000h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 02fh, 068h, 06fh, 06dh
+    db  065h, 02fh, 066h, 06dh, 033h, 02fh, 073h, 072h, 063h, 02fh, 076h, 062h, 06fh, 078h, 02fh, 06fh
+    db  075h, 074h, 02fh, 06ch, 069h, 06eh, 075h, 078h, 02eh, 061h, 06dh, 064h, 036h, 034h, 02fh, 072h
+    db  065h, 06ch, 065h, 061h, 073h, 065h, 02fh, 06fh, 062h, 06ah, 02fh, 056h, 042h, 06fh, 078h, 056h
+    db  067h, 061h, 042h, 069h, 06fh, 073h, 02fh, 056h, 042h, 06fh, 078h, 056h, 067h, 061h, 042h, 069h
+    db  06fh, 073h, 02eh, 073h, 079h, 06dh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
@@ -7698,4 +7720,4 @@ section CONST2 progbits vstart=0x7ee2 align=1 ; size=0x0 class=DATA group=DGROUP
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 052h
+    db  000h, 000h, 000h, 000h, 000h, 0d8h
diff --git a/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.md5sum b/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.md5sum
index eb48fdd..b91e293 100644
--- a/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.md5sum
+++ b/src/VBox/Devices/Graphics/BIOS/VBoxVgaBiosAlternative.md5sum
@@ -1 +1 @@
-8406df1961ac4c9f5a155ae44226c892 *VBoxVgaBios.rom
+f4e86759b71bab93b5eb55c13a752604 *VBoxVgaBios.rom
diff --git a/src/VBox/Devices/Graphics/BIOS/vbe.c b/src/VBox/Devices/Graphics/BIOS/vbe.c
index bc8d2bd..1e5cc44 100644
--- a/src/VBox/Devices/Graphics/BIOS/vbe.c
+++ b/src/VBox/Devices/Graphics/BIOS/vbe.c
@@ -53,7 +53,7 @@
 //#define VBE2_NO_VESA_CHECK
 
 // use bytewise i/o (Longhorn beta issue, not in released Vista)
-//#define VBE_BYTEWISE_IO
+#define VBE_BYTEWISE_IO
 
 #ifdef VBE_BYTEWISE_IO
     extern void do_out_dx_ax();
diff --git a/src/VBox/Devices/Graphics/BIOS/vberom.asm b/src/VBox/Devices/Graphics/BIOS/vberom.asm
index cdc8316..5d58364 100644
--- a/src/VBox/Devices/Graphics/BIOS/vberom.asm
+++ b/src/VBox/Devices/Graphics/BIOS/vberom.asm
@@ -57,6 +57,8 @@ VGAROM  segment public 'CODE'
 
 .386
 
+VBE_BYTEWISE_IO EQU 1
+
 ;; Bytewise in/out
 ifdef VBE_BYTEWISE_IO
 
diff --git a/src/VBox/Devices/Graphics/BIOS/vgabios.c b/src/VBox/Devices/Graphics/BIOS/vgabios.c
index 26739bc..389e711 100644
--- a/src/VBox/Devices/Graphics/BIOS/vgabios.c
+++ b/src/VBox/Devices/Graphics/BIOS/vgabios.c
@@ -181,8 +181,37 @@ void init_bios_area(void)
     bda[BIOSMEM_CURRENT_MSR] = 0x09;
 }
 
+struct dcc {
+    uint8_t     n_ent;
+    uint8_t     version;
+    uint8_t     max_code;
+    uint8_t     reserved;
+    uint16_t    dccs[16];
+} dcc_table = {
+    16,
+    1,
+    7,
+    0
+};
+
+struct ssa {
+    uint16_t    size;
+    void __far  *dcc;
+    void __far  *sacs;
+    void __far  *pal;
+    void __far  *resvd[3];
+
+} secondary_save_area = {
+    sizeof(struct ssa),
+    &dcc_table
+};
+
 void __far *video_save_pointer_table[7] = {
-    &video_param_table
+    &video_param_table,
+    0,
+    0,
+    0,
+    &secondary_save_area
 };
 
 // ============================================================================================
@@ -633,6 +662,11 @@ void biosfn_set_video_mode(uint8_t mode)
  // The real mode
  mode=mode&0x7f;
 
+ // Display switching is not supported, and mono monitors aren't either.
+ // Requests to set mode 7 (mono) must set mode 0 instead (color).
+ if (mode == 7)
+     mode = 0;
+
  // find the entry in the video modes
  line=find_vga_entry(mode);
 
@@ -1413,29 +1447,20 @@ static void biosfn_write_teletype(uint8_t car, uint8_t page, uint8_t attr, uint8
 
  switch(car)
   {
-   case 7:
+   case '\a':   // ASCII 0x07, BEL
     //FIXME should beep
     break;
 
-   case 8:
+   case '\b':   // ASCII 0x08, BS
     if(xcurs>0)xcurs--;
     break;
 
-   case '\r':
-    xcurs=0;
-    break;
-
-   case '\n':
+   case '\n':   // ASCII 0x0A, LF
     ycurs++;
     break;
 
-   case '\t':
-    do
-     {
-      biosfn_write_teletype(' ',page,attr,flag);
-      vga_get_cursor_pos(page,&dummy,&cursor);
-      xcurs=cursor&0x00ff;ycurs=(cursor&0xff00)>>8;
-     }while(xcurs%8==0);
+   case '\r':   // ASCII 0x0D, CR
+    xcurs=0;
     break;
 
    default:
@@ -1475,12 +1500,11 @@ static void biosfn_write_teletype(uint8_t car, uint8_t page, uint8_t attr, uint8
        }
      }
     xcurs++;
-  }
-
- // Do we need to wrap ?
- if(xcurs==nbcols)
-  {xcurs=0;
-   ycurs++;
+    // Do we need to wrap ?
+    if(xcurs==nbcols)
+     {xcurs=0;
+      ycurs++;
+     }
   }
 
  // Do we need to scroll ?
diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
index 6c4aff6..cab295d 100644
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp
@@ -36,7 +36,6 @@
 #ifdef VMSVGA_USE_EMT_HALT_CODE
 # include <VBox/vmm/vmapi.h>
 # include <VBox/vmm/vmcpuset.h>
-# include <VBox/vmm/vm.h> /* Need VMCPU::idCpu. */
 #endif
 #include <VBox/sup.h>
 
@@ -93,7 +92,7 @@
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
 /* 64-bit GMR descriptor */
-typedef struct 
+typedef struct
 {
    RTGCPHYS GCPhys;
    uint64_t numPages;
@@ -118,7 +117,7 @@ typedef struct
         uint32_t            bytesPerLine;
         SVGAGMRImageFormat  format;
     } GMRFB;
-    struct 
+    struct
     {
         bool                fActive;
         uint32_t            xHotspot;
@@ -158,6 +157,23 @@ typedef struct
 
 } VMSVGASTATE, *PVMSVGASTATE;
 
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+#ifdef IN_RING3
+# ifdef DEBUG_FIFO_ACCESS
+static FNPGMPHYSHANDLER vmsvgaR3FIFOAccessHandler;
+# endif
+# ifdef DEBUG_GMR_ACCESS
+static FNPGMPHYSHANDLER vmsvgaR3GMRAccessHandler;
+# endif
+#endif
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
 #ifdef IN_RING3
 
 /**
@@ -227,7 +243,7 @@ static SSMFIELD const g_aVGAStateSVGAFields[] =
     SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, pSVGAState),
     SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, p3dState),
     SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, pFrameBufferBackup),
-    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, pFIFOExtCmdParam),    
+    SSMFIELD_ENTRY_IGN_HCPTR(       VMSVGAState, pFIFOExtCmdParam),
     SSMFIELD_ENTRY_IGN_GCPHYS(      VMSVGAState, GCPhysFIFO),
     SSMFIELD_ENTRY_IGNORE(          VMSVGAState, cbFIFO),
     SSMFIELD_ENTRY(                 VMSVGAState, u32SVGAId),
@@ -512,7 +528,7 @@ static const char *vmsvgaFIFOCmdToString(uint32_t u32Cmd)
  * Inform the VGA device of viewport changes (as a result of e.g. scrolling)
  *
  * @param   pInterface          Pointer to this interface.
- * @param   
+ * @param
  * @param   uScreenId           The screen updates are for.
  * @param   x                   The upper left corner x coordinate of the new viewport rectangle
  * @param   y                   The upper left corner y coordinate of the new viewport rectangle
@@ -805,7 +821,7 @@ PDMBOTHCBDECL(int) vmsvgaReadPort(PVGASTATE pThis, uint32_t *pu32)
             PVMSVGASTATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;
             STAM_REL_PROFILE_START(&pSVGAState->StatBusyDelayEmts, EmtDelay);
             PVM         pVM   = PDMDevHlpGetVM(pThis->pDevInsR3);
-            VMCPUID     idCpu = PDMDevHlpGetVMCPU(pThis->pDevInsR3)->idCpu; /** @todo add a separate dev helper for this. */
+            VMCPUID     idCpu = PDMDevHlpGetCurrentCpuId(pThis->pDevInsR3);
             VMCPUSET_ATOMIC_ADD(&pSVGAState->BusyDelayedEmts, idCpu);
             ASMAtomicIncU32(&pSVGAState->cBusyDelayedEmts);
             if (pThis->svga.fBusy)
@@ -1003,7 +1019,7 @@ int vmsvgaChangeMode(PVGASTATE pThis)
     pThis->last_scr_height  = pThis->svga.uHeight;
     pThis->last_width       = pThis->svga.uWidth;
     pThis->last_height      = pThis->svga.uHeight;
-    
+
     ASMAtomicOrU32(&pThis->svga.u32ActionFlags, VMSVGA_ACTION_CHANGEMODE);
 
     /* vmsvgaPortSetViewPort not called after state load; set sensible defaults. */
@@ -1058,7 +1074,7 @@ PDMBOTHCBDECL(int) vmsvgaWritePort(PVGASTATE pThis, uint32_t u32)
     switch (pThis->svga.u32IndexReg)
     {
     case SVGA_REG_ID:
-        if (    u32 == SVGA_ID_0 
+        if (    u32 == SVGA_ID_0
             ||  u32 == SVGA_ID_1
             ||  u32 == SVGA_ID_2)
             pThis->svga.u32SVGAId = u32;
@@ -1076,7 +1092,7 @@ PDMBOTHCBDECL(int) vmsvgaWritePort(PVGASTATE pThis, uint32_t u32)
             break;
 
 #ifdef IN_RING3
-        if (    u32 == 1 
+        if (    u32 == 1
             &&  pThis->svga.fEnabled == false)
         {
             /* Make a backup copy of the first 32k in order to save font data etc. */
@@ -1360,7 +1376,7 @@ PDMBOTHCBDECL(int) vmsvgaWritePort(PVGASTATE pThis, uint32_t u32)
         if (pThis->svga.fTraces == u32)
             break; /* nothing to do */
 
-#ifdef IN_RING3        
+#ifdef IN_RING3
         vmsvgaSetTraces(pThis, !!u32);
 #else
         rc = VINF_IOM_R3_IOPORT_WRITE;
@@ -1523,7 +1539,7 @@ PDMBOTHCBDECL(int) vmsvgaIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port
  * @param   fWriteAccess    Read or write access
  */
 static int vmsvgaFIFOAccess(PVM pVM, PVGASTATE pThis, RTGCPHYS GCPhys, bool fWriteAccess)
-{   
+{
     RTGCPHYS GCPhysOffset = GCPhys - pThis->svga.GCPhysFIFO;
     uint32_t *pFIFO = pThis->svga.pFIFOR3;
 
@@ -1858,20 +1874,23 @@ static int vmsvgaFIFOAccess(PVM pVM, PVGASTATE pThis, RTGCPHYS GCPhys, bool fWri
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             VM Handle.
+ * @param   pVCpu           The cross context CPU structure for the calling EMT.
  * @param   GCPhys          The physical address the guest is writing to.
  * @param   pvPhys          The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
+ * @param   enmOrigin       Who is making the access.
  * @param   pvUser          User argument.
  */
-static DECLCALLBACK(int) vmsvgaR3FIFOAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser)
+static DECLCALLBACK(int) vmsvgaR3FIFOAccessHandler(PVM pVM, PVMCPU pVCpu RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                                   PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     PVGASTATE   pThis = (PVGASTATE)pvUser;
     int         rc;
     Assert(pThis);
     Assert(GCPhys >= pThis->GCPhysVRAM);
-    NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf);
+    NOREF(pVCpu); NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmOrigin);
 
     rc = vmsvgaFIFOAccess(pVM, pThis, GCPhys, enmAccessType == PGMACCESSTYPE_WRITE);
     if (RT_SUCCESS(rc))
@@ -1890,19 +1909,22 @@ static DECLCALLBACK(int) vmsvgaR3FIFOAccessHandler(PVM pVM, RTGCPHYS GCPhys, voi
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             VM Handle.
+ * @param   pVCpu           The cross context CPU structure for the calling EMT.
  * @param   GCPhys          The physical address the guest is writing to.
  * @param   pvPhys          The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
+ * @param   enmOrigin       Who is making the access.
  * @param   pvUser          User argument.
  */
-static DECLCALLBACK(int) vmsvgaR3GMRAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser)
+static DECLCALLBACK(int) vmsvgaR3GMRAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                                  PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     PVGASTATE   pThis = (PVGASTATE)pvUser;
     Assert(pThis);
     PVMSVGASTATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;
-    NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf);
+    NOREF(pVCpu); NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmOrigin);
 
     Log(("vmsvgaR3GMRAccessHandler: GMR access to page %RGp\n", GCPhys));
 
@@ -1914,7 +1936,7 @@ static DECLCALLBACK(int) vmsvgaR3GMRAccessHandler(PVM pVM, RTGCPHYS GCPhys, void
         {
             for (uint32_t j = 0; j < pGMR->numDescriptors; j++)
             {
-                if (    GCPhys >= pGMR->paDesc[j].GCPhys 
+                if (    GCPhys >= pGMR->paDesc[j].GCPhys
                     &&  GCPhys < pGMR->paDesc[j].GCPhys + pGMR->paDesc[j].numPages * PAGE_SIZE)
                 {
                     /*
@@ -1943,20 +1965,16 @@ static DECLCALLBACK(int) vmsvgaRegisterGMR(PPDMDEVINS pDevIns, uint32_t gmrId)
 
     for (uint32_t i = 0; i < pGMR->numDescriptors; i++)
     {
-        rc = PGMR3HandlerPhysicalRegister(PDMDevHlpGetVM(pThis->pDevInsR3),
-                                            PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
-                                            pGMR->paDesc[i].GCPhys, pGMR->paDesc[i].GCPhys + pGMR->paDesc[i].numPages * PAGE_SIZE - 1,
-                                            vmsvgaR3GMRAccessHandler, pThis,
-                                            NULL, NULL, NULL,
-                                            NULL, NULL, NULL,
-                                            "VMSVGA GMR");
+        rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pThis->pDevInsR3),
+                                        pGMR->paDesc[i].GCPhys, pGMR->paDesc[i].GCPhys + pGMR->paDesc[i].numPages * PAGE_SIZE - 1,
+                                        pThis->svga.hGmrAccessHandlerType, pThis, NIL_RTR0PTR, NIL_RTRCPTR, "VMSVGA GMR");
         AssertRC(rc);
     }
     return VINF_SUCCESS;
 }
 
 /* Callback handler for VMR3ReqCallWait */
-static DECLCALLBACK(int) vmsvgaUnregisterGMR(PPDMDEVINS pDevIns, uint32_t gmrId)
+static DECLCALLBACK(int) vmsvgaDeregisterGMR(PPDMDEVINS pDevIns, uint32_t gmrId)
 {
     PVGASTATE    pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
     PVMSVGASTATE pSVGAState = (PVMSVGASTATE)pThis->svga.pSVGAState;
@@ -1988,7 +2006,7 @@ static DECLCALLBACK(int) vmsvgaResetGMRHandlers(PVGASTATE pThis)
             }
         }
     }
-    return VINF_SUCCESS;   
+    return VINF_SUCCESS;
 }
 
 # endif /* IN_RING3 */
@@ -2406,7 +2424,7 @@ static DECLCALLBACK(int) vmsvgaFIFOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
                 break;
 
             case SVGA_CMD_FENCE:
-            {                
+            {
                 SVGAFifoCmdFence *pCmdFence;
                 VMSVGAFIFO_GET_CMD_BUFFER_BREAK(pCmdFence, SVGAFifoCmdFence, sizeof(*pCmdFence));
                 if (VMSVGA_IS_VALID_FIFO_REG(SVGA_FIFO_FENCE, offFifoMin))
@@ -2826,7 +2844,7 @@ static DECLCALLBACK(int) vmsvgaFIFOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
                 VMSVGAFIFO_GET_CMD_BUFFER_BREAK(pCmd, SVGAFifoCmdAnnotationFill, sizeof(*pCmd));
 
                 Log(("vmsvgaFIFOLoop: SVGA_CMD_ANNOTATION_FILL red=%x green=%x blue=%x\n", pCmd->color.s.r, pCmd->color.s.g, pCmd->color.s.b));
-                pSVGAState->colorAnnotation = pCmd->color; 
+                pSVGAState->colorAnnotation = pCmd->color;
                 break;
             }
 
@@ -2936,7 +2954,7 @@ static DECLCALLBACK(int) vmsvgaFIFOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
 
                         cRects = (pHdr->size - sizeof(*pCmd)) / sizeof(SVGASignedRect);
                         rc = vmsvga3dSurfaceBlitToScreen(pThis, pCmd->destScreenId, pCmd->destRect, pCmd->srcImage, pCmd->srcRect, cRects, (SVGASignedRect *)(pCmd + 1));
-                        break;                
+                        break;
                     }
 
                     case SVGA_3D_CMD_CONTEXT_DEFINE:
@@ -3272,7 +3290,7 @@ void vmsvgaGMRFree(PVGASTATE pThis, uint32_t idGMR)
     {
         PGMR pGMR = &pSVGAState->aGMR[idGMR];
 # ifdef DEBUG_GMR_ACCESS
-        VMR3ReqCallWait(PDMDevHlpGetVM(pThis->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaUnregisterGMR, 2, pThis->pDevInsR3, idGMR);
+        VMR3ReqCallWait(PDMDevHlpGetVM(pThis->pDevInsR3), VMCPUID_ANY, (PFNRT)vmsvgaDeregisterGMR, 2, pThis->pDevInsR3, idGMR);
 # endif
 
         Assert(pGMR->paDesc);
@@ -3348,7 +3366,7 @@ int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,
         }
         else
         {
-            for(uint32_t i = 0; i < cHeight; i++) 
+            for(uint32_t i = 0; i < cHeight; i++)
             {
                 memcpy(pbDst, pSrc, cbWidth);
 
@@ -3372,7 +3390,7 @@ int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,
                     ("src.gmrId=%#x src.offset=%#x offSrc=%#x cbSrcPitch=%#x cHeight=%#x cbWidth=%#x cbTotal=%#x\n",
                      src.gmrId, src.offset, offSrc, cbSrcPitch, cHeight, cbWidth, pGMR->cbTotal),
                     VERR_INVALID_PARAMETER);
-    
+
     for (uint32_t i = 0; i < cHeight; i++)
     {
         uint32_t cbCurrentWidth = cbWidth;
@@ -3395,7 +3413,7 @@ int vmsvgaGMRTransfer(PVGASTATE pThis, const SVGA3dTransferType enmTransferType,
             {
                 cbToCopy = cbCurrentWidth;
             }
-            else 
+            else
             {
                 cbToCopy = (offDesc + pDesc->numPages * PAGE_SIZE - offCurrent);
                 AssertReturn(cbToCopy <= cbCurrentWidth, VERR_INVALID_PARAMETER);
@@ -3550,13 +3568,9 @@ DECLCALLBACK(int) vmsvgaR3IORegionMap(PPCIDEVICE pPciDev, int iRegion, RTGCPHYS
 # ifdef DEBUG_FIFO_ACCESS
             if (RT_SUCCESS(rc))
             {
-                rc = PGMR3HandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns),
-                                                  PGMPHYSHANDLERTYPE_PHYSICAL_ALL,
-                                                  GCPhysAddress, GCPhysAddress + (VMSVGA_FIFO_SIZE - 1),
-                                                  vmsvgaR3FIFOAccessHandler, pThis,
-                                                  NULL, NULL, NULL,
-                                                  NULL, NULL, NULL,
-                                                  "VMSVGA FIFO");
+                rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns), GCPhysAddress, GCPhysAddress + (VMSVGA_FIFO_SIZE - 1),
+                                                pThis->svga.hFifoAccessHandlerType, pThis, NIL_RTR0PTR, NIL_RTRCPTR, 
+                                                "VMSVGA FIFO");
                 AssertRC(rc);
             }
 # endif
@@ -3618,7 +3632,7 @@ int vmsvgaLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint3
         PGMR pGMR = &pSVGAState->aGMR[i];
 
         rc = SSMR3GetStructEx(pSSM, pGMR, sizeof(*pGMR), 0, g_aGMRFields, NULL);
-        AssertRCReturn(rc, rc); 
+        AssertRCReturn(rc, rc);
 
         if (pGMR->numDescriptors)
         {
@@ -3647,7 +3661,7 @@ int vmsvgaLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint3
         /* Save the 3d state in the FIFO thread. */
         pThis->svga.u8FIFOExtCommand = VMSVGA_FIFO_EXTCMD_LOADSTATE;
         pThis->svga.pFIFOExtCmdParam = (void *)&loadstate;
-        /* Hack alert: resume the IO thread as it has been suspended before the destruct callback. 
+        /* Hack alert: resume the IO thread as it has been suspended before the destruct callback.
          * The PowerOff notification isn't working, so not an option in this case.
          */
         PDMR3ThreadResume(pThis->svga.pFIFOIOThread);
@@ -3738,7 +3752,7 @@ int vmsvgaSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
         /* Save the 3d state in the FIFO thread. */
         pThis->svga.u8FIFOExtCommand = VMSVGA_FIFO_EXTCMD_SAVESTATE;
         pThis->svga.pFIFOExtCmdParam = (void *)pSSM;
-        /* Hack alert: resume the IO thread as it has been suspended before the destruct callback. 
+        /* Hack alert: resume the IO thread as it has been suspended before the destruct callback.
          * The PowerOff notification isn't working, so not an option in this case.
          */
         PDMR3ThreadResume(pThis->svga.pFIFOIOThread);
@@ -3822,7 +3836,7 @@ int vmsvgaDestruct(PPDMDEVINS pDevIns)
 
     /* Stop the FIFO thread. */
     pThis->svga.u8FIFOExtCommand = VMSVGA_FIFO_EXTCMD_TERMINATE;
-    /* Hack alert: resume the IO thread as it has been suspended before the destruct callback. 
+    /* Hack alert: resume the IO thread as it has been suspended before the destruct callback.
      * The PowerOff notification isn't working, so not an option in this case.
      */
     PDMR3ThreadResume(pThis->svga.pFIFOIOThread);
@@ -3958,6 +3972,20 @@ int vmsvgaInit(PPDMDEVINS pDevIns)
     }
     Log(("VMSVGA: Maximum size (%d,%d)\n", pThis->svga.u32MaxWidth, pThis->svga.u32MaxHeight));
 
+# ifdef DEBUG_GMR_ACCESS
+    /* Register the GMR access handler type. */
+    rc = PGMR3HandlerPhysicalTypeRegister(PDMDevHlpGetVM(pThis->pDevInsR3), PGMPHYSHANDLERKIND_WRITE,
+                                          vmsvgaR3GMRAccessHandler, NULL, NULL, NULL, NULL, "VMSVGA GMR",
+                                          &pThis->svga.hGmrAccessHandlerType);
+    AssertRCReturn(rc, rc);
+# endif
+# ifdef DEBUG_FIFO_ACCESS
+    rc = PGMR3HandlerPhysicalTypeRegister(PDMDevHlpGetVM(pThis->pDevInsR3), PGMPHYSHANDLERKIND_ALL,
+                                          vmsvgaR3FIFOAccessHandler, NULL, NULL, NULL, NULL, "VMSVGA FIFO",
+                                          &pThis->svga.hFifoAccessHandlerType);
+    AssertRCReturn(rc, rc);
+#endif
+
     /* Create the async IO thread. */
     rc = PDMDevHlpThreadCreate(pDevIns, &pThis->svga.pFIFOIOThread, pThis, vmsvgaFIFOLoop, vmsvgaFIFOLoopWakeUp, 0,
                                 RTTHREADTYPE_IO, "VMSVGA FIFO");
@@ -3980,7 +4008,7 @@ int vmsvgaInit(PPDMDEVINS pDevIns)
     STAM_REL_REG(pVM, &pSVGAState->StatFifoTodoTimeout, STAMTYPE_COUNTER, "/Devices/VMSVGA/FifoTodoTimeout",  STAMUNIT_OCCURENCES, "Number of times we discovered pending work after a wait timeout.");
     STAM_REL_REG(pVM, &pSVGAState->StatFifoTodoWoken,   STAMTYPE_COUNTER, "/Devices/VMSVGA/FifoTodoWoken",  STAMUNIT_OCCURENCES, "Number of times we discovered pending work after being woken up.");
     STAM_REL_REG(pVM, &pSVGAState->StatFifoStalls,      STAMTYPE_PROFILE, "/Devices/VMSVGA/FifoStalls",  STAMUNIT_TICKS_PER_CALL, "Profiling of FIFO stalls (waiting for guest to finish copying data).");
-   
+
     return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m
index e494920..f7fe389 100644
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m
@@ -1,7 +1,7 @@
 /* $Id: DevVGA-SVGA3d-cocoa.m $ */
 /** @file
- * VirtualBox OpenGL Cocoa Window System Helper Implementation. 
- *  
+ * VirtualBox OpenGL Cocoa Window System Helper Implementation.
+ *
  * @remarks Inspired by HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m.
  */
 
diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
index 33e862d..5e7c3a3 100644
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
@@ -2330,7 +2330,7 @@ static void vmsvga3dSurfaceFormat2OGL(PVMSVGA3DSURFACE pSurface, SVGA3dSurfaceFo
         pSurface->internalFormatGL = GL_DEPTH_COMPONENT16; /** @todo Wine suggests GL_DEPTH_COMPONENT24. */
         pSurface->formatGL = GL_DEPTH_COMPONENT;
         pSurface->typeGL = GL_UNSIGNED_SHORT;
-        AssertMsgFailed(("Test me - SVGA3D_Z_D16\n"));
+        //AssertMsgFailed(("Test me - SVGA3D_Z_D16\n"));
         break;
     case SVGA3D_Z_D24S8:                /* D3DFMT_D24S8 - WINED3DFMT_D24_UNORM_S8_UINT */
         pSurface->internalFormatGL = GL_DEPTH24_STENCIL8;
@@ -3143,7 +3143,9 @@ static int vmsvga3dCreateTexture(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContex
 
 #ifdef VMSVGA3D_OGL_WITH_SHARED_CTX
     if (idPrevCtx < pState->cContexts && pState->papContexts[idPrevCtx]->id == idPrevCtx)
+    {
         VMSVGA3D_SET_CURRENT_CONTEXT(pState, pState->papContexts[idPrevCtx]);
+    }
 #endif
     return VINF_SUCCESS;
 }
diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
index cb3ae4e..902f4b2 100644
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
@@ -1,3 +1,4 @@
+/* $Id: DevVGA-SVGA3d-shared.cpp $ */
 /** @file
  * DevVMWare - VMWare SVGA device
  */
@@ -145,28 +146,28 @@ DECLCALLBACK(int) vmsvga3dWindowThread(RTTHREAD ThreadSelf, void *pvUser)
                 pCS->cx = rectClient.right - rectClient.left;
                 pCS->cy = rectClient.bottom - rectClient.top;
 #endif
-                *pHwnd = CreateWindowEx(pCS->dwExStyle, 
-                                        VMSVGA3D_WNDCLASSNAME, 
-                                        pCS->lpszName, 
+                *pHwnd = CreateWindowEx(pCS->dwExStyle,
+                                        VMSVGA3D_WNDCLASSNAME,
+                                        pCS->lpszName,
                                         pCS->style,
 #ifdef DEBUG_GFX_WINDOW
                                         0,
                                         0,
 #else
-                                        pCS->x, 
-                                        pCS->y, 
+                                        pCS->x,
+                                        pCS->y,
 #endif
-                                        pCS->cx, 
+                                        pCS->cx,
                                         pCS->cy,
 #ifdef DEBUG_GFX_WINDOW
                                         0,
 #else
-                                        pCS->hwndParent, 
+                                        pCS->hwndParent,
 #endif
-                                        pCS->hMenu, 
-                                        pCS->hInstance, 
+                                        pCS->hMenu,
+                                        pCS->hInstance,
                                         NULL);
-                AssertMsg(*pHwnd, ("CreateWindowEx %x %s %s %x (%d,%d)(%d,%d), %x %x %x error=%x\n", pCS->dwExStyle, pCS->lpszName, VMSVGA3D_WNDCLASSNAME, pCS->style, pCS->x, 
+                AssertMsg(*pHwnd, ("CreateWindowEx %x %s %s %x (%d,%d)(%d,%d), %x %x %x error=%x\n", pCS->dwExStyle, pCS->lpszName, VMSVGA3D_WNDCLASSNAME, pCS->style, pCS->x,
                                     pCS->y, pCS->cx, pCS->cy,pCS->hwndParent, pCS->hMenu, pCS->hInstance, GetLastError()));
 
                 /* Signal to the caller that we're done. */
@@ -340,8 +341,10 @@ uint32_t vmsvga3dSurfaceFormatSize(SVGA3dSurfaceFormat format)
         return 32;
     case SVGA3D_A16B16G16R16:
         return 8;
+
+    default:
+        AssertFailedReturn(4);
     }
-    AssertFailedReturn(4);
 }
 
 #ifdef LOG_ENABLED
@@ -579,7 +582,7 @@ const char *vmsvga3dGetRenderStateName(uint32_t state)
 {
     switch (state)
     {
-    case SVGA3D_RS_ZENABLE:                /* SVGA3dBool */            
+    case SVGA3D_RS_ZENABLE:                /* SVGA3dBool */
         return "SVGA3D_RS_ZENABLE";
     case SVGA3D_RS_ZWRITEENABLE:           /* SVGA3dBool */
         return "SVGA3D_RS_ZWRITEENABLE";
diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h
index 6e29143..b42881e 100644
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h
@@ -1,3 +1,4 @@
+/* $Id: DevVGA-SVGA3d-shared.h $ */
 /** @file
  * VMware SVGA device -- 3D part
  */
@@ -220,7 +221,7 @@ int vmsvga3dLoadExec(PVGASTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32
                 Assert(pMipmapLevel->cbSurface);
                 pMipmapLevel->pSurfaceData = RTMemAllocZ(pMipmapLevel->cbSurface);
                 AssertReturn(pMipmapLevel->pSurfaceData, VERR_NO_MEMORY);
-                
+
                 /* Fetch the data present boolean first. */
                 rc = SSMR3GetBool(pSSM, &fDataPresent);
                 AssertRCReturn(rc, rc);
@@ -574,7 +575,7 @@ int vmsvga3dSaveExec(PVGASTATE pThis, PSSMHANDLE pSSM)
                                                                     NULL,
                                                                     D3DLOCK_READONLY);
                             AssertMsgReturn(hr == D3D_OK, ("vmsvga3dSaveExec: LockRect failed with %x\n", hr), VERR_INTERNAL_ERROR);
-               
+
                             /* Copy the data one line at a time in case the internal pitch is different. */
                             for (uint32_t j = 0; j < pMipmapLevel->size.height; j++)
                             {
@@ -607,7 +608,7 @@ int vmsvga3dSaveExec(PVGASTATE pThis, PSSMHANDLE pSSM)
 
                             if (fVertex)
                                 hr = pSurface->u.pVertexBuffer->Lock(0, 0, (void **)&pD3DData, D3DLOCK_READONLY);
-                            else        
+                            else
                                 hr = pSurface->u.pIndexBuffer->Lock(0, 0, (void **)&pD3DData, D3DLOCK_READONLY);
                             AssertMsg(hr == D3D_OK, ("vmsvga3dSaveExec: Lock %s failed with %x\n", (fVertex) ? "vertex" : "index", hr));
 
@@ -699,8 +700,8 @@ int vmsvga3dSaveExec(PVGASTATE pThis, PSSMHANDLE pSSM)
 
                             glGetTexImage(GL_TEXTURE_2D,
                                           i,
-                                          pSurface->formatGL, 
-                                          pSurface->typeGL, 
+                                          pSurface->formatGL,
+                                          pSurface->typeGL,
                                           pData);
                             VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext);
 
diff --git a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
index 1c1e46b..9a67e1d 100644
--- a/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
@@ -1,3 +1,4 @@
+/* $Id: DevVGA-SVGA3d-win.cpp $ */
 /** @file
  * DevVMWare - VMWare SVGA device
  */
diff --git a/src/VBox/Devices/Graphics/DevVGA.cpp b/src/VBox/Devices/Graphics/DevVGA.cpp
index 83cf7c9..00c4f6e 100644
--- a/src/VBox/Devices/Graphics/DevVGA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA.cpp
@@ -117,6 +117,7 @@
 #include <VBox/vmm/pdmdev.h>
 #include <VBox/vmm/pgm.h>
 #ifdef IN_RING3
+# include <iprt/cdefs.h>
 # include <iprt/mem.h>
 # include <iprt/ctype.h>
 #endif /* IN_RING3 */
@@ -139,7 +140,6 @@
 # include <stdio.h> /* sscan */
 #endif
 
-#include "vl_vbox.h"
 #include "VBoxDD.h"
 #include "VBoxDD2.h"
 
@@ -262,6 +262,16 @@ typedef WINHDR *PWINHDR;
 #define LOGO_MAX_HEIGHT      480
 #define LOGO_MAX_SIZE        LOGO_MAX_WIDTH * LOGO_MAX_HEIGHT * 4
 
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+#ifndef IN_RING3
+RT_C_DECLS_BEGIN
+DECLEXPORT(FNPGMRZPHYSPFHANDLER)  vgaLbfAccessPfHandler;
+RT_C_DECLS_END
+#endif
+PGM_ALL_CB_DECL(FNPGMPHYSHANDLER) vgaLFBAccessHandler;
+
 
 /*******************************************************************************
 *   Global Variables                                                           *
@@ -1041,6 +1051,7 @@ static int vbe_ioport_write_data(PVGASTATE pThis, uint32_t addr, uint32_t val)
 #ifndef IN_RING3
             return VINF_IOM_R3_IOPORT_WRITE;
 #else
+        {
             if ((val & VBE_DISPI_ENABLED) &&
                 !(pThis->vbe_regs[VBE_DISPI_INDEX_ENABLE] & VBE_DISPI_ENABLED)) {
                 int h, shift_control;
@@ -1128,8 +1139,8 @@ static int vbe_ioport_write_data(PVGASTATE pThis, uint32_t addr, uint32_t val)
             }
             pThis->vbe_regs[pThis->vbe_index] = val;
             /*
-             * LFB video mode is either disabled or changed. This notification
-             * is used by the display to disable VBVA.
+             * LFB video mode is either disabled or changed. Notify the display
+             * and reset VBVA.
              */
             pThis->pDrv->pfnLFBModeChange(pThis->pDrv, (val & VBE_DISPI_ENABLED) != 0);
 #ifdef VBOX_WITH_HGSMI
@@ -1143,6 +1154,7 @@ static int vbe_ioport_write_data(PVGASTATE pThis, uint32_t addr, uint32_t val)
                 pThis->fRemappedVGA = false;
             }
             break;
+        }
 #endif /* IN_RING3 */
         case VBE_DISPI_INDEX_VIRT_WIDTH:
         case VBE_DISPI_INDEX_X_OFFSET:
@@ -1184,7 +1196,7 @@ static int vbe_ioport_write_data(PVGASTATE pThis, uint32_t addr, uint32_t val)
 #endif
 
 /* called for accesses between 0xa0000 and 0xc0000 */
-static uint32_t vga_mem_readb(PVGASTATE pThis, target_phys_addr_t addr, int *prc)
+static uint32_t vga_mem_readb(PVGASTATE pThis, RTGCPHYS addr, int *prc)
 {
     int memory_map_mode, plane;
     uint32_t ret;
@@ -1286,7 +1298,7 @@ static uint32_t vga_mem_readb(PVGASTATE pThis, target_phys_addr_t addr, int *prc
 }
 
 /* called for accesses between 0xa0000 and 0xc0000 */
-static int vga_mem_writeb(PVGASTATE pThis, target_phys_addr_t addr, uint32_t val)
+static int vga_mem_writeb(PVGASTATE pThis, RTGCPHYS addr, uint32_t val)
 {
     int memory_map_mode, plane, write_mode, b, func_select, mask;
     uint32_t write_mask, bit_mask, set_mask;
@@ -2077,7 +2089,9 @@ static int vga_resize_graphic(PVGASTATE pThis, int cx, int cy,
     AssertReturn(cx, VERR_INVALID_PARAMETER);
     AssertReturn(cy, VERR_INVALID_PARAMETER);
     AssertPtrReturn(pThis, VERR_INVALID_POINTER);
-    AssertReturn(pThis->line_offset, VERR_INTERNAL_ERROR);
+
+    if (!pThis->line_offset)
+        return VERR_INTERNAL_ERROR;
 
 #if 0 //def VBOX_WITH_VDMA
     /** @todo: we get a second resize here when VBVA is on, while we actually should not */
@@ -2185,7 +2199,7 @@ int vgaR3UpdateDisplay(VGAState *s, unsigned xStart, unsigned yStart, unsigned w
     uint8_t *dest = s->pDrv->pu8Data      + offsetDest;
     uint8_t *src  = s->CTX_SUFF(vram_ptr) + offsetSource;
 
-    for(unsigned y = yStart; y < yStart + height; y++) 
+    for(unsigned y = yStart; y < yStart + height; y++)
     {
         vga_draw_line(s, dest, src, width);
 
@@ -2259,7 +2273,7 @@ static int vmsvga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnRe
     d = pDrv->pu8Data;
     linesize = pDrv->cbScanline;
 
-    for(y = 0; y < height; y++) 
+    for(y = 0; y < height; y++)
     {
         addr = addr1 + y * bwidth;
 
@@ -2403,6 +2417,22 @@ static int vga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResiz
             return rc;
         full_update = true;
     }
+
+    if (pThis->fRenderVRAM)
+    {
+        /* Do not update the destination buffer if it is not big enough.
+         * Can happen if the resize request was ignored by the driver.
+         */
+        if (   pDrv->cx != (uint32_t)width
+            || pDrv->cy != (uint32_t)height)
+        {
+            LogRel(("Framebuffer mismatch: vga %dx%d, drv %dx%d!!!\n",
+                    width, height,
+                    pDrv->cx, pDrv->cy));
+            return VINF_SUCCESS;
+        }
+    }
+
     vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(pDrv->cBits)];
 
     if (pThis->cursor_invalidate)
@@ -2434,12 +2464,12 @@ static int vga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResiz
         if (!(pThis->cr[0x17] & 2)) {
             addr = (addr & ~(1 << 16)) | ((y1 & 2) << 15);
         }
-        page0 = addr & TARGET_PAGE_MASK;
-        page1 = (addr + bwidth - 1) & TARGET_PAGE_MASK;
+        page0 = addr & ~PAGE_OFFSET_MASK;
+        page1 = (addr + bwidth - 1) & ~PAGE_OFFSET_MASK;
         bool update = full_update | vga_is_dirty(pThis, page0) | vga_is_dirty(pThis, page1);
-        if (page1 - page0 > TARGET_PAGE_SIZE) {
+        if (page1 - page0 > PAGE_SIZE) {
             /* if wide line, can use another page */
-            update |= vga_is_dirty(pThis, page0 + TARGET_PAGE_SIZE);
+            update |= vga_is_dirty(pThis, page0 + PAGE_SIZE);
         }
         /* explicit invalidation for the hardware cursor */
         update |= (pThis->invalidated_y_table[y >> 5] >> (y & 0x1f)) & 1;
@@ -2485,7 +2515,7 @@ static int vga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResiz
     }
     /* reset modified pages */
     if (page_max != -1 && reset_dirty) {
-        vga_reset_dirty(pThis, page_min, page_max + TARGET_PAGE_SIZE);
+        vga_reset_dirty(pThis, page_min, page_max + PAGE_SIZE);
     }
     memset(pThis->invalidated_y_table, 0, ((height + 31) >> 5) * 4);
     return VINF_SUCCESS;
@@ -2588,16 +2618,16 @@ static int vga_update_display(PVGASTATE pThis, bool fUpdateAll, bool fFailOnResi
 #ifdef VBOX_WITH_VMSVGA
             if (pThis->svga.fEnabled) {
                 *pcur_graphic_mode = GMODE_SVGA;
-                rc = vmsvga_draw_graphic(pThis, 1, false, reset_dirty, pDrv);
+                rc = vmsvga_draw_graphic(pThis, 1, fFailOnResize, reset_dirty, pDrv);
             }
             else
 #endif
             if (pThis->gr[6] & 1) {
                 *pcur_graphic_mode = GMODE_GRAPH;
-                rc = vga_draw_graphic(pThis, 1, false, reset_dirty, pDrv);
+                rc = vga_draw_graphic(pThis, 1, fFailOnResize, reset_dirty, pDrv);
             } else {
                 *pcur_graphic_mode = GMODE_TEXT;
-                rc = vga_draw_text(pThis, 1, false, reset_dirty, pDrv);
+                rc = vga_draw_text(pThis, 1, fFailOnResize, reset_dirty, pDrv);
             }
 
             if (fBlank) {
@@ -2646,89 +2676,91 @@ static int vga_update_display(PVGASTATE pThis, bool fUpdateAll, bool fFailOnResi
     return rc;
 }
 
-static void vga_save(QEMUFile *f, PVGASTATE pThis)
+static void vga_save(PSSMHANDLE pSSM, PVGASTATE pThis)
 {
     int i;
 
-    qemu_put_be32s(f, &pThis->latch);
-    qemu_put_8s(f, &pThis->sr_index);
-    qemu_put_buffer(f, pThis->sr, 8);
-    qemu_put_8s(f, &pThis->gr_index);
-    qemu_put_buffer(f, pThis->gr, 16);
-    qemu_put_8s(f, &pThis->ar_index);
-    qemu_put_buffer(f, pThis->ar, 21);
-    qemu_put_be32s(f, &pThis->ar_flip_flop);
-    qemu_put_8s(f, &pThis->cr_index);
-    qemu_put_buffer(f, pThis->cr, 256);
-    qemu_put_8s(f, &pThis->msr);
-    qemu_put_8s(f, &pThis->fcr);
-    qemu_put_8s(f, &pThis->st00);
-    qemu_put_8s(f, &pThis->st01);
-
-    qemu_put_8s(f, &pThis->dac_state);
-    qemu_put_8s(f, &pThis->dac_sub_index);
-    qemu_put_8s(f, &pThis->dac_read_index);
-    qemu_put_8s(f, &pThis->dac_write_index);
-    qemu_put_buffer(f, pThis->dac_cache, 3);
-    qemu_put_buffer(f, pThis->palette, 768);
-
-    qemu_put_be32s(f, &pThis->bank_offset);
+    SSMR3PutU32(pSSM, pThis->latch);
+    SSMR3PutU8(pSSM, pThis->sr_index);
+    SSMR3PutMem(pSSM, pThis->sr, 8);
+    SSMR3PutU8(pSSM, pThis->gr_index);
+    SSMR3PutMem(pSSM, pThis->gr, 16);
+    SSMR3PutU8(pSSM, pThis->ar_index);
+    SSMR3PutMem(pSSM, pThis->ar, 21);
+    SSMR3PutU32(pSSM, pThis->ar_flip_flop);
+    SSMR3PutU8(pSSM, pThis->cr_index);
+    SSMR3PutMem(pSSM, pThis->cr, 256);
+    SSMR3PutU8(pSSM, pThis->msr);
+    SSMR3PutU8(pSSM, pThis->fcr);
+    SSMR3PutU8(pSSM, pThis->st00);
+    SSMR3PutU8(pSSM, pThis->st01);
+
+    SSMR3PutU8(pSSM, pThis->dac_state);
+    SSMR3PutU8(pSSM, pThis->dac_sub_index);
+    SSMR3PutU8(pSSM, pThis->dac_read_index);
+    SSMR3PutU8(pSSM, pThis->dac_write_index);
+    SSMR3PutMem(pSSM, pThis->dac_cache, 3);
+    SSMR3PutMem(pSSM, pThis->palette, 768);
+
+    SSMR3PutU32(pSSM, pThis->bank_offset);
 #ifdef CONFIG_BOCHS_VBE
-    qemu_put_byte(f, 1);
-    qemu_put_be16s(f, &pThis->vbe_index);
+    SSMR3PutU8(pSSM, 1);
+    SSMR3PutU16(pSSM, pThis->vbe_index);
     for(i = 0; i < VBE_DISPI_INDEX_NB_SAVED; i++)
-        qemu_put_be16s(f, &pThis->vbe_regs[i]);
-    qemu_put_be32s(f, &pThis->vbe_start_addr);
-    qemu_put_be32s(f, &pThis->vbe_line_offset);
+        SSMR3PutU16(pSSM, pThis->vbe_regs[i]);
+    SSMR3PutU32(pSSM, pThis->vbe_start_addr);
+    SSMR3PutU32(pSSM, pThis->vbe_line_offset);
 #else
-    qemu_put_byte(f, 0);
+    SSMR3PutU8(pSSM, 0);
 #endif
 }
 
-static int vga_load(QEMUFile *f, PVGASTATE pThis, int version_id)
+static int vga_load(PSSMHANDLE pSSM, PVGASTATE pThis, int version_id)
 {
     int is_vbe, i;
     uint32_t u32Dummy;
-
-    qemu_get_be32s(f, &pThis->latch);
-    qemu_get_8s(f, &pThis->sr_index);
-    qemu_get_buffer(f, pThis->sr, 8);
-    qemu_get_8s(f, &pThis->gr_index);
-    qemu_get_buffer(f, pThis->gr, 16);
-    qemu_get_8s(f, &pThis->ar_index);
-    qemu_get_buffer(f, pThis->ar, 21);
-    qemu_get_be32s(f, (uint32_t *)&pThis->ar_flip_flop);
-    qemu_get_8s(f, &pThis->cr_index);
-    qemu_get_buffer(f, pThis->cr, 256);
-    qemu_get_8s(f, &pThis->msr);
-    qemu_get_8s(f, &pThis->fcr);
-    qemu_get_8s(f, &pThis->st00);
-    qemu_get_8s(f, &pThis->st01);
-
-    qemu_get_8s(f, &pThis->dac_state);
-    qemu_get_8s(f, &pThis->dac_sub_index);
-    qemu_get_8s(f, &pThis->dac_read_index);
-    qemu_get_8s(f, &pThis->dac_write_index);
-    qemu_get_buffer(f, pThis->dac_cache, 3);
-    qemu_get_buffer(f, pThis->palette, 768);
-
-    qemu_get_be32s(f, (uint32_t *)&pThis->bank_offset);
-    is_vbe = qemu_get_byte(f);
+    uint8_t u8;
+
+    SSMR3GetU32(pSSM, &pThis->latch);
+    SSMR3GetU8(pSSM, &pThis->sr_index);
+    SSMR3GetMem(pSSM, pThis->sr, 8);
+    SSMR3GetU8(pSSM, &pThis->gr_index);
+    SSMR3GetMem(pSSM, pThis->gr, 16);
+    SSMR3GetU8(pSSM, &pThis->ar_index);
+    SSMR3GetMem(pSSM, pThis->ar, 21);
+    SSMR3GetU32(pSSM, (uint32_t *)&pThis->ar_flip_flop);
+    SSMR3GetU8(pSSM, &pThis->cr_index);
+    SSMR3GetMem(pSSM, pThis->cr, 256);
+    SSMR3GetU8(pSSM, &pThis->msr);
+    SSMR3GetU8(pSSM, &pThis->fcr);
+    SSMR3GetU8(pSSM, &pThis->st00);
+    SSMR3GetU8(pSSM, &pThis->st01);
+
+    SSMR3GetU8(pSSM, &pThis->dac_state);
+    SSMR3GetU8(pSSM, &pThis->dac_sub_index);
+    SSMR3GetU8(pSSM, &pThis->dac_read_index);
+    SSMR3GetU8(pSSM, &pThis->dac_write_index);
+    SSMR3GetMem(pSSM, pThis->dac_cache, 3);
+    SSMR3GetMem(pSSM, pThis->palette, 768);
+
+    SSMR3GetU32(pSSM, (uint32_t *)&pThis->bank_offset);
+    SSMR3GetU8(pSSM, &u8);
+    is_vbe = !!u8;
 #ifdef CONFIG_BOCHS_VBE
     if (!is_vbe)
     {
         Log(("vga_load: !is_vbe !!\n"));
         return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
     }
-    qemu_get_be16s(f, &pThis->vbe_index);
+    SSMR3GetU16(pSSM, &pThis->vbe_index);
     for(i = 0; i < VBE_DISPI_INDEX_NB_SAVED; i++)
-        qemu_get_be16s(f, &pThis->vbe_regs[i]);
+        SSMR3GetU16(pSSM, &pThis->vbe_regs[i]);
     if (version_id <= VGA_SAVEDSTATE_VERSION_INV_VHEIGHT)
         recalculate_data(pThis, false); /* <- re-calculate the pThis->vbe_regs[VBE_DISPI_INDEX_VIRT_HEIGHT] since it might be invalid */
-    qemu_get_be32s(f, &pThis->vbe_start_addr);
-    qemu_get_be32s(f, &pThis->vbe_line_offset);
+    SSMR3GetU32(pSSM, &pThis->vbe_start_addr);
+    SSMR3GetU32(pSSM, &pThis->vbe_line_offset);
     if (version_id < 2)
-        qemu_get_be32s(f, &u32Dummy);
+        SSMR3GetU32(pSSM, &u32Dummy);
     pThis->vbe_bank_max = (pThis->vram_size >> 16) - 1;
 #else
     if (is_vbe)
@@ -3501,11 +3533,12 @@ static int vgaLFBAccess(PVM pVM, PVGASTATE pThis, RTGCPHYS GCPhys, RTGCPTR GCPtr
 }
 
 
-#ifdef IN_RC
+#ifndef IN_RING3
 /**
  * @callback_method_impl{FNPGMRCPHYSHANDLER, \#PF Handler for VBE LFB access.}
  */
-PDMBOTHCBDECL(int) vgaRCLFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
+PDMBOTHCBDECL(int) vgaLbfAccessPfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                         RTGCPHYS GCPhysFault, void *pvUser)
 {
     PVGASTATE   pThis = (PVGASTATE)pvUser;
     AssertPtr(pThis);
@@ -3515,35 +3548,20 @@ PDMBOTHCBDECL(int) vgaRCLFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXC
 
     return vgaLFBAccess(pVM, pThis, GCPhysFault, pvFault);
 }
+#endif /* !IN_RING3 */
 
-#elif IN_RING0
-
-/**
- * @callback_method_impl{FNPGMR0PHYSHANDLER, \#PF Handler for VBE LFB access.}
- */
-PDMBOTHCBDECL(int) vgaR0LFBAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
-{
-    PVGASTATE   pThis = (PVGASTATE)pvUser;
-    Assert(pThis);
-    Assert(GCPhysFault >= pThis->GCPhysVRAM);
-    AssertMsg(uErrorCode & X86_TRAP_PF_RW, ("uErrorCode=%#x\n", uErrorCode));
-    NOREF(pRegFrame);
-
-    return vgaLFBAccess(pVM, pThis, GCPhysFault, pvFault);
-}
-
-#else /* IN_RING3 */
 
 /**
- * @callback_method_impl{FNPGMR3PHYSHANDLER, HC access handler for the LFB.}
+ * @callback_method_impl{FNPGMPHYSHANDLER, HC access handler for the LFB.}
  */
-static DECLCALLBACK(int) vgaR3LFBAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser)
+PGM_ALL_CB_DECL(int) vgaLFBAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                         PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     PVGASTATE   pThis = (PVGASTATE)pvUser;
     int         rc;
     Assert(pThis);
     Assert(GCPhys >= pThis->GCPhysVRAM);
-    NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmAccessType);
+    NOREF(pVCpu); NOREF(pvPhys); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmAccessType); NOREF(enmOrigin);
 
     rc = vgaLFBAccess(pVM, pThis, GCPhys, 0);
     if (RT_SUCCESS(rc))
@@ -3551,7 +3569,7 @@ static DECLCALLBACK(int) vgaR3LFBAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *p
     AssertMsg(rc <= VINF_SUCCESS, ("rc=%Rrc\n", rc));
     return rc;
 }
-#endif /* IN_RING3 */
+
 
 /* -=-=-=-=-=- All rings: VGA BIOS I/Os -=-=-=-=-=- */
 
@@ -3888,7 +3906,7 @@ static void vbeShowBitmap(uint16_t cBits, uint16_t xLogo, uint16_t yLogo, uint16
                         *pu8TmpPtr++ = pix * iStep / LOGO_SHOW_STEPS;
                         *pu8TmpPtr++ = pix * iStep / LOGO_SHOW_STEPS;
                         *pu8TmpPtr++ = pix * iStep / LOGO_SHOW_STEPS;
-                        *pu8TmpPtr++;
+                        pu8TmpPtr++;
                     }
                     else
                     {
@@ -3915,7 +3933,7 @@ static void vbeShowBitmap(uint16_t cBits, uint16_t xLogo, uint16_t yLogo, uint16
                     *pu8TmpPtr++ = pix * iStep / LOGO_SHOW_STEPS;
                     pix = u32Pal & 0xFF;
                     *pu8TmpPtr++ = pix * iStep / LOGO_SHOW_STEPS;
-                    *pu8TmpPtr++;
+                    pu8TmpPtr++;
 
                     j = (j + 1) % 2;
                     break;
@@ -3931,7 +3949,7 @@ static void vbeShowBitmap(uint16_t cBits, uint16_t xLogo, uint16_t yLogo, uint16
                     *pu8TmpPtr++ = pix * iStep / LOGO_SHOW_STEPS;
                     pix = u32Pal & 0xFF;
                     *pu8TmpPtr++ = pix * iStep / LOGO_SHOW_STEPS;
-                    *pu8TmpPtr++;
+                    pu8TmpPtr++;
                     break;
                 }
 
@@ -3939,7 +3957,7 @@ static void vbeShowBitmap(uint16_t cBits, uint16_t xLogo, uint16_t yLogo, uint16
                     *pu8TmpPtr++ = *pu8Src++ * iStep / LOGO_SHOW_STEPS;
                     *pu8TmpPtr++ = *pu8Src++ * iStep / LOGO_SHOW_STEPS;
                     *pu8TmpPtr++ = *pu8Src++ * iStep / LOGO_SHOW_STEPS;
-                    *pu8TmpPtr++;
+                    pu8TmpPtr++;
                     break;
             }
         }
@@ -4153,10 +4171,13 @@ static DECLCALLBACK(void) vgaInfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, c
         pHlp->pfnPrintf(pHlp, "vsync start : %d px, end: %d px\n", r->vs_start, r->vs_end);
         pHlp->pfnPrintf(pHlp, "cclks per frame: %d\n", r->frame_cclks);
         pHlp->pfnPrintf(pHlp, "cclk time (ns) : %d\n", r->cclk_ns);
-        vfreq_hz = 1000000000 / r->frame_ns;
-        hfreq_hz = 1000000000 / r->h_total_ns;
-        pHlp->pfnPrintf(pHlp, "vfreq: %d Hz, hfreq: %d.%03d kHz\n",
-                        vfreq_hz, hfreq_hz / 1000, hfreq_hz % 1000);
+        if (r->frame_ns && r->h_total_ns)   /* Careful in case state is temporarily invalid. */
+        {
+            vfreq_hz = 1000000000 / r->frame_ns;
+            hfreq_hz = 1000000000 / r->h_total_ns;
+            pHlp->pfnPrintf(pHlp, "vfreq: %d Hz, hfreq: %d.%03d kHz\n",
+                            vfreq_hz, hfreq_hz / 1000, hfreq_hz % 1000);
+        }
     }
     pHlp->pfnPrintf(pHlp, "display refresh interval: %u ms\n", pThis->cMilliesRefreshInterval);
 
@@ -4512,9 +4533,41 @@ static DECLCALLBACK(void *) vgaPortQueryInterface(PPDMIBASE pInterface, const ch
 #if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI))
     PDMIBASE_RETURN_INTERFACE(pszIID, PDMIDISPLAYVBVACALLBACKS, &pThis->IVBVACallbacks);
 #endif
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds);
     return NULL;
 }
 
+/* -=-=-=-=-=- Ring 3: ILeds -=-=-=-=-=- */
+#define ILEDPORTS_2_VGASTATE(pInterface) ( (PVGASTATE)((uintptr_t)pInterface - RT_OFFSETOF(VGASTATE, ILeds)) )
+
+/**
+ * Gets the pointer to the status LED of a unit.
+ *
+ * @returns VBox status code.
+ * @param   pInterface      Pointer to the interface structure containing the called function pointer.
+ * @param   iLUN            The unit which status LED we desire.
+ * @param   ppLed           Where to store the LED pointer.
+ */
+static DECLCALLBACK(int) vgaPortQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed)
+{
+    PVGASTATE pThis = ILEDPORTS_2_VGASTATE(pInterface);
+    switch (iLUN)
+    {
+        /* LUN #0: Display port. */
+        case 0:
+        {
+            *ppLed = &pThis->Led3D;
+            Assert((*ppLed)->u32Magic == PDMLED_MAGIC);
+            return VINF_SUCCESS;
+        }
+
+        default:
+            AssertMsgFailed(("Invalid LUN #%d\n", iLUN));
+            return VERR_PDM_NO_SUCH_LUN;
+    }
+
+    return VERR_PDM_LUN_NOT_FOUND;
+}
 
 /* -=-=-=-=-=- Ring 3: Dummy IDisplayConnector -=-=-=-=-=- */
 
@@ -4634,7 +4687,7 @@ static DECLCALLBACK(int) vgaPortUpdateDisplay(PPDMIDISPLAYPORT pInterface)
 /**
  * Internal vgaPortUpdateDisplayAll worker called under pThis->CritSect.
  */
-static int updateDisplayAll(PVGASTATE pThis)
+static int updateDisplayAll(PVGASTATE pThis, bool fFailOnResize)
 {
     PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);
 
@@ -4657,12 +4710,12 @@ static int updateDisplayAll(PVGASTATE pThis)
 
     pThis->graphic_mode = -1; /* force full update */
 
-    return vga_update_display(pThis, true, false, true,
+    return vga_update_display(pThis, true, fFailOnResize, true,
             pThis->pDrv, &pThis->graphic_mode);
 }
 
 
-int vgaUpdateDisplayAll(PVGASTATE pThis)
+DECLCALLBACK(int) vgaUpdateDisplayAll(PVGASTATE pThis, bool fFailOnResize)
 {
 #ifdef DEBUG_sunlover
     LogFlow(("vgaPortUpdateDisplayAll\n"));
@@ -4671,7 +4724,7 @@ int vgaUpdateDisplayAll(PVGASTATE pThis)
     int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
     AssertRC(rc);
 
-    rc = updateDisplayAll(pThis);
+    rc = updateDisplayAll(pThis, fFailOnResize);
 
     PDMCritSectLeave(&pThis->CritSect);
     return rc;
@@ -4683,14 +4736,14 @@ int vgaUpdateDisplayAll(PVGASTATE pThis)
  * @param   pInterface          Pointer to this interface.
  * @see     PDMIKEYBOARDPORT::pfnUpdateDisplayAll() for details.
  */
-static DECLCALLBACK(int) vgaPortUpdateDisplayAll(PPDMIDISPLAYPORT pInterface)
+static DECLCALLBACK(int) vgaPortUpdateDisplayAll(PPDMIDISPLAYPORT pInterface, bool fFailOnResize)
 {
     PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
     PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis));
 
     /* This is called both in VBVA mode and normal modes. */
 
-    return vgaUpdateDisplayAll(pThis);
+    return vgaUpdateDisplayAll(pThis, fFailOnResize);
 }
 
 
@@ -4713,14 +4766,18 @@ static DECLCALLBACK(int) vgaPortSetRefreshRate(PPDMIDISPLAYPORT pInterface, uint
 }
 
 
-/** @copydoc PDMIDISPLAYPORT::pfnQueryColorDepth */
-static DECLCALLBACK(int) vgaPortQueryColorDepth(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits)
+/** @copydoc PDMIDISPLAYPORT::pfnQueryVideoMode */
+static DECLCALLBACK(int) vgaPortQueryVideoMode(PPDMIDISPLAYPORT pInterface, uint32_t *pcBits, uint32_t *pcx, uint32_t *pcy)
 {
     PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface);
 
     if (!pcBits)
         return VERR_INVALID_PARAMETER;
     *pcBits = vga_get_bpp(pThis);
+    if (pcx)
+        *pcx = pThis->last_scr_width;
+    if (pcy)
+        *pcy = pThis->last_scr_height;
     return VINF_SUCCESS;
 }
 
@@ -4962,8 +5019,9 @@ static DECLCALLBACK(void) vgaPortUpdateDisplayRect(PPDMIDISPLAYPORT pInterface,
 #endif /* DEBUG_sunlover */
 
     Assert(pInterface);
-    Assert(pThis->pDrv);
-    Assert(pThis->pDrv->pu8Data);
+
+    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
+    AssertRC(rc);
 
     /* Check if there is something to do at all. */
     if (!pThis->fRenderVRAM)
@@ -4972,11 +5030,12 @@ static DECLCALLBACK(void) vgaPortUpdateDisplayRect(PPDMIDISPLAYPORT pInterface,
 #ifdef DEBUG_sunlover
         LogFlow(("vgaPortUpdateDisplayRect: nothing to do fRender is false.\n"));
 #endif /* DEBUG_sunlover */
+        PDMCritSectLeave(&pThis->CritSect);
         return;
     }
 
-    int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
-    AssertRC(rc);
+    Assert(pThis->pDrv);
+    Assert(pThis->pDrv->pu8Data);
 
     /* Correct negative x and y coordinates. */
     if (x < 0)
@@ -5293,16 +5352,13 @@ static DECLCALLBACK(void) vgaTimerRefresh(PPDMDEVINS pDevIns, PTMTIMER pTimer, v
 int vgaR3RegisterVRAMHandler(PVGASTATE pVGAState, uint64_t cbFrameBuffer)
 {
     PPDMDEVINS pDevIns = pVGAState->pDevInsR3;
-
     Assert(pVGAState->GCPhysVRAM);
 
-    int rc = PGMR3HandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns),
-                                          PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
-                                          pVGAState->GCPhysVRAM, pVGAState->GCPhysVRAM + (cbFrameBuffer - 1),
-                                          vgaR3LFBAccessHandler, pVGAState,
-                                          g_DeviceVga.szR0Mod, "vgaR0LFBAccessHandler", pDevIns->pvInstanceDataR0,
-                                          g_DeviceVga.szRCMod, "vgaGCLFBAccessHandler", pDevIns->pvInstanceDataRC,
-                                          "VGA LFB");
+    int rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns),
+                                        pVGAState->GCPhysVRAM, pVGAState->GCPhysVRAM + (cbFrameBuffer - 1),
+                                        pVGAState->hLfbAccessHandlerType, pVGAState, pDevIns->pvInstanceDataR0,
+                                        pDevIns->pvInstanceDataRC, "VGA LFB");
+
     AssertRC(rc);
     return rc;
 }
@@ -5338,11 +5394,14 @@ static DECLCALLBACK(int) vgaR3IORegionMap(PPCIDEVICE pPciDev, /*unsigned*/ int i
     PVGASTATE   pThis = PDMINS_2_DATA(pDevIns, PVGASTATE);
     Log(("vgaR3IORegionMap: iRegion=%d GCPhysAddress=%RGp cb=%#x enmType=%d\n", iRegion, GCPhysAddress, cb, enmType));
 #ifdef VBOX_WITH_VMSVGA
-    AssertReturn((iRegion == ((pThis->fVMSVGAEnabled) ? 1 : 0)) && (enmType == ((pThis->fVMSVGAEnabled) ? PCI_ADDRESS_SPACE_MEM : PCI_ADDRESS_SPACE_MEM_PREFETCH)), VERR_INTERNAL_ERROR);    
+    AssertReturn((iRegion == ((pThis->fVMSVGAEnabled) ? 1 : 0)) && (enmType == ((pThis->fVMSVGAEnabled) ? PCI_ADDRESS_SPACE_MEM : PCI_ADDRESS_SPACE_MEM_PREFETCH)), VERR_INTERNAL_ERROR);
 #else
     AssertReturn(iRegion == 0 && enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH, VERR_INTERNAL_ERROR);
 #endif
 
+    rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY);
+    AssertRC(rc);
+
     if (GCPhysAddress != NIL_RTGCPHYS)
     {
         /*
@@ -5352,13 +5411,9 @@ static DECLCALLBACK(int) vgaR3IORegionMap(PPCIDEVICE pPciDev, /*unsigned*/ int i
         AssertRC(rc);
         if (RT_SUCCESS(rc))
         {
-            rc = PGMR3HandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns),
-                                              PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
-                                              GCPhysAddress, GCPhysAddress + (pThis->vram_size - 1),
-                                              vgaR3LFBAccessHandler, pThis,
-                                              g_DeviceVga.szR0Mod, "vgaR0LFBAccessHandler", pDevIns->pvInstanceDataR0,
-                                              g_DeviceVga.szRCMod, "vgaRCLFBAccessHandler", pDevIns->pvInstanceDataRC,
-                                              "VGA LFB");
+            rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns), GCPhysAddress, GCPhysAddress + (pThis->vram_size - 1),
+                                            pThis->hLfbAccessHandlerType, pThis, pDevIns->pvInstanceDataR0,
+                                            pDevIns->pvInstanceDataRC, "VGA LFB");
             AssertRC(rc);
             if (RT_SUCCESS(rc))
             {
@@ -5393,6 +5448,7 @@ static DECLCALLBACK(int) vgaR3IORegionMap(PPCIDEVICE pPciDev, /*unsigned*/ int i
         pThis->GCPhysVRAM = 0;
         /* NB: VBE_DISPI_INDEX_FB_BASE_HI is left unchanged here. */
     }
+    PDMCritSectLeave(&pThis->CritSect);
     return rc;
 }
 
@@ -6055,7 +6111,7 @@ static DECLCALLBACK(int)   vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF
 
     pThis->IPort.pfnUpdateDisplay       = vgaPortUpdateDisplay;
     pThis->IPort.pfnUpdateDisplayAll    = vgaPortUpdateDisplayAll;
-    pThis->IPort.pfnQueryColorDepth     = vgaPortQueryColorDepth;
+    pThis->IPort.pfnQueryVideoMode      = vgaPortQueryVideoMode;
     pThis->IPort.pfnSetRefreshRate      = vgaPortSetRefreshRate;
     pThis->IPort.pfnTakeScreenshot      = vgaPortTakeScreenshot;
     pThis->IPort.pfnFreeScreenshot      = vgaPortFreeScreenshot;
@@ -6085,14 +6141,14 @@ static DECLCALLBACK(int)   vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF
 # endif
 #endif
 
-//    pThis->ILeds.pfnQueryStatusLed = vgaPortQueryStatusLed;
+    pThis->ILeds.pfnQueryStatusLed = vgaPortQueryStatusLed;
 
     RT_ZERO(pThis->Led3D);
     pThis->Led3D.u32Magic = PDMLED_MAGIC;
 
     /*
      * We use our own critical section to avoid unncessary pointer indirections
-     * in interface methods (as we all as for historical reasons).
+     * in interface methods (as well as for historical reasons).
      */
     rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSect, RT_SRC_POS, "VGA#%u", iInstance);
     AssertRCReturn(rc, rc);
@@ -6155,6 +6211,17 @@ static DECLCALLBACK(int)   vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF
 #endif
 
     /*
+     * Register access handler types.
+     */
+    rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE,
+                                          vgaLFBAccessHandler,
+                                          g_DeviceVga.szR0Mod, "vgaLbfAccessPfHandler",
+                                          g_DeviceVga.szRCMod, "vgaLbfAccessPfHandler",
+                                          "VGA LFB", &pThis->hLfbAccessHandlerType);
+    AssertRCReturn(rc, rc);
+
+
+    /*
      * Register I/O ports.
      */
     rc = PDMDevHlpIOPortRegister(pDevIns,  0x3c0, 16, NULL, vgaIOPortWrite,       vgaIOPortRead, NULL, NULL,      "VGA - 3c0");
@@ -6571,7 +6638,7 @@ static DECLCALLBACK(int)   vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF
 
                 cParams = sscanf(pszExtraData, "%ux%ux%u", &cx, &cy, &cBits);
                 if (    cParams != 3
-                    ||  (cBits != 16 && cBits != 24 && cBits != 32))
+                    ||  (cBits != 8 && cBits != 16 && cBits != 24 && cBits != 32))
                 {
                     AssertMsgFailed(("Configuration error: Invalid mode data '%s' for '%s'! cBits=%d\n", pszExtraData, szExtraDataKey, cBits));
                     return VERR_VGA_INVALID_CUSTOM_MODE;
@@ -6590,6 +6657,10 @@ static DECLCALLBACK(int)   vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF
                 /* Use defaults from max at bpp mode. */
                 switch (cBits)
                 {
+                    case 8:
+                        u16DefMode = VBE_VESA_MODE_1024X768X8;
+                        break;
+
                     case 16:
                         u16DefMode = VBE_VESA_MODE_1024X768X565;
                         break;
@@ -6850,6 +6921,31 @@ static DECLCALLBACK(int)   vgaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCF
 
     /* Init latched access mask. */
     pThis->uMaskLatchAccess = 0x3ff;
+
+    if (RT_SUCCESS(rc))
+    {
+        PPDMIBASE  pBase;
+        /*
+         * Attach status driver (optional).
+         */
+        rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis->IBase, &pBase, "Status Port");
+        AssertRC(rc);
+        if (RT_SUCCESS(rc))
+        {
+            pThis->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);
+            pThis->pMediaNotify = PDMIBASE_QUERY_INTERFACE(pBase, PDMIMEDIANOTIFY);
+        }
+        else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
+        {
+            Log(("%s/%d: warning: no driver attached to LUN #0!\n", pDevIns->pReg->szName, pDevIns->iInstance));
+            rc = VINF_SUCCESS;
+        }
+        else
+        {
+            AssertMsgFailed(("Failed to attach to status driver. rc=%Rrc\n", rc));
+            rc = PDMDEV_SET_ERROR(pDevIns, rc, N_("VGA cannot attach to status driver"));
+        }
+    }
     return rc;
 }
 
diff --git a/src/VBox/Devices/Graphics/DevVGA.h b/src/VBox/Devices/Graphics/DevVGA.h
index 4040742..a5b5811 100644
--- a/src/VBox/Devices/Graphics/DevVGA.h
+++ b/src/VBox/Devices/Graphics/DevVGA.h
@@ -317,6 +317,12 @@ typedef struct
     /** External command to be executed in the FIFO thread. */
     uint8_t                     u8FIFOExtCommand;
     bool                        Padding6;
+# if defined(DEBUG_GMR_ACCESS) || defined(DEBUG_FIFO_ACCESS)
+    /** GMR debug access handler type handle. */
+    PGMPHYSHANDLERTYPE          hGmrAccessHandlerType;
+    /** FIFO debug access handler type handle. */
+    PGMPHYSHANDLERTYPE          hFifoAccessHandlerType;
+# endif
 } VMSVGAState;
 #endif /* VBOX_WITH_VMSVGA */
 
@@ -399,18 +405,25 @@ typedef struct VGAState {
     PDMIBASE                    IBase;
     /** LUN\#0: The display port interface. */
     PDMIDISPLAYPORT             IPort;
-# if HC_ARCH_BITS == 32
-    uint32_t                    PaddingIPort;
-# endif
 # if defined(VBOX_WITH_HGSMI) && (defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_WITH_CRHGSMI))
     /** LUN\#0: VBVA callbacks interface */
     PDMIDISPLAYVBVACALLBACKS    IVBVACallbacks;
+# else
+    RTR3PTR                     Padding2;
 # endif
+    /** Status LUN\#0: Leds interface. */
+    PDMILEDPORTS                ILeds;
+
     /** Pointer to base interface of the driver. */
     R3PTRTYPE(PPDMIBASE)        pDrvBase;
     /** Pointer to display connector interface of the driver. */
     R3PTRTYPE(PPDMIDISPLAYCONNECTOR) pDrv;
 
+    /** Status LUN: Partner of ILeds. */
+    R3PTRTYPE(PPDMILEDCONNECTORS)   pLedsConnector;
+    /** Status LUN: Media Notifys. */
+    R3PTRTYPE(PPDMIMEDIANOTIFY)     pMediaNotify;
+
     /** Refresh timer handle - HC. */
     PTMTIMERR3                  RefreshTimer;
 
@@ -448,11 +461,14 @@ typedef struct VGAState {
 #ifdef VBOX_WITH_VMSVGA
     /* Whether the SVGA emulation is enabled or not. */
     bool                        fVMSVGAEnabled;
-    bool                        Padding1[1];
+    bool                        Padding1[1+4];
 #else
-    bool                        Padding1[2];
+    bool                        Padding1[2+4];
 #endif
 
+    /** Physical access type for the linear frame buffer dirty page tracking. */
+    PGMPHYSHANDLERTYPE          hLfbAccessHandlerType;
+
     /** The physical address the VRAM was assigned. */
     RTGCPHYS                    GCPhysVRAM;
     /** The critical section protect the instance data. */
@@ -644,8 +660,8 @@ bool VBVAIsEnabled(PVGASTATE pVGAState);
 void VBVARaiseIrq (PVGASTATE pVGAState, uint32_t fFlags);
 void VBVARaiseIrqNoWait(PVGASTATE pVGAState, uint32_t fFlags);
 
-int VBVAInfoView(PVGASTATE pVGAState, VBVAINFOVIEW *pView);
-int VBVAInfoScreen(PVGASTATE pVGAState, VBVAINFOSCREEN *pScreen);
+int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW *pView);
+int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN *pScreen);
 int VBVAGetInfoViewAndScreen(PVGASTATE pVGAState, uint32_t u32ViewIndex, VBVAINFOVIEW *pView, VBVAINFOSCREEN *pScreen);
 
 /* @return host-guest flags that were set on reset
@@ -683,7 +699,7 @@ int vboxVBVASaveStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
 int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Version);
 int vboxVBVALoadStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM);
 
-int vgaUpdateDisplayAll(PVGASTATE pThis);
+DECLCALLBACK(int) vgaUpdateDisplayAll(PVGASTATE pThis, bool fFailOnResize);
 DECLCALLBACK(int) vbvaPortSendModeHint(PPDMIDISPLAYPORT pInterface, uint32_t cx,
                                        uint32_t cy, uint32_t cBPP,
                                        uint32_t cDisplay, uint32_t dx,
diff --git a/src/VBox/Devices/Graphics/DevVGATmpl.h b/src/VBox/Devices/Graphics/DevVGATmpl.h
index 6c9efb5..16d7ff9 100644
--- a/src/VBox/Devices/Graphics/DevVGATmpl.h
+++ b/src/VBox/Devices/Graphics/DevVGATmpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -55,12 +55,12 @@
 
 #if DEPTH != 15
 
-static inline void glue(vga_draw_glyph_line_, DEPTH)(uint8_t *d,
-                                                     int font_data,
-                                                     uint32_t xorcol,
-                                                     uint32_t bgcol,
-                                                     int dscan,
-                                                     int linesize)
+static inline void RT_CONCAT(vga_draw_glyph_line_, DEPTH)(uint8_t *d,
+                                                          int font_data,
+                                                          uint32_t xorcol,
+                                                          uint32_t bgcol,
+                                                          int dscan,
+                                                          int linesize)
 {
 #if BPP == 1
         ((uint32_t *)d)[0] = (dmask16[(font_data >> 4)] & xorcol) ^ bgcol;
@@ -91,9 +91,9 @@ static inline void glue(vga_draw_glyph_line_, DEPTH)(uint8_t *d,
 #endif
 }
 
-static void glue(vga_draw_glyph8_, DEPTH)(uint8_t *d, int linesize,
-                                          const uint8_t *font_ptr, int h,
-                                          uint32_t fgcol, uint32_t bgcol, int dscan)
+static void RT_CONCAT(vga_draw_glyph8_, DEPTH)(uint8_t *d, int linesize,
+                                               const uint8_t *font_ptr, int h,
+                                               uint32_t fgcol, uint32_t bgcol, int dscan)
 {
     uint32_t xorcol;
     int      font_data;
@@ -101,15 +101,15 @@ static void glue(vga_draw_glyph8_, DEPTH)(uint8_t *d, int linesize,
     xorcol = bgcol ^ fgcol;
     do {
         font_data = font_ptr[0];
-        glue(vga_draw_glyph_line_, DEPTH)(d, font_data, xorcol, bgcol, dscan, linesize);
+        RT_CONCAT(vga_draw_glyph_line_, DEPTH)(d, font_data, xorcol, bgcol, dscan, linesize);
         font_ptr += 4;
         d += linesize << dscan;
     } while (--h);
 }
 
-static void glue(vga_draw_glyph16_, DEPTH)(uint8_t *d, int linesize,
-                                          const uint8_t *font_ptr, int h,
-                                          uint32_t fgcol, uint32_t bgcol, int dscan)
+static void RT_CONCAT(vga_draw_glyph16_, DEPTH)(uint8_t *d, int linesize,
+                                                const uint8_t *font_ptr, int h,
+                                                uint32_t fgcol, uint32_t bgcol, int dscan)
 {
     uint32_t xorcol;
     int      font_data;
@@ -117,20 +117,20 @@ static void glue(vga_draw_glyph16_, DEPTH)(uint8_t *d, int linesize,
     xorcol = bgcol ^ fgcol;
     do {
         font_data = font_ptr[0];
-        glue(vga_draw_glyph_line_, DEPTH)(d,
-                                          expand4to8[font_data >> 4],
-                                          xorcol, bgcol, dscan, linesize);
-        glue(vga_draw_glyph_line_, DEPTH)(d + 8 * BPP,
-                                          expand4to8[font_data & 0x0f],
-                                          xorcol, bgcol, dscan, linesize);
+        RT_CONCAT(vga_draw_glyph_line_, DEPTH)(d,
+                                               expand4to8[font_data >> 4],
+                                               xorcol, bgcol, dscan, linesize);
+        RT_CONCAT(vga_draw_glyph_line_, DEPTH)(d + 8 * BPP,
+                                               expand4to8[font_data & 0x0f],
+                                               xorcol, bgcol, dscan, linesize);
         font_ptr += 4;
         d += linesize << dscan;
     } while (--h);
 }
 
-static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
-                                          const uint8_t *font_ptr, int h,
-                                          uint32_t fgcol, uint32_t bgcol, int dup9)
+static void RT_CONCAT(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
+                                               const uint8_t *font_ptr, int h,
+                                               uint32_t fgcol, uint32_t bgcol, int dup9)
 {
     uint32_t xorcol, v;
     int      font_data;
@@ -139,20 +139,20 @@ static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
     do {
         font_data = font_ptr[0];
 #if BPP == 1
-        cpu_to_32wu((uint32_t *)d, (dmask16[(font_data >> 4)] & xorcol) ^ bgcol);
+        ((uint32_t *)d)[0] = RT_H2LE_U32((dmask16[(font_data >> 4)] & xorcol) ^ bgcol);
         v = (dmask16[(font_data >> 0) & 0xf] & xorcol) ^ bgcol;
-        cpu_to_32wu(((uint32_t *)d)+1, v);
+        ((uint32_t *)d)[1] = RT_H2LE_U32(v);
         if (dup9)
             ((uint8_t *)d)[8] = v >> (24 * (1 - BIG));
         else
             ((uint8_t *)d)[8] = bgcol;
 
 #elif BPP == 2
-        cpu_to_32wu(((uint32_t *)d)+0, (dmask4[(font_data >> 6)] & xorcol) ^ bgcol);
-        cpu_to_32wu(((uint32_t *)d)+1, (dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol);
-        cpu_to_32wu(((uint32_t *)d)+2, (dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol);
+        ((uint32_t *)d)[0] = RT_H2LE_U32((dmask4[(font_data >> 6)] & xorcol) ^ bgcol);
+        ((uint32_t *)d)[1] = RT_H2LE_U32((dmask4[(font_data >> 4) & 3] & xorcol) ^ bgcol);
+        ((uint32_t *)d)[2] = RT_H2LE_U32((dmask4[(font_data >> 2) & 3] & xorcol) ^ bgcol);
         v = (dmask4[(font_data >> 0) & 3] & xorcol) ^ bgcol;
-        cpu_to_32wu(((uint32_t *)d)+3, v);
+        ((uint32_t *)d)[3] = RT_H2LE_U32(v);
         if (dup9)
             ((uint16_t *)d)[8] = v >> (16 * (1 - BIG));
         else
@@ -180,8 +180,8 @@ static void glue(vga_draw_glyph9_, DEPTH)(uint8_t *d, int linesize,
 /*
  * 4 color mode
  */
-static void glue(vga_draw_line2_, DEPTH)(VGAState *s1, uint8_t *d,
-                                         const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line2_, DEPTH)(VGAState *s1, uint8_t *d,
+                                              const uint8_t *s, int width)
 {
     uint32_t plane_mask, *palette, data, v, src_inc, dwb_mode;
     int x;
@@ -224,8 +224,8 @@ static void glue(vga_draw_line2_, DEPTH)(VGAState *s1, uint8_t *d,
 /*
  * 4 color mode, dup2 horizontal
  */
-static void glue(vga_draw_line2d2_, DEPTH)(VGAState *s1, uint8_t *d,
-                                           const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line2d2_, DEPTH)(VGAState *s1, uint8_t *d,
+                                                const uint8_t *s, int width)
 {
     uint32_t plane_mask, *palette, data, v, src_inc, dwb_mode;
     int x;
@@ -259,8 +259,8 @@ static void glue(vga_draw_line2d2_, DEPTH)(VGAState *s1, uint8_t *d,
 /*
  * 16 color mode
  */
-static void glue(vga_draw_line4_, DEPTH)(VGAState *s1, uint8_t *d,
-                                         const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line4_, DEPTH)(VGAState *s1, uint8_t *d,
+                                              const uint8_t *s, int width)
 {
     uint32_t plane_mask, data, v, *palette;
     int x;
@@ -291,8 +291,8 @@ static void glue(vga_draw_line4_, DEPTH)(VGAState *s1, uint8_t *d,
 /*
  * 16 color mode, dup2 horizontal
  */
-static void glue(vga_draw_line4d2_, DEPTH)(VGAState *s1, uint8_t *d,
-                                           const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line4d2_, DEPTH)(VGAState *s1, uint8_t *d,
+                                                const uint8_t *s, int width)
 {
     uint32_t plane_mask, data, v, *palette;
     int x;
@@ -325,8 +325,8 @@ static void glue(vga_draw_line4d2_, DEPTH)(VGAState *s1, uint8_t *d,
  *
  * XXX: add plane_mask support (never used in standard VGA modes)
  */
-static void glue(vga_draw_line8d2_, DEPTH)(VGAState *s1, uint8_t *d,
-                                           const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line8d2_, DEPTH)(VGAState *s1, uint8_t *d,
+                                                const uint8_t *s, int width)
 {
     uint32_t *palette;
     int x;
@@ -348,8 +348,8 @@ static void glue(vga_draw_line8d2_, DEPTH)(VGAState *s1, uint8_t *d,
  *
  * XXX: add plane_mask support (never used in standard VGA modes)
  */
-static void glue(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d,
-                                         const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d,
+                                              const uint8_t *s, int width)
 {
     uint32_t *palette;
     int x;
@@ -378,8 +378,8 @@ static void glue(vga_draw_line8_, DEPTH)(VGAState *s1, uint8_t *d,
 /*
  * 15 bit color
  */
-static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d,
-                                          const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d,
+                                               const uint8_t *s, int width)
 {
 #if DEPTH == 15 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
     memcpy(d, s, width * 2);
@@ -389,11 +389,11 @@ static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d,
 
     w = width;
     do {
-        v = lduw_raw((void *)s);
+        v = s[0] | (s[1] << 8);
         r = (v >> 7) & 0xf8;
         g = (v >> 2) & 0xf8;
         b = (v << 3) & 0xf8;
-        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
+        ((PIXEL_TYPE *)d)[0] = RT_CONCAT(rgb_to_pixel, DEPTH)(r, g, b);
         s += 2;
         d += BPP;
     } while (--w != 0);
@@ -404,8 +404,8 @@ static void glue(vga_draw_line15_, DEPTH)(VGAState *s1, uint8_t *d,
 /*
  * 16 bit color
  */
-static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d,
-                                          const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d,
+                                               const uint8_t *s, int width)
 {
 #if DEPTH == 16 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
     memcpy(d, s, width * 2);
@@ -415,11 +415,11 @@ static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d,
 
     w = width;
     do {
-        v = lduw_raw((void *)s);
+        v = s[0] | (s[1] << 8);
         r = (v >> 8) & 0xf8;
         g = (v >> 3) & 0xfc;
         b = (v << 3) & 0xf8;
-        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
+        ((PIXEL_TYPE *)d)[0] = RT_CONCAT(rgb_to_pixel, DEPTH)(r, g, b);
         s += 2;
         d += BPP;
     } while (--w != 0);
@@ -430,8 +430,8 @@ static void glue(vga_draw_line16_, DEPTH)(VGAState *s1, uint8_t *d,
 /*
  * 24 bit color
  */
-static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d,
-                                          const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d,
+                                               const uint8_t *s, int width)
 {
     int w;
     uint32_t r, g, b;
@@ -448,7 +448,7 @@ static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d,
         g = s[1];
         r = s[2];
 #endif
-        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
+        ((PIXEL_TYPE *)d)[0] = RT_CONCAT(rgb_to_pixel, DEPTH)(r, g, b);
         s += 3;
         d += BPP;
     } while (--w != 0);
@@ -457,8 +457,8 @@ static void glue(vga_draw_line24_, DEPTH)(VGAState *s1, uint8_t *d,
 /*
  * 32 bit color
  */
-static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d,
-                                          const uint8_t *s, int width)
+static void RT_CONCAT(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d,
+                                               const uint8_t *s, int width)
 {
 #if DEPTH == 32 && defined(WORDS_BIGENDIAN) == defined(TARGET_WORDS_BIGENDIAN)
     memcpy(d, s, width * 4);
@@ -477,7 +477,7 @@ static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d,
         g = s[1];
         r = s[2];
 #endif
-        ((PIXEL_TYPE *)d)[0] = glue(rgb_to_pixel, DEPTH)(r, g, b);
+        ((PIXEL_TYPE *)d)[0] = RT_CONCAT(rgb_to_pixel, DEPTH)(r, g, b);
         s += 4;
         d += BPP;
     } while (--w != 0);
@@ -490,12 +490,12 @@ static void glue(vga_draw_line32_, DEPTH)(VGAState *s1, uint8_t *d,
 #ifdef VBOX
 static
 #endif/* VBOX */
-void glue(vga_draw_cursor_line_, DEPTH)(uint8_t *d1,
-                                        const uint8_t *src1,
-                                        int poffset, int w,
-                                        unsigned int color0,
-                                        unsigned int color1,
-                                        unsigned int color_xor)
+void RT_CONCAT(vga_draw_cursor_line_, DEPTH)(uint8_t *d1,
+                                             const uint8_t *src1,
+                                             int poffset, int w,
+                                             unsigned int color0,
+                                             unsigned int color1,
+                                             unsigned int color_xor)
 {
     const uint8_t *plane0, *plane1;
     int x, b0, b1;
diff --git a/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp b/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
index a4bd506..dc2e5e7 100644
--- a/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA_VBVA.cpp
@@ -1315,7 +1315,7 @@ int vbvaVHWACommandCompleteAsync(PPDMIDISPLAYVBVACALLBACKS pInterface, PVBOXVHWA
 
             if(RT_SUCCESS(rc))
             {
-                rc = HGSMIHostCommandProcessAndFreeAsynch(pIns, pHostCmd, (pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ) != 0);
+                rc = HGSMIHostCommandSubmitAndFreeAsynch(pIns, pHostCmd, RT_BOOL(pCmd->Flags & VBOXVHWACMD_FLAG_GH_ASYNCH_IRQ));
                 AssertRC(rc);
                 if(RT_SUCCESS(rc))
                 {
@@ -1858,15 +1858,13 @@ int vboxVBVALoadStateExec (PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t u32Vers
 
             if (u32Version > VGA_SAVEDSTATE_VERSION_WDDM)
             {
-#define VBOX_VHWA_SOLARIS_ARCH "solaris."
-
                 bool fLoadCommands;
 
                 if (u32Version < VGA_SAVEDSTATE_VERSION_FIXED_PENDVHWA)
                 {
                     const char *pcszOsArch = SSMR3HandleHostOSAndArch(pSSM);
                     Assert(pcszOsArch);
-                    fLoadCommands = !pcszOsArch || RTStrNCmp(pcszOsArch, VBOX_VHWA_SOLARIS_ARCH, sizeof (VBOX_VHWA_SOLARIS_ARCH) - 1);
+                    fLoadCommands = !pcszOsArch || RTStrNCmp(pcszOsArch, RT_STR_TUPLE("solaris"));
                 }
                 else
                     fLoadCommands = true;
@@ -1992,61 +1990,70 @@ void VBVARaiseIrqNoWait(PVGASTATE pVGAState, uint32_t fFlags)
     VMR3ReqCallNoWait(PDMDevHlpGetVM(pVGAState->pDevInsR3), VMCPUID_ANY, (PFNRT)vbvaRaiseIrqEMT, 2, pVGAState, fFlags);
 }
 
-int VBVAInfoView(PVGASTATE pVGAState, VBVAINFOVIEW *pView)
+int VBVAInfoView(PVGASTATE pVGAState, const VBVAINFOVIEW *pView)
 {
-    LogFlowFunc(("VBVA_INFO_VIEW: index %d, offset 0x%x, size 0x%x, max screen size 0x%x\n",
-                     pView->u32ViewIndex, pView->u32ViewOffset, pView->u32ViewSize, pView->u32MaxScreenSize));
+    LogFlowFunc(("VBVA_INFO_VIEW: u32ViewIndex %d, u32ViewOffset 0x%x, u32ViewSize 0x%x, u32MaxScreenSize 0x%x\n",
+                 pView->u32ViewIndex, pView->u32ViewOffset, pView->u32ViewSize, pView->u32MaxScreenSize));
 
     PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
-    VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
+    VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns);
 
-    /* @todo verify view data. */
-    if (pView->u32ViewIndex >= pCtx->cViews)
+    if (   pView->u32ViewIndex < pCtx->cViews
+        && pView->u32ViewOffset <= pVGAState->vram_size
+        && pView->u32ViewSize <= pVGAState->vram_size
+        && pView->u32ViewOffset <= pVGAState->vram_size - pView->u32ViewSize
+        && pView->u32MaxScreenSize <= pView->u32ViewSize)
     {
-        Log(("View index too large %d!!!\n",
-             pView->u32ViewIndex));
-        return VERR_INVALID_PARAMETER;
+        pCtx->aViews[pView->u32ViewIndex].view = *pView;
+        return VINF_SUCCESS;
     }
 
-    pCtx->aViews[pView->u32ViewIndex].view = *pView;
-
-    return VINF_SUCCESS;
+    LogRelFlow(("VBVA_INFO_VIEW: invalid data: index %d(%d), offset 0x%x, size 0x%x, max 0x%x, vram size 0x%x\n",
+                pView->u32ViewIndex, pCtx->cViews, pView->u32ViewOffset, pView->u32ViewSize,
+                pView->u32MaxScreenSize, pVGAState->vram_size));
+    return VERR_INVALID_PARAMETER;
 }
 
-int VBVAInfoScreen(PVGASTATE pVGAState, VBVAINFOSCREEN *pScreen)
+int VBVAInfoScreen(PVGASTATE pVGAState, const VBVAINFOSCREEN *pScreen)
 {
-    PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
-    VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext (pIns);
-    VBVAINFOVIEW *pView = &pCtx->aViews[pScreen->u32ViewIndex].view;
-    /* Calculate the offset of the  end of the screen so we can make
-     * sure it is inside the view.  I assume that screen rollover is not
-     * implemented. */
-    int64_t offEnd =   (int64_t)pScreen->u32Height * pScreen->u32LineSize
-                     + pScreen->u32Width + pScreen->u32StartOffset;
     LogRel(("VBVA_INFO_SCREEN: [%d] @%d,%d %dx%d, line 0x%x, BPP %d, flags 0x%x\n",
-                    pScreen->u32ViewIndex, pScreen->i32OriginX, pScreen->i32OriginY,
-                    pScreen->u32Width, pScreen->u32Height,
-                    pScreen->u32LineSize,  pScreen->u16BitsPerPixel, pScreen->u16Flags));
+            pScreen->u32ViewIndex, pScreen->i32OriginX, pScreen->i32OriginY,
+            pScreen->u32Width, pScreen->u32Height,
+            pScreen->u32LineSize, pScreen->u16BitsPerPixel, pScreen->u16Flags));
+
+    PHGSMIINSTANCE pIns = pVGAState->pHGSMI;
+    VBVACONTEXT *pCtx = (VBVACONTEXT *)HGSMIContext(pIns);
 
-    if (   pScreen->u32ViewIndex < RT_ELEMENTS (pCtx->aViews)
+    /* Allow pScreen->u16BitsPerPixel == 0 because legacy guest code used it for screen blanking. */
+    if (   pScreen->u32ViewIndex < pCtx->cViews
         && pScreen->u16BitsPerPixel <= 32
         && pScreen->u32Width <= UINT16_MAX
         && pScreen->u32Height <= UINT16_MAX
-        && pScreen->u32LineSize <= UINT16_MAX * 4
-        && offEnd < pView->u32MaxScreenSize)
+        && pScreen->u32LineSize <= UINT16_MAX * 4)
     {
-        vbvaResize (pVGAState, &pCtx->aViews[pScreen->u32ViewIndex], pScreen);
-        return VINF_SUCCESS;
+        const VBVAINFOVIEW *pView = &pCtx->aViews[pScreen->u32ViewIndex].view;
+        const uint32_t u32BytesPerPixel = (pScreen->u16BitsPerPixel + 7) / 8;
+        if (pScreen->u32Width <= pScreen->u32LineSize / (u32BytesPerPixel? u32BytesPerPixel: 1))
+        {
+            const uint64_t u64ScreenSize = (uint64_t)pScreen->u32LineSize * pScreen->u32Height;
+            if (   pScreen->u32StartOffset <= pView->u32ViewSize
+                && u64ScreenSize <= pView->u32MaxScreenSize
+                && pScreen->u32StartOffset <= pView->u32ViewSize - (uint32_t)u64ScreenSize)
+            {
+                vbvaResize(pVGAState, &pCtx->aViews[pScreen->u32ViewIndex], pScreen);
+                return VINF_SUCCESS;
+            }
+
+            LogRelFlow(("VBVA_INFO_SCREEN: invalid data: size 0x%RX64, max 0x%RX32\n",
+                        u64ScreenSize, pView->u32MaxScreenSize));
+        }
+    }
+    else
+    {
+        LogRelFlow(("VBVA_INFO_SCREEN: invalid data: index %RU32(%RU32)\n",
+                     pScreen->u32ViewIndex, pCtx->cViews));
     }
 
-    LogRelFlow(("VBVA_INFO_SCREEN [%lu]: bad data: %lux%lu, line 0x%lx, BPP %u, start offset %lu, max screen size %lu\n",
-                    (unsigned long)pScreen->u32ViewIndex,
-                    (unsigned long)pScreen->u32Width,
-                    (unsigned long)pScreen->u32Height,
-                    (unsigned long)pScreen->u32LineSize,
-                    (unsigned long)pScreen->u16BitsPerPixel,
-                    (unsigned long)pScreen->u32StartOffset,
-                    (unsigned long)pView->u32MaxScreenSize));
     return VERR_INVALID_PARAMETER;
 }
 
@@ -2067,6 +2074,7 @@ int VBVAGetInfoViewAndScreen(PVGASTATE pVGAState, uint32_t u32ViewIndex, VBVAINF
     return VINF_SUCCESS;
 }
 
+
 /*
  *
  * New VBVA uses a new interface id: #define VBE_DISPI_ID_VBOX_VIDEO         0xBE01
@@ -2192,7 +2200,7 @@ static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16Channe
             }
             else if (pConf32->u32Index == VBOX_VBVA_CONF32_SCREEN_FLAGS)
             {
-                pConf32->u32Value = VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED;
+                pConf32->u32Value = VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED | VBVA_SCREEN_F_BLANK;
             }
             else
             {
@@ -2241,21 +2249,21 @@ static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16Channe
             }
 #endif
 
-            if (cbBuffer < sizeof (VBVAINFOVIEW))
+            /* Expect at least one VBVAINFOVIEW structure. */
+            if (cbBuffer < sizeof(VBVAINFOVIEW))
             {
                 rc = VERR_INVALID_PARAMETER;
                 break;
             }
 
             /* Guest submits an array of VBVAINFOVIEW structures. */
-            VBVAINFOVIEW *pView = (VBVAINFOVIEW *)pvBuffer;
-
+            const VBVAINFOVIEW *pView = (VBVAINFOVIEW *)pvBuffer;
             for (;
-                 cbBuffer >= sizeof (VBVAINFOVIEW);
-                 pView++, cbBuffer -= sizeof (VBVAINFOVIEW))
+                 cbBuffer >= sizeof(VBVAINFOVIEW);
+                 ++pView, cbBuffer -= sizeof(VBVAINFOVIEW))
             {
-                VBVAINFOVIEW View = *pView;
-                rc = VBVAInfoView(pVGAState, &View);
+                VBVAINFOVIEW view = *pView;
+                rc = VBVAInfoView(pVGAState, &view);
                 if (RT_FAILURE(rc))
                     break;
             }
@@ -2273,7 +2281,7 @@ static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16Channe
             LogFlowFunc(("VBVA_INFO_HEAP: offset 0x%x, size 0x%x\n",
                          pHeap->u32HeapOffset, pHeap->u32HeapSize));
 
-            rc = HGSMISetupHostHeap (pIns, pHeap->u32HeapOffset, pHeap->u32HeapSize);
+            rc = HGSMIHostHeapSetup(pIns, pHeap->u32HeapOffset, pHeap->u32HeapSize);
         } break;
 
         case VBVA_FLUSH:
@@ -2293,23 +2301,22 @@ static DECLCALLBACK(int) vbvaChannelHandler (void *pvHandler, uint16_t u16Channe
 
         case VBVA_INFO_SCREEN:
         {
-            if (cbBuffer < sizeof (VBVAINFOSCREEN))
+#ifdef VBOX_WITH_CRHGSMI
+            if (vboxCmdVBVAIsEnabled(pVGAState))
             {
+                AssertMsgFailed(("VBVA_INFO_SCREEN is not acceptible for CmdVbva\n"));
                 rc = VERR_INVALID_PARAMETER;
                 break;
             }
+#endif
 
-#ifdef VBOX_WITH_CRHGSMI
-            if (vboxCmdVBVAIsEnabled(pVGAState))
+            if (cbBuffer < sizeof(VBVAINFOSCREEN))
             {
-                AssertMsgFailed(("VBVA_INFO_SCREEN is not acceptible for CmdVbva\n"));
                 rc = VERR_INVALID_PARAMETER;
                 break;
             }
-#endif
 
-            VBVAINFOSCREEN *pScreen = (VBVAINFOSCREEN *)pvBuffer;
-            VBVAINFOSCREEN Screen = *pScreen;
+            VBVAINFOSCREEN Screen = *(VBVAINFOSCREEN *)pvBuffer;
             rc = VBVAInfoScreen(pVGAState, &Screen);
         } break;
 
diff --git a/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp b/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
index 2b801db..655a542 100644
--- a/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
+++ b/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
@@ -1,3 +1,4 @@
+/* $Id: DevVGA_VDMA.cpp $ */
 /** @file
  * Video DMA (VDMA) support.
  */
@@ -15,6 +16,7 @@
  */
 #include <VBox/VMMDev.h>
 #include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pgm.h>
 #include <VBox/VBoxVideo.h>
 #include <iprt/semaphore.h>
 #include <iprt/thread.h>
@@ -1148,7 +1150,7 @@ static int vdmaVBVACtlDisableSync(PVBOXVDMAHOST pVdma)
         return rc;
     }
 
-    vgaUpdateDisplayAll(pVdma->pVGAState);
+    vgaUpdateDisplayAll(pVdma->pVGAState, /* fFailOnResize = */ false);
 
     return VINF_SUCCESS;
 }
@@ -1434,47 +1436,63 @@ static int vboxVDMACrHostCtlProcess(struct VBOXVDMAHOST *pVdma, VBVAEXHOSTCTL *p
     }
 }
 
-static int vboxVDMACrGuestCtlResizeEntryProcess(struct VBOXVDMAHOST *pVdma, VBOXCMDVBVA_RESIZE_ENTRY *pEntry)
+static int vboxVDMASetupScreenInfo(PVGASTATE pVGAState, VBVAINFOSCREEN *pScreen)
 {
-    PVGASTATE pVGAState = pVdma->pVGAState;
-    VBVAINFOSCREEN Screen = pEntry->Screen;
-    VBVAINFOVIEW View;
-    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap);
-    uint32_t u32ViewIndex = Screen.u32ViewIndex;
-    uint16_t u16Flags = Screen.u16Flags;
-    bool fDisable = false;
-
-    memcpy(aTargetMap, pEntry->aTargetMap, sizeof (aTargetMap));
+    const uint32_t u32ViewIndex = pScreen->u32ViewIndex;
+    const bool fDisabled = RT_BOOL(pScreen->u16Flags & VBVA_SCREEN_F_DISABLED);
 
-    ASMBitClearRange(aTargetMap, pVGAState->cMonitors, VBOX_VIDEO_MAX_SCREENS);
-
-    if (u16Flags & VBVA_SCREEN_F_DISABLED)
-    {
-        fDisable = true;
-        memset(&Screen, 0, sizeof (Screen));
-        Screen.u32ViewIndex = u32ViewIndex;
-        Screen.u16Flags = VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED;
-    }
-
-    if (u32ViewIndex > pVGAState->cMonitors)
+    if (fDisabled)
     {
-        if (u32ViewIndex != 0xffffffff)
+        if (   u32ViewIndex < pVGAState->cMonitors
+            || u32ViewIndex == UINT32_C(0xFFFFFFFF))
         {
-            WARN(("invalid view index\n"));
-            return VERR_INVALID_PARAMETER;
+            RT_ZERO(*pScreen);
+            pScreen->u32ViewIndex = u32ViewIndex;
+            pScreen->u16Flags = VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED;
+            return VINF_SUCCESS;
         }
-        else if (!fDisable)
+    }
+    else
+    {
+        if (   u32ViewIndex < pVGAState->cMonitors
+            && pScreen->u16BitsPerPixel <= 32
+            && pScreen->u32Width <= UINT16_MAX
+            && pScreen->u32Height <= UINT16_MAX
+            && pScreen->u32LineSize <= UINT16_MAX * 4)
         {
-            WARN(("0xffffffff view index only valid for disable requests\n"));
-            return VERR_INVALID_PARAMETER;
+            const uint32_t u32BytesPerPixel = (pScreen->u16BitsPerPixel + 7) / 8;
+            if (pScreen->u32Width <= pScreen->u32LineSize / (u32BytesPerPixel? u32BytesPerPixel: 1))
+            {
+                const uint64_t u64ScreenSize = (uint64_t)pScreen->u32LineSize * pScreen->u32Height;
+                if (   pScreen->u32StartOffset <= pVGAState->vram_size
+                    && u64ScreenSize <= pVGAState->vram_size
+                    && pScreen->u32StartOffset <= pVGAState->vram_size - (uint32_t)u64ScreenSize)
+                {
+                    return VINF_SUCCESS;
+                }
+            }
         }
     }
 
-    View.u32ViewOffset = 0;
-    View.u32ViewSize = Screen.u32LineSize * Screen.u32Height + Screen.u32StartOffset;
-    View.u32MaxScreenSize = View.u32ViewSize + Screen.u32Width + 1; /* <- make VBVAInfoScreen logic (offEnd < pView->u32MaxScreenSize) happy */
+    return VERR_INVALID_PARAMETER;
+}
 
-    int rc = VINF_SUCCESS;
+static int vboxVDMACrGuestCtlResizeEntryProcess(struct VBOXVDMAHOST *pVdma, VBOXCMDVBVA_RESIZE_ENTRY *pEntry)
+{
+    PVGASTATE pVGAState = pVdma->pVGAState;
+    VBVAINFOSCREEN Screen = pEntry->Screen;
+
+    /* Verify and cleanup local copy of the input data. */
+    int rc = vboxVDMASetupScreenInfo(pVGAState, &Screen);
+    if (RT_FAILURE(rc))
+    {
+        WARN(("invalid screen data\n"));
+        return rc;
+    }
+
+    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap);
+    memcpy(aTargetMap, pEntry->aTargetMap, sizeof(aTargetMap));
+    ASMBitClearRange(aTargetMap, pVGAState->cMonitors, VBOX_VIDEO_MAX_SCREENS);
 
     rc = pVdma->CrSrvInfo.pfnResize(pVdma->CrSrvInfo.hSvr, &Screen, aTargetMap);
     if (RT_FAILURE(rc))
@@ -1483,6 +1501,14 @@ static int vboxVDMACrGuestCtlResizeEntryProcess(struct VBOXVDMAHOST *pVdma, VBOX
         return rc;
     }
 
+    /* A fake view which contains the current screen for the 2D VBVAInfoView. */
+    VBVAINFOVIEW View;
+    View.u32ViewOffset = 0;
+    View.u32ViewSize = Screen.u32LineSize * Screen.u32Height + Screen.u32StartOffset;
+    View.u32MaxScreenSize = Screen.u32LineSize * Screen.u32Height;
+
+    const bool fDisable = RT_BOOL(Screen.u16Flags & VBVA_SCREEN_F_DISABLED);
+
     for (int i = ASMBitFirstSet(aTargetMap, pVGAState->cMonitors);
             i >= 0;
             i = ASMBitNextSet(aTargetMap, pVGAState->cMonitors, i))
@@ -1518,11 +1544,6 @@ static int vboxVDMACrGuestCtlResizeEntryProcess(struct VBOXVDMAHOST *pVdma, VBOX
         }
     }
 
-    if (RT_FAILURE(rc))
-        return rc;
-
-    Screen.u32ViewIndex = u32ViewIndex;
-
     return rc;
 }
 
@@ -1614,7 +1635,8 @@ static int vboxVDMACrGuestCtlProcess(struct VBOXVDMAHOST *pVdma, VBVAEXHOSTCTL *
             }
 
             /* do vgaUpdateDisplayAll right away */
-            vgaUpdateDisplayAll(pVdma->pVGAState);
+            VMR3ReqCallNoWait(PDMDevHlpGetVM(pVdma->pVGAState->pDevInsR3), VMCPUID_ANY,
+                              (PFNRT)vgaUpdateDisplayAll, 2, pVdma->pVGAState, /* fFailOnResize = */ false);
 
             return VBoxVDMAThreadTerm(&pVdma->Thread, NULL, NULL, false);
         }
@@ -2754,6 +2776,8 @@ int vboxVDMAReset(struct VBOXVDMAHOST *pVdma)
 
 int vboxVDMADestruct(struct VBOXVDMAHOST *pVdma)
 {
+    if (!pVdma)
+        return VINF_SUCCESS;
 #ifdef VBOX_WITH_CRHGSMI
     vdmaVBVACtlDisableSync(pVdma);
     VBoxVDMAThreadCleanup(&pVdma->Thread);
diff --git a/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp b/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
index fff80a2..9b7d6d2 100644
--- a/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
+++ b/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.cpp
@@ -1,3 +1,4 @@
+/* $Id: HGSMIHost.cpp $ */
 /** @file
  *
  * VBox Host Guest Shared Memory Interface (HGSMI).
@@ -60,12 +61,12 @@
 #include <iprt/alloc.h>
 #include <iprt/critsect.h>
 #include <iprt/heap.h>
+#include <iprt/list.h>
 #include <iprt/semaphore.h>
 #include <iprt/string.h>
-#include <iprt/asm.h>
 
 #include <VBox/err.h>
-#define LOG_GROUP LOG_GROUP_DEV_VGA
+#define LOG_GROUP LOG_GROUP_HGSMI
 #include <VBox/log.h>
 #include <VBox/vmm/ssm.h>
 
@@ -73,7 +74,6 @@
 #include <VBox/HGSMI/HGSMIChannels.h>
 #include <VBox/HGSMI/HGSMIChSetup.h>
 
-#include "HGSMIHostHlp.h"
 #include "../DevVGASavedState.h"
 
 #ifdef DEBUG_sunlover
@@ -132,7 +132,32 @@
 #endif /* !HGSMI_STRICT */
 
 
-typedef struct _HGSMIINSTANCE
+/* Host heap types. */
+#define HGSMI_HEAP_TYPE_NULL    0 /* Heap not initialized. */
+#define HGSMI_HEAP_TYPE_POINTER 1 /* Deprecated, used only for old saved states. RTHEAPSIMPLE. */
+#define HGSMI_HEAP_TYPE_OFFSET  2 /* Deprecated, used only for old saved states. RTHEAPOFFSET. */
+#define HGSMI_HEAP_TYPE_MA      3 /* Memory allocator. */
+
+typedef struct HGSMIHOSTHEAP
+{
+    uint32_t u32HeapType;   /* HGSMI_HEAP_TYPE_* */
+    int32_t volatile cRefs; /* How many blocks allocated. */
+    HGSMIAREA area;         /* Host heap location. */
+    union
+    {
+        HGSMIMADATA ma;     /* Memory allocator for the default host heap implementation. */
+        struct              /* Legacy heap implementations. For old saved states. */
+        {
+            union
+            {
+                RTHEAPSIMPLE hPtr;  /* Pointer based heap. */
+                RTHEAPOFFSET hOff;  /* Offset based heap. */
+            } u;
+        } legacy;
+    } u;
+} HGSMIHOSTHEAP;
+
+typedef struct HGSMIINSTANCE
 {
     PVM pVM;                           /* The VM. */
 
@@ -141,65 +166,44 @@ typedef struct _HGSMIINSTANCE
     RTCRITSECT   instanceCritSect;     /* For updating the instance data: FIFO's, channels. */
 
     HGSMIAREA area; /* The shared memory description. */
-    HGSMIHEAP hostHeap;                /* Host heap instance. */
+    HGSMIHOSTHEAP hostHeap;            /* Host heap instance. */
     RTCRITSECT    hostHeapCritSect;    /* Heap serialization lock. */
 
-    HGSMILIST hostFIFO;                /* Pending host buffers. */
-    HGSMILIST hostFIFORead;            /* Host buffers read by the guest. */
-    HGSMILIST hostFIFOProcessed;       /* Processed by the guest. */
-    HGSMILIST hostFIFOFree;            /* Buffers for reuse. */
+    RTLISTANCHOR hostFIFO;             /* Pending host buffers. */
+    RTLISTANCHOR hostFIFORead;         /* Host buffers read by the guest. */
+    RTLISTANCHOR hostFIFOProcessed;    /* Processed by the guest. */
+    RTLISTANCHOR hostFIFOFree;         /* Buffers for reuse. */
 #ifdef VBOX_WITH_WDDM
-    HGSMILIST guestCmdCompleted;       /* list of completed guest commands to be returned to the guest*/
+    RTLISTANCHOR guestCmdCompleted;    /* list of completed guest commands to be returned to the guest*/
 #endif
-    RTCRITSECT    hostFIFOCritSect;    /* FIFO serialization lock. */
+    RTCRITSECT hostFIFOCritSect;       /* FIFO serialization lock. */
 
     PFNHGSMINOTIFYGUEST pfnNotifyGuest; /* Guest notification callback. */
-    void *pvNotifyGuest;               /* Guest notification callback context. */
+    void *pvNotifyGuest;                /* Guest notification callback context. */
 
-    volatile HGSMIHOSTFLAGS * pHGFlags;
+    volatile HGSMIHOSTFLAGS *pHGFlags;
 
     HGSMICHANNELINFO channelInfo;      /* Channel handlers indexed by the channel id.
-                                                      * The array is accessed under the instance lock.
-                                                      */
- }  HGSMIINSTANCE;
+                                        * The array is accessed under the instance lock.
+                                        */
+} HGSMIINSTANCE;
 
 
 typedef DECLCALLBACK(void) FNHGSMIHOSTFIFOCALLBACK(void *pvCallback);
 typedef FNHGSMIHOSTFIFOCALLBACK *PFNHGSMIHOSTFIFOCALLBACK;
 
-typedef struct _HGSMIHOSTFIFOENTRY
+typedef struct HGSMIHOSTFIFOENTRY
 {
-    /* The list field. Must be the first field. */
-    HGSMILISTENTRY entry;
-
-    /* Backlink to the HGSMI instance. */
-    HGSMIINSTANCE *pIns;
+    RTLISTNODE nodeEntry;
 
-#if 0
-    /* removed to allow saved state handling */
-    /* The event which is signalled when the command has been processed by the host. */
-    RTSEMEVENTMULTI hEvent;
-#endif
-    /* Status flags of the entry. */
-    volatile uint32_t fl;
-
-    /* Offset in the memory region of the entry data. */
-    HGSMIOFFSET offBuffer;
+    HGSMIINSTANCE *pIns;               /* Backlink to the HGSMI instance. */
 
-#if 0
-    /* removed to allow saved state handling */
-    /* The command completion callback. */
-    PFNHGSMIHOSTFIFOCALLBACK pfnCallback;
-    void *pvCallback;
-#endif
+    volatile uint32_t fl;              /* Status flags of the entry. */
 
+    HGSMIOFFSET offBuffer;             /* Offset of the HGSMI buffer header in the HGSMI host heap:
+                                        * [pIns->hostHeap.area.offBase .. offLast]. */
 } HGSMIHOSTFIFOENTRY;
 
-#define HGSMILISTENTRY_2_FIFOENTRY(_pe) \
-    ( (HGSMIHOSTFIFOENTRY*)((uint8_t *)(_pe) - RT_OFFSETOF(HGSMIHOSTFIFOENTRY, entry)) )
-
-//AssertCompile(RT_OFFSETOF(HGSMIHOSTFIFOENTRY, entry) == 0);
-
 
 #define HGSMI_F_HOST_FIFO_ALLOCATED 0x0001
 #define HGSMI_F_HOST_FIFO_QUEUED    0x0002
@@ -212,16 +216,12 @@ static DECLCALLBACK(void) hgsmiHostCommandFreeCallback (void *pvCallback);
 
 #ifdef VBOX_WITH_WDDM
 
-typedef struct _HGSMIGUESTCOMPLENTRY
+typedef struct HGSMIGUESTCOMPLENTRY
 {
-    /* The list field. Must be the first field. */
-    HGSMILISTENTRY entry;
-    /* guest command buffer */
-    HGSMIOFFSET offBuffer;
+    RTLISTNODE nodeEntry;
+    HGSMIOFFSET offBuffer; /* Offset of the guest command buffer. */
 } HGSMIGUESTCOMPLENTRY;
 
-#define HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(_pe) \
-    ( (HGSMIGUESTCOMPLENTRY*)((uint8_t *)(_pe) - RT_OFFSETOF(HGSMIGUESTCOMPLENTRY, entry)) )
 
 static void hgsmiGuestCompletionFIFOFree (HGSMIINSTANCE *pIns, HGSMIGUESTCOMPLENTRY *pEntry)
 {
@@ -293,29 +293,31 @@ static HGSMIOFFSET hgsmiProcessGuestCmdCompletion(HGSMIINSTANCE *pIns)
     HGSMIOFFSET offCmd = HGSMIOFFSET_VOID;
     int rc = hgsmiFIFOLock(pIns);
     AssertRC(rc);
-    if(RT_SUCCESS(rc))
+    if (RT_SUCCESS(rc))
     {
-        /* Get the host FIFO head entry. */
-        HGSMILISTENTRY *pHead = pIns->guestCmdCompleted.pHead;
-        if(pHead)
-            hgsmiListRemove (&pIns->guestCmdCompleted, pHead, NULL);
+        HGSMIGUESTCOMPLENTRY *pEntry = RTListGetFirst(&pIns->guestCmdCompleted, HGSMIGUESTCOMPLENTRY, nodeEntry);
+        if (pEntry)
+        {
+            RTListNodeRemove(&pEntry->nodeEntry);
+        }
 
-        if(!pIns->guestCmdCompleted.pHead)
+        if (RTListIsEmpty(&pIns->guestCmdCompleted))
         {
             if(pIns->pHGFlags)
-                ASMAtomicAndU32(&pIns->pHGFlags->u32HostFlags, (~HGSMIHOSTFLAGS_GCOMMAND_COMPLETED));
+            {
+                ASMAtomicAndU32(&pIns->pHGFlags->u32HostFlags, ~HGSMIHOSTFLAGS_GCOMMAND_COMPLETED);
+            }
         }
 
         hgsmiFIFOUnlock(pIns);
 
-        if (pHead)
+        if (pEntry)
         {
-            HGSMIGUESTCOMPLENTRY *pEntry = HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(pHead);
             offCmd = pEntry->offBuffer;
 
             LogFlowFunc(("host FIFO head %p.\n", pEntry));
 
-            hgsmiGuestCompletionFIFOFree (pIns, pEntry);
+            hgsmiGuestCompletionFIFOFree(pIns, pEntry);
         }
     }
     return offCmd;
@@ -345,36 +347,27 @@ HGSMIOFFSET HGSMIGuestRead (PHGSMIINSTANCE pIns)
 #endif
 }
 
-static bool hgsmiProcessHostCmdCompletion (HGSMIINSTANCE *pIns,
-                     HGSMIOFFSET offBuffer,
-                     bool bCompleteFirst)
+static bool hgsmiProcessHostCmdCompletion(HGSMIINSTANCE *pIns,
+                                          HGSMIOFFSET offBuffer,
+                                          bool bCompleteFirst)
 {
     VM_ASSERT_EMT(pIns->pVM);
 
     int rc = hgsmiFIFOLock(pIns);
     if(RT_SUCCESS(rc))
     {
-        /* Search the Read list for the given buffer offset. Also find the previous entry. */
-        HGSMIHOSTFIFOENTRY *pEntry = HGSMILISTENTRY_2_FIFOENTRY(pIns->hostFIFORead.pHead);
-        HGSMIHOSTFIFOENTRY *pPrev = NULL;
+        /* Search the Read list for the given buffer offset. */
+        HGSMIHOSTFIFOENTRY *pEntry = NULL;
 
-        while (pEntry)
+        HGSMIHOSTFIFOENTRY *pIter;
+        RTListForEach(&pIns->hostFIFORead, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
         {
-            Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_READ));
-
-            if (bCompleteFirst || pEntry->offBuffer == offBuffer)
+            Assert(pIter->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_READ));
+            if (bCompleteFirst || pIter->offBuffer == offBuffer)
             {
+                pEntry = pIter;
                 break;
             }
-
-#ifdef DEBUGVHWASTRICT
-            /* guest usually completes commands in the order it receives it
-             * if we're here this would typically means there is some cmd loss */
-            AssertFailed();
-#endif
-
-            pPrev = pEntry;
-            pEntry = HGSMILISTENTRY_2_FIFOENTRY(pEntry->entry.pNext);
         }
 
         LogFlowFunc(("read list entry: %p.\n", pEntry));
@@ -383,25 +376,17 @@ static bool hgsmiProcessHostCmdCompletion (HGSMIINSTANCE *pIns,
 
         if (pEntry)
         {
-            /* Exclude from the Read list. */
-            hgsmiListRemove (&pIns->hostFIFORead, &pEntry->entry, pPrev? &pPrev->entry: NULL);
+            RTListNodeRemove(&pEntry->nodeEntry);
 
             pEntry->fl &= ~HGSMI_F_HOST_FIFO_READ;
             pEntry->fl |= HGSMI_F_HOST_FIFO_PROCESSED;
 
-            /* Save in the Processed list. */
-            hgsmiListAppend (&pIns->hostFIFOProcessed, &pEntry->entry);
+            RTListAppend(&pIns->hostFIFOProcessed, &pEntry->nodeEntry);
 
             hgsmiFIFOUnlock(pIns);
-#if 0
-            /* Inform the submitter. */
-            if (pEntry->pfnCallback)
-            {
-                pEntry->pfnCallback (pEntry->pvCallback);
-            }
-#else
+
             hgsmiHostCommandFreeCallback(pEntry);
-#endif
+
             return true;
         }
 
@@ -434,12 +419,13 @@ HGSMIOFFSET HGSMIHostRead (HGSMIINSTANCE *pIns)
 
     VM_ASSERT_EMT(pIns->pVM);
 
+    AssertPtrReturn(pIns->pHGFlags, VERR_WRONG_ORDER);
     int rc = hgsmiFIFOLock(pIns);
     AssertRC(rc);
     if(RT_SUCCESS(rc))
     {
         /* Get the host FIFO head entry. */
-        HGSMIHOSTFIFOENTRY *pEntry = HGSMILISTENTRY_2_FIFOENTRY(pIns->hostFIFO.pHead);
+        HGSMIHOSTFIFOENTRY *pEntry = RTListGetFirst(&pIns->hostFIFO, HGSMIHOSTFIFOENTRY, nodeEntry);
 
         LogFlowFunc(("host FIFO head %p.\n", pEntry));
 
@@ -447,10 +433,12 @@ HGSMIOFFSET HGSMIHostRead (HGSMIINSTANCE *pIns)
         {
             Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_QUEUED));
 
-            /* Exclude from the FIFO. */
-            hgsmiListRemove (&pIns->hostFIFO, &pEntry->entry, NULL);
+            /*
+             * Move the entry to the Read list.
+             */
+            RTListNodeRemove(&pEntry->nodeEntry);
 
-            if(!pIns->hostFIFO.pHead)
+            if (RTListIsEmpty(&pIns->hostFIFO))
             {
                 ASMAtomicAndU32(&pIns->pHGFlags->u32HostFlags, (~HGSMIHOSTFLAGS_COMMANDS_PENDING));
             }
@@ -458,11 +446,10 @@ HGSMIOFFSET HGSMIHostRead (HGSMIINSTANCE *pIns)
             pEntry->fl &= ~HGSMI_F_HOST_FIFO_QUEUED;
             pEntry->fl |= HGSMI_F_HOST_FIFO_READ;
 
-            /* Save in the Read list. */
-            hgsmiListAppend (&pIns->hostFIFORead, &pEntry->entry);
+            RTListAppend(&pIns->hostFIFORead, &pEntry->nodeEntry);
 
             hgsmiFIFOUnlock(pIns);
-            Assert(pEntry->offBuffer != HGSMIOFFSET_VOID);
+
             /* Return the buffer offset of the host FIFO head. */
             return pEntry->offBuffer;
         }
@@ -484,29 +471,16 @@ static void hgsmiNotifyGuest (HGSMIINSTANCE *pIns)
 
 void HGSMISetHostGuestFlags(HGSMIINSTANCE *pIns, uint32_t flags)
 {
+    AssertPtrReturnVoid(pIns->pHGFlags);
     ASMAtomicOrU32(&pIns->pHGFlags->u32HostFlags, flags);
 }
 
 void HGSMIClearHostGuestFlags(HGSMIINSTANCE *pIns, uint32_t flags)
 {
+    AssertPtrReturnVoid(pIns->pHGFlags);
     ASMAtomicAndU32(&pIns->pHGFlags->u32HostFlags, (~flags));
 }
 
-#if 0
-static void hgsmiRaiseEvent (const HGSMIHOSTFIFOENTRY *pEntry)
-{
-    int rc = RTSemEventMultiSignal (pEntry->hEvent);
-    AssertRC(rc);
-}
-
-static int hgsmiWaitEvent (const HGSMIHOSTFIFOENTRY *pEntry)
-{
-    int rc = RTSemEventMultiWait (pEntry->hEvent, RT_INDEFINITE_WAIT);
-    AssertRC(rc);
-    return rc;
-}
-#endif
-
 /*
  * The host heap.
  *
@@ -526,6 +500,182 @@ static void hgsmiHostHeapUnlock (HGSMIINSTANCE *pIns)
     AssertRC (rc);
 }
 
+static HGSMIOFFSET hgsmiHostHeapOffset(HGSMIHOSTHEAP *pHeap)
+{
+    return pHeap->area.offBase;
+}
+
+static HGSMISIZE hgsmiHostHeapSize(HGSMIHOSTHEAP *pHeap)
+{
+    return pHeap->area.cbArea;
+}
+
+static void *hgsmiHostHeapBufferAlloc(HGSMIHOSTHEAP *pHeap,
+                                      HGSMISIZE cbBuffer)
+{
+    void *pvBuf = NULL;
+
+    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
+    {
+        pvBuf = HGSMIMAAlloc(&pHeap->u.ma, cbBuffer);
+    }
+    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
+    {
+        pvBuf = RTHeapSimpleAlloc(pHeap->u.legacy.u.hPtr, cbBuffer, 0);
+    }
+    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
+    {
+        pvBuf = RTHeapOffsetAlloc(pHeap->u.legacy.u.hOff, cbBuffer, 0);
+    }
+
+    if (pvBuf)
+    {
+        ++pHeap->cRefs;
+    }
+
+    return pvBuf;
+}
+
+static void hgsmiHostHeapBufferFree(HGSMIHOSTHEAP *pHeap,
+                                    void *pvBuf)
+{
+    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
+    {
+        HGSMIMAFree(&pHeap->u.ma, pvBuf);
+    }
+    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
+    {
+        RTHeapSimpleFree(pHeap->u.legacy.u.hPtr, pvBuf);
+    }
+    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
+    {
+        RTHeapOffsetFree(pHeap->u.legacy.u.hOff, pvBuf);
+    }
+    --pHeap->cRefs;
+}
+
+static void *hgsmiHostHeapDataAlloc(HGSMIHOSTHEAP *pHeap,
+                                    HGSMISIZE cbData,
+                                    uint8_t u8Channel,
+                                    uint16_t u16ChannelInfo)
+{
+    HGSMISIZE cbAlloc = HGSMIBufferRequiredSize(cbData);
+    HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)hgsmiHostHeapBufferAlloc(pHeap, cbAlloc);
+    if (!pHeader)
+        return NULL;
+
+    HGSMIBufferInitializeSingle(&pHeap->area, pHeader, cbAlloc, u8Channel, u16ChannelInfo);
+
+    return HGSMIBufferDataFromPtr(pHeader);
+}
+
+static void hgsmiHostHeapDataFree(HGSMIHOSTHEAP *pHeap,
+                                  void *pvData)
+{
+    if (   pvData
+        && pHeap->u32HeapType != HGSMI_HEAP_TYPE_NULL)
+    {
+        HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);
+        hgsmiHostHeapBufferFree(pHeap, pHeader);
+    }
+}
+
+/* Needed for heap relocation: offset of the heap handle relative to the start of heap area. */
+static HGSMIOFFSET hgsmiHostHeapHandleLocationOffset(HGSMIHOSTHEAP *pHeap)
+{
+    HGSMIOFFSET offHeapHandle;
+    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_POINTER)
+    {
+        offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.legacy.u.hPtr - (uintptr_t)pHeap->area.pu8Base);
+    }
+    else if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
+    {
+        offHeapHandle = (HGSMIOFFSET)((uintptr_t)pHeap->u.legacy.u.hOff - (uintptr_t)pHeap->area.pu8Base);
+    }
+    else
+    {
+        offHeapHandle = HGSMIOFFSET_VOID;
+    }
+    return offHeapHandle;
+}
+
+static int hgsmiHostHeapRelocate(HGSMIHOSTHEAP *pHeap,
+                                 uint32_t u32HeapType,
+                                 void *pvBase,
+                                 uint32_t offHeapHandle,
+                                 uintptr_t offDelta,
+                                 HGSMISIZE cbArea,
+                                 HGSMIOFFSET offBase)
+{
+    int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);
+    if (RT_SUCCESS(rc))
+    {
+        if (u32HeapType == HGSMI_HEAP_TYPE_OFFSET)
+        {
+            pHeap->u.legacy.u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle);
+        }
+        else if (u32HeapType == HGSMI_HEAP_TYPE_POINTER)
+        {
+            pHeap->u.legacy.u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle);
+            rc = RTHeapSimpleRelocate(pHeap->u.legacy.u.hPtr, offDelta); AssertRC(rc);
+        }
+        else
+        {
+            /* HGSMI_HEAP_TYPE_MA does not need the relocation. */
+            rc = VERR_NOT_SUPPORTED;
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            pHeap->u32HeapType = u32HeapType;
+        }
+        else
+        {
+            HGSMIAreaClear(&pHeap->area);
+        }
+    }
+
+    return rc;
+}
+
+static int hgsmiHostHeapRestoreMA(HGSMIHOSTHEAP *pHeap,
+                                  void *pvBase,
+                                  HGSMISIZE cbArea,
+                                  HGSMIOFFSET offBase,
+                                  uint32_t cBlocks,
+                                  HGSMIOFFSET *paDescriptors,
+                                  HGSMISIZE cbMaxBlock,
+                                  HGSMIENV *pEnv)
+{
+    int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);
+    if (RT_SUCCESS(rc))
+    {
+        rc = HGSMIMAInit(&pHeap->u.ma, &pHeap->area, paDescriptors, cBlocks, cbMaxBlock, pEnv);
+
+        if (RT_FAILURE(rc))
+        {
+            HGSMIAreaClear(&pHeap->area);
+        }
+    }
+
+    return rc;
+}
+
+static void hgsmiHostHeapSetupUninitialized(HGSMIHOSTHEAP *pHeap)
+{
+    RT_ZERO(*pHeap);
+    pHeap->u32HeapType = HGSMI_HEAP_TYPE_NULL;
+}
+
+static void hgsmiHostHeapDestroy(HGSMIHOSTHEAP *pHeap)
+{
+    if (pHeap->u32HeapType == HGSMI_HEAP_TYPE_MA)
+    {
+        HGSMIMAUninit(&pHeap->u.ma);
+    }
+    hgsmiHostHeapSetupUninitialized(pHeap);
+}
+
 static int hgsmiHostFIFOAlloc (HGSMIINSTANCE *pIns, HGSMIHOSTFIFOENTRY **ppEntry)
 {
     int rc = VINF_SUCCESS;
@@ -537,14 +687,6 @@ static int hgsmiHostFIFOAlloc (HGSMIINSTANCE *pIns, HGSMIHOSTFIFOENTRY **ppEntry
     if (pEntry)
     {
         pEntry->fl = HGSMI_F_HOST_FIFO_ALLOCATED;
-#if 0
-        rc = RTSemEventMultiCreate (&pEntry->hEvent);
-
-        if (RT_FAILURE (rc))
-        {
-            RTMemFree (pEntry);
-        }
-#endif
     }
     else
     {
@@ -562,169 +704,125 @@ static int hgsmiHostFIFOAlloc (HGSMIINSTANCE *pIns, HGSMIHOSTFIFOENTRY **ppEntry
 static void hgsmiHostFIFOFree (HGSMIINSTANCE *pIns, HGSMIHOSTFIFOENTRY *pEntry)
 {
     NOREF (pIns);
-#if 0
-    if (pEntry->hEvent)
-    {
-        RTSemEventMultiDestroy (pEntry->hEvent);
-    }
-#endif
     RTMemFree (pEntry);
 }
 
 static int hgsmiHostCommandFreeByEntry (HGSMIHOSTFIFOENTRY *pEntry)
 {
+    LogFlowFunc(("offBuffer 0x%08X\n", pEntry->offBuffer));
+
     HGSMIINSTANCE *pIns = pEntry->pIns;
     int rc = hgsmiFIFOLock (pIns);
     if(RT_SUCCESS(rc))
     {
-        hgsmiListRemove (&pIns->hostFIFOProcessed, &pEntry->entry, NULL);
+        RTListNodeRemove(&pEntry->nodeEntry);
         hgsmiFIFOUnlock (pIns);
 
-        void *pvMem = HGSMIBufferDataFromOffset(&pIns->area, pEntry->offBuffer);
+        void *pvData = HGSMIBufferDataFromOffset(&pIns->hostHeap.area, pEntry->offBuffer);
 
         rc = hgsmiHostHeapLock (pIns);
         if(RT_SUCCESS(rc))
         {
             /* Deallocate the host heap memory. */
-            HGSMIHeapFree (&pIns->hostHeap, pvMem);
+            hgsmiHostHeapDataFree(&pIns->hostHeap, pvData);
 
             hgsmiHostHeapUnlock(pIns);
         }
 
         hgsmiHostFIFOFree (pIns, pEntry);
     }
+
+    LogFlowFunc(("%Rrc\n", rc));
     return rc;
 }
 
-static int hgsmiHostCommandFree (HGSMIINSTANCE *pIns,
-                                                void *pvMem)
+static int hgsmiHostCommandFree(HGSMIINSTANCE *pIns,
+                                void *pvData)
 {
-    HGSMIOFFSET offMem = HGSMIHeapBufferOffset (&pIns->hostHeap, pvMem);
-    int rc = VINF_SUCCESS;
-    if (offMem != HGSMIOFFSET_VOID)
+    HGSMIOFFSET offBuffer = HGSMIBufferOffsetFromData(&pIns->hostHeap.area, pvData);
+    HGSMIHOSTFIFOENTRY *pEntry = NULL;
+
+    int rc = hgsmiFIFOLock(pIns);
+    if (RT_SUCCESS(rc))
     {
-        rc = hgsmiFIFOLock (pIns);
-        if(RT_SUCCESS(rc))
+        /* Search the Processed list for the given offBuffer. */
+        HGSMIHOSTFIFOENTRY *pIter;
+        RTListForEach(&pIns->hostFIFOProcessed, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
         {
-            /* Search the Processed list for the given offMem. Also find the previous entry. */
-            HGSMIHOSTFIFOENTRY *pEntry = HGSMILISTENTRY_2_FIFOENTRY(pIns->hostFIFOProcessed.pHead);
-            HGSMIHOSTFIFOENTRY *pPrev = NULL;
-
-            while (pEntry)
-            {
-                Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED));
+            Assert(pIter->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED));
 
-                if (pEntry->offBuffer == offMem)
-                {
-                    break;
-                }
-
-                pPrev = pEntry;
-                pEntry = HGSMILISTENTRY_2_FIFOENTRY(pEntry->entry.pNext);
-            }
-
-            if (pEntry)
-            {
-                /* Exclude from the Processed list. */
-                hgsmiListRemove (&pIns->hostFIFOProcessed, &pEntry->entry, &pPrev->entry);
-            }
-            else
+            if (pIter->offBuffer == offBuffer)
             {
-                LogRel(("HGSMI[%s]: the host frees unprocessed FIFO entry: 0x%08X\n", pIns->pszName, offMem));
-                AssertFailed ();
+                pEntry = pIter;
+                break;
             }
+        }
 
+        if (pEntry)
+        {
+            RTListNodeRemove(&pEntry->nodeEntry);
+        }
+        else
+        {
+            AssertLogRelMsgFailed(("HGSMI[%s]: the host frees unprocessed FIFO entry: 0x%08X\n",
+                                   pIns->pszName, offBuffer));
+        }
 
-            hgsmiFIFOUnlock (pIns);
-
-            rc = hgsmiHostHeapLock (pIns);
-            if(RT_SUCCESS(rc))
-            {
-                /* Deallocate the host heap memory. */
-                HGSMIHeapFree (&pIns->hostHeap, pvMem);
+        hgsmiFIFOUnlock (pIns);
 
-                hgsmiHostHeapUnlock(pIns);
-            }
+        rc = hgsmiHostHeapLock (pIns);
+        if (RT_SUCCESS(rc))
+        {
+            /* Deallocate the host heap memory. */
+            hgsmiHostHeapDataFree(&pIns->hostHeap, pvData);
 
-            if(pEntry)
-            {
-                /* Deallocate the entry. */
-                hgsmiHostFIFOFree (pIns, pEntry);
-            }
+            hgsmiHostHeapUnlock(pIns);
         }
 
+        if (pEntry)
+        {
+            /* Deallocate the entry. */
+            hgsmiHostFIFOFree(pIns, pEntry);
+        }
     }
-    else
-    {
-        rc = VERR_INVALID_POINTER;
-        LogRel(("HGSMI[%s]: the host frees invalid FIFO entry: %p\n", pIns->pszName, pvMem));
-        AssertFailed ();
-    }
-    return rc;
-}
-
-#define HGSMI_SET_COMMAND_PROCESSED_STATE(_pe) \
-{ \
-    Assert((_pe)->entry.pNext == NULL); \
-    Assert((_pe)->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED)); \
-}
 
-#if 0
-static DECLCALLBACK(void) hgsmiHostCommandRaiseEventCallback (void *pvCallback)
-{
-    /* Guest has processed the command. */
-    HGSMIHOSTFIFOENTRY *pEntry = (HGSMIHOSTFIFOENTRY *)pvCallback;
-
-    HGSMI_SET_COMMAND_PROCESSED_STATE(pEntry);
-
-    /* This is a simple callback, just signal the event. */
-    hgsmiRaiseEvent (pEntry);
+    return rc;
 }
-#endif
 
 static DECLCALLBACK(void) hgsmiHostCommandFreeCallback (void *pvCallback)
 {
     /* Guest has processed the command. */
     HGSMIHOSTFIFOENTRY *pEntry = (HGSMIHOSTFIFOENTRY *)pvCallback;
 
-    HGSMI_SET_COMMAND_PROCESSED_STATE(pEntry);
+    Assert(pEntry->fl == (HGSMI_F_HOST_FIFO_ALLOCATED | HGSMI_F_HOST_FIFO_PROCESSED));
 
     /* This is a simple callback, just signal the event. */
     hgsmiHostCommandFreeByEntry (pEntry);
 }
 
-static int hgsmiHostCommandWrite (HGSMIINSTANCE *pIns, HGSMIOFFSET offMem
-#if 0
-        , PFNHGSMIHOSTFIFOCALLBACK pfnCallback, void **ppvContext
-#endif
-        )
+static int hgsmiHostCommandWrite(HGSMIINSTANCE *pIns,
+                                 HGSMIOFFSET offBuffer)
 {
-    HGSMIHOSTFIFOENTRY *pEntry;
+    AssertPtrReturn(pIns->pHGFlags, VERR_WRONG_ORDER);
 
-    int rc = hgsmiHostFIFOAlloc (pIns, &pEntry);
+    HGSMIHOSTFIFOENTRY *pEntry;
+    int rc = hgsmiHostFIFOAlloc(pIns, &pEntry);
 
-    if (RT_SUCCESS (rc))
+    if (RT_SUCCESS(rc))
     {
         /* Initialize the new entry and add it to the FIFO. */
         pEntry->fl |= HGSMI_F_HOST_FIFO_QUEUED;
 
         pEntry->pIns = pIns;
-        pEntry->offBuffer = offMem;
-#if 0
-        pEntry->pfnCallback = pfnCallback;
-        pEntry->pvCallback = pEntry;
-#endif
+        pEntry->offBuffer = offBuffer;
 
         rc = hgsmiFIFOLock(pIns);
-        if (RT_SUCCESS (rc))
+        if (RT_SUCCESS(rc))
         {
-            hgsmiListAppend (&pIns->hostFIFO, &pEntry->entry);
             ASMAtomicOrU32(&pIns->pHGFlags->u32HostFlags, HGSMIHOSTFLAGS_COMMANDS_PENDING);
+            RTListAppend(&pIns->hostFIFO, &pEntry->nodeEntry);
 
             hgsmiFIFOUnlock(pIns);
-#if 0
-            *ppvContext = pEntry;
-#endif
         }
         else
         {
@@ -739,104 +837,74 @@ static int hgsmiHostCommandWrite (HGSMIINSTANCE *pIns, HGSMIOFFSET offMem
 /**
  * Append the shared memory block to the FIFO, inform the guest.
  *
- * @param pIns       Pointer to HGSMI instance,
- * @param pv         The HC memory pointer to the information.
- * @param ppvContext Where to store a pointer, which will allow the caller
- *                   to wait for the command completion.
- * @param            bDoIrq specifies whether the guest interrupt should be generated,
- * i.e. in case the command is not urgent(e.g. some guest command completion notification that does not require post-processing)
- * the command could be posted without raising an irq.
- *
+ * @param pIns       Pointer to HGSMI instance.
+ * @param pvData     The shared memory block data pointer.
+ * @param fDoIrq     Whether the guest interrupt should be generated, i.e. if the command is not
+ *                   urgent (e.g. some guest command completion notification that does not require
+ *                   post-processing) the command could be submitted without raising an irq.
  * @thread EMT
  */
-static int hgsmiHostCommandProcess (HGSMIINSTANCE *pIns, HGSMIOFFSET offBuffer,
-#if 0
-        PFNHGSMIHOSTFIFOCALLBACK pfnCallback, void **ppvContext,
-#endif
-        bool bDoIrq)
+static int hgsmiHostCommandSubmit(HGSMIINSTANCE *pIns,
+                                  void *pvData,
+                                  bool fDoIrq)
 {
-//    HGSMIOFFSET offMem;
-//
-//    int rc = hgsmiCheckMemPtr (pIns, pvMem, &offMem);
-//
-//    if (RT_SUCCESS (rc))
-//    {
-        /* Append the command to FIFO. */
-        int rc = hgsmiHostCommandWrite (pIns, offBuffer
-#if 0
-                , pfnCallback, ppvContext
-#endif
-                );
-
-        if (RT_SUCCESS (rc))
+    /* Append the command to FIFO. */
+    HGSMIOFFSET offBuffer = HGSMIBufferOffsetFromData(&pIns->hostHeap.area, pvData);
+    int rc = hgsmiHostCommandWrite(pIns, offBuffer);
+    if (RT_SUCCESS(rc))
+    {
+        if (fDoIrq)
         {
-            if(bDoIrq)
-            {
-                /* Now guest can read the FIFO, the notification is informational. */
-                hgsmiNotifyGuest (pIns);
-            }
+            /* Now guest can read the FIFO, the notification is informational. */
+            hgsmiNotifyGuest(pIns);
         }
-//    }
-//    else
-//    {
-//        AssertFailed ();
-//    }
+    }
 
     return rc;
 }
-#if 0
-static void hgsmiWait (void *pvContext)
-{
-    HGSMIHOSTFIFOENTRY *pEntry = (HGSMIHOSTFIFOENTRY *)pvContext;
-
-    for (;;)
-    {
-        hgsmiWaitEvent (pEntry);
 
-        if (pEntry->fl & (HGSMI_F_HOST_FIFO_PROCESSED | HGSMI_F_HOST_FIFO_CANCELED))
-        {
-            return;
-        }
-    }
-}
-#endif
 /**
- * Allocate a shared memory block. The host can write command/data to the memory.
+ * Allocate a shared memory buffer. The host can write command/data to the memory.
+ * The allocated buffer contains the 'header', 'data' and the 'tail', but *ppvData
+ * will point to the 'data'.
  *
- * @param pIns   Pointer to HGSMI instance,
- * @param ppvMem Where to store the allocated memory pointer to data.
- * @param cbMem  How many bytes of data to allocate.
+ * @return VBox status code. Pointer to the payload data in *ppvData.
+ * @param pIns           HGSMI instance,
+ * @param ppvData        Where to store the allocated memory pointer to data.
+ * @param cbData         How many bytes of data to allocate.
+ * @param u8Channel      HGSMI channel.
+ * @param u16ChannelInfo Command parameter.
  */
-int HGSMIHostCommandAlloc (HGSMIINSTANCE *pIns,
-                           void **ppvMem,
-                           HGSMISIZE cbMem,
-                           uint8_t u8Channel,
-                           uint16_t u16ChannelInfo)
+int HGSMIHostCommandAlloc(HGSMIINSTANCE *pIns,
+                          void **ppvData,
+                          HGSMISIZE cbData,
+                          uint8_t u8Channel,
+                          uint16_t u16ChannelInfo)
 {
-    LogFlowFunc (("pIns = %p, cbMem = 0x%08X(%d)\n", pIns, cbMem, cbMem));
+    LogFlowFunc(("pIns = %p, cbData = %d, u8Channel %d, u16ChannelInfo 0x%04X\n",
+                 pIns, cbData, u8Channel, u16ChannelInfo));
 
-    int rc = hgsmiHostHeapLock (pIns);
-    if(RT_SUCCESS(rc))
+    int rc = hgsmiHostHeapLock(pIns);
+    if (RT_SUCCESS(rc))
     {
-        void *pvMem = HGSMIHeapAlloc (&pIns->hostHeap,
-                                  cbMem,
-                                  u8Channel,
-                                  u16ChannelInfo);
+        void *pvData = hgsmiHostHeapDataAlloc(&pIns->hostHeap,
+                                              cbData,
+                                              u8Channel,
+                                              u16ChannelInfo);
         hgsmiHostHeapUnlock(pIns);
 
-        if (pvMem)
+        if (pvData)
         {
-            *ppvMem = pvMem;
+            *ppvData = pvData;
         }
         else
         {
-            LogRel((0, "HGSMIHeapAlloc: HGSMIHeapAlloc failed\n"));
-            rc = VERR_GENERAL_FAILURE;
+            LogRel(("HGSMI[%s]: host heap allocation failed %d bytes\n", pIns->pszName, cbData));
+            rc = VERR_NO_MEMORY;
         }
     }
 
-    LogFlowFunc (("rc = %Rrc, pvMem = %p\n", rc, *ppvMem));
-
+    LogFlowFunc(("%Rrc, pvData = %p\n", rc, *ppvData));
     return rc;
 }
 
@@ -844,110 +912,102 @@ int HGSMIHostCommandAlloc (HGSMIINSTANCE *pIns,
  * Convenience function that allows posting the host command asynchronously
  * and make it freed on completion.
  * The caller does not get notified in any way on command completion,
- * on success return the pvMem buffer can not be used after being passed to this function
+ * on successful return the pvData buffer can not be used after being passed to this function.
  *
- * @param pIns  Pointer to HGSMI instance,
- * @param pvMem The pointer returned by 'HGSMIHostCommandAlloc'.
- * @param bDoIrq specifies whether the guest interrupt should be generated,
- * i.e. in case the command is not urgent(e.g. some guest command completion notification that does not require post-processing)
- * the command could be posted without raising an irq.
+ * @param pIns   HGSMI instance,
+ * @param pvData The pointer returned by 'HGSMIHostCommandAlloc'.
+ * @param fDoIrq Specifies whether the guest interrupt should be generated.
+ *               In case the command is not urgent (e.g. some guest command
+ *               completion notification that does not require post-processing)
+ *               the command could be posted without raising an irq.
  */
-int HGSMIHostCommandProcessAndFreeAsynch (PHGSMIINSTANCE pIns,
-                             void *pvMem,
-                             bool bDoIrq)
+int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns,
+                                        void *pvData,
+                                        bool fDoIrq)
 {
-    LogFlowFunc(("pIns = %p, pvMem = %p\n", pIns, pvMem));
-
-#if 0
-    void *pvContext = NULL;
-#endif
+    LogFlowFunc(("pIns = %p, pvData = %p, fDoIrq = %d\n", pIns, pvData, fDoIrq));
 
-    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pIns->hostHeap, pvMem);
-
-    int rc = hgsmiHostCommandProcess (pIns, offBuffer,
-#if 0
-            hgsmiHostCommandFreeCallback, &pvContext,
-#endif
-            bDoIrq);
-    AssertRC (rc);
+    int rc;
+    if (HGSMIAreaContainsPointer(&pIns->hostHeap.area, pvData))
+    {
+        rc = hgsmiHostCommandSubmit(pIns, pvData, fDoIrq);
+    }
+    else
+    {
+        AssertLogRelMsgFailed(("HGSMI[%s]: host submits invalid command %p/%p\n",
+                               pIns->pszName, pvData, pIns->hostHeap.area.pu8Base));
+        rc = VERR_INVALID_POINTER;
+    }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
-
     return rc;
 }
-#if 0
+
 /**
- * Submit the shared memory block to the guest.
+ * Free the shared memory block.
  *
- * @param pIns  Pointer to HGSMI instance,
- * @param pvMem The pointer returned by 'HGSMIHostCommandAlloc'.
+ * @param pIns   Pointer to HGSMI instance,
+ * @param pvData The pointer returned by 'HGSMIHostCommandAlloc'.
  */
-int HGSMIHostCommandProcess (HGSMIINSTANCE *pIns,
-                             void *pvMem)
+int HGSMIHostCommandFree(HGSMIINSTANCE *pIns,
+                         void *pvData)
 {
-    LogFlowFunc(("pIns = %p, pvMem = %p\n", pIns, pvMem));
-
-    VM_ASSERT_OTHER_THREAD(pIns->pVM);
-
-    void *pvContext = NULL;
+    LogFlowFunc(("pIns = %p, pvData = %p\n", pIns, pvData));
 
-    HGSMIOFFSET offBuffer = HGSMIHeapBufferOffset (&pIns->hostHeap, pvMem);
-
-//    /* Have to forward to EMT because FIFO processing is there. */
-//    int rc = VMR3ReqCallVoid (pIns->pVM, &pReq, RT_INDEFINITE_WAIT,
-//                              (PFNRT) hgsmiHostCommandProcess,
-//                              3, pIns, offBuffer, &pvContext);
-
-    int rc = hgsmiHostCommandProcess (pIns, offBuffer,
-#if 0
-            hgsmiHostCommandRaiseEventCallback, &pvContext,
-#endif
-            true);
-    AssertReleaseRC (rc);
-
-    if (RT_SUCCESS (rc))
+    int rc;
+    if (HGSMIAreaContainsPointer(&pIns->hostHeap.area, pvData))
     {
-        /* Wait for completion. */
-        hgsmiWait (pvContext);
+        rc = hgsmiHostCommandFree(pIns, pvData);
+    }
+    else
+    {
+        AssertLogRelMsgFailed(("HGSMI[%s]: the host frees invalid FIFO entry %p/%p\n",
+                               pIns->pszName, pvData, pIns->hostHeap.area.pu8Base));
+        rc = VERR_INVALID_POINTER;
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
-
     return rc;
 }
-#endif
 
-/**
- * Free the shared memory block.
- *
- * @param pIns  Pointer to HGSMI instance,
- * @param pvMem The pointer returned by 'HGSMIHostCommandAlloc'.
- */
-int HGSMIHostCommandFree (HGSMIINSTANCE *pIns,
-                          void *pvMem)
+static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb)
 {
-    LogFlowFunc(("pIns = %p, pvMem = %p\n", pIns, pvMem));
+    NOREF(pvEnv);
+    return RTMemAlloc(cb);
+}
 
-    return hgsmiHostCommandFree (pIns, pvMem);
+static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv)
+{
+    NOREF(pvEnv);
+    RTMemFree(pv);
 }
 
-int HGSMISetupHostHeap (PHGSMIINSTANCE pIns,
-                        HGSMIOFFSET    offHeap,
-                        HGSMISIZE      cbHeap)
+static HGSMIENV g_hgsmiEnv =
+{
+    NULL,
+    hgsmiEnvAlloc,
+    hgsmiEnvFree
+};
+
+int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns,
+                       HGSMIOFFSET    offHeap,
+                       HGSMISIZE      cbHeap)
 {
     LogFlowFunc(("pIns %p, offHeap 0x%08X, cbHeap = 0x%08X\n", pIns, offHeap, cbHeap));
 
     int rc = VINF_SUCCESS;
 
-    Assert (pIns);
+    AssertPtrReturn(pIns, VERR_INVALID_PARAMETER);
 
-//    if (   offHeap >= pIns->cbMem
-//        || cbHeap > pIns->cbMem
-//        || offHeap + cbHeap > pIns->cbMem)
-//    {
-//        rc = VERR_INVALID_PARAMETER;
-//    }
-//    else
+    if (   offHeap >= pIns->area.cbArea
+        || cbHeap > pIns->area.cbArea
+        || offHeap > pIns->area.cbArea - cbHeap)
+    {
+        AssertLogRelMsgFailed(("offHeap 0x%08X, cbHeap = 0x%08X, pIns->area.cbArea 0x%08X\n",
+                               offHeap, cbHeap, pIns->area.cbArea));
+        rc = VERR_INVALID_PARAMETER;
+    }
+    else
     {
         rc = hgsmiHostHeapLock (pIns);
 
@@ -955,17 +1015,27 @@ int HGSMISetupHostHeap (PHGSMIINSTANCE pIns,
         {
             if (pIns->hostHeap.cRefs)
             {
-                AssertFailed();
+                AssertLogRelMsgFailed(("HGSMI[%s]: host heap setup ignored. %d allocated.\n",
+                                       pIns->pszName, pIns->hostHeap.cRefs));
                 /* It is possible to change the heap only if there is no pending allocations. */
                 rc = VERR_ACCESS_DENIED;
             }
             else
             {
-                rc = HGSMIHeapSetup (&pIns->hostHeap,
-                                     pIns->area.pu8Base+offHeap,
-                                     cbHeap,
-                                     offHeap,
-                                     true /*fOffsetBased*/);
+                rc = HGSMIAreaInitialize(&pIns->hostHeap.area, pIns->area.pu8Base + offHeap, cbHeap, offHeap);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = HGSMIMAInit(&pIns->hostHeap.u.ma, &pIns->hostHeap.area, NULL, 0, 0, &g_hgsmiEnv);
+                }
+
+                if (RT_SUCCESS(rc))
+                {
+                    pIns->hostHeap.u32HeapType = HGSMI_HEAP_TYPE_MA;
+                }
+                else
+                {
+                    HGSMIAreaClear(&pIns->hostHeap.area);
+                }
             }
 
             hgsmiHostHeapUnlock (pIns);
@@ -977,26 +1047,30 @@ int HGSMISetupHostHeap (PHGSMIINSTANCE pIns,
     return rc;
 }
 
-static int hgsmiHostSaveFifoEntryLocked (HGSMIHOSTFIFOENTRY *pEntry, PSSMHANDLE pSSM)
-{
-    SSMR3PutU32 (pSSM, pEntry->fl);
-    return SSMR3PutU32 (pSSM, pEntry->offBuffer);
-}
-
-static int hgsmiHostSaveFifoLocked (HGSMILIST * pFifo, PSSMHANDLE pSSM)
+static int hgsmiHostSaveFifoLocked(RTLISTANCHOR *pList, PSSMHANDLE pSSM)
 {
     VBOXHGSMI_SAVE_FIFOSTART(pSSM);
-    uint32_t size = 0;
-    for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry; pEntry = pEntry->pNext)
+
+    HGSMIHOSTFIFOENTRY *pIter;
+
+    uint32_t cEntries = 0;
+    RTListForEach(pList, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
     {
-        ++size;
+        ++cEntries;
     }
-    int rc = SSMR3PutU32 (pSSM, size);
 
-    for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry && RT_SUCCESS(rc); pEntry = pEntry->pNext)
+    int rc = SSMR3PutU32(pSSM, cEntries);
+    if (RT_SUCCESS(rc))
     {
-        HGSMIHOSTFIFOENTRY *pFifoEntry = HGSMILISTENTRY_2_FIFOENTRY(pEntry);
-        rc = hgsmiHostSaveFifoEntryLocked (pFifoEntry, pSSM);
+        RTListForEach(pList, pIter, HGSMIHOSTFIFOENTRY, nodeEntry)
+        {
+            SSMR3PutU32(pSSM, pIter->fl);
+            rc = SSMR3PutU32(pSSM, pIter->offBuffer);
+            if (RT_FAILURE(rc))
+            {
+                break;
+            }
+        }
     }
 
     VBOXHGSMI_SAVE_FIFOSTOP(pSSM);
@@ -1004,25 +1078,28 @@ static int hgsmiHostSaveFifoLocked (HGSMILIST * pFifo, PSSMHANDLE pSSM)
     return rc;
 }
 
-static int hgsmiHostSaveGuestCmdCompletedFifoEntryLocked (HGSMIGUESTCOMPLENTRY *pEntry, PSSMHANDLE pSSM)
-{
-    return SSMR3PutU32 (pSSM, pEntry->offBuffer);
-}
-
-static int hgsmiHostSaveGuestCmdCompletedFifoLocked (HGSMILIST * pFifo, PSSMHANDLE pSSM)
+static int hgsmiHostSaveGuestCmdCompletedFifoLocked(RTLISTANCHOR *pList, PSSMHANDLE pSSM)
 {
     VBOXHGSMI_SAVE_FIFOSTART(pSSM);
-    uint32_t size = 0;
-    for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry; pEntry = pEntry->pNext)
+
+    HGSMIGUESTCOMPLENTRY *pIter;
+
+    uint32_t cEntries = 0;
+    RTListForEach(pList, pIter, HGSMIGUESTCOMPLENTRY, nodeEntry)
     {
-        ++size;
+        ++cEntries;
     }
-    int rc = SSMR3PutU32 (pSSM, size);
-
-    for(HGSMILISTENTRY * pEntry = pFifo->pHead; pEntry && RT_SUCCESS(rc); pEntry = pEntry->pNext)
+    int rc = SSMR3PutU32(pSSM, cEntries);
+    if (RT_SUCCESS(rc))
     {
-        HGSMIGUESTCOMPLENTRY *pFifoEntry = HGSMILISTENTRY_2_HGSMIGUESTCOMPLENTRY(pEntry);
-        rc = hgsmiHostSaveGuestCmdCompletedFifoEntryLocked (pFifoEntry, pSSM);
+        RTListForEach(pList, pIter, HGSMIGUESTCOMPLENTRY, nodeEntry)
+        {
+            rc = SSMR3PutU32(pSSM, pIter->offBuffer);
+            if (RT_FAILURE(rc))
+            {
+                break;
+            }
+        }
     }
 
     VBOXHGSMI_SAVE_FIFOSTOP(pSSM);
@@ -1050,20 +1127,22 @@ static int hgsmiHostLoadFifoEntryLocked (PHGSMIINSTANCE pIns, HGSMIHOSTFIFOENTRY
     return rc;
 }
 
-static int hgsmiHostLoadFifoLocked (PHGSMIINSTANCE pIns, HGSMILIST * pFifo, PSSMHANDLE pSSM)
+static int hgsmiHostLoadFifoLocked(PHGSMIINSTANCE pIns, RTLISTANCHOR *pList, PSSMHANDLE pSSM)
 {
     VBOXHGSMI_LOAD_FIFOSTART(pSSM);
 
-    uint32_t size;
-    int rc = SSMR3GetU32 (pSSM, &size); AssertRC(rc);
-    if(RT_SUCCESS(rc) && size)
+    uint32_t cEntries = 0;
+    int rc = SSMR3GetU32(pSSM, &cEntries);
+    if (RT_SUCCESS(rc) && cEntries)
     {
-        for(uint32_t i = 0; i < size; ++i)
+        uint32_t i;
+        for (i = 0; i < cEntries; ++i)
         {
-            HGSMIHOSTFIFOENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
-            rc = hgsmiHostLoadFifoEntryLocked (pIns, &pFifoEntry, pSSM);
+            HGSMIHOSTFIFOENTRY *pEntry = NULL;
+            rc = hgsmiHostLoadFifoEntryLocked(pIns, &pEntry, pSSM);
             AssertRCBreak(rc);
-            hgsmiListAppend (pFifo, &pFifoEntry->entry);
+
+            RTListAppend(pList, &pEntry->nodeEntry);
         }
     }
 
@@ -1087,35 +1166,40 @@ static int hgsmiHostLoadGuestCmdCompletedFifoEntryLocked (PHGSMIINSTANCE pIns, H
     return rc;
 }
 
-static int hgsmiHostLoadGuestCmdCompletedFifoLocked (PHGSMIINSTANCE pIns, HGSMILIST * pFifo, PSSMHANDLE pSSM, uint32_t u32Version)
+static int hgsmiHostLoadGuestCmdCompletedFifoLocked(PHGSMIINSTANCE pIns, RTLISTANCHOR *pList, PSSMHANDLE pSSM, uint32_t u32Version)
 {
     VBOXHGSMI_LOAD_FIFOSTART(pSSM);
 
-    uint32_t size;
-    int rc = SSMR3GetU32 (pSSM, &size); AssertRC(rc);
-    if(RT_SUCCESS(rc) && size)
+    uint32_t i;
+
+    uint32_t cEntries = 0;
+    int rc = SSMR3GetU32(pSSM, &cEntries);
+    if (RT_SUCCESS(rc) && cEntries)
     {
         if (u32Version > VGA_SAVEDSTATE_VERSION_INV_GCMDFIFO)
         {
-            for(uint32_t i = 0; i < size; ++i)
+            for (i = 0; i < cEntries; ++i)
             {
-                HGSMIGUESTCOMPLENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
-                rc = hgsmiHostLoadGuestCmdCompletedFifoEntryLocked (pIns, &pFifoEntry, pSSM);
+                HGSMIGUESTCOMPLENTRY *pEntry = NULL;
+                rc = hgsmiHostLoadGuestCmdCompletedFifoEntryLocked(pIns, &pEntry, pSSM);
                 AssertRCBreak(rc);
-                hgsmiListAppend (pFifo, &pFifoEntry->entry);
+
+                RTListAppend(pList, &pEntry->nodeEntry);
             }
         }
         else
         {
             LogRel(("WARNING: the current saved state version has some 3D support data missing, "
                     "which may lead to some guest applications function improperly"));
-            /* just read out all invalid data and discard it */
-            for(uint32_t i = 0; i < size; ++i)
+
+            /* Just read out all invalid data and discard it. */
+            for (i = 0; i < cEntries; ++i)
             {
-                HGSMIHOSTFIFOENTRY *pFifoEntry = NULL;  /* initialized to shut up gcc */
-                rc = hgsmiHostLoadFifoEntryLocked (pIns, &pFifoEntry, pSSM);
+                HGSMIHOSTFIFOENTRY *pEntry = NULL;
+                rc = hgsmiHostLoadFifoEntryLocked(pIns, &pEntry, pSSM);
                 AssertRCBreak(rc);
-                hgsmiHostFIFOFree (pIns, pFifoEntry);
+
+                hgsmiHostFIFOFree(pIns, pEntry);
             }
         }
     }
@@ -1125,23 +1209,83 @@ static int hgsmiHostLoadGuestCmdCompletedFifoLocked (PHGSMIINSTANCE pIns, HGSMIL
     return rc;
 }
 
+static int hgsmiHostSaveMA(PSSMHANDLE pSSM, HGSMIMADATA *pMA)
+{
+    int rc = SSMR3PutU32(pSSM, pMA->cBlocks);
+    if (RT_SUCCESS(rc))
+    {
+        HGSMIMABLOCK *pIter;
+        RTListForEach(&pMA->listBlocks, pIter, HGSMIMABLOCK, nodeBlock)
+        {
+            SSMR3PutU32(pSSM, pIter->descriptor);
+        }
+
+        rc = SSMR3PutU32(pSSM, pMA->cbMaxBlock);
+    }
+
+    return rc;
+}
+
+static int hgsmiHostLoadMA(PSSMHANDLE pSSM, uint32_t *pcBlocks, HGSMIOFFSET **ppaDescriptors, HGSMISIZE *pcbMaxBlock)
+{
+    int rc = SSMR3GetU32(pSSM, pcBlocks);
+    if (RT_SUCCESS(rc))
+    {
+        HGSMIOFFSET *paDescriptors = NULL;
+        if (*pcBlocks > 0)
+        {
+            paDescriptors = (HGSMIOFFSET *)RTMemAlloc(*pcBlocks * sizeof(HGSMIOFFSET));
+            if (paDescriptors)
+            {
+                uint32_t i;
+                for (i = 0; i < *pcBlocks; ++i)
+                {
+                    SSMR3GetU32(pSSM, &paDescriptors[i]);
+                }
+            }
+            else
+            {
+                rc = VERR_NO_MEMORY;
+            }
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            rc = SSMR3GetU32(pSSM, pcbMaxBlock);
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            *ppaDescriptors = paDescriptors;
+        }
+        else
+        {
+            RTMemFree(paDescriptors);
+        }
+    }
+
+    return rc;
+}
+
 int HGSMIHostSaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM)
 {
     VBOXHGSMI_SAVE_START(pSSM);
 
     int rc;
 
-    SSMR3PutU32(pSSM, pIns->hostHeap.fOffsetBased ? HGSMI_HEAP_TYPE_OFFSET : HGSMI_HEAP_TYPE_POINTER);
+    SSMR3PutU32(pSSM, pIns->hostHeap.u32HeapType);
 
     HGSMIOFFSET off = pIns->pHGFlags ? HGSMIPointerToOffset(&pIns->area, (const HGSMIBUFFERHEADER *)pIns->pHGFlags) : HGSMIOFFSET_VOID;
     SSMR3PutU32 (pSSM, off);
 
-    off = HGSMIHeapHandleLocationOffset(&pIns->hostHeap);
+    off = pIns->hostHeap.u32HeapType == HGSMI_HEAP_TYPE_MA?
+              0:
+              hgsmiHostHeapHandleLocationOffset(&pIns->hostHeap);
     rc = SSMR3PutU32 (pSSM, off);
     if(off != HGSMIOFFSET_VOID)
     {
-        SSMR3PutU32 (pSSM, HGSMIHeapOffset(&pIns->hostHeap));
-        SSMR3PutU32 (pSSM, HGSMIHeapSize(&pIns->hostHeap));
+        SSMR3PutU32 (pSSM, hgsmiHostHeapOffset(&pIns->hostHeap));
+        SSMR3PutU32 (pSSM, hgsmiHostHeapSize(&pIns->hostHeap));
         /* need save mem pointer to calculate offset on restore */
         SSMR3PutU64 (pSSM, (uint64_t)(uintptr_t)pIns->area.pu8Base);
         rc = hgsmiFIFOLock (pIns);
@@ -1156,6 +1300,14 @@ int HGSMIHostSaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM)
 
             hgsmiFIFOUnlock (pIns);
         }
+
+        if (RT_SUCCESS(rc))
+        {
+            if (pIns->hostHeap.u32HeapType == HGSMI_HEAP_TYPE_MA)
+            {
+                rc = hgsmiHostSaveMA(pSSM, &pIns->hostHeap.u.ma);
+            }
+        }
     }
 
     VBOXHGSMI_SAVE_STOP(pSSM);
@@ -1184,7 +1336,7 @@ int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Ve
     AssertRCReturn(rc, rc);
     pIns->pHGFlags = (off != HGSMIOFFSET_VOID) ? (HGSMIHOSTFLAGS*)HGSMIOffsetToPointer (&pIns->area, off) : NULL;
 
-    HGSMIHEAP hHeap = pIns->hostHeap;
+    HGSMIHOSTHEAP hHeap = pIns->hostHeap;
     rc = SSMR3GetU32(pSSM, &off);
     AssertRCReturn(rc, rc);
     if(off != HGSMIOFFSET_VOID)
@@ -1197,12 +1349,6 @@ int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Ve
                               HGSMI_HEAP_TYPE_POINTER;
         }
 
-        if (u32HeapType == HGSMI_HEAP_TYPE_MA)
-        {
-            AssertMsgFailed(("MA heap not supported"));
-            return VERR_VERSION_MISMATCH;
-        }
-
         HGSMIOFFSET offHeap;
         SSMR3GetU32(pSSM, &offHeap);
         uint32_t cbHeap;
@@ -1211,23 +1357,6 @@ int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Ve
         rc = SSMR3GetU64(pSSM, &oldMem);
         AssertRCReturn(rc, rc);
 
-        rc = hgsmiHostHeapLock (pIns);
-        if (RT_SUCCESS (rc))
-        {
-            Assert(!pIns->hostHeap.cRefs);
-            pIns->hostHeap.cRefs = 0;
-
-            rc = HGSMIHeapRelocate(&pIns->hostHeap,
-                                   pIns->area.pu8Base+offHeap,
-                                   off,
-                                   uintptr_t(pIns->area.pu8Base) - uintptr_t(oldMem),
-                                   cbHeap,
-                                   offHeap,
-                                   u32HeapType == HGSMI_HEAP_TYPE_OFFSET);
-
-            hgsmiHostHeapUnlock (pIns);
-        }
-
         if (RT_SUCCESS(rc))
         {
             rc = hgsmiFIFOLock (pIns);
@@ -1246,6 +1375,50 @@ int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Ve
                 hgsmiFIFOUnlock (pIns);
             }
         }
+
+        if (RT_SUCCESS(rc))
+        {
+            if (u32HeapType == HGSMI_HEAP_TYPE_MA)
+            {
+                uint32_t cBlocks = 0;
+                HGSMISIZE cbMaxBlock = 0;
+                HGSMIOFFSET *paDescriptors = NULL;
+                rc = hgsmiHostLoadMA(pSSM, &cBlocks, &paDescriptors, &cbMaxBlock);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = hgsmiHostHeapRestoreMA(&pIns->hostHeap,
+                                                pIns->area.pu8Base+offHeap,
+                                                cbHeap,
+                                                offHeap,
+                                                cBlocks,
+                                                paDescriptors,
+                                                cbMaxBlock,
+                                                &g_hgsmiEnv);
+
+                    RTMemFree(paDescriptors);
+                }
+            }
+            else if (   u32HeapType == HGSMI_HEAP_TYPE_OFFSET
+                     || u32HeapType == HGSMI_HEAP_TYPE_POINTER)
+            {
+                rc = hgsmiHostHeapLock (pIns);
+                if (RT_SUCCESS (rc))
+                {
+                    Assert(!pIns->hostHeap.cRefs);
+                    pIns->hostHeap.cRefs = 0;
+
+                    rc = hgsmiHostHeapRelocate(&pIns->hostHeap,
+                                               u32HeapType,
+                                               pIns->area.pu8Base+offHeap,
+                                               off,
+                                               uintptr_t(pIns->area.pu8Base) - uintptr_t(oldMem),
+                                               cbHeap,
+                                               offHeap);
+
+                    hgsmiHostHeapUnlock (pIns);
+                }
+            }
+        }
     }
 
     VBOXHGSMI_LOAD_STOP(pSSM);
@@ -1436,11 +1609,12 @@ int HGSMICreate (PHGSMIINSTANCE *ppIns,
                  void           *pvNotifyGuest,
                  size_t         cbContext)
 {
-    LogFlowFunc(("ppIns = %p, pVM = %p, pszName = [%s], pu8MemBase = %p, cbMem = 0x%08X, offMemBase = 0x%08X, "
+    LogFlowFunc(("ppIns = %p, pVM = %p, pszName = [%s], offBase = 0x%08X, pu8MemBase = %p, cbMem = 0x%08X, "
                  "pfnNotifyGuest = %p, pvNotifyGuest = %p, cbContext = %d\n",
                  ppIns,
                  pVM,
                  pszName,
+                 offBase,
                  pu8MemBase,
                  cbMem,
                  pfnNotifyGuest,
@@ -1487,10 +1661,16 @@ int HGSMICreate (PHGSMIINSTANCE *ppIns,
 
         pIns->pszName        = VALID_PTR(pszName)? pszName: "";
 
-        HGSMIHeapSetupUnitialized (&pIns->hostHeap);
+        hgsmiHostHeapSetupUninitialized(&pIns->hostHeap);
 
         pIns->pfnNotifyGuest = pfnNotifyGuest;
         pIns->pvNotifyGuest  = pvNotifyGuest;
+
+        RTListInit(&pIns->hostFIFO);
+        RTListInit(&pIns->hostFIFORead);
+        RTListInit(&pIns->hostFIFOProcessed);
+        RTListInit(&pIns->hostFIFOFree);
+        RTListInit(&pIns->guestCmdCompleted);
     }
 
     rc = HGSMIHostChannelRegister (pIns,
@@ -1530,7 +1710,7 @@ uint32_t HGSMIReset (PHGSMIINSTANCE pIns)
     while(hgsmiProcessGuestCmdCompletion(pIns) != HGSMIOFFSET_VOID) {}
 #endif
 
-    HGSMIHeapSetupUnitialized (&pIns->hostHeap);
+    hgsmiHostHeapDestroy(&pIns->hostHeap);
 
     return flags;
 }
@@ -1541,6 +1721,8 @@ void HGSMIDestroy (PHGSMIINSTANCE pIns)
 
     if (pIns)
     {
+        hgsmiHostHeapDestroy(&pIns->hostHeap);
+
         if (RTCritSectIsInitialized (&pIns->hostHeapCritSect))
         {
             RTCritSectDelete (&pIns->hostHeapCritSect);
@@ -1570,6 +1752,7 @@ static int hgsmiGuestCommandComplete (HGSMIINSTANCE *pIns, HGSMIOFFSET offMem)
 {
     HGSMIGUESTCOMPLENTRY *pEntry = NULL;
 
+    AssertPtrReturn(pIns->pHGFlags, VERR_WRONG_ORDER);
     int rc = hgsmiGuestCompletionFIFOAlloc (pIns, &pEntry);
     AssertRC(rc);
     if (RT_SUCCESS (rc))
@@ -1580,7 +1763,7 @@ static int hgsmiGuestCommandComplete (HGSMIINSTANCE *pIns, HGSMIOFFSET offMem)
         AssertRC(rc);
         if (RT_SUCCESS (rc))
         {
-            hgsmiListAppend (&pIns->guestCmdCompleted, &pEntry->entry);
+            RTListAppend(&pIns->guestCmdCompleted, &pEntry->nodeEntry);
             ASMAtomicOrU32(&pIns->pHGFlags->u32HostFlags, HGSMIHOSTFLAGS_GCOMMAND_COMPLETED);
 
             hgsmiFIFOUnlock(pIns);
diff --git a/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h b/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h
index a1042ed..bc6525f 100644
--- a/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h
+++ b/src/VBox/Devices/Graphics/HGSMI/HGSMIHost.h
@@ -1,3 +1,4 @@
+/* $Id: HGSMIHost.h $ */
 /** @file
  *
  * VBox Host Guest Shared Memory Interface (HGSMI).
@@ -25,8 +26,8 @@
 #include <VBox/HGSMI/HGSMI.h>
 #include <VBox/HGSMI/HGSMIChSetup.h>
 
-struct _HGSMIINSTANCE;
-typedef struct _HGSMIINSTANCE *PHGSMIINSTANCE;
+struct HGSMIINSTANCE;
+typedef struct HGSMIINSTANCE *PHGSMIINSTANCE;
 
 /* Callback for the guest notification about a new host buffer. */
 typedef DECLCALLBACK(void) FNHGSMINOTIFYGUEST(void *pvCallback);
@@ -67,12 +68,9 @@ int HGSMIChannelRegisterName (PHGSMIINSTANCE pIns,
                               void *pvChannelHandler,
                               uint8_t *pu8Channel);
 
-int HGSMISetupHostHeap (PHGSMIINSTANCE pIns,
-                        HGSMIOFFSET    offHeap,
-                        HGSMISIZE      cbHeap);
-
-int HGSMISaveStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
-int HGSMILoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM);
+int HGSMIHostHeapSetup(PHGSMIINSTANCE pIns,
+                       HGSMIOFFSET    offHeap,
+                       HGSMISIZE      cbHeap);
 
 /*
  * Virtual hardware IO handlers.
@@ -104,21 +102,18 @@ void HGSMIClearHostGuestFlags(PHGSMIINSTANCE pIns, uint32_t flags);
  */
 
 /* Allocate a buffer in the host heap. */
-int HGSMIHostCommandAlloc (PHGSMIINSTANCE pIns,
-                           void **ppvMem,
-                           HGSMISIZE cbMem,
-                           uint8_t u8Channel,
-                           uint16_t u16ChannelInfo);
-
-int HGSMIHostCommandProcess (PHGSMIINSTANCE pIns,
-                             void *pvMem);
+int HGSMIHostCommandAlloc(PHGSMIINSTANCE pIns,
+                          void **ppvData,
+                          HGSMISIZE cbData,
+                          uint8_t u8Channel,
+                          uint16_t u16ChannelInfo);
 
-int HGSMIHostCommandProcessAndFreeAsynch (PHGSMIINSTANCE pIns,
-                             void *pvMem,
-                             bool bDoIrq);
+int HGSMIHostCommandSubmitAndFreeAsynch(PHGSMIINSTANCE pIns,
+                                        void *pvData,
+                                        bool fDoIrq);
 
-int HGSMIHostCommandFree (PHGSMIINSTANCE pIns,
-                          void *pvMem);
+int HGSMIHostCommandFree(PHGSMIINSTANCE pIns,
+                         void *pvData);
 
 int HGSMIHostLoadStateExec (PHGSMIINSTANCE pIns, PSSMHANDLE pSSM, uint32_t u32Version);
 
diff --git a/src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.cpp b/src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.cpp
deleted file mode 100644
index 3e0686a..0000000
--- a/src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
- *
- * VBox Host Guest Shared Memory Interface (HGSMI).
- * Host part helpers.
- */
-
-/*
- * Copyright (C) 2006-2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-
-#include "HGSMIHostHlp.h"
-
-
-void hgsmiListAppend (HGSMILIST *pList, HGSMILISTENTRY *pEntry)
-{
-    AssertPtr(pEntry);
-    Assert(pEntry->pNext == NULL);
-
-    if (pList->pTail)
-    {
-        Assert (pList->pTail->pNext == NULL);
-        pList->pTail->pNext = pEntry;
-    }
-    else
-    {
-        Assert (pList->pHead == NULL);
-        pList->pHead = pEntry;
-    }
-
-    pList->pTail = pEntry;
-}
-
-
-void hgsmiListRemove (HGSMILIST *pList, HGSMILISTENTRY *pEntry, HGSMILISTENTRY *pPrev)
-{
-    AssertPtr(pEntry);
-
-    if (pEntry->pNext == NULL)
-    {
-        Assert (pList->pTail == pEntry);
-        pList->pTail = pPrev;
-    }
-    else
-    {
-        /* Do nothing. The *pTail is not changed. */
-    }
-
-    if (pPrev == NULL)
-    {
-        Assert (pList->pHead == pEntry);
-        pList->pHead = pEntry->pNext;
-    }
-    else
-    {
-        pPrev->pNext = pEntry->pNext;
-    }
-
-    pEntry->pNext = NULL;
-}
-
-HGSMILISTENTRY * hgsmiListRemoveAll (HGSMILIST *pList, HGSMILISTENTRY ** ppTail /* optional */)
-{
-    HGSMILISTENTRY * pHead = pList->pHead;
-    if (ppTail)
-        *ppTail = pList->pTail;
-
-    hgsmiListInit (pList);
-
-    return pHead;
-}
-
diff --git a/src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.h b/src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.h
deleted file mode 100644
index eb76aed..0000000
--- a/src/VBox/Devices/Graphics/HGSMI/HGSMIHostHlp.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/** @file
- *
- * VBox Host Guest Shared Memory Interface (HGSMI).
- * Host part helpers.
- */
-
-/*
- * Copyright (C) 2006-2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-
-#ifndef __HGSMIHostHlp_h__
-#define __HGSMIHostHlp_h__
-
-#include <iprt/assert.h>
-#include <iprt/types.h>
-
-typedef struct _HGSMILISTENTRY
-{
-    struct _HGSMILISTENTRY *pNext;
-} HGSMILISTENTRY;
-
-typedef struct _HGSMILIST
-{
-    HGSMILISTENTRY *pHead;
-    HGSMILISTENTRY *pTail;
-} HGSMILIST;
-
-void hgsmiListAppend (HGSMILIST *pList, HGSMILISTENTRY *pEntry);
-DECLINLINE(void) hgsmiListPrepend (HGSMILIST *pList, HGSMILISTENTRY *pEntry)
-{
-    HGSMILISTENTRY * pHead = pList->pHead;
-    pList->pHead = pEntry;
-    pEntry->pNext = pHead;
-    if (!pHead)
-        pList->pTail = pEntry;
-}
-
-void hgsmiListRemove (HGSMILIST *pList, HGSMILISTENTRY *pEntry, HGSMILISTENTRY *pPrev);
-
-DECLINLINE(HGSMILISTENTRY*) hgsmiListRemoveHead (HGSMILIST *pList)
-{
-    HGSMILISTENTRY *pHead = pList->pHead;
-    if (pHead)
-        hgsmiListRemove (pList, pHead, NULL);
-    return pHead;
-}
-
-DECLINLINE(bool) hgsmiListIsEmpty (HGSMILIST *pList)
-{
-    return !pList->pHead;
-}
-
-DECLINLINE(void) hgsmiListInit (HGSMILIST *pList)
-{
-    pList->pHead = NULL;
-    pList->pTail = NULL;
-}
-
-HGSMILISTENTRY * hgsmiListRemoveAll (HGSMILIST *pList, HGSMILISTENTRY ** ppTail /* optional */);
-
-DECLINLINE(void) hgsmiListAppendAll (HGSMILIST *pList, HGSMILISTENTRY *pHead, HGSMILISTENTRY *pTail)
-{
-    if(hgsmiListIsEmpty (pList))
-    {
-        pList->pHead = pHead;
-        pList->pTail = pTail;
-    }
-    else
-    {
-        pList->pTail->pNext = pHead;
-        pList->pTail = pTail;
-    }
-}
-
-DECLINLINE(void) hgsmiListPrependAll (HGSMILIST *pList, HGSMILISTENTRY *pHead, HGSMILISTENTRY *pTail)
-{
-    HGSMILISTENTRY *pOldHead = pList->pHead;
-    if(!pOldHead)
-    {
-        pList->pHead = pHead;
-        pList->pTail = pTail;
-    }
-    else
-    {
-        pList->pHead = pHead;
-        pTail->pNext = pOldHead;
-    }
-}
-
-DECLINLINE(void) hgsmiListCat (HGSMILIST *pList, HGSMILIST *pList2)
-{
-    hgsmiListAppendAll (pList, pList2->pHead, pList2->pTail);
-    hgsmiListInit (pList2);
-}
-
-DECLINLINE(void) hgsmiListPrepCat (HGSMILIST *pList, HGSMILIST *pList2)
-{
-    hgsmiListPrependAll (pList, pList2->pHead, pList2->pTail);
-    hgsmiListInit (pList2);
-}
-
-
-#endif /* !__HGSMIHostHlp_h__*/
diff --git a/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.cpp b/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.cpp
index 606772d..a7cfe82 100644
--- a/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.cpp
+++ b/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.cpp
@@ -1,3 +1,4 @@
+/* $Id: SHGSMIHost.cpp $ */
 /*
  * Copyright (C) 2010 Oracle Corporation
  *
diff --git a/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.h b/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.h
index 8f7879c..492d897 100644
--- a/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.h
+++ b/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.h
@@ -1,3 +1,4 @@
+/* $Id: SHGSMIHost.h $ */
 /*
  * Copyright (C) 2010 Oracle Corporation
  *
diff --git a/src/VBox/Devices/Graphics/VBoxSVGA3D.rc b/src/VBox/Devices/Graphics/VBoxSVGA3D.rc
deleted file mode 100644
index 0f01a02..0000000
--- a/src/VBox/Devices/Graphics/VBoxSVGA3D.rc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id: VBoxSVGA3D.rc $ */
-/** @file
- * VBoxSVGA3D - Resource file containing version info and icon.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      VFT2_UNKNOWN
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904b0" // Lang=US English, CharSet=Unicode
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox VMSVGA 3D\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     "VBoxSVGA3D\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", "VBoxSVGA3D.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1200
-  END
-END
diff --git a/src/VBox/Devices/Input/DevPS2.cpp b/src/VBox/Devices/Input/DevPS2.cpp
index 5abb04b..4e0d415 100644
--- a/src/VBox/Devices/Input/DevPS2.cpp
+++ b/src/VBox/Devices/Input/DevPS2.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -45,7 +45,6 @@
 *   Header Files                                                               *
 *******************************************************************************/
 #define LOG_GROUP LOG_GROUP_DEV_KBD
-#include "vl_vbox.h"
 #include <VBox/vmm/pdmdev.h>
 #include <iprt/assert.h>
 #include <iprt/uuid.h>
@@ -53,8 +52,15 @@
 #include "VBoxDD.h"
 #include "PS2Dev.h"
 
-#define PCKBD_SAVED_STATE_VERSION 7
+/* Do not remove this (unless eliminating the corresponding ifdefs), it will
+ * cause instant triple faults when booting Windows VMs. */
+#define TARGET_I386
 
+#ifndef VBOX_WITH_NEW_PS2M
+#define PCKBD_SAVED_STATE_VERSION 7
+#else
+#define PCKBD_SAVED_STATE_VERSION 8
+#endif
 
 #ifndef VBOX_DEVICE_STRUCT_TESTCASE
 /*******************************************************************************
@@ -209,9 +215,9 @@ typedef struct KBDState
     int32_t mouse_flags;
     uint8_t mouse_buttons;
     uint8_t mouse_buttons_reported;
-#endif
 
     uint32_t    Alignment0;
+#endif
 
     /** Pointer to the device instance - RC. */
     PPDMDEVINSRC                pDevInsRC;
@@ -1074,58 +1080,56 @@ static void kbd_reset(void *opaque)
 #endif
 }
 
-static void kbd_save(QEMUFile* f, void* opaque)
+static void kbd_save(PSSMHANDLE pSSM, KBDState *s)
 {
 #ifndef VBOX_WITH_NEW_PS2M
     uint32_t    cItems;
     int i;
 #endif
-    KBDState *s = (KBDState*)opaque;
 
-    qemu_put_8s(f, &s->write_cmd);
-    qemu_put_8s(f, &s->status);
-    qemu_put_8s(f, &s->mode);
-    qemu_put_8s(f, &s->dbbout);
+    SSMR3PutU8(pSSM, s->write_cmd);
+    SSMR3PutU8(pSSM, s->status);
+    SSMR3PutU8(pSSM, s->mode);
+    SSMR3PutU8(pSSM, s->dbbout);
 #ifndef VBOX_WITH_NEW_PS2M
-    qemu_put_be32s(f, &s->mouse_write_cmd);
-    qemu_put_8s(f, &s->mouse_status);
-    qemu_put_8s(f, &s->mouse_resolution);
-    qemu_put_8s(f, &s->mouse_sample_rate);
-    qemu_put_8s(f, &s->mouse_wrap);
-    qemu_put_8s(f, &s->mouse_type);
-    qemu_put_8s(f, &s->mouse_detect_state);
-    qemu_put_be32s(f, &s->mouse_dx);
-    qemu_put_be32s(f, &s->mouse_dy);
-    qemu_put_be32s(f, &s->mouse_dz);
-    qemu_put_be32s(f, &s->mouse_dw);
-    qemu_put_be32s(f, &s->mouse_flags);
-    qemu_put_8s(f, &s->mouse_buttons);
-    qemu_put_8s(f, &s->mouse_buttons_reported);
+    SSMR3PutU32(pSSM, s->mouse_write_cmd);
+    SSMR3PutU8(pSSM, s->mouse_status);
+    SSMR3PutU8(pSSM, s->mouse_resolution);
+    SSMR3PutU8(pSSM, s->mouse_sample_rate);
+    SSMR3PutU8(pSSM, s->mouse_wrap);
+    SSMR3PutU8(pSSM, s->mouse_type);
+    SSMR3PutU8(pSSM, s->mouse_detect_state);
+    SSMR3PutU32(pSSM, s->mouse_dx);
+    SSMR3PutU32(pSSM, s->mouse_dy);
+    SSMR3PutU32(pSSM, s->mouse_dz);
+    SSMR3PutU32(pSSM, s->mouse_dw);
+    SSMR3PutU32(pSSM, s->mouse_flags);
+    SSMR3PutU8(pSSM, s->mouse_buttons);
+    SSMR3PutU8(pSSM, s->mouse_buttons_reported);
 
     cItems = s->mouse_command_queue.count;
-    SSMR3PutU32(f, cItems);
+    SSMR3PutU32(pSSM, cItems);
     for (i = s->mouse_command_queue.rptr; cItems-- > 0; i = (i + 1) % RT_ELEMENTS(s->mouse_command_queue.data))
-        SSMR3PutU8(f, s->mouse_command_queue.data[i]);
+        SSMR3PutU8(pSSM, s->mouse_command_queue.data[i]);
     Log(("kbd_save: %d mouse command queue items stored\n", s->mouse_command_queue.count));
 
     cItems = s->mouse_event_queue.count;
-    SSMR3PutU32(f, cItems);
+    SSMR3PutU32(pSSM, cItems);
     for (i = s->mouse_event_queue.rptr; cItems-- > 0; i = (i + 1) % RT_ELEMENTS(s->mouse_event_queue.data))
-        SSMR3PutU8(f, s->mouse_event_queue.data[i]);
+        SSMR3PutU8(pSSM, s->mouse_event_queue.data[i]);
     Log(("kbd_save: %d mouse event queue items stored\n", s->mouse_event_queue.count));
 #endif
 
     /* terminator */
-    SSMR3PutU32(f, ~0);
+    SSMR3PutU32(pSSM, ~0);
 }
 
-static int kbd_load(QEMUFile* f, void* opaque, int version_id)
+static int kbd_load(PSSMHANDLE pSSM, KBDState *s, uint32_t version_id)
 {
     uint32_t    u32, i;
     uint8_t u8Dummy;
     uint32_t u32Dummy;
     int         rc;
-    KBDState *s = (KBDState*)opaque;
 
 #if 0
     /** @todo enable this and remove the "if (version_id == 4)" code at some
@@ -1135,50 +1139,87 @@ static int kbd_load(QEMUFile* f, void* opaque, int version_id)
 #endif
     if (version_id < 2 || version_id > PCKBD_SAVED_STATE_VERSION)
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
-    qemu_get_8s(f, &s->write_cmd);
-    qemu_get_8s(f, &s->status);
-    qemu_get_8s(f, &s->mode);
+    SSMR3GetU8(pSSM, &s->write_cmd);
+    SSMR3GetU8(pSSM, &s->status);
+    SSMR3GetU8(pSSM, &s->mode);
     if (version_id <= 5)
     {
-        qemu_get_be32s(f, (uint32_t *)&u32Dummy);
-        qemu_get_be32s(f, (uint32_t *)&u32Dummy);
+        SSMR3GetU32(pSSM, (uint32_t *)&u32Dummy);
+        SSMR3GetU32(pSSM, (uint32_t *)&u32Dummy);
     }
     else
     {
-        qemu_get_8s(f, &s->dbbout);
+        SSMR3GetU8(pSSM, &s->dbbout);
     }
 #ifndef VBOX_WITH_NEW_PS2M
-    qemu_get_be32s(f, (uint32_t *)&s->mouse_write_cmd);
-    qemu_get_8s(f, &s->mouse_status);
-    qemu_get_8s(f, &s->mouse_resolution);
-    qemu_get_8s(f, &s->mouse_sample_rate);
-    qemu_get_8s(f, &s->mouse_wrap);
-    qemu_get_8s(f, &s->mouse_type);
-    qemu_get_8s(f, &s->mouse_detect_state);
-    qemu_get_be32s(f, (uint32_t *)&s->mouse_dx);
-    qemu_get_be32s(f, (uint32_t *)&s->mouse_dy);
-    qemu_get_be32s(f, (uint32_t *)&s->mouse_dz);
+    SSMR3GetU32(pSSM, (uint32_t *)&s->mouse_write_cmd);
+    SSMR3GetU8(pSSM, &s->mouse_status);
+    SSMR3GetU8(pSSM, &s->mouse_resolution);
+    SSMR3GetU8(pSSM, &s->mouse_sample_rate);
+    SSMR3GetU8(pSSM, &s->mouse_wrap);
+    SSMR3GetU8(pSSM, &s->mouse_type);
+    SSMR3GetU8(pSSM, &s->mouse_detect_state);
+    SSMR3GetU32(pSSM, (uint32_t *)&s->mouse_dx);
+    SSMR3GetU32(pSSM, (uint32_t *)&s->mouse_dy);
+    SSMR3GetU32(pSSM, (uint32_t *)&s->mouse_dz);
     if (version_id > 2)
     {
-        SSMR3GetS32(f, &s->mouse_dw);
-        SSMR3GetS32(f, &s->mouse_flags);
+        SSMR3GetS32(pSSM, &s->mouse_dw);
+        SSMR3GetS32(pSSM, &s->mouse_flags);
     }
-    qemu_get_8s(f, &s->mouse_buttons);
+    SSMR3GetU8(pSSM, &s->mouse_buttons);
     if (version_id == 4)
     {
-        SSMR3GetU32(f, &u32Dummy);
-        SSMR3GetU32(f, &u32Dummy);
+        SSMR3GetU32(pSSM, &u32Dummy);
+        SSMR3GetU32(pSSM, &u32Dummy);
     }
     if (version_id > 3)
-        SSMR3GetU8(f, &s->mouse_buttons_reported);
+        SSMR3GetU8(pSSM, &s->mouse_buttons_reported);
     if (version_id == 4)
-        SSMR3GetU8(f, &u8Dummy);
+        SSMR3GetU8(pSSM, &u8Dummy);
     s->mouse_command_queue.count = 0;
     s->mouse_command_queue.rptr = 0;
     s->mouse_command_queue.wptr = 0;
     s->mouse_event_queue.count = 0;
     s->mouse_event_queue.rptr = 0;
     s->mouse_event_queue.wptr = 0;
+#else
+    if (version_id <= 7)
+    {
+        int32_t     i32Dummy;
+        uint8_t     u8State;
+        uint8_t     u8Rate;
+        uint8_t     u8Proto;
+
+        SSMR3GetU32(pSSM, &u32Dummy);
+        SSMR3GetU8(pSSM, &u8State);
+        SSMR3GetU8(pSSM, &u8Dummy);
+        SSMR3GetU8(pSSM, &u8Rate);
+        SSMR3GetU8(pSSM, &u8Dummy);
+        SSMR3GetU8(pSSM, &u8Proto);
+        SSMR3GetU8(pSSM, &u8Dummy);
+        SSMR3GetS32(pSSM, &i32Dummy);
+        SSMR3GetS32(pSSM, &i32Dummy);
+        SSMR3GetS32(pSSM, &i32Dummy);
+        if (version_id > 2)
+        {
+            SSMR3GetS32(pSSM, &i32Dummy);
+            SSMR3GetS32(pSSM, &i32Dummy);
+        }
+        rc = SSMR3GetU8(pSSM, &u8Dummy);
+        if (version_id == 4)
+        {
+            SSMR3GetU32(pSSM, &u32Dummy);
+            rc = SSMR3GetU32(pSSM, &u32Dummy);
+        }
+        if (version_id > 3)
+            rc = SSMR3GetU8(pSSM, &u8Dummy);
+        if (version_id == 4)
+            rc = SSMR3GetU8(pSSM, &u8Dummy);
+        AssertLogRelRCReturn(rc, rc);
+
+        PS2MFixupState(&s->Aux, u8State, u8Rate, u8Proto);
+    }
 #endif
 
     /* Determine the translation state. */
@@ -1189,12 +1230,12 @@ static int kbd_load(QEMUFile* f, void* opaque, int version_id)
      */
     if (version_id <= 5)
     {
-        rc = SSMR3GetU32(f, &u32);
+        rc = SSMR3GetU32(pSSM, &u32);
         if (RT_FAILURE(rc))
             return rc;
         for (i = 0; i < u32; i++)
         {
-            rc = SSMR3GetU8(f, &u8Dummy);
+            rc = SSMR3GetU8(pSSM, &u8Dummy);
             if (RT_FAILURE(rc))
                 return rc;
         }
@@ -1202,7 +1243,7 @@ static int kbd_load(QEMUFile* f, void* opaque, int version_id)
     }
 
 #ifndef VBOX_WITH_NEW_PS2M
-    rc = SSMR3GetU32(f, &u32);
+    rc = SSMR3GetU32(pSSM, &u32);
     if (RT_FAILURE(rc))
         return rc;
     if (u32 > RT_ELEMENTS(s->mouse_command_queue.data))
@@ -1212,7 +1253,7 @@ static int kbd_load(QEMUFile* f, void* opaque, int version_id)
     }
     for (i = 0; i < u32; i++)
     {
-        rc = SSMR3GetU8(f, &s->mouse_command_queue.data[i]);
+        rc = SSMR3GetU8(pSSM, &s->mouse_command_queue.data[i]);
         if (RT_FAILURE(rc))
             return rc;
     }
@@ -1220,7 +1261,7 @@ static int kbd_load(QEMUFile* f, void* opaque, int version_id)
     s->mouse_command_queue.count = u32;
     Log(("kbd_load: %d mouse command queue items loaded\n", u32));
 
-    rc = SSMR3GetU32(f, &u32);
+    rc = SSMR3GetU32(pSSM, &u32);
     if (RT_FAILURE(rc))
         return rc;
     if (u32 > RT_ELEMENTS(s->mouse_event_queue.data))
@@ -1230,7 +1271,7 @@ static int kbd_load(QEMUFile* f, void* opaque, int version_id)
     }
     for (i = 0; i < u32; i++)
     {
-        rc = SSMR3GetU8(f, &s->mouse_event_queue.data[i]);
+        rc = SSMR3GetU8(pSSM, &s->mouse_event_queue.data[i]);
         if (RT_FAILURE(rc))
             return rc;
     }
@@ -1238,23 +1279,34 @@ static int kbd_load(QEMUFile* f, void* opaque, int version_id)
     s->mouse_event_queue.count = u32;
     Log(("kbd_load: %d mouse event queue items loaded\n", u32));
 #else
-    if (version_id <= 6)
+    if (version_id <= 7)
     {
-        rc = SSMR3GetU32(f, &u32);
+        rc = SSMR3GetU32(pSSM, &u32);
         if (RT_FAILURE(rc))
             return rc;
         for (i = 0; i < u32; i++)
         {
-            rc = SSMR3GetU8(f, &u8Dummy);
+            rc = SSMR3GetU8(pSSM, &u8Dummy);
             if (RT_FAILURE(rc))
                 return rc;
         }
         Log(("kbd_load: %d mouse event queue items discarded from old saved state\n", u32));
+
+        rc = SSMR3GetU32(pSSM, &u32);
+        if (RT_FAILURE(rc))
+            return rc;
+        for (i = 0; i < u32; i++)
+        {
+            rc = SSMR3GetU8(pSSM, &u8Dummy);
+            if (RT_FAILURE(rc))
+                return rc;
+        }
+        Log(("kbd_load: %d mouse command queue items discarded from old saved state\n", u32));
     }
 #endif
 
     /* terminator */
-    rc = SSMR3GetU32(f, &u32);
+    rc = SSMR3GetU32(pSSM, &u32);
     if (RT_FAILURE(rc))
         return rc;
     if (u32 != ~0U)
@@ -1315,10 +1367,10 @@ PDMBOTHCBDECL(int) kbdIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT
 {
     int rc = VINF_SUCCESS;
     NOREF(pvUser);
-    if (cb == 1)
+    if (cb == 1 || cb == 2)
     {
         KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *);
-        rc = kbd_write_data(pThis, Port, u32);
+        rc = kbd_write_data(pThis, Port, (uint8_t)u32);
         Log2(("kbdIOPortDataWrite: Port=%#x cb=%d u32=%#x\n", Port, cb, u32));
     }
     else
@@ -1339,16 +1391,21 @@ PDMBOTHCBDECL(int) kbdIOPortDataWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT
  */
 PDMBOTHCBDECL(int) kbdIOPortStatusRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb)
 {
+    uint16_t    fluff = 0;
+    KBDState    *pThis = PDMINS_2_DATA(pDevIns, KBDState *);
+
     NOREF(pvUser);
-    if (cb == 1)
-    {
-        KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *);
-        *pu32 = kbd_read_status(pThis, Port);
+    switch (cb) {
+    case 2:
+        fluff = 0xff00;
+    case 1:
+        *pu32 = fluff | kbd_read_status(pThis, Port);
         Log2(("kbdIOPortStatusRead: Port=%#x cb=%d -> *pu32=%#x\n", Port, cb, *pu32));
         return VINF_SUCCESS;
+    default:
+        AssertMsgFailed(("Port=%#x cb=%d\n", Port, cb));
+        return VERR_IOM_IOPORT_UNUSED;
     }
-    AssertMsgFailed(("Port=%#x cb=%d\n", Port, cb));
-    return VERR_IOM_IOPORT_UNUSED;
 }
 
 /**
@@ -1366,10 +1423,10 @@ PDMBOTHCBDECL(int) kbdIOPortCommandWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOP
 {
     int rc = VINF_SUCCESS;
     NOREF(pvUser);
-    if (cb == 1)
+    if (cb == 1 || cb == 2)
     {
         KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *);
-        rc = kbd_write_command(pThis, Port, u32);
+        rc = kbd_write_command(pThis, Port, (uint8_t)u32);
         Log2(("kbdIOPortCommandWrite: Port=%#x cb=%d u32=%#x rc=%Rrc\n", Port, cb, u32, rc));
     }
     else
@@ -1417,7 +1474,7 @@ static DECLCALLBACK(int) kbdLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32
     if (uVersion >= 6)
         rc = PS2KLoadState(&pThis->Kbd, pSSM, uVersion);
 #ifdef VBOX_WITH_NEW_PS2M
-    if (uVersion >= 7)
+    if (uVersion >= 8)
         rc = PS2MLoadState(&pThis->Aux, pSSM, uVersion);
 #endif
     return rc;
@@ -1666,7 +1723,6 @@ static DECLCALLBACK(int) kbdConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNO
     rc = CFGMR3QueryBoolDef(pCfg, "R0Enabled", &fR0Enabled, true);
     if (RT_FAILURE(rc))
         return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to query \"R0Enabled\" from the config"));
-fGCEnabled = fR0Enabled = false;
     Log(("pckbd: fGCEnabled=%RTbool fR0Enabled=%RTbool\n", fGCEnabled, fR0Enabled));
 
 
diff --git a/src/VBox/Devices/Input/DrvKeyboardQueue.cpp b/src/VBox/Devices/Input/DrvKeyboardQueue.cpp
index c14e4ee..48027a1 100644
--- a/src/VBox/Devices/Input/DrvKeyboardQueue.cpp
+++ b/src/VBox/Devices/Input/DrvKeyboardQueue.cpp
@@ -31,6 +31,14 @@
 /*******************************************************************************
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
+
+/** Scancode translator state.  */
+typedef enum {
+    SS_IDLE,    /**< Starting state. */
+    SS_EXT,     /**< E0 byte was received. */
+    SS_EXT1     /**< E1 byte was received. */
+} scan_state_t;
+
 /**
  * Keyboard queue driver instance data.
  *
@@ -51,6 +59,8 @@ typedef struct DRVKBDQUEUE
     PDMIKEYBOARDPORT            IPort;
     /** The queue handle. */
     PPDMQUEUE                   pQueue;
+    /** State of the scancode translation. */
+    scan_state_t                XlatState;
     /** Discard input when this flag is set. */
     bool                        fInactive;
     /** When VM is suspended, queue full errors are not fatal. */
@@ -66,10 +76,110 @@ typedef struct DRVKBDQUEUEITEM
     /** The core part owned by the queue manager. */
     PDMQUEUEITEMCORE    Core;
     /** The keycode. */
-    uint8_t             u8KeyCode;
+    uint32_t            u32UsageCode;
 } DRVKBDQUEUEITEM, *PDRVKBDQUEUEITEM;
 
 
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+
+/** Lookup table for converting PC/XT scan codes to USB HID usage codes. */
+static const uint8_t aScancode2Hid[] =
+{
+    0x00, 0x29, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, /* 00-07 */
+    0x24, 0x25, 0x26, 0x27, 0x2d, 0x2e, 0x2a, 0x2b, /* 08-1F */
+    0x14, 0x1a, 0x08, 0x15, 0x17, 0x1c, 0x18, 0x0c, /* 10-17 */
+    0x12, 0x13, 0x2f, 0x30, 0x28, 0xe0, 0x04, 0x16, /* 18-1F */
+    0x07, 0x09, 0x0a, 0x0b, 0x0d, 0x0e, 0x0f, 0x33, /* 20-27 */
+    0x34, 0x35, 0xe1, 0x31, 0x1d, 0x1b, 0x06, 0x19, /* 28-2F */
+    0x05, 0x11, 0x10, 0x36, 0x37, 0x38, 0xe5, 0x55, /* 30-37 */
+    0xe2, 0x2c, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, /* 38-3F */
+    0x3f, 0x40, 0x41, 0x42, 0x43, 0x53, 0x47, 0x5f, /* 40-47 */
+    0x60, 0x61, 0x56, 0x5c, 0x5d, 0x5e, 0x57, 0x59, /* 48-4F */
+    0x5a, 0x5b, 0x62, 0x63, 0x46, 0x00, 0x64, 0x44, /* 50-57 */
+    0x45, 0x67, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 58-5F */
+    0x00, 0x00, 0x00, 0x00, 0x68, 0x69, 0x6a, 0x6b, /* 60-67 */
+    0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, /* 68-6F */
+    0x88, 0x91, 0x90, 0x87, 0x00, 0x00, 0x00, 0x00, /* 70-77 */
+    0x00, 0x8a, 0x00, 0x8b, 0x00, 0x89, 0x85, 0x00  /* 78-7F */
+};
+
+/** Lookup table for extended scancodes (arrow keys etc.). */
+static const uint8_t aExtScan2Hid[] =
+{
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00-07 */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 08-1F */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10-17 */
+    0x00, 0x00, 0x00, 0x00, 0x58, 0xe4, 0x00, 0x00, /* 18-1F */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 20-27 */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28-2F */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x46, /* 30-37 */
+    /* Sun-specific keys.  Most of the XT codes are made up  */
+    0xe6, 0x00, 0x00, 0x75, 0x76, 0x77, 0xA3, 0x78, /* 38-3F */
+    0x80, 0x81, 0x82, 0x79, 0x00, 0x00, 0x48, 0x4a, /* 40-47 */
+    0x52, 0x4b, 0x00, 0x50, 0x00, 0x4f, 0x00, 0x4d, /* 48-4F */
+    0x51, 0x4e, 0x49, 0x4c, 0x00, 0x00, 0x00, 0x00, /* 50-57 */
+    0x00, 0x00, 0x00, 0xe3, 0xe7, 0x65, 0x66, 0x00, /* 58-5F */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 60-67 */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 68-6F */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 70-77 */
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  /* 78-7F */
+};
+
+/**
+ * Convert a PC scan code to a USB HID usage byte.
+ *
+ * @param state         Current state of the translator (scan_state_t).
+ * @param scanCode      Incoming scan code.
+ * @param pUsage        Pointer to usage; high bit set for key up events. The
+ *                      contents are only valid if returned state is SS_IDLE.
+ *
+ * @return scan_state_t New state of the translator.
+ */
+static scan_state_t ScancodeToHidUsage(scan_state_t state, uint8_t scanCode, uint32_t *pUsage)
+{
+    uint32_t    keyUp;
+    uint8_t     usage;
+
+    Assert(pUsage);
+
+    /* Isolate the scan code and key break flag. */
+    keyUp = (scanCode & 0x80) << 24;
+
+    switch (state) {
+    case SS_IDLE:
+        if (scanCode == 0xE0) {
+            state = SS_EXT;
+        } else if (scanCode == 0xE1) {
+            state = SS_EXT1;
+        } else {
+            usage = aScancode2Hid[scanCode & 0x7F];
+            *pUsage = usage | keyUp;
+            /* Remain in SS_IDLE state. */
+        }
+        break;
+    case SS_EXT:
+        usage = aExtScan2Hid[scanCode & 0x7F];
+        *pUsage = usage | keyUp;
+        state = SS_IDLE;
+        break;
+    case SS_EXT1:
+        /* The sequence is E1 1D 45 E1 9D C5. We take the easy way out and remain
+         * in the SS_EXT1 state until 45 or C5 is received.
+         */
+        if ((scanCode & 0x7F) == 0x45) {
+            *pUsage = 0x48;
+            if (scanCode == 0xC5)
+                *pUsage |= keyUp;
+            state = SS_IDLE;
+        }
+        /* Else remain in SS_EXT1 state. */
+        break;
+    }
+    return state;
+}
+
 
 /* -=-=-=-=- IBase -=-=-=-=- */
 
@@ -100,26 +210,54 @@ static DECLCALLBACK(void *)  drvKbdQueueQueryInterface(PPDMIBASE pInterface, con
  *
  * @returns VBox status code.
  * @param   pInterface          Pointer to this interface structure.
- * @param   u8KeyCode           The keycode to queue.
+ * @param   u8ScanCode          The scan code to translate/queue.
  * @thread  Any thread.
  */
-static DECLCALLBACK(int) drvKbdQueuePutEvent(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode)
+static DECLCALLBACK(int) drvKbdQueuePutEventScan(PPDMIKEYBOARDPORT pInterface, uint8_t u8ScanCode)
 {
     PDRVKBDQUEUE pDrv = IKEYBOARDPORT_2_DRVKBDQUEUE(pInterface);
     /* Ignore any attempt to send events if queue is inactive. */
     if (pDrv->fInactive)
         return VINF_SUCCESS;
 
-    PDRVKBDQUEUEITEM pItem = (PDRVKBDQUEUEITEM)PDMQueueAlloc(pDrv->pQueue);
-    if (pItem)
-    {
-        pItem->u8KeyCode = u8KeyCode;
-        PDMQueueInsert(pDrv->pQueue, &pItem->Core);
-        return VINF_SUCCESS;
+    uint32_t    u32Usage = 0;
+    pDrv->XlatState = ScancodeToHidUsage(pDrv->XlatState, u8ScanCode, &u32Usage);
+
+    if (pDrv->XlatState == SS_IDLE) {
+        PDRVKBDQUEUEITEM pItem = (PDRVKBDQUEUEITEM)PDMQueueAlloc(pDrv->pQueue);
+        if (pItem)
+        {
+            /*
+             * Work around incredibly poorly desgined Korean keyboards which
+             * only send break events for Hangul/Hanja keys -- convert a lone
+             * key up into a key up/key down sequence.
+             */
+            if (u32Usage == 0x80000090 || u32Usage == 0x80000091)
+            {
+                PDRVKBDQUEUEITEM pItem2 = (PDRVKBDQUEUEITEM)PDMQueueAlloc(pDrv->pQueue);
+                /*
+                 * NB: If there's no room in the queue, we will drop the faked
+                 * key down event. Probably less bad than the alternatives.
+                 */
+                if (pItem2)
+                {
+                    /* Manufacture a key down event. */
+                    pItem2->u32UsageCode = u32Usage & ~0x80000000;
+                    PDMQueueInsert(pDrv->pQueue, &pItem2->Core);
+                }
+            }
+
+            pItem->u32UsageCode = u32Usage;
+            PDMQueueInsert(pDrv->pQueue, &pItem->Core);
+
+            return VINF_SUCCESS;
+        }
+        if (!pDrv->fSuspended)
+            AssertMsgFailed(("drvKbdQueuePutEventScan: Queue is full!!!!\n"));
+        return VERR_PDM_NO_QUEUE_ITEMS;
     }
-    if (!pDrv->fSuspended)
-        AssertMsgFailed(("drvKbdQueuePutEvent: Queue is full!!!!\n"));
-    return VERR_PDM_NO_QUEUE_ITEMS;
+    else
+        return VINF_SUCCESS;
 }
 
 
@@ -154,6 +292,19 @@ static DECLCALLBACK(void) drvKbdPassThruSetActive(PPDMIKEYBOARDCONNECTOR pInterf
     pDrv->pDownConnector->pfnSetActive(pDrv->pDownConnector, fActive);
 }
 
+/**
+ * Flush the keyboard queue if there are pending events.
+ *
+ * @param   pInterface  Pointer to the keyboard connector interface structure.
+ */
+static DECLCALLBACK(void) drvKbdFlushQueue(PPDMIKEYBOARDCONNECTOR pInterface)
+{
+    PDRVKBDQUEUE pDrv = PPDMIKEYBOARDCONNECTOR_2_DRVKBDQUEUE(pInterface);
+
+    AssertPtr(pDrv->pQueue);
+    PDMQueueFlushIfNecessary(pDrv->pQueue);
+}
+
 
 /* -=-=-=-=- queue -=-=-=-=- */
 
@@ -169,7 +320,7 @@ static DECLCALLBACK(bool) drvKbdQueueConsumer(PPDMDRVINS pDrvIns, PPDMQUEUEITEMC
 {
     PDRVKBDQUEUE        pThis = PDMINS_2_DATA(pDrvIns, PDRVKBDQUEUE);
     PDRVKBDQUEUEITEM    pItem = (PDRVKBDQUEUEITEM)pItemCore;
-    int rc = pThis->pUpPort->pfnPutEvent(pThis->pUpPort, pItem->u8KeyCode);
+    int rc = pThis->pUpPort->pfnPutEventHid(pThis->pUpPort, pItem->u32UsageCode);
     return RT_SUCCESS(rc);
 }
 
@@ -263,13 +414,15 @@ static DECLCALLBACK(int) drvKbdQueueConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg
      */
     pDrv->fInactive                         = true;
     pDrv->fSuspended                        = false;
+    pDrv->XlatState                         = SS_IDLE;
     /* IBase. */
     pDrvIns->IBase.pfnQueryInterface        = drvKbdQueueQueryInterface;
     /* IKeyboardConnector. */
     pDrv->IConnector.pfnLedStatusChange     = drvKbdPassThruLedsChange;
     pDrv->IConnector.pfnSetActive           = drvKbdPassThruSetActive;
+    pDrv->IConnector.pfnFlushQueue          = drvKbdFlushQueue;
     /* IKeyboardPort. */
-    pDrv->IPort.pfnPutEvent                 = drvKbdQueuePutEvent;
+    pDrv->IPort.pfnPutEventScan             = drvKbdQueuePutEventScan;
 
     /*
      * Get the IKeyboardPort interface of the above driver/device.
diff --git a/src/VBox/Devices/Input/DrvMouseQueue.cpp b/src/VBox/Devices/Input/DrvMouseQueue.cpp
index 9d0a8d2..1528dd2 100644
--- a/src/VBox/Devices/Input/DrvMouseQueue.cpp
+++ b/src/VBox/Devices/Input/DrvMouseQueue.cpp
@@ -203,6 +203,20 @@ static DECLCALLBACK(void) drvMousePassThruReportModes(PPDMIMOUSECONNECTOR pInter
 }
 
 
+/**
+ * Flush the mouse queue if there are pending events.
+ *
+ * @param   pInterface  Pointer to the mouse connector interface structure.
+ */
+static DECLCALLBACK(void) drvMouseFlushQueue(PPDMIMOUSECONNECTOR pInterface)
+{
+    PDRVMOUSEQUEUE pDrv = PPDMIMOUSECONNECTOR_2_DRVMOUSEQUEUE(pInterface);
+
+    AssertPtr(pDrv->pQueue);
+    PDMQueueFlushIfNecessary(pDrv->pQueue);
+}
+
+
 
 /* -=-=-=-=- queue -=-=-=-=- */
 
diff --git a/src/VBox/Devices/Input/PS2Dev.h b/src/VBox/Devices/Input/PS2Dev.h
index bdb3243..09a960c 100644
--- a/src/VBox/Devices/Input/PS2Dev.h
+++ b/src/VBox/Devices/Input/PS2Dev.h
@@ -1,3 +1,4 @@
+/* $Id: PS2Dev.h $ */
 /** @file
  * PS/2 devices - Internal header file.
  */
@@ -67,6 +68,7 @@ void PS2MReset(PPS2M pThis);
 void PS2MRelocate(PPS2M pThis, RTGCINTPTR offDelta, PPDMDEVINS pDevIns);
 void PS2MSaveState(PPS2M pThis, PSSMHANDLE pSSM);
 int  PS2MLoadState(PPS2M pThis, PSSMHANDLE pSSM, uint32_t uVersion);
+void PS2MFixupState(PPS2M pThis, uint8_t u8State, uint8_t u8Rate, uint8_t u8Proto);
 
 PS2M *KBDGetPS2MFromDevIns(PPDMDEVINS pDevIns);
 
diff --git a/src/VBox/Devices/Input/PS2K.cpp b/src/VBox/Devices/Input/PS2K.cpp
index 33febea..08ea32d 100644
--- a/src/VBox/Devices/Input/PS2K.cpp
+++ b/src/VBox/Devices/Input/PS2K.cpp
@@ -1,3 +1,4 @@
+/* $Id: PS2K.cpp $ */
 /** @file
  * PS2K - PS/2 keyboard emulation.
  */
@@ -461,112 +462,6 @@ static const   key_def   aPS2ModKeys[] = {
 *   Global Variables                                                           *
 *******************************************************************************/
 
-/*
- * Because of historical reasons and poor design, VirtualBox internally uses BIOS
- * PC/XT style scan codes to represent keyboard events. Each key press and release is
- * represented as a stream of bytes, typically only one byte but up to four-byte
- * sequences are possible. In the typical case, the GUI front end generates the stream
- * of scan codes which we need to translate back to a single up/down event.
- *
- * This function could possibly live somewhere else.
- */
-
-/** Lookup table for converting PC/XT scan codes to USB HID usage codes. */
-static uint8_t aScancode2Hid[] =
-{
-    0x00, 0x29, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, /* 00-07 */
-    0x24, 0x25, 0x26, 0x27, 0x2d, 0x2e, 0x2a, 0x2b, /* 08-1F */
-    0x14, 0x1a, 0x08, 0x15, 0x17, 0x1c, 0x18, 0x0c, /* 10-17 */
-    0x12, 0x13, 0x2f, 0x30, 0x28, 0xe0, 0x04, 0x16, /* 18-1F */
-    0x07, 0x09, 0x0a, 0x0b, 0x0d, 0x0e, 0x0f, 0x33, /* 20-27 */
-    0x34, 0x35, 0xe1, 0x31, 0x1d, 0x1b, 0x06, 0x19, /* 28-2F */
-    0x05, 0x11, 0x10, 0x36, 0x37, 0x38, 0xe5, 0x55, /* 30-37 */
-    0xe2, 0x2c, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, /* 38-3F */
-    0x3f, 0x40, 0x41, 0x42, 0x43, 0x53, 0x47, 0x5f, /* 40-47 */
-    0x60, 0x61, 0x56, 0x5c, 0x5d, 0x5e, 0x57, 0x59, /* 48-4F */
-    0x5a, 0x5b, 0x62, 0x63, 0x46, 0x00, 0x64, 0x44, /* 50-57 */
-    0x45, 0x67, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 58-5F */
-    0x00, 0x00, 0x00, 0x00, 0x68, 0x69, 0x6a, 0x6b, /* 60-67 */
-    0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, /* 68-6F */
-    0x88, 0x91, 0x90, 0x87, 0x00, 0x00, 0x00, 0x00, /* 70-77 */
-    0x00, 0x8a, 0x00, 0x8b, 0x00, 0x89, 0x85, 0x00  /* 78-7F */
-};
-
-/** Lookup table for extended scancodes (arrow keys etc.). */
-static uint8_t aExtScan2Hid[] =
-{
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00-07 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 08-1F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10-17 */
-    0x00, 0x00, 0x00, 0x00, 0x58, 0xe4, 0x00, 0x00, /* 18-1F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 20-27 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28-2F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x46, /* 30-37 */
-    /* Sun-specific keys.  Most of the XT codes are made up  */
-    0xe6, 0x00, 0x00, 0x75, 0x76, 0x77, 0xA3, 0x78, /* 38-3F */
-    0x80, 0x81, 0x82, 0x79, 0x00, 0x00, 0x48, 0x4a, /* 40-47 */
-    0x52, 0x4b, 0x00, 0x50, 0x00, 0x4f, 0x00, 0x4d, /* 48-4F */
-    0x51, 0x4e, 0x49, 0x4c, 0x00, 0x00, 0x00, 0x00, /* 50-57 */
-    0x00, 0x00, 0x00, 0xe3, 0xe7, 0x65, 0x66, 0x00, /* 58-5F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 60-67 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 68-6F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 70-77 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  /* 78-7F */
-};
-
-/**
- * Convert a PC scan code to a USB HID usage byte.
- *
- * @param state         Current state of the translator (scan_state_t).
- * @param scanCode      Incoming scan code.
- * @param pUsage        Pointer to usage; high bit set for key up events. The
- *                      contents are only valid if returned state is SS_IDLE.
- *
- * @return scan_state_t New state of the translator.
- */
-static scan_state_t ScancodeToHidUsage(scan_state_t state, uint8_t scanCode, uint32_t *pUsage)
-{
-    uint32_t    keyUp;
-    uint8_t     usage;
-
-    Assert(pUsage);
-
-    /* Isolate the scan code and key break flag. */
-    keyUp = (scanCode & 0x80) << 24;
-
-    switch (state) {
-    case SS_IDLE:
-        if (scanCode == 0xE0) {
-            state = SS_EXT;
-        } else if (scanCode == 0xE1) {
-            state = SS_EXT1;
-        } else {
-            usage = aScancode2Hid[scanCode & 0x7F];
-            *pUsage = usage | keyUp;
-            /* Remain in SS_IDLE state. */
-        }
-        break;
-    case SS_EXT:
-        usage = aExtScan2Hid[scanCode & 0x7F];
-        *pUsage = usage | keyUp;
-        state = SS_IDLE;
-        break;
-    case SS_EXT1:
-        /* The sequence is E1 1D 45 E1 9D C5. We take the easy way out and remain
-         * in the SS_EXT1 state until 45 or C5 is received.
-         */
-        if ((scanCode & 0x7F) == 0x45) {
-            *pUsage = 0x48;
-            if (scanCode == 0xC5)
-                *pUsage |= keyUp;
-            state = SS_IDLE;
-        }
-        /* Else remain in SS_EXT1 state. */
-        break;
-    }
-    return state;
-}
-
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
@@ -596,7 +491,7 @@ static void ps2kInsertQueue(GeneriQ *pQ, uint8_t val)
     /* Check if queue is full. */
     if (pQ->cUsed >= pQ->cSize)
     {
-        LogFlowFunc(("queue %p full (%d entries)\n", pQ, pQ->cUsed));
+        LogRelFlowFunc(("queue %p full (%d entries)\n", pQ, pQ->cUsed));
         return;
     }
     /* Insert data and update circular buffer write position. */
@@ -604,7 +499,7 @@ static void ps2kInsertQueue(GeneriQ *pQ, uint8_t val)
     if (++pQ->wpos == pQ->cSize)
         pQ->wpos = 0;   /* Roll over. */
     ++pQ->cUsed;
-    LogFlowFunc(("inserted 0x%02X into queue %p\n", val, pQ));
+    LogRelFlowFunc(("inserted 0x%02X into queue %p\n", val, pQ));
 }
 
 #ifdef IN_RING3
@@ -642,18 +537,12 @@ static void ps2kSaveQueue(PSSMHANDLE pSSM, GeneriQ *pQ)
  */
 static int ps2kLoadQueue(PSSMHANDLE pSSM, GeneriQ *pQ)
 {
-    int         rc;
-
     /* On load, always put the read pointer at zero. */
-    SSMR3GetU32(pSSM, &pQ->cUsed);
-
-    LogFlow(("Loading %d items to queue %p\n", pQ->cUsed, pQ));
-
-    if (pQ->cUsed > pQ->cSize)
-    {
-        AssertMsgFailed(("Saved size=%u, actual=%u\n", pQ->cUsed, pQ->cSize));
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    }
+    int rc = SSMR3GetU32(pSSM, &pQ->cUsed);
+    AssertRCReturn(rc, rc);
+    LogFlow(("Loading %u items to queue %p\n", pQ->cUsed, pQ));
+    AssertMsgReturn(pQ->cUsed <= pQ->cSize, ("Saved size=%u, actual=%u\n", pQ->cUsed, pQ->cSize),
+                    VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
 
     /* Recalculate queue positions and load data in one go. */
     pQ->rpos = 0;
@@ -755,6 +644,10 @@ int PS2KByteToKbd(PPS2K pThis, uint8_t cmd)
 
     LogFlowFunc(("new cmd=0x%02X, active cmd=0x%02X\n", cmd, pThis->u8CurrCmd));
 
+    if (pThis->u8CurrCmd == KCMD_RESET)
+        /* In reset mode, do not respond at all. */
+        return VINF_SUCCESS;
+
     switch (cmd)
     {
         case KCMD_ECHO:
@@ -896,7 +789,7 @@ int PS2KByteFromKbd(PPS2K pThis, uint8_t *pb)
 
 #ifdef IN_RING3
 
-static int psk2ProcessKeyEvent(PPS2K pThis, uint8_t u8HidCode, bool fKeyDown)
+static int ps2kProcessKeyEvent(PPS2K pThis, uint8_t u8HidCode, bool fKeyDown)
 {
     unsigned int    i = 0;
     key_def const   *pKeyDef;
@@ -1128,7 +1021,7 @@ static DECLCALLBACK(void) ps2kTypematicTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer
 
         if (pThis->enmTypematicState == KBD_TMS_REPEAT)
         {
-            psk2ProcessKeyEvent(pThis, pThis->u8TypematicKey, true /* Key down */ );
+            ps2kProcessKeyEvent(pThis, pThis->u8TypematicKey, true /* Key down */ );
             TMTimerSetMillies(pThis->CTX_SUFF(pKbdTypematicTimer), pThis->uTypematicRepeat);
         }
     }
@@ -1143,7 +1036,7 @@ static DECLCALLBACK(void) ps2kDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, vo
 
     LogFlowFunc(("Delay timer: cmd %02X\n", pThis->u8CurrCmd));
 
-    Assert(pThis->u8CurrCmd == KCMD_RESET);
+    AssertMsg(pThis->u8CurrCmd == KCMD_RESET, ("u8CurrCmd=%02x\n", pThis->u8CurrCmd));
     ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_BAT_OK);
     pThis->fScanning = true;    /* BAT completion enables scanning! */
     pThis->u8CurrCmd = 0;
@@ -1160,13 +1053,11 @@ static DECLCALLBACK(void) ps2kDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, vo
 static void ps2kReleaseKeys(PPS2K pThis)
 {
     LogFlowFunc(("Releasing keys...\n"));
-    LogRel(("Releasing keys...\n"));
 
     for (unsigned uKey = 0; uKey < sizeof(pThis->abDepressedKeys); ++uKey)
         if (pThis->abDepressedKeys[uKey])
         {
-            LogRel(("Releasing key %02X\n", uKey));
-            psk2ProcessKeyEvent(pThis, uKey, false /* key up */);
+            ps2kProcessKeyEvent(pThis, uKey, false /* key up */);
             pThis->abDepressedKeys[uKey] = 0;
         }
     LogFlowFunc(("Done releasing keys\n"));
@@ -1259,7 +1150,7 @@ static int ps2kPutEventWorker(PPS2K pThis, uint32_t u32Usage)
         rc = PDMCritSectEnter(pThis->pCritSectR3, VERR_SEM_BUSY);
         AssertReleaseRC(rc);
 
-        rc = psk2ProcessKeyEvent(pThis, u8HidCode, fKeyDown);
+        rc = ps2kProcessKeyEvent(pThis, u8HidCode, fKeyDown);
 
         PDMCritSectLeave(pThis->pCritSectR3);
     }
@@ -1267,40 +1158,30 @@ static int ps2kPutEventWorker(PPS2K pThis, uint32_t u32Usage)
     return rc;
 }
 
-static DECLCALLBACK(int) ps2kPutEventWrapper(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode)
+static DECLCALLBACK(int) ps2kPutEventWrapper(PPDMIKEYBOARDPORT pInterface, uint32_t u32UsageCode)
 {
     PPS2K       pThis = RT_FROM_MEMBER(pInterface, PS2K, Keyboard.IPort);
-    uint32_t    u32Usage = 0;
     int         rc;
 
-    LogFlowFunc(("key code %02X\n", u8KeyCode));
+    LogRelFlowFunc(("key code %08X\n", u32UsageCode));
+
+    rc = PDMCritSectEnter(pThis->pCritSectR3, VERR_SEM_BUSY);
+    AssertReleaseRC(rc);
 
     /* The 'BAT fail' scancode is reused as a signal to release keys. No actual
      * key is allowed to use this scancode.
      */
-    if (RT_UNLIKELY(u8KeyCode == KRSP_BAT_FAIL))
+    if (RT_UNLIKELY(u32UsageCode == KRSP_BAT_FAIL))
     {
-        rc = PDMCritSectEnter(pThis->pCritSectR3, VERR_SEM_BUSY);
-        AssertReleaseRC(rc);
-
         ps2kReleaseKeys(pThis);
-
-        PDMCritSectLeave(pThis->pCritSectR3);
     }
     else
     {
-        pThis->XlatState = ScancodeToHidUsage(pThis->XlatState, u8KeyCode, &u32Usage);
-
-        if (pThis->XlatState == SS_IDLE)
-        {
-            /* Stupid Korean key hack: convert a lone break key into a press/release sequence. */
-            if (u32Usage == 0x80000090 || u32Usage == 0x80000091)
-                ps2kPutEventWorker(pThis, u32Usage & ~0x80000000);
-
-            ps2kPutEventWorker(pThis, u32Usage);
-        }
+        ps2kPutEventWorker(pThis, u32UsageCode);
     }
 
+    PDMCritSectLeave(pThis->pCritSectR3);
+
     return VINF_SUCCESS;
 }
 
@@ -1513,7 +1394,7 @@ int PS2KConstruct(PPS2K pThis, PPDMDEVINS pDevIns, void *pParent, int iInstance)
     pThis->cmdQ.cSize = KBD_CMD_QUEUE_SIZE;
 
     pThis->Keyboard.IBase.pfnQueryInterface = ps2kQueryInterface;
-    pThis->Keyboard.IPort.pfnPutEvent       = ps2kPutEventWrapper;
+    pThis->Keyboard.IPort.pfnPutEventHid    = ps2kPutEventWrapper;
 
     /*
      * Initialize the critical section pointer(s).
diff --git a/src/VBox/Devices/Input/PS2M.cpp b/src/VBox/Devices/Input/PS2M.cpp
index 6de654b..c49a25b 100644
--- a/src/VBox/Devices/Input/PS2M.cpp
+++ b/src/VBox/Devices/Input/PS2M.cpp
@@ -1,3 +1,4 @@
+/* $Id: PS2M.cpp $ */
 /** @file
  * PS2M - PS/2 auxiliary device (mouse) emulation.
  */
@@ -47,9 +48,9 @@
  * Upon reset, the mouse is always in the standard PS/2 mode. A special 'knock'
  * sequence can be used to switch to ImPS/2 or ImEx mode. Three consecutive
  * Set Sampling Rate (0F3h) commands with arguments 200, 100, 80 switch to ImPS/2
- * mode. While in ImPS/2 mode, three consecutive Set Sampling Rate commands with
- * arguments 200, 200, 80 switch to ImEx mode. The Read ID (0F2h) command will
- * report the currently selected protocol.
+ * mode. While in ImPS/2 or PS/2 mode, three consecutive Set Sampling Rate
+ * commands with arguments 200, 200, 80 switch to ImEx mode. The Read ID (0F2h)
+ * command will report the currently selected protocol.
  *
  *
  * Standard PS/2 pointing device three-byte report packet format:
@@ -124,7 +125,7 @@
 #define ACMD_READ_ID        0xF2    /* Read device ID. */
 #define ACMD_SET_SAMP_RATE  0xF3    /* Set sampling rate. */
 #define ACMD_ENABLE         0xF4    /* Enable (streaming mode). */
-#define ACMD_DFLT_DISABLE   0xF5    /* Disable and set defaults. */
+#define ACMD_DISABLE        0xF5    /* Disable (streaming mode). */
 #define ACMD_SET_DEFAULT    0xF6    /* Set defaults. */
 #define ACMD_INVALID_4      0xF7
 #define ACMD_INVALID_5      0xF8
@@ -181,11 +182,16 @@ typedef enum {
 
 /* Auxiliary device operational state. */
 typedef enum {
-    AUX_STATE_SCALING = RT_BIT(4),  /* 2:1 scaling in effect. */
-    AUX_STATE_ENABLED = RT_BIT(5),  /* Reporting enabled in stream mode. */
-    AUX_STATE_REMOTE  = RT_BIT(6)   /* Remote mode (reports on request). */
+    AUX_STATE_RATE_ERR  = RT_BIT(0),    /* Invalid rate received. */
+    AUX_STATE_RES_ERR   = RT_BIT(1),    /* Invalid resolution received. */
+    AUX_STATE_SCALING   = RT_BIT(4),    /* 2:1 scaling in effect. */
+    AUX_STATE_ENABLED   = RT_BIT(5),    /* Reporting enabled in stream mode. */
+    AUX_STATE_REMOTE    = RT_BIT(6)     /* Remote mode (reports on request). */
 } PS2M_STATE;
 
+/* Externally visible state bits. */
+#define AUX_STATE_EXTERNAL  (AUX_STATE_SCALING | AUX_STATE_ENABLED | AUX_STATE_REMOTE)
+
 /* Protocols supported by the PS/2 mouse. */
 typedef enum {
     PS2M_PROTO_PS2STD = 0,  /* Standard PS/2 mouse protocol. */
@@ -196,9 +202,8 @@ typedef enum {
 /* Protocol selection 'knock' states. */
 typedef enum {
     PS2M_KNOCK_INITIAL,
-    PS2M_KNOCK_IMPS2_1ST,
+    PS2M_KNOCK_1ST,
     PS2M_KNOCK_IMPS2_2ND,
-    PS2M_KNOCK_IMEX_1ST,
     PS2M_KNOCK_IMEX_2ND
 } PS2M_KNOCK_STATE;
 
@@ -219,6 +224,8 @@ typedef struct PS2M
     uint8_t             u8CurrCmd;
     /** Set if the throttle delay is active. */
     bool                fThrottleActive;
+    /** Set if the throttle delay is active. */
+    bool                fDelayReset;
     /** Operational mode. */
     PS2M_MODE           enmMode;
     /** Currently used protocol. */
@@ -237,11 +244,12 @@ typedef struct PS2M
     int32_t             iAccumZ;
     /** Accumulated button presses. */
     uint32_t            fAccumB;
+    /** Instantaneous button data. */
+    uint32_t            fCurrB;
+    /** Button state last sent to the guest. */
+    uint32_t            fReportedB;
     /** Throttling delay in milliseconds. */
-    unsigned            uThrottleDelay;
-#if HC_ARCH_BITS == 32
-    uint32_t            Alignment0;
-#endif
+    uint32_t            uThrottleDelay;
 
     /** The device critical section protecting everything - R3 Ptr */
     R3PTRTYPE(PPDMCRITSECT) pCritSectR3;
@@ -285,15 +293,6 @@ AssertCompile(PS2M_STRUCT_FILLER >= sizeof(PS2M));
 
 #ifndef VBOX_DEVICE_STRUCT_TESTCASE
 
-/* Key type flags. */
-#define KF_E0        0x01    /* E0 prefix. */
-#define KF_NB        0x02    /* No break code. */
-#define KF_GK        0x04    /* Gray navigation key. */
-#define KF_PS        0x08    /* Print Screen key. */
-#define KF_PB        0x10    /* Pause/Break key. */
-#define KF_NL        0x20    /* Num Lock key. */
-#define KF_NS        0x40    /* NumPad '/' key. */
-
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
@@ -328,7 +327,7 @@ static void ps2kInsertQueue(GeneriQ *pQ, uint8_t val)
     /* Check if queue is full. */
     if (pQ->cUsed >= pQ->cSize)
     {
-        LogFlowFunc(("queue %p full (%d entries)\n", pQ, pQ->cUsed));
+        LogRelFlowFunc(("queue %p full (%d entries)\n", pQ, pQ->cUsed));
         return;
     }
     /* Insert data and update circular buffer write position. */
@@ -336,7 +335,7 @@ static void ps2kInsertQueue(GeneriQ *pQ, uint8_t val)
     if (++pQ->wpos == pQ->cSize)
         pQ->wpos = 0;   /* Roll over. */
     ++pQ->cUsed;
-    LogFlowFunc(("inserted 0x%02X into queue %p\n", val, pQ));
+    LogRelFlowFunc(("inserted 0x%02X into queue %p\n", val, pQ));
 }
 
 #ifdef IN_RING3
@@ -403,6 +402,18 @@ static void ps2mSetDriverState(PPS2M pThis, bool fEnabled)
         pDrv->pfnReportModes(pDrv, fEnabled, false, false);
 }
 
+/* Reset the pointing device. */
+static void ps2mReset(PPS2M pThis)
+{
+    ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_BAT_OK);
+    ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, 0);
+    pThis->enmMode   = AUX_MODE_STD;
+    pThis->u8CurrCmd = 0;
+
+    //@todo: move to its proper home!
+    ps2mSetDriverState(pThis, true);
+}
+
 #endif /* IN_RING3 */
 
 /**
@@ -434,7 +445,8 @@ static int ps2kRemoveQueue(GeneriQ *pQ, uint8_t *pVal)
 
 static void ps2mSetRate(PPS2M pThis, uint8_t rate)
 {
-    pThis->uThrottleDelay = 1000 / rate;
+    Assert(rate);
+    pThis->uThrottleDelay = rate ? 1000 / rate : 0;
     pThis->u8SampleRate = rate;
     LogFlowFunc(("Sampling rate %u, throttle delay %u ms\n", pThis->u8SampleRate, pThis->uThrottleDelay));
 }
@@ -450,62 +462,117 @@ static void ps2mSetDefaults(PPS2M pThis)
     /* Sample rate 100 reports per second. */
     ps2mSetRate(pThis, 100);
 
-    /* Accumulators and button status bits are cleared. */
+    /* Event queue, eccumulators, and button status bits are cleared. */
     ps2kClearQueue((GeneriQ *)&pThis->evtQ);
-    //@todo accumulators/current state
+    pThis->iAccumX = pThis->iAccumY = pThis->iAccumZ = pThis->fAccumB;
 }
 
 /* Handle the sampling rate 'knock' sequence which selects protocol. */
 static void ps2mRateProtocolKnock(PPS2M pThis, uint8_t rate)
 {
-    if (pThis->enmProtocol == PS2M_PROTO_PS2STD)
+    switch (pThis->enmKnockState)
     {
-        switch (pThis->enmKnockState)
-        {
-        case PS2M_KNOCK_INITIAL:
-            if (rate == 200)
-                pThis->enmKnockState = PS2M_KNOCK_IMPS2_1ST;
-            break;
-        case PS2M_KNOCK_IMPS2_1ST:
-            if (rate == 100)
-                pThis->enmKnockState = PS2M_KNOCK_IMPS2_2ND;
-            else
-                pThis->enmKnockState = PS2M_KNOCK_INITIAL;
-            break;
-        case PS2M_KNOCK_IMPS2_2ND:
-            if (rate == 80)
-            {
-                pThis->enmProtocol = PS2M_PROTO_IMPS2;
-                LogRelFlow(("PS2M: Switching mouse to ImPS/2 protocol.\n"));
-            }
-        default:
+    case PS2M_KNOCK_INITIAL:
+        if (rate == 200)
+            pThis->enmKnockState = PS2M_KNOCK_1ST;
+        break;
+    case PS2M_KNOCK_1ST:
+        if (rate == 100)
+            pThis->enmKnockState = PS2M_KNOCK_IMPS2_2ND;
+        else if (rate == 200)
+            pThis->enmKnockState = PS2M_KNOCK_IMEX_2ND;
+        else
             pThis->enmKnockState = PS2M_KNOCK_INITIAL;
+        break;
+    case PS2M_KNOCK_IMPS2_2ND:
+        if (rate == 80)
+        {
+            pThis->enmProtocol = PS2M_PROTO_IMPS2;
+            LogRelFlow(("PS2M: Switching mouse to ImPS/2 protocol.\n"));
         }
+        pThis->enmKnockState = PS2M_KNOCK_INITIAL;
+        break;
+    case PS2M_KNOCK_IMEX_2ND:
+        if (rate == 80)
+        {
+            pThis->enmProtocol = PS2M_PROTO_IMEX;
+            LogRelFlow(("PS2M: Switching mouse to ImEx protocol.\n"));
+        }
+        /* Fall through! */
+    default:
+        pThis->enmKnockState = PS2M_KNOCK_INITIAL;
     }
-    else if (pThis->enmProtocol == PS2M_PROTO_IMPS2)
+}
+
+/* Three-button event mask. */
+#define PS2M_STD_BTN_MASK   (RT_BIT(0) | RT_BIT(1) | RT_BIT(2))
+
+/* Report accumulated movement and button presses, then clear the accumulators. */
+static void ps2mReportAccumulatedEvents(PPS2M pThis, GeneriQ *pQueue, bool fAccumBtns)
+{
+    uint32_t    fBtnState = fAccumBtns ? pThis->fAccumB : pThis->fCurrB;
+    uint8_t     val;
+    int         dX, dY, dZ;
+
+    /* Clamp the accumulated delta values to the allowed range. */
+    dX = RT_MIN(RT_MAX(pThis->iAccumX, -255), 255);
+    dY = RT_MIN(RT_MAX(pThis->iAccumY, -255), 255);
+    dZ = RT_MIN(RT_MAX(pThis->iAccumZ, -8), 7);
+
+    /* Start with the sync bit and buttons 1-3. */
+    val = RT_BIT(3) | (fBtnState & PS2M_STD_BTN_MASK);
+    /* Set the X/Y sign bits. */
+    if (dX < 0)
+        val |= RT_BIT(4);
+    if (dY < 0)
+        val |= RT_BIT(5);
+
+    /* Send the standard 3-byte packet (always the same). */
+    ps2kInsertQueue(pQueue, val);
+    ps2kInsertQueue(pQueue, dX);
+    ps2kInsertQueue(pQueue, dY);
+
+    /* Add fourth byte if extended protocol is in use. */
+    if (pThis->enmProtocol > PS2M_PROTO_PS2STD)
     {
-        switch (pThis->enmKnockState)
+        if (pThis->enmProtocol == PS2M_PROTO_IMPS2)
+            ps2kInsertQueue(pQueue, dZ);
+        else
         {
-        case PS2M_KNOCK_INITIAL:
-            if (rate == 200)
-                pThis->enmKnockState = PS2M_KNOCK_IMEX_1ST;
-            break;
-        case PS2M_KNOCK_IMEX_1ST:
-            if (rate == 200)
-                pThis->enmKnockState = PS2M_KNOCK_IMEX_2ND;
-            else
-                pThis->enmKnockState = PS2M_KNOCK_INITIAL;
-            break;
-        case PS2M_KNOCK_IMEX_2ND:
-            if (rate == 80)
-            {
-                pThis->enmProtocol = PS2M_PROTO_IMEX;
-                LogRelFlow(("PS2M: Switching mouse to ImEx protocol.\n"));
-            }
-        default:
-            pThis->enmKnockState = PS2M_KNOCK_INITIAL;
+            Assert(pThis->enmProtocol == PS2M_PROTO_IMEX);
+            /* Z value uses 4 bits; buttons 4/5 in bits 4 and 5. */
+            val  = dZ & 0x0f;
+            val |= (fBtnState << 1) & (RT_BIT(4) | RT_BIT(5));
+            ps2kInsertQueue(pQueue, val);
         }
     }
+
+    /* Clear the movement accumulators, but not necessarily button state. */
+    pThis->iAccumX = pThis->iAccumY = pThis->iAccumZ = 0;
+    /* Clear accumulated button state only when it's being used. */
+    if (fAccumBtns)
+    {
+        pThis->fReportedB = pThis->fAccumB;
+        pThis->fAccumB    = 0;
+    }
+}
+
+
+/* Determine whether a reporting rate is one of the valid ones. */
+bool ps2mIsRateSupported(uint8_t rate)
+{
+    static uint8_t  aValidRates[] = { 10, 20, 40, 60, 80, 100, 200 };
+    size_t          i;
+    bool            fValid = false;
+
+    for (i = 0; i < RT_ELEMENTS(aValidRates); ++i)
+        if (aValidRates[i] == rate)
+        {
+            fValid = true;
+            break;
+        }
+
+   return fValid;
 }
 
 /**
@@ -523,11 +590,13 @@ int PS2MByteToAux(PPS2M pThis, uint8_t cmd)
 //LogRel(("aux: cmd=0x%02X, active cmd=0x%02X\n", cmd, pThis->u8CurrCmd));
 
     if (pThis->enmMode == AUX_MODE_RESET)
-    {
         /* In reset mode, do not respond at all. */
         return VINF_SUCCESS;
-    }
-    else if (pThis->enmMode == AUX_MODE_WRAP)
+
+    /* If there's anything left in the command response queue, trash it. */
+    ps2kClearQueue((GeneriQ *)&pThis->cmdQ);
+
+    if (pThis->enmMode == AUX_MODE_WRAP)
     {
         /* In wrap mode, bounce most data right back.*/
         if (cmd == ACMD_RESET || cmd == ACMD_RESET_WRAP)
@@ -539,6 +608,12 @@ int PS2MByteToAux(PPS2M pThis, uint8_t cmd)
         }
     }
 
+#ifndef IN_RING3
+    /* Reset, Enable, and Set Default commands must be run in R3. */
+    if (cmd == ACMD_RESET || cmd == ACMD_ENABLE || cmd == ACMD_SET_DEFAULT)
+        return VINF_IOM_R3_IOPORT_WRITE;
+#endif
+
     switch (cmd)
     {
         case ACMD_SET_SCALE_11:
@@ -553,8 +628,7 @@ int PS2MByteToAux(PPS2M pThis, uint8_t cmd)
             break;
         case ACMD_REQ_STATUS:
             /* Report current status, sample rate, and resolution. */
-            //@todo: buttons
-            u8Val  = pThis->u8State;
+            u8Val  = (pThis->u8State & AUX_STATE_EXTERNAL) | (pThis->fCurrB & PS2M_STD_BTN_MASK);
             ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
             ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, u8Val);
             ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, pThis->u8Resolution);
@@ -566,6 +640,11 @@ int PS2MByteToAux(PPS2M pThis, uint8_t cmd)
             ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
             pThis->u8CurrCmd = 0;
             break;
+        case ACMD_READ_REMOTE:
+            ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
+            ps2mReportAccumulatedEvents(pThis, (GeneriQ *)&pThis->cmdQ, false);
+            pThis->u8CurrCmd = 0;
+            break;
         case ACMD_RESET_WRAP:
             pThis->enmMode = AUX_MODE_STD;
             /* NB: Stream mode reporting remains disabled! */
@@ -590,16 +669,17 @@ int PS2MByteToAux(PPS2M pThis, uint8_t cmd)
             break;
         case ACMD_ENABLE:
             pThis->u8State |= AUX_STATE_ENABLED;
-            //@todo: R3 only!
 #ifdef IN_RING3
             ps2mSetDriverState(pThis, true);
+#else
+            AssertLogRelMsgFailed(("Invalid ACMD_ENABLE outside R3!\n"));
 #endif
             ps2kClearQueue((GeneriQ *)&pThis->evtQ);
             ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
             pThis->u8CurrCmd = 0;
             break;
-        case ACMD_DFLT_DISABLE:
-            ps2mSetDefaults(pThis);
+        case ACMD_DISABLE:
+            pThis->u8State &= ~AUX_STATE_ENABLED;
             ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
             pThis->u8CurrCmd = 0;
             break;
@@ -617,8 +697,15 @@ int PS2MByteToAux(PPS2M pThis, uint8_t cmd)
             pThis->u8CurrCmd = cmd;
             pThis->enmMode   = AUX_MODE_RESET;
             ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
-            /* Slightly delay reset completion; it might take hundreds of ms. */
-            TMTimerSetMillies(pThis->CTX_SUFF(pDelayTimer), 1);
+            if (pThis->fDelayReset)
+                /* Slightly delay reset completion; it might take hundreds of ms. */
+                TMTimerSetMillies(pThis->CTX_SUFF(pDelayTimer), 1);
+            else
+#ifdef IN_RING3
+                ps2mReset(pThis);
+#else
+                AssertLogRelMsgFailed(("Invalid ACMD_RESET outside R3!\n"));
+#endif
             break;
         /* The following commands need a parameter. */
         case ACMD_SET_RES:
@@ -631,17 +718,55 @@ int PS2MByteToAux(PPS2M pThis, uint8_t cmd)
             switch (pThis->u8CurrCmd)
             {
                 case ACMD_SET_RES:
-                    //@todo reject unsupported resolutions
-                    pThis->u8Resolution = cmd;
-                    ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
-                    pThis->u8CurrCmd = 0;
+                    if (cmd < 4)    /* Valid resolutions are 0-3. */
+                    {
+                        pThis->u8Resolution = cmd;
+                        pThis->u8State &= ~AUX_STATE_RES_ERR;
+                        ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
+                        pThis->u8CurrCmd = 0;
+                    }
+                    else
+                    {
+                        /* Bad resolution. Reply with Resend or Error. */
+                        if (pThis->u8State & AUX_STATE_RES_ERR)
+                        {
+                            pThis->u8State &= ~AUX_STATE_RES_ERR;
+                            ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ERROR);
+                            pThis->u8CurrCmd = 0;
+                        }
+                        else
+                        {
+                            pThis->u8State |= AUX_STATE_RES_ERR;
+                            ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_RESEND);
+                            /* NB: Current command remains unchanged. */
+                        }
+                    }
                     break;
                 case ACMD_SET_SAMP_RATE:
-                    //@todo reject unsupported rates
-                    ps2mSetRate(pThis, cmd);
-                    ps2mRateProtocolKnock(pThis, cmd);
-                    ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
-                    pThis->u8CurrCmd = 0;
+                    if (ps2mIsRateSupported(cmd))
+                    {
+                        pThis->u8State &= ~AUX_STATE_RATE_ERR;
+                        ps2mSetRate(pThis, cmd);
+                        ps2mRateProtocolKnock(pThis, cmd);
+                        ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ACK);
+                        pThis->u8CurrCmd = 0;
+                    }
+                    else
+                    {
+                        /* Bad rate. Reply with Resend or Error. */
+                        if (pThis->u8State & AUX_STATE_RATE_ERR)
+                        {
+                            pThis->u8State &= ~AUX_STATE_RATE_ERR;
+                            ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_ERROR);
+                            pThis->u8CurrCmd = 0;
+                        }
+                        else
+                        {
+                            pThis->u8State |= AUX_STATE_RATE_ERR;
+                            ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_RESEND);
+                            /* NB: Current command remains unchanged. */
+                        }
+                    }
                     break;
                 default:
                     fHandled = false;
@@ -702,55 +827,6 @@ int PS2MByteFromAux(PPS2M pThis, uint8_t *pb)
 
 #ifdef IN_RING3
 
-/* Three-button event mask. */
-#define PS2M_STD_BTN_MASK   (RT_BIT(0) | RT_BIT(1) | RT_BIT(2))
-
-/* Report accumulated movement and button presses, then clear the accumulators. */
-static void ps2mReportAccumulatedEvents(PPS2M pThis)
-{
-    uint8_t     val;
-    int8_t      dX, dY, dZ;
-
-    /* Clamp the accumulated delta values to the allowed range. */
-    dX = RT_MIN(RT_MAX(pThis->iAccumX, -256), 255);
-    dY = RT_MIN(RT_MAX(pThis->iAccumY, -256), 255);
-    dZ = RT_MIN(RT_MAX(pThis->iAccumZ, -8), 7);
-
-    /* Start with the sync bit and buttons 1-3. */
-    val = RT_BIT(3) | (pThis->fAccumB & PS2M_STD_BTN_MASK);
-    /* Set the X/Y sign bits. */
-    if (dX < 0)
-        val |= RT_BIT(4);
-    if (dY < 0)
-        val |= RT_BIT(5);
-
-    /* Send the standard 3-byte packet (always the same). */
-    ps2kInsertQueue((GeneriQ *)&pThis->evtQ, val);
-    ps2kInsertQueue((GeneriQ *)&pThis->evtQ, dX);
-    ps2kInsertQueue((GeneriQ *)&pThis->evtQ, dY);
-
-    /* Add fourth byte if extended protocol is in use. */
-    if (pThis->enmProtocol > PS2M_PROTO_PS2STD)
-    {
-        if (pThis->enmProtocol == PS2M_PROTO_IMPS2)
-            ps2kInsertQueue((GeneriQ *)&pThis->evtQ, dZ);
-        else
-        {
-            Assert(pThis->enmProtocol == PS2M_PROTO_IMEX);
-            /* Z value uses 4 bits; buttons 4/5 in bits 4 and 5. */
-            val  = dZ & 0x0f;
-            val |= (pThis->fAccumB << 1) & (RT_BIT(4) | RT_BIT(5));
-            ps2kInsertQueue((GeneriQ *)&pThis->evtQ, dZ);
-        }
-    }
-
-    /* Clear the accumulators. */
-    pThis->iAccumX = pThis->iAccumY = pThis->iAccumZ = pThis->fAccumB = 0;
-
-    /* Poke the KBC to update its state. */
-    KBCUpdateInterrupts(pThis->pParent);
-}
-
 /* Event rate throttling timer to emulate the auxiliary device sampling rate.
  */
 static DECLCALLBACK(void) ps2mThrottleTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
@@ -766,13 +842,15 @@ static DECLCALLBACK(void) ps2mThrottleTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer,
     /* If the input queue is not empty, restart the timer. */
 #else
     /* If more movement is accumulated, report it and restart the timer. */
-    uHaveEvents = pThis->iAccumX | pThis->iAccumY | pThis->iAccumZ | pThis->fAccumB;
+    uHaveEvents = pThis->iAccumX | pThis->iAccumY | pThis->iAccumZ | (pThis->fCurrB != pThis->fReportedB);
     LogFlowFunc(("Have%s events\n", uHaveEvents ? "" : " no"));
 
     if (uHaveEvents)
 #endif
     {
-        ps2mReportAccumulatedEvents(pThis);
+        /* Report accumulated data, poke the KBC, and start the timer. */
+        ps2mReportAccumulatedEvents(pThis, (GeneriQ *)&pThis->evtQ, true);
+        KBCUpdateInterrupts(pThis->pParent);
         TMTimerSetMillies(pThis->CTX_SUFF(pThrottleTimer), pThis->uThrottleDelay);
     }
     else
@@ -791,17 +869,11 @@ static DECLCALLBACK(void) ps2mDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, vo
     LogFlowFunc(("Delay timer: cmd %02X\n", pThis->u8CurrCmd));
 
     Assert(pThis->u8CurrCmd == ACMD_RESET);
-    ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, ARSP_BAT_OK);
-    ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, 0);
-    pThis->enmMode   = AUX_MODE_STD;
-    pThis->u8CurrCmd = 0;
+    ps2mReset(pThis);
 
     ///@todo Might want a PS2MCompleteCommand() to push last response, clear command, and kick the KBC...
     /* Give the KBC a kick. */
     KBCUpdateInterrupts(pThis->pParent);
-
-    //@todo: move to its proper home!
-    ps2mSetDriverState(pThis, true);
 }
 
 
@@ -872,13 +944,15 @@ static int ps2mPutEventWorker(PPS2M pThis, int32_t dx, int32_t dy,
     pThis->iAccumX += dx;
     pThis->iAccumY += dy;
     pThis->iAccumZ += dz;
-    pThis->fAccumB |= fButtons & PS2M_STD_BTN_MASK; //@todo: accumulate based on current protocol?
+    pThis->fAccumB |= fButtons;     //@todo: accumulate based on current protocol?
+    pThis->fCurrB   = fButtons;
 
 #if 1
-    /* Report the event and the throttle timer unless it's already running. */
+    /* Report the event and start the throttle timer unless it's already running. */
     if (!pThis->fThrottleActive)
     {
-        ps2mReportAccumulatedEvents(pThis);
+        ps2mReportAccumulatedEvents(pThis, (GeneriQ *)&pThis->evtQ, true);
+        KBCUpdateInterrupts(pThis->pParent);
         pThis->fThrottleActive = true;
         TMTimerSetMillies(pThis->CTX_SUFF(pThrottleTimer), pThis->uThrottleDelay);
     }
@@ -921,7 +995,7 @@ static DECLCALLBACK(int) ps2mPutEvent(PPDMIMOUSEPORT pInterface, int32_t dx, int
     int rc = PDMCritSectEnter(pThis->pCritSectR3, VERR_SEM_BUSY);
     AssertReleaseRC(rc);
 
-    LogFlowFunc(("dX=%d dY=%d dZ=%d dW=%d buttons=%02X\n", dx, dy, dz, dw, fButtons));
+    LogRelFlowFunc(("dX=%d dY=%d dZ=%d dW=%d buttons=%02X\n", dx, dy, dz, dw, fButtons));
     /* NB: The PS/2 Y axis direction is inverted relative to ours. */
     ps2mPutEventWorker(pThis, dx, -dy, dz, dw, fButtons);
 
@@ -1057,12 +1131,26 @@ int PS2MLoadState(PPS2M pThis, PSSMHANDLE pSSM, uint32_t uVersion)
     /* Recalculate the throttling delay. */
     ps2mSetRate(pThis, pThis->u8SampleRate);
 
-    //@todo: Is this the right place/logic?
     ps2mSetDriverState(pThis, !!(pThis->u8State & AUX_STATE_ENABLED));
 
     return rc;
 }
 
+void PS2MFixupState(PPS2M pThis, uint8_t u8State, uint8_t u8Rate, uint8_t u8Proto)
+{
+    LogFlowFunc(("Fixing up old PS2M state version\n"));
+
+    /* Load the basic auxiliary device state. */
+    pThis->u8State      = u8State;
+    pThis->u8SampleRate = u8Rate ? u8Rate : 40; /* In case it wasn't saved right. */
+    pThis->enmProtocol  = (PS2M_PROTO)u8Proto;
+
+    /* Recalculate the throttling delay. */
+    ps2mSetRate(pThis, pThis->u8SampleRate);
+
+    ps2mSetDriverState(pThis, !!(pThis->u8State & AUX_STATE_ENABLED));
+}
+
 void PS2MReset(PPS2M pThis)
 {
     LogFlowFunc(("Resetting PS2M\n"));
@@ -1113,7 +1201,7 @@ int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, void *pParent, int iInstance)
      */
     PTMTIMER pTimer;
     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_REAL, ps2mThrottleTimer, pThis,
-                                TMTIMER_FLAGS_NO_CRIT_SECT, "PS2M Throttle Timer", &pTimer);
+                                TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "PS2M Throttle Timer", &pTimer);
     if (RT_FAILURE(rc))
         return rc;
 
@@ -1125,7 +1213,7 @@ int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, void *pParent, int iInstance)
      * Create the command delay timer.
      */
     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ps2mDelayTimer, pThis,
-                                TMTIMER_FLAGS_NO_CRIT_SECT, "PS2M Delay Timer", &pTimer);
+                                TMTIMER_FLAGS_DEFAULT_CRIT_SECT, "PS2M Delay Timer", &pTimer);
     if (RT_FAILURE(rc))
         return rc;
 
diff --git a/src/VBox/Devices/Input/UsbKbd.cpp b/src/VBox/Devices/Input/UsbKbd.cpp
index 5b40036..e280844 100644
--- a/src/VBox/Devices/Input/UsbKbd.cpp
+++ b/src/VBox/Devices/Input/UsbKbd.cpp
@@ -15,6 +15,36 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+/** @page pg_usb_kbd    USB Keyboard Device Emulation.
+ *
+ * This module implements a standard USB keyboard which uses the boot
+ * interface. The keyboard sends reports which have room for up to six
+ * normal keys and all standard modifier keys. A report always reflects the
+ * current state of the keyboard and indicates which keys are held down.
+ *
+ * Software normally utilizes the keyboard's interrupt endpoint to request
+ * reports to be sent whenever a state change occurs. However, reports can
+ * also be sent whenever an interrupt transfer is initiated (the keyboard is
+ * not "idle") or requested via the control endpoint (polling).
+ *
+ * Because turnaround on USB is relatively slow, the keyboard often ends up
+ * in a situation where new input arrived but there is no URB available
+ * where a report could be written to. The PDM queue maintained by the
+ * keyboard driver is utilized to provide buffering and hold incoming events
+ * until they can be passed along. The USB keyboard can effectively buffer
+ * up to one event.
+ *
+ * If there is a pending event and a new URB becomes available, a report is
+ * built and the keyboard queue is flushed. This ensures that queued events
+ * are processed as quickly as possible.
+ *
+ *
+ * References:
+ *
+ * Device Class Definition for Human Interface Devices (HID), Version 1.11
+ *
+ */
+
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
@@ -132,13 +162,6 @@ typedef struct USBHIDK_REPORT
     uint8_t     aKeys[6];       /**< Normal keys */
 } USBHIDK_REPORT, *PUSBHIDK_REPORT;
 
-/** Scancode translator state.  */
-typedef enum {
-    SS_IDLE,    /**< Starting state. */
-    SS_EXT,     /**< E0 byte was received. */
-    SS_EXT1     /**< E1 byte was received. */
-} scan_state_t;
-
 /**
  * The USB HID instance data.
  */
@@ -160,9 +183,6 @@ typedef struct USBHID
     /** The state of the HID (state machine).*/
     USBHIDREQSTATE      enmState;
 
-    /** State of the scancode translation. */
-    scan_state_t        XlatState;
-
     /** Pending to-host queue.
      * The URBs waiting here are waiting for data to become available.
      */
@@ -178,9 +198,6 @@ typedef struct USBHID
     bool                fHaveDoneQueueWaiter;
     /** If device has pending changes. */
     bool                fHasPendingChanges;
-    /** Keypresses which have not yet been reported.  A workaround for the
-     * problem of keys being released before the keypress could be reported. */
-    uint8_t             abUnreportedKeys[VBOX_USB_USAGE_ARRAY_SIZE];
     /** Currently depressed keys */
     uint8_t             abDepressedKeys[VBOX_USB_USAGE_ARRAY_SIZE];
 
@@ -358,110 +375,6 @@ static const PDMUSBDESCCACHE g_UsbHidDescCache =
 };
 
 
-/*
- * Because of historical reasons and poor design, VirtualBox internally uses BIOS
- * PC/XT style scan codes to represent keyboard events. Each key press and release is
- * represented as a stream of bytes, typically only one byte but up to four-byte
- * sequences are possible. In the typical case, the GUI front end generates the stream
- * of scan codes which we need to translate back to a single up/down event.
- *
- * This function could possibly live somewhere else.
- */
-
-/** Lookup table for converting PC/XT scan codes to USB HID usage codes. */
-/** We map the scan codes for F13 to F23 to the usage codes for Sun keyboard
- *  left-hand side function keys rather than to the standard F13 to F23 usage
- *  codes, since we suspect that there are more people wanting Sun keyboard
- *  emulation than emulation of other keyboards with extended function keys. */
-static uint8_t aScancode2Hid[] =
-{
-    0x00, 0x29, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, /* 00-07 */
-    0x24, 0x25, 0x26, 0x27, 0x2d, 0x2e, 0x2a, 0x2b, /* 08-1F */
-    0x14, 0x1a, 0x08, 0x15, 0x17, 0x1c, 0x18, 0x0c, /* 10-17 */
-    0x12, 0x13, 0x2f, 0x30, 0x28, 0xe0, 0x04, 0x16, /* 18-1F */
-    0x07, 0x09, 0x0a, 0x0b, 0x0d, 0x0e, 0x0f, 0x33, /* 20-27 */
-    0x34, 0x35, 0xe1, 0x31, 0x1d, 0x1b, 0x06, 0x19, /* 28-2F */
-    0x05, 0x11, 0x10, 0x36, 0x37, 0x38, 0xe5, 0x55, /* 30-37 */
-    0xe2, 0x2c, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, /* 38-3F */
-    0x3f, 0x40, 0x41, 0x42, 0x43, 0x53, 0x47, 0x5f, /* 40-47 */
-    0x60, 0x61, 0x56, 0x5c, 0x5d, 0x5e, 0x57, 0x59, /* 48-4F */
-    0x5a, 0x5b, 0x62, 0x63, 0x46, 0x00, 0x64, 0x44, /* 50-57 */
-    0x45, 0x67, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 58-5F */
-               /* Sun keys: Props Undo  Front Copy */
-    0x00, 0x00, 0x00, 0x00, 0x76, 0x7a, 0x77, 0x7c, /* 60-67 */
- /* Open  Paste Find  Cut   Stop  Again Help */
-    0x74, 0x7d, 0x7e, 0x7b, 0x78, 0x79, 0x75, 0x00, /* 68-6F */
-    0x88, 0x91, 0x90, 0x87, 0x00, 0x00, 0x00, 0x00, /* 70-77 */
-    0x00, 0x8a, 0x00, 0x8b, 0x00, 0x89, 0x85, 0x00  /* 78-7F */
-};
-
-/** Lookup table for extended scancodes (arrow keys etc.). */
-static uint8_t aExtScan2Hid[] =
-{
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00-07 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 08-1F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10-17 */
-    0x00, 0x00, 0x00, 0x00, 0x58, 0xe4, 0x00, 0x00, /* 18-1F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 20-27 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28-2F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x46, /* 30-37 */
-    0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38-3F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x4a, /* 40-47 */
-    0x52, 0x4b, 0x00, 0x50, 0x00, 0x4f, 0x00, 0x4d, /* 48-4F */
-    0x51, 0x4e, 0x49, 0x4c, 0x00, 0x00, 0x00, 0x00, /* 50-57 */
-    0x00, 0x00, 0x00, 0xe3, 0xe7, 0x65, 0x66, 0x00, /* 58-5F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 60-67 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 68-6F */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 70-77 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  /* 78-7F */
-};
-
-/**
- * Convert a PC scan code to a USB HID usage byte.
- *
- * @param state         Current state of the translator (scan_state_t).
- * @param scanCode      Incoming scan code.
- * @param pUsage        Pointer to usage; high bit set for key up events. The
- *                      contents are only valid if returned state is SS_IDLE.
- *
- * @return scan_state_t New state of the translator.
- */
-static scan_state_t ScancodeToHidUsage(scan_state_t state, uint8_t scanCode, uint32_t *pUsage)
-{
-    uint32_t    keyUp;
-    uint8_t     usage;
-
-    Assert(pUsage);
-
-    /* Isolate the scan code and key break flag. */
-    keyUp = (scanCode & 0x80) << 24;
-
-    switch (state) {
-    case SS_IDLE:
-        if (scanCode == 0xE0) {
-            state = SS_EXT;
-        } else if (scanCode == 0xE1) {
-            state = SS_EXT1;
-        } else {
-            usage = aScancode2Hid[scanCode & 0x7F];
-            *pUsage = usage | keyUp;
-            /* Remain in SS_IDLE state. */
-        }
-        break;
-    case SS_EXT:
-        usage = aExtScan2Hid[scanCode & 0x7F];
-        *pUsage = usage | keyUp;
-        state = SS_IDLE;
-        break;
-    case SS_EXT1:
-        Assert(0);  //@todo - sort out the Pause key
-        *pUsage = 0;
-        state = SS_IDLE;
-        break;
-    }
-    return state;
-}
-
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
@@ -576,7 +489,6 @@ static void usbHidLinkDone(PUSBHID pThis, PVUSBURB pUrb)
 }
 
 
-
 /**
  * Completes the URB with a stalled state, halting the pipe.
  */
@@ -661,29 +573,6 @@ static int usbHidResetWorker(PUSBHID pThis, PVUSBURB pUrb, bool fSetConfig)
     return VINF_SUCCESS;
 }
 
-#ifdef DEBUG
-# define HEX_DIGIT(x) (((x) < 0xa) ? ((x) + '0') : ((x) - 0xa + 'a'))
-static void usbHidComputePressed(PUSBHIDK_REPORT pReport, char* pszBuf, unsigned cbBuf)
-{
-    unsigned offBuf = 0;
-    unsigned i;
-    for (i = 0; i < RT_ELEMENTS(pReport->aKeys); ++i)
-    {
-        uint8_t uCode = pReport->aKeys[i];
-        if (uCode != 0)
-        {
-            if (offBuf + 4 >= cbBuf)
-                break;
-            pszBuf[offBuf++] = HEX_DIGIT(uCode >> 4);
-            pszBuf[offBuf++] = HEX_DIGIT(uCode & 0xf);
-            pszBuf[offBuf++] = ' ';
-        }
-    }
-    pszBuf[offBuf++] = '\0';
-}
-# undef HEX_DIGIT
-#endif
-
 /**
  * Returns true if the usage code corresponds to a keyboard modifier key
  * (left or right ctrl, shift, alt or GUI).  The usage codes for these keys
@@ -706,24 +595,17 @@ static uint8_t usbHidModifierToFlag(uint8_t u8Usage)
 }
 
 /**
- * Create a USB HID keyboard report based on a vector of keys which have been
- * pressed since the last report was created (so that we don't miss keys that
- * are only pressed briefly) and a vector of currently depressed keys.
- * The keys in the report aKeys array are in increasing order (important for
- * the test case).
+ * Create a USB HID keyboard report reflecting the current state of the
+ * keyboard (up/down keys).
  */
-static int usbHidFillReport(PUSBHIDK_REPORT pReport,
-                            uint8_t *pabUnreportedKeys,
-                            uint8_t *pabDepressedKeys)
+static void usbHidBuildReport(PUSBHIDK_REPORT pReport, uint8_t *pabDepressedKeys)
 {
-    int rc = false;
     unsigned iBuf = 0;
     RT_ZERO(*pReport);
     for (unsigned iKey = 0; iKey < VBOX_USB_USAGE_ARRAY_SIZE; ++iKey)
     {
-        AssertReturn(iBuf <= RT_ELEMENTS(pReport->aKeys),
-                     VERR_INTERNAL_ERROR);
-        if (pabUnreportedKeys[iKey] || pabDepressedKeys[iKey])
+        Assert(iBuf <= RT_ELEMENTS(pReport->aKeys));
+        if (pabDepressedKeys[iKey])
         {
             if (usbHidUsageCodeIsModifier(iKey))
                 pReport->ShiftState |= usbHidModifierToFlag(iKey);
@@ -740,125 +622,11 @@ static int usbHidFillReport(PUSBHIDK_REPORT pReport,
             {
                 pReport->aKeys[iBuf] = iKey;
                 ++iBuf;
-                /* More Korean keyboard hackery: Give the caller a hint that
-                 * a key release event needs reporting.
-                 */
-                if (iKey == 0x90 || iKey == 0x91)
-                    rc = true;
             }
-            /* Avoid "hanging" keys: If a key is unreported but no longer
-             * depressed, we'll need to report the key-up state, too.
-             */
-            if (pabUnreportedKeys[iKey] && !pabDepressedKeys[iKey])
-                rc = true;
-
-            pabUnreportedKeys[iKey] = 0;
         }
     }
-    return rc;
 }
 
-#ifdef DEBUG
-/** Test data for testing usbHidFillReport().  The format is:
- *   - Unreported keys (zero terminated array)
- *   - Depressed keys (zero terminated array)
- *   - Expected shift state in the report (single byte inside array)
- *   - Expected keys buffer contents (array of six bytes)
- */
-static const uint8_t testUsbHidFillReportData[][4][10] = {
-    /* Just unreported, no modifiers */
-    {{4, 9, 0}, {0}, {0}, {4, 9, 0, 0, 0, 0}},
-    /* Just unreported, one modifier */
-    {{4, 9, 0xe2, 0}, {0}, {4}, {4, 9, 0, 0, 0, 0}},
-    /* Just unreported, two modifiers */
-    {{4, 9, 0xe2, 0xe4, 0}, {0}, {20}, {4, 9, 0, 0, 0, 0}},
-    /* Just depressed, no modifiers */
-    {{0}, {7, 20, 0}, {0}, {7, 20, 0, 0, 0, 0}},
-    /* Just depressed, one modifier */
-    {{0}, {7, 20, 0xe3, 0}, {8}, {7, 20, 0, 0, 0, 0}},
-    /* Just depressed, two modifiers */
-    {{0}, {7, 20, 0xe3, 0xe6, 0}, {72}, {7, 20, 0, 0, 0, 0}},
-    /* Unreported and depressed, no overlap, no modifiers */
-    {{5, 10, 0}, {8, 21, 0}, {0}, {5, 8, 10, 21, 0, 0}},
-    /* Unreported and depressed, one overlap, no modifiers */
-    {{5, 10, 0}, {8, 10, 21, 0}, {0}, {5, 8, 10, 21, 0, 0}},
-    /* Unreported and depressed, no overlap, non-overlapping modifiers */
-    {{5, 10, 0xe2, 0xe4, 0}, {8, 21, 0xe3, 0xe6, 0}, {92},
-           {5, 8, 10, 21, 0, 0}},
-    /* Unreported and depressed, one overlap, non-overlapping modifiers */
-    {{5, 10, 21, 0xe2, 0xe4, 0}, {8, 21, 0xe3, 0xe6, 0}, {92},
-           {5, 8, 10, 21, 0, 0}},
-    /* Unreported and depressed, no overlap, overlapping modifiers */
-    {{5, 10, 0xe2, 0xe4, 0}, {8, 21, 0xe3, 0xe4, 0}, {28},
-           {5, 8, 10, 21, 0, 0}},
-    /* Unreported and depressed, one overlap, overlapping modifiers */
-    {{5, 10, 0xe2, 0xe4, 0}, {5, 8, 21, 0xe3, 0xe4, 0}, {28},
-           {5, 8, 10, 21, 0, 0}},
-    /* Just too many unreported, no modifiers */
-    {{4, 9, 11, 12, 16, 18, 20, 0}, {0}, {0}, {1, 1, 1, 1, 1, 1}},
-    /* Just too many unreported, two modifiers */
-    {{4, 9, 11, 12, 16, 18, 20, 0xe2, 0xe4, 0}, {0}, {20},
-           {1, 1, 1, 1, 1, 1}},
-    /* Just too many depressed, no modifiers */
-    {{0}, {7, 20, 22, 25, 27, 29, 34, 0}, {0}, {1, 1, 1, 1, 1, 1}},
-    /* Just too many depressed, two modifiers */
-    {{0}, {7, 20, 22, 25, 27, 29, 34, 0xe3, 0xe5, 0}, {40},
-           {1, 1, 1, 1, 1, 1}},
-    /* Too many unreported and depressed, no overlap, no modifiers */
-    {{5, 10, 12, 13, 0}, {8, 9, 21, 0}, {0}, {1, 1, 1, 1, 1, 1}},
-    /* Eight unreported and depressed total, one overlap, no modifiers */
-    {{5, 10, 12, 13, 0}, {8, 10, 21, 22, 0}, {0}, {1, 1, 1, 1, 1, 1}},
-    /* Seven unreported and depressed total, one overlap, no modifiers */
-    {{5, 10, 12, 13, 0}, {8, 10, 21, 0}, {0}, {5, 8, 10, 12, 13, 21}},
-    /* Too many unreported and depressed, no overlap, two modifiers */
-    {{5, 10, 12, 13, 0xe2, 0}, {8, 9, 21, 0xe4, 0}, {20},
-           {1, 1, 1, 1, 1, 1}},
-    /* Eight unreported and depressed total, one overlap, two modifiers */
-    {{5, 10, 12, 13, 0xe1, 0}, {8, 10, 21, 22, 0xe2, 0}, {6},
-           {1, 1, 1, 1, 1, 1}},
-    /* Seven unreported and depressed total, one overlap, two modifiers */
-    {{5, 10, 12, 13, 0xe2, 0}, {8, 10, 21, 0xe3, 0}, {12},
-           {5, 8, 10, 12, 13, 21}}
-};
-
-/** Test case for usbHidFillReport() */
-class testUsbHidFillReport
-{
-    USBHIDK_REPORT mReport;
-    uint8_t mabUnreportedKeys[VBOX_USB_USAGE_ARRAY_SIZE];
-    uint8_t mabDepressedKeys[VBOX_USB_USAGE_ARRAY_SIZE];
-    const uint8_t (*mTests)[4][10];
-
-    void doTest(unsigned cTest, const uint8_t *paiUnreportedKeys,
-                const uint8_t *paiDepressedKeys, uint8_t aExpShiftState,
-                const uint8_t *pabExpKeys)
-    {
-        RT_ZERO(mReport);
-        RT_ZERO(mabUnreportedKeys);
-        RT_ZERO(mabDepressedKeys);
-        for (unsigned i = 0; paiUnreportedKeys[i] != 0; ++i)
-            mabUnreportedKeys[paiUnreportedKeys[i]] = 1;
-        for (unsigned i = 0; paiDepressedKeys[i] != 0; ++i)
-            mabUnreportedKeys[paiDepressedKeys[i]] = 1;
-        int rc = usbHidFillReport(&mReport, mabUnreportedKeys, mabDepressedKeys);
-        AssertMsgRC(rc, ("test %u\n", cTest));
-        AssertMsg(mReport.ShiftState == aExpShiftState, ("test %u\n", cTest));
-        for (unsigned i = 0; i < RT_ELEMENTS(mReport.aKeys); ++i)
-            AssertMsg(mReport.aKeys[i] == pabExpKeys[i], ("test %u\n", cTest));
-    }
-
-public:
-    testUsbHidFillReport(void) : mTests(&testUsbHidFillReportData[0])
-    {
-        for (unsigned i = 0; i < RT_ELEMENTS(testUsbHidFillReportData); ++i)
-            doTest(i, mTests[i][0], mTests[i][1], mTests[i][2][0],
-                   mTests[i][3]);
-    }
-};
-
-static testUsbHidFillReport gsTestUsbHidFillReport;
-#endif
-
 /**
  * Handles a SET_REPORT request sent to the default control pipe. Note
  * that unrecognized requests are ignored without reporting an error.
@@ -888,29 +656,24 @@ static void usbHidSetReport(PUSBHID pThis, PVUSBURB pUrb)
 }
 
 /**
- * Sends a state report to the host if there is a pending URB.
+ * Sends a state report to the guest if there is a URB available.
  */
-static int usbHidSendReport(PUSBHID pThis)
+static void usbHidSendReport(PUSBHID pThis)
 {
     PVUSBURB pUrb = usbHidQueueRemoveHead(&pThis->ToHostQueue);
     if (pUrb)
     {
         PUSBHIDK_REPORT pReport = (PUSBHIDK_REPORT)&pUrb->abData[0];
 
-        int again = usbHidFillReport(pReport, pThis->abUnreportedKeys,
-                                      pThis->abDepressedKeys);
-        if (again)
-            pThis->fHasPendingChanges = true;
-        else
-            pThis->fHasPendingChanges = false;
-        return usbHidCompleteOk(pThis, pUrb, sizeof(*pReport));
+        usbHidBuildReport(pReport, pThis->abDepressedKeys);
+        pThis->fHasPendingChanges = false;
+        usbHidCompleteOk(pThis, pUrb, sizeof(*pReport));
     }
     else
     {
         Log2(("No available URB for USB kbd\n"));
         pThis->fHasPendingChanges = true;
     }
-    return VINF_EOF;
 }
 
 /**
@@ -924,82 +687,72 @@ static DECLCALLBACK(void *) usbHidKeyboardQueryInterface(PPDMIBASE pInterface, c
     return NULL;
 }
 
+/* See the PS2K device. */
+#define KRSP_BAT_FAIL       0xFC    /* Also a 'release keys' signal. */
+
 /**
  * Keyboard event handler.
  *
  * @returns VBox status code.
  * @param   pInterface      Pointer to the keyboard port interface (KBDState::Keyboard.IPort).
- * @param   u8KeyCode       The keycode.
+ * @param   u32UsageCode    The key usage ID.
  */
-static DECLCALLBACK(int) usbHidKeyboardPutEvent(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode)
+static DECLCALLBACK(int) usbHidKeyboardPutEvent(PPDMIKEYBOARDPORT pInterface, uint32_t u32UsageCode)
 {
     PUSBHID pThis = RT_FROM_MEMBER(pInterface, USBHID, Lun0.IPort);
-    uint32_t    u32Usage = 0;
     uint8_t     u8HidCode;
-    int         fKeyDown;
+    bool        fKeyDown;
     bool        fHaveEvent = true;
+    int         rc = VINF_SUCCESS;
 
     RTCritSectEnter(&pThis->CritSect);
 
-    pThis->XlatState = ScancodeToHidUsage(pThis->XlatState, u8KeyCode, &u32Usage);
+    /* Let's see what we got... */
+    fKeyDown  = !(u32UsageCode & 0x80000000);
+    u8HidCode = u32UsageCode & 0xFF;
+    AssertReturn(u8HidCode <= VBOX_USB_MAX_USAGE_CODE, VERR_INTERNAL_ERROR);
 
-    if (pThis->XlatState == SS_IDLE)
-    {
-        /* The usage code is valid. */
-        fKeyDown = !(u32Usage & 0x80000000);
-        u8HidCode = u32Usage & 0xFF;
-        AssertReturn(u8HidCode <= VBOX_USB_MAX_USAGE_CODE, VERR_INTERNAL_ERROR);
+    LogFlowFunc(("key %s: 0x%x\n", fKeyDown ? "down" : "up", u8HidCode));
 
-        LogFlowFunc(("key %s: 0x%x->0x%x\n",
-                        fKeyDown ? "down" : "up", u8KeyCode, u8HidCode));
+    /*
+     * Due to host key repeat, we can get key events for keys which are
+     * already depressed. Drop those right here.
+     */
+    if (fKeyDown && pThis->abDepressedKeys[u8HidCode])
+        fHaveEvent = false;
 
-        if (fKeyDown)
+    /* If there is already a pending event, we won't accept a new one yet. */
+    if (pThis->fHasPendingChanges && fHaveEvent)
+    {
+        rc = VERR_TRY_AGAIN;
+    }
+    else if (fHaveEvent)
+    {
+        if (RT_UNLIKELY(u32UsageCode == KRSP_BAT_FAIL))
         {
-            /* Due to host key repeat, we can get key events for keys which are
-             * already depressed. */
-            if (!pThis->abDepressedKeys[u8HidCode])
-            {
-                pThis->abUnreportedKeys[u8HidCode] = 1;
-
-                /* If a non-modifier key is being marked as unreported, also set
-                 * all currently depressed modifer keys as unreported. This avoids
-                 * problems where a simulated key sequence is sent too fast and
-                 * by the time the key is reported, some previously reported
-                 * modifiers are already released. This helps ensure that the guest
-                 * sees the entire modifier(s)+key sequence in a single report.
-                 */
-                if (!usbHidUsageCodeIsModifier(u8HidCode))
-                {
-                    int     iModKey;
-
-                    for (iModKey = USBHID_MODIFIER_FIRST; iModKey <= USBHID_MODIFIER_LAST; ++iModKey)
-                        if (pThis->abDepressedKeys[iModKey])
-                            pThis->abUnreportedKeys[iModKey] = 1;
-                }
-            }
-            else
-                fHaveEvent = false;
-            pThis->abDepressedKeys[u8HidCode] = 1;
+            /* Clear all currently depressed and unreported keys. */
+            RT_ZERO(pThis->abDepressedKeys);
         }
         else
         {
-            /* For stupid Korean keyboards, we have to fake a key up/down sequence
-             * because they only send break codes for Hangul/Hanja keys.
-             */
-            if (u8HidCode == 0x90 || u8HidCode == 0x91)
-                pThis->abUnreportedKeys[u8HidCode] = 1;
-            pThis->abDepressedKeys[u8HidCode] = 0;
+            /* Regular key event - update keyboard state. */
+            if (fKeyDown)
+                pThis->abDepressedKeys[u8HidCode] = 1;
+            else
+                pThis->abDepressedKeys[u8HidCode] = 0;
         }
 
-
-        /* Send a report if the host is already waiting for it. */
-        if (fHaveEvent)
-            usbHidSendReport(pThis);
+        /*
+         * Try sending a report. Note that we already decided to consume the
+         * event regardless of whether a URB is available or not. If it's not,
+         * we will simply not accept any further events.
+         */
+        usbHidSendReport(pThis);
     }
 
     RTCritSectLeave(&pThis->CritSect);
 
-    return VINF_SUCCESS;
+    return rc;
 }
 
 /**
@@ -1109,8 +862,13 @@ static int usbHidHandleIntrDevToHost(PUSBHID pThis, PUSBHIDEP pEp, PVUSBURB pUrb
             usbHidQueueAddTail(&pThis->ToHostQueue, pUrb);
             /* If device was not set idle, send the current report right away. */
             if (pThis->bIdle != 0 || pThis->fHasPendingChanges)
+            {
                 usbHidSendReport(pThis);
-            LogFlow(("usbHidHandleIntrDevToHost: Sent report via %p:%s\n", pUrb, pUrb->pszDesc));
+                LogFlow(("usbHidHandleIntrDevToHost: Sent report via %p:%s\n", pUrb, pUrb->pszDesc));
+                Assert(!pThis->fHasPendingChanges); /* Since we just got a URB... */
+                /* There may be more input queued up. Ask for it now. */
+                pThis->Lun0.pDrv->pfnFlushQueue(pThis->Lun0.pDrv);
+            }
             return VINF_SUCCESS;
 
         /*
@@ -1489,7 +1247,6 @@ static DECLCALLBACK(int) usbHidConstruct(PPDMUSBINS pUsbIns, int iInstance, PCFG
      */
     pThis->pUsbIns                                  = pUsbIns;
     pThis->hEvtDoneQueue                            = NIL_RTSEMEVENT;
-    pThis->XlatState                                = SS_IDLE;
     usbHidQueueInit(&pThis->ToHostQueue);
     usbHidQueueInit(&pThis->DoneQueue);
 
@@ -1507,7 +1264,7 @@ static DECLCALLBACK(int) usbHidConstruct(PPDMUSBINS pUsbIns, int iInstance, PCFG
         return rc;
 
     pThis->Lun0.IBase.pfnQueryInterface = usbHidKeyboardQueryInterface;
-    pThis->Lun0.IPort.pfnPutEvent       = usbHidKeyboardPutEvent;
+    pThis->Lun0.IPort.pfnPutEventHid    = usbHidKeyboardPutEvent;
 
     /*
      * Attach the keyboard driver.
diff --git a/src/VBox/Devices/Input/UsbMouse.cpp b/src/VBox/Devices/Input/UsbMouse.cpp
index be3e4e7..f8ff79a 100644
--- a/src/VBox/Devices/Input/UsbMouse.cpp
+++ b/src/VBox/Devices/Input/UsbMouse.cpp
@@ -1,3 +1,4 @@
+/* $Id: UsbMouse.cpp $ */
 /** @file
  * UsbMouse - USB Human Interface Device Emulation (Mouse).
  */
diff --git a/src/VBox/Devices/Input/testcase/tstUsbMouse.cpp b/src/VBox/Devices/Input/testcase/tstUsbMouse.cpp
index 8b733c4..2feb99e 100644
--- a/src/VBox/Devices/Input/testcase/tstUsbMouse.cpp
+++ b/src/VBox/Devices/Input/testcase/tstUsbMouse.cpp
@@ -306,7 +306,6 @@ int main()
      * Init the runtime, test and say hello.
      */
     RTTEST hTest;
-    PDRVTSTMOUSE pThis;
     int rc = RTTestInitAndCreate("tstUsbMouse", &hTest);
     if (rc)
         return rc;
diff --git a/src/VBox/Devices/Makefile.kmk b/src/VBox/Devices/Makefile.kmk
index 67d8f19..f635b04 100644
--- a/src/VBox/Devices/Makefile.kmk
+++ b/src/VBox/Devices/Makefile.kmk
@@ -25,6 +25,9 @@ endif
 
 # Include sub-makefiles.
 include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
+ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+ include $(PATH_SUB_CURRENT)/Audio/testcase/Makefile.kmk
+endif
 include $(PATH_SUB_CURRENT)/Input/testcase/Makefile.kmk
 if defined(VBOX_WITH_INTEL_PXE) || defined(VBOX_ONLY_EXTPACKS)
  include $(PATH_SUB_CURRENT)/PC/PXE/Makefile.kmk
@@ -65,6 +68,9 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
   if defined(VBOX_WITH_EHCI_IMPL) && !defined(VBOX_WITH_EXTPACK_PUEL)
    VBoxDDU_DEFS          += VBOX_WITH_EHCI_IMPL
   endif
+  if defined(VBOX_WITH_XHCI_IMPL) && !defined(VBOX_WITH_EXTPACK_PUEL)
+   VBoxDDU_DEFS          += VBOX_WITH_XHCI_IMPL
+  endif
   ifdef VBOX_WITH_NEW_USB_CODE_ON_DARWIN
    VBoxDDU_DEFS.darwin   += VBOX_WITH_NEW_USB_CODE_ON_DARWIN
   endif
@@ -80,8 +86,6 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  	Storage/VSCSI/VSCSIIoReq.cpp \
  	Storage/VSCSI/VSCSIVpdPagePool.cpp \
  	build/VBoxDDUDeps.cpp
- VBoxDDU_SOURCES.win      = \
-	build/VBoxDDU.rc
  ifdef VBOX_WITH_USB
   VBoxDDU_INCS.os2       += \
  	$(PATH_ROOT)/src/VBox/HostDrivers/VBoxUSB/os2
@@ -104,6 +108,7 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  endif
 
  VBoxDDU_LDFLAGS.linux    = -Wl,--no-undefined
+ $(call VBOX_SET_VER_INFO_DLL,VBoxDDU,VirtualBox VMM Devices and Drivers Utilities)
 
  #
  # VBoxDD (shared object)
@@ -117,7 +122,7 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  VBoxDD_DEFS             = \
  	VBOX_ACPI \
  	VBOX_HGCM_HOST_CODE \
- 	VBOX_WITH_HGCM \
+ 	$(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) \
  	$(if $(VBOX_BIOS_DMI_FALLBACK),VBOX_BIOS_DMI_FALLBACK,) \
  	VBOX_WITH_DMI_CHASSIS \
  	VBOX_WITH_DMI_OEMSTRINGS
@@ -148,8 +153,9 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  	PC/DevPcBios.cpp \
  	PC/DevFwCommon.cpp \
  	PC/DevPcArch.cpp \
+	GIMDev/GIMDev.cpp \
  	VMMDev/VMMDev.cpp \
- 	VMMDev/VMMDevHGCM.cpp \
+ 	$(if $(VBOX_WITH_HGCM),VMMDev/VMMDevHGCM.cpp,) \
  	VMMDev/VMMDevTesting.cpp \
  	Network/DevPCNet.cpp \
  	Audio/DevIchAc97.cpp \
@@ -162,11 +168,6 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  	Serial/DevSerial.cpp \
  	Parallel/DevParallel.cpp \
 	\
- 	Audio/audio.c \
- 	Audio/audiosniffer.c \
- 	Audio/mixeng.c \
- 	Audio/noaudio.c \
- 	Audio/filteraudio.c \
  	Input/DrvKeyboardQueue.cpp \
  	Input/DrvMouseQueue.cpp \
  	Network/DrvIntNet.cpp \
@@ -175,6 +176,7 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  	PC/DrvAcpiCpu.cpp \
  	Serial/DrvChar.cpp \
  	Serial/DrvNamedPipe.cpp \
+ 	Serial/DrvTCP.cpp \
  	Serial/DrvRawFile.cpp \
  	Storage/DrvBlock.cpp \
  	Storage/DrvMediaISO.cpp \
@@ -184,8 +186,6 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  	Storage/ATAPIPassthrough.cpp \
  	Network/DrvNetSniffer.cpp \
  	Network/Pcap.cpp
- VBoxDD_SOURCES.win      = \
-        build/VBoxDD.rc
  ifn1of ($(KBUILD_TARGET), os2)
   VBoxDD_SOURCES += Storage/DrvHostBase.cpp
  endif
@@ -234,8 +234,7 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
   VBoxDD_DEFS           += VBOX_WITH_HGSMI
   VBoxDD_SOURCES        += \
  	Graphics/DevVGA_VBVA.cpp \
- 	Graphics/HGSMI/HGSMIHost.cpp \
- 	Graphics/HGSMI/HGSMIHostHlp.cpp
+ 	Graphics/HGSMI/HGSMIHost.cpp
   VBoxDD_LIBS           += \
  	$(PATH_STAGE_LIB)/HGSMIHostR3Lib$(VBOX_SUFF_LIB)
  endif
@@ -355,6 +354,12 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  	USB/DevEHCI.cpp
   endif
 
+  if defined(VBOX_WITH_XHCI_IMPL) && !defined(VBOX_WITH_EXTPACK_PUEL)
+   VBoxDD_DEFS          += VBOX_WITH_XHCI_IMPL
+   VBoxDD_SOURCES       += \
+ 	USB/DevXHCI.cpp
+  endif
+
   if defined(VBOX_WITH_USB_VIDEO_IMPL) && !defined(VBOX_WITH_EXTPACK_PUEL)
    if1of ($(KBUILD_TARGET), linux)
     VBoxDD_DEFS          += VBOX_WITH_USB_VIDEO_IMPL
@@ -392,22 +397,15 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
   VBoxDD_DEFS           += VBOX_WITH_INIP
   VBoxDD_SOURCES        += \
         Network/DevINIP.cpp
-  ifndef VBOX_WITH_NEW_LWIP
-    include $(PATH_SUB_CURRENT)/Network/lwip/Makefile.kmk
-    VBoxDD_INCS         += $(LWIP_INCS)
-    VBoxDD_SOURCES      += $(LWIP_SOURCES)
-  else
-    # XXX: do not depend on order
-    ifndef LWIP_SOURCES
-      include $(PATH_SUB_CURRENT)/Network/lwip-new/Makefile.kmk
-    endif
-    Network/DevINIP.cpp_DEFS += VBOX_WITH_NEW_LWIP
-    VBoxDD_LWIP_INCS += Network # for lwipopts.h
-    $(eval $(call def_vbox_lwip_private, \
-                      VBoxDD, Network/lwip-new))
-    $(eval $(call def_vbox_lwip_flags, \
-                      VBoxDD, Network/DevINIP.cpp, Network/lwip-new))
+  # XXX: do not depend on order
+  ifndef LWIP_SOURCES
+    include $(PATH_SUB_CURRENT)/Network/lwip-new/Makefile.kmk
   endif
+  VBoxDD_LWIP_INCS += Network # for lwipopts.h
+  $(eval $(call def_vbox_lwip_private, \
+                    VBoxDD, Network/lwip-new))
+  $(eval $(call def_vbox_lwip_flags, \
+                    VBoxDD, Network/DevINIP.cpp, Network/lwip-new))
  endif # VBOX_WITH_INIP
 
  ifdef VBOX_WITH_E1000
@@ -478,13 +476,8 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  endif
 
  ifdef VBOX_WITH_ISCSI
-  ifdef VBOX_WITH_NEW_LWIP
-    Storage/DrvVD.cpp_DEFS += VBOX_WITH_NEW_LWIP
-    $(eval $(call def_vbox_lwip_flags, \
-                      VBoxDD, Storage/DrvVD.cpp, Network/lwip-new))
-  else
-    Storage/DrvVD.cpp_INCS = $(LWIP_INCS)
-  endif
+  $(eval $(call def_vbox_lwip_flags, \
+                    VBoxDD, Storage/DrvVD.cpp, Network/lwip-new))
  endif
 
  ifdef VBOX_WITH_DRV_DISK_INTEGRITY
@@ -528,24 +521,120 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
 
  # --- Audio bits. ---
 
- ifdef VBOX_WITH_ALSA
-  VBoxDD_DEFS.linux     += VBOX_WITH_ALSA
-  VBoxDD_SOURCES.linux  += \
- 	Audio/alsaaudio.c \
- 	Audio/alsa_stubs.c
- endif
+ ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+  VBoxDD_DEFS            += VBOX_WITH_PDM_AUDIO_DRIVER
+  VBoxDD_SOURCES         += \
+	Audio/AudioMixBuffer.cpp \
+	Audio/AudioMixer.cpp \
+	Audio/DrvAudio.cpp \
+	Audio/DrvAudioCommon.cpp \
+	Audio/DrvHostNullAudio.cpp
+
+  ifeq ($(KBUILD_TARGET),darwin)
+   VBoxDD_SOURCES += \
+	Audio/DrvHostCoreAudio.cpp
+  endif
 
- ifdef VBOX_WITH_PULSE
-  VBoxDD_DEFS.linux     += VBOX_WITH_PULSE
-  VBoxDD_SOURCES.linux  += \
- 	Audio/pulseaudio.c \
- 	Audio/pulse_stubs.c
-  VBoxDD_DEFS.freebsd   += VBOX_WITH_PULSE
-  VBoxDD_SOURCES.freebsd+= \
- 	Audio/pulseaudio.c \
- 	Audio/pulse_stubs.c
- endif
+  ifeq ($(KBUILD_TARGET),win)
+   VBoxDD_SOURCES += \
+	Audio/DrvHostDSound.cpp
+   VBoxDD_LIBS    += \
+	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/dsound.lib
+  endif
+
+  ifeq ($(KBUILD_TARGET),linux)
+   VBoxDD_SOURCES += \
+		Audio/DrvHostOSSAudio.cpp
+
+   ifdef VBOX_WITH_PULSE
+    VBoxDD_DEFS    += VBOX_WITH_PULSE
+    VBoxDD_SOURCES += \
+	Audio/DrvHostPulseAudio.cpp \
+	Audio/pulse_stubs.c
+   endif
+
+   ifdef VBOX_WITH_ALSA
+    VBoxDD_DEFS    += VBOX_WITH_ALSA
+    VBoxDD_SOURCES += \
+		Audio/DrvHostALSAAudio.cpp \
+		Audio/alsa_stubs.c
+   endif
+  endif
+
+  ifeq ($(KBUILD_TARGET),freebsd)
+   VBoxDD_SOURCES  += \
+		Audio/DrvHostOSSAudio.cpp
+   ifdef VBOX_WITH_PULSE
+    VBoxDD_DEFS    += VBOX_WITH_PULSE
+    VBoxDD_SOURCES += \
+	Audio/DrvHostPulseAudio.cpp \
+	Audio/pulse_stubs.c
+   endif
+  endif
+
+  ifeq ($(KBUILD_TARGET),solaris)
+   ifdef VBOX_WITH_SOLARIS_OSS
+    VBoxDD_SOURCES += Audio/DrvHostOSSAudio.cpp
+    VBoxDD_DEFS    += VBOX_WITH_SOLARIS_OSS
+   endif
+  endif
 
+ else # !VBOX_WITH_PDM_AUDIO_DRIVER
+
+  VBoxDD_SOURCES += \
+ 	 Audio/audio.c \
+ 	 Audio/audiosniffer.c \
+ 	 Audio/noaudio.c \
+ 	 Audio/filteraudio.c \
+	 Audio/mixeng.c
+
+  ifeq ($(KBUILD_TARGET),win)
+   VBoxDD_SOURCES += \
+	Audio/dsoundaudio.c
+  endif
+
+  VBoxDD_SOURCES.darwin  += \
+  	Audio/coreaudio.c
+
+  ifeq ($(KBUILD_TARGET),solaris)
+   VBoxDD_SOURCES += \
+ 	Audio/solaudio.c
+   ifdef VBOX_WITH_SOLARIS_OSS
+    VBoxDD_DEFS    += VBOX_WITH_SOLARIS_OSS
+    VBoxDD_SOURCES += \
+	Audio/ossaudio.c
+   endif
+  endif
+
+  ifeq ($(KBUILD_TARGET),linux)
+   VBoxDD_SOURCES += \
+ 	  Audio/ossaudio.c
+   ifdef VBOX_WITH_PULSE
+    VBoxDD_DEFS    += VBOX_WITH_PULSE
+    VBoxDD_SOURCES += \
+ 	  Audio/pulseaudio.c \
+ 	  Audio/pulse_stubs.c
+   endif
+   ifdef VBOX_WITH_ALSA
+    VBoxDD_DEFS    += VBOX_WITH_ALSA
+    VBoxDD_SOURCES += \
+ 	  Audio/alsaaudio.c \
+ 	  Audio/alsa_stubs.c
+   endif
+  endif
+
+  ifeq ($(KBUILD_TARGET),freebsd)
+   VBoxDD_SOURCES += \
+ 	  Audio/ossaudio.c
+   ifdef VBOX_WITH_PULSE
+    VBoxDD_DEFS    += VBOX_WITH_PULSE
+    VBoxDD_SOURCES += \
+ 	  Audio/pulseaudio.c \
+ 	  Audio/pulse_stubs.c
+   endif
+  endif
+
+ endif # !VBOX_WITH_PDM_AUDIO_DRIVER
 
  # --- WARNING! SLIRP MESS AHEAD! ;-) ---
  VBOX_SLIRP_SOURCES = \
@@ -662,26 +751,21 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  # --- OS specific driver hacks. ---
 
  ifeq ($(KBUILD_TARGET),darwin)
-  VBoxDD_SOURCES.darwin += Serial/DrvHostSerial.cpp Audio/coreaudio.c
+  VBoxDD_SOURCES.darwin += Serial/DrvHostSerial.cpp
  endif # darwin
 
  ifeq ($(KBUILD_TARGET),freebsd)
-  VBoxDD_SOURCES += Serial/DrvHostSerial.cpp Audio/ossaudio.c
+  VBoxDD_SOURCES += Serial/DrvHostSerial.cpp
   VBoxDD_SOURCES.freebsd += Network/DrvTAP.cpp
  endif # freebsd
 
  VBoxDD_SOURCES.linux += \
  	Network/DrvTAP.cpp \
- 	Audio/ossaudio.c \
  	Parallel/DrvHostParallel.cpp \
  	Serial/DrvHostSerial.cpp
 
  ifeq ($(KBUILD_TARGET),solaris)
-  VBoxDD_SOURCES.solaris += Serial/DrvHostSerial.cpp Audio/solaudio.c
-  ifdef VBOX_WITH_SOLARIS_OSS
-   VBoxDD_SOURCES += Audio/ossaudio.c
-   VBoxDD_DEFS += VBOX_WITH_SOLARIS_OSS
-  endif
+  VBoxDD_SOURCES.solaris += Serial/DrvHostSerial.cpp
   ifdef VBOX_WITH_SUID_WRAPPER
    VBoxDD_DEFS += VBOX_WITH_SUID_WRAPPER
   endif
@@ -689,14 +773,13 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
 
  VBoxDD_DEFS.win += VBOX_WITH_WIN_PARPORT_SUP
  VBoxDD_SOURCES.win += \
- 	Audio/dsoundaudio.c \
- 	Serial/DrvHostSerial.cpp \
- 	Parallel/DrvHostParallel.cpp
+	Serial/DrvHostSerial.cpp \
+	Parallel/DrvHostParallel.cpp
 
  ifdef VBOX_WITH_VIRTUALKD
   VBoxDD_DEFS.win     += VBOX_WITH_VIRTUALKD
   VBoxDD_SOURCES.win  += \
-    Misc/VirtualKD.cpp
+	Misc/VirtualKD.cpp
  endif
 
  if defined(VBOX_WITH_NETFLT)
@@ -814,6 +897,8 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  Graphics/DevVGA.cpp_INCS = $(VgaBiosBin_0_OUTDIR)
  Graphics/DevVGA.cpp_DEPS = $(VgaBiosBin_0_OUTDIR)/vbetables.h
 
+ $(call VBOX_SET_VER_INFO_DLL,VBoxDD,VirtualBox VMM Devices and Drivers) # (last!)
+
 
  ifdef VBOX_WITH_RAW_MODE
   #
@@ -823,7 +908,7 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
   ifeq ($(KBUILD_TARGET_ARCH),x86)
    VBoxDDGC_DEFS.darwin   = VBOX_WITH_2X_4GB_ADDR_SPACE
   endif
-  VBoxDDGC_DEFS           = VBOX_WITH_HGCM
+  VBoxDDGC_DEFS           = $(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,)
   VBoxDDGC_INCS           = build
   VBoxDDGC_SOURCES        = \
  	Audio/DevIchHda.cpp \
@@ -901,6 +986,11 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
     VBoxDDGC_SOURCES    += \
   	USB/DevEHCI.cpp
    endif
+   if defined(VBOX_WITH_XHCI_IMPL) && !defined(VBOX_WITH_EXTPACK_PUEL)
+    VBoxDDGC_DEFS       += VBOX_WITH_XHCI_IMPL
+    VBoxDDGC_SOURCES    += \
+  	USB/DevXHCI.cpp
+   endif
   endif
 
   ifdef VBOX_WITH_VIDEOHWACCEL
@@ -936,6 +1026,8 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
   endif
  endif # VBOX_WITH_RAW_MODE
 
+ $(call VBOX_SET_VER_INFO_RC,VBoxDDGC,VirtualBox VMM Devices and Drivers$(COMMA) raw-mode) # last!
+
 
  #
  # VBoxDD2 (shared object)
@@ -950,8 +1042,6 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  	PC/DevAPIC.cpp \
  	PC/DevIoApic.cpp \
  	PC/DevLPC.cpp
- VBoxDD2_SOURCES.win     = \
-	build/VBoxDD2.rc
  VBoxDD2_LIBS            = \
  	$(PATH_STAGE_LIB)/PcBiosBin$(VBOX_SUFF_LIB) \
  	$(PATH_STAGE_LIB)/VgaBiosBin$(VBOX_SUFF_LIB) \
@@ -969,16 +1059,17 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
   VBoxDD2_DEFS          += VBOX_WITH_PXE_ROM
  endif
 
+ $(call VBOX_SET_VER_INFO_DLL,VBoxDD2,VirtualBox VMM Devices and Drivers 2) # (last!)
 
  #
  # VBoxDDR0 (sysmod)
  #
  VBoxDDR0_TEMPLATE       = VBoxR0
  VBoxDDR0_DEFS.darwin.x86= VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 VBOX_WITH_2X_4GB_ADDR_SPACE
- VBoxDDR0_DEFS           = IN_RT_R0 VBOX_WITH_HGCM # - WTF is IN_RT_R0 doing here?
- VBoxDDR0_DEFS.win    += VBOX_WITH_WIN_PARPORT_SUP
+ VBoxDDR0_DEFS           = IN_RT_R0 $(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) # - WTF is IN_RT_R0 doing here?
+ VBoxDDR0_DEFS.win      += VBOX_WITH_WIN_PARPORT_SUP
  VBoxDDR0_INCS           = build
- VBoxDDR0_SDKS.win 	 = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
+ VBoxDDR0_SDKS.win 	  = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
  VBoxDDR0_SOURCES        = \
  	build/VBoxDDR0.cpp \
  	Audio/DevIchHda.cpp \
@@ -1067,6 +1158,11 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
    VBoxDDR0_SOURCES     += \
  	USB/DevEHCI.cpp
   endif
+  if defined(VBOX_WITH_XHCI_IMPL) && !defined(VBOX_WITH_EXTPACK_PUEL)
+   VBoxDDR0_DEFS        += VBOX_WITH_XHCI_IMPL
+   VBoxDDR0_SOURCES     += \
+ 	USB/DevXHCI.cpp
+  endif
  endif
 
  if defined(VBOX_WITH_PCI_PASSTHROUGH_IMPL) && !defined(VBOX_WITH_EXTPACK_PUEL)
@@ -1109,6 +1205,8 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
  	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
  endif
 
+ $(call VBOX_SET_VER_INFO_R0,VBoxDDR0,VirtualBox VMM Devices and Drivers$(COMMA) ring-0) # (last!)
+
 
  ifdef VBOX_WITH_RAW_MODE
   #
@@ -1124,6 +1222,7 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
    	$(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB) \
    	$(PATH_STAGE_LIB)/VMMRCImp$(VBOX_SUFF_LIB)
   endif
+  $(call VBOX_SET_VER_INFO_RC,VBoxDD2GC,VirtualBox VMM Devices and Drivers 2$(COMMA) raw-mode)
  endif
 
 
@@ -1143,13 +1242,15 @@ if !defined(VBOX_ONLY_EXTPACKS)         # Goes on almost to the end of the file.
   	$(PATH_STAGE_LIB)/VMMR0Imp$(VBOX_SUFF_LIB) \
   	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
  endif
+ $(call VBOX_SET_VER_INFO_R0,VBoxDD2R0,VirtualBox VMM Devices and Drivers 2$(COMMA) ring-0) # (last!)
 
 
  #
  # Ring-0 Services (library, linked into VMMR0.r0)
  #
  ServicesR0_TEMPLATE  = VBoxR0
- ServicesR0_DEFS      = IN_INTNET_R0 IN_RT_R0 $(if $(VBOX_WITH_PCI_PASSTHROUGH),IN_PCIRAW_R0,) \
+ ServicesR0_DEFS      = IN_INTNET_R0 IN_RT_R0 \
+	$(if $(VBOX_WITH_PCI_PASSTHROUGH),IN_PCIRAW_R0,) \
 	$(if $(VBOX_WITH_NAT_SERVICE),VBOX_WITH_NAT_SERVICE,)
  ServicesR0_SOURCES   = \
  	Network/SrvIntNetR0.cpp \
@@ -1235,42 +1336,58 @@ if defined(VBOX_WITH_EXTPACK_PUEL) && defined(VBOX_WITH_EXTPACK_PUEL_BUILD)
  if defined(VBOX_WITH_USB)
   DLLS += VBoxEhciR3
   VBoxEhciR3_TEMPLATE = VBoxR3ExtPackPuel
-  VBoxEhciR3_SOURCES  = USB/DevEHCI.cpp
-  VBoxEhciR3_SOURCES.win = \
- 	build/VBoxEhciR3.rc
+  VBoxEhciR3_SOURCES  = \
+	USB/DevEHCI.cpp \
+	USB/DevXHCI.cpp
+  $(call VBOX_SET_VER_INFO_DLL,VBoxEhciR3,PUEL Extension Pack - EHCI Device)
 
   SYSMODS += VBoxEhciR0
   VBoxEhciR0_TEMPLATE = VBoxR0ExtPackPuel
-  VBoxEhciR0_SOURCES  = USB/DevEHCI.cpp
+  VBoxEhciR0_SOURCES  = \
+	USB/DevEHCI.cpp \
+	USB/DevXHCI.cpp
+  $(call VBOX_SET_VER_INFO_R0,VBoxEhciR0,PUEL Extension Pack - EHCI Device$(COMMA) ring-0)
 
   ifdef VBOX_WITH_RAW_MODE
    SYSMODS += VBoxEhciRC
    VBoxEhciRC_TEMPLATE = VBoxRcExtPackPuel
-   VBoxEhciRC_SOURCES  = USB/DevEHCI.cpp
+   VBoxEhciRC_SOURCES  = \
+	USB/DevEHCI.cpp \
+	USB/DevXHCI.cpp
+   $(call VBOX_SET_VER_INFO_RC,VBoxEhciRC,PUEL Extension Pack - EHCI Device$(COMMA) raw-mode)
   endif
+
+  # Hacky but MSI support *must* be enabled
+  ifdef VBOX_WITH_MSI_DEVICES
+   VBoxEhciR3_DEFS += VBOX_WITH_MSI_DEVICES
+   VBoxEhciR0_DEFS += VBOX_WITH_MSI_DEVICES
+   VBoxEhciRC_DEFS += VBOX_WITH_MSI_DEVICES
+  endif
+
  endif
 
  if defined(VBOX_WITH_PCI_PASSTHROUGH)
   DLLS += VBoxPciRawR3
   VBoxPciRawR3_TEMPLATE     = VBoxR3ExtPackPuel
   VBoxPciRawR3_SOURCES      = Bus/DevPciRaw.cpp
-  VBoxPciRawR3_SOURCES.win  = build/VBoxPciRawR3.rc
+  $(call VBOX_SET_VER_INFO_DLL,VBoxPciRawR3,PUEL Extension Pack - PCI Passthrough Device)
 
   DLLS += VBoxPciRawDrv
   VBoxPciRawDrv_TEMPLATE    = VBoxR3ExtPackPuel
   VBoxPciRawDrv_SOURCES     = Bus/DrvPciRaw.cpp
-  VBoxPciRawDrv_SOURCES.win = build/VBoxPciRawDrv.rc
+  $(call VBOX_SET_VER_INFO_DLL,VBoxPciRawDrv,PUEL Extension Pack - PCI Passthrough Driver)
 
   SYSMODS += VBoxPciRawR0
   VBoxPciRawR0_TEMPLATE     = VBoxR0ExtPackPuel
   VBoxPciRawR0_SOURCES      = Bus/DevPciRaw.cpp
+  $(call VBOX_SET_VER_INFO_R0,VBoxPciRawR0,PUEL Extension Pack - PCI Passthrough Driver$(COMMA) ring-0)
 
   Bus/DevPciRaw.cpp_INCS    = Bus
  endif
 
 
  #
- # The Intel PXE rom.
+ # The Intel PXE ROM.
  #
  INSTALLS += VBoxExtPackPuelInsRoms
  VBoxExtPackPuelInsRoms_TEMPLATE = VBoxInsExtPackPuel
@@ -1354,8 +1471,6 @@ if defined(VBOX_WITH_VMSVGA3D) && !defined(VBOX_ONLY_EXTPACKS)
  	Graphics/shaderlib/stateblock.c \
  	Graphics/shaderlib/directx.c \
  	Graphics/shaderlib/libWineStub/debug.c
- VBoxSVGA3D_SOURCES.win := \
- 	Graphics/VBoxSVGA3D.rc
  VBoxSVGA3D_LIBS        = $(LIB_RUNTIME)
  VBoxSVGA3D_LIBS.win   += $(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Opengl32.lib
  if1of ($(KBUILD_TARGET), solaris linux freebsd)
@@ -1363,6 +1478,7 @@ if defined(VBOX_WITH_VMSVGA3D) && !defined(VBOX_ONLY_EXTPACKS)
  endif
  VBoxSVGA3D_LDFLAGS.darwin += \
  	-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxSVGA3D.dylib
+ $(call VBOX_SET_VER_INFO_DLL,VBoxSVGA3D,VirtualBox VMSVGA 3D)
 
  #
  # The Objective C code needs to be separate since the shaderlib redefines most
diff --git a/src/VBox/Devices/Network/DevE1000.cpp b/src/VBox/Devices/Network/DevE1000.cpp
index a012ea9..a877b5c 100644
--- a/src/VBox/Devices/Network/DevE1000.cpp
+++ b/src/VBox/Devices/Network/DevE1000.cpp
@@ -158,9 +158,9 @@
 # ifdef E1K_REL_DEBUG
 #  define DEBUG
 #  define E1kLog(a)               LogRel(a)
-#  define E1kLog2(a)              do {} while (0) /* LogRel(a) */
-#  define E1kLog3(a)              do {} while (0) /* LogRel(a) */
-#  define E1kLogX(x, a)           do {} while (0) /* LogRel(a) */
+#  define E1kLog2(a)              LogRel(a)
+#  define E1kLog3(a)              LogRel(a)
+#  define E1kLogX(x, a)           LogRel(a)
 //#  define E1kLog3(a)              do {} while (0)
 # else
 #  define E1kLog(a)               do {} while (0)
@@ -1931,7 +1931,7 @@ static int e1kRaiseInterrupt(PE1KSTATE pThis, int rcBusy, uint32_t u32IntCause =
                 /* Raise(1) INTA(0) */
                 E1kLogRel(("E1000: irq RAISED icr&mask=0x%x, icr=0x%x\n", ICR & IMS, ICR));
                 PDMDevHlpPCISetIrq(pThis->CTX_SUFF(pDevIns), 0, 1);
-                E1kLog2(("%s e1kRaiseInterrupt: Raised. ICR&IMS=%08x\n",
+                E1kLog(("%s e1kRaiseInterrupt: Raised. ICR&IMS=%08x\n",
                         pThis->szPrf, ICR & IMS));
             }
         }
@@ -2636,17 +2636,6 @@ static int e1kRegWriteCTRL(PE1KSTATE pThis, uint32_t offset, uint32_t index, uin
     }
     else
     {
-
-#ifdef DEBUG
-        if (   (value & CTRL_SLU)
-            && !(STATUS & STATUS_LU))
-        {
-            E1kLog(("%s %s: STATUS %x, value %x, cable%s connected\n",
-                    pThis->szPrf, __FUNCTION__,
-                    STATUS, value,
-                    pThis->fCableConnected ? "" : " NOT"));
-        }
-#endif
         if (   (value & CTRL_SLU)
             && pThis->fCableConnected
             && !(STATUS & STATUS_LU))
@@ -2826,8 +2815,14 @@ static int e1kRegWriteMDIC(PE1KSTATE pThis, uint32_t offset, uint32_t index, uin
     }
     else if (GET_BITS_V(value, MDIC, PHY) != 1)
     {
-        E1kLog(("%s ERROR! Access to invalid PHY detected, phy=%d.\n",
+        E1kLog(("%s WARNING! Access to invalid PHY detected, phy=%d.\n",
                 pThis->szPrf, GET_BITS_V(value, MDIC, PHY)));
+        /*
+         * Some drivers scan the MDIO bus for a PHY. We can work with these
+         * drivers if we set MDIC_READY and MDIC_ERROR when there isn't a PHY
+         * at the requested address, see @bugref{7346}.
+         */
+        MDIC = MDIC_READY | MDIC_ERROR;
     }
     else
     {
@@ -2902,7 +2897,7 @@ static int e1kRegReadICR(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint3
                  * beginning of interrupt handler
                  */
                 E1kLogRel(("E1000: irq lowered, icr=0x%x\n", ICR));
-                E1kLog2(("%s e1kRegReadICR: Lowered IRQ (%08x)\n", pThis->szPrf, ICR));
+                E1kLog(("%s e1kRegReadICR: Lowered IRQ (%08x)\n", pThis->szPrf, ICR));
                 /* Clear all pending interrupts */
                 ICR = 0;
                 pThis->fIntRaised = false;
@@ -2963,7 +2958,7 @@ static int e1kRegWriteIMS(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint
 {
     IMS |= value;
     E1kLogRel(("E1000: irq enabled, RDH=%x RDT=%x TDH=%x TDT=%x\n", RDH, RDT, TDH, TDT));
-    E1kLog2(("%s e1kRegWriteIMS: IRQ enabled\n", pThis->szPrf));
+    E1kLog(("%s e1kRegWriteIMS: IRQ enabled\n", pThis->szPrf));
     /* Mask changes, we need to raise pending interrupts. */
     if ((ICR & IMS) && !pThis->fLocked)
     {
@@ -3007,10 +3002,10 @@ static int e1kRegWriteIMC(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint
         /* Lower(0) INTA(0) */
         PDMDevHlpPCISetIrq(pThis->CTX_SUFF(pDevIns), 0, 0);
         pThis->fIntRaised = false;
-        E1kLog2(("%s e1kRegWriteIMC: Lowered IRQ: ICR=%08x\n", pThis->szPrf, ICR));
+        E1kLog(("%s e1kRegWriteIMC: Lowered IRQ: ICR=%08x\n", pThis->szPrf, ICR));
     }
     IMS &= ~value;
-    E1kLog2(("%s e1kRegWriteIMC: IRQ disabled\n", pThis->szPrf));
+    E1kLog(("%s e1kRegWriteIMC: IRQ disabled\n", pThis->szPrf));
     e1kCsLeave(pThis);
 
     return VINF_SUCCESS;
@@ -3100,7 +3095,21 @@ static int e1kRegWriteRDT(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint
     int rc = e1kCsRxEnter(pThis, VINF_IOM_R3_MMIO_WRITE);
     if (RT_LIKELY(rc == VINF_SUCCESS))
     {
-        E1kLog2(("%s e1kRegWriteRDT\n",  pThis->szPrf));
+        E1kLog(("%s e1kRegWriteRDT\n",  pThis->szPrf));
+        /*
+         * Some drivers advance RDT too far, so that it equals RDH. This
+         * somehow manages to work with real hardware but not with this
+         * emulated device. We can work with these drivers if we just
+         * write 1 less when we see a driver writing RDT equal to RDH,
+         * see @bugref{7346}.
+         */
+        if (value == RDH)
+        {
+            if (RDH == 0)
+                value = (RDLEN / sizeof(E1KRXDESC)) - 1;
+            else
+                value = RDH - 1;
+        }
         rc = e1kRegWriteDefault(pThis, offset, index, value);
 #ifdef E1K_WITH_RXD_CACHE
         /*
@@ -3341,12 +3350,9 @@ static DECLCALLBACK(void) e1kLinkUpTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, vo
      * already armed (shortly after e1kLoadDone() or when the cable was disconnected
      * and connect+disconnect the cable very quick.
      */
-    if (!pThis->fCableConnected) {
-        E1kLog(("%s %s: cable not connected!\n", pThis->szPrf, __FUNCTION__));
+    if (!pThis->fCableConnected)
         return;
-    }
 
-    E1kLog(("%s %s\n", pThis->szPrf, __FUNCTION__));
     e1kR3LinkUp(pThis);
 }
 
@@ -5343,7 +5349,7 @@ static int e1kRegWriteTDT(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint
     if (TDH != TDT && (STATUS & STATUS_LU))
     {
         Log5(("E1000: TDT write: TDH=%08x, TDT=%08x, %d descriptors to process\n", TDH, TDT, e1kGetTxLen(pThis)));
-        E1kLog2(("%s e1kRegWriteTDT: %d descriptors to process\n",
+        E1kLog(("%s e1kRegWriteTDT: %d descriptors to process\n",
                  pThis->szPrf, e1kGetTxLen(pThis)));
 
         /* Transmit pending packets if possible, defer it if we cannot do it
@@ -5506,7 +5512,7 @@ static int e1kRegReadVFTA(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint
  */
 static int e1kRegReadUnimplemented(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint32_t *pu32Value)
 {
-    E1kLog2(("%s At %08X read (00000000) attempt from unimplemented register %s (%s)\n",
+    E1kLog(("%s At %08X read (00000000) attempt from unimplemented register %s (%s)\n",
             pThis->szPrf, offset, g_aE1kRegMap[index].abbrev, g_aE1kRegMap[index].name));
     *pu32Value = 0;
 
@@ -5576,7 +5582,7 @@ static int e1kRegReadDefault(PE1KSTATE pThis, uint32_t offset, uint32_t index, u
 
  static int e1kRegWriteUnimplemented(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint32_t value)
 {
-    E1kLog2(("%s At %08X write attempt (%08X) to  unimplemented register %s (%s)\n",
+    E1kLog(("%s At %08X write attempt (%08X) to  unimplemented register %s (%s)\n",
             pThis->szPrf, offset, value, g_aE1kRegMap[index].abbrev, g_aE1kRegMap[index].name));
 
     return VINF_SUCCESS;
@@ -5749,7 +5755,7 @@ static int e1kRegReadUnaligned(PE1KSTATE pThis, uint32_t offReg, void *pv, uint3
             STAM_COUNTER_INC(&pThis->aStatRegReads[index]);
     }
     else
-        E1kLog2(("%s At %08X read (%s) attempt from non-existing register\n",
+        E1kLog(("%s At %08X read (%s) attempt from non-existing register\n",
                 pThis->szPrf, offReg, e1kU32toHex(u32, mask, buf)));
 
     memcpy(pv, &u32, cb);
@@ -5849,7 +5855,7 @@ static int e1kRegWriteAlignedU32(PE1KSTATE pThis, uint32_t offReg, uint32_t u32V
             STAM_COUNTER_INC(&pThis->aStatRegWrites[index]);
     }
     else
-        E1kLog2(("%s At %08X write attempt (%08X) to  non-existing register\n",
+        E1kLog(("%s At %08X write attempt (%08X) to  non-existing register\n",
                 pThis->szPrf, offReg, u32Value));
     return rc;
 }
@@ -6492,8 +6498,7 @@ static DECLCALLBACK(int) e1kR3SetLinkState(PPDMINETWORKCONFIG pInterface, PDMNET
 {
     PE1KSTATE pThis = RT_FROM_MEMBER(pInterface, E1KSTATE, INetworkConfig);
 
-    E1kLog(("%s e1kR3SetLinkState: STATUS_LU=%s -> enmState=%d\n",
-            pThis->szPrf, STATUS & STATUS_LU ? "up" : "down", enmState));
+    E1kLog(("%s e1kR3SetLinkState: enmState=%d\n", pThis->szPrf, enmState));
     switch (enmState)
     {
         case PDMNETWORKLINKSTATE_UP:
diff --git a/src/VBox/Devices/Network/DevINIP.cpp b/src/VBox/Devices/Network/DevINIP.cpp
index 8234c5b..1604015 100644
--- a/src/VBox/Devices/Network/DevINIP.cpp
+++ b/src/VBox/Devices/Network/DevINIP.cpp
@@ -33,13 +33,11 @@ RT_C_DECLS_BEGIN
 #include "lwip/memp.h"
 #include "lwip/pbuf.h"
 #include "lwip/netif.h"
-#ifndef VBOX_WITH_NEW_LWIP
-# include "ipv4/lwip/ip.h"
-#else
-# include "lwip/api.h"
-# include "lwip/tcp_impl.h"
-# include "ipv6/lwip/ethip6.h"
-#endif
+#include "lwip/api.h"
+#include "lwip/tcp_impl.h"
+# if LWIP_IPV6
+#  include "ipv6/lwip/ethip6.h"
+# endif
 #include "lwip/udp.h"
 #include "lwip/tcp.h"
 #include "lwip/tcpip.h"
@@ -54,10 +52,7 @@ RT_C_DECLS_END
 #include <iprt/uuid.h>
 
 #include "VBoxDD.h"
-
-#ifdef VBOX_WITH_NEW_LWIP
-# include "VBoxLwipCore.h"
-#endif
+#include "VBoxLwipCore.h"
 
 /*******************************************************************************
 *   Macros and Defines                                                         *
@@ -114,15 +109,6 @@ typedef struct DEVINTNETIP
     const void             *pLinkHack;
     /** Flag whether the link is up. */
     bool                    fLnkUp;
-#ifndef VBOX_WITH_NEW_LWIP
-    /**
-     * This hack-flag for spliting initialization logic in devINIPTcpipInitDone,
-     * this is the only place when during initialization we can be called from TCPIP
-     * thread.
-     * This callback used for Initialization and Finalization with old lwip.
-     */
-    bool fTermination;
-#endif
     /**
      * In callback we're getting status of interface adding operation (TCPIP thread),
      * but we need inform constructing routine whether it was success or not(EMT thread).
@@ -158,63 +144,11 @@ static const PFNRT g_pDevINILinkHack[] =
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-#ifndef VBOX_WITH_NEW_LWIP
-static DECLCALLBACK(void) devINIPARPTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer);
-static DECLCALLBACK(void) devINIPTCPFastTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer);
-static DECLCALLBACK(void) devINIPTCPSlowTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer);
-#endif
 static DECLCALLBACK(err_t) devINIPOutput(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr);
 static DECLCALLBACK(err_t) devINIPOutputRaw(struct netif *netif, struct pbuf *p);
 static DECLCALLBACK(err_t) devINIPInterface(struct netif *netif);
 
 
-#ifndef VBOX_WITH_NEW_LWIP
-/**
- * ARP cache timeout handling for lwIP.
- *
- * @param   pDevIns     Device instance.
- * @param   pTimer      Pointer to timer.
- */
-static DECLCALLBACK(void) devINIPARPTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
-{
-    PDEVINTNETIP pThis = (PDEVINTNETIP)pvUser;
-    LogFlow(("%s: pDevIns=%p pTimer=%p\n", __FUNCTION__, pDevIns, pTimer));
-    lwip_etharp_tmr();
-    TMTimerSetMillies(pThis->ARPTimer, ARP_TMR_INTERVAL);
-    LogFlow(("%s: return\n", __FUNCTION__));
-}
-
-/**
- * TCP fast timer handling for lwIP.
- *
- * @param   pDevIns     Device instance.
- * @param   pTimer      Pointer to timer.
- */
-static DECLCALLBACK(void) devINIPTCPFastTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
-{
-    PDEVINTNETIP pThis = (PDEVINTNETIP)pvUser;
-    LogFlow(("%s: pDevIns=%p pTimer=%p\n", __FUNCTION__, pDevIns, pTimer));
-    lwip_tcp_fasttmr();
-    TMTimerSetMillies(pThis->TCPFastTimer, TCP_FAST_INTERVAL);
-    LogFlow(("%s: return\n", __FUNCTION__));
-}
-
-/**
- * TCP slow timer handling for lwIP.
- *
- * @param   pDevIns     Device instance.
- * @param   pTimer      Pointer to timer.
- */
-static DECLCALLBACK(void) devINIPTCPSlowTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
-{
-    PDEVINTNETIP pThis = (PDEVINTNETIP)pvUser;
-    LogFlow(("%s: pDevIns=%p pTimer=%p\n", __FUNCTION__, pDevIns, pTimer));
-    lwip_tcp_slowtmr();
-    TMTimerSetMillies(pThis->TCPSlowTimer, TCP_SLOW_INTERVAL);
-    LogFlow(("%s: return\n", __FUNCTION__));
-}
-#endif /* VBOX_WITH_NEW_LWIP */
-
 /**
  * Output a TCP/IP packet on the interface. Uses the generic lwIP ARP
  * code to resolve the address and call the link-level packet function.
@@ -229,11 +163,9 @@ static DECLCALLBACK(err_t) devINIPOutput(struct netif *netif, struct pbuf *p, st
     err_t lrc;
     LogFlow(("%s: netif=%p p=%p ipaddr=%#04x\n", __FUNCTION__, netif, p,
              ipaddr->addr));
-#ifndef VBOX_WITH_NEW_LWIP
-    lrc = lwip_etharp_output(netif, ipaddr, p);
-#else
+
     lrc = lwip_etharp_output(netif, p, ipaddr);
-#endif
+
     LogFlow(("%s: return %d\n", __FUNCTION__, lrc));
     return lrc;
 }
@@ -326,25 +258,18 @@ static DECLCALLBACK(err_t) devINIPInterface(struct netif *netif)
     memcpy(netif->hwaddr, &g_pDevINIPData->MAC, sizeof(g_pDevINIPData->MAC));
     netif->mtu = DEVINIP_MAX_FRAME;
     netif->flags = NETIF_FLAG_BROADCAST;
-#ifdef VBOX_WITH_NEW_LWIP
-    /** @todo why explicit ARP routing required for 1.2.0 case? */
     netif->flags |= NETIF_FLAG_ETHARP;
     netif->flags |= NETIF_FLAG_ETHERNET;
-    /* Note! We always assign link-local IPv6 address */
+
+#if LWIP_IPV6
     netif_create_ip6_linklocal_address(netif, 0);
     netif_ip6_addr_set_state(netif, 0, IP6_ADDR_VALID);
     netif->output_ip6 = ethip6_output;
     netif->ip6_autoconfig_enabled=1;
     LogFunc(("netif: ipv6:%RTnaipv6\n", &netif->ip6_addr[0].addr[0]));
-    netif->output = lwip_etharp_output;
-
-    lwip_etharp_init();
-#else
-    netif->output = devINIPOutput;
+#endif
 
-    lwip_etharp_init();
-    TMTimerSetMillies(g_pDevINIPData->ARPTimer, ARP_TMR_INTERVAL);
- #endif
+    netif->output = lwip_etharp_output;
     netif->linkoutput = devINIPOutputRaw;
 
     LogFlow(("%s: success\n", __FUNCTION__));
@@ -451,27 +376,10 @@ static DECLCALLBACK(int) devINIPNetworkDown_Input(PPDMINETWORKDOWN pInterface, c
 
         ethhdr = (const struct eth_hdr *)p->payload;
         struct netif *iface = &g_pDevINIPData->IntNetIF;
-#ifndef VBOX_WITH_NEW_LWIP
-        err_t lrc;
-        switch (htons(ethhdr->type))
-        {
-            case ETHTYPE_IP:    /* IP packet */
-                lwip_pbuf_header(p, -(ssize_t)sizeof(struct eth_hdr));
-                lrc = iface->input(p, iface);
-                if (lrc)
-                    rc = VERR_NET_IO_ERROR;
-                break;
-            case ETHTYPE_ARP:   /* ARP packet */
-                lwip_etharp_arp_input(iface, (struct eth_addr *)iface->hwaddr, p);
-                break;
-            default:
-                lwip_pbuf_free(p);
-        }
-#else
+
         /* We've setup flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET
           so this should be thread-safe. */
         tcpip_input(p,iface);
-#endif
     }
 
     LogFlow(("%s: return %Rrc\n", __FUNCTION__, rc));
@@ -499,11 +407,7 @@ static DECLCALLBACK(void) devINIPTcpipInitDone(void *arg)
     AssertPtrReturnVoid(arg);
 
     pThis->rcInitialization = VINF_SUCCESS;
-#ifndef VBOX_WITH_NEW_LWIP
-    /* see PDEVINTNETIP::fTermination */
-    if (!pThis->fTermination)
     {
-#endif
         struct netif *ret;
         struct ip_addr ipaddr, netmask, gw;
         struct in_addr ip;
@@ -564,18 +468,12 @@ static DECLCALLBACK(void) devINIPTcpipInitDone(void *arg)
 
         lwip_netif_set_default(&pThis->IntNetIF);
         lwip_netif_set_up(&pThis->IntNetIF);
-
-#ifndef VBOX_WITH_NEW_LWIP
     }
     done:
-    lwip_sys_sem_signal(pThis->LWIPTcpInitSem);
-#else
-    done:
     return;
-#endif
 }
 
-#ifdef VBOX_WITH_NEW_LWIP
+
 /**
  * This callback is for finitializing our activity on TCPIP thread.
  * XXX: We do it only for new LWIP, old LWIP will stay broken for now.
@@ -589,7 +487,6 @@ static DECLCALLBACK(void) devINIPTcpipFiniDone(void *arg)
     netif_set_down(&pThis->IntNetIF);
     netif_remove(&pThis->IntNetIF);
 }
-#endif
 
 
 /**
@@ -687,18 +584,7 @@ static DECLCALLBACK(int) devINIPDestruct(PPDMDEVINS pDevIns)
     PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
 
     if (g_pDevINIPData != NULL)
-    {
-#ifndef VBOX_WITH_NEW_LWIP
-        netif_set_down(&pThis->IntNetIF);
-        netif_remove(&pThis->IntNetIF);
-        pThis->fTermination = true;
-        tcpip_terminate();
-        lwip_sys_sem_wait(pThis->LWIPTcpInitSem);
-        lwip_sys_sem_free(pThis->LWIPTcpInitSem);
-#else
         vboxLwipCoreFinalize(devINIPTcpipFiniDone, pThis);
-#endif
-    }
 
     MMR3HeapFree(pThis->pszIP);
     pThis->pszIP = NULL;
@@ -719,9 +605,8 @@ static DECLCALLBACK(int) devINIPConstruct(PPDMDEVINS pDevIns, int iInstance, PCF
 {
     PDEVINTNETIP pThis = PDMINS_2_DATA(pDevIns, PDEVINTNETIP);
     int rc = VINF_SUCCESS;
-#ifdef VBOX_WITH_NEW_LWIP
     err_t errRc = ERR_OK;
-#endif
+
     LogFlow(("%s: pDevIns=%p iInstance=%d pCfg=%p\n", __FUNCTION__,
              pDevIns, iInstance, pCfg));
 
@@ -732,9 +617,7 @@ static DECLCALLBACK(int) devINIPConstruct(PPDMDEVINS pDevIns, int iInstance, PCF
      * Validate the config.
      */
     if (!CFGMR3AreValuesValid(pCfg, "MAC\0IP\0"
-#ifdef VBOX_WITH_NEW_LWIP
                                     "IPv6\0"
-#endif
                                     "Netmask\0Gateway\0"))
         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
                                 N_("Unknown Internal Networking IP configuration option"));
@@ -821,35 +704,7 @@ static DECLCALLBACK(int) devINIPConstruct(PPDMDEVINS pDevIns, int iInstance, PCF
     /*
      * Initialize lwIP.
      */
-#ifndef VBOX_WITH_NEW_LWIP
-    lwip_stats_init();
-    lwip_sys_init();
-# if MEM_LIBC_MALLOC == 0
-    lwip_mem_init();
-# endif
-    lwip_memp_init();
-    lwip_pbuf_init();
-    lwip_netif_init();
-    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, devINIPARPTimer, pThis,
-                                TMTIMER_FLAGS_NO_CRIT_SECT, "lwIP ARP", &pThis->ARPTimer);
-    AssertRCReturn(rc, rc);
-    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, devINIPTCPFastTimer, pThis,
-                                TMTIMER_FLAGS_NO_CRIT_SECT, "lwIP fast TCP", &pThis->TCPFastTimer);
-    AssertRCReturn(rc, rc);
-    TMTimerSetMillies(pThis->TCPFastTimer, TCP_FAST_INTERVAL);
-    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, devINIPTCPSlowTimer, pThis,
-                                TMTIMER_FLAGS_NO_CRIT_SECT, "lwIP slow TCP", &pThis->TCPSlowTimer);
-    AssertRCReturn(rc, rc);
-    TMTimerSetMillies(pThis->TCPFastTimer, TCP_SLOW_INTERVAL);
-
-    pThis->LWIPTcpInitSem = lwip_sys_sem_new(0);
-
-    lwip_tcpip_init(devINIPTcpipInitDone, pThis);
-    lwip_sys_sem_wait(pThis->LWIPTcpInitSem);
-
-#else /* VBOX_WITH_NEW_LWIP */
     vboxLwipCoreInitialize(devINIPTcpipInitDone, pThis);
-#endif
 
     /* this rc could be updated in devINIPTcpInitDone thread */
     AssertRCReturn(pThis->rcInitialization, pThis->rcInitialization);
diff --git a/src/VBox/Devices/Network/DevPCNet.cpp b/src/VBox/Devices/Network/DevPCNet.cpp
index 481267e..24613f6 100644
--- a/src/VBox/Devices/Network/DevPCNet.cpp
+++ b/src/VBox/Devices/Network/DevPCNet.cpp
@@ -632,6 +632,14 @@ AssertCompileSize(RMD, 16);
 
 static void pcnetPollTimerStart(PPCNETSTATE pThis);
 static int  pcnetXmitPending(PPCNETSTATE pThis, bool fOnWorkerThread);
+#ifdef PCNET_NO_POLLING
+PGM_ALL_CB_DECL(FNPGMPHYSHANDLER)           pcnetHandleRingWrite;
+# ifndef IN_RING3
+RT_C_DECLS_BEGIN
+DECLEXPORT(CTX_SUFF(FNPGM,PHYSPFHANDLER))   pcnetHandleRingWritePf;
+RT_C_DECLS_END
+# endif
+#endif
 
 
 
@@ -1074,12 +1082,6 @@ DECLINLINE(RTGCPHYS32) pcnetTdraAddr(PPCNETSTATE pThis, int idx)
     return pThis->GCTDRA + ((CSR_XMTRL(pThis) - idx) << pThis->iLog2DescSize);
 }
 
-RT_C_DECLS_BEGIN
-#ifndef IN_RING3
-DECLEXPORT(int) pcnetHandleRingWrite(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
-                                     RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
-#endif
-RT_C_DECLS_END
 
 #undef htonl
 #define htonl(x)    ASMByteSwapU32(x)
@@ -1094,25 +1096,26 @@ static int      pcnetBCRWriteU16(PPCNETSTATE pThis, uint32_t u32RAP, uint32_t va
 
 
 #ifdef PCNET_NO_POLLING
-# ifndef IN_RING3
 
+# ifndef IN_RING3
 /**
  * #PF Virtual Handler callback for Guest write access to the ring descriptor page(pThis)
  *
  * @return  VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         VM Handle.
+ * @param   pVCpu           The cross context CPU structure for the calling EMT.
  * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   GCPhysFault The GC physical address corresponding to pvFault.
  * @param   pvUser      User argument.
  */
-DECLEXPORT(int) pcnetHandleRingWrite(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
-                                     RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
+DECLEXPORT(int) pcnetHandleRingWritePf(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame,
+                                       RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
 {
-    PPCNETSTATE pThis   = (PPCNETSTATE)pvUser;
+    PPCNETSTATE pThis = (PPCNETSTATE)pvUser;
 
-    Log(("#%d pcnetHandleRingWriteGC: write to %#010x\n", PCNET_INST_NR, GCPhysFault));
+    Log(("#%d pcnetHandleRingWritePf: write to %#010x\n", PCNET_INST_NR, GCPhysFault));
 
     uint32_t cb;
     int rc = CTXALLSUFF(pThis->pfnEMInterpretInstruction)(pVM, pRegFrame, pvFault, &cb);
@@ -1148,11 +1151,11 @@ DECLEXPORT(int) pcnetHandleRingWrite(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE
     STAM_COUNTER_INC(&CTXALLSUFF(pThis->StatRingWriteFailed)); ;
     return VINF_IOM_R3_MMIO_WRITE; /* handle in ring3 */
 }
+#endif /* !IN_RING3 */
 
-# else /* IN_RING3 */
 
 /**
- * #PF Handler callback for physical access handler ranges (MMIO among others) in HC.
+ * #PF Handler callback for physical access handler ranges (MMIO among others).
  *
  * The handler can not raise any faults, it's mainly for monitoring write access
  * to certain pages.
@@ -1160,15 +1163,17 @@ DECLEXPORT(int) pcnetHandleRingWrite(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             VM Handle.
+ * @param   pVCpu           The cross context CPU structure for the calling EMT.
  * @param   GCPhys          The physical address the guest is writing to.
  * @param   pvPhys          The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
+ * @param   enmOrigin       Who is making the access.
  * @param   pvUser          User argument.
  */
-static DECLCALLBACK(int) pcnetHandleRingWrite(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf,
-                                              size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser)
+PGM_ALL_CB_DECL(int) pcnetHandleRingWrite(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                          PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     PPDMDEVINS  pDevIns = (PPDMDEVINS)pvUser;
     PPCNETSTATE pThis   = PDMINS_2_DATA(pDevIns, PPCNETSTATE);
@@ -1203,7 +1208,6 @@ static DECLCALLBACK(int) pcnetHandleRingWrite(PVM pVM, RTGCPHYS GCPhys, void *pv
     }
     return VINF_SUCCESS;
 }
-# endif /* !IN_RING3 */
 #endif /* PCNET_NO_POLLING */
 
 static void pcnetSoftReset(PPCNETSTATE pThis)
@@ -1356,16 +1360,13 @@ static void pcnetUpdateRingHandlers(PPCNETSTATE pThis)
             PGMHandlerPhysicalDeregister(PDMDevHlpGetVM(pDevIns),
                                         pThis->RDRAPhysOld & ~PAGE_OFFSET_MASK);
 
-        rc = PGMR3HandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns),
-                                          PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
-                                          pThis->GCRDRA & ~PAGE_OFFSET_MASK,
-                                          RT_ALIGN(pcnetRdraAddr(pThis, 0), PAGE_SIZE) - 1,
-                                          pcnetHandleRingWrite, pDevIns,
-                                          g_DevicePCNet.szR0Mod, "pcnetHandleRingWrite",
-                                          pThis->pDevInsHC->pvInstanceDataHC,
-                                          g_DevicePCNet.szRCMod, "pcnetHandleRingWrite",
-                                          pThis->pDevInsHC->pvInstanceDataRC,
-                                          "PCNet receive ring write access handler");
+        rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns),
+                                        pThis->GCRDRA & ~PAGE_OFFSET_MASK,
+                                        RT_ALIGN(pcnetRdraAddr(pThis, 0), PAGE_SIZE) - 1,
+                                        pThis->hNoPollingHandlerType, pDevIns,
+                                        pThis->pDevInsHC->pvInstanceDataHC,
+                                        pThis->pDevInsHC->pvInstanceDataRC,
+                                        "PCNet receive ring write access handler");
         AssertRC(rc);
 
         pThis->RDRAPhysOld = pThis->GCRDRA;
@@ -1395,16 +1396,14 @@ static void pcnetUpdateRingHandlers(PPCNETSTATE pThis)
                 PGMHandlerPhysicalDeregister(PDMDevHlpGetVM(pDevIns),
                                              pThis->TDRAPhysOld & ~PAGE_OFFSET_MASK);
 
-            rc = PGMR3HandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns),
-                                              PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
-                                              pThis->GCTDRA & ~PAGE_OFFSET_MASK,
-                                              RT_ALIGN(pcnetTdraAddr(pThis, 0), PAGE_SIZE) - 1,
-                                              pcnetHandleRingWrite, pDevIns,
-                                              g_DevicePCNet.szR0Mod, "pcnetHandleRingWrite",
-                                              pThis->pDevInsHC->pvInstanceDataHC,
-                                              g_DevicePCNet.szRCMod, "pcnetHandleRingWrite",
-                                              pThis->pDevInsHC->pvInstanceDataRC,
-                                              "PCNet transmit ring write access handler");
+            rc = PGMHandlerPhysicalRegister(PDMDevHlpGetVM(pDevIns),
+                                            pThis->GCTDRA & ~PAGE_OFFSET_MASK,
+                                            RT_ALIGN(pcnetTdraAddr(pThis, 0), PAGE_SIZE) - 1,
+                                            pThis->hNoPollingHandlerType,
+                                            pDevIns,
+                                            pThis->pDevInsHC->pvInstanceDataHC,
+                                            pThis->pDevInsHC->pvInstanceDataRC,
+                                            "PCNet transmit ring write access handler");
             AssertRC(rc);
 
             pThis->TDRAPhysOld = pThis->GCTDRA;
@@ -1548,8 +1547,7 @@ static void pcnetStart(PPCNETSTATE pThis)
 static void pcnetStop(PPCNETSTATE pThis)
 {
     Log(("#%d pcnetStop:\n", PCNET_INST_NR));
-    pThis->aCSR[0] &= ~0x7feb;
-    pThis->aCSR[0] |=  0x0014;
+    pThis->aCSR[0]  =  0x0004;
     pThis->aCSR[4] &= ~0x02c2;
     pThis->aCSR[5] &= ~0x0011;
     pcnetPollTimer(pThis);
@@ -4948,7 +4946,7 @@ static DECLCALLBACK(int) pcnetConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGM
     pThis->PciDev.config[0x3f] = 0xff;
 
     /*
-     * We use own critical section (historical reasons).
+     * We use our own critical section (historical reasons).
      */
     rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSect, RT_SRC_POS, "PCNet#%u", iInstance);
     AssertRCReturn(rc, rc);
@@ -4979,6 +4977,15 @@ static DECLCALLBACK(int) pcnetConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGM
     if (RT_SUCCESS(rc))
         rc = PDMR3LdrGetSymbolRCLazy(PDMDevHlpGetVM(pDevIns), NULL, NULL, "EMInterpretInstruction", (RTGCPTR *)&pThis->pfnEMInterpretInstructionRC);
     AssertLogRelMsgRCReturn(rc, ("PDMR3LdrGetSymbolRCLazy(EMInterpretInstruction) -> %Rrc\n", rc), rc);
+
+    rc = PGMR3HandlerPhysicalTypeRegister(PDMDevHlpGetVM(pDevIns), PGMPHYSHANDLERKIND_WRITE,
+                                          pcnetHandleRingWrite,
+                                          g_DevicePCNet.szR0Mod, "pcnetHandleRingWritePf",
+                                          g_DevicePCNet.szRCMod, "pcnetHandleRingWritePf",
+                                          "PCNet ring write access handler",
+                                          &pThis->hNoPollingHandlerType);
+    AssertRCReturn(rc, rc);
+
 #else
     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, pcnetTimer, pThis,
                                 TMTIMER_FLAGS_NO_CRIT_SECT, "PCNet Poll Timer", &pThis->pTimerPollR3);
diff --git a/src/VBox/Devices/Network/DrvNAT.cpp b/src/VBox/Devices/Network/DrvNAT.cpp
index 9aa54d2..46a9f81 100644
--- a/src/VBox/Devices/Network/DrvNAT.cpp
+++ b/src/VBox/Devices/Network/DrvNAT.cpp
@@ -390,7 +390,9 @@ static void drvNATFreeSgBuf(PDRVNAT pThis, PPDMSCATTERGATHER pSgBuf)
  */
 static void drvNATSendWorker(PDRVNAT pThis, PPDMSCATTERGATHER pSgBuf)
 {
+#ifndef DEBUG_andy /* Assertion happens often to me after resuming a VM -- no time to investigate this now. */
     Assert(pThis->enmLinkState == PDMNETWORKLINKSTATE_UP);
+#endif
     if (pThis->enmLinkState == PDMNETWORKLINKSTATE_UP)
     {
         struct mbuf *m = (struct mbuf *)pSgBuf->pvAllocator;
@@ -635,13 +637,13 @@ static void drvNATNotifyLinkChangedWorker(PDRVNAT pThis, PDMNETWORKLINKSTATE enm
     switch (enmLinkState)
     {
         case PDMNETWORKLINKSTATE_UP:
-            LogRel(("NAT: link up\n"));
+            LogRel(("NAT: Link up\n"));
             slirp_link_up(pThis->pNATState);
             break;
 
         case PDMNETWORKLINKSTATE_DOWN:
         case PDMNETWORKLINKSTATE_DOWN_RESUME:
-            LogRel(("NAT: link down\n"));
+            LogRel(("NAT: Link down\n"));
             slirp_link_down(pThis->pNATState);
             break;
 
@@ -799,7 +801,7 @@ static DECLCALLBACK(int) drvNATAsyncIoThread(PPDMDRVINS pDrvIns, PPDMTHREAD pThr
             }
             else if (cPollNegRet++ > 128)
             {
-                LogRel(("NAT:Poll returns (%s) suppressed %d\n", strerror(errno), cPollNegRet));
+                LogRel(("NAT: Poll returns (%s) suppressed %d\n", strerror(errno), cPollNegRet));
                 cPollNegRet = 0;
             }
         }
@@ -1419,7 +1421,7 @@ static DECLCALLBACK(int) drvNATConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
     /* NAT engine configuration */
     pThis->INetworkNATCfg.pfnRedirectRuleCommand = drvNATNetworkNatConfig_RedirectRuleCommand;
 #if HAVE_NOTIFICATION_FOR_DNS_UPDATE && !defined(RT_OS_DARWIN)
-    /* 
+    /*
      * On OS X we stick to the old OS X specific notifications for
      * now.  Elsewhere use IHostNameResolutionConfigurationChangeEvent
      * by enbaling HAVE_NOTIFICATION_FOR_DNS_UPDATE in libslirp.h.
@@ -1525,7 +1527,7 @@ static DECLCALLBACK(int) drvNATConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
         GET_STRING_ALLOC(rc, pThis, pCfg, "BindIP", pszBindIP);
         rc = slirp_set_binding_address(pThis->pNATState, pszBindIP);
         if (rc != 0 && pszBindIP && *pszBindIP)
-            LogRel(("NAT: value of BindIP has been ignored\n"));
+            LogRel(("NAT: Value of BindIP has been ignored\n"));
 
         if(pszBindIP != NULL)
             MMR3HeapFree(pszBindIP);
diff --git a/src/VBox/Devices/Network/DrvTAP.cpp b/src/VBox/Devices/Network/DrvTAP.cpp
index 0581b79..ce83a40 100644
--- a/src/VBox/Devices/Network/DrvTAP.cpp
+++ b/src/VBox/Devices/Network/DrvTAP.cpp
@@ -650,7 +650,7 @@ static DECLCALLBACK(int) SolarisTAPAttach(PDRVTAP pThis)
     if (ioctl(InterfaceFD, SIOCGLIFFLAGS, &ifReq) == -1)
         LogRel(("TAP#%d: Failed to get interface flags after setting PPA. errno=%d\n", pThis->pDrvIns->iInstance, errno));
 
-#ifdef VBOX_SOLARIS_TAP_ARP
+# ifdef VBOX_SOLARIS_TAP_ARP
     /* Interface */
     if (ioctl(InterfaceFD, I_PUSH, "arp") == -1)
         LogRel(("TAP#%d: Failed to push ARP to Interface FD. errno=%d\n", pThis->pDrvIns->iInstance, errno));
@@ -676,7 +676,7 @@ static DECLCALLBACK(int) SolarisTAPAttach(PDRVTAP pThis)
     ioIF.ic_dp = (char *)&ifReq;
     if (ioctl(ARPFileDes, I_STR, &ioIF) == -1)
         LogRel(("TAP#%d: Failed to set interface name to ARP.\n", pThis->pDrvIns->iInstance));
-#endif
+# endif
 
     /* We must use I_LINK and not I_PLINK as I_PLINK makes the link persistent.
      * Then we would not be able unlink the interface if we reuse it.
@@ -686,36 +686,36 @@ static DECLCALLBACK(int) SolarisTAPAttach(PDRVTAP pThis)
     if (IPMuxID == -1)
     {
         close(InterfaceFD);
-#ifdef VBOX_SOLARIS_TAP_ARP
+# ifdef VBOX_SOLARIS_TAP_ARP
         close(ARPFileDes);
-#endif
+# endif
         LogRel(("TAP#%d: Cannot link TAP device to IP.\n", pThis->pDrvIns->iInstance));
         return PDMDrvHlpVMSetError(pThis->pDrvIns, VERR_HOSTIF_IOCTL, RT_SRC_POS,
                     N_("Failed to link TAP device to IP. Check TAP interface name. errno=%d"), errno);
     }
 
-#ifdef VBOX_SOLARIS_TAP_ARP
+# ifdef VBOX_SOLARIS_TAP_ARP
     int ARPMuxID = ioctl(IPFileDes, I_LINK, ARPFileDes);
     if (ARPMuxID == -1)
         LogRel(("TAP#%d: Failed to link TAP device to ARP\n", pThis->pDrvIns->iInstance));
 
     close(ARPFileDes);
-#endif
+# endif
     close(InterfaceFD);
 
     /* Reuse ifReq */
     memset(&ifReq, 0, sizeof(ifReq));
     RTStrCopy(ifReq.lifr_name, sizeof(ifReq.lifr_name), pThis->pszDeviceName);
     ifReq.lifr_ip_muxid  = IPMuxID;
-#ifdef VBOX_SOLARIS_TAP_ARP
+# ifdef VBOX_SOLARIS_TAP_ARP
     ifReq.lifr_arp_muxid = ARPMuxID;
-#endif
+# endif
 
     if (ioctl(IPFileDes, SIOCSLIFMUXID, &ifReq) == -1)
     {
-#ifdef VBOX_SOLARIS_TAP_ARP
+# ifdef VBOX_SOLARIS_TAP_ARP
         ioctl(IPFileDes, I_PUNLINK, ARPMuxID);
-#endif
+# endif
         ioctl(IPFileDes, I_PUNLINK, IPMuxID);
         close(IPFileDes);
         LogRel(("TAP#%d: Failed to set Mux ID.\n", pThis->pDrvIns->iInstance));
@@ -725,7 +725,7 @@ static DECLCALLBACK(int) SolarisTAPAttach(PDRVTAP pThis)
 
     int rc = RTFileFromNative(&pThis->hFileDevice, TapFileDes);
     AssertLogRelRC(rc);
-    if (RT_FAILURE(rc)))
+    if (RT_FAILURE(rc))
     {
         close(IPFileDes);
         close(TapFileDes);
@@ -977,7 +977,7 @@ static DECLCALLBACK(int) drvTAPConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
         return PDMDrvHlpVMSetError(pDrvIns, VERR_HOSTIF_IOCTL, RT_SRC_POS,
                                    N_("Configuration error: Failed to configure /dev/net/tun. errno=%d"), errno);
     /** @todo determine device name. This can be done by reading the link /proc/<pid>/fd/<fd> */
-    Log(("drvTAPContruct: %d (from fd)\n", pThis->hFileDevice));
+    Log(("drvTAPContruct: %d (from fd)\n", (intptr_t)pThis->hFileDevice));
     rc = VINF_SUCCESS;
 
     /*
diff --git a/src/VBox/Devices/Network/SrvIntNetR0.cpp b/src/VBox/Devices/Network/SrvIntNetR0.cpp
index 8af684b..7367ee0 100644
--- a/src/VBox/Devices/Network/SrvIntNetR0.cpp
+++ b/src/VBox/Devices/Network/SrvIntNetR0.cpp
@@ -1,10 +1,15 @@
 /* $Id: SrvIntNetR0.cpp $ */
 /** @file
  * Internal networking - The ring 0 service.
+ *
+ * @remarks No lazy code changes.  If you don't understand exactly what you're
+ *          doing, get an understanding or forget it.
+ *          All changes shall be reviewed by bird before commit.  If not around,
+ *          email and let Frank and/or Klaus OK the changes before committing.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -157,27 +162,6 @@ typedef INTNETDSTTAB *PINTNETDSTTAB;
 /** Pointer to a const destination table. */
 typedef INTNETDSTTAB const *PCINTNETDSTTAB;
 
-
-/** Network layer address type. */
-typedef enum INTNETADDRTYPE
-{
-    /** The invalid 0 entry. */
-    kIntNetAddrType_Invalid = 0,
-    /** IP version 4. */
-    kIntNetAddrType_IPv4,
-    /** IP version 6. */
-    kIntNetAddrType_IPv6,
-    /** IPX. */
-    kIntNetAddrType_IPX,
-    /** The end of the valid values. */
-    kIntNetAddrType_End,
-    /** The usual 32-bit hack. */
-    kIntNetAddrType_32BitHack = 0x7fffffff
-} INTNETADDRTYPE;
-/** Pointer to a network layer address type. */
-typedef INTNETADDRTYPE *PINTNETADDRTYPE;
-
-
 /**
  * Address and type.
  */
@@ -350,13 +334,17 @@ typedef struct INTNETNETWORK
      * This is protected by the INTNET::hMtxCreateOpenDestroy. */
     struct INTNETNETWORK   *pNext;
 
-    /** The spinlock protecting MacTab and INTNETTRUNKIF::aAddrCache.
+    /** The spinlock protecting MacTab, aAddrBlacklist and INTNETIF::aAddrCache.
      *  Interrupt safe. */
     RTSPINLOCK              hAddrSpinlock;
     /** MAC address table.
      * This doubles as interface collection. */
     INTNETMACTAB            MacTab;
 
+    /** The network layer address cache. (Indexed by type, 0 entry isn't used.
+     * Contains host addresses.  We don't let guests spoof them. */
+    INTNETADDRCACHE         aAddrBlacklist[kIntNetAddrType_End];
+
     /** Wait for an interface to stop being busy so it can be removed or have its
      * destination table replaced.  We have to wait upon this while owning the
      * network mutex.  Will only ever have one waiter because of the big mutex. */
@@ -449,6 +437,28 @@ g_afIntNetOpenNetworkIfFlags[] =
 };
 
 
+/*******************************************************************************
+*   Forward Declarations                                                       *
+*******************************************************************************/
+static void intnetR0TrunkIfDestroy(PINTNETTRUNKIF pThis, PINTNETNETWORK pNetwork);
+
+
+/**
+ * Checks if a pointer belongs to the list of known networks without
+ * accessing memory it points to.
+ *
+ * @returns true, if such network is in the list.
+ * @param   pIntNet     The pointer to the internal network instance (global).
+ * @param   pNetwork    The pointer that must be validated.
+ */
+DECLINLINE(bool) intnetR0NetworkIsValid(PINTNET pIntNet, PINTNETNETWORK pNetwork)
+{
+    for (PINTNETNETWORK pCurr = pIntNet->pNetworks; pCurr; pCurr = pCurr->pNext)
+        if (pCurr == pNetwork)
+            return true;
+    return false;
+}
+
 
 /**
  * Worker for intnetR0SgWritePart that deals with the case where the
@@ -715,7 +725,8 @@ DECLINLINE(void) intnetR0BusyDecIf(PINTNETIF pIf)
  */
 DECLINLINE(void) intnetR0BusyDecTrunk(PINTNETTRUNKIF pTrunk)
 {
-    intnetR0BusyDec(pTrunk->pNetwork, &pTrunk->cBusy);
+    if (pTrunk)
+        intnetR0BusyDec(pTrunk->pNetwork, &pTrunk->cBusy);
 }
 
 
@@ -743,6 +754,7 @@ DECLINLINE(void) intnetR0BusyIncIf(PINTNETIF pIf)
  */
 DECLINLINE(void) intnetR0BusyIncTrunk(PINTNETTRUNKIF pTrunk)
 {
+    if (!pTrunk) return;
     uint32_t cNewBusy = ASMAtomicIncU32(&pTrunk->cBusy);
     AssertMsg((cNewBusy & ~INTNET_BUSY_WAKEUP_MASK) < INTNET_MAX_IFS * 3, ("%#x\n", cNewBusy));
     NOREF(cNewBusy);
@@ -1138,21 +1150,43 @@ DECLINLINE(void) intnetR0IfAddrCacheDelete(PINTNETIF pIf, PINTNETADDRCACHE pCach
  * @param   cbAddr          The address size (optimization).
  * @param   pszMsg          Log message.
  */
-DECLINLINE(void) intnetR0NetworkAddrCacheDelete(PINTNETNETWORK pNetwork, PCRTNETADDRU pAddr, INTNETADDRTYPE const enmType,
-                                                uint8_t const cbAddr, const char *pszMsg)
+DECLINLINE(void) intnetR0NetworkAddrCacheDeleteUnlocked(PINTNETNETWORK pNetwork,
+                                                        PCRTNETADDRU pAddr, INTNETADDRTYPE enmType,
+                                                        uint8_t const cbAddr,
+                                                        const char *pszMsg)
 {
-    RTSpinlockAcquire(pNetwork->hAddrSpinlock);
-
     uint32_t iIf = pNetwork->MacTab.cEntries;
     while (iIf--)
     {
         PINTNETIF pIf = pNetwork->MacTab.paEntries[iIf].pIf;
+
         int i = intnetR0IfAddrCacheLookup(&pIf->aAddrCache[enmType], pAddr, cbAddr);
         if (RT_UNLIKELY(i >= 0))
             intnetR0IfAddrCacheDeleteIt(pIf, &pIf->aAddrCache[enmType], i, pszMsg);
     }
+}
+
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+/**
+ * Deletes the address from all the interface caches.
+ *
+ * This is used to remove stale entries that has been reassigned to
+ * other machines on the network.
+ *
+ * @param   pNetwork        The network.
+ * @param   pAddr           The address.
+ * @param   enmType         The address type.
+ * @param   cbAddr          The address size (optimization).
+ * @param   pszMsg          Log message.
+ */
+DECLINLINE(void) intnetR0NetworkAddrCacheDelete(PINTNETNETWORK pNetwork, PCRTNETADDRU pAddr, INTNETADDRTYPE const enmType,
+                                                uint8_t const cbAddr, const char *pszMsg)
+{
+    RTSpinlockAcquire(pNetwork->hAddrSpinlock);
+
+    intnetR0NetworkAddrCacheDeleteUnlocked(pNetwork, pAddr, enmType, cbAddr, pszMsg);
+
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 }
 
 
@@ -1185,7 +1219,7 @@ DECLINLINE(void) intnetR0NetworkAddrCacheDeleteMinusIf(PINTNETNETWORK pNetwork,
         }
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 }
 
 
@@ -1212,17 +1246,125 @@ DECLINLINE(PINTNETIF) intnetR0NetworkAddrCacheLookupIf(PINTNETNETWORK pNetwork,
         if (i >= 0)
         {
             intnetR0BusyIncIf(pIf);
-            RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+            RTSpinlockRelease(pNetwork->hAddrSpinlock);
             return pIf;
         }
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
     return NULL;
 }
 
 
 /**
+ * Look up specified address in the network's blacklist.
+ *
+ * @param pNetwork      The network. 
+ * @param enmType       The address type.
+ * @param pAddr         The address.
+ */
+static bool intnetR0NetworkBlacklistLookup(PINTNETNETWORK pNetwork,
+                                           PCRTNETADDRU pAddr, INTNETADDRTYPE enmType)
+{
+    PINTNETADDRCACHE pCache = &pNetwork->aAddrBlacklist[enmType];
+
+    if (RT_UNLIKELY(pCache->cEntriesAlloc == 0))
+        return false;
+
+    const uint8_t cbAddr = pCache->cbAddress;
+    Assert(cbAddr == intnetR0AddrSize(enmType));
+
+    for (unsigned i = 0; i < pCache->cEntries; ++i)
+    {
+        uint8_t *pbEntry = pCache->pbEntries + pCache->cbEntry * i;
+        if (intnetR0AddrUIsEqualEx((PCRTNETADDRU)pbEntry, pAddr, cbAddr))
+            return true;
+    }
+
+    return false;
+}
+
+
+/**
+ * Deletes specified address from network's blacklist.
+ *
+ * @param pNetwork      The network. 
+ * @param enmType       The address type.
+ * @param pAddr         The address.
+ */
+static void intnetR0NetworkBlacklistDelete(PINTNETNETWORK pNetwork,
+                                           PCRTNETADDRU pAddr, INTNETADDRTYPE enmType)
+{
+    PINTNETADDRCACHE pCache = &pNetwork->aAddrBlacklist[enmType];
+
+    if (RT_UNLIKELY(pCache->cEntriesAlloc == 0))
+        return;
+
+    const uint8_t cbAddr = pCache->cbAddress;
+    Assert(cbAddr == intnetR0AddrSize(enmType));
+
+    for (unsigned i = 0; i < pCache->cEntries; ++i)
+    {
+        uint8_t *pbEntry = pCache->pbEntries + pCache->cbEntry * i;
+        if (!intnetR0AddrUIsEqualEx((PCRTNETADDRU)pbEntry, pAddr, cbAddr))
+            continue;
+
+        --pCache->cEntries;
+        memmove(pCache->pbEntries + i * pCache->cbEntry,
+                pCache->pbEntries + (i + 1) * pCache->cbEntry,
+                (pCache->cEntries - i) * pCache->cbEntry);
+        return;
+    }
+}
+
+
+/**
+ * Adds specified address from network's blacklist.
+ *
+ * @param pNetwork      The network. 
+ * @param enmType       The address type.
+ * @param pAddr         The address.
+ */
+static void intnetR0NetworkBlacklistAdd(PINTNETNETWORK pNetwork,
+                                        PCRTNETADDRU pAddr, INTNETADDRTYPE enmType)
+{
+    PINTNETADDRCACHE pCache = &pNetwork->aAddrBlacklist[enmType];
+
+    if (RT_UNLIKELY(pCache->cEntriesAlloc == 0))
+        return;
+
+    const uint8_t cbAddr = pCache->cbAddress;
+    Assert(cbAddr == intnetR0AddrSize(enmType));
+
+    /* lookup */
+    for (unsigned i = 0; i < pCache->cEntries; ++i)
+    {
+        uint8_t *pbEntry = pCache->pbEntries + pCache->cbEntry * i;
+        if (RT_UNLIKELY(intnetR0AddrUIsEqualEx((PCRTNETADDRU)pbEntry, pAddr, cbAddr)))
+            return; /* already exists */
+    }
+
+    if (pCache->cEntries >= pCache->cEntriesAlloc)
+    {
+        /* shift */
+        memmove(pCache->pbEntries, pCache->pbEntries + pCache->cbEntry, 
+                pCache->cbEntry * (pCache->cEntries - 1));
+        --pCache->cEntries;
+    }
+
+    Assert(pCache->cEntries < pCache->cEntriesAlloc);
+
+    /* push */
+    uint8_t *pbEntry = pCache->pbEntries + pCache->cEntries * pCache->cbEntry;
+    memcpy(pbEntry, pAddr, cbAddr);
+    memset(pbEntry + pCache->cbAddress, '\0', pCache->cbEntry - cbAddr);
+    ++pCache->cEntries;
+
+    Assert(pCache->cEntries <= pCache->cEntriesAlloc);
+}
+
+
+/**
  * Adds an address to the cache, the caller is responsible for making sure it's
  * not already in the cache.
  *
@@ -1233,16 +1375,48 @@ DECLINLINE(PINTNETIF) intnetR0NetworkAddrCacheLookupIf(PINTNETNETWORK pNetwork,
  * @param   pAddr       The address.
  * @param   pszMsg      log message.
  */
-static void intnetR0IfAddrCacheAddIt(PINTNETIF pIf, PINTNETADDRCACHE pCache, PCRTNETADDRU pAddr, const char *pszMsg)
+static void intnetR0IfAddrCacheAddIt(PINTNETIF pIf, INTNETADDRTYPE enmAddrType, PCRTNETADDRU pAddr,
+                                     const char *pszMsg)
 {
     PINTNETNETWORK  pNetwork = pIf->pNetwork;
     AssertReturnVoid(pNetwork);
+
+    PINTNETADDRCACHE pCache = &pIf->aAddrCache[enmAddrType];
+
+    const uint8_t cbAddr = pCache->cbAddress;
+    Assert(cbAddr == intnetR0AddrSize(enmAddrType));
+
     RTSpinlockAcquire(pNetwork->hAddrSpinlock);
 
+    bool fBlacklisted = intnetR0NetworkBlacklistLookup(pNetwork, pAddr, enmAddrType);
+    if (fBlacklisted)
+    {
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
+
+#ifdef LOG_ENABLED
+        switch (enmAddrType)
+        {
+            case kIntNetAddrType_IPv4:
+                Log(("%s: spoofing attempt for %RTnaipv4\n",
+                     __FUNCTION__, pAddr->IPv4));
+                break;
+            case kIntNetAddrType_IPv6:
+                Log(("%s: spoofing attempt for %RTnaipv6\n",
+                     __FUNCTION__, &pAddr->IPv6));
+                break;
+            default: 
+                Log(("%s: spoofing attempt for %.*Rhxs (type %d)\n",
+                     __FUNCTION__, cbAddr, pAddr, enmAddrType));
+                break;
+        }
+#endif
+        return;
+    }
+
     if (RT_UNLIKELY(!pCache->cEntriesAlloc))
     {
         /* This shouldn't happen*/
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
         return;
     }
 
@@ -1262,8 +1436,8 @@ static void intnetR0IfAddrCacheAddIt(PINTNETIF pIf, PINTNETADDRCACHE pCache, PCR
     uint8_t *pbEntry = pCache->pbEntries + pCache->cEntries * pCache->cbEntry;
     memcpy(pbEntry, pAddr, pCache->cbAddress);
     memset(pbEntry + pCache->cbAddress, '\0', pCache->cbEntry - pCache->cbAddress);
+
 #ifdef LOG_ENABLED
-    INTNETADDRTYPE enmAddrType = (INTNETADDRTYPE)(uintptr_t)(pCache - &pIf->aAddrCache[0]);
     switch (enmAddrType)
     {
         case kIntNetAddrType_IPv4:
@@ -1283,7 +1457,7 @@ static void intnetR0IfAddrCacheAddIt(PINTNETIF pIf, PINTNETADDRCACHE pCache, PCR
     pCache->cEntries++;
     Assert(pCache->cEntries <= pCache->cEntriesAlloc);
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 }
 
 
@@ -1296,8 +1470,14 @@ static void intnetR0IfAddrCacheAddIt(PINTNETIF pIf, PINTNETADDRCACHE pCache, PCR
  * @param   cbAddr      The size of the address (optimization).
  * @param   pszMsg      Log message.
  */
-static void intnetR0IfAddrCacheAddSlow(PINTNETIF pIf, PINTNETADDRCACHE pCache, PCRTNETADDRU pAddr, uint8_t const cbAddr, const char *pszMsg)
+static void intnetR0IfAddrCacheAddSlow(PINTNETIF pIf, INTNETADDRTYPE enmAddrType, PCRTNETADDRU pAddr,
+                                       const char *pszMsg)
 {
+    PINTNETADDRCACHE pCache = &pIf->aAddrCache[enmAddrType];
+
+    const uint8_t cbAddr = pCache->cbAddress;
+    Assert(cbAddr == intnetR0AddrSize(enmAddrType));
+
     /*
      * Check all but the first and last entries, the caller
      * has already checked those.
@@ -1315,7 +1495,7 @@ static void intnetR0IfAddrCacheAddSlow(PINTNETIF pIf, PINTNETADDRCACHE pCache, P
     /*
      * Not found, add it.
      */
-    intnetR0IfAddrCacheAddIt(pIf, pCache, pAddr, pszMsg);
+    intnetR0IfAddrCacheAddIt(pIf, enmAddrType, pAddr, pszMsg);
 }
 
 
@@ -1330,10 +1510,13 @@ static void intnetR0IfAddrCacheAddSlow(PINTNETIF pIf, PINTNETADDRCACHE pCache, P
  * @param   cbAddr      The size of the address (optimization).
  * @param   pszMsg      Log message.
  */
-DECLINLINE(void) intnetR0IfAddrCacheAdd(PINTNETIF pIf, PINTNETADDRCACHE pCache, PCRTNETADDRU pAddr,
-                                        uint8_t const cbAddr, const char *pszMsg)
+DECLINLINE(void) intnetR0IfAddrCacheAdd(PINTNETIF pIf, INTNETADDRTYPE enmAddrType, PCRTNETADDRU pAddr,
+                                        const char *pszMsg)
 {
-    Assert(pCache->cbAddress == cbAddr);
+    PINTNETADDRCACHE pCache = &pIf->aAddrCache[enmAddrType];
+
+    const uint8_t cbAddr = pCache->cbAddress;
+    Assert(cbAddr == intnetR0AddrSize(enmAddrType));
 
     /*
      * The optimized case is when the address the first or last cache entry.
@@ -1344,7 +1527,8 @@ DECLINLINE(void) intnetR0IfAddrCacheAdd(PINTNETIF pIf, PINTNETADDRCACHE pCache,
                       || (i > 1
                           && intnetR0AddrUIsEqualEx((PCRTNETADDRU)(pCache->pbEntries + pCache->cbEntry * i), pAddr, cbAddr))) ))
         return;
-    intnetR0IfAddrCacheAddSlow(pIf, pCache, pAddr, cbAddr, pszMsg);
+
+    intnetR0IfAddrCacheAddSlow(pIf, enmAddrType, pAddr, pszMsg);
 }
 
 
@@ -1540,7 +1724,7 @@ static INTNETSWDECISION intnetR0NetworkSwitchLevel3(PINTNETNETWORK pNetwork, PCR
         intnetR0BusyIncTrunk(pTrunk);
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
     return pDstTab->cIfs
          ? (!pDstTab->fTrunkDst ? INTNETSWDECISION_INTNET : INTNETSWDECISION_BROADCAST)
          : (!pDstTab->fTrunkDst ? INTNETSWDECISION_DROP   : INTNETSWDECISION_TRUNK);
@@ -1597,7 +1781,7 @@ static INTNETSWDECISION intnetR0NetworkPreSwitchUnicast(PINTNETNETWORK pNetwork,
         }
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
     return enmSwDecision;
 }
 
@@ -1710,7 +1894,7 @@ static INTNETSWDECISION intnetR0NetworkSwitchUnicast(PINTNETNETWORK pNetwork, ui
         intnetR0BusyIncTrunk(pTrunk);
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
     return pDstTab->cIfs
          ? (!pDstTab->fTrunkDst ? INTNETSWDECISION_INTNET : INTNETSWDECISION_BROADCAST)
          : (!pDstTab->fTrunkDst ? INTNETSWDECISION_DROP   : INTNETSWDECISION_TRUNK);
@@ -1772,7 +1956,7 @@ static INTNETSWDECISION intnetR0NetworkSwitchBroadcast(PINTNETNETWORK pNetwork,
         intnetR0BusyIncTrunk(pTrunk);
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
     return INTNETSWDECISION_BROADCAST;
 }
 
@@ -1833,7 +2017,7 @@ static INTNETSWDECISION intnetR0NetworkSwitchTrunkAndPromisc(PINTNETNETWORK pNet
         intnetR0BusyIncTrunk(pTrunk);
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
     return !pDstTab->cIfs
         ? (!pDstTab->fTrunkDst ? INTNETSWDECISION_DROP   : INTNETSWDECISION_TRUNK)
         : (!pDstTab->fTrunkDst ? INTNETSWDECISION_INTNET : INTNETSWDECISION_BROADCAST);
@@ -1875,7 +2059,7 @@ static INTNETSWDECISION intnetR0NetworkSwitchTrunk(PINTNETNETWORK pNetwork, uint
         intnetR0BusyIncTrunk(pTrunk);
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
     return pDstTab->fTrunkDst ? INTNETSWDECISION_TRUNK : INTNETSWDECISION_DROP;
 }
 
@@ -1969,7 +2153,7 @@ static int intnetR0NetworkEnsureTabSpace(PINTNETNETWORK pNetwork)
                         void *pvOld = *ppDstTab;
                         if (pvOld)
                             *ppDstTab = pNew;
-                        RTSpinlockReleaseNoInts(pTrunk->hDstTabSpinlock);
+                        RTSpinlockRelease(pTrunk->hDstTabSpinlock);
                         if (pvOld)
                         {
                             RTMemFree(pvOld);
@@ -2003,7 +2187,7 @@ static int intnetR0NetworkEnsureTabSpace(PINTNETNETWORK pNetwork)
                     pTab->paEntries         = paNew;
                     pTab->cEntriesAllocated = cAllocated;
 
-                    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+                    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
                     RTMemFree(paOld);
                 }
@@ -2116,12 +2300,12 @@ static void intnetR0NetworkSnoopDhcp(PINTNETNETWORK pNetwork, PCRTNETIPV4 pIpHdr
                     }
                 }
 
-                RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+                RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
                 if (pMatchingIf)
                 {
-                    intnetR0IfAddrCacheAdd(pMatchingIf, &pMatchingIf->aAddrCache[kIntNetAddrType_IPv4],
-                                           (PCRTNETADDRU)&pDhcp->bp_yiaddr, sizeof(RTNETADDRIPV4), "DHCP_MT_ACK");
+                    intnetR0IfAddrCacheAdd(pMatchingIf, kIntNetAddrType_IPv4,
+                                           (PCRTNETADDRU)&pDhcp->bp_yiaddr, "DHCP_MT_ACK");
                     intnetR0BusyDecIf(pMatchingIf);
                 }
             }
@@ -2149,7 +2333,7 @@ static void intnetR0NetworkSnoopDhcp(PINTNETNETWORK pNetwork, PCRTNETIPV4 pIpHdr
                 }
             }
 
-            RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+            RTSpinlockRelease(pNetwork->hAddrSpinlock);
             break;
         }
     }
@@ -2375,6 +2559,8 @@ static void intnetR0TrunkIfSnoopAddr(PINTNETNETWORK pNetwork, PCINTNETSG pSG, ui
  */
 static void intnetR0IfSnoopIPv6SourceAddr(PINTNETIF pIf, PCRTNETIPV6 pIpHdr, uint32_t cbPacket, bool fGso)
 {
+    NOREF(fGso);
+
     /*
      * Check the header size first to prevent access invalid data.
      */
@@ -2391,7 +2577,7 @@ static void intnetR0IfSnoopIPv6SourceAddr(PINTNETIF pIf, PCRTNETIPV6 pIpHdr, uin
     if (    intnetR0IPv6AddrIsGood(Addr.IPv6) && (pIpHdr->ip6_hlim == 0xff)
         &&  intnetR0IfAddrCacheLookupLikely(&pIf->aAddrCache[kIntNetAddrType_IPv6], &Addr, sizeof(Addr.IPv6)) < 0)
     {
-        intnetR0IfAddrCacheAddIt(pIf, &pIf->aAddrCache[kIntNetAddrType_IPv6], &Addr, "if/ipv6");
+        intnetR0IfAddrCacheAdd(pIf, kIntNetAddrType_IPv6, &Addr, "if/ipv6");
     }
 }
 
@@ -2437,7 +2623,8 @@ static void intnetR0IfSnoopIPv4SourceAddr(PINTNETIF pIf, PCRTNETIPV4 pIpHdr, uin
             Log(("intnetR0IfSnoopIPv4SourceAddr: bad ip header\n"));
             return;
         }
-        intnetR0IfAddrCacheAddIt(pIf, &pIf->aAddrCache[kIntNetAddrType_IPv4], &Addr, "if/ipv4");
+
+        intnetR0IfAddrCacheAddIt(pIf, kIntNetAddrType_IPv4, &Addr, "if/ipv4");
         fValidatedIpHdr = true;
     }
 
@@ -2513,8 +2700,9 @@ static void intnetR0IfSnoopArpAddr(PINTNETIF pIf, PCRTNETARPIPV4 pArpIPv4, uint3
 
     if (    !memcmp(&pArpIPv4->ar_sha, &pIf->MacAddr, sizeof(RTMAC))
         &&  intnetR0IPv4AddrIsGood(pArpIPv4->ar_spa))
-        intnetR0IfAddrCacheAdd(pIf, &pIf->aAddrCache[kIntNetAddrType_IPv4],
-                               (PCRTNETADDRU)&pArpIPv4->ar_spa, sizeof(RTNETADDRIPV4), "if/arp");
+    {
+        intnetR0IfAddrCacheAdd(pIf, kIntNetAddrType_IPv4, (PCRTNETADDRU)&pArpIPv4->ar_spa, "if/arp");
+    }
 }
 
 
@@ -2610,7 +2798,7 @@ static void intnetR0IfSend(PINTNETIF pIf, PINTNETIF pIfSender, PINTNETSG pSG, PC
      */
     RTSpinlockAcquire(pIf->hRecvInSpinlock);
     int rc = intnetR0RingWriteFrame(&pIf->pIntBuf->Recv, pSG, pNewDstMac);
-    RTSpinlockReleaseNoInts(pIf->hRecvInSpinlock);
+    RTSpinlockRelease(pIf->hRecvInSpinlock);
     if (RT_SUCCESS(rc))
     {
         pIf->cYields = 0;
@@ -2637,7 +2825,7 @@ static void intnetR0IfSend(PINTNETIF pIf, PINTNETIF pIfSender, PINTNETSG pSG, PC
 
             RTSpinlockAcquire(pIf->hRecvInSpinlock);
             rc = intnetR0RingWriteFrame(&pIf->pIntBuf->Recv, pSG, pNewDstMac);
-            RTSpinlockReleaseNoInts(pIf->hRecvInSpinlock);
+            RTSpinlockRelease(pIf->hRecvInSpinlock);
             if (RT_SUCCESS(rc))
             {
                 STAM_REL_COUNTER_INC(&pIf->pIntBuf->cStatYieldsOk);
@@ -2779,7 +2967,7 @@ static uint16_t computeIPv6FullChecksum(PCRTNETIPV6 pIpHdr)
  * Neighbor Discovery datagrams.
  */
 static void intnetR0TrunkSharedMacEditIPv6FromIntNet(PINTNETTRUNKIF pThis, PINTNETIF pIfSender,
-						     PRTNETETHERHDR pEthHdr, uint32_t cb)
+                                                     PRTNETETHERHDR pEthHdr, uint32_t cb)
 {
     if (RT_UNLIKELY(cb < sizeof(*pEthHdr)))
         return;
@@ -2806,24 +2994,24 @@ static void intnetR0TrunkSharedMacEditIPv6FromIntNet(PINTNETTRUNKIF pThis, PINTN
     switch (type)
     {
         case RTNETIPV6_ICMP_TYPE_RS:
-	    hdrlen = 8;
-	    break;
+            hdrlen = 8;
+            break;
 
         case RTNETIPV6_ICMP_TYPE_RA:
-	    hdrlen = 16;
-	    break;
+            hdrlen = 16;
+            break;
 
         case RTNETIPV6_ICMP_TYPE_NS:
-	    hdrlen = 24;
-	    break;
+            hdrlen = 24;
+            break;
 
         case RTNETIPV6_ICMP_TYPE_NA:
-	    hdrlen = 24;
-	    llaopt = RTNETIPV6_ICMP_ND_TLLA_OPT;
-	    break;
+            hdrlen = 24;
+            llaopt = RTNETIPV6_ICMP_ND_TLLA_OPT;
+            break;
 
         default:
-	    return;
+            return;
     }
 
     AssertReturnVoid(hdrlen > 0);
@@ -2831,7 +3019,7 @@ static void intnetR0TrunkSharedMacEditIPv6FromIntNet(PINTNETTRUNKIF pThis, PINTN
         return;
 
     if (RT_UNLIKELY(pICMPv6->icmp6_code != 0))
-	return;
+        return;
 
     PRTNETNDP_LLA_OPT pLLAOpt = NULL;
     char *pOpt = (char *)pICMPv6 + hdrlen;
@@ -2846,8 +3034,8 @@ static void intnetR0TrunkSharedMacEditIPv6FromIntNet(PINTNETTRUNKIF pThis, PINTN
 
         if (opt == llaopt)
         {
-	    if (RT_UNLIKELY(optlen != 8))
-		return;
+            if (RT_UNLIKELY(optlen != 8))
+                return;
             pLLAOpt = (PRTNETNDP_LLA_OPT)pOpt;
             break;
         }
@@ -3088,6 +3276,8 @@ static bool intnetR0NetworkSharedMacDetectAndFixBroadcast(PINTNETNETWORK pNetwor
  */
 static void intnetR0NetworkSnoopNAFromWire(PINTNETNETWORK pNetwork, PINTNETSG pSG, PRTNETETHERHDR pEthHdr)
 {
+    NOREF(pEthHdr);
+
     /*
      * Check the minimum size and get a linear copy of the thing to work on,
      * using the temporary buffer if necessary.
@@ -3179,8 +3369,15 @@ static void intnetR0NetworkEditArpFromWire(PINTNETNETWORK pNetwork, PINTNETSG pS
      * The thing we're interested in here is a reply to a query made by a guest
      * since we modified the MAC in the initial request the guest made.
      */
+    RTSpinlockAcquire(pNetwork->hAddrSpinlock);
+    RTMAC MacAddrTrunk;
+    if (pNetwork->MacTab.pTrunk)
+        MacAddrTrunk = pNetwork->MacTab.pTrunk->MacAddr;
+    else
+        memset(&MacAddrTrunk, 0, sizeof(MacAddrTrunk));
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
     if (    ar_oper == RTNET_ARPOP_REPLY
-        &&  !memcmp(&pArpIPv4->ar_tha, &pNetwork->MacTab.pTrunk->MacAddr, sizeof(RTMAC)))
+        &&  !memcmp(&pArpIPv4->ar_tha, &MacAddrTrunk, sizeof(RTMAC)))
     {
         PINTNETIF pIf = intnetR0NetworkAddrCacheLookupIf(pNetwork, (PCRTNETADDRU)&pArpIPv4->ar_tpa,
                                                          kIntNetAddrType_IPv4, sizeof(pArpIPv4->ar_tpa));
@@ -3188,7 +3385,7 @@ static void intnetR0NetworkEditArpFromWire(PINTNETNETWORK pNetwork, PINTNETSG pS
         {
             Log6(("fw: ar_tha %.6Rhxs -> %.6Rhxs\n", &pArpIPv4->ar_tha, &pIf->MacAddr));
             pArpIPv4->ar_tha = pIf->MacAddr;
-            if (!memcmp(&pEthHdr->DstMac, &pNetwork->MacTab.pTrunk->MacAddr, sizeof(RTMAC)))
+            if (!memcmp(&pEthHdr->DstMac, &MacAddrTrunk, sizeof(RTMAC)))
             {
                 Log6(("fw: DstMac %.6Rhxs -> %.6Rhxs\n", &pEthHdr->DstMac, &pIf->MacAddr));
                 pEthHdr->DstMac = pIf->MacAddr;
@@ -3354,7 +3551,7 @@ DECLINLINE(bool) intnetR0NetworkIsContextOk(PINTNETNETWORK pNetwork, PINTNETIF p
 
     /* ASSUMES: that the trunk won't change its report while we're checking. */
     PINTNETTRUNKIF  pTrunk = pDstTab->pTrunk;
-    if ((fTrunkDst & pTrunk->fNoPreemptDsts) == fTrunkDst)
+    if (pTrunk && (fTrunkDst & pTrunk->fNoPreemptDsts) == fTrunkDst)
         return true;
 
     /* ASSUMES: That a preemption test detects HM contexts. (Will work on
@@ -3396,7 +3593,7 @@ DECLINLINE(bool) intnetR0NetworkIsContextOkForBroadcast(PINTNETNETWORK pNetwork,
             || (   (!pNetwork->MacTab.fHostActive || (pTrunk->fNoPreemptDsts & INTNETTRUNKDIR_HOST) )
                 && (!pNetwork->MacTab.fWireActive || (pTrunk->fNoPreemptDsts & INTNETTRUNKDIR_WIRE) ) );
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
     return fRc;
 }
@@ -3599,7 +3796,8 @@ static void intnetR0NetworkReleaseDstTab(PINTNETNETWORK pNetwork, PINTNETDSTTAB
     if (pDstTab->fTrunkDst)
     {
         PINTNETTRUNKIF pTrunk = pDstTab->pTrunk;
-        intnetR0BusyDec(pNetwork, &pTrunk->cBusy);
+        if (pTrunk)
+            intnetR0BusyDec(pNetwork, &pTrunk->cBusy);
         pDstTab->pTrunk    = NULL;
         pDstTab->fTrunkDst = 0;
     }
@@ -3656,9 +3854,12 @@ static void intnetR0NetworkDeliver(PINTNETNETWORK pNetwork, PINTNETDSTTAB pDstTa
     if (pDstTab->fTrunkDst)
     {
         PINTNETTRUNKIF pTrunk = pDstTab->pTrunk;
-        if (pIfSender)
-            intnetR0TrunkIfSend(pTrunk, pNetwork, pIfSender, pDstTab->fTrunkDst, pSG);
-        intnetR0BusyDec(pNetwork, &pTrunk->cBusy);
+        if (pTrunk)
+        {
+            if (pIfSender)
+                intnetR0TrunkIfSend(pTrunk, pNetwork, pIfSender, pDstTab->fTrunkDst, pSG);
+            intnetR0BusyDec(pNetwork, &pTrunk->cBusy);
+        }
         pDstTab->pTrunk    = NULL;
         pDstTab->fTrunkDst = 0;
     }
@@ -3734,7 +3935,7 @@ static INTNETSWDECISION intnetR0NetworkSend(PINTNETNETWORK pNetwork, PINTNETIF p
             pIfEntry->MacAddr = EthHdr.SrcMac;
         pIfSender->MacAddr    = EthHdr.SrcMac;
 
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
     }
 
     /*
@@ -4105,7 +4306,7 @@ INTNETR0DECL(int) IntNetR0IfSetPromiscuousMode(INTNETIFHANDLE hIf, PSUPDRVSESSIO
             }
         }
 
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
     }
     else
         rc = VERR_WRONG_ORDER;
@@ -4189,7 +4390,7 @@ INTNETR0DECL(int) IntNetR0IfSetMacAddress(INTNETIFHANDLE hIf, PSUPDRVSESSION pSe
                 intnetR0BusyIncTrunk(pTrunk);
         }
 
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
         if (pTrunk)
         {
@@ -4288,7 +4489,7 @@ static int intnetR0NetworkSetIfActive(PINTNETNETWORK pNetwork, PINTNETIF pIf, bo
         }
     }
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
     /*
      * Tell the trunk if necessary.
@@ -4693,7 +4894,7 @@ static DECLCALLBACK(void) intnetR0IfDestruct(void *pvObj, void *pvUser1, void *p
 
         PINTNETTRUNKIF pTrunk = pNetwork->MacTab.pTrunk;
 
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
         /* Notify the trunk about the interface being destroyed. */
         if (pTrunk && pTrunk->pIfPort)
@@ -4705,7 +4906,7 @@ static DECLCALLBACK(void) intnetR0IfDestruct(void *pvObj, void *pvUser1, void *p
         /* Release our reference to the network. */
         RTSpinlockAcquire(pNetwork->hAddrSpinlock);
         pIf->pNetwork = NULL;
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
         SUPR0ObjRelease(pNetwork->pvObj, pIf->pSession);
     }
@@ -4919,7 +5120,7 @@ static int intnetR0NetworkCreateIf(PINTNETNETWORK pNetwork, PSUPDRVSESSION pSess
                     if (pTrunk)
                         intnetR0BusyIncTrunk(pTrunk);
 
-                    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+                    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
                     if (pTrunk)
                     {
@@ -4993,7 +5194,7 @@ static DECLCALLBACK(void) intnetR0TrunkIfPortReportMacAddress(PINTNETTRUNKSWPORT
         pNetwork->MacTab.HostMac = *pMacAddr;
         pThis->MacAddr           = *pMacAddr;
 
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
     }
     else
         pThis->MacAddr = *pMacAddr;
@@ -5021,7 +5222,7 @@ static DECLCALLBACK(void) intnetR0TrunkIfPortReportPromiscuousMode(PINTNETTRUNKS
         pNetwork->MacTab.fHostPromiscuousEff  = pNetwork->MacTab.fHostPromiscuousReal
                                              && (pNetwork->fFlags & INTNET_OPEN_FLAGS_PROMISC_ALLOW_TRUNK_HOST);
 
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
     }
     intnetR0BusyDecTrunk(pThis);
 }
@@ -5056,6 +5257,65 @@ static DECLCALLBACK(void) intnetR0TrunkIfPortReportNoPreemptDsts(PINTNETTRUNKSWP
 }
 
 
+/** @copydoc INTNETTRUNKSWPORT::pfnDisconnect */
+static DECLCALLBACK(void) intnetR0TrunkIfPortDisconnect(PINTNETTRUNKSWPORT pSwitchPort, PINTNETTRUNKIFPORT pIfPort,
+                                                        PFNINTNETTRUNKIFPORTRELEASEBUSY pfnReleaseBusy)
+{
+    PINTNETTRUNKIF pThis = INTNET_SWITCHPORT_2_TRUNKIF(pSwitchPort);
+
+    /*
+     * The caller has marked the trunk instance busy on his side before making
+     * the call (see method docs) to let us safely grab the network and internal
+     * network instance pointers without racing the network destruction code
+     * (intnetR0TrunkIfDestroy (called by intnetR0TrunkIfDestroy) will wait for
+     * the interface to stop being busy before setting pNetwork to NULL and
+     * freeing up the resources).
+     */
+    PINTNETNETWORK pNetwork = pThis->pNetwork;
+    if (pNetwork)
+    {
+        PINTNET pIntNet = pNetwork->pIntNet;
+        Assert(pNetwork->pIntNet);
+
+        /*
+         * We must decrease the callers busy count here to prevent deadlocking
+         * when requesting the big mutex ownership.  This will of course
+         * unblock anyone stuck in intnetR0TrunkIfDestroy doing pfnWaitForIdle
+         * (the other deadlock party), so we have to revalidate the network
+         * pointer after taking ownership of the big mutex.
+         */
+        pfnReleaseBusy(pIfPort);
+
+        RTSemMutexRequest(pIntNet->hMtxCreateOpenDestroy, RT_INDEFINITE_WAIT);
+
+        if (intnetR0NetworkIsValid(pIntNet, pNetwork))
+        {
+            Assert(pNetwork->MacTab.pTrunk == pThis); /* Must be valid as long as tehre are no concurrent calls to this method. */
+            Assert(pThis->pIfPort == pIfPort);        /* Ditto */
+
+            /*
+             * Disconnect the trunk and destroy it, similar to what is done int
+             * intnetR0NetworkDestruct.
+             */
+            pIfPort->pfnSetState(pIfPort, INTNETTRUNKIFSTATE_DISCONNECTING);
+
+            RTSpinlockAcquire(pNetwork->hAddrSpinlock);
+            pNetwork->MacTab.pTrunk = NULL;
+            RTSpinlockRelease(pNetwork->hAddrSpinlock);
+
+            intnetR0TrunkIfDestroy(pThis, pNetwork);
+        }
+
+        RTSemMutexRelease(pIntNet->hMtxCreateOpenDestroy);
+    }
+    /*
+     * We must always release the busy reference.
+     */
+    else
+        pfnReleaseBusy(pIfPort);
+}
+
+
 /** @copydoc INTNETTRUNKSWPORT::pfnPreRecv */
 static DECLCALLBACK(INTNETSWDECISION) intnetR0TrunkIfPortPreRecv(PINTNETTRUNKSWPORT pSwitchPort,
                                                                  void const *pvSrc, size_t cbSrc, uint32_t fSrc)
@@ -5146,7 +5406,7 @@ static DECLCALLBACK(bool) intnetR0TrunkIfPortRecv(PINTNETTRUNKSWPORT pSwitchPort
                     }
                 }
             }
-            RTSpinlockReleaseNoInts(pThis->hDstTabSpinlock);
+            RTSpinlockRelease(pThis->hDstTabSpinlock);
             Assert(!pDstTab || iDstTab < pThis->cIntDstTabs);
         }
         else
@@ -5159,12 +5419,12 @@ static DECLCALLBACK(bool) intnetR0TrunkIfPortRecv(PINTNETTRUNKSWPORT pSwitchPort
             if (pDstTab)
             {
                 pThis->apIntDstTabs[iDstTab] = NULL;
-                RTSpinlockReleaseNoInts(pThis->hDstTabSpinlock);
+                RTSpinlockRelease(pThis->hDstTabSpinlock);
                 Assert(iDstTab < RT_ELEMENTS(pThis->apTaskDstTabs));
             }
             else
             {
-                RTSpinlockReleaseNoInts(pThis->hDstTabSpinlock);
+                RTSpinlockRelease(pThis->hDstTabSpinlock);
                 intnetR0AllocDstTab(pNetwork->MacTab.cEntriesAllocated, &pDstTab);
                 iDstTab = 65535;
             }
@@ -5203,7 +5463,7 @@ static DECLCALLBACK(bool) intnetR0TrunkIfPortRecv(PINTNETTRUNKSWPORT pSwitchPort
                             break;
                         }
                 }
-                RTSpinlockReleaseNoInts(pThis->hDstTabSpinlock);
+                RTSpinlockRelease(pThis->hDstTabSpinlock);
                 Assert(iDstTab < RT_MAX(RT_ELEMENTS(pThis->apTaskDstTabs), pThis->cIntDstTabs));
             }
         }
@@ -5253,6 +5513,54 @@ static DECLCALLBACK(void) intnetR0TrunkIfPortSGRelease(PINTNETTRUNKSWPORT pSwitc
 }
 
 
+/** @copydoc INTNETTRUNKSWPORT::pfnNotifyHostAddress */
+static DECLCALLBACK(void) intnetR0NetworkNotifyHostAddress(PINTNETTRUNKSWPORT pSwitchPort,
+                                                           bool fAdded,
+                                                           INTNETADDRTYPE enmType, const void *pvAddr)
+{
+    PINTNETTRUNKIF pTrunkIf = INTNET_SWITCHPORT_2_TRUNKIF(pSwitchPort);
+    PINTNETNETWORK pNetwork = pTrunkIf->pNetwork;
+    PCRTNETADDRU pAddr = (PCRTNETADDRU)pvAddr;
+    uint8_t cbAddr;
+
+    if (enmType == kIntNetAddrType_IPv4)
+    {
+        Log(("%s: %s %RTnaipv4\n",
+             __FUNCTION__, (fAdded ? "add" : "del"),
+             pAddr->IPv4));
+        cbAddr = 4;
+    }
+    else if (enmType == kIntNetAddrType_IPv6)
+    {
+        Log(("%s: %s %RTnaipv6\n",
+             __FUNCTION__, (fAdded ? "add" : "del"),
+             pAddr));
+        cbAddr = 16;
+    }
+    else
+    {
+        Log(("%s: unexpected address type %d\n", __FUNCTION__, enmType));
+        return;
+    }
+
+    RTSpinlockAcquire(pNetwork->hAddrSpinlock);
+    if (fAdded)         /* one of host interfaces got a new address */
+    {
+        /* blacklist it to prevent spoofing by guests */
+        intnetR0NetworkBlacklistAdd(pNetwork, pAddr, enmType);
+
+        /* kick out any guest that uses it */
+        intnetR0NetworkAddrCacheDeleteUnlocked(pNetwork, pAddr, enmType, cbAddr, "tif/host");
+    }
+    else                /* address deleted from one of host interfaces */
+    {
+        /* stop blacklisting it, guests may use it now */
+        intnetR0NetworkBlacklistDelete(pNetwork, pAddr, enmType);
+    }
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
+}
+
+
 /**
  * Shutdown the trunk interface.
  *
@@ -5280,7 +5588,7 @@ static void intnetR0TrunkIfDestroy(PINTNETTRUNKIF pThis, PINTNETNETWORK pNetwork
         /* unset it */
         pThis->pIfPort = NULL;
 
-        /* wait in portions so we can complain ever now an then. */
+        /* wait in portions so we can complain every now an then. */
         uint64_t StartTS = RTTimeSystemNanoTS();
         int rc = pIfPort->pfnWaitForIdle(pIfPort, 10*1000);
         if (RT_FAILURE(rc))
@@ -5314,7 +5622,7 @@ static void intnetR0TrunkIfDestroy(PINTNETTRUNKIF pThis, PINTNETNETWORK pNetwork
     /*
      * Free up the resources.
      */
-    pThis->pNetwork   = NULL;
+    pThis->pNetwork = NULL; /* Must not be cleared while busy, see intnetR0TrunkIfPortDisconnect. */
     RTSpinlockDestroy(pThis->hDstTabSpinlock);
     for (unsigned i = 0; i < RT_ELEMENTS(pThis->apTaskDstTabs); i++)
     {
@@ -5416,6 +5724,9 @@ static int intnetR0NetworkCreateTrunkIf(PINTNETNETWORK pNetwork, PSUPDRVSESSION
         pTrunk->SwitchPort.pfnReportPromiscuousMode   = intnetR0TrunkIfPortReportPromiscuousMode;
         pTrunk->SwitchPort.pfnReportGsoCapabilities   = intnetR0TrunkIfPortReportGsoCapabilities;
         pTrunk->SwitchPort.pfnReportNoPreemptDsts     = intnetR0TrunkIfPortReportNoPreemptDsts;
+        if (pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE)
+            pTrunk->SwitchPort.pfnNotifyHostAddress   = intnetR0NetworkNotifyHostAddress;
+        pTrunk->SwitchPort.pfnDisconnect              = intnetR0TrunkIfPortDisconnect;
         pTrunk->SwitchPort.u32VersionEnd              = INTNETTRUNKSWPORT_VERSION;
         //pTrunk->pIfPort                 = NULL;
         pTrunk->pNetwork                  = pNetwork;
@@ -5556,7 +5867,7 @@ static DECLCALLBACK(void) intnetR0NetworkDestruct(void *pvObj, void *pvUser1, vo
     pNetwork->MacTab.fHostActive = false;
     pNetwork->MacTab.fWireActive = false;
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
     /* Wait for all the interfaces to quiesce.  (Interfaces cannot be
        removed / added since we're holding the big lock.) */
@@ -5592,7 +5903,7 @@ static DECLCALLBACK(void) intnetR0NetworkDestruct(void *pvObj, void *pvUser1, vo
      */
     pNetwork->MacTab.pTrunk = NULL;
 
-    RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+    RTSpinlockRelease(pNetwork->hAddrSpinlock);
 
     if (pTrunk)
         intnetR0TrunkIfDestroy(pTrunk, pNetwork);
@@ -5625,6 +5936,8 @@ static DECLCALLBACK(void) intnetR0NetworkDestruct(void *pvObj, void *pvUser1, vo
     pNetwork->hAddrSpinlock = NIL_RTSPINLOCK;
     RTMemFree(pNetwork->MacTab.paEntries);
     pNetwork->MacTab.paEntries = NULL;
+    for (int i = kIntNetAddrType_Invalid + 1; i < kIntNetAddrType_End; i++)
+        intnetR0IfAddrCacheDestroy(&pNetwork->aAddrBlacklist[i]);
     RTMemFree(pNetwork);
 
     /* Release the create/destroy sem. */
@@ -5784,7 +6097,7 @@ static int intnetR0AdaptOpenNetworkFlags(PINTNETNETWORK pNetwork, uint32_t fFlag
             }
         }
 
-        RTSpinlockReleaseNoInts(pNetwork->hAddrSpinlock);
+        RTSpinlockRelease(pNetwork->hAddrSpinlock);
     }
 
     return VINF_SUCCESS;
@@ -6007,6 +6320,12 @@ static int intnetR0CreateNetwork(PINTNET pIntNet, PSUPDRVSESSION pSession, const
     }
     if (RT_SUCCESS(rc))
     {
+        for (int i = kIntNetAddrType_Invalid + 1; i < kIntNetAddrType_End && RT_SUCCESS(rc); i++)
+            rc = intnetR0IfAddrCacheInit(&pNetwork->aAddrBlacklist[i], (INTNETADDRTYPE)i,
+                                         !!(pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE));
+    }
+    if (RT_SUCCESS(rc))
+    {
         /*
          * Register the object in the current session and link it into the network list.
          */
diff --git a/src/VBox/Devices/Network/lwip-new/vbox/VBoxLwipCore.cpp b/src/VBox/Devices/Network/lwip-new/vbox/VBoxLwipCore.cpp
index f848e7b..d75c6b6 100644
--- a/src/VBox/Devices/Network/lwip-new/vbox/VBoxLwipCore.cpp
+++ b/src/VBox/Devices/Network/lwip-new/vbox/VBoxLwipCore.cpp
@@ -19,9 +19,9 @@
  * @todo: this should be somehow shared with with DevINIP, because
  * we want that every NAT and DevINIP instance uses a initialized LWIP
  * initialization of LWIP should happen on iLWIPInitiatorCounter 0 -> 1.
- * see pfnConstruct/Destruct. 
+ * see pfnConstruct/Destruct.
  *
- * @note: see comment to DevINIP.cpp:DevINIPConfigured 
+ * @note: see comment to DevINIP.cpp:DevINIPConfigured
  * @note: perhaps initilization stuff would be better move out of NAT driver,
  *  because we have to deal with attaching detaching NAT driver at runtime.
  */
@@ -48,12 +48,12 @@ extern "C" {
 typedef struct {
     PFNRT1 pfn;
     void *pvUser;
-} LWIPCOREUSERCALLBACK, *PLWIPCOREUSERCALLBACK; 
+} LWIPCOREUSERCALLBACK, *PLWIPCOREUSERCALLBACK;
 
 
 RTCLockMtx g_mtxLwip;
 
-typedef struct LWIPCORE 
+typedef struct LWIPCORE
 {
     int iLWIPInitiatorCounter;
     sys_sem_t LwipTcpIpSem;
@@ -163,7 +163,7 @@ int vboxLwipCoreInitialize(PFNRT1 pfnCallback, void *pvCallbackArg)
 
 
 /**
- * This function decrement lwip reference counter 
+ * This function decrement lwip reference counter
  * and calls tcpip thread termination function.
  */
 void vboxLwipCoreFinalize(PFNRT1 pfnCallback, void *pvCallbackArg)
diff --git a/src/VBox/Devices/Network/lwip-new/vbox/VBoxLwipCore.h b/src/VBox/Devices/Network/lwip-new/vbox/VBoxLwipCore.h
index dcf6f08..da9e687 100644
--- a/src/VBox/Devices/Network/lwip-new/vbox/VBoxLwipCore.h
+++ b/src/VBox/Devices/Network/lwip-new/vbox/VBoxLwipCore.h
@@ -22,7 +22,7 @@
 typedef DECLCALLBACK(void) FNRT1(void *);
 typedef FNRT1 *PFNRT1;
 /**
- * initiliazes LWIP core, and do callback on tcp/ip thread 
+ * initiliazes LWIP core, and do callback on tcp/ip thread
  */
 int vboxLwipCoreInitialize(PFNRT1 pfnCallback, void * pfnCallbackArg);
 void vboxLwipCoreFinalize(PFNRT1 pfnCallback, void * pfnCallbackArg);
diff --git a/src/VBox/Devices/Network/lwip-new/vbox/include/arch/cc.h b/src/VBox/Devices/Network/lwip-new/vbox/include/arch/cc.h
index d71a396..90ed1b5 100644
--- a/src/VBox/Devices/Network/lwip-new/vbox/include/arch/cc.h
+++ b/src/VBox/Devices/Network/lwip-new/vbox/include/arch/cc.h
@@ -33,7 +33,7 @@ typedef uintptr_t mem_ptr_t;
 # define PACK_STRUCT_STRUCT
 # define PACK_STRUCT_USE_INCLUDES
 # if _MSC_VER < 1600
-#  define LWIP_PROVIDE_ERRNO 
+#  define LWIP_PROVIDE_ERRNO
 # else
 #  include <errno.h>
 # endif
diff --git a/src/VBox/Devices/Network/lwip-new/vbox/include/lwip-namespace.h b/src/VBox/Devices/Network/lwip-new/vbox/include/lwip-namespace.h
index 41c0ffe..3aa59bc 100644
--- a/src/VBox/Devices/Network/lwip-new/vbox/include/lwip-namespace.h
+++ b/src/VBox/Devices/Network/lwip-new/vbox/include/lwip-namespace.h
@@ -187,7 +187,7 @@
 #define tcp_recved lwip_tcp_recved
 #define tcp_rexmit lwip_tcp_rexmit
 #define tcp_rexmit_rto lwip_tcp_rexmit_rto
-/* tcp_rst is renaming to tcp_rst_impl, 
+/* tcp_rst is renaming to tcp_rst_impl,
  * so for cleaner ABI, _impl was added. */
 #define tcp_rst_impl lwip_tcp_rst_impl
 #define tcp_seg_copy lwip_tcp_seg_copy
diff --git a/src/VBox/Devices/Network/lwip-new/vbox/sys_arch.c b/src/VBox/Devices/Network/lwip-new/vbox/sys_arch.c
index b10202e..42e3fef 100644
--- a/src/VBox/Devices/Network/lwip-new/vbox/sys_arch.c
+++ b/src/VBox/Devices/Network/lwip-new/vbox/sys_arch.c
@@ -402,7 +402,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *pvMbox, void **msg)
         /* (mbox) is empty, don't wait */
         rc = LWIPMutexRelease((mbox)->mutex);
         AssertRC(rc);
-	return SYS_MBOX_EMPTY;
+        return SYS_MBOX_EMPTY;
     }
     if (((mbox)->head + 1) % MBOX_ENTRIES_MAX == (mbox)->tail)
     {
diff --git a/src/VBox/Devices/Network/lwip/CHANGELOG b/src/VBox/Devices/Network/lwip/CHANGELOG
deleted file mode 100644
index 8ad980e..0000000
--- a/src/VBox/Devices/Network/lwip/CHANGELOG
+++ /dev/null
@@ -1,680 +0,0 @@
-FUTURE
-
-  * TODO: The lwIP source code makes some invalid assumptions on processor
-    word-length, storage sizes and alignment. See the mailing lists for
-    problems with exoteric (/DSP) architectures showing these problems.
-    We still have to fix some of these issues neatly.
-
-  * TODO: the ARP layer is not protected against concurrent access. If
-    you run from a multitasking OS, serialize access to ARP (called from
-    your network device driver and from a timeout thread.)
-
-  * TODO: the PPP code is broken in a few ways. There are namespace
-    collisions on BSD systems and many assumptions on word-length
-    (sizeof(int)). In ppp.c an assumption is made on the availability of
-    a thread subsystem. Either PPP needs to be moved to contrib/ports/???
-    or rearranged to be more generic.
-    
-  * TODO: review the the sequential netconn and socket API (lwip/src/api)
-    for bugs and performance issues. Frequent system calls (e.g. sys_mbox_fetch)
-    slooow things down considerably. 
-
-HISTORY
-
-(CVS HEAD)
-
-  * [Enter new changes just after this line - do not remove this line]
-
-  ++ New features:
-
-  2006-12-01 Christiaan Simons
-  * mem.h, opt.h: Added MEM_LIBC_MALLOC option.
-    Note this is a workaround. Currently I have no other options left.
-
-  2006-10-26 Christiaan Simons (accepted patch by Jonathan Larmour)
-  * ipv4/ip_frag.c: rename MAX_MTU to IP_FRAG_MAX_MTU and move define
-    to include/lwip/opt.h.
-  * ipv4/lwip/ip_frag.h: Remove unused IP_REASS_INTERVAL.
-    Move IP_REASS_MAXAGE and IP_REASS_BUFSIZE to include/lwip/opt.h.
-  * opt.h: Add above new options.
-
-  2006-08-18 Christiaan Simons
-  * tcp_{in,out}.c: added SNMP counters.
-  * ipv4/ip.c: added SNMP counters.
-  * ipv4/ip_frag.c: added SNMP counters.
-
-  2006-08-08 Christiaan Simons
-  * etharp.{c,h}: added etharp_find_addr() to read
-    (stable) ethernet/IP address pair from ARP table
-  
-  2006-07-14 Christiaan Simons
-  * mib_structs.c: added
-  * include/lwip/snmp_structs.h: added
-  * netif.{c,h}, netif/ethernetif.c: added SNMP statistics to netif struct
-
-  2006-07-06 Christiaan Simons
-  * snmp/asn1_{enc,dec}.c added
-  * snmp/mib2.c added
-  * snmp/msg_{in,out}.c added
-  * include/lwip/snmp_asn1.h added
-  * include/lwip/snmp_msg.h added
-  * doc/snmp_agent.txt added  
-
-  2006-03-29 Christiaan Simons
-  * inet.c, inet.h: Added platform byteswap support.
-    Added LWIP_PLATFORM_BYTESWAP define (defaults to 0) and
-    optional LWIP_PLATFORM_HTONS(), LWIP_PLATFORM_HTONL() macros.
-
-  ++ Bug fixes:
-  
-  2006-11-30 Christiaan Simons
-  * dhcp.c: Fixed false triggers of request_timeout.
-
-  2006-11-28 Christiaan Simons
-  * netif.c: In netif_add() fixed missing clear of ip_addr, netmask, gw and flags.
-
-  2006-10-11 Christiaan Simons
-  * api_lib.c etharp.c, ip.c, memp.c, stats.c, sys.{c,h} tcp.h:
-    Partially accepted patch #5449 for ANSI C compatibility / build fixes.
-  * ipv4/lwip/ip.h ipv6/lwip/ip.h: Corrected UDP-Lite protocol
-    identifier from 170 to 136 (bug #17574).
-
-  2006-10-10 Christiaan Simons
-  * api_msg.c: Fixed Nagle algorithm as reported by Bob Grice.
-
-  2006-08-17 Christiaan Simons
-  * udp.c: Fixed bug #17200, added check for broadcast
-    destinations for PCBs bound to a unicast address.
-
-  2006-08-07 Christiaan Simons
-  * api_msg.c: Flushing TCP output in do_close() (bug #15926).
-    
-  2006-06-27 Christiaan Simons
-  * api_msg.c: Applied patch for cold case (bug #11135).
-    In accept_function() ensure newconn->callback is always initialized.
-
-  2006-06-15 Christiaan Simons
-  * mem.h: added MEM_SIZE_F alias to fix an ancient cold case (bug #1748),
-    facilitate printing of mem_size_t and u16_t statistics.
-
-  2006-06-14 Christiaan Simons
-  * api_msg.c: Applied patch #5146 to handle allocation failures
-    in accept() by Kevin Lawson.
-
-  2006-05-26 Christiaan Simons
-  * api_lib.c: Removed conn->sem creation and destruction 
-    from netconn_write() and added sys_sem_new to netconn_new_*.
-
-(STABLE-1_1_1)
-
-  2006-03-03  Christiaan Simons
-  * ipv4/ip_frag.c: Added bound-checking assertions on ip_reassbitmap
-    access and added pbuf_alloc() return value checks.
-
-  2006-01-01  Leon Woestenberg <leon.woestenberg at gmx.net>
-  * tcp_{in,out}.c, tcp_out.c: Removed 'even sndbuf' fix in TCP, which is
-    now handled by the checksum routine properly.
-
-  2006-02-27  Leon Woestenberg <leon.woestenberg at gmx.net>
-   * pbuf.c: Fix alignment; pbuf_init() would not work unless
-     pbuf_pool_memory[] was properly aligned. (Patch by Curt McDowell.)
-
-  2005-12-20  Leon Woestenberg <leon.woestenberg at gmx.net>
-  * tcp.c: Remove PCBs which stay in LAST_ACK state too long. Patch
-    submitted by Mitrani Hiroshi.
-    
-  2005-12-15  Christiaan Simons
-  * inet.c: Disabled the added summing routine to preserve code space.
-
-  2005-12-14  Leon Woestenberg <leon.woestenberg at gmx.net>
-  * tcp_in.c: Duplicate FIN ACK race condition fix by Kelvin Lawson.
-    Added Curt McDowell's optimized checksumming routine for future
-    inclusion. Need to create test case for unaliged, aligned, odd,
-    even length combination of cases on various endianess machines.
-
-  2005-12-09  Christiaan Simons
-  * inet.c: Rewrote standard checksum routine in proper portable C.
-
-  2005-11-25  Christiaan Simons
-  * udp.c tcp.c: Removed SO_REUSE hack. Should reside in socket code only.
-  * *.c: introduced cc.h LWIP_DEBUG formatters matching the u16_t, s16_t,
-    u32_t, s32_t typedefs. This solves most debug word-length assumes.  
-
-  2005-07-17 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * inet.c: Fixed unaligned 16-bit access in the standard checksum
-    routine by Peter Jolasson.
-  * slipif.c: Fixed implementation assumption of single-pbuf datagrams.
-
-  2005-02-04 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * tcp_out.c: Fixed uninitialized 'queue' referenced in memerr branch.
-  * tcp_{out|in}.c: Applied patch fixing unaligned access.
-
-  2005-01-04 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * pbuf.c: Fixed missing semicolon after LWIP_DEBUG statement.
-
-  2005-01-03 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * udp.c: UDP pcb->recv() was called even when it was NULL.
-
-(STABLE-1_1_0)
-
-  2004-12-28 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * etharp.*: Disabled multiple packets on the ARP queue.
-    This clashes with TCP queueing.
-
-  2004-11-28 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * etharp.*: Fixed race condition from ARP request to ARP timeout.
-    Halved the ARP period, doubled the period counts.
-    ETHARP_MAX_PENDING now should be at least 2. This prevents
-    the counter from reaching 0 right away (which would allow
-    too little time for ARP responses to be received).
-    
-  2004-11-25 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * dhcp.c: Decline messages were not multicast but unicast.
-  * etharp.c: ETHARP_CREATE is renamed to ETHARP_TRY_HARD.
-    Do not try hard to insert arbitrary packet's source address,
-    etharp_ip_input() now calls etharp_update() without ETHARP_TRY_HARD. 
-    etharp_query() now always DOES call ETHARP_TRY_HARD so that users
-    querying an address will see it appear in the cache (DHCP could
-    suffer from this when a server invalidly gave an in-use address.)
-  * ipv4/ip_addr.h: Renamed ip_addr_maskcmp() to _netcmp() as we are
-    comparing network addresses (identifiers), not the network masks
-    themselves.
-  * ipv4/ip_addr.c: ip_addr_isbroadcast() now checks that the given
-    IP address actually belongs to the network of the given interface.
-
-  2004-11-24 Kieran Mansley <kjm25 at cam.ac.uk>
-  * tcp.c: Increment pcb->snd_buf when ACK is received in SYN_SENT state.
-
-(STABLE-1_1_0-RC1)
-
-  2004-10-16 Kieran Mansley <kjm25 at cam.ac.uk>
-  * tcp.c: Add code to tcp_recved() to send an ACK (window update) immediately,
-	even if one is already pending, if the rcv_wnd is above a threshold
-	(currently TCP_WND/2). This avoids waiting for a timer to expire to send a
-	delayed ACK in order to open the window if the stack is only receiving data.
-
-  2004-09-12 Kieran Mansley <kjm25 at cam.ac.uk>
-  * tcp*.*: Retransmit time-out handling improvement by Sam Jansen.
-
-  2004-08-20 Tony Mountifield <tony at softins.co.uk>
-  * etharp.c: Make sure the first pbuf queued on an ARP entry
-    is properly ref counted.
-
-  2004-07-27 Tony Mountifield <tony at softins.co.uk>
-  * debug.h: Added (int) cast in LWIP_DEBUGF() to avoid compiler
-    warnings about comparison.
-  * pbuf.c: Stopped compiler complaining of empty if statement
-    when LWIP_DEBUGF() empty.  Closed an unclosed comment.
-  * tcp.c: Stopped compiler complaining of empty if statement
-    when LWIP_DEBUGF() empty.
-  * ip.h Corrected IPH_TOS() macro: returns a byte, so doesn't need htons().
-  * inet.c: Added a couple of casts to quiet the compiler.
-    No need to test isascii(c) before isdigit(c) or isxdigit(c).
-
-  2004-07-22 Tony Mountifield <tony at softins.co.uk>
-  * inet.c: Made data types consistent in inet_ntoa().
-    Added casts for return values of checksum routines, to pacify compiler.
-  * ip_frag.c, tcp_out.c, sockets.c, pbuf.c
-    Small corrections to some debugging statements, to pacify compiler.
-
-  2004-07-21 Tony Mountifield <tony at softins.co.uk>
-  * etharp.c: Removed spurious semicolon and added missing end-of-comment.
-  * ethernetif.c Updated low_level_output() to match prototype for
-    netif->linkoutput and changed low_level_input() similarly for consistency.
-  * api_msg.c: Changed recv_raw() from int to u8_t, to match prototype
-    of raw_recv() in raw.h and so avoid compiler error.
-  * sockets.c: Added trivial (int) cast to keep compiler happier.
-  * ip.c, netif.c Changed debug statements to use the tidier ip4_addrN() macros.
-  
-(STABLE-1_0_0)
-
-  ++ Changes:
-
-  2004-07-05 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * sockets.*: Restructured LWIP_PRIVATE_TIMEVAL. Make sure
-    your cc.h file defines this either 1 or 0. If non-defined,
-    defaults to 1.
-  * .c: Added <string.h> and <errno.h> includes where used.
-  * etharp.c: Made some array indices unsigned.
-
-  2004-06-27 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * netif.*: Added netif_set_up()/down().
-  * dhcp.c: Changes to restart program flow.
-
-  2004-05-07 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * etharp.c: In find_entry(), instead of a list traversal per candidate, do a
-    single-pass lookup for different candidates. Should exploit locality.
-
-  2004-04-29 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * tcp*.c: Cleaned up source comment documentation for Doxygen processing.
-  * opt.h: ETHARP_ALWAYS_INSERT option removed to comply with ARP RFC.
-  * etharp.c: update_arp_entry() only adds new ARP entries when adviced to by
-    the caller. This deprecates the ETHARP_ALWAYS_INSERT overrule option.
-
-  ++ Bug fixes:
-
-  2004-04-27 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * etharp.c: Applied patch of bug #8708 by Toni Mountifield with a solution
-    suggested by Timmy Brolin. Fix for 32-bit processors that cannot access
-    non-aligned 32-bit words, such as soms 32-bit TCP/IP header fields. Fix
-    is to prefix the 14-bit Ethernet headers with two padding bytes.
-
-  2004-04-23 Leon Woestenberg <leon.woestenberg at gmx.net>
-  * ip_addr.c: Fix in the ip_addr_isbroadcast() check.
-  * etharp.c: Fixed the case where the packet that initiates the ARP request
-    is not queued, and gets lost. Fixed the case where the packets destination
-    address is already known; we now always queue the packet and perform an ARP
-    request.
-  
-(STABLE-0_7_0)
-
-  ++ Bug fixes:
-
-  * Fixed TCP bug for SYN_SENT to ESTABLISHED state transition.
-  * Fixed TCP bug in dequeueing of FIN from out of order segment queue.
-  * Fixed two possible NULL references in rare cases.
-
-(STABLE-0_6_6)
-
-  ++ Bug fixes:
-
-  * Fixed DHCP which did not include the IP address in DECLINE messages.
-
-  ++ Changes:
-
-  * etharp.c has been hauled over a bit.
-
-(STABLE-0_6_5)
-
-  ++ Bug fixes:
-
-  * Fixed TCP bug induced by bad window resizing with unidirectional TCP traffic.
-  * Packets sent from ARP queue had invalid source hardware address.
-
-  ++ Changes:
-
-  * Pass-by ARP requests do now update the cache.
-
-  ++ New features:
-
-  * No longer dependent on ctype.h.
-  * New socket options.
-  * Raw IP pcb support.
-
-(STABLE-0_6_4)
-
-  ++ Bug fixes:
-
-  * Some debug formatters and casts fixed.
-  * Numereous fixes in PPP.
-
-  ++ Changes:
-
-  * DEBUGF now is LWIP_DEBUGF
-  * pbuf_dechain() has been re-enabled.
-  * Mentioned the changed use of CVS branches in README.
-
-(STABLE-0_6_3)
-
-  ++ Bug fixes:
-
-  * Fixed pool pbuf memory leak in pbuf_alloc().
-    Occured if not enough PBUF_POOL pbufs for a packet pbuf chain.
-    Reported by Savin Zlobec.
-
-  * PBUF_POOL chains had their tot_len field not set for non-first
-    pbufs. Fixed in pbuf_alloc().
-
-  ++ New features:
-
-  * Added PPP stack contributed by Marc Boucher
-
-  ++ Changes:
-
-  * Now drops short packets for ICMP/UDP/TCP protocols. More robust.
-
-  * ARP queueuing now queues the latest packet instead of the first.
-    This is the RFC recommended behaviour, but can be overridden in
-    lwipopts.h.
-
-(0.6.2)
-
-  ++ Bugfixes:
-
-  * TCP has been fixed to deal with the new use of the pbuf->ref
-    counter.
-
-  * DHCP dhcp_inform() crash bug fixed.
-
-  ++ Changes:
-
-  * Removed pbuf_pool_free_cache and pbuf_pool_alloc_cache. Also removed
-    pbuf_refresh(). This has sped up pbuf pool operations considerably.
-    Implemented by David Haas.
-
-(0.6.1)
-
-  ++ New features:
-
-  * The packet buffer implementation has been enhanced to support
-    zero-copy and copy-on-demand for packet buffers which have their
-    payloads in application-managed memory.
-    Implemented by David Haas.
-
-    Use PBUF_REF to make a pbuf refer to RAM. lwIP will use zero-copy
-    if an outgoing packet can be directly sent on the link, or perform
-    a copy-on-demand when necessary.
-
-    The application can safely assume the packet is sent, and the RAM
-    is available to the application directly after calling udp_send()
-    or similar function.
-
-  ++ Bugfixes:
-
-  * ARP_QUEUEING should now correctly work for all cases, including
-    PBUF_REF.
-    Implemented by Leon Woestenberg.
-
-  ++ Changes:
-
-  * IP_ADDR_ANY is no longer a NULL pointer. Instead, it is a pointer
-    to a '0.0.0.0' IP address.
-
-  * The packet buffer implementation is changed. The pbuf->ref counter
-    meaning has changed, and several pbuf functions have been
-    adapted accordingly.
-
-  * netif drivers have to be changed to set the hardware address length field
-    that must be initialized correctly by the driver (hint: 6 for Ethernet MAC).
-    See the contrib/ports/c16x cs8900 driver as a driver example.
-
-  * netif's have a dhcp field that must be initialized to NULL by the driver.
-    See the contrib/ports/c16x cs8900 driver as a driver example.
-
-(0.5.x) This file has been unmaintained up to 0.6.1. All changes are
-  logged in CVS but have not been explained here.
-
-(0.5.3) Changes since version 0.5.2
-
-  ++ Bugfixes:
-
-  * memp_malloc(MEMP_API_MSG) could fail with multiple application
-    threads because it wasn't protected by semaphores.
-
-  ++ Other changes:
-
-  * struct ip_addr now packed.
-
-  * The name of the time variable in arp.c has been changed to ctime
-    to avoid conflicts with the time() function.
-
-(0.5.2) Changes since version 0.5.1
-
-  ++ New features:
-
-  * A new TCP function, tcp_tmr(), now handles both TCP timers.
-
-  ++ Bugfixes:
-
-  * A bug in tcp_parseopt() could cause the stack to hang because of a
-    malformed TCP option.
-
-  * The address of new connections in the accept() function in the BSD
-    socket library was not handled correctly.
-
-  * pbuf_dechain() did not update the ->tot_len field of the tail.
-
-  * Aborted TCP connections were not handled correctly in all
-    situations.
-
-  ++ Other changes:
-
-  * All protocol header structs are now packed.
-
-  * The ->len field in the tcp_seg structure now counts the actual
-    amount of data, and does not add one for SYN and FIN segments.
-
-(0.5.1) Changes since version 0.5.0
-
-  ++ New features:
-
-  * Possible to run as a user process under Linux.
-
-  * Preliminary support for cross platform packed structs.
-
-  * ARP timer now implemented.
-
-  ++ Bugfixes:
-
-  * TCP output queue length was badly initialized when opening
-    connections.
-
-  * TCP delayed ACKs were not sent correctly.
-
-  * Explicit initialization of BSS segment variables.
-
-  * read() in BSD socket library could drop data.
-
-  * Problems with memory alignment.
-
-  * Situations when all TCP buffers were used could lead to
-    starvation.
-
-  * TCP MSS option wasn't parsed correctly.
-
-  * Problems with UDP checksum calculation.
-
-  * IP multicast address tests had endianess problems.
-
-  * ARP requests had wrong destination hardware address.
-
-  ++ Other changes:
-
-  * struct eth_addr changed from u16_t[3] array to u8_t[6].
-
-  * A ->linkoutput() member was added to struct netif.
-
-  * TCP and UDP ->dest_* struct members where changed to ->remote_*.
-
-  * ntoh* macros are now null definitions for big endian CPUs.
-
-(0.5.0) Changes since version 0.4.2
-
-  ++ New features:
-
-  * Redesigned operating system emulation layer to make porting easier.
-
-  * Better control over TCP output buffers.
-
-  * Documenation added.
-
-  ++ Bugfixes:
-
-  * Locking issues in buffer management.
-
-  * Bugfixes in the sequential API.
-
-  * IP forwarding could cause memory leakage. This has been fixed.
-
-  ++ Other changes:
-
-  * Directory structure somewhat changed; the core/ tree has been
-    collapsed.
-
-(0.4.2) Changes since version 0.4.1
-
-  ++ New features:
-
-  * Experimental ARP implementation added.
-
-  * Skeleton Ethernet driver added.
-
-  * Experimental BSD socket API library added.
-
-  ++ Bugfixes:
-
-  * In very intense situations, memory leakage could occur. This has
-    been fixed.
-
-  ++ Other changes:
-
-  * Variables named "data" and "code" have been renamed in order to
-    avoid name conflicts in certain compilers.
-
-  * Variable++ have in appliciable cases been translated to ++variable
-    since some compilers generate better code in the latter case.
-
-(0.4.1) Changes since version 0.4
-
-  ++ New features:
-
-  * TCP: Connection attempts time out earlier than data
-    transmissions. Nagle algorithm implemented. Push flag set on the
-    last segment in a burst.
-
-  * UDP: experimental support for UDP-Lite extensions.
-
-  ++ Bugfixes:
-
-  * TCP: out of order segments were in some cases handled incorrectly,
-    and this has now been fixed. Delayed acknowledgements was broken
-    in 0.4, has now been fixed. Binding to an address that is in use
-    now results in an error. Reset connections sometimes hung an
-    application; this has been fixed.
-
-  * Checksum calculation sometimes failed for chained pbufs with odd
-    lengths. This has been fixed.
-
-  * API: a lot of bug fixes in the API. The UDP API has been improved
-    and tested. Error reporting and handling has been
-    improved. Logical flaws and race conditions for incoming TCP
-    connections has been found and removed.
-
-  * Memory manager: alignment issues. Reallocating memory sometimes
-    failed, this has been fixed.
-
-  * Generic library: bcopy was flawed and has been fixed.
-
-  ++ Other changes:
-
-  * API: all datatypes has been changed from generic ones such as
-    ints, to specified ones such as u16_t. Functions that return
-    errors now have the correct type (err_t).
-
-  * General: A lot of code cleaned up and debugging code removed. Many
-    portability issues have been fixed.
-
-  * The license was changed; the advertising clause was removed.
-
-  * C64 port added.
-
-  * Thanks: Huge thanks go to Dagan Galarneau, Horst Garnetzke, Petri
-    Kosunen, Mikael Caleres, and Frits Wilmink for reporting and
-    fixing bugs!
-
-(0.4) Changes since version 0.3.1
-
-  * Memory management has been radically changed; instead of
-    allocating memory from a shared heap, memory for objects that are
-    rapidly allocated and deallocated is now kept in pools. Allocation
-    and deallocation from those memory pools is very fast. The shared
-    heap is still present but is used less frequently.
-
-  * The memory, memory pool, and packet buffer subsystems now support
-    4-, 2-, or 1-byte alignment.
-
-  * "Out of memory" situations are handled in a more robust way.
-
-  * Stack usage has been reduced.
-
-  * Easier configuration of lwIP parameters such as memory usage,
-    TTLs, statistics gathering, etc. All configuration parameters are
-    now kept in a single header file "lwipopts.h".
-
-  * The directory structure has been changed slightly so that all
-    architecture specific files are kept under the src/arch
-    hierarchy.
-
-  * Error propagation has been improved, both in the protocol modules
-    and in the API.
-
-  * The code for the RTXC architecture has been implemented, tested
-    and put to use.
-
-  * Bugs have been found and corrected in the TCP, UDP, IP, API, and
-    the Internet checksum modules.
-
-  * Bugs related to porting between a 32-bit and a 16-bit architecture
-    have been found and corrected.
-
-  * The license has been changed slightly to conform more with the
-    original BSD license, including the advertisement clause.
-
-(0.3.1) Changes since version 0.3
-
-  * Fix of a fatal bug in the buffer management. Pbufs with allocated
-    RAM never returned the RAM when the pbuf was deallocated.
-
-  * TCP congestion control, window updates and retransmissions did not
-    work correctly. This has now been fixed.
-
-  * Bugfixes in the API.
-
-(0.3) Changes since version 0.2
-
-  * New and improved directory structure. All include files are now
-    kept in a dedicated include/ directory.
-
-  * The API now has proper error handling. A new function,
-    netconn_err(), now returns an error code for the connection in
-    case of errors.
-
-  * Improvements in the memory management subsystem. The system now
-    keeps a pointer to the lowest free memory block. A new function,
-    mem_malloc2() tries to allocate memory once, and if it fails tries
-    to free some memory and retry the allocation.
-
-  * Much testing has been done with limited memory
-    configurations. lwIP now does a better job when overloaded.
-
-  * Some bugfixes and improvements to the buffer (pbuf) subsystem.
-
-  * Many bugfixes in the TCP code:
-
-    - Fixed a bug in tcp_close().
-
-    - The TCP receive window was incorrectly closed when out of
-      sequence segments was received. This has been fixed.
-
-    - Connections are now timed-out of the FIN-WAIT-2 state.
-
-    - The initial congestion window could in some cases be too
-      large. This has been fixed.
-
-    - The retransmission queue could in some cases be screwed up. This
-      has been fixed.
-
-    - TCP RST flag now handled correctly.
-
-    - Out of sequence data was in some cases never delivered to the
-      application. This has been fixed.
-
-    - Retransmitted segments now contain the correct acknowledgment
-      number and advertised window.
-
-    - TCP retransmission timeout backoffs are not correctly computed
-      (ala BSD). After a number of retransmissions, TCP now gives up
-      the connection.
-
-  * TCP connections now are kept on three lists, one for active
-    connections, one for listening connections, and one for
-    connections that are in TIME-WAIT. This greatly speeds up the fast
-    timeout processing for sending delayed ACKs.
-
-  * TCP now provides proper feedback to the application when a
-    connection has been successfully set up.
-
-  * More comments have been added to the code. The code has also been
-    somewhat cleaned up.
-
-(0.2) Initial public release.
diff --git a/src/VBox/Devices/Network/lwip/COPYING b/src/VBox/Devices/Network/lwip/COPYING
deleted file mode 100644
index e23898b..0000000
--- a/src/VBox/Devices/Network/lwip/COPYING
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-
diff --git a/src/VBox/Devices/Network/lwip/FILES b/src/VBox/Devices/Network/lwip/FILES
deleted file mode 100644
index 6625319..0000000
--- a/src/VBox/Devices/Network/lwip/FILES
+++ /dev/null
@@ -1,4 +0,0 @@
-src/      - The source code for the lwIP TCP/IP stack.
-doc/      - The documentation for lwIP.
-
-See also the FILES file in each subdirectory.
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kmk b/src/VBox/Devices/Network/lwip/Makefile.kmk
deleted file mode 100644
index 357d869..0000000
--- a/src/VBox/Devices/Network/lwip/Makefile.kmk
+++ /dev/null
@@ -1,49 +0,0 @@
-# $Id: Makefile.kmk $
-## @file
-# Adds sources list and defines required to LWIP 1.2.0 compilation
-#
-
-#
-# Copyright (C) 2006-2012 Oracle Corporation
-#
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
-#
-
-  LWIP_INCS           += \
- 	Network/lwip/src/include \
- 	Network/lwip/src/include/ipv4 \
- 	Network/lwip/vbox/include
-  LWIP_SOURCES        += \
- 	Network/lwip/src/api/api_lib.c \
- 	Network/lwip/src/api/api_msg.c \
- 	Network/lwip/src/api/err.c \
- 	Network/lwip/src/api/sockets.c \
- 	Network/lwip/src/api/tcpip.c \
- 	Network/lwip/src/core/tcp_in.c \
- 	Network/lwip/src/core/dhcp.c \
- 	Network/lwip/src/core/inet.c \
- 	Network/lwip/src/core/mem.c \
- 	Network/lwip/src/core/memp.c \
- 	Network/lwip/src/core/netif.c \
- 	Network/lwip/src/core/pbuf.c \
- 	Network/lwip/src/core/raw.c \
- 	Network/lwip/src/core/stats.c \
- 	Network/lwip/src/core/sys.c \
- 	Network/lwip/src/core/tcp.c \
- 	Network/lwip/src/core/ipv4/ip_addr.c \
- 	Network/lwip/src/core/ipv4/icmp.c \
- 	Network/lwip/src/core/ipv4/ip.c \
- 	Network/lwip/src/core/ipv4/ip_frag.c \
- 	Network/lwip/src/core/tcp_out.c \
- 	Network/lwip/src/core/udp.c \
- 	Network/lwip/src/netif/etharp.c \
- 	Network/lwip/vbox/sys_arch.c
-  ifneq ($(KBUILD_TARGET),win)
-   Network/lwip/src/api/sockets.c_CFLAGS = $(VBOX_GCC_Wno-address)
-  endif
diff --git a/src/VBox/Devices/Network/lwip/README b/src/VBox/Devices/Network/lwip/README
deleted file mode 100644
index d910282..0000000
--- a/src/VBox/Devices/Network/lwip/README
+++ /dev/null
@@ -1,74 +0,0 @@
-INTRODUCTION
-
-lwIP is a small independent implementation of the TCP/IP protocol
-suite that has been developed by Adam Dunkels at the Computer and
-Networks Architectures (CNA) lab at the Swedish Institute of Computer
-Science (SICS).
-
-The focus of the lwIP TCP/IP implementation is to reduce the RAM usage
-while still having a full scale TCP. This making lwIP suitable for use
-in embedded systems with tens of kilobytes of free RAM and room for
-around 40 kilobytes of code ROM.
-
-FEATURES
-
- * IP (Internet Protocol) including packet forwarding over multiple
-   network interfaces
- * ICMP (Internet Control Message Protocol) for network maintenance
-   and debugging
- * UDP (User Datagram Protocol) including experimental UDP-lite
-   extensions
- * TCP (Transmission Control Protocol) with congestion control, RTT
-   estimation and fast recovery/fast retransmit
- * Specialized API for enhanced performance
- * Optional Berkeley socket API
-
-LICENSE
-
-lwIP is freely available under a BSD license.
-
-DEVELOPMENT
-
-lwIP has grown into an excellent TCP/IP stack for embedded devices,
-and developers using the stack often submit bug fixes, improvements,
-and additions to the stack to further increase its usefulness.
-
-Development of lwIP is hosted on Savannah, a central point for
-software development, maintenance and distribution. Everyone can
-help improve lwIP by use of Savannah's interface, CVS and the
-mailing list. A core team of developers will commit changes to the
-CVS source tree.
-
-The lwIP TCP/IP stack is maintained in the 'lwip' CVS module and
-contributions (such as platform ports) are in the 'contrib' module.
-
-See doc/savannah.txt for details on CVS server access for users and
-developers.
-
-Last night's CVS tar ball can be downloaded from:
-  http://savannah.gnu.org/cvs.backups/lwip.tar.gz [CHANGED - NEEDS FIXING]
-
-The current CVS trees are web-browsable:
-  http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/lwip/
-  http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/contrib/
-
-Submit patches and bugs via the lwIP project page:
-  http://savannah.nongnu.org/projects/lwip/
-
-
-DOCUMENTATION
-
-The original out-dated homepage of lwIP and Adam Dunkels' papers on
-lwIP are at the official lwIP home page:
-  http://www.sics.se/~adam/lwip/
-
-Self documentation of the source code is regularly extracted from the
-current CVS sources and is available from this web page:
-  http://www.nongnu.org/lwip/
-
-Reading Adam's papers, the files in docs/, browsing the source code
-documentation and browsing the mailing list archives is a good way to
-become familiar with the design of lwIP.
-
-Adam Dunkels <adam at sics.se>
-Leon Woestenberg <leon.woestenberg at gmx.net>		    
diff --git a/src/VBox/Devices/Network/lwip/README.vbox b/src/VBox/Devices/Network/lwip/README.vbox
deleted file mode 100644
index 39d6a2a..0000000
--- a/src/VBox/Devices/Network/lwip/README.vbox
+++ /dev/null
@@ -1 +0,0 @@
-This is based on lwIP 1.2.0.
diff --git a/src/VBox/Devices/Network/lwip/doc/FILES b/src/VBox/Devices/Network/lwip/doc/FILES
deleted file mode 100644
index 49806d7..0000000
--- a/src/VBox/Devices/Network/lwip/doc/FILES
+++ /dev/null
@@ -1,5 +0,0 @@
-savannah.txt   - How to obtain the current development source code.
-contrib.txt    - How to contribute to lwIP as a developer.
-rawapi.txt     - The documentation for the core API of lwIP.
-snmp_agent.txt - The documentation for the lwIP SNMP agent.
-sys_arch.txt   - The documentation for a system abstraction layer of lwIP.
diff --git a/src/VBox/Devices/Network/lwip/doc/contrib.txt b/src/VBox/Devices/Network/lwip/doc/contrib.txt
deleted file mode 100644
index 7c99b9b..0000000
--- a/src/VBox/Devices/Network/lwip/doc/contrib.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-1 Introduction
-
-This document describes some guidelines for people participating
-in lwIP development.
-
-2 How to contribute to lwIP
-
-Here is a short list of suggestions to anybody working with lwIP and 
-trying to contribute bug reports, fixes, enhancements, platform ports etc.
-First of all as you may already know lwIP is a volunteer project so feedback
-to fixes or questions might often come late. Hopefully the bug and patch tracking 
-features of Savannah help us not lose users' input.
-
-2.1 Source code style:
-
-1. do not use tabs.
-2. indentation is two spaces per level (i.e. per tab).
-3. end debug messages with a trailing newline (\n).
-4. one space between keyword and opening bracket.
-5. no space between function and opening bracket.
-6. one space and no newline before opening curly braces of a block.
-7. closing curly brace on a single line.
-8. spaces surrounding assignment and comparisons.
-9. use current source code style as further reference.
-
-2.2 Source code documentation style:
-
-1. JavaDoc compliant and Doxygen compatible.
-2. Function documentation above functions in .c files, not .h files.
-   (This forces you to synchronize documentation and implementation.)
-3. Use current documentation style as further reference.
- 
-2.3 Bug reports and patches:
-
-1. Make sure you are reporting bugs or send patches against the latest
-   sources. (From the latest release and/or the current CVS sources.)
-2. If you think you found a bug make sure it's not already filed in the
-   bugtracker at Savannah.
-3. If you have a fix put the patch on Savannah. If it is a patch that affects
-   both core and arch specific stuff please separate them so that the core can
-   be applied separately while leaving the other patch 'open'. The prefered way
-   is to NOT touch archs you can't test and let maintainers take care of them.
-   This is a good way to see if they are used at all - the same goes for unix
-   netifs except tapif.
-4. Do not file a bug and post a fix to it to the patch area. Either a bug report
-   or a patch will be enough.
-   If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area.
-5. Trivial patches (compiler warning, indentation and spelling fixes or anything obvious which takes a line or two)
-   can go to the lwip-users list. This is still the fastest way of interaction and the list is not so crowded
-   as to allow for loss of fixes. Putting bugs on Savannah and subsequently closing them is too much an overhead
-   for reporting a compiler warning fix.
-6. Patches should be specific to a single change or to related changes.Do not mix bugfixes with spelling and other
-   trivial fixes unless the bugfix is trivial too.Do not reorganize code and rename identifiers in the same patch you
-   change behaviour if not necessary.A patch is easier to read and understand if it's to the point and short than
-   if it's not to the point and long :) so the chances for it to be applied are greater. 
-
-2.4 Platform porters:
-
-1. If you have ported lwIP to a platform (an OS, a uC/processor or a combination of these) and
-   you think it could benefit others[1] you might want discuss this on the mailing list. You
-   can also ask for CVS access to submit and maintain your port in the contrib CVS module.
-   
\ No newline at end of file
diff --git a/src/VBox/Devices/Network/lwip/doc/rawapi.txt b/src/VBox/Devices/Network/lwip/doc/rawapi.txt
deleted file mode 100644
index 916a670..0000000
--- a/src/VBox/Devices/Network/lwip/doc/rawapi.txt
+++ /dev/null
@@ -1,419 +0,0 @@
-Raw TCP/IP interface for lwIP
-
-Authors: Adam Dunkels, Leon Woestenberg, Christiaan Simons
-
-lwIP provides two Application Program's Interfaces (APIs) for programs
-to use for communication with the TCP/IP code:
-* low-level "core" / "callback" or "raw" API.
-* higher-level "sequential" API.
-
-The sequential API provides a way for ordinary, sequential, programs
-to use the lwIP stack. It is quite similar to the BSD socket API. The
-model of execution is based on the blocking open-read-write-close
-paradigm. Since the TCP/IP stack is event based by nature, the TCP/IP
-code and the application program must reside in different execution
-contexts (threads).
-
-** The remainder of this document discusses the "raw" API. **
-
-The raw TCP/IP interface allows the application program to integrate
-better with the TCP/IP code. Program execution is event based by
-having callback functions being called from within the TCP/IP
-code. The TCP/IP code and the application program both run in the same
-thread. The sequential API has a much higher overhead and is not very
-well suited for small systems since it forces a multithreaded paradigm
-on the application.
-
-The raw TCP/IP interface is not only faster in terms of code execution
-time but is also less memory intensive. The drawback is that program
-development is somewhat harder and application programs written for
-the raw TCP/IP interface are more difficult to understand. Still, this
-is the preferred way of writing applications that should be small in
-code size and memory usage.
-
-Both APIs can be used simultaneously by different application
-programs. In fact, the sequential API is implemented as an application
-program using the raw TCP/IP interface.
-
---- Callbacks
-
-Program execution is driven by callbacks. Each callback is an ordinary
-C function that is called from within the TCP/IP code. Every callback
-function is passed the current TCP or UDP connection state as an
-argument. Also, in order to be able to keep program specific state,
-the callback functions are called with a program specified argument
-that is independent of the TCP/IP state.
-
-The function for setting the application connection state is:
-
-- void tcp_arg(struct tcp_pcb *pcb, void *arg)
-
-  Specifies the program specific state that should be passed to all
-  other callback functions. The "pcb" argument is the current TCP
-  connection control block, and the "arg" argument is the argument
-  that will be passed to the callbacks.
-
-  
---- TCP connection setup
-
-The functions used for setting up connections is similar to that of
-the sequential API and of the BSD socket API. A new TCP connection
-identifier (i.e., a protocol control block - PCB) is created with the
-tcp_new() function. This PCB can then be either set to listen for new
-incoming connections or be explicitly connected to another host.
-
-- struct tcp_pcb *tcp_new(void)
-
-  Creates a new connection identifier (PCB). If memory is not
-  available for creating the new pcb, NULL is returned.
-
-- err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr,
-                 u16_t port)
-
-  Binds the pcb to a local IP address and port number. The IP address
-  can be specified as IP_ADDR_ANY in order to bind the connection to
-  all local IP addresses.
-
-  If another connection is bound to the same port, the function will
-  return ERR_USE, otherwise ERR_OK is returned.
-
-- struct tcp_pcb *tcp_listen(struct tcp_pcb *pcb)
-
-  Commands a pcb to start listening for incoming connections. When an
-  incoming connection is accepted, the function specified with the
-  tcp_accept() function will be called. The pcb will have to be bound
-  to a local port with the tcp_bind() function.
-
-  The tcp_listen() function returns a new connection identifier, and
-  the one passed as an argument to the function will be
-  deallocated. The reason for this behavior is that less memory is
-  needed for a connection that is listening, so tcp_listen() will
-  reclaim the memory needed for the original connection and allocate a
-  new smaller memory block for the listening connection.
-
-  tcp_listen() may return NULL if no memory was available for the
-  listening connection. If so, the memory associated with the pcb
-  passed as an argument to tcp_listen() will not be deallocated.
-
-- void tcp_accept(struct tcp_pcb *pcb,
-                  err_t (* accept)(void *arg, struct tcp_pcb *newpcb,
-                                   err_t err))
-
-  Specified the callback function that should be called when a new
-  connection arrives on a listening connection.
-      
-- err_t tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr,
-                    u16_t port, err_t (* connected)(void *arg,
-                                                    struct tcp_pcb *tpcb,
-                                                    err_t err));
-
-  Sets up the pcb to connect to the remote host and sends the
-  initial SYN segment which opens the connection. 
-
-  The tcp_connect() function returns immediately; it does not wait for
-  the connection to be properly setup. Instead, it will call the
-  function specified as the fourth argument (the "connected" argument)
-  when the connection is established. If the connection could not be
-  properly established, either because the other host refused the
-  connection or because the other host didn't answer, the "connected"
-  function will be called with an the "err" argument set accordingly.
-
-  The tcp_connect() function can return ERR_MEM if no memory is
-  available for enqueueing the SYN segment. If the SYN indeed was
-  enqueued successfully, the tcp_connect() function returns ERR_OK.
-
-  
---- Sending TCP data
-
-TCP data is sent by enqueueing the data with a call to
-tcp_write(). When the data is successfully transmitted to the remote
-host, the application will be notified with a call to a specified
-callback function.
-
-- err_t tcp_write(struct tcp_pcb *pcb, void *dataptr, u16_t len,
-                  u8_t copy)
-
-  Enqueues the data pointed to by the argument dataptr. The length of
-  the data is passed as the len parameter. The copy argument is either
-  0 or 1 and indicates whether the new memory should be allocated for
-  the data to be copied into. If the argument is 0, no new memory
-  should be allocated and the data should only be referenced by
-  pointer.
-
-  The tcp_write() function will fail and return ERR_MEM if the length
-  of the data exceeds the current send buffer size or if the length of
-  the queue of outgoing segment is larger than the upper limit defined
-  in lwipopts.h. The number of bytes available in the output queue can
-  be retrieved with the tcp_sndbuf() function.
-
-  The proper way to use this function is to call the function with at
-  most tcp_sndbuf() bytes of data. If the function returns ERR_MEM,
-  the application should wait until some of the currently enqueued
-  data has been successfully received by the other host and try again.
-
-- void tcp_sent(struct tcp_pcb *pcb,
-                err_t (* sent)(void *arg, struct tcp_pcb *tpcb,
-		               u16_t len))
-
-  Specifies the callback function that should be called when data has
-  successfully been received (i.e., acknowledged) by the remote
-  host. The len argument passed to the callback function gives the
-  amount bytes that was acknowledged by the last acknowledgment.
-
-  
---- Receiving TCP data
-
-TCP data reception is callback based - an application specified
-callback function is called when new data arrives. When the
-application has taken the data, it has to call the tcp_recved()
-function to indicate that TCP can advertise increase the receive
-window.
-
-- void tcp_recv(struct tcp_pcb *pcb,
-                err_t (* recv)(void *arg, struct tcp_pcb *tpcb,
-                               struct pbuf *p, err_t err))
-
-  Sets the callback function that will be called when new data
-  arrives. The callback function will be passed a NULL pbuf to
-  indicate that the remote host has closed the connection.
-
-- void tcp_recved(struct tcp_pcb *pcb, u16_t len)
-
-  Must be called when the application has received the data. The len
-  argument indicates the length of the received data.
-    
-
---- Application polling
-
-When a connection is idle (i.e., no data is either transmitted or
-received), lwIP will repeatedly poll the application by calling a
-specified callback function. This can be used either as a watchdog
-timer for killing connections that have stayed idle for too long, or
-as a method of waiting for memory to become available. For instance,
-if a call to tcp_write() has failed because memory wasn't available,
-the application may use the polling functionality to call tcp_write()
-again when the connection has been idle for a while.
-
-- void tcp_poll(struct tcp_pcb *pcb, u8_t interval,
-                err_t (* poll)(void *arg, struct tcp_pcb *tpcb))
-
-  Specifies the polling interval and the callback function that should
-  be called to poll the application. The interval is specified in
-  number of TCP coarse grained timer shots, which typically occurs
-  twice a second. An interval of 10 means that the application would
-  be polled every 5 seconds.
-
-
---- Closing and aborting connections
-
-- err_t tcp_close(struct tcp_pcb *pcb)
-
-  Closes the connection. The function may return ERR_MEM if no memory
-  was available for closing the connection. If so, the application
-  should wait and try again either by using the acknowledgment
-  callback or the polling functionality. If the close succeeds, the
-  function returns ERR_OK.
-
-  The pcb is deallocated by the TCP code after a call to tcp_close(). 
-
-- void tcp_abort(struct tcp_pcb *pcb)
-
-  Aborts the connection by sending a RST (reset) segment to the remote
-  host. The pcb is deallocated. This function never fails.
-
-If a connection is aborted because of an error, the application is
-alerted of this event by the err callback. Errors that might abort a
-connection are when there is a shortage of memory. The callback
-function to be called is set using the tcp_err() function.
-
-- void tcp_err(struct tcp_pcb *pcb, void (* err)(void *arg,
-	       err_t err))
-
-  The error callback function does not get the pcb passed to it as a
-  parameter since the pcb may already have been deallocated.
-
-
---- Lower layer TCP interface
-
-TCP provides a simple interface to the lower layers of the
-system. During system initialization, the function tcp_init() has
-to be called before any other TCP function is called. When the system
-is running, the two timer functions tcp_fasttmr() and tcp_slowtmr()
-must be called with regular intervals. The tcp_fasttmr() should be
-called every TCP_FAST_INTERVAL milliseconds (defined in tcp.h) and
-tcp_slowtmr() should be called every TCP_SLOW_INTERVAL milliseconds. 
-
-
---- UDP interface
-
-The UDP interface is similar to that of TCP, but due to the lower
-level of complexity of UDP, the interface is significantly simpler.
-
-- struct udp_pcb *udp_new(void)
-
-  Creates a new UDP pcb which can be used for UDP communication. The
-  pcb is not active until it has either been bound to a local address
-  or connected to a remote address.
-
-- void udp_remove(struct udp_pcb *pcb)
-
-  Removes and deallocates the pcb.  
-  
-- err_t udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr,
-                 u16_t port)
-
-  Binds the pcb to a local address. The IP-address argument "ipaddr"
-  can be IP_ADDR_ANY to indicate that it should listen to any local IP
-  address. The function currently always return ERR_OK.
-
-- err_t udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr,
-                    u16_t port)
-
-  Sets the remote end of the pcb. This function does not generate any
-  network traffic, but only set the remote address of the pcb.
-
-- err_t udp_disconnect(struct udp_pcb *pcb)
-
-  Remove the remote end of the pcb. This function does not generate
-  any network traffic, but only removes the remote address of the pcb.
-
-- err_t udp_send(struct udp_pcb *pcb, struct pbuf *p)
-
-  Sends the pbuf p. The pbuf is not deallocated.
-
-- void udp_recv(struct udp_pcb *pcb,
-                void (* recv)(void *arg, struct udp_pcb *upcb,
-                                         struct pbuf *p,
-                                         struct ip_addr *addr,
-                                         u16_t port),
-                              void *recv_arg)
-
-  Specifies a callback function that should be called when a UDP
-  datagram is received.
-  
-
---- System initalization
-
-A truly complete and generic sequence for initializing the lwip stack
-cannot be given because it depends on the build configuration (lwipopts.h)
-and additional initializations for your runtime environment (e.g. timers).
-
-We can give you some idea on how to proceed when using the raw API.
-We assume a configuration using a single Ethernet netif and the
-UDP and TCP transport layers, IPv4 and the DHCP client.
-
-Call these functions in the order of appearance:
-
-- stats_init()
-
-  Clears the structure where runtime statistics are gathered.
-
-- sys_init()
-  
-  Not of much use since we set the NO_SYS 1 option in lwipopts.h,
-  to be called for easy configuration changes.
-
-- mem_init()
-
-  Initializes the dynamic memory heap defined by MEM_SIZE.
-
-- memp_init()
-
-  Initializes the memory pools defined by MEMP_NUM_x.
-
-- pbuf_init()
-
-  Initializes the pbuf memory pool defined by PBUF_POOL_SIZE.
-  
-- etharp_init()
-
-  Initializes the ARP table and queue.
-  Note: you must call etharp_tmr at a 10 second regular interval
-  after this initialization.
-
-- ip_init()
-
-  Doesn't do much, it should be called to handle future changes.
-
-- udp_init()
-
-  Clears the UDP PCB list.
-
-- tcp_init()
-
-  Clears the TCP PCB list and clears some internal TCP timers.
-  Note: you must call tcp_fasttmr() and tcp_slowtmr() at the
-  predefined regular intervals after this initialization. 
-  
-- netif_add(struct netif *netif, struct ip_addr *ipaddr,
-            struct ip_addr *netmask, struct ip_addr *gw,
-            void *state, err_t (* init)(struct netif *netif),
-            err_t (* input)(struct pbuf *p, struct netif *netif))
-
-  Adds your network interface to the netif_list. Allocate a struct
-  netif and pass a pointer to this structure as the first argument.
-  Give pointers to cleared ip_addr structures when using DHCP,
-  or fill them with sane numbers otherwise. The state pointer may be NULL.
-
-  The init function pointer must point to a initialization function for
-  your ethernet netif interface. The following code illustrates it's use.
-  
-  err_t netif_if_init(struct netif *netif)
-  {
-    u8_t i;
-    
-    for(i = 0; i < 6; i++) netif->hwaddr[i] = some_eth_addr[i];
-    init_my_eth_device();
-    return ERR_OK;
-  }
-  
-  The input function pointer must point to the lwip ip_input().
-  
-- netif_set_default(struct netif *netif)
-
-  Registers the default network interface.
-
-- netif_set_up(struct netif *netif)
-
-  When the netif is fully configured this function must be called.
-
-- dhcp_start(struct netif *netif)
-
-  Creates a new DHCP client for this interface on the first call.
-  Note: you must call dhcp_fine_tmr() and dhcp_coarse_tmr() at
-  the predefined regular intervals after starting the client.
-  
-  You can peek in the netif->dhcp struct for the actual DHCP status.
-
-
---- Optimalization hints
-
-The first thing you want to optimize is the lwip_standard_checksum()
-routine from src/core/inet.c. You can override this standard
-function with the #define LWIP_CHKSUM <your_checksum_routine>.
-
-There are C examples given in inet.c or you might want to
-craft an assembly function for this. RFC1071 is a good
-introduction to this subject.
-
-Other significant improvements can be made by supplying
-assembly or inline replacements for htons() and htonl()
-if you're using a little-endian architecture.
-#define LWIP_PLATFORM_BYTESWAP 1
-#define LWIP_PLATFORM_HTONS(x) <your_htons>
-#define LWIP_PLATFORM_HTONL(x) <your_htonl>
-
-Check your network interface driver if it reads at
-a higher speed than the maximum wire-speed. If the
-hardware isn't serviced frequently and fast enough
-buffer overflows are likely to occur.
-
-E.g. when using the cs8900 driver, call cs8900if_service(ethif)
-as frequently as possible. When using an RTOS let the cs8900 interrupt
-wake a high priority task that services your driver using a binary
-semaphore or event flag. Some drivers might allow additional tuning
-to match your application and network.
-
-For a production release it is recommended to set LWIP_STATS to 0.
-Note that speed performance isn't influenced much by simply setting
-high values to the memory options.
\ No newline at end of file
diff --git a/src/VBox/Devices/Network/lwip/doc/savannah.txt b/src/VBox/Devices/Network/lwip/doc/savannah.txt
deleted file mode 100644
index 409905b..0000000
--- a/src/VBox/Devices/Network/lwip/doc/savannah.txt
+++ /dev/null
@@ -1,135 +0,0 @@
-Daily Use Guide for using Savannah for lwIP
-
-Table of Contents:
-
-1 - Obtaining lwIP from the CVS repository
-2 - Committers/developers CVS access using SSH (to be written)
-3 - Merging from DEVEL branch to main trunk (stable branch)
-4 - How to release lwIP
-
-
-
-1 Obtaining lwIP from the CVS repository
-----------------------------------------
-
-To perform an anonymous CVS checkout of the main trunk (this is where
-bug fixes and incremental enhancements occur), do this:
-
-cvs -z3 -d:pserver:anonymous at cvs.sv.gnu.org:/sources/lwip checkout lwip
- 
-Or, obtain a stable branch (updated with bug fixes only) as follows:
-cvs -z3 -d:pserver:anonymous at cvs.sv.gnu.org:/sources/lwip checkout \
-  -r STABLE-0_7 -d lwip-0.7 lwip
-
-Or, obtain a specific (fixed) release as follows:
-cvs -z3 -d:pserver:anonymous at cvs.sv.gnu.org:/sources/lwip checkout \
-  -r STABLE-0_7_0 -d lwip-0.7.0 lwip
-
-3 Committers/developers CVS access using SSH
---------------------------------------------
-
-The Savannah server uses SSH (Secure Shell) protocol 2 authentication and encryption.
-As such, CVS commits to the server occur through a SSH tunnel for project members.
-To create a SSH2 key pair in UNIX-like environments, do this:
-
-ssh-keygen -t dsa
-
-Under Windows, a recommended SSH client is "PuTTY", freely available with good
-documentation and a graphic user interface. Use its key generator.
-
-Now paste the id_dsa.pub contents into your Savannah account public key list. Wait
-a while so that Savannah can update its configuration (This can take minutes).
-
-Try to login using SSH:
-
-ssh -v your_login at cvs.sv.gnu.org
-
-If it tells you:
-
-Authenticating with public key "your_key_name"...
-Server refused to allocate pty
-
-then you could login; Savannah refuses to give you a shell - which is OK, as we
-are allowed to use SSH for CVS only. Now, you should be able to do this:
-
-export CVS_RSH=ssh
-cvs -z3 -d:ext:your_login at cvs.sv.gnu.org:/sources/lwip co lwip
- 
-after which you can edit your local files with bug fixes or new features and
-commit them. Make sure you know what you are doing when using CVS to make
-changes on the repository. If in doubt, ask on the lwip-members mailing list.
-
-(If SSH asks about authenticity of the host, you can check the key
- fingerprint against http://savannah.nongnu.org/cvs/?group=lwip)
-
-
-3 Merging from DEVEL branch to main trunk (stable)
---------------------------------------------------
-
-Merging is a delicate process in CVS and requires the
-following disciplined steps in order to prevent conflicts
-in the future. Conflicts can be hard to solve!
-
-Merging from branch A to branch B requires that the A branch
-has a tag indicating the previous merger. This tag is called
-'merged_from_A_to_B'. After merging, the tag is moved in the
-A branch to remember this merger for future merge actions.
-
-IMPORTANT: AFTER COMMITTING A SUCCESFUL MERGE IN THE
-REPOSITORY, THE TAG MUST BE SET ON THE SOURCE BRANCH OF THE
-MERGE ACTION (REPLACING EXISTING TAGS WITH THE SAME NAME).
-
-Merge all changes in DEVEL since our last merge to main:
-
-In the working copy of the main trunk:
-cvs update -P -jmerged_from_DEVEL_to_main -jDEVEL 
-
-(This will apply the changes between 'merged_from_DEVEL_to_main'
-and 'DEVEL' to your work set of files)
-
-We can now commit the merge result.
-cvs commit -R -m "Merged from DEVEL to main." 
-
-If this worked out OK, we now move the tag in the DEVEL branch
-to this merge point, so we can use this point for future merges:
-
-cvs rtag -F -r DEVEL merged_from_DEVEL_to_main lwip 
-
-4 How to release lwIP
----------------------
-
-First, checkout a clean copy of the branch to be released. Tag this set with
-tag name "STABLE-0_6_3". (I use release number 0.6.3 throughout this example).
-
-Login CVS using pserver authentication, then export a clean copy of the
-tagged tree. Export is similar to a checkout, except that the CVS metadata
-is not created locally. 
-
-export CVS_RSH=ssh
-cvs -z3 -d:pserver:anonymous at cvs.sv.gnu.org:/sources/lwip checkout \
-  -r STABLE-0_6_3 -d lwip-0.6.3 lwip
-
-Archive this directory using tar, gzip'd, bzip2'd and zip'd.
-
-tar czvf lwip-0.6.3.tar.gz lwip-0.6.3
-tar cjvf lwip-0.6.3.tar.bz2 lwip-0.6.3
-zip -r lwip-0.6.3.zip lwip-0.6.3
-
-Now, sign the archives with a detached GPG binary signature as follows:
-
-gpg -b lwip-0.6.3.tar.gz
-gpg -b lwip-0.6.3.tar.bz2
-gpg -b lwip-0.6.3.zip
-
-Upload these files using anonymous FTP:
-ncftp ftp://savannah.gnu.org/incoming/savannah/lwip
-
-ncftp>mput *0.6.3.*
-
-Additionally, you may post a news item on Savannah, like this:
-
-A new 0.6.3 release is now available here:
-http://savannah.nongnu.org/files/?group=lwip&highlight=0.6.3
-
-You will have to submit this via the user News interface, then approve
-this via the Administrator News interface.
\ No newline at end of file
diff --git a/src/VBox/Devices/Network/lwip/doc/snmp_agent.txt b/src/VBox/Devices/Network/lwip/doc/snmp_agent.txt
deleted file mode 100644
index 8b08f11..0000000
--- a/src/VBox/Devices/Network/lwip/doc/snmp_agent.txt
+++ /dev/null
@@ -1,172 +0,0 @@
-SNMPv1 agent for lwIP
-
-Author: Christiaan Simons
-
-This is a brief introduction how to use and configure the SNMP agent.
-Note the agent uses the raw-API UDP interface so you may also want to
-read rawapi.txt to gain a better understanding of the SNMP message handling.
-
-0 Agent Capabilities
-====================
-
-SNMPv1 per RFC1157
-  This is an old(er) standard but is still widely supported.
-  For SNMPv2c and v3 have a greater complexity and need many
-  more lines of code. IMHO this breaks the idea of "lightweight IP".
-
-  Note the S in SNMP stands for "Simple". Note that "Simple" is
-  relative. SNMP is simple compared to the complex ISO network
-  management protocols CMIP (Common Management Information Protocol)
-  and CMOT (CMip Over Tcp).
-
-MIB II per RFC1213
-  The standard lwIP stack management information base.
-  This is a required MIB, so this is always enabled.
-  When builing lwIP without TCP, the mib-2.tcp group is omitted.
-  The groups EGP, CMOT and transmission are disabled by default.
-  
-  Most mib-2 objects are not writable except:
-  sysName, sysLocation, sysContact, snmpEnableAuthenTraps.
-  Writing to or changing the ARP and IP address and route
-  tables is not possible.
- 
-  Note lwIP has a very limited notion of IP routing. It currently
-  doen't have a route table and doesn't have a notion of the U,G,H flags.
-  Instead lwIP uses the interface list with only one default interface
-  acting as a single gateway interface (G) for the default route.
-
-  The agent returns a "virtual table" with the default route 0.0.0.0
-  for the default interface and network routes (no H) for each
-  network interface in the netif_list.
-  All routes are considered to be up (U).
-
-Loading additional MIBs
-  MIBs can only be added in compile-time, not in run-time.
-  There is no MIB compiler thus additional MIBs must be hand coded.
-
-Large SNMP message support
-  The packet decoding and encoding routines are designed
-  to use pbuf-chains. Larger payloads then the minimum
-  SNMP requirement of 484 octets are supported if the 
-  PBUF_POOL_SIZE and IP_REASS_BUFSIZE are set to match your
-  local requirement.
-
-1 Building the Agent
-====================
-
-First of all you'll need to add the following define
-to your local lwipopts.h:
-
-#define LWIP_SNMP               1
-
-and add the source files in lwip/src/core/snmp
-and some snmp headers in lwip/src/include/lwip to your makefile.
-
-Note you'll might need to adapt you network driver to update
-the mib2 variables for your interface.
-
-2 Running the Agent
-===================
-
-The following function calls must be made in your program to
-actually get the SNMP agent running.
-
-Before starting the agent you should supply pointers
-to non-volatile memory for sysContact, sysLocation,
-and snmpEnableAuthenTraps. You can do this by calling
-
-snmp_set_syscontact()
-snmp_set_syslocation()
-snmp_set_snmpenableauthentraps()
-
-Additionally you may want to set
-
-snmp_set_sysdescr()
-snmp_set_sysobjid() (if you have a private MIB)
-snmp_set_sysname()
-
-Also before starting the agent you need to setup
-one or more trap destinations using these calls:
-
-snmp_trap_dst_enable();
-snmp_trap_dst_ip_set();
-
-In the lwIP initialisation sequence call snmp_init() just after
-the call to udp_init().
-
-Exactly every 10 msec the SNMP uptime timestamp must be updated with
-snmp_inc_sysuptime(). You should call this from a timer interrupt
-or a timer signal handler depending on your runtime environment.
-
-
-3 Private MIBs
-==============
-
-If want to extend the agent with your own private MIB you'll need to
-add the following define to your local lwipopts.h:
-
-#define SNMP_PRIVATE_MIB        1
-
-You must provide the private_mib.h and associated files yourself.
-Note we don't have a "MIB compiler" that generates C source from a MIB,
-so you're required to do some serious coding if you enable this!
-
-Note the lwIP enterprise ID (26381) is assigned to the lwIP project,
-ALL OBJECT IDENTIFIERS LIVING UNDER THIS ID ARE ASSIGNED BY THE lwIP
-MAINTAINERS!
-
-If you need to create your own private MIB you'll need
-to apply for your own enterprise ID with IANA: http://www.iana.org/numbers.html 
-
-You can set it by passing a struct snmp_obj_id to the agent
-using snmp_set_sysobjid(&my_object_id), just before snmp_init().
-
-Note the object identifiers for thes MIB-2 and your private MIB
-tree must be kept in sorted ascending (lexicographical) order.
-This to ensure correct getnext operation.
-
-An example for a private MIB is part of the "minimal Unix" project:
-contrib/ports/unix/proj/minimal/lwip_prvmib.c
-
-The next chapter gives a more detailed description of the
-MIB-2 tree and the optional private MIB.
-
-4 The Gory Details
-==================
-
-4.0 Object identifiers and the MIB tree.
-
-We have three distinct parts for all object identifiers:
-
-The prefix
-  .iso.org.dod.internet
-
-the middle part 
-  .mgmt.mib-2.ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress
-
-and the index part
-  .1.192.168.0.1
-
-Objects located above the .internet hierarchy aren't supported.
-Currently only the .mgmt sub-tree is available and
-when the SNMP_PRIVATE_MIB is enabled the .private tree
-becomes available too.
-
-Object identifiers from incoming requests are checked
-for a matching prefix, middle part and index part
-or are expanded(*) for GetNext requests with short
-or inexisting names in the request.
-(* we call this "expansion" but this also
-resembles the "auto-completion" operation)
-
-The middle part is usually located in ROM (const)
-to preserve precious RAM on small microcontrollers.
-However RAM location is possible for an dynamically
-changing private tree.
-
-The index part is handled by functions which in
-turn use dynamically allocated index trees from RAM.
-These trees are updated by e.g. the etharp code
-when new entries are made or removed form the ARP cache.
-
-/** @todo more gory details */
diff --git a/src/VBox/Devices/Network/lwip/doc/sys_arch.txt b/src/VBox/Devices/Network/lwip/doc/sys_arch.txt
deleted file mode 100644
index b2c45e0..0000000
--- a/src/VBox/Devices/Network/lwip/doc/sys_arch.txt
+++ /dev/null
@@ -1,201 +0,0 @@
-sys_arch interface for lwIP 0.6++
-
-Author: Adam Dunkels
-
-The operating system emulation layer provides a common interface
-between the lwIP code and the underlying operating system kernel. The
-general idea is that porting lwIP to new architectures requires only
-small changes to a few header files and a new sys_arch
-implementation. It is also possible to do a sys_arch implementation
-that does not rely on any underlying operating system.
-
-The sys_arch provides semaphores and mailboxes to lwIP. For the full
-lwIP functionality, multiple threads support can be implemented in the
-sys_arch, but this is not required for the basic lwIP
-functionality. Previous versions of lwIP required the sys_arch to
-implement timer scheduling as well but as of lwIP 0.5 this is
-implemented in a higher layer.
-
-In addition to the source file providing the functionality of sys_arch,
-the OS emulation layer must provide several header files defining
-macros used throughout lwip.  The files required and the macros they
-must define are listed below the sys_arch description.
-
-Semaphores can be either counting or binary - lwIP works with both
-kinds. Mailboxes are used for message passing and can be implemented
-either as a queue which allows multiple messages to be posted to a
-mailbox, or as a rendez-vous point where only one message can be
-posted at a time. lwIP works with both kinds, but the former type will
-be more efficient. A message in a mailbox is just a pointer, nothing
-more. 
-
-Semaphores are represented by the type "sys_sem_t" which is typedef'd
-in the sys_arch.h file. Mailboxes are equivalently represented by the
-type "sys_mbox_t". lwIP does not place any restrictions on how
-sys_sem_t or sys_mbox_t are represented internally.
-
-The following functions must be implemented by the sys_arch:
-
-- void sys_init(void)
-
-  Is called to initialize the sys_arch layer.
-
-- sys_sem_t sys_sem_new(u8_t count)
-
-  Creates and returns a new semaphore. The "count" argument specifies
-  the initial state of the semaphore.
-
-- void sys_sem_free(sys_sem_t sem)
-
-  Deallocates a semaphore.
-
-- void sys_sem_signal(sys_sem_t sem)
-
-  Signals a semaphore.
-
-- u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout)
-
-  Blocks the thread while waiting for the semaphore to be
-  signaled. If the "timeout" argument is non-zero, the thread should
-  only be blocked for the specified time (measured in
-  milliseconds).
-
-  If the timeout argument is non-zero, the return value is the number of
-  milliseconds spent waiting for the semaphore to be signaled. If the
-  semaphore wasn't signaled within the specified time, the return value is
-  SYS_ARCH_TIMEOUT. If the thread didn't have to wait for the semaphore
-  (i.e., it was already signaled), the function may return zero.
-
-  Notice that lwIP implements a function with a similar name,
-  sys_sem_wait(), that uses the sys_arch_sem_wait() function.
-
-- sys_mbox_t sys_mbox_new(void)
-
-  Creates an empty mailbox.
-
-- void sys_mbox_free(sys_mbox_t mbox)
-
-  Deallocates a mailbox. If there are messages still present in the
-  mailbox when the mailbox is deallocated, it is an indication of a
-  programming error in lwIP and the developer should be notified.
-
-- void sys_mbox_post(sys_mbox_t mbox, void *msg)
-
-  Posts the "msg" to the mailbox.
-
-- u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout)
-
-  Blocks the thread until a message arrives in the mailbox, but does
-  not block the thread longer than "timeout" milliseconds (similar to
-  the sys_arch_sem_wait() function). The "msg" argument is a result
-  parameter that is set by the function (i.e., by doing "*msg =
-  ptr"). The "msg" parameter maybe NULL to indicate that the message
-  should be dropped.
-
-  The return values are the same as for the sys_arch_sem_wait() function:
-  Number of milliseconds spent waiting or SYS_ARCH_TIMEOUT if there was a
-  timeout.
-
-  Note that a function with a similar name, sys_mbox_fetch(), is
-  implemented by lwIP. 
-  
-- struct sys_timeouts *sys_arch_timeouts(void)
-
-  Returns a pointer to the per-thread sys_timeouts structure. In lwIP,
-  each thread has a list of timeouts which is repressented as a linked
-  list of sys_timeout structures. The sys_timeouts structure holds a
-  pointer to a linked list of timeouts. This function is called by
-  the lwIP timeout scheduler and must not return a NULL value. 
-
-  In a single threadd sys_arch implementation, this function will
-  simply return a pointer to a global sys_timeouts variable stored in
-  the sys_arch module.
-  
-If threads are supported by the underlying operating system and if
-such functionality is needed in lwIP, the following function will have
-to be implemented as well:
-
-- sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio)
-
-  Starts a new thread with priority "prio" that will begin its execution in the
-  function "thread()". The "arg" argument will be passed as an argument to the
-  thread() function. The id of the new thread is returned. Both the id and
-  the priority are system dependent.
-
-- sys_prot_t sys_arch_protect(void)
-
-  This optional function does a "fast" critical region protection and returns
-  the previous protection level. This function is only called during very short
-  critical regions. An embedded system which supports ISR-based drivers might
-  want to implement this function by disabling interrupts. Task-based systems
-  might want to implement this by using a mutex or disabling tasking. This
-  function should support recursive calls from the same task or interrupt. In
-  other words, sys_arch_protect() could be called while already protected. In
-  that case the return value indicates that it is already protected.
-
-  sys_arch_protect() is only required if your port is supporting an operating
-  system.
-
-- void sys_arch_unprotect(sys_prot_t pval)
-
-  This optional function does a "fast" set of critical region protection to the
-  value specified by pval. See the documentation for sys_arch_protect() for
-  more information. This function is only required if your port is supporting
-  an operating system.
-
-Note:
-
-Be carefull with using mem_malloc() in sys_arch. When malloc() refers to
-mem_malloc() you can run into a circular function call problem. In mem.c
-mem_init() tries to allcate a semaphore using mem_malloc, which of course
-can't be performed when sys_arch uses mem_malloc.
-
--------------------------------------------------------------------------------
-Additional files required for the "OS support" emulation layer:
--------------------------------------------------------------------------------
-
-cc.h       - Architecture environment, some compiler specific, some
-             environment specific (probably should move env stuff 
-             to sys_arch.h.)
-
-  Typedefs for the types used by lwip -
-    u8_t, s8_t, u16_t, s16_t, u32_t, s32_t, mem_ptr_t
-
-  Compiler hints for packing lwip's structures -
-    PACK_STRUCT_FIELD(x)
-    PACK_STRUCT_STRUCT
-    PACK_STRUCT_BEGIN
-    PACK_STRUCT_END
-
-  Platform specific diagnostic output -
-    LWIP_PLATFORM_DIAG(x)    - non-fatal, print a message.
-    LWIP_PLATFORM_ASSERT(x)  - fatal, print message and abandon execution.
-
-  "lightweight" synchronization mechanisms -
-    SYS_ARCH_DECL_PROTECT(x) - declare a protection state variable.
-    SYS_ARCH_PROTECT(x)      - enter protection mode.
-    SYS_ARCH_UNPROTECT(x)    - leave protection mode.
-
-  If the compiler does not provide memset() this file must include a
-  definition of it, or include a file which defines it.
-
-  This file must either include a system-local <errno.h> which defines
-  the standard *nix error codes, or it should #define LWIP_PROVIDE_ERRNO
-  to make lwip/arch.h define the codes which are used throughout.
-
-
-perf.h     - Architecture specific performance measurement.
-  Measurement calls made throughout lwip, these can be defined to nothing.
-    PERF_START               - start measuring something.
-    PERF_STOP(x)             - stop measuring something, and record the result.
-
-sys_arch.h - Tied to sys_arch.c
-
-  Arch dependent types for the following objects:
-    sys_sem_t, sys_mbox_t, sys_thread_t,
-  And, optionally:
-    sys_prot_t
-
-  Defines to set vars of sys_mbox_t and sys_sem_t to NULL.
-    SYS_MBOX_NULL NULL
-    SYS_SEM_NULL NULL
diff --git a/src/VBox/Devices/Network/lwip/src/FILES b/src/VBox/Devices/Network/lwip/src/FILES
deleted file mode 100644
index 2b65731..0000000
--- a/src/VBox/Devices/Network/lwip/src/FILES
+++ /dev/null
@@ -1,13 +0,0 @@
-api/      - The code for the high-level wrapper API. Not needed if
-            you use the lowel-level call-back/raw API.
-
-core/     - The core of the TPC/IP stack; protocol implementations,
-            memory and buffer management, and the low-level raw API.
-	    
-include/  - lwIP include files.
-
-netif/    - Generic network interface device drivers are kept here,
-            as well as the ARP module.
-
-For more information on the various subdirectories, check the FILES
-file in each directory.
diff --git a/src/VBox/Devices/Network/lwip/src/api/api_lib.c b/src/VBox/Devices/Network/lwip/src/api/api_lib.c
deleted file mode 100644
index 01683b0..0000000
--- a/src/VBox/Devices/Network/lwip/src/api/api_lib.c
+++ /dev/null
@@ -1,722 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-/* This is the part of the API that is linked with
-   the application */
-
-#include "lwip/opt.h"
-#include "lwip/api.h"
-#include "lwip/api_msg.h"
-#include "lwip/memp.h"
-
-
-struct
-netbuf *netbuf_new(void)
-{
-  struct netbuf *buf;
-
-  buf = memp_malloc(MEMP_NETBUF);
-  if (buf != NULL) {
-    buf->p = NULL;
-    buf->ptr = NULL;
-    return buf;
-  } else {
-    return NULL;
-  }
-}
-
-void
-netbuf_delete(struct netbuf *buf)
-{
-  if (buf != NULL) {
-    if (buf->p != NULL) {
-      pbuf_free(buf->p);
-      buf->p = buf->ptr = NULL;
-    }
-    memp_free(MEMP_NETBUF, buf);
-  }
-}
-
-void *
-netbuf_alloc(struct netbuf *buf, u16_t size)
-{
-  /* Deallocate any previously allocated memory. */
-  if (buf->p != NULL) {
-    pbuf_free(buf->p);
-  }
-  buf->p = pbuf_alloc(PBUF_TRANSPORT, size, PBUF_RAM);
-  if (buf->p == NULL) {
-     return NULL;
-  }
-  buf->ptr = buf->p;
-  return buf->p->payload;
-}
-
-void
-netbuf_free(struct netbuf *buf)
-{
-  if (buf->p != NULL) {
-    pbuf_free(buf->p);
-  }
-  buf->p = buf->ptr = NULL;
-}
-
-void
-netbuf_ref(struct netbuf *buf, void *dataptr, u16_t size)
-{
-  if (buf->p != NULL) {
-    pbuf_free(buf->p);
-  }
-  buf->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_REF);
-  buf->p->payload = dataptr;
-  buf->p->len = buf->p->tot_len = size;
-  buf->ptr = buf->p;
-}
-
-void
-netbuf_chain(struct netbuf *head, struct netbuf *tail)
-{
-  pbuf_chain(head->p, tail->p);
-  head->ptr = head->p;
-  memp_free(MEMP_NETBUF, tail);
-}
-
-u16_t
-netbuf_len(struct netbuf *buf)
-{
-  return buf->p->tot_len;
-}
-
-err_t
-netbuf_data(struct netbuf *buf, void **dataptr, u16_t *len)
-{
-  if (buf->ptr == NULL) {
-    return ERR_BUF;
-  }
-  *dataptr = buf->ptr->payload;
-  *len = buf->ptr->len;
-  return ERR_OK;
-}
-
-s8_t
-netbuf_next(struct netbuf *buf)
-{
-  if (buf->ptr->next == NULL) {
-    return -1;
-  }
-  buf->ptr = buf->ptr->next;
-  if (buf->ptr->next == NULL) {
-    return 1;
-  }
-  return 0;
-}
-
-void
-netbuf_first(struct netbuf *buf)
-{
-  buf->ptr = buf->p;
-}
-
-void
-netbuf_copy_partial(struct netbuf *buf, void *dataptr, u16_t len, u16_t offset)
-{
-  struct pbuf *p;
-  u16_t i, left;
-
-  left = 0;
-
-  if(buf == NULL || dataptr == NULL) {
-    return;
-  }
-  
-  /* This implementation is bad. It should use bcopy
-     instead. */
-  for(p = buf->p; left < len && p != NULL; p = p->next) {
-    if (offset != 0 && offset >= p->len) {
-      offset -= p->len;
-    } else {    
-      for(i = offset; i < p->len; ++i) {
-  ((u8_t *)dataptr)[left] = ((u8_t *)p->payload)[i];
-  if (++left >= len) {
-    return;
-  }
-      }
-      offset = 0;
-    }
-  }
-}
-
-void
-netbuf_copy(struct netbuf *buf, void *dataptr, u16_t len)
-{
-  netbuf_copy_partial(buf, dataptr, len, 0);
-}
-
-struct ip_addr *
-netbuf_fromaddr(struct netbuf *buf)
-{
-  return buf->fromaddr;
-}
-
-u16_t
-netbuf_fromport(struct netbuf *buf)
-{
-  return buf->fromport;
-}
-
-struct
-netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto,
-                                   void (*callback)(struct netconn *, enum netconn_evt, u16_t len))
-{
-  struct netconn *conn;
-  struct api_msg *msg;
-
-  conn = memp_malloc(MEMP_NETCONN);
-  if (conn == NULL) {
-    return NULL;
-  }
-  
-  conn->err = ERR_OK;
-  conn->type = t;
-  conn->pcb.tcp = NULL;
-
-  if ((conn->mbox = sys_mbox_new()) == SYS_MBOX_NULL) {
-    memp_free(MEMP_NETCONN, conn);
-    return NULL;
-  }
-  conn->recvmbox = SYS_MBOX_NULL;
-  conn->acceptmbox = SYS_MBOX_NULL;
-  conn->sem = sys_sem_new(0);
-  if (conn->sem == SYS_SEM_NULL) {
-    memp_free(MEMP_NETCONN, conn);
-    return NULL;
-  }
-  conn->state = NETCONN_NONE;
-  conn->socket = 0;
-  conn->callback = callback;
-  conn->recv_avail = 0;
-
-  if((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    memp_free(MEMP_NETCONN, conn);
-    return NULL;
-  }
-  
-  msg->type = API_MSG_NEWCONN;
-  msg->msg.msg.bc.port = proto; /* misusing the port field */
-  msg->msg.conn = conn;
-  api_msg_post(msg);  
-  sys_mbox_fetch(conn->mbox, NULL);
-  memp_free(MEMP_API_MSG, msg);
-
-  if ( conn->err != ERR_OK ) {
-    memp_free(MEMP_NETCONN, conn);
-    return NULL;
-  }
-
-  return conn;
-}
-
-
-struct
-netconn *netconn_new(enum netconn_type t)
-{
-  return netconn_new_with_proto_and_callback(t,0,NULL);
-}
-
-struct
-netconn *netconn_new_with_callback(enum netconn_type t,
-                                   void (*callback)(struct netconn *, enum netconn_evt, u16_t len))
-{
-  return netconn_new_with_proto_and_callback(t,0,callback);
-}
-
-
-err_t
-netconn_delete(struct netconn *conn)
-{
-  struct api_msg *msg;
-  void *mem;
-  
-  if (conn == NULL) {
-    return ERR_OK;
-  }
-  
-  if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    return ERR_MEM;
-  }
-  
-  msg->type = API_MSG_DELCONN;
-  msg->msg.conn = conn;
-  api_msg_post(msg);  
-  sys_mbox_fetch(conn->mbox, NULL);
-  memp_free(MEMP_API_MSG, msg);
-
-  /* Drain the recvmbox. */
-  if (conn->recvmbox != SYS_MBOX_NULL) {
-    while (sys_arch_mbox_fetch(conn->recvmbox, &mem, 1) != SYS_ARCH_TIMEOUT) {
-      if (conn->type == NETCONN_TCP) {
-        if(mem != NULL)
-          pbuf_free((struct pbuf *)mem);
-      } else {
-        netbuf_delete((struct netbuf *)mem);
-      }
-    }
-    sys_mbox_free(conn->recvmbox);
-    conn->recvmbox = SYS_MBOX_NULL;
-  }
- 
-
-  /* Drain the acceptmbox. */
-  if (conn->acceptmbox != SYS_MBOX_NULL) {
-    while (sys_arch_mbox_fetch(conn->acceptmbox, &mem, 1) != SYS_ARCH_TIMEOUT) {
-      netconn_delete((struct netconn *)mem);
-    }
-    
-    sys_mbox_free(conn->acceptmbox);
-    conn->acceptmbox = SYS_MBOX_NULL;
-  }
-
-  sys_mbox_free(conn->mbox);
-  conn->mbox = SYS_MBOX_NULL;
-  if (conn->sem != SYS_SEM_NULL) {
-    sys_sem_free(conn->sem);
-  }
-  /*  conn->sem = SYS_SEM_NULL;*/
-  memp_free(MEMP_NETCONN, conn);
-  return ERR_OK;
-}
-
-enum netconn_type
-netconn_type(struct netconn *conn)
-{
-  return conn->type;
-}
-
-err_t
-netconn_peer(struct netconn *conn, struct ip_addr *addr,
-       u16_t *port)
-{
-  switch (conn->type) {
-  case NETCONN_RAW:
-    /* return an error as connecting is only a helper for upper layers */
-    return ERR_CONN;
-  case NETCONN_UDPLITE:
-  case NETCONN_UDPNOCHKSUM:
-  case NETCONN_UDP:
-    if (conn->pcb.udp == NULL ||
-  ((conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0))
-     return ERR_CONN;
-    *addr = (conn->pcb.udp->remote_ip);
-    *port = conn->pcb.udp->remote_port;
-    break;
-  case NETCONN_TCP:
-    if (conn->pcb.tcp == NULL)
-      return ERR_CONN;
-    *addr = (conn->pcb.tcp->remote_ip);
-    *port = conn->pcb.tcp->remote_port;
-    break;
-  }
-  return (conn->err = ERR_OK);
-}
-
-err_t
-netconn_addr(struct netconn *conn, struct ip_addr **addr,
-       u16_t *port)
-{
-  switch (conn->type) {
-  case NETCONN_RAW:
-    *addr = &(conn->pcb.raw->local_ip);
-    *port = conn->pcb.raw->protocol;
-    break;
-  case NETCONN_UDPLITE:
-  case NETCONN_UDPNOCHKSUM:
-  case NETCONN_UDP:
-    *addr = &(conn->pcb.udp->local_ip);
-    *port = conn->pcb.udp->local_port;
-    break;
-  case NETCONN_TCP:
-    *addr = &(conn->pcb.tcp->local_ip);
-    *port = conn->pcb.tcp->local_port;
-    break;
-  }
-  return (conn->err = ERR_OK);
-}
-
-err_t
-netconn_bind(struct netconn *conn, struct ip_addr *addr,
-      u16_t port)
-{
-  struct api_msg *msg;
-
-  if (conn == NULL) {
-    return ERR_VAL;
-  }
-
-  if (conn->type != NETCONN_TCP &&
-     conn->recvmbox == SYS_MBOX_NULL) {
-    if ((conn->recvmbox = sys_mbox_new()) == SYS_MBOX_NULL) {
-      return ERR_MEM;
-    }
-  }
-  
-  if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    return (conn->err = ERR_MEM);
-  }
-  msg->type = API_MSG_BIND;
-  msg->msg.conn = conn;
-  msg->msg.msg.bc.ipaddr = addr;
-  msg->msg.msg.bc.port = port;
-  api_msg_post(msg);
-  sys_mbox_fetch(conn->mbox, NULL);
-  memp_free(MEMP_API_MSG, msg);
-  return conn->err;
-}
-
-
-err_t
-netconn_connect(struct netconn *conn, struct ip_addr *addr,
-       u16_t port)
-{
-  struct api_msg *msg;
-  
-  if (conn == NULL) {
-    return ERR_VAL;
-  }
-
-
-  if (conn->recvmbox == SYS_MBOX_NULL) {
-    if ((conn->recvmbox = sys_mbox_new()) == SYS_MBOX_NULL) {
-      return ERR_MEM;
-    }
-  }
-  
-  if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    return ERR_MEM;
-  }
-  msg->type = API_MSG_CONNECT;
-  msg->msg.conn = conn;  
-  msg->msg.msg.bc.ipaddr = addr;
-  msg->msg.msg.bc.port = port;
-  api_msg_post(msg);
-  sys_mbox_fetch(conn->mbox, NULL);
-  memp_free(MEMP_API_MSG, msg);
-  return conn->err;
-}
-
-err_t
-netconn_disconnect(struct netconn *conn)
-{
-  struct api_msg *msg;
-  
-  if (conn == NULL) {
-    return ERR_VAL;
-  }
-
-  if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    return ERR_MEM;
-  }
-  msg->type = API_MSG_DISCONNECT;
-  msg->msg.conn = conn;  
-  api_msg_post(msg);
-  sys_mbox_fetch(conn->mbox, NULL);
-  memp_free(MEMP_API_MSG, msg);
-  return conn->err;
-
-}
-
-err_t
-netconn_listen(struct netconn *conn)
-{
-  struct api_msg *msg;
-
-  if (conn == NULL) {
-    return ERR_VAL;
-  }
-
-  if (conn->acceptmbox == SYS_MBOX_NULL) {
-    conn->acceptmbox = sys_mbox_new();
-    if (conn->acceptmbox == SYS_MBOX_NULL) {
-      return ERR_MEM;
-    }
-  }
-  
-  if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    return (conn->err = ERR_MEM);
-  }
-  msg->type = API_MSG_LISTEN;
-  msg->msg.conn = conn;
-  api_msg_post(msg);
-  sys_mbox_fetch(conn->mbox, NULL);
-  memp_free(MEMP_API_MSG, msg);
-  return conn->err;
-}
-
-struct netconn *
-netconn_accept(struct netconn *conn)
-{
-  struct netconn *newconn;
-  
-  if (conn == NULL) {
-    return NULL;
-  }
-  
-  sys_mbox_fetch(conn->acceptmbox, (void *)&newconn);
-  /* Register event with callback */
-  if (conn->callback)
-      (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, 0);
-  
-  return newconn;
-}
-
-struct netbuf *
-netconn_recv(struct netconn *conn)
-{
-  struct api_msg *msg;
-  struct netbuf *buf;
-  struct pbuf *p;
-  u16_t len;
-    
-  if (conn == NULL) {
-    return NULL;
-  }
-  
-  if (conn->recvmbox == SYS_MBOX_NULL) {
-    conn->err = ERR_CONN;
-    return NULL;
-  }
-
-  if (conn->err != ERR_OK) {
-    return NULL;
-  }
-
-  if (conn->type == NETCONN_TCP) {
-    if (conn->pcb.tcp->state == LISTEN) {
-      conn->err = ERR_CONN;
-      return NULL;
-    }
-
-
-    buf = memp_malloc(MEMP_NETBUF);
-
-    if (buf == NULL) {
-      conn->err = ERR_MEM;
-      return NULL;
-    }
-    
-    sys_mbox_fetch(conn->recvmbox, (void *)&p);
-
-    if (p != NULL)
-    {
-        len = p->tot_len;
-        conn->recv_avail -= len;
-    }
-    else
-        len = 0;
-    
-    /* Register event with callback */
-      if (conn->callback)
-        (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, len);
-
-    /* If we are closed, we indicate that we no longer wish to receive
-       data by setting conn->recvmbox to SYS_MBOX_NULL. */
-    if (p == NULL) {
-      memp_free(MEMP_NETBUF, buf);
-      sys_mbox_free(conn->recvmbox);
-      conn->recvmbox = SYS_MBOX_NULL;
-      return NULL;
-    }
-
-    buf->p = p;
-    buf->ptr = p;
-    buf->fromport = 0;
-    buf->fromaddr = NULL;
-
-    /* Let the stack know that we have taken the data. */
-    if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-      conn->err = ERR_MEM;
-      return buf;
-    }
-    msg->type = API_MSG_RECV;
-    msg->msg.conn = conn;
-    if (buf != NULL) {
-      msg->msg.msg.len = buf->p->tot_len;
-    } else {
-      msg->msg.msg.len = 1;
-    }
-    api_msg_post(msg);
-
-    sys_mbox_fetch(conn->mbox, NULL);
-    memp_free(MEMP_API_MSG, msg);
-  } else {
-    sys_mbox_fetch(conn->recvmbox, (void *)&buf);
-  conn->recv_avail -= buf->p->tot_len;
-    /* Register event with callback */
-    if (conn->callback)
-        (*conn->callback)(conn, NETCONN_EVT_RCVMINUS, buf->p->tot_len);
-  }
-
-  
-
-    
-  LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_recv: received %p (err %d)\n", (void *)buf, conn->err));
-
-
-  return buf;
-}
-
-err_t
-netconn_send(struct netconn *conn, struct netbuf *buf)
-{
-  struct api_msg *msg;
-
-  if (conn == NULL) {
-    return ERR_VAL;
-  }
-
-  if (conn->err != ERR_OK) {
-    return conn->err;
-  }
-
-  if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    return (conn->err = ERR_MEM);
-  }
-
-  LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_send: sending %d bytes\n", buf->p->tot_len));
-  msg->type = API_MSG_SEND;
-  msg->msg.conn = conn;
-  msg->msg.msg.p = buf->p;
-  api_msg_post(msg);
-
-  sys_mbox_fetch(conn->mbox, NULL);
-  memp_free(MEMP_API_MSG, msg);
-  return conn->err;
-}
-
-err_t
-netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy)
-{
-  struct api_msg *msg;
-  u16_t len;
-  
-  if (conn == NULL) {
-    return ERR_VAL;
-  }
-
-  if (conn->err != ERR_OK) {
-    return conn->err;
-  }
-
-  if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    return (conn->err = ERR_MEM);
-  }
-  msg->type = API_MSG_WRITE;
-  msg->msg.conn = conn;
-        
-
-  conn->state = NETCONN_WRITE;
-  while (conn->err == ERR_OK && size > 0) {
-    msg->msg.msg.w.dataptr = dataptr;
-    msg->msg.msg.w.copy = copy;
-    
-    if (conn->type == NETCONN_TCP) {
-      if (tcp_sndbuf(conn->pcb.tcp) == 0) {
-  sys_sem_wait(conn->sem);
-  if (conn->err != ERR_OK) {
-    goto ret;
-  }
-      }
-      if (size > tcp_sndbuf(conn->pcb.tcp)) {
-  /* We cannot send more than one send buffer's worth of data at a
-     time. */
-  len = tcp_sndbuf(conn->pcb.tcp);
-      } else {
-  len = size;
-      }
-    } else {
-      len = size;
-    }
-    
-    LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_write: writing %d bytes (%d)\n", len, copy));
-    msg->msg.msg.w.len = len;
-    api_msg_post(msg);
-    sys_mbox_fetch(conn->mbox, NULL);    
-    if (conn->err == ERR_OK) {
-      dataptr = (void *)((u8_t *)dataptr + len);
-      size -= len;
-    } else if (conn->err == ERR_MEM) {
-      conn->err = ERR_OK;
-      sys_sem_wait(conn->sem);
-    } else {
-      goto ret;
-    }
-  }
- ret:
-  memp_free(MEMP_API_MSG, msg);
-  conn->state = NETCONN_NONE;
-  
-  return conn->err;
-}
-
-err_t
-netconn_close(struct netconn *conn)
-{
-  struct api_msg *msg;
-
-  if (conn == NULL) {
-    return ERR_VAL;
-  }
-  if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) {
-    return (conn->err = ERR_MEM);
-  }
-
-  conn->state = NETCONN_CLOSE;
- again:
-  msg->type = API_MSG_CLOSE;
-  msg->msg.conn = conn;
-  api_msg_post(msg);
-  sys_mbox_fetch(conn->mbox, NULL);
-  if (conn->err == ERR_MEM &&
-     conn->sem != SYS_SEM_NULL) {
-    sys_sem_wait(conn->sem);
-    goto again;
-  }
-  conn->state = NETCONN_NONE;
-  memp_free(MEMP_API_MSG, msg);
-  return conn->err;
-}
-
-err_t
-netconn_err(struct netconn *conn)
-{
-  return conn->err;
-}
-
diff --git a/src/VBox/Devices/Network/lwip/src/api/api_msg.c b/src/VBox/Devices/Network/lwip/src/api/api_msg.c
deleted file mode 100644
index b7cf03b..0000000
--- a/src/VBox/Devices/Network/lwip/src/api/api_msg.c
+++ /dev/null
@@ -1,807 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/opt.h"
-#include "lwip/arch.h"
-#include "lwip/api_msg.h"
-#include "lwip/memp.h"
-#include "lwip/sys.h"
-#include "lwip/tcpip.h"
-
-#if LWIP_RAW
-static u8_t
-recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
-    struct ip_addr *addr)
-{
-  struct netbuf *buf;
-  struct netconn *conn;
-
-  conn = arg;
-  if (!conn) return 0;
-
-  if (conn->recvmbox != SYS_MBOX_NULL) {
-    if (!(buf = memp_malloc(MEMP_NETBUF))) {
-      return 0;
-    }
-    pbuf_ref(p);
-    buf->p = p;
-    buf->ptr = p;
-    buf->fromaddr = addr;
-    buf->fromport = pcb->protocol;
-
-    conn->recv_avail += p->tot_len;
-    /* Register event with callback */
-    if (conn->callback)
-        (*conn->callback)(conn, NETCONN_EVT_RCVPLUS, p->tot_len);
-    sys_mbox_post(conn->recvmbox, buf);
-  }
-
-  return 0; /* do not eat the packet */
-}
-#endif
-#if LWIP_UDP
-static void
-recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
-   struct ip_addr *addr, u16_t port)
-{
-  struct netbuf *buf;
-  struct netconn *conn;
-
-  conn = arg;
-  
-  if (conn == NULL) {
-    pbuf_free(p);
-    return;
-  }
-  if (conn->recvmbox != SYS_MBOX_NULL) {
-    buf = memp_malloc(MEMP_NETBUF);
-    if (buf == NULL) {
-      pbuf_free(p);
-      return;
-    } else {
-      buf->p = p;
-      buf->ptr = p;
-      buf->fromaddr = addr;
-      buf->fromport = port;
-    }
-
-  conn->recv_avail += p->tot_len;
-    /* Register event with callback */
-    if (conn->callback)
-        (*conn->callback)(conn, NETCONN_EVT_RCVPLUS, p->tot_len);
-    sys_mbox_post(conn->recvmbox, buf);
-  }
-}
-#endif /* LWIP_UDP */
-#if LWIP_TCP
-
-static err_t
-recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
-{
-  struct netconn *conn;
-  u16_t len;
-  
-  conn = arg;
-
-  if (conn == NULL) {
-    pbuf_free(p);
-    return ERR_VAL;
-  }
-
-  if (conn->recvmbox != SYS_MBOX_NULL) {
-        
-    conn->err = err;
-    if (p != NULL) {
-        len = p->tot_len;
-        conn->recv_avail += len;
-    }
-    else
-        len = 0;
-    /* Register event with callback */
-    if (conn->callback)
-        (*conn->callback)(conn, NETCONN_EVT_RCVPLUS, len);
-    sys_mbox_post(conn->recvmbox, p);
-  }  
-  return ERR_OK;
-}
-
-
-static err_t
-poll_tcp(void *arg, struct tcp_pcb *pcb)
-{
-  struct netconn *conn;
-
-  conn = arg;
-  if (conn != NULL &&
-     (conn->state == NETCONN_WRITE || conn->state == NETCONN_CLOSE) &&
-     conn->sem != SYS_SEM_NULL) {
-    sys_sem_signal(conn->sem);
-  }
-  return ERR_OK;
-}
-
-static err_t
-sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
-{
-  struct netconn *conn;
-
-  conn = arg;
-  if (conn != NULL && conn->sem != SYS_SEM_NULL) {
-    sys_sem_signal(conn->sem);
-  }
-
-  if (conn && conn->callback)
-      if (tcp_sndbuf(conn->pcb.tcp) > TCP_SNDLOWAT)
-          (*conn->callback)(conn, NETCONN_EVT_SENDPLUS, len);
-  
-  return ERR_OK;
-}
-
-static void
-err_tcp(void *arg, err_t err)
-{
-  struct netconn *conn;
-
-  conn = arg;
-
-  conn->pcb.tcp = NULL;
-
-  
-  conn->err = err;
-  if (conn->recvmbox != SYS_MBOX_NULL) {
-    /* Register event with callback */
-    if (conn->callback)
-      (*conn->callback)(conn, NETCONN_EVT_RCVPLUS, 0);
-    sys_mbox_post(conn->recvmbox, NULL);
-  }
-  if (conn->mbox != SYS_MBOX_NULL) {
-    sys_mbox_post(conn->mbox, NULL);
-  }
-  if (conn->acceptmbox != SYS_MBOX_NULL) {
-     /* Register event with callback */
-    if (conn->callback)
-      (*conn->callback)(conn, NETCONN_EVT_RCVPLUS, 0);
-    sys_mbox_post(conn->acceptmbox, NULL);
-  }
-  if (conn->sem != SYS_SEM_NULL) {
-    sys_sem_signal(conn->sem);
-  }
-}
-
-static void
-setup_tcp(struct netconn *conn)
-{
-  struct tcp_pcb *pcb;
-  
-  pcb = conn->pcb.tcp;
-  tcp_arg(pcb, conn);
-  tcp_recv(pcb, recv_tcp);
-  tcp_sent(pcb, sent_tcp);
-  tcp_poll(pcb, poll_tcp, 4);
-  tcp_err(pcb, err_tcp);
-}
-
-static err_t
-accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
-{
-  sys_mbox_t mbox;
-  struct netconn *newconn;
-  struct netconn *conn;
-  
-#if API_MSG_DEBUG
-#if TCP_DEBUG
-  tcp_debug_print_state(newpcb->state);
-#endif /* TCP_DEBUG */
-#endif /* API_MSG_DEBUG */
-  conn = (struct netconn *)arg;
-  mbox = conn->acceptmbox;
-  newconn = memp_malloc(MEMP_NETCONN);
-  if (newconn == NULL) {
-    return ERR_MEM;
-  }
-  newconn->recvmbox = sys_mbox_new();
-  if (newconn->recvmbox == SYS_MBOX_NULL) {
-    memp_free(MEMP_NETCONN, newconn);
-    return ERR_MEM;
-  }
-  newconn->mbox = sys_mbox_new();
-  if (newconn->mbox == SYS_MBOX_NULL) {
-    sys_mbox_free(newconn->recvmbox);
-    memp_free(MEMP_NETCONN, newconn);
-    return ERR_MEM;
-  }
-  newconn->sem = sys_sem_new(0);
-  if (newconn->sem == SYS_SEM_NULL) {
-    sys_mbox_free(newconn->recvmbox);
-    sys_mbox_free(newconn->mbox);
-    memp_free(MEMP_NETCONN, newconn);
-    return ERR_MEM;
-  }
-  /* Allocations were OK, setup the PCB etc */
-  newconn->type = NETCONN_TCP;
-  newconn->pcb.tcp = newpcb;
-  setup_tcp(newconn);
-  newconn->acceptmbox = SYS_MBOX_NULL;
-  newconn->err = err;
-  /* Register event with callback */
-  if (conn->callback)
-  {
-    (*conn->callback)(conn, NETCONN_EVT_RCVPLUS, 0);
-  }
-  /* We have to set the callback here even though
-   * the new socket is unknown. Mark the socket as -1. */
-  newconn->callback = conn->callback;
-  newconn->socket = -1;
-  newconn->recv_avail = 0;
-  
-  sys_mbox_post(mbox, newconn);
-  return ERR_OK;
-}
-#endif /* LWIP_TCP */
-
-static void
-do_newconn(struct api_msg_msg *msg)
-{
-   if(msg->conn->pcb.tcp != NULL) {
-   /* This "new" connection already has a PCB allocated. */
-   /* Is this an error condition? Should it be deleted? 
-      We currently just are happy and return. */
-     sys_mbox_post(msg->conn->mbox, NULL);
-     return;
-   }
-
-   msg->conn->err = ERR_OK;
-
-   /* Allocate a PCB for this connection */
-   switch(msg->conn->type) {
-#if LWIP_RAW
-   case NETCONN_RAW:
-      msg->conn->pcb.raw = raw_new(msg->msg.bc.port); /* misusing the port field */
-      raw_recv(msg->conn->pcb.raw, recv_raw, msg->conn);
-     break;
-#endif
-#if LWIP_UDP
-   case NETCONN_UDPLITE:
-      msg->conn->pcb.udp = udp_new();
-      if(msg->conn->pcb.udp == NULL) {
-         msg->conn->err = ERR_MEM;
-         break;
-      }
-      udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE);
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-   case NETCONN_UDPNOCHKSUM:
-      msg->conn->pcb.udp = udp_new();
-      if(msg->conn->pcb.udp == NULL) {
-         msg->conn->err = ERR_MEM;
-         break;
-      }
-      udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM);
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-   case NETCONN_UDP:
-      msg->conn->pcb.udp = udp_new();
-      if(msg->conn->pcb.udp == NULL) {
-         msg->conn->err = ERR_MEM;
-         break;
-      }
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP
-   case NETCONN_TCP:
-      msg->conn->pcb.tcp = tcp_new();
-      if(msg->conn->pcb.tcp == NULL) {
-         msg->conn->err = ERR_MEM;
-         break;
-      }
-      setup_tcp(msg->conn);
-      break;
-#endif
-   }
-   
-  
-  sys_mbox_post(msg->conn->mbox, NULL);
-}
-
-
-static void
-do_delconn(struct api_msg_msg *msg)
-{
-  if (msg->conn->pcb.tcp != NULL) {
-    switch (msg->conn->type) {
-#if LWIP_RAW
-    case NETCONN_RAW:
-      raw_remove(msg->conn->pcb.raw);
-      break;
-#endif
-#if LWIP_UDP
-    case NETCONN_UDPLITE:
-      /* FALLTHROUGH */
-    case NETCONN_UDPNOCHKSUM:
-      /* FALLTHROUGH */
-    case NETCONN_UDP:
-      msg->conn->pcb.udp->recv_arg = NULL;
-      udp_remove(msg->conn->pcb.udp);
-      break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP      
-    case NETCONN_TCP:
-      if (msg->conn->pcb.tcp->state == LISTEN) {
-  tcp_arg(msg->conn->pcb.tcp, NULL);
-  tcp_accept(msg->conn->pcb.tcp, NULL);  
-  tcp_close(msg->conn->pcb.tcp);
-      } else {
-  tcp_arg(msg->conn->pcb.tcp, NULL);
-  tcp_sent(msg->conn->pcb.tcp, NULL);
-  tcp_recv(msg->conn->pcb.tcp, NULL);  
-  tcp_poll(msg->conn->pcb.tcp, NULL, 0);
-  tcp_err(msg->conn->pcb.tcp, NULL);
-  if (tcp_close(msg->conn->pcb.tcp) != ERR_OK) {
-    tcp_abort(msg->conn->pcb.tcp);
-  }
-      }
-#endif
-    default:  
-    break;
-    }
-  }
-  /* Trigger select() in socket layer */
-  if (msg->conn->callback)
-  {
-      (*msg->conn->callback)(msg->conn, NETCONN_EVT_RCVPLUS, 0);
-      (*msg->conn->callback)(msg->conn, NETCONN_EVT_SENDPLUS, 0);
-  }
-  
-  if (msg->conn->mbox != SYS_MBOX_NULL) {
-    sys_mbox_post(msg->conn->mbox, NULL);
-  }
-}
-
-static void
-do_bind(struct api_msg_msg *msg)
-{
-  if (msg->conn->pcb.tcp == NULL) {
-    switch (msg->conn->type) {
-#if LWIP_RAW
-    case NETCONN_RAW:
-      msg->conn->pcb.raw = raw_new(msg->msg.bc.port); /* misusing the port field as protocol */
-      raw_recv(msg->conn->pcb.raw, recv_raw, msg->conn);
-      break;
-#endif
-#if LWIP_UDP
-    case NETCONN_UDPLITE:
-      msg->conn->pcb.udp = udp_new();
-      udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE);
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-    case NETCONN_UDPNOCHKSUM:
-      msg->conn->pcb.udp = udp_new();
-      udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM);
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-    case NETCONN_UDP:
-      msg->conn->pcb.udp = udp_new();
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP      
-    case NETCONN_TCP:
-      msg->conn->pcb.tcp = tcp_new();
-      setup_tcp(msg->conn);
-#endif /* LWIP_TCP */
-    default:  
-    break;
-    }
-  }
-  switch (msg->conn->type) {
-#if LWIP_RAW
-  case NETCONN_RAW:
-    msg->conn->err = raw_bind(msg->conn->pcb.raw,msg->msg.bc.ipaddr);
-    break;
-#endif
-#if LWIP_UDP
-  case NETCONN_UDPLITE:
-    /* FALLTHROUGH */
-  case NETCONN_UDPNOCHKSUM:
-    /* FALLTHROUGH */
-  case NETCONN_UDP:
-    msg->conn->err = udp_bind(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
-    break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP
-  case NETCONN_TCP:
-    msg->conn->err = tcp_bind(msg->conn->pcb.tcp,
-            msg->msg.bc.ipaddr, msg->msg.bc.port);
-#endif /* LWIP_TCP */
-  default:
-    break;
-  }
-  sys_mbox_post(msg->conn->mbox, NULL);
-}
-#if LWIP_TCP
-
-static err_t
-do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
-{
-  struct netconn *conn;
-
-  conn = arg;
-
-  if (conn == NULL) {
-    return ERR_VAL;
-  }
-  
-  conn->err = err;
-  if (conn->type == NETCONN_TCP && err == ERR_OK) {
-    setup_tcp(conn);
-  }    
-  sys_mbox_post(conn->mbox, NULL);
-  return ERR_OK;
-}
-#endif  
-
-static void
-do_connect(struct api_msg_msg *msg)
-{
-  if (msg->conn->pcb.tcp == NULL) {
-    switch (msg->conn->type) {
-#if LWIP_RAW
-    case NETCONN_RAW:
-      msg->conn->pcb.raw = raw_new(msg->msg.bc.port); /* misusing the port field as protocol */
-      raw_recv(msg->conn->pcb.raw, recv_raw, msg->conn);
-      break;
-#endif
-#if LWIP_UDP
-    case NETCONN_UDPLITE:
-      msg->conn->pcb.udp = udp_new();
-      if (msg->conn->pcb.udp == NULL) {
-  msg->conn->err = ERR_MEM;
-  sys_mbox_post(msg->conn->mbox, NULL);
-  return;
-      }
-      udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE);
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-    case NETCONN_UDPNOCHKSUM:
-      msg->conn->pcb.udp = udp_new();
-      if (msg->conn->pcb.udp == NULL) {
-  msg->conn->err = ERR_MEM;
-  sys_mbox_post(msg->conn->mbox, NULL);
-  return;
-      }
-      udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM);
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-    case NETCONN_UDP:
-      msg->conn->pcb.udp = udp_new();
-      if (msg->conn->pcb.udp == NULL) {
-  msg->conn->err = ERR_MEM;
-  sys_mbox_post(msg->conn->mbox, NULL);
-  return;
-      }
-      udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
-      break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP      
-    case NETCONN_TCP:
-      msg->conn->pcb.tcp = tcp_new();      
-      if (msg->conn->pcb.tcp == NULL) {
-  msg->conn->err = ERR_MEM;
-  sys_mbox_post(msg->conn->mbox, NULL);
-  return;
-      }
-#endif
-    default:
-      break;
-    }
-  }
-  switch (msg->conn->type) {
-#if LWIP_RAW
-  case NETCONN_RAW:
-    raw_connect(msg->conn->pcb.raw, msg->msg.bc.ipaddr);
-    sys_mbox_post(msg->conn->mbox, NULL);
-    break;
-#endif
-#if LWIP_UDP
-  case NETCONN_UDPLITE:
-    /* FALLTHROUGH */
-  case NETCONN_UDPNOCHKSUM:
-    /* FALLTHROUGH */
-  case NETCONN_UDP:
-    udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
-    sys_mbox_post(msg->conn->mbox, NULL);
-    break;
-#endif 
-#if LWIP_TCP      
-  case NETCONN_TCP:
-    /*    tcp_arg(msg->conn->pcb.tcp, msg->conn);*/
-    setup_tcp(msg->conn);
-    tcp_connect(msg->conn->pcb.tcp, msg->msg.bc.ipaddr, msg->msg.bc.port,
-    do_connected);
-    /*tcp_output(msg->conn->pcb.tcp);*/
-#endif
-
-  default:
-    break;
-  }
-}
-
-static void
-do_disconnect(struct api_msg_msg *msg)
-{
-
-  switch (msg->conn->type) {
-#if LWIP_RAW
-  case NETCONN_RAW:
-    /* Do nothing as connecting is only a helper for upper lwip layers */
-    break;
-#endif
-#if LWIP_UDP
-  case NETCONN_UDPLITE:
-    /* FALLTHROUGH */
-  case NETCONN_UDPNOCHKSUM:
-    /* FALLTHROUGH */
-  case NETCONN_UDP:
-    udp_disconnect(msg->conn->pcb.udp);
-    break;
-#endif 
-  case NETCONN_TCP:
-    break;
-  }
-  sys_mbox_post(msg->conn->mbox, NULL);
-}
-
-
-static void
-do_listen(struct api_msg_msg *msg)
-{
-  if (msg->conn->pcb.tcp != NULL) {
-    switch (msg->conn->type) {
-#if LWIP_RAW
-    case NETCONN_RAW:
-      LWIP_DEBUGF(API_MSG_DEBUG, ("api_msg: listen RAW: cannot listen for RAW.\n"));
-      break;
-#endif
-#if LWIP_UDP
-    case NETCONN_UDPLITE:
-      /* FALLTHROUGH */
-    case NETCONN_UDPNOCHKSUM:
-      /* FALLTHROUGH */
-    case NETCONN_UDP:
-      LWIP_DEBUGF(API_MSG_DEBUG, ("api_msg: listen UDP: cannot listen for UDP.\n"));
-      break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP      
-    case NETCONN_TCP:
-      msg->conn->pcb.tcp = tcp_listen(msg->conn->pcb.tcp);
-      if (msg->conn->pcb.tcp == NULL) {
-  msg->conn->err = ERR_MEM;
-      } else {
-  if (msg->conn->acceptmbox == SYS_MBOX_NULL) {
-    msg->conn->acceptmbox = sys_mbox_new();
-    if (msg->conn->acceptmbox == SYS_MBOX_NULL) {
-      msg->conn->err = ERR_MEM;
-      break;
-    }
-  }
-  tcp_arg(msg->conn->pcb.tcp, msg->conn);
-  tcp_accept(msg->conn->pcb.tcp, accept_function);
-      }
-#endif
-    default:
-      break;
-    }
-  }
-  sys_mbox_post(msg->conn->mbox, NULL);
-}
-
-static void
-do_accept(struct api_msg_msg *msg)
-{
-  if (msg->conn->pcb.tcp != NULL) {
-    switch (msg->conn->type) {
-#if LWIP_RAW
-    case NETCONN_RAW:
-      LWIP_DEBUGF(API_MSG_DEBUG, ("api_msg: accept RAW: cannot accept for RAW.\n"));
-      break;
-#endif
-#if LWIP_UDP
-    case NETCONN_UDPLITE:
-      /* FALLTHROUGH */
-    case NETCONN_UDPNOCHKSUM:
-      /* FALLTHROUGH */
-    case NETCONN_UDP:    
-      LWIP_DEBUGF(API_MSG_DEBUG, ("api_msg: accept UDP: cannot accept for UDP.\n"));
-      break;
-#endif /* LWIP_UDP */
-    case NETCONN_TCP:
-      break;
-    }
-  }
-}
-
-static void
-do_send(struct api_msg_msg *msg)
-{
-  if (msg->conn->pcb.tcp != NULL) {
-    switch (msg->conn->type) {
-#if LWIP_RAW
-    case NETCONN_RAW:
-      raw_send(msg->conn->pcb.raw, msg->msg.p);
-      break;
-#endif
-#if LWIP_UDP
-    case NETCONN_UDPLITE:
-      /* FALLTHROUGH */
-    case NETCONN_UDPNOCHKSUM:
-      /* FALLTHROUGH */
-    case NETCONN_UDP:
-      udp_send(msg->conn->pcb.udp, msg->msg.p);
-      break;
-#endif /* LWIP_UDP */
-    case NETCONN_TCP:
-      break;
-    }
-  }
-  sys_mbox_post(msg->conn->mbox, NULL);
-}
-
-static void
-do_recv(struct api_msg_msg *msg)
-{
-#if LWIP_TCP
-  if (msg->conn->pcb.tcp != NULL) {
-    if (msg->conn->type == NETCONN_TCP) {
-      tcp_recved(msg->conn->pcb.tcp, msg->msg.len);
-    }
-  }
-#endif  
-  sys_mbox_post(msg->conn->mbox, NULL);
-}
-
-static void
-do_write(struct api_msg_msg *msg)
-{
-#if LWIP_TCP  
-  err_t err;
-#endif  
-  if (msg->conn->pcb.tcp != NULL) {
-    switch (msg->conn->type) {
-#if LWIP_RAW
-    case NETCONN_RAW:
-      msg->conn->err = ERR_VAL;
-      break;
-#endif
-#if LWIP_UDP 
-    case NETCONN_UDPLITE:
-      /* FALLTHROUGH */
-    case NETCONN_UDPNOCHKSUM:
-      /* FALLTHROUGH */
-    case NETCONN_UDP:
-      msg->conn->err = ERR_VAL;
-      break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP 
-    case NETCONN_TCP:      
-      err = tcp_write(msg->conn->pcb.tcp, msg->msg.w.dataptr,
-                      msg->msg.w.len, msg->msg.w.copy);
-      /* This is the Nagle algorithm: inhibit the sending of new TCP
-   segments when new outgoing data arrives from the user if any
-   previously transmitted data on the connection remains
-   unacknowledged. */
-      if(err == ERR_OK && (msg->conn->pcb.tcp->unacked == NULL ||
-        (msg->conn->pcb.tcp->flags & TF_NODELAY) || 
-        (msg->conn->pcb.tcp->snd_queuelen) > 1)) {
-          tcp_output(msg->conn->pcb.tcp);
-      }
-      msg->conn->err = err;
-      if (msg->conn->callback)
-          if (err == ERR_OK)
-          {
-              if (tcp_sndbuf(msg->conn->pcb.tcp) <= TCP_SNDLOWAT)
-                  (*msg->conn->callback)(msg->conn, NETCONN_EVT_SENDMINUS, msg->msg.w.len);
-          }
-#endif
-    default:
-      break;
-    }
-  }
-  sys_mbox_post(msg->conn->mbox, NULL);
-}
-
-static void
-do_close(struct api_msg_msg *msg)
-{
-  err_t err;
-
-  err = ERR_OK;
-
-  if (msg->conn->pcb.tcp != NULL) {
-    switch (msg->conn->type) {
-#if LWIP_RAW
-    case NETCONN_RAW:
-      break;
-#endif
-#if LWIP_UDP
-    case NETCONN_UDPLITE:
-      /* FALLTHROUGH */
-    case NETCONN_UDPNOCHKSUM:
-      /* FALLTHROUGH */
-    case NETCONN_UDP:
-      break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP
-    case NETCONN_TCP:
-      if (msg->conn->pcb.tcp->state == LISTEN) {
-        err = tcp_close(msg->conn->pcb.tcp);
-      }
-      else if (msg->conn->pcb.tcp->state == CLOSE_WAIT) {
-        err = tcp_output(msg->conn->pcb.tcp);
-      }
-      msg->conn->err = err;      
-#endif
-    default:      
-      break;
-    }
-  }
-  sys_mbox_post(msg->conn->mbox, NULL);
-}
-
-typedef void (* api_msg_decode)(struct api_msg_msg *msg);
-static api_msg_decode decode[API_MSG_MAX] = {
-  do_newconn,
-  do_delconn,
-  do_bind,
-  do_connect,
-  do_disconnect,
-  do_listen,
-  do_accept,
-  do_send,
-  do_recv,
-  do_write,
-  do_close
-  };
-void
-api_msg_input(struct api_msg *msg)
-{  
-  decode[msg->type](&(msg->msg));
-}
-
-void
-api_msg_post(struct api_msg *msg)
-{
-  tcpip_apimsg(msg);
-}
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/api/err.c b/src/VBox/Devices/Network/lwip/src/api/err.c
deleted file mode 100644
index b582d88..0000000
--- a/src/VBox/Devices/Network/lwip/src/api/err.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/err.h"
-
-#ifdef LWIP_DEBUG
-
-static char *err_strerr[] = {"Ok.",
-           "Out of memory error.",
-           "Buffer error.",
-           "Connection aborted.",
-           "Connection reset.",
-           "Connection closed.",
-           "Not connected.",
-           "Illegal value.",
-           "Illegal argument.",
-           "Routing problem.",
-           "Address in use."
-};
-
-
-char *
-lwip_strerr(err_t err)
-{
-  return err_strerr[-err];
-
-}
-
-
-#endif /* LWIP_DEBUG */
diff --git a/src/VBox/Devices/Network/lwip/src/api/sockets.c b/src/VBox/Devices/Network/lwip/src/api/sockets.c
deleted file mode 100644
index 375458c..0000000
--- a/src/VBox/Devices/Network/lwip/src/api/sockets.c
+++ /dev/null
@@ -1,1367 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- * Improved by Marc Boucher <marc at mbsi.ca> and David Haas <dhaas at alum.rpi.edu>
- *
- */
-
-#include <string.h>
-#ifndef _MSC_VER /* Why is errno.h included here - see lwip/arch.h -> lwip/cc.h */
-# include <errno.h>
-#endif
-
-#include "lwip/opt.h"
-#include "lwip/api.h"
-#include "lwip/arch.h"
-#include "lwip/sys.h"
-
-#include "lwip/sockets.h"
-
-#define NUM_SOCKETS MEMP_NUM_NETCONN
-
-struct lwip_socket {
-  struct netconn *conn;
-  struct netbuf *lastdata;
-  u16_t lastoffset;
-  u16_t rcvevent;
-  u16_t sendevent;
-  u16_t  flags;
-  int err;
-};
-
-struct lwip_select_cb
-{
-    struct lwip_select_cb *next;
-    fd_set *readset;
-    fd_set *writeset;
-    fd_set *exceptset;
-    int sem_signalled;
-    sys_sem_t sem;
-};
-
-static struct lwip_socket sockets[NUM_SOCKETS];
-static struct lwip_select_cb *select_cb_list = 0;
-
-static sys_sem_t socksem = 0;
-static sys_sem_t selectsem = 0;
-
-static void
-event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len);
-
-static int err_to_errno_table[11] = {
-    0,      /* ERR_OK    0      No error, everything OK. */
-    ENOMEM,    /* ERR_MEM  -1      Out of memory error.     */
-    ENOBUFS,    /* ERR_BUF  -2      Buffer error.            */
-    ECONNABORTED,  /* ERR_ABRT -3      Connection aborted.      */
-    ECONNRESET,    /* ERR_RST  -4      Connection reset.        */
-    ESHUTDOWN,    /* ERR_CLSD -5      Connection closed.       */
-    ENOTCONN,    /* ERR_CONN -6      Not connected.           */
-    EINVAL,    /* ERR_VAL  -7      Illegal value.           */
-    EIO,    /* ERR_ARG  -8      Illegal argument.        */
-    EHOSTUNREACH,  /* ERR_RTE  -9      Routing problem.         */
-    EADDRINUSE    /* ERR_USE  -10     Address in use.          */
-};
-
-#define ERR_TO_ERRNO_TABLE_SIZE \
-  (sizeof(err_to_errno_table)/sizeof(err_to_errno_table[0]))
-
-#define err_to_errno(err) \
-  (-(err) >= 0 && (unsigned)-(err) < ERR_TO_ERRNO_TABLE_SIZE ? \
-    err_to_errno_table[(unsigned)-(err)] : EIO)
-
-#ifdef ERRNO
-#define set_errno(err) errno = (err)
-# ifdef _MSC_VER
-#  error "Curious bird: Where is ERRNO defined for MSC?"
-# endif
-#else
-#define set_errno(err)
-#endif
-
-#define sock_set_errno(sk, e) do { \
-      sk->err = (e); \
-      set_errno(sk->err); \
-} while (0)
-
-
-static struct lwip_socket *
-get_socket(int s)
-{
-  struct lwip_socket *sock;
-
-  if ((s < 0) || (s >= NUM_SOCKETS)) {
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", s));
-    set_errno(EBADF);
-    return NULL;
-  }
-
-  sock = &sockets[s];
-
-  if (!sock->conn) {
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): not active\n", s));
-    set_errno(EBADF);
-    return NULL;
-  }
-
-  return sock;
-}
-
-static int
-alloc_socket(struct netconn *newconn)
-{
-  int i;
-
-  if (!socksem)
-      socksem = sys_sem_new(1);
-
-  /* Protect socket array */
-  sys_sem_wait(socksem);
-
-  /* allocate a new socket identifier */
-  for(i = 0; i < NUM_SOCKETS; ++i) {
-    if (!sockets[i].conn) {
-      sockets[i].conn = newconn;
-      sockets[i].lastdata = NULL;
-      sockets[i].lastoffset = 0;
-      sockets[i].rcvevent = 0;
-      sockets[i].sendevent = 1; /* TCP send buf is empty */
-      sockets[i].flags = 0;
-      sockets[i].err = 0;
-      sys_sem_signal(socksem);
-      return i;
-    }
-  }
-  sys_sem_signal(socksem);
-  return -1;
-}
-
-int
-lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
-{
-  struct lwip_socket *sock;
-  struct netconn *newconn;
-  struct ip_addr naddr;
-  u16_t port;
-  int newsock;
-  struct sockaddr_in sin;
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s));
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  newconn = netconn_accept(sock->conn);
-
-  /* get the IP address and port of the remote host */
-  netconn_peer(newconn, &naddr, &port);
-
-  memset(&sin, 0, sizeof(sin));
-  sin.sin_len = sizeof(sin);
-  sin.sin_family = AF_INET;
-  sin.sin_port = htons(port);
-  sin.sin_addr.s_addr = naddr.addr;
-
-  if (*addrlen > (socklen_t)sizeof(sin))
-      *addrlen = sizeof(sin);
-
-  memcpy(addr, &sin, *addrlen);
-
-  newsock = alloc_socket(newconn);
-  if (newsock == -1) {
-    netconn_delete(newconn);
-  sock_set_errno(sock, ENOBUFS);
-  return -1;
-  }
-  newconn->callback = event_callback;
-  sock = get_socket(newsock);
-
-  sys_sem_wait(socksem);
-  sock->rcvevent += -1 - newconn->socket;
-  newconn->socket = newsock;
-  sys_sem_signal(socksem);
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d addr=", s, newsock));
-  ip_addr_debug_print(SOCKETS_DEBUG, &naddr);
-  LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u\n", port));
-
-  sock_set_errno(sock, 0);
-  return newsock;
-}
-
-int
-lwip_bind(int s, struct sockaddr *name, socklen_t namelen)
-{
-  struct lwip_socket *sock;
-  struct ip_addr local_addr;
-  u16_t local_port;
-  err_t err;
-
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  local_addr.addr = ((struct sockaddr_in *)name)->sin_addr.s_addr;
-  local_port = ((struct sockaddr_in *)name)->sin_port;
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d, addr=", s));
-  ip_addr_debug_print(SOCKETS_DEBUG, &local_addr);
-  LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(local_port)));
-
-  err = netconn_bind(sock->conn, &local_addr, ntohs(local_port));
-
-  if (err != ERR_OK) {
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d) failed, err=%d\n", s, err));
-    sock_set_errno(sock, err_to_errno(err));
-    return -1;
-  }
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d) succeeded\n", s));
-  sock_set_errno(sock, 0);
-  return 0;
-}
-
-int
-lwip_close(int s)
-{
-  struct lwip_socket *sock;
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s));
-  if (!socksem)
-      socksem = sys_sem_new(1);
-
-  /* We cannot allow multiple closes of the same socket. */
-  sys_sem_wait(socksem);
-
-  sock = get_socket(s);
-  if (!sock) {
-      sys_sem_signal(socksem);
-      set_errno(EBADF);
-      return -1;
-  }
-
-  netconn_delete(sock->conn);
-  if (sock->lastdata) {
-    netbuf_delete(sock->lastdata);
-  }
-  sock->lastdata = NULL;
-  sock->lastoffset = 0;
-  sock->conn = NULL;
-  sys_sem_signal(socksem);
-  sock_set_errno(sock, 0);
-  return 0;
-}
-
-int
-lwip_connect(int s, struct sockaddr *name, socklen_t namelen)
-{
-  struct lwip_socket *sock;
-  err_t err;
-
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  if (((struct sockaddr_in *)name)->sin_family == AF_UNSPEC) {
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d, AF_UNSPEC)\n", s));
-    err = netconn_disconnect(sock->conn);
-  } else {
-    struct ip_addr remote_addr;
-    u16_t remote_port;
-
-    remote_addr.addr = ((struct sockaddr_in *)name)->sin_addr.s_addr;
-    remote_port = ((struct sockaddr_in *)name)->sin_port;
-
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d, addr=", s));
-    ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr);
-    LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(remote_port)));
-
-    err = netconn_connect(sock->conn, &remote_addr, ntohs(remote_port));
-   }
-
-  if (err != ERR_OK) {
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) failed, err=%d\n", s, err));
-    sock_set_errno(sock, err_to_errno(err));
-    return -1;
-  }
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) succeeded\n", s));
-  sock_set_errno(sock, 0);
-  return 0;
-}
-
-int
-lwip_listen(int s, int backlog)
-{
-  struct lwip_socket *sock;
-  err_t err;
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d, backlog=%d)\n", s, backlog));
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  err = netconn_listen(sock->conn);
-
-  if (err != ERR_OK) {
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d) failed, err=%d\n", s, err));
-    sock_set_errno(sock, err_to_errno(err));
-    return -1;
-  }
-
-  sock_set_errno(sock, 0);
-  return 0;
-}
-
-int
-lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
-        struct sockaddr *from, socklen_t *fromlen)
-{
-  struct lwip_socket *sock;
-  struct netbuf *buf;
-  u16_t buflen, copylen;
-  struct ip_addr *addr;
-  u16_t port;
-
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d, %p, %d, 0x%x, ..)\n", s, mem, len, flags));
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  /* Check if there is data left from the last recv operation. */
-  if (sock->lastdata) {
-    buf = sock->lastdata;
-  } else {
-    /* If this is non-blocking call, then check first */
-    if (((flags & MSG_DONTWAIT) || (sock->flags & O_NONBLOCK))
-  && !sock->rcvevent)
-    {
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): returning EWOULDBLOCK\n", s));
-      sock_set_errno(sock, EWOULDBLOCK);
-      return -1;
-    }
-
-    /* No data was left from the previous operation, so we try to get
-       some from the network. */
-    buf = netconn_recv(sock->conn);
-
-    if (!buf) {
-      /* We should really do some error checking here. */
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): buf == NULL!\n", s));
-      sock_set_errno(sock, 0);
-      return 0;
-    }
-  }
-
-  buflen = netbuf_len(buf);
-
-  buflen -= sock->lastoffset;
-
-  if (len > buflen) {
-    copylen = buflen;
-  } else {
-    copylen = len;
-  }
-
-  /* copy the contents of the received buffer into
-     the supplied memory pointer mem */
-  netbuf_copy_partial(buf, mem, copylen, sock->lastoffset);
-
-  /* Check to see from where the data was. */
-  if (from && fromlen) {
-    struct sockaddr_in sin;
-
-    addr = netbuf_fromaddr(buf);
-    port = netbuf_fromport(buf);
-
-    memset(&sin, 0, sizeof(sin));
-    sin.sin_len = sizeof(sin);
-    sin.sin_family = AF_INET;
-    sin.sin_port = htons(port);
-    sin.sin_addr.s_addr = addr->addr;
-
-    if (*fromlen > (socklen_t)sizeof(sin))
-      *fromlen = sizeof(sin);
-
-    memcpy(from, &sin, *fromlen);
-
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s));
-    ip_addr_debug_print(SOCKETS_DEBUG, addr);
-    LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u len=%u\n", port, copylen));
-  } else {
-#if SOCKETS_DEBUG
-    addr = netbuf_fromaddr(buf);
-    port = netbuf_fromport(buf);
-
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s));
-    ip_addr_debug_print(SOCKETS_DEBUG, addr);
-    LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u len=%u\n", port, copylen));
-#endif
-
-  }
-
-  /* If this is a TCP socket, check if there is data left in the
-     buffer. If so, it should be saved in the sock structure for next
-     time around. */
-  if (netconn_type(sock->conn) == NETCONN_TCP && buflen - copylen > 0) {
-    sock->lastdata = buf;
-    sock->lastoffset += copylen;
-  } else {
-    sock->lastdata = NULL;
-    sock->lastoffset = 0;
-    netbuf_delete(buf);
-  }
-
-
-  sock_set_errno(sock, 0);
-  return copylen;
-}
-
-int
-lwip_read(int s, void *mem, int len)
-{
-  return lwip_recvfrom(s, mem, len, 0, NULL, NULL);
-}
-
-int
-lwip_recv(int s, void *mem, int len, unsigned int flags)
-{
-  return lwip_recvfrom(s, mem, len, flags, NULL, NULL);
-}
-
-int
-lwip_send(int s, void *data, int size, unsigned int flags)
-{
-  struct lwip_socket *sock;
-  struct netbuf *buf;
-  err_t err;
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_send(%d, data=%p, size=%d, flags=0x%x)\n", s, data, size, flags));
-
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  switch (netconn_type(sock->conn)) {
-  case NETCONN_RAW:
-  case NETCONN_UDP:
-  case NETCONN_UDPLITE:
-  case NETCONN_UDPNOCHKSUM:
-    /* create a buffer */
-    buf = netbuf_new();
-
-    if (!buf) {
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_send(%d) ENOBUFS\n", s));
-      sock_set_errno(sock, ENOBUFS);
-      return -1;
-    }
-
-    /* make the buffer point to the data that should
-       be sent */
-    netbuf_ref(buf, data, size);
-
-    /* send the data */
-    err = netconn_send(sock->conn, buf);
-
-    /* deallocated the buffer */
-    netbuf_delete(buf);
-    break;
-  case NETCONN_TCP:
-    err = netconn_write(sock->conn, data, size, NETCONN_COPY);
-    break;
-  default:
-    err = ERR_ARG;
-    break;
-  }
-  if (err != ERR_OK) {
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_send(%d) err=%d\n", s, err));
-    sock_set_errno(sock, err_to_errno(err));
-    return -1;
-  }
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_send(%d) ok size=%d\n", s, size));
-  sock_set_errno(sock, 0);
-  return size;
-}
-
-int
-lwip_sendto(int s, void *data, int size, unsigned int flags,
-       struct sockaddr *to, socklen_t tolen)
-{
-  struct lwip_socket *sock;
-  struct ip_addr remote_addr, addr;
-  u16_t remote_port, port;
-  int ret,connected;
-
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  /* get the peer if currently connected */
-  connected = (netconn_peer(sock->conn, &addr, &port) == ERR_OK);
-
-  remote_addr.addr = ((struct sockaddr_in *)to)->sin_addr.s_addr;
-  remote_port = ((struct sockaddr_in *)to)->sin_port;
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_sendto(%d, data=%p, size=%d, flags=0x%x to=", s, data, size, flags));
-  ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr);
-  LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%u\n", ntohs(remote_port)));
-
-  netconn_connect(sock->conn, &remote_addr, ntohs(remote_port));
-
-  ret = lwip_send(s, data, size, flags);
-
-  /* reset the remote address and port number
-     of the connection */
-  if (connected)
-    netconn_connect(sock->conn, &addr, port);
-  else
-  netconn_disconnect(sock->conn);
-  return ret;
-}
-
-int
-lwip_socket(int domain, int type, int protocol)
-{
-  struct netconn *conn;
-  int i;
-
-  /* create a netconn */
-  switch (type) {
-  case SOCK_RAW:
-    conn = netconn_new_with_proto_and_callback(NETCONN_RAW, protocol, event_callback);
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_socket(%s, SOCK_RAW, %d) = ", domain == PF_INET ? "PF_INET" : "UNKNOWN", protocol));
-    break;
-  case SOCK_DGRAM:
-    conn = netconn_new_with_callback(NETCONN_UDP, event_callback);
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_socket(%s, SOCK_DGRAM, %d) = ", domain == PF_INET ? "PF_INET" : "UNKNOWN", protocol));
-    break;
-  case SOCK_STREAM:
-    conn = netconn_new_with_callback(NETCONN_TCP, event_callback);
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_socket(%s, SOCK_STREAM, %d) = ", domain == PF_INET ? "PF_INET" : "UNKNOWN", protocol));
-    break;
-  default:
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_socket(%d, %d/UNKNOWN, %d) = -1\n", domain, type, protocol));
-    set_errno(EINVAL);
-    return -1;
-  }
-
-  if (!conn) {
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("-1 / ENOBUFS (could not create netconn)\n"));
-    set_errno(ENOBUFS);
-    return -1;
-  }
-
-  i = alloc_socket(conn);
-
-  if (i == -1) {
-    netconn_delete(conn);
-  set_errno(ENOBUFS);
-  return -1;
-  }
-  conn->socket = i;
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("%d\n", i));
-  set_errno(0);
-  return i;
-}
-
-int
-lwip_write(int s, void *data, int size)
-{
-   return lwip_send(s, data, size, 0);
-}
-
-
-static int
-lwip_selscan(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset)
-{
-    int i, nready = 0;
-    fd_set lreadset, lwriteset, lexceptset;
-    struct lwip_socket *p_sock;
-
-    FD_ZERO(&lreadset);
-    FD_ZERO(&lwriteset);
-    FD_ZERO(&lexceptset);
-
-    /* Go through each socket in each list to count number of sockets which
-       currently match */
-    for(i = 0; i < maxfdp1; i++)
-    {
-        if (FD_ISSET(i, readset))
-        {
-            /* See if netconn of this socket is ready for read */
-            p_sock = get_socket(i);
-            if (p_sock && (p_sock->lastdata || p_sock->rcvevent))
-            {
-                FD_SET(i, &lreadset);
-		LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_selscan: fd=%d ready for reading\n", i));
-                nready++;
-            }
-        }
-        if (FD_ISSET(i, writeset))
-        {
-            /* See if netconn of this socket is ready for write */
-            p_sock = get_socket(i);
-            if (p_sock && p_sock->sendevent)
-            {
-                FD_SET(i, &lwriteset);
-		LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_selscan: fd=%d ready for writing\n", i));
-                nready++;
-            }
-        }
-    }
-    *readset = lreadset;
-    *writeset = lwriteset;
-    FD_ZERO(exceptset);
-
-    return nready;
-}
-
-
-
-int
-lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
-               struct timeval *timeout)
-{
-    int i;
-    int nready;
-    fd_set lreadset, lwriteset, lexceptset;
-    u32_t msectimeout;
-    struct lwip_select_cb select_cb;
-    struct lwip_select_cb *p_selcb;
-
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select(%d, %p, %p, %p, tvsec=%ld tvusec=%ld)\n", maxfdp1, (void *)readset, (void *) writeset, (void *) exceptset, timeout ? timeout->tv_sec : -1L, timeout ? timeout->tv_usec : -1L));
-
-    select_cb.next = 0;
-    select_cb.readset = readset;
-    select_cb.writeset = writeset;
-    select_cb.exceptset = exceptset;
-    select_cb.sem_signalled = 0;
-
-    /* Protect ourselves searching through the list */
-    if (!selectsem)
-        selectsem = sys_sem_new(1);
-    sys_sem_wait(selectsem);
-
-    if (readset)
-        lreadset = *readset;
-    else
-        FD_ZERO(&lreadset);
-    if (writeset)
-        lwriteset = *writeset;
-    else
-        FD_ZERO(&lwriteset);
-    if (exceptset)
-        lexceptset = *exceptset;
-    else
-        FD_ZERO(&lexceptset);
-
-    /* Go through each socket in each list to count number of sockets which
-       currently match */
-    nready = lwip_selscan(maxfdp1, &lreadset, &lwriteset, &lexceptset);
-
-    /* If we don't have any current events, then suspend if we are supposed to */
-    if (!nready)
-    {
-        if (timeout && timeout->tv_sec == 0 && timeout->tv_usec == 0)
-        {
-            sys_sem_signal(selectsem);
-            if (readset)
-                FD_ZERO(readset);
-            if (writeset)
-                FD_ZERO(writeset);
-            if (exceptset)
-                FD_ZERO(exceptset);
-
-	    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select: no timeout, returning 0\n"));
-	    set_errno(0);
-
-            return 0;
-        }
-
-        /* add our semaphore to list */
-        /* We don't actually need any dynamic memory. Our entry on the
-         * list is only valid while we are in this function, so it's ok
-         * to use local variables */
-
-        select_cb.sem = sys_sem_new(0);
-        /* Note that we are still protected */
-        /* Put this select_cb on top of list */
-        select_cb.next = select_cb_list;
-        select_cb_list = &select_cb;
-
-        /* Now we can safely unprotect */
-        sys_sem_signal(selectsem);
-
-        /* Now just wait to be woken */
-        if (timeout == 0)
-            /* Wait forever */
-            msectimeout = 0;
-        else
-            msectimeout =  ((timeout->tv_sec * 1000) + ((timeout->tv_usec + 500)/1000));
-
-        i = sys_sem_wait_timeout(select_cb.sem, msectimeout);
-
-        /* Take us off the list */
-        sys_sem_wait(selectsem);
-        if (select_cb_list == &select_cb)
-            select_cb_list = select_cb.next;
-        else
-            for (p_selcb = select_cb_list; p_selcb; p_selcb = p_selcb->next)
-                if (p_selcb->next == &select_cb)
-                {
-                    p_selcb->next = select_cb.next;
-                    break;
-                }
-
-        sys_sem_signal(selectsem);
-
-        sys_sem_free(select_cb.sem);
-        if (i == 0)             /* Timeout */
-        {
-            if (readset)
-                FD_ZERO(readset);
-            if (writeset)
-                FD_ZERO(writeset);
-            if (exceptset)
-                FD_ZERO(exceptset);
-
-	    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select: timeout expired\n"));
-	    set_errno(0);
-
-            return 0;
-        }
-
-        if (readset)
-            lreadset = *readset;
-        else
-            FD_ZERO(&lreadset);
-        if (writeset)
-            lwriteset = *writeset;
-        else
-            FD_ZERO(&lwriteset);
-        if (exceptset)
-            lexceptset = *exceptset;
-        else
-            FD_ZERO(&lexceptset);
-
-        /* See what's set */
-        nready = lwip_selscan(maxfdp1, &lreadset, &lwriteset, &lexceptset);
-    }
-    else
-        sys_sem_signal(selectsem);
-
-    if (readset)
-        *readset = lreadset;
-    if (writeset)
-        *writeset = lwriteset;
-    if (exceptset)
-        *exceptset = lexceptset;
-
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select: nready=%d\n", nready));
-    set_errno(0);
-
-    return nready;
-}
-
-
-static void
-event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
-{
-    int s;
-    struct lwip_socket *sock;
-    struct lwip_select_cb *scb;
-
-    /* Get socket */
-    if (conn)
-    {
-        s = conn->socket;
-        if (s < 0)
-        {
-            /* Data comes in right away after an accept, even though
-             * the server task might not have created a new socket yet.
-             * Just count down (or up) if that's the case and we
-             * will use the data later. Note that only receive events
-             * can happen before the new socket is set up. */
-            if (evt == NETCONN_EVT_RCVPLUS)
-                conn->socket--;
-            return;
-        }
-
-        sock = get_socket(s);
-        if (!sock)
-            return;
-    }
-    else
-        return;
-
-    if (!selectsem)
-        selectsem = sys_sem_new(1);
-
-    sys_sem_wait(selectsem);
-    /* Set event as required */
-    switch (evt)
-    {
-      case NETCONN_EVT_RCVPLUS:
-        sock->rcvevent++;
-        break;
-      case NETCONN_EVT_RCVMINUS:
-        sock->rcvevent--;
-        break;
-      case NETCONN_EVT_SENDPLUS:
-        sock->sendevent = 1;
-        break;
-      case NETCONN_EVT_SENDMINUS:
-        sock->sendevent = 0;
-        break;
-    }
-    sys_sem_signal(selectsem);
-
-    /* Now decide if anyone is waiting for this socket */
-    /* NOTE: This code is written this way to protect the select link list
-       but to avoid a deadlock situation by releasing socksem before
-       signalling for the select. This means we need to go through the list
-       multiple times ONLY IF a select was actually waiting. We go through
-       the list the number of waiting select calls + 1. This list is
-       expected to be small. */
-    while (1)
-    {
-        sys_sem_wait(selectsem);
-        for (scb = select_cb_list; scb; scb = scb->next)
-        {
-            if (scb->sem_signalled == 0)
-            {
-                /* Test this select call for our socket */
-                if (scb->readset && FD_ISSET(s, scb->readset))
-                    if (sock->rcvevent)
-                        break;
-                if (scb->writeset && FD_ISSET(s, scb->writeset))
-                    if (sock->sendevent)
-                        break;
-            }
-        }
-        if (scb)
-        {
-            scb->sem_signalled = 1;
-            sys_sem_signal(selectsem);
-            sys_sem_signal(scb->sem);
-        } else {
-            sys_sem_signal(selectsem);
-            break;
-        }
-    }
-
-}
-
-
-
-
-int lwip_shutdown(int s, int how)
-{
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_shutdown(%d, how=%d)\n", s, how));
-  return lwip_close(s); /* XXX temporary hack until proper implementation */
-}
-
-int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen)
-{
-  struct lwip_socket *sock;
-  struct sockaddr_in sin;
-  struct ip_addr naddr;
-
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  memset(&sin, 0, sizeof(sin));
-  sin.sin_len = sizeof(sin);
-  sin.sin_family = AF_INET;
-
-  /* get the IP address and port of the remote host */
-  netconn_peer(sock->conn, &naddr, &sin.sin_port);
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getpeername(%d, addr=", s));
-  ip_addr_debug_print(SOCKETS_DEBUG, &naddr);
-  LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%d)\n", sin.sin_port));
-
-  sin.sin_port = htons(sin.sin_port);
-  sin.sin_addr.s_addr = naddr.addr;
-
-  if (*namelen > (socklen_t)sizeof(sin))
-      *namelen = sizeof(sin);
-
-  memcpy(name, &sin, *namelen);
-  sock_set_errno(sock, 0);
-  return 0;
-}
-
-int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen)
-{
-  struct lwip_socket *sock;
-  struct sockaddr_in sin;
-  struct ip_addr *naddr;
-
-  sock = get_socket(s);
-  if (!sock) {
-    set_errno(EBADF);
-    return -1;
-  }
-
-  memset(&sin, 0, sizeof(sin));
-  sin.sin_len = sizeof(sin);
-  sin.sin_family = AF_INET;
-
-  /* get the IP address and port of the remote host */
-  netconn_addr(sock->conn, &naddr, &sin.sin_port);
-
-  LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockname(%d, addr=", s));
-  ip_addr_debug_print(SOCKETS_DEBUG, naddr);
-  LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%d)\n", sin.sin_port));
-
-  sin.sin_port = htons(sin.sin_port);
-  sin.sin_addr.s_addr = naddr->addr;
-
-  if (*namelen > (socklen_t)sizeof(sin))
-      *namelen = sizeof(sin);
-
-  memcpy(name, &sin, *namelen);
-  sock_set_errno(sock, 0);
-  return 0;
-}
-
-int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen)
-{
-  int err = 0;
-  struct lwip_socket *sock = get_socket(s);
-
-  if(!sock) {
-   	set_errno(EBADF);
-    return -1;
-  }
-
-  if( NULL == optval || NULL == optlen ) {
-    sock_set_errno( sock, EFAULT );
-    return -1;
-  }
-
-  /* Do length and type checks for the various options first, to keep it readable. */
-  switch( level ) {
-
-/* Level: SOL_SOCKET */
-  case SOL_SOCKET:
-      switch(optname) {
-
-      case SO_ACCEPTCONN:
-      case SO_BROADCAST:
-      /* UNIMPL case SO_DEBUG: */
-      /* UNIMPL case SO_DONTROUTE: */
-      case SO_ERROR:
-      case SO_KEEPALIVE:
-      /* UNIMPL case SO_OOBINLINE: */
-      /* UNIMPL case SO_RCVBUF: */
-      /* UNIMPL case SO_SNDBUF: */
-      /* UNIMPL case SO_RCVLOWAT: */
-      /* UNIMPL case SO_SNDLOWAT: */
-#if SO_REUSE
-      case SO_REUSEADDR:
-      case SO_REUSEPORT:
-#endif /* SO_REUSE */
-      case SO_TYPE:
-      /* UNIMPL case SO_USELOOPBACK: */
-        if( *optlen < (socklen_t)sizeof(int) ) {
-          err = EINVAL;
-        }
-          break;
-
-      default:
-        LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, UNIMPL: optname=0x%x, ..)\n", s, optname));
-        err = ENOPROTOOPT;
-      }  /* switch */
-      break;
-
-/* Level: IPPROTO_IP */
-  case IPPROTO_IP:
-      switch(optname) {
-      /* UNIMPL case IP_HDRINCL: */
-      /* UNIMPL case IP_RCVDSTADDR: */
-      /* UNIMPL case IP_RCVIF: */
-      case IP_TTL:
-      case IP_TOS:
-        if( *optlen < (socklen_t)sizeof(int) ) {
-          err = EINVAL;
-        }
-        break;
-
-      default:
-        LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, UNIMPL: optname=0x%x, ..)\n", s, optname));
-        err = ENOPROTOOPT;
-      }  /* switch */
-      break;
-
-/* Level: IPPROTO_TCP */
-  case IPPROTO_TCP:
-      if( *optlen < (socklen_t)sizeof(int) ) {
-        err = EINVAL;
-        break;
-    }
-
-      /* If this is no TCP socket, ignore any options. */
-      if ( sock->conn->type != NETCONN_TCP ) return 0;
-
-      switch( optname ) {
-      case TCP_NODELAY:
-      case TCP_KEEPALIVE:
-        break;
-
-      default:
-        LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_TCP, UNIMPL: optname=0x%x, ..)\n", s, optname));
-        err = ENOPROTOOPT;
-      }  /* switch */
-      break;
-
-/* UNDEFINED LEVEL */
-  default:
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, level=0x%x, UNIMPL: optname=0x%x, ..)\n", s, level, optname));
-      err = ENOPROTOOPT;
-  }  /* switch */
-
-
-  if( 0 != err ) {
-    sock_set_errno(sock, err);
-    return -1;
-  }
-
-
-
-  /* Now do the actual option processing */
-
-  switch(level) {
-
-/* Level: SOL_SOCKET */
-  case SOL_SOCKET:
-    switch( optname ) {
-
-    /* The option flags */
-    case SO_ACCEPTCONN:
-    case SO_BROADCAST:
-    /* UNIMPL case SO_DEBUG: */
-    /* UNIMPL case SO_DONTROUTE: */
-    case SO_KEEPALIVE:
-    /* UNIMPL case SO_OOBINCLUDE: */
-#if SO_REUSE
-    case SO_REUSEADDR:
-    case SO_REUSEPORT:
-#endif /* SO_REUSE */
-    /*case SO_USELOOPBACK: UNIMPL */
-      *(int*)optval = sock->conn->pcb.tcp->so_options & optname;
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, optname=0x%x, ..) = %s\n", s, optname, (*(int*)optval?"on":"off")));
-      break;
-
-    case SO_TYPE:
-      switch (sock->conn->type) {
-      case NETCONN_RAW:
-        *(int*)optval = SOCK_RAW;
-        break;
-      case NETCONN_TCP:
-        *(int*)optval = SOCK_STREAM;
-        break;
-      case NETCONN_UDP:
-      case NETCONN_UDPLITE:
-      case NETCONN_UDPNOCHKSUM:
-        *(int*)optval = SOCK_DGRAM;
-        break;
-      default: /* unrecognized socket type */
-        *(int*)optval = sock->conn->type;
-        LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, SO_TYPE): unrecognized socket type %d\n", s, *(int *)optval));
-      }  /* switch */
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, SO_TYPE) = %d\n", s, *(int *)optval));
-      break;
-
-    case SO_ERROR:
-      *(int *)optval = sock->err;
-      sock->err = 0;
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, SO_ERROR) = %d\n", s, *(int *)optval));
-      break;
-    }  /* switch */
-    break;
-
-/* Level: IPPROTO_IP */
-  case IPPROTO_IP:
-    switch( optname ) {
-    case IP_TTL:
-      *(int*)optval = sock->conn->pcb.tcp->ttl;
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_TTL) = %d\n", s, *(int *)optval));
-      break;
-    case IP_TOS:
-      *(int*)optval = sock->conn->pcb.tcp->tos;
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_TOS) = %d\n", s, *(int *)optval));
-      break;
-    }  /* switch */
-    break;
-
-/* Level: IPPROTO_TCP */
-  case IPPROTO_TCP:
-    switch( optname ) {
-    case TCP_NODELAY:
-      *(int*)optval = (sock->conn->pcb.tcp->flags & TF_NODELAY);
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_TCP, TCP_NODELAY) = %s\n", s, (*(int*)optval)?"on":"off") );
-      break;
-    case TCP_KEEPALIVE:
-      *(int*)optval = (int)sock->conn->pcb.tcp->keepalive;
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, TCP_KEEPALIVE) = %d\n", s, *(int *)optval));
-      break;
-    }  /* switch */
-    break;
-  }
-
-
-  sock_set_errno(sock, err);
-  return err ? -1 : 0;
-}
-
-int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen)
-{
-  struct lwip_socket *sock = get_socket(s);
-  int err = 0;
-
-  if(!sock) {
-   	set_errno(EBADF);
-    return -1;
-  }
-
-  if( NULL == optval ) {
-    sock_set_errno( sock, EFAULT );
-    return -1;
-  }
-
-
-  /* Do length and type checks for the various options first, to keep it readable. */
-  switch( level ) {
-
-/* Level: SOL_SOCKET */
-  case SOL_SOCKET:
-    switch(optname) {
-
-    case SO_BROADCAST:
-    /* UNIMPL case SO_DEBUG: */
-    /* UNIMPL case SO_DONTROUTE: */
-    case SO_KEEPALIVE:
-    /* UNIMPL case SO_OOBINLINE: */
-    /* UNIMPL case SO_RCVBUF: */
-    /* UNIMPL case SO_SNDBUF: */
-    /* UNIMPL case SO_RCVLOWAT: */
-    /* UNIMPL case SO_SNDLOWAT: */
-#if SO_REUSE
-    case SO_REUSEADDR:
-    case SO_REUSEPORT:
-#endif /* SO_REUSE */
-    /* UNIMPL case SO_USELOOPBACK: */
-      if( optlen < (socklen_t)sizeof(int) ) {
-        err = EINVAL;
-      }
-      break;
-    default:
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, SOL_SOCKET, UNIMPL: optname=0x%x, ..)\n", s, optname));
-      err = ENOPROTOOPT;
-    }  /* switch */
-    break;
-
-/* Level: IPPROTO_IP */
-  case IPPROTO_IP:
-    switch(optname) {
-    /* UNIMPL case IP_HDRINCL: */
-    /* UNIMPL case IP_RCVDSTADDR: */
-    /* UNIMPL case IP_RCVIF: */
-    case IP_TTL:
-    case IP_TOS:
-      if( optlen < (socklen_t)sizeof(int) ) {
-        err = EINVAL;
-      }
-        break;
-      default:
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, UNIMPL: optname=0x%x, ..)\n", s, optname));
-      err = ENOPROTOOPT;
-    }  /* switch */
-    break;
-
-/* Level: IPPROTO_TCP */
-  case IPPROTO_TCP:
-    if( optlen < (socklen_t)sizeof(int) ) {
-      err = EINVAL;
-        break;
-    }
-
-    /* If this is no TCP socket, ignore any options. */
-    if ( sock->conn->type != NETCONN_TCP ) return 0;
-
-    switch( optname ) {
-    case TCP_NODELAY:
-    case TCP_KEEPALIVE:
-      break;
-
-    default:
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, UNIMPL: optname=0x%x, ..)\n", s, optname));
-      err = ENOPROTOOPT;
-    }  /* switch */
-    break;
-
-/* UNDEFINED LEVEL */
-  default:
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, level=0x%x, UNIMPL: optname=0x%x, ..)\n", s, level, optname));
-    err = ENOPROTOOPT;
-  }  /* switch */
-
-
-  if( 0 != err ) {
-    sock_set_errno(sock, err);
-    return -1;
-  }
-
-
-
-  /* Now do the actual option processing */
-
-  switch(level) {
-
-/* Level: SOL_SOCKET */
-  case SOL_SOCKET:
-    switch(optname) {
-
-    /* The option flags */
-    case SO_BROADCAST:
-    /* UNIMPL case SO_DEBUG: */
-    /* UNIMPL case SO_DONTROUTE: */
-    case SO_KEEPALIVE:
-    /* UNIMPL case SO_OOBINCLUDE: */
-#if SO_REUSE
-    case SO_REUSEADDR:
-    case SO_REUSEPORT:
-#endif /* SO_REUSE */
-    /* UNIMPL case SO_USELOOPBACK: */
-      if ( *(int*)optval ) {
-        sock->conn->pcb.tcp->so_options |= optname;
-      } else {
-        sock->conn->pcb.tcp->so_options &= ~optname;
-      }
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, SOL_SOCKET, optname=0x%x, ..) -> %s\n", s, optname, (*(int*)optval?"on":"off")));
-      break;
-    }  /* switch */
-    break;
-
-/* Level: IPPROTO_IP */
-  case IPPROTO_IP:
-    switch( optname ) {
-    case IP_TTL:
-      sock->conn->pcb.tcp->ttl = (u8_t)(*(int*)optval);
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, IP_TTL, ..) -> %u\n", s, sock->conn->pcb.tcp->ttl));
-      break;
-    case IP_TOS:
-      sock->conn->pcb.tcp->tos = (u8_t)(*(int*)optval);
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, IP_TOS, ..)-> %u\n", s, sock->conn->pcb.tcp->tos));
-      break;
-    }  /* switch */
-    break;
-
-/* Level: IPPROTO_TCP */
-  case IPPROTO_TCP:
-    switch( optname ) {
-    case TCP_NODELAY:
-      if ( *(int*)optval ) {
-        sock->conn->pcb.tcp->flags |= TF_NODELAY;
-      } else {
-        sock->conn->pcb.tcp->flags &= ~TF_NODELAY;
-      }
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, TCP_NODELAY) -> %s\n", s, (*(int *)optval)?"on":"off") );
-      break;
-    case TCP_KEEPALIVE:
-      sock->conn->pcb.tcp->keepalive = (u32_t)(*(int*)optval);
-      LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, TCP_KEEPALIVE) -> %lu\n", s, sock->conn->pcb.tcp->keepalive));
-      break;
-    }  /* switch */
-    break;
-  }  /* switch */
-
-  sock_set_errno(sock, err);
-  return err ? -1 : 0;
-}
-
-int lwip_ioctl(int s, long cmd, void *argp)
-{
-  struct lwip_socket *sock = get_socket(s);
-
-  if(!sock) {
-   	set_errno(EBADF);
-    return -1;
-  }
-
-  switch (cmd) {
-  case FIONREAD:
-    if (!argp) {
-      sock_set_errno(sock, EINVAL);
-      return -1;
-    }
-
-    *((u16_t*)argp) = sock->conn->recv_avail;
-
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_ioctl(%d, FIONREAD, %p) = %u\n", s, argp, *((u16_t*)argp)));
-    sock_set_errno(sock, 0);
-    return 0;
-
-  case FIONBIO:
-    if (argp && *(u32_t*)argp)
-      sock->flags |= O_NONBLOCK;
-    else
-      sock->flags &= ~O_NONBLOCK;
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_ioctl(%d, FIONBIO, %d)\n", s, !!(sock->flags & O_NONBLOCK)));
-    sock_set_errno(sock, 0);
-    return 0;
-
-  default:
-    LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_ioctl(%d, UNIMPL: 0x%lx, %p)\n", s, cmd, argp));
-    sock_set_errno(sock, ENOSYS); /* not yet implemented */
-    return -1;
-  }
-}
-
diff --git a/src/VBox/Devices/Network/lwip/src/api/tcpip.c b/src/VBox/Devices/Network/lwip/src/api/tcpip.c
deleted file mode 100644
index 8dc2e10..0000000
--- a/src/VBox/Devices/Network/lwip/src/api/tcpip.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/opt.h"
-
-#include "lwip/sys.h"
-
-#include "lwip/memp.h"
-#include "lwip/pbuf.h"
-
-#include "lwip/ip.h"
-#include "lwip/ip_frag.h"
-#include "lwip/udp.h"
-#include "lwip/tcp.h"
-
-#include "lwip/tcpip.h"
-
-static void (* tcpip_init_done)(void *arg) = NULL;
-static void *tcpip_init_done_arg;
-static sys_mbox_t mbox;
-
-#if LWIP_TCP
-static int tcpip_tcp_timer_active = 0;
-
-static void
-tcpip_tcp_timer(void *arg)
-{
-  (void)arg;
-
-  /* call TCP timer handler */
-  tcp_tmr();
-  /* timer still needed? */
-  if (tcp_active_pcbs || tcp_tw_pcbs) {
-    /* restart timer */
-    sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
-  } else {
-    /* disable timer */
-    tcpip_tcp_timer_active = 0;
-  }
-}
-
-#if !NO_SYS
-void
-tcp_timer_needed(void)
-{
-  /* timer is off but needed again? */
-  if (!tcpip_tcp_timer_active && (tcp_active_pcbs || tcp_tw_pcbs)) {
-    /* enable and start timer */
-    tcpip_tcp_timer_active = 1;
-    sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
-  }
-}
-#endif /* !NO_SYS */
-#endif /* LWIP_TCP */
-
-#if IP_REASSEMBLY
-static void
-ip_timer(void *data)
-{
-  LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip: ip_reass_tmr()\n"));
-  ip_reass_tmr();
-  sys_timeout(1000, ip_timer, NULL);
-}
-#endif
-
-static void
-tcpip_thread(void *arg)
-{
-  struct tcpip_msg *msg;
-
-  (void)arg;
-
-  ip_init();
-#if LWIP_UDP  
-  udp_init();
-#endif
-#if LWIP_TCP
-  tcp_init();
-#endif
-#if IP_REASSEMBLY
-  sys_timeout(1000, ip_timer, NULL);
-#endif
-  if (tcpip_init_done != NULL) {
-    tcpip_init_done(tcpip_init_done_arg);
-  }
-
-  while (1) {                          /* MAIN Loop */
-    sys_mbox_fetch(mbox, (void *)&msg);
-    switch (msg->type) {
-    case TCPIP_MSG_API:
-      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg));
-      api_msg_input(msg->msg.apimsg);
-      break;
-    case TCPIP_MSG_INPUT:
-      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p\n", (void *)msg));
-      ip_input(msg->msg.inp.p, msg->msg.inp.netif);
-      break;
-    case TCPIP_MSG_CALLBACK:
-      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg));
-      msg->msg.cb.f(msg->msg.cb.ctx);
-      break;
-    default:
-      break;
-    }
-#ifdef VBOX
-    if (msg->type == TCPIP_MSG_TERM)
-    {
-        memp_free(MEMP_TCPIP_MSG, msg);
-        break;
-    }
-#endif
-    memp_free(MEMP_TCPIP_MSG, msg);
-  }
-#ifdef VBOX
-  if (tcpip_init_done != NULL) {
-    tcpip_init_done(tcpip_init_done_arg);
-  }
-#endif
-}
-
-err_t
-tcpip_input(struct pbuf *p, struct netif *inp)
-{
-  struct tcpip_msg *msg;
-  
-  msg = memp_malloc(MEMP_TCPIP_MSG);
-  if (msg == NULL) {
-    pbuf_free(p);    
-    return ERR_MEM;  
-  }
-  
-  msg->type = TCPIP_MSG_INPUT;
-  msg->msg.inp.p = p;
-  msg->msg.inp.netif = inp;
-  sys_mbox_post(mbox, msg);
-  return ERR_OK;
-}
-
-err_t
-tcpip_callback(void (*f)(void *ctx), void *ctx)
-{
-  struct tcpip_msg *msg;
-  
-  msg = memp_malloc(MEMP_TCPIP_MSG);
-  if (msg == NULL) {
-    return ERR_MEM;  
-  }
-  
-  msg->type = TCPIP_MSG_CALLBACK;
-  msg->msg.cb.f = f;
-  msg->msg.cb.ctx = ctx;
-  sys_mbox_post(mbox, msg);
-  return ERR_OK;
-}
-
-void
-tcpip_apimsg(struct api_msg *apimsg)
-{
-  struct tcpip_msg *msg;
-  msg = memp_malloc(MEMP_TCPIP_MSG);
-  if (msg == NULL) {
-    memp_free(MEMP_API_MSG, apimsg);
-    return;
-  }
-  msg->type = TCPIP_MSG_API;
-  msg->msg.apimsg = apimsg;
-  sys_mbox_post(mbox, msg);
-}
-
-#ifdef VBOX
-void
-tcpip_terminate(void)
-{
-  struct tcpip_msg *msg;
-  msg = memp_malloc(MEMP_TCPIP_MSG);
-  if (msg == NULL) {
-    return;
-  }
-  msg->type = TCPIP_MSG_TERM;
-  sys_mbox_post(mbox, msg);
-}
-#endif
-
-void
-tcpip_init(void (* initfunc)(void *), void *arg)
-{
-  tcpip_init_done = initfunc;
-  tcpip_init_done_arg = arg;
-  mbox = sys_mbox_new();
-  sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
-}
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/dhcp.c b/src/VBox/Devices/Network/lwip/src/core/dhcp.c
deleted file mode 100644
index 2dabd4f..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/dhcp.c
+++ /dev/null
@@ -1,1464 +0,0 @@
-/**
- * @file
- *
- * Dynamic Host Configuration Protocol client
- */
-
-/*
- *
- * Copyright (c) 2001-2004 Leon Woestenberg <leon.woestenberg at gmx.net>
- * Copyright (c) 2001-2004 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is a contribution to the lwIP TCP/IP stack.
- * The Swedish Institute of Computer Science and Adam Dunkels
- * are specifically granted permission to redistribute this
- * source code.
- *
- * Author: Leon Woestenberg <leon.woestenberg at gmx.net>
- *
- * This is a DHCP client for the lwIP TCP/IP stack. It aims to conform
- * with RFC 2131 and RFC 2132.
- *
- * TODO:
- * - Proper parsing of DHCP messages exploiting file/sname field overloading.
- * - Add JavaDoc style documentation (API, internals).
- * - Support for interfaces other than Ethernet (SLIP, PPP, ...)
- *
- * Please coordinate changes and requests with Leon Woestenberg
- * <leon.woestenberg at gmx.net>
- *
- * Integration with your code:
- *
- * In lwip/dhcp.h
- * #define DHCP_COARSE_TIMER_SECS (recommended 60 which is a minute)
- * #define DHCP_FINE_TIMER_MSECS (recommended 500 which equals TCP coarse timer)
- *
- * Then have your application call dhcp_coarse_tmr() and
- * dhcp_fine_tmr() on the defined intervals.
- *
- * dhcp_start(struct netif *netif);
- * starts a DHCP client instance which configures the interface by
- * obtaining an IP address lease and maintaining it.
- *
- * Use dhcp_release(netif) to end the lease and use dhcp_stop(netif)
- * to remove the DHCP client.
- *
- */
- 
-#include <string.h>
- 
-#include "lwip/stats.h"
-#include "lwip/mem.h"
-#include "lwip/udp.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-#include "lwip/inet.h"
-#include "netif/etharp.h"
-
-#include "lwip/sys.h"
-#include "lwip/opt.h"
-#include "lwip/dhcp.h"
-
-#if LWIP_DHCP /* don't build if not configured for use in lwipopt.h */
-
-/** global transaction identifier, must be
- *  unique for each DHCP request. We simply increment, starting
- *  with this value (easy to match with a packet analyzer) */
-static u32_t xid = 0xABCD0000;
-
-/** DHCP client state machine functions */
-static void dhcp_handle_ack(struct netif *netif);
-static void dhcp_handle_nak(struct netif *netif);
-static void dhcp_handle_offer(struct netif *netif);
-
-static err_t dhcp_discover(struct netif *netif);
-static err_t dhcp_select(struct netif *netif);
-static void dhcp_check(struct netif *netif);
-static void dhcp_bind(struct netif *netif);
-static err_t dhcp_decline(struct netif *netif);
-static err_t dhcp_rebind(struct netif *netif);
-static void dhcp_set_state(struct dhcp *dhcp, u8_t new_state);
-
-/** receive, unfold, parse and free incoming messages */
-static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port);
-static err_t dhcp_unfold_reply(struct dhcp *dhcp);
-static u8_t *dhcp_get_option_ptr(struct dhcp *dhcp, u8_t option_type);
-static u8_t dhcp_get_option_byte(u8_t *ptr);
-#if 0
-static u16_t dhcp_get_option_short(u8_t *ptr);
-#endif
-static u32_t dhcp_get_option_long(u8_t *ptr);
-static void dhcp_free_reply(struct dhcp *dhcp);
-
-/** set the DHCP timers */
-static void dhcp_timeout(struct netif *netif);
-static void dhcp_t1_timeout(struct netif *netif);
-static void dhcp_t2_timeout(struct netif *netif);
-
-/** build outgoing messages */
-/** create a DHCP request, fill in common headers */
-static err_t dhcp_create_request(struct netif *netif);
-/** free a DHCP request */
-static void dhcp_delete_request(struct netif *netif);
-/** add a DHCP option (type, then length in bytes) */
-static void dhcp_option(struct dhcp *dhcp, u8_t option_type, u8_t option_len);
-/** add option values */
-static void dhcp_option_byte(struct dhcp *dhcp, u8_t value);
-static void dhcp_option_short(struct dhcp *dhcp, u16_t value);
-static void dhcp_option_long(struct dhcp *dhcp, u32_t value);
-/** always add the DHCP options trailer to end and pad */
-static void dhcp_option_trailer(struct dhcp *dhcp);
-
-/**
- * Back-off the DHCP client (because of a received NAK response).
- *
- * Back-off the DHCP client because of a received NAK. Receiving a
- * NAK means the client asked for something non-sensible, for
- * example when it tries to renew a lease obtained on another network.
- *
- * We back-off and will end up restarting a fresh DHCP negotiation later.
- *
- * @param state pointer to DHCP state structure
- */
-static void dhcp_handle_nak(struct netif *netif) {
-  struct dhcp *dhcp = netif->dhcp;
-  u16_t msecs = 10 * 1000;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_handle_nak(netif=%p) %c%c%"U16_F"\n", 
-    (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
-  dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_handle_nak(): set request timeout %"U16_F" msecs\n", msecs));
-  dhcp_set_state(dhcp, DHCP_BACKING_OFF);
-}
-
-/**
- * Checks if the offered IP address is already in use.
- *
- * It does so by sending an ARP request for the offered address and
- * entering CHECKING state. If no ARP reply is received within a small
- * interval, the address is assumed to be free for use by us.
- */
-static void dhcp_check(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  err_t result;
-  u16_t msecs;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_check(netif=%p) %c%c\n", (void *)netif, (s16_t)netif->name[0],
-    (s16_t)netif->name[1]));
-  /* create an ARP query for the offered IP address, expecting that no host
-     responds, as the IP address should not be in use. */
-  result = etharp_query(netif, &dhcp->offered_ip_addr, NULL);
-  if (result != ERR_OK) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_check: could not perform ARP query\n"));
-  }
-  dhcp->tries++;
-  msecs = 500;
-  dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_check(): set request timeout %"U16_F" msecs\n", msecs));
-  dhcp_set_state(dhcp, DHCP_CHECKING);
-}
-
-/**
- * Remember the configuration offered by a DHCP server.
- *
- * @param state pointer to DHCP state structure
- */
-static void dhcp_handle_offer(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  /* obtain the server address */
-  u8_t *option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_SERVER_ID);
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_handle_offer(netif=%p) %c%c%"U16_F"\n",
-    (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
-  if (option_ptr != NULL)
-  {
-    dhcp->server_ip_addr.addr = htonl(dhcp_get_option_long(&option_ptr[2]));
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_STATE, ("dhcp_handle_offer(): server 0x%08"X32_F"\n", dhcp->server_ip_addr.addr));
-    /* remember offered address */
-    ip_addr_set(&dhcp->offered_ip_addr, (struct ip_addr *)&dhcp->msg_in->yiaddr);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_STATE, ("dhcp_handle_offer(): offer for 0x%08"X32_F"\n", dhcp->offered_ip_addr.addr));
-
-    dhcp_select(netif);
-  }
-}
-
-/**
- * Select a DHCP server offer out of all offers.
- *
- * Simply select the first offer received.
- *
- * @param netif the netif under DHCP control
- * @return lwIP specific error (see error.h)
- */
-static err_t dhcp_select(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  err_t result;
-  u32_t msecs;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_select(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
-
-  /* create and initialize the DHCP message header */
-  result = dhcp_create_request(netif);
-  if (result == ERR_OK)
-  {
-    dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
-    dhcp_option_byte(dhcp, DHCP_REQUEST);
-
-    dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN);
-    dhcp_option_short(dhcp, 576);
-
-    /* MUST request the offered IP address */
-    dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4);
-    dhcp_option_long(dhcp, ntohl(dhcp->offered_ip_addr.addr));
-
-    dhcp_option(dhcp, DHCP_OPTION_SERVER_ID, 4);
-    dhcp_option_long(dhcp, ntohl(dhcp->server_ip_addr.addr));
-
-    dhcp_option(dhcp, DHCP_OPTION_PARAMETER_REQUEST_LIST, 4/*num options*/);
-    dhcp_option_byte(dhcp, DHCP_OPTION_SUBNET_MASK);
-    dhcp_option_byte(dhcp, DHCP_OPTION_ROUTER);
-    dhcp_option_byte(dhcp, DHCP_OPTION_BROADCAST);
-    dhcp_option_byte(dhcp, DHCP_OPTION_DNS_SERVER);
-
-    dhcp_option_trailer(dhcp);
-    /* shrink the pbuf to the actual content length */
-    pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
-
-    /* TODO: we really should bind to a specific local interface here
-       but we cannot specify an unconfigured netif as it is addressless */
-    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
-    /* send broadcast to any DHCP server */
-    udp_connect(dhcp->pcb, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
-    udp_send(dhcp->pcb, dhcp->p_out);
-    /* reconnect to any (or to server here?!) */
-    udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
-    dhcp_delete_request(netif);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_select: REQUESTING\n"));
-    dhcp_set_state(dhcp, DHCP_REQUESTING);
-  } else {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_select: could not allocate DHCP request\n"));
-  }
-  dhcp->tries++;
-  msecs = dhcp->tries < 4 ? dhcp->tries * 1000 : 4 * 1000;
-  dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_STATE, ("dhcp_select(): set request timeout %"U32_F" msecs\n", msecs));
-  return result;
-}
-
-/**
- * The DHCP timer that checks for lease renewal/rebind timeouts.
- *
- */
-void dhcp_coarse_tmr()
-{
-  struct netif *netif = netif_list;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_coarse_tmr()\n"));
-  /* iterate through all network interfaces */
-  while (netif != NULL) {
-    /* only act on DHCP configured interfaces */
-    if (netif->dhcp != NULL) {
-      /* timer is active (non zero), and triggers (zeroes) now? */
-      if (netif->dhcp->t2_timeout-- == 1) {
-        LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_coarse_tmr(): t2 timeout\n"));
-        /* this clients' rebind timeout triggered */
-        dhcp_t2_timeout(netif);
-      /* timer is active (non zero), and triggers (zeroes) now */
-      } else if (netif->dhcp->t1_timeout-- == 1) {
-        LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_coarse_tmr(): t1 timeout\n"));
-        /* this clients' renewal timeout triggered */
-        dhcp_t1_timeout(netif);
-      }
-    }
-    /* proceed to next netif */
-    netif = netif->next;
-  }
-}
-
-/**
- * DHCP transaction timeout handling
- *
- * A DHCP server is expected to respond within a short period of time.
- * This timer checks whether an outstanding DHCP request is timed out.
- * 
- */
-void dhcp_fine_tmr()
-{
-  struct netif *netif = netif_list;
-  /* loop through netif's */
-  while (netif != NULL) {
-    /* only act on DHCP configured interfaces */
-    if (netif->dhcp != NULL) {
-      /* timer is active (non zero), and is about to trigger now */      
-      if (netif->dhcp->request_timeout > 1) {
-        netif->dhcp->request_timeout--;
-      }
-      else if (netif->dhcp->request_timeout == 1) {
-        netif->dhcp->request_timeout--;
-        /* { netif->dhcp->request_timeout == 0 } */
-        LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_fine_tmr(): request timeout\n"));
-        /* this clients' request timeout triggered */
-        dhcp_timeout(netif);
-      }
-    }
-    /* proceed to next network interface */
-    netif = netif->next;
-  }
-}
-
-/**
- * A DHCP negotiation transaction, or ARP request, has timed out.
- *
- * The timer that was started with the DHCP or ARP request has
- * timed out, indicating no response was received in time.
- *
- * @param netif the netif under DHCP control
- *
- */
-static void dhcp_timeout(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_timeout()\n"));
-  /* back-off period has passed, or server selection timed out */
-  if ((dhcp->state == DHCP_BACKING_OFF) || (dhcp->state == DHCP_SELECTING)) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_timeout(): restarting discovery\n"));
-    dhcp_discover(netif);
-  /* receiving the requested lease timed out */
-  } else if (dhcp->state == DHCP_REQUESTING) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_timeout(): REQUESTING, DHCP request timed out\n"));
-    if (dhcp->tries <= 5) {
-      dhcp_select(netif);
-    } else {
-      LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_timeout(): REQUESTING, releasing, restarting\n"));
-      dhcp_release(netif);
-      dhcp_discover(netif);
-    }
-  /* received no ARP reply for the offered address (which is good) */
-  } else if (dhcp->state == DHCP_CHECKING) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_timeout(): CHECKING, ARP request timed out\n"));
-    if (dhcp->tries <= 1) {
-      dhcp_check(netif);
-    /* no ARP replies on the offered address,
-       looks like the IP address is indeed free */
-    } else {
-      /* bind the interface to the offered address */
-      dhcp_bind(netif);
-    }
-  }
-  /* did not get response to renew request? */
-  else if (dhcp->state == DHCP_RENEWING) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_timeout(): RENEWING, DHCP request timed out\n"));
-    /* just retry renewal */
-    /* note that the rebind timer will eventually time-out if renew does not work */
-    dhcp_renew(netif);
-  /* did not get response to rebind request? */
-  } else if (dhcp->state == DHCP_REBINDING) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_timeout(): REBINDING, DHCP request timed out\n"));
-    if (dhcp->tries <= 8) {
-      dhcp_rebind(netif);
-    } else {
-      LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_timeout(): RELEASING, DISCOVERING\n"));
-      dhcp_release(netif);
-      dhcp_discover(netif);
-    }
-  }
-}
-
-/**
- * The renewal period has timed out.
- *
- * @param netif the netif under DHCP control
- */
-static void dhcp_t1_timeout(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_STATE, ("dhcp_t1_timeout()\n"));
-  if ((dhcp->state == DHCP_REQUESTING) || (dhcp->state == DHCP_BOUND) || (dhcp->state == DHCP_RENEWING)) {
-    /* just retry to renew - note that the rebind timer (t2) will
-     * eventually time-out if renew tries fail. */
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_t1_timeout(): must renew\n"));
-    dhcp_renew(netif);
-  }
-}
-
-/**
- * The rebind period has timed out.
- *
- */
-static void dhcp_t2_timeout(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_t2_timeout()\n"));
-  if ((dhcp->state == DHCP_REQUESTING) || (dhcp->state == DHCP_BOUND) || (dhcp->state == DHCP_RENEWING)) {
-    /* just retry to rebind */
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_t2_timeout(): must rebind\n"));
-    dhcp_rebind(netif);
-  }
-}
-
-/**
- *
- * @param netif the netif under DHCP control
- */
-static void dhcp_handle_ack(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  u8_t *option_ptr;
-  /* clear options we might not get from the ACK */
-  dhcp->offered_sn_mask.addr = 0;
-  dhcp->offered_gw_addr.addr = 0;
-  dhcp->offered_bc_addr.addr = 0;
-
-  /* lease time given? */
-  option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_LEASE_TIME);
-  if (option_ptr != NULL) {
-    /* remember offered lease time */
-    dhcp->offered_t0_lease = dhcp_get_option_long(option_ptr + 2);
-  }
-  /* renewal period given? */
-  option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_T1);
-  if (option_ptr != NULL) {
-    /* remember given renewal period */
-    dhcp->offered_t1_renew = dhcp_get_option_long(option_ptr + 2);
-  } else {
-    /* calculate safe periods for renewal */
-    dhcp->offered_t1_renew = dhcp->offered_t0_lease / 2;
-  }
-
-  /* renewal period given? */
-  option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_T2);
-  if (option_ptr != NULL) {
-    /* remember given rebind period */
-    dhcp->offered_t2_rebind = dhcp_get_option_long(option_ptr + 2);
-  } else {
-    /* calculate safe periods for rebinding */
-    dhcp->offered_t2_rebind = dhcp->offered_t0_lease;
-  }
-
-  /* (y)our internet address */
-  ip_addr_set(&dhcp->offered_ip_addr, &dhcp->msg_in->yiaddr);
-
-/**
- * Patch #1308
- * TODO: we must check if the file field is not overloaded by DHCP options!
- */
-#if 0
-  /* boot server address */
-  ip_addr_set(&dhcp->offered_si_addr, &dhcp->msg_in->siaddr);
-  /* boot file name */
-  if (dhcp->msg_in->file[0]) {
-    dhcp->boot_file_name = mem_malloc(strlen(dhcp->msg_in->file) + 1);
-    strcpy(dhcp->boot_file_name, dhcp->msg_in->file);
-  }
-#endif
-
-  /* subnet mask */
-  option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_SUBNET_MASK);
-  /* subnet mask given? */
-  if (option_ptr != NULL) {
-    dhcp->offered_sn_mask.addr = htonl(dhcp_get_option_long(&option_ptr[2]));
-  }
-
-  /* gateway router */
-  option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_ROUTER);
-  if (option_ptr != NULL) {
-    dhcp->offered_gw_addr.addr = htonl(dhcp_get_option_long(&option_ptr[2]));
-  }
-
-  /* broadcast address */
-  option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_BROADCAST);
-  if (option_ptr != NULL) {
-    dhcp->offered_bc_addr.addr = htonl(dhcp_get_option_long(&option_ptr[2]));
-  }
-  
-  /* DNS servers */
-  option_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_DNS_SERVER);
-  if (option_ptr != NULL) {
-    u8_t n;
-    dhcp->dns_count = dhcp_get_option_byte(&option_ptr[1]) / (u32_t)sizeof(struct ip_addr);
-    /* limit to at most DHCP_MAX_DNS DNS servers */
-    if (dhcp->dns_count > DHCP_MAX_DNS)
-      dhcp->dns_count = DHCP_MAX_DNS;
-    for (n = 0; n < dhcp->dns_count; n++) {
-      dhcp->offered_dns_addr[n].addr = htonl(dhcp_get_option_long(&option_ptr[2 + n * 4]));
-    }
-  }
-}
-
-/**
- * Start DHCP negotiation for a network interface.
- *
- * If no DHCP client instance was attached to this interface,
- * a new client is created first. If a DHCP client instance
- * was already present, it restarts negotiation.
- *
- * @param netif The lwIP network interface
- * @return lwIP error code
- * - ERR_OK - No error
- * - ERR_MEM - Out of memory
- *
- */
-err_t dhcp_start(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  err_t result = ERR_OK;
-
-  LWIP_ASSERT("netif != NULL", netif != NULL);
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
-  netif->flags &= ~NETIF_FLAG_DHCP;
-
-  /* no DHCP client attached yet? */
-  if (dhcp == NULL) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_start(): starting new DHCP client\n"));
-    dhcp = mem_malloc(sizeof(struct dhcp));
-    if (dhcp == NULL) {
-      LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_start(): could not allocate dhcp\n"));
-      return ERR_MEM;
-    }
-    /* store this dhcp client in the netif */
-    netif->dhcp = dhcp;
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_start(): allocated dhcp"));
-  /* already has DHCP client attached */
-  } else {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE | 3, ("dhcp_start(): restarting DHCP configuration\n"));
-  }
-    
-  /* clear data structure */
-  memset(dhcp, 0, sizeof(struct dhcp));
-  /* allocate UDP PCB */
-  dhcp->pcb = udp_new();
-  if (dhcp->pcb == NULL) {
-    LWIP_DEBUGF(DHCP_DEBUG  | DBG_TRACE, ("dhcp_start(): could not obtain pcb\n"));
-    mem_free((void *)dhcp);
-    netif->dhcp = dhcp = NULL;
-    return ERR_MEM;
-  }
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_start(): starting DHCP configuration\n"));
-  /* (re)start the DHCP negotiation */
-  result = dhcp_discover(netif);
-  if (result != ERR_OK) {
-    /* free resources allocated above */
-    dhcp_stop(netif);
-    return ERR_MEM;
-  }
-  netif->flags |= NETIF_FLAG_DHCP;
-  return result;
-}
-
-/**
- * Inform a DHCP server of our manual configuration.
- *
- * This informs DHCP servers of our fixed IP address configuration
- * by sending an INFORM message. It does not involve DHCP address
- * configuration, it is just here to be nice to the network.
- *
- * @param netif The lwIP network interface
- *
- */
-void dhcp_inform(struct netif *netif)
-{
-  struct dhcp *dhcp;
-  err_t result = ERR_OK;
-  dhcp = mem_malloc(sizeof(struct dhcp));
-  if (dhcp == NULL) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_inform(): could not allocate dhcp\n"));
-    return;
-  }
-  netif->dhcp = dhcp;
-  memset(dhcp, 0, sizeof(struct dhcp));
-
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_inform(): allocated dhcp\n"));
-  dhcp->pcb = udp_new();
-  if (dhcp->pcb == NULL) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_inform(): could not obtain pcb"));
-    mem_free((void *)dhcp);
-    return;
-  }
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_inform(): created new udp pcb\n"));
-  /* create and initialize the DHCP message header */
-  result = dhcp_create_request(netif);
-  if (result == ERR_OK) {
-
-    dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
-    dhcp_option_byte(dhcp, DHCP_INFORM);
-
-    dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN);
-    /* TODO: use netif->mtu ?! */
-    dhcp_option_short(dhcp, 576);
-
-    dhcp_option_trailer(dhcp);
-
-    pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
-
-    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
-    udp_connect(dhcp->pcb, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_inform: INFORMING\n"));
-    udp_send(dhcp->pcb, dhcp->p_out);
-    udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
-    dhcp_delete_request(netif);
-  } else {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_inform: could not allocate DHCP request\n"));
-  }
-
-  if (dhcp != NULL)
-  {
-    if (dhcp->pcb != NULL) udp_remove(dhcp->pcb);
-    dhcp->pcb = NULL;
-    mem_free((void *)dhcp);
-    netif->dhcp = NULL;
-  }
-}
-
-#if DHCP_DOES_ARP_CHECK
-/**
- * Match an ARP reply with the offered IP address.
- *
- * @param addr The IP address we received a reply from
- *
- */
-void dhcp_arp_reply(struct netif *netif, struct ip_addr *addr)
-{
-  LWIP_ASSERT("netif != NULL", netif != NULL);
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_arp_reply()\n"));
-  /* is a DHCP client doing an ARP check? */
-  if ((netif->dhcp != NULL) && (netif->dhcp->state == DHCP_CHECKING)) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_arp_reply(): CHECKING, arp reply for 0x%08"X32_F"\n", addr->addr));
-    /* did a host respond with the address we
-       were offered by the DHCP server? */
-    if (ip_addr_cmp(addr, &netif->dhcp->offered_ip_addr)) {
-      /* we will not accept the offered address */
-      LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE | 1, ("dhcp_arp_reply(): arp reply matched with offered address, declining\n"));
-      dhcp_decline(netif);
-    }
-  }
-}
-
-/**
- * Decline an offered lease.
- *
- * Tell the DHCP server we do not accept the offered address.
- * One reason to decline the lease is when we find out the address
- * is already in use by another host (through ARP).
- */
-static err_t dhcp_decline(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  err_t result = ERR_OK;
-  u16_t msecs;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_decline()\n"));
-  dhcp_set_state(dhcp, DHCP_BACKING_OFF);
-  /* create and initialize the DHCP message header */
-  result = dhcp_create_request(netif);
-  if (result == ERR_OK)
-  {
-    dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
-    dhcp_option_byte(dhcp, DHCP_DECLINE);
-
-    dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN);
-    dhcp_option_short(dhcp, 576);
-
-    dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4);
-    dhcp_option_long(dhcp, ntohl(dhcp->offered_ip_addr.addr));
-
-    dhcp_option_trailer(dhcp);
-    /* resize pbuf to reflect true size of options */
-    pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
-
-    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
-    /* @todo: should we really connect here? we are performing sendto() */
-    udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
-    /* per section 4.4.4, broadcast DECLINE messages */
-    udp_sendto(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
-    dhcp_delete_request(netif);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_decline: BACKING OFF\n"));
-  } else {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_decline: could not allocate DHCP request\n"));
-  }
-  dhcp->tries++;
-  msecs = 10*1000;
-  dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS;
-   LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_decline(): set request timeout %"U16_F" msecs\n", msecs));
-  return result;
-}
-#endif
-
-
-/**
- * Start the DHCP process, discover a DHCP server.
- *
- */
-static err_t dhcp_discover(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  err_t result = ERR_OK;
-  u16_t msecs;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_discover()\n"));
-  ip_addr_set(&dhcp->offered_ip_addr, IP_ADDR_ANY);
-  /* create and initialize the DHCP message header */
-  result = dhcp_create_request(netif);
-  if (result == ERR_OK)
-  {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_discover: making request\n"));
-    dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
-    dhcp_option_byte(dhcp, DHCP_DISCOVER);
-
-    dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN);
-    dhcp_option_short(dhcp, 576);
-
-    dhcp_option(dhcp, DHCP_OPTION_PARAMETER_REQUEST_LIST, 4/*num options*/);
-    dhcp_option_byte(dhcp, DHCP_OPTION_SUBNET_MASK);
-    dhcp_option_byte(dhcp, DHCP_OPTION_ROUTER);
-    dhcp_option_byte(dhcp, DHCP_OPTION_BROADCAST);
-    dhcp_option_byte(dhcp, DHCP_OPTION_DNS_SERVER);
-
-    dhcp_option_trailer(dhcp);
-
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_discover: realloc()ing\n"));
-    pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
-
-    /* set receive callback function with netif as user data */
-    udp_recv(dhcp->pcb, dhcp_recv, netif);
-    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
-    udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)\n"));
-    udp_sendto(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_discover: deleting()ing\n"));
-    dhcp_delete_request(netif);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_discover: SELECTING\n"));
-    dhcp_set_state(dhcp, DHCP_SELECTING);
-  } else {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_discover: could not allocate DHCP request\n"));
-  }
-  dhcp->tries++;
-  msecs = dhcp->tries < 4 ? (dhcp->tries + 1) * 1000 : 10 * 1000;
-  dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_discover(): set request timeout %"U16_F" msecs\n", msecs));
-  return result;
-}
-
-
-/**
- * Bind the interface to the offered IP address.
- *
- * @param netif network interface to bind to the offered address
- */
-static void dhcp_bind(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  struct ip_addr sn_mask, gw_addr;
-  LWIP_ASSERT("dhcp_bind: netif != NULL", netif != NULL);
-  LWIP_ASSERT("dhcp_bind: dhcp != NULL", dhcp != NULL);
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_bind(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
-
-  /* temporary DHCP lease? */
-  if (dhcp->offered_t1_renew != 0xffffffffUL) {
-    /* set renewal period timer */
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_bind(): t1 renewal timer %"U32_F" secs\n", dhcp->offered_t1_renew));
-    dhcp->t1_timeout = (dhcp->offered_t1_renew + DHCP_COARSE_TIMER_SECS / 2) / DHCP_COARSE_TIMER_SECS;
-    if (dhcp->t1_timeout == 0) dhcp->t1_timeout = 1;
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_bind(): set request timeout %"U32_F" msecs\n", dhcp->offered_t1_renew*1000));
-  }
-  /* set renewal period timer */
-  if (dhcp->offered_t2_rebind != 0xffffffffUL) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_bind(): t2 rebind timer %"U32_F" secs\n", dhcp->offered_t2_rebind));
-    dhcp->t2_timeout = (dhcp->offered_t2_rebind + DHCP_COARSE_TIMER_SECS / 2) / DHCP_COARSE_TIMER_SECS;
-    if (dhcp->t2_timeout == 0) dhcp->t2_timeout = 1;
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_bind(): set request timeout %"U32_F" msecs\n", dhcp->offered_t2_rebind*1000));
-  }
-  /* copy offered network mask */
-  ip_addr_set(&sn_mask, &dhcp->offered_sn_mask);
-
-  /* subnet mask not given? */
-  /* TODO: this is not a valid check. what if the network mask is 0? */
-  if (sn_mask.addr == 0) {
-    /* choose a safe subnet mask given the network class */
-    u8_t first_octet = ip4_addr1(&sn_mask);
-    if (first_octet <= 127) sn_mask.addr = htonl(0xff000000);
-    else if (first_octet >= 192) sn_mask.addr = htonl(0xffffff00);
-    else sn_mask.addr = htonl(0xffff0000);
-  }
-
-  ip_addr_set(&gw_addr, &dhcp->offered_gw_addr);
-  /* gateway address not given? */
-  if (gw_addr.addr == 0) {
-    /* copy network address */
-    gw_addr.addr = (dhcp->offered_ip_addr.addr & sn_mask.addr);
-    /* use first host address on network as gateway */
-    gw_addr.addr |= htonl(0x00000001);
-  }
-
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_STATE, ("dhcp_bind(): IP: 0x%08"X32_F"\n", dhcp->offered_ip_addr.addr));
-  netif_set_ipaddr(netif, &dhcp->offered_ip_addr);
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_STATE, ("dhcp_bind(): SN: 0x%08"X32_F"\n", sn_mask.addr));
-  netif_set_netmask(netif, &sn_mask);
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_STATE, ("dhcp_bind(): GW: 0x%08"X32_F"\n", gw_addr.addr));
-  netif_set_gw(netif, &gw_addr);
-  /* bring the interface up */
-  netif_set_up(netif);
-  /* netif is now bound to DHCP leased address */
-  dhcp_set_state(dhcp, DHCP_BOUND);
-}
-
-/**
- * Renew an existing DHCP lease at the involved DHCP server.
- *
- * @param netif network interface which must renew its lease
- */
-err_t dhcp_renew(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  err_t result;
-  u16_t msecs;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_renew()\n"));
-  dhcp_set_state(dhcp, DHCP_RENEWING);
-
-  /* create and initialize the DHCP message header */
-  result = dhcp_create_request(netif);
-  if (result == ERR_OK) {
-
-    dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
-    dhcp_option_byte(dhcp, DHCP_REQUEST);
-
-    dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN);
-    /* TODO: use netif->mtu in some way */
-    dhcp_option_short(dhcp, 576);
-
-#if 0
-    dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4);
-    dhcp_option_long(dhcp, ntohl(dhcp->offered_ip_addr.addr));
-#endif
-
-#if 0
-    dhcp_option(dhcp, DHCP_OPTION_SERVER_ID, 4);
-    dhcp_option_long(dhcp, ntohl(dhcp->server_ip_addr.addr));
-#endif
-    /* append DHCP message trailer */
-    dhcp_option_trailer(dhcp);
-
-    pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
-
-    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
-    udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
-    udp_send(dhcp->pcb, dhcp->p_out);
-    dhcp_delete_request(netif);
-
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_renew: RENEWING\n"));
-  } else {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_renew: could not allocate DHCP request\n"));
-  }
-  dhcp->tries++;
-  /* back-off on retries, but to a maximum of 20 seconds */
-  msecs = dhcp->tries < 10 ? dhcp->tries * 2000 : 20 * 1000;
-  dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS;
-   LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_renew(): set request timeout %"U16_F" msecs\n", msecs));
-  return result;
-}
-
-/**
- * Rebind with a DHCP server for an existing DHCP lease.
- *
- * @param netif network interface which must rebind with a DHCP server
- */
-static err_t dhcp_rebind(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  err_t result;
-  u16_t msecs;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_rebind()\n"));
-  dhcp_set_state(dhcp, DHCP_REBINDING);
-
-  /* create and initialize the DHCP message header */
-  result = dhcp_create_request(netif);
-  if (result == ERR_OK)
-  {
-
-    dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
-    dhcp_option_byte(dhcp, DHCP_REQUEST);
-
-    dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN);
-    dhcp_option_short(dhcp, 576);
-
-#if 0
-    dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4);
-    dhcp_option_long(dhcp, ntohl(dhcp->offered_ip_addr.addr));
-
-    dhcp_option(dhcp, DHCP_OPTION_SERVER_ID, 4);
-    dhcp_option_long(dhcp, ntohl(dhcp->server_ip_addr.addr));
-#endif
-
-    dhcp_option_trailer(dhcp);
-
-    pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
-
-    /* set remote IP association to any DHCP server */
-    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
-    udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);
-    /* broadcast to server */
-    udp_sendto(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
-    dhcp_delete_request(netif);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_rebind: REBINDING\n"));
-  } else {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_rebind: could not allocate DHCP request\n"));
-  }
-  dhcp->tries++;
-  msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000;
-  dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS;
-   LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_rebind(): set request timeout %"U16_F" msecs\n", msecs));
-  return result;
-}
-
-/**
- * Release a DHCP lease.
- *
- * @param netif network interface which must release its lease
- */
-err_t dhcp_release(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  err_t result;
-  u16_t msecs;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_release()\n"));
-
-  /* idle DHCP client */
-  dhcp_set_state(dhcp, DHCP_OFF);
-  /* clean old DHCP offer */
-  dhcp->server_ip_addr.addr = 0;
-  dhcp->offered_ip_addr.addr = dhcp->offered_sn_mask.addr = 0;
-  dhcp->offered_gw_addr.addr = dhcp->offered_bc_addr.addr = 0;
-  dhcp->offered_t0_lease = dhcp->offered_t1_renew = dhcp->offered_t2_rebind = 0;
-  dhcp->dns_count = 0;
-  
-  /* create and initialize the DHCP message header */
-  result = dhcp_create_request(netif);
-  if (result == ERR_OK) {
-    dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN);
-    dhcp_option_byte(dhcp, DHCP_RELEASE);
-
-    dhcp_option_trailer(dhcp);
-
-    pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len);
-
-    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
-    udp_connect(dhcp->pcb, &dhcp->server_ip_addr, DHCP_SERVER_PORT);
-    udp_send(dhcp->pcb, dhcp->p_out);
-    dhcp_delete_request(netif);
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_release: RELEASED, DHCP_OFF\n"));
-  } else {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_release: could not allocate DHCP request\n"));
-  }
-  dhcp->tries++;
-  msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000;
-  dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | DBG_STATE, ("dhcp_release(): set request timeout %"U16_F" msecs\n", msecs));
-  /* bring the interface down */
-  netif_set_down(netif);
-  /* remove IP address from interface */
-  netif_set_ipaddr(netif, IP_ADDR_ANY);
-  netif_set_gw(netif, IP_ADDR_ANY);
-  netif_set_netmask(netif, IP_ADDR_ANY);
-  
-  /* TODO: netif_down(netif); */
-  return result;
-}
-/**
- * Remove the DHCP client from the interface.
- *
- * @param netif The network interface to stop DHCP on
- */
-void dhcp_stop(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  LWIP_ASSERT("dhcp_stop: netif != NULL", netif != NULL);
-
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_stop()\n"));
-  /* netif is DHCP configured? */
-  if (dhcp != NULL)
-  {
-    if (dhcp->pcb != NULL)
-    {
-      udp_remove(dhcp->pcb);
-      dhcp->pcb = NULL;
-    }
-    if (dhcp->p != NULL)
-    {
-      pbuf_free(dhcp->p);
-      dhcp->p = NULL;
-    }
-    /* free unfolded reply */
-    dhcp_free_reply(dhcp);
-    mem_free((void *)dhcp);
-    netif->dhcp = NULL;
-  }
-}
-
-/*
- * Set the DHCP state of a DHCP client.
- *
- * If the state changed, reset the number of tries.
- *
- * TODO: we might also want to reset the timeout here?
- */
-static void dhcp_set_state(struct dhcp *dhcp, u8_t new_state)
-{
-  if (new_state != dhcp->state)
-  {
-    dhcp->state = new_state;
-    dhcp->tries = 0;
-  }
-}
-
-/*
- * Concatenate an option type and length field to the outgoing
- * DHCP message.
- *
- */
-static void dhcp_option(struct dhcp *dhcp, u8_t option_type, u8_t option_len)
-{
-  LWIP_ASSERT("dhcp_option_short: dhcp->options_out_len + 2 + option_len <= DHCP_OPTIONS_LEN", dhcp->options_out_len + 2 + option_len <= DHCP_OPTIONS_LEN);
-  dhcp->msg_out->options[dhcp->options_out_len++] = option_type;
-  dhcp->msg_out->options[dhcp->options_out_len++] = option_len;
-}
-/*
- * Concatenate a single byte to the outgoing DHCP message.
- *
- */
-static void dhcp_option_byte(struct dhcp *dhcp, u8_t value)
-{
-  LWIP_ASSERT("dhcp_option_short: dhcp->options_out_len < DHCP_OPTIONS_LEN", dhcp->options_out_len < DHCP_OPTIONS_LEN);
-  dhcp->msg_out->options[dhcp->options_out_len++] = value;
-}
-static void dhcp_option_short(struct dhcp *dhcp, u16_t value)
-{
-  LWIP_ASSERT("dhcp_option_short: dhcp->options_out_len + 2 <= DHCP_OPTIONS_LEN", dhcp->options_out_len + 2 <= DHCP_OPTIONS_LEN);
-  dhcp->msg_out->options[dhcp->options_out_len++] = (value & 0xff00U) >> 8;
-  dhcp->msg_out->options[dhcp->options_out_len++] =  value & 0x00ffU;
-}
-static void dhcp_option_long(struct dhcp *dhcp, u32_t value)
-{
-  LWIP_ASSERT("dhcp_option_long: dhcp->options_out_len + 4 <= DHCP_OPTIONS_LEN", dhcp->options_out_len + 4 <= DHCP_OPTIONS_LEN);
-  dhcp->msg_out->options[dhcp->options_out_len++] = (value & 0xff000000UL) >> 24;
-  dhcp->msg_out->options[dhcp->options_out_len++] = (value & 0x00ff0000UL) >> 16;
-  dhcp->msg_out->options[dhcp->options_out_len++] = (value & 0x0000ff00UL) >> 8;
-  dhcp->msg_out->options[dhcp->options_out_len++] = (value & 0x000000ffUL);
-}
-
-/**
- * Extract the DHCP message and the DHCP options.
- *
- * Extract the DHCP message and the DHCP options, each into a contiguous
- * piece of memory. As a DHCP message is variable sized by its options,
- * and also allows overriding some fields for options, the easy approach
- * is to first unfold the options into a conitguous piece of memory, and
- * use that further on.
- *
- */
-static err_t dhcp_unfold_reply(struct dhcp *dhcp)
-{
-  struct pbuf *p = dhcp->p;
-  u8_t *ptr;
-  u16_t i;
-  u16_t j = 0;
-  LWIP_ASSERT("dhcp->p != NULL", dhcp->p != NULL);
-  /* free any left-overs from previous unfolds */
-  dhcp_free_reply(dhcp);
-  /* options present? */
-  if (dhcp->p->tot_len > (sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN))
-  {
-    dhcp->options_in_len = dhcp->p->tot_len - (sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN);
-    dhcp->options_in = mem_malloc(dhcp->options_in_len);
-    if (dhcp->options_in == NULL)
-    {
-      LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_unfold_reply(): could not allocate dhcp->options\n"));
-      return ERR_MEM;
-    }
-  }
-  dhcp->msg_in = mem_malloc(sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN);
-  if (dhcp->msg_in == NULL)
-  {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_unfold_reply(): could not allocate dhcp->msg_in\n"));
-    mem_free((void *)dhcp->options_in);
-    dhcp->options_in = NULL;
-    return ERR_MEM;
-  }
-
-  ptr = (u8_t *)dhcp->msg_in;
-  /* proceed through struct dhcp_msg */
-  for (i = 0; i < sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN; i++)
-  {
-    *ptr++ = ((u8_t *)p->payload)[j++];
-    /* reached end of pbuf? */
-    if (j == p->len)
-    {
-      /* proceed to next pbuf in chain */
-      p = p->next;
-      j = 0;
-    }
-  }
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_unfold_reply(): copied %"U16_F" bytes into dhcp->msg_in[]\n", i));
-  if (dhcp->options_in != NULL) {
-    ptr = (u8_t *)dhcp->options_in;
-    /* proceed through options */
-    for (i = 0; i < dhcp->options_in_len; i++) {
-      *ptr++ = ((u8_t *)p->payload)[j++];
-      /* reached end of pbuf? */
-      if (j == p->len) {
-        /* proceed to next pbuf in chain */
-        p = p->next;
-        j = 0;
-      }
-    }
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_unfold_reply(): copied %"U16_F" bytes to dhcp->options_in[]\n", i));
-  }
-  return ERR_OK;
-}
-
-/**
- * Free the incoming DHCP message including contiguous copy of
- * its DHCP options.
- *
- */
-static void dhcp_free_reply(struct dhcp *dhcp)
-{
-  if (dhcp->msg_in != NULL) {
-    mem_free((void *)dhcp->msg_in);
-    dhcp->msg_in = NULL;
-  }
-  if (dhcp->options_in) {
-    mem_free((void *)dhcp->options_in);
-    dhcp->options_in = NULL;
-    dhcp->options_in_len = 0;
-  }
-  LWIP_DEBUGF(DHCP_DEBUG, ("dhcp_free_reply(): free'd\n"));
-}
-
-
-/**
- * If an incoming DHCP message is in response to us, then trigger the state machine
- */
-static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
-{
-  struct netif *netif = (struct netif *)arg;
-  struct dhcp *dhcp = netif->dhcp;
-  struct dhcp_msg *reply_msg = (struct dhcp_msg *)p->payload;
-  u8_t *options_ptr;
-  u8_t msg_type;
-  u8_t i;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_recv(pbuf = %p) from DHCP server %"U16_F".%"U16_F".%"U16_F".%"U16_F" port %"U16_F"\n", (void*)p,
-    (u16_t)(ntohl(addr->addr) >> 24 & 0xff), (u16_t)(ntohl(addr->addr) >> 16 & 0xff),
-    (u16_t)(ntohl(addr->addr) >>  8 & 0xff), (u16_t)(ntohl(addr->addr) & 0xff), port));
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("pbuf->len = %"U16_F"\n", p->len));
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("pbuf->tot_len = %"U16_F"\n", p->tot_len));
-  /* prevent warnings about unused arguments */
-  (void)pcb; (void)addr; (void)port;
-  dhcp->p = p;
-  /* TODO: check packet length before reading them */
-  if (reply_msg->op != DHCP_BOOTREPLY) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("not a DHCP reply message, but type %"U16_F"\n", (u16_t)reply_msg->op));
-    pbuf_free(p);
-    dhcp->p = NULL;
-    return;
-  }
-  /* iterate through hardware address and match against DHCP message */
-  for (i = 0; i < netif->hwaddr_len; i++) {
-    if (netif->hwaddr[i] != reply_msg->chaddr[i]) {
-      LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("netif->hwaddr[%"U16_F"]==%02"X16_F" != reply_msg->chaddr[%"U16_F"]==%02"X16_F"\n",
-        (u16_t)i, (u16_t)netif->hwaddr[i], (u16_t)i, (u16_t)reply_msg->chaddr[i]));
-      pbuf_free(p);
-      dhcp->p = NULL;
-      return;
-    }
-  }
-  /* match transaction ID against what we expected */
-  if (ntohl(reply_msg->xid) != dhcp->xid) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("transaction id mismatch reply_msg->xid(%"X32_F")!=dhcp->xid(%"X32_F")\n",ntohl(reply_msg->xid),dhcp->xid));
-    pbuf_free(p);
-    dhcp->p = NULL;
-    return;
-  }
-  /* option fields could be unfold? */
-  if (dhcp_unfold_reply(dhcp) != ERR_OK) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("problem unfolding DHCP message - too short on memory?\n"));
-    pbuf_free(p);
-    dhcp->p = NULL;
-    return;
-  }
-
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("searching DHCP_OPTION_MESSAGE_TYPE\n"));
-  /* obtain pointer to DHCP message type */
-  options_ptr = dhcp_get_option_ptr(dhcp, DHCP_OPTION_MESSAGE_TYPE);
-  if (options_ptr == NULL) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("DHCP_OPTION_MESSAGE_TYPE option not found\n"));
-    pbuf_free(p);
-    dhcp->p = NULL;
-    return;
-  }
-
-  /* read DHCP message type */
-  msg_type = dhcp_get_option_byte(options_ptr + 2);
-  /* message type is DHCP ACK? */
-  if (msg_type == DHCP_ACK) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("DHCP_ACK received\n"));
-    /* in requesting state? */
-    if (dhcp->state == DHCP_REQUESTING) {
-      dhcp_handle_ack(netif);
-      dhcp->request_timeout = 0;
-#if DHCP_DOES_ARP_CHECK
-      /* check if the acknowledged lease address is already in use */
-      dhcp_check(netif);
-#else
-      /* bind interface to the acknowledged lease address */
-      dhcp_bind(netif);
-#endif
-    }
-    /* already bound to the given lease address? */
-    else if ((dhcp->state == DHCP_REBOOTING) || (dhcp->state == DHCP_REBINDING) || (dhcp->state == DHCP_RENEWING)) {
-      dhcp->request_timeout = 0;
-      dhcp_bind(netif);
-    }
-  }
-  /* received a DHCP_NAK in appropriate state? */
-  else if ((msg_type == DHCP_NAK) &&
-    ((dhcp->state == DHCP_REBOOTING) || (dhcp->state == DHCP_REQUESTING) ||
-     (dhcp->state == DHCP_REBINDING) || (dhcp->state == DHCP_RENEWING  ))) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("DHCP_NAK received\n"));
-    dhcp->request_timeout = 0;
-    dhcp_handle_nak(netif);
-  }
-  /* received a DHCP_OFFER in DHCP_SELECTING state? */
-  else if ((msg_type == DHCP_OFFER) && (dhcp->state == DHCP_SELECTING)) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("DHCP_OFFER received in DHCP_SELECTING state\n"));
-    dhcp->request_timeout = 0;
-    /* remember offered lease */
-    dhcp_handle_offer(netif);
-  }
-  pbuf_free(p);
-  dhcp->p = NULL;
-}
-
-
-static err_t dhcp_create_request(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  u16_t i;
-  LWIP_ASSERT("dhcp_create_request: dhcp->p_out == NULL", dhcp->p_out == NULL);
-  LWIP_ASSERT("dhcp_create_request: dhcp->msg_out == NULL", dhcp->msg_out == NULL);
-  dhcp->p_out = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct dhcp_msg), PBUF_RAM);
-  if (dhcp->p_out == NULL) {
-    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_create_request(): could not allocate pbuf\n"));
-    return ERR_MEM;
-  }
-  /* give unique transaction identifier to this request */
-  dhcp->xid = xid++;
-  LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("transaction id xid++(%"X32_F") dhcp->xid(%"U32_F")\n",xid,dhcp->xid));
-
-  dhcp->msg_out = (struct dhcp_msg *)dhcp->p_out->payload;
-
-  dhcp->msg_out->op = DHCP_BOOTREQUEST;
-  /* TODO: make link layer independent */
-  dhcp->msg_out->htype = DHCP_HTYPE_ETH;
-  /* TODO: make link layer independent */
-  dhcp->msg_out->hlen = DHCP_HLEN_ETH;
-  dhcp->msg_out->hops = 0;
-  dhcp->msg_out->xid = htonl(dhcp->xid);
-  dhcp->msg_out->secs = 0;
-  dhcp->msg_out->flags = 0;
-  dhcp->msg_out->ciaddr.addr = netif->ip_addr.addr;
-  dhcp->msg_out->yiaddr.addr = 0;
-  dhcp->msg_out->siaddr.addr = 0;
-  dhcp->msg_out->giaddr.addr = 0;
-  for (i = 0; i < DHCP_CHADDR_LEN; i++) {
-    /* copy netif hardware address, pad with zeroes */
-    dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/;
-  }
-  for (i = 0; i < DHCP_SNAME_LEN; i++) dhcp->msg_out->sname[i] = 0;
-  for (i = 0; i < DHCP_FILE_LEN; i++) dhcp->msg_out->file[i] = 0;
-  dhcp->msg_out->cookie = htonl(0x63825363UL);
-  dhcp->options_out_len = 0;
-  /* fill options field with an incrementing array (for debugging purposes) */
-  for (i = 0; i < DHCP_OPTIONS_LEN; i++) dhcp->msg_out->options[i] = i;
-  return ERR_OK;
-}
-
-static void dhcp_delete_request(struct netif *netif)
-{
-  struct dhcp *dhcp = netif->dhcp;
-  LWIP_ASSERT("dhcp_free_msg: dhcp->p_out != NULL", dhcp->p_out != NULL);
-  LWIP_ASSERT("dhcp_free_msg: dhcp->msg_out != NULL", dhcp->msg_out != NULL);
-  pbuf_free(dhcp->p_out);
-  dhcp->p_out = NULL;
-  dhcp->msg_out = NULL;
-}
-
-/**
- * Add a DHCP message trailer
- *
- * Adds the END option to the DHCP message, and if
- * necessary, up to three padding bytes.
- */
-
-static void dhcp_option_trailer(struct dhcp *dhcp)
-{
-  LWIP_ASSERT("dhcp_option_trailer: dhcp->msg_out != NULL\n", dhcp->msg_out != NULL);
-  LWIP_ASSERT("dhcp_option_trailer: dhcp->options_out_len < DHCP_OPTIONS_LEN\n", dhcp->options_out_len < DHCP_OPTIONS_LEN);
-  dhcp->msg_out->options[dhcp->options_out_len++] = DHCP_OPTION_END;
-  /* packet is too small, or not 4 byte aligned? */
-  while ((dhcp->options_out_len < DHCP_MIN_OPTIONS_LEN) || (dhcp->options_out_len & 3)) {
-    /* LWIP_DEBUGF(DHCP_DEBUG,("dhcp_option_trailer:dhcp->options_out_len=%"U16_F", DHCP_OPTIONS_LEN=%"U16_F, dhcp->options_out_len, DHCP_OPTIONS_LEN)); */
-    LWIP_ASSERT("dhcp_option_trailer: dhcp->options_out_len < DHCP_OPTIONS_LEN\n", dhcp->options_out_len < DHCP_OPTIONS_LEN);
-    /* add a fill/padding byte */
-    dhcp->msg_out->options[dhcp->options_out_len++] = 0;
-  }
-}
-
-/**
- * Find the offset of a DHCP option inside the DHCP message.
- *
- * @param client DHCP client
- * @param option_type
- *
- * @return a byte offset into the UDP message where the option was found, or
- * zero if the given option was not found.
- */
-static u8_t *dhcp_get_option_ptr(struct dhcp *dhcp, u8_t option_type)
-{
-  u8_t overload = DHCP_OVERLOAD_NONE;
-
-  /* options available? */
-  if ((dhcp->options_in != NULL) && (dhcp->options_in_len > 0)) {
-    /* start with options field */
-    u8_t *options = (u8_t *)dhcp->options_in;
-    u16_t offset = 0;
-    /* at least 1 byte to read and no end marker, then at least 3 bytes to read? */
-    while ((offset < dhcp->options_in_len) && (options[offset] != DHCP_OPTION_END)) {
-      /* LWIP_DEBUGF(DHCP_DEBUG, ("msg_offset=%"U16_F", q->len=%"U16_F, msg_offset, q->len)); */
-      /* are the sname and/or file field overloaded with options? */
-      if (options[offset] == DHCP_OPTION_OVERLOAD) {
-        LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("overloaded message detected\n"));
-        /* skip option type and length */
-        offset += 2;
-        overload = options[offset++];
-      }
-      /* requested option found */
-      else if (options[offset] == option_type) {
-        LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("option found at offset %"U16_F" in options\n", offset));
-        return &options[offset];
-      /* skip option */
-      } else {
-         LWIP_DEBUGF(DHCP_DEBUG, ("skipping option %"U16_F" in options\n", options[offset]));
-        /* skip option type */
-        offset++;
-        /* skip option length, and then length bytes */
-        offset += 1 + options[offset];
-      }
-    }
-    /* is this an overloaded message? */
-    if (overload != DHCP_OVERLOAD_NONE) {
-      u16_t field_len;
-      if (overload == DHCP_OVERLOAD_FILE) {
-        LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("overloaded file field\n"));
-        options = (u8_t *)&dhcp->msg_in->file;
-        field_len = DHCP_FILE_LEN;
-      } else if (overload == DHCP_OVERLOAD_SNAME) {
-        LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("overloaded sname field\n"));
-        options = (u8_t *)&dhcp->msg_in->sname;
-        field_len = DHCP_SNAME_LEN;
-      /* TODO: check if else if () is necessary */
-      } else {
-        LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 1, ("overloaded sname and file field\n"));
-        options = (u8_t *)&dhcp->msg_in->sname;
-        field_len = DHCP_FILE_LEN + DHCP_SNAME_LEN;
-      }
-      offset = 0;
-
-      /* at least 1 byte to read and no end marker */
-      while ((offset < field_len) && (options[offset] != DHCP_OPTION_END)) {
-        if (options[offset] == option_type) {
-           LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("option found at offset=%"U16_F"\n", offset));
-          return &options[offset];
-        /* skip option */
-        } else {
-          LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("skipping option %"U16_F"\n", options[offset]));
-          /* skip option type */
-          offset++;
-          offset += 1 + options[offset];
-        }
-      }
-    }
-  }
-  return NULL;
-}
-
-/**
- * Return the byte of DHCP option data.
- *
- * @param client DHCP client.
- * @param ptr pointer obtained by dhcp_get_option_ptr().
- *
- * @return byte value at the given address.
- */
-static u8_t dhcp_get_option_byte(u8_t *ptr)
-{
-  LWIP_DEBUGF(DHCP_DEBUG, ("option byte value=%"U16_F"\n", (u16_t)(*ptr)));
-  return *ptr;
-}
-
-#if 0
-/**
- * Return the 16-bit value of DHCP option data.
- *
- * @param client DHCP client.
- * @param ptr pointer obtained by dhcp_get_option_ptr().
- *
- * @return byte value at the given address.
- */
-static u16_t dhcp_get_option_short(u8_t *ptr)
-{
-  u16_t value;
-  value = *ptr++ << 8;
-  value |= *ptr;
-  LWIP_DEBUGF(DHCP_DEBUG, ("option short value=%"U16_F"\n", value));
-  return value;
-}
-#endif
-
-/**
- * Return the 32-bit value of DHCP option data.
- *
- * @param client DHCP client.
- * @param ptr pointer obtained by dhcp_get_option_ptr().
- *
- * @return byte value at the given address.
- */
-static u32_t dhcp_get_option_long(u8_t *ptr)
-{
-  u32_t value;
-  value = (u32_t)(*ptr++) << 24;
-  value |= (u32_t)(*ptr++) << 16;
-  value |= (u32_t)(*ptr++) << 8;
-  value |= (u32_t)(*ptr++);
-  LWIP_DEBUGF(DHCP_DEBUG, ("option long value=%"U32_F"\n", value));
-  return value;
-}
-
-#endif /* LWIP_DHCP */
diff --git a/src/VBox/Devices/Network/lwip/src/core/inet.c b/src/VBox/Devices/Network/lwip/src/core/inet.c
deleted file mode 100644
index 2c54389..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/inet.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-
-/* inet.c
- *
- * Functions common to all TCP/IP modules, such as the Internet checksum and the
- * byte order functions.
- *
- */
-
-
-#include "lwip/opt.h"
-
-#include "lwip/arch.h"
-
-#include "lwip/def.h"
-#include "lwip/inet.h"
-
-#include "lwip/sys.h"
-
-/* These are some reference implementations of the checksum algorithm, with the
- * aim of being simple, correct and fully portable. Checksumming is the
- * first thing you would want to optimize for your platform. If you create
- * your own version, link it in and in your sys_arch.h put:
- * 
- * #define LWIP_CHKSUM <your_checksum_routine> 
-*/
-#ifndef LWIP_CHKSUM
-#define LWIP_CHKSUM lwip_standard_chksum
-
-#if 1 /* Version A */
-/**
- * lwip checksum
- *
- * @param dataptr points to start of data to be summed at any boundary
- * @param len length of data to be summed
- * @return host order (!) lwip checksum (non-inverted Internet sum) 
- *
- * @note accumulator size limits summable length to 64k
- * @note host endianess is irrelevant (p3 RFC1071)
- */
-static u16_t
-lwip_standard_chksum(void *dataptr, u16_t len)
-{
-  u32_t acc;
-  u16_t src;
-  u8_t *octetptr;
-
-  acc = 0;
-  /* dataptr may be at odd or even addresses */
-  octetptr = (u8_t*)dataptr;
-  while (len > 1)
-  {
-    /* declare first octet as most significant
-       thus assume network order, ignoring host order */
-    src = (*octetptr) << 8;
-    octetptr++;
-    /* declare second octet as least significant */
-    src |= (*octetptr);
-    octetptr++;
-    acc += src;
-    len -= 2;
-  }
-  if (len > 0)
-  {
-    /* accumulate remaining octet */
-    src = (*octetptr) << 8;
-    acc += src;
-  }
-  /* add deferred carry bits */
-  acc = (acc >> 16) + (acc & 0x0000ffffUL);
-  if ((acc & 0xffff0000) != 0) {
-    acc = (acc >> 16) + (acc & 0x0000ffffUL);
-  }
-  /* This maybe a little confusing: reorder sum using htons()
-     instead of ntohs() since it has a little less call overhead.
-     The caller must invert bits for Internet sum ! */
-  return htons((u16_t)acc);
-}
-#endif
-
-#if 0 /* Version B */
-/*
- * Curt McDowell
- * Broadcom Corp.
- * csm at broadcom.com
- *
- * IP checksum two bytes at a time with support for
- * unaligned buffer.
- * Works for len up to and including 0x20000.
- * by Curt McDowell, Broadcom Corp. 12/08/2005
- */
-
-static u16_t
-lwip_standard_chksum(void *dataptr, int len)
-{
-  u8_t *pb = dataptr;
-  u16_t *ps, t = 0;
-  u32_t sum = 0;
-  int odd = ((u32_t)pb & 1);
-
-  /* Get aligned to u16_t */
-  if (odd && len > 0) {
-    ((u8_t *)&t)[1] = *pb++;
-    len--;
-  }
-
-  /* Add the bulk of the data */
-  ps = (u16_t *)pb;
-  while (len > 1) {
-    sum += *ps++;
-    len -= 2;
-  }
-
-  /* Consume left-over byte, if any */
-  if (len > 0)
-    ((u8_t *)&t)[0] = *(u8_t *)ps;;
-
-  /* Add end bytes */
-  sum += t;
-
-  /*  Fold 32-bit sum to 16 bits */
-  while (sum >> 16)
-    sum = (sum & 0xffff) + (sum >> 16);
-
-  /* Swap if alignment was odd */
-  if (odd)
-    sum = ((sum & 0xff) << 8) | ((sum & 0xff00) >> 8);
-
-  return sum;
-}
-#endif
-
-#if 0 /* Version C */
-/**
- * An optimized checksum routine. Basically, it uses loop-unrolling on
- * the checksum loop, treating the head and tail bytes specially, whereas
- * the inner loop acts on 8 bytes at a time. 
- *
- * @arg start of buffer to be checksummed. May be an odd byte address.
- * @len number of bytes in the buffer to be checksummed.
- * 
- * by Curt McDowell, Broadcom Corp. December 8th, 2005
- */
-
-static u16_t
-lwip_standard_chksum(void *dataptr, int len)
-{
-  u8_t *pb = dataptr;
-  u16_t *ps, t = 0;
-  u32_t *pl;
-  u32_t sum = 0, tmp;
-  /* starts at odd byte address? */
-  int odd = ((u32_t)pb & 1);
-
-  if (odd && len > 0) {
-    ((u8_t *)&t)[1] = *pb++;
-    len--;
-  }
-
-  ps = (u16_t *)pb;
-
-  if (((u32_t)ps & 3) && len > 1) {
-    sum += *ps++;
-    len -= 2;
-  }
-
-  pl = (u32_t *)ps;
-
-  while (len > 7)  {
-    tmp = sum + *pl++;          /* ping */
-    if (tmp < sum)
-      tmp++;                    /* add back carry */
-
-    sum = tmp + *pl++;          /* pong */
-    if (sum < tmp)
-      sum++;                    /* add back carry */
-
-    len -= 8;
-  }
-
-  /* make room in upper bits */
-  sum = (sum >> 16) + (sum & 0xffff);
-
-  ps = (u16_t *)pl;
-
-  /* 16-bit aligned word remaining? */
-  while (len > 1) {
-    sum += *ps++;
-    len -= 2;
-  }
-
-  /* dangling tail byte remaining? */
-  if (len > 0)                  /* include odd byte */
-    ((u8_t *)&t)[0] = *(u8_t *)ps;
-
-  sum += t;                     /* add end bytes */
-
-  while (sum >> 16)             /* combine halves */
-    sum = (sum >> 16) + (sum & 0xffff);
-
-  if (odd)
-    sum = ((sum & 0xff) << 8) | ((sum & 0xff00) >> 8);
-
-  return sum;
-}
-#endif
-
-#endif /* LWIP_CHKSUM */
-
-/* inet_chksum_pseudo:
- *
- * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
- */
-
-u16_t
-inet_chksum_pseudo(struct pbuf *p,
-       struct ip_addr *src, struct ip_addr *dest,
-       u8_t proto, u16_t proto_len)
-{
-  u32_t acc;
-  struct pbuf *q;
-  u8_t swapped;
-
-  acc = 0;
-  swapped = 0;
-  /* iterate through all pbuf in chain */
-  for(q = p; q != NULL; q = q->next) {
-    LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
-      (void *)q, (void *)q->next));
-    acc += LWIP_CHKSUM(q->payload, q->len);
-    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/
-    while (acc >> 16) {
-      acc = (acc & 0xffffUL) + (acc >> 16);
-    }
-    if (q->len % 2 != 0) {
-      swapped = 1 - swapped;
-      acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8);
-    }
-    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/
-  }
-
-  if (swapped) {
-    acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8);
-  }
-  acc += (src->addr & 0xffffUL);
-  acc += ((src->addr >> 16) & 0xffffUL);
-  acc += (dest->addr & 0xffffUL);
-  acc += ((dest->addr >> 16) & 0xffffUL);
-  acc += (u32_t)htons((u16_t)proto);
-  acc += (u32_t)htons(proto_len);
-
-  while (acc >> 16) {
-    acc = (acc & 0xffffUL) + (acc >> 16);
-  }
-  LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc));
-  return (u16_t)~(acc & 0xffffUL);
-}
-
-/* inet_chksum:
- *
- * Calculates the Internet checksum over a portion of memory. Used primarily for IP
- * and ICMP.
- */
-
-u16_t
-inet_chksum(void *dataptr, u16_t len)
-{
-  u32_t acc;
-
-  acc = LWIP_CHKSUM(dataptr, len);
-  while (acc >> 16) {
-    acc = (acc & 0xffff) + (acc >> 16);
-  }
-  return (u16_t)~(acc & 0xffff);
-}
-
-u16_t
-inet_chksum_pbuf(struct pbuf *p)
-{
-  u32_t acc;
-  struct pbuf *q;
-  u8_t swapped;
-
-  acc = 0;
-  swapped = 0;
-  for(q = p; q != NULL; q = q->next) {
-    acc += LWIP_CHKSUM(q->payload, q->len);
-    while (acc >> 16) {
-      acc = (acc & 0xffffUL) + (acc >> 16);
-    }
-    if (q->len % 2 != 0) {
-      swapped = 1 - swapped;
-      acc = (acc & 0x00ffUL << 8) | (acc & 0xff00UL >> 8);
-    }
-  }
-
-  if (swapped) {
-    acc = ((acc & 0x00ffUL) << 8) | ((acc & 0xff00UL) >> 8);
-  }
-  return (u16_t)~(acc & 0xffffUL);
-}
-
-/* Here for now until needed in other places in lwIP */
-#ifndef isprint
-#define in_range(c, lo, up)  ((u8_t)c >= lo && (u8_t)c <= up)
-#define isprint(c)           in_range(c, 0x20, 0x7f)
-#define isdigit(c)           in_range(c, '0', '9')
-#define isxdigit(c)          (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
-#define islower(c)           in_range(c, 'a', 'z')
-#define isspace(c)           (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
-#endif    
-    
-/*
- * Ascii internet address interpretation routine.
- * The value returned is in network order.
- */
-
-u32_t
-inet_addr(const char *cp)
-{
-  struct in_addr val;
-
-  if (inet_aton(cp, &val)) {
-    return (val.s_addr);
-  }
-  return (INADDR_NONE);
-}
-
-/*
- * Check whether "cp" is a valid ascii representation
- * of an Internet address and convert to a binary address.
- * Returns 1 if the address is valid, 0 if not.
- * This replaces inet_addr, the return value from which
- * cannot distinguish between failure and a local broadcast address.
- */
-int
-inet_aton(const char *cp, struct in_addr *addr)
-{
-  u32_t val;
-  int base, n, c;
-  u32_t parts[4];
-  u32_t *pp = parts;
-
-  c = *cp;
-  for (;;) {
-    /*
-     * Collect number up to ``.''.
-     * Values are specified as for C:
-     * 0x=hex, 0=octal, 1-9=decimal.
-     */
-    if (!isdigit(c))
-      return (0);
-    val = 0;
-    base = 10;
-    if (c == '0') {
-      c = *++cp;
-      if (c == 'x' || c == 'X') {
-        base = 16;
-        c = *++cp;
-      } else
-        base = 8;
-    }
-    for (;;) {
-      if (isdigit(c)) {
-        val = (val * base) + (int)(c - '0');
-        c = *++cp;
-      } else if (base == 16 && isxdigit(c)) {
-        val = (val << 4) | (int)(c + 10 - (islower(c) ? 'a' : 'A'));
-        c = *++cp;
-      } else
-        break;
-    }
-    if (c == '.') {
-      /*
-       * Internet format:
-       *  a.b.c.d
-       *  a.b.c   (with c treated as 16 bits)
-       *  a.b (with b treated as 24 bits)
-       */
-      if (pp >= parts + 3)
-        return (0);
-      *pp++ = val;
-      c = *++cp;
-    } else
-      break;
-  }
-  /*
-   * Check for trailing characters.
-   */
-  if (c != '\0' && (!isprint(c) || !isspace(c)))
-    return (0);
-  /*
-   * Concoct the address according to
-   * the number of parts specified.
-   */
-  n = pp - parts + 1;
-  switch (n) {
-
-  case 0:
-    return (0);       /* initial nondigit */
-
-  case 1:             /* a -- 32 bits */
-    break;
-
-  case 2:             /* a.b -- 8.24 bits */
-    if (val > 0xffffff)
-      return (0);
-    val |= parts[0] << 24;
-    break;
-
-  case 3:             /* a.b.c -- 8.8.16 bits */
-    if (val > 0xffff)
-      return (0);
-    val |= (parts[0] << 24) | (parts[1] << 16);
-    break;
-
-  case 4:             /* a.b.c.d -- 8.8.8.8 bits */
-    if (val > 0xff)
-      return (0);
-    val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
-    break;
-  }
-  if (addr)
-    addr->s_addr = htonl(val);
-  return (1);
-}
-
-/* Convert numeric IP address into decimal dotted ASCII representation.
- * returns ptr to static buffer; not reentrant!
- */
-char *
-inet_ntoa(struct in_addr addr)
-{
-  static char str[16];
-  u32_t s_addr = addr.s_addr;
-  char inv[3];
-  char *rp;
-  u8_t *ap;
-  u8_t rem;
-  u8_t n;
-  u8_t i;
-
-  rp = str;
-  ap = (u8_t *)&s_addr;
-  for(n = 0; n < 4; n++) {
-    i = 0;
-    do {
-      rem = *ap % (u8_t)10;
-      *ap /= (u8_t)10;
-      inv[i++] = '0' + rem;
-    } while(*ap);
-    while(i--)
-      *rp++ = inv[i];
-    *rp++ = '.';
-    ap++;
-  }
-  *--rp = 0;
-  return str;
-}
-
-/*
- * These are reference implementations of the byte swapping functions.
- * Again with the aim of being simple, correct and fully portable.
- * Byte swapping is the second thing you would want to optimize. You will
- * need to port it to your architecture and in your cc.h:
- * 
- * #define LWIP_PLATFORM_BYTESWAP 1
- * #define LWIP_PLATFORM_HTONS(x) <your_htons>
- * #define LWIP_PLATFORM_HTONL(x) <your_htonl>
- *
- * Note ntohs() and ntohl() are merely references to the htonx counterparts.
- */
-
-#ifndef BYTE_ORDER
-#error BYTE_ORDER is not defined
-#endif
-#if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN)
-
-u16_t
-htons(u16_t n)
-{
-  return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
-}
-
-u16_t
-ntohs(u16_t n)
-{
-  return htons(n);
-}
-
-u32_t
-htonl(u32_t n)
-{
-  return ((n & 0xff) << 24) |
-    ((n & 0xff00) << 8) |
-    ((n & 0xff0000) >> 8) |
-    ((n & 0xff000000) >> 24);
-}
-
-u32_t
-ntohl(u32_t n)
-{
-  return htonl(n);
-}
-
-#endif /* (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) */
diff --git a/src/VBox/Devices/Network/lwip/src/core/inet6.c b/src/VBox/Devices/Network/lwip/src/core/inet6.c
deleted file mode 100644
index c04915b..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/inet6.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-
-/* inet6.c
- *
- * Functions common to all TCP/IP modules, such as the Internet checksum and the
- * byte order functions.
- *
- */
-
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/inet.h"
-
-
-
-/* chksum:
- *
- * Sums up all 16 bit words in a memory portion. Also includes any odd byte.
- * This function is used by the other checksum functions.
- *
- * For now, this is not optimized. Must be optimized for the particular processor
- * arcitecture on which it is to run. Preferebly coded in assembler.
- */
-
-static u32_t
-chksum(void *dataptr, u16_t len)
-{
-  u16_t *sdataptr = dataptr;
-  u32_t acc;
-  
-  
-  for(acc = 0; len > 1; len -= 2) {
-    acc += *sdataptr++;
-  }
-
-  /* add up any odd byte */
-  if (len == 1) {
-    acc += htons((u16_t)(*(u8_t *)dataptr) << 8);
-  }
-
-  return acc;
-
-}
-
-/* inet_chksum_pseudo:
- *
- * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
- */
-
-u16_t
-inet_chksum_pseudo(struct pbuf *p,
-       struct ip_addr *src, struct ip_addr *dest,
-       u8_t proto, u32_t proto_len)
-{
-  u32_t acc;
-  struct pbuf *q;
-  u8_t swapped, i;
-
-  acc = 0;
-  swapped = 0;
-  for(q = p; q != NULL; q = q->next) {    
-    acc += chksum(q->payload, q->len);
-    while (acc >> 16) {
-      acc = (acc & 0xffff) + (acc >> 16);
-    }
-    if (q->len % 2 != 0) {
-      swapped = 1 - swapped;
-      acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8);
-    }
-  }
-
-  if (swapped) {
-    acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8);
-  }
-  
-  for(i = 0; i < 8; i++) {
-    acc += ((u16_t *)src->addr)[i] & 0xffff;
-    acc += ((u16_t *)dest->addr)[i] & 0xffff;
-    while (acc >> 16) {
-      acc = (acc & 0xffff) + (acc >> 16);
-    }
-  }
-  acc += (u16_t)htons((u16_t)proto);
-  acc += ((u16_t *)&proto_len)[0] & 0xffff;
-  acc += ((u16_t *)&proto_len)[1] & 0xffff;
-
-  while (acc >> 16) {
-    acc = (acc & 0xffff) + (acc >> 16);
-  }
-  return ~(acc & 0xffff);
-}
-
-/* inet_chksum:
- *
- * Calculates the Internet checksum over a portion of memory. Used primarely for IP
- * and ICMP.
- */
-
-u16_t
-inet_chksum(void *dataptr, u16_t len)
-{
-  u32_t acc, sum;
-
-  acc = chksum(dataptr, len);
-  sum = (acc & 0xffff) + (acc >> 16);
-  sum += (sum >> 16);
-  return ~(sum & 0xffff);
-}
-
-u16_t
-inet_chksum_pbuf(struct pbuf *p)
-{
-  u32_t acc;
-  struct pbuf *q;
-  u8_t swapped;
-  
-  acc = 0;
-  swapped = 0;
-  for(q = p; q != NULL; q = q->next) {
-    acc += chksum(q->payload, q->len);
-    while (acc >> 16) {
-      acc = (acc & 0xffff) + (acc >> 16);
-    }    
-    if (q->len % 2 != 0) {
-      swapped = 1 - swapped;
-      acc = (acc & 0xff << 8) | (acc & 0xff00 >> 8);
-    }
-  }
- 
-  if (swapped) {
-    acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8);
-  }
-  return ~(acc & 0xffff);
-}
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/ipv4/icmp.c b/src/VBox/Devices/Network/lwip/src/core/ipv4/icmp.c
deleted file mode 100644
index 248f2c6..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/ipv4/icmp.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-/* Some ICMP messages should be passed to the transport protocols. This
-   is not implemented. */
-
-#include <string.h>
-
-#include "lwip/opt.h"
-#include "lwip/icmp.h"
-#include "lwip/inet.h"
-#include "lwip/ip.h"
-#include "lwip/def.h"
-#include "lwip/stats.h"
-#include "lwip/snmp.h"
-
-void
-icmp_input(struct pbuf *p, struct netif *inp)
-{
-  u8_t type;
-  u8_t code;
-  struct icmp_echo_hdr *iecho;
-  struct ip_hdr *iphdr;
-  struct ip_addr tmpaddr;
-  u16_t hlen;
-
-  ICMP_STATS_INC(icmp.recv);
-  snmp_inc_icmpinmsgs();
-
-
-  iphdr = p->payload;
-  hlen = IPH_HL(iphdr) * 4;
-  if (pbuf_header(p, -((s16_t)hlen)) || (p->tot_len < sizeof(u16_t)*2)) {
-    LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: short ICMP (%"U16_F" bytes) received\n", p->tot_len));
-    pbuf_free(p);
-    ICMP_STATS_INC(icmp.lenerr);
-    snmp_inc_icmpinerrors();
-    return;
-  }
-
-  type = *((u8_t *)p->payload);
-  code = *(((u8_t *)p->payload)+1);
-  switch (type) {
-  case ICMP_ECHO:
-    /* broadcast or multicast destination address? */
-    if (ip_addr_isbroadcast(&iphdr->dest, inp) || ip_addr_ismulticast(&iphdr->dest)) {
-      LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: Not echoing to multicast or broadcast pings\n"));
-      ICMP_STATS_INC(icmp.err);
-      pbuf_free(p);
-      return;
-    }
-    LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n"));
-    if (p->tot_len < sizeof(struct icmp_echo_hdr)) {
-      LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n"));
-      pbuf_free(p);
-      ICMP_STATS_INC(icmp.lenerr);
-      snmp_inc_icmpinerrors();
-
-      return;
-    }
-    iecho = p->payload;
-    if (inet_chksum_pbuf(p) != 0) {
-      LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo\n"));
-      pbuf_free(p);
-      ICMP_STATS_INC(icmp.chkerr);
-      snmp_inc_icmpinerrors();
-      return;
-    }
-    tmpaddr.addr = iphdr->src.addr;
-    iphdr->src.addr = iphdr->dest.addr;
-    iphdr->dest.addr = tmpaddr.addr;
-    ICMPH_TYPE_SET(iecho, ICMP_ER);
-    /* adjust the checksum */
-    if (iecho->chksum >= htons(0xffff - (ICMP_ECHO << 8))) {
-      iecho->chksum += htons(ICMP_ECHO << 8) + 1;
-    } else {
-      iecho->chksum += htons(ICMP_ECHO << 8);
-    }
-    ICMP_STATS_INC(icmp.xmit);
-    /* increase number of messages attempted to send */
-    snmp_inc_icmpoutmsgs();
-    /* increase number of echo replies attempted to send */
-    snmp_inc_icmpoutechoreps();
-
-    pbuf_header(p, hlen);
-    ip_output_if(p, &(iphdr->src), IP_HDRINCL,
-     IPH_TTL(iphdr), 0, IP_PROTO_ICMP, inp);
-    break;
-  default:
-  LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %"S16_F" code %"S16_F" not supported.\n", (s16_t)type, (s16_t)code));
-    ICMP_STATS_INC(icmp.proterr);
-    ICMP_STATS_INC(icmp.drop);
-  }
-  pbuf_free(p);
-}
-
-void
-icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
-{
-  struct pbuf *q;
-  struct ip_hdr *iphdr;
-  struct icmp_dur_hdr *idur;
-
-  q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM);
-  /* ICMP header + IP header + 8 bytes of data */
-
-  iphdr = p->payload;
-
-  idur = q->payload;
-  ICMPH_TYPE_SET(idur, ICMP_DUR);
-  ICMPH_CODE_SET(idur, t);
-
-  memcpy((u8_t *)q->payload + 8, p->payload, IP_HLEN + 8);
-
-  /* calculate checksum */
-  idur->chksum = 0;
-  idur->chksum = inet_chksum(idur, q->len);
-  ICMP_STATS_INC(icmp.xmit);
-  /* increase number of messages attempted to send */
-  snmp_inc_icmpoutmsgs();
-  /* increase number of destination unreachable messages attempted to send */
-  snmp_inc_icmpoutdestunreachs();
-
-  ip_output(q, NULL, &(iphdr->src),
-      ICMP_TTL, 0, IP_PROTO_ICMP);
-  pbuf_free(q);
-}
-
-#if IP_FORWARD
-void
-icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
-{
-  struct pbuf *q;
-  struct ip_hdr *iphdr;
-  struct icmp_te_hdr *tehdr;
-
-  q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM);
-
-  iphdr = p->payload;
-  LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from "));
-  ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src));
-  LWIP_DEBUGF(ICMP_DEBUG, (" to "));
-  ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest));
-  LWIP_DEBUGF(ICMP_DEBUG, ("\n"));
-
-  tehdr = q->payload;
-  ICMPH_TYPE_SET(tehdr, ICMP_TE);
-  ICMPH_CODE_SET(tehdr, t);
-
-  /* copy fields from original packet */
-  memcpy((u8_t *)q->payload + 8, (u8_t *)p->payload, IP_HLEN + 8);
-
-  /* calculate checksum */
-  tehdr->chksum = 0;
-  tehdr->chksum = inet_chksum(tehdr, q->len);
-  ICMP_STATS_INC(icmp.xmit);
-  /* increase number of messages attempted to send */
-  snmp_inc_icmpoutmsgs();
-  /* increase number of destination unreachable messages attempted to send */
-  snmp_inc_icmpouttimeexcds();
-  ip_output(q, NULL, &(iphdr->src),
-      ICMP_TTL, 0, IP_PROTO_ICMP);
-  pbuf_free(q);
-}
-
-#endif /* IP_FORWARD */
-
-
-
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/ipv4/ip.c b/src/VBox/Devices/Network/lwip/src/core/ipv4/ip.c
deleted file mode 100644
index 9d655f8..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/ipv4/ip.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/* @file
- *
- * This is the IP layer implementation for incoming and outgoing IP traffic.
- * 
- * @see ip_frag.c
- *
- */
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/mem.h"
-#include "lwip/ip.h"
-#include "lwip/ip_frag.h"
-#include "lwip/inet.h"
-#include "lwip/netif.h"
-#include "lwip/icmp.h"
-#include "lwip/raw.h"
-#include "lwip/udp.h"
-#include "lwip/tcp.h"
-
-#include "lwip/stats.h"
-
-#include "arch/perf.h"
-
-#include "lwip/snmp.h"
-#if LWIP_DHCP
-#  include "lwip/dhcp.h"
-#endif /* LWIP_DHCP */
-
-
-/**
- * Initializes the IP layer.
- */
-
-void
-ip_init(void)
-{
-#if IP_FRAG
-  ip_frag_init();
-#endif
-}
-
-/**
- * Finds the appropriate network interface for a given IP address. It
- * searches the list of network interfaces linearly. A match is found
- * if the masked IP address of the network interface equals the masked
- * IP address given to the function.
- */
-
-struct netif *
-ip_route(struct ip_addr *dest)
-{
-  struct netif *netif;
-
-  /* iterate through netifs */
-  for(netif = netif_list; netif != NULL; netif = netif->next) {
-    /* network mask matches? */
-    if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
-      /* return netif on which to forward IP packet */
-      return netif;
-    }
-  }
-  /* no matching netif found, use default netif */
-  return netif_default;
-}
-#if IP_FORWARD
-
-/**
- * Forwards an IP packet. It finds an appropriate route for the
- * packet, decrements the TTL value of the packet, adjusts the
- * checksum and outputs the packet on the appropriate interface.
- */
-
-static struct netif *
-ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
-{
-  struct netif *netif;
-
-  PERF_START;
-  /* Find network interface where to forward this IP packet to. */
-  netif = ip_route((struct ip_addr *)&(iphdr->dest));
-  if (netif == NULL) {
-    LWIP_DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for 0x%"X32_F" found\n",
-                      iphdr->dest.addr));
-    snmp_inc_ipoutnoroutes();
-    return (struct netif *)NULL;
-  }
-  /* Do not forward packets onto the same network interface on which
-   * they arrived. */
-  if (netif == inp) {
-    LWIP_DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n"));
-    snmp_inc_ipoutnoroutes();
-    return (struct netif *)NULL;
-  }
-
-  /* decrement TTL */
-  IPH_TTL_SET(iphdr, IPH_TTL(iphdr) - 1);
-  /* send ICMP if TTL == 0 */
-  if (IPH_TTL(iphdr) == 0) {
-    snmp_inc_ipinhdrerrors();
-    /* Don't send ICMP messages in response to ICMP messages */
-    if (IPH_PROTO(iphdr) != IP_PROTO_ICMP) {
-      icmp_time_exceeded(p, ICMP_TE_TTL);
-    }
-    return (struct netif *)NULL;
-  }
-
-  /* Incrementally update the IP checksum. */
-  if (IPH_CHKSUM(iphdr) >= htons(0xffff - 0x100)) {
-    IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + htons(0x100) + 1);
-  } else {
-    IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + htons(0x100));
-  }
-
-  LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to 0x%"X32_F"\n",
-                    iphdr->dest.addr));
-
-  IP_STATS_INC(ip.fw);
-  IP_STATS_INC(ip.xmit);
-  snmp_inc_ipforwdatagrams();
-
-  PERF_STOP("ip_forward");
-  /* transmit pbuf on chosen interface */
-  netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
-  return netif;
-}
-#endif /* IP_FORWARD */
-
-/**
- * This function is called by the network interface device driver when
- * an IP packet is received. The function does the basic checks of the
- * IP header such as packet size being at least larger than the header
- * size etc. If the packet was not destined for us, the packet is
- * forwarded (using ip_forward). The IP checksum is always checked.
- *
- * Finally, the packet is sent to the upper layer protocol input function.
- * 
- * 
- * 
- */
-
-err_t
-ip_input(struct pbuf *p, struct netif *inp) {
-  struct ip_hdr *iphdr;
-  struct netif *netif;
-  u16_t iphdrlen;
-
-  IP_STATS_INC(ip.recv);
-  snmp_inc_ipinreceives();
-
-  /* identify the IP header */
-  iphdr = p->payload;
-  if (IPH_V(iphdr) != 4) {
-    LWIP_DEBUGF(IP_DEBUG | 1, ("IP packet dropped due to bad version number %"U16_F"\n", IPH_V(iphdr)));
-    ip_debug_print(p);
-    pbuf_free(p);
-    IP_STATS_INC(ip.err);
-    IP_STATS_INC(ip.drop);
-    snmp_inc_ipinhdrerrors();
-    return ERR_OK;
-  }
-  /* obtain IP header length in number of 32-bit words */
-  iphdrlen = IPH_HL(iphdr);
-  /* calculate IP header length in bytes */
-  iphdrlen *= 4;
-
-  /* header length exceeds first pbuf length? */
-  if (iphdrlen > p->len) {
-    LWIP_DEBUGF(IP_DEBUG | 2, ("IP header (len %"U16_F") does not fit in first pbuf (len %"U16_F"), IP packet droppped.\n",
-      iphdrlen, p->len));
-    /* free (drop) packet pbufs */
-    pbuf_free(p);
-    IP_STATS_INC(ip.lenerr);
-    IP_STATS_INC(ip.drop);
-    snmp_inc_ipindiscards();
-    return ERR_OK;
-  }
-
-  /* verify checksum */
-#if CHECKSUM_CHECK_IP
-  if (inet_chksum(iphdr, iphdrlen) != 0) {
-
-    LWIP_DEBUGF(IP_DEBUG | 2, ("Checksum (0x%"X16_F") failed, IP packet dropped.\n", inet_chksum(iphdr, iphdrlen)));
-    ip_debug_print(p);
-    pbuf_free(p);
-    IP_STATS_INC(ip.chkerr);
-    IP_STATS_INC(ip.drop);
-    snmp_inc_ipinhdrerrors();
-    return ERR_OK;
-  }
-#endif
-
-  /* Trim pbuf. This should have been done at the netif layer,
-   * but we'll do it anyway just to be sure that its done. */
-  pbuf_realloc(p, ntohs(IPH_LEN(iphdr)));
-
-  /* match packet against an interface, i.e. is this packet for us? */
-  for (netif = netif_list; netif != NULL; netif = netif->next) {
-
-    LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%"X32_F" netif->ip_addr 0x%"X32_F" (0x%"X32_F", 0x%"X32_F", 0x%"X32_F")\n",
-      iphdr->dest.addr, netif->ip_addr.addr,
-      iphdr->dest.addr & netif->netmask.addr,
-      netif->ip_addr.addr & netif->netmask.addr,
-      iphdr->dest.addr & ~(netif->netmask.addr)));
-
-    /* interface is up and configured? */
-    if ((netif_is_up(netif)) && (!ip_addr_isany(&(netif->ip_addr))))
-    {
-      /* unicast to this interface address? */
-      if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr)) ||
-         /* or broadcast on this interface network address? */
-         ip_addr_isbroadcast(&(iphdr->dest), netif)) {
-        LWIP_DEBUGF(IP_DEBUG, ("ip_input: packet accepted on interface %c%c\n",
-          netif->name[0], netif->name[1]));
-        /* break out of for loop */
-        break;
-      }
-    }
-  }
-#if LWIP_DHCP
-  /* Pass DHCP messages regardless of destination address. DHCP traffic is addressed
-   * using link layer addressing (such as Ethernet MAC) so we must not filter on IP.
-   * According to RFC 1542 section 3.1.1, referred by RFC 2131).
-   */
-  if (netif == NULL) {
-    /* remote port is DHCP server? */
-    if (IPH_PROTO(iphdr) == IP_PROTO_UDP) {
-      LWIP_DEBUGF(IP_DEBUG | DBG_TRACE | 1, ("ip_input: UDP packet to DHCP client port %"U16_F"\n",
-        ntohs(((struct udp_hdr *)((u8_t *)iphdr + iphdrlen))->dest)));
-      if (ntohs(((struct udp_hdr *)((u8_t *)iphdr + iphdrlen))->dest) == DHCP_CLIENT_PORT) {
-        LWIP_DEBUGF(IP_DEBUG | DBG_TRACE | 1, ("ip_input: DHCP packet accepted.\n"));
-        netif = inp;
-      }
-    }
-  }
-#endif /* LWIP_DHCP */
-  /* packet not for us? */
-  if (netif == NULL) {
-    /* packet not for us, route or discard */
-    LWIP_DEBUGF(IP_DEBUG | DBG_TRACE | 1, ("ip_input: packet not for us.\n"));
-#if IP_FORWARD
-    /* non-broadcast packet? */
-    if (!ip_addr_isbroadcast(&(iphdr->dest), inp)) {
-      /* try to forward IP packet on (other) interfaces */
-      ip_forward(p, iphdr, inp);
-    }
-    else
-#endif /* IP_FORWARD */
-    {
-      snmp_inc_ipinaddrerrors();
-      snmp_inc_ipindiscards();
-    }
-    pbuf_free(p);
-    return ERR_OK;
-  }
-  /* packet consists of multiple fragments? */
-  if ((IPH_OFFSET(iphdr) & htons(IP_OFFMASK | IP_MF)) != 0) {
-#if IP_REASSEMBLY /* packet fragment reassembly code present? */
-    LWIP_DEBUGF(IP_DEBUG, ("IP packet is a fragment (id=0x%04"X16_F" tot_len=%"U16_F" len=%"U16_F" MF=%"U16_F" offset=%"U16_F"), calling ip_reass()\n",
-      ntohs(IPH_ID(iphdr)), p->tot_len, ntohs(IPH_LEN(iphdr)), !!(IPH_OFFSET(iphdr) & htons(IP_MF)), (ntohs(IPH_OFFSET(iphdr)) & IP_OFFMASK)*8));
-    /* reassemble the packet*/
-    p = ip_reass(p);
-    /* packet not fully reassembled yet? */
-    if (p == NULL) {
-      return ERR_OK;
-    }
-    iphdr = p->payload;
-#else /* IP_REASSEMBLY == 0, no packet fragment reassembly code present */
-    pbuf_free(p);
-    LWIP_DEBUGF(IP_DEBUG | 2, ("IP packet dropped since it was fragmented (0x%"X16_F") (while IP_REASSEMBLY == 0).\n",
-      ntohs(IPH_OFFSET(iphdr))));
-    IP_STATS_INC(ip.opterr);
-    IP_STATS_INC(ip.drop);
-    /* unsupported protocol feature */
-    snmp_inc_ipinunknownprotos();
-    return ERR_OK;
-#endif /* IP_REASSEMBLY */
-  }
-
-#if IP_OPTIONS == 0 /* no support for IP options in the IP header? */
-  if (iphdrlen > IP_HLEN) {
-    LWIP_DEBUGF(IP_DEBUG | 2, ("IP packet dropped since there were IP options (while IP_OPTIONS == 0).\n"));
-    pbuf_free(p);
-    IP_STATS_INC(ip.opterr);
-    IP_STATS_INC(ip.drop);
-    /* unsupported protocol feature */
-    snmp_inc_ipinunknownprotos();
-    return ERR_OK;
-  }
-#endif /* IP_OPTIONS == 0 */
-
-  /* send to upper layers */
-  LWIP_DEBUGF(IP_DEBUG, ("ip_input: \n"));
-  ip_debug_print(p);
-  LWIP_DEBUGF(IP_DEBUG, ("ip_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len));
-
-#if LWIP_RAW
-  /* raw input did not eat the packet? */
-  if (raw_input(p, inp) == 0) {
-#endif /* LWIP_RAW */
-
-  switch (IPH_PROTO(iphdr)) {
-#if LWIP_UDP
-  case IP_PROTO_UDP:
-  case IP_PROTO_UDPLITE:
-    snmp_inc_ipindelivers();
-    udp_input(p, inp);
-    break;
-#endif /* LWIP_UDP */
-#if LWIP_TCP
-  case IP_PROTO_TCP:
-    snmp_inc_ipindelivers();
-    tcp_input(p, inp);
-    break;
-#endif /* LWIP_TCP */
-  case IP_PROTO_ICMP:
-    snmp_inc_ipindelivers();
-    icmp_input(p, inp);
-    break;
-  default:
-    /* send ICMP destination protocol unreachable unless is was a broadcast */
-    if (!ip_addr_isbroadcast(&(iphdr->dest), inp) &&
-        !ip_addr_ismulticast(&(iphdr->dest))) {
-      p->payload = iphdr;
-      icmp_dest_unreach(p, ICMP_DUR_PROTO);
-    }
-    pbuf_free(p);
-
-    LWIP_DEBUGF(IP_DEBUG | 2, ("Unsupported transport protocol %"U16_F"\n", IPH_PROTO(iphdr)));
-
-    IP_STATS_INC(ip.proterr);
-    IP_STATS_INC(ip.drop);
-    snmp_inc_ipinunknownprotos();
-  }
-#if LWIP_RAW
-  } /* LWIP_RAW */
-#endif
-  return ERR_OK;
-}
-
-/**
- * Sends an IP packet on a network interface. This function constructs
- * the IP header and calculates the IP header checksum. If the source
- * IP address is NULL, the IP address of the outgoing network
- * interface is filled in as source address.
- *
- * @note ip_id: RFC791 "some host may be able to simply use
- *  unique identifiers independent of destination"
- */
-
-err_t
-ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
-             u8_t ttl, u8_t tos,
-             u8_t proto, struct netif *netif)
-{
-  struct ip_hdr *iphdr;
-  static u16_t ip_id = 0;
-
-  snmp_inc_ipoutrequests();
-
-  if (dest != IP_HDRINCL) {
-    if (pbuf_header(p, IP_HLEN)) {
-      LWIP_DEBUGF(IP_DEBUG | 2, ("ip_output: not enough room for IP header in pbuf\n"));
-
-      IP_STATS_INC(ip.err);
-      snmp_inc_ipoutdiscards();
-      return ERR_BUF;
-    }
-
-    iphdr = p->payload;
-
-    IPH_TTL_SET(iphdr, ttl);
-    IPH_PROTO_SET(iphdr, proto);
-
-    ip_addr_set(&(iphdr->dest), dest);
-
-    IPH_VHLTOS_SET(iphdr, 4, IP_HLEN / 4, tos);
-    IPH_LEN_SET(iphdr, htons(p->tot_len));
-    IPH_OFFSET_SET(iphdr, htons(IP_DF));
-    IPH_ID_SET(iphdr, htons(ip_id));
-    ++ip_id;
-
-    if (ip_addr_isany(src)) {
-      ip_addr_set(&(iphdr->src), &(netif->ip_addr));
-    } else {
-      ip_addr_set(&(iphdr->src), src);
-    }
-
-    IPH_CHKSUM_SET(iphdr, 0);
-#if CHECKSUM_GEN_IP
-    IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN));
-#endif
-  } else {
-    iphdr = p->payload;
-    dest = &(iphdr->dest);
-  }
-
-#if IP_FRAG
-  /* don't fragment if interface has mtu set to 0 [loopif] */
-  if (netif->mtu && (p->tot_len > netif->mtu))
-    return ip_frag(p,netif,dest);
-#endif
-
-  IP_STATS_INC(ip.xmit);
-
-  LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c%"U16_F"\n", netif->name[0], netif->name[1], netif->num));
-  ip_debug_print(p);
-
-  LWIP_DEBUGF(IP_DEBUG, ("netif->output()"));
-
-  return netif->output(netif, p, dest);
-}
-
-/**
- * Simple interface to ip_output_if. It finds the outgoing network
- * interface and calls upon ip_output_if to do the actual work.
- */
-
-err_t
-ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
-          u8_t ttl, u8_t tos, u8_t proto)
-{
-  struct netif *netif;
-
-  if ((netif = ip_route(dest)) == NULL) {
-    LWIP_DEBUGF(IP_DEBUG | 2, ("ip_output: No route to 0x%"X32_F"\n", dest->addr));
-
-    IP_STATS_INC(ip.rterr);
-    snmp_inc_ipoutnoroutes();
-    return ERR_RTE;
-  }
-
-  return ip_output_if(p, src, dest, ttl, tos, proto, netif);
-}
-
-#if IP_DEBUG
-void
-ip_debug_print(struct pbuf *p)
-{
-  struct ip_hdr *iphdr = p->payload;
-  u8_t *payload;
-
-  payload = (u8_t *)iphdr + IP_HLEN;
-
-  LWIP_DEBUGF(IP_DEBUG, ("IP header:\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|%2"S16_F" |%2"S16_F" |  0x%02"X16_F" |     %5"U16_F"     | (v, hl, tos, len)\n",
-                    IPH_V(iphdr),
-                    IPH_HL(iphdr),
-                    IPH_TOS(iphdr),
-                    ntohs(IPH_LEN(iphdr))));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|    %5"U16_F"      |%"U16_F"%"U16_F"%"U16_F"|    %4"U16_F"   | (id, flags, offset)\n",
-                    ntohs(IPH_ID(iphdr)),
-                    ntohs(IPH_OFFSET(iphdr)) >> 15 & 1,
-                    ntohs(IPH_OFFSET(iphdr)) >> 14 & 1,
-                    ntohs(IPH_OFFSET(iphdr)) >> 13 & 1,
-                    ntohs(IPH_OFFSET(iphdr)) & IP_OFFMASK));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|  %3"U16_F"  |  %3"U16_F"  |    0x%04"X16_F"     | (ttl, proto, chksum)\n",
-                    IPH_TTL(iphdr),
-                    IPH_PROTO(iphdr),
-                    ntohs(IPH_CHKSUM(iphdr))));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|  %3"U16_F"  |  %3"U16_F"  |  %3"U16_F"  |  %3"U16_F"  | (src)\n",
-                    ip4_addr1(&iphdr->src),
-                    ip4_addr2(&iphdr->src),
-                    ip4_addr3(&iphdr->src),
-                    ip4_addr4(&iphdr->src)));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|  %3"U16_F"  |  %3"U16_F"  |  %3"U16_F"  |  %3"U16_F"  | (dest)\n",
-                    ip4_addr1(&iphdr->dest),
-                    ip4_addr2(&iphdr->dest),
-                    ip4_addr3(&iphdr->dest),
-                    ip4_addr4(&iphdr->dest)));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-}
-#endif /* IP_DEBUG */
-
-
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/ipv4/ip_addr.c b/src/VBox/Devices/Network/lwip/src/core/ipv4/ip_addr.c
deleted file mode 100644
index 6dd2c49..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/ipv4/ip_addr.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/inet.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-
-#define IP_ADDR_ANY_VALUE 0x00000000UL
-#define IP_ADDR_BROADCAST_VALUE 0xffffffffUL
-
-/* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in ip_addr.h */
-const struct ip_addr ip_addr_any = { IP_ADDR_ANY_VALUE };
-const struct ip_addr ip_addr_broadcast = { IP_ADDR_BROADCAST_VALUE };
-
-/* Determine if an address is a broadcast address on a network interface 
- * 
- * @param addr address to be checked
- * @param netif the network interface against which the address is checked
- * @return returns non-zero if the address is a broadcast address
- *
- */
-
-u8_t ip_addr_isbroadcast(struct ip_addr *addr, struct netif *netif)
-{
-  u32_t addr2test;
-
-  addr2test = addr->addr;
-  /* all ones (broadcast) or all zeroes (old skool broadcast) */
-  if ((~addr2test == IP_ADDR_ANY_VALUE) ||
-      (addr2test == IP_ADDR_ANY_VALUE))
-    return 1;
-  /* no broadcast support on this network interface? */
-  else if ((netif->flags & NETIF_FLAG_BROADCAST) == 0)
-    /* the given address cannot be a broadcast address
-     * nor can we check against any broadcast addresses */
-    return 0;
-  /* address matches network interface address exactly? => no broadcast */
-  else if (addr2test == netif->ip_addr.addr)
-    return 0;
-  /*  on the same (sub) network... */
-  else if (ip_addr_netcmp(addr, &(netif->ip_addr), &(netif->netmask))
-         /* ...and host identifier bits are all ones? =>... */
-          && ((addr2test & ~netif->netmask.addr) ==
-           (IP_ADDR_BROADCAST_VALUE & ~netif->netmask.addr)))
-    /* => network broadcast address */
-    return 1;
-  else
-    return 0;
-}
diff --git a/src/VBox/Devices/Network/lwip/src/core/ipv4/ip_frag.c b/src/VBox/Devices/Network/lwip/src/core/ipv4/ip_frag.c
deleted file mode 100644
index d552355..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/ipv4/ip_frag.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/* @file
- * 
- * This is the IP packet segmentation and reassembly implementation.
- *
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Jani Monoses <jani at iv.ro> 
- * original reassembly code by Adam Dunkels <adam at sics.se>
- * 
- */
-
-#include <string.h>
-
-#include "lwip/opt.h"
-#include "lwip/ip.h"
-#include "lwip/ip_frag.h"
-#include "lwip/netif.h"
-#include "lwip/snmp.h"
-#include "lwip/stats.h"
-
-static u8_t ip_reassbuf[IP_HLEN + IP_REASS_BUFSIZE];
-static u8_t ip_reassbitmap[IP_REASS_BUFSIZE / (8 * 8) + 1];
-static const u8_t bitmap_bits[8] = { 0xff, 0x7f, 0x3f, 0x1f,
-  0x0f, 0x07, 0x03, 0x01
-};
-static u16_t ip_reasslen;
-static u8_t ip_reassflags;
-#define IP_REASS_FLAG_LASTFRAG 0x01
-
-static u8_t ip_reasstmr;
-
-/*
- * Copy len bytes from offset in pbuf to buffer 
- *
- * helper used by both ip_reass and ip_frag
- */
-static struct pbuf *
-copy_from_pbuf(struct pbuf *p, u16_t * offset,
-           u8_t * buffer, u16_t len)
-{
-  u16_t l;
-
-  p->payload = (u8_t *)p->payload + *offset;
-  p->len -= *offset;
-  while (len) {
-    l = len < p->len ? len : p->len;
-    memcpy(buffer, p->payload, l);
-    buffer += l;
-    len -= l;
-    if (len)
-      p = p->next;
-    else
-      *offset = l;
-  }
-  return p;
-}
-
-
-/**
- * Initializes IP reassembly and fragmentation states.
- */
-void
-ip_frag_init(void)
-{
-  ip_reasstmr = 0;
-  ip_reassflags = 0;
-  ip_reasslen = 0;
-  memset(ip_reassbitmap, 0, sizeof(ip_reassbitmap));
-}
-
-/**
- * Reassembly timer base function
- * for both NO_SYS == 0 and 1 (!).
- *
- * Should be called every 1000 msec.
- */
-void
-ip_reass_tmr(void)
-{
-  if (ip_reasstmr > 0) {
-    ip_reasstmr--;
-    LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass_tmr: timer dec %"U16_F"\n",(u16_t)ip_reasstmr));
-    if (ip_reasstmr == 0) {
-      /* reassembly timed out */
-      snmp_inc_ipreasmfails();
-    }
-  }
-}
-
-/**
- * Reassembles incoming IP fragments into an IP datagram.
- *
- * @param p points to a pbuf chain of the fragment
- * @return NULL if reassembly is incomplete, ? otherwise
- */
-struct pbuf *
-ip_reass(struct pbuf *p)
-{
-  struct pbuf *q;
-  struct ip_hdr *fraghdr, *iphdr;
-  u16_t offset, len;
-  u16_t i;
-
-  IPFRAG_STATS_INC(ip_frag.recv);
-  snmp_inc_ipreasmreqds();
-
-  iphdr = (struct ip_hdr *) ip_reassbuf;
-  fraghdr = (struct ip_hdr *) p->payload;
-  /* If ip_reasstmr is zero, no packet is present in the buffer, so we
-     write the IP header of the fragment into the reassembly
-     buffer. The timer is updated with the maximum age. */
-  if (ip_reasstmr == 0) {
-    LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: new packet\n"));
-    memcpy(iphdr, fraghdr, IP_HLEN);
-    ip_reasstmr = IP_REASS_MAXAGE;
-    ip_reassflags = 0;
-    /* Clear the bitmap. */
-    memset(ip_reassbitmap, 0, sizeof(ip_reassbitmap));
-  }
-
-  /* Check if the incoming fragment matches the one currently present
-     in the reasembly buffer. If so, we proceed with copying the
-     fragment into the buffer. */
-  if (ip_addr_cmp(&iphdr->src, &fraghdr->src) &&
-      ip_addr_cmp(&iphdr->dest, &fraghdr->dest) &&
-      IPH_ID(iphdr) == IPH_ID(fraghdr)) {
-    LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: matching previous fragment ID=%"X16_F"\n",
-      ntohs(IPH_ID(fraghdr))));
-    IPFRAG_STATS_INC(ip_frag.cachehit);
-    /* Find out the offset in the reassembly buffer where we should
-       copy the fragment. */
-    len = ntohs(IPH_LEN(fraghdr)) - IPH_HL(fraghdr) * 4;
-    offset = (ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) * 8;
-
-    /* If the offset or the offset + fragment length overflows the
-       reassembly buffer, we discard the entire packet. */
-    if ((offset > IP_REASS_BUFSIZE) || ((offset + len) > IP_REASS_BUFSIZE)) {
-      LWIP_DEBUGF(IP_REASS_DEBUG,
-       ("ip_reass: fragment outside of buffer (%"S16_F":%"S16_F"/%"S16_F").\n", offset,
-        offset + len, IP_REASS_BUFSIZE));
-      ip_reasstmr = 0;
-      snmp_inc_ipreasmfails();
-      goto nullreturn;
-    }
-
-    /* Copy the fragment into the reassembly buffer, at the right
-       offset. */
-    LWIP_DEBUGF(IP_REASS_DEBUG,
-     ("ip_reass: copying with offset %"S16_F" into %"S16_F":%"S16_F"\n", offset,
-      IP_HLEN + offset, IP_HLEN + offset + len));
-    i = IPH_HL(fraghdr) * 4;
-    copy_from_pbuf(p, &i, &ip_reassbuf[IP_HLEN + offset], len);
-
-    /* Update the bitmap. */
-    if (offset / (8 * 8) == (offset + len) / (8 * 8)) {
-      LWIP_DEBUGF(IP_REASS_DEBUG,
-       ("ip_reass: updating single byte in bitmap.\n"));
-      /* If the two endpoints are in the same byte, we only update that byte. */
-      LWIP_ASSERT("offset / (8 * 8) < sizeof(ip_reassbitmap)",
-                   offset / (8 * 8) < sizeof(ip_reassbitmap));
-      ip_reassbitmap[offset / (8 * 8)] |=
-        bitmap_bits[(offset / 8) & 7] &
-        ~bitmap_bits[((offset + len) / 8) & 7];
-    } else {
-      /* If the two endpoints are in different bytes, we update the
-         bytes in the endpoints and fill the stuff inbetween with
-         0xff. */
-      LWIP_ASSERT("offset / (8 * 8) < sizeof(ip_reassbitmap)",
-                   offset / (8 * 8) < sizeof(ip_reassbitmap));
-      ip_reassbitmap[offset / (8 * 8)] |= bitmap_bits[(offset / 8) & 7];
-      LWIP_DEBUGF(IP_REASS_DEBUG,
-       ("ip_reass: updating many bytes in bitmap (%"S16_F":%"S16_F").\n",
-        1 + offset / (8 * 8), (offset + len) / (8 * 8)));
-      for (i = 1 + offset / (8 * 8); i < (offset + len) / (8 * 8); ++i) {
-        ip_reassbitmap[i] = 0xff;
-      }
-      LWIP_ASSERT("(offset + len) / (8 * 8) < sizeof(ip_reassbitmap)",
-                   (offset + len) / (8 * 8) < sizeof(ip_reassbitmap));
-      ip_reassbitmap[(offset + len) / (8 * 8)] |=
-        ~bitmap_bits[((offset + len) / 8) & 7];
-    }
-
-    /* If this fragment has the More Fragments flag set to zero, we
-       know that this is the last fragment, so we can calculate the
-       size of the entire packet. We also set the
-       IP_REASS_FLAG_LASTFRAG flag to indicate that we have received
-       the final fragment. */
-
-    if ((ntohs(IPH_OFFSET(fraghdr)) & IP_MF) == 0) {
-      ip_reassflags |= IP_REASS_FLAG_LASTFRAG;
-      ip_reasslen = offset + len;
-      LWIP_DEBUGF(IP_REASS_DEBUG,
-       ("ip_reass: last fragment seen, total len %"S16_F"\n",
-        ip_reasslen));
-    }
-
-    /* Finally, we check if we have a full packet in the buffer. We do
-       this by checking if we have the last fragment and if all bits
-       in the bitmap are set. */
-    if (ip_reassflags & IP_REASS_FLAG_LASTFRAG) {
-      /* Check all bytes up to and including all but the last byte in
-         the bitmap. */
-      LWIP_ASSERT("ip_reasslen / (8 * 8) - 1 < sizeof(ip_reassbitmap)",
-                   ip_reasslen / (8 * 8) - 1 < sizeof(ip_reassbitmap));
-      for (i = 0; i < ip_reasslen / (8 * 8) - 1; ++i) {
-        if (ip_reassbitmap[i] != 0xff) {
-          LWIP_DEBUGF(IP_REASS_DEBUG,
-           ("ip_reass: last fragment seen, bitmap %"S16_F"/%"S16_F" failed (%"X16_F")\n",
-            i, ip_reasslen / (8 * 8) - 1, ip_reassbitmap[i]));
-          goto nullreturn;
-        }
-      }
-      /* Check the last byte in the bitmap. It should contain just the
-         right amount of bits. */
-      LWIP_ASSERT("ip_reasslen / (8 * 8) < sizeof(ip_reassbitmap)",
-                   ip_reasslen / (8 * 8) < sizeof(ip_reassbitmap));
-      if (ip_reassbitmap[ip_reasslen / (8 * 8)] !=
-        (u8_t) ~ bitmap_bits[ip_reasslen / 8 & 7]) {
-         LWIP_DEBUGF(IP_REASS_DEBUG,
-          ("ip_reass: last fragment seen, bitmap %"S16_F" didn't contain %"X16_F" (%"X16_F")\n",
-        ip_reasslen / (8 * 8), ~bitmap_bits[ip_reasslen / 8 & 7],
-        ip_reassbitmap[ip_reasslen / (8 * 8)]));
-        goto nullreturn;
-      }
-
-      /* Pretend to be a "normal" (i.e., not fragmented) IP packet
-         from now on. */
-      ip_reasslen += IP_HLEN;
-
-      IPH_LEN_SET(iphdr, htons(ip_reasslen));
-      IPH_OFFSET_SET(iphdr, 0);
-      IPH_CHKSUM_SET(iphdr, 0);
-      IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN));
-
-      /* If we have come this far, we have a full packet in the
-         buffer, so we allocate a pbuf and copy the packet into it. We
-         also reset the timer. */
-      ip_reasstmr = 0;
-      pbuf_free(p);
-      p = pbuf_alloc(PBUF_LINK, ip_reasslen, PBUF_POOL);
-      if (p != NULL) {
-        i = 0;
-        for (q = p; q != NULL; q = q->next) {
-          /* Copy enough bytes to fill this pbuf in the chain. The
-             available data in the pbuf is given by the q->len variable. */
-          LWIP_DEBUGF(IP_REASS_DEBUG,
-           ("ip_reass: memcpy from %p (%"S16_F") to %p, %"S16_F" bytes\n",
-            (void *)&ip_reassbuf[i], i, q->payload,
-            q->len > ip_reasslen - i ? ip_reasslen - i : q->len));
-          memcpy(q->payload, &ip_reassbuf[i],
-            q->len > ip_reasslen - i ? ip_reasslen - i : q->len);
-          i += q->len;
-        }
-        IPFRAG_STATS_INC(ip_frag.fw);
-        snmp_inc_ipreasmoks();
-      } else {
-        LWIP_DEBUGF(IP_REASS_DEBUG,
-          ("ip_reass: pbuf_alloc(PBUF_LINK, ip_reasslen=%"U16_F", PBUF_POOL) failed\n", ip_reasslen));
-        IPFRAG_STATS_INC(ip_frag.memerr);
-        snmp_inc_ipreasmfails();
-      }
-      LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: p %p\n", (void*)p));
-      return p;
-    }
-  }
-
-nullreturn:
-  IPFRAG_STATS_INC(ip_frag.drop);
-  pbuf_free(p);
-  return NULL;
-}
-
-static u8_t buf[MEM_ALIGN_SIZE(IP_FRAG_MAX_MTU)];
-
-/**
- * Fragment an IP datagram if too large for the netif.
- *
- * Chop the datagram in MTU sized chunks and send them in order
- * by using a fixed size static memory buffer (PBUF_ROM)
- */
-err_t 
-ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
-{
-  struct pbuf *rambuf;
-  struct pbuf *header;
-  struct ip_hdr *iphdr;
-  u16_t nfb = 0;
-  u16_t left, cop;
-  u16_t mtu = netif->mtu;
-  u16_t ofo, omf;
-  u16_t last;
-  u16_t poff = IP_HLEN;
-  u16_t tmp;
-
-  /* Get a RAM based MTU sized pbuf */
-  rambuf = pbuf_alloc(PBUF_LINK, 0, PBUF_REF);
-  if (rambuf == NULL) {
-    LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_frag: pbuf_alloc(PBUF_LINK, 0, PBUF_REF) failed\n"));
-    return ERR_MEM;
-  }
-  rambuf->tot_len = rambuf->len = mtu;
-  rambuf->payload = MEM_ALIGN((void *)buf);
-
-  /* Copy the IP header in it */
-  iphdr = rambuf->payload;
-  memcpy(iphdr, p->payload, IP_HLEN);
-
-  /* Save original offset */
-  tmp = ntohs(IPH_OFFSET(iphdr));
-  ofo = tmp & IP_OFFMASK;
-  omf = tmp & IP_MF;
-
-  left = p->tot_len - IP_HLEN;
-
-  while (left) {
-    last = (left <= mtu - IP_HLEN);
-
-    /* Set new offset and MF flag */
-    ofo += nfb;
-    tmp = omf | (IP_OFFMASK & (ofo));
-    if (!last)
-      tmp = tmp | IP_MF;
-    IPH_OFFSET_SET(iphdr, htons(tmp));
-
-    /* Fill this fragment */
-    nfb = (mtu - IP_HLEN) / 8;
-    cop = last ? left : nfb * 8;
-
-    p = copy_from_pbuf(p, &poff, (u8_t *) iphdr + IP_HLEN, cop);
-
-    /* Correct header */
-    IPH_LEN_SET(iphdr, htons(cop + IP_HLEN));
-    IPH_CHKSUM_SET(iphdr, 0);
-    IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN));
-
-    if (last)
-      pbuf_realloc(rambuf, left + IP_HLEN);
-    /* This part is ugly: we alloc a RAM based pbuf for 
-     * the link level header for each chunk and then 
-     * free it.A PBUF_ROM style pbuf for which pbuf_header
-     * worked would make things simpler.
-     */
-    header = pbuf_alloc(PBUF_LINK, 0, PBUF_RAM);
-    if (header != NULL) {
-      pbuf_chain(header, rambuf);
-      netif->output(netif, header, dest);
-      IPFRAG_STATS_INC(ip_frag.xmit);
-      snmp_inc_ipfragcreates();
-      pbuf_free(header);
-    } else {
-      LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_frag: pbuf_alloc() for header failed\n"));
-      pbuf_free(rambuf);      
-      return ERR_MEM;    
-    }
-    left -= cop;
-  }
-  pbuf_free(rambuf);
-  snmp_inc_ipfragoks();
-  return ERR_OK;
-}
diff --git a/src/VBox/Devices/Network/lwip/src/core/ipv6/README b/src/VBox/Devices/Network/lwip/src/core/ipv6/README
deleted file mode 100644
index 3620004..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/ipv6/README
+++ /dev/null
@@ -1 +0,0 @@
-IPv6 support in lwIP is very experimental.
diff --git a/src/VBox/Devices/Network/lwip/src/core/ipv6/icmp6.c b/src/VBox/Devices/Network/lwip/src/core/ipv6/icmp6.c
deleted file mode 100644
index 10b6903..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/ipv6/icmp6.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-/* Some ICMP messages should be passed to the transport protocols. This
-   is not implemented. */
-
-#include "lwip/opt.h"
-
-#include "lwip/icmp.h"
-#include "lwip/inet.h"
-#include "lwip/ip.h"
-#include "lwip/def.h"
-
-#include "lwip/stats.h"
-
-
-void
-icmp_input(struct pbuf *p, struct netif *inp)
-{
-  u8_t type;
-  struct icmp_echo_hdr *iecho;
-  struct ip_hdr *iphdr;
-  struct ip_addr tmpaddr;
-
-#ifdef ICMP_STATS
-  ++lwip_stats.icmp.recv;
-#endif /* ICMP_STATS */
-
-  /* TODO: check length before accessing payload! */
-
-  type = ((u8_t *)p->payload)[0];
-
-  switch (type) {
-  case ICMP6_ECHO:
-    LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n"));
-
-    if (p->tot_len < sizeof(struct icmp_echo_hdr)) {
-      LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n"));
-
-      pbuf_free(p);
-#ifdef ICMP_STATS
-      ++lwip_stats.icmp.lenerr;
-#endif /* ICMP_STATS */
-
-      return;
-    }
-    iecho = p->payload;
-    iphdr = (struct ip_hdr *)((u8_t *)p->payload - IP_HLEN);
-    if (inet_chksum_pbuf(p) != 0) {
-      LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%"X16_F")\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len)));
-
-#ifdef ICMP_STATS
-      ++lwip_stats.icmp.chkerr;
-#endif /* ICMP_STATS */
-    /*      return;*/
-    }
-    LWIP_DEBUGF(ICMP_DEBUG, ("icmp: p->len %"S16_F" p->tot_len %"S16_F"\n", p->len, p->tot_len));
-    ip_addr_set(&tmpaddr, &(iphdr->src));
-    ip_addr_set(&(iphdr->src), &(iphdr->dest));
-    ip_addr_set(&(iphdr->dest), &tmpaddr);
-    iecho->type = ICMP6_ER;
-    /* adjust the checksum */
-    if (iecho->chksum >= htons(0xffff - (ICMP6_ECHO << 8))) {
-      iecho->chksum += htons(ICMP6_ECHO << 8) + 1;
-    } else {
-      iecho->chksum += htons(ICMP6_ECHO << 8);
-    }
-    LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%"X16_F")\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len)));
-#ifdef ICMP_STATS
-    ++lwip_stats.icmp.xmit;
-#endif /* ICMP_STATS */
-
-    /*    LWIP_DEBUGF("icmp: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len);*/
-    ip_output_if (p, &(iphdr->src), IP_HDRINCL,
-     iphdr->hoplim, IP_PROTO_ICMP, inp);
-    break;
-  default:
-    LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %"S16_F" not supported.\n", (s16_t)type));
-#ifdef ICMP_STATS
-    ++lwip_stats.icmp.proterr;
-    ++lwip_stats.icmp.drop;
-#endif /* ICMP_STATS */
-  }
-
-  pbuf_free(p);
-}
-
-void
-icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
-{
-  struct pbuf *q;
-  struct ip_hdr *iphdr;
-  struct icmp_dur_hdr *idur;
-
-  q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM);
-  /* ICMP header + IP header + 8 bytes of data */
-
-  iphdr = p->payload;
-
-  idur = q->payload;
-  idur->type = (u8_t)ICMP6_DUR;
-  idur->icode = (u8_t)t;
-
-  memcpy((u8_t *)q->payload + 8, p->payload, IP_HLEN + 8);
-
-  /* calculate checksum */
-  idur->chksum = 0;
-  idur->chksum = inet_chksum(idur, q->len);
-#ifdef ICMP_STATS
-  ++lwip_stats.icmp.xmit;
-#endif /* ICMP_STATS */
-
-  ip_output(q, NULL,
-      (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP);
-  pbuf_free(q);
-}
-
-void
-icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
-{
-  struct pbuf *q;
-  struct ip_hdr *iphdr;
-  struct icmp_te_hdr *tehdr;
-
-  LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded\n"));
-
-  q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM);
-
-  iphdr = p->payload;
-
-  tehdr = q->payload;
-  tehdr->type = (u8_t)ICMP6_TE;
-  tehdr->icode = (u8_t)t;
-
-  /* copy fields from original packet */
-  memcpy((u8_t *)q->payload + 8, (u8_t *)p->payload, IP_HLEN + 8);
-
-  /* calculate checksum */
-  tehdr->chksum = 0;
-  tehdr->chksum = inet_chksum(tehdr, q->len);
-#ifdef ICMP_STATS
-  ++lwip_stats.icmp.xmit;
-#endif /* ICMP_STATS */
-  ip_output(q, NULL,
-      (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP);
-  pbuf_free(q);
-}
-
-
-
-
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/ipv6/ip6.c b/src/VBox/Devices/Network/lwip/src/core/ipv6/ip6.c
deleted file mode 100644
index 03037c8..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/ipv6/ip6.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-
-
-/* ip.c
- *
- * This is the code for the IP layer for IPv6.
- *
- */
-
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/mem.h"
-#include "lwip/ip.h"
-#include "lwip/inet.h"
-#include "lwip/netif.h"
-#include "lwip/icmp.h"
-#include "lwip/udp.h"
-#include "lwip/tcp.h"
-
-#include "lwip/stats.h"
-
-#include "arch/perf.h"
-
-/* ip_init:
- *
- * Initializes the IP layer.
- */
-
-void
-ip_init(void)
-{
-}
-
-/* ip_route:
- *
- * Finds the appropriate network interface for a given IP address. It searches the
- * list of network interfaces linearly. A match is found if the masked IP address of
- * the network interface equals the masked IP address given to the function.
- */
-
-struct netif *
-ip_route(struct ip_addr *dest)
-{
-  struct netif *netif;
-
-  for(netif = netif_list; netif != NULL; netif = netif->next) {
-    if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
-      return netif;
-    }
-  }
-
-  return netif_default;
-}
-
-/* ip_forward:
- *
- * Forwards an IP packet. It finds an appropriate route for the packet, decrements
- * the TTL value of the packet, adjusts the checksum and outputs the packet on the
- * appropriate interface.
- */
-
-static void
-ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
-{
-  struct netif *netif;
-
-  PERF_START;
-
-  if ((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) {
-
-    LWIP_DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for "));
-#if IP_DEBUG
-    ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
-#endif /* IP_DEBUG */
-    LWIP_DEBUGF(IP_DEBUG, ("\n"));
-    pbuf_free(p);
-    return;
-  }
-  /* Decrement TTL and send ICMP if ttl == 0. */
-  if (--iphdr->hoplim == 0) {
-    /* Don't send ICMP messages in response to ICMP messages */
-    if (iphdr->nexthdr != IP_PROTO_ICMP) {
-      icmp_time_exceeded(p, ICMP_TE_TTL);
-    }
-    pbuf_free(p);
-    return;
-  }
-
-  /* Incremental update of the IP checksum. */
-  /*  if (iphdr->chksum >= htons(0xffff - 0x100)) {
-    iphdr->chksum += htons(0x100) + 1;
-  } else {
-    iphdr->chksum += htons(0x100);
-    }*/
-
-
-  LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to "));
-#if IP_DEBUG
-  ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
-#endif /* IP_DEBUG */
-  LWIP_DEBUGF(IP_DEBUG, ("\n"));
-
-#ifdef IP_STATS
-  ++lwip_stats.ip.fw;
-  ++lwip_stats.ip.xmit;
-#endif /* IP_STATS */
-
-  PERF_STOP("ip_forward");
-
-  netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
-}
-
-/* ip_input:
- *
- * This function is called by the network interface device driver when an IP packet is
- * received. The function does the basic checks of the IP header such as packet size
- * being at least larger than the header size etc. If the packet was not destined for
- * us, the packet is forwarded (using ip_forward). The IP checksum is always checked.
- *
- * Finally, the packet is sent to the upper layer protocol input function.
- */
-
-void
-ip_input(struct pbuf *p, struct netif *inp) {
-  struct ip_hdr *iphdr;
-  struct netif *netif;
-
-
-  PERF_START;
-
-#if IP_DEBUG
-  ip_debug_print(p);
-#endif /* IP_DEBUG */
-
-
-#ifdef IP_STATS
-  ++lwip_stats.ip.recv;
-#endif /* IP_STATS */
-
-  /* identify the IP header */
-  iphdr = p->payload;
-
-
-  if (iphdr->v != 6) {
-    LWIP_DEBUGF(IP_DEBUG, ("IP packet dropped due to bad version number\n"));
-#if IP_DEBUG
-    ip_debug_print(p);
-#endif /* IP_DEBUG */
-    pbuf_free(p);
-#ifdef IP_STATS
-    ++lwip_stats.ip.err;
-    ++lwip_stats.ip.drop;
-#endif /* IP_STATS */
-    return;
-  }
-
-  /* is this packet for us? */
-  for(netif = netif_list; netif != NULL; netif = netif->next) {
-#if IP_DEBUG
-    LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest "));
-    ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
-    LWIP_DEBUGF(IP_DEBUG, ("netif->ip_addr "));
-    ip_addr_debug_print(IP_DEBUG, &(netif->ip_addr));
-    LWIP_DEBUGF(IP_DEBUG, ("\n"));
-#endif /* IP_DEBUG */
-    if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {
-      break;
-    }
-  }
-
-
-  if (netif == NULL) {
-    /* packet not for us, route or discard */
-#ifdef IP_FORWARD
-    ip_forward(p, iphdr);
-#endif
-    pbuf_free(p);
-    return;
-  }
-
-  pbuf_realloc(p, IP_HLEN + ntohs(iphdr->len));
-
-  /* send to upper layers */
-#if IP_DEBUG
-  /*  LWIP_DEBUGF("ip_input: \n");
-  ip_debug_print(p);
-  LWIP_DEBUGF("ip_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len);*/
-#endif /* IP_DEBUG */
-
-
-  pbuf_header(p, -IP_HLEN);
-
-  switch (iphdr->nexthdr) {
-  case IP_PROTO_UDP:
-    udp_input(p);
-    break;
-  case IP_PROTO_TCP:
-    tcp_input(p);
-    break;
-  case IP_PROTO_ICMP:
-    icmp_input(p, inp);
-    break;
-  default:
-    /* send ICMP destination protocol unreachable */
-    icmp_dest_unreach(p, ICMP_DUR_PROTO);
-    pbuf_free(p);
-    LWIP_DEBUGF(IP_DEBUG, ("Unsupported transport protocol %"U16_F"\n",
-          iphdr->nexthdr));
-
-#ifdef IP_STATS
-    ++lwip_stats.ip.proterr;
-    ++lwip_stats.ip.drop;
-#endif /* IP_STATS */
-
-  }
-  PERF_STOP("ip_input");
-}
-
-
-/* ip_output_if:
- *
- * Sends an IP packet on a network interface. This function constructs the IP header
- * and calculates the IP header checksum. If the source IP address is NULL,
- * the IP address of the outgoing network interface is filled in as source address.
- */
-
-err_t
-ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
-       u8_t ttl,
-       u8_t proto, struct netif *netif)
-{
-  struct ip_hdr *iphdr;
-
-  PERF_START;
-
-  printf("len %"U16_F" tot_len %"U16_F"\n", p->len, p->tot_len);
-  if (pbuf_header(p, IP_HLEN)) {
-    LWIP_DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n"));
-#ifdef IP_STATS
-    ++lwip_stats.ip.err;
-#endif /* IP_STATS */
-
-    return ERR_BUF;
-  }
-  printf("len %"U16_F" tot_len %"U16_F"\n", p->len, p->tot_len);
-
-  iphdr = p->payload;
-
-
-  if (dest != IP_HDRINCL) {
-    printf("!IP_HDRLINCL\n");
-    iphdr->hoplim = ttl;
-    iphdr->nexthdr = proto;
-    iphdr->len = htons(p->tot_len - IP_HLEN);
-    ip_addr_set(&(iphdr->dest), dest);
-
-    iphdr->v = 6;
-
-    if (ip_addr_isany(src)) {
-      ip_addr_set(&(iphdr->src), &(netif->ip_addr));
-    } else {
-      ip_addr_set(&(iphdr->src), src);
-    }
-
-  } else {
-    dest = &(iphdr->dest);
-  }
-
-#ifdef IP_STATS
-  ++lwip_stats.ip.xmit;
-#endif /* IP_STATS */
-
-  LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c (len %"U16_F")\n", netif->name[0], netif->name[1], p->tot_len));
-#if IP_DEBUG
-  ip_debug_print(p);
-#endif /* IP_DEBUG */
-
-  PERF_STOP("ip_output_if");
-  return netif->output(netif, p, dest);
-}
-
-/* ip_output:
- *
- * Simple interface to ip_output_if. It finds the outgoing network interface and
- * calls upon ip_output_if to do the actual work.
- */
-
-err_t
-ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
-    u8_t ttl, u8_t proto)
-{
-  struct netif *netif;
-  if ((netif = ip_route(dest)) == NULL) {
-    LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%"X32_F"\n", dest->addr));
-#ifdef IP_STATS
-    ++lwip_stats.ip.rterr;
-#endif /* IP_STATS */
-    return ERR_RTE;
-  }
-
-  return ip_output_if (p, src, dest, ttl, proto, netif);
-}
-
-#if IP_DEBUG
-void
-ip_debug_print(struct pbuf *p)
-{
-  struct ip_hdr *iphdr = p->payload;
-  u8_t *payload;
-
-  payload = (u8_t *)iphdr + IP_HLEN;
-
-  LWIP_DEBUGF(IP_DEBUG, ("IP header:\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|%2"S16_F" |  %"X16_F"%"X16_F"  |      %"X16_F"%"X16_F"           | (v, traffic class, flow label)\n",
-        iphdr->v,
-        iphdr->tclass1, iphdr->tclass2,
-        iphdr->flow1, iphdr->flow2));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|    %5"U16_F"      | %2"U16_F"  |  %2"U16_F"   | (len, nexthdr, hoplim)\n",
-        ntohs(iphdr->len),
-        iphdr->nexthdr,
-        iphdr->hoplim));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|       %4"X32_F"      |       %4"X32_F"     | (src)\n",
-        ntohl(iphdr->src.addr[0]) >> 16 & 0xffff,
-        ntohl(iphdr->src.addr[0]) & 0xffff));
-  LWIP_DEBUGF(IP_DEBUG, ("|       %4"X32_F"      |       %4"X32_F"     | (src)\n",
-        ntohl(iphdr->src.addr[1]) >> 16 & 0xffff,
-        ntohl(iphdr->src.addr[1]) & 0xffff));
-  LWIP_DEBUGF(IP_DEBUG, ("|       %4"X32_F"      |       %4"X32_F"     | (src)\n",
-        ntohl(iphdr->src.addr[2]) >> 16 & 0xffff,
-        ntohl(iphdr->src.addr[2]) & 0xffff));
-  LWIP_DEBUGF(IP_DEBUG, ("|       %4"X32_F"      |       %4"X32_F"     | (src)\n",
-        ntohl(iphdr->src.addr[3]) >> 16 & 0xffff,
-        ntohl(iphdr->src.addr[3]) & 0xffff));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(IP_DEBUG, ("|       %4"X32_F"      |       %4"X32_F"     | (dest)\n",
-        ntohl(iphdr->dest.addr[0]) >> 16 & 0xffff,
-        ntohl(iphdr->dest.addr[0]) & 0xffff));
-  LWIP_DEBUGF(IP_DEBUG, ("|       %4"X32_F"      |       %4"X32_F"     | (dest)\n",
-        ntohl(iphdr->dest.addr[1]) >> 16 & 0xffff,
-        ntohl(iphdr->dest.addr[1]) & 0xffff));
-  LWIP_DEBUGF(IP_DEBUG, ("|       %4"X32_F"      |       %4"X32_F"     | (dest)\n",
-        ntohl(iphdr->dest.addr[2]) >> 16 & 0xffff,
-        ntohl(iphdr->dest.addr[2]) & 0xffff));
-  LWIP_DEBUGF(IP_DEBUG, ("|       %4"X32_F"      |       %4"X32_F"     | (dest)\n",
-        ntohl(iphdr->dest.addr[3]) >> 16 & 0xffff,
-        ntohl(iphdr->dest.addr[3]) & 0xffff));
-  LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
-}
-#endif /* IP_DEBUG */
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/ipv6/ip6_addr.c b/src/VBox/Devices/Network/lwip/src/core/ipv6/ip6_addr.c
deleted file mode 100644
index dcb5078..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/ipv6/ip6_addr.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/ip_addr.h"
-#include "lwip/inet.h"
-
-
-u8_t
-ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2,
-                struct ip_addr *mask)
-{
-  return((addr1->addr[0] & mask->addr[0]) == (addr2->addr[0] & mask->addr[0]) &&
-         (addr1->addr[1] & mask->addr[1]) == (addr2->addr[1] & mask->addr[1]) &&
-         (addr1->addr[2] & mask->addr[2]) == (addr2->addr[2] & mask->addr[2]) &&
-         (addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3]));
-        
-}
-
-u8_t
-ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2)
-{
-  return(addr1->addr[0] == addr2->addr[0] &&
-         addr1->addr[1] == addr2->addr[1] &&
-         addr1->addr[2] == addr2->addr[2] &&
-         addr1->addr[3] == addr2->addr[3]);
-}
-
-void
-ip_addr_set(struct ip_addr *dest, struct ip_addr *src)
-{
-  memcpy(dest, src, sizeof(struct ip_addr));
-  /*  dest->addr[0] = src->addr[0];
-  dest->addr[1] = src->addr[1];
-  dest->addr[2] = src->addr[2];
-  dest->addr[3] = src->addr[3];*/
-}
-
-u8_t
-ip_addr_isany(struct ip_addr *addr)
-{
-  if (addr == NULL) return 1;
-  return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0);
-}
-
-
-/*#if IP_DEBUG*/
-void
-ip_addr_debug_print(struct ip_addr *addr)
-{
-  printf("%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F",
-         ntohl(addr->addr[0]) >> 16 & 0xffff,
-         ntohl(addr->addr[0]) & 0xffff,
-         ntohl(addr->addr[1]) >> 16 & 0xffff,
-         ntohl(addr->addr[1]) & 0xffff,
-         ntohl(addr->addr[2]) >> 16 & 0xffff,
-         ntohl(addr->addr[2]) & 0xffff,
-         ntohl(addr->addr[3]) >> 16 & 0xffff,
-         ntohl(addr->addr[3]) & 0xffff);
-}
-/*#endif*/ /* IP_DEBUG */
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/mem.c b/src/VBox/Devices/Network/lwip/src/core/mem.c
deleted file mode 100644
index 6ef311d..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/mem.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/** @file
- *
- * Dynamic memory manager
- *
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include <string.h>
-
-#include "lwip/arch.h"
-#include "lwip/opt.h"
-#include "lwip/def.h"
-#include "lwip/mem.h"
-
-#include "lwip/sys.h"
-
-#include "lwip/stats.h"
-
-#if (MEM_LIBC_MALLOC == 0)
-/* lwIP replacement for your libc malloc() */
-
-struct mem {
-  mem_size_t next, prev;
-#if MEM_ALIGNMENT == 1
-  u8_t used;
-#elif MEM_ALIGNMENT == 2
-  u16_t used;
-#elif MEM_ALIGNMENT == 4
-  u32_t used;
-#elif MEM_ALIGNMENT == 8
-  u64_t used;
-#else
-#error "unhandled MEM_ALIGNMENT size"
-#endif /* MEM_ALIGNMENT */
-};
-
-static struct mem *ram_end;
-#if 1
-/* Adam original */
-static u8_t ram[MEM_SIZE + sizeof(struct mem) + MEM_ALIGNMENT];
-#else
-/* Christiaan alignment fix */
-static u8_t *ram;
-static struct mem ram_heap[1 + ( (MEM_SIZE + sizeof(struct mem) - 1) / sizeof(struct mem))];
-#endif
-
-#define MIN_SIZE 12
-#if 0 /* this one does not align correctly for some, resulting in crashes */
-#define SIZEOF_STRUCT_MEM (unsigned int)MEM_ALIGN_SIZE(sizeof(struct mem))
-#else
-#define SIZEOF_STRUCT_MEM (sizeof(struct mem) + \
-                          (((sizeof(struct mem) % MEM_ALIGNMENT) == 0)? 0 : \
-                          (4 - (sizeof(struct mem) % MEM_ALIGNMENT))))
-#endif
-
-static struct mem *lfree;   /* pointer to the lowest free block */
-
-static sys_sem_t mem_sem;
-
-static void
-plug_holes(struct mem *mem)
-{
-  struct mem *nmem;
-  struct mem *pmem;
-
-  LWIP_ASSERT("plug_holes: mem >= ram", (u8_t *)mem >= ram);
-  LWIP_ASSERT("plug_holes: mem < ram_end", (u8_t *)mem < (u8_t *)ram_end);
-  LWIP_ASSERT("plug_holes: mem->used == 0", mem->used == 0);
-
-  /* plug hole forward */
-  LWIP_ASSERT("plug_holes: mem->next <= MEM_SIZE", mem->next <= MEM_SIZE);
-
-  nmem = (struct mem *)&ram[mem->next];
-  if (mem != nmem && nmem->used == 0 && (u8_t *)nmem != (u8_t *)ram_end) {
-    if (lfree == nmem) {
-      lfree = mem;
-    }
-    mem->next = nmem->next;
-    ((struct mem *)&ram[nmem->next])->prev = (u8_t *)mem - ram;
-  }
-
-  /* plug hole backward */
-  pmem = (struct mem *)&ram[mem->prev];
-  if (pmem != mem && pmem->used == 0) {
-    if (lfree == mem) {
-      lfree = pmem;
-    }
-    pmem->next = mem->next;
-    ((struct mem *)&ram[mem->next])->prev = (u8_t *)pmem - ram;
-  }
-}
-
-void
-mem_init(void)
-{
-  struct mem *mem;
-
-#if 1
-  /* Adam original */
-#else
-  /* Christiaan alignment fix */
-  ram = (u8_t*)ram_heap;
-#endif
-  memset(ram, 0, MEM_SIZE);
-  mem = (struct mem *)ram;
-  mem->next = MEM_SIZE;
-  mem->prev = 0;
-  mem->used = 0;
-  ram_end = (struct mem *)&ram[MEM_SIZE];
-  ram_end->used = 1;
-  ram_end->next = MEM_SIZE;
-  ram_end->prev = MEM_SIZE;
-
-  mem_sem = sys_sem_new(1);
-
-  lfree = (struct mem *)ram;
-
-#if MEM_STATS
-  lwip_stats.mem.avail = MEM_SIZE;
-#endif /* MEM_STATS */
-}
-
-void
-mem_free(void *rmem)
-{
-  struct mem *mem;
-
-  if (rmem == NULL) {
-    LWIP_DEBUGF(MEM_DEBUG | DBG_TRACE | 2, ("mem_free(p == NULL) was called.\n"));
-    return;
-  }
-
-  sys_sem_wait(mem_sem);
-
-  LWIP_ASSERT("mem_free: legal memory", (u8_t *)rmem >= (u8_t *)ram &&
-    (u8_t *)rmem < (u8_t *)ram_end);
-
-  if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) {
-    LWIP_DEBUGF(MEM_DEBUG | 3, ("mem_free: illegal memory\n"));
-#if MEM_STATS
-    ++lwip_stats.mem.err;
-#endif /* MEM_STATS */
-    sys_sem_signal(mem_sem);
-    return;
-  }
-  mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM);
-
-  LWIP_ASSERT("mem_free: mem->used", mem->used);
-
-  mem->used = 0;
-
-  if (mem < lfree) {
-    lfree = mem;
-  }
-
-#if MEM_STATS
-  lwip_stats.mem.used -= mem->next - ((u8_t *)mem - ram);
-
-#endif /* MEM_STATS */
-  plug_holes(mem);
-  sys_sem_signal(mem_sem);
-}
-
-void *
-mem_realloc(void *rmem, mem_size_t newsize)
-{
-  mem_size_t size;
-  mem_size_t ptr, ptr2;
-  struct mem *mem, *mem2;
-
-  /* Expand the size of the allocated memory region so that we can
-     adjust for alignment. */
-  if ((newsize % MEM_ALIGNMENT) != 0) {
-   newsize += MEM_ALIGNMENT - ((newsize + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT);
-  }
-
-  if (newsize > MEM_SIZE) {
-    return NULL;
-  }
-
-  sys_sem_wait(mem_sem);
-
-  LWIP_ASSERT("mem_realloc: legal memory", (u8_t *)rmem >= (u8_t *)ram &&
-   (u8_t *)rmem < (u8_t *)ram_end);
-
-  if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) {
-    LWIP_DEBUGF(MEM_DEBUG | 3, ("mem_realloc: illegal memory\n"));
-    return rmem;
-  }
-  mem = (struct mem *)((u8_t *)rmem - SIZEOF_STRUCT_MEM);
-
-  ptr = (u8_t *)mem - ram;
-
-  size = mem->next - ptr - SIZEOF_STRUCT_MEM;
-#if MEM_STATS
-  lwip_stats.mem.used -= (size - newsize);
-#endif /* MEM_STATS */
-
-  if (newsize + SIZEOF_STRUCT_MEM + MIN_SIZE < size) {
-    ptr2 = ptr + SIZEOF_STRUCT_MEM + newsize;
-    mem2 = (struct mem *)&ram[ptr2];
-    mem2->used = 0;
-    mem2->next = mem->next;
-    mem2->prev = ptr;
-    mem->next = ptr2;
-    if (mem2->next != MEM_SIZE) {
-      ((struct mem *)&ram[mem2->next])->prev = ptr2;
-    }
-
-    plug_holes(mem2);
-  }
-  sys_sem_signal(mem_sem);
-  return rmem;
-}
-
-#if 1
-/**
- * Adam's mem_malloc(), suffers from bug #17922
- * Set if to 0 for alternative mem_malloc().
- */
-void *
-mem_malloc(mem_size_t size)
-{
-  mem_size_t ptr, ptr2;
-  struct mem *mem, *mem2;
-
-  if (size == 0) {
-    return NULL;
-  }
-
-  /* Expand the size of the allocated memory region so that we can
-     adjust for alignment. */
-  if ((size % MEM_ALIGNMENT) != 0) {
-    size += MEM_ALIGNMENT - ((size + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT);
-  }
-
-  if (size > MEM_SIZE) {
-    return NULL;
-  }
-
-  sys_sem_wait(mem_sem);
-
-  for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE; ptr = ((struct mem *)&ram[ptr])->next) {
-    mem = (struct mem *)&ram[ptr];
-    if (!mem->used &&
-       mem->next - (ptr + SIZEOF_STRUCT_MEM) >= size + SIZEOF_STRUCT_MEM) {
-      ptr2 = ptr + SIZEOF_STRUCT_MEM + size;
-      mem2 = (struct mem *)&ram[ptr2];
-
-      mem2->prev = ptr;
-      mem2->next = mem->next;
-      mem->next = ptr2;
-      if (mem2->next != MEM_SIZE) {
-        ((struct mem *)&ram[mem2->next])->prev = ptr2;
-      }
-
-      mem2->used = 0;
-      mem->used = 1;
-#if MEM_STATS
-      lwip_stats.mem.used += (size + SIZEOF_STRUCT_MEM);
-      /*      if (lwip_stats.mem.max < lwip_stats.mem.used) {
-        lwip_stats.mem.max = lwip_stats.mem.used;
-        } */
-      if (lwip_stats.mem.max < ptr2) {
-        lwip_stats.mem.max = ptr2;
-      }
-#endif /* MEM_STATS */
-
-      if (mem == lfree) {
-        /* Find next free block after mem */
-        while (lfree->used && lfree != ram_end) {
-          lfree = (struct mem *)&ram[lfree->next];
-        }
-        LWIP_ASSERT("mem_malloc: !lfree->used", !lfree->used);
-      }
-      sys_sem_signal(mem_sem);
-      LWIP_ASSERT("mem_malloc: allocated memory not above ram_end.",
-       (mem_ptr_t)mem + SIZEOF_STRUCT_MEM + size <= (mem_ptr_t)ram_end);
-      LWIP_ASSERT("mem_malloc: allocated memory properly aligned.",
-       (unsigned long)((u8_t *)mem + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT == 0);
-      return (u8_t *)mem + SIZEOF_STRUCT_MEM;
-    }
-  }
-  LWIP_DEBUGF(MEM_DEBUG | 2, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size));
-#if MEM_STATS
-  ++lwip_stats.mem.err;
-#endif /* MEM_STATS */
-  sys_sem_signal(mem_sem);
-  return NULL;
-}
-#else
-/**
- * Adam's mem_malloc() plus solution for bug #17922
- */
-void *
-mem_malloc(mem_size_t size)
-{
-  mem_size_t ptr, ptr2;
-  struct mem *mem, *mem2;
-
-  if (size == 0) {
-    return NULL;
-  }
-
-  /* Expand the size of the allocated memory region so that we can
-     adjust for alignment. */
-  if ((size % MEM_ALIGNMENT) != 0) {
-    size += MEM_ALIGNMENT - ((size + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT);
-  }
-
-  if (size > MEM_SIZE) {
-    return NULL;
-  }
-
-  sys_sem_wait(mem_sem);
-
-  for (ptr = (u8_t *)lfree - ram; ptr < MEM_SIZE - size; ptr = ((struct mem *)&ram[ptr])->next) {
-    mem = (struct mem *)&ram[ptr];
-
-    if (!mem->used) {
-
-      ptr2 = ptr + SIZEOF_STRUCT_MEM + size;
-
-      if (mem->next - (ptr + (2*SIZEOF_STRUCT_MEM)) >= size) {
-        /* split large block, create empty remainder */
-        mem->next = ptr2;
-        mem->used = 1;
-        /* create mem2 struct */
-        mem2 = (struct mem *)&ram[ptr2];
-        mem2->used = 0;
-        mem2->next = mem->next;
-        mem2->prev = ptr;
-
-        if (mem2->next != MEM_SIZE) {
-          ((struct mem *)&ram[mem2->next])->prev = ptr2;
-        }
-      }
-      else if (mem->next - (ptr + SIZEOF_STRUCT_MEM) > size) {
-        /* near fit, no split, no mem2 creation,
-           round up to mem->next */
-        ptr2 = mem->next;
-        mem->used = 1;
-      }
-      else if (mem->next - (ptr + SIZEOF_STRUCT_MEM) == size) {
-        /* exact fit, do not split, no mem2 creation */
-        mem->next = ptr2;
-        mem->used = 1;
-      }
-
-      if (mem->used) {
-#if MEM_STATS
-        lwip_stats.mem.used += (size + SIZEOF_STRUCT_MEM);
-        if (lwip_stats.mem.max < ptr2) {
-          lwip_stats.mem.max = ptr2;
-        }
-#endif /* MEM_STATS */
-        if (mem == lfree) {
-          /* Find next free block after mem */
-          while (lfree->used && lfree != ram_end) {
-            lfree = (struct mem *)&ram[lfree->next];
-          }
-          LWIP_ASSERT("mem_malloc: !lfree->used", !lfree->used);
-        }
-        sys_sem_signal(mem_sem);
-        LWIP_ASSERT("mem_malloc: allocated memory not above ram_end.",
-         (mem_ptr_t)mem + SIZEOF_STRUCT_MEM + size <= (mem_ptr_t)ram_end);
-        LWIP_ASSERT("mem_malloc: allocated memory properly aligned.",
-         (unsigned long)((u8_t *)mem + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT == 0);
-        return (u8_t *)mem + SIZEOF_STRUCT_MEM;
-      }
-    }
-  }
-  LWIP_DEBUGF(MEM_DEBUG | 2, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size));
-#if MEM_STATS
-  ++lwip_stats.mem.err;
-#endif /* MEM_STATS */
-  sys_sem_signal(mem_sem);
-  return NULL;
-}
-#endif
-
-#endif /* MEM_LIBC_MALLOC == 0 */
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/memp.c b/src/VBox/Devices/Network/lwip/src/core/memp.c
deleted file mode 100644
index b31812d..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/memp.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/opt.h"
-
-#include "lwip/memp.h"
-
-#include "lwip/pbuf.h"
-#include "lwip/udp.h"
-#include "lwip/raw.h"
-#include "lwip/tcp.h"
-#include "lwip/api.h"
-#include "lwip/api_msg.h"
-#include "lwip/tcpip.h"
-
-#include "lwip/sys.h"
-#include "lwip/stats.h"
-
-struct memp {
-  struct memp *next;
-};
-
-#define MEMP_SIZE MEM_ALIGN_SIZE(sizeof(struct memp))
-
-static struct memp *memp_tab[MEMP_MAX];
-
-static const u16_t memp_sizes[MEMP_MAX] = {
-  MEM_ALIGN_SIZE(sizeof(struct pbuf)),
-  MEM_ALIGN_SIZE(sizeof(struct raw_pcb)),
-  MEM_ALIGN_SIZE(sizeof(struct udp_pcb)),
-  MEM_ALIGN_SIZE(sizeof(struct tcp_pcb)),
-  MEM_ALIGN_SIZE(sizeof(struct tcp_pcb_listen)),
-  MEM_ALIGN_SIZE(sizeof(struct tcp_seg)),
-  MEM_ALIGN_SIZE(sizeof(struct netbuf)),
-  MEM_ALIGN_SIZE(sizeof(struct netconn)),
-  MEM_ALIGN_SIZE(sizeof(struct api_msg)),
-  MEM_ALIGN_SIZE(sizeof(struct tcpip_msg)),
-  MEM_ALIGN_SIZE(sizeof(struct sys_timeo))
-};
-
-static const u16_t memp_num[MEMP_MAX] = {
-  MEMP_NUM_PBUF,
-  MEMP_NUM_RAW_PCB,
-  MEMP_NUM_UDP_PCB,
-  MEMP_NUM_TCP_PCB,
-  MEMP_NUM_TCP_PCB_LISTEN,
-  MEMP_NUM_TCP_SEG,
-  MEMP_NUM_NETBUF,
-  MEMP_NUM_NETCONN,
-  MEMP_NUM_API_MSG,
-  MEMP_NUM_TCPIP_MSG,
-  MEMP_NUM_SYS_TIMEOUT
-};
-
-#define MEMP_TYPE_SIZE(qty, type) \
-  ((qty) * (MEMP_SIZE + MEM_ALIGN_SIZE(sizeof(type))))
-
-static u8_t memp_memory[MEM_ALIGNMENT - 1 + 
-  MEMP_TYPE_SIZE(MEMP_NUM_PBUF, struct pbuf) +
-  MEMP_TYPE_SIZE(MEMP_NUM_RAW_PCB, struct raw_pcb) +
-  MEMP_TYPE_SIZE(MEMP_NUM_UDP_PCB, struct udp_pcb) +
-  MEMP_TYPE_SIZE(MEMP_NUM_TCP_PCB, struct tcp_pcb) +
-  MEMP_TYPE_SIZE(MEMP_NUM_TCP_PCB_LISTEN, struct tcp_pcb_listen) +
-  MEMP_TYPE_SIZE(MEMP_NUM_TCP_SEG, struct tcp_seg) +
-  MEMP_TYPE_SIZE(MEMP_NUM_NETBUF, struct netbuf) +
-  MEMP_TYPE_SIZE(MEMP_NUM_NETCONN, struct netconn) +
-  MEMP_TYPE_SIZE(MEMP_NUM_API_MSG, struct api_msg) +
-  MEMP_TYPE_SIZE(MEMP_NUM_TCPIP_MSG, struct tcpip_msg) +
-  MEMP_TYPE_SIZE(MEMP_NUM_SYS_TIMEOUT, struct sys_timeo)];
-
-#if !SYS_LIGHTWEIGHT_PROT
-static sys_sem_t mutex;
-#endif
-
-#if MEMP_SANITY_CHECK
-static int
-memp_sanity(void)
-{
-  s16_t i, c;
-  struct memp *m, *n;
-
-  for (i = 0; i < MEMP_MAX; i++) {
-    for (m = memp_tab[i]; m != NULL; m = m->next) {
-      c = 1;
-      for (n = memp_tab[i]; n != NULL; n = n->next) {
-        if (n == m && --c < 0) {
-          return 0; /* LW was: abort(); */
-        }
-      }
-    }
-  }
-  return 1;
-}
-#endif /* MEMP_SANITY_CHECK*/
-
-void
-memp_init(void)
-{
-  struct memp *memp;
-  u16_t i, j;
-
-#if MEMP_STATS
-  for (i = 0; i < MEMP_MAX; ++i) {
-    lwip_stats.memp[i].used = lwip_stats.memp[i].max =
-      lwip_stats.memp[i].err = 0;
-    lwip_stats.memp[i].avail = memp_num[i];
-  }
-#endif /* MEMP_STATS */
-
-  memp = MEM_ALIGN(memp_memory);
-  for (i = 0; i < MEMP_MAX; ++i) {
-    memp_tab[i] = NULL;
-    for (j = 0; j < memp_num[i]; ++j) {
-      memp->next = memp_tab[i];
-      memp_tab[i] = memp;
-      memp = (struct memp *)((u8_t *)memp + MEMP_SIZE + memp_sizes[i]);
-    }
-  }
-
-#if !SYS_LIGHTWEIGHT_PROT
-  mutex = sys_sem_new(1);
-#endif
-}
-
-void *
-memp_malloc(memp_t type)
-{
-  struct memp *memp;
-  void *mem;
-#if SYS_LIGHTWEIGHT_PROT
-  SYS_ARCH_DECL_PROTECT(old_level);
-#endif
- 
-  LWIP_ASSERT("memp_malloc: type < MEMP_MAX", type < MEMP_MAX);
-
-#if SYS_LIGHTWEIGHT_PROT
-  SYS_ARCH_PROTECT(old_level);
-#else /* SYS_LIGHTWEIGHT_PROT */  
-  sys_sem_wait(mutex);
-#endif /* SYS_LIGHTWEIGHT_PROT */  
-
-  memp = memp_tab[type];
-  
-  if (memp != NULL) {    
-    memp_tab[type] = memp->next;    
-    memp->next = NULL;
-#if MEMP_STATS
-    ++lwip_stats.memp[type].used;
-    if (lwip_stats.memp[type].used > lwip_stats.memp[type].max) {
-      lwip_stats.memp[type].max = lwip_stats.memp[type].used;
-    }
-#endif /* MEMP_STATS */
-    mem = (u8_t *)memp + MEMP_SIZE;
-    LWIP_ASSERT("memp_malloc: memp properly aligned",
-                ((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
-  } else {
-    LWIP_DEBUGF(MEMP_DEBUG | 2, ("memp_malloc: out of memory in pool %"S16_F"\n", type));
-#if MEMP_STATS
-    ++lwip_stats.memp[type].err;
-#endif /* MEMP_STATS */
-    mem = NULL;
-  }
-
-#if SYS_LIGHTWEIGHT_PROT
-  SYS_ARCH_UNPROTECT(old_level);
-#else /* SYS_LIGHTWEIGHT_PROT */
-  sys_sem_signal(mutex);
-#endif /* SYS_LIGHTWEIGHT_PROT */  
-
-  return mem;
-}
-
-void
-memp_free(memp_t type, void *mem)
-{
-  struct memp *memp;
-#if SYS_LIGHTWEIGHT_PROT
-  SYS_ARCH_DECL_PROTECT(old_level);
-#endif /* SYS_LIGHTWEIGHT_PROT */  
-
-  if (mem == NULL) {
-    return;
-  }
-
-  memp = (struct memp *)((u8_t *)mem - MEMP_SIZE);
-
-#if SYS_LIGHTWEIGHT_PROT
-  SYS_ARCH_PROTECT(old_level);
-#else /* SYS_LIGHTWEIGHT_PROT */  
-  sys_sem_wait(mutex);
-#endif /* SYS_LIGHTWEIGHT_PROT */  
-
-#if MEMP_STATS
-  lwip_stats.memp[type].used--; 
-#endif /* MEMP_STATS */
-  
-  memp->next = memp_tab[type]; 
-  memp_tab[type] = memp;
-
-#if MEMP_SANITY_CHECK
-  LWIP_ASSERT("memp sanity", memp_sanity());
-#endif  
-
-#if SYS_LIGHTWEIGHT_PROT
-  SYS_ARCH_UNPROTECT(old_level);
-#else /* SYS_LIGHTWEIGHT_PROT */
-  sys_sem_signal(mutex);
-#endif /* SYS_LIGHTWEIGHT_PROT */  
-}
diff --git a/src/VBox/Devices/Network/lwip/src/core/netif.c b/src/VBox/Devices/Network/lwip/src/core/netif.c
deleted file mode 100644
index b1e2bc1..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/netif.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/**
- * @file
- *
- * lwIP network interface abstraction
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-#include "lwip/tcp.h"
-#include "lwip/snmp.h"
-
-struct netif *netif_list = NULL;
-struct netif *netif_default = NULL;
-
-/**
- * Add a network interface to the list of lwIP netifs.
- *
- * @param netif a pre-allocated netif structure
- * @param ipaddr IP address for the new netif
- * @param netmask network mask for the new netif
- * @param gw default gateway IP address for the new netif
- * @param state opaque data passed to the new netif
- * @param init callback function that initializes the interface
- * @param input callback function that is called to pass
- * ingress packets up in the protocol layer stack.
- *
- * @return netif, or NULL if failed.
- */
-struct netif *
-netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
-  struct ip_addr *gw,
-  void *state,
-  err_t (* init)(struct netif *netif),
-  err_t (* input)(struct pbuf *p, struct netif *netif))
-{
-  static s16_t netifnum = 0;
-
-  /* reset new interface configuration state */
-  netif->ip_addr.addr = 0;
-  netif->netmask.addr = 0;
-  netif->gw.addr = 0;
-  netif->flags = 0;
-#if LWIP_DHCP
-  /* netif not under DHCP control by default */
-  netif->dhcp = NULL;
-#endif
-  /* remember netif specific state information data */
-  netif->state = state;
-  netif->num = netifnum++;
-  netif->input = input;
-
-  netif_set_addr(netif, ipaddr, netmask, gw);
-
-  /* call user specified initialization function for netif */
-  if (init(netif) != ERR_OK) {
-    return NULL;
-  }
-
-  /* add this netif to the list */
-  netif->next = netif_list;
-  netif_list = netif;
-  snmp_inc_iflist();
-
-  LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP addr ",
-    netif->name[0], netif->name[1]));
-  ip_addr_debug_print(NETIF_DEBUG, ipaddr);
-  LWIP_DEBUGF(NETIF_DEBUG, (" netmask "));
-  ip_addr_debug_print(NETIF_DEBUG, netmask);
-  LWIP_DEBUGF(NETIF_DEBUG, (" gw "));
-  ip_addr_debug_print(NETIF_DEBUG, gw);
-  LWIP_DEBUGF(NETIF_DEBUG, ("\n"));
-  return netif;
-}
-
-void
-netif_set_addr(struct netif *netif,struct ip_addr *ipaddr, struct ip_addr *netmask,
-    struct ip_addr *gw)
-{
-  netif_set_ipaddr(netif, ipaddr);
-  netif_set_netmask(netif, netmask);
-  netif_set_gw(netif, gw);
-}
-
-void netif_remove(struct netif * netif)
-{
-  if ( netif == NULL ) return;
-
-  snmp_delete_ipaddridx_tree(netif);
-
-  /*  is it the first netif? */
-  if (netif_list == netif) {
-    netif_list = netif->next;
-    snmp_dec_iflist();
-  }
-  else {
-    /*  look for netif further down the list */
-    struct netif * tmpNetif;
-    for (tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) {
-      if (tmpNetif->next == netif) {
-        tmpNetif->next = netif->next;
-        snmp_dec_iflist();
-        break;
-      }
-    }
-    if (tmpNetif == NULL)
-      return; /*  we didn't find any netif today */
-  }
-  /* this netif is default? */
-  if (netif_default == netif)
-    /* reset default netif */
-    netif_default = NULL;
-  LWIP_DEBUGF( NETIF_DEBUG, ("netif_remove: removed netif\n") );
-}
-
-struct netif *
-netif_find(char *name)
-{
-  struct netif *netif;
-  u8_t num;
-
-  if (name == NULL) {
-    return NULL;
-  }
-
-  num = name[2] - '0';
-
-  for(netif = netif_list; netif != NULL; netif = netif->next) {
-    if (num == netif->num &&
-       name[0] == netif->name[0] &&
-       name[1] == netif->name[1]) {
-      LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: found %c%c\n", name[0], name[1]));
-      return netif;
-    }
-  }
-  LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
-  return NULL;
-}
-
-void
-netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
-{
-  /* TODO: Handling of obsolete pcbs */
-  /* See:  http://mail.gnu.org/archive/html/lwip-users/2003-03/msg00118.html */
-#if LWIP_TCP
-  struct tcp_pcb *pcb;
-  struct tcp_pcb_listen *lpcb;
-
-  /* address is actually being changed? */
-  if ((ip_addr_cmp(ipaddr, &(netif->ip_addr))) == 0)
-  {
-    /* extern struct tcp_pcb *tcp_active_pcbs; defined by tcp.h */
-    LWIP_DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: netif address being changed\n"));
-    pcb = tcp_active_pcbs;
-    while (pcb != NULL) {
-      /* PCB bound to current local interface address? */
-      if (ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))) {
-        /* this connection must be aborted */
-        struct tcp_pcb *next = pcb->next;
-        LWIP_DEBUGF(NETIF_DEBUG | 1, ("netif_set_ipaddr: aborting TCP pcb %p\n", (void *)pcb));
-        tcp_abort(pcb);
-        pcb = next;
-      } else {
-        pcb = pcb->next;
-      }
-    }
-    for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
-      /* PCB bound to current local interface address? */
-      if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) {
-        /* The PCB is listening to the old ipaddr and
-         * is set to listen to the new one instead */
-        ip_addr_set(&(lpcb->local_ip), ipaddr);
-      }
-    }
-  }
-#endif
-  snmp_delete_ipaddridx_tree(netif);
-  snmp_delete_iprteidx_tree(0,netif);
-  /* set new IP address to netif */
-  ip_addr_set(&(netif->ip_addr), ipaddr);
-  snmp_insert_ipaddridx_tree(netif);
-  snmp_insert_iprteidx_tree(0,netif);
-
-#if 0 /* only allowed for Ethernet interfaces TODO: how can we check? */
-  /** For Ethernet network interfaces, we would like to send a
-   *  "gratuitous ARP"; this is an ARP packet sent by a node in order
-   *  to spontaneously cause other nodes to update an entry in their
-   *  ARP cache. From RFC 3220 "IP Mobility Support for IPv4" section 4.6.
-   */ 
-  etharp_query(netif, ipaddr, NULL);
-#endif
-  LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: IP address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
-    netif->name[0], netif->name[1],
-    ip4_addr1(&netif->ip_addr),
-    ip4_addr2(&netif->ip_addr),
-    ip4_addr3(&netif->ip_addr),
-    ip4_addr4(&netif->ip_addr)));
-}
-
-void
-netif_set_gw(struct netif *netif, struct ip_addr *gw)
-{
-  ip_addr_set(&(netif->gw), gw);
-  LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: GW address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
-    netif->name[0], netif->name[1],
-    ip4_addr1(&netif->gw),
-    ip4_addr2(&netif->gw),
-    ip4_addr3(&netif->gw),
-    ip4_addr4(&netif->gw)));
-}
-
-void
-netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
-{
-  snmp_delete_iprteidx_tree(0, netif);
-  /* set new netmask to netif */
-  ip_addr_set(&(netif->netmask), netmask);
-  snmp_insert_iprteidx_tree(0, netif);
-  LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: netmask of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
-    netif->name[0], netif->name[1],
-    ip4_addr1(&netif->netmask),
-    ip4_addr2(&netif->netmask),
-    ip4_addr3(&netif->netmask),
-    ip4_addr4(&netif->netmask)));
-}
-
-void
-netif_set_default(struct netif *netif)
-{
-  if (netif == NULL)
-  {
-    /* remove default route */
-    snmp_delete_iprteidx_tree(1, netif);
-  }
-  else
-  {
-    /* install default route */
-    snmp_insert_iprteidx_tree(1, netif);
-  }
-  netif_default = netif;
-  LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n",
-           netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\''));
-}
-
-/**
- * Bring an interface up, available for processing
- * traffic.
- * 
- * @note: Enabling DHCP on a down interface will make it come
- * up once configured.
- * 
- * @see dhcp_start()
- */ 
-void netif_set_up(struct netif *netif)
-{
-  netif->flags |= NETIF_FLAG_UP;
-#if LWIP_SNMP
-  snmp_get_sysuptime(&netif->ts);
-#endif
-}
-
-/**
- * Ask if an interface is up
- */ 
-u8_t netif_is_up(struct netif *netif)
-{
-  return (netif->flags & NETIF_FLAG_UP)?1:0;
-}
-
-/**
- * Bring an interface down, disabling any traffic processing.
- *
- * @note: Enabling DHCP on a down interface will make it come
- * up once configured.
- * 
- * @see dhcp_start()
- */ 
-void netif_set_down(struct netif *netif)
-{
-  netif->flags &= ~NETIF_FLAG_UP;
-#if LWIP_SNMP
-  snmp_get_sysuptime(&netif->ts);
-#endif
-}
-
-void
-netif_init(void)
-{
-  netif_list = netif_default = NULL;
-}
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/pbuf.c b/src/VBox/Devices/Network/lwip/src/core/pbuf.c
deleted file mode 100644
index 454b135..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/pbuf.c
+++ /dev/null
@@ -1,961 +0,0 @@
-/**
- * @file
- * Packet buffer management
- *
- * Packets are built from the pbuf data structure. It supports dynamic
- * memory allocation for packet contents or can reference externally
- * managed packet contents both in RAM and ROM. Quick allocation for
- * incoming packets is provided through pools with fixed sized pbufs.
- *
- * A packet may span over multiple pbufs, chained as a singly linked
- * list. This is called a "pbuf chain".
- *
- * Multiple packets may be queued, also using this singly linked list.
- * This is called a "packet queue".
- * 
- * So, a packet queue consists of one or more pbuf chains, each of
- * which consist of one or more pbufs. Currently, queues are only
- * supported in a limited section of lwIP, this is the etharp queueing
- * code. Outside of this section no packet queues are supported yet.
- * 
- * The differences between a pbuf chain and a packet queue are very
- * precise but subtle. 
- *
- * The last pbuf of a packet has a ->tot_len field that equals the
- * ->len field. It can be found by traversing the list. If the last
- * pbuf of a packet has a ->next field other than NULL, more packets
- * are on the queue.
- *
- * Therefore, looping through a pbuf of a single packet, has an
- * loop end condition (tot_len == p->len), NOT (next == NULL).
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include <string.h>
-
-#include "lwip/opt.h"
-#include "lwip/stats.h"
-#include "lwip/def.h"
-#include "lwip/mem.h"
-#include "lwip/memp.h"
-#include "lwip/pbuf.h"
-#include "lwip/sys.h"
-#include "arch/perf.h"
-
-static u8_t pbuf_pool_memory[MEM_ALIGNMENT - 1 + PBUF_POOL_SIZE * MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE + sizeof(struct pbuf))];
-
-#if !SYS_LIGHTWEIGHT_PROT
-static volatile u8_t pbuf_pool_free_lock, pbuf_pool_alloc_lock;
-static sys_sem_t pbuf_pool_free_sem;
-#endif
-
-static struct pbuf *pbuf_pool = NULL;
-
-/**
- * Initializes the pbuf module.
- *
- * A large part of memory is allocated for holding the pool of pbufs.
- * The size of the individual pbufs in the pool is given by the size
- * parameter, and the number of pbufs in the pool by the num parameter.
- *
- * After the memory has been allocated, the pbufs are set up. The
- * ->next pointer in each pbuf is set up to point to the next pbuf in
- * the pool.
- *
- */
-void
-pbuf_init(void)
-{
-  struct pbuf *p, *q = NULL;
-  u16_t i;
-
-  pbuf_pool = (struct pbuf *)MEM_ALIGN(pbuf_pool_memory);
-
-#if PBUF_STATS
-  lwip_stats.pbuf.avail = PBUF_POOL_SIZE;
-#endif /* PBUF_STATS */
-
-  /* Set up ->next pointers to link the pbufs of the pool together */
-  p = pbuf_pool;
-
-  for(i = 0; i < PBUF_POOL_SIZE; ++i) {
-    p->next = (struct pbuf *)((u8_t *)p + PBUF_POOL_BUFSIZE + sizeof(struct pbuf));
-    p->len = p->tot_len = PBUF_POOL_BUFSIZE;
-    p->payload = MEM_ALIGN((void *)((u8_t *)p + sizeof(struct pbuf)));
-    p->flags = PBUF_FLAG_POOL;
-    q = p;
-    p = p->next;
-  }
-
-  /* The ->next pointer of last pbuf is NULL to indicate that there
-     are no more pbufs in the pool */
-  q->next = NULL;
-
-#if !SYS_LIGHTWEIGHT_PROT
-  pbuf_pool_alloc_lock = 0;
-  pbuf_pool_free_lock = 0;
-  pbuf_pool_free_sem = sys_sem_new(1);
-#endif
-}
-
-/**
- * @internal only called from pbuf_alloc()
- */
-static struct pbuf *
-pbuf_pool_alloc(void)
-{
-  struct pbuf *p = NULL;
-
-  SYS_ARCH_DECL_PROTECT(old_level);
-  SYS_ARCH_PROTECT(old_level);
-
-#if !SYS_LIGHTWEIGHT_PROT
-  /* Next, check the actual pbuf pool, but if the pool is locked, we
-     pretend to be out of buffers and return NULL. */
-  if (pbuf_pool_free_lock) {
-#if PBUF_STATS
-    ++lwip_stats.pbuf.alloc_locked;
-#endif /* PBUF_STATS */
-    return NULL;
-  }
-  pbuf_pool_alloc_lock = 1;
-  if (!pbuf_pool_free_lock) {
-#endif /* SYS_LIGHTWEIGHT_PROT */
-    p = pbuf_pool;
-    if (p) {
-      pbuf_pool = p->next;
-    }
-#if !SYS_LIGHTWEIGHT_PROT
-#if PBUF_STATS
-  } else {
-    ++lwip_stats.pbuf.alloc_locked;
-#endif /* PBUF_STATS */
-  }
-  pbuf_pool_alloc_lock = 0;
-#endif /* SYS_LIGHTWEIGHT_PROT */
-
-#if PBUF_STATS
-  if (p != NULL) {
-    ++lwip_stats.pbuf.used;
-    if (lwip_stats.pbuf.used > lwip_stats.pbuf.max) {
-      lwip_stats.pbuf.max = lwip_stats.pbuf.used;
-    }
-  }
-#endif /* PBUF_STATS */
-
-  SYS_ARCH_UNPROTECT(old_level);
-  return p;
-}
-
-
-/**
- * Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type).
- *
- * The actual memory allocated for the pbuf is determined by the
- * layer at which the pbuf is allocated and the requested size
- * (from the size parameter).
- *
- * @param flag this parameter decides how and where the pbuf
- * should be allocated as follows:
- *
- * - PBUF_RAM: buffer memory for pbuf is allocated as one large
- *             chunk. This includes protocol headers as well.
- * - PBUF_ROM: no buffer memory is allocated for the pbuf, even for
- *             protocol headers. Additional headers must be prepended
- *             by allocating another pbuf and chain in to the front of
- *             the ROM pbuf. It is assumed that the memory used is really
- *             similar to ROM in that it is immutable and will not be
- *             changed. Memory which is dynamic should generally not
- *             be attached to PBUF_ROM pbufs. Use PBUF_REF instead.
- * - PBUF_REF: no buffer memory is allocated for the pbuf, even for
- *             protocol headers. It is assumed that the pbuf is only
- *             being used in a single thread. If the pbuf gets queued,
- *             then pbuf_take should be called to copy the buffer.
- * - PBUF_POOL: the pbuf is allocated as a pbuf chain, with pbufs from
- *              the pbuf pool that is allocated during pbuf_init().
- *
- * @return the allocated pbuf. If multiple pbufs where allocated, this
- * is the first pbuf of a pbuf chain.
- */
-struct pbuf *
-pbuf_alloc(pbuf_layer l, u16_t length, pbuf_flag flag)
-{
-  struct pbuf *p, *q, *r;
-  u16_t offset;
-  s32_t rem_len; /* remaining length */
-  LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 3, ("pbuf_alloc(length=%"U16_F")\n", length));
-
-  /* determine header offset */
-  offset = 0;
-  switch (l) {
-  case PBUF_TRANSPORT:
-    /* add room for transport (often TCP) layer header */
-    offset += PBUF_TRANSPORT_HLEN;
-    /* FALLTHROUGH */
-  case PBUF_IP:
-    /* add room for IP layer header */
-    offset += PBUF_IP_HLEN;
-    /* FALLTHROUGH */
-  case PBUF_LINK:
-    /* add room for link layer header */
-    offset += PBUF_LINK_HLEN;
-    break;
-  case PBUF_RAW:
-    break;
-  default:
-    LWIP_ASSERT("pbuf_alloc: bad pbuf layer", 0);
-    return NULL;
-  }
-
-  switch (flag) {
-  case PBUF_POOL:
-    /* allocate head of pbuf chain into p */
-    p = pbuf_pool_alloc();
-    LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 3, ("pbuf_alloc: allocated pbuf %p\n", (void *)p));
-    if (p == NULL) {
-#if PBUF_STATS
-      ++lwip_stats.pbuf.err;
-#endif /* PBUF_STATS */
-      return NULL;
-    }
-    p->next = NULL;
-
-    /* make the payload pointer point 'offset' bytes into pbuf data memory */
-    p->payload = MEM_ALIGN((void *)((u8_t *)p + (sizeof(struct pbuf) + offset)));
-    LWIP_ASSERT("pbuf_alloc: pbuf p->payload properly aligned",
-            ((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0);
-    /* the total length of the pbuf chain is the requested size */
-    p->tot_len = length;
-    /* set the length of the first pbuf in the chain */
-    p->len = length > PBUF_POOL_BUFSIZE - offset? PBUF_POOL_BUFSIZE - offset: length;
-    /* set reference count (needed here in case we fail) */
-    p->ref = 1;
-
-    /* now allocate the tail of the pbuf chain */
-
-    /* remember first pbuf for linkage in next iteration */
-    r = p;
-    /* remaining length to be allocated */
-    rem_len = length - p->len;
-    /* any remaining pbufs to be allocated? */
-    while (rem_len > 0) {
-      q = pbuf_pool_alloc();
-      if (q == NULL) {
-       LWIP_DEBUGF(PBUF_DEBUG | 2, ("pbuf_alloc: Out of pbufs in pool.\n"));
-#if PBUF_STATS
-        ++lwip_stats.pbuf.err;
-#endif /* PBUF_STATS */
-        /* free chain so far allocated */
-        pbuf_free(p);
-        /* bail out unsuccesfully */
-        return NULL;
-      }
-      q->next = NULL;
-      /* make previous pbuf point to this pbuf */
-      r->next = q;
-      /* set total length of this pbuf and next in chain */
-      q->tot_len = rem_len;
-      /* this pbuf length is pool size, unless smaller sized tail */
-      q->len = rem_len > PBUF_POOL_BUFSIZE? PBUF_POOL_BUFSIZE: rem_len;
-      q->payload = (void *)((u8_t *)q + sizeof(struct pbuf));
-      LWIP_ASSERT("pbuf_alloc: pbuf q->payload properly aligned",
-              ((mem_ptr_t)q->payload % MEM_ALIGNMENT) == 0);
-      q->ref = 1;
-      /* calculate remaining length to be allocated */
-      rem_len -= q->len;
-      /* remember this pbuf for linkage in next iteration */
-      r = q;
-    }
-    /* end of chain */
-    /*r->next = NULL;*/
-
-    break;
-  case PBUF_RAM:
-    /* If pbuf is to be allocated in RAM, allocate memory for it. */
-    p = mem_malloc(MEM_ALIGN_SIZE(sizeof(struct pbuf) + offset) + MEM_ALIGN_SIZE(length));
-    if (p == NULL) {
-      return NULL;
-    }
-    /* Set up internal structure of the pbuf. */
-    p->payload = MEM_ALIGN((void *)((u8_t *)p + sizeof(struct pbuf) + offset));
-    p->len = p->tot_len = length;
-    p->next = NULL;
-    p->flags = PBUF_FLAG_RAM;
-
-    LWIP_ASSERT("pbuf_alloc: pbuf->payload properly aligned",
-           ((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0);
-    break;
-  /* pbuf references existing (non-volatile static constant) ROM payload? */
-  case PBUF_ROM:
-  /* pbuf references existing (externally allocated) RAM payload? */
-  case PBUF_REF:
-    /* only allocate memory for the pbuf structure */
-    p = memp_malloc(MEMP_PBUF);
-    if (p == NULL) {
-      LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2, ("pbuf_alloc: Could not allocate MEMP_PBUF for PBUF_%s.\n", flag == PBUF_ROM?"ROM":"REF"));
-      return NULL;
-    }
-    /* caller must set this field properly, afterwards */
-    p->payload = NULL;
-    p->len = p->tot_len = length;
-    p->next = NULL;
-    p->flags = (flag == PBUF_ROM? PBUF_FLAG_ROM: PBUF_FLAG_REF);
-    break;
-  default:
-    LWIP_ASSERT("pbuf_alloc: erroneous flag", 0);
-    return NULL;
-  }
-  /* set reference count */
-  p->ref = 1;
-  LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 3, ("pbuf_alloc(length=%"U16_F") == %p\n", length, (void *)p));
-  return p;
-}
-
-
-#if PBUF_STATS
-#define DEC_PBUF_STATS do { --lwip_stats.pbuf.used; } while (0)
-#else /* PBUF_STATS */
-#define DEC_PBUF_STATS
-#endif /* PBUF_STATS */
-
-#define PBUF_POOL_FAST_FREE(p)  do {                                    \
-                                  p->next = pbuf_pool;                  \
-                                  pbuf_pool = p;                        \
-                                  DEC_PBUF_STATS;                       \
-                                } while (0)
-
-#if SYS_LIGHTWEIGHT_PROT
-#define PBUF_POOL_FREE(p)  do {                                         \
-                                SYS_ARCH_DECL_PROTECT(old_level);       \
-                                SYS_ARCH_PROTECT(old_level);            \
-                                PBUF_POOL_FAST_FREE(p);                 \
-                                SYS_ARCH_UNPROTECT(old_level);          \
-                               } while (0)
-#else /* SYS_LIGHTWEIGHT_PROT */
-#define PBUF_POOL_FREE(p)  do {                                         \
-                             sys_sem_wait(pbuf_pool_free_sem);          \
-                             PBUF_POOL_FAST_FREE(p);                    \
-                             sys_sem_signal(pbuf_pool_free_sem);        \
-                           } while (0)
-#endif /* SYS_LIGHTWEIGHT_PROT */
-
-/**
- * Shrink a pbuf chain to a desired length.
- *
- * @param p pbuf to shrink.
- * @param new_len desired new length of pbuf chain
- *
- * Depending on the desired length, the first few pbufs in a chain might
- * be skipped and left unchanged. The new last pbuf in the chain will be
- * resized, and any remaining pbufs will be freed.
- *
- * @note If the pbuf is ROM/REF, only the ->tot_len and ->len fields are adjusted.
- * @note May not be called on a packet queue.
- *
- * @bug Cannot grow the size of a pbuf (chain) (yet).
- */
-void
-pbuf_realloc(struct pbuf *p, u16_t new_len)
-{
-  struct pbuf *q;
-  u16_t rem_len; /* remaining length */
-  s16_t grow;
-
-  LWIP_ASSERT("pbuf_realloc: sane p->flags", p->flags == PBUF_FLAG_POOL ||
-              p->flags == PBUF_FLAG_ROM ||
-              p->flags == PBUF_FLAG_RAM ||
-              p->flags == PBUF_FLAG_REF);
-
-  /* desired length larger than current length? */
-  if (new_len >= p->tot_len) {
-    /* enlarging not yet supported */
-    return;
-  }
-
-  /* the pbuf chain grows by (new_len - p->tot_len) bytes
-   * (which may be negative in case of shrinking) */
-  grow = new_len - p->tot_len;
-
-  /* first, step over any pbufs that should remain in the chain */
-  rem_len = new_len;
-  q = p;
-  /* should this pbuf be kept? */
-  while (rem_len > q->len) {
-    /* decrease remaining length by pbuf length */
-    rem_len -= q->len;
-    /* decrease total length indicator */
-    q->tot_len += grow;
-    /* proceed to next pbuf in chain */
-    q = q->next;
-  }
-  /* we have now reached the new last pbuf (in q) */
-  /* rem_len == desired length for pbuf q */
-
-  /* shrink allocated memory for PBUF_RAM */
-  /* (other types merely adjust their length fields */
-  if ((q->flags == PBUF_FLAG_RAM) && (rem_len != q->len)) {
-    /* reallocate and adjust the length of the pbuf that will be split */
-    mem_realloc(q, (u8_t *)q->payload - (u8_t *)q + rem_len);
-  }
-  /* adjust length fields for new last pbuf */
-  q->len = rem_len;
-  q->tot_len = q->len;
-
-  /* any remaining pbufs in chain? */
-  if (q->next != NULL) {
-    /* free remaining pbufs in chain */
-    pbuf_free(q->next);
-  }
-  /* q is last packet in chain */
-  q->next = NULL;
-
-}
-
-/**
- * Adjusts the payload pointer to hide or reveal headers in the payload.
- *
- * Adjusts the ->payload pointer so that space for a header
- * (dis)appears in the pbuf payload.
- *
- * The ->payload, ->tot_len and ->len fields are adjusted.
- *
- * @param hdr_size_inc Number of bytes to increment header size which
- * increases the size of the pbuf. New space is on the front.
- * (Using a negative value decreases the header size.)
- * If hdr_size_inc is 0, this function does nothing and returns succesful.
- *
- * PBUF_ROM and PBUF_REF type buffers cannot have their sizes increased, so
- * the call will fail. A check is made that the increase in header size does
- * not move the payload pointer in front of the start of the buffer.
- * @return non-zero on failure, zero on success.
- *
- */
-u8_t
-pbuf_header(struct pbuf *p, s16_t header_size_increment)
-{
-  u16_t flags;
-  void *payload;
-
-  LWIP_ASSERT("p != NULL", p != NULL);
-  if ((header_size_increment == 0) || (p == NULL)) return 0;
- 
-  flags = p->flags;
-  /* remember current payload pointer */
-  payload = p->payload;
-
-  /* pbuf types containing payloads? */
-  if (flags == PBUF_FLAG_RAM || flags == PBUF_FLAG_POOL) {
-    /* set new payload pointer */
-    p->payload = (u8_t *)p->payload - header_size_increment;
-    /* boundary check fails? */
-    if ((u8_t *)p->payload < (u8_t *)p + sizeof(struct pbuf)) {
-      LWIP_DEBUGF( PBUF_DEBUG | 2, ("pbuf_header: failed as %p < %p (not enough space for new header size)\n",
-        (void *)p->payload,
-        (void *)(p + 1)));
-      /* restore old payload pointer */
-      p->payload = payload;
-      /* bail out unsuccesfully */
-      return 1;
-    }
-  /* pbuf types refering to external payloads? */
-  } else if (flags == PBUF_FLAG_REF || flags == PBUF_FLAG_ROM) {
-    /* hide a header in the payload? */
-    if ((header_size_increment < 0) && (header_size_increment - p->len <= 0)) {
-      /* increase payload pointer */
-      p->payload = (u8_t *)p->payload - header_size_increment;
-    } else {
-      /* cannot expand payload to front (yet!)
-       * bail out unsuccesfully */
-      return 1;
-    }
-  }
-  /* modify pbuf length fields */
-  p->len += header_size_increment;
-  p->tot_len += header_size_increment;
-
-  LWIP_DEBUGF( PBUF_DEBUG, ("pbuf_header: old %p new %p (%"S16_F")\n",
-    (void *)payload, (void *)p->payload, header_size_increment));
-
-  return 0;
-}
-
-/**
- * Dereference a pbuf chain or queue and deallocate any no-longer-used
- * pbufs at the head of this chain or queue.
- *
- * Decrements the pbuf reference count. If it reaches zero, the pbuf is
- * deallocated.
- *
- * For a pbuf chain, this is repeated for each pbuf in the chain,
- * up to the first pbuf which has a non-zero reference count after
- * decrementing. So, when all reference counts are one, the whole
- * chain is free'd.
- *
- * @param pbuf The pbuf (chain) to be dereferenced.
- *
- * @return the number of pbufs that were de-allocated
- * from the head of the chain.
- *
- * @note MUST NOT be called on a packet queue (Not verified to work yet).
- * @note the reference counter of a pbuf equals the number of pointers
- * that refer to the pbuf (or into the pbuf).
- *
- * @internal examples:
- *
- * Assuming existing chains a->b->c with the following reference
- * counts, calling pbuf_free(a) results in:
- * 
- * 1->2->3 becomes ...1->3
- * 3->3->3 becomes 2->3->3
- * 1->1->2 becomes ......1
- * 2->1->1 becomes 1->1->1
- * 1->1->1 becomes .......
- *
- */
-u8_t
-pbuf_free(struct pbuf *p)
-{
-  u16_t flags;
-  struct pbuf *q;
-  u8_t count;
-  SYS_ARCH_DECL_PROTECT(old_level);
-
-  LWIP_ASSERT("p != NULL", p != NULL);
-  /* if assertions are disabled, proceed with debug output */
-  if (p == NULL) {
-    LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2, ("pbuf_free(p == NULL) was called.\n"));
-    return 0;
-  }
-  LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 3, ("pbuf_free(%p)\n", (void *)p));
-
-  PERF_START;
-
-  LWIP_ASSERT("pbuf_free: sane flags",
-    p->flags == PBUF_FLAG_RAM || p->flags == PBUF_FLAG_ROM ||
-    p->flags == PBUF_FLAG_REF || p->flags == PBUF_FLAG_POOL);
-
-  count = 0;
-  /* Since decrementing ref cannot be guaranteed to be a single machine operation
-   * we must protect it. Also, the later test of ref must be protected.
-   */
-  SYS_ARCH_PROTECT(old_level);
-  /* de-allocate all consecutive pbufs from the head of the chain that
-   * obtain a zero reference count after decrementing*/
-  while (p != NULL) {
-    /* all pbufs in a chain are referenced at least once */
-    LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0);
-    /* decrease reference count (number of pointers to pbuf) */
-    p->ref--;
-    /* this pbuf is no longer referenced to? */
-    if (p->ref == 0) {
-      /* remember next pbuf in chain for next iteration */
-      q = p->next;
-      LWIP_DEBUGF( PBUF_DEBUG | 2, ("pbuf_free: deallocating %p\n", (void *)p));
-      flags = p->flags;
-      /* is this a pbuf from the pool? */
-      if (flags == PBUF_FLAG_POOL) {
-        p->len = p->tot_len = PBUF_POOL_BUFSIZE;
-        p->payload = (void *)((u8_t *)p + sizeof(struct pbuf));
-        PBUF_POOL_FREE(p);
-      /* is this a ROM or RAM referencing pbuf? */
-      } else if (flags == PBUF_FLAG_ROM || flags == PBUF_FLAG_REF) {
-        memp_free(MEMP_PBUF, p);
-      /* flags == PBUF_FLAG_RAM */
-      } else {
-        mem_free(p);
-      }
-      count++;
-      /* proceed to next pbuf */
-      p = q;
-    /* p->ref > 0, this pbuf is still referenced to */
-    /* (and so the remaining pbufs in chain as well) */
-    } else {
-      LWIP_DEBUGF( PBUF_DEBUG | 2, ("pbuf_free: %p has ref %"U16_F", ending here.\n", (void *)p, (u16_t)p->ref));
-      /* stop walking through the chain */
-      p = NULL;
-    }
-  }
-  SYS_ARCH_UNPROTECT(old_level);
-  PERF_STOP("pbuf_free");
-  /* return number of de-allocated pbufs */
-  return count;
-}
-
-/**
- * Count number of pbufs in a chain
- *
- * @param p first pbuf of chain
- * @return the number of pbufs in a chain
- */
-
-u8_t
-pbuf_clen(struct pbuf *p)
-{
-  u8_t len;
-
-  len = 0;
-  while (p != NULL) {
-    ++len;
-    p = p->next;
-  }
-  return len;
-}
-
-/**
- * Increment the reference count of the pbuf.
- *
- * @param p pbuf to increase reference counter of
- *
- */
-void
-pbuf_ref(struct pbuf *p)
-{
-  SYS_ARCH_DECL_PROTECT(old_level);
-  /* pbuf given? */
-  if (p != NULL) {
-    SYS_ARCH_PROTECT(old_level);
-    ++(p->ref);
-    SYS_ARCH_UNPROTECT(old_level);
-  }
-}
-
-/**
- * Concatenate two pbufs (each may be a pbuf chain) and take over
- * the caller's reference of the tail pbuf.
- * 
- * @note The caller MAY NOT reference the tail pbuf afterwards.
- * Use pbuf_chain() for that purpose.
- * 
- * @see pbuf_chain()
- */
-
-void
-pbuf_cat(struct pbuf *h, struct pbuf *t)
-{
-  struct pbuf *p;
-
-  LWIP_ASSERT("h != NULL (programmer violates API)", h != NULL);
-  LWIP_ASSERT("t != NULL (programmer violates API)", t != NULL);
-  if ((h == NULL) || (t == NULL)) return;
-
-  /* proceed to last pbuf of chain */
-  for (p = h; p->next != NULL; p = p->next) {
-    /* add total length of second chain to all totals of first chain */
-    p->tot_len += t->tot_len;
-  }
-  /* { p is last pbuf of first h chain, p->next == NULL } */
-  LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);
-  LWIP_ASSERT("p->next == NULL", p->next == NULL);
-  /* add total length of second chain to last pbuf total of first chain */
-  p->tot_len += t->tot_len;
-  /* chain last pbuf of head (p) with first of tail (t) */
-  p->next = t;
-  /* p->next now references t, but the caller will drop its reference to t,
-   * so netto there is no change to the reference count of t.
-   */
-}
-
-/**
- * Chain two pbufs (or pbuf chains) together.
- * 
- * The caller MUST call pbuf_free(t) once it has stopped
- * using it. Use pbuf_cat() instead if you no longer use t.
- * 
- * @param h head pbuf (chain)
- * @param t tail pbuf (chain)
- * @note The pbufs MUST belong to the same packet.
- * @note MAY NOT be called on a packet queue.
- *
- * The ->tot_len fields of all pbufs of the head chain are adjusted.
- * The ->next field of the last pbuf of the head chain is adjusted.
- * The ->ref field of the first pbuf of the tail chain is adjusted.
- *
- */
-void
-pbuf_chain(struct pbuf *h, struct pbuf *t)
-{
-  pbuf_cat(h, t);
-  /* t is now referenced by h */
-  pbuf_ref(t);
-  LWIP_DEBUGF(PBUF_DEBUG | DBG_FRESH | 2, ("pbuf_chain: %p references %p\n", (void *)h, (void *)t));
-}
-
-/* For packet queueing. Note that queued packets MUST be dequeued first
- * using pbuf_dequeue() before calling other pbuf_() functions. */
-#if ARP_QUEUEING
-/**
- * Add a packet to the end of a queue.
- *
- * @param q pointer to first packet on the queue
- * @param n packet to be queued
- *
- * Both packets MUST be given, and must be different.
- */
-void
-pbuf_queue(struct pbuf *p, struct pbuf *n)
-{
-#if PBUF_DEBUG /* remember head of queue */
-  struct pbuf *q = p;
-#endif
-  /* programmer stupidity checks */
-  LWIP_ASSERT("p == NULL in pbuf_queue: this indicates a programmer error\n", p != NULL);
-  LWIP_ASSERT("n == NULL in pbuf_queue: this indicates a programmer error\n", n != NULL);
-  LWIP_ASSERT("p == n in pbuf_queue: this indicates a programmer error\n", p != n);
-  if ((p == NULL) || (n == NULL) || (p == n)){
-    LWIP_DEBUGF(PBUF_DEBUG | DBG_HALT | 3, ("pbuf_queue: programmer argument error\n"));
-    return;
-  }
-
-  /* iterate through all packets on queue */
-  while (p->next != NULL) {
-/* be very picky about pbuf chain correctness */
-#if PBUF_DEBUG
-    /* iterate through all pbufs in packet */
-    while (p->tot_len != p->len) {
-      /* make sure invariant condition holds */
-      LWIP_ASSERT("p->len < p->tot_len", p->len < p->tot_len);
-      /* make sure each packet is complete */
-      LWIP_ASSERT("p->next != NULL", p->next != NULL);
-      p = p->next;
-      /* { p->tot_len == p->len => p is last pbuf of a packet } */
-    }
-    /* { p is last pbuf of a packet } */
-    /* proceed to next packet on queue */
-#endif
-    /* proceed to next pbuf */
-    if (p->next != NULL) p = p->next;
-  }
-  /* { p->tot_len == p->len and p->next == NULL } ==>
-   * { p is last pbuf of last packet on queue } */
-  /* chain last pbuf of queue with n */
-  p->next = n;
-  /* n is now referenced to by the (packet p in the) queue */
-  pbuf_ref(n);
-#if PBUF_DEBUG
-  LWIP_DEBUGF(PBUF_DEBUG | DBG_FRESH | 2,
-    ("pbuf_queue: newly queued packet %p sits after packet %p in queue %p\n",
-    (void *)n, (void *)p, (void *)q));
-#endif
-}
-
-/**
- * Remove a packet from the head of a queue.
- *
- * The caller MUST reference the remainder of the queue (as returned). The
- * caller MUST NOT call pbuf_ref() as it implicitly takes over the reference
- * from p.
- * 
- * @param p pointer to first packet on the queue which will be dequeued.
- * @return first packet on the remaining queue (NULL if no further packets).
- *
- */
-struct pbuf *
-pbuf_dequeue(struct pbuf *p)
-{
-  struct pbuf *q;
-  LWIP_ASSERT("p != NULL", p != NULL);
-
-  /* iterate through all pbufs in packet p */
-  while (p->tot_len != p->len) {
-    /* make sure invariant condition holds */
-    LWIP_ASSERT("p->len < p->tot_len", p->len < p->tot_len);
-    /* make sure each packet is complete */
-    LWIP_ASSERT("p->next != NULL", p->next != NULL);
-    p = p->next;
-  }
-  /* { p->tot_len == p->len } => p is the last pbuf of the first packet */
-  /* remember next packet on queue in q */
-  q = p->next;
-  /* dequeue packet p from queue */
-  p->next = NULL;
-  /* any next packet on queue? */
-  if (q != NULL) {
-    /* although q is no longer referenced by p, it MUST be referenced by
-     * the caller, who is maintaining this packet queue. So, we do not call
-     * pbuf_free(q) here, resulting in an implicit pbuf_ref(q) for the caller. */
-    LWIP_DEBUGF(PBUF_DEBUG | DBG_FRESH | 2, ("pbuf_dequeue: first remaining packet on queue is %p\n", (void *)q));
-  } else {
-    LWIP_DEBUGF(PBUF_DEBUG | DBG_FRESH | 2, ("pbuf_dequeue: no further packets on queue\n"));
-  }
-  return q;
-}
-#endif
-
-/**
- *
- * Create PBUF_POOL (or PBUF_RAM) copies of PBUF_REF pbufs.
- *
- * Used to queue packets on behalf of the lwIP stack, such as
- * ARP based queueing.
- *
- * Go through a pbuf chain and replace any PBUF_REF buffers
- * with PBUF_POOL (or PBUF_RAM) pbufs, each taking a copy of
- * the referenced data.
- *
- * @note You MUST explicitly use p = pbuf_take(p);
- * The pbuf you give as argument, may have been replaced
- * by a (differently located) copy through pbuf_take()!
- *
- * @note Any replaced pbufs will be freed through pbuf_free().
- * This may deallocate them if they become no longer referenced.
- *
- * @param p Head of pbuf chain to process
- *
- * @return Pointer to head of pbuf chain
- */
-struct pbuf *
-pbuf_take(struct pbuf *p)
-{
-  struct pbuf *q , *prev, *head;
-  LWIP_ASSERT("pbuf_take: p != NULL\n", p != NULL);
-  LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 3, ("pbuf_take(%p)\n", (void*)p));
-
-  prev = NULL;
-  head = p;
-  /* iterate through pbuf chain */
-  do
-  {
-    /* pbuf is of type PBUF_REF? */
-    if (p->flags == PBUF_FLAG_REF) {
-      LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE, ("pbuf_take: encountered PBUF_REF %p\n", (void *)p));
-      /* allocate a pbuf (w/ payload) fully in RAM */
-      /* PBUF_POOL buffers are faster if we can use them */
-      if (p->len <= PBUF_POOL_BUFSIZE) {
-        q = pbuf_alloc(PBUF_RAW, p->len, PBUF_POOL);
-        if (q == NULL) {
-          LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2, ("pbuf_take: Could not allocate PBUF_POOL\n"));
-        }
-      } else {
-        /* no replacement pbuf yet */
-        q = NULL;
-        LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2, ("pbuf_take: PBUF_POOL too small to replace PBUF_REF\n"));
-      }
-      /* no (large enough) PBUF_POOL was available? retry with PBUF_RAM */
-      if (q == NULL) {
-        q = pbuf_alloc(PBUF_RAW, p->len, PBUF_RAM);
-        if (q == NULL) {
-          LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 2, ("pbuf_take: Could not allocate PBUF_RAM\n"));
-        }
-      }
-      /* replacement pbuf could be allocated? */
-      if (q != NULL)
-      {
-        /* copy p to q */
-        /* copy successor */
-        q->next = p->next;
-        /* remove linkage from original pbuf */
-        p->next = NULL;
-        /* remove linkage to original pbuf */
-        if (prev != NULL) {
-          /* prev->next == p at this point */
-          LWIP_ASSERT("prev->next == p", prev->next == p);
-          /* break chain and insert new pbuf instead */
-          prev->next = q;
-        /* prev == NULL, so we replaced the head pbuf of the chain */
-        } else {
-          head = q;
-        }
-        /* copy pbuf payload */
-        memcpy(q->payload, p->payload, p->len);
-        q->tot_len = p->tot_len;
-        q->len = p->len;
-        /* in case p was the first pbuf, it is no longer refered to by
-         * our caller, as the caller MUST do p = pbuf_take(p);
-         * in case p was not the first pbuf, it is no longer refered to
-         * by prev. we can safely free the pbuf here.
-         * (note that we have set p->next to NULL already so that
-         * we will not free the rest of the chain by accident.)
-         */
-        pbuf_free(p);
-        /* do not copy ref, since someone else might be using the old buffer */
-        LWIP_DEBUGF(PBUF_DEBUG, ("pbuf_take: replaced PBUF_REF %p with %p\n", (void *)p, (void *)q));
-        p = q;
-      } else {
-        /* deallocate chain */
-        pbuf_free(head);
-        LWIP_DEBUGF(PBUF_DEBUG | 2, ("pbuf_take: failed to allocate replacement pbuf for %p\n", (void *)p));
-        return NULL;
-      }
-    /* p->flags != PBUF_FLAG_REF */
-    } else {
-      LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 1, ("pbuf_take: skipping pbuf not of type PBUF_REF\n"));
-    }
-    /* remember this pbuf */
-    prev = p;
-    /* proceed to next pbuf in original chain */
-    p = p->next;
-  } while (p);
-  LWIP_DEBUGF(PBUF_DEBUG | DBG_TRACE | 1, ("pbuf_take: end of chain reached.\n"));
-
-  return head;
-}
-
-/**
- * Dechains the first pbuf from its succeeding pbufs in the chain.
- *
- * Makes p->tot_len field equal to p->len.
- * @param p pbuf to dechain
- * @return remainder of the pbuf chain, or NULL if it was de-allocated.
- * @note May not be called on a packet queue.
- */
-struct pbuf *
-pbuf_dechain(struct pbuf *p)
-{
-  struct pbuf *q;
-  u8_t tail_gone = 1;
-  /* tail */
-  q = p->next;
-  /* pbuf has successor in chain? */
-  if (q != NULL) {
-    /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */
-    LWIP_ASSERT("p->tot_len == p->len + q->tot_len", q->tot_len == p->tot_len - p->len);
-    /* enforce invariant if assertion is disabled */
-    q->tot_len = p->tot_len - p->len;
-    /* decouple pbuf from remainder */
-    p->next = NULL;
-    /* total length of pbuf p is its own length only */
-    p->tot_len = p->len;
-    /* q is no longer referenced by p, free it */
-    LWIP_DEBUGF(PBUF_DEBUG | DBG_STATE, ("pbuf_dechain: unreferencing %p\n", (void *)q));
-    tail_gone = pbuf_free(q);
-    if (tail_gone > 0) {
-      LWIP_DEBUGF(PBUF_DEBUG | DBG_STATE,
-                  ("pbuf_dechain: deallocated %p (as it is no longer referenced)\n", (void *)q));
-    }
-    /* return remaining tail or NULL if deallocated */
-  }
-  /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */
-  LWIP_ASSERT("p->tot_len == p->len", p->tot_len == p->len);
-  return (tail_gone > 0? NULL: q);
-}
diff --git a/src/VBox/Devices/Network/lwip/src/core/raw.c b/src/VBox/Devices/Network/lwip/src/core/raw.c
deleted file mode 100644
index 3019980..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/raw.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/**
- * @file
- * 
- * Implementation of raw protocol PCBs for low-level handling of
- * different types of protocols besides (or overriding) those
- * already available in lwIP.
- *
- */
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include <string.h>
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/memp.h"
-#include "lwip/inet.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-#include "lwip/raw.h"
-
-#include "lwip/stats.h"
-
-#include "arch/perf.h"
-#include "lwip/snmp.h"
-
-#if LWIP_RAW
-
-/** The list of RAW PCBs */
-static struct raw_pcb *raw_pcbs = NULL;
-
-void
-raw_init(void)
-{
-  raw_pcbs = NULL;
-}
-
-/**
- * Determine if in incoming IP packet is covered by a RAW PCB
- * and if so, pass it to a user-provided receive callback function.
- *
- * Given an incoming IP datagram (as a chain of pbufs) this function
- * finds a corresponding RAW PCB and calls the corresponding receive
- * callback function.
- *
- * @param pbuf pbuf to be demultiplexed to a RAW PCB.
- * @param netif network interface on which the datagram was received.
- * @Return - 1 if the packet has been eaten by a RAW PCB receive
- *           callback function. The caller MAY NOT not reference the
- *           packet any longer, and MAY NOT call pbuf_free().
- * @return - 0 if packet is not eaten (pbuf is still referenced by the
- *           caller).
- *
- */
-u8_t
-raw_input(struct pbuf *p, struct netif *inp)
-{
-  struct raw_pcb *pcb;
-  struct ip_hdr *iphdr;
-  s16_t proto;
-  u8_t eaten = 0;
-
-  iphdr = p->payload;
-  proto = IPH_PROTO(iphdr);
-
-  pcb = raw_pcbs;
-  /* loop through all raw pcbs until the packet is eaten by one */
-  /* this allows multiple pcbs to match against the packet by design */
-  while ((eaten == 0) && (pcb != NULL)) {
-    if (pcb->protocol == proto) {
-      /* receive callback function available? */
-      if (pcb->recv != NULL) {
-        /* the receive callback function did not eat the packet? */
-        if (pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src)) != 0)
-        {
-          /* receive function ate the packet */
-          p = NULL;
-          eaten = 1;
-        }
-      }
-      /* no receive callback function was set for this raw PCB */
-      /* drop the packet */
-    }
-    pcb = pcb->next;
-  }
-  return eaten;
-}
-
-/**
- * Bind a RAW PCB.
- *
- * @param pcb RAW PCB to be bound with a local address ipaddr.
- * @param ipaddr local IP address to bind with. Use IP_ADDR_ANY to
- * bind to all local interfaces.
- *
- * @return lwIP error code.
- * - ERR_OK. Successful. No error occured.
- * - ERR_USE. The specified IP address is already bound to by
- * another RAW PCB.
- *
- * @see raw_disconnect()
- */
-err_t
-raw_bind(struct raw_pcb *pcb, struct ip_addr *ipaddr)
-{
-  ip_addr_set(&pcb->local_ip, ipaddr);
-  return ERR_OK;
-}
-
-/**
- * Connect an RAW PCB. This function is required by upper layers
- * of lwip. Using the raw api you could use raw_sendto() instead
- *
- * This will associate the RAW PCB with the remote address.
- *
- * @param pcb RAW PCB to be connected with remote address ipaddr and port.
- * @param ipaddr remote IP address to connect with.
- *
- * @return lwIP error code
- *
- * @see raw_disconnect() and raw_sendto()
- */
-err_t
-raw_connect(struct raw_pcb *pcb, struct ip_addr *ipaddr)
-{
-  ip_addr_set(&pcb->remote_ip, ipaddr);
-  return ERR_OK;
-}
-
-
-/**
- * Set the callback function for received packets that match the
- * raw PCB's protocol and binding. 
- * 
- * The callback function MUST either
- * - eat the packet by calling pbuf_free() and returning non-zero. The
- *   packet will not be passed to other raw PCBs or other protocol layers.
- * - not free the packet, and return zero. The packet will be matched
- *   against further PCBs and/or forwarded to another protocol layers.
- * 
- * @return non-zero if the packet was free()d, zero if the packet remains
- * available for others.
- */
-void
-raw_recv(struct raw_pcb *pcb,
-         u8_t (* recv)(void *arg, struct raw_pcb *upcb, struct pbuf *p,
-                      struct ip_addr *addr),
-         void *recv_arg)
-{
-  /* remember recv() callback and user data */
-  pcb->recv = recv;
-  pcb->recv_arg = recv_arg;
-}
-
-/**
- * Send the raw IP packet to the given address. Note that actually you cannot
- * modify the IP headers (this is inconsistent with the receive callback where
- * you actually get the IP headers), you can only specify the IP payload here.
- * It requires some more changes in lwIP. (there will be a raw_send() function
- * then.)
- *
- * @param pcb the raw pcb which to send
- * @param p the IP payload to send
- * @param ipaddr the destination address of the IP packet
- *
- */
-err_t
-raw_sendto(struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *ipaddr)
-{
-  err_t err;
-  struct netif *netif;
-  struct ip_addr *src_ip;
-  struct pbuf *q; /* q will be sent down the stack */
-  
-  LWIP_DEBUGF(RAW_DEBUG | DBG_TRACE | 3, ("raw_sendto\n"));
-  
-  /* not enough space to add an IP header to first pbuf in given p chain? */
-  if (pbuf_header(p, IP_HLEN)) {
-    /* allocate header in new pbuf */
-    q = pbuf_alloc(PBUF_IP, 0, PBUF_RAM);
-    /* new header pbuf could not be allocated? */
-    if (q == NULL) {
-      LWIP_DEBUGF(RAW_DEBUG | DBG_TRACE | 2, ("raw_sendto: could not allocate header\n"));
-      return ERR_MEM;
-    }
-    /* chain header q in front of given pbuf p */
-    pbuf_chain(q, p);
-    /* { first pbuf q points to header pbuf } */
-    LWIP_DEBUGF(RAW_DEBUG, ("raw_sendto: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p));
-  }  else {
-    /* first pbuf q equals given pbuf */
-    q = p;
-    pbuf_header(q, -IP_HLEN);
-  }
-  
-  if ((netif = ip_route(ipaddr)) == NULL) {
-    LWIP_DEBUGF(RAW_DEBUG | 1, ("raw_sendto: No route to 0x%"X32_F"\n", ipaddr->addr));
-#if RAW_STATS
-    /*    ++lwip_stats.raw.rterr;*/
-#endif /* RAW_STATS */
-    /* free any temporary header pbuf allocated by pbuf_header() */
-    if (q != p) {
-      pbuf_free(q);
-    }
-    return ERR_RTE;
-  }
-
-  if (ip_addr_isany(&pcb->local_ip)) {
-    /* use outgoing network interface IP address as source address */
-    src_ip = &(netif->ip_addr);
-  } else {
-    /* use RAW PCB local IP address as source address */
-    src_ip = &(pcb->local_ip);
-  }
-
-  err = ip_output_if (q, src_ip, ipaddr, pcb->ttl, pcb->tos, pcb->protocol, netif);
-
-  /* did we chain a header earlier? */
-  if (q != p) {
-    /* free the header */
-    pbuf_free(q);
-  }
-  return err;
-}
-
-/**
- * Send the raw IP packet to the address given by raw_connect()
- *
- * @param pcb the raw pcb which to send
- * @param p the IP payload to send
- * @param ipaddr the destination address of the IP packet
- *
- */
-err_t
-raw_send(struct raw_pcb *pcb, struct pbuf *p)
-{
-  return raw_sendto(pcb, p, &pcb->remote_ip);
-}
-
-/**
- * Remove an RAW PCB.
- *
- * @param pcb RAW PCB to be removed. The PCB is removed from the list of
- * RAW PCB's and the data structure is freed from memory.
- *
- * @see raw_new()
- */
-void
-raw_remove(struct raw_pcb *pcb)
-{
-  struct raw_pcb *pcb2;
-  /* pcb to be removed is first in list? */
-  if (raw_pcbs == pcb) {
-    /* make list start at 2nd pcb */
-    raw_pcbs = raw_pcbs->next;
-    /* pcb not 1st in list */
-  } else for(pcb2 = raw_pcbs; pcb2 != NULL; pcb2 = pcb2->next) {
-    /* find pcb in raw_pcbs list */
-    if (pcb2->next != NULL && pcb2->next == pcb) {
-      /* remove pcb from list */
-      pcb2->next = pcb->next;
-    }
-  }
-  memp_free(MEMP_RAW_PCB, pcb);
-}
-
-/**
- * Create a RAW PCB.
- *
- * @return The RAW PCB which was created. NULL if the PCB data structure
- * could not be allocated.
- *
- * @param proto the protocol number of the IPs payload (e.g. IP_PROTO_ICMP)
- *
- * @see raw_remove()
- */
-struct raw_pcb *
-raw_new(u16_t proto) {
-  struct raw_pcb *pcb;
-
-  LWIP_DEBUGF(RAW_DEBUG | DBG_TRACE | 3, ("raw_new\n"));
-
-  pcb = memp_malloc(MEMP_RAW_PCB);
-  /* could allocate RAW PCB? */
-  if (pcb != NULL) {
-    /* initialize PCB to all zeroes */
-    memset(pcb, 0, sizeof(struct raw_pcb));
-    pcb->protocol = proto;
-    pcb->ttl = RAW_TTL;
-    pcb->next = raw_pcbs;
-    raw_pcbs = pcb;
-  }
-  return pcb;
-}
-
-#endif /* LWIP_RAW */
diff --git a/src/VBox/Devices/Network/lwip/src/core/snmp/asn1_dec.c b/src/VBox/Devices/Network/lwip/src/core/snmp/asn1_dec.c
deleted file mode 100644
index 5e04b38..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/snmp/asn1_dec.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/**
- * @file
- * Abstract Syntax Notation One (ISO 8824, 8825) decoding
- *
- * @todo not optimised (yet), favor correctness over speed, favor speed over size
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#include "lwip/opt.h"
-
-#if LWIP_SNMP
-#include "lwip/snmp_asn1.h"
-
-/**
- * Retrieves type field from incoming pbuf chain.
- *
- * @param p points to a pbuf holding an ASN1 coded type field
- * @param ofs points to the offset within the pbuf chain of the ASN1 coded type field
- * @param type return ASN1 type
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode
- */
-err_t
-snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-      *type = *msg_ptr;
-      return ERR_OK;
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Decodes length field from incoming pbuf chain into host length.
- *
- * @param p points to a pbuf holding an ASN1 coded length
- * @param ofs points to the offset within the pbuf chain of the ASN1 coded length
- * @param octets_used returns number of octets used by the length code
- * @param length return host order length, upto 64k
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode
- */
-err_t
-snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-
-      if (*msg_ptr < 0x80)
-      {
-        /* primitive definite length format */
-        *octets_used = 1;
-        *length = *msg_ptr;
-        return ERR_OK;
-      }
-      else if (*msg_ptr == 0x80)
-      {
-        /* constructed indefinite length format, termination with two zero octets */
-        u8_t zeros;
-        u8_t i;
-
-        *length = 0;
-        zeros = 0;
-        while (zeros != 2)
-        {
-          i = 2;
-          while (i > 0)
-          {
-            i--;
-            (*length) += 1;
-            ofs += 1;
-            if (ofs >= plen)
-            {
-              /* next octet in next pbuf */
-              p = p->next;
-              if (p == NULL) { return ERR_ARG; }
-              msg_ptr = p->payload;
-              plen += p->len;
-            }
-            else
-            {
-              /* next octet in same pbuf */
-              msg_ptr++;
-            }
-            if (*msg_ptr == 0)
-            {
-              zeros++;
-              if (zeros == 2)
-              {
-                /* stop while (i > 0) */
-                i = 0;
-              }
-            }
-            else
-            {
-              zeros = 0;
-            }
-          }
-        }
-        *octets_used = 1;
-        return ERR_OK;
-      }
-      else if (*msg_ptr == 0x81)
-      {
-        /* constructed definite length format, one octet */
-        ofs += 1;
-        if (ofs >= plen)
-        {
-          /* next octet in next pbuf */
-          p = p->next;
-          if (p == NULL) { return ERR_ARG; }
-          msg_ptr = p->payload;
-        }
-        else
-        {
-          /* next octet in same pbuf */
-          msg_ptr++;
-        }
-        *length = *msg_ptr;
-        *octets_used = 2;
-        return ERR_OK;
-      }
-      else if (*msg_ptr == 0x82)
-      {
-        u8_t i;
-
-        /* constructed definite length format, two octets */
-        i = 2;
-        while (i > 0)
-        {
-          i--;
-          ofs += 1;
-          if (ofs >= plen)
-          {
-            /* next octet in next pbuf */
-            p = p->next;
-            if (p == NULL) { return ERR_ARG; }
-            msg_ptr = p->payload;
-            plen += p->len;
-          }
-          else
-          {
-            /* next octet in same pbuf */
-            msg_ptr++;
-          }
-          if (i == 0)
-          {
-            /* least significant length octet */
-            *length |= *msg_ptr;
-          }
-          else
-          {
-            /* most significant length octet */
-            *length = (*msg_ptr) << 8;
-          }
-        }
-        *octets_used = 3;
-        return ERR_OK;
-      }
-      else
-      {
-        /* constructed definite length format 3..127 octets, this is too big (>64k) */
-        /**  @todo: do we need to accept inefficient codings with many leading zero's? */
-        *octets_used = 1 + ((*msg_ptr) & 0x7f);
-        return ERR_ARG;
-      }
-    }
-    p = p->next;
-  }
-
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Decodes positive integer (counter, gauge, timeticks) into u32_t.
- *
- * @param p points to a pbuf holding an ASN1 coded integer
- * @param ofs points to the offset within the pbuf chain of the ASN1 coded integer
- * @param len length of the coded integer field
- * @param value return host order integer
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode
- *
- * @note ASN coded integers are _always_ signed. E.g. +0xFFFF is coded
- * as 0x00,0xFF,0xFF. Note the leading sign octet. A positive value
- * of 0xFFFFFFFF is preceded with 0x00 and the length is 5 octets!!
- */
-err_t
-snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-      if ((len > 0) && (len < 6))
-      {
-        /* start from zero */
-        *value = 0;
-        if (*msg_ptr & 0x80)
-        {
-          /* negative, expecting zero sign bit! */
-          return ERR_ARG;
-        }
-        else
-        {
-          /* positive */
-          if ((len > 1) && (*msg_ptr == 0))
-          {
-            /* skip leading "sign byte" octet 0x00 */
-            len--;
-            ofs += 1;
-            if (ofs >= plen)
-            {
-              /* next octet in next pbuf */
-              p = p->next;
-              if (p == NULL) { return ERR_ARG; }
-              msg_ptr = p->payload;
-              plen += p->len;
-            }
-            else
-            {
-              /* next octet in same pbuf */
-              msg_ptr++;
-            }
-          }
-        }
-        /* OR octets with value */
-        while (len > 1)
-        {
-          len--;
-          *value |= *msg_ptr;
-          *value <<= 8;
-          ofs += 1;
-          if (ofs >= plen)
-          {
-            /* next octet in next pbuf */
-            p = p->next;
-            if (p == NULL) { return ERR_ARG; }
-            msg_ptr = p->payload;
-            plen += p->len;
-          }
-          else
-          {
-            /* next octet in same pbuf */
-            msg_ptr++;
-          }
-        }
-        *value |= *msg_ptr;
-        return ERR_OK;
-      }
-      else
-      {
-        return ERR_ARG;
-      }
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Decodes integer into s32_t.
- *
- * @param p points to a pbuf holding an ASN1 coded integer
- * @param ofs points to the offset within the pbuf chain of the ASN1 coded integer
- * @param len length of the coded integer field
- * @param value return host order integer
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode
- *
- * @note ASN coded integers are _always_ signed!
- */
-err_t
-snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-  u8_t *lsb_ptr = (u8_t*)value;
-  u8_t sign;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-      if ((len > 0) && (len < 5))
-      {
-        if (*msg_ptr & 0x80)
-        {
-          /* negative, start from -1 */
-          *value = -1;
-          sign = 1;
-        }
-        else
-        {
-          /* positive, start from 0 */
-          *value = 0;
-          sign = 0;
-        }
-        /* OR/AND octets with value */
-        while (len > 1)
-        {
-          len--;
-          if (sign)
-          {
-            *lsb_ptr &= *msg_ptr;
-            *value <<= 8;
-            *lsb_ptr |= 255;
-          }
-          else
-          {
-            *lsb_ptr |= *msg_ptr;
-            *value <<= 8;
-          }
-          ofs += 1;
-          if (ofs >= plen)
-          {
-            /* next octet in next pbuf */
-            p = p->next;
-            if (p == NULL) { return ERR_ARG; }
-            msg_ptr = p->payload;
-            plen += p->len;
-          }
-          else
-          {
-            /* next octet in same pbuf */
-            msg_ptr++;
-          }
-        }
-        if (sign)
-        {
-          *lsb_ptr &= *msg_ptr;
-        }
-        else
-        {
-          *lsb_ptr |= *msg_ptr;
-        }
-        return ERR_OK;
-      }
-      else
-      {
-        return ERR_ARG;
-      }
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Decodes object identifier from incoming message into array of s32_t.
- *
- * @param p points to a pbuf holding an ASN1 coded object identifier
- * @param ofs points to the offset within the pbuf chain of the ASN1 coded object identifier
- * @param len length of the coded object identifier
- * @param oid return object identifier struct
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode
- */
-err_t
-snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-  s32_t *oid_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-
-      oid->len = 0;
-      oid_ptr = &oid->id[0];
-      if (len > 0)
-      {
-        /* first compressed octet */
-        if (*msg_ptr == 0x2B)
-        {
-          /* (most) common case 1.3 (iso.org) */
-          *oid_ptr = 1;
-          oid_ptr++;
-          *oid_ptr = 3;
-          oid_ptr++;
-        }
-        else if (*msg_ptr < 40)
-        {
-          *oid_ptr = 0;
-          oid_ptr++;
-          *oid_ptr = *msg_ptr;
-          oid_ptr++;
-        }
-        else if (*msg_ptr < 80)
-        {
-          *oid_ptr = 1;
-          oid_ptr++;
-          *oid_ptr = (*msg_ptr) - 40;
-          oid_ptr++;
-        }
-        else
-        {
-          *oid_ptr = 2;
-          oid_ptr++;
-          *oid_ptr = (*msg_ptr) - 80;
-          oid_ptr++;
-        }
-        oid->len = 2;
-      }
-      else
-      {
-        /* accepting zero length identifiers e.g. for
-           getnext operation. uncommon but valid */
-        return ERR_OK;
-      }
-      len--;
-      if (len > 0)
-      {
-        ofs += 1;
-        if (ofs >= plen)
-        {
-          /* next octet in next pbuf */
-          p = p->next;
-          if (p == NULL) { return ERR_ARG; }
-          msg_ptr = p->payload;
-          plen += p->len;
-        }
-        else
-        {
-          /* next octet in same pbuf */
-          msg_ptr++;
-        }
-      }
-      while ((len > 0) && (oid->len < LWIP_SNMP_OBJ_ID_LEN))
-      {
-        /* sub-identifier uses multiple octets */
-        if (*msg_ptr & 0x80)
-        {
-          s32_t sub_id = 0;
-
-          while ((*msg_ptr & 0x80) && (len > 1))
-          {
-            len--;
-            sub_id = (sub_id << 7) + (*msg_ptr & ~0x80);
-            ofs += 1;
-            if (ofs >= plen)
-            {
-              /* next octet in next pbuf */
-              p = p->next;
-              if (p == NULL) { return ERR_ARG; }
-              msg_ptr = p->payload;
-              plen += p->len;
-            }
-            else
-            {
-              /* next octet in same pbuf */
-              msg_ptr++;
-            }
-          }
-          if (!(*msg_ptr & 0x80) && (len > 0))
-          {
-            /* last octet sub-identifier */
-            len--;
-            sub_id = (sub_id << 7) + *msg_ptr;
-            *oid_ptr = sub_id;
-          }
-        }
-        else
-        {
-          /* !(*msg_ptr & 0x80) sub-identifier uses single octet */
-          len--;
-          *oid_ptr = *msg_ptr;
-        }
-        if (len > 0)
-        {
-          /* remaining oid bytes available ... */
-          ofs += 1;
-          if (ofs >= plen)
-          {
-            /* next octet in next pbuf */
-            p = p->next;
-            if (p == NULL) { return ERR_ARG; }
-            msg_ptr = p->payload;
-            plen += p->len;
-          }
-          else
-          {
-            /* next octet in same pbuf */
-            msg_ptr++;
-          }
-        }
-        oid_ptr++;
-        oid->len++;
-      }
-      if (len == 0)
-      {
-        /* len == 0, end of oid */
-        return ERR_OK;
-      }
-      else
-      {
-        /* len > 0, oid->len == LWIP_SNMP_OBJ_ID_LEN or malformed encoding */
-        return ERR_ARG;
-      }
-
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Decodes (copies) raw data (ip-addresses, octet strings, opaque encoding)
- * from incoming message into array.
- *
- * @param p points to a pbuf holding an ASN1 coded raw data
- * @param ofs points to the offset within the pbuf chain of the ASN1 coded raw data
- * @param len length of the coded raw data (zero is valid, e.g. empty string!)
- * @param raw_len length of the raw return value
- * @param raw return raw bytes
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode
- */
-err_t
-snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  if (len > 0)
-  {
-    plen = 0;
-    while (p != NULL)
-    {
-      base = plen;
-      plen += p->len;
-      if (ofs < plen)
-      {
-        msg_ptr = p->payload;
-        msg_ptr += ofs - base;
-        if (raw_len >= len)
-        {
-          while (len > 1)
-          {
-            /* copy len - 1 octets */
-            len--;
-            *raw = *msg_ptr;
-            raw++;
-            ofs += 1;
-            if (ofs >= plen)
-            {
-              /* next octet in next pbuf */
-              p = p->next;
-              if (p == NULL) { return ERR_ARG; }
-              msg_ptr = p->payload;
-              plen += p->len;
-            }
-            else
-            {
-              /* next octet in same pbuf */
-              msg_ptr++;
-            }
-          }
-          /* copy last octet */
-          *raw = *msg_ptr;
-          return ERR_OK;
-        }
-        else
-        {
-          /* raw_len < len, not enough dst space */
-          return ERR_ARG;
-        }
-      }
-      p = p->next;
-    }
-    /* p == NULL, ofs >= plen */
-    return ERR_ARG;
-  }
-  else
-  {
-    /* len == 0, empty string */
-    return ERR_OK;
-  }
-}
-
-#endif /* LWIP_SNMP */
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/snmp/asn1_enc.c b/src/VBox/Devices/Network/lwip/src/core/snmp/asn1_enc.c
deleted file mode 100644
index 4d04f28..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/snmp/asn1_enc.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/**
- * @file
- * Abstract Syntax Notation One (ISO 8824, 8825) encoding
- *
- * @todo not optimised (yet), favor correctness over speed, favor speed over size
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#include "lwip/opt.h"
-
-#if LWIP_SNMP
-#include "lwip/snmp_asn1.h"
-
-/**
- * Returns octet count for length.
- *
- * @param length
- * @param octets_needed points to the return value
- */
-void
-snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed)
-{
-  if (length < 0x80U)
-  {
-    *octets_needed = 1;
-  }
-  else if (length < 0x100U)
-  {
-    *octets_needed = 2;
-  }
-  else
-  {
-    *octets_needed = 3;
-  }
-}
-
-/**
- * Returns octet count for an u32_t.
- *
- * @param value
- * @param octets_needed points to the return value
- *
- * @note ASN coded integers are _always_ signed. E.g. +0xFFFF is coded
- * as 0x00,0xFF,0xFF. Note the leading sign octet. A positive value
- * of 0xFFFFFFFF is preceded with 0x00 and the length is 5 octets!!
- */
-void
-snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed)
-{
-  if (value < 0x80UL)
-  {
-    *octets_needed = 1;
-  }
-  else if (value < 0x8000UL)
-  {
-    *octets_needed = 2;
-  }
-  else if (value < 0x800000UL)
-  {
-    *octets_needed = 3;
-  }
-  else if (value < 0x80000000UL)
-  {
-    *octets_needed = 4;
-  }
-  else
-  {
-    *octets_needed = 5;
-  }
-}
-
-/**
- * Returns octet count for an s32_t.
- *
- * @param value
- * @param octets_needed points to the return value
- *
- * @note ASN coded integers are _always_ signed.
- */
-void
-snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed)
-{
-  if (value < 0)
-  {
-    value = ~value;
-  }
-  if (value < 0x80L)
-  {
-    *octets_needed = 1;
-  }
-  else if (value < 0x8000L)
-  {
-    *octets_needed = 2;
-  }
-  else if (value < 0x800000L)
-  {
-    *octets_needed = 3;
-  }
-  else
-  {
-    *octets_needed = 4;
-  }
-}
-
-/**
- * Returns octet count for an object identifier.
- *
- * @param ident_len object identifier array length
- * @param ident points to object identifier array
- * @param octets_needed points to the return value
- */
-void
-snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed)
-{
-  s32_t sub_id;
-  u8_t cnt;
-
-  cnt = 0;
-  if (ident_len > 1)
-  {
-    /* compressed prefix in one octet */
-    cnt++;
-    ident_len -= 2;
-    ident += 2;
-  }
-  while(ident_len > 0)
-  {
-    ident_len--;
-    sub_id = *ident;
-
-    sub_id >>= 7;
-    cnt++;
-    while(sub_id > 0)
-    {
-      sub_id >>= 7;
-      cnt++;
-    }
-    ident++;
-  }
-  *octets_needed = cnt;
-}
-
-/**
- * Encodes ASN type field into a pbuf chained ASN1 msg.
- *
- * @param p points to output pbuf to encode value into
- * @param ofs points to the offset within the pbuf chain
- * @param type input ASN1 type
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
- */
-err_t
-snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-      *msg_ptr = type;
-      return ERR_OK;
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Encodes host order length field into a pbuf chained ASN1 msg.
- *
- * @param p points to output pbuf to encode length into
- * @param ofs points to the offset within the pbuf chain
- * @param length is the host order length to be encoded
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
- */
-err_t
-snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-
-      if (length < 0x80)
-      {
-        *msg_ptr = length;
-        return ERR_OK;
-      }
-      else if (length < 0x100)
-      {
-        *msg_ptr = 0x81;
-        ofs += 1;
-        if (ofs >= plen)
-        {
-          /* next octet in next pbuf */
-          p = p->next;
-          if (p == NULL) { return ERR_ARG; }
-          msg_ptr = p->payload;
-        }
-        else
-        {
-          /* next octet in same pbuf */
-          msg_ptr++;
-        }
-        *msg_ptr = length;
-        return ERR_OK;
-      }
-      else
-      {
-        u8_t i;
-
-        /* length >= 0x100 && length <= 0xFFFF */
-        *msg_ptr = 0x82;
-        i = 2;
-        while (i > 0)
-        {
-          i--;
-          ofs += 1;
-          if (ofs >= plen)
-          {
-            /* next octet in next pbuf */
-            p = p->next;
-            if (p == NULL) { return ERR_ARG; }
-            msg_ptr = p->payload;
-            plen += p->len;
-          }
-          else
-          {
-            /* next octet in same pbuf */
-            msg_ptr++;
-          }
-          if (i == 0)
-          {
-            /* least significant length octet */
-            *msg_ptr = length;
-          }
-          else
-          {
-            /* most significant length octet */
-            *msg_ptr = length >> 8;
-          }
-        }
-        return ERR_OK;
-      }
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Encodes u32_t (counter, gauge, timeticks) into a pbuf chained ASN1 msg.
- *
- * @param p points to output pbuf to encode value into
- * @param ofs points to the offset within the pbuf chain
- * @param octets_needed encoding length (from snmp_asn1_enc_u32t_cnt())
- * @param value is the host order u32_t value to be encoded
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
- *
- * @see snmp_asn1_enc_u32t_cnt()
- */
-err_t
-snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, u32_t value)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-
-      if (octets_needed == 5)
-      {
-        /* not enough bits in 'value' add leading 0x00 */
-        octets_needed--;
-        *msg_ptr = 0x00;
-        ofs += 1;
-        if (ofs >= plen)
-        {
-          /* next octet in next pbuf */
-          p = p->next;
-          if (p == NULL) { return ERR_ARG; }
-          msg_ptr = p->payload;
-          plen += p->len;
-        }
-        else
-        {
-          /* next octet in same pbuf */
-          msg_ptr++;
-        }
-      }
-      while (octets_needed > 1)
-      {
-        octets_needed--;
-        *msg_ptr = value >> (octets_needed << 3);
-        ofs += 1;
-        if (ofs >= plen)
-        {
-          /* next octet in next pbuf */
-          p = p->next;
-          if (p == NULL) { return ERR_ARG; }
-          msg_ptr = p->payload;
-          plen += p->len;
-        }
-        else
-        {
-          /* next octet in same pbuf */
-          msg_ptr++;
-        }
-      }
-      /* (only) one least significant octet */
-      *msg_ptr = value;
-      return ERR_OK;
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Encodes s32_t integer into a pbuf chained ASN1 msg.
- *
- * @param p points to output pbuf to encode value into
- * @param ofs points to the offset within the pbuf chain
- * @param octets_needed encoding length (from snmp_asn1_enc_s32t_cnt())
- * @param value is the host order s32_t value to be encoded
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
- *
- * @see snmp_asn1_enc_s32t_cnt()
- */
-err_t
-snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, s32_t value)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-
-      while (octets_needed > 1)
-      {
-        octets_needed--;
-        *msg_ptr = value >> (octets_needed << 3);
-        ofs += 1;
-        if (ofs >= plen)
-        {
-          /* next octet in next pbuf */
-          p = p->next;
-          if (p == NULL) { return ERR_ARG; }
-          msg_ptr = p->payload;
-          plen += p->len;
-        }
-        else
-        {
-          /* next octet in same pbuf */
-          msg_ptr++;
-        }
-      }
-      /* (only) one least significant octet */
-      *msg_ptr = value;
-      return ERR_OK;
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Encodes object identifier into a pbuf chained ASN1 msg.
- *
- * @param p points to output pbuf to encode oid into
- * @param ofs points to the offset within the pbuf chain
- * @param ident_len object identifier array length
- * @param ident points to object identifier array
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
- */
-err_t
-snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-
-      if (ident_len > 1)
-      {
-        if ((ident[0] == 1) && (ident[1] == 3))
-        {
-          /* compressed (most common) prefix .iso.org */
-          *msg_ptr = 0x2b;
-        }
-        else
-        {
-          /* calculate prefix */
-          *msg_ptr = (ident[0] * 40) + ident[1];
-        }
-        ofs += 1;
-        if (ofs >= plen)
-        {
-          /* next octet in next pbuf */
-          p = p->next;
-          if (p == NULL) { return ERR_ARG; }
-          msg_ptr = p->payload;
-          plen += p->len;
-        }
-        else
-        {
-          /* next octet in same pbuf */
-          msg_ptr++;
-        }
-        ident_len -= 2;
-        ident += 2;
-      }
-      else
-      {
-/* @bug:  allow empty varbinds for symmetry (we must decode them for getnext), allow partial compression??  */
-        /* ident_len <= 1, at least we need zeroDotZero (0.0) (ident_len == 2) */
-        return ERR_ARG;
-      }
-      while (ident_len > 0)
-      {
-        s32_t sub_id;
-        u8_t shift, tail;
-
-        ident_len--;
-        sub_id = *ident;
-        tail = 0;
-        shift = 28;
-        while(shift > 0)
-        {
-          u8_t code;
-
-          code = sub_id >> shift;
-          if ((code != 0) || (tail != 0))
-          {
-            tail = 1;
-            *msg_ptr = code | 0x80;
-            ofs += 1;
-            if (ofs >= plen)
-            {
-              /* next octet in next pbuf */
-              p = p->next;
-              if (p == NULL) { return ERR_ARG; }
-              msg_ptr = p->payload;
-              plen += p->len;
-            }
-            else
-            {
-              /* next octet in same pbuf */
-              msg_ptr++;
-            }
-          }
-          shift -= 7;
-        }
-        *msg_ptr = (u8_t)sub_id & 0x7F;
-        if (ident_len > 0)
-        {
-          ofs += 1;
-          if (ofs >= plen)
-          {
-            /* next octet in next pbuf */
-            p = p->next;
-            if (p == NULL) { return ERR_ARG; }
-            msg_ptr = p->payload;
-            plen += p->len;
-          }
-          else
-          {
-            /* next octet in same pbuf */
-            msg_ptr++;
-          }
-        }
-        /* proceed to next sub-identifier */
-        ident++;
-      }
-      return ERR_OK;
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-/**
- * Encodes raw data (octet string, opaque) into a pbuf chained ASN1 msg.
- *
- * @param p points to output pbuf to encode raw data into
- * @param ofs points to the offset within the pbuf chain
- * @param raw_len raw data length
- * @param raw points raw data
- * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode
- */
-err_t
-snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u8_t raw_len, u8_t *raw)
-{
-  u16_t plen, base;
-  u8_t *msg_ptr;
-
-  plen = 0;
-  while (p != NULL)
-  {
-    base = plen;
-    plen += p->len;
-    if (ofs < plen)
-    {
-      msg_ptr = p->payload;
-      msg_ptr += ofs - base;
-
-      while (raw_len > 1)
-      {
-        /* copy raw_len - 1 octets */
-        raw_len--;
-        *msg_ptr = *raw;
-        raw++;
-        ofs += 1;
-        if (ofs >= plen)
-        {
-          /* next octet in next pbuf */
-          p = p->next;
-          if (p == NULL) { return ERR_ARG; }
-          msg_ptr = p->payload;
-          plen += p->len;
-        }
-        else
-        {
-          /* next octet in same pbuf */
-          msg_ptr++;
-        }
-      }
-      if (raw_len > 0)
-      {
-        /* copy last or single octet */
-        *msg_ptr = *raw;
-      }
-      return ERR_OK;
-    }
-    p = p->next;
-  }
-  /* p == NULL, ofs >= plen */
-  return ERR_ARG;
-}
-
-#endif /* LWIP_SNMP */
diff --git a/src/VBox/Devices/Network/lwip/src/core/snmp/mib2.c b/src/VBox/Devices/Network/lwip/src/core/snmp/mib2.c
deleted file mode 100644
index 3e478ab..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/snmp/mib2.c
+++ /dev/null
@@ -1,4021 +0,0 @@
-/**
- * @file
- * Management Information Base II (RFC1213) objects and functions.
- *
- * @note the object identifiers for this MIB-2 and private MIB tree
- * must be kept in sorted ascending order. This to ensure correct getnext operation.
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#include "arch/cc.h"
-#include "lwip/opt.h"
-
-#if LWIP_SNMP
-#include "lwip/snmp.h"
-#include "lwip/netif.h"
-#include "netif/etharp.h"
-#include "lwip/ip.h"
-#include "lwip/ip_frag.h"
-#include "lwip/tcp.h"
-#include "lwip/udp.h"
-#include "lwip/snmp_asn1.h"
-#include "lwip/snmp_structs.h"
-
-/**
- * IANA assigned enterprise ID for lwIP is 26381
- * @see http://www.iana.org/assignments/enterprise-numbers
- *
- * @note this enterprise ID is assigned to the lwIP project,
- * all object identifiers living under this ID are assigned
- * by the lwIP maintainers (contact Christiaan Simons)!
- * @note don't change this define, use snmp_set_sysobjid()
- *
- * If you need to create your own private MIB you'll need
- * to apply for your own enterprise ID with IANA:
- * http://www.iana.org/numbers.html
- */
-#define SNMP_ENTERPRISE_ID 26381
-#define SNMP_SYSOBJID_LEN 7
-#define SNMP_SYSOBJID {1, 3, 6, 1, 4, 1, SNMP_ENTERPRISE_ID}
-
-#ifndef SNMP_SYSSERVICES
-#define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2))
-#endif
-
-static void system_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void system_get_value(struct obj_def *od, u16_t len, void *value);
-static u8_t system_set_test(struct obj_def *od, u16_t len, void *value);
-static void system_set_value(struct obj_def *od, u16_t len, void *value);
-static void interfaces_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void interfaces_get_value(struct obj_def *od, u16_t len, void *value);
-static void ifentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void ifentry_get_value(struct obj_def *od, u16_t len, void *value);
-static void atentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void atentry_get_value(struct obj_def *od, u16_t len, void *value);
-static void ip_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void ip_get_value(struct obj_def *od, u16_t len, void *value);
-static u8_t ip_set_test(struct obj_def *od, u16_t len, void *value);
-static void ip_addrentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value);
-static void ip_rteentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value);
-static void ip_ntomentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void ip_ntomentry_get_value(struct obj_def *od, u16_t len, void *value);
-static void icmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void icmp_get_value(struct obj_def *od, u16_t len, void *value);
-#if LWIP_TCP
-static void tcp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void tcp_get_value(struct obj_def *od, u16_t len, void *value);
-static void tcpconnentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void tcpconnentry_get_value(struct obj_def *od, u16_t len, void *value);
-#endif
-static void udp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void udp_get_value(struct obj_def *od, u16_t len, void *value);
-static void udpentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void udpentry_get_value(struct obj_def *od, u16_t len, void *value);
-static void snmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-static void snmp_get_value(struct obj_def *od, u16_t len, void *value);
-static u8_t snmp_set_test(struct obj_def *od, u16_t len, void *value);
-static void snmp_set_value(struct obj_def *od, u16_t len, void *value);
-
-
-/* snmp .1.3.6.1.2.1.11 */
-const mib_scalar_node snmp_scalar = {
-  &snmp_get_object_def,
-  &snmp_get_value,
-  &snmp_set_test,
-  &snmp_set_value,
-  MIB_NODE_SC,
-  0
-};
-const s32_t snmp_ids[28] = {
-  1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16,
-  17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30
-};
-struct mib_node* const snmp_nodes[28] = {
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar,
-  (struct mib_node* const)&snmp_scalar, (struct mib_node* const)&snmp_scalar
-};
-const struct mib_array_node snmp = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  28,
-  snmp_ids,
-  snmp_nodes
-};
-
-/* dot3 and EtherLike MIB not planned. (transmission .1.3.6.1.2.1.10) */
-/* historical (some say hysterical). (cmot .1.3.6.1.2.1.9) */
-/* lwIP has no EGP, thus may not implement it. (egp .1.3.6.1.2.1.8) */
-
-/* udp .1.3.6.1.2.1.7 */
-/** index root node for udpTable */
-struct mib_list_rootnode udp_root = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_LR,
-  0,
-  NULL,
-  NULL,
-  0
-};
-const s32_t udpentry_ids[2] = { 1, 2 };
-struct mib_node* const udpentry_nodes[2] = {
-  (struct mib_node* const)&udp_root, (struct mib_node* const)&udp_root,
-};
-const struct mib_array_node udpentry = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  2,
-  udpentry_ids,
-  udpentry_nodes
-};
-
-s32_t udptable_id = 1;
-struct mib_node* udptable_node = (struct mib_node* const)&udpentry;
-struct mib_ram_array_node udptable = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_RA,
-  0,
-  &udptable_id,
-  &udptable_node
-};
-
-const mib_scalar_node udp_scalar = {
-  &udp_get_object_def,
-  &udp_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_SC,
-  0
-};
-const s32_t udp_ids[5] = { 1, 2, 3, 4, 5 };
-struct mib_node* const udp_nodes[5] = {
-  (struct mib_node* const)&udp_scalar, (struct mib_node* const)&udp_scalar,
-  (struct mib_node* const)&udp_scalar, (struct mib_node* const)&udp_scalar,
-  (struct mib_node* const)&udptable
-};
-const struct mib_array_node udp = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  5,
-  udp_ids,
-  udp_nodes
-};
-
-/* tcp .1.3.6.1.2.1.6 */
-#if LWIP_TCP
-/* only if the TCP protocol is available may implement this group */
-/** index root node for tcpConnTable */
-struct mib_list_rootnode tcpconntree_root = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_LR,
-  0,
-  NULL,
-  NULL,
-  0
-};
-const s32_t tcpconnentry_ids[5] = { 1, 2, 3, 4, 5 };
-struct mib_node* const tcpconnentry_nodes[5] = {
-  (struct mib_node* const)&tcpconntree_root, (struct mib_node* const)&tcpconntree_root,
-  (struct mib_node* const)&tcpconntree_root, (struct mib_node* const)&tcpconntree_root,
-  (struct mib_node* const)&tcpconntree_root
-};
-const struct mib_array_node tcpconnentry = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  5,
-  tcpconnentry_ids,
-  tcpconnentry_nodes
-};
-
-s32_t tcpconntable_id = 1;
-struct mib_node* tcpconntable_node = (struct mib_node* const)&tcpconnentry;
-struct mib_ram_array_node tcpconntable = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_RA,
-/** @todo update maxlength when inserting / deleting from table
-   0 when table is empty, 1 when more than one entry */
-  0,
-  &tcpconntable_id,
-  &tcpconntable_node
-};
-
-const mib_scalar_node tcp_scalar = {
-  &tcp_get_object_def,
-  &tcp_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_SC,
-  0
-};
-const s32_t tcp_ids[15] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-struct mib_node* const tcp_nodes[15] = {
-  (struct mib_node* const)&tcp_scalar, (struct mib_node* const)&tcp_scalar,
-  (struct mib_node* const)&tcp_scalar, (struct mib_node* const)&tcp_scalar,
-  (struct mib_node* const)&tcp_scalar, (struct mib_node* const)&tcp_scalar,
-  (struct mib_node* const)&tcp_scalar, (struct mib_node* const)&tcp_scalar,
-  (struct mib_node* const)&tcp_scalar, (struct mib_node* const)&tcp_scalar,
-  (struct mib_node* const)&tcp_scalar, (struct mib_node* const)&tcp_scalar,
-  (struct mib_node* const)&tcpconntable, (struct mib_node* const)&tcp_scalar,
-  (struct mib_node* const)&tcp_scalar
-};
-const struct mib_array_node tcp = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  15,
-  tcp_ids,
-  tcp_nodes
-};
-#endif
-
-/* icmp .1.3.6.1.2.1.5 */
-const mib_scalar_node icmp_scalar = {
-  &icmp_get_object_def,
-  &icmp_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_SC,
-  0
-};
-const s32_t icmp_ids[26] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 };
-struct mib_node* const icmp_nodes[26] = {
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar,
-  (struct mib_node* const)&icmp_scalar, (struct mib_node* const)&icmp_scalar
-};
-const struct mib_array_node icmp = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  26,
-  icmp_ids,
-  icmp_nodes
-};
-
-/** index root node for ipNetToMediaTable */
-struct mib_list_rootnode ipntomtree_root = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_LR,
-  0,
-  NULL,
-  NULL,
-  0
-};
-const s32_t ipntomentry_ids[4] = { 1, 2, 3, 4 };
-struct mib_node* const ipntomentry_nodes[4] = {
-  (struct mib_node* const)&ipntomtree_root, (struct mib_node* const)&ipntomtree_root,
-  (struct mib_node* const)&ipntomtree_root, (struct mib_node* const)&ipntomtree_root
-};
-const struct mib_array_node ipntomentry = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  4,
-  ipntomentry_ids,
-  ipntomentry_nodes
-};
-
-s32_t ipntomtable_id = 1;
-struct mib_node* ipntomtable_node = (struct mib_node* const)&ipntomentry;
-struct mib_ram_array_node ipntomtable = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_RA,
-  0,
-  &ipntomtable_id,
-  &ipntomtable_node
-};
-
-/** index root node for ipRouteTable */
-struct mib_list_rootnode iprtetree_root = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_LR,
-  0,
-  NULL,
-  NULL,
-  0
-};
-const s32_t iprteentry_ids[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
-struct mib_node* const iprteentry_nodes[13] = {
-  (struct mib_node* const)&iprtetree_root, (struct mib_node* const)&iprtetree_root,
-  (struct mib_node* const)&iprtetree_root, (struct mib_node* const)&iprtetree_root,
-  (struct mib_node* const)&iprtetree_root, (struct mib_node* const)&iprtetree_root,
-  (struct mib_node* const)&iprtetree_root, (struct mib_node* const)&iprtetree_root,
-  (struct mib_node* const)&iprtetree_root, (struct mib_node* const)&iprtetree_root,
-  (struct mib_node* const)&iprtetree_root, (struct mib_node* const)&iprtetree_root,
-  (struct mib_node* const)&iprtetree_root
-};
-const struct mib_array_node iprteentry = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  13,
-  iprteentry_ids,
-  iprteentry_nodes
-};
-
-s32_t iprtetable_id = 1;
-struct mib_node* iprtetable_node = (struct mib_node* const)&iprteentry;
-struct mib_ram_array_node iprtetable = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_RA,
-  0,
-  &iprtetable_id,
-  &iprtetable_node
-};
-
-/** index root node for ipAddrTable */
-struct mib_list_rootnode ipaddrtree_root = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_LR,
-  0,
-  NULL,
-  NULL,
-  0
-};
-const s32_t ipaddrentry_ids[5] = { 1, 2, 3, 4, 5 };
-struct mib_node* const ipaddrentry_nodes[5] = {
-  (struct mib_node* const)&ipaddrtree_root,
-  (struct mib_node* const)&ipaddrtree_root,
-  (struct mib_node* const)&ipaddrtree_root,
-  (struct mib_node* const)&ipaddrtree_root,
-  (struct mib_node* const)&ipaddrtree_root
-};
-const struct mib_array_node ipaddrentry = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  5,
-  ipaddrentry_ids,
-  ipaddrentry_nodes
-};
-
-s32_t ipaddrtable_id = 1;
-struct mib_node* ipaddrtable_node = (struct mib_node* const)&ipaddrentry;
-struct mib_ram_array_node ipaddrtable = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_RA,
-  0,
-  &ipaddrtable_id,
-  &ipaddrtable_node
-};
-
-/* ip .1.3.6.1.2.1.4 */
-const mib_scalar_node ip_scalar = {
-  &ip_get_object_def,
-  &ip_get_value,
-  &ip_set_test,
-  &noleafs_set_value,
-  MIB_NODE_SC,
-  0
-};
-const s32_t ip_ids[23] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
-struct mib_node* const ip_nodes[23] = {
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ip_scalar,
-  (struct mib_node* const)&ip_scalar, (struct mib_node* const)&ipaddrtable,
-  (struct mib_node* const)&iprtetable, (struct mib_node* const)&ipntomtable,
-  (struct mib_node* const)&ip_scalar
-};
-const struct mib_array_node ip = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  23,
-  ip_ids,
-  ip_nodes
-};
-
-/** index root node for atTable */
-struct mib_list_rootnode arptree_root = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_LR,
-  0,
-  NULL,
-  NULL,
-  0
-};
-const s32_t atentry_ids[3] = { 1, 2, 3 };
-struct mib_node* const atentry_nodes[3] = {
-  (struct mib_node* const)&arptree_root,
-  (struct mib_node* const)&arptree_root,
-  (struct mib_node* const)&arptree_root
-};
-const struct mib_array_node atentry = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  3,
-  atentry_ids,
-  atentry_nodes
-};
-
-const s32_t attable_id = 1;
-struct mib_node* const attable_node = (struct mib_node* const)&atentry;
-const struct mib_array_node attable = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  1,
-  &attable_id,
-  &attable_node
-};
-
-/* at .1.3.6.1.2.1.3 */
-s32_t at_id = 1;
-struct mib_node* at_node = (struct mib_node* const)&attable;
-struct mib_ram_array_node at = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_RA,
-  0,
-  &at_id,
-  &at_node
-};
-
-/** index root node for ifTable */
-struct mib_list_rootnode iflist_root = {
-  &ifentry_get_object_def,
-  &ifentry_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_LR,
-  0,
-  NULL,
-  NULL,
-  0
-};
-const s32_t ifentry_ids[22] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 };
-struct mib_node* const ifentry_nodes[22] = {
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root,
-  (struct mib_node* const)&iflist_root, (struct mib_node* const)&iflist_root
-};
-const struct mib_array_node ifentry = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  22,
-  ifentry_ids,
-  ifentry_nodes
-};
-
-s32_t iftable_id = 1;
-struct mib_node* iftable_node = (struct mib_node* const)&ifentry;
-struct mib_ram_array_node iftable = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_RA,
-  0,
-  &iftable_id,
-  &iftable_node
-};
-
-/* interfaces .1.3.6.1.2.1.2 */
-const mib_scalar_node interfaces_scalar = {
-  &interfaces_get_object_def,
-  &interfaces_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_SC,
-  0
-};
-const s32_t interfaces_ids[2] = { 1, 2 };
-struct mib_node* const interfaces_nodes[2] = {
-  (struct mib_node* const)&interfaces_scalar, (struct mib_node* const)&iftable
-};
-const struct mib_array_node interfaces = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  2,
-  interfaces_ids,
-  interfaces_nodes
-};
-
-
-/*             0 1 2 3 4 5 6 */
-/* system .1.3.6.1.2.1.1 */
-const mib_scalar_node sys_tem_scalar = {
-  &system_get_object_def,
-  &system_get_value,
-  &system_set_test,
-  &system_set_value,
-  MIB_NODE_SC,
-  0
-};
-const s32_t sys_tem_ids[7] = { 1, 2, 3, 4, 5, 6, 7 };
-struct mib_node* const sys_tem_nodes[7] = {
-  (struct mib_node* const)&sys_tem_scalar, (struct mib_node* const)&sys_tem_scalar,
-  (struct mib_node* const)&sys_tem_scalar, (struct mib_node* const)&sys_tem_scalar,
-  (struct mib_node* const)&sys_tem_scalar, (struct mib_node* const)&sys_tem_scalar,
-  (struct mib_node* const)&sys_tem_scalar
-};
-/* work around name issue with 'sys_tem', some compiler(s?) seem to reserve 'system' */
-const struct mib_array_node sys_tem = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  7,
-  sys_tem_ids,
-  sys_tem_nodes
-};
-
-/* mib-2 .1.3.6.1.2.1 */
-#if LWIP_TCP
-#define MIB2_GROUPS 8
-#else
-#define MIB2_GROUPS 7
-#endif
-const s32_t mib2_ids[MIB2_GROUPS] =
-{
-  1,
-  2,
-  3,
-  4,
-  5,
-#if LWIP_TCP
-  6,
-#endif
-  7,
-  11
-};
-struct mib_node* const mib2_nodes[MIB2_GROUPS] = {
-  (struct mib_node* const)&sys_tem,
-  (struct mib_node* const)&interfaces,
-  (struct mib_node* const)&at,
-  (struct mib_node* const)&ip,
-  (struct mib_node* const)&icmp,
-#if LWIP_TCP
-  (struct mib_node* const)&tcp,
-#endif
-  (struct mib_node* const)&udp,
-  (struct mib_node* const)&snmp
-};
-
-const struct mib_array_node mib2 = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  MIB2_GROUPS,
-  mib2_ids,
-  mib2_nodes
-};
-
-/* mgmt .1.3.6.1.2 */
-const s32_t mgmt_ids[1] = { 1 };
-struct mib_node* const mgmt_nodes[1] = { (struct mib_node* const)&mib2 };
-const struct mib_array_node mgmt = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  1,
-  mgmt_ids,
-  mgmt_nodes
-};
-
-/* internet .1.3.6.1 */
-#if SNMP_PRIVATE_MIB
-s32_t internet_ids[2] = { 2, 4 };
-struct mib_node* const internet_nodes[2] = { (struct mib_node* const)&mgmt, (struct mib_node* const)&private };
-const struct mib_array_node internet = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  2,
-  internet_ids,
-  internet_nodes
-};
-#else
-const s32_t internet_ids[1] = { 2 };
-struct mib_node* const internet_nodes[1] = { (struct mib_node* const)&mgmt };
-const struct mib_array_node internet = {
-  &noleafs_get_object_def,
-  &noleafs_get_value,
-  &noleafs_set_test,
-  &noleafs_set_value,
-  MIB_NODE_AR,
-  1,
-  internet_ids,
-  internet_nodes
-};
-#endif
-
-/** mib-2.system.sysObjectID  */
-static struct snmp_obj_id sysobjid = {SNMP_SYSOBJID_LEN, SNMP_SYSOBJID};
-/** enterprise ID for generic TRAPs, .iso.org.dod.internet.mgmt.mib-2.snmp */
-static struct snmp_obj_id snmpgrp_id = {7,{1,3,6,1,2,1,11}};
-/** mib-2.system.sysServices */
-static const s32_t sysservices = SNMP_SYSSERVICES;
-
-/** mib-2.system.sysDescr */
-static const u8_t sysdescr_len_default = 4;
-static const u8_t sysdescr_default[] = "lwIP";
-static u8_t* sysdescr_len_ptr = (u8_t*)&sysdescr_len_default;
-static u8_t* sysdescr_ptr = (u8_t*)&sysdescr_default[0];
-/** mib-2.system.sysContact */
-static const u8_t syscontact_len_default = 0;
-static const u8_t syscontact_default[] = "";
-static u8_t* syscontact_len_ptr = (u8_t*)&syscontact_len_default;
-static u8_t* syscontact_ptr = (u8_t*)&syscontact_default[0];
-/** mib-2.system.sysName */
-static const u8_t sysname_len_default = 8;
-static const u8_t sysname_default[] = "FQDN-unk";
-static u8_t* sysname_len_ptr = (u8_t*)&sysname_len_default;
-static u8_t* sysname_ptr = (u8_t*)&sysname_default[0];
-/** mib-2.system.sysLocation */
-static const u8_t syslocation_len_default = 0;
-static const u8_t syslocation_default[] = "";
-static u8_t* syslocation_len_ptr = (u8_t*)&syslocation_len_default;
-static u8_t* syslocation_ptr = (u8_t*)&syslocation_default[0];
-/** mib-2.snmp.snmpEnableAuthenTraps */
-static const u8_t snmpenableauthentraps_default = 2; /* disabled */
-static u8_t* snmpenableauthentraps_ptr = (u8_t*)&snmpenableauthentraps_default;
-
-/** mib-2.interfaces.ifTable.ifEntry.ifSpecific (zeroDotZero) */
-static const struct snmp_obj_id ifspecific = {2, {0, 0}};
-/** mib-2.ip.ipRouteTable.ipRouteEntry.ipRouteInfo (zeroDotZero) */
-static const struct snmp_obj_id iprouteinfo = {2, {0, 0}};
-
-
-
-/* mib-2.system counter(s) */
-static u32_t sysuptime = 0;
-
-/* mib-2.ip counter(s) */
-static u32_t ipinreceives = 0,
-             ipinhdrerrors = 0,
-             ipinaddrerrors = 0,
-             ipforwdatagrams = 0,
-             ipinunknownprotos = 0,
-             ipindiscards = 0,
-             ipindelivers = 0,
-             ipoutrequests = 0,
-             ipoutdiscards = 0,
-             ipoutnoroutes = 0,
-             ipreasmreqds = 0,
-             ipreasmoks = 0,
-             ipreasmfails = 0,
-             ipfragoks = 0,
-             ipfragfails = 0,
-             ipfragcreates = 0,
-             iproutingdiscards = 0;
-/* mib-2.icmp counter(s) */
-static u32_t icmpinmsgs = 0,
-             icmpinerrors = 0,
-             icmpindestunreachs = 0,
-             icmpintimeexcds = 0,
-             icmpinparmprobs = 0,
-             icmpinsrcquenchs = 0,
-             icmpinredirects = 0,
-             icmpinechos = 0,
-             icmpinechoreps = 0,
-             icmpintimestamps = 0,
-             icmpintimestampreps = 0,
-             icmpinaddrmasks = 0,
-             icmpinaddrmaskreps = 0,
-             icmpoutmsgs = 0,
-             icmpouterrors = 0,
-             icmpoutdestunreachs = 0,
-             icmpouttimeexcds = 0,
-             icmpoutparmprobs = 0,
-             icmpoutsrcquenchs = 0,
-             icmpoutredirects = 0,
-             icmpoutechos = 0,
-             icmpoutechoreps = 0,
-             icmpouttimestamps = 0,
-             icmpouttimestampreps = 0,
-             icmpoutaddrmasks = 0,
-             icmpoutaddrmaskreps = 0;
-/* mib-2.tcp counter(s) */
-static u32_t tcpactiveopens = 0,
-             tcppassiveopens = 0,
-             tcpattemptfails = 0,
-             tcpestabresets = 0,
-             tcpinsegs = 0,
-             tcpoutsegs = 0,
-             tcpretranssegs = 0,
-             tcpinerrs = 0,
-             tcpoutrsts = 0;
-/* mib-2.udp counter(s) */
-static u32_t udpindatagrams = 0,
-             udpnoports = 0,
-             udpinerrors = 0,
-             udpoutdatagrams = 0;
-/* mib-2.snmp counter(s) */
-static u32_t snmpinpkts = 0,
-             snmpoutpkts = 0,
-             snmpinbadversions = 0,
-             snmpinbadcommunitynames = 0,
-             snmpinbadcommunityuses = 0,
-             snmpinasnparseerrs = 0,
-             snmpintoobigs = 0,
-             snmpinnosuchnames = 0,
-             snmpinbadvalues = 0,
-             snmpinreadonlys = 0,
-             snmpingenerrs = 0,
-             snmpintotalreqvars = 0,
-             snmpintotalsetvars = 0,
-             snmpingetrequests = 0,
-             snmpingetnexts = 0,
-             snmpinsetrequests = 0,
-             snmpingetresponses = 0,
-             snmpintraps = 0,
-             snmpouttoobigs = 0,
-             snmpoutnosuchnames = 0,
-             snmpoutbadvalues = 0,
-             snmpoutgenerrs = 0,
-             snmpoutgetrequests = 0,
-             snmpoutgetnexts = 0,
-             snmpoutsetrequests = 0,
-             snmpoutgetresponses = 0,
-             snmpouttraps = 0;
-
-
-
-/* prototypes of the following functions are in lwip/src/include/lwip/snmp.h */
-/**
- * Copy octet string.
- *
- * @param dst points to destination
- * @param src points to source
- * @param n number of octets to copy.
- */
-void ocstrncpy(u8_t *dst, u8_t *src, u8_t n)
-{
-  while (n > 0)
-  {
-    n--;
-    *dst++ = *src++;
-  }
-}
-
-/**
- * Copy object identifier (s32_t) array.
- *
- * @param dst points to destination
- * @param src points to source
- * @param n number of sub identifiers to copy.
- */
-void objectidncpy(s32_t *dst, s32_t *src, u8_t n)
-{
-  while(n > 0)
-  {
-    n--;
-    *dst++ = *src++;
-  }
-}
-
-/**
- * Initializes sysDescr pointers.
- *
- * @param str if non-NULL then copy str pointer
- * @param strlen points to string length, excluding zero terminator
- */
-void snmp_set_sysdesr(u8_t *str, u8_t *strlen)
-{
-  if (str != NULL)
-  {
-    sysdescr_ptr = str;
-    sysdescr_len_ptr = strlen;
-  }
-}
-
-void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid)
-{
-  *oid = &sysobjid;
-}
-
-/**
- * Initializes sysObjectID value.
- *
- * @param oid points to stuct snmp_obj_id to copy
- */
-void snmp_set_sysobjid(struct snmp_obj_id *oid)
-{
-  sysobjid = *oid;
-}
-
-/**
- * Must be called at regular 10 msec interval from a timer interrupt
- * or signal handler depending on your runtime environment.
- */
-void snmp_inc_sysuptime(void)
-{
-  sysuptime++;
-}
-
-void snmp_get_sysuptime(u32_t *value)
-{
-  *value = sysuptime;
-}
-
-/**
- * Initializes sysContact pointers,
- * e.g. ptrs to non-volatile memory external to lwIP.
- *
- * @param str if non-NULL then copy str pointer
- * @param strlen points to string length, excluding zero terminator
- */
-void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen)
-{
-  if (ocstr != NULL)
-  {
-    syscontact_ptr = ocstr;
-    syscontact_len_ptr = ocstrlen;
-  }
-}
-
-/**
- * Initializes sysName pointers,
- * e.g. ptrs to non-volatile memory external to lwIP.
- *
- * @param str if non-NULL then copy str pointer
- * @param strlen points to string length, excluding zero terminator
- */
-void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen)
-{
-  if (ocstr != NULL)
-  {
-    sysname_ptr = ocstr;
-    sysname_len_ptr = ocstrlen;
-  }
-}
-
-/**
- * Initializes sysLocation pointers,
- * e.g. ptrs to non-volatile memory external to lwIP.
- *
- * @param str if non-NULL then copy str pointer
- * @param strlen points to string length, excluding zero terminator
- */
-void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen)
-{
-  if (ocstr != NULL)
-  {
-    syslocation_ptr = ocstr;
-    syslocation_len_ptr = ocstrlen;
-  }
-}
-
-
-void snmp_add_ifinoctets(struct netif *ni, u32_t value)
-{
-  ni->ifinoctets += value;
-}
-
-void snmp_inc_ifinucastpkts(struct netif *ni)
-{
-  (ni->ifinucastpkts)++;
-}
-
-void snmp_inc_ifinnucastpkts(struct netif *ni)
-{
-  (ni->ifinnucastpkts)++;
-}
-
-void snmp_inc_ifindiscards(struct netif *ni)
-{
-  (ni->ifindiscards)++;
-}
-
-void snmp_add_ifoutoctets(struct netif *ni, u32_t value)
-{
-  ni->ifoutoctets += value;
-}
-
-void snmp_inc_ifoutucastpkts(struct netif *ni)
-{
-  (ni->ifoutucastpkts)++;
-}
-
-void snmp_inc_ifoutnucastpkts(struct netif *ni)
-{
-  (ni->ifoutnucastpkts)++;
-}
-
-void snmp_inc_ifoutdiscards(struct netif *ni)
-{
-  (ni->ifoutdiscards)++;
-}
-
-void snmp_inc_iflist(void)
-{
-  struct mib_list_node *if_node = NULL;
-
-  snmp_mib_node_insert(&iflist_root, iflist_root.count + 1, &if_node);
-  /* enable getnext traversal on filled table */
-  iftable.maxlength = 1;
-}
-
-void snmp_dec_iflist(void)
-{
-  snmp_mib_node_delete(&iflist_root, iflist_root.tail);
-  /* disable getnext traversal on empty table */
-  if(iflist_root.count == 0) iftable.maxlength = 0;
-}
-
-/**
- * Inserts ARP table indexes (.xIfIndex.xNetAddress)
- * into arp table index trees (both atTable and ipNetToMediaTable).
- */
-void snmp_insert_arpidx_tree(struct netif *ni, struct ip_addr *ip)
-{
-  struct mib_list_rootnode *at_rn;
-  struct mib_list_node *at_node;
-  struct ip_addr hip;
-  s32_t arpidx[5];
-  u8_t level, tree;
-
-  LWIP_ASSERT("ni != NULL", ni != NULL);
-  snmp_netiftoifindex(ni, &arpidx[0]);
-  hip.addr = ntohl(ip->addr);
-  snmp_iptooid(&hip, &arpidx[1]);
-
-  for (tree = 0; tree < 2; tree++)
-  {
-    if (tree == 0)
-    {
-      at_rn = &arptree_root;
-    }
-    else
-    {
-      at_rn = &ipntomtree_root;
-    }
-    for (level = 0; level < 5; level++)
-    {
-      at_node = NULL;
-      snmp_mib_node_insert(at_rn, arpidx[level], &at_node);
-      if ((level != 4) && (at_node != NULL))
-      {
-        if (at_node->nptr == NULL)
-        {
-          at_rn = snmp_mib_lrn_alloc();
-          at_node->nptr = (struct mib_node*)at_rn;
-          if (at_rn != NULL)
-          {
-            if (level == 3)
-            {
-              if (tree == 0)
-              {
-                at_rn->get_object_def = atentry_get_object_def;
-                at_rn->get_value = atentry_get_value;
-              }
-              else
-              {
-                at_rn->get_object_def = ip_ntomentry_get_object_def;
-                at_rn->get_value = ip_ntomentry_get_value;
-              }
-              at_rn->set_test = noleafs_set_test;
-              at_rn->set_value = noleafs_set_value;
-            }
-          }
-          else
-          {
-            /* at_rn == NULL, malloc failure */
-            LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_insert_arpidx_tree() insert failed, mem full"));
-            break;
-          }
-        }
-        else
-        {
-          at_rn = (struct mib_list_rootnode*)at_node->nptr;
-        }
-      }
-    }
-  }
-  /* enable getnext traversal on filled tables */
-  at.maxlength = 1;
-  ipntomtable.maxlength = 1;
-}
-
-/**
- * Removes ARP table indexes (.xIfIndex.xNetAddress)
- * from arp table index trees.
- */
-void snmp_delete_arpidx_tree(struct netif *ni, struct ip_addr *ip)
-{
-  struct mib_list_rootnode *at_rn, *next, *del_rn[5];
-  struct mib_list_node *at_n, *del_n[5];
-  struct ip_addr hip;
-  s32_t arpidx[5];
-  u8_t fc, tree, level, del_cnt;
-
-  snmp_netiftoifindex(ni, &arpidx[0]);
-  hip.addr = ntohl(ip->addr);
-  snmp_iptooid(&hip, &arpidx[1]);
-
-  for (tree = 0; tree < 2; tree++)
-  {
-    /* mark nodes for deletion */
-    if (tree == 0)
-    {
-      at_rn = &arptree_root;
-    }
-    else
-    {
-      at_rn = &ipntomtree_root;
-    }
-    level = 0;
-    del_cnt = 0;
-    while ((level < 5) && (at_rn != NULL))
-    {
-      fc = snmp_mib_node_find(at_rn, arpidx[level], &at_n);
-      if (fc == 0)
-      {
-        /* arpidx[level] does not exist */
-        del_cnt = 0;
-        at_rn = NULL;
-      }
-      else if (fc == 1)
-      {
-        del_rn[del_cnt] = at_rn;
-        del_n[del_cnt] = at_n;
-        del_cnt++;
-        at_rn = (struct mib_list_rootnode*)(at_n->nptr);
-      }
-      else if (fc == 2)
-      {
-        /* reset delete (2 or more childs) */
-        del_cnt = 0;
-        at_rn = (struct mib_list_rootnode*)(at_n->nptr);
-      }
-      level++;
-    }
-    /* delete marked index nodes */
-    while (del_cnt > 0)
-    {
-      del_cnt--;
-
-      at_rn = del_rn[del_cnt];
-      at_n = del_n[del_cnt];
-
-      next = snmp_mib_node_delete(at_rn, at_n);
-      if (next != NULL)
-      {
-        LWIP_ASSERT("next_count == 0",next->count == 0);
-        snmp_mib_lrn_free(next);
-      }
-    }
-  }
-  /* disable getnext traversal on empty tables */
-  if(arptree_root.count == 0) at.maxlength = 0;
-  if(ipntomtree_root.count == 0) ipntomtable.maxlength = 0;
-}
-
-void snmp_inc_ipinreceives(void)
-{
-  ipinreceives++;
-}
-
-void snmp_inc_ipinhdrerrors(void)
-{
-  ipinhdrerrors++;
-}
-
-void snmp_inc_ipinaddrerrors(void)
-{
-  ipinaddrerrors++;
-}
-
-void snmp_inc_ipforwdatagrams(void)
-{
-  ipforwdatagrams++;
-}
-
-void snmp_inc_ipinunknownprotos(void)
-{
-  ipinunknownprotos++;
-}
-
-void snmp_inc_ipindiscards(void)
-{
-  ipindiscards++;
-}
-
-void snmp_inc_ipindelivers(void)
-{
-  ipindelivers++;
-}
-
-void snmp_inc_ipoutrequests(void)
-{
-  ipoutrequests++;
-}
-
-void snmp_inc_ipoutdiscards(void)
-{
-  ipoutdiscards++;
-}
-
-void snmp_inc_ipoutnoroutes(void)
-{
-  ipoutnoroutes++;
-}
-
-void snmp_inc_ipreasmreqds(void)
-{
-  ipreasmreqds++;
-}
-
-void snmp_inc_ipreasmoks(void)
-{
-  ipreasmoks++;
-}
-
-void snmp_inc_ipreasmfails(void)
-{
-  ipreasmfails++;
-}
-
-void snmp_inc_ipfragoks(void)
-{
-  ipfragoks++;
-}
-
-void snmp_inc_ipfragfails(void)
-{
-  ipfragfails++;
-}
-
-void snmp_inc_ipfragcreates(void)
-{
-  ipfragcreates++;
-}
-
-void snmp_inc_iproutingdiscards(void)
-{
-  iproutingdiscards++;
-}
-
-/**
- * Inserts ipAddrTable indexes (.ipAdEntAddr)
- * into index tree.
- */
-void snmp_insert_ipaddridx_tree(struct netif *ni)
-{
-  struct mib_list_rootnode *ipa_rn;
-  struct mib_list_node *ipa_node;
-  struct ip_addr ip;
-  s32_t ipaddridx[4];
-  u8_t level;
-
-  LWIP_ASSERT("ni != NULL", ni != NULL);
-  ip.addr = ntohl(ni->ip_addr.addr);
-  snmp_iptooid(&ip, &ipaddridx[0]);
-
-  level = 0;
-  ipa_rn = &ipaddrtree_root;
-  while (level < 4)
-  {
-    ipa_node = NULL;
-    snmp_mib_node_insert(ipa_rn, ipaddridx[level], &ipa_node);
-    if ((level != 3) && (ipa_node != NULL))
-    {
-      if (ipa_node->nptr == NULL)
-      {
-        ipa_rn = snmp_mib_lrn_alloc();
-        ipa_node->nptr = (struct mib_node*)ipa_rn;
-        if (ipa_rn != NULL)
-        {
-          if (level == 2)
-          {
-            ipa_rn->get_object_def = ip_addrentry_get_object_def;
-            ipa_rn->get_value = ip_addrentry_get_value;
-            ipa_rn->set_test = noleafs_set_test;
-            ipa_rn->set_value = noleafs_set_value;
-          }
-        }
-        else
-        {
-          /* ipa_rn == NULL, malloc failure */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_insert_ipaddridx_tree() insert failed, mem full"));
-          break;
-        }
-      }
-      else
-      {
-        ipa_rn = (struct mib_list_rootnode*)ipa_node->nptr;
-      }
-    }
-    level++;
-  }
-  /* enable getnext traversal on filled table */
-  ipaddrtable.maxlength = 1;
-}
-
-/**
- * Removes ipAddrTable indexes (.ipAdEntAddr)
- * from index tree.
- */
-void snmp_delete_ipaddridx_tree(struct netif *ni)
-{
-  struct mib_list_rootnode *ipa_rn, *next, *del_rn[4];
-  struct mib_list_node *ipa_n, *del_n[4];
-  struct ip_addr ip;
-  s32_t ipaddridx[4];
-  u8_t fc, level, del_cnt;
-
-  LWIP_ASSERT("ni != NULL", ni != NULL);
-  ip.addr = ntohl(ni->ip_addr.addr);
-  snmp_iptooid(&ip, &ipaddridx[0]);
-
-  /* mark nodes for deletion */
-  level = 0;
-  del_cnt = 0;
-  ipa_rn = &ipaddrtree_root;
-  while ((level < 4) && (ipa_rn != NULL))
-  {
-    fc = snmp_mib_node_find(ipa_rn, ipaddridx[level], &ipa_n);
-    if (fc == 0)
-    {
-      /* ipaddridx[level] does not exist */
-      del_cnt = 0;
-      ipa_rn = NULL;
-    }
-    else if (fc == 1)
-    {
-      del_rn[del_cnt] = ipa_rn;
-      del_n[del_cnt] = ipa_n;
-      del_cnt++;
-      ipa_rn = (struct mib_list_rootnode*)(ipa_n->nptr);
-    }
-    else if (fc == 2)
-    {
-      /* reset delete (2 or more childs) */
-      del_cnt = 0;
-      ipa_rn = (struct mib_list_rootnode*)(ipa_n->nptr);
-    }
-    level++;
-  }
-  /* delete marked index nodes */
-  while (del_cnt > 0)
-  {
-    del_cnt--;
-
-    ipa_rn = del_rn[del_cnt];
-    ipa_n = del_n[del_cnt];
-
-    next = snmp_mib_node_delete(ipa_rn, ipa_n);
-    if (next != NULL)
-    {
-      LWIP_ASSERT("next_count == 0",next->count == 0);
-      snmp_mib_lrn_free(next);
-    }
-  }
-  /* disable getnext traversal on empty table */
-  if (ipaddrtree_root.count == 0) ipaddrtable.maxlength = 0;
-}
-
-/**
- * Inserts ipRouteTable indexes (.ipRouteDest)
- * into index tree.
- *
- * @param dflt non-zero for the default rte, zero for network rte
- * @param netif points to network interface for this rte
- *
- * @todo record sysuptime for _this_ route when it is installed
- *   (needed for ipRouteAge) in the netif.
- */
-void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni)
-{
-  u8_t insert = 0;
-  struct ip_addr dst;
-
-  if (dflt != 0)
-  {
-    /* the default route 0.0.0.0 */
-    dst.addr = 0;
-    insert = 1;
-  }
-  else
-  {
-    /* route to the network address */
-    dst.addr = ntohl(ni->ip_addr.addr & ni->netmask.addr);
-    /* exclude 0.0.0.0 network (reserved for default rte) */
-    if (dst.addr != 0) insert = 1;
-  }
-  if (insert)
-  {
-    struct mib_list_rootnode *iprte_rn;
-    struct mib_list_node *iprte_node;
-    s32_t iprteidx[4];
-    u8_t level;
-
-    snmp_iptooid(&dst, &iprteidx[0]);
-    level = 0;
-    iprte_rn = &iprtetree_root;
-    while (level < 4)
-    {
-      iprte_node = NULL;
-      snmp_mib_node_insert(iprte_rn, iprteidx[level], &iprte_node);
-      if ((level != 3) && (iprte_node != NULL))
-      {
-        if (iprte_node->nptr == NULL)
-        {
-          iprte_rn = snmp_mib_lrn_alloc();
-          iprte_node->nptr = (struct mib_node*)iprte_rn;
-          if (iprte_rn != NULL)
-          {
-            if (level == 2)
-            {
-              iprte_rn->get_object_def = ip_rteentry_get_object_def;
-              iprte_rn->get_value = ip_rteentry_get_value;
-              iprte_rn->set_test = noleafs_set_test;
-              iprte_rn->set_value = noleafs_set_value;
-            }
-          }
-          else
-          {
-            /* iprte_rn == NULL, malloc failure */
-            LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_insert_iprteidx_tree() insert failed, mem full"));
-            break;
-          }
-        }
-        else
-        {
-          iprte_rn = (struct mib_list_rootnode*)iprte_node->nptr;
-        }
-      }
-      level++;
-    }
-  }
-  /* enable getnext traversal on filled table */
-  iprtetable.maxlength = 1;
-}
-
-/**
- * Removes ipRouteTable indexes (.ipRouteDest)
- * from index tree.
- *
- * @param dflt non-zero for the default rte, zero for network rte
- * @param netif points to network interface for this rte or NULL
- *   for default route to be removed.
- */
-void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni)
-{
-  u8_t delete = 0;
-  struct ip_addr dst;
-
-  if (dflt != 0)
-  {
-    /* the default route 0.0.0.0 */
-    dst.addr = 0;
-    delete = 1;
-  }
-  else
-  {
-    /* route to the network address */
-    dst.addr = ntohl(ni->ip_addr.addr & ni->netmask.addr);
-    /* exclude 0.0.0.0 network (reserved for default rte) */
-    if (dst.addr != 0) delete = 1;
-  }
-  if (delete)
-  {
-    struct mib_list_rootnode *iprte_rn, *next, *del_rn[4];
-    struct mib_list_node *iprte_n, *del_n[4];
-    s32_t iprteidx[4];
-    u8_t fc, level, del_cnt;
-
-    snmp_iptooid(&dst, &iprteidx[0]);
-    /* mark nodes for deletion */
-    level = 0;
-    del_cnt = 0;
-    iprte_rn = &iprtetree_root;
-    while ((level < 4) && (iprte_rn != NULL))
-    {
-      fc = snmp_mib_node_find(iprte_rn, iprteidx[level], &iprte_n);
-      if (fc == 0)
-      {
-        /* iprteidx[level] does not exist */
-        del_cnt = 0;
-        iprte_rn = NULL;
-      }
-      else if (fc == 1)
-      {
-        del_rn[del_cnt] = iprte_rn;
-        del_n[del_cnt] = iprte_n;
-        del_cnt++;
-        iprte_rn = (struct mib_list_rootnode*)(iprte_n->nptr);
-      }
-      else if (fc == 2)
-      {
-        /* reset delete (2 or more childs) */
-        del_cnt = 0;
-        iprte_rn = (struct mib_list_rootnode*)(iprte_n->nptr);
-      }
-      level++;
-    }
-    /* delete marked index nodes */
-    while (del_cnt > 0)
-    {
-      del_cnt--;
-
-      iprte_rn = del_rn[del_cnt];
-      iprte_n = del_n[del_cnt];
-
-      next = snmp_mib_node_delete(iprte_rn, iprte_n);
-      if (next != NULL)
-      {
-        LWIP_ASSERT("next_count == 0",next->count == 0);
-        snmp_mib_lrn_free(next);
-      }
-    }
-  }
-  /* disable getnext traversal on empty table */
-  if (iprtetree_root.count == 0) iprtetable.maxlength = 0;
-}
-
-
-void snmp_inc_icmpinmsgs(void)
-{
-  icmpinmsgs++;
-}
-
-void snmp_inc_icmpinerrors(void)
-{
-  icmpinerrors++;
-}
-
-void snmp_inc_icmpindestunreachs(void)
-{
-  icmpindestunreachs++;
-}
-
-void snmp_inc_icmpintimeexcds(void)
-{
-  icmpintimeexcds++;
-}
-
-void snmp_inc_icmpinparmprobs(void)
-{
-  icmpinparmprobs++;
-}
-
-void snmp_inc_icmpinsrcquenchs(void)
-{
-  icmpinsrcquenchs++;
-}
-
-void snmp_inc_icmpinredirects(void)
-{
-  icmpinredirects++;
-}
-
-void snmp_inc_icmpinechos(void)
-{
-  icmpinechos++;
-}
-
-void snmp_inc_icmpinechoreps(void)
-{
-  icmpinechoreps++;
-}
-
-void snmp_inc_icmpintimestamps(void)
-{
-  icmpintimestamps++;
-}
-
-void snmp_inc_icmpintimestampreps(void)
-{
-  icmpintimestampreps++;
-}
-
-void snmp_inc_icmpinaddrmasks(void)
-{
-  icmpinaddrmasks++;
-}
-
-void snmp_inc_icmpinaddrmaskreps(void)
-{
-  icmpinaddrmaskreps++;
-}
-
-void snmp_inc_icmpoutmsgs(void)
-{
-  icmpoutmsgs++;
-}
-
-void snmp_inc_icmpouterrors(void)
-{
-  icmpouterrors++;
-}
-
-void snmp_inc_icmpoutdestunreachs(void)
-{
-  icmpoutdestunreachs++;
-}
-
-void snmp_inc_icmpouttimeexcds(void)
-{
-  icmpouttimeexcds++;
-}
-
-void snmp_inc_icmpoutparmprobs(void)
-{
-  icmpoutparmprobs++;
-}
-
-void snmp_inc_icmpoutsrcquenchs(void)
-{
-  icmpoutsrcquenchs++;
-}
-
-void snmp_inc_icmpoutredirects(void)
-{
-  icmpoutredirects++;
-}
-
-void snmp_inc_icmpoutechos(void)
-{
-  icmpoutechos++;
-}
-
-void snmp_inc_icmpoutechoreps(void)
-{
-  icmpoutechoreps++;
-}
-
-void snmp_inc_icmpouttimestamps(void)
-{
-  icmpouttimestamps++;
-}
-
-void snmp_inc_icmpouttimestampreps(void)
-{
-  icmpouttimestampreps++;
-}
-
-void snmp_inc_icmpoutaddrmasks(void)
-{
-  icmpoutaddrmasks++;
-}
-
-void snmp_inc_icmpoutaddrmaskreps(void)
-{
-  icmpoutaddrmaskreps++;
-}
-
-void snmp_inc_tcpactiveopens(void)
-{
-  tcpactiveopens++;
-}
-
-void snmp_inc_tcppassiveopens(void)
-{
-  tcppassiveopens++;
-}
-
-void snmp_inc_tcpattemptfails(void)
-{
-  tcpattemptfails++;
-}
-
-void snmp_inc_tcpestabresets(void)
-{
-  tcpestabresets++;
-}
-
-void snmp_inc_tcpinsegs(void)
-{
-  tcpinsegs++;
-}
-
-void snmp_inc_tcpoutsegs(void)
-{
-  tcpoutsegs++;
-}
-
-void snmp_inc_tcpretranssegs(void)
-{
-  tcpretranssegs++;
-}
-
-void snmp_inc_tcpinerrs(void)
-{
-  tcpinerrs++;
-}
-
-void snmp_inc_tcpoutrsts(void)
-{
-  tcpoutrsts++;
-}
-
-void snmp_inc_udpindatagrams(void)
-{
-  udpindatagrams++;
-}
-
-void snmp_inc_udpnoports(void)
-{
-  udpnoports++;
-}
-
-void snmp_inc_udpinerrors(void)
-{
-  udpinerrors++;
-}
-
-void snmp_inc_udpoutdatagrams(void)
-{
-  udpoutdatagrams++;
-}
-
-/**
- * Inserts udpTable indexes (.udpLocalAddress.udpLocalPort)
- * into index tree.
- */
-void snmp_insert_udpidx_tree(struct udp_pcb *pcb)
-{
-  struct mib_list_rootnode *udp_rn;
-  struct mib_list_node *udp_node;
-  struct ip_addr ip;
-  s32_t udpidx[5];
-  u8_t level;
-
-  LWIP_ASSERT("pcb != NULL", pcb != NULL);
-  ip.addr = ntohl(pcb->local_ip.addr);
-  snmp_iptooid(&ip, &udpidx[0]);
-  udpidx[4] = pcb->local_port;
-
-  udp_rn = &udp_root;
-  for (level = 0; level < 5; level++)
-  {
-    udp_node = NULL;
-    snmp_mib_node_insert(udp_rn, udpidx[level], &udp_node);
-    if ((level != 4) && (udp_node != NULL))
-    {
-      if (udp_node->nptr == NULL)
-      {
-        udp_rn = snmp_mib_lrn_alloc();
-        udp_node->nptr = (struct mib_node*)udp_rn;
-        if (udp_rn != NULL)
-        {
-          if (level == 3)
-          {
-            udp_rn->get_object_def = udpentry_get_object_def;
-            udp_rn->get_value = udpentry_get_value;
-            udp_rn->set_test = noleafs_set_test;
-            udp_rn->set_value = noleafs_set_value;
-          }
-        }
-        else
-        {
-          /* udp_rn == NULL, malloc failure */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_insert_udpidx_tree() insert failed, mem full"));
-          break;
-        }
-      }
-      else
-      {
-        udp_rn = (struct mib_list_rootnode*)udp_node->nptr;
-      }
-    }
-  }
-  udptable.maxlength = 1;
-}
-
-/**
- * Removes udpTable indexes (.udpLocalAddress.udpLocalPort)
- * from index tree.
- */
-void snmp_delete_udpidx_tree(struct udp_pcb *pcb)
-{
-  struct mib_list_rootnode *udp_rn, *next, *del_rn[5];
-  struct mib_list_node *udp_n, *del_n[5];
-  struct ip_addr ip;
-  s32_t udpidx[5];
-  u8_t bindings, fc, level, del_cnt;
-
-  LWIP_ASSERT("pcb != NULL", pcb != NULL);
-  ip.addr = ntohl(pcb->local_ip.addr);
-  snmp_iptooid(&ip, &udpidx[0]);
-  udpidx[4] = pcb->local_port;
-
-  /* count PCBs for a given binding
-     (e.g. when reusing ports or for temp output PCBs) */
-  bindings = 0;
-  pcb = udp_pcbs;
-  while ((pcb != NULL))
-  {
-    if ((pcb->local_ip.addr == ip.addr) &&
-        (pcb->local_port == udpidx[4]))
-    {
-      bindings++;
-    }
-    pcb = pcb->next;
-  }
-  if (bindings == 1)
-  {
-    /* selectively remove */
-    /* mark nodes for deletion */
-    level = 0;
-    del_cnt = 0;
-    udp_rn = &udp_root;
-    while ((level < 5) && (udp_rn != NULL))
-    {
-      fc = snmp_mib_node_find(udp_rn, udpidx[level], &udp_n);
-      if (fc == 0)
-      {
-        /* udpidx[level] does not exist */
-        del_cnt = 0;
-        udp_rn = NULL;
-      }
-      else if (fc == 1)
-      {
-        del_rn[del_cnt] = udp_rn;
-        del_n[del_cnt] = udp_n;
-        del_cnt++;
-        udp_rn = (struct mib_list_rootnode*)(udp_n->nptr);
-      }
-      else if (fc == 2)
-      {
-        /* reset delete (2 or more childs) */
-        del_cnt = 0;
-        udp_rn = (struct mib_list_rootnode*)(udp_n->nptr);
-      }
-      level++;
-    }
-    /* delete marked index nodes */
-    while (del_cnt > 0)
-    {
-      del_cnt--;
-
-      udp_rn = del_rn[del_cnt];
-      udp_n = del_n[del_cnt];
-
-      next = snmp_mib_node_delete(udp_rn, udp_n);
-      if (next != NULL)
-      {
-        LWIP_ASSERT("next_count == 0",next->count == 0);
-        snmp_mib_lrn_free(next);
-      }
-    }
-  }
-  /* disable getnext traversal on empty table */
-  if (udp_root.count == 0) udptable.maxlength = 0;
-}
-
-
-void snmp_inc_snmpinpkts(void)
-{
-  snmpinpkts++;
-}
-
-void snmp_inc_snmpoutpkts(void)
-{
-  snmpoutpkts++;
-}
-
-void snmp_inc_snmpinbadversions(void)
-{
-  snmpinbadversions++;
-}
-
-void snmp_inc_snmpinbadcommunitynames(void)
-{
-  snmpinbadcommunitynames++;
-}
-
-void snmp_inc_snmpinbadcommunityuses(void)
-{
-  snmpinbadcommunityuses++;
-}
-
-void snmp_inc_snmpinasnparseerrs(void)
-{
-  snmpinasnparseerrs++;
-}
-
-void snmp_inc_snmpintoobigs(void)
-{
-  snmpintoobigs++;
-}
-
-void snmp_inc_snmpinnosuchnames(void)
-{
-  snmpinnosuchnames++;
-}
-
-void snmp_inc_snmpinbadvalues(void)
-{
-  snmpinbadvalues++;
-}
-
-void snmp_inc_snmpinreadonlys(void)
-{
-  snmpinreadonlys++;
-}
-
-void snmp_inc_snmpingenerrs(void)
-{
-  snmpingenerrs++;
-}
-
-void snmp_add_snmpintotalreqvars(u8_t value)
-{
-  snmpintotalreqvars += value;
-}
-
-void snmp_add_snmpintotalsetvars(u8_t value)
-{
-  snmpintotalsetvars += value;
-}
-
-void snmp_inc_snmpingetrequests(void)
-{
-  snmpingetrequests++;
-}
-
-void snmp_inc_snmpingetnexts(void)
-{
-  snmpingetnexts++;
-}
-
-void snmp_inc_snmpinsetrequests(void)
-{
-  snmpinsetrequests++;
-}
-
-void snmp_inc_snmpingetresponses(void)
-{
-  snmpingetresponses++;
-}
-
-void snmp_inc_snmpintraps(void)
-{
-  snmpintraps++;
-}
-
-void snmp_inc_snmpouttoobigs(void)
-{
-  snmpouttoobigs++;
-}
-
-void snmp_inc_snmpoutnosuchnames(void)
-{
-  snmpoutnosuchnames++;
-}
-
-void snmp_inc_snmpoutbadvalues(void)
-{
-  snmpoutbadvalues++;
-}
-
-void snmp_inc_snmpoutgenerrs(void)
-{
-  snmpoutgenerrs++;
-}
-
-void snmp_inc_snmpoutgetrequests(void)
-{
-  snmpoutgetrequests++;
-}
-
-void snmp_inc_snmpoutgetnexts(void)
-{
-  snmpoutgetnexts++;
-}
-
-void snmp_inc_snmpoutsetrequests(void)
-{
-  snmpoutsetrequests++;
-}
-
-void snmp_inc_snmpoutgetresponses(void)
-{
-  snmpoutgetresponses++;
-}
-
-void snmp_inc_snmpouttraps(void)
-{
-  snmpouttraps++;
-}
-
-void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid)
-{
-  *oid = &snmpgrp_id;
-}
-
-void snmp_set_snmpenableauthentraps(u8_t *value)
-{
-  if (value != NULL)
-  {
-    snmpenableauthentraps_ptr = value;
-  }
-}
-
-void snmp_get_snmpenableauthentraps(u8_t *value)
-{
-  *value = *snmpenableauthentraps_ptr;
-}
-
-void
-noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  if (ident_len){}
-  if (ident){}
-  od->instance = MIB_OBJECT_NONE;
-}
-
-void
-noleafs_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  if (od){}
-  if (len){}
-  if (value){}
-}
-
-u8_t
-noleafs_set_test(struct obj_def *od, u16_t len, void *value)
-{
-  if (od){}
-  if (len){}
-  if (value){}
-  /* can't set */
-  return 0;
-}
-
-void
-noleafs_set_value(struct obj_def *od, u16_t len, void *value)
-{
-  if (od){}
-  if (len){}
-  if (value){}
-}
-
-
-/**
- * Returns systems object definitions.
- *
- * @param ident_len the address length (2)
- * @param ident points to objectname.0 (object id trailer)
- * @param od points to object definition.
- */
-static void
-system_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  u8_t id;
-
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  if (ident_len == 2)
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def system.%"U16_F".0\n",(u16_t)id));
-    switch (id)
-    {
-      case 1: /* sysDescr */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-        od->v_len = *sysdescr_len_ptr;
-        break;
-      case 2: /* sysObjectID */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID);
-        od->v_len = sysobjid.len * sizeof(s32_t);
-        break;
-      case 3: /* sysUpTime */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS);
-        od->v_len = sizeof(u32_t);
-        break;
-      case 4: /* sysContact */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-        od->v_len = *syscontact_len_ptr;
-        break;
-      case 5: /* sysName */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-        od->v_len = *sysname_len_ptr;
-        break;
-      case 6: /* sysLocation */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-        od->v_len = *syslocation_len_ptr;
-        break;
-      case 7: /* sysServices */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("system_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    };
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("system_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-/**
- * Returns system object value.
- *
- * @param ident_len the address length (2)
- * @param ident points to objectname.0 (object id trailer)
- * @param len return value space (in bytes)
- * @param value points to (varbind) space to copy value into.
- */
-static void
-system_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id;
-
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 1: /* sysDescr */
-      ocstrncpy(value,sysdescr_ptr,len);
-      break;
-    case 2: /* sysObjectID */
-      objectidncpy((s32_t*)value,(s32_t*)sysobjid.id,len / sizeof(s32_t));
-      break;
-    case 3: /* sysUpTime */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = sysuptime;
-      }
-      break;
-    case 4: /* sysContact */
-      ocstrncpy(value,syscontact_ptr,len);
-      break;
-    case 5: /* sysName */
-      ocstrncpy(value,sysname_ptr,len);
-      break;
-    case 6: /* sysLocation */
-      ocstrncpy(value,syslocation_ptr,len);
-      break;
-    case 7: /* sysServices */
-      {
-        s32_t *sint_ptr = value;
-        *sint_ptr = sysservices;
-      }
-      break;
-  };
-}
-
-static u8_t
-system_set_test(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id, set_ok;
-
-  if (value) {}
-  set_ok = 0;
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 4: /* sysContact */
-      if ((syscontact_ptr != syscontact_default) &&
-          (len <= 255))
-      {
-        set_ok = 1;
-      }
-      break;
-    case 5: /* sysName */
-      if ((sysname_ptr != sysname_default) &&
-          (len <= 255))
-      {
-        set_ok = 1;
-      }
-      break;
-    case 6: /* sysLocation */
-      if ((syslocation_ptr != syslocation_default) &&
-          (len <= 255))
-      {
-        set_ok = 1;
-      }
-      break;
-  };
-  return set_ok;
-}
-
-static void
-system_set_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id;
-
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 4: /* sysContact */
-      ocstrncpy(syscontact_ptr,value,len);
-      *syscontact_len_ptr = len;
-      break;
-    case 5: /* sysName */
-      ocstrncpy(sysname_ptr,value,len);
-      *sysname_len_ptr = len;
-      break;
-    case 6: /* sysLocation */
-      ocstrncpy(syslocation_ptr,value,len);
-      *syslocation_len_ptr = len;
-      break;
-  };
-}
-
-/**
- * Returns interfaces.ifnumber object definition.
- *
- * @param ident_len the address length (2)
- * @param ident points to objectname.index
- * @param od points to object definition.
- */
-static void
-interfaces_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  if (ident_len == 2)
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    od->instance = MIB_OBJECT_SCALAR;
-    od->access = MIB_OBJECT_READ_ONLY;
-    od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-    od->v_len = sizeof(s32_t);
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("interfaces_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-/**
- * Returns interfaces.ifnumber object value.
- *
- * @param ident_len the address length (2)
- * @param ident points to objectname.0 (object id trailer)
- * @param len return value space (in bytes)
- * @param value points to (varbind) space to copy value into.
- */
-static void
-interfaces_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  if (len){}
-  if (od->id_inst_ptr[0] == 1)
-  {
-    s32_t *sint_ptr = value;
-    *sint_ptr = iflist_root.count;
-  }
-}
-
-/**
- * Returns ifentry object definitions.
- *
- * @param ident_len the address length (2)
- * @param ident points to objectname.index
- * @param od points to object definition.
- */
-static void
-ifentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  u8_t id;
-
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  if (ident_len == 2)
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def ifentry.%"U16_F"\n",(u16_t)id));
-    switch (id)
-    {
-      case 1: /* ifIndex */
-      case 3: /* ifType */
-      case 4: /* ifMtu */
-      case 8: /* ifOperStatus */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 2: /* ifDescr */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-        /** @todo this should be some sort of sizeof(struct netif.name) */
-        od->v_len = 2;
-        break;
-      case 5: /* ifSpeed */
-      case 21: /* ifOutQLen */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE);
-        od->v_len = sizeof(u32_t);
-        break;
-      case 6: /* ifPhysAddress */
-        {
-          struct netif *netif;
-
-          snmp_ifindextonetif(ident[1], &netif);
-          od->instance = MIB_OBJECT_TAB;
-          od->access = MIB_OBJECT_READ_ONLY;
-          od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-          od->v_len = netif->hwaddr_len;
-        }
-        break;
-      case 7: /* ifAdminStatus */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 9: /* ifLastChange */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS);
-        od->v_len = sizeof(u32_t);
-        break;
-      case 10: /* ifInOctets */
-      case 11: /* ifInUcastPkts */
-      case 12: /* ifInNUcastPkts */
-      case 13: /* ifInDiscarts */
-      case 14: /* ifInErrors */
-      case 15: /* ifInUnkownProtos */
-      case 16: /* ifOutOctets */
-      case 17: /* ifOutUcastPkts */
-      case 18: /* ifOutNUcastPkts */
-      case 19: /* ifOutDiscarts */
-      case 20: /* ifOutErrors */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
-        od->v_len = sizeof(u32_t);
-        break;
-      case 22: /* ifSpecific */
-        /** @note returning zeroDotZero (0.0) no media specific MIB support */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID);
-        od->v_len = ifspecific.len * sizeof(s32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("ifentry_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    };
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("ifentry_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-/**
- * Returns ifentry object value.
- *
- * @param ident_len the address length (2)
- * @param ident points to objectname.0 (object id trailer)
- * @param len return value space (in bytes)
- * @param value points to (varbind) space to copy value into.
- */
-static void
-ifentry_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  struct netif *netif;
-  u8_t id;
-
-  snmp_ifindextonetif(od->id_inst_ptr[1], &netif);
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 1: /* ifIndex */
-      {
-        s32_t *sint_ptr = value;
-        *sint_ptr = od->id_inst_ptr[1];
-      }
-      break;
-    case 2: /* ifDescr */
-      ocstrncpy(value,(u8_t*)netif->name,len);
-      break;
-    case 3: /* ifType */
-      {
-        s32_t *sint_ptr = value;
-        *sint_ptr = netif->link_type;
-      }
-      break;
-    case 4: /* ifMtu */
-      {
-        s32_t *sint_ptr = value;
-        *sint_ptr = netif->mtu;
-      }
-      break;
-    case 5: /* ifSpeed */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->link_speed;
-      }
-      break;
-    case 6: /* ifPhysAddress */
-      ocstrncpy(value,netif->hwaddr,len);
-      break;
-    case 7: /* ifAdminStatus */
-    case 8: /* ifOperStatus */
-      {
-        s32_t *sint_ptr = value;
-        if (netif_is_up(netif))
-        {
-          *sint_ptr = 1;
-        }
-        else
-        {
-          *sint_ptr = 2;
-        }
-      }
-      break;
-    case 9: /* ifLastChange */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ts;
-      }
-      break;
-    case 10: /* ifInOctets */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ifinoctets;
-      }
-      break;
-    case 11: /* ifInUcastPkts */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ifinucastpkts;
-      }
-      break;
-    case 12: /* ifInNUcastPkts */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ifinnucastpkts;
-      }
-      break;
-    case 13: /* ifInDiscarts */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ifindiscards;
-      }
-      break;
-    case 14: /* ifInErrors */
-    case 15: /* ifInUnkownProtos */
-      /** @todo add these counters! */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = 0;
-      }
-      break;
-    case 16: /* ifOutOctets */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ifoutoctets;
-      }
-      break;
-    case 17: /* ifOutUcastPkts */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ifoutucastpkts;
-      }
-      break;
-    case 18: /* ifOutNUcastPkts */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ifoutnucastpkts;
-      }
-      break;
-    case 19: /* ifOutDiscarts */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = netif->ifoutdiscards;
-      }
-      break;
-    case 20: /* ifOutErrors */
-       /** @todo add this counter! */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = 0;
-      }
-      break;
-    case 21: /* ifOutQLen */
-      /** @todo figure out if this must be 0 (no queue) or 1? */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = 0;
-      }
-      break;
-    case 22: /* ifSpecific */
-      objectidncpy((s32_t*)value,(s32_t*)ifspecific.id,len / sizeof(s32_t));
-      break;
-  };
-}
-
-/**
- * Returns atentry object definitions.
- *
- * @param ident_len the address length (6)
- * @param ident points to objectname.atifindex.atnetaddress
- * @param od points to object definition.
- */
-static void
-atentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (5) */
-  ident_len += 5;
-  ident -= 5;
-
-  if (ident_len == 6)
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    switch (ident[0])
-    {
-      case 1: /* atIfIndex */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 2: /* atPhysAddress */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-        od->v_len = sizeof(struct eth_addr);
-        break;
-      case 3: /* atNetAddress */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
-        od->v_len = 4;
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("atentry_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    }
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("atentry_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-atentry_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id;
-  struct eth_addr* ethaddr_ret;
-  struct ip_addr* ipaddr_ret;
-  struct ip_addr ip;
-  struct netif *netif;
-
-  if (len) {}
-
-  snmp_ifindextonetif(od->id_inst_ptr[1], &netif);
-  snmp_oidtoip(&od->id_inst_ptr[2], &ip);
-  ip.addr = htonl(ip.addr);
-
-  if (etharp_find_addr(netif, &ip, &ethaddr_ret, &ipaddr_ret) > -1)
-  {
-    id = od->id_inst_ptr[0];
-    switch (id)
-    {
-      case 1: /* atIfIndex */
-        {
-          s32_t *sint_ptr = value;
-          *sint_ptr = od->id_inst_ptr[1];
-        }
-        break;
-      case 2: /* atPhysAddress */
-        {
-          struct eth_addr *dst = value;
-
-          *dst = *ethaddr_ret;
-        }
-        break;
-      case 3: /* atNetAddress */
-        {
-          struct ip_addr *dst = value;
-
-          *dst = *ipaddr_ret;
-        }
-        break;
-    }
-  }
-}
-
-static void
-ip_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  u8_t id;
-
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  if (ident_len == 2)
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def ip.%"U16_F".0\n",(u16_t)id));
-    switch (id)
-    {
-      case 1: /* ipForwarding */
-      case 2: /* ipDefaultTTL */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 3: /* ipInReceives */
-      case 4: /* ipInHdrErrors */
-      case 5: /* ipInAddrErrors */
-      case 6: /* ipForwDatagrams */
-      case 7: /* ipInUnknownProtos */
-      case 8: /* ipInDiscards */
-      case 9: /* ipInDelivers */
-      case 10: /* ipOutRequests */
-      case 11: /* ipOutDiscards */
-      case 12: /* ipOutNoRoutes */
-      case 14: /* ipReasmReqds */
-      case 15: /* ipReasmOKs */
-      case 16: /* ipReasmFails */
-      case 17: /* ipFragOKs */
-      case 18: /* ipFragFails */
-      case 19: /* ipFragCreates */
-      case 23: /* ipRoutingDiscards */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
-        od->v_len = sizeof(u32_t);
-        break;
-      case 13: /* ipReasmTimeout */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    };
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-ip_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id;
-
-  if (len) {}
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 1: /* ipForwarding */
-      {
-        s32_t *sint_ptr = value;
-#if IP_FORWARD
-        /* forwarding */
-        *sint_ptr = 1;
-#else
-        /* not-forwarding */
-        *sint_ptr = 2;
-#endif
-      }
-      break;
-    case 2: /* ipDefaultTTL */
-      {
-        s32_t *sint_ptr = value;
-        *sint_ptr = IP_DEFAULT_TTL;
-      }
-      break;
-    case 3: /* ipInReceives */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipinreceives;
-      }
-      break;
-    case 4: /* ipInHdrErrors */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipinhdrerrors;
-      }
-      break;
-    case 5: /* ipInAddrErrors */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipinaddrerrors;
-      }
-      break;
-    case 6: /* ipForwDatagrams */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipforwdatagrams;
-      }
-      break;
-    case 7: /* ipInUnknownProtos */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipinunknownprotos;
-      }
-      break;
-    case 8: /* ipInDiscards */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipindiscards;
-      }
-      break;
-    case 9: /* ipInDelivers */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipindelivers;
-      }
-      break;
-    case 10: /* ipOutRequests */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipoutrequests;
-      }
-      break;
-    case 11: /* ipOutDiscards */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipoutdiscards;
-      }
-      break;
-    case 12: /* ipOutNoRoutes */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipoutnoroutes;
-      }
-      break;
-    case 13: /* ipReasmTimeout */
-      {
-        s32_t *sint_ptr = value;
-#if IP_REASSEMBLY
-        *sint_ptr = IP_REASS_MAXAGE;
-#else
-        *sint_ptr = 0;
-#endif
-      }
-      break;
-    case 14: /* ipReasmReqds */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipreasmreqds;
-      }
-      break;
-    case 15: /* ipReasmOKs */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipreasmoks;
-      }
-      break;
-    case 16: /* ipReasmFails */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipreasmfails;
-      }
-      break;
-    case 17: /* ipFragOKs */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipfragoks;
-      }
-      break;
-    case 18: /* ipFragFails */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipfragfails;
-      }
-      break;
-    case 19: /* ipFragCreates */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = ipfragcreates;
-      }
-      break;
-    case 23: /* ipRoutingDiscards */
-      /** @todo can lwIP discard routes at all?? hardwire this to 0?? */
-      {
-        u32_t *uint_ptr = value;
-        *uint_ptr = iproutingdiscards;
-      }
-      break;
-  };
-}
-
-/**
- * Test ip object value before setting.
- *
- * @param od is the object definition
- * @param len return value space (in bytes)
- * @param value points to (varbind) space to copy value from.
- *
- * @note we allow set if the value matches the hardwired value,
- *   otherwise return badvalue.
- */
-static u8_t
-ip_set_test(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id, set_ok;
-  s32_t *sint_ptr = value;
-
-  if (len) {}
-  set_ok = 0;
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 1: /* ipForwarding */
-#if IP_FORWARD
-      /* forwarding */
-      if (*sint_ptr == 1)
-#else
-      /* not-forwarding */
-      if (*sint_ptr == 2)
-#endif
-      {
-        set_ok = 1;
-      }
-      break;
-    case 2: /* ipDefaultTTL */
-      if (*sint_ptr == IP_DEFAULT_TTL)
-      {
-        set_ok = 1;
-      }
-      break;
-  };
-  return set_ok;
-}
-
-static void
-ip_addrentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (4) */
-  ident_len += 4;
-  ident -= 4;
-
-  if (ident_len == 5)
-  {
-    u8_t id;
-
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    switch (id)
-    {
-      case 1: /* ipAdEntAddr */
-      case 3: /* ipAdEntNetMask */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
-        od->v_len = 4;
-        break;
-      case 2: /* ipAdEntIfIndex */
-      case 4: /* ipAdEntBcastAddr */
-      case 5: /* ipAdEntReasmMaxSize */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_addrentry_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    }
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_addrentry_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id;
-  u16_t ifidx;
-  struct ip_addr ip;
-  struct netif *netif = netif_list;
-
-  if (len) {}
-  snmp_oidtoip(&od->id_inst_ptr[1], &ip);
-  ip.addr = htonl(ip.addr);
-  ifidx = 0;
-  while ((netif != NULL) && !ip_addr_cmp(&ip, &netif->ip_addr))
-  {
-    netif = netif->next;
-    ifidx++;
-  }
-
-  if (netif != NULL)
-  {
-    id = od->id_inst_ptr[0];
-    switch (id)
-    {
-      case 1: /* ipAdEntAddr */
-        {
-          struct ip_addr *dst = value;
-          *dst = netif->ip_addr;
-        }
-        break;
-      case 2: /* ipAdEntIfIndex */
-        {
-          s32_t *sint_ptr = value;
-          *sint_ptr = ifidx + 1;
-        }
-        break;
-      case 3: /* ipAdEntNetMask */
-        {
-          struct ip_addr *dst = value;
-          *dst = netif->netmask;
-        }
-        break;
-      case 4: /* ipAdEntBcastAddr */
-        {
-          s32_t *sint_ptr = value;
-
-          /* lwIP oddity, there's no broadcast
-            address in the netif we can rely on */
-          *sint_ptr = ip_addr_broadcast.addr & 1;
-        }
-        break;
-      case 5: /* ipAdEntReasmMaxSize */
-        {
-          s32_t *sint_ptr = value;
-#if IP_REASSEMBLY
-          *sint_ptr = (IP_HLEN + IP_REASS_BUFSIZE);
-#else
-          /** @todo returning MTU would be a bad thing and
-             returning a wild guess like '576' isn't good either */
-          *sint_ptr = 0;
-#endif
-        }
-        break;
-    }
-  }
-}
-
-/**
- * @note
- * lwIP IP routing is currently using the network addresses in netif_list.
- * if no suitable network IP is found in netif_list, the default_netif is used.
- */
-static void
-ip_rteentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  u8_t id;
-
-  /* return to object name, adding index depth (4) */
-  ident_len += 4;
-  ident -= 4;
-
-  if (ident_len == 5)
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    switch (id)
-    {
-      case 1: /* ipRouteDest */
-      case 7: /* ipRouteNextHop */
-      case 11: /* ipRouteMask */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
-        od->v_len = 4;
-        break;
-      case 2: /* ipRouteIfIndex */
-      case 3: /* ipRouteMetric1 */
-      case 4: /* ipRouteMetric2 */
-      case 5: /* ipRouteMetric3 */
-      case 6: /* ipRouteMetric4 */
-      case 8: /* ipRouteType */
-      case 10: /* ipRouteAge */
-      case 12: /* ipRouteMetric5 */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 9: /* ipRouteProto */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 13: /* ipRouteInfo */
-        /** @note returning zeroDotZero (0.0) no routing protocol specific MIB */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID);
-        od->v_len = iprouteinfo.len * sizeof(s32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_rteentry_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    }
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_rteentry_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  struct netif *netif;
-  struct ip_addr dest;
-  s32_t *ident;
-  u8_t id;
-
-  ident = od->id_inst_ptr;
-  snmp_oidtoip(&ident[1], &dest);
-  dest.addr = htonl(dest.addr);
-
-  if (dest.addr == 0)
-  {
-    /* ip_route() uses default netif for default route */
-    netif = netif_default;
-  }
-  else
-  {
-    /* not using ip_route(), need exact match! */
-    netif = netif_list;
-    while ((netif != NULL) &&
-            !ip_addr_netcmp(&dest, &(netif->ip_addr), &(netif->netmask)) )
-    {
-      netif = netif->next;
-    }
-  }
-  if (netif != NULL)
-  {
-    id = ident[0];
-    switch (id)
-    {
-      case 1: /* ipRouteDest */
-        {
-          struct ip_addr *dst = value;
-
-          if (dest.addr == 0)
-          {
-            /* default rte has 0.0.0.0 dest */
-            dst->addr = 0;
-          }
-          else
-          {
-            /* netifs have netaddress dest */
-            dst->addr = netif->ip_addr.addr & netif->netmask.addr;
-          }
-        }
-        break;
-      case 2: /* ipRouteIfIndex */
-        {
-          s32_t *sint_ptr = value;
-
-          snmp_netiftoifindex(netif, sint_ptr);
-        }
-        break;
-      case 3: /* ipRouteMetric1 */
-        {
-          s32_t *sint_ptr = value;
-
-          if (dest.addr == 0)
-          {
-            /* default rte has metric 1 */
-            *sint_ptr = 1;
-          }
-          else
-          {
-            /* other rtes have metric 0 */
-            *sint_ptr = 0;
-          }
-        }
-        break;
-      case 4: /* ipRouteMetric2 */
-      case 5: /* ipRouteMetric3 */
-      case 6: /* ipRouteMetric4 */
-      case 12: /* ipRouteMetric5 */
-        {
-          s32_t *sint_ptr = value;
-          /* not used */
-          *sint_ptr = -1;
-        }
-        break;
-      case 7: /* ipRouteNextHop */
-        {
-          struct ip_addr *dst = value;
-
-          if (dest.addr == 0)
-          {
-            /* default rte: gateway */
-            *dst = netif->gw;
-          }
-          else
-          {
-            /* other rtes: netif ip_addr  */
-            *dst = netif->ip_addr;
-          }
-        }
-        break;
-      case 8: /* ipRouteType */
-        {
-          s32_t *sint_ptr = value;
-
-          if (dest.addr == 0)
-          {
-            /* default rte is indirect */
-            *sint_ptr = 4;
-          }
-          else
-          {
-            /* other rtes are direct */
-            *sint_ptr = 3;
-          }
-        }
-        break;
-      case 9: /* ipRouteProto */
-        {
-          s32_t *sint_ptr = value;
-          /* locally defined routes */
-          *sint_ptr = 2;
-        }
-        break;
-      case 10: /* ipRouteAge */
-        {
-          s32_t *sint_ptr = value;
-          /** @todo (sysuptime - timestamp last change) / 100
-              @see snmp_insert_iprteidx_tree() */
-          *sint_ptr = 0;
-        }
-        break;
-      case 11: /* ipRouteMask */
-        {
-          struct ip_addr *dst = value;
-
-          if (dest.addr == 0)
-          {
-            /* default rte use 0.0.0.0 mask */
-            dst->addr = 0;
-          }
-          else
-          {
-            /* other rtes use netmask */
-            *dst = netif->netmask;
-          }
-        }
-        break;
-      case 13: /* ipRouteInfo */
-        objectidncpy((s32_t*)value,(s32_t*)iprouteinfo.id,len / sizeof(s32_t));
-        break;
-    }
-  }
-}
-
-static void
-ip_ntomentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (5) */
-  ident_len += 5;
-  ident -= 5;
-
-  if (ident_len == 6)
-  {
-    u8_t id;
-
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    switch (id)
-    {
-      case 1: /* ipNetToMediaIfIndex */
-      case 4: /* ipNetToMediaType */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 2: /* ipNetToMediaPhysAddress */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
-        od->v_len = sizeof(struct eth_addr);
-        break;
-      case 3: /* ipNetToMediaNetAddress */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
-        od->v_len = 4;
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_ntomentry_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    }
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_ntomentry_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-ip_ntomentry_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id;
-  struct eth_addr* ethaddr_ret;
-  struct ip_addr* ipaddr_ret;
-  struct ip_addr ip;
-  struct netif *netif;
-
-  if (len) {}
-
-  snmp_ifindextonetif(od->id_inst_ptr[1], &netif);
-  snmp_oidtoip(&od->id_inst_ptr[2], &ip);
-  ip.addr = htonl(ip.addr);
-
-  if (etharp_find_addr(netif, &ip, &ethaddr_ret, &ipaddr_ret) > -1)
-  {
-    id = od->id_inst_ptr[0];
-    switch (id)
-    {
-      case 1: /* ipNetToMediaIfIndex */
-        {
-          s32_t *sint_ptr = value;
-          *sint_ptr = od->id_inst_ptr[1];
-        }
-        break;
-      case 2: /* ipNetToMediaPhysAddress */
-        {
-          struct eth_addr *dst = value;
-
-          *dst = *ethaddr_ret;
-        }
-        break;
-      case 3: /* ipNetToMediaNetAddress */
-        {
-          struct ip_addr *dst = value;
-
-          *dst = *ipaddr_ret;
-        }
-        break;
-      case 4: /* ipNetToMediaType */
-        {
-          s32_t *sint_ptr = value;
-          /* dynamic (?) */
-          *sint_ptr = 3;
-        }
-        break;
-    }
-  }
-}
-
-static void
-icmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  if ((ident_len == 2) &&
-      (ident[0] > 0) && (ident[0] < 27))
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    od->instance = MIB_OBJECT_SCALAR;
-    od->access = MIB_OBJECT_READ_ONLY;
-    od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
-    od->v_len = sizeof(u32_t);
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("icmp_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-icmp_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u32_t *uint_ptr = value;
-  u8_t id;
-
-  if (len){}
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 1: /* icmpInMsgs */
-      *uint_ptr = icmpinmsgs;
-      break;
-    case 2: /* icmpInErrors */
-      *uint_ptr = icmpinerrors;
-      break;
-    case 3: /* icmpInDestUnreachs */
-      *uint_ptr = icmpindestunreachs;
-      break;
-    case 4: /* icmpInTimeExcds */
-      *uint_ptr = icmpintimeexcds;
-      break;
-    case 5: /* icmpInParmProbs */
-      *uint_ptr = icmpinparmprobs;
-      break;
-    case 6: /* icmpInSrcQuenchs */
-      *uint_ptr = icmpinsrcquenchs;
-      break;
-    case 7: /* icmpInRedirects */
-      *uint_ptr = icmpinredirects;
-      break;
-    case 8: /* icmpInEchos */
-      *uint_ptr = icmpinechos;
-      break;
-    case 9: /* icmpInEchoReps */
-      *uint_ptr = icmpinechoreps;
-      break;
-    case 10: /* icmpInTimestamps */
-      *uint_ptr = icmpintimestamps;
-      break;
-    case 11: /* icmpInTimestampReps */
-      *uint_ptr = icmpintimestampreps;
-      break;
-    case 12: /* icmpInAddrMasks */
-      *uint_ptr = icmpinaddrmasks;
-      break;
-    case 13: /* icmpInAddrMaskReps */
-      *uint_ptr = icmpinaddrmaskreps;
-      break;
-    case 14: /* icmpOutMsgs */
-      *uint_ptr = icmpoutmsgs;
-      break;
-    case 15: /* icmpOutErrors */
-      *uint_ptr = icmpouterrors;
-      break;
-    case 16: /* icmpOutDestUnreachs */
-      *uint_ptr = icmpoutdestunreachs;
-      break;
-    case 17: /* icmpOutTimeExcds */
-      *uint_ptr = icmpouttimeexcds;
-      break;
-    case 18: /* icmpOutParmProbs */
-      *uint_ptr = icmpoutparmprobs;
-      break;
-    case 19: /* icmpOutSrcQuenchs */
-      *uint_ptr = icmpoutsrcquenchs;
-      break;
-    case 20: /* icmpOutRedirects */
-      *uint_ptr = icmpoutredirects;
-      break;
-    case 21: /* icmpOutEchos */
-      *uint_ptr = icmpoutechos;
-      break;
-    case 22: /* icmpOutEchoReps */
-      *uint_ptr = icmpoutechoreps;
-      break;
-    case 23: /* icmpOutTimestamps */
-      *uint_ptr = icmpouttimestamps;
-      break;
-    case 24: /* icmpOutTimestampReps */
-      *uint_ptr = icmpouttimestampreps;
-      break;
-    case 25: /* icmpOutAddrMasks */
-      *uint_ptr = icmpoutaddrmasks;
-      break;
-    case 26: /* icmpOutAddrMaskReps */
-      *uint_ptr = icmpoutaddrmaskreps;
-      break;
-  }
-}
-
-#if LWIP_TCP
-/** @todo tcp grp */
-static void
-tcp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  u8_t id;
-
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  if (ident_len == 2)
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def tcp.%"U16_F".0\n",(u16_t)id));
-
-    switch (id)
-    {
-      case 1: /* tcpRtoAlgorithm */
-      case 2: /* tcpRtoMin */
-      case 3: /* tcpRtoMax */
-      case 4: /* tcpMaxConn */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 5: /* tcpActiveOpens */
-      case 6: /* tcpPassiveOpens */
-      case 7: /* tcpAttemptFails */
-      case 8: /* tcpEstabResets */
-      case 10: /* tcpInSegs */
-      case 11: /* tcpOutSegs */
-      case 12: /* tcpRetransSegs */
-      case 14: /* tcpInErrs */
-      case 15: /* tcpOutRsts */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
-        od->v_len = sizeof(u32_t);
-        break;
-      case 9: /* tcpCurrEstab */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE);
-        od->v_len = sizeof(u32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcp_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    };
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcp_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-tcp_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u32_t *uint_ptr = value;
-  s32_t *sint_ptr = value;
-  u8_t id;
-
-  if (len){}
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 1: /* tcpRtoAlgorithm, vanj(4) */
-      *sint_ptr = 4;
-      break;
-    case 2: /* tcpRtoMin */
-      /* @todo not the actual value, a guess,
-          needs to be calculated */
-      *sint_ptr = 1000;
-      break;
-    case 3: /* tcpRtoMax */
-      /* @todo not the actual value, a guess,
-         needs to be calculated */
-      *sint_ptr = 60000;
-      break;
-    case 4: /* tcpMaxConn */
-      *sint_ptr = MEMP_NUM_TCP_PCB;
-      break;
-    case 5: /* tcpActiveOpens */
-      *uint_ptr = tcpactiveopens;
-      break;
-    case 6: /* tcpPassiveOpens */
-      *uint_ptr = tcppassiveopens;
-      break;
-    case 7: /* tcpAttemptFails */
-      *uint_ptr = tcpattemptfails;
-      break;
-    case 8: /* tcpEstabResets */
-      *uint_ptr = tcpestabresets;
-      break;
-    case 9: /* tcpCurrEstab */
-      {
-        u16_t tcpcurrestab = 0;
-        struct tcp_pcb *pcb = tcp_active_pcbs;
-        while (pcb != NULL)
-        {
-          if ((pcb->state == ESTABLISHED) ||
-              (pcb->state == CLOSE_WAIT))
-          {
-            tcpcurrestab++;
-          }
-          pcb = pcb->next;
-        }
-        *uint_ptr = tcpcurrestab;
-      }
-      break;
-    case 10: /* tcpInSegs */
-      *uint_ptr = tcpinsegs;
-      break;
-    case 11: /* tcpOutSegs */
-      *uint_ptr = tcpoutsegs;
-      break;
-    case 12: /* tcpRetransSegs */
-      *uint_ptr = tcpretranssegs;
-      break;
-    case 14: /* tcpInErrs */
-      *uint_ptr = tcpinerrs;
-      break;
-    case 15: /* tcpOutRsts */
-      *uint_ptr = tcpoutrsts;
-      break;
-  }
-}
-
-static void
-tcpconnentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (10) */
-  ident_len += 10;
-  ident -= 10;
-
-  if (ident_len == 11)
-  {
-    u8_t id;
-
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def tcp.%"U16_F".0\n",(u16_t)id));
-
-    switch (id)
-    {
-      case 1: /* tcpConnState */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      case 2: /* tcpConnLocalAddress */
-      case 4: /* tcpConnRemAddress */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
-        od->v_len = 4;
-        break;
-      case 3: /* tcpConnLocalPort */
-      case 5: /* tcpConnRemPort */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcpconnentry_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    };
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcpconnentry_get_object_def: no such object\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-tcpconnentry_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  struct ip_addr lip, rip;
-  u16_t lport, rport;
-  s32_t *ident;
-
-  ident = od->id_inst_ptr;
-  snmp_oidtoip(&ident[1], &lip);
-  lip.addr = htonl(lip.addr);
-  lport = ident[5];
-  snmp_oidtoip(&ident[6], &rip);
-  rip.addr = htonl(rip.addr);
-  rport = ident[10];
-
-  /** @todo find matching PCB */
-}
-#endif
-
-static void
-udp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  if ((ident_len == 2) &&
-      (ident[0] > 0) && (ident[0] < 6))
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    od->instance = MIB_OBJECT_SCALAR;
-    od->access = MIB_OBJECT_READ_ONLY;
-    od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
-    od->v_len = sizeof(u32_t);
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("udp_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-udp_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u32_t *uint_ptr = value;
-  u8_t id;
-
-  if (len){}
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-    case 1: /* udpInDatagrams */
-      *uint_ptr = udpindatagrams;
-      break;
-    case 2: /* udpNoPorts */
-      *uint_ptr = udpnoports;
-      break;
-    case 3: /* udpInErrors */
-      *uint_ptr = udpinerrors;
-      break;
-    case 4: /* udpOutDatagrams */
-      *uint_ptr = udpoutdatagrams;
-      break;
-  }
-}
-
-static void
-udpentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (5) */
-  ident_len += 5;
-  ident -= 5;
-
-  if (ident_len == 6)
-  {
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    switch (ident[0])
-    {
-      case 1: /* udpLocalAddress */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
-        od->v_len = 4;
-        break;
-      case 2: /* udpLocalPort */
-        od->instance = MIB_OBJECT_TAB;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("udpentry_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    }
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("udpentry_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-udpentry_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id;
-  struct udp_pcb *pcb;
-  struct ip_addr ip;
-  u16_t port;
-
-  if (len){}
-  snmp_oidtoip(&od->id_inst_ptr[1], &ip);
-  ip.addr = htonl(ip.addr);
-  port = od->id_inst_ptr[5];
-
-  pcb = udp_pcbs;
-  while ((pcb != NULL) &&
-         !((pcb->local_ip.addr == ip.addr) &&
-           (pcb->local_port == port)))
-  {
-    pcb = pcb->next;
-  }
-
-  if (pcb != NULL)
-  {
-    id = od->id_inst_ptr[0];
-    switch (id)
-    {
-      case 1: /* udpLocalAddress */
-        {
-          struct ip_addr *dst = value;
-          *dst = pcb->local_ip;
-        }
-        break;
-      case 2: /* udpLocalPort */
-        {
-          s32_t *sint_ptr = value;
-          *sint_ptr = pcb->local_port;
-        }
-        break;
-    }
-  }
-}
-
-static void
-snmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
-{
-  /* return to object name, adding index depth (1) */
-  ident_len += 1;
-  ident -= 1;
-  if (ident_len == 2)
-  {
-    u8_t id;
-
-    od->id_inst_len = ident_len;
-    od->id_inst_ptr = ident;
-
-    id = ident[0];
-    switch (id)
-    {
-      case 1: /* snmpInPkts */
-      case 2: /* snmpOutPkts */
-      case 3: /* snmpInBadVersions */
-      case 4: /* snmpInBadCommunityNames */
-      case 5: /* snmpInBadCommunityUses */
-      case 6: /* snmpInASNParseErrs */
-      case 8: /* snmpInTooBigs */
-      case 9: /* snmpInNoSuchNames */
-      case 10: /* snmpInBadValues */
-      case 11: /* snmpInReadOnlys */
-      case 12: /* snmpInGenErrs */
-      case 13: /* snmpInTotalReqVars */
-      case 14: /* snmpInTotalSetVars */
-      case 15: /* snmpInGetRequests */
-      case 16: /* snmpInGetNexts */
-      case 17: /* snmpInSetRequests */
-      case 18: /* snmpInGetResponses */
-      case 19: /* snmpInTraps */
-      case 20: /* snmpOutTooBigs */
-      case 21: /* snmpOutNoSuchNames */
-      case 22: /* snmpOutBadValues */
-      case 24: /* snmpOutGenErrs */
-      case 25: /* snmpOutGetRequests */
-      case 26: /* snmpOutGetNexts */
-      case 27: /* snmpOutSetRequests */
-      case 28: /* snmpOutGetResponses */
-      case 29: /* snmpOutTraps */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_ONLY;
-        od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
-        od->v_len = sizeof(u32_t);
-        break;
-      case 30: /* snmpEnableAuthenTraps */
-        od->instance = MIB_OBJECT_SCALAR;
-        od->access = MIB_OBJECT_READ_WRITE;
-        od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
-        od->v_len = sizeof(s32_t);
-        break;
-      default:
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_get_object_def: no such object\n"));
-        od->instance = MIB_OBJECT_NONE;
-        break;
-    };
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_get_object_def: no scalar\n"));
-    od->instance = MIB_OBJECT_NONE;
-  }
-}
-
-static void
-snmp_get_value(struct obj_def *od, u16_t len, void *value)
-{
-  u32_t *uint_ptr = value;
-  u8_t id;
-
-  if (len){}
-  id = od->id_inst_ptr[0];
-  switch (id)
-  {
-      case 1: /* snmpInPkts */
-        *uint_ptr = snmpinpkts;
-        break;
-      case 2: /* snmpOutPkts */
-        *uint_ptr = snmpoutpkts;
-        break;
-      case 3: /* snmpInBadVersions */
-        *uint_ptr = snmpinbadversions;
-        break;
-      case 4: /* snmpInBadCommunityNames */
-        *uint_ptr = snmpinbadcommunitynames;
-        break;
-      case 5: /* snmpInBadCommunityUses */
-        *uint_ptr = snmpinbadcommunityuses;
-        break;
-      case 6: /* snmpInASNParseErrs */
-        *uint_ptr = snmpinasnparseerrs;
-        break;
-      case 8: /* snmpInTooBigs */
-        *uint_ptr = snmpintoobigs;
-        break;
-      case 9: /* snmpInNoSuchNames */
-        *uint_ptr = snmpinnosuchnames;
-        break;
-      case 10: /* snmpInBadValues */
-        *uint_ptr = snmpinbadvalues;
-        break;
-      case 11: /* snmpInReadOnlys */
-        *uint_ptr = snmpinreadonlys;
-        break;
-      case 12: /* snmpInGenErrs */
-        *uint_ptr = snmpingenerrs;
-        break;
-      case 13: /* snmpInTotalReqVars */
-        *uint_ptr = snmpintotalreqvars;
-        break;
-      case 14: /* snmpInTotalSetVars */
-        *uint_ptr = snmpintotalsetvars;
-        break;
-      case 15: /* snmpInGetRequests */
-        *uint_ptr = snmpingetrequests;
-        break;
-      case 16: /* snmpInGetNexts */
-        *uint_ptr = snmpingetnexts;
-        break;
-      case 17: /* snmpInSetRequests */
-        *uint_ptr = snmpinsetrequests;
-        break;
-      case 18: /* snmpInGetResponses */
-        *uint_ptr = snmpingetresponses;
-        break;
-      case 19: /* snmpInTraps */
-        *uint_ptr = snmpintraps;
-        break;
-      case 20: /* snmpOutTooBigs */
-        *uint_ptr = snmpouttoobigs;
-        break;
-      case 21: /* snmpOutNoSuchNames */
-        *uint_ptr = snmpoutnosuchnames;
-        break;
-      case 22: /* snmpOutBadValues */
-        *uint_ptr = snmpoutbadvalues;
-        break;
-      case 24: /* snmpOutGenErrs */
-        *uint_ptr = snmpoutgenerrs;
-        break;
-      case 25: /* snmpOutGetRequests */
-        *uint_ptr = snmpoutgetrequests;
-        break;
-      case 26: /* snmpOutGetNexts */
-        *uint_ptr = snmpoutgetnexts;
-        break;
-      case 27: /* snmpOutSetRequests */
-        *uint_ptr = snmpoutsetrequests;
-        break;
-      case 28: /* snmpOutGetResponses */
-        *uint_ptr = snmpoutgetresponses;
-        break;
-      case 29: /* snmpOutTraps */
-        *uint_ptr = snmpouttraps;
-        break;
-      case 30: /* snmpEnableAuthenTraps */
-        *uint_ptr = *snmpenableauthentraps_ptr;
-        break;
-  };
-}
-
-/**
- * Test snmp object value before setting.
- *
- * @param od is the object definition
- * @param len return value space (in bytes)
- * @param value points to (varbind) space to copy value from.
- */
-static u8_t
-snmp_set_test(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id, set_ok;
-
-  if (len) {}
-  set_ok = 0;
-  id = od->id_inst_ptr[0];
-  if (id == 30)
-  {
-    /* snmpEnableAuthenTraps */
-    s32_t *sint_ptr = value;
-
-    if (snmpenableauthentraps_ptr != &snmpenableauthentraps_default)
-    {
-      /* we should have writable non-volatile mem here */
-      if ((*sint_ptr == 1) || (*sint_ptr == 2))
-      {
-        set_ok = 1;
-      }
-    }
-    else
-    {
-      /* const or hardwired value */
-      if (*sint_ptr == snmpenableauthentraps_default)
-      {
-        set_ok = 1;
-      }
-    }
-  }
-  return set_ok;
-}
-
-static void
-snmp_set_value(struct obj_def *od, u16_t len, void *value)
-{
-  u8_t id;
-
-  if (len) {}
-  id = od->id_inst_ptr[0];
-  if (id == 30)
-  {
-    /* snmpEnableAuthenTraps */
-    s32_t *sint_ptr = value;
-    *snmpenableauthentraps_ptr = *sint_ptr;
-  }
-}
-
-#endif /* LWIP_SNMP */
diff --git a/src/VBox/Devices/Network/lwip/src/core/snmp/mib_structs.c b/src/VBox/Devices/Network/lwip/src/core/snmp/mib_structs.c
deleted file mode 100644
index e68636a..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/snmp/mib_structs.c
+++ /dev/null
@@ -1,1185 +0,0 @@
-/**
- * @file
- * MIB tree access/construction functions.
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#include "lwip/opt.h"
-
-#if LWIP_SNMP
-#include "lwip/snmp_structs.h"
-#include "lwip/mem.h"
-
-
-
-/** .iso.org.dod.internet address prefix, @see snmp_iso_*() */
-const s32_t prefix[4] = {1, 3, 6, 1};
-
-#define NODE_STACK_SIZE (LWIP_SNMP_OBJ_ID_LEN)
-/** node stack entry (old news?) */
-struct nse
-{
-  /** right child */
-  struct mib_node* r_ptr;
-  /** right child identifier */
-  s32_t r_id;
-  /** right child next level */
-  u8_t r_nl;
-};
-static u8_t node_stack_cnt = 0;
-static struct nse node_stack[NODE_STACK_SIZE];
-
-/**
- * Pushes nse struct onto stack.
- */
-static void
-push_node(struct nse* node)
-{
-  LWIP_ASSERT("node_stack_cnt < NODE_STACK_SIZE",node_stack_cnt < NODE_STACK_SIZE);
-  LWIP_DEBUGF(SNMP_MIB_DEBUG,("push_node() node=%p id=%"S32_F"\n",(void*)(node->r_ptr),node->r_id));
-  if (node_stack_cnt < NODE_STACK_SIZE)
-  {
-    node_stack[node_stack_cnt] = *node;
-    node_stack_cnt++;
-  }
-}
-
-/**
- * Pops nse struct from stack.
- */
-static void
-pop_node(struct nse* node)
-{
-  if (node_stack_cnt > 0)
-  {
-    node_stack_cnt--;
-    *node = node_stack[node_stack_cnt];
-  }
-  LWIP_DEBUGF(SNMP_MIB_DEBUG,("pop_node() node=%p id=%"S32_F"\n",(void *)(node->r_ptr),node->r_id));
-}
-
-/**
- * Conversion from ifIndex to lwIP netif
- * @param ifindex is a s32_t object sub-identifier
- * @param netif points to returned netif struct pointer
- */
-void
-snmp_ifindextonetif(s32_t ifindex, struct netif **netif)
-{
-  struct netif *nif = netif_list;
-  u16_t i, ifidx;
-
-  ifidx = ifindex - 1;
-  i = 0;
-  while ((nif != NULL) && (i < ifidx))
-  {
-    nif = nif->next;
-    i++;
-  }
-  *netif = nif;
-}
-
-/**
- * Conversion from lwIP netif to ifIndex
- * @param netif points to a netif struct
- * @param ifindex points to s32_t object sub-identifier
- */
-void
-snmp_netiftoifindex(struct netif *netif, s32_t *ifidx)
-{
-  struct netif *nif = netif_list;
-  u16_t i;
-
-  i = 0;
-  while (nif != netif)
-  {
-    nif = nif->next;
-    i++;
-  }
-  *ifidx = i+1;
-}
-
-/**
- * Conversion from oid to lwIP ip_addr
- * @param ident points to s32_t ident[4] input
- * @param ip points to output struct
- */
-void
-snmp_oidtoip(s32_t *ident, struct ip_addr *ip)
-{
-  u32_t ipa;
-
-  ipa = ident[0];
-  ipa <<= 8;
-  ipa |= ident[1];
-  ipa <<= 8;
-  ipa |= ident[2];
-  ipa <<= 8;
-  ipa |= ident[3];
-  ip->addr = ipa;
-}
-
-/**
- * Conversion from lwIP ip_addr to oid
- * @param ip points to input struct
- * @param ident points to s32_t ident[4] output
- */
-void
-snmp_iptooid(struct ip_addr *ip, s32_t *ident)
-{
-  u32_t ipa;
-
-  ipa = ip->addr;
-  ident[0] = (ipa >> 24) & 0xff;
-  ident[1] = (ipa >> 16) & 0xff;
-  ident[2] = (ipa >> 8) & 0xff;
-  ident[3] = ipa & 0xff;
-}
-
-struct mib_list_node *
-snmp_mib_ln_alloc(s32_t id)
-{
-  struct mib_list_node *ln;
-
-  ln = (struct mib_list_node *)mem_malloc(sizeof(struct mib_list_node));
-  if (ln != NULL)
-  {
-    ln->prev = NULL;
-    ln->next = NULL;
-    ln->objid = id;
-    ln->nptr = NULL;
-  }
-  return ln;
-}
-
-void
-snmp_mib_ln_free(struct mib_list_node *ln)
-{
-  mem_free(ln);
-}
-
-struct mib_list_rootnode *
-snmp_mib_lrn_alloc(void)
-{
-  struct mib_list_rootnode *lrn;
-
-  lrn = (struct mib_list_rootnode*)mem_malloc(sizeof(struct mib_list_rootnode));
-  if (lrn != NULL)
-  {
-    lrn->get_object_def = noleafs_get_object_def;
-    lrn->get_value = noleafs_get_value;
-    lrn->set_test = noleafs_set_test;
-    lrn->set_value = noleafs_set_value;
-    lrn->node_type = MIB_NODE_LR;
-    lrn->maxlength = 0;
-    lrn->head = NULL;
-    lrn->tail = NULL;
-    lrn->count = 0;
-  }
-  return lrn;
-}
-
-void
-snmp_mib_lrn_free(struct mib_list_rootnode *lrn)
-{
-  mem_free(lrn);
-}
-
-/**
- * Inserts node in idx list in a sorted
- * (ascending order) fashion and
- * allocates the node if needed.
- *
- * @param rn points to the root node
- * @param objid is the object sub identifier
- * @param insn points to a pointer to the inserted node
- *   used for constructing the tree.
- * @return -1 if failed, 1 if inserted, 2 if present.
- */
-s8_t
-snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn)
-{
-  struct mib_list_node *nn;
-  s8_t insert;
-
-  LWIP_ASSERT("rn != NULL",rn != NULL);
-
-  /* -1 = malloc failure, 0 = not inserted, 1 = inserted, 2 = was present */
-  insert = 0;
-  if (rn->head == NULL)
-  {
-    /* empty list, add first node */
-    LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc empty list objid==%"S32_F"\n",objid));
-    nn = snmp_mib_ln_alloc(objid);
-    if (nn != NULL)
-    {
-      rn->head = nn;
-      rn->tail = nn;
-      *insn = nn;
-      insert = 1;
-    }
-    else
-    {
-      insert = -1;
-    }
-  }
-  else
-  {
-    struct mib_list_node *n;
-    /* at least one node is present */
-    n = rn->head;
-    while ((n != NULL) && (insert == 0))
-    {
-      if (n->objid == objid)
-      {
-        /* node is already there */
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("node already there objid==%"S32_F"\n",objid));
-        *insn = n;
-        insert = 2;
-      }
-      else if (n->objid < objid)
-      {
-        if (n->next == NULL)
-        {
-          /* alloc and insert at the tail */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc ins tail objid==%"S32_F"\n",objid));
-          nn = snmp_mib_ln_alloc(objid);
-          if (nn != NULL)
-          {
-            nn->next = NULL;
-            nn->prev = n;
-            n->next = nn;
-            rn->tail = nn;
-            *insn = nn;
-            insert = 1;
-          }
-          else
-          {
-            /* insertion failure */
-            insert = -1;
-          }
-        }
-        else
-        {
-          /* there's more to explore: traverse list */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("traverse list\n"));
-          n = n->next;
-        }
-      }
-      else
-      {
-        /* n->objid > objid */
-        /* alloc and insert between n->prev and n */
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc ins n->prev, objid==%"S32_F", n\n",objid));
-        nn = snmp_mib_ln_alloc(objid);
-        if (nn != NULL)
-        {
-          if (n->prev == NULL)
-          {
-            /* insert at the head */
-            nn->next = n;
-            nn->prev = NULL;
-            rn->head = nn;
-            n->prev = nn;
-          }
-          else
-          {
-            /* insert in the middle */
-            nn->next = n;
-            nn->prev = n->prev;
-            n->prev->next = nn;
-            n->prev = nn;
-          }
-          *insn = nn;
-          insert = 1;
-        }
-        else
-        {
-          /* insertion failure */
-          insert = -1;
-        }
-      }
-    }
-  }
-  if (insert == 1)
-  {
-    rn->count += 1;
-  }
-  LWIP_ASSERT("insert != 0",insert != 0);
-  return insert;
-}
-
-/**
- * Finds node in idx list and returns deletion mark.
- *
- * @param rn points to the root node
- * @param objid  is the object sub identifier
- * @param fn returns pointer to found node
- * @return 0 if not found, 1 if deletable,
- *   2 can't delete (2 or more children), 3 not a list_node
- */
-s8_t
-snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn)
-{
-  s8_t fc;
-  struct mib_list_node *n;
-
-  LWIP_ASSERT("rn != NULL",rn != NULL);
-  n = rn->head;
-  while ((n != NULL) && (n->objid != objid))
-  {
-    n = n->next;
-  }
-  if (n == NULL)
-  {
-    fc = 0;
-  }
-  else if (n->nptr == NULL)
-  {
-    /* leaf, can delete node */
-    fc = 1;
-  }
-  else
-  {
-    struct mib_list_rootnode *rn;
-
-    if (n->nptr->node_type == MIB_NODE_LR)
-    {
-      rn = (struct mib_list_rootnode *)n->nptr;
-      if (rn->count > 1)
-      {
-        /* can't delete node */
-        fc = 2;
-      }
-      else
-      {
-        /* count <= 1, can delete node */
-        fc = 1;
-      }
-    }
-    else
-    {
-      /* other node type */
-      fc = 3;
-    }
-  }
-  *fn = n;
-  return fc;
-}
-
-/**
- * Removes node from idx list
- * if it has a single child left.
- *
- * @param rn points to the root node
- * @param n points to the node to delete
- * @return the nptr to be freed by caller
- */
-struct mib_list_rootnode *
-snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n)
-{
-  struct mib_list_rootnode *next;
-
-  LWIP_ASSERT("rn != NULL",rn != NULL);
-  LWIP_ASSERT("n != NULL",n != NULL);
-
-  /* caller must remove this sub-tree */
-  next = (struct mib_list_rootnode*)(n->nptr);
-  rn->count -= 1;
-
-  if (n == rn->head)
-  {
-    rn->head = n->next;
-    if (n->next != NULL)
-    {
-      /* not last node, new list begin */
-      n->next->prev = NULL;
-    }
-  }
-  else if (n == rn->tail)
-  {
-    rn->tail = n->prev;
-    if (n->prev != NULL)
-    {
-      /* not last node, new list end */
-      n->prev->next = NULL;
-    }
-  }
-  else
-  {
-    /* node must be in the middle */
-    n->prev->next = n->next;
-    n->next->prev = n->prev;
-  }
-  LWIP_DEBUGF(SNMP_MIB_DEBUG,("free list objid==%"S32_F"\n",n->objid));
-  snmp_mib_ln_free(n);
-  if (rn->count == 0)
-  {
-    rn->head = NULL;
-    rn->tail = NULL;
-  }
-  return next;
-}
-
-
-
-/**
- * Searches tree for the supplied (scalar?) object identifier.
- *
- * @param node points to the root of the tree ('.internet')
- * @param ident_len the length of the supplied object identifier
- * @param ident points to the array of sub identifiers
- * @param np points to the found object instance (rerurn)
- * @return pointer to the requested parent (!) node if success, NULL otherwise
- */
-struct mib_node *
-snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np)
-{
-  u8_t node_type, ext_level;
-
-  ext_level = 0;
-  LWIP_DEBUGF(SNMP_MIB_DEBUG,("node==%p *ident==%"S32_F"\n",(void*)node,*ident));
-  while (node != NULL)
-  {
-    node_type = node->node_type;
-    if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA))
-    {
-      struct mib_array_node *an;
-      u16_t i;
-
-      if (ident_len > 0)
-      {
-        /* array node (internal ROM or RAM, fixed length) */
-        an = (struct mib_array_node *)node;
-        i = 0;
-        while ((i < an->maxlength) && (an->objid[i] != *ident))
-        {
-          i++;
-        }
-        if (i < an->maxlength)
-        {
-          /* found it, if available proceed to child, otherwise inspect leaf */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("an->objid[%"U16_F"]==%"S32_F" *ident==%"S32_F"\n",i,an->objid[i],*ident));
-          if (an->nptr[i] == NULL)
-          {
-            /* a scalar leaf OR table,
-               inspect remaining instance number / table index */
-            np->ident_len = ident_len;
-            np->ident = ident;
-            return (struct mib_node*)an;
-          }
-          else
-          {
-            /* follow next child pointer */
-            ident++;
-            ident_len--;
-            node = an->nptr[i];
-          }
-        }
-        else
-        {
-          /* search failed, identifier mismatch (nosuchname) */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("an search failed *ident==%"S32_F"\n",*ident));
-          return NULL;
-        }
-      }
-      else
-      {
-        /* search failed, short object identifier (nosuchname) */
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("an search failed, short object identifier\n"));
-        return NULL;
-      }
-    }
-    else if(node_type == MIB_NODE_LR)
-    {
-      struct mib_list_rootnode *lrn;
-      struct mib_list_node *ln;
-
-      if (ident_len > 0)
-      {
-        /* list root node (internal 'RAM', variable length) */
-        lrn = (struct mib_list_rootnode *)node;
-        ln = lrn->head;
-        /* iterate over list, head to tail */
-        while ((ln != NULL) && (ln->objid != *ident))
-        {
-          ln = ln->next;
-        }
-        if (ln != NULL)
-        {
-          /* found it, proceed to child */;
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("ln->objid==%"S32_F" *ident==%"S32_F"\n",ln->objid,*ident));
-          if (ln->nptr == NULL)
-          {
-            np->ident_len = ident_len;
-            np->ident = ident;
-            return (struct mib_node*)lrn;
-          }
-          else
-          {
-            /* follow next child pointer */
-            ident_len--;
-            ident++;
-            node = ln->nptr;
-          }
-        }
-        else
-        {
-          /* search failed */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("ln search failed *ident==%"S32_F"\n",*ident));
-          return NULL;
-        }
-      }
-      else
-      {
-        /* search failed, short object identifier (nosuchname) */
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("ln search failed, short object identifier\n"));
-        return NULL;
-      }
-    }
-    else if(node_type == MIB_NODE_EX)
-    {
-      struct mib_external_node *en;
-      u16_t i, len;
-
-      if (ident_len > 0)
-      {
-        /* external node (addressing and access via functions) */
-        en = (struct mib_external_node *)node;
-
-        i = 0;
-        len = en->level_length(en->addr_inf,ext_level);
-        while ((i < len) && (en->ident_cmp(en->addr_inf,ext_level,i,*ident) != 0))
-        {
-          i++;
-        }
-        if (i < len)
-        {
-          s32_t debug_id;
-
-          en->get_objid(en->addr_inf,ext_level,i,&debug_id);
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("en->objid==%"S32_F" *ident==%"S32_F"\n",debug_id,*ident));
-          if ((ext_level + 1) == en->tree_levels)
-          {
-            np->ident_len = ident_len;
-            np->ident = ident;
-            return (struct mib_node*)en;
-          }
-          else
-          {
-            /* found it, proceed to child */
-            ident_len--;
-            ident++;
-            ext_level++;
-          }
-        }
-        else
-        {
-          /* search failed */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("en search failed *ident==%"S32_F"\n",*ident));
-          return NULL;
-        }
-      }
-      else
-      {
-        /* search failed, short object identifier (nosuchname) */
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("en search failed, short object identifier\n"));
-        return NULL;
-      }
-    }
-    else if (node_type == MIB_NODE_SC)
-    {
-      mib_scalar_node *sn;
-
-      sn = (mib_scalar_node *)node;
-      if ((ident_len == 1) && (*ident == 0))
-      {
-        np->ident_len = ident_len;
-        np->ident = ident;
-        return (struct mib_node*)sn;
-      }
-      else
-      {
-        /* search failed, short object identifier (nosuchname) */
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("search failed, invalid object identifier length\n"));
-        return NULL;
-      }
-    }
-    else
-    {
-      /* unknown node_type */
-      LWIP_DEBUGF(SNMP_MIB_DEBUG,("search failed node_type %"U16_F" unkown\n",(u16_t)node_type));
-      return NULL;
-    }
-  }
-  /* done, found nothing */
-  LWIP_DEBUGF(SNMP_MIB_DEBUG,("search failed node==%p\n",(void*)node));
-  return NULL;
-}
-
-/**
- * Test table for presence of at least one table entry.
- */
-static u8_t
-empty_table(struct mib_node *node)
-{
-  u8_t node_type;
-  u8_t empty = 0;
-
-  if (node != NULL)
-  {
-    node_type = node->node_type;
-    if (node_type == MIB_NODE_LR)
-    {
-      struct mib_list_rootnode *lrn;
-      lrn = (struct mib_list_rootnode *)node;
-      if ((lrn->count == 0) || (lrn->head == NULL))
-      {
-        empty = 1;
-      }
-    }
-    else if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA))
-    {
-      struct mib_array_node *an;
-      an = (struct mib_array_node *)node;
-      if ((an->maxlength == 0) || (an->nptr == NULL))
-      {
-        empty = 1;
-      }
-    }
-    else if (node_type == MIB_NODE_EX)
-    {
-      struct mib_external_node *en;
-      en = (struct mib_external_node *)node;
-      if (en->tree_levels == 0)
-      {
-        empty = 1;
-      }
-    }
-  }
-  return empty;
-}
-
-/**
- * Tree expansion.
- */
-struct mib_node *
-snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret)
-{
-  u8_t node_type, ext_level, climb_tree;
-
-  ext_level = 0;
-  /* reset node stack */
-  node_stack_cnt = 0;
-  while (node != NULL)
-  {
-    climb_tree = 0;
-    node_type = node->node_type;
-    if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA))
-    {
-      struct mib_array_node *an;
-      u16_t i;
-
-      /* array node (internal ROM or RAM, fixed length) */
-      an = (struct mib_array_node *)node;
-      if (ident_len > 0)
-      {
-        i = 0;
-        while ((i < an->maxlength) && (an->objid[i] < *ident))
-        {
-          i++;
-        }
-        if (i < an->maxlength)
-        {
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("an->objid[%"U16_F"]==%"S32_F" *ident==%"S32_F"\n",i,an->objid[i],*ident));
-          /* add identifier to oidret */
-          oidret->id[oidret->len] = an->objid[i];
-          (oidret->len)++;
-
-          if (an->nptr[i] == NULL)
-          {
-            LWIP_DEBUGF(SNMP_MIB_DEBUG,("leaf node\n"));
-            /* leaf node (e.g. in a fixed size table) */
-            if (an->objid[i] > *ident)
-            {
-              return (struct mib_node*)an;
-            }
-            else if ((i + 1) < an->maxlength)
-            {
-              /* an->objid[i] == *ident */
-              (oidret->len)--;
-              oidret->id[oidret->len] = an->objid[i + 1];
-              (oidret->len)++;
-              return (struct mib_node*)an;
-            }
-            else
-            {
-              /* (i + 1) == an->maxlength */
-              (oidret->len)--;
-              climb_tree = 1;
-            }
-          }
-          else
-          {
-            u8_t j;
-            struct nse cur_node;
-
-            LWIP_DEBUGF(SNMP_MIB_DEBUG,("non-leaf node\n"));
-            /* non-leaf, store right child ptr and id */
-            j = i + 1;
-            while ((j < an->maxlength) && (empty_table(an->nptr[j])))
-            {
-              j++;
-            }
-            if (j < an->maxlength)
-            {
-              cur_node.r_ptr = an->nptr[j];
-              cur_node.r_id = an->objid[j];
-              cur_node.r_nl = 0;
-            }
-            else
-            {
-              cur_node.r_ptr = NULL;
-            }
-            push_node(&cur_node);
-            if (an->objid[i] == *ident)
-            {
-              ident_len--;
-              ident++;
-            }
-            else
-            {
-              /* an->objid[i] < *ident */
-              ident_len = 0;
-            }
-            /* follow next child pointer */
-            node = an->nptr[i];
-          }
-        }
-        else
-        {
-          /* i == an->maxlength */
-          climb_tree = 1;
-        }
-      }
-      else
-      {
-        u8_t j;
-        /* ident_len == 0, complete with leftmost '.thing' */
-        j = 0;
-        while ((j < an->maxlength) && empty_table(an->nptr[j]))
-        {
-          j++;
-        }
-        if (j < an->maxlength)
-        {
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("left an->objid[j]==%"S32_F"\n",an->objid[j]));
-          oidret->id[oidret->len] = an->objid[j];
-          (oidret->len)++;
-          if (an->nptr[j] == NULL)
-          {
-            /* leaf node */
-            return (struct mib_node*)an;
-          }
-          else
-          {
-            /* no leaf, continue */
-            node = an->nptr[j];
-          }
-        }
-        else
-        {
-          /* j == an->maxlength */
-          climb_tree = 1;
-        }
-      }
-    }
-    else if(node_type == MIB_NODE_LR)
-    {
-      struct mib_list_rootnode *lrn;
-      struct mib_list_node *ln;
-
-      /* list root node (internal 'RAM', variable length) */
-      lrn = (struct mib_list_rootnode *)node;
-      if (ident_len > 0)
-      {
-        ln = lrn->head;
-        /* iterate over list, head to tail */
-        while ((ln != NULL) && (ln->objid < *ident))
-        {
-          ln = ln->next;
-        }
-        if (ln != NULL)
-        {
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("ln->objid==%"S32_F" *ident==%"S32_F"\n",ln->objid,*ident));
-          oidret->id[oidret->len] = ln->objid;
-          (oidret->len)++;
-          if (ln->nptr == NULL)
-          {
-            /* leaf node */
-            if (ln->objid > *ident)
-            {
-              return (struct mib_node*)lrn;
-            }
-            else if (ln->next != NULL)
-            {
-              /* ln->objid == *ident */
-              (oidret->len)--;
-              oidret->id[oidret->len] = ln->next->objid;
-              (oidret->len)++;
-              return (struct mib_node*)lrn;
-            }
-            else
-            {
-              /* ln->next == NULL */
-              (oidret->len)--;
-              climb_tree = 1;
-            }
-          }
-          else
-          {
-            struct mib_list_node *jn;
-            struct nse cur_node;
-
-            /* non-leaf, store right child ptr and id */
-            jn = ln->next;
-            while ((jn != NULL) && empty_table(jn->nptr))
-            {
-              jn = jn->next;
-            }
-            if (jn != NULL)
-            {
-              cur_node.r_ptr = jn->nptr;
-              cur_node.r_id = jn->objid;
-              cur_node.r_nl = 0;
-            }
-            else
-            {
-              cur_node.r_ptr = NULL;
-            }
-            push_node(&cur_node);
-            if (ln->objid == *ident)
-            {
-              ident_len--;
-              ident++;
-            }
-            else
-            {
-              /* ln->objid < *ident */
-              ident_len = 0;
-            }
-            /* follow next child pointer */
-            node = ln->nptr;
-          }
-
-        }
-        else
-        {
-          /* ln == NULL */
-          climb_tree = 1;
-        }
-      }
-      else
-      {
-        struct mib_list_node *jn;
-        /* ident_len == 0, complete with leftmost '.thing' */
-        jn = lrn->head;
-        while ((jn != NULL) && empty_table(jn->nptr))
-        {
-          jn = jn->next;
-        }
-        if (jn != NULL)
-        {
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("left jn->objid==%"S32_F"\n",jn->objid));
-          oidret->id[oidret->len] = jn->objid;
-          (oidret->len)++;
-          if (jn->nptr == NULL)
-          {
-            /* leaf node */
-            LWIP_DEBUGF(SNMP_MIB_DEBUG,("jn->nptr == NULL\n"));
-            return (struct mib_node*)lrn;
-          }
-          else
-          {
-            /* no leaf, continue */
-            node = jn->nptr;
-          }
-        }
-        else
-        {
-          /* jn == NULL */
-          climb_tree = 1;
-        }
-      }
-    }
-    else if(node_type == MIB_NODE_EX)
-    {
-      struct mib_external_node *en;
-      s32_t ex_id;
-
-      /* external node (addressing and access via functions) */
-      en = (struct mib_external_node *)node;
-      if (ident_len > 0)
-      {
-        u16_t i, len;
-
-        i = 0;
-        len = en->level_length(en->addr_inf,ext_level);
-        while ((i < len) && (en->ident_cmp(en->addr_inf,ext_level,i,*ident) < 0))
-        {
-          i++;
-        }
-        if (i < len)
-        {
-          /* add identifier to oidret */
-          en->get_objid(en->addr_inf,ext_level,i,&ex_id);
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("en->objid[%"U16_F"]==%"S32_F" *ident==%"S32_F"\n",i,ex_id,*ident));
-          oidret->id[oidret->len] = ex_id;
-          (oidret->len)++;
-
-          if ((ext_level + 1) == en->tree_levels)
-          {
-            LWIP_DEBUGF(SNMP_MIB_DEBUG,("leaf node\n"));
-            /* leaf node */
-            if (ex_id > *ident)
-            {
-              return (struct mib_node*)en;
-            }
-            else if ((i + 1) < len)
-            {
-              /* ex_id == *ident */
-              en->get_objid(en->addr_inf,ext_level,i + 1,&ex_id);
-              (oidret->len)--;
-              oidret->id[oidret->len] = ex_id;
-              (oidret->len)++;
-              return (struct mib_node*)en;
-            }
-            else
-            {
-              /* (i + 1) == len */
-              (oidret->len)--;
-              climb_tree = 1;
-            }
-          }
-          else
-          {
-            u8_t j;
-            struct nse cur_node;
-
-            LWIP_DEBUGF(SNMP_MIB_DEBUG,("non-leaf node\n"));
-            /* non-leaf, store right child ptr and id */
-            j = i + 1;
-            if (j < len)
-            {
-              /* right node is the current external node */
-              cur_node.r_ptr = node;
-              en->get_objid(en->addr_inf,ext_level,j,&cur_node.r_id);
-              cur_node.r_nl = ext_level + 1;
-            }
-            else
-            {
-              cur_node.r_ptr = NULL;
-            }
-            push_node(&cur_node);
-            if (en->ident_cmp(en->addr_inf,ext_level,i,*ident) == 0)
-            {
-              ident_len--;
-              ident++;
-            }
-            else
-            {
-              /* external id < *ident */
-              ident_len = 0;
-            }
-            /* proceed to child */
-            ext_level++;
-          }
-        }
-        else
-        {
-          /* i == len (en->level_len()) */
-          climb_tree = 1;
-        }
-      }
-      else
-      {
-        /* ident_len == 0, complete with leftmost '.thing' */
-        en->get_objid(en->addr_inf,ext_level,0,&ex_id);
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("left en->objid==%"S32_F"\n",ex_id));
-        oidret->id[oidret->len] = ex_id;
-        (oidret->len)++;
-        if ((ext_level + 1) == en->tree_levels)
-        {
-          /* leaf node */
-          LWIP_DEBUGF(SNMP_MIB_DEBUG,("(ext_level + 1) == en->tree_levels\n"));
-          return (struct mib_node*)en;
-        }
-        else
-        {
-          /* no leaf, proceed to child */
-          ext_level++;
-        }
-      }
-    }
-    else if(node_type == MIB_NODE_SC)
-    {
-      mib_scalar_node *sn;
-
-      /* scalar node  */
-      sn = (mib_scalar_node *)node;
-      if (ident_len > 0)
-      {
-        /* at .0 */
-        climb_tree = 1;
-      }
-      else
-      {
-        /* ident_len == 0, complete object identifier */
-        oidret->id[oidret->len] = 0;
-        (oidret->len)++;
-        /* leaf node */
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("completed scalar leaf\n"));
-        return (struct mib_node*)sn;
-      }
-    }
-    else
-    {
-      /* unknown/unhandled node_type */
-      LWIP_DEBUGF(SNMP_MIB_DEBUG,("expand failed node_type %"U16_F" unkown\n",(u16_t)node_type));
-      return NULL;
-    }
-
-    if (climb_tree)
-    {
-      struct nse child;
-
-      /* find right child ptr */
-      child.r_ptr = NULL;
-      child.r_id = 0;
-      child.r_nl = 0;
-      while ((node_stack_cnt > 0) && (child.r_ptr == NULL))
-      {
-        pop_node(&child);
-        /* trim returned oid */
-        (oidret->len)--;
-      }
-      if (child.r_ptr != NULL)
-      {
-        /* incoming ident is useless beyond this point */
-        ident_len = 0;
-        oidret->id[oidret->len] = child.r_id;
-        oidret->len++;
-        node = child.r_ptr;
-        ext_level = child.r_nl;
-      }
-      else
-      {
-        /* tree ends here ... */
-        LWIP_DEBUGF(SNMP_MIB_DEBUG,("expand failed, tree ends here\n"));
-        return NULL;
-      }
-    }
-  }
-  /* done, found nothing */
-  LWIP_DEBUGF(SNMP_MIB_DEBUG,("expand failed node==%p\n",(void*)node));
-  return NULL;
-}
-
-/**
- * Test object identifier for the iso.org.dod.internet prefix.
- *
- * @param ident_len the length of the supplied object identifier
- * @param ident points to the array of sub identifiers
- * @return 1 if it matches, 0 otherwise
- */
-u8_t
-snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident)
-{
-  if ((ident_len > 3) &&
-      (ident[0] == 1) && (ident[1] == 3) &&
-      (ident[2] == 6) && (ident[3] == 1))
-  {
-    return 1;
-  }
-  else
-  {
-    return 0;
-  }
-}
-
-/**
- * Expands object identifier to the iso.org.dod.internet
- * prefix for use in getnext operation.
- *
- * @param ident_len the length of the supplied object identifier
- * @param ident points to the array of sub identifiers
- * @param oidret points to returned expanded object identifier
- * @return 1 if it matches, 0 otherwise
- *
- * @note ident_len 0 is allowed, expanding to the first known object id!!
- */
-u8_t
-snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret)
-{
-  const s32_t *prefix_ptr;
-  s32_t *ret_ptr;
-  u8_t i;
-
-  i = 0;
-  prefix_ptr = &prefix[0];
-  ret_ptr = &oidret->id[0];
-  ident_len = ((ident_len < 4)?ident_len:4);
-  while ((i < ident_len) && ((*ident) <= (*prefix_ptr)))
-  {
-    *ret_ptr++ = *prefix_ptr++;
-    ident++;
-    i++;
-  }
-  if (i == ident_len)
-  {
-    /* match, complete missing bits */
-    while (i < 4)
-    {
-      *ret_ptr++ = *prefix_ptr++;
-      i++;
-    }
-    oidret->len = i;
-    return 1;
-  }
-  else
-  {
-    /* i != ident_len */
-    return 0;
-  }
-}
-
-#endif /* LWIP_SNMP */
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/snmp/msg_in.c b/src/VBox/Devices/Network/lwip/src/core/snmp/msg_in.c
deleted file mode 100644
index d071850..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/snmp/msg_in.c
+++ /dev/null
@@ -1,1458 +0,0 @@
-/**
- * @file
- * SNMP input message processing (RFC1157).
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#include "lwip/opt.h"
-
-#if LWIP_SNMP
-#include <string.h>
-#include "arch/cc.h"
-#include "lwip/ip_addr.h"
-#include "lwip/mem.h"
-#include "lwip/udp.h"
-#include "lwip/stats.h"
-
-#include "lwip/snmp.h"
-#include "lwip/snmp_asn1.h"
-#include "lwip/snmp_msg.h"
-#include "lwip/snmp_structs.h"
-
-
-/* public (non-static) constants */
-/** SNMP v1 == 0 */
-const s32_t snmp_version = 0;
-/** default SNMP community string */
-const char snmp_publiccommunity[7] = "public";
-
-/* statically allocated buffers for SNMP_CONCURRENT_REQUESTS */
-#if (SNMP_CONCURRENT_REQUESTS == 0)
-#error "need at least one snmp_msg_pstat"
-#endif
-struct snmp_msg_pstat msg_input_list[SNMP_CONCURRENT_REQUESTS];
-/* UDP Protocol Control Block */
-struct udp_pcb *snmp1_pcb = NULL;
-
-static void snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port);
-static err_t snmp_pdu_header_check(struct pbuf *p, u16_t ofs, u16_t pdu_len, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat);
-static err_t snmp_pdu_dec_varbindlist(struct pbuf *p, u16_t ofs, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat);
-
-
-/**
- * Starts SNMP Agent.
- * Allocates UDP pcb and binds it to IP_ADDR_ANY port 161.
- */
-void
-snmp_init(void)
-{
-  struct snmp_msg_pstat *msg_ps;
-  u8_t i;
-
-  snmp1_pcb = udp_new();
-  if (snmp1_pcb != NULL)
-  {
-    udp_recv(snmp1_pcb, snmp_recv, (void *)SNMP_IN_PORT);
-    udp_bind(snmp1_pcb, IP_ADDR_ANY, SNMP_IN_PORT);
-  }
-  msg_ps = &msg_input_list[0];
-  for (i=0; i<SNMP_CONCURRENT_REQUESTS; i++)
-  {
-    msg_ps->state = SNMP_MSG_EMPTY;
-    msg_ps->error_index = 0;
-    msg_ps->error_status = SNMP_ES_NOERROR;
-    msg_ps++;
-  }
-  trap_msg.pcb = snmp1_pcb;
-  /* The coldstart trap will only be output
-     if our outgoing interface is up & configured  */
-  snmp_coldstart_trap();
-}
-
-static void
-snmp_error_response(struct snmp_msg_pstat *msg_ps, u8_t error)
-{
-  snmp_varbind_list_free(&msg_ps->outvb);
-  msg_ps->outvb = msg_ps->invb;
-  msg_ps->invb.head = NULL;
-  msg_ps->invb.tail = NULL;
-  msg_ps->invb.count = 0;
-  msg_ps->error_status = error;
-  msg_ps->error_index = 1 + msg_ps->vb_idx;
-  snmp_send_response(msg_ps);
-  snmp_varbind_list_free(&msg_ps->outvb);
-  msg_ps->state = SNMP_MSG_EMPTY;
-}
-
-static void
-snmp_ok_response(struct snmp_msg_pstat *msg_ps)
-{
-  err_t err_ret;
-
-  err_ret = snmp_send_response(msg_ps);
-  if (err_ret == ERR_MEM)
-  {
-    /* serious memory problem, can't return tooBig */
-#if LWIP_STATS
-    LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event pbufs.used = %"U16_F"\n",lwip_stats.pbuf.used));
-#endif
-  }
-  else
-  {
-    LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event = %"S32_F"\n",msg_ps->error_status));
-  }
-  /* free varbinds (if available) */
-  snmp_varbind_list_free(&msg_ps->invb);
-  snmp_varbind_list_free(&msg_ps->outvb);
-  msg_ps->state = SNMP_MSG_EMPTY;
-}
-
-/**
- * Service an internal or external event for SNMP GET.
- *
- * @param request_id identifies requests from 0 to (SNMP_CONCURRENT_REQUESTS-1)
- * @param msg_ps points to the assosicated message process state
- */
-static void
-snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
-{
-  LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_get_event: msg_ps->state==%"U16_F"\n",(u16_t)msg_ps->state));
-
-  if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF)
-  {
-    struct mib_external_node *en;
-    struct snmp_name_ptr np;
-
-    /* get_object_def() answer*/
-    en = msg_ps->ext_mib_node;
-    np = msg_ps->ext_name_ptr;
-
-    /* translate answer into a known lifeform */
-    en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
-    if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
-    {
-      msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE;
-      en->get_value_q(request_id, &msg_ps->ext_object_def);
-    }
-    else
-    {
-      en->get_object_def_pc(request_id, np.ident_len, np.ident);
-      /* search failed, object id points to unknown object (nosuchname) */
-      snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
-    }
-  }
-  else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_VALUE)
-  {
-    struct mib_external_node *en;
-    struct snmp_varbind *vb;
-
-    /* get_value() answer */
-    en = msg_ps->ext_mib_node;
-
-    /* allocate output varbind */
-    vb = (struct snmp_varbind *)mem_malloc(sizeof(struct snmp_varbind));
-    LWIP_ASSERT("vb != NULL",vb != NULL);
-    if (vb != NULL)
-    {
-      vb->next = NULL;
-      vb->prev = NULL;
-
-      /* move name from invb to outvb */
-      vb->ident = msg_ps->vb_ptr->ident;
-      vb->ident_len = msg_ps->vb_ptr->ident_len;
-      /* ensure this memory is refereced once only */
-      msg_ps->vb_ptr->ident = NULL;
-      msg_ps->vb_ptr->ident_len = 0;
-
-      vb->value_type = msg_ps->ext_object_def.asn_type;
-      vb->value_len =  msg_ps->ext_object_def.v_len;
-      if (vb->value_len > 0)
-      {
-        vb->value = mem_malloc(vb->value_len);
-        LWIP_ASSERT("vb->value != NULL",vb->value != NULL);
-        if (vb->value != NULL)
-        {
-          en->get_value_a(request_id, &msg_ps->ext_object_def, vb->value_len, vb->value);
-          snmp_varbind_tail_add(&msg_ps->outvb, vb);
-          /* search again (if vb_idx < msg_ps->invb.count) */
-          msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-          msg_ps->vb_idx += 1;
-        }
-        else
-        {
-          en->get_value_pc(request_id, &msg_ps->ext_object_def);
-          LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: no variable space\n"));
-          msg_ps->vb_ptr->ident = vb->ident;
-          msg_ps->vb_ptr->ident_len = vb->ident_len;
-          mem_free(vb);
-          snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
-        }
-      }
-      else
-      {
-        /* vb->value_len == 0, empty value (e.g. empty string) */
-        en->get_value_a(request_id, &msg_ps->ext_object_def, 0, NULL);
-        vb->value = NULL;
-        snmp_varbind_tail_add(&msg_ps->outvb, vb);
-        /* search again (if vb_idx < msg_ps->invb.count) */
-        msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-        msg_ps->vb_idx += 1;
-      }
-    }
-    else
-    {
-      en->get_value_pc(request_id, &msg_ps->ext_object_def);
-      LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: no outvb space\n"));
-      snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
-    }
-  }
-
-  while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
-         (msg_ps->vb_idx < msg_ps->invb.count))
-  {
-    struct mib_node *mn;
-    struct snmp_name_ptr np;
-
-    if (msg_ps->vb_idx == 0)
-    {
-      msg_ps->vb_ptr = msg_ps->invb.head;
-    }
-    else
-    {
-      msg_ps->vb_ptr = msg_ps->vb_ptr->next;
-    }
-    /** test object identifier for .iso.org.dod.internet prefix */
-    if (snmp_iso_prefix_tst(msg_ps->vb_ptr->ident_len,  msg_ps->vb_ptr->ident))
-    {
-      mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4,
-                             msg_ps->vb_ptr->ident + 4, &np);
-    }
-    else
-    {
-      mn = NULL;
-    }
-    if (mn != NULL)
-    {
-      if (mn->node_type == MIB_NODE_EX)
-      {
-        /* external object */
-        struct mib_external_node *en = (struct mib_external_node*)mn;
-
-        msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
-        /* save en && args in msg_ps!! */
-        msg_ps->ext_mib_node = en;
-        msg_ps->ext_name_ptr = np;
-
-        en->get_object_def_q(en->addr_inf, request_id, np.ident_len, np.ident);
-      }
-      else
-      {
-        /* internal object */
-        struct obj_def object_def;
-
-        msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF;
-        mn->get_object_def(np.ident_len, np.ident, &object_def);
-        if (object_def.instance != MIB_OBJECT_NONE)
-        {
-          mn = mn;
-        }
-        else
-        {
-          /* search failed, object id points to unknown object (nosuchname) */
-          mn =  NULL;
-        }
-        if (mn != NULL)
-        {
-          struct snmp_varbind *vb;
-
-          msg_ps->state = SNMP_MSG_INTERNAL_GET_VALUE;
-          /* allocate output varbind */
-          vb = (struct snmp_varbind *)mem_malloc(sizeof(struct snmp_varbind));
-          LWIP_ASSERT("vb != NULL",vb != NULL);
-          if (vb != NULL)
-          {
-            vb->next = NULL;
-            vb->prev = NULL;
-
-            /* move name from invb to outvb */
-            vb->ident = msg_ps->vb_ptr->ident;
-            vb->ident_len = msg_ps->vb_ptr->ident_len;
-            /* ensure this memory is refereced once only */
-            msg_ps->vb_ptr->ident = NULL;
-            msg_ps->vb_ptr->ident_len = 0;
-
-            vb->value_type = object_def.asn_type;
-            vb->value_len = object_def.v_len;
-            if (vb->value_len > 0)
-            {
-              vb->value = mem_malloc(vb->value_len);
-              LWIP_ASSERT("vb->value != NULL",vb->value != NULL);
-              if (vb->value != NULL)
-              {
-                mn->get_value(&object_def, vb->value_len, vb->value);
-                snmp_varbind_tail_add(&msg_ps->outvb, vb);
-                msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-                msg_ps->vb_idx += 1;
-              }
-              else
-              {
-                LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: couldn't allocate variable space\n"));
-                msg_ps->vb_ptr->ident = vb->ident;
-                msg_ps->vb_ptr->ident_len = vb->ident_len;
-                mem_free(vb);
-                snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
-              }
-            }
-            else
-            {
-              /* vb->value_len == 0, empty value (e.g. empty string) */
-              vb->value = NULL;
-              snmp_varbind_tail_add(&msg_ps->outvb, vb);
-              msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-              msg_ps->vb_idx += 1;
-            }
-          }
-          else
-          {
-            LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: couldn't allocate outvb space\n"));
-            snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
-          }
-        }
-      }
-    }
-    if (mn == NULL)
-    {
-      /* mn == NULL, noSuchName */
-      snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
-    }
-  }
-  if ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
-      (msg_ps->vb_idx == msg_ps->invb.count))
-  {
-    snmp_ok_response(msg_ps);
-  }
-}
-
-/**
- * Service an internal or external event for SNMP GETNEXT.
- *
- * @param request_id identifies requests from 0 to (SNMP_CONCURRENT_REQUESTS-1)
- * @param msg_ps points to the assosicated message process state
- */
-static void
-snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
-{
-  LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_getnext_event: msg_ps->state==%"U16_F"\n",(u16_t)msg_ps->state));
-
-  if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF)
-  {
-    struct mib_external_node *en;
-
-    /* get_object_def() answer*/
-    en = msg_ps->ext_mib_node;
-
-    /* translate answer into a known lifeform */
-    en->get_object_def_a(request_id, 1, &msg_ps->ext_oid.id[msg_ps->ext_oid.len - 1], &msg_ps->ext_object_def);
-    if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
-    {
-      msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE;
-      en->get_value_q(request_id, &msg_ps->ext_object_def);
-    }
-    else
-    {
-      en->get_object_def_pc(request_id, 1, &msg_ps->ext_oid.id[msg_ps->ext_oid.len - 1]);
-      /* search failed, object id points to unknown object (nosuchname) */
-      snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
-    }
-  }
-  else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_VALUE)
-  {
-    struct mib_external_node *en;
-    struct snmp_varbind *vb;
-
-    /* get_value() answer */
-    en = msg_ps->ext_mib_node;
-
-    vb = snmp_varbind_alloc(&msg_ps->ext_oid,
-                            msg_ps->ext_object_def.asn_type,
-                            msg_ps->ext_object_def.v_len);
-    if (vb != NULL)
-    {
-      en->get_value_a(request_id, &msg_ps->ext_object_def, vb->value_len, vb->value);
-      snmp_varbind_tail_add(&msg_ps->outvb, vb);
-      msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-      msg_ps->vb_idx += 1;
-    }
-    else
-    {
-      en->get_value_pc(request_id, &msg_ps->ext_object_def);
-      LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_getnext_event: couldn't allocate outvb space\n"));
-      snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
-    }
-  }
-
-  while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
-         (msg_ps->vb_idx < msg_ps->invb.count))
-  {
-    struct mib_node *mn;
-    struct snmp_obj_id oid;
-
-    if (msg_ps->vb_idx == 0)
-    {
-      msg_ps->vb_ptr = msg_ps->invb.head;
-    }
-    else
-    {
-      msg_ps->vb_ptr = msg_ps->vb_ptr->next;
-    }
-    if (snmp_iso_prefix_expand(msg_ps->vb_ptr->ident_len, msg_ps->vb_ptr->ident, &oid))
-    {
-      if (msg_ps->vb_ptr->ident_len > 3)
-      {
-        /* can offset ident_len and ident */
-        mn = snmp_expand_tree((struct mib_node*)&internet,
-                              msg_ps->vb_ptr->ident_len - 4,
-                              msg_ps->vb_ptr->ident + 4, &oid);
-      }
-      else
-      {
-        /* can't offset ident_len -4, ident + 4 */
-        mn = snmp_expand_tree((struct mib_node*)&internet, 0, NULL, &oid);
-      }
-    }
-    else
-    {
-      mn = NULL;
-    }
-    if (mn != NULL)
-    {
-      if (mn->node_type == MIB_NODE_EX)
-      {
-        /* external object */
-        struct mib_external_node *en = (struct mib_external_node*)mn;
-
-        msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
-        /* save en && args in msg_ps!! */
-        msg_ps->ext_mib_node = en;
-        msg_ps->ext_oid = oid;
-
-        en->get_object_def_q(en->addr_inf, request_id, 1, &oid.id[oid.len - 1]);
-      }
-      else
-      {
-        /* internal object */
-        struct obj_def object_def;
-        struct snmp_varbind *vb;
-
-        msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF;
-        mn->get_object_def(1, &oid.id[oid.len - 1], &object_def);
-
-        vb = snmp_varbind_alloc(&oid, object_def.asn_type, object_def.v_len);
-        if (vb != NULL)
-        {
-          msg_ps->state = SNMP_MSG_INTERNAL_GET_VALUE;
-          mn->get_value(&object_def, object_def.v_len, vb->value);
-          snmp_varbind_tail_add(&msg_ps->outvb, vb);
-          msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-          msg_ps->vb_idx += 1;
-        }
-        else
-        {
-          LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_recv couldn't allocate outvb space\n"));
-          snmp_error_response(msg_ps,SNMP_ES_TOOBIG);
-        }
-      }
-    }
-    if (mn == NULL)
-    {
-      /* mn == NULL, noSuchName */
-      snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
-    }
-  }
-  if ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
-      (msg_ps->vb_idx == msg_ps->invb.count))
-  {
-    snmp_ok_response(msg_ps);
-  }
-}
-
-/**
- * Service an internal or external event for SNMP SET.
- *
- * @param request_id identifies requests from 0 to (SNMP_CONCURRENT_REQUESTS-1)
- * @param msg_ps points to the assosicated message process state
- */
-static void
-snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps)
-{
-  LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_set_event: msg_ps->state==%"U16_F"\n",(u16_t)msg_ps->state));
-
-  if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF)
-  {
-    struct mib_external_node *en;
-    struct snmp_name_ptr np;
-
-    /* get_object_def() answer*/
-    en = msg_ps->ext_mib_node;
-    np = msg_ps->ext_name_ptr;
-
-    /* translate answer into a known lifeform */
-    en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
-    if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
-    {
-      msg_ps->state = SNMP_MSG_EXTERNAL_SET_TEST;
-      en->set_test_q(request_id, &msg_ps->ext_object_def);
-    }
-    else
-    {
-      en->get_object_def_pc(request_id, np.ident_len, np.ident);
-      /* search failed, object id points to unknown object (nosuchname) */
-      snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
-    }
-  }
-  else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_TEST)
-  {
-    struct mib_external_node *en;
-    struct snmp_name_ptr np;
-
-    /* set_test() answer*/
-    en = msg_ps->ext_mib_node;
-    np = msg_ps->ext_name_ptr;
-
-    if (msg_ps->ext_object_def.access == MIB_OBJECT_READ_WRITE)
-    {
-       if ((msg_ps->ext_object_def.asn_type == msg_ps->vb_ptr->value_type) &&
-           (en->set_test_a(request_id,&msg_ps->ext_object_def,
-                           msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value) != 0))
-      {
-        msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-        msg_ps->vb_idx += 1;
-      }
-      else
-      {
-        en->set_test_pc(request_id,&msg_ps->ext_object_def);
-        /* bad value */
-        snmp_error_response(msg_ps,SNMP_ES_BADVALUE);
-      }
-    }
-    else
-    {
-      en->set_test_pc(request_id,&msg_ps->ext_object_def);
-      /* object not available for set */
-      snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
-    }
-  }
-  else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF_S)
-  {
-    struct mib_external_node *en;
-    struct snmp_name_ptr np;
-
-    /* get_object_def() answer*/
-    en = msg_ps->ext_mib_node;
-    np = msg_ps->ext_name_ptr;
-
-    /* translate answer into a known lifeform */
-    en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def);
-    if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE)
-    {
-      msg_ps->state = SNMP_MSG_EXTERNAL_SET_VALUE;
-      en->set_value_q(request_id, &msg_ps->ext_object_def,
-                      msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value);
-    }
-    else
-    {
-      en->get_object_def_pc(request_id, np.ident_len, np.ident);
-      /* set_value failed, object has disappeared for some odd reason?? */
-      snmp_error_response(msg_ps,SNMP_ES_GENERROR);
-    }
-  }
-  else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_VALUE)
-  {
-    struct mib_external_node *en;
-
-    /** set_value_a() @todo: use reply value?? */
-    en = msg_ps->ext_mib_node;
-    en->set_value_a(request_id, &msg_ps->ext_object_def, 0, NULL);
-
-    /** @todo use set_value_pc() if toobig */
-    msg_ps->state = SNMP_MSG_INTERNAL_SET_VALUE;
-    msg_ps->vb_idx += 1;
-  }
-
-  /* test all values before setting */
-  while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
-         (msg_ps->vb_idx < msg_ps->invb.count))
-  {
-    struct mib_node *mn;
-    struct snmp_name_ptr np;
-
-    if (msg_ps->vb_idx == 0)
-    {
-      msg_ps->vb_ptr = msg_ps->invb.head;
-    }
-    else
-    {
-      msg_ps->vb_ptr = msg_ps->vb_ptr->next;
-    }
-    /** test object identifier for .iso.org.dod.internet prefix */
-    if (snmp_iso_prefix_tst(msg_ps->vb_ptr->ident_len,  msg_ps->vb_ptr->ident))
-    {
-      mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4,
-                             msg_ps->vb_ptr->ident + 4, &np);
-    }
-    else
-    {
-      mn = NULL;
-    }
-    if (mn != NULL)
-    {
-      if (mn->node_type == MIB_NODE_EX)
-      {
-        /* external object */
-        struct mib_external_node *en = (struct mib_external_node*)mn;
-
-        msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF;
-        /* save en && args in msg_ps!! */
-        msg_ps->ext_mib_node = en;
-        msg_ps->ext_name_ptr = np;
-
-        en->get_object_def_q(en->addr_inf, request_id, np.ident_len, np.ident);
-      }
-      else
-      {
-        /* internal object */
-        struct obj_def object_def;
-
-        msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF;
-        mn->get_object_def(np.ident_len, np.ident, &object_def);
-        if (object_def.instance != MIB_OBJECT_NONE)
-        {
-          mn = mn;
-        }
-        else
-        {
-          /* search failed, object id points to unknown object (nosuchname) */
-          mn = NULL;
-        }
-        if (mn != NULL)
-        {
-          msg_ps->state = SNMP_MSG_INTERNAL_SET_TEST;
-
-          if (object_def.access == MIB_OBJECT_READ_WRITE)
-          {
-            if ((object_def.asn_type == msg_ps->vb_ptr->value_type) &&
-                (mn->set_test(&object_def,msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value) != 0))
-            {
-              msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-              msg_ps->vb_idx += 1;
-            }
-            else
-            {
-              /* bad value */
-              snmp_error_response(msg_ps,SNMP_ES_BADVALUE);
-            }
-          }
-          else
-          {
-            /* object not available for set */
-            snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
-          }
-        }
-      }
-    }
-    if (mn == NULL)
-    {
-      /* mn == NULL, noSuchName */
-      snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME);
-    }
-  }
-
-  if ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) &&
-      (msg_ps->vb_idx == msg_ps->invb.count))
-  {
-    msg_ps->vb_idx = 0;
-    msg_ps->state = SNMP_MSG_INTERNAL_SET_VALUE;
-  }
-
-  /* set all values "atomically" (be as "atomic" as possible) */
-  while ((msg_ps->state == SNMP_MSG_INTERNAL_SET_VALUE) &&
-         (msg_ps->vb_idx < msg_ps->invb.count))
-  {
-    struct mib_node *mn;
-    struct snmp_name_ptr np;
-
-    if (msg_ps->vb_idx == 0)
-    {
-      msg_ps->vb_ptr = msg_ps->invb.head;
-    }
-    else
-    {
-      msg_ps->vb_ptr = msg_ps->vb_ptr->next;
-    }
-    /* skip iso prefix test, was done previously while settesting() */
-    mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4,
-                           msg_ps->vb_ptr->ident + 4, &np);
-    /* check if object is still available
-       (e.g. external hot-plug thingy present?) */
-    if (mn != NULL)
-    {
-      if (mn->node_type == MIB_NODE_EX)
-      {
-        /* external object */
-        struct mib_external_node *en = (struct mib_external_node*)mn;
-
-        msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF_S;
-        /* save en && args in msg_ps!! */
-        msg_ps->ext_mib_node = en;
-        msg_ps->ext_name_ptr = np;
-
-        en->get_object_def_q(en->addr_inf, request_id, np.ident_len, np.ident);
-      }
-      else
-      {
-        /* internal object */
-        struct obj_def object_def;
-
-        msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF_S;
-        mn->get_object_def(np.ident_len, np.ident, &object_def);
-        msg_ps->state = SNMP_MSG_INTERNAL_SET_VALUE;
-        mn->set_value(&object_def,msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value);
-        msg_ps->vb_idx += 1;
-      }
-    }
-  }
-  if ((msg_ps->state == SNMP_MSG_INTERNAL_SET_VALUE) &&
-      (msg_ps->vb_idx == msg_ps->invb.count))
-  {
-    /* simply echo the input if we can set it
-       @todo do we need to return the actual value?
-       e.g. if value is silently modified or behaves sticky? */
-    msg_ps->outvb = msg_ps->invb;
-    msg_ps->invb.head = NULL;
-    msg_ps->invb.tail = NULL;
-    msg_ps->invb.count = 0;
-    snmp_ok_response(msg_ps);
-  }
-}
-
-
-/**
- * Handle one internal or external event.
- * Called for one async event. (recv external/private answer)
- *
- * @param request_id identifies requests from 0 to (SNMP_CONCURRENT_REQUESTS-1)
- */
-void
-snmp_msg_event(u8_t request_id)
-{
-  struct snmp_msg_pstat *msg_ps;
-
-  if (request_id < SNMP_CONCURRENT_REQUESTS)
-  {
-    msg_ps = &msg_input_list[request_id];
-    if (msg_ps->rt == SNMP_ASN1_PDU_GET_NEXT_REQ)
-    {
-      snmp_msg_getnext_event(request_id, msg_ps);
-    }
-    else if (msg_ps->rt == SNMP_ASN1_PDU_GET_REQ)
-    {
-      snmp_msg_get_event(request_id, msg_ps);
-    }
-    else if(msg_ps->rt == SNMP_ASN1_PDU_SET_REQ)
-    {
-      snmp_msg_set_event(request_id, msg_ps);
-    }
-  }
-}
-
-
-/* lwIP UDP receive callback function */
-static void
-snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
-{
-  struct udp_hdr *udphdr;
-
-  /* suppress unused argument warning */
-  if (arg);
-  /* peek in the UDP header (goto IP payload) */
-  pbuf_header(p, UDP_HLEN);
-  udphdr = p->payload;
-
-  /* check if datagram is really directed at us (including broadcast requests) */
-  if ((pcb == snmp1_pcb) && (ntohs(udphdr->dest) == 161))
-  {
-    struct snmp_msg_pstat *msg_ps;
-    u8_t req_idx;
-
-    /* traverse input message process list, look for SNMP_MSG_EMPTY */
-    msg_ps = &msg_input_list[0];
-    req_idx = 0;
-    while ((req_idx<SNMP_CONCURRENT_REQUESTS) && (msg_ps->state != SNMP_MSG_EMPTY))
-    {
-      req_idx++;
-      msg_ps++;
-    }
-    if (req_idx != SNMP_CONCURRENT_REQUESTS)
-    {
-      err_t err_ret;
-      u16_t payload_len;
-      u16_t payload_ofs;
-      u16_t varbind_ofs = 0;
-
-      /* accepting request */
-      snmp_inc_snmpinpkts();
-      /* record used 'protocol control block' */
-      msg_ps->pcb = pcb;
-      /* source address (network order) */
-      msg_ps->sip = *addr;
-      /* source port (host order (lwIP oddity)) */
-      msg_ps->sp = port;
-      /* read UDP payload length from UDP header */
-      payload_len = ntohs(udphdr->len) - UDP_HLEN;
-
-      /* adjust to UDP payload */
-      payload_ofs = UDP_HLEN;
-
-      /* check total length, version, community, pdu type */
-      err_ret = snmp_pdu_header_check(p, payload_ofs, payload_len, &varbind_ofs, msg_ps);
-      if (((msg_ps->rt == SNMP_ASN1_PDU_GET_REQ) ||
-           (msg_ps->rt == SNMP_ASN1_PDU_GET_NEXT_REQ) ||
-           (msg_ps->rt == SNMP_ASN1_PDU_SET_REQ)) &&
-          ((msg_ps->error_status == SNMP_ES_NOERROR) &&
-           (msg_ps->error_index == 0)) )
-      {
-        /* Only accept requests and requests without error (be robust) */
-        err_ret = err_ret;
-      }
-      else
-      {
-        /* Reject response and trap headers or error requests as input! */
-        err_ret = ERR_ARG;
-      }
-      if (err_ret == ERR_OK)
-      {
-        LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_recv ok, community %s\n", msg_ps->community));
-
-        /* Builds a list of variable bindings. Copy the varbinds from the pbuf
-          chain to glue them when these are divided over two or more pbuf's. */
-        err_ret = snmp_pdu_dec_varbindlist(p, varbind_ofs, &varbind_ofs, msg_ps);
-        if ((err_ret == ERR_OK) && (msg_ps->invb.count > 0))
-        {
-          /* we've decoded the incoming message, release input msg now */
-          pbuf_free(p);
-
-          msg_ps->error_status = SNMP_ES_NOERROR;
-          msg_ps->error_index = 0;
-          /* find object for each variable binding */
-          msg_ps->state = SNMP_MSG_SEARCH_OBJ;
-          /* first variable binding from list to inspect */
-          msg_ps->vb_idx = 0;
-
-          LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_recv varbind cnt=%"U16_F"\n",(u16_t)msg_ps->invb.count));
-
-          /* handle input event and as much objects as possible in one go */
-          snmp_msg_event(req_idx);
-        }
-        else
-        {
-          /* varbind-list decode failed, or varbind list empty.
-             drop request silently, do not return error!
-             (errors are only returned for a specific varbind failure) */
-          pbuf_free(p);
-          LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_pdu_dec_varbindlist() failed\n"));
-        }
-      }
-      else
-      {
-        /* header check failed
-           drop request silently, do not return error! */
-        pbuf_free(p);
-        LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_pdu_header_check() failed\n"));
-      }
-    }
-    else
-    {
-      /* exceeding number of concurrent requests */
-      pbuf_free(p);
-    }
-  }
-  else
-  {
-    /* datagram not for us */
-    pbuf_free(p);
-  }
-}
-
-/**
- * Checks and decodes incoming SNMP message header, logs header errors.
- *
- * @param p points to pbuf chain of SNMP message (UDP payload)
- * @param ofs points to first octet of SNMP message
- * @param pdu_len the length of the UDP payload
- * @param ofs_ret returns the ofset of the variable bindings
- * @param m_stat points to the current message request state return
- * @return
- * - ERR_OK SNMP header is sane and accepted
- * - ERR_ARG SNMP header is either malformed or rejected
- */
-static err_t
-snmp_pdu_header_check(struct pbuf *p, u16_t ofs, u16_t pdu_len, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat)
-{
-  err_t derr;
-  u16_t len, ofs_base;
-  u8_t  len_octets;
-  u8_t  type;
-  s32_t version;
-
-  ofs_base = ofs;
-  snmp_asn1_dec_type(p, ofs, &type);
-  derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-  if ((derr != ERR_OK) ||
-      (pdu_len != (1 + len_octets + len)) ||
-      (type != (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ)))
-  {
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  ofs += (1 + len_octets);
-  snmp_asn1_dec_type(p, ofs, &type);
-  derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-  if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)))
-  {
-    /* can't decode or no integer (version) */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, &version);
-  if (derr != ERR_OK)
-  {
-    /* can't decode */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  if (version != 0)
-  {
-    /* not version 1 */
-    snmp_inc_snmpinbadversions();
-    return ERR_ARG;
-  }
-  ofs += (1 + len_octets + len);
-  snmp_asn1_dec_type(p, ofs, &type);
-  derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-  if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR)))
-  {
-    /* can't decode or no octet string (community) */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  derr = snmp_asn1_dec_raw(p, ofs + 1 + len_octets, len, SNMP_COMMUNITY_STR_LEN, m_stat->community);
-  if (derr != ERR_OK)
-  {
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  /* add zero terminator */
-  len = ((len < (SNMP_COMMUNITY_STR_LEN))?(len):(SNMP_COMMUNITY_STR_LEN));
-  m_stat->community[len] = 0;
-  m_stat->com_strlen = len;
-  if (strncmp(snmp_publiccommunity, (const char*)m_stat->community, SNMP_COMMUNITY_STR_LEN) != 0)
-  {
-    /** @todo: move this if we need to check more names */
-    snmp_inc_snmpinbadcommunitynames();
-    snmp_authfail_trap();
-    return ERR_ARG;
-  }
-  ofs += (1 + len_octets + len);
-  snmp_asn1_dec_type(p, ofs, &type);
-  derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-  if (derr != ERR_OK)
-  {
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  switch(type)
-  {
-    case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_GET_REQ):
-      /* GetRequest PDU */
-      snmp_inc_snmpingetrequests();
-      derr = ERR_OK;
-      break;
-    case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_GET_NEXT_REQ):
-      /* GetNextRequest PDU */
-      snmp_inc_snmpingetnexts();
-      derr = ERR_OK;
-      break;
-    case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_GET_RESP):
-      /* GetResponse PDU */
-      snmp_inc_snmpingetresponses();
-      derr = ERR_ARG;
-      break;
-    case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_SET_REQ):
-      /* SetRequest PDU */
-      snmp_inc_snmpinsetrequests();
-      derr = ERR_OK;
-      break;
-    case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_TRAP):
-      /* Trap PDU */
-      snmp_inc_snmpintraps();
-      derr = ERR_ARG;
-      break;
-    default:
-      snmp_inc_snmpinasnparseerrs();
-      derr = ERR_ARG;
-      break;
-  }
-  if (derr != ERR_OK)
-  {
-    /* unsupported input PDU for this agent (no parse error) */
-    return ERR_ARG;
-  }
-  m_stat->rt = type & 0x1F;
-  ofs += (1 + len_octets);
-  if (len != (pdu_len - (ofs - ofs_base)))
-  {
-    /* decoded PDU length does not equal actual payload length */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  snmp_asn1_dec_type(p, ofs, &type);
-  derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-  if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)))
-  {
-    /* can't decode or no integer (request ID) */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, &m_stat->rid);
-  if (derr != ERR_OK)
-  {
-    /* can't decode */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  ofs += (1 + len_octets + len);
-  snmp_asn1_dec_type(p, ofs, &type);
-  derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-  if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)))
-  {
-    /* can't decode or no integer (error-status) */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  /* must be noError (0) for incoming requests.
-     log errors for mib-2 completeness and for debug purposes */
-  derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, &m_stat->error_status);
-  if (derr != ERR_OK)
-  {
-    /* can't decode */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  switch (m_stat->error_status)
-  {
-    case SNMP_ES_TOOBIG:
-      snmp_inc_snmpintoobigs();
-      break;
-    case SNMP_ES_NOSUCHNAME:
-      snmp_inc_snmpinnosuchnames();
-      break;
-    case SNMP_ES_BADVALUE:
-      snmp_inc_snmpinbadvalues();
-      break;
-    case SNMP_ES_READONLY:
-      snmp_inc_snmpinreadonlys();
-      break;
-    case SNMP_ES_GENERROR:
-      snmp_inc_snmpingenerrs();
-      break;
-  }
-  ofs += (1 + len_octets + len);
-  snmp_asn1_dec_type(p, ofs, &type);
-  derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-  if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)))
-  {
-    /* can't decode or no integer (error-index) */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  /* must be 0 for incoming requests.
-     decode anyway to catch bad integers (and dirty tricks) */
-  derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, &m_stat->error_index);
-  if (derr != ERR_OK)
-  {
-    /* can't decode */
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  ofs += (1 + len_octets + len);
-  *ofs_ret = ofs;
-  return ERR_OK;
-}
-
-static err_t
-snmp_pdu_dec_varbindlist(struct pbuf *p, u16_t ofs, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat)
-{
-  err_t derr;
-  u16_t len, vb_len;
-  u8_t  len_octets;
-  u8_t type;
-
-  /* variable binding list */
-  snmp_asn1_dec_type(p, ofs, &type);
-  derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &vb_len);
-  if ((derr != ERR_OK) ||
-      (type != (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ)))
-  {
-    snmp_inc_snmpinasnparseerrs();
-    return ERR_ARG;
-  }
-  ofs += (1 + len_octets);
-
-  /* start with empty list */
-  m_stat->invb.count = 0;
-  m_stat->invb.head = NULL;
-  m_stat->invb.tail = NULL;
-
-  while (vb_len > 0)
-  {
-    struct snmp_obj_id oid, oid_value;
-    struct snmp_varbind *vb;
-
-    snmp_asn1_dec_type(p, ofs, &type);
-    derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-    if ((derr != ERR_OK) ||
-        (type != (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ)) ||
-        (len <= 0) || (len > vb_len))
-    {
-      snmp_inc_snmpinasnparseerrs();
-      /* free varbinds (if available) */
-      snmp_varbind_list_free(&m_stat->invb);
-      return ERR_ARG;
-    }
-    ofs += (1 + len_octets);
-    vb_len -= (1 + len_octets);
-
-    snmp_asn1_dec_type(p, ofs, &type);
-    derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-    if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID)))
-    {
-      /* can't decode object name length */
-      snmp_inc_snmpinasnparseerrs();
-      /* free varbinds (if available) */
-      snmp_varbind_list_free(&m_stat->invb);
-      return ERR_ARG;
-    }
-    derr = snmp_asn1_dec_oid(p, ofs + 1 + len_octets, len, &oid);
-    if (derr != ERR_OK)
-    {
-      /* can't decode object name */
-      snmp_inc_snmpinasnparseerrs();
-      /* free varbinds (if available) */
-      snmp_varbind_list_free(&m_stat->invb);
-      return ERR_ARG;
-    }
-    ofs += (1 + len_octets + len);
-    vb_len -= (1 + len_octets + len);
-
-    snmp_asn1_dec_type(p, ofs, &type);
-    derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len);
-    if (derr != ERR_OK)
-    {
-      /* can't decode object value length */
-      snmp_inc_snmpinasnparseerrs();
-      /* free varbinds (if available) */
-      snmp_varbind_list_free(&m_stat->invb);
-      return ERR_ARG;
-    }
-
-    switch (type)
-    {
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG):
-        vb = snmp_varbind_alloc(&oid, type, sizeof(s32_t));
-        if (vb != NULL)
-        {
-          s32_t *vptr = vb->value;
-
-          derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, vptr);
-          snmp_varbind_tail_add(&m_stat->invb, vb);
-        }
-        else
-        {
-          derr = ERR_ARG;
-        }
-        break;
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS):
-        vb = snmp_varbind_alloc(&oid, type, sizeof(u32_t));
-        if (vb != NULL)
-        {
-          u32_t *vptr = vb->value;
-
-          derr = snmp_asn1_dec_u32t(p, ofs + 1 + len_octets, len, vptr);
-          snmp_varbind_tail_add(&m_stat->invb, vb);
-        }
-        else
-        {
-          derr = ERR_ARG;
-        }
-        break;
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_OPAQUE):
-        vb = snmp_varbind_alloc(&oid, type, len);
-        if (vb != NULL)
-        {
-          derr = snmp_asn1_dec_raw(p, ofs + 1 + len_octets, len, vb->value_len, vb->value);
-          snmp_varbind_tail_add(&m_stat->invb, vb);
-        }
-        else
-        {
-          derr = ERR_ARG;
-        }
-        break;
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_NUL):
-        vb = snmp_varbind_alloc(&oid, type, 0);
-        if (vb != NULL)
-        {
-          snmp_varbind_tail_add(&m_stat->invb, vb);
-          derr = ERR_OK;
-        }
-        else
-        {
-          derr = ERR_ARG;
-        }
-        break;
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID):
-        derr = snmp_asn1_dec_oid(p, ofs + 1 + len_octets, len, &oid_value);
-        if (derr == ERR_OK)
-        {
-          vb = snmp_varbind_alloc(&oid, type, oid_value.len * sizeof(s32_t));
-          if (vb != NULL)
-          {
-            u8_t i = oid_value.len;
-            s32_t *vptr = vb->value;
-
-            while(i > 0)
-            {
-              i--;
-              vptr[i] = oid_value.id[i];
-            }
-            snmp_varbind_tail_add(&m_stat->invb, vb);
-            derr = ERR_OK;
-          }
-          else
-          {
-            derr = ERR_ARG;
-          }
-        }
-        break;
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR):
-        if (len == 4)
-        {
-          /* must be exactly 4 octets! */
-          vb = snmp_varbind_alloc(&oid, type, 4);
-          if (vb != NULL)
-          {
-            derr = snmp_asn1_dec_raw(p, ofs + 1 + len_octets, len, vb->value_len, vb->value);
-            snmp_varbind_tail_add(&m_stat->invb, vb);
-          }
-          else
-          {
-            derr = ERR_ARG;
-          }
-        }
-        else
-        {
-          derr = ERR_ARG;
-        }
-        break;
-      default:
-        derr = ERR_ARG;
-        break;
-    }
-    if (derr != ERR_OK)
-    {
-      snmp_inc_snmpinasnparseerrs();
-      /* free varbinds (if available) */
-      snmp_varbind_list_free(&m_stat->invb);
-      return ERR_ARG;
-    }
-    ofs += (1 + len_octets + len);
-    vb_len -= (1 + len_octets + len);
-  }
-
-  if (m_stat->rt == SNMP_ASN1_PDU_SET_REQ)
-  {
-    snmp_add_snmpintotalsetvars(m_stat->invb.count);
-  }
-  else
-  {
-    snmp_add_snmpintotalreqvars(m_stat->invb.count);
-  }
-
-  *ofs_ret = ofs;
-  return ERR_OK;
-}
-
-struct snmp_varbind*
-snmp_varbind_alloc(struct snmp_obj_id *oid, u8_t type, u8_t len)
-{
-  struct snmp_varbind *vb;
-
-  vb = (struct snmp_varbind *)mem_malloc(sizeof(struct snmp_varbind));
-  LWIP_ASSERT("vb != NULL",vb != NULL);
-  if (vb != NULL)
-  {
-    u8_t i;
-
-    vb->next = NULL;
-    vb->prev = NULL;
-    i = oid->len;
-    vb->ident_len = i;
-    if (i > 0)
-    {
-      /* allocate array of s32_t for our object identifier */
-      vb->ident = (s32_t*)mem_malloc(sizeof(s32_t) * i);
-      LWIP_ASSERT("vb->ident != NULL",vb->ident != NULL);
-      if (vb->ident == NULL)
-      {
-        mem_free(vb);
-        return NULL;
-      }
-      while(i > 0)
-      {
-        i--;
-        vb->ident[i] = oid->id[i];
-      }
-    }
-    else
-    {
-      /* i == 0, pass zero length object identifier */
-      vb->ident = NULL;
-    }
-    vb->value_type = type;
-    vb->value_len = len;
-    if (len > 0)
-    {
-      /* allocate raw bytes for our object value */
-      vb->value = mem_malloc(len);
-      LWIP_ASSERT("vb->value != NULL",vb->value != NULL);
-      if (vb->value == NULL)
-      {
-        if (vb->ident != NULL)
-        {
-          mem_free(vb->ident);
-        }
-        mem_free(vb);
-        return NULL;
-      }
-    }
-    else
-    {
-      /* ASN1_NUL type, or zero length ASN1_OC_STR */
-      vb->value = NULL;
-    }
-  }
-  return vb;
-}
-
-void
-snmp_varbind_free(struct snmp_varbind *vb)
-{
-  if (vb->value != NULL )
-  {
-    mem_free(vb->value);
-  }
-  if (vb->ident != NULL )
-  {
-    mem_free(vb->ident);
-  }
-  mem_free(vb);
-}
-
-void
-snmp_varbind_list_free(struct snmp_varbind_root *root)
-{
-  struct snmp_varbind *vb, *prev;
-
-  vb = root->tail;
-  while ( vb != NULL )
-  {
-    prev = vb->prev;
-    snmp_varbind_free(vb);
-    vb = prev;
-  }
-  root->count = 0;
-  root->head = NULL;
-  root->tail = NULL;
-}
-
-void
-snmp_varbind_tail_add(struct snmp_varbind_root *root, struct snmp_varbind *vb)
-{
-  if (root->count == 0)
-  {
-    /* add first varbind to list */
-    root->head = vb;
-    root->tail = vb;
-  }
-  else
-  {
-    /* add nth varbind to list tail */
-    root->tail->next = vb;
-    vb->prev = root->tail;
-    root->tail = vb;
-  }
-  root->count += 1;
-}
-
-struct snmp_varbind*
-snmp_varbind_tail_remove(struct snmp_varbind_root *root)
-{
-  struct snmp_varbind* vb;
-
-  if (root->count > 0)
-  {
-    /* remove tail varbind */
-    vb = root->tail;
-    root->tail = vb->prev;
-    vb->prev->next = NULL;
-    root->count -= 1;
-  }
-  else
-  {
-    /* nothing to remove */
-    vb = NULL;
-  }
-  return vb;
-}
-
-#endif /* LWIP_SNMP */
diff --git a/src/VBox/Devices/Network/lwip/src/core/snmp/msg_out.c b/src/VBox/Devices/Network/lwip/src/core/snmp/msg_out.c
deleted file mode 100644
index c8961c9..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/snmp/msg_out.c
+++ /dev/null
@@ -1,687 +0,0 @@
-/**
- * @file
- * SNMP output message processing (RFC1157).
- *
- * Output responses and traps are build in two passes:
- *
- * Pass 0: iterate over the output message backwards to determine encoding lengths
- * Pass 1: the actual forward encoding of internal form into ASN1
- *
- * The single-pass encoding method described by Comer & Stevens
- * requires extra buffer space and copying for reversal of the packet.
- * The buffer requirement can be prohibitively large for big payloads
- * (>= 484) therefore we use the two encoding passes.
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#include "lwip/opt.h"
-
-#if LWIP_SNMP
-#include "arch/cc.h"
-#include "lwip/udp.h"
-#include "lwip/netif.h"
-
-#include "lwip/snmp.h"
-#include "lwip/snmp_asn1.h"
-#include "lwip/snmp_msg.h"
-
-struct snmp_trap_dst
-{
-  /* destination IP address in network order */
-  struct ip_addr dip;
-  /* set to 0 when disabled, >0 when enabled */
-  u8_t enable;
-};
-#if (SNMP_TRAP_DESTINATIONS == 0)
-#error "need at least one trap destination"
-#endif
-struct snmp_trap_dst trap_dst[SNMP_TRAP_DESTINATIONS];
-
-/** TRAP message structure */
-struct snmp_msg_trap trap_msg;
-
-static u16_t snmp_resp_header_sum(struct snmp_msg_pstat *m_stat, u16_t vb_len);
-static u16_t snmp_trap_header_sum(struct snmp_msg_trap *m_trap, u16_t vb_len);
-static u16_t snmp_varbind_list_sum(struct snmp_varbind_root *root);
-
-static u16_t snmp_resp_header_enc(struct snmp_msg_pstat *m_stat, struct pbuf *p);
-static u16_t snmp_trap_header_enc(struct snmp_msg_trap *m_trap, struct pbuf *p);
-static u16_t snmp_varbind_list_enc(struct snmp_varbind_root *root, struct pbuf *p, u16_t ofs);
-
-/**
- * Sets enable switch for this trap destination.
- * @param dst_idx index in 0 .. SNMP_TRAP_DESTINATIONS-1
- * @param enable switch if 0 destination is disabled >0 enabled.
- */
-void
-snmp_trap_dst_enable(u8_t dst_idx, u8_t enable)
-{
-  if (dst_idx < SNMP_TRAP_DESTINATIONS)
-  {
-    trap_dst[dst_idx].enable = enable;
-  }
-}
-
-/**
- * Sets IPv4 address for this trap destination.
- * @param dst_idx index in 0 .. SNMP_TRAP_DESTINATIONS-1
- * @param dst IPv4 address in host order.
- */
-void
-snmp_trap_dst_ip_set(u8_t dst_idx, struct ip_addr *dst)
-{
-  if (dst_idx < SNMP_TRAP_DESTINATIONS)
-  {
-    trap_dst[dst_idx].dip.addr = htonl(dst->addr);
-  }
-}
-
-/**
- * Sends a 'getresponse' message to the request originator.
- *
- * @param m_stat points to the current message request state source
- * @return ERR_OK when success, ERR_MEM if we're out of memory
- *
- * @note the caller is responsible for filling in outvb in the m_stat
- * and provide error-status and index (except for tooBig errors) ...
- */
-err_t
-snmp_send_response(struct snmp_msg_pstat *m_stat)
-{
-  struct snmp_varbind_root emptyvb = {NULL, NULL, 0, 0, 0};
-  struct pbuf *p;
-  u16_t tot_len;
-  err_t err;
-
-  /* pass 0, calculate length fields */
-  tot_len = snmp_varbind_list_sum(&m_stat->outvb);
-  tot_len = snmp_resp_header_sum(m_stat, tot_len);
-
-  /* try allocating pbuf(s) for complete response */
-  p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL);
-  if (p == NULL)
-  {
-    LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_snd_response() tooBig\n"));
-
-    /* can't construct reply, return error-status tooBig */
-    m_stat->error_status = SNMP_ES_TOOBIG;
-    m_stat->error_index = 0;
-    /* pass 0, recalculate lengths, for empty varbind-list */
-    tot_len = snmp_varbind_list_sum(&emptyvb);
-    tot_len = snmp_resp_header_sum(m_stat, tot_len);
-    /* retry allocation once for header and empty varbind-list */
-    p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL);
-  }
-  if (p != NULL)
-  {
-    /* first pbuf alloc try or retry alloc success */
-    u16_t ofs;
-
-    LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_snd_response() p != NULL\n"));
-
-    /* pass 1, size error, encode packet ino the pbuf(s) */
-    ofs = snmp_resp_header_enc(m_stat, p);
-    if (m_stat->error_status == SNMP_ES_TOOBIG)
-    {
-      snmp_varbind_list_enc(&emptyvb, p, ofs);
-    }
-    else
-    {
-      snmp_varbind_list_enc(&m_stat->outvb, p, ofs);
-    }
-
-    switch (m_stat->error_status)
-    {
-      case SNMP_ES_TOOBIG:
-        snmp_inc_snmpouttoobigs();
-        break;
-      case SNMP_ES_NOSUCHNAME:
-        snmp_inc_snmpoutnosuchnames();
-        break;
-      case SNMP_ES_BADVALUE:
-        snmp_inc_snmpoutbadvalues();
-        break;
-      case SNMP_ES_GENERROR:
-        snmp_inc_snmpoutgenerrs();
-        break;
-    }
-    snmp_inc_snmpoutgetresponses();
-    snmp_inc_snmpoutpkts();
-
-    /** @todo do we need separate rx and tx pcbs for threaded case? */
-    /** connect to the originating source */
-    udp_connect(m_stat->pcb, &m_stat->sip, m_stat->sp);
-    err = udp_send(m_stat->pcb, p);
-    if (err == ERR_MEM)
-    {
-      /** @todo release some memory, retry and return tooBig? tooMuchHassle? */
-      err = ERR_MEM;
-    }
-    else
-    {
-      err = ERR_OK;
-    }
-    /** disassociate remote address and port with this pcb */
-    udp_disconnect(m_stat->pcb);
-
-    pbuf_free(p);
-    LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_snd_response() done\n"));
-    return err;
-  }
-  else
-  {
-    /* first pbuf alloc try or retry alloc failed
-       very low on memory, couldn't return tooBig */
-    return ERR_MEM;
-  }
-}
-
-
-/**
- * Sends an generic or enterprise specific trap message.
- *
- * @param generic_trap is the trap code
- * @param eoid points to enterprise object identifier
- * @param specific_trap used for enterprise traps when generic_trap == 6
- * @return ERR_OK when success, ERR_MEM if we're out of memory
- *
- * @note the caller is responsible for filling in outvb in the trap_msg
- * @note the use of the enterpise identifier field
- * is per RFC1215.
- * Use .iso.org.dod.internet.mgmt.mib-2.snmp for generic traps
- * and .iso.org.dod.internet.private.enterprises.yourenterprise
- * (sysObjectID) for specific traps.
- */
-err_t
-snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap)
-{
-  struct snmp_trap_dst *td;
-  struct netif *dst_if;
-  struct ip_addr dst_ip;
-  struct pbuf *p;
-  u16_t i,tot_len;
-
-  for (i=0, td = &trap_dst[0]; i<SNMP_TRAP_DESTINATIONS; i++, td++)
-  {
-    if ((td->enable != 0) && (td->dip.addr != 0))
-    {
-      /* network order trap destination */
-      trap_msg.dip.addr = td->dip.addr;
-      /* lookup current source address for this dst */
-      dst_if = ip_route(&td->dip);
-      dst_ip.addr = ntohl(dst_if->ip_addr.addr);
-      trap_msg.sip_raw[0] = dst_ip.addr >> 24;
-      trap_msg.sip_raw[1] = dst_ip.addr >> 16;
-      trap_msg.sip_raw[2] = dst_ip.addr >> 8;
-      trap_msg.sip_raw[3] = dst_ip.addr;
-      trap_msg.gen_trap = generic_trap;
-      trap_msg.spc_trap = specific_trap;
-      if (generic_trap == SNMP_GENTRAP_ENTERPRISESPC)
-      {
-        /* enterprise-Specific trap */
-        trap_msg.enterprise = eoid;
-      }
-      else
-      {
-        /* generic (MIB-II) trap */
-        snmp_get_snmpgrpid_ptr(&trap_msg.enterprise);
-      }
-      snmp_get_sysuptime(&trap_msg.ts);
-
-      /* pass 0, calculate length fields */
-      tot_len = snmp_varbind_list_sum(&trap_msg.outvb);
-      tot_len = snmp_trap_header_sum(&trap_msg, tot_len);
-
-      /* allocate pbuf(s) */
-      p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL);
-      if (p != NULL)
-      {
-        u16_t ofs;
-
-        /* pass 1, encode packet ino the pbuf(s) */
-        ofs = snmp_trap_header_enc(&trap_msg, p);
-        snmp_varbind_list_enc(&trap_msg.outvb, p, ofs);
-
-        snmp_inc_snmpouttraps();
-        snmp_inc_snmpoutpkts();
-
-        /** connect to the TRAP destination */
-        udp_connect(trap_msg.pcb, &trap_msg.dip, SNMP_TRAP_PORT);
-        udp_send(trap_msg.pcb, p);
-        /** disassociate remote address and port with this pcb */
-        udp_disconnect(trap_msg.pcb);
-
-        pbuf_free(p);
-      }
-      else
-      {
-        return ERR_MEM;
-      }
-    }
-  }
-  return ERR_OK;
-}
-
-void
-snmp_coldstart_trap(void)
-{
-  trap_msg.outvb.head = NULL;
-  trap_msg.outvb.tail = NULL;
-  trap_msg.outvb.count = 0;
-  snmp_send_trap(SNMP_GENTRAP_COLDSTART, NULL, 0);
-}
-
-void
-snmp_authfail_trap(void)
-{
-  u8_t enable;
-  snmp_get_snmpenableauthentraps(&enable);
-  if (enable == 1)
-  {
-    trap_msg.outvb.head = NULL;
-    trap_msg.outvb.tail = NULL;
-    trap_msg.outvb.count = 0;
-    snmp_send_trap(SNMP_GENTRAP_AUTHFAIL, NULL, 0);
-  }
-}
-
-/**
- * Sums response header field lengths from tail to head and
- * returns resp_header_lengths for second encoding pass.
- *
- * @param vb_len varbind-list length
- * @param rhl points to returned header lengths
- * @return the required lenght for encoding the response header
- */
-static u16_t
-snmp_resp_header_sum(struct snmp_msg_pstat *m_stat, u16_t vb_len)
-{
-  u16_t tot_len;
-  struct snmp_resp_header_lengths *rhl;
-
-  rhl = &m_stat->rhl;
-  tot_len = vb_len;
-  snmp_asn1_enc_s32t_cnt(m_stat->error_index, &rhl->erridxlen);
-  snmp_asn1_enc_length_cnt(rhl->erridxlen, &rhl->erridxlenlen);
-  tot_len += 1 + rhl->erridxlenlen + rhl->erridxlen;
-
-  snmp_asn1_enc_s32t_cnt(m_stat->error_status, &rhl->errstatlen);
-  snmp_asn1_enc_length_cnt(rhl->errstatlen, &rhl->errstatlenlen);
-  tot_len += 1 + rhl->errstatlenlen + rhl->errstatlen;
-
-  snmp_asn1_enc_s32t_cnt(m_stat->rid, &rhl->ridlen);
-  snmp_asn1_enc_length_cnt(rhl->ridlen, &rhl->ridlenlen);
-  tot_len += 1 + rhl->ridlenlen + rhl->ridlen;
-
-  rhl->pdulen = tot_len;
-  snmp_asn1_enc_length_cnt(rhl->pdulen, &rhl->pdulenlen);
-  tot_len += 1 + rhl->pdulenlen;
-
-  rhl->comlen = m_stat->com_strlen;
-  snmp_asn1_enc_length_cnt(rhl->comlen, &rhl->comlenlen);
-  tot_len += 1 + rhl->comlenlen + rhl->comlen;
-
-  snmp_asn1_enc_s32t_cnt(snmp_version, &rhl->verlen);
-  snmp_asn1_enc_length_cnt(rhl->verlen, &rhl->verlenlen);
-  tot_len += 1 + rhl->verlen + rhl->verlenlen;
-
-  rhl->seqlen = tot_len;
-  snmp_asn1_enc_length_cnt(rhl->seqlen, &rhl->seqlenlen);
-  tot_len += 1 + rhl->seqlenlen;
-
-  return tot_len;
-}
-
-/**
- * Sums trap header field lengths from tail to head and
- * returns trap_header_lengths for second encoding pass.
- *
- * @param vb_len varbind-list length
- * @param thl points to returned header lengths
- * @return the required lenght for encoding the trap header
- */
-static u16_t
-snmp_trap_header_sum(struct snmp_msg_trap *m_trap, u16_t vb_len)
-{
-  u16_t tot_len;
-  struct snmp_trap_header_lengths *thl;
-
-  thl = &m_trap->thl;
-  tot_len = vb_len;
-
-  snmp_asn1_enc_u32t_cnt(m_trap->ts, &thl->tslen);
-  snmp_asn1_enc_length_cnt(thl->tslen, &thl->tslenlen);
-  tot_len += 1 + thl->tslen + thl->tslenlen;
-
-  snmp_asn1_enc_s32t_cnt(m_trap->spc_trap, &thl->strplen);
-  snmp_asn1_enc_length_cnt(thl->strplen, &thl->strplenlen);
-  tot_len += 1 + thl->strplen + thl->strplenlen;
-
-  snmp_asn1_enc_s32t_cnt(m_trap->gen_trap, &thl->gtrplen);
-  snmp_asn1_enc_length_cnt(thl->gtrplen, &thl->gtrplenlen);
-  tot_len += 1 + thl->gtrplen + thl->gtrplenlen;
-
-  thl->aaddrlen = 4;
-  snmp_asn1_enc_length_cnt(thl->aaddrlen, &thl->aaddrlenlen);
-  tot_len += 1 + thl->aaddrlen + thl->aaddrlenlen;
-
-  snmp_asn1_enc_oid_cnt(m_trap->enterprise->len, &m_trap->enterprise->id[0], &thl->eidlen);
-  snmp_asn1_enc_length_cnt(thl->eidlen, &thl->eidlenlen);
-  tot_len += 1 + thl->eidlen + thl->eidlenlen;
-
-  thl->pdulen = tot_len;
-  snmp_asn1_enc_length_cnt(thl->pdulen, &thl->pdulenlen);
-  tot_len += 1 + thl->pdulenlen;
-
-  thl->comlen = sizeof(snmp_publiccommunity) - 1;
-  snmp_asn1_enc_length_cnt(thl->comlen, &thl->comlenlen);
-  tot_len += 1 + thl->comlenlen + thl->comlen;
-
-  snmp_asn1_enc_s32t_cnt(snmp_version, &thl->verlen);
-  snmp_asn1_enc_length_cnt(thl->verlen, &thl->verlenlen);
-  tot_len += 1 + thl->verlen + thl->verlenlen;
-
-  thl->seqlen = tot_len;
-  snmp_asn1_enc_length_cnt(thl->seqlen, &thl->seqlenlen);
-  tot_len += 1 + thl->seqlenlen;
-
-  return tot_len;
-}
-
-/**
- * Sums varbind lengths from tail to head and
- * annotates lengths in varbind for second encoding pass.
- *
- * @param root points to the root of the variable binding list
- * @return the required lenght for encoding the variable bindings
- */
-static u16_t
-snmp_varbind_list_sum(struct snmp_varbind_root *root)
-{
-  struct snmp_varbind *vb;
-  u32_t *uint_ptr;
-  s32_t *sint_ptr;
-  u16_t tot_len;
-
-  tot_len = 0;
-  vb = root->tail;
-  while ( vb != NULL )
-  {
-    /* encoded value lenght depends on type */
-    switch (vb->value_type)
-    {
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG):
-        sint_ptr = vb->value;
-        snmp_asn1_enc_s32t_cnt(*sint_ptr, &vb->vlen);
-        break;
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS):
-        uint_ptr = vb->value;
-        snmp_asn1_enc_u32t_cnt(*uint_ptr, &vb->vlen);
-        break;
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR):
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_NUL):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_OPAQUE):
-        vb->vlen = vb->value_len;
-        break;
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID):
-        sint_ptr = vb->value;
-        snmp_asn1_enc_oid_cnt(vb->value_len / sizeof(s32_t), sint_ptr, &vb->vlen);
-        break;
-      default:
-        /* unsupported type */
-        vb->vlen = 0;
-        break;
-    };
-    /* encoding length of value length field */
-    snmp_asn1_enc_length_cnt(vb->vlen, &vb->vlenlen);
-    snmp_asn1_enc_oid_cnt(vb->ident_len, vb->ident, &vb->olen);
-    snmp_asn1_enc_length_cnt(vb->olen, &vb->olenlen);
-
-    vb->seqlen = 1 + vb->vlenlen + vb->vlen;
-    vb->seqlen += 1 + vb->olenlen + vb->olen;
-    snmp_asn1_enc_length_cnt(vb->seqlen, &vb->seqlenlen);
-
-    /* varbind seq */
-    tot_len += 1 + vb->seqlenlen + vb->seqlen;
-
-    vb = vb->prev;
-  }
-
-  /* varbind-list seq */
-  root->seqlen = tot_len;
-  snmp_asn1_enc_length_cnt(root->seqlen, &root->seqlenlen);
-  tot_len += 1 + root->seqlenlen;
-
-  return tot_len;
-}
-
-/**
- * Encodes response header from head to tail.
- */
-static u16_t
-snmp_resp_header_enc(struct snmp_msg_pstat *m_stat, struct pbuf *p)
-{
-  u16_t ofs;
-
-  ofs = 0;
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_stat->rhl.seqlen);
-  ofs += m_stat->rhl.seqlenlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_stat->rhl.verlen);
-  ofs += m_stat->rhl.verlenlen;
-  snmp_asn1_enc_s32t(p, ofs, m_stat->rhl.verlen, snmp_version);
-  ofs += m_stat->rhl.verlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_stat->rhl.comlen);
-  ofs += m_stat->rhl.comlenlen;
-  snmp_asn1_enc_raw(p, ofs, m_stat->rhl.comlen, m_stat->community);
-  ofs += m_stat->rhl.comlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_GET_RESP));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_stat->rhl.pdulen);
-  ofs += m_stat->rhl.pdulenlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_stat->rhl.ridlen);
-  ofs += m_stat->rhl.ridlenlen;
-  snmp_asn1_enc_s32t(p, ofs, m_stat->rhl.ridlen, m_stat->rid);
-  ofs += m_stat->rhl.ridlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_stat->rhl.errstatlen);
-  ofs += m_stat->rhl.errstatlenlen;
-  snmp_asn1_enc_s32t(p, ofs, m_stat->rhl.errstatlen, m_stat->error_status);
-  ofs += m_stat->rhl.errstatlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_stat->rhl.erridxlen);
-  ofs += m_stat->rhl.erridxlenlen;
-  snmp_asn1_enc_s32t(p, ofs, m_stat->rhl.erridxlen, m_stat->error_index);
-  ofs += m_stat->rhl.erridxlen;
-
-  return ofs;
-}
-
-/**
- * Encodes trap header from head to tail.
- */
-static u16_t
-snmp_trap_header_enc(struct snmp_msg_trap *m_trap, struct pbuf *p)
-{
-  u16_t ofs;
-
-  ofs = 0;
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.seqlen);
-  ofs += m_trap->thl.seqlenlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.verlen);
-  ofs += m_trap->thl.verlenlen;
-  snmp_asn1_enc_s32t(p, ofs, m_trap->thl.verlen, snmp_version);
-  ofs += m_trap->thl.verlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.comlen);
-  ofs += m_trap->thl.comlenlen;
-  snmp_asn1_enc_raw(p, ofs, m_trap->thl.comlen, (u8_t *)&snmp_publiccommunity[0]);
-  ofs += m_trap->thl.comlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_TRAP));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.pdulen);
-  ofs += m_trap->thl.pdulenlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.eidlen);
-  ofs += m_trap->thl.eidlenlen;
-  snmp_asn1_enc_oid(p, ofs, m_trap->enterprise->len, &m_trap->enterprise->id[0]);
-  ofs += m_trap->thl.eidlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.aaddrlen);
-  ofs += m_trap->thl.aaddrlenlen;
-  snmp_asn1_enc_raw(p, ofs, m_trap->thl.aaddrlen, &m_trap->sip_raw[0]);
-  ofs += m_trap->thl.aaddrlen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.gtrplen);
-  ofs += m_trap->thl.gtrplenlen;
-  snmp_asn1_enc_u32t(p, ofs, m_trap->thl.gtrplen, m_trap->gen_trap);
-  ofs += m_trap->thl.gtrplen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.strplen);
-  ofs += m_trap->thl.strplenlen;
-  snmp_asn1_enc_u32t(p, ofs, m_trap->thl.strplen, m_trap->spc_trap);
-  ofs += m_trap->thl.strplen;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, m_trap->thl.tslen);
-  ofs += m_trap->thl.tslenlen;
-  snmp_asn1_enc_u32t(p, ofs, m_trap->thl.tslen, m_trap->ts);
-  ofs += m_trap->thl.tslen;
-
-  return ofs;
-}
-
-/**
- * Encodes varbind list from head to tail.
- */
-static u16_t
-snmp_varbind_list_enc(struct snmp_varbind_root *root, struct pbuf *p, u16_t ofs)
-{
-  struct snmp_varbind *vb;
-  s32_t *sint_ptr;
-  u32_t *uint_ptr;
-  u8_t *raw_ptr;
-
-  snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ));
-  ofs += 1;
-  snmp_asn1_enc_length(p, ofs, root->seqlen);
-  ofs += root->seqlenlen;
-
-  vb = root->head;
-  while ( vb != NULL )
-  {
-    snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ));
-    ofs += 1;
-    snmp_asn1_enc_length(p, ofs, vb->seqlen);
-    ofs += vb->seqlenlen;
-
-    snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID));
-    ofs += 1;
-    snmp_asn1_enc_length(p, ofs, vb->olen);
-    ofs += vb->olenlen;
-    snmp_asn1_enc_oid(p, ofs, vb->ident_len, &vb->ident[0]);
-    ofs += vb->olen;
-
-    snmp_asn1_enc_type(p, ofs, vb->value_type);
-    ofs += 1;
-    snmp_asn1_enc_length(p, ofs, vb->vlen);
-    ofs += vb->vlenlen;
-
-    switch (vb->value_type)
-    {
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG):
-        sint_ptr = vb->value;
-        snmp_asn1_enc_s32t(p, ofs, vb->vlen, *sint_ptr);
-        break;
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS):
-        uint_ptr = vb->value;
-        snmp_asn1_enc_u32t(p, ofs, vb->vlen, *uint_ptr);
-        break;
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR):
-      case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_OPAQUE):
-        raw_ptr = vb->value;
-        snmp_asn1_enc_raw(p, ofs, vb->vlen, raw_ptr);
-        break;
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_NUL):
-        break;
-      case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID):
-        sint_ptr = vb->value;
-        snmp_asn1_enc_oid(p, ofs, vb->value_len / sizeof(s32_t), sint_ptr);
-        break;
-      default:
-        /* unsupported type */
-        break;
-    };
-    ofs += vb->vlen;
-    vb = vb->next;
-  }
-  return ofs;
-}
-
-#endif /* LWIP_SNMP */
diff --git a/src/VBox/Devices/Network/lwip/src/core/stats.c b/src/VBox/Devices/Network/lwip/src/core/stats.c
deleted file mode 100644
index d5b3740..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/stats.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include <string.h>
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-
-#include "lwip/stats.h"
-#include "lwip/mem.h"
-
-
-#if LWIP_STATS
-struct stats_ lwip_stats;
-
-void
-stats_init(void)
-{
-  memset(&lwip_stats, 0, sizeof(struct stats_));
-}
-#if LWIP_STATS_DISPLAY
-void
-stats_display_proto(struct stats_proto *proto, char *name)
-{
-  LWIP_PLATFORM_DIAG(("\n%s\n\t", name));
-  LWIP_PLATFORM_DIAG(("xmit: %"S16_F"\n\t", proto->xmit)); 
-  LWIP_PLATFORM_DIAG(("rexmit: %"S16_F"\n\t", proto->rexmit)); 
-  LWIP_PLATFORM_DIAG(("recv: %"S16_F"\n\t", proto->recv)); 
-  LWIP_PLATFORM_DIAG(("fw: %"S16_F"\n\t", proto->fw)); 
-  LWIP_PLATFORM_DIAG(("drop: %"S16_F"\n\t", proto->drop)); 
-  LWIP_PLATFORM_DIAG(("chkerr: %"S16_F"\n\t", proto->chkerr)); 
-  LWIP_PLATFORM_DIAG(("lenerr: %"S16_F"\n\t", proto->lenerr)); 
-  LWIP_PLATFORM_DIAG(("memerr: %"S16_F"\n\t", proto->memerr)); 
-  LWIP_PLATFORM_DIAG(("rterr: %"S16_F"\n\t", proto->rterr)); 
-  LWIP_PLATFORM_DIAG(("proterr: %"S16_F"\n\t", proto->proterr)); 
-  LWIP_PLATFORM_DIAG(("opterr: %"S16_F"\n\t", proto->opterr)); 
-  LWIP_PLATFORM_DIAG(("err: %"S16_F"\n\t", proto->err)); 
-  LWIP_PLATFORM_DIAG(("cachehit: %"S16_F"\n", proto->cachehit)); 
-}
-
-void
-stats_display_pbuf(struct stats_pbuf *pbuf)
-{
-  LWIP_PLATFORM_DIAG(("\nPBUF\n\t"));
-  LWIP_PLATFORM_DIAG(("avail: %"S16_F"\n\t", pbuf->avail)); 
-  LWIP_PLATFORM_DIAG(("used: %"S16_F"\n\t", pbuf->used)); 
-  LWIP_PLATFORM_DIAG(("max: %"S16_F"\n\t", pbuf->max)); 
-  LWIP_PLATFORM_DIAG(("err: %"S16_F"\n\t", pbuf->err)); 
-  LWIP_PLATFORM_DIAG(("alloc_locked: %"S16_F"\n\t", pbuf->alloc_locked)); 
-  LWIP_PLATFORM_DIAG(("refresh_locked: %"S16_F"\n", pbuf->refresh_locked)); 
-}
-
-void
-stats_display_mem(struct stats_mem *mem, char *name)
-{
-  LWIP_PLATFORM_DIAG(("\n MEM %s\n\t", name));
-  LWIP_PLATFORM_DIAG(("avail: %"MEM_SIZE_F"\n\t", mem->avail)); 
-  LWIP_PLATFORM_DIAG(("used: %"MEM_SIZE_F"\n\t", mem->used)); 
-  LWIP_PLATFORM_DIAG(("max: %"MEM_SIZE_F"\n\t", mem->max)); 
-  LWIP_PLATFORM_DIAG(("err: %"MEM_SIZE_F"\n", mem->err));
-  
-}
-
-void
-stats_display(void)
-{
-  s16_t i;
-  char * memp_names[] = {"PBUF", "RAW_PCB", "UDP_PCB", "TCP_PCB", "TCP_PCB_LISTEN",
-        "TCP_SEG", "NETBUF", "NETCONN", "API_MSG", "TCP_MSG", "TIMEOUT"};
-  stats_display_proto(&lwip_stats.link, "LINK");
-  stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG");
-  stats_display_proto(&lwip_stats.ip, "IP");
-  stats_display_proto(&lwip_stats.icmp, "ICMP");
-  stats_display_proto(&lwip_stats.udp, "UDP");
-  stats_display_proto(&lwip_stats.tcp, "TCP");
-  stats_display_pbuf(&lwip_stats.pbuf);
-  stats_display_mem(&lwip_stats.mem, "HEAP");
-  for (i = 0; i < MEMP_MAX; i++) {
-    stats_display_mem(&lwip_stats.memp[i], memp_names[i]);
-  }
-  
-}
-#endif /* LWIP_STATS_DISPLAY */
-#endif /* LWIP_STATS */
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/sys.c b/src/VBox/Devices/Network/lwip/src/core/sys.c
deleted file mode 100644
index 5ca4c7e..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/sys.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/sys.h"
-#include "lwip/opt.h"
-#include "lwip/def.h"
-#include "lwip/memp.h"
-
-#if (NO_SYS == 0)
-
-struct sswt_cb
-{
-    s16_t timeflag;
-    sys_sem_t *psem;
-};
-
-
-
-void
-sys_mbox_fetch(sys_mbox_t mbox, void **msg)
-{
-  u32_t time;
-  struct sys_timeouts *timeouts;
-  struct sys_timeo *tmptimeout;
-  sys_timeout_handler h;
-  void *arg;
-
-
- again:
-  timeouts = sys_arch_timeouts();
-
-  if (!timeouts || !timeouts->next) {
-    sys_arch_mbox_fetch(mbox, msg, 0);
-  } else {
-    if (timeouts->next->time > 0) {
-      time = sys_arch_mbox_fetch(mbox, msg, timeouts->next->time);
-    } else {
-      time = SYS_ARCH_TIMEOUT;
-    }
-
-    if (time == SYS_ARCH_TIMEOUT) {
-      /* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
-   could be fetched. We should now call the timeout handler and
-   deallocate the memory allocated for the timeout. */
-      tmptimeout = timeouts->next;
-      timeouts->next = tmptimeout->next;
-      h = tmptimeout->h;
-      arg = tmptimeout->arg;
-      memp_free(MEMP_SYS_TIMEOUT, tmptimeout);
-      if (h != NULL) {
-        LWIP_DEBUGF(SYS_DEBUG, ("smf calling h=%p(%p)\n", (void *)(uintptr_t)h, (void *)arg));
-      	h(arg);
-      }
-
-      /* We try again to fetch a message from the mbox. */
-      goto again;
-    } else {
-      /* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
-   occured. The time variable is set to the number of
-   milliseconds we waited for the message. */
-      if (time <= timeouts->next->time) {
-  timeouts->next->time -= time;
-      } else {
-  timeouts->next->time = 0;
-      }
-    }
-
-  }
-}
-
-void
-sys_sem_wait(sys_sem_t sem)
-{
-  u32_t time;
-  struct sys_timeouts *timeouts;
-  struct sys_timeo *tmptimeout;
-  sys_timeout_handler h;
-  void *arg;
-
-  /*  while (sys_arch_sem_wait(sem, 1000) == 0);
-      return;*/
-
- again:
-
-  timeouts = sys_arch_timeouts();
-
-  if (!timeouts || !timeouts->next) {
-    sys_arch_sem_wait(sem, 0);
-  } else {
-    if (timeouts->next->time > 0) {
-      time = sys_arch_sem_wait(sem, timeouts->next->time);
-    } else {
-      time = SYS_ARCH_TIMEOUT;
-    }
-
-    if (time == SYS_ARCH_TIMEOUT) {
-      /* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message
-   could be fetched. We should now call the timeout handler and
-   deallocate the memory allocated for the timeout. */
-      tmptimeout = timeouts->next;
-      timeouts->next = tmptimeout->next;
-      h = tmptimeout->h;
-      arg = tmptimeout->arg;
-      memp_free(MEMP_SYS_TIMEOUT, tmptimeout);
-      if (h != NULL) {
-        LWIP_DEBUGF(SYS_DEBUG, ("ssw h=%p(%p)\n", (void *)(uintptr_t)h, (void *)arg));
-        h(arg);
-      }
-
-
-      /* We try again to fetch a message from the mbox. */
-      goto again;
-    } else {
-      /* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout
-   occured. The time variable is set to the number of
-   milliseconds we waited for the message. */
-      if (time <= timeouts->next->time) {
-  timeouts->next->time -= time;
-      } else {
-  timeouts->next->time = 0;
-      }
-    }
-
-  }
-}
-
-void
-sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
-{
-  struct sys_timeouts *timeouts;
-  struct sys_timeo *timeout, *t;
-
-  timeout = memp_malloc(MEMP_SYS_TIMEOUT);
-  if (timeout == NULL) {
-    return;
-  }
-  timeout->next = NULL;
-  timeout->h = h;
-  timeout->arg = arg;
-  timeout->time = msecs;
-
-  timeouts = sys_arch_timeouts();
-
-  LWIP_DEBUGF(SYS_DEBUG, ("sys_timeout: %p msecs=%"U32_F" h=%p arg=%p\n",
-    (void *)timeout, msecs, (void *)(uintptr_t)h, (void *)arg));
-
-  LWIP_ASSERT("sys_timeout: timeouts != NULL", timeouts != NULL);
-
-  if (timeouts->next == NULL) {
-    timeouts->next = timeout;
-    return;
-  }
-
-  if (timeouts->next->time > msecs) {
-    timeouts->next->time -= msecs;
-    timeout->next = timeouts->next;
-    timeouts->next = timeout;
-  } else {
-    for(t = timeouts->next; t != NULL; t = t->next) {
-      timeout->time -= t->time;
-      if (t->next == NULL || t->next->time > timeout->time) {
-        if (t->next != NULL) {
-          t->next->time -= timeout->time;
-        }
-        timeout->next = t->next;
-        t->next = timeout;
-        break;
-      }
-    }
-  }
-
-}
-
-/* Go through timeout list (for this task only) and remove the first matching entry,
-   even though the timeout has not triggered yet.
-*/
-
-void
-sys_untimeout(sys_timeout_handler h, void *arg)
-{
-    struct sys_timeouts *timeouts;
-    struct sys_timeo *prev_t, *t;
-
-    timeouts = sys_arch_timeouts();
-
-    if (timeouts->next == NULL)
-        return;
-
-    for (t = timeouts->next, prev_t = NULL; t != NULL; prev_t = t, t = t->next)
-    {
-        if ((t->h == h) && (t->arg == arg))
-        {
-            /* We have a match */
-            /* Unlink from previous in list */
-            if (prev_t == NULL)
-                timeouts->next = t->next;
-            else
-                prev_t->next = t->next;
-            /* If not the last one, add time of this one back to next */
-            if (t->next != NULL)
-                t->next->time += t->time;
-            memp_free(MEMP_SYS_TIMEOUT, t);
-            return;
-        }
-    }
-    return;
-}
-
-
-
-
-
-static void
-sswt_handler(void *arg)
-{
-    struct sswt_cb *sswt_cb = (struct sswt_cb *) arg;
-
-    /* Timeout. Set flag to TRUE and signal semaphore */
-    sswt_cb->timeflag = 1;
-    sys_sem_signal(*(sswt_cb->psem));
-}
-
-/* Wait for a semaphore with timeout (specified in ms) */
-/* timeout = 0: wait forever */
-/* Returns 0 on timeout. 1 otherwise */
-
-int
-sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
-{
-    struct sswt_cb sswt_cb;
-
-    sswt_cb.psem = &sem;
-    sswt_cb.timeflag = 0;
-
-    /* If timeout is zero, then just wait forever */
-    if (timeout > 0)
-        /* Create a timer and pass it the address of our flag */
-        sys_timeout(timeout, sswt_handler, &sswt_cb);
-    sys_sem_wait(sem);
-    /* Was it a timeout? */
-    if (sswt_cb.timeflag)
-    {
-        /* timeout */
-        return 0;
-    } else {
-        /* Not a timeout. Remove timeout entry */
-        sys_untimeout(sswt_handler, &sswt_cb);
-        return 1;
-    }
-
-}
-
-
-void
-sys_msleep(u32_t ms)
-{
-  sys_sem_t delaysem = sys_sem_new(0);
-
-  sys_sem_wait_timeout(delaysem, ms);
-
-  sys_sem_free(delaysem);
-}
-
-
-#endif /* NO_SYS */
diff --git a/src/VBox/Devices/Network/lwip/src/core/tcp.c b/src/VBox/Devices/Network/lwip/src/core/tcp.c
deleted file mode 100644
index 89dfd24..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/tcp.c
+++ /dev/null
@@ -1,1182 +0,0 @@
-/**
- * @file
- *
- * Transmission Control Protocol for IP
- *
- * This file contains common functions for the TCP implementation, such as functinos
- * for manipulating the data structures and the TCP timer functions. TCP functions
- * related to input and output is found in tcp_in.c and tcp_out.c respectively.
- *
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include <string.h>
-
-#include "lwip/opt.h"
-#include "lwip/def.h"
-#include "lwip/mem.h"
-#include "lwip/memp.h"
-#include "lwip/snmp.h"
-
-#include "lwip/tcp.h"
-#if LWIP_TCP
-
-/* Incremented every coarse grained timer shot (typically every 500 ms). */
-u32_t tcp_ticks;
-const u8_t tcp_backoff[13] =
-    { 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7};
-
-/* The TCP PCB lists. */
-
-/** List of all TCP PCBs in LISTEN state */
-union tcp_listen_pcbs_t tcp_listen_pcbs;
-/** List of all TCP PCBs that are in a state in which
- * they accept or send data. */
-struct tcp_pcb *tcp_active_pcbs;  
-/** List of all TCP PCBs in TIME-WAIT state */
-struct tcp_pcb *tcp_tw_pcbs;
-
-struct tcp_pcb *tcp_tmp_pcb;
-
-static u8_t tcp_timer;
-static u16_t tcp_new_port(void);
-
-/**
- * Initializes the TCP layer.
- */
-void
-tcp_init(void)
-{
-  /* Clear globals. */
-  tcp_listen_pcbs.listen_pcbs = NULL;
-  tcp_active_pcbs = NULL;
-  tcp_tw_pcbs = NULL;
-  tcp_tmp_pcb = NULL;
-  
-  /* initialize timer */
-  tcp_ticks = 0;
-  tcp_timer = 0;
-  
-}
-
-/**
- * Called periodically to dispatch TCP timers.
- *
- */
-void
-tcp_tmr(void)
-{
-  /* Call tcp_fasttmr() every 250 ms */
-  tcp_fasttmr();
-
-  if (++tcp_timer & 1) {
-    /* Call tcp_tmr() every 500 ms, i.e., every other timer
-       tcp_tmr() is called. */
-    tcp_slowtmr();
-  }
-}
-
-/**
- * Closes the connection held by the PCB.
- *
- */
-err_t
-tcp_close(struct tcp_pcb *pcb)
-{
-  err_t err;
-
-#if TCP_DEBUG
-  LWIP_DEBUGF(TCP_DEBUG, ("tcp_close: closing in "));
-  tcp_debug_print_state(pcb->state);
-#endif /* TCP_DEBUG */
-
-  switch (pcb->state) {
-  case CLOSED:
-    /* Closing a pcb in the CLOSED state might seem erroneous,
-     * however, it is in this state once allocated and as yet unused
-     * and the user needs some way to free it should the need arise.
-     * Calling tcp_close() with a pcb that has already been closed, (i.e. twice)
-     * or for a pcb that has been used and then entered the CLOSED state 
-     * is erroneous, but this should never happen as the pcb has in those cases
-     * been freed, and so any remaining handles are bogus. */
-    err = ERR_OK;
-    memp_free(MEMP_TCP_PCB, pcb);
-    pcb = NULL;
-    break;
-  case LISTEN:
-    err = ERR_OK;
-    tcp_pcb_remove((struct tcp_pcb **)&tcp_listen_pcbs.pcbs, pcb);
-    memp_free(MEMP_TCP_PCB_LISTEN, pcb);
-    pcb = NULL;
-    break;
-  case SYN_SENT:
-    err = ERR_OK;
-    tcp_pcb_remove(&tcp_active_pcbs, pcb);
-    memp_free(MEMP_TCP_PCB, pcb);
-    pcb = NULL;
-    snmp_inc_tcpattemptfails();
-    break;
-  case SYN_RCVD:
-    err = tcp_send_ctrl(pcb, TCP_FIN);
-    if (err == ERR_OK) {
-      snmp_inc_tcpattemptfails();
-      pcb->state = FIN_WAIT_1;
-    }
-    break;
-  case ESTABLISHED:
-    err = tcp_send_ctrl(pcb, TCP_FIN);
-    if (err == ERR_OK) {
-      snmp_inc_tcpestabresets();
-      pcb->state = FIN_WAIT_1;
-    }
-    break;
-  case CLOSE_WAIT:
-    err = tcp_send_ctrl(pcb, TCP_FIN);
-    if (err == ERR_OK) {
-      snmp_inc_tcpestabresets();
-      pcb->state = LAST_ACK;
-    }
-    break;
-  default:
-    /* Has already been closed, do nothing. */
-    err = ERR_OK;
-    pcb = NULL;
-    break;
-  }
-
-  if (pcb != NULL && err == ERR_OK) {
-    err = tcp_output(pcb);
-  }
-  return err;
-}
-
-/**
- * Aborts a connection by sending a RST to the remote host and deletes
- * the local protocol control block. This is done when a connection is
- * killed because of shortage of memory.
- *
- */
-void
-tcp_abort(struct tcp_pcb *pcb)
-{
-  u32_t seqno, ackno;
-  u16_t remote_port, local_port;
-  struct ip_addr remote_ip, local_ip;
-#if LWIP_CALLBACK_API  
-  void (* errf)(void *arg, err_t err);
-#endif /* LWIP_CALLBACK_API */
-  void *errf_arg;
-
-  
-  /* Figure out on which TCP PCB list we are, and remove us. If we
-     are in an active state, call the receive function associated with
-     the PCB with a NULL argument, and send an RST to the remote end. */
-  if (pcb->state == TIME_WAIT) {
-    tcp_pcb_remove(&tcp_tw_pcbs, pcb);
-    memp_free(MEMP_TCP_PCB, pcb);
-  } else {
-    seqno = pcb->snd_nxt;
-    ackno = pcb->rcv_nxt;
-    ip_addr_set(&local_ip, &(pcb->local_ip));
-    ip_addr_set(&remote_ip, &(pcb->remote_ip));
-    local_port = pcb->local_port;
-    remote_port = pcb->remote_port;
-#if LWIP_CALLBACK_API
-    errf = pcb->errf;
-#endif /* LWIP_CALLBACK_API */
-    errf_arg = pcb->callback_arg;
-    tcp_pcb_remove(&tcp_active_pcbs, pcb);
-    if (pcb->unacked != NULL) {
-      tcp_segs_free(pcb->unacked);
-    }
-    if (pcb->unsent != NULL) {
-      tcp_segs_free(pcb->unsent);
-    }
-#if TCP_QUEUE_OOSEQ    
-    if (pcb->ooseq != NULL) {
-      tcp_segs_free(pcb->ooseq);
-    }
-#endif /* TCP_QUEUE_OOSEQ */
-    memp_free(MEMP_TCP_PCB, pcb);
-    TCP_EVENT_ERR(errf, errf_arg, ERR_ABRT);
-    LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_abort: sending RST\n"));
-    tcp_rst(seqno, ackno, &local_ip, &remote_ip, local_port, remote_port);
-  }
-}
-
-/**
- * Binds the connection to a local portnumber and IP address. If the
- * IP address is not given (i.e., ipaddr == NULL), the IP address of
- * the outgoing network interface is used instead.
- *
- */
-
-err_t
-tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
-{
-  struct tcp_pcb *cpcb;
-
-  if (port == 0) {
-    port = tcp_new_port();
-  }
-  /* Check if the address already is in use. */
-  for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs;
-      cpcb != NULL; cpcb = cpcb->next) {
-    if (cpcb->local_port == port) {
-      if (ip_addr_isany(&(cpcb->local_ip)) ||
-        ip_addr_isany(ipaddr) ||
-        ip_addr_cmp(&(cpcb->local_ip), ipaddr)) {
-          return ERR_USE;
-      }
-    }
-  }
-  for(cpcb = tcp_active_pcbs;
-      cpcb != NULL; cpcb = cpcb->next) {
-    if (cpcb->local_port == port) {
-      if (ip_addr_isany(&(cpcb->local_ip)) ||
-   ip_addr_isany(ipaddr) ||
-   ip_addr_cmp(&(cpcb->local_ip), ipaddr)) {
-  return ERR_USE;
-      }
-    }
-  }
-
-  if (!ip_addr_isany(ipaddr)) {
-    pcb->local_ip = *ipaddr;
-  }
-  pcb->local_port = port;
-  LWIP_DEBUGF(TCP_DEBUG, ("tcp_bind: bind to port %"U16_F"\n", port));
-  return ERR_OK;
-}
-#if LWIP_CALLBACK_API
-static err_t
-tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
-{
-  (void)arg;
-  (void)pcb;
-  (void)err;
-
-  return ERR_ABRT;
-}
-#endif /* LWIP_CALLBACK_API */
-
-/**
- * Set the state of the connection to be LISTEN, which means that it
- * is able to accept incoming connections. The protocol control block
- * is reallocated in order to consume less memory. Setting the
- * connection to LISTEN is an irreversible process.
- *
- */
-struct tcp_pcb *
-tcp_listen(struct tcp_pcb *pcb)
-{
-  struct tcp_pcb_listen *lpcb;
-
-  /* already listening? */
-  if (pcb->state == LISTEN) {
-    return pcb;
-  }
-  lpcb = memp_malloc(MEMP_TCP_PCB_LISTEN);
-  if (lpcb == NULL) {
-    return NULL;
-  }
-  lpcb->callback_arg = pcb->callback_arg;
-  lpcb->local_port = pcb->local_port;
-  lpcb->state = LISTEN;
-  lpcb->so_options = pcb->so_options;
-  lpcb->so_options |= SOF_ACCEPTCONN;
-  lpcb->ttl = pcb->ttl;
-  lpcb->tos = pcb->tos;
-  ip_addr_set(&lpcb->local_ip, &pcb->local_ip);
-  memp_free(MEMP_TCP_PCB, pcb);
-#if LWIP_CALLBACK_API
-  lpcb->accept = tcp_accept_null;
-#endif /* LWIP_CALLBACK_API */
-  TCP_REG(&tcp_listen_pcbs.listen_pcbs, lpcb);
-  return (struct tcp_pcb *)lpcb;
-}
-
-/**
- * This function should be called by the application when it has
- * processed the data. The purpose is to advertise a larger window
- * when the data has been processed.
- *
- */
-void
-tcp_recved(struct tcp_pcb *pcb, u16_t len)
-{
-  if ((u32_t)pcb->rcv_wnd + len > TCP_WND) {
-    pcb->rcv_wnd = TCP_WND;
-  } else {
-    pcb->rcv_wnd += len;
-  }
-  if (!(pcb->flags & TF_ACK_DELAY) &&
-     !(pcb->flags & TF_ACK_NOW)) {
-    /*
-     * We send an ACK here (if one is not already pending, hence
-     * the above tests) as tcp_recved() implies that the application
-     * has processed some data, and so we can open the receiver's
-     * window to allow more to be transmitted.  This could result in
-     * two ACKs being sent for each received packet in some limited cases
-     * (where the application is only receiving data, and is slow to
-     * process it) but it is necessary to guarantee that the sender can
-     * continue to transmit.
-     */
-    tcp_ack(pcb);
-  } 
-  else if (pcb->flags & TF_ACK_DELAY && pcb->rcv_wnd >= TCP_WND/2) {
-    /* If we can send a window update such that there is a full
-     * segment available in the window, do so now.  This is sort of
-     * nagle-like in its goals, and tries to hit a compromise between
-     * sending acks each time the window is updated, and only sending
-     * window updates when a timer expires.  The "threshold" used
-     * above (currently TCP_WND/2) can be tuned to be more or less
-     * aggressive  */
-    tcp_ack_now(pcb);
-  }
-
-  LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %"U16_F" bytes, wnd %"U16_F" (%"U16_F").\n",
-         len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd));
-}
-
-/**
- * A nastly hack featuring 'goto' statements that allocates a
- * new TCP local port.
- */
-static u16_t
-tcp_new_port(void)
-{
-  struct tcp_pcb *pcb;
-#ifndef TCP_LOCAL_PORT_RANGE_START
-#define TCP_LOCAL_PORT_RANGE_START 4096
-#define TCP_LOCAL_PORT_RANGE_END   0x7fff
-#endif
-  static u16_t port = TCP_LOCAL_PORT_RANGE_START;
-  
- again:
-  if (++port > TCP_LOCAL_PORT_RANGE_END) {
-    port = TCP_LOCAL_PORT_RANGE_START;
-  }
-  
-  for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
-    if (pcb->local_port == port) {
-      goto again;
-    }
-  }
-  for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
-    if (pcb->local_port == port) {
-      goto again;
-    }
-  }
-  for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) {
-    if (pcb->local_port == port) {
-      goto again;
-    }
-  }
-  return port;
-}
-
-/**
- * Connects to another host. The function given as the "connected"
- * argument will be called when the connection has been established.
- *
- */
-err_t
-tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
-      err_t (* connected)(void *arg, struct tcp_pcb *tpcb, err_t err))
-{
-  u32_t optdata;
-  err_t ret;
-  u32_t iss;
-
-  LWIP_DEBUGF(TCP_DEBUG, ("tcp_connect to port %"U16_F"\n", port));
-  if (ipaddr != NULL) {
-    pcb->remote_ip = *ipaddr;
-  } else {
-    return ERR_VAL;
-  }
-  pcb->remote_port = port;
-  if (pcb->local_port == 0) {
-    pcb->local_port = tcp_new_port();
-  }
-  iss = tcp_next_iss();
-  pcb->rcv_nxt = 0;
-  pcb->snd_nxt = iss;
-  pcb->lastack = iss - 1;
-  pcb->snd_lbb = iss - 1;
-  pcb->rcv_wnd = TCP_WND;
-  pcb->snd_wnd = TCP_WND;
-  pcb->mss = TCP_MSS;
-  pcb->cwnd = 1;
-  pcb->ssthresh = pcb->mss * 10;
-  pcb->state = SYN_SENT;
-#if LWIP_CALLBACK_API  
-  pcb->connected = connected;
-#endif /* LWIP_CALLBACK_API */  
-  TCP_REG(&tcp_active_pcbs, pcb);
-
-  snmp_inc_tcpactiveopens();
-  
-  /* Build an MSS option */
-  optdata = htonl(((u32_t)2 << 24) | 
-      ((u32_t)4 << 16) | 
-      (((u32_t)pcb->mss / 256) << 8) |
-      (pcb->mss & 255));
-
-  ret = tcp_enqueue(pcb, NULL, 0, TCP_SYN, 0, (u8_t *)&optdata, 4);
-  if (ret == ERR_OK) { 
-    tcp_output(pcb);
-  }
-  return ret;
-} 
-
-/**
- * Called every 500 ms and implements the retransmission timer and the timer that
- * removes PCBs that have been in TIME-WAIT for enough time. It also increments
- * various timers such as the inactivity timer in each PCB.
- */
-void
-tcp_slowtmr(void)
-{
-  struct tcp_pcb *pcb, *pcb2, *prev;
-  u32_t eff_wnd;
-  u8_t pcb_remove;      /* flag if a PCB should be removed */
-  err_t err;
-
-  err = ERR_OK;
-
-  ++tcp_ticks;
-
-  /* Steps through all of the active PCBs. */
-  prev = NULL;
-  pcb = tcp_active_pcbs;
-  if (pcb == NULL) {
-    LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: no active pcbs\n"));
-  }
-  while (pcb != NULL) {
-    LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: processing active pcb\n"));
-    LWIP_ASSERT("tcp_slowtmr: active pcb->state != CLOSED\n", pcb->state != CLOSED);
-    LWIP_ASSERT("tcp_slowtmr: active pcb->state != LISTEN\n", pcb->state != LISTEN);
-    LWIP_ASSERT("tcp_slowtmr: active pcb->state != TIME-WAIT\n", pcb->state != TIME_WAIT);
-
-    pcb_remove = 0;
-
-    if (pcb->state == SYN_SENT && pcb->nrtx == TCP_SYNMAXRTX) {
-      ++pcb_remove;
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max SYN retries reached\n"));
-    }
-    else if (pcb->nrtx == TCP_MAXRTX) {
-      ++pcb_remove;
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max DATA retries reached\n"));
-    } else {
-      ++pcb->rtime;
-      if (pcb->unacked != NULL && pcb->rtime >= pcb->rto) {
-
-        /* Time for a retransmission. */
-        LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_slowtmr: rtime %"U16_F" pcb->rto %"U16_F"\n",
-          pcb->rtime, pcb->rto));
-
-        /* Double retransmission time-out unless we are trying to
-         * connect to somebody (i.e., we are in SYN_SENT). */
-        if (pcb->state != SYN_SENT) {
-          pcb->rto = ((pcb->sa >> 3) + pcb->sv) << tcp_backoff[pcb->nrtx];
-        }
-        /* Reduce congestion window and ssthresh. */
-        eff_wnd = LWIP_MIN(pcb->cwnd, pcb->snd_wnd);
-        pcb->ssthresh = eff_wnd >> 1;
-        if (pcb->ssthresh < pcb->mss) {
-          pcb->ssthresh = pcb->mss * 2;
-        }
-        pcb->cwnd = pcb->mss;
-        LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: cwnd %"U16_F" ssthresh %"U16_F"\n",
-                                pcb->cwnd, pcb->ssthresh));
- 
-        /* The following needs to be called AFTER cwnd is set to one mss - STJ */
-        tcp_rexmit_rto(pcb);
-     }
-    }
-    /* Check if this PCB has stayed too long in FIN-WAIT-2 */
-    if (pcb->state == FIN_WAIT_2) {
-      if ((u32_t)(tcp_ticks - pcb->tmr) >
-        TCP_FIN_WAIT_TIMEOUT / TCP_SLOW_INTERVAL) {
-        ++pcb_remove;
-        LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in FIN-WAIT-2\n"));
-      }
-    }
-
-   /* Check if KEEPALIVE should be sent */
-   if((pcb->so_options & SOF_KEEPALIVE) && ((pcb->state == ESTABLISHED) || (pcb->state == CLOSE_WAIT))) {
-      if((u32_t)(tcp_ticks - pcb->tmr) > (pcb->keepalive + TCP_MAXIDLE) / TCP_SLOW_INTERVAL)  {
-         LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to %"U16_F".%"U16_F".%"U16_F".%"U16_F".\n",
-                                 ip4_addr1(&pcb->remote_ip), ip4_addr2(&pcb->remote_ip),
-                                 ip4_addr3(&pcb->remote_ip), ip4_addr4(&pcb->remote_ip)));
-
-         tcp_abort(pcb);
-      }
-      else if((u32_t)(tcp_ticks - pcb->tmr) > (pcb->keepalive + pcb->keep_cnt * TCP_KEEPINTVL) / TCP_SLOW_INTERVAL) {
-         tcp_keepalive(pcb);
-         pcb->keep_cnt++;
-      }
-   }
-
-    /* If this PCB has queued out of sequence data, but has been
-       inactive for too long, will drop the data (it will eventually
-       be retransmitted). */
-#if TCP_QUEUE_OOSEQ    
-    if (pcb->ooseq != NULL &&
-       (u32_t)tcp_ticks - pcb->tmr >=
-       pcb->rto * TCP_OOSEQ_TIMEOUT) {
-      tcp_segs_free(pcb->ooseq);
-      pcb->ooseq = NULL;
-      LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: dropping OOSEQ queued data\n"));
-    }
-#endif /* TCP_QUEUE_OOSEQ */
-
-    /* Check if this PCB has stayed too long in SYN-RCVD */
-    if (pcb->state == SYN_RCVD) {
-      if ((u32_t)(tcp_ticks - pcb->tmr) >
-        TCP_SYN_RCVD_TIMEOUT / TCP_SLOW_INTERVAL) {
-        ++pcb_remove;
-        LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in SYN-RCVD\n"));
-      }
-    }
-
-    /* Check if this PCB has stayed too long in LAST-ACK */
-    if (pcb->state == LAST_ACK) {
-      if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) {
-        ++pcb_remove;
-        LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in LAST-ACK\n"));
-      }
-    }
-
-    /* If the PCB should be removed, do it. */
-    if (pcb_remove) {
-      tcp_pcb_purge(pcb);      
-      /* Remove PCB from tcp_active_pcbs list. */
-      if (prev != NULL) {
-  LWIP_ASSERT("tcp_slowtmr: middle tcp != tcp_active_pcbs", pcb != tcp_active_pcbs);
-        prev->next = pcb->next;
-      } else {
-        /* This PCB was the first. */
-        LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_active_pcbs", tcp_active_pcbs == pcb);
-        tcp_active_pcbs = pcb->next;
-      }
-
-      TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_ABRT);
-
-      pcb2 = pcb->next;
-      memp_free(MEMP_TCP_PCB, pcb);
-      pcb = pcb2;
-    } else {
-
-      /* We check if we should poll the connection. */
-      ++pcb->polltmr;
-      if (pcb->polltmr >= pcb->pollinterval) {
-        pcb->polltmr = 0;
-        LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: polling application\n"));
-        TCP_EVENT_POLL(pcb, err);
-        if (err == ERR_OK) {
-          tcp_output(pcb);
-        }
-      }
-      
-      prev = pcb;
-      pcb = pcb->next;
-    }
-  }
-
-  
-  /* Steps through all of the TIME-WAIT PCBs. */
-  prev = NULL;    
-  pcb = tcp_tw_pcbs;
-  while (pcb != NULL) {
-    LWIP_ASSERT("tcp_slowtmr: TIME-WAIT pcb->state == TIME-WAIT", pcb->state == TIME_WAIT);
-    pcb_remove = 0;
-
-    /* Check if this PCB has stayed long enough in TIME-WAIT */
-    if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) {
-      ++pcb_remove;
-    }
-    
-
-
-    /* If the PCB should be removed, do it. */
-    if (pcb_remove) {
-      tcp_pcb_purge(pcb);      
-      /* Remove PCB from tcp_tw_pcbs list. */
-      if (prev != NULL) {
-  LWIP_ASSERT("tcp_slowtmr: middle tcp != tcp_tw_pcbs", pcb != tcp_tw_pcbs);
-        prev->next = pcb->next;
-      } else {
-        /* This PCB was the first. */
-        LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_tw_pcbs", tcp_tw_pcbs == pcb);
-        tcp_tw_pcbs = pcb->next;
-      }
-      pcb2 = pcb->next;
-      memp_free(MEMP_TCP_PCB, pcb);
-      pcb = pcb2;
-    } else {
-      prev = pcb;
-      pcb = pcb->next;
-    }
-  }
-}
-
-/**
- * Is called every TCP_FAST_INTERVAL (250 ms) and sends delayed ACKs.
- */
-void
-tcp_fasttmr(void)
-{
-  struct tcp_pcb *pcb;
-
-  /* send delayed ACKs */  
-  for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
-    if (pcb->flags & TF_ACK_DELAY) {
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_fasttmr: delayed ACK\n"));
-      tcp_ack_now(pcb);
-      pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW);
-    }
-  }
-}
-
-/**
- * Deallocates a list of TCP segments (tcp_seg structures).
- *
- */
-u8_t
-tcp_segs_free(struct tcp_seg *seg)
-{
-  u8_t count = 0;
-  struct tcp_seg *next;
-  while (seg != NULL) {
-    next = seg->next;
-    count += tcp_seg_free(seg);
-    seg = next;
-  }
-  return count;
-}
-
-/**
- * Frees a TCP segment.
- *
- */
-u8_t
-tcp_seg_free(struct tcp_seg *seg)
-{
-  u8_t count = 0;
-  
-  if (seg != NULL) {
-    if (seg->p != NULL) {
-      count = pbuf_free(seg->p);
-#if TCP_DEBUG
-      seg->p = NULL;
-#endif /* TCP_DEBUG */
-    }
-    memp_free(MEMP_TCP_SEG, seg);
-  }
-  return count;
-}
-
-/**
- * Sets the priority of a connection.
- *
- */
-void
-tcp_setprio(struct tcp_pcb *pcb, u8_t prio)
-{
-  pcb->prio = prio;
-}
-#if TCP_QUEUE_OOSEQ
-
-/**
- * Returns a copy of the given TCP segment.
- *
- */ 
-struct tcp_seg *
-tcp_seg_copy(struct tcp_seg *seg)
-{
-  struct tcp_seg *cseg;
-
-  cseg = memp_malloc(MEMP_TCP_SEG);
-  if (cseg == NULL) {
-    return NULL;
-  }
-  memcpy((u8_t *)cseg, (const u8_t *)seg, sizeof(struct tcp_seg)); 
-  pbuf_ref(cseg->p);
-  return cseg;
-}
-#endif
-
-#if LWIP_CALLBACK_API
-static err_t
-tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
-{
-  arg = arg;
-  if (p != NULL) {
-    pbuf_free(p);
-  } else if (err == ERR_OK) {
-    return tcp_close(pcb);
-  }
-  return ERR_OK;
-}
-#endif /* LWIP_CALLBACK_API */
-
-static void
-tcp_kill_prio(u8_t prio)
-{
-  struct tcp_pcb *pcb, *inactive;
-  u32_t inactivity;
-  u8_t mprio;
-
-
-  mprio = TCP_PRIO_MAX;
-  
-  /* We kill the oldest active connection that has lower priority than
-     prio. */
-  inactivity = 0;
-  inactive = NULL;
-  for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
-    if (pcb->prio <= prio &&
-       pcb->prio <= mprio &&
-       (u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
-      inactivity = tcp_ticks - pcb->tmr;
-      inactive = pcb;
-      mprio = pcb->prio;
-    }
-  }
-  if (inactive != NULL) {
-    LWIP_DEBUGF(TCP_DEBUG, ("tcp_kill_prio: killing oldest PCB %p (%"S32_F")\n",
-           (void *)inactive, inactivity));
-    tcp_abort(inactive);
-  }      
-}
-
-
-static void
-tcp_kill_timewait(void)
-{
-  struct tcp_pcb *pcb, *inactive;
-  u32_t inactivity;
-
-  inactivity = 0;
-  inactive = NULL;
-  for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
-    if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
-      inactivity = tcp_ticks - pcb->tmr;
-      inactive = pcb;
-    }
-  }
-  if (inactive != NULL) {
-    LWIP_DEBUGF(TCP_DEBUG, ("tcp_kill_timewait: killing oldest TIME-WAIT PCB %p (%"S32_F")\n",
-           (void *)inactive, inactivity));
-    tcp_abort(inactive);
-  }      
-}
-
-
-
-struct tcp_pcb *
-tcp_alloc(u8_t prio)
-{
-  struct tcp_pcb *pcb;
-  u32_t iss;
-  
-  pcb = memp_malloc(MEMP_TCP_PCB);
-  if (pcb == NULL) {
-    /* Try killing oldest connection in TIME-WAIT. */
-    LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest TIME-WAIT connection\n"));
-    tcp_kill_timewait();
-    pcb = memp_malloc(MEMP_TCP_PCB);
-    if (pcb == NULL) {
-      tcp_kill_prio(prio);    
-      pcb = memp_malloc(MEMP_TCP_PCB);
-    }
-  }
-  if (pcb != NULL) {
-    memset(pcb, 0, sizeof(struct tcp_pcb));
-    pcb->prio = TCP_PRIO_NORMAL;
-    pcb->snd_buf = TCP_SND_BUF;
-    pcb->snd_queuelen = 0;
-    pcb->rcv_wnd = TCP_WND;
-    pcb->tos = 0;
-    pcb->ttl = TCP_TTL;
-    pcb->mss = TCP_MSS;
-    pcb->rto = 3000 / TCP_SLOW_INTERVAL;
-    pcb->sa = 0;
-    pcb->sv = 3000 / TCP_SLOW_INTERVAL;
-    pcb->rtime = 0;
-    pcb->cwnd = 1;
-    iss = tcp_next_iss();
-    pcb->snd_wl2 = iss;
-    pcb->snd_nxt = iss;
-    pcb->snd_max = iss;
-    pcb->lastack = iss;
-    pcb->snd_lbb = iss;   
-    pcb->tmr = tcp_ticks;
-
-    pcb->polltmr = 0;
-
-#if LWIP_CALLBACK_API
-    pcb->recv = tcp_recv_null;
-#endif /* LWIP_CALLBACK_API */  
-    
-    /* Init KEEPALIVE timer */
-    pcb->keepalive = TCP_KEEPDEFAULT;
-    pcb->keep_cnt = 0;
-  }
-  return pcb;
-}
-
-/**
- * Creates a new TCP protocol control block but doesn't place it on
- * any of the TCP PCB lists.
- *
- * @internal: Maybe there should be a idle TCP PCB list where these
- * PCBs are put on. We can then implement port reservation using
- * tcp_bind(). Currently, we lack this (BSD socket type of) feature.
- */
-
-struct tcp_pcb *
-tcp_new(void)
-{
-  return tcp_alloc(TCP_PRIO_NORMAL);
-}
-
-/*
- * tcp_arg():
- *
- * Used to specify the argument that should be passed callback
- * functions.
- *
- */ 
-
-void
-tcp_arg(struct tcp_pcb *pcb, void *arg)
-{  
-  pcb->callback_arg = arg;
-}
-#if LWIP_CALLBACK_API
-
-/**
- * Used to specify the function that should be called when a TCP
- * connection receives data.
- *
- */ 
-void
-tcp_recv(struct tcp_pcb *pcb,
-   err_t (* recv)(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err))
-{
-  pcb->recv = recv;
-}
-
-/**
- * Used to specify the function that should be called when TCP data
- * has been successfully delivered to the remote host.
- *
- */ 
-
-void
-tcp_sent(struct tcp_pcb *pcb,
-   err_t (* sent)(void *arg, struct tcp_pcb *tpcb, u16_t len))
-{
-  pcb->sent = sent;
-}
-
-/**
- * Used to specify the function that should be called when a fatal error
- * has occured on the connection.
- *
- */ 
-void
-tcp_err(struct tcp_pcb *pcb,
-   void (* errf)(void *arg, err_t err))
-{
-  pcb->errf = errf;
-}
-
-/**
- * Used for specifying the function that should be called when a
- * LISTENing connection has been connected to another host.
- *
- */ 
-void
-tcp_accept(struct tcp_pcb *pcb,
-     err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err))
-{
-  ((struct tcp_pcb_listen *)pcb)->accept = accept;
-}
-#endif /* LWIP_CALLBACK_API */
-
-
-/**
- * Used to specify the function that should be called periodically
- * from TCP. The interval is specified in terms of the TCP coarse
- * timer interval, which is called twice a second.
- *
- */ 
-void
-tcp_poll(struct tcp_pcb *pcb,
-   err_t (* poll)(void *arg, struct tcp_pcb *tpcb), u8_t interval)
-{
-#if LWIP_CALLBACK_API
-  pcb->poll = poll;
-#endif /* LWIP_CALLBACK_API */  
-  pcb->pollinterval = interval;
-}
-
-/**
- * Purges a TCP PCB. Removes any buffered data and frees the buffer memory.
- *
- */
-void
-tcp_pcb_purge(struct tcp_pcb *pcb)
-{
-  if (pcb->state != CLOSED &&
-     pcb->state != TIME_WAIT &&
-     pcb->state != LISTEN) {
-
-    LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge\n"));
-    
-    if (pcb->unsent != NULL) {    
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: not all data sent\n"));
-    }
-    if (pcb->unacked != NULL) {    
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->unacked\n"));
-    }
-#if TCP_QUEUE_OOSEQ /* LW */
-    if (pcb->ooseq != NULL) {    
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->ooseq\n"));
-    }
-    
-    tcp_segs_free(pcb->ooseq);
-    pcb->ooseq = NULL;
-#endif /* TCP_QUEUE_OOSEQ */
-    tcp_segs_free(pcb->unsent);
-    tcp_segs_free(pcb->unacked);
-    pcb->unacked = pcb->unsent = NULL;
-  }
-}
-
-/**
- * Purges the PCB and removes it from a PCB list. Any delayed ACKs are sent first.
- *
- */
-void
-tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
-{
-  TCP_RMV(pcblist, pcb);
-
-  tcp_pcb_purge(pcb);
-  
-  /* if there is an outstanding delayed ACKs, send it */
-  if (pcb->state != TIME_WAIT &&
-     pcb->state != LISTEN &&
-     pcb->flags & TF_ACK_DELAY) {
-    pcb->flags |= TF_ACK_NOW;
-    tcp_output(pcb);
-  }  
-  pcb->state = CLOSED;
-
-  LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane());
-}
-
-/**
- * Calculates a new initial sequence number for new connections.
- *
- */
-u32_t
-tcp_next_iss(void)
-{
-  static u32_t iss = 6510;
-  
-  iss += tcp_ticks;       /* XXX */
-  return iss;
-}
-
-#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
-void
-tcp_debug_print(struct tcp_hdr *tcphdr)
-{
-  LWIP_DEBUGF(TCP_DEBUG, ("TCP header:\n"));
-  LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(TCP_DEBUG, ("|    %5"U16_F"      |    %5"U16_F"      | (src port, dest port)\n",
-         ntohs(tcphdr->src), ntohs(tcphdr->dest)));
-  LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(TCP_DEBUG, ("|           %010"U32_F"          | (seq no)\n",
-          ntohl(tcphdr->seqno)));
-  LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(TCP_DEBUG, ("|           %010"U32_F"          | (ack no)\n",
-         ntohl(tcphdr->ackno)));
-  LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(TCP_DEBUG, ("| %2"U16_F" |   |%"U16_F"%"U16_F"%"U16_F"%"U16_F"%"U16_F"%"U16_F"|     %5"U16_F"     | (hdrlen, flags (",
-       TCPH_HDRLEN(tcphdr),
-         TCPH_FLAGS(tcphdr) >> 5 & 1,
-         TCPH_FLAGS(tcphdr) >> 4 & 1,
-         TCPH_FLAGS(tcphdr) >> 3 & 1,
-         TCPH_FLAGS(tcphdr) >> 2 & 1,
-         TCPH_FLAGS(tcphdr) >> 1 & 1,
-         TCPH_FLAGS(tcphdr) & 1,
-         ntohs(tcphdr->wnd)));
-  tcp_debug_print_flags(TCPH_FLAGS(tcphdr));
-  LWIP_DEBUGF(TCP_DEBUG, ("), win)\n"));
-  LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(TCP_DEBUG, ("|    0x%04"X16_F"     |     %5"U16_F"     | (chksum, urgp)\n",
-         ntohs(tcphdr->chksum), ntohs(tcphdr->urgp)));
-  LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n"));
-}
-
-void
-tcp_debug_print_state(enum tcp_state s)
-{
-  LWIP_DEBUGF(TCP_DEBUG, ("State: "));
-  switch (s) {
-  case CLOSED:
-    LWIP_DEBUGF(TCP_DEBUG, ("CLOSED\n"));
-    break;
- case LISTEN:
-   LWIP_DEBUGF(TCP_DEBUG, ("LISTEN\n"));
-   break;
-  case SYN_SENT:
-    LWIP_DEBUGF(TCP_DEBUG, ("SYN_SENT\n"));
-    break;
-  case SYN_RCVD:
-    LWIP_DEBUGF(TCP_DEBUG, ("SYN_RCVD\n"));
-    break;
-  case ESTABLISHED:
-    LWIP_DEBUGF(TCP_DEBUG, ("ESTABLISHED\n"));
-    break;
-  case FIN_WAIT_1:
-    LWIP_DEBUGF(TCP_DEBUG, ("FIN_WAIT_1\n"));
-    break;
-  case FIN_WAIT_2:
-    LWIP_DEBUGF(TCP_DEBUG, ("FIN_WAIT_2\n"));
-    break;
-  case CLOSE_WAIT:
-    LWIP_DEBUGF(TCP_DEBUG, ("CLOSE_WAIT\n"));
-    break;
-  case CLOSING:
-    LWIP_DEBUGF(TCP_DEBUG, ("CLOSING\n"));
-    break;
-  case LAST_ACK:
-    LWIP_DEBUGF(TCP_DEBUG, ("LAST_ACK\n"));
-    break;
-  case TIME_WAIT:
-    LWIP_DEBUGF(TCP_DEBUG, ("TIME_WAIT\n"));
-   break;
-  }
-}
-
-void
-tcp_debug_print_flags(u8_t flags)
-{
-  if (flags & TCP_FIN) {
-    LWIP_DEBUGF(TCP_DEBUG, ("FIN "));
-  }
-  if (flags & TCP_SYN) {
-    LWIP_DEBUGF(TCP_DEBUG, ("SYN "));
-  }
-  if (flags & TCP_RST) {
-    LWIP_DEBUGF(TCP_DEBUG, ("RST "));
-  }
-  if (flags & TCP_PSH) {
-    LWIP_DEBUGF(TCP_DEBUG, ("PSH "));
-  }
-  if (flags & TCP_ACK) {
-    LWIP_DEBUGF(TCP_DEBUG, ("ACK "));
-  }
-  if (flags & TCP_URG) {
-    LWIP_DEBUGF(TCP_DEBUG, ("URG "));
-  }
-  if (flags & TCP_ECE) {
-    LWIP_DEBUGF(TCP_DEBUG, ("ECE "));
-  }
-  if (flags & TCP_CWR) {
-    LWIP_DEBUGF(TCP_DEBUG, ("CWR "));
-  }
-}
-
-void
-tcp_debug_print_pcbs(void)
-{
-  struct tcp_pcb *pcb;
-  LWIP_DEBUGF(TCP_DEBUG, ("Active PCB states:\n"));
-  for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
-    LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ",
-                       pcb->local_port, pcb->remote_port,
-                       pcb->snd_nxt, pcb->rcv_nxt));
-    tcp_debug_print_state(pcb->state);
-  }    
-  LWIP_DEBUGF(TCP_DEBUG, ("Listen PCB states:\n"));
-  for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) {
-    LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ",
-                       pcb->local_port, pcb->remote_port,
-                       pcb->snd_nxt, pcb->rcv_nxt));
-    tcp_debug_print_state(pcb->state);
-  }    
-  LWIP_DEBUGF(TCP_DEBUG, ("TIME-WAIT PCB states:\n"));
-  for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
-    LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ",
-                       pcb->local_port, pcb->remote_port,
-                       pcb->snd_nxt, pcb->rcv_nxt));
-    tcp_debug_print_state(pcb->state);
-  }    
-}
-
-s16_t
-tcp_pcbs_sane(void)
-{
-  struct tcp_pcb *pcb;
-  for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
-    LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != CLOSED", pcb->state != CLOSED);
-    LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != LISTEN", pcb->state != LISTEN);
-    LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT);
-  }
-  for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
-    LWIP_ASSERT("tcp_pcbs_sane: tw pcb->state == TIME-WAIT", pcb->state == TIME_WAIT);
-  }
-  return 1;
-}
-#endif /* TCP_DEBUG */
-#endif /* LWIP_TCP */
-
-
-
-
-
-
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/tcp_in.c b/src/VBox/Devices/Network/lwip/src/core/tcp_in.c
deleted file mode 100644
index f6a3b87..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/tcp_in.c
+++ /dev/null
@@ -1,1209 +0,0 @@
-/**
- * @file
- *
- * Transmission Control Protocol, incoming traffic
- *
- * The input processing functions of the TCP layer.
- *
- * These functions are generally called in the order (ip_input() ->)
- * tcp_input() -> * tcp_process() -> tcp_receive() (-> application).
- * 
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include "lwip/def.h"
-#include "lwip/opt.h"
-
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-#include "lwip/mem.h"
-#include "lwip/memp.h"
-
-#include "lwip/inet.h"
-#include "lwip/tcp.h"
-
-#include "lwip/stats.h"
-#include "arch/perf.h"
-#include "lwip/snmp.h"
-
-#if LWIP_TCP
-/* These variables are global to all functions involved in the input
-   processing of TCP segments. They are set by the tcp_input()
-   function. */
-static struct tcp_seg inseg;
-static struct tcp_hdr *tcphdr;
-static struct ip_hdr *iphdr;
-static u32_t seqno, ackno;
-static u8_t flags;
-static u16_t tcplen;
-
-static u8_t recv_flags;
-static struct pbuf *recv_data;
-
-struct tcp_pcb *tcp_input_pcb;
-
-/* Forward declarations. */
-static err_t tcp_process(struct tcp_pcb *pcb);
-static u8_t tcp_receive(struct tcp_pcb *pcb);
-static void tcp_parseopt(struct tcp_pcb *pcb);
-
-static err_t tcp_listen_input(struct tcp_pcb_listen *pcb);
-static err_t tcp_timewait_input(struct tcp_pcb *pcb);
-
-/* tcp_input:
- *
- * The initial input processing of TCP. It verifies the TCP header, demultiplexes
- * the segment between the PCBs and passes it on to tcp_process(), which implements
- * the TCP finite state machine. This function is called by the IP layer (in
- * ip_input()).
- */
-
-void
-tcp_input(struct pbuf *p, struct netif *inp)
-{
-  struct tcp_pcb *pcb, *prev;
-  struct tcp_pcb_listen *lpcb;
-  u8_t hdrlen;
-  err_t err;
-
-  PERF_START;
-
-  TCP_STATS_INC(tcp.recv);
-  snmp_inc_tcpinsegs();
-
-  iphdr = p->payload;
-  tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4);
-
-#if TCP_INPUT_DEBUG
-  tcp_debug_print(tcphdr);
-#endif
-
-  /* remove header from payload */
-  if (pbuf_header(p, -((s16_t)(IPH_HL(iphdr) * 4))) || (p->tot_len < sizeof(struct tcp_hdr))) {
-    /* drop short packets */
-    LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: short packet (%"U16_F" bytes) discarded\n", p->tot_len));
-    TCP_STATS_INC(tcp.lenerr);
-    TCP_STATS_INC(tcp.drop);
-    pbuf_free(p);
-    return;
-  }
-
-  /* Don't even process incoming broadcasts/multicasts. */
-  if (ip_addr_isbroadcast(&(iphdr->dest), inp) ||
-      ip_addr_ismulticast(&(iphdr->dest))) {
-    snmp_inc_tcpinerrs();
-    pbuf_free(p);
-    return;
-  }
-
-#if CHECKSUM_CHECK_TCP
-  /* Verify TCP checksum. */
-  if (inet_chksum_pseudo(p, (struct ip_addr *)&(iphdr->src),
-      (struct ip_addr *)&(iphdr->dest),
-      IP_PROTO_TCP, p->tot_len) != 0) {
-      LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packet discarded due to failing checksum 0x%04"X16_F"\n",
-        inet_chksum_pseudo(p, (struct ip_addr *)&(iphdr->src), (struct ip_addr *)&(iphdr->dest),
-      IP_PROTO_TCP, p->tot_len)));
-#if TCP_DEBUG
-    tcp_debug_print(tcphdr);
-#endif /* TCP_DEBUG */
-    TCP_STATS_INC(tcp.chkerr);
-    TCP_STATS_INC(tcp.drop);
-    snmp_inc_tcpinerrs();
-    pbuf_free(p);
-    return;
-  }
-#endif
-
-  /* Move the payload pointer in the pbuf so that it points to the
-     TCP data instead of the TCP header. */
-  hdrlen = TCPH_HDRLEN(tcphdr);
-  pbuf_header(p, -(hdrlen * 4));
-
-  /* Convert fields in TCP header to host byte order. */
-  tcphdr->src = ntohs(tcphdr->src);
-  tcphdr->dest = ntohs(tcphdr->dest);
-  seqno = tcphdr->seqno = ntohl(tcphdr->seqno);
-  ackno = tcphdr->ackno = ntohl(tcphdr->ackno);
-  tcphdr->wnd = ntohs(tcphdr->wnd);
-
-  flags = TCPH_FLAGS(tcphdr) & TCP_FLAGS;
-  tcplen = p->tot_len + ((flags & TCP_FIN || flags & TCP_SYN)? 1: 0);
-
-  /* Demultiplex an incoming segment. First, we check if it is destined
-     for an active connection. */
-  prev = NULL;
-
-  
-  for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
-    LWIP_ASSERT("tcp_input: active pcb->state != CLOSED", pcb->state != CLOSED);
-    LWIP_ASSERT("tcp_input: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT);
-    LWIP_ASSERT("tcp_input: active pcb->state != LISTEN", pcb->state != LISTEN);
-    if (pcb->remote_port == tcphdr->src &&
-       pcb->local_port == tcphdr->dest &&
-       ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src)) &&
-       ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest))) {
-
-      /* Move this PCB to the front of the list so that subsequent
-         lookups will be faster (we exploit locality in TCP segment
-         arrivals). */
-      LWIP_ASSERT("tcp_input: pcb->next != pcb (before cache)", pcb->next != pcb);
-      if (prev != NULL) {
-        prev->next = pcb->next;
-        pcb->next = tcp_active_pcbs;
-        tcp_active_pcbs = pcb;
-      }
-      LWIP_ASSERT("tcp_input: pcb->next != pcb (after cache)", pcb->next != pcb);
-      break;
-    }
-    prev = pcb;
-  }
-
-  if (pcb == NULL) {
-    /* If it did not go to an active connection, we check the connections
-       in the TIME-WAIT state. */
-    for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
-      LWIP_ASSERT("tcp_input: TIME-WAIT pcb->state == TIME-WAIT", pcb->state == TIME_WAIT);
-      if (pcb->remote_port == tcphdr->src &&
-         pcb->local_port == tcphdr->dest &&
-         ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src)) &&
-         ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest))) {
-        /* We don't really care enough to move this PCB to the front
-           of the list since we are not very likely to receive that
-           many segments for connections in TIME-WAIT. */
-        LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for TIME_WAITing connection.\n"));
-        tcp_timewait_input(pcb);
-        pbuf_free(p);
-        return;
-      }
-    }
-
-  /* Finally, if we still did not get a match, we check all PCBs that
-     are LISTENing for incoming connections. */
-    prev = NULL;
-    for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
-      if ((ip_addr_isany(&(lpcb->local_ip)) ||
-        ip_addr_cmp(&(lpcb->local_ip), &(iphdr->dest))) &&
-        lpcb->local_port == tcphdr->dest) {
-        /* Move this PCB to the front of the list so that subsequent
-           lookups will be faster (we exploit locality in TCP segment
-           arrivals). */
-        if (prev != NULL) {
-          ((struct tcp_pcb_listen *)prev)->next = lpcb->next;
-                /* our successor is the remainder of the listening list */
-          lpcb->next = tcp_listen_pcbs.listen_pcbs;
-                /* put this listening pcb at the head of the listening list */
-          tcp_listen_pcbs.listen_pcbs = lpcb;
-        }
-      
-        LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n"));
-        tcp_listen_input(lpcb);
-        pbuf_free(p);
-        return;
-      }
-      prev = (struct tcp_pcb *)lpcb;
-    }
-  }
-
-#if TCP_INPUT_DEBUG
-  LWIP_DEBUGF(TCP_INPUT_DEBUG, ("+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags "));
-  tcp_debug_print_flags(TCPH_FLAGS(tcphdr));
-  LWIP_DEBUGF(TCP_INPUT_DEBUG, ("-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n"));
-#endif /* TCP_INPUT_DEBUG */
-
-
-  if (pcb != NULL) {
-    /* The incoming segment belongs to a connection. */
-#if TCP_INPUT_DEBUG
-#if TCP_DEBUG
-    tcp_debug_print_state(pcb->state);
-#endif /* TCP_DEBUG */
-#endif /* TCP_INPUT_DEBUG */
-
-    /* Set up a tcp_seg structure. */
-    inseg.next = NULL;
-    inseg.len = p->tot_len;
-    inseg.dataptr = p->payload;
-    inseg.p = p;
-    inseg.tcphdr = tcphdr;
-
-    recv_data = NULL;
-    recv_flags = 0;
-
-    tcp_input_pcb = pcb;
-    err = tcp_process(pcb);
-    tcp_input_pcb = NULL;
-    /* A return value of ERR_ABRT means that tcp_abort() was called
-       and that the pcb has been freed. If so, we don't do anything. */
-    if (err != ERR_ABRT) {
-      if (recv_flags & TF_RESET) {
-        /* TF_RESET means that the connection was reset by the other
-           end. We then call the error callback to inform the
-           application that the connection is dead before we
-           deallocate the PCB. */
-        TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_RST);
-        tcp_pcb_remove(&tcp_active_pcbs, pcb);
-        memp_free(MEMP_TCP_PCB, pcb);
-            } else if (recv_flags & TF_CLOSED) {
-        /* The connection has been closed and we will deallocate the
-           PCB. */
-        tcp_pcb_remove(&tcp_active_pcbs, pcb);
-        memp_free(MEMP_TCP_PCB, pcb);
-            } else {
-        err = ERR_OK;
-        /* If the application has registered a "sent" function to be
-           called when new send buffer space is available, we call it
-           now. */
-        if (pcb->acked > 0) {
-          TCP_EVENT_SENT(pcb, pcb->acked, err);
-        }
-      
-        if (recv_data != NULL) {
-          /* Notify application that data has been received. */
-          TCP_EVENT_RECV(pcb, recv_data, ERR_OK, err);
-        }
-      
-        /* If a FIN segment was received, we call the callback
-           function with a NULL buffer to indicate EOF. */
-        if (recv_flags & TF_GOT_FIN) {
-          TCP_EVENT_RECV(pcb, NULL, ERR_OK, err);
-        }
-        /* If there were no errors, we try to send something out. */
-        if (err == ERR_OK) {
-          tcp_output(pcb);
-        }
-      }
-    }
-
-
-    /* give up our reference to inseg.p */
-    if (inseg.p != NULL)
-    {
-      pbuf_free(inseg.p);
-      inseg.p = NULL;
-    }
-#if TCP_INPUT_DEBUG
-#if TCP_DEBUG
-    tcp_debug_print_state(pcb->state);
-#endif /* TCP_DEBUG */
-#endif /* TCP_INPUT_DEBUG */
-      
-  } else {
-
-    /* If no matching PCB was found, send a TCP RST (reset) to the
-       sender. */
-    LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_input: no PCB match found, resetting.\n"));
-    if (!(TCPH_FLAGS(tcphdr) & TCP_RST)) {
-      TCP_STATS_INC(tcp.proterr);
-      TCP_STATS_INC(tcp.drop);
-      tcp_rst(ackno, seqno + tcplen,
-        &(iphdr->dest), &(iphdr->src),
-        tcphdr->dest, tcphdr->src);
-    }
-    pbuf_free(p);
-  }
-
-  LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane());
-  PERF_STOP("tcp_input");
-}
-
-/* tcp_listen_input():
- *
- * Called by tcp_input() when a segment arrives for a listening
- * connection.
- */
-
-static err_t
-tcp_listen_input(struct tcp_pcb_listen *pcb)
-{
-  struct tcp_pcb *npcb;
-  u32_t optdata;
-
-  /* In the LISTEN state, we check for incoming SYN segments,
-     creates a new PCB, and responds with a SYN|ACK. */
-  if (flags & TCP_ACK) {
-    /* For incoming segments with the ACK flag set, respond with a
-       RST. */
-    LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_listen_input: ACK in LISTEN, sending reset\n"));
-    tcp_rst(ackno + 1, seqno + tcplen,
-      &(iphdr->dest), &(iphdr->src),
-      tcphdr->dest, tcphdr->src);
-  } else if (flags & TCP_SYN) {
-    LWIP_DEBUGF(TCP_DEBUG, ("TCP connection request %"U16_F" -> %"U16_F".\n", tcphdr->src, tcphdr->dest));
-    npcb = tcp_alloc(pcb->prio);
-    /* If a new PCB could not be created (probably due to lack of memory),
-       we don't do anything, but rely on the sender will retransmit the
-       SYN at a time when we have more memory available. */
-    if (npcb == NULL) {
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n"));
-      TCP_STATS_INC(tcp.memerr);
-      return ERR_MEM;
-    }
-    /* Set up the new PCB. */
-    ip_addr_set(&(npcb->local_ip), &(iphdr->dest));
-    npcb->local_port = pcb->local_port;
-    ip_addr_set(&(npcb->remote_ip), &(iphdr->src));
-    npcb->remote_port = tcphdr->src;
-    npcb->state = SYN_RCVD;
-    npcb->rcv_nxt = seqno + 1;
-    npcb->snd_wnd = tcphdr->wnd;
-    npcb->ssthresh = npcb->snd_wnd;
-    npcb->snd_wl1 = seqno - 1;/* initialise to seqno-1 to force window update */
-    npcb->callback_arg = pcb->callback_arg;
-#if LWIP_CALLBACK_API
-    npcb->accept = pcb->accept;
-#endif /* LWIP_CALLBACK_API */
-    /* inherit socket options */
-    npcb->so_options = pcb->so_options & (SOF_DEBUG|SOF_DONTROUTE|SOF_KEEPALIVE|SOF_OOBINLINE|SOF_LINGER);
-    /* Register the new PCB so that we can begin receiving segments
-       for it. */
-    TCP_REG(&tcp_active_pcbs, npcb);
-
-    /* Parse any options in the SYN. */
-    tcp_parseopt(npcb);
-
-    snmp_inc_tcppassiveopens();
-
-    /* Build an MSS option. */
-    optdata = htonl(((u32_t)2 << 24) |
-        ((u32_t)4 << 16) |
-        (((u32_t)npcb->mss / 256) << 8) |
-        (npcb->mss & 255));
-    /* Send a SYN|ACK together with the MSS option. */
-    tcp_enqueue(npcb, NULL, 0, TCP_SYN | TCP_ACK, 0, (u8_t *)&optdata, 4);
-    return tcp_output(npcb);
-  }
-  return ERR_OK;
-}
-
-/* tcp_timewait_input():
- *
- * Called by tcp_input() when a segment arrives for a connection in
- * TIME_WAIT.
- */
-
-static err_t
-tcp_timewait_input(struct tcp_pcb *pcb)
-{
-  if (TCP_SEQ_GT(seqno + tcplen, pcb->rcv_nxt)) {
-    pcb->rcv_nxt = seqno + tcplen;
-  }
-  if (tcplen > 0) {
-    tcp_ack_now(pcb);
-  }
-  return tcp_output(pcb);
-}
-
-/* tcp_process
- *
- * Implements the TCP state machine. Called by tcp_input. In some
- * states tcp_receive() is called to receive data. The tcp_seg
- * argument will be freed by the caller (tcp_input()) unless the
- * recv_data pointer in the pcb is set.
- */
-
-static err_t
-tcp_process(struct tcp_pcb *pcb)
-{
-  struct tcp_seg *rseg;
-  u8_t acceptable = 0;
-  err_t err;
-  u8_t accepted_inseq;
-
-  err = ERR_OK;
-
-  /* Process incoming RST segments. */
-  if (flags & TCP_RST) {
-    /* First, determine if the reset is acceptable. */
-    if (pcb->state == SYN_SENT) {
-      if (ackno == pcb->snd_nxt) {
-        acceptable = 1;
-      }
-    } else {
-      /*if (TCP_SEQ_GEQ(seqno, pcb->rcv_nxt) &&
-          TCP_SEQ_LEQ(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) {
-      */
-      if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt+pcb->rcv_wnd)) {
-        acceptable = 1;
-      }
-    }
-
-    if (acceptable) {
-      LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_process: Connection RESET\n"));
-      LWIP_ASSERT("tcp_input: pcb->state != CLOSED", pcb->state != CLOSED);
-      recv_flags = TF_RESET;
-      pcb->flags &= ~TF_ACK_DELAY;
-      return ERR_RST;
-    } else {
-      LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_process: unacceptable reset seqno %"U32_F" rcv_nxt %"U32_F"\n",
-       seqno, pcb->rcv_nxt));
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_process: unacceptable reset seqno %"U32_F" rcv_nxt %"U32_F"\n",
-       seqno, pcb->rcv_nxt));
-      return ERR_OK;
-    }
-  }
-
-  /* Update the PCB (in)activity timer. */
-  pcb->tmr = tcp_ticks;
-  pcb->keep_cnt = 0;
-
-  /* Do different things depending on the TCP state. */
-  switch (pcb->state) {
-  case SYN_SENT:
-    LWIP_DEBUGF(TCP_INPUT_DEBUG, ("SYN-SENT: ackno %"U32_F" pcb->snd_nxt %"U32_F" unacked %"U32_F"\n", ackno,
-     pcb->snd_nxt, ntohl(pcb->unacked->tcphdr->seqno)));
-    /* received SYN ACK with expected sequence number? */
-    if ((flags & TCP_ACK) && (flags & TCP_SYN)
-        && ackno == ntohl(pcb->unacked->tcphdr->seqno) + 1) {
-      pcb->snd_buf++;
-      pcb->rcv_nxt = seqno + 1;
-      pcb->lastack = ackno;
-      pcb->snd_wnd = tcphdr->wnd;
-      pcb->snd_wl1 = seqno - 1; /* initialise to seqno - 1 to force window update */
-      pcb->state = ESTABLISHED;
-      pcb->cwnd = pcb->mss;
-      --pcb->snd_queuelen;
-      LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_process: SYN-SENT --queuelen %"U16_F"\n", (u16_t)pcb->snd_queuelen));
-      rseg = pcb->unacked;
-      pcb->unacked = rseg->next;
-      tcp_seg_free(rseg);
-
-      /* Parse any options in the SYNACK. */
-      tcp_parseopt(pcb);
-
-      /* Call the user specified function to call when sucessfully
-       * connected. */
-      TCP_EVENT_CONNECTED(pcb, ERR_OK, err);
-      tcp_ack(pcb);
-    }
-    /* received ACK? possibly a half-open connection */
-    else if (flags & TCP_ACK) {
-      /* send a RST to bring the other side in a non-synchronized state. */
-      tcp_rst(ackno, seqno + tcplen, &(iphdr->dest), &(iphdr->src),
-        tcphdr->dest, tcphdr->src);
-    }
-    break;
-  case SYN_RCVD:
-    if (flags & TCP_ACK &&
-       !(flags & TCP_RST)) {
-      /* expected ACK number? */
-      if (TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_nxt)) {
-        pcb->state = ESTABLISHED;
-        LWIP_DEBUGF(TCP_DEBUG, ("TCP connection established %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
-#if LWIP_CALLBACK_API
-        LWIP_ASSERT("pcb->accept != NULL", pcb->accept != NULL);
-#endif
-        /* Call the accept function. */
-        TCP_EVENT_ACCEPT(pcb, ERR_OK, err);
-        if (err != ERR_OK) {
-          /* If the accept function returns with an error, we abort
-           * the connection. */
-          tcp_abort(pcb);
-          return ERR_ABRT;
-        }
-        /* If there was any data contained within this ACK,
-         * we'd better pass it on to the application as well. */
-        tcp_receive(pcb);
-        pcb->cwnd = pcb->mss;
-      }
-      /* incorrect ACK number */
-      else {
-        /* send RST */
-        tcp_rst(ackno, seqno + tcplen, &(iphdr->dest), &(iphdr->src),
-          tcphdr->dest, tcphdr->src);
-      }
-    }
-    break;
-  case CLOSE_WAIT:
-    /* FALLTHROUGH */
-  case ESTABLISHED:
-    accepted_inseq = tcp_receive(pcb);
-    if ((flags & TCP_FIN) && accepted_inseq) { /* passive close */
-      tcp_ack_now(pcb);
-      pcb->state = CLOSE_WAIT;
-    }
-    break;
-  case FIN_WAIT_1:
-    tcp_receive(pcb);
-    if (flags & TCP_FIN) {
-      if (flags & TCP_ACK && ackno == pcb->snd_nxt) {
-        LWIP_DEBUGF(TCP_DEBUG,
-          ("TCP connection closed %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
-        tcp_ack_now(pcb);
-        tcp_pcb_purge(pcb);
-        TCP_RMV(&tcp_active_pcbs, pcb);
-        pcb->state = TIME_WAIT;
-        TCP_REG(&tcp_tw_pcbs, pcb);
-      } else {
-        tcp_ack_now(pcb);
-        pcb->state = CLOSING;
-      }
-    } else if (flags & TCP_ACK && ackno == pcb->snd_nxt) {
-      pcb->state = FIN_WAIT_2;
-    }
-    break;
-  case FIN_WAIT_2:
-    tcp_receive(pcb);
-    if (flags & TCP_FIN) {
-      LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
-      tcp_ack_now(pcb);
-      tcp_pcb_purge(pcb);
-      TCP_RMV(&tcp_active_pcbs, pcb);
-      pcb->state = TIME_WAIT;
-      TCP_REG(&tcp_tw_pcbs, pcb);
-    }
-    break;
-  case CLOSING:
-    tcp_receive(pcb);
-    if (flags & TCP_ACK && ackno == pcb->snd_nxt) {
-      LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
-      tcp_ack_now(pcb);
-      tcp_pcb_purge(pcb);
-      TCP_RMV(&tcp_active_pcbs, pcb);
-      pcb->state = TIME_WAIT;
-      TCP_REG(&tcp_tw_pcbs, pcb);
-    }
-    break;
-  case LAST_ACK:
-    tcp_receive(pcb);
-    if (flags & TCP_ACK && ackno == pcb->snd_nxt) {
-      LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest));
-      pcb->state = CLOSED;
-      recv_flags = TF_CLOSED;
-    }
-    break;
-  default:
-    break;
-  }
-  return ERR_OK;
-}
-
-/* tcp_receive:
- *
- * Called by tcp_process. Checks if the given segment is an ACK for outstanding
- * data, and if so frees the memory of the buffered data. Next, is places the
- * segment on any of the receive queues (pcb->recved or pcb->ooseq). If the segment
- * is buffered, the pbuf is referenced by pbuf_ref so that it will not be freed until
- * i it has been removed from the buffer.
- *
- * If the incoming segment constitutes an ACK for a segment that was used for RTT
- * estimation, the RTT is estimated here as well.
- *
- * @return 1 if 
- */
-
-static u8_t
-tcp_receive(struct tcp_pcb *pcb)
-{
-  struct tcp_seg *next;
-#if TCP_QUEUE_OOSEQ
-  struct tcp_seg *prev, *cseg;
-#endif
-  struct pbuf *p;
-  s32_t off;
-  s16_t m;
-  u32_t right_wnd_edge;
-  u16_t new_tot_len;
-  u8_t accepted_inseq = 0;
-
-  if (flags & TCP_ACK) {
-    right_wnd_edge = pcb->snd_wnd + pcb->snd_wl1;
-
-    /* Update window. */
-    if (TCP_SEQ_LT(pcb->snd_wl1, seqno) ||
-       (pcb->snd_wl1 == seqno && TCP_SEQ_LT(pcb->snd_wl2, ackno)) ||
-       (pcb->snd_wl2 == ackno && tcphdr->wnd > pcb->snd_wnd)) {
-      pcb->snd_wnd = tcphdr->wnd;
-      pcb->snd_wl1 = seqno;
-      pcb->snd_wl2 = ackno;
-      LWIP_DEBUGF(TCP_WND_DEBUG, ("tcp_receive: window update %"U32_F"\n", pcb->snd_wnd));
-#if TCP_WND_DEBUG
-    } else {
-      if (pcb->snd_wnd != tcphdr->wnd) {
-        LWIP_DEBUGF(TCP_WND_DEBUG, ("tcp_receive: no window update lastack %"U32_F" snd_max %"U32_F" ackno %"U32_F" wl1 %"U32_F" seqno %"U32_F" wl2 %"U32_F"\n",
-                               pcb->lastack, pcb->snd_max, ackno, pcb->snd_wl1, seqno, pcb->snd_wl2));
-      }
-#endif /* TCP_WND_DEBUG */
-    }
-
-    if (pcb->lastack == ackno) {
-      pcb->acked = 0;
-
-      if (pcb->snd_wl1 + pcb->snd_wnd == right_wnd_edge){
-        ++pcb->dupacks;
-        if (pcb->dupacks >= 3 && pcb->unacked != NULL) {
-          if (!(pcb->flags & TF_INFR)) {
-            /* This is fast retransmit. Retransmit the first unacked segment. */
-            LWIP_DEBUGF(TCP_FR_DEBUG, ("tcp_receive: dupacks %"U16_F" (%"U32_F"), fast retransmit %"U32_F"\n",
-                                       (u16_t)pcb->dupacks, pcb->lastack,
-                                       ntohl(pcb->unacked->tcphdr->seqno)));
-            tcp_rexmit(pcb);
-            /* Set ssthresh to max (FlightSize / 2, 2*SMSS) */
-            /*pcb->ssthresh = LWIP_MAX((pcb->snd_max -
-                                      pcb->lastack) / 2,
-                                      2 * pcb->mss);*/
-            /* Set ssthresh to half of the minimum of the currenct cwnd and the advertised window */
-            if (pcb->cwnd > pcb->snd_wnd)
-              pcb->ssthresh = pcb->snd_wnd / 2;
-            else
-              pcb->ssthresh = pcb->cwnd / 2;
-
-            pcb->cwnd = pcb->ssthresh + 3 * pcb->mss;
-            pcb->flags |= TF_INFR;
-          } else {
-            /* Inflate the congestion window, but not if it means that
-               the value overflows. */
-            if ((u16_t)(pcb->cwnd + pcb->mss) > pcb->cwnd) {
-              pcb->cwnd += pcb->mss;
-            }
-          }
-        }
-      } else {
-        LWIP_DEBUGF(TCP_FR_DEBUG, ("tcp_receive: dupack averted %"U32_F" %"U32_F"\n",
-                                   pcb->snd_wl1 + pcb->snd_wnd, right_wnd_edge));
-      }
-    } else
-      /*if (TCP_SEQ_LT(pcb->lastack, ackno) &&
-        TCP_SEQ_LEQ(ackno, pcb->snd_max)) { */
-      if (TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_max)){
-      /* We come here when the ACK acknowledges new data. */
-      
-      /* Reset the "IN Fast Retransmit" flag, since we are no longer
-         in fast retransmit. Also reset the congestion window to the
-         slow start threshold. */
-      if (pcb->flags & TF_INFR) {
-        pcb->flags &= ~TF_INFR;
-        pcb->cwnd = pcb->ssthresh;
-      }
-
-      /* Reset the number of retransmissions. */
-      pcb->nrtx = 0;
-
-      /* Reset the retransmission time-out. */
-      pcb->rto = (pcb->sa >> 3) + pcb->sv;
-
-      /* Update the send buffer space. */
-      pcb->acked = ackno - pcb->lastack;
-
-      pcb->snd_buf += pcb->acked;
-
-      /* Reset the fast retransmit variables. */
-      pcb->dupacks = 0;
-      pcb->lastack = ackno;
-
-      /* Update the congestion control variables (cwnd and
-         ssthresh). */
-      if (pcb->state >= ESTABLISHED) {
-        if (pcb->cwnd < pcb->ssthresh) {
-          if ((u16_t)(pcb->cwnd + pcb->mss) > pcb->cwnd) {
-            pcb->cwnd += pcb->mss;
-          }
-          LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_receive: slow start cwnd %"U16_F"\n", pcb->cwnd));
-        } else {
-          u16_t new_cwnd = (pcb->cwnd + pcb->mss * pcb->mss / pcb->cwnd);
-          if (new_cwnd > pcb->cwnd) {
-            pcb->cwnd = new_cwnd;
-          }
-          LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_receive: congestion avoidance cwnd %"U16_F"\n", pcb->cwnd));
-        }
-      }
-      LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: ACK for %"U32_F", unacked->seqno %"U32_F":%"U32_F"\n",
-                                    ackno,
-                                    pcb->unacked != NULL?
-                                    ntohl(pcb->unacked->tcphdr->seqno): 0,
-                                    pcb->unacked != NULL?
-                                    ntohl(pcb->unacked->tcphdr->seqno) + TCP_TCPLEN(pcb->unacked): 0));
-
-      /* Remove segment from the unacknowledged list if the incoming
-         ACK acknowlegdes them. */
-      while (pcb->unacked != NULL &&
-             TCP_SEQ_LEQ(ntohl(pcb->unacked->tcphdr->seqno) +
-                         TCP_TCPLEN(pcb->unacked), ackno)) {
-        LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: removing %"U32_F":%"U32_F" from pcb->unacked\n",
-                                      ntohl(pcb->unacked->tcphdr->seqno),
-                                      ntohl(pcb->unacked->tcphdr->seqno) +
-                                      TCP_TCPLEN(pcb->unacked)));
-
-        next = pcb->unacked;
-        pcb->unacked = pcb->unacked->next;
-
-        LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_receive: queuelen %"U16_F" ... ", (u16_t)pcb->snd_queuelen));
-        pcb->snd_queuelen -= pbuf_clen(next->p);
-        tcp_seg_free(next);
-
-        LWIP_DEBUGF(TCP_QLEN_DEBUG, ("%"U16_F" (after freeing unacked)\n", (u16_t)pcb->snd_queuelen));
-        if (pcb->snd_queuelen != 0) {
-          LWIP_ASSERT("tcp_receive: valid queue length", pcb->unacked != NULL ||
-                      pcb->unsent != NULL);
-        }
-      }
-      pcb->polltmr = 0;
-    }
-
-    /* We go through the ->unsent list to see if any of the segments
-       on the list are acknowledged by the ACK. This may seem
-       strange since an "unsent" segment shouldn't be acked. The
-       rationale is that lwIP puts all outstanding segments on the
-       ->unsent list after a retransmission, so these segments may
-       in fact have been sent once. */
-    while (pcb->unsent != NULL &&
-           /*TCP_SEQ_LEQ(ntohl(pcb->unsent->tcphdr->seqno) + TCP_TCPLEN(pcb->unsent), ackno) &&
-             TCP_SEQ_LEQ(ackno, pcb->snd_max)*/
-           TCP_SEQ_BETWEEN(ackno, ntohl(pcb->unsent->tcphdr->seqno) + TCP_TCPLEN(pcb->unsent), pcb->snd_max)
-           ) {
-      LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: removing %"U32_F":%"U32_F" from pcb->unsent\n",
-                                    ntohl(pcb->unsent->tcphdr->seqno), ntohl(pcb->unsent->tcphdr->seqno) +
-                                    TCP_TCPLEN(pcb->unsent)));
-
-      next = pcb->unsent;
-      pcb->unsent = pcb->unsent->next;
-      LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_receive: queuelen %"U16_F" ... ", (u16_t)pcb->snd_queuelen));
-      pcb->snd_queuelen -= pbuf_clen(next->p);
-      tcp_seg_free(next);
-      LWIP_DEBUGF(TCP_QLEN_DEBUG, ("%"U16_F" (after freeing unsent)\n", (u16_t)pcb->snd_queuelen));
-      if (pcb->snd_queuelen != 0) {
-        LWIP_ASSERT("tcp_receive: valid queue length",
-          pcb->unacked != NULL || pcb->unsent != NULL);
-      }
-
-      if (pcb->unsent != NULL) {
-        pcb->snd_nxt = htonl(pcb->unsent->tcphdr->seqno);
-      }
-    }
-    /* End of ACK for new data processing. */
-
-    LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_receive: pcb->rttest %"U32_F" rtseq %"U32_F" ackno %"U32_F"\n",
-                                pcb->rttest, pcb->rtseq, ackno));
-
-    /* RTT estimation calculations. This is done by checking if the
-       incoming segment acknowledges the segment we use to take a
-       round-trip time measurement. */
-    if (pcb->rttest && TCP_SEQ_LT(pcb->rtseq, ackno)) {
-      m = tcp_ticks - pcb->rttest;
-
-      LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_receive: experienced rtt %"U16_F" ticks (%"U16_F" msec).\n",
-                                  m, m * TCP_SLOW_INTERVAL));
-
-      /* This is taken directly from VJs original code in his paper */
-      m = m - (pcb->sa >> 3);
-      pcb->sa += m;
-      if (m < 0) {
-        m = -m;
-      }
-      m = m - (pcb->sv >> 2);
-      pcb->sv += m;
-      pcb->rto = (pcb->sa >> 3) + pcb->sv;
-
-      LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_receive: RTO %"U16_F" (%"U16_F" miliseconds)\n",
-                                  pcb->rto, pcb->rto * TCP_SLOW_INTERVAL));
-
-      pcb->rttest = 0;
-    }
-  }
-
-  /* If the incoming segment contains data, we must process it
-     further. */
-  if (tcplen > 0) {
-    /* This code basically does three things:
-
-    +) If the incoming segment contains data that is the next
-    in-sequence data, this data is passed to the application. This
-    might involve trimming the first edge of the data. The rcv_nxt
-    variable and the advertised window are adjusted.
-
-    +) If the incoming segment has data that is above the next
-    sequence number expected (->rcv_nxt), the segment is placed on
-    the ->ooseq queue. This is done by finding the appropriate
-    place in the ->ooseq queue (which is ordered by sequence
-    number) and trim the segment in both ends if needed. An
-    immediate ACK is sent to indicate that we received an
-    out-of-sequence segment.
-
-    +) Finally, we check if the first segment on the ->ooseq queue
-    now is in sequence (i.e., if rcv_nxt >= ooseq->seqno). If
-    rcv_nxt > ooseq->seqno, we must trim the first edge of the
-    segment on ->ooseq before we adjust rcv_nxt. The data in the
-    segments that are now on sequence are chained onto the
-    incoming segment so that we only need to call the application
-    once.
-    */
-
-    /* First, we check if we must trim the first edge. We have to do
-       this if the sequence number of the incoming segment is less
-       than rcv_nxt, and the sequence number plus the length of the
-       segment is larger than rcv_nxt. */
-    /*    if (TCP_SEQ_LT(seqno, pcb->rcv_nxt)){
-          if (TCP_SEQ_LT(pcb->rcv_nxt, seqno + tcplen)) {*/
-    if (TCP_SEQ_BETWEEN(pcb->rcv_nxt, seqno + 1, seqno + tcplen - 1)){
-      /* Trimming the first edge is done by pushing the payload
-         pointer in the pbuf downwards. This is somewhat tricky since
-         we do not want to discard the full contents of the pbuf up to
-         the new starting point of the data since we have to keep the
-         TCP header which is present in the first pbuf in the chain.
-         
-         What is done is really quite a nasty hack: the first pbuf in
-         the pbuf chain is pointed to by inseg.p. Since we need to be
-         able to deallocate the whole pbuf, we cannot change this
-         inseg.p pointer to point to any of the later pbufs in the
-         chain. Instead, we point the ->payload pointer in the first
-         pbuf to data in one of the later pbufs. We also set the
-         inseg.data pointer to point to the right place. This way, the
-         ->p pointer will still point to the first pbuf, but the
-         ->p->payload pointer will point to data in another pbuf.
-         
-         After we are done with adjusting the pbuf pointers we must
-         adjust the ->data pointer in the seg and the segment
-         length.*/
-      
-      off = pcb->rcv_nxt - seqno;
-      p = inseg.p;
-      LWIP_ASSERT("inseg.p != NULL", inseg.p);
-      if (inseg.p->len < off) {
-        new_tot_len = inseg.p->tot_len - off;
-        while (p->len < off) {
-          off -= p->len;
-          /* KJM following line changed (with addition of new_tot_len var)
-             to fix bug #9076
-             inseg.p->tot_len -= p->len; */
-          p->tot_len = new_tot_len;
-          p->len = 0;
-          p = p->next;
-        }
-        pbuf_header(p, -off);
-      } else {
-        pbuf_header(inseg.p, -off);
-      }
-      /* KJM following line changed to use p->payload rather than inseg->p->payload
-         to fix bug #9076 */
-      inseg.dataptr = p->payload;
-      inseg.len -= pcb->rcv_nxt - seqno;
-      inseg.tcphdr->seqno = seqno = pcb->rcv_nxt;
-    }
-    else {
-      if (TCP_SEQ_LT(seqno, pcb->rcv_nxt)){
-        /* the whole segment is < rcv_nxt */
-        /* must be a duplicate of a packet that has already been correctly handled */
-        
-        LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: duplicate seqno %"U32_F"\n", seqno));
-        tcp_ack_now(pcb);
-      }
-    }
-
-    /* The sequence number must be within the window (above rcv_nxt
-       and below rcv_nxt + rcv_wnd) in order to be further
-       processed. */
-    /*if (TCP_SEQ_GEQ(seqno, pcb->rcv_nxt) &&
-      TCP_SEQ_LT(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) {*/
-    if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd - 1)){
-      if (pcb->rcv_nxt == seqno) {
-        accepted_inseq = 1; 
-        /* The incoming segment is the next in sequence. We check if
-           we have to trim the end of the segment and update rcv_nxt
-           and pass the data to the application. */
-#if TCP_QUEUE_OOSEQ
-        if (pcb->ooseq != NULL &&
-            TCP_SEQ_LEQ(pcb->ooseq->tcphdr->seqno, seqno + inseg.len)) {
-          /* We have to trim the second edge of the incoming
-             segment. */
-          inseg.len = pcb->ooseq->tcphdr->seqno - seqno;
-          pbuf_realloc(inseg.p, inseg.len);
-        }
-#endif /* TCP_QUEUE_OOSEQ */
-
-        tcplen = TCP_TCPLEN(&inseg);
-
-        /* First received FIN will be ACKed +1, on any successive (duplicate)
-         * FINs we are already in CLOSE_WAIT and have already done +1.
-         */
-        if (pcb->state != CLOSE_WAIT) {
-          pcb->rcv_nxt += tcplen;
-        }
-
-        /* Update the receiver's (our) window. */
-        if (pcb->rcv_wnd < tcplen) {
-          pcb->rcv_wnd = 0;
-        } else {
-          pcb->rcv_wnd -= tcplen;
-        }
-
-        /* If there is data in the segment, we make preparations to
-           pass this up to the application. The ->recv_data variable
-           is used for holding the pbuf that goes to the
-           application. The code for reassembling out-of-sequence data
-           chains its data on this pbuf as well.
-
-           If the segment was a FIN, we set the TF_GOT_FIN flag that will
-           be used to indicate to the application that the remote side has
-           closed its end of the connection. */
-        if (inseg.p->tot_len > 0) {
-          recv_data = inseg.p;
-          /* Since this pbuf now is the responsibility of the
-             application, we delete our reference to it so that we won't
-             (mistakingly) deallocate it. */
-          inseg.p = NULL;
-        }
-        if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) {
-          LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: received FIN.\n"));
-          recv_flags = TF_GOT_FIN;
-        }
-
-#if TCP_QUEUE_OOSEQ
-        /* We now check if we have segments on the ->ooseq queue that
-           is now in sequence. */
-        while (pcb->ooseq != NULL &&
-               pcb->ooseq->tcphdr->seqno == pcb->rcv_nxt) {
-
-          cseg = pcb->ooseq;
-          seqno = pcb->ooseq->tcphdr->seqno;
-
-          pcb->rcv_nxt += TCP_TCPLEN(cseg);
-          if (pcb->rcv_wnd < TCP_TCPLEN(cseg)) {
-            pcb->rcv_wnd = 0;
-          } else {
-            pcb->rcv_wnd -= TCP_TCPLEN(cseg);
-          }
-          if (cseg->p->tot_len > 0) {
-            /* Chain this pbuf onto the pbuf that we will pass to
-               the application. */
-            if (recv_data) {
-              pbuf_cat(recv_data, cseg->p);
-            } else {
-              recv_data = cseg->p;
-            }
-            cseg->p = NULL;
-          }
-          if (TCPH_FLAGS(cseg->tcphdr) & TCP_FIN) {
-            LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: dequeued FIN.\n"));
-            recv_flags = TF_GOT_FIN;
-            if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */
-              pcb->state = CLOSE_WAIT;
-            } 
-          }
-
-
-          pcb->ooseq = cseg->next;
-          tcp_seg_free(cseg);
-        }
-#endif /* TCP_QUEUE_OOSEQ */
-
-
-        /* Acknowledge the segment(s). */
-        tcp_ack(pcb);
-
-      } else {
-        /* We get here if the incoming segment is out-of-sequence. */
-        tcp_ack_now(pcb);
-#if TCP_QUEUE_OOSEQ
-        /* We queue the segment on the ->ooseq queue. */
-        if (pcb->ooseq == NULL) {
-          pcb->ooseq = tcp_seg_copy(&inseg);
-        } else {
-          /* If the queue is not empty, we walk through the queue and
-             try to find a place where the sequence number of the
-             incoming segment is between the sequence numbers of the
-             previous and the next segment on the ->ooseq queue. That is
-             the place where we put the incoming segment. If needed, we
-             trim the second edges of the previous and the incoming
-             segment so that it will fit into the sequence.
-
-             If the incoming segment has the same sequence number as a
-             segment on the ->ooseq queue, we discard the segment that
-             contains less data. */
-
-          prev = NULL;
-          for(next = pcb->ooseq; next != NULL; next = next->next) {
-            if (seqno == next->tcphdr->seqno) {
-              /* The sequence number of the incoming segment is the
-                 same as the sequence number of the segment on
-                 ->ooseq. We check the lengths to see which one to
-                 discard. */
-              if (inseg.len > next->len) {
-                /* The incoming segment is larger than the old
-                   segment. We replace the old segment with the new
-                   one. */
-                cseg = tcp_seg_copy(&inseg);
-                if (cseg != NULL) {
-                  cseg->next = next->next;
-                  if (prev != NULL) {
-                    prev->next = cseg;
-                  } else {
-                    pcb->ooseq = cseg;
-                  }
-                }
-                break;
-              } else {
-                /* Either the lenghts are the same or the incoming
-                   segment was smaller than the old one; in either
-                   case, we ditch the incoming segment. */
-                break;
-              }
-            } else {
-              if (prev == NULL) {
-                if (TCP_SEQ_LT(seqno, next->tcphdr->seqno)) {
-                  /* The sequence number of the incoming segment is lower
-                     than the sequence number of the first segment on the
-                     queue. We put the incoming segment first on the
-                     queue. */
-
-                  if (TCP_SEQ_GT(seqno + inseg.len, next->tcphdr->seqno)) {
-                    /* We need to trim the incoming segment. */
-                    inseg.len = next->tcphdr->seqno - seqno;
-                    pbuf_realloc(inseg.p, inseg.len);
-                  }
-                  cseg = tcp_seg_copy(&inseg);
-                  if (cseg != NULL) {
-                    cseg->next = next;
-                    pcb->ooseq = cseg;
-                  }
-                  break;
-                }
-              } else 
-                /*if (TCP_SEQ_LT(prev->tcphdr->seqno, seqno) &&
-                  TCP_SEQ_LT(seqno, next->tcphdr->seqno)) {*/
-                if(TCP_SEQ_BETWEEN(seqno, prev->tcphdr->seqno+1, next->tcphdr->seqno-1)){
-                /* The sequence number of the incoming segment is in
-                   between the sequence numbers of the previous and
-                   the next segment on ->ooseq. We trim and insert the
-                   incoming segment and trim the previous segment, if
-                   needed. */
-                if (TCP_SEQ_GT(seqno + inseg.len, next->tcphdr->seqno)) {
-                  /* We need to trim the incoming segment. */
-                  inseg.len = next->tcphdr->seqno - seqno;
-                  pbuf_realloc(inseg.p, inseg.len);
-                }
-
-                cseg = tcp_seg_copy(&inseg);
-                if (cseg != NULL) {
-                  cseg->next = next;
-                  prev->next = cseg;
-                  if (TCP_SEQ_GT(prev->tcphdr->seqno + prev->len, seqno)) {
-                    /* We need to trim the prev segment. */
-                    prev->len = seqno - prev->tcphdr->seqno;
-                    pbuf_realloc(prev->p, prev->len);
-                  }
-                }
-                break;
-              }
-              /* If the "next" segment is the last segment on the
-                 ooseq queue, we add the incoming segment to the end
-                 of the list. */
-              if (next->next == NULL &&
-                  TCP_SEQ_GT(seqno, next->tcphdr->seqno)) {
-                next->next = tcp_seg_copy(&inseg);
-                if (next->next != NULL) {
-                  if (TCP_SEQ_GT(next->tcphdr->seqno + next->len, seqno)) {
-                    /* We need to trim the last segment. */
-                    next->len = seqno - next->tcphdr->seqno;
-                    pbuf_realloc(next->p, next->len);
-                  }
-                }
-                break;
-              }
-            }
-            prev = next;
-          }
-        }
-#endif /* TCP_QUEUE_OOSEQ */
-
-      }
-    } else {
-      /*if (TCP_SEQ_GT(pcb->rcv_nxt, seqno) ||
-        TCP_SEQ_GEQ(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) {*/
-      if(!TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd-1)){
-        tcp_ack_now(pcb);
-      }
-    }
-  } else {
-    /* Segments with length 0 is taken care of here. Segments that
-       fall out of the window are ACKed. */
-    /*if (TCP_SEQ_GT(pcb->rcv_nxt, seqno) ||
-      TCP_SEQ_GEQ(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) {*/
-    if(!TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd-1)){
-      tcp_ack_now(pcb);
-    }
-  }
-  return accepted_inseq;
-}
-
-/*
- * tcp_parseopt:
- *
- * Parses the options contained in the incoming segment. (Code taken
- * from uIP with only small changes.)
- *
- */
-
-static void
-tcp_parseopt(struct tcp_pcb *pcb)
-{
-  u8_t c;
-  u8_t *opts, opt;
-  u16_t mss;
-
-  opts = (u8_t *)tcphdr + TCP_HLEN;
-
-  /* Parse the TCP MSS option, if present. */
-  if(TCPH_HDRLEN(tcphdr) > 0x5) {
-    for(c = 0; c < (TCPH_HDRLEN(tcphdr) - 5) << 2 ;) {
-      opt = opts[c];
-      if (opt == 0x00) {
-        /* End of options. */
-  break;
-      } else if (opt == 0x01) {
-        ++c;
-        /* NOP option. */
-      } else if (opt == 0x02 &&
-        opts[c + 1] == 0x04) {
-        /* An MSS option with the right option length. */
-        mss = (opts[c + 2] << 8) | opts[c + 3];
-        pcb->mss = mss > TCP_MSS? TCP_MSS: mss;
-
-        /* And we are done processing options. */
-        break;
-      } else {
-  if (opts[c + 1] == 0) {
-          /* If the length field is zero, the options are malformed
-             and we don't process them further. */
-          break;
-        }
-        /* All other options have a length field, so that we easily
-           can skip past them. */
-        c += opts[c + 1];
-      }
-    }
-  }
-}
-#endif /* LWIP_TCP */
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/tcp_out.c b/src/VBox/Devices/Network/lwip/src/core/tcp_out.c
deleted file mode 100644
index 409110a..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/tcp_out.c
+++ /dev/null
@@ -1,727 +0,0 @@
-/**
- * @file
- *
- * Transmission Control Protocol, outgoing traffic
- *
- * The output functions of TCP.
- *
- */
-
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#include <string.h>
-
-#include "lwip/def.h"
-#include "lwip/opt.h"
-#include "lwip/mem.h"
-#include "lwip/memp.h"
-#include "lwip/sys.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-#include "lwip/inet.h"
-#include "lwip/tcp.h"
-#include "lwip/stats.h"
-#include "lwip/snmp.h"
-
-#if LWIP_TCP
-
-/* Forward declarations.*/
-static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb);
-
-err_t
-tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
-{
-  /* no data, no length, flags, copy=1, no optdata, no optdatalen */
-  return tcp_enqueue(pcb, NULL, 0, flags, 1, NULL, 0);
-}
-
-/**
- * Write data for sending (but does not send it immediately).
- *
- * It waits in the expectation of more data being sent soon (as
- * it can send them more efficiently by combining them together).
- * To prompt the system to send data now, call tcp_output() after
- * calling tcp_write().
- * 
- * @arg pcb Protocol control block of the TCP connection to enqueue data for. 
- * 
- * @see tcp_write()
- */
-
-err_t
-tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t copy)
-{
-  LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write(pcb=%p, arg=%p, len=%"U16_F", copy=%"U16_F")\n", (void *)pcb,
-    arg, len, (u16_t)copy));
-  /* connection is in valid state for data transmission? */
-  if (pcb->state == ESTABLISHED ||
-     pcb->state == CLOSE_WAIT ||
-     pcb->state == SYN_SENT ||
-     pcb->state == SYN_RCVD) {
-    if (len > 0) {
-      return tcp_enqueue(pcb, (void *)arg, len, 0, copy, NULL, 0);
-    }
-    return ERR_OK;
-  } else {
-    LWIP_DEBUGF(TCP_OUTPUT_DEBUG | DBG_STATE | 3, ("tcp_write() called in invalid state\n"));
-    return ERR_CONN;
-  }
-}
-
-/**
- * Enqueue either data or TCP options (but not both) for tranmission
- * 
- * 
- * 
- * @arg pcb Protocol control block for the TCP connection to enqueue data for.
- * @arg arg Pointer to the data to be enqueued for sending.
- * @arg len Data length in bytes
- * @arg flags
- * @arg copy 1 if data must be copied, 0 if data is non-volatile and can be
- * referenced.
- * @arg optdata
- * @arg optlen
- */
-err_t
-tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
-  u8_t flags, u8_t copy,
-  u8_t *optdata, u8_t optlen)
-{
-  struct pbuf *p;
-  struct tcp_seg *seg, *useg, *queue;
-  u32_t left, seqno;
-  u16_t seglen;
-  void *ptr;
-  u8_t queuelen;
-
-  LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue(pcb=%p, arg=%p, len=%"U16_F", flags=%"X16_F", copy=%"U16_F")\n",
-    (void *)pcb, arg, len, (u16_t)flags, (u16_t)copy));
-  LWIP_ASSERT("tcp_enqueue: len == 0 || optlen == 0 (programmer violates API)",
-      len == 0 || optlen == 0);
-  LWIP_ASSERT("tcp_enqueue: arg == NULL || optdata == NULL (programmer violates API)",
-      arg == NULL || optdata == NULL);
-  /* fail on too much data */
-  if (len > pcb->snd_buf) {
-    LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_enqueue: too much data (len=%"U16_F" > snd_buf=%"U16_F")\n", len, pcb->snd_buf));
-    return ERR_MEM;
-  }
-  left = len;
-  ptr = arg;
-
-  /* seqno will be the sequence number of the first segment enqueued
-   * by the call to this function. */
-  seqno = pcb->snd_lbb;
-
-  LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: queuelen: %"U16_F"\n", (u16_t)pcb->snd_queuelen));
-
-  /* If total number of pbufs on the unsent/unacked queues exceeds the
-   * configured maximum, return an error */
-  queuelen = pcb->snd_queuelen;
-  if (queuelen >= TCP_SND_QUEUELEN) {
-    LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_enqueue: too long queue %"U16_F" (max %"U16_F")\n", queuelen, TCP_SND_QUEUELEN));
-    TCP_STATS_INC(tcp.memerr);
-    return ERR_MEM;
-  }
-  if (queuelen != 0) {
-    LWIP_ASSERT("tcp_enqueue: pbufs on queue => at least one queue non-empty",
-      pcb->unacked != NULL || pcb->unsent != NULL);
-  } else {
-    LWIP_ASSERT("tcp_enqueue: no pbufs on queue => both queues empty",
-      pcb->unacked == NULL && pcb->unsent == NULL);
-  }
-
-  /* First, break up the data into segments and tuck them together in
-   * the local "queue" variable. */
-  useg = queue = seg = NULL;
-  seglen = 0;
-  while (queue == NULL || left > 0) {
-
-    /* The segment length should be the MSS if the data to be enqueued
-     * is larger than the MSS. */
-    seglen = left > pcb->mss? pcb->mss: left;
-
-    /* Allocate memory for tcp_seg, and fill in fields. */
-    seg = memp_malloc(MEMP_TCP_SEG);
-    if (seg == NULL) {
-      LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for tcp_seg\n"));
-      goto memerr;
-    }
-    seg->next = NULL;
-    seg->p = NULL;
-
-    /* first segment of to-be-queued data? */
-    if (queue == NULL) {
-      queue = seg;
-    }
-    /* subsequent segments of to-be-queued data */
-    else {
-      /* Attach the segment to the end of the queued segments */
-      LWIP_ASSERT("useg != NULL", useg != NULL);
-      useg->next = seg;
-    }
-    /* remember last segment of to-be-queued data for next iteration */
-    useg = seg;
-
-    /* If copy is set, memory should be allocated
-     * and data copied into pbuf, otherwise data comes from
-     * ROM or other static memory, and need not be copied. If
-     * optdata is != NULL, we have options instead of data. */
-     
-    /* options? */
-    if (optdata != NULL) {
-      if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) {
-        goto memerr;
-      }
-      ++queuelen;
-      seg->dataptr = seg->p->payload;
-    }
-    /* copy from volatile memory? */
-    else if (copy) {
-      if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_RAM)) == NULL) {
-        LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue : could not allocate memory for pbuf copy size %"U16_F"\n", seglen));
-        goto memerr;
-      }
-      ++queuelen;
-      if (arg != NULL) {
-        memcpy(seg->p->payload, ptr, seglen);
-      }
-      seg->dataptr = seg->p->payload;
-    }
-    /* do not copy data */
-    else {
-      /* First, allocate a pbuf for holding the data.
-       * since the referenced data is available at least until it is sent out on the
-       * link (as it has to be ACKed by the remote party) we can safely use PBUF_ROM
-       * instead of PBUF_REF here.
-       */
-      if ((p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_ROM)) == NULL) {
-        LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for zero-copy pbuf\n"));
-        goto memerr;
-      }
-      ++queuelen;
-      /* reference the non-volatile payload data */
-      p->payload = ptr;
-      seg->dataptr = ptr;
-
-      /* Second, allocate a pbuf for the headers. */
-      if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM)) == NULL) {
-        /* If allocation fails, we have to deallocate the data pbuf as
-         * well. */
-        pbuf_free(p);
-        LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for header pbuf\n"));
-        goto memerr;
-      }
-      ++queuelen;
-
-      /* Concatenate the headers and data pbufs together. */
-      pbuf_cat(seg->p/*header*/, p/*data*/);
-      p = NULL;
-    }
-
-    /* Now that there are more segments queued, we check again if the
-    length of the queue exceeds the configured maximum. */
-    if (queuelen > TCP_SND_QUEUELEN) {
-      LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: queue too long %"U16_F" (%"U16_F")\n", queuelen, TCP_SND_QUEUELEN));
-      goto memerr;
-    }
-
-    seg->len = seglen;
-
-    /* build TCP header */
-    if (pbuf_header(seg->p, TCP_HLEN)) {
-      LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: no room for TCP header in pbuf.\n"));
-      TCP_STATS_INC(tcp.err);
-      goto memerr;
-    }
-    seg->tcphdr = seg->p->payload;
-    seg->tcphdr->src = htons(pcb->local_port);
-    seg->tcphdr->dest = htons(pcb->remote_port);
-    seg->tcphdr->seqno = htonl(seqno);
-    seg->tcphdr->urgp = 0;
-    TCPH_FLAGS_SET(seg->tcphdr, flags);
-    /* don't fill in tcphdr->ackno and tcphdr->wnd until later */
-
-    /* Copy the options into the header, if they are present. */
-    if (optdata == NULL) {
-      TCPH_HDRLEN_SET(seg->tcphdr, 5);
-    }
-    else {
-      TCPH_HDRLEN_SET(seg->tcphdr, (5 + optlen / 4));
-      /* Copy options into data portion of segment.
-       Options can thus only be sent in non data carrying
-       segments such as SYN|ACK. */
-      memcpy(seg->dataptr, optdata, optlen);
-    }
-    LWIP_DEBUGF(TCP_OUTPUT_DEBUG | DBG_TRACE, ("tcp_enqueue: queueing %"U32_F":%"U32_F" (0x%"X16_F")\n",
-      ntohl(seg->tcphdr->seqno),
-      ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg),
-      (u16_t)flags));
-
-    left -= seglen;
-    seqno += seglen;
-    ptr = (void *)((u8_t *)ptr + seglen);
-  }
-
-  /* Now that the data to be enqueued has been broken up into TCP
-  segments in the queue variable, we add them to the end of the
-  pcb->unsent queue. */
-  if (pcb->unsent == NULL) {
-    useg = NULL;
-  }
-  else {
-    for (useg = pcb->unsent; useg->next != NULL; useg = useg->next);
-  }
-  /* { useg is last segment on the unsent queue, NULL if list is empty } */
-
-  /* If there is room in the last pbuf on the unsent queue,
-  chain the first pbuf on the queue together with that. */
-  if (useg != NULL &&
-    TCP_TCPLEN(useg) != 0 &&
-    !(TCPH_FLAGS(useg->tcphdr) & (TCP_SYN | TCP_FIN)) &&
-    !(flags & (TCP_SYN | TCP_FIN)) &&
-    /* fit within max seg size */
-    useg->len + queue->len <= pcb->mss) {
-    /* Remove TCP header from first segment of our to-be-queued list */
-    pbuf_header(queue->p, -TCP_HLEN);
-    pbuf_cat(useg->p, queue->p);
-    useg->len += queue->len;
-    useg->next = queue->next;
-
-    LWIP_DEBUGF(TCP_OUTPUT_DEBUG | DBG_TRACE | DBG_STATE, ("tcp_enqueue: chaining segments, new len %"U16_F"\n", useg->len));
-    if (seg == queue) {
-      seg = NULL;
-    }
-    memp_free(MEMP_TCP_SEG, queue);
-  }
-  else {
-    /* empty list */
-    if (useg == NULL) {
-      /* initialize list with this segment */
-      pcb->unsent = queue;
-    }
-    /* enqueue segment */
-    else {
-      useg->next = queue;
-    }
-  }
-  if ((flags & TCP_SYN) || (flags & TCP_FIN)) {
-    ++len;
-  }
-  pcb->snd_lbb += len;
-
-  pcb->snd_buf -= len;
-
-  /* update number of segments on the queues */
-  pcb->snd_queuelen = queuelen;
-  LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: %"S16_F" (after enqueued)\n", pcb->snd_queuelen));
-  if (pcb->snd_queuelen != 0) {
-    LWIP_ASSERT("tcp_enqueue: valid queue length",
-      pcb->unacked != NULL || pcb->unsent != NULL);
-  }
-
-  /* Set the PSH flag in the last segment that we enqueued, but only
-  if the segment has data (indicated by seglen > 0). */
-  if (seg != NULL && seglen > 0 && seg->tcphdr != NULL) {
-    TCPH_SET_FLAG(seg->tcphdr, TCP_PSH);
-  }
-
-  return ERR_OK;
-memerr:
-  TCP_STATS_INC(tcp.memerr);
-
-  if (queue != NULL) {
-    tcp_segs_free(queue);
-  }
-  if (pcb->snd_queuelen != 0) {
-    LWIP_ASSERT("tcp_enqueue: valid queue length", pcb->unacked != NULL ||
-      pcb->unsent != NULL);
-  }
-  LWIP_DEBUGF(TCP_QLEN_DEBUG | DBG_STATE, ("tcp_enqueue: %"S16_F" (with mem err)\n", pcb->snd_queuelen));
-  return ERR_MEM;
-}
-
-/* find out what we can send and send it */
-err_t
-tcp_output(struct tcp_pcb *pcb)
-{
-  struct pbuf *p;
-  struct tcp_hdr *tcphdr;
-  struct tcp_seg *seg, *useg;
-  u32_t wnd;
-#if TCP_CWND_DEBUG
-  s16_t i = 0;
-#endif /* TCP_CWND_DEBUG */
-
-  /* First, check if we are invoked by the TCP input processing
-     code. If so, we do not output anything. Instead, we rely on the
-     input processing code to call us when input processing is done
-     with. */
-  if (tcp_input_pcb == pcb) {
-    return ERR_OK;
-  }
-
-  wnd = LWIP_MIN(pcb->snd_wnd, pcb->cwnd);
-
-  seg = pcb->unsent;
-
-  /* useg should point to last segment on unacked queue */
-  useg = pcb->unacked;
-  if (useg != NULL) {
-    for (; useg->next != NULL; useg = useg->next);
-  }                                                                             
-   
-  /* If the TF_ACK_NOW flag is set and no data will be sent (either
-   * because the ->unsent queue is empty or because the window does
-   * not allow it), construct an empty ACK segment and send it.
-   *
-   * If data is to be sent, we will just piggyback the ACK (see below).
-   */
-  if (pcb->flags & TF_ACK_NOW &&
-     (seg == NULL ||
-      ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len > wnd)) {
-    p = pbuf_alloc(PBUF_IP, TCP_HLEN, PBUF_RAM);
-    if (p == NULL) {
-      LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: (ACK) could not allocate pbuf\n"));
-      return ERR_BUF;
-    }
-    LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: sending ACK for %"U32_F"\n", pcb->rcv_nxt));
-    /* remove ACK flags from the PCB, as we send an empty ACK now */
-    pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW);
-
-    tcphdr = p->payload;
-    tcphdr->src = htons(pcb->local_port);
-    tcphdr->dest = htons(pcb->remote_port);
-    tcphdr->seqno = htonl(pcb->snd_nxt);
-    tcphdr->ackno = htonl(pcb->rcv_nxt);
-    TCPH_FLAGS_SET(tcphdr, TCP_ACK);
-    tcphdr->wnd = htons(pcb->rcv_wnd);
-    tcphdr->urgp = 0;
-    TCPH_HDRLEN_SET(tcphdr, 5);
-
-    tcphdr->chksum = 0;
-#if CHECKSUM_GEN_TCP
-    tcphdr->chksum = inet_chksum_pseudo(p, &(pcb->local_ip), &(pcb->remote_ip),
-          IP_PROTO_TCP, p->tot_len);
-#endif
-    ip_output(p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos,
-        IP_PROTO_TCP);
-    pbuf_free(p);
-
-    return ERR_OK;
-  }
-
-#if TCP_OUTPUT_DEBUG
-  if (seg == NULL) {
-    LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: nothing to send (%p)\n", (void*)pcb->unsent));
-  }
-#endif /* TCP_OUTPUT_DEBUG */
-#if TCP_CWND_DEBUG
-  if (seg == NULL) {
-    LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"U32_F", cwnd %"U16_F", wnd %"U32_F", seg == NULL, ack %"U32_F"\n",
-                            pcb->snd_wnd, pcb->cwnd, wnd,
-                            pcb->lastack));
-  } else {
-    LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"U32_F", cwnd %"U16_F", wnd %"U32_F", effwnd %"U32_F", seq %"U32_F", ack %"U32_F"\n",
-                            pcb->snd_wnd, pcb->cwnd, wnd,
-                            ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len,
-                            ntohl(seg->tcphdr->seqno), pcb->lastack));
-  }
-#endif /* TCP_CWND_DEBUG */
-  /* data available and window allows it to be sent? */
-  while (seg != NULL &&
-  ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) {
-#if TCP_CWND_DEBUG
-    LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"U32_F", cwnd %"U16_F", wnd %"U32_F", effwnd %"U32_F", seq %"U32_F", ack %"U32_F", i %"S16_F"\n",
-                            pcb->snd_wnd, pcb->cwnd, wnd,
-                            ntohl(seg->tcphdr->seqno) + seg->len -
-                            pcb->lastack,
-                            ntohl(seg->tcphdr->seqno), pcb->lastack, i));
-    ++i;
-#endif /* TCP_CWND_DEBUG */
-
-    pcb->unsent = seg->next;
-
-    if (pcb->state != SYN_SENT) {
-      TCPH_SET_FLAG(seg->tcphdr, TCP_ACK);
-      pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW);
-    }
-
-    tcp_output_segment(seg, pcb);
-    pcb->snd_nxt = ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg);
-    if (TCP_SEQ_LT(pcb->snd_max, pcb->snd_nxt)) {
-      pcb->snd_max = pcb->snd_nxt;
-    }
-    /* put segment on unacknowledged list if length > 0 */
-    if (TCP_TCPLEN(seg) > 0) {
-      seg->next = NULL;
-      /* unacked list is empty? */
-      if (pcb->unacked == NULL) {
-        pcb->unacked = seg;
-        useg = seg;
-      /* unacked list is not empty? */
-      } else {
-        /* In the case of fast retransmit, the packet should not go to the tail
-         * of the unacked queue, but rather at the head. We need to check for
-         * this case. -STJ Jul 27, 2004 */
-        if (TCP_SEQ_LT(ntohl(seg->tcphdr->seqno), ntohl(useg->tcphdr->seqno))){
-          /* add segment to head of unacked list */
-          seg->next = pcb->unacked;
-          pcb->unacked = seg;
-        } else {
-          /* add segment to tail of unacked list */
-          useg->next = seg;
-          useg = useg->next;
-        }
-      }
-    /* do not queue empty segments on the unacked list */
-    } else {
-      tcp_seg_free(seg);
-    }
-    seg = pcb->unsent;
-  }
-  return ERR_OK;
-}
-
-/**
- * Actually send a TCP segment over IP
- */
-static void
-tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
-{
-  u16_t len;
-  struct netif *netif;
-
-  /** @bug Exclude retransmitted segments from this count. */
-  snmp_inc_tcpoutsegs();
-
-  /* The TCP header has already been constructed, but the ackno and
-   wnd fields remain. */
-  seg->tcphdr->ackno = htonl(pcb->rcv_nxt);
-
-  /* silly window avoidance */
-  if (pcb->rcv_wnd < pcb->mss) {
-    seg->tcphdr->wnd = 0;
-  } else {
-    /* advertise our receive window size in this TCP segment */
-    seg->tcphdr->wnd = htons(pcb->rcv_wnd);
-  }
-
-  /* If we don't have a local IP address, we get one by
-     calling ip_route(). */
-  if (ip_addr_isany(&(pcb->local_ip))) {
-    netif = ip_route(&(pcb->remote_ip));
-    if (netif == NULL) {
-      return;
-    }
-    ip_addr_set(&(pcb->local_ip), &(netif->ip_addr));
-  }
-
-  pcb->rtime = 0;
-
-  if (pcb->rttest == 0) {
-    pcb->rttest = tcp_ticks;
-    pcb->rtseq = ntohl(seg->tcphdr->seqno);
-
-    LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_output_segment: rtseq %"U32_F"\n", pcb->rtseq));
-  }
-  LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output_segment: %"U32_F":%"U32_F"\n",
-          htonl(seg->tcphdr->seqno), htonl(seg->tcphdr->seqno) +
-          seg->len));
-
-  len = (u16_t)((u8_t *)seg->tcphdr - (u8_t *)seg->p->payload);
-
-  seg->p->len -= len;
-  seg->p->tot_len -= len;
-
-  seg->p->payload = seg->tcphdr;
-
-  seg->tcphdr->chksum = 0;
-#if CHECKSUM_GEN_TCP
-  seg->tcphdr->chksum = inet_chksum_pseudo(seg->p,
-             &(pcb->local_ip),
-             &(pcb->remote_ip),
-             IP_PROTO_TCP, seg->p->tot_len);
-#endif
-  TCP_STATS_INC(tcp.xmit);
-
-  ip_output(seg->p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos,
-      IP_PROTO_TCP);
-}
-
-void
-tcp_rst(u32_t seqno, u32_t ackno,
-  struct ip_addr *local_ip, struct ip_addr *remote_ip,
-  u16_t local_port, u16_t remote_port)
-{
-  struct pbuf *p;
-  struct tcp_hdr *tcphdr;
-  p = pbuf_alloc(PBUF_IP, TCP_HLEN, PBUF_RAM);
-  if (p == NULL) {
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_rst: could not allocate memory for pbuf\n"));
-      return;
-  }
-
-  tcphdr = p->payload;
-  tcphdr->src = htons(local_port);
-  tcphdr->dest = htons(remote_port);
-  tcphdr->seqno = htonl(seqno);
-  tcphdr->ackno = htonl(ackno);
-  TCPH_FLAGS_SET(tcphdr, TCP_RST | TCP_ACK);
-  tcphdr->wnd = htons(TCP_WND);
-  tcphdr->urgp = 0;
-  TCPH_HDRLEN_SET(tcphdr, 5);
-
-  tcphdr->chksum = 0;
-#if CHECKSUM_GEN_TCP
-  tcphdr->chksum = inet_chksum_pseudo(p, local_ip, remote_ip,
-              IP_PROTO_TCP, p->tot_len);
-#endif
-  TCP_STATS_INC(tcp.xmit);
-  snmp_inc_tcpoutrsts();
-   /* Send output with hardcoded TTL since we have no access to the pcb */
-  ip_output(p, local_ip, remote_ip, TCP_TTL, 0, IP_PROTO_TCP);
-  pbuf_free(p);
-  LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %"U32_F" ackno %"U32_F".\n", seqno, ackno));
-}
-
-/* requeue all unacked segments for retransmission */
-void
-tcp_rexmit_rto(struct tcp_pcb *pcb)
-{
-  struct tcp_seg *seg;
-
-  if (pcb->unacked == NULL) {
-    return;
-  }
-
-  /* Move all unacked segments to the head of the unsent queue */
-  for (seg = pcb->unacked; seg->next != NULL; seg = seg->next);
-  /* concatenate unsent queue after unacked queue */
-  seg->next = pcb->unsent;
-  /* unsent queue is the concatenated queue (of unacked, unsent) */
-  pcb->unsent = pcb->unacked;
-  /* unacked queue is now empty */
-  pcb->unacked = NULL;
-
-  pcb->snd_nxt = ntohl(pcb->unsent->tcphdr->seqno);
-  /* increment number of retransmissions */
-  ++pcb->nrtx;
-
-  /* Don't take any RTT measurements after retransmitting. */
-  pcb->rttest = 0;
-
-  /* Do the actual retransmission */
-  tcp_output(pcb);
-}
-
-void
-tcp_rexmit(struct tcp_pcb *pcb)
-{
-  struct tcp_seg *seg;
-
-  if (pcb->unacked == NULL) {
-    return;
-  }
-
-  /* Move the first unacked segment to the unsent queue */
-  seg = pcb->unacked->next;
-  pcb->unacked->next = pcb->unsent;
-  pcb->unsent = pcb->unacked;
-  pcb->unacked = seg;
-
-  pcb->snd_nxt = ntohl(pcb->unsent->tcphdr->seqno);
-
-  ++pcb->nrtx;
-
-  /* Don't take any rtt measurements after retransmitting. */
-  pcb->rttest = 0;
-
-  /* Do the actual retransmission. */
-  snmp_inc_tcpretranssegs();
-  tcp_output(pcb);
-
-}
-
-
-void
-tcp_keepalive(struct tcp_pcb *pcb)
-{
-   struct pbuf *p;
-   struct tcp_hdr *tcphdr;
-
-   LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: sending KEEPALIVE probe to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
-                           ip4_addr1(&pcb->remote_ip), ip4_addr2(&pcb->remote_ip),
-                           ip4_addr3(&pcb->remote_ip), ip4_addr4(&pcb->remote_ip)));
-
-   LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: tcp_ticks %"U32_F"   pcb->tmr %"U32_F"  pcb->keep_cnt %"U16_F"\n", tcp_ticks, pcb->tmr, pcb->keep_cnt));
-   
-   p = pbuf_alloc(PBUF_IP, TCP_HLEN, PBUF_RAM);
-
-   if(p == NULL) {
-      LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: could not allocate memory for pbuf\n"));
-      return;
-   }
-
-   tcphdr = p->payload;
-   tcphdr->src = htons(pcb->local_port);
-   tcphdr->dest = htons(pcb->remote_port);
-   tcphdr->seqno = htonl(pcb->snd_nxt - 1);
-   tcphdr->ackno = htonl(pcb->rcv_nxt);
-   tcphdr->wnd = htons(pcb->rcv_wnd);
-   tcphdr->urgp = 0;
-   TCPH_HDRLEN_SET(tcphdr, 5);
-   
-   tcphdr->chksum = 0;
-#if CHECKSUM_GEN_TCP
-   tcphdr->chksum = inet_chksum_pseudo(p, &pcb->local_ip, &pcb->remote_ip, IP_PROTO_TCP, p->tot_len);
-#endif
-  TCP_STATS_INC(tcp.xmit);
-
-   /* Send output to IP */
-  ip_output(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, 0, IP_PROTO_TCP);
-
-  pbuf_free(p);
-
-  LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_keepalive: seqno %"U32_F" ackno %"U32_F".\n", pcb->snd_nxt - 1, pcb->rcv_nxt));
-}
-
-#endif /* LWIP_TCP */
-
-
-
-
-
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/core/udp.c b/src/VBox/Devices/Network/lwip/src/core/udp.c
deleted file mode 100644
index fb15685..0000000
--- a/src/VBox/Devices/Network/lwip/src/core/udp.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/**
- * @file
- * User Datagram Protocol module
- *
- */
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-
-/* udp.c
- *
- * The code for the User Datagram Protocol UDP.
- *
- */
-
-#include <string.h>
-
-#include "lwip/opt.h"
-
-#include "lwip/def.h"
-#include "lwip/memp.h"
-#include "lwip/inet.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-#include "lwip/udp.h"
-#include "lwip/icmp.h"
-
-#include "lwip/stats.h"
-
-#include "arch/perf.h"
-#include "lwip/snmp.h"
-
-/* The list of UDP PCBs */
-#if LWIP_UDP
-/* exported in udp.h (was static) */
-struct udp_pcb *udp_pcbs = NULL;
-
-static struct udp_pcb *pcb_cache = NULL;
-
-void
-udp_init(void)
-{
-  udp_pcbs = pcb_cache = NULL;
-}
-
-/**
- * Process an incoming UDP datagram.
- *
- * Given an incoming UDP datagram (as a chain of pbufs) this function
- * finds a corresponding UDP PCB and
- *
- * @param pbuf pbuf to be demultiplexed to a UDP PCB.
- * @param netif network interface on which the datagram was received.
- *
- */
-void
-udp_input(struct pbuf *p, struct netif *inp)
-{
-  struct udp_hdr *udphdr;
-  struct udp_pcb *pcb;
-  struct udp_pcb *uncon_pcb;
-  struct ip_hdr *iphdr;
-  u16_t src, dest;
-  u8_t local_match;
-
-  PERF_START;
-
-  UDP_STATS_INC(udp.recv);
-
-  iphdr = p->payload;
-
-  if (p->tot_len < (IPH_HL(iphdr) * 4 + UDP_HLEN)) {
-    /* drop short packets */
-    LWIP_DEBUGF(UDP_DEBUG,
-                ("udp_input: short UDP datagram (%"U16_F" bytes) discarded\n", p->tot_len));
-    UDP_STATS_INC(udp.lenerr);
-    UDP_STATS_INC(udp.drop);
-    snmp_inc_udpinerrors();
-    pbuf_free(p);
-    goto end;
-  }
-
-  pbuf_header(p, -(s16_t)(IPH_HL(iphdr) * 4));
-
-  udphdr = (struct udp_hdr *)p->payload;
-
-  LWIP_DEBUGF(UDP_DEBUG, ("udp_input: received datagram of length %"U16_F"\n", p->tot_len));
-
-  src = ntohs(udphdr->src);
-  dest = ntohs(udphdr->dest);
-
-  udp_debug_print(udphdr);
-
-  /* print the UDP source and destination */
-  LWIP_DEBUGF(UDP_DEBUG,
-              ("udp (%"U16_F".%"U16_F".%"U16_F".%"U16_F", %"U16_F") <-- "
-               "(%"U16_F".%"U16_F".%"U16_F".%"U16_F", %"U16_F")\n",
-               ip4_addr1(&iphdr->dest), ip4_addr2(&iphdr->dest),
-               ip4_addr3(&iphdr->dest), ip4_addr4(&iphdr->dest), ntohs(udphdr->dest),
-               ip4_addr1(&iphdr->src), ip4_addr2(&iphdr->src),
-               ip4_addr3(&iphdr->src), ip4_addr4(&iphdr->src), ntohs(udphdr->src)));
-
-  local_match = 0;
-  uncon_pcb = NULL;
-  /* Iterate through the UDP pcb list for a matching pcb */
-  for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
-    /* print the PCB local and remote address */
-    LWIP_DEBUGF(UDP_DEBUG,
-                ("pcb (%"U16_F".%"U16_F".%"U16_F".%"U16_F", %"U16_F") --- "
-                 "(%"U16_F".%"U16_F".%"U16_F".%"U16_F", %"U16_F")\n",
-                 ip4_addr1(&pcb->local_ip), ip4_addr2(&pcb->local_ip),
-                 ip4_addr3(&pcb->local_ip), ip4_addr4(&pcb->local_ip), pcb->local_port,
-                 ip4_addr1(&pcb->remote_ip), ip4_addr2(&pcb->remote_ip),
-                 ip4_addr3(&pcb->remote_ip), ip4_addr4(&pcb->remote_ip), pcb->remote_port));
-
-    /* compare PCB local addr+port to UDP destination addr+port */
-    if ((pcb->local_port == dest) &&
-        (ip_addr_isany(&pcb->local_ip) ||
-         ip_addr_cmp(&(pcb->local_ip), &(iphdr->dest)) || 
-         ip_addr_isbroadcast(&(iphdr->dest), inp))) {
-      local_match = 1;
-      if ((uncon_pcb == NULL) && 
-          ((pcb->flags & UDP_FLAGS_CONNECTED) == 0)) {
-        /* the first unconnected matching PCB */     
-        uncon_pcb = pcb;
-      }
-    }
-    /* compare PCB remote addr+port to UDP source addr+port */
-    if ((local_match != 0) &&
-        (pcb->remote_port == src) &&
-        (ip_addr_isany(&pcb->remote_ip) ||
-         ip_addr_cmp(&(pcb->remote_ip), &(iphdr->src)))) {
-      /* the first fully matching PCB */
-      break;
-    }
-  }
-  /* no fully matching pcb found? then look for an unconnected pcb */
-  if (pcb == NULL) {
-    pcb = uncon_pcb;
-  }
-
-  /* Check checksum if this is a match or if it was directed at us. */
-  if (pcb != NULL || ip_addr_cmp(&inp->ip_addr, &iphdr->dest)) {
-    LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE, ("udp_input: calculating checksum\n"));
-#ifdef IPv6
-    if (iphdr->nexthdr == IP_PROTO_UDPLITE) {
-#else
-    if (IPH_PROTO(iphdr) == IP_PROTO_UDPLITE) {
-#endif /* IPv4 */
-      /* Do the UDP Lite checksum */
-#if CHECKSUM_CHECK_UDP
-      if (inet_chksum_pseudo(p, (struct ip_addr *)&(iphdr->src),
-                             (struct ip_addr *)&(iphdr->dest),
-                             IP_PROTO_UDPLITE, ntohs(udphdr->len)) != 0) {
-        LWIP_DEBUGF(UDP_DEBUG | 2,
-                    ("udp_input: UDP Lite datagram discarded due to failing checksum\n"));
-        UDP_STATS_INC(udp.chkerr);
-        UDP_STATS_INC(udp.drop);
-        snmp_inc_udpinerrors();
-        pbuf_free(p);
-        goto end;
-      }
-#endif
-    } else {
-#if CHECKSUM_CHECK_UDP
-      if (udphdr->chksum != 0) {
-        if (inet_chksum_pseudo(p, (struct ip_addr *)&(iphdr->src),
-                               (struct ip_addr *)&(iphdr->dest),
-                               IP_PROTO_UDP, p->tot_len) != 0) {
-          LWIP_DEBUGF(UDP_DEBUG | 2,
-                      ("udp_input: UDP datagram discarded due to failing checksum\n"));
-          UDP_STATS_INC(udp.chkerr);
-          UDP_STATS_INC(udp.drop);
-          snmp_inc_udpinerrors();
-          pbuf_free(p);
-          goto end;
-        }
-      }
-#endif
-    }
-    pbuf_header(p, -UDP_HLEN);
-    if (pcb != NULL) {
-      snmp_inc_udpindatagrams();
-      /* callback */
-      if (pcb->recv != NULL)
-        pcb->recv(pcb->recv_arg, pcb, p, &(iphdr->src), src);
-    } else {
-      LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE, ("udp_input: not for us.\n"));
-
-      /* No match was found, send ICMP destination port unreachable unless
-         destination address was broadcast/multicast. */
-
-      if (!ip_addr_isbroadcast(&iphdr->dest, inp) &&
-          !ip_addr_ismulticast(&iphdr->dest)) {
-
-        /* restore pbuf pointer */
-        p->payload = iphdr;
-        icmp_dest_unreach(p, ICMP_DUR_PORT);
-      }
-      UDP_STATS_INC(udp.proterr);
-      UDP_STATS_INC(udp.drop);
-      snmp_inc_udpnoports();
-      pbuf_free(p);
-    }
-  } else {
-    pbuf_free(p);
-  }
-end:
-  PERF_STOP("udp_input");
-}
-
-/**
- * Send data to a specified address using UDP.
- *
- * @param pcb UDP PCB used to send the data.
- * @param pbuf chain of pbuf's to be sent.
- * @param dst_ip Destination IP address.
- * @param dst_port Destination UDP port.
- *
- * If the PCB already has a remote address association, it will
- * be restored after the data is sent.
- * 
- * @return lwIP error code.
- * - ERR_OK. Successful. No error occured.
- * - ERR_MEM. Out of memory.
- * - ERR_RTE. Could not find route to destination address.
- *
- * @see udp_disconnect() udp_send()
- */
-err_t
-udp_sendto(struct udp_pcb *pcb, struct pbuf *p,
-  struct ip_addr *dst_ip, u16_t dst_port)
-{
-  err_t err;
-  /* temporary space for current PCB remote address */
-  struct ip_addr pcb_remote_ip;
-  u16_t pcb_remote_port;
-  /* remember current remote peer address of PCB */
-  pcb_remote_ip.addr = pcb->remote_ip.addr;
-  pcb_remote_port = pcb->remote_port;
-  /* copy packet destination address to PCB remote peer address */
-  pcb->remote_ip.addr = dst_ip->addr;
-  pcb->remote_port = dst_port;
-  /* send to the packet destination address */
-  err = udp_send(pcb, p);
-  /* restore PCB remote peer address */
-  pcb->remote_ip.addr = pcb_remote_ip.addr;
-  pcb->remote_port = pcb_remote_port;
-  return err;
-}
-
-/**
- * Send data using UDP.
- *
- * @param pcb UDP PCB used to send the data.
- * @param pbuf chain of pbuf's to be sent.
- *
- * @return lwIP error code.
- * - ERR_OK. Successful. No error occured.
- * - ERR_MEM. Out of memory.
- * - ERR_RTE. Could not find route to destination address.
- *
- * @see udp_disconnect() udp_sendto()
- */
-err_t
-udp_send(struct udp_pcb *pcb, struct pbuf *p)
-{
-  struct udp_hdr *udphdr;
-  struct netif *netif;
-  struct ip_addr *src_ip;
-  err_t err;
-  struct pbuf *q; /* q will be sent down the stack */
-
-  LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_send\n"));
-
-  /* if the PCB is not yet bound to a port, bind it here */
-  if (pcb->local_port == 0) {
-    LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: not yet bound to a port, binding now\n"));
-    err = udp_bind(pcb, &pcb->local_ip, pcb->local_port);
-    if (err != ERR_OK) {
-      LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: forced port bind failed\n"));
-      return err;
-    }
-  }
-  /* find the outgoing network interface for this packet */
-  netif = ip_route(&(pcb->remote_ip));
-  /* no outgoing network interface could be found? */
-  if (netif == NULL) {
-    LWIP_DEBUGF(UDP_DEBUG | 1, ("udp_send: No route to 0x%"X32_F"\n", pcb->remote_ip.addr));
-    UDP_STATS_INC(udp.rterr);
-    return ERR_RTE;
-  }
-
-  /* not enough space to add an UDP header to first pbuf in given p chain? */
-  if (pbuf_header(p, UDP_HLEN)) {
-    /* allocate header in a seperate new pbuf */
-    q = pbuf_alloc(PBUF_IP, UDP_HLEN, PBUF_RAM);
-    /* new header pbuf could not be allocated? */
-    if (q == NULL) {
-      LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 2, ("udp_send: could not allocate header\n"));
-      return ERR_MEM;
-    }
-    /* chain header q in front of given pbuf p */
-    pbuf_chain(q, p);
-    /* first pbuf q points to header pbuf */
-    LWIP_DEBUGF(UDP_DEBUG,
-                ("udp_send: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p));
-    /* adding a header within p succeeded */
-  } else {
-    /* first pbuf q equals given pbuf */
-    q = p;
-    LWIP_DEBUGF(UDP_DEBUG, ("udp_send: added header in given pbuf %p\n", (void *)p));
-  }
-  /* q now represents the packet to be sent */
-  udphdr = q->payload;
-  udphdr->src = htons(pcb->local_port);
-  udphdr->dest = htons(pcb->remote_port);
-  /* in UDP, 0 checksum means 'no checksum' */
-  udphdr->chksum = 0x0000; 
-
-  /* PCB local address is IP_ANY_ADDR? */
-  if (ip_addr_isany(&pcb->local_ip)) {
-    /* use outgoing network interface IP address as source address */
-    src_ip = &(netif->ip_addr);
-  } else {
-    /* use UDP PCB local IP address as source address */
-    src_ip = &(pcb->local_ip);
-  }
-
-  LWIP_DEBUGF(UDP_DEBUG, ("udp_send: sending datagram of length %"U16_F"\n", q->tot_len));
-
-  /* UDP Lite protocol? */
-  if (pcb->flags & UDP_FLAGS_UDPLITE) {
-    LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE packet length %"U16_F"\n", q->tot_len));
-    /* set UDP message length in UDP header */
-    udphdr->len = htons(pcb->chksum_len);
-    /* calculate checksum */
-#if CHECKSUM_GEN_UDP
-    udphdr->chksum = inet_chksum_pseudo(q, src_ip, &(pcb->remote_ip),
-                                        IP_PROTO_UDP, pcb->chksum_len);
-    /* chksum zero must become 0xffff, as zero means 'no checksum' */
-    if (udphdr->chksum == 0x0000)
-      udphdr->chksum = 0xffff;
-#else
-    udphdr->chksum = 0x0000;
-#endif
-    /* output to IP */
-    LWIP_DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if (,,,,IP_PROTO_UDPLITE,)\n"));
-    err = ip_output_if(q, src_ip, &pcb->remote_ip, pcb->ttl, pcb->tos, IP_PROTO_UDPLITE, netif);    
-  } else {      /* UDP */
-    LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP packet length %"U16_F"\n", q->tot_len));
-    udphdr->len = htons(q->tot_len);
-    /* calculate checksum */
-#if CHECKSUM_GEN_UDP
-    if ((pcb->flags & UDP_FLAGS_NOCHKSUM) == 0) {
-      udphdr->chksum = inet_chksum_pseudo(q, src_ip, &pcb->remote_ip, IP_PROTO_UDP, q->tot_len);
-      /* chksum zero must become 0xffff, as zero means 'no checksum' */
-      if (udphdr->chksum == 0x0000) udphdr->chksum = 0xffff;
-    }
-#else
-    udphdr->chksum = 0x0000;
-#endif
-    LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum 0x%04"X16_F"\n", udphdr->chksum));
-    LWIP_DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if (,,,,IP_PROTO_UDP,)\n"));
-    /* output to IP */
-    err = ip_output_if(q, src_ip, &pcb->remote_ip, pcb->ttl, pcb->tos, IP_PROTO_UDP, netif);    
-  }
-  /* TODO: must this be increased even if error occured? */
-  snmp_inc_udpoutdatagrams();
-
-  /* did we chain a seperate header pbuf earlier? */
-  if (q != p) {
-    /* free the header pbuf */
-    pbuf_free(q);
-    q = NULL;
-    /* p is still referenced by the caller, and will live on */
-  }
-
-  UDP_STATS_INC(udp.xmit);
-  return err;
-}
-
-/**
- * Bind an UDP PCB.
- *
- * @param pcb UDP PCB to be bound with a local address ipaddr and port.
- * @param ipaddr local IP address to bind with. Use IP_ADDR_ANY to
- * bind to all local interfaces.
- * @param port local UDP port to bind with.
- *
- * @return lwIP error code.
- * - ERR_OK. Successful. No error occured.
- * - ERR_USE. The specified ipaddr and port are already bound to by
- * another UDP PCB.
- *
- * @see udp_disconnect()
- */
-err_t
-udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
-{
-  struct udp_pcb *ipcb;
-  u8_t rebind;
-
-  LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 3, ("udp_bind(ipaddr = "));
-  ip_addr_debug_print(UDP_DEBUG, ipaddr);
-  LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | 3, (", port = %"U16_F")\n", port));
-
-  rebind = 0;
-  /* Check for double bind and rebind of the same pcb */
-  for (ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {
-    /* is this UDP PCB already on active list? */
-    if (pcb == ipcb) {
-      /* pcb may occur at most once in active list */
-      LWIP_ASSERT("rebind == 0", rebind == 0);
-      /* pcb already in list, just rebind */
-      rebind = 1;
-    }
-
-    /* this code does not allow upper layer to share a UDP port for
-       listening to broadcast or multicast traffic (See SO_REUSE_ADDR and
-       SO_REUSE_PORT under *BSD). TODO: See where it fits instead, OR
-       combine with implementation of UDP PCB flags. Leon Woestenberg. */
-#ifdef LWIP_UDP_TODO
-    /* port matches that of PCB in list? */
-    else
-      if ((ipcb->local_port == port) &&
-          /* IP address matches, or one is IP_ADDR_ANY? */
-          (ip_addr_isany(&(ipcb->local_ip)) ||
-           ip_addr_isany(ipaddr) ||
-           ip_addr_cmp(&(ipcb->local_ip), ipaddr))) {
-        /* other PCB already binds to this local IP and port */
-        LWIP_DEBUGF(UDP_DEBUG,
-                    ("udp_bind: local port %"U16_F" already bound by another pcb\n", port));
-        return ERR_USE;
-      }
-#endif
-  }
-
-  ip_addr_set(&pcb->local_ip, ipaddr);
-
-  /* no port specified? */
-  if (port == 0) {
-#ifndef UDP_LOCAL_PORT_RANGE_START
-#define UDP_LOCAL_PORT_RANGE_START 4096
-#define UDP_LOCAL_PORT_RANGE_END   0x7fff
-#endif
-    port = UDP_LOCAL_PORT_RANGE_START;
-    ipcb = udp_pcbs;
-    while ((ipcb != NULL) && (port != UDP_LOCAL_PORT_RANGE_END)) {
-      if (ipcb->local_port == port) {
-        port++;
-        ipcb = udp_pcbs;
-      } else
-        ipcb = ipcb->next;
-    }
-    if (ipcb != NULL) {
-      /* no more ports available in local range */
-      LWIP_DEBUGF(UDP_DEBUG, ("udp_bind: out of free UDP ports\n"));
-      return ERR_USE;
-    }
-  }
-  pcb->local_port = port;
-  snmp_insert_udpidx_tree(pcb);
-  /* pcb not active yet? */
-  if (rebind == 0) {
-    /* place the PCB on the active list if not already there */
-    pcb->next = udp_pcbs;
-    udp_pcbs = pcb;
-  }
-  LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE,
-              ("udp_bind: bound to %"U16_F".%"U16_F".%"U16_F".%"U16_F", port %"U16_F"\n",
-               (u16_t)(ntohl(pcb->local_ip.addr) >> 24 & 0xff),
-               (u16_t)(ntohl(pcb->local_ip.addr) >> 16 & 0xff),
-               (u16_t)(ntohl(pcb->local_ip.addr) >> 8 & 0xff),
-               (u16_t)(ntohl(pcb->local_ip.addr) & 0xff), pcb->local_port));
-  return ERR_OK;
-}
-/**
- * Connect an UDP PCB.
- *
- * This will associate the UDP PCB with the remote address.
- *
- * @param pcb UDP PCB to be connected with remote address ipaddr and port.
- * @param ipaddr remote IP address to connect with.
- * @param port remote UDP port to connect with.
- *
- * @return lwIP error code
- *
- * @see udp_disconnect()
- */
-err_t
-udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
-{
-  struct udp_pcb *ipcb;
-
-  if (pcb->local_port == 0) {
-    err_t err = udp_bind(pcb, &pcb->local_ip, pcb->local_port);
-    if (err != ERR_OK)
-      return err;
-  }
-
-  ip_addr_set(&pcb->remote_ip, ipaddr);
-  pcb->remote_port = port;
-  pcb->flags |= UDP_FLAGS_CONNECTED;
-/** TODO: this functionality belongs in upper layers */
-#ifdef LWIP_UDP_TODO
-  /* Nail down local IP for netconn_addr()/getsockname() */
-  if (ip_addr_isany(&pcb->local_ip) && !ip_addr_isany(&pcb->remote_ip)) {
-    struct netif *netif;
-
-    if ((netif = ip_route(&(pcb->remote_ip))) == NULL) {
-      LWIP_DEBUGF(UDP_DEBUG, ("udp_connect: No route to 0x%lx\n", pcb->remote_ip.addr));
-      UDP_STATS_INC(udp.rterr);
-      return ERR_RTE;
-    }
-    /** TODO: this will bind the udp pcb locally, to the interface which
-        is used to route output packets to the remote address. However, we
-        might want to accept incoming packets on any interface! */
-    pcb->local_ip = netif->ip_addr;
-  } else if (ip_addr_isany(&pcb->remote_ip)) {
-    pcb->local_ip.addr = 0;
-  }
-#endif
-  LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE,
-              ("udp_connect: connected to %"U16_F".%"U16_F".%"U16_F".%"U16_F",port %"U16_F"\n",
-               (u16_t)(ntohl(pcb->remote_ip.addr) >> 24 & 0xff),
-               (u16_t)(ntohl(pcb->remote_ip.addr) >> 16 & 0xff),
-               (u16_t)(ntohl(pcb->remote_ip.addr) >> 8 & 0xff),
-               (u16_t)(ntohl(pcb->remote_ip.addr) & 0xff), pcb->remote_port));
-
-  /* Insert UDP PCB into the list of active UDP PCBs. */
-  for (ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {
-    if (pcb == ipcb) {
-      /* already on the list, just return */
-      return ERR_OK;
-    }
-  }
-  /* PCB not yet on the list, add PCB now */
-  pcb->next = udp_pcbs;
-  udp_pcbs = pcb;
-  return ERR_OK;
-}
-
-void
-udp_disconnect(struct udp_pcb *pcb)
-{
-  /* reset remote address association */
-  ip_addr_set(&pcb->remote_ip, IP_ADDR_ANY);
-  pcb->remote_port = 0;
-  /* mark PCB as unconnected */
-  pcb->flags &= ~UDP_FLAGS_CONNECTED;
-}
-
-void
-udp_recv(struct udp_pcb *pcb,
-         void (* recv)(void *arg, struct udp_pcb *upcb, struct pbuf *p,
-                       struct ip_addr *addr, u16_t port),
-         void *recv_arg)
-{
-  /* remember recv() callback and user data */
-  pcb->recv = recv;
-  pcb->recv_arg = recv_arg;
-}
-
-/**
- * Remove an UDP PCB.
- *
- * @param pcb UDP PCB to be removed. The PCB is removed from the list of
- * UDP PCB's and the data structure is freed from memory.
- *
- * @see udp_new()
- */
-void
-udp_remove(struct udp_pcb *pcb)
-{
-  struct udp_pcb *pcb2;
-
-  snmp_delete_udpidx_tree(pcb);
-  /* pcb to be removed is first in list? */
-  if (udp_pcbs == pcb) {
-    /* make list start at 2nd pcb */
-    udp_pcbs = udp_pcbs->next;
-    /* pcb not 1st in list */
-  } else
-    for (pcb2 = udp_pcbs; pcb2 != NULL; pcb2 = pcb2->next) {
-      /* find pcb in udp_pcbs list */
-      if (pcb2->next != NULL && pcb2->next == pcb) {
-        /* remove pcb from list */
-        pcb2->next = pcb->next;
-      }
-    }
-  memp_free(MEMP_UDP_PCB, pcb);
-}
-
-/**
- * Create a UDP PCB.
- *
- * @return The UDP PCB which was created. NULL if the PCB data structure
- * could not be allocated.
- *
- * @see udp_remove()
- */
-struct udp_pcb *
-udp_new(void)
-{
-  struct udp_pcb *pcb;
-  pcb = memp_malloc(MEMP_UDP_PCB);
-  /* could allocate UDP PCB? */
-  if (pcb != NULL) {
-    /* initialize PCB to all zeroes */
-    memset(pcb, 0, sizeof(struct udp_pcb));
-    pcb->ttl = UDP_TTL;
-  }
-  return pcb;
-}
-
-#if UDP_DEBUG
-void
-udp_debug_print(struct udp_hdr *udphdr)
-{
-  LWIP_DEBUGF(UDP_DEBUG, ("UDP header:\n"));
-  LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(UDP_DEBUG, ("|     %5"U16_F"     |     %5"U16_F"     | (src port, dest port)\n",
-                          ntohs(udphdr->src), ntohs(udphdr->dest)));
-  LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n"));
-  LWIP_DEBUGF(UDP_DEBUG, ("|     %5"U16_F"     |     0x%04"X16_F"    | (len, chksum)\n",
-                          ntohs(udphdr->len), ntohs(udphdr->chksum)));
-  LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n"));
-}
-#endif /* UDP_DEBUG */
-
-#endif /* LWIP_UDP */
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/icmp.h b/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/icmp.h
deleted file mode 100644
index 634405b..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/icmp.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_ICMP_H__
-#define __LWIP_ICMP_H__
-
-#include "lwip/arch.h"
-
-#include "lwip/opt.h"
-#include "lwip/pbuf.h"
-
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-
-#define ICMP_ER 0      /* echo reply */
-#define ICMP_DUR 3     /* destination unreachable */
-#define ICMP_SQ 4      /* source quench */
-#define ICMP_RD 5      /* redirect */
-#define ICMP_ECHO 8    /* echo */
-#define ICMP_TE 11     /* time exceeded */
-#define ICMP_PP 12     /* parameter problem */
-#define ICMP_TS 13     /* timestamp */
-#define ICMP_TSR 14    /* timestamp reply */
-#define ICMP_IRQ 15    /* information request */
-#define ICMP_IR 16     /* information reply */
-
-enum icmp_dur_type {
-  ICMP_DUR_NET = 0,    /* net unreachable */
-  ICMP_DUR_HOST = 1,   /* host unreachable */
-  ICMP_DUR_PROTO = 2,  /* protocol unreachable */
-  ICMP_DUR_PORT = 3,   /* port unreachable */
-  ICMP_DUR_FRAG = 4,   /* fragmentation needed and DF set */
-  ICMP_DUR_SR = 5      /* source route failed */
-};
-
-enum icmp_te_type {
-  ICMP_TE_TTL = 0,     /* time to live exceeded in transit */
-  ICMP_TE_FRAG = 1     /* fragment reassembly time exceeded */
-};
-
-void icmp_input(struct pbuf *p, struct netif *inp);
-
-void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
-void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct icmp_echo_hdr {
-  PACK_STRUCT_FIELD(u16_t _type_code);
-  PACK_STRUCT_FIELD(u16_t chksum);
-  PACK_STRUCT_FIELD(u16_t id);
-  PACK_STRUCT_FIELD(u16_t seqno);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-
-PACK_STRUCT_BEGIN
-struct icmp_dur_hdr {
-  PACK_STRUCT_FIELD(u16_t _type_code);
-  PACK_STRUCT_FIELD(u16_t chksum);
-  PACK_STRUCT_FIELD(u32_t unused);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-
-PACK_STRUCT_BEGIN
-struct icmp_te_hdr {
-  PACK_STRUCT_FIELD(u16_t _type_code);
-  PACK_STRUCT_FIELD(u16_t chksum);
-  PACK_STRUCT_FIELD(u32_t unused);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-#define ICMPH_TYPE(hdr) (ntohs((hdr)->_type_code) >> 8)
-#define ICMPH_CODE(hdr) (ntohs((hdr)->_type_code) & 0xff)
-
-#define ICMPH_TYPE_SET(hdr, type) ((hdr)->_type_code = htons(ICMPH_CODE(hdr) | ((type) << 8)))
-#define ICMPH_CODE_SET(hdr, code) ((hdr)->_type_code = htons((code) | (ICMPH_TYPE(hdr) << 8)))
-
-#endif /* __LWIP_ICMP_H__ */
-    
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/inet.h b/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/inet.h
deleted file mode 100644
index 57a55a3..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/inet.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_INET_H__
-#define __LWIP_INET_H__
-
-#include "lwip/arch.h"
-
-#include "lwip/opt.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-
-u16_t inet_chksum(void *dataptr, u16_t len);
-#if 0 /* optimized routine */
-u16_t inet_chksum4(u8_t *dataptr, u16_t len);
-#endif
-u16_t inet_chksum_pbuf(struct pbuf *p);
-u16_t inet_chksum_pseudo(struct pbuf *p,
-       struct ip_addr *src, struct ip_addr *dest,
-       u8_t proto, u16_t proto_len);
-
-u32_t inet_addr(const char *cp);
-int inet_aton(const char *cp, struct in_addr *addr);
-char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reentrant! */
-
-#ifdef htons
-#undef htons
-#endif /* htons */
-#ifdef htonl
-#undef htonl
-#endif /* htonl */
-#ifdef ntohs
-#undef ntohs
-#endif /* ntohs */
-#ifdef ntohl
-#undef ntohl
-#endif /* ntohl */
-
-#ifndef LWIP_PLATFORM_BYTESWAP
-#define LWIP_PLATFORM_BYTESWAP 0
-#endif
-
-#if BYTE_ORDER == BIG_ENDIAN
-#define htons(x) (x)
-#define ntohs(x) (x)
-#define htonl(x) (x)
-#define ntohl(x) (x)
-#else /* BYTE_ORDER != BIG_ENDIAN */
-#ifdef LWIP_PREFIX_BYTEORDER_FUNCS
-/* workaround for naming collisions on some platforms */
-#define htons lwip_htons
-#define ntohs lwip_ntohs
-#define htonl lwip_htonl
-#define ntohl lwip_ntohl
-#endif
-#if LWIP_PLATFORM_BYTESWAP
-#define htons(x) LWIP_PLATFORM_HTONS(x)
-#define ntohs(x) LWIP_PLATFORM_HTONS(x)
-#define htonl(x) LWIP_PLATFORM_HTONL(x)
-#define ntohl(x) LWIP_PLATFORM_HTONL(x)
-#else
-u16_t htons(u16_t x);
-u16_t ntohs(u16_t x);
-u32_t htonl(u32_t x);
-u32_t ntohl(u32_t x);
-#endif
-
-#endif
-
-#endif /* __LWIP_INET_H__ */
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip.h b/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip.h
deleted file mode 100644
index 9f745f5..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_IP_H__
-#define __LWIP_IP_H__
-
-#include "lwip/arch.h"
-
-#include "lwip/def.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-
-#include "lwip/err.h"
-
-
-void ip_init(void);
-struct netif *ip_route(struct ip_addr *dest);
-err_t ip_input(struct pbuf *p, struct netif *inp);
-err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
-    u8_t ttl, u8_t tos, u8_t proto);
-err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
-       u8_t ttl, u8_t tos, u8_t proto,
-       struct netif *netif);
-
-#define IP_HLEN 20
-
-#define IP_PROTO_ICMP 1
-#define IP_PROTO_UDP 17
-#define IP_PROTO_UDPLITE 136
-#define IP_PROTO_TCP 6
-
-/* This is passed as the destination address to ip_output_if (not
-   to ip_output), meaning that an IP header already is constructed
-   in the pbuf. This is used when TCP retransmits. */
-#ifdef IP_HDRINCL
-#undef IP_HDRINCL
-#endif /* IP_HDRINCL */
-#define IP_HDRINCL  NULL
-
-
-/* This is the common part of all PCB types. It needs to be at the
-   beginning of a PCB type definition. It is located here so that
-   changes to this common part are made in one location instead of
-   having to change all PCB structs. */
-#define IP_PCB struct ip_addr local_ip; \
-  struct ip_addr remote_ip; \
-   /* Socket options */  \
-  u16_t so_options;      \
-   /* Type Of Service */ \
-  u8_t tos;              \
-  /* Time To Live */     \
-  u8_t ttl
-
-/*
- * Option flags per-socket. These are the same like SO_XXX.
- */
-#define SOF_DEBUG     (u16_t)0x0001U    /* turn on debugging info recording */
-#define SOF_ACCEPTCONN  (u16_t)0x0002U    /* socket has had listen() */
-#define SOF_REUSEADDR (u16_t)0x0004U    /* allow local address reuse */
-#define SOF_KEEPALIVE (u16_t)0x0008U    /* keep connections alive */
-#define SOF_DONTROUTE (u16_t)0x0010U    /* just use interface addresses */
-#define SOF_BROADCAST (u16_t)0x0020U    /* permit sending of broadcast msgs */
-#define SOF_USELOOPBACK (u16_t)0x0040U    /* bypass hardware when possible */
-#define SOF_LINGER      (u16_t)0x0080U    /* linger on close if data present */
-#define SOF_OOBINLINE (u16_t)0x0100U    /* leave received OOB data in line */
-#define SOF_REUSEPORT (u16_t)0x0200U    /* allow local address & port reuse */
-
-
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct ip_hdr {
-  /* version / header length / type of service */
-  PACK_STRUCT_FIELD(u16_t _v_hl_tos);
-  /* total length */
-  PACK_STRUCT_FIELD(u16_t _len);
-  /* identification */
-  PACK_STRUCT_FIELD(u16_t _id);
-  /* fragment offset field */
-  PACK_STRUCT_FIELD(u16_t _offset);
-#define IP_RF 0x8000        /* reserved fragment flag */
-#define IP_DF 0x4000        /* dont fragment flag */
-#define IP_MF 0x2000        /* more fragments flag */
-#define IP_OFFMASK 0x1fff   /* mask for fragmenting bits */
-  /* time to live / protocol*/
-  PACK_STRUCT_FIELD(u16_t _ttl_proto);
-  /* checksum */
-  PACK_STRUCT_FIELD(u16_t _chksum);
-  /* source and destination IP addresses */
-  PACK_STRUCT_FIELD(struct ip_addr src);
-  PACK_STRUCT_FIELD(struct ip_addr dest); 
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-#define IPH_V(hdr)  (ntohs((hdr)->_v_hl_tos) >> 12)
-#define IPH_HL(hdr) ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f)
-#define IPH_TOS(hdr) (ntohs((hdr)->_v_hl_tos) & 0xff)
-#define IPH_LEN(hdr) ((hdr)->_len)
-#define IPH_ID(hdr) ((hdr)->_id)
-#define IPH_OFFSET(hdr) ((hdr)->_offset)
-#define IPH_TTL(hdr) (ntohs((hdr)->_ttl_proto) >> 8)
-#define IPH_PROTO(hdr) (ntohs((hdr)->_ttl_proto) & 0xff)
-#define IPH_CHKSUM(hdr) ((hdr)->_chksum)
-
-#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos)))
-#define IPH_LEN_SET(hdr, len) (hdr)->_len = (len)
-#define IPH_ID_SET(hdr, id) (hdr)->_id = (id)
-#define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off)
-#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (htons(IPH_PROTO(hdr) | ((u16_t)(ttl) << 8)))
-#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (htons((proto) | (IPH_TTL(hdr) << 8)))
-#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
-
-#if IP_DEBUG
-void ip_debug_print(struct pbuf *p);
-#else
-#define ip_debug_print(p)
-#endif /* IP_DEBUG */
-
-#endif /* __LWIP_IP_H__ */
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip_addr.h b/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip_addr.h
deleted file mode 100644
index d877ebe..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip_addr.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_IP_ADDR_H__
-#define __LWIP_IP_ADDR_H__
-
-#include "lwip/arch.h"
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct ip_addr {
-  PACK_STRUCT_FIELD(u32_t addr);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-/*
- * struct ipaddr2 is used in the definition of the ARP packet format in
- * order to support compilers that don't have structure packing.
- */
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct ip_addr2 {
-  PACK_STRUCT_FIELD(u16_t addrw[2]);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-/* For compatibility with BSD code */
-struct in_addr {
-  u32_t s_addr;
-};
-
-struct netif;
-
-extern const struct ip_addr ip_addr_any;
-extern const struct ip_addr ip_addr_broadcast;
-
-/** IP_ADDR_ can be used as a fixed IP address
- *  for the wildcard and the broadcast address
- */
-#define IP_ADDR_ANY         ((struct ip_addr *)&ip_addr_any)
-#define IP_ADDR_BROADCAST   ((struct ip_addr *)&ip_addr_broadcast)
-
-#define INADDR_NONE         ((u32_t)0xffffffff)  /* 255.255.255.255 */
-#define INADDR_LOOPBACK     ((u32_t)0x7f000001)  /* 127.0.0.1 */
-
-/* Definitions of the bits in an Internet address integer.
-
-   On subnets, host and network parts are found according to
-   the subnet mask, not these masks.  */
-
-#define IN_CLASSA(a)        ((((u32_t)(a)) & 0x80000000) == 0)
-#define IN_CLASSA_NET       0xff000000
-#define IN_CLASSA_NSHIFT    24
-#define IN_CLASSA_HOST      (0xffffffff & ~IN_CLASSA_NET)
-#define IN_CLASSA_MAX       128
-
-#define IN_CLASSB(a)        ((((u32_t)(a)) & 0xc0000000) == 0x80000000)
-#define IN_CLASSB_NET       0xffff0000
-#define IN_CLASSB_NSHIFT    16
-#define IN_CLASSB_HOST      (0xffffffff & ~IN_CLASSB_NET)
-#define IN_CLASSB_MAX       65536
-
-#define IN_CLASSC(a)        ((((u32_t)(a)) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSC_NET       0xffffff00
-#define IN_CLASSC_NSHIFT    8
-#define IN_CLASSC_HOST      (0xffffffff & ~IN_CLASSC_NET)
-
-#define IN_CLASSD(a)        (((u32_t)(a) & 0xf0000000) == 0xe0000000)
-#define IN_CLASSD_NET       0xf0000000          /* These ones aren't really */
-#define IN_CLASSD_NSHIFT    28                  /*   net and host fields, but */
-#define IN_CLASSD_HOST      0x0fffffff          /*   routing needn't know. */
-#define IN_MULTICAST(a)     IN_CLASSD(a)
-
-#define IN_EXPERIMENTAL(a)  (((u32_t)(a) & 0xf0000000) == 0xf0000000)
-#define IN_BADCLASS(a)      (((u32_t)(a) & 0xf0000000) == 0xf0000000)
-
-#define IN_LOOPBACKNET      127                 /* official! */
-
-#define IP4_ADDR(ipaddr, a,b,c,d) \
-        (ipaddr)->addr = htonl(((u32_t)((a) & 0xff) << 24) | \
-                               ((u32_t)((b) & 0xff) << 16) | \
-                               ((u32_t)((c) & 0xff) << 8) | \
-                                (u32_t)((d) & 0xff))
-
-#define ip_addr_set(dest, src) (dest)->addr = \
-                               ((src) == NULL? 0:\
-                               (src)->addr)
-/**
- * Determine if two address are on the same network.
- *
- * @arg addr1 IP address 1
- * @arg addr2 IP address 2
- * @arg mask network identifier mask
- * @return !0 if the network identifiers of both address match
- */
-#define ip_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \
-                                              (mask)->addr) == \
-                                             ((addr2)->addr & \
-                                              (mask)->addr))
-#define ip_addr_cmp(addr1, addr2) ((addr1)->addr == (addr2)->addr)
-
-#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == 0)
-
-u8_t ip_addr_isbroadcast(struct ip_addr *, struct netif *);
-
-#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000))
-
-#define ip_addr_debug_print(debug, ipaddr) \
-        LWIP_DEBUGF(debug, ("%"U16_F".%"U16_F".%"U16_F".%"U16_F, \
-                ipaddr ? (u16_t)(ntohl((ipaddr)->addr) >> 24) & 0xff : 0, \
-                ipaddr ? (u16_t)(ntohl((ipaddr)->addr) >> 16) & 0xff : 0, \
-                ipaddr ? (u16_t)(ntohl((ipaddr)->addr) >> 8) & 0xff : 0, \
-                ipaddr ? (u16_t)ntohl((ipaddr)->addr) & 0xff : 0))
-
-/* These are cast to u16_t, with the intent that they are often arguments
- * to printf using the U16_F format from cc.h. */
-#define ip4_addr1(ipaddr) ((u16_t)(ntohl((ipaddr)->addr) >> 24) & 0xff)
-#define ip4_addr2(ipaddr) ((u16_t)(ntohl((ipaddr)->addr) >> 16) & 0xff)
-#define ip4_addr3(ipaddr) ((u16_t)(ntohl((ipaddr)->addr) >> 8) & 0xff)
-#define ip4_addr4(ipaddr) ((u16_t)(ntohl((ipaddr)->addr)) & 0xff)
-
-#endif /* __LWIP_IP_ADDR_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip_frag.h b/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip_frag.h
deleted file mode 100644
index a326c1c..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv4/lwip/ip_frag.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Jani Monoses <jani at iv.ro>
- *
- */
-
-#ifndef __LWIP_IP_FRAG_H__
-#define __LWIP_IP_FRAG_H__
-
-#include "lwip/opt.h"
-#include "lwip/err.h"
-#include "lwip/pbuf.h"
-#include "lwip/netif.h"
-#include "lwip/ip_addr.h"
-
-void ip_frag_init(void);
-void ip_reass_tmr(void);
-struct pbuf * ip_reass(struct pbuf *p);
-err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest);
-
-#endif /* __LWIP_IP_FRAG_H__ */
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/icmp.h b/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/icmp.h
deleted file mode 100644
index 2b6adb1..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/icmp.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_ICMP_H__
-#define __LWIP_ICMP_H__
-
-#include "lwip/arch.h"
-
-#include "lwip/opt.h"
-#include "lwip/pbuf.h"
-
-#include "lwip/netif.h"
-
-#define ICMP6_DUR  1
-#define ICMP6_TE   3
-#define ICMP6_ECHO 128    /* echo */
-#define ICMP6_ER   129      /* echo reply */
-
-
-enum icmp_dur_type {
-  ICMP_DUR_NET = 0,    /* net unreachable */
-  ICMP_DUR_HOST = 1,   /* host unreachable */
-  ICMP_DUR_PROTO = 2,  /* protocol unreachable */
-  ICMP_DUR_PORT = 3,   /* port unreachable */
-  ICMP_DUR_FRAG = 4,   /* fragmentation needed and DF set */
-  ICMP_DUR_SR = 5      /* source route failed */
-};
-
-enum icmp_te_type {
-  ICMP_TE_TTL = 0,     /* time to live exceeded in transit */
-  ICMP_TE_FRAG = 1     /* fragment reassembly time exceeded */
-};
-
-void icmp_input(struct pbuf *p, struct netif *inp);
-
-void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t);
-void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t);
-
-struct icmp_echo_hdr {
-  u8_t type;
-  u8_t icode;
-  u16_t chksum;
-  u16_t id;
-  u16_t seqno;
-};
-
-struct icmp_dur_hdr {
-  u8_t type;
-  u8_t icode;
-  u16_t chksum;
-  u32_t unused;
-};
-
-struct icmp_te_hdr {
-  u8_t type;
-  u8_t icode;
-  u16_t chksum;
-  u32_t unused;
-};
-
-#endif /* __LWIP_ICMP_H__ */
-    
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/inet.h b/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/inet.h
deleted file mode 100644
index ae78343..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/inet.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_INET_H__
-#define __LWIP_INET_H__
-
-#include "lwip/arch.h"
-
-#include "lwip/opt.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-
-u16_t inet_chksum(void *data, u16_t len);
-u16_t inet_chksum_pbuf(struct pbuf *p);
-u16_t inet_chksum_pseudo(struct pbuf *p,
-       struct ip_addr *src, struct ip_addr *dest,
-       u8_t proto, u32_t proto_len);
-
-u32_t inet_addr(const char *cp);
-s8_t inet_aton(const char *cp, struct in_addr *addr);
-
-#ifndef _MACHINE_ENDIAN_H_
-#ifndef _NETINET_IN_H
-#ifndef _LINUX_BYTEORDER_GENERIC_H
-u16_t htons(u16_t n);
-u16_t ntohs(u16_t n);
-u32_t htonl(u32_t n);
-u32_t ntohl(u32_t n);
-#endif /* _LINUX_BYTEORDER_GENERIC_H */
-#endif /* _NETINET_IN_H */
-#endif /* _MACHINE_ENDIAN_H_ */
-
-#endif /* __LWIP_INET_H__ */
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/ip.h b/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/ip.h
deleted file mode 100644
index 6d7d510..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/ip.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_IP_H__
-#define __LWIP_IP_H__
-
-#include "lwip/opt.h"
-#include "lwip/def.h"
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-
-#include "lwip/err.h"
-
-#define IP_HLEN 40
-
-#define IP_PROTO_ICMP 58
-#define IP_PROTO_UDP 17
-#define IP_PROTO_UDPLITE 136
-#define IP_PROTO_TCP 6
-
-/* This is passed as the destination address to ip_output_if (not
-   to ip_output), meaning that an IP header already is constructed
-   in the pbuf. This is used when TCP retransmits. */
-#ifdef IP_HDRINCL
-#undef IP_HDRINCL
-#endif /* IP_HDRINCL */
-#define IP_HDRINCL  NULL
-
-
-/* The IPv6 header. */
-struct ip_hdr {
-#if BYTE_ORDER == LITTLE_ENDIAN
-  u8_t tclass1:4, v:4;
-  u8_t flow1:4, tclass2:4;  
-#else
-  u8_t v:4, tclass1:4;
-  u8_t tclass2:8, flow1:4;
-#endif
-  u16_t flow2;
-  u16_t len;                /* payload length */
-  u8_t nexthdr;             /* next header */
-  u8_t hoplim;              /* hop limit (TTL) */
-  struct ip_addr src, dest;          /* source and destination IP addresses */
-};
-
-void ip_init(void);
-
-#include "lwip/netif.h"
-
-struct netif *ip_route(struct ip_addr *dest);
-
-void ip_input(struct pbuf *p, struct netif *inp);
-
-/* source and destination addresses in network byte order, please */
-err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
-         u8_t ttl, u8_t proto);
-
-err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
-      u8_t ttl, u8_t proto,
-      struct netif *netif);
-
-#if IP_DEBUG
-void ip_debug_print(struct pbuf *p);
-#endif /* IP_DEBUG */
-
-#endif /* __LWIP_IP_H__ */
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/ip_addr.h b/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/ip_addr.h
deleted file mode 100644
index db1f090..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/ipv6/lwip/ip_addr.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_IP_ADDR_H__
-#define __LWIP_IP_ADDR_H__
-
-#include "lwip/arch.h"
-
-#define IP_ADDR_ANY 0
-
-struct ip_addr {
-  u32_t addr[4];
-};
-
-#define IP6_ADDR(ipaddr, a,b,c,d,e,f,g,h) do { (ipaddr)->addr[0] = htonl((u32_t)((a & 0xffff) << 16) | (b & 0xffff)); \
-                                               (ipaddr)->addr[1] = htonl(((c & 0xffff) << 16) | (d & 0xffff)); \
-                                               (ipaddr)->addr[2] = htonl(((e & 0xffff) << 16) | (f & 0xffff)); \
-                                               (ipaddr)->addr[3] = htonl(((g & 0xffff) << 16) | (h & 0xffff)); } while(0)
-
-u8_t ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2,
-        struct ip_addr *mask);
-u8_t ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2);
-void ip_addr_set(struct ip_addr *dest, struct ip_addr *src);
-u8_t ip_addr_isany(struct ip_addr *addr);
-
-
-#if IP_DEBUG
-void ip_addr_debug_print(struct ip_addr *addr);
-#endif /* IP_DEBUG */
-
-#endif /* __LWIP_IP_ADDR_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/api.h b/src/VBox/Devices/Network/lwip/src/include/lwip/api.h
deleted file mode 100644
index 7f0ad59..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/api.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_API_H__
-#define __LWIP_API_H__
-
-#include "lwip/opt.h"
-#include "lwip/pbuf.h"
-#include "lwip/sys.h"
-
-#include "lwip/ip.h"
-
-#include "lwip/raw.h"
-#include "lwip/udp.h"
-#include "lwip/tcp.h"
-
-#include "lwip/err.h"
-
-#define NETCONN_NOCOPY 0x00
-#define NETCONN_COPY   0x01
-
-enum netconn_type {
-  NETCONN_TCP,
-  NETCONN_UDP,
-  NETCONN_UDPLITE,
-  NETCONN_UDPNOCHKSUM,
-  NETCONN_RAW
-};
-
-enum netconn_state {
-  NETCONN_NONE,
-  NETCONN_WRITE,
-  NETCONN_ACCEPT,
-  NETCONN_RECV,
-  NETCONN_CONNECT,
-  NETCONN_CLOSE
-};
-
-enum netconn_evt {
-  NETCONN_EVT_RCVPLUS,
-  NETCONN_EVT_RCVMINUS,
-  NETCONN_EVT_SENDPLUS,
-  NETCONN_EVT_SENDMINUS
-};
-
-struct netbuf {
-  struct pbuf *p, *ptr;
-  struct ip_addr *fromaddr;
-  u16_t fromport;
-  err_t err;
-};
-
-struct netconn {
-  enum netconn_type type;
-  enum netconn_state state;
-  union {
-    struct tcp_pcb *tcp;
-    struct udp_pcb *udp;
-    struct raw_pcb *raw;
-  } pcb;
-  err_t err;
-  sys_mbox_t mbox;
-  sys_mbox_t recvmbox;
-  sys_mbox_t acceptmbox;
-  sys_sem_t sem;
-  int socket;
-  u16_t recv_avail;
-  void (* callback)(struct netconn *, enum netconn_evt, u16_t len);
-};
-
-/* Network buffer functions: */
-struct netbuf *   netbuf_new      (void);
-void              netbuf_delete   (struct netbuf *buf);
-void *            netbuf_alloc    (struct netbuf *buf, u16_t size);
-void              netbuf_free     (struct netbuf *buf);
-void              netbuf_ref      (struct netbuf *buf,
-           void *dataptr, u16_t size);
-void              netbuf_chain    (struct netbuf *head,
-           struct netbuf *tail);
-
-u16_t             netbuf_len      (struct netbuf *buf);
-err_t             netbuf_data     (struct netbuf *buf,
-           void **dataptr, u16_t *len);
-s8_t              netbuf_next     (struct netbuf *buf);
-void              netbuf_first    (struct netbuf *buf);
-
-void              netbuf_copy     (struct netbuf *buf,
-           void *dataptr, u16_t len);
-void              netbuf_copy_partial(struct netbuf *buf, void *dataptr, 
-              u16_t len, u16_t offset);
-struct ip_addr *  netbuf_fromaddr (struct netbuf *buf);
-u16_t             netbuf_fromport (struct netbuf *buf);
-
-/* Network connection functions: */
-struct netconn *  netconn_new     (enum netconn_type type);
-struct
-netconn *netconn_new_with_callback(enum netconn_type t,
-                                   void (*callback)(struct netconn *, enum netconn_evt, u16_t len));
-struct
-netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto,
-                                   void (*callback)(struct netconn *, enum netconn_evt, u16_t len));
-err_t             netconn_delete  (struct netconn *conn);
-enum netconn_type netconn_type    (struct netconn *conn);
-err_t             netconn_peer    (struct netconn *conn,
-           struct ip_addr *addr,
-           u16_t *port);
-err_t             netconn_addr    (struct netconn *conn,
-           struct ip_addr **addr,
-           u16_t *port);
-err_t             netconn_bind    (struct netconn *conn,
-           struct ip_addr *addr,
-           u16_t port);
-err_t             netconn_connect (struct netconn *conn,
-           struct ip_addr *addr,
-           u16_t port);
-err_t             netconn_disconnect (struct netconn *conn);
-err_t             netconn_listen  (struct netconn *conn);
-struct netconn *  netconn_accept  (struct netconn *conn);
-struct netbuf *   netconn_recv    (struct netconn *conn);
-err_t             netconn_send    (struct netconn *conn,
-           struct netbuf *buf);
-err_t             netconn_write   (struct netconn *conn,
-           void *dataptr, u16_t size,
-           u8_t copy);
-err_t             netconn_close   (struct netconn *conn);
-
-err_t             netconn_err     (struct netconn *conn);
-
-#endif /* __LWIP_API_H__ */
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/api_msg.h b/src/VBox/Devices/Network/lwip/src/include/lwip/api_msg.h
deleted file mode 100644
index 3fef3dd..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/api_msg.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_API_MSG_H__
-#define __LWIP_API_MSG_H__
-
-#include "lwip/opt.h"
-#include "lwip/pbuf.h"
-#include "lwip/sys.h"
-
-#include "lwip/ip.h"
-
-#include "lwip/udp.h"
-#include "lwip/tcp.h"
-
-#include "lwip/api.h"
-
-enum api_msg_type {
-  API_MSG_NEWCONN,
-  API_MSG_DELCONN,
-  
-  API_MSG_BIND,
-  API_MSG_CONNECT,
-  API_MSG_DISCONNECT,
-
-  API_MSG_LISTEN,
-  API_MSG_ACCEPT,
-
-  API_MSG_SEND,
-  API_MSG_RECV,
-  API_MSG_WRITE,
-
-  API_MSG_CLOSE,
-  
-  API_MSG_MAX
-};
-
-struct api_msg_msg {
-  struct netconn *conn;
-  enum netconn_type conntype;
-  union {
-    struct pbuf *p;   
-    struct  {
-      struct ip_addr *ipaddr;
-      u16_t port;
-    } bc;
-    struct {
-      void *dataptr;
-      u16_t len;
-      u8_t copy;
-    } w;    
-    sys_mbox_t mbox;
-    u16_t len;
-  } msg;
-};
-
-struct api_msg {
-  enum api_msg_type type;
-  struct api_msg_msg msg;
-};
-
-void api_msg_input(struct api_msg *msg);
-void api_msg_post(struct api_msg *msg);
-
-#endif /* __LWIP_API_MSG_H__ */
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/arch.h b/src/VBox/Devices/Network/lwip/src/include/lwip/arch.h
deleted file mode 100644
index 3713bba..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/arch.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_ARCH_H__
-#define __LWIP_ARCH_H__
-
-#ifndef LITTLE_ENDIAN
-#define LITTLE_ENDIAN 1234
-#endif
-
-#ifndef BIG_ENDIAN
-#define BIG_ENDIAN 4321
-#endif
-
-#include "arch/cc.h"
-
-#ifndef PACK_STRUCT_BEGIN
-#define PACK_STRUCT_BEGIN
-#endif /* PACK_STRUCT_BEGIN */
-
-#ifndef PACK_STRUCT_END
-#define PACK_STRUCT_END
-#endif /* PACK_STRUCT_END */
-
-#ifndef PACK_STRUCT_FIELD
-#define PACK_STRUCT_FIELD(x) x
-#endif /* PACK_STRUCT_FIELD */
-
-
-
-#ifdef LWIP_PROVIDE_ERRNO
-
-#define  EPERM     1  /* Operation not permitted */
-#define  ENOENT     2  /* No such file or directory */
-#define  ESRCH     3  /* No such process */
-#define  EINTR     4  /* Interrupted system call */
-#define  EIO     5  /* I/O error */
-#define  ENXIO     6  /* No such device or address */
-#define  E2BIG     7  /* Arg list too long */
-#define  ENOEXEC     8  /* Exec format error */
-#define  EBADF     9  /* Bad file number */
-#define  ECHILD    10  /* No child processes */
-#define  EAGAIN    11  /* Try again */
-#define  ENOMEM    12  /* Out of memory */
-#define  EACCES    13  /* Permission denied */
-#define  EFAULT    14  /* Bad address */
-#define  ENOTBLK    15  /* Block device required */
-#define  EBUSY    16  /* Device or resource busy */
-#define  EEXIST    17  /* File exists */
-#define  EXDEV    18  /* Cross-device link */
-#define  ENODEV    19  /* No such device */
-#define  ENOTDIR    20  /* Not a directory */
-#define  EISDIR    21  /* Is a directory */
-#define  EINVAL    22  /* Invalid argument */
-#define  ENFILE    23  /* File table overflow */
-#define  EMFILE    24  /* Too many open files */
-#define  ENOTTY    25  /* Not a typewriter */
-#define  ETXTBSY    26  /* Text file busy */
-#define  EFBIG    27  /* File too large */
-#define  ENOSPC    28  /* No space left on device */
-#define  ESPIPE    29  /* Illegal seek */
-#define  EROFS    30  /* Read-only file system */
-#define  EMLINK    31  /* Too many links */
-#define  EPIPE    32  /* Broken pipe */
-#define  EDOM    33  /* Math argument out of domain of func */
-#define  ERANGE    34  /* Math result not representable */
-#define  EDEADLK    35  /* Resource deadlock would occur */
-#define  ENAMETOOLONG  36  /* File name too long */
-#define  ENOLCK    37  /* No record locks available */
-#define  ENOSYS    38  /* Function not implemented */
-#define  ENOTEMPTY  39  /* Directory not empty */
-#define  ELOOP    40  /* Too many symbolic links encountered */
-#define  EWOULDBLOCK  EAGAIN  /* Operation would block */
-#define  ENOMSG    42  /* No message of desired type */
-#define  EIDRM    43  /* Identifier removed */
-#define  ECHRNG    44  /* Channel number out of range */
-#define  EL2NSYNC  45  /* Level 2 not synchronized */
-#define  EL3HLT    46  /* Level 3 halted */
-#define  EL3RST    47  /* Level 3 reset */
-#define  ELNRNG    48  /* Link number out of range */
-#define  EUNATCH    49  /* Protocol driver not attached */
-#define  ENOCSI    50  /* No CSI structure available */
-#define  EL2HLT    51  /* Level 2 halted */
-#define  EBADE    52  /* Invalid exchange */
-#define  EBADR    53  /* Invalid request descriptor */
-#define  EXFULL    54  /* Exchange full */
-#define  ENOANO    55  /* No anode */
-#define  EBADRQC    56  /* Invalid request code */
-#define  EBADSLT    57  /* Invalid slot */
-
-#define  EDEADLOCK  EDEADLK
-
-#define  EBFONT    59  /* Bad font file format */
-#define  ENOSTR    60  /* Device not a stream */
-#define  ENODATA    61  /* No data available */
-#define  ETIME    62  /* Timer expired */
-#define  ENOSR    63  /* Out of streams resources */
-#define  ENONET    64  /* Machine is not on the network */
-#define  ENOPKG    65  /* Package not installed */
-#define  EREMOTE    66  /* Object is remote */
-#define  ENOLINK    67  /* Link has been severed */
-#define  EADV    68  /* Advertise error */
-#define  ESRMNT    69  /* Srmount error */
-#define  ECOMM    70  /* Communication error on send */
-#define  EPROTO    71  /* Protocol error */
-#define  EMULTIHOP  72  /* Multihop attempted */
-#define  EDOTDOT    73  /* RFS specific error */
-#define  EBADMSG    74  /* Not a data message */
-#define  EOVERFLOW  75  /* Value too large for defined data type */
-#define  ENOTUNIQ  76  /* Name not unique on network */
-#define  EBADFD    77  /* File descriptor in bad state */
-#define  EREMCHG    78  /* Remote address changed */
-#define  ELIBACC    79  /* Can not access a needed shared library */
-#define  ELIBBAD    80  /* Accessing a corrupted shared library */
-#define  ELIBSCN    81  /* .lib section in a.out corrupted */
-#define  ELIBMAX    82  /* Attempting to link in too many shared libraries */
-#define  ELIBEXEC  83  /* Cannot exec a shared library directly */
-#define  EILSEQ    84  /* Illegal byte sequence */
-#define  ERESTART  85  /* Interrupted system call should be restarted */
-#define  ESTRPIPE  86  /* Streams pipe error */
-#define  EUSERS    87  /* Too many users */
-#define  ENOTSOCK  88  /* Socket operation on non-socket */
-#define  EDESTADDRREQ  89  /* Destination address required */
-#define  EMSGSIZE  90  /* Message too long */
-#define  EPROTOTYPE  91  /* Protocol wrong type for socket */
-#define  ENOPROTOOPT  92  /* Protocol not available */
-#define  EPROTONOSUPPORT  93  /* Protocol not supported */
-#define  ESOCKTNOSUPPORT  94  /* Socket type not supported */
-#define  EOPNOTSUPP  95  /* Operation not supported on transport endpoint */
-#define  EPFNOSUPPORT  96  /* Protocol family not supported */
-#define  EAFNOSUPPORT  97  /* Address family not supported by protocol */
-#define  EADDRINUSE  98  /* Address already in use */
-#define  EADDRNOTAVAIL  99  /* Cannot assign requested address */
-#define  ENETDOWN  100  /* Network is down */
-#define  ENETUNREACH  101  /* Network is unreachable */
-#define  ENETRESET  102  /* Network dropped connection because of reset */
-#define  ECONNABORTED  103  /* Software caused connection abort */
-#define  ECONNRESET  104  /* Connection reset by peer */
-#define  ENOBUFS    105  /* No buffer space available */
-#define  EISCONN    106  /* Transport endpoint is already connected */
-#define  ENOTCONN  107  /* Transport endpoint is not connected */
-#define  ESHUTDOWN  108  /* Cannot send after transport endpoint shutdown */
-#define  ETOOMANYREFS  109  /* Too many references: cannot splice */
-#define  ETIMEDOUT  110  /* Connection timed out */
-#define  ECONNREFUSED  111  /* Connection refused */
-#define  EHOSTDOWN  112  /* Host is down */
-#define  EHOSTUNREACH  113  /* No route to host */
-#define  EALREADY  114  /* Operation already in progress */
-#define  EINPROGRESS  115  /* Operation now in progress */
-#define  ESTALE    116  /* Stale NFS file handle */
-#define  EUCLEAN    117  /* Structure needs cleaning */
-#define  ENOTNAM    118  /* Not a XENIX named type file */
-#define  ENAVAIL    119  /* No XENIX semaphores available */
-#define  EISNAM    120  /* Is a named type file */
-#define  EREMOTEIO  121  /* Remote I/O error */
-#define  EDQUOT    122  /* Quota exceeded */
-
-#define  ENOMEDIUM  123  /* No medium found */
-#define  EMEDIUMTYPE  124  /* Wrong medium type */
-
-
-#define ENSROK    0 /* DNS server returned answer with no data */
-#define ENSRNODATA  160 /* DNS server returned answer with no data */
-#define ENSRFORMERR 161 /* DNS server claims query was misformatted */
-#define ENSRSERVFAIL 162  /* DNS server returned general failure */
-#define ENSRNOTFOUND 163  /* Domain name not found */
-#define ENSRNOTIMP  164 /* DNS server does not implement requested operation */
-#define ENSRREFUSED 165 /* DNS server refused query */
-#define ENSRBADQUERY 166  /* Misformatted DNS query */
-#define ENSRBADNAME 167 /* Misformatted domain name */
-#define ENSRBADFAMILY 168 /* Unsupported address family */
-#define ENSRBADRESP 169 /* Misformatted DNS reply */
-#define ENSRCONNREFUSED 170 /* Could not contact DNS servers */
-#define ENSRTIMEOUT 171 /* Timeout while contacting DNS servers */
-#define ENSROF    172 /* End of file */
-#define ENSRFILE  173 /* Error reading file */
-#define ENSRNOMEM 174 /* Out of memory */
-#define ENSRDESTRUCTION 175 /* Application terminated lookup */
-#define ENSRQUERYDOMAINTOOLONG  176 /* Domain name is too long */
-#define ENSRCNAMELOOP 177 /* Domain name is too long */
-
-#ifndef errno
-extern int errno;
-#endif
-
-#endif /* LWIP_PROVIDE_ERRNO */
-
-#endif /* __LWIP_ARCH_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/debug.h b/src/VBox/Devices/Network/lwip/src/include/lwip/debug.h
deleted file mode 100644
index 3220541..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/debug.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_DEBUG_H__
-#define __LWIP_DEBUG_H__
-
-#include "arch/cc.h"
-
-/** lower two bits indicate debug level
- * - 0 off
- * - 1 warning
- * - 2 serious
- * - 3 severe
- */
-
-#define DBG_LEVEL_OFF     0
-#define DBG_LEVEL_WARNING 1  /* bad checksums, dropped packets, ... */
-#define DBG_LEVEL_SERIOUS 2  /* memory allocation failures, ... */
-#define DBG_LEVEL_SEVERE  3  /* */ 
-#define DBG_MASK_LEVEL    3
-
-/** flag for LWIP_DEBUGF to enable that debug message */
-#define DBG_ON  0x80U
-/** flag for LWIP_DEBUGF to disable that debug message */
-#define DBG_OFF 0x00U
-
-/** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */
-#define DBG_TRACE   0x40U
-/** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */
-#define DBG_STATE   0x20U
-/** flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet */
-#define DBG_FRESH   0x10U
-/** flag for LWIP_DEBUGF to halt after printing this debug message */
-#define DBG_HALT    0x08U
-
-#ifndef LWIP_NOASSERT
-#  define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
-#else
-#  define LWIP_ASSERT(x,y) do {} while (0)
-#endif
-
-#ifdef LWIP_DEBUG
-/** print debug message only if debug message type is enabled...
- *  AND is of correct type AND is at least DBG_LEVEL
- */
-#  define LWIP_DEBUGF(debug,x) do { if (((debug) & DBG_ON) && ((debug) & DBG_TYPES_ON) && ((s16_t)((debug) & DBG_MASK_LEVEL) >= DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if ((debug) & DBG_HALT) while(1); } } while(0)
-#  define LWIP_ERROR(x)        do { LWIP_PLATFORM_DIAG(x); } while(0)
-#else /* LWIP_DEBUG */
-#  define LWIP_DEBUGF(debug,x) do {} while (0)
-#  define LWIP_ERROR(x)        do {} while (0)
-#endif /* LWIP_DEBUG */
-
-#endif /* __LWIP_DEBUG_H__ */
-
-
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/def.h b/src/VBox/Devices/Network/lwip/src/include/lwip/def.h
deleted file mode 100644
index eba9b87..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/def.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_DEF_H__
-#define __LWIP_DEF_H__
-
-/* this might define NULL already */
-#include "arch/cc.h"
-
-#define LWIP_MAX(x , y)  (x) > (y) ? (x) : (y)
-#define LWIP_MIN(x , y)  (x) < (y) ? (x) : (y)
-
-#ifndef NULL
-#define NULL ((void *)0)
-#endif
-
-
-#endif /* __LWIP_DEF_H__ */
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/dhcp.h b/src/VBox/Devices/Network/lwip/src/include/lwip/dhcp.h
deleted file mode 100644
index bfe753f..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/dhcp.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/** @file
- */
-
-#ifndef __LWIP_DHCP_H__
-#define __LWIP_DHCP_H__
-
-#include "lwip/opt.h"
-#include "lwip/netif.h"
-#include "lwip/udp.h"
-
-/** period (in seconds) of the application calling dhcp_coarse_tmr() */
-#define DHCP_COARSE_TIMER_SECS 60 
-/** period (in milliseconds) of the application calling dhcp_fine_tmr() */
-#define DHCP_FINE_TIMER_MSECS 500 
-
-struct dhcp
-{
-  /** current DHCP state machine state */
-  u8_t state;
-  /** retries of current request */
-  u8_t tries;
-  /** transaction identifier of last sent request */ 
-  u32_t xid;
-  /** our connection to the DHCP server */ 
-  struct udp_pcb *pcb;
-  /** (first) pbuf of incoming msg */
-  struct pbuf *p;
-  /** incoming msg */
-  struct dhcp_msg *msg_in;
-  /** incoming msg options */
-  struct dhcp_msg *options_in; 
-  /** ingoing msg options length */
-  u16_t options_in_len;
-
-  struct pbuf *p_out; /* pbuf of outcoming msg */
-  struct dhcp_msg *msg_out; /* outgoing msg */
-  u16_t options_out_len; /* outgoing msg options length */
-  u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */
-  u16_t t1_timeout;  /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */
-  u16_t t2_timeout;  /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */
-  struct ip_addr server_ip_addr; /* dhcp server address that offered this lease */
-  struct ip_addr offered_ip_addr;
-  struct ip_addr offered_sn_mask;
-  struct ip_addr offered_gw_addr;
-  struct ip_addr offered_bc_addr;
-#define DHCP_MAX_DNS 2
-  u32_t dns_count; /* actual number of DNS servers obtained */
-  struct ip_addr offered_dns_addr[DHCP_MAX_DNS]; /* DNS server addresses */
- 
-  u32_t offered_t0_lease; /* lease period (in seconds) */
-  u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */
-  u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period)  */
-/** Patch #1308
- *  TODO: See dhcp.c "TODO"s
- */
-#if 0
-  struct ip_addr offered_si_addr;
-  u8_t *boot_file_name;
-#endif
-};
-
-/* MUST be compiled with "pack structs" or equivalent! */
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-/** minimum set of fields of any DHCP message */
-struct dhcp_msg
-{
-  PACK_STRUCT_FIELD(u8_t op);
-  PACK_STRUCT_FIELD(u8_t htype);
-  PACK_STRUCT_FIELD(u8_t hlen);
-  PACK_STRUCT_FIELD(u8_t hops);
-  PACK_STRUCT_FIELD(u32_t xid);
-  PACK_STRUCT_FIELD(u16_t secs);
-  PACK_STRUCT_FIELD(u16_t flags);
-  PACK_STRUCT_FIELD(struct ip_addr ciaddr);
-  PACK_STRUCT_FIELD(struct ip_addr yiaddr);
-  PACK_STRUCT_FIELD(struct ip_addr siaddr);
-  PACK_STRUCT_FIELD(struct ip_addr giaddr);
-#define DHCP_CHADDR_LEN 16U
-  PACK_STRUCT_FIELD(u8_t chaddr[DHCP_CHADDR_LEN]);
-#define DHCP_SNAME_LEN 64U
-  PACK_STRUCT_FIELD(u8_t sname[DHCP_SNAME_LEN]);
-#define DHCP_FILE_LEN 128U
-  PACK_STRUCT_FIELD(u8_t file[DHCP_FILE_LEN]);
-  PACK_STRUCT_FIELD(u32_t cookie);
-#define DHCP_MIN_OPTIONS_LEN 68U
-/** make sure user does not configure this too small */
-#if ((defined(DHCP_OPTIONS_LEN)) && (DHCP_OPTIONS_LEN < DHCP_MIN_OPTIONS_LEN))
-#  undef DHCP_OPTIONS_LEN
-#endif
-/** allow this to be configured in lwipopts.h, but not too small */
-#if (!defined(DHCP_OPTIONS_LEN))
-/** set this to be sufficient for your options in outgoing DHCP msgs */
-#  define DHCP_OPTIONS_LEN DHCP_MIN_OPTIONS_LEN
-#endif
-  PACK_STRUCT_FIELD(u8_t options[DHCP_OPTIONS_LEN]);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-/** start DHCP configuration */
-err_t dhcp_start(struct netif *netif);
-/** enforce early lease renewal (not needed normally)*/
-err_t dhcp_renew(struct netif *netif);
-/** release the DHCP lease, usually called before dhcp_stop()*/
-err_t dhcp_release(struct netif *netif);
-/** stop DHCP configuration */
-void dhcp_stop(struct netif *netif);
-/** inform server of our manual IP address */
-void dhcp_inform(struct netif *netif);
-
-/** if enabled, check whether the offered IP address is not in use, using ARP */
-#if DHCP_DOES_ARP_CHECK
-void dhcp_arp_reply(struct netif *netif, struct ip_addr *addr);
-#endif
-
-/** to be called every minute */
-void dhcp_coarse_tmr(void);
-/** to be called every half second */
-void dhcp_fine_tmr(void);
- 
-/** DHCP message item offsets and length */
-#define DHCP_MSG_OFS (UDP_DATA_OFS)  
-  #define DHCP_OP_OFS (DHCP_MSG_OFS + 0)
-  #define DHCP_HTYPE_OFS (DHCP_MSG_OFS + 1)
-  #define DHCP_HLEN_OFS (DHCP_MSG_OFS + 2)
-  #define DHCP_HOPS_OFS (DHCP_MSG_OFS + 3)
-  #define DHCP_XID_OFS (DHCP_MSG_OFS + 4)
-  #define DHCP_SECS_OFS (DHCP_MSG_OFS + 8)
-  #define DHCP_FLAGS_OFS (DHCP_MSG_OFS + 10)
-  #define DHCP_CIADDR_OFS (DHCP_MSG_OFS + 12)
-  #define DHCP_YIADDR_OFS (DHCP_MSG_OFS + 16)
-  #define DHCP_SIADDR_OFS (DHCP_MSG_OFS + 20)
-  #define DHCP_GIADDR_OFS (DHCP_MSG_OFS + 24)
-  #define DHCP_CHADDR_OFS (DHCP_MSG_OFS + 28)
-  #define DHCP_SNAME_OFS (DHCP_MSG_OFS + 44)
-  #define DHCP_FILE_OFS (DHCP_MSG_OFS + 108)
-#define DHCP_MSG_LEN 236
-
-#define DHCP_COOKIE_OFS (DHCP_MSG_OFS + DHCP_MSG_LEN)
-#define DHCP_OPTIONS_OFS (DHCP_MSG_OFS + DHCP_MSG_LEN + 4)
-
-#define DHCP_CLIENT_PORT 68  
-#define DHCP_SERVER_PORT 67
-
-/** DHCP client states */
-#define DHCP_REQUESTING 1
-#define DHCP_INIT 2
-#define DHCP_REBOOTING 3
-#define DHCP_REBINDING 4
-#define DHCP_RENEWING 5
-#define DHCP_SELECTING 6
-#define DHCP_INFORMING 7
-#define DHCP_CHECKING 8
-#define DHCP_PERMANENT 9
-#define DHCP_BOUND 10
-/** not yet implemented #define DHCP_RELEASING 11 */
-#define DHCP_BACKING_OFF 12
-#define DHCP_OFF 13
- 
-#define DHCP_BOOTREQUEST 1
-#define DHCP_BOOTREPLY 2
-
-#define DHCP_DISCOVER 1
-#define DHCP_OFFER 2
-#define DHCP_REQUEST 3
-#define DHCP_DECLINE 4
-#define DHCP_ACK 5
-#define DHCP_NAK 6
-#define DHCP_RELEASE 7
-#define DHCP_INFORM 8
-
-#define DHCP_HTYPE_ETH 1
-
-#define DHCP_HLEN_ETH 6
-
-#define DHCP_BROADCAST_FLAG 15
-#define DHCP_BROADCAST_MASK (1 << DHCP_FLAG_BROADCAST)
-
-/** BootP options */
-#define DHCP_OPTION_PAD 0
-#define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.3 */
-#define DHCP_OPTION_ROUTER 3
-#define DHCP_OPTION_DNS_SERVER 6 
-#define DHCP_OPTION_HOSTNAME 12
-#define DHCP_OPTION_IP_TTL 23
-#define DHCP_OPTION_MTU 26
-#define DHCP_OPTION_BROADCAST 28
-#define DHCP_OPTION_TCP_TTL 37
-#define DHCP_OPTION_END 255
-
-/** DHCP options */
-#define DHCP_OPTION_REQUESTED_IP 50 /* RFC 2132 9.1, requested IP address */
-#define DHCP_OPTION_LEASE_TIME 51 /* RFC 2132 9.2, time in seconds, in 4 bytes */
-#define DHCP_OPTION_OVERLOAD 52 /* RFC2132 9.3, use file and/or sname field for options */
-
-#define DHCP_OPTION_MESSAGE_TYPE 53 /* RFC 2132 9.6, important for DHCP */
-#define DHCP_OPTION_MESSAGE_TYPE_LEN 1
-
-
-#define DHCP_OPTION_SERVER_ID 54 /* RFC 2132 9.7, server IP address */
-#define DHCP_OPTION_PARAMETER_REQUEST_LIST 55 /* RFC 2132 9.8, requested option types */
-
-#define DHCP_OPTION_MAX_MSG_SIZE 57 /* RFC 2132 9.10, message size accepted >= 576 */
-#define DHCP_OPTION_MAX_MSG_SIZE_LEN 2
-
-#define DHCP_OPTION_T1 58 /* T1 renewal time */
-#define DHCP_OPTION_T2 59 /* T2 rebinding time */
-#define DHCP_OPTION_CLIENT_ID 61
-#define DHCP_OPTION_TFTP_SERVERNAME 66
-#define DHCP_OPTION_BOOTFILE 67
-
-/** possible combinations of overloading the file and sname fields with options */
-#define DHCP_OVERLOAD_NONE 0
-#define DHCP_OVERLOAD_FILE 1
-#define DHCP_OVERLOAD_SNAME  2
-#define DHCP_OVERLOAD_SNAME_FILE 3
-
-#endif /*__LWIP_DHCP_H__*/
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/err.h b/src/VBox/Devices/Network/lwip/src/include/lwip/err.h
deleted file mode 100644
index c92cb26..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/err.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_ERR_H__
-#define __LWIP_ERR_H__
-
-#include "lwip/opt.h"
-
-#include "arch/cc.h"
-
-typedef s8_t err_t;
-
-/* Definitions for error constants. */
-
-#define ERR_OK    0      /* No error, everything OK. */
-#define ERR_MEM  -1      /* Out of memory error.     */
-#define ERR_BUF  -2      /* Buffer error.            */
-
-
-#define ERR_ABRT -3      /* Connection aborted.      */
-#define ERR_RST  -4      /* Connection reset.        */
-#define ERR_CLSD -5      /* Connection closed.       */
-#define ERR_CONN -6      /* Not connected.           */
-
-#define ERR_VAL  -7      /* Illegal value.           */
-
-#define ERR_ARG  -8      /* Illegal argument.        */
-
-#define ERR_RTE  -9      /* Routing problem.         */
-
-#define ERR_USE  -10     /* Address in use.          */
-
-#define ERR_IF   -11     /* Low-level netif error    */
-#define ERR_ISCONN -12   /* Already connected.       */
-
-
-#ifdef LWIP_DEBUG
-extern char *lwip_strerr(err_t err);
-#else
-#define lwip_strerr(x) ""
-#endif /* LWIP_DEBUG */
-#endif /* __LWIP_ERR_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/mem.h b/src/VBox/Devices/Network/lwip/src/include/lwip/mem.h
deleted file mode 100644
index f14d176..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/mem.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_MEM_H__
-#define __LWIP_MEM_H__
-
-#include "lwip/opt.h"
-#include "lwip/arch.h"
-
-#if MEM_SIZE > 64000l
-typedef u32_t mem_size_t;
-#define MEM_SIZE_F U32_F
-#else
-typedef u16_t mem_size_t;
-#define MEM_SIZE_F U16_F
-#endif /* MEM_SIZE > 64000 */
-
-#if MEM_LIBC_MALLOC
-/* aliases for C library malloc() */
-#define mem_init()
-#define mem_free(x) free(x)
-#define mem_malloc(x) malloc(x)
-#define mem_realloc(x, size) realloc(x,size)
-#else
-/* lwIP alternative malloc */
-void mem_init(void);
-void *mem_malloc(mem_size_t size);
-void mem_free(void *mem);
-void *mem_realloc(void *mem, mem_size_t size);
-#endif
-
-#ifndef MEM_ALIGN_SIZE
-#define MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))
-#endif
-
-#ifndef MEM_ALIGN
-#define MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1)))
-#endif
-
-#endif /* __LWIP_MEM_H__ */
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/memp.h b/src/VBox/Devices/Network/lwip/src/include/lwip/memp.h
deleted file mode 100644
index 1cd46fa..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/memp.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#ifndef __LWIP_MEMP_H__
-#define __LWIP_MEMP_H__
-
-#include "lwip/opt.h"
-
-typedef enum {
-  MEMP_PBUF,
-  MEMP_RAW_PCB,
-  MEMP_UDP_PCB,
-  MEMP_TCP_PCB,
-  MEMP_TCP_PCB_LISTEN,
-  MEMP_TCP_SEG,
-
-  MEMP_NETBUF,
-  MEMP_NETCONN,
-  MEMP_API_MSG,
-  MEMP_TCPIP_MSG,
-
-  MEMP_SYS_TIMEOUT,
-  
-  MEMP_MAX
-} memp_t;
-
-void memp_init(void);
-
-void *memp_malloc(memp_t type);
-void *memp_realloc(memp_t fromtype, memp_t totype, void *mem);
-void memp_free(memp_t type, void *mem);
-
-#endif /* __LWIP_MEMP_H__  */
-    
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/netif.h b/src/VBox/Devices/Network/lwip/src/include/lwip/netif.h
deleted file mode 100644
index b773769..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/netif.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_NETIF_H__
-#define __LWIP_NETIF_H__
-
-#include "lwip/opt.h"
-
-#include "lwip/err.h"
-
-#include "lwip/ip_addr.h"
-
-#include "lwip/inet.h"
-#include "lwip/pbuf.h"
-#if LWIP_DHCP
-#  include "lwip/dhcp.h"
-#endif
-
-/** must be the maximum of all used hardware address lengths
-    across all types of interfaces in use */
-#define NETIF_MAX_HWADDR_LEN 6U
-
-/** TODO: define the use (where, when, whom) of netif flags */
-
-/** whether the network interface is 'up'. this is
- * a software flag used to control whether this network
- * interface is enabled and processes traffic.
- */
-#define NETIF_FLAG_UP 0x1U
-/** if set, the netif has broadcast capability */
-#define NETIF_FLAG_BROADCAST 0x2U
-/** if set, the netif is one end of a point-to-point connection */
-#define NETIF_FLAG_POINTTOPOINT 0x4U
-/** if set, the interface is configured using DHCP */
-#define NETIF_FLAG_DHCP 0x08U
-/** if set, the interface has an active link
- *  (set by the network interface driver) */
-#define NETIF_FLAG_LINK_UP 0x10U
-
-/** Generic data structure used for all lwIP network interfaces.
- *  The following fields should be filled in by the initialization
- *  function for the device driver: hwaddr_len, hwaddr[], mtu, flags */
-
-struct netif {
-  /** pointer to next in linked list */
-  struct netif *next;
-
-  /** IP address configuration in network byte order */
-  struct ip_addr ip_addr;
-  struct ip_addr netmask;
-  struct ip_addr gw;
-
-  /** This function is called by the network device driver
-   *  to pass a packet up the TCP/IP stack. */
-  err_t (* input)(struct pbuf *p, struct netif *inp);
-  /** This function is called by the IP module when it wants
-   *  to send a packet on the interface. This function typically
-   *  first resolves the hardware address, then sends the packet. */
-  err_t (* output)(struct netif *netif, struct pbuf *p,
-       struct ip_addr *ipaddr);
-  /** This function is called by the ARP module when it wants
-   *  to send a packet on the interface. This function outputs
-   *  the pbuf as-is on the link medium. */
-  err_t (* linkoutput)(struct netif *netif, struct pbuf *p);
-  /** This field can be set by the device driver and could point
-   *  to state information for the device. */
-  void *state;
-#if LWIP_DHCP
-  /** the DHCP client state information for this netif */
-  struct dhcp *dhcp;
-#endif
-  /** number of bytes used in hwaddr */
-  u8_t hwaddr_len;
-  /** link level hardware address of this interface */
-  u8_t hwaddr[NETIF_MAX_HWADDR_LEN];
-  /** maximum transfer unit (in bytes) */
-  u16_t mtu;
-  /** flags (see NETIF_FLAG_ above) */
-  u8_t flags;
-  /** descriptive abbreviation */
-  char name[2];
-  /** number of this interface */
-  u8_t num;
-#if LWIP_SNMP
-  /** link type (ifType values per RFC1213) */
-  u8_t link_type;
-  /** (estimate) link speed */
-  u32_t link_speed;
-  /** timestamp at last change made (up/down) */
-  u32_t ts;
-  /** counters */
-  u32_t ifinoctets;
-  u32_t ifinucastpkts;
-  u32_t ifinnucastpkts;
-  u32_t ifindiscards;
-  u32_t ifoutoctets;
-  u32_t ifoutucastpkts;
-  u32_t ifoutnucastpkts;
-  u32_t ifoutdiscards;
-#endif
-};
-
-/** The list of network interfaces. */
-extern struct netif *netif_list;
-/** The default network interface. */
-extern struct netif *netif_default;
-
-/* netif_init() must be called first. */
-void netif_init(void);
-
-struct netif *netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
-      struct ip_addr *gw,
-      void *state,
-      err_t (* init)(struct netif *netif),
-      err_t (* input)(struct pbuf *p, struct netif *netif));
-
-void
-netif_set_addr(struct netif *netif,struct ip_addr *ipaddr, struct ip_addr *netmask,
-    struct ip_addr *gw);
-void netif_remove(struct netif * netif);
-
-/* Returns a network interface given its name. The name is of the form
-   "et0", where the first two letters are the "name" field in the
-   netif structure, and the digit is in the num field in the same
-   structure. */
-struct netif *netif_find(char *name);
-
-void netif_set_default(struct netif *netif);
-
-void netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr);
-void netif_set_netmask(struct netif *netif, struct ip_addr *netmast);
-void netif_set_gw(struct netif *netif, struct ip_addr *gw);
-void netif_set_up(struct netif *netif);
-void netif_set_down(struct netif *netif);
-u8_t netif_is_up(struct netif *netif);
-
-#endif /* __LWIP_NETIF_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/opt.h b/src/VBox/Devices/Network/lwip/src/include/lwip/opt.h
deleted file mode 100644
index c8bdb49..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/opt.h
+++ /dev/null
@@ -1,722 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_OPT_H__
-#define __LWIP_OPT_H__
-
-/* Include user defined options first */
-#include "lwipopts.h"
-#include "lwip/debug.h"
-
-/* Define default values for unconfigured parameters. */
-
-/* Platform specific locking */
-
-/*
- * enable SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
- * for certain critical regions during buffer allocation, deallocation and memory
- * allocation and deallocation.
- */
-#ifndef SYS_LIGHTWEIGHT_PROT
-#define SYS_LIGHTWEIGHT_PROT            0
-#endif
-
-#ifndef NO_SYS
-#define NO_SYS                          0
-#endif
-/* ---------- Memory options ---------- */
-#ifndef MEM_LIBC_MALLOC
-#define MEM_LIBC_MALLOC                 0
-#endif
-
-/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
-   lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
-   byte alignment -> define MEM_ALIGNMENT to 2. */
-
-#ifndef MEM_ALIGNMENT
-#define MEM_ALIGNMENT                   1
-#endif
-
-/* MEM_SIZE: the size of the heap memory. If the application will send
-a lot of data that needs to be copied, this should be set high. */
-#ifndef MEM_SIZE
-#define MEM_SIZE                        1600
-#endif
-
-#ifndef MEMP_SANITY_CHECK
-#define MEMP_SANITY_CHECK       0
-#endif
-
-/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
-   sends a lot of data out of ROM (or other static memory), this
-   should be set high. */
-#ifndef MEMP_NUM_PBUF
-#define MEMP_NUM_PBUF                   16
-#endif
-
-/* Number of raw connection PCBs */
-#ifndef MEMP_NUM_RAW_PCB
-#define MEMP_NUM_RAW_PCB                4
-#endif
-
-/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
-   per active UDP "connection". */
-#ifndef MEMP_NUM_UDP_PCB
-#define MEMP_NUM_UDP_PCB                4
-#endif
-/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
-   connections. */
-#ifndef MEMP_NUM_TCP_PCB
-#define MEMP_NUM_TCP_PCB                5
-#endif
-/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
-   connections. */
-#ifndef MEMP_NUM_TCP_PCB_LISTEN
-#define MEMP_NUM_TCP_PCB_LISTEN         8
-#endif
-/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
-   segments. */
-#ifndef MEMP_NUM_TCP_SEG
-#define MEMP_NUM_TCP_SEG                16
-#endif
-/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
-   timeouts. */
-#ifndef MEMP_NUM_SYS_TIMEOUT
-#define MEMP_NUM_SYS_TIMEOUT            3
-#endif
-
-/* The following four are used only with the sequential API and can be
-   set to 0 if the application only will use the raw API. */
-/* MEMP_NUM_NETBUF: the number of struct netbufs. */
-#ifndef MEMP_NUM_NETBUF
-#define MEMP_NUM_NETBUF                 2
-#endif
-/* MEMP_NUM_NETCONN: the number of struct netconns. */
-#ifndef MEMP_NUM_NETCONN
-#define MEMP_NUM_NETCONN                4
-#endif
-/* MEMP_NUM_APIMSG: the number of struct api_msg, used for
-   communication between the TCP/IP stack and the sequential
-   programs. */
-#ifndef MEMP_NUM_API_MSG
-#define MEMP_NUM_API_MSG                8
-#endif
-/* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
-   for sequential API communication and incoming packets. Used in
-   src/api/tcpip.c. */
-#ifndef MEMP_NUM_TCPIP_MSG
-#define MEMP_NUM_TCPIP_MSG              8
-#endif
-
-/* ---------- Pbuf options ---------- */
-/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
-
-#ifndef PBUF_POOL_SIZE
-#define PBUF_POOL_SIZE                  16
-#endif
-
-/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
-
-#ifndef PBUF_POOL_BUFSIZE
-#define PBUF_POOL_BUFSIZE               128
-#endif
-
-/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
-   link level header. Defaults to 14 for Ethernet. */
-
-#ifndef PBUF_LINK_HLEN
-#define PBUF_LINK_HLEN                  14
-#endif
-
-
-
-/* ---------- ARP options ---------- */
-
-/** Number of active hardware address, IP address pairs cached */
-#ifndef ARP_TABLE_SIZE
-#define ARP_TABLE_SIZE                  10
-#endif
-
-/**
- * If enabled, outgoing packets are queued during hardware address
- * resolution.
- *
- * This feature has not stabilized yet. Single-packet queueing is
- * believed to be stable, multi-packet queueing is believed to
- * clash with the TCP segment queueing.
- * 
- * As multi-packet-queueing is currently disabled, enabling this
- * _should_ work, but we need your testing feedback on lwip-users.
- *
- */
-#ifndef ARP_QUEUEING
-#define ARP_QUEUEING                    1
-#endif
-
-/* This option is deprecated */
-#ifdef ETHARP_QUEUE_FIRST
-#error ETHARP_QUEUE_FIRST option is deprecated. Remove it from your lwipopts.h.
-#endif
-
-/* This option is removed to comply with the ARP standard */
-#ifdef ETHARP_ALWAYS_INSERT
-#error ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h.
-#endif
-
-/* ---------- IP options ---------- */
-/* Define IP_FORWARD to 1 if you wish to have the ability to forward
-   IP packets across network interfaces. If you are going to run lwIP
-   on a device with only one network interface, define this to 0. */
-#ifndef IP_FORWARD
-#define IP_FORWARD                      0
-#endif
-
-/* If defined to 1, IP options are allowed (but not parsed). If
-   defined to 0, all packets with IP options are dropped. */
-#ifndef IP_OPTIONS
-#define IP_OPTIONS                      1
-#endif
-
-/** IP reassembly and segmentation. Even if they both deal with IP
- *  fragments, note that these are orthogonal, one dealing with incoming
- *  packets, the other with outgoing packets
- */
-
-/** Reassemble incoming fragmented IP packets */
-#ifndef IP_REASSEMBLY
-#define IP_REASSEMBLY                   1
-#endif
-
-/** Fragment outgoing IP packets if their size exceeds MTU */
-#ifndef IP_FRAG
-#define IP_FRAG                         1
-#endif
-
-/* IP reassemly default age in seconds */
-#ifndef IP_REASS_MAXAGE
-#define IP_REASS_MAXAGE 3
-#endif
-
-/* IP reassembly buffer size (minus IP header) */
-#ifndef IP_REASS_BUFSIZE
-#define IP_REASS_BUFSIZE 5760
-#endif
-
-/* Assumed max MTU on any interface for IP frag buffer */
-#ifndef IP_FRAG_MAX_MTU
-#define IP_FRAG_MAX_MTU 1500
-#endif
-
-/** Global default value for Time To Live used by transport layers. */
-#ifndef IP_DEFAULT_TTL
-#define IP_DEFAULT_TTL                  255
-#endif
-
-/* ---------- ICMP options ---------- */
-
-#ifndef ICMP_TTL
-#define ICMP_TTL                        (IP_DEFAULT_TTL)
-#endif
-
-/* ---------- RAW options ---------- */
-
-#ifndef LWIP_RAW
-#define LWIP_RAW                        1
-#endif
-
-#ifndef RAW_TTL
-#define RAW_TTL                        (IP_DEFAULT_TTL)
-#endif
-
-/* ---------- DHCP options ---------- */
-
-#ifndef LWIP_DHCP
-#define LWIP_DHCP                       0
-#endif
-
-/* 1 if you want to do an ARP check on the offered address
-   (recommended). */
-#ifndef DHCP_DOES_ARP_CHECK
-#define DHCP_DOES_ARP_CHECK             1
-#endif
-
-/* ---------- SNMP options ---------- */
-/** @note UDP must be available for SNMP transport */
-#ifndef LWIP_SNMP
-#define LWIP_SNMP                       0
-#endif
-
-/** @note At least one request buffer is required.  */
-#ifndef SNMP_CONCURRENT_REQUESTS
-#define SNMP_CONCURRENT_REQUESTS        1
-#endif
-
-/** @note At least one trap destination is required */
-#ifndef SNMP_TRAP_DESTINATIONS
-#define SNMP_TRAP_DESTINATIONS          1
-#endif
-
-#ifndef SNMP_PRIVATE_MIB
-#define SNMP_PRIVATE_MIB                0
-#endif
-
-/* ---------- UDP options ---------- */
-#ifndef LWIP_UDP
-#define LWIP_UDP                        1
-#endif
-
-#ifndef UDP_TTL
-#define UDP_TTL                         (IP_DEFAULT_TTL)
-#endif
-
-/* ---------- TCP options ---------- */
-#ifndef LWIP_TCP
-#define LWIP_TCP                        1
-#endif
-
-#ifndef TCP_TTL
-#define TCP_TTL                         (IP_DEFAULT_TTL)
-#endif
-
-#ifndef TCP_WND
-#define TCP_WND                         2048
-#endif 
-
-#ifndef TCP_MAXRTX
-#define TCP_MAXRTX                      12
-#endif
-
-#ifndef TCP_SYNMAXRTX
-#define TCP_SYNMAXRTX                   6
-#endif
-
-
-/* Controls if TCP should queue segments that arrive out of
-   order. Define to 0 if your device is low on memory. */
-#ifndef TCP_QUEUE_OOSEQ
-#define TCP_QUEUE_OOSEQ                 1
-#endif
-
-/* TCP Maximum segment size. */
-#ifndef TCP_MSS
-#define TCP_MSS                         128 /* A *very* conservative default. */
-#endif
-
-/* TCP sender buffer space (bytes). */
-#ifndef TCP_SND_BUF
-#define TCP_SND_BUF                     256
-#endif
-
-/* TCP sender buffer space (pbufs). This must be at least = 2 *
-   TCP_SND_BUF/TCP_MSS for things to work. */
-#ifndef TCP_SND_QUEUELEN
-#define TCP_SND_QUEUELEN                4 * TCP_SND_BUF/TCP_MSS
-#endif
-
-
-/* Maximum number of retransmissions of data segments. */
-
-/* Maximum number of retransmissions of SYN segments. */
-
-/* TCP writable space (bytes). This must be less than or equal
-   to TCP_SND_BUF. It is the amount of space which must be
-   available in the tcp snd_buf for select to return writable */
-#ifndef TCP_SNDLOWAT
-#define TCP_SNDLOWAT                    TCP_SND_BUF/2
-#endif
-
-/* Support loop interface (127.0.0.1) */
-#ifndef LWIP_HAVE_LOOPIF
-#define LWIP_HAVE_LOOPIF                0
-#endif
-
-#ifndef LWIP_EVENT_API
-#define LWIP_EVENT_API                  0
-#define LWIP_CALLBACK_API               1
-#else 
-#define LWIP_EVENT_API                  1
-#define LWIP_CALLBACK_API               0
-#endif 
-
-#ifndef LWIP_COMPAT_SOCKETS
-#define LWIP_COMPAT_SOCKETS             1
-#endif
-
-
-#ifndef TCPIP_THREAD_PRIO
-#define TCPIP_THREAD_PRIO               1
-#endif
-
-#ifndef SLIPIF_THREAD_PRIO
-#define SLIPIF_THREAD_PRIO              1
-#endif
-
-#ifndef PPP_THREAD_PRIO
-#define PPP_THREAD_PRIO                 1
-#endif
-
-#ifndef DEFAULT_THREAD_PRIO
-#define DEFAULT_THREAD_PRIO             1
-#endif
-
-
-/* ---------- Socket Options ---------- */
-/* Enable SO_REUSEADDR and SO_REUSEPORT options */ 
-#ifdef SO_REUSE
-/* I removed the lot since this was an ugly hack. It broke the raw-API.
-   It also came with many ugly goto's, Christiaan Simons. */
-#error "SO_REUSE currently unavailable, this was a hack"
-#endif                                                                        
-
-
-/* ---------- Statistics options ---------- */
-#ifndef LWIP_STATS
-#define LWIP_STATS                      1
-#endif
-
-#if LWIP_STATS
-
-#ifndef LWIP_STATS_DISPLAY
-#define LWIP_STATS_DISPLAY 0
-#endif
-
-#ifndef LINK_STATS
-#define LINK_STATS  1
-#endif
-
-#ifndef IP_STATS
-#define IP_STATS    1
-#endif
-
-#ifndef IPFRAG_STATS
-#define IPFRAG_STATS    1
-#endif
-
-#ifndef ICMP_STATS
-#define ICMP_STATS  1
-#endif
-
-#ifndef UDP_STATS
-#define UDP_STATS   1
-#endif
-
-#ifndef TCP_STATS
-#define TCP_STATS   1
-#endif
-
-#ifndef MEM_STATS
-#define MEM_STATS   1
-#endif
-
-#ifndef MEMP_STATS
-#define MEMP_STATS  1
-#endif
-
-#ifndef PBUF_STATS
-#define PBUF_STATS  1
-#endif
-
-#ifndef SYS_STATS
-#define SYS_STATS   1
-#endif
-
-#ifndef RAW_STATS
-#define RAW_STATS   0
-#endif
-
-#else
-
-#define LINK_STATS  0
-#define IP_STATS    0
-#define IPFRAG_STATS    0
-#define ICMP_STATS  0
-#define UDP_STATS   0
-#define TCP_STATS   0
-#define MEM_STATS   0
-#define MEMP_STATS  0
-#define PBUF_STATS  0
-#define SYS_STATS   0
-#define RAW_STATS   0
-#define LWIP_STATS_DISPLAY  0
-
-#endif /* LWIP_STATS */
-
-/* ---------- PPP options ---------- */
-
-#ifndef PPP_SUPPORT
-#define PPP_SUPPORT                     0      /* Set for PPP */
-#endif
-
-#if PPP_SUPPORT 
-
-#define NUM_PPP                         1      /* Max PPP sessions. */
-
-
-
-#ifndef PAP_SUPPORT
-#define PAP_SUPPORT                     0      /* Set for PAP. */
-#endif
-
-#ifndef CHAP_SUPPORT
-#define CHAP_SUPPORT                    0      /* Set for CHAP. */
-#endif
-
-#define MSCHAP_SUPPORT                  0      /* Set for MSCHAP (NOT FUNCTIONAL!) */
-#define CBCP_SUPPORT                    0      /* Set for CBCP (NOT FUNCTIONAL!) */
-#define CCP_SUPPORT                     0      /* Set for CCP (NOT FUNCTIONAL!) */
-
-#ifndef VJ_SUPPORT
-#define VJ_SUPPORT                      0      /* Set for VJ header compression. */
-#endif
-
-#ifndef MD5_SUPPORT
-#define MD5_SUPPORT                     0      /* Set for MD5 (see also CHAP) */
-#endif
-
-
-/*
- * Timeouts.
- */
-#define FSM_DEFTIMEOUT                  6       /* Timeout time in seconds */
-#define FSM_DEFMAXTERMREQS              2       /* Maximum Terminate-Request transmissions */
-#define FSM_DEFMAXCONFREQS              10      /* Maximum Configure-Request transmissions */
-#define FSM_DEFMAXNAKLOOPS              5       /* Maximum number of nak loops */
-
-#define UPAP_DEFTIMEOUT                 6       /* Timeout (seconds) for retransmitting req */
-#define UPAP_DEFREQTIME                 30      /* Time to wait for auth-req from peer */
-
-#define CHAP_DEFTIMEOUT                 6       /* Timeout time in seconds */
-#define CHAP_DEFTRANSMITS               10      /* max # times to send challenge */
-
-
-/* Interval in seconds between keepalive echo requests, 0 to disable. */
-#if 1
-#define LCP_ECHOINTERVAL                0
-#else
-#define LCP_ECHOINTERVAL                10
-#endif
-
-/* Number of unanswered echo requests before failure. */
-#define LCP_MAXECHOFAILS                3
-
-/* Max Xmit idle time (in jiffies) before resend flag char. */
-#define PPP_MAXIDLEFLAG                 100
-
-/*
- * Packet sizes
- *
- * Note - lcp shouldn't be allowed to negotiate stuff outside these
- *    limits.  See lcp.h in the pppd directory.
- * (XXX - these constants should simply be shared by lcp.c instead
- *    of living in lcp.h)
- */
-#define PPP_MTU                         1500     /* Default MTU (size of Info field) */
-#if 0
-#define PPP_MAXMTU  65535 - (PPP_HDRLEN + PPP_FCSLEN)
-#else
-#define PPP_MAXMTU                      1500 /* Largest MTU we allow */
-#endif
-#define PPP_MINMTU                      64
-#define PPP_MRU                         1500     /* default MRU = max length of info field */
-#define PPP_MAXMRU                      1500     /* Largest MRU we allow */
-#define PPP_DEFMRU                      296             /* Try for this */
-#define PPP_MINMRU                      128             /* No MRUs below this */
-
-
-#define MAXNAMELEN                      256     /* max length of hostname or name for auth */
-#define MAXSECRETLEN                    256     /* max length of password or secret */
-
-#endif /* PPP_SUPPORT */
-
-/* checksum options - set to zero for hardware checksum support */
-
-#ifndef CHECKSUM_GEN_IP
-#define CHECKSUM_GEN_IP                 1
-#endif
- 
-#ifndef CHECKSUM_GEN_UDP
-#define CHECKSUM_GEN_UDP                1
-#endif
- 
-#ifndef CHECKSUM_GEN_TCP
-#define CHECKSUM_GEN_TCP                1
-#endif
- 
-#ifndef CHECKSUM_CHECK_IP
-#define CHECKSUM_CHECK_IP               1
-#endif
- 
-#ifndef CHECKSUM_CHECK_UDP
-#define CHECKSUM_CHECK_UDP              1
-#endif
-
-#ifndef CHECKSUM_CHECK_TCP
-#define CHECKSUM_CHECK_TCP              1
-#endif
-
-/* Debugging options all default to off */
-
-#ifndef DBG_TYPES_ON
-#define DBG_TYPES_ON                    0
-#endif
-
-#ifndef ETHARP_DEBUG
-#define ETHARP_DEBUG                    DBG_OFF
-#endif
-
-#ifndef NETIF_DEBUG
-#define NETIF_DEBUG                     DBG_OFF
-#endif
-
-#ifndef PBUF_DEBUG
-#define PBUF_DEBUG                      DBG_OFF
-#endif
-
-#ifndef API_LIB_DEBUG
-#define API_LIB_DEBUG                   DBG_OFF
-#endif
-
-#ifndef API_MSG_DEBUG
-#define API_MSG_DEBUG                   DBG_OFF
-#endif
-
-#ifndef SOCKETS_DEBUG
-#define SOCKETS_DEBUG                   DBG_OFF
-#endif
-
-#ifndef ICMP_DEBUG
-#define ICMP_DEBUG                      DBG_OFF
-#endif
-
-#ifndef INET_DEBUG
-#define INET_DEBUG                      DBG_OFF
-#endif
-
-#ifndef IP_DEBUG
-#define IP_DEBUG                        DBG_OFF
-#endif
-
-#ifndef IP_REASS_DEBUG
-#define IP_REASS_DEBUG                  DBG_OFF
-#endif
-
-#ifndef RAW_DEBUG
-#define RAW_DEBUG                       DBG_OFF
-#endif
-
-#ifndef MEM_DEBUG
-#define MEM_DEBUG                       DBG_OFF
-#endif
-
-#ifndef MEMP_DEBUG
-#define MEMP_DEBUG                      DBG_OFF
-#endif
-
-#ifndef SYS_DEBUG
-#define SYS_DEBUG                       DBG_OFF
-#endif
-
-#ifndef TCP_DEBUG
-#define TCP_DEBUG                       DBG_OFF
-#endif
-
-#ifndef TCP_INPUT_DEBUG
-#define TCP_INPUT_DEBUG                 DBG_OFF
-#endif
-
-#ifndef TCP_FR_DEBUG
-#define TCP_FR_DEBUG                    DBG_OFF
-#endif
-
-#ifndef TCP_RTO_DEBUG
-#define TCP_RTO_DEBUG                   DBG_OFF
-#endif
-
-#ifndef TCP_REXMIT_DEBUG
-#define TCP_REXMIT_DEBUG                DBG_OFF
-#endif
-
-#ifndef TCP_CWND_DEBUG
-#define TCP_CWND_DEBUG                  DBG_OFF
-#endif
-
-#ifndef TCP_WND_DEBUG
-#define TCP_WND_DEBUG                   DBG_OFF
-#endif
-
-#ifndef TCP_OUTPUT_DEBUG
-#define TCP_OUTPUT_DEBUG                DBG_OFF
-#endif
-
-#ifndef TCP_RST_DEBUG
-#define TCP_RST_DEBUG                   DBG_OFF
-#endif
-
-#ifndef TCP_QLEN_DEBUG
-#define TCP_QLEN_DEBUG                  DBG_OFF
-#endif
-
-#ifndef UDP_DEBUG
-#define UDP_DEBUG                       DBG_OFF
-#endif
-
-#ifndef TCPIP_DEBUG
-#define TCPIP_DEBUG                     DBG_OFF
-#endif
-
-#ifndef PPP_DEBUG 
-#define PPP_DEBUG                       DBG_OFF
-#endif
-
-#ifndef SLIP_DEBUG 
-#define SLIP_DEBUG                      DBG_OFF
-#endif
-
-#ifndef DHCP_DEBUG 
-#define DHCP_DEBUG                      DBG_OFF
-#endif
-
-#ifndef SNMP_MSG_DEBUG 
-#define SNMP_MSG_DEBUG                  DBG_OFF
-#endif
-
-#ifndef SNMP_MIB_DEBUG 
-#define SNMP_MIB_DEBUG                  DBG_OFF
-#endif
-
-#ifndef DBG_MIN_LEVEL
-#define DBG_MIN_LEVEL                   DBG_LEVEL_OFF
-#endif
-
-#endif /* __LWIP_OPT_H__ */
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/pbuf.h b/src/VBox/Devices/Network/lwip/src/include/lwip/pbuf.h
deleted file mode 100644
index 546aa30..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/pbuf.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#ifndef __LWIP_PBUF_H__
-#define __LWIP_PBUF_H__
-
-#include "arch/cc.h"
-
-
-#define PBUF_TRANSPORT_HLEN 20
-#define PBUF_IP_HLEN        20
-
-typedef enum {
-  PBUF_TRANSPORT,
-  PBUF_IP,
-  PBUF_LINK,
-  PBUF_RAW
-} pbuf_layer;
-
-typedef enum {
-  PBUF_RAM,
-  PBUF_ROM,
-  PBUF_REF,
-  PBUF_POOL
-} pbuf_flag;
-
-/* Definitions for the pbuf flag field. These are NOT the flags that
- * are passed to pbuf_alloc(). */
-#define PBUF_FLAG_RAM   0x00U    /* Flags that pbuf data is stored in RAM */
-#define PBUF_FLAG_ROM   0x01U    /* Flags that pbuf data is stored in ROM */
-#define PBUF_FLAG_POOL  0x02U    /* Flags that the pbuf comes from the pbuf pool */
-#define PBUF_FLAG_REF   0x04U    /* Flags thet the pbuf payload refers to RAM */
-
-/** indicates this packet was broadcast on the link */
-#define PBUF_FLAG_LINK_BROADCAST 0x80U
-
-struct pbuf {
-  /** next pbuf in singly linked pbuf chain */
-  struct pbuf *next;
-
-  /** pointer to the actual data in the buffer */
-  void *payload;
-  
-  /**
-   * total length of this buffer and all next buffers in chain
-   * belonging to the same packet.
-   *
-   * For non-queue packet chains this is the invariant:
-   * p->tot_len == p->len + (p->next? p->next->tot_len: 0)
-   */
-  u16_t tot_len;
-  
-  /** length of this buffer */
-  u16_t len;  
-
-  /** flags telling the type of pbuf, see PBUF_FLAG_ */
-  u16_t flags;
-  
-  /**
-   * the reference count always equals the number of pointers
-   * that refer to this pbuf. This can be pointers from an application,
-   * the stack itself, or pbuf->next pointers from a chain.
-   */
-  u16_t ref;
-  
-};
-
-void pbuf_init(void);
-
-struct pbuf *pbuf_alloc(pbuf_layer l, u16_t size, pbuf_flag flag);
-void pbuf_realloc(struct pbuf *p, u16_t size); 
-u8_t pbuf_header(struct pbuf *p, s16_t header_size);
-void pbuf_ref(struct pbuf *p);
-void pbuf_ref_chain(struct pbuf *p);
-u8_t pbuf_free(struct pbuf *p);
-u8_t pbuf_clen(struct pbuf *p);  
-void pbuf_cat(struct pbuf *h, struct pbuf *t);
-void pbuf_chain(struct pbuf *h, struct pbuf *t);
-struct pbuf *pbuf_take(struct pbuf *f);
-struct pbuf *pbuf_dechain(struct pbuf *p);
-void pbuf_queue(struct pbuf *p, struct pbuf *n);
-struct pbuf * pbuf_dequeue(struct pbuf *p);
-
-#endif /* __LWIP_PBUF_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/raw.h b/src/VBox/Devices/Network/lwip/src/include/lwip/raw.h
deleted file mode 100644
index 6f7a987..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/raw.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_RAW_H__
-#define __LWIP_RAW_H__
-
-#include "lwip/arch.h"
-
-#include "lwip/pbuf.h"
-#include "lwip/inet.h"
-#include "lwip/ip.h"
-
-struct raw_pcb {
-/* Common members of all PCB types */
-  IP_PCB;
-
-  struct raw_pcb *next;
-
-  u16_t protocol;
-
-  u8_t (* recv)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
-    struct ip_addr *addr);
-  void *recv_arg;
-};
-
-/* The following functions is the application layer interface to the
-   RAW code. */
-struct raw_pcb * raw_new        (u16_t proto);
-void             raw_remove     (struct raw_pcb *pcb);
-err_t            raw_bind       (struct raw_pcb *pcb, struct ip_addr *ipaddr);
-err_t            raw_connect    (struct raw_pcb *pcb, struct ip_addr *ipaddr);
-
-void             raw_recv       (struct raw_pcb *pcb,
-                                 u8_t (* recv)(void *arg, struct raw_pcb *pcb,
-                                              struct pbuf *p,
-                                              struct ip_addr *addr),
-                                 void *recv_arg);
-err_t            raw_sendto    (struct raw_pcb *pcb, struct pbuf *p, struct ip_addr *ipaddr);
-err_t            raw_send       (struct raw_pcb *pcb, struct pbuf *p);
-
-/* The following functions are the lower layer interface to RAW. */
-u8_t              raw_input      (struct pbuf *p, struct netif *inp);
-void             raw_init       (void);
-
-
-#endif /* __LWIP_RAW_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/sio.h b/src/VBox/Devices/Network/lwip/src/include/lwip/sio.h
deleted file mode 100644
index 8a37aa3..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/sio.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- */
-
-/*
- * This is the interface to the platform specific serial IO module
- * It needs to be implemented by those platforms which need SLIP or PPP
- */
-
-#include "arch/cc.h"
-
-#ifndef __sio_fd_t_defined
-typedef void * sio_fd_t;
-#endif
-
-#ifndef sio_open
-sio_fd_t sio_open(u8_t);
-#endif
-
-#ifndef sio_send
-void sio_send(u8_t, sio_fd_t);
-#endif
-
-#ifndef sio_recv
-u8_t sio_recv(sio_fd_t);
-#endif
-
-#ifndef sio_read
-u32_t sio_read(sio_fd_t, u8_t *, u32_t);
-#endif
-
-#ifndef sio_write
-u32_t sio_write(sio_fd_t, u8_t *, u32_t);
-#endif
-
-#ifndef sio_read_abort
-void sio_read_abort(sio_fd_t);
-#endif
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/snmp.h b/src/VBox/Devices/Network/lwip/src/include/lwip/snmp.h
deleted file mode 100644
index 95145ce..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/snmp.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright (c) 2001, 2002 Leon Woestenberg <leon.woestenberg at axon.tv>
- * Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Leon Woestenberg <leon.woestenberg at axon.tv>
- *
- */
-#ifndef __LWIP_SNMP_H__
-#define __LWIP_SNMP_H__
-
-#include "lwip/opt.h"
-#include "lwip/netif.h"
-#include "lwip/udp.h"
-
-/* SNMP support available? */
-#if defined(LWIP_SNMP) && (LWIP_SNMP > 0)
-
-/** fixed maximum length for object identifier type */
-#define LWIP_SNMP_OBJ_ID_LEN 32
-/** internal object identifier representation */
-struct snmp_obj_id
-{
-  u8_t len;
-  s32_t id[LWIP_SNMP_OBJ_ID_LEN];
-};
-
-/* system */
-void snmp_set_sysdesr(u8_t* str, u8_t* strlen);
-void snmp_set_sysobjid(struct snmp_obj_id *oid);
-void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid);
-void snmp_inc_sysuptime(void);
-void snmp_get_sysuptime(u32_t *value);
-void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen);
-void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen);
-void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen);
-
-/* network interface */
-void snmp_add_ifinoctets(struct netif *ni, u32_t value); 
-void snmp_inc_ifinucastpkts(struct netif *ni);
-void snmp_inc_ifinnucastpkts(struct netif *ni);
-void snmp_inc_ifindiscards(struct netif *ni);
-void snmp_add_ifoutoctets(struct netif *ni, u32_t value);
-void snmp_inc_ifoutucastpkts(struct netif *ni);
-void snmp_inc_ifoutnucastpkts(struct netif *ni);
-void snmp_inc_ifoutdiscards(struct netif *ni);
-void snmp_inc_iflist(void);
-void snmp_dec_iflist(void);
-
-/* ARP (for atTable and ipNetToMediaTable) */
-void snmp_insert_arpidx_tree(struct netif *ni, struct ip_addr *ip);
-void snmp_delete_arpidx_tree(struct netif *ni, struct ip_addr *ip);
-
-/* IP */
-void snmp_inc_ipinreceives(void);
-void snmp_inc_ipinhdrerrors(void);
-void snmp_inc_ipinaddrerrors(void);
-void snmp_inc_ipforwdatagrams(void);
-void snmp_inc_ipinunknownprotos(void);
-void snmp_inc_ipindiscards(void);
-void snmp_inc_ipindelivers(void);
-void snmp_inc_ipoutrequests(void);
-void snmp_inc_ipoutdiscards(void);
-void snmp_inc_ipoutnoroutes(void);
-void snmp_inc_ipreasmreqds(void);
-void snmp_inc_ipreasmoks(void);
-void snmp_inc_ipreasmfails(void);
-void snmp_inc_ipfragoks(void);
-void snmp_inc_ipfragfails(void);
-void snmp_inc_ipfragcreates(void);
-void snmp_inc_iproutingdiscards(void);
-void snmp_insert_ipaddridx_tree(struct netif *ni);
-void snmp_delete_ipaddridx_tree(struct netif *ni);
-void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni);
-void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni);
-
-/* ICMP */
-void snmp_inc_icmpinmsgs(void);
-void snmp_inc_icmpinerrors(void);
-void snmp_inc_icmpindestunreachs(void);
-void snmp_inc_icmpintimeexcds(void);
-void snmp_inc_icmpinparmprobs(void);
-void snmp_inc_icmpinsrcquenchs(void);
-void snmp_inc_icmpinredirects(void);
-void snmp_inc_icmpinechos(void);
-void snmp_inc_icmpinechoreps(void);
-void snmp_inc_icmpintimestamps(void);
-void snmp_inc_icmpintimestampreps(void);
-void snmp_inc_icmpinaddrmasks(void);
-void snmp_inc_icmpinaddrmaskreps(void);
-void snmp_inc_icmpoutmsgs(void);
-void snmp_inc_icmpouterrors(void);
-void snmp_inc_icmpoutdestunreachs(void);
-void snmp_inc_icmpouttimeexcds(void);
-void snmp_inc_icmpoutparmprobs(void);
-void snmp_inc_icmpoutsrcquenchs(void);
-void snmp_inc_icmpoutredirects(void); 
-void snmp_inc_icmpoutechos(void);
-void snmp_inc_icmpoutechoreps(void);
-void snmp_inc_icmpouttimestamps(void);
-void snmp_inc_icmpouttimestampreps(void);
-void snmp_inc_icmpoutaddrmasks(void);
-void snmp_inc_icmpoutaddrmaskreps(void);
-
-/* TCP */
-void snmp_inc_tcpactiveopens(void);
-void snmp_inc_tcppassiveopens(void);
-void snmp_inc_tcpattemptfails(void);
-void snmp_inc_tcpestabresets(void);
-void snmp_inc_tcpinsegs(void);
-void snmp_inc_tcpoutsegs(void);
-void snmp_inc_tcpretranssegs(void);
-void snmp_inc_tcpinerrs(void);
-void snmp_inc_tcpoutrsts(void);
-
-/* UDP */
-void snmp_inc_udpindatagrams(void);
-void snmp_inc_udpnoports(void);
-void snmp_inc_udpinerrors(void);
-void snmp_inc_udpoutdatagrams(void);
-void snmp_insert_udpidx_tree(struct udp_pcb *pcb);
-void snmp_delete_udpidx_tree(struct udp_pcb *pcb);
-
-/* SNMP */
-void snmp_inc_snmpinpkts(void);
-void snmp_inc_snmpoutpkts(void);
-void snmp_inc_snmpinbadversions(void);
-void snmp_inc_snmpinbadcommunitynames(void);
-void snmp_inc_snmpinbadcommunityuses(void);
-void snmp_inc_snmpinasnparseerrs(void);
-void snmp_inc_snmpintoobigs(void);
-void snmp_inc_snmpinnosuchnames(void);
-void snmp_inc_snmpinbadvalues(void);
-void snmp_inc_snmpinreadonlys(void);
-void snmp_inc_snmpingenerrs(void);
-void snmp_add_snmpintotalreqvars(u8_t value);
-void snmp_add_snmpintotalsetvars(u8_t value);
-void snmp_inc_snmpingetrequests(void);
-void snmp_inc_snmpingetnexts(void);
-void snmp_inc_snmpinsetrequests(void);
-void snmp_inc_snmpingetresponses(void);
-void snmp_inc_snmpintraps(void);
-void snmp_inc_snmpouttoobigs(void);
-void snmp_inc_snmpoutnosuchnames(void);
-void snmp_inc_snmpoutbadvalues(void);
-void snmp_inc_snmpoutgenerrs(void);
-void snmp_inc_snmpoutgetrequests(void);
-void snmp_inc_snmpoutgetnexts(void);
-void snmp_inc_snmpoutsetrequests(void);
-void snmp_inc_snmpoutgetresponses(void);
-void snmp_inc_snmpouttraps(void);
-void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid);
-void snmp_set_snmpenableauthentraps(u8_t *value);
-void snmp_get_snmpenableauthentraps(u8_t *value);
-
-/* LWIP_SNMP support not available */
-/* define everything to be empty */
-#else
-
-/* system */
-#define snmp_set_sysdesr(str, strlen)
-#define snmp_get_sysobjid_ptr(oid)
-#define snmp_inc_sysuptime()
-#define snmp_get_sysuptime(value)
-
-/* network interface */
-#define snmp_add_ifinoctets(ni,value) 
-#define snmp_inc_ifinucastpkts(ni)
-#define snmp_inc_ifinnucastpkts(ni)
-#define snmp_inc_ifindiscards(ni)
-#define snmp_add_ifoutoctets(ni,value)
-#define snmp_inc_ifoutucastpkts(ni)
-#define snmp_inc_ifoutnucastpkts(ni)
-#define snmp_inc_ifoutdiscards(ni)
-#define snmp_inc_iflist()
-#define snmp_dec_iflist()
-
-/* ARP */
-#define snmp_insert_arpidx_tree(ni,ip)
-#define snmp_delete_arpidx_tree(ni,ip)
-
-/* IP */
-#define snmp_inc_ipinreceives()
-#define snmp_inc_ipinhdrerrors()
-#define snmp_inc_ipinaddrerrors()
-#define snmp_inc_ipforwdatagrams()
-#define snmp_inc_ipinunknownprotos()
-#define snmp_inc_ipindiscards()
-#define snmp_inc_ipindelivers()
-#define snmp_inc_ipoutrequests()
-#define snmp_inc_ipoutdiscards()
-#define snmp_inc_ipoutnoroutes()
-#define snmp_inc_ipreasmreqds()
-#define snmp_inc_ipreasmoks()
-#define snmp_inc_ipreasmfails()
-#define snmp_inc_ipfragoks()
-#define snmp_inc_ipfragfails()
-#define snmp_inc_ipfragcreates()
-#define snmp_inc_iproutingdiscards()
-#define snmp_insert_ipaddridx_tree(ni)
-#define snmp_delete_ipaddridx_tree(ni)
-#define snmp_insert_iprteidx_tree(dflt, ni)
-#define snmp_delete_iprteidx_tree(dflt, ni)
-
-/* ICMP */
-#define snmp_inc_icmpinmsgs()
-#define snmp_inc_icmpinerrors() 
-#define snmp_inc_icmpindestunreachs() 
-#define snmp_inc_icmpintimeexcds()
-#define snmp_inc_icmpinparmprobs() 
-#define snmp_inc_icmpinsrcquenchs() 
-#define snmp_inc_icmpinredirects() 
-#define snmp_inc_icmpinechos() 
-#define snmp_inc_icmpinechoreps()
-#define snmp_inc_icmpintimestamps() 
-#define snmp_inc_icmpintimestampreps()
-#define snmp_inc_icmpinaddrmasks()
-#define snmp_inc_icmpinaddrmaskreps()
-#define snmp_inc_icmpoutmsgs()
-#define snmp_inc_icmpouterrors()
-#define snmp_inc_icmpoutdestunreachs() 
-#define snmp_inc_icmpouttimeexcds() 
-#define snmp_inc_icmpoutparmprobs()
-#define snmp_inc_icmpoutsrcquenchs()
-#define snmp_inc_icmpoutredirects() 
-#define snmp_inc_icmpoutechos() 
-#define snmp_inc_icmpoutechoreps()
-#define snmp_inc_icmpouttimestamps()
-#define snmp_inc_icmpouttimestampreps()
-#define snmp_inc_icmpoutaddrmasks()
-#define snmp_inc_icmpoutaddrmaskreps()
-/* TCP */
-#define snmp_inc_tcpactiveopens()
-#define snmp_inc_tcppassiveopens()
-#define snmp_inc_tcpattemptfails()
-#define snmp_inc_tcpestabresets()
-#define snmp_inc_tcpinsegs()
-#define snmp_inc_tcpoutsegs()
-#define snmp_inc_tcpretranssegs()
-#define snmp_inc_tcpinerrs()
-#define snmp_inc_tcpoutrsts()
-
-/* UDP */
-#define snmp_inc_udpindatagrams()
-#define snmp_inc_udpnoports()
-#define snmp_inc_udpinerrors()
-#define snmp_inc_udpoutdatagrams()
-#define snmp_insert_udpidx_tree(pcb)
-#define snmp_delete_udpidx_tree(pcb)
-
-/* SNMP */
-#define snmp_inc_snmpinpkts()
-#define snmp_inc_snmpoutpkts()
-#define snmp_inc_snmpinbadversions()
-#define snmp_inc_snmpinbadcommunitynames()
-#define snmp_inc_snmpinbadcommunityuses()
-#define snmp_inc_snmpinasnparseerrs()
-#define snmp_inc_snmpintoobigs()
-#define snmp_inc_snmpinnosuchnames()
-#define snmp_inc_snmpinbadvalues()
-#define snmp_inc_snmpinreadonlys()
-#define snmp_inc_snmpingenerrs()
-#define snmp_add_snmpintotalreqvars(value)
-#define snmp_add_snmpintotalsetvars(value)
-#define snmp_inc_snmpingetrequests()
-#define snmp_inc_snmpingetnexts()
-#define snmp_inc_snmpinsetrequests()
-#define snmp_inc_snmpingetresponses()
-#define snmp_inc_snmpintraps()
-#define snmp_inc_snmpouttoobigs()
-#define snmp_inc_snmpoutnosuchnames()
-#define snmp_inc_snmpoutbadvalues()
-#define snmp_inc_snmpoutgenerrs()
-#define snmp_inc_snmpoutgetrequests()
-#define snmp_inc_snmpoutgetnexts()
-#define snmp_inc_snmpoutsetrequests()
-#define snmp_inc_snmpoutgetresponses()
-#define snmp_inc_snmpouttraps()
-#define snmp_get_snmpgrpid_ptr(oid)
-#define snmp_set_snmpenableauthentraps(value)
-#define snmp_get_snmpenableauthentraps(value)
-
-#endif
-
-#endif /* __LWIP_SNMP_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_asn1.h b/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_asn1.h
deleted file mode 100644
index c1df94a..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_asn1.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * @file
- * Abstract Syntax Notation One (ISO 8824, 8825) codec.
- */
- 
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#ifndef __LWIP_SNMP_ASN1_H__
-#define __LWIP_SNMP_ASN1_H__
-
-#include "lwip/opt.h"
-#include "arch/cc.h"
-#include "lwip/err.h"
-#include "lwip/pbuf.h"
-#include "lwip/snmp.h"
-
-#define SNMP_ASN1_UNIV   (!0x80 | !0x40)
-#define SNMP_ASN1_APPLIC (!0x80 |  0x40)
-#define SNMP_ASN1_CONTXT ( 0x80 | !0x40)
-
-#define SNMP_ASN1_CONSTR (0x20)
-#define SNMP_ASN1_PRIMIT (!0x20)
-
-/* universal tags */
-#define SNMP_ASN1_INTEG  2
-#define SNMP_ASN1_OC_STR 4
-#define SNMP_ASN1_NUL    5
-#define SNMP_ASN1_OBJ_ID 6
-#define SNMP_ASN1_SEQ    16
-
-/* application specific (SNMP) tags */
-#define SNMP_ASN1_IPADDR 0    /* octet string size(4) */
-#define SNMP_ASN1_COUNTER 1   /* u32_t */
-#define SNMP_ASN1_GAUGE 2     /* u32_t */
-#define SNMP_ASN1_TIMETICKS 3 /* u32_t */
-#define SNMP_ASN1_OPAQUE 4    /* octet string */
-
-/* context specific (SNMP) tags */
-#define SNMP_ASN1_PDU_GET_REQ 0
-#define SNMP_ASN1_PDU_GET_NEXT_REQ 1
-#define SNMP_ASN1_PDU_GET_RESP 2
-#define SNMP_ASN1_PDU_SET_REQ 3
-#define SNMP_ASN1_PDU_TRAP 4
-
-err_t snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type);
-err_t snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length);
-err_t snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value);
-err_t snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value);
-err_t snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid);
-err_t snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw);
-
-void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed);
-void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed);
-void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed);
-void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed);
-err_t snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type);
-err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length);
-err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, u32_t value);
-err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u8_t octets_needed, s32_t value);
-err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident);
-err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u8_t raw_len, u8_t *raw);
-
-#endif
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_msg.h b/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_msg.h
deleted file mode 100644
index 66faedd..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_msg.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/**
- * @file
- * SNMP Agent message handling structures.
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#ifndef __LWIP_SNMP_MSG_H__
-#define __LWIP_SNMP_MSG_H__
-
-#include "lwip/opt.h"
-#include "arch/cc.h"
-#include "lwip/snmp.h"
-#include "lwip/snmp_structs.h"
-
-#if SNMP_PRIVATE_MIB
-#include "private_mib.h"
-#endif
-
-#define SNMP_IN_PORT 161
-#define SNMP_TRAP_PORT 162
-
-#define SNMP_ES_NOERROR 0
-#define SNMP_ES_TOOBIG 1
-#define SNMP_ES_NOSUCHNAME 2
-#define SNMP_ES_BADVALUE 3
-#define SNMP_ES_READONLY 4
-#define SNMP_ES_GENERROR 5
-
-#define SNMP_GENTRAP_COLDSTART 0
-#define SNMP_GENTRAP_WARMSTART 1
-#define SNMP_GENTRAP_AUTHFAIL 4
-#define SNMP_GENTRAP_ENTERPRISESPC 6
-
-struct snmp_varbind
-{
-  /* next pointer, NULL for last in list */
-  struct snmp_varbind *next;
-  /* previous pointer, NULL for first in list */
-  struct snmp_varbind *prev;
-
-  /* object identifier length (in s32_t) */
-  u8_t ident_len;
-  /* object identifier array */
-  s32_t *ident;
-
-  /* object value ASN1 type */
-  u8_t value_type;
-  /* object value length (in u8_t) */
-  u8_t value_len;
-  /* object value */
-  void *value;
-
-  /* encoding varbind seq length length */
-  u8_t seqlenlen;
-  /* encoding object identifier length length */
-  u8_t olenlen;
-  /* encoding object value length length */
-  u8_t vlenlen;
-  /* encoding varbind seq length */
-  u16_t seqlen;
-  /* encoding object identifier length */
-  u16_t olen;
-  /* encoding object value length */
-  u16_t vlen;
-};
-
-struct snmp_varbind_root
-{
-  struct snmp_varbind *head;
-  struct snmp_varbind *tail;
-  /* number of variable bindings in list */
-  u8_t count;
-  /* encoding varbind-list seq length length */
-  u8_t seqlenlen;
-  /* encoding varbind-list seq length */
-  u16_t seqlen;
-};
-
-/** output response message header length fields */
-struct snmp_resp_header_lengths
-{
-  /* encoding error-index length length */
-  u8_t erridxlenlen;
-  /* encoding error-status length length */
-  u8_t errstatlenlen;
-  /* encoding request id length length */
-  u8_t ridlenlen;
-  /* encoding pdu length length */
-  u8_t pdulenlen;
-  /* encoding community length length */
-  u8_t comlenlen;
-  /* encoding version length length */
-  u8_t verlenlen;
-  /* encoding sequence length length */
-  u8_t seqlenlen;
-
-  /* encoding error-index length */
-  u16_t erridxlen;
-  /* encoding error-status length */
-  u16_t errstatlen;
-  /* encoding request id length */
-  u16_t ridlen;
-  /* encoding pdu length */
-  u16_t pdulen;
-  /* encoding community length */
-  u16_t comlen;
-  /* encoding version length */
-  u16_t verlen;
-  /* encoding sequence length */
-  u16_t seqlen;
-};
-
-/** output response message header length fields */
-struct snmp_trap_header_lengths
-{
-  /* encoding timestamp length length */
-  u8_t tslenlen;
-  /* encoding specific-trap length length */
-  u8_t strplenlen;
-  /* encoding generic-trap length length */
-  u8_t gtrplenlen;
-  /* encoding agent-addr length length */
-  u8_t aaddrlenlen;
-  /* encoding enterprise-id length length */
-  u8_t eidlenlen;
-  /* encoding pdu length length */
-  u8_t pdulenlen;
-  /* encoding community length length */
-  u8_t comlenlen;
-  /* encoding version length length */
-  u8_t verlenlen;
-  /* encoding sequence length length */
-  u8_t seqlenlen;
-
-  /* encoding timestamp length */
-  u16_t tslen;
-  /* encoding specific-trap length */
-  u16_t strplen;
-  /* encoding generic-trap length */
-  u16_t gtrplen;
-  /* encoding agent-addr length */
-  u16_t aaddrlen;
-  /* encoding enterprise-id length */
-  u16_t eidlen;
-  /* encoding pdu length */
-  u16_t pdulen;
-  /* encoding community length */
-  u16_t comlen;
-  /* encoding version length */
-  u16_t verlen;
-  /* encoding sequence length */
-  u16_t seqlen;
-};
-
-/* Accepting new SNMP messages. */
-#define SNMP_MSG_EMPTY                 0
-/* Search for matching object for variable binding. */
-#define SNMP_MSG_SEARCH_OBJ            1
-/* Perform SNMP operation on in-memory object.
-   Pass-through states, for symmetry only. */
-#define SNMP_MSG_INTERNAL_GET_OBJDEF   2
-#define SNMP_MSG_INTERNAL_GET_VALUE    3
-#define SNMP_MSG_INTERNAL_SET_TEST     4
-#define SNMP_MSG_INTERNAL_GET_OBJDEF_S 5
-#define SNMP_MSG_INTERNAL_SET_VALUE    6
-/* Perform SNMP operation on object located externally.
-   In theory this could be used for building a proxy agent.
-   Practical use is for an enterprise spc. app. gateway. */
-#define SNMP_MSG_EXTERNAL_GET_OBJDEF   7
-#define SNMP_MSG_EXTERNAL_GET_VALUE    8
-#define SNMP_MSG_EXTERNAL_SET_TEST     9
-#define SNMP_MSG_EXTERNAL_GET_OBJDEF_S 10
-#define SNMP_MSG_EXTERNAL_SET_VALUE    11
-
-#define SNMP_COMMUNITY_STR_LEN 64
-struct snmp_msg_pstat
-{
-  /* lwIP local port (161) binding */
-  struct udp_pcb *pcb;
-  /* source IP address */
-  struct ip_addr sip;
-  /* source UDP port */
-  u16_t sp;
-  /* request type */
-  u8_t rt;
-  /* request ID */
-  s32_t rid;
-  /* error status */
-  s32_t error_status;
-  /* error index */
-  s32_t error_index;
-  /* community name (zero terminated) */
-  u8_t community[SNMP_COMMUNITY_STR_LEN + 1];
-  /* community string length (exclusive zero term) */
-  u8_t com_strlen;
-  /* one out of MSG_EMPTY, MSG_DEMUX, MSG_INTERNAL, MSG_EXTERNAL_x */
-  u8_t state;
-  /* saved arguments for MSG_EXTERNAL_x */
-  struct mib_external_node *ext_mib_node;
-  struct snmp_name_ptr ext_name_ptr;
-  struct obj_def ext_object_def;
-  struct snmp_obj_id ext_oid;
-  /* index into input variable binding list */
-  u8_t vb_idx;
-  /* ptr into input variable binding list */
-  struct snmp_varbind *vb_ptr;
-  /* list of variable bindings from input */
-  struct snmp_varbind_root invb;
-  /* list of variable bindings to output */
-  struct snmp_varbind_root outvb;
-  /* output response lengths used in ASN encoding */
-  struct snmp_resp_header_lengths rhl;
-};
-
-struct snmp_msg_trap
-{
-  /* lwIP local port (161) binding */
-  struct udp_pcb *pcb;
-  /* destination IP address in network order */
-  struct ip_addr dip;
-
-  /* source enterprise ID (sysObjectID) */
-  struct snmp_obj_id *enterprise;
-  /* source IP address, raw network order format */
-  u8_t sip_raw[4];
-  /* generic trap code */
-  u32_t gen_trap;
-  /* specific trap code */
-  u32_t spc_trap;
-  /* timestamp */
-  u32_t ts;
-  /* list of variable bindings to output */
-  struct snmp_varbind_root outvb;
-  /* output trap lengths used in ASN encoding */
-  struct snmp_trap_header_lengths thl;
-};
-
-/** Agent Version constant, 0 = v1 oddity */
-extern const s32_t snmp_version;
-/** Agent default "public" community string */
-extern const char snmp_publiccommunity[7];
-
-extern struct snmp_msg_trap trap_msg;
-
-/** Agent setup, start listening to port 161. */
-void snmp_init(void);
-void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable);
-void snmp_trap_dst_ip_set(u8_t dst_idx, struct ip_addr *dst);
-
-/** Varbind-list functions. */
-struct snmp_varbind* snmp_varbind_alloc(struct snmp_obj_id *oid, u8_t type, u8_t len);
-void snmp_varbind_free(struct snmp_varbind *vb);
-void snmp_varbind_list_free(struct snmp_varbind_root *root);
-void snmp_varbind_tail_add(struct snmp_varbind_root *root, struct snmp_varbind *vb);
-struct snmp_varbind* snmp_varbind_tail_remove(struct snmp_varbind_root *root);
-
-/** Handle an internal (recv) or external (private response) event. */
-void snmp_msg_event(u8_t request_id);
-err_t snmp_send_response(struct snmp_msg_pstat *m_stat);
-err_t snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap);
-void snmp_coldstart_trap(void);
-void snmp_authfail_trap(void);
-
-#endif
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_structs.h b/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_structs.h
deleted file mode 100644
index f485466..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/snmp_structs.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/**
- * @file
- * Generic MIB tree structures.
- *
- * @todo namespace prefixes
- */
-
-/*
- * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * Author: Christiaan Simons <christiaan.simons at axon.tv>
- */
-
-#ifndef __LWIP_SNMP_STRUCTS_H__
-#define __LWIP_SNMP_STRUCTS_H__
-
-#include "lwip/opt.h"
-#if LWIP_SNMP
-
-#include "arch/cc.h"
-#include "lwip/snmp.h"
-
-#if SNMP_PRIVATE_MIB
-#include "private_mib.h"
-#endif
-
-/* MIB object instance */
-#define MIB_OBJECT_NONE 0 
-#define MIB_OBJECT_SCALAR 1
-#define MIB_OBJECT_TAB 2
-
-/* MIB object access */
-#define MIB_OBJECT_READ_ONLY 0
-#define MIB_OBJECT_READ_WRITE 1
-#define MIB_OBJECT_WRITE_ONLY 2
-#define MIB_OBJECT_NOT_ACCESSIBLE 3
-
-/** object definition returned by (get_object_def)() */
-struct obj_def
-{
-  /* MIB_OBJECT_NONE (0), MIB_OBJECT_SCALAR (1), MIB_OBJECT_TAB (2) */
-  u8_t instance;
-  /* 0 read-only, 1 read-write, 2 write-only, 3 not-accessible */
-  u8_t access;
-  /* ASN type for this object */
-  u8_t asn_type;
-  /* value length (host length) */
-  u16_t v_len;
-  /* length of instance part of supplied object identifier */
-  u8_t  id_inst_len;
-  /* instance part of supplied object identifier */
-  s32_t *id_inst_ptr;
-};
-
-struct snmp_name_ptr
-{
-  u8_t ident_len;
-  s32_t *ident;
-};
-
-/** MIB const scalar (.0) node */
-#define MIB_NODE_SC 0x01
-/** MIB const array node */
-#define MIB_NODE_AR 0x02
-/** MIB array node (mem_malloced from RAM) */
-#define MIB_NODE_RA 0x03
-/** MIB list root node (mem_malloced from RAM) */
-#define MIB_NODE_LR 0x04
-/** MIB node for external objects */
-#define MIB_NODE_EX 0x05
-
-/** node "base class" layout, the mandatory fields for a node  */
-struct mib_node
-{
-  /** returns struct obj_def for the given object identifier */
-  void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
-  /** returns object value for the given object identifier,
-     @note the caller must allocate at least len bytes for the value */
-  void (*get_value)(struct obj_def *od, u16_t len, void *value);
-  /** tests length and/or range BEFORE setting */
-  u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
-  /** sets object value, only to be called when set_test()  */
-  void (*set_value)(struct obj_def *od, u16_t len, void *value);  
-  /** One out of MIB_NODE_AR, MIB_NODE_LR or MIB_NODE_EX */
-  const u8_t node_type;
-  /* array or max list length */
-  const u16_t maxlength;
-};
-
-/** derived node for scalars .0 index */
-typedef struct mib_node mib_scalar_node;
-
-/** derived node, points to a fixed size const array
-    of sub-identifiers plus a 'child' pointer */
-struct mib_array_node
-{
-  /* inherited "base class" members */
-  void (* const get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
-  void (* const get_value)(struct obj_def *od, u16_t len, void *value);
-  u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
-  void (*set_value)(struct obj_def *od, u16_t len, void *value);
-
-  const u8_t node_type;
-  const u16_t maxlength;
-
-  /* aditional struct members */
-  const s32_t *objid;
-  struct mib_node* const *nptr;
-};
-
-/** derived node, points to a fixed size mem_malloced array
-    of sub-identifiers plus a 'child' pointer */
-struct mib_ram_array_node
-{
-  /* inherited "base class" members */
-  void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
-  void (*get_value)(struct obj_def *od, u16_t len, void *value);
-  u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
-  void (*set_value)(struct obj_def *od, u16_t len, void *value);
-
-  u8_t node_type;
-  u16_t maxlength;
-
-  /* aditional struct members */
-  s32_t *objid;
-  struct mib_node **nptr;
-};
-
-struct mib_list_node
-{
-  struct mib_list_node *prev;  
-  struct mib_list_node *next;
-  s32_t objid;
-  struct mib_node *nptr;
-};
-
-/** derived node, points to a doubly linked list
-    of sub-identifiers plus a 'child' pointer */
-struct mib_list_rootnode
-{
-  /* inherited "base class" members */
-  void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
-  void (*get_value)(struct obj_def *od, u16_t len, void *value);
-  u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
-  void (*set_value)(struct obj_def *od, u16_t len, void *value);
-
-  u8_t node_type;
-  u16_t maxlength;
-
-  /* aditional struct members */
-  struct mib_list_node *head;
-  struct mib_list_node *tail;
-  /* counts list nodes in list  */
-  u16_t count;
-};
-
-/** derived node, has access functions for mib object in external memory or device
-    using 'tree_level' and 'idx', with a range 0 .. (level_length() - 1) */
-struct mib_external_node
-{
-  /* inherited "base class" members */
-  void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od);
-  void (*get_value)(struct obj_def *od, u16_t len, void *value);
-  u8_t (*set_test)(struct obj_def *od, u16_t len, void *value);
-  void (*set_value)(struct obj_def *od, u16_t len, void *value);
-
-  u8_t node_type;
-  u16_t maxlength;
-
-  /* aditional struct members */
-  /** points to an extenal (in memory) record of some sort of addressing
-      information, passed to and interpreted by the funtions below */
-  void* addr_inf;
-  /** tree levels under this node */
-  u8_t tree_levels;
-  /** number of objects at this level */
-  u16_t (*level_length)(void* addr_inf, u8_t level);
-  /** compares object sub identifier with external id
-      return zero when equal, nonzero when unequal */
-  s32_t (*ident_cmp)(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id);
-  void (*get_objid)(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id);
-
-  /** async Questions */
-  void (*get_object_def_q)(void* addr_inf, u8_t rid, u8_t ident_len, s32_t *ident);
-  void (*get_value_q)(u8_t rid, struct obj_def *od);
-  void (*set_test_q)(u8_t rid, struct obj_def *od);
-  void (*set_value_q)(u8_t rid, struct obj_def *od, u16_t len, void *value);
-  /** async Answers */
-  void (*get_object_def_a)(u8_t rid, u8_t ident_len, s32_t *ident, struct obj_def *od);
-  void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
-  u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
-  void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value);
-  /** async Panic Close (agent returns error reply, 
-      e.g. used for external transaction cleanup) */
-  void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident);
-  void (*get_value_pc)(u8_t rid, struct obj_def *od);
-  void (*set_test_pc)(u8_t rid, struct obj_def *od);
-  void (*set_value_pc)(u8_t rid, struct obj_def *od);
-};
-
-/** export MIB tree from mib2.c */
-extern const struct mib_array_node internet;
-
-/** dummy function pointers for non-leaf MIB nodes from mib2.c */
-void noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
-void noleafs_get_value(struct obj_def *od, u16_t len, void *value);
-u8_t noleafs_set_test(struct obj_def *od, u16_t len, void *value);
-void noleafs_set_value(struct obj_def *od, u16_t len, void *value);
-
-void snmp_oidtoip(s32_t *ident, struct ip_addr *ip);
-void snmp_iptooid(struct ip_addr *ip, s32_t *ident);
-void snmp_ifindextonetif(s32_t ifindex, struct netif **netif);
-void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx);
-
-struct mib_list_node* snmp_mib_ln_alloc(s32_t id);
-void snmp_mib_ln_free(struct mib_list_node *ln);
-struct mib_list_rootnode* snmp_mib_lrn_alloc(void);
-void snmp_mib_lrn_free(struct mib_list_rootnode *lrn);
-
-s8_t snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn);
-s8_t snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn);
-struct mib_list_rootnode *snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n);
-
-struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np);
-struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
-u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident);
-u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret);
-
-#endif /* LWIP_SNMP */
-#endif
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/sockets.h b/src/VBox/Devices/Network/lwip/src/include/lwip/sockets.h
deleted file mode 100644
index d5f8ccf..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/sockets.h
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-
-#ifndef __LWIP_SOCKETS_H__
-#define __LWIP_SOCKETS_H__
-#include "lwip/ip_addr.h"
-
-struct sockaddr_in {
-  u8_t sin_len;
-  u8_t sin_family;
-  u16_t sin_port;
-  struct in_addr sin_addr;
-  char sin_zero[8];
-};
-
-struct sockaddr {
-  u8_t sa_len;
-  u8_t sa_family;
-  char sa_data[14];
-};
-
-#ifndef socklen_t
-#  define socklen_t int
-#endif
-
-
-#define SOCK_STREAM     1
-#define SOCK_DGRAM      2
-#define SOCK_RAW        3
-
-/*
- * Option flags per-socket.
- */
-#define  SO_DEBUG  0x0001    /* turn on debugging info recording */
-#define  SO_ACCEPTCONN  0x0002    /* socket has had listen() */
-#define  SO_REUSEADDR  0x0004    /* allow local address reuse */
-#define  SO_KEEPALIVE  0x0008    /* keep connections alive */
-#define  SO_DONTROUTE  0x0010    /* just use interface addresses */
-#define  SO_BROADCAST  0x0020    /* permit sending of broadcast msgs */
-#define  SO_USELOOPBACK  0x0040    /* bypass hardware when possible */
-#define  SO_LINGER  0x0080    /* linger on close if data present */
-#define  SO_OOBINLINE  0x0100    /* leave received OOB data in line */
-#define	 SO_REUSEPORT	0x0200		/* allow local address & port reuse */
-
-#define SO_DONTLINGER   (int)(~SO_LINGER)
-
-/*
- * Additional options, not kept in so_options.
- */
-#define SO_SNDBUF  0x1001    /* send buffer size */
-#define SO_RCVBUF  0x1002    /* receive buffer size */
-#define SO_SNDLOWAT  0x1003    /* send low-water mark */
-#define SO_RCVLOWAT  0x1004    /* receive low-water mark */
-#define SO_SNDTIMEO  0x1005    /* send timeout */
-#define SO_RCVTIMEO  0x1006    /* receive timeout */
-#define  SO_ERROR  0x1007    /* get error status and clear */
-#define  SO_TYPE    0x1008    /* get socket type */
-
-
-
-/*
- * Structure used for manipulating linger option.
- */
-struct linger {
-       int l_onoff;                /* option on/off */
-       int l_linger;               /* linger time */
-};
-
-/*
- * Level number for (get/set)sockopt() to apply to socket itself.
- */
-#define  SOL_SOCKET  0xfff    /* options for socket level */
-
-
-#define AF_UNSPEC       0
-#define AF_INET         2
-#define PF_INET         AF_INET
-#define PF_UNSPEC       AF_UNSPEC
-
-#define IPPROTO_IP      0
-#define IPPROTO_TCP     6
-#define IPPROTO_UDP     17
-
-#define INADDR_ANY      0
-#define INADDR_BROADCAST 0xffffffff
-
-/* Flags we can use with send and recv. */
-#define MSG_DONTWAIT    0x40            /* Nonblocking i/o for this operation only */
-
-
-/*
- * Options for level IPPROTO_IP
- */
-#define IP_TOS       1
-#define IP_TTL       2
-
-
-#define IPTOS_TOS_MASK          0x1E
-#define IPTOS_TOS(tos)          ((tos) & IPTOS_TOS_MASK)
-#define IPTOS_LOWDELAY          0x10
-#define IPTOS_THROUGHPUT        0x08
-#define IPTOS_RELIABILITY       0x04
-#define IPTOS_LOWCOST           0x02
-#define IPTOS_MINCOST           IPTOS_LOWCOST
-
-/*
- * Definitions for IP precedence (also in ip_tos) (hopefully unused)
- */
-#define IPTOS_PREC_MASK                 0xe0
-#define IPTOS_PREC(tos)                ((tos) & IPTOS_PREC_MASK)
-#define IPTOS_PREC_NETCONTROL           0xe0
-#define IPTOS_PREC_INTERNETCONTROL      0xc0
-#define IPTOS_PREC_CRITIC_ECP           0xa0
-#define IPTOS_PREC_FLASHOVERRIDE        0x80
-#define IPTOS_PREC_FLASH                0x60
-#define IPTOS_PREC_IMMEDIATE            0x40
-#define IPTOS_PREC_PRIORITY             0x20
-#define IPTOS_PREC_ROUTINE              0x00
-
-
-/*
- * Commands for ioctlsocket(),  taken from the BSD file fcntl.h.
- *
- *
- * Ioctl's have the command encoded in the lower word,
- * and the size of any in or out parameters in the upper
- * word.  The high 2 bits of the upper word are used
- * to encode the in/out status of the parameter; for now
- * we restrict parameters to at most 128 bytes.
- */
-#if !defined(FIONREAD) || !defined(FIONBIO)
-#define IOCPARM_MASK    0x7f            /* parameters must be < 128 bytes */
-#define IOC_VOID        0x20000000      /* no parameters */
-#define IOC_OUT         0x40000000      /* copy out parameters */
-#define IOC_IN          0x80000000      /* copy in parameters */
-#define IOC_INOUT       (IOC_IN|IOC_OUT)
-                                        /* 0x20000000 distinguishes new &
-                                           old ioctl's */
-#define _IO(x,y)        (IOC_VOID|((x)<<8)|(y))
-
-#define _IOR(x,y,t)     (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
-
-#define _IOW(x,y,t)     (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
-#endif
-
-#ifndef FIONREAD
-#define FIONREAD    _IOR('f', 127, unsigned long) /* get # bytes to read */
-#endif
-#ifndef FIONBIO
-#define FIONBIO     _IOW('f', 126, unsigned long) /* set/clear non-blocking i/o */
-#endif
-
-/* Socket I/O Controls */
-#ifndef SIOCSHIWAT
-#define SIOCSHIWAT  _IOW('s',  0, unsigned long)  /* set high watermark */
-#define SIOCGHIWAT  _IOR('s',  1, unsigned long)  /* get high watermark */
-#define SIOCSLOWAT  _IOW('s',  2, unsigned long)  /* set low watermark */
-#define SIOCGLOWAT  _IOR('s',  3, unsigned long)  /* get low watermark */
-#define SIOCATMARK  _IOR('s',  7, unsigned long)  /* at oob mark? */
-#endif
-
-#ifndef O_NONBLOCK
-#define O_NONBLOCK    04000U
-#endif
-
-#ifndef FD_SET
-  #undef  FD_SETSIZE
-  #define FD_SETSIZE    16
-  #define FD_SET(n, p)  ((p)->fd_bits[(n)/8] |=  (1 << ((n) & 7)))
-  #define FD_CLR(n, p)  ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7)))
-  #define FD_ISSET(n,p) ((p)->fd_bits[(n)/8] &   (1 << ((n) & 7)))
-  #define FD_ZERO(p)    memset((void*)(p),0,sizeof(*(p)))
-
-  typedef struct fd_set {
-          unsigned char fd_bits [(FD_SETSIZE+7)/8];
-        } fd_set;
-
-/* 
- * only define this in sockets.c so it does not interfere
- * with other projects namespaces where timeval is present
- */ 
-#ifndef LWIP_TIMEVAL_PRIVATE
-#define LWIP_TIMEVAL_PRIVATE 1
-#endif
-
-#if LWIP_TIMEVAL_PRIVATE
-  struct timeval {
-    long    tv_sec;         /* seconds */
-    long    tv_usec;        /* and microseconds */
-  };
-#endif
-
-#endif
-
-int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
-int lwip_bind(int s, struct sockaddr *name, socklen_t namelen);
-int lwip_shutdown(int s, int how);
-int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen);
-int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen);
-int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen);
-int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen);
-int lwip_close(int s);
-int lwip_connect(int s, struct sockaddr *name, socklen_t namelen);
-int lwip_listen(int s, int backlog);
-int lwip_recv(int s, void *mem, int len, unsigned int flags);
-int lwip_read(int s, void *mem, int len);
-int lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
-      struct sockaddr *from, socklen_t *fromlen);
-int lwip_send(int s, void *dataptr, int size, unsigned int flags);
-int lwip_sendto(int s, void *dataptr, int size, unsigned int flags,
-    struct sockaddr *to, socklen_t tolen);
-int lwip_socket(int domain, int type, int protocol);
-int lwip_write(int s, void *dataptr, int size);
-int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
-                struct timeval *timeout);
-int lwip_ioctl(int s, long cmd, void *argp);
-
-#if LWIP_COMPAT_SOCKETS
-#define accept(a,b,c)         lwip_accept(a,b,c)
-#define bind(a,b,c)           lwip_bind(a,b,c)
-#define shutdown(a,b)         lwip_shutdown(a,b)
-#define close(s)              lwip_close(s)
-#define connect(a,b,c)        lwip_connect(a,b,c)
-#define getsockname(a,b,c)    lwip_getsockname(a,b,c)
-#define getpeername(a,b,c)    lwip_getpeername(a,b,c)
-#define setsockopt(a,b,c,d,e) lwip_setsockopt(a,b,c,d,e)
-#define getsockopt(a,b,c,d,e) lwip_getsockopt(a,b,c,d,e)
-#define listen(a,b)           lwip_listen(a,b)
-#define recv(a,b,c,d)         lwip_recv(a,b,c,d)
-#define read(a,b,c)           lwip_read(a,b,c)
-#define recvfrom(a,b,c,d,e,f) lwip_recvfrom(a,b,c,d,e,f)
-#define send(a,b,c,d)         lwip_send(a,b,c,d)
-#define sendto(a,b,c,d,e,f)   lwip_sendto(a,b,c,d,e,f)
-#define socket(a,b,c)         lwip_socket(a,b,c)
-#define write(a,b,c)          lwip_write(a,b,c)
-#define select(a,b,c,d,e)     lwip_select(a,b,c,d,e)
-#define ioctlsocket(a,b,c)    lwip_ioctl(a,b,c)
-#endif /* LWIP_COMPAT_SOCKETS */
-
-#endif /* __LWIP_SOCKETS_H__ */
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/stats.h b/src/VBox/Devices/Network/lwip/src/include/lwip/stats.h
deleted file mode 100644
index 71acfd0..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/stats.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_STATS_H__
-#define __LWIP_STATS_H__
-
-#include "lwip/opt.h"
-#include "arch/cc.h"
-
-#include "lwip/mem.h"
-#include "lwip/memp.h"
-
-#if LWIP_STATS
-
-struct stats_proto {
-  u16_t xmit;    /* Transmitted packets. */
-  u16_t rexmit;  /* Retransmitted packets. */
-  u16_t recv;    /* Received packets. */
-  u16_t fw;      /* Forwarded packets. */
-  u16_t drop;    /* Dropped packets. */
-  u16_t chkerr;  /* Checksum error. */
-  u16_t lenerr;  /* Invalid length error. */
-  u16_t memerr;  /* Out of memory error. */
-  u16_t rterr;   /* Routing error. */
-  u16_t proterr; /* Protocol error. */
-  u16_t opterr;  /* Error in options. */
-  u16_t err;     /* Misc error. */
-  u16_t cachehit;
-};
-
-struct stats_mem {
-  mem_size_t avail;
-  mem_size_t used;
-  mem_size_t max;  
-  mem_size_t err;
-};
-
-struct stats_pbuf {
-  u16_t avail;
-  u16_t used;
-  u16_t max;  
-  u16_t err;
-
-  u16_t alloc_locked;
-  u16_t refresh_locked;
-};
-
-struct stats_syselem {
-  u16_t used;
-  u16_t max;
-  u16_t err;
-};
-
-struct stats_sys {
-  struct stats_syselem sem;
-  struct stats_syselem mbox;
-};
-
-struct stats_ {
-  struct stats_proto link;
-  struct stats_proto ip_frag;
-  struct stats_proto ip;
-  struct stats_proto icmp;
-  struct stats_proto udp;
-  struct stats_proto tcp;
-  struct stats_pbuf pbuf;
-  struct stats_mem mem;
-  struct stats_mem memp[MEMP_MAX];
-  struct stats_sys sys;
-};
-
-extern struct stats_ lwip_stats;
-
-
-void stats_init(void);
-
-#define STATS_INC(x) ++lwip_stats.x
-#else
-#define stats_init()
-#define STATS_INC(x)
-#endif /* LWIP_STATS */
-
-#if TCP_STATS
-#define TCP_STATS_INC(x) STATS_INC(x)
-#else
-#define TCP_STATS_INC(x)
-#endif
-
-#if UDP_STATS
-#define UDP_STATS_INC(x) STATS_INC(x)
-#else
-#define UDP_STATS_INC(x)
-#endif
-
-#if ICMP_STATS
-#define ICMP_STATS_INC(x) STATS_INC(x)
-#else
-#define ICMP_STATS_INC(x)
-#endif
-
-#if IP_STATS
-#define IP_STATS_INC(x) STATS_INC(x)
-#else
-#define IP_STATS_INC(x)
-#endif
-
-#if IPFRAG_STATS
-#define IPFRAG_STATS_INC(x) STATS_INC(x)
-#else
-#define IPFRAG_STATS_INC(x)
-#endif
-
-#if LINK_STATS
-#define LINK_STATS_INC(x) STATS_INC(x)
-#else
-#define LINK_STATS_INC(x)
-#endif
-
-/* Display of statistics */
-#if LWIP_STATS_DISPLAY
-void stats_display(void);
-#else
-#define stats_display()
-#endif
-
-#endif /* __LWIP_STATS_H__ */
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/sys.h b/src/VBox/Devices/Network/lwip/src/include/lwip/sys.h
deleted file mode 100644
index f7925b3..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/sys.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_SYS_H__
-#define __LWIP_SYS_H__
-
-#include "arch/cc.h"
-
-#include "lwip/opt.h"
-
-
-#if NO_SYS
-
-/* For a totally minimal and standalone system, we provide null
-   definitions of the sys_ functions. */
-typedef u8_t sys_sem_t;
-typedef u8_t sys_mbox_t;
-struct sys_timeo {u8_t dummy;};
-
-#define sys_init()
-#define sys_timeout(m,h,a)
-#define sys_untimeout(m,a)
-#define sys_sem_new(c) c
-#define sys_sem_signal(s)
-#define sys_sem_wait(s)
-#define sys_sem_free(s)
-#define sys_mbox_new() 0
-#define sys_mbox_fetch(m,d)
-#define sys_mbox_post(m,d)
-#define sys_mbox_free(m)
-
-#define sys_thread_new(t,a,p)
-
-#else /* NO_SYS */
-
-#include "arch/sys_arch.h"
-
-/** Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait */
-#define SYS_ARCH_TIMEOUT 0xffffffff
-
-typedef void (* sys_timeout_handler)(void *arg);
-
-struct sys_timeo {
-  struct sys_timeo *next;
-  u32_t time;
-  sys_timeout_handler h;
-  void *arg;
-};
-
-struct sys_timeouts {
-  struct sys_timeo *next;
-};
-
-/* sys_init() must be called before anthing else. */
-void sys_init(void);
-
-/*
- * sys_timeout():
- *
- * Schedule a timeout a specified amount of milliseconds in the
- * future. When the timeout occurs, the specified timeout handler will
- * be called. The handler will be passed the "arg" argument when
- * called.
- *
- */
-void sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
-void sys_untimeout(sys_timeout_handler h, void *arg);
-struct sys_timeouts *sys_arch_timeouts(void);
-
-/* Semaphore functions. */
-sys_sem_t sys_sem_new(u8_t count);
-void sys_sem_signal(sys_sem_t sem);
-u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout);
-void sys_sem_free(sys_sem_t sem);
-void sys_sem_wait(sys_sem_t sem);
-int sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout);
-
-/* Time functions. */
-#ifdef VBOX
-void sys_msleep(u32_t ms); /* only has a (close to) 1 jiffy resolution. */
-#else
-#ifndef sys_msleep
-void sys_msleep(u32_t ms); /* only has a (close to) 1 jiffy resolution. */
-#endif
-#endif
-#ifndef sys_jiffies
-u32_t sys_jiffies(void); /* since power up. */
-#endif
-
-/* Mailbox functions. */
-sys_mbox_t sys_mbox_new(void);
-void sys_mbox_post(sys_mbox_t mbox, void *msg);
-u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout);
-void sys_mbox_free(sys_mbox_t mbox);
-void sys_mbox_fetch(sys_mbox_t mbox, void **msg);
-
-
-/* Thread functions. */
-sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio);
-
-/* The following functions are used only in Unix code, and
-   can be omitted when porting the stack. */
-/* Returns the current time in microseconds. */
-unsigned long sys_now(void);
-
-#endif /* NO_SYS */
-
-/* Critical Region Protection */
-/* These functions must be implemented in the sys_arch.c file.
-   In some implementations they can provide a more light-weight protection
-   mechanism than using semaphores. Otherwise semaphores can be used for
-   implementation */
-#ifndef SYS_ARCH_PROTECT
-/** SYS_LIGHTWEIGHT_PROT
- * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
- * for certain critical regions during buffer allocation, deallocation and memory
- * allocation and deallocation.
- */
-#if SYS_LIGHTWEIGHT_PROT
-
-/** SYS_ARCH_DECL_PROTECT
- * declare a protection variable. This macro will default to defining a variable of
- * type sys_prot_t. If a particular port needs a different implementation, then
- * this macro may be defined in sys_arch.h.
- */
-#define SYS_ARCH_DECL_PROTECT(lev) sys_prot_t lev
-/** SYS_ARCH_PROTECT
- * Perform a "fast" protect. This could be implemented by
- * disabling interrupts for an embedded system or by using a semaphore or
- * mutex. The implementation should allow calling SYS_ARCH_PROTECT when
- * already protected. The old protection level is returned in the variable
- * "lev". This macro will default to calling the sys_arch_protect() function
- * which should be implemented in sys_arch.c. If a particular port needs a
- * different implementation, then this macro may be defined in sys_arch.h
- */
-#define SYS_ARCH_PROTECT(lev) lev = sys_arch_protect()
-/** SYS_ARCH_UNPROTECT
- * Perform a "fast" set of the protection level to "lev". This could be
- * implemented by setting the interrupt level to "lev" within the MACRO or by
- * using a semaphore or mutex.  This macro will default to calling the
- * sys_arch_unprotect() function which should be implemented in
- * sys_arch.c. If a particular port needs a different implementation, then
- * this macro may be defined in sys_arch.h
- */
-#define SYS_ARCH_UNPROTECT(lev) sys_arch_unprotect(lev)
-sys_prot_t sys_arch_protect(void);
-void sys_arch_unprotect(sys_prot_t pval);
-
-#else
-
-#define SYS_ARCH_DECL_PROTECT(lev)
-#define SYS_ARCH_PROTECT(lev)
-#define SYS_ARCH_UNPROTECT(lev)
-
-#endif /* SYS_LIGHTWEIGHT_PROT */
-
-#endif /* SYS_ARCH_PROTECT */
-
-#endif /* __LWIP_SYS_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/tcp.h b/src/VBox/Devices/Network/lwip/src/include/lwip/tcp.h
deleted file mode 100644
index 9f86892..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/tcp.h
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_TCP_H__
-#define __LWIP_TCP_H__
-
-#include "lwip/sys.h"
-#include "lwip/mem.h"
-
-#include "lwip/pbuf.h"
-#include "lwip/opt.h"
-#include "lwip/ip.h"
-#include "lwip/icmp.h"
-
-#include "lwip/err.h"
-
-struct tcp_pcb;
-
-/* Functions for interfacing with TCP: */
-
-/* Lower layer interface to TCP: */
-void             tcp_init    (void);  /* Must be called first to
-           initialize TCP. */
-void             tcp_tmr     (void);  /* Must be called every
-           TCP_TMR_INTERVAL
-           ms. (Typically 250 ms). */
-/* Application program's interface: */
-struct tcp_pcb * tcp_new     (void);
-struct tcp_pcb * tcp_alloc   (u8_t prio);
-
-void             tcp_arg     (struct tcp_pcb *pcb, void *arg);
-void             tcp_accept  (struct tcp_pcb *pcb,
-            err_t (* accept)(void *arg, struct tcp_pcb *newpcb,
-                 err_t err));
-void             tcp_recv    (struct tcp_pcb *pcb,
-            err_t (* recv)(void *arg, struct tcp_pcb *tpcb,
-          struct pbuf *p, err_t err));
-void             tcp_sent    (struct tcp_pcb *pcb,
-            err_t (* sent)(void *arg, struct tcp_pcb *tpcb,
-               u16_t len));
-void             tcp_poll    (struct tcp_pcb *pcb,
-            err_t (* poll)(void *arg, struct tcp_pcb *tpcb),
-            u8_t interval);
-void             tcp_err     (struct tcp_pcb *pcb,
-            void (* err)(void *arg, err_t err));
-
-#define          tcp_mss(pcb)      ((pcb)->mss)
-#define          tcp_sndbuf(pcb)   ((pcb)->snd_buf)
-
-void             tcp_recved  (struct tcp_pcb *pcb, u16_t len);
-err_t            tcp_bind    (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
-            u16_t port);
-err_t            tcp_connect (struct tcp_pcb *pcb, struct ip_addr *ipaddr,
-            u16_t port, err_t (* connected)(void *arg,
-                    struct tcp_pcb *tpcb,
-                    err_t err));
-struct tcp_pcb * tcp_listen  (struct tcp_pcb *pcb);
-void             tcp_abort   (struct tcp_pcb *pcb);
-err_t            tcp_close   (struct tcp_pcb *pcb);
-err_t            tcp_write   (struct tcp_pcb *pcb, const void *dataptr, u16_t len,
-            u8_t copy);
-
-void             tcp_setprio (struct tcp_pcb *pcb, u8_t prio);
-
-#define TCP_PRIO_MIN    1
-#define TCP_PRIO_NORMAL 64
-#define TCP_PRIO_MAX    127
-
-/* It is also possible to call these two functions at the right
-   intervals (instead of calling tcp_tmr()). */
-void             tcp_slowtmr (void);
-void             tcp_fasttmr (void);
-
-
-/* Only used by IP to pass a TCP segment to TCP: */
-void             tcp_input   (struct pbuf *p, struct netif *inp);
-/* Used within the TCP code only: */
-err_t            tcp_output  (struct tcp_pcb *pcb);
-void             tcp_rexmit  (struct tcp_pcb *pcb);
-void             tcp_rexmit_rto  (struct tcp_pcb *pcb);
-
-
-
-#define TCP_SEQ_LT(a,b)     ((s32_t)((a)-(b)) < 0)
-#define TCP_SEQ_LEQ(a,b)    ((s32_t)((a)-(b)) <= 0)
-#define TCP_SEQ_GT(a,b)     ((s32_t)((a)-(b)) > 0)
-#define TCP_SEQ_GEQ(a,b)    ((s32_t)((a)-(b)) >= 0)
-/* is b<=a<=c? */
-#if 0 /* see bug #10548 */
-#define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b))
-#endif
-#define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c))
-#define TCP_FIN 0x01U
-#define TCP_SYN 0x02U
-#define TCP_RST 0x04U
-#define TCP_PSH 0x08U
-#define TCP_ACK 0x10U
-#define TCP_URG 0x20U
-#define TCP_ECE 0x40U
-#define TCP_CWR 0x80U
-
-#define TCP_FLAGS 0x3fU
-
-/* Length of the TCP header, excluding options. */
-#define TCP_HLEN 20
-
-#ifndef TCP_TMR_INTERVAL
-#define TCP_TMR_INTERVAL       250  /* The TCP timer interval in
-                                       milliseconds. */
-#endif /* TCP_TMR_INTERVAL */
-
-#ifndef TCP_FAST_INTERVAL
-#define TCP_FAST_INTERVAL      TCP_TMR_INTERVAL /* the fine grained timeout in
-                                       milliseconds */
-#endif /* TCP_FAST_INTERVAL */
-
-#ifndef TCP_SLOW_INTERVAL
-#define TCP_SLOW_INTERVAL      (2*TCP_TMR_INTERVAL)  /* the coarse grained timeout in
-                                       milliseconds */
-#endif /* TCP_SLOW_INTERVAL */
-
-#define TCP_FIN_WAIT_TIMEOUT 20000 /* milliseconds */
-#define TCP_SYN_RCVD_TIMEOUT 20000 /* milliseconds */
-
-#define TCP_OOSEQ_TIMEOUT        6U /* x RTO */
-
-#define TCP_MSL 60000  /* The maximum segment lifetime in microseconds */
-
-/*
- * User-settable options (used with setsockopt).
- */
-#define TCP_NODELAY    0x01    /* don't delay send to coalesce packets */
-#define TCP_KEEPALIVE  0x02    /* send KEEPALIVE probes when idle for pcb->keepalive miliseconds */
-
-/* Keepalive values */
-#define  TCP_KEEPDEFAULT   7200000                       /* KEEPALIVE timer in miliseconds */
-#define  TCP_KEEPINTVL     75000                         /* Time between KEEPALIVE probes in miliseconds */
-#define  TCP_KEEPCNT       9                             /* Counter for KEEPALIVE probes */
-#define  TCP_MAXIDLE       TCP_KEEPCNT * TCP_KEEPINTVL   /* Maximum KEEPALIVE probe time */
-
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct tcp_hdr {
-  PACK_STRUCT_FIELD(u16_t src);
-  PACK_STRUCT_FIELD(u16_t dest);
-  PACK_STRUCT_FIELD(u32_t seqno);
-  PACK_STRUCT_FIELD(u32_t ackno);
-  PACK_STRUCT_FIELD(u16_t _hdrlen_rsvd_flags);
-  PACK_STRUCT_FIELD(u16_t wnd);
-  PACK_STRUCT_FIELD(u16_t chksum);
-  PACK_STRUCT_FIELD(u16_t urgp);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-#define TCPH_OFFSET(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 8)
-#define TCPH_HDRLEN(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 12)
-#define TCPH_FLAGS(phdr)  (ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS)
-
-#define TCPH_OFFSET_SET(phdr, offset) (phdr)->_hdrlen_rsvd_flags = htons(((offset) << 8) | TCPH_FLAGS(phdr))
-#define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | TCPH_FLAGS(phdr))
-#define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons((ntohs((phdr)->_hdrlen_rsvd_flags) & ~TCP_FLAGS) | (flags))
-#define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (flags))
-#define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (TCPH_FLAGS(phdr) & ~(flags)) )
-
-#define TCP_TCPLEN(seg) ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & TCP_FIN || \
-          TCPH_FLAGS((seg)->tcphdr) & TCP_SYN)? 1: 0))
-
-enum tcp_state {
-  CLOSED      = 0,
-  LISTEN      = 1,
-  SYN_SENT    = 2,
-  SYN_RCVD    = 3,
-  ESTABLISHED = 4,
-  FIN_WAIT_1  = 5,
-  FIN_WAIT_2  = 6,
-  CLOSE_WAIT  = 7,
-  CLOSING     = 8,
-  LAST_ACK    = 9,
-  TIME_WAIT   = 10
-};
-
-/* the TCP protocol control block */
-struct tcp_pcb {
-/** common PCB members */
-  IP_PCB;
-/** protocol specific PCB members */
-  struct tcp_pcb *next; /* for the linked list */
-  enum tcp_state state; /* TCP state */
-  u8_t prio;
-  void *callback_arg;
-
-  u16_t local_port;
-  u16_t remote_port;
-  
-  u8_t flags;
-#define TF_ACK_DELAY (u8_t)0x01U   /* Delayed ACK. */
-#define TF_ACK_NOW   (u8_t)0x02U   /* Immediate ACK. */
-#define TF_INFR      (u8_t)0x04U   /* In fast recovery. */
-#define TF_RESET     (u8_t)0x08U   /* Connection was reset. */
-#define TF_CLOSED    (u8_t)0x10U   /* Connection was sucessfully closed. */
-#define TF_GOT_FIN   (u8_t)0x20U   /* Connection was closed by the remote end. */
-#define TF_NODELAY   (u8_t)0x40U   /* Disable Nagle algorithm */
-
-  /* receiver variables */
-  u32_t rcv_nxt;   /* next seqno expected */
-  u16_t rcv_wnd;   /* receiver window */
-  
-  /* Timers */
-  u32_t tmr;
-  u8_t polltmr, pollinterval;
-  
-  /* Retransmission timer. */
-  u16_t rtime;
-  
-  u16_t mss;   /* maximum segment size */
-  
-  /* RTT (round trip time) estimation variables */
-  u32_t rttest; /* RTT estimate in 500ms ticks */
-  u32_t rtseq;  /* sequence number being timed */
-  s16_t sa, sv; /* @todo document this */
-
-  u16_t rto;    /* retransmission time-out */
-  u8_t nrtx;    /* number of retransmissions */
-
-  /* fast retransmit/recovery */
-  u32_t lastack; /* Highest acknowledged seqno. */
-  u8_t dupacks;
-  
-  /* congestion avoidance/control variables */
-  u16_t cwnd;  
-  u16_t ssthresh;
-
-  /* sender variables */
-  u32_t snd_nxt,       /* next seqno to be sent */
-    snd_max,       /* Highest seqno sent. */
-    snd_wnd,       /* sender window */
-    snd_wl1, snd_wl2, /* Sequence and acknowledgement numbers of last
-       window update. */
-    snd_lbb;       /* Sequence number of next byte to be buffered. */
-
-  u16_t acked;
-  
-  u16_t snd_buf;   /* Available buffer space for sending (in bytes). */
-  u8_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */
-  
-  
-  /* These are ordered by sequence number: */
-  struct tcp_seg *unsent;   /* Unsent (queued) segments. */
-  struct tcp_seg *unacked;  /* Sent but unacknowledged segments. */
-#if TCP_QUEUE_OOSEQ  
-  struct tcp_seg *ooseq;    /* Received out of sequence segments. */
-#endif /* TCP_QUEUE_OOSEQ */
-
-#if LWIP_CALLBACK_API
-  /* Function to be called when more send buffer space is available. */
-  err_t (* sent)(void *arg, struct tcp_pcb *pcb, u16_t space);
-  
-  /* Function to be called when (in-sequence) data has arrived. */
-  err_t (* recv)(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err);
-
-  /* Function to be called when a connection has been set up. */
-  err_t (* connected)(void *arg, struct tcp_pcb *pcb, err_t err);
-
-  /* Function to call when a listener has been connected. */
-  err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
-
-  /* Function which is called periodically. */
-  err_t (* poll)(void *arg, struct tcp_pcb *pcb);
-
-  /* Function to be called whenever a fatal error occurs. */
-  void (* errf)(void *arg, err_t err);
-#endif /* LWIP_CALLBACK_API */
-
-  /* idle time before KEEPALIVE is sent */
-  u32_t keepalive;
-  
-  /* KEEPALIVE counter */
-  u8_t keep_cnt;
-};
-
-struct tcp_pcb_listen {  
-/* Common members of all PCB types */
-  IP_PCB;
-
-/* Protocol specific PCB members */
-  struct tcp_pcb_listen *next;   /* for the linked list */
-  
-  /* Even if state is obviously LISTEN this is here for
-   * field compatibility with tpc_pcb to which it is cast sometimes
-   * Until a cleaner solution emerges this is here.FIXME
-   */ 
-  enum tcp_state state;   /* TCP state */
-
-  u8_t prio;
-  void *callback_arg;
-  
-  u16_t local_port; 
-
-#if LWIP_CALLBACK_API
-  /* Function to call when a listener has been connected. */
-  err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
-#endif /* LWIP_CALLBACK_API */
-};
-
-#if LWIP_EVENT_API
-
-enum lwip_event {
-  LWIP_EVENT_ACCEPT,
-  LWIP_EVENT_SENT,
-  LWIP_EVENT_RECV,
-  LWIP_EVENT_CONNECTED,
-  LWIP_EVENT_POLL,
-  LWIP_EVENT_ERR
-};
-
-err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb,
-         enum lwip_event,
-         struct pbuf *p,
-         u16_t size,
-         err_t err);
-
-#define TCP_EVENT_ACCEPT(pcb,err,ret)    ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
-                LWIP_EVENT_ACCEPT, NULL, 0, err)
-#define TCP_EVENT_SENT(pcb,space,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
-                   LWIP_EVENT_SENT, NULL, space, ERR_OK)
-#define TCP_EVENT_RECV(pcb,p,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
-                LWIP_EVENT_RECV, (p), 0, (err))
-#define TCP_EVENT_CONNECTED(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
-                LWIP_EVENT_CONNECTED, NULL, 0, (err))
-#define TCP_EVENT_POLL(pcb,ret)       ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\
-                LWIP_EVENT_POLL, NULL, 0, ERR_OK)
-#define TCP_EVENT_ERR(errf,arg,err)  lwip_tcp_event((arg), NULL, \
-                LWIP_EVENT_ERR, NULL, 0, (err))
-#else /* LWIP_EVENT_API */
-#define TCP_EVENT_ACCEPT(pcb,err,ret)     \
-                        if((pcb)->accept != NULL) \
-                        (ret = (pcb)->accept((pcb)->callback_arg,(pcb),(err)))
-#define TCP_EVENT_SENT(pcb,space,ret) \
-                        if((pcb)->sent != NULL) \
-                        (ret = (pcb)->sent((pcb)->callback_arg,(pcb),(space)))
-#define TCP_EVENT_RECV(pcb,p,err,ret) \
-                        if((pcb)->recv != NULL) \
-                        { ret = (pcb)->recv((pcb)->callback_arg,(pcb),(p),(err)); } else { \
-                          if (p) pbuf_free(p); }
-#define TCP_EVENT_CONNECTED(pcb,err,ret) \
-                        if((pcb)->connected != NULL) \
-                        (ret = (pcb)->connected((pcb)->callback_arg,(pcb),(err)))
-#define TCP_EVENT_POLL(pcb,ret) \
-                        if((pcb)->poll != NULL) \
-                        (ret = (pcb)->poll((pcb)->callback_arg,(pcb)))
-#define TCP_EVENT_ERR(errf,arg,err) \
-                        if((errf) != NULL) \
-                        (errf)((arg),(err))
-#endif /* LWIP_EVENT_API */
-
-/* This structure represents a TCP segment on the unsent and unacked queues */
-struct tcp_seg {
-  struct tcp_seg *next;    /* used when putting segements on a queue */
-  struct pbuf *p;          /* buffer containing data + TCP header */
-  void *dataptr;           /* pointer to the TCP data in the pbuf */
-  u16_t len;               /* the TCP length of this segment */
-  struct tcp_hdr *tcphdr;  /* the TCP header */
-};
-
-/* Internal functions and global variables: */
-struct tcp_pcb *tcp_pcb_copy(struct tcp_pcb *pcb);
-void tcp_pcb_purge(struct tcp_pcb *pcb);
-void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb);
-
-u8_t tcp_segs_free(struct tcp_seg *seg);
-u8_t tcp_seg_free(struct tcp_seg *seg);
-struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg);
-
-#define tcp_ack(pcb)     if((pcb)->flags & TF_ACK_DELAY) { \
-                            (pcb)->flags &= ~TF_ACK_DELAY; \
-                            (pcb)->flags |= TF_ACK_NOW; \
-                            tcp_output(pcb); \
-                         } else { \
-                            (pcb)->flags |= TF_ACK_DELAY; \
-                         }
-
-#define tcp_ack_now(pcb) (pcb)->flags |= TF_ACK_NOW; \
-                         tcp_output(pcb)
-
-err_t tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags);
-err_t tcp_enqueue(struct tcp_pcb *pcb, void *dataptr, u16_t len,
-    u8_t flags, u8_t copy,
-                u8_t *optdata, u8_t optlen);
-
-void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg);
-
-void tcp_rst(u32_t seqno, u32_t ackno,
-       struct ip_addr *local_ip, struct ip_addr *remote_ip,
-       u16_t local_port, u16_t remote_port);
-
-u32_t tcp_next_iss(void);
-
-void tcp_keepalive(struct tcp_pcb *pcb);
-
-extern struct tcp_pcb *tcp_input_pcb;
-extern u32_t tcp_ticks;
-
-#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG
-void tcp_debug_print(struct tcp_hdr *tcphdr);
-void tcp_debug_print_flags(u8_t flags);
-void tcp_debug_print_state(enum tcp_state s);
-void tcp_debug_print_pcbs(void);
-s16_t tcp_pcbs_sane(void);
-#else
-#  define tcp_debug_print(tcphdr)
-#  define tcp_debug_print_flags(flags)
-#  define tcp_debug_print_state(s)
-#  define tcp_debug_print_pcbs()
-#  define tcp_pcbs_sane() 1
-#endif /* TCP_DEBUG */
-
-#if NO_SYS
-#define tcp_timer_needed()
-#else
-void tcp_timer_needed(void);
-#endif
-
-/* The TCP PCB lists. */
-union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */
-  struct tcp_pcb_listen *listen_pcbs; 
-  struct tcp_pcb *pcbs;
-};
-extern union tcp_listen_pcbs_t tcp_listen_pcbs;
-extern struct tcp_pcb *tcp_active_pcbs;  /* List of all TCP PCBs that are in a
-              state in which they accept or send
-              data. */
-extern struct tcp_pcb *tcp_tw_pcbs;      /* List of all TCP PCBs in TIME-WAIT. */
-
-extern struct tcp_pcb *tcp_tmp_pcb;      /* Only used for temporary storage. */
-
-/* Axioms about the above lists:   
-   1) Every TCP PCB that is not CLOSED is in one of the lists.
-   2) A PCB is only in one of the lists.
-   3) All PCBs in the tcp_listen_pcbs list is in LISTEN state.
-   4) All PCBs in the tcp_tw_pcbs list is in TIME-WAIT state.
-*/
-
-/* Define two macros, TCP_REG and TCP_RMV that registers a TCP PCB
-   with a PCB list or removes a PCB from a list, respectively. */
-#if 0
-#define TCP_REG(pcbs, npcb) do {\
-                            LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", npcb, npcb->local_port)); \
-                            for(tcp_tmp_pcb = *pcbs; \
-          tcp_tmp_pcb != NULL; \
-        tcp_tmp_pcb = tcp_tmp_pcb->next) { \
-                                LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != npcb); \
-                            } \
-                            LWIP_ASSERT("TCP_REG: pcb->state != CLOSED", npcb->state != CLOSED); \
-                            npcb->next = *pcbs; \
-                            LWIP_ASSERT("TCP_REG: npcb->next != npcb", npcb->next != npcb); \
-                            *(pcbs) = npcb; \
-                            LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
-              tcp_timer_needed(); \
-                            } while(0)
-#define TCP_RMV(pcbs, npcb) do { \
-                            LWIP_ASSERT("TCP_RMV: pcbs != NULL", *pcbs != NULL); \
-                            LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", npcb, *pcbs)); \
-                            if(*pcbs == npcb) { \
-                               *pcbs = (*pcbs)->next; \
-                            } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
-                               if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \
-                                  tcp_tmp_pcb->next = npcb->next; \
-                                  break; \
-                               } \
-                            } \
-                            npcb->next = NULL; \
-                            LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \
-                            LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", npcb, *pcbs)); \
-                            } while(0)
-
-#else /* LWIP_DEBUG */
-#define TCP_REG(pcbs, npcb) do { \
-                            npcb->next = *pcbs; \
-                            *(pcbs) = npcb; \
-              tcp_timer_needed(); \
-                            } while(0)
-#define TCP_RMV(pcbs, npcb) do { \
-                            if(*(pcbs) == npcb) { \
-                               (*(pcbs)) = (*pcbs)->next; \
-                            } else for(tcp_tmp_pcb = *pcbs; tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \
-                               if(tcp_tmp_pcb->next != NULL && tcp_tmp_pcb->next == npcb) { \
-                                  tcp_tmp_pcb->next = npcb->next; \
-                                  break; \
-                               } \
-                            } \
-                            npcb->next = NULL; \
-                            } while(0)
-#endif /* LWIP_DEBUG */
-#endif /* __LWIP_TCP_H__ */
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/tcpip.h b/src/VBox/Devices/Network/lwip/src/include/lwip/tcpip.h
deleted file mode 100644
index 58d88d7..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/tcpip.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_TCPIP_H__
-#define __LWIP_TCPIP_H__
-
-#include "lwip/api_msg.h"
-#include "lwip/pbuf.h"
-
-void tcpip_init(void (* tcpip_init_done)(void *), void *arg);
-#ifdef VBOX
-void tcpip_terminate(void);
-#endif
-void tcpip_apimsg(struct api_msg *apimsg);
-err_t tcpip_input(struct pbuf *p, struct netif *inp);
-err_t tcpip_callback(void (*f)(void *ctx), void *ctx);
-
-void tcpip_tcp_timer_needed(void);
-
-enum tcpip_msg_type {
-  TCPIP_MSG_API,
-  TCPIP_MSG_INPUT,
-  TCPIP_MSG_CALLBACK
-#ifdef VBOX
-  ,
-  TCPIP_MSG_TERM
-#endif
-};
-
-struct tcpip_msg {
-  enum tcpip_msg_type type;
-  sys_sem_t *sem;
-  union {
-    struct api_msg *apimsg;
-    struct {
-      struct pbuf *p;
-      struct netif *netif;
-    } inp;
-    struct {
-      void (*f)(void *ctx);
-      void *ctx;
-    } cb;
-  } msg;
-};
-
-
-#endif /* __LWIP_TCPIP_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/lwip/udp.h b/src/VBox/Devices/Network/lwip/src/include/lwip/udp.h
deleted file mode 100644
index 346898e..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/lwip/udp.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __LWIP_UDP_H__
-#define __LWIP_UDP_H__
-
-#include "lwip/arch.h"
-
-#include "lwip/pbuf.h"
-#include "lwip/inet.h"
-#include "lwip/ip.h"
-
-#define UDP_HLEN 8
-
-struct udp_hdr {
-  PACK_STRUCT_FIELD(u16_t src);
-  PACK_STRUCT_FIELD(u16_t dest);  /* src/dest UDP ports */
-  PACK_STRUCT_FIELD(u16_t len);
-  PACK_STRUCT_FIELD(u16_t chksum);
-} PACK_STRUCT_STRUCT;
-
-#define UDP_FLAGS_NOCHKSUM 0x01U
-#define UDP_FLAGS_UDPLITE  0x02U
-#define UDP_FLAGS_CONNECTED  0x04U
-
-struct udp_pcb {
-/* Common members of all PCB types */
-  IP_PCB;
-
-/* Protocol specific PCB members */
-
-  struct udp_pcb *next;
-
-  u8_t flags;
-  u16_t local_port, remote_port;
-  
-  u16_t chksum_len;
-  
-  void (* recv)(void *arg, struct udp_pcb *pcb, struct pbuf *p,
-    struct ip_addr *addr, u16_t port);
-  void *recv_arg;  
-};
-/* udp_pcbs export for exernal reference (e.g. SNMP agent) */
-extern struct udp_pcb *udp_pcbs;
-
-/* The following functions is the application layer interface to the
-   UDP code. */
-struct udp_pcb * udp_new        (void);
-void             udp_remove     (struct udp_pcb *pcb);
-err_t            udp_bind       (struct udp_pcb *pcb, struct ip_addr *ipaddr,
-                 u16_t port);
-err_t            udp_connect    (struct udp_pcb *pcb, struct ip_addr *ipaddr,
-                 u16_t port);
-void             udp_disconnect    (struct udp_pcb *pcb);
-void             udp_recv       (struct udp_pcb *pcb,
-         void (* recv)(void *arg, struct udp_pcb *upcb,
-                 struct pbuf *p,
-                 struct ip_addr *addr,
-                 u16_t port),
-         void *recv_arg);
-err_t            udp_sendto     (struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *dst_ip, u16_t dst_port);
-err_t            udp_send       (struct udp_pcb *pcb, struct pbuf *p);
-
-#define          udp_flags(pcb)  ((pcb)->flags)
-#define          udp_setflags(pcb, f)  ((pcb)->flags = (f))
-
-/* The following functions are the lower layer interface to UDP. */
-void             udp_input      (struct pbuf *p, struct netif *inp);
-void             udp_init       (void);
-
-#if UDP_DEBUG
-void udp_debug_print(struct udp_hdr *udphdr);
-#else
-#define udp_debug_print(udphdr)
-#endif
-#endif /* __LWIP_UDP_H__ */
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/include/netif/etharp.h b/src/VBox/Devices/Network/lwip/src/include/netif/etharp.h
deleted file mode 100644
index d64f55e..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/netif/etharp.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
- * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg at axon.tv>
- * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-#ifndef __NETIF_ETHARP_H__
-#define __NETIF_ETHARP_H__
-
-#ifndef ETH_PAD_SIZE
-#define ETH_PAD_SIZE 0
-#endif
-
-#include "lwip/pbuf.h"
-#include "lwip/ip_addr.h"
-#include "lwip/netif.h"
-#include "lwip/ip.h"
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct eth_addr {
-  PACK_STRUCT_FIELD(u8_t addr[6]);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct eth_hdr {
-#if ETH_PAD_SIZE
-  PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]);
-#endif
-  PACK_STRUCT_FIELD(struct eth_addr dest);
-  PACK_STRUCT_FIELD(struct eth_addr src);
-  PACK_STRUCT_FIELD(u16_t type);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-/** the ARP message */
-struct etharp_hdr {
-  PACK_STRUCT_FIELD(struct eth_hdr ethhdr);
-  PACK_STRUCT_FIELD(u16_t hwtype);
-  PACK_STRUCT_FIELD(u16_t proto);
-  PACK_STRUCT_FIELD(u16_t _hwlen_protolen);
-  PACK_STRUCT_FIELD(u16_t opcode);
-  PACK_STRUCT_FIELD(struct eth_addr shwaddr);
-  PACK_STRUCT_FIELD(struct ip_addr2 sipaddr);
-  PACK_STRUCT_FIELD(struct eth_addr dhwaddr);
-  PACK_STRUCT_FIELD(struct ip_addr2 dipaddr);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/bpstruct.h"
-#endif
-PACK_STRUCT_BEGIN
-struct ethip_hdr {
-  PACK_STRUCT_FIELD(struct eth_hdr eth);
-  PACK_STRUCT_FIELD(struct ip_hdr ip);
-} PACK_STRUCT_STRUCT;
-PACK_STRUCT_END
-#ifdef PACK_STRUCT_USE_INCLUDES
-#  include "arch/epstruct.h"
-#endif
-
-/** 5 seconds period */
-#define ARP_TMR_INTERVAL 5000
-
-#define ETHTYPE_ARP 0x0806
-#define ETHTYPE_IP  0x0800
-
-
-void etharp_init(void);
-void etharp_tmr(void);
-s8_t etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr,
-         struct eth_addr **eth_ret, struct ip_addr **ip_ret);
-void etharp_ip_input(struct netif *netif, struct pbuf *p);
-void etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr,
-         struct pbuf *p);
-err_t etharp_output(struct netif *netif, struct ip_addr *ipaddr,
-         struct pbuf *q);
-err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q);
-err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr);
-
-#endif /* __NETIF_ARP_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/netif/loopif.h b/src/VBox/Devices/Network/lwip/src/include/netif/loopif.h
deleted file mode 100644
index 97b3c67..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/netif/loopif.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __NETIF_LOOPIF_H__
-#define __NETIF_LOOPIF_H__
-
-#include "lwip/netif.h"
-
-err_t loopif_init(struct netif *netif);
-
-#endif /* __NETIF_LOOPIF_H__ */
diff --git a/src/VBox/Devices/Network/lwip/src/include/netif/slipif.h b/src/VBox/Devices/Network/lwip/src/include/netif/slipif.h
deleted file mode 100644
index bf70046..0000000
--- a/src/VBox/Devices/Network/lwip/src/include/netif/slipif.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2001, Swedish Institute of Computer Science.
- * All rights reserved. 
- *
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following conditions 
- * are met: 
- * 1. Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer. 
- * 2. Redistributions in binary form must reproduce the above copyright 
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the distribution. 
- * 3. Neither the name of the Institute nor the names of its contributors 
- *    may be used to endorse or promote products derived from this software 
- *    without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
- * SUCH DAMAGE. 
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#ifndef __NETIF_SLIPIF_H__
-#define __NETIF_SLIPIF_H__
-
-#include "lwip/netif.h"
-
-err_t slipif_init(struct netif * netif);
- 
-#endif 
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/FILES b/src/VBox/Devices/Network/lwip/src/netif/FILES
deleted file mode 100644
index 825d407..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/FILES
+++ /dev/null
@@ -1,27 +0,0 @@
-This directory contains generic network interface device drivers that
-do not contain any hardware or architecture specific code. The files
-are:
-
-etharp.c
-          Implements the ARP (Address Resolution Protocol) over
-          Ethernet. The code in this file should be used together with
-          Ethernet device drivers. Note that this module has been
-          largely made Ethernet independent so you should be able to
-          adapt this for other link layers (such as Firewire).
-
-ethernetif.c
-          An example of how an Ethernet device driver could look. This
-          file can be used as a "skeleton" for developing new Ethernet
-          network device drivers. It uses the etharp.c ARP code.
-
-loopif.c
-          An example network interface that shows how a "loopback"
-          interface would work. This is not really intended for actual
-          use, but as a very basic example of how initialization and
-          output functions work.
-
-slipif.c
-          A generic implementation of the SLIP (Serial Line IP)
-          protocol. It requires a sio (serial I/O) module to work.
-	  
-ppp/      Point-to-Point Protocol stack
diff --git a/src/VBox/Devices/Network/lwip/src/netif/etharp.c b/src/VBox/Devices/Network/lwip/src/netif/etharp.c
deleted file mode 100644
index 9787f6d..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/etharp.c
+++ /dev/null
@@ -1,892 +0,0 @@
-/**
- * @file
- * Address Resolution Protocol module for IP over Ethernet
- *
- * Functionally, ARP is divided into two parts. The first maps an IP address
- * to a physical address when sending a packet, and the second part answers
- * requests from other machines for our physical address.
- *
- * This implementation complies with RFC 826 (Ethernet ARP). It supports
- * Gratuitious ARP from RFC3220 (IP Mobility Support for IPv4) section 4.6
- * if an interface calls etharp_query(our_netif, its_ip_addr, NULL) upon
- * address change.
- */
-
-/*
- * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
- * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg at axon.tv>
- * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- */
-#include <string.h>
-#include "lwip/opt.h"
-#include "lwip/inet.h"
-#include "netif/etharp.h"
-#include "lwip/ip.h"
-#include "lwip/stats.h"
-#include "lwip/snmp.h"
-
-/* ARP needs to inform DHCP of any ARP replies? */
-#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK)
-#  include "lwip/dhcp.h"
-#endif
-
-/** the time an ARP entry stays valid after its last update,
- * (240 * 5) seconds = 20 minutes.
- */
-#define ARP_MAXAGE 240
-/** the time an ARP entry stays pending after first request,
- * (2 * 5) seconds = 10 seconds.
- * 
- * @internal Keep this number at least 2, otherwise it might
- * run out instantly if the timeout occurs directly after a request.
- */
-#define ARP_MAXPENDING 2
-
-#define HWTYPE_ETHERNET 1
-
-/** ARP message types */
-#define ARP_REQUEST 1
-#define ARP_REPLY 2
-
-#define ARPH_HWLEN(hdr) (ntohs((hdr)->_hwlen_protolen) >> 8)
-#define ARPH_PROTOLEN(hdr) (ntohs((hdr)->_hwlen_protolen) & 0xff)
-
-#define ARPH_HWLEN_SET(hdr, len) (hdr)->_hwlen_protolen = htons(ARPH_PROTOLEN(hdr) | ((len) << 8))
-#define ARPH_PROTOLEN_SET(hdr, len) (hdr)->_hwlen_protolen = htons((len) | (ARPH_HWLEN(hdr) << 8))
-
-enum etharp_state {
-  ETHARP_STATE_EMPTY,
-  ETHARP_STATE_PENDING,
-  ETHARP_STATE_STABLE,
-  /** @internal transitional state used in etharp_tmr() for convenience*/
-  ETHARP_STATE_EXPIRED
-};
-
-struct etharp_entry {
-#if ARP_QUEUEING
-  /** 
-   * Pointer to queue of pending outgoing packets on this ARP entry.
-   */
-   struct pbuf *p;
-#endif
-  struct ip_addr ipaddr;
-  struct eth_addr ethaddr;
-  enum etharp_state state;
-  u8_t ctime;
-  struct netif *netif;
-};
-
-static const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
-static struct etharp_entry arp_table[ARP_TABLE_SIZE];
-
-/**
- * Try hard to create a new entry - we want the IP address to appear in
- * the cache (even if this means removing an active entry or so). */
-#define ETHARP_TRY_HARD 1
-
-static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags);
-static err_t update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags);
-/**
- * Initializes ARP module.
- */
-void
-etharp_init(void)
-{
-  u8_t i;
-  /* clear ARP entries */
-  for(i = 0; i < ARP_TABLE_SIZE; ++i) {
-    arp_table[i].state = ETHARP_STATE_EMPTY;
-#if ARP_QUEUEING
-    arp_table[i].p = NULL;
-#endif
-    arp_table[i].ctime = 0;
-    arp_table[i].netif = NULL;
-  }
-}
-
-/**
- * Clears expired entries in the ARP table.
- *
- * This function should be called every ETHARP_TMR_INTERVAL microseconds (5 seconds),
- * in order to expire entries in the ARP table.
- */
-void
-etharp_tmr(void)
-{
-  u8_t i;
-
-  LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer\n"));
-  /* remove expired entries from the ARP table */
-  for (i = 0; i < ARP_TABLE_SIZE; ++i) {
-    arp_table[i].ctime++;
-    /* stable entry? */
-    if ((arp_table[i].state == ETHARP_STATE_STABLE) &&
-         /* entry has become old? */
-        (arp_table[i].ctime >= ARP_MAXAGE)) {
-      LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired stable entry %"U16_F".\n", (u16_t)i));
-      arp_table[i].state = ETHARP_STATE_EXPIRED;
-    /* pending entry? */
-    } else if (arp_table[i].state == ETHARP_STATE_PENDING) {
-      /* entry unresolved/pending for too long? */
-      if (arp_table[i].ctime >= ARP_MAXPENDING) {
-        LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired pending entry %"U16_F".\n", (u16_t)i));
-        arp_table[i].state = ETHARP_STATE_EXPIRED;
-#if ARP_QUEUEING
-      } else if (arp_table[i].p != NULL) {
-        /* resend an ARP query here */
-#endif
-      }
-    }
-    /* clean up entries that have just been expired */
-    if (arp_table[i].state == ETHARP_STATE_EXPIRED) {
-      /* remove from SNMP ARP index tree */
-      snmp_delete_arpidx_tree(arp_table[i].netif, &arp_table[i].ipaddr);
-#if ARP_QUEUEING
-      /* and empty packet queue */
-      if (arp_table[i].p != NULL) {
-        /* remove all queued packets */
-        LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: freeing entry %"U16_F", packet queue %p.\n", (u16_t)i, (void *)(arp_table[i].p)));
-        pbuf_free(arp_table[i].p);
-        arp_table[i].p = NULL;
-      }
-#endif
-      /* recycle entry for re-use */      
-      arp_table[i].state = ETHARP_STATE_EMPTY;
-    }
-  }
-}
-
-/**
- * Search the ARP table for a matching or new entry.
- * 
- * If an IP address is given, return a pending or stable ARP entry that matches
- * the address. If no match is found, create a new entry with this address set,
- * but in state ETHARP_EMPTY. The caller must check and possibly change the
- * state of the returned entry.
- * 
- * If ipaddr is NULL, return a initialized new entry in state ETHARP_EMPTY.
- * 
- * In all cases, attempt to create new entries from an empty entry. If no
- * empty entries are available and ETHARP_TRY_HARD flag is set, recycle
- * old entries. Heuristic choose the least important entry for recycling.
- *
- * @param ipaddr IP address to find in ARP cache, or to add if not found.
- * @param flags
- * - ETHARP_TRY_HARD: Try hard to create a entry by allowing recycling of
- * active (stable or pending) entries.
- *  
- * @return The ARP entry index that matched or is created, ERR_MEM if no
- * entry is found or could be recycled.
- */
-static s8_t find_entry(struct ip_addr *ipaddr, u8_t flags)
-{
-  s8_t old_pending = ARP_TABLE_SIZE, old_stable = ARP_TABLE_SIZE;
-  s8_t empty = ARP_TABLE_SIZE;
-  u8_t i = 0, age_pending = 0, age_stable = 0;
-#if ARP_QUEUEING
-  /* oldest entry with packets on queue */
-  s8_t old_queue = ARP_TABLE_SIZE;
-  /* its age */
-  u8_t age_queue = 0;
-#endif
-
-  /**
-   * a) do a search through the cache, remember candidates
-   * b) select candidate entry
-   * c) create new entry
-   */
-
-  /* a) in a single search sweep, do all of this
-   * 1) remember the first empty entry (if any)
-   * 2) remember the oldest stable entry (if any)
-   * 3) remember the oldest pending entry without queued packets (if any)
-   * 4) remember the oldest pending entry with queued packets (if any)
-   * 5) search for a matching IP entry, either pending or stable
-   *    until 5 matches, or all entries are searched for.
-   */
-
-  for (i = 0; i < ARP_TABLE_SIZE; ++i) {
-    /* no empty entry found yet and now we do find one? */
-    if ((empty == ARP_TABLE_SIZE) && (arp_table[i].state == ETHARP_STATE_EMPTY)) {
-      LWIP_DEBUGF(ETHARP_DEBUG, ("find_entry: found empty entry %"U16_F"\n", (u16_t)i));
-      /* remember first empty entry */
-      empty = i;
-    }
-    /* pending entry? */
-    else if (arp_table[i].state == ETHARP_STATE_PENDING) {
-      /* if given, does IP address match IP address in ARP entry? */
-      if (ipaddr && ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {
-        LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: found matching pending entry %"U16_F"\n", (u16_t)i));
-        /* found exact IP address match, simply bail out */
-        return i;
-#if ARP_QUEUEING
-      /* pending with queued packets? */
-      } else if (arp_table[i].p != NULL) {
-        if (arp_table[i].ctime >= age_queue) {
-          old_queue = i;
-          age_queue = arp_table[i].ctime;
-        }
-#endif
-      /* pending without queued packets? */
-      } else {
-        if (arp_table[i].ctime >= age_pending) {
-          old_pending = i;
-          age_pending = arp_table[i].ctime;
-        }
-      }        
-    }
-    /* stable entry? */
-    else if (arp_table[i].state == ETHARP_STATE_STABLE) {
-      /* if given, does IP address match IP address in ARP entry? */
-      if (ipaddr && ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {
-        LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: found matching stable entry %"U16_F"\n", (u16_t)i));
-        /* found exact IP address match, simply bail out */
-        return i;
-      /* remember entry with oldest stable entry in oldest, its age in maxtime */
-      } else if (arp_table[i].ctime >= age_stable) {
-        old_stable = i;
-        age_stable = arp_table[i].ctime;
-      }
-    }
-  }
-  /* { we have no match } => try to create a new entry */
-   
-  /* no empty entry found and not allowed to recycle? */
-  if ((empty == ARP_TABLE_SIZE) && ((flags & ETHARP_TRY_HARD) == 0))
-  {
-    return (s8_t)ERR_MEM;
-  }
-  
-  /* b) choose the least destructive entry to recycle:
-   * 1) empty entry
-   * 2) oldest stable entry
-   * 3) oldest pending entry without queued packets
-   * 4) oldest pending entry without queued packets
-   * 
-   * { ETHARP_TRY_HARD is set at this point }
-   */ 
-
-  /* 1) empty entry available? */
-  if (empty < ARP_TABLE_SIZE) {
-    i = empty;
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: selecting empty entry %"U16_F"\n", (u16_t)i));
-  }
-  /* 2) found recyclable stable entry? */
-  else if (old_stable < ARP_TABLE_SIZE) {
-    /* recycle oldest stable*/
-    i = old_stable;
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: selecting oldest stable entry %"U16_F"\n", (u16_t)i));
-#if ARP_QUEUEING
-    /* no queued packets should exist on stable entries */
-    LWIP_ASSERT("arp_table[i].p == NULL", arp_table[i].p == NULL);
-#endif
-  /* 3) found recyclable pending entry without queued packets? */
-  } else if (old_pending < ARP_TABLE_SIZE) {
-    /* recycle oldest pending */
-    i = old_pending;
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: selecting oldest pending entry %"U16_F" (without queue)\n", (u16_t)i));
-#if ARP_QUEUEING
-  /* 4) found recyclable pending entry with queued packets? */
-  } else if (old_queue < ARP_TABLE_SIZE) {
-    /* recycle oldest pending */
-    i = old_queue;
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("find_entry: selecting oldest pending entry %"U16_F", freeing packet queue %p\n", (u16_t)i, (void *)(arp_table[i].p)));
-    pbuf_free(arp_table[i].p);
-    arp_table[i].p = NULL;
-#endif
-    /* no empty or recyclable entries found */
-  } else {
-    return (s8_t)ERR_MEM;
-  }
-
-  /* { empty or recyclable entry found } */
-  LWIP_ASSERT("i < ARP_TABLE_SIZE", i < ARP_TABLE_SIZE);
-
-  if (arp_table[i].state != ETHARP_STATE_EMPTY)
-  {
-    snmp_delete_arpidx_tree(arp_table[i].netif, &arp_table[i].ipaddr);
-  }
-  /* recycle entry (no-op for an already empty entry) */
-  arp_table[i].state = ETHARP_STATE_EMPTY;
-
-  /* IP address given? */
-  if (ipaddr != NULL) {
-    /* set IP address */
-    ip_addr_set(&arp_table[i].ipaddr, ipaddr);
-  }
-  arp_table[i].ctime = 0;
-  return (err_t)i;
-}
-
-/**
- * Update (or insert) a IP/MAC address pair in the ARP cache.
- *
- * If a pending entry is resolved, any queued packets will be sent
- * at this point.
- * 
- * @param ipaddr IP address of the inserted ARP entry.
- * @param ethaddr Ethernet address of the inserted ARP entry.
- * @param flags Defines behaviour:
- * - ETHARP_TRY_HARD Allows ARP to insert this as a new item. If not specified,
- * only existing ARP entries will be updated.
- *
- * @return
- * - ERR_OK Succesfully updated ARP cache.
- * - ERR_MEM If we could not add a new ARP entry when ETHARP_TRY_HARD was set.
- * - ERR_ARG Non-unicast address given, those will not appear in ARP cache.
- *
- * @see pbuf_free()
- */
-static err_t
-update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *ethaddr, u8_t flags)
-{
-  s8_t i;
-  u8_t k;
-  LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE | 3, ("update_arp_entry()\n"));
-  LWIP_ASSERT("netif->hwaddr_len != 0", netif->hwaddr_len != 0);
-  LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F" - %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F"\n",
-                                        ip4_addr1(ipaddr), ip4_addr2(ipaddr), ip4_addr3(ipaddr), ip4_addr4(ipaddr), 
-                                        ethaddr->addr[0], ethaddr->addr[1], ethaddr->addr[2],
-                                        ethaddr->addr[3], ethaddr->addr[4], ethaddr->addr[5]));
-  /* non-unicast address? */
-  if (ip_addr_isany(ipaddr) ||
-      ip_addr_isbroadcast(ipaddr, netif) ||
-      ip_addr_ismulticast(ipaddr)) {
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: will not add non-unicast IP address to ARP cache\n"));
-    return ERR_ARG;
-  }
-  /* find or create ARP entry */
-  i = find_entry(ipaddr, flags);
-  /* bail out if no entry could be found */
-  if (i < 0) return (err_t)i;
-  
-  /* mark it stable */
-  arp_table[i].state = ETHARP_STATE_STABLE;
-  /* record network interface */
-  arp_table[i].netif = netif;
-
-  /* insert in SNMP ARP index tree */
-  snmp_insert_arpidx_tree(netif, &arp_table[i].ipaddr);
-
-  LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: updating stable entry %"S16_F"\n", (s16_t)i));
-  /* update address */
-  k = netif->hwaddr_len;
-  while (k > 0) {
-    k--;
-    arp_table[i].ethaddr.addr[k] = ethaddr->addr[k];
-  }
-  /* reset time stamp */
-  arp_table[i].ctime = 0;
-/* this is where we will send out queued packets! */
-#if ARP_QUEUEING
-  while (arp_table[i].p != NULL) {
-    /* get the first packet on the queue */
-    struct pbuf *p = arp_table[i].p;
-    /* Ethernet header */
-    struct eth_hdr *ethhdr = p->payload;
-    /* remember (and reference) remainder of queue */
-    /* note: this will also terminate the p pbuf chain */
-    arp_table[i].p = pbuf_dequeue(p);
-    /* fill-in Ethernet header */
-    k = netif->hwaddr_len;
-    while(k > 0) {
-      k--;
-      ethhdr->dest.addr[k] = ethaddr->addr[k];
-      ethhdr->src.addr[k] = netif->hwaddr[k];
-    }
-    ethhdr->type = htons(ETHTYPE_IP);
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: sending queued IP packet %p.\n", (void *)p));
-    /* send the queued IP packet */
-    netif->linkoutput(netif, p);
-    /* free the queued IP packet */
-    pbuf_free(p);
-  }
-#endif
-  return ERR_OK;
-}
-
-/**
- * Finds (stable) ethernet/IP address pair from ARP table
- * using interface and IP address index.
- * @note the addresses in the ARP table are in network order!
- *
- * @param netif points to interface index
- * @param ipaddr points to the (network order) IP address index
- * @param eth_ret points to return pointer
- * @param ip_ret points to return pointer
- * @return table index if found, -1 otherwise
- */
-s8_t
-etharp_find_addr(struct netif *netif, struct ip_addr *ipaddr,
-         struct eth_addr **eth_ret, struct ip_addr **ip_ret)
-{
-  s8_t i;
-
-  i = 0;
-  while (i < ARP_TABLE_SIZE)
-  {
-    if ((arp_table[i].state == ETHARP_STATE_STABLE) &&
-        (arp_table[i].netif == netif) && 
-        ip_addr_cmp(ipaddr, &arp_table[i].ipaddr) )
-    {
-      *eth_ret = &arp_table[i].ethaddr;
-      *ip_ret = &arp_table[i].ipaddr;
-      return i;
-    }
-    i++;
-  }
-  return -1;
-}
-
-/**
- * Updates the ARP table using the given IP packet.
- *
- * Uses the incoming IP packet's source address to update the
- * ARP cache for the local network. The function does not alter
- * or free the packet. This function must be called before the
- * packet p is passed to the IP layer.
- *
- * @param netif The lwIP network interface on which the IP packet pbuf arrived.
- * @param pbuf The IP packet that arrived on netif.
- *
- * @return NULL
- *
- * @see pbuf_free()
- */
-void
-etharp_ip_input(struct netif *netif, struct pbuf *p)
-{
-  struct ethip_hdr *hdr;
-  LWIP_ASSERT("netif != NULL", netif != NULL);
-  /* Only insert an entry if the source IP address of the
-     incoming IP packet comes from a host on the local network. */
-  hdr = p->payload;
-  /* source is not on the local network? */
-  if (!ip_addr_netcmp(&(hdr->ip.src), &(netif->ip_addr), &(netif->netmask))) {
-    /* do nothing */
-    return;
-  }
-
-  LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_ip_input: updating ETHARP table.\n"));
-  /* update ARP table */
-  /* @todo We could use ETHARP_TRY_HARD if we think we are going to talk
-   * back soon (for example, if the destination IP address is ours. */
-  update_arp_entry(netif, &(hdr->ip.src), &(hdr->eth.src), 0);
-}
-
-
-/**
- * Responds to ARP requests to us. Upon ARP replies to us, add entry to cache  
- * send out queued IP packets. Updates cache with snooped address pairs.
- *
- * Should be called for incoming ARP packets. The pbuf in the argument
- * is freed by this function.
- *
- * @param netif The lwIP network interface on which the ARP packet pbuf arrived.
- * @param pbuf The ARP packet that arrived on netif. Is freed by this function.
- * @param ethaddr Ethernet address of netif.
- *
- * @return NULL
- *
- * @see pbuf_free()
- */
-void
-etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
-{
-  struct etharp_hdr *hdr;
-  /* these are aligned properly, whereas the ARP header fields might not be */
-  struct ip_addr sipaddr, dipaddr;
-  u8_t i;
-  u8_t for_us;
-
-  LWIP_ASSERT("netif != NULL", netif != NULL);
-  
-  /* drop short ARP packets */
-  if (p->tot_len < sizeof(struct etharp_hdr)) {
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE | 1, ("etharp_arp_input: packet dropped, too short (%"S16_F"/%"S16_F")\n", p->tot_len, (s16_t)sizeof(struct etharp_hdr)));
-    pbuf_free(p);
-    return;
-  }
-
-  hdr = p->payload;
- 
-  /* Copy struct ip_addr2 to aligned ip_addr, to support compilers without
-   * structure packing (not using structure copy which breaks strict-aliasing rules). */
-  memcpy(&sipaddr, &hdr->sipaddr, sizeof(sipaddr));
-  memcpy(&dipaddr, &hdr->dipaddr, sizeof(dipaddr));
-
-  /* this interface is not configured? */
-  if (netif->ip_addr.addr == 0) {
-    for_us = 0;
-  } else {
-    /* ARP packet directed to us? */
-    for_us = ip_addr_cmp(&dipaddr, &(netif->ip_addr));
-  }
-
-  /* ARP message directed to us? */
-  if (for_us) {
-    /* add IP address in ARP cache; assume requester wants to talk to us.
-     * can result in directly sending the queued packets for this host. */
-    update_arp_entry(netif, &sipaddr, &(hdr->shwaddr), ETHARP_TRY_HARD);
-  /* ARP message not directed to us? */
-  } else {
-    /* update the source IP address in the cache, if present */
-    update_arp_entry(netif, &sipaddr, &(hdr->shwaddr), 0);
-  }
-
-  /* now act on the message itself */
-  switch (htons(hdr->opcode)) {
-  /* ARP request? */
-  case ARP_REQUEST:
-    /* ARP request. If it asked for our address, we send out a
-     * reply. In any case, we time-stamp any existing ARP entry,
-     * and possiby send out an IP packet that was queued on it. */
-
-    LWIP_DEBUGF (ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP request\n"));
-    /* ARP request for our address? */
-    if (for_us) {
-
-      LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: replying to ARP request for our IP address\n"));
-      /* re-use pbuf to send ARP reply */
-      hdr->opcode = htons(ARP_REPLY);
-
-      hdr->dipaddr = hdr->sipaddr;
-      hdr->sipaddr = *(struct ip_addr2 *)&netif->ip_addr;
-
-      i = netif->hwaddr_len;
-      while(i > 0) {
-        i--;
-        hdr->dhwaddr.addr[i] = hdr->shwaddr.addr[i];
-        hdr->shwaddr.addr[i] = ethaddr->addr[i];
-        hdr->ethhdr.dest.addr[i] = hdr->dhwaddr.addr[i];
-        hdr->ethhdr.src.addr[i] = ethaddr->addr[i];
-      }
-
-      hdr->hwtype = htons(HWTYPE_ETHERNET);
-      ARPH_HWLEN_SET(hdr, netif->hwaddr_len);
-
-      hdr->proto = htons(ETHTYPE_IP);
-      ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr));
-
-      hdr->ethhdr.type = htons(ETHTYPE_ARP);
-      /* return ARP reply */
-      netif->linkoutput(netif, p);
-    /* we are not configured? */
-    } else if (netif->ip_addr.addr == 0) {
-      /* { for_us == 0 and netif->ip_addr.addr == 0 } */
-      LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: we are unconfigured, ARP request ignored.\n"));
-    /* request was not directed to us */
-    } else {
-      /* { for_us == 0 and netif->ip_addr.addr != 0 } */
-      LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: ARP request was not for us.\n"));
-    }
-    break;
-  case ARP_REPLY:
-    /* ARP reply. We already updated the ARP cache earlier. */
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP reply\n"));
-#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK)
-    /* DHCP wants to know about ARP replies from any host with an
-     * IP address also offered to us by the DHCP server. We do not
-     * want to take a duplicate IP address on a single network.
-     * @todo How should we handle redundant (fail-over) interfaces?
-     * */
-    dhcp_arp_reply(netif, &sipaddr);
-#endif
-    break;
-  default:
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: ARP unknown opcode type %"S16_F"\n", htons(hdr->opcode)));
-    break;
-  }
-  /* free ARP packet */
-  pbuf_free(p);
-}
-
-/**
- * Resolve and fill-in Ethernet address header for outgoing packet.
- *
- * For IP multicast and broadcast, corresponding Ethernet addresses
- * are selected and the packet is transmitted on the link.
- *
- * For unicast addresses, the packet is submitted to etharp_query(). In
- * case the IP address is outside the local network, the IP address of
- * the gateway is used.
- *
- * @param netif The lwIP network interface which the IP packet will be sent on.
- * @param ipaddr The IP address of the packet destination.
- * @param pbuf The pbuf(s) containing the IP packet to be sent.
- *
- * @return
- * - ERR_RTE No route to destination (no gateway to external networks),
- * or the return type of either etharp_query() or netif->linkoutput().
- */
-err_t
-etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
-{
-  struct eth_addr *dest, *srcaddr, mcastaddr;
-  struct eth_hdr *ethhdr;
-  u8_t i;
-
-  /* make room for Ethernet header - should not fail */
-  if (pbuf_header(q, sizeof(struct eth_hdr)) != 0) {
-    /* bail out */
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE | 2, ("etharp_output: could not allocate room for header.\n"));
-    LINK_STATS_INC(link.lenerr);
-    return ERR_BUF;
-  }
-
-  /* assume unresolved Ethernet address */
-  dest = NULL;
-  /* Determine on destination hardware address. Broadcasts and multicasts
-   * are special, other IP addresses are looked up in the ARP table. */
-
-  /* broadcast destination IP address? */
-  if (ip_addr_isbroadcast(ipaddr, netif)) {
-    /* broadcast on Ethernet also */
-    dest = (struct eth_addr *)ðbroadcast;
-  /* multicast destination IP address? */
-  } else if (ip_addr_ismulticast(ipaddr)) {
-    /* Hash IP multicast address to MAC address.*/
-    mcastaddr.addr[0] = 0x01;
-    mcastaddr.addr[1] = 0x00;
-    mcastaddr.addr[2] = 0x5e;
-    mcastaddr.addr[3] = ip4_addr2(ipaddr) & 0x7f;
-    mcastaddr.addr[4] = ip4_addr3(ipaddr);
-    mcastaddr.addr[5] = ip4_addr4(ipaddr);
-    /* destination Ethernet address is multicast */
-    dest = &mcastaddr;
-  /* unicast destination IP address? */
-  } else {
-    /* outside local network? */
-    if (!ip_addr_netcmp(ipaddr, &(netif->ip_addr), &(netif->netmask))) {
-      /* interface has default gateway? */
-      if (netif->gw.addr != 0) {
-        /* send to hardware address of default gateway IP address */
-        ipaddr = &(netif->gw);
-      /* no default gateway available */
-      } else {
-        /* no route to destination error (default gateway missing) */
-        return ERR_RTE;
-      }
-    }
-    /* queue on destination Ethernet address belonging to ipaddr */
-    return etharp_query(netif, ipaddr, q);
-  }
-
-  /* continuation for multicast/broadcast destinations */
-  /* obtain source Ethernet address of the given interface */
-  srcaddr = (struct eth_addr *)netif->hwaddr;
-  ethhdr = q->payload;
-  i = netif->hwaddr_len;
-  while(i > 0) {
-    i--;
-    ethhdr->dest.addr[i] = dest->addr[i];
-    ethhdr->src.addr[i] = srcaddr->addr[i];
-  }
-  ethhdr->type = htons(ETHTYPE_IP);
-  /* send packet directly on the link */
-  return netif->linkoutput(netif, q);
-}
-
-/**
- * Send an ARP request for the given IP address and/or queue a packet.
- *
- * If the IP address was not yet in the cache, a pending ARP cache entry
- * is added and an ARP request is sent for the given address. The packet
- * is queued on this entry.
- *
- * If the IP address was already pending in the cache, a new ARP request
- * is sent for the given address. The packet is queued on this entry.
- *
- * If the IP address was already stable in the cache, and a packet is
- * given, it is directly sent and no ARP request is sent out. 
- * 
- * If the IP address was already stable in the cache, and no packet is
- * given, an ARP request is sent out.
- * 
- * @param netif The lwIP network interface on which ipaddr
- * must be queried for.
- * @param ipaddr The IP address to be resolved.
- * @param q If non-NULL, a pbuf that must be delivered to the IP address.
- * q is not freed by this function.
- *
- * @return
- * - ERR_BUF Could not make room for Ethernet header.
- * - ERR_MEM Hardware address unknown, and no more ARP entries available
- *   to query for address or queue the packet.
- * - ERR_MEM Could not queue packet due to memory shortage.
- * - ERR_RTE No route to destination (no gateway to external networks).
- * - ERR_ARG Non-unicast address given, those will not appear in ARP cache.
- *
- */
-err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
-{
-  struct eth_addr * srcaddr = (struct eth_addr *)netif->hwaddr;
-  err_t result = ERR_MEM;
-  s8_t i; /* ARP entry index */
-  u8_t k; /* Ethernet address octet index */
-
-  /* non-unicast address? */
-  if (ip_addr_isbroadcast(ipaddr, netif) ||
-      ip_addr_ismulticast(ipaddr) ||
-      ip_addr_isany(ipaddr)) {
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: will not add non-unicast IP address to ARP cache\n"));
-    return ERR_ARG;
-  }
-
-  /* find entry in ARP cache, ask to create entry if queueing packet */
-  i = find_entry(ipaddr, ETHARP_TRY_HARD);
-
-  /* could not find or create entry? */
-  if (i < 0)
-  {
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: could not create ARP entry\n"));
-    if (q) LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: packet dropped\n"));
-    return (err_t)i;
-  }
-
-  /* mark a fresh entry as pending (we just sent a request) */
-  if (arp_table[i].state == ETHARP_STATE_EMPTY) {
-    arp_table[i].state = ETHARP_STATE_PENDING;
-  }
-
-  /* { i is either a STABLE or (new or existing) PENDING entry } */
-  LWIP_ASSERT("arp_table[i].state == PENDING or STABLE",
-  ((arp_table[i].state == ETHARP_STATE_PENDING) ||
-   (arp_table[i].state == ETHARP_STATE_STABLE)));
-
-  /* do we have a pending entry? or an implicit query request? */
-  if ((arp_table[i].state == ETHARP_STATE_PENDING) || (q == NULL)) {
-    /* try to resolve it; send out ARP request */
-    result = etharp_request(netif, ipaddr);
-  }
-  
-  /* packet given? */
-  if (q != NULL) {
-    /* stable entry? */
-    if (arp_table[i].state == ETHARP_STATE_STABLE) {
-      /* we have a valid IP->Ethernet address mapping,
-       * fill in the Ethernet header for the outgoing packet */
-      struct eth_hdr *ethhdr = q->payload;
-      k = netif->hwaddr_len;
-      while(k > 0) {
-        k--;
-        ethhdr->dest.addr[k] = arp_table[i].ethaddr.addr[k];
-        ethhdr->src.addr[k]  = srcaddr->addr[k];
-      }
-      ethhdr->type = htons(ETHTYPE_IP);
-      LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: sending packet %p\n", (void *)q));
-      /* send the packet */
-      result = netif->linkoutput(netif, q);
-    /* pending entry? (either just created or already pending */
-    } else if (arp_table[i].state == ETHARP_STATE_PENDING) {
-#if ARP_QUEUEING /* queue the given q packet */
-      struct pbuf *p;
-      /* copy any PBUF_REF referenced payloads into PBUF_RAM */
-      /* (the caller of lwIP assumes the referenced payload can be
-       * freed after it returns from the lwIP call that brought us here) */
-      p = pbuf_take(q);
-      /* packet could be taken over? */
-      if (p != NULL) {
-        /* queue packet ... */
-        if (arp_table[i].p == NULL) {
-          /* ... in the empty queue */
-          pbuf_ref(p);
-          arp_table[i].p = p;
-#if 0 /* multi-packet-queueing disabled, see bug #11400 */
-        } else {
-          /* ... at tail of non-empty queue */
-          pbuf_queue(arp_table[i].p, p);
-#endif
-        }
-        LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: queued packet %p on ARP entry %"S16_F"\n", (void *)q, (s16_t)i));
-        result = ERR_OK;
-      } else {
-        LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: could not queue a copy of PBUF_REF packet %p (out of memory)\n", (void *)q));
-        /* { result == ERR_MEM } through initialization */
-      }
-#else /* ARP_QUEUEING == 0 */
-      /* q && state == PENDING && ARP_QUEUEING == 0 => result = ERR_MEM */
-      /* { result == ERR_MEM } through initialization */
-      LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: Ethernet destination address unknown, queueing disabled, packet %p dropped\n", (void *)q));
-#endif
-    }
-  }
-  return result;
-}
-
-err_t etharp_request(struct netif *netif, struct ip_addr *ipaddr)
-{
-  struct pbuf *p;
-  struct eth_addr * srcaddr = (struct eth_addr *)netif->hwaddr;
-  err_t result = ERR_OK;
-  u8_t k; /* ARP entry index */
-
-  /* allocate a pbuf for the outgoing ARP request packet */
-  p = pbuf_alloc(PBUF_LINK, sizeof(struct etharp_hdr), PBUF_RAM);
-  /* could allocate a pbuf for an ARP request? */
-  if (p != NULL) {
-    struct etharp_hdr *hdr = p->payload;
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_request: sending ARP request.\n"));
-    hdr->opcode = htons(ARP_REQUEST);
-    k = netif->hwaddr_len;
-    while(k > 0) {
-      k--;
-      hdr->shwaddr.addr[k] = srcaddr->addr[k];
-      /* the hardware address is what we ask for, in
-       * a request it is a don't-care value, we use zeroes */
-      hdr->dhwaddr.addr[k] = 0x00;
-    }
-    hdr->dipaddr = *(struct ip_addr2 *)ipaddr;
-    hdr->sipaddr = *(struct ip_addr2 *)&netif->ip_addr;
-
-    hdr->hwtype = htons(HWTYPE_ETHERNET);
-    ARPH_HWLEN_SET(hdr, netif->hwaddr_len);
-
-    hdr->proto = htons(ETHTYPE_IP);
-    ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr));
-    k = netif->hwaddr_len;
-    while(k > 0) {
-      k--;
-      /* broadcast to all network interfaces on the local network */
-      hdr->ethhdr.dest.addr[k] = 0xff;
-      hdr->ethhdr.src.addr[k] = srcaddr->addr[k];
-    }
-    hdr->ethhdr.type = htons(ETHTYPE_ARP);
-    /* send ARP query */
-    result = netif->linkoutput(netif, p);
-    /* free ARP query packet */
-    pbuf_free(p);
-    p = NULL;
-  /* could not allocate pbuf for ARP request */
-  } else {
-    result = ERR_MEM;
-    LWIP_DEBUGF(ETHARP_DEBUG | DBG_TRACE | 2, ("etharp_request: could not allocate pbuf for ARP request.\n"));
-  }
-  return result;
-}
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ethernetif.c b/src/VBox/Devices/Network/lwip/src/netif/ethernetif.c
deleted file mode 100644
index 87d5917..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ethernetif.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-
-/*
- * This file is a skeleton for developing Ethernet network interface
- * drivers for lwIP. Add code to the low_level functions and do a
- * search-and-replace for the word "ethernetif" to replace it with
- * something that better describes your network interface.
- */
-
-#include "lwip/opt.h"
-#include "lwip/def.h"
-#include "lwip/mem.h"
-#include "lwip/pbuf.h"
-#include "lwip/sys.h"
-#include <lwip/stats.h>
-
-#include "netif/etharp.h"
-
-/* Define those to better describe your network interface. */
-#define IFNAME0 'e'
-#define IFNAME1 'n'
-
-struct ethernetif {
-  struct eth_addr *ethaddr;
-  /* Add whatever per-interface state that is needed here. */
-};
-
-static const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
-
-/* Forward declarations. */
-static void  ethernetif_input(struct netif *netif);
-static err_t ethernetif_output(struct netif *netif, struct pbuf *p,
-             struct ip_addr *ipaddr);
-
-static void
-low_level_init(struct netif *netif)
-{
-  struct ethernetif *ethernetif = netif->state;
-  
-  /* set MAC hardware address length */
-  netif->hwaddr_len = 6;
-
-  /* set MAC hardware address */
-  netif->hwaddr[0] = ;
-  ...
-  netif->hwaddr[5] = ;
-
-  /* maximum transfer unit */
-  netif->mtu = 1500;
-  
-  /* broadcast capability */
-  netif->flags = NETIF_FLAG_BROADCAST;
- 
-  /* Do whatever else is needed to initialize interface. */  
-}
-
-/*
- * low_level_output():
- *
- * Should do the actual transmission of the packet. The packet is
- * contained in the pbuf that is passed to the function. This pbuf
- * might be chained.
- *
- */
-
-static err_t
-low_level_output(struct netif *netif, struct pbuf *p)
-{
-  struct ethernetif *ethernetif = netif->state;
-  struct pbuf *q;
-
-  initiate transfer();
-  
-#if ETH_PAD_SIZE
-  pbuf_header(p, -ETH_PAD_SIZE);			/* drop the padding word */
-#endif
-
-  for(q = p; q != NULL; q = q->next) {
-    /* Send the data from the pbuf to the interface, one pbuf at a
-       time. The size of the data in each pbuf is kept in the ->len
-       variable. */
-    send data from(q->payload, q->len);
-  }
-
-  signal that packet should be sent();
-
-#if ETH_PAD_SIZE
-  pbuf_header(p, ETH_PAD_SIZE);			/* reclaim the padding word */
-#endif
-  
-#if LINK_STATS
-  lwip_stats.link.xmit++;
-#endif /* LINK_STATS */      
-
-  return ERR_OK;
-}
-
-/*
- * low_level_input():
- *
- * Should allocate a pbuf and transfer the bytes of the incoming
- * packet from the interface into the pbuf.
- *
- */
-
-static struct pbuf *
-low_level_input(struct netif *netif)
-{
-  struct ethernetif *ethernetif = netif->state;
-  struct pbuf *p, *q;
-  u16_t len;
-
-  /* Obtain the size of the packet and put it into the "len"
-     variable. */
-  len = ;
-
-#if ETH_PAD_SIZE
-  len += ETH_PAD_SIZE;						/* allow room for Ethernet padding */
-#endif
-
-  /* We allocate a pbuf chain of pbufs from the pool. */
-  p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
-  
-  if (p != NULL) {
-
-#if ETH_PAD_SIZE
-    pbuf_header(p, -ETH_PAD_SIZE);			/* drop the padding word */
-#endif
-
-    /* We iterate over the pbuf chain until we have read the entire
-     * packet into the pbuf. */
-    for(q = p; q != NULL; q = q->next) {
-      /* Read enough bytes to fill this pbuf in the chain. The
-       * available data in the pbuf is given by the q->len
-       * variable. */
-      read data into(q->payload, q->len);
-    }
-    acknowledge that packet has been read();
-
-#if ETH_PAD_SIZE
-    pbuf_header(p, ETH_PAD_SIZE);			/* reclaim the padding word */
-#endif
-
-#if LINK_STATS
-    lwip_stats.link.recv++;
-#endif /* LINK_STATS */      
-  } else {
-    drop packet();
-#if LINK_STATS
-    lwip_stats.link.memerr++;
-    lwip_stats.link.drop++;
-#endif /* LINK_STATS */      
-  }
-
-  return p;  
-}
-
-/*
- * ethernetif_output():
- *
- * This function is called by the TCP/IP stack when an IP packet
- * should be sent. It calls the function called low_level_output() to
- * do the actual transmission of the packet.
- *
- */
-
-static err_t
-ethernetif_output(struct netif *netif, struct pbuf *p,
-      struct ip_addr *ipaddr)
-{
-  
- /* resolve hardware address, then send (or queue) packet */
-  return etharp_output(netif, ipaddr, p);
- 
-}
-
-/*
- * ethernetif_input():
- *
- * This function should be called when a packet is ready to be read
- * from the interface. It uses the function low_level_input() that
- * should handle the actual reception of bytes from the network
- * interface.
- *
- */
-
-static void
-ethernetif_input(struct netif *netif)
-{
-  struct ethernetif *ethernetif;
-  struct eth_hdr *ethhdr;
-  struct pbuf *p;
-
-  ethernetif = netif->state;
-  
-  /* move received packet into a new pbuf */
-  p = low_level_input(netif);
-  /* no packet could be read, silently ignore this */
-  if (p == NULL) return;
-  /* points to packet payload, which starts with an Ethernet header */
-  ethhdr = p->payload;
-
-#if LINK_STATS
-  lwip_stats.link.recv++;
-#endif /* LINK_STATS */
-
-  ethhdr = p->payload;
-    
-  switch (htons(ethhdr->type)) {
-  /* IP packet? */
-  case ETHTYPE_IP:
-#if 0
-/* CSi disabled ARP table update on ingress IP packets.
-   This seems to work but needs thorough testing. */
-    /* update ARP table */
-    etharp_ip_input(netif, p);
-#endif
-    /* skip Ethernet header */
-    pbuf_header(p, -sizeof(struct eth_hdr));
-    /* pass to network layer */
-    netif->input(p, netif);
-    break;
-      
-    case ETHTYPE_ARP:
-      /* pass p to ARP module  */
-      etharp_arp_input(netif, ethernetif->ethaddr, p);
-      break;
-    default:
-      pbuf_free(p);
-      p = NULL;
-      break;
-  }
-}
-
-static void
-arp_timer(void *arg)
-{
-  etharp_tmr();
-  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
-}
-
-/*
- * ethernetif_init():
- *
- * Should be called at the beginning of the program to set up the
- * network interface. It calls the function low_level_init() to do the
- * actual setup of the hardware.
- *
- */
-
-err_t
-ethernetif_init(struct netif *netif)
-{
-  struct ethernetif *ethernetif;
-    
-  ethernetif = mem_malloc(sizeof(struct ethernetif));
-  
-  if (ethernetif == NULL)
-  {
-  	LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n"));
-  	return ERR_MEM;
-  }
-
-#if LWIP_SNMP
-  /* ifType ethernetCsmacd(6) @see RFC1213 */
-  netif->link_type = 6;
-  /* your link speed here */
-  netif->link_speed = ;
-  netif->ts = 0;
-  netif->ifinoctets = 0;
-  netif->ifinucastpkts = 0;
-  netif->ifinnucastpkts = 0;
-  netif->ifindiscards = 0;
-  netif->ifoutoctets = 0;
-  netif->ifoutucastpkts = 0;
-  netif->ifoutnucastpkts = 0;
-  netif->ifoutdiscards = 0;
-#endif
-  
-  netif->state = ethernetif;
-  netif->name[0] = IFNAME0;
-  netif->name[1] = IFNAME1;
-  netif->output = ethernetif_output;
-  netif->linkoutput = low_level_output;
-  
-  ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]);
-  
-  low_level_init(netif);
-
-  etharp_init();
-
-  sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL);
-
-  return ERR_OK;
-}
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/loopif.c b/src/VBox/Devices/Network/lwip/src/netif/loopif.c
deleted file mode 100644
index 0464cb8..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/loopif.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without modification, 
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- *    derived from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
- * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
- * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
- * OF SUCH DAMAGE.
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam at sics.se>
- *
- */
-#include "lwip/opt.h"
-
-#if LWIP_HAVE_LOOPIF
-
-#include "netif/loopif.h"
-#include "lwip/mem.h"
-
-#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
-#include "netif/tcpdump.h"
-#endif /* LWIP_DEBUG && LWIP_TCPDUMP */
-
-#include "lwip/tcp.h"
-#include "lwip/ip.h"
-
-static void
-loopif_input( void * arg )
-{
-	struct netif *netif = (struct netif *)( ((void **)arg)[ 0 ] );
-	struct pbuf *r = (struct pbuf *)( ((void **)arg)[ 1 ] );
-
-	mem_free( arg );
-	netif -> input( r, netif );
-}
-
-static err_t
-loopif_output(struct netif *netif, struct pbuf *p,
-       struct ip_addr *ipaddr)
-{
-  struct pbuf *q, *r;
-  u8_t *ptr;
-  void **arg;
-
-#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP)
-  tcpdump(p);
-#endif /* LWIP_DEBUG && LWIP_TCPDUMP */
-  
-  r = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
-  if (r != NULL) {
-    ptr = r->payload;
-    
-    for(q = p; q != NULL; q = q->next) {
-      memcpy(ptr, q->payload, q->len);
-      ptr += q->len;
-    }
-
-    arg = mem_malloc( sizeof( void *[2]));
-	if( NULL == arg ) {
-		return ERR_MEM;
-	}
-	
-	arg[0] = netif;
-	arg[1] = r;
-	/**
-	 * workaround (patch #1779) to try to prevent bug #2595:
-	 * When connecting to "localhost" with the loopif interface,
-	 * tcp_output doesn't get the opportunity to finnish sending the
-	 * segment before tcp_process gets it, resulting in tcp_process
-	 * referencing pcb->unacked-> which still is NULL.
-	 * 
-	 * TODO: Is there still a race condition here? Leon
-	 */
-	sys_timeout( 1, loopif_input, arg );
-	
-    return ERR_OK;    
-  }
-  return ERR_MEM;
-}
-
-err_t
-loopif_init(struct netif *netif)
-{
-  netif->name[0] = 'l';
-  netif->name[1] = 'o';
-#if 0 /** TODO: I think this should be enabled, or not? Leon */
-  netif->input = loopif_input;
-#endif
-  netif->output = loopif_output;
-  return ERR_OK;
-}
-
-#endif /* LWIP_HAVE_LOOPIF */
-
-
-
-
-
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/auth.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/auth.c
deleted file mode 100644
index 3334964..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/auth.c
+++ /dev/null
@@ -1,927 +0,0 @@
-/*****************************************************************************
-* auth.c - Network Authentication and Phase Control program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* Copyright (c) 1997 by Global Election Systems Inc.  All rights reserved.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-08 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*   Ported from public pppd code.
-*****************************************************************************/
-/*
- * auth.c - PPP authentication and phase control.
- *
- * Copyright (c) 1993 The Australian National University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the Australian National University.  The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "ppp.h"
-#if PPP_SUPPORT > 0
-#include "fsm.h"
-#include "lcp.h"
-#include "pap.h"
-#include "chap.h"
-#include "auth.h"
-#include "ipcp.h"
-
-#if CBCP_SUPPORT > 0
-#include "cbcp.h"
-#endif
-
-#include "pppdebug.h"
-
-
-/*************************/
-/*** LOCAL DEFINITIONS ***/
-/*************************/
-
-/* Bits in auth_pending[] */
-#define PAP_WITHPEER    1
-#define PAP_PEER    2
-#define CHAP_WITHPEER   4
-#define CHAP_PEER   8
-
-
-                                                                    
-/************************/
-/*** LOCAL DATA TYPES ***/
-/************************/
-/* Used for storing a sequence of words.  Usually malloced. */
-struct wordlist {
-    struct wordlist *next;
-    char        word[1];
-};
-
-
-
-/***********************************/
-/*** LOCAL FUNCTION DECLARATIONS ***/
-/***********************************/
-extern char *crypt (const char *, const char *);
-
-/* Prototypes for procedures local to this file. */
-
-static void network_phase (int);
-static void check_idle (void *);
-static void connect_time_expired (void *);
-#if 0
-static int  login (char *, char *, char **, int *);
-#endif
-static void logout (void);
-static int  null_login (int);
-static int  get_pap_passwd (int, char *, char *);
-static int  have_pap_secret (void);
-static int  have_chap_secret (char *, char *, u32_t);
-static int  ip_addr_check (u32_t, struct wordlist *);
-#if 0 /* PAP_SUPPORT > 0 || CHAP_SUPPORT > 0 */
-static void set_allowed_addrs(int unit, struct wordlist *addrs);
-static void free_wordlist (struct wordlist *);
-#endif
-#if CBCP_SUPPORT > 0
-static void callback_phase (int);
-#endif
-
-
-/******************************/
-/*** PUBLIC DATA STRUCTURES ***/
-/******************************/
-
-
-/*****************************/
-/*** LOCAL DATA STRUCTURES ***/
-/*****************************/
-#if PAP_SUPPORT > 0 || CHAP_SUPPORT > 0
-/* The name by which the peer authenticated itself to us. */
-static char peer_authname[MAXNAMELEN];
-#endif
-
-/* Records which authentication operations haven't completed yet. */
-static int auth_pending[NUM_PPP];
-
-/* Set if we have successfully called login() */
-static int logged_in;
-
-/* Set if we have run the /etc/ppp/auth-up script. */
-static int did_authup;
-
-/* List of addresses which the peer may use. */
-static struct wordlist *addresses[NUM_PPP];
-
-/* Number of network protocols which we have opened. */
-static int num_np_open;
-
-/* Number of network protocols which have come up. */
-static int num_np_up;
-
-#if PAP_SUPPORT > 0 || CHAP_SUPPORT > 0
-/* Set if we got the contents of passwd[] from the pap-secrets file. */
-static int passwd_from_file;
-#endif
-
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-/*
- * An Open on LCP has requested a change from Dead to Establish phase.
- * Do what's necessary to bring the physical layer up.
- */
-void link_required(int unit)
-{
-    AUTHDEBUG((LOG_INFO, "link_required: %d\n", unit));
-}
-
-/*
- * LCP has terminated the link; go to the Dead phase and take the
- * physical layer down.
- */
-void link_terminated(int unit)
-{
-    AUTHDEBUG((LOG_INFO, "link_terminated: %d\n", unit));
-    
-    if (lcp_phase[unit] == PHASE_DEAD)
-        return;
-    if (logged_in)
-        logout();
-    lcp_phase[unit] = PHASE_DEAD;
-    AUTHDEBUG((LOG_NOTICE, "Connection terminated.\n"));
-	pppMainWakeup(unit);
-}
-
-/*
- * LCP has gone down; it will either die or try to re-establish.
- */
-void link_down(int unit)
-{
-    int i;
-    struct protent *protp;
-    
-    AUTHDEBUG((LOG_INFO, "link_down: %d\n", unit));
-    if (did_authup) {
-        /* XXX Do link down processing. */
-        did_authup = 0;
-    }
-    for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) {
-        if (!protp->enabled_flag)
-            continue;
-        if (protp->protocol != PPP_LCP && protp->lowerdown != NULL)
-            (*protp->lowerdown)(unit);
-        if (protp->protocol < 0xC000 && protp->close != NULL)
-            (*protp->close)(unit, "LCP down");
-    }
-    num_np_open = 0;
-    num_np_up = 0;
-    if (lcp_phase[unit] != PHASE_DEAD)
-        lcp_phase[unit] = PHASE_TERMINATE;
-	pppMainWakeup(unit);
-}
-
-/*
- * The link is established.
- * Proceed to the Dead, Authenticate or Network phase as appropriate.
- */
-void link_established(int unit)
-{
-    int auth;
-    int i;
-    struct protent *protp;
-    lcp_options *wo = &lcp_wantoptions[unit];
-    lcp_options *go = &lcp_gotoptions[unit];
-#if PAP_SUPPORT > 0 || CHAP_SUPPORT > 0
-    lcp_options *ho = &lcp_hisoptions[unit];
-#endif
-    
-    AUTHDEBUG((LOG_INFO, "link_established: %d\n", unit));
-    /*
-     * Tell higher-level protocols that LCP is up.
-     */
-    for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i)
-        if (protp->protocol != PPP_LCP && protp->enabled_flag
-                && protp->lowerup != NULL)
-            (*protp->lowerup)(unit);
-    
-    if (ppp_settings.auth_required && !(go->neg_chap || go->neg_upap)) {
-        /*
-         * We wanted the peer to authenticate itself, and it refused:
-         * treat it as though it authenticated with PAP using a username
-         * of "" and a password of "".  If that's not OK, boot it out.
-         */
-        if (!wo->neg_upap || !null_login(unit)) {
-            AUTHDEBUG((LOG_WARNING, "peer refused to authenticate\n"));
-            lcp_close(unit, "peer refused to authenticate");
-            return;
-        }
-    }
-    
-    lcp_phase[unit] = PHASE_AUTHENTICATE;
-    auth = 0;
-#if CHAP_SUPPORT > 0
-    if (go->neg_chap) {
-        ChapAuthPeer(unit, ppp_settings.our_name, go->chap_mdtype);
-        auth |= CHAP_PEER;
-    } 
-#endif
-#if PAP_SUPPORT > 0 && CHAP_SUPPORT > 0
-    else
-#endif
-#if PAP_SUPPORT > 0
-    if (go->neg_upap) {
-        upap_authpeer(unit);
-        auth |= PAP_PEER;
-    }
-#endif
-#if CHAP_SUPPORT > 0
-    if (ho->neg_chap) {
-        ChapAuthWithPeer(unit, ppp_settings.user, ho->chap_mdtype);
-        auth |= CHAP_WITHPEER;
-    }
-#endif
-#if PAP_SUPPORT > 0 && CHAP_SUPPORT > 0
-    else
-#endif
-#if PAP_SUPPORT > 0
-    if (ho->neg_upap) {
-        if (ppp_settings.passwd[0] == 0) {
-            passwd_from_file = 1;
-            if (!get_pap_passwd(unit, ppp_settings.user, ppp_settings.passwd))
-                AUTHDEBUG((LOG_ERR, "No secret found for PAP login\n"));
-        }
-        upap_authwithpeer(unit, ppp_settings.user, ppp_settings.passwd);
-        auth |= PAP_WITHPEER;
-    }
-#endif
-    auth_pending[unit] = auth;
-    
-    if (!auth)
-        network_phase(unit);
-}
-
-
-/*
- * The peer has failed to authenticate himself using `protocol'.
- */
-void auth_peer_fail(int unit, u16_t protocol)
-{
-    AUTHDEBUG((LOG_INFO, "auth_peer_fail: %d proto=%X\n", unit, protocol));
-    /*
-     * Authentication failure: take the link down
-     */
-    lcp_close(unit, "Authentication failed");
-}
-
-
-#if PAP_SUPPORT > 0 || CHAP_SUPPORT > 0
-/*
- * The peer has been successfully authenticated using `protocol'.
- */
-void auth_peer_success(int unit, u16_t protocol, char *name, int namelen)
-{
-    int pbit;
-    
-    AUTHDEBUG((LOG_INFO, "auth_peer_success: %d proto=%X\n", unit, protocol));
-    switch (protocol) {
-    case PPP_CHAP:
-        pbit = CHAP_PEER;
-        break;
-    case PPP_PAP:
-        pbit = PAP_PEER;
-        break;
-    default:
-        AUTHDEBUG((LOG_WARNING, "auth_peer_success: unknown protocol %x\n",
-               protocol));
-        return;
-    }
-    
-    /*
-     * Save the authenticated name of the peer for later.
-     */
-    if (namelen > sizeof(peer_authname) - 1)
-        namelen = sizeof(peer_authname) - 1;
-    BCOPY(name, peer_authname, namelen);
-    peer_authname[namelen] = 0;
-    
-    /*
-     * If there is no more authentication still to be done,
-     * proceed to the network (or callback) phase.
-     */
-    if ((auth_pending[unit] &= ~pbit) == 0)
-        network_phase(unit);
-}
-
-/*
- * We have failed to authenticate ourselves to the peer using `protocol'.
- */
-void auth_withpeer_fail(int unit, u16_t protocol)
-{
-    int errCode = PPPERR_AUTHFAIL;
-    
-    AUTHDEBUG((LOG_INFO, "auth_withpeer_fail: %d proto=%X\n", unit, protocol));
-    if (passwd_from_file)
-        BZERO(ppp_settings.passwd, MAXSECRETLEN);
-    /* 
-     * XXX Warning: the unit number indicates the interface which is
-     * not necessarily the PPP connection.  It works here as long
-     * as we are only supporting PPP interfaces.
-     */
-    pppIOCtl(unit, PPPCTLS_ERRCODE, &errCode);
-
-    /*
-     * We've failed to authenticate ourselves to our peer.
-     * He'll probably take the link down, and there's not much
-     * we can do except wait for that.
-     */
-}
-
-/*
- * We have successfully authenticated ourselves with the peer using `protocol'.
- */
-void auth_withpeer_success(int unit, u16_t protocol)
-{
-    int pbit;
-    
-    AUTHDEBUG((LOG_INFO, "auth_withpeer_success: %d proto=%X\n", unit, protocol));
-    switch (protocol) {
-    case PPP_CHAP:
-        pbit = CHAP_WITHPEER;
-        break;
-    case PPP_PAP:
-        if (passwd_from_file)
-            BZERO(ppp_settings.passwd, MAXSECRETLEN);
-        pbit = PAP_WITHPEER;
-        break;
-    default:
-        AUTHDEBUG((LOG_WARNING, "auth_peer_success: unknown protocol %x\n",
-               protocol));
-        pbit = 0;
-    }
-    
-    /*
-     * If there is no more authentication still being done,
-     * proceed to the network (or callback) phase.
-     */
-    if ((auth_pending[unit] &= ~pbit) == 0)
-        network_phase(unit);
-}
-#endif
-
-
-/*
- * np_up - a network protocol has come up.
- */
-void np_up(int unit, u16_t proto)
-{
-    AUTHDEBUG((LOG_INFO, "np_up: %d proto=%X\n", unit, proto));
-    if (num_np_up == 0) {
-	AUTHDEBUG((LOG_INFO, "np_up: maxconnect=%d idle_time_limit=%d\n",ppp_settings.maxconnect,ppp_settings.idle_time_limit));
-        /*
-         * At this point we consider that the link has come up successfully.
-         */
-        if (ppp_settings.idle_time_limit > 0)
-            TIMEOUT(check_idle, NULL, ppp_settings.idle_time_limit);
-        
-        /*
-         * Set a timeout to close the connection once the maximum
-         * connect time has expired.
-         */
-        if (ppp_settings.maxconnect > 0)
-            TIMEOUT(connect_time_expired, 0, ppp_settings.maxconnect);
-    }
-    ++num_np_up;
-}
-
-/*
- * np_down - a network protocol has gone down.
- */
-void np_down(int unit, u16_t proto)
-{
-    AUTHDEBUG((LOG_INFO, "np_down: %d proto=%X\n", unit, proto));
-    if (--num_np_up == 0 && ppp_settings.idle_time_limit > 0) {
-        UNTIMEOUT(check_idle, NULL);
-    }
-}
-
-/*
- * np_finished - a network protocol has finished using the link.
- */
-void np_finished(int unit, u16_t proto)
-{
-    AUTHDEBUG((LOG_INFO, "np_finished: %d proto=%X\n", unit, proto));
-    if (--num_np_open <= 0) {
-        /* no further use for the link: shut up shop. */
-        lcp_close(0, "No network protocols running");
-    }
-}
-
-/*
- * auth_reset - called when LCP is starting negotiations to recheck
- * authentication options, i.e. whether we have appropriate secrets
- * to use for authenticating ourselves and/or the peer.
- */
-void auth_reset(int unit)
-{
-    lcp_options *go = &lcp_gotoptions[unit];
-    lcp_options *ao = &lcp_allowoptions[0];
-    ipcp_options *ipwo = &ipcp_wantoptions[0];
-    u32_t remote;
-    
-    AUTHDEBUG((LOG_INFO, "auth_reset: %d\n", unit));
-    ao->neg_upap = !ppp_settings.refuse_pap && (ppp_settings.passwd[0] != 0 || get_pap_passwd(unit, NULL, NULL));
-    ao->neg_chap = !ppp_settings.refuse_chap && ppp_settings.passwd[0] != 0 /*have_chap_secret(ppp_settings.user, ppp_settings.remote_name, (u32_t)0)*/;
-    
-    if (go->neg_upap && !have_pap_secret())
-        go->neg_upap = 0;
-    if (go->neg_chap) {
-        remote = ipwo->accept_remote? 0: ipwo->hisaddr;
-        if (!have_chap_secret(ppp_settings.remote_name, ppp_settings.our_name, remote))
-            go->neg_chap = 0;
-    }
-}
-
-
-#if PAP_SUPPORT > 0
-/*
- * check_passwd - Check the user name and passwd against the PAP secrets
- * file.  If requested, also check against the system password database,
- * and login the user if OK.
- *
- * returns:
- *  UPAP_AUTHNAK: Authentication failed.
- *  UPAP_AUTHACK: Authentication succeeded.
- * In either case, msg points to an appropriate message.
- */
-int check_passwd(
-	int unit,
-	char *auser,
-	int userlen,
-	char *apasswd,
-	int passwdlen,
-	char **msg,
-	int *msglen
-)
-{
-#if 1
-	*msg = (char *) 0;
-	return UPAP_AUTHACK;     /* XXX Assume all entries OK. */
-#else
-    int ret = 0;
-    struct wordlist *addrs = NULL;
-    char passwd[256], user[256];
-    char secret[MAXWORDLEN];
-    static u_short attempts = 0;
-    
-    /*
-     * Make copies of apasswd and auser, then null-terminate them.
-     */
-    BCOPY(apasswd, passwd, passwdlen);
-    passwd[passwdlen] = '\0';
-    BCOPY(auser, user, userlen);
-    user[userlen] = '\0';
-    *msg = (char *) 0;
-
-    /* XXX Validate user name and password. */
-    ret = UPAP_AUTHACK;     /* XXX Assume all entries OK. */
-        
-    if (ret == UPAP_AUTHNAK) {
-        if (*msg == (char *) 0)
-            *msg = "Login incorrect";
-        *msglen = strlen(*msg);
-        /*
-         * Frustrate passwd stealer programs.
-         * Allow 10 tries, but start backing off after 3 (stolen from login).
-         * On 10'th, drop the connection.
-         */
-        if (attempts++ >= 10) {
-            AUTHDEBUG((LOG_WARNING, "%d LOGIN FAILURES BY %s\n", attempts, user));
-            /*ppp_panic("Excess Bad Logins");*/
-        }
-        if (attempts > 3) {
-            sys_msleep((attempts - 3) * 5);
-        }
-        if (addrs != NULL) {
-            free_wordlist(addrs);
-        }
-    } else {
-        attempts = 0;           /* Reset count */
-        if (*msg == (char *) 0)
-            *msg = "Login ok";
-        *msglen = strlen(*msg);
-        set_allowed_addrs(unit, addrs);
-    }
-    
-    BZERO(passwd, sizeof(passwd));
-    BZERO(secret, sizeof(secret));
-    
-    return ret;
-#endif
-}
-#endif
-
-
-/*
- * auth_ip_addr - check whether the peer is authorized to use
- * a given IP address.  Returns 1 if authorized, 0 otherwise.
- */
-int auth_ip_addr(int unit, u32_t addr)
-{
-    return ip_addr_check(addr, addresses[unit]);
-}
-
-/*
- * bad_ip_adrs - return 1 if the IP address is one we don't want
- * to use, such as an address in the loopback net or a multicast address.
- * addr is in network byte order.
- */
-int bad_ip_adrs(u32_t addr)
-{
-    addr = ntohl(addr);
-    return (addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET
-        || IN_MULTICAST(addr) || IN_BADCLASS(addr);
-}
-
-
-#if CHAP_SUPPORT > 0
-/*
- * get_secret - open the CHAP secret file and return the secret
- * for authenticating the given client on the given server.
- * (We could be either client or server).
- */
-int get_secret(
-    int unit,
-    char *client,
-    char *server,
-    char *secret,
-    int *secret_len,
-    int save_addrs
-)
-{
-#if 1
-    int len;
-    struct wordlist *addrs;
-    
-    addrs = NULL;
-
-    if(!client || !client[0] || strcmp(client, ppp_settings.user)) {
-	return 0;
-    }
-
-    len = strlen(ppp_settings.passwd);
-    if (len > MAXSECRETLEN) {
-        AUTHDEBUG((LOG_ERR, "Secret for %s on %s is too long\n", client, server));
-        len = MAXSECRETLEN;
-    }
-    BCOPY(ppp_settings.passwd, secret, len);
-    *secret_len = len;
-    
-    return 1;
-#else
-    int ret = 0, len;
-    struct wordlist *addrs;
-    char secbuf[MAXWORDLEN];
-    
-    addrs = NULL;
-    secbuf[0] = 0;
-
-    /* XXX Find secret. */  
-    if (ret < 0)
-        return 0;
-    
-    if (save_addrs)
-        set_allowed_addrs(unit, addrs);
-    
-    len = strlen(secbuf);
-    if (len > MAXSECRETLEN) {
-        AUTHDEBUG((LOG_ERR, "Secret for %s on %s is too long\n", client, server));
-        len = MAXSECRETLEN;
-    }
-    BCOPY(secbuf, secret, len);
-    BZERO(secbuf, sizeof(secbuf));
-    *secret_len = len;
-    
-    return 1;
-#endif
-}
-#endif
-
-
-#if 0 /* UNUSED */
-/*
- * auth_check_options - called to check authentication options.
- */
-void auth_check_options(void)
-{
-    lcp_options *wo = &lcp_wantoptions[0];
-    int can_auth;
-    ipcp_options *ipwo = &ipcp_wantoptions[0];
-    u32_t remote;
-    
-    /* Default our_name to hostname, and user to our_name */
-    if (ppp_settings.our_name[0] == 0 || ppp_settings.usehostname)
-        strcpy(ppp_settings.our_name, ppp_settings.hostname);
-    if (ppp_settings.user[0] == 0)
-        strcpy(ppp_settings.user, ppp_settings.our_name);
-    
-    /* If authentication is required, ask peer for CHAP or PAP. */
-    if (ppp_settings.auth_required && !wo->neg_chap && !wo->neg_upap) {
-        wo->neg_chap = 1;
-        wo->neg_upap = 1;
-    }
-    
-    /*
-     * Check whether we have appropriate secrets to use
-     * to authenticate the peer.
-     */
-    can_auth = wo->neg_upap && have_pap_secret();
-    if (!can_auth && wo->neg_chap) {
-        remote = ipwo->accept_remote? 0: ipwo->hisaddr;
-        can_auth = have_chap_secret(ppp_settings.remote_name, ppp_settings.our_name, remote);
-    }
-    
-    if (ppp_settings.auth_required && !can_auth) {
-        ppp_panic("No auth secret");
-    }
-}
-#endif
-
-
-/**********************************/
-/*** LOCAL FUNCTION DEFINITIONS ***/
-/**********************************/
-/*
- * Proceed to the network phase.
- */
-static void network_phase(int unit)
-{
-    int i;
-    struct protent *protp;
-    lcp_options *go = &lcp_gotoptions[unit];
-    
-    /*
-     * If the peer had to authenticate, run the auth-up script now.
-     */
-    if ((go->neg_chap || go->neg_upap) && !did_authup) {
-        /* XXX Do setup for peer authentication. */
-        did_authup = 1;
-    }
-    
-#if CBCP_SUPPORT > 0
-    /*
-     * If we negotiated callback, do it now.
-     */
-    if (go->neg_cbcp) {
-        lcp_phase[unit] = PHASE_CALLBACK;
-        (*cbcp_protent.open)(unit);
-        return;
-    }
-#endif
-    
-    lcp_phase[unit] = PHASE_NETWORK;
-    for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i)
-        if (protp->protocol < 0xC000 && protp->enabled_flag
-                && protp->open != NULL) {
-            (*protp->open)(unit);
-            if (protp->protocol != PPP_CCP)
-                ++num_np_open;
-        }
-    
-    if (num_np_open == 0)
-        /* nothing to do */
-        lcp_close(0, "No network protocols running");
-}
-
-/*
- * check_idle - check whether the link has been idle for long
- * enough that we can shut it down.
- */
-static void check_idle(void *arg)
-{
-    struct ppp_idle idle;
-    u_short itime;
-    
-	(void)arg;
-    if (!get_idle_time(0, &idle))
-        return;
-    itime = LWIP_MIN(idle.xmit_idle, idle.recv_idle);
-    if (itime >= ppp_settings.idle_time_limit) {
-        /* link is idle: shut it down. */
-        AUTHDEBUG((LOG_INFO, "Terminating connection due to lack of activity.\n"));
-        lcp_close(0, "Link inactive");
-    } else {
-        TIMEOUT(check_idle, NULL, ppp_settings.idle_time_limit - itime);
-    }
-}
-
-/*
- * connect_time_expired - log a message and close the connection.
- */
-static void connect_time_expired(void *arg)
-{
-	(void)arg;
-
-    AUTHDEBUG((LOG_INFO, "Connect time expired\n"));
-    lcp_close(0, "Connect time expired");   /* Close connection */
-}
-
-#if 0
-/*
- * login - Check the user name and password against the system
- * password database, and login the user if OK.
- *
- * returns:
- *  UPAP_AUTHNAK: Login failed.
- *  UPAP_AUTHACK: Login succeeded.
- * In either case, msg points to an appropriate message.
- */
-static int login(char *user, char *passwd, char **msg, int *msglen)
-{
-    /* XXX Fail until we decide that we want to support logins. */
-    return (UPAP_AUTHNAK);
-}
-#endif
-
-/*
- * logout - Logout the user.
- */
-static void logout(void)
-{
-    logged_in = 0;
-}
-
-
-/*
- * null_login - Check if a username of "" and a password of "" are
- * acceptable, and iff so, set the list of acceptable IP addresses
- * and return 1.
- */
-static int null_login(int unit)
-{
-	(void)unit;
-    /* XXX Fail until we decide that we want to support logins. */
-    return 0;
-}
-
-
-/*
- * get_pap_passwd - get a password for authenticating ourselves with
- * our peer using PAP.  Returns 1 on success, 0 if no suitable password
- * could be found.
- */
-static int get_pap_passwd(int unit, char *user, char *passwd)
-{
-/* normally we would reject PAP if no password is provided,
-   but this causes problems with some providers (like CHT in Taiwan)
-   who incorrectly request PAP and expect a bogus/empty password, so
-   always provide a default user/passwd of "none"/"none"
-*/
-    if(user)
-    	strcpy(user,   "none");
-    if(passwd)
-    	strcpy(passwd, "none");
-
-    return 1;
-}
-
-
-/*
- * have_pap_secret - check whether we have a PAP file with any
- * secrets that we could possibly use for authenticating the peer.
- */
-static int have_pap_secret(void)
-{
-    /* XXX Fail until we set up our passwords. */
-    return 0;
-}
-
-
-/*
- * have_chap_secret - check whether we have a CHAP file with a
- * secret that we could possibly use for authenticating `client'
- * on `server'.  Either can be the null string, meaning we don't
- * know the identity yet.
- */
-static int have_chap_secret(char *client, char *server, u32_t remote)
-{
-	(void)client;
-	(void)server;
-	(void)remote;
-    /* XXX Fail until we set up our passwords. */
-    return 0;
-}
-
-
-#if 0 /* PAP_SUPPORT > 0 || CHAP_SUPPORT > 0 */
-/*
- * set_allowed_addrs() - set the list of allowed addresses.
- */
-static void set_allowed_addrs(int unit, struct wordlist *addrs)
-{
-    if (addresses[unit] != NULL)
-        free_wordlist(addresses[unit]);
-    addresses[unit] = addrs;
-
-#if 0
-    /*
-     * If there's only one authorized address we might as well
-     * ask our peer for that one right away
-     */
-    if (addrs != NULL && addrs->next == NULL) {
-        char *p = addrs->word;
-        struct ipcp_options *wo = &ipcp_wantoptions[unit];
-        u32_t a;
-        struct hostent *hp;
-        
-        if (wo->hisaddr == 0 && *p != '!' && *p != '-'
-                && strchr(p, '/') == NULL) {
-            hp = gethostbyname(p);
-            if (hp != NULL && hp->h_addrtype == AF_INET)
-                a = *(u32_t *)hp->h_addr;
-            else
-                a = inet_addr(p);
-            if (a != (u32_t) -1)
-                wo->hisaddr = a;
-        }
-    }
-#endif
-}
-#endif
-
-static int ip_addr_check(u32_t addr, struct wordlist *addrs)
-{
-    
-    /* don't allow loopback or multicast address */
-    if (bad_ip_adrs(addr))
-        return 0;
-    
-    if (addrs == NULL)
-        return !ppp_settings.auth_required;      /* no addresses authorized */
-    
-    /* XXX All other addresses allowed. */
-    return 1;
-}
-
-#if 0 /* PAP_SUPPORT > 0 || CHAP_SUPPORT */
-/*
- * free_wordlist - release memory allocated for a wordlist.
- */
-static void free_wordlist(struct wordlist *wp)
-{
-    struct wordlist *next;
-    
-    while (wp != NULL) {
-        next = wp->next;
-        free(wp);
-        wp = next;
-    }
-}
-#endif
-
-#endif /* PPP_SUPPORT */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/auth.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/auth.h
deleted file mode 100644
index d6a5de5..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/auth.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*****************************************************************************
-* auth.h -  PPP Authentication and phase control header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1998 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-04 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original derived from BSD pppd.h.
-*****************************************************************************/
-/*
- * pppd.h - PPP daemon global declarations.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-
-#ifndef AUTH_H
-#define AUTH_H
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-void link_required (int);		/* we are starting to use the link */
-void link_terminated (int);	/* we are finished with the link */
-void link_down (int);			/* the LCP layer has left the Opened state */
-void link_established (int);	/* the link is up; authenticate now */
-void np_up (int, u16_t);			/* a network protocol has come up */
-void np_down (int, u16_t);		/* a network protocol has gone down */
-void np_finished (int, u16_t);	/* a network protocol no longer needs link */
-void auth_peer_fail (int, u16_t);/* peer failed to authenticate itself */
-
-/* peer successfully authenticated itself */
-void auth_peer_success (int, u16_t, char *, int);
-
-/* we failed to authenticate ourselves */
-void auth_withpeer_fail (int, u16_t);
-
-/* we successfully authenticated ourselves */
-void auth_withpeer_success (int, u16_t);
-
-/* check authentication options supplied */
-void auth_check_options (void);
-void auth_reset (int);			/* check what secrets we have */
-
-/* Check peer-supplied username/password */
-int  check_passwd (int, char *, int, char *, int, char **, int *);
-
-/* get "secret" for chap */
-int  get_secret (int, char *, char *, char *, int *, int);
-
-/* check if IP address is authorized */
-int  auth_ip_addr (int, u32_t);
-
-/* check if IP address is unreasonable */
-int  bad_ip_adrs (u32_t);
-
-
-#endif /* AUTH_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.c
deleted file mode 100644
index 4d1dc0d..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.c
+++ /dev/null
@@ -1,872 +0,0 @@
-/*** WARNING - THIS HAS NEVER BEEN FINISHED ***/
-/*****************************************************************************
-* chap.c - Network Challenge Handshake Authentication Protocol program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 by Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-04 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original based on BSD chap.c.
-*****************************************************************************/
-/*
- * chap.c - Challenge Handshake Authentication Protocol.
- *
- * Copyright (c) 1993 The Australian National University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the Australian National University.  The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Copyright (c) 1991 Gregory M. Christy.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Gregory M. Christy.  The name of the author may not be used to
- * endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "ppp.h"
-#if PPP_SUPPORT > 0
-#include "magic.h"
-
-#if CHAP_SUPPORT > 0
-
-#include "randm.h"
-#include "auth.h"
-#include "md5.h"
-#include "chap.h"
-#include "chpms.h"
-#include "pppdebug.h"
-
-
-/*************************/
-/*** LOCAL DEFINITIONS ***/
-/*************************/
-
-
-/************************/
-/*** LOCAL DATA TYPES ***/
-/************************/
-
-
-/***********************************/
-/*** LOCAL FUNCTION DECLARATIONS ***/
-/***********************************/
-/*
- * Protocol entry points.
- */
-static void ChapInit (int);
-static void ChapLowerUp (int);
-static void ChapLowerDown (int);
-static void ChapInput (int, u_char *, int);
-static void ChapProtocolReject (int);
-static int  ChapPrintPkt (u_char *, int,
-			      void (*) (void *, char *, ...), void *);
-
-static void ChapChallengeTimeout (void *);
-static void ChapResponseTimeout (void *);
-static void ChapReceiveChallenge (chap_state *, u_char *, int, int);
-static void ChapRechallenge (void *);
-static void ChapReceiveResponse (chap_state *, u_char *, int, int);
-static void ChapReceiveSuccess(chap_state *cstate, u_char *inp, u_char id, int len);
-static void ChapReceiveFailure(chap_state *cstate, u_char *inp, u_char id, int len);
-static void ChapSendStatus (chap_state *, int);
-static void ChapSendChallenge (chap_state *);
-static void ChapSendResponse (chap_state *);
-static void ChapGenChallenge (chap_state *);
-
-
-/******************************/
-/*** PUBLIC DATA STRUCTURES ***/
-/******************************/
-chap_state chap[NUM_PPP];		/* CHAP state; one for each unit */
-
-struct protent chap_protent = {
-    PPP_CHAP,
-    ChapInit,
-    ChapInput,
-    ChapProtocolReject,
-    ChapLowerUp,
-    ChapLowerDown,
-    NULL,
-    NULL,
-#if 0
-    ChapPrintPkt,
-    NULL,
-#endif
-    1,
-    "CHAP",
-#if 0
-    NULL,
-    NULL,
-    NULL
-#endif
-};
-
-
-
-/*****************************/
-/*** LOCAL DATA STRUCTURES ***/
-/*****************************/
-static char *ChapCodenames[] = {
-	"Challenge", "Response", "Success", "Failure"
-};
-
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-/*
- * ChapAuthWithPeer - Authenticate us with our peer (start client).
- *
- */
-void ChapAuthWithPeer(int unit, char *our_name, int digest)
-{
-	chap_state *cstate = &chap[unit];
-	
-	cstate->resp_name = our_name;
-	cstate->resp_type = digest;
-	
-	if (cstate->clientstate == CHAPCS_INITIAL ||
-			cstate->clientstate == CHAPCS_PENDING) {
-		/* lower layer isn't up - wait until later */
-		cstate->clientstate = CHAPCS_PENDING;
-		return;
-	}
-	
-	/*
-	 * We get here as a result of LCP coming up.
-	 * So even if CHAP was open before, we will 
-	 * have to re-authenticate ourselves.
-	 */
-	cstate->clientstate = CHAPCS_LISTEN;
-}
-
-
-/*
- * ChapAuthPeer - Authenticate our peer (start server).
- */
-void ChapAuthPeer(int unit, char *our_name, int digest)
-{
-	chap_state *cstate = &chap[unit];
-	
-	cstate->chal_name = our_name;
-	cstate->chal_type = digest;
-	
-	if (cstate->serverstate == CHAPSS_INITIAL ||
-			cstate->serverstate == CHAPSS_PENDING) {
-		/* lower layer isn't up - wait until later */
-		cstate->serverstate = CHAPSS_PENDING;
-		return;
-	}
-	
-	ChapGenChallenge(cstate);
-	ChapSendChallenge(cstate);		/* crank it up dude! */
-	cstate->serverstate = CHAPSS_INITIAL_CHAL;
-}
-
-
-
-
-/**********************************/
-/*** LOCAL FUNCTION DEFINITIONS ***/
-/**********************************/
-/*
- * ChapInit - Initialize a CHAP unit.
- */
-static void ChapInit(int unit)
-{
-	chap_state *cstate = &chap[unit];
-	
-	BZERO(cstate, sizeof(*cstate));
-	cstate->unit = unit;
-	cstate->clientstate = CHAPCS_INITIAL;
-	cstate->serverstate = CHAPSS_INITIAL;
-	cstate->timeouttime = CHAP_DEFTIMEOUT;
-	cstate->max_transmits = CHAP_DEFTRANSMITS;
-	/* random number generator is initialized in magic_init */
-}
-
-
-/*
- * ChapChallengeTimeout - Timeout expired on sending challenge.
- */
-static void ChapChallengeTimeout(void *arg)
-{
-	chap_state *cstate = (chap_state *) arg;
-	
-	/* if we aren't sending challenges, don't worry.  then again we */
-	/* probably shouldn't be here either */
-	if (cstate->serverstate != CHAPSS_INITIAL_CHAL &&
-			cstate->serverstate != CHAPSS_RECHALLENGE)
-		return;
-	
-	if (cstate->chal_transmits >= cstate->max_transmits) {
-		/* give up on peer */
-		CHAPDEBUG((LOG_ERR, "Peer failed to respond to CHAP challenge\n"));
-		cstate->serverstate = CHAPSS_BADAUTH;
-		auth_peer_fail(cstate->unit, PPP_CHAP);
-		return;
-	}
-	
-	ChapSendChallenge(cstate);		/* Re-send challenge */
-}
-
-
-/*
- * ChapResponseTimeout - Timeout expired on sending response.
- */
-static void ChapResponseTimeout(void *arg)
-{
-	chap_state *cstate = (chap_state *) arg;
-	
-	/* if we aren't sending a response, don't worry. */
-	if (cstate->clientstate != CHAPCS_RESPONSE)
-		return;
-	
-	ChapSendResponse(cstate);		/* re-send response */
-}
-
-
-/*
- * ChapRechallenge - Time to challenge the peer again.
- */
-static void ChapRechallenge(void *arg)
-{
-	chap_state *cstate = (chap_state *) arg;
-	
-	/* if we aren't sending a response, don't worry. */
-	if (cstate->serverstate != CHAPSS_OPEN)
-		return;
-	
-	ChapGenChallenge(cstate);
-	ChapSendChallenge(cstate);
-	cstate->serverstate = CHAPSS_RECHALLENGE;
-}
-
-
-/*
- * ChapLowerUp - The lower layer is up.
- *
- * Start up if we have pending requests.
- */
-static void ChapLowerUp(int unit)
-{
-	chap_state *cstate = &chap[unit];
-	
-	if (cstate->clientstate == CHAPCS_INITIAL)
-		cstate->clientstate = CHAPCS_CLOSED;
-	else if (cstate->clientstate == CHAPCS_PENDING)
-		cstate->clientstate = CHAPCS_LISTEN;
-	
-	if (cstate->serverstate == CHAPSS_INITIAL)
-		cstate->serverstate = CHAPSS_CLOSED;
-	else if (cstate->serverstate == CHAPSS_PENDING) {
-		ChapGenChallenge(cstate);
-		ChapSendChallenge(cstate);
-		cstate->serverstate = CHAPSS_INITIAL_CHAL;
-	}
-}
-
-
-/*
- * ChapLowerDown - The lower layer is down.
- *
- * Cancel all timeouts.
- */
-static void ChapLowerDown(int unit)
-{
-	chap_state *cstate = &chap[unit];
-	
-	/* Timeout(s) pending?  Cancel if so. */
-	if (cstate->serverstate == CHAPSS_INITIAL_CHAL ||
-			cstate->serverstate == CHAPSS_RECHALLENGE)
-		UNTIMEOUT(ChapChallengeTimeout, cstate);
-	else if (cstate->serverstate == CHAPSS_OPEN
-			&& cstate->chal_interval != 0)
-		UNTIMEOUT(ChapRechallenge, cstate);
-	if (cstate->clientstate == CHAPCS_RESPONSE)
-		UNTIMEOUT(ChapResponseTimeout, cstate);
-	
-	cstate->clientstate = CHAPCS_INITIAL;
-	cstate->serverstate = CHAPSS_INITIAL;
-}
-
-
-/*
- * ChapProtocolReject - Peer doesn't grok CHAP.
- */
-static void ChapProtocolReject(int unit)
-{
-	chap_state *cstate = &chap[unit];
-	
-	if (cstate->serverstate != CHAPSS_INITIAL &&
-			cstate->serverstate != CHAPSS_CLOSED)
-		auth_peer_fail(unit, PPP_CHAP);
-	if (cstate->clientstate != CHAPCS_INITIAL &&
-			cstate->clientstate != CHAPCS_CLOSED)
-		auth_withpeer_fail(unit, PPP_CHAP);
-	ChapLowerDown(unit);		/* shutdown chap */
-}
-
-
-/*
- * ChapInput - Input CHAP packet.
- */
-static void ChapInput(int unit, u_char *inpacket, int packet_len)
-{
-	chap_state *cstate = &chap[unit];
-	u_char *inp;
-	u_char code, id;
-	int len;
-	
-	/*
-	 * Parse header (code, id and length).
-	 * If packet too short, drop it.
-	 */
-	inp = inpacket;
-	if (packet_len < CHAP_HEADERLEN) {
-		CHAPDEBUG((LOG_INFO, "ChapInput: rcvd short header.\n"));
-		return;
-	}
-	GETCHAR(code, inp);
-	GETCHAR(id, inp);
-	GETSHORT(len, inp);
-	if (len < CHAP_HEADERLEN) {
-		CHAPDEBUG((LOG_INFO, "ChapInput: rcvd illegal length.\n"));
-		return;
-	}
-	if (len > packet_len) {
-		CHAPDEBUG((LOG_INFO, "ChapInput: rcvd short packet.\n"));
-		return;
-	}
-	len -= CHAP_HEADERLEN;
-	
-	/*
-	 * Action depends on code (as in fact it usually does :-).
-	 */
-	switch (code) {
-	case CHAP_CHALLENGE:
-		ChapReceiveChallenge(cstate, inp, id, len);
-		break;
-	
-	case CHAP_RESPONSE:
-		ChapReceiveResponse(cstate, inp, id, len);
-		break;
-	
-	case CHAP_FAILURE:
-		ChapReceiveFailure(cstate, inp, id, len);
-		break;
-	
-	case CHAP_SUCCESS:
-		ChapReceiveSuccess(cstate, inp, id, len);
-		break;
-	
-	default:				/* Need code reject? */
-		CHAPDEBUG((LOG_WARNING, "Unknown CHAP code (%d) received.\n", code));
-		break;
-	}
-}
-
-
-/*
- * ChapReceiveChallenge - Receive Challenge and send Response.
- */
-static void ChapReceiveChallenge(chap_state *cstate, u_char *inp, int id, int len)
-{
-	int rchallenge_len;
-	u_char *rchallenge;
-	int secret_len;
-	char secret[MAXSECRETLEN];
-	char rhostname[256];
-	MD5_CTX mdContext;
-	u_char hash[MD5_SIGNATURE_SIZE];
-	
-	CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: Rcvd id %d.\n", id));
-	if (cstate->clientstate == CHAPCS_CLOSED ||
-		cstate->clientstate == CHAPCS_PENDING) {
-		CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: in state %d\n",
-			   cstate->clientstate));
-		return;
-	}
-	
-	if (len < 2) {
-		CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: rcvd short packet.\n"));
-		return;
-	}
-	
-	GETCHAR(rchallenge_len, inp);
-	len -= sizeof (u_char) + rchallenge_len;	/* now name field length */
-	if (len < 0) {
-		CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: rcvd short packet.\n"));
-		return;
-	}
-	rchallenge = inp;
-	INCPTR(rchallenge_len, inp);
-	
-	if (len >= sizeof(rhostname))
-		len = sizeof(rhostname) - 1;
-	BCOPY(inp, rhostname, len);
-	rhostname[len] = '\000';
-	
-	CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: received name field '%s'\n",
-	       rhostname));
-	
-	/* Microsoft doesn't send their name back in the PPP packet */
-	if (ppp_settings.remote_name[0] != 0 && (ppp_settings.explicit_remote || rhostname[0] == 0)) {
-		strncpy(rhostname, ppp_settings.remote_name, sizeof(rhostname));
-		rhostname[sizeof(rhostname) - 1] = 0;
-		CHAPDEBUG((LOG_INFO, "ChapReceiveChallenge: using '%s' as remote name\n",
-			   rhostname));
-	}
-	
-	/* get secret for authenticating ourselves with the specified host */
-	if (!get_secret(cstate->unit, cstate->resp_name, rhostname,
-			    secret, &secret_len, 0)) {
-		secret_len = 0;		/* assume null secret if can't find one */
-		CHAPDEBUG((LOG_WARNING, "No CHAP secret found for authenticating us to %s\n", rhostname));
-	}
-	
-	/* cancel response send timeout if necessary */
-	if (cstate->clientstate == CHAPCS_RESPONSE)
-		UNTIMEOUT(ChapResponseTimeout, cstate);
-	
-	cstate->resp_id = id;
-	cstate->resp_transmits = 0;
-	
-	/*  generate MD based on negotiated type */
-	switch (cstate->resp_type) { 
-	
-	case CHAP_DIGEST_MD5:
-		MD5Init(&mdContext);
-		MD5Update(&mdContext, &cstate->resp_id, 1);
-		MD5Update(&mdContext, (u_char*)secret, secret_len);
-		MD5Update(&mdContext, rchallenge, rchallenge_len);
-		MD5Final(hash, &mdContext);
-		BCOPY(hash, cstate->response, MD5_SIGNATURE_SIZE);
-		cstate->resp_length = MD5_SIGNATURE_SIZE;
-		break;
-	
-#ifdef CHAPMS
-	case CHAP_MICROSOFT:
-		ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len);
-		break;
-#endif
-	
-	default:
-		CHAPDEBUG((LOG_INFO, "unknown digest type %d\n", cstate->resp_type));
-		return;
-	}
-	
-	BZERO(secret, sizeof(secret));
-	ChapSendResponse(cstate);
-}
-
-
-/*
- * ChapReceiveResponse - Receive and process response.
- */
-static void ChapReceiveResponse(chap_state *cstate, u_char *inp, int id, int len)
-{
-	u_char *remmd, remmd_len;
-	int secret_len, old_state;
-	int code;
-	char rhostname[256];
-	MD5_CTX mdContext;
-	char secret[MAXSECRETLEN];
-	u_char hash[MD5_SIGNATURE_SIZE];
-	
-	CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: Rcvd id %d.\n", id));
-	
-	if (cstate->serverstate == CHAPSS_CLOSED ||
-			cstate->serverstate == CHAPSS_PENDING) {
-		CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: in state %d\n",
-		cstate->serverstate));
-		return;
-	}
-	
-	if (id != cstate->chal_id)
-		return;			/* doesn't match ID of last challenge */
-	
-	/*
-	* If we have received a duplicate or bogus Response,
-	* we have to send the same answer (Success/Failure)
-	* as we did for the first Response we saw.
-	*/
-	if (cstate->serverstate == CHAPSS_OPEN) {
-		ChapSendStatus(cstate, CHAP_SUCCESS);
-		return;
-	}
-	if (cstate->serverstate == CHAPSS_BADAUTH) {
-		ChapSendStatus(cstate, CHAP_FAILURE);
-		return;
-	}
-	
-	if (len < 2) {
-		CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: rcvd short packet.\n"));
-		return;
-	}
-	GETCHAR(remmd_len, inp);		/* get length of MD */
-	remmd = inp;			/* get pointer to MD */
-	INCPTR(remmd_len, inp);
-	
-	len -= sizeof (u_char) + remmd_len;
-	if (len < 0) {
-		CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: rcvd short packet.\n"));
-		return;
-	}
-	
-	UNTIMEOUT(ChapChallengeTimeout, cstate);
-	
-	if (len >= sizeof(rhostname))
-		len = sizeof(rhostname) - 1;
-	BCOPY(inp, rhostname, len);
-	rhostname[len] = '\000';
-	
-	CHAPDEBUG((LOG_INFO, "ChapReceiveResponse: received name field: %s\n",
-				rhostname));
-	
-	/*
-	* Get secret for authenticating them with us,
-	* do the hash ourselves, and compare the result.
-	*/
-	code = CHAP_FAILURE;
-	if (!get_secret(cstate->unit, rhostname, cstate->chal_name,
-	secret, &secret_len, 1)) {
-/*        CHAPDEBUG((LOG_WARNING, TL_CHAP, "No CHAP secret found for authenticating %s\n", rhostname)); */
-		CHAPDEBUG((LOG_WARNING, "No CHAP secret found for authenticating %s\n",
-		rhostname));
-	} else {
-	
-		/*  generate MD based on negotiated type */
-		switch (cstate->chal_type) { 
-		
-		case CHAP_DIGEST_MD5:		/* only MD5 is defined for now */
-			if (remmd_len != MD5_SIGNATURE_SIZE)
-				break;			/* it's not even the right length */
-			MD5Init(&mdContext);
-			MD5Update(&mdContext, &cstate->chal_id, 1);
-			MD5Update(&mdContext, (u_char*)secret, secret_len);
-			MD5Update(&mdContext, cstate->challenge, cstate->chal_len);
-			MD5Final(hash, &mdContext); 
-			
-			/* compare local and remote MDs and send the appropriate status */
-			if (memcmp (hash, remmd, MD5_SIGNATURE_SIZE) == 0)
-				code = CHAP_SUCCESS;	/* they are the same! */
-			break;
-		
-		default:
-			CHAPDEBUG((LOG_INFO, "unknown digest type %d\n", cstate->chal_type));
-		}
-	}
-	
-	BZERO(secret, sizeof(secret));
-	ChapSendStatus(cstate, code);
-	
-	if (code == CHAP_SUCCESS) {
-		old_state = cstate->serverstate;
-		cstate->serverstate = CHAPSS_OPEN;
-		if (old_state == CHAPSS_INITIAL_CHAL) {
-			auth_peer_success(cstate->unit, PPP_CHAP, rhostname, len);
-		}
-		if (cstate->chal_interval != 0)
-			TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval);
-	} else {
-		CHAPDEBUG((LOG_ERR, "CHAP peer authentication failed\n"));
-		cstate->serverstate = CHAPSS_BADAUTH;
-		auth_peer_fail(cstate->unit, PPP_CHAP);
-	}
-}
-
-/*
- * ChapReceiveSuccess - Receive Success
- */
-static void ChapReceiveSuccess(chap_state *cstate, u_char *inp, u_char id, int len)
-{
-
-	CHAPDEBUG((LOG_INFO, "ChapReceiveSuccess: Rcvd id %d.\n", id));
-	
-	if (cstate->clientstate == CHAPCS_OPEN)
-		/* presumably an answer to a duplicate response */
-		return;
-	
-	if (cstate->clientstate != CHAPCS_RESPONSE) {
-		/* don't know what this is */
-		CHAPDEBUG((LOG_INFO, "ChapReceiveSuccess: in state %d\n",
-			   cstate->clientstate));
-		return;
-	}
-	
-	UNTIMEOUT(ChapResponseTimeout, cstate);
-	
-	/*
-	 * Print message.
-	 */
-	if (len > 0)
-		PRINTMSG(inp, len);
-	
-	cstate->clientstate = CHAPCS_OPEN;
-	
-	auth_withpeer_success(cstate->unit, PPP_CHAP);
-}
-
-
-/*
- * ChapReceiveFailure - Receive failure.
- */
-static void ChapReceiveFailure(chap_state *cstate, u_char *inp, u_char id, int len)
-{
-	CHAPDEBUG((LOG_INFO, "ChapReceiveFailure: Rcvd id %d.\n", id));
-	
-	if (cstate->clientstate != CHAPCS_RESPONSE) {
-		/* don't know what this is */
-		CHAPDEBUG((LOG_INFO, "ChapReceiveFailure: in state %d\n",
-			   cstate->clientstate));
-		return;
-	}
-	
-	UNTIMEOUT(ChapResponseTimeout, cstate);
-	
-	/*
-	 * Print message.
-	 */
-	if (len > 0)
-		PRINTMSG(inp, len);
-	
-	CHAPDEBUG((LOG_ERR, "CHAP authentication failed\n"));
-	auth_withpeer_fail(cstate->unit, PPP_CHAP);
-}
-
-
-/*
- * ChapSendChallenge - Send an Authenticate challenge.
- */
-static void ChapSendChallenge(chap_state *cstate)
-{
-	u_char *outp;
-	int chal_len, name_len;
-	int outlen;
-	
-	chal_len = cstate->chal_len;
-	name_len = strlen(cstate->chal_name);
-	outlen = CHAP_HEADERLEN + sizeof (u_char) + chal_len + name_len;
-	outp = outpacket_buf[cstate->unit];
-	
-	MAKEHEADER(outp, PPP_CHAP);		/* paste in a CHAP header */
-	
-	PUTCHAR(CHAP_CHALLENGE, outp);
-	PUTCHAR(cstate->chal_id, outp);
-	PUTSHORT(outlen, outp);
-	
-	PUTCHAR(chal_len, outp);		/* put length of challenge */
-	BCOPY(cstate->challenge, outp, chal_len);
-	INCPTR(chal_len, outp);
-	
-	BCOPY(cstate->chal_name, outp, name_len);	/* append hostname */
-	
-	pppWrite(cstate->unit, outpacket_buf[cstate->unit], outlen + PPP_HDRLEN);
-	
-	CHAPDEBUG((LOG_INFO, "ChapSendChallenge: Sent id %d.\n", cstate->chal_id));
-	
-	TIMEOUT(ChapChallengeTimeout, cstate, cstate->timeouttime);
-	++cstate->chal_transmits;
-}
-
-
-/*
- * ChapSendStatus - Send a status response (ack or nak).
- */
-static void ChapSendStatus(chap_state *cstate, int code)
-{
-	u_char *outp;
-	int outlen, msglen;
-	char msg[256];
-	
-	if (code == CHAP_SUCCESS)
-		strcpy(msg, "Welcome!");
-	else
-		strcpy(msg, "I don't like you.  Go 'way.");
-	msglen = strlen(msg);
-	
-	outlen = CHAP_HEADERLEN + msglen;
-	outp = outpacket_buf[cstate->unit];
-	
-	MAKEHEADER(outp, PPP_CHAP);		/* paste in a header */
-	
-	PUTCHAR(code, outp);
-	PUTCHAR(cstate->chal_id, outp);
-	PUTSHORT(outlen, outp);
-	BCOPY(msg, outp, msglen);
-	pppWrite(cstate->unit, outpacket_buf[cstate->unit], outlen + PPP_HDRLEN);
-	
-	CHAPDEBUG((LOG_INFO, "ChapSendStatus: Sent code %d, id %d.\n", code,
-	       cstate->chal_id));
-}
-
-/*
- * ChapGenChallenge is used to generate a pseudo-random challenge string of
- * a pseudo-random length between min_len and max_len.  The challenge
- * string and its length are stored in *cstate, and various other fields of
- * *cstate are initialized.
- */
-
-static void ChapGenChallenge(chap_state *cstate)
-{
-	int chal_len;
-	u_char *ptr = cstate->challenge;
-	int i;
-	
-	/* pick a random challenge length between MIN_CHALLENGE_LENGTH and 
-	   MAX_CHALLENGE_LENGTH */  
-	chal_len = (unsigned)
-				((((magic() >> 16) *
-			        (MAX_CHALLENGE_LENGTH - MIN_CHALLENGE_LENGTH)) >> 16)
-			     + MIN_CHALLENGE_LENGTH);
-	cstate->chal_len = chal_len;
-	cstate->chal_id = ++cstate->id;
-	cstate->chal_transmits = 0;
-	
-	/* generate a random string */
-	for (i = 0; i < chal_len; i++ )
-		*ptr++ = (char) (magic() & 0xff);
-}
-
-/*
- * ChapSendResponse - send a response packet with values as specified
- * in *cstate.
- */
-/* ARGSUSED */
-static void ChapSendResponse(chap_state *cstate)
-{
-	u_char *outp;
-	int outlen, md_len, name_len;
-	
-	md_len = cstate->resp_length;
-	name_len = strlen(cstate->resp_name);
-	outlen = CHAP_HEADERLEN + sizeof (u_char) + md_len + name_len;
-	outp = outpacket_buf[cstate->unit];
-	
-	MAKEHEADER(outp, PPP_CHAP);
-	
-	PUTCHAR(CHAP_RESPONSE, outp);	/* we are a response */
-	PUTCHAR(cstate->resp_id, outp);	/* copy id from challenge packet */
-	PUTSHORT(outlen, outp);			/* packet length */
-	
-	PUTCHAR(md_len, outp);			/* length of MD */
-	BCOPY(cstate->response, outp, md_len);		/* copy MD to buffer */
-	INCPTR(md_len, outp);
-	
-	BCOPY(cstate->resp_name, outp, name_len);	/* append our name */
-	
-	/* send the packet */
-	pppWrite(cstate->unit, outpacket_buf[cstate->unit], outlen + PPP_HDRLEN);
-	
-	cstate->clientstate = CHAPCS_RESPONSE;
-	TIMEOUT(ChapResponseTimeout, cstate, cstate->timeouttime);
-	++cstate->resp_transmits;
-}
-
-/*
- * ChapPrintPkt - print the contents of a CHAP packet.
- */
-static int ChapPrintPkt(
-	u_char *p,
-	int plen,
-	void (*printer) (void *, char *, ...),
-	void *arg
-)
-{
-	int code, id, len;
-	int clen, nlen;
-	u_char x;
-	
-	if (plen < CHAP_HEADERLEN)
-		return 0;
-	GETCHAR(code, p);
-	GETCHAR(id, p);
-	GETSHORT(len, p);
-	if (len < CHAP_HEADERLEN || len > plen)
-		return 0;
-	
-	if (code >= 1 && code <= sizeof(ChapCodenames) / sizeof(char *))
-		printer(arg, " %s", ChapCodenames[code-1]);
-	else
-		printer(arg, " code=0x%x", code);
-	printer(arg, " id=0x%x", id);
-	len -= CHAP_HEADERLEN;
-	switch (code) {
-	case CHAP_CHALLENGE:
-	case CHAP_RESPONSE:
-		if (len < 1)
-			break;
-		clen = p[0];
-		if (len < clen + 1)
-			break;
-		++p;
-		nlen = len - clen - 1;
-		printer(arg, " <");
-		for (; clen > 0; --clen) {
-			GETCHAR(x, p);
-			printer(arg, "%.2x", x);
-		}
-		printer(arg, ">, name = %.*Z", nlen, p);
-		break;
-	case CHAP_FAILURE:
-	case CHAP_SUCCESS:
-		printer(arg, " %.*Z", len, p);
-		break;
-	default:
-		for (clen = len; clen > 0; --clen) {
-			GETCHAR(x, p);
-			printer(arg, " %.2x", x);
-		}
-	}
-	
-	return len + CHAP_HEADERLEN;
-}
-
-#endif
-
-#endif /* PPP_SUPPORT */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.h
deleted file mode 100644
index 06d1b15..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/chap.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*****************************************************************************
-* chap.h - Network Challenge Handshake Authentication Protocol header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1998 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-03 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original built from BSD network code.
-******************************************************************************/
-/*
- * chap.h - Challenge Handshake Authentication Protocol definitions.
- *
- * Copyright (c) 1993 The Australian National University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the Australian National University.  The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Copyright (c) 1991 Gregory M. Christy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the author.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id: chap.h $
- */
-
-#ifndef CHAP_H
-#define CHAP_H
-
-/*************************
-*** PUBLIC DEFINITIONS ***
-*************************/
-
-/* Code + ID + length */
-#define CHAP_HEADERLEN		4
-
-/*
- * CHAP codes.
- */
-
-#define CHAP_DIGEST_MD5		5	/* use MD5 algorithm */
-#define MD5_SIGNATURE_SIZE	16	/* 16 bytes in a MD5 message digest */
-#define CHAP_MICROSOFT		0x80	/* use Microsoft-compatible alg. */
-#define MS_CHAP_RESPONSE_LEN	49	/* Response length for MS-CHAP */
-
-#define CHAP_CHALLENGE		1
-#define CHAP_RESPONSE		2
-#define CHAP_SUCCESS		3
-#define CHAP_FAILURE    	4
-
-/*
- *  Challenge lengths (for challenges we send) and other limits.
- */
-#define MIN_CHALLENGE_LENGTH	32
-#define MAX_CHALLENGE_LENGTH	64
-#define MAX_RESPONSE_LENGTH	64	/* sufficient for MD5 or MS-CHAP */
-
-/*
- * Client (peer) states.
- */
-#define CHAPCS_INITIAL		0	/* Lower layer down, not opened */
-#define CHAPCS_CLOSED		1	/* Lower layer up, not opened */
-#define CHAPCS_PENDING		2	/* Auth us to peer when lower up */
-#define CHAPCS_LISTEN		3	/* Listening for a challenge */
-#define CHAPCS_RESPONSE		4	/* Sent response, waiting for status */
-#define CHAPCS_OPEN		5	/* We've received Success */
-
-/*
- * Server (authenticator) states.
- */
-#define CHAPSS_INITIAL		0	/* Lower layer down, not opened */
-#define CHAPSS_CLOSED		1	/* Lower layer up, not opened */
-#define CHAPSS_PENDING		2	/* Auth peer when lower up */
-#define CHAPSS_INITIAL_CHAL	3	/* We've sent the first challenge */
-#define CHAPSS_OPEN		4	/* We've sent a Success msg */
-#define CHAPSS_RECHALLENGE	5	/* We've sent another challenge */
-#define CHAPSS_BADAUTH		6	/* We've sent a Failure msg */
-
-/************************
-*** PUBLIC DATA TYPES ***
-************************/
-
-/*
- * Each interface is described by a chap structure.
- */
-
-typedef struct chap_state {
-    int unit;			/* Interface unit number */
-    int clientstate;		/* Client state */
-    int serverstate;		/* Server state */
-    u_char challenge[MAX_CHALLENGE_LENGTH]; /* last challenge string sent */
-    u_char chal_len;		/* challenge length */
-    u_char chal_id;		/* ID of last challenge */
-    u_char chal_type;		/* hash algorithm for challenges */
-    u_char id;			/* Current id */
-    char *chal_name;		/* Our name to use with challenge */
-    int chal_interval;		/* Time until we challenge peer again */
-    int timeouttime;		/* Timeout time in seconds */
-    int max_transmits;		/* Maximum # of challenge transmissions */
-    int chal_transmits;		/* Number of transmissions of challenge */
-    int resp_transmits;		/* Number of transmissions of response */
-    u_char response[MAX_RESPONSE_LENGTH];	/* Response to send */
-    u_char resp_length;		/* length of response */
-    u_char resp_id;		/* ID for response messages */
-    u_char resp_type;		/* hash algorithm for responses */
-    char *resp_name;		/* Our name to send with response */
-} chap_state;
-
-
-/******************
-*** PUBLIC DATA ***
-******************/
-extern chap_state chap[];
-
-extern struct protent chap_protent;
-
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-
-void ChapAuthWithPeer (int, char *, int);
-void ChapAuthPeer (int, char *, int);
-
-#endif /* CHAP_H */
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.c
deleted file mode 100644
index 01755ba..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*** WARNING - THIS CODE HAS NOT BEEN FINISHED! ***/
-/*****************************************************************************
-* chpms.c - Network MicroSoft Challenge Handshake Authentication Protocol program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* Copyright (c) 1997 by Global Election Systems Inc.  All rights reserved.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-08 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original based on BSD chap_ms.c.
-*****************************************************************************/
-/*
- * chap_ms.c - Microsoft MS-CHAP compatible implementation.
- *
- * Copyright (c) 1995 Eric Rosenquist, Strata Software Limited.
- * http://www.strataware.com/
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Eric Rosenquist.  The name of the author may not be used to
- * endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/*
- * Modifications by Lauri Pesonen / lpesonen at clinet.fi, april 1997
- *
- *   Implemented LANManager type password response to MS-CHAP challenges.
- *   Now pppd provides both NT style and LANMan style blocks, and the
- *   prefered is set by option "ms-lanman". Default is to use NT.
- *   The hash text (StdText) was taken from Win95 RASAPI32.DLL.
- *
- *   You should also use DOMAIN\\USERNAME as described in README.MSCHAP80
- */
-
-#define USE_CRYPT
-
-
-#include "ppp.h"
-
-#if MSCHAP_SUPPORT > 0
-
-#include "md4.h"
-#ifndef USE_CRYPT
-#include "des.h"
-#endif
-#include "chap.h"
-#include "chpms.h"
-#include "pppdebug.h"
-
-
-/*************************/
-/*** LOCAL DEFINITIONS ***/
-/*************************/
-
-
-/************************/
-/*** LOCAL DATA TYPES ***/
-/************************/
-typedef struct {
-    u_char LANManResp[24];
-    u_char NTResp[24];
-    u_char UseNT;		/* If 1, ignore the LANMan response field */
-} MS_ChapResponse;
-/* We use MS_CHAP_RESPONSE_LEN, rather than sizeof(MS_ChapResponse),
-   in case this struct gets padded. */
-
-
-
-/***********************************/
-/*** LOCAL FUNCTION DECLARATIONS ***/
-/***********************************/
-
-/* XXX Don't know what to do with these. */
-extern void setkey(const char *);
-extern void encrypt(char *, int);
-
-static void	DesEncrypt (u_char *, u_char *, u_char *);
-static void	MakeKey (u_char *, u_char *);
-
-#ifdef USE_CRYPT
-static void	Expand (u_char *, u_char *);
-static void	Collapse (u_char *, u_char *);
-#endif
-
-static void ChallengeResponse(
-	u_char *challenge,	/* IN   8 octets */
-	u_char *pwHash,		/* IN  16 octets */
-	u_char *response	/* OUT 24 octets */
-);
-static void ChapMS_NT(
-	char *rchallenge,
-	int rchallenge_len,
-	char *secret,
-	int secret_len,
-	MS_ChapResponse *response
-);
-static u_char Get7Bits(
-	u_char *input,
-	int startBit
-);
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-void ChapMS(
-	chap_state *cstate,
-	char *rchallenge,
-	int rchallenge_len,
-	char *secret,
-	int secret_len
-)
-{
-	MS_ChapResponse	response;
-#ifdef MSLANMAN
-	extern int ms_lanman;
-#endif
-	
-#if 0
-	CHAPDEBUG((LOG_INFO, "ChapMS: secret is '%.*s'\n", secret_len, secret));
-#endif
-	BZERO(&response, sizeof(response));
-	
-	/* Calculate both always */
-	ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, &response);
-	
-#ifdef MSLANMAN
-	ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, &response);
-	
-	/* prefered method is set by option  */
-	response.UseNT = !ms_lanman;
-#else
-	response.UseNT = 1;
-#endif
-	
-	BCOPY(&response, cstate->response, MS_CHAP_RESPONSE_LEN);
-	cstate->resp_length = MS_CHAP_RESPONSE_LEN;
-}
-
-
-/**********************************/
-/*** LOCAL FUNCTION DEFINITIONS ***/
-/**********************************/
-static void ChallengeResponse(
-	u_char *challenge,	/* IN   8 octets */
-	u_char *pwHash,		/* IN  16 octets */
-	u_char *response	/* OUT 24 octets */
-)
-{
-	char    ZPasswordHash[21];
-	
-	BZERO(ZPasswordHash, sizeof(ZPasswordHash));
-	BCOPY(pwHash, ZPasswordHash, 16);
-	
-#if 0
-	log_packet(ZPasswordHash, sizeof(ZPasswordHash), "ChallengeResponse - ZPasswordHash", LOG_DEBUG);
-#endif
-	
-	DesEncrypt(challenge, ZPasswordHash +  0, response + 0);
-	DesEncrypt(challenge, ZPasswordHash +  7, response + 8);
-	DesEncrypt(challenge, ZPasswordHash + 14, response + 16);
-	
-#if 0
-	log_packet(response, 24, "ChallengeResponse - response", LOG_DEBUG);
-#endif
-}
-
-
-#ifdef USE_CRYPT
-static void DesEncrypt(
-	u_char *clear,	/* IN  8 octets */
-	u_char *key,	/* IN  7 octets */
-	u_char *cipher	/* OUT 8 octets */
-)
-{
-	u_char des_key[8];
-	u_char crypt_key[66];
-	u_char des_input[66];
-	
-	MakeKey(key, des_key);
-	
-	Expand(des_key, crypt_key);
-	setkey(crypt_key);
-	
-#if 0
-	CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X\n",
-	       clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7]));
-#endif
-	
-	Expand(clear, des_input);
-	encrypt(des_input, 0);
-	Collapse(des_input, cipher);
-	
-#if 0
-	CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X\n",
-	       cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7]));
-#endif
-}
-
-#else /* USE_CRYPT */
-
-static void DesEncrypt(
-	u_char *clear,	/* IN  8 octets */
-	u_char *key,	/* IN  7 octets */
-	u_char *cipher	/* OUT 8 octets */
-)
-{
-	des_cblock		des_key;
-	des_key_schedule	key_schedule;
-	
-	MakeKey(key, des_key);
-	
-	des_set_key(&des_key, key_schedule);
-	
-#if 0
-	CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X\n",
-	       clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7]));
-#endif
-	
-	des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1);
-	
-#if 0
-	CHAPDEBUG((LOG_INFO, "DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X\n",
-	       cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7]));
-#endif
-}
-
-#endif /* USE_CRYPT */
-
-
-static u_char Get7Bits(
-	u_char *input,
-	int startBit
-)
-{
-	register unsigned int	word;
-	
-	word  = (unsigned)input[startBit / 8] << 8;
-	word |= (unsigned)input[startBit / 8 + 1];
-	
-	word >>= 15 - (startBit % 8 + 7);
-	
-	return word & 0xFE;
-}
-
-#ifdef USE_CRYPT
-
-/* in == 8-byte string (expanded version of the 56-bit key)
- * out == 64-byte string where each byte is either 1 or 0
- * Note that the low-order "bit" is always ignored by by setkey()
- */
-static void Expand(u_char *in, u_char *out)
-{
-	int j, c;
-	int i;
-	
-	for(i = 0; i < 64; in++){
-		c = *in;
-		for(j = 7; j >= 0; j--)
-			*out++ = (c >> j) & 01;
-		i += 8;
-	}
-}
-
-/* The inverse of Expand
- */
-static void Collapse(u_char *in, u_char *out)
-{
-	int j;
-	int i;
-	unsigned int c;
-	
-	for (i = 0; i < 64; i += 8, out++) {
-		c = 0;
-		for (j = 7; j >= 0; j--, in++)
-			c |= *in << j;
-		*out = c & 0xff;
-	}
-}
-#endif
-
-static void MakeKey(
-	u_char *key,		/* IN  56 bit DES key missing parity bits */
-	u_char *des_key		/* OUT 64 bit DES key with parity bits added */
-)
-{
-	des_key[0] = Get7Bits(key,  0);
-	des_key[1] = Get7Bits(key,  7);
-	des_key[2] = Get7Bits(key, 14);
-	des_key[3] = Get7Bits(key, 21);
-	des_key[4] = Get7Bits(key, 28);
-	des_key[5] = Get7Bits(key, 35);
-	des_key[6] = Get7Bits(key, 42);
-	des_key[7] = Get7Bits(key, 49);
-	
-#ifndef USE_CRYPT
-	des_set_odd_parity((des_cblock *)des_key);
-#endif
-	
-#if 0
-	CHAPDEBUG((LOG_INFO, "MakeKey: 56-bit input : %02X%02X%02X%02X%02X%02X%02X\n",
-	       key[0], key[1], key[2], key[3], key[4], key[5], key[6]));
-	CHAPDEBUG((LOG_INFO, "MakeKey: 64-bit output: %02X%02X%02X%02X%02X%02X%02X%02X\n",
-	       des_key[0], des_key[1], des_key[2], des_key[3], des_key[4], des_key[5], des_key[6], des_key[7]));
-#endif
-}
-
-static void ChapMS_NT(
-	char *rchallenge,
-	int rchallenge_len,
-	char *secret,
-	int secret_len,
-	MS_ChapResponse *response
-)
-{
-	int			i;
-	MDstruct	md4Context;
-	u_char		unicodePassword[MAX_NT_PASSWORD * 2];
-	static int	low_byte_first = -1;
-	
-	/* Initialize the Unicode version of the secret (== password). */
-	/* This implicitly supports 8-bit ISO8859/1 characters. */
-	BZERO(unicodePassword, sizeof(unicodePassword));
-	for (i = 0; i < secret_len; i++)
-		unicodePassword[i * 2] = (u_char)secret[i];
-	
-	MDbegin(&md4Context);
-	MDupdate(&md4Context, unicodePassword, secret_len * 2 * 8);	/* Unicode is 2 bytes/char, *8 for bit count */
-	
-	if (low_byte_first == -1)
-		low_byte_first = (htons((unsigned short int)1) != 1);
-	if (low_byte_first == 0)
-		MDreverse((u_long *)&md4Context);  /*  sfb 961105 */
-	
-	MDupdate(&md4Context, NULL, 0);	/* Tell MD4 we're done */
-	
-	ChallengeResponse(rchallenge, (char *)md4Context.buffer, response->NTResp);
-}
-
-#ifdef MSLANMAN
-static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
-
-static ChapMS_LANMan(
-	char *rchallenge,
-	int rchallenge_len,
-	char *secret,
-	int secret_len,
-	MS_ChapResponse	*response
-)
-{
-	int			i;
-	u_char		UcasePassword[MAX_NT_PASSWORD]; /* max is actually 14 */
-	u_char		PasswordHash[16];
-	
-	/* LANMan password is case insensitive */
-	BZERO(UcasePassword, sizeof(UcasePassword));
-	for (i = 0; i < secret_len; i++)
-		UcasePassword[i] = (u_char)toupper(secret[i]);
-	DesEncrypt( StdText, UcasePassword + 0, PasswordHash + 0 );
-	DesEncrypt( StdText, UcasePassword + 7, PasswordHash + 8 );
-	ChallengeResponse(rchallenge, PasswordHash, response->LANManResp);
-}
-#endif
-
-#endif /* MSCHAP_SUPPORT */
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.h
deleted file mode 100644
index cfb2047..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/chpms.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
-* chpms.h - Network Microsoft Challenge Handshake Protocol header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1998 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 98-01-30 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original built from BSD network code.
-******************************************************************************/
-/*
- * chap.h - Challenge Handshake Authentication Protocol definitions.
- *
- * Copyright (c) 1995 Eric Rosenquist, Strata Software Limited.
- * http://www.strataware.com/
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Eric Rosenquist.  The name of the author may not be used to
- * endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id: chpms.h $
- */
-
-#ifndef CHPMS_H
-#define CHPMS_H
-
-#define MAX_NT_PASSWORD	256	/* Maximum number of (Unicode) chars in an NT password */
-
-void ChapMS (chap_state *, char *, int, char *, int);
-
-#endif /* CHPMS_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.c
deleted file mode 100644
index fe8b38a..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.c
+++ /dev/null
@@ -1,838 +0,0 @@
-/*****************************************************************************
-* fsm.c - Network Control Protocol Finite State Machine program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 by Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-01 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original based on BSD fsm.c.
-*****************************************************************************/
-/*
- * fsm.c - {Link, IP} Control Protocol Finite State Machine.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-
-/*
- * TODO:
- * Randomize fsm id on link/init.
- * Deal with variable outgoing MTU.
- */
-
-#include "ppp.h"
-#if PPP_SUPPORT > 0
-#include "fsm.h"
-#include "pppdebug.h"
-
-
-/*************************/
-/*** LOCAL DEFINITIONS ***/
-/*************************/
-
-
-/************************/
-/*** LOCAL DATA TYPES ***/
-/************************/
-
-
-/***********************************/
-/*** LOCAL FUNCTION DECLARATIONS ***/
-/***********************************/
-static void fsm_timeout (void *);
-static void fsm_rconfreq (fsm *, u_char, u_char *, int);
-static void fsm_rconfack (fsm *, int, u_char *, int);
-static void fsm_rconfnakrej (fsm *, int, int, u_char *, int);
-static void fsm_rtermreq (fsm *, int, u_char *, int);
-static void fsm_rtermack (fsm *);
-static void fsm_rcoderej (fsm *, u_char *, int);
-static void fsm_sconfreq (fsm *, int);
-
-#define PROTO_NAME(f)	((f)->callbacks->proto_name)
-
-
-/******************************/
-/*** PUBLIC DATA STRUCTURES ***/
-/******************************/
-
-
-/*****************************/
-/*** LOCAL DATA STRUCTURES ***/
-/*****************************/
-int peer_mru[NUM_PPP];
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-
-/*
- * fsm_init - Initialize fsm.
- *
- * Initialize fsm state.
- */
-void fsm_init(fsm *f)
-{
-	f->state = INITIAL;
-	f->flags = 0;
-	f->id = 0;				/* XXX Start with random id? */
-	f->timeouttime = FSM_DEFTIMEOUT;
-	f->maxconfreqtransmits = FSM_DEFMAXCONFREQS;
-	f->maxtermtransmits = FSM_DEFMAXTERMREQS;
-	f->maxnakloops = FSM_DEFMAXNAKLOOPS;
-	f->term_reason_len = 0;
-}
-
-
-/*
- * fsm_lowerup - The lower layer is up.
- */
-void fsm_lowerup(fsm *f)
-{
-	int oldState = f->state;
-
-	switch( f->state ){
-	case INITIAL:
-		f->state = CLOSED;
-		break;
-	
-	case STARTING:
-		if( f->flags & OPT_SILENT )
-			f->state = STOPPED;
-		else {
-			/* Send an initial configure-request */
-			fsm_sconfreq(f, 0);
-			f->state = REQSENT;
-		}
-	break;
-	
-	default:
-		FSMDEBUG((LOG_INFO, "%s: Up event in state %d!\n",
-				PROTO_NAME(f), f->state));
-	}
-	
-	FSMDEBUG((LOG_INFO, "%s: lowerup state %d -> %d\n",
-			PROTO_NAME(f), oldState, f->state));
-}
-
-
-/*
- * fsm_lowerdown - The lower layer is down.
- *
- * Cancel all timeouts and inform upper layers.
- */
-void fsm_lowerdown(fsm *f)
-{
-	int oldState = f->state;
-	
-	switch( f->state ){
-	case CLOSED:
-		f->state = INITIAL;
-		break;
-	
-	case STOPPED:
-		f->state = STARTING;
-		if( f->callbacks->starting )
-			(*f->callbacks->starting)(f);
-		break;
-	
-	case CLOSING:
-		f->state = INITIAL;
-		UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		break;
-	
-	case STOPPING:
-	case REQSENT:
-	case ACKRCVD:
-	case ACKSENT:
-		f->state = STARTING;
-		UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		break;
-	
-	case OPENED:
-		if( f->callbacks->down )
-			(*f->callbacks->down)(f);
-		f->state = STARTING;
-		break;
-	
-	default:
-		FSMDEBUG((LOG_INFO, "%s: Down event in state %d!\n",
-				PROTO_NAME(f), f->state));
-	}
-	
-	FSMDEBUG((LOG_INFO, "%s: lowerdown state %d -> %d\n",
-			PROTO_NAME(f), oldState, f->state));
-}
-
-
-/*
- * fsm_open - Link is allowed to come up.
- */
-void fsm_open(fsm *f)
-{
-	int oldState = f->state;
-	
-	switch( f->state ){
-		case INITIAL:
-			f->state = STARTING;
-			if( f->callbacks->starting )
-				(*f->callbacks->starting)(f);
-			break;
-		
-		case CLOSED:
-		if( f->flags & OPT_SILENT )
-			f->state = STOPPED;
-		else {
-			/* Send an initial configure-request */
-			fsm_sconfreq(f, 0);
-			f->state = REQSENT;
-		}
-		break;
-	
-	case CLOSING:
-		f->state = STOPPING;
-		/* fall through */
-	case STOPPED:
-	case OPENED:
-		if( f->flags & OPT_RESTART ){
-			fsm_lowerdown(f);
-			fsm_lowerup(f);
-		}
-		break;
-	}
-	
-	FSMDEBUG((LOG_INFO, "%s: open state %d -> %d\n",
-			PROTO_NAME(f), oldState, f->state));
-}
-
-
-/*
- * fsm_close - Start closing connection.
- *
- * Cancel timeouts and either initiate close or possibly go directly to
- * the CLOSED state.
- */
-void fsm_close(fsm *f, char *reason)
-{
-	int oldState = f->state;
-	
-	f->term_reason = reason;
-	f->term_reason_len = (reason == NULL? 0: strlen(reason));
-	switch( f->state ){
-	case STARTING:
-		f->state = INITIAL;
-		break;
-	case STOPPED:
-		f->state = CLOSED;
-		break;
-	case STOPPING:
-		f->state = CLOSING;
-		break;
-	
-	case REQSENT:
-	case ACKRCVD:
-	case ACKSENT:
-	case OPENED:
-		if( f->state != OPENED )
-			UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		else if( f->callbacks->down )
-			(*f->callbacks->down)(f);	/* Inform upper layers we're down */
-		
-		/* Init restart counter, send Terminate-Request */
-		f->retransmits = f->maxtermtransmits;
-		fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
-					(u_char *) f->term_reason, f->term_reason_len);
-		TIMEOUT(fsm_timeout, f, f->timeouttime);
-		--f->retransmits;
-		
-		f->state = CLOSING;
-		break;
-	}
-	
-	FSMDEBUG((LOG_INFO, "%s: close reason=%s state %d -> %d\n",
-			PROTO_NAME(f), reason, oldState, f->state));
-}
-
-
-/*
- * fsm_sdata - Send some data.
- *
- * Used for all packets sent to our peer by this module.
- */
-void fsm_sdata(
-	fsm *f,
-	u_char code, 
-	u_char id,
-	u_char *data,
-	int datalen
-)
-{
-	u_char *outp;
-	int outlen;
-	
-	/* Adjust length to be smaller than MTU */
-	outp = outpacket_buf[f->unit];
-	if (datalen > peer_mru[f->unit] - (int)HEADERLEN)
-		datalen = peer_mru[f->unit] - HEADERLEN;
-	if (datalen && data != outp + PPP_HDRLEN + HEADERLEN)
-		BCOPY(data, outp + PPP_HDRLEN + HEADERLEN, datalen);
-	outlen = datalen + HEADERLEN;
-	MAKEHEADER(outp, f->protocol);
-	PUTCHAR(code, outp);
-	PUTCHAR(id, outp);
-	PUTSHORT(outlen, outp);
-	pppWrite(f->unit, outpacket_buf[f->unit], outlen + PPP_HDRLEN);
-	FSMDEBUG((LOG_INFO, "fsm_sdata(%s): Sent code %d,%d,%d.\n",
-				PROTO_NAME(f), code, id, outlen));
-}
-
-
-/*
- * fsm_input - Input packet.
- */
-void fsm_input(fsm *f, u_char *inpacket, int l)
-{
-	u_char *inp = inpacket;
-	u_char code, id;
-	int len;
-	
-	/*
-	* Parse header (code, id and length).
-	* If packet too short, drop it.
-	*/
-	if (l < HEADERLEN) {
-		FSMDEBUG((LOG_WARNING, "fsm_input(%x): Rcvd short header.\n",
-					f->protocol));
-		return;
-	}
-	GETCHAR(code, inp);
-	GETCHAR(id, inp);
-	GETSHORT(len, inp);
-	if (len < HEADERLEN) {
-		FSMDEBUG((LOG_INFO, "fsm_input(%x): Rcvd illegal length.\n",
-				f->protocol));
-		return;
-	}
-	if (len > l) {
-		FSMDEBUG((LOG_INFO, "fsm_input(%x): Rcvd short packet.\n",
-				f->protocol));
-		return;
-	}
-	len -= HEADERLEN;		/* subtract header length */
-	
-	if( f->state == INITIAL || f->state == STARTING ){
-		FSMDEBUG((LOG_INFO, "fsm_input(%x): Rcvd packet in state %d.\n",
-				f->protocol, f->state));
-		return;
-	}
-	FSMDEBUG((LOG_INFO, "fsm_input(%s):%d,%d,%d\n", PROTO_NAME(f), code, id, l));
-	/*
-	 * Action depends on code.
-	 */
-	switch (code) {
-	case CONFREQ:
-		fsm_rconfreq(f, id, inp, len);
-		break;
-	
-	case CONFACK:
-		fsm_rconfack(f, id, inp, len);
-		break;
-	
-	case CONFNAK:
-	case CONFREJ:
-		fsm_rconfnakrej(f, code, id, inp, len);
-		break;
-	
-	case TERMREQ:
-		fsm_rtermreq(f, id, inp, len);
-		break;
-	
-	case TERMACK:
-		fsm_rtermack(f);
-		break;
-	
-	case CODEREJ:
-		fsm_rcoderej(f, inp, len);
-		break;
-	
-	default:
-		if( !f->callbacks->extcode
-				|| !(*f->callbacks->extcode)(f, code, id, inp, len) )
-			fsm_sdata(f, CODEREJ, ++f->id, inpacket, len + HEADERLEN);
-		break;
-	}
-}
-
-
-/*
- * fsm_protreject - Peer doesn't speak this protocol.
- *
- * Treat this as a catastrophic error (RXJ-).
- */
-void fsm_protreject(fsm *f)
-{
-	switch( f->state ){
-	case CLOSING:
-		UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		/* fall through */
-	case CLOSED:
-		f->state = CLOSED;
-		if( f->callbacks->finished )
-			(*f->callbacks->finished)(f);
-		break;
-	
-	case STOPPING:
-	case REQSENT:
-	case ACKRCVD:
-	case ACKSENT:
-		UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		/* fall through */
-	case STOPPED:
-		f->state = STOPPED;
-		if( f->callbacks->finished )
-			(*f->callbacks->finished)(f);
-		break;
-	
-	case OPENED:
-		if( f->callbacks->down )
-			(*f->callbacks->down)(f);
-		
-		/* Init restart counter, send Terminate-Request */
-		f->retransmits = f->maxtermtransmits;
-		fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
-					(u_char *) f->term_reason, f->term_reason_len);
-		TIMEOUT(fsm_timeout, f, f->timeouttime);
-		--f->retransmits;
-		
-		f->state = STOPPING;
-		break;
-	
-	default:
-		FSMDEBUG((LOG_INFO, "%s: Protocol-reject event in state %d!\n",
-					PROTO_NAME(f), f->state));
-	}
-}
-
-
-
-
-
-/**********************************/
-/*** LOCAL FUNCTION DEFINITIONS ***/
-/**********************************/
-
-/*
- * fsm_timeout - Timeout expired.
- */
-static void fsm_timeout(void *arg)
-{
-    fsm *f = (fsm *) arg;
-
-    switch (f->state) {
-    case CLOSING:
-    case STOPPING:
-		if( f->retransmits <= 0 ){
-		    FSMDEBUG((LOG_WARNING, "%s: timeout sending Terminate-Request state=%d\n",
-					   PROTO_NAME(f), f->state));
-		    /*
-		     * We've waited for an ack long enough.  Peer probably heard us.
-		     */
-		    f->state = (f->state == CLOSING)? CLOSED: STOPPED;
-		    if( f->callbacks->finished )
-			(*f->callbacks->finished)(f);
-		} else {
-		    FSMDEBUG((LOG_WARNING, "%s: timeout resending Terminate-Requests state=%d\n",
-					   PROTO_NAME(f), f->state));
-		    /* Send Terminate-Request */
-		    fsm_sdata(f, TERMREQ, f->reqid = ++f->id,
-			      (u_char *) f->term_reason, f->term_reason_len);
-		    TIMEOUT(fsm_timeout, f, f->timeouttime);
-		    --f->retransmits;
-		}
-		break;
-
-    case REQSENT:
-    case ACKRCVD:
-    case ACKSENT:
-		if (f->retransmits <= 0) {
-		    FSMDEBUG((LOG_WARNING, "%s: timeout sending Config-Requests state=%d\n",
-			   PROTO_NAME(f), f->state));
-		    f->state = STOPPED;
-		    if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished )
-				(*f->callbacks->finished)(f);
-	
-		} else {
-		    FSMDEBUG((LOG_WARNING, "%s: timeout resending Config-Request state=%d\n",
-			   PROTO_NAME(f), f->state));
-		    /* Retransmit the configure-request */
-		    if (f->callbacks->retransmit)
-				(*f->callbacks->retransmit)(f);
-		    fsm_sconfreq(f, 1);		/* Re-send Configure-Request */
-		    if( f->state == ACKRCVD )
-				f->state = REQSENT;
-		}
-		break;
-
-    default:
-		FSMDEBUG((LOG_INFO, "%s: Timeout event in state %d!\n",
-				  PROTO_NAME(f), f->state));
-	    }
-}
-
-
-/*
- * fsm_rconfreq - Receive Configure-Request.
- */
-static void fsm_rconfreq(fsm *f, u_char id, u_char *inp, int len)
-{
-	int code, reject_if_disagree;
-	
-	FSMDEBUG((LOG_INFO, "fsm_rconfreq(%s): Rcvd id %d state=%d\n", 
-				PROTO_NAME(f), id, f->state));
-	switch( f->state ){
-	case CLOSED:
-		/* Go away, we're closed */
-		fsm_sdata(f, TERMACK, id, NULL, 0);
-		return;
-	case CLOSING:
-	case STOPPING:
-		return;
-	
-	case OPENED:
-		/* Go down and restart negotiation */
-		if( f->callbacks->down )
-			(*f->callbacks->down)(f);	/* Inform upper layers */
-		fsm_sconfreq(f, 0);		/* Send initial Configure-Request */
-		break;
-	
-	case STOPPED:
-		/* Negotiation started by our peer */
-		fsm_sconfreq(f, 0);		/* Send initial Configure-Request */
-		f->state = REQSENT;
-		break;
-	}
-	
-	/*
-	* Pass the requested configuration options
-	* to protocol-specific code for checking.
-	*/
-	if (f->callbacks->reqci){		/* Check CI */
-		reject_if_disagree = (f->nakloops >= f->maxnakloops);
-		code = (*f->callbacks->reqci)(f, inp, &len, reject_if_disagree);
-	} 
-	else if (len)
-		code = CONFREJ;			/* Reject all CI */
-	else
-		code = CONFACK;
-	
-	/* send the Ack, Nak or Rej to the peer */
-	fsm_sdata(f, (u_char)code, id, inp, len);
-	
-	if (code == CONFACK) {
-		if (f->state == ACKRCVD) {
-			UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-			f->state = OPENED;
-			if (f->callbacks->up)
-				(*f->callbacks->up)(f);	/* Inform upper layers */
-		} 
-		else
-			f->state = ACKSENT;
-		f->nakloops = 0;
-	} 
-	else {
-		/* we sent CONFACK or CONFREJ */
-		if (f->state != ACKRCVD)
-			f->state = REQSENT;
-		if( code == CONFNAK )
-			++f->nakloops;
-	}
-}
-
-
-/*
- * fsm_rconfack - Receive Configure-Ack.
- */
-static void fsm_rconfack(fsm *f, int id, u_char *inp, int len)
-{
-	FSMDEBUG((LOG_INFO, "fsm_rconfack(%s): Rcvd id %d state=%d\n",
-				PROTO_NAME(f), id, f->state));
-	
-	if (id != f->reqid || f->seen_ack)		/* Expected id? */
-		return;					/* Nope, toss... */
-	if( !(f->callbacks->ackci? (*f->callbacks->ackci)(f, inp, len):
-								(len == 0)) ){
-		/* Ack is bad - ignore it */
-		FSMDEBUG((LOG_INFO, "%s: received bad Ack (length %d)\n",
-					PROTO_NAME(f), len));
-		return;
-	}
-	f->seen_ack = 1;
-	
-	switch (f->state) {
-	case CLOSED:
-	case STOPPED:
-		fsm_sdata(f, TERMACK, (u_char)id, NULL, 0);
-		break;
-	
-	case REQSENT:
-		f->state = ACKRCVD;
-		f->retransmits = f->maxconfreqtransmits;
-		break;
-	
-	case ACKRCVD:
-		/* Huh? an extra valid Ack? oh well... */
-		UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		fsm_sconfreq(f, 0);
-		f->state = REQSENT;
-		break;
-	
-	case ACKSENT:
-		UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		f->state = OPENED;
-		f->retransmits = f->maxconfreqtransmits;
-		if (f->callbacks->up)
-			(*f->callbacks->up)(f);	/* Inform upper layers */
-		break;
-	
-	case OPENED:
-		/* Go down and restart negotiation */
-		if (f->callbacks->down)
-			(*f->callbacks->down)(f);	/* Inform upper layers */
-		fsm_sconfreq(f, 0);		/* Send initial Configure-Request */
-		f->state = REQSENT;
-		break;
-	}
-}
-
-
-/*
- * fsm_rconfnakrej - Receive Configure-Nak or Configure-Reject.
- */
-static void fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len)
-{
-	int (*proc) (fsm *, u_char *, int);
-	int ret;
-	
-	FSMDEBUG((LOG_INFO, "fsm_rconfnakrej(%s): Rcvd id %d state=%d\n",
-				PROTO_NAME(f), id, f->state));
-	
-	if (id != f->reqid || f->seen_ack)	/* Expected id? */
-		return;				/* Nope, toss... */
-	proc = (code == CONFNAK)? f->callbacks->nakci: f->callbacks->rejci;
-	if (!proc || !(ret = proc(f, inp, len))) {
-		/* Nak/reject is bad - ignore it */
-		FSMDEBUG((LOG_INFO, "%s: received bad %s (length %d)\n",
-					PROTO_NAME(f), (code==CONFNAK? "Nak": "reject"), len));
-		return;
-	}
-	f->seen_ack = 1;
-	
-	switch (f->state) {
-	case CLOSED:
-	case STOPPED:
-		fsm_sdata(f, TERMACK, (u_char)id, NULL, 0);
-		break;
-	
-	case REQSENT:
-	case ACKSENT:
-		/* They didn't agree to what we wanted - try another request */
-		UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		if (ret < 0)
-			f->state = STOPPED;		/* kludge for stopping CCP */
-		else
-			fsm_sconfreq(f, 0);		/* Send Configure-Request */
-		break;
-	
-	case ACKRCVD:
-		/* Got a Nak/reject when we had already had an Ack?? oh well... */
-		UNTIMEOUT(fsm_timeout, f);	/* Cancel timeout */
-		fsm_sconfreq(f, 0);
-		f->state = REQSENT;
-		break;
-	
-	case OPENED:
-		/* Go down and restart negotiation */
-		if (f->callbacks->down)
-			(*f->callbacks->down)(f);	/* Inform upper layers */
-		fsm_sconfreq(f, 0);		/* Send initial Configure-Request */
-		f->state = REQSENT;
-		break;
-	}
-}
-
-
-/*
- * fsm_rtermreq - Receive Terminate-Req.
- */
-static void fsm_rtermreq(fsm *f, int id, u_char *p, int len)
-{
-	FSMDEBUG((LOG_INFO, "fsm_rtermreq(%s): Rcvd id %d state=%d\n",
-				PROTO_NAME(f), id, f->state));
-	
-	switch (f->state) {
-	case ACKRCVD:
-	case ACKSENT:
-		f->state = REQSENT;		/* Start over but keep trying */
-		break;
-	
-	case OPENED:
-		if (len > 0) {
-			FSMDEBUG((LOG_INFO, "%s terminated by peer (%x)\n", PROTO_NAME(f), p));
-		} else {
-			FSMDEBUG((LOG_INFO, "%s terminated by peer\n", PROTO_NAME(f)));
-		}
-		if (f->callbacks->down)
-			(*f->callbacks->down)(f);	/* Inform upper layers */
-		f->retransmits = 0;
-		f->state = STOPPING;
-		TIMEOUT(fsm_timeout, f, f->timeouttime);
-		break;
-	}
-	
-	fsm_sdata(f, TERMACK, (u_char)id, NULL, 0);
-}
-
-
-/*
- * fsm_rtermack - Receive Terminate-Ack.
- */
-static void fsm_rtermack(fsm *f)
-{
-	FSMDEBUG((LOG_INFO, "fsm_rtermack(%s): state=%d\n", 
-				PROTO_NAME(f), f->state));
-	
-	switch (f->state) {
-	case CLOSING:
-		UNTIMEOUT(fsm_timeout, f);
-		f->state = CLOSED;
-		if( f->callbacks->finished )
-			(*f->callbacks->finished)(f);
-		break;
-	case STOPPING:
-		UNTIMEOUT(fsm_timeout, f);
-		f->state = STOPPED;
-		if( f->callbacks->finished )
-			(*f->callbacks->finished)(f);
-		break;
-	
-	case ACKRCVD:
-		f->state = REQSENT;
-		break;
-	
-	case OPENED:
-		if (f->callbacks->down)
-			(*f->callbacks->down)(f);	/* Inform upper layers */
-		fsm_sconfreq(f, 0);
-		break;
-	}
-}
-
-
-/*
- * fsm_rcoderej - Receive an Code-Reject.
- */
-static void fsm_rcoderej(fsm *f, u_char *inp, int len)
-{
-	u_char code, id;
-	
-	FSMDEBUG((LOG_INFO, "fsm_rcoderej(%s): state=%d\n", 
-				PROTO_NAME(f), f->state));
-	
-	if (len < HEADERLEN) {
-		FSMDEBUG((LOG_INFO, "fsm_rcoderej: Rcvd short Code-Reject packet!\n"));
-		return;
-	}
-	GETCHAR(code, inp);
-	GETCHAR(id, inp);
-	FSMDEBUG((LOG_WARNING, "%s: Rcvd Code-Reject for code %d, id %d\n",
-				PROTO_NAME(f), code, id));
-	
-	if( f->state == ACKRCVD )
-		f->state = REQSENT;
-}
-
-
-/*
- * fsm_sconfreq - Send a Configure-Request.
- */
-static void fsm_sconfreq(fsm *f, int retransmit)
-{
-	u_char *outp;
-	int cilen;
-	
-	if( f->state != REQSENT && f->state != ACKRCVD && f->state != ACKSENT ){
-		/* Not currently negotiating - reset options */
-		if( f->callbacks->resetci )
-			(*f->callbacks->resetci)(f);
-		f->nakloops = 0;
-		}
-	
-	if( !retransmit ){
-		/* New request - reset retransmission counter, use new ID */
-		f->retransmits = f->maxconfreqtransmits;
-		f->reqid = ++f->id;
-	}
-	
-	f->seen_ack = 0;
-	
-	/*
-	 * Make up the request packet
-	 */
-	outp = outpacket_buf[f->unit] + PPP_HDRLEN + HEADERLEN;
-	if( f->callbacks->cilen && f->callbacks->addci ){
-		cilen = (*f->callbacks->cilen)(f);
-		if( cilen > peer_mru[f->unit] - (int)HEADERLEN )
-			cilen = peer_mru[f->unit] - HEADERLEN;
-		if (f->callbacks->addci)
-			(*f->callbacks->addci)(f, outp, &cilen);
-	} else
-		cilen = 0;
-	
-	/* send the request to our peer */
-	fsm_sdata(f, CONFREQ, f->reqid, outp, cilen);
-	
-	/* start the retransmit timer */
-	--f->retransmits;
-	TIMEOUT(fsm_timeout, f, f->timeouttime);
-	
-	FSMDEBUG((LOG_INFO, "%s: sending Configure-Request, id %d\n",
-				PROTO_NAME(f), f->reqid));
-}
-
-#endif /* PPP_SUPPORT */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.h
deleted file mode 100644
index 17bdd4a..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/fsm.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/*****************************************************************************
-* fsm.h - Network Control Protocol Finite State Machine header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* Copyright (c) 1997 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-11-05 Guy Lancaster <glanca at gesn.com>, Global Election Systems Inc.
-*	Original based on BSD code.
-*****************************************************************************/
-/*
- * fsm.h - {Link, IP} Control Protocol Finite State Machine definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id: fsm.h $
- */
-
-#ifndef FSM_H
-#define FSM_H
-
-
-/*****************************************************************************
-************************* PUBLIC DEFINITIONS *********************************
-*****************************************************************************/
-/*
- * LCP Packet header = Code, id, length.
- */
-#define HEADERLEN	(sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
-
-
-/*
- *  CP (LCP, IPCP, etc.) codes.
- */
-#define CONFREQ		1		/* Configuration Request */
-#define CONFACK		2		/* Configuration Ack */
-#define CONFNAK		3		/* Configuration Nak */
-#define CONFREJ		4		/* Configuration Reject */
-#define TERMREQ		5		/* Termination Request */
-#define TERMACK		6		/* Termination Ack */
-#define CODEREJ		7		/* Code Reject */
-
-/*
- * Link states.
- */
-#define INITIAL		0		/* Down, hasn't been opened */
-#define STARTING	1		/* Down, been opened */
-#define CLOSED		2		/* Up, hasn't been opened */
-#define STOPPED		3		/* Open, waiting for down event */
-#define CLOSING		4		/* Terminating the connection, not open */
-#define STOPPING	5		/* Terminating, but open */
-#define REQSENT		6		/* We've sent a Config Request */
-#define ACKRCVD		7		/* We've received a Config Ack */
-#define ACKSENT		8		/* We've sent a Config Ack */
-#define OPENED		9		/* Connection available */
-
-
-/*
- * Flags - indicate options controlling FSM operation
- */
-#define OPT_PASSIVE	1		/* Don't die if we don't get a response */
-#define OPT_RESTART	2		/* Treat 2nd OPEN as DOWN, UP */
-#define OPT_SILENT	4		/* Wait for peer to speak first */
-
-
-/*****************************************************************************
-************************* PUBLIC DATA TYPES **********************************
-*****************************************************************************/
-/*
- * Each FSM is described by an fsm structure and fsm callbacks.
- */
-typedef struct fsm {
-    int unit;				/* Interface unit number */
-    u_short protocol;		/* Data Link Layer Protocol field value */
-    int state;				/* State */
-    int flags;				/* Contains option bits */
-    u_char id;				/* Current id */
-    u_char reqid;			/* Current request id */
-    u_char seen_ack;		/* Have received valid Ack/Nak/Rej to Req */
-    int timeouttime;		/* Timeout time in milliseconds */
-    int maxconfreqtransmits;/* Maximum Configure-Request transmissions */
-    int retransmits;		/* Number of retransmissions left */
-    int maxtermtransmits;	/* Maximum Terminate-Request transmissions */
-    int nakloops;			/* Number of nak loops since last ack */
-    int maxnakloops;		/* Maximum number of nak loops tolerated */
-    struct fsm_callbacks* callbacks;/* Callback routines */
-    char* term_reason;		/* Reason for closing protocol */
-    int term_reason_len;	/* Length of term_reason */
-} fsm;
-
-
-typedef struct fsm_callbacks {
-    void (*resetci)			/* Reset our Configuration Information */
-		(fsm*);
-    int  (*cilen)			/* Length of our Configuration Information */
-		(fsm*);
-    void (*addci) 			/* Add our Configuration Information */
-		(fsm*, u_char*, int*);
-    int  (*ackci)			/* ACK our Configuration Information */
-		(fsm*, u_char*, int);
-    int  (*nakci)			/* NAK our Configuration Information */
-		(fsm*, u_char*, int);
-    int  (*rejci)			/* Reject our Configuration Information */
-		(fsm*, u_char*, int);
-    int  (*reqci)			/* Request peer's Configuration Information */
-		(fsm*, u_char*, int*, int);
-    void (*up)				/* Called when fsm reaches OPENED state */
-		(fsm*);
-    void (*down)			/* Called when fsm leaves OPENED state */
-		(fsm*);
-    void (*starting)		/* Called when we want the lower layer */
-		(fsm*);
-    void (*finished)		/* Called when we don't want the lower layer */
-		(fsm*);
-    void (*protreject)		/* Called when Protocol-Reject received */
-		(int);
-    void (*retransmit)		/* Retransmission is necessary */
-		(fsm*);
-    int  (*extcode)			/* Called when unknown code received */
-		(fsm*, int, u_char, u_char*, int);
-    char *proto_name;		/* String name for protocol (for messages) */
-} fsm_callbacks;
-
-
-/*****************************************************************************
-*********************** PUBLIC DATA STRUCTURES *******************************
-*****************************************************************************/
-/*
- * Variables
- */
-extern int peer_mru[];		/* currently negotiated peer MRU (per unit) */
-
-
-/*****************************************************************************
-************************** PUBLIC FUNCTIONS **********************************
-*****************************************************************************/
-
-/*
- * Prototypes
- */
-void fsm_init (fsm*);
-void fsm_lowerup (fsm*);
-void fsm_lowerdown (fsm*);
-void fsm_open (fsm*);
-void fsm_close (fsm*, char*);
-void fsm_input (fsm*, u_char*, int);
-void fsm_protreject (fsm*);
-void fsm_sdata (fsm*, u_char, u_char, u_char*, int);
-
-
-#endif /* FSM_H */
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.c
deleted file mode 100644
index d5b2518..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.c
+++ /dev/null
@@ -1,1377 +0,0 @@
-/*****************************************************************************
-* ipcp.c - Network PPP IP Control Protocol program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 by Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-08 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original.
-*****************************************************************************/
-/*
- * ipcp.c - PPP IP Control Protocol.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include <string.h>
-
-#include "ppp.h"
-#if PPP_SUPPORT > 0
-#include "auth.h"
-#include "fsm.h"
-#include "vj.h"
-#include "ipcp.h"
-#include "pppdebug.h"
-
-
-/*************************/
-/*** LOCAL DEFINITIONS ***/
-/*************************/
-/* #define OLD_CI_ADDRS 1 */	/* Support deprecated address negotiation. */
-
-/*
- * Lengths of configuration options.
- */
-#define CILEN_VOID	2
-#define CILEN_COMPRESS	4	/* min length for compression protocol opt. */
-#define CILEN_VJ	6	/* length for RFC1332 Van-Jacobson opt. */
-#define CILEN_ADDR	6	/* new-style single address option */
-#define CILEN_ADDRS	10	/* old-style dual address option */
-
-
-
-/***********************************/
-/*** LOCAL FUNCTION DECLARATIONS ***/
-/***********************************/
-/*
- * Callbacks for fsm code.  (CI = Configuration Information)
- */
-static void ipcp_resetci (fsm *);	/* Reset our CI */
-static int  ipcp_cilen (fsm *);	        /* Return length of our CI */
-static void ipcp_addci (fsm *, u_char *, int *); /* Add our CI */
-static int  ipcp_ackci (fsm *, u_char *, int);	/* Peer ack'd our CI */
-static int  ipcp_nakci (fsm *, u_char *, int);	/* Peer nak'd our CI */
-static int  ipcp_rejci (fsm *, u_char *, int);	/* Peer rej'd our CI */
-static int  ipcp_reqci (fsm *, u_char *, int *, int); /* Rcv CI */
-static void ipcp_up (fsm *);		/* We're UP */
-static void ipcp_down (fsm *);		/* We're DOWN */
-#if 0
-static void ipcp_script (fsm *, char *); /* Run an up/down script */
-#endif
-static void ipcp_finished (fsm *);	/* Don't need lower layer */
-
-/*
- * Protocol entry points from main code.
- */
-static void ipcp_init (int);
-static void ipcp_open (int);
-static void ipcp_close (int, char *);
-static void ipcp_lowerup (int);
-static void ipcp_lowerdown (int);
-static void ipcp_input (int, u_char *, int);
-static void ipcp_protrej (int);
-
-static void ipcp_clear_addrs (int);
-
-#define CODENAME(x)	((x) == CONFACK ? "ACK" : \
-			 (x) == CONFNAK ? "NAK" : "REJ")
-
-
-
-/******************************/
-/*** PUBLIC DATA STRUCTURES ***/
-/******************************/
-/* global vars */
-ipcp_options ipcp_wantoptions[NUM_PPP];	/* Options that we want to request */
-ipcp_options ipcp_gotoptions[NUM_PPP];	/* Options that peer ack'd */
-ipcp_options ipcp_allowoptions[NUM_PPP];	/* Options we allow peer to request */
-ipcp_options ipcp_hisoptions[NUM_PPP];	/* Options that we ack'd */
-
-fsm ipcp_fsm[NUM_PPP];		/* IPCP fsm structure */
-
-struct protent ipcp_protent = {
-    PPP_IPCP,
-    ipcp_init,
-    ipcp_input,
-    ipcp_protrej,
-    ipcp_lowerup,
-    ipcp_lowerdown,
-    ipcp_open,
-    ipcp_close,
-#if 0
-    ipcp_printpkt,
-    NULL,
-#endif
-    1,
-    "IPCP",
-#if 0
-    ip_check_options,
-    NULL,
-    ip_active_pkt
-#endif
-};
-
-
-
-/*****************************/
-/*** LOCAL DATA STRUCTURES ***/
-/*****************************/
-/* local vars */
-static int cis_received[NUM_PPP];		/* # Conf-Reqs received */
-static int default_route_set[NUM_PPP];	/* Have set up a default route */
-
-static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */
-    ipcp_resetci,		/* Reset our Configuration Information */
-    ipcp_cilen,			/* Length of our Configuration Information */
-    ipcp_addci,			/* Add our Configuration Information */
-    ipcp_ackci,			/* ACK our Configuration Information */
-    ipcp_nakci,			/* NAK our Configuration Information */
-    ipcp_rejci,			/* Reject our Configuration Information */
-    ipcp_reqci,			/* Request peer's Configuration Information */
-    ipcp_up,			/* Called when fsm reaches OPENED state */
-    ipcp_down,			/* Called when fsm leaves OPENED state */
-    NULL,				/* Called when we want the lower layer up */
-    ipcp_finished,		/* Called when we want the lower layer down */
-    NULL,				/* Called when Protocol-Reject received */
-    NULL,				/* Retransmission is necessary */
-    NULL,				/* Called to handle protocol-specific codes */
-    "IPCP"				/* String name of protocol */
-};
-
-
-
-/**********************************/
-/*** LOCAL FUNCTION DEFINITIONS ***/
-/**********************************/
-
-/*
- * Non-standard inet_ntoa left here for compat with original ppp
- * sources. Assumes u32_t instead of struct in_addr.
- */ 
-
-char * _inet_ntoa(u32_t n)
-{
-	struct in_addr ia;
-	ia.s_addr = n;
-	return inet_ntoa(ia);
-}
-
-#define inet_ntoa _inet_ntoa
-
-/*
- * ipcp_init - Initialize IPCP.
- */
-static void ipcp_init(int unit)
-{
-	fsm *f = &ipcp_fsm[unit];
-	ipcp_options *wo = &ipcp_wantoptions[unit];
-	ipcp_options *ao = &ipcp_allowoptions[unit];
-	
-	f->unit = unit;
-	f->protocol = PPP_IPCP;
-	f->callbacks = &ipcp_callbacks;
-	fsm_init(&ipcp_fsm[unit]);
-	
-	memset(wo, 0, sizeof(*wo));
-	memset(ao, 0, sizeof(*ao));
-	
-	wo->neg_addr = 1;
-	wo->ouraddr = 0;
-#if VJ_SUPPORT > 0
-	wo->neg_vj = 1;
-#else
-	wo->neg_vj = 0;
-#endif
-	wo->vj_protocol = IPCP_VJ_COMP;
-	wo->maxslotindex = MAX_SLOTS - 1;
-	wo->cflag = 0;
-	
-	wo->default_route = 1;
-	
-	ao->neg_addr = 1;
-#if VJ_SUPPORT > 0
-	ao->neg_vj = 1;
-#else
-	ao->neg_vj = 0;
-#endif
-	ao->maxslotindex = MAX_SLOTS - 1;
-	ao->cflag = 1;
-	
-	ao->default_route = 1;
-}
-
-
-/*
- * ipcp_open - IPCP is allowed to come up.
- */
-static void ipcp_open(int unit)
-{
-	fsm_open(&ipcp_fsm[unit]);
-}
-
-
-/*
- * ipcp_close - Take IPCP down.
- */
-static void ipcp_close(int unit, char *reason)
-{
-	fsm_close(&ipcp_fsm[unit], reason);
-}
-
-
-/*
- * ipcp_lowerup - The lower layer is up.
- */
-static void ipcp_lowerup(int unit)
-{
-	fsm_lowerup(&ipcp_fsm[unit]);
-}
-
-
-/*
- * ipcp_lowerdown - The lower layer is down.
- */
-static void ipcp_lowerdown(int unit)
-{
-	fsm_lowerdown(&ipcp_fsm[unit]);
-}
-
-
-/*
- * ipcp_input - Input IPCP packet.
- */
-static void ipcp_input(int unit, u_char *p, int len)
-{
-	fsm_input(&ipcp_fsm[unit], p, len);
-}
-
-
-/*
- * ipcp_protrej - A Protocol-Reject was received for IPCP.
- *
- * Pretend the lower layer went down, so we shut up.
- */
-static void ipcp_protrej(int unit)
-{
-	fsm_lowerdown(&ipcp_fsm[unit]);
-}
-
-
-/*
- * ipcp_resetci - Reset our CI.
- */
-static void ipcp_resetci(fsm *f)
-{
-	ipcp_options *wo = &ipcp_wantoptions[f->unit];
-	
-	wo->req_addr = wo->neg_addr && ipcp_allowoptions[f->unit].neg_addr;
-	if (wo->ouraddr == 0)
-		wo->accept_local = 1;
-	if (wo->hisaddr == 0)
-		wo->accept_remote = 1;
-	/* Request DNS addresses from the peer */
-	wo->req_dns1 = ppp_settings.usepeerdns;
-	wo->req_dns2 = ppp_settings.usepeerdns;
-	ipcp_gotoptions[f->unit] = *wo;
-	cis_received[f->unit] = 0;
-}
-
-
-/*
- * ipcp_cilen - Return length of our CI.
- */
-static int ipcp_cilen(fsm *f)
-{
-	ipcp_options *go = &ipcp_gotoptions[f->unit];
-	ipcp_options *wo = &ipcp_wantoptions[f->unit];
-	ipcp_options *ho = &ipcp_hisoptions[f->unit];
-	
-#define LENCIVJ(neg, old)	(neg ? (old? CILEN_COMPRESS : CILEN_VJ) : 0)
-#define LENCIADDR(neg, old)	(neg ? (old? CILEN_ADDRS : CILEN_ADDR) : 0)
-#define LENCIDNS(neg)		(neg ? (CILEN_ADDR) : 0)
-	
-	/*
-	 * First see if we want to change our options to the old
-	 * forms because we have received old forms from the peer.
-	 */
-	if (wo->neg_addr && !go->neg_addr && !go->old_addrs) {
-		/* use the old style of address negotiation */
-		go->neg_addr = 1;
-		go->old_addrs = 1;
-	}
-	if (wo->neg_vj && !go->neg_vj && !go->old_vj) {
-		/* try an older style of VJ negotiation */
-		if (cis_received[f->unit] == 0) {
-			/* keep trying the new style until we see some CI from the peer */
-			go->neg_vj = 1;
-		} else {
-			/* use the old style only if the peer did */
-			if (ho->neg_vj && ho->old_vj) {
-				go->neg_vj = 1;
-				go->old_vj = 1;
-				go->vj_protocol = ho->vj_protocol;
-			}
-		}
-	}
-	
-	return (LENCIADDR(go->neg_addr, go->old_addrs)
-			+ LENCIVJ(go->neg_vj, go->old_vj) +
-			LENCIDNS(go->req_dns1) +
-			LENCIDNS(go->req_dns2));
-}
-
-
-/*
- * ipcp_addci - Add our desired CIs to a packet.
- */
-static void ipcp_addci(fsm *f, u_char *ucp, int *lenp)
-{
-	ipcp_options *go = &ipcp_gotoptions[f->unit];
-	int len = *lenp;
-	
-#define ADDCIVJ(opt, neg, val, old, maxslotindex, cflag) \
-	if (neg) { \
-		int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
-		if (len >= vjlen) { \
-			PUTCHAR(opt, ucp); \
-			PUTCHAR(vjlen, ucp); \
-			PUTSHORT(val, ucp); \
-			if (!old) { \
-				PUTCHAR(maxslotindex, ucp); \
-				PUTCHAR(cflag, ucp); \
-			} \
-			len -= vjlen; \
-		} else \
-			neg = 0; \
-	}
-	
-#define ADDCIADDR(opt, neg, old, val1, val2) \
-	if (neg) { \
-		int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \
-		if (len >= addrlen) { \
-			u32_t l; \
-			PUTCHAR(opt, ucp); \
-			PUTCHAR(addrlen, ucp); \
-			l = ntohl(val1); \
-			PUTLONG(l, ucp); \
-			if (old) { \
-				l = ntohl(val2); \
-				PUTLONG(l, ucp); \
-			} \
-			len -= addrlen; \
-		} else \
-			neg = 0; \
-	}
-
-#define ADDCIDNS(opt, neg, addr) \
-	if (neg) { \
-		if (len >= CILEN_ADDR) { \
-			u32_t l; \
-			PUTCHAR(opt, ucp); \
-			PUTCHAR(CILEN_ADDR, ucp); \
-			l = ntohl(addr); \
-			PUTLONG(l, ucp); \
-			len -= CILEN_ADDR; \
-		} else \
-			neg = 0; \
-	}
-	
-	ADDCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), go->neg_addr,
-			  go->old_addrs, go->ouraddr, go->hisaddr);
-	
-	ADDCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj,
-			go->maxslotindex, go->cflag);
-	
-	ADDCIDNS(CI_MS_DNS1, go->req_dns1, go->dnsaddr[0]);
-
-	ADDCIDNS(CI_MS_DNS2, go->req_dns2, go->dnsaddr[1]);
-
-	*lenp -= len;
-}
-
-
-/*
- * ipcp_ackci - Ack our CIs.
- *
- * Returns:
- *	0 - Ack was bad.
- *	1 - Ack was good.
- */
-static int ipcp_ackci(fsm *f, u_char *p, int len)
-{
-	ipcp_options *go = &ipcp_gotoptions[f->unit];
-	u_short cilen, citype, cishort;
-	u32_t cilong;
-	u_char cimaxslotindex, cicflag;
-	
-	/*
-	 * CIs must be in exactly the same order that we sent...
-	 * Check packet length and CI length at each step.
-	 * If we find any deviations, then this packet is bad.
-	 */
-	
-#define ACKCIVJ(opt, neg, val, old, maxslotindex, cflag) \
-	if (neg) { \
-		int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \
-		if ((len -= vjlen) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != vjlen || \
-				citype != opt)  \
-			goto bad; \
-		GETSHORT(cishort, p); \
-		if (cishort != val) \
-			goto bad; \
-		if (!old) { \
-			GETCHAR(cimaxslotindex, p); \
-			if (cimaxslotindex != maxslotindex) \
-				goto bad; \
-			GETCHAR(cicflag, p); \
-			if (cicflag != cflag) \
-				goto bad; \
-		} \
-	}
-	
-#define ACKCIADDR(opt, neg, old, val1, val2) \
-	if (neg) { \
-		int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \
-		u32_t l; \
-		if ((len -= addrlen) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != addrlen || \
-				citype != opt) \
-			goto bad; \
-		GETLONG(l, p); \
-		cilong = htonl(l); \
-		if (val1 != cilong) \
-			goto bad; \
-		if (old) { \
-			GETLONG(l, p); \
-			cilong = htonl(l); \
-			if (val2 != cilong) \
-				goto bad; \
-		} \
-	}
-
-#define ACKCIDNS(opt, neg, addr) \
-	if (neg) { \
-		u32_t l; \
-		if ((len -= CILEN_ADDR) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != CILEN_ADDR || \
-				citype != opt) \
-			goto bad; \
-		GETLONG(l, p); \
-		cilong = htonl(l); \
-		if (addr != cilong) \
-			goto bad; \
-	}
-	
-	ACKCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), go->neg_addr,
-			  go->old_addrs, go->ouraddr, go->hisaddr);
-	
-	ACKCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj,
-			go->maxslotindex, go->cflag);
-	
-	ACKCIDNS(CI_MS_DNS1, go->req_dns1, go->dnsaddr[0]);
-
-	ACKCIDNS(CI_MS_DNS2, go->req_dns2, go->dnsaddr[1]);
-
-	/*
-	 * If there are any remaining CIs, then this packet is bad.
-	 */
-	if (len != 0)
-		goto bad;
-	return (1);
-	
-bad:
-	IPCPDEBUG((LOG_INFO, "ipcp_ackci: received bad Ack!\n"));
-	return (0);
-}
-
-/*
- * ipcp_nakci - Peer has sent a NAK for some of our CIs.
- * This should not modify any state if the Nak is bad
- * or if IPCP is in the OPENED state.
- *
- * Returns:
- *	0 - Nak was bad.
- *	1 - Nak was good.
- */
-static int ipcp_nakci(fsm *f, u_char *p, int len)
-{
-	ipcp_options *go = &ipcp_gotoptions[f->unit];
-	u_char cimaxslotindex, cicflag;
-	u_char citype, cilen, *next;
-	u_short cishort;
-	u32_t ciaddr1, ciaddr2, l, cidnsaddr;
-	ipcp_options no;		/* options we've seen Naks for */
-	ipcp_options try;		/* options to request next time */
-	
-	BZERO(&no, sizeof(no));
-	try = *go;
-	
-	/*
-	 * Any Nak'd CIs must be in exactly the same order that we sent.
-	 * Check packet length and CI length at each step.
-	 * If we find any deviations, then this packet is bad.
-	 */
-#define NAKCIADDR(opt, neg, old, code) \
-	if (go->neg && \
-			len >= (cilen = (old? CILEN_ADDRS: CILEN_ADDR)) && \
-			p[1] == cilen && \
-			p[0] == opt) { \
-		len -= cilen; \
-		INCPTR(2, p); \
-		GETLONG(l, p); \
-		ciaddr1 = htonl(l); \
-		if (old) { \
-			GETLONG(l, p); \
-			ciaddr2 = htonl(l); \
-			no.old_addrs = 1; \
-		} else \
-			ciaddr2 = 0; \
-		no.neg = 1; \
-		code \
-	}
-	
-#define NAKCIVJ(opt, neg, code) \
-	if (go->neg && \
-			((cilen = p[1]) == CILEN_COMPRESS || cilen == CILEN_VJ) && \
-			len >= cilen && \
-			p[0] == opt) { \
-		len -= cilen; \
-		INCPTR(2, p); \
-		GETSHORT(cishort, p); \
-		no.neg = 1; \
-		code \
-	}
-	
-#define NAKCIDNS(opt, neg, code) \
-	if (go->neg && \
-			((cilen = p[1]) == CILEN_ADDR) && \
-			len >= cilen && \
-			p[0] == opt) { \
-		len -= cilen; \
-		INCPTR(2, p); \
-		GETLONG(l, p); \
-		cidnsaddr = htonl(l); \
-		no.neg = 1; \
-		code \
-	}
-	
-	/*
-	 * Accept the peer's idea of {our,his} address, if different
-	 * from our idea, only if the accept_{local,remote} flag is set.
-	 */
-	NAKCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), neg_addr, go->old_addrs,
-	  if (go->accept_local && ciaddr1) { /* Do we know our address? */
-		  try.ouraddr = ciaddr1;
-		  IPCPDEBUG((LOG_INFO, "local IP address %s\n",
-			     inet_ntoa(ciaddr1)));
-	  }
-	  if (go->accept_remote && ciaddr2) { /* Does he know his? */
-		  try.hisaddr = ciaddr2;
-		  IPCPDEBUG((LOG_INFO, "remote IP address %s\n",
-			     inet_ntoa(ciaddr2)));
-	  }
-	);
-	
-	/*
-	 * Accept the peer's value of maxslotindex provided that it
-	 * is less than what we asked for.  Turn off slot-ID compression
-	 * if the peer wants.  Send old-style compress-type option if
-	 * the peer wants.
-	 */
-	NAKCIVJ(CI_COMPRESSTYPE, neg_vj,
-		if (cilen == CILEN_VJ) {
-			GETCHAR(cimaxslotindex, p);
-			GETCHAR(cicflag, p);
-			if (cishort == IPCP_VJ_COMP) {
-				try.old_vj = 0;
-				if (cimaxslotindex < go->maxslotindex)
-					try.maxslotindex = cimaxslotindex;
-				if (!cicflag)
-					try.cflag = 0;
-			} else {
-				try.neg_vj = 0;
-			}
-		} else {
-			if (cishort == IPCP_VJ_COMP || cishort == IPCP_VJ_COMP_OLD) {
-				try.old_vj = 1;
-				try.vj_protocol = cishort;
-			} else {
-				try.neg_vj = 0;
-			}
-		}
-	);
-	
-	NAKCIDNS(CI_MS_DNS1, req_dns1,
-			try.dnsaddr[0] = cidnsaddr;
-		  	IPCPDEBUG((LOG_INFO, "primary DNS address %s\n", inet_ntoa(cidnsaddr)));
-			);
-
-	NAKCIDNS(CI_MS_DNS2, req_dns2,
-			try.dnsaddr[1] = cidnsaddr;
-		  	IPCPDEBUG((LOG_INFO, "secondary DNS address %s\n", inet_ntoa(cidnsaddr)));
-			);
-
-	/*
-	* There may be remaining CIs, if the peer is requesting negotiation
-	* on an option that we didn't include in our request packet.
-	* If they want to negotiate about IP addresses, we comply.
-	* If they want us to ask for compression, we refuse.
-	*/
-	while (len > CILEN_VOID) {
-		GETCHAR(citype, p);
-		GETCHAR(cilen, p);
-		if( (len -= cilen) < 0 )
-			goto bad;
-		next = p + cilen - 2;
-		
-		switch (citype) {
-		case CI_COMPRESSTYPE:
-			if (go->neg_vj || no.neg_vj ||
-					(cilen != CILEN_VJ && cilen != CILEN_COMPRESS))
-				goto bad;
-			no.neg_vj = 1;
-			break;
-		case CI_ADDRS:
-			if ((go->neg_addr && go->old_addrs) || no.old_addrs
-					|| cilen != CILEN_ADDRS)
-				goto bad;
-			try.neg_addr = 1;
-			try.old_addrs = 1;
-			GETLONG(l, p);
-			ciaddr1 = htonl(l);
-			if (ciaddr1 && go->accept_local)
-				try.ouraddr = ciaddr1;
-			GETLONG(l, p);
-			ciaddr2 = htonl(l);
-			if (ciaddr2 && go->accept_remote)
-				try.hisaddr = ciaddr2;
-			no.old_addrs = 1;
-			break;
-		case CI_ADDR:
-			if (go->neg_addr || no.neg_addr || cilen != CILEN_ADDR)
-				goto bad;
-			try.old_addrs = 0;
-			GETLONG(l, p);
-			ciaddr1 = htonl(l);
-			if (ciaddr1 && go->accept_local)
-				try.ouraddr = ciaddr1;
-			if (try.ouraddr != 0)
-				try.neg_addr = 1;
-			no.neg_addr = 1;
-			break;
-		}
-		p = next;
-	}
-	
-	/* If there is still anything left, this packet is bad. */
-	if (len != 0)
-		goto bad;
-	
-	/*
-	 * OK, the Nak is good.  Now we can update state.
-	 */
-	if (f->state != OPENED)
-		*go = try;
-	
-	return 1;
-	
-bad:
-	IPCPDEBUG((LOG_INFO, "ipcp_nakci: received bad Nak!\n"));
-	return 0;
-}
-
-
-/*
- * ipcp_rejci - Reject some of our CIs.
- */
-static int ipcp_rejci(fsm *f, u_char *p, int len)
-{
-	ipcp_options *go = &ipcp_gotoptions[f->unit];
-	u_char cimaxslotindex, ciflag, cilen;
-	u_short cishort;
-	u32_t cilong;
-	ipcp_options try;		/* options to request next time */
-	
-	try = *go;
-	/*
-	 * Any Rejected CIs must be in exactly the same order that we sent.
-	 * Check packet length and CI length at each step.
-	 * If we find any deviations, then this packet is bad.
-	 */
-#define REJCIADDR(opt, neg, old, val1, val2) \
-	if (go->neg && \
-			len >= (cilen = old? CILEN_ADDRS: CILEN_ADDR) && \
-			p[1] == cilen && \
-			p[0] == opt) { \
-		u32_t l; \
-		len -= cilen; \
-		INCPTR(2, p); \
-		GETLONG(l, p); \
-		cilong = htonl(l); \
-		/* Check rejected value. */ \
-		if (cilong != val1) \
-			goto bad; \
-		if (old) { \
-			GETLONG(l, p); \
-			cilong = htonl(l); \
-			/* Check rejected value. */ \
-			if (cilong != val2) \
-				goto bad; \
-		} \
-		try.neg = 0; \
-	}
-	
-#define REJCIVJ(opt, neg, val, old, maxslot, cflag) \
-	if (go->neg && \
-			p[1] == (old? CILEN_COMPRESS : CILEN_VJ) && \
-			len >= p[1] && \
-			p[0] == opt) { \
-		len -= p[1]; \
-		INCPTR(2, p); \
-		GETSHORT(cishort, p); \
-		/* Check rejected value. */  \
-		if (cishort != val) \
-			goto bad; \
-		if (!old) { \
-			GETCHAR(cimaxslotindex, p); \
-			if (cimaxslotindex != maxslot) \
-				goto bad; \
-			GETCHAR(ciflag, p); \
-			if (ciflag != cflag) \
-				goto bad; \
-		} \
-		try.neg = 0; \
-	}
-	
-#define REJCIDNS(opt, neg, dnsaddr) \
-	if (go->neg && \
-			((cilen = p[1]) == CILEN_ADDR) && \
-			len >= cilen && \
-			p[0] == opt) { \
-		u32_t l; \
-		len -= cilen; \
-		INCPTR(2, p); \
-		GETLONG(l, p); \
-		cilong = htonl(l); \
-		/* Check rejected value. */ \
-		if (cilong != dnsaddr) \
-			goto bad; \
-		try.neg = 0; \
-	}
-
-	REJCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), neg_addr,
-			  go->old_addrs, go->ouraddr, go->hisaddr);
-	
-	REJCIVJ(CI_COMPRESSTYPE, neg_vj, go->vj_protocol, go->old_vj,
-			go->maxslotindex, go->cflag);
-	
-	REJCIDNS(CI_MS_DNS1, req_dns1, go->dnsaddr[0]);
-
-	REJCIDNS(CI_MS_DNS2, req_dns2, go->dnsaddr[1]);
-
-	/*
-	 * If there are any remaining CIs, then this packet is bad.
-	 */
-	if (len != 0)
-		goto bad;
-	/*
-	 * Now we can update state.
-	 */
-	if (f->state != OPENED)
-		*go = try;
-	return 1;
-	
-bad:
-	IPCPDEBUG((LOG_INFO, "ipcp_rejci: received bad Reject!\n"));
-	return 0;
-}
-
-
-/*
- * ipcp_reqci - Check the peer's requested CIs and send appropriate response.
- *
- * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified
- * appropriately.  If reject_if_disagree is non-zero, doesn't return
- * CONFNAK; returns CONFREJ if it can't return CONFACK.
- */
-static int ipcp_reqci(
-	fsm *f,
-	u_char *inp,		/* Requested CIs */
-	int *len,			/* Length of requested CIs */
-	int reject_if_disagree
-)
-{
-	ipcp_options *wo = &ipcp_wantoptions[f->unit];
-	ipcp_options *ho = &ipcp_hisoptions[f->unit];
-	ipcp_options *ao = &ipcp_allowoptions[f->unit];
-#ifdef OLD_CI_ADDRS
-	ipcp_options *go = &ipcp_gotoptions[f->unit];
-#endif
-	u_char *cip, *next;				/* Pointer to current and next CIs */
-	u_short cilen, citype;			/* Parsed len, type */
-	u_short cishort;				/* Parsed short value */
-	u32_t tl, ciaddr1;			/* Parsed address values */
-#ifdef OLD_CI_ADDRS
-	u32_t ciaddr2;				/* Parsed address values */
-#endif
-	int rc = CONFACK;				/* Final packet return code */
-	int orc;						/* Individual option return code */
-	u_char *p;						/* Pointer to next char to parse */
-	u_char *ucp = inp;				/* Pointer to current output char */
-	int l = *len;					/* Length left */
-	u_char maxslotindex, cflag;
-	int d;
-	
-	cis_received[f->unit] = 1;
-	
-	/*
-	 * Reset all his options.
-	 */
-	BZERO(ho, sizeof(*ho));
-	
-	/*
-	 * Process all his options.
-	 */
-	next = inp;
-	while (l) {
-		orc = CONFACK;				/* Assume success */
-		cip = p = next;				/* Remember begining of CI */
-		if (l < 2 ||				/* Not enough data for CI header or */
-				p[1] < 2 ||			/*  CI length too small or */
-				p[1] > l) {			/*  CI length too big? */
-			IPCPDEBUG((LOG_INFO, "ipcp_reqci: bad CI length!\n"));
-			orc = CONFREJ;			/* Reject bad CI */
-			cilen = l;				/* Reject till end of packet */
-			l = 0;					/* Don't loop again */
-			goto endswitch;
-		}
-		GETCHAR(citype, p);			/* Parse CI type */
-		GETCHAR(cilen, p);			/* Parse CI length */
-		l -= cilen;					/* Adjust remaining length */
-		next += cilen;				/* Step to next CI */
-
-		switch (citype) {			/* Check CI type */
-#ifdef OLD_CI_ADDRS /* Need to save space... */
-		case CI_ADDRS:
-			IPCPDEBUG((LOG_INFO, "ipcp_reqci: received ADDRS\n"));
-			if (!ao->neg_addr ||
-					cilen != CILEN_ADDRS) {	/* Check CI length */
-				orc = CONFREJ;		/* Reject CI */
-				break;
-			}
-			
-			/*
-			 * If he has no address, or if we both have his address but
-			 * disagree about it, then NAK it with our idea.
-			 * In particular, if we don't know his address, but he does,
-			 * then accept it.
-			 */
-			GETLONG(tl, p);		/* Parse source address (his) */
-			ciaddr1 = htonl(tl);
-			IPCPDEBUG((LOG_INFO, "his addr %s\n", inet_ntoa(ciaddr1)));
-			if (ciaddr1 != wo->hisaddr
-					&& (ciaddr1 == 0 || !wo->accept_remote)) {
-				orc = CONFNAK;
-				if (!reject_if_disagree) {
-					DECPTR(sizeof(u32_t), p);
-					tl = ntohl(wo->hisaddr);
-					PUTLONG(tl, p);
-				}
-			} else if (ciaddr1 == 0 && wo->hisaddr == 0) {
-				/*
-				 * If neither we nor he knows his address, reject the option.
-				 */
-				orc = CONFREJ;
-				wo->req_addr = 0;	/* don't NAK with 0.0.0.0 later */
-				break;
-			}
-			
-			/*
-			 * If he doesn't know our address, or if we both have our address
-			 * but disagree about it, then NAK it with our idea.
-			 */
-			GETLONG(tl, p);		/* Parse desination address (ours) */
-			ciaddr2 = htonl(tl);
-			IPCPDEBUG((LOG_INFO, "our addr %s\n", inet_ntoa(ciaddr2)));
-			if (ciaddr2 != wo->ouraddr) {
-				if (ciaddr2 == 0 || !wo->accept_local) {
-					orc = CONFNAK;
-					if (!reject_if_disagree) {
-						DECPTR(sizeof(u32_t), p);
-						tl = ntohl(wo->ouraddr);
-						PUTLONG(tl, p);
-					}
-				} else {
-					go->ouraddr = ciaddr2;	/* accept peer's idea */
-				}
-			}
-			
-			ho->neg_addr = 1;
-			ho->old_addrs = 1;
-			ho->hisaddr = ciaddr1;
-			ho->ouraddr = ciaddr2;
-			break;
-#endif
-		
-		case CI_ADDR:
-			if (!ao->neg_addr) {
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Reject ADDR not allowed\n"));
-				orc = CONFREJ;				/* Reject CI */
-				break;
-			} else if (cilen != CILEN_ADDR) {	/* Check CI length */
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Reject ADDR bad len\n"));
-				orc = CONFREJ;				/* Reject CI */
-				break;
-			}
-			
-			/*
-			 * If he has no address, or if we both have his address but
-			 * disagree about it, then NAK it with our idea.
-			 * In particular, if we don't know his address, but he does,
-			 * then accept it.
-			 */
-			GETLONG(tl, p);	/* Parse source address (his) */
-			ciaddr1 = htonl(tl);
-			if (ciaddr1 != wo->hisaddr
-					&& (ciaddr1 == 0 || !wo->accept_remote)) {
-				orc = CONFNAK;
-				if (!reject_if_disagree) {
-					DECPTR(sizeof(u32_t), p);
-					tl = ntohl(wo->hisaddr);
-					PUTLONG(tl, p);
-				}
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Nak ADDR %s\n", inet_ntoa(ciaddr1)));
-			} else if (ciaddr1 == 0 && wo->hisaddr == 0) {
-				/*
-				 * Don't ACK an address of 0.0.0.0 - reject it instead.
-				 */
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Reject ADDR %s\n", inet_ntoa(ciaddr1)));
-				orc = CONFREJ;
-				wo->req_addr = 0;	/* don't NAK with 0.0.0.0 later */
-				break;
-			}
-			
-			ho->neg_addr = 1;
-			ho->hisaddr = ciaddr1;
-			IPCPDEBUG((LOG_INFO, "ipcp_reqci: ADDR %s\n", inet_ntoa(ciaddr1)));
-			break;
-		
-		case CI_MS_DNS1:
-		case CI_MS_DNS2:
-			/* Microsoft primary or secondary DNS request */
-			d = citype == CI_MS_DNS2;
-			
-			/* If we do not have a DNS address then we cannot send it */
-			if (ao->dnsaddr[d] == 0 ||
-					cilen != CILEN_ADDR) {	/* Check CI length */
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Rejecting DNS%d Request\n", d+1));
-				orc = CONFREJ;				/* Reject CI */
-				break;
-			}
-			GETLONG(tl, p);
-			if (htonl(tl) != ao->dnsaddr[d]) {
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Naking DNS%d Request %d\n",
-							d+1, inet_ntoa(tl)));
-				DECPTR(sizeof(u32_t), p);
-				tl = ntohl(ao->dnsaddr[d]);
-				PUTLONG(tl, p);
-				orc = CONFNAK;
-			}
-			IPCPDEBUG((LOG_INFO, "ipcp_reqci: received DNS%d Request\n", d+1));
-			break;
-		
-		case CI_MS_WINS1:
-		case CI_MS_WINS2:
-			/* Microsoft primary or secondary WINS request */
-			d = citype == CI_MS_WINS2;
-			IPCPDEBUG((LOG_INFO, "ipcp_reqci: received WINS%d Request\n", d+1));
-			
-			/* If we do not have a DNS address then we cannot send it */
-			if (ao->winsaddr[d] == 0 ||
-				cilen != CILEN_ADDR) {	/* Check CI length */
-				orc = CONFREJ;			/* Reject CI */
-				break;
-			}
-			GETLONG(tl, p);
-			if (htonl(tl) != ao->winsaddr[d]) {
-				DECPTR(sizeof(u32_t), p);
-				tl = ntohl(ao->winsaddr[d]);
-				PUTLONG(tl, p);
-				orc = CONFNAK;
-			}
-			break;
-		
-		case CI_COMPRESSTYPE:
-			if (!ao->neg_vj) {
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Rejecting COMPRESSTYPE not allowed\n"));
-				orc = CONFREJ;
-				break;
-			} else if (cilen != CILEN_VJ && cilen != CILEN_COMPRESS) {
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Rejecting COMPRESSTYPE len=%d\n", cilen));
-				orc = CONFREJ;
-				break;
-			}
-			GETSHORT(cishort, p);
-			
-			if (!(cishort == IPCP_VJ_COMP ||
-					(cishort == IPCP_VJ_COMP_OLD && cilen == CILEN_COMPRESS))) {
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Rejecting COMPRESSTYPE %d\n", cishort));
-				orc = CONFREJ;
-				break;
-			}
-			
-			ho->neg_vj = 1;
-			ho->vj_protocol = cishort;
-			if (cilen == CILEN_VJ) {
-				GETCHAR(maxslotindex, p);
-				if (maxslotindex > ao->maxslotindex) { 
-					IPCPDEBUG((LOG_INFO, "ipcp_reqci: Naking VJ max slot %d\n", maxslotindex));
-					orc = CONFNAK;
-					if (!reject_if_disagree){
-						DECPTR(1, p);
-						PUTCHAR(ao->maxslotindex, p);
-					}
-				}
-				GETCHAR(cflag, p);
-				if (cflag && !ao->cflag) {
-					IPCPDEBUG((LOG_INFO, "ipcp_reqci: Naking VJ cflag %d\n", cflag));
-					orc = CONFNAK;
-					if (!reject_if_disagree){
-						DECPTR(1, p);
-						PUTCHAR(wo->cflag, p);
-					}
-				}
-				ho->maxslotindex = maxslotindex;
-				ho->cflag = cflag;
-			} else {
-				ho->old_vj = 1;
-				ho->maxslotindex = MAX_SLOTS - 1;
-				ho->cflag = 1;
-			}
-			IPCPDEBUG((LOG_INFO, 
-						"ipcp_reqci: received COMPRESSTYPE p=%d old=%d maxslot=%d cflag=%d\n",
-						ho->vj_protocol, ho->old_vj, ho->maxslotindex, ho->cflag));
-			break;
-			
-		default:
-			IPCPDEBUG((LOG_INFO, "ipcp_reqci: Rejecting unknown CI type %d\n", citype));
-			orc = CONFREJ;
-			break;
-		}
-		
-endswitch:
-		if (orc == CONFACK &&		/* Good CI */
-				rc != CONFACK)		/*  but prior CI wasnt? */
-			continue;				/* Don't send this one */
-		
-		if (orc == CONFNAK) {		/* Nak this CI? */
-			if (reject_if_disagree) {	/* Getting fed up with sending NAKs? */
-				IPCPDEBUG((LOG_INFO, "ipcp_reqci: Rejecting too many naks\n"));
-				orc = CONFREJ;		/* Get tough if so */
-			} else {
-				if (rc == CONFREJ)	/* Rejecting prior CI? */
-					continue;		/* Don't send this one */
-				if (rc == CONFACK) {	/* Ack'd all prior CIs? */
-					rc = CONFNAK;	/* Not anymore... */
-					ucp = inp;		/* Backup */
-				}
-			}
-		}
-		
-		if (orc == CONFREJ &&		/* Reject this CI */
-				rc != CONFREJ) {	/*  but no prior ones? */
-			rc = CONFREJ;
-			ucp = inp;				/* Backup */
-		}
-		
-		/* Need to move CI? */
-		if (ucp != cip)
-			BCOPY(cip, ucp, cilen);	/* Move it */
-		
-		/* Update output pointer */
-		INCPTR(cilen, ucp);
-	}
-	
-	/*
-	 * If we aren't rejecting this packet, and we want to negotiate
-	 * their address, and they didn't send their address, then we
-	 * send a NAK with a CI_ADDR option appended.  We assume the
-	 * input buffer is long enough that we can append the extra
-	 * option safely.
-	 */
-	if (rc != CONFREJ && !ho->neg_addr &&
-			wo->req_addr && !reject_if_disagree) {
-		IPCPDEBUG((LOG_INFO, "ipcp_reqci: Requesting peer address\n"));
-		if (rc == CONFACK) {
-			rc = CONFNAK;
-			ucp = inp;				/* reset pointer */
-			wo->req_addr = 0;		/* don't ask again */
-		}
-		PUTCHAR(CI_ADDR, ucp);
-		PUTCHAR(CILEN_ADDR, ucp);
-		tl = ntohl(wo->hisaddr);
-		PUTLONG(tl, ucp);
-	}
-	
-	*len = (int)(ucp - inp);		/* Compute output length */
-	IPCPDEBUG((LOG_INFO, "ipcp_reqci: returning Configure-%s\n", CODENAME(rc)));
-	return (rc);			/* Return final code */
-}
-
-
-#if 0
-/*
- * ip_check_options - check that any IP-related options are OK,
- * and assign appropriate defaults.
- */
-static void ip_check_options(u_long localAddr)
-{
-	ipcp_options *wo = &ipcp_wantoptions[0];
-
-	/*
-	 * Load our default IP address but allow the remote host to give us
-	 * a new address.
-	 */
-	if (wo->ouraddr == 0 && !ppp_settings.disable_defaultip) {
-		wo->accept_local = 1;	/* don't insist on this default value */
-		wo->ouraddr = htonl(localAddr);
-	}
-}
-#endif
-
-
-/*
- * ipcp_up - IPCP has come UP.
- *
- * Configure the IP network interface appropriately and bring it up.
- */
-static void ipcp_up(fsm *f)
-{
-	u32_t mask;
-	ipcp_options *ho = &ipcp_hisoptions[f->unit];
-	ipcp_options *go = &ipcp_gotoptions[f->unit];
-	ipcp_options *wo = &ipcp_wantoptions[f->unit];
-	
-	np_up(f->unit, PPP_IP);
-	IPCPDEBUG((LOG_INFO, "ipcp: up\n"));
-	
-	/*
-	 * We must have a non-zero IP address for both ends of the link.
-	 */
-	if (!ho->neg_addr)
-		ho->hisaddr = wo->hisaddr;
-	
-	if (ho->hisaddr == 0) {
-		IPCPDEBUG((LOG_ERR, "Could not determine remote IP address\n"));
-		ipcp_close(f->unit, "Could not determine remote IP address");
-		return;
-	}
-	if (go->ouraddr == 0) {
-		IPCPDEBUG((LOG_ERR, "Could not determine local IP address\n"));
-		ipcp_close(f->unit, "Could not determine local IP address");
-		return;
-	}
-	
-	if (ppp_settings.usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) {
-		/*pppGotDNSAddrs(go->dnsaddr[0], go->dnsaddr[1]);*/
-	}
-
-	/*
-	 * Check that the peer is allowed to use the IP address it wants.
-	 */
-	if (!auth_ip_addr(f->unit, ho->hisaddr)) {
-		IPCPDEBUG((LOG_ERR, "Peer is not authorized to use remote address %s\n",
-				inet_ntoa(ho->hisaddr)));
-		ipcp_close(f->unit, "Unauthorized remote IP address");
-		return;
-	}
-	
-	/* set tcp compression */
-	sifvjcomp(f->unit, ho->neg_vj, ho->cflag, ho->maxslotindex);
-	
-	/*
-	 * Set IP addresses and (if specified) netmask.
-	 */
-	mask = GetMask(go->ouraddr);
-	
-	if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask, go->dnsaddr[0], go->dnsaddr[1])) {
-		IPCPDEBUG((LOG_WARNING, "sifaddr failed\n"));
-		ipcp_close(f->unit, "Interface configuration failed");
-		return;
-	}
-	
-	/* bring the interface up for IP */
-	if (!sifup(f->unit)) {
-		IPCPDEBUG((LOG_WARNING, "sifup failed\n"));
-		ipcp_close(f->unit, "Interface configuration failed");
-		return;
-	}
-	
-	sifnpmode(f->unit, PPP_IP, NPMODE_PASS);
-	
-	/* assign a default route through the interface if required */
-	if (ipcp_wantoptions[f->unit].default_route) 
-		if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr))
-			default_route_set[f->unit] = 1;
-	
-	IPCPDEBUG((LOG_NOTICE, "local  IP address %s\n", inet_ntoa(go->ouraddr)));
-	IPCPDEBUG((LOG_NOTICE, "remote IP address %s\n", inet_ntoa(ho->hisaddr)));
-	if (go->dnsaddr[0]) {
-		IPCPDEBUG((LOG_NOTICE, "primary   DNS address %s\n", inet_ntoa(go->dnsaddr[0])));
-	}
-	if (go->dnsaddr[1]) {
-		IPCPDEBUG((LOG_NOTICE, "secondary DNS address %s\n", inet_ntoa(go->dnsaddr[1])));
-	}
-}
-
-
-/*
- * ipcp_down - IPCP has gone DOWN.
- *
- * Take the IP network interface down, clear its addresses
- * and delete routes through it.
- */
-static void ipcp_down(fsm *f)
-{
-	IPCPDEBUG((LOG_INFO, "ipcp: down\n"));
-	np_down(f->unit, PPP_IP);
-	sifvjcomp(f->unit, 0, 0, 0);
-	
-	sifdown(f->unit);
-	ipcp_clear_addrs(f->unit);
-}
-
-
-/*
- * ipcp_clear_addrs() - clear the interface addresses, routes, etc.
- */
-static void ipcp_clear_addrs(int unit)
-{
-	u32_t ouraddr, hisaddr;
-	
-	ouraddr = ipcp_gotoptions[unit].ouraddr;
-	hisaddr = ipcp_hisoptions[unit].hisaddr;
-	if (default_route_set[unit]) {
-		cifdefaultroute(unit, ouraddr, hisaddr);
-		default_route_set[unit] = 0;
-	}
-	cifaddr(unit, ouraddr, hisaddr);
-}
-
-
-/*
- * ipcp_finished - possibly shut down the lower layers.
- */
-static void ipcp_finished(fsm *f)
-{
-	np_finished(f->unit, PPP_IP);
-}
-
-#if 0
-static int ipcp_printpkt(
-	u_char *p,
-	int plen,
-	void (*printer) (void *, char *, ...),
-	void *arg
-)
-{
-	(void)p;
-	(void)plen;
-	(void)printer;
-	(void)arg;
-	return 0;
-}
-
-/*
- * ip_active_pkt - see if this IP packet is worth bringing the link up for.
- * We don't bring the link up for IP fragments or for TCP FIN packets
- * with no data.
- */
-#define IP_HDRLEN	20	/* bytes */
-#define IP_OFFMASK	0x1fff
-#define IPPROTO_TCP	6
-#define TCP_HDRLEN	20
-#define TH_FIN		0x01
-
-/*
- * We use these macros because the IP header may be at an odd address,
- * and some compilers might use word loads to get th_off or ip_hl.
- */
-
-#define net_short(x)	(((x)[0] << 8) + (x)[1])
-#define get_iphl(x)	(((unsigned char *)(x))[0] & 0xF)
-#define get_ipoff(x)	net_short((unsigned char *)(x) + 6)
-#define get_ipproto(x)	(((unsigned char *)(x))[9])
-#define get_tcpoff(x)	(((unsigned char *)(x))[12] >> 4)
-#define get_tcpflags(x)	(((unsigned char *)(x))[13])
-
-static int ip_active_pkt(u_char *pkt, int len)
-{
-	u_char *tcp;
-	int hlen;
-	
-	len -= PPP_HDRLEN;
-	pkt += PPP_HDRLEN;
-	if (len < IP_HDRLEN)
-		return 0;
-	if ((get_ipoff(pkt) & IP_OFFMASK) != 0)
-		return 0;
-	if (get_ipproto(pkt) != IPPROTO_TCP)
-		return 1;
-	hlen = get_iphl(pkt) * 4;
-	if (len < hlen + TCP_HDRLEN)
-		return 0;
-	tcp = pkt + hlen;
-	if ((get_tcpflags(tcp) & TH_FIN) != 0 && len == hlen + get_tcpoff(tcp) * 4)
-		return 0;
-	return 1;
-}
-#endif
-
-#endif /* PPP_SUPPORT */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.h
deleted file mode 100644
index d96c02e..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/ipcp.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
-* ipcp.h -  PPP IP NCP: Internet Protocol Network Control Protocol header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-04 Guy Lancaster <glanca at gesn.com>, Global Election Systems Inc.
-*	Original derived from BSD codes.
-*****************************************************************************/
-/*
- * ipcp.h - IP Control Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id: ipcp.h $
- */
-
-#ifndef IPCP_H
-#define IPCP_H
-
-/*************************
-*** PUBLIC DEFINITIONS ***
-*************************/
-/*
- * Options.
- */
-#define CI_ADDRS	1			/* IP Addresses */
-#define CI_COMPRESSTYPE	2		/* Compression Type */
-#define	CI_ADDR		3
-
-#define CI_MS_WINS1	128			/* Primary WINS value */
-#define CI_MS_DNS1	129			/* Primary DNS value */
-#define CI_MS_WINS2	130			/* Secondary WINS value */
-#define CI_MS_DNS2	131			/* Secondary DNS value */
-
-#define IPCP_VJMODE_OLD 1		/* "old" mode (option # = 0x0037) */
-#define IPCP_VJMODE_RFC1172 2	/* "old-rfc"mode (option # = 0x002d) */
-#define IPCP_VJMODE_RFC1332 3	/* "new-rfc"mode (option # = 0x002d, */
-                                /*  maxslot and slot number compression) */
-
-#define IPCP_VJ_COMP 0x002d		/* current value for VJ compression option*/
-#define IPCP_VJ_COMP_OLD 0x0037	/* "old" (i.e, broken) value for VJ */
-								/* compression option*/ 
-
-
-/************************
-*** PUBLIC DATA TYPES ***
-************************/
-
-typedef struct ipcp_options {
-    u_int neg_addr : 1;			/* Negotiate IP Address? */
-    u_int old_addrs : 1;			/* Use old (IP-Addresses) option? */
-    u_int req_addr : 1;			/* Ask peer to send IP address? */
-    u_int default_route : 1;		/* Assign default route through interface? */
-    u_int proxy_arp : 1;			/* Make proxy ARP entry for peer? */
-    u_int neg_vj : 1;				/* Van Jacobson Compression? */
-    u_int old_vj : 1;				/* use old (short) form of VJ option? */
-    u_int accept_local : 1;		/* accept peer's value for ouraddr */
-    u_int accept_remote : 1;		/* accept peer's value for hisaddr */
-    u_int req_dns1 : 1;			/* Ask peer to send primary DNS address? */
-    u_int req_dns2 : 1;			/* Ask peer to send secondary DNS address? */
-    u_short vj_protocol;		/* protocol value to use in VJ option */
-    u_char maxslotindex;		/* VJ slots - 1. */
-    u_char cflag;				/* VJ slot compression flag. */
-    u32_t ouraddr, hisaddr;	/* Addresses in NETWORK BYTE ORDER */
-    u32_t dnsaddr[2];		/* Primary and secondary MS DNS entries */
-    u32_t winsaddr[2];		/* Primary and secondary MS WINS entries */
-} ipcp_options;
-
-
-/*****************************
-*** PUBLIC DATA STRUCTURES ***
-*****************************/
-
-extern fsm ipcp_fsm[];
-extern ipcp_options ipcp_wantoptions[];
-extern ipcp_options ipcp_gotoptions[];
-extern ipcp_options ipcp_allowoptions[];
-extern ipcp_options ipcp_hisoptions[];
-
-extern struct protent ipcp_protent;
-
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-
-
-#endif /* IPCP_H */
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.c
deleted file mode 100644
index 6a988d6..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.c
+++ /dev/null
@@ -1,1991 +0,0 @@
-/*****************************************************************************
-* lcp.c - Network Link Control Protocol program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 by Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-01 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original.
-*****************************************************************************/
-
-/*
- * lcp.c - PPP Link Control Protocol.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
- 
-#include <string.h>
- 
-#include "ppp.h"
-#if PPP_SUPPORT > 0
-#include "fsm.h"
-#include "chap.h"
-#include "magic.h"
-#include "auth.h"
-#include "lcp.h"
-#include "pppdebug.h"
-
-
-/*************************/
-/*** LOCAL DEFINITIONS ***/
-/*************************/
-/*
- * Length of each type of configuration option (in octets)
- */
-#define CILEN_VOID	2
-#define CILEN_CHAR	3
-#define CILEN_SHORT	4	/* CILEN_VOID + sizeof(short) */
-#define CILEN_CHAP	5	/* CILEN_VOID + sizeof(short) + 1 */
-#define CILEN_LONG	6	/* CILEN_VOID + sizeof(long) */
-#define CILEN_LQR	8	/* CILEN_VOID + sizeof(short) + sizeof(long) */
-#define CILEN_CBCP	3
-
-
-/***********************************/
-/*** LOCAL FUNCTION DECLARATIONS ***/
-/***********************************/
-/*
- * Callbacks for fsm code.  (CI = Configuration Information)
- */
-static void lcp_resetci (fsm*);	        /* Reset our CI */
-static int  lcp_cilen (fsm*);		        /* Return length of our CI */
-static void lcp_addci (fsm*, u_char*, int*);       /* Add our CI to pkt */
-static int  lcp_ackci (fsm*, u_char*, int);/* Peer ack'd our CI */
-static int  lcp_nakci (fsm*, u_char*, int);/* Peer nak'd our CI */
-static int  lcp_rejci (fsm*, u_char*, int);/* Peer rej'd our CI */
-static int  lcp_reqci (fsm*, u_char*, int*, int);  /* Rcv peer CI */
-static void lcp_up (fsm*);		            /* We're UP */
-static void lcp_down (fsm*);	    	    /* We're DOWN */
-static void lcp_starting (fsm*);   	    /* We need lower layer up */
-static void lcp_finished (fsm*);	        /* We need lower layer down */
-static int  lcp_extcode (fsm*, int, u_char, u_char*, int);
-
-static void lcp_rprotrej (fsm*, u_char*, int);
-
-/*
- * routines to send LCP echos to peer
- */
-static void lcp_echo_lowerup (int);
-static void lcp_echo_lowerdown (int);
-static void LcpEchoTimeout (void*);
-static void lcp_received_echo_reply (fsm*, int, u_char*, int);
-static void LcpSendEchoRequest (fsm*);
-static void LcpLinkFailure (fsm*);
-static void LcpEchoCheck (fsm*);
-
-/*
- * Protocol entry points.
- * Some of these are called directly.
- */
-static void lcp_input (int, u_char *, int);
-static void lcp_protrej (int);
-
-#define CODENAME(x)	((x) == CONFACK ? "ACK" : \
-			 (x) == CONFNAK ? "NAK" : "REJ")
-
-
-/******************************/
-/*** PUBLIC DATA STRUCTURES ***/
-/******************************/
-/* global vars */
-LinkPhase lcp_phase[NUM_PPP];			/* Phase of link session (RFC 1661) */
-lcp_options lcp_wantoptions[NUM_PPP];	/* Options that we want to request */
-lcp_options lcp_gotoptions[NUM_PPP];	/* Options that peer ack'd */
-lcp_options lcp_allowoptions[NUM_PPP];	/* Options we allow peer to request */
-lcp_options lcp_hisoptions[NUM_PPP];	/* Options that we ack'd */
-ext_accm xmit_accm[NUM_PPP];			/* extended transmit ACCM */
-
-
-
-/*****************************/
-/*** LOCAL DATA STRUCTURES ***/
-/*****************************/
-static fsm lcp_fsm[NUM_PPP];			/* LCP fsm structure (global)*/
-static u_int	 lcp_echo_interval = LCP_ECHOINTERVAL; /* Interval between LCP echo-requests */
-static u_int	 lcp_echo_fails = LCP_MAXECHOFAILS; /* Tolerance to unanswered echo-requests */
-static u32_t lcp_echos_pending = 0;	/* Number of outstanding echo msgs */
-static u32_t lcp_echo_number   = 0;	/* ID number of next echo frame */
-static u32_t lcp_echo_timer_running = 0;  /* TRUE if a timer is running */
-
-static u_char nak_buffer[PPP_MRU];	/* where we construct a nak packet */
-
-static fsm_callbacks lcp_callbacks = {	/* LCP callback routines */
-    lcp_resetci,		/* Reset our Configuration Information */
-    lcp_cilen,			/* Length of our Configuration Information */
-    lcp_addci,			/* Add our Configuration Information */
-    lcp_ackci,			/* ACK our Configuration Information */
-    lcp_nakci,			/* NAK our Configuration Information */
-    lcp_rejci,			/* Reject our Configuration Information */
-    lcp_reqci,			/* Request peer's Configuration Information */
-    lcp_up,				/* Called when fsm reaches OPENED state */
-    lcp_down,			/* Called when fsm leaves OPENED state */
-    lcp_starting,		/* Called when we want the lower layer up */
-    lcp_finished,		/* Called when we want the lower layer down */
-    NULL,				/* Called when Protocol-Reject received */
-    NULL,				/* Retransmission is necessary */
-    lcp_extcode,		/* Called to handle LCP-specific codes */
-    "LCP"				/* String name of protocol */
-};
-
-struct protent lcp_protent = {
-    PPP_LCP,
-    lcp_init,
-    lcp_input,
-    lcp_protrej,
-    lcp_lowerup,
-    lcp_lowerdown,
-    lcp_open,
-    lcp_close,
-#if 0
-    lcp_printpkt,
-    NULL,
-#endif
-    1,
-    "LCP",
-#if 0
-    NULL,
-    NULL,
-    NULL
-#endif
-};
-
-int lcp_loopbackfail = DEFLOOPBACKFAIL;
-
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-/*
- * lcp_init - Initialize LCP.
- */
-void lcp_init(int unit)
-{
-	fsm *f = &lcp_fsm[unit];
-	lcp_options *wo = &lcp_wantoptions[unit];
-	lcp_options *ao = &lcp_allowoptions[unit];
-	
-	f->unit = unit;
-	f->protocol = PPP_LCP;
-	f->callbacks = &lcp_callbacks;
-	
-	fsm_init(f);
-	
-	wo->passive = 0;
-	wo->silent = 0;
-	wo->restart = 0;			/* Set to 1 in kernels or multi-line
-								 * implementations */
-	wo->neg_mru = 1;
-	wo->mru = PPP_DEFMRU;
-	wo->neg_asyncmap = 1;
-	wo->asyncmap = 0x00000000l;	/* Assume don't need to escape any ctl chars. */
-	wo->neg_chap = 0;			/* Set to 1 on server */
-	wo->neg_upap = 0;			/* Set to 1 on server */
-	wo->chap_mdtype = CHAP_DIGEST_MD5;
-	wo->neg_magicnumber = 1;
-	wo->neg_pcompression = 1;
-	wo->neg_accompression = 1;
-	wo->neg_lqr = 0;			/* no LQR implementation yet */
-	wo->neg_cbcp = 0;
-	
-	ao->neg_mru = 1;
-	ao->mru = PPP_MAXMRU;
-	ao->neg_asyncmap = 1;
-	ao->asyncmap = 0x00000000l;	/* Assume don't need to escape any ctl chars. */
-	ao->neg_chap = (CHAP_SUPPORT != 0);
-	ao->chap_mdtype = CHAP_DIGEST_MD5;
-	ao->neg_upap = (PAP_SUPPORT != 0);
-	ao->neg_magicnumber = 1;
-	ao->neg_pcompression = 1;
-	ao->neg_accompression = 1;
-	ao->neg_lqr = 0;			/* no LQR implementation yet */
-	ao->neg_cbcp = (CBCP_SUPPORT != 0);
-
-	/* 
-	 * Set transmit escape for the flag and escape characters plus anything
-	 * set for the allowable options.
-	 */
-	memset(xmit_accm[unit], 0, sizeof(xmit_accm[0]));
-	xmit_accm[unit][15] = 0x60;
-	xmit_accm[unit][0] = (u_char)(ao->asyncmap & 0xFF);
-	xmit_accm[unit][1] = (u_char)((ao->asyncmap >> 8) & 0xFF);
-	xmit_accm[unit][2] = (u_char)((ao->asyncmap >> 16) & 0xFF);
-	xmit_accm[unit][3] = (u_char)((ao->asyncmap >> 24) & 0xFF);
-	LCPDEBUG((LOG_INFO, "lcp_init: xmit_accm=%X %X %X %X\n",
-				xmit_accm[unit][0],
-				xmit_accm[unit][1],
-				xmit_accm[unit][2],
-				xmit_accm[unit][3]));
-	
-	lcp_phase[unit] = PHASE_INITIALIZE;
-}
-
-
-/*
- * lcp_open - LCP is allowed to come up.
- */
-void lcp_open(int unit)
-{
-	fsm *f = &lcp_fsm[unit];
-	lcp_options *wo = &lcp_wantoptions[unit];
-	
-	f->flags = 0;
-	if (wo->passive)
-		f->flags |= OPT_PASSIVE;
-	if (wo->silent)
-		f->flags |= OPT_SILENT;
-	fsm_open(f);
-	
-	lcp_phase[unit] = PHASE_ESTABLISH; 
-}
-
-
-/*
- * lcp_close - Take LCP down.
- */
-void lcp_close(int unit, char *reason)
-{
-	fsm *f = &lcp_fsm[unit];
-	
-	if (lcp_phase[unit] != PHASE_DEAD)
-		lcp_phase[unit] = PHASE_TERMINATE;
-	if (f->state == STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) {
-		/*
-		 * This action is not strictly according to the FSM in RFC1548,
-		 * but it does mean that the program terminates if you do an
-		 * lcp_close() in passive/silent mode when a connection hasn't
-		 * been established.
-		 */
-		f->state = CLOSED;
-		lcp_finished(f);
-	}
-	else
-		fsm_close(&lcp_fsm[unit], reason);
-}
-
-
-/*
- * lcp_lowerup - The lower layer is up.
- */
-void lcp_lowerup(int unit)
-{
-	lcp_options *wo = &lcp_wantoptions[unit];
-	
-	/*
-	* Don't use A/C or protocol compression on transmission,
-	* but accept A/C and protocol compressed packets
-	* if we are going to ask for A/C and protocol compression.
-	*/
-	ppp_set_xaccm(unit, &xmit_accm[unit]);
-	ppp_send_config(unit, PPP_MRU, 0xffffffffl, 0, 0);
-	ppp_recv_config(unit, PPP_MRU, 0x00000000l,
-					wo->neg_pcompression, wo->neg_accompression);
-	peer_mru[unit] = PPP_MRU;
-	lcp_allowoptions[unit].asyncmap 
-		= (u_long)xmit_accm[unit][0]
-			| ((u_long)xmit_accm[unit][1] << 8)
-			| ((u_long)xmit_accm[unit][2] << 16)
-			| ((u_long)xmit_accm[unit][3] << 24);
-	LCPDEBUG((LOG_INFO, "lcp_lowerup: asyncmap=%X %X %X %X\n",
-				xmit_accm[unit][3],
-				xmit_accm[unit][2],
-				xmit_accm[unit][1],
-				xmit_accm[unit][0]));
-	
-	fsm_lowerup(&lcp_fsm[unit]);
-}
-
-
-/*
- * lcp_lowerdown - The lower layer is down.
- */
-void lcp_lowerdown(int unit)
-{
-	fsm_lowerdown(&lcp_fsm[unit]);
-}
-
-/*
- * lcp_sprotrej - Send a Protocol-Reject for some protocol.
- */
-void lcp_sprotrej(int unit, u_char *p, int len)
-{
-	/*
-	* Send back the protocol and the information field of the
-	* rejected packet.  We only get here if LCP is in the OPENED state.
-	*/
-
-	fsm_sdata(&lcp_fsm[unit], PROTREJ, ++lcp_fsm[unit].id,
-				p, len);
-}
-
-
-
-/**********************************/
-/*** LOCAL FUNCTION DEFINITIONS ***/
-/**********************************/
-/*
- * lcp_input - Input LCP packet.
- */
-static void lcp_input(int unit, u_char *p, int len)
-{
-	fsm *f = &lcp_fsm[unit];
-	
-	fsm_input(f, p, len);
-}
-
-
-/*
- * lcp_extcode - Handle a LCP-specific code.
- */
-static int lcp_extcode(fsm *f, int code, u_char id, u_char *inp, int len)
-{
-	u_char *magp;
-	
-	switch( code ){
-	case PROTREJ:
-		lcp_rprotrej(f, inp, len);
-		break;
-	
-	case ECHOREQ:
-		if (f->state != OPENED)
-			break;
-		LCPDEBUG((LOG_INFO, "lcp: Echo-Request, Rcvd id %d\n", id));
-		magp = inp;
-		PUTLONG(lcp_gotoptions[f->unit].magicnumber, magp);
-		fsm_sdata(f, ECHOREP, id, inp, len);
-		break;
-	
-	case ECHOREP:
-		lcp_received_echo_reply(f, id, inp, len);
-		break;
-	
-	case DISCREQ:
-		break;
-	
-	default:
-		return 0;
-	}
-	return 1;
-}
-
-    
-/*
- * lcp_rprotrej - Receive an Protocol-Reject.
- *
- * Figure out which protocol is rejected and inform it.
- */
-static void lcp_rprotrej(fsm *f, u_char *inp, int len)
-{
-	int i;
-	struct protent *protp;
-	u_short prot;
-	
-	if (len < sizeof (u_short)) {
-		LCPDEBUG((LOG_INFO,
-				"lcp_rprotrej: Rcvd short Protocol-Reject packet!\n"));
-		return;
-	}
-	
-	GETSHORT(prot, inp);
-	
-	LCPDEBUG((LOG_INFO,
-			"lcp_rprotrej: Rcvd Protocol-Reject packet for %x!\n",
-			prot));
-	
-	/*
-	* Protocol-Reject packets received in any state other than the LCP
-	* OPENED state SHOULD be silently discarded.
-	*/
-	if( f->state != OPENED ){
-		LCPDEBUG((LOG_INFO, "Protocol-Reject discarded: LCP in state %d\n",
-				f->state));
-		return;
-	}
-	
-	/*
-	* Upcall the proper Protocol-Reject routine.
-	*/
-	for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i)
-		if (protp->protocol == prot && protp->enabled_flag) {
-			(*protp->protrej)(f->unit);
-			return;
-		}
-	
-	LCPDEBUG((LOG_WARNING, "Protocol-Reject for unsupported protocol 0x%x\n",
-			prot));
-}
-
-
-/*
- * lcp_protrej - A Protocol-Reject was received.
- */
-static void lcp_protrej(int unit)
-{
-	(void)unit;
-	/*
-	* Can't reject LCP!
-	*/
-	LCPDEBUG((LOG_WARNING,
-			"lcp_protrej: Received Protocol-Reject for LCP!\n"));
-	fsm_protreject(&lcp_fsm[unit]);
-}
-
-
-/*
- * lcp_resetci - Reset our CI.
- */
-static void lcp_resetci(fsm *f)
-{
-	lcp_wantoptions[f->unit].magicnumber = magic();
-	lcp_wantoptions[f->unit].numloops = 0;
-	lcp_gotoptions[f->unit] = lcp_wantoptions[f->unit];
-	peer_mru[f->unit] = PPP_MRU;
-	auth_reset(f->unit);
-}
-
-
-/*
- * lcp_cilen - Return length of our CI.
- */
-static int lcp_cilen(fsm *f)
-{
-	lcp_options *go = &lcp_gotoptions[f->unit];
-
-#define LENCIVOID(neg)	((neg) ? CILEN_VOID : 0)
-#define LENCICHAP(neg)	((neg) ? CILEN_CHAP : 0)
-#define LENCISHORT(neg)	((neg) ? CILEN_SHORT : 0)
-#define LENCILONG(neg)	((neg) ? CILEN_LONG : 0)
-#define LENCILQR(neg)	((neg) ? CILEN_LQR: 0)
-#define LENCICBCP(neg)	((neg) ? CILEN_CBCP: 0)
-	/*
-	* NB: we only ask for one of CHAP and UPAP, even if we will
-	* accept either.
-	*/
-	return (LENCISHORT(go->neg_mru && go->mru != PPP_DEFMRU) +
-		LENCILONG(go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl) +
-		LENCICHAP(go->neg_chap) +
-		LENCISHORT(!go->neg_chap && go->neg_upap) +
-		LENCILQR(go->neg_lqr) +
-		LENCICBCP(go->neg_cbcp) +
-		LENCILONG(go->neg_magicnumber) +
-		LENCIVOID(go->neg_pcompression) +
-		LENCIVOID(go->neg_accompression));
-}
-
-
-/*
- * lcp_addci - Add our desired CIs to a packet.
- */
-static void lcp_addci(fsm *f, u_char *ucp, int *lenp)
-{
-	lcp_options *go = &lcp_gotoptions[f->unit];
-	u_char *start_ucp = ucp;
-	
-#define ADDCIVOID(opt, neg) \
-	if (neg) { \
-	    LCPDEBUG((LOG_INFO, "lcp_addci: opt=%d\n", opt)); \
-		PUTCHAR(opt, ucp); \
-		PUTCHAR(CILEN_VOID, ucp); \
-	}
-#define ADDCISHORT(opt, neg, val) \
-	if (neg) { \
-	    LCPDEBUG((LOG_INFO, "lcp_addci: INT opt=%d %X\n", opt, val)); \
-		PUTCHAR(opt, ucp); \
-		PUTCHAR(CILEN_SHORT, ucp); \
-		PUTSHORT(val, ucp); \
-	}
-#define ADDCICHAP(opt, neg, val, digest) \
-	if (neg) { \
-	    LCPDEBUG((LOG_INFO, "lcp_addci: CHAP opt=%d %X\n", opt, val)); \
-		PUTCHAR(opt, ucp); \
-		PUTCHAR(CILEN_CHAP, ucp); \
-		PUTSHORT(val, ucp); \
-		PUTCHAR(digest, ucp); \
-	}
-#define ADDCILONG(opt, neg, val) \
-	if (neg) { \
-	    LCPDEBUG((LOG_INFO, "lcp_addci: L opt=%d %lX\n", opt, val)); \
-		PUTCHAR(opt, ucp); \
-		PUTCHAR(CILEN_LONG, ucp); \
-		PUTLONG(val, ucp); \
-	}
-#define ADDCILQR(opt, neg, val) \
-	if (neg) { \
-	    LCPDEBUG((LOG_INFO, "lcp_addci: LQR opt=%d %lX\n", opt, val)); \
-		PUTCHAR(opt, ucp); \
-		PUTCHAR(CILEN_LQR, ucp); \
-		PUTSHORT(PPP_LQR, ucp); \
-		PUTLONG(val, ucp); \
-	}
-#define ADDCICHAR(opt, neg, val) \
-	if (neg) { \
-	    LCPDEBUG((LOG_INFO, "lcp_addci: CHAR opt=%d %X '%z'\n", opt, val, val)); \
-		PUTCHAR(opt, ucp); \
-		PUTCHAR(CILEN_CHAR, ucp); \
-		PUTCHAR(val, ucp); \
-	}
-	
-	ADDCISHORT(CI_MRU, go->neg_mru && go->mru != PPP_DEFMRU, go->mru);
-	ADDCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl,
-			go->asyncmap);
-	ADDCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype);
-	ADDCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP);
-	ADDCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
-	ADDCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
-	ADDCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
-	ADDCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
-	ADDCIVOID(CI_ACCOMPRESSION, go->neg_accompression);
-	
-	if (ucp - start_ucp != *lenp) {
-		/* this should never happen, because peer_mtu should be 1500 */
-		LCPDEBUG((LOG_ERR, "Bug in lcp_addci: wrong length\n"));
-	}
-}
-
-
-/*
- * lcp_ackci - Ack our CIs.
- * This should not modify any state if the Ack is bad.
- *
- * Returns:
- *	0 - Ack was bad.
- *	1 - Ack was good.
- */
-static int lcp_ackci(fsm *f, u_char *p, int len)
-{
-	lcp_options *go = &lcp_gotoptions[f->unit];
-	u_char cilen, citype, cichar;
-	u_short cishort;
-	u32_t cilong;
-	
-	/*
-	* CIs must be in exactly the same order that we sent.
-	* Check packet length and CI length at each step.
-	* If we find any deviations, then this packet is bad.
-	*/
-#define ACKCIVOID(opt, neg) \
-	if (neg) { \
-		if ((len -= CILEN_VOID) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != CILEN_VOID || \
-				citype != opt) \
-			goto bad; \
-	}
-#define ACKCISHORT(opt, neg, val) \
-	if (neg) { \
-		if ((len -= CILEN_SHORT) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != CILEN_SHORT || \
-				citype != opt) \
-			goto bad; \
-		GETSHORT(cishort, p); \
-		if (cishort != val) \
-			goto bad; \
-	}
-#define ACKCICHAR(opt, neg, val) \
-	if (neg) { \
-		if ((len -= CILEN_CHAR) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != CILEN_CHAR || \
-				citype != opt) \
-			goto bad; \
-		GETCHAR(cichar, p); \
-		if (cichar != val) \
-			goto bad; \
-	}
-#define ACKCICHAP(opt, neg, val, digest) \
-	if (neg) { \
-		if ((len -= CILEN_CHAP) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != CILEN_CHAP || \
-				citype != opt) \
-			goto bad; \
-		GETSHORT(cishort, p); \
-		if (cishort != val) \
-			goto bad; \
-		GETCHAR(cichar, p); \
-		if (cichar != digest) \
-			goto bad; \
-	}
-#define ACKCILONG(opt, neg, val) \
-	if (neg) { \
-		if ((len -= CILEN_LONG) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != CILEN_LONG || \
-				citype != opt) \
-			goto bad; \
-		GETLONG(cilong, p); \
-		if (cilong != val) \
-			goto bad; \
-	}
-#define ACKCILQR(opt, neg, val) \
-	if (neg) { \
-		if ((len -= CILEN_LQR) < 0) \
-			goto bad; \
-		GETCHAR(citype, p); \
-		GETCHAR(cilen, p); \
-		if (cilen != CILEN_LQR || \
-				citype != opt) \
-			goto bad; \
-		GETSHORT(cishort, p); \
-		if (cishort != PPP_LQR) \
-			goto bad; \
-		GETLONG(cilong, p); \
-		if (cilong != val) \
-			goto bad; \
-	}
-	
-	ACKCISHORT(CI_MRU, go->neg_mru && go->mru != PPP_DEFMRU, go->mru);
-	ACKCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl,
-			go->asyncmap);
-	ACKCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype);
-	ACKCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP);
-	ACKCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
-	ACKCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
-	ACKCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
-	ACKCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
-	ACKCIVOID(CI_ACCOMPRESSION, go->neg_accompression);
-	
-	/*
-	 * If there are any remaining CIs, then this packet is bad.
-	 */
-	if (len != 0)
-		goto bad;
-	LCPDEBUG((LOG_INFO, "lcp_acki: Ack\n"));
-	return (1);
-bad:
-	LCPDEBUG((LOG_WARNING, "lcp_acki: received bad Ack!\n"));
-	return (0);
-}
-
-
-/*
- * lcp_nakci - Peer has sent a NAK for some of our CIs.
- * This should not modify any state if the Nak is bad
- * or if LCP is in the OPENED state.
- *
- * Returns:
- *	0 - Nak was bad.
- *	1 - Nak was good.
- */
-static int lcp_nakci(fsm *f, u_char *p, int len)
-{
-	lcp_options *go = &lcp_gotoptions[f->unit];
-	lcp_options *wo = &lcp_wantoptions[f->unit];
-	u_char citype, cichar, *next;
-	u_short cishort;
-	u32_t cilong;
-	lcp_options no;		/* options we've seen Naks for */
-	lcp_options try;		/* options to request next time */
-	int looped_back = 0;
-	int cilen;
-	
-	BZERO(&no, sizeof(no));
-	try = *go;
-	
-	/*
-	* Any Nak'd CIs must be in exactly the same order that we sent.
-	* Check packet length and CI length at each step.
-	* If we find any deviations, then this packet is bad.
-	*/
-#define NAKCIVOID(opt, neg, code) \
-	if (go->neg && \
-			len >= CILEN_VOID && \
-			p[1] == CILEN_VOID && \
-			p[0] == opt) { \
-		len -= CILEN_VOID; \
-		INCPTR(CILEN_VOID, p); \
-		no.neg = 1; \
-		code \
-	}
-#define NAKCICHAP(opt, neg, code) \
-	if (go->neg && \
-			len >= CILEN_CHAP && \
-			p[1] == CILEN_CHAP && \
-			p[0] == opt) { \
-		len -= CILEN_CHAP; \
-		INCPTR(2, p); \
-		GETSHORT(cishort, p); \
-		GETCHAR(cichar, p); \
-		no.neg = 1; \
-		code \
-	}
-#define NAKCICHAR(opt, neg, code) \
-	if (go->neg && \
-			len >= CILEN_CHAR && \
-			p[1] == CILEN_CHAR && \
-			p[0] == opt) { \
-		len -= CILEN_CHAR; \
-		INCPTR(2, p); \
-		GETCHAR(cichar, p); \
-		no.neg = 1; \
-		code \
-	}
-#define NAKCISHORT(opt, neg, code) \
-	if (go->neg && \
-			len >= CILEN_SHORT && \
-			p[1] == CILEN_SHORT && \
-			p[0] == opt) { \
-		len -= CILEN_SHORT; \
-		INCPTR(2, p); \
-		GETSHORT(cishort, p); \
-		no.neg = 1; \
-		code \
-	}
-#define NAKCILONG(opt, neg, code) \
-	if (go->neg && \
-			len >= CILEN_LONG && \
-			p[1] == CILEN_LONG && \
-			p[0] == opt) { \
-		len -= CILEN_LONG; \
-		INCPTR(2, p); \
-		GETLONG(cilong, p); \
-		no.neg = 1; \
-		code \
-	}
-#define NAKCILQR(opt, neg, code) \
-	if (go->neg && \
-			len >= CILEN_LQR && \
-			p[1] == CILEN_LQR && \
-			p[0] == opt) { \
-		len -= CILEN_LQR; \
-		INCPTR(2, p); \
-		GETSHORT(cishort, p); \
-		GETLONG(cilong, p); \
-		no.neg = 1; \
-		code \
-	}
-	
-	/*
-	* We don't care if they want to send us smaller packets than
-	* we want.  Therefore, accept any MRU less than what we asked for,
-	* but then ignore the new value when setting the MRU in the kernel.
-	* If they send us a bigger MRU than what we asked, accept it, up to
-	* the limit of the default MRU we'd get if we didn't negotiate.
-	*/
-	if (go->neg_mru && go->mru != PPP_DEFMRU) {
-		NAKCISHORT(CI_MRU, neg_mru,
-			if (cishort <= wo->mru || cishort < PPP_DEFMRU)
-				try.mru = cishort;
-		);
-	}
-	
-	/*
-	* Add any characters they want to our (receive-side) asyncmap.
-	*/
-	if (go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl) {
-		NAKCILONG(CI_ASYNCMAP, neg_asyncmap,
-			try.asyncmap = go->asyncmap | cilong;
-		);
-	}
-	
-	/*
-	* If they've nak'd our authentication-protocol, check whether
-	* they are proposing a different protocol, or a different
-	* hash algorithm for CHAP.
-	*/
-	if ((go->neg_chap || go->neg_upap)
-			&& len >= CILEN_SHORT
-			&& p[0] == CI_AUTHTYPE && p[1] >= CILEN_SHORT && p[1] <= len) {
-		cilen = p[1];
-	len -= cilen;
-	no.neg_chap = go->neg_chap;
-	no.neg_upap = go->neg_upap;
-	INCPTR(2, p);
-	GETSHORT(cishort, p);
-	if (cishort == PPP_PAP && cilen == CILEN_SHORT) {
-		/*
-		 * If we were asking for CHAP, they obviously don't want to do it.
-		 * If we weren't asking for CHAP, then we were asking for PAP,
-		 * in which case this Nak is bad.
-		 */
-		if (!go->neg_chap)
-			goto bad;
-		try.neg_chap = 0;
-	
-	} else if (cishort == PPP_CHAP && cilen == CILEN_CHAP) {
-		GETCHAR(cichar, p);
-		if (go->neg_chap) {
-			/*
-			 * We were asking for CHAP/MD5; they must want a different
-			 * algorithm.  If they can't do MD5, we'll have to stop
-			 * asking for CHAP.
-			 */
-			if (cichar != go->chap_mdtype)
-				try.neg_chap = 0;
-		} else {
-			/*
-			 * Stop asking for PAP if we were asking for it.
-			 */
-			try.neg_upap = 0;
-		}
-	
-	} else {
-		/*
-		 * We don't recognize what they're suggesting.
-		 * Stop asking for what we were asking for.
-		 */
-		if (go->neg_chap)
-			try.neg_chap = 0;
-		else
-			try.neg_upap = 0;
-		p += cilen - CILEN_SHORT;
-	}
-	}
-	
-	/*
-	* If they can't cope with our link quality protocol, we'll have
-	* to stop asking for LQR.  We haven't got any other protocol.
-	* If they Nak the reporting period, take their value XXX ?
-	*/
-	NAKCILQR(CI_QUALITY, neg_lqr,
-		if (cishort != PPP_LQR)
-			try.neg_lqr = 0;
-		else
-			try.lqr_period = cilong;
-	);
-	
-	/*
-	* Only implementing CBCP...not the rest of the callback options
-	*/
-	NAKCICHAR(CI_CALLBACK, neg_cbcp,
-		try.neg_cbcp = 0;
-	);
-	
-	/*
-	* Check for a looped-back line.
-	*/
-	NAKCILONG(CI_MAGICNUMBER, neg_magicnumber,
-		try.magicnumber = magic();
-		looped_back = 1;
-	);
-	
-	/*
-	* Peer shouldn't send Nak for protocol compression or
-	* address/control compression requests; they should send
-	* a Reject instead.  If they send a Nak, treat it as a Reject.
-	*/
-	NAKCIVOID(CI_PCOMPRESSION, neg_pcompression,
-		try.neg_pcompression = 0;
-	);
-	NAKCIVOID(CI_ACCOMPRESSION, neg_accompression,
-		try.neg_accompression = 0;
-	);
-	
-	/*
-	* There may be remaining CIs, if the peer is requesting negotiation
-	* on an option that we didn't include in our request packet.
-	* If we see an option that we requested, or one we've already seen
-	* in this packet, then this packet is bad.
-	* If we wanted to respond by starting to negotiate on the requested
-	* option(s), we could, but we don't, because except for the
-	* authentication type and quality protocol, if we are not negotiating
-	* an option, it is because we were told not to.
-	* For the authentication type, the Nak from the peer means
-	* `let me authenticate myself with you' which is a bit pointless.
-	* For the quality protocol, the Nak means `ask me to send you quality
-	* reports', but if we didn't ask for them, we don't want them.
-	* An option we don't recognize represents the peer asking to
-	* negotiate some option we don't support, so ignore it.
-	*/
-	while (len > CILEN_VOID) {
-		GETCHAR(citype, p);
-		GETCHAR(cilen, p);
-		if (cilen < CILEN_VOID || (len -= cilen) < 0)
-			goto bad;
-		next = p + cilen - 2;
-		
-		switch (citype) {
-		case CI_MRU:
-			if ((go->neg_mru && go->mru != PPP_DEFMRU)
-					|| no.neg_mru || cilen != CILEN_SHORT)
-				goto bad;
-			GETSHORT(cishort, p);
-			if (cishort < PPP_DEFMRU)
-				try.mru = cishort;
-			break;
-		case CI_ASYNCMAP:
-			if ((go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl)
-					|| no.neg_asyncmap || cilen != CILEN_LONG)
-				goto bad;
-			break;
-		case CI_AUTHTYPE:
-			if (go->neg_chap || no.neg_chap || go->neg_upap || no.neg_upap)
-				goto bad;
-			break;
-		case CI_MAGICNUMBER:
-			if (go->neg_magicnumber || no.neg_magicnumber ||
-					cilen != CILEN_LONG)
-				goto bad;
-			break;
-		case CI_PCOMPRESSION:
-			if (go->neg_pcompression || no.neg_pcompression
-					|| cilen != CILEN_VOID)
-				goto bad;
-			break;
-		case CI_ACCOMPRESSION:
-			if (go->neg_accompression || no.neg_accompression
-					|| cilen != CILEN_VOID)
-				goto bad;
-			break;
-		case CI_QUALITY:
-			if (go->neg_lqr || no.neg_lqr || cilen != CILEN_LQR)
-				goto bad;
-			break;
-		}
-		p = next;
-	}
-	
-	/* If there is still anything left, this packet is bad. */
-	if (len != 0)
-		goto bad;
-	
-	/*
-	* OK, the Nak is good.  Now we can update state.
-	*/
-	if (f->state != OPENED) {
-		if (looped_back) {
-			if (++try.numloops >= lcp_loopbackfail) {
-				LCPDEBUG((LOG_NOTICE, "Serial line is looped back.\n"));
-				lcp_close(f->unit, "Loopback detected");
-			}
-		} 
-		else
-			try.numloops = 0;
-		*go = try;
-	}
-	
-	return 1;
-	
-bad:
-	LCPDEBUG((LOG_WARNING, "lcp_nakci: received bad Nak!\n"));
-	return 0;
-}
-
-
-/*
- * lcp_rejci - Peer has Rejected some of our CIs.
- * This should not modify any state if the Reject is bad
- * or if LCP is in the OPENED state.
- *
- * Returns:
- *	0 - Reject was bad.
- *	1 - Reject was good.
- */
-static int lcp_rejci(fsm *f, u_char *p, int len)
-{
-	lcp_options *go = &lcp_gotoptions[f->unit];
-	u_char cichar;
-	u_short cishort;
-	u32_t cilong;
-	lcp_options try;		/* options to request next time */
-	
-	try = *go;
-	
-	/*
-	* Any Rejected CIs must be in exactly the same order that we sent.
-	* Check packet length and CI length at each step.
-	* If we find any deviations, then this packet is bad.
-	*/
-#define REJCIVOID(opt, neg) \
-	if (go->neg && \
-			len >= CILEN_VOID && \
-			p[1] == CILEN_VOID && \
-			p[0] == opt) { \
-		len -= CILEN_VOID; \
-		INCPTR(CILEN_VOID, p); \
-		try.neg = 0; \
-		LCPDEBUG((LOG_INFO, "lcp_rejci: void opt %d rejected\n", opt)); \
-	}
-#define REJCISHORT(opt, neg, val) \
-	if (go->neg && \
-			len >= CILEN_SHORT && \
-			p[1] == CILEN_SHORT && \
-			p[0] == opt) { \
-		len -= CILEN_SHORT; \
-		INCPTR(2, p); \
-		GETSHORT(cishort, p); \
-		/* Check rejected value. */ \
-		if (cishort != val) \
-			goto bad; \
-		try.neg = 0; \
-		LCPDEBUG((LOG_INFO,"lcp_rejci: short opt %d rejected\n", opt)); \
-	}
-#define REJCICHAP(opt, neg, val, digest) \
-	if (go->neg && \
-			len >= CILEN_CHAP && \
-			p[1] == CILEN_CHAP && \
-			p[0] == opt) { \
-		len -= CILEN_CHAP; \
-		INCPTR(2, p); \
-		GETSHORT(cishort, p); \
-		GETCHAR(cichar, p); \
-		/* Check rejected value. */ \
-		if (cishort != val || cichar != digest) \
-			goto bad; \
-		try.neg = 0; \
-		try.neg_upap = 0; \
-		LCPDEBUG((LOG_INFO,"lcp_rejci: chap opt %d rejected\n", opt)); \
-	}
-#define REJCILONG(opt, neg, val) \
-	if (go->neg && \
-			len >= CILEN_LONG && \
-			p[1] == CILEN_LONG && \
-			p[0] == opt) { \
-		len -= CILEN_LONG; \
-		INCPTR(2, p); \
-		GETLONG(cilong, p); \
-		/* Check rejected value. */ \
-		if (cilong != val) \
-			goto bad; \
-		try.neg = 0; \
-		LCPDEBUG((LOG_INFO,"lcp_rejci: long opt %d rejected\n", opt)); \
-	}
-#define REJCILQR(opt, neg, val) \
-	if (go->neg && \
-			len >= CILEN_LQR && \
-			p[1] == CILEN_LQR && \
-			p[0] == opt) { \
-		len -= CILEN_LQR; \
-		INCPTR(2, p); \
-		GETSHORT(cishort, p); \
-		GETLONG(cilong, p); \
-		/* Check rejected value. */ \
-		if (cishort != PPP_LQR || cilong != val) \
-			goto bad; \
-		try.neg = 0; \
-		LCPDEBUG((LOG_INFO,"lcp_rejci: LQR opt %d rejected\n", opt)); \
-	}
-#define REJCICBCP(opt, neg, val) \
-	if (go->neg && \
-			len >= CILEN_CBCP && \
-			p[1] == CILEN_CBCP && \
-			p[0] == opt) { \
-		len -= CILEN_CBCP; \
-		INCPTR(2, p); \
-		GETCHAR(cichar, p); \
-		/* Check rejected value. */ \
-		if (cichar != val) \
-			goto bad; \
-		try.neg = 0; \
-		LCPDEBUG((LOG_INFO,"lcp_rejci: Callback opt %d rejected\n", opt)); \
-	}
-	
-	REJCISHORT(CI_MRU, neg_mru, go->mru);
-	REJCILONG(CI_ASYNCMAP, neg_asyncmap, go->asyncmap);
-	REJCICHAP(CI_AUTHTYPE, neg_chap, PPP_CHAP, go->chap_mdtype);
-	if (!go->neg_chap) {
-		REJCISHORT(CI_AUTHTYPE, neg_upap, PPP_PAP);
-	}
-	REJCILQR(CI_QUALITY, neg_lqr, go->lqr_period);
-	REJCICBCP(CI_CALLBACK, neg_cbcp, CBCP_OPT);
-	REJCILONG(CI_MAGICNUMBER, neg_magicnumber, go->magicnumber);
-	REJCIVOID(CI_PCOMPRESSION, neg_pcompression);
-	REJCIVOID(CI_ACCOMPRESSION, neg_accompression);
-	
-	/*
-	* If there are any remaining CIs, then this packet is bad.
-	*/
-	if (len != 0)
-		goto bad;
-	/*
-	* Now we can update state.
-	*/
-	if (f->state != OPENED)
-		*go = try;
-	return 1;
-	
-bad:
-	LCPDEBUG((LOG_WARNING, "lcp_rejci: received bad Reject!\n"));
-	return 0;
-}
-
-
-/*
- * lcp_reqci - Check the peer's requested CIs and send appropriate response.
- *
- * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified
- * appropriately.  If reject_if_disagree is non-zero, doesn't return
- * CONFNAK; returns CONFREJ if it can't return CONFACK.
- */
-static int lcp_reqci(fsm *f, 
-						u_char *inp,		/* Requested CIs */
-						int *lenp,			/* Length of requested CIs */
-						int reject_if_disagree)
-{
-	lcp_options *go = &lcp_gotoptions[f->unit];
-	lcp_options *ho = &lcp_hisoptions[f->unit];
-	lcp_options *ao = &lcp_allowoptions[f->unit];
-	u_char *cip, *next;			/* Pointer to current and next CIs */
-	int cilen, citype, cichar;	/* Parsed len, type, char value */
-	u_short cishort;			/* Parsed short value */
-	u32_t cilong;			/* Parse long value */
-	int rc = CONFACK;			/* Final packet return code */
-	int orc;					/* Individual option return code */
-	u_char *p;					/* Pointer to next char to parse */
-	u_char *rejp;				/* Pointer to next char in reject frame */
-	u_char *nakp;				/* Pointer to next char in Nak frame */
-	int l = *lenp;				/* Length left */
-#if TRACELCP > 0
-	char traceBuf[80];
-	int traceNdx = 0;
-#endif
-	
-	/*
-	 * Reset all his options.
-	 */
-	BZERO(ho, sizeof(*ho));
-	
-	/*
-	 * Process all his options.
-	 */
-	next = inp;
-	nakp = nak_buffer;
-	rejp = inp;
-	while (l) {
-		orc = CONFACK;			/* Assume success */
-		cip = p = next;			/* Remember begining of CI */
-		if (l < 2 ||			/* Not enough data for CI header or */
-				p[1] < 2 ||			/*  CI length too small or */
-				p[1] > l) {			/*  CI length too big? */
-			LCPDEBUG((LOG_WARNING, "lcp_reqci: bad CI length!\n"));
-			orc = CONFREJ;		/* Reject bad CI */
-			cilen = l;			/* Reject till end of packet */
-			l = 0;			/* Don't loop again */
-			citype = 0;
-			goto endswitch;
-		}
-		GETCHAR(citype, p);		/* Parse CI type */
-		GETCHAR(cilen, p);		/* Parse CI length */
-		l -= cilen;			/* Adjust remaining length */
-		next += cilen;			/* Step to next CI */
-		
-		switch (citype) {		/* Check CI type */
-		case CI_MRU:
-			if (!ao->neg_mru) {		/* Allow option? */
-				LCPDEBUG((LOG_INFO, "lcp_reqci: Reject MRU - not allowed\n"));
-				orc = CONFREJ;		/* Reject CI */
-				break;
-			} else if (cilen != CILEN_SHORT) {	/* Check CI length */
-				LCPDEBUG((LOG_INFO, "lcp_reqci: Reject MRU - bad length\n"));
-				orc = CONFREJ;		/* Reject CI */
-				break;
-			}
-			GETSHORT(cishort, p);	/* Parse MRU */
-			
-			/*
-			 * He must be able to receive at least our minimum.
-			 * No need to check a maximum.  If he sends a large number,
-			 * we'll just ignore it.
-			 */
-			if (cishort < PPP_MINMRU) {
-				LCPDEBUG((LOG_INFO, "lcp_reqci: Nak - MRU too small\n"));
-				orc = CONFNAK;		/* Nak CI */
-				PUTCHAR(CI_MRU, nakp);
-				PUTCHAR(CILEN_SHORT, nakp);
-				PUTSHORT(PPP_MINMRU, nakp);	/* Give him a hint */
-				break;
-			}
-			ho->neg_mru = 1;		/* Remember he sent MRU */
-			ho->mru = cishort;		/* And remember value */
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " MRU %d", cishort);
-			traceNdx = strlen(traceBuf);
-#endif
-			break;
-		
-		case CI_ASYNCMAP:
-			if (!ao->neg_asyncmap) {
-				LCPDEBUG((LOG_INFO, "lcp_reqci: Reject ASYNCMAP not allowed\n"));
-				orc = CONFREJ;
-				break;
-			} else if (cilen != CILEN_LONG) {
-				LCPDEBUG((LOG_INFO, "lcp_reqci: Reject ASYNCMAP bad length\n"));
-				orc = CONFREJ;
-				break;
-			}
-			GETLONG(cilong, p);
-			
-			/*
-			 * Asyncmap must have set at least the bits
-			 * which are set in lcp_allowoptions[unit].asyncmap.
-			 */
-			if ((ao->asyncmap & ~cilong) != 0) {
-				LCPDEBUG((LOG_INFO, "lcp_reqci: Nak ASYNCMAP %lX missing %lX\n", 
-							cilong, ao->asyncmap));
-				orc = CONFNAK;
-				PUTCHAR(CI_ASYNCMAP, nakp);
-				PUTCHAR(CILEN_LONG, nakp);
-				PUTLONG(ao->asyncmap | cilong, nakp);
-				break;
-			}
-			ho->neg_asyncmap = 1;
-			ho->asyncmap = cilong;
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " ASYNCMAP=%lX", cilong);
-			traceNdx = strlen(traceBuf);
-#endif
-			break;
-		
-		case CI_AUTHTYPE:
-			if (cilen < CILEN_SHORT) {
-				LCPDEBUG((LOG_INFO, "lcp_reqci: Reject AUTHTYPE missing arg\n"));
-				orc = CONFREJ;
-				break;
-			} else if (!(ao->neg_upap || ao->neg_chap)) {
-				/*
-				 * Reject the option if we're not willing to authenticate.
-				 */
-				LCPDEBUG((LOG_INFO, "lcp_reqci: Reject AUTHTYPE not allowed\n"));
-				orc = CONFREJ;
-				break;
-			}
-			GETSHORT(cishort, p);
-			
-			/*
-			 * Authtype must be UPAP or CHAP.
-			 *
-			 * Note: if both ao->neg_upap and ao->neg_chap are set,
-			 * and the peer sends a Configure-Request with two
-			 * authenticate-protocol requests, one for CHAP and one
-			 * for UPAP, then we will reject the second request.
-			 * Whether we end up doing CHAP or UPAP depends then on
-			 * the ordering of the CIs in the peer's Configure-Request.
-			 */
-			
-			if (cishort == PPP_PAP) {
-				if (ho->neg_chap) {	/* we've already accepted CHAP */
-					LCPDEBUG((LOG_WARNING, "lcp_reqci: Reject AUTHTYPE PAP already accepted\n"));
-					orc = CONFREJ;
-					break;
-				} else if (cilen != CILEN_SHORT) {
-					LCPDEBUG((LOG_WARNING, "lcp_reqci: Reject AUTHTYPE PAP bad len\n"));
-					orc = CONFREJ;
-					break;
-				}
-				if (!ao->neg_upap) {	/* we don't want to do PAP */
-					LCPDEBUG((LOG_WARNING, "lcp_reqci: Nak AUTHTYPE PAP not allowed\n"));
-					orc = CONFNAK;	/* NAK it and suggest CHAP */
-					PUTCHAR(CI_AUTHTYPE, nakp);
-					PUTCHAR(CILEN_CHAP, nakp);
-					PUTSHORT(PPP_CHAP, nakp);
-					PUTCHAR(ao->chap_mdtype, nakp);
-					break;
-				}
-				ho->neg_upap = 1;
-#if TRACELCP > 0
-				snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " PAP (%X)", cishort);
-				traceNdx = strlen(traceBuf);
-#endif
-				break;
-			}
-			if (cishort == PPP_CHAP) {
-				if (ho->neg_upap) {	/* we've already accepted PAP */
-					LCPDEBUG((LOG_WARNING, "lcp_reqci: Reject AUTHTYPE CHAP accepted PAP\n"));
-					orc = CONFREJ;
-					break;
-				} else if (cilen != CILEN_CHAP) {
-					LCPDEBUG((LOG_WARNING, "lcp_reqci: Reject AUTHTYPE CHAP bad len\n"));
-					orc = CONFREJ;
-					break;
-				}
-				if (!ao->neg_chap) {	/* we don't want to do CHAP */
-					LCPDEBUG((LOG_WARNING, "lcp_reqci: Nak AUTHTYPE CHAP not allowed\n"));
-					orc = CONFNAK;	/* NAK it and suggest PAP */
-					PUTCHAR(CI_AUTHTYPE, nakp);
-					PUTCHAR(CILEN_SHORT, nakp);
-					PUTSHORT(PPP_PAP, nakp);
-					break;
-				}
-				GETCHAR(cichar, p);	/* get digest type*/
-				if (cichar != CHAP_DIGEST_MD5
-#ifdef CHAPMS
-						&& cichar != CHAP_MICROSOFT
-#endif
-				) {
-					LCPDEBUG((LOG_WARNING, "lcp_reqci: Nak AUTHTYPE CHAP digest=%d\n", cichar));
-					orc = CONFNAK;
-					PUTCHAR(CI_AUTHTYPE, nakp);
-					PUTCHAR(CILEN_CHAP, nakp);
-					PUTSHORT(PPP_CHAP, nakp);
-					PUTCHAR(ao->chap_mdtype, nakp);
-					break;
-				}
-#if TRACELCP > 0
-				snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " CHAP %X,%d", cishort, cichar);
-				traceNdx = strlen(traceBuf);
-#endif
-				ho->chap_mdtype = cichar; /* save md type */
-				ho->neg_chap = 1;
-				break;
-			}
-			
-			/*
-			 * We don't recognize the protocol they're asking for.
-			 * Nak it with something we're willing to do.
-			 * (At this point we know ao->neg_upap || ao->neg_chap.)
-			 */
-			orc = CONFNAK;
-			PUTCHAR(CI_AUTHTYPE, nakp);
-			if (ao->neg_chap) {
-				LCPDEBUG((LOG_WARNING, "lcp_reqci: Nak AUTHTYPE %d req CHAP\n", cishort));
-				PUTCHAR(CILEN_CHAP, nakp);
-				PUTSHORT(PPP_CHAP, nakp);
-				PUTCHAR(ao->chap_mdtype, nakp);
-			} 
-			else {
-				LCPDEBUG((LOG_WARNING, "lcp_reqci: Nak AUTHTYPE %d req PAP\n", cishort));
-				PUTCHAR(CILEN_SHORT, nakp);
-				PUTSHORT(PPP_PAP, nakp);
-			}
-			break;
-		
-		case CI_QUALITY:
-			GETSHORT(cishort, p);
-			GETLONG(cilong, p);
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " QUALITY (%x %x)", cishort, (unsigned int) cilong);
-			traceNdx = strlen(traceBuf);
-#endif
-
-			if (!ao->neg_lqr ||
-					cilen != CILEN_LQR) {
-				orc = CONFREJ;
-				break;
-			}
-			
-			/*
-			 * Check the protocol and the reporting period.
-			 * XXX When should we Nak this, and what with?
-			 */
-			if (cishort != PPP_LQR) {
-				orc = CONFNAK;
-				PUTCHAR(CI_QUALITY, nakp);
-				PUTCHAR(CILEN_LQR, nakp);
-				PUTSHORT(PPP_LQR, nakp);
-				PUTLONG(ao->lqr_period, nakp);
-				break;
-			}
-			break;
-		
-		case CI_MAGICNUMBER:
-			if (!(ao->neg_magicnumber || go->neg_magicnumber) ||
-					cilen != CILEN_LONG) {
-				orc = CONFREJ;
-				break;
-			}
-			GETLONG(cilong, p);
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " MAGICNUMBER (%lX)", cilong);
-			traceNdx = strlen(traceBuf);
-#endif
-
-			/*
-			 * He must have a different magic number.
-			 */
-			if (go->neg_magicnumber &&
-					cilong == go->magicnumber) {
-				cilong = magic();	/* Don't put magic() inside macro! */
-				orc = CONFNAK;
-				PUTCHAR(CI_MAGICNUMBER, nakp);
-				PUTCHAR(CILEN_LONG, nakp);
-				PUTLONG(cilong, nakp);
-				break;
-			}
-			ho->neg_magicnumber = 1;
-			ho->magicnumber = cilong;
-			break;
-		
-		
-		case CI_PCOMPRESSION:
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " PCOMPRESSION");
-			traceNdx = strlen(traceBuf);
-#endif
-			if (!ao->neg_pcompression ||
-					cilen != CILEN_VOID) {
-				orc = CONFREJ;
-				break;
-			}
-			ho->neg_pcompression = 1;
-			break;
-		
-		case CI_ACCOMPRESSION:
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " ACCOMPRESSION");
-			traceNdx = strlen(traceBuf);
-#endif
-			if (!ao->neg_accompression ||
-					cilen != CILEN_VOID) {
-				orc = CONFREJ;
-				break;
-			}
-			ho->neg_accompression = 1;
-			break;
-		
-		case CI_MRRU:
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " CI_MRRU");
-			traceNdx = strlen(traceBuf);
-#endif
-			orc = CONFREJ;
-			break;
-		
-		case CI_SSNHF:
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " CI_SSNHF");
-			traceNdx = strlen(traceBuf);
-#endif
-			orc = CONFREJ;
-			break;
-		
-		case CI_EPDISC:
-#if TRACELCP > 0
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " CI_EPDISC");
-			traceNdx = strlen(traceBuf);
-#endif
-			orc = CONFREJ;
-			break;
-		
-		default:
-#if TRACELCP
-			snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " unknown %d", citype);
-			traceNdx = strlen(traceBuf);
-#endif
-			orc = CONFREJ;
-			break;
-		}
-		
-	endswitch:
-#if TRACELCP
-		if (traceNdx >= 80 - 32) {
-			LCPDEBUG((LOG_INFO, "lcp_reqci: rcvd%s\n", traceBuf));
-			traceNdx = 0;
-		}
-#endif
-		if (orc == CONFACK &&		/* Good CI */
-				rc != CONFACK)		/*  but prior CI wasnt? */
-			continue;			/* Don't send this one */
-		
-		if (orc == CONFNAK) {		/* Nak this CI? */
-			if (reject_if_disagree	/* Getting fed up with sending NAKs? */
-					&& citype != CI_MAGICNUMBER) {
-				orc = CONFREJ;		/* Get tough if so */
-			} 
-			else {
-				if (rc == CONFREJ)	/* Rejecting prior CI? */
-					continue;		/* Don't send this one */
-				rc = CONFNAK;
-			}
-		}
-		if (orc == CONFREJ) {		/* Reject this CI */
-			rc = CONFREJ;
-			if (cip != rejp)		/* Need to move rejected CI? */
-				BCOPY(cip, rejp, cilen); /* Move it */
-			INCPTR(cilen, rejp);	/* Update output pointer */
-		}
-	}
-	
-	/*
-	 * If we wanted to send additional NAKs (for unsent CIs), the
-	 * code would go here.  The extra NAKs would go at *nakp.
-	 * At present there are no cases where we want to ask the
-	 * peer to negotiate an option.
-	 */
-	
-	switch (rc) {
-	case CONFACK:
-		*lenp = (int)(next - inp);
-		break;
-	case CONFNAK:
-		/*
-		 * Copy the Nak'd options from the nak_buffer to the caller's buffer.
-		 */
-		*lenp = (int)(nakp - nak_buffer);
-		BCOPY(nak_buffer, inp, *lenp);
-		break;
-	case CONFREJ:
-		*lenp = (int)(rejp - inp);
-		break;
-	}
-	
-#if TRACELCP > 0
-	if (traceNdx > 0) {
-		LCPDEBUG((LOG_INFO, "lcp_reqci: %s\n", traceBuf));
-	}
-#endif
-	LCPDEBUG((LOG_INFO, "lcp_reqci: returning CONF%s.\n", CODENAME(rc)));
-	return (rc);			/* Return final code */
-}
-
-
-/*
- * lcp_up - LCP has come UP.
- */
-static void lcp_up(fsm *f)
-{
-	lcp_options *wo = &lcp_wantoptions[f->unit];
-	lcp_options *ho = &lcp_hisoptions[f->unit];
-	lcp_options *go = &lcp_gotoptions[f->unit];
-	lcp_options *ao = &lcp_allowoptions[f->unit];
-	
-	if (!go->neg_magicnumber)
-		go->magicnumber = 0;
-	if (!ho->neg_magicnumber)
-		ho->magicnumber = 0;
-	
-	/*
-	* Set our MTU to the smaller of the MTU we wanted and
-	* the MRU our peer wanted.  If we negotiated an MRU,
-	* set our MRU to the larger of value we wanted and
-	* the value we got in the negotiation.
-	*/
-	ppp_send_config(f->unit, LWIP_MIN(ao->mru, (ho->neg_mru? ho->mru: PPP_MRU)),
-				(ho->neg_asyncmap? ho->asyncmap: 0xffffffffl),
-				ho->neg_pcompression, ho->neg_accompression);
-	/*
-	* If the asyncmap hasn't been negotiated, we really should
-	* set the receive asyncmap to ffffffff, but we set it to 0
-	* for backwards contemptibility.
-	*/
-	ppp_recv_config(f->unit, (go->neg_mru? LWIP_MAX(wo->mru, go->mru): PPP_MRU),
-				(go->neg_asyncmap? go->asyncmap: 0x00000000),
-				go->neg_pcompression, go->neg_accompression);
-	
-	if (ho->neg_mru)
-		peer_mru[f->unit] = ho->mru;
-	
-	lcp_echo_lowerup(f->unit);  /* Enable echo messages */
-	
-	link_established(f->unit);
-}
-
-
-/*
- * lcp_down - LCP has gone DOWN.
- *
- * Alert other protocols.
- */
-static void lcp_down(fsm *f)
-{
-	lcp_options *go = &lcp_gotoptions[f->unit];
-	
-	lcp_echo_lowerdown(f->unit);
-	
-	link_down(f->unit);
-	
-	ppp_send_config(f->unit, PPP_MRU, 0xffffffffl, 0, 0);
-	ppp_recv_config(f->unit, PPP_MRU,
-				(go->neg_asyncmap? go->asyncmap: 0x00000000),
-				go->neg_pcompression, go->neg_accompression);
-	peer_mru[f->unit] = PPP_MRU;
-}
-
-
-/*
- * lcp_starting - LCP needs the lower layer up.
- */
-static void lcp_starting(fsm *f)
-{
-	link_required(f->unit);
-}
-
-
-/*
- * lcp_finished - LCP has finished with the lower layer.
- */
-static void lcp_finished(fsm *f)
-{
-	link_terminated(f->unit);
-}
-
-
-#if 0
-/*
- * print_string - print a readable representation of a string using
- * printer.
- */
-static void print_string(
-    char *p,
-    int len,
-    void (*printer) (void *, char *, ...),
-    void *arg
-)
-{
-    int c;
-    
-    printer(arg, "\"");
-    for (; len > 0; --len) {
-        c = *p++;
-        if (' ' <= c && c <= '~') {
-            if (c == '\\' || c == '"')
-                printer(arg, "\\");
-            printer(arg, "%c", c);
-        } else {
-            switch (c) {
-            case '\n':
-                printer(arg, "\\n");
-                break;
-            case '\r':
-                printer(arg, "\\r");
-                break;
-            case '\t':
-                printer(arg, "\\t");
-                break;
-            default:
-                printer(arg, "\\%.3o", c);
-            }
-        }
-    }
-    printer(arg, "\"");
-}
-
-
-/*
- * lcp_printpkt - print the contents of an LCP packet.
- */
-static char *lcp_codenames[] = {
-	"ConfReq", "ConfAck", "ConfNak", "ConfRej",
-	"TermReq", "TermAck", "CodeRej", "ProtRej",
-	"EchoReq", "EchoRep", "DiscReq"
-};
-
-static int lcp_printpkt(
-	u_char *p,
-	int plen,
-	void (*printer) (void *, char *, ...),
-	void *arg
-)
-{
-	int code, id, len, olen;
-	u_char *pstart, *optend;
-	u_short cishort;
-	u32_t cilong;
-	
-	if (plen < HEADERLEN)
-		return 0;
-	pstart = p;
-	GETCHAR(code, p);
-	GETCHAR(id, p);
-	GETSHORT(len, p);
-	if (len < HEADERLEN || len > plen)
-		return 0;
-	
-	if (code >= 1 && code <= sizeof(lcp_codenames) / sizeof(char *))
-		printer(arg, " %s", lcp_codenames[code-1]);
-	else
-		printer(arg, " code=0x%x", code);
-	printer(arg, " id=0x%x", id);
-	len -= HEADERLEN;
-	switch (code) {
-	case CONFREQ:
-	case CONFACK:
-	case CONFNAK:
-	case CONFREJ:
-		/* print option list */
-		while (len >= 2) {
-			GETCHAR(code, p);
-			GETCHAR(olen, p);
-			p -= 2;
-			if (olen < 2 || olen > len) {
-				break;
-			}
-			printer(arg, " <");
-			len -= olen;
-			optend = p + olen;
-			switch (code) {
-			case CI_MRU:
-				if (olen == CILEN_SHORT) {
-					p += 2;
-					GETSHORT(cishort, p);
-					printer(arg, "mru %d", cishort);
-				}
-				break;
-			case CI_ASYNCMAP:
-				if (olen == CILEN_LONG) {
-					p += 2;
-					GETLONG(cilong, p);
-					printer(arg, "asyncmap 0x%lx", cilong);
-				}
-				break;
-			case CI_AUTHTYPE:
-				if (olen >= CILEN_SHORT) {
-					p += 2;
-					printer(arg, "auth ");
-					GETSHORT(cishort, p);
-					switch (cishort) {
-					case PPP_PAP:
-						printer(arg, "pap");
-						break;
-					case PPP_CHAP:
-						printer(arg, "chap");
-						break;
-					default:
-						printer(arg, "0x%x", cishort);
-					}
-				}
-				break;
-			case CI_QUALITY:
-				if (olen >= CILEN_SHORT) {
-					p += 2;
-					printer(arg, "quality ");
-					GETSHORT(cishort, p);
-					switch (cishort) {
-					case PPP_LQR:
-						printer(arg, "lqr");
-						break;
-					default:
-						printer(arg, "0x%x", cishort);
-					}
-				}
-				break;
-			case CI_CALLBACK:
-				if (olen >= CILEN_CHAR) {
-					p += 2;
-					printer(arg, "callback ");
-					GETSHORT(cishort, p);
-					switch (cishort) {
-					case CBCP_OPT:
-						printer(arg, "CBCP");
-						break;
-					default:
-						printer(arg, "0x%x", cishort);
-					}
-				}
-				break;
-			case CI_MAGICNUMBER:
-				if (olen == CILEN_LONG) {
-					p += 2;
-					GETLONG(cilong, p);
-					printer(arg, "magic 0x%x", cilong);
-				}
-				break;
-			case CI_PCOMPRESSION:
-				if (olen == CILEN_VOID) {
-					p += 2;
-					printer(arg, "pcomp");
-				}
-				break;
-			case CI_ACCOMPRESSION:
-				if (olen == CILEN_VOID) {
-					p += 2;
-					printer(arg, "accomp");
-				}
-				break;
-			}
-			while (p < optend) {
-				GETCHAR(code, p);
-				printer(arg, " %.2x", code);
-			}
-			printer(arg, ">");
-		}
-		break;
-	
-	case TERMACK:
-	case TERMREQ:
-		if (len > 0 && *p >= ' ' && *p < 0x7f) {
-			printer(arg, " ");
-			print_string((char*)p, len, printer, arg);
-			p += len;
-			len = 0;
-		}
-		break;
-	
-	case ECHOREQ:
-	case ECHOREP:
-	case DISCREQ:
-		if (len >= 4) {
-			GETLONG(cilong, p);
-			printer(arg, " magic=0x%x", cilong);
-			p += 4;
-			len -= 4;
-		}
-		break;
-	}
-	
-	/* print the rest of the bytes in the packet */
-	for (; len > 0; --len) {
-		GETCHAR(code, p);
-		printer(arg, " %.2x", code);
-	}
-	
-	return (int)(p - pstart);
-}
-#endif
-
-/*
- * Time to shut down the link because there is nothing out there.
- */
-
-static void LcpLinkFailure (fsm *f)
-{
-	if (f->state == OPENED) {
-		LCPDEBUG((LOG_INFO, "No response to %d echo-requests\n", lcp_echos_pending));
-		LCPDEBUG((LOG_NOTICE, "Serial link appears to be disconnected.\n"));
-		lcp_close(f->unit, "Peer not responding");
-	}
-}
-
-/*
- * Timer expired for the LCP echo requests from this process.
- */
-
-static void LcpEchoCheck (fsm *f)
-{
-	LcpSendEchoRequest (f);
-	
-	/*
-	 * Start the timer for the next interval.
-	 */
-	LWIP_ASSERT("lcp_echo_timer_running == 0", lcp_echo_timer_running == 0);
-
-	TIMEOUT (LcpEchoTimeout, f, lcp_echo_interval);
-	lcp_echo_timer_running = 1;
-}
-
-/*
- * LcpEchoTimeout - Timer expired on the LCP echo
- */
-
-static void LcpEchoTimeout (void *arg)
-{
-	if (lcp_echo_timer_running != 0) {
-		lcp_echo_timer_running = 0;
-		LcpEchoCheck ((fsm *) arg);
-	}
-}
-
-/*
- * LcpEchoReply - LCP has received a reply to the echo
- */
-static void lcp_received_echo_reply (fsm *f, int id, u_char *inp, int len)
-{
-	u32_t magic;
-	
-	(void)id;
-
-	/* Check the magic number - don't count replies from ourselves. */
-	if (len < 4) {
-		LCPDEBUG((LOG_WARNING, "lcp: received short Echo-Reply, length %d\n", len));
-		return;
-	}
-	GETLONG(magic, inp);
-	if (lcp_gotoptions[f->unit].neg_magicnumber
-			&& magic == lcp_gotoptions[f->unit].magicnumber) {
-		LCPDEBUG((LOG_WARNING, "appear to have received our own echo-reply!\n"));
-		return;
-	}
-	
-	/* Reset the number of outstanding echo frames */
-	lcp_echos_pending = 0;
-}
-
-/*
- * LcpSendEchoRequest - Send an echo request frame to the peer
- */
-
-static void LcpSendEchoRequest (fsm *f)
-{
-	u32_t lcp_magic;
-	u_char pkt[4], *pktp;
-	
-	/*
-	* Detect the failure of the peer at this point.
-	*/
-	if (lcp_echo_fails != 0) {
-		if (lcp_echos_pending++ >= lcp_echo_fails) {
-			LcpLinkFailure(f);
-			lcp_echos_pending = 0;
-		}
-	}
-	
-	/*
-	* Make and send the echo request frame.
-	*/
-	if (f->state == OPENED) {
-		lcp_magic = lcp_gotoptions[f->unit].magicnumber;
-		pktp = pkt;
-		PUTLONG(lcp_magic, pktp);
-		fsm_sdata(f, ECHOREQ, (u_char)(lcp_echo_number++ & 0xFF), pkt, (int)(pktp - pkt));
-	}
-}
-
-/*
- * lcp_echo_lowerup - Start the timer for the LCP frame
- */
-
-static void lcp_echo_lowerup (int unit)
-{
-	fsm *f = &lcp_fsm[unit];
-	
-	/* Clear the parameters for generating echo frames */
-	lcp_echos_pending      = 0;
-	lcp_echo_number        = 0;
-	lcp_echo_timer_running = 0;
-	
-	/* If a timeout interval is specified then start the timer */
-	if (lcp_echo_interval != 0)
-		LcpEchoCheck (f);
-}
-
-/*
- * lcp_echo_lowerdown - Stop the timer for the LCP frame
- */
-
-static void lcp_echo_lowerdown (int unit)
-{
-	fsm *f = &lcp_fsm[unit];
-	
-	if (lcp_echo_timer_running != 0) {
-		UNTIMEOUT (LcpEchoTimeout, f);
-		lcp_echo_timer_running = 0;
-	}
-}
-
-#endif /* PPP_SUPPORT */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.h
deleted file mode 100644
index 1decc38..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/lcp.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*****************************************************************************
-* lcp.h - Network Link Control Protocol header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-11-05 Guy Lancaster <glanca at gesn.com>, Global Election Systems Inc.
-*	Original derived from BSD codes.
-*****************************************************************************/
-/*
- * lcp.h - Link Control Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id: lcp.h $
- */
-
-#ifndef LCP_H
-#define LCP_H
-
-
-/*************************
-*** PUBLIC DEFINITIONS ***
-*************************/
-/*
- * Options.
- */
-#define CI_MRU		1	/* Maximum Receive Unit */
-#define CI_ASYNCMAP	2	/* Async Control Character Map */
-#define CI_AUTHTYPE	3	/* Authentication Type */
-#define CI_QUALITY	4	/* Quality Protocol */
-#define CI_MAGICNUMBER	5	/* Magic Number */
-#define CI_PCOMPRESSION	7	/* Protocol Field Compression */
-#define CI_ACCOMPRESSION 8	/* Address/Control Field Compression */
-#define CI_CALLBACK	13	/* callback */
-#define CI_MRRU		17	/* max reconstructed receive unit; multilink */
-#define CI_SSNHF	18	/* short sequence numbers for multilink */
-#define CI_EPDISC	19	/* endpoint discriminator */
-
-/*
- * LCP-specific packet types.
- */
-#define PROTREJ		8	/* Protocol Reject */
-#define ECHOREQ		9	/* Echo Request */
-#define ECHOREP		10	/* Echo Reply */
-#define DISCREQ		11	/* Discard Request */
-#define CBCP_OPT	6	/* Use callback control protocol */
-
-
-/************************
-*** PUBLIC DATA TYPES ***
-************************/
-
-/*
- * The state of options is described by an lcp_options structure.
- */
-typedef struct lcp_options {
-    u_int passive : 1;			/* Don't die if we don't get a response */
-    u_int silent : 1;				/* Wait for the other end to start first */
-    u_int restart : 1;			/* Restart vs. exit after close */
-    u_int neg_mru : 1;			/* Negotiate the MRU? */
-    u_int neg_asyncmap : 1;		/* Negotiate the async map? */
-    u_int neg_upap : 1;			/* Ask for UPAP authentication? */
-    u_int neg_chap : 1;			/* Ask for CHAP authentication? */
-    u_int neg_magicnumber : 1;	/* Ask for magic number? */
-    u_int neg_pcompression : 1;	/* HDLC Protocol Field Compression? */
-    u_int neg_accompression : 1;	/* HDLC Address/Control Field Compression? */
-    u_int neg_lqr : 1;			/* Negotiate use of Link Quality Reports */
-    u_int neg_cbcp : 1;			/* Negotiate use of CBCP */
-#ifdef PPP_MULTILINK
-    u_int neg_mrru : 1;			/* Negotiate multilink MRRU */
-    u_int neg_ssnhf : 1;		/* Negotiate short sequence numbers */
-    u_int neg_endpoint : 1;		/* Negotiate endpoint discriminator */
-#endif
-    u_short mru;			/* Value of MRU */
-#ifdef PPP_MULTILINK
-    u_short mrru;			/* Value of MRRU, and multilink enable */
-#endif
-    u_char chap_mdtype;			/* which MD type (hashing algorithm) */
-    u32_t asyncmap;			/* Value of async map */
-    u32_t magicnumber;
-    int numloops;				/* Number of loops during magic number neg. */
-    u32_t lqr_period;		/* Reporting period for LQR 1/100ths second */
-#ifdef PPP_MULTILINK
-    struct epdisc endpoint;	/* endpoint discriminator */
-#endif
-} lcp_options;
-
-/*
- * Values for phase from BSD pppd.h based on RFC 1661.
- */
-typedef enum {
-	PHASE_DEAD = 0,
-	PHASE_INITIALIZE,
-	PHASE_ESTABLISH,
-	PHASE_AUTHENTICATE,
-	PHASE_CALLBACK,
-	PHASE_NETWORK,
-	PHASE_TERMINATE
-} LinkPhase;
-
-
-/*****************************
-*** PUBLIC DATA STRUCTURES ***
-*****************************/
-
-extern LinkPhase lcp_phase[NUM_PPP];	/* Phase of link session (RFC 1661) */
-extern lcp_options lcp_wantoptions[];
-extern lcp_options lcp_gotoptions[];
-extern lcp_options lcp_allowoptions[];
-extern lcp_options lcp_hisoptions[];
-extern ext_accm xmit_accm[];
-
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-
-void lcp_init (int);
-void lcp_open (int);
-void lcp_close (int, char *);
-void lcp_lowerup (int);
-void lcp_lowerdown (int);
-void lcp_sprotrej (int, u_char *, int);	/* send protocol reject */
-
-extern struct protent lcp_protent;
-
-/* Default number of times we receive our magic number from the peer
-   before deciding the link is looped-back. */
-#define DEFLOOPBACKFAIL	10
-
-#endif /* LCP_H */
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.c
deleted file mode 100644
index 4274016..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*****************************************************************************
-* magic.c - Network Random Number Generator program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 by Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-04 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original based on BSD magic.c.
-*****************************************************************************/
-/*
- * magic.c - PPP Magic Number routines.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "ppp.h"
-#include "randm.h"
-#include "magic.h"
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-/*
- * magicInit - Initialize the magic number generator.
- *
- * Since we use another random number generator that has its own
- * initialization, we do nothing here.
- */
-void magicInit()
-{
-	return;
-}
-
-/*
- * magic - Returns the next magic number.
- */
-u32_t magic()
-{
-    return avRandom();
-}
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.h
deleted file mode 100644
index 54619b7..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/magic.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
-* magic.h - Network Random Number Generator header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-04 Guy Lancaster <glanca at gesn.com>, Global Election Systems Inc.
-*   Original derived from BSD codes.
-*****************************************************************************/
-/*
- * magic.h - PPP Magic Number definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- * $Id: magic.h $
- */
-
-#ifndef MAGIC_H
-#define MAGIC_H
-
-/*****************************************************************************
-************************** PUBLIC FUNCTIONS **********************************
-*****************************************************************************/
-
-void magicInit(void);   /* Initialize the magic number generator */
-u32_t magic(void);  /* Returns the next magic number */
-
-#endif /* MAGIC_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/md5.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/md5.c
deleted file mode 100644
index e077cde..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/md5.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- ***********************************************************************
- ** md5.c -- the source code for MD5 routines                         **
- ** RSA Data Security, Inc. MD5 Message-Digest Algorithm              **
- ** Created: 2/17/90 RLR                                              **
- ** Revised: 1/91 SRD,AJ,BSK,JT Reference C ver., 7/10 constant corr. **
- ***********************************************************************
- */
-
-/*
- ***********************************************************************
- ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved.  **
- **                                                                   **
- ** License to copy and use this software is granted provided that    **
- ** it is identified as the "RSA Data Security, Inc. MD5 Message-     **
- ** Digest Algorithm" in all material mentioning or referencing this  **
- ** software or this function.                                        **
- **                                                                   **
- ** License is also granted to make and use derivative works          **
- ** provided that such works are identified as "derived from the RSA  **
- ** Data Security, Inc. MD5 Message-Digest Algorithm" in all          **
- ** material mentioning or referencing the derived work.              **
- **                                                                   **
- ** RSA Data Security, Inc. makes no representations concerning       **
- ** either the merchantability of this software or the suitability    **
- ** of this software for any particular purpose.  It is provided "as  **
- ** is" without express or implied warranty of any kind.              **
- **                                                                   **
- ** These notices must be retained in any copies of any part of this  **
- ** documentation and/or software.                                    **
- ***********************************************************************
- */
-
-#include "ppp.h"
-#include "md5.h"
-#include "pppdebug.h"
-
-#if CHAP_SUPPORT > 0 || MD5_SUPPORT > 0
-
-/*
- ***********************************************************************
- **  Message-digest routines:                                         **
- **  To form the message digest for a message M                       **
- **    (1) Initialize a context buffer mdContext using MD5Init        **
- **    (2) Call MD5Update on mdContext and M                          **
- **    (3) Call MD5Final on mdContext                                 **
- **  The message digest is now in mdContext->digest[0...15]           **
- ***********************************************************************
- */
-
-/* forward declaration */
-static void Transform (u32_t *buf, u32_t *in);
-
-static unsigned char PADDING[64] = {
-  0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-/* F, G, H and I are basic MD5 functions */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
-/* Rotation is separate from addition to prevent recomputation */
-#define FF(a, b, c, d, x, s, ac) \
-  {(a) += F ((b), (c), (d)) + (x) + (u32_t)(ac); \
-   (a) = ROTATE_LEFT ((a), (s)); \
-   (a) += (b); \
-  }
-#define GG(a, b, c, d, x, s, ac) \
-  {(a) += G ((b), (c), (d)) + (x) + (u32_t)(ac); \
-   (a) = ROTATE_LEFT ((a), (s)); \
-   (a) += (b); \
-  }
-#define HH(a, b, c, d, x, s, ac) \
-  {(a) += H ((b), (c), (d)) + (x) + (u32_t)(ac); \
-   (a) = ROTATE_LEFT ((a), (s)); \
-   (a) += (b); \
-  }
-#define II(a, b, c, d, x, s, ac) \
-  {(a) += I ((b), (c), (d)) + (x) + (u32_t)(ac); \
-   (a) = ROTATE_LEFT ((a), (s)); \
-   (a) += (b); \
-  }
-
-#ifdef __STDC__
-#define UL(x)	x##UL
-#else
-#ifdef WIN32
-#define UL(x)	x##UL
-#else
-#define UL(x)	x
-#endif
-#endif
-
-/* The routine MD5Init initializes the message-digest context
-   mdContext. All fields are set to zero.
- */
-void MD5Init (MD5_CTX *mdContext)
-{
-  mdContext->i[0] = mdContext->i[1] = (u32_t)0;
-
-  /* Load magic initialization constants.
-   */
-  mdContext->buf[0] = (u32_t)0x67452301UL;
-  mdContext->buf[1] = (u32_t)0xefcdab89UL;
-  mdContext->buf[2] = (u32_t)0x98badcfeUL;
-  mdContext->buf[3] = (u32_t)0x10325476UL;
-}
-
-/* The routine MD5Update updates the message-digest context to
-   account for the presence of each of the characters inBuf[0..inLen-1]
-   in the message whose digest is being computed.
- */
-void MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen)
-{
-  u32_t in[16];
-  int mdi;
-  unsigned int i, ii;
-
-#if 0
-  ppp_trace(LOG_INFO, "MD5Update: %u:%.*H\n", inLen, MIN(inLen, 20) * 2, inBuf);
-  ppp_trace(LOG_INFO, "MD5Update: %u:%s\n", inLen, inBuf);
-#endif
-  
-  /* compute number of bytes mod 64 */
-  mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
-
-  /* update number of bits */
-  if ((mdContext->i[0] + ((u32_t)inLen << 3)) < mdContext->i[0])
-    mdContext->i[1]++;
-  mdContext->i[0] += ((u32_t)inLen << 3);
-  mdContext->i[1] += ((u32_t)inLen >> 29);
-
-  while (inLen--) {
-    /* add new character to buffer, increment mdi */
-    mdContext->in[mdi++] = *inBuf++;
-
-    /* transform if necessary */
-    if (mdi == 0x40) {
-      for (i = 0, ii = 0; i < 16; i++, ii += 4)
-        in[i] = (((u32_t)mdContext->in[ii+3]) << 24) |
-                (((u32_t)mdContext->in[ii+2]) << 16) |
-				(((u32_t)mdContext->in[ii+1]) << 8) |
-                ((u32_t)mdContext->in[ii]);
-      Transform (mdContext->buf, in);
-      mdi = 0;
-    }
-  }
-}
-
-/* The routine MD5Final terminates the message-digest computation and
-   ends with the desired message digest in mdContext->digest[0...15].
- */
-void MD5Final (unsigned char hash[], MD5_CTX *mdContext)
-{
-  u32_t in[16];
-  int mdi;
-  unsigned int i, ii;
-  unsigned int padLen;
-
-  /* save number of bits */
-  in[14] = mdContext->i[0];
-  in[15] = mdContext->i[1];
-
-  /* compute number of bytes mod 64 */
-  mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
-
-  /* pad out to 56 mod 64 */
-  padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
-  MD5Update (mdContext, PADDING, padLen);
-
-  /* append length in bits and transform */
-  for (i = 0, ii = 0; i < 14; i++, ii += 4)
-    in[i] = (((u32_t)mdContext->in[ii+3]) << 24) |
-            (((u32_t)mdContext->in[ii+2]) << 16) |
-            (((u32_t)mdContext->in[ii+1]) << 8) |
-            ((u32_t)mdContext->in[ii]);
-  Transform (mdContext->buf, in);
-
-  /* store buffer in digest */
-  for (i = 0, ii = 0; i < 4; i++, ii += 4) {
-    mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF);
-	mdContext->digest[ii+1] =
-      (unsigned char)((mdContext->buf[i] >> 8) & 0xFF);
-    mdContext->digest[ii+2] =
-      (unsigned char)((mdContext->buf[i] >> 16) & 0xFF);
-    mdContext->digest[ii+3] =
-      (unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
-  }
-  memcpy(hash, mdContext->digest, 16);
-}
-
-/* Basic MD5 step. Transforms buf based on in.
- */
-static void Transform (u32_t *buf, u32_t *in)
-{
-  u32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3];
-
-  /* Round 1 */
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-  FF ( a, b, c, d, in[ 0], S11, UL(3614090360)); /* 1 */
-  FF ( d, a, b, c, in[ 1], S12, UL(3905402710)); /* 2 */
-  FF ( c, d, a, b, in[ 2], S13, UL( 606105819)); /* 3 */
-  FF ( b, c, d, a, in[ 3], S14, UL(3250441966)); /* 4 */
-  FF ( a, b, c, d, in[ 4], S11, UL(4118548399)); /* 5 */
-  FF ( d, a, b, c, in[ 5], S12, UL(1200080426)); /* 6 */
-  FF ( c, d, a, b, in[ 6], S13, UL(2821735955)); /* 7 */
-  FF ( b, c, d, a, in[ 7], S14, UL(4249261313)); /* 8 */
-  FF ( a, b, c, d, in[ 8], S11, UL(1770035416)); /* 9 */
-  FF ( d, a, b, c, in[ 9], S12, UL(2336552879)); /* 10 */
-  FF ( c, d, a, b, in[10], S13, UL(4294925233)); /* 11 */
-  FF ( b, c, d, a, in[11], S14, UL(2304563134)); /* 12 */
-  FF ( a, b, c, d, in[12], S11, UL(1804603682)); /* 13 */
-  FF ( d, a, b, c, in[13], S12, UL(4254626195)); /* 14 */
-  FF ( c, d, a, b, in[14], S13, UL(2792965006)); /* 15 */
-  FF ( b, c, d, a, in[15], S14, UL(1236535329)); /* 16 */
-
-  /* Round 2 */
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-  GG ( a, b, c, d, in[ 1], S21, UL(4129170786)); /* 17 */
-  GG ( d, a, b, c, in[ 6], S22, UL(3225465664)); /* 18 */
-  GG ( c, d, a, b, in[11], S23, UL( 643717713)); /* 19 */
-  GG ( b, c, d, a, in[ 0], S24, UL(3921069994)); /* 20 */
-  GG ( a, b, c, d, in[ 5], S21, UL(3593408605)); /* 21 */
-  GG ( d, a, b, c, in[10], S22, UL(  38016083)); /* 22 */
-  GG ( c, d, a, b, in[15], S23, UL(3634488961)); /* 23 */
-  GG ( b, c, d, a, in[ 4], S24, UL(3889429448)); /* 24 */
-  GG ( a, b, c, d, in[ 9], S21, UL( 568446438)); /* 25 */
-  GG ( d, a, b, c, in[14], S22, UL(3275163606)); /* 26 */
-  GG ( c, d, a, b, in[ 3], S23, UL(4107603335)); /* 27 */
-  GG ( b, c, d, a, in[ 8], S24, UL(1163531501)); /* 28 */
-  GG ( a, b, c, d, in[13], S21, UL(2850285829)); /* 29 */
-  GG ( d, a, b, c, in[ 2], S22, UL(4243563512)); /* 30 */
-  GG ( c, d, a, b, in[ 7], S23, UL(1735328473)); /* 31 */
-  GG ( b, c, d, a, in[12], S24, UL(2368359562)); /* 32 */
-
-  /* Round 3 */
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-  HH ( a, b, c, d, in[ 5], S31, UL(4294588738)); /* 33 */
-  HH ( d, a, b, c, in[ 8], S32, UL(2272392833)); /* 34 */
-  HH ( c, d, a, b, in[11], S33, UL(1839030562)); /* 35 */
-  HH ( b, c, d, a, in[14], S34, UL(4259657740)); /* 36 */
-  HH ( a, b, c, d, in[ 1], S31, UL(2763975236)); /* 37 */
-  HH ( d, a, b, c, in[ 4], S32, UL(1272893353)); /* 38 */
-  HH ( c, d, a, b, in[ 7], S33, UL(4139469664)); /* 39 */
-  HH ( b, c, d, a, in[10], S34, UL(3200236656)); /* 40 */
-  HH ( a, b, c, d, in[13], S31, UL( 681279174)); /* 41 */
-  HH ( d, a, b, c, in[ 0], S32, UL(3936430074)); /* 42 */
-  HH ( c, d, a, b, in[ 3], S33, UL(3572445317)); /* 43 */
-  HH ( b, c, d, a, in[ 6], S34, UL(  76029189)); /* 44 */
-  HH ( a, b, c, d, in[ 9], S31, UL(3654602809)); /* 45 */
-  HH ( d, a, b, c, in[12], S32, UL(3873151461)); /* 46 */
-  HH ( c, d, a, b, in[15], S33, UL( 530742520)); /* 47 */
-  HH ( b, c, d, a, in[ 2], S34, UL(3299628645)); /* 48 */
-
-  /* Round 4 */
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-  II ( a, b, c, d, in[ 0], S41, UL(4096336452)); /* 49 */
-  II ( d, a, b, c, in[ 7], S42, UL(1126891415)); /* 50 */
-  II ( c, d, a, b, in[14], S43, UL(2878612391)); /* 51 */
-  II ( b, c, d, a, in[ 5], S44, UL(4237533241)); /* 52 */
-  II ( a, b, c, d, in[12], S41, UL(1700485571)); /* 53 */
-  II ( d, a, b, c, in[ 3], S42, UL(2399980690)); /* 54 */
-  II ( c, d, a, b, in[10], S43, UL(4293915773)); /* 55 */
-  II ( b, c, d, a, in[ 1], S44, UL(2240044497)); /* 56 */
-  II ( a, b, c, d, in[ 8], S41, UL(1873313359)); /* 57 */
-  II ( d, a, b, c, in[15], S42, UL(4264355552)); /* 58 */
-  II ( c, d, a, b, in[ 6], S43, UL(2734768916)); /* 59 */
-  II ( b, c, d, a, in[13], S44, UL(1309151649)); /* 60 */
-  II ( a, b, c, d, in[ 4], S41, UL(4149444226)); /* 61 */
-  II ( d, a, b, c, in[11], S42, UL(3174756917)); /* 62 */
-  II ( c, d, a, b, in[ 2], S43, UL( 718787259)); /* 63 */
-  II ( b, c, d, a, in[ 9], S44, UL(3951481745)); /* 64 */
-
-  buf[0] += a;
-  buf[1] += b;
-  buf[2] += c;
-  buf[3] += d;
-}
-
-#endif
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/md5.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/md5.h
deleted file mode 100644
index 0e81cdc..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/md5.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- ***********************************************************************
- ** md5.h -- header file for implementation of MD5                    **
- ** RSA Data Security, Inc. MD5 Message-Digest Algorithm              **
- ** Created: 2/17/90 RLR                                              **
- ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version               **
- ** Revised (for MD5): RLR 4/27/91                                    **
- **   -- G modified to have y&~z instead of y&z                       **
- **   -- FF, GG, HH modified to add in last register done             **
- **   -- Access pattern: round 2 works mod 5, round 3 works mod 3     **
- **   -- distinct additive constant for each step                     **
- **   -- round 4 added, working mod 7                                 **
- ***********************************************************************
- */
-
-/*
- ***********************************************************************
- ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved.  **
- **                                                                   **
- ** License to copy and use this software is granted provided that    **
- ** it is identified as the "RSA Data Security, Inc. MD5 Message-     **
- ** Digest Algorithm" in all material mentioning or referencing this  **
- ** software or this function.                                        **
- **                                                                   **
- ** License is also granted to make and use derivative works          **
- ** provided that such works are identified as "derived from the RSA  **
- ** Data Security, Inc. MD5 Message-Digest Algorithm" in all          **
- ** material mentioning or referencing the derived work.              **
- **                                                                   **
- ** RSA Data Security, Inc. makes no representations concerning       **
- ** either the merchantability of this software or the suitability    **
- ** of this software for any particular purpose.  It is provided "as  **
- ** is" without express or implied warranty of any kind.              **
- **                                                                   **
- ** These notices must be retained in any copies of any part of this  **
- ** documentation and/or software.                                    **
- ***********************************************************************
- */
-
-#ifndef MD5_H
-#define MD5_H
-
-/* Data structure for MD5 (Message-Digest) computation */
-typedef struct {
-  u32_t i[2];                   /* number of _bits_ handled mod 2^64 */
-  u32_t buf[4];                                    /* scratch buffer */
-  unsigned char in[64];                              /* input buffer */
-  unsigned char digest[16];     /* actual digest after MD5Final call */
-} MD5_CTX;
-
-void MD5Init (MD5_CTX *mdContext);
-void MD5Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen);
-void MD5Final (unsigned char hash[], MD5_CTX *mdContext);
-
-#endif /* MD5_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/pap.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/pap.c
deleted file mode 100644
index 23e438f..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/pap.c
+++ /dev/null
@@ -1,608 +0,0 @@
-/*****************************************************************************
-* pap.c - Network Password Authentication Protocol program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 by Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-12 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original.
-*****************************************************************************/
-/*
- * upap.c - User/Password Authentication Protocol.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include "ppp.h"
-#include "auth.h"
-#include "pap.h"
-#include "pppdebug.h"
-
-
-#if PAP_SUPPORT > 0
-
-/***********************************/
-/*** LOCAL FUNCTION DECLARATIONS ***/
-/***********************************/
-/*
- * Protocol entry points.
- */
-static void upap_init (int);
-static void upap_lowerup (int);
-static void upap_lowerdown (int);
-static void upap_input (int, u_char *, int);
-static void upap_protrej (int);
-
-static void upap_timeout (void *);
-static void upap_reqtimeout (void *);
-static void upap_rauthreq (upap_state *, u_char *, int, int);
-static void upap_rauthack (upap_state *, u_char *, int, int);
-static void upap_rauthnak (upap_state *, u_char *, int, int);
-static void upap_sauthreq (upap_state *);
-static void upap_sresp (upap_state *, u_char, u_char, char *, int);
-
-
-
-
-/******************************/
-/*** PUBLIC DATA STRUCTURES ***/
-/******************************/
-struct protent pap_protent = {
-    PPP_PAP,
-    upap_init,
-    upap_input,
-    upap_protrej,
-    upap_lowerup,
-    upap_lowerdown,
-    NULL,
-    NULL,
-#if 0
-    upap_printpkt,
-    NULL,
-#endif
-    1,
-    "PAP",
-#if 0
-    NULL,
-    NULL,
-    NULL
-#endif
-};
-
-upap_state upap[NUM_PPP];		/* UPAP state; one for each unit */
-
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-/*
- *  Set the default login name and password for the pap sessions
- */
-void upap_setloginpasswd(int unit, const char *luser, const char *lpassword)
-{
-	upap_state *u = &upap[unit];
-	
-	/* Save the username and password we're given */
-	u->us_user = luser;
-	u->us_userlen = strlen(luser);
-	u->us_passwd = lpassword;
-	u->us_passwdlen = strlen(lpassword);
-}
-
-
-/*
- * upap_authwithpeer - Authenticate us with our peer (start client).
- *
- * Set new state and send authenticate's.
- */
-void upap_authwithpeer(int unit, char *user, char *password)
-{
-	upap_state *u = &upap[unit];
-	
-	UPAPDEBUG((LOG_INFO, "upap_authwithpeer: %d user=%s password=%s s=%d\n",
-				unit, user, password, u->us_clientstate));
-	
-	upap_setloginpasswd(unit, user, password);
-
-	u->us_transmits = 0;
-	
-	/* Lower layer up yet? */
-	if (u->us_clientstate == UPAPCS_INITIAL ||
-			u->us_clientstate == UPAPCS_PENDING) {
-		u->us_clientstate = UPAPCS_PENDING;
-		return;
-	}
-	
-	upap_sauthreq(u);			/* Start protocol */
-}
-
-
-/*
- * upap_authpeer - Authenticate our peer (start server).
- *
- * Set new state.
- */
-void upap_authpeer(int unit)
-{
-	upap_state *u = &upap[unit];
-	
-	/* Lower layer up yet? */
-	if (u->us_serverstate == UPAPSS_INITIAL ||
-			u->us_serverstate == UPAPSS_PENDING) {
-		u->us_serverstate = UPAPSS_PENDING;
-		return;
-	}
-	
-	u->us_serverstate = UPAPSS_LISTEN;
-	if (u->us_reqtimeout > 0)
-		TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
-}
-
-
-
-/**********************************/
-/*** LOCAL FUNCTION DEFINITIONS ***/
-/**********************************/
-/*
- * upap_init - Initialize a UPAP unit.
- */
-static void upap_init(int unit)
-{
-	upap_state *u = &upap[unit];
-
-	UPAPDEBUG((LOG_INFO, "upap_init: %d\n", unit));	
-	u->us_unit = unit;
-	u->us_user = NULL;
-	u->us_userlen = 0;
-	u->us_passwd = NULL;
-	u->us_passwdlen = 0;
-	u->us_clientstate = UPAPCS_INITIAL;
-	u->us_serverstate = UPAPSS_INITIAL;
-	u->us_id = 0;
-	u->us_timeouttime = UPAP_DEFTIMEOUT;
-	u->us_maxtransmits = 10;
-	u->us_reqtimeout = UPAP_DEFREQTIME;
-}
-
-/*
- * upap_timeout - Retransmission timer for sending auth-reqs expired.
- */
-static void upap_timeout(void *arg)
-{
-	upap_state *u = (upap_state *) arg;
-	
-	UPAPDEBUG((LOG_INFO, "upap_timeout: %d timeout %d expired s=%d\n", 
-				u->us_unit, u->us_timeouttime, u->us_clientstate));
-	
-	if (u->us_clientstate != UPAPCS_AUTHREQ)
-		return;
-	
-	if (u->us_transmits >= u->us_maxtransmits) {
-		/* give up in disgust */
-		UPAPDEBUG((LOG_ERR, "No response to PAP authenticate-requests\n"));
-		u->us_clientstate = UPAPCS_BADAUTH;
-		auth_withpeer_fail(u->us_unit, PPP_PAP);
-		return;
-	}
-	
-	upap_sauthreq(u);		/* Send Authenticate-Request */
-}
-
-
-/*
- * upap_reqtimeout - Give up waiting for the peer to send an auth-req.
- */
-static void upap_reqtimeout(void *arg)
-{
-	upap_state *u = (upap_state *) arg;
-	
-	if (u->us_serverstate != UPAPSS_LISTEN)
-		return;			/* huh?? */
-	
-	auth_peer_fail(u->us_unit, PPP_PAP);
-	u->us_serverstate = UPAPSS_BADAUTH;
-}
-
-
-/*
- * upap_lowerup - The lower layer is up.
- *
- * Start authenticating if pending.
- */
-static void upap_lowerup(int unit)
-{
-	upap_state *u = &upap[unit];
-	
-	UPAPDEBUG((LOG_INFO, "upap_lowerup: %d s=%d\n", unit, u->us_clientstate));
-	
-	if (u->us_clientstate == UPAPCS_INITIAL)
-		u->us_clientstate = UPAPCS_CLOSED;
-	else if (u->us_clientstate == UPAPCS_PENDING) {
-		upap_sauthreq(u);	/* send an auth-request */
-	}
-	
-	if (u->us_serverstate == UPAPSS_INITIAL)
-		u->us_serverstate = UPAPSS_CLOSED;
-	else if (u->us_serverstate == UPAPSS_PENDING) {
-		u->us_serverstate = UPAPSS_LISTEN;
-		if (u->us_reqtimeout > 0)
-			TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout);
-	}
-}
-
-
-/*
- * upap_lowerdown - The lower layer is down.
- *
- * Cancel all timeouts.
- */
-static void upap_lowerdown(int unit)
-{
-	upap_state *u = &upap[unit];
-	
-	UPAPDEBUG((LOG_INFO, "upap_lowerdown: %d s=%d\n", unit, u->us_clientstate));
-	
-	if (u->us_clientstate == UPAPCS_AUTHREQ)	/* Timeout pending? */
-		UNTIMEOUT(upap_timeout, u);		/* Cancel timeout */
-	if (u->us_serverstate == UPAPSS_LISTEN && u->us_reqtimeout > 0)
-		UNTIMEOUT(upap_reqtimeout, u);
-	
-	u->us_clientstate = UPAPCS_INITIAL;
-	u->us_serverstate = UPAPSS_INITIAL;
-}
-
-
-/*
- * upap_protrej - Peer doesn't speak this protocol.
- *
- * This shouldn't happen.  In any case, pretend lower layer went down.
- */
-static void upap_protrej(int unit)
-{
-	upap_state *u = &upap[unit];
-	
-	if (u->us_clientstate == UPAPCS_AUTHREQ) {
-		UPAPDEBUG((LOG_ERR, "PAP authentication failed due to protocol-reject\n"));
-		auth_withpeer_fail(unit, PPP_PAP);
-	}
-	if (u->us_serverstate == UPAPSS_LISTEN) {
-		UPAPDEBUG((LOG_ERR, "PAP authentication of peer failed (protocol-reject)\n"));
-		auth_peer_fail(unit, PPP_PAP);
-	}
-	upap_lowerdown(unit);
-}
-
-
-/*
- * upap_input - Input UPAP packet.
- */
-static void upap_input(int unit, u_char *inpacket, int l)
-{
-	upap_state *u = &upap[unit];
-	u_char *inp;
-	u_char code, id;
-	int len;
-	
-	/*
-	 * Parse header (code, id and length).
-	 * If packet too short, drop it.
-	 */
-	inp = inpacket;
-	if (l < UPAP_HEADERLEN) {
-		UPAPDEBUG((LOG_INFO, "pap_input: rcvd short header.\n"));
-		return;
-	}
-	GETCHAR(code, inp);
-	GETCHAR(id, inp);
-	GETSHORT(len, inp);
-	if (len < UPAP_HEADERLEN) {
-		UPAPDEBUG((LOG_INFO, "pap_input: rcvd illegal length.\n"));
-		return;
-	}
-	if (len > l) {
-		UPAPDEBUG((LOG_INFO, "pap_input: rcvd short packet.\n"));
-		return;
-	}
-	len -= UPAP_HEADERLEN;
-	
-	/*
-	 * Action depends on code.
-	 */
-	switch (code) {
-	case UPAP_AUTHREQ:
-		upap_rauthreq(u, inp, id, len);
-		break;
-	
-	case UPAP_AUTHACK:
-		upap_rauthack(u, inp, id, len);
-		break;
-	
-	case UPAP_AUTHNAK:
-		upap_rauthnak(u, inp, id, len);
-		break;
-	
-	default:				/* XXX Need code reject */
-		break;
-	}
-}
-
-
-/*
- * upap_rauth - Receive Authenticate.
- */
-static void upap_rauthreq(
-	upap_state *u, 
-	u_char *inp, 
-	int id,
-	int len
-)
-{
-	u_char ruserlen, rpasswdlen;
-	char *ruser, *rpasswd;
-	int retcode;
-	char *msg;
-	int msglen;
-	
-	UPAPDEBUG((LOG_INFO, "pap_rauth: Rcvd id %d.\n", id));
-	
-	if (u->us_serverstate < UPAPSS_LISTEN)
-		return;
-	
-	/*
-	 * If we receive a duplicate authenticate-request, we are
-	 * supposed to return the same status as for the first request.
-	 */
-	if (u->us_serverstate == UPAPSS_OPEN) {
-		upap_sresp(u, UPAP_AUTHACK, id, "", 0);	/* return auth-ack */
-		return;
-	}
-	if (u->us_serverstate == UPAPSS_BADAUTH) {
-		upap_sresp(u, UPAP_AUTHNAK, id, "", 0);	/* return auth-nak */
-		return;
-	}
-	
-	/*
-	 * Parse user/passwd.
-	 */
-	if (len < sizeof (u_char)) {
-		UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
-		return;
-	}
-	GETCHAR(ruserlen, inp);
-	len -= sizeof (u_char) + ruserlen + sizeof (u_char);
-	if (len < 0) {
-		UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
-		return;
-	}
-	ruser = (char *) inp;
-	INCPTR(ruserlen, inp);
-	GETCHAR(rpasswdlen, inp);
-	if (len < rpasswdlen) {
-		UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
-		return;
-	}
-	rpasswd = (char *) inp;
-	
-	/*
-	 * Check the username and password given.
-	 */
-	retcode = check_passwd(u->us_unit, ruser, ruserlen, rpasswd,
-			   rpasswdlen, &msg, &msglen);
-	BZERO(rpasswd, rpasswdlen);
-	
-	upap_sresp(u, retcode, id, msg, msglen);
-	
-	if (retcode == UPAP_AUTHACK) {
-		u->us_serverstate = UPAPSS_OPEN;
-		auth_peer_success(u->us_unit, PPP_PAP, ruser, ruserlen);
-	} else {
-		u->us_serverstate = UPAPSS_BADAUTH;
-		auth_peer_fail(u->us_unit, PPP_PAP);
-	}
-	
-	if (u->us_reqtimeout > 0)
-		UNTIMEOUT(upap_reqtimeout, u);
-}
-
-
-/*
- * upap_rauthack - Receive Authenticate-Ack.
- */
-static void upap_rauthack(
-	upap_state *u,
-	u_char *inp,
-	int id,
-	int len
-)
-{
-	u_char msglen;
-	char *msg;
-	
-	UPAPDEBUG((LOG_INFO, "pap_rauthack: Rcvd id %d s=%d\n", id, u->us_clientstate));
-	
-	if (u->us_clientstate != UPAPCS_AUTHREQ) /* XXX */
-		return;
-	
-	/*
-	 * Parse message.
-	 */
-	if (len < sizeof (u_char)) {
-		UPAPDEBUG((LOG_INFO, "pap_rauthack: rcvd short packet.\n"));
-		return;
-	}
-	GETCHAR(msglen, inp);
-	len -= sizeof (u_char);
-	if (len < msglen) {
-		UPAPDEBUG((LOG_INFO, "pap_rauthack: rcvd short packet.\n"));
-		return;
-	}
-	msg = (char *) inp;
-	PRINTMSG(msg, msglen);
-	
-	u->us_clientstate = UPAPCS_OPEN;
-	
-	auth_withpeer_success(u->us_unit, PPP_PAP);
-}
-
-
-/*
- * upap_rauthnak - Receive Authenticate-Nakk.
- */
-static void upap_rauthnak(
-	upap_state *u,
-	u_char *inp,
-	int id,
-	int len
-)
-{
-	u_char msglen;
-	char *msg;
-	
-	UPAPDEBUG((LOG_INFO, "pap_rauthnak: Rcvd id %d s=%d\n", id, u->us_clientstate));
-	
-	if (u->us_clientstate != UPAPCS_AUTHREQ) /* XXX */
-		return;
-	
-	/*
-	 * Parse message.
-	 */
-	if (len < sizeof (u_char)) {
-		UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet.\n"));
-		return;
-	}
-	GETCHAR(msglen, inp);
-	len -= sizeof (u_char);
-	if (len < msglen) {
-		UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet.\n"));
-		return;
-	}
-	msg = (char *) inp;
-	PRINTMSG(msg, msglen);
-	
-	u->us_clientstate = UPAPCS_BADAUTH;
-	
-	UPAPDEBUG((LOG_ERR, "PAP authentication failed\n"));
-	auth_withpeer_fail(u->us_unit, PPP_PAP);
-}
-
-
-/*
- * upap_sauthreq - Send an Authenticate-Request.
- */
-static void upap_sauthreq(upap_state *u)
-{
-	u_char *outp;
-	int outlen;
-	
-	outlen = UPAP_HEADERLEN + 2 * sizeof (u_char) 
-			+ u->us_userlen + u->us_passwdlen;
-	outp = outpacket_buf[u->us_unit];
-	
-	MAKEHEADER(outp, PPP_PAP);
-	
-	PUTCHAR(UPAP_AUTHREQ, outp);
-	PUTCHAR(++u->us_id, outp);
-	PUTSHORT(outlen, outp);
-	PUTCHAR(u->us_userlen, outp);
-	BCOPY(u->us_user, outp, u->us_userlen);
-	INCPTR(u->us_userlen, outp);
-	PUTCHAR(u->us_passwdlen, outp);
-	BCOPY(u->us_passwd, outp, u->us_passwdlen);
-	
-	pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN);
-	
-	UPAPDEBUG((LOG_INFO, "pap_sauth: Sent id %d\n", u->us_id));
-	
-	TIMEOUT(upap_timeout, u, u->us_timeouttime);
-	++u->us_transmits;
-	u->us_clientstate = UPAPCS_AUTHREQ;
-}
-
-
-/*
- * upap_sresp - Send a response (ack or nak).
- */
-static void upap_sresp(
-	upap_state *u,
-	u_char code, 
-	u_char id,
-	char *msg,
-	int msglen
-)
-{
-	u_char *outp;
-	int outlen;
-	
-	outlen = UPAP_HEADERLEN + sizeof (u_char) + msglen;
-	outp = outpacket_buf[u->us_unit];
-	MAKEHEADER(outp, PPP_PAP);
-	
-	PUTCHAR(code, outp);
-	PUTCHAR(id, outp);
-	PUTSHORT(outlen, outp);
-	PUTCHAR(msglen, outp);
-	BCOPY(msg, outp, msglen);
-	pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN);
-	
-	UPAPDEBUG((LOG_INFO, "pap_sresp: Sent code %d, id %d s=%d\n", 
-				code, id, u->us_clientstate));
-}
-
-#if 0
-/*
- * upap_printpkt - print the contents of a PAP packet.
- */
-static int upap_printpkt(
-	u_char *p,
-	int plen,
-	void (*printer) (void *, char *, ...),
-	void *arg
-)
-{
-	(void)p;
-	(void)plen;
-	(void)printer;
-	(void)arg;
-	return 0;
-}
-#endif
-
-#endif /* PAP_SUPPORT */
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/pap.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/pap.h
deleted file mode 100644
index 215c8a4..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/pap.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*****************************************************************************
-* pap.h -  PPP Password Authentication Protocol header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-12-04 Guy Lancaster <glanca at gesn.com>, Global Election Systems Inc.
-*	Original derived from BSD codes.
-*****************************************************************************/
-/*
- * upap.h - User/Password Authentication Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-
-#ifndef PAP_H
-#define PAP_H
-
-/*************************
-*** PUBLIC DEFINITIONS ***
-*************************/
-/*
- * Packet header = Code, id, length.
- */
-#define UPAP_HEADERLEN	(sizeof (u_char) + sizeof (u_char) + sizeof (u_short))
-
-
-/*
- * UPAP codes.
- */
-#define UPAP_AUTHREQ	1	/* Authenticate-Request */
-#define UPAP_AUTHACK	2	/* Authenticate-Ack */
-#define UPAP_AUTHNAK	3	/* Authenticate-Nak */
-
-/*
- * Client states.
- */
-#define UPAPCS_INITIAL	0	/* Connection down */
-#define UPAPCS_CLOSED	1	/* Connection up, haven't requested auth */
-#define UPAPCS_PENDING	2	/* Connection down, have requested auth */
-#define UPAPCS_AUTHREQ	3	/* We've sent an Authenticate-Request */
-#define UPAPCS_OPEN		4	/* We've received an Ack */
-#define UPAPCS_BADAUTH	5	/* We've received a Nak */
-
-/*
- * Server states.
- */
-#define UPAPSS_INITIAL	0	/* Connection down */
-#define UPAPSS_CLOSED	1	/* Connection up, haven't requested auth */
-#define UPAPSS_PENDING	2	/* Connection down, have requested auth */
-#define UPAPSS_LISTEN	3	/* Listening for an Authenticate */
-#define UPAPSS_OPEN		4	/* We've sent an Ack */
-#define UPAPSS_BADAUTH	5	/* We've sent a Nak */
-
-
-/************************
-*** PUBLIC DATA TYPES ***
-************************/
-
-/*
- * Each interface is described by upap structure.
- */
-typedef struct upap_state {
-    int us_unit;			/* Interface unit number */
-    const char *us_user;	/* User */
-    int us_userlen;			/* User length */
-    const char *us_passwd;	/* Password */
-    int us_passwdlen;		/* Password length */
-    int us_clientstate;		/* Client state */
-    int us_serverstate;		/* Server state */
-    u_char us_id;			/* Current id */
-    int us_timeouttime;		/* Timeout (seconds) for auth-req retrans. */
-    int us_transmits;		/* Number of auth-reqs sent */
-    int us_maxtransmits;	/* Maximum number of auth-reqs to send */
-    int us_reqtimeout;		/* Time to wait for auth-req from peer */
-} upap_state;
-
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-
-extern upap_state upap[];
-
-void upap_setloginpasswd(int unit, const char *luser, const char *lpassword);
-void upap_authwithpeer (int, char *, char *);
-void upap_authpeer (int);
-
-extern struct protent pap_protent;
-
-#endif /* PAP_H */
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/ppp.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/ppp.c
deleted file mode 100644
index 5295f6a..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/ppp.c
+++ /dev/null
@@ -1,1631 +0,0 @@
-/*****************************************************************************
-* ppp.c - Network Point to Point Protocol program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 by Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-11-05 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*   Original.
-*****************************************************************************/
-
-/*
- * ppp_defs.h - PPP definitions.
- *
- * if_pppvar.h - private structures and declarations for PPP.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies.  This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- */
-
-/*
- * if_ppp.h - Point-to-Point Protocol definitions.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
- 
-#include <string.h>
- 
-#include "ppp.h"
-#if PPP_SUPPORT > 0
-#include "randm.h"
-#include "fsm.h"
-#if PAP_SUPPORT > 0
-#include "pap.h"
-#endif
-#if CHAP_SUPPORT > 0
-#include "chap.h"
-#endif
-#include "ipcp.h"
-#include "lcp.h"
-#include "magic.h"
-#include "auth.h"
-#if VJ_SUPPORT > 0
-#include "vj.h"
-#endif
-
-#include "pppdebug.h"
-
-/*************************/
-/*** LOCAL DEFINITIONS ***/
-/*************************/
-
-/*
- * The basic PPP frame.
- */
-#define PPP_ADDRESS(p)  (((u_char *)(p))[0])
-#define PPP_CONTROL(p)  (((u_char *)(p))[1])
-#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])
-
-/* PPP packet parser states.  Current state indicates operation yet to be
- * completed. */
-typedef enum {
-    PDIDLE = 0,                 /* Idle state - waiting. */
-    PDSTART,                    /* Process start flag. */
-    PDADDRESS,                  /* Process address field. */
-    PDCONTROL,                  /* Process control field. */
-    PDPROTOCOL1,                /* Process protocol field 1. */
-    PDPROTOCOL2,                /* Process protocol field 2. */
-    PDDATA                      /* Process data byte. */
-} PPPDevStates;
-
-#define ESCAPE_P(accm, c) ((accm)[(c) >> 3] & pppACCMMask[c & 0x07])
-
-/************************/
-/*** LOCAL DATA TYPES ***/
-/************************/
-/*
- * PPP interface control block.
- */
-typedef struct PPPControl_s {
-    char openFlag;                      /* True when in use. */
-    char oldFrame;                      /* Old framing character for fd. */
-    sio_fd_t fd;                    /* File device ID of port. */
-    int  kill_link;                     /* Shut the link down. */
-    int  sig_hup;                       /* Carrier lost. */
-    int  if_up;                         /* True when the interface is up. */
-    int  errCode;                       /* Code indicating why interface is down. */
-    struct pbuf *inHead, *inTail;       /* The input packet. */
-    PPPDevStates inState;               /* The input process state. */
-    char inEscaped;                     /* Escape next character. */
-    u16_t inProtocol;                   /* The input protocol code. */
-    u16_t inFCS;                        /* Input Frame Check Sequence value. */
-    int  mtu;                           /* Peer's mru */
-    int  pcomp;                         /* Does peer accept protocol compression? */
-    int  accomp;                        /* Does peer accept addr/ctl compression? */
-    u_long lastXMit;                    /* Time of last transmission. */
-    ext_accm inACCM;                    /* Async-Ctl-Char-Map for input. */
-    ext_accm outACCM;                   /* Async-Ctl-Char-Map for output. */
-#if VJ_SUPPORT > 0
-    int  vjEnabled;                     /* Flag indicating VJ compression enabled. */
-    struct vjcompress vjComp;           /* Van Jabobsen compression header. */
-#endif
-
-    struct netif netif;
-
-    struct ppp_addrs addrs;
-
-    void (*linkStatusCB)(void *ctx, int errCode, void *arg);
-    void *linkStatusCtx;
-
-} PPPControl;
-
-
-/*
- * Ioctl definitions.
- */
-
-struct npioctl {
-    int     protocol;           /* PPP procotol, e.g. PPP_IP */
-    enum NPmode mode;
-};
-
-
-
-/***********************************/
-/*** LOCAL FUNCTION DECLARATIONS ***/
-/***********************************/
-static void pppMain(void *pd);
-static void pppDrop(PPPControl *pc);
-static void pppInProc(int pd, u_char *s, int l);
-
-
-/******************************/
-/*** PUBLIC DATA STRUCTURES ***/
-/******************************/
-u_long subnetMask;
-
-static PPPControl pppControl[NUM_PPP]; /* The PPP interface control blocks. */
-
-/*
- * PPP Data Link Layer "protocol" table.
- * One entry per supported protocol.
- * The last entry must be NULL.
- */
-struct protent *ppp_protocols[] = {
-    &lcp_protent,
-#if PAP_SUPPORT > 0
-    &pap_protent,
-#endif
-#if CHAP_SUPPORT > 0
-    &chap_protent,
-#endif
-#if CBCP_SUPPORT > 0
-    &cbcp_protent,
-#endif
-    &ipcp_protent,
-#if CCP_SUPPORT > 0
-    &ccp_protent,
-#endif
-    NULL
-};
-
-
-/*
- * Buffers for outgoing packets.  This must be accessed only from the appropriate
- * PPP task so that it doesn't need to be protected to avoid collisions.
- */
-u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN];  
-
-
-/*****************************/
-/*** LOCAL DATA STRUCTURES ***/
-/*****************************/
-
-/*
- * FCS lookup table as calculated by genfcstab.
- */
-static const u_short fcstab[256] = {
-    0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
-    0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
-    0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
-    0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
-    0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
-    0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
-    0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
-    0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
-    0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
-    0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
-    0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
-    0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
-    0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
-    0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
-    0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
-    0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
-    0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
-    0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
-    0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
-    0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
-    0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
-    0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
-    0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
-    0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
-    0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
-    0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
-    0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
-    0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
-    0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
-    0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
-    0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
-    0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
-};
-
-/* PPP's Asynchronous-Control-Character-Map.  The mask array is used
- * to select the specific bit for a character. */
-static u_char pppACCMMask[] = {
-    0x01,
-    0x02,
-    0x04,
-    0x08,
-    0x10,
-    0x20,
-    0x40,
-    0x80
-};
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-/* Initialize the PPP subsystem. */
-
-struct ppp_settings ppp_settings;
-
-void pppInit(void)
-{
-    struct protent *protp;
-    int i, j;
-    
-	memset(&ppp_settings, 0, sizeof(ppp_settings));
-	ppp_settings.usepeerdns = 1;
-	pppSetAuth(PPPAUTHTYPE_NONE, NULL, NULL);
-
-	magicInit();
-
-    for (i = 0; i < NUM_PPP; i++) {
-        pppControl[i].openFlag = 0;
-
-		subnetMask = htonl(0xffffff00);
-    
-        /*
-         * Initialize to the standard option set.
-         */
-        for (j = 0; (protp = ppp_protocols[j]) != NULL; ++j)
-            (*protp->init)(i);
-    }
-
-#if LINK_STATS
-    /* Clear the statistics. */
-    memset(&lwip_stats.link, 0, sizeof(lwip_stats.link));
-#endif
-}
-
-void pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd)
-{
-    switch(authType) {
-	case PPPAUTHTYPE_NONE:
-	default:
-#ifdef LWIP_PPP_STRICT_PAP_REJECT
-	    ppp_settings.refuse_pap = 1;
-#else
-	    /* some providers request pap and accept an empty login/pw */
-	    ppp_settings.refuse_pap = 0;
-#endif
-	    ppp_settings.refuse_chap = 1;
-	    break;
-	case PPPAUTHTYPE_ANY:
-/* Warning: Using PPPAUTHTYPE_ANY might have security consequences.
- * RFC 1994 says:
- *
- * In practice, within or associated with each PPP server, there is a
- * database which associates "user" names with authentication
- * information ("secrets").  It is not anticipated that a particular
- * named user would be authenticated by multiple methods.  This would
- * make the user vulnerable to attacks which negotiate the least secure
- * method from among a set (such as PAP rather than CHAP).  If the same
- * secret was used, PAP would reveal the secret to be used later with
- * CHAP.
- *
- * Instead, for each user name there should be an indication of exactly
- * one method used to authenticate that user name.  If a user needs to
- * make use of different authentication methods under different
- * circumstances, then distinct user names SHOULD be employed, each of
- * which identifies exactly one authentication method.
- *
- */
-	    ppp_settings.refuse_pap = 0;
-	    ppp_settings.refuse_chap = 0;
-	    break;
-	case PPPAUTHTYPE_PAP:
-	    ppp_settings.refuse_pap = 0;
-	    ppp_settings.refuse_chap = 1;
-	    break;
-	case PPPAUTHTYPE_CHAP:
-	    ppp_settings.refuse_pap = 1;
-	    ppp_settings.refuse_chap = 0;
-	    break;
-    }
-
-    if(user) {
-	strncpy(ppp_settings.user, user, sizeof(ppp_settings.user)-1);
-	ppp_settings.user[sizeof(ppp_settings.user)-1] = '\0';
-    } else
-	ppp_settings.user[0] = '\0';
-
-    if(passwd) {
-	strncpy(ppp_settings.passwd, passwd, sizeof(ppp_settings.passwd)-1);
-	ppp_settings.passwd[sizeof(ppp_settings.passwd)-1] = '\0';
-    } else
-	ppp_settings.passwd[0] = '\0';
-}
-
-/* Open a new PPP connection using the given I/O device.
- * This initializes the PPP control block but does not
- * attempt to negotiate the LCP session.  If this port
- * connects to a modem, the modem connection must be
- * established before calling this.
- * Return a new PPP connection descriptor on success or
- * an error code (negative) on failure. */
-int pppOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx)
-{
-    PPPControl *pc;
-    int pd;
-
-    /* Find a free PPP session descriptor. Critical region? */
-    for (pd = 0; pd < NUM_PPP && pppControl[pd].openFlag != 0; pd++);
-    if (pd >= NUM_PPP)
-        pd = PPPERR_OPEN;
-    else
-        pppControl[pd].openFlag = !0;
-
-    /* Launch a deamon thread. */
-    if (pd >= 0) {
-
-        pppControl[pd].openFlag = 1;
-
-        lcp_init(pd);
-        pc = &pppControl[pd];
-        pc->fd = fd;
-        pc->kill_link = 0;
-        pc->sig_hup = 0;
-        pc->if_up = 0;
-        pc->errCode = 0;
-        pc->inState = PDIDLE;
-        pc->inHead = NULL;
-        pc->inTail = NULL;
-        pc->inEscaped = 0;
-        pc->lastXMit = 0;
-
-#if VJ_SUPPORT > 0
-        pc->vjEnabled = 0;
-        vj_compress_init(&pc->vjComp);
-#endif
-
-        /* 
-         * Default the in and out accm so that escape and flag characters
-         * are always escaped. 
-         */
-        memset(pc->inACCM, 0, sizeof(ext_accm));
-        pc->inACCM[15] = 0x60;
-        memset(pc->outACCM, 0, sizeof(ext_accm));
-        pc->outACCM[15] = 0x60;
-
-	pc->linkStatusCB = linkStatusCB;
-	pc->linkStatusCtx = linkStatusCtx;
-
-	sys_thread_new(pppMain, (void*)pd, PPP_THREAD_PRIO);
-	if(!linkStatusCB) {
-		while(pd >= 0 && !pc->if_up) {
-			sys_msleep(500);
-			if (lcp_phase[pd] == PHASE_DEAD) {
-				pppClose(pd);
-				if (pc->errCode)
-					pd = pc->errCode;
-				else
-					pd = PPPERR_CONNECT;
-			}
-		}
-	}
-    }
-    return pd;
-}
-
-/* Close a PPP connection and release the descriptor. 
- * Any outstanding packets in the queues are dropped.
- * Return 0 on success, an error code on failure. */
-int pppClose(int pd)
-{
-    PPPControl *pc = &pppControl[pd];
-    int st = 0;
-
-    /* Disconnect */
-    pc->kill_link = !0;
-    pppMainWakeup(pd);
-    
-    if(!pc->linkStatusCB) {
-	    while(st >= 0 && lcp_phase[pd] != PHASE_DEAD) {
-		    sys_msleep(500);
-		    break;
-	    }
-    }
-    return st;
-}
-
-/* This function is called when carrier is lost on the PPP channel. */
-void pppSigHUP(int pd)
-{
-    PPPControl *pc = &pppControl[pd];
-
-    pc->sig_hup = 1;
-    pppMainWakeup(pd);
-}
-
-static void nPut(PPPControl *pc, struct pbuf *nb)
-{
-	struct pbuf *b;
-	int c;
-
-	for(b = nb; b != NULL; b = b->next) {
-	    if((c = sio_write(pc->fd, b->payload, b->len)) != b->len) {
-		PPPDEBUG((LOG_WARNING,
-			    "PPP nPut: incomplete sio_write(%d,, %u) = %d\n", pc->fd, b->len, c));
-#if LINK_STATS
-		lwip_stats.link.err++;
-#endif /* LINK_STATS */
-		pc->lastXMit = 0; /* prepend PPP_FLAG to next packet */
-		break;
-	    }
-	}
-	pbuf_free(nb);
-
-#if LINK_STATS
-	lwip_stats.link.xmit++;
-#endif /* LINK_STATS */
-}
-
-/* 
- * pppAppend - append given character to end of given pbuf.  If outACCM
- * is not NULL and the character needs to be escaped, do so.
- * If pbuf is full, append another.
- * Return the current pbuf.
- */
-static struct pbuf *pppAppend(u_char c, struct pbuf *nb, ext_accm *outACCM)
-{
-    struct pbuf *tb = nb;
-    
-    /* Make sure there is room for the character and an escape code.
-     * Sure we don't quite fill the buffer if the character doesn't
-     * get escaped but is one character worth complicating this? */
-    /* Note: We assume no packet header. */
-    if (nb && (PBUF_POOL_BUFSIZE - nb->len) < 2) {
-	tb = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
-	if (tb) {
-	    nb->next = tb;
-        }
-#if LINK_STATS
-	else {
-	    lwip_stats.link.memerr++;
-	}
-#endif /* LINK_STATS */
-	nb = tb;
-    }
-    if (nb) {
-	if (outACCM && ESCAPE_P(*outACCM, c)) {
-            *((u_char*)nb->payload + nb->len++) = PPP_ESCAPE;
-            *((u_char*)nb->payload + nb->len++) = c ^ PPP_TRANS;
-        }
-        else
-            *((u_char*)nb->payload + nb->len++) = c;
-    }
-        
-    return tb;
-}
-
-/* Send a packet on the given connection. */
-static err_t pppifOutput(struct netif *netif, struct pbuf *pb, struct ip_addr *ipaddr)
-{
-    int pd = (int)netif->state;
-    u_short protocol = PPP_IP;
-    PPPControl *pc = &pppControl[pd];
-    u_int fcsOut = PPP_INITFCS;
-    struct pbuf *headMB = NULL, *tailMB = NULL, *p;
-    u_char c;
-
-    (void)ipaddr;
-
-    /* Validate parameters. */
-    /* We let any protocol value go through - it can't hurt us
-     * and the peer will just drop it if it's not accepting it. */
-	if (pd < 0 || pd >= NUM_PPP || !pc->openFlag || !pb) {
-        PPPDEBUG((LOG_WARNING, "pppifOutput[%d]: bad parms prot=%d pb=%p\n",
-                    pd, protocol, pb));
-#if LINK_STATS
-		lwip_stats.link.opterr++;
-		lwip_stats.link.drop++;
-#endif
-		return ERR_ARG;
-	}
-
-    /* Check that the link is up. */
-	if (lcp_phase[pd] == PHASE_DEAD) {
-        PPPDEBUG((LOG_ERR, "pppifOutput[%d]: link not up\n", pd));
-#if LINK_STATS
-		lwip_stats.link.rterr++;
-		lwip_stats.link.drop++;
-#endif
-		return ERR_RTE;
-	}
-
-    /* Grab an output buffer. */
-	headMB = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
-    if (headMB == NULL) {
-        PPPDEBUG((LOG_WARNING, "pppifOutput[%d]: first alloc fail\n", pd));
-#if LINK_STATS
-		lwip_stats.link.memerr++;
-		lwip_stats.link.drop++;
-#endif /* LINK_STATS */
-        return ERR_MEM;
-    }
-        
-#if VJ_SUPPORT > 0
-    /* 
-     * Attempt Van Jacobson header compression if VJ is configured and
-     * this is an IP packet. 
-     */
-    if (protocol == PPP_IP && pc->vjEnabled) {
-        switch (vj_compress_tcp(&pc->vjComp, pb)) {
-        case TYPE_IP:
-            /* No change...
-            protocol = PPP_IP_PROTOCOL;
-             */
-            break;
-        case TYPE_COMPRESSED_TCP:
-            protocol = PPP_VJC_COMP;
-            break;
-        case TYPE_UNCOMPRESSED_TCP:
-            protocol = PPP_VJC_UNCOMP;
-            break;
-        default:
-            PPPDEBUG((LOG_WARNING, "pppifOutput[%d]: bad IP packet\n", pd));
-#if LINK_STATS
-			lwip_stats.link.proterr++;
-			lwip_stats.link.drop++;
-#endif
-        	pbuf_free(headMB);
-            return ERR_VAL;
-        }
-    }
-#endif
-        
-    tailMB = headMB;
-        
-    /* Build the PPP header. */
-    if ((sys_jiffies() - pc->lastXMit) >= PPP_MAXIDLEFLAG)
-        tailMB = pppAppend(PPP_FLAG, tailMB, NULL);
-    pc->lastXMit = sys_jiffies();
-    if (!pc->accomp) {
-        fcsOut = PPP_FCS(fcsOut, PPP_ALLSTATIONS);
-        tailMB = pppAppend(PPP_ALLSTATIONS, tailMB, &pc->outACCM);
-        fcsOut = PPP_FCS(fcsOut, PPP_UI);
-        tailMB = pppAppend(PPP_UI, tailMB, &pc->outACCM);
-    }
-    if (!pc->pcomp || protocol > 0xFF) {
-        c = (protocol >> 8) & 0xFF;
-        fcsOut = PPP_FCS(fcsOut, c);
-        tailMB = pppAppend(c, tailMB, &pc->outACCM);
-    }
-    c = protocol & 0xFF;
-    fcsOut = PPP_FCS(fcsOut, c);
-    tailMB = pppAppend(c, tailMB, &pc->outACCM);
-    
-    /* Load packet. */
-	for(p = pb; p; p = p->next) {
-    	int n;
-    	u_char *sPtr;
-
-        sPtr = (u_char*)p->payload;
-        n = p->len;
-        while (n-- > 0) {
-            c = *sPtr++;
-            
-            /* Update FCS before checking for special characters. */
-            fcsOut = PPP_FCS(fcsOut, c);
-            
-            /* Copy to output buffer escaping special characters. */
-            tailMB = pppAppend(c, tailMB, &pc->outACCM);
-        }
-    }
-
-    /* Add FCS and trailing flag. */
-    c = ~fcsOut & 0xFF;
-    tailMB = pppAppend(c, tailMB, &pc->outACCM);
-    c = (~fcsOut >> 8) & 0xFF;
-    tailMB = pppAppend(c, tailMB, &pc->outACCM);
-    tailMB = pppAppend(PPP_FLAG, tailMB, NULL);
-        
-    /* If we failed to complete the packet, throw it away. */
-    if (!tailMB) {
-        PPPDEBUG((LOG_WARNING,
-                    "pppifOutput[%d]: Alloc err - dropping proto=%d\n", 
-                    pd, protocol));
-        pbuf_free(headMB);
-#if LINK_STATS
-		lwip_stats.link.memerr++;
-		lwip_stats.link.drop++;
-#endif
-        return ERR_MEM;
-    }
-
-	/* Send it. */
-    PPPDEBUG((LOG_INFO, "pppifOutput[%d]: proto=0x%04X\n", pd, protocol));
-
-    nPut(pc, headMB);
-
-    return ERR_OK;
-}
-
-/* Get and set parameters for the given connection.
- * Return 0 on success, an error code on failure. */
-int  pppIOCtl(int pd, int cmd, void *arg)
-{
-    PPPControl *pc = &pppControl[pd];
-    int st = 0;
-
-    if (pd < 0 || pd >= NUM_PPP)
-        st = PPPERR_PARAM;
-    else {
-        switch(cmd) {
-        case PPPCTLG_UPSTATUS:      /* Get the PPP up status. */
-            if (arg) 
-                *(int *)arg = (int)(pc->if_up);
-            else
-                st = PPPERR_PARAM;
-            break;
-        case PPPCTLS_ERRCODE:       /* Set the PPP error code. */
-            if (arg) 
-                pc->errCode = *(int *)arg;
-            else
-                st = PPPERR_PARAM;
-            break;
-        case PPPCTLG_ERRCODE:       /* Get the PPP error code. */
-            if (arg) 
-                *(int *)arg = (int)(pc->errCode);
-            else
-                st = PPPERR_PARAM;
-            break;
-        case PPPCTLG_FD:
-            if (arg) 
-                *(sio_fd_t *)arg = pc->fd;
-            else
-                st = PPPERR_PARAM;
-            break;
-        default:
-            st = PPPERR_PARAM;
-            break;
-        }
-    }
-    
-    return st;
-}
-
-/*
- * Return the Maximum Transmission Unit for the given PPP connection.
- */
-u_int pppMTU(int pd)
-{
-    PPPControl *pc = &pppControl[pd];
-    u_int st;
-    
-    /* Validate parameters. */
-    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag)
-        st = 0;
-    else
-        st = pc->mtu;
-        
-    return st;
-}
-
-/*
- * Write n characters to a ppp link.
- *  RETURN: >= 0 Number of characters written
- *           -1 Failed to write to device
- */
-int pppWrite(int pd, const u_char *s, int n)
-{
-    PPPControl *pc = &pppControl[pd];
-    u_char c;
-    u_int fcsOut = PPP_INITFCS;
-    struct pbuf *headMB = NULL, *tailMB;
-	headMB = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
-    if (headMB == NULL) {
-#if LINK_STATS
-		lwip_stats.link.memerr++;
-		lwip_stats.link.proterr++;
-#endif /* LINK_STATS */
-		return PPPERR_ALLOC;
-    }
-
-    tailMB = headMB;
-        
-    /* If the link has been idle, we'll send a fresh flag character to
-     * flush any noise. */
-    if ((sys_jiffies() - pc->lastXMit) >= PPP_MAXIDLEFLAG)
-        tailMB = pppAppend(PPP_FLAG, tailMB, NULL);
-    pc->lastXMit = sys_jiffies();
-     
-    /* Load output buffer. */
-    while (n-- > 0) {
-        c = *s++;
-        
-        /* Update FCS before checking for special characters. */
-        fcsOut = PPP_FCS(fcsOut, c);
-        
-        /* Copy to output buffer escaping special characters. */
-        tailMB = pppAppend(c, tailMB, &pc->outACCM);
-    }
-    
-    /* Add FCS and trailing flag. */
-    c = ~fcsOut & 0xFF;
-    tailMB = pppAppend(c, tailMB, &pc->outACCM);
-    c = (~fcsOut >> 8) & 0xFF;
-    tailMB = pppAppend(c, tailMB, &pc->outACCM);
-    tailMB = pppAppend(PPP_FLAG, tailMB, NULL);
-        
-    /* If we failed to complete the packet, throw it away.
-     * Otherwise send it. */
-    if (!tailMB) {
-		PPPDEBUG((LOG_WARNING,
-                "pppWrite[%d]: Alloc err - dropping pbuf len=%d\n", pd, headMB->len));
-/*                "pppWrite[%d]: Alloc err - dropping %d:%.*H", pd, headMB->len, LWIP_MIN(headMB->len * 2, 40), headMB->payload)); */
-		pbuf_free(headMB);
-#if LINK_STATS
-		lwip_stats.link.memerr++;
-		lwip_stats.link.proterr++;
-#endif /* LINK_STATS */
-		return PPPERR_ALLOC;
-	}
-
-    PPPDEBUG((LOG_INFO, "pppWrite[%d]: len=%d\n", pd, headMB->len));
-/*     "pppWrite[%d]: %d:%.*H", pd, headMB->len, LWIP_MIN(headMB->len * 2, 40), headMB->payload)); */
-    nPut(pc, headMB);
-
-    return PPPERR_NONE;
-}
-
-/*
- * ppp_send_config - configure the transmit characteristics of
- * the ppp interface.
- */
-void ppp_send_config(
-    int unit, 
-    int mtu,
-    u32_t asyncmap,
-    int pcomp, 
-    int accomp
-)
-{
-    PPPControl *pc = &pppControl[unit];
-    int i;
-    
-    pc->mtu = mtu;
-    pc->pcomp = pcomp;
-    pc->accomp = accomp;
-    
-    /* Load the ACCM bits for the 32 control codes. */
-    for (i = 0; i < 32/8; i++)
-        pc->outACCM[i] = (u_char)((asyncmap >> (8 * i)) & 0xFF);
-    PPPDEBUG((LOG_INFO, "ppp_send_config[%d]: outACCM=%X %X %X %X\n",
-                unit,
-                pc->outACCM[0], pc->outACCM[1], pc->outACCM[2], pc->outACCM[3]));
-}
-
-
-/*
- * ppp_set_xaccm - set the extended transmit ACCM for the interface.
- */
-void ppp_set_xaccm(int unit, ext_accm *accm)
-{
-    memcpy(pppControl[unit].outACCM, accm, sizeof(ext_accm));
-    PPPDEBUG((LOG_INFO, "ppp_set_xaccm[%d]: outACCM=%X %X %X %X\n",
-                unit,
-                pppControl[unit].outACCM[0],
-                pppControl[unit].outACCM[1],
-                pppControl[unit].outACCM[2],
-                pppControl[unit].outACCM[3]));
-}
-
-
-/*
- * ppp_recv_config - configure the receive-side characteristics of
- * the ppp interface.
- */
-void ppp_recv_config(
-    int unit, 
-    int mru,
-    u32_t asyncmap,
-    int pcomp, 
-    int accomp
-)
-{
-    PPPControl *pc = &pppControl[unit];
-    int i;
-    
-	(void)accomp;
-	(void)pcomp;
-	(void)mru;
-
-    /* Load the ACCM bits for the 32 control codes. */
-    for (i = 0; i < 32 / 8; i++)
-        pc->inACCM[i] = (u_char)(asyncmap >> (i * 8));
-    PPPDEBUG((LOG_INFO, "ppp_recv_config[%d]: inACCM=%X %X %X %X\n",
-                unit,
-                pc->inACCM[0], pc->inACCM[1], pc->inACCM[2], pc->inACCM[3]));
-}
-
-#if 0
-/*
- * ccp_test - ask kernel whether a given compression method
- * is acceptable for use.  Returns 1 if the method and parameters
- * are OK, 0 if the method is known but the parameters are not OK
- * (e.g. code size should be reduced), or -1 if the method is unknown.
- */
-int ccp_test(
-    int unit, 
-    int opt_len, 
-    int for_transmit,
-    u_char *opt_ptr
-)
-{
-    return 0;   /* XXX Currently no compression. */
-}
-
-/*
- * ccp_flags_set - inform kernel about the current state of CCP.
- */
-void ccp_flags_set(int unit, int isopen, int isup)
-{
-    /* XXX */
-}
-
-/*
- * ccp_fatal_error - returns 1 if decompression was disabled as a
- * result of an error detected after decompression of a packet,
- * 0 otherwise.  This is necessary because of patent nonsense.
- */
-int ccp_fatal_error(int unit)
-{
-    /* XXX */
-    return 0;
-}
-#endif
-
-/*
- * get_idle_time - return how long the link has been idle.
- */
-int get_idle_time(int u, struct ppp_idle *ip)
-{   
-    /* XXX */
-	(void)u;
-	(void)ip;
-
-    return 0;
-}
-
-
-/*
- * Return user specified netmask, modified by any mask we might determine
- * for address `addr' (in network byte order).
- * Here we scan through the system's list of interfaces, looking for
- * any non-point-to-point interfaces which might appear to be on the same
- * network as `addr'.  If we find any, we OR in their netmask to the
- * user-specified netmask.
- */
-u32_t GetMask(u32_t addr)
-{
-    u32_t mask, nmask;
-    
-    htonl(addr);
-    if (IN_CLASSA(addr))    /* determine network mask for address class */
-        nmask = IN_CLASSA_NET;
-    else if (IN_CLASSB(addr))
-        nmask = IN_CLASSB_NET;
-    else
-        nmask = IN_CLASSC_NET;
-    /* class D nets are disallowed by bad_ip_adrs */
-    mask = subnetMask | htonl(nmask);
-    
-    /* XXX
-     * Scan through the system's network interfaces.
-     * Get each netmask and OR them into our mask.
-     */
-    
-    return mask;
-}
-
-/*
- * sifvjcomp - config tcp header compression
- */
-int sifvjcomp(
-    int pd, 
-    int vjcomp, 
-    int cidcomp, 
-    int maxcid
-)
-{
-#if VJ_SUPPORT > 0
-    PPPControl *pc = &pppControl[pd];
-    
-    pc->vjEnabled = vjcomp;
-    pc->vjComp.compressSlot = cidcomp;
-    pc->vjComp.maxSlotIndex = maxcid;
-    PPPDEBUG((LOG_INFO, "sifvjcomp: VJ compress enable=%d slot=%d max slot=%d\n",
-                vjcomp, cidcomp, maxcid));
-#endif
-
-    return 0;
-}
-
-/*
- * pppifNetifInit - netif init callback
- */
-static err_t pppifNetifInit(struct netif *netif)
-{
-	netif->name[0] = 'p';
-	netif->name[1] = 'p';
-	netif->output = pppifOutput;
-	netif->mtu = pppMTU((int)netif->state);
-	return ERR_OK;
-}
-
-
-/*
- * sifup - Config the interface up and enable IP packets to pass.
- */
-int sifup(int pd)
-{
-    PPPControl *pc = &pppControl[pd];
-    int st = 1;
-    
-    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
-        st = 0;
-        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
-    } else {
-		netif_remove(&pc->netif);
-		if (netif_add(&pc->netif, &pc->addrs.our_ipaddr, &pc->addrs.netmask, &pc->addrs.his_ipaddr, (void *)pd, pppifNetifInit, ip_input)) {
-        	
-        	netif_set_up(&pc->netif);
-        	pc->if_up = 1;
-        	pc->errCode = PPPERR_NONE;
-
-			PPPDEBUG((LOG_DEBUG, "sifup: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
-			if(pc->linkStatusCB)
-				pc->linkStatusCB(pc->linkStatusCtx, pc->errCode, &pc->addrs);
-		} else {
-        	st = 0;
-        	PPPDEBUG((LOG_ERR, "sifup[%d]: netif_add failed\n", pd));
-		}
-    }
-
-    return st;
-}
-
-/*
- * sifnpmode - Set the mode for handling packets for a given NP.
- */
-int sifnpmode(int u, int proto, enum NPmode mode)
-{
-	(void)u;
-	(void)proto;
-	(void)mode;
-    return 0;
-}
-
-/*
- * sifdown - Config the interface down and disable IP.
- */
-int sifdown(int pd)
-{
-    PPPControl *pc = &pppControl[pd];
-    int st = 1;
-    
-    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
-        st = 0;
-        PPPDEBUG((LOG_WARNING, "sifdown[%d]: bad parms\n", pd));
-    } else {
-        pc->if_up = 0;
-	netif_remove(&pc->netif);
-	PPPDEBUG((LOG_DEBUG, "sifdown: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
-	if(pc->linkStatusCB)
-		pc->linkStatusCB(pc->linkStatusCtx, PPPERR_CONNECT, NULL);
-	}
-    return st;
-}
-
-/*
- * sifaddr - Config the interface IP addresses and netmask.
- */
-int sifaddr(
-    int pd,             /* Interface unit ??? */
-    u32_t o,        /* Our IP address ??? */
-    u32_t h,        /* His IP address ??? */
-    u32_t m,        /* IP subnet mask ??? */
-    u32_t ns1,      /* Primary DNS */
-    u32_t ns2       /* Secondary DNS */
-)
-{
-    PPPControl *pc = &pppControl[pd];
-    int st = 1;
-    
-    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
-        st = 0;
-        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
-    } else {
-		memcpy(&pc->addrs.our_ipaddr, &o, sizeof(o));
-		memcpy(&pc->addrs.his_ipaddr, &h, sizeof(h));
-		memcpy(&pc->addrs.netmask, &m, sizeof(m));
-		memcpy(&pc->addrs.dns1, &ns1, sizeof(ns1));
-		memcpy(&pc->addrs.dns2, &ns2, sizeof(ns2));
-    }
-    return st;
-}
-
-/*
- * cifaddr - Clear the interface IP addresses, and delete routes
- * through the interface if possible.
- */
-int cifaddr(
-    int pd,         /* Interface unit ??? */
-    u32_t o,    /* Our IP address ??? */
-    u32_t h     /* IP broadcast address ??? */
-)
-{
-    PPPControl *pc = &pppControl[pd];
-    int st = 1;
-    
-	(void)o;
-	(void)h;
-    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
-        st = 0;
-        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
-    } else {
-		IP4_ADDR(&pc->addrs.our_ipaddr, 0,0,0,0);
-		IP4_ADDR(&pc->addrs.his_ipaddr, 0,0,0,0);
-		IP4_ADDR(&pc->addrs.netmask, 255,255,255,0);
-		IP4_ADDR(&pc->addrs.dns1, 0,0,0,0);
-		IP4_ADDR(&pc->addrs.dns2, 0,0,0,0);
-    }
-    return st;
-}
-
-/*
- * sifdefaultroute - assign a default route through the address given.
- */
-int sifdefaultroute(int pd, u32_t l, u32_t g)
-{
-    PPPControl *pc = &pppControl[pd];
-    int st = 1;
-    
-	(void)l;
-	(void)g;
-    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
-        st = 0;
-        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
-    } else {
-		netif_set_default(&pc->netif);
-    }
-
-    /* TODO: check how PPP handled the netMask, previously not set by ipSetDefault */
-
-    return st;
-}
-
-/*
- * cifdefaultroute - delete a default route through the address given.
- */
-int cifdefaultroute(int pd, u32_t l, u32_t g)
-{
-    PPPControl *pc = &pppControl[pd];
-    int st = 1;
-    
-	(void)l;
-	(void)g;
-    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
-        st = 0;
-        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
-    } else {
-		netif_set_default(NULL);
-    }
-
-    return st;
-}
-
-void
-pppMainWakeup(int pd)
-{
-	PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d\n", pd));
-	sio_read_abort(pppControl[pd].fd);
-}
-
-/* these callbacks are necessary because lcp_* functions
-   must be called in the same context as pppInput(),
-   namely the tcpip_thread(), essentially because
-   they manipulate timeouts which are thread-private
-*/
-
-static void
-pppStartCB(void *arg)
-{
-    int pd = (int)arg;
-
-	PPPDEBUG((LOG_DEBUG, "pppStartCB: unit %d\n", pd));
-    lcp_lowerup(pd);
-    lcp_open(pd);      /* Start protocol */
-}
-
-static void
-pppStopCB(void *arg)
-{
-    int pd = (int)arg;
-
-	PPPDEBUG((LOG_DEBUG, "pppStopCB: unit %d\n", pd));
-    lcp_close(pd, "User request");
-}
-
-static void
-pppHupCB(void *arg)
-{
-    int pd = (int)arg;
-
-	PPPDEBUG((LOG_DEBUG, "pppHupCB: unit %d\n", pd));
-    lcp_lowerdown(pd);
-    link_terminated(pd);
-}
-/**********************************/
-/*** LOCAL FUNCTION DEFINITIONS ***/
-/**********************************/
-/* The main PPP process function.  This implements the state machine according
- * to section 4 of RFC 1661: The Point-To-Point Protocol. */
-static void pppMain(void *arg)
-{
-    int pd = (int)arg;
-    struct pbuf *p;
-    PPPControl* pc;
-
-    pc = &pppControl[pd];
-
-    p = pbuf_alloc(PBUF_RAW, PPP_MRU+PPP_HDRLEN, PBUF_RAM);
-    if(!p) {
-		LWIP_ASSERT("p != NULL", p);
-		pc->errCode = PPPERR_ALLOC;
-		goto out;
-    }
-
-    /*
-     * Start the connection and handle incoming events (packet or timeout).
-     */
-	PPPDEBUG((LOG_INFO, "pppMain: unit %d: Connecting\n", pd));
-    tcpip_callback(pppStartCB, arg);
-    while (lcp_phase[pd] != PHASE_DEAD) {
-        if (pc->kill_link) {
-	    	PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d kill_link -> pppStopCB\n", pd));
-		pc->errCode = PPPERR_USER;
-		/* This will leave us at PHASE_DEAD. */
-    		tcpip_callback(pppStopCB, arg);
-		pc->kill_link = 0;
-        }
-        else if (pc->sig_hup) {
-	    	PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d sig_hup -> pppHupCB\n", pd));
-		pc->sig_hup = 0;
-    		tcpip_callback(pppHupCB, arg);
-        } else {
-		int c = sio_read(pc->fd, p->payload, p->len);
-		if(c > 0) {
-			pppInProc(pd, p->payload, c);
-		} else {
-		    PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d sio_read len=%d returned %d\n", pd, p->len, c));
-		    sys_msleep(1); /* give other tasks a chance to run */
-		}
-        }
-    }
-	PPPDEBUG((LOG_INFO, "pppMain: unit %d: PHASE_DEAD\n", pd));
-    pbuf_free(p);
-
-out:
-	PPPDEBUG((LOG_DEBUG, "pppMain: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
-    if(pc->linkStatusCB)
-	    pc->linkStatusCB(pc->linkStatusCtx, pc->errCode ? pc->errCode : PPPERR_PROTOCOL, NULL);
-
-    pc->openFlag = 0;
-}
-
-static struct pbuf *pppSingleBuf(struct pbuf *p)
-{
-	struct pbuf *q, *b;
-	u_char *pl;
-
-	if(p->tot_len == p->len)
-		return p;
-
-	q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
-	if(!q) {
-		PPPDEBUG((LOG_ERR,
-                        "pppSingleBuf: unable to alloc new buf (%d)\n", p->tot_len));
-		return p; /* live dangerously */
-	}
-
-	for(b = p, pl = q->payload; b != NULL; b = b->next) {
-		memcpy(pl, b->payload, b->len);
-		pl += b->len;
-	}
-
-	pbuf_free(p);
-
-	return q;
-}
-
-struct pppInputHeader {
-	int unit;
-	u16_t proto;
-};
-
-/*
- * Pass the processed input packet to the appropriate handler.
- * This function and all handlers run in the context of the tcpip_thread
- */
-static void pppInput(void *arg)
-{
-	struct pbuf *nb = (struct pbuf *)arg;
-    u16_t protocol;
-    int pd;
-
-	pd = ((struct pppInputHeader *)nb->payload)->unit;
-	protocol = ((struct pppInputHeader *)nb->payload)->proto;
-
-    pbuf_header(nb, -(int)sizeof(struct pppInputHeader));
-
-#if LINK_STATS
-    lwip_stats.link.recv++;
-#endif /* LINK_STATS */
-
-    /*
-     * Toss all non-LCP packets unless LCP is OPEN.
-     * Until we get past the authentication phase, toss all packets
-     * except LCP, LQR and authentication packets.
-     */
-    if((lcp_phase[pd] <= PHASE_AUTHENTICATE) && (protocol != PPP_LCP)) {
-	    if(!((protocol == PPP_LQR) || (protocol == PPP_PAP) || (protocol == PPP_CHAP)) ||
-			(lcp_phase[pd] != PHASE_AUTHENTICATE)) {
-		PPPDEBUG((LOG_INFO, "pppInput: discarding proto 0x%04X in phase %d\n", protocol, lcp_phase[pd]));
-		goto drop;
-	    }
-    }
-
-    switch(protocol) {
-    case PPP_VJC_COMP:      /* VJ compressed TCP */
-#if VJ_SUPPORT > 0
-        PPPDEBUG((LOG_INFO, "pppInput[%d]: vj_comp in pbuf len=%d\n", pd, nb->len));
-        /*
-         * Clip off the VJ header and prepend the rebuilt TCP/IP header and
-         * pass the result to IP.
-         */
-        if (vj_uncompress_tcp(&nb, &pppControl[pd].vjComp) >= 0) {
-            if (pppControl[pd].netif.input != NULL) {
-              pppControl[pd].netif.input(nb, &pppControl[pd].netif);
-            }
-			return;
-        }
-	/* Something's wrong so drop it. */
-	PPPDEBUG((LOG_WARNING, "pppInput[%d]: Dropping VJ compressed\n", pd));
-#else
-        /* No handler for this protocol so drop the packet. */
-        PPPDEBUG((LOG_INFO, "pppInput[%d]: drop VJ Comp in %d:%s\n", pd, nb->len, nb->payload));
-#endif /* VJ_SUPPORT > 0 */
-	break;
-    case PPP_VJC_UNCOMP:    /* VJ uncompressed TCP */
-#if VJ_SUPPORT > 0
-        PPPDEBUG((LOG_INFO, "pppInput[%d]: vj_un in pbuf len=%d\n", pd, nb->len));
-        /*
-         * Process the TCP/IP header for VJ header compression and then pass
-         * the packet to IP.
-         */
-        if (vj_uncompress_uncomp(nb, &pppControl[pd].vjComp) >= 0) {
-            if (pppControl[pd].netif.input != NULL) {
-              pppControl[pd].netif.input(nb, &pppControl[pd].netif);
-            }
-			return;
-        }
-	/* Something's wrong so drop it. */
-	PPPDEBUG((LOG_WARNING, "pppInput[%d]: Dropping VJ uncompressed\n", pd));
-#else
-        /* No handler for this protocol so drop the packet. */
-        PPPDEBUG((LOG_INFO,
-                    "pppInput[%d]: drop VJ UnComp in %d:.*H\n", 
-                    pd, nb->len, LWIP_MIN(nb->len * 2, 40), nb->payload));
-#endif /* VJ_SUPPORT > 0 */
-	break;
-    case PPP_IP:            /* Internet Protocol */
-        PPPDEBUG((LOG_INFO, "pppInput[%d]: ip in pbuf len=%d\n", pd, nb->len));
-        if (pppControl[pd].netif.input != NULL) {
-          pppControl[pd].netif.input(nb, &pppControl[pd].netif);
-        }
-		return;
-    default:
-	{
-		struct protent *protp;
-		int i;
-
-		/*
-		 * Upcall the proper protocol input routine.
-		 */
-		for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) {
-			if (protp->protocol == protocol && protp->enabled_flag) {
-				PPPDEBUG((LOG_INFO, "pppInput[%d]: %s len=%d\n", pd, protp->name, nb->len));
-				nb = pppSingleBuf(nb);
-				(*protp->input)(pd, nb->payload, nb->len);
-				goto out;
-			}
-		}
-
-		/* No handler for this protocol so reject the packet. */
-		PPPDEBUG((LOG_INFO, "pppInput[%d]: rejecting unsupported proto 0x%04X len=%d\n", pd, protocol, nb->len));
-		pbuf_header(nb, sizeof(protocol));
-#if BYTE_ORDER == LITTLE_ENDIAN
-		protocol = htons(protocol);
-		memcpy(nb->payload, &protocol, sizeof(protocol));
-#endif
-		lcp_sprotrej(pd, nb->payload, nb->len);
-	}
-	break;
-    }
-
-drop:
-#if LINK_STATS
-    lwip_stats.link.drop++;
-#endif
-
-out:
-    pbuf_free(nb);
-    return;
-}
-
-
-/*
- * Drop the input packet.
- */
-static void pppDrop(PPPControl *pc)
-{
-    if (pc->inHead != NULL) {
-#if 0	    
-        PPPDEBUG((LOG_INFO, "pppDrop: %d:%.*H\n", pc->inHead->len, min(60, pc->inHead->len * 2), pc->inHead->payload));
-#endif	
-        PPPDEBUG((LOG_INFO, "pppDrop: pbuf len=%d\n", pc->inHead->len));
-	if (pc->inTail && (pc->inTail != pc->inHead))
-	    pbuf_free(pc->inTail);
-        pbuf_free(pc->inHead);
-        pc->inHead = NULL;
-        pc->inTail = NULL;
-    }
-#if VJ_SUPPORT > 0
-    vj_uncompress_err(&pc->vjComp);
-#endif
-
-#if LINK_STATS
-    lwip_stats.link.drop++;
-#endif /* LINK_STATS */
-}
-
-
-/*
- * Process a received octet string.
- */
-static void pppInProc(int pd, u_char *s, int l)
-{
-    PPPControl *pc = &pppControl[pd];
-    struct pbuf *nextNBuf;
-    u_char curChar;
-
-    PPPDEBUG((LOG_DEBUG, "pppInProc[%d]: got %d bytes\n", pd, l));
-    while (l-- > 0) {
-        curChar = *s++;
-        
-        /* Handle special characters. */
-        if (ESCAPE_P(pc->inACCM, curChar)) {
-            /* Check for escape sequences. */
-            /* XXX Note that this does not handle an escaped 0x5d character which
-             * would appear as an escape character.  Since this is an ASCII ']'
-             * and there is no reason that I know of to escape it, I won't complicate
-             * the code to handle this case. GLL */
-            if (curChar == PPP_ESCAPE)
-                pc->inEscaped = 1;
-            /* Check for the flag character. */
-            else if (curChar == PPP_FLAG) {
-                /* If this is just an extra flag character, ignore it. */
-                if (pc->inState <= PDADDRESS)
-                    ;
-                /* If we haven't received the packet header, drop what has come in. */
-                else if (pc->inState < PDDATA) {
-                    PPPDEBUG((LOG_WARNING,
-                                "pppInProc[%d]: Dropping incomplete packet %d\n", 
-                                pd, pc->inState));
-#if LINK_STATS
-					lwip_stats.link.lenerr++;
-#endif
-                    pppDrop(pc);
-                }
-                /* If the fcs is invalid, drop the packet. */
-                else if (pc->inFCS != PPP_GOODFCS) {
-                    PPPDEBUG((LOG_INFO,
-                                "pppInProc[%d]: Dropping bad fcs 0x%04X proto=0x%04X\n", 
-                                pd, pc->inFCS, pc->inProtocol));
-#if LINK_STATS
-					lwip_stats.link.chkerr++;
-#endif
-                    pppDrop(pc);
-                }
-                /* Otherwise it's a good packet so pass it on. */
-                else {
-                    
-                    /* Trim off the checksum. */
-		    if(pc->inTail->len >= 2) {
-			pc->inTail->len -= 2;
-
-			pc->inTail->tot_len = pc->inTail->len;
-			if (pc->inTail != pc->inHead) {
-			    pbuf_cat(pc->inHead, pc->inTail);
-			}
-		    } else {
-			pc->inTail->tot_len = pc->inTail->len;
-			if (pc->inTail != pc->inHead) {
-			    pbuf_cat(pc->inHead, pc->inTail);
-			}
-
-			pbuf_realloc(pc->inHead, pc->inHead->tot_len - 2);
-		    }
-
-                    /* Dispatch the packet thereby consuming it. */
-		    if(tcpip_callback(pppInput, pc->inHead) != ERR_OK) {
-                    	PPPDEBUG((LOG_ERR,
-				    "pppInProc[%d]: tcpip_callback() failed, dropping packet\n", pd));
-			pbuf_free(pc->inHead);
-#if LINK_STATS
-			lwip_stats.link.drop++;
-#endif
-		    }
-                    pc->inHead = NULL;
-                    pc->inTail = NULL;
-                }
-                    
-                /* Prepare for a new packet. */
-                pc->inFCS = PPP_INITFCS;
-                pc->inState = PDADDRESS;
-                pc->inEscaped = 0;
-            }
-            /* Other characters are usually control characters that may have
-             * been inserted by the physical layer so here we just drop them. */
-            else {
-                PPPDEBUG((LOG_WARNING,
-                            "pppInProc[%d]: Dropping ACCM char <%d>\n", pd, curChar));
-            }
-        }
-        /* Process other characters. */
-        else {
-            /* Unencode escaped characters. */
-            if (pc->inEscaped) {
-                pc->inEscaped = 0;
-                curChar ^= PPP_TRANS;
-            }
-            
-            /* Process character relative to current state. */
-            switch(pc->inState) {
-            case PDIDLE:                    /* Idle state - waiting. */
-                /* Drop the character if it's not 0xff
-                 * we would have processed a flag character above. */
-                if (curChar != PPP_ALLSTATIONS) {
-                	break;
-				}
-
-				/* Fall through */
-            case PDSTART:                   /* Process start flag. */
-                /* Prepare for a new packet. */
-                pc->inFCS = PPP_INITFCS;
-
-				/* Fall through */
-            case PDADDRESS:                 /* Process address field. */
-                if (curChar == PPP_ALLSTATIONS) {
-                    pc->inState = PDCONTROL;
-                    break;
-                }
-                /* Else assume compressed address and control fields so
-                 * fall through to get the protocol... */
-            case PDCONTROL:                 /* Process control field. */
-                /* If we don't get a valid control code, restart. */
-                if (curChar == PPP_UI) {
-                    pc->inState = PDPROTOCOL1;
-                	break;
-                }
-#if 0
-                else {
-                    PPPDEBUG((LOG_WARNING,
-                                "pppInProc[%d]: Invalid control <%d>\n", pd, curChar));
-                    pc->inState = PDSTART;
-                }
-#endif
-            case PDPROTOCOL1:               /* Process protocol field 1. */
-                /* If the lower bit is set, this is the end of the protocol
-                 * field. */
-                if (curChar & 1) {
-                    pc->inProtocol = curChar;
-                    pc->inState = PDDATA;
-                }
-                else {
-                    pc->inProtocol = (u_int)curChar << 8;
-                    pc->inState = PDPROTOCOL2;
-                }
-                break;
-            case PDPROTOCOL2:               /* Process protocol field 2. */
-                pc->inProtocol |= curChar;
-                pc->inState = PDDATA;
-                break;
-            case PDDATA:                    /* Process data byte. */
-                /* Make space to receive processed data. */
-                if (pc->inTail == NULL || pc->inTail->len == PBUF_POOL_BUFSIZE) {
-		    if(pc->inTail) {
-			pc->inTail->tot_len = pc->inTail->len;
-			if (pc->inTail != pc->inHead) {
-			    pbuf_cat(pc->inHead, pc->inTail);
-			}
-		    }
-                    /* If we haven't started a packet, we need a packet header. */
-                    nextNBuf = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
-                    if (nextNBuf == NULL) {
-                        /* No free buffers.  Drop the input packet and let the
-                         * higher layers deal with it.  Continue processing
-                         * the received pbuf chain in case a new packet starts. */
-                        PPPDEBUG((LOG_ERR, "pppInProc[%d]: NO FREE MBUFS!\n", pd));
-#if LINK_STATS
-						lwip_stats.link.memerr++;
-#endif /* LINK_STATS */
-                        pppDrop(pc);
-                        pc->inState = PDSTART;  /* Wait for flag sequence. */
-			break;
-                    }
-		    if (pc->inHead == NULL) {
-			struct pppInputHeader *pih = nextNBuf->payload;
-
-			pih->unit = pd;
-			pih->proto = pc->inProtocol;
-
-			nextNBuf->len += sizeof(*pih);
-
-			pc->inHead = nextNBuf;
-		    }
-		    pc->inTail = nextNBuf;
-                }
-                /* Load character into buffer. */
-                ((u_char*)pc->inTail->payload)[pc->inTail->len++] = curChar;
-                break;
-            }
-
-            /* update the frame check sequence number. */
-            pc->inFCS = PPP_FCS(pc->inFCS, curChar);
-        }
-    }
-	avRandomize();
-}
-
-#endif /* PPP_SUPPORT */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/ppp.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/ppp.h
deleted file mode 100644
index 25cea83..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/ppp.h
+++ /dev/null
@@ -1,446 +0,0 @@
-/*****************************************************************************
-* ppp.h - Network Point to Point Protocol header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 97-11-05 Guy Lancaster <glanca at gesn.com>, Global Election Systems Inc.
-*	Original derived from BSD codes.
-*****************************************************************************/
-
-#ifndef PPP_H
-#define PPP_H
-
-#include "lwip/opt.h"
-
-#if PPP_SUPPORT > 0
-#include "lwip/sio.h"
-#include "lwip/api.h"
-#include "lwip/sockets.h"
-#include "lwip/stats.h"
-#include "lwip/mem.h"
-#include "lwip/tcpip.h"
-#include "lwip/netif.h"
-
-/*
- * pppd.h - PPP daemon global declarations.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-/*
- * ppp_defs.h - PPP definitions.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies.  This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- */
-
-#define TIMEOUT(f, a, t)    sys_untimeout((f), (a)), sys_timeout((t)*1000, (f), (a))
-#define UNTIMEOUT(f, a)     sys_untimeout((f), (a))
-
-
-# ifndef __u_char_defined
-
-/* Type definitions for BSD code. */
-typedef unsigned long u_long;
-typedef unsigned int u_int;
-typedef unsigned short u_short;
-typedef unsigned char u_char;
-
-#endif
-
-/*
- * Constants and structures defined by the internet system,
- * Per RFC 790, September 1981, and numerous additions.
- */
-
-/*
- * The basic PPP frame.
- */
-#define PPP_HDRLEN  4       /* octets for standard ppp header */
-#define PPP_FCSLEN  2       /* octets for FCS */
-
-
-/*
- * Significant octet values.
- */
-#define PPP_ALLSTATIONS 0xff    /* All-Stations broadcast address */
-#define PPP_UI          0x03    /* Unnumbered Information */
-#define PPP_FLAG        0x7e    /* Flag Sequence */
-#define PPP_ESCAPE      0x7d    /* Asynchronous Control Escape */
-#define PPP_TRANS       0x20    /* Asynchronous transparency modifier */
-
-/*
- * Protocol field values.
- */
-#define PPP_IP          0x21    /* Internet Protocol */
-#define PPP_AT          0x29    /* AppleTalk Protocol */
-#define PPP_VJC_COMP    0x2d    /* VJ compressed TCP */
-#define PPP_VJC_UNCOMP  0x2f    /* VJ uncompressed TCP */
-#define PPP_COMP        0xfd    /* compressed packet */
-#define PPP_IPCP        0x8021  /* IP Control Protocol */
-#define PPP_ATCP        0x8029  /* AppleTalk Control Protocol */
-#define PPP_CCP         0x80fd  /* Compression Control Protocol */
-#define PPP_LCP         0xc021  /* Link Control Protocol */
-#define PPP_PAP         0xc023  /* Password Authentication Protocol */
-#define PPP_LQR         0xc025  /* Link Quality Report protocol */
-#define PPP_CHAP        0xc223  /* Cryptographic Handshake Auth. Protocol */
-#define PPP_CBCP        0xc029  /* Callback Control Protocol */
-
-/*
- * Values for FCS calculations.
- */
-#define PPP_INITFCS 0xffff  /* Initial FCS value */
-#define PPP_GOODFCS 0xf0b8  /* Good final FCS value */
-#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
-
-/*
- * Extended asyncmap - allows any character to be escaped.
- */
-typedef u_char  ext_accm[32];
-
-/*
- * What to do with network protocol (NP) packets.
- */
-enum NPmode {
-    NPMODE_PASS,        /* pass the packet through */
-    NPMODE_DROP,        /* silently drop the packet */
-    NPMODE_ERROR,       /* return an error */
-    NPMODE_QUEUE        /* save it up for later. */
-};
-
-/*
- * Inline versions of get/put char/short/long.
- * Pointer is advanced; we assume that both arguments
- * are lvalues and will already be in registers.
- * cp MUST be u_char *.
- */
-#define GETCHAR(c, cp) { \
-    (c) = *(cp)++; \
-}
-#define PUTCHAR(c, cp) { \
-    *(cp)++ = (u_char) (c); \
-}
-
-
-#define GETSHORT(s, cp) { \
-    (s) = *(cp); (cp)++; (s) << 8; \
-    (s) |= *(cp); (cp)++; \
-}
-#define PUTSHORT(s, cp) { \
-    *(cp)++ = (u_char) ((s) >> 8); \
-    *(cp)++ = (u_char) (s); \
-}
-
-#define GETLONG(l, cp) { \
-    (l) = *(cp); (cp)++; (l) << 8; \
-    (l) |= *(cp); (cp)++; (l) <<= 8; \
-    (l) |= *(cp); (cp)++; (l) <<= 8; \
-    (l) |= *(cp); (cp)++; \
-}
-#define PUTLONG(l, cp) { \
-    *(cp)++ = (u_char) ((l) >> 24); \
-    *(cp)++ = (u_char) ((l) >> 16); \
-    *(cp)++ = (u_char) ((l) >> 8); \
-    *(cp)++ = (u_char) (l); \
-}
-
-
-#define INCPTR(n, cp)   ((cp) += (n))
-#define DECPTR(n, cp)   ((cp) -= (n))
-
-#define BCMP(s0, s1, l)     memcmp((u_char *)(s0), (u_char *)(s1), (l))
-#define BCOPY(s, d, l)      memcpy((d), (s), (l))
-#define BZERO(s, n)         memset(s, 0, n)
-#if PPP_DEBUG
-#define PRINTMSG(m, l)  { m[l] = '\0'; ppp_trace(LOG_INFO, "Remote message: %s\n", m); }
-#else
-#define PRINTMSG(m, l)
-#endif
-
-/*
- * MAKEHEADER - Add PPP Header fields to a packet.
- */
-#define MAKEHEADER(p, t) { \
-    PUTCHAR(PPP_ALLSTATIONS, p); \
-    PUTCHAR(PPP_UI, p); \
-    PUTSHORT(t, p); }
-
-/*************************
-*** PUBLIC DEFINITIONS ***
-*************************/
-
-/* Error codes. */
-#define PPPERR_NONE 0				/* No error. */
-#define PPPERR_PARAM -1				/* Invalid parameter. */
-#define PPPERR_OPEN -2				/* Unable to open PPP session. */
-#define PPPERR_DEVICE -3			/* Invalid I/O device for PPP. */
-#define PPPERR_ALLOC -4				/* Unable to allocate resources. */
-#define PPPERR_USER -5				/* User interrupt. */
-#define PPPERR_CONNECT -6			/* Connection lost. */
-#define PPPERR_AUTHFAIL -7			/* Failed authentication challenge. */
-#define PPPERR_PROTOCOL -8			/* Failed to meet protocol. */
-
-/*
- * PPP IOCTL commands.
- */
-/*
- * Get the up status - 0 for down, non-zero for up.  The argument must
- * point to an int.
- */
-#define PPPCTLG_UPSTATUS 100	/* Get the up status - 0 down else up */
-#define PPPCTLS_ERRCODE 101		/* Set the error code */
-#define PPPCTLG_ERRCODE 102		/* Get the error code */
-#define	PPPCTLG_FD		103		/* Get the fd associated with the ppp */
-
-/************************
-*** PUBLIC DATA TYPES ***
-************************/
-
-/*
- * The following struct gives the addresses of procedures to call
- * for a particular protocol.
- */
-struct protent {
-    u_short protocol;       /* PPP protocol number */
-    /* Initialization procedure */
-    void (*init) (int unit);
-    /* Process a received packet */
-    void (*input) (int unit, u_char *pkt, int len);
-    /* Process a received protocol-reject */
-    void (*protrej) (int unit);
-    /* Lower layer has come up */
-    void (*lowerup) (int unit);
-    /* Lower layer has gone down */
-    void (*lowerdown) (int unit);
-    /* Open the protocol */
-    void (*open) (int unit);
-    /* Close the protocol */
-    void (*close) (int unit, char *reason);
-#if 0
-    /* Print a packet in readable form */
-    int  (*printpkt) (u_char *pkt, int len,
-              void (*printer) (void *, char *, ...),
-              void *arg);
-    /* Process a received data packet */
-    void (*datainput) (int unit, u_char *pkt, int len);
-#endif
-    int  enabled_flag;      /* 0 iff protocol is disabled */
-    char *name;         /* Text name of protocol */
-#if 0
-    /* Check requested options, assign defaults */
-    void (*check_options) (u_long);
-    /* Configure interface for demand-dial */
-    int  (*demand_conf) (int unit);
-    /* Say whether to bring up link for this pkt */
-    int  (*active_pkt) (u_char *pkt, int len);
-#endif
-};
-
-/*
- * The following structure records the time in seconds since
- * the last NP packet was sent or received.
- */
-struct ppp_idle {
-    u_short xmit_idle;      /* seconds since last NP packet sent */
-    u_short recv_idle;      /* seconds since last NP packet received */
-};
-
-struct ppp_settings {
-
-	u_int  disable_defaultip : 1;   /* Don't use hostname for default IP addrs */
-	u_int  auth_required : 1;      /* Peer is required to authenticate */
-	u_int  explicit_remote : 1;    /* remote_name specified with remotename opt */
-	u_int  refuse_pap : 1;         /* Don't wanna auth. ourselves with PAP */
-	u_int  refuse_chap : 1;        /* Don't wanna auth. ourselves with CHAP */
-	u_int  usehostname : 1;        /* Use hostname for our_name */
-	u_int  usepeerdns : 1;         /* Ask peer for DNS adds */
-
-	u_short idle_time_limit; /* Shut down link if idle for this long */
-	int  maxconnect;         /* Maximum connect time (seconds) */
-
-	char user[MAXNAMELEN + 1];/* Username for PAP */
-	char passwd[MAXSECRETLEN + 1];           /* Password for PAP, secret for CHAP */
-	char our_name[MAXNAMELEN + 1];         /* Our name for authentication purposes */
-	char remote_name[MAXNAMELEN + 1];      /* Peer's name for authentication */
-};
-
-struct ppp_addrs {
-    struct ip_addr our_ipaddr, his_ipaddr, netmask, dns1, dns2;
-};
-
-/*****************************
-*** PUBLIC DATA STRUCTURES ***
-*****************************/
-/* Buffers for outgoing packets. */
-extern u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN];
-
-extern struct ppp_settings ppp_settings;
-
-extern struct protent *ppp_protocols[];/* Table of pointers to supported protocols */
-
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-
-/* Initialize the PPP subsystem. */
-void pppInit(void);
-
-/* Warning: Using PPPAUTHTYPE_ANY might have security consequences.
- * RFC 1994 says:
- *
- * In practice, within or associated with each PPP server, there is a
- * database which associates "user" names with authentication
- * information ("secrets").  It is not anticipated that a particular
- * named user would be authenticated by multiple methods.  This would
- * make the user vulnerable to attacks which negotiate the least secure
- * method from among a set (such as PAP rather than CHAP).  If the same
- * secret was used, PAP would reveal the secret to be used later with
- * CHAP.
- *
- * Instead, for each user name there should be an indication of exactly
- * one method used to authenticate that user name.  If a user needs to
- * make use of different authentication methods under different
- * circumstances, then distinct user names SHOULD be employed, each of
- * which identifies exactly one authentication method.
- *
- */
-enum pppAuthType {
-    PPPAUTHTYPE_NONE,
-    PPPAUTHTYPE_ANY,
-    PPPAUTHTYPE_PAP,
-    PPPAUTHTYPE_CHAP
-};
-
-void pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd);
-
-/*
- * Open a new PPP connection using the given I/O device.
- * This initializes the PPP control block but does not
- * attempt to negotiate the LCP session.
- * Return a new PPP connection descriptor on success or
- * an error code (negative) on failure. 
- */
-int pppOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx);
-
-/*
- * Close a PPP connection and release the descriptor. 
- * Any outstanding packets in the queues are dropped.
- * Return 0 on success, an error code on failure. 
- */
-int pppClose(int pd);
-
-/*
- * Indicate to the PPP process that the line has disconnected.
- */
-void pppSigHUP(int pd);
-
-/*
- * Get and set parameters for the given connection.
- * Return 0 on success, an error code on failure. 
- */
-int  pppIOCtl(int pd, int cmd, void *arg);
-
-/*
- * Return the Maximum Transmission Unit for the given PPP connection.
- */
-u_int pppMTU(int pd);
-
-/*
- * Write n characters to a ppp link.
- *	RETURN: >= 0 Number of characters written
- *		 	 -1 Failed to write to device
- */
-int pppWrite(int pd, const u_char *s, int n);
-
-void pppMainWakeup(int pd);
-
-/* Configure i/f transmit parameters */
-void ppp_send_config (int, int, u32_t, int, int);
-/* Set extended transmit ACCM */
-void ppp_set_xaccm (int, ext_accm *);
-/* Configure i/f receive parameters */
-void ppp_recv_config (int, int, u32_t, int, int);
-/* Find out how long link has been idle */
-int  get_idle_time (int, struct ppp_idle *);
-
-/* Configure VJ TCP header compression */
-int  sifvjcomp (int, int, int, int);
-/* Configure i/f down (for IP) */
-int  sifup (int);		
-/* Set mode for handling packets for proto */
-int  sifnpmode (int u, int proto, enum NPmode mode);
-/* Configure i/f down (for IP) */
-int  sifdown (int);	
-/* Configure IP addresses for i/f */
-int  sifaddr (int, u32_t, u32_t, u32_t, u32_t, u32_t);
-/* Reset i/f IP addresses */
-int  cifaddr (int, u32_t, u32_t);
-/* Create default route through i/f */
-int  sifdefaultroute (int, u32_t, u32_t);
-/* Delete default route through i/f */
-int  cifdefaultroute (int, u32_t, u32_t);
-
-/* Get appropriate netmask for address */
-u32_t GetMask (u32_t); 
-
-#endif /* PPP_SUPPORT */
-
-#endif /* PPP_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/pppdebug.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/pppdebug.h
deleted file mode 100644
index de1478c..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/pppdebug.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*****************************************************************************
-* pppdebug.h - System debugging utilities.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1998 Global Election Systems Inc.
-* portions Copyright (c) 2001 by Cognizant Pty Ltd.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY (please don't use tabs!)
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 98-07-29 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*	Original.
-*
-*****************************************************************************
-*/
-#ifndef PPPDEBUG_H
-#define PPPDEBUG_H
-
-/************************
-*** PUBLIC DATA TYPES ***
-************************/
-/* Trace levels. */
-typedef enum {
-	LOG_CRITICAL = 0,
-	LOG_ERR = 1,
-	LOG_NOTICE = 2,
-	LOG_WARNING = 3,
-	LOG_INFO = 5,
-	LOG_DETAIL = 6,
-	LOG_DEBUG = 7
-} LogCodes;
-
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-/*
- *	ppp_trace - a form of printf to send tracing information to stderr
- */
-void ppp_trace(int level, const char *format,...);
-
-#if PPP_DEBUG > 0
-
-#define AUTHDEBUG(a) ppp_trace a
-#define IPCPDEBUG(a) ppp_trace a
-#define UPAPDEBUG(a) ppp_trace a
-#define LCPDEBUG(a) ppp_trace a
-#define FSMDEBUG(a) ppp_trace a
-#define CHAPDEBUG(a) ppp_trace a
-#define PPPDEBUG(a) ppp_trace a
-
-#define TRACELCP 1
-
-#else
-
-#define AUTHDEBUG(a)
-#define IPCPDEBUG(a)
-#define UPAPDEBUG(a)
-#define LCPDEBUG(a)
-#define FSMDEBUG(a)
-#define CHAPDEBUG(a)
-
-#define PPPDEBUG(a)
-
-#define TRACELCP 0
-
-#endif
-
-#endif /* PPPDEBUG_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/randm.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/randm.c
deleted file mode 100644
index 05eeb44..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/randm.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*****************************************************************************
-* randm.c - Random number generator program file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* Copyright (c) 1998 by Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 98-06-03 Guy Lancaster <lancasterg at acm.org>, Global Election Systems Inc.
-*   Extracted from avos.
-*****************************************************************************/
-
-#include "ppp.h"
-#if PPP_SUPPORT > 0
-#include "md5.h"
-#include "randm.h"
-
-#include "pppdebug.h"
-
-
-#if MD5_SUPPORT>0   /* this module depends on MD5 */
-#define RANDPOOLSZ 16   /* Bytes stored in the pool of randomness. */
-
-/*****************************/
-/*** LOCAL DATA STRUCTURES ***/
-/*****************************/
-static char randPool[RANDPOOLSZ];   /* Pool of randomness. */
-static long randCount = 0;      /* Pseudo-random incrementer */
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-/*
- * Initialize the random number generator.
- *
- * Since this is to be called on power up, we don't have much
- *  system randomess to work with.  Here all we use is the
- *  real-time clock.  We'll accumulate more randomness as soon
- *  as things start happening.
- */
-void avRandomInit()
-{
-    avChurnRand(NULL, 0);
-}
-
-/*
- * Churn the randomness pool on a random event.  Call this early and often
- *  on random and semi-random system events to build randomness in time for
- *  usage.  For randomly timed events, pass a null pointer and a zero length
- *  and this will use the system timer and other sources to add randomness.
- *  If new random data is available, pass a pointer to that and it will be
- *  included.
- *
- * Ref: Applied Cryptography 2nd Ed. by Bruce Schneier p. 427
- */
-void avChurnRand(char *randData, u32_t randLen)
-{
-    MD5_CTX md5;
-
-/*  ppp_trace(LOG_INFO, "churnRand: %u@%P\n", randLen, randData); */
-    MD5Init(&md5);
-    MD5Update(&md5, (u_char *)randPool, sizeof(randPool));
-    if (randData)
-        MD5Update(&md5, (u_char *)randData, randLen);
-    else {
-        struct {
-            /* INCLUDE fields for any system sources of randomness */
-            char foobar;
-        } sysData;
-
-        /* Load sysData fields here. */
-        ;
-        MD5Update(&md5, (u_char *)&sysData, sizeof(sysData));
-    }
-    MD5Final((u_char *)randPool, &md5);
-/*  ppp_trace(LOG_INFO, "churnRand: -> 0\n"); */
-}
-
-/*
- * Use the random pool to generate random data.  This degrades to pseudo
- *  random when used faster than randomness is supplied using churnRand().
- * Note: It's important that there be sufficient randomness in randPool
- *  before this is called for otherwise the range of the result may be
- *  narrow enough to make a search feasible.
- *
- * Ref: Applied Cryptography 2nd Ed. by Bruce Schneier p. 427
- *
- * XXX Why does he not just call churnRand() for each block?  Probably
- *  so that you don't ever publish the seed which could possibly help
- *  predict future values.
- * XXX Why don't we preserve md5 between blocks and just update it with
- *  randCount each time?  Probably there is a weakness but I wish that
- *  it was documented.
- */
-void avGenRand(char *buf, u32_t bufLen)
-{
-    MD5_CTX md5;
-    u_char tmp[16];
-    u32_t n;
-
-    while (bufLen > 0) {
-        n = LWIP_MIN(bufLen, RANDPOOLSZ);
-        MD5Init(&md5);
-        MD5Update(&md5, (u_char *)randPool, sizeof(randPool));
-        MD5Update(&md5, (u_char *)&randCount, sizeof(randCount));
-        MD5Final(tmp, &md5);
-        randCount++;
-        memcpy(buf, tmp, n);
-        buf += n;
-        bufLen -= n;
-    }
-}
-
-/*
- * Return a new random number.
- */
-u32_t avRandom()
-{
-    u32_t newRand;
-
-    avGenRand((char *)&newRand, sizeof(newRand));
-
-    return newRand;
-}
-
-#else /* MD5_SUPPORT */
-
-
-/*****************************/
-/*** LOCAL DATA STRUCTURES ***/
-/*****************************/
-static int  avRandomized = 0;       /* Set when truely randomized. */
-static u32_t avRandomSeed = 0;      /* Seed used for random number generation. */
-
-
-/***********************************/
-/*** PUBLIC FUNCTION DEFINITIONS ***/
-/***********************************/
-/*
- * Initialize the random number generator.
- *
- * Here we attempt to compute a random number seed but even if
- * it isn't random, we'll randomize it later.
- *
- * The current method uses the fields from the real time clock,
- * the idle process counter, the millisecond counter, and the
- * hardware timer tick counter.  When this is invoked
- * in startup(), then the idle counter and timer values may
- * repeat after each boot and the real time clock may not be
- * operational.  Thus we call it again on the first random
- * event.
- */
-void avRandomInit()
-{
-#if 0
-    /* Get a pointer into the last 4 bytes of clockBuf. */
-    u32_t *lptr1 = (u32_t *)((char *)&clockBuf[3]);
-
-    /*
-     * Initialize our seed using the real-time clock, the idle
-     * counter, the millisecond timer, and the hardware timer
-     * tick counter.  The real-time clock and the hardware
-     * tick counter are the best sources of randomness but
-     * since the tick counter is only 16 bit (and truncated
-     * at that), the idle counter and millisecond timer
-     * (which may be small values) are added to help
-     * randomize the lower 16 bits of the seed.
-     */
-    readClk();
-    avRandomSeed += *(u32_t *)clockBuf + *lptr1 + OSIdleCtr
-             + ppp_mtime() + ((u32_t)TM1 << 16) + TM1;
-#else
-    avRandomSeed += sys_jiffies(); /* XXX */
-#endif
-        
-    /* Initialize the Borland random number generator. */
-    srand((unsigned)avRandomSeed);
-}
-
-/*
- * Randomize our random seed value.  Here we use the fact that
- * this function is called at *truely random* times by the polling
- * and network functions.  Here we only get 16 bits of new random
- * value but we use the previous value to randomize the other 16
- * bits.
- */
-void avRandomize(void)
-{
-    static u32_t last_jiffies;
-
-    if (!avRandomized) {
-        avRandomized = !0;
-        avRandomInit();
-        /* The initialization function also updates the seed. */
-    } else {
-/*        avRandomSeed += (avRandomSeed << 16) + TM1; */
-    	avRandomSeed += (sys_jiffies() - last_jiffies); /* XXX */
-    }
-    last_jiffies = sys_jiffies();
-}
-
-/*
- * Return a new random number.
- * Here we use the Borland rand() function to supply a pseudo random
- * number which we make truely random by combining it with our own
- * seed which is randomized by truely random events. 
- * Thus the numbers will be truely random unless there have been no
- * operator or network events in which case it will be pseudo random
- * seeded by the real time clock.
- */
-u32_t avRandom()
-{
-    return ((((u32_t)rand() << 16) + rand()) + avRandomSeed);
-}
-
-
-
-#endif /* MD5_SUPPORT */
-#endif /* PPP_SUPPORT */
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/randm.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/randm.h
deleted file mode 100644
index baa42f0..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/randm.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*****************************************************************************
-* randm.h - Random number generator header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* Copyright (c) 1998 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
-* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
-* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc at mbsi.ca>
-*   Ported to lwIP.
-* 98-05-29 Guy Lancaster <glanca at gesn.com>, Global Election Systems Inc.
-*	Extracted from avos.
-*****************************************************************************/
-
-#ifndef RANDM_H
-#define RANDM_H
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-/*
- * Initialize the random number generator.
- */
-void avRandomInit(void);
-
-/*
- * Churn the randomness pool on a random event.  Call this early and often
- *	on random and semi-random system events to build randomness in time for
- *	usage.  For randomly timed events, pass a null pointer and a zero length
- *	and this will use the system timer and other sources to add randomness.
- *	If new random data is available, pass a pointer to that and it will be
- *	included.
- */
-void avChurnRand(char *randData, u32_t randLen);
-
-/*
- * Randomize our random seed value.  To be called for truely random events
- * such as user operations and network traffic.
- */
-#if MD5_SUPPORT
-#define avRandomize()	avChurnRand(NULL, 0)
-#else
-void avRandomize(void);
-#endif
-
-/*
- * Use the random pool to generate random data.  This degrades to pseudo
- *	random when used faster than randomness is supplied using churnRand().
- *	Thus it's important to make sure that the results of this are not
- *	published directly because one could predict the next result to at
- *	least some degree.  Also, it's important to get a good seed before
- *	the first use.
- */
-void avGenRand(char *buf, u32_t bufLen);
-
-/*
- * Return a new random number.
- */
-u32_t avRandom(void);
-
-
-#endif /* RANDM_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.c b/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.c
deleted file mode 100644
index 0636ee1..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.c
+++ /dev/null
@@ -1,633 +0,0 @@
-/*
- * Routines to compress and uncompess tcp packets (for transmission
- * over low speed serial lines.
- *
- * Copyright (c) 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- *	Van Jacobson (van at helios.ee.lbl.gov), Dec 31, 1989:
- *	- Initial distribution.
- *
- * Modified June 1993 by Paul Mackerras, paulus at cs.anu.edu.au,
- * so that the entire packet being decompressed doesn't have
- * to be in contiguous memory (just the compressed header).
- *
- * Modified March 1998 by Guy Lancaster, glanca at gesn.com,
- * for a 16 bit processor.
- */
-
-#include <string.h>
-
-#include "ppp.h"
-#include "vj.h"
-#include "pppdebug.h"
-
-#if VJ_SUPPORT > 0
-
-#if LINK_STATS
-#define INCR(counter) ++comp->stats.counter
-#else
-#define INCR(counter)
-#endif
-
-#if defined(NO_CHAR_BITFIELDS)
-#define getip_hl(base)	((base).ip_hl_v&0xf)
-#define getth_off(base)	(((base).th_x2_off&0xf0)>>4)
-#else
-#define getip_hl(base)	((base).ip_hl)
-#define getth_off(base)	((base).th_off)
-#endif
-
-void vj_compress_init(struct vjcompress *comp)
-{
-	register u_int i;
-	register struct cstate *tstate = comp->tstate;
-	
-#if MAX_SLOTS == 0
-	memset((char *)comp, 0, sizeof(*comp));
-#endif
-	comp->maxSlotIndex = MAX_SLOTS - 1;
-	comp->compressSlot = 0;		/* Disable slot ID compression by default. */
-	for (i = MAX_SLOTS - 1; i > 0; --i) {
-		tstate[i].cs_id = i;
-		tstate[i].cs_next = &tstate[i - 1];
-	}
-	tstate[0].cs_next = &tstate[MAX_SLOTS - 1];
-	tstate[0].cs_id = 0;
-	comp->last_cs = &tstate[0];
-	comp->last_recv = 255;
-	comp->last_xmit = 255;
-	comp->flags = VJF_TOSS;
-}
-
-
-/* ENCODE encodes a number that is known to be non-zero.  ENCODEZ
- * checks for zero (since zero has to be encoded in the long, 3 byte
- * form).
- */
-#define ENCODE(n) { \
-	if ((u_short)(n) >= 256) { \
-		*cp++ = 0; \
-		cp[1] = (n); \
-		cp[0] = (n) >> 8; \
-		cp += 2; \
-	} else { \
-		*cp++ = (n); \
-	} \
-}
-#define ENCODEZ(n) { \
-	if ((u_short)(n) >= 256 || (u_short)(n) == 0) { \
-		*cp++ = 0; \
-		cp[1] = (n); \
-		cp[0] = (n) >> 8; \
-		cp += 2; \
-	} else { \
-		*cp++ = (n); \
-	} \
-}
-
-#define DECODEL(f) { \
-	if (*cp == 0) {\
-		u32_t tmp = ntohl(f) + ((cp[1] << 8) | cp[2]); \
-		(f) = htonl(tmp); \
-		cp += 3; \
-	} else { \
-		u32_t tmp = ntohl(f) + (u32_t)*cp++; \
-		(f) = htonl(tmp); \
-	} \
-}
-
-#define DECODES(f) { \
-	if (*cp == 0) {\
-		u_short tmp = ntohs(f) + (((u_short)cp[1] << 8) | cp[2]); \
-		(f) = htons(tmp); \
-		cp += 3; \
-	} else { \
-		u_short tmp = ntohs(f) + (u_short)*cp++; \
-		(f) = htons(tmp); \
-	} \
-}
-
-#define DECODEU(f) { \
-	if (*cp == 0) {\
-		(f) = htons(((u_short)cp[1] << 8) | cp[2]); \
-		cp += 3; \
-	} else { \
-		(f) = htons((u_short)*cp++); \
-	} \
-}
-
-/*
- * vj_compress_tcp - Attempt to do Van Jacobsen header compression on a
- * packet.  This assumes that nb and comp are not null and that the first
- * buffer of the chain contains a valid IP header.
- * Return the VJ type code indicating whether or not the packet was
- * compressed.
- */
-u_int vj_compress_tcp(
-	struct vjcompress *comp,
-	struct pbuf *pb
-)
-{
-	register struct ip *ip = (struct ip *)pb->payload;
-	register struct cstate *cs = comp->last_cs->cs_next;
-	register u_short hlen = getip_hl(*ip);
-	register struct tcphdr *oth;
-	register struct tcphdr *th;
-	register u_short deltaS, deltaA;
-	register u_long deltaL;
-	register u_int changes = 0;
-	u_char new_seq[16];
-	register u_char *cp = new_seq;
-
-	/*	
-	 * Check that the packet is IP proto TCP.
-	 */
-	if (ip->ip_p != IPPROTO_TCP)
-		return (TYPE_IP);
-		
-	/*
-	 * Bail if this is an IP fragment or if the TCP packet isn't
-	 * `compressible' (i.e., ACK isn't set or some other control bit is
-	 * set).  
-	 */
-	if ((ip->ip_off & htons(0x3fff)) || pb->tot_len < 40)
-		return (TYPE_IP);
-	th = (struct tcphdr *)&((long *)ip)[hlen];
-	if ((th->th_flags & (TCP_SYN|TCP_FIN|TCP_RST|TCP_ACK)) != TCP_ACK)
-		return (TYPE_IP);
-		
-	/*
-	 * Packet is compressible -- we're going to send either a
-	 * COMPRESSED_TCP or UNCOMPRESSED_TCP packet.  Either way we need
-	 * to locate (or create) the connection state.  Special case the
-	 * most recently used connection since it's most likely to be used
-	 * again & we don't have to do any reordering if it's used.
-	 */
-	INCR(vjs_packets);
-	if (ip->ip_src.s_addr != cs->cs_ip.ip_src.s_addr 
-			|| ip->ip_dst.s_addr != cs->cs_ip.ip_dst.s_addr 
-			|| *(long *)th != ((long *)&cs->cs_ip)[getip_hl(cs->cs_ip)]) {
-		/*
-		 * Wasn't the first -- search for it.
-		 *
-		 * States are kept in a circularly linked list with
-		 * last_cs pointing to the end of the list.  The
-		 * list is kept in lru order by moving a state to the
-		 * head of the list whenever it is referenced.  Since
-		 * the list is short and, empirically, the connection
-		 * we want is almost always near the front, we locate
-		 * states via linear search.  If we don't find a state
-		 * for the datagram, the oldest state is (re-)used.
-		 */
-		register struct cstate *lcs;
-		register struct cstate *lastcs = comp->last_cs;
-		
-		do {
-			lcs = cs; cs = cs->cs_next;
-			INCR(vjs_searches);
-			if (ip->ip_src.s_addr == cs->cs_ip.ip_src.s_addr
-					&& ip->ip_dst.s_addr == cs->cs_ip.ip_dst.s_addr
-					&& *(long *)th == ((long *)&cs->cs_ip)[getip_hl(cs->cs_ip)])
-				goto found;
-		} while (cs != lastcs);
-		
-		/*
-		 * Didn't find it -- re-use oldest cstate.  Send an
-		 * uncompressed packet that tells the other side what
-		 * connection number we're using for this conversation.
-		 * Note that since the state list is circular, the oldest
-		 * state points to the newest and we only need to set
-		 * last_cs to update the lru linkage.
-		 */
-		INCR(vjs_misses);
-		comp->last_cs = lcs;
-		hlen += getth_off(*th);
-		hlen <<= 2;
-		/* Check that the IP/TCP headers are contained in the first buffer. */
-		if (hlen > pb->len)
-			return (TYPE_IP);
-		goto uncompressed;
-		
-		found:
-		/*
-		 * Found it -- move to the front on the connection list.
-		 */
-		if (cs == lastcs)
-			comp->last_cs = lcs;
-		else {
-			lcs->cs_next = cs->cs_next;
-			cs->cs_next = lastcs->cs_next;
-			lastcs->cs_next = cs;
-		}
-	}
-	
-	oth = (struct tcphdr *)&((long *)&cs->cs_ip)[hlen];
-	deltaS = hlen;
-	hlen += getth_off(*th);
-	hlen <<= 2;
-	/* Check that the IP/TCP headers are contained in the first buffer. */
-	if (hlen > pb->len) {
-		PPPDEBUG((LOG_INFO, "vj_compress_tcp: header len %d spans buffers\n", 
-					hlen));
-		return (TYPE_IP);
-	}
-	
-	/*
-	 * Make sure that only what we expect to change changed. The first
-	 * line of the `if' checks the IP protocol version, header length &
-	 * type of service.  The 2nd line checks the "Don't fragment" bit.
-	 * The 3rd line checks the time-to-live and protocol (the protocol
-	 * check is unnecessary but costless).  The 4th line checks the TCP
-	 * header length.  The 5th line checks IP options, if any.  The 6th
-	 * line checks TCP options, if any.  If any of these things are
-	 * different between the previous & current datagram, we send the
-	 * current datagram `uncompressed'.
-	 */
-	if (((u_short *)ip)[0] != ((u_short *)&cs->cs_ip)[0] 
-			|| ((u_short *)ip)[3] != ((u_short *)&cs->cs_ip)[3] 
-			|| ((u_short *)ip)[4] != ((u_short *)&cs->cs_ip)[4] 
-			|| getth_off(*th) != getth_off(*oth) 
-			|| (deltaS > 5 && BCMP(ip + 1, &cs->cs_ip + 1, (deltaS - 5) << 2)) 
-			|| (getth_off(*th) > 5 && BCMP(th + 1, oth + 1, (getth_off(*th) - 5) << 2)))
-		goto uncompressed;
-	
-	/*
-	 * Figure out which of the changing fields changed.  The
-	 * receiver expects changes in the order: urgent, window,
-	 * ack, seq (the order minimizes the number of temporaries
-	 * needed in this section of code).
-	 */
-	if (th->th_flags & TCP_URG) {
-		deltaS = ntohs(th->th_urp);
-		ENCODEZ(deltaS);
-		changes |= NEW_U;
-	} else if (th->th_urp != oth->th_urp)
-		/* argh! URG not set but urp changed -- a sensible
-		 * implementation should never do this but RFC793
-		 * doesn't prohibit the change so we have to deal
-		 * with it. */
-		goto uncompressed;
-	
-	if ((deltaS = (u_short)(ntohs(th->th_win) - ntohs(oth->th_win))) != 0) {
-		ENCODE(deltaS);
-		changes |= NEW_W;
-	}
-	
-	if ((deltaL = ntohl(th->th_ack) - ntohl(oth->th_ack)) != 0) {
-		if (deltaL > 0xffff)
-			goto uncompressed;
-		deltaA = (u_short)deltaL;
-		ENCODE(deltaA);
-		changes |= NEW_A;
-	}
-	
-	if ((deltaL = ntohl(th->th_seq) - ntohl(oth->th_seq)) != 0) {
-		if (deltaL > 0xffff)
-			goto uncompressed;
-		deltaS = (u_short)deltaL;
-		ENCODE(deltaS);
-		changes |= NEW_S;
-	}
-	
-	switch(changes) {
-	
-	case 0:
-		/*
-		 * Nothing changed. If this packet contains data and the
-		 * last one didn't, this is probably a data packet following
-		 * an ack (normal on an interactive connection) and we send
-		 * it compressed.  Otherwise it's probably a retransmit,
-		 * retransmitted ack or window probe.  Send it uncompressed
-		 * in case the other side missed the compressed version.
-		 */
-		if (ip->ip_len != cs->cs_ip.ip_len &&
-			ntohs(cs->cs_ip.ip_len) == hlen)
-		break;
-	
-	/* (fall through) */
-	
-	case SPECIAL_I:
-	case SPECIAL_D:
-		/*
-		 * actual changes match one of our special case encodings --
-		 * send packet uncompressed.
-		 */
-		goto uncompressed;
-	
-	case NEW_S|NEW_A:
-		if (deltaS == deltaA && deltaS == ntohs(cs->cs_ip.ip_len) - hlen) {
-			/* special case for echoed terminal traffic */
-			changes = SPECIAL_I;
-			cp = new_seq;
-		}
-		break;
-	
-	case NEW_S:
-		if (deltaS == ntohs(cs->cs_ip.ip_len) - hlen) {
-			/* special case for data xfer */
-			changes = SPECIAL_D;
-			cp = new_seq;
-		}
-		break;
-	}
-	
-	deltaS = (u_short)(ntohs(ip->ip_id) - ntohs(cs->cs_ip.ip_id));
-	if (deltaS != 1) {
-		ENCODEZ(deltaS);
-		changes |= NEW_I;
-	}
-	if (th->th_flags & TCP_PSH)
-	changes |= TCP_PUSH_BIT;
-	/*
-	 * Grab the cksum before we overwrite it below.  Then update our
-	 * state with this packet's header.
-	 */
-	deltaA = ntohs(th->th_sum);
-	BCOPY(ip, &cs->cs_ip, hlen);
-	
-	/*
-	 * We want to use the original packet as our compressed packet.
-	 * (cp - new_seq) is the number of bytes we need for compressed
-	 * sequence numbers.  In addition we need one byte for the change
-	 * mask, one for the connection id and two for the tcp checksum.
-	 * So, (cp - new_seq) + 4 bytes of header are needed.  hlen is how
-	 * many bytes of the original packet to toss so subtract the two to
-	 * get the new packet size.
-	 */
-	deltaS = (u_short)(cp - new_seq);
-	if (!comp->compressSlot || comp->last_xmit != cs->cs_id) {
-		comp->last_xmit = cs->cs_id;
-		hlen -= deltaS + 4;
-		pbuf_header(pb, -hlen);
-		cp = (u_char *)pb->payload;
-		*cp++ = changes | NEW_C;
-		*cp++ = cs->cs_id;
-	} else {
-		hlen -= deltaS + 3;
-		pbuf_header(pb, -hlen);
-		cp = (u_char *)pb->payload;
-		*cp++ = changes;
-	}
-	*cp++ = deltaA >> 8;
-	*cp++ = deltaA;
-	BCOPY(new_seq, cp, deltaS);
-	INCR(vjs_compressed);
-	return (TYPE_COMPRESSED_TCP);
-
-	/*
-	 * Update connection state cs & send uncompressed packet (that is,
-	 * a regular ip/tcp packet but with the 'conversation id' we hope
-	 * to use on future compressed packets in the protocol field).
-	 */
-uncompressed:
-	BCOPY(ip, &cs->cs_ip, hlen);
-	ip->ip_p = cs->cs_id;
-	comp->last_xmit = cs->cs_id;
-	return (TYPE_UNCOMPRESSED_TCP);
-}
-
-/*
- * Called when we may have missed a packet.
- */
-void vj_uncompress_err(struct vjcompress *comp)
-{
-    comp->flags |= VJF_TOSS;
-	INCR(vjs_errorin);
-}
-
-/*
- * "Uncompress" a packet of type TYPE_UNCOMPRESSED_TCP.
- * Return 0 on success, -1 on failure.
- */
-int vj_uncompress_uncomp(
-	struct pbuf *nb,
-	struct vjcompress *comp
-)
-{
-	register u_int hlen;
-	register struct cstate *cs;
-	register struct ip *ip;
-	
-	ip = (struct ip *)nb->payload;
-	hlen = getip_hl(*ip) << 2;
-	if (ip->ip_p >= MAX_SLOTS
-			|| hlen + sizeof(struct tcphdr) > nb->len
-			|| (hlen += getth_off(*((struct tcphdr *)&((char *)ip)[hlen])) << 2)
-			    > nb->len
-			|| hlen > MAX_HDR) {
-		PPPDEBUG((LOG_INFO, "vj_uncompress_uncomp: bad cid=%d, hlen=%d buflen=%d\n", 
-					ip->ip_p, hlen, nb->len));
-		comp->flags |= VJF_TOSS;
-		INCR(vjs_errorin);
-		return -1;
-	}
-	cs = &comp->rstate[comp->last_recv = ip->ip_p];
-	comp->flags &=~ VJF_TOSS;
-	ip->ip_p = IPPROTO_TCP;
-	BCOPY(ip, &cs->cs_ip, hlen);
-	cs->cs_hlen = hlen;
-	INCR(vjs_uncompressedin);
-	return 0;
-}
-
-/*
- * Uncompress a packet of type TYPE_COMPRESSED_TCP.
- * The packet is composed of a buffer chain and the first buffer
- * must contain an accurate chain length.
- * The first buffer must include the entire compressed TCP/IP header. 
- * This procedure replaces the compressed header with the uncompressed
- * header and returns the length of the VJ header.
- */
-int vj_uncompress_tcp(
-	struct pbuf **nb,
-	struct vjcompress *comp
-)
-{
-	u_char *cp;
-	struct tcphdr *th;
-	struct cstate *cs;
-	u_short *bp;
-	struct pbuf *n0 = *nb;
-	u32_t tmp;
-	u_int vjlen, hlen, changes;
-	
-	INCR(vjs_compressedin);
-	cp = (u_char *)n0->payload;
-	changes = *cp++;
-	if (changes & NEW_C) {
-		/* 
-		 * Make sure the state index is in range, then grab the state.
-		 * If we have a good state index, clear the 'discard' flag. 
-		 */
-		if (*cp >= MAX_SLOTS) {
-			PPPDEBUG((LOG_INFO, "vj_uncompress_tcp: bad cid=%d\n", *cp));
-			goto bad;
-		}
-		
-		comp->flags &=~ VJF_TOSS;
-		comp->last_recv = *cp++;
-	} else {
-		/* 
-		 * this packet has an implicit state index.  If we've
-		 * had a line error since the last time we got an
-		 * explicit state index, we have to toss the packet. 
-		 */
-		if (comp->flags & VJF_TOSS) {
-			PPPDEBUG((LOG_INFO, "vj_uncompress_tcp: tossing\n"));
-			INCR(vjs_tossed);
-			return (-1);
-		}
-	}
-	cs = &comp->rstate[comp->last_recv];
-	hlen = getip_hl(cs->cs_ip) << 2;
-	th = (struct tcphdr *)&((u_char *)&cs->cs_ip)[hlen];
-	th->th_sum = htons((*cp << 8) | cp[1]);
-	cp += 2;
-	if (changes & TCP_PUSH_BIT)
-		th->th_flags |= TCP_PSH;
-	else
-		th->th_flags &=~ TCP_PSH;
-	
-	switch (changes & SPECIALS_MASK) {
-	case SPECIAL_I:
-		{
-			register u32_t i = ntohs(cs->cs_ip.ip_len) - cs->cs_hlen;
-			/* some compilers can't nest inline assembler.. */
-			tmp = ntohl(th->th_ack) + i;
-			th->th_ack = htonl(tmp);
-			tmp = ntohl(th->th_seq) + i;
-			th->th_seq = htonl(tmp);
-		}
-		break;
-	
-	case SPECIAL_D:
-		/* some compilers can't nest inline assembler.. */
-		tmp = ntohl(th->th_seq) + ntohs(cs->cs_ip.ip_len) - cs->cs_hlen;
-		th->th_seq = htonl(tmp);
-		break;
-	
-	default:
-		if (changes & NEW_U) {
-			th->th_flags |= TCP_URG;
-			DECODEU(th->th_urp);
-		} else
-			th->th_flags &=~ TCP_URG;
-		if (changes & NEW_W)
-			DECODES(th->th_win);
-		if (changes & NEW_A)
-			DECODEL(th->th_ack);
-		if (changes & NEW_S)
-			DECODEL(th->th_seq);
-		break;
-	}
-	if (changes & NEW_I) {
-		DECODES(cs->cs_ip.ip_id);
-	} else {
-		cs->cs_ip.ip_id = ntohs(cs->cs_ip.ip_id) + 1;
-		cs->cs_ip.ip_id = htons(cs->cs_ip.ip_id);
-	}
-	
-	/*
-	 * At this point, cp points to the first byte of data in the
-	 * packet.  Fill in the IP total length and update the IP
-	 * header checksum.
-	 */
-	vjlen = (u_short)(cp - (u_char*)n0->payload);
-	if (n0->len < vjlen) {
-		/* 
-		 * We must have dropped some characters (crc should detect
-		 * this but the old slip framing won't) 
-		 */
-		PPPDEBUG((LOG_INFO, "vj_uncompress_tcp: head buffer %d too short %d\n", 
-				  n0->len, vjlen));
-		goto bad;
-	}
-	
-#if BYTE_ORDER == LITTLE_ENDIAN
-	tmp = n0->tot_len - vjlen + cs->cs_hlen;
-	cs->cs_ip.ip_len = htons(tmp);
-#else
-	cs->cs_ip.ip_len = htons(n0->tot_len - vjlen + cs->cs_hlen);
-#endif
-	
-	/* recompute the ip header checksum */
-	bp = (u_short *) &cs->cs_ip;
-	cs->cs_ip.ip_sum = 0;
-	for (tmp = 0; hlen > 0; hlen -= 2)
-		tmp += *bp++;
-	tmp = (tmp & 0xffff) + (tmp >> 16);
-	tmp = (tmp & 0xffff) + (tmp >> 16);
-	cs->cs_ip.ip_sum = (u_short)(~tmp);
-	
-	/* Remove the compressed header and prepend the uncompressed header. */
-	pbuf_header(n0, -vjlen);
-
-	if(MEM_ALIGN(n0->payload) != n0->payload) {
-		struct pbuf *np, *q;
-		u8_t *bufptr;
-
-		np = pbuf_alloc(PBUF_RAW, n0->len + cs->cs_hlen, PBUF_POOL);
-		if(!np) {
-			PPPDEBUG((LOG_WARNING, "vj_uncompress_tcp: realign failed\n"));
-			*nb = NULL;
-			goto bad;
-		}
-
-		pbuf_header(np, -cs->cs_hlen);
-
-		bufptr = n0->payload;
-		for(q = np; q != NULL; q = q->next) {
-			memcpy(q->payload, bufptr, q->len);
-			bufptr += q->len;
-		}
-
-		if(n0->next) {
-			pbuf_chain(np, n0->next);
-			pbuf_dechain(n0);
-		}
-		pbuf_free(n0);
-		n0 = np;
-	}
-
-	if(pbuf_header(n0, cs->cs_hlen)) {
-		struct pbuf *np;
-
-		LWIP_ASSERT("vj_uncompress_tcp: cs->cs_hlen <= PBUF_POOL_BUFSIZE", cs->cs_hlen <= PBUF_POOL_BUFSIZE);
-		np = pbuf_alloc(PBUF_RAW, cs->cs_hlen, PBUF_POOL);
-		if(!np) {
-			PPPDEBUG((LOG_WARNING, "vj_uncompress_tcp: prepend failed\n"));
-			*nb = NULL;
-			goto bad;
-		}
-		pbuf_cat(np, n0);
-		n0 = np;
-	}
-	LWIP_ASSERT("n0->len >= cs->cs_hlen", n0->len >= cs->cs_hlen);
-	memcpy(n0->payload, &cs->cs_ip, cs->cs_hlen);
-
-	*nb = n0;
-
-	return vjlen;
-	
-bad:
-	comp->flags |= VJF_TOSS;
-	INCR(vjs_errorin);
-	return (-1);
-}
-
-#endif
-
-
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.h
deleted file mode 100644
index b7374b3..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/vj.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Definitions for tcp compression routines.
- *
- * $Id: vj.h $
- *
- * Copyright (c) 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- *	Van Jacobson (van at helios.ee.lbl.gov), Dec 31, 1989:
- *	- Initial distribution.
- */
-
-#ifndef VJ_H
-#define VJ_H
-
-#include "vjbsdhdr.h"
-
-#define MAX_SLOTS	16			/* must be > 2 and < 256 */
-#define MAX_HDR		128
-
-/*
- * Compressed packet format:
- *
- * The first octet contains the packet type (top 3 bits), TCP
- * 'push' bit, and flags that indicate which of the 4 TCP sequence
- * numbers have changed (bottom 5 bits).  The next octet is a
- * conversation number that associates a saved IP/TCP header with
- * the compressed packet.  The next two octets are the TCP checksum
- * from the original datagram.  The next 0 to 15 octets are
- * sequence number changes, one change per bit set in the header
- * (there may be no changes and there are two special cases where
- * the receiver implicitly knows what changed -- see below).
- * 
- * There are 5 numbers which can change (they are always inserted
- * in the following order): TCP urgent pointer, window,
- * acknowlegement, sequence number and IP ID.  (The urgent pointer
- * is different from the others in that its value is sent, not the
- * change in value.)  Since typical use of SLIP links is biased
- * toward small packets (see comments on MTU/MSS below), changes
- * use a variable length coding with one octet for numbers in the
- * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the
- * range 256 - 65535 or 0.  (If the change in sequence number or
- * ack is more than 65535, an uncompressed packet is sent.)
- */
-
-/*
- * Packet types (must not conflict with IP protocol version)
- *
- * The top nibble of the first octet is the packet type.  There are
- * three possible types: IP (not proto TCP or tcp with one of the
- * control flags set); uncompressed TCP (a normal IP/TCP packet but
- * with the 8-bit protocol field replaced by an 8-bit connection id --
- * this type of packet syncs the sender & receiver); and compressed
- * TCP (described above).
- *
- * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and
- * is logically part of the 4-bit "changes" field that follows.  Top
- * three bits are actual packet type.  For backward compatibility
- * and in the interest of conserving bits, numbers are chosen so the
- * IP protocol version number (4) which normally appears in this nibble
- * means "IP packet".
- */
-
-/* packet types */
-#define TYPE_IP 0x40
-#define TYPE_UNCOMPRESSED_TCP 0x70
-#define TYPE_COMPRESSED_TCP 0x80
-#define TYPE_ERROR 0x00
-
-/* Bits in first octet of compressed packet */
-#define NEW_C	0x40	/* flag bits for what changed in a packet */
-#define NEW_I	0x20
-#define NEW_S	0x08
-#define NEW_A	0x04
-#define NEW_W	0x02
-#define NEW_U	0x01
-
-/* reserved, special-case values of above */
-#define SPECIAL_I (NEW_S|NEW_W|NEW_U)		/* echoed interactive traffic */
-#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U)	/* unidirectional data */
-#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)
-
-#define TCP_PUSH_BIT 0x10
-
-
-/*
- * "state" data for each active tcp conversation on the wire.  This is
- * basically a copy of the entire IP/TCP header from the last packet
- * we saw from the conversation together with a small identifier
- * the transmit & receive ends of the line use to locate saved header.
- */
-struct cstate {
-    struct cstate *cs_next;	/* next most recently used state (xmit only) */
-    u_short cs_hlen;		/* size of hdr (receive only) */
-    u_char cs_id;			/* connection # associated with this state */
-    u_char cs_filler;
-    union {
-		char csu_hdr[MAX_HDR];
-		struct ip csu_ip;	/* ip/tcp hdr from most recent packet */
-    } vjcs_u;
-};
-#define cs_ip vjcs_u.csu_ip
-#define cs_hdr vjcs_u.csu_hdr
-
-
-struct vjstat {
-    unsigned long vjs_packets;			/* outbound packets */
-    unsigned long vjs_compressed;		/* outbound compressed packets */
-    unsigned long vjs_searches;			/* searches for connection state */
-    unsigned long vjs_misses;			/* times couldn't find conn. state */
-    unsigned long vjs_uncompressedin;	/* inbound uncompressed packets */
-    unsigned long vjs_compressedin;		/* inbound compressed packets */
-    unsigned long vjs_errorin;			/* inbound unknown type packets */
-    unsigned long vjs_tossed;			/* inbound packets tossed because of error */
-};
-
-/*
- * all the state data for one serial line (we need one of these per line).
- */
-struct vjcompress {
-    struct cstate *last_cs;	/* most recently used tstate */
-    u_char last_recv;		/* last rcvd conn. id */
-    u_char last_xmit;		/* last sent conn. id */
-    u_short flags;
-    u_char maxSlotIndex;
-    u_char compressSlot;	/* Flag indicating OK to compress slot ID. */
-#if LINK_STATS
-    struct vjstat stats;
-#endif
-    struct cstate tstate[MAX_SLOTS];	/* xmit connection states */
-    struct cstate rstate[MAX_SLOTS];	/* receive connection states */
-};
-
-/* flag values */
-#define VJF_TOSS 1U		/* tossing rcvd frames because of input err */
-
-extern void  vj_compress_init (struct vjcompress *comp);
-extern u_int vj_compress_tcp (struct vjcompress *comp, struct pbuf *pb);
-extern void  vj_uncompress_err (struct vjcompress *comp);
-extern int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp);
-extern int vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp);
-
-#endif /* VJ_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/ppp/vjbsdhdr.h b/src/VBox/Devices/Network/lwip/src/netif/ppp/vjbsdhdr.h
deleted file mode 100644
index a089352..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/ppp/vjbsdhdr.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef VJBSDHDR_H
-#define VJBSDHDR_H
-
-#include "lwip/tcp.h"
-
-
-/*
- * Structure of an internet header, naked of options.
- *
- * We declare ip_len and ip_off to be short, rather than u_short
- * pragmatically since otherwise unsigned comparisons can result
- * against negative integers quite easily, and fail in subtle ways.
- */
-PACK_STRUCT_BEGIN
-struct ip
-{
-#if defined(NO_CHAR_BITFIELDS)
-	u_char ip_hl_v;	/* bug in GCC for mips means the bitfield stuff will sometimes break - so we use a char for both and get round it with macro's instead... */
-#else
-#if BYTE_ORDER == LITTLE_ENDIAN
-	unsigned ip_hl:4,				/* header length */
-		ip_v:4;						/* version */
-#elif BYTE_ORDER == BIG_ENDIAN 
-	unsigned ip_v:4,					/* version */
-		ip_hl:4;					/* header length */
-#else
-	COMPLAIN - NO BYTE ORDER SELECTED!
-#endif
-#endif
-	u_char	ip_tos;					/* type of service */
-	u_short	ip_len;					/* total length */
-	u_short	ip_id;					/* identification */
-	u_short	ip_off;					/* fragment offset field */
-#define	IP_DF 0x4000				/* dont fragment flag */
-#define	IP_MF 0x2000				/* more fragments flag */
-#define	IP_OFFMASK 0x1fff			/* mask for fragmenting bits */
-	u_char	ip_ttl;					/* time to live */
-	u_char	ip_p;					/* protocol */
-	u_short	ip_sum;					/* checksum */
-	struct	in_addr ip_src,ip_dst;	/* source and dest address */
-};
-PACK_STRUCT_END
-
-typedef u32_t tcp_seq;
-
-/*
- * TCP header.
- * Per RFC 793, September, 1981.
- */
-PACK_STRUCT_BEGIN
-struct tcphdr  
-{
-	u_short	th_sport;		/* source port */
-	u_short	th_dport;		/* destination port */
-	tcp_seq	th_seq;			/* sequence number */
-	tcp_seq	th_ack;			/* acknowledgement number */
-#if defined(NO_CHAR_BITFIELDS)
-	u_char th_x2_off;
-#else
-#if BYTE_ORDER == LITTLE_ENDIAN
-	unsigned	th_x2:4,		/* (unused) */
-			th_off:4;		/* data offset */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN 
-	unsigned	th_off:4,		/* data offset */
-			th_x2:4;		/* (unused) */
-#endif
-#endif
-	u_char	th_flags;
-	u_short	th_win;			/* window */
-	u_short	th_sum;			/* checksum */
-	u_short	th_urp;			/* urgent pointer */
-};
-PACK_STRUCT_END
-
-#endif /* VJBSDHDR_H */
diff --git a/src/VBox/Devices/Network/lwip/src/netif/slipif.c b/src/VBox/Devices/Network/lwip/src/netif/slipif.c
deleted file mode 100644
index dd8db20..0000000
--- a/src/VBox/Devices/Network/lwip/src/netif/slipif.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * All rights reserved. 
- *
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following conditions 
- * are met: 
- * 1. Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer. 
- * 2. Redistributions in binary form must reproduce the above copyright 
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the distribution. 
- * 3. Neither the name of the Institute nor the names of its contributors 
- *    may be used to endorse or promote products derived from this software 
- *    without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
- * SUCH DAMAGE. 
- *
- * This file is built upon the file: src/arch/rtxc/netif/sioslip.c
- *
- * Author: Magnus Ivarsson <magnus.ivarsson(at)volvo.com> 
- */
-
-/* 
- * This is an arch independent SLIP netif. The specific serial hooks must be
- * provided by another file. They are sio_open, sio_recv and sio_send
- */
-
-#include "netif/slipif.h"
-#include "lwip/opt.h"
-#include "lwip/def.h"
-#include "lwip/pbuf.h"
-#include "lwip/sys.h"
-#include "lwip/stats.h"
-#include "lwip/sio.h"
-
-#define SLIP_END     0300
-#define SLIP_ESC     0333
-#define SLIP_ESC_END 0334
-#define SLIP_ESC_ESC 0335
-
-#define MAX_SIZE     1500
-
-/**
- * Send a pbuf doing the necessary SLIP encapsulation
- *
- * Uses the serial layer's sio_send() 
- */
-err_t
-slipif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
-{
-  struct pbuf *q;
-  u16_t i;
-  u8_t c;
-
-  /* Send pbuf out on the serial I/O device. */
-  sio_send(SLIP_END, netif->state);
-
-  for (q = p; q != NULL; q = q->next) {
-    for (i = 0; i < q->len; i++) {
-      c = ((u8_t *)q->payload)[i];
-      switch (c) {
-      case SLIP_END:
-        sio_send(SLIP_ESC, netif->state);
-        sio_send(SLIP_ESC_END, netif->state);
-        break;
-      case SLIP_ESC:
-        sio_send(SLIP_ESC, netif->state);
-        sio_send(SLIP_ESC_ESC, netif->state);
-        break;
-      default:
-        sio_send(c, netif->state);
-        break;
-      }
-    }
-  }
-  sio_send(SLIP_END, netif->state);
-  return 0;
-}
-
-/**
- * Handle the incoming SLIP stream character by character
- *
- * Poll the serial layer by calling sio_recv()
- * 
- * @return The IP packet when SLIP_END is received 
- */
-static struct pbuf *
-slipif_input(struct netif *netif)
-{
-  u8_t c;
-  struct pbuf *p, *q;
-  u16_t recved;
-  u16_t i;
-
-  q = p = NULL;
-  recved = i = 0;
-  c = 0;
-
-  while (1) {
-    c = sio_recv(netif->state);
-    switch (c) {
-    case SLIP_END:
-      if (recved > 0) {
-        /* Received whole packet. */
-        pbuf_realloc(q, recved);
-        
-        LINK_STATS_INC(link.recv);
-        
-        LWIP_DEBUGF(SLIP_DEBUG, ("slipif: Got packet\n"));
-        return q;
-      }
-      break;
-
-    case SLIP_ESC:
-      c = sio_recv(netif->state);
-      switch (c) {
-      case SLIP_ESC_END:
-        c = SLIP_END;
-        break;
-      case SLIP_ESC_ESC:
-        c = SLIP_ESC;
-        break;
-      }
-      /* FALLTHROUGH */
-
-    default:
-      if (p == NULL) {
-        LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: alloc\n"));
-        p = pbuf_alloc(PBUF_LINK, PBUF_POOL_BUFSIZE, PBUF_POOL);
-
-        if (p == NULL) {
-          LINK_STATS_INC(link.drop);
-          LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: no new pbuf! (DROP)\n"));
-        }
-
-        if (q != NULL) {
-          pbuf_cat(q, p);
-        } else {
-          q = p;
-        }
-      }
-      if (p != NULL && recved < MAX_SIZE) {
-        ((u8_t *)p->payload)[i] = c;
-        recved++;
-        i++;
-        if (i >= p->len) {
-          i = 0;
-          if (p->next != NULL && p->next->len > 0)
-            p = p->next;
-          else
-            p = NULL;
-        }
-      }
-      break;
-    }
-
-  }
-  return NULL;
-}
-
-/**
- * The SLIP input thread.
- *
- * Feed the IP layer with incoming packets
- */
-static void
-slipif_loop(void *nf)
-{
-  struct pbuf *p;
-  struct netif *netif = (struct netif *)nf;
-
-  while (1) {
-    p = slipif_input(netif);
-    netif->input(p, netif);
-  }
-}
-
-/**
- * SLIP netif initialization
- *
- * Call the arch specific sio_open and remember
- * the opened device in the state field of the netif.
- */
-err_t
-slipif_init(struct netif *netif)
-{
-
-  LWIP_DEBUGF(SLIP_DEBUG, ("slipif_init: netif->num=%"U16_F"\n", (u16_t)netif->num));
-
-  netif->name[0] = 's';
-  netif->name[1] = 'l';
-  netif->output = slipif_output;
-  netif->mtu = 1500;
-  netif->flags = NETIF_FLAG_POINTTOPOINT;
-
-  netif->state = sio_open(netif->num);
-  if (!netif->state)
-    return ERR_IF;
-
-  sys_thread_new(slipif_loop, netif, SLIPIF_THREAD_PRIO);
-  return ERR_OK;
-}
diff --git a/src/VBox/Devices/Network/lwip/vbox/include/arch/bpstruct.h b/src/VBox/Devices/Network/lwip/vbox/include/arch/bpstruct.h
deleted file mode 100644
index 1d81e3f..0000000
--- a/src/VBox/Devices/Network/lwip/vbox/include/arch/bpstruct.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma pack(push,1)
diff --git a/src/VBox/Devices/Network/lwip/vbox/include/arch/cc.h b/src/VBox/Devices/Network/lwip/vbox/include/arch/cc.h
deleted file mode 100644
index f03b84f..0000000
--- a/src/VBox/Devices/Network/lwip/vbox/include/arch/cc.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef VBOX_ARCH_CC_H_
-#define VBOX_ARCH_CC_H_
-
-#ifndef LOG_GROUP
-#define LOG_GROUP LOG_GROUP_DRV_LWIP
-#endif
-#include <VBox/log.h>
-#include <iprt/stdint.h>
-#include <iprt/cdefs.h>
-#include <iprt/assert.h>
-
-typedef uint8_t u8_t;
-typedef int8_t s8_t;
-typedef uint16_t u16_t;
-typedef int16_t s16_t;
-typedef uint32_t u32_t;
-typedef int32_t s32_t;
-
-typedef uintptr_t mem_ptr_t;
-
-#ifdef _MSC_VER
-# define PACK_STRUCT_FIELD(x) x
-# define PACK_STRUCT_STRUCT
-# define PACK_STRUCT_USE_INCLUDES
-# define LWIP_PROVIDE_ERRNO
-# pragma warning (disable: 4103)
-#elif defined(__GNUC__)
-# define PACK_STRUCT_FIELD(x) x
-# define PACK_STRUCT_STRUCT __attribute__((__packed__))
-# define PACK_STRUCT_BEGIN
-# define PACK_STRUCT_END
-# include <errno.h>
-#else
-# error This header file has not been ported yet for this compiler.
-#endif
-
-/* Provide byte order hint. */
-#undef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-
-#ifdef DEBUG
-#define LWIP_PLATFORM_DIAG(x) Log(x)
-#else /* !DEBUG */
-#define LWIP_PLATFORM_DIAG(x) LogRel(x)
-#endif /* !DEBUG */
-#define LWIP_PLATFORM_ASSERT(x) AssertReleaseMsgFailed((x))
-
-#endif /* !VBOX_ARCH_CC_H_ */
diff --git a/src/VBox/Devices/Network/lwip/vbox/include/arch/epstruct.h b/src/VBox/Devices/Network/lwip/vbox/include/arch/epstruct.h
deleted file mode 100644
index 65898b5..0000000
--- a/src/VBox/Devices/Network/lwip/vbox/include/arch/epstruct.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma pack(pop)
diff --git a/src/VBox/Devices/Network/lwip/vbox/include/arch/perf.h b/src/VBox/Devices/Network/lwip/vbox/include/arch/perf.h
deleted file mode 100644
index 5b364db..0000000
--- a/src/VBox/Devices/Network/lwip/vbox/include/arch/perf.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef VBOX_ARCH_PERF_H_
-#define VBOX_ARCH_PERF_H_
-
-#define PERF_START
-#define PERF_STOP(x)
-
-#endif /* !VBOX_ARCH_PERF_H_ */
diff --git a/src/VBox/Devices/Network/lwip/vbox/include/arch/sys_arch.h b/src/VBox/Devices/Network/lwip/vbox/include/arch/sys_arch.h
deleted file mode 100644
index 199c459..0000000
--- a/src/VBox/Devices/Network/lwip/vbox/include/arch/sys_arch.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef VBOX_ARCH_SYS_ARCH_H_
-#define VBOX_ARCH_SYS_ARCH_H_
-
-#include <iprt/semaphore.h>
-#include <iprt/thread.h>
-#ifdef RT_OS_DARWIN
-#include <sys/time.h>
-#endif
-
-/** NULL value for a mbox. */
-#define SYS_MBOX_NULL NULL
-
-/** NULL value for a mutex semaphore. */
-#define SYS_SEM_NULL NIL_RTSEMEVENT
-
-/** The IPRT event semaphore ID just works fine for this type. */
-typedef RTSEMEVENT sys_sem_t;
-
-/** Forward declaration of the actual mbox type. */
-struct sys_mbox;
-
-/** The opaque type of a mbox. */
-typedef struct sys_mbox *sys_mbox_t;
-
-/** The IPRT thread ID just works fine for this type. */
-typedef RTTHREAD sys_thread_t;
-
-#if SYS_LIGHTWEIGHT_PROT
-/** This is just a dummy. The implementation doesn't need anything. */
-typedef void *sys_prot_t;
-#endif
-
-#endif /* !VBOX_ARCH_SYS_ARCH_H_ */
diff --git a/src/VBox/Devices/Network/lwip/vbox/include/lwipopts.h b/src/VBox/Devices/Network/lwip/vbox/include/lwipopts.h
deleted file mode 100644
index 0d405df..0000000
--- a/src/VBox/Devices/Network/lwip/vbox/include/lwipopts.h
+++ /dev/null
@@ -1,300 +0,0 @@
-#ifndef VBOX_LWIP_OPTS_H_
-#define VBOX_LWIP_OPTS_H_
-
-#include <iprt/mem.h>
-#include <iprt/alloca.h>    /* This may include malloc.h (msc), which is something that has
-                             * to be done before redefining any of the functions therein. */
-
-/* lwip/sockets.h assumes that if FD_SET is defined (in case of Innotek GCC
- * its definition is dragged through iprt/types.h) then struct timeval is
- * defined as well, but it's not the case. So include it manually. */
-#ifdef RT_OS_OS2
-# include <sys/time.h>
-#endif
-
-/** Make lwIP use the libc malloc, or more precisely (see below) the IPRT
- * memory allocation functions. */
-#define MEM_LIBC_MALLOC 1
-
-/** Set proper memory alignment. */
-#if HC_ARCH_BITS == 64
-# define MEM_ALIGNMENT 8
-#else
-#define MEM_ALIGNMENT 4
-#endif
-
-/** Increase number of PBUF buffers. */
-#define PBUF_POOL_SIZE 128
-
-/** Increase PBUF buffer size. */
-#define PBUF_POOL_BUFSIZE 1536
-
-/** Increase maximum TCP window size. */
-#define TCP_WND 32768
-
-/** Increase TCP maximum segment size. */
-#define TCP_MSS 1400
-
-/** Enable queueing of out-of-order segments. */
-#define TCP_QUEUE_OOSEQ 1
-
-/** TCP send buffer space. */
-#define TCP_SND_BUF 32768
-
-/** TCP send buffer space (in pbufs). */
-#define TCP_SND_QUEUELEN 2*TCP_SND_BUF/TCP_MSS
-
-/** Increase maximum pool size for PBUF. */
-#define MEMP_NUM_PBUF 64
-
-/** Increase maximum pool size for TCPIP messages. Default of 8 is too low. */
-#define MEMP_NUM_TCPIP_MSG 32
-
-/** Increase maximum number of queued TCP segments. Needed for large sends. */
-#define MEMP_NUM_TCP_SEG 255
-
-/** Turn on support for lightweight critical region protection. Leaving this
- * off uses synchronization code in pbuf.c which is totally polluted with
- * races. All the other lwip source files would fall back to semaphore-based
- * synchronization, but pbuf.c is just broken, leading to incorrect allocation
- * and as a result to assertions due to buffers being double freed. */
-#define SYS_LIGHTWEIGHT_PROT 1
-
-/** Attempt to get rid of htons etc. macro issues. */
-#define LWIP_PREFIX_BYTEORDER_FUNCS
-
-/* Debugging stuff. */
-#ifdef DEBUG
-#define LWIP_DEBUG
-#define DBG_TYPES_ON (DBG_ON | DBG_TRACE | DBG_STATE | DBG_FRESH | DBG_HALT)
-#define DBG_MIN_LEVEL 0
-
-#define ETHARP_DEBUG    DBG_ON
-#define NETIF_DEBUG DBG_ON
-#define PBUF_DEBUG  DBG_ON
-#define API_LIB_DEBUG   DBG_ON
-#define API_MSG_DEBUG   DBG_ON
-#define SOCKETS_DEBUG   DBG_ON
-#define ICMP_DEBUG  DBG_ON
-#define INET_DEBUG  DBG_ON
-#define IP_DEBUG    DBG_ON
-#define IP_REASS_DEBUG  DBG_ON
-#define RAW_DEBUG   DBG_ON
-#define MEM_DEBUG   DBG_ON
-#define MEMP_DEBUG  DBG_ON
-#define SYS_DEBUG   DBG_ON
-#define TCP_DEBUG   DBG_ON
-#define TCP_INPUT_DEBUG DBG_ON
-#define TCP_FR_DEBUG    DBG_ON
-#define TCP_RTO_DEBUG   DBG_ON
-#define TCP_REXMIT_DEBUG    DBG_ON
-#define TCP_CWND_DEBUG  DBG_ON
-#define TCP_WND_DEBUG   DBG_ON
-#define TCP_OUTPUT_DEBUG    DBG_ON
-#define TCP_RST_DEBUG   DBG_ON
-#define TCP_QLEN_DEBUG  DBG_ON
-#define UDP_DEBUG   DBG_ON
-#define TCPIP_DEBUG DBG_ON
-#define DHCP_DEBUG  DBG_ON
-
-#endif /* DEBUG */
-
-/* printf formatter definitions */
-#define U16_F "hu"
-#define S16_F "hd"
-#define X16_F "hx"
-#define U32_F "lu"
-#define S32_F "ld"
-#define X32_F "lx"
-
-/* Redirect libc memory alloc functions to IPRT. */
-#define malloc(x) RTMemAlloc(x)
-#define realloc(x,y) RTMemRealloc((x), (y))
-#define free(x) RTMemFree(x)
-
-/* Hack to avoid function name collisions with slirp or any other code. */
-#define api_msg_input lwip_api_msg_input
-#define api_msg_post lwip_api_msg_post
-#define etharp_arp_input lwip_etharp_arp_input
-#define etharp_find_addr lwip_etharp_find_addr
-#define etharp_init lwip_etharp_init
-#define etharp_ip_input lwip_etharp_ip_input
-#define etharp_output lwip_etharp_output
-#define etharp_query lwip_etharp_query
-#define etharp_request lwip_etharp_request
-#define etharp_tmr lwip_etharp_tmr
-#define icmp_dest_unreach lwip_icmp_dest_unreach
-#define icmp_input lwip_icmp_input
-#define inet_addr lwip_inet_addr
-#define inet_aton lwip_inet_aton
-#define inet_chksum lwip_inet_chksum
-#define inet_chksum_pbuf lwip_inet_chksum_pbuf
-#define inet_chksum_pseudo lwip_inet_chksum_pseudo
-#define inet_ntoa lwip_inet_ntoa
-#define ip_addr_any lwip_ip_addr_any
-#define ip_addr_broadcast lwip_ip_addr_broadcast
-#define ip_addr_isbroadcast lwip_ip_addr_isbroadcast /* problematic */
-#define ip_frag lwip_ip_frag
-#define ip_frag_init lwip_ip_frag_init
-#define ip_init lwip_ip_init
-#define ip_input lwip_ip_input
-#define ip_output lwip_ip_output
-#define ip_output_if lwip_ip_output_if
-#define ip_reass lwip_ip_reass
-#define ip_reass_tmr lwip_ip_reass_tmr
-#define ip_route lwip_ip_route
-#define netbuf_alloc lwip_netbuf_alloc
-#define netbuf_chain lwip_netbuf_chain
-#define netbuf_copy lwip_netbuf_copy
-#define netbuf_copy_partial lwip_netbuf_copy_partial
-#define netbuf_data lwip_netbuf_data
-#define netbuf_delete lwip_netbuf_delete
-#define netbuf_first lwip_netbuf_first
-#define netbuf_free lwip_netbuf_free
-#define netbuf_fromaddr lwip_netbuf_fromaddr
-#define netbuf_fromport lwip_netbuf_fromport
-#define netbuf_len lwip_netbuf_len
-#define netbuf_new lwip_netbuf_new
-#define netbuf_next lwip_netbuf_next
-#define netbuf_ref lwip_netbuf_ref
-#define netconn_accept lwip_netconn_accept
-#define netconn_addr lwip_netconn_addr
-#define netconn_bind lwip_netconn_bind
-#define netconn_close lwip_netconn_close
-#define netconn_connect lwip_netconn_connect
-#define netconn_delete lwip_netconn_delete
-#define netconn_disconnect lwip_netconn_disconnect
-#define netconn_err lwip_netconn_err
-#define netconn_listen lwip_netconn_listen
-#define netconn_new lwip_netconn_new
-#define netconn_new_with_callback lwip_netconn_new_with_callback
-#define netconn_new_with_proto_and_callback lwip_netconn_new_with_proto_and_callback
-#define netconn_peer lwip_netconn_peer
-#define netconn_recv lwip_netconn_recv
-#define netconn_send lwip_netconn_send
-#define netconn_type lwip_netconn_type
-#define netconn_write lwip_netconn_write
-#define netif_add lwip_netif_add
-#define netif_default lwip_netif_default
-#define netif_find lwip_netif_find
-#define netif_init lwip_netif_init
-#define netif_is_up lwip_netif_is_up
-#define netif_list lwip_netif_list
-#define netif_remove lwip_netif_remove
-#define netif_set_addr lwip_netif_set_addr
-#define netif_set_default lwip_netif_set_default
-#define netif_set_down lwip_netif_set_down
-#define netif_set_gw lwip_netif_set_gw
-#define netif_set_ipaddr lwip_netif_set_ipaddr
-#define netif_set_netmask lwip_netif_set_netmask
-#define netif_set_up lwip_netif_set_up
-#if MEM_LIBC_MALLOC == 0
-#define mem_free lwip_mem_free
-#define mem_init lwip_mem_init
-#define mem_malloc lwip_mem_malloc
-#define mem_realloc lwip_mem_realloc
-#endif
-#define memp_free lwip_memp_free
-#define memp_init lwip_memp_init
-#define memp_malloc lwip_memp_malloc
-#define pbuf_alloc lwip_pbuf_alloc
-#define pbuf_cat lwip_pbuf_cat
-#define pbuf_chain lwip_pbuf_chain
-#define pbuf_clen lwip_pbuf_clen
-#define pbuf_dechain lwip_pbuf_dechain
-#define pbuf_dequeue lwip_pbuf_dequeue
-#define pbuf_free lwip_pbuf_free
-#define pbuf_header lwip_pbuf_header
-#define pbuf_init lwip_pbuf_init
-#define pbuf_queue lwip_pbuf_queue
-#define pbuf_realloc lwip_pbuf_realloc
-#define pbuf_ref lwip_pbuf_ref
-#define pbuf_take lwip_pbuf_take
-#define raw_bind lwip_raw_bind
-#define raw_connect lwip_raw_connect
-#define raw_init lwip_raw_init
-#define raw_input lwip_raw_input
-#define raw_new lwip_raw_new
-#define raw_recv lwip_raw_recv
-#define raw_remove lwip_raw_remove
-#define raw_send lwip_raw_send
-#define raw_sendto lwip_raw_sendto
-#define stats_init lwip_stats_init
-#define sys_arch_mbox_fetch lwip_sys_arch_mbox_fetch
-#define sys_arch_protect lwip_sys_arch_protect
-#define sys_arch_sem_wait lwip_sys_arch_sem_wait
-#define sys_arch_timeouts lwip_sys_arch_timeouts
-#define sys_arch_unprotect lwip_sys_arch_unprotect
-#define sys_init lwip_sys_init
-#define sys_mbox_fetch lwip_sys_mbox_fetch
-#define sys_mbox_free lwip_sys_mbox_free
-#define sys_mbox_new lwip_sys_mbox_new
-#define sys_mbox_post lwip_sys_mbox_post
-#define sys_sem_free lwip_sys_sem_free
-#define sys_sem_new lwip_sys_sem_new
-#define sys_sem_signal lwip_sys_sem_signal
-#define sys_thread_new lwip_sys_thread_new
-#define sys_msleep lwip_sys_msleep
-#define sys_sem_wait lwip_sys_sem_wait
-#define sys_sem_wait_timeout lwip_sys_sem_wait_timeout
-#define sys_timeout lwip_sys_timeout
-#define sys_untimeout lwip_sys_untimeout
-#define tcp_abort lwip_tcp_abort
-#define tcp_accept lwip_tcp_accept
-#define tcp_active_pcbs lwip_tcp_active_pcbs
-#define tcp_alloc lwip_tcp_alloc
-#define tcp_arg lwip_tcp_arg
-#define tcp_backoff lwip_tcp_backoff
-#define tcp_bind lwip_tcp_bind
-#define tcp_close lwip_tcp_close
-#define tcp_connect lwip_tcp_connect
-#define tcp_enqueue lwip_tcp_enqueue
-#define tcp_err lwip_tcp_err
-#define tcp_fasttmr lwip_tcp_fasttmr
-#define tcp_init lwip_tcp_init
-#define tcp_input lwip_tcp_input
-#define tcp_input_pcb lwip_tcp_input_pcb
-#define tcp_keepalive lwip_tcp_keepalive
-#define tcp_listen lwip_tcp_listen
-#define tcp_listen_pcbs lwip_tcp_listen_pcbs
-#define tcp_new lwip_tcp_new
-#define tcp_next_iss lwip_tcp_next_iss
-#define tcp_output lwip_tcp_output
-#define tcp_pcb_purge lwip_tcp_pcb_purge
-#define tcp_pcb_remove lwip_tcp_pcb_remove
-#define tcp_poll lwip_tcp_poll
-#define tcp_recv lwip_tcp_recv
-#define tcp_recved lwip_tcp_recved
-#define tcp_rexmit lwip_tcp_rexmit
-#define tcp_rexmit_rto lwip_tcp_rexmit_rto
-#define tcp_rst lwip_tcp_rst
-#define tcp_seg_copy lwip_tcp_seg_copy
-#define tcp_seg_free lwip_tcp_seg_free
-#define tcp_segs_free lwip_tcp_segs_free
-#define tcp_send_ctrl lwip_tcp_send_ctrl
-#define tcp_sent lwip_tcp_sent
-#define tcp_setprio lwip_tcp_setprio
-#define tcp_slowtmr lwip_tcp_slowtmr
-#define tcp_ticks lwip_tcp_ticks
-#define tcp_timer_needed lwip_tcp_timer_needed
-#define tcp_tmp_pcb lwip_tcp_tmp_pcb
-#define tcp_tmr lwip_tcp_tmr
-#define tcp_tw_pcbs lwip_tcp_tw_pcbs
-#define tcp_write lwip_tcp_write
-#define tcpip_apimsg lwip_tcpip_apimsg
-#define tcpip_callback lwip_tcpip_callback
-#define tcpip_init lwip_tcpip_init
-#define tcpip_input lwip_tcpip_input
-#define udp_bind lwip_udp_bind
-#define udp_connect lwip_udp_connect
-#define udp_disconnect lwip_udp_disconnect
-#define udp_init lwip_udp_init
-#define udp_input lwip_udp_input
-#define udp_new lwip_udp_new
-#define udp_pcbs lwip_udp_pcbs
-#define udp_recv lwip_udp_recv
-#define udp_remove lwip_udp_remove
-#define udp_send lwip_udp_send
-#define udp_sendto lwip_udp_sendto
-
-#endif
diff --git a/src/VBox/Devices/Network/lwip/vbox/sys_arch.c b/src/VBox/Devices/Network/lwip/vbox/sys_arch.c
deleted file mode 100644
index 573b02c..0000000
--- a/src/VBox/Devices/Network/lwip/vbox/sys_arch.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/** $Id: sys_arch.c $ */
-/** @file
- * System dependent parts of lwIP, implemented with IPRT.
- */
-
-/*
- * Copyright (C) 2007-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-
-#include <lwip/sys.h>
-
-#include <iprt/assert.h>
-#include <iprt/err.h>
-#include <iprt/mem.h>
-#include <iprt/string.h>
-#include <iprt/critsect.h>
-#include <iprt/thread.h>
-#include <iprt/time.h>
-
-/** @todo during my tests on Debian Lenny 64 bit I ran into trouble using
- * mutex semaphores (crash deep down in the pthreads lib). Using the write
- * case of rw semaphores also gives mutual exclusion, and didn't show those
- * crashes. Should be investigated, because this "fix" might be just covering
- * the symptoms of a bug elsewhere. */
-#if HC_ARCH_BITS == 64 && defined RT_ARCH_LINUX
-#define LWIPMUTEXTYPE RTSEMRW
-#define LWIPMutexCreate RTSemRWCreate
-#define LWIPMutexDestroy RTSemRWDestroy
-#define LWIPMutexRequest RTSemRWRequestWrite
-#define LWIPMutexRelease RTSemRWReleaseWrite
-#else
-#define LWIPMUTEXTYPE RTSEMMUTEX
-#define LWIPMutexCreate RTSemMutexCreate
-#define LWIPMutexDestroy RTSemMutexDestroy
-#define LWIPMutexRequest RTSemMutexRequest
-#define LWIPMutexRelease RTSemMutexRelease
-#endif
-
-/** Maximum number of threads lwIP is allowed to create. */
-#define THREADS_MAX 5
-
-/** Maximum number of mbox entries needed for reasonable performance. */
-#define MBOX_ENTRIES_MAX 128
-
-/** Data type for slots in TLS. */
-typedef struct
-{
-    RTTHREAD tid;
-    void (* thread)(void *arg);
-    void *arg;
-    struct sys_timeouts timeouts;
-} THREADLOCALSTORAGE;
-
-/** Actual declaration of the mbox type. */
-struct sys_mbox
-{
-    LWIPMUTEXTYPE mutex;
-    RTSEMEVENTMULTI nonempty, nonfull;
-    void *apvEntries[MBOX_ENTRIES_MAX];
-    u32_t head, tail;
-};
-
-#if SYS_LIGHTWEIGHT_PROT
-/** Critical section variable for short term synchronization. */
-static RTCRITSECT g_ProtCritSect;
-#else
-/** Synchronization for thread creation handling. */
-static RTSEMEVENT g_ThreadSem;
-#endif
-
-/** Number of threads currently created by lwIP. */
-static u32_t g_cThreads = 0;
-
-/** The simulated thread local storage for lwIP things. */
-static THREADLOCALSTORAGE g_aTLS[THREADS_MAX];
-
-/**
- * Initialize the port to IPRT.
- */
-void sys_init(void)
-{
-    int rc;
-    unsigned i;
-#if SYS_LIGHTWEIGHT_PROT
-    rc = RTCritSectInit(&g_ProtCritSect);
-    AssertRC(rc);
-#else
-    rc = RTSemEventCreate(&g_ThreadSem);
-    AssertRC(rc);
-    rc = RTSemEventSignal(g_ThreadSem);
-    AssertRC(rc);
-#endif
-    for (i = 0; i < THREADS_MAX; i++)
-        g_aTLS[i].tid = NIL_RTTHREAD;
-}
-
-/**
- * Create a new (binary) semaphore.
- */
-sys_sem_t sys_sem_new(u8_t count)
-{
-    int rc;
-    RTSEMEVENT sem;
-
-    Assert(count <= 1);
-    rc = RTSemEventCreate(&sem);
-    AssertRC(rc);
-    if (count == 1)
-    {
-        rc = RTSemEventSignal(sem);
-        AssertRC(rc);
-    }
-    return sem;
-}
-
-/**
- * Destroy a (binary) semaphore.
- */
-void sys_sem_free(sys_sem_t sem)
-{
-    int rc;
-    rc = RTSemEventDestroy(sem);
-    AssertRC(rc);
-}
-
-/**
- * Signal a (binary) semaphore.
- */
-void sys_sem_signal(sys_sem_t sem)
-{
-    int rc;
-    rc = RTSemEventSignal(sem);
-    AssertRC(rc);
-}
-
-/**
- * Wait for a (binary) semaphore.
- */
-u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout)
-{
-    int rc;
-    RTMSINTERVAL cMillies;
-    uint64_t tsStart, tsEnd;
-
-    tsStart = RTTimeMilliTS();
-    if (timeout == 0)
-        cMillies = RT_INDEFINITE_WAIT;
-    else
-        cMillies = timeout;
-    rc = RTSemEventWait(sem, cMillies);
-    if (rc == VERR_TIMEOUT)
-        return SYS_ARCH_TIMEOUT;
-    AssertRC(rc);
-    tsEnd = RTTimeMilliTS();
-    return tsEnd - tsStart;
-}
-
-/**
- * Create new mbox.
- */
-sys_mbox_t sys_mbox_new(void)
-{
-    int rc;
-    struct sys_mbox *mbox;
-
-    mbox = RTMemAllocZ(sizeof(*mbox));
-    Assert(mbox != NULL);
-    if (!mbox)
-        return mbox;
-    rc = LWIPMutexCreate(&mbox->mutex);
-    AssertRC(rc);
-    if (RT_FAILURE(rc))
-    {
-        RTMemFree(mbox);
-        return NULL;
-    }
-    rc = RTSemEventMultiCreate(&mbox->nonempty);
-    AssertRC(rc);
-    if (RT_FAILURE(rc))
-    {
-        rc = LWIPMutexDestroy(mbox->mutex);
-        AssertRC(rc);
-        RTMemFree(mbox);
-        return NULL;
-    }
-    rc = RTSemEventMultiCreate(&mbox->nonfull);
-    AssertRC(rc);
-    if (RT_FAILURE(rc))
-    {
-        rc = RTSemEventMultiDestroy(mbox->nonempty);
-        AssertRC(rc);
-        rc = LWIPMutexDestroy(mbox->mutex);
-        AssertRC(rc);
-        RTMemFree(mbox);
-        return NULL;
-    }
-    return mbox;
-}
-
-/**
- * Free an mbox.
- */
-void sys_mbox_free(sys_mbox_t mbox)
-{
-    Assert(mbox != NULL);
-    LWIPMutexDestroy(mbox->mutex);
-    RTSemEventMultiDestroy(mbox->nonempty);
-    RTSemEventMultiDestroy(mbox->nonfull);
-    RTMemFree(mbox);
-}
-
-/**
- * Place an entry in an mbox.
- */
-void sys_mbox_post(sys_mbox_t mbox, void *msg)
-{
-    int rc;
-
-    Assert(mbox != NULL);
-    rc = LWIPMutexRequest(mbox->mutex, RT_INDEFINITE_WAIT);
-    AssertRC(rc);
-    while ((mbox->head + 1) % MBOX_ENTRIES_MAX == mbox->tail)
-    {
-        /* mbox is full, have to wait until a slot becomes available. */
-        rc = LWIPMutexRelease(mbox->mutex);
-        AssertRC(rc);
-        rc = RTSemEventMultiWait(mbox->nonfull, RT_INDEFINITE_WAIT);
-        AssertRC(rc);
-        rc = LWIPMutexRequest(mbox->mutex, RT_INDEFINITE_WAIT);
-        AssertRC(rc);
-    }
-    if (mbox->head == mbox->tail)
-    {
-        rc = RTSemEventMultiSignal(mbox->nonempty);
-        AssertRC(rc);
-    }
-    mbox->apvEntries[mbox->head] = msg;
-    mbox->head++;
-    mbox->head %= MBOX_ENTRIES_MAX;
-    if ((mbox->head + 1) % MBOX_ENTRIES_MAX == mbox->tail)
-    {
-        rc = RTSemEventMultiReset(mbox->nonfull);
-        AssertRC(rc);
-    }
-    rc = LWIPMutexRelease(mbox->mutex);
-    AssertRC(rc);
-}
-
-/**
- * Get an entry from an mbox.
- */
-u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout)
-{
-    int rc;
-    RTMSINTERVAL cMillies;
-    uint64_t tsStart, tsEnd;
-
-    Assert(mbox != NULL);
-    tsStart = RTTimeMilliTS();
-    if (timeout == 0)
-        cMillies = RT_INDEFINITE_WAIT;
-    else
-        cMillies = timeout;
-    rc = LWIPMutexRequest(mbox->mutex, cMillies);
-    if (rc == VERR_TIMEOUT)
-        return SYS_ARCH_TIMEOUT;
-    AssertRC(rc);
-    while (mbox->head == mbox->tail)
-    {
-        /* mbox is empty, have to wait until a slot is filled. */
-        rc = LWIPMutexRelease(mbox->mutex);
-        AssertRC(rc);
-        if (timeout != 0)
-        {
-            tsEnd = RTTimeMilliTS();
-            if (tsEnd - tsStart >= cMillies)
-                return SYS_ARCH_TIMEOUT;
-            cMillies -= tsEnd - tsStart;
-        }
-        rc = RTSemEventMultiWait(mbox->nonempty, cMillies);
-        if (rc == VERR_TIMEOUT)
-            return SYS_ARCH_TIMEOUT;
-        AssertRC(rc);
-        if (timeout != 0)
-        {
-            tsEnd = RTTimeMilliTS();
-            if (tsEnd - tsStart >= cMillies)
-                return SYS_ARCH_TIMEOUT;
-            cMillies -= tsEnd - tsStart;
-        }
-        rc = LWIPMutexRequest(mbox->mutex, cMillies);
-        if (rc == VERR_TIMEOUT)
-            return SYS_ARCH_TIMEOUT;
-        AssertRC(rc);
-    }
-    if ((mbox->head + 1) % MBOX_ENTRIES_MAX == mbox->tail)
-    {
-        rc = RTSemEventMultiSignal(mbox->nonfull);
-        AssertRC(rc);
-    }
-    if (msg != NULL)
-        *msg = mbox->apvEntries[mbox->tail];
-    mbox->tail++;
-    mbox->tail %= MBOX_ENTRIES_MAX;
-    rc = RTSemEventMultiSignal(mbox->nonfull);
-    if (mbox->head == mbox->tail)
-    {
-        rc = RTSemEventMultiReset(mbox->nonempty);
-        AssertRC(rc);
-    }
-    rc = LWIPMutexRelease(mbox->mutex);
-    AssertRC(rc);
-    tsEnd = RTTimeMilliTS();
-    return tsEnd - tsStart;
-}
-
-/**
- * Grab the pointer to this thread's timeouts from TLS.
- */
-struct sys_timeouts *sys_arch_timeouts(void)
-{
-    unsigned i;
-#if SYS_LIGHTWEIGHT_PROT
-    SYS_ARCH_DECL_PROTECT(old_level);
-#endif
-    RTTHREAD myself;
-    struct sys_timeouts *to = NULL;
-
-    myself = RTThreadSelf();
-#if SYS_LIGHTWEIGHT_PROT
-    SYS_ARCH_PROTECT(old_level);
-#else
-    RTSemEventWait(g_ThreadSem, RT_INDEFINITE_WAIT);
-#endif
-    for (i = 0; i < g_cThreads; i++)
-    {
-        if (g_aTLS[i].tid == myself)
-        {
-            to = &g_aTLS[i].timeouts;
-            break;
-        }
-    }
-    /* Auto-adopt new threads which use lwIP as they pop up. */
-    if (!to)
-    {
-        unsigned id;
-        id = g_cThreads;
-        g_cThreads++;
-        Assert(g_cThreads <= THREADS_MAX);
-        g_aTLS[id].tid = myself;
-        to = &g_aTLS[id].timeouts;
-    }
-#if SYS_LIGHTWEIGHT_PROT
-    SYS_ARCH_UNPROTECT(old_level);
-#else
-    RTSemEventSignal(g_ThreadSem);
-#endif
-    return to;
-}
-
-/**
- * Internal: thread main function adapter, dropping the first parameter. Needed
- * to make lwip thread main function compatible with IPRT thread main function.
- */
-static int sys_thread_adapter(RTTHREAD ThreadSelf, void *pvUser)
-{
-    THREADLOCALSTORAGE *tls = (THREADLOCALSTORAGE *)pvUser;
-    tls->thread(tls->arg);
-    return 0;
-}
-
-/**
- * Create new thread.
- */
-sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio)
-{
-    int rc;
-#if SYS_LIGHTWEIGHT_PROT
-    SYS_ARCH_DECL_PROTECT(old_level);
-#endif
-    unsigned id;
-    RTTHREAD tid;
-
-#if SYS_LIGHTWEIGHT_PROT
-    SYS_ARCH_PROTECT(old_level);
-#else
-    RTSemEventWait(g_ThreadSem, RT_INDEFINITE_WAIT);
-#endif
-    id = g_cThreads;
-    g_cThreads++;
-    Assert(g_cThreads <= THREADS_MAX);
-    g_aTLS[id].thread = thread;
-    g_aTLS[id].arg = arg;
-    rc = RTThreadCreateF(&tid, sys_thread_adapter, &g_aTLS[id], 0,
-                         RTTHREADTYPE_IO, 0, "lwIP%u", id);
-    if (RT_FAILURE(rc))
-    {
-        g_cThreads--;
-        tid = NIL_RTTHREAD;
-    }
-    else
-        g_aTLS[id].tid = tid;
-#if SYS_LIGHTWEIGHT_PROT
-    SYS_ARCH_UNPROTECT(old_level);
-#else
-    RTSemEventSignal(g_ThreadSem);
-#endif
-    AssertRC(rc);
-    return tid;
-}
-
-#if SYS_LIGHTWEIGHT_PROT
-/**
- * Start a short critical section.
- */
-sys_prot_t sys_arch_protect(void)
-{
-    int rc;
-    rc = RTCritSectEnter(&g_ProtCritSect);
-    AssertRC(rc);
-    return NULL;
-}
-#endif
-
-#if SYS_LIGHTWEIGHT_PROT
-/**
- * End a short critical section.
- */
-void sys_arch_unprotect(sys_prot_t pval)
-{
-    int rc;
-    (void)pval;
-    rc = RTCritSectLeave(&g_ProtCritSect);
-    AssertRC(rc);
-}
-#endif
diff --git a/src/VBox/Devices/Network/lwipopts.h b/src/VBox/Devices/Network/lwipopts.h
index bc71931..4521c53 100644
--- a/src/VBox/Devices/Network/lwipopts.h
+++ b/src/VBox/Devices/Network/lwipopts.h
@@ -100,7 +100,7 @@
 
 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
    Use default that is based on TCP_MSS and PBUF_LINK_HLEN.  */
-#undef PBUF_POOL_BUFSIZE  
+#undef PBUF_POOL_BUFSIZE
 
 /** Turn on support for lightweight critical region protection. Leaving this
  * off uses synchronization code in pbuf.c which is totally polluted with
@@ -128,17 +128,17 @@
 
 #define LWIP_ND6_ALLOW_RA_UPDATES       (!LWIP_IPV6_FORWARD)
 #define LWIP_IPV6_SEND_ROUTER_SOLICIT   (!LWIP_IPV6_FORWARD)
-/* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases 
+/* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases
  * iSCSI over intnet with IPv6
  */
-#define LWIP_IPV6_AUTOCONFIG            1 
+#define LWIP_IPV6_AUTOCONFIG            1
 #if LWIP_IPV6_FORWARD /* otherwise use the default from lwip/opt.h */
 #define LWIP_IPV6_DUP_DETECT_ATTEMPTS   0
 #endif
 
 #define LWIP_IPV6_FRAG                  1
 
-/** 
+/**
  * aka Slirp mode.
  */
 #define LWIP_CONNECTION_PROXY 0
diff --git a/src/VBox/Devices/Network/scripts/VBoxPortForwarding.py b/src/VBox/Devices/Network/scripts/VBoxPortForwarding.py
index b27bfaa..be4edf2 100755
--- a/src/VBox/Devices/Network/scripts/VBoxPortForwarding.py
+++ b/src/VBox/Devices/Network/scripts/VBoxPortForwarding.py
@@ -22,12 +22,12 @@ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 # > VBoxManage setextradata "winXP"
 #        "VBoxInternal/Devices/pcnet/0/LUN#0/Config/www/GuestPort" 80
 # > VBoxManage setextradata "winXP"
-#        "VBoxInternal/Devices/pcnet/0/LUN#0/Config/www/HostPort" 8080 
+#        "VBoxInternal/Devices/pcnet/0/LUN#0/Config/www/HostPort" 8080
 ################################################################################
 
 import os,sys
 from vboxapi import VirtualBoxManager
-import optparse 
+import optparse
 
 class OptionParser (optparse.OptionParser):
     def check_required(self, opt):
@@ -40,7 +40,7 @@ class OptionParser (optparse.OptionParser):
 
 def generate_profile_name(proto, host_port, guest_port):
     return proto + '_' + str(host_port) + '_' + str(guest_port)
- 
+
 def main(argv):
 
     usage = "usage: %prog --vm winXP -a 1 -p TCP -l 8080 -g 80 -P www"
@@ -58,7 +58,7 @@ def main(argv):
     parser.add_option("-a", "--adapter", dest="adapter", type="int",
                      default=-1)
     (options,args) = parser.parse_args(argv)
-    
+
     if (not (parser.check_required("-V") or parser.check_required("-G"))):
         parser.error("please define --vm or --guid option")
     if (not parser.check_required("-p")):
@@ -83,7 +83,7 @@ def main(argv):
             vm = vb.getMachine(options.vmname)
     except:
         print "can't find VM by name or UID:",options.vmname
-        del man 
+        del man
         return
 
     print "vm found: %s [%s]" % (vm.name, vm.id)
@@ -92,16 +92,16 @@ def main(argv):
     vm = session.machine
 
     adapter = vm.getNetworkAdapter(options.adapter)
-    
+
     if adapter.enabled == False:
-        print "adapter(%d) is disabled" % adapter.slot    
+        print "adapter(%d) is disabled" % adapter.slot
         del man
         return
 
     name = None
     if (adapter.adapterType == man.constants.NetworkAdapterType_Null):
         print "none adapter type detected"
-        return -1 
+        return -1
     elif (adapter.adapterType == man.constants.NetworkAdapterType_Am79C970A):
         name = "pcnet"
     elif (adapter.adapterType == man.constants.NetworkAdapterType_Am79C973):
@@ -113,15 +113,15 @@ def main(argv):
     elif (adapter.adapterType == man.constants.NetworkAdapterType_I82543GC):
         name = "e1000"
     print "adapter of '%s' type has been detected" % name
-    
+
     profile_name = options.profile
     if profile_name == None:
-        profile_name = generate_profile_name(options.proto.upper(), 
-                                            options.host_port, 
+        profile_name = generate_profile_name(options.proto.upper(),
+                                            options.host_port,
                                             options.guest_port)
     config = "VBoxInternal/Devices/" + name + "/"
     config = config + str(adapter.slot)  +"/LUN#0/Config/" + profile_name
-    proto = config + "/Protocol" 
+    proto = config + "/Protocol"
     host_port = config + "/HostPort"
     guest_port = config + "/GuestPort"
 
diff --git a/src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h b/src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h
index 57c5f57..ca576d2 100644
--- a/src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h
+++ b/src/VBox/Devices/Network/slirp/bsd/sys/mbuf.h
@@ -60,7 +60,7 @@ DECLNORETURN(static void) panic (char *fmt, ...)
     AssertFatalFailed();
 }
 /* for non-gnu compilers */
-# define __func__ __FUNCTION__
+# define __func__ RT_GCC_EXTENSION __FUNCTION__
 # ifndef __inline
 #  define __inline
 # endif
diff --git a/src/VBox/Devices/Network/slirp/debug.c b/src/VBox/Devices/Network/slirp/debug.c
index fd77c97..0a78ba0 100644
--- a/src/VBox/Devices/Network/slirp/debug.c
+++ b/src/VBox/Devices/Network/slirp/debug.c
@@ -301,17 +301,17 @@ printSocket(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
                 "socket(%d)", so->s);
 
     cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
-            "socket %d:(proto:%u) exp. in %d "
+            "socket %d:(proto:%u) exp. in %d"
             " state=%R[natsockstate]"
-            " fUnderPolling:%RTbool"
-            " fShouldBeRemoved:%RTbool"
+            "%s" /* fUnderPolling */
+            "%s" /* fShouldBeRemoved */
             " f_(addr:port)=%RTnaipv4:%d"
             " l_(addr:port)=%RTnaipv4:%d",
             so->s, so->so_type,
             so->so_expire ? so->so_expire - curtime : 0,
             so->so_state,
-            so->fUnderPolling,
-            so->fShouldBeRemoved,
+            so->fUnderPolling ? " fUnderPolling" : "",
+            so->fShouldBeRemoved ? " fShouldBeRemoved" : "",
             so->so_faddr.s_addr,
             RT_N2H_U16(so->so_fport),
             so->so_laddr.s_addr,
diff --git a/src/VBox/Devices/Network/slirp/ip_icmp.c b/src/VBox/Devices/Network/slirp/ip_icmp.c
index f73b226..b9bafd5 100644
--- a/src/VBox/Devices/Network/slirp/ip_icmp.c
+++ b/src/VBox/Devices/Network/slirp/ip_icmp.c
@@ -89,7 +89,6 @@ static const int icmp_flush[19] =
 /* ADDR MASK REPLY (18) */   0
 };
 
-static void icmp_cache_clean(PNATState pData, int iEntries);
 
 int
 icmp_init(PNATState pData, int iIcmpCacheLimit)
@@ -98,6 +97,8 @@ icmp_init(PNATState pData, int iIcmpCacheLimit)
     pData->icmp_socket.so_state = SS_ISFCONNECTED;
 
 #ifndef RT_OS_WINDOWS
+    TAILQ_INIT(&pData->icmp_msg_head);
+
     if (iIcmpCacheLimit < 0)
     {
         LogRel(("NAT: iIcmpCacheLimit is invalid %d, will be alter to default value 100\n", iIcmpCacheLimit));
@@ -128,9 +129,6 @@ icmp_init(PNATState pData, int iIcmpCacheLimit)
     }
     fd_nonblock(pData->icmp_socket.s);
     NSOCK_INC();
-
-    LIST_INIT(&pData->icmp_msg_head);
-
 #else /* RT_OS_WINDOWS */
     if (icmpwin_init(pData) != 0)
         return 1;
@@ -148,12 +146,111 @@ icmp_finit(PNATState pData)
 #ifdef RT_OS_WINDOWS
     icmpwin_finit(pData);
 #else
-    icmp_cache_clean(pData, -1);
+    while (!TAILQ_EMPTY(&pData->icmp_msg_head))
+    {
+        struct icmp_msg *icm = TAILQ_FIRST(&pData->icmp_msg_head);
+        icmp_msg_delete(pData, icm);
+    }
     closesocket(pData->icmp_socket.s);
 #endif
 }
 
+
 #if !defined(RT_OS_WINDOWS)
+static struct icmp_msg *
+icmp_msg_alloc(PNATState pData)
+{
+    struct icmp_msg *icm;
+
+#ifdef DEBUG
+    {
+        int iTally = 0;
+        TAILQ_FOREACH(icm, &pData->icmp_msg_head, im_queue)
+            ++iTally;
+        Assert(pData->cIcmpCacheSize == iTally);
+    }
+#endif
+
+    if (pData->cIcmpCacheSize >= pData->iIcmpCacheLimit)
+    {
+        int cTargetCacheSize = pData->iIcmpCacheLimit/2;
+
+        while (pData->cIcmpCacheSize > cTargetCacheSize)
+        {
+            icm = TAILQ_FIRST(&pData->icmp_msg_head);
+            icmp_msg_delete(pData, icm);
+        }
+    }
+
+    icm = RTMemAlloc(sizeof(struct icmp_msg));
+    if (RT_UNLIKELY(icm == NULL))
+        return NULL;
+
+    TAILQ_INSERT_TAIL(&pData->icmp_msg_head, icm, im_queue);
+    pData->cIcmpCacheSize++;
+
+    return icm;
+}
+
+
+static void
+icmp_attach(PNATState pData, struct mbuf *m)
+{
+    struct icmp_msg *icm;
+
+#ifdef DEBUG
+    {
+        /* only used for ping */
+        struct ip *ip = mtod(m, struct ip *);
+        Assert(ip->ip_p == IPPROTO_ICMP);
+    }
+#endif
+
+    icm = icmp_msg_alloc(pData);
+    if (RT_UNLIKELY(icm == NULL))
+        return;
+
+    icm->im_so = &pData->icmp_socket;
+    icm->im_m = m;
+}
+
+
+void
+icmp_msg_delete(PNATState pData, struct icmp_msg *icm)
+{
+    if (RT_UNLIKELY(icm == NULL))
+        return;
+
+#ifdef DEBUG
+    {
+        struct icmp_msg *existing;
+        int iTally = 0;
+
+        TAILQ_FOREACH(existing, &pData->icmp_msg_head, im_queue)
+            ++iTally;
+        Assert(pData->cIcmpCacheSize == iTally);
+
+        Assert(pData->cIcmpCacheSize > 0);
+        TAILQ_FOREACH(existing, &pData->icmp_msg_head, im_queue)
+        {
+            if (existing == icm)
+                break;
+        }
+        Assert(existing != NULL);
+    }
+#endif
+
+    TAILQ_REMOVE(&pData->icmp_msg_head, icm, im_queue);
+    pData->cIcmpCacheSize--;
+
+    icm->im_so->so_m = NULL;
+    if (icm->im_m != NULL)
+        m_freem(pData, icm->im_m);
+
+    RTMemFree(icm);
+}
+
+
 /*
  * ip here is ip header + 64bytes readed from ICMP packet
  */
@@ -184,7 +281,7 @@ icmp_find_original_mbuf(PNATState pData, struct ip *ip)
     {
         case IPPROTO_ICMP:
             icp = (struct icmp *)((char *)ip + (ip->ip_hl << 2));
-            LIST_FOREACH(icm, &pData->icmp_msg_head, im_list)
+            TAILQ_FOREACH(icm, &pData->icmp_msg_head, im_queue)
             {
                 m0 = icm->im_m;
                 ip0 = mtod(m0, struct ip *);
@@ -249,7 +346,7 @@ icmp_find_original_mbuf(PNATState pData, struct ip *ip)
             {
                 found = 1;
                 so = last_socket;
-                goto sofound;
+                break;
             }
             for (so = head_socket->so_prev; so != head_socket; so = so->so_prev)
             {
@@ -268,92 +365,58 @@ icmp_find_original_mbuf(PNATState pData, struct ip *ip)
         default:
             Log(("NAT:ICMP: unsupported protocol(%d)\n", ip->ip_p));
     }
-    sofound:
-    if (found == 1 && icm == NULL)
+
+#ifdef DEBUG
+    if (found)
+        Assert((icm != NULL) ^ (so != NULL));
+#endif
+
+    if (found && icm == NULL)
     {
+        /*
+         * XXX: Implies this is not a pong, found socket.  This is, of
+         * course, wasteful since the caller will delete icmp_msg
+         * immediately after processing, so there's not much reason to
+         * clutter up the queue with it.
+         */
+        AssertReturn(so != NULL, NULL);
+
+        /*
+         * XXX: FIXME: If the very first send(2) fails, the socket is
+         * still in SS_NOFDREF and so we will not report this too.
+         */
         if (so->so_state == SS_NOFDREF)
         {
-            /* socket is shutdowning we've already sent ICMP on it.*/
-            Log(("NAT: Received icmp on shutdowning socket (probably corresponding ICMP socket has been already sent)\n"));
+            /* socket is shutting down we've already sent ICMP on it. */
+            Log(("NAT:ICMP: disconnected %R[natsock]\n", so));
+            LogFlowFunc(("LEAVE: icm:NULL\n"));
             return NULL;
         }
-        icm = RTMemAlloc(sizeof(struct icmp_msg));
-        icm->im_m = so->so_m;
-        icm->im_so = so;
-        found = 1;
-        Log(("hit:%R[natsock]\n", so));
-        /*XXX: this storage not very long,
-         * better add flag if it should removed from lis
-         */
-        LIST_INSERT_HEAD(&pData->icmp_msg_head, icm, im_list);
-        pData->cIcmpCacheSize++;
-        if (pData->cIcmpCacheSize > pData->iIcmpCacheLimit)
-            icmp_cache_clean(pData, pData->iIcmpCacheLimit/2);
-        LogFlowFunc(("LEAVE: icm:%p\n", icm));
-        return (icm);
-    }
-    if (found == 1)
-    {
-        LogFlowFunc(("LEAVE: icm:%p\n", icm));
-        return icm;
-    }
 
-    LogFlowFunc(("LEAVE: NULL\n"));
-    return NULL;
-}
-
-/**
- * iEntries how many entries to leave, if iEntries < 0, clean all
- */
-static void icmp_cache_clean(PNATState pData, int iEntries)
-{
-    int iIcmpCount = 0;
-    struct icmp_msg *icm = NULL;
-    LogFlowFunc(("iEntries:%d\n", iEntries));
-    if (iEntries > pData->cIcmpCacheSize)
-    {
-        LogFlowFuncLeave();
-        return;
-    }
-    while(!LIST_EMPTY(&pData->icmp_msg_head))
-    {
-        icm = LIST_FIRST(&pData->icmp_msg_head);
-        if (    iEntries > 0
-            &&  iIcmpCount < iEntries)
+        if (so->so_m == NULL)
         {
-            iIcmpCount++;
-            continue;
+            Log(("NAT:ICMP: no saved mbuf for %R[natsock]\n", so));
+            LogFlowFunc(("LEAVE: icm:NULL\n"));
+            return NULL;
         }
 
-        LIST_REMOVE(icm, im_list);
-        if (icm->im_m)
+        icm = icmp_msg_alloc(pData);
+        if (RT_UNLIKELY(icm == NULL))
         {
-            pData->cIcmpCacheSize--;
-            m_freem(pData, icm->im_m);
+            LogFlowFunc(("LEAVE: icm:NULL\n"));
+            return NULL;
         }
-        RTMemFree(icm);
-    }
-    LogFlowFuncLeave();
-}
 
-static int
-icmp_attach(PNATState pData, struct mbuf *m)
-{
-    struct icmp_msg *icm;
-    struct ip *ip;
-    ip = mtod(m, struct ip *);
-    Assert(ip->ip_p == IPPROTO_ICMP);
-    icm = RTMemAlloc(sizeof(struct icmp_msg));
-    icm->im_m = m;
-    icm->im_so = m->m_so;
-    LIST_INSERT_HEAD(&pData->icmp_msg_head, icm, im_list);
-    pData->cIcmpCacheSize++;
-    if (pData->cIcmpCacheSize > pData->iIcmpCacheLimit)
-        icmp_cache_clean(pData, pData->iIcmpCacheLimit/2);
-    return 0;
+        Log(("NAT:ICMP: for %R[natsock]\n", so));
+        icm->im_so = so;
+        icm->im_m = so->so_m;
+    }
+    LogFlowFunc(("LEAVE: icm:%p\n", icm));
+    return icm;
 }
 #endif /* !RT_OS_WINDOWS */
 
+
 /*
  * Process a received ICMP message.
  */
@@ -479,7 +542,6 @@ icmp_input(PNATState pData, struct mbuf *m, int hlen)
                               (struct sockaddr *)&addr, sizeof(addr));
                     if (rc >= 0)
                     {
-                        m->m_so = &pData->icmp_socket;
                         icmp_attach(pData, m);
                         /* don't let m_freem at the end free atached buffer */
                         goto done;
diff --git a/src/VBox/Devices/Network/slirp/ip_icmp.h b/src/VBox/Devices/Network/slirp/ip_icmp.h
index 0bec0ec..6922b77 100644
--- a/src/VBox/Devices/Network/slirp/ip_icmp.h
+++ b/src/VBox/Devices/Network/slirp/ip_icmp.h
@@ -191,16 +191,17 @@ void icmp_reflect (PNATState, struct mbuf *);
 
 struct icmp_msg
 {
-    LIST_ENTRY(icmp_msg) im_list;
+    TAILQ_ENTRY(icmp_msg) im_queue;
     struct mbuf *im_m;
     struct socket *im_so;
 };
 
-LIST_HEAD(icmp_storage, icmp_msg);
+TAILQ_HEAD(icmp_storage, icmp_msg);
 
 int icmp_init (PNATState , int);
 void icmp_finit (PNATState );
 struct icmp_msg * icmp_find_original_mbuf (PNATState , struct ip *);
+void icmp_msg_delete(PNATState, struct icmp_msg *);
 
 #ifdef RT_OS_WINDOWS
 /* Windows ICMP API code in ip_icmpwin.c */
diff --git a/src/VBox/Devices/Network/slirp/libalias/alias_mod.c b/src/VBox/Devices/Network/slirp/libalias/alias_mod.c
index 76ca009..4423bc3 100644
--- a/src/VBox/Devices/Network/slirp/libalias/alias_mod.c
+++ b/src/VBox/Devices/Network/slirp/libalias/alias_mod.c
@@ -114,10 +114,26 @@ _handler_chain_destroy(void)
 
 #else /* VBOX */
 # define LIBALIAS_WLOCK_ASSERT() ;
-# define LIBALIAS_RLOCK() ;
-# define LIBALIAS_RUNLOCK() ;
-# define LIBALIAS_WLOCK() ;
-# define LIBALIAS_WUNLOCK() ;
+# define LIBALIAS_RLOCK() \
+    do { \
+        int rc = RTCritSectRwEnterShared(&pData->CsRwHandlerChain); \
+        AssertRC(rc); \
+    } while (0)
+# define LIBALIAS_RUNLOCK() \
+    do { \
+        int rc = RTCritSectRwLeaveShared(&pData->CsRwHandlerChain); \
+        AssertRC(rc); \
+    } while (0)
+# define LIBALIAS_WLOCK() \
+    do { \
+        int rc = RTCritSectRwEnterExcl(&pData->CsRwHandlerChain); \
+        AssertRC(rc); \
+    } while (0)
+# define LIBALIAS_WUNLOCK() \
+    do { \
+        int rc = RTCritSectRwLeaveExcl(&pData->CsRwHandlerChain); \
+        AssertRC(rc); \
+    } while (0)
 # define _handler_chain_init() ;
 # define _handler_chain_destroy() ;
 #endif
diff --git a/src/VBox/Devices/Network/slirp/resolv_conf_parser.c b/src/VBox/Devices/Network/slirp/resolv_conf_parser.c
index 647d705..91c71e0 100644
--- a/src/VBox/Devices/Network/slirp/resolv_conf_parser.c
+++ b/src/VBox/Devices/Network/slirp/resolv_conf_parser.c
@@ -22,6 +22,10 @@
 #include <iprt/stream.h>
 #include <iprt/thread.h>
 
+#ifdef RT_OS_FREEBSD
+# include <sys/socket.h>
+#endif
+
 #include <arpa/inet.h>
 
 #include <ctype.h>
diff --git a/src/VBox/Devices/Network/slirp/sbuf.c b/src/VBox/Devices/Network/slirp/sbuf.c
index 8f94d37..7801836 100644
--- a/src/VBox/Devices/Network/slirp/sbuf.c
+++ b/src/VBox/Devices/Network/slirp/sbuf.c
@@ -25,7 +25,6 @@
  */
 
 #include <slirp.h>
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
 
 /* Done as a macro in socket.h */
 /* int
@@ -281,84 +280,3 @@ sbcopy(struct sbuf *sb, int off, int len, char *to)
             memcpy(to+off, sb->sb_data, len);
     }
 }
-#else /* VBOX_WITH_SLIRP_BSD_SBUF */
-void
-sbappend (PNATState pData, struct socket *so, struct mbuf *m)
-{
-    int ret = 0;
-    int mlen = 0;
-    caddr_t buf = NULL;
-
-    STAM_PROFILE_START(&pData->StatIOSBAppend_pf, a);
-    LogFlow(("sbappend: so = %R[natsock], m = %lx, m->m_len = %d\n", so, (long)m, m ? m->m_len : 0));
-
-    STAM_COUNTER_INC(&pData->StatIOSBAppend);
-    mlen = m_length(m, NULL);
-    if (mlen <= 0)
-    {
-        STAM_COUNTER_INC(&pData->StatIOSBAppend_zm);
-        goto done;
-    }
-
-    /*
-     * We only write if there's nothing in the buffer,
-     * ottherwise it'll arrive out of order, and hence corrupt
-     */
-    buf = RTMemAlloc(mlen);
-    if (buf == NULL)
-    {
-        ret = 0;
-        goto no_sent;
-    }
-    m_copydata(m, 0, mlen, buf);
-
-    /*
-     * If there is urgent data, call sosendoob
-     * if not all was sent, sowrite will take care of the rest
-     * (The rest of this function is just an optimisation)
-     */
-    if (so->so_urgc)
-    {
-        sbuf_bcpy(&so->so_rcv, buf, mlen);
-        RTMemFree(buf);
-        m_free(pData, m);
-        sosendoob(so);
-        return;
-    }
-
-    if(!sbuf_len(&so->so_rcv))
-        ret = send(so->s, buf, mlen, 0);
-no_sent:
-
-    if (ret <= 0)
-    {
-        STAM_COUNTER_INC(&pData->StatIOSBAppend_wf);
-        /*
-         * Nothing was written
-         * It's possible that the socket has closed, but
-         * we don't need to check because if it has closed,
-         * it will be detected in the normal way by soread()
-         */
-        sbuf_bcpy(&so->so_rcv, buf, mlen);
-        STAM_PROFILE_STOP(&pData->StatIOSBAppend_pf_wf, a);
-        goto done;
-    }
-    else if (ret != mlen)
-    {
-        STAM_COUNTER_INC(&pData->StatIOSBAppend_wp);
-        /*
-         * Something was written, but not everything..
-         * sbappendsb the rest
-         */
-        sbuf_bcpy(&so->so_rcv, &buf[ret + 1], mlen - ret);
-        STAM_PROFILE_STOP(&pData->StatIOSBAppend_pf_wp, a);
-        goto done;
-    } /* else */
-    /* Whatever happened, we free the mbuf */
-    STAM_COUNTER_INC(&pData->StatIOSBAppend_wa);
-    STAM_PROFILE_STOP(&pData->StatIOSBAppend_pf_wa, a);
-done:
-    RTMemFree(buf);
-    m_freem(pData, m);
-}
-#endif
diff --git a/src/VBox/Devices/Network/slirp/sbuf.h b/src/VBox/Devices/Network/slirp/sbuf.h
index 9035d33..ed1dc7a 100644
--- a/src/VBox/Devices/Network/slirp/sbuf.h
+++ b/src/VBox/Devices/Network/slirp/sbuf.h
@@ -27,7 +27,6 @@
 #ifndef _SBUF_H_
 #define _SBUF_H_
 
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
 # define sbflush(sb) sbdrop((sb),(sb)->sb_cc)
 # define sbspace(sb) ((sb)->sb_datalen - (sb)->sb_cc)
 # define SBUF_LEN(sb) ((sb)->sb_cc)
@@ -51,13 +50,4 @@ void sbreserve (PNATState, struct sbuf *, int);
 void sbappend (PNATState, struct socket *, struct mbuf *);
 void sbappendsb (PNATState, struct sbuf *, struct mbuf *);
 void sbcopy (struct sbuf *, int, int, char *);
-#else
-void sbappend (PNATState, struct socket *, struct mbuf *);
-# include "bsd/sys/sbuf.h"
-# define SBUF_LEN(sb) (sbuf_len(sb))
-/* XXX: @todo SBUF_SIZE is a hack both space and SIZE shouldn't be used out of subr_sbuf.c*/
-# define SBUF_SIZE(sb) ((sb)->s_size)
-/* see subr_sbuf.c to verify the formula */
-# define sbspace(sb) (SBUF_SIZE(sb) - SBUF_LEN((sb)) - 1)
-#endif
 #endif
diff --git a/src/VBox/Devices/Network/slirp/slirp.c b/src/VBox/Devices/Network/slirp/slirp.c
index 26f8a4c..b37b92e 100644
--- a/src/VBox/Devices/Network/slirp/slirp.c
+++ b/src/VBox/Devices/Network/slirp/slirp.c
@@ -316,6 +316,10 @@ int slirp_init(PNATState *ppData, uint32_t u32NetAddr, uint32_t u32Netmask,
     pData->pvUser = pvUser;
     pData->netmask = u32Netmask;
 
+    rc = RTCritSectRwInit(&pData->CsRwHandlerChain);
+    if (RT_FAILURE(rc))
+        return rc;
+
     /* sockets & TCP defaults */
     pData->socket_rcv = 64 * _1K;
     pData->socket_snd = 64 * _1K;
@@ -490,8 +494,7 @@ void slirp_link_down(PNATState pData)
     if (link_up == 0)
         return;
 
-    if (!pData->fUseHostResolverPermanent)
-        slirpReleaseDnsSettings(pData);
+    slirpReleaseDnsSettings(pData);
 
     while ((so = tcb.so_next) != &tcb)
     {
@@ -529,9 +532,6 @@ void slirp_term(PNATState pData)
         return;
     icmp_finit(pData);
 
-    /* Signal to slirp_link_down() to release DNS data. */
-    pData->fUseHostResolverPermanent = 0;
-
     slirp_link_down(pData);
     ftp_alias_unload(pData);
     nbt_alias_unload(pData);
@@ -566,7 +566,6 @@ void slirp_term(PNATState pData)
 #ifdef RT_OS_WINDOWS
     WSACleanup();
 #endif
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
 #ifdef LOG_ENABLED
     Log(("\n"
          "NAT statistics\n"
@@ -582,7 +581,7 @@ void slirp_term(PNATState pData)
          "\n"
          "\n"));
 #endif
-#endif
+    RTCritSectRwDelete(&pData->CsRwHandlerChain);
     RTMemFree(pData);
 }
 
@@ -1350,7 +1349,7 @@ static void arp_input(PNATState pData, struct mbuf *m)
                 if (!fGratuitousArpReported)
                 {
                     LogRel(("NAT: Gratuitous ARP [IP:%RTnaipv4, ether:%RTmac]\n",
-                            pARPHeader->ar_sip, pARPHeader->ar_sha));
+                            *(uint32_t *)pARPHeader->ar_sip, pARPHeader->ar_sha));
                     fGratuitousArpReported = true;
                 }
                 slirp_arp_cache_update_or_add(pData, *(uint32_t *)pARPHeader->ar_sip, &pARPHeader->ar_sha[0]);
diff --git a/src/VBox/Devices/Network/slirp/slirp_dns.c b/src/VBox/Devices/Network/slirp/slirp_dns.c
index d82bda9..626a1d4 100644
--- a/src/VBox/Devices/Network/slirp/slirp_dns.c
+++ b/src/VBox/Devices/Network/slirp/slirp_dns.c
@@ -217,7 +217,7 @@ static int get_dns_addr_domain(PNATState pData, const char **ppszDomain)
         }
 
         pDomain->dd_pszDomain = RTStrDup(st.rcps_domain);
-        LogRel(("NAT: adding domain name %s\n", pDomain->dd_pszDomain));
+        LogRel(("NAT: Adding domain name %s\n", pDomain->dd_pszDomain));
         LIST_INSERT_HEAD(&pData->pDomainList, pDomain, dd_list);
     }
 
diff --git a/src/VBox/Devices/Network/slirp/slirp_state.h b/src/VBox/Devices/Network/slirp/slirp_state.h
index aca62d2..20abf65 100644
--- a/src/VBox/Devices/Network/slirp/slirp_state.h
+++ b/src/VBox/Devices/Network/slirp/slirp_state.h
@@ -295,6 +295,8 @@ typedef struct NATState
     int    i32AliasMode;
     struct libalias *proxy_alias;
     LIST_HEAD(handler_chain, proto_handler) handler_chain;
+    /** Critical R/W section to protect the handler chain list. */
+    RTCRITSECTRW CsRwHandlerChain;
     struct port_forward_rule_list port_forward_rule_head;
     int cRedirectionsActive;
     int cRedirectionsStored;
diff --git a/src/VBox/Devices/Network/slirp/socket.c b/src/VBox/Devices/Network/slirp/socket.c
index 1ef0aca..a383442 100644
--- a/src/VBox/Devices/Network/slirp/socket.c
+++ b/src/VBox/Devices/Network/slirp/socket.c
@@ -235,7 +235,6 @@ sofree(PNATState pData, struct socket *so)
  * NOTE: This will only be called if it is select()ed for reading, so
  * a read() of 0 (or less) means it's disconnected
  */
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
 int
 soread(PNATState pData, struct socket *so)
 {
@@ -423,83 +422,6 @@ soread(PNATState pData, struct socket *so)
     SOCKET_UNLOCK(so);
     return nn;
 }
-#else /* VBOX_WITH_SLIRP_BSD_SBUF */
-int
-soread(PNATState pData, struct socket *so)
-{
-    int n;
-    char *buf;
-    struct sbuf *sb = &so->so_snd;
-    size_t len = sbspace(sb);
-    int mss = so->so_tcpcb->t_maxseg;
-
-    STAM_PROFILE_START(&pData->StatIOread, a);
-    STAM_COUNTER_RESET(&pData->StatIORead_in_1);
-    STAM_COUNTER_RESET(&pData->StatIORead_in_2);
-
-    QSOCKET_LOCK(tcb);
-    SOCKET_LOCK(so);
-    QSOCKET_UNLOCK(tcb);
-
-    LogFlowFunc(("soread: so = %lx\n", (long)so));
-
-    if (len > mss)
-        len -= len % mss;
-    buf = RTMemAlloc(len);
-    if (buf == NULL)
-    {
-        Log(("NAT: can't alloc enough memory\n"));
-        return -1;
-    }
-
-    n = recv(so->s, buf, len, (so->so_tcpcb->t_force? MSG_OOB:0));
-    if (n <= 0)
-    {
-        /*
-         * Special case for WSAEnumNetworkEvents: If we receive 0 bytes that
-         * _could_ mean that the connection is closed. But we will receive an
-         * FD_CLOSE event later if the connection was _really_ closed. With
-         * www.youtube.com I see this very often. Closing the socket too early
-         * would be dangerous.
-         */
-        int status;
-        unsigned long pending = 0;
-        status = ioctlsocket(so->s, FIONREAD, &pending);
-        if (status < 0)
-            Log(("NAT:error in WSAIoctl: %d\n", errno));
-        if (n == 0 && (pending != 0))
-        {
-            SOCKET_UNLOCK(so);
-            STAM_PROFILE_STOP(&pData->StatIOread, a);
-            RTMemFree(buf);
-            return 0;
-        }
-        if (   n < 0
-            && soIgnorableErrorCode(errno))
-        {
-            SOCKET_UNLOCK(so);
-            STAM_PROFILE_STOP(&pData->StatIOread, a);
-            RTMemFree(buf);
-            return 0;
-        }
-        else
-        {
-            Log2((" --- soread() disconnected, n = %d, errno = %d (%s)\n",
-                  n, errno, strerror(errno)));
-            sofcantrcvmore(so);
-            tcp_sockclosed(pData, sototcpcb(so));
-            SOCKET_UNLOCK(so);
-            STAM_PROFILE_STOP(&pData->StatIOread, a);
-            RTMemFree(buf);
-            return -1;
-        }
-    }
-
-    sbuf_bcat(sb, buf, n);
-    RTMemFree(buf);
-    return n;
-}
-#endif
 
 /*
  * Get urgent data
@@ -533,7 +455,7 @@ sorecvoob(PNATState pData, struct socket *so)
         tp->t_force = 0;
     }
 }
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
+
 /*
  * Send urgent data
  * There's a lot duplicated code here, but...
@@ -749,58 +671,6 @@ sowrite(PNATState pData, struct socket *so)
     STAM_PROFILE_STOP(&pData->StatIOwrite, a);
     return nn;
 }
-#else /* VBOX_WITH_SLIRP_BSD_SBUF */
-static int
-do_sosend(struct socket *so, int fUrg)
-{
-    struct sbuf *sb = &so->so_rcv;
-
-    int n, len;
-
-    LogFlowFunc(("sosendoob: so = %R[natsock]\n", so));
-
-    len = sbuf_len(sb);
-
-    n = send(so->s, sbuf_data(sb), len, (fUrg ? MSG_OOB : 0));
-    if (n < 0)
-        Log(("NAT: Can't sent sbuf via socket.\n"));
-    if (fUrg)
-        so->so_urgc -= n;
-    if (n > 0 && n < len)
-    {
-        char *ptr;
-        char *buff;
-        buff = RTMemAlloc(len);
-        if (buff == NULL)
-        {
-            Log(("NAT: No space to allocate temporal buffer\n"));
-            return -1;
-        }
-        ptr = sbuf_data(sb);
-        memcpy(buff, &ptr[n], len - n);
-        sbuf_bcpy(sb, buff, len - n);
-        RTMemFree(buff);
-        return n;
-    }
-    sbuf_clear(sb);
-    return n;
-}
-int
-sosendoob(struct socket *so)
-{
-    return do_sosend(so, 1);
-}
-
-/*
- * Write data from so_rcv to so's socket,
- * updating all sbuf field as necessary
- */
-int
-sowrite(PNATState pData, struct socket *so)
-{
-    return do_sosend(so, 0);
-}
-#endif
 
 /*
  * recvfrom() a UDP socket
@@ -1357,9 +1227,7 @@ send_icmp_to_guest(PNATState pData, char *buff, size_t len, const struct sockadd
     if (!m)
     {
         LogFunc(("%R[natsock] hasn't stored it's mbuf on sent\n", icm->im_so));
-        LIST_REMOVE(icm, im_list);
-        RTMemFree(icm);
-        return;
+        goto done;
     }
 
     src = addr->sin_addr.s_addr;
@@ -1370,7 +1238,7 @@ send_icmp_to_guest(PNATState pData, char *buff, size_t len, const struct sockadd
         if (icp0->icmp_type != ICMP_ECHO)
         {
             Log(("NAT: we haven't found echo for this reply\n"));
-            return;
+            goto done;
         }
         /*
          * while combining buffer to send (see ip_icmp.c) we control ICMP header only,
@@ -1383,7 +1251,7 @@ send_icmp_to_guest(PNATState pData, char *buff, size_t len, const struct sockadd
         {
             Log(("NAT: ECHO(%d) lenght doesn't match ECHOREPLY(%d)\n",
                 (ip->ip_len - hlen), (ip0->ip_len - (ip0->ip_hl << 2))));
-            return;
+            goto done;
         }
     }
 
@@ -1426,10 +1294,9 @@ send_icmp_to_guest(PNATState pData, char *buff, size_t len, const struct sockadd
     icmp_reflect(pData, m);
     /* m was freed */
     icm->im_m = NULL;
-    icm->im_so->so_m = NULL;
-    LIST_REMOVE(icm, im_list);
-    pData->cIcmpCacheSize--;
-    RTMemFree(icm);
+
+  done:
+    icmp_msg_delete(pData, icm);
 }
 
 static void sorecvfrom_icmp_unix(PNATState pData, struct socket *so)
diff --git a/src/VBox/Devices/Network/slirp/tcp_input.c b/src/VBox/Devices/Network/slirp/tcp_input.c
index 167a123..8468fa1 100644
--- a/src/VBox/Devices/Network/slirp/tcp_input.c
+++ b/src/VBox/Devices/Network/slirp/tcp_input.c
@@ -529,13 +529,8 @@ findso:
             goto dropwithreset;
         }
         SOCKET_LOCK(so);
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
         sbreserve(pData, &so->so_snd, tcp_sndspace);
         sbreserve(pData, &so->so_rcv, tcp_rcvspace);
-#else
-        sbuf_new(&so->so_snd, NULL, tcp_sndspace, SBUF_AUTOEXTEND);
-        sbuf_new(&so->so_rcv, NULL, tcp_rcvspace, SBUF_AUTOEXTEND);
-#endif
 
 /*      tcp_last_so = so; */  /* XXX ? */
 /*      tp = sototcpcb(so);    */
@@ -661,15 +656,7 @@ findso:
               acked = ti->ti_ack - tp->snd_una;
               tcpstat.tcps_rcvackpack++;
               tcpstat.tcps_rcvackbyte += acked;
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
               sbdrop(&so->so_snd, acked);
-#else
-              if (sbuf_len(&so->so_snd) < acked)
-                /* drop all what sbuf have */
-                sbuf_setpos(&so->so_snd, 0);
-              else
-                sbuf_setpos(&so->so_snd, sbuf_len(&so->so_snd) - acked);
-#endif
               tp->snd_una = ti->ti_ack;
               m_freem(pData, m);
 
@@ -1396,20 +1383,12 @@ synrx_to_est:
             if (acked > SBUF_LEN(&so->so_snd))
             {
                 tp->snd_wnd -= SBUF_LEN(&so->so_snd);
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
                 sbdrop(&so->so_snd, (int)so->so_snd.sb_cc);
-#else
-                sbuf_clear(&so->so_snd);
-#endif
                 ourfinisacked = 1;
             }
             else
             {
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
                 sbdrop(&so->so_snd, acked);
-#else
-                sbuf_setpos(&so->so_snd, sbuf_len(&so->so_snd) - acked);
-#endif
                 tp->snd_wnd -= acked;
                 ourfinisacked = 0;
             }
@@ -1526,8 +1505,6 @@ step6:
     if ((tiflags & TH_URG) && ti->ti_urp &&
             TCPS_HAVERCVDFIN(tp->t_state) == 0)
     {
-    /* BSD's sbufs are auto extent so we shouldn't worry here */
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
         /*
          * This is a kludge, but if we receive and accept
          * random urgent pointers, we'll crash in
@@ -1541,7 +1518,7 @@ step6:
             LogFlowFunc(("%d -> dodata\n", __LINE__));
             goto dodata;
         }
-#endif
+
         /*
          * If this segment advances the known urgent pointer,
          * then mark the data stream.  This should not happen
@@ -2042,13 +2019,8 @@ tcp_mss(PNATState pData, register struct tcpcb *tp, u_int offer)
 
     tp->snd_cwnd = mss;
 
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
     sbreserve(pData, &so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0));
     sbreserve(pData, &so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0));
-#else
-    sbuf_new(&so->so_snd, NULL, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0), SBUF_AUTOEXTEND);
-    sbuf_new(&so->so_rcv, NULL, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0), SBUF_AUTOEXTEND);
-#endif
 
     Log2((" returning mss = %d\n", mss));
 
diff --git a/src/VBox/Devices/Network/slirp/tcp_output.c b/src/VBox/Devices/Network/slirp/tcp_output.c
index 99927e5..9b052f3 100644
--- a/src/VBox/Devices/Network/slirp/tcp_output.c
+++ b/src/VBox/Devices/Network/slirp/tcp_output.c
@@ -421,12 +421,8 @@ send:
         if (len <= MHLEN - hdrlen - max_linkhdr)
         {
 #endif
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
             sbcopy(&so->so_snd, off, (int) len, mtod(m, caddr_t) + hdrlen);
             m->m_len += len;
-#else
-            m_copyback(pData, m, hdrlen, len, sbuf_data(&so->so_snd) + off);
-#endif
 #if 0
         }
         else
diff --git a/src/VBox/Devices/Network/slirp/tcp_subr.c b/src/VBox/Devices/Network/slirp/tcp_subr.c
index c18dde6..0769a5f 100644
--- a/src/VBox/Devices/Network/slirp/tcp_subr.c
+++ b/src/VBox/Devices/Network/slirp/tcp_subr.c
@@ -304,13 +304,8 @@ tcp_close(PNATState pData, register struct tcpcb *tp)
      * any sbufs reserved. */
     if (!(so->so_state & SS_FACCEPTCONN))
     {
-#ifndef VBOX_WITH_SLIRP_BSD_SBUF
         sbfree(&so->so_rcv);
         sbfree(&so->so_snd);
-#else
-        sbuf_delete(&so->so_rcv);
-        sbuf_delete(&so->so_snd);
-#endif
     }
     sofree(pData, so);
     SOCKET_UNLOCK(so);
diff --git a/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp b/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp
index baae294..4381cb2 100644
--- a/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp
+++ b/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp
@@ -806,7 +806,7 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
                 return 1;
 
             case 'V':
-                RTPrintf("$Revision: 94787 $\n");
+                RTPrintf("$Revision: 94786 $\n");
                 return 0;
 
             default:
diff --git a/src/VBox/Devices/PC/BIOS/Makefile.kmk b/src/VBox/Devices/PC/BIOS/Makefile.kmk
index fa46f37..f013d1d 100644
--- a/src/VBox/Devices/PC/BIOS/Makefile.kmk
+++ b/src/VBox/Devices/PC/BIOS/Makefile.kmk
@@ -41,6 +41,7 @@ ifdef VBOX_WITH_OPEN_WATCOM
  	  segment BIOS32  segaddr=0xF000 offset=0xDA00 \
  	  segment BIOSSEG segaddr=0xF000 offset=0xE000
  VBoxPcBios_SOURCES = \
+ 	post.c \
  	bios.c \
  	print.c \
  	ata.c \
diff --git a/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm b/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm
index 62b0110..4ac03b3 100644
--- a/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm
+++ b/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.asm
@@ -4,6 +4,23 @@
 ;
 
 ;
+; Source file: post.c
+;
+;  BIOS POST routines. Used only during initialization.
+;  
+;  
+;  
+;  Copyright (C) 2004-2014 Oracle Corporation
+;  
+;  This file is part of VirtualBox Open Source Edition (OSE), as
+;  available from http://www.virtualbox.org. This file is free software;
+;  you can redistribute it and/or modify it under the terms of the GNU
+;  General Public License (GPL) as published by the Free Software
+;  Foundation, in version 2 as it comes in the "COPYING" file of the
+;  VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+;  hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+;
 ; Source file: bios.c
 ;
 ;  
@@ -838,15 +855,15 @@ _fd_parm:                                    ; 0xf0000 LB 0x5b
 _fd_map:                                     ; 0xf005b LB 0xf
     db  001h, 000h, 002h, 002h, 003h, 003h, 004h, 004h, 005h, 005h, 00eh, 006h, 00fh, 006h, 000h
 _pktacc:                                     ; 0xf006a LB 0xc
-    db  000h, 000h, 000h, 000h, 000h, 000h, 03fh, 028h, 0cfh, 078h, 097h, 086h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 08fh, 028h, 089h, 07bh, 06bh, 089h
 _softrst:                                    ; 0xf0076 LB 0xc
-    db  000h, 000h, 000h, 000h, 000h, 000h, 027h, 02bh, 036h, 036h, 036h, 036h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 077h, 02bh, 054h, 038h, 054h, 038h
 _dskacc:                                     ; 0xf0082 LB 0x2e
-    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 088h, 027h, 002h, 028h, 000h, 000h, 000h, 000h
-    db  063h, 077h, 019h, 078h, 093h, 085h, 027h, 086h, 000h, 000h, 000h, 000h, 000h, 000h, 05fh, 033h
+    db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0d8h, 027h, 052h, 028h, 000h, 000h, 000h, 000h
+    db  017h, 07ah, 0d0h, 07ah, 066h, 088h, 0f9h, 088h, 000h, 000h, 000h, 000h, 000h, 000h, 05fh, 033h
     db  032h, 05fh, 000h, 0dah, 00fh, 000h, 000h, 001h, 0f3h, 000h, 000h, 000h, 000h, 000h
 
-section CONST progbits vstart=0xb0 align=1 ; size=0xcf8 class=DATA group=DGROUP
+section CONST progbits vstart=0xb0 align=1 ; size=0xce0 class=DATA group=DGROUP
     db   'NMI Handler called', 00ah, 000h
     db   'INT18: BOOT FAILURE', 00ah, 000h
     db   '%s', 00ah, 000h, 000h
@@ -941,8 +958,9 @@ section CONST progbits vstart=0xb0 align=1 ; size=0xcf8 class=DATA group=DGROUP
     db   ' l) LAN', 00ah, 00ah, ' b) Continue booting', 00ah, 000h
     db   'Delaying boot for %d seconds:', 000h
     db   ' %d', 000h, 000h
-    db   'scsi_read_sectors: device_id out of range %d', 00ah, 000h
-    db   'scsi_write_sectors: device_id out of range %d', 00ah, 000h
+    db   'scsi_read_sectors', 000h
+    db   '%s: device_id out of range %d', 00ah, 000h
+    db   'scsi_write_sectors', 000h
     db   'scsi_cmd_packet', 000h
     db   '%s: DATA_OUT not supported yet', 00ah, 000h
     db   'scsi_enumerate_attached_devices', 000h
@@ -950,7 +968,7 @@ section CONST progbits vstart=0xb0 align=1 ; size=0xcf8 class=DATA group=DGROUP
     db   '%s: SCSI_READ_CAPACITY failed', 00ah, 000h
     db   'Disk %d has an unsupported sector size of %u', 00ah, 000h
     db   'SCSI %d-ID#%d: LCHS=%u/%u/%u %lu sectors', 00ah, 000h
-    db   'SCSI %d-ID#%d: CD/DVD-ROM', 00ah, 000h
+    db   'SCSI %d-ID#%d: CD/DVD-ROM', 00ah, 000h, 000h
     db   'ahci_read_sectors', 000h
     db   '%s: device_id out of range %d', 00ah, 000h
     db   'ahci_write_sectors', 000h
@@ -963,20 +981,20 @@ section CONST progbits vstart=0xb0 align=1 ; size=0xcf8 class=DATA group=DGROUP
     db   'APM: Unsupported function AX=%04X BX=%04X called', 00ah, 000h, 000h
     db   'PCI: Unsupported function AX=%04X BX=%04X called', 00ah, 000h
 
-section CONST2 progbits vstart=0xda8 align=1 ; size=0x3fa class=DATA group=DGROUP
-_bios_cvs_version_string:                    ; 0xf0da8 LB 0x12
-    db  'VirtualBox 4.3.28', 000h
-_bios_prefix_string:                         ; 0xf0dba LB 0x8
+section CONST2 progbits vstart=0xd90 align=1 ; size=0x400 class=DATA group=DGROUP
+_bios_cvs_version_string:                    ; 0xf0d90 LB 0x18
+    db  'VirtualBox 5.0.0_BETA4', 000h, 000h
+_bios_prefix_string:                         ; 0xf0da8 LB 0x8
     db  'BIOS: ', 000h, 000h
-_isotag:                                     ; 0xf0dc2 LB 0x6
+_isotag:                                     ; 0xf0db0 LB 0x6
     db  'CD001', 000h
-_eltorito:                                   ; 0xf0dc8 LB 0x18
+_eltorito:                                   ; 0xf0db6 LB 0x18
     db  'EL TORITO SPECIFICATION', 000h
-_drivetypes:                                 ; 0xf0de0 LB 0x28
+_drivetypes:                                 ; 0xf0dce LB 0x28
     db  046h, 06ch, 06fh, 070h, 070h, 079h, 000h, 000h, 000h, 000h, 048h, 061h, 072h, 064h, 020h, 044h
     db  069h, 073h, 06bh, 000h, 043h, 044h, 02dh, 052h, 04fh, 04dh, 000h, 000h, 000h, 000h, 04ch, 041h
     db  04eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h
-_scan_to_scanascii:                          ; 0xf0e08 LB 0x37a
+_scan_to_scanascii:                          ; 0xf0df6 LB 0x37a
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 01bh, 001h, 01bh, 001h, 01bh, 001h
     db  000h, 001h, 000h, 000h, 031h, 002h, 021h, 002h, 000h, 000h, 000h, 078h, 000h, 000h, 032h, 003h
     db  040h, 003h, 000h, 003h, 000h, 079h, 000h, 000h, 033h, 004h, 023h, 004h, 000h, 000h, 000h, 07ah
@@ -1033,14 +1051,55 @@ _scan_to_scanascii:                          ; 0xf0e08 LB 0x37a
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 05ch, 056h, 07ch, 056h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 085h, 000h, 087h, 000h, 089h, 000h, 08bh, 000h, 000h
     db  000h, 086h, 000h, 088h, 000h, 08ah, 000h, 08ch, 000h, 000h
-_panic_msg_keyb_buffer_full:                 ; 0xf1182 LB 0x20
+_panic_msg_keyb_buffer_full:                 ; 0xf1170 LB 0x20
     db  '%s: keyboard input buffer full', 00ah, 000h
 
-  ; Padding 0x45e bytes at 0xf11a2
-  times 1118 db 0
+  ; Padding 0x470 bytes at 0xf1190
+  times 1136 db 0
 
-section _TEXT progbits vstart=0x1600 align=1 ; size=0x7f55 class=CODE group=AUTO
-read_byte_:                                  ; 0xf1600 LB 0xe
+section _TEXT progbits vstart=0x1600 align=1 ; size=0x8235 class=CODE group=AUTO
+rom_scan_:                                   ; 0xf1600 LB 0x50
+    push bp                                   ; 55
+    mov bp, sp                                ; 89 e5
+    push bx                                   ; 53
+    push cx                                   ; 51
+    push si                                   ; 56
+    push ax                                   ; 50
+    push ax                                   ; 50
+    mov bx, ax                                ; 89 c3
+    mov cx, dx                                ; 89 d1
+    cmp bx, cx                                ; 39 cb
+    jnc short 01648h                          ; 73 38
+    xor si, si                                ; 31 f6
+    mov dx, bx                                ; 89 da
+    mov es, bx                                ; 8e c3
+    cmp word [es:si], 0aa55h                  ; 26 81 3c 55 aa
+    jne short 01642h                          ; 75 25
+    mov word [bp-008h], bx                    ; 89 5e f8
+    mov word [bp-00ah], strict word 00003h    ; c7 46 f6 03 00
+    call far [bp-00ah]                        ; ff 5e f6
+    cli                                       ; fa
+    mov es, bx                                ; 8e c3
+    mov al, byte [es:si+002h]                 ; 26 8a 44 02
+    add AL, strict byte 003h                  ; 04 03
+    and AL, strict byte 0fch                  ; 24 fc
+    xor ah, ah                                ; 30 e4
+    cwd                                       ; 99
+    sal dx, 002h                              ; c1 e2 02
+    db  01bh, 0c2h
+    ; sbb ax, dx                                ; 1b c2
+    sar ax, 002h                              ; c1 f8 02
+    add bx, ax                                ; 01 c3
+    jmp short 0160ch                          ; eb ca
+    add bx, 00080h                            ; 81 c3 80 00
+    jmp short 0160ch                          ; eb c4
+    lea sp, [bp-006h]                         ; 8d 66 fa
+    pop si                                    ; 5e
+    pop cx                                    ; 59
+    pop bx                                    ; 5b
+    pop bp                                    ; 5d
+    retn                                      ; c3
+read_byte_:                                  ; 0xf1650 LB 0xe
     push bx                                   ; 53
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -1050,7 +1109,7 @@ read_byte_:                                  ; 0xf1600 LB 0xe
     pop bp                                    ; 5d
     pop bx                                    ; 5b
     retn                                      ; c3
-write_byte_:                                 ; 0xf160e LB 0xe
+write_byte_:                                 ; 0xf165e LB 0xe
     push si                                   ; 56
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -1060,7 +1119,7 @@ write_byte_:                                 ; 0xf160e LB 0xe
     pop bp                                    ; 5d
     pop si                                    ; 5e
     retn                                      ; c3
-read_word_:                                  ; 0xf161c LB 0xe
+read_word_:                                  ; 0xf166c LB 0xe
     push bx                                   ; 53
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -1070,7 +1129,7 @@ read_word_:                                  ; 0xf161c LB 0xe
     pop bp                                    ; 5d
     pop bx                                    ; 5b
     retn                                      ; c3
-write_word_:                                 ; 0xf162a LB 0xe
+write_word_:                                 ; 0xf167a LB 0xe
     push si                                   ; 56
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -1080,7 +1139,7 @@ write_word_:                                 ; 0xf162a LB 0xe
     pop bp                                    ; 5d
     pop si                                    ; 5e
     retn                                      ; c3
-read_dword_:                                 ; 0xf1638 LB 0x12
+read_dword_:                                 ; 0xf1688 LB 0x12
     push bx                                   ; 53
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -1091,7 +1150,7 @@ read_dword_:                                 ; 0xf1638 LB 0x12
     pop bp                                    ; 5d
     pop bx                                    ; 5b
     retn                                      ; c3
-write_dword_:                                ; 0xf164a LB 0x12
+write_dword_:                                ; 0xf169a LB 0x12
     push si                                   ; 56
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -1102,13 +1161,13 @@ write_dword_:                                ; 0xf164a LB 0x12
     pop bp                                    ; 5d
     pop si                                    ; 5e
     retn                                      ; c3
-inb_cmos_:                                   ; 0xf165c LB 0x1d
+inb_cmos_:                                   ; 0xf16ac LB 0x1d
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
     mov AH, strict byte 070h                  ; b4 70
     cmp AL, strict byte 080h                  ; 3c 80
-    jc short 01668h                           ; 72 02
+    jc short 016b8h                           ; 72 02
     mov AH, strict byte 072h                  ; b4 72
     movzx dx, ah                              ; 0f b6 d4
     out DX, AL                                ; ee
@@ -1121,14 +1180,14 @@ inb_cmos_:                                   ; 0xf165c LB 0x1d
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-outb_cmos_:                                  ; 0xf1679 LB 0x1f
+outb_cmos_:                                  ; 0xf16c9 LB 0x1f
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     mov ah, dl                                ; 88 d4
     mov BL, strict byte 070h                  ; b3 70
     cmp AL, strict byte 080h                  ; 3c 80
-    jc short 01687h                           ; 72 02
+    jc short 016d7h                           ; 72 02
     mov BL, strict byte 072h                  ; b3 72
     movzx dx, bl                              ; 0f b6 d3
     out DX, AL                                ; ee
@@ -1140,7 +1199,7 @@ outb_cmos_:                                  ; 0xf1679 LB 0x1f
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-_dummy_isr_function:                         ; 0xf1698 LB 0x6b
+_dummy_isr_function:                         ; 0xf16e8 LB 0x6b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push ax                                   ; 50
@@ -1154,7 +1213,7 @@ _dummy_isr_function:                         ; 0xf1698 LB 0x6b
     mov bx, ax                                ; 89 c3
     mov byte [bp-002h], al                    ; 88 46 fe
     test al, al                               ; 84 c0
-    je short 016f3h                           ; 74 43
+    je short 01743h                           ; 74 43
     mov AL, strict byte 00bh                  ; b0 0b
     mov dx, 000a0h                            ; ba a0 00
     out DX, AL                                ; ee
@@ -1163,7 +1222,7 @@ _dummy_isr_function:                         ; 0xf1698 LB 0x6b
     ; sub ah, ah                                ; 2a e4
     mov cx, ax                                ; 89 c1
     test al, al                               ; 84 c0
-    je short 016d5h                           ; 74 16
+    je short 01725h                           ; 74 16
     mov dx, 000a1h                            ; ba a1 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -1175,7 +1234,7 @@ _dummy_isr_function:                         ; 0xf1698 LB 0x6b
     mov AL, strict byte 020h                  ; b0 20
     mov dx, 000a0h                            ; ba a0 00
     out DX, AL                                ; ee
-    jmp short 016eah                          ; eb 15
+    jmp short 0173ah                          ; eb 15
     mov dx, strict word 00021h                ; ba 21 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -1193,67 +1252,67 @@ _dummy_isr_function:                         ; 0xf1698 LB 0x6b
     movzx bx, cl                              ; 0f b6 d9
     mov dx, strict word 0006bh                ; ba 6b 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 0f ff
+    call 0165eh                               ; e8 0f ff
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-_nmi_handler_msg:                            ; 0xf1703 LB 0x12
+_nmi_handler_msg:                            ; 0xf1753 LB 0x12
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push 000b0h                               ; 68 b0 00
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 14 02
+    call 01972h                               ; e8 14 02
     add sp, strict byte 00004h                ; 83 c4 04
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-_int18_panic_msg:                            ; 0xf1715 LB 0x12
+_int18_panic_msg:                            ; 0xf1765 LB 0x12
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push 000c4h                               ; 68 c4 00
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 02 02
+    call 01972h                               ; e8 02 02
     add sp, strict byte 00004h                ; 83 c4 04
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-_log_bios_start:                             ; 0xf1727 LB 0x20
+_log_bios_start:                             ; 0xf1777 LB 0x20
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
-    mov bx, 00dbah                            ; bb ba 0d
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 ac 01
-    push 00da8h                               ; 68 a8 0d
+    call 01931h                               ; e8 ac 01
+    push 00d90h                               ; 68 90 0d
     push 000d9h                               ; 68 d9 00
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 e2 01
+    call 01972h                               ; e8 e2 01
     add sp, strict byte 00006h                ; 83 c4 06
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-_print_bios_banner:                          ; 0xf1747 LB 0x2e
+_print_bios_banner:                          ; 0xf1797 LB 0x2e
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov dx, strict word 00072h                ; ba 72 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 c9 fe
+    call 0166ch                               ; e8 c9 fe
     mov cx, ax                                ; 89 c1
     xor bx, bx                                ; 31 db
     mov dx, strict word 00072h                ; ba 72 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0162ah                               ; e8 ca fe
+    call 0167ah                               ; e8 ca fe
     cmp cx, 01234h                            ; 81 f9 34 12
-    jne short 0176eh                          ; 75 08
+    jne short 017beh                          ; 75 08
     mov AL, strict byte 003h                  ; b0 03
     mov AH, strict byte 000h                  ; b4 00
     int 010h                                  ; cd 10
-    jmp short 01771h                          ; eb 03
-    call 07372h                               ; e8 01 5c
+    jmp short 017c1h                          ; eb 03
+    call 075fah                               ; e8 39 5e
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-send_:                                       ; 0xf1775 LB 0x3b
+send_:                                       ; 0xf17c5 LB 0x3b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -1261,19 +1320,19 @@ send_:                                       ; 0xf1775 LB 0x3b
     mov bx, ax                                ; 89 c3
     mov cl, dl                                ; 88 d1
     test AL, strict byte 008h                 ; a8 08
-    je short 01788h                           ; 74 06
+    je short 017d8h                           ; 74 06
     mov al, dl                                ; 88 d0
     mov dx, 00403h                            ; ba 03 04
     out DX, AL                                ; ee
     test bl, 004h                             ; f6 c3 04
-    je short 01793h                           ; 74 06
+    je short 017e3h                           ; 74 06
     mov al, cl                                ; 88 c8
     mov dx, 00504h                            ; ba 04 05
     out DX, AL                                ; ee
     test bl, 002h                             ; f6 c3 02
-    je short 017a9h                           ; 74 11
+    je short 017f9h                           ; 74 11
     cmp cl, 00ah                              ; 80 f9 0a
-    jne short 017a3h                          ; 75 06
+    jne short 017f3h                          ; 75 06
     mov AL, strict byte 00dh                  ; b0 0d
     mov AH, strict byte 00eh                  ; b4 0e
     int 010h                                  ; cd 10
@@ -1285,7 +1344,7 @@ send_:                                       ; 0xf1775 LB 0x3b
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-put_int_:                                    ; 0xf17b0 LB 0x5f
+put_int_:                                    ; 0xf1800 LB 0x5f
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -1300,24 +1359,24 @@ put_int_:                                    ; 0xf17b0 LB 0x5f
     idiv di                                   ; f7 ff
     mov word [bp-006h], ax                    ; 89 46 fa
     test ax, ax                               ; 85 c0
-    je short 017d5h                           ; 74 0a
+    je short 01825h                           ; 74 0a
     dec bx                                    ; 4b
     mov dx, ax                                ; 89 c2
     mov ax, si                                ; 89 f0
-    call 017b0h                               ; e8 dd ff
-    jmp short 017f0h                          ; eb 1b
+    call 01800h                               ; e8 dd ff
+    jmp short 01840h                          ; eb 1b
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jle short 017e4h                          ; 7e 0a
+    jle short 01834h                          ; 7e 0a
     mov dx, strict word 00020h                ; ba 20 00
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 93 ff
-    jmp short 017d5h                          ; eb f1
+    call 017c5h                               ; e8 93 ff
+    jmp short 01825h                          ; eb f1
     test cx, cx                               ; 85 c9
-    je short 017f0h                           ; 74 08
+    je short 01840h                           ; 74 08
     mov dx, strict word 0002dh                ; ba 2d 00
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 85 ff
+    call 017c5h                               ; e8 85 ff
     mov al, byte [bp-006h]                    ; 8a 46 fa
     mov DL, strict byte 00ah                  ; b2 0a
     mul dl                                    ; f6 e2
@@ -1327,13 +1386,13 @@ put_int_:                                    ; 0xf17b0 LB 0x5f
     add AL, strict byte 030h                  ; 04 30
     movzx dx, al                              ; 0f b6 d0
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 6d ff
+    call 017c5h                               ; e8 6d ff
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-put_uint_:                                   ; 0xf180f LB 0x60
+put_uint_:                                   ; 0xf185f LB 0x60
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -1348,24 +1407,24 @@ put_uint_:                                   ; 0xf180f LB 0x60
     div di                                    ; f7 f7
     mov word [bp-006h], ax                    ; 89 46 fa
     test ax, ax                               ; 85 c0
-    je short 01835h                           ; 74 0a
+    je short 01885h                           ; 74 0a
     dec bx                                    ; 4b
     mov dx, ax                                ; 89 c2
     mov ax, si                                ; 89 f0
-    call 0180fh                               ; e8 dc ff
-    jmp short 01850h                          ; eb 1b
+    call 0185fh                               ; e8 dc ff
+    jmp short 018a0h                          ; eb 1b
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jle short 01844h                          ; 7e 0a
+    jle short 01894h                          ; 7e 0a
     mov dx, strict word 00020h                ; ba 20 00
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 33 ff
-    jmp short 01835h                          ; eb f1
+    call 017c5h                               ; e8 33 ff
+    jmp short 01885h                          ; eb f1
     test cx, cx                               ; 85 c9
-    je short 01850h                           ; 74 08
+    je short 018a0h                           ; 74 08
     mov dx, strict word 0002dh                ; ba 2d 00
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 25 ff
+    call 017c5h                               ; e8 25 ff
     mov al, byte [bp-006h]                    ; 8a 46 fa
     mov DL, strict byte 00ah                  ; b2 0a
     mul dl                                    ; f6 e2
@@ -1375,13 +1434,13 @@ put_uint_:                                   ; 0xf180f LB 0x60
     add AL, strict byte 030h                  ; 04 30
     movzx dx, al                              ; 0f b6 d0
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 0d ff
+    call 017c5h                               ; e8 0d ff
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-put_luint_:                                  ; 0xf186f LB 0x72
+put_luint_:                                  ; 0xf18bf LB 0x72
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -1395,30 +1454,30 @@ put_luint_:                                  ; 0xf186f LB 0x72
     mov dx, cx                                ; 89 ca
     mov bx, strict word 0000ah                ; bb 0a 00
     xor cx, cx                                ; 31 c9
-    call 09460h                               ; e8 d7 7b
+    call 09740h                               ; e8 67 7e
     mov word [bp-008h], ax                    ; 89 46 f8
     mov cx, dx                                ; 89 d1
     mov dx, ax                                ; 89 c2
     or dx, cx                                 ; 09 ca
-    je short 018a3h                           ; 74 0f
+    je short 018f3h                           ; 74 0f
     push word [bp+004h]                       ; ff 76 04
     lea dx, [di-001h]                         ; 8d 55 ff
     mov bx, ax                                ; 89 c3
     mov ax, si                                ; 89 f0
-    call 0186fh                               ; e8 ce ff
-    jmp short 018c0h                          ; eb 1d
+    call 018bfh                               ; e8 ce ff
+    jmp short 01910h                          ; eb 1d
     dec di                                    ; 4f
     test di, di                               ; 85 ff
-    jle short 018b2h                          ; 7e 0a
+    jle short 01902h                          ; 7e 0a
     mov dx, strict word 00020h                ; ba 20 00
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 c5 fe
-    jmp short 018a3h                          ; eb f1
+    call 017c5h                               ; e8 c5 fe
+    jmp short 018f3h                          ; eb f1
     cmp word [bp+004h], strict byte 00000h    ; 83 7e 04 00
-    je short 018c0h                           ; 74 08
+    je short 01910h                           ; 74 08
     mov dx, strict word 0002dh                ; ba 2d 00
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 b5 fe
+    call 017c5h                               ; e8 b5 fe
     mov al, byte [bp-008h]                    ; 8a 46 f8
     mov DL, strict byte 00ah                  ; b2 0a
     mul dl                                    ; f6 e2
@@ -1428,13 +1487,13 @@ put_luint_:                                  ; 0xf186f LB 0x72
     add AL, strict byte 030h                  ; 04 30
     movzx dx, al                              ; 0f b6 d0
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 9d fe
+    call 017c5h                               ; e8 9d fe
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00002h                               ; c2 02 00
-put_str_:                                    ; 0xf18e1 LB 0x21
+put_str_:                                    ; 0xf1931 LB 0x21
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
@@ -1443,18 +1502,18 @@ put_str_:                                    ; 0xf18e1 LB 0x21
     mov es, cx                                ; 8e c1
     mov dl, byte [es:bx]                      ; 26 8a 17
     test dl, dl                               ; 84 d2
-    je short 018fbh                           ; 74 0a
+    je short 0194bh                           ; 74 0a
     xor dh, dh                                ; 30 f6
     mov ax, si                                ; 89 f0
-    call 01775h                               ; e8 7d fe
+    call 017c5h                               ; e8 7d fe
     inc bx                                    ; 43
-    jmp short 018e8h                          ; eb ed
+    jmp short 01938h                          ; eb ed
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop si                                    ; 5e
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-put_str_near_:                               ; 0xf1902 LB 0x20
+put_str_near_:                               ; 0xf1952 LB 0x20
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -1463,18 +1522,18 @@ put_str_near_:                               ; 0xf1902 LB 0x20
     mov bx, dx                                ; 89 d3
     mov dl, byte [bx]                         ; 8a 17
     test dl, dl                               ; 84 d2
-    je short 0191bh                           ; 74 0a
+    je short 0196bh                           ; 74 0a
     xor dh, dh                                ; 30 f6
     mov ax, cx                                ; 89 c8
-    call 01775h                               ; e8 5d fe
+    call 017c5h                               ; e8 5d fe
     inc bx                                    ; 43
-    jmp short 0190bh                          ; eb f0
+    jmp short 0195bh                          ; eb f0
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop cx                                    ; 59
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-bios_printf_:                                ; 0xf1922 LB 0x23b
+bios_printf_:                                ; 0xf1972 LB 0x23b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -1491,31 +1550,31 @@ bios_printf_:                                ; 0xf1922 LB 0x23b
     mov ax, word [bp+004h]                    ; 8b 46 04
     and ax, strict word 00007h                ; 25 07 00
     cmp ax, strict word 00007h                ; 3d 07 00
-    jne short 01950h                          ; 75 0b
+    jne short 019a0h                          ; 75 0b
     push 000deh                               ; 68 de 00
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 d5 ff
+    call 01972h                               ; e8 d5 ff
     add sp, strict byte 00004h                ; 83 c4 04
     mov bx, word [bp+006h]                    ; 8b 5e 06
     mov dl, byte [bx]                         ; 8a 17
     test dl, dl                               ; 84 d2
-    je near 01b41h                            ; 0f 84 e6 01
+    je near 01b91h                            ; 0f 84 e6 01
     cmp dl, 025h                              ; 80 fa 25
-    jne short 01968h                          ; 75 08
+    jne short 019b8h                          ; 75 08
     mov cx, strict word 00001h                ; b9 01 00
     xor si, si                                ; 31 f6
-    jmp near 01b3bh                           ; e9 d3 01
+    jmp near 01b8bh                           ; e9 d3 01
     test cx, cx                               ; 85 c9
-    je near 01b33h                            ; 0f 84 c5 01
+    je near 01b83h                            ; 0f 84 c5 01
     cmp dl, 030h                              ; 80 fa 30
-    jc short 01986h                           ; 72 13
+    jc short 019d6h                           ; 72 13
     cmp dl, 039h                              ; 80 fa 39
-    jnbe short 01986h                         ; 77 0e
+    jnbe short 019d6h                         ; 77 0e
     movzx ax, dl                              ; 0f b6 c2
     imul si, si, strict byte 0000ah           ; 6b f6 0a
     sub ax, strict word 00030h                ; 2d 30 00
     add si, ax                                ; 01 c6
-    jmp near 01b3bh                           ; e9 b5 01
+    jmp near 01b8bh                           ; e9 b5 01
     mov ax, word [bp-010h]                    ; 8b 46 f0
     mov word [bp-010h], ax                    ; 89 46 f0
     add word [bp-012h], strict byte 00002h    ; 83 46 ee 02
@@ -1523,20 +1582,20 @@ bios_printf_:                                ; 0xf1922 LB 0x23b
     mov ax, word [es:bx-002h]                 ; 26 8b 47 fe
     mov word [bp-00ch], ax                    ; 89 46 f4
     cmp dl, 078h                              ; 80 fa 78
-    je short 019a4h                           ; 74 05
+    je short 019f4h                           ; 74 05
     cmp dl, 058h                              ; 80 fa 58
-    jne short 019edh                          ; 75 49
+    jne short 01a3dh                          ; 75 49
     test si, si                               ; 85 f6
-    jne short 019abh                          ; 75 03
+    jne short 019fbh                          ; 75 03
     mov si, strict word 00004h                ; be 04 00
     cmp dl, 078h                              ; 80 fa 78
-    jne short 019b5h                          ; 75 05
+    jne short 01a05h                          ; 75 05
     mov di, strict word 00061h                ; bf 61 00
-    jmp short 019b8h                          ; eb 03
+    jmp short 01a08h                          ; eb 03
     mov di, strict word 00041h                ; bf 41 00
     lea bx, [si-001h]                         ; 8d 5c ff
     test bx, bx                               ; 85 db
-    jl near 01b2fh                            ; 0f 8c 6e 01
+    jl near 01b7fh                            ; 0f 8c 6e 01
     mov cx, bx                                ; 89 d9
     sal cx, 002h                              ; c1 e1 02
     mov ax, word [bp-00ch]                    ; 8b 46 f4
@@ -1544,29 +1603,29 @@ bios_printf_:                                ; 0xf1922 LB 0x23b
     xor ah, ah                                ; 30 e4
     and AL, strict byte 00fh                  ; 24 0f
     cmp ax, strict word 00009h                ; 3d 09 00
-    jnbe short 019dbh                         ; 77 07
+    jnbe short 01a2bh                         ; 77 07
     mov dx, ax                                ; 89 c2
     add dx, strict byte 00030h                ; 83 c2 30
-    jmp short 019e2h                          ; eb 07
+    jmp short 01a32h                          ; eb 07
     mov dx, ax                                ; 89 c2
     sub dx, strict byte 0000ah                ; 83 ea 0a
     add dx, di                                ; 01 fa
     xor dh, dh                                ; 30 f6
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 01775h                               ; e8 8b fd
+    call 017c5h                               ; e8 8b fd
     dec bx                                    ; 4b
-    jmp short 019bbh                          ; eb ce
+    jmp short 01a0bh                          ; eb ce
     cmp dl, 075h                              ; 80 fa 75
-    jne short 01a01h                          ; 75 0f
+    jne short 01a51h                          ; 75 0f
     xor cx, cx                                ; 31 c9
     mov bx, si                                ; 89 f3
     mov dx, ax                                ; 89 c2
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0180fh                               ; e8 11 fe
-    jmp near 01b2fh                           ; e9 2e 01
+    call 0185fh                               ; e8 11 fe
+    jmp near 01b7fh                           ; e9 2e 01
     lea bx, [si-001h]                         ; 8d 5c ff
     cmp dl, 06ch                              ; 80 fa 6c
-    jne near 01abdh                           ; 0f 85 b2 00
+    jne near 01b0dh                           ; 0f 85 b2 00
     inc word [bp+006h]                        ; ff 46 06
     mov di, word [bp+006h]                    ; 8b 7e 06
     mov dl, byte [di]                         ; 8a 15
@@ -1577,9 +1636,9 @@ bios_printf_:                                ; 0xf1922 LB 0x23b
     mov ax, word [es:di-002h]                 ; 26 8b 45 fe
     mov word [bp-00eh], ax                    ; 89 46 f2
     cmp dl, 064h                              ; 80 fa 64
-    jne short 01a59h                          ; 75 2d
+    jne short 01aa9h                          ; 75 2d
     test byte [bp-00dh], 080h                 ; f6 46 f3 80
-    je short 01a47h                           ; 74 15
+    je short 01a97h                           ; 74 15
     push strict byte 00001h                   ; 6a 01
     mov ax, word [bp-00ch]                    ; 8b 46 f4
     mov cx, word [bp-00eh]                    ; 8b 4e f2
@@ -1588,77 +1647,77 @@ bios_printf_:                                ; 0xf1922 LB 0x23b
     sbb cx, strict byte 00000h                ; 83 d9 00
     mov dx, bx                                ; 89 da
     mov bx, ax                                ; 89 c3
-    jmp short 01a50h                          ; eb 09
+    jmp short 01aa0h                          ; eb 09
     push strict byte 00000h                   ; 6a 00
     mov bx, word [bp-00ch]                    ; 8b 5e f4
     mov dx, si                                ; 89 f2
     mov cx, ax                                ; 89 c1
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0186fh                               ; e8 19 fe
-    jmp near 01b2fh                           ; e9 d6 00
+    call 018bfh                               ; e8 19 fe
+    jmp near 01b7fh                           ; e9 d6 00
     cmp dl, 075h                              ; 80 fa 75
-    jne short 01a60h                          ; 75 02
-    jmp short 01a47h                          ; eb e7
+    jne short 01ab0h                          ; 75 02
+    jmp short 01a97h                          ; eb e7
     cmp dl, 078h                              ; 80 fa 78
-    je short 01a6ch                           ; 74 07
+    je short 01abch                           ; 74 07
     cmp dl, 058h                              ; 80 fa 58
-    jne near 01b2fh                           ; 0f 85 c3 00
+    jne near 01b7fh                           ; 0f 85 c3 00
     test si, si                               ; 85 f6
-    jne short 01a73h                          ; 75 03
+    jne short 01ac3h                          ; 75 03
     mov si, strict word 00008h                ; be 08 00
     cmp dl, 078h                              ; 80 fa 78
-    jne short 01a7dh                          ; 75 05
+    jne short 01acdh                          ; 75 05
     mov di, strict word 00061h                ; bf 61 00
-    jmp short 01a80h                          ; eb 03
+    jmp short 01ad0h                          ; eb 03
     mov di, strict word 00041h                ; bf 41 00
     lea bx, [si-001h]                         ; 8d 5c ff
     test bx, bx                               ; 85 db
-    jl near 01b2fh                            ; 0f 8c a6 00
+    jl near 01b7fh                            ; 0f 8c a6 00
     mov ax, word [bp-00ch]                    ; 8b 46 f4
     mov cx, bx                                ; 89 d9
     sal cx, 002h                              ; c1 e1 02
     mov dx, word [bp-00eh]                    ; 8b 56 f2
-    jcxz 01a9ch                               ; e3 06
+    jcxz 01aech                               ; e3 06
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 01a96h                               ; e2 fa
+    loop 01ae6h                               ; e2 fa
     and ax, strict word 0000fh                ; 25 0f 00
     cmp ax, strict word 00009h                ; 3d 09 00
-    jnbe short 01aabh                         ; 77 07
+    jnbe short 01afbh                         ; 77 07
     mov dx, ax                                ; 89 c2
     add dx, strict byte 00030h                ; 83 c2 30
-    jmp short 01ab2h                          ; eb 07
+    jmp short 01b02h                          ; eb 07
     mov dx, ax                                ; 89 c2
     sub dx, strict byte 0000ah                ; 83 ea 0a
     add dx, di                                ; 01 fa
     xor dh, dh                                ; 30 f6
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 01775h                               ; e8 bb fc
+    call 017c5h                               ; e8 bb fc
     dec bx                                    ; 4b
-    jmp short 01a83h                          ; eb c6
+    jmp short 01ad3h                          ; eb c6
     cmp dl, 064h                              ; 80 fa 64
-    jne short 01adfh                          ; 75 1d
+    jne short 01b2fh                          ; 75 1d
     test byte [bp-00bh], 080h                 ; f6 46 f5 80
-    je short 01ad1h                           ; 74 09
+    je short 01b21h                           ; 74 09
     mov dx, ax                                ; 89 c2
     neg dx                                    ; f7 da
     mov cx, strict word 00001h                ; b9 01 00
-    jmp short 01ad7h                          ; eb 06
+    jmp short 01b27h                          ; eb 06
     xor cx, cx                                ; 31 c9
     mov bx, si                                ; 89 f3
     mov dx, ax                                ; 89 c2
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 017b0h                               ; e8 d3 fc
-    jmp short 01b2fh                          ; eb 50
+    call 01800h                               ; e8 d3 fc
+    jmp short 01b7fh                          ; eb 50
     cmp dl, 073h                              ; 80 fa 73
-    jne short 01af0h                          ; 75 0c
+    jne short 01b40h                          ; 75 0c
     mov cx, ds                                ; 8c d9
     mov bx, ax                                ; 89 c3
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 018e1h                               ; e8 f3 fd
-    jmp short 01b2fh                          ; eb 3f
+    call 01931h                               ; e8 f3 fd
+    jmp short 01b7fh                          ; eb 3f
     cmp dl, 053h                              ; 80 fa 53
-    jne short 01b13h                          ; 75 1e
+    jne short 01b63h                          ; 75 1e
     mov word [bp-00eh], ax                    ; 89 46 f2
     mov ax, word [bp-010h]                    ; 8b 46 f0
     mov word [bp-010h], ax                    ; 89 46 f0
@@ -1668,32 +1727,32 @@ bios_printf_:                                ; 0xf1922 LB 0x23b
     mov word [bp-00ch], ax                    ; 89 46 f4
     mov bx, ax                                ; 89 c3
     mov cx, word [bp-00eh]                    ; 8b 4e f2
-    jmp short 01ae8h                          ; eb d5
+    jmp short 01b38h                          ; eb d5
     cmp dl, 063h                              ; 80 fa 63
-    jne short 01b24h                          ; 75 0c
+    jne short 01b74h                          ; 75 0c
     movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 01775h                               ; e8 53 fc
-    jmp short 01b2fh                          ; eb 0b
+    call 017c5h                               ; e8 53 fc
+    jmp short 01b7fh                          ; eb 0b
     push 000e6h                               ; 68 e6 00
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 f6 fd
+    call 01972h                               ; e8 f6 fd
     add sp, strict byte 00004h                ; 83 c4 04
     xor cx, cx                                ; 31 c9
-    jmp short 01b3bh                          ; eb 08
+    jmp short 01b8bh                          ; eb 08
     xor dh, dh                                ; 30 f6
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 01775h                               ; e8 3a fc
+    call 017c5h                               ; e8 3a fc
     inc word [bp+006h]                        ; ff 46 06
-    jmp near 01950h                           ; e9 0f fe
+    jmp near 019a0h                           ; e9 0f fe
     xor ax, ax                                ; 31 c0
     mov word [bp-012h], ax                    ; 89 46 ee
     mov word [bp-010h], ax                    ; 89 46 f0
     test byte [bp+004h], 001h                 ; f6 46 04 01
-    je short 01b53h                           ; 74 04
+    je short 01ba3h                           ; 74 04
     cli                                       ; fa
     hlt                                       ; f4
-    jmp short 01b50h                          ; eb fd
+    jmp short 01ba0h                          ; eb fd
     lea sp, [bp-00ah]                         ; 8d 66 f6
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -1702,19 +1761,19 @@ bios_printf_:                                ; 0xf1922 LB 0x23b
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-_ata_init:                                   ; 0xf1b5d LB 0xc4
+_ata_init:                                   ; 0xf1bad LB 0xc4
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 b2 fa
+    call 0166ch                               ; e8 b2 fa
     mov si, 00122h                            ; be 22 01
     mov dx, ax                                ; 89 c2
     xor al, al                                ; 30 c0
-    jmp short 01b77h                          ; eb 04
+    jmp short 01bc7h                          ; eb 04
     cmp AL, strict byte 004h                  ; 3c 04
-    jnc short 01b9bh                          ; 73 24
+    jnc short 01bebh                          ; 73 24
     movzx bx, al                              ; 0f b6 d8
     imul bx, bx, strict byte 00006h           ; 6b db 06
     mov es, dx                                ; 8e c2
@@ -1725,11 +1784,11 @@ _ata_init:                                   ; 0xf1b5d LB 0xc4
     mov byte [es:bx+001c1h], 000h             ; 26 c6 87 c1 01 00
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
-    jmp short 01b73h                          ; eb d8
+    jmp short 01bc3h                          ; eb d8
     xor al, al                                ; 30 c0
-    jmp short 01ba3h                          ; eb 04
+    jmp short 01bf3h                          ; eb 04
     cmp AL, strict byte 008h                  ; 3c 08
-    jnc short 01beeh                          ; 73 4b
+    jnc short 01c3eh                          ; 73 4b
     movzx bx, al                              ; 0f b6 d8
     imul bx, bx, strict byte 00018h           ; 6b db 18
     mov es, dx                                ; 8e c2
@@ -1749,11 +1808,11 @@ _ata_init:                                   ; 0xf1b5d LB 0xc4
     ; mov dword [es:bx+032h], strict dword 000000000h ; 66 26 c7 47 32 00 00 00 00
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
-    jmp short 01b9fh                          ; eb b1
+    jmp short 01befh                          ; eb b1
     xor al, al                                ; 30 c0
-    jmp short 01bf6h                          ; eb 04
+    jmp short 01c46h                          ; eb 04
     cmp AL, strict byte 010h                  ; 3c 10
-    jnc short 01c0dh                          ; 73 17
+    jnc short 01c5dh                          ; 73 17
     movzx bx, al                              ; 0f b6 d8
     mov es, dx                                ; 8e c2
     add bx, si                                ; 01 f3
@@ -1761,7 +1820,7 @@ _ata_init:                                   ; 0xf1b5d LB 0xc4
     mov byte [es:bx+001b0h], 010h             ; 26 c6 87 b0 01 10
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
-    jmp short 01bf2h                          ; eb e5
+    jmp short 01c42h                          ; eb e5
     mov es, dx                                ; 8e c2
     mov byte [es:si+0019eh], 000h             ; 26 c6 84 9e 01 00
     mov byte [es:si+001afh], 000h             ; 26 c6 84 af 01 00
@@ -1769,7 +1828,7 @@ _ata_init:                                   ; 0xf1b5d LB 0xc4
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-ata_reset_:                                  ; 0xf1c21 LB 0xde
+ata_reset_:                                  ; 0xf1c71 LB 0xde
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -1782,7 +1841,7 @@ ata_reset_:                                  ; 0xf1c21 LB 0xde
     push ax                                   ; 50
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 e7 f9
+    call 0166ch                               ; e8 e7 f9
     mov word [bp-00eh], 00122h                ; c7 46 f2 22 01
     mov di, ax                                ; 89 c7
     mov bx, word [bp-010h]                    ; 8b 5e f0
@@ -1802,14 +1861,14 @@ ata_reset_:                                  ; 0xf1c21 LB 0xde
     mov bx, 000ffh                            ; bb ff 00
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 01c79h                          ; 76 0c
+    jbe short 01cc9h                          ; 76 0c
     mov dx, cx                                ; 89 ca
     add dx, strict byte 00007h                ; 83 c2 07
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 080h                 ; a8 80
-    je short 01c68h                           ; 74 ef
+    je short 01cb8h                           ; 74 ef
     lea dx, [si+006h]                         ; 8d 54 06
     mov AL, strict byte 00ah                  ; b0 0a
     out DX, AL                                ; ee
@@ -1817,11 +1876,11 @@ ata_reset_:                                  ; 0xf1c21 LB 0xde
     mov es, di                                ; 8e c7
     add bx, word [bp-00eh]                    ; 03 5e f2
     cmp byte [es:bx+01eh], 000h               ; 26 80 7f 1e 00
-    je short 01cdbh                           ; 74 4c
+    je short 01d2bh                           ; 74 4c
     cmp byte [bp-00ch], 000h                  ; 80 7e f4 00
-    je short 01c9ah                           ; 74 05
+    je short 01ceah                           ; 74 05
     mov ax, 000b0h                            ; b8 b0 00
-    jmp short 01c9dh                          ; eb 03
+    jmp short 01cedh                          ; eb 03
     mov ax, 000a0h                            ; b8 a0 00
     mov dx, cx                                ; 89 ca
     add dx, strict byte 00006h                ; 83 c2 06
@@ -1839,36 +1898,36 @@ ata_reset_:                                  ; 0xf1c21 LB 0xde
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp bl, 001h                              ; 80 fb 01
-    jne short 01cdbh                          ; 75 22
+    jne short 01d2bh                          ; 75 22
     cmp al, bl                                ; 38 d8
-    jne short 01cdbh                          ; 75 1e
+    jne short 01d2bh                          ; 75 1e
     mov bx, strict word 0ffffh                ; bb ff ff
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 01cdbh                          ; 76 16
+    jbe short 01d2bh                          ; 76 16
     mov dx, cx                                ; 89 ca
     add dx, strict byte 00007h                ; 83 c2 07
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 080h                 ; a8 80
-    je short 01cdbh                           ; 74 0a
+    je short 01d2bh                           ; 74 0a
     mov ax, strict word 0ffffh                ; b8 ff ff
     dec ax                                    ; 48
     test ax, ax                               ; 85 c0
-    jnbe short 01cd4h                         ; 77 fb
-    jmp short 01cc0h                          ; eb e5
+    jnbe short 01d24h                         ; 77 fb
+    jmp short 01d10h                          ; eb e5
     mov bx, strict word 00010h                ; bb 10 00
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 01cefh                          ; 76 0c
+    jbe short 01d3fh                          ; 76 0c
     mov dx, cx                                ; 89 ca
     add dx, strict byte 00007h                ; 83 c2 07
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 040h                 ; a8 40
-    je short 01cdeh                           ; 74 ef
+    je short 01d2eh                           ; 74 ef
     lea dx, [si+006h]                         ; 8d 54 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
@@ -1880,7 +1939,7 @@ ata_reset_:                                  ; 0xf1c21 LB 0xde
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
+ata_cmd_data_in_:                            ; 0xf1d4f LB 0x258
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -1911,30 +1970,30 @@ ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
     mov ax, word [es:di+024h]                 ; 26 8b 45 24
     mov word [bp-00ch], ax                    ; 89 46 f4
     test ax, ax                               ; 85 c0
-    jne short 01d67h                          ; 75 14
+    jne short 01db7h                          ; 75 14
     cmp byte [bp-006h], 001h                  ; 80 7e fa 01
-    jne short 01d60h                          ; 75 07
+    jne short 01db0h                          ; 75 07
     mov word [bp-00ch], 04000h                ; c7 46 f4 00 40
-    jmp short 01d76h                          ; eb 16
+    jmp short 01dc6h                          ; eb 16
     mov word [bp-00ch], 08000h                ; c7 46 f4 00 80
-    jmp short 01d76h                          ; eb 0f
+    jmp short 01dc6h                          ; eb 0f
     cmp byte [bp-006h], 001h                  ; 80 7e fa 01
-    jne short 01d73h                          ; 75 06
+    jne short 01dc3h                          ; 75 06
     shr word [bp-00ch], 002h                  ; c1 6e f4 02
-    jmp short 01d76h                          ; eb 03
+    jmp short 01dc6h                          ; eb 03
     shr word [bp-00ch], 1                     ; d1 6e f4
     lea dx, [bx+007h]                         ; 8d 57 07
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 080h                 ; a8 80
-    je short 01d8fh                           ; 74 0f
+    je short 01ddfh                           ; 74 0f
     mov dx, word [bp-01ch]                    ; 8b 56 e4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00001h                ; ba 01 00
-    jmp near 01f4eh                           ; e9 bf 01
+    jmp near 01f9eh                           ; e9 bf 01
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov ax, word [es:si]                      ; 26 8b 04
     mov word [bp-020h], ax                    ; 89 46 e0
@@ -1951,13 +2010,13 @@ ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
     mov word [bp-018h], ax                    ; 89 46 e8
     mov ax, word [bp-010h]                    ; 8b 46 f0
     test ax, ax                               ; 85 c0
-    jne short 01e2dh                          ; 75 67
+    jne short 01e7dh                          ; 75 67
     mov dx, word [bp-020h]                    ; 8b 56 e0
     add dx, word [bp-014h]                    ; 03 56 ec
     adc ax, word [bp-01eh]                    ; 13 46 e2
     cmp ax, 01000h                            ; 3d 00 10
-    jnbe short 01dd6h                         ; 77 02
-    jne short 01e01h                          ; 75 2b
+    jnbe short 01e26h                         ; 77 02
+    jne short 01e51h                          ; 75 2b
     mov ax, word [bp-01eh]                    ; 8b 46 e2
     xor al, al                                ; 30 c0
     shr ax, 008h                              ; c1 e8 08
@@ -1982,7 +2041,7 @@ ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
     mov cx, strict word 00008h                ; b9 08 00
     shr word [bp-01eh], 1                     ; d1 6e e2
     rcr word [bp-020h], 1                     ; d1 5e e0
-    loop 01e0ch                               ; e2 f8
+    loop 01e5ch                               ; e2 f8
     mov ax, word [bp-020h]                    ; 8b 46 e0
     mov word [bp-012h], ax                    ; 89 46 ee
     mov ax, word [bp-01eh]                    ; 8b 46 e2
@@ -2011,9 +2070,9 @@ ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
     lea dx, [bx+005h]                         ; 8d 57 05
     out DX, AL                                ; ee
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    je short 01e63h                           ; 74 05
+    je short 01eb3h                           ; 74 05
     mov ax, 000b0h                            ; b8 b0 00
-    jmp short 01e66h                          ; eb 03
+    jmp short 01eb6h                          ; eb 03
     mov ax, 000a0h                            ; b8 a0 00
     movzx dx, byte [bp-018h]                  ; 0f b6 56 e8
     or ax, dx                                 ; 09 d0
@@ -2024,13 +2083,13 @@ ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
     out DX, AL                                ; ee
     mov ax, word [bp-016h]                    ; 8b 46 ea
     cmp ax, 000c4h                            ; 3d c4 00
-    je short 01e84h                           ; 74 05
+    je short 01ed4h                           ; 74 05
     cmp ax, strict word 00029h                ; 3d 29 00
-    jne short 01e91h                          ; 75 0d
+    jne short 01ee1h                          ; 75 0d
     mov ax, word [bp-014h]                    ; 8b 46 ec
     mov word [bp-01ah], ax                    ; 89 46 e6
     mov word [bp-014h], strict word 00001h    ; c7 46 ec 01 00
-    jmp short 01e96h                          ; eb 05
+    jmp short 01ee6h                          ; eb 05
     mov word [bp-01ah], strict word 00001h    ; c7 46 e6 01 00
     lea dx, [bx+007h]                         ; 8d 57 07
     in AL, DX                                 ; ec
@@ -2038,38 +2097,38 @@ ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
     ; sub ah, ah                                ; 2a e4
     mov dl, al                                ; 88 c2
     test AL, strict byte 080h                 ; a8 80
-    jne short 01e96h                          ; 75 f4
+    jne short 01ee6h                          ; 75 f4
     test AL, strict byte 001h                 ; a8 01
-    je short 01eb5h                           ; 74 0f
+    je short 01f05h                           ; 74 0f
     mov dx, word [bp-01ch]                    ; 8b 56 e4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00002h                ; ba 02 00
-    jmp near 01f4eh                           ; e9 99 00
+    jmp near 01f9eh                           ; e9 99 00
     test dl, 008h                             ; f6 c2 08
-    jne short 01ec9h                          ; 75 0f
+    jne short 01f19h                          ; 75 0f
     mov dx, word [bp-01ch]                    ; 8b 56 e4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00003h                ; ba 03 00
-    jmp near 01f4eh                           ; e9 85 00
+    jmp near 01f9eh                           ; e9 85 00
     sti                                       ; fb
     cmp di, 0f800h                            ; 81 ff 00 f8
-    jc short 01eddh                           ; 72 0d
+    jc short 01f2dh                           ; 72 0d
     sub di, 00800h                            ; 81 ef 00 08
     mov ax, word [bp-00eh]                    ; 8b 46 f2
     add ax, 00080h                            ; 05 80 00
     mov word [bp-00eh], ax                    ; 89 46 f2
     cmp byte [bp-006h], 001h                  ; 80 7e fa 01
-    jne short 01ef0h                          ; 75 0d
+    jne short 01f40h                          ; 75 0d
     mov dx, bx                                ; 89 da
     mov cx, word [bp-00ch]                    ; 8b 4e f4
     mov es, [bp-00eh]                         ; 8e 46 f2
     db  0f3h, 066h, 06dh
     ; rep insd                                  ; f3 66 6d
-    jmp short 01efah                          ; eb 0a
+    jmp short 01f4ah                          ; eb 0a
     mov dx, bx                                ; 89 da
     mov cx, word [bp-00ch]                    ; 8b 4e f4
     mov es, [bp-00eh]                         ; 8e 46 f2
@@ -2084,28 +2143,28 @@ ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
     ; sub ah, ah                                ; 2a e4
     mov dl, al                                ; 88 c2
     test AL, strict byte 080h                 ; a8 80
-    jne short 01f07h                          ; 75 f4
+    jne short 01f57h                          ; 75 f4
     cmp word [bp-014h], strict byte 00000h    ; 83 7e ec 00
-    jne short 01f2dh                          ; 75 14
+    jne short 01f7dh                          ; 75 14
     and AL, strict byte 0c9h                  ; 24 c9
     cmp AL, strict byte 040h                  ; 3c 40
-    je short 01f43h                           ; 74 24
+    je short 01f93h                           ; 74 24
     mov dx, word [bp-01ch]                    ; 8b 56 e4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00004h                ; ba 04 00
-    jmp short 01f4eh                          ; eb 21
+    jmp short 01f9eh                          ; eb 21
     mov al, dl                                ; 88 d0
     and AL, strict byte 0c9h                  ; 24 c9
     cmp AL, strict byte 048h                  ; 3c 48
-    je short 01ecah                           ; 74 95
+    je short 01f1ah                           ; 74 95
     mov dx, word [bp-01ch]                    ; 8b 56 e4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00005h                ; ba 05 00
-    jmp short 01f4eh                          ; eb 0b
+    jmp short 01f9eh                          ; eb 0b
     mov dx, word [bp-01ch]                    ; 8b 56 e4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
@@ -2117,7 +2176,7 @@ ata_cmd_data_in_:                            ; 0xf1cff LB 0x258
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-_ata_detect:                                 ; 0xf1f57 LB 0x617
+_ata_detect:                                 ; 0xf1fa7 LB 0x617
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -2125,7 +2184,7 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     sub sp, 0025ch                            ; 81 ec 5c 02
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 b3 f6
+    call 0166ch                               ; e8 b3 f6
     mov word [bp-024h], ax                    ; 89 46 dc
     mov di, 00122h                            ; bf 22 01
     mov es, ax                                ; 8e c0
@@ -2143,7 +2202,7 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov byte [bp-00ah], al                    ; 88 46 f6
     mov byte [bp-006h], al                    ; 88 46 fa
     mov byte [bp-00eh], al                    ; 88 46 f2
-    jmp near 024f9h                           ; e9 48 05
+    jmp near 02549h                           ; e9 48 05
     mov ax, 000a0h                            ; b8 a0 00
     lea dx, [si+006h]                         ; 8d 54 06
     out DX, AL                                ; ee
@@ -2175,20 +2234,20 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp cl, 055h                              ; 80 f9 55
-    jne near 020abh                           ; 0f 85 c0 00
+    jne near 020fbh                           ; 0f 85 c0 00
     cmp AL, strict byte 0aah                  ; 3c aa
-    jne near 020abh                           ; 0f 85 ba 00
+    jne near 020fbh                           ; 0f 85 ba 00
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     les bx, [bp-028h]                         ; c4 5e d8
     add bx, ax                                ; 01 c3
     mov byte [es:bx+01eh], 001h               ; 26 c6 47 1e 01
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 01c21h                               ; e8 18 fc
+    call 01c71h                               ; e8 18 fc
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    je short 02014h                           ; 74 05
+    je short 02064h                           ; 74 05
     mov ax, 000b0h                            ; b8 b0 00
-    jmp short 02017h                          ; eb 03
+    jmp short 02067h                          ; eb 03
     mov ax, 000a0h                            ; b8 a0 00
     lea dx, [si+006h]                         ; 8d 54 06
     out DX, AL                                ; ee
@@ -2202,9 +2261,9 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp bl, 001h                              ; 80 fb 01
-    jne near 020abh                           ; 0f 85 7b 00
+    jne near 020fbh                           ; 0f 85 7b 00
     cmp al, bl                                ; 38 d8
-    jne near 020abh                           ; 0f 85 75 00
+    jne near 020fbh                           ; 0f 85 75 00
     lea dx, [si+004h]                         ; 8d 54 04
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -2222,31 +2281,31 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp bl, 014h                              ; 80 fb 14
-    jne short 0206eh                          ; 75 18
+    jne short 020beh                          ; 75 18
     cmp cl, 0ebh                              ; 80 f9 eb
-    jne short 0206eh                          ; 75 13
+    jne short 020beh                          ; 75 13
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     les bx, [bp-028h]                         ; c4 5e d8
     add bx, ax                                ; 01 c3
     mov byte [es:bx+01eh], 003h               ; 26 c6 47 1e 03
-    jmp short 020abh                          ; eb 3d
+    jmp short 020fbh                          ; eb 3d
     test bh, bh                               ; 84 ff
-    jne short 02090h                          ; 75 1e
+    jne short 020e0h                          ; 75 1e
     cmp byte [bp-00ch], 000h                  ; 80 7e f4 00
-    jne short 02090h                          ; 75 18
+    jne short 020e0h                          ; 75 18
     test al, al                               ; 84 c0
-    je short 02090h                           ; 74 14
+    je short 020e0h                           ; 74 14
     movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
     imul bx, bx, strict byte 00018h           ; 6b db 18
     mov es, [bp-026h]                         ; 8e 46 da
     add bx, word [bp-028h]                    ; 03 5e d8
     mov byte [es:bx+01eh], 002h               ; 26 c6 47 1e 02
-    jmp short 020abh                          ; eb 1b
+    jmp short 020fbh                          ; eb 1b
     cmp bh, 0ffh                              ; 80 ff ff
-    jne short 020abh                          ; 75 16
+    jne short 020fbh                          ; 75 16
     cmp bh, byte [bp-00ch]                    ; 3a 7e f4
-    jne short 020abh                          ; 75 11
+    jne short 020fbh                          ; 75 11
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     les bx, [bp-028h]                         ; c4 5e d8
@@ -2263,7 +2322,7 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov al, byte [es:si+01eh]                 ; 26 8a 44 1e
     mov byte [bp-010h], al                    ; 88 46 f0
     cmp AL, strict byte 002h                  ; 3c 02
-    jne near 022d1h                           ; 0f 85 03 02
+    jne near 02321h                           ; 0f 85 03 02
     mov byte [es:si+01fh], 0ffh               ; 26 c6 44 1f ff
     mov byte [es:si+022h], 000h               ; 26 c6 44 22 00
     lea dx, [bp-00260h]                       ; 8d 96 a0 fd
@@ -2276,12 +2335,12 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov bx, 000ech                            ; bb ec 00
     mov ax, word [bp-028h]                    ; 8b 46 d8
     mov dx, es                                ; 8c c2
-    call 01cffh                               ; e8 03 fc
+    call 01d4fh                               ; e8 03 fc
     test ax, ax                               ; 85 c0
-    je short 0210bh                           ; 74 0b
+    je short 0215bh                           ; 74 0b
     push 00104h                               ; 68 04 01
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 1a f8
+    call 01972h                               ; e8 1a f8
     add sp, strict byte 00004h                ; 83 c4 04
     test byte [bp-00260h], 080h               ; f6 86 a0 fd 80
     db  00fh, 095h, 0c0h
@@ -2304,65 +2363,65 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov word [bp-020h], ax                    ; 89 46 e0
     mov si, word [bp-001e6h]                  ; 8b b6 1a fe
     cmp si, 00fffh                            ; 81 fe ff 0f
-    jne short 02160h                          ; 75 10
+    jne short 021b0h                          ; 75 10
     cmp ax, strict word 0ffffh                ; 3d ff ff
-    jne short 02160h                          ; 75 0b
+    jne short 021b0h                          ; 75 0b
     mov ax, word [bp-00198h]                  ; 8b 86 68 fe
     mov word [bp-020h], ax                    ; 89 46 e0
     mov si, word [bp-00196h]                  ; 8b b6 6a fe
     mov al, byte [bp-00eh]                    ; 8a 46 f2
     cmp AL, strict byte 001h                  ; 3c 01
-    jc short 02173h                           ; 72 0c
-    jbe short 0217bh                          ; 76 12
+    jc short 021c3h                           ; 72 0c
+    jbe short 021cbh                          ; 76 12
     cmp AL, strict byte 003h                  ; 3c 03
-    je short 02183h                           ; 74 16
+    je short 021d3h                           ; 74 16
     cmp AL, strict byte 002h                  ; 3c 02
-    je short 0217fh                           ; 74 0e
-    jmp short 021c0h                          ; eb 4d
+    je short 021cfh                           ; 74 0e
+    jmp short 02210h                          ; eb 4d
     test al, al                               ; 84 c0
-    jne short 021c0h                          ; 75 49
+    jne short 02210h                          ; 75 49
     mov BL, strict byte 01eh                  ; b3 1e
-    jmp short 02185h                          ; eb 0a
+    jmp short 021d5h                          ; eb 0a
     mov BL, strict byte 026h                  ; b3 26
-    jmp short 02185h                          ; eb 06
+    jmp short 021d5h                          ; eb 06
     mov BL, strict byte 067h                  ; b3 67
-    jmp short 02185h                          ; eb 02
+    jmp short 021d5h                          ; eb 02
     mov BL, strict byte 070h                  ; b3 70
     mov al, bl                                ; 88 d8
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     xor ah, ah                                ; 30 e4
-    call 0165ch                               ; e8 ce f4
+    call 016ach                               ; e8 ce f4
     xor ah, ah                                ; 30 e4
     mov dx, ax                                ; 89 c2
     sal dx, 008h                              ; c1 e2 08
     movzx ax, bl                              ; 0f b6 c3
-    call 0165ch                               ; e8 c1 f4
+    call 016ach                               ; e8 c1 f4
     xor ah, ah                                ; 30 e4
     add ax, dx                                ; 01 d0
     mov word [bp-034h], ax                    ; 89 46 cc
     mov al, bl                                ; 88 d8
     add AL, strict byte 002h                  ; 04 02
     xor ah, ah                                ; 30 e4
-    call 0165ch                               ; e8 b1 f4
+    call 016ach                               ; e8 b1 f4
     xor ah, ah                                ; 30 e4
     mov word [bp-036h], ax                    ; 89 46 ca
     mov al, bl                                ; 88 d8
     add AL, strict byte 007h                  ; 04 07
     xor ah, ah                                ; 30 e4
-    call 0165ch                               ; e8 a3 f4
+    call 016ach                               ; e8 a3 f4
     xor ah, ah                                ; 30 e4
     mov word [bp-032h], ax                    ; 89 46 ce
-    jmp short 021cdh                          ; eb 0d
+    jmp short 0221dh                          ; eb 0d
     mov bx, word [bp-020h]                    ; 8b 5e e0
     mov cx, si                                ; 89 f1
     mov dx, ss                                ; 8c d2
     lea ax, [bp-036h]                         ; 8d 46 ca
-    call 0532eh                               ; e8 61 31
-    mov bx, 00dbah                            ; bb ba 0d
+    call 055b6h                               ; e8 99 33
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 09 f7
+    call 01931h                               ; e8 09 f7
     mov ax, word [bp-032h]                    ; 8b 46 ce
     push ax                                   ; 50
     mov ax, word [bp-036h]                    ; 8b 46 ca
@@ -2378,7 +2437,7 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     push ax                                   ; 50
     push 0012dh                               ; 68 2d 01
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 23 f7
+    call 01972h                               ; e8 23 f7
     add sp, strict byte 00014h                ; 83 c4 14
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
@@ -2411,11 +2470,11 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     pop DS                                    ; 1f
     mov al, byte [bp-00eh]                    ; 8a 46 f2
     cmp AL, strict byte 002h                  ; 3c 02
-    jnc short 022bch                          ; 73 60
+    jnc short 0230ch                          ; 73 60
     test al, al                               ; 84 c0
-    jne short 02265h                          ; 75 05
+    jne short 022b5h                          ; 75 05
     mov di, strict word 0003dh                ; bf 3d 00
-    jmp short 02268h                          ; eb 03
+    jmp short 022b8h                          ; eb 03
     mov di, strict word 0004dh                ; bf 4d 00
     mov dx, word [bp-024h]                    ; 8b 56 dc
     mov ax, word [bp-034h]                    ; 8b 46 cc
@@ -2434,16 +2493,16 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov byte [es:di+00eh], al                 ; 26 88 45 0e
     xor al, al                                ; 30 c0
     xor ah, ah                                ; 30 e4
-    jmp short 022a6h                          ; eb 05
+    jmp short 022f6h                          ; eb 05
     cmp ah, 00fh                              ; 80 fc 0f
-    jnc short 022b4h                          ; 73 0e
+    jnc short 02304h                          ; 73 0e
     movzx bx, ah                              ; 0f b6 dc
     mov es, dx                                ; 8e c2
     add bx, di                                ; 01 fb
     add al, byte [es:bx]                      ; 26 02 07
     db  0feh, 0c4h
     ; inc ah                                    ; fe c4
-    jmp short 022a1h                          ; eb ed
+    jmp short 022f1h                          ; eb ed
     neg al                                    ; f6 d8
     mov es, dx                                ; 8e c2
     mov byte [es:di+00fh], al                 ; 26 88 45 0f
@@ -2454,7 +2513,7 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov byte [es:bx+0019fh], al               ; 26 88 87 9f 01
     inc byte [bp-006h]                        ; fe 46 fa
     cmp byte [bp-010h], 003h                  ; 80 7e f0 03
-    jne near 02371h                           ; 0f 85 98 00
+    jne near 023c1h                           ; 0f 85 98 00
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     les bx, [bp-028h]                         ; c4 5e d8
@@ -2471,12 +2530,12 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov bx, 000a1h                            ; bb a1 00
     mov ax, word [bp-028h]                    ; 8b 46 d8
     mov dx, es                                ; 8c c2
-    call 01cffh                               ; e8 ec f9
+    call 01d4fh                               ; e8 ec f9
     test ax, ax                               ; 85 c0
-    je short 02322h                           ; 74 0b
+    je short 02372h                           ; 74 0b
     push 00154h                               ; 68 54 01
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 03 f6
+    call 01972h                               ; e8 03 f6
     add sp, strict byte 00004h                ; 83 c4 04
     mov cl, byte [bp-0025fh]                  ; 8a 8e a1 fd
     and cl, 01fh                              ; 80 e1 1f
@@ -2505,9 +2564,9 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     inc byte [bp-00ah]                        ; fe 46 f6
     mov al, byte [bp-010h]                    ; 8a 46 f0
     cmp AL, strict byte 003h                  ; 3c 03
-    je short 023a4h                           ; 74 2c
+    je short 023f4h                           ; 74 2c
     cmp AL, strict byte 002h                  ; 3c 02
-    jne near 02407h                           ; 0f 85 89 00
+    jne near 02457h                           ; 0f 85 89 00
     movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
     imul bx, bx, strict byte 00018h           ; 6b db 18
     mov es, [bp-026h]                         ; 8e 46 da
@@ -2519,25 +2578,25 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov cx, strict word 0000bh                ; b9 0b 00
     shr word [bp-02eh], 1                     ; d1 6e d2
     rcr word [bp-030h], 1                     ; d1 5e d0
-    loop 0239ch                               ; e2 f8
+    loop 023ech                               ; e2 f8
     movzx dx, byte [bp-001bfh]                ; 0f b6 96 41 fe
     sal dx, 008h                              ; c1 e2 08
     movzx ax, byte [bp-001c0h]                ; 0f b6 86 40 fe
     or dx, ax                                 ; 09 c2
     mov byte [bp-012h], 00fh                  ; c6 46 ee 0f
-    jmp short 023c2h                          ; eb 09
+    jmp short 02412h                          ; eb 09
     dec byte [bp-012h]                        ; fe 4e ee
     cmp byte [bp-012h], 000h                  ; 80 7e ee 00
-    jbe short 023cfh                          ; 76 0d
+    jbe short 0241fh                          ; 76 0d
     movzx cx, byte [bp-012h]                  ; 0f b6 4e ee
     mov ax, strict word 00001h                ; b8 01 00
     sal ax, CL                                ; d3 e0
     test dx, ax                               ; 85 c2
-    je short 023b9h                           ; 74 ea
+    je short 02409h                           ; 74 ea
     xor di, di                                ; 31 ff
-    jmp short 023d8h                          ; eb 05
+    jmp short 02428h                          ; eb 05
     cmp di, strict byte 00014h                ; 83 ff 14
-    jnl short 023edh                          ; 7d 15
+    jnl short 0243dh                          ; 7d 15
     mov si, di                                ; 89 fe
     add si, di                                ; 01 fe
     mov al, byte [bp+si-00229h]               ; 8a 82 d7 fd
@@ -2545,111 +2604,111 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov al, byte [bp+si-0022ah]               ; 8a 82 d6 fd
     mov byte [bp+si-05fh], al                 ; 88 42 a1
     inc di                                    ; 47
-    jmp short 023d3h                          ; eb e6
+    jmp short 02423h                          ; eb e6
     mov byte [bp-038h], 000h                  ; c6 46 c8 00
     mov di, strict word 00027h                ; bf 27 00
-    jmp short 023fbh                          ; eb 05
+    jmp short 0244bh                          ; eb 05
     dec di                                    ; 4f
     test di, di                               ; 85 ff
-    jle short 02407h                          ; 7e 0c
+    jle short 02457h                          ; 7e 0c
     cmp byte [bp+di-060h], 020h               ; 80 7b a0 20
-    jne short 02407h                          ; 75 06
+    jne short 02457h                          ; 75 06
     mov byte [bp+di-060h], 000h               ; c6 43 a0 00
-    jmp short 023f6h                          ; eb ef
+    jmp short 02446h                          ; eb ef
     mov al, byte [bp-010h]                    ; 8a 46 f0
     cmp AL, strict byte 003h                  ; 3c 03
-    je short 0246ah                           ; 74 5c
+    je short 024bah                           ; 74 5c
     cmp AL, strict byte 002h                  ; 3c 02
-    je short 0241bh                           ; 74 09
+    je short 0246bh                           ; 74 09
     cmp AL, strict byte 001h                  ; 3c 01
-    je near 024d1h                            ; 0f 84 b9 00
-    jmp near 024f0h                           ; e9 d5 00
+    je near 02521h                            ; 0f 84 b9 00
+    jmp near 02540h                           ; e9 d5 00
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    je short 02426h                           ; 74 05
+    je short 02476h                           ; 74 05
     mov ax, 0017fh                            ; b8 7f 01
-    jmp short 02429h                          ; eb 03
+    jmp short 02479h                          ; eb 03
     mov ax, 00186h                            ; b8 86 01
     push ax                                   ; 50
     movzx ax, byte [bp-018h]                  ; 0f b6 46 e8
     push ax                                   ; 50
     push 0018dh                               ; 68 8d 01
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 eb f4
+    call 01972h                               ; e8 eb f4
     add sp, strict byte 00008h                ; 83 c4 08
     xor di, di                                ; 31 ff
     movzx ax, byte [bp+di-060h]               ; 0f b6 43 a0
     inc di                                    ; 47
     test ax, ax                               ; 85 c0
-    je short 02453h                           ; 74 0e
+    je short 024a3h                           ; 74 0e
     push ax                                   ; 50
     push 00198h                               ; 68 98 01
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 d4 f4
+    call 01972h                               ; e8 d4 f4
     add sp, strict byte 00006h                ; 83 c4 06
-    jmp short 0243ch                          ; eb e9
+    jmp short 0248ch                          ; eb e9
     push dword [bp-030h]                      ; 66 ff 76 d0
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
     push ax                                   ; 50
     push 0019bh                               ; 68 9b 01
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 be f4
+    call 01972h                               ; e8 be f4
     add sp, strict byte 0000ah                ; 83 c4 0a
-    jmp near 024f0h                           ; e9 86 00
+    jmp near 02540h                           ; e9 86 00
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    je short 02475h                           ; 74 05
+    je short 024c5h                           ; 74 05
     mov ax, 0017fh                            ; b8 7f 01
-    jmp short 02478h                          ; eb 03
+    jmp short 024c8h                          ; eb 03
     mov ax, 00186h                            ; b8 86 01
     push ax                                   ; 50
     movzx ax, byte [bp-018h]                  ; 0f b6 46 e8
     push ax                                   ; 50
     push 0018dh                               ; 68 8d 01
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 9c f4
+    call 01972h                               ; e8 9c f4
     add sp, strict byte 00008h                ; 83 c4 08
     xor di, di                                ; 31 ff
     movzx ax, byte [bp+di-060h]               ; 0f b6 43 a0
     inc di                                    ; 47
     test ax, ax                               ; 85 c0
-    je short 024a2h                           ; 74 0e
+    je short 024f2h                           ; 74 0e
     push ax                                   ; 50
     push 00198h                               ; 68 98 01
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 85 f4
+    call 01972h                               ; e8 85 f4
     add sp, strict byte 00006h                ; 83 c4 06
-    jmp short 0248bh                          ; eb e9
+    jmp short 024dbh                          ; eb e9
     movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     les bx, [bp-028h]                         ; c4 5e d8
     add bx, ax                                ; 01 c3
     cmp byte [es:bx+01fh], 005h               ; 26 80 7f 1f 05
-    jne short 024bfh                          ; 75 0a
+    jne short 0250fh                          ; 75 0a
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
     push ax                                   ; 50
     push 001bbh                               ; 68 bb 01
-    jmp short 024c7h                          ; eb 08
+    jmp short 02517h                          ; eb 08
     movzx ax, byte [bp-012h]                  ; 0f b6 46 ee
     push ax                                   ; 50
     push 001d5h                               ; 68 d5 01
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 56 f4
+    call 01972h                               ; e8 56 f4
     add sp, strict byte 00006h                ; 83 c4 06
-    jmp short 024f0h                          ; eb 1f
+    jmp short 02540h                          ; eb 1f
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    je short 024dch                           ; 74 05
+    je short 0252ch                           ; 74 05
     mov ax, 0017fh                            ; b8 7f 01
-    jmp short 024dfh                          ; eb 03
+    jmp short 0252fh                          ; eb 03
     mov ax, 00186h                            ; b8 86 01
     push ax                                   ; 50
     movzx ax, byte [bp-018h]                  ; 0f b6 46 e8
     push ax                                   ; 50
     push 001e7h                               ; 68 e7 01
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 35 f4
+    call 01972h                               ; e8 35 f4
     add sp, strict byte 00008h                ; 83 c4 08
     inc byte [bp-00eh]                        ; fe 46 f2
     cmp byte [bp-00eh], 008h                  ; 80 7e f2 08
-    jnc short 02547h                          ; 73 4e
+    jnc short 02597h                          ; 73 4e
     movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
     mov ax, bx                                ; 89 d8
     cwd                                       ; 99
@@ -2677,9 +2736,9 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     mov AL, strict byte 00ah                  ; b0 0a
     out DX, AL                                ; ee
     test cl, cl                               ; 84 c9
-    je near 01fb1h                            ; 0f 84 70 fa
+    je near 02001h                            ; 0f 84 70 fa
     mov ax, 000b0h                            ; b8 b0 00
-    jmp near 01fb4h                           ; e9 6d fa
+    jmp near 02004h                           ; e9 6d fa
     mov al, byte [bp-006h]                    ; 8a 46 fa
     les bx, [bp-028h]                         ; c4 5e d8
     mov byte [es:bx+0019eh], al               ; 26 88 87 9e 01
@@ -2688,13 +2747,13 @@ _ata_detect:                                 ; 0xf1f57 LB 0x617
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     mov dx, strict word 00075h                ; ba 75 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 a7 f0
+    call 0165eh                               ; e8 a7 f0
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
+ata_cmd_data_out_:                           ; 0xf25be LB 0x21a
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -2723,22 +2782,22 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     mov al, byte [es:si+022h]                 ; 26 8a 44 22
     mov byte [bp-008h], al                    ; 88 46 f8
     cmp AL, strict byte 001h                  ; 3c 01
-    jne short 025c2h                          ; 75 07
+    jne short 02612h                          ; 75 07
     mov word [bp-012h], 00080h                ; c7 46 ee 80 00
-    jmp short 025c7h                          ; eb 05
+    jmp short 02617h                          ; eb 05
     mov word [bp-012h], 00100h                ; c7 46 ee 00 01
     lea dx, [bx+007h]                         ; 8d 57 07
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 080h                 ; a8 80
-    je short 025e0h                           ; 74 0f
+    je short 02630h                           ; 74 0f
     mov dx, word [bp-00ch]                    ; 8b 56 f4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00001h                ; ba 01 00
-    jmp near 0277fh                           ; e9 9f 01
+    jmp near 027cfh                           ; e9 9f 01
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov ax, word [es:di]                      ; 26 8b 05
     mov word [bp-01eh], ax                    ; 89 46 e2
@@ -2755,13 +2814,13 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     mov word [bp-014h], ax                    ; 89 46 ec
     mov ax, word [bp-010h]                    ; 8b 46 f0
     test ax, ax                               ; 85 c0
-    jne short 0267eh                          ; 75 67
+    jne short 026ceh                          ; 75 67
     mov dx, word [bp-01eh]                    ; 8b 56 e2
     add dx, word [bp-00eh]                    ; 03 56 f2
     adc ax, word [bp-01ch]                    ; 13 46 e4
     cmp ax, 01000h                            ; 3d 00 10
-    jnbe short 02627h                         ; 77 02
-    jne short 02652h                          ; 75 2b
+    jnbe short 02677h                         ; 77 02
+    jne short 026a2h                          ; 75 2b
     mov ax, word [bp-01ch]                    ; 8b 46 e4
     xor al, al                                ; 30 c0
     shr ax, 008h                              ; c1 e8 08
@@ -2786,7 +2845,7 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     mov cx, strict word 00008h                ; b9 08 00
     shr word [bp-01ch], 1                     ; d1 6e e4
     rcr word [bp-01eh], 1                     ; d1 5e e2
-    loop 0265dh                               ; e2 f8
+    loop 026adh                               ; e2 f8
     mov ax, word [bp-01eh]                    ; 8b 46 e2
     mov word [bp-016h], ax                    ; 89 46 ea
     mov ax, word [bp-01ch]                    ; 8b 46 e4
@@ -2815,9 +2874,9 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     lea dx, [bx+005h]                         ; 8d 57 05
     out DX, AL                                ; ee
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    je short 026b4h                           ; 74 05
+    je short 02704h                           ; 74 05
     mov ax, 000b0h                            ; b8 b0 00
-    jmp short 026b7h                          ; eb 03
+    jmp short 02707h                          ; eb 03
     mov ax, 000a0h                            ; b8 a0 00
     movzx dx, byte [bp-014h]                  ; 0f b6 56 ec
     or ax, dx                                 ; 09 d0
@@ -2832,38 +2891,38 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     ; sub ah, ah                                ; 2a e4
     mov dl, al                                ; 88 c2
     test AL, strict byte 080h                 ; a8 80
-    jne short 026c8h                          ; 75 f4
+    jne short 02718h                          ; 75 f4
     test AL, strict byte 001h                 ; a8 01
-    je short 026e7h                           ; 74 0f
+    je short 02737h                           ; 74 0f
     mov dx, word [bp-00ch]                    ; 8b 56 f4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00002h                ; ba 02 00
-    jmp near 0277fh                           ; e9 98 00
+    jmp near 027cfh                           ; e9 98 00
     test dl, 008h                             ; f6 c2 08
-    jne short 026fbh                          ; 75 0f
+    jne short 0274bh                          ; 75 0f
     mov dx, word [bp-00ch]                    ; 8b 56 f4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00003h                ; ba 03 00
-    jmp near 0277fh                           ; e9 84 00
+    jmp near 027cfh                           ; e9 84 00
     sti                                       ; fb
     cmp si, 0f800h                            ; 81 fe 00 f8
-    jc short 0270fh                           ; 72 0d
+    jc short 0275fh                           ; 72 0d
     sub si, 00800h                            ; 81 ee 00 08
     mov ax, word [bp-018h]                    ; 8b 46 e8
     add ax, 00080h                            ; 05 80 00
     mov word [bp-018h], ax                    ; 89 46 e8
     cmp byte [bp-008h], 001h                  ; 80 7e f8 01
-    jne short 02723h                          ; 75 0e
+    jne short 02773h                          ; 75 0e
     mov dx, bx                                ; 89 da
     mov cx, word [bp-012h]                    ; 8b 4e ee
     mov es, [bp-018h]                         ; 8e 46 e8
     db  0f3h, 066h, 026h, 06fh
     ; rep es outsd                              ; f3 66 26 6f
-    jmp short 0272eh                          ; eb 0b
+    jmp short 0277eh                          ; eb 0b
     mov dx, bx                                ; 89 da
     mov cx, word [bp-012h]                    ; 8b 4e ee
     mov es, [bp-018h]                         ; 8e 46 e8
@@ -2878,28 +2937,28 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     ; sub ah, ah                                ; 2a e4
     mov dl, al                                ; 88 c2
     test AL, strict byte 080h                 ; a8 80
-    jne short 02738h                          ; 75 f4
+    jne short 02788h                          ; 75 f4
     cmp word [bp-00eh], strict byte 00000h    ; 83 7e f2 00
-    jne short 0275eh                          ; 75 14
+    jne short 027aeh                          ; 75 14
     and AL, strict byte 0e9h                  ; 24 e9
     cmp AL, strict byte 040h                  ; 3c 40
-    je short 02774h                           ; 74 24
+    je short 027c4h                           ; 74 24
     mov dx, word [bp-00ch]                    ; 8b 56 f4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00006h                ; ba 06 00
-    jmp short 0277fh                          ; eb 21
+    jmp short 027cfh                          ; eb 21
     mov al, dl                                ; 88 d0
     and AL, strict byte 0c9h                  ; 24 c9
     cmp AL, strict byte 048h                  ; 3c 48
-    je short 026fch                           ; 74 96
+    je short 0274ch                           ; 74 96
     mov dx, word [bp-00ch]                    ; 8b 56 f4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00007h                ; ba 07 00
-    jmp short 0277fh                          ; eb 0b
+    jmp short 027cfh                          ; eb 0b
     mov dx, word [bp-00ch]                    ; 8b 56 f4
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
@@ -2911,7 +2970,7 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
- at ata_read_sectors:                           ; 0xf2788 LB 0x7a
+ at ata_read_sectors:                           ; 0xf27d8 LB 0x7a
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -2925,24 +2984,24 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     sal dx, 009h                              ; c1 e2 09
     mov ax, word [es:si+012h]                 ; 26 8b 44 12
     test ax, ax                               ; 85 c0
-    je short 027b6h                           ; 74 0d
+    je short 02806h                           ; 74 0d
     movzx di, bl                              ; 0f b6 fb
     imul di, di, strict byte 00018h           ; 6b ff 18
     mov [bp-006h], es                         ; 8c 46 fa
     add di, si                                ; 01 f7
-    jmp short 027e2h                          ; eb 2c
+    jmp short 02832h                          ; eb 2c
     mov di, word [es:si]                      ; 26 8b 3c
     add di, cx                                ; 01 cf
     mov word [bp-006h], di                    ; 89 7e fa
     adc ax, word [es:si+002h]                 ; 26 13 44 02
     cmp ax, 01000h                            ; 3d 00 10
-    jnbe short 027c9h                         ; 77 02
-    jne short 027d5h                          ; 75 0c
+    jnbe short 02819h                         ; 77 02
+    jne short 02825h                          ; 75 0c
     mov bx, strict word 00024h                ; bb 24 00
     mov ax, si                                ; 89 f0
     mov dx, es                                ; 8c c2
-    call 01cffh                               ; e8 2c f5
-    jmp short 027f9h                          ; eb 24
+    call 01d4fh                               ; e8 2c f5
+    jmp short 02849h                          ; eb 24
     movzx ax, bl                              ; 0f b6 c3
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     mov [bp-006h], es                         ; 8c 46 fa
@@ -2952,7 +3011,7 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     mov bx, 000c4h                            ; bb c4 00
     mov ax, si                                ; 89 f0
     mov dx, es                                ; 8c c2
-    call 01cffh                               ; e8 0f f5
+    call 01d4fh                               ; e8 0f f5
     mov es, [bp-006h]                         ; 8e 46 fa
     mov word [es:di+024h], 00200h             ; 26 c7 45 24 00 02
     lea sp, [bp-004h]                         ; 8d 66 fc
@@ -2960,33 +3019,33 @@ ata_cmd_data_out_:                           ; 0xf256e LB 0x21a
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
- at ata_write_sectors:                          ; 0xf2802 LB 0x3d
+ at ata_write_sectors:                          ; 0xf2852 LB 0x3d
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     les si, [bp+004h]                         ; c4 76 04
     mov cx, word [es:si+00ah]                 ; 26 8b 4c 0a
     cmp word [es:si+012h], strict byte 00000h ; 26 83 7c 12 00
-    je short 02820h                           ; 74 0c
+    je short 02870h                           ; 74 0c
     mov bx, strict word 00030h                ; bb 30 00
     mov ax, si                                ; 89 f0
     mov dx, es                                ; 8c c2
-    call 0256eh                               ; e8 50 fd
-    jmp short 02837h                          ; eb 17
+    call 025beh                               ; e8 50 fd
+    jmp short 02887h                          ; eb 17
     xor ax, ax                                ; 31 c0
     mov dx, word [es:si]                      ; 26 8b 14
     add dx, cx                                ; 01 ca
     adc ax, word [es:si+002h]                 ; 26 13 44 02
     cmp ax, 01000h                            ; 3d 00 10
-    jnbe short 02832h                         ; 77 02
-    jne short 02814h                          ; 75 e2
+    jnbe short 02882h                         ; 77 02
+    jne short 02864h                          ; 75 e2
     mov bx, strict word 00034h                ; bb 34 00
-    jmp short 02817h                          ; eb e0
+    jmp short 02867h                          ; eb e0
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
+ata_cmd_packet_:                             ; 0xf288f LB 0x2e8
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -2997,7 +3056,7 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     mov di, bx                                ; 89 df
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 c6 ed
+    call 0166ch                               ; e8 c6 ed
     mov word [bp-012h], 00122h                ; c7 46 ee 22 01
     mov word [bp-00eh], ax                    ; 89 46 f2
     mov ax, word [bp-01ah]                    ; 8b 46 e6
@@ -3006,20 +3065,20 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     and ah, 001h                              ; 80 e4 01
     mov byte [bp-006h], ah                    ; 88 66 fa
     cmp byte [bp+00ah], 002h                  ; 80 7e 0a 02
-    jne short 02891h                          ; 75 1f
-    mov bx, 00dbah                            ; bb ba 0d
+    jne short 028e1h                          ; 75 1f
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 64 f0
+    call 01931h                               ; e8 64 f0
     push 00201h                               ; 68 01 02
     push 00210h                               ; 68 10 02
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 9a f0
+    call 01972h                               ; e8 9a f0
     add sp, strict byte 00006h                ; 83 c4 06
     mov dx, strict word 00001h                ; ba 01 00
-    jmp near 02b1ch                           ; e9 8b 02
+    jmp near 02b6ch                           ; e9 8b 02
     test byte [bp+004h], 001h                 ; f6 46 04 01
-    jne short 0288bh                          ; 75 f4
+    jne short 028dbh                          ; 75 f4
     xor ah, ah                                ; 30 e4
     imul ax, ax, strict byte 00006h           ; 6b c0 06
     mov es, [bp-00eh]                         ; 8e 46 f2
@@ -3037,10 +3096,10 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     mov word [bp-016h], ax                    ; 89 46 ea
     mov al, byte [bp-008h]                    ; 8a 46 f8
     cmp AL, strict byte 00ch                  ; 3c 0c
-    jnc short 028d4h                          ; 73 06
+    jnc short 02924h                          ; 73 06
     mov byte [bp-008h], 00ch                  ; c6 46 f8 0c
-    jmp short 028dah                          ; eb 06
-    jbe short 028dah                          ; 76 04
+    jmp short 0292ah                          ; eb 06
+    jbe short 0292ah                          ; 76 04
     mov byte [bp-008h], 010h                  ; c6 46 f8 10
     shr byte [bp-008h], 1                     ; d0 6e f8
     mov es, [bp-00eh]                         ; 8e 46 f2
@@ -3053,9 +3112,9 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 080h                 ; a8 80
-    je short 02902h                           ; 74 06
+    je short 02952h                           ; 74 06
     mov dx, strict word 00002h                ; ba 02 00
-    jmp near 02b1ch                           ; e9 1a 02
+    jmp near 02b6ch                           ; e9 1a 02
     mov dx, word [bp-010h]                    ; 8b 56 f0
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 00ah                  ; b0 0a
@@ -3067,9 +3126,9 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     mov AL, strict byte 0ffh                  ; b0 ff
     out DX, AL                                ; ee
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    je short 02922h                           ; 74 05
+    je short 02972h                           ; 74 05
     mov ax, 000b0h                            ; b8 b0 00
-    jmp short 02925h                          ; eb 03
+    jmp short 02975h                          ; eb 03
     mov ax, 000a0h                            ; b8 a0 00
     lea dx, [bx+006h]                         ; 8d 57 06
     out DX, AL                                ; ee
@@ -3082,23 +3141,23 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     ; sub ah, ah                                ; 2a e4
     mov dl, al                                ; 88 c2
     test AL, strict byte 080h                 ; a8 80
-    jne short 0292fh                          ; 75 f4
+    jne short 0297fh                          ; 75 f4
     test AL, strict byte 001h                 ; a8 01
-    je short 0294eh                           ; 74 0f
+    je short 0299eh                           ; 74 0f
     mov dx, word [bp-010h]                    ; 8b 56 f0
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00003h                ; ba 03 00
-    jmp near 02b1ch                           ; e9 ce 01
+    jmp near 02b6ch                           ; e9 ce 01
     test dl, 008h                             ; f6 c2 08
-    jne short 02962h                          ; 75 0f
+    jne short 029b2h                          ; 75 0f
     mov dx, word [bp-010h]                    ; 8b 56 f0
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov dx, strict word 00004h                ; ba 04 00
-    jmp near 02b1ch                           ; e9 ba 01
+    jmp near 02b6ch                           ; e9 ba 01
     sti                                       ; fb
     mov ax, di                                ; 89 f8
     shr ax, 004h                              ; c1 e8 04
@@ -3111,38 +3170,38 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     db  0f3h, 026h, 06fh
     ; rep es outsw                              ; f3 26 6f
     cmp byte [bp+00ah], 000h                  ; 80 7e 0a 00
-    jne short 0298bh                          ; 75 0b
+    jne short 029dbh                          ; 75 0b
     lea dx, [bx+007h]                         ; 8d 57 07
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov dl, al                                ; 88 c2
-    jmp near 02afdh                           ; e9 72 01
+    jmp near 02b4dh                           ; e9 72 01
     lea dx, [bx+007h]                         ; 8d 57 07
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov dl, al                                ; 88 c2
     test AL, strict byte 080h                 ; a8 80
-    jne short 0298bh                          ; 75 f4
+    jne short 029dbh                          ; 75 f4
     test AL, strict byte 088h                 ; a8 88
-    je near 02afdh                            ; 0f 84 60 01
+    je near 02b4dh                            ; 0f 84 60 01
     test AL, strict byte 001h                 ; a8 01
-    je short 029ach                           ; 74 0b
+    je short 029fch                           ; 74 0b
     mov dx, word [bp-010h]                    ; 8b 56 f0
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
-    jmp short 02948h                          ; eb 9c
+    jmp short 02998h                          ; eb 9c
     mov al, dl                                ; 88 d0
     and AL, strict byte 0c9h                  ; 24 c9
     cmp AL, strict byte 048h                  ; 3c 48
-    je short 029bfh                           ; 74 0b
+    je short 02a0fh                           ; 74 0b
     mov dx, word [bp-010h]                    ; 8b 56 f0
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
-    jmp short 0295ch                          ; eb 9d
+    jmp short 029ach                          ; eb 9d
     mov ax, word [bp+00ch]                    ; 8b 46 0c
     shr ax, 004h                              ; c1 e8 04
     mov dx, word [bp+00eh]                    ; 8b 56 0e
@@ -3165,21 +3224,21 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     mov word [bp-014h], cx                    ; 89 4e ec
     mov ax, word [bp+004h]                    ; 8b 46 04
     cmp ax, cx                                ; 39 c8
-    jbe short 029ffh                          ; 76 0c
+    jbe short 02a4fh                          ; 76 0c
     mov ax, cx                                ; 89 c8
     sub word [bp+004h], cx                    ; 29 4e 04
     xor ax, cx                                ; 31 c8
     mov word [bp-014h], ax                    ; 89 46 ec
-    jmp short 02a09h                          ; eb 0a
+    jmp short 02a59h                          ; eb 0a
     mov cx, ax                                ; 89 c1
     mov word [bp+004h], strict word 00000h    ; c7 46 04 00 00
     sub word [bp-014h], ax                    ; 29 46 ec
     xor ax, ax                                ; 31 c0
     cmp word [bp+008h], strict byte 00000h    ; 83 7e 08 00
-    jne short 02a32h                          ; 75 21
+    jne short 02a82h                          ; 75 21
     mov dx, word [bp-014h]                    ; 8b 56 ec
     cmp dx, word [bp+006h]                    ; 3b 56 06
-    jbe short 02a32h                          ; 76 19
+    jbe short 02a82h                          ; 76 19
     mov ax, word [bp-014h]                    ; 8b 46 ec
     sub ax, word [bp+006h]                    ; 2b 46 06
     mov word [bp-00ch], ax                    ; 89 46 f4
@@ -3188,7 +3247,7 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     xor ax, ax                                ; 31 c0
     mov word [bp+006h], ax                    ; 89 46 06
     mov word [bp+008h], ax                    ; 89 46 08
-    jmp short 02a3eh                          ; eb 0c
+    jmp short 02a8eh                          ; eb 0c
     mov word [bp-00ch], ax                    ; 89 46 f4
     mov dx, word [bp-014h]                    ; 8b 56 ec
     sub word [bp+006h], dx                    ; 29 56 06
@@ -3196,39 +3255,39 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     mov si, word [bp-014h]                    ; 8b 76 ec
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     test cl, 003h                             ; f6 c1 03
-    je short 02a4bh                           ; 74 02
+    je short 02a9bh                           ; 74 02
     xor al, al                                ; 30 c0
     test byte [bp-014h], 003h                 ; f6 46 ec 03
-    je short 02a53h                           ; 74 02
+    je short 02aa3h                           ; 74 02
     xor al, al                                ; 30 c0
     test byte [bp-00ch], 003h                 ; f6 46 f4 03
-    je short 02a5bh                           ; 74 02
+    je short 02aabh                           ; 74 02
     xor al, al                                ; 30 c0
     test byte [bp-014h], 001h                 ; f6 46 ec 01
-    je short 02a73h                           ; 74 12
+    je short 02ac3h                           ; 74 12
     inc word [bp-014h]                        ; ff 46 ec
     cmp word [bp-00ch], strict byte 00000h    ; 83 7e f4 00
-    jbe short 02a73h                          ; 76 09
+    jbe short 02ac3h                          ; 76 09
     test byte [bp-00ch], 001h                 ; f6 46 f4 01
-    je short 02a73h                           ; 74 03
+    je short 02ac3h                           ; 74 03
     dec word [bp-00ch]                        ; ff 4e f4
     cmp AL, strict byte 001h                  ; 3c 01
-    jne short 02a84h                          ; 75 0d
+    jne short 02ad4h                          ; 75 0d
     shr word [bp-014h], 002h                  ; c1 6e ec 02
     shr cx, 002h                              ; c1 e9 02
     shr word [bp-00ch], 002h                  ; c1 6e f4 02
-    jmp short 02a8ch                          ; eb 08
+    jmp short 02adch                          ; eb 08
     shr word [bp-014h], 1                     ; d1 6e ec
     shr cx, 1                                 ; d1 e9
     shr word [bp-00ch], 1                     ; d1 6e f4
     cmp AL, strict byte 001h                  ; 3c 01
-    jne short 02abch                          ; 75 2c
+    jne short 02b0ch                          ; 75 2c
     test cx, cx                               ; 85 c9
-    je short 02a9eh                           ; 74 0a
+    je short 02aeeh                           ; 74 0a
     mov dx, bx                                ; 89 da
     push eax                                  ; 66 50
     in eax, DX                                ; 66 ed
-    loop 02a98h                               ; e2 fc
+    loop 02ae8h                               ; e2 fc
     pop eax                                   ; 66 58
     mov dx, bx                                ; 89 da
     mov cx, word [bp-014h]                    ; 8b 4e ec
@@ -3237,28 +3296,28 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     ; rep insd                                  ; f3 66 6d
     mov ax, word [bp-00ch]                    ; 8b 46 f4
     test ax, ax                               ; 85 c0
-    je short 02adbh                           ; 74 2b
+    je short 02b2bh                           ; 74 2b
     mov cx, ax                                ; 89 c1
     push eax                                  ; 66 50
     in eax, DX                                ; 66 ed
-    loop 02ab4h                               ; e2 fc
+    loop 02b04h                               ; e2 fc
     pop eax                                   ; 66 58
-    jmp short 02adbh                          ; eb 1f
+    jmp short 02b2bh                          ; eb 1f
     test cx, cx                               ; 85 c9
-    je short 02ac5h                           ; 74 05
+    je short 02b15h                           ; 74 05
     mov dx, bx                                ; 89 da
     in ax, DX                                 ; ed
-    loop 02ac2h                               ; e2 fd
+    loop 02b12h                               ; e2 fd
     mov dx, bx                                ; 89 da
     mov cx, word [bp-014h]                    ; 8b 4e ec
     les di, [bp+00ch]                         ; c4 7e 0c
     rep insw                                  ; f3 6d
     mov ax, word [bp-00ch]                    ; 8b 46 f4
     test ax, ax                               ; 85 c0
-    je short 02adbh                           ; 74 05
+    je short 02b2bh                           ; 74 05
     mov cx, ax                                ; 89 c1
     in ax, DX                                 ; ed
-    loop 02ad8h                               ; e2 fd
+    loop 02b28h                               ; e2 fd
     add word [bp+00ch], si                    ; 01 76 0c
     xor ax, ax                                ; 31 c0
     add word [bp-018h], si                    ; 01 76 e8
@@ -3269,16 +3328,16 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     mov word [es:si+016h], ax                 ; 26 89 44 16
     mov ax, word [bp-016h]                    ; 8b 46 ea
     mov word [es:si+018h], ax                 ; 26 89 44 18
-    jmp near 0298bh                           ; e9 8e fe
+    jmp near 029dbh                           ; e9 8e fe
     mov al, dl                                ; 88 d0
     and AL, strict byte 0e9h                  ; 24 e9
     cmp AL, strict byte 040h                  ; 3c 40
-    je short 02b11h                           ; 74 0c
+    je short 02b61h                           ; 74 0c
     mov dx, word [bp-010h]                    ; 8b 56 f0
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
-    jmp near 0295ch                           ; e9 4b fe
+    jmp near 029ach                           ; e9 4b fe
     mov dx, word [bp-010h]                    ; 8b 56 f0
     add dx, strict byte 00006h                ; 83 c2 06
     mov AL, strict byte 008h                  ; b0 08
@@ -3290,7 +3349,7 @@ ata_cmd_packet_:                             ; 0xf283f LB 0x2e8
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 0000ch                               ; c2 0c 00
-ata_soft_reset_:                             ; 0xf2b27 LB 0x80
+ata_soft_reset_:                             ; 0xf2b77 LB 0x80
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -3300,7 +3359,7 @@ ata_soft_reset_:                             ; 0xf2b27 LB 0x80
     mov bx, ax                                ; 89 c3
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 e3 ea
+    call 0166ch                               ; e8 e3 ea
     mov dx, bx                                ; 89 da
     shr dx, 1                                 ; d1 ea
     and bl, 001h                              ; 80 e3 01
@@ -3315,9 +3374,9 @@ ata_soft_reset_:                             ; 0xf2b27 LB 0x80
     mov AL, strict byte 00ah                  ; b0 0a
     out DX, AL                                ; ee
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    je short 02b69h                           ; 74 05
+    je short 02bb9h                           ; 74 05
     mov ax, 000b0h                            ; b8 b0 00
-    jmp short 02b6ch                          ; eb 03
+    jmp short 02bbch                          ; eb 03
     mov ax, 000a0h                            ; b8 a0 00
     mov dx, cx                                ; 89 ca
     add dx, strict byte 00006h                ; 83 c2 06
@@ -3332,15 +3391,15 @@ ata_soft_reset_:                             ; 0xf2b27 LB 0x80
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 080h                 ; a8 80
-    jne short 02b7ah                          ; 75 f4
+    jne short 02bcah                          ; 75 f4
     and AL, strict byte 0e9h                  ; 24 e9
     cmp AL, strict byte 040h                  ; 3c 40
-    je short 02b97h                           ; 74 0b
+    je short 02be7h                           ; 74 0b
     lea dx, [bx+006h]                         ; 8d 57 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
     mov ax, strict word 00001h                ; b8 01 00
-    jmp short 02b9fh                          ; eb 08
+    jmp short 02befh                          ; eb 08
     lea dx, [bx+006h]                         ; 8d 57 06
     mov AL, strict byte 008h                  ; b0 08
     out DX, AL                                ; ee
@@ -3351,7 +3410,7 @@ ata_soft_reset_:                             ; 0xf2b27 LB 0x80
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-set_diskette_ret_status_:                    ; 0xf2ba7 LB 0x18
+set_diskette_ret_status_:                    ; 0xf2bf7 LB 0x18
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -3359,54 +3418,54 @@ set_diskette_ret_status_:                    ; 0xf2ba7 LB 0x18
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00041h                ; ba 41 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 56 ea
+    call 0165eh                               ; e8 56 ea
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-set_diskette_current_cyl_:                   ; 0xf2bbf LB 0x2d
+set_diskette_current_cyl_:                   ; 0xf2c0f LB 0x2d
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     mov bl, al                                ; 88 c3
     cmp AL, strict byte 001h                  ; 3c 01
-    jbe short 02bd4h                          ; 76 0b
+    jbe short 02c24h                          ; 76 0b
     push 00230h                               ; 68 30 02
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 51 ed
+    call 01972h                               ; e8 51 ed
     add sp, strict byte 00004h                ; 83 c4 04
     movzx ax, dl                              ; 0f b6 c2
     movzx dx, bl                              ; 0f b6 d3
     add dx, 00094h                            ; 81 c2 94 00
     mov bx, ax                                ; 89 c3
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 28 ea
+    call 0165eh                               ; e8 28 ea
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_wait_for_interrupt_:                  ; 0xf2bec LB 0x21
+floppy_wait_for_interrupt_:                  ; 0xf2c3c LB 0x21
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
     cli                                       ; fa
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 06 ea
+    call 01650h                               ; e8 06 ea
     test AL, strict byte 080h                 ; a8 80
-    je short 02c02h                           ; 74 04
+    je short 02c52h                           ; 74 04
     and AL, strict byte 080h                  ; 24 80
-    jmp short 02c07h                          ; eb 05
+    jmp short 02c57h                          ; eb 05
     sti                                       ; fb
     hlt                                       ; f4
     cli                                       ; fa
-    jmp short 02bf1h                          ; eb ea
+    jmp short 02c41h                          ; eb ea
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_wait_for_interrupt_or_timeout_:       ; 0xf2c0d LB 0x46
+floppy_wait_for_interrupt_or_timeout_:       ; 0xf2c5d LB 0x46
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -3415,28 +3474,28 @@ floppy_wait_for_interrupt_or_timeout_:       ; 0xf2c0d LB 0x46
     cli                                       ; fa
     mov dx, strict word 00040h                ; ba 40 00
     mov ax, dx                                ; 89 d0
-    call 01600h                               ; e8 e4 e9
+    call 01650h                               ; e8 e4 e9
     test al, al                               ; 84 c0
-    jne short 02c25h                          ; 75 05
+    jne short 02c75h                          ; 75 05
     sti                                       ; fb
     xor cl, cl                                ; 30 c9
-    jmp short 02c49h                          ; eb 24
+    jmp short 02c99h                          ; eb 24
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 d2 e9
+    call 01650h                               ; e8 d2 e9
     mov cl, al                                ; 88 c1
     test AL, strict byte 080h                 ; a8 80
-    je short 02c44h                           ; 74 10
+    je short 02c94h                           ; 74 10
     and AL, strict byte 07fh                  ; 24 7f
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 cc e9
-    jmp short 02c49h                          ; eb 05
+    call 0165eh                               ; e8 cc e9
+    jmp short 02c99h                          ; eb 05
     sti                                       ; fb
     hlt                                       ; f4
     cli                                       ; fa
-    jmp short 02c14h                          ; eb cb
+    jmp short 02c64h                          ; eb cb
     mov al, cl                                ; 88 c8
     lea sp, [bp-006h]                         ; 8d 66 fa
     pop dx                                    ; 5a
@@ -3444,7 +3503,7 @@ floppy_wait_for_interrupt_or_timeout_:       ; 0xf2c0d LB 0x46
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_reset_controller_:                    ; 0xf2c53 LB 0x2b
+floppy_reset_controller_:                    ; 0xf2ca3 LB 0x2b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -3466,13 +3525,13 @@ floppy_reset_controller_:                    ; 0xf2c53 LB 0x2b
     ; sub ah, ah                                ; 2a e4
     and AL, strict byte 0c0h                  ; 24 c0
     cmp AL, strict byte 080h                  ; 3c 80
-    jne short 02c6bh                          ; 75 f4
+    jne short 02cbbh                          ; 75 f4
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_prepare_controller_:                  ; 0xf2c7e LB 0x81
+floppy_prepare_controller_:                  ; 0xf2cce LB 0x81
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -3482,12 +3541,12 @@ floppy_prepare_controller_:                  ; 0xf2c7e LB 0x81
     mov cx, ax                                ; 89 c1
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 70 e9
+    call 01650h                               ; e8 70 e9
     and AL, strict byte 07fh                  ; 24 7f
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 70 e9
+    call 0165eh                               ; e8 70 e9
     mov dx, 003f2h                            ; ba f2 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -3495,9 +3554,9 @@ floppy_prepare_controller_:                  ; 0xf2c7e LB 0x81
     and AL, strict byte 004h                  ; 24 04
     mov byte [bp-008h], al                    ; 88 46 f8
     test cx, cx                               ; 85 c9
-    je short 02cb1h                           ; 74 04
+    je short 02d01h                           ; 74 04
     mov AL, strict byte 020h                  ; b0 20
-    jmp short 02cb3h                          ; eb 02
+    jmp short 02d03h                          ; eb 02
     mov AL, strict byte 010h                  ; b0 10
     or AL, strict byte 00ch                   ; 0c 0c
     or al, cl                                 ; 08 c8
@@ -3506,10 +3565,10 @@ floppy_prepare_controller_:                  ; 0xf2c7e LB 0x81
     mov bx, strict word 00025h                ; bb 25 00
     mov dx, strict word 00040h                ; ba 40 00
     mov ax, dx                                ; 89 d0
-    call 0160eh                               ; e8 48 e9
+    call 0165eh                               ; e8 48 e9
     mov dx, 0008bh                            ; ba 8b 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 31 e9
+    call 01650h                               ; e8 31 e9
     shr al, 006h                              ; c0 e8 06
     mov dx, 003f7h                            ; ba f7 03
     out DX, AL                                ; ee
@@ -3519,21 +3578,21 @@ floppy_prepare_controller_:                  ; 0xf2c7e LB 0x81
     ; sub ah, ah                                ; 2a e4
     and AL, strict byte 0c0h                  ; 24 c0
     cmp AL, strict byte 080h                  ; 3c 80
-    jne short 02cd6h                          ; 75 f4
+    jne short 02d26h                          ; 75 f4
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    jne short 02cf7h                          ; 75 0f
-    call 02bech                               ; e8 01 ff
+    jne short 02d47h                          ; 75 0f
+    call 02c3ch                               ; e8 01 ff
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 17 e9
+    call 0165eh                               ; e8 17 e9
     lea sp, [bp-006h]                         ; 8d 66 fa
     pop dx                                    ; 5a
     pop cx                                    ; 59
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_media_known_:                         ; 0xf2cff LB 0x43
+floppy_media_known_:                         ; 0xf2d4f LB 0x43
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -3541,32 +3600,32 @@ floppy_media_known_:                         ; 0xf2cff LB 0x43
     mov bx, ax                                ; 89 c3
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 f1 e8
+    call 01650h                               ; e8 f1 e8
     mov ah, al                                ; 88 c4
     test bx, bx                               ; 85 db
-    je short 02d17h                           ; 74 02
+    je short 02d67h                           ; 74 02
     shr al, 1                                 ; d0 e8
     and AL, strict byte 001h                  ; 24 01
-    jne short 02d1fh                          ; 75 04
+    jne short 02d6fh                          ; 75 04
     xor ah, ah                                ; 30 e4
-    jmp short 02d3bh                          ; eb 1c
+    jmp short 02d8bh                          ; eb 1c
     mov dx, 00090h                            ; ba 90 00
     test bx, bx                               ; 85 db
-    je short 02d29h                           ; 74 03
+    je short 02d79h                           ; 74 03
     mov dx, 00091h                            ; ba 91 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 d1 e8
+    call 01650h                               ; e8 d1 e8
     xor ah, ah                                ; 30 e4
     sar ax, 004h                              ; c1 f8 04
     and AL, strict byte 001h                  ; 24 01
-    je short 02d1bh                           ; 74 e3
+    je short 02d6bh                           ; 74 e3
     mov ax, strict word 00001h                ; b8 01 00
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_read_id_:                             ; 0xf2d42 LB 0x40
+floppy_read_id_:                             ; 0xf2d92 LB 0x40
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -3574,24 +3633,24 @@ floppy_read_id_:                             ; 0xf2d42 LB 0x40
     push si                                   ; 56
     sub sp, strict byte 00008h                ; 83 ec 08
     mov bx, ax                                ; 89 c3
-    call 02c7eh                               ; e8 2e ff
+    call 02cceh                               ; e8 2e ff
     mov AL, strict byte 04ah                  ; b0 4a
     mov dx, 003f5h                            ; ba f5 03
     out DX, AL                                ; ee
     mov al, bl                                ; 88 d8
     out DX, AL                                ; ee
-    call 02bech                               ; e8 90 fe
+    call 02c3ch                               ; e8 90 fe
     xor si, si                                ; 31 f6
-    jmp short 02d65h                          ; eb 05
+    jmp short 02db5h                          ; eb 05
     cmp si, strict byte 00007h                ; 83 fe 07
-    jnl short 02d71h                          ; 7d 0c
+    jnl short 02dc1h                          ; 7d 0c
     mov dx, 003f5h                            ; ba f5 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov byte [bp+si-00eh], al                 ; 88 42 f2
     inc si                                    ; 46
-    jmp short 02d60h                          ; eb ef
+    jmp short 02db0h                          ; eb ef
     test byte [bp-00eh], 0c0h                 ; f6 46 f2 c0
     db  00fh, 094h, 0c0h
     ; sete al                                   ; 0f 94 c0
@@ -3602,35 +3661,35 @@ floppy_read_id_:                             ; 0xf2d42 LB 0x40
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_drive_recal_:                         ; 0xf2d82 LB 0x48
+floppy_drive_recal_:                         ; 0xf2dd2 LB 0x48
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     push cx                                   ; 51
     push dx                                   ; 52
     mov bx, ax                                ; 89 c3
-    call 02c7eh                               ; e8 f1 fe
+    call 02cceh                               ; e8 f1 fe
     mov AL, strict byte 007h                  ; b0 07
     mov dx, 003f5h                            ; ba f5 03
     out DX, AL                                ; ee
     mov al, bl                                ; 88 d8
     out DX, AL                                ; ee
-    call 02bech                               ; e8 53 fe
+    call 02c3ch                               ; e8 53 fe
     test bx, bx                               ; 85 db
-    je short 02da4h                           ; 74 07
+    je short 02df4h                           ; 74 07
     or AL, strict byte 002h                   ; 0c 02
     mov cx, 00095h                            ; b9 95 00
-    jmp short 02da9h                          ; eb 05
+    jmp short 02df9h                          ; eb 05
     or AL, strict byte 001h                   ; 0c 01
     mov cx, 00094h                            ; b9 94 00
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 59 e8
+    call 0165eh                               ; e8 59 e8
     xor bx, bx                                ; 31 db
     mov dx, cx                                ; 89 ca
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 4f e8
+    call 0165eh                               ; e8 4f e8
     mov ax, strict word 00001h                ; b8 01 00
     lea sp, [bp-006h]                         ; 8d 66 fa
     pop dx                                    ; 5a
@@ -3638,7 +3697,7 @@ floppy_drive_recal_:                         ; 0xf2d82 LB 0x48
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_media_sense_:                         ; 0xf2dca LB 0xf0
+floppy_media_sense_:                         ; 0xf2e1a LB 0xf0
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -3647,85 +3706,85 @@ floppy_media_sense_:                         ; 0xf2dca LB 0xf0
     push si                                   ; 56
     push di                                   ; 57
     mov di, ax                                ; 89 c7
-    call 02d82h                               ; e8 ab ff
+    call 02dd2h                               ; e8 ab ff
     test ax, ax                               ; 85 c0
-    jne short 02de0h                          ; 75 05
+    jne short 02e30h                          ; 75 05
     xor cx, cx                                ; 31 c9
-    jmp near 02eaeh                           ; e9 ce 00
+    jmp near 02efeh                           ; e9 ce 00
     mov ax, strict word 00010h                ; b8 10 00
-    call 0165ch                               ; e8 76 e8
+    call 016ach                               ; e8 76 e8
     test di, di                               ; 85 ff
-    jne short 02df1h                          ; 75 07
+    jne short 02e41h                          ; 75 07
     mov cl, al                                ; 88 c1
     shr cl, 004h                              ; c0 e9 04
-    jmp short 02df6h                          ; eb 05
+    jmp short 02e46h                          ; eb 05
     mov cl, al                                ; 88 c1
     and cl, 00fh                              ; 80 e1 0f
     cmp cl, 001h                              ; 80 f9 01
-    jne short 02e04h                          ; 75 09
+    jne short 02e54h                          ; 75 09
     xor cl, cl                                ; 30 c9
     mov CH, strict byte 015h                  ; b5 15
     mov si, strict word 00001h                ; be 01 00
-    jmp short 02e42h                          ; eb 3e
+    jmp short 02e92h                          ; eb 3e
     cmp cl, 002h                              ; 80 f9 02
-    jne short 02e0fh                          ; 75 06
+    jne short 02e5fh                          ; 75 06
     xor cl, cl                                ; 30 c9
     mov CH, strict byte 035h                  ; b5 35
-    jmp short 02dffh                          ; eb f0
+    jmp short 02e4fh                          ; eb f0
     cmp cl, 003h                              ; 80 f9 03
-    jne short 02e1ah                          ; 75 06
+    jne short 02e6ah                          ; 75 06
     xor cl, cl                                ; 30 c9
     mov CH, strict byte 017h                  ; b5 17
-    jmp short 02dffh                          ; eb e5
+    jmp short 02e4fh                          ; eb e5
     cmp cl, 004h                              ; 80 f9 04
-    jne short 02e25h                          ; 75 06
+    jne short 02e75h                          ; 75 06
     xor cl, cl                                ; 30 c9
     mov CH, strict byte 017h                  ; b5 17
-    jmp short 02dffh                          ; eb da
+    jmp short 02e4fh                          ; eb da
     cmp cl, 005h                              ; 80 f9 05
-    jne short 02e30h                          ; 75 06
+    jne short 02e80h                          ; 75 06
     mov CL, strict byte 0cch                  ; b1 cc
     mov CH, strict byte 0d7h                  ; b5 d7
-    jmp short 02dffh                          ; eb cf
+    jmp short 02e4fh                          ; eb cf
     cmp cl, 00eh                              ; 80 f9 0e
-    je short 02e3ah                           ; 74 05
+    je short 02e8ah                           ; 74 05
     cmp cl, 00fh                              ; 80 f9 0f
-    jne short 02e3ch                          ; 75 02
-    jmp short 02e2ah                          ; eb ee
+    jne short 02e8ch                          ; 75 02
+    jmp short 02e7ah                          ; eb ee
     xor cl, cl                                ; 30 c9
     xor ch, ch                                ; 30 ed
     xor si, si                                ; 31 f6
     movzx bx, cl                              ; 0f b6 d9
     mov dx, 0008bh                            ; ba 8b 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 c0 e7
+    call 0165eh                               ; e8 c0 e7
     mov ax, di                                ; 89 f8
-    call 02d42h                               ; e8 ef fe
+    call 02d92h                               ; e8 ef fe
     test ax, ax                               ; 85 c0
-    jne short 02e89h                          ; 75 32
+    jne short 02ed9h                          ; 75 32
     mov al, cl                                ; 88 c8
     and AL, strict byte 0c0h                  ; 24 c0
     cmp AL, strict byte 080h                  ; 3c 80
-    je short 02e89h                           ; 74 2a
+    je short 02ed9h                           ; 74 2a
     mov al, cl                                ; 88 c8
     and AL, strict byte 0c0h                  ; 24 c0
     cmp AL, strict byte 0c0h                  ; 3c c0
-    je short 02e76h                           ; 74 0f
+    je short 02ec6h                           ; 74 0f
     mov ah, cl                                ; 88 cc
     and ah, 03fh                              ; 80 e4 3f
     cmp AL, strict byte 040h                  ; 3c 40
-    je short 02e82h                           ; 74 12
+    je short 02ed2h                           ; 74 12
     test al, al                               ; 84 c0
-    je short 02e7bh                           ; 74 07
-    jmp short 02e42h                          ; eb cc
+    je short 02ecbh                           ; 74 07
+    jmp short 02e92h                          ; eb cc
     and cl, 03fh                              ; 80 e1 3f
-    jmp short 02e42h                          ; eb c7
+    jmp short 02e92h                          ; eb c7
     mov cl, ah                                ; 88 e1
     or cl, 040h                               ; 80 c9 40
-    jmp short 02e42h                          ; eb c0
+    jmp short 02e92h                          ; eb c0
     mov cl, ah                                ; 88 e1
     or cl, 080h                               ; 80 c9 80
-    jmp short 02e42h                          ; eb b9
+    jmp short 02e92h                          ; eb b9
     test di, di                               ; 85 ff
     db  00fh, 095h, 0c0h
     ; setne al                                  ; 0f 95 c0
@@ -3734,11 +3793,11 @@ floppy_media_sense_:                         ; 0xf2dca LB 0xf0
     movzx bx, cl                              ; 0f b6 d9
     mov dx, 0008bh                            ; ba 8b 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 6d e7
+    call 0165eh                               ; e8 6d e7
     movzx bx, ch                              ; 0f b6 dd
     mov dx, di                                ; 89 fa
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 62 e7
+    call 0165eh                               ; e8 62 e7
     mov cx, si                                ; 89 f1
     mov ax, cx                                ; 89 c8
     lea sp, [bp-00ah]                         ; 8d 66 f6
@@ -3749,17 +3808,17 @@ floppy_media_sense_:                         ; 0xf2dca LB 0xf0
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-floppy_drive_exists_:                        ; 0xf2eba LB 0x24
+floppy_drive_exists_:                        ; 0xf2f0a LB 0x24
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
     mov dx, ax                                ; 89 c2
     mov ax, strict word 00010h                ; b8 10 00
-    call 0165ch                               ; e8 96 e7
+    call 016ach                               ; e8 96 e7
     test dx, dx                               ; 85 d2
-    jne short 02ecfh                          ; 75 05
+    jne short 02f1fh                          ; 75 05
     shr al, 004h                              ; c0 e8 04
-    jmp short 02ed1h                          ; eb 02
+    jmp short 02f21h                          ; eb 02
     and AL, strict byte 00fh                  ; 24 0f
     test al, al                               ; 84 c0
     db  00fh, 095h, 0c0h
@@ -3769,88 +3828,92 @@ floppy_drive_exists_:                        ; 0xf2eba LB 0x24
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-_int13_diskette_function:                    ; 0xf2ede LB 0x729
+_int13_diskette_function:                    ; 0xf2f2e LB 0x8f7
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     push di                                   ; 57
-    sub sp, strict byte 00012h                ; 83 ec 12
+    sub sp, strict byte 00016h                ; 83 ec 16
     mov bx, word [bp+016h]                    ; 8b 5e 16
     shr bx, 008h                              ; c1 eb 08
-    mov ch, bl                                ; 88 dd
+    mov byte [bp-006h], bl                    ; 88 5e fa
     mov si, word [bp+016h]                    ; 8b 76 16
     and si, 000ffh                            ; 81 e6 ff 00
-    mov ah, byte [bp+00eh]                    ; 8a 66 0e
+    mov al, byte [bp+00eh]                    ; 8a 46 0e
+    mov ah, byte [bp+014h]                    ; 8a 66 14
+    mov cl, byte [bp+016h]                    ; 8a 4e 16
+    mov dx, word [bp+014h]                    ; 8b 56 14
+    shr dx, 008h                              ; c1 ea 08
+    mov word [bp-010h], dx                    ; 89 56 f0
     cmp bl, 008h                              ; 80 fb 08
-    jc short 02f37h                           ; 72 3a
+    jc short 02f95h                           ; 72 38
     mov dx, word [bp+01ch]                    ; 8b 56 1c
     or dl, 001h                               ; 80 ca 01
     cmp bl, 008h                              ; 80 fb 08
-    jbe near 03486h                           ; 0f 86 7c 05
+    jbe near 034ebh                           ; 0f 86 81 05
     cmp bl, 016h                              ; 80 fb 16
-    jc short 02f2dh                           ; 72 1e
+    jc short 02f8bh                           ; 72 1c
     or si, 00100h                             ; 81 ce 00 01
-    mov cx, si                                ; 89 f1
     cmp bl, 016h                              ; 80 fb 16
-    jbe near 035c2h                           ; 0f 86 a6 06
+    jbe near 0361fh                           ; 0f 86 a5 06
     cmp bl, 018h                              ; 80 fb 18
-    je near 035c7h                            ; 0f 84 a4 06
+    je near 036b5h                            ; 0f 84 34 07
     cmp bl, 017h                              ; 80 fb 17
-    je near 035c7h                            ; 0f 84 9d 06
-    jmp near 035e4h                           ; e9 b7 06
+    je near 03643h                            ; 0f 84 bb 06
+    jmp near 03802h                           ; e9 77 08
     cmp bl, 015h                              ; 80 fb 15
-    je near 0357ch                            ; 0f 84 48 06
-    jmp near 035e4h                           ; e9 ad 06
+    je near 035dbh                            ; 0f 84 49 06
+    jmp near 03802h                           ; e9 6d 08
     cmp bl, 001h                              ; 80 fb 01
-    jc short 02f51h                           ; 72 15
-    jbe near 02fcah                           ; 0f 86 8a 00
+    jc short 02fafh                           ; 72 15
+    jbe near 03028h                           ; 0f 86 8a 00
     cmp bl, 005h                              ; 80 fb 05
-    je near 0330ch                            ; 0f 84 c5 03
+    je near 03365h                            ; 0f 84 c0 03
     cmp bl, 004h                              ; 80 fb 04
-    jbe near 02fe8h                           ; 0f 86 9a 00
-    jmp near 035e4h                           ; e9 93 06
+    jbe near 03046h                           ; 0f 86 9a 00
+    jmp near 03802h                           ; e9 53 08
     test bl, bl                               ; 84 db
-    jne near 035e4h                           ; 0f 85 8d 06
+    jne near 03802h                           ; 0f 85 4d 08
     mov al, byte [bp+00eh]                    ; 8a 46 0e
-    mov byte [bp-00eh], al                    ; 88 46 f2
+    mov byte [bp-008h], al                    ; 88 46 f8
     cmp AL, strict byte 001h                  ; 3c 01
-    jbe short 02f75h                          ; 76 14
+    jbe short 02fd3h                          ; 76 14
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 001h                               ; 80 cc 01
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, strict word 00001h                ; b8 01 00
-    call 02ba7h                               ; e8 35 fc
-    jmp near 032e8h                           ; e9 73 03
+    call 02bf7h                               ; e8 27 fc
+    jmp near 03341h                           ; e9 6e 03
     mov ax, strict word 00010h                ; b8 10 00
-    call 0165ch                               ; e8 e1 e6
-    cmp byte [bp-00eh], 000h                  ; 80 7e f2 00
-    jne short 02f88h                          ; 75 07
-    mov dl, al                                ; 88 c2
-    shr dl, 004h                              ; c0 ea 04
-    jmp short 02f8dh                          ; eb 05
-    mov dl, al                                ; 88 c2
-    and dl, 00fh                              ; 80 e2 0f
-    test dl, dl                               ; 84 d2
-    jne short 02fa1h                          ; 75 10
+    call 016ach                               ; e8 d3 e6
+    cmp byte [bp-008h], 000h                  ; 80 7e f8 00
+    jne short 02fe6h                          ; 75 07
+    mov cl, al                                ; 88 c1
+    shr cl, 004h                              ; c0 e9 04
+    jmp short 02febh                          ; eb 05
+    mov cl, al                                ; 88 c1
+    and cl, 00fh                              ; 80 e1 0f
+    test cl, cl                               ; 84 c9
+    jne short 02fffh                          ; 75 10
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 080h                               ; 80 cc 80
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, 00080h                            ; b8 80 00
-    jmp short 02f6fh                          ; eb ce
+    jmp short 02fcdh                          ; eb ce
     xor bx, bx                                ; 31 db
     mov dx, strict word 0003eh                ; ba 3e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 62 e6
+    call 0165eh                               ; e8 54 e6
     xor al, al                                ; 30 c0
     mov byte [bp+017h], al                    ; 88 46 17
     xor ah, ah                                ; 30 e4
-    call 02ba7h                               ; e8 f1 fb
+    call 02bf7h                               ; e8 e3 fb
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     xor dx, dx                                ; 31 d2
-    call 02bbfh                               ; e8 fc fb
+    call 02c0fh                               ; e8 ee fb
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -3859,147 +3922,144 @@ _int13_diskette_function:                    ; 0xf2ede LB 0x729
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
     mov dx, 00441h                            ; ba 41 04
     xor ax, ax                                ; 31 c0
-    call 01600h                               ; e8 2a e6
+    call 01650h                               ; e8 1c e6
     movzx dx, al                              ; 0f b6 d0
     sal dx, 008h                              ; c1 e2 08
     or si, dx                                 ; 09 d6
     mov word [bp+016h], si                    ; 89 76 16
     test al, al                               ; 84 c0
-    je short 02fc3h                           ; 74 de
-    jmp near 032e8h                           ; e9 00 03
-    mov al, byte [bp+016h]                    ; 8a 46 16
-    mov byte [bp-00ch], al                    ; 88 46 f4
-    mov dx, word [bp+014h]                    ; 8b 56 14
-    shr dx, 008h                              ; c1 ea 08
-    mov byte [bp-008h], dl                    ; 88 56 f8
-    mov al, byte [bp+014h]                    ; 8a 46 14
-    mov byte [bp-00ah], al                    ; 88 46 f6
+    je short 03021h                           ; 74 de
+    jmp near 03341h                           ; e9 fb 02
+    mov ch, cl                                ; 88 cd
+    mov dl, byte [bp-010h]                    ; 8a 56 f0
+    mov byte [bp-00ch], dl                    ; 88 56 f4
+    mov byte [bp-00ah], ah                    ; 88 66 f6
     mov dx, word [bp+012h]                    ; 8b 56 12
     shr dx, 008h                              ; c1 ea 08
-    mov byte [bp-006h], dl                    ; 88 56 fa
-    mov byte [bp-00eh], ah                    ; 88 66 f2
-    cmp ah, 001h                              ; 80 fc 01
-    jnbe short 0301eh                         ; 77 10
+    mov byte [bp-00eh], dl                    ; 88 56 f2
+    mov byte [bp-008h], al                    ; 88 46 f8
+    cmp AL, strict byte 001h                  ; 3c 01
+    jnbe short 0306fh                         ; 77 0e
     cmp dl, 001h                              ; 80 fa 01
-    jnbe short 0301eh                         ; 77 0b
-    mov al, byte [bp-00ch]                    ; 8a 46 f4
-    test al, al                               ; 84 c0
-    je short 0301eh                           ; 74 04
-    cmp AL, strict byte 048h                  ; 3c 48
-    jbe short 03047h                          ; 76 29
-    mov bx, 00dbah                            ; bb ba 0d
+    jnbe short 0306fh                         ; 77 09
+    test cl, cl                               ; 84 c9
+    je short 0306fh                           ; 74 05
+    cmp cl, 048h                              ; 80 f9 48
+    jbe short 03099h                          ; 76 2a
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 b8 e8
+    call 01931h                               ; e8 b7 e8
     push 00255h                               ; 68 55 02
     push 0026dh                               ; 68 6d 02
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 ee e8
+    call 01972h                               ; e8 ed e8
     add sp, strict byte 00006h                ; 83 c4 06
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 001h                               ; 80 cc 01
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, strict word 00001h                ; b8 01 00
-    jmp short 030b8h                          ; eb 71
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 02ebah                               ; e8 6c fe
+    jmp near 0310fh                           ; e9 76 00
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02f0ah                               ; e8 6a fe
     test ax, ax                               ; 85 c0
-    je near 0314ah                            ; 0f 84 f6 00
-    movzx dx, byte [bp-00eh]                  ; 0f b6 56 f2
+    je near 031a2h                            ; 0f 84 fc 00
+    movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
     mov ax, dx                                ; 89 d0
-    call 02cffh                               ; e8 a2 fc
+    call 02d4fh                               ; e8 a0 fc
     test ax, ax                               ; 85 c0
-    jne short 0307ah                          ; 75 19
+    jne short 030cch                          ; 75 19
     mov ax, dx                                ; 89 d0
-    call 02dcah                               ; e8 64 fd
+    call 02e1ah                               ; e8 62 fd
     test ax, ax                               ; 85 c0
-    jne short 0307ah                          ; 75 10
+    jne short 030cch                          ; 75 10
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 00ch                               ; 80 cc 0c
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, strict word 0000ch                ; b8 0c 00
-    jmp short 030b8h                          ; eb 3e
-    cmp ch, 002h                              ; 80 fd 02
-    jne near 031e1h                           ; 0f 85 60 01
+    jmp short 0310fh                          ; eb 43
+    cmp byte [bp-006h], 002h                  ; 80 7e fa 02
+    jne near 03234h                           ; 0f 85 60 01
+    mov ax, word [bp+006h]                    ; 8b 46 06
+    shr ax, 00ch                              ; c1 e8 0c
+    mov cl, al                                ; 88 c1
     mov dx, word [bp+006h]                    ; 8b 56 06
-    shr dx, 00ch                              ; c1 ea 0c
-    mov ah, dl                                ; 88 d4
-    mov cx, word [bp+006h]                    ; 8b 4e 06
-    sal cx, 004h                              ; c1 e1 04
+    sal dx, 004h                              ; c1 e2 04
     mov bx, word [bp+010h]                    ; 8b 5e 10
-    add bx, cx                                ; 01 cb
-    cmp bx, cx                                ; 39 cb
-    jnc short 0309ah                          ; 73 02
-    db  0feh, 0c4h
-    ; inc ah                                    ; fe c4
-    movzx cx, byte [bp-00ch]                  ; 0f b6 4e f4
-    sal cx, 009h                              ; c1 e1 09
-    dec cx                                    ; 49
-    mov dx, bx                                ; 89 da
-    add dx, cx                                ; 01 ca
+    add bx, dx                                ; 01 d3
+    mov word [bp-012h], bx                    ; 89 5e ee
     cmp dx, bx                                ; 39 da
-    jnc short 030c2h                          ; 73 18
+    jbe short 030f0h                          ; 76 02
+    db  0feh, 0c1h
+    ; inc cl                                    ; fe c1
+    movzx bx, ch                              ; 0f b6 dd
+    sal bx, 009h                              ; c1 e3 09
+    dec bx                                    ; 4b
+    mov ax, word [bp-012h]                    ; 8b 46 ee
+    add ax, bx                                ; 01 d8
+    cmp ax, word [bp-012h]                    ; 3b 46 ee
+    jnc short 03119h                          ; 73 18
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 009h                               ; 80 cc 09
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, strict word 00009h                ; b8 09 00
-    call 02ba7h                               ; e8 ec fa
+    call 02bf7h                               ; e8 e5 fa
     mov byte [bp+016h], 000h                  ; c6 46 16 00
-    jmp near 032e8h                           ; e9 26 02
+    jmp near 03341h                           ; e9 28 02
     mov AL, strict byte 006h                  ; b0 06
     mov dx, strict word 0000ah                ; ba 0a 00
     out DX, AL                                ; ee
     xor al, al                                ; 30 c0
     mov dx, strict word 0000ch                ; ba 0c 00
     out DX, AL                                ; ee
-    mov al, bl                                ; 88 d8
+    mov al, byte [bp-012h]                    ; 8a 46 ee
     mov dx, strict word 00004h                ; ba 04 00
     out DX, AL                                ; ee
-    shr bx, 008h                              ; c1 eb 08
-    mov al, bl                                ; 88 d8
+    mov ax, word [bp-012h]                    ; 8b 46 ee
+    shr ax, 008h                              ; c1 e8 08
     out DX, AL                                ; ee
-    xor al, bl                                ; 30 d8
+    xor al, al                                ; 30 c0
     mov dx, strict word 0000ch                ; ba 0c 00
     out DX, AL                                ; ee
-    mov al, cl                                ; 88 c8
+    mov al, bl                                ; 88 d8
     mov dx, strict word 00005h                ; ba 05 00
     out DX, AL                                ; ee
-    shr cx, 008h                              ; c1 e9 08
-    mov al, cl                                ; 88 c8
+    mov ax, bx                                ; 89 d8
+    shr ax, 008h                              ; c1 e8 08
     out DX, AL                                ; ee
     mov AL, strict byte 046h                  ; b0 46
     mov dx, strict word 0000bh                ; ba 0b 00
     out DX, AL                                ; ee
-    mov al, ah                                ; 88 e0
+    mov al, cl                                ; 88 c8
     mov dx, 00081h                            ; ba 81 00
     out DX, AL                                ; ee
     mov AL, strict byte 002h                  ; b0 02
     mov dx, strict word 0000ah                ; ba 0a 00
     out DX, AL                                ; ee
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 02c7eh                               ; e8 79 fb
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02cceh                               ; e8 70 fb
     mov AL, strict byte 0e6h                  ; b0 e6
     mov dx, 003f5h                            ; ba f5 03
     out DX, AL                                ; ee
-    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
+    movzx dx, byte [bp-00eh]                  ; 0f b6 56 f2
     sal dx, 002h                              ; c1 e2 02
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     or ax, dx                                 ; 09 d0
     mov dx, 003f5h                            ; ba f5 03
     out DX, AL                                ; ee
-    mov al, byte [bp-008h]                    ; 8a 46 f8
+    mov al, byte [bp-00ch]                    ; 8a 46 f4
     out DX, AL                                ; ee
-    mov al, byte [bp-006h]                    ; 8a 46 fa
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     out DX, AL                                ; ee
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     out DX, AL                                ; ee
     mov AL, strict byte 002h                  ; b0 02
     out DX, AL                                ; ee
     movzx dx, byte [bp-00ah]                  ; 0f b6 56 f6
-    movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
+    movzx ax, ch                              ; 0f b6 c5
     add ax, dx                                ; 01 d0
     dec ax                                    ; 48
     mov dx, 003f5h                            ; ba f5 03
@@ -4008,52 +4068,52 @@ _int13_diskette_function:                    ; 0xf2ede LB 0x729
     out DX, AL                                ; ee
     mov AL, strict byte 0ffh                  ; b0 ff
     out DX, AL                                ; ee
-    call 02c0dh                               ; e8 ca fa
+    call 02c5dh                               ; e8 c2 fa
     test al, al                               ; 84 c0
-    jne short 0315bh                          ; 75 14
-    call 02c53h                               ; e8 09 fb
+    jne short 031b3h                          ; 75 14
+    call 02ca3h                               ; e8 01 fb
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 080h                               ; 80 cc 80
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, 00080h                            ; b8 80 00
-    jmp near 030b8h                           ; e9 5d ff
+    jmp near 0310fh                           ; e9 5c ff
     mov dx, 003f4h                            ; ba f4 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     and AL, strict byte 0c0h                  ; 24 c0
     cmp AL, strict byte 0c0h                  ; 3c c0
-    je short 03175h                           ; 74 0e
+    je short 031cdh                           ; 74 0e
     push 00255h                               ; 68 55 02
     push 00288h                               ; 68 88 02
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 b0 e7
+    call 01972h                               ; e8 a8 e7
     add sp, strict byte 00006h                ; 83 c4 06
     xor si, si                                ; 31 f6
-    jmp short 0317eh                          ; eb 05
+    jmp short 031d6h                          ; eb 05
     cmp si, strict byte 00007h                ; 83 fe 07
-    jnl short 03196h                          ; 7d 18
+    jnl short 031eeh                          ; 7d 18
     mov dx, 003f5h                            ; ba f5 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
-    mov byte [bp+si-016h], al                 ; 88 42 ea
+    mov byte [bp+si-01ah], al                 ; 88 42 e6
     movzx bx, al                              ; 0f b6 d8
     lea dx, [si+042h]                         ; 8d 54 42
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 7b e4
+    call 0165eh                               ; e8 73 e4
     inc si                                    ; 46
-    jmp short 03179h                          ; eb e3
-    test byte [bp-016h], 0c0h                 ; f6 46 ea c0
-    je short 031adh                           ; 74 11
+    jmp short 031d1h                          ; eb e3
+    test byte [bp-01ah], 0c0h                 ; f6 46 e6 c0
+    je short 03205h                           ; 74 11
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 020h                               ; 80 cc 20
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, strict word 00020h                ; b8 20 00
-    jmp near 030b8h                           ; e9 0b ff
-    movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
+    jmp near 0310fh                           ; e9 0a ff
+    movzx ax, ch                              ; 0f b6 c5
     sal ax, 009h                              ; c1 e0 09
     cwd                                       ; 99
     db  02bh, 0c2h
@@ -4068,83 +4128,83 @@ _int13_diskette_function:                    ; 0xf2ede LB 0x729
     mov ds, dx                                ; 8e da
     rep movsw                                 ; f3 a5
     pop DS                                    ; 1f
-    movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 02bbfh                               ; e8 e9 f9
+    movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02c0fh                               ; e8 e2 f9
     mov byte [bp+017h], 000h                  ; c6 46 17 00
-    and byte [bp+01ch], 0feh                  ; 80 66 1c fe
-    jmp near 02fc3h                           ; e9 e2 fd
-    cmp ch, 003h                              ; 80 fd 03
-    jne near 032f6h                           ; 0f 85 0e 01
-    mov cx, word [bp+006h]                    ; 8b 4e 06
-    shr cx, 00ch                              ; c1 e9 0c
-    mov ah, cl                                ; 88 cc
+    jmp near 036aeh                           ; e9 7a 04
+    cmp byte [bp-006h], 003h                  ; 80 7e fa 03
+    jne near 0334fh                           ; 0f 85 13 01
+    mov ax, word [bp+006h]                    ; 8b 46 06
+    shr ax, 00ch                              ; c1 e8 0c
+    mov cl, al                                ; 88 c1
     mov dx, word [bp+006h]                    ; 8b 56 06
     sal dx, 004h                              ; c1 e2 04
     mov bx, word [bp+010h]                    ; 8b 5e 10
     add bx, dx                                ; 01 d3
-    cmp bx, dx                                ; 39 d3
-    jnc short 03201h                          ; 73 02
-    db  0feh, 0c4h
-    ; inc ah                                    ; fe c4
-    movzx cx, byte [bp-00ch]                  ; 0f b6 4e f4
-    sal cx, 009h                              ; c1 e1 09
-    dec cx                                    ; 49
-    mov dx, bx                                ; 89 da
-    add dx, cx                                ; 01 ca
+    mov word [bp-012h], bx                    ; 89 5e ee
     cmp dx, bx                                ; 39 da
-    jc near 030aah                            ; 0f 82 97 fe
+    jbe short 03258h                          ; 76 02
+    db  0feh, 0c1h
+    ; inc cl                                    ; fe c1
+    movzx bx, ch                              ; 0f b6 dd
+    sal bx, 009h                              ; c1 e3 09
+    dec bx                                    ; 4b
+    mov ax, word [bp-012h]                    ; 8b 46 ee
+    add ax, bx                                ; 01 d8
+    cmp ax, word [bp-012h]                    ; 3b 46 ee
+    jc near 03101h                            ; 0f 82 96 fe
     mov AL, strict byte 006h                  ; b0 06
     mov dx, strict word 0000ah                ; ba 0a 00
     out DX, AL                                ; ee
     xor al, al                                ; 30 c0
     mov dx, strict word 0000ch                ; ba 0c 00
     out DX, AL                                ; ee
-    mov al, bl                                ; 88 d8
+    mov al, byte [bp-012h]                    ; 8a 46 ee
     mov dx, strict word 00004h                ; ba 04 00
     out DX, AL                                ; ee
-    shr bx, 008h                              ; c1 eb 08
-    mov al, bl                                ; 88 d8
+    mov ax, word [bp-012h]                    ; 8b 46 ee
+    shr ax, 008h                              ; c1 e8 08
     out DX, AL                                ; ee
-    xor al, bl                                ; 30 d8
+    xor al, al                                ; 30 c0
     mov dx, strict word 0000ch                ; ba 0c 00
     out DX, AL                                ; ee
-    mov al, cl                                ; 88 c8
+    mov al, bl                                ; 88 d8
     mov dx, strict word 00005h                ; ba 05 00
     out DX, AL                                ; ee
-    shr cx, 008h                              ; c1 e9 08
-    mov al, cl                                ; 88 c8
+    mov ax, bx                                ; 89 d8
+    shr ax, 008h                              ; c1 e8 08
     out DX, AL                                ; ee
     mov AL, strict byte 04ah                  ; b0 4a
     mov dx, strict word 0000bh                ; ba 0b 00
     out DX, AL                                ; ee
-    mov al, ah                                ; 88 e0
+    mov al, cl                                ; 88 c8
     mov dx, 00081h                            ; ba 81 00
     out DX, AL                                ; ee
     mov AL, strict byte 002h                  ; b0 02
     mov dx, strict word 0000ah                ; ba 0a 00
     out DX, AL                                ; ee
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 02c7eh                               ; e8 28 fa
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02cceh                               ; e8 1e fa
     mov AL, strict byte 0c5h                  ; b0 c5
     mov dx, 003f5h                            ; ba f5 03
     out DX, AL                                ; ee
-    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
+    movzx dx, byte [bp-00eh]                  ; 0f b6 56 f2
     sal dx, 002h                              ; c1 e2 02
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     or ax, dx                                 ; 09 d0
     mov dx, 003f5h                            ; ba f5 03
     out DX, AL                                ; ee
-    mov al, byte [bp-008h]                    ; 8a 46 f8
+    mov al, byte [bp-00ch]                    ; 8a 46 f4
     out DX, AL                                ; ee
-    mov al, byte [bp-006h]                    ; 8a 46 fa
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     out DX, AL                                ; ee
     mov al, byte [bp-00ah]                    ; 8a 46 f6
     out DX, AL                                ; ee
     mov AL, strict byte 002h                  ; b0 02
     out DX, AL                                ; ee
     movzx dx, byte [bp-00ah]                  ; 0f b6 56 f6
-    movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
+    movzx ax, ch                              ; 0f b6 c5
     add ax, dx                                ; 01 d0
     dec ax                                    ; 48
     mov dx, 003f5h                            ; ba f5 03
@@ -4153,210 +4213,216 @@ _int13_diskette_function:                    ; 0xf2ede LB 0x729
     out DX, AL                                ; ee
     mov AL, strict byte 0ffh                  ; b0 ff
     out DX, AL                                ; ee
-    call 02c0dh                               ; e8 79 f9
+    call 02c5dh                               ; e8 70 f9
     test al, al                               ; 84 c0
-    je near 03147h                            ; 0f 84 ad fe
+    je near 0319fh                            ; 0f 84 ac fe
     mov dx, 003f4h                            ; ba f4 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     and AL, strict byte 0c0h                  ; 24 c0
     cmp AL, strict byte 0c0h                  ; 3c c0
-    je short 032b4h                           ; 74 0e
+    je short 0330dh                           ; 74 0e
     push 00255h                               ; 68 55 02
     push 00288h                               ; 68 88 02
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 71 e6
+    call 01972h                               ; e8 68 e6
     add sp, strict byte 00006h                ; 83 c4 06
     xor si, si                                ; 31 f6
-    jmp short 032bdh                          ; eb 05
+    jmp short 03316h                          ; eb 05
     cmp si, strict byte 00007h                ; 83 fe 07
-    jnl short 032d5h                          ; 7d 18
+    jnl short 0332eh                          ; 7d 18
     mov dx, 003f5h                            ; ba f5 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
-    mov byte [bp+si-016h], al                 ; 88 42 ea
+    mov byte [bp+si-01ah], al                 ; 88 42 e6
     movzx bx, al                              ; 0f b6 d8
     lea dx, [si+042h]                         ; 8d 54 42
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 3c e3
+    call 0165eh                               ; e8 33 e3
     inc si                                    ; 46
-    jmp short 032b8h                          ; eb e3
-    test byte [bp-016h], 0c0h                 ; f6 46 ea c0
-    je near 031cbh                            ; 0f 84 ee fe
-    test byte [bp-015h], 002h                 ; f6 46 eb 02
-    je short 032efh                           ; 74 0c
+    jmp short 03311h                          ; eb e3
+    test byte [bp-01ah], 0c0h                 ; f6 46 e6 c0
+    je near 03222h                            ; 0f 84 ec fe
+    test byte [bp-019h], 002h                 ; f6 46 e7 02
+    je short 03348h                           ; 74 0c
     mov word [bp+016h], 00300h                ; c7 46 16 00 03
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
-    jmp near 02fc3h                           ; e9 d4 fc
+    jmp near 03021h                           ; e9 d9 fc
     mov word [bp+016h], 00100h                ; c7 46 16 00 01
-    jmp short 032e8h                          ; eb f2
-    movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 02bbfh                               ; e8 be f8
+    jmp short 03341h                          ; eb f2
+    movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02c0fh                               ; e8 b5 f8
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
     mov byte [bp+017h], 000h                  ; c6 46 17 00
-    jmp near 02fc3h                           ; e9 b7 fc
-    mov al, byte [bp+016h]                    ; 8a 46 16
+    jmp near 03021h                           ; e9 bc fc
+    mov ch, byte [bp+016h]                    ; 8a 6e 16
+    mov ax, word [bp+014h]                    ; 8b 46 14
+    shr ax, 008h                              ; c1 e8 08
     mov byte [bp-00ch], al                    ; 88 46 f4
-    mov dx, word [bp+014h]                    ; 8b 56 14
+    mov dx, word [bp+012h]                    ; 8b 56 12
     shr dx, 008h                              ; c1 ea 08
-    mov ax, word [bp+012h]                    ; 8b 46 12
-    shr ax, 008h                              ; c1 e8 08
-    mov byte [bp-006h], al                    ; 88 46 fa
+    mov byte [bp-00eh], dl                    ; 88 56 f2
     mov bl, byte [bp+00eh]                    ; 8a 5e 0e
-    mov byte [bp-00eh], bl                    ; 88 5e f2
+    mov byte [bp-008h], bl                    ; 88 5e f8
     cmp bl, 001h                              ; 80 fb 01
-    jnbe short 03340h                         ; 77 14
-    cmp AL, strict byte 001h                  ; 3c 01
-    jnbe short 03340h                         ; 77 10
-    cmp dl, 04fh                              ; 80 fa 4f
-    jnbe short 03340h                         ; 77 0b
-    mov al, byte [bp-00ch]                    ; 8a 46 f4
-    test al, al                               ; 84 c0
-    je short 03340h                           ; 74 04
-    cmp AL, strict byte 012h                  ; 3c 12
-    jbe short 03355h                          ; 76 15
+    jnbe short 03397h                         ; 77 12
+    cmp dl, 001h                              ; 80 fa 01
+    jnbe short 03397h                         ; 77 0d
+    cmp AL, strict byte 04fh                  ; 3c 4f
+    jnbe short 03397h                         ; 77 09
+    test ch, ch                               ; 84 ed
+    je short 03397h                           ; 74 05
+    cmp ch, 012h                              ; 80 fd 12
+    jbe short 033ach                          ; 76 15
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 001h                               ; 80 cc 01
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, strict word 00001h                ; b8 01 00
-    call 02ba7h                               ; e8 56 f8
+    call 02bf7h                               ; e8 4f f8
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 02ebah                               ; e8 5e fb
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02f0ah                               ; e8 57 fb
     test ax, ax                               ; 85 c0
-    je near 02f91h                            ; 0f 84 2f fc
-    movzx dx, byte [bp-00eh]                  ; 0f b6 56 f2
+    je near 02fefh                            ; 0f 84 36 fc
+    movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
     mov ax, dx                                ; 89 d0
-    call 02cffh                               ; e8 94 f9
+    call 02d4fh                               ; e8 8d f9
     test ax, ax                               ; 85 c0
-    jne short 0337ah                          ; 75 0b
+    jne short 033d1h                          ; 75 0b
     mov ax, dx                                ; 89 d0
-    call 02dcah                               ; e8 56 fa
+    call 02e1ah                               ; e8 4f fa
     test ax, ax                               ; 85 c0
-    je near 0306ah                            ; 0f 84 f0 fc
+    je near 030bch                            ; 0f 84 eb fc
+    mov ax, word [bp+006h]                    ; 8b 46 06
+    shr ax, 00ch                              ; c1 e8 0c
+    mov cl, al                                ; 88 c1
     mov dx, word [bp+006h]                    ; 8b 56 06
-    shr dx, 00ch                              ; c1 ea 0c
-    mov ah, dl                                ; 88 d4
-    mov cx, word [bp+006h]                    ; 8b 4e 06
-    sal cx, 004h                              ; c1 e1 04
+    sal dx, 004h                              ; c1 e2 04
     mov bx, word [bp+010h]                    ; 8b 5e 10
-    add bx, cx                                ; 01 cb
-    cmp bx, cx                                ; 39 cb
-    jnc short 03393h                          ; 73 02
-    db  0feh, 0c4h
-    ; inc ah                                    ; fe c4
-    movzx cx, byte [bp-00ch]                  ; 0f b6 4e f4
-    sal cx, 002h                              ; c1 e1 02
-    dec cx                                    ; 49
-    mov dx, bx                                ; 89 da
-    add dx, cx                                ; 01 ca
+    add bx, dx                                ; 01 d3
+    mov word [bp-012h], bx                    ; 89 5e ee
     cmp dx, bx                                ; 39 da
-    jc near 030aah                            ; 0f 82 05 fd
+    jbe short 033edh                          ; 76 02
+    db  0feh, 0c1h
+    ; inc cl                                    ; fe c1
+    movzx bx, ch                              ; 0f b6 dd
+    sal bx, 002h                              ; c1 e3 02
+    dec bx                                    ; 4b
+    mov ax, word [bp-012h]                    ; 8b 46 ee
+    add ax, bx                                ; 01 d8
+    cmp ax, word [bp-012h]                    ; 3b 46 ee
+    jc near 03101h                            ; 0f 82 01 fd
     mov AL, strict byte 006h                  ; b0 06
     mov dx, strict word 0000ah                ; ba 0a 00
     out DX, AL                                ; ee
     xor al, al                                ; 30 c0
     mov dx, strict word 0000ch                ; ba 0c 00
     out DX, AL                                ; ee
-    mov al, bl                                ; 88 d8
+    mov al, byte [bp-012h]                    ; 8a 46 ee
     mov dx, strict word 00004h                ; ba 04 00
     out DX, AL                                ; ee
-    shr bx, 008h                              ; c1 eb 08
-    mov al, bl                                ; 88 d8
+    mov ax, word [bp-012h]                    ; 8b 46 ee
+    shr ax, 008h                              ; c1 e8 08
     out DX, AL                                ; ee
-    xor al, bl                                ; 30 d8
+    xor al, al                                ; 30 c0
     mov dx, strict word 0000ch                ; ba 0c 00
     out DX, AL                                ; ee
-    mov al, cl                                ; 88 c8
+    mov al, bl                                ; 88 d8
     mov dx, strict word 00005h                ; ba 05 00
     out DX, AL                                ; ee
-    shr cx, 008h                              ; c1 e9 08
-    mov al, cl                                ; 88 c8
+    mov ax, bx                                ; 89 d8
+    shr ax, 008h                              ; c1 e8 08
     out DX, AL                                ; ee
     mov AL, strict byte 04ah                  ; b0 4a
     mov dx, strict word 0000bh                ; ba 0b 00
     out DX, AL                                ; ee
-    mov al, ah                                ; 88 e0
+    mov al, cl                                ; 88 c8
     mov dx, 00081h                            ; ba 81 00
     out DX, AL                                ; ee
     mov AL, strict byte 002h                  ; b0 02
     mov dx, strict word 0000ah                ; ba 0a 00
     out DX, AL                                ; ee
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    call 02c7eh                               ; e8 96 f8
-    mov AL, strict byte 04dh                  ; b0 4d
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02cceh                               ; e8 89 f8
+    mov AL, strict byte 00fh                  ; b0 0f
     mov dx, 003f5h                            ; ba f5 03
     out DX, AL                                ; ee
-    movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
-    sal dx, 002h                              ; c1 e2 02
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
-    or ax, dx                                 ; 09 d0
-    mov dx, 003f5h                            ; ba f5 03
+    movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
+    sal bx, 002h                              ; c1 e3 02
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    or bx, ax                                 ; 09 c3
+    mov al, bl                                ; 88 d8
+    out DX, AL                                ; ee
+    mov al, byte [bp-00ch]                    ; 8a 46 f4
+    out DX, AL                                ; ee
+    mov AL, strict byte 04dh                  ; b0 4d
+    out DX, AL                                ; ee
+    mov al, bl                                ; 88 d8
     out DX, AL                                ; ee
     mov AL, strict byte 002h                  ; b0 02
     out DX, AL                                ; ee
-    mov al, byte [bp-00ch]                    ; 8a 46 f4
+    mov al, ch                                ; 88 e8
     out DX, AL                                ; ee
-    xor al, al                                ; 30 c0
+    xor al, ch                                ; 30 e8
     out DX, AL                                ; ee
     mov AL, strict byte 0f6h                  ; b0 f6
     out DX, AL                                ; ee
-    call 02c0dh                               ; e8 fe f7
+    call 02c5dh                               ; e8 e9 f7
     test al, al                               ; 84 c0
-    jne short 03419h                          ; 75 06
-    call 02c53h                               ; e8 3d f8
-    jmp near 02f91h                           ; e9 78 fb
+    jne short 0347eh                          ; 75 06
+    call 02ca3h                               ; e8 28 f8
+    jmp near 02fefh                           ; e9 71 fb
     mov dx, 003f4h                            ; ba f4 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     and AL, strict byte 0c0h                  ; 24 c0
     cmp AL, strict byte 0c0h                  ; 3c c0
-    je short 03433h                           ; 74 0e
+    je short 03498h                           ; 74 0e
     push 00255h                               ; 68 55 02
     push 00288h                               ; 68 88 02
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 f2 e4
+    call 01972h                               ; e8 dd e4
     add sp, strict byte 00006h                ; 83 c4 06
     xor si, si                                ; 31 f6
-    jmp short 0343ch                          ; eb 05
+    jmp short 034a1h                          ; eb 05
     cmp si, strict byte 00007h                ; 83 fe 07
-    jnl short 03454h                          ; 7d 18
+    jnl short 034b9h                          ; 7d 18
     mov dx, 003f5h                            ; ba f5 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
-    mov byte [bp+si-016h], al                 ; 88 42 ea
+    mov byte [bp+si-01ah], al                 ; 88 42 e6
     movzx bx, al                              ; 0f b6 d8
     lea dx, [si+042h]                         ; 8d 54 42
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 bd e1
+    call 0165eh                               ; e8 a8 e1
     inc si                                    ; 46
-    jmp short 03437h                          ; eb e3
-    test byte [bp-016h], 0c0h                 ; f6 46 ea c0
-    je short 03470h                           ; 74 16
-    test byte [bp-015h], 002h                 ; f6 46 eb 02
-    jne near 032e3h                           ; 0f 85 81 fe
+    jmp short 0349ch                          ; eb e3
+    test byte [bp-01ah], 0c0h                 ; f6 46 e6 c0
+    je short 034d5h                           ; 74 16
+    test byte [bp-019h], 002h                 ; f6 46 e7 02
+    jne near 0333ch                           ; 0f 85 75 fe
     push 00255h                               ; 68 55 02
     push 0029ch                               ; 68 9c 02
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 b5 e4
+    call 01972h                               ; e8 a0 e4
     add sp, strict byte 00006h                ; 83 c4 06
     xor al, al                                ; 30 c0
     mov byte [bp+017h], al                    ; 88 46 17
     xor ah, ah                                ; 30 e4
-    call 02ba7h                               ; e8 2d f7
-    movzx ax, byte [bp-00eh]                  ; 0f b6 46 f2
+    call 02bf7h                               ; e8 18 f7
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     xor dx, dx                                ; 31 d2
-    call 02bbfh                               ; e8 3c f7
-    jmp near 031dah                           ; e9 54 fd
-    mov byte [bp-00eh], ah                    ; 88 66 f2
-    cmp ah, 001h                              ; 80 fc 01
-    jbe short 034aeh                          ; 76 20
+    call 02c0fh                               ; e8 27 f7
+    jmp near 036aeh                           ; e9 c3 01
+    mov byte [bp-008h], al                    ; 88 46 f8
+    cmp AL, strict byte 001h                  ; 3c 01
+    jbe short 0350fh                          ; 76 1d
     xor ax, ax                                ; 31 c0
     mov word [bp+016h], ax                    ; 89 46 16
     mov word [bp+010h], ax                    ; 89 46 10
@@ -4364,326 +4430,489 @@ _int13_diskette_function:                    ; 0xf2ede LB 0x729
     mov word [bp+012h], ax                    ; 89 46 12
     mov word [bp+006h], ax                    ; 89 46 06
     mov word [bp+008h], ax                    ; 89 46 08
-    movzx ax, cl                              ; 0f b6 c1
+    movzx ax, ch                              ; 0f b6 c5
     mov word [bp+012h], ax                    ; 89 46 12
-    mov word [bp+01ch], dx                    ; 89 56 1c
-    jmp near 02fc3h                           ; e9 15 fb
+    jmp near 0362ch                           ; e9 1d 01
     mov ax, strict word 00010h                ; b8 10 00
-    call 0165ch                               ; e8 a8 e1
-    mov dl, al                                ; 88 c2
-    xor cl, cl                                ; 30 c9
+    call 016ach                               ; e8 97 e1
+    mov cl, al                                ; 88 c1
+    xor ch, ch                                ; 30 ed
     test AL, strict byte 0f0h                 ; a8 f0
-    je short 034beh                           ; 74 02
-    mov CL, strict byte 001h                  ; b1 01
-    test dl, 00fh                             ; f6 c2 0f
-    je short 034c5h                           ; 74 02
-    db  0feh, 0c1h
-    ; inc cl                                    ; fe c1
-    cmp byte [bp-00eh], 000h                  ; 80 7e f2 00
-    jne short 034d0h                          ; 75 05
-    shr dl, 004h                              ; c0 ea 04
-    jmp short 034d3h                          ; eb 03
-    and dl, 00fh                              ; 80 e2 0f
+    je short 0351fh                           ; 74 02
+    mov CH, strict byte 001h                  ; b5 01
+    test cl, 00fh                             ; f6 c1 0f
+    je short 03526h                           ; 74 02
+    db  0feh, 0c5h
+    ; inc ch                                    ; fe c5
+    cmp byte [bp-008h], 000h                  ; 80 7e f8 00
+    jne short 03531h                          ; 75 05
+    shr cl, 004h                              ; c0 e9 04
+    jmp short 03534h                          ; eb 03
+    and cl, 00fh                              ; 80 e1 0f
     mov byte [bp+011h], 000h                  ; c6 46 11 00
-    movzx ax, dl                              ; 0f b6 c2
+    movzx ax, cl                              ; 0f b6 c1
     mov word [bp+010h], ax                    ; 89 46 10
     mov word [bp+016h], strict word 00000h    ; c7 46 16 00 00
-    mov bx, word [bp+012h]                    ; 8b 5e 12
-    xor bl, bl                                ; 30 db
-    movzx ax, cl                              ; 0f b6 c1
-    or bx, ax                                 ; 09 c3
-    mov word [bp+012h], bx                    ; 89 5e 12
-    mov ax, bx                                ; 89 d8
-    xor ah, bh                                ; 30 fc
+    mov ax, word [bp+012h]                    ; 8b 46 12
+    xor al, al                                ; 30 c0
+    movzx dx, ch                              ; 0f b6 d5
+    or ax, dx                                 ; 09 d0
+    mov word [bp+012h], ax                    ; 89 46 12
+    xor ah, ah                                ; 30 e4
     or ah, 001h                               ; 80 cc 01
     mov word [bp+012h], ax                    ; 89 46 12
-    cmp dl, 003h                              ; 80 fa 03
-    jc short 03513h                           ; 72 15
-    jbe short 0353ah                          ; 76 3a
-    cmp dl, 005h                              ; 80 fa 05
-    jc short 03541h                           ; 72 3c
-    jbe short 03548h                          ; 76 41
-    cmp dl, 00fh                              ; 80 fa 0f
-    je short 03556h                           ; 74 4a
-    cmp dl, 00eh                              ; 80 fa 0e
-    je short 0354fh                           ; 74 3e
-    jmp short 0355dh                          ; eb 4a
-    cmp dl, 002h                              ; 80 fa 02
-    je short 03533h                           ; 74 1b
-    cmp dl, 001h                              ; 80 fa 01
-    je short 0352ch                           ; 74 0f
-    test dl, dl                               ; 84 d2
-    jne short 0355dh                          ; 75 3c
+    cmp cl, 003h                              ; 80 f9 03
+    jc short 03572h                           ; 72 15
+    jbe short 03599h                          ; 76 3a
+    cmp cl, 005h                              ; 80 f9 05
+    jc short 035a0h                           ; 72 3c
+    jbe short 035a7h                          ; 76 41
+    cmp cl, 00fh                              ; 80 f9 0f
+    je short 035b5h                           ; 74 4a
+    cmp cl, 00eh                              ; 80 f9 0e
+    je short 035aeh                           ; 74 3e
+    jmp short 035bch                          ; eb 4a
+    cmp cl, 002h                              ; 80 f9 02
+    je short 03592h                           ; 74 1b
+    cmp cl, 001h                              ; 80 f9 01
+    je short 0358bh                           ; 74 0f
+    test cl, cl                               ; 84 c9
+    jne short 035bch                          ; 75 3c
     mov word [bp+014h], strict word 00000h    ; c7 46 14 00 00
     mov byte [bp+013h], 000h                  ; c6 46 13 00
-    jmp short 0356bh                          ; eb 3f
+    jmp short 035cah                          ; eb 3f
     mov word [bp+014h], 02709h                ; c7 46 14 09 27
-    jmp short 0356bh                          ; eb 38
+    jmp short 035cah                          ; eb 38
     mov word [bp+014h], 04f0fh                ; c7 46 14 0f 4f
-    jmp short 0356bh                          ; eb 31
+    jmp short 035cah                          ; eb 31
     mov word [bp+014h], 04f09h                ; c7 46 14 09 4f
-    jmp short 0356bh                          ; eb 2a
+    jmp short 035cah                          ; eb 2a
     mov word [bp+014h], 04f12h                ; c7 46 14 12 4f
-    jmp short 0356bh                          ; eb 23
+    jmp short 035cah                          ; eb 23
     mov word [bp+014h], 04f24h                ; c7 46 14 24 4f
-    jmp short 0356bh                          ; eb 1c
+    jmp short 035cah                          ; eb 1c
     mov word [bp+014h], 0fe3fh                ; c7 46 14 3f fe
-    jmp short 0356bh                          ; eb 15
+    jmp short 035cah                          ; eb 15
     mov word [bp+014h], 0feffh                ; c7 46 14 ff fe
-    jmp short 0356bh                          ; eb 0e
+    jmp short 035cah                          ; eb 0e
     push 00255h                               ; 68 55 02
     push 002adh                               ; 68 ad 02
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 ba e3
+    call 01972h                               ; e8 ab e3
     add sp, strict byte 00006h                ; 83 c4 06
     mov word [bp+006h], 0f000h                ; c7 46 06 00 f0
-    movzx ax, dl                              ; 0f b6 c2
-    call 03607h                               ; e8 91 00
+    movzx ax, cl                              ; 0f b6 c1
+    call 03825h                               ; e8 50 02
     mov word [bp+008h], ax                    ; 89 46 08
-    jmp near 031dah                           ; e9 5e fc
-    mov byte [bp-00eh], ah                    ; 88 66 f2
-    cmp ah, 001h                              ; 80 fc 01
-    jbe short 0358ah                          ; 76 06
+    jmp near 036aeh                           ; e9 d3 00
+    mov byte [bp-008h], al                    ; 88 46 f8
+    cmp AL, strict byte 001h                  ; 3c 01
+    jbe short 035e7h                          ; 76 05
     mov word [bp+016h], si                    ; 89 76 16
-    jmp near 034a8h                           ; e9 1e ff
+    jmp short 0362ch                          ; eb 45
     mov ax, strict word 00010h                ; b8 10 00
-    call 0165ch                               ; e8 cc e0
-    cmp byte [bp-00eh], 000h                  ; 80 7e f2 00
-    jne short 0359dh                          ; 75 07
-    mov dl, al                                ; 88 c2
-    shr dl, 004h                              ; c0 ea 04
-    jmp short 035a2h                          ; eb 05
-    mov dl, al                                ; 88 c2
-    and dl, 00fh                              ; 80 e2 0f
+    call 016ach                               ; e8 bf e0
+    cmp byte [bp-008h], 000h                  ; 80 7e f8 00
+    jne short 035fah                          ; 75 07
+    mov cl, al                                ; 88 c1
+    shr cl, 004h                              ; c0 e9 04
+    jmp short 035ffh                          ; eb 05
+    mov cl, al                                ; 88 c1
+    and cl, 00fh                              ; 80 e1 0f
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
-    mov bx, word [bp+016h]                    ; 8b 5e 16
-    xor bh, bh                                ; 30 ff
-    test dl, dl                               ; 84 d2
-    je short 035bch                           ; 74 0d
-    cmp dl, 001h                              ; 80 fa 01
-    jbe short 035b9h                          ; 76 05
-    or bh, 002h                               ; 80 cf 02
-    jmp short 035bch                          ; eb 03
-    or bh, 001h                               ; 80 cf 01
-    mov word [bp+016h], bx                    ; 89 5e 16
-    jmp near 02fc3h                           ; e9 01 fa
-    cmp ah, 001h                              ; 80 fc 01
-    jbe short 035d3h                          ; 76 0c
+    mov dx, word [bp+016h]                    ; 8b 56 16
+    xor dh, dh                                ; 30 f6
+    test cl, cl                               ; 84 c9
+    je short 03619h                           ; 74 0d
+    cmp cl, 001h                              ; 80 f9 01
+    jbe short 03616h                          ; 76 05
+    or dh, 002h                               ; 80 ce 02
+    jmp short 03619h                          ; eb 03
+    or dh, 001h                               ; 80 ce 01
+    mov word [bp+016h], dx                    ; 89 56 16
+    jmp near 03021h                           ; e9 02 fa
+    cmp AL, strict byte 001h                  ; 3c 01
+    jbe short 03632h                          ; 76 0f
     mov word [bp+016h], si                    ; 89 76 16
     mov ax, strict word 00001h                ; b8 01 00
-    call 02ba7h                               ; e8 d7 f5
-    jmp near 034a8h                           ; e9 d5 fe
+    call 02bf7h                               ; e8 cb f5
+    mov word [bp+01ch], dx                    ; 89 56 1c
+    jmp near 03021h                           ; e9 ef f9
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 006h                               ; 80 cc 06
     mov word [bp+016h], ax                    ; 89 46 16
     mov ax, strict word 00006h                ; b8 06 00
-    jmp near 02f6fh                           ; e9 8b f9
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 02fcdh                           ; e9 8a f9
+    mov byte [bp-008h], al                    ; 88 46 f8
+    mov bl, cl                                ; 88 cb
+    cmp AL, strict byte 001h                  ; 3c 01
+    jnbe short 03623h                         ; 77 d7
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02f0ah                               ; e8 b7 f8
+    test ax, ax                               ; 85 c0
+    je near 02fefh                            ; 0f 84 96 f9
+    cmp byte [bp-008h], 000h                  ; 80 7e f8 00
+    db  00fh, 095h, 0c0h
+    ; setne al                                  ; 0f 95 c0
+    movzx dx, al                              ; 0f b6 d0
+    add dx, 00090h                            ; 81 c2 90 00
+    mov word [bp-012h], dx                    ; 89 56 ee
+    mov ax, strict word 00040h                ; b8 40 00
+    call 01650h                               ; e8 e0 df
+    and AL, strict byte 00fh                  ; 24 0f
+    cmp bl, 002h                              ; 80 fb 02
+    jc short 03686h                           ; 72 0f
+    jbe short 03692h                          ; 76 19
+    cmp bl, 004h                              ; 80 fb 04
+    je short 0368eh                           ; 74 10
+    cmp bl, 003h                              ; 80 fb 03
+    je short 03696h                           ; 74 13
+    jmp near 02fbfh                           ; e9 39 f9
+    cmp bl, 001h                              ; 80 fb 01
+    je short 0368eh                           ; 74 03
+    jmp near 02fbfh                           ; e9 31 f9
+    or AL, strict byte 090h                   ; 0c 90
+    jmp short 03698h                          ; eb 06
+    or AL, strict byte 070h                   ; 0c 70
+    jmp short 03698h                          ; eb 02
+    or AL, strict byte 010h                   ; 0c 10
+    movzx bx, al                              ; 0f b6 d8
+    mov dx, word [bp-012h]                    ; 8b 56 ee
+    mov ax, strict word 00040h                ; b8 40 00
+    call 0165eh                               ; e8 ba df
+    xor al, al                                ; 30 c0
+    mov byte [bp+017h], al                    ; 88 46 17
+    xor ah, ah                                ; 30 e4
+    call 02bf7h                               ; e8 49 f5
+    and byte [bp+01ch], 0feh                  ; 80 66 1c fe
+    jmp near 03021h                           ; e9 6c f9
+    mov byte [bp-008h], al                    ; 88 46 f8
+    mov ch, ah                                ; 88 e5
+    and ch, 03fh                              ; 80 e5 3f
+    movzx bx, ah                              ; 0f b6 dc
+    sar bx, 006h                              ; c1 fb 06
+    sal bx, 008h                              ; c1 e3 08
+    add bx, word [bp-010h]                    ; 03 5e f0
+    mov byte [bp-00ch], bl                    ; 88 5e f4
+    cmp AL, strict byte 001h                  ; 3c 01
+    jnbe near 03623h                          ; 0f 87 51 ff
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 02f0ah                               ; e8 31 f8
+    test ax, ax                               ; 85 c0
+    je near 02fefh                            ; 0f 84 10 f9
+    movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
+    mov ax, dx                                ; 89 d0
+    call 02d4fh                               ; e8 67 f6
+    test ax, ax                               ; 85 c0
+    jne short 03706h                          ; 75 1a
+    mov ax, dx                                ; 89 d0
+    call 02e1ah                               ; e8 29 f7
+    test ax, ax                               ; 85 c0
+    jne short 03706h                          ; 75 11
+    mov ax, word [bp+016h]                    ; 8b 46 16
+    xor ah, ah                                ; 30 e4
+    or ah, 00ch                               ; 80 cc 0c
+    mov word [bp+016h], ax                    ; 89 46 16
+    mov ax, strict word 0000ch                ; b8 0c 00
+    jmp near 02fcdh                           ; e9 c7 f8
+    mov ax, strict word 00010h                ; b8 10 00
+    call 016ach                               ; e8 a0 df
+    cmp byte [bp-008h], 000h                  ; 80 7e f8 00
+    jne short 03719h                          ; 75 07
+    mov cl, al                                ; 88 c1
+    shr cl, 004h                              ; c0 e9 04
+    jmp short 0371eh                          ; eb 05
+    mov cl, al                                ; 88 c1
+    and cl, 00fh                              ; 80 e1 0f
+    cmp byte [bp-008h], 000h                  ; 80 7e f8 00
+    db  00fh, 095h, 0c0h
+    ; setne al                                  ; 0f 95 c0
+    movzx dx, al                              ; 0f b6 d0
+    add dx, 00090h                            ; 81 c2 90 00
+    mov word [bp-012h], dx                    ; 89 56 ee
+    mov ax, strict word 00040h                ; b8 40 00
+    call 01650h                               ; e8 1b df
+    and AL, strict byte 00fh                  ; 24 0f
+    cmp cl, 003h                              ; 80 f9 03
+    jc short 0375ah                           ; 72 1e
+    mov dl, al                                ; 88 c2
+    or dl, 090h                               ; 80 ca 90
+    cmp cl, 003h                              ; 80 f9 03
+    jbe short 03798h                          ; 76 52
+    mov ah, al                                ; 88 c4
+    or ah, 010h                               ; 80 cc 10
+    cmp cl, 005h                              ; 80 f9 05
+    je near 037bdh                            ; 0f 84 6b 00
+    cmp cl, 004h                              ; 80 f9 04
+    je short 037a7h                           ; 74 50
+    jmp near 037d8h                           ; e9 7e 00
+    cmp cl, 002h                              ; 80 f9 02
+    je short 0377ah                           ; 74 1b
+    cmp cl, 001h                              ; 80 f9 01
+    jne near 037d8h                           ; 0f 85 72 00
+    cmp byte [bp-00ch], 027h                  ; 80 7e f4 27
+    jne near 037d8h                           ; 0f 85 6a 00
+    cmp ch, 009h                              ; 80 fd 09
+    jne near 037d8h                           ; 0f 85 63 00
+    or AL, strict byte 090h                   ; 0c 90
+    jmp near 037d8h                           ; e9 5e 00
+    cmp byte [bp-00ch], 027h                  ; 80 7e f4 27
+    jne short 03789h                          ; 75 09
+    cmp ch, 009h                              ; 80 fd 09
+    jne short 03789h                          ; 75 04
+    or AL, strict byte 070h                   ; 0c 70
+    jmp short 037d8h                          ; eb 4f
+    cmp byte [bp-00ch], 04fh                  ; 80 7e f4 4f
+    jne short 037d8h                          ; 75 49
+    cmp ch, 00fh                              ; 80 fd 0f
+    jne short 037d8h                          ; 75 44
+    or AL, strict byte 010h                   ; 0c 10
+    jmp short 037d8h                          ; eb 40
+    cmp byte [bp-00ch], 04fh                  ; 80 7e f4 4f
+    jne short 037d8h                          ; 75 3a
+    cmp ch, 009h                              ; 80 fd 09
+    jne short 037d8h                          ; 75 35
+    mov al, dl                                ; 88 d0
+    jmp short 037d8h                          ; eb 31
+    cmp byte [bp-00ch], 04fh                  ; 80 7e f4 4f
+    jne short 037d8h                          ; 75 2b
+    cmp ch, 009h                              ; 80 fd 09
+    jne short 037b4h                          ; 75 02
+    jmp short 037a3h                          ; eb ef
+    cmp ch, 012h                              ; 80 fd 12
+    jne short 037d8h                          ; 75 1f
+    mov al, ah                                ; 88 e0
+    jmp short 037d8h                          ; eb 1b
+    cmp byte [bp-00ch], 04fh                  ; 80 7e f4 4f
+    jne short 037d8h                          ; 75 15
+    cmp ch, 009h                              ; 80 fd 09
+    jne short 037cah                          ; 75 02
+    jmp short 037a3h                          ; eb d9
+    cmp ch, 012h                              ; 80 fd 12
+    jne short 037d1h                          ; 75 02
+    jmp short 037b9h                          ; eb e8
+    cmp ch, 024h                              ; 80 fd 24
+    jne short 037d8h                          ; 75 02
+    or AL, strict byte 0d0h                   ; 0c d0
+    movzx dx, al                              ; 0f b6 d0
+    sar dx, 004h                              ; c1 fa 04
+    test dl, 001h                             ; f6 c2 01
+    je near 036f5h                            ; 0f 84 10 ff
+    movzx bx, al                              ; 0f b6 d8
+    mov dx, word [bp-012h]                    ; 8b 56 ee
+    mov ax, strict word 00040h                ; b8 40 00
+    call 0165eh                               ; e8 6d de
+    mov word [bp+006h], 0f000h                ; c7 46 06 00 f0
+    movzx ax, cl                              ; 0f b6 c1
+    call 03825h                               ; e8 29 00
+    mov word [bp+008h], ax                    ; 89 46 08
+    jmp near 036a4h                           ; e9 a2 fe
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 f2 e2
+    call 01931h                               ; e8 24 e1
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 00255h                               ; 68 55 02
     push 002c2h                               ; 68 c2 02
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 21 e3
+    call 01972h                               ; e8 53 e1
     add sp, strict byte 00008h                ; 83 c4 08
-    jmp near 02f61h                           ; e9 5a f9
-get_floppy_dpt_:                             ; 0xf3607 LB 0x2f
+    jmp near 02fbfh                           ; e9 9a f7
+get_floppy_dpt_:                             ; 0xf3825 LB 0x2f
     push bx                                   ; 53
     push dx                                   ; 52
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov dl, al                                ; 88 c2
     xor ax, ax                                ; 31 c0
-    jmp short 03618h                          ; eb 06
+    jmp short 03836h                          ; eb 06
     inc ax                                    ; 40
     cmp ax, strict word 00007h                ; 3d 07 00
-    jnc short 0362fh                          ; 73 17
+    jnc short 0384dh                          ; 73 17
     mov bx, ax                                ; 89 c3
     add bx, ax                                ; 01 c3
     cmp dl, byte [word bx+0005bh]             ; 3a 97 5b 00
-    jne short 03612h                          ; 75 f0
+    jne short 03830h                          ; 75 f0
     movzx ax, byte [word bx+0005ch]           ; 0f b6 87 5c 00
     imul ax, ax, strict byte 0000dh           ; 6b c0 0d
     add ax, strict word 00000h                ; 05 00 00
-    jmp short 03632h                          ; eb 03
+    jmp short 03850h                          ; eb 03
     mov ax, strict word 00041h                ; b8 41 00
     pop bp                                    ; 5d
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     retn                                      ; c3
-dummy_soft_reset_:                           ; 0xf3636 LB 0x7
+dummy_soft_reset_:                           ; 0xf3854 LB 0x7
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     xor ax, ax                                ; 31 c0
     pop bp                                    ; 5d
     retn                                      ; c3
-_cdemu_init:                                 ; 0xf363d LB 0x18
+_cdemu_init:                                 ; 0xf385b LB 0x18
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 d3 df
+    call 0166ch                               ; e8 05 de
     xor bx, bx                                ; 31 db
     mov dx, 00322h                            ; ba 22 03
-    call 0160eh                               ; e8 bd df
+    call 0165eh                               ; e8 ef dd
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-_cdemu_isactive:                             ; 0xf3655 LB 0x16
+_cdemu_isactive:                             ; 0xf3873 LB 0x16
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 bb df
+    call 0166ch                               ; e8 ed dd
     mov dx, 00322h                            ; ba 22 03
-    call 01600h                               ; e8 99 df
+    call 01650h                               ; e8 cb dd
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-_cdemu_emulated_drive:                       ; 0xf366b LB 0x16
+_cdemu_emulated_drive:                       ; 0xf3889 LB 0x16
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 a5 df
+    call 0166ch                               ; e8 d7 dd
     mov dx, 00324h                            ; ba 24 03
-    call 01600h                               ; e8 83 df
+    call 01650h                               ; e8 b5 dd
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-_int13_eltorito:                             ; 0xf3681 LB 0x189
+_int13_eltorito:                             ; 0xf389f LB 0x189
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     push di                                   ; 57
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 8d df
+    call 0166ch                               ; e8 bf dd
     mov si, 00322h                            ; be 22 03
     mov di, ax                                ; 89 c7
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     cmp ax, strict word 0004bh                ; 3d 4b 00
-    jc short 036a9h                           ; 72 0a
-    jbe short 036cfh                          ; 76 2e
+    jc short 038c7h                           ; 72 0a
+    jbe short 038edh                          ; 76 2e
     cmp ax, strict word 0004dh                ; 3d 4d 00
-    jbe short 036b0h                          ; 76 0a
-    jmp near 037ceh                           ; e9 25 01
+    jbe short 038ceh                          ; 76 0a
+    jmp near 039ech                           ; e9 25 01
     cmp ax, strict word 0004ah                ; 3d 4a 00
-    jne near 037ceh                           ; 0f 85 1e 01
-    mov bx, 00dbah                            ; bb ba 0d
+    jne near 039ech                           ; 0f 85 1e 01
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 26 e2
+    call 01931h                               ; e8 58 e0
     push word [bp+016h]                       ; ff 76 16
     push 002dch                               ; 68 dc 02
     push 002ebh                               ; 68 eb 02
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 59 e2
+    call 01972h                               ; e8 8b e0
     add sp, strict byte 00008h                ; 83 c4 08
-    jmp near 037e9h                           ; e9 1a 01
+    jmp near 03a07h                           ; e9 1a 01
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     mov ax, word [bp+004h]                    ; 8b 46 04
     mov bx, strict word 00013h                ; bb 13 00
-    call 0160eh                               ; e8 33 df
+    call 0165eh                               ; e8 65 dd
     mov es, di                                ; 8e c7
     movzx bx, byte [es:si+001h]               ; 26 0f b6 5c 01
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     inc dx                                    ; 42
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0160eh                               ; e8 22 df
+    call 0165eh                               ; e8 54 dd
     mov es, di                                ; 8e c7
     movzx bx, byte [es:si+002h]               ; 26 0f b6 5c 02
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     inc dx                                    ; 42
     inc dx                                    ; 42
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0160eh                               ; e8 10 df
+    call 0165eh                               ; e8 42 dd
     mov es, di                                ; 8e c7
     movzx bx, byte [es:si+003h]               ; 26 0f b6 5c 03
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 00003h                ; 83 c2 03
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0160eh                               ; e8 fd de
+    call 0165eh                               ; e8 2f dd
     mov es, di                                ; 8e c7
     mov bx, word [es:si+008h]                 ; 26 8b 5c 08
     mov cx, word [es:si+00ah]                 ; 26 8b 4c 0a
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 00004h                ; 83 c2 04
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0164ah                               ; e8 23 df
+    call 0169ah                               ; e8 55 dd
     mov es, di                                ; 8e c7
     mov bx, word [es:si+004h]                 ; 26 8b 5c 04
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 00008h                ; 83 c2 08
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0162ah                               ; e8 f1 de
+    call 0167ah                               ; e8 23 dd
     mov es, di                                ; 8e c7
     mov bx, word [es:si+006h]                 ; 26 8b 5c 06
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 0000ah                ; 83 c2 0a
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0162ah                               ; e8 df de
+    call 0167ah                               ; e8 11 dd
     mov es, di                                ; 8e c7
     mov bx, word [es:si+00ch]                 ; 26 8b 5c 0c
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 0000ch                ; 83 c2 0c
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0162ah                               ; e8 cd de
+    call 0167ah                               ; e8 ff dc
     mov es, di                                ; 8e c7
     mov bx, word [es:si+00eh]                 ; 26 8b 5c 0e
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 0000eh                ; 83 c2 0e
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0162ah                               ; e8 bb de
+    call 0167ah                               ; e8 ed dc
     mov es, di                                ; 8e c7
     movzx bx, byte [es:si+012h]               ; 26 0f b6 5c 12
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 00010h                ; 83 c2 10
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0160eh                               ; e8 8c de
+    call 0165eh                               ; e8 be dc
     mov es, di                                ; 8e c7
     movzx bx, byte [es:si+014h]               ; 26 0f b6 5c 14
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 00011h                ; 83 c2 11
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0160eh                               ; e8 79 de
+    call 0165eh                               ; e8 ab dc
     mov es, di                                ; 8e c7
     movzx bx, byte [es:si+010h]               ; 26 0f b6 5c 10
     mov dx, word [bp+00ah]                    ; 8b 56 0a
     add dx, strict byte 00012h                ; 83 c2 12
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 0160eh                               ; e8 66 de
+    call 0165eh                               ; e8 98 dc
     test byte [bp+016h], 0ffh                 ; f6 46 16 ff
-    jne short 037b4h                          ; 75 06
+    jne short 039d2h                          ; 75 06
     mov es, di                                ; 8e c7
     mov byte [es:si], 000h                    ; 26 c6 04 00
     mov byte [bp+017h], 000h                  ; c6 46 17 00
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 4b de
+    call 0165eh                               ; e8 7d dc
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-    mov bx, 00dbah                            ; bb ba 0d
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 08 e1
+    call 01931h                               ; e8 3a df
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 002dch                               ; 68 dc 02
     push 00313h                               ; 68 13 03
-    jmp near 036c4h                           ; e9 db fe
+    jmp near 038e2h                           ; e9 db fe
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 001h                               ; 80 cc 01
@@ -4693,10 +4922,10 @@ _int13_eltorito:                             ; 0xf3681 LB 0x189
     xor bh, bh                                ; 30 ff
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 0a de
+    call 0165eh                               ; e8 3c dc
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
-    jmp short 037c7h                          ; eb bd
-device_is_cdrom_:                            ; 0xf380a LB 0x35
+    jmp short 039e5h                          ; eb bd
+device_is_cdrom_:                            ; 0xf3a28 LB 0x35
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -4704,24 +4933,24 @@ device_is_cdrom_:                            ; 0xf380a LB 0x35
     mov bl, al                                ; 88 c3
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 02 de
+    call 0166ch                               ; e8 34 dc
     cmp bl, 010h                              ; 80 fb 10
-    jc short 03823h                           ; 72 04
+    jc short 03a41h                           ; 72 04
     xor ax, ax                                ; 31 c0
-    jmp short 03838h                          ; eb 15
+    jmp short 03a56h                          ; eb 15
     xor bh, bh                                ; 30 ff
     imul bx, bx, strict byte 00018h           ; 6b db 18
     mov es, ax                                ; 8e c0
     add bx, 00122h                            ; 81 c3 22 01
     cmp byte [es:bx+01fh], 005h               ; 26 80 7f 1f 05
-    jne short 0381fh                          ; 75 ea
+    jne short 03a3dh                          ; 75 ea
     mov ax, strict word 00001h                ; b8 01 00
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop dx                                    ; 5a
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-cdrom_boot_:                                 ; 0xf383f LB 0x416
+cdrom_boot_:                                 ; 0xf3a5d LB 0x416
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -4732,30 +4961,30 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     sub sp, 0081ch                            ; 81 ec 1c 08
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 c8 dd
+    call 0166ch                               ; e8 fa db
     mov word [bp-018h], ax                    ; 89 46 e8
     mov si, 00322h                            ; be 22 03
     mov word [bp-010h], ax                    ; 89 46 f0
     mov word [bp-014h], 00122h                ; c7 46 ec 22 01
     mov word [bp-012h], ax                    ; 89 46 ee
     mov byte [bp-00ch], 000h                  ; c6 46 f4 00
-    jmp short 03874h                          ; eb 09
+    jmp short 03a92h                          ; eb 09
     inc byte [bp-00ch]                        ; fe 46 f4
     cmp byte [bp-00ch], 010h                  ; 80 7e f4 10
-    jnc short 0387fh                          ; 73 0b
+    jnc short 03a9dh                          ; 73 0b
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
-    call 0380ah                               ; e8 8f ff
+    call 03a28h                               ; e8 8f ff
     test ax, ax                               ; 85 c0
-    je short 0386bh                           ; 74 ec
+    je short 03a89h                           ; 74 ec
     cmp byte [bp-00ch], 010h                  ; 80 7e f4 10
-    jc short 0388bh                           ; 72 06
+    jc short 03aa9h                           ; 72 06
     mov ax, strict word 00002h                ; b8 02 00
-    jmp near 03bf2h                           ; e9 67 03
+    jmp near 03e10h                           ; e9 67 03
     mov cx, strict word 0000ch                ; b9 0c 00
     xor bx, bx                                ; 31 db
     mov dx, ss                                ; 8c d2
     lea ax, [bp-026h]                         ; 8d 46 da
-    call 094cah                               ; e8 32 5c
+    call 097aah                               ; e8 f4 5c
     mov word [bp-026h], strict word 00028h    ; c7 46 da 28 00
     mov ax, strict word 00011h                ; b8 11 00
     xor dx, dx                                ; 31 d2
@@ -4771,10 +5000,10 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     db  066h, 026h, 0c7h, 047h, 00ah, 001h, 000h, 000h, 008h
     ; mov dword [es:bx+00ah], strict dword 008000001h ; 66 26 c7 47 0a 01 00 00 08
     mov byte [bp-00eh], 000h                  ; c6 46 f2 00
-    jmp short 038d0h                          ; eb 09
+    jmp short 03aeeh                          ; eb 09
     inc byte [bp-00eh]                        ; fe 46 f2
     cmp byte [bp-00eh], 004h                  ; 80 7e f2 04
-    jnbe short 03907h                         ; 77 37
+    jnbe short 03b25h                         ; 77 37
     movzx di, byte [bp-00ch]                  ; 0f b6 7e f4
     imul di, di, strict byte 00018h           ; 6b ff 18
     mov es, [bp-012h]                         ; 8e 46 ee
@@ -4794,35 +5023,35 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     mov dx, strict word 0000ch                ; ba 0c 00
     call word [word di+0006ah]                ; ff 95 6a 00
     test ax, ax                               ; 85 c0
-    jne short 038c7h                          ; 75 c0
+    jne short 03ae5h                          ; 75 c0
     test ax, ax                               ; 85 c0
-    je short 03911h                           ; 74 06
+    je short 03b2fh                           ; 74 06
     mov ax, strict word 00003h                ; b8 03 00
-    jmp near 03bf2h                           ; e9 e1 02
+    jmp near 03e10h                           ; e9 e1 02
     cmp byte [bp-00826h], 000h                ; 80 be da f7 00
-    je short 0391eh                           ; 74 06
+    je short 03b3ch                           ; 74 06
     mov ax, strict word 00004h                ; b8 04 00
-    jmp near 03bf2h                           ; e9 d4 02
+    jmp near 03e10h                           ; e9 d4 02
     xor di, di                                ; 31 ff
-    jmp short 03928h                          ; eb 06
+    jmp short 03b46h                          ; eb 06
     inc di                                    ; 47
     cmp di, strict byte 00005h                ; 83 ff 05
-    jnc short 03938h                          ; 73 10
+    jnc short 03b56h                          ; 73 10
     mov al, byte [bp+di-00825h]               ; 8a 83 db f7
-    cmp al, byte [di+00dc2h]                  ; 3a 85 c2 0d
-    je short 03922h                           ; 74 f0
+    cmp al, byte [di+00db0h]                  ; 3a 85 b0 0d
+    je short 03b40h                           ; 74 f0
     mov ax, strict word 00005h                ; b8 05 00
-    jmp near 03bf2h                           ; e9 ba 02
+    jmp near 03e10h                           ; e9 ba 02
     xor di, di                                ; 31 ff
-    jmp short 03942h                          ; eb 06
+    jmp short 03b60h                          ; eb 06
     inc di                                    ; 47
     cmp di, strict byte 00017h                ; 83 ff 17
-    jnc short 03952h                          ; 73 10
+    jnc short 03b70h                          ; 73 10
     mov al, byte [bp+di-0081fh]               ; 8a 83 e1 f7
-    cmp al, byte [di+00dc8h]                  ; 3a 85 c8 0d
-    je short 0393ch                           ; 74 f0
+    cmp al, byte [di+00db6h]                  ; 3a 85 b6 0d
+    je short 03b5ah                           ; 74 f0
     mov ax, strict word 00006h                ; b8 06 00
-    jmp near 03bf2h                           ; e9 a0 02
+    jmp near 03e10h                           ; e9 a0 02
     mov ax, word [bp-007dfh]                  ; 8b 86 21 f8
     mov dx, word [bp-007ddh]                  ; 8b 96 23 f8
     mov word [bp-026h], strict word 00028h    ; c7 46 da 28 00
@@ -4853,38 +5082,38 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     mov dx, strict word 0000ch                ; ba 0c 00
     call word [word di+0006ah]                ; ff 95 6a 00
     test ax, ax                               ; 85 c0
-    je short 039afh                           ; 74 06
+    je short 03bcdh                           ; 74 06
     mov ax, strict word 00007h                ; b8 07 00
-    jmp near 03bf2h                           ; e9 43 02
+    jmp near 03e10h                           ; e9 43 02
     cmp byte [bp-00826h], 001h                ; 80 be da f7 01
-    je short 039bch                           ; 74 06
+    je short 03bdah                           ; 74 06
     mov ax, strict word 00008h                ; b8 08 00
-    jmp near 03bf2h                           ; e9 36 02
+    jmp near 03e10h                           ; e9 36 02
     cmp byte [bp-00825h], 000h                ; 80 be db f7 00
-    je short 039c9h                           ; 74 06
+    je short 03be7h                           ; 74 06
     mov ax, strict word 00009h                ; b8 09 00
-    jmp near 03bf2h                           ; e9 29 02
+    jmp near 03e10h                           ; e9 29 02
     cmp byte [bp-00808h], 055h                ; 80 be f8 f7 55
-    je short 039d6h                           ; 74 06
+    je short 03bf4h                           ; 74 06
     mov ax, strict word 0000ah                ; b8 0a 00
-    jmp near 03bf2h                           ; e9 1c 02
+    jmp near 03e10h                           ; e9 1c 02
     cmp byte [bp-00807h], 0aah                ; 80 be f9 f7 aa
-    jne short 039d0h                          ; 75 f3
+    jne short 03beeh                          ; 75 f3
     cmp byte [bp-00806h], 088h                ; 80 be fa f7 88
-    je short 039eah                           ; 74 06
+    je short 03c08h                           ; 74 06
     mov ax, strict word 0000bh                ; b8 0b 00
-    jmp near 03bf2h                           ; e9 08 02
+    jmp near 03e10h                           ; e9 08 02
     mov al, byte [bp-00805h]                  ; 8a 86 fb f7
     mov es, [bp-010h]                         ; 8e 46 f0
     mov byte [es:si+001h], al                 ; 26 88 44 01
     cmp byte [bp-00805h], 000h                ; 80 be fb f7 00
-    jne short 03a03h                          ; 75 07
+    jne short 03c21h                          ; 75 07
     mov byte [es:si+002h], 0e0h               ; 26 c6 44 02 e0
-    jmp short 03a16h                          ; eb 13
+    jmp short 03c34h                          ; eb 13
     cmp byte [bp-00805h], 004h                ; 80 be fb f7 04
-    jnc short 03a11h                          ; 73 07
+    jnc short 03c2fh                          ; 73 07
     mov byte [es:si+002h], 000h               ; 26 c6 44 02 00
-    jmp short 03a16h                          ; eb 05
+    jmp short 03c34h                          ; eb 05
     mov byte [es:si+002h], 080h               ; 26 c6 44 02 80
     movzx di, byte [bp-00ch]                  ; 0f b6 7e f4
     mov ax, di                                ; 89 f8
@@ -4902,7 +5131,7 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     mov ax, word [bp-00804h]                  ; 8b 86 fc f7
     mov word [bp-016h], ax                    ; 89 46 ea
     test ax, ax                               ; 85 c0
-    jne short 03a44h                          ; 75 05
+    jne short 03c62h                          ; 75 05
     mov word [bp-016h], 007c0h                ; c7 46 ea c0 07
     mov ax, word [bp-016h]                    ; 8b 46 ea
     mov es, [bp-010h]                         ; 8e 46 f0
@@ -4911,11 +5140,11 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     mov di, word [bp-00800h]                  ; 8b be 00 f8
     mov word [es:si+00eh], di                 ; 26 89 7c 0e
     test di, di                               ; 85 ff
-    je short 03a66h                           ; 74 06
+    je short 03c84h                           ; 74 06
     cmp di, 00400h                            ; 81 ff 00 04
-    jbe short 03a6ch                          ; 76 06
+    jbe short 03c8ah                          ; 76 06
     mov ax, strict word 0000ch                ; b8 0c 00
-    jmp near 03bf2h                           ; e9 86 01
+    jmp near 03e10h                           ; e9 86 01
     mov ax, word [bp-007feh]                  ; 8b 86 02 f8
     mov dx, word [bp-007fch]                  ; 8b 96 04 f8
     mov word [es:si+008h], ax                 ; 26 89 44 08
@@ -4955,7 +5184,7 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     mov cx, strict word 00009h                ; b9 09 00
     sal ax, 1                                 ; d1 e0
     rcl di, 1                                 ; d1 d7
-    loop 03adah                               ; e2 fa
+    loop 03cf8h                               ; e2 fa
     push di                                   ; 57
     push ax                                   ; 50
     push strict byte 00000h                   ; 6a 00
@@ -4968,47 +5197,47 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     les bx, [bp-014h]                         ; c4 5e ec
     mov word [es:bx+01ch], strict word 00000h ; 26 c7 47 1c 00 00
     test ax, ax                               ; 85 c0
-    je short 03b0ah                           ; 74 06
+    je short 03d28h                           ; 74 06
     mov ax, strict word 0000dh                ; b8 0d 00
-    jmp near 03bf2h                           ; e9 e8 00
+    jmp near 03e10h                           ; e9 e8 00
     mov es, [bp-010h]                         ; 8e 46 f0
     mov al, byte [es:si+001h]                 ; 26 8a 44 01
     cmp AL, strict byte 002h                  ; 3c 02
-    jc short 03b22h                           ; 72 0d
-    jbe short 03b3ah                          ; 76 23
+    jc short 03d40h                           ; 72 0d
+    jbe short 03d58h                          ; 76 23
     cmp AL, strict byte 004h                  ; 3c 04
-    je short 03b50h                           ; 74 35
+    je short 03d6eh                           ; 74 35
     cmp AL, strict byte 003h                  ; 3c 03
-    je short 03b45h                           ; 74 26
-    jmp near 03b9bh                           ; e9 79 00
+    je short 03d63h                           ; 74 26
+    jmp near 03db9h                           ; e9 79 00
     cmp AL, strict byte 001h                  ; 3c 01
-    jne short 03b9bh                          ; 75 75
+    jne short 03db9h                          ; 75 75
     mov es, [bp-010h]                         ; 8e 46 f0
     db  066h, 026h, 0c7h, 044h, 012h, 050h, 000h, 00fh, 000h
     ; mov dword [es:si+012h], strict dword 0000f0050h ; 66 26 c7 44 12 50 00 0f 00
     mov word [es:si+010h], strict word 00002h ; 26 c7 44 10 02 00
-    jmp short 03b9bh                          ; eb 61
+    jmp short 03db9h                          ; eb 61
     db  066h, 026h, 0c7h, 044h, 012h, 050h, 000h, 012h, 000h
     ; mov dword [es:si+012h], strict dword 000120050h ; 66 26 c7 44 12 50 00 12 00
-    jmp short 03b32h                          ; eb ed
+    jmp short 03d50h                          ; eb ed
     db  066h, 026h, 0c7h, 044h, 012h, 050h, 000h, 024h, 000h
     ; mov dword [es:si+012h], strict dword 000240050h ; 66 26 c7 44 12 50 00 24 00
-    jmp short 03b32h                          ; eb e2
+    jmp short 03d50h                          ; eb e2
     mov dx, 001c4h                            ; ba c4 01
     mov ax, word [bp-016h]                    ; 8b 46 ea
-    call 01600h                               ; e8 a7 da
+    call 01650h                               ; e8 d9 d8
     and AL, strict byte 03fh                  ; 24 3f
     xor ah, ah                                ; 30 e4
     mov es, [bp-010h]                         ; 8e 46 f0
     mov word [es:si+014h], ax                 ; 26 89 44 14
     mov dx, 001c4h                            ; ba c4 01
     mov ax, word [bp-016h]                    ; 8b 46 ea
-    call 01600h                               ; e8 93 da
+    call 01650h                               ; e8 c5 d8
     movzx bx, al                              ; 0f b6 d8
     sal bx, 002h                              ; c1 e3 02
     mov dx, 001c5h                            ; ba c5 01
     mov ax, word [bp-016h]                    ; 8b 46 ea
-    call 01600h                               ; e8 84 da
+    call 01650h                               ; e8 b6 d8
     xor ah, ah                                ; 30 e4
     add ax, bx                                ; 01 d8
     inc ax                                    ; 40
@@ -5016,36 +5245,36 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     mov word [es:si+012h], ax                 ; 26 89 44 12
     mov dx, 001c3h                            ; ba c3 01
     mov ax, word [bp-016h]                    ; 8b 46 ea
-    call 01600h                               ; e8 6f da
+    call 01650h                               ; e8 a1 d8
     xor ah, ah                                ; 30 e4
     inc ax                                    ; 40
     mov es, [bp-010h]                         ; 8e 46 f0
     mov word [es:si+010h], ax                 ; 26 89 44 10
     mov es, [bp-010h]                         ; 8e 46 f0
     cmp byte [es:si+001h], 000h               ; 26 80 7c 01 00
-    je short 03bd9h                           ; 74 34
+    je short 03df7h                           ; 74 34
     cmp byte [es:si+002h], 000h               ; 26 80 7c 02 00
-    jne short 03bc2h                          ; 75 16
+    jne short 03de0h                          ; 75 16
     mov dx, strict word 00010h                ; ba 10 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 4b da
+    call 01650h                               ; e8 7d d8
     or AL, strict byte 041h                   ; 0c 41
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00010h                ; ba 10 00
     mov ax, strict word 00040h                ; b8 40 00
-    jmp short 03bd6h                          ; eb 14
+    jmp short 03df4h                          ; eb 14
     mov dx, 002c0h                            ; ba c0 02
     mov ax, word [bp-018h]                    ; 8b 46 e8
-    call 01600h                               ; e8 35 da
+    call 01650h                               ; e8 67 d8
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     movzx bx, al                              ; 0f b6 d8
     mov dx, 002c0h                            ; ba c0 02
     mov ax, word [bp-018h]                    ; 8b 46 e8
-    call 0160eh                               ; e8 35 da
+    call 0165eh                               ; e8 67 d8
     mov es, [bp-010h]                         ; 8e 46 f0
     cmp byte [es:si+001h], 000h               ; 26 80 7c 01 00
-    je short 03be7h                           ; 74 04
+    je short 03e05h                           ; 74 04
     mov byte [es:si], 001h                    ; 26 c6 04 01
     mov es, [bp-010h]                         ; 8e 46 f0
     movzx ax, byte [es:si+002h]               ; 26 0f b6 44 02
@@ -5059,12 +5288,12 @@ cdrom_boot_:                                 ; 0xf383f LB 0x416
     pop bp                                    ; 5d
     retn                                      ; c3
     db  050h, 04eh, 049h, 048h, 047h, 046h, 045h, 044h, 043h, 042h, 041h, 018h, 016h, 015h, 014h, 011h
-    db  010h, 00dh, 00ch, 00bh, 00ah, 009h, 008h, 005h, 004h, 003h, 002h, 001h, 000h, 0edh, 03fh, 0fbh
-    db  03ch, 045h, 03dh, 06dh, 03dh, 03ah, 03dh, 06dh, 03dh, 03ah, 03dh, 043h, 03fh, 020h, 03dh, 0edh
-    db  03fh, 0edh, 03fh, 020h, 03dh, 020h, 03dh, 020h, 03dh, 020h, 03dh, 020h, 03dh, 0e4h, 03fh, 020h
-    db  03dh, 0edh, 03fh, 0edh, 03fh, 0edh, 03fh, 0edh, 03fh, 0edh, 03fh, 0edh, 03fh, 0edh, 03fh, 0edh
-    db  03fh, 0edh, 03fh, 0edh, 03fh, 0edh, 03fh, 0edh, 03fh
-_int13_cdemu:                                ; 0xf3c55 LB 0x434
+    db  010h, 00dh, 00ch, 00bh, 00ah, 009h, 008h, 005h, 004h, 003h, 002h, 001h, 000h, 00bh, 042h, 019h
+    db  03fh, 063h, 03fh, 08bh, 03fh, 058h, 03fh, 08bh, 03fh, 058h, 03fh, 061h, 041h, 03eh, 03fh, 00bh
+    db  042h, 00bh, 042h, 03eh, 03fh, 03eh, 03fh, 03eh, 03fh, 03eh, 03fh, 03eh, 03fh, 002h, 042h, 03eh
+    db  03fh, 00bh, 042h, 00bh, 042h, 00bh, 042h, 00bh, 042h, 00bh, 042h, 00bh, 042h, 00bh, 042h, 00bh
+    db  042h, 00bh, 042h, 00bh, 042h, 00bh, 042h, 00bh, 042h
+_int13_cdemu:                                ; 0xf3e73 LB 0x434
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -5072,7 +5301,7 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     sub sp, strict byte 0002ah                ; 83 ec 2a
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 b6 d9
+    call 0166ch                               ; e8 e8 d7
     mov di, 00322h                            ; bf 22 03
     mov cx, ax                                ; 89 c1
     mov si, di                                ; 89 fe
@@ -5088,19 +5317,19 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 79 d9
+    call 0165eh                               ; e8 ab d7
     mov es, cx                                ; 8e c1
     cmp byte [es:di], 000h                    ; 26 80 3d 00
-    je short 03cabh                           ; 74 0e
+    je short 03ec9h                           ; 74 0e
     movzx dx, byte [es:di+002h]               ; 26 0f b6 55 02
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     cmp dx, ax                                ; 39 c2
-    je short 03cd4h                           ; 74 29
-    mov bx, 00dbah                            ; bb ba 0d
+    je short 03ef2h                           ; 74 29
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 2b dc
+    call 01931h                               ; e8 5d da
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     push ax                                   ; 50
@@ -5110,21 +5339,21 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     push 0032ch                               ; 68 2c 03
     push 00338h                               ; 68 38 03
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 54 dc
+    call 01972h                               ; e8 86 da
     add sp, strict byte 0000ah                ; 83 c4 0a
-    jmp near 0400dh                           ; e9 39 03
+    jmp near 0422bh                           ; e9 39 03
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     cmp ax, strict word 00050h                ; 3d 50 00
-    jnbe near 03fedh                          ; 0f 87 0c 03
+    jnbe near 0420bh                          ; 0f 87 0c 03
     push CS                                   ; 0e
     pop ES                                    ; 07
     mov cx, strict word 0001eh                ; b9 1e 00
-    mov di, 03bfch                            ; bf fc 3b
+    mov di, 03e1ah                            ; bf 1a 3e
     repne scasb                               ; f2 ae
     sal cx, 1                                 ; d1 e1
     mov di, cx                                ; 89 cf
-    mov ax, word [cs:di+03c19h]               ; 2e 8b 85 19 3c
+    mov ax, word [cs:di+03e37h]               ; 2e 8b 85 37 3e
     mov bx, word [bp+016h]                    ; 8b 5e 16
     xor bh, bh                                ; 30 ff
     jmp ax                                    ; ff e0
@@ -5135,14 +5364,14 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     movzx bx, byte [es:bx+01eh]               ; 26 0f b6 5f 1e
     add bx, bx                                ; 01 db
     cmp word [word bx+0006ah], strict byte 00000h ; 83 bf 6a 00 00
-    je near 03d20h                            ; 0f 84 08 00
+    je near 03f3eh                            ; 0f 84 08 00
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
     call word [word bx+00076h]                ; ff 97 76 00
     mov byte [bp+017h], 000h                  ; c6 46 17 00
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 df d8
+    call 0165eh                               ; e8 11 d7
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
@@ -5152,10 +5381,10 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 003h                               ; 80 cc 03
-    jmp near 04015h                           ; e9 d0 02
+    jmp near 04233h                           ; e9 d0 02
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 b2 d8
+    call 01650h                               ; e8 e4 d6
     mov cl, al                                ; 88 c1
     movzx ax, cl                              ; 0f b6 c1
     sal ax, 008h                              ; c1 e0 08
@@ -5164,10 +5393,10 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 a8 d8
+    call 0165eh                               ; e8 da d6
     test cl, cl                               ; 84 c9
-    je short 03d24h                           ; 74 ba
-    jmp near 04029h                           ; e9 bc 02
+    je short 03f42h                           ; 74 ba
+    jmp near 04247h                           ; e9 bc 02
     mov es, [bp-008h]                         ; 8e 46 f8
     mov di, word [es:si+014h]                 ; 26 8b 7c 14
     mov dx, word [es:si+012h]                 ; 26 8b 54 12
@@ -5191,19 +5420,19 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     xor ch, ch                                ; 30 ed
     mov word [bp-00ah], cx                    ; 89 4e f6
     test cx, cx                               ; 85 c9
-    jne short 03dbah                          ; 75 03
-    jmp near 03d20h                           ; e9 66 ff
+    jne short 03fd8h                          ; 75 03
+    jmp near 03f3eh                           ; e9 66 ff
     cmp di, word [bp-010h]                    ; 3b 7e f0
-    jc near 0400dh                            ; 0f 82 4c 02
+    jc near 0422bh                            ; 0f 82 4c 02
     cmp ax, dx                                ; 39 d0
-    jnc near 0400dh                           ; 0f 83 46 02
+    jnc near 0422bh                           ; 0f 83 46 02
     cmp si, bx                                ; 39 de
-    jnc near 0400dh                           ; 0f 83 40 02
+    jnc near 0422bh                           ; 0f 83 40 02
     mov dx, word [bp+016h]                    ; 8b 56 16
     shr dx, 008h                              ; c1 ea 08
     cmp dx, strict byte 00004h                ; 83 fa 04
-    jne short 03ddbh                          ; 75 03
-    jmp near 03d20h                           ; e9 45 ff
+    jne short 03ff9h                          ; 75 03
+    jmp near 03f3eh                           ; e9 45 ff
     mov dx, word [bp+010h]                    ; 8b 56 10
     shr dx, 004h                              ; c1 ea 04
     mov cx, word [bp+006h]                    ; 8b 4e 06
@@ -5214,13 +5443,13 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     mov word [bp-01ch], dx                    ; 89 56 e4
     xor dl, dl                                ; 30 d2
     xor cx, cx                                ; 31 c9
-    call 09499h                               ; e8 a0 56
+    call 09779h                               ; e8 62 57
     xor bx, bx                                ; 31 db
     add ax, si                                ; 01 f0
     adc dx, bx                                ; 11 da
     mov bx, di                                ; 89 fb
     xor cx, cx                                ; 31 c9
-    call 09499h                               ; e8 93 56
+    call 09779h                               ; e8 55 57
     mov bx, ax                                ; 89 c3
     mov ax, word [bp-010h]                    ; 8b 46 f0
     dec ax                                    ; 48
@@ -5255,7 +5484,7 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     mov cx, strict word 0000ch                ; b9 0c 00
     mov dx, ss                                ; 8c d2
     lea ax, [bp-02eh]                         ; 8d 46 d2
-    call 094cah                               ; e8 6d 56
+    call 097aah                               ; e8 2f 57
     mov word [bp-02eh], strict word 00028h    ; c7 46 d2 28 00
     mov ax, word [bp-014h]                    ; 8b 46 ec
     add ax, si                                ; 01 f0
@@ -5303,7 +5532,7 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     mov cx, strict word 00009h                ; b9 09 00
     sal si, 1                                 ; d1 e6
     rcl di, 1                                 ; d1 d7
-    loop 03eddh                               ; e2 fa
+    loop 040fbh                               ; e2 fa
     push di                                   ; 57
     push si                                   ; 56
     push ax                                   ; 50
@@ -5318,11 +5547,11 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     db  066h, 026h, 0c7h, 047h, 01ah, 000h, 000h, 000h, 000h
     ; mov dword [es:bx+01ah], strict dword 000000000h ; 66 26 c7 47 1a 00 00 00 00
     test al, al                               ; 84 c0
-    je near 03d20h                            ; 0f 84 13 fe
-    mov bx, 00dbah                            ; bb ba 0d
+    je near 03f3eh                            ; 0f 84 13 fe
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 c9 d9
+    call 01931h                               ; e8 fb d7
     movzx ax, dl                              ; 0f b6 c2
     push ax                                   ; 50
     mov ax, word [bp+016h]                    ; 8b 46 16
@@ -5331,14 +5560,14 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     push 0032ch                               ; 68 2c 03
     push 0036eh                               ; 68 6e 03
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 f4 d9
+    call 01972h                               ; e8 26 d8
     add sp, strict byte 0000ah                ; 83 c4 0a
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 002h                               ; 80 cc 02
     mov word [bp+016h], ax                    ; 89 46 16
     mov byte [bp+016h], 000h                  ; c6 46 16 00
-    jmp near 04018h                           ; e9 d5 00
+    jmp near 04236h                           ; e9 d5 00
     mov es, [bp-008h]                         ; 8e 46 f8
     mov di, word [es:si+014h]                 ; 26 8b 7c 14
     mov dx, word [es:si+012h]                 ; 26 8b 54 12
@@ -5377,40 +5606,40 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     mov dl, byte [es:si+001h]                 ; 26 8a 54 01
     mov word [bp+010h], ax                    ; 89 46 10
     cmp dl, 003h                              ; 80 fa 03
-    je short 03fc7h                           ; 74 1a
+    je short 041e5h                           ; 74 1a
     cmp dl, 002h                              ; 80 fa 02
-    je short 03fc3h                           ; 74 11
+    je short 041e1h                           ; 74 11
     cmp dl, 001h                              ; 80 fa 01
-    jne short 03fcbh                          ; 75 14
+    jne short 041e9h                          ; 75 14
     mov ax, word [bp+010h]                    ; 8b 46 10
     xor al, al                                ; 30 c0
     or AL, strict byte 002h                   ; 0c 02
     mov word [bp+010h], ax                    ; 89 46 10
-    jmp short 03fcbh                          ; eb 08
+    jmp short 041e9h                          ; eb 08
     or AL, strict byte 004h                   ; 0c 04
-    jmp short 03fbeh                          ; eb f7
+    jmp short 041dch                          ; eb f7
     or AL, strict byte 005h                   ; 0c 05
-    jmp short 03fbeh                          ; eb f3
+    jmp short 041dch                          ; eb f3
     mov es, [bp-008h]                         ; 8e 46 f8
     cmp byte [es:si+001h], 004h               ; 26 80 7c 01 04
-    jnc near 03d20h                           ; 0f 83 49 fd
+    jnc near 03f3eh                           ; 0f 83 49 fd
     mov word [bp+008h], 0efc7h                ; c7 46 08 c7 ef
     mov word [bp+006h], 0f000h                ; c7 46 06 00 f0
-    jmp near 03d20h                           ; e9 3c fd
+    jmp near 03f3eh                           ; e9 3c fd
     or bh, 003h                               ; 80 cf 03
     mov word [bp+016h], bx                    ; 89 5e 16
-    jmp near 03d24h                           ; e9 37 fd
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 03f42h                           ; e9 37 fd
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 e9 d8
+    call 01931h                               ; e8 1b d7
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 0032ch                               ; 68 2c 03
     push 0038fh                               ; 68 8f 03
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 18 d9
+    call 01972h                               ; e8 4a d7
     add sp, strict byte 00008h                ; 83 c4 08
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
@@ -5421,16 +5650,16 @@ _int13_cdemu:                                ; 0xf3c55 LB 0x434
     xor bh, bh                                ; 30 ff
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 e5 d5
+    call 0165eh                               ; e8 17 d4
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
-    jmp near 03d33h                           ; e9 03 fd
+    jmp near 03f51h                           ; e9 03 fd
     db  050h, 04eh, 049h, 048h, 047h, 046h, 045h, 044h, 043h, 042h, 041h, 018h, 016h, 015h, 014h, 011h
-    db  010h, 00dh, 00ch, 00bh, 00ah, 009h, 008h, 005h, 004h, 003h, 002h, 001h, 000h, 0ceh, 045h, 04ah
-    db  043h, 036h, 041h, 0ceh, 045h, 02bh, 041h, 0ceh, 045h, 02bh, 041h, 0ceh, 045h, 04ah, 043h, 0ceh
-    db  045h, 0ceh, 045h, 04ah, 043h, 04ah, 043h, 04ah, 043h, 04ah, 043h, 04ah, 043h, 060h, 041h, 04ah
-    db  043h, 0ceh, 045h, 069h, 041h, 07ch, 041h, 02bh, 041h, 07ch, 041h, 0aah, 042h, 064h, 043h, 07ch
-    db  041h, 08bh, 043h, 087h, 045h, 08fh, 045h, 0ceh, 045h
-_int13_cdrom:                                ; 0xf4089 LB 0x562
+    db  010h, 00dh, 00ch, 00bh, 00ah, 009h, 008h, 005h, 004h, 003h, 002h, 001h, 000h, 0ech, 047h, 068h
+    db  045h, 054h, 043h, 0ech, 047h, 049h, 043h, 0ech, 047h, 049h, 043h, 0ech, 047h, 068h, 045h, 0ech
+    db  047h, 0ech, 047h, 068h, 045h, 068h, 045h, 068h, 045h, 068h, 045h, 068h, 045h, 07eh, 043h, 068h
+    db  045h, 0ech, 047h, 087h, 043h, 09ah, 043h, 049h, 043h, 09ah, 043h, 0c8h, 044h, 082h, 045h, 09ah
+    db  043h, 0a9h, 045h, 0a5h, 047h, 0adh, 047h, 0ech, 047h
+_int13_cdrom:                                ; 0xf42a7 LB 0x562
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -5438,20 +5667,20 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     sub sp, strict byte 00028h                ; 83 ec 28
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 82 d5
+    call 0166ch                               ; e8 b4 d3
     mov word [bp-01ah], ax                    ; 89 46 e6
     mov si, 00122h                            ; be 22 01
     mov word [bp-00ch], ax                    ; 89 46 f4
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 60 d5
+    call 0165eh                               ; e8 92 d3
     mov ax, word [bp+010h]                    ; 8b 46 10
     xor ah, ah                                ; 30 e4
     cmp ax, 000e0h                            ; 3d e0 00
-    jc short 040bdh                           ; 72 05
+    jc short 042dbh                           ; 72 05
     cmp ax, 000f0h                            ; 3d f0 00
-    jc short 040dbh                           ; 72 1e
+    jc short 042f9h                           ; 72 1e
     mov ax, word [bp+010h]                    ; 8b 46 10
     xor ah, ah                                ; 30 e4
     push ax                                   ; 50
@@ -5461,9 +5690,9 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     push 003bfh                               ; 68 bf 03
     push 003cbh                               ; 68 cb 03
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 4d d8
+    call 01972h                               ; e8 7f d6
     add sp, strict byte 0000ah                ; 83 c4 0a
-    jmp near 045abh                           ; e9 d0 04
+    jmp near 047c9h                           ; e9 d0 04
     mov ax, word [bp+010h]                    ; 8b 46 10
     xor ah, ah                                ; 30 e4
     mov es, [bp-00ch]                         ; 8e 46 f4
@@ -5472,36 +5701,36 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     mov dl, byte [es:bx+000d0h]               ; 26 8a 97 d0 00
     mov byte [bp-008h], dl                    ; 88 56 f8
     cmp dl, 010h                              ; 80 fa 10
-    jc short 04104h                           ; 72 10
+    jc short 04322h                           ; 72 10
     push ax                                   ; 50
     mov ax, word [bp+018h]                    ; 8b 46 18
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 003bfh                               ; 68 bf 03
     push 003f6h                               ; 68 f6 03
-    jmp short 040d0h                          ; eb cc
+    jmp short 042eeh                          ; eb cc
     mov ax, word [bp+018h]                    ; 8b 46 18
     shr ax, 008h                              ; c1 e8 08
     cmp ax, strict word 00050h                ; 3d 50 00
-    jnbe near 045ceh                          ; 0f 87 bd 04
+    jnbe near 047ech                          ; 0f 87 bd 04
     push CS                                   ; 0e
     pop ES                                    ; 07
     mov cx, strict word 0001eh                ; b9 1e 00
-    mov di, 04030h                            ; bf 30 40
+    mov di, 0424eh                            ; bf 4e 42
     repne scasb                               ; f2 ae
     sal cx, 1                                 ; d1 e1
     mov di, cx                                ; 89 cf
-    mov ax, word [cs:di+0404dh]               ; 2e 8b 85 4d 40
+    mov ax, word [cs:di+0426bh]               ; 2e 8b 85 6b 42
     mov bx, word [bp+018h]                    ; 8b 5e 18
     xor bh, bh                                ; 30 ff
     jmp ax                                    ; ff e0
     mov ax, word [bp+018h]                    ; 8b 46 18
     xor ah, ah                                ; 30 e4
     or ah, 003h                               ; 80 cc 03
-    jmp near 045b3h                           ; e9 7d 04
+    jmp near 047d1h                           ; e9 7d 04
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 c1 d4
+    call 01650h                               ; e8 f3 d2
     mov cl, al                                ; 88 c1
     movzx ax, cl                              ; 0f b6 c1
     sal ax, 008h                              ; c1 e0 08
@@ -5510,18 +5739,18 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 b7 d4
+    call 0165eh                               ; e8 e9 d2
     test cl, cl                               ; 84 c9
-    je near 0434eh                            ; 0f 84 f1 01
-    jmp near 045c7h                           ; e9 67 04
+    je near 0456ch                            ; 0f 84 f1 01
+    jmp near 047e5h                           ; e9 67 04
     or bh, 002h                               ; 80 cf 02
     mov word [bp+018h], bx                    ; 89 5e 18
-    jmp near 045b6h                           ; e9 4d 04
+    jmp near 047d4h                           ; e9 4d 04
     mov word [bp+012h], 0aa55h                ; c7 46 12 55 aa
     or bh, 030h                               ; 80 cf 30
     mov word [bp+018h], bx                    ; 89 5e 18
     mov word [bp+016h], strict word 00007h    ; c7 46 16 07 00
-    jmp near 0434eh                           ; e9 d2 01
+    jmp near 0456ch                           ; e9 d2 01
     mov bx, word [bp+00ch]                    ; 8b 5e 0c
     mov es, [bp+006h]                         ; 8e 46 06
     mov word [bp-014h], bx                    ; 89 5e ec
@@ -5536,16 +5765,16 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     mov word [bp-018h], ax                    ; 89 46 e8
     mov di, word [es:bx+00eh]                 ; 26 8b 7f 0e
     or di, ax                                 ; 09 c7
-    je short 041c4h                           ; 74 18
+    je short 043e2h                           ; 74 18
     mov ax, word [bp+018h]                    ; 8b 46 18
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 003bfh                               ; 68 bf 03
     push 00428h                               ; 68 28 04
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 64 d7
+    call 01972h                               ; e8 96 d5
     add sp, strict byte 00008h                ; 83 c4 08
-    jmp near 045abh                           ; e9 e7 03
+    jmp near 047c9h                           ; e9 e7 03
     les bx, [bp-014h]                         ; c4 5e ec
     mov ax, word [es:bx+008h]                 ; 26 8b 47 08
     mov word [bp-018h], ax                    ; 89 46 e8
@@ -5555,14 +5784,14 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     shr ax, 008h                              ; c1 e8 08
     mov word [bp-016h], ax                    ; 89 46 ea
     cmp ax, strict word 00044h                ; 3d 44 00
-    je near 0434ah                            ; 0f 84 66 01
+    je near 04568h                            ; 0f 84 66 01
     cmp ax, strict word 00047h                ; 3d 47 00
-    je near 0434ah                            ; 0f 84 5f 01
+    je near 04568h                            ; 0f 84 5f 01
     mov cx, strict word 0000ch                ; b9 0c 00
     xor bx, bx                                ; 31 db
     mov dx, ss                                ; 8c d2
     lea ax, [bp-02ch]                         ; 8d 46 d4
-    call 094cah                               ; e8 d2 52
+    call 097aah                               ; e8 94 53
     mov word [bp-02ch], strict word 00028h    ; c7 46 d4 28 00
     mov ax, word [bp-018h]                    ; 8b 46 e8
     mov dx, di                                ; 89 fa
@@ -5590,7 +5819,7 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     mov cx, strict word 0000bh                ; b9 0b 00
     sal ax, 1                                 ; d1 e0
     rcl bx, 1                                 ; d1 d3
-    loop 04242h                               ; e2 fa
+    loop 04460h                               ; e2 fa
     push bx                                   ; 53
     push ax                                   ; 50
     push strict byte 00000h                   ; 6a 00
@@ -5606,29 +5835,29 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     mov cx, strict word 0000bh                ; b9 0b 00
     shr di, 1                                 ; d1 ef
     rcr ax, 1                                 ; d1 d8
-    loop 0426ch                               ; e2 fa
+    loop 0448ah                               ; e2 fa
     les bx, [bp-014h]                         ; c4 5e ec
     mov word [es:bx+002h], ax                 ; 26 89 47 02
     test dl, dl                               ; 84 d2
-    je near 0434ah                            ; 0f 84 cb 00
-    mov bx, 00dbah                            ; bb ba 0d
+    je near 04568h                            ; 0f 84 cb 00
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 57 d6
+    call 01931h                               ; e8 89 d4
     movzx ax, dl                              ; 0f b6 c2
     push ax                                   ; 50
     push word [bp-016h]                       ; ff 76 ea
     push 003bfh                               ; 68 bf 03
     push 00451h                               ; 68 51 04
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 86 d6
+    call 01972h                               ; e8 b8 d4
     add sp, strict byte 0000ah                ; 83 c4 0a
     mov ax, word [bp+018h]                    ; 8b 46 18
     xor ah, ah                                ; 30 e4
     or ah, 00ch                               ; 80 cc 0c
-    jmp near 045b3h                           ; e9 09 03
+    jmp near 047d1h                           ; e9 09 03
     cmp bx, strict byte 00002h                ; 83 fb 02
-    jnbe near 045abh                          ; 0f 87 fa 02
+    jnbe near 047c9h                          ; 0f 87 fa 02
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     mov es, [bp-00ch]                         ; 8e 46 f4
@@ -5636,20 +5865,20 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     add di, ax                                ; 01 c7
     mov al, byte [es:di+021h]                 ; 26 8a 45 21
     cmp bx, strict byte 00002h                ; 83 fb 02
-    je short 0433bh                           ; 74 73
+    je short 04559h                           ; 74 73
     cmp bx, strict byte 00001h                ; 83 fb 01
-    je short 04308h                           ; 74 3b
+    je short 04526h                           ; 74 3b
     test bx, bx                               ; 85 db
-    jne near 0434ah                           ; 0f 85 77 00
+    jne near 04568h                           ; 0f 85 77 00
     cmp AL, strict byte 0ffh                  ; 3c ff
-    jne short 042e9h                          ; 75 12
+    jne short 04507h                          ; 75 12
     mov ax, word [bp+018h]                    ; 8b 46 18
     xor ah, ah                                ; 30 e4
     or ah, 0b4h                               ; 80 cc b4
     mov word [bp+018h], ax                    ; 89 46 18
     xor al, al                                ; 30 c0
     or AL, strict byte 001h                   ; 0c 01
-    jmp near 045b3h                           ; e9 ca 02
+    jmp near 047d1h                           ; e9 ca 02
     movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
     imul dx, dx, strict byte 00018h           ; 6b d2 18
     db  0feh, 0c0h
@@ -5661,13 +5890,13 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     xor al, al                                ; 30 c0
     or AL, strict byte 001h                   ; 0c 01
     mov word [bp+018h], ax                    ; 89 46 18
-    jmp near 0434ah                           ; e9 42 00
+    jmp near 04568h                           ; e9 42 00
     test al, al                               ; 84 c0
-    jne short 04318h                          ; 75 0c
+    jne short 04536h                          ; 75 0c
     or bh, 0b0h                               ; 80 cf b0
     mov word [bp+018h], bx                    ; 89 5e 18
     mov byte [bp+018h], al                    ; 88 46 18
-    jmp near 045b6h                           ; e9 9e 02
+    jmp near 047d4h                           ; e9 9e 02
     movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
     imul dx, dx, strict byte 00018h           ; 6b d2 18
     db  0feh, 0c8h
@@ -5682,7 +5911,7 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     mov ax, word [bp+018h]                    ; 8b 46 18
     xor al, al                                ; 30 c0
     or ax, dx                                 ; 09 d0
-    jmp short 04302h                          ; eb c7
+    jmp short 04520h                          ; eb c7
     test al, al                               ; 84 c0
     db  00fh, 095h, 0c0h
     ; setne al                                  ; 0f 95 c0
@@ -5694,7 +5923,7 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 b5 d2
+    call 0165eh                               ; e8 e7 d0
     and byte [bp+01eh], 0feh                  ; 80 66 1e fe
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
@@ -5707,14 +5936,14 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     add si, ax                                ; 01 c6
     mov al, byte [es:si+021h]                 ; 26 8a 44 21
     test al, al                               ; 84 c0
-    je short 0437eh                           ; 74 06
+    je short 0459ch                           ; 74 06
     or bh, 0b1h                               ; 80 cf b1
-    jmp near 04163h                           ; e9 e5 fd
-    je short 0434ah                           ; 74 ca
+    jmp near 04381h                           ; e9 e5 fd
+    je short 04568h                           ; 74 ca
     mov ax, word [bp+018h]                    ; 8b 46 18
     xor ah, ah                                ; 30 e4
     or ah, 0b1h                               ; 80 cc b1
-    jmp near 045b3h                           ; e9 28 02
+    jmp near 047d1h                           ; e9 28 02
     mov dx, word [bp+00ch]                    ; 8b 56 0c
     mov cx, word [bp+006h]                    ; 8b 4e 06
     mov bx, dx                                ; 89 d3
@@ -5724,8 +5953,8 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     mov ax, word [es:di]                      ; 26 8b 05
     mov word [bp-00eh], ax                    ; 89 46 f2
     cmp ax, strict word 0001ah                ; 3d 1a 00
-    jc near 045abh                            ; 0f 82 04 02
-    jc short 043f8h                           ; 72 4f
+    jc near 047c9h                            ; 0f 82 04 02
+    jc short 04616h                           ; 72 4f
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     mov es, [bp-00ch]                         ; 8e 46 f4
@@ -5748,7 +5977,7 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     db  066h, 026h, 0c7h, 045h, 014h, 0ffh, 0ffh, 0ffh, 0ffh
     ; mov dword [es:di+014h], strict dword 0ffffffffh ; 66 26 c7 45 14 ff ff ff ff
     cmp word [bp-00eh], strict byte 0001eh    ; 83 7e f2 1e
-    jc near 044cfh                            ; 0f 82 cf 00
+    jc near 046edh                            ; 0f 82 cf 00
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov word [es:bx], strict word 0001eh      ; 26 c7 07 1e 00
     mov ax, word [bp-01ah]                    ; 8b 46 e6
@@ -5800,22 +6029,22 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     mov byte [es:si+001feh], 011h             ; 26 c6 84 fe 01 11
     xor cl, cl                                ; 30 c9
     xor ch, ch                                ; 30 ed
-    jmp short 044b2h                          ; eb 05
+    jmp short 046d0h                          ; eb 05
     cmp ch, 00fh                              ; 80 fd 0f
-    jnc short 044c5h                          ; 73 13
+    jnc short 046e3h                          ; 73 13
     movzx dx, ch                              ; 0f b6 d5
     add dx, 00312h                            ; 81 c2 12 03
     mov ax, word [bp-01ah]                    ; 8b 46 e6
-    call 01600h                               ; e8 41 d1
+    call 01650h                               ; e8 73 cf
     add cl, al                                ; 00 c1
     db  0feh, 0c5h
     ; inc ch                                    ; fe c5
-    jmp short 044adh                          ; eb e8
+    jmp short 046cbh                          ; eb e8
     neg cl                                    ; f6 d9
     mov es, [bp-00ch]                         ; 8e 46 f4
     mov byte [es:si+001ffh], cl               ; 26 88 8c ff 01
     cmp word [bp-00eh], strict byte 00042h    ; 83 7e f2 42
-    jc near 0434ah                            ; 0f 82 73 fe
+    jc near 04568h                            ; 0f 82 73 fe
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     cwd                                       ; 99
     db  02bh, 0c2h
@@ -5833,7 +6062,7 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     ; mov dword [es:bx+01eh], strict dword 00024beddh ; 66 26 c7 47 1e dd be 24 00
     mov word [es:bx+022h], strict word 00000h ; 26 c7 47 22 00 00
     test al, al                               ; 84 c0
-    jne short 04518h                          ; 75 09
+    jne short 04736h                          ; 75 09
     db  066h, 026h, 0c7h, 047h, 024h, 049h, 053h, 041h, 020h
     ; mov dword [es:bx+024h], strict dword 020415349h ; 66 26 c7 47 24 49 53 41 20
     mov es, [bp-00ah]                         ; 8e 46 f6
@@ -5842,7 +6071,7 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     db  066h, 026h, 0c7h, 047h, 02ch, 020h, 020h, 020h, 020h
     ; mov dword [es:bx+02ch], strict dword 020202020h ; 66 26 c7 47 2c 20 20 20 20
     test al, al                               ; 84 c0
-    jne short 04544h                          ; 75 13
+    jne short 04762h                          ; 75 13
     mov word [es:bx+030h], dx                 ; 26 89 57 30
     db  066h, 026h, 0c7h, 047h, 032h, 000h, 000h, 000h, 000h
     ; mov dword [es:bx+032h], strict dword 000000000h ; 66 26 c7 47 32 00 00 00 00
@@ -5857,32 +6086,32 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     mov word [es:bx+03eh], strict word 00000h ; 26 c7 47 3e 00 00
     xor al, al                                ; 30 c0
     mov AH, strict byte 01eh                  ; b4 1e
-    jmp short 0456ch                          ; eb 05
+    jmp short 0478ah                          ; eb 05
     cmp ah, 040h                              ; 80 fc 40
-    jnc short 0457bh                          ; 73 0f
+    jnc short 04799h                          ; 73 0f
     movzx si, ah                              ; 0f b6 f4
     mov es, [bp-00ah]                         ; 8e 46 f6
     add si, bx                                ; 01 de
     add al, byte [es:si]                      ; 26 02 04
     db  0feh, 0c4h
     ; inc ah                                    ; fe c4
-    jmp short 04567h                          ; eb ec
+    jmp short 04785h                          ; eb ec
     neg al                                    ; f6 d8
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov byte [es:bx+041h], al                 ; 26 88 47 41
-    jmp near 0434ah                           ; e9 c3 fd
+    jmp near 04568h                           ; e9 c3 fd
     or bh, 006h                               ; 80 cf 06
     mov word [bp+018h], bx                    ; 89 5e 18
-    jmp short 045c7h                          ; eb 38
+    jmp short 047e5h                          ; eb 38
     cmp bx, strict byte 00006h                ; 83 fb 06
-    je near 0434ah                            ; 0f 84 b4 fd
+    je near 04568h                            ; 0f 84 b4 fd
     cmp bx, strict byte 00001h                ; 83 fb 01
-    jc short 045abh                           ; 72 10
-    jbe near 0434ah                           ; 0f 86 ab fd
+    jc short 047c9h                           ; 72 10
+    jbe near 04568h                           ; 0f 86 ab fd
     cmp bx, strict byte 00003h                ; 83 fb 03
-    jc short 045abh                           ; 72 07
+    jc short 047c9h                           ; 72 07
     cmp bx, strict byte 00004h                ; 83 fb 04
-    jbe near 0434ah                           ; 0f 86 9f fd
+    jbe near 04568h                           ; 0f 86 9f fd
     mov ax, word [bp+018h]                    ; 8b 46 18
     xor ah, ah                                ; 30 e4
     or ah, 001h                               ; 80 cc 01
@@ -5892,55 +6121,55 @@ _int13_cdrom:                                ; 0xf4089 LB 0x562
     xor bh, bh                                ; 30 ff
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 47 d0
+    call 0165eh                               ; e8 79 ce
     or byte [bp+01eh], 001h                   ; 80 4e 1e 01
-    jmp near 0435dh                           ; e9 8f fd
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 0457bh                           ; e9 8f fd
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 08 d3
+    call 01931h                               ; e8 3a d1
     mov ax, word [bp+018h]                    ; 8b 46 18
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 003bfh                               ; 68 bf 03
     push 00313h                               ; 68 13 03
     push strict byte 00004h                   ; 6a 04
-    jmp near 041bbh                           ; e9 d0 fb
-print_boot_device_:                          ; 0xf45eb LB 0x4b
+    jmp near 043d9h                           ; e9 d0 fb
+print_boot_device_:                          ; 0xf4809 LB 0x4b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
     test al, al                               ; 84 c0
-    je short 045f8h                           ; 74 05
+    je short 04816h                           ; 74 05
     mov dx, strict word 00002h                ; ba 02 00
-    jmp short 04612h                          ; eb 1a
+    jmp short 04830h                          ; eb 1a
     test dl, dl                               ; 84 d2
-    je short 04601h                           ; 74 05
+    je short 0481fh                           ; 74 05
     mov dx, strict word 00003h                ; ba 03 00
-    jmp short 04612h                          ; eb 11
+    jmp short 04830h                          ; eb 11
     test bl, 080h                             ; f6 c3 80
-    jne short 0460ah                          ; 75 04
+    jne short 04828h                          ; 75 04
     xor dh, dh                                ; 30 f6
-    jmp short 04612h                          ; eb 08
+    jmp short 04830h                          ; eb 08
     test bl, 080h                             ; f6 c3 80
-    je short 04630h                           ; 74 21
+    je short 0484eh                           ; 74 21
     mov dx, strict word 00001h                ; ba 01 00
-    mov bx, 00dbah                            ; bb ba 0d
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 c4 d2
+    call 01931h                               ; e8 f6 d0
     imul dx, dx, strict byte 0000ah           ; 6b d2 0a
-    add dx, 00de0h                            ; 81 c2 e0 0d
+    add dx, 00dceh                            ; 81 c2 ce 0d
     push dx                                   ; 52
     push 00474h                               ; 68 74 04
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 f5 d2
+    call 01972h                               ; e8 27 d1
     add sp, strict byte 00006h                ; 83 c4 06
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-print_boot_failure_:                         ; 0xf4636 LB 0x93
+print_boot_failure_:                         ; 0xf4854 LB 0x93
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -5949,73 +6178,73 @@ print_boot_failure_:                         ; 0xf4636 LB 0x93
     and ah, 07fh                              ; 80 e4 7f
     movzx si, ah                              ; 0f b6 f4
     test al, al                               ; 84 c0
-    je short 04663h                           ; 74 1b
-    mov bx, 00dbah                            ; bb ba 0d
+    je short 04881h                           ; 74 1b
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 8e d2
-    push 00df4h                               ; 68 f4 0d
+    call 01931h                               ; e8 c0 d0
+    push 00de2h                               ; 68 e2 0d
     push 00488h                               ; 68 88 04
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 c4 d2
+    call 01972h                               ; e8 f6 d0
     add sp, strict byte 00006h                ; 83 c4 06
-    jmp short 046a7h                          ; eb 44
+    jmp short 048c5h                          ; eb 44
     test dl, dl                               ; 84 d2
-    je short 04677h                           ; 74 10
-    mov bx, 00dbah                            ; bb ba 0d
+    je short 04895h                           ; 74 10
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 6f d2
-    push 00dfeh                               ; 68 fe 0d
-    jmp short 04656h                          ; eb df
+    call 01931h                               ; e8 a1 d0
+    push 00dech                               ; 68 ec 0d
+    jmp short 04874h                          ; eb df
     test bl, 080h                             ; f6 c3 80
-    je short 0468dh                           ; 74 11
-    mov bx, 00dbah                            ; bb ba 0d
+    je short 048abh                           ; 74 11
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 5a d2
+    call 01931h                               ; e8 8c d0
     push si                                   ; 56
-    push 00deah                               ; 68 ea 0d
-    jmp short 0469ch                          ; eb 0f
-    mov bx, 00dbah                            ; bb ba 0d
+    push 00dd8h                               ; 68 d8 0d
+    jmp short 048bah                          ; eb 0f
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 49 d2
+    call 01931h                               ; e8 7b d0
     push si                                   ; 56
-    push 00de0h                               ; 68 e0 0d
+    push 00dceh                               ; 68 ce 0d
     push 0049dh                               ; 68 9d 04
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 7e d2
+    call 01972h                               ; e8 b0 d0
     add sp, strict byte 00008h                ; 83 c4 08
     cmp byte [bp+004h], 001h                  ; 80 7e 04 01
-    jne short 046c1h                          ; 75 14
+    jne short 048dfh                          ; 75 14
     test dh, dh                               ; 84 f6
-    jne short 046b6h                          ; 75 05
+    jne short 048d4h                          ; 75 05
     push 004b5h                               ; 68 b5 04
-    jmp short 046b9h                          ; eb 03
+    jmp short 048d7h                          ; eb 03
     push 004dfh                               ; 68 df 04
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 64 d2
+    call 01972h                               ; e8 96 d0
     add sp, strict byte 00004h                ; 83 c4 04
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00002h                               ; c2 02 00
-print_cdromboot_failure_:                    ; 0xf46c9 LB 0x27
+print_cdromboot_failure_:                    ; 0xf48e7 LB 0x27
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     push cx                                   ; 51
     push dx                                   ; 52
     mov dx, ax                                ; 89 c2
-    mov bx, 00dbah                            ; bb ba 0d
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 05 d2
+    call 01931h                               ; e8 37 d0
     push dx                                   ; 52
     push 00514h                               ; 68 14 05
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 3d d2
+    call 01972h                               ; e8 6f d0
     add sp, strict byte 00006h                ; 83 c4 06
     lea sp, [bp-006h]                         ; 8d 66 fa
     pop dx                                    ; 5a
@@ -6023,7 +6252,7 @@ print_cdromboot_failure_:                    ; 0xf46c9 LB 0x27
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-_int19_function:                             ; 0xf46f0 LB 0x256
+_int19_function:                             ; 0xf490e LB 0x256
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -6031,160 +6260,160 @@ _int19_function:                             ; 0xf46f0 LB 0x256
     sub sp, strict byte 0000eh                ; 83 ec 0e
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 1b cf
+    call 0166ch                               ; e8 4d cd
     mov bx, ax                                ; 89 c3
     mov word [bp-00eh], ax                    ; 89 46 f2
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
     mov ax, strict word 0003dh                ; b8 3d 00
-    call 0165ch                               ; e8 4c cf
+    call 016ach                               ; e8 7e cd
     movzx si, al                              ; 0f b6 f0
     mov ax, strict word 00038h                ; b8 38 00
-    call 0165ch                               ; e8 43 cf
+    call 016ach                               ; e8 75 cd
     and AL, strict byte 0f0h                  ; 24 f0
     xor ah, ah                                ; 30 e4
     sal ax, 004h                              ; c1 e0 04
     or si, ax                                 ; 09 c6
     mov ax, strict word 0003ch                ; b8 3c 00
-    call 0165ch                               ; e8 34 cf
+    call 016ach                               ; e8 66 cd
     and AL, strict byte 00fh                  ; 24 0f
     xor ah, ah                                ; 30 e4
     sal ax, 00ch                              ; c1 e0 0c
     or si, ax                                 ; 09 c6
     mov dx, 00339h                            ; ba 39 03
     mov ax, bx                                ; 89 d8
-    call 01600h                               ; e8 c7 ce
+    call 01650h                               ; e8 f9 cc
     test al, al                               ; 84 c0
-    je short 04748h                           ; 74 0b
+    je short 04966h                           ; 74 0b
     mov dx, 00339h                            ; ba 39 03
     mov ax, bx                                ; 89 d8
-    call 01600h                               ; e8 bb ce
+    call 01650h                               ; e8 ed cc
     movzx si, al                              ; 0f b6 f0
     cmp byte [bp+004h], 001h                  ; 80 7e 04 01
-    jne short 0475eh                          ; 75 10
+    jne short 0497ch                          ; 75 10
     mov ax, strict word 0003ch                ; b8 3c 00
-    call 0165ch                               ; e8 08 cf
+    call 016ach                               ; e8 3a cd
     and AL, strict byte 0f0h                  ; 24 f0
     xor ah, ah                                ; 30 e4
     sar ax, 004h                              ; c1 f8 04
-    call 07596h                               ; e8 38 2e
+    call 0781eh                               ; e8 a2 2e
     cmp byte [bp+004h], 002h                  ; 80 7e 04 02
-    jne short 04767h                          ; 75 03
+    jne short 04985h                          ; 75 03
     shr si, 004h                              ; c1 ee 04
     cmp byte [bp+004h], 003h                  ; 80 7e 04 03
-    jne short 04770h                          ; 75 03
+    jne short 0498eh                          ; 75 03
     shr si, 008h                              ; c1 ee 08
     cmp byte [bp+004h], 004h                  ; 80 7e 04 04
-    jne short 04779h                          ; 75 03
+    jne short 04997h                          ; 75 03
     shr si, 00ch                              ; c1 ee 0c
     cmp si, strict byte 00010h                ; 83 fe 10
-    jnc short 04782h                          ; 73 04
+    jnc short 049a0h                          ; 73 04
     mov byte [bp-008h], 001h                  ; c6 46 f8 01
     xor al, al                                ; 30 c0
     mov byte [bp-006h], al                    ; 88 46 fa
     mov byte [bp-00ah], al                    ; 88 46 f6
     mov byte [bp-00ch], al                    ; 88 46 f4
-    mov bx, 00dbah                            ; bb ba 0d
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 49 d1
+    call 01931h                               ; e8 7b cf
     push si                                   ; 56
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     push ax                                   ; 50
     push 00534h                               ; 68 34 05
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 7c d1
+    call 01972h                               ; e8 ae cf
     add sp, strict byte 00008h                ; 83 c4 08
     and si, strict byte 0000fh                ; 83 e6 0f
     cmp si, strict byte 00002h                ; 83 fe 02
-    jc short 047bfh                           ; 72 0e
-    jbe short 047ceh                          ; 76 1b
+    jc short 049ddh                           ; 72 0e
+    jbe short 049ech                          ; 76 1b
     cmp si, strict byte 00004h                ; 83 fe 04
-    je short 047ech                           ; 74 34
+    je short 04a0ah                           ; 74 34
     cmp si, strict byte 00003h                ; 83 fe 03
-    je short 047e2h                           ; 74 25
-    jmp short 04819h                          ; eb 5a
+    je short 04a00h                           ; 74 25
+    jmp short 04a37h                          ; eb 5a
     cmp si, strict byte 00001h                ; 83 fe 01
-    jne short 04819h                          ; 75 55
+    jne short 04a37h                          ; 75 55
     xor al, al                                ; 30 c0
     mov byte [bp-006h], al                    ; 88 46 fa
     mov byte [bp-00ah], al                    ; 88 46 f6
-    jmp short 04831h                          ; eb 63
+    jmp short 04a4fh                          ; eb 63
     mov dx, 00338h                            ; ba 38 03
     mov ax, word [bp-00eh]                    ; 8b 46 f2
-    call 01600h                               ; e8 29 ce
+    call 01650h                               ; e8 5b cc
     add AL, strict byte 080h                  ; 04 80
     mov byte [bp-006h], al                    ; 88 46 fa
     mov byte [bp-00ah], 000h                  ; c6 46 f6 00
-    jmp short 04831h                          ; eb 4f
+    jmp short 04a4fh                          ; eb 4f
     mov byte [bp-006h], 000h                  ; c6 46 fa 00
     mov byte [bp-00ah], 001h                  ; c6 46 f6 01
-    jmp short 047f6h                          ; eb 0a
+    jmp short 04a14h                          ; eb 0a
     mov byte [bp-00ch], 001h                  ; c6 46 f4 01
     cmp byte [bp-00ah], 000h                  ; 80 7e f6 00
-    je short 04831h                           ; 74 3b
-    call 0383fh                               ; e8 46 f0
+    je short 04a4fh                           ; 74 3b
+    call 03a5dh                               ; e8 46 f0
     mov bx, ax                                ; 89 c3
     test AL, strict byte 0ffh                 ; a8 ff
-    je short 04820h                           ; 74 21
-    call 046c9h                               ; e8 c7 fe
+    je short 04a3eh                           ; 74 21
+    call 048e7h                               ; e8 c7 fe
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     push ax                                   ; 50
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     mov cx, strict word 00001h                ; b9 01 00
-    call 04636h                               ; e8 1d fe
+    call 04854h                               ; e8 1d fe
     xor ax, ax                                ; 31 c0
     xor dx, dx                                ; 31 d2
-    jmp near 0493fh                           ; e9 1f 01
+    jmp near 04b5dh                           ; e9 1f 01
     mov dx, 0032eh                            ; ba 2e 03
     mov ax, word [bp-00eh]                    ; 8b 46 f2
-    call 0161ch                               ; e8 f3 cd
+    call 0166ch                               ; e8 25 cc
     mov di, ax                                ; 89 c7
     shr bx, 008h                              ; c1 eb 08
     mov byte [bp-006h], bl                    ; 88 5e fa
     cmp byte [bp-00ch], 001h                  ; 80 7e f4 01
-    jne near 048adh                           ; 0f 85 74 00
+    jne near 04acbh                           ; 0f 85 74 00
     xor si, si                                ; 31 f6
     mov ax, 0e200h                            ; b8 00 e2
     mov es, ax                                ; 8e c0
     cmp word [es:si], 0aa55h                  ; 26 81 3c 55 aa
-    jne short 04802h                          ; 75 bb
+    jne short 04a20h                          ; 75 bb
     mov cx, ax                                ; 89 c1
     mov si, word [es:si+01ah]                 ; 26 8b 74 1a
     cmp word [es:si+002h], 0506eh             ; 26 81 7c 02 6e 50
-    jne short 04802h                          ; 75 ad
+    jne short 04a20h                          ; 75 ad
     cmp word [es:si], 05024h                  ; 26 81 3c 24 50
-    jne short 04802h                          ; 75 a6
+    jne short 04a20h                          ; 75 a6
     mov di, word [es:si+00eh]                 ; 26 8b 7c 0e
     mov dx, word [es:di]                      ; 26 8b 15
     mov ax, word [es:di+002h]                 ; 26 8b 45 02
     cmp ax, 06568h                            ; 3d 68 65
-    jne short 0488bh                          ; 75 1f
+    jne short 04aa9h                          ; 75 1f
     cmp dx, 07445h                            ; 81 fa 45 74
-    jne short 0488bh                          ; 75 19
+    jne short 04aa9h                          ; 75 19
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
-    call 045ebh                               ; e8 6a fd
+    call 04809h                               ; e8 6a fd
     mov word [bp-012h], strict word 00006h    ; c7 46 ee 06 00
     mov word [bp-010h], cx                    ; 89 4e f0
-    jmp short 048a7h                          ; eb 1c
+    jmp short 04ac5h                          ; eb 1c
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
-    call 045ebh                               ; e8 51 fd
+    call 04809h                               ; e8 51 fd
     sti                                       ; fb
     mov word [bp-010h], cx                    ; 89 4e f0
     mov es, cx                                ; 8e c1
     mov ax, word [es:si+01ah]                 ; 26 8b 44 1a
     mov word [bp-012h], ax                    ; 89 46 ee
     call far [bp-012h]                        ; ff 5e ee
-    jmp near 04802h                           ; e9 55 ff
+    jmp near 04a20h                           ; e9 55 ff
     cmp byte [bp-00ah], 000h                  ; 80 7e f6 00
-    jne short 048d9h                          ; 75 26
+    jne short 04af7h                          ; 75 26
     cmp byte [bp-00ch], 000h                  ; 80 7e f4 00
-    jne short 048d9h                          ; 75 20
+    jne short 04af7h                          ; 75 20
     mov di, 007c0h                            ; bf c0 07
     mov es, di                                ; 8e c7
     mov dl, byte [bp-006h]                    ; 8a 56 fa
@@ -6197,40 +6426,40 @@ _int19_function:                             ; 0xf46f0 LB 0x256
     mov ax, strict word 00000h                ; b8 00 00
     sbb ax, strict byte 00000h                ; 83 d8 00
     test ax, ax                               ; 85 c0
-    jne near 04802h                           ; 0f 85 29 ff
+    jne near 04a20h                           ; 0f 85 29 ff
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
     db  00fh, 094h, 0c1h
     ; sete cl                                   ; 0f 94 c1
     cmp byte [bp-00ah], 000h                  ; 80 7e f6 00
-    je short 048e8h                           ; 74 02
+    je short 04b06h                           ; 74 02
     mov CL, strict byte 001h                  ; b1 01
     xor dx, dx                                ; 31 d2
     mov ax, di                                ; 89 f8
-    call 0161ch                               ; e8 2d cd
+    call 0166ch                               ; e8 5f cb
     mov bx, ax                                ; 89 c3
     mov dx, strict word 00002h                ; ba 02 00
     mov ax, di                                ; 89 f8
-    call 0161ch                               ; e8 23 cd
+    call 0166ch                               ; e8 55 cb
     cmp bx, ax                                ; 39 c3
-    je short 0490eh                           ; 74 11
+    je short 04b2ch                           ; 74 11
     test cl, cl                               ; 84 c9
-    jne short 04924h                          ; 75 23
+    jne short 04b42h                          ; 75 23
     mov dx, 001feh                            ; ba fe 01
     mov ax, di                                ; 89 f8
-    call 0161ch                               ; e8 13 cd
+    call 0166ch                               ; e8 45 cb
     cmp ax, 0aa55h                            ; 3d 55 aa
-    je short 04924h                           ; 74 16
+    je short 04b42h                           ; 74 16
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     push ax                                   ; 50
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     xor cx, cx                                ; 31 c9
-    jmp near 04816h                           ; e9 f2 fe
+    jmp near 04a34h                           ; e9 f2 fe
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     movzx dx, byte [bp-00ch]                  ; 0f b6 56 f4
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
-    call 045ebh                               ; e8 b8 fc
+    call 04809h                               ; e8 b8 fc
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     xor dx, dx                                ; 31 d2
     xor ax, ax                                ; 31 c0
@@ -6241,18 +6470,18 @@ _int19_function:                             ; 0xf46f0 LB 0x256
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-keyboard_panic_:                             ; 0xf4946 LB 0x13
+keyboard_panic_:                             ; 0xf4b64 LB 0x13
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push ax                                   ; 50
     push 00554h                               ; 68 54 05
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 d0 cf
+    call 01972h                               ; e8 02 ce
     add sp, strict byte 00006h                ; 83 c4 06
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-_keyboard_init:                              ; 0xf4959 LB 0x26a
+_keyboard_init:                              ; 0xf4b77 LB 0x26a
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov AL, strict byte 0aah                  ; b0 aa
@@ -6264,44 +6493,44 @@ _keyboard_init:                              ; 0xf4959 LB 0x26a
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 0497ch                           ; 74 0d
+    je short 04b9ah                           ; 74 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 0497ch                          ; 76 08
+    jbe short 04b9ah                          ; 76 08
     xor al, al                                ; 30 c0
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04965h                          ; eb e9
+    jmp short 04b83h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04985h                          ; 75 05
+    jne short 04ba3h                          ; 75 05
     xor ax, ax                                ; 31 c0
-    call 04946h                               ; e8 c1 ff
+    call 04b64h                               ; e8 c1 ff
     mov bx, strict word 0ffffh                ; bb ff ff
     mov dx, strict word 00064h                ; ba 64 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 0499fh                          ; 75 0d
+    jne short 04bbdh                          ; 75 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 0499fh                          ; 76 08
+    jbe short 04bbdh                          ; 76 08
     mov AL, strict byte 001h                  ; b0 01
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04988h                          ; eb e9
+    jmp short 04ba6h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 049a9h                          ; 75 06
+    jne short 04bc7h                          ; 75 06
     mov ax, strict word 00001h                ; b8 01 00
-    call 04946h                               ; e8 9d ff
+    call 04b64h                               ; e8 9d ff
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp ax, strict word 00055h                ; 3d 55 00
-    je short 049bah                           ; 74 06
+    je short 04bd8h                           ; 74 06
     mov ax, 003dfh                            ; b8 df 03
-    call 04946h                               ; e8 8c ff
+    call 04b64h                               ; e8 8c ff
     mov AL, strict byte 0abh                  ; b0 ab
     mov dx, strict word 00064h                ; ba 64 00
     out DX, AL                                ; ee
@@ -6311,44 +6540,44 @@ _keyboard_init:                              ; 0xf4959 LB 0x26a
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 049dah                           ; 74 0d
+    je short 04bf8h                           ; 74 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 049dah                          ; 76 08
+    jbe short 04bf8h                          ; 76 08
     mov AL, strict byte 010h                  ; b0 10
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 049c3h                          ; eb e9
+    jmp short 04be1h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 049e4h                          ; 75 06
+    jne short 04c02h                          ; 75 06
     mov ax, strict word 0000ah                ; b8 0a 00
-    call 04946h                               ; e8 62 ff
+    call 04b64h                               ; e8 62 ff
     mov bx, strict word 0ffffh                ; bb ff ff
     mov dx, strict word 00064h                ; ba 64 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 049feh                          ; 75 0d
+    jne short 04c1ch                          ; 75 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 049feh                          ; 76 08
+    jbe short 04c1ch                          ; 76 08
     mov AL, strict byte 011h                  ; b0 11
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 049e7h                          ; eb e9
+    jmp short 04c05h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04a08h                          ; 75 06
+    jne short 04c26h                          ; 75 06
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 04946h                               ; e8 3e ff
+    call 04b64h                               ; e8 3e ff
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test ax, ax                               ; 85 c0
-    je short 04a18h                           ; 74 06
+    je short 04c36h                           ; 74 06
     mov ax, 003e0h                            ; b8 e0 03
-    call 04946h                               ; e8 2e ff
+    call 04b64h                               ; e8 2e ff
     mov AL, strict byte 0ffh                  ; b0 ff
     mov dx, strict word 00060h                ; ba 60 00
     out DX, AL                                ; ee
@@ -6358,67 +6587,67 @@ _keyboard_init:                              ; 0xf4959 LB 0x26a
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 04a38h                           ; 74 0d
+    je short 04c56h                           ; 74 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 04a38h                          ; 76 08
+    jbe short 04c56h                          ; 76 08
     mov AL, strict byte 020h                  ; b0 20
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04a21h                          ; eb e9
+    jmp short 04c3fh                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04a42h                          ; 75 06
+    jne short 04c60h                          ; 75 06
     mov ax, strict word 00014h                ; b8 14 00
-    call 04946h                               ; e8 04 ff
+    call 04b64h                               ; e8 04 ff
     mov bx, strict word 0ffffh                ; bb ff ff
     mov dx, strict word 00064h                ; ba 64 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 04a5ch                          ; 75 0d
+    jne short 04c7ah                          ; 75 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 04a5ch                          ; 76 08
+    jbe short 04c7ah                          ; 76 08
     mov AL, strict byte 021h                  ; b0 21
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04a45h                          ; eb e9
+    jmp short 04c63h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04a66h                          ; 75 06
+    jne short 04c84h                          ; 75 06
     mov ax, strict word 00015h                ; b8 15 00
-    call 04946h                               ; e8 e0 fe
+    call 04b64h                               ; e8 e0 fe
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp ax, 000fah                            ; 3d fa 00
-    je short 04a77h                           ; 74 06
+    je short 04c95h                           ; 74 06
     mov ax, 003e1h                            ; b8 e1 03
-    call 04946h                               ; e8 cf fe
+    call 04b64h                               ; e8 cf fe
     mov dx, strict word 00064h                ; ba 64 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 04a89h                          ; 75 08
+    jne short 04ca7h                          ; 75 08
     mov AL, strict byte 031h                  ; b0 31
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04a77h                          ; eb ee
+    jmp short 04c95h                          ; eb ee
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp ax, 000aah                            ; 3d aa 00
-    je short 04aa2h                           ; 74 0e
+    je short 04cc0h                           ; 74 0e
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp ax, 000aah                            ; 3d aa 00
-    je short 04aa2h                           ; 74 06
+    je short 04cc0h                           ; 74 06
     mov ax, 003e2h                            ; b8 e2 03
-    call 04946h                               ; e8 a4 fe
+    call 04b64h                               ; e8 a4 fe
     mov AL, strict byte 0f5h                  ; b0 f5
     mov dx, strict word 00060h                ; ba 60 00
     out DX, AL                                ; ee
@@ -6428,44 +6657,44 @@ _keyboard_init:                              ; 0xf4959 LB 0x26a
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 04ac2h                           ; 74 0d
+    je short 04ce0h                           ; 74 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 04ac2h                          ; 76 08
+    jbe short 04ce0h                          ; 76 08
     mov AL, strict byte 040h                  ; b0 40
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04aabh                          ; eb e9
+    jmp short 04cc9h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04acch                          ; 75 06
+    jne short 04ceah                          ; 75 06
     mov ax, strict word 00028h                ; b8 28 00
-    call 04946h                               ; e8 7a fe
+    call 04b64h                               ; e8 7a fe
     mov bx, strict word 0ffffh                ; bb ff ff
     mov dx, strict word 00064h                ; ba 64 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 04ae6h                          ; 75 0d
+    jne short 04d04h                          ; 75 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 04ae6h                          ; 76 08
+    jbe short 04d04h                          ; 76 08
     mov AL, strict byte 041h                  ; b0 41
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04acfh                          ; eb e9
+    jmp short 04cedh                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04af0h                          ; 75 06
+    jne short 04d0eh                          ; 75 06
     mov ax, strict word 00029h                ; b8 29 00
-    call 04946h                               ; e8 56 fe
+    call 04b64h                               ; e8 56 fe
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp ax, 000fah                            ; 3d fa 00
-    je short 04b01h                           ; 74 06
+    je short 04d1fh                           ; 74 06
     mov ax, 003e3h                            ; b8 e3 03
-    call 04946h                               ; e8 45 fe
+    call 04b64h                               ; e8 45 fe
     mov AL, strict byte 060h                  ; b0 60
     mov dx, strict word 00064h                ; ba 64 00
     out DX, AL                                ; ee
@@ -6475,18 +6704,18 @@ _keyboard_init:                              ; 0xf4959 LB 0x26a
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 04b21h                           ; 74 0d
+    je short 04d3fh                           ; 74 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 04b21h                          ; 76 08
+    jbe short 04d3fh                          ; 76 08
     mov AL, strict byte 050h                  ; b0 50
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04b0ah                          ; eb e9
+    jmp short 04d28h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04b2bh                          ; 75 06
+    jne short 04d49h                          ; 75 06
     mov ax, strict word 00032h                ; b8 32 00
-    call 04946h                               ; e8 1b fe
+    call 04b64h                               ; e8 1b fe
     mov AL, strict byte 065h                  ; b0 65
     mov dx, strict word 00060h                ; ba 60 00
     out DX, AL                                ; ee
@@ -6496,18 +6725,18 @@ _keyboard_init:                              ; 0xf4959 LB 0x26a
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 04b4bh                           ; 74 0d
+    je short 04d69h                           ; 74 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 04b4bh                          ; 76 08
+    jbe short 04d69h                          ; 76 08
     mov AL, strict byte 060h                  ; b0 60
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04b34h                          ; eb e9
+    jmp short 04d52h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04b55h                          ; 75 06
+    jne short 04d73h                          ; 75 06
     mov ax, strict word 0003ch                ; b8 3c 00
-    call 04946h                               ; e8 f1 fd
+    call 04b64h                               ; e8 f1 fd
     mov AL, strict byte 0f4h                  ; b0 f4
     mov dx, strict word 00060h                ; ba 60 00
     out DX, AL                                ; ee
@@ -6517,53 +6746,53 @@ _keyboard_init:                              ; 0xf4959 LB 0x26a
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 04b75h                           ; 74 0d
+    je short 04d93h                           ; 74 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 04b75h                          ; 76 08
+    jbe short 04d93h                          ; 76 08
     mov AL, strict byte 070h                  ; b0 70
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04b5eh                          ; eb e9
+    jmp short 04d7ch                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04b7fh                          ; 75 06
+    jne short 04d9dh                          ; 75 06
     mov ax, strict word 00046h                ; b8 46 00
-    call 04946h                               ; e8 c7 fd
+    call 04b64h                               ; e8 c7 fd
     mov bx, strict word 0ffffh                ; bb ff ff
     mov dx, strict word 00064h                ; ba 64 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 04b99h                          ; 75 0d
+    jne short 04db7h                          ; 75 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 04b99h                          ; 76 08
+    jbe short 04db7h                          ; 76 08
     mov AL, strict byte 071h                  ; b0 71
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 04b82h                          ; eb e9
+    jmp short 04da0h                          ; eb e9
     test bx, bx                               ; 85 db
-    jne short 04ba3h                          ; 75 06
+    jne short 04dc1h                          ; 75 06
     mov ax, strict word 00046h                ; b8 46 00
-    call 04946h                               ; e8 a3 fd
+    call 04b64h                               ; e8 a3 fd
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp ax, 000fah                            ; 3d fa 00
-    je short 04bb4h                           ; 74 06
+    je short 04dd2h                           ; 74 06
     mov ax, 003e4h                            ; b8 e4 03
-    call 04946h                               ; e8 92 fd
+    call 04b64h                               ; e8 92 fd
     mov AL, strict byte 0a8h                  ; b0 a8
     mov dx, strict word 00064h                ; ba 64 00
     out DX, AL                                ; ee
     xor ax, ax                                ; 31 c0
-    call 05e2eh                               ; e8 6f 12
+    call 060b6h                               ; e8 d9 12
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-enqueue_key_:                                ; 0xf4bc3 LB 0x93
+enqueue_key_:                                ; 0xf4de1 LB 0x93
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -6575,32 +6804,32 @@ enqueue_key_:                                ; 0xf4bc3 LB 0x93
     mov bl, dl                                ; 88 d3
     mov dx, strict word 0001ah                ; ba 1a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 43 ca
+    call 0166ch                               ; e8 75 c8
     mov di, ax                                ; 89 c7
     mov dx, strict word 0001ch                ; ba 1c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 38 ca
+    call 0166ch                               ; e8 6a c8
     mov si, ax                                ; 89 c6
     lea cx, [si+002h]                         ; 8d 4c 02
     cmp cx, strict byte 0003eh                ; 83 f9 3e
-    jc short 04bf1h                           ; 72 03
+    jc short 04e0fh                           ; 72 03
     mov cx, strict word 0001eh                ; b9 1e 00
     cmp cx, di                                ; 39 f9
-    jne short 04bf9h                          ; 75 04
+    jne short 04e17h                          ; 75 04
     xor ax, ax                                ; 31 c0
-    jmp short 04c1eh                          ; eb 25
+    jmp short 04e3ch                          ; eb 25
     xor bh, bh                                ; 30 ff
     mov dx, si                                ; 89 f2
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 0b ca
+    call 0165eh                               ; e8 3d c8
     movzx bx, byte [bp-00ah]                  ; 0f b6 5e f6
     lea dx, [si+001h]                         ; 8d 54 01
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 fe c9
+    call 0165eh                               ; e8 30 c8
     mov bx, cx                                ; 89 cb
     mov dx, strict word 0001ch                ; ba 1c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0162ah                               ; e8 0f ca
+    call 0167ah                               ; e8 41 c8
     mov ax, strict word 00001h                ; b8 01 00
     lea sp, [bp-008h]                         ; 8d 66 f8
     pop di                                    ; 5f
@@ -6618,339 +6847,369 @@ enqueue_key_:                                ; 0xf4bc3 LB 0x93
     inc bp                                    ; 45
     cmp bh, byte [bx+si]                      ; 3a 38
     sub bl, byte [ss:di]                      ; 36 2a 1d
-    nop                                       ; 90
-    dec si                                    ; 4e
-    sbb ax, 0ec4dh                            ; 1d 4d ec
-    dec sp                                    ; 4c
-    in AL, DX                                 ; ec
-    dec sp                                    ; 4c
-    lahf                                      ; 9f
-    dec bp                                    ; 4d
-    lds cx, [si+011h]                         ; c5 4c 11
-    dec si                                    ; 4e
-    pushaw                                    ; 60
-    dec si                                    ; 4e
-    or word [bp+05eh], strict byte 0004dh     ; 83 4e 5e 4d
-    in AL, DX                                 ; ec
-    dec sp                                    ; 4c
-    in AL, DX                                 ; ec
-    dec sp                                    ; 4c
-    fmul dword [di-022h]                      ; d8 4d de
-    dec sp                                    ; 4c
-    inc cx                                    ; 41
+    fist word [bx+si+045h]                    ; df 50 45
+    dec di                                    ; 4f
+    or ax, 00d4fh                             ; 0d 4f 0d
+    dec di                                    ; 4f
+    ror word [bx-01dh], CL                    ; d3 4f e3
     dec si                                    ; 4e
-    jl short 04ca4h                           ; 7c 4e
-_int09_function:                             ; 0xf4c56 LB 0x35d
+    push cx                                   ; 51
+    push ax                                   ; 50
+    mov word [0c550h], ax                     ; a3 50 c5
+    push ax                                   ; 50
+    mov [bx+00dh], cs                         ; 8c 4f 0d
+    dec di                                    ; 4f
+    or ax, 0124fh                             ; 0d 4f 12
+    push ax                                   ; 50
+    dec word [bp-07ch]                        ; ff 4e 84
+    push ax                                   ; 50
+    db  0beh
+    push ax                                   ; 50
+_int09_function:                             ; 0xf4e74 LB 0x3c7
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
-    push si                                   ; 56
     push di                                   ; 57
-    sub sp, strict byte 0000ch                ; 83 ec 0c
+    sub sp, strict byte 0000eh                ; 83 ec 0e
     mov al, byte [bp+014h]                    ; 8a 46 14
-    mov byte [bp-00ah], al                    ; 88 46 f6
+    mov byte [bp-008h], al                    ; 88 46 f8
     test al, al                               ; 84 c0
-    jne short 04c81h                          ; 75 19
-    mov bx, 00dbah                            ; bb ba 0d
+    jne short 04e9eh                          ; 75 19
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 6e cc
+    call 01931h                               ; e8 a1 ca
     push 00567h                               ; 68 67 05
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 a7 cc
+    call 01972h                               ; e8 da ca
     add sp, strict byte 00004h                ; 83 c4 04
-    jmp near 04fach                           ; e9 2b 03
+    jmp near 05235h                           ; e9 97 03
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 76 c9
-    mov byte [bp-00eh], al                    ; 88 46 f2
-    mov bl, al                                ; 88 c3
+    call 01650h                               ; e8 a9 c7
+    mov byte [bp-010h], al                    ; 88 46 f0
+    mov byte [bp-00ah], al                    ; 88 46 f6
     mov dx, strict word 00018h                ; ba 18 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 68 c9
-    mov byte [bp-010h], al                    ; 88 46 f0
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    call 01650h                               ; e8 9a c7
+    mov byte [bp-00eh], al                    ; 88 46 f2
+    mov byte [bp-004h], al                    ; 88 46 fc
     mov dx, 00096h                            ; ba 96 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 59 c9
-    mov byte [bp-008h], al                    ; 88 46 f8
+    call 01650h                               ; e8 8b c7
     mov byte [bp-006h], al                    ; 88 46 fa
-    mov al, byte [bp-00ah]                    ; 8a 46 f6
+    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov al, byte [bp-008h]                    ; 8a 46 f8
     push CS                                   ; 0e
     pop ES                                    ; 07
     mov cx, strict word 00010h                ; b9 10 00
-    mov di, 04c27h                            ; bf 27 4c
+    mov di, 04e45h                            ; bf 45 4e
     repne scasb                               ; f2 ae
     sal cx, 1                                 ; d1 e1
     mov di, cx                                ; 89 cf
-    mov ax, word [cs:di+04c36h]               ; 2e 8b 85 36 4c
+    mov ax, word [cs:di+04e54h]               ; 2e 8b 85 54 4e
     jmp ax                                    ; ff e0
-    xor bl, 040h                              ; 80 f3 40
-    xor bh, bh                                ; 30 ff
+    xor byte [bp-00ah], 040h                  ; 80 76 f6 40
+    movzx bx, byte [bp-00ah]                  ; 0f b6 5e f6
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 3b c9
-    or byte [bp-00ch], 040h                   ; 80 4e f4 40
-    movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
-    jmp near 04e54h                           ; e9 76 01
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    call 0165eh                               ; e8 6a c7
+    or byte [bp-004h], 040h                   ; 80 4e fc 40
+    movzx bx, byte [bp-004h]                  ; 0f b6 5e fc
+    jmp near 05097h                           ; e9 98 01
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     and AL, strict byte 0bfh                  ; 24 bf
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov byte [bp-004h], al                    ; 88 46 fc
     movzx bx, al                              ; 0f b6 d8
-    jmp near 04e54h                           ; e9 68 01
-    test byte [bp-006h], 002h                 ; f6 46 fa 02
-    jne near 04f8eh                           ; 0f 85 9a 02
-    mov al, byte [bp-00ah]                    ; 8a 46 f6
+    jmp near 05097h                           ; e9 8a 01
+    test byte [bp-00ch], 002h                 ; f6 46 f4 02
+    jne near 05217h                           ; 0f 85 02 03
+    mov al, byte [bp-008h]                    ; 8a 46 f8
     and AL, strict byte 07fh                  ; 24 7f
     cmp AL, strict byte 02ah                  ; 3c 2a
     db  00fh, 094h, 0c0h
     ; sete al                                   ; 0f 94 c0
-    xor ah, ah                                ; 30 e4
-    inc ax                                    ; 40
-    test byte [bp-00ah], 080h                 ; f6 46 f6 80
-    je short 04d0dh                           ; 74 06
+    movzx dx, al                              ; 0f b6 d0
+    inc dx                                    ; 42
+    test byte [bp-008h], 080h                 ; f6 46 f8 80
+    je short 04f32h                           ; 74 09
+    mov al, dl                                ; 88 d0
     not al                                    ; f6 d0
-    and bl, al                                ; 20 c3
-    jmp short 04d0fh                          ; eb 02
-    or bl, al                                 ; 08 c3
-    xor bh, bh                                ; 30 ff
+    and byte [bp-00ah], al                    ; 20 46 f6
+    jmp short 04f35h                          ; eb 03
+    or byte [bp-00ah], dl                     ; 08 56 f6
+    movzx bx, byte [bp-00ah]                  ; 0f b6 5e f6
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 f4 c8
-    jmp near 04f8eh                           ; e9 71 02
-    test byte [bp-008h], 001h                 ; f6 46 f8 01
-    jne near 04f8eh                           ; 0f 85 69 02
-    or bl, 004h                               ; 80 cb 04
-    xor bh, bh                                ; 30 ff
+    call 0165eh                               ; e8 1c c7
+    jmp near 05217h                           ; e9 d2 02
+    test byte [bp-006h], 001h                 ; f6 46 fa 01
+    jne near 05217h                           ; 0f 85 ca 02
+    mov al, byte [bp-010h]                    ; 8a 46 f0
+    or AL, strict byte 004h                   ; 0c 04
+    mov byte [bp-00ah], al                    ; 88 46 f6
+    movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 db c8
-    mov al, byte [bp-008h]                    ; 8a 46 f8
+    call 0165eh                               ; e8 fd c6
+    mov al, byte [bp-006h]                    ; 8a 46 fa
     test AL, strict byte 002h                 ; a8 02
-    je short 04d47h                           ; 74 0d
+    je short 04f75h                           ; 74 0d
     or AL, strict byte 004h                   ; 0c 04
-    mov byte [bp-006h], al                    ; 88 46 fa
+    mov byte [bp-00ch], al                    ; 88 46 f4
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00096h                            ; ba 96 00
-    jmp short 04d55h                          ; eb 0e
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    jmp short 04f83h                          ; eb 0e
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     or AL, strict byte 001h                   ; 0c 01
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov byte [bp-004h], al                    ; 88 46 fc
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00018h                ; ba 18 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 b3 c8
-    jmp near 04f8eh                           ; e9 30 02
-    test byte [bp-008h], 001h                 ; f6 46 f8 01
-    jne near 04f8eh                           ; 0f 85 28 02
-    and bl, 0fbh                              ; 80 e3 fb
-    xor bh, bh                                ; 30 ff
+    call 0165eh                               ; e8 d5 c6
+    jmp near 05217h                           ; e9 8b 02
+    test byte [bp-006h], 001h                 ; f6 46 fa 01
+    jne near 05217h                           ; 0f 85 83 02
+    mov al, byte [bp-010h]                    ; 8a 46 f0
+    and AL, strict byte 0fbh                  ; 24 fb
+    mov byte [bp-00ah], al                    ; 88 46 f6
+    movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 9a c8
-    mov al, byte [bp-008h]                    ; 8a 46 f8
+    call 0165eh                               ; e8 b6 c6
+    mov al, byte [bp-006h]                    ; 8a 46 fa
     test AL, strict byte 002h                 ; a8 02
-    je short 04d88h                           ; 74 0d
+    je short 04fbch                           ; 74 0d
     and AL, strict byte 0fbh                  ; 24 fb
-    mov byte [bp-006h], al                    ; 88 46 fa
+    mov byte [bp-00ch], al                    ; 88 46 f4
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00096h                            ; ba 96 00
-    jmp short 04d96h                          ; eb 0e
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    jmp short 04fcah                          ; eb 0e
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     and AL, strict byte 0feh                  ; 24 fe
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov byte [bp-004h], al                    ; 88 46 fc
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00018h                ; ba 18 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 72 c8
-    jmp near 04f8eh                           ; e9 ef 01
-    or bl, 008h                               ; 80 cb 08
-    xor bh, bh                                ; 30 ff
+    call 0165eh                               ; e8 8e c6
+    jmp near 05217h                           ; e9 44 02
+    mov al, byte [bp-010h]                    ; 8a 46 f0
+    or AL, strict byte 008h                   ; 0c 08
+    mov byte [bp-00ah], al                    ; 88 46 f6
+    movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 61 c8
-    mov al, byte [bp-008h]                    ; 8a 46 f8
+    call 0165eh                               ; e8 77 c6
+    mov al, byte [bp-006h]                    ; 8a 46 fa
     test AL, strict byte 002h                 ; a8 02
-    je short 04dc1h                           ; 74 0d
+    je short 04ffbh                           ; 74 0d
     or AL, strict byte 008h                   ; 0c 08
-    mov byte [bp-006h], al                    ; 88 46 fa
+    mov byte [bp-00ch], al                    ; 88 46 f4
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00096h                            ; ba 96 00
-    jmp short 04dcfh                          ; eb 0e
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    jmp short 05009h                          ; eb 0e
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     or AL, strict byte 002h                   ; 0c 02
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov byte [bp-004h], al                    ; 88 46 fc
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00018h                ; ba 18 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 39 c8
-    jmp near 04f8eh                           ; e9 b6 01
-    and bl, 0f7h                              ; 80 e3 f7
-    xor bh, bh                                ; 30 ff
+    call 0165eh                               ; e8 4f c6
+    jmp near 05217h                           ; e9 05 02
+    mov al, byte [bp-010h]                    ; 8a 46 f0
+    and AL, strict byte 0f7h                  ; 24 f7
+    mov byte [bp-00ah], al                    ; 88 46 f6
+    movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 28 c8
-    mov al, byte [bp-008h]                    ; 8a 46 f8
+    call 0165eh                               ; e8 38 c6
+    mov al, byte [bp-006h]                    ; 8a 46 fa
     test AL, strict byte 002h                 ; a8 02
-    je short 04dfah                           ; 74 0d
+    je short 0503ah                           ; 74 0d
     and AL, strict byte 0f7h                  ; 24 f7
-    mov byte [bp-006h], al                    ; 88 46 fa
+    mov byte [bp-00ch], al                    ; 88 46 f4
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00096h                            ; ba 96 00
-    jmp short 04e08h                          ; eb 0e
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    jmp short 05048h                          ; eb 0e
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     and AL, strict byte 0fdh                  ; 24 fd
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov byte [bp-004h], al                    ; 88 46 fc
+    movzx bx, al                              ; 0f b6 d8
+    mov dx, strict word 00018h                ; ba 18 00
+    mov ax, strict word 00040h                ; b8 40 00
+    call 0165eh                               ; e8 10 c6
+    jmp near 05217h                           ; e9 c6 01
+    test byte [bp-006h], 003h                 ; f6 46 fa 03
+    jne near 05217h                           ; 0f 85 be 01
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
+    or AL, strict byte 020h                   ; 0c 20
+    mov byte [bp-004h], al                    ; 88 46 fc
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00018h                ; ba 18 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 00 c8
-    jmp near 04f8eh                           ; e9 7d 01
-    test byte [bp-008h], 003h                 ; f6 46 f8 03
-    jne near 04f8eh                           ; 0f 85 75 01
+    call 0165eh                               ; e8 f1 c5
     mov al, byte [bp-010h]                    ; 8a 46 f0
-    or AL, strict byte 020h                   ; 0c 20
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    xor AL, strict byte 020h                  ; 34 20
+    mov byte [bp-00ah], al                    ; 88 46 f6
     movzx bx, al                              ; 0f b6 d8
-    mov dx, strict word 00018h                ; ba 18 00
-    mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 e1 c7
-    mov bl, byte [bp-00eh]                    ; 8a 5e f2
-    xor bl, 020h                              ; 80 f3 20
-    xor bh, bh                                ; 30 ff
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 d0 c7
-    jmp near 04f8eh                           ; e9 4d 01
-    test byte [bp-008h], 003h                 ; f6 46 f8 03
-    jne near 04f8eh                           ; 0f 85 45 01
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    call 0165eh                               ; e8 dd c5
+    jmp near 05217h                           ; e9 93 01
+    test byte [bp-006h], 003h                 ; f6 46 fa 03
+    jne near 05217h                           ; 0f 85 8b 01
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     and AL, strict byte 0dfh                  ; 24 df
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov byte [bp-004h], al                    ; 88 46 fc
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00018h                ; ba 18 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 b1 c7
-    jmp near 04f8eh                           ; e9 2e 01
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    call 0165eh                               ; e8 be c5
+    jmp near 05217h                           ; e9 74 01
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     or AL, strict byte 010h                   ; 0c 10
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    mov byte [bp-004h], al                    ; 88 46 fc
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00018h                ; ba 18 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 9a c7
-    mov bl, byte [bp-00eh]                    ; 8a 5e f2
-    xor bl, 010h                              ; 80 f3 10
-    jmp short 04e33h                          ; eb b7
+    call 0165eh                               ; e8 a7 c5
     mov al, byte [bp-010h]                    ; 8a 46 f0
+    xor AL, strict byte 010h                  ; 34 10
+    jmp short 05072h                          ; eb b4
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     and AL, strict byte 0efh                  ; 24 ef
-    jmp short 04e4eh                          ; eb cb
-    mov al, bl                                ; 88 d8
+    jmp short 05091h                          ; eb cc
+    mov al, byte [bp-010h]                    ; 8a 46 f0
     and AL, strict byte 00ch                  ; 24 0c
     cmp AL, strict byte 00ch                  ; 3c 0c
-    jne short 04e90h                          ; 75 05
+    jne short 050dfh                          ; 75 11
+    mov bx, 01234h                            ; bb 34 12
+    mov dx, strict word 00072h                ; ba 72 00
+    mov ax, strict word 00040h                ; b8 40 00
+    call 0167ah                               ; e8 a0 c5
     jmp far 0f000h:0e05bh                     ; ea 5b e0 00 f0
-    test byte [bp-00ah], 080h                 ; f6 46 f6 80
-    jne near 04f8eh                           ; 0f 85 f6 00
-    cmp byte [bp-00ah], 058h                  ; 80 7e f6 58
-    jbe short 04ebch                          ; 76 1e
-    mov bx, 00dbah                            ; bb ba 0d
+    mov al, byte [bp-008h]                    ; 8a 46 f8
+    test AL, strict byte 080h                 ; a8 80
+    je short 0511dh                           ; 74 37
+    cmp AL, strict byte 0fah                  ; 3c fa
+    jne short 050fah                          ; 75 10
+    mov dx, 00097h                            ; ba 97 00
+    mov ax, strict word 00040h                ; b8 40 00
+    call 01650h                               ; e8 5d c5
+    mov dl, al                                ; 88 c2
+    or dl, 010h                               ; 80 ca 10
+    jmp short 0510eh                          ; eb 14
+    cmp AL, strict byte 0feh                  ; 3c fe
+    jne near 05217h                           ; 0f 85 17 01
+    mov dx, 00097h                            ; ba 97 00
+    mov ax, strict word 00040h                ; b8 40 00
+    call 01650h                               ; e8 47 c5
+    mov dl, al                                ; 88 c2
+    or dl, 020h                               ; 80 ca 20
+    movzx bx, dl                              ; 0f b6 da
+    mov dx, 00097h                            ; ba 97 00
+    mov ax, strict word 00040h                ; b8 40 00
+    call 0165eh                               ; e8 44 c5
+    jmp near 05217h                           ; e9 fa 00
+    cmp byte [bp-008h], 058h                  ; 80 7e f8 58
+    jbe short 05141h                          ; 76 1e
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 38 ca
-    movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
+    call 01931h                               ; e8 03 c8
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     push ax                                   ; 50
     push 00581h                               ; 68 81 05
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 6c ca
+    call 01972h                               ; e8 37 c8
     add sp, strict byte 00006h                ; 83 c4 06
-    jmp near 04fach                           ; e9 f0 00
-    test bl, 008h                             ; f6 c3 08
-    je short 04ed3h                           ; 74 12
-    movzx si, byte [bp-00ah]                  ; 0f b6 76 f6
-    imul si, si, strict byte 0000ah           ; 6b f6 0a
-    mov dl, byte [si+00e0eh]                  ; 8a 94 0e 0e
-    mov ax, word [si+00e0eh]                  ; 8b 84 0e 0e
-    jmp near 04f5fh                           ; e9 8c 00
-    test bl, 004h                             ; f6 c3 04
-    je short 04eeah                           ; 74 12
-    movzx si, byte [bp-00ah]                  ; 0f b6 76 f6
-    imul si, si, strict byte 0000ah           ; 6b f6 0a
-    mov dl, byte [si+00e0ch]                  ; 8a 94 0c 0e
-    mov ax, word [si+00e0ch]                  ; 8b 84 0c 0e
-    jmp near 04f5fh                           ; e9 75 00
-    mov al, byte [bp-006h]                    ; 8a 46 fa
+    jmp near 05235h                           ; e9 f4 00
+    mov al, byte [bp-00ah]                    ; 8a 46 f6
+    test AL, strict byte 008h                 ; a8 08
+    je short 0515ah                           ; 74 12
+    movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
+    imul bx, bx, strict byte 0000ah           ; 6b db 0a
+    mov dl, byte [bx+00dfch]                  ; 8a 97 fc 0d
+    mov ax, word [bx+00dfch]                  ; 8b 87 fc 0d
+    jmp near 051e8h                           ; e9 8e 00
+    test AL, strict byte 004h                 ; a8 04
+    je short 05170h                           ; 74 12
+    movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
+    imul bx, bx, strict byte 0000ah           ; 6b db 0a
+    mov dl, byte [bx+00dfah]                  ; 8a 97 fa 0d
+    mov ax, word [bx+00dfah]                  ; 8b 87 fa 0d
+    jmp near 051e8h                           ; e9 78 00
+    mov al, byte [bp-00ch]                    ; 8a 46 f4
     and AL, strict byte 002h                  ; 24 02
     test al, al                               ; 84 c0
-    jbe short 04f08h                          ; 76 15
-    mov al, byte [bp-00ah]                    ; 8a 46 f6
+    jbe short 0518eh                          ; 76 15
+    mov al, byte [bp-008h]                    ; 8a 46 f8
     cmp AL, strict byte 047h                  ; 3c 47
-    jc short 04f08h                           ; 72 0e
+    jc short 0518eh                           ; 72 0e
     cmp AL, strict byte 053h                  ; 3c 53
-    jnbe short 04f08h                         ; 77 0a
+    jnbe short 0518eh                         ; 77 0a
     mov DL, strict byte 0e0h                  ; b2 e0
-    movzx si, al                              ; 0f b6 f0
-    imul si, si, strict byte 0000ah           ; 6b f6 0a
-    jmp short 04f5bh                          ; eb 53
-    test bl, 003h                             ; f6 c3 03
-    je short 04f3ah                           ; 74 2d
-    movzx si, byte [bp-00ah]                  ; 0f b6 76 f6
-    imul si, si, strict byte 0000ah           ; 6b f6 0a
-    movzx ax, byte [si+00e10h]                ; 0f b6 84 10 0e
-    movzx dx, bl                              ; 0f b6 d3
+    movzx bx, al                              ; 0f b6 d8
+    imul bx, bx, strict byte 0000ah           ; 6b db 0a
+    jmp short 051e4h                          ; eb 56
+    test byte [bp-00ah], 003h                 ; f6 46 f6 03
+    je short 051c2h                           ; 74 2e
+    movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
+    imul bx, bx, strict byte 0000ah           ; 6b db 0a
+    movzx ax, byte [bx+00dfeh]                ; 0f b6 87 fe 0d
+    movzx dx, byte [bp-00ah]                  ; 0f b6 56 f6
     test dx, ax                               ; 85 c2
-    je short 04f2ah                           ; 74 0a
-    mov dl, byte [si+00e08h]                  ; 8a 94 08 0e
-    mov ax, word [si+00e08h]                  ; 8b 84 08 0e
-    jmp short 04f32h                          ; eb 08
-    mov dl, byte [si+00e0ah]                  ; 8a 94 0a 0e
-    mov ax, word [si+00e0ah]                  ; 8b 84 0a 0e
+    je short 051b2h                           ; 74 0a
+    mov dl, byte [bx+00df6h]                  ; 8a 97 f6 0d
+    mov ax, word [bx+00df6h]                  ; 8b 87 f6 0d
+    jmp short 051bah                          ; eb 08
+    mov dl, byte [bx+00df8h]                  ; 8a 97 f8 0d
+    mov ax, word [bx+00df8h]                  ; 8b 87 f8 0d
     shr ax, 008h                              ; c1 e8 08
-    mov byte [bp-00ah], al                    ; 88 46 f6
-    jmp short 04f65h                          ; eb 2b
-    movzx si, byte [bp-00ah]                  ; 0f b6 76 f6
-    imul si, si, strict byte 0000ah           ; 6b f6 0a
-    movzx ax, byte [si+00e10h]                ; 0f b6 84 10 0e
-    movzx dx, bl                              ; 0f b6 d3
+    mov byte [bp-008h], al                    ; 88 46 f8
+    jmp short 051eeh                          ; eb 2c
+    movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
+    imul bx, bx, strict byte 0000ah           ; 6b db 0a
+    movzx ax, byte [bx+00dfeh]                ; 0f b6 87 fe 0d
+    movzx dx, byte [bp-00ah]                  ; 0f b6 56 f6
     test dx, ax                               ; 85 c2
-    je short 04f57h                           ; 74 0a
-    mov dl, byte [si+00e0ah]                  ; 8a 94 0a 0e
-    mov ax, word [si+00e0ah]                  ; 8b 84 0a 0e
-    jmp short 04f5fh                          ; eb 08
-    mov dl, byte [si+00e08h]                  ; 8a 94 08 0e
-    mov ax, word [si+00e08h]                  ; 8b 84 08 0e
+    je short 051e0h                           ; 74 0a
+    mov dl, byte [bx+00df8h]                  ; 8a 97 f8 0d
+    mov ax, word [bx+00df8h]                  ; 8b 87 f8 0d
+    jmp short 051e8h                          ; eb 08
+    mov dl, byte [bx+00df6h]                  ; 8a 97 f6 0d
+    mov ax, word [bx+00df6h]                  ; 8b 87 f6 0d
     shr ax, 008h                              ; c1 e8 08
-    mov byte [bp-00ah], al                    ; 88 46 f6
-    cmp byte [bp-00ah], 000h                  ; 80 7e f6 00
-    jne short 04f85h                          ; 75 1a
+    mov byte [bp-008h], al                    ; 88 46 f8
+    cmp byte [bp-008h], 000h                  ; 80 7e f8 00
+    jne short 0520eh                          ; 75 1a
     test dl, dl                               ; 84 d2
-    jne short 04f85h                          ; 75 16
-    mov bx, 00dbah                            ; bb ba 0d
+    jne short 0520eh                          ; 75 16
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 67 c9
+    call 01931h                               ; e8 2e c7
     push 005b8h                               ; 68 b8 05
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 a0 c9
+    call 01972h                               ; e8 67 c7
     add sp, strict byte 00004h                ; 83 c4 04
     xor dh, dh                                ; 30 f6
-    movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
-    call 04bc3h                               ; e8 35 fc
-    mov al, byte [bp-00ah]                    ; 8a 46 f6
+    movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
+    call 04de1h                               ; e8 ca fb
+    mov al, byte [bp-008h]                    ; 8a 46 f8
     and AL, strict byte 07fh                  ; 24 7f
     cmp AL, strict byte 01dh                  ; 3c 1d
-    je short 04f9bh                           ; 74 04
-    and byte [bp-006h], 0feh                  ; 80 66 fa fe
-    and byte [bp-006h], 0fdh                  ; 80 66 fa fd
-    movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
+    je short 05224h                           ; 74 04
+    and byte [bp-00ch], 0feh                  ; 80 66 f4 fe
+    and byte [bp-00ch], 0fdh                  ; 80 66 f4 fd
+    movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     mov dx, 00096h                            ; ba 96 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 62 c6
-    lea sp, [bp-004h]                         ; 8d 66 fc
+    call 0165eh                               ; e8 29 c4
+    lea sp, [bp-002h]                         ; 8d 66 fe
     pop di                                    ; 5f
-    pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-dequeue_key_:                                ; 0xf4fb3 LB 0x94
+dequeue_key_:                                ; 0xf523b LB 0x94
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -6963,36 +7222,36 @@ dequeue_key_:                                ; 0xf4fb3 LB 0x94
     mov word [bp-008h], cx                    ; 89 4e f8
     mov dx, strict word 0001ah                ; ba 1a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 4f c6
+    call 0166ch                               ; e8 17 c4
     mov bx, ax                                ; 89 c3
     mov dx, strict word 0001ch                ; ba 1c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 44 c6
+    call 0166ch                               ; e8 0c c4
     cmp bx, ax                                ; 39 c3
-    je short 05019h                           ; 74 3d
+    je short 052a1h                           ; 74 3d
     mov dx, bx                                ; 89 da
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 1c c6
+    call 01650h                               ; e8 e4 c3
     mov cl, al                                ; 88 c1
     lea dx, [bx+001h]                         ; 8d 57 01
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 11 c6
+    call 01650h                               ; e8 d9 c3
     mov es, [bp-008h]                         ; 8e 46 f8
     mov byte [es:si], cl                      ; 26 88 0c
     mov es, [bp-006h]                         ; 8e 46 fa
     mov byte [es:di], al                      ; 26 88 05
     cmp word [bp+004h], strict byte 00000h    ; 83 7e 04 00
-    je short 05014h                           ; 74 13
+    je short 0529ch                           ; 74 13
     inc bx                                    ; 43
     inc bx                                    ; 43
     cmp bx, strict byte 0003eh                ; 83 fb 3e
-    jc short 0500bh                           ; 72 03
+    jc short 05293h                           ; 72 03
     mov bx, strict word 0001eh                ; bb 1e 00
     mov dx, strict word 0001ah                ; ba 1a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0162ah                               ; e8 16 c6
+    call 0167ah                               ; e8 de c3
     mov ax, strict word 00001h                ; b8 01 00
-    jmp short 0501bh                          ; eb 02
+    jmp short 052a3h                          ; eb 02
     xor ax, ax                                ; 31 c0
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
@@ -7003,35 +7262,34 @@ dequeue_key_:                                ; 0xf4fb3 LB 0x94
     adc word [bx+si], dx                      ; 11 10
     or cl, byte [bx+di]                       ; 0a 09
     add ax, 00102h                            ; 05 02 01
-    add ch, ah                                ; 00 e5
-    push dx                                   ; 52
-    sti                                       ; fb
+    add byte [di+055h], ch                    ; 00 6d 55
+    adc word [bp+di-036h], strict byte 00053h ; 83 53 ca 53
+    push SS                                   ; 16
+    push sp                                   ; 54
+    db  026h, 054h
+    ; es push sp                                ; 26 54
     push ax                                   ; 50
-    inc dx                                    ; 42
-    push cx                                   ; 51
-    mov ss, [bx+di-062h]                      ; 8e 51 9e
-    push cx                                   ; 51
-    enter 0d151h, 051h                        ; c8 51 d1 51
-    inc dx                                    ; 42
-    push dx                                   ; 52
-    jnc short 05093h                          ; 73 52
-    mov AL, byte [0da52h]                     ; a0 52 da
-    push dx                                   ; 52
-    db  028h
-    push bx                                   ; 53
-_int16_function:                             ; 0xf5047 LB 0x2e7
+    push sp                                   ; 54
+    pop cx                                    ; 59
+    push sp                                   ; 54
+    retf 0fb54h                               ; ca 54 fb
+    push sp                                   ; 54
+    sub byte [di+062h], dl                    ; 28 55 62
+    push bp                                   ; 55
+    mov AL, strict byte 055h                  ; b0 55
+_int16_function:                             ; 0xf52cf LB 0x2e7
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push di                                   ; 57
     sub sp, strict byte 00006h                ; 83 ec 06
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 a9 c5
+    call 01650h                               ; e8 71 c3
     mov cl, al                                ; 88 c1
     mov bh, al                                ; 88 c7
     mov dx, 00097h                            ; ba 97 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 9c c5
+    call 01650h                               ; e8 64 c3
     mov bl, al                                ; 88 c3
     movzx dx, cl                              ; 0f b6 d1
     sar dx, 004h                              ; c1 fa 04
@@ -7040,7 +7298,7 @@ _int16_function:                             ; 0xf5047 LB 0x2e7
     xor ah, ah                                ; 30 e4
     xor al, dl                                ; 30 d0
     test ax, ax                               ; 85 c0
-    je short 050d9h                           ; 74 60
+    je short 05361h                           ; 74 60
     cli                                       ; fa
     mov AL, strict byte 0edh                  ; b0 ed
     mov dx, strict word 00060h                ; ba 60 00
@@ -7050,18 +7308,18 @@ _int16_function:                             ; 0xf5047 LB 0x2e7
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 05092h                          ; 75 08
+    jne short 0531ah                          ; 75 08
     mov AL, strict byte 021h                  ; b0 21
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 05080h                          ; eb ee
+    jmp short 05308h                          ; eb ee
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp ax, 000fah                            ; 3d fa 00
-    jne short 050d8h                          ; 75 3b
-    and bl, 0f8h                              ; 80 e3 f8
+    jne short 05360h                          ; 75 3b
+    and bl, 0c8h                              ; 80 e3 c8
     movzx ax, bh                              ; 0f b6 c7
     sar ax, 004h                              ; c1 f8 04
     and ax, strict word 00007h                ; 25 07 00
@@ -7076,11 +7334,11 @@ _int16_function:                             ; 0xf5047 LB 0x2e7
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 050c7h                          ; 75 08
+    jne short 0534fh                          ; 75 08
     mov AL, strict byte 021h                  ; b0 21
     mov dx, 00080h                            ; ba 80 00
     out DX, AL                                ; ee
-    jmp short 050b5h                          ; eb ee
+    jmp short 0533dh                          ; eb ee
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -7088,63 +7346,63 @@ _int16_function:                             ; 0xf5047 LB 0x2e7
     xor bh, bh                                ; 30 ff
     mov dx, 00097h                            ; ba 97 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 36 c5
+    call 0165eh                               ; e8 fe c2
     sti                                       ; fb
     mov ax, word [bp+012h]                    ; 8b 46 12
     shr ax, 008h                              ; c1 e8 08
     cmp ax, 000a2h                            ; 3d a2 00
-    jnbe near 052e5h                          ; 0f 87 ff 01
+    jnbe near 0556dh                          ; 0f 87 ff 01
     push CS                                   ; 0e
     pop ES                                    ; 07
     mov cx, strict word 0000ch                ; b9 0c 00
-    mov di, 05024h                            ; bf 24 50
+    mov di, 052ach                            ; bf ac 52
     repne scasb                               ; f2 ae
     sal cx, 1                                 ; d1 e1
     mov di, cx                                ; 89 cf
-    mov ax, word [cs:di+0502fh]               ; 2e 8b 85 2f 50
+    mov ax, word [cs:di+052b7h]               ; 2e 8b 85 b7 52
     jmp ax                                    ; ff e0
     push strict byte 00001h                   ; 6a 01
     mov cx, ss                                ; 8c d1
     lea bx, [bp-008h]                         ; 8d 5e f8
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 04fb3h                               ; e8 a9 fe
+    call 0523bh                               ; e8 a9 fe
     test ax, ax                               ; 85 c0
-    jne short 05119h                          ; 75 0b
+    jne short 053a1h                          ; 75 0b
     push 005efh                               ; 68 ef 05
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 0c c8
+    call 01972h                               ; e8 d4 c5
     add sp, strict byte 00004h                ; 83 c4 04
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    je short 05125h                           ; 74 06
+    je short 053adh                           ; 74 06
     cmp byte [bp-008h], 0f0h                  ; 80 7e f8 f0
-    je short 0512bh                           ; 74 06
+    je short 053b3h                           ; 74 06
     cmp byte [bp-008h], 0e0h                  ; 80 7e f8 e0
-    jne short 0512fh                          ; 75 04
+    jne short 053b7h                          ; 75 04
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
     movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
     sal dx, 008h                              ; c1 e2 08
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     or dx, ax                                 ; 09 c2
     mov word [bp+012h], dx                    ; 89 56 12
-    jmp near 05328h                           ; e9 e6 01
+    jmp near 055b0h                           ; e9 e6 01
     or word [bp+01ch], 00200h                 ; 81 4e 1c 00 02
     push strict byte 00000h                   ; 6a 00
     mov cx, ss                                ; 8c d1
     lea bx, [bp-008h]                         ; 8d 5e f8
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 04fb3h                               ; e8 5d fe
+    call 0523bh                               ; e8 5d fe
     test ax, ax                               ; 85 c0
-    jne short 05161h                          ; 75 07
+    jne short 053e9h                          ; 75 07
     or word [bp+01ch], strict byte 00040h     ; 83 4e 1c 40
-    jmp near 05328h                           ; e9 c7 01
+    jmp near 055b0h                           ; e9 c7 01
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    je short 0516dh                           ; 74 06
+    je short 053f5h                           ; 74 06
     cmp byte [bp-008h], 0f0h                  ; 80 7e f8 f0
-    je short 05173h                           ; 74 06
+    je short 053fbh                           ; 74 06
     cmp byte [bp-008h], 0e0h                  ; 80 7e f8 e0
-    jne short 05177h                          ; 75 04
+    jne short 053ffh                          ; 75 04
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
     movzx dx, byte [bp-006h]                  ; 0f b6 56 fa
     sal dx, 008h                              ; c1 e2 08
@@ -7152,32 +7410,32 @@ _int16_function:                             ; 0xf5047 LB 0x2e7
     or dx, ax                                 ; 09 c2
     mov word [bp+012h], dx                    ; 89 56 12
     and word [bp+01ch], strict byte 0ffbfh    ; 83 66 1c bf
-    jmp near 05328h                           ; e9 9a 01
+    jmp near 055b0h                           ; e9 9a 01
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 69 c4
+    call 01650h                               ; e8 31 c2
     mov dx, word [bp+012h]                    ; 8b 56 12
     mov dl, al                                ; 88 c2
-    jmp short 0513ch                          ; eb 9e
+    jmp short 053c4h                          ; eb 9e
     mov al, byte [bp+010h]                    ; 8a 46 10
     movzx dx, al                              ; 0f b6 d0
     mov ax, word [bp+010h]                    ; 8b 46 10
     shr ax, 008h                              ; c1 e8 08
     xor ah, ah                                ; 30 e4
-    call 04bc3h                               ; e8 14 fa
+    call 04de1h                               ; e8 aa f9
     test ax, ax                               ; 85 c0
-    jne short 051c0h                          ; 75 0d
+    jne short 05448h                          ; 75 0d
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor al, al                                ; 30 c0
     or AL, strict byte 001h                   ; 0c 01
     mov word [bp+012h], ax                    ; 89 46 12
-    jmp near 05328h                           ; e9 68 01
+    jmp near 055b0h                           ; e9 68 01
     and word [bp+012h], 0ff00h                ; 81 66 12 00 ff
-    jmp near 05328h                           ; e9 60 01
+    jmp near 055b0h                           ; e9 60 01
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor al, al                                ; 30 c0
     or AL, strict byte 030h                   ; 0c 30
-    jmp short 051bah                          ; eb e9
+    jmp short 05442h                          ; eb e9
     mov byte [bp-004h], 002h                  ; c6 46 fc 02
     xor cx, cx                                ; 31 c9
     cli                                       ; fa
@@ -7190,40 +7448,40 @@ _int16_function:                             ; 0xf5047 LB 0x2e7
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 051f8h                          ; 75 0d
+    jne short 05480h                          ; 75 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 051f8h                          ; 76 08
+    jbe short 05480h                          ; 76 08
     mov dx, 00080h                            ; ba 80 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
-    jmp short 051e1h                          ; eb e9
+    jmp short 05469h                          ; eb e9
     test bx, bx                               ; 85 db
-    jbe short 0523ch                          ; 76 40
+    jbe short 054c4h                          ; 76 40
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp ax, 000fah                            ; 3d fa 00
-    jne short 0523ch                          ; 75 35
+    jne short 054c4h                          ; 75 35
     mov bx, strict word 0ffffh                ; bb ff ff
     mov dx, strict word 00064h                ; ba 64 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 05221h                          ; 75 0d
+    jne short 054a9h                          ; 75 0d
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 05221h                          ; 76 08
+    jbe short 054a9h                          ; 76 08
     mov dx, 00080h                            ; ba 80 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
-    jmp short 0520ah                          ; eb e9
+    jmp short 05492h                          ; eb e9
     test bx, bx                               ; 85 db
-    jbe short 05233h                          ; 76 0e
+    jbe short 054bbh                          ; 76 0e
     shr cx, 008h                              ; c1 e9 08
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
@@ -7233,80 +7491,80 @@ _int16_function:                             ; 0xf5047 LB 0x2e7
     or cx, ax                                 ; 09 c1
     dec byte [bp-004h]                        ; fe 4e fc
     cmp byte [bp-004h], 000h                  ; 80 7e fc 00
-    jnbe short 05207h                         ; 77 cb
+    jnbe short 0548fh                         ; 77 cb
     mov word [bp+00ch], cx                    ; 89 4e 0c
-    jmp near 05328h                           ; e9 e6 00
+    jmp near 055b0h                           ; e9 e6 00
     push strict byte 00001h                   ; 6a 01
     mov cx, ss                                ; 8c d1
     lea bx, [bp-008h]                         ; 8d 5e f8
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 04fb3h                               ; e8 62 fd
+    call 0523bh                               ; e8 62 fd
     test ax, ax                               ; 85 c0
-    jne short 05260h                          ; 75 0b
+    jne short 054e8h                          ; 75 0b
     push 005efh                               ; 68 ef 05
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 c5 c6
+    call 01972h                               ; e8 8d c4
     add sp, strict byte 00004h                ; 83 c4 04
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    je near 0512fh                            ; 0f 84 c7 fe
+    je near 053b7h                            ; 0f 84 c7 fe
     cmp byte [bp-008h], 0f0h                  ; 80 7e f8 f0
-    je near 0512bh                            ; 0f 84 bb fe
-    jmp near 0512fh                           ; e9 bc fe
+    je near 053b3h                            ; 0f 84 bb fe
+    jmp near 053b7h                           ; e9 bc fe
     or word [bp+01ch], 00200h                 ; 81 4e 1c 00 02
     push strict byte 00000h                   ; 6a 00
     mov cx, ss                                ; 8c d1
     lea bx, [bp-008h]                         ; 8d 5e f8
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 04fb3h                               ; e8 2c fd
+    call 0523bh                               ; e8 2c fd
     test ax, ax                               ; 85 c0
-    je near 0515ah                            ; 0f 84 cd fe
+    je near 053e2h                            ; 0f 84 cd fe
     cmp byte [bp-006h], 000h                  ; 80 7e fa 00
-    je near 05177h                            ; 0f 84 e2 fe
+    je near 053ffh                            ; 0f 84 e2 fe
     cmp byte [bp-008h], 0f0h                  ; 80 7e f8 f0
-    je near 05173h                            ; 0f 84 d6 fe
-    jmp near 05177h                           ; e9 d7 fe
+    je near 053fbh                            ; 0f 84 d6 fe
+    jmp near 053ffh                           ; e9 d7 fe
     mov dx, strict word 00017h                ; ba 17 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 57 c3
+    call 01650h                               ; e8 1f c1
     mov dx, word [bp+012h]                    ; 8b 56 12
     mov dl, al                                ; 88 c2
     mov word [bp+012h], dx                    ; 89 56 12
     mov dx, strict word 00018h                ; ba 18 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 46 c3
+    call 01650h                               ; e8 0e c1
     mov bh, al                                ; 88 c7
     and bh, 073h                              ; 80 e7 73
     mov dx, 00096h                            ; ba 96 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 38 c3
+    call 01650h                               ; e8 00 c1
     and AL, strict byte 00ch                  ; 24 0c
     or bh, al                                 ; 08 c7
     mov dx, word [bp+012h]                    ; 8b 56 12
     xor dh, dh                                ; 30 f6
     movzx ax, bh                              ; 0f b6 c7
     sal ax, 008h                              ; c1 e0 08
-    jmp near 0513ah                           ; e9 60 fe
+    jmp near 053c2h                           ; e9 60 fe
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     or ah, 080h                               ; 80 cc 80
-    jmp near 051bah                           ; e9 d5 fe
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 05442h                           ; e9 d5 fe
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 f1 c5
+    call 01931h                               ; e8 b9 c3
     mov ax, word [bp+012h]                    ; 8b 46 12
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 00613h                               ; 68 13 06
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 23 c6
+    call 01972h                               ; e8 eb c3
     add sp, strict byte 00006h                ; 83 c4 06
-    mov bx, 00dbah                            ; bb ba 0d
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 d4 c5
+    call 01931h                               ; e8 9c c3
     mov ax, word [bp+00eh]                    ; 8b 46 0e
     push ax                                   ; 50
     mov ax, word [bp+010h]                    ; 8b 46 10
@@ -7317,13 +7575,13 @@ _int16_function:                             ; 0xf5047 LB 0x2e7
     push ax                                   ; 50
     push 0063bh                               ; 68 3b 06
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 fd c5
+    call 01972h                               ; e8 c5 c3
     add sp, strict byte 0000ch                ; 83 c4 0c
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop di                                    ; 5f
     pop bp                                    ; 5d
     retn                                      ; c3
-set_geom_lba_:                               ; 0xf532e LB 0x9e
+set_geom_lba_:                               ; 0xf55b6 LB 0x9e
     push si                                   ; 56
     push di                                   ; 57
     enter 00004h, 000h                        ; c8 04 00 00
@@ -7335,33 +7593,33 @@ set_geom_lba_:                               ; 0xf532e LB 0x9e
     mov dx, strict word 0007eh                ; ba 7e 00
     mov di, 000ffh                            ; bf ff 00
     xor bx, bx                                ; 31 db
-    jmp short 0534fh                          ; eb 05
+    jmp short 055d7h                          ; eb 05
     cmp bx, strict byte 00004h                ; 83 fb 04
-    jnl short 05365h                          ; 7d 16
+    jnl short 055edh                          ; 7d 16
     cmp dx, word [bp-002h]                    ; 3b 56 fe
-    jnbe short 0535bh                         ; 77 07
-    jne short 0535eh                          ; 75 08
+    jnbe short 055e3h                         ; 77 07
+    jne short 055e6h                          ; 75 08
     cmp ax, word [bp-004h]                    ; 3b 46 fc
-    jc short 0535eh                           ; 72 03
+    jc short 055e6h                           ; 72 03
     inc di                                    ; 47
     shr di, 1                                 ; d1 ef
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
     inc bx                                    ; 43
-    jmp short 0534ah                          ; eb e5
+    jmp short 055d2h                          ; eb e5
     mov ax, di                                ; 89 f8
     xor dx, dx                                ; 31 d2
     mov bx, strict word 0003fh                ; bb 3f 00
     xor cx, cx                                ; 31 c9
-    call 09499h                               ; e8 28 41
+    call 09779h                               ; e8 80 41
     mov bx, ax                                ; 89 c3
     mov cx, dx                                ; 89 d1
     mov ax, word [bp-004h]                    ; 8b 46 fc
     mov dx, word [bp-002h]                    ; 8b 56 fe
-    call 09460h                               ; e8 e2 40
+    call 09740h                               ; e8 3a 41
     mov word [es:si+002h], ax                 ; 26 89 44 02
     cmp ax, 00400h                            ; 3d 00 04
-    jbe short 0538dh                          ; 76 06
+    jbe short 05615h                          ; 76 06
     mov word [es:si+002h], 00400h             ; 26 c7 44 02 00 04
     mov word [es:si], di                      ; 26 89 3c
     mov word [es:si+004h], strict word 0003fh ; 26 c7 44 04 3f 00
@@ -7369,60 +7627,60 @@ set_geom_lba_:                               ; 0xf532e LB 0x9e
     pop di                                    ; 5f
     pop si                                    ; 5e
     retn                                      ; c3
-    push si                                   ; 56
-    push sp                                   ; 54
-    jl short 053f2h                           ; 7c 54
-    test ax, 0a954h                           ; a9 54 a9
-    push sp                                   ; 54
-    test ax, 08154h                           ; a9 54 81
-    push si                                   ; 56
-    scasw                                     ; af
-    push di                                   ; 57
-    scasw                                     ; af
-    push di                                   ; 57
-    call far 0af57h:08c56h                    ; 9a 56 8c 57 af
-    push di                                   ; 57
-    scasw                                     ; af
-    push di                                   ; 57
-    mov [bx-074h], ss                         ; 8c 57 8c
-    push di                                   ; 57
-    scasw                                     ; af
-    push di                                   ; 57
-    scasw                                     ; af
-    push di                                   ; 57
-    adc byte [bx-074h], dl                    ; 10 57 8c
-    push di                                   ; 57
-    scasw                                     ; af
-    push di                                   ; 57
-    scasw                                     ; af
+    ficom word [bp+004h]                      ; de 56 04
     push di                                   ; 57
-    mov [bx+040h], ss                         ; 8c 57 40
+    xor word [bx+031h], dx                    ; 31 57 31
     push di                                   ; 57
-    scasw                                     ; af
-    push di                                   ; 57
-    scasw                                     ; af
-    push di                                   ; 57
-    scasw                                     ; af
-    push di                                   ; 57
-_int13_harddisk:                             ; 0xf53cc LB 0x441
+    xor word [bx+009h], dx                    ; 31 57 09
+    pop cx                                    ; 59
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    and bl, byte [bx+di+014h]                 ; 22 59 14
+    pop dx                                    ; 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    adc AL, strict byte 05ah                  ; 14 5a
+    adc AL, strict byte 05ah                  ; 14 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    cbw                                       ; 98
+    pop cx                                    ; 59
+    adc AL, strict byte 05ah                  ; 14 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    adc AL, strict byte 05ah                  ; 14 5a
+    enter 03759h, 05ah                        ; c8 59 37 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+    aaa                                       ; 37
+    pop dx                                    ; 5a
+_int13_harddisk:                             ; 0xf5654 LB 0x441
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     sub sp, strict byte 00010h                ; 83 ec 10
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 41 c2
+    call 0166ch                               ; e8 09 c0
     mov si, 00122h                            ; be 22 01
     mov word [bp-004h], ax                    ; 89 46 fc
     xor bx, bx                                ; 31 db
     mov dx, 0008eh                            ; ba 8e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 22 c2
+    call 0165eh                               ; e8 ea bf
     mov ax, word [bp+00eh]                    ; 8b 46 0e
     xor ah, ah                                ; 30 e4
     cmp ax, 00080h                            ; 3d 80 00
-    jc short 053fbh                           ; 72 05
+    jc short 05683h                           ; 72 05
     cmp ax, 00090h                            ; 3d 90 00
-    jc short 05419h                           ; 72 1e
+    jc short 056a1h                           ; 72 1e
     mov ax, word [bp+00eh]                    ; 8b 46 0e
     xor ah, ah                                ; 30 e4
     push ax                                   ; 50
@@ -7432,9 +7690,9 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     push 0065eh                               ; 68 5e 06
     push 0066dh                               ; 68 6d 06
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 0f c5
+    call 01972h                               ; e8 d7 c2
     add sp, strict byte 0000ah                ; 83 c4 0a
-    jmp near 057cah                           ; e9 b1 03
+    jmp near 05a52h                           ; e9 b1 03
     mov ax, word [bp+00eh]                    ; 8b 46 0e
     xor ah, ah                                ; 30 e4
     mov es, [bp-004h]                         ; 8e 46 fc
@@ -7443,36 +7701,36 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     mov dl, byte [es:bx+0011fh]               ; 26 8a 97 1f 01
     mov byte [bp-002h], dl                    ; 88 56 fe
     cmp dl, 010h                              ; 80 fa 10
-    jc short 05442h                           ; 72 10
+    jc short 056cah                           ; 72 10
     push ax                                   ; 50
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 0065eh                               ; 68 5e 06
     push 00698h                               ; 68 98 06
-    jmp short 0540eh                          ; eb cc
+    jmp short 05696h                          ; eb cc
     mov bx, word [bp+016h]                    ; 8b 5e 16
     shr bx, 008h                              ; c1 eb 08
     cmp bx, strict byte 00018h                ; 83 fb 18
-    jnbe near 057afh                          ; 0f 87 60 03
+    jnbe near 05a37h                          ; 0f 87 60 03
     add bx, bx                                ; 01 db
-    jmp word [cs:bx+0539ah]                   ; 2e ff a7 9a 53
+    jmp word [cs:bx+05622h]                   ; 2e ff a7 22 56
     cmp byte [bp-002h], 008h                  ; 80 7e fe 08
-    jnc near 05465h                           ; 0f 83 07 00
+    jnc near 056edh                           ; 0f 83 07 00
     movzx ax, byte [bp-002h]                  ; 0f b6 46 fe
-    call 01c21h                               ; e8 bc c7
+    call 01c71h                               ; e8 84 c5
     mov byte [bp+017h], 000h                  ; c6 46 17 00
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 9a c1
+    call 0165eh                               ; e8 62 bf
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 7b c1
+    call 01650h                               ; e8 43 bf
     mov cl, al                                ; 88 c1
     mov dx, word [bp+016h]                    ; 8b 56 16
     xor dh, dh                                ; 30 f6
@@ -7483,10 +7741,10 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 6c c1
+    call 0165eh                               ; e8 34 bf
     test cl, cl                               ; 84 c9
-    je short 05469h                           ; 74 c3
-    jmp near 057e6h                           ; e9 3d 03
+    je short 056f1h                           ; 74 c3
+    jmp near 05a6eh                           ; e9 3d 03
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     mov word [bp-00ch], ax                    ; 89 46 f4
@@ -7506,22 +7764,22 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     mov word [bp-008h], ax                    ; 89 46 f8
     mov ax, word [bp-00ch]                    ; 8b 46 f4
     cmp ax, 00080h                            ; 3d 80 00
-    jnbe short 054e4h                         ; 77 04
+    jnbe short 0576ch                         ; 77 04
     test ax, ax                               ; 85 c0
-    jne short 05507h                          ; 75 23
-    mov bx, 00dbah                            ; bb ba 0d
+    jne short 0578fh                          ; 75 23
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 f2 c3
+    call 01931h                               ; e8 ba c1
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 0065eh                               ; 68 5e 06
     push 006cah                               ; 68 ca 06
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 21 c4
+    call 01972h                               ; e8 e9 c1
     add sp, strict byte 00008h                ; 83 c4 08
-    jmp near 057cah                           ; e9 c3 02
+    jmp near 05a52h                           ; e9 c3 02
     movzx ax, byte [bp-002h]                  ; 0f b6 46 fe
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     mov es, [bp-004h]                         ; 8e 46 fc
@@ -7532,16 +7790,16 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     mov dx, word [es:bx+02ah]                 ; 26 8b 57 2a
     mov word [bp-00ah], dx                    ; 89 56 f6
     cmp di, ax                                ; 39 c7
-    jnc short 05534h                          ; 73 0c
+    jnc short 057bch                          ; 73 0c
     cmp cx, word [bp-008h]                    ; 3b 4e f8
-    jbe short 05534h                          ; 76 07
+    jbe short 057bch                          ; 76 07
     mov ax, word [bp-006h]                    ; 8b 46 fa
     cmp ax, dx                                ; 39 d0
-    jbe short 05562h                          ; 76 2e
-    mov bx, 00dbah                            ; bb ba 0d
+    jbe short 057eah                          ; 76 2e
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 a2 c3
+    call 01931h                               ; e8 6a c1
     push dword [bp-008h]                      ; 66 ff 76 f8
     push di                                   ; 57
     mov ax, word [bp+012h]                    ; 8b 46 12
@@ -7553,36 +7811,36 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     push 0065eh                               ; 68 5e 06
     push 006f2h                               ; 68 f2 06
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 c6 c3
+    call 01972h                               ; e8 8e c1
     add sp, strict byte 00010h                ; 83 c4 10
-    jmp near 057cah                           ; e9 68 02
+    jmp near 05a52h                           ; e9 68 02
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     cmp ax, strict word 00004h                ; 3d 04 00
-    jne short 05570h                          ; 75 03
-    jmp near 05465h                           ; e9 f5 fe
+    jne short 057f8h                          ; 75 03
+    jmp near 056edh                           ; e9 f5 fe
     movzx bx, byte [bp-002h]                  ; 0f b6 5e fe
     imul bx, bx, strict byte 00018h           ; 6b db 18
     mov es, [bp-004h]                         ; 8e 46 fc
     add bx, si                                ; 01 f3
     cmp cx, word [es:bx+02ch]                 ; 26 3b 4f 2c
-    jne short 05591h                          ; 75 0f
+    jne short 05819h                          ; 75 0f
     mov ax, word [es:bx+030h]                 ; 26 8b 47 30
     cmp ax, word [bp-00ah]                    ; 3b 46 f6
-    jne short 05591h                          ; 75 06
+    jne short 05819h                          ; 75 06
     cmp byte [bp-002h], 008h                  ; 80 7e fe 08
-    jc short 055c1h                           ; 72 30
+    jc short 05849h                           ; 72 30
     mov ax, di                                ; 89 f8
     xor dx, dx                                ; 31 d2
     mov bx, cx                                ; 89 cb
     xor cx, cx                                ; 31 c9
-    call 09499h                               ; e8 fd 3e
+    call 09779h                               ; e8 55 3f
     xor bx, bx                                ; 31 db
     add ax, word [bp-008h]                    ; 03 46 f8
     adc dx, bx                                ; 11 da
     mov bx, word [bp-00ah]                    ; 8b 5e f6
     xor cx, cx                                ; 31 c9
-    call 09499h                               ; e8 ee 3e
+    call 09779h                               ; e8 46 3f
     xor bx, bx                                ; 31 db
     add ax, word [bp-006h]                    ; 03 46 fa
     adc dx, bx                                ; 11 da
@@ -7635,11 +7893,11 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     or bx, ax                                 ; 09 c3
     mov word [bp+016h], bx                    ; 89 5e 16
     test dl, dl                               ; 84 d2
-    je near 05465h                            ; 0f 84 13 fe
-    mov bx, 00dbah                            ; bb ba 0d
+    je near 056edh                            ; 0f 84 13 fe
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 84 c2
+    call 01931h                               ; e8 4c c0
     movzx ax, dl                              ; 0f b6 c2
     push ax                                   ; 50
     mov ax, word [bp+016h]                    ; 8b 46 16
@@ -7648,21 +7906,21 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     push 0065eh                               ; 68 5e 06
     push 00739h                               ; 68 39 07
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 af c2
+    call 01972h                               ; e8 77 c0
     add sp, strict byte 0000ah                ; 83 c4 0a
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 00ch                               ; 80 cc 0c
-    jmp near 057d2h                           ; e9 51 01
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 05a5ah                           ; e9 51 01
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 55 c2
+    call 01931h                               ; e8 1d c0
     push 0075ah                               ; 68 5a 07
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 8e c2
+    call 01972h                               ; e8 56 c0
     add sp, strict byte 00004h                ; 83 c4 04
-    jmp near 05465h                           ; e9 cb fd
+    jmp near 056edh                           ; e9 cb fd
     movzx ax, byte [bp-002h]                  ; 0f b6 46 fe
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     mov es, [bp-004h]                         ; 8e 46 fc
@@ -7705,7 +7963,7 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     mov dx, word [bp-00ch]                    ; 8b 56 f4
     or dx, ax                                 ; 09 c2
     mov word [bp+012h], dx                    ; 89 56 12
-    jmp near 05465h                           ; e9 55 fd
+    jmp near 056edh                           ; e9 55 fd
     movzx ax, byte [bp-002h]                  ; 0f b6 46 fe
     cwd                                       ; 99
     db  02bh, 0c2h
@@ -7721,12 +7979,12 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     ; sub ah, ah                                ; 2a e4
     and AL, strict byte 0c0h                  ; 24 c0
     cmp AL, strict byte 040h                  ; 3c 40
-    jne short 05735h                          ; 75 03
-    jmp near 05465h                           ; e9 30 fd
+    jne short 059bdh                          ; 75 03
+    jmp near 056edh                           ; e9 30 fd
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 0aah                               ; 80 cc aa
-    jmp near 057d2h                           ; e9 92 00
+    jmp near 05a5ah                           ; e9 92 00
     movzx ax, byte [bp-002h]                  ; 0f b6 46 fe
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     mov es, [bp-004h]                         ; 8e 46 fc
@@ -7740,10 +7998,10 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     xor dx, dx                                ; 31 d2
     mov bx, word [bp-008h]                    ; 8b 5e f8
     xor cx, cx                                ; 31 c9
-    call 09499h                               ; e8 2f 3d
+    call 09779h                               ; e8 87 3d
     mov bx, word [bp-006h]                    ; 8b 5e fa
     xor cx, cx                                ; 31 c9
-    call 09499h                               ; e8 27 3d
+    call 09779h                               ; e8 7f 3d
     mov word [bp-010h], ax                    ; 89 46 f0
     mov word [bp-00eh], dx                    ; 89 56 f2
     mov word [bp+014h], dx                    ; 89 56 14
@@ -7752,30 +8010,30 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     xor ah, ah                                ; 30 e4
     or ah, 003h                               ; 80 cc 03
     mov word [bp+016h], ax                    ; 89 46 16
-    jmp near 05469h                           ; e9 dd fc
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 056f1h                           ; e9 dd fc
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 4a c1
+    call 01931h                               ; e8 12 bf
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 0065eh                               ; 68 5e 06
     push 00774h                               ; 68 74 07
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 79 c1
+    call 01972h                               ; e8 41 bf
     add sp, strict byte 00008h                ; 83 c4 08
-    jmp near 05465h                           ; e9 b6 fc
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 056edh                           ; e9 b6 fc
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 27 c1
+    call 01931h                               ; e8 ef be
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 0065eh                               ; 68 5e 06
     push 007a7h                               ; 68 a7 07
-    jmp near 054fch                           ; e9 32 fd
+    jmp near 05784h                           ; e9 32 fd
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 001h                               ; 80 cc 01
@@ -7785,47 +8043,58 @@ _int13_harddisk:                             ; 0xf53cc LB 0x441
     xor bh, bh                                ; 30 ff
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 28 be
+    call 0165eh                               ; e8 f0 bb
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
-    jmp near 05478h                           ; e9 8b fc
-    test AL, strict byte 058h                 ; a8 58
-    rcr byte [bx+si-040h], 058h               ; c0 58 c0 58
-    rcr byte [bx+si+06fh], 05ch               ; c0 58 6f 5c
-    add bx, word [bp+si-040h]                 ; 03 5a c0
-    pop ax                                    ; 58
-    or word [bp+si+06fh], bx                  ; 09 5a 6f
-    pop sp                                    ; 5c
-    mov si, 0be5ch                            ; be 5c be
-    pop sp                                    ; 5c
-    mov si, 0be5ch                            ; be 5c be
-    pop sp                                    ; 5c
-    xchg byte [si-042h], bl                   ; 86 5c be
+    jmp near 05700h                           ; e9 8b fc
+    xor byte [bp+di+048h], bl                 ; 30 5b 48
+    pop bx                                    ; 5b
+    dec ax                                    ; 48
+    pop bx                                    ; 5b
+    dec ax                                    ; 48
+    pop bx                                    ; 5b
+    neg word [bp-075h]                        ; f7 5e 8b
     pop sp                                    ; 5c
-    db  0beh
+    dec ax                                    ; 48
+    pop bx                                    ; 5b
+    xchg cx, ax                               ; 91
     pop sp                                    ; 5c
-_int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
+    neg word [bp+046h]                        ; f7 5e 46
+    pop di                                    ; 5f
+    inc si                                    ; 46
+    pop di                                    ; 5f
+    inc si                                    ; 46
+    pop di                                    ; 5f
+    inc si                                    ; 46
+    pop di                                    ; 5f
+    push CS                                   ; 0e
+    pop di                                    ; 5f
+    inc si                                    ; 46
+    pop di                                    ; 5f
+    inc si                                    ; 46
+    pop di                                    ; 5f
+_int13_harddisk_ext:                         ; 0xf5a95 LB 0x4cc
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     sub sp, strict byte 00028h                ; 83 ec 28
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 00 be
+    call 0166ch                               ; e8 c8 bb
     mov word [bp-014h], ax                    ; 89 46 ec
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 f4 bd
+    call 0166ch                               ; e8 bc bb
     mov si, 00122h                            ; be 22 01
     mov word [bp-026h], ax                    ; 89 46 da
     xor bx, bx                                ; 31 db
     mov dx, 0008eh                            ; ba 8e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 d5 bd
+    call 0165eh                               ; e8 9d bb
     mov ax, word [bp+00eh]                    ; 8b 46 0e
     xor ah, ah                                ; 30 e4
     cmp ax, 00080h                            ; 3d 80 00
-    jc short 05848h                           ; 72 05
+    jc short 05ad0h                           ; 72 05
     cmp ax, 00090h                            ; 3d 90 00
-    jc short 05866h                           ; 72 1e
+    jc short 05aeeh                           ; 72 1e
     mov ax, word [bp+00eh]                    ; 8b 46 0e
     xor ah, ah                                ; 30 e4
     push ax                                   ; 50
@@ -7835,9 +8104,9 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     push 007d5h                               ; 68 d5 07
     push 0066dh                               ; 68 6d 06
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 c2 c0
+    call 01972h                               ; e8 8a be
     add sp, strict byte 0000ah                ; 83 c4 0a
-    jmp near 05c9ch                           ; e9 36 04
+    jmp near 05f24h                           ; e9 36 04
     mov ax, word [bp+00eh]                    ; 8b 46 0e
     xor ah, ah                                ; 30 e4
     mov es, [bp-026h]                         ; 8e 46 da
@@ -7845,30 +8114,30 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     add bx, ax                                ; 01 c3
     mov cl, byte [es:bx+0011fh]               ; 26 8a 8f 1f 01
     cmp cl, 010h                              ; 80 f9 10
-    jc short 0588ch                           ; 72 10
+    jc short 05b14h                           ; 72 10
     push ax                                   ; 50
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 007d5h                               ; 68 d5 07
     push 00698h                               ; 68 98 06
-    jmp short 0585bh                          ; eb cf
+    jmp short 05ae3h                          ; eb cf
     mov bx, word [bp+016h]                    ; 8b 5e 16
     shr bx, 008h                              ; c1 eb 08
     sub bx, strict byte 00041h                ; 83 eb 41
     cmp bx, strict byte 0000fh                ; 83 fb 0f
-    jnbe near 05cbeh                          ; 0f 87 22 04
+    jnbe near 05f46h                          ; 0f 87 22 04
     add bx, bx                                ; 01 db
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
-    jmp word [cs:bx+057edh]                   ; 2e ff a7 ed 57
+    jmp word [cs:bx+05a75h]                   ; 2e ff a7 75 5a
     mov word [bp+010h], 0aa55h                ; c7 46 10 55 aa
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 030h                               ; 80 cc 30
     mov word [bp+016h], ax                    ; 89 46 16
     mov word [bp+014h], strict word 00007h    ; c7 46 14 07 00
-    jmp near 05c73h                           ; e9 b3 03
+    jmp near 05efbh                           ; e9 b3 03
     mov bx, word [bp+00ah]                    ; 8b 5e 0a
     mov es, [bp+004h]                         ; 8e 46 04
     mov di, bx                                ; 89 df
@@ -7883,14 +8152,14 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     mov word [bp-00ah], ax                    ; 89 46 f6
     mov ax, word [es:bx+00eh]                 ; 26 8b 47 0e
     or ax, word [bp-00ah]                     ; 0b 46 f6
-    je short 05901h                           ; 74 11
+    je short 05b89h                           ; 74 11
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 007d5h                               ; 68 d5 07
     push 007e8h                               ; 68 e8 07
     push strict byte 00007h                   ; 6a 07
-    jmp short 0594bh                          ; eb 4a
+    jmp short 05bd3h                          ; eb 4a
     mov es, [bp-010h]                         ; 8e 46 f0
     mov ax, word [es:di+008h]                 ; 26 8b 45 08
     mov word [bp-00ah], ax                    ; 89 46 f6
@@ -7902,31 +8171,31 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     add bx, dx                                ; 01 d3
     mov ch, byte [es:bx+01eh]                 ; 26 8a 6f 1e
     cmp ax, word [es:bx+034h]                 ; 26 3b 47 34
-    jnbe short 05931h                         ; 77 0b
-    jne short 05954h                          ; 75 2c
+    jnbe short 05bb9h                         ; 77 0b
+    jne short 05bdch                          ; 75 2c
     mov dx, word [bp-00ah]                    ; 8b 56 f6
     cmp dx, word [es:bx+032h]                 ; 26 3b 57 32
-    jc short 05954h                           ; 72 23
-    mov bx, 00dbah                            ; bb ba 0d
+    jc short 05bdch                           ; 72 23
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 a5 bf
+    call 01931h                               ; e8 6d bd
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 007d5h                               ; 68 d5 07
     push 00811h                               ; 68 11 08
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 d4 bf
+    call 01972h                               ; e8 9c bd
     add sp, strict byte 00008h                ; 83 c4 08
-    jmp near 05c9ch                           ; e9 48 03
+    jmp near 05f24h                           ; e9 48 03
     mov dx, word [bp+016h]                    ; 8b 56 16
     shr dx, 008h                              ; c1 ea 08
     mov word [bp-00ch], dx                    ; 89 56 f4
     cmp dx, strict byte 00044h                ; 83 fa 44
-    je near 05c6fh                            ; 0f 84 0b 03
+    je near 05ef7h                            ; 0f 84 0b 03
     cmp dx, strict byte 00047h                ; 83 fa 47
-    je near 05c6fh                            ; 0f 84 04 03
+    je near 05ef7h                            ; 0f 84 04 03
     mov es, [bp-026h]                         ; 8e 46 da
     db  066h, 026h, 0c7h, 044h, 014h, 000h, 000h, 000h, 000h
     ; mov dword [es:si+014h], strict dword 000000000h ; 66 26 c7 44 14 00 00 00 00
@@ -7958,25 +8227,25 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     mov es, [bp-010h]                         ; 8e 46 f0
     mov word [es:di+002h], ax                 ; 26 89 45 02
     test dl, dl                               ; 84 d2
-    je near 05c6fh                            ; 0f 84 97 02
-    mov bx, 00dbah                            ; bb ba 0d
+    je near 05ef7h                            ; 0f 84 97 02
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 fe be
+    call 01931h                               ; e8 c6 bc
     movzx ax, dl                              ; 0f b6 c2
     push ax                                   ; 50
     push word [bp-00ch]                       ; ff 76 f4
     push 007d5h                               ; 68 d5 07
     push 00739h                               ; 68 39 07
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 2d bf
+    call 01972h                               ; e8 f5 bc
     add sp, strict byte 0000ah                ; 83 c4 0a
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 00ch                               ; 80 cc 0c
-    jmp near 05ca4h                           ; e9 a1 02
+    jmp near 05f2ch                           ; e9 a1 02
     or ah, 0b2h                               ; 80 cc b2
-    jmp near 05ca4h                           ; e9 9b 02
+    jmp near 05f2ch                           ; e9 9b 02
     mov bx, word [bp+00ah]                    ; 8b 5e 0a
     mov ax, word [bp+004h]                    ; 8b 46 04
     mov word [bp-006h], ax                    ; 89 46 fa
@@ -7986,8 +8255,8 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     mov ax, word [es:di]                      ; 26 8b 05
     mov word [bp-00eh], ax                    ; 89 46 f2
     cmp ax, strict word 0001ah                ; 3d 1a 00
-    jc near 05c9ch                            ; 0f 82 76 02
-    jc near 05aadh                            ; 0f 82 83 00
+    jc near 05f24h                            ; 0f 82 76 02
+    jc near 05d35h                            ; 0f 82 83 00
     movzx ax, cl                              ; 0f b6 c1
     imul ax, ax, strict byte 00018h           ; 6b c0 18
     mov es, [bp-026h]                         ; 8e 46 da
@@ -8025,7 +8294,7 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     db  066h, 026h, 0c7h, 045h, 014h, 000h, 000h, 000h, 000h
     ; mov dword [es:di+014h], strict dword 000000000h ; 66 26 c7 45 14 00 00 00 00
     cmp word [bp-00eh], strict byte 0001eh    ; 83 7e f2 1e
-    jc near 05bb9h                            ; 0f 82 04 01
+    jc near 05e41h                            ; 0f 82 04 01
     mov es, [bp-004h]                         ; 8e 46 fc
     mov word [es:bx], strict word 0001eh      ; 26 c7 07 1e 00
     mov ax, word [bp-014h]                    ; 8b 46 ec
@@ -8051,9 +8320,9 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     mov ah, byte [es:di+022h]                 ; 26 8a 65 22
     mov al, byte [es:di+023h]                 ; 26 8a 45 23
     test al, al                               ; 84 c0
-    jne short 05b0bh                          ; 75 04
+    jne short 05d93h                          ; 75 04
     xor dx, dx                                ; 31 d2
-    jmp short 05b0eh                          ; eb 03
+    jmp short 05d96h                          ; eb 03
     mov dx, strict word 00008h                ; ba 08 00
     or dl, 010h                               ; 80 ca 10
     mov word [bp-008h], dx                    ; 89 56 f8
@@ -8068,9 +8337,9 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     movzx dx, ah                              ; 0f b6 d4
     or word [bp-008h], dx                     ; 09 56 f8
     cmp AL, strict byte 003h                  ; 3c 03
-    jne short 05b34h                          ; 75 05
+    jne short 05dbch                          ; 75 05
     mov ax, strict word 00003h                ; b8 03 00
-    jmp short 05b36h                          ; eb 02
+    jmp short 05dbeh                          ; eb 02
     xor ax, ax                                ; 31 c0
     or word [bp-008h], ax                     ; 09 46 f8
     mov ax, word [bp-01ah]                    ; 8b 46 e6
@@ -8095,21 +8364,21 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     mov byte [es:si+001feh], 011h             ; 26 c6 84 fe 01 11
     xor ch, ch                                ; 30 ed
     mov byte [bp-002h], ch                    ; 88 6e fe
-    jmp short 05b9ah                          ; eb 06
+    jmp short 05e22h                          ; eb 06
     cmp byte [bp-002h], 00fh                  ; 80 7e fe 0f
-    jnc short 05bafh                          ; 73 15
+    jnc short 05e37h                          ; 73 15
     movzx dx, byte [bp-002h]                  ; 0f b6 56 fe
     add dx, 00312h                            ; 81 c2 12 03
     mov ax, word [bp-014h]                    ; 8b 46 ec
-    call 01600h                               ; e8 58 ba
+    call 01650h                               ; e8 20 b8
     add ch, al                                ; 00 c5
     inc byte [bp-002h]                        ; fe 46 fe
-    jmp short 05b94h                          ; eb e5
+    jmp short 05e1ch                          ; eb e5
     neg ch                                    ; f6 dd
     mov es, [bp-026h]                         ; 8e 46 da
     mov byte [es:si+001ffh], ch               ; 26 88 ac ff 01
     cmp word [bp-00eh], strict byte 00042h    ; 83 7e f2 42
-    jc near 05c6fh                            ; 0f 82 ae 00
+    jc near 05ef7h                            ; 0f 82 ae 00
     movzx ax, cl                              ; 0f b6 c1
     cwd                                       ; 99
     db  02bh, 0c2h
@@ -8127,7 +8396,7 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     ; mov dword [es:bx+01eh], strict dword 00024beddh ; 66 26 c7 47 1e dd be 24 00
     mov word [es:bx+022h], strict word 00000h ; 26 c7 47 22 00 00
     test al, al                               ; 84 c0
-    jne short 05c01h                          ; 75 09
+    jne short 05e89h                          ; 75 09
     db  066h, 026h, 0c7h, 047h, 024h, 049h, 053h, 041h, 020h
     ; mov dword [es:bx+024h], strict dword 020415349h ; 66 26 c7 47 24 49 53 41 20
     mov es, [bp-004h]                         ; 8e 46 fc
@@ -8136,7 +8405,7 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     db  066h, 026h, 0c7h, 047h, 02ch, 020h, 020h, 020h, 020h
     ; mov dword [es:bx+02ch], strict dword 020202020h ; 66 26 c7 47 2c 20 20 20 20
     test al, al                               ; 84 c0
-    jne short 05c2dh                          ; 75 13
+    jne short 05eb5h                          ; 75 13
     mov word [es:bx+030h], dx                 ; 26 89 57 30
     db  066h, 026h, 0c7h, 047h, 032h, 000h, 000h, 000h, 000h
     ; mov dword [es:bx+032h], strict dword 000000000h ; 66 26 c7 47 32 00 00 00 00
@@ -8151,17 +8420,17 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     mov word [es:bx+03eh], strict word 00000h ; 26 c7 47 3e 00 00
     xor cl, cl                                ; 30 c9
     mov CH, strict byte 01eh                  ; b5 1e
-    jmp short 05c54h                          ; eb 05
+    jmp short 05edch                          ; eb 05
     cmp ch, 040h                              ; 80 fd 40
-    jnc short 05c66h                          ; 73 12
+    jnc short 05eeeh                          ; 73 12
     movzx dx, ch                              ; 0f b6 d5
     add dx, word [bp+00ah]                    ; 03 56 0a
     mov ax, word [bp+004h]                    ; 8b 46 04
-    call 01600h                               ; e8 a0 b9
+    call 01650h                               ; e8 68 b7
     add cl, al                                ; 00 c1
     db  0feh, 0c5h
     ; inc ch                                    ; fe c5
-    jmp short 05c4fh                          ; eb e9
+    jmp short 05ed7h                          ; eb e9
     neg cl                                    ; f6 d9
     mov es, [bp-004h]                         ; 8e 46 fc
     mov byte [es:bx+041h], cl                 ; 26 88 4f 41
@@ -8169,20 +8438,20 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     xor bx, bx                                ; 31 db
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 90 b9
+    call 0165eh                               ; e8 58 b7
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
     cmp ax, strict word 00006h                ; 3d 06 00
-    je short 05c6fh                           ; 74 e4
+    je short 05ef7h                           ; 74 e4
     cmp ax, strict word 00001h                ; 3d 01 00
-    jc short 05c9ch                           ; 72 0c
-    jbe short 05c6fh                          ; 76 dd
+    jc short 05f24h                           ; 72 0c
+    jbe short 05ef7h                          ; 76 dd
     cmp ax, strict word 00003h                ; 3d 03 00
-    jc short 05c9ch                           ; 72 05
+    jc short 05f24h                           ; 72 05
     cmp ax, strict word 00004h                ; 3d 04 00
-    jbe short 05c6fh                          ; 76 d3
+    jbe short 05ef7h                          ; 76 d3
     mov ax, word [bp+016h]                    ; 8b 46 16
     xor ah, ah                                ; 30 e4
     or ah, 001h                               ; 80 cc 01
@@ -8192,20 +8461,20 @@ _int13_harddisk_ext:                         ; 0xf580d LB 0x4cc
     xor bh, bh                                ; 30 ff
     mov dx, strict word 00074h                ; ba 74 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 56 b9
+    call 0165eh                               ; e8 1e b7
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
-    jmp short 05c82h                          ; eb c4
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp short 05f0ah                          ; eb c4
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 18 bc
+    call 01931h                               ; e8 e0 b9
     mov ax, word [bp+016h]                    ; 8b 46 16
     shr ax, 008h                              ; c1 e8 08
     push ax                                   ; 50
     push 007d5h                               ; 68 d5 07
     push 007a7h                               ; 68 a7 07
-    jmp near 05949h                           ; e9 70 fc
-_int14_function:                             ; 0xf5cd9 LB 0x155
+    jmp near 05bd1h                           ; e9 70 fc
+_int14_function:                             ; 0xf5f61 LB 0x155
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -8213,29 +8482,29 @@ _int14_function:                             ; 0xf5cd9 LB 0x155
     mov dx, word [bp+00eh]                    ; 8b 56 0e
     add dx, dx                                ; 01 d2
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 33 b9
+    call 0166ch                               ; e8 fb b6
     mov si, ax                                ; 89 c6
     mov bx, ax                                ; 89 c3
     mov dx, word [bp+00eh]                    ; 8b 56 0e
     add dx, strict byte 0007ch                ; 83 c2 7c
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 07 b9
+    call 01650h                               ; e8 cf b6
     mov cl, al                                ; 88 c1
     cmp word [bp+00eh], strict byte 00004h    ; 83 7e 0e 04
-    jnc near 05e24h                           ; 0f 83 21 01
+    jnc near 060ach                           ; 0f 83 21 01
     test si, si                               ; 85 f6
-    jbe near 05e24h                           ; 0f 86 1b 01
+    jbe near 060ach                           ; 0f 86 1b 01
     mov al, byte [bp+013h]                    ; 8a 46 13
     cmp AL, strict byte 001h                  ; 3c 01
-    jc short 05d21h                           ; 72 11
-    jbe short 05d75h                          ; 76 63
+    jc short 05fa9h                           ; 72 11
+    jbe short 05ffdh                          ; 76 63
     cmp AL, strict byte 003h                  ; 3c 03
-    je near 05e0dh                            ; 0f 84 f5 00
+    je near 06095h                            ; 0f 84 f5 00
     cmp AL, strict byte 002h                  ; 3c 02
-    je near 05dc3h                            ; 0f 84 a5 00
-    jmp near 05e1eh                           ; e9 fd 00
+    je near 0604bh                            ; 0f 84 a5 00
+    jmp near 060a6h                           ; e9 fd 00
     test al, al                               ; 84 c0
-    jne near 05e1eh                           ; 0f 85 f7 00
+    jne near 060a6h                           ; 0f 85 f7 00
     lea dx, [bx+003h]                         ; 8d 57 03
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -8267,17 +8536,17 @@ _int14_function:                             ; 0xf5cd9 LB 0x155
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov byte [bp+012h], al                    ; 88 46 12
-    jmp near 05dffh                           ; e9 97 00
+    jmp near 06087h                           ; e9 97 00
     mov AL, strict byte 017h                  ; b0 17
     mov dx, bx                                ; 89 da
     out DX, AL                                ; ee
     lea dx, [bx+001h]                         ; 8d 57 01
     mov AL, strict byte 004h                  ; b0 04
     out DX, AL                                ; ee
-    jmp short 05d4ah                          ; eb d5
+    jmp short 05fd2h                          ; eb d5
     mov dx, strict word 0006ch                ; ba 6c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 9e b8
+    call 0166ch                               ; e8 66 b6
     mov si, ax                                ; 89 c6
     lea dx, [bx+005h]                         ; 8d 57 05
     in AL, DX                                 ; ec
@@ -8285,20 +8554,20 @@ _int14_function:                             ; 0xf5cd9 LB 0x155
     ; sub ah, ah                                ; 2a e4
     and ax, strict word 00060h                ; 25 60 00
     cmp ax, strict word 00060h                ; 3d 60 00
-    je short 05da5h                           ; 74 17
+    je short 0602dh                           ; 74 17
     test cl, cl                               ; 84 c9
-    je short 05da5h                           ; 74 13
+    je short 0602dh                           ; 74 13
     mov dx, strict word 0006ch                ; ba 6c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 81 b8
+    call 0166ch                               ; e8 49 b6
     cmp ax, si                                ; 39 f0
-    je short 05d80h                           ; 74 e1
+    je short 06008h                           ; 74 e1
     mov si, ax                                ; 89 c6
     db  0feh, 0c9h
     ; dec cl                                    ; fe c9
-    jmp short 05d80h                          ; eb db
+    jmp short 06008h                          ; eb db
     test cl, cl                               ; 84 c9
-    je short 05dafh                           ; 74 06
+    je short 06037h                           ; 74 06
     mov al, byte [bp+012h]                    ; 8a 46 12
     mov dx, bx                                ; 89 da
     out DX, AL                                ; ee
@@ -8308,33 +8577,33 @@ _int14_function:                             ; 0xf5cd9 LB 0x155
     ; sub ah, ah                                ; 2a e4
     mov byte [bp+013h], al                    ; 88 46 13
     test cl, cl                               ; 84 c9
-    jne short 05dffh                          ; 75 43
+    jne short 06087h                          ; 75 43
     or AL, strict byte 080h                   ; 0c 80
     mov byte [bp+013h], al                    ; 88 46 13
-    jmp short 05dffh                          ; eb 3c
+    jmp short 06087h                          ; eb 3c
     mov dx, strict word 0006ch                ; ba 6c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 50 b8
+    call 0166ch                               ; e8 18 b6
     mov si, ax                                ; 89 c6
     lea dx, [bx+005h]                         ; 8d 57 05
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 05defh                          ; 75 17
+    jne short 06077h                          ; 75 17
     test cl, cl                               ; 84 c9
-    je short 05defh                           ; 74 13
+    je short 06077h                           ; 74 13
     mov dx, strict word 0006ch                ; ba 6c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 37 b8
+    call 0166ch                               ; e8 ff b5
     cmp ax, si                                ; 39 f0
-    je short 05dceh                           ; 74 e5
+    je short 06056h                           ; 74 e5
     mov si, ax                                ; 89 c6
     db  0feh, 0c9h
     ; dec cl                                    ; fe c9
-    jmp short 05dceh                          ; eb df
+    jmp short 06056h                          ; eb df
     test cl, cl                               ; 84 c9
-    je short 05e05h                           ; 74 12
+    je short 0608dh                           ; 74 12
     mov byte [bp+013h], 000h                  ; c6 46 13 00
     mov dx, bx                                ; 89 da
     in AL, DX                                 ; ec
@@ -8342,12 +8611,12 @@ _int14_function:                             ; 0xf5cd9 LB 0x155
     ; sub ah, ah                                ; 2a e4
     mov byte [bp+012h], al                    ; 88 46 12
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
-    jmp short 05e28h                          ; eb 23
+    jmp short 060b0h                          ; eb 23
     lea dx, [bx+005h]                         ; 8d 57 05
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
-    jmp short 05dbeh                          ; eb b1
+    jmp short 06046h                          ; eb b1
     lea dx, [si+005h]                         ; 8d 54 05
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -8357,15 +8626,15 @@ _int14_function:                             ; 0xf5cd9 LB 0x155
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
-    jmp short 05dfch                          ; eb de
+    jmp short 06084h                          ; eb de
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
-    jmp short 05e28h                          ; eb 04
+    jmp short 060b0h                          ; eb 04
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-set_enable_a20_:                             ; 0xf5e2e LB 0x2c
+set_enable_a20_:                             ; 0xf60b6 LB 0x2c
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -8378,10 +8647,10 @@ set_enable_a20_:                             ; 0xf5e2e LB 0x2c
     ; sub ah, ah                                ; 2a e4
     mov cl, al                                ; 88 c1
     test bx, bx                               ; 85 db
-    je short 05e47h                           ; 74 05
+    je short 060cfh                           ; 74 05
     or AL, strict byte 002h                   ; 0c 02
     out DX, AL                                ; ee
-    jmp short 05e4ah                          ; eb 03
+    jmp short 060d2h                          ; eb 03
     and AL, strict byte 0fdh                  ; 24 fd
     out DX, AL                                ; ee
     test cl, 002h                             ; f6 c1 02
@@ -8394,7 +8663,7 @@ set_enable_a20_:                             ; 0xf5e2e LB 0x2c
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-set_e820_range_:                             ; 0xf5e5a LB 0x8c
+set_e820_range_:                             ; 0xf60e2 LB 0x8c
     push si                                   ; 56
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -8423,10 +8692,10 @@ set_e820_range_:                             ; 0xf5e5a LB 0x8c
     pop si                                    ; 5e
     retn 0000ah                               ; c2 0a 00
     db  0ech, 0e9h, 0d8h, 0c1h, 0c0h, 0bfh, 091h, 090h, 089h, 088h, 087h, 083h, 052h, 04fh, 041h, 024h
-    db  000h, 085h, 063h, 025h, 05fh, 038h, 05fh, 0cdh, 05fh, 0d3h, 05fh, 0d8h, 05fh, 0ddh, 05fh, 07fh
-    db  060h, 01ch, 062h, 042h, 062h, 0c6h, 05fh, 0c6h, 05fh, 00fh, 063h, 037h, 063h, 04ah, 063h, 059h
-    db  063h, 0cdh, 05fh, 060h, 063h
-_int15_function:                             ; 0xf5ee6 LB 0x4cd
+    db  000h, 00dh, 066h, 0adh, 061h, 0c0h, 061h, 055h, 062h, 05bh, 062h, 060h, 062h, 065h, 062h, 007h
+    db  063h, 0a4h, 064h, 0cah, 064h, 04eh, 062h, 04eh, 062h, 097h, 065h, 0bfh, 065h, 0d2h, 065h, 0e1h
+    db  065h, 055h, 062h, 0e8h, 065h
+_int15_function:                             ; 0xf616e LB 0x4cd
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -8436,15 +8705,15 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     mov ax, word [bp+012h]                    ; 8b 46 12
     shr ax, 008h                              ; c1 e8 08
     cmp ax, 000ech                            ; 3d ec 00
-    jnbe near 06385h                          ; 0f 87 8b 04
+    jnbe near 0660dh                          ; 0f 87 8b 04
     push CS                                   ; 0e
     pop ES                                    ; 07
     mov cx, strict word 00012h                ; b9 12 00
-    mov di, 05eb1h                            ; bf b1 5e
+    mov di, 06139h                            ; bf 39 61
     repne scasb                               ; f2 ae
     sal cx, 1                                 ; d1 e1
     mov di, cx                                ; 89 cf
-    mov si, word [cs:di+05ec2h]               ; 2e 8b b5 c2 5e
+    mov si, word [cs:di+0614ah]               ; 2e 8b b5 4a 61
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     mov cx, word [bp+018h]                    ; 8b 4e 18
@@ -8457,30 +8726,30 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     cmp ax, 000c0h                            ; 3d c0 00
-    jne near 06385h                           ; 0f 85 54 04
+    jne near 0660dh                           ; 0f 85 54 04
     or byte [bp+018h], 001h                   ; 80 4e 18 01
-    jmp near 0632eh                           ; e9 f6 03
+    jmp near 065b6h                           ; e9 f6 03
     mov dx, ax                                ; 89 c2
     cmp ax, strict word 00001h                ; 3d 01 00
-    jc short 05f4dh                           ; 72 0e
-    jbe short 05f61h                          ; 76 20
+    jc short 061d5h                           ; 72 0e
+    jbe short 061e9h                          ; 76 20
     cmp ax, strict word 00003h                ; 3d 03 00
-    je short 05f8eh                           ; 74 48
+    je short 06216h                           ; 74 48
     cmp ax, strict word 00002h                ; 3d 02 00
-    je short 05f71h                           ; 74 26
-    jmp short 05f9bh                          ; eb 4e
+    je short 061f9h                           ; 74 26
+    jmp short 06223h                          ; eb 4e
     test ax, ax                               ; 85 c0
-    jne short 05f9bh                          ; 75 4a
+    jne short 06223h                          ; 75 4a
     xor ax, ax                                ; 31 c0
-    call 05e2eh                               ; e8 d8 fe
+    call 060b6h                               ; e8 d8 fe
     and byte [bp+018h], 0feh                  ; 80 66 18 fe
     mov byte [bp+013h], 000h                  ; c6 46 13 00
-    jmp near 05fc6h                           ; e9 65 00
+    jmp near 0624eh                           ; e9 65 00
     mov ax, strict word 00001h                ; b8 01 00
-    call 05e2eh                               ; e8 c7 fe
+    call 060b6h                               ; e8 c7 fe
     and byte [bp+018h], 0feh                  ; 80 66 18 fe
     mov byte [bp+013h], dh                    ; 88 76 13
-    jmp near 05fc6h                           ; e9 55 00
+    jmp near 0624eh                           ; e9 55 00
     mov dx, 00092h                            ; ba 92 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -8492,21 +8761,21 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     mov word [bp+012h], dx                    ; 89 56 12
     and byte [bp+018h], 0feh                  ; 80 66 18 fe
     mov byte [bp+013h], ah                    ; 88 66 13
-    jmp near 05fc6h                           ; e9 38 00
+    jmp near 0624eh                           ; e9 38 00
     and byte [bp+018h], 0feh                  ; 80 66 18 fe
     mov byte [bp+013h], ah                    ; 88 66 13
     mov word [bp+00ch], ax                    ; 89 46 0c
-    jmp near 05fc6h                           ; e9 2b 00
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 0624eh                           ; e9 2b 00
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 3b b9
+    call 01931h                               ; e8 03 b7
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     push ax                                   ; 50
     push 00836h                               ; 68 36 08
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 6e b9
+    call 01972h                               ; e8 36 b7
     add sp, strict byte 00006h                ; 83 c4 06
     or byte [bp+018h], 001h                   ; 80 4e 18 01
     mov ax, word [bp+012h]                    ; 8b 46 12
@@ -8519,38 +8788,38 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     pop bp                                    ; 5d
     retn                                      ; c3
     mov word [bp+018h], bx                    ; 89 5e 18
-    jmp near 06079h                           ; e9 a6 00
+    jmp near 06301h                           ; e9 a6 00
     mov word [bp+018h], bx                    ; 89 5e 18
-    jmp short 05fc6h                          ; eb ee
+    jmp short 0624eh                          ; eb ee
     mov word [bp+018h], cx                    ; 89 4e 18
-    jmp short 05fc3h                          ; eb e6
+    jmp short 0624bh                          ; eb e6
     test byte [bp+012h], 0ffh                 ; f6 46 12 ff
-    je short 0604fh                           ; 74 6c
+    je short 062d7h                           ; 74 6c
     mov dx, 000a0h                            ; ba a0 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 14 b6
+    call 01650h                               ; e8 dc b3
     test AL, strict byte 001h                 ; a8 01
-    jne near 06325h                           ; 0f 85 33 03
+    jne near 065adh                           ; 0f 85 33 03
     mov bx, strict word 00001h                ; bb 01 00
     mov dx, 000a0h                            ; ba a0 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 10 b6
+    call 0165eh                               ; e8 d8 b3
     mov bx, word [bp+014h]                    ; 8b 5e 14
     mov dx, 00098h                            ; ba 98 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0162ah                               ; e8 20 b6
+    call 0167ah                               ; e8 e8 b3
     mov bx, word [bp+00ch]                    ; 8b 5e 0c
     mov dx, 0009ah                            ; ba 9a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0162ah                               ; e8 14 b6
+    call 0167ah                               ; e8 dc b3
     mov bx, word [bp+00eh]                    ; 8b 5e 0e
     mov dx, 0009ch                            ; ba 9c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0162ah                               ; e8 08 b6
+    call 0167ah                               ; e8 d0 b3
     mov bx, word [bp+010h]                    ; 8b 5e 10
     mov dx, 0009eh                            ; ba 9e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0162ah                               ; e8 fc b5
+    call 0167ah                               ; e8 c4 b3
     and byte [bp+018h], 0feh                  ; 80 66 18 fe
     mov dx, 000a1h                            ; ba a1 00
     in AL, DX                                 ; ec
@@ -8559,23 +8828,23 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     and AL, strict byte 0feh                  ; 24 fe
     out DX, AL                                ; ee
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 0165ch                               ; e8 1b b6
+    call 016ach                               ; e8 e3 b3
     or AL, strict byte 040h                   ; 0c 40
     movzx dx, al                              ; 0f b6 d0
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 01679h                               ; e8 2d b6
-    jmp near 05fc6h                           ; e9 77 ff
+    call 016c9h                               ; e8 f5 b3
+    jmp near 0624eh                           ; e9 77 ff
     cmp ax, strict word 00001h                ; 3d 01 00
-    jne short 0606dh                          ; 75 19
+    jne short 062f5h                          ; 75 19
     xor bx, bx                                ; 31 db
     mov dx, 000a0h                            ; ba a0 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 af b5
+    call 0165eh                               ; e8 77 b3
     and byte [bp+018h], 0feh                  ; 80 66 18 fe
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 0165ch                               ; e8 f3 b5
+    call 016ach                               ; e8 bb b3
     and AL, strict byte 0bfh                  ; 24 bf
-    jmp short 06043h                          ; eb d6
+    jmp short 062cbh                          ; eb d6
     mov word [bp+018h], bx                    ; 89 5e 18
     mov ax, dx                                ; 89 d0
     xor ah, dh                                ; 30 f4
@@ -8583,10 +8852,10 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     dec ax                                    ; 48
     or dx, ax                                 ; 09 c2
     mov word [bp+012h], dx                    ; 89 56 12
-    jmp near 05fc6h                           ; e9 47 ff
+    jmp near 0624eh                           ; e9 47 ff
     cli                                       ; fa
     mov ax, strict word 00001h                ; b8 01 00
-    call 05e2eh                               ; e8 a8 fd
+    call 060b6h                               ; e8 a8 fd
     mov di, ax                                ; 89 c7
     mov ax, word [bp+014h]                    ; 8b 46 14
     sal ax, 004h                              ; c1 e0 04
@@ -8596,7 +8865,7 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     shr dx, 00ch                              ; c1 ea 0c
     mov byte [bp-006h], dl                    ; 88 56 fa
     cmp cx, ax                                ; 39 c1
-    jnc short 060a5h                          ; 73 05
+    jnc short 0632dh                          ; 73 05
     db  0feh, 0c2h
     ; inc dl                                    ; fe c2
     mov byte [bp-006h], dl                    ; 88 56 fa
@@ -8604,52 +8873,52 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     add dx, strict byte 00008h                ; 83 c2 08
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, strict word 0002fh                ; bb 2f 00
-    call 0162ah                               ; e8 76 b5
+    call 0167ah                               ; e8 3e b3
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0000ah                ; 83 c2 0a
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, cx                                ; 89 cb
-    call 0162ah                               ; e8 68 b5
+    call 0167ah                               ; e8 30 b3
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0000ch                ; 83 c2 0c
     mov ax, word [bp+014h]                    ; 8b 46 14
-    call 0160eh                               ; e8 3c b5
+    call 0165eh                               ; e8 04 b3
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0000dh                ; 83 c2 0d
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, 00093h                            ; bb 93 00
-    call 0160eh                               ; e8 2d b5
+    call 0165eh                               ; e8 f5 b2
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0000eh                ; 83 c2 0e
     mov ax, word [bp+014h]                    ; 8b 46 14
     xor bx, bx                                ; 31 db
-    call 0162ah                               ; e8 3b b5
+    call 0167ah                               ; e8 03 b3
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 00020h                ; 83 c2 20
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, strict word 0ffffh                ; bb ff ff
-    call 0162ah                               ; e8 2c b5
+    call 0167ah                               ; e8 f4 b2
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 00022h                ; 83 c2 22
     mov ax, word [bp+014h]                    ; 8b 46 14
     xor bx, bx                                ; 31 db
-    call 0162ah                               ; e8 1e b5
+    call 0167ah                               ; e8 e6 b2
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 00024h                ; 83 c2 24
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, strict word 0000fh                ; bb 0f 00
-    call 0160eh                               ; e8 f3 b4
+    call 0165eh                               ; e8 bb b2
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 00025h                ; 83 c2 25
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, 0009bh                            ; bb 9b 00
-    call 0160eh                               ; e8 e4 b4
+    call 0165eh                               ; e8 ac b2
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 00026h                ; 83 c2 26
     mov ax, word [bp+014h]                    ; 8b 46 14
     xor bx, bx                                ; 31 db
-    call 0162ah                               ; e8 f2 b4
+    call 0167ah                               ; e8 ba b2
     mov ax, ss                                ; 8c d0
     mov cx, ax                                ; 89 c1
     sal cx, 004h                              ; c1 e1 04
@@ -8659,27 +8928,27 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     add dx, strict byte 00028h                ; 83 c2 28
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, strict word 0ffffh                ; bb ff ff
-    call 0162ah                               ; e8 d6 b4
+    call 0167ah                               ; e8 9e b2
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0002ah                ; 83 c2 2a
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, cx                                ; 89 cb
-    call 0162ah                               ; e8 c8 b4
+    call 0167ah                               ; e8 90 b2
     movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0002ch                ; 83 c2 2c
     mov ax, word [bp+014h]                    ; 8b 46 14
-    call 0160eh                               ; e8 9c b4
+    call 0165eh                               ; e8 64 b2
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0002dh                ; 83 c2 2d
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, 00093h                            ; bb 93 00
-    call 0160eh                               ; e8 8d b4
+    call 0165eh                               ; e8 55 b2
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0002eh                ; 83 c2 2e
     mov ax, word [bp+014h]                    ; 8b 46 14
     xor bx, bx                                ; 31 db
-    call 0162ah                               ; e8 9b b4
+    call 0167ah                               ; e8 63 b2
     mov si, word [bp+006h]                    ; 8b 76 06
     mov es, [bp+014h]                         ; 8e 46 14
     mov cx, word [bp+010h]                    ; 8b 4e 10
@@ -8690,7 +8959,7 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     mov ds, ax                                ; 8e d8
     mov word [00467h], sp                     ; 89 26 67 04
     mov [00469h], ss                          ; 8c 16 69 04
-    call 061abh                               ; e8 00 00
+    call 06433h                               ; e8 00 00
     pop di                                    ; 5f
     add di, strict byte 0001bh                ; 83 c7 1b
     push strict byte 00020h                   ; 6a 20
@@ -8713,7 +8982,7 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     ; xor di, di                                ; 33 ff
     cld                                       ; fc
     rep movsw                                 ; f3 a5
-    call 061dfh                               ; e8 00 00
+    call 06467h                               ; e8 00 00
     pop ax                                    ; 58
     push 0f000h                               ; 68 00 f0
     add ax, strict byte 00018h                ; 83 c0 18
@@ -8734,53 +9003,53 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     pop eax                                   ; 66 58
     pop DS                                    ; 1f
     mov ax, di                                ; 89 f8
-    call 05e2eh                               ; e8 1e fc
+    call 060b6h                               ; e8 1e fc
     sti                                       ; fb
     mov byte [bp+013h], 000h                  ; c6 46 13 00
     and byte [bp+018h], 0feh                  ; 80 66 18 fe
-    jmp near 05fc6h                           ; e9 aa fd
+    jmp near 0624eh                           ; e9 aa fd
     mov ax, strict word 00031h                ; b8 31 00
-    call 0165ch                               ; e8 3a b4
+    call 016ach                               ; e8 02 b2
     xor ah, ah                                ; 30 e4
     mov dx, ax                                ; 89 c2
     sal dx, 008h                              ; c1 e2 08
     mov ax, strict word 00030h                ; b8 30 00
-    call 0165ch                               ; e8 2d b4
+    call 016ach                               ; e8 f5 b1
     xor ah, ah                                ; 30 e4
     or dx, ax                                 ; 09 c2
     mov word [bp+012h], dx                    ; 89 56 12
     cmp dx, strict byte 0ffc0h                ; 83 fa c0
-    jbe short 06215h                          ; 76 da
+    jbe short 0649dh                          ; 76 da
     mov word [bp+012h], strict word 0ffc0h    ; c7 46 12 c0 ff
-    jmp short 06215h                          ; eb d3
+    jmp short 0649dh                          ; eb d3
     cli                                       ; fa
     mov ax, strict word 00001h                ; b8 01 00
-    call 05e2eh                               ; e8 e5 fb
+    call 060b6h                               ; e8 e5 fb
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 00038h                ; 83 c2 38
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, strict word 0ffffh                ; bb ff ff
-    call 0162ah                               ; e8 d2 b3
+    call 0167ah                               ; e8 9a b1
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0003ah                ; 83 c2 3a
     mov ax, word [bp+014h]                    ; 8b 46 14
     xor bx, bx                                ; 31 db
-    call 0162ah                               ; e8 c4 b3
+    call 0167ah                               ; e8 8c b1
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0003ch                ; 83 c2 3c
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, strict word 0000fh                ; bb 0f 00
-    call 0160eh                               ; e8 99 b3
+    call 0165eh                               ; e8 61 b1
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0003dh                ; 83 c2 3d
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov bx, 0009bh                            ; bb 9b 00
-    call 0160eh                               ; e8 8a b3
+    call 0165eh                               ; e8 52 b1
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, strict byte 0003eh                ; 83 c2 3e
     mov ax, word [bp+014h]                    ; 8b 46 14
     xor bx, bx                                ; 31 db
-    call 0162ah                               ; e8 98 b3
+    call 0167ah                               ; e8 60 b1
     mov AL, strict byte 011h                  ; b0 11
     mov dx, strict word 00020h                ; ba 20 00
     out DX, AL                                ; ee
@@ -8810,7 +9079,7 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     mov dx, 000a1h                            ; ba a1 00
     out DX, AL                                ; ee
     mov si, word [bp+006h]                    ; 8b 76 06
-    call 062d3h                               ; e8 00 00
+    call 0655bh                               ; e8 00 00
     pop di                                    ; 5f
     add di, strict byte 00018h                ; 83 c7 18
     push strict byte 00038h                   ; 6a 38
@@ -8838,69 +9107,66 @@ _int15_function:                             ; 0xf5ee6 LB 0x4cd
     push ax                                   ; 50
     push cx                                   ; 51
     retf                                      ; cb
-    jmp near 05fc6h                           ; e9 b7 fc
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 0624eh                           ; e9 b7 fc
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 c7 b5
+    call 01931h                               ; e8 8f b3
     push 00876h                               ; 68 76 08
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 00 b6
+    call 01972h                               ; e8 c8 b3
     add sp, strict byte 00004h                ; 83 c4 04
     or byte [bp+018h], 001h                   ; 80 4e 18 01
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     or ah, 086h                               ; 80 cc 86
     mov word [bp+012h], ax                    ; 89 46 12
-    jmp near 05fc6h                           ; e9 8f fc
+    jmp near 0624eh                           ; e9 8f fc
     mov word [bp+018h], cx                    ; 89 4e 18
     mov word [bp+012h], ax                    ; 89 46 12
     mov word [bp+00ch], 0e6f5h                ; c7 46 0c f5 e6
     mov word [bp+014h], 0f000h                ; c7 46 14 00 f0
-    jmp near 05fc6h                           ; e9 7c fc
+    jmp near 0624eh                           ; e9 7c fc
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 c9 b2
+    call 0166ch                               ; e8 91 b0
     mov word [bp+014h], ax                    ; 89 46 14
-    jmp near 06215h                           ; e9 bc fe
+    jmp near 0649dh                           ; e9 bc fe
     push 008a5h                               ; 68 a5 08
     push strict byte 00008h                   ; 6a 08
-    jmp short 0631fh                          ; eb bf
+    jmp short 065a7h                          ; eb bf
     test byte [bp+012h], 0ffh                 ; f6 46 12 ff
-    jne short 06385h                          ; 75 1f
+    jne short 0660dh                          ; 75 1f
     mov word [bp+012h], ax                    ; 89 46 12
     mov ax, word [bp+00ch]                    ; 8b 46 0c
     xor ah, ah                                ; 30 e4
     cmp ax, strict word 00001h                ; 3d 01 00
-    jc short 0637eh                           ; 72 0b
+    jc short 06606h                           ; 72 0b
     cmp ax, strict word 00003h                ; 3d 03 00
-    jnbe short 0637eh                         ; 77 06
+    jnbe short 06606h                         ; 77 06
     mov word [bp+018h], cx                    ; 89 4e 18
-    jmp near 05fc6h                           ; e9 48 fc
+    jmp near 0624eh                           ; e9 48 fc
     or byte [bp+018h], 001h                   ; 80 4e 18 01
-    jmp near 05fc6h                           ; e9 41 fc
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 0624eh                           ; e9 41 fc
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 51 b5
+    call 01931h                               ; e8 19 b3
     push word [bp+00ch]                       ; ff 76 0c
     push word [bp+012h]                       ; ff 76 12
     push 008bch                               ; 68 bc 08
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 84 b5
+    call 01972h                               ; e8 4c b3
     add sp, strict byte 00008h                ; 83 c4 08
-    jmp short 06325h                          ; eb 82
-    pop sp                                    ; 5c
-    db  065h, 07eh, 065h
-    ; gs jle short 0640ch                       ; 65 7e 65
-    mov ax, word [0c365h]                     ; a1 65 c3
-    db  065h, 0e3h, 065h
-    ; gs jcxz 06412h                            ; 65 e3 65
-    add AL, strict byte 066h                  ; 04 66
-    inc bx                                    ; 43
-    outsd                                     ; 66 6f
-    db  066h
-_int15_function32:                           ; 0xf63b3 LB 0x37e
+    jmp short 065adh                          ; eb 82
+    in AL, strict byte 067h                   ; e4 67
+    push ES                                   ; 06
+    push 06829h                               ; 68 29 68
+    dec bx                                    ; 4b
+    push 0686bh                               ; 68 6b 68
+    mov [bx+si-035h], gs                      ; 8c 68 cb
+    push 068f7h                               ; 68 f7 68
+_int15_function32:                           ; 0xf663b LB 0x37e
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -8912,11 +9178,11 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+020h]                    ; 8b 46 20
     xor ah, ah                                ; 30 e4
     cmp dx, 000e8h                            ; 81 fa e8 00
-    je near 06480h                            ; 0f 84 ad 00
+    je near 06708h                            ; 0f 84 ad 00
     cmp dx, 000d0h                            ; 81 fa d0 00
-    je short 0641bh                           ; 74 42
+    je short 066a3h                           ; 74 42
     cmp dx, 00086h                            ; 81 fa 86 00
-    jne near 06701h                           ; 0f 85 20 03
+    jne near 06989h                           ; 0f 85 20 03
     sti                                       ; fb
     mov ax, word [bp+01ch]                    ; 8b 46 1c
     mov dx, word [bp+018h]                    ; 8b 56 18
@@ -8935,33 +9201,33 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     ; mov ah, al                                ; 8a e0
     db  066h, 00bh, 0c9h
     ; or ecx, ecx                               ; 66 0b c9
-    je near 06418h                            ; 0f 84 0e 00
+    je near 066a0h                            ; 0f 84 0e 00
     in AL, strict byte 061h                   ; e4 61
     and AL, strict byte 010h                  ; 24 10
     db  03ah, 0c4h
     ; cmp al, ah                                ; 3a c4
-    je short 0640ah                           ; 74 f8
+    je short 06692h                           ; 74 f8
     db  08ah, 0e0h
     ; mov ah, al                                ; 8a e0
     dec ecx                                   ; 66 49
-    jne short 0640ah                          ; 75 f2
-    jmp near 0672bh                           ; e9 10 03
+    jne short 06692h                          ; 75 f2
+    jmp near 069b3h                           ; e9 10 03
     cmp ax, strict word 0004fh                ; 3d 4f 00
-    jne near 06701h                           ; 0f 85 df 02
+    jne near 06989h                           ; 0f 85 df 02
     cmp word [bp+016h], 05052h                ; 81 7e 16 52 50
-    jne near 06701h                           ; 0f 85 d6 02
+    jne near 06989h                           ; 0f 85 d6 02
     cmp word [bp+014h], 04f43h                ; 81 7e 14 43 4f
-    jne near 06701h                           ; 0f 85 cd 02
+    jne near 06989h                           ; 0f 85 cd 02
     cmp word [bp+01eh], 04d4fh                ; 81 7e 1e 4f 4d
-    jne near 06701h                           ; 0f 85 c4 02
+    jne near 06989h                           ; 0f 85 c4 02
     cmp word [bp+01ch], 04445h                ; 81 7e 1c 45 44
-    jne near 06701h                           ; 0f 85 bb 02
+    jne near 06989h                           ; 0f 85 bb 02
     mov ax, word [bp+00ah]                    ; 8b 46 0a
     or ax, word [bp+008h]                     ; 0b 46 08
-    jne near 06701h                           ; 0f 85 b1 02
+    jne near 06989h                           ; 0f 85 b1 02
     mov ax, word [bp+006h]                    ; 8b 46 06
     or ax, word [bp+004h]                     ; 0b 46 04
-    jne near 06701h                           ; 0f 85 a7 02
+    jne near 06989h                           ; 0f 85 a7 02
     mov word [bp+028h], bx                    ; 89 5e 28
     mov ax, word [bp+014h]                    ; 8b 46 14
     mov word [bp+008h], ax                    ; 89 46 08
@@ -8972,26 +9238,26 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+01eh]                    ; 8b 46 1e
     mov word [bp+006h], ax                    ; 89 46 06
     mov dword [bp+020h], strict dword 049413332h ; 66 c7 46 20 32 33 41 49
-    jmp near 0672bh                           ; e9 ab 02
+    jmp near 069b3h                           ; e9 ab 02
     cmp ax, strict word 00020h                ; 3d 20 00
-    je short 0648fh                           ; 74 0a
+    je short 06717h                           ; 74 0a
     cmp ax, strict word 00001h                ; 3d 01 00
-    je near 066b6h                            ; 0f 84 2a 02
-    jmp near 06701h                           ; e9 72 02
+    je near 0693eh                            ; 0f 84 2a 02
+    jmp near 06989h                           ; e9 72 02
     cmp word [bp+01ah], 0534dh                ; 81 7e 1a 4d 53
-    jne near 06701h                           ; 0f 85 69 02
+    jne near 06989h                           ; 0f 85 69 02
     cmp word [bp+018h], 04150h                ; 81 7e 18 50 41
-    jne near 06701h                           ; 0f 85 60 02
+    jne near 06989h                           ; 0f 85 60 02
     mov ax, strict word 00035h                ; b8 35 00
-    call 0165ch                               ; e8 b5 b1
+    call 016ach                               ; e8 7d af
     movzx bx, al                              ; 0f b6 d8
     xor dx, dx                                ; 31 d2
     mov cx, strict word 00008h                ; b9 08 00
     sal bx, 1                                 ; d1 e3
     rcl dx, 1                                 ; d1 d2
-    loop 064afh                               ; e2 fa
+    loop 06737h                               ; e2 fa
     mov ax, strict word 00034h                ; b8 34 00
-    call 0165ch                               ; e8 a1 b1
+    call 016ach                               ; e8 69 af
     xor ah, ah                                ; 30 e4
     mov dx, bx                                ; 89 da
     or dx, ax                                 ; 09 c2
@@ -8999,30 +9265,30 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     add bx, bx                                ; 01 db
     adc dx, 00100h                            ; 81 d2 00 01
     cmp dx, 00100h                            ; 81 fa 00 01
-    jc short 064d5h                           ; 72 06
-    jne short 06502h                          ; 75 31
+    jc short 0675dh                           ; 72 06
+    jne short 0678ah                          ; 75 31
     test bx, bx                               ; 85 db
-    jnbe short 06502h                         ; 77 2d
+    jnbe short 0678ah                         ; 77 2d
     mov ax, strict word 00031h                ; b8 31 00
-    call 0165ch                               ; e8 81 b1
+    call 016ach                               ; e8 49 af
     movzx bx, al                              ; 0f b6 d8
     xor dx, dx                                ; 31 d2
     mov cx, strict word 00008h                ; b9 08 00
     sal bx, 1                                 ; d1 e3
     rcl dx, 1                                 ; d1 d2
-    loop 064e3h                               ; e2 fa
+    loop 0676bh                               ; e2 fa
     mov ax, strict word 00030h                ; b8 30 00
-    call 0165ch                               ; e8 6d b1
+    call 016ach                               ; e8 35 af
     xor ah, ah                                ; 30 e4
     or bx, ax                                 ; 09 c3
     mov cx, strict word 0000ah                ; b9 0a 00
     sal bx, 1                                 ; d1 e3
     rcl dx, 1                                 ; d1 d2
-    loop 064f6h                               ; e2 fa
+    loop 0677eh                               ; e2 fa
     add bx, strict byte 00000h                ; 83 c3 00
     adc dx, strict byte 00010h                ; 83 d2 10
     mov ax, strict word 00062h                ; b8 62 00
-    call 0165ch                               ; e8 54 b1
+    call 016ach                               ; e8 1c af
     xor ah, ah                                ; 30 e4
     mov word [bp-00ah], ax                    ; 89 46 f6
     xor al, al                                ; 30 c0
@@ -9030,28 +9296,28 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov cx, strict word 00008h                ; b9 08 00
     sal word [bp-00ah], 1                     ; d1 66 f6
     rcl word [bp-008h], 1                     ; d1 56 f8
-    loop 06515h                               ; e2 f8
+    loop 0679dh                               ; e2 f8
     mov ax, strict word 00061h                ; b8 61 00
-    call 0165ch                               ; e8 39 b1
+    call 016ach                               ; e8 01 af
     xor ah, ah                                ; 30 e4
     or word [bp-00ah], ax                     ; 09 46 f6
     mov ax, word [bp-00ah]                    ; 8b 46 f6
     mov word [bp-008h], ax                    ; 89 46 f8
     mov word [bp-00ah], strict word 00000h    ; c7 46 f6 00 00
     mov ax, strict word 00063h                ; b8 63 00
-    call 0165ch                               ; e8 23 b1
+    call 016ach                               ; e8 eb ae
     mov byte [bp-004h], al                    ; 88 46 fc
     mov byte [bp-006h], al                    ; 88 46 fa
     mov ax, word [bp+014h]                    ; 8b 46 14
     cmp ax, strict word 00007h                ; 3d 07 00
-    jnbe near 06701h                          ; 0f 87 b8 01
+    jnbe near 06989h                          ; 0f 87 b8 01
     mov si, ax                                ; 89 c6
     add si, ax                                ; 01 c6
     mov cx, bx                                ; 89 d9
     add cx, strict byte 00000h                ; 83 c1 00
     mov ax, dx                                ; 89 d0
     adc ax, strict word 0ffffh                ; 15 ff ff
-    jmp word [cs:si+063a3h]                   ; 2e ff a4 a3 63
+    jmp word [cs:si+0662bh]                   ; 2e ff a4 2b 66
     push strict byte 00001h                   ; 6a 01
     push dword 000000000h                     ; 66 6a 00
     push strict byte 00009h                   ; 6a 09
@@ -9060,9 +9326,9 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+024h]                    ; 8b 46 24
     xor bx, bx                                ; 31 db
     xor cx, cx                                ; 31 c9
-    call 05e5ah                               ; e8 e7 f8
+    call 060e2h                               ; e8 e7 f8
     mov dword [bp+014h], strict dword 000000001h ; 66 c7 46 14 01 00 00 00
-    jmp near 066a0h                           ; e9 22 01
+    jmp near 06928h                           ; e9 22 01
     push strict byte 00002h                   ; 6a 02
     push dword 000000000h                     ; 66 6a 00
     push strict byte 0000ah                   ; 6a 0a
@@ -9071,9 +9337,9 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+024h]                    ; 8b 46 24
     mov bx, 0fc00h                            ; bb 00 fc
     mov cx, strict word 00009h                ; b9 09 00
-    call 05e5ah                               ; e8 c4 f8
+    call 060e2h                               ; e8 c4 f8
     mov dword [bp+014h], strict dword 000000002h ; 66 c7 46 14 02 00 00 00
-    jmp near 066a0h                           ; e9 ff 00
+    jmp near 06928h                           ; e9 ff 00
     push strict byte 00002h                   ; 6a 02
     push dword 000000000h                     ; 66 6a 00
     push strict byte 00010h                   ; 6a 10
@@ -9082,9 +9348,9 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+024h]                    ; 8b 46 24
     xor bx, bx                                ; 31 db
     mov cx, strict word 0000fh                ; b9 0f 00
-    call 05e5ah                               ; e8 a2 f8
+    call 060e2h                               ; e8 a2 f8
     mov dword [bp+014h], strict dword 000000003h ; 66 c7 46 14 03 00 00 00
-    jmp near 066a0h                           ; e9 dd 00
+    jmp near 06928h                           ; e9 dd 00
     push strict byte 00001h                   ; 6a 01
     push dword 000000000h                     ; 66 6a 00
     push ax                                   ; 50
@@ -9093,9 +9359,9 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+024h]                    ; 8b 46 24
     xor bx, bx                                ; 31 db
     mov cx, strict word 00010h                ; b9 10 00
-    call 05e5ah                               ; e8 82 f8
+    call 060e2h                               ; e8 82 f8
     mov dword [bp+014h], strict dword 000000004h ; 66 c7 46 14 04 00 00 00
-    jmp near 066a0h                           ; e9 bd 00
+    jmp near 06928h                           ; e9 bd 00
     push strict byte 00003h                   ; 6a 03
     push dword 000000000h                     ; 66 6a 00
     push dx                                   ; 52
@@ -9105,9 +9371,9 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov bx, cx                                ; 89 cb
     mov cx, ax                                ; 89 c1
     mov ax, si                                ; 89 f0
-    call 05e5ah                               ; e8 61 f8
+    call 060e2h                               ; e8 61 f8
     mov dword [bp+014h], strict dword 000000005h ; 66 c7 46 14 05 00 00 00
-    jmp near 066a0h                           ; e9 9c 00
+    jmp near 06928h                           ; e9 9c 00
     push strict byte 00002h                   ; 6a 02
     push dword 000000000h                     ; 66 6a 00
     push dword 000000000h                     ; 66 6a 00
@@ -9115,19 +9381,19 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+024h]                    ; 8b 46 24
     xor bx, bx                                ; 31 db
     mov cx, strict word 0fffch                ; b9 fc ff
-    call 05e5ah                               ; e8 40 f8
+    call 060e2h                               ; e8 40 f8
     cmp byte [bp-004h], 000h                  ; 80 7e fc 00
-    jne short 06627h                          ; 75 07
+    jne short 068afh                          ; 75 07
     mov ax, word [bp-008h]                    ; 8b 46 f8
     test ax, ax                               ; 85 c0
-    je short 0663bh                           ; 74 14
+    je short 068c3h                           ; 74 14
     mov dword [bp+014h], strict dword 000000007h ; 66 c7 46 14 07 00 00 00
-    jmp short 066a0h                          ; eb 6f
+    jmp short 06928h                          ; eb 6f
     mov dword [bp+014h], strict dword 000000006h ; 66 c7 46 14 06 00 00 00
-    jmp short 066a0h                          ; eb 65
+    jmp short 06928h                          ; eb 65
     mov word [bp+014h], ax                    ; 89 46 14
     mov word [bp+016h], ax                    ; 89 46 16
-    jmp short 066a0h                          ; eb 5d
+    jmp short 06928h                          ; eb 5d
     push strict byte 00002h                   ; 6a 02
     push dword 000000000h                     ; 66 6a 00
     push dword 000000000h                     ; 66 6a 00
@@ -9135,20 +9401,20 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+024h]                    ; 8b 46 24
     xor bx, bx                                ; 31 db
     xor cx, cx                                ; 31 c9
-    call 05e5ah                               ; e8 02 f8
+    call 060e2h                               ; e8 02 f8
     cmp byte [bp-004h], 000h                  ; 80 7e fc 00
-    jne short 06665h                          ; 75 07
+    jne short 068edh                          ; 75 07
     mov ax, word [bp-008h]                    ; 8b 46 f8
     test ax, ax                               ; 85 c0
-    je short 06667h                           ; 74 02
-    jmp short 06627h                          ; eb c0
+    je short 068efh                           ; 74 02
+    jmp short 068afh                          ; eb c0
     mov word [bp+014h], ax                    ; 89 46 14
     mov word [bp+016h], ax                    ; 89 46 16
-    jmp short 066a0h                          ; eb 31
+    jmp short 06928h                          ; eb 31
     cmp byte [bp-004h], 000h                  ; 80 7e fc 00
-    jne short 0667bh                          ; 75 06
+    jne short 06903h                          ; 75 06
     cmp word [bp-008h], strict byte 00000h    ; 83 7e f8 00
-    je short 066a0h                           ; 74 25
+    je short 06928h                           ; 74 25
     push strict byte 00001h                   ; 6a 01
     mov al, byte [bp-006h]                    ; 8a 46 fa
     db  0feh, 0c0h
@@ -9161,49 +9427,49 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     mov ax, word [bp+024h]                    ; 8b 46 24
     xor bx, bx                                ; 31 db
     xor cx, cx                                ; 31 c9
-    call 05e5ah                               ; e8 c2 f7
+    call 060e2h                               ; e8 c2 f7
     xor ax, ax                                ; 31 c0
     mov word [bp+014h], ax                    ; 89 46 14
     mov word [bp+016h], ax                    ; 89 46 16
     mov dword [bp+020h], strict dword 0534d4150h ; 66 c7 46 20 50 41 4d 53
     mov dword [bp+01ch], strict dword 000000014h ; 66 c7 46 1c 14 00 00 00
     and byte [bp+028h], 0feh                  ; 80 66 28 fe
-    jmp short 0672bh                          ; eb 75
+    jmp short 069b3h                          ; eb 75
     mov word [bp+028h], bx                    ; 89 5e 28
     mov ax, strict word 00031h                ; b8 31 00
-    call 0165ch                               ; e8 9d af
+    call 016ach                               ; e8 65 ad
     movzx dx, al                              ; 0f b6 d0
     sal dx, 008h                              ; c1 e2 08
     mov ax, strict word 00030h                ; b8 30 00
-    call 0165ch                               ; e8 91 af
+    call 016ach                               ; e8 59 ad
     xor ah, ah                                ; 30 e4
     or dx, ax                                 ; 09 c2
     mov word [bp+01ch], dx                    ; 89 56 1c
     cmp dx, 03c00h                            ; 81 fa 00 3c
-    jbe short 066ddh                          ; 76 05
+    jbe short 06965h                          ; 76 05
     mov word [bp+01ch], 03c00h                ; c7 46 1c 00 3c
     mov ax, strict word 00035h                ; b8 35 00
-    call 0165ch                               ; e8 79 af
+    call 016ach                               ; e8 41 ad
     movzx dx, al                              ; 0f b6 d0
     sal dx, 008h                              ; c1 e2 08
     mov ax, strict word 00034h                ; b8 34 00
-    call 0165ch                               ; e8 6d af
+    call 016ach                               ; e8 35 ad
     xor ah, ah                                ; 30 e4
     or dx, ax                                 ; 09 c2
     mov word [bp+018h], dx                    ; 89 56 18
     mov ax, word [bp+01ch]                    ; 8b 46 1c
     mov word [bp+020h], ax                    ; 89 46 20
     mov word [bp+014h], dx                    ; 89 56 14
-    jmp short 0672bh                          ; eb 2a
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp short 069b3h                          ; eb 2a
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 d5 b1
+    call 01931h                               ; e8 9d af
     push word [bp+014h]                       ; ff 76 14
     push word [bp+020h]                       ; ff 76 20
     push 008bch                               ; 68 bc 08
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 08 b2
+    call 01972h                               ; e8 d0 af
     add sp, strict byte 00008h                ; 83 c4 08
     or byte [bp+028h], 001h                   ; 80 4e 28 01
     mov ax, word [bp+020h]                    ; 8b 46 20
@@ -9214,7 +9480,7 @@ _int15_function32:                           ; 0xf63b3 LB 0x37e
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-_inv_op_handler:                             ; 0xf6731 LB 0x195
+_inv_op_handler:                             ; 0xf69b9 LB 0x195
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -9223,11 +9489,11 @@ _inv_op_handler:                             ; 0xf6731 LB 0x195
     push ax                                   ; 50
     les bx, [bp+018h]                         ; c4 5e 18
     cmp byte [es:bx], 0f0h                    ; 26 80 3f f0
-    jne short 06747h                          ; 75 06
+    jne short 069cfh                          ; 75 06
     inc word [bp+018h]                        ; ff 46 18
-    jmp near 068bfh                           ; e9 78 01
+    jmp near 06b47h                           ; e9 78 01
     cmp word [es:bx], 0050fh                  ; 26 81 3f 0f 05
-    jne near 068bbh                           ; 0f 85 6b 01
+    jne near 06b43h                           ; 0f 85 6b 01
     mov si, 00800h                            ; be 00 08
     xor ax, ax                                ; 31 c0
     mov word [bp-006h], ax                    ; 89 46 fa
@@ -9255,11 +9521,11 @@ _inv_op_handler:                             ; 0xf6731 LB 0x195
     mov cx, strict word 00004h                ; b9 04 00
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 067a0h                               ; e2 fa
+    loop 06a28h                               ; e2 fa
     cmp bx, dx                                ; 39 d3
-    jne short 067aeh                          ; 75 04
+    jne short 06a36h                          ; 75 04
     cmp di, ax                                ; 39 c7
-    je short 067b3h                           ; 74 05
+    je short 06a3bh                           ; 74 05
     mov word [bp-008h], strict word 00001h    ; c7 46 f8 01 00
     mov es, [bp-006h]                         ; 8e 46 fa
     movzx di, byte [es:si+04ah]               ; 26 0f b6 7c 4a
@@ -9269,11 +9535,11 @@ _inv_op_handler:                             ; 0xf6731 LB 0x195
     mov cx, strict word 00004h                ; b9 04 00
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 067c8h                               ; e2 fa
+    loop 06a50h                               ; e2 fa
     cmp di, dx                                ; 39 d7
-    jne short 067d6h                          ; 75 04
+    jne short 06a5eh                          ; 75 04
     cmp bx, ax                                ; 39 c3
-    je short 067dah                           ; 74 04
+    je short 06a62h                           ; 74 04
     or byte [bp-008h], 002h                   ; 80 4e f8 02
     push strict byte 00000h                   ; 6a 00
     push 00800h                               ; 68 00 08
@@ -9323,10 +9589,10 @@ _inv_op_handler:                             ; 0xf6731 LB 0x195
     lmsw ax                                   ; 0f 01 f0
     mov ax, strict word 00008h                ; b8 08 00
     test cx, strict word 00001h               ; f7 c1 01 00
-    je near 06878h                            ; 0f 84 02 00
+    je near 06b00h                            ; 0f 84 02 00
     mov es, ax                                ; 8e c0
     test cx, strict word 00002h               ; f7 c1 02 00
-    je near 068a0h                            ; 0f 84 20 00
+    je near 06b28h                            ; 0f 84 20 00
     mov bx, word [word ss:00000h]             ; 36 8b 1e 00 00
     mov word [word ss:00008h], bx             ; 36 89 1e 08 00
     mov bx, word [word ss:00002h]             ; 36 8b 1e 02 00
@@ -9343,141 +9609,143 @@ _inv_op_handler:                             ; 0xf6731 LB 0x195
     sub sp, strict byte 00006h                ; 83 ec 06
     mov ss, [word ss:00020h]                  ; 36 8e 16 20 00
     iret                                      ; cf
-    jmp short 068bfh                          ; eb 04
+    jmp short 06b47h                          ; eb 04
     sti                                       ; fb
     hlt                                       ; f4
-    jmp short 068bch                          ; eb fd
+    jmp short 06b44h                          ; eb fd
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-init_rtc_:                                   ; 0xf68c6 LB 0x28
+init_rtc_:                                   ; 0xf6b4e LB 0x28
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
     mov dx, strict word 00026h                ; ba 26 00
     mov ax, strict word 0000ah                ; b8 0a 00
-    call 01679h                               ; e8 a6 ad
+    call 016c9h                               ; e8 6e ab
     mov dx, strict word 00002h                ; ba 02 00
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 01679h                               ; e8 9d ad
+    call 016c9h                               ; e8 65 ab
     mov ax, strict word 0000ch                ; b8 0c 00
-    call 0165ch                               ; e8 7a ad
+    call 016ach                               ; e8 42 ab
     mov ax, strict word 0000dh                ; b8 0d 00
-    call 0165ch                               ; e8 74 ad
+    call 016ach                               ; e8 3c ab
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-rtc_updating_:                               ; 0xf68ee LB 0x21
+rtc_updating_:                               ; 0xf6b76 LB 0x21
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
     mov dx, 061a8h                            ; ba a8 61
     dec dx                                    ; 4a
-    je short 06906h                           ; 74 0e
+    je short 06b8eh                           ; 74 0e
     mov ax, strict word 0000ah                ; b8 0a 00
-    call 0165ch                               ; e8 5e ad
+    call 016ach                               ; e8 26 ab
     test AL, strict byte 080h                 ; a8 80
-    jne short 068f5h                          ; 75 f3
+    jne short 06b7dh                          ; 75 f3
     xor ax, ax                                ; 31 c0
-    jmp short 06909h                          ; eb 03
+    jmp short 06b91h                          ; eb 03
     mov ax, strict word 00001h                ; b8 01 00
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-_int70_function:                             ; 0xf690f LB 0xbe
+_int70_function:                             ; 0xf6b97 LB 0xbe
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     push ax                                   ; 50
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 0165ch                               ; e8 42 ad
+    call 016ach                               ; e8 0a ab
     mov dl, al                                ; 88 c2
     mov byte [bp-004h], al                    ; 88 46 fc
     mov ax, strict word 0000ch                ; b8 0c 00
-    call 0165ch                               ; e8 37 ad
+    call 016ach                               ; e8 ff aa
     mov dh, al                                ; 88 c6
     test dl, 060h                             ; f6 c2 60
-    je near 069b4h                            ; 0f 84 86 00
+    je near 06c3ch                            ; 0f 84 86 00
     test AL, strict byte 020h                 ; a8 20
-    je short 06936h                           ; 74 04
+    je short 06bbeh                           ; 74 04
     sti                                       ; fb
     int 04ah                                  ; cd 4a
     cli                                       ; fa
     test dh, 040h                             ; f6 c6 40
-    je near 069b4h                            ; 0f 84 77 00
+    je near 06c3ch                            ; 0f 84 77 00
     mov dx, 000a0h                            ; ba a0 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 ba ac
+    call 01650h                               ; e8 82 aa
     test al, al                               ; 84 c0
-    je short 069b4h                           ; 74 6a
+    je short 06c3ch                           ; 74 6a
     mov dx, 0009ch                            ; ba 9c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01638h                               ; e8 e5 ac
+    call 01688h                               ; e8 ad aa
     test dx, dx                               ; 85 d2
-    jne short 069a0h                          ; 75 49
+    jne short 06c28h                          ; 75 49
     cmp ax, 003d1h                            ; 3d d1 03
-    jnc short 069a0h                          ; 73 44
+    jnc short 06c28h                          ; 73 44
     mov dx, 00098h                            ; ba 98 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 b7 ac
+    call 0166ch                               ; e8 7f aa
     mov si, ax                                ; 89 c6
     mov dx, 0009ah                            ; ba 9a 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 ac ac
+    call 0166ch                               ; e8 74 aa
     mov cx, ax                                ; 89 c1
     xor bx, bx                                ; 31 db
     mov dx, 000a0h                            ; ba a0 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 91 ac
+    call 0165eh                               ; e8 59 aa
     mov al, byte [bp-004h]                    ; 8a 46 fc
     and AL, strict byte 037h                  ; 24 37
     movzx dx, al                              ; 0f b6 d0
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 01679h                               ; e8 ee ac
+    call 016c9h                               ; e8 b6 aa
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 01600h                               ; e8 6e ac
+    call 01650h                               ; e8 36 aa
     or AL, strict byte 080h                   ; 0c 80
     movzx bx, al                              ; 0f b6 d8
     mov dx, cx                                ; 89 ca
     mov ax, si                                ; 89 f0
-    call 0160eh                               ; e8 70 ac
-    jmp short 069b4h                          ; eb 14
+    call 0165eh                               ; e8 38 aa
+    jmp short 06c3ch                          ; eb 14
     mov bx, ax                                ; 89 c3
     add bx, 0fc2fh                            ; 81 c3 2f fc
     mov cx, dx                                ; 89 d1
     adc cx, strict byte 0ffffh                ; 83 d1 ff
     mov dx, 0009ch                            ; ba 9c 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0164ah                               ; e8 96 ac
-    call 0e03bh                               ; e8 84 76
+    call 0169ah                               ; e8 5e aa
+    call 0e030h                               ; e8 f1 73
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-    in AL, strict byte 069h                   ; e4 69
-    or ax, 0326ah                             ; 0d 6a 32
-    push strict byte 00064h                   ; 6a 64
-    push strict byte 0ffb3h                   ; 6a b3
-    push strict byte 0ffebh                   ; 6a eb
-    push strict byte 0002eh                   ; 6a 2e
-    db  06bh
-    db  085h
-    db  06bh
-_int1a_function:                             ; 0xf69cd LB 0x1c8
+    insb                                      ; 6c
+    insb                                      ; 6c
+    xchg bp, ax                               ; 95
+    insb                                      ; 6c
+    mov dx, 0ec6ch                            ; ba 6c ec
+    insb                                      ; 6c
+    cmp bp, word [di+073h]                    ; 3b 6d 73
+    insw                                      ; 6d
+    mov DH, strict byte 06dh                  ; b6 6d
+    db  00dh
+    outsb                                     ; 6e
+_int1a_function:                             ; 0xf6c55 LB 0x1c8
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     sti                                       ; fb
     mov al, byte [bp+013h]                    ; 8a 46 13
     cmp AL, strict byte 007h                  ; 3c 07
-    jnbe near 06a09h                          ; 0f 87 2f 00
+    jnbe near 06c91h                          ; 0f 87 2f 00
     movzx bx, al                              ; 0f b6 d8
     add bx, bx                                ; 01 db
-    jmp word [cs:bx+069bdh]                   ; 2e ff a7 bd 69
+    jmp word [cs:bx+06c45h]                   ; 2e ff a7 45 6c
     cli                                       ; fa
     mov bx, 0046eh                            ; bb 6e 04
     xor ax, ax                                ; 31 c0
@@ -9508,41 +9776,41 @@ _int1a_function:                             ; 0xf69cd LB 0x1c8
     mov byte [es:bx], 000h                    ; 26 c6 07 00
     sti                                       ; fb
     mov byte [bp+013h], 000h                  ; c6 46 13 00
-    jmp short 06a09h                          ; eb d7
-    call 068eeh                               ; e8 b9 fe
+    jmp short 06c91h                          ; eb d7
+    call 06b76h                               ; e8 b9 fe
     test ax, ax                               ; 85 c0
-    je short 06a3bh                           ; 74 02
-    jmp short 06a09h                          ; eb ce
+    je short 06cc3h                           ; 74 02
+    jmp short 06c91h                          ; eb ce
     xor ax, ax                                ; 31 c0
-    call 0165ch                               ; e8 1c ac
+    call 016ach                               ; e8 e4 a9
     mov byte [bp+00fh], al                    ; 88 46 0f
     mov ax, strict word 00002h                ; b8 02 00
-    call 0165ch                               ; e8 13 ac
+    call 016ach                               ; e8 db a9
     mov byte [bp+010h], al                    ; 88 46 10
     mov ax, strict word 00004h                ; b8 04 00
-    call 0165ch                               ; e8 0a ac
+    call 016ach                               ; e8 d2 a9
     mov bl, al                                ; 88 c3
     mov byte [bp+011h], al                    ; 88 46 11
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 0165ch                               ; e8 ff ab
+    call 016ach                               ; e8 c7 a9
     and AL, strict byte 001h                  ; 24 01
     mov byte [bp+00eh], al                    ; 88 46 0e
-    jmp short 06aa9h                          ; eb 45
-    call 068eeh                               ; e8 87 fe
+    jmp short 06d31h                          ; eb 45
+    call 06b76h                               ; e8 87 fe
     test ax, ax                               ; 85 c0
-    je short 06a6eh                           ; 74 03
-    call 068c6h                               ; e8 58 fe
+    je short 06cf6h                           ; 74 03
+    call 06b4eh                               ; e8 58 fe
     movzx dx, byte [bp+00fh]                  ; 0f b6 56 0f
     xor ax, ax                                ; 31 c0
-    call 01679h                               ; e8 02 ac
+    call 016c9h                               ; e8 ca a9
     movzx dx, byte [bp+010h]                  ; 0f b6 56 10
     mov ax, strict word 00002h                ; b8 02 00
-    call 01679h                               ; e8 f8 ab
+    call 016c9h                               ; e8 c0 a9
     movzx dx, byte [bp+011h]                  ; 0f b6 56 11
     mov ax, strict word 00004h                ; b8 04 00
-    call 01679h                               ; e8 ee ab
+    call 016c9h                               ; e8 b6 a9
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 0165ch                               ; e8 cb ab
+    call 016ach                               ; e8 93 a9
     mov bl, al                                ; 88 c3
     and bl, 060h                              ; 80 e3 60
     or bl, 002h                               ; 80 cb 02
@@ -9551,71 +9819,71 @@ _int1a_function:                             ; 0xf69cd LB 0x1c8
     or bl, al                                 ; 08 c3
     movzx dx, bl                              ; 0f b6 d3
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 01679h                               ; e8 d0 ab
+    call 016c9h                               ; e8 98 a9
     mov byte [bp+013h], 000h                  ; c6 46 13 00
     mov byte [bp+012h], bl                    ; 88 5e 12
-    jmp near 06a09h                           ; e9 56 ff
+    jmp near 06c91h                           ; e9 56 ff
     mov byte [bp+013h], 000h                  ; c6 46 13 00
-    call 068eeh                               ; e8 34 fe
+    call 06b76h                               ; e8 34 fe
     test ax, ax                               ; 85 c0
-    je short 06ac1h                           ; 74 03
-    jmp near 06a09h                           ; e9 48 ff
+    je short 06d49h                           ; 74 03
+    jmp near 06c91h                           ; e9 48 ff
     mov ax, strict word 00009h                ; b8 09 00
-    call 0165ch                               ; e8 95 ab
+    call 016ach                               ; e8 5d a9
     mov byte [bp+010h], al                    ; 88 46 10
     mov ax, strict word 00008h                ; b8 08 00
-    call 0165ch                               ; e8 8c ab
+    call 016ach                               ; e8 54 a9
     mov byte [bp+00fh], al                    ; 88 46 0f
     mov ax, strict word 00007h                ; b8 07 00
-    call 0165ch                               ; e8 83 ab
+    call 016ach                               ; e8 4b a9
     mov byte [bp+00eh], al                    ; 88 46 0e
     mov ax, strict word 00032h                ; b8 32 00
-    call 0165ch                               ; e8 7a ab
+    call 016ach                               ; e8 42 a9
     mov byte [bp+011h], al                    ; 88 46 11
     mov byte [bp+012h], al                    ; 88 46 12
-    jmp near 06a09h                           ; e9 1e ff
-    call 068eeh                               ; e8 00 fe
+    jmp near 06c91h                           ; e9 1e ff
+    call 06b76h                               ; e8 00 fe
     test ax, ax                               ; 85 c0
-    je short 06af8h                           ; 74 06
-    call 068c6h                               ; e8 d1 fd
-    jmp near 06a09h                           ; e9 11 ff
+    je short 06d80h                           ; 74 06
+    call 06b4eh                               ; e8 d1 fd
+    jmp near 06c91h                           ; e9 11 ff
     movzx dx, byte [bp+010h]                  ; 0f b6 56 10
     mov ax, strict word 00009h                ; b8 09 00
-    call 01679h                               ; e8 77 ab
+    call 016c9h                               ; e8 3f a9
     movzx dx, byte [bp+00fh]                  ; 0f b6 56 0f
     mov ax, strict word 00008h                ; b8 08 00
-    call 01679h                               ; e8 6d ab
+    call 016c9h                               ; e8 35 a9
     movzx dx, byte [bp+00eh]                  ; 0f b6 56 0e
     mov ax, strict word 00007h                ; b8 07 00
-    call 01679h                               ; e8 63 ab
+    call 016c9h                               ; e8 2b a9
     movzx dx, byte [bp+011h]                  ; 0f b6 56 11
     mov ax, strict word 00032h                ; b8 32 00
-    call 01679h                               ; e8 59 ab
+    call 016c9h                               ; e8 21 a9
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 0165ch                               ; e8 36 ab
+    call 016ach                               ; e8 fe a8
     mov bl, al                                ; 88 c3
     and bl, 07fh                              ; 80 e3 7f
-    jmp near 06aa0h                           ; e9 72 ff
+    jmp near 06d28h                           ; e9 72 ff
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 0165ch                               ; e8 28 ab
+    call 016ach                               ; e8 f0 a8
     mov bl, al                                ; 88 c3
     mov word [bp+012h], strict word 00000h    ; c7 46 12 00 00
     test AL, strict byte 020h                 ; a8 20
-    je short 06b42h                           ; 74 03
-    jmp near 06a09h                           ; e9 c7 fe
-    call 068eeh                               ; e8 a9 fd
+    je short 06dcah                           ; 74 03
+    jmp near 06c91h                           ; e9 c7 fe
+    call 06b76h                               ; e8 a9 fd
     test ax, ax                               ; 85 c0
-    je short 06b4ch                           ; 74 03
-    call 068c6h                               ; e8 7a fd
+    je short 06dd4h                           ; 74 03
+    call 06b4eh                               ; e8 7a fd
     movzx dx, byte [bp+00fh]                  ; 0f b6 56 0f
     mov ax, strict word 00001h                ; b8 01 00
-    call 01679h                               ; e8 23 ab
+    call 016c9h                               ; e8 eb a8
     movzx dx, byte [bp+010h]                  ; 0f b6 56 10
     mov ax, strict word 00003h                ; b8 03 00
-    call 01679h                               ; e8 19 ab
+    call 016c9h                               ; e8 e1 a8
     movzx dx, byte [bp+011h]                  ; 0f b6 56 11
     mov ax, strict word 00005h                ; b8 05 00
-    call 01679h                               ; e8 0f ab
+    call 016c9h                               ; e8 d7 a8
     mov dx, 000a1h                            ; ba a1 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -9627,15 +9895,15 @@ _int1a_function:                             ; 0xf69cd LB 0x1c8
     or AL, strict byte 020h                   ; 0c 20
     movzx dx, al                              ; 0f b6 d0
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 01679h                               ; e8 f7 aa
-    jmp near 06a09h                           ; e9 84 fe
+    call 016c9h                               ; e8 bf a8
+    jmp near 06c91h                           ; e9 84 fe
     mov ax, strict word 0000bh                ; b8 0b 00
-    call 0165ch                               ; e8 d1 aa
+    call 016ach                               ; e8 99 a8
     mov bl, al                                ; 88 c3
     and AL, strict byte 057h                  ; 24 57
     movzx dx, al                              ; 0f b6 d0
-    jmp near 06aa3h                           ; e9 0e ff
-send_to_mouse_ctrl_:                         ; 0xf6b95 LB 0x34
+    jmp near 06d2bh                           ; e9 0e ff
+send_to_mouse_ctrl_:                         ; 0xf6e1d LB 0x34
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -9646,11 +9914,11 @@ send_to_mouse_ctrl_:                         ; 0xf6b95 LB 0x34
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 06bb4h                           ; 74 0e
+    je short 06e3ch                           ; 74 0e
     push 008f6h                               ; 68 f6 08
-    push 01182h                               ; 68 82 11
+    push 01170h                               ; 68 70 11
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 71 ad
+    call 01972h                               ; e8 39 ab
     add sp, strict byte 00006h                ; 83 c4 06
     mov AL, strict byte 0d4h                  ; b0 d4
     mov dx, strict word 00064h                ; ba 64 00
@@ -9664,7 +9932,7 @@ send_to_mouse_ctrl_:                         ; 0xf6b95 LB 0x34
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-get_mouse_data_:                             ; 0xf6bc9 LB 0x3b
+get_mouse_data_:                             ; 0xf6e51 LB 0x3b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -9678,15 +9946,15 @@ get_mouse_data_:                             ; 0xf6bc9 LB 0x3b
     ; sub ah, ah                                ; 2a e4
     and ax, strict word 00021h                ; 25 21 00
     cmp ax, strict word 00021h                ; 3d 21 00
-    je short 06beah                           ; 74 07
+    je short 06e72h                           ; 74 07
     test cx, cx                               ; 85 c9
-    je short 06beah                           ; 74 03
+    je short 06e72h                           ; 74 03
     dec cx                                    ; 49
-    jmp short 06bd5h                          ; eb eb
+    jmp short 06e5dh                          ; eb eb
     test cx, cx                               ; 85 c9
-    jne short 06bf2h                          ; 75 04
+    jne short 06e7ah                          ; 75 04
     mov AL, strict byte 001h                  ; b0 01
-    jmp short 06bfdh                          ; eb 0b
+    jmp short 06e85h                          ; eb 0b
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -9698,7 +9966,7 @@ get_mouse_data_:                             ; 0xf6bc9 LB 0x3b
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-set_kbd_command_byte_:                       ; 0xf6c04 LB 0x32
+set_kbd_command_byte_:                       ; 0xf6e8c LB 0x32
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -9709,11 +9977,11 @@ set_kbd_command_byte_:                       ; 0xf6c04 LB 0x32
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 002h                 ; a8 02
-    je short 06c23h                           ; 74 0e
+    je short 06eabh                           ; 74 0e
     push 00900h                               ; 68 00 09
-    push 01182h                               ; 68 82 11
+    push 01170h                               ; 68 70 11
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 02 ad
+    call 01972h                               ; e8 ca aa
     add sp, strict byte 00006h                ; 83 c4 06
     mov AL, strict byte 060h                  ; b0 60
     mov dx, strict word 00064h                ; ba 64 00
@@ -9726,13 +9994,13 @@ set_kbd_command_byte_:                       ; 0xf6c04 LB 0x32
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-_int74_function:                             ; 0xf6c36 LB 0xca
+_int74_function:                             ; 0xf6ebe LB 0xca
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     sub sp, strict byte 00008h                ; 83 ec 08
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 d7 a9
+    call 0166ch                               ; e8 9f a7
     mov cx, ax                                ; 89 c1
     mov word [bp+004h], strict word 00000h    ; c7 46 04 00 00
     mov dx, strict word 00064h                ; ba 64 00
@@ -9741,7 +10009,7 @@ _int74_function:                             ; 0xf6c36 LB 0xca
     ; sub ah, ah                                ; 2a e4
     and AL, strict byte 021h                  ; 24 21
     cmp AL, strict byte 021h                  ; 3c 21
-    jne near 06cech                           ; 0f 85 92 00
+    jne near 06f74h                           ; 0f 85 92 00
     mov dx, strict word 00060h                ; ba 60 00
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -9749,14 +10017,14 @@ _int74_function:                             ; 0xf6c36 LB 0xca
     mov bl, al                                ; 88 c3
     mov dx, strict word 00026h                ; ba 26 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 96 a9
+    call 01650h                               ; e8 5e a7
     mov byte [bp-006h], al                    ; 88 46 fa
     mov dx, strict word 00027h                ; ba 27 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 8b a9
+    call 01650h                               ; e8 53 a7
     mov byte [bp-008h], al                    ; 88 46 f8
     test AL, strict byte 080h                 ; a8 80
-    je short 06cech                           ; 74 70
+    je short 06f74h                           ; 74 70
     mov al, byte [bp-008h]                    ; 8a 46 f8
     and AL, strict byte 007h                  ; 24 07
     mov byte [bp-002h], al                    ; 88 46 fe
@@ -9767,112 +10035,109 @@ _int74_function:                             ; 0xf6c36 LB 0xca
     movzx dx, al                              ; 0f b6 d0
     add dx, strict byte 00028h                ; 83 c2 28
     mov ax, cx                                ; 89 c8
-    call 0160eh                               ; e8 75 a9
+    call 0165eh                               ; e8 3d a7
     mov al, byte [bp-004h]                    ; 8a 46 fc
     cmp al, byte [bp-002h]                    ; 3a 46 fe
-    jc short 06cddh                           ; 72 3c
+    jc short 06f65h                           ; 72 3c
     mov dx, strict word 00028h                ; ba 28 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 57 a9
+    call 01650h                               ; e8 1f a7
     xor ah, ah                                ; 30 e4
     mov word [bp+00ch], ax                    ; 89 46 0c
     mov dx, strict word 00029h                ; ba 29 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 4a a9
+    call 01650h                               ; e8 12 a7
     xor ah, ah                                ; 30 e4
     mov word [bp+00ah], ax                    ; 89 46 0a
     mov dx, strict word 0002ah                ; ba 2a 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 3d a9
+    call 01650h                               ; e8 05 a7
     xor ah, ah                                ; 30 e4
     mov word [bp+008h], ax                    ; 89 46 08
     xor al, al                                ; 30 c0
     mov word [bp+006h], ax                    ; 89 46 06
     mov byte [bp-006h], ah                    ; 88 66 fa
     test byte [bp-008h], 080h                 ; f6 46 f8 80
-    je short 06ce0h                           ; 74 0a
+    je short 06f68h                           ; 74 0a
     mov word [bp+004h], strict word 00001h    ; c7 46 04 01 00
-    jmp short 06ce0h                          ; eb 03
+    jmp short 06f68h                          ; eb 03
     inc byte [bp-006h]                        ; fe 46 fa
     movzx bx, byte [bp-006h]                  ; 0f b6 5e fa
     mov dx, strict word 00026h                ; ba 26 00
     mov ax, cx                                ; 89 c8
-    call 0160eh                               ; e8 22 a9
+    call 0165eh                               ; e8 ea a6
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-    inc sp                                    ; 44
-    insw                                      ; 6d
-    mov dx, 03d6dh                            ; ba 6d 3d
-    outsb                                     ; 6e
-    into                                      ; ce
-    outsb                                     ; 6e
-    cmp AL, strict byte 06fh                  ; 3c 6f
-    nop                                       ; 90
-    insw                                      ; 6d
-    db  064h, 06fh
-    ; fs outsw                                  ; 64 6f
-    db  029h
-    db  070h
-_int15_function_mouse:                       ; 0xf6d00 LB 0x38b
+    int3                                      ; cc
+    outsw                                     ; 6f
+    inc dx                                    ; 42
+    jo short 06f42h                           ; 70 c5
+    jo short 06fd5h                           ; 70 56
+    jno short 06f45h                          ; 71 c4
+    jno short 06f9bh                          ; 71 18
+    jo short 06f71h                           ; 70 ec
+    jno short 06f38h                          ; 71 b1
+    db  072h
+_int15_function_mouse:                       ; 0xf6f88 LB 0x38b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     sub sp, strict byte 00006h                ; 83 ec 06
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 0c a9
+    call 0166ch                               ; e8 d4 a6
     mov cx, ax                                ; 89 c1
     cmp byte [bp+012h], 007h                  ; 80 7e 12 07
-    jbe short 06d23h                          ; 76 0b
+    jbe short 06fabh                          ; 76 0b
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 001h                  ; c6 46 13 01
-    jmp near 07085h                           ; e9 62 03
+    jmp near 0730dh                           ; e9 62 03
     mov ax, strict word 00065h                ; b8 65 00
-    call 06c04h                               ; e8 db fe
+    call 06e8ch                               ; e8 db fe
     and word [bp+018h], strict byte 0fffeh    ; 83 66 18 fe
     mov byte [bp+013h], 000h                  ; c6 46 13 00
     mov al, byte [bp+012h]                    ; 8a 46 12
     cmp AL, strict byte 007h                  ; 3c 07
-    jnbe near 0706ch                          ; 0f 87 32 03
+    jnbe near 072f4h                          ; 0f 87 32 03
     movzx si, al                              ; 0f b6 f0
     add si, si                                ; 01 f6
-    jmp word [cs:si+06cf0h]                   ; 2e ff a4 f0 6c
+    jmp word [cs:si+06f78h]                   ; 2e ff a4 78 6f
     cmp byte [bp+00dh], 001h                  ; 80 7e 0d 01
-    jnbe near 07077h                          ; 0f 87 2b 03
+    jnbe near 072ffh                          ; 0f 87 2b 03
     mov dx, strict word 00027h                ; ba 27 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 ac a8
+    call 01650h                               ; e8 74 a6
     test AL, strict byte 080h                 ; a8 80
-    jne short 06d63h                          ; 75 0b
+    jne short 06febh                          ; 75 0b
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 005h                  ; c6 46 13 05
-    jmp near 0707fh                           ; e9 1c 03
+    jmp near 07307h                           ; e9 1c 03
     cmp byte [bp+00dh], 000h                  ; 80 7e 0d 00
     db  00fh, 094h, 0c0h
     ; sete al                                   ; 0f 94 c0
     add AL, strict byte 0f4h                  ; 04 f4
     xor ah, ah                                ; 30 e4
-    call 06b95h                               ; e8 24 fe
+    call 06e1dh                               ; e8 24 fe
     test al, al                               ; 84 c0
-    jne near 07005h                           ; 0f 85 8e 02
+    jne near 0728dh                           ; 0f 85 8e 02
     mov dx, ss                                ; 8c d2
     lea ax, [bp-008h]                         ; 8d 46 f8
-    call 06bc9h                               ; e8 4a fe
+    call 06e51h                               ; e8 4a fe
     test al, al                               ; 84 c0
-    je near 0707fh                            ; 0f 84 fa 02
+    je near 07307h                            ; 0f 84 fa 02
     cmp byte [bp-008h], 0fah                  ; 80 7e f8 fa
-    jne near 07005h                           ; 0f 85 78 02
-    jmp near 0707fh                           ; e9 ef 02
+    jne near 0728dh                           ; 0f 85 78 02
+    jmp near 07307h                           ; e9 ef 02
     mov al, byte [bp+00dh]                    ; 8a 46 0d
     cmp AL, strict byte 001h                  ; 3c 01
-    jc short 06d9bh                           ; 72 04
+    jc short 07023h                           ; 72 04
     cmp AL, strict byte 008h                  ; 3c 08
-    jbe short 06d9eh                          ; 76 03
-    jmp near 06f31h                           ; e9 93 01
+    jbe short 07026h                          ; 76 03
+    jmp near 071b9h                           ; e9 93 01
     mov dx, strict word 00027h                ; ba 27 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 5a a8
+    call 01650h                               ; e8 22 a6
     mov ah, byte [bp+00dh]                    ; 8a 66 0d
     db  0feh, 0cch
     ; dec ah                                    ; fe cc
@@ -9881,272 +10146,272 @@ _int15_function_mouse:                       ; 0xf6d00 LB 0x38b
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00027h                ; ba 27 00
     mov ax, cx                                ; 89 c8
-    call 0160eh                               ; e8 54 a8
+    call 0165eh                               ; e8 1c a6
     mov dx, strict word 00026h                ; ba 26 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 3e a8
+    call 01650h                               ; e8 06 a6
     and AL, strict byte 0f8h                  ; 24 f8
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00026h                ; ba 26 00
     mov ax, cx                                ; 89 c8
-    call 0160eh                               ; e8 3f a8
+    call 0165eh                               ; e8 07 a6
     mov ax, 000ffh                            ; b8 ff 00
-    call 06b95h                               ; e8 c0 fd
+    call 06e1dh                               ; e8 c0 fd
     test al, al                               ; 84 c0
-    jne near 07005h                           ; 0f 85 2a 02
+    jne near 0728dh                           ; 0f 85 2a 02
     mov dx, ss                                ; 8c d2
     lea ax, [bp-004h]                         ; 8d 46 fc
-    call 06bc9h                               ; e8 e6 fd
+    call 06e51h                               ; e8 e6 fd
     mov cl, al                                ; 88 c1
     cmp byte [bp-004h], 0feh                  ; 80 7e fc fe
-    jne short 06df6h                          ; 75 0b
+    jne short 0707eh                          ; 75 0b
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 004h                  ; c6 46 13 04
-    jmp near 0707fh                           ; e9 89 02
+    jmp near 07307h                           ; e9 89 02
     cmp byte [bp-004h], 0fah                  ; 80 7e fc fa
-    je short 06e0ch                           ; 74 10
+    je short 07094h                           ; 74 10
     movzx ax, byte [bp-004h]                  ; 0f b6 46 fc
     push ax                                   ; 50
     push 0090bh                               ; 68 0b 09
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 19 ab
+    call 01972h                               ; e8 e1 a8
     add sp, strict byte 00006h                ; 83 c4 06
     test cl, cl                               ; 84 c9
-    jne near 07005h                           ; 0f 85 f3 01
+    jne near 0728dh                           ; 0f 85 f3 01
     mov dx, ss                                ; 8c d2
     lea ax, [bp-008h]                         ; 8d 46 f8
-    call 06bc9h                               ; e8 af fd
+    call 06e51h                               ; e8 af fd
     test al, al                               ; 84 c0
-    jne near 07005h                           ; 0f 85 e5 01
+    jne near 0728dh                           ; 0f 85 e5 01
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 06bc9h                               ; e8 a1 fd
+    call 06e51h                               ; e8 a1 fd
     test al, al                               ; 84 c0
-    jne near 07005h                           ; 0f 85 d7 01
+    jne near 0728dh                           ; 0f 85 d7 01
     mov al, byte [bp-008h]                    ; 8a 46 f8
     mov byte [bp+00ch], al                    ; 88 46 0c
     mov al, byte [bp-006h]                    ; 8a 46 fa
     mov byte [bp+00dh], al                    ; 88 46 0d
-    jmp near 0707fh                           ; e9 42 02
+    jmp near 07307h                           ; e9 42 02
     mov al, byte [bp+00dh]                    ; 8a 46 0d
     cmp AL, strict byte 003h                  ; 3c 03
-    jc short 06e54h                           ; 72 10
-    jbe short 06e72h                          ; 76 2c
+    jc short 070dch                           ; 72 10
+    jbe short 070fah                          ; 76 2c
     cmp AL, strict byte 006h                  ; 3c 06
-    je short 06e84h                           ; 74 3a
+    je short 0710ch                           ; 74 3a
     cmp AL, strict byte 005h                  ; 3c 05
-    je short 06e7eh                           ; 74 30
+    je short 07106h                           ; 74 30
     cmp AL, strict byte 004h                  ; 3c 04
-    je short 06e78h                           ; 74 26
-    jmp short 06e8ah                          ; eb 36
+    je short 07100h                           ; 74 26
+    jmp short 07112h                          ; eb 36
     cmp AL, strict byte 002h                  ; 3c 02
-    je short 06e6ch                           ; 74 14
+    je short 070f4h                           ; 74 14
     cmp AL, strict byte 001h                  ; 3c 01
-    je short 06e66h                           ; 74 0a
+    je short 070eeh                           ; 74 0a
     test al, al                               ; 84 c0
-    jne short 06e8ah                          ; 75 2a
+    jne short 07112h                          ; 75 2a
     mov byte [bp-008h], 00ah                  ; c6 46 f8 0a
-    jmp short 06e8eh                          ; eb 28
+    jmp short 07116h                          ; eb 28
     mov byte [bp-008h], 014h                  ; c6 46 f8 14
-    jmp short 06e8eh                          ; eb 22
+    jmp short 07116h                          ; eb 22
     mov byte [bp-008h], 028h                  ; c6 46 f8 28
-    jmp short 06e8eh                          ; eb 1c
+    jmp short 07116h                          ; eb 1c
     mov byte [bp-008h], 03ch                  ; c6 46 f8 3c
-    jmp short 06e8eh                          ; eb 16
+    jmp short 07116h                          ; eb 16
     mov byte [bp-008h], 050h                  ; c6 46 f8 50
-    jmp short 06e8eh                          ; eb 10
+    jmp short 07116h                          ; eb 10
     mov byte [bp-008h], 064h                  ; c6 46 f8 64
-    jmp short 06e8eh                          ; eb 0a
+    jmp short 07116h                          ; eb 0a
     mov byte [bp-008h], 0c8h                  ; c6 46 f8 c8
-    jmp short 06e8eh                          ; eb 04
+    jmp short 07116h                          ; eb 04
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
     cmp byte [bp-008h], 000h                  ; 80 7e f8 00
-    jbe short 06ec3h                          ; 76 2f
+    jbe short 0714bh                          ; 76 2f
     mov ax, 000f3h                            ; b8 f3 00
-    call 06b95h                               ; e8 fb fc
+    call 06e1dh                               ; e8 fb fc
     test al, al                               ; 84 c0
-    jne short 06eb8h                          ; 75 1a
+    jne short 07140h                          ; 75 1a
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 06bc9h                               ; e8 23 fd
+    call 06e51h                               ; e8 23 fd
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
-    call 06b95h                               ; e8 e8 fc
+    call 06e1dh                               ; e8 e8 fc
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 06bc9h                               ; e8 14 fd
-    jmp near 0707fh                           ; e9 c7 01
+    call 06e51h                               ; e8 14 fd
+    jmp near 07307h                           ; e9 c7 01
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 003h                  ; c6 46 13 03
-    jmp near 0707fh                           ; e9 bc 01
+    jmp near 07307h                           ; e9 bc 01
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 002h                  ; c6 46 13 02
-    jmp near 0707fh                           ; e9 b1 01
+    jmp near 07307h                           ; e9 b1 01
     cmp byte [bp+00dh], 004h                  ; 80 7e 0d 04
-    jnc short 06f31h                          ; 73 5d
+    jnc short 071b9h                          ; 73 5d
     mov ax, 000e8h                            ; b8 e8 00
-    call 06b95h                               ; e8 bb fc
+    call 06e1dh                               ; e8 bb fc
     test al, al                               ; 84 c0
-    jne short 06f26h                          ; 75 48
+    jne short 071aeh                          ; 75 48
     mov dx, ss                                ; 8c d2
     lea ax, [bp-008h]                         ; 8d 46 f8
-    call 06bc9h                               ; e8 e3 fc
+    call 06e51h                               ; e8 e3 fc
     cmp byte [bp-008h], 0fah                  ; 80 7e f8 fa
-    je short 06efch                           ; 74 10
+    je short 07184h                           ; 74 10
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     push ax                                   ; 50
     push 00936h                               ; 68 36 09
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 29 aa
+    call 01972h                               ; e8 f1 a7
     add sp, strict byte 00006h                ; 83 c4 06
     movzx ax, byte [bp+00dh]                  ; 0f b6 46 0d
-    call 06b95h                               ; e8 92 fc
+    call 06e1dh                               ; e8 92 fc
     mov dx, ss                                ; 8c d2
     lea ax, [bp-008h]                         ; 8d 46 f8
-    call 06bc9h                               ; e8 be fc
+    call 06e51h                               ; e8 be fc
     cmp byte [bp-008h], 0fah                  ; 80 7e f8 fa
-    je near 0707fh                            ; 0f 84 6c 01
+    je near 07307h                            ; 0f 84 6c 01
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     push ax                                   ; 50
     push 00936h                               ; 68 36 09
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 02 aa
+    call 01972h                               ; e8 ca a7
     add sp, strict byte 00006h                ; 83 c4 06
-    jmp near 0707fh                           ; e9 59 01
+    jmp near 07307h                           ; e9 59 01
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 003h                  ; c6 46 13 03
-    jmp near 0707fh                           ; e9 4e 01
+    jmp near 07307h                           ; e9 4e 01
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 002h                  ; c6 46 13 02
-    jmp near 0707fh                           ; e9 43 01
+    jmp near 07307h                           ; e9 43 01
     mov ax, 000f2h                            ; b8 f2 00
-    call 06b95h                               ; e8 53 fc
+    call 06e1dh                               ; e8 53 fc
     test al, al                               ; 84 c0
-    jne short 06f59h                          ; 75 13
+    jne short 071e1h                          ; 75 13
     mov dx, ss                                ; 8c d2
     lea ax, [bp-008h]                         ; 8d 46 f8
-    call 06bc9h                               ; e8 7b fc
+    call 06e51h                               ; e8 7b fc
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 06bc9h                               ; e8 73 fc
-    jmp near 06e34h                           ; e9 db fe
+    call 06e51h                               ; e8 73 fc
+    jmp near 070bch                           ; e9 db fe
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 003h                  ; c6 46 13 03
-    jmp near 0707fh                           ; e9 1b 01
+    jmp near 07307h                           ; e9 1b 01
     mov al, byte [bp+00dh]                    ; 8a 46 0d
     test al, al                               ; 84 c0
-    jbe short 06f72h                          ; 76 07
+    jbe short 071fah                          ; 76 07
     cmp AL, strict byte 002h                  ; 3c 02
-    jbe short 06fdbh                          ; 76 6c
-    jmp near 0700fh                           ; e9 9d 00
+    jbe short 07263h                          ; 76 6c
+    jmp near 07297h                           ; e9 9d 00
     mov ax, 000e9h                            ; b8 e9 00
-    call 06b95h                               ; e8 1d fc
+    call 06e1dh                               ; e8 1d fc
     test al, al                               ; 84 c0
-    jne near 07005h                           ; 0f 85 87 00
+    jne near 0728dh                           ; 0f 85 87 00
     mov dx, ss                                ; 8c d2
     lea ax, [bp-008h]                         ; 8d 46 f8
-    call 06bc9h                               ; e8 43 fc
+    call 06e51h                               ; e8 43 fc
     mov cl, al                                ; 88 c1
     cmp byte [bp-008h], 0fah                  ; 80 7e f8 fa
-    je short 06f9eh                           ; 74 10
+    je short 07226h                           ; 74 10
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     push ax                                   ; 50
     push 00936h                               ; 68 36 09
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 87 a9
+    call 01972h                               ; e8 4f a7
     add sp, strict byte 00006h                ; 83 c4 06
     test cl, cl                               ; 84 c9
-    jne short 07005h                          ; 75 63
+    jne short 0728dh                          ; 75 63
     mov dx, ss                                ; 8c d2
     lea ax, [bp-008h]                         ; 8d 46 f8
-    call 06bc9h                               ; e8 1f fc
+    call 06e51h                               ; e8 1f fc
     test al, al                               ; 84 c0
-    jne short 07005h                          ; 75 57
+    jne short 0728dh                          ; 75 57
     mov dx, ss                                ; 8c d2
     lea ax, [bp-006h]                         ; 8d 46 fa
-    call 06bc9h                               ; e8 13 fc
+    call 06e51h                               ; e8 13 fc
     test al, al                               ; 84 c0
-    jne short 07005h                          ; 75 4b
+    jne short 0728dh                          ; 75 4b
     mov dx, ss                                ; 8c d2
     lea ax, [bp-004h]                         ; 8d 46 fc
-    call 06bc9h                               ; e8 07 fc
+    call 06e51h                               ; e8 07 fc
     test al, al                               ; 84 c0
-    jne short 07005h                          ; 75 3f
+    jne short 0728dh                          ; 75 3f
     mov al, byte [bp-008h]                    ; 8a 46 f8
     mov byte [bp+00ch], al                    ; 88 46 0c
     mov al, byte [bp-006h]                    ; 8a 46 fa
     mov byte [bp+010h], al                    ; 88 46 10
     mov al, byte [bp-004h]                    ; 8a 46 fc
     mov byte [bp+00eh], al                    ; 88 46 0e
-    jmp near 0707fh                           ; e9 a4 00
+    jmp near 07307h                           ; e9 a4 00
     cmp AL, strict byte 001h                  ; 3c 01
-    jne short 06fe4h                          ; 75 05
+    jne short 0726ch                          ; 75 05
     mov ax, 000e6h                            ; b8 e6 00
-    jmp short 06fe7h                          ; eb 03
+    jmp short 0726fh                          ; eb 03
     mov ax, 000e7h                            ; b8 e7 00
-    call 06b95h                               ; e8 ab fb
+    call 06e1dh                               ; e8 ab fb
     mov cl, al                                ; 88 c1
     test cl, cl                               ; 84 c9
-    jne short 06fffh                          ; 75 0f
+    jne short 07287h                          ; 75 0f
     mov dx, ss                                ; 8c d2
     lea ax, [bp-008h]                         ; 8d 46 f8
-    call 06bc9h                               ; e8 d1 fb
+    call 06e51h                               ; e8 d1 fb
     cmp byte [bp-008h], 0fah                  ; 80 7e f8 fa
     db  00fh, 095h, 0c1h
     ; setne cl                                  ; 0f 95 c1
     test cl, cl                               ; 84 c9
-    je near 0707fh                            ; 0f 84 7a 00
+    je near 07307h                            ; 0f 84 7a 00
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 003h                  ; c6 46 13 03
-    jmp short 0707fh                          ; eb 70
+    jmp short 07307h                          ; eb 70
     movzx ax, byte [bp+00dh]                  ; 0f b6 46 0d
     push ax                                   ; 50
     push 00962h                               ; 68 62 09
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 06 a9
+    call 01972h                               ; e8 ce a6
     add sp, strict byte 00006h                ; 83 c4 06
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 001h                  ; c6 46 13 01
-    jmp short 0707fh                          ; eb 56
+    jmp short 07307h                          ; eb 56
     mov si, word [bp+00ch]                    ; 8b 76 0c
     mov bx, si                                ; 89 f3
     mov dx, strict word 00022h                ; ba 22 00
     mov ax, cx                                ; 89 c8
-    call 0162ah                               ; e8 f4 a5
+    call 0167ah                               ; e8 bc a3
     mov bx, word [bp+014h]                    ; 8b 5e 14
     mov dx, strict word 00024h                ; ba 24 00
     mov ax, cx                                ; 89 c8
-    call 0162ah                               ; e8 e9 a5
+    call 0167ah                               ; e8 b1 a3
     mov dx, strict word 00027h                ; ba 27 00
     mov ax, cx                                ; 89 c8
-    call 01600h                               ; e8 b7 a5
+    call 01650h                               ; e8 7f a3
     mov ah, al                                ; 88 c4
     test si, si                               ; 85 f6
-    jne short 0705dh                          ; 75 0e
+    jne short 072e5h                          ; 75 0e
     cmp word [bp+014h], strict byte 00000h    ; 83 7e 14 00
-    jne short 0705dh                          ; 75 08
+    jne short 072e5h                          ; 75 08
     test AL, strict byte 080h                 ; a8 80
-    je short 0705fh                           ; 74 06
+    je short 072e7h                           ; 74 06
     and AL, strict byte 07fh                  ; 24 7f
-    jmp short 0705fh                          ; eb 02
+    jmp short 072e7h                          ; eb 02
     or AL, strict byte 080h                   ; 0c 80
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00027h                ; ba 27 00
     mov ax, cx                                ; 89 c8
-    call 0160eh                               ; e8 a4 a5
-    jmp short 0707fh                          ; eb 13
+    call 0165eh                               ; e8 6c a3
+    jmp short 07307h                          ; eb 13
     push 0097ch                               ; 68 7c 09
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 ae a8
+    call 01972h                               ; e8 76 a6
     add sp, strict byte 00004h                ; 83 c4 04
     or word [bp+018h], strict byte 00001h     ; 83 4e 18 01
     mov byte [bp+013h], 001h                  ; c6 46 13 01
     mov ax, strict word 00047h                ; b8 47 00
-    call 06c04h                               ; e8 7f fb
+    call 06e8ch                               ; e8 7f fb
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-_int17_function:                             ; 0xf708b LB 0xb3
+_int17_function:                             ; 0xf7313 LB 0xb3
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -10156,24 +10421,24 @@ _int17_function:                             ; 0xf708b LB 0xb3
     add dx, dx                                ; 01 d2
     add dx, strict byte 00008h                ; 83 c2 08
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 7d a5
+    call 0166ch                               ; e8 45 a3
     mov bx, ax                                ; 89 c3
     mov si, ax                                ; 89 c6
     cmp byte [bp+013h], 003h                  ; 80 7e 13 03
-    jnc near 07134h                           ; 0f 83 89 00
+    jnc near 073bch                           ; 0f 83 89 00
     mov ax, word [bp+00eh]                    ; 8b 46 0e
     cmp ax, strict word 00003h                ; 3d 03 00
-    jnc near 07134h                           ; 0f 83 7f 00
+    jnc near 073bch                           ; 0f 83 7f 00
     test bx, bx                               ; 85 db
-    jbe near 07134h                           ; 0f 86 79 00
+    jbe near 073bch                           ; 0f 86 79 00
     mov dx, ax                                ; 89 c2
     add dx, strict byte 00078h                ; 83 c2 78
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 3a a5
+    call 01650h                               ; e8 02 a3
     movzx cx, al                              ; 0f b6 c8
     sal cx, 008h                              ; c1 e1 08
     cmp byte [bp+013h], 000h                  ; 80 7e 13 00
-    jne short 070ffh                          ; 75 2d
+    jne short 07387h                          ; 75 2d
     mov al, byte [bp+012h]                    ; 8a 46 12
     mov dx, bx                                ; 89 da
     out DX, AL                                ; ee
@@ -10193,13 +10458,13 @@ _int17_function:                             ; 0xf708b LB 0xb3
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 040h                 ; a8 40
-    je short 070ffh                           ; 74 07
+    je short 07387h                           ; 74 07
     test cx, cx                               ; 85 c9
-    je short 070ffh                           ; 74 03
+    je short 07387h                           ; 74 03
     dec cx                                    ; 49
-    jmp short 070eeh                          ; eb ef
+    jmp short 07376h                          ; eb ef
     cmp byte [bp+013h], 001h                  ; 80 7e 13 01
-    jne short 0711bh                          ; 75 16
+    jne short 073a3h                          ; 75 16
     lea dx, [si+002h]                         ; 8d 54 02
     in AL, DX                                 ; ec
     db  02ah, 0e4h
@@ -10218,16 +10483,16 @@ _int17_function:                             ; 0xf708b LB 0xb3
     xor AL, strict byte 048h                  ; 34 48
     mov byte [bp+013h], al                    ; 88 46 13
     test cx, cx                               ; 85 c9
-    jne short 0712eh                          ; 75 04
+    jne short 073b6h                          ; 75 04
     or byte [bp+013h], 001h                   ; 80 4e 13 01
     and byte [bp+01ch], 0feh                  ; 80 66 1c fe
-    jmp short 07138h                          ; eb 04
+    jmp short 073c0h                          ; eb 04
     or byte [bp+01ch], 001h                   ; 80 4e 1c 01
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-wait_:                                       ; 0xf713e LB 0xb2
+wait_:                                       ; 0xf73c6 LB 0xb2
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -10245,28 +10510,28 @@ wait_:                                       ; 0xf713e LB 0xb2
     xor cx, cx                                ; 31 c9
     mov dx, 0046ch                            ; ba 6c 04
     xor ax, ax                                ; 31 c0
-    call 01638h                               ; e8 d7 a4
+    call 01688h                               ; e8 9f a2
     mov word [bp-00eh], ax                    ; 89 46 f2
     mov bx, dx                                ; 89 d3
     hlt                                       ; f4
     mov dx, 0046ch                            ; ba 6c 04
     xor ax, ax                                ; 31 c0
-    call 01638h                               ; e8 c9 a4
+    call 01688h                               ; e8 91 a2
     mov word [bp-012h], ax                    ; 89 46 ee
     mov di, dx                                ; 89 d7
     cmp dx, bx                                ; 39 da
-    jnbe short 0717fh                         ; 77 07
-    jne short 07186h                          ; 75 0c
+    jnbe short 07407h                         ; 77 07
+    jne short 0740eh                          ; 75 0c
     cmp ax, word [bp-00eh]                    ; 3b 46 f2
-    jbe short 07186h                          ; 76 07
+    jbe short 0740eh                          ; 76 07
     sub ax, word [bp-00eh]                    ; 2b 46 f2
     sbb dx, bx                                ; 19 da
-    jmp short 07191h                          ; eb 0b
+    jmp short 07419h                          ; eb 0b
     cmp dx, bx                                ; 39 da
-    jc short 07191h                           ; 72 07
-    jne short 07195h                          ; 75 09
+    jc short 07419h                           ; 72 07
+    jne short 0741dh                          ; 75 09
     cmp ax, word [bp-00eh]                    ; 3b 46 f2
-    jnc short 07195h                          ; 73 04
+    jnc short 0741dh                          ; 73 04
     sub si, ax                                ; 29 c6
     sbb cx, dx                                ; 19 d1
     mov ax, word [bp-012h]                    ; 8b 46 ee
@@ -10274,13 +10539,13 @@ wait_:                                       ; 0xf713e LB 0xb2
     mov bx, di                                ; 89 fb
     mov ax, 00100h                            ; b8 00 01
     int 016h                                  ; cd 16
-    je near 071abh                            ; 0f 84 05 00
+    je near 07433h                            ; 0f 84 05 00
     mov AL, strict byte 001h                  ; b0 01
-    jmp near 071adh                           ; e9 02 00
+    jmp near 07435h                           ; e9 02 00
     db  032h, 0c0h
     ; xor al, al                                ; 32 c0
     test al, al                               ; 84 c0
-    je short 071d5h                           ; 74 24
+    je short 0745dh                           ; 74 24
     db  033h, 0c0h
     ; xor ax, ax                                ; 33 c0
     int 016h                                  ; cd 16
@@ -10291,17 +10556,17 @@ wait_:                                       ; 0xf713e LB 0xb2
     push ax                                   ; 50
     push 0099eh                               ; 68 9e 09
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 5a a7
+    call 01972h                               ; e8 22 a5
     add sp, strict byte 00006h                ; 83 c4 06
     cmp byte [bp-00ch], 000h                  ; 80 7e f4 00
-    je short 071d5h                           ; 74 04
+    je short 0745dh                           ; 74 04
     mov al, dl                                ; 88 d0
-    jmp short 071e7h                          ; eb 12
+    jmp short 0746fh                          ; eb 12
     test cx, cx                               ; 85 c9
-    jnle short 07166h                         ; 7f 8d
-    jne short 071dfh                          ; 75 04
+    jnle short 073eeh                         ; 7f 8d
+    jne short 07467h                          ; 75 04
     test si, si                               ; 85 f6
-    jnbe short 07166h                         ; 77 87
+    jnbe short 073eeh                         ; 77 87
     mov ax, word [bp-010h]                    ; 8b 46 f0
     push ax                                   ; 50
     popfw                                     ; 9d
@@ -10313,7 +10578,7 @@ wait_:                                       ; 0xf713e LB 0xb2
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-read_logo_byte_:                             ; 0xf71f0 LB 0x16
+read_logo_byte_:                             ; 0xf7478 LB 0x16
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
@@ -10328,7 +10593,7 @@ read_logo_byte_:                             ; 0xf71f0 LB 0x16
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-read_logo_word_:                             ; 0xf7206 LB 0x14
+read_logo_word_:                             ; 0xf748e LB 0x14
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push dx                                   ; 52
@@ -10341,7 +10606,7 @@ read_logo_word_:                             ; 0xf7206 LB 0x14
     pop dx                                    ; 5a
     pop bp                                    ; 5d
     retn                                      ; c3
-print_detected_harddisks_:                   ; 0xf721a LB 0x130
+print_detected_harddisks_:                   ; 0xf74a2 LB 0x130
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -10353,29 +10618,29 @@ print_detected_harddisks_:                   ; 0xf721a LB 0x130
     push ax                                   ; 50
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 ef a3
+    call 0166ch                               ; e8 b7 a1
     mov si, ax                                ; 89 c6
     mov byte [bp-00ch], 000h                  ; c6 46 f4 00
     xor cl, cl                                ; 30 c9
     xor ch, ch                                ; 30 ed
     mov dx, 002c0h                            ; ba c0 02
-    call 01600h                               ; e8 c3 a3
+    call 01650h                               ; e8 8b a1
     mov byte [bp-00eh], al                    ; 88 46 f2
     xor bl, bl                                ; 30 db
     cmp bl, byte [bp-00eh]                    ; 3a 5e f2
-    jnc near 0731ch                           ; 0f 83 d3 00
+    jnc near 075a4h                           ; 0f 83 d3 00
     movzx dx, bl                              ; 0f b6 d3
     add dx, 002c1h                            ; 81 c2 c1 02
     mov ax, si                                ; 89 f0
-    call 01600h                               ; e8 ab a3
+    call 01650h                               ; e8 73 a1
     mov bh, al                                ; 88 c7
     cmp AL, strict byte 00ch                  ; 3c 0c
-    jc short 0727fh                           ; 72 24
+    jc short 07507h                           ; 72 24
     test cl, cl                               ; 84 c9
-    jne short 0726ch                          ; 75 0d
+    jne short 074f4h                          ; 75 0d
     push 009afh                               ; 68 af 09
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 bb a6
+    call 01972h                               ; e8 83 a4
     add sp, strict byte 00004h                ; 83 c4 04
     mov CL, strict byte 001h                  ; b1 01
     movzx ax, bl                              ; 0f b6 c3
@@ -10383,36 +10648,36 @@ print_detected_harddisks_:                   ; 0xf721a LB 0x130
     push ax                                   ; 50
     push 009c4h                               ; 68 c4 09
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 a9 a6
+    call 01972h                               ; e8 71 a4
     add sp, strict byte 00006h                ; 83 c4 06
-    jmp near 07317h                           ; e9 98 00
+    jmp near 0759fh                           ; e9 98 00
     cmp AL, strict byte 008h                  ; 3c 08
-    jc short 07296h                           ; 72 13
+    jc short 0751eh                           ; 72 13
     test ch, ch                               ; 84 ed
-    jne short 07294h                          ; 75 0d
+    jne short 0751ch                          ; 75 0d
     push 009d7h                               ; 68 d7 09
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 93 a6
+    call 01972h                               ; e8 5b a4
     add sp, strict byte 00004h                ; 83 c4 04
     mov CH, strict byte 001h                  ; b5 01
-    jmp short 0726ch                          ; eb d6
+    jmp short 074f4h                          ; eb d6
     cmp AL, strict byte 004h                  ; 3c 04
-    jnc short 072b1h                          ; 73 17
+    jnc short 07539h                          ; 73 17
     cmp byte [bp-00ch], 000h                  ; 80 7e f4 00
-    jne short 072b1h                          ; 75 11
+    jne short 07539h                          ; 75 11
     push 009ech                               ; 68 ec 09
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 7a a6
+    call 01972h                               ; e8 42 a4
     add sp, strict byte 00004h                ; 83 c4 04
     mov byte [bp-00ch], 001h                  ; c6 46 f4 01
-    jmp short 072c7h                          ; eb 16
+    jmp short 0754fh                          ; eb 16
     cmp bh, 004h                              ; 80 ff 04
-    jc short 072c7h                           ; 72 11
+    jc short 0754fh                           ; 72 11
     test cl, cl                               ; 84 c9
-    jne short 072c7h                          ; 75 0d
+    jne short 0754fh                          ; 75 0d
     push 009feh                               ; 68 fe 09
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 60 a6
+    call 01972h                               ; e8 28 a4
     add sp, strict byte 00004h                ; 83 c4 04
     mov CL, strict byte 001h                  ; b1 01
     movzx ax, bl                              ; 0f b6 c3
@@ -10420,10 +10685,10 @@ print_detected_harddisks_:                   ; 0xf721a LB 0x130
     push ax                                   ; 50
     push 00a12h                               ; 68 12 0a
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 4e a6
+    call 01972h                               ; e8 16 a4
     add sp, strict byte 00006h                ; 83 c4 06
     cmp bh, 004h                              ; 80 ff 04
-    jc short 072dfh                           ; 72 03
+    jc short 07567h                           ; 72 03
     sub bh, 004h                              ; 80 ef 04
     movzx ax, bh                              ; 0f b6 c7
     cwd                                       ; 99
@@ -10431,41 +10696,41 @@ print_detected_harddisks_:                   ; 0xf721a LB 0x130
     ; sub ax, dx                                ; 2b c2
     sar ax, 1                                 ; d1 f8
     test ax, ax                               ; 85 c0
-    je short 072f0h                           ; 74 05
+    je short 07578h                           ; 74 05
     push 00a1ch                               ; 68 1c 0a
-    jmp short 072f3h                          ; eb 03
+    jmp short 0757bh                          ; eb 03
     push 00a27h                               ; 68 27 0a
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 2a a6
+    call 01972h                               ; e8 f2 a3
     add sp, strict byte 00004h                ; 83 c4 04
     movzx ax, bh                              ; 0f b6 c7
     mov di, strict word 00002h                ; bf 02 00
     cwd                                       ; 99
     idiv di                                   ; f7 ff
     test dx, dx                               ; 85 d2
-    je short 0730dh                           ; 74 05
+    je short 07595h                           ; 74 05
     push 00a30h                               ; 68 30 0a
-    jmp short 07310h                          ; eb 03
+    jmp short 07598h                          ; eb 03
     push 00a36h                               ; 68 36 0a
     push di                                   ; 57
-    call 01922h                               ; e8 0e a6
+    call 01972h                               ; e8 d6 a3
     add sp, strict byte 00004h                ; 83 c4 04
     db  0feh, 0c3h
     ; inc bl                                    ; fe c3
-    jmp near 07242h                           ; e9 26 ff
+    jmp near 074cah                           ; e9 26 ff
     cmp byte [bp-00ch], 000h                  ; 80 7e f4 00
-    jne short 07335h                          ; 75 13
+    jne short 075bdh                          ; 75 13
     test cl, cl                               ; 84 c9
-    jne short 07335h                          ; 75 0f
+    jne short 075bdh                          ; 75 0f
     test ch, ch                               ; 84 ed
-    jne short 07335h                          ; 75 0b
+    jne short 075bdh                          ; 75 0b
     push 00a3dh                               ; 68 3d 0a
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 f0 a5
+    call 01972h                               ; e8 b8 a3
     add sp, strict byte 00004h                ; 83 c4 04
     push 00a51h                               ; 68 51 0a
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 e5 a5
+    call 01972h                               ; e8 ad a3
     add sp, strict byte 00004h                ; 83 c4 04
     lea sp, [bp-00ah]                         ; 8d 66 f6
     pop di                                    ; 5f
@@ -10475,7 +10740,7 @@ print_detected_harddisks_:                   ; 0xf721a LB 0x130
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-get_boot_drive_:                             ; 0xf734a LB 0x28
+get_boot_drive_:                             ; 0xf75d2 LB 0x28
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -10483,12 +10748,12 @@ get_boot_drive_:                             ; 0xf734a LB 0x28
     mov bl, al                                ; 88 c3
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 c2 a2
+    call 0166ch                               ; e8 8a a0
     mov dx, 002c0h                            ; ba c0 02
-    call 01600h                               ; e8 a0 a2
+    call 01650h                               ; e8 68 a0
     sub bl, 002h                              ; 80 eb 02
     cmp bl, al                                ; 38 c3
-    jc short 07369h                           ; 72 02
+    jc short 075f1h                           ; 72 02
     mov BL, strict byte 0ffh                  ; b3 ff
     mov al, bl                                ; 88 d8
     lea sp, [bp-004h]                         ; 8d 66 fc
@@ -10496,7 +10761,7 @@ get_boot_drive_:                             ; 0xf734a LB 0x28
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-show_logo_:                                  ; 0xf7372 LB 0x224
+show_logo_:                                  ; 0xf75fa LB 0x224
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -10507,7 +10772,7 @@ show_logo_:                                  ; 0xf7372 LB 0x224
     sub sp, strict byte 0000ch                ; 83 ec 0c
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 96 a2
+    call 0166ch                               ; e8 5e a0
     mov si, ax                                ; 89 c6
     xor cl, cl                                ; 30 c9
     xor dx, dx                                ; 31 d2
@@ -10518,9 +10783,9 @@ show_logo_:                                  ; 0xf7372 LB 0x224
     mov AL, strict byte 048h                  ; b0 48
     out strict byte 040h, AL                  ; e6 40
     movzx ax, dl                              ; 0f b6 c2
-    call 07206h                               ; e8 68 fe
+    call 0748eh                               ; e8 68 fe
     cmp ax, 066bbh                            ; 3d bb 66
-    jne near 07476h                           ; 0f 85 d1 00
+    jne near 076feh                           ; 0f 85 d1 00
     push SS                                   ; 16
     pop ES                                    ; 07
     lea di, [bp-016h]                         ; 8d 7e ea
@@ -10528,119 +10793,119 @@ show_logo_:                                  ; 0xf7372 LB 0x224
     int 010h                                  ; cd 10
     mov word [es:di], bx                      ; 26 89 1d
     cmp ax, strict word 0004fh                ; 3d 4f 00
-    jne near 07476h                           ; 0f 85 bd 00
+    jne near 076feh                           ; 0f 85 bd 00
     mov al, dl                                ; 88 d0
     add AL, strict byte 004h                  ; 04 04
     xor ah, ah                                ; 30 e4
-    call 071f0h                               ; e8 2e fe
+    call 07478h                               ; e8 2e fe
     mov ch, al                                ; 88 c5
     mov byte [bp-00ch], al                    ; 88 46 f4
     mov al, dl                                ; 88 d0
     add AL, strict byte 005h                  ; 04 05
     xor ah, ah                                ; 30 e4
-    call 071f0h                               ; e8 20 fe
+    call 07478h                               ; e8 20 fe
     mov dh, al                                ; 88 c6
     mov byte [bp-010h], al                    ; 88 46 f0
     mov al, dl                                ; 88 d0
     add AL, strict byte 002h                  ; 04 02
     xor ah, ah                                ; 30 e4
-    call 07206h                               ; e8 28 fe
+    call 0748eh                               ; e8 28 fe
     mov bx, ax                                ; 89 c3
     mov word [bp-014h], ax                    ; 89 46 ec
     mov al, dl                                ; 88 d0
     add AL, strict byte 006h                  ; 04 06
     xor ah, ah                                ; 30 e4
-    call 071f0h                               ; e8 04 fe
+    call 07478h                               ; e8 04 fe
     mov byte [bp-012h], al                    ; 88 46 ee
     test ch, ch                               ; 84 ed
-    jne short 073fdh                          ; 75 0a
+    jne short 07685h                          ; 75 0a
     test dh, dh                               ; 84 f6
-    jne short 073fdh                          ; 75 06
+    jne short 07685h                          ; 75 06
     test bx, bx                               ; 85 db
-    je near 07476h                            ; 0f 84 79 00
+    je near 076feh                            ; 0f 84 79 00
     mov bx, 00142h                            ; bb 42 01
     mov ax, 04f02h                            ; b8 02 4f
     int 010h                                  ; cd 10
     cmp byte [bp-00ch], 000h                  ; 80 7e f4 00
-    je short 0742eh                           ; 74 23
+    je short 076b6h                           ; 74 23
     xor bx, bx                                ; 31 db
-    jmp short 07415h                          ; eb 06
+    jmp short 0769dh                          ; eb 06
     inc bx                                    ; 43
     cmp bx, strict byte 00010h                ; 83 fb 10
-    jnbe short 07435h                         ; 77 20
+    jnbe short 076bdh                         ; 77 20
     mov ax, bx                                ; 89 d8
     or ah, 002h                               ; 80 cc 02
     mov dx, 003b8h                            ; ba b8 03
     out DX, ax                                ; ef
     xor dx, dx                                ; 31 d2
     mov ax, strict word 00001h                ; b8 01 00
-    call 0713eh                               ; e8 18 fd
+    call 073c6h                               ; e8 18 fd
     cmp AL, strict byte 086h                  ; 3c 86
-    jne short 0740fh                          ; 75 e5
+    jne short 07697h                          ; 75 e5
     mov CL, strict byte 001h                  ; b1 01
-    jmp short 07435h                          ; eb 07
+    jmp short 076bdh                          ; eb 07
     mov ax, 00210h                            ; b8 10 02
     mov dx, 003b8h                            ; ba b8 03
     out DX, ax                                ; ef
     test cl, cl                               ; 84 c9
-    jne short 0744bh                          ; 75 12
+    jne short 076d3h                          ; 75 12
     mov ax, word [bp-014h]                    ; 8b 46 ec
     shr ax, 004h                              ; c1 e8 04
     mov dx, strict word 00001h                ; ba 01 00
-    call 0713eh                               ; e8 f9 fc
+    call 073c6h                               ; e8 f9 fc
     cmp AL, strict byte 086h                  ; 3c 86
-    jne short 0744bh                          ; 75 02
+    jne short 076d3h                          ; 75 02
     mov CL, strict byte 001h                  ; b1 01
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    je short 07476h                           ; 74 25
+    je short 076feh                           ; 74 25
     test cl, cl                               ; 84 c9
-    jne short 07476h                          ; 75 21
+    jne short 076feh                          ; 75 21
     mov bx, strict word 00010h                ; bb 10 00
-    jmp short 0745fh                          ; eb 05
+    jmp short 076e7h                          ; eb 05
     dec bx                                    ; 4b
     test bx, bx                               ; 85 db
-    jbe short 07476h                          ; 76 17
+    jbe short 076feh                          ; 76 17
     mov ax, bx                                ; 89 d8
     or ah, 002h                               ; 80 cc 02
     mov dx, 003b8h                            ; ba b8 03
     out DX, ax                                ; ef
     xor dx, dx                                ; 31 d2
     mov ax, strict word 00001h                ; b8 01 00
-    call 0713eh                               ; e8 ce fc
+    call 073c6h                               ; e8 ce fc
     cmp AL, strict byte 086h                  ; 3c 86
-    jne short 0745ah                          ; 75 e6
+    jne short 076e2h                          ; 75 e6
     mov CL, strict byte 001h                  ; b1 01
     xor bx, bx                                ; 31 db
     mov dx, 00339h                            ; ba 39 03
     mov ax, si                                ; 89 f0
-    call 0160eh                               ; e8 8e a1
+    call 0165eh                               ; e8 56 9f
     mov AL, strict byte 003h                  ; b0 03
     mov AH, strict byte 000h                  ; b4 00
     int 010h                                  ; cd 10
     cmp byte [bp-012h], 000h                  ; 80 7e ee 00
-    je near 07577h                            ; 0f 84 e9 00
+    je near 077ffh                            ; 0f 84 e9 00
     cmp byte [bp-00ch], 000h                  ; 80 7e f4 00
-    jne short 074c4h                          ; 75 30
+    jne short 0774ch                          ; 75 30
     cmp byte [bp-010h], 000h                  ; 80 7e f0 00
-    jne short 074c4h                          ; 75 2a
+    jne short 0774ch                          ; 75 2a
     cmp word [bp-014h], strict byte 00000h    ; 83 7e ec 00
-    jne short 074c4h                          ; 75 24
+    jne short 0774ch                          ; 75 24
     cmp byte [bp-012h], 002h                  ; 80 7e ee 02
-    jne short 074b1h                          ; 75 0b
+    jne short 07739h                          ; 75 0b
     push 00a53h                               ; 68 53 0a
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 74 a4
+    call 01972h                               ; e8 3c a2
     add sp, strict byte 00004h                ; 83 c4 04
     test cl, cl                               ; 84 c9
-    jne short 074c4h                          ; 75 0f
+    jne short 0774ch                          ; 75 0f
     mov dx, strict word 00001h                ; ba 01 00
     mov ax, 000c0h                            ; b8 c0 00
-    call 0713eh                               ; e8 80 fc
+    call 073c6h                               ; e8 80 fc
     cmp AL, strict byte 086h                  ; 3c 86
-    jne short 074c4h                          ; 75 02
+    jne short 0774ch                          ; 75 02
     mov CL, strict byte 001h                  ; b1 01
     test cl, cl                               ; 84 c9
-    je near 07577h                            ; 0f 84 ad 00
+    je near 077ffh                            ; 0f 84 ad 00
     mov byte [bp-00eh], 000h                  ; c6 46 f2 00
     mov ax, 00100h                            ; b8 00 01
     mov cx, 01000h                            ; b9 00 10
@@ -10659,54 +10924,54 @@ show_logo_:                                  ; 0xf7372 LB 0x224
     int 010h                                  ; cd 10
     push 00a75h                               ; 68 75 0a
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 2f a4
+    call 01972h                               ; e8 f7 a1
     add sp, strict byte 00004h                ; 83 c4 04
-    call 0721ah                               ; e8 21 fd
+    call 074a2h                               ; e8 21 fd
     push 00ab9h                               ; 68 b9 0a
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 21 a4
+    call 01972h                               ; e8 e9 a1
     add sp, strict byte 00004h                ; 83 c4 04
     mov dx, strict word 00001h                ; ba 01 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0713eh                               ; e8 31 fc
+    call 073c6h                               ; e8 31 fc
     mov bl, al                                ; 88 c3
     test al, al                               ; 84 c0
-    je short 07504h                           ; 74 f1
+    je short 0778ch                           ; 74 f1
     cmp AL, strict byte 030h                  ; 3c 30
-    je short 07565h                           ; 74 4e
+    je short 077edh                           ; 74 4e
     cmp bl, 002h                              ; 80 fb 02
-    jc short 0753eh                           ; 72 22
+    jc short 077c6h                           ; 72 22
     cmp bl, 009h                              ; 80 fb 09
-    jnbe short 0753eh                         ; 77 1d
+    jnbe short 077c6h                         ; 77 1d
     movzx ax, bl                              ; 0f b6 c3
-    call 0734ah                               ; e8 23 fe
+    call 075d2h                               ; e8 23 fe
     cmp AL, strict byte 0ffh                  ; 3c ff
-    jne short 0752dh                          ; 75 02
-    jmp short 07504h                          ; eb d7
+    jne short 077b5h                          ; 75 02
+    jmp short 0778ch                          ; eb d7
     movzx bx, al                              ; 0f b6 d8
     mov dx, 00338h                            ; ba 38 03
     mov ax, si                                ; 89 f0
-    call 0160eh                               ; e8 d6 a0
+    call 0165eh                               ; e8 9e 9e
     mov byte [bp-00eh], 002h                  ; c6 46 f2 02
-    jmp short 07565h                          ; eb 27
+    jmp short 077edh                          ; eb 27
     cmp bl, 02eh                              ; 80 fb 2e
-    je short 07553h                           ; 74 10
+    je short 077dbh                           ; 74 10
     cmp bl, 026h                              ; 80 fb 26
-    je short 07559h                           ; 74 11
+    je short 077e1h                           ; 74 11
     cmp bl, 021h                              ; 80 fb 21
-    jne short 0755fh                          ; 75 12
+    jne short 077e7h                          ; 75 12
     mov byte [bp-00eh], 001h                  ; c6 46 f2 01
-    jmp short 07565h                          ; eb 12
+    jmp short 077edh                          ; eb 12
     mov byte [bp-00eh], 003h                  ; c6 46 f2 03
-    jmp short 07565h                          ; eb 0c
+    jmp short 077edh                          ; eb 0c
     mov byte [bp-00eh], 004h                  ; c6 46 f2 04
-    jmp short 07565h                          ; eb 06
+    jmp short 077edh                          ; eb 06
     cmp byte [bp-00eh], 000h                  ; 80 7e f2 00
-    je short 07504h                           ; 74 9f
+    je short 0778ch                           ; 74 9f
     movzx bx, byte [bp-00eh]                  ; 0f b6 5e f2
     mov dx, 00339h                            ; ba 39 03
     mov ax, si                                ; 89 f0
-    call 0160eh                               ; e8 9d a0
+    call 0165eh                               ; e8 65 9e
     mov AL, strict byte 003h                  ; b0 03
     mov AH, strict byte 000h                  ; b4 00
     int 010h                                  ; cd 10
@@ -10719,7 +10984,7 @@ show_logo_:                                  ; 0xf7372 LB 0x224
     pushad                                    ; 66 60
     push DS                                   ; 1e
     mov ds, ax                                ; 8e d8
-    call 0edbfh                               ; e8 36 78
+    call 0edbfh                               ; e8 ae 75
     pop DS                                    ; 1f
     popad                                     ; 66 61
     lea sp, [bp-00ah]                         ; 8d 66 f6
@@ -10730,14 +10995,14 @@ show_logo_:                                  ; 0xf7372 LB 0x224
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-delay_boot_:                                 ; 0xf7596 LB 0x67
+delay_boot_:                                 ; 0xf781e LB 0x67
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     push dx                                   ; 52
     mov dx, ax                                ; 89 c2
     test ax, ax                               ; 85 c0
-    je short 075f6h                           ; 74 55
+    je short 0787eh                           ; 74 55
     mov AL, strict byte 034h                  ; b0 34
     out strict byte 043h, AL                  ; e6 43
     mov AL, strict byte 0d3h                  ; b0 d3
@@ -10747,24 +11012,24 @@ delay_boot_:                                 ; 0xf7596 LB 0x67
     push dx                                   ; 52
     push 00b03h                               ; 68 03 0b
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 6c a3
+    call 01972h                               ; e8 34 a1
     add sp, strict byte 00006h                ; 83 c4 06
     mov bx, dx                                ; 89 d3
     test bx, bx                               ; 85 db
-    jbe short 075d6h                          ; 76 17
+    jbe short 0785eh                          ; 76 17
     push bx                                   ; 53
     push 00b21h                               ; 68 21 0b
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 5a a3
+    call 01972h                               ; e8 22 a1
     add sp, strict byte 00006h                ; 83 c4 06
     xor dx, dx                                ; 31 d2
     mov ax, strict word 00040h                ; b8 40 00
-    call 0713eh                               ; e8 6b fb
+    call 073c6h                               ; e8 6b fb
     dec bx                                    ; 4b
-    jmp short 075bbh                          ; eb e5
+    jmp short 07843h                          ; eb e5
     push 00a51h                               ; 68 51 0a
     push strict byte 00002h                   ; 6a 02
-    call 01922h                               ; e8 44 a3
+    call 01972h                               ; e8 0c a1
     add sp, strict byte 00004h                ; 83 c4 04
     mov AL, strict byte 034h                  ; b0 34
     out strict byte 043h, AL                  ; e6 43
@@ -10775,7 +11040,7 @@ delay_boot_:                                 ; 0xf7596 LB 0x67
     pushad                                    ; 66 60
     push DS                                   ; 1e
     mov ds, ax                                ; 8e d8
-    call 0edbfh                               ; e8 cc 77
+    call 0edbfh                               ; e8 44 75
     pop DS                                    ; 1f
     popad                                     ; 66 61
     lea sp, [bp-004h]                         ; 8d 66 fc
@@ -10783,7 +11048,7 @@ delay_boot_:                                 ; 0xf7596 LB 0x67
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-scsi_cmd_data_in_:                           ; 0xf75fd LB 0xb2
+scsi_cmd_data_in_:                           ; 0xf7885 LB 0xc9
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -10791,21 +11056,21 @@ scsi_cmd_data_in_:                           ; 0xf75fd LB 0xb2
     sub sp, strict byte 00006h                ; 83 ec 06
     mov si, ax                                ; 89 c6
     mov byte [bp-006h], dl                    ; 88 56 fa
-    mov word [bp-00ah], bx                    ; 89 5e f6
-    mov word [bp-008h], cx                    ; 89 4e f8
+    mov word [bp-008h], bx                    ; 89 5e f8
+    mov word [bp-00ah], cx                    ; 89 4e f6
     mov bx, word [bp+00ah]                    ; 8b 5e 0a
     mov dx, si                                ; 89 f2
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 07613h                          ; 75 f7
+    jne short 0789bh                          ; 75 f7
     mov ax, bx                                ; 89 d8
     mov dx, word [bp+00ch]                    ; 8b 56 0c
     mov cx, strict word 0000ch                ; b9 0c 00
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 07624h                               ; e2 fa
+    loop 078ach                               ; e2 fa
     and ax, 000f0h                            ; 25 f0 00
     movzx cx, byte [bp+004h]                  ; 0f b6 4e 04
     or cx, ax                                 ; 09 c1
@@ -10823,31 +11088,42 @@ scsi_cmd_data_in_:                           ; 0xf75fd LB 0xb2
     mov cx, strict word 00008h                ; b9 08 00
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 0764ah                               ; e2 fa
+    loop 078d2h                               ; e2 fa
     mov dx, si                                ; 89 f2
     out DX, AL                                ; ee
     xor cx, cx                                ; 31 c9
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     cmp cx, ax                                ; 39 c1
-    jnc short 0766bh                          ; 73 0e
-    les di, [bp-00ah]                         ; c4 7e f6
+    jnc short 078f6h                          ; 73 11
+    mov es, [bp-00ah]                         ; 8e 46 f6
+    mov di, word [bp-008h]                    ; 8b 7e f8
     add di, cx                                ; 01 cf
     mov al, byte [es:di]                      ; 26 8a 05
     mov dx, si                                ; 89 f2
     out DX, AL                                ; ee
     inc cx                                    ; 41
-    jmp short 07655h                          ; eb ea
+    jmp short 078ddh                          ; eb e7
     mov dx, si                                ; 89 f2
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 0766bh                          ; 75 f7
+    jne short 078f6h                          ; 75 f7
+    test AL, strict byte 002h                 ; a8 02
+    je short 07911h                           ; 74 0e
+    lea dx, [si+003h]                         ; 8d 54 03
+    xor al, al                                ; 30 c0
+    out DX, AL                                ; ee
+    in AL, DX                                 ; ec
+    db  02ah, 0e4h
+    ; sub ah, ah                                ; 2a e4
+    mov di, strict word 00004h                ; bf 04 00
+    jmp short 07943h                          ; eb 32
     lea dx, [si+001h]                         ; 8d 54 01
     cmp word [bp+00ch], strict byte 00000h    ; 83 7e 0c 00
-    jne short 07683h                          ; 75 06
+    jne short 07920h                          ; 75 06
     cmp bx, 08000h                            ; 81 fb 00 80
-    jbe short 0769dh                          ; 76 1a
+    jbe short 0793ah                          ; 76 1a
     mov cx, 08000h                            ; b9 00 80
     les di, [bp+006h]                         ; c4 7e 06
     rep insb                                  ; f3 6c
@@ -10856,17 +11132,18 @@ scsi_cmd_data_in_:                           ; 0xf75fd LB 0xb2
     mov ax, es                                ; 8c c0
     add ax, 00800h                            ; 05 00 08
     mov word [bp+008h], ax                    ; 89 46 08
-    jmp short 07674h                          ; eb d7
+    jmp short 07911h                          ; eb d7
     mov cx, bx                                ; 89 d9
     les di, [bp+006h]                         ; c4 7e 06
     rep insb                                  ; f3 6c
-    xor ax, ax                                ; 31 c0
+    xor di, di                                ; 31 ff
+    mov ax, di                                ; 89 f8
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 0000ah                               ; c2 0a 00
-scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
+scsi_cmd_data_out_:                          ; 0xf794e LB 0xc9
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -10874,21 +11151,21 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     sub sp, strict byte 00006h                ; 83 ec 06
     mov di, ax                                ; 89 c7
     mov byte [bp-006h], dl                    ; 88 56 fa
-    mov word [bp-00ah], bx                    ; 89 5e f6
-    mov word [bp-008h], cx                    ; 89 4e f8
+    mov word [bp-008h], bx                    ; 89 5e f8
+    mov word [bp-00ah], cx                    ; 89 4e f6
     mov bx, word [bp+00ah]                    ; 8b 5e 0a
     mov dx, di                                ; 89 fa
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 076c5h                          ; 75 f7
+    jne short 07964h                          ; 75 f7
     mov ax, bx                                ; 89 d8
     mov dx, word [bp+00ch]                    ; 8b 56 0c
     mov cx, strict word 0000ch                ; b9 0c 00
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 076d6h                               ; e2 fa
+    loop 07975h                               ; e2 fa
     and ax, 000f0h                            ; 25 f0 00
     movzx cx, byte [bp+004h]                  ; 0f b6 4e 04
     or cx, ax                                 ; 09 c1
@@ -10906,25 +11183,26 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     mov cx, strict word 00008h                ; b9 08 00
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 076fch                               ; e2 fa
+    loop 0799bh                               ; e2 fa
     mov dx, di                                ; 89 fa
     out DX, AL                                ; ee
     xor cx, cx                                ; 31 c9
     movzx ax, byte [bp+004h]                  ; 0f b6 46 04
     cmp cx, ax                                ; 39 c1
-    jnc short 0771dh                          ; 73 0e
-    les si, [bp-00ah]                         ; c4 76 f6
+    jnc short 079bfh                          ; 73 11
+    mov es, [bp-00ah]                         ; 8e 46 f6
+    mov si, word [bp-008h]                    ; 8b 76 f8
     add si, cx                                ; 01 ce
     mov al, byte [es:si]                      ; 26 8a 04
     mov dx, di                                ; 89 fa
     out DX, AL                                ; ee
     inc cx                                    ; 41
-    jmp short 07707h                          ; eb ea
+    jmp short 079a6h                          ; eb e7
     lea dx, [di+001h]                         ; 8d 55 01
     cmp word [bp+00ch], strict byte 00000h    ; 83 7e 0c 00
-    jne short 0772ch                          ; 75 06
+    jne short 079ceh                          ; 75 06
     cmp bx, 08000h                            ; 81 fb 00 80
-    jbe short 07747h                          ; 76 1b
+    jbe short 079e9h                          ; 76 1b
     mov cx, 08000h                            ; b9 00 80
     les si, [bp+006h]                         ; c4 76 06
     db  0f3h, 026h, 06eh
@@ -10934,7 +11212,7 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     mov ax, es                                ; 8c c0
     add ax, 00800h                            ; 05 00 08
     mov word [bp+008h], ax                    ; 89 46 08
-    jmp short 0771dh                          ; eb d6
+    jmp short 079bfh                          ; eb d6
     mov cx, bx                                ; 89 d9
     les si, [bp+006h]                         ; c4 76 06
     db  0f3h, 026h, 06eh
@@ -10944,14 +11222,24 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 0774fh                          ; 75 f7
+    jne short 079f1h                          ; 75 f7
+    test AL, strict byte 002h                 ; a8 02
+    je short 07a0ch                           ; 74 0e
+    lea dx, [di+003h]                         ; 8d 55 03
+    xor al, al                                ; 30 c0
+    out DX, AL                                ; ee
+    in AL, DX                                 ; ec
+    db  02ah, 0e4h
+    ; sub ah, ah                                ; 2a e4
+    mov ax, strict word 00004h                ; b8 04 00
+    jmp short 07a0eh                          ; eb 02
     xor ax, ax                                ; 31 c0
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 0000ah                               ; c2 0a 00
- at scsi_read_sectors:                          ; 0xf7763 LB 0xb6
+ at scsi_read_sectors:                          ; 0xf7a17 LB 0xb9
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -10962,13 +11250,14 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     mov bl, byte [es:si+008h]                 ; 26 8a 5c 08
     sub bl, 008h                              ; 80 eb 08
     cmp bl, 004h                              ; 80 fb 04
-    jbe short 0778ch                          ; 76 0f
+    jbe short 07a43h                          ; 76 12
     movzx ax, bl                              ; 0f b6 c3
     push ax                                   ; 50
     push 00b26h                               ; 68 26 0b
+    push 00b38h                               ; 68 38 0b
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 99 a1
-    add sp, strict byte 00006h                ; 83 c4 06
+    call 01972h                               ; e8 32 9f
+    add sp, strict byte 00008h                ; 83 c4 08
     mov es, [bp+006h]                         ; 8e 46 06
     mov di, word [es:si+00ah]                 ; 26 8b 7c 0a
     mov word [bp-012h], strict word 00028h    ; c7 46 ee 28 00
@@ -10994,7 +11283,7 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     mov cx, strict word 00009h                ; b9 09 00
     sal word [bp-008h], 1                     ; d1 66 f8
     rcl word [bp-006h], 1                     ; d1 56 fa
-    loop 077d5h                               ; e2 f8
+    loop 07a8ch                               ; e2 f8
     push dword [bp-008h]                      ; 66 ff 76 f8
     db  066h, 026h, 0ffh, 074h, 004h
     ; push dword [es:si+004h]                   ; 66 26 ff 74 04
@@ -11002,10 +11291,10 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     xor dh, dh                                ; 30 f6
     mov cx, ss                                ; 8c d1
     lea bx, [bp-012h]                         ; 8d 5e ee
-    call 075fdh                               ; e8 0b fe
+    call 07885h                               ; e8 dc fd
     mov ah, al                                ; 88 c4
     test al, al                               ; 84 c0
-    jne short 0780dh                          ; 75 15
+    jne short 07ac4h                          ; 75 15
     mov es, [bp+006h]                         ; 8e 46 06
     mov word [es:si+014h], di                 ; 26 89 7c 14
     mov dx, word [bp-008h]                    ; 8b 56 f8
@@ -11018,7 +11307,7 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
- at scsi_write_sectors:                         ; 0xf7819 LB 0xb6
+ at scsi_write_sectors:                         ; 0xf7ad0 LB 0xb9
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -11029,13 +11318,14 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     mov bl, byte [es:si+008h]                 ; 26 8a 5c 08
     sub bl, 008h                              ; 80 eb 08
     cmp bl, 004h                              ; 80 fb 04
-    jbe short 07842h                          ; 76 0f
+    jbe short 07afch                          ; 76 12
     movzx ax, bl                              ; 0f b6 c3
     push ax                                   ; 50
-    push 00b54h                               ; 68 54 0b
+    push 00b57h                               ; 68 57 0b
+    push 00b38h                               ; 68 38 0b
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 e3 a0
-    add sp, strict byte 00006h                ; 83 c4 06
+    call 01972h                               ; e8 79 9e
+    add sp, strict byte 00008h                ; 83 c4 08
     mov es, [bp+006h]                         ; 8e 46 06
     mov di, word [es:si+00ah]                 ; 26 8b 7c 0a
     mov word [bp-012h], strict word 0002ah    ; c7 46 ee 2a 00
@@ -11061,7 +11351,7 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     mov cx, strict word 00009h                ; b9 09 00
     sal word [bp-008h], 1                     ; d1 66 f8
     rcl word [bp-006h], 1                     ; d1 56 fa
-    loop 0788bh                               ; e2 f8
+    loop 07b45h                               ; e2 f8
     push dword [bp-008h]                      ; 66 ff 76 f8
     db  066h, 026h, 0ffh, 074h, 004h
     ; push dword [es:si+004h]                   ; 66 26 ff 74 04
@@ -11069,10 +11359,10 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     xor dh, dh                                ; 30 f6
     mov cx, ss                                ; 8c d1
     lea bx, [bp-012h]                         ; 8d 5e ee
-    call 076afh                               ; e8 07 fe
+    call 0794eh                               ; e8 ec fd
     mov ah, al                                ; 88 c4
     test al, al                               ; 84 c0
-    jne short 078c3h                          ; 75 15
+    jne short 07b7dh                          ; 75 15
     mov es, [bp+006h]                         ; 8e 46 06
     mov word [es:si+014h], di                 ; 26 89 7c 14
     mov dx, word [bp-008h]                    ; 8b 56 f8
@@ -11085,7 +11375,7 @@ scsi_cmd_data_out_:                          ; 0xf76af LB 0xb4
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
+scsi_cmd_packet_:                            ; 0xf7b89 LB 0x166
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -11097,22 +11387,22 @@ scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
     mov word [bp-00ah], cx                    ; 89 4e f6
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 31 9d
+    call 0166ch                               ; e8 c7 9a
     mov si, 00122h                            ; be 22 01
     mov word [bp-00eh], ax                    ; 89 46 f2
     cmp byte [bp+00ah], 002h                  ; 80 7e 0a 02
-    jne short 07916h                          ; 75 1f
-    mov bx, 00dbah                            ; bb ba 0d
+    jne short 07bd0h                          ; 75 1f
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 df 9f
-    push 00b83h                               ; 68 83 0b
-    push 00b93h                               ; 68 93 0b
+    call 01931h                               ; e8 75 9d
+    push 00b6ah                               ; 68 6a 0b
+    push 00b7ah                               ; 68 7a 0b
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 15 a0
+    call 01972h                               ; e8 ab 9d
     add sp, strict byte 00006h                ; 83 c4 06
     mov dx, strict word 00001h                ; ba 01 00
-    jmp near 07a2ah                           ; e9 14 01
+    jmp near 07ce4h                           ; e9 14 01
     sub di, strict byte 00008h                ; 83 ef 08
     sal di, 002h                              ; c1 e7 02
     sub byte [bp-006h], 002h                  ; 80 6e fa 02
@@ -11126,7 +11416,7 @@ scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 07932h                          ; 75 f7
+    jne short 07bech                          ; 75 f7
     xor ax, ax                                ; 31 c0
     mov dx, word [bp+006h]                    ; 8b 56 06
     add dx, word [bp+004h]                    ; 03 56 04
@@ -11142,7 +11432,7 @@ scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
     mov cx, strict word 0000ch                ; b9 0c 00
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 0795dh                               ; e2 fa
+    loop 07c17h                               ; e2 fa
     and ax, 000f0h                            ; 25 f0 00
     movzx cx, byte [bp-006h]                  ; 0f b6 4e fa
     or cx, ax                                 ; 09 c1
@@ -11160,28 +11450,28 @@ scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
     mov cx, strict word 00008h                ; b9 08 00
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 07984h                               ; e2 fa
+    loop 07c3eh                               ; e2 fa
     mov dx, bx                                ; 89 da
     out DX, AL                                ; ee
     xor cx, cx                                ; 31 c9
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
     cmp cx, ax                                ; 39 c1
-    jnc short 079a5h                          ; 73 0e
+    jnc short 07c5fh                          ; 73 0e
     les di, [bp-00ch]                         ; c4 7e f4
     add di, cx                                ; 01 cf
     mov al, byte [es:di]                      ; 26 8a 05
     mov dx, bx                                ; 89 da
     out DX, AL                                ; ee
     inc cx                                    ; 41
-    jmp short 0798fh                          ; eb ea
+    jmp short 07c49h                          ; eb ea
     mov dx, bx                                ; 89 da
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     test AL, strict byte 001h                 ; a8 01
-    jne short 079a5h                          ; 75 f7
+    jne short 07c5fh                          ; 75 f7
     test AL, strict byte 002h                 ; a8 02
-    je short 079c0h                           ; 74 0e
+    je short 07c7ah                           ; 74 0e
     lea dx, [bx+003h]                         ; 8d 57 03
     xor al, al                                ; 30 c0
     out DX, AL                                ; ee
@@ -11189,14 +11479,14 @@ scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov dx, strict word 00003h                ; ba 03 00
-    jmp short 07a2ah                          ; eb 6a
+    jmp short 07ce4h                          ; eb 6a
     mov ax, word [bp+004h]                    ; 8b 46 04
     test ax, ax                               ; 85 c0
-    je short 079cfh                           ; 74 08
+    je short 07c89h                           ; 74 08
     lea dx, [bx+001h]                         ; 8d 57 01
     mov cx, ax                                ; 89 c1
     in AL, DX                                 ; ec
-    loop 079cch                               ; e2 fd
+    loop 07c86h                               ; e2 fd
     mov ax, word [bp+006h]                    ; 8b 46 06
     mov es, [bp-00eh]                         ; 8e 46 f2
     mov word [es:si+016h], ax                 ; 26 89 44 16
@@ -11204,9 +11494,9 @@ scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
     mov word [es:si+018h], ax                 ; 26 89 44 18
     lea ax, [bx+001h]                         ; 8d 47 01
     cmp word [bp+008h], strict byte 00000h    ; 83 7e 08 00
-    jne short 079f0h                          ; 75 07
+    jne short 07caah                          ; 75 07
     cmp word [bp+006h], 08000h                ; 81 7e 06 00 80
-    jbe short 07a0dh                          ; 76 1d
+    jbe short 07cc7h                          ; 76 1d
     mov dx, ax                                ; 89 c2
     mov cx, 08000h                            ; b9 00 80
     les di, [bp+00ch]                         ; c4 7e 0c
@@ -11216,17 +11506,17 @@ scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
     mov ax, es                                ; 8c c0
     add ax, 00800h                            ; 05 00 08
     mov word [bp+00eh], ax                    ; 89 46 0e
-    jmp short 079e0h                          ; eb d3
+    jmp short 07c9ah                          ; eb d3
     mov dx, ax                                ; 89 c2
     mov cx, word [bp+006h]                    ; 8b 4e 06
     les di, [bp+00ch]                         ; c4 7e 0c
     rep insb                                  ; f3 6c
     mov es, [bp-00eh]                         ; 8e 46 f2
     cmp word [es:si+01ch], strict byte 00000h ; 26 83 7c 1c 00
-    je short 07a28h                           ; 74 07
+    je short 07ce2h                           ; 74 07
     mov cx, word [es:si+01ch]                 ; 26 8b 4c 1c
     in AL, DX                                 ; ec
-    loop 07a25h                               ; e2 fd
+    loop 07cdfh                               ; e2 fd
     xor dx, dx                                ; 31 d2
     mov ax, dx                                ; 89 d0
     lea sp, [bp-004h]                         ; 8d 66 fc
@@ -11234,7 +11524,7 @@ scsi_cmd_packet_:                            ; 0xf78cf LB 0x166
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 0000ch                               ; c2 0c 00
-scsi_enumerate_attached_devices_:            ; 0xf7a35 LB 0x3e5
+scsi_enumerate_attached_devices_:            ; 0xf7cef LB 0x3e4
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -11242,174 +11532,170 @@ scsi_enumerate_attached_devices_:            ; 0xf7a35 LB 0x3e5
     push dx                                   ; 52
     push si                                   ; 56
     push di                                   ; 57
-    sub sp, 0021ch                            ; 81 ec 1c 02
+    sub sp, 0021eh                            ; 81 ec 1e 02
     push ax                                   ; 50
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 d1 9b
+    call 0166ch                               ; e8 67 99
     mov si, 00122h                            ; be 22 01
-    mov word [bp-01ah], ax                    ; 89 46 e6
-    mov word [bp-010h], strict word 00000h    ; c7 46 f0 00 00
-    jmp near 07da8h                           ; e9 4f 03
-    mov es, [bp-01ah]                         ; 8e 46 e6
-    cmp byte [es:si+001e8h], 004h             ; 26 80 bc e8 01 04
-    jnc near 07e10h                           ; 0f 83 aa 03
+    mov word [bp-018h], ax                    ; 89 46 e8
+    mov word [bp-00eh], strict word 00000h    ; c7 46 f2 00 00
+    jmp near 08055h                           ; e9 42 03
+    cmp AL, strict byte 004h                  ; 3c 04
+    jnc near 080c9h                           ; 0f 83 b0 03
     mov cx, strict word 0000ah                ; b9 0a 00
     xor bx, bx                                ; 31 db
     mov dx, ss                                ; 8c d2
-    lea ax, [bp-026h]                         ; 8d 46 da
-    call 094cah                               ; e8 57 1a
-    mov byte [bp-026h], 025h                  ; c6 46 da 25
+    lea ax, [bp-028h]                         ; 8d 46 d8
+    call 097aah                               ; e8 84 1a
+    mov byte [bp-028h], 025h                  ; c6 46 d8 25
     push dword 000000008h                     ; 66 6a 08
-    lea dx, [bp-00226h]                       ; 8d 96 da fd
+    lea dx, [bp-00228h]                       ; 8d 96 d8 fd
     push SS                                   ; 16
     push dx                                   ; 52
     push strict byte 0000ah                   ; 6a 0a
-    movzx dx, byte [bp-010h]                  ; 0f b6 56 f0
+    movzx dx, byte [bp-00eh]                  ; 0f b6 56 f2
     mov cx, ss                                ; 8c d1
-    lea bx, [bp-026h]                         ; 8d 5e da
-    mov ax, word [bp-00228h]                  ; 8b 86 d8 fd
-    call 075fdh                               ; e8 6b fb
+    lea bx, [bp-028h]                         ; 8d 5e d8
+    mov ax, word [bp-0022ah]                  ; 8b 86 d6 fd
+    call 07885h                               ; e8 40 fb
     test al, al                               ; 84 c0
-    je short 07aa4h                           ; 74 0e
-    push 00bb3h                               ; 68 b3 0b
-    push 00bech                               ; 68 ec 0b
+    je short 07d57h                           ; 74 0e
+    push 00b9ah                               ; 68 9a 0b
+    push 00bd3h                               ; 68 d3 0b
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 81 9e
+    call 01972h                               ; e8 1e 9c
     add sp, strict byte 00006h                ; 83 c4 06
-    movzx ax, byte [bp-00225h]                ; 0f b6 86 db fd
-    movzx di, byte [bp-00226h]                ; 0f b6 be da fd
+    movzx ax, byte [bp-00227h]                ; 0f b6 86 d9 fd
+    movzx di, byte [bp-00228h]                ; 0f b6 be d8 fd
     sal di, 008h                              ; c1 e7 08
     xor bx, bx                                ; 31 db
     or di, ax                                 ; 09 c7
-    movzx ax, byte [bp-00224h]                ; 0f b6 86 dc fd
+    movzx ax, byte [bp-00226h]                ; 0f b6 86 da fd
     xor dx, dx                                ; 31 d2
     mov cx, strict word 00008h                ; b9 08 00
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 07abfh                               ; e2 fa
+    loop 07d72h                               ; e2 fa
     or bx, ax                                 ; 09 c3
-    or dx, di                                 ; 09 fa
-    movzx ax, byte [bp-00223h]                ; 0f b6 86 dd fd
+    or di, dx                                 ; 09 d7
+    movzx ax, byte [bp-00225h]                ; 0f b6 86 db fd
     or bx, ax                                 ; 09 c3
-    mov word [bp-00eh], bx                    ; 89 5e f2
-    mov word [bp-018h], dx                    ; 89 56 e8
-    movzx di, byte [bp-00222h]                ; 0f b6 be de fd
-    sal di, 008h                              ; c1 e7 08
-    movzx dx, byte [bp-00221h]                ; 0f b6 96 df fd
+    mov word [bp-014h], bx                    ; 89 5e ec
+    add word [bp-014h], strict byte 00001h    ; 83 46 ec 01
+    adc di, strict byte 00000h                ; 83 d7 00
+    movzx ax, byte [bp-00224h]                ; 0f b6 86 dc fd
+    sal ax, 008h                              ; c1 e0 08
+    movzx dx, byte [bp-00223h]                ; 0f b6 96 dd fd
     xor bx, bx                                ; 31 db
-    or di, dx                                 ; 09 d7
-    movzx ax, byte [bp-00220h]                ; 0f b6 86 e0 fd
+    or ax, dx                                 ; 09 d0
+    mov word [bp-012h], ax                    ; 89 46 ee
+    movzx ax, byte [bp-00222h]                ; 0f b6 86 de fd
     xor dx, dx                                ; 31 d2
     mov cx, strict word 00008h                ; b9 08 00
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 07af1h                               ; e2 fa
+    loop 07dabh                               ; e2 fa
     or ax, bx                                 ; 09 d8
-    or dx, di                                 ; 09 fa
-    movzx bx, byte [bp-0021fh]                ; 0f b6 9e e1 fd
+    or dx, word [bp-012h]                     ; 0b 56 ee
+    movzx bx, byte [bp-00221h]                ; 0f b6 9e df fd
     or ax, bx                                 ; 09 d8
-    mov word [bp-016h], ax                    ; 89 46 ea
+    mov word [bp-010h], ax                    ; 89 46 f0
     test dx, dx                               ; 85 d2
-    jne short 07b0eh                          ; 75 05
+    jne short 07dc9h                          ; 75 05
     cmp ax, 00200h                            ; 3d 00 02
-    je short 07b2eh                           ; 74 20
-    mov bx, 00dbah                            ; bb ba 0d
+    je short 07de9h                           ; 74 20
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 c8 9d
+    call 01931h                               ; e8 5d 9b
     push dx                                   ; 52
-    push word [bp-016h]                       ; ff 76 ea
     push word [bp-010h]                       ; ff 76 f0
-    push 00c0bh                               ; 68 0b 0c
+    push word [bp-00eh]                       ; ff 76 f2
+    push 00bf2h                               ; 68 f2 0b
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 fa 9d
+    call 01972h                               ; e8 8f 9b
     add sp, strict byte 0000ah                ; 83 c4 0a
-    jmp near 07d9fh                           ; e9 71 02
-    mov es, [bp-01ah]                         ; 8e 46 e6
-    mov al, byte [es:si+001e8h]               ; 26 8a 84 e8 01
-    mov byte [bp-00ch], al                    ; 88 46 f4
+    jmp near 0804ch                           ; e9 63 02
+    mov al, byte [bp-00ch]                    ; 8a 46 f4
     cmp AL, strict byte 001h                  ; 3c 01
-    jc short 07b49h                           ; 72 0c
-    jbe short 07b51h                          ; 76 12
+    jc short 07dfch                           ; 72 0c
+    jbe short 07e04h                          ; 76 12
     cmp AL, strict byte 003h                  ; 3c 03
-    je short 07b59h                           ; 74 16
+    je short 07e0ch                           ; 74 16
     cmp AL, strict byte 002h                  ; 3c 02
-    je short 07b55h                           ; 74 0e
-    jmp short 07ba5h                          ; eb 5c
+    je short 07e08h                           ; 74 0e
+    jmp short 07e5bh                          ; eb 5f
     test al, al                               ; 84 c0
-    jne short 07ba5h                          ; 75 58
+    jne short 07e5bh                          ; 75 5b
     mov BL, strict byte 090h                  ; b3 90
-    jmp short 07b5bh                          ; eb 0a
+    jmp short 07e0eh                          ; eb 0a
     mov BL, strict byte 098h                  ; b3 98
-    jmp short 07b5bh                          ; eb 06
+    jmp short 07e0eh                          ; eb 06
     mov BL, strict byte 0a0h                  ; b3 a0
-    jmp short 07b5bh                          ; eb 02
+    jmp short 07e0eh                          ; eb 02
     mov BL, strict byte 0a8h                  ; b3 a8
     mov al, bl                                ; 88 d8
     add AL, strict byte 007h                  ; 04 07
     movzx cx, al                              ; 0f b6 c8
     mov ax, cx                                ; 89 c8
-    call 0165ch                               ; e8 f5 9a
+    call 016ach                               ; e8 92 98
     test al, al                               ; 84 c0
-    je short 07ba5h                           ; 74 3a
+    je short 07e5bh                           ; 74 3d
     mov al, bl                                ; 88 d8
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     xor ah, ah                                ; 30 e4
-    call 0165ch                               ; e8 e8 9a
+    call 016ach                               ; e8 85 98
     xor ah, ah                                ; 30 e4
-    mov dx, ax                                ; 89 c2
-    sal dx, 008h                              ; c1 e2 08
+    sal ax, 008h                              ; c1 e0 08
+    mov word [bp-012h], ax                    ; 89 46 ee
     movzx ax, bl                              ; 0f b6 c3
-    call 0165ch                               ; e8 db 9a
+    call 016ach                               ; e8 77 98
     xor ah, ah                                ; 30 e4
-    add ax, dx                                ; 01 d0
+    add ax, word [bp-012h]                    ; 03 46 ee
     cwd                                       ; 99
-    mov di, ax                                ; 89 c7
-    mov word [bp-012h], dx                    ; 89 56 ee
+    mov word [bp-01eh], ax                    ; 89 46 e2
+    mov word [bp-016h], dx                    ; 89 56 ea
     mov al, bl                                ; 88 d8
     add AL, strict byte 002h                  ; 04 02
     xor ah, ah                                ; 30 e4
-    call 0165ch                               ; e8 c8 9a
-    xor ah, ah                                ; 30 e4
-    mov word [bp-014h], ax                    ; 89 46 ec
-    mov ax, cx                                ; 89 c8
-    call 0165ch                               ; e8 be 9a
+    call 016ach                               ; e8 62 98
     xor ah, ah                                ; 30 e4
     mov word [bp-01ch], ax                    ; 89 46 e4
-    jmp short 07beah                          ; eb 45
-    mov ax, word [bp-018h]                    ; 8b 46 e8
-    cmp ax, strict word 00040h                ; 3d 40 00
-    jnbe short 07bafh                         ; 77 02
-    jne short 07bbbh                          ; 75 0c
-    mov word [bp-014h], 000ffh                ; c7 46 ec ff 00
-    mov word [bp-01ch], strict word 0003fh    ; c7 46 e4 3f 00
-    jmp short 07bd3h                          ; eb 18
-    cmp ax, strict word 00020h                ; 3d 20 00
-    jnbe short 07bc2h                         ; 77 02
-    jne short 07bc9h                          ; 75 07
-    mov word [bp-014h], 00080h                ; c7 46 ec 80 00
-    jmp short 07bceh                          ; eb 05
-    mov word [bp-014h], strict word 00040h    ; c7 46 ec 40 00
-    mov word [bp-01ch], strict word 00020h    ; c7 46 e4 20 00
-    mov bx, word [bp-014h]                    ; 8b 5e ec
-    imul bx, word [bp-01ch]                   ; 0f af 5e e4
-    mov ax, word [bp-00eh]                    ; 8b 46 f2
-    mov dx, word [bp-018h]                    ; 8b 56 e8
+    mov ax, cx                                ; 89 c8
+    call 016ach                               ; e8 58 98
+    xor ah, ah                                ; 30 e4
+    mov word [bp-01ah], ax                    ; 89 46 e6
+    jmp short 07e9ch                          ; eb 41
+    cmp di, strict byte 00040h                ; 83 ff 40
+    jnbe short 07e62h                         ; 77 02
+    jne short 07e6ch                          ; 75 0a
+    mov dword [bp-01ch], strict dword 0003f00ffh ; 66 c7 46 e4 ff 00 3f 00
+    jmp short 07e85h                          ; eb 19
+    cmp di, strict byte 00020h                ; 83 ff 20
+    jnbe short 07e73h                         ; 77 02
+    jne short 07e7dh                          ; 75 0a
+    mov dword [bp-01ch], strict dword 000200080h ; 66 c7 46 e4 80 00 20 00
+    jmp short 07e85h                          ; eb 08
+    mov dword [bp-01ch], strict dword 000200040h ; 66 c7 46 e4 40 00 20 00
+    mov bx, word [bp-01ch]                    ; 8b 5e e4
+    imul bx, word [bp-01ah]                   ; 0f af 5e e6
+    mov ax, word [bp-014h]                    ; 8b 46 ec
+    mov dx, di                                ; 89 fa
     xor cx, cx                                ; 31 c9
-    call 09460h                               ; e8 7b 18
-    mov di, ax                                ; 89 c7
-    mov word [bp-012h], dx                    ; 89 56 ee
+    call 09740h                               ; e8 aa 18
+    mov word [bp-01eh], ax                    ; 89 46 e2
+    mov word [bp-016h], dx                    ; 89 56 ea
     mov dl, byte [bp-00ch]                    ; 8a 56 f4
     add dl, 008h                              ; 80 c2 08
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     sal bx, 002h                              ; c1 e3 02
-    mov es, [bp-01ah]                         ; 8e 46 e6
+    mov es, [bp-018h]                         ; 8e 46 e8
     add bx, si                                ; 01 f3
-    mov ax, word [bp-00228h]                  ; 8b 86 d8 fd
+    mov ax, word [bp-0022ah]                  ; 8b 86 d6 fd
     mov word [es:bx+001d8h], ax               ; 26 89 87 d8 01
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     mov byte [es:bx+001dah], al               ; 26 88 87 da 01
     movzx ax, dl                              ; 0f b6 c2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
@@ -11417,61 +11703,61 @@ scsi_enumerate_attached_devices_:            ; 0xf7a35 LB 0x3e5
     add bx, ax                                ; 01 c3
     db  066h, 026h, 0c7h, 047h, 01eh, 004h, 0ffh, 000h, 000h
     ; mov dword [es:bx+01eh], strict dword 00000ff04h ; 66 26 c7 47 1e 04 ff 00 00
-    mov ax, word [bp-016h]                    ; 8b 46 ea
+    mov ax, word [bp-010h]                    ; 8b 46 f0
     mov word [es:bx+024h], ax                 ; 26 89 47 24
     mov byte [es:bx+023h], 001h               ; 26 c6 47 23 01
-    mov ax, word [bp-014h]                    ; 8b 46 ec
-    mov word [es:bx+026h], ax                 ; 26 89 47 26
     mov ax, word [bp-01ch]                    ; 8b 46 e4
+    mov word [es:bx+026h], ax                 ; 26 89 47 26
+    mov ax, word [bp-01ah]                    ; 8b 46 e6
     mov word [es:bx+02ah], ax                 ; 26 89 47 2a
-    cmp word [bp-012h], strict byte 00000h    ; 83 7e ee 00
-    jne short 07c46h                          ; 75 06
-    cmp di, 00400h                            ; 81 ff 00 04
-    jbe short 07c4eh                          ; 76 08
+    cmp word [bp-016h], strict byte 00000h    ; 83 7e ea 00
+    jne short 07ef9h                          ; 75 07
+    cmp word [bp-01eh], 00400h                ; 81 7e e2 00 04
+    jbe short 07f01h                          ; 76 08
     mov word [es:bx+028h], 00400h             ; 26 c7 47 28 00 04
-    jmp short 07c52h                          ; eb 04
-    mov word [es:bx+028h], di                 ; 26 89 7f 28
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp short 07f08h                          ; eb 07
+    mov ax, word [bp-01eh]                    ; 8b 46 e2
+    mov word [es:bx+028h], ax                 ; 26 89 47 28
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 84 9c
-    push word [bp-018h]                       ; ff 76 e8
-    push word [bp-00eh]                       ; ff 76 f2
-    push word [bp-01ch]                       ; ff 76 e4
-    push word [bp-014h]                       ; ff 76 ec
+    call 01931h                               ; e8 1e 9a
     push di                                   ; 57
-    push word [bp-010h]                       ; ff 76 f0
+    push word [bp-014h]                       ; ff 76 ec
+    push dword [bp-01ch]                      ; 66 ff 76 e4
+    push word [bp-01eh]                       ; ff 76 e2
+    push word [bp-00eh]                       ; ff 76 f2
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     push ax                                   ; 50
-    push 00c39h                               ; 68 39 0c
+    push 00c20h                               ; 68 20 0c
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 a8 9c
+    call 01972h                               ; e8 44 9a
     add sp, strict byte 00012h                ; 83 c4 12
     movzx ax, dl                              ; 0f b6 c2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
-    mov es, [bp-01ah]                         ; 8e 46 e6
+    mov es, [bp-018h]                         ; 8e 46 e8
     mov bx, si                                ; 89 f3
     add bx, ax                                ; 01 c3
-    mov ax, word [bp-014h]                    ; 8b 46 ec
-    mov word [es:bx+02ch], ax                 ; 26 89 47 2c
     mov ax, word [bp-01ch]                    ; 8b 46 e4
+    mov word [es:bx+02ch], ax                 ; 26 89 47 2c
+    mov ax, word [bp-01ah]                    ; 8b 46 e6
     mov word [es:bx+030h], ax                 ; 26 89 47 30
-    cmp word [bp-012h], strict byte 00000h    ; 83 7e ee 00
-    jne short 07ca4h                          ; 75 06
-    cmp di, 00400h                            ; 81 ff 00 04
-    jbe short 07cach                          ; 76 08
+    cmp word [bp-016h], strict byte 00000h    ; 83 7e ea 00
+    jne short 07f59h                          ; 75 07
+    cmp word [bp-01eh], 00400h                ; 81 7e e2 00 04
+    jbe short 07f61h                          ; 76 08
     mov word [es:bx+02eh], 00400h             ; 26 c7 47 2e 00 04
-    jmp short 07cb0h                          ; eb 04
-    mov word [es:bx+02eh], di                 ; 26 89 7f 2e
+    jmp short 07f68h                          ; eb 07
+    mov ax, word [bp-01eh]                    ; 8b 46 e2
+    mov word [es:bx+02eh], ax                 ; 26 89 47 2e
     movzx ax, dl                              ; 0f b6 c2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
-    mov es, [bp-01ah]                         ; 8e 46 e6
+    mov es, [bp-018h]                         ; 8e 46 e8
     mov bx, si                                ; 89 f3
     add bx, ax                                ; 01 c3
-    mov ax, word [bp-00eh]                    ; 8b 46 f2
+    mov ax, word [bp-014h]                    ; 8b 46 ec
     mov word [es:bx+032h], ax                 ; 26 89 47 32
-    mov ax, word [bp-018h]                    ; 8b 46 e8
-    mov word [es:bx+034h], ax                 ; 26 89 47 34
+    mov word [es:bx+034h], di                 ; 26 89 7f 34
     mov al, byte [es:si+0019eh]               ; 26 8a 84 9e 01
     mov ah, byte [bp-00ch]                    ; 8a 66 f4
     add ah, 008h                              ; 80 c4 08
@@ -11483,44 +11769,41 @@ scsi_enumerate_attached_devices_:            ; 0xf7a35 LB 0x3e5
     mov byte [es:si+0019eh], al               ; 26 88 84 9e 01
     mov dx, strict word 00075h                ; ba 75 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 10 99
+    call 01650h                               ; e8 ab 96
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00075h                ; ba 75 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 10 99
+    call 0165eh                               ; e8 ab 96
     inc byte [bp-00ch]                        ; fe 46 f4
-    mov al, byte [bp-00ch]                    ; 8a 46 f4
-    mov es, [bp-01ah]                         ; 8e 46 e6
-    mov byte [es:si+001e8h], al               ; 26 88 84 e8 01
-    jmp near 07d9fh                           ; e9 90 00
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp near 08041h                           ; e9 88 00
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 c7 9b
-    push word [bp-010h]                       ; ff 76 f0
+    call 01931h                               ; e8 6d 99
+    push word [bp-00eh]                       ; ff 76 f2
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     push ax                                   ; 50
-    push 00c63h                               ; 68 63 0c
+    push 00c4ah                               ; 68 4a 0c
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 f8 9b
+    call 01972h                               ; e8 9e 99
     add sp, strict byte 00008h                ; 83 c4 08
     mov dl, byte [bp-00ch]                    ; 8a 56 f4
     add dl, 008h                              ; 80 c2 08
-    test byte [bp-00225h], 080h               ; f6 86 db fd 80
+    test byte [bp-00227h], 080h               ; f6 86 d9 fd 80
     db  00fh, 095h, 0c0h
     ; setne al                                  ; 0f 95 c0
     xor ah, ah                                ; 30 e4
     mov cx, ax                                ; 89 c1
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     sal ax, 002h                              ; c1 e0 02
-    mov es, [bp-01ah]                         ; 8e 46 e6
+    mov es, [bp-018h]                         ; 8e 46 e8
     mov bx, si                                ; 89 f3
     add bx, ax                                ; 01 c3
-    mov ax, word [bp-00228h]                  ; 8b 86 d8 fd
+    mov ax, word [bp-0022ah]                  ; 8b 86 d6 fd
     mov word [es:bx+001d8h], ax               ; 26 89 87 d8 01
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    mov al, byte [bp-00eh]                    ; 8a 46 f2
     mov byte [es:bx+001dah], al               ; 26 88 87 da 01
     movzx ax, dl                              ; 0f b6 c2
     imul ax, ax, strict byte 00018h           ; 6b c0 18
@@ -11540,45 +11823,49 @@ scsi_enumerate_attached_devices_:            ; 0xf7a35 LB 0x3e5
     mov byte [es:si+001afh], al               ; 26 88 84 af 01
     inc byte [bp-00ch]                        ; fe 46 f4
     mov al, byte [bp-00ch]                    ; 8a 46 f4
+    mov es, [bp-018h]                         ; 8e 46 e8
     mov byte [es:si+001e8h], al               ; 26 88 84 e8 01
-    inc word [bp-010h]                        ; ff 46 f0
-    cmp word [bp-010h], strict byte 00010h    ; 83 7e f0 10
-    jnl short 07e10h                          ; 7d 68
-    mov byte [bp-026h], 012h                  ; c6 46 da 12
+    inc word [bp-00eh]                        ; ff 46 f2
+    cmp word [bp-00eh], strict byte 00010h    ; 83 7e f2 10
+    jnl short 080c9h                          ; 7d 74
+    mov byte [bp-028h], 012h                  ; c6 46 d8 12
     xor al, al                                ; 30 c0
+    mov byte [bp-027h], al                    ; 88 46 d9
+    mov byte [bp-026h], al                    ; 88 46 da
     mov byte [bp-025h], al                    ; 88 46 db
-    mov byte [bp-024h], al                    ; 88 46 dc
+    mov byte [bp-024h], 005h                  ; c6 46 dc 05
     mov byte [bp-023h], al                    ; 88 46 dd
-    mov byte [bp-022h], 005h                  ; c6 46 de 05
-    mov byte [bp-021h], al                    ; 88 46 df
     push dword 000000005h                     ; 66 6a 05
-    lea dx, [bp-00226h]                       ; 8d 96 da fd
+    lea dx, [bp-00228h]                       ; 8d 96 d8 fd
     push SS                                   ; 16
     push dx                                   ; 52
     push strict byte 00006h                   ; 6a 06
-    movzx dx, byte [bp-010h]                  ; 0f b6 56 f0
+    movzx dx, byte [bp-00eh]                  ; 0f b6 56 f2
     mov cx, ss                                ; 8c d1
-    lea bx, [bp-026h]                         ; 8d 5e da
-    mov ax, word [bp-00228h]                  ; 8b 86 d8 fd
-    call 075fdh                               ; e8 24 f8
+    lea bx, [bp-028h]                         ; 8d 5e d8
+    mov ax, word [bp-0022ah]                  ; 8b 86 d6 fd
+    call 07885h                               ; e8 ff f7
     test al, al                               ; 84 c0
-    je short 07debh                           ; 74 0e
-    push 00bb3h                               ; 68 b3 0b
-    push 00bd3h                               ; 68 d3 0b
+    je short 08098h                           ; 74 0e
+    push 00b9ah                               ; 68 9a 0b
+    push 00bbah                               ; 68 ba 0b
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 3a 9b
+    call 01972h                               ; e8 dd 98
     add sp, strict byte 00006h                ; 83 c4 06
-    test byte [bp-00226h], 0e0h               ; f6 86 da fd e0
-    jne short 07dfbh                          ; 75 09
-    test byte [bp-00226h], 01fh               ; f6 86 da fd 1f
-    je near 07a59h                            ; 0f 84 5e fc
-    test byte [bp-00226h], 0e0h               ; f6 86 da fd e0
-    jne short 07d9fh                          ; 75 9d
-    mov al, byte [bp-00226h]                  ; 8a 86 da fd
+    mov es, [bp-018h]                         ; 8e 46 e8
+    mov al, byte [es:si+001e8h]               ; 26 8a 84 e8 01
+    mov byte [bp-00ch], al                    ; 88 46 f4
+    test byte [bp-00228h], 0e0h               ; f6 86 d8 fd e0
+    jne short 080b3h                          ; 75 09
+    test byte [bp-00228h], 01fh               ; f6 86 d8 fd 1f
+    je near 07d13h                            ; 0f 84 60 fc
+    test byte [bp-00228h], 0e0h               ; f6 86 d8 fd e0
+    jne short 08041h                          ; 75 87
+    mov al, byte [bp-00228h]                  ; 8a 86 d8 fd
     and AL, strict byte 01fh                  ; 24 1f
     cmp AL, strict byte 005h                  ; 3c 05
-    je near 07d0fh                            ; 0f 84 01 ff
-    jmp short 07d9fh                          ; eb 8f
+    je near 07fb9h                            ; 0f 84 f3 fe
+    jmp near 08041h                           ; e9 78 ff
     lea sp, [bp-00ah]                         ; 8d 66 f6
     pop di                                    ; 5f
     pop si                                    ; 5e
@@ -11587,12 +11874,12 @@ scsi_enumerate_attached_devices_:            ; 0xf7a35 LB 0x3e5
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-_scsi_init:                                  ; 0xf7e1a LB 0x66
+_scsi_init:                                  ; 0xf80d3 LB 0x66
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 f6 97
+    call 0166ch                               ; e8 8d 95
     mov bx, 00122h                            ; bb 22 01
     mov es, ax                                ; 8e c0
     mov byte [es:bx+001e8h], 000h             ; 26 c6 87 e8 01 00
@@ -11603,12 +11890,12 @@ _scsi_init:                                  ; 0xf7e1a LB 0x66
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp AL, strict byte 055h                  ; 3c 55
-    jne short 07e4ah                          ; 75 0c
+    jne short 08103h                          ; 75 0c
     xor al, al                                ; 30 c0
     mov dx, 00433h                            ; ba 33 04
     out DX, AL                                ; ee
     mov ax, 00430h                            ; b8 30 04
-    call 07a35h                               ; e8 eb fb
+    call 07cefh                               ; e8 ec fb
     mov AL, strict byte 055h                  ; b0 55
     mov dx, 00436h                            ; ba 36 04
     out DX, AL                                ; ee
@@ -11616,12 +11903,12 @@ _scsi_init:                                  ; 0xf7e1a LB 0x66
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp AL, strict byte 055h                  ; 3c 55
-    jne short 07e63h                          ; 75 0c
+    jne short 0811ch                          ; 75 0c
     xor al, al                                ; 30 c0
     mov dx, 00437h                            ; ba 37 04
     out DX, AL                                ; ee
     mov ax, 00434h                            ; b8 34 04
-    call 07a35h                               ; e8 d2 fb
+    call 07cefh                               ; e8 d3 fb
     mov AL, strict byte 055h                  ; b0 55
     mov dx, 0043ah                            ; ba 3a 04
     out DX, AL                                ; ee
@@ -11629,16 +11916,16 @@ _scsi_init:                                  ; 0xf7e1a LB 0x66
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp AL, strict byte 055h                  ; 3c 55
-    jne short 07e7ch                          ; 75 0c
+    jne short 08135h                          ; 75 0c
     xor al, al                                ; 30 c0
     mov dx, 0043bh                            ; ba 3b 04
     out DX, AL                                ; ee
     mov ax, 00438h                            ; b8 38 04
-    call 07a35h                               ; e8 b9 fb
+    call 07cefh                               ; e8 ba fb
     mov sp, bp                                ; 89 ec
     pop bp                                    ; 5d
     retn                                      ; c3
-high_bits_save_:                             ; 0xf7e80 LB 0x17
+high_bits_save_:                             ; 0xf8139 LB 0x17
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -11650,7 +11937,7 @@ high_bits_save_:                             ; 0xf7e80 LB 0x17
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-high_bits_restore_:                          ; 0xf7e97 LB 0x17
+high_bits_restore_:                          ; 0xf8150 LB 0x17
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -11662,7 +11949,7 @@ high_bits_restore_:                          ; 0xf7e97 LB 0x17
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_ctrl_set_bits_:                         ; 0xf7eae LB 0x43
+ahci_ctrl_set_bits_:                         ; 0xf8167 LB 0x43
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -11700,7 +11987,7 @@ ahci_ctrl_set_bits_:                         ; 0xf7eae LB 0x43
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_ctrl_clear_bits_:                       ; 0xf7ef1 LB 0x47
+ahci_ctrl_clear_bits_:                       ; 0xf81aa LB 0x47
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -11740,7 +12027,7 @@ ahci_ctrl_clear_bits_:                       ; 0xf7ef1 LB 0x47
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_ctrl_is_bit_set_:                       ; 0xf7f38 LB 0x39
+ahci_ctrl_is_bit_set_:                       ; 0xf81f1 LB 0x39
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -11762,18 +12049,18 @@ ahci_ctrl_is_bit_set_:                       ; 0xf7f38 LB 0x39
     shr eax, 010h                             ; 66 c1 e8 10
     xchg dx, ax                               ; 92
     test dx, di                               ; 85 fa
-    jne short 07f64h                          ; 75 04
+    jne short 0821dh                          ; 75 04
     test ax, bx                               ; 85 d8
-    je short 07f68h                           ; 74 04
+    je short 08221h                           ; 74 04
     mov AL, strict byte 001h                  ; b0 01
-    jmp short 07f6ah                          ; eb 02
+    jmp short 08223h                          ; eb 02
     xor al, al                                ; 30 c0
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_ctrl_extract_bits_:                     ; 0xf7f71 LB 0x1b
+ahci_ctrl_extract_bits_:                     ; 0xf822a LB 0x1b
     push si                                   ; 56
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -11781,14 +12068,14 @@ ahci_ctrl_extract_bits_:                     ; 0xf7f71 LB 0x1b
     and ax, bx                                ; 21 d8
     and dx, cx                                ; 21 ca
     movzx cx, byte [bp+006h]                  ; 0f b6 4e 06
-    jcxz 07f87h                               ; e3 06
+    jcxz 08240h                               ; e3 06
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 07f81h                               ; e2 fa
+    loop 0823ah                               ; e2 fa
     pop bp                                    ; 5d
     pop si                                    ; 5e
     retn 00002h                               ; c2 02 00
-ahci_addr_to_phys_:                          ; 0xf7f8c LB 0x1e
+ahci_addr_to_phys_:                          ; 0xf8245 LB 0x1e
     push bx                                   ; 53
     push cx                                   ; 51
     push bp                                   ; 55
@@ -11799,7 +12086,7 @@ ahci_addr_to_phys_:                          ; 0xf7f8c LB 0x1e
     mov cx, strict word 00004h                ; b9 04 00
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 07f9ah                               ; e2 fa
+    loop 08253h                               ; e2 fa
     xor cx, cx                                ; 31 c9
     add ax, bx                                ; 01 d8
     adc dx, cx                                ; 11 ca
@@ -11807,7 +12094,7 @@ ahci_addr_to_phys_:                          ; 0xf7f8c LB 0x1e
     pop cx                                    ; 59
     pop bx                                    ; 5b
     retn                                      ; c3
-ahci_port_cmd_sync_:                         ; 0xf7faa LB 0xd5
+ahci_port_cmd_sync_:                         ; 0xf8263 LB 0xd5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -11821,7 +12108,7 @@ ahci_port_cmd_sync_:                         ; 0xf7faa LB 0xd5
     mov byte [bp-008h], al                    ; 88 46 f8
     mov di, word [es:si+00260h]               ; 26 8b bc 60 02
     cmp AL, strict byte 0ffh                  ; 3c ff
-    je near 08077h                            ; 0f 84 aa 00
+    je near 08330h                            ; 0f 84 aa 00
     movzx cx, byte [es:si+00263h]             ; 26 0f b6 8c 63 02
     xor dx, dx                                ; 31 d2
     or dl, 080h                               ; 80 ca 80
@@ -11833,7 +12120,7 @@ ahci_port_cmd_sync_:                         ; 0xf7faa LB 0xd5
     ; mov dword [es:si+004h], strict dword 000000000h ; 66 26 c7 44 04 00 00 00 00
     lea ax, [si+00080h]                       ; 8d 84 80 00
     mov dx, es                                ; 8c c2
-    call 07f8ch                               ; e8 96 ff
+    call 08245h                               ; e8 96 ff
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov word [es:si+008h], ax                 ; 26 89 44 08
     mov word [es:si+00ah], dx                 ; 26 89 54 0a
@@ -11843,7 +12130,7 @@ ahci_port_cmd_sync_:                         ; 0xf7faa LB 0xd5
     mov bx, strict word 00011h                ; bb 11 00
     xor cx, cx                                ; 31 c9
     mov ax, di                                ; 89 f8
-    call 07eaeh                               ; e8 98 fe
+    call 08167h                               ; e8 98 fe
     lea ax, [si+00138h]                       ; 8d 84 38 01
     cwd                                       ; 99
     mov cx, dx                                ; 89 d1
@@ -11870,27 +12157,27 @@ ahci_port_cmd_sync_:                         ; 0xf7faa LB 0xd5
     mov cx, 04000h                            ; b9 00 40
     mov dx, si                                ; 89 f2
     mov ax, di                                ; 89 f8
-    call 07f38h                               ; e8 e2 fe
+    call 081f1h                               ; e8 e2 fe
     test al, al                               ; 84 c0
-    je short 08039h                           ; 74 df
+    je short 082f2h                           ; 74 df
     mov bx, strict word 00001h                ; bb 01 00
     xor cx, cx                                ; 31 c9
     mov dx, si                                ; 89 f2
     mov ax, di                                ; 89 f8
-    call 07eaeh                               ; e8 48 fe
+    call 08167h                               ; e8 48 fe
     mov dx, word [bp-00ch]                    ; 8b 56 f4
     add dx, 00118h                            ; 81 c2 18 01
     mov bx, strict word 00001h                ; bb 01 00
     xor cx, cx                                ; 31 c9
     mov ax, di                                ; 89 f8
-    call 07ef1h                               ; e8 7a fe
+    call 081aah                               ; e8 7a fe
     lea sp, [bp-006h]                         ; 8d 66 fa
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_cmd_data_:                              ; 0xf807f LB 0x1ca
+ahci_cmd_data_:                              ; 0xf8338 LB 0x1e4
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -11898,72 +12185,72 @@ ahci_cmd_data_:                              ; 0xf807f LB 0x1ca
     push di                                   ; 57
     sub sp, strict byte 00010h                ; 83 ec 10
     mov di, ax                                ; 89 c7
-    mov word [bp-012h], dx                    ; 89 56 ee
+    mov word [bp-00ch], dx                    ; 89 56 f4
     mov byte [bp-008h], bl                    ; 88 5e f8
     xor si, si                                ; 31 f6
     mov es, dx                                ; 8e c2
     mov ax, word [es:di+001eeh]               ; 26 8b 85 ee 01
     mov word [bp-00ah], ax                    ; 89 46 f6
-    mov word [bp-00eh], si                    ; 89 76 f2
-    mov word [bp-00ch], ax                    ; 89 46 f4
+    mov word [bp-010h], si                    ; 89 76 f0
+    mov word [bp-00eh], ax                    ; 89 46 f2
     mov ax, word [es:di+00ah]                 ; 26 8b 45 0a
-    mov word [bp-010h], ax                    ; 89 46 f0
-    mov ax, word [es:di+00ch]                 ; 26 8b 45 0c
     mov word [bp-016h], ax                    ; 89 46 ea
+    mov ax, word [es:di+00ch]                 ; 26 8b 45 0c
+    mov word [bp-012h], ax                    ; 89 46 ee
     mov cx, strict word 00040h                ; b9 40 00
     xor bx, bx                                ; 31 db
     mov ax, 00080h                            ; b8 80 00
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 094cah                               ; e8 0c 14
+    call 097aah                               ; e8 33 14
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov word [es:si+00080h], 08027h           ; 26 c7 84 80 00 27 80
     mov al, byte [bp-008h]                    ; 8a 46 f8
     mov byte [es:si+00082h], al               ; 26 88 84 82 00
     mov byte [es:si+00083h], 000h             ; 26 c6 84 83 00 00
-    mov es, [bp-012h]                         ; 8e 46 ee
+    mov es, [bp-00ch]                         ; 8e 46 f4
     mov al, byte [es:di]                      ; 26 8a 05
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov byte [es:si+00084h], al               ; 26 88 84 84 00
-    mov es, [bp-012h]                         ; 8e 46 ee
+    mov es, [bp-00ch]                         ; 8e 46 f4
     mov ax, word [es:di]                      ; 26 8b 05
     mov bx, word [es:di+002h]                 ; 26 8b 5d 02
     mov cx, strict word 00008h                ; b9 08 00
     shr bx, 1                                 ; d1 eb
     rcr ax, 1                                 ; d1 d8
-    loop 080f1h                               ; e2 fa
+    loop 083aah                               ; e2 fa
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov byte [es:si+00085h], al               ; 26 88 84 85 00
-    mov es, [bp-012h]                         ; 8e 46 ee
+    mov es, [bp-00ch]                         ; 8e 46 f4
     mov ax, word [es:di+002h]                 ; 26 8b 45 02
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov byte [es:si+00086h], al               ; 26 88 84 86 00
     mov byte [es:si+00087h], 040h             ; 26 c6 84 87 00 40
-    mov es, [bp-012h]                         ; 8e 46 ee
+    mov es, [bp-00ch]                         ; 8e 46 f4
     mov ax, word [es:di+002h]                 ; 26 8b 45 02
     shr ax, 008h                              ; c1 e8 08
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov byte [es:si+00088h], al               ; 26 88 84 88 00
     mov word [es:si+00089h], strict word 00000h ; 26 c7 84 89 00 00 00
     mov byte [es:si+0008bh], 000h             ; 26 c6 84 8b 00 00
-    mov al, byte [bp-010h]                    ; 8a 46 f0
+    mov al, byte [bp-016h]                    ; 8a 46 ea
     mov byte [es:si+0008ch], al               ; 26 88 84 8c 00
-    mov ax, word [bp-010h]                    ; 8b 46 f0
+    mov ax, word [bp-016h]                    ; 8b 46 ea
     shr ax, 008h                              ; c1 e8 08
     mov byte [es:si+0008dh], al               ; 26 88 84 8d 00
     mov word [es:si+00276h], strict word 00010h ; 26 c7 84 76 02 10 00
-    mov ax, word [bp-010h]                    ; 8b 46 f0
+    mov ax, word [bp-016h]                    ; 8b 46 ea
     xor dx, dx                                ; 31 d2
-    mov bx, word [bp-016h]                    ; 8b 5e ea
+    mov bx, word [bp-012h]                    ; 8b 5e ee
     xor cx, cx                                ; 31 c9
-    call 09499h                               ; e8 3f 13
+    call 09779h                               ; e8 66 13
     push dx                                   ; 52
     push ax                                   ; 50
-    mov es, [bp-012h]                         ; 8e 46 ee
+    mov es, [bp-00ch]                         ; 8e 46 f4
     mov bx, word [es:di+004h]                 ; 26 8b 5d 04
     mov cx, word [es:di+006h]                 ; 26 8b 4d 06
     mov ax, 0026ah                            ; b8 6a 02
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 093b4h                               ; e8 44 12
+    call 09688h                               ; e8 5f 12
     mov es, [bp-00ah]                         ; 8e 46 f6
     movzx ax, byte [es:si+00263h]             ; 26 0f b6 84 63 02
     mov dx, word [es:si+0027eh]               ; 26 8b 94 7e 02
@@ -11976,62 +12263,72 @@ ahci_cmd_data_:                              ; 0xf807f LB 0x1ca
     mov word [es:bx+0010ch], dx               ; 26 89 97 0c 01
     mov dx, word [bp-014h]                    ; 8b 56 ec
     mov word [es:bx+0010eh], dx               ; 26 89 97 0e 01
-    mov cx, word [es:si+0027ah]               ; 26 8b 8c 7a 02
-    mov dx, word [es:si+0027ch]               ; 26 8b 94 7c 02
-    mov word [es:bx+00100h], cx               ; 26 89 8f 00 01
-    mov word [es:bx+00102h], dx               ; 26 89 97 02 01
+    mov dx, word [es:si+0027ah]               ; 26 8b 94 7a 02
+    mov cx, word [es:si+0027ch]               ; 26 8b 8c 7c 02
+    mov word [es:bx+00100h], dx               ; 26 89 97 00 01
+    mov word [es:bx+00102h], cx               ; 26 89 8f 02 01
     inc ax                                    ; 40
-    mov es, [bp-012h]                         ; 8e 46 ee
+    mov es, [bp-00ch]                         ; 8e 46 f4
     cmp word [es:di+01ch], strict byte 00000h ; 26 83 7d 1c 00
-    je short 081e9h                           ; 74 2c
+    je short 084a2h                           ; 74 2c
     mov dx, word [es:di+01ch]                 ; 26 8b 55 1c
     dec dx                                    ; 4a
-    mov di, ax                                ; 89 c7
-    sal di, 004h                              ; c1 e7 04
+    mov bx, ax                                ; 89 c3
+    sal bx, 004h                              ; c1 e3 04
     mov es, [bp-00ah]                         ; 8e 46 f6
-    mov word [es:di+0010ch], dx               ; 26 89 95 0c 01
-    mov word [es:di+0010eh], si               ; 26 89 b5 0e 01
+    mov word [es:bx+0010ch], dx               ; 26 89 97 0c 01
+    mov word [es:bx+0010eh], si               ; 26 89 b7 0e 01
     mov dx, word [es:si+00264h]               ; 26 8b 94 64 02
-    mov bx, word [es:si+00266h]               ; 26 8b 9c 66 02
-    mov word [es:di+00100h], dx               ; 26 89 95 00 01
-    mov word [es:di+00102h], bx               ; 26 89 9d 02 01
+    mov cx, word [es:si+00266h]               ; 26 8b 8c 66 02
+    mov word [es:bx+00100h], dx               ; 26 89 97 00 01
+    mov word [es:bx+00102h], cx               ; 26 89 8f 02 01
     inc ax                                    ; 40
-    les bx, [bp-00eh]                         ; c4 5e f2
+    les bx, [bp-010h]                         ; c4 5e f0
     mov byte [es:bx+00263h], al               ; 26 88 87 63 02
     xor ax, ax                                ; 31 c0
-    les bx, [bp-00eh]                         ; c4 5e f2
+    les bx, [bp-010h]                         ; c4 5e f0
     movzx dx, byte [es:bx+00263h]             ; 26 0f b6 97 63 02
     cmp ax, dx                                ; 39 d0
-    jnc short 08203h                          ; 73 03
+    jnc short 084bch                          ; 73 03
     inc ax                                    ; 40
-    jmp short 081f3h                          ; eb f0
+    jmp short 084ach                          ; eb f0
     mov al, byte [bp-008h]                    ; 8a 46 f8
     cmp AL, strict byte 035h                  ; 3c 35
-    jne short 08210h                          ; 75 06
+    jne short 084c9h                          ; 75 06
     mov byte [bp-008h], 040h                  ; c6 46 f8 40
-    jmp short 08224h                          ; eb 14
+    jmp short 084ddh                          ; eb 14
     cmp AL, strict byte 0a0h                  ; 3c a0
-    jne short 08220h                          ; 75 0c
+    jne short 084d9h                          ; 75 0c
     or byte [bp-008h], 020h                   ; 80 4e f8 20
     or byte [es:bx+00083h], 001h              ; 26 80 8f 83 00 01
-    jmp short 08224h                          ; eb 04
+    jmp short 084ddh                          ; eb 04
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
     or byte [bp-008h], 005h                   ; 80 4e f8 05
     movzx bx, byte [bp-008h]                  ; 0f b6 5e f8
-    mov ax, word [bp-00eh]                    ; 8b 46 f2
-    mov dx, word [bp-00ch]                    ; 8b 56 f4
-    call 07faah                               ; e8 75 fd
-    mov ax, word [bp-00eh]                    ; 8b 46 f2
+    mov ax, word [bp-010h]                    ; 8b 46 f0
+    mov dx, word [bp-00eh]                    ; 8b 56 f2
+    call 08263h                               ; e8 75 fd
+    mov cx, word [bp-00eh]                    ; 8b 4e f2
+    mov bx, word [bp-010h]                    ; 8b 5e f0
+    add bx, 00240h                            ; 81 c3 40 02
+    mov ax, word [bp-010h]                    ; 8b 46 f0
     add ax, 0026ah                            ; 05 6a 02
-    mov dx, word [bp-00ch]                    ; 8b 56 f4
-    call 0942dh                               ; e8 ec 11
+    mov dx, cx                                ; 89 ca
+    call 09701h                               ; e8 fe 11
+    mov es, cx                                ; 8e c1
+    mov al, byte [es:bx+003h]                 ; 26 8a 47 03
+    test al, al                               ; 84 c0
+    je short 08512h                           ; 74 05
+    mov ax, strict word 00004h                ; b8 04 00
+    jmp short 08514h                          ; eb 02
+    xor ah, ah                                ; 30 e4
     lea sp, [bp-006h]                         ; 8d 66 fa
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_port_deinit_current_:                   ; 0xf8249 LB 0x144
+ahci_port_deinit_current_:                   ; 0xf851c LB 0x144
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -12046,14 +12343,14 @@ ahci_port_deinit_current_:                   ; 0xf8249 LB 0x144
     mov al, byte [es:di+00262h]               ; 26 8a 85 62 02
     mov byte [bp-00ah], al                    ; 88 46 f6
     cmp AL, strict byte 0ffh                  ; 3c ff
-    je near 08384h                            ; 0f 84 17 01
+    je near 08657h                            ; 0f 84 17 01
     movzx dx, al                              ; 0f b6 d0
     sal dx, 007h                              ; c1 e2 07
     add dx, 00118h                            ; 81 c2 18 01
     mov bx, strict word 00011h                ; bb 11 00
     xor cx, cx                                ; 31 c9
     mov ax, si                                ; 89 f0
-    call 07ef1h                               ; e8 70 fc
+    call 081aah                               ; e8 56 fc
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     sal ax, 007h                              ; c1 e0 07
     mov word [bp-00eh], ax                    ; 89 46 f2
@@ -12062,24 +12359,24 @@ ahci_port_deinit_current_:                   ; 0xf8249 LB 0x144
     mov bx, 0c011h                            ; bb 11 c0
     xor cx, cx                                ; 31 c9
     mov ax, si                                ; 89 f0
-    call 07f38h                               ; e8 9d fc
+    call 081f1h                               ; e8 83 fc
     cmp AL, strict byte 001h                  ; 3c 01
-    je short 08281h                           ; 74 e2
+    je short 08554h                           ; 74 e2
     mov cx, strict word 00020h                ; b9 20 00
     xor bx, bx                                ; 31 db
     mov ax, di                                ; 89 f8
     mov dx, word [bp-00ch]                    ; 8b 56 f4
-    call 094cah                               ; e8 1e 12
+    call 097aah                               ; e8 2b 12
     lea ax, [di+00080h]                       ; 8d 85 80 00
     mov cx, strict word 00040h                ; b9 40 00
     xor bx, bx                                ; 31 db
     mov dx, word [bp-00ch]                    ; 8b 56 f4
-    call 094cah                               ; e8 0f 12
+    call 097aah                               ; e8 1c 12
     lea ax, [di+00200h]                       ; 8d 85 00 02
     mov cx, strict word 00060h                ; b9 60 00
     xor bx, bx                                ; 31 db
     mov dx, word [bp-00ch]                    ; 8b 56 f4
-    call 094cah                               ; e8 00 12
+    call 097aah                               ; e8 0d 12
     mov ax, word [bp-00eh]                    ; 8b 46 f2
     add ax, 00108h                            ; 05 08 01
     cwd                                       ; 99
@@ -12181,7 +12478,7 @@ ahci_port_deinit_current_:                   ; 0xf8249 LB 0x144
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_port_init_:                             ; 0xf838d LB 0x206
+ahci_port_init_:                             ; 0xf8660 LB 0x206
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -12191,7 +12488,7 @@ ahci_port_init_:                             ; 0xf838d LB 0x206
     mov si, ax                                ; 89 c6
     mov word [bp-00ah], dx                    ; 89 56 f6
     mov byte [bp-008h], bl                    ; 88 5e f8
-    call 08249h                               ; e8 a8 fe
+    call 0851ch                               ; e8 a8 fe
     movzx dx, bl                              ; 0f b6 d3
     sal dx, 007h                              ; c1 e2 07
     add dx, 00118h                            ; 81 c2 18 01
@@ -12199,7 +12496,7 @@ ahci_port_init_:                             ; 0xf838d LB 0x206
     mov ax, word [es:si+00260h]               ; 26 8b 84 60 02
     mov bx, strict word 00011h                ; bb 11 00
     xor cx, cx                                ; 31 c9
-    call 07ef1h                               ; e8 36 fb
+    call 081aah                               ; e8 1c fb
     movzx di, byte [bp-008h]                  ; 0f b6 7e f8
     sal di, 007h                              ; c1 e7 07
     lea dx, [di+00118h]                       ; 8d 95 18 01
@@ -12207,26 +12504,26 @@ ahci_port_init_:                             ; 0xf838d LB 0x206
     mov ax, word [es:si+00260h]               ; 26 8b 84 60 02
     mov bx, 0c011h                            ; bb 11 c0
     xor cx, cx                                ; 31 c9
-    call 07f38h                               ; e8 62 fb
+    call 081f1h                               ; e8 48 fb
     cmp AL, strict byte 001h                  ; 3c 01
-    je short 083bbh                           ; 74 e1
+    je short 0868eh                           ; 74 e1
     mov cx, strict word 00020h                ; b9 20 00
     xor bx, bx                                ; 31 db
     mov ax, si                                ; 89 f0
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 094cah                               ; e8 e3 10
+    call 097aah                               ; e8 f0 10
     lea ax, [si+00080h]                       ; 8d 84 80 00
     mov cx, strict word 00040h                ; b9 40 00
     xor bx, bx                                ; 31 db
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 094cah                               ; e8 d4 10
+    call 097aah                               ; e8 e1 10
     mov ax, si                                ; 89 f0
     add ah, 002h                              ; 80 c4 02
     mov word [bp-00ch], ax                    ; 89 46 f4
     mov cx, strict word 00060h                ; b9 60 00
     xor bx, bx                                ; 31 db
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 094cah                               ; e8 c1 10
+    call 097aah                               ; e8 ce 10
     lea ax, [di+00108h]                       ; 8d 85 08 01
     cwd                                       ; 99
     mov es, [bp-00ah]                         ; 8e 46 f6
@@ -12240,7 +12537,7 @@ ahci_port_init_:                             ; 0xf838d LB 0x206
     out DX, eax                               ; 66 ef
     mov ax, word [bp-00ch]                    ; 8b 46 f4
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 07f8ch                               ; e8 60 fb
+    call 08245h                               ; e8 46 fb
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov bx, word [es:si+00260h]               ; 26 8b 9c 60 02
     add bx, strict byte 00004h                ; 83 c3 04
@@ -12285,7 +12582,7 @@ ahci_port_init_:                             ; 0xf838d LB 0x206
     out DX, eax                               ; 66 ef
     mov ax, si                                ; 89 f0
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 07f8ch                               ; e8 f4 fa
+    call 08245h                               ; e8 da fa
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov bx, word [es:si+00260h]               ; 26 8b 9c 60 02
     add bx, strict byte 00004h                ; 83 c3 04
@@ -12390,46 +12687,46 @@ ahci_port_init_:                             ; 0xf838d LB 0x206
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
- at ahci_read_sectors:                          ; 0xf8593 LB 0x94
+ at ahci_read_sectors:                          ; 0xf8866 LB 0x93
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
     push di                                   ; 57
-    les di, [bp+004h]                         ; c4 7e 04
-    movzx di, byte [es:di+008h]               ; 26 0f b6 7d 08
-    sub di, strict byte 0000ch                ; 83 ef 0c
-    cmp di, strict byte 00004h                ; 83 ff 04
-    jbe short 085b7h                          ; 76 0f
-    push di                                   ; 57
-    push 00c7eh                               ; 68 7e 0c
-    push 00c90h                               ; 68 90 0c
+    les bx, [bp+004h]                         ; c4 5e 04
+    movzx bx, byte [es:bx+008h]               ; 26 0f b6 5f 08
+    sub bx, strict byte 0000ch                ; 83 eb 0c
+    cmp bx, strict byte 00004h                ; 83 fb 04
+    jbe short 0888ah                          ; 76 0f
+    push bx                                   ; 53
+    push 00c66h                               ; 68 66 0c
+    push 00c78h                               ; 68 78 0c
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 6e 93
+    call 01972h                               ; e8 eb 90
     add sp, strict byte 00008h                ; 83 c4 08
-    les bx, [bp+004h]                         ; c4 5e 04
-    mov dx, word [es:bx+001eeh]               ; 26 8b 97 ee 01
+    les di, [bp+004h]                         ; c4 7e 04
+    mov dx, word [es:di+001eeh]               ; 26 8b 95 ee 01
     xor ax, ax                                ; 31 c0
-    call 07e80h                               ; e8 bc f8
+    call 08139h                               ; e8 a2 f8
     mov es, [bp+006h]                         ; 8e 46 06
-    add di, bx                                ; 01 df
-    movzx bx, byte [es:di+001e9h]             ; 26 0f b6 9d e9 01
-    mov di, word [bp+004h]                    ; 8b 7e 04
-    mov dx, word [es:di+001eeh]               ; 26 8b 95 ee 01
+    add bx, di                                ; 01 fb
+    movzx bx, byte [es:bx+001e9h]             ; 26 0f b6 9f e9 01
+    mov si, di                                ; 89 fe
+    mov dx, word [es:si+001eeh]               ; 26 8b 94 ee 01
     xor ax, ax                                ; 31 c0
-    call 0838dh                               ; e8 b1 fd
+    call 08660h                               ; e8 b2 fd
     mov bx, strict word 00025h                ; bb 25 00
     mov ax, di                                ; 89 f8
     mov dx, word [bp+006h]                    ; 8b 56 06
-    call 0807fh                               ; e8 98 fa
+    call 08338h                               ; e8 7f fa
+    mov bx, ax                                ; 89 c3
     mov es, [bp+006h]                         ; 8e 46 06
-    mov bx, di                                ; 89 fb
-    mov ax, word [es:bx+00ah]                 ; 26 8b 47 0a
-    mov word [es:bx+014h], ax                 ; 26 89 47 14
+    mov ax, word [es:di+00ah]                 ; 26 8b 45 0a
+    mov word [es:si+014h], ax                 ; 26 89 44 14
     mov cx, ax                                ; 89 c1
     sal cx, 009h                              ; c1 e1 09
     shr cx, 1                                 ; d1 e9
     mov di, word [es:di+004h]                 ; 26 8b 7d 04
-    mov ax, word [es:bx+006h]                 ; 26 8b 47 06
+    mov ax, word [es:si+006h]                 ; 26 8b 44 06
     mov si, di                                ; 89 fe
     mov dx, ax                                ; 89 c2
     mov es, ax                                ; 8e c0
@@ -12437,17 +12734,17 @@ ahci_port_init_:                             ; 0xf838d LB 0x206
     mov ds, dx                                ; 8e da
     rep movsw                                 ; f3 a5
     pop DS                                    ; 1f
-    mov es, [bp+006h]                         ; 8e 46 06
-    mov dx, word [es:bx+001eeh]               ; 26 8b 97 ee 01
-    xor ax, ax                                ; 31 c0
-    call 07e97h                               ; e8 7b f8
+    les si, [bp+004h]                         ; c4 76 04
+    mov dx, word [es:si+001eeh]               ; 26 8b 94 ee 01
     xor ax, ax                                ; 31 c0
+    call 08150h                               ; e8 62 f8
+    mov ax, bx                                ; 89 d8
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
- at ahci_write_sectors:                         ; 0xf8627 LB 0x70
+ at ahci_write_sectors:                         ; 0xf88f9 LB 0x72
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -12457,39 +12754,40 @@ ahci_port_init_:                             ; 0xf838d LB 0x206
     movzx bx, byte [es:si+008h]               ; 26 0f b6 5c 08
     sub bx, strict byte 0000ch                ; 83 eb 0c
     cmp bx, strict byte 00004h                ; 83 fb 04
-    jbe short 0864fh                          ; 76 0f
+    jbe short 08921h                          ; 76 0f
     push bx                                   ; 53
-    push 00cafh                               ; 68 af 0c
-    push 00c90h                               ; 68 90 0c
+    push 00c97h                               ; 68 97 0c
+    push 00c78h                               ; 68 78 0c
     push strict byte 00007h                   ; 6a 07
-    call 01922h                               ; e8 d6 92
+    call 01972h                               ; e8 54 90
     add sp, strict byte 00008h                ; 83 c4 08
     mov es, cx                                ; 8e c1
     mov dx, word [es:si+001eeh]               ; 26 8b 94 ee 01
     xor ax, ax                                ; 31 c0
-    call 07e80h                               ; e8 25 f8
+    call 08139h                               ; e8 0c f8
     mov es, cx                                ; 8e c1
     add bx, si                                ; 01 f3
     movzx bx, byte [es:bx+001e9h]             ; 26 0f b6 9f e9 01
     mov dx, word [es:si+001eeh]               ; 26 8b 94 ee 01
     xor ax, ax                                ; 31 c0
-    call 0838dh                               ; e8 1e fd
+    call 08660h                               ; e8 1f fd
     mov bx, strict word 00035h                ; bb 35 00
     mov ax, si                                ; 89 f0
     mov dx, cx                                ; 89 ca
-    call 0807fh                               ; e8 06 fa
+    call 08338h                               ; e8 ed f9
+    mov bx, ax                                ; 89 c3
     mov es, cx                                ; 8e c1
     mov dx, word [es:si+00ah]                 ; 26 8b 54 0a
     mov word [es:si+014h], dx                 ; 26 89 54 14
     mov dx, word [es:si+001eeh]               ; 26 8b 94 ee 01
     xor ax, ax                                ; 31 c0
-    call 07e97h                               ; e8 0a f8
-    xor ax, ax                                ; 31 c0
+    call 08150h                               ; e8 ef f7
+    mov ax, bx                                ; 89 d8
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-ahci_cmd_packet_:                            ; 0xf8697 LB 0x173
+ahci_cmd_packet_:                            ; 0xf896b LB 0x173
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -12501,30 +12799,30 @@ ahci_cmd_packet_:                            ; 0xf8697 LB 0x173
     mov word [bp-010h], cx                    ; 89 4e f0
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 6a 8f
+    call 0166ch                               ; e8 e6 8c
     mov si, 00122h                            ; be 22 01
     mov word [bp-008h], ax                    ; 89 46 f8
     cmp byte [bp+00ah], 002h                  ; 80 7e 0a 02
-    jne short 086ddh                          ; 75 1f
-    mov bx, 00dbah                            ; bb ba 0d
+    jne short 089b1h                          ; 75 1f
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 18 92
-    push 00cc2h                               ; 68 c2 0c
-    push 00cd2h                               ; 68 d2 0c
+    call 01931h                               ; e8 94 8f
+    push 00caah                               ; 68 aa 0c
+    push 00cbah                               ; 68 ba 0c
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 4e 92
+    call 01972h                               ; e8 ca 8f
     add sp, strict byte 00006h                ; 83 c4 06
     mov ax, strict word 00001h                ; b8 01 00
-    jmp near 08801h                           ; e9 24 01
+    jmp near 08ad5h                           ; e9 24 01
     test byte [bp+004h], 001h                 ; f6 46 04 01
-    jne short 086d7h                          ; 75 f4
+    jne short 089abh                          ; 75 f4
     mov ax, word [bp+006h]                    ; 8b 46 06
     mov dx, word [bp+008h]                    ; 8b 56 08
     mov cx, strict word 00008h                ; b9 08 00
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 086ech                               ; e2 fa
+    loop 089c0h                               ; e2 fa
     mov es, [bp-008h]                         ; 8e 46 f8
     mov word [es:si], ax                      ; 26 89 04
     mov word [es:si+002h], dx                 ; 26 89 54 02
@@ -12536,7 +12834,7 @@ ahci_cmd_packet_:                            ; 0xf8697 LB 0x173
     mov ax, word [bp+006h]                    ; 8b 46 06
     mov dx, word [bp+008h]                    ; 8b 56 08
     xor cx, cx                                ; 31 c9
-    call 09460h                               ; e8 47 0d
+    call 09740h                               ; e8 53 0d
     mov word [es:si+00ah], ax                 ; 26 89 44 0a
     xor di, di                                ; 31 ff
     mov ax, word [es:si+001eeh]               ; 26 8b 84 ee 01
@@ -12546,28 +12844,28 @@ ahci_cmd_packet_:                            ; 0xf8697 LB 0x173
     sub word [bp-014h], strict byte 0000ch    ; 83 6e ec 0c
     xor ax, ax                                ; 31 c0
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 07e80h                               ; e8 47 f7
+    call 08139h                               ; e8 2c f7
     mov es, [bp-008h]                         ; 8e 46 f8
     mov bx, word [bp-014h]                    ; 8b 5e ec
     add bx, si                                ; 01 f3
     movzx bx, byte [es:bx+001e9h]             ; 26 0f b6 9f e9 01
     mov dx, word [es:si+001eeh]               ; 26 8b 94 ee 01
     xor ax, ax                                ; 31 c0
-    call 0838dh                               ; e8 3c fc
+    call 08660h                               ; e8 3b fc
     movzx ax, byte [bp-006h]                  ; 0f b6 46 fa
     push ax                                   ; 50
     mov bx, word [bp-012h]                    ; 8b 5e ee
     mov cx, word [bp-010h]                    ; 8b 4e f0
     mov ax, 000c0h                            ; b8 c0 00
     mov dx, word [bp-00ah]                    ; 8b 56 f6
-    call 094d7h                               ; e8 72 0d
+    call 097b7h                               ; e8 7e 0d
     mov es, [bp-008h]                         ; 8e 46 f8
     mov word [es:si+014h], di                 ; 26 89 7c 14
     mov word [es:si+016h], di                 ; 26 89 7c 16
     mov word [es:si+018h], di                 ; 26 89 7c 18
     mov ax, word [es:si+01ah]                 ; 26 8b 44 1a
     test ax, ax                               ; 85 c0
-    je short 087a3h                           ; 74 27
+    je short 08a77h                           ; 74 27
     dec ax                                    ; 48
     mov es, [bp-00ah]                         ; 8e 46 f6
     mov word [es:di+0010ch], ax               ; 26 89 85 0c 01
@@ -12580,7 +12878,7 @@ ahci_cmd_packet_:                            ; 0xf8697 LB 0x173
     mov bx, 000a0h                            ; bb a0 00
     mov ax, si                                ; 89 f0
     mov dx, word [bp-008h]                    ; 8b 56 f8
-    call 0807fh                               ; e8 d1 f8
+    call 08338h                               ; e8 b6 f8
     les bx, [bp-00eh]                         ; c4 5e f2
     mov ax, word [es:bx+004h]                 ; 26 8b 47 04
     mov dx, word [es:bx+006h]                 ; 26 8b 57 06
@@ -12603,20 +12901,20 @@ ahci_cmd_packet_:                            ; 0xf8697 LB 0x173
     pop DS                                    ; 1f
     mov ax, word [bp-00eh]                    ; 8b 46 f2
     mov dx, word [bp-00ch]                    ; 8b 56 f4
-    call 07e97h                               ; e8 aa f6
+    call 08150h                               ; e8 8f f6
     les bx, [bp-00eh]                         ; c4 5e f2
     mov ax, word [es:bx+006h]                 ; 26 8b 47 06
     or ax, word [es:bx+004h]                  ; 26 0b 47 04
-    jne short 087ffh                          ; 75 05
+    jne short 08ad3h                          ; 75 05
     mov ax, strict word 00004h                ; b8 04 00
-    jmp short 08801h                          ; eb 02
+    jmp short 08ad5h                          ; eb 02
     xor ax, ax                                ; 31 c0
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 0000ch                               ; c2 0c 00
-ahci_port_detect_device_:                    ; 0xf880a LB 0x451
+ahci_port_detect_device_:                    ; 0xf8ade LB 0x451
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -12628,10 +12926,10 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     mov byte [bp-008h], bl                    ; 88 5e f8
     movzx di, bl                              ; 0f b6 fb
     mov bx, di                                ; 89 fb
-    call 0838dh                               ; e8 69 fb
+    call 08660h                               ; e8 68 fb
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 ef 8d
+    call 0166ch                               ; e8 6b 8b
     mov word [bp-010h], 00122h                ; c7 46 f0 22 01
     mov word [bp-00eh], ax                    ; 89 46 f2
     sal di, 007h                              ; c1 e7 07
@@ -12700,9 +12998,9 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     push strict byte 00000h                   ; 6a 00
     mov bx, strict word 0000fh                ; bb 0f 00
     xor cx, cx                                ; 31 c9
-    call 07f71h                               ; e8 9a f6
+    call 0822ah                               ; e8 7f f6
     test ax, ax                               ; 85 c0
-    je near 08c53h                            ; 0f 84 76 03
+    je near 08f27h                            ; 0f 84 76 03
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     sal ax, 007h                              ; c1 e0 07
     mov word [bp-016h], ax                    ; 89 46 ea
@@ -12730,17 +13028,17 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     push strict byte 00000h                   ; 6a 00
     mov bx, strict word 0000fh                ; bb 0f 00
     xor cx, cx                                ; 31 c9
-    call 07f71h                               ; e8 4e f6
+    call 0822ah                               ; e8 33 f6
     cmp ax, strict word 00001h                ; 3d 01 00
-    je short 088ddh                           ; 74 b5
+    je short 08bb1h                           ; 74 b5
     push strict byte 00000h                   ; 6a 00
     mov bx, strict word 0000fh                ; bb 0f 00
     xor cx, cx                                ; 31 c9
     mov ax, di                                ; 89 f8
     mov dx, word [bp-01ah]                    ; 8b 56 e6
-    call 07f71h                               ; e8 3a f6
+    call 0822ah                               ; e8 1f f6
     cmp ax, strict word 00003h                ; 3d 03 00
-    jne near 08c53h                           ; 0f 85 15 03
+    jne near 08f27h                           ; 0f 85 15 03
     mov ax, word [bp-016h]                    ; 8b 46 ea
     add ax, 00130h                            ; 05 30 01
     cwd                                       ; 99
@@ -12767,14 +13065,14 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     mov al, byte [es:bx+001edh]               ; 26 8a 87 ed 01
     mov byte [bp-00ch], al                    ; 88 46 f4
     cmp AL, strict byte 004h                  ; 3c 04
-    jnc near 08c53h                           ; 0f 83 cf 02
+    jnc near 08f27h                           ; 0f 83 cf 02
     mov dx, word [bp-016h]                    ; 8b 56 ea
     add dx, 00118h                            ; 81 c2 18 01
     mov es, [bp-012h]                         ; 8e 46 ee
     mov ax, word [es:si+00260h]               ; 26 8b 84 60 02
     mov bx, strict word 00010h                ; bb 10 00
     xor cx, cx                                ; 31 c9
-    call 07eaeh                               ; e8 13 f5
+    call 08167h                               ; e8 f8 f4
     mov ax, word [bp-016h]                    ; 8b 46 ea
     add ax, 00124h                            ; 05 24 01
     cwd                                       ; 99
@@ -12798,9 +13096,9 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     mov cl, byte [bp-00ch]                    ; 8a 4e f4
     add cl, 00ch                              ; 80 c1 0c
     test dx, dx                               ; 85 d2
-    jne near 08bafh                           ; 0f 85 d8 01
+    jne near 08e83h                           ; 0f 85 d8 01
     cmp ax, 00101h                            ; 3d 01 01
-    jne near 08bafh                           ; 0f 85 d1 01
+    jne near 08e83h                           ; 0f 85 d1 01
     les bx, [bp-010h]                         ; c4 5e f0
     db  066h, 026h, 0c7h, 007h, 000h, 000h, 000h, 000h
     ; mov dword [es:bx], strict dword 000000000h ; 66 26 c7 07 00 00 00 00
@@ -12812,7 +13110,7 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     mov bx, 000ech                            ; bb ec 00
     mov ax, word [bp-010h]                    ; 8b 46 f0
     mov dx, es                                ; 8c c2
-    call 0807fh                               ; e8 76 f6
+    call 08338h                               ; e8 5b f6
     mov byte [bp-00ah], cl                    ; 88 4e f6
     test byte [bp-00226h], 080h               ; f6 86 da fd 80
     db  00fh, 095h, 0c0h
@@ -12829,9 +13127,9 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     mov word [bp-014h], ax                    ; 89 46 ec
     mov di, word [bp-001ach]                  ; 8b be 54 fe
     cmp di, 00fffh                            ; 81 ff ff 0f
-    jne short 08a4eh                          ; 75 10
+    jne short 08d22h                          ; 75 10
     cmp ax, strict word 0ffffh                ; 3d ff ff
-    jne short 08a4eh                          ; 75 0b
+    jne short 08d22h                          ; 75 0b
     mov ax, word [bp-0015eh]                  ; 8b 86 a2 fe
     mov word [bp-014h], ax                    ; 89 46 ec
     mov di, word [bp-0015ch]                  ; 8b be a4 fe
@@ -12860,62 +13158,62 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     mov word [es:si+030h], ax                 ; 26 89 44 30
     mov al, byte [bp-00ch]                    ; 8a 46 f4
     cmp AL, strict byte 001h                  ; 3c 01
-    jc short 08ab9h                           ; 72 0c
-    jbe short 08ac1h                          ; 76 12
+    jc short 08d8dh                           ; 72 0c
+    jbe short 08d95h                          ; 76 12
     cmp AL, strict byte 003h                  ; 3c 03
-    je short 08ac9h                           ; 74 16
+    je short 08d9dh                           ; 74 16
     cmp AL, strict byte 002h                  ; 3c 02
-    je short 08ac5h                           ; 74 0e
-    jmp short 08b12h                          ; eb 59
+    je short 08d99h                           ; 74 0e
+    jmp short 08de6h                          ; eb 59
     test al, al                               ; 84 c0
-    jne short 08b12h                          ; 75 55
+    jne short 08de6h                          ; 75 55
     mov DL, strict byte 040h                  ; b2 40
-    jmp short 08acbh                          ; eb 0a
+    jmp short 08d9fh                          ; eb 0a
     mov DL, strict byte 048h                  ; b2 48
-    jmp short 08acbh                          ; eb 06
+    jmp short 08d9fh                          ; eb 06
     mov DL, strict byte 050h                  ; b2 50
-    jmp short 08acbh                          ; eb 02
+    jmp short 08d9fh                          ; eb 02
     mov DL, strict byte 058h                  ; b2 58
     mov al, dl                                ; 88 d0
     add AL, strict byte 007h                  ; 04 07
     movzx bx, al                              ; 0f b6 d8
     mov ax, bx                                ; 89 d8
-    call 0165ch                               ; e8 85 8b
+    call 016ach                               ; e8 01 89
     test al, al                               ; 84 c0
-    je short 08b12h                           ; 74 37
+    je short 08de6h                           ; 74 37
     mov al, dl                                ; 88 d0
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     xor ah, ah                                ; 30 e4
-    call 0165ch                               ; e8 78 8b
+    call 016ach                               ; e8 f4 88
     xor ah, ah                                ; 30 e4
     mov si, ax                                ; 89 c6
     sal si, 008h                              ; c1 e6 08
     movzx ax, dl                              ; 0f b6 c2
-    call 0165ch                               ; e8 6b 8b
+    call 016ach                               ; e8 e7 88
     xor ah, ah                                ; 30 e4
     add ax, si                                ; 01 f0
     mov word [bp-024h], ax                    ; 89 46 dc
     mov al, dl                                ; 88 d0
     add AL, strict byte 002h                  ; 04 02
     xor ah, ah                                ; 30 e4
-    call 0165ch                               ; e8 5b 8b
+    call 016ach                               ; e8 d7 88
     xor ah, ah                                ; 30 e4
     mov word [bp-026h], ax                    ; 89 46 da
     mov ax, bx                                ; 89 d8
-    call 0165ch                               ; e8 51 8b
+    call 016ach                               ; e8 cd 88
     xor ah, ah                                ; 30 e4
     mov word [bp-022h], ax                    ; 89 46 de
-    jmp short 08b1fh                          ; eb 0d
+    jmp short 08df3h                          ; eb 0d
     mov bx, word [bp-014h]                    ; 8b 5e ec
     mov cx, di                                ; 89 f9
     mov dx, ss                                ; 8c d2
     lea ax, [bp-026h]                         ; 8d 46 da
-    call 0532eh                               ; e8 0f c8
-    mov bx, 00dbah                            ; bb ba 0d
+    call 055b6h                               ; e8 c3 c7
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 b7 8d
+    call 01931h                               ; e8 33 8b
     push di                                   ; 57
     push word [bp-014h]                       ; ff 76 ec
     mov ax, word [bp-022h]                    ; 8b 46 de
@@ -12930,9 +13228,9 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     push ax                                   ; 50
     movzx ax, byte [bp-00ch]                  ; 0f b6 46 f4
     push ax                                   ; 50
-    push 00cf2h                               ; 68 f2 0c
+    push 00cdah                               ; 68 da 0c
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 cf 8d
+    call 01972h                               ; e8 4b 8b
     add sp, strict byte 00018h                ; 83 c4 18
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
     imul ax, ax, strict byte 00018h           ; 6b c0 18
@@ -12961,18 +13259,18 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     mov byte [es:bx+0019eh], al               ; 26 88 87 9e 01
     mov dx, strict word 00075h                ; ba 75 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 01600h                               ; e8 62 8a
+    call 01650h                               ; e8 de 87
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     movzx bx, al                              ; 0f b6 d8
     mov dx, strict word 00075h                ; ba 75 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0160eh                               ; e8 62 8a
-    jmp near 08c45h                           ; e9 96 00
+    call 0165eh                               ; e8 de 87
+    jmp near 08f19h                           ; e9 96 00
     cmp dx, 0eb14h                            ; 81 fa 14 eb
-    jne near 08c45h                           ; 0f 85 8e 00
+    jne near 08f19h                           ; 0f 85 8e 00
     cmp ax, 00101h                            ; 3d 01 01
-    jne near 08c45h                           ; 0f 85 87 00
+    jne near 08f19h                           ; 0f 85 87 00
     les bx, [bp-010h]                         ; c4 5e f0
     db  066h, 026h, 0c7h, 007h, 000h, 000h, 000h, 000h
     ; mov dword [es:bx], strict dword 000000000h ; 66 26 c7 07 00 00 00 00
@@ -12984,7 +13282,7 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     mov bx, 000a1h                            ; bb a1 00
     mov ax, word [bp-010h]                    ; 8b 46 f0
     mov dx, es                                ; 8c c2
-    call 0807fh                               ; e8 96 f4
+    call 08338h                               ; e8 7b f4
     test byte [bp-00226h], 080h               ; f6 86 da fd 80
     db  00fh, 095h, 0c0h
     ; setne al                                  ; 0f 95 c0
@@ -13023,7 +13321,7 @@ ahci_port_detect_device_:                    ; 0xf880a LB 0x451
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_mem_alloc_:                             ; 0xf8c5b LB 0x43
+ahci_mem_alloc_:                             ; 0xf8f2f LB 0x43
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -13033,25 +13331,25 @@ ahci_mem_alloc_:                             ; 0xf8c5b LB 0x43
     push di                                   ; 57
     mov dx, 00413h                            ; ba 13 04
     xor ax, ax                                ; 31 c0
-    call 0161ch                               ; e8 b1 89
+    call 0166ch                               ; e8 2d 87
     test ax, ax                               ; 85 c0
-    je short 08c94h                           ; 74 25
+    je short 08f68h                           ; 74 25
     dec ax                                    ; 48
     mov bx, ax                                ; 89 c3
     xor dx, dx                                ; 31 d2
     mov cx, strict word 0000ah                ; b9 0a 00
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 08c77h                               ; e2 fa
+    loop 08f4bh                               ; e2 fa
     mov si, ax                                ; 89 c6
     mov di, dx                                ; 89 d7
     mov cx, strict word 00004h                ; b9 04 00
     shr di, 1                                 ; d1 ef
     rcr si, 1                                 ; d1 de
-    loop 08c84h                               ; e2 fa
+    loop 08f58h                               ; e2 fa
     mov dx, 00413h                            ; ba 13 04
     xor ax, ax                                ; 31 c0
-    call 0162ah                               ; e8 98 89
+    call 0167ah                               ; e8 14 87
     mov ax, si                                ; 89 f0
     lea sp, [bp-00ah]                         ; 8d 66 f6
     pop di                                    ; 5f
@@ -13061,7 +13359,7 @@ ahci_mem_alloc_:                             ; 0xf8c5b LB 0x43
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-ahci_hba_init_:                              ; 0xf8c9e LB 0x125
+ahci_hba_init_:                              ; 0xf8f72 LB 0x125
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -13073,7 +13371,7 @@ ahci_hba_init_:                              ; 0xf8c9e LB 0x125
     mov si, ax                                ; 89 c6
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, strict word 00040h                ; b8 40 00
-    call 0161ch                               ; e8 68 89
+    call 0166ch                               ; e8 e4 86
     mov bx, 00122h                            ; bb 22 01
     mov word [bp-010h], ax                    ; 89 46 f0
     mov ax, strict word 00010h                ; b8 10 00
@@ -13090,10 +13388,10 @@ ahci_hba_init_:                              ; 0xf8c9e LB 0x125
     ; mov dx, ax                                ; 8b d0
     shr eax, 010h                             ; 66 c1 e8 10
     xchg dx, ax                               ; 92
-    call 08c5bh                               ; e8 82 ff
+    call 08f2fh                               ; e8 82 ff
     mov di, ax                                ; 89 c7
     test ax, ax                               ; 85 c0
-    je near 08da2h                            ; 0f 84 c1 00
+    je near 09076h                            ; 0f 84 c1 00
     mov es, [bp-010h]                         ; 8e 46 f0
     mov word [es:bx+001eeh], di               ; 26 89 bf ee 01
     mov byte [es:bx+001edh], 000h             ; 26 c6 87 ed 01 00
@@ -13107,7 +13405,7 @@ ahci_hba_init_:                              ; 0xf8c9e LB 0x125
     xor cx, cx                                ; 31 c9
     mov dx, strict word 00004h                ; ba 04 00
     mov ax, si                                ; 89 f0
-    call 07eaeh                               ; e8 99 f1
+    call 08167h                               ; e8 7e f1
     mov ax, strict word 00004h                ; b8 04 00
     xor cx, cx                                ; 31 c9
     mov dx, si                                ; 89 f2
@@ -13124,7 +13422,7 @@ ahci_hba_init_:                              ; 0xf8c9e LB 0x125
     shr eax, 010h                             ; 66 c1 e8 10
     xchg dx, ax                               ; 92
     test AL, strict byte 001h                 ; a8 01
-    jne short 08d15h                          ; 75 de
+    jne short 08fe9h                          ; 75 de
     xor ax, ax                                ; 31 c0
     xor cx, cx                                ; 31 c9
     mov dx, si                                ; 89 f2
@@ -13142,35 +13440,35 @@ ahci_hba_init_:                              ; 0xf8c9e LB 0x125
     push strict byte 00000h                   ; 6a 00
     mov bx, strict word 0001fh                ; bb 1f 00
     xor cx, cx                                ; 31 c9
-    call 07f71h                               ; e8 16 f2
+    call 0822ah                               ; e8 fb f1
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     mov byte [bp-00eh], al                    ; 88 46 f2
     mov byte [bp-00ch], 000h                  ; c6 46 f4 00
-    jmp short 08d6fh                          ; eb 09
+    jmp short 09043h                          ; eb 09
     inc byte [bp-00ch]                        ; fe 46 f4
     cmp byte [bp-00ch], 020h                  ; 80 7e f4 20
-    jnc short 08da0h                          ; 73 31
+    jnc short 09074h                          ; 73 31
     movzx cx, byte [bp-00ch]                  ; 0f b6 4e f4
     mov ax, strict word 00001h                ; b8 01 00
     xor dx, dx                                ; 31 d2
-    jcxz 08d80h                               ; e3 06
+    jcxz 09054h                               ; e3 06
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 08d7ah                               ; e2 fa
+    loop 0904eh                               ; e2 fa
     mov bx, ax                                ; 89 c3
     mov cx, dx                                ; 89 d1
     mov dx, strict word 0000ch                ; ba 0c 00
     mov ax, si                                ; 89 f0
-    call 07f38h                               ; e8 ac f1
+    call 081f1h                               ; e8 91 f1
     test al, al                               ; 84 c0
-    je short 08d66h                           ; 74 d6
+    je short 0903ah                           ; 74 d6
     movzx bx, byte [bp-00ch]                  ; 0f b6 5e f4
     xor ax, ax                                ; 31 c0
     mov dx, di                                ; 89 fa
-    call 0880ah                               ; e8 6f fa
+    call 08adeh                               ; e8 6f fa
     dec byte [bp-00eh]                        ; fe 4e f2
-    jne short 08d66h                          ; 75 c6
+    jne short 0903ah                          ; 75 c6
     xor ax, ax                                ; 31 c0
     lea sp, [bp-00ah]                         ; 8d 66 f6
     pop di                                    ; 5f
@@ -13180,9 +13478,9 @@ ahci_hba_init_:                              ; 0xf8c9e LB 0x125
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-    db  00bh, 005h, 004h, 003h, 002h, 001h, 000h, 092h, 08eh, 070h, 08eh, 076h, 08eh, 07ch, 08eh, 082h
-    db  08eh, 088h, 08eh, 08eh, 08eh, 092h, 08eh
-_ahci_init:                                  ; 0xf8dc3 LB 0xfe
+    db  00bh, 005h, 004h, 003h, 002h, 001h, 000h, 066h, 091h, 044h, 091h, 04ah, 091h, 050h, 091h, 056h
+    db  091h, 05ch, 091h, 062h, 091h, 066h, 091h
+_ahci_init:                                  ; 0xf9097 LB 0xfe
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -13190,10 +13488,10 @@ _ahci_init:                                  ; 0xf8dc3 LB 0xfe
     sub sp, strict byte 00006h                ; 83 ec 06
     mov ax, 00601h                            ; b8 01 06
     mov dx, strict word 00001h                ; ba 01 00
-    call 092e1h                               ; e8 0d 05
+    call 095b5h                               ; e8 0d 05
     mov dx, ax                                ; 89 c2
     cmp ax, strict word 0ffffh                ; 3d ff ff
-    je near 08ebah                            ; 0f 84 dd 00
+    je near 0918eh                            ; 0f 84 dd 00
     xor al, al                                ; 30 c0
     shr ax, 008h                              ; c1 e8 08
     mov byte [bp-00ah], al                    ; 88 46 f6
@@ -13201,124 +13499,128 @@ _ahci_init:                                  ; 0xf8dc3 LB 0xfe
     xor dh, dh                                ; 30 f6
     xor ah, ah                                ; 30 e4
     mov bx, strict word 00034h                ; bb 34 00
-    call 0930ch                               ; e8 1a 05
+    call 095e0h                               ; e8 1a 05
     mov cl, al                                ; 88 c1
     test cl, cl                               ; 84 c9
-    je short 08e1bh                           ; 74 23
+    je short 090efh                           ; 74 23
     movzx bx, cl                              ; 0f b6 d9
     movzx di, byte [bp-008h]                  ; 0f b6 7e f8
     movzx si, byte [bp-00ah]                  ; 0f b6 76 f6
     mov dx, di                                ; 89 fa
     mov ax, si                                ; 89 f0
-    call 0930ch                               ; e8 02 05
+    call 095e0h                               ; e8 02 05
     cmp AL, strict byte 012h                  ; 3c 12
-    je short 08e1bh                           ; 74 0d
+    je short 090efh                           ; 74 0d
     mov al, cl                                ; 88 c8
     db  0feh, 0c0h
     ; inc al                                    ; fe c0
     movzx bx, al                              ; 0f b6 d8
     mov dx, di                                ; 89 fa
     mov ax, si                                ; 89 f0
-    jmp short 08defh                          ; eb d4
+    jmp short 090c3h                          ; eb d4
     test cl, cl                               ; 84 c9
-    je near 08ebah                            ; 0f 84 99 00
+    je near 0918eh                            ; 0f 84 99 00
     add cl, 002h                              ; 80 c1 02
     movzx bx, cl                              ; 0f b6 d9
     movzx di, byte [bp-008h]                  ; 0f b6 7e f8
     movzx si, byte [bp-00ah]                  ; 0f b6 76 f6
     mov dx, di                                ; 89 fa
     mov ax, si                                ; 89 f0
-    call 0930ch                               ; e8 d6 04
+    call 095e0h                               ; e8 d6 04
     cmp AL, strict byte 010h                  ; 3c 10
-    jne near 08ebah                           ; 0f 85 7e 00
+    jne near 0918eh                           ; 0f 85 7e 00
     mov byte [bp-006h], 000h                  ; c6 46 fa 00
     mov al, cl                                ; 88 c8
     add AL, strict byte 002h                  ; 04 02
     movzx bx, al                              ; 0f b6 d8
     mov dx, di                                ; 89 fa
     mov ax, si                                ; 89 f0
-    call 09330h                               ; e8 e2 04
+    call 09604h                               ; e8 e2 04
     mov dx, ax                                ; 89 c2
     and ax, strict word 0000fh                ; 25 0f 00
     sub ax, strict word 00004h                ; 2d 04 00
     cmp ax, strict word 0000bh                ; 3d 0b 00
-    jnbe short 08e92h                         ; 77 37
+    jnbe short 09166h                         ; 77 37
     push CS                                   ; 0e
     pop ES                                    ; 07
     mov cx, strict word 00008h                ; b9 08 00
-    mov di, 08dach                            ; bf ac 8d
+    mov di, 09080h                            ; bf 80 90
     repne scasb                               ; f2 ae
     sal cx, 1                                 ; d1 e1
     mov di, cx                                ; 89 cf
-    mov ax, word [cs:di-0724dh]               ; 2e 8b 85 b3 8d
+    mov ax, word [cs:di-06f79h]               ; 2e 8b 85 87 90
     jmp ax                                    ; ff e0
     mov byte [bp-006h], 010h                  ; c6 46 fa 10
-    jmp short 08e92h                          ; eb 1c
+    jmp short 09166h                          ; eb 1c
     mov byte [bp-006h], 014h                  ; c6 46 fa 14
-    jmp short 08e92h                          ; eb 16
+    jmp short 09166h                          ; eb 16
     mov byte [bp-006h], 018h                  ; c6 46 fa 18
-    jmp short 08e92h                          ; eb 10
+    jmp short 09166h                          ; eb 10
     mov byte [bp-006h], 01ch                  ; c6 46 fa 1c
-    jmp short 08e92h                          ; eb 0a
+    jmp short 09166h                          ; eb 0a
     mov byte [bp-006h], 020h                  ; c6 46 fa 20
-    jmp short 08e92h                          ; eb 04
+    jmp short 09166h                          ; eb 04
     mov byte [bp-006h], 024h                  ; c6 46 fa 24
     mov si, dx                                ; 89 d6
     shr si, 004h                              ; c1 ee 04
     sal si, 002h                              ; c1 e6 02
     mov al, byte [bp-006h]                    ; 8a 46 fa
     test al, al                               ; 84 c0
-    je short 08ebah                           ; 74 19
+    je short 0918eh                           ; 74 19
     movzx bx, al                              ; 0f b6 d8
     movzx dx, byte [bp-008h]                  ; 0f b6 56 f8
     movzx ax, byte [bp-00ah]                  ; 0f b6 46 f6
-    call 09352h                               ; e8 a3 04
+    call 09626h                               ; e8 a3 04
     test AL, strict byte 001h                 ; a8 01
-    je short 08ebah                           ; 74 07
+    je short 0918eh                           ; 74 07
     and AL, strict byte 0f0h                  ; 24 f0
     add ax, si                                ; 01 f0
-    call 08c9eh                               ; e8 e4 fd
+    call 08f72h                               ; e8 e4 fd
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-apm_out_str_:                                ; 0xf8ec1 LB 0x39
+apm_out_str_:                                ; 0xf9195 LB 0x39
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     mov bx, ax                                ; 89 c3
     cmp byte [bx], 000h                       ; 80 3f 00
-    je short 08ed6h                           ; 74 0a
+    je short 091aah                           ; 74 0a
     mov al, byte [bx]                         ; 8a 07
     out DX, AL                                ; ee
     inc bx                                    ; 43
     mov al, byte [bx]                         ; 8a 07
     db  00ah, 0c0h
     ; or al, al                                 ; 0a c0
-    jne short 08eceh                          ; 75 f8
+    jne short 091a2h                          ; 75 f8
     lea sp, [bp-002h]                         ; 8d 66 fe
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-    sbb ax, 0e98fh                            ; 1d 8f e9
-    db  08fh, 02fh
-    ; pop word [bx]                             ; 8f 2f
-    db  08fh, 04ah, 08fh
-    ; pop word [bp+si-071h]                     ; 8f 4a 8f
-    jmp near 00476h                           ; e9 8f 75
-    db  08fh, 0e9h
-    ; pop cx                                    ; 8f e9
-    db  08fh, 07ah, 08fh
-    ; pop word [bp+si-071h]                     ; 8f 7a 8f
-    mov si, 0be8fh                            ; be 8f be
-    db  08fh, 0beh, 08fh, 0b9h
-    ; pop word [bp-04671h]                      ; 8f be 8f b9
-    db  08fh, 0beh, 08fh, 0beh
-    ; pop word [bp-04171h]                      ; 8f be 8f be
-    db  08fh
-    mov DL, strict byte 08fh                  ; b2 8f
-_apm_function:                               ; 0xf8efa LB 0xf5
+    db  0f1h
+    xchg cx, ax                               ; 91
+    mov bp, 00392h                            ; bd 92 03
+    xchg dx, ax                               ; 92
+    push DS                                   ; 1e
+    xchg dx, ax                               ; 92
+    mov bp, 04992h                            ; bd 92 49
+    xchg dx, ax                               ; 92
+    mov bp, 04e92h                            ; bd 92 4e
+    xchg dx, ax                               ; 92
+    xchg dx, ax                               ; 92
+    xchg dx, ax                               ; 92
+    xchg dx, ax                               ; 92
+    xchg dx, ax                               ; 92
+    xchg dx, ax                               ; 92
+    xchg dx, ax                               ; 92
+    lea dx, [bp+si-06d6eh]                    ; 8d 92 92 92
+    xchg dx, ax                               ; 92
+    xchg dx, ax                               ; 92
+    db  086h
+    xchg dx, ax                               ; 92
+_apm_function:                               ; 0xf91ce LB 0xf5
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -13326,23 +13628,23 @@ _apm_function:                               ; 0xf8efa LB 0xf5
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
     cmp ax, strict word 0000eh                ; 3d 0e 00
-    jnbe near 08fbeh                          ; 0f 87 b0 00
+    jnbe near 09292h                          ; 0f 87 b0 00
     mov bx, ax                                ; 89 c3
     add bx, ax                                ; 01 c3
     mov dx, word [bp+018h]                    ; 8b 56 18
     or dl, 001h                               ; 80 ca 01
-    jmp word [cs:bx-07124h]                   ; 2e ff a7 dc 8e
+    jmp word [cs:bx-06e50h]                   ; 2e ff a7 b0 91
     mov word [bp+012h], 00102h                ; c7 46 12 02 01
     mov word [bp+00ch], 0504dh                ; c7 46 0c 4d 50
     mov word [bp+010h], strict word 00003h    ; c7 46 10 03 00
-    jmp near 08fe9h                           ; e9 ba 00
+    jmp near 092bdh                           ; e9 ba 00
     mov word [bp+012h], 0f000h                ; c7 46 12 00 f0
-    mov word [bp+00ch], 09544h                ; c7 46 0c 44 95
+    mov word [bp+00ch], 09824h                ; c7 46 0c 24 98
     mov word [bp+010h], 0f000h                ; c7 46 10 00 f0
     mov ax, strict word 0fff0h                ; b8 f0 ff
     mov word [bp+006h], ax                    ; 89 46 06
     mov word [bp+004h], ax                    ; 89 46 04
-    jmp near 08fe9h                           ; e9 9f 00
+    jmp near 092bdh                           ; e9 9f 00
     mov word [bp+012h], 0f000h                ; c7 46 12 00 f0
     mov word [bp+00ch], 0da40h                ; c7 46 0c 40 da
     mov ax, 0f000h                            ; b8 00 f0
@@ -13355,43 +13657,43 @@ _apm_function:                               ; 0xf8efa LB 0xf5
     sal ebx, 010h                             ; 66 c1 e3 10
     mov si, ax                                ; 89 c6
     sal esi, 010h                             ; 66 c1 e6 10
-    jmp near 08fe9h                           ; e9 74 00
+    jmp near 092bdh                           ; e9 74 00
     sti                                       ; fb
     hlt                                       ; f4
-    jmp near 08fe9h                           ; e9 6f 00
+    jmp near 092bdh                           ; e9 6f 00
     cmp word [bp+010h], strict byte 00003h    ; 83 7e 10 03
-    je short 08f9fh                           ; 74 1f
+    je short 09273h                           ; 74 1f
     cmp word [bp+010h], strict byte 00002h    ; 83 7e 10 02
-    je short 08f97h                           ; 74 11
+    je short 0926bh                           ; 74 11
     cmp word [bp+010h], strict byte 00001h    ; 83 7e 10 01
-    jne short 08fa7h                          ; 75 1b
+    jne short 0927bh                          ; 75 1b
     mov dx, 08900h                            ; ba 00 89
-    mov ax, 00d2ah                            ; b8 2a 0d
-    call 08ec1h                               ; e8 2c ff
-    jmp short 08fe9h                          ; eb 52
+    mov ax, 00d12h                            ; b8 12 0d
+    call 09195h                               ; e8 2c ff
+    jmp short 092bdh                          ; eb 52
     mov dx, 08900h                            ; ba 00 89
-    mov ax, 00d32h                            ; b8 32 0d
-    jmp short 08f92h                          ; eb f3
+    mov ax, 00d1ah                            ; b8 1a 0d
+    jmp short 09266h                          ; eb f3
     mov dx, 08900h                            ; ba 00 89
-    mov ax, 00d3ah                            ; b8 3a 0d
-    jmp short 08f92h                          ; eb eb
+    mov ax, 00d22h                            ; b8 22 0d
+    jmp short 09266h                          ; eb eb
     or ah, 00ah                               ; 80 cc 0a
     mov word [bp+012h], ax                    ; 89 46 12
     mov word [bp+018h], dx                    ; 89 56 18
-    jmp short 08fe9h                          ; eb 37
+    jmp short 092bdh                          ; eb 37
     mov word [bp+012h], 00102h                ; c7 46 12 02 01
-    jmp short 08fe9h                          ; eb 30
+    jmp short 092bdh                          ; eb 30
     or ah, 080h                               ; 80 cc 80
-    jmp short 08faah                          ; eb ec
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp short 0927eh                          ; eb ec
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 18 89
+    call 01931h                               ; e8 94 86
     push word [bp+00ch]                       ; ff 76 0c
     push word [bp+012h]                       ; ff 76 12
-    push 00d43h                               ; 68 43 0d
+    push 00d2bh                               ; 68 2b 0d
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 4b 89
+    call 01972h                               ; e8 c7 86
     add sp, strict byte 00008h                ; 83 c4 08
     mov ax, word [bp+012h]                    ; 8b 46 12
     xor ah, ah                                ; 30 e4
@@ -13402,7 +13704,7 @@ _apm_function:                               ; 0xf8efa LB 0xf5
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-pci16_select_reg_:                           ; 0xf8fef LB 0x24
+pci16_select_reg_:                           ; 0xf92c3 LB 0x24
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -13419,7 +13721,7 @@ pci16_select_reg_:                           ; 0xf8fef LB 0x24
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-pci16_find_device_:                          ; 0xf9013 LB 0xf7
+pci16_find_device_:                          ; 0xf92e7 LB 0xf7
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -13433,49 +13735,49 @@ pci16_find_device_:                          ; 0xf9013 LB 0xf7
     xor bx, bx                                ; 31 db
     mov byte [bp-008h], 000h                  ; c6 46 f8 00
     test bl, 007h                             ; f6 c3 07
-    jne short 0905bh                          ; 75 2d
+    jne short 0932fh                          ; 75 2d
     mov dx, strict word 0000eh                ; ba 0e 00
     mov ax, bx                                ; 89 d8
-    call 08fefh                               ; e8 b9 ff
+    call 092c3h                               ; e8 b9 ff
     mov dx, 00cfeh                            ; ba fe 0c
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     mov byte [bp-006h], al                    ; 88 46 fa
     cmp AL, strict byte 0ffh                  ; 3c ff
-    jne short 09049h                          ; 75 06
+    jne short 0931dh                          ; 75 06
     add bx, strict byte 00008h                ; 83 c3 08
-    jmp near 090dch                           ; e9 93 00
+    jmp near 093b0h                           ; e9 93 00
     test byte [bp-006h], 080h                 ; f6 46 fa 80
-    je short 09056h                           ; 74 07
+    je short 0932ah                           ; 74 07
     mov word [bp-00ah], strict word 00001h    ; c7 46 f6 01 00
-    jmp short 0905bh                          ; eb 05
+    jmp short 0932fh                          ; eb 05
     mov word [bp-00ah], strict word 00008h    ; c7 46 f6 08 00
     mov al, byte [bp-006h]                    ; 8a 46 fa
     and AL, strict byte 007h                  ; 24 07
     cmp AL, strict byte 001h                  ; 3c 01
-    jne short 09083h                          ; 75 1f
+    jne short 09357h                          ; 75 1f
     mov ax, bx                                ; 89 d8
     shr ax, 008h                              ; c1 e8 08
     test ax, ax                               ; 85 c0
-    jne short 09083h                          ; 75 16
+    jne short 09357h                          ; 75 16
     mov dx, strict word 0001ah                ; ba 1a 00
     mov ax, bx                                ; 89 d8
-    call 08fefh                               ; e8 7a ff
+    call 092c3h                               ; e8 7a ff
     mov dx, 00cfeh                            ; ba fe 0c
     in AL, DX                                 ; ec
     db  02ah, 0e4h
     ; sub ah, ah                                ; 2a e4
     cmp al, byte [bp-008h]                    ; 3a 46 f8
-    jbe short 09083h                          ; 76 03
+    jbe short 09357h                          ; 76 03
     mov byte [bp-008h], al                    ; 88 46 f8
     test di, di                               ; 85 ff
-    je short 0908ch                           ; 74 05
+    je short 09360h                           ; 74 05
     mov dx, strict word 00008h                ; ba 08 00
-    jmp short 0908eh                          ; eb 02
+    jmp short 09362h                          ; eb 02
     xor dx, dx                                ; 31 d2
     mov ax, bx                                ; 89 d8
-    call 08fefh                               ; e8 5c ff
+    call 092c3h                               ; e8 5c ff
     mov dx, 00cfch                            ; ba fc 0c
     in eax, DX                                ; 66 ed
     db  08bh, 0d0h
@@ -13486,50 +13788,46 @@ pci16_find_device_:                          ; 0xf9013 LB 0xf7
     mov word [bp-00ch], dx                    ; 89 56 f4
     mov word [bp-010h], strict word 00000h    ; c7 46 f0 00 00
     test di, di                               ; 85 ff
-    je short 090bdh                           ; 74 0f
+    je short 09391h                           ; 74 0f
     mov cx, strict word 00008h                ; b9 08 00
     shr dx, 1                                 ; d1 ea
     rcr ax, 1                                 ; d1 d8
-    loop 090b1h                               ; e2 fa
+    loop 09385h                               ; e2 fa
     mov word [bp-00eh], ax                    ; 89 46 f2
     mov word [bp-00ch], dx                    ; 89 56 f4
     mov ax, word [bp-00ch]                    ; 8b 46 f4
     cmp ax, word [bp-014h]                    ; 3b 46 ec
-    jne short 090cdh                          ; 75 08
+    jne short 093a1h                          ; 75 08
     mov ax, word [bp-00eh]                    ; 8b 46 f2
     cmp ax, word [bp-012h]                    ; 3b 46 ee
-    je short 090d3h                           ; 74 06
+    je short 093a7h                           ; 74 06
     cmp word [bp-010h], strict byte 00000h    ; 83 7e f0 00
-    je short 090d9h                           ; 74 06
+    je short 093adh                           ; 74 06
     dec si                                    ; 4e
     cmp si, strict byte 0ffffh                ; 83 fe ff
-    je short 090ebh                           ; 74 12
+    je short 093bfh                           ; 74 12
     add bx, word [bp-00ah]                    ; 03 5e f6
     mov dx, bx                                ; 89 da
     shr dx, 008h                              ; c1 ea 08
     movzx ax, byte [bp-008h]                  ; 0f b6 46 f8
     cmp dx, ax                                ; 39 c2
-    jbe near 09029h                           ; 0f 86 3e ff
+    jbe near 092fdh                           ; 0f 86 3e ff
     cmp si, strict byte 0ffffh                ; 83 fe ff
-    jne short 090f4h                          ; 75 04
+    jne short 093c8h                          ; 75 04
     mov ax, bx                                ; 89 d8
-    jmp short 090f7h                          ; eb 03
+    jmp short 093cbh                          ; eb 03
     mov ax, strict word 0ffffh                ; b8 ff ff
     lea sp, [bp-004h]                         ; 8d 66 fc
     pop di                                    ; 5f
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-    in AL, DX                                 ; ec
-    xchg cx, ax                               ; 91
-    push ES                                   ; 06
-    xchg dx, ax                               ; 92
-    sbb word [bp+si-06dd2h], dx               ; 19 92 2e 92
-    inc cx                                    ; 41
-    xchg dx, ax                               ; 92
-    push sp                                   ; 54
-    xchg dx, ax                               ; 92
-_pci16_function:                             ; 0xf910a LB 0x1d7
+    rcl byte [si-06b26h], 0edh                ; c0 94 da 94 ed
+    xchg sp, ax                               ; 94
+    add dl, byte [di-06aebh]                  ; 02 95 15 95
+    db  028h
+    xchg bp, ax                               ; 95
+_pci16_function:                             ; 0xf93de LB 0x1d7
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -13543,69 +13841,69 @@ _pci16_function:                             ; 0xf910a LB 0x1d7
     mov ax, word [bp+020h]                    ; 8b 46 20
     xor ah, ah                                ; 30 e4
     cmp bx, strict byte 00003h                ; 83 fb 03
-    jc short 09143h                           ; 72 1a
-    jbe short 0919bh                          ; 76 70
+    jc short 09417h                           ; 72 1a
+    jbe short 0946fh                          ; 76 70
     cmp bx, strict byte 0000eh                ; 83 fb 0e
-    je near 09268h                            ; 0f 84 36 01
+    je near 0953ch                            ; 0f 84 36 01
     cmp bx, strict byte 00008h                ; 83 fb 08
-    jc near 092adh                            ; 0f 82 74 01
+    jc near 09581h                            ; 0f 82 74 01
     cmp bx, strict byte 0000dh                ; 83 fb 0d
-    jbe near 091c0h                           ; 0f 86 80 00
-    jmp near 092adh                           ; e9 6a 01
+    jbe near 09494h                           ; 0f 86 80 00
+    jmp near 09581h                           ; e9 6a 01
     cmp bx, strict byte 00002h                ; 83 fb 02
-    je short 0916bh                           ; 74 23
+    je short 0943fh                           ; 74 23
     cmp bx, strict byte 00001h                ; 83 fb 01
-    jne near 092adh                           ; 0f 85 5e 01
+    jne near 09581h                           ; 0f 85 5e 01
     mov word [bp+020h], strict word 00001h    ; c7 46 20 01 00
     mov word [bp+014h], 00210h                ; c7 46 14 10 02
     mov word [bp+01ch], strict word 00000h    ; c7 46 1c 00 00
     mov word [bp+018h], 04350h                ; c7 46 18 50 43
     mov word [bp+01ah], 02049h                ; c7 46 1a 49 20
-    jmp near 092dah                           ; e9 6f 01
+    jmp near 095aeh                           ; e9 6f 01
     cmp word [bp+018h], strict byte 0ffffh    ; 83 7e 18 ff
-    jne short 09177h                          ; 75 06
+    jne short 0944bh                          ; 75 06
     or ah, 083h                               ; 80 cc 83
-    jmp near 092d3h                           ; e9 5c 01
+    jmp near 095a7h                           ; e9 5c 01
     mov bx, word [bp+008h]                    ; 8b 5e 08
     mov dx, word [bp+01ch]                    ; 8b 56 1c
     mov ax, word [bp+018h]                    ; 8b 46 18
     xor cx, cx                                ; 31 c9
-    call 09013h                               ; e8 8e fe
+    call 092e7h                               ; e8 8e fe
     cmp ax, strict word 0ffffh                ; 3d ff ff
-    jne short 09195h                          ; 75 0b
+    jne short 09469h                          ; 75 0b
     mov ax, word [bp+020h]                    ; 8b 46 20
     xor ah, ah                                ; 30 e4
     or ah, 086h                               ; 80 cc 86
-    jmp near 092d3h                           ; e9 3e 01
+    jmp near 095a7h                           ; e9 3e 01
     mov word [bp+014h], ax                    ; 89 46 14
-    jmp near 092dah                           ; e9 3f 01
+    jmp near 095aeh                           ; e9 3f 01
     mov bx, word [bp+008h]                    ; 8b 5e 08
     mov ax, word [bp+01ch]                    ; 8b 46 1c
     mov dx, word [bp+01eh]                    ; 8b 56 1e
     mov cx, strict word 00001h                ; b9 01 00
-    call 09013h                               ; e8 69 fe
+    call 092e7h                               ; e8 69 fe
     cmp ax, strict word 0ffffh                ; 3d ff ff
-    jne short 091bah                          ; 75 0b
+    jne short 0948eh                          ; 75 0b
     mov ax, word [bp+020h]                    ; 8b 46 20
     xor ah, ah                                ; 30 e4
     or ah, 086h                               ; 80 cc 86
-    jmp near 092d3h                           ; e9 19 01
+    jmp near 095a7h                           ; e9 19 01
     mov word [bp+014h], ax                    ; 89 46 14
-    jmp near 092dah                           ; e9 1a 01
+    jmp near 095aeh                           ; e9 1a 01
     cmp word [bp+004h], 00100h                ; 81 7e 04 00 01
-    jc short 091cdh                           ; 72 06
+    jc short 094a1h                           ; 72 06
     or ah, 087h                               ; 80 cc 87
-    jmp near 092d3h                           ; e9 06 01
+    jmp near 095a7h                           ; e9 06 01
     mov dx, word [bp+004h]                    ; 8b 56 04
     mov ax, word [bp+014h]                    ; 8b 46 14
-    call 08fefh                               ; e8 19 fe
+    call 092c3h                               ; e8 19 fe
     mov bx, word [bp+020h]                    ; 8b 5e 20
     xor bh, bh                                ; 30 ff
     sub bx, strict byte 00008h                ; 83 eb 08
     cmp bx, strict byte 00005h                ; 83 fb 05
-    jnbe near 092dah                          ; 0f 87 f5 00
+    jnbe near 095aeh                          ; 0f 87 f5 00
     add bx, bx                                ; 01 db
-    jmp word [cs:bx-06f02h]                   ; 2e ff a7 fe 90
+    jmp word [cs:bx-06c2eh]                   ; 2e ff a7 d2 93
     mov bx, word [bp+01ch]                    ; 8b 5e 1c
     xor bl, bl                                ; 30 db
     mov dx, word [bp+004h]                    ; 8b 56 04
@@ -13616,14 +13914,14 @@ _pci16_function:                             ; 0xf910a LB 0x1d7
     ; sub ah, ah                                ; 2a e4
     or bx, ax                                 ; 09 c3
     mov word [bp+01ch], bx                    ; 89 5e 1c
-    jmp near 092dah                           ; e9 d4 00
+    jmp near 095aeh                           ; e9 d4 00
     mov dx, word [bp+004h]                    ; 8b 56 04
     xor dh, dh                                ; 30 f6
     and dl, 002h                              ; 80 e2 02
     add dx, 00cfch                            ; 81 c2 fc 0c
     in ax, DX                                 ; ed
     mov word [bp+01ch], ax                    ; 89 46 1c
-    jmp near 092dah                           ; e9 c1 00
+    jmp near 095aeh                           ; e9 c1 00
     mov dx, 00cfch                            ; ba fc 0c
     in eax, DX                                ; 66 ed
     db  08bh, 0d0h
@@ -13632,21 +13930,21 @@ _pci16_function:                             ; 0xf910a LB 0x1d7
     xchg dx, ax                               ; 92
     mov word [bp+01ch], ax                    ; 89 46 1c
     mov word [bp+01eh], dx                    ; 89 56 1e
-    jmp near 092dah                           ; e9 ac 00
+    jmp near 095aeh                           ; e9 ac 00
     mov ax, word [bp+01ch]                    ; 8b 46 1c
     mov dx, word [bp+004h]                    ; 8b 56 04
     xor dh, dh                                ; 30 f6
     and dl, 003h                              ; 80 e2 03
     add dx, 00cfch                            ; 81 c2 fc 0c
     out DX, AL                                ; ee
-    jmp near 092dah                           ; e9 99 00
+    jmp near 095aeh                           ; e9 99 00
     mov ax, word [bp+01ch]                    ; 8b 46 1c
     mov dx, word [bp+004h]                    ; 8b 56 04
     xor dh, dh                                ; 30 f6
     and dl, 002h                              ; 80 e2 02
     add dx, 00cfch                            ; 81 c2 fc 0c
     out DX, ax                                ; ef
-    jmp near 092dah                           ; e9 86 00
+    jmp near 095aeh                           ; e9 86 00
     mov ax, word [bp+01ch]                    ; 8b 46 1c
     mov cx, word [bp+01eh]                    ; 8b 4e 1e
     mov dx, 00cfch                            ; ba fc 0c
@@ -13655,20 +13953,20 @@ _pci16_function:                             ; 0xf910a LB 0x1d7
     db  08bh, 0c1h
     ; mov ax, cx                                ; 8b c1
     out DX, eax                               ; 66 ef
-    jmp short 092dah                          ; eb 72
+    jmp short 095aeh                          ; eb 72
     mov bx, word [bp+004h]                    ; 8b 5e 04
     mov es, [bp+026h]                         ; 8e 46 26
     mov word [bp-008h], bx                    ; 89 5e f8
     mov [bp-006h], es                         ; 8c 46 fa
     mov cx, word [0f4a0h]                     ; 8b 0e a0 f4
     cmp cx, word [es:bx]                      ; 26 3b 0f
-    jbe short 0928eh                          ; 76 11
+    jbe short 09562h                          ; 76 11
     mov ax, word [bp+020h]                    ; 8b 46 20
     xor ah, ah                                ; 30 e4
     or ah, 089h                               ; 80 cc 89
     mov word [bp+020h], ax                    ; 89 46 20
     or word [bp+02ch], strict byte 00001h     ; 83 4e 2c 01
-    jmp short 092a2h                          ; eb 14
+    jmp short 09576h                          ; eb 14
     les di, [es:bx+002h]                      ; 26 c4 7f 02
     mov si, 0f2c0h                            ; be c0 f2
     mov dx, ds                                ; 8c da
@@ -13680,18 +13978,18 @@ _pci16_function:                             ; 0xf910a LB 0x1d7
     mov ax, word [0f4a0h]                     ; a1 a0 f4
     les bx, [bp-008h]                         ; c4 5e f8
     mov word [es:bx], ax                      ; 26 89 07
-    jmp short 092dah                          ; eb 2d
-    mov bx, 00dbah                            ; bb ba 0d
+    jmp short 095aeh                          ; eb 2d
+    mov bx, 00da8h                            ; bb a8 0d
     mov cx, ds                                ; 8c d9
     mov ax, strict word 00004h                ; b8 04 00
-    call 018e1h                               ; e8 29 86
+    call 01931h                               ; e8 a5 83
     mov ax, word [bp+014h]                    ; 8b 46 14
     push ax                                   ; 50
     mov ax, word [bp+020h]                    ; 8b 46 20
     push ax                                   ; 50
-    push 00d76h                               ; 68 76 0d
+    push 00d5eh                               ; 68 5e 0d
     push strict byte 00004h                   ; 6a 04
-    call 01922h                               ; e8 5a 86
+    call 01972h                               ; e8 d6 83
     add sp, strict byte 00008h                ; 83 c4 08
     mov ax, word [bp+020h]                    ; 8b 46 20
     xor ah, ah                                ; 30 e4
@@ -13703,7 +14001,7 @@ _pci16_function:                             ; 0xf910a LB 0x1d7
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn                                      ; c3
-pci_find_classcode_:                         ; 0xf92e1 LB 0x2b
+pci_find_classcode_:                         ; 0xf95b5 LB 0x2b
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
@@ -13718,7 +14016,7 @@ pci_find_classcode_:                         ; 0xf92e1 LB 0x2b
     ; mov cx, dx                                ; 8b ca
     int 01ah                                  ; cd 1a
     cmp ah, 000h                              ; 80 fc 00
-    je near 09302h                            ; 0f 84 03 00
+    je near 095d6h                            ; 0f 84 03 00
     mov bx, strict word 0ffffh                ; bb ff ff
     mov ax, bx                                ; 89 d8
     lea sp, [bp-006h]                         ; 8d 66 fa
@@ -13727,7 +14025,7 @@ pci_find_classcode_:                         ; 0xf92e1 LB 0x2b
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-pci_read_config_byte_:                       ; 0xf930c LB 0x24
+pci_read_config_byte_:                       ; 0xf95e0 LB 0x24
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -13746,7 +14044,7 @@ pci_read_config_byte_:                       ; 0xf930c LB 0x24
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-pci_read_config_word_:                       ; 0xf9330 LB 0x22
+pci_read_config_word_:                       ; 0xf9604 LB 0x22
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -13765,7 +14063,7 @@ pci_read_config_word_:                       ; 0xf9330 LB 0x22
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-pci_read_config_dword_:                      ; 0xf9352 LB 0x27
+pci_read_config_dword_:                      ; 0xf9626 LB 0x27
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push cx                                   ; 51
@@ -13786,7 +14084,7 @@ pci_read_config_dword_:                      ; 0xf9352 LB 0x27
     pop cx                                    ; 59
     pop bp                                    ; 5d
     retn                                      ; c3
-vds_is_present_:                             ; 0xf9379 LB 0x1d
+vds_is_present_:                             ; 0xf964d LB 0x1d
     push bx                                   ; 53
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
@@ -13794,7 +14092,7 @@ vds_is_present_:                             ; 0xf9379 LB 0x1d
     mov ax, strict word 00040h                ; b8 40 00
     mov es, ax                                ; 8e c0
     test byte [es:bx], 020h                   ; 26 f6 07 20
-    je short 09391h                           ; 74 06
+    je short 09665h                           ; 74 06
     mov ax, strict word 00001h                ; b8 01 00
     pop bp                                    ; 5d
     pop bx                                    ; 5b
@@ -13803,7 +14101,7 @@ vds_is_present_:                             ; 0xf9379 LB 0x1d
     pop bp                                    ; 5d
     pop bx                                    ; 5b
     retn                                      ; c3
-vds_real_to_lin_:                            ; 0xf9396 LB 0x1e
+vds_real_to_lin_:                            ; 0xf966a LB 0x1e
     push bx                                   ; 53
     push cx                                   ; 51
     push bp                                   ; 55
@@ -13814,7 +14112,7 @@ vds_real_to_lin_:                            ; 0xf9396 LB 0x1e
     mov cx, strict word 00004h                ; b9 04 00
     sal ax, 1                                 ; d1 e0
     rcl dx, 1                                 ; d1 d2
-    loop 093a4h                               ; e2 fa
+    loop 09678h                               ; e2 fa
     xor cx, cx                                ; 31 c9
     add ax, bx                                ; 01 d8
     adc dx, cx                                ; 11 ca
@@ -13822,7 +14120,7 @@ vds_real_to_lin_:                            ; 0xf9396 LB 0x1e
     pop cx                                    ; 59
     pop bx                                    ; 5b
     retn                                      ; c3
-vds_build_sg_list_:                          ; 0xf93b4 LB 0x79
+vds_build_sg_list_:                          ; 0xf9688 LB 0x79
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push si                                   ; 56
@@ -13836,23 +14134,23 @@ vds_build_sg_list_:                          ; 0xf93b4 LB 0x79
     mov word [es:di], bx                      ; 26 89 1d
     mov bx, word [bp+006h]                    ; 8b 5e 06
     mov word [es:di+002h], bx                 ; 26 89 5d 02
-    call 09396h                               ; e8 c3 ff
+    call 0966ah                               ; e8 c3 ff
     mov es, si                                ; 8e c6
     mov word [es:di+004h], ax                 ; 26 89 45 04
     mov word [es:di+006h], dx                 ; 26 89 55 06
     mov word [es:di+008h], strict word 00000h ; 26 c7 45 08 00 00
-    call 09379h                               ; e8 93 ff
+    call 0964dh                               ; e8 93 ff
     test ax, ax                               ; 85 c0
-    je short 093fdh                           ; 74 13
+    je short 096d1h                           ; 74 13
     mov es, si                                ; 8e c6
     mov ax, 08105h                            ; b8 05 81
     mov dx, strict word 00000h                ; ba 00 00
     int 04bh                                  ; cd 4b
-    jc near 093fah                            ; 0f 82 02 00
+    jc near 096ceh                            ; 0f 82 02 00
     db  032h, 0c0h
     ; xor al, al                                ; 32 c0
     cbw                                       ; 98
-    jmp short 09424h                          ; eb 27
+    jmp short 096f8h                          ; eb 27
     mov es, si                                ; 8e c6
     mov word [es:di+00eh], strict word 00001h ; 26 c7 45 0e 01 00
     mov dx, word [es:di+004h]                 ; 26 8b 55 04
@@ -13869,21 +14167,21 @@ vds_build_sg_list_:                          ; 0xf93b4 LB 0x79
     pop si                                    ; 5e
     pop bp                                    ; 5d
     retn 00004h                               ; c2 04 00
-vds_free_sg_list_:                           ; 0xf942d LB 0x33
+vds_free_sg_list_:                           ; 0xf9701 LB 0x3f
     push bp                                   ; 55
     mov bp, sp                                ; 89 e5
     push bx                                   ; 53
     push di                                   ; 57
     mov bx, ax                                ; 89 c3
-    call 09379h                               ; e8 42 ff
+    call 0964dh                               ; e8 42 ff
     test ax, ax                               ; 85 c0
-    je short 0944eh                           ; 74 13
+    je short 09722h                           ; 74 13
     mov di, bx                                ; 89 df
     mov es, dx                                ; 8e c2
     mov ax, 08106h                            ; b8 06 81
     mov dx, strict word 00000h                ; ba 00 00
     int 04bh                                  ; cd 4b
-    jc near 0944dh                            ; 0f 82 02 00
+    jc near 09721h                            ; 0f 82 02 00
     db  032h, 0c0h
     ; xor al, al                                ; 32 c0
     cbw                                       ; 98
@@ -13894,8 +14192,8 @@ vds_free_sg_list_:                           ; 0xf942d LB 0x33
     pop bx                                    ; 5b
     pop bp                                    ; 5d
     retn                                      ; c3
-    times 0x3 db 0
-__U4D:                                       ; 0xf9460 LB 0x39
+    times 0xf db 0
+__U4D:                                       ; 0xf9740 LB 0x39
     pushfw                                    ; 9c
     push eax                                  ; 66 50
     push edx                                  ; 66 52
@@ -13925,7 +14223,7 @@ __U4D:                                       ; 0xf9460 LB 0x39
     rol eax, 010h                             ; 66 c1 c0 10
     popfw                                     ; 9d
     retn                                      ; c3
-__U4M:                                       ; 0xf9499 LB 0x31
+__U4M:                                       ; 0xf9779 LB 0x31
     pushfw                                    ; 9c
     push eax                                  ; 66 50
     push edx                                  ; 66 52
@@ -13950,7 +14248,7 @@ __U4M:                                       ; 0xf9499 LB 0x31
     rol eax, 010h                             ; 66 c1 c0 10
     popfw                                     ; 9d
     retn                                      ; c3
-_fmemset_:                                   ; 0xf94ca LB 0xd
+_fmemset_:                                   ; 0xf97aa LB 0xd
     push di                                   ; 57
     mov es, dx                                ; 8e c2
     db  08bh, 0f8h
@@ -13960,7 +14258,7 @@ _fmemset_:                                   ; 0xf94ca LB 0xd
     xchg al, bl                               ; 86 d8
     pop di                                    ; 5f
     retn                                      ; c3
-_fmemcpy_:                                   ; 0xf94d7 LB 0x33
+_fmemcpy_:                                   ; 0xf97b7 LB 0x33
     push bp                                   ; 55
     db  08bh, 0ech
     ; mov bp, sp                                ; 8b ec
@@ -13980,21 +14278,21 @@ _fmemcpy_:                                   ; 0xf94d7 LB 0x33
     pop di                                    ; 5f
     leave                                     ; c9
     retn                                      ; c3
-    add byte [bx+si], ah                      ; 00 20
-    xchg bp, ax                               ; 95
-    and dl, byte [di-06adah]                  ; 22 95 26 95
-    db  026h, 095h
-    ; es xchg bp, ax                            ; 26 95
-    db  026h, 095h
-    ; es xchg bp, ax                            ; 26 95
-    sub byte [di-06ad8h], dl                  ; 28 95 28 95
-    sub dl, byte [di-06ad2h]                  ; 2a 95 2e 95
-    db  02eh, 095h
-    ; cs xchg bp, ax                            ; 2e 95
-    xor byte [di-06acbh], dl                  ; 30 95 35 95
-    aaa                                       ; 37
-    xchg bp, ax                               ; 95
-apm_worker:                                  ; 0xf950a LB 0x3a
+    add byte [bx+si], al                      ; 00 00
+    cbw                                       ; 98
+    add bl, byte [bx+si-067fah]               ; 02 98 06 98
+    push ES                                   ; 06
+    cbw                                       ; 98
+    push ES                                   ; 06
+    cbw                                       ; 98
+    or byte [bx+si-067f8h], bl                ; 08 98 08 98
+    or bl, byte [bx+si-067f2h]                ; 0a 98 0e 98
+    push CS                                   ; 0e
+    cbw                                       ; 98
+    adc byte [bx+si-067ebh], bl               ; 10 98 15 98
+    pop SS                                    ; 17
+    cbw                                       ; 98
+apm_worker:                                  ; 0xf97ea LB 0x3a
     sti                                       ; fb
     push ax                                   ; 50
     db  032h, 0e4h
@@ -14006,29 +14304,29 @@ apm_worker:                                  ; 0xf950a LB 0x3a
     cmp AL, strict byte 00dh                  ; 3c 0d
     pop ax                                    ; 58
     mov AH, strict byte 053h                  ; b4 53
-    jnc short 09540h                          ; 73 25
-    jmp word [cs:bp-06b10h]                   ; 2e ff a6 f0 94
-    jmp short 0953eh                          ; eb 1c
+    jnc short 09820h                          ; 73 25
+    jmp word [cs:bp-06830h]                   ; 2e ff a6 d0 97
+    jmp short 0981eh                          ; eb 1c
     sti                                       ; fb
     hlt                                       ; f4
-    jmp short 0953eh                          ; eb 18
-    jmp short 0953eh                          ; eb 16
-    jmp short 09540h                          ; eb 16
+    jmp short 0981eh                          ; eb 18
+    jmp short 0981eh                          ; eb 16
+    jmp short 09820h                          ; eb 16
     mov AH, strict byte 080h                  ; b4 80
-    jmp short 09542h                          ; eb 14
-    jmp short 09540h                          ; eb 10
+    jmp short 09822h                          ; eb 14
+    jmp short 09820h                          ; eb 10
     mov ax, 00102h                            ; b8 02 01
-    jmp short 0953eh                          ; eb 09
-    jmp short 0953eh                          ; eb 07
+    jmp short 0981eh                          ; eb 09
+    jmp short 0981eh                          ; eb 07
     mov BL, strict byte 000h                  ; b3 00
     mov cx, strict word 00000h                ; b9 00 00
-    jmp short 0953eh                          ; eb 00
+    jmp short 0981eh                          ; eb 00
     clc                                       ; f8
     retn                                      ; c3
     mov AH, strict byte 009h                  ; b4 09
     stc                                       ; f9
     retn                                      ; c3
-apm_pm16_entry:                              ; 0xf9544 LB 0x11
+apm_pm16_entry:                              ; 0xf9824 LB 0x11
     mov AH, strict byte 002h                  ; b4 02
     push DS                                   ; 1e
     push bp                                   ; 55
@@ -14036,13 +14334,13 @@ apm_pm16_entry:                              ; 0xf9544 LB 0x11
     pop bp                                    ; 5d
     add bp, strict byte 00008h                ; 83 c5 08
     mov ds, bp                                ; 8e dd
-    call 0950ah                               ; e8 b8 ff
+    call 097eah                               ; e8 b8 ff
     pop bp                                    ; 5d
     pop DS                                    ; 1f
     retf                                      ; cb
 
-  ; Padding 0x44ab bytes at 0xf9555
-  times 17579 db 0
+  ; Padding 0x41cb bytes at 0xf9835
+  times 16843 db 0
 
 section BIOS32 progbits vstart=0xda00 align=1 ; size=0x3cb class=CODE group=AUTO
 bios32_service:                              ; 0xfda00 LB 0x26
@@ -14089,7 +14387,7 @@ apm_pm32_entry:                              ; 0xfda40 LB 0x21
     pop bp                                    ; 5d
     add bp, strict byte 00008h                ; 83 c5 08
     push ebp                                  ; 66 55
-    mov bp, 09546h                            ; bd 46 95
+    mov bp, 09826h                            ; bd 26 98
     add byte [bx+si], al                      ; 00 00
     push ebp                                  ; 66 55
     mov AH, strict byte 003h                  ; b4 03
@@ -14285,12 +14583,12 @@ _pci32_function:                             ; 0xfdb7a LB 0x251
     add byte [bx+si], al                      ; 00 00
     xor bx, bx                                ; 31 db
     db  00fh, 0b7h, 055h, 00ch
-    ; movzx dx, word [di+00ch]                  ; 0f b7 55 0c
+    ; movzx dx, [di+00ch]                       ; 0f b7 55 0c
     db  00fh, 0b7h, 045h, 020h
-    ; movzx ax, word [di+020h]                  ; 0f b7 45 20
+    ; movzx ax, [di+020h]                       ; 0f b7 45 20
     sal ax, 010h                              ; c1 e0 10
     db  00fh, 0b7h, 04dh, 01ch
-    ; movzx cx, word [di+01ch]                  ; 0f b7 4d 1c
+    ; movzx cx, [di+01ch]                       ; 0f b7 4d 1c
     or ax, cx                                 ; 09 c8
     call 0da81h                               ; e8 66 fe
     db  0ffh
@@ -14306,7 +14604,7 @@ _pci32_function:                             ; 0xfdb7a LB 0x251
     jmp near 0ddc1h                           ; e9 8a 01
     add byte [bx+si], al                      ; 00 00
     db  00fh, 0b7h, 055h, 00ch
-    ; movzx dx, word [di+00ch]                  ; 0f b7 55 0c
+    ; movzx dx, [di+00ch]                       ; 0f b7 55 0c
     mov ax, word [di+020h]                    ; 8b 45 20
     mov bx, strict word 00001h                ; bb 01 00
     add byte [bx+si], al                      ; 00 00
@@ -14330,9 +14628,9 @@ _pci32_function:                             ; 0xfdb7a LB 0x251
     jmp near 0ddb9h                           ; e9 40 01
     add byte [bx+si], al                      ; 00 00
     db  00fh, 0b7h, 055h, 008h
-    ; movzx dx, word [di+008h]                  ; 0f b7 55 08
+    ; movzx dx, [di+008h]                       ; 0f b7 55 08
     db  00fh, 0b7h, 045h, 018h
-    ; movzx ax, word [di+018h]                  ; 0f b7 45 18
+    ; movzx ax, [di+018h]                       ; 0f b7 45 18
     call 0da5fh                               ; e8 d9 fd
     db  0ffh
     dec word [bp+di+02445h]                   ; ff 8b 45 24
@@ -14399,7 +14697,7 @@ _pci32_function:                             ; 0xfdb7a LB 0x251
     jmp near 0ddc1h                           ; e9 97 00
     add byte [bx+si], al                      ; 00 00
     db  00fh, 0b7h, 045h, 020h
-    ; movzx ax, word [di+020h]                  ; 0f b7 45 20
+    ; movzx ax, [di+020h]                       ; 0f b7 45 20
     mov dx, word [di+008h]                    ; 8b 55 08
     xor dh, dh                                ; 30 f6
     and dl, 002h                              ; 80 e2 02
@@ -14416,7 +14714,7 @@ _pci32_function:                             ; 0xfdb7a LB 0x251
     out DX, ax                                ; ef
     jmp short 0ddc3h                          ; eb 70
     db  00fh, 0b7h, 045h, 008h
-    ; movzx ax, word [di+008h]                  ; 0f b7 45 08
+    ; movzx ax, [di+008h]                       ; 0f b7 45 08
     mov es, [di+028h]                         ; 8e 45 28
     mov [di-010h], es                         ; 8c 45 f0
     mov bx, ax                                ; 89 c3
@@ -14480,38 +14778,51 @@ section BIOSSEG progbits vstart=0xe000 align=1 ; size=0x2000 class=CODE group=AU
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
     db  000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 058h, 04dh
-eoi_jmp_post:                                ; 0xfe030 LB 0xb
-    call 0e03bh                               ; e8 08 00
-    db  033h, 0c0h
-    ; xor ax, ax                                ; 33 c0
-    mov ds, ax                                ; 8e d8
-    jmp far [00467h]                          ; ff 2e 67 04
-eoi_both_pics:                               ; 0xfe03b LB 0x4
+eoi_both_pics:                               ; 0xfe030 LB 0x4
     mov AL, strict byte 020h                  ; b0 20
     out strict byte 0a0h, AL                  ; e6 a0
-eoi_master_pic:                              ; 0xfe03f LB 0x5
+eoi_master_pic:                              ; 0xfe034 LB 0x5
     mov AL, strict byte 020h                  ; b0 20
     out strict byte 020h, AL                  ; e6 20
     retn                                      ; c3
-set_int_vects:                               ; 0xfe044 LB 0x17
+set_int_vects:                               ; 0xfe039 LB 0xb
     mov word [bx], ax                         ; 89 07
     mov word [bx+002h], dx                    ; 89 57 02
     add bx, strict byte 00004h                ; 83 c3 04
-    loop 0e044h                               ; e2 f6
+    loop 0e039h                               ; e2 f6
     retn                                      ; c3
+eoi_jmp_post:                                ; 0xfe044 LB 0x17
+    call 0e030h                               ; e8 e9 ff
+    db  033h, 0c0h
+    ; xor ax, ax                                ; 33 c0
+    mov ds, ax                                ; 8e d8
+    jmp far [00467h]                          ; ff 2e 67 04
     times 0xa db 0
     db  'XM'
-post:                                        ; 0xfe05b LB 0x4c
+post:                                        ; 0xfe05b LB 0x65
     cli                                       ; fa
     smsw ax                                   ; 0f 01 e0
     test ax, strict word 00001h               ; a9 01 00
-    je short 0e068h                           ; 74 04
+    je short 0e06ah                           ; 74 06
+    mov AL, strict byte 001h                  ; b0 01
     out strict byte 092h, AL                  ; e6 92
-    jmp short 0e066h                          ; eb fe
+    jmp short 0e068h                          ; eb fe
     mov AL, strict byte 00fh                  ; b0 0f
     out strict byte 070h, AL                  ; e6 70
     in AL, strict byte 071h                   ; e4 71
     xchg ah, al                               ; 86 c4
+    in AL, strict byte 064h                   ; e4 64
+    test AL, strict byte 004h                 ; a8 04
+    je short 0e089h                           ; 74 11
+    db  08ah, 0c4h
+    ; mov al, ah                                ; 8a c4
+    db  00ah, 0c0h
+    ; or al, al                                 ; 0a c0
+    jne short 0e089h                          ; 75 0b
+    push strict byte 00040h                   ; 6a 40
+    pop DS                                    ; 1f
+    cmp word [word 00072h], 01234h            ; 81 3e 72 00 34 12
+    jne short 0e064h                          ; 75 db
     mov AL, strict byte 00fh                  ; b0 0f
     out strict byte 070h, AL                  ; e6 70
     mov AL, strict byte 000h                  ; b0 00
@@ -14519,9 +14830,9 @@ post:                                        ; 0xfe05b LB 0x4c
     db  08ah, 0c4h
     ; mov al, ah                                ; 8a c4
     cmp AL, strict byte 009h                  ; 3c 09
-    je short 0e090h                           ; 74 12
+    je short 0e0a9h                           ; 74 12
     cmp AL, strict byte 00ah                  ; 3c 0a
-    je short 0e090h                           ; 74 0e
+    je short 0e0a9h                           ; 74 0e
     db  032h, 0c0h
     ; xor al, al                                ; 32 c0
     out strict byte 00dh, AL                  ; e6 0d
@@ -14533,16 +14844,16 @@ post:                                        ; 0xfe05b LB 0x4c
     db  08ah, 0c4h
     ; mov al, ah                                ; 8a c4
     cmp AL, strict byte 000h                  ; 3c 00
-    je short 0e0a7h                           ; 74 11
+    je short 0e0c0h                           ; 74 11
     cmp AL, strict byte 00dh                  ; 3c 0d
-    jnc short 0e0a7h                          ; 73 0d
+    jnc short 0e0c0h                          ; 73 0d
     cmp AL, strict byte 009h                  ; 3c 09
-    jne short 0e0a1h                          ; 75 03
-    jmp near 0e342h                           ; e9 a1 02
+    jne short 0e0bah                          ; 75 03
+    jmp near 0e366h                           ; e9 ac 02
     cmp AL, strict byte 005h                  ; 3c 05
-    je short 0e030h                           ; 74 8b
-    jmp short 0e0a7h                          ; eb 00
-normal_post:                                 ; 0xfe0a7 LB 0x21c
+    je short 0e044h                           ; 74 86
+    jmp short 0e0c0h                          ; eb 00
+normal_post:                                 ; 0xfe0c0 LB 0x203
     mov ax, 07800h                            ; b8 00 78
     db  08bh, 0e0h
     ; mov sp, ax                                ; 8b e0
@@ -14564,13 +14875,13 @@ normal_post:                                 ; 0xfe0a7 LB 0x21c
     ; xor bx, bx                                ; 33 db
     add bx, 01000h                            ; 81 c3 00 10
     cmp bx, 09000h                            ; 81 fb 00 90
-    jnc short 0e0dah                          ; 73 0b
+    jnc short 0e0f3h                          ; 73 0b
     mov es, bx                                ; 8e c3
     db  033h, 0ffh
     ; xor di, di                                ; 33 ff
     mov cx, 08000h                            ; b9 00 80
     rep stosw                                 ; f3 ab
-    jmp short 0e0c5h                          ; eb eb
+    jmp short 0e0deh                          ; eb eb
     mov es, bx                                ; 8e c3
     db  033h, 0ffh
     ; xor di, di                                ; 33 ff
@@ -14581,18 +14892,18 @@ normal_post:                                 ; 0xfe0a7 LB 0x21c
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 01727h                               ; e8 3c 36
-    call 0e8e0h                               ; e8 f2 07
+    call 01777h                               ; e8 73 36
+    call 0e8e0h                               ; e8 d9 07
     db  033h, 0dbh
     ; xor bx, bx                                ; 33 db
     mov ds, bx                                ; 8e db
     mov cx, strict word 00060h                ; b9 60 00
     mov ax, 0ff53h                            ; b8 53 ff
     mov dx, 0f000h                            ; ba 00 f0
-    call 0e044h                               ; e8 46 ff
+    call 0e039h                               ; e8 22 ff
     mov bx, 001a0h                            ; bb a0 01
     mov cx, strict word 00010h                ; b9 10 00
-    call 0e044h                               ; e8 3d ff
+    call 0e039h                               ; e8 19 ff
     mov ax, 0027fh                            ; b8 7f 02
     mov word [00413h], ax                     ; a3 13 04
     mov ax, 0e9dch                            ; b8 dc e9
@@ -14627,7 +14938,13 @@ normal_post:                                 ; 0xfe0a7 LB 0x21c
     mov word [00070h], ax                     ; a3 70 00
     mov ax, 0f000h                            ; b8 00 f0
     mov word [00072h], ax                     ; a3 72 00
-    call 0e7c0h                               ; e8 50 06
+    call 0e778h                               ; e8 ef 05
+    call 0f13ch                               ; e8 b0 0f
+    call 0f1c1h                               ; e8 32 10
+    mov ax, 0fe6eh                            ; b8 6e fe
+    mov word [00068h], ax                     ; a3 68 00
+    mov ax, 0f000h                            ; b8 00 f0
+    mov word [0006ah], ax                     ; a3 6a 00
     mov ax, 0fea5h                            ; b8 a5 fe
     mov word [00020h], ax                     ; a3 20 00
     mov ax, 0f000h                            ; b8 00 f0
@@ -14637,6 +14954,10 @@ normal_post:                                 ; 0xfe0a7 LB 0x21c
     mov AL, strict byte 000h                  ; b0 00
     out strict byte 040h, AL                  ; e6 40
     out strict byte 040h, AL                  ; e6 40
+    mov ax, 0f065h                            ; b8 65 f0
+    mov word [00040h], ax                     ; a3 40 00
+    mov ax, 0f000h                            ; b8 00 f0
+    mov word [00042h], ax                     ; a3 42 00
     mov ax, 0e987h                            ; b8 87 e9
     mov word [00024h], ax                     ; a3 24 00
     mov ax, 0f000h                            ; b8 00 f0
@@ -14661,16 +14982,19 @@ normal_post:                                 ; 0xfe0a7 LB 0x21c
     mov word [00480h], bx                     ; 89 1e 80 04
     mov bx, strict word 0003eh                ; bb 3e 00
     mov word [00482h], bx                     ; 89 1e 82 04
+    mov AL, strict byte 014h                  ; b0 14
+    out strict byte 070h, AL                  ; e6 70
+    in AL, strict byte 071h                   ; e4 71
+    mov byte [00410h], AL                     ; a2 10 04
     push DS                                   ; 1e
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 04959h                               ; e8 86 67
+    mov ax, 0c000h                            ; b8 00 c0
+    mov dx, 0c800h                            ; ba 00 c8
+    call 01600h                               ; e8 e7 33
+    call 04b77h                               ; e8 5b 69
     pop DS                                    ; 1f
-    mov AL, strict byte 014h                  ; b0 14
-    out strict byte 070h, AL                  ; e6 70
-    in AL, strict byte 071h                   ; e4 71
-    mov byte [00410h], AL                     ; a2 10 04
     mov ax, 0ff53h                            ; b8 53 ff
     mov word [0003ch], ax                     ; a3 3c 00
     mov ax, 0f000h                            ; b8 00 f0
@@ -14682,9 +15006,9 @@ normal_post:                                 ; 0xfe0a7 LB 0x21c
     ; xor bx, bx                                ; 33 db
     mov CL, strict byte 014h                  ; b1 14
     mov dx, 00378h                            ; ba 78 03
-    call 0ecedh                               ; e8 f6 0a
+    call 0ecedh                               ; e8 b6 0a
     mov dx, 00278h                            ; ba 78 02
-    call 0ecedh                               ; e8 f0 0a
+    call 0ecedh                               ; e8 b0 0a
     sal bx, 00eh                              ; c1 e3 0e
     mov ax, word [00410h]                     ; a1 10 04
     and ax, 03fffh                            ; 25 ff 3f
@@ -14707,23 +15031,19 @@ normal_post:                                 ; 0xfe0a7 LB 0x21c
     ; xor bx, bx                                ; 33 db
     mov CL, strict byte 00ah                  ; b1 0a
     mov dx, 003f8h                            ; ba f8 03
-    call 0ed0bh                               ; e8 d2 0a
+    call 0ed0bh                               ; e8 92 0a
     mov dx, 002f8h                            ; ba f8 02
-    call 0ed0bh                               ; e8 cc 0a
+    call 0ed0bh                               ; e8 8c 0a
     mov dx, 003e8h                            ; ba e8 03
-    call 0ed0bh                               ; e8 c6 0a
+    call 0ed0bh                               ; e8 86 0a
     mov dx, 002e8h                            ; ba e8 02
-    call 0ed0bh                               ; e8 c0 0a
+    call 0ed0bh                               ; e8 80 0a
     sal bx, 009h                              ; c1 e3 09
     mov ax, word [00410h]                     ; a1 10 04
     and ax, 0f1ffh                            ; 25 ff f1
     db  00bh, 0c3h
     ; or ax, bx                                 ; 0b c3
     mov word [00410h], ax                     ; a3 10 04
-    mov ax, 0fe6eh                            ; b8 6e fe
-    mov word [00068h], ax                     ; a3 68 00
-    mov ax, 0f000h                            ; b8 00 f0
-    mov word [0006ah], ax                     ; a3 6a 00
     mov ax, 0ff53h                            ; b8 53 ff
     mov word [00128h], ax                     ; a3 28 01
     mov ax, 0f000h                            ; b8 00 f0
@@ -14732,35 +15052,19 @@ normal_post:                                 ; 0xfe0a7 LB 0x21c
     mov word [001c0h], ax                     ; a3 c0 01
     mov ax, 0f000h                            ; b8 00 f0
     mov word [001c2h], ax                     ; a3 c2 01
-    call 0edbfh                               ; e8 3f 0b
-    mov ax, 0f8a9h                            ; b8 a9 f8
-    mov word [001d0h], ax                     ; a3 d0 01
-    mov ax, 0f000h                            ; b8 00 f0
-    mov word [001d2h], ax                     ; a3 d2 01
-    mov ax, 0e2cah                            ; b8 ca e2
-    mov word [001d4h], ax                     ; a3 d4 01
-    mov ax, 0f000h                            ; b8 00 f0
-    mov word [001d6h], ax                     ; a3 d6 01
-    mov ax, 0f065h                            ; b8 65 f0
-    mov word [00040h], ax                     ; a3 40 00
-    mov ax, 0f000h                            ; b8 00 f0
-    mov word [00042h], ax                     ; a3 42 00
-    call 0e79bh                               ; e8 f4 04
-    call 0f13ch                               ; e8 92 0e
-    call 0f1c1h                               ; e8 14 0f
-    call 0e758h                               ; e8 a8 04
-    jmp short 0e31bh                          ; eb 69
-    times 0xf db 0
+    call 0edbfh                               ; e8 0b 0b
+    jmp short 0e31bh                          ; eb 65
+    times 0xb db 0
     db  'XM'
 nmi:                                         ; 0xfe2c3 LB 0x7
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 01703h                               ; e8 3a 34
+    call 01753h                               ; e8 8a 34
     iret                                      ; cf
 int75_handler:                               ; 0xfe2ca LB 0x8
     out strict byte 0f0h, AL                  ; e6 f0
-    call 0e03bh                               ; e8 6c fd
+    call 0e030h                               ; e8 61 fd
     int 002h                                  ; cd 02
     iret                                      ; cf
 hard_drive_post:                             ; 0xfe2d2 LB 0x12c
@@ -14791,25 +15095,37 @@ hard_drive_post:                             ; 0xfe2d2 LB 0x12c
     mov ax, 09fc0h                            ; b8 c0 9f
     mov word [0011ah], ax                     ; a3 1a 01
     retn                                      ; c3
+    mov ax, 0f8a9h                            ; b8 a9 f8
+    mov word [001d0h], ax                     ; a3 d0 01
+    mov ax, 0f000h                            ; b8 00 f0
+    mov word [001d2h], ax                     ; a3 d2 01
+    mov ax, 0e2cah                            ; b8 ca e2
+    mov word [001d4h], ax                     ; a3 d4 01
+    mov ax, 0f000h                            ; b8 00 f0
+    mov word [001d6h], ax                     ; a3 d6 01
+    call 0e753h                               ; e8 1d 04
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 01b5dh                               ; e8 3c 38
-    call 01f57h                               ; e8 33 3c
-    call 08dc3h                               ; e8 9c aa
-    call 07e1ah                               ; e8 f0 9a
-    call 0ed2fh                               ; e8 02 0a
-    call 0e2d2h                               ; e8 a2 ff
+    call 01badh                               ; e8 71 38
+    call 01fa7h                               ; e8 68 3c
+    call 09097h                               ; e8 55 ad
+    call 080d3h                               ; e8 8e 9d
+    call 0ed2fh                               ; e8 e7 09
+    call 0e2d2h                               ; e8 87 ff
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 01747h                               ; e8 11 34
-    call 0363dh                               ; e8 04 53
+    call 01797h                               ; e8 46 34
+    mov ax, 0c800h                            ; b8 00 c8
+    mov dx, 0f000h                            ; ba 00 f0
+    call 01600h                               ; e8 a6 32
+    call 0385bh                               ; e8 fe 54
     sti                                       ; fb
     int 019h                                  ; cd 19
     sti                                       ; fb
     hlt                                       ; f4
-    jmp short 0e33dh                          ; eb fd
+    jmp short 0e361h                          ; eb fd
     cli                                       ; fa
     hlt                                       ; f4
     mov ax, strict word 00040h                ; b8 40 00
@@ -14831,7 +15147,7 @@ hard_drive_post:                             ; 0xfe2d2 LB 0x12c
     popaw                                     ; 61
     sti                                       ; fb
     retf 00002h                               ; ca 02 00
-    times 0x91 db 0
+    times 0x6d db 0
     db  'XM'
 int13_handler:                               ; 0xfe3fe LB 0x3
     jmp near 0ec5bh                           ; e9 5a 08
@@ -14902,7 +15218,7 @@ int19_handler:                               ; 0xfe6f2 LB 0x61
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 05cd9h                               ; e8 97 75
+    call 05f61h                               ; e8 1f 78
     popaw                                     ; 61
     pop ES                                    ; 07
     pop DS                                    ; 1f
@@ -14913,53 +15229,12 @@ int19_handler:                               ; 0xfe6f2 LB 0x61
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 01698h                               ; e8 49 2f
+    call 016e8h                               ; e8 99 2f
     popaw                                     ; 61
     pop ES                                    ; 07
     pop DS                                    ; 1f
     iret                                      ; cf
-rom_checksum:                                ; 0xfe753 LB 0x5
-    push ax                                   ; 50
-    db  032h, 0c0h
-    ; xor al, al                                ; 32 c0
-    pop ax                                    ; 58
-    retn                                      ; c3
-rom_scan:                                    ; 0xfe758 LB 0x43
-    mov cx, 0c000h                            ; b9 00 c0
-    mov ds, cx                                ; 8e d9
-    mov ax, strict word 00004h                ; b8 04 00
-    cmp word [word 00000h], 0aa55h            ; 81 3e 00 00 55 aa
-    jne short 0e78bh                          ; 75 23
-    call 0e753h                               ; e8 e8 ff
-    jne short 0e78bh                          ; 75 1e
-    mov AL, byte [00002h]                     ; a0 02 00
-    test AL, strict byte 003h                 ; a8 03
-    je short 0e778h                           ; 74 04
-    and AL, strict byte 0fch                  ; 24 fc
-    add AL, strict byte 004h                  ; 04 04
-    db  033h, 0dbh
-    ; xor bx, bx                                ; 33 db
-    mov ds, bx                                ; 8e db
-    push ax                                   ; 50
-    push cx                                   ; 51
-    push strict byte 00003h                   ; 6a 03
-    db  08bh, 0ech
-    ; mov bp, sp                                ; 8b ec
-    call far [byte bp+000h]                   ; ff 5e 00
-    cli                                       ; fa
-    add sp, strict byte 00002h                ; 83 c4 02
-    pop cx                                    ; 59
-    pop ax                                    ; 58
-    sal ax, 005h                              ; c1 e0 05
-    db  003h, 0c8h
-    ; add cx, ax                                ; 03 c8
-    cmp cx, 0e800h                            ; 81 f9 00 e8
-    jbe short 0e75bh                          ; 76 c5
-    db  033h, 0c0h
-    ; xor ax, ax                                ; 33 c0
-    mov ds, ax                                ; 8e d8
-    retn                                      ; c3
-init_pic:                                    ; 0xfe79b LB 0x25
+init_pic:                                    ; 0xfe753 LB 0x25
     mov AL, strict byte 011h                  ; b0 11
     out strict byte 020h, AL                  ; e6 20
     out strict byte 0a0h, AL                  ; e6 a0
@@ -14979,7 +15254,7 @@ init_pic:                                    ; 0xfe79b LB 0x25
     mov AL, strict byte 08fh                  ; b0 8f
     out strict byte 0a1h, AL                  ; e6 a1
     retn                                      ; c3
-ebda_post:                                   ; 0xfe7c0 LB 0xa4
+ebda_post:                                   ; 0xfe778 LB 0xec
     mov ax, 0e746h                            ; b8 46 e7
     mov word [00034h], ax                     ; a3 34 00
     mov ax, 0f000h                            ; b8 00 f0
@@ -15004,7 +15279,7 @@ ebda_post:                                   ; 0xfe7c0 LB 0xa4
     mov ds, ax                                ; 8e d8
     mov word [0040eh], 09fc0h                 ; c7 06 0e 04 c0 9f
     retn                                      ; c3
-    times 0x27 db 0
+    times 0x6f db 0
     pop ax                                    ; 58
     dec bp                                    ; 4d
     sti                                       ; fb
@@ -15018,7 +15293,7 @@ ebda_post:                                   ; 0xfe7c0 LB 0xa4
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 05047h                               ; e8 05 68
+    call 052cfh                               ; e8 8d 6a
     popaw                                     ; 61
     pop DS                                    ; 1f
     pop ES                                    ; 07
@@ -15035,7 +15310,7 @@ ebda_post:                                   ; 0xfe7c0 LB 0xa4
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 05047h                               ; e8 e7 67
+    call 052cfh                               ; e8 6f 6a
     popaw                                     ; 61
     pop DS                                    ; 1f
     pop ES                                    ; 07
@@ -15076,6 +15351,9 @@ pmode_setup:                                 ; 0xfe8e0 LB 0x37b
     mov eax, cr0                              ; 0f 20 c0
     and eax, strict dword 09fffffffh          ; 66 25 ff ff ff 9f
     mov cr0, eax                              ; 0f 22 c0
+    mov esi, strict dword 0fee000f0h          ; 66 be f0 00 e0 fe
+    mov eax, strict dword 00000010fh          ; 66 b8 0f 01 00 00
+    mov dword [esi], eax                      ; 67 66 89 06
     mov esi, strict dword 0fee00350h          ; 66 be 50 03 e0 fe
     mov eax, dword [esi]                      ; 67 66 8b 06
     and eax, strict dword 0fffe00ffh          ; 66 25 ff 00 fe ff
@@ -15086,12 +15364,12 @@ pmode_setup:                                 ; 0xfe8e0 LB 0x37b
     and eax, strict dword 0fffe00ffh          ; 66 25 ff 00 fe ff
     or ah, 004h                               ; 80 cc 04
     mov dword [esi], eax                      ; 67 66 89 06
-    call 0e87fh                               ; e8 59 ff
+    call 0e87fh                               ; e8 49 ff
     popfw                                     ; 9d
     pop esi                                   ; 66 5e
     pop eax                                   ; 66 58
     retn                                      ; c3
-    times 0x59 db 0
+    times 0x49 db 0
     pop ax                                    ; 58
     dec bp                                    ; 4d
     cli                                       ; fa
@@ -15134,12 +15412,12 @@ pmode_setup:                                 ; 0xfe8e0 LB 0x37b
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 04c56h                               ; e8 87 62
+    call 04e74h                               ; e8 a5 64
     pop ES                                    ; 07
     popaw                                     ; 61
     pop DS                                    ; 1f
     cli                                       ; fa
-    call 0e03fh                               ; e8 69 f6
+    call 0e034h                               ; e8 5e f6
     mov AL, strict byte 0aeh                  ; b0 ae
     out strict byte 064h, AL                  ; e6 64
     pop ax                                    ; 58
@@ -15150,7 +15428,7 @@ pmode_setup:                                 ; 0xfe8e0 LB 0x37b
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 06731h                               ; e8 4c 7d
+    call 069b9h                               ; e8 d4 7f
     pop DS                                    ; 1f
     pop ES                                    ; 07
     popaw                                     ; 61
@@ -15171,16 +15449,16 @@ int13_relocated:                             ; 0xfec5b LB 0x55
     pop DS                                    ; 1f
     cld                                       ; fc
     push 0ece9h                               ; 68 e9 ec
-    jmp near 03681h                           ; e9 10 4a
+    jmp near 0389fh                           ; e9 2e 4c
     push ES                                   ; 06
     push ax                                   ; 50
     push bx                                   ; 53
     push cx                                   ; 51
     push dx                                   ; 52
-    call 03655h                               ; e8 dc 49
+    call 03873h                               ; e8 fa 4b
     cmp AL, strict byte 000h                  ; 3c 00
     je short 0ecabh                           ; 74 2e
-    call 0366bh                               ; e8 eb 49
+    call 03889h                               ; e8 09 4c
     pop dx                                    ; 5a
     push dx                                   ; 52
     db  03ah, 0c2h
@@ -15198,7 +15476,7 @@ int13_relocated:                             ; 0xfec5b LB 0x55
     pop DS                                    ; 1f
     cld                                       ; fc
     push 0ece9h                               ; 68 e9 ec
-    jmp near 03c55h                           ; e9 be 4f
+    jmp near 03e73h                           ; e9 dc 51
     and dl, 0e0h                              ; 80 e2 e0
     db  03ah, 0c2h
     ; cmp al, dl                                ; 3a c2
@@ -15238,22 +15516,22 @@ int13_legacy:                                ; 0xfecb4 LB 0x14
     test dl, 080h                             ; f6 c2 80
     jne short 0ecc8h                          ; 75 06
     push 0ece9h                               ; 68 e9 ec
-    jmp near 02edeh                           ; e9 16 42
+    jmp near 02f2eh                           ; e9 66 42
 int13_notfloppy:                             ; 0xfecc8 LB 0x14
     cmp dl, 0e0h                              ; 80 fa e0
     jc short 0ecdch                           ; 72 0f
     shr ebx, 010h                             ; 66 c1 eb 10
     push bx                                   ; 53
-    call 04089h                               ; e8 b4 53
+    call 042a7h                               ; e8 d2 55
     pop bx                                    ; 5b
     sal ebx, 010h                             ; 66 c1 e3 10
     jmp short 0ece9h                          ; eb 0d
 int13_disk:                                  ; 0xfecdc LB 0xd
     cmp ah, 040h                              ; 80 fc 40
     jnbe short 0ece6h                         ; 77 05
-    call 053cch                               ; e8 e8 66
+    call 05654h                               ; e8 70 69
     jmp short 0ece9h                          ; eb 03
-    call 0580dh                               ; e8 24 6b
+    call 05a95h                               ; e8 ac 6d
 int13_out:                                   ; 0xfece9 LB 0x4
     pop DS                                    ; 1f
     pop ES                                    ; 07
@@ -15441,7 +15719,7 @@ int0e_handler:                               ; 0xfef57 LB 0x70
     db  033h, 0c0h
     ; xor ax, ax                                ; 33 c0
     mov ds, ax                                ; 8e d8
-    call 0e03fh                               ; e8 b6 f0
+    call 0e034h                               ; e8 ab f0
     or byte [0043eh], 080h                    ; 80 0e 3e 04 80
     pop DS                                    ; 1f
     pop dx                                    ; 5a
@@ -15466,7 +15744,7 @@ int17_handler:                               ; 0xfefd4 LB 0xd
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 0708bh                               ; e8 ae 80
+    call 07313h                               ; e8 36 83
     popaw                                     ; 61
     pop ES                                    ; 07
     pop DS                                    ; 1f
@@ -15491,7 +15769,7 @@ int10_handler:                               ; 0xff065 LB 0x47
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 01715h                               ; e8 6b 26
+    call 01765h                               ; e8 bb 26
     hlt                                       ; f4
     iret                                      ; cf
 int19_relocated:                             ; 0xff0ac LB 0x90
@@ -15514,28 +15792,28 @@ int19_relocated:                             ; 0xff0ac LB 0x90
     ; mov bp, sp                                ; 8b ec
     mov ax, strict word 00001h                ; b8 01 00
     push ax                                   ; 50
-    call 046f0h                               ; e8 20 56
+    call 0490eh                               ; e8 3e 58
     inc sp                                    ; 44
     inc sp                                    ; 44
     test ax, ax                               ; 85 c0
     jne short 0f0feh                          ; 75 28
     mov ax, strict word 00002h                ; b8 02 00
     push ax                                   ; 50
-    call 046f0h                               ; e8 13 56
+    call 0490eh                               ; e8 31 58
     inc sp                                    ; 44
     inc sp                                    ; 44
     test ax, ax                               ; 85 c0
     jne short 0f0feh                          ; 75 1b
     mov ax, strict word 00003h                ; b8 03 00
     push strict byte 00003h                   ; 6a 03
-    call 046f0h                               ; e8 05 56
+    call 0490eh                               ; e8 23 58
     inc sp                                    ; 44
     inc sp                                    ; 44
     test ax, ax                               ; 85 c0
     jne short 0f0feh                          ; 75 0d
     mov ax, strict word 00004h                ; b8 04 00
     push ax                                   ; 50
-    call 046f0h                               ; e8 f8 55
+    call 0490eh                               ; e8 16 58
     inc sp                                    ; 44
     inc sp                                    ; 44
     test ax, ax                               ; 85 c0
@@ -15826,20 +16104,20 @@ int15_handler:                               ; 0xff859 LB 0x2e
     je short 0f882h                           ; 74 0e
     cmp ah, 0c2h                              ; 80 fc c2
     je short 0f887h                           ; 74 0e
-    call 05ee6h                               ; e8 6a 66
+    call 0616eh                               ; e8 f2 68
     popaw                                     ; 61
     pop ES                                    ; 07
     pop DS                                    ; 1f
     popfw                                     ; 9d
     jmp short 0f895h                          ; eb 13
-    call 08efah                               ; e8 75 96
+    call 091ceh                               ; e8 49 99
     jmp short 0f87ch                          ; eb f5
 int15_handler_mouse:                         ; 0xff887 LB 0x5
-    call 06d00h                               ; e8 76 74
+    call 06f88h                               ; e8 fe 76
     jmp short 0f87ch                          ; eb f0
 int15_handler32:                             ; 0xff88c LB 0x9
     pushad                                    ; 66 60
-    call 063b3h                               ; e8 22 6b
+    call 0663bh                               ; e8 aa 6d
     popad                                     ; 66 61
     jmp short 0f87dh                          ; eb e8
 iret_modify_cf:                              ; 0xff895 LB 0x14
@@ -15869,7 +16147,7 @@ int74_handler:                               ; 0xff8a9 LB 0x2e
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 06c36h                               ; e8 79 73
+    call 06ebeh                               ; e8 01 76
     pop cx                                    ; 59
     jcxz 0f8cch                               ; e3 0c
     push strict byte 00000h                   ; 6a 00
@@ -15878,7 +16156,7 @@ int74_handler:                               ; 0xff8a9 LB 0x2e
     pop DS                                    ; 1f
     call far [word 00022h]                    ; ff 1e 22 00
     cli                                       ; fa
-    call 0e03bh                               ; e8 6b e7
+    call 0e030h                               ; e8 60 e7
     add sp, strict byte 00008h                ; 83 c4 08
     pop DS                                    ; 1f
     pop ES                                    ; 07
@@ -15890,7 +16168,7 @@ int76_handler:                               ; 0xff8d7 LB 0x197
     mov ax, strict word 00040h                ; b8 40 00
     mov ds, ax                                ; 8e d8
     mov byte [0008eh], 0ffh                   ; c6 06 8e 00 ff
-    call 0e03bh                               ; e8 55 e7
+    call 0e030h                               ; e8 4a e7
     pop DS                                    ; 1f
     pop ax                                    ; 58
     iret                                      ; cf
@@ -15961,8 +16239,8 @@ font8x8:                                     ; 0xffa6e LB 0x421
     db  000h, 000h, 0fch, 098h, 030h, 064h, 0fch, 000h, 01ch, 030h, 030h, 0e0h, 030h, 030h, 01ch, 000h
     db  018h, 018h, 018h, 000h, 018h, 018h, 018h, 000h, 0e0h, 030h, 030h, 01ch, 030h, 030h, 0e0h, 000h
     db  076h, 0dch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 010h, 038h, 06ch, 0c6h, 0c6h, 0feh, 000h
-    db  080h, 0fch, 0b1h, 075h, 00fh, 006h, 01eh, 00eh, 01fh, 0fch, 066h, 060h, 0e8h, 08dh, 092h, 066h
-    db  061h, 01fh, 007h, 0cfh, 006h, 01eh, 060h, 00eh, 01fh, 0fch, 0e8h, 042h, 06bh, 061h, 01fh, 007h
+    db  080h, 0fch, 0b1h, 075h, 00fh, 006h, 01eh, 00eh, 01fh, 0fch, 066h, 060h, 0e8h, 061h, 095h, 066h
+    db  061h, 01fh, 007h, 0cfh, 006h, 01eh, 060h, 00eh, 01fh, 0fch, 0e8h, 0cah, 06dh, 061h, 01fh, 007h
     db  0cfh
 int70_handler:                               ; 0xffe8f LB 0x16
     push ES                                   ; 06
@@ -15971,7 +16249,7 @@ int70_handler:                               ; 0xffe8f LB 0x16
     push CS                                   ; 0e
     pop DS                                    ; 1f
     cld                                       ; fc
-    call 0690fh                               ; e8 77 6a
+    call 06b97h                               ; e8 ff 6c
     popaw                                     ; 61
     pop DS                                    ; 1f
     pop ES                                    ; 07
@@ -16009,7 +16287,7 @@ int08_handler:                               ; 0xffea5 LB 0xae
     out DX, AL                                ; ee
     int 01ch                                  ; cd 1c
     cli                                       ; fa
-    call 0e03fh                               ; e8 5c e1
+    call 0e034h                               ; e8 51 e1
     pop dx                                    ; 5a
     pop DS                                    ; 1f
     pop eax                                   ; 66 58
@@ -16022,7 +16300,7 @@ int08_handler:                               ; 0xffea5 LB 0xae
     dec bp                                    ; 4d
     dec di                                    ; 4f
     jc short 0ff64h                           ; 72 61
-    arpl word [si+065h], bp                   ; 63 6c 65
+    arpl [si+065h], bp                        ; 63 6c 65
     and byte [bp+04dh], dl                    ; 20 56 4d
     and byte [bp+069h], dl                    ; 20 56 69
     jc short 0ff82h                           ; 72 74
@@ -16070,4 +16348,4 @@ dummy_iret:                                  ; 0xfff53 LB 0x9d
     db  'XM'
 cpu_reset:                                   ; 0xffff0 LB 0x10
     jmp far 0f000h:0e05bh                     ; ea 5b e0 00 f0
-    db  030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fch, 0fbh
+    db  030h, 036h, 02fh, 032h, 033h, 02fh, 039h, 039h, 000h, 0fch, 03ch
diff --git a/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum b/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum
index 4a82038..f69e1e6 100644
--- a/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum
+++ b/src/VBox/Devices/PC/BIOS/VBoxBiosAlternative.md5sum
@@ -1 +1 @@
-fd88467e1679ab87b7c0a39079fab344 *VBoxPcBios.rom
+4fe9ce6091e1e013a0de0934c5459c0f *VBoxPcBios.rom
diff --git a/src/VBox/Devices/PC/BIOS/ahci.c b/src/VBox/Devices/PC/BIOS/ahci.c
index cb1ccf4..b0af223 100644
--- a/src/VBox/Devices/PC/BIOS/ahci.c
+++ b/src/VBox/Devices/PC/BIOS/ahci.c
@@ -45,6 +45,30 @@ typedef struct
 } ahci_prdt;
 
 /**
+ * SATA D2H FIS (Device to Host Frame Information Structure).
+ */
+typedef struct {
+    uint8_t     fis_type;   /* 34h */
+    uint8_t     intr;       /* Bit 6 indicates interrupt status. */
+    uint8_t     status;     /* Status register. */
+    uint8_t     error;      /* Error register. */
+    uint8_t     sec_no;     /* Sector number register. */
+    uint8_t     cyl_lo;     /* Cylinder low register. */
+    uint8_t     cyl_hi;     /* Cylinder high register. */
+    uint8_t     dev_hd;     /* Device/head register. */
+    uint8_t     sec_no_exp; /* Expanded sector number register. */
+    uint8_t     cyl_lo_exp; /* Expanded cylinder low register. */
+    uint8_t     cyl_hi_exp; /* Expanded cylinder high register. */
+    uint8_t     resvd0;
+    uint8_t     sec_cn;     /* Sector count register. */
+    uint8_t     sec_cn_exp; /* Expanded sector count register. */
+    uint16_t    resvd1;
+    uint32_t    resvd2;
+} fis_d2h;
+
+ct_assert(sizeof(fis_d2h) == 20);
+
+/**
  * AHCI controller data.
  */
 typedef struct
@@ -304,8 +328,7 @@ static void ahci_port_cmd_sync(ahci_t __far *ahci, uint8_t val)
         /* Disable command engine. */
         ahci_ctrl_clear_bits(io_base, AHCI_PORT_REG(port, AHCI_REG_PORT_CMD),
                              AHCI_REG_PORT_CMD_ST);
-
-        /** @todo: Examine status. */
+        /* Caller must examine status. */
     }
     else
         DBG_AHCI("AHCI: Invalid port given\n");
@@ -314,12 +337,13 @@ static void ahci_port_cmd_sync(ahci_t __far *ahci, uint8_t val)
 /**
  * Issue command to device.
  */
-static void ahci_cmd_data(bio_dsk_t __far *bios_dsk, uint8_t cmd)
+static uint16_t ahci_cmd_data(bio_dsk_t __far *bios_dsk, uint8_t cmd)
 {
     ahci_t __far    *ahci  = bios_dsk->ahci_seg :> 0;
     uint16_t        n_sect = bios_dsk->drqp.nsect;
     uint16_t        sectsz = bios_dsk->drqp.sect_sz;
     uint16_t        prdt_idx;
+    fis_d2h __far   *d2h;
 
     _fmemset(&ahci->abCmd[0], 0, sizeof(ahci->abCmd));
 
@@ -383,8 +407,13 @@ static void ahci_cmd_data(bio_dsk_t __far *bios_dsk, uint8_t cmd)
 
     ahci_port_cmd_sync(ahci, cmd);
 
+    /* Examine operation status. */
+    d2h = (void __far *)&ahci->abFisRecv[0x40];
+    DBG_AHCI("AHCI: ERR=%02x, STAT=%02x, SCNT=%02x\n", d2h->error, d2h->status, d2h->sec_cn);
+
     /* Unlock the buffer again. */
     vds_free_sg_list(&ahci->edds);
+    return d2h->error ? 4 : 0;
 }
 
 /**
@@ -489,6 +518,7 @@ static void ahci_port_init(ahci_t __far *ahci, uint8_t u8Port)
 int ahci_read_sectors(bio_dsk_t __far *bios_dsk)
 {
     uint16_t        device_id;
+    uint16_t        rc;
 
     device_id = VBOX_GET_AHCI_DEVICE(bios_dsk->drqp.dev_id);
     if (device_id > BX_MAX_AHCI_DEVICES)
@@ -500,14 +530,14 @@ int ahci_read_sectors(bio_dsk_t __far *bios_dsk)
 
     high_bits_save(bios_dsk->ahci_seg :> 0);
     ahci_port_init(bios_dsk->ahci_seg :> 0, bios_dsk->ahcidev[device_id].port);
-    ahci_cmd_data(bios_dsk, AHCI_CMD_READ_DMA_EXT);
+    rc = ahci_cmd_data(bios_dsk, AHCI_CMD_READ_DMA_EXT);
     DBG_AHCI("%s: transferred %lu bytes\n", __func__, ((ahci_t __far *)(bios_dsk->ahci_seg :> 0))->aCmdHdr[1]);
     bios_dsk->drqp.trsfsectors = bios_dsk->drqp.nsect;
 #ifdef DMA_WORKAROUND
     rep_movsw(bios_dsk->drqp.buffer, bios_dsk->drqp.buffer, bios_dsk->drqp.nsect * 512 / 2);
 #endif
     high_bits_restore(bios_dsk->ahci_seg :> 0);
-    return 0;   //@todo!!
+    return rc;
 }
 
 /**
@@ -520,6 +550,7 @@ int ahci_read_sectors(bio_dsk_t __far *bios_dsk)
 int ahci_write_sectors(bio_dsk_t __far *bios_dsk)
 {
     uint16_t        device_id;
+    uint16_t        rc;
 
     device_id = VBOX_GET_AHCI_DEVICE(bios_dsk->drqp.dev_id);
     if (device_id > BX_MAX_AHCI_DEVICES)
@@ -531,11 +562,11 @@ int ahci_write_sectors(bio_dsk_t __far *bios_dsk)
 
     high_bits_save(bios_dsk->ahci_seg :> 0);
     ahci_port_init(bios_dsk->ahci_seg :> 0, bios_dsk->ahcidev[device_id].port);
-    ahci_cmd_data(bios_dsk, AHCI_CMD_WRITE_DMA_EXT);
+    rc = ahci_cmd_data(bios_dsk, AHCI_CMD_WRITE_DMA_EXT);
     DBG_AHCI("%s: transferred %lu bytes\n", __func__, ((ahci_t __far *)(bios_dsk->ahci_seg :> 0))->aCmdHdr[1]);
     bios_dsk->drqp.trsfsectors = bios_dsk->drqp.nsect;
     high_bits_restore(bios_dsk->ahci_seg :> 0);
-    return 0;   //@todo!!
+    return rc;
 }
 
 //@todo: move
@@ -604,7 +635,6 @@ uint16_t ahci_cmd_packet(uint16_t device_id, uint8_t cmdlen, char __far *cmdbuf,
     high_bits_restore(ahci);
 
     return ahci->aCmdHdr[1] == 0 ? 4 : 0;
-//    return 0;   //@todo!!
 }
 
 void ahci_port_detect_device(ahci_t __far *ahci, uint8_t u8Port)
diff --git a/src/VBox/Devices/PC/BIOS/biosint.h b/src/VBox/Devices/PC/BIOS/biosint.h
index 383cc17..164cbdb 100644
--- a/src/VBox/Devices/PC/BIOS/biosint.h
+++ b/src/VBox/Devices/PC/BIOS/biosint.h
@@ -65,6 +65,7 @@
 #define DEBUG_INT74     0
 #define DEBUG_PCI       0
 #define DEBUG_APM       0
+#define DEBUG_POST      0
 
 #define FP_OFF(p)   ((unsigned)(p))
 #define FP_SEG(p)   ((unsigned)((unsigned long)(void __far*)(p) >> 16))
diff --git a/src/VBox/Devices/PC/BIOS/floppy.c b/src/VBox/Devices/PC/BIOS/floppy.c
index 4561928..7951c88 100644
--- a/src/VBox/Devices/PC/BIOS/floppy.c
+++ b/src/VBox/Devices/PC/BIOS/floppy.c
@@ -450,7 +450,7 @@ void BIOSCALL int13_diskette_function(disk_regs_t r)
 {
     uint8_t     drive, num_sectors, track, sector, head;
     uint16_t    base_address, base_count, base_es;
-    uint8_t     page, mode_register, val8;
+    uint8_t     page, mode_register, val8, media_state;
     uint8_t     return_status[7];
     uint8_t     drive_type, num_floppies, ah;
     uint16_t    last_addr;
@@ -582,7 +582,7 @@ void BIOSCALL int13_diskette_function(disk_regs_t r)
             outb(0x000c, 0x00); // clear flip-flop
             outb(0x0005, base_count);
             outb(0x0005, base_count>>8);
-            BX_DEBUG_INT13_FL("xfer buf %x bytes at %x:%x\n", 
+            BX_DEBUG_INT13_FL("xfer buf %x bytes at %x:%x\n",
                               base_count, page, base_address);
 
             // port 0b: DMA-1 Mode Register
@@ -721,7 +721,7 @@ void BIOSCALL int13_diskette_function(disk_regs_t r)
             outb(0x000c, 0x00); // clear flip-flop
             outb(0x0005, base_count);
             outb(0x0005, base_count>>8);
-            BX_DEBUG_INT13_FL("xfer buf %x bytes at %x:%x\n", 
+            BX_DEBUG_INT13_FL("xfer buf %x bytes at %x:%x\n",
                               base_count, page, base_address);
 
             // port 0b: DMA-1 Mode Register
@@ -905,6 +905,11 @@ void BIOSCALL int13_diskette_function(disk_regs_t r)
         // set up floppy controller for transfer
         floppy_prepare_controller(drive);
 
+        // send seek command to controller
+        outb(0x03f5, 0x0f); // 0f: seek
+        outb(0x03f5, (head << 2) | drive); // HD DR1 DR2
+        outb(0x03f5, track);
+
         // send format-track command (6 bytes) to controller
         outb(0x03f5, 0x4d); // 4d: format track
         outb(0x03f5, (head << 2) | drive); // HD DR1 DR2
@@ -1105,17 +1110,193 @@ void BIOSCALL int13_diskette_function(disk_regs_t r)
 
     case 0x17: // set diskette type for format(old)
         BX_DEBUG_INT13_FL("floppy f17\n");
-        /* not used for 1.44M floppies */
-        SET_AH(0x01); // not supported
-        set_diskette_ret_status(1); /* not supported */
-        SET_CF();
+        // NOTE: 1.44M diskette not supported by this function, use INT14h/18h instead.
+        // Drive number (0 or 1) values allowed
+        drive = GET_ELDL();
+
+        // Format type (AL)
+        // 00 - NOT USED    
+        // 01 - DISKETTE 360K IN 360K DRIVE    
+        // 02 - DISKETTE 360K IN 1.2M DRIVE
+        // 03 - DISKETTE 1.2M IN 1.2M DRIVE
+        // 04 - DISKETTE 720K IN 720K DRIVE
+        val8 = GET_AL();
+
+        BX_DEBUG_INT13_FL("floppy f17 - drive: %d, format type: %d\n", drive, val8);
+
+        if (drive > 1) {
+            SET_AH(0x01); // invalid drive
+            set_diskette_ret_status(0x01); // bad parameter
+            SET_CF();
+            return;
+        }
+    
+        // see if drive exists
+        if (floppy_drive_exists(drive) == 0) {
+            SET_AH(0x80); // not responding/time out
+            set_diskette_ret_status(0x80);
+            SET_CF();
+            return;
+        }
+
+        // Get current drive state. Set 'base_address' to media status offset address
+        base_address = (drive) ? 0x0091 : 0x0090;
+        media_state = read_byte(0x0040, base_address);
+
+        // Mask out (clear) bits 4-7 (4:media type established, 5:double stepping, 6-7:data rate)
+        media_state &= 0x0f;
+
+        switch (val8) {
+        case 1:
+            // 360K media in 360K drive
+            media_state |= 0x90; // 1001 0000 (media type established, 250 kbps)
+            break;
+        case 2:
+            // 360K media in 1.2M drive
+            media_state |= 0x70; // 0111 0000 (media type established, double stepping, 300 kbps)
+            break;
+        case 3:
+            // 1.2M media in 1.2M drive
+            media_state |= 0x10; // 0001 0000 (media type established, 500 kbps)
+            break;
+        case 4:
+            // 720K media in 720K drive
+            media_state |= 0x90; // 1001 0000 (media type established, 250 kbps)
+            break;
+        default:
+            // bad parameter
+            SET_AH(0x01); // invalid format mode parameter
+            set_diskette_ret_status(0x01);
+            SET_CF();
+            return;
+        }
+
+        // Update media status
+        write_byte(0x0040, base_address, media_state);
+        BX_DEBUG_INT13_FL("floppy f17 - media status set to: %02x\n", media_state);
+
+        // return success!
+        SET_AH(0);
+        set_diskette_ret_status(0);
+        CLEAR_CF();
         return;
 
     case 0x18: // set diskette type for format(new)
         BX_DEBUG_INT13_FL("floppy f18\n");
-        SET_AH(0x01); // do later
-        set_diskette_ret_status(1);
-        SET_CF();
+        // Set Media Type for Format. Verifies that the device supports a specific geometry.
+        // Unlike INT13h/17h, this service supports higher capacity drives (1.44M and 2.88M).
+        // Drive number (0 or 1) values allowed
+        drive = GET_ELDL();
+
+        val8 = GET_CL();
+        num_sectors = val8 & 0x3f;             // max sector number per cylinder
+        track = ((val8 >> 6) << 8) + GET_CH(); // max cylinder number (max cylinders - 1)
+
+        BX_DEBUG_INT13_FL("floppy f18 - drive: %d, max cylinder/track number: %d, sectors-per-tracks: %d\n",
+           drive, track, num_sectors);
+
+        if (drive > 1) {
+            SET_AH(0x01); // invalid drive
+            set_diskette_ret_status(0x01);
+            SET_CF();
+            return;
+        }
+
+        // see if drive exists
+        if (floppy_drive_exists(drive) == 0) {
+            SET_AH(0x80); // not responding/time out
+            set_diskette_ret_status(0x80);
+            SET_CF();
+            return;
+        }
+
+        // see if media in drive, and media type is known
+        if (floppy_media_known(drive) == 0) {
+            if (floppy_media_sense(drive) == 0) {
+                SET_AH(0x0C); // drive/media type unknown
+                set_diskette_ret_status(0x0C);
+                SET_CF(); 
+                return;
+            }
+        }
+
+        // @todo: break out drive type determination
+        drive_type = inb_cmos(0x10);
+        if (drive == 0)
+            drive_type >>= 4;
+        else
+            drive_type &= 0x0f;
+     
+        // Get current drive state. Set 'base_address' to media status offset address
+        base_address = (drive) ? 0x0091 : 0x0090;
+        media_state = read_byte(0x0040, base_address);
+
+        // Mask out (clear) bits 4-7 (4:media type established, 5:double stepping, 6-7:data rate)
+        media_state &= 0x0f;
+
+        switch (drive_type) {
+        case 1: // 360KB, 5.25"
+            if (track == 39 && num_sectors == 9)
+                media_state |= 0x90; // 1001 0000 (media type established, 250 kbps)
+
+            break;
+        case 2: // 1.2MB, 5.25"
+            if (track == 39 && num_sectors == 9) {          // 360K disk in 1.2M drive 
+                media_state |= 0x70; // 0111 0000 (media type established, double stepping, 300 kbps)
+            } else if (track == 79 && num_sectors == 15) {  // 1.2M disk in 1.2M drive
+                media_state |= 0x10; // 0001 0000 (media type established, 500 kbps)
+            }
+            break;
+        case 3: // 720KB, 3.5"
+            if (track == 79 && num_sectors == 9)
+                media_state |= 0x90; // 1001 0000 (media type established, 250 kbps)
+
+			break;
+        case 4: // 1.44MB, 3.5"
+            if (track == 79) {
+                if (num_sectors == 9) {          // 720K disk in 1.44M drive
+                    media_state |= 0x90; // 1001 0000 (media type established, 250 kbps)
+                } else if (num_sectors == 18) {  // 1.44M disk in 1.44M drive
+                    media_state |= 0x10; // 0001 0000 (media type established, 500 kbps)
+                }
+            } 
+            break;
+        case 5: // 2.88MB, 3.5"
+            if (track == 79) {
+                if (num_sectors == 9) {          // 720K disk in 2.88M drive
+                    media_state |= 0x90; // 1001 0000 (media type established, 250 kbps)
+                } else if (num_sectors == 18) {  // 1.44M disk in 2.88M drive
+                    media_state |= 0x10; // 0001 0000 (media type established, 500 kbps)
+                } else if (num_sectors == 36) {  // 2.88M disk in 2.88M drive
+                    media_state |= 0xD0; // 1101 0000 (media type established, 1 Mbps)
+                }
+            }
+            break;
+        default:
+            break;
+        }
+
+        // Error if bit 4 (media type established) has not just been set above.
+        if (((media_state >> 4) & 0x01) == 0) {
+            // Error - assume requested tracks/sectors-per-track not supported
+            // for current drive type - or drive type is unknown!
+            SET_AH(0x0C);
+            set_diskette_ret_status(0x0C);
+            SET_CF(); 
+            return;
+        }
+
+        // Update media status
+        write_byte(0x0040, base_address, media_state);
+
+        // set es & di to point to 11 byte diskette param table in ROM 
+        ES = 0xF000;    // @todo: any way to make this relocatable?
+        DI = get_floppy_dpt(drive_type);
+
+        // return success!
+        SET_AH(0);
+        set_diskette_ret_status(0);
+        CLEAR_CF();
         return;
 
     default:
diff --git a/src/VBox/Devices/PC/BIOS/keyboard.c b/src/VBox/Devices/PC/BIOS/keyboard.c
index 0fc6824..2e669fa 100644
--- a/src/VBox/Devices/PC/BIOS/keyboard.c
+++ b/src/VBox/Devices/PC/BIOS/keyboard.c
@@ -468,12 +468,23 @@ void BIOSCALL int09_function(uint16_t ES, uint16_t DI, uint16_t SI, uint16_t BP,
         break;
 
     case 0x53: /* Del press */
-        if ((shift_flags & 0x0c) == 0x0c)
+        if ((shift_flags & 0x0c) == 0x0c) {
+            /* Indicate a warm boot. */
+            write_word(0x0040,0x0072, 0x1234);
             jmp_post();
+        }
         /* fall through */
 
     default:
         if (scancode & 0x80) {
+            /* Set ack/resend flags if appropriate. */
+            if (scancode == 0xFA) {
+                flag = read_byte(0x0040, 0x97) | 0x10;
+                write_byte(0x0040, 0x97, flag);
+            } else if (scancode == 0xFE) {
+                flag = read_byte(0x0040, 0x97) | 0x20;
+                write_byte(0x0040, 0x97, flag);
+            }
             break; /* toss key releases ... */
         }
         if (scancode > MAX_SCAN_CODE) {
@@ -588,7 +599,7 @@ void BIOSCALL int16_function(volatile kbd_regs_t r)
         outb(0x60, 0xed);
         while ((inb(0x64) & 0x01) == 0) outb(0x80, 0x21);
         if ((inb(0x60) == 0xfa)) {
-            led_flags &= 0xf8;
+            led_flags &= 0xc8;
             led_flags |= ((shift_flags >> 4) & 0x07);
             outb(0x60, led_flags & 0x07);
             while ((inb(0x64) & 0x01) == 0)
diff --git a/src/VBox/Devices/PC/BIOS/makefile b/src/VBox/Devices/PC/BIOS/makefile
index b8a00e4..a7fca80 100644
--- a/src/VBox/Devices/PC/BIOS/makefile
+++ b/src/VBox/Devices/PC/BIOS/makefile
@@ -29,11 +29,11 @@ INCLS  = -I$(Q)../../../../../include$(Q)
 .asm.obj : .autodepend
 	wasm -fo=.obj $(AFLAGS) $(DEFS) $<
 
-OBJS = 	bios.obj print.obj ata.obj floppy.obj floppyt.obj eltorito.obj &
+OBJS = 	bios.obj post.obj ata.obj floppy.obj floppyt.obj eltorito.obj &
 	boot.obj keyboard.obj disk.obj serial.obj system.obj invop.obj &
 	timepci.obj logo.obj ps2mouse.obj parallel.obj scsi.obj &
 	ahci.obj apm.obj apm_pm.obj pcibios.obj pciutil.obj vds.obj &
-	pcibio32.obj pci32.obj orgs.obj
+	print.obj pcibio32.obj pci32.obj orgs.obj
 
 vbxbios.rom : vbxbios.bin
 	biossums $< $@
diff --git a/src/VBox/Devices/PC/BIOS/orgs.asm b/src/VBox/Devices/PC/BIOS/orgs.asm
index a380ea2..913b235 100644
--- a/src/VBox/Devices/PC/BIOS/orgs.asm
+++ b/src/VBox/Devices/PC/BIOS/orgs.asm
@@ -127,6 +127,7 @@ extrn		_cdemu_init:near
 extrn		_keyboard_init:near
 extrn		_print_bios_banner:near
 extrn		_inv_op_handler:near
+extrn		rom_scan_:near
 
 
 ;; Symbols referenced from C code
@@ -168,8 +169,6 @@ public		int75_handler
 public		int15_handler32
 public		int15_handler_mouse
 public		iret_modify_cf
-public		rom_scan
-public		rom_checksum
 public		init_pic
 public		floppy_post
 public		int13_out
@@ -198,15 +197,9 @@ BIOSSEG		segment	'CODE'
 		assume	cs:BIOSSEG
 
 ;;
-;; Start of fixed code - eoi_jmp_post is kept here to allow short jumps.
+;; Start of fixed code - eoi_jmp_post is kept near here to allow short jumps.
 ;;
 		BIOSORG	0E030h
-eoi_jmp_post:
-		call	eoi_both_pics
-		xor	ax, ax
-		mov	ds, ax
-		jmp	dword ptr ds:[0467h]
-
 eoi_both_pics:
 		mov	al, PIC_CMD_EOI
 		out	PIC_SLAVE, al
@@ -228,6 +221,12 @@ set_int_vects	proc	near
 
 set_int_vects	endp
 
+eoi_jmp_post:
+		call	eoi_both_pics
+		xor	ax, ax
+		mov	ds, ax
+		jmp	dword ptr ds:[0467h]
+
 ;; --------------------------------------------------------
 ;; POST entry point
 ;; --------------------------------------------------------
@@ -243,15 +242,13 @@ post:
 
 		;; Reset processor to get out of protected mode. Use system
 		;; port instead of KBC.
-		;; NB: We only need bit 0 to be set in AL, which we just
-		;; determined to be the case.
+reset_sys:
+		mov	al, 1
 		out	92h, al
 		jmp	$		; not strictly necessary in a VM
 		
 		
 in_real_mode:
-		;; TODO: Check KBC system flag first
-
 		;; read the CMOS shutdown status
 		mov	al, 0Fh
 		out	CMOS_ADDR, al
@@ -260,6 +257,27 @@ in_real_mode:
 		;; save status
 		xchg	ah, al
 
+		;; Check KBC self-test/shutdown flag. If it is set, we need
+		;; to check for a reboot attempt.
+		in	al, 64h
+		test	al, 4		; clear flag indicates cold boot
+		jz	cont_post
+
+		;; Warm boot, check the shutdown byte.
+		mov	al, ah
+		or	al, al
+		jnz	cont_post
+
+		;; Warm boot but shutdown byte is zero. This is either a warm
+		;; boot request or an attempt to reset the system via triple
+		;; faulting the CPU or similar. Check reboot flag.
+		;; NB: At this point, registers need not be preserved.
+		push	40h
+		pop	ds
+		cmp	word ptr ds:[72h], 1234h
+		jnz	reset_sys	; trigger system reset
+
+cont_post:
 		;; reset the shutdown status in CMOS
 		mov	al, 0Fh
 		out	CMOS_ADDR, al
@@ -392,6 +410,11 @@ memory_cleared:
 
 		call	ebda_post
 
+		;; Initialize PCI devices. This can and should be done early.
+		call	pcibios_init_iomem_bases
+		call	pcibios_init_irqs
+		SET_INT_VECTOR 1Ah, BIOSSEG, int1a_handler
+
 		;; PIT setup
 		SET_INT_VECTOR 08h, BIOSSEG, int08_handler
 		mov	al, 34h		; timer 0, binary, 16-bit, mode 2
@@ -400,6 +423,9 @@ memory_cleared:
 		out	40h, al
 		out	40h, al
 
+		;; video setup - must be done before POSTing VGA ROM
+		SET_INT_VECTOR 10h, BIOSSEG, int10_handler
+
 		;; keyboard setup
 		SET_INT_VECTOR 09h, BIOSSEG, int09_handler
 		SET_INT_VECTOR 16h, BIOSSEG, int16_handler
@@ -422,18 +448,25 @@ memory_cleared:
 		mov	bx, 3Eh
 		mov	ds:[482h], bx	; keyboard buffer end
 
-		push	ds
-		C_SETUP
-		call	_keyboard_init
-		pop	ds
-
-
 		;; store CMOS equipment byte in BDA
 		mov	al, 14h
 		out	CMOS_ADDR, al
 		in	al, CMOS_DATA
 		mov	ds:[410h], al
 
+		push	ds
+		C_SETUP
+
+		;; Scan for video ROMs in the C000-C800 range. This is done
+		;; early so that errors are displayed on the screen.
+		mov	ax, 0C000h
+		mov	dx, 0C800h
+		call	rom_scan_
+
+		;; Initialize the keyboard
+		call	_keyboard_init
+		pop	ds
+
 		;; parallel setup
 		SET_INT_VECTOR 0Fh, BIOSSEG, dummy_iret
 		xor	ax, ax
@@ -471,28 +504,11 @@ memory_cleared:
 		mov	ds:[410h], ax
 
 		;; CMOS RTC
-		SET_INT_VECTOR 1Ah, BIOSSEG, int1a_handler
 		SET_INT_VECTOR 4Ah, BIOSSEG, dummy_iret	; TODO: redundant?
 		SET_INT_VECTOR 70h, BIOSSEG, int70_handler
 		;; BIOS DATA AREA 4CEh ???
 		call	rtc_post
 
-		;; PS/2 mouse setup
-		SET_INT_VECTOR 74h, BIOSSEG, int74_handler
-
-		;; IRQ 13h (FPU exception) setup
-		SET_INT_VECTOR 75h, BIOSSEG, int75_handler
-
-		;; Video setup
-		SET_INT_VECTOR 10h, BIOSSEG, int10_handler
-
-		call	init_pic
-
-		call	pcibios_init_iomem_bases
-		call	pcibios_init_irqs
-
-		call	rom_scan
-
 		jmp	norm_post_cont
 
 
@@ -538,6 +554,14 @@ hard_drive_post	endp
 
 
 norm_post_cont:
+		;; PS/2 mouse setup
+		SET_INT_VECTOR 74h, BIOSSEG, int74_handler
+
+		;; IRQ 13h (FPU exception) setup
+		SET_INT_VECTOR 75h, BIOSSEG, int75_handler
+
+		call	init_pic
+
 		C_SETUP
 		;; ATA/ATAPI driver setup
 		call	_ata_init
@@ -562,6 +586,11 @@ endif
 		C_SETUP			; in case assembly code changed things
 		call	_print_bios_banner
 
+		;; Scan for additional ROMs in the C800-EFFF range
+		mov	ax, 0C800h
+		mov	dx, 0F000h
+		call	rom_scan_
+
 		;; El Torito floppy/hard disk emulation
 		call	_cdemu_init
 
@@ -731,73 +760,6 @@ dummy_isr:
 		iret
 
 
-rom_checksum 	proc	near
-		push	ax
-ifdef CHECKSUM_ROMS
-		push	bx
-		push	cx
-		xor	ax, ax
-		xor	bx, bx
-		xor	cx, cx
-		mov	ch, ds:[2]
-		shl	cx, 1
-checksum_loop:
-		add	al, [bx]
-		inc	bx
-		loop	checksum_loop
-		and	al, 0FFh	; set flags
-		pop	cx
-		pop	bx
-else
-		xor	al, al
-endif
-		pop	ax
-		ret
-rom_checksum	endp
-
-
-;;
-;; ROM scan - scan for valid ROMs and initialize them
-;;
-rom_scan:
-		mov	cx, 0C000h	; start at C000
-rom_scan_loop:
-		mov	ds, cx
-		mov	ax, 4		; scan in 2K increments
-		cmp	word ptr ds:[0], 0AA55h	; look for signature
-		jne	rom_scan_increment
-
-		call	rom_checksum
-		jnz	rom_scan_increment
-
-		mov	al, ds:[2]	; set increment to ROM length
-		test	al, 3
-		jz	block_count_rounded
-
-		and	al, 0FCh	; round up
-		add	al, 4		; to nearest 2K
-block_count_rounded:
-		xor	bx, bx
-		mov	ds, bx
-		push	ax
-		push	cx		; push segment...
-		push	3		; ...and offset of ROM entry
-		mov	bp, sp
-		call	dword ptr [bp]	; call ROM init routine
-		cli			; in case ROM enabled interrupts
-		add	sp, 2		; get rid of offset
-		pop	cx		; restore registers
-		pop	ax
-rom_scan_increment:
-		shl	ax, 5		; convert to 16-byte increments
-		add	cx, ax
-		cmp	cx, 0E800h	; must encompass VBOX_LANBOOT_SEG!
-		jbe	rom_scan_loop
-
-		xor	ax, ax		; DS back to zero
-		mov	ds, ax
-		ret
-
 init_pic	proc	near
 
 		mov	al, 11h		; send init commands
diff --git a/src/VBox/Devices/PC/BIOS/pcibios.c b/src/VBox/Devices/PC/BIOS/pcibios.c
index 33f79c0..4cc4911 100644
--- a/src/VBox/Devices/PC/BIOS/pcibios.c
+++ b/src/VBox/Devices/PC/BIOS/pcibios.c
@@ -387,9 +387,9 @@ void BIOSCALL PCIxx(function)(volatile pci_regs_t r)
         break;
     case GET_IRQ_ROUTING:
         route_buf = ES :> (void *)DI;
-        BX_DEBUG_PCI("PCI: Route Buf %04X:%04X size %04X (at %04X:%04X)\n",
+        BX_DEBUG_PCI("PCI: Route Buf %04X:%04X size %04X, need %04X (at %04X:%04X)\n",
                      FP_SEG(route_buf->buf_ptr), FP_OFF(route_buf->buf_ptr),
-                     route_buf->buf_size, ES, DI);
+                     route_buf->buf_size, pci_routing_table_size, ES, DI);
         if (pci_routing_table_size > route_buf->buf_size) {
             SET_AH(BUFFER_TOO_SMALL);
             SET_CF();
diff --git a/src/VBox/Devices/PC/BIOS/pmsetup.inc b/src/VBox/Devices/PC/BIOS/pmsetup.inc
index c354f24..5f7eb4f 100644
--- a/src/VBox/Devices/PC/BIOS/pmsetup.inc
+++ b/src/VBox/Devices/PC/BIOS/pmsetup.inc
@@ -14,13 +14,15 @@
 ;; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 ;;
 
-LVT0		equ	0FEE00350h
-LVT1		equ	0FEE00360h
+SVR		equ	0FEE000F0h
+LVT_LINT0	equ	0FEE00350h
+LVT_LINT1	equ	0FEE00360h
 
 public		pmode_setup
 
-;; Program LVT0/LVT1 entries in the local APIC. Some Linux kernels (e.g., RHEL4
-;; SMP 32-bit) expect the entries to be unmasked in virtual wire mode.
+;; Enable the local APIC and program LINT0/LINT1 entries. Without that,
+;; virtual wire interrupts could not be delivered. Note that the APIC must
+;; be enabled first because when disabled, all LVTs are forced masked.
 
 pmode_setup	proc	near
 
@@ -30,19 +32,27 @@ pmode_setup	proc	near
 		pushf
 		cli			; Interrupts would kill us!
 		call	pmode_enter
+
 		mov	eax, cr0	; Clear CR0.CD and CR0.NW
 		and	eax, 09FFFFFFFh
 		mov	cr0, eax
-		mov	esi, LVT0	; Program LVT0 to ExtINT and unmask
+
+		mov	esi, SVR	; Program the SVR -- enable the APIC,
+		mov	eax, 010Fh	; set spurious interrupt vector to 15
+		mov	[esi], eax
+
+		mov	esi, LVT_LINT0	; Program LINT0 to ExtINT and unmask
 		mov	eax, [esi]
 		and	eax, 0FFFE00FFh
 		or	ah,  7
 		mov	[esi], eax
-		mov	esi, LVT1	; Program LVT1 to NMI and unmask
+
+		mov	esi, LVT_LINT1	; Program LINT1 to NMI and unmask
 		mov	eax, [esi]
 		and	eax, 0FFFE00FFh
 		or	ah,  4
 		mov	[esi], eax
+
 		call	pmode_exit
 		popf
 		pop	esi
diff --git a/src/VBox/Devices/PC/BIOS/post.c b/src/VBox/Devices/PC/BIOS/post.c
new file mode 100644
index 0000000..ae54f83
--- /dev/null
+++ b/src/VBox/Devices/PC/BIOS/post.c
@@ -0,0 +1,102 @@
+/** @file
+ * BIOS POST routines. Used only during initialization.
+ */
+
+/*
+ * Copyright (C) 2004-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include "biosint.h"
+#include "inlines.h"
+
+#if DEBUG_POST
+#  define DPRINT(...) BX_DEBUG(__VA_ARGS__)
+#else
+#  define DPRINT(...)
+#endif
+
+/* In general, checksumming ROMs in a VM just wastes time. */
+//#define CHECKSUM_ROMS
+
+/* The format of a ROM is as follows:
+ *
+ *     ------------------------------
+ *   0 | AA55h signature (word)     |
+ *     ------------------------------
+ *   2 | Size in 512B blocks (byte) |
+ *     ------------------------------
+ *   3 | Start of executable code   |
+ *     |          .......           |
+ * end |                            |
+ *     ------------------------------
+ */
+
+typedef struct rom_hdr_tag {
+    uint16_t    signature;
+    uint8_t     num_blks;
+    uint8_t     code;
+} rom_hdr;
+
+
+/* Calculate the checksum of a ROM. Note that the ROM might be
+ * larger than 64K.
+ */
+static inline uint8_t rom_checksum(uint8_t __far *rom, uint8_t blocks)
+{
+    uint8_t     sum = 0;
+
+#ifdef CHECKSUM_ROMS
+    while (blocks--) {
+        int     i;
+
+        for (i = 0; i < 512; ++i)
+            sum += rom[i];
+        /* Add 512 bytes (32 paragraphs) to segment. */
+        rom = MK_FP(FP_SEG(rom) + (512 >> 4), 0);
+    }
+#endif
+    return sum;
+}
+
+/* Scan for ROMs in the given range and execute their POST code. */
+void rom_scan(uint16_t start_seg, uint16_t end_seg)
+{
+    rom_hdr __far   *rom;
+    uint8_t         rom_blks;
+
+    DPRINT("Scanning for ROMs in %04X-%04X range\n", start_seg, end_seg);
+
+    while (start_seg < end_seg) {
+        rom = MK_FP(start_seg, 0);
+        /* Check for the ROM signature. */
+        if (rom->signature == 0xAA55) {
+            DPRINT("Found ROM at segment %04X\n", start_seg);
+            if (!rom_checksum((void __far *)rom, rom->num_blks)) {
+                void (__far * rom_init)(void);
+
+                /* Checksum good, initialize ROM. */
+                rom_init = (void __far *)&rom->code;
+                rom_init();
+                int_disable();
+                DPRINT("ROM initialized\n");
+
+                /* Continue scanning past the end of this ROM. */
+                rom_blks   = (rom->num_blks + 3) & ~3;  /* 4 blocks = 2K */
+                start_seg += rom_blks / 4;
+            }
+        } else {
+            /* Scanning is done in 2K steps. */
+            start_seg += 2048 >> 4;
+        }
+    }
+}
diff --git a/src/VBox/Devices/PC/BIOS/scsi.c b/src/VBox/Devices/PC/BIOS/scsi.c
index 236a4db..44aea7e 100644
--- a/src/VBox/Devices/PC/BIOS/scsi.c
+++ b/src/VBox/Devices/PC/BIOS/scsi.c
@@ -108,6 +108,15 @@ int scsi_cmd_data_in(uint16_t io_base, uint8_t target_id, uint8_t __far *aCDB,
         status = inb(io_base + VBSCSI_REGISTER_STATUS);
     while (status & VBSCSI_BUSY);
 
+    /* If any error occurred, inform the caller and don't bother reading the data. */
+    if (status & VBSCSI_ERROR) {
+        outb(io_base + VBSCSI_REGISTER_RESET, 0);
+
+        status = inb(io_base + VBSCSI_REGISTER_DEVSTAT);
+        DBG_SCSI("%s: read failed, device status %02X\n", __func__, status);
+        return 4;   /* Sector not found */
+    }
+
     /* Read in the data. The transfer length may be exactly 64K or more,
      * which needs a bit of care when we're using 16-bit 'rep ins'.
      */
@@ -163,6 +172,15 @@ int scsi_cmd_data_out(uint16_t io_base, uint8_t target_id, uint8_t __far *aCDB,
         status = inb(io_base + VBSCSI_REGISTER_STATUS);
     while (status & VBSCSI_BUSY);
 
+    /* If any error occurred, inform the caller. */
+    if (status & VBSCSI_ERROR) {
+        outb(io_base + VBSCSI_REGISTER_RESET, 0);
+
+        status = inb(io_base + VBSCSI_REGISTER_DEVSTAT);
+        DBG_SCSI("%s: write failed, device status %02X\n", __func__, status);
+        return 4;   /* Sector not found */
+    }
+
     return 0;
 }
 
@@ -184,7 +202,7 @@ int scsi_read_sectors(bio_dsk_t __far *bios_dsk)
 
     device_id = VBOX_GET_SCSI_DEVICE(bios_dsk->drqp.dev_id);
     if (device_id > BX_MAX_SCSI_DEVICES)
-        BX_PANIC("scsi_read_sectors: device_id out of range %d\n", device_id);
+        BX_PANIC("%s: device_id out of range %d\n", __func__, device_id);
 
     count    = bios_dsk->drqp.nsect;
 
@@ -233,7 +251,7 @@ int scsi_write_sectors(bio_dsk_t __far *bios_dsk)
 
     device_id = VBOX_GET_SCSI_DEVICE(bios_dsk->drqp.dev_id);
     if (device_id > BX_MAX_SCSI_DEVICES)
-        BX_PANIC("scsi_write_sectors: device_id out of range %d\n", device_id);
+        BX_PANIC("%s: device_id out of range %d\n", __func__, device_id);
 
     count    = bios_dsk->drqp.nsect;
 
@@ -398,6 +416,8 @@ void scsi_enumerate_attached_devices(uint16_t io_base)
         if (rc != 0)
             BX_PANIC("%s: SCSI_INQUIRY failed\n", __func__);
 
+        devcount_scsi = bios_dsk->scsi_devcount;
+
         /* Check the attached device. */
         if (   ((buffer[0] & 0xe0) == 0)
             && ((buffer[0] & 0x1f) == 0x00))
@@ -405,7 +425,7 @@ void scsi_enumerate_attached_devices(uint16_t io_base)
             DBG_SCSI("%s: Disk detected at %d\n", __func__, i);
 
             /* We add the disk only if the maximum is not reached yet. */
-            if (bios_dsk->scsi_devcount < BX_MAX_SCSI_DEVICES)
+            if (devcount_scsi < BX_MAX_SCSI_DEVICES)
             {
                 uint32_t    sectors, sector_size, cylinders;
                 uint16_t    heads, sectors_per_track;
@@ -426,6 +446,7 @@ void scsi_enumerate_attached_devices(uint16_t io_base)
                           | ((uint32_t)buffer[1] << 16)
                           | ((uint32_t)buffer[2] << 8)
                           | ((uint32_t)buffer[3]);
+                ++sectors;  /* Returned value is the last LBA, zero-based. */
 
                 sector_size =   ((uint32_t)buffer[4] << 24)
                               | ((uint32_t)buffer[5] << 16)
@@ -440,8 +461,6 @@ void scsi_enumerate_attached_devices(uint16_t io_base)
                     continue;
                 }
 
-                devcount_scsi = bios_dsk->scsi_devcount;
-
                 /* Get logical CHS geometry. */
                 switch (devcount_scsi)
                 {
@@ -536,7 +555,6 @@ void scsi_enumerate_attached_devices(uint16_t io_base)
                 write_byte(0x40, 0x75, hdcount);
 
                 devcount_scsi++;
-                bios_dsk->scsi_devcount = devcount_scsi;
             }
             else
             {
@@ -571,10 +589,11 @@ void scsi_enumerate_attached_devices(uint16_t io_base)
             bios_dsk->cdcount = cdcount;
 
             devcount_scsi++;
-            bios_dsk->scsi_devcount = devcount_scsi;
         }
         else
             DBG_SCSI("%s: No supported device detected at %d\n", __func__, i);
+
+        bios_dsk->scsi_devcount = devcount_scsi;
     }
 }
 
@@ -599,13 +618,13 @@ void BIOSCALL scsi_init(void)
     if (identifier == 0x55)
     {
         /* Detected - Enumerate attached devices. */
-        DBG_SCSI("scsi_init: BusLogic SCSI adapter detected\n");
+        DBG_SCSI("%s: BusLogic SCSI adapter detected\n", __func__);
         outb(BUSLOGIC_BIOS_IO_PORT+VBSCSI_REGISTER_RESET, 0);
         scsi_enumerate_attached_devices(BUSLOGIC_BIOS_IO_PORT);
     }
     else
     {
-        DBG_SCSI("scsi_init: BusLogic SCSI adapter not detected\n");
+        DBG_SCSI("%s: BusLogic SCSI adapter not detected\n", __func__);
     }
 
     /* Detect the LSI Logic parallel SCSI adapter. */
@@ -615,13 +634,13 @@ void BIOSCALL scsi_init(void)
     if (identifier == 0x55)
     {
         /* Detected - Enumerate attached devices. */
-        DBG_SCSI("scsi_init: LSI Logic SCSI adapter detected\n");
+        DBG_SCSI("%s: LSI Logic SCSI adapter detected\n", __func__);
         outb(LSILOGIC_BIOS_IO_PORT+VBSCSI_REGISTER_RESET, 0);
         scsi_enumerate_attached_devices(LSILOGIC_BIOS_IO_PORT);
     }
     else
     {
-        DBG_SCSI("scsi_init: LSI Logic SCSI adapter not detected\n");
+        DBG_SCSI("%s: LSI Logic SCSI adapter not detected\n", __func__);
     }
 
     /* Detect the LSI Logic SAS adapter. */
@@ -631,12 +650,12 @@ void BIOSCALL scsi_init(void)
     if (identifier == 0x55)
     {
         /* Detected - Enumerate attached devices. */
-        DBG_SCSI("scsi_init: LSI Logic SAS adapter detected\n");
+        DBG_SCSI("%s: LSI Logic SAS adapter detected\n", __func__);
         outb(LSILOGIC_SAS_BIOS_IO_PORT+VBSCSI_REGISTER_RESET, 0);
         scsi_enumerate_attached_devices(LSILOGIC_SAS_BIOS_IO_PORT);
     }
     else
     {
-        DBG_SCSI("scsi_init: LSI Logic SAS adapter not detected\n");
+        DBG_SCSI("%s: LSI Logic SAS adapter not detected\n", __func__);
     }
 }
diff --git a/src/VBox/Devices/PC/DevACPI.cpp b/src/VBox/Devices/PC/DevACPI.cpp
index b807d94..d1fef5f 100644
--- a/src/VBox/Devices/PC/DevACPI.cpp
+++ b/src/VBox/Devices/PC/DevACPI.cpp
@@ -65,7 +65,7 @@
 #define PM_TMR_FREQ     3579545
 /* Default base for PM PIIX4 device */
 #define PM_PORT_BASE    0x4000
-/* Port offsets in PM device */    
+/* Port offsets in PM device */
 enum
 {
     PM1a_EVT_OFFSET                     = 0x00,
@@ -892,7 +892,7 @@ static void acpiR3PmTimerReset(ACPIState *pThis, uint64_t uNow)
 
 /**
   * Used by acpiR3PMTimer & acpiPmTmrRead to update TMR_VAL and update TMR_STS
-  * 
+  *
   * The caller is expected to either hold the clock lock or to have made sure
   * the VM is resetting or loading state.
   *
@@ -1511,25 +1511,25 @@ PDMBOTHCBDECL(int) acpiR3PM1aCtlWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT
             case 0x01:                  /* S1 */
                 if (pThis->fS1Enabled)
                 {
-                    LogRel(("Entering S1 power state (powered-on suspend)\n"));
+                    LogRel(("ACPI: Entering S1 power state (powered-on suspend)\n"));
                     rc = acpiR3DoSleep(pThis);
                     break;
                 }
-                LogRel(("Ignoring guest attempt to enter S1 power state (powered-on suspend)!\n"));
+                LogRel(("ACPI: Ignoring guest attempt to enter S1 power state (powered-on suspend)!\n"));
                 /* fall thru */
 
             case 0x04:                  /* S4 */
                 if (pThis->fS4Enabled)
                 {
-                    LogRel(("Entering S4 power state (suspend to disk)\n"));
+                    LogRel(("ACPI: Entering S4 power state (suspend to disk)\n"));
                     rc = acpiR3DoPowerOff(pThis);/* Same behavior as S5 */
                     break;
                 }
-                LogRel(("Ignoring guest attempt to enter S4 power state (suspend to disk)!\n"));
+                LogRel(("ACPI: Ignoring guest attempt to enter S4 power state (suspend to disk)!\n"));
                 /* fall thru */
 
             case 0x05:                  /* S5 */
-                LogRel(("Entering S5 power state (power down)\n"));
+                LogRel(("ACPI: Entering S5 power state (power down)\n"));
                 rc = acpiR3DoPowerOff(pThis);
                 break;
 
@@ -1567,12 +1567,12 @@ PDMBOTHCBDECL(int) acpiPMTmrRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port
     int rc = TMTimerLock(pThis->CTX_SUFF(pPmTimer), VINF_IOM_R3_IOPORT_READ);
     if (rc != VINF_SUCCESS)
         return rc;
-    
+
     rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_R3_IOPORT_READ);
     if (rc != VINF_SUCCESS)
     {
-            TMTimerUnlock(pThis->CTX_SUFF(pPmTimer));
-            return rc;
+        TMTimerUnlock(pThis->CTX_SUFF(pPmTimer));
+        return rc;
     }
 
     uint64_t u64Now = TMTimerGet(pThis->CTX_SUFF(pPmTimer));
@@ -1707,7 +1707,7 @@ PDMBOTHCBDECL(int) acpiR3ResetWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT P
     int rc = VINF_SUCCESS;
     if (u32 == ACPI_RESET_REG_VAL)
     {
-        LogRel(("Reset initiated by ACPI\n"));
+        LogRel(("ACPI: Reset initiated by ACPI\n"));
         rc = PDMDevHlpVMReset(pDevIns);
     }
     else
@@ -2641,7 +2641,7 @@ static int acpiR3PlantTables(ACPIState *pThis)
     if (cbRamLow > UINT32_C(0xffe00000)) /* See MEM3. */
     {
         /* Note: This is also enforced by DevPcBios.cpp. */
-        LogRel(("DevACPI: Clipping cbRamLow=%#RX64 down to 0xffe00000.\n", cbRamLow));
+        LogRel(("ACPI: Clipping cbRamLow=%#RX64 down to 0xffe00000.\n", cbRamLow));
         cbRamLow = UINT32_C(0xffe00000);
     }
     pThis->cbRamLow = (uint32_t)cbRamLow;
@@ -3310,7 +3310,8 @@ static DECLCALLBACK(int) acpiR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
                         memcpy(&pThis->u32OemRevision, &pThis->pu8CustBin[24], 4);
                         memcpy(&pThis->au8CreatorId[0], &pThis->pu8CustBin[28], 4);
                         memcpy(&pThis->u32CreatorRev, &pThis->pu8CustBin[32], 4);
-                        LogRel(("Reading custom ACPI table from file '%s' (%d bytes)\n", pszCustBinFile, pThis->cbCustBin));
+                        LogRel(("ACPI: Reading custom ACPI table from file '%s' (%d bytes)\n", pszCustBinFile,
+                                pThis->cbCustBin));
                     }
                 }
                 else
diff --git a/src/VBox/Devices/PC/DevAPIC.cpp b/src/VBox/Devices/PC/DevAPIC.cpp
index 0c49150..ae0ebcf 100644
--- a/src/VBox/Devices/PC/DevAPIC.cpp
+++ b/src/VBox/Devices/PC/DevAPIC.cpp
@@ -283,7 +283,7 @@ typedef struct APICState
     LogApicId               id;
     /* Physical APIC id - not visible to user, constant */
     PhysApicId              phys_id;
-    /** @todo: is it logical or physical? Not really used anyway now. */
+    /** @todo is it logical or physical? Not really used anyway now. */
     PhysApicId              arb_id;
     uint32_t                spurious_vec;
     uint8_t                 log_dest;
@@ -492,7 +492,7 @@ DECLINLINE(uint32_t) getApicEnableBits(APICDeviceInfo *pDev)
         case PDMAPICVERSION_APIC:
             return MSR_IA32_APICBASE_ENABLE;
         case PDMAPICVERSION_X2APIC:
-            return MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_X2ENABLE ;
+            return MSR_IA32_APICBASE_ENABLE | MSR_IA32_APICBASE_X2ENABLE;
         default:
             AssertMsgFailed(("Unsupported APIC version %d\n", pDev->enmVersion));
             return 0;
@@ -587,7 +587,7 @@ PDMBOTHCBDECL(void) apicSetBase(PPDMDEVINS pDevIns, VMCPUID idCpu, uint64_t val)
     APICState *pApic = apicGetStateById(pDev, idCpu);
     Log(("apicSetBase: %016RX64\n", val));
 
-    /** @todo: do we need to lock here ? */
+    /** @todo do we need to lock here ? */
     /* APIC_LOCK_VOID(pDev, VERR_INTERNAL_ERROR); */
     /** @todo If this change is valid immediately, then we should change the MMIO registration! */
     /* We cannot change if this CPU is BSP or not by writing to MSR - it's hardwired */
@@ -615,10 +615,12 @@ PDMBOTHCBDECL(void) apicSetBase(PPDMDEVINS pDevIns, VMCPUID idCpu, uint64_t val)
                 break;
             }
             case PDMAPICVERSION_APIC:
-                /** @todo: map MMIO ranges, if needed */
+                /** @todo map MMIO ranges, if needed */
                 break;
             case PDMAPICVERSION_X2APIC:
-                /** @todo: unmap MMIO ranges of this APIC, according to the spec */
+                /** @todo unmap MMIO ranges of this APIC, according to the spec.  This is how
+                 *       real hw works! (Remember the problem disabling NMI watchdog timers in
+                 *       the world switchers when host used x2apic?)! */
                 break;
             default:
                 break;
@@ -655,6 +657,16 @@ PDMBOTHCBDECL(uint8_t) apicGetTPR(PPDMDEVINS pDevIns, VMCPUID idCpu)
 }
 
 
+PDMBOTHCBDECL(uint64_t) apicGetTimerFreq(PPDMDEVINS pDevIns)
+{
+    APICDeviceInfo *pDev = PDMINS_2_DATA(pDevIns, APICDeviceInfo *);
+    APICState *pApic = apicGetStateById(pDev, 0);
+    uint64_t uTimer = TMTimerGetFreq(pApic->CTX_SUFF(pTimer));
+    Log2(("apicGetTimerFreq: returns %#RX64\n", uTimer));
+    return uTimer;
+}
+
+
 /**
  * apicWriteRegister helper for dealing with invalid register access.
  *
@@ -1149,9 +1161,7 @@ PDMBOTHCBDECL(int) apicLocalInterrupt(PPDMDEVINS pDevIns, uint8_t u8Pin, uint8_t
             case APIC_DM_FIXED:
             {
                 /** @todo implement APIC_DM_FIXED! */
-                static unsigned s_c = 0;
-                if (s_c++ < 5)
-                    LogRel(("delivery type APIC_DM_FIXED not implemented. u8Pin=%d u8Level=%d\n", u8Pin, u8Level));
+                LogRelMax(5, ("delivery type APIC_DM_FIXED not implemented. u8Pin=%d u8Level=%d\n", u8Pin, u8Level));
                 return  VINF_SUCCESS;
             }
             case APIC_DM_INIT:
@@ -1858,8 +1868,8 @@ PDMBOTHCBDECL(int) apicMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPh
     Log(("CPU%d: apicMMIOWrite at %RGp\n", pApic->phys_id, GCPhysAddr));
     Assert(cb == 4);
 
-    /** @todo: add LAPIC range validity checks (multiple LAPICs can theoretically have
-     *         different physical addresses, see @bugref{3092}) */
+    /** @todo add LAPIC range validity checks (multiple LAPICs can theoretically
+     *        have different physical addresses, see @bugref{3092}) */
 
     STAM_COUNTER_INC(&CTXSUFF(pDev->StatMMIOWrite));
     /* Note! It does its own locking. */
@@ -1885,9 +1895,8 @@ static uint64_t apicR3InfoReadReg(APICDeviceInfo *pDev, APICState *pApic, uint32
     return u64Value;
 }
 
-
 /**
- * Print a 8-DWORD Local APIC bit map (256 bits).
+ * Print an 8-DWORD Local APIC bit map (256 bits).
  *
  * @param   pDev                The PDM device instance.
  * @param   pApic               The Local APIC in question.
@@ -1896,12 +1905,40 @@ static uint64_t apicR3InfoReadReg(APICDeviceInfo *pDev, APICState *pApic, uint32
  */
 static void apicR3DumpVec(APICDeviceInfo *pDev, APICState *pApic, PCDBGFINFOHLP pHlp, uint32_t iStartReg)
 {
-    for (uint32_t i = 0; i < 8; i++)
+    for (int i = 7; i >= 0; --i)
         pHlp->pfnPrintf(pHlp, "%08x", apicR3InfoReadReg(pDev, pApic, iStartReg + i));
     pHlp->pfnPrintf(pHlp, "\n");
 }
 
 /**
+ * Print the set of pending interrupts in a 256-bit map.
+ *
+ * @param   pDev                The PDM device instance.
+ * @param   pApic               The Local APIC in question.
+ * @param   pHlp                The output helper.
+ * @param   iStartReg           The register to start at.
+ */
+static void apicR3DumpPending(APICDeviceInfo *pDev, APICState *pApic, PCDBGFINFOHLP pHlp, PCAPIC256BITREG pReg)
+{
+    APIC256BITREG       pending;
+    int                 iMax;
+    int                 cPending = 0;
+
+    pending = *pReg;
+    pHlp->pfnPrintf(pHlp, "    pending =");
+
+    while ((iMax = Apic256BitReg_FindLastSetBit(&pending, -1)) != -1)
+    {
+        pHlp->pfnPrintf(pHlp, " %02x", iMax);
+        Apic256BitReg_ClearBit(&pending, iMax);
+        ++cPending;
+    }
+    if (!cPending)
+        pHlp->pfnPrintf(pHlp, " none");
+    pHlp->pfnPrintf(pHlp, "\n");
+}
+
+/**
  * Print basic Local APIC state.
  *
  * @param   pDev                The PDM device instance.
@@ -1937,12 +1974,10 @@ static void apicR3InfoBasic(APICDeviceInfo *pDev, APICState *pApic, PCDBGFINFOHL
     pHlp->pfnPrintf(pHlp, "    vector  = %02x\n", (unsigned)RT_BYTE1(u64));
     pHlp->pfnPrintf(pHlp, "  ISR       : ");
     apicR3DumpVec(pDev, pApic, pHlp, 0x10);
-    int iMax = Apic256BitReg_FindLastSetBit(&pApic->isr, -1);
-    pHlp->pfnPrintf(pHlp, "    highest = %02x\n", iMax == -1 ? 0 : iMax);
+    apicR3DumpPending(pDev, pApic, pHlp, &pApic->isr);
     pHlp->pfnPrintf(pHlp, "  IRR       : ");
     apicR3DumpVec(pDev, pApic, pHlp, 0x20);
-    iMax = Apic256BitReg_FindLastSetBit(&pApic->irr, -1);
-    pHlp->pfnPrintf(pHlp, "    highest = %02X\n", iMax == -1 ? 0 : iMax);
+    apicR3DumpPending(pDev, pApic, pHlp, &pApic->irr);
 }
 
 
@@ -2053,7 +2088,7 @@ static DECLCALLBACK(int) apicR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     /* config */
     apicR3LiveExec(pDevIns, pSSM, SSM_PASS_FINAL);
 
-    /* save all APICs data */ /** @todo: is it correct? */
+    /* save all APICs data */ /** @todo is it correct? */
     APIC_FOREACH_BEGIN(pDev);
         apic_save(pSSM, pCurApic);
     APIC_FOREACH_END();
@@ -2095,7 +2130,7 @@ static DECLCALLBACK(int) apicR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uin
     if (uPass != SSM_PASS_FINAL)
         return VINF_SUCCESS;
 
-    /* load all APICs data */ /** @todo: is it correct? */
+    /* load all APICs data */ /** @todo is it correct? */
     APIC_LOCK(pDev, VERR_INTERNAL_ERROR_3);
 
     int rc = VINF_SUCCESS;
@@ -2139,8 +2174,8 @@ static DECLCALLBACK(void) apicR3Reset(PPDMDEVINS pDevIns)
         /* Clear any pending APIC interrupt action flag. */
         apicCpuClearInterrupt(pDev, pApic);
     }
-    /** @todo r=bird: Why is this done everytime, while the constructor first
-     *        checks the CPUID?  Who is right? */
+
+    LogRel(("APIC: Re-activating Local APIC\n"));
     pDev->pApicHlpR3->pfnChangeFeature(pDev->pDevInsR3, pDev->enmVersion);
 
     APIC_UNLOCK(pDev);
@@ -2236,7 +2271,8 @@ static DECLCALLBACK(int) apicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
     pDev->pDevInsRC  = PDMDEVINS_2_RCPTR(pDevIns);
     pDev->cCpus      = cCpus;
     pDev->fIoApic    = fIoApic;
-    /* Use PDMAPICVERSION_X2APIC to activate x2APIC mode */
+    /** @todo Finish X2APIC implementation.  Must, among other things, set
+     *        PDMAPICVERSION_X2APIC here when X2APIC is configured. */
     pDev->enmVersion = PDMAPICVERSION_APIC;
 
     /* Disable locking in this device. */
@@ -2272,6 +2308,7 @@ static DECLCALLBACK(int) apicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
     ApicReg.pfnReadMSRR3            = apicReadMSR;
     ApicReg.pfnBusDeliverR3         = apicBusDeliverCallback;
     ApicReg.pfnLocalInterruptR3     = apicLocalInterrupt;
+    ApicReg.pfnGetTimerFreqR3       = apicGetTimerFreq;
     if (fRZEnabled)
     {
         ApicReg.pszGetInterruptRC   = "apicGetInterrupt";
@@ -2284,6 +2321,7 @@ static DECLCALLBACK(int) apicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
         ApicReg.pszReadMSRRC        = "apicReadMSR";
         ApicReg.pszBusDeliverRC     = "apicBusDeliverCallback";
         ApicReg.pszLocalInterruptRC = "apicLocalInterrupt";
+        ApicReg.pszGetTimerFreqRC   = "apicGetTimerFreq";
 
         ApicReg.pszGetInterruptR0   = "apicGetInterrupt";
         ApicReg.pszHasPendingIrqR0  = "apicHasPendingIrq";
@@ -2295,6 +2333,7 @@ static DECLCALLBACK(int) apicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
         ApicReg.pszReadMSRR0        = "apicReadMSR";
         ApicReg.pszBusDeliverR0     = "apicBusDeliverCallback";
         ApicReg.pszLocalInterruptR0 = "apicLocalInterrupt";
+        ApicReg.pszGetTimerFreqR0   = "apicGetTimerFreq";
     }
     else
     {
@@ -2308,6 +2347,7 @@ static DECLCALLBACK(int) apicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
         ApicReg.pszReadMSRRC        = NULL;
         ApicReg.pszBusDeliverRC     = NULL;
         ApicReg.pszLocalInterruptRC = NULL;
+        ApicReg.pszGetTimerFreqRC   = NULL;
 
         ApicReg.pszGetInterruptR0   = NULL;
         ApicReg.pszHasPendingIrqR0  = NULL;
@@ -2319,6 +2359,7 @@ static DECLCALLBACK(int) apicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
         ApicReg.pszReadMSRR0        = NULL;
         ApicReg.pszBusDeliverR0     = NULL;
         ApicReg.pszLocalInterruptR0 = NULL;
+        ApicReg.pszGetTimerFreqR0   = NULL;
     }
 
     rc = PDMDevHlpAPICRegister(pDevIns, &ApicReg, &pDev->pApicHlpR3);
@@ -2328,31 +2369,16 @@ static DECLCALLBACK(int) apicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
     /*
      * The CPUID feature bit.
      */
-    /** @todo r=bird: See remark in the apicR3Reset. */
-    uint32_t u32Eax, u32Ebx, u32Ecx, u32Edx;
-    PDMDevHlpGetCpuId(pDevIns, 0, &u32Eax, &u32Ebx, &u32Ecx, &u32Edx);
-    if (u32Eax >= 1)
-    {
-        if (   fIoApic                       /* If IOAPIC is enabled, enable Local APIC in any case */
-            || (   u32Ebx == X86_CPUID_VENDOR_INTEL_EBX
-                && u32Ecx == X86_CPUID_VENDOR_INTEL_ECX
-                && u32Edx == X86_CPUID_VENDOR_INTEL_EDX /* GenuineIntel */)
-            || (   u32Ebx == X86_CPUID_VENDOR_AMD_EBX
-                && u32Ecx == X86_CPUID_VENDOR_AMD_ECX
-                && u32Edx == X86_CPUID_VENDOR_AMD_EDX   /* AuthenticAMD */))
-        {
-            LogRel(("Activating Local APIC\n"));
-            pDev->pApicHlpR3->pfnChangeFeature(pDevIns, pDev->enmVersion);
-        }
-    }
+    LogRel(("APIC: Activating Local APIC\n"));
+    pDev->pApicHlpR3->pfnChangeFeature(pDevIns, pDev->enmVersion);
 
     /*
      * Register the MMIO range.
      */
-    /** @todo: shall reregister, if base changes. */
+    /** @todo shall reregister, if base changes. */
     uint32_t ApicBase = pDev->paLapicsR3[0].apicbase & ~0xfff;
     rc = PDMDevHlpMMIORegister(pDevIns, ApicBase, 0x1000, pDev,
-                               IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_ONLY_DWORD,
+                               IOMMMIO_FLAGS_READ_DWORD | IOMMMIO_FLAGS_WRITE_DWORD_ZEROED,
                                apicMMIOWrite, apicMMIORead, "APIC Memory");
     if (RT_FAILURE(rc))
         return rc;
diff --git a/src/VBox/Devices/PC/DevHPET.cpp b/src/VBox/Devices/PC/DevHPET.cpp
index b9a9720..99b3478 100644
--- a/src/VBox/Devices/PC/DevHPET.cpp
+++ b/src/VBox/Devices/PC/DevHPET.cpp
@@ -76,8 +76,8 @@
 
 /** @name Interrupt type
  * @{ */
-#define HPET_TIMER_TYPE_LEVEL       1
-#define HPET_TIMER_TYPE_EDGE        0
+#define HPET_TIMER_TYPE_LEVEL       (1 << 1)
+#define HPET_TIMER_TYPE_EDGE        (0 << 1)
 /** @} */
 
 /** @name Delivery mode
@@ -445,9 +445,7 @@ static int hpetTimerRegRead32(HPET const *pThis, uint32_t iTimerNo, uint32_t iTi
     if (   iTimerNo >= HPET_CAP_GET_TIMERS(pThis->u32Capabilities)  /* The second check is only to satisfy Parfait; */
         || iTimerNo >= RT_ELEMENTS(pThis->aTimers) )                /* in practice, the number of configured timers */
     {                                                               /* will always be <= aTimers elements. */
-        static unsigned s_cOccurences = 0;
-        if (s_cOccurences++ < 10)
-            LogRel(("HPET: using timer above configured range: %d\n", iTimerNo));
+        LogRelMax(10, ("HPET: using timer above configured range: %d\n", iTimerNo));
         *pu32Value = 0;
         return VINF_SUCCESS;
     }
@@ -483,9 +481,7 @@ static int hpetTimerRegRead32(HPET const *pThis, uint32_t iTimerNo, uint32_t iTi
 
         default:
         {
-            static unsigned s_cOccurences = 0;
-            if (s_cOccurences++ < 10)
-                LogRel(("invalid HPET register read %d on %d\n", iTimerReg, pHpetTimer->idxTimer));
+            LogRelMax(10, ("invalid HPET register read %d on %d\n", iTimerReg, pHpetTimer->idxTimer));
             u32Value = 0;
             break;
         }
@@ -514,9 +510,7 @@ static int hpetTimerRegWrite32(HPET *pThis, uint32_t iTimerNo, uint32_t iTimerRe
     if (   iTimerNo >= HPET_CAP_GET_TIMERS(pThis->u32Capabilities)
         || iTimerNo >= RT_ELEMENTS(pThis->aTimers) )    /* Parfait - see above. */
     {
-        static unsigned s_cOccurences = 0;
-        if (s_cOccurences++ < 10)
-            LogRel(("HPET: using timer above configured range: %d\n", iTimerNo));
+        LogRelMax(10, ("HPET: using timer above configured range: %d\n", iTimerNo));
         return VINF_SUCCESS;
     }
     HPETTIMER *pHpetTimer = &pThis->aTimers[iTimerNo];
@@ -545,9 +539,7 @@ static int hpetTimerRegWrite32(HPET *pThis, uint32_t iTimerNo, uint32_t iTimerRe
             }
             if ((u32NewValue & HPET_TN_INT_TYPE) == HPET_TIMER_TYPE_LEVEL)
             {
-                static unsigned s_cOccurences = 0;
-                if (s_cOccurences++ < 10)
-                    LogRel(("level-triggered config not yet supported\n"));
+                LogRelMax(10, ("level-triggered config not yet supported\n"));
                 AssertFailed();
             }
 
@@ -558,10 +550,8 @@ static int hpetTimerRegWrite32(HPET *pThis, uint32_t iTimerNo, uint32_t iTimerRe
         }
 
         case HPET_TN_CFG + 4: /* Interrupt capabilities - read only. */
-        {
             Log(("write HPET_TN_CFG + 4, useless\n"));
             break;
-        }
 
         case HPET_TN_CMP: /* lower bits of comparator register */
         {
@@ -602,24 +592,16 @@ static int hpetTimerRegWrite32(HPET *pThis, uint32_t iTimerNo, uint32_t iTimerRe
         }
 
         case HPET_TN_ROUTE:
-        {
             Log(("write HPET_TN_ROUTE\n"));
             break;
-        }
 
         case HPET_TN_ROUTE + 4:
-        {
             Log(("write HPET_TN_ROUTE + 4\n"));
             break;
-        }
 
         default:
-        {
-            static unsigned s_cOccurences = 0;
-            if (s_cOccurences++ < 10)
-                LogRel(("invalid timer register write: %d\n", iTimerReg));
+            LogRelMax(10, ("invalid timer register write: %d\n", iTimerReg));
             break;
-        }
     }
 
     return VINF_SUCCESS;
@@ -813,11 +795,7 @@ static int hpetConfigRegWrite32(HPET *pThis, uint32_t idxReg, uint32_t u32NewVal
         {
             Log(("write HPET_STATUS + 4: %x\n", u32NewValue));
             if (u32NewValue != 0)
-            {
-                static unsigned s_cOccurrences = 0;
-                if (s_cOccurrences++ < 10)
-                    LogRel(("Writing HPET_STATUS + 4 with non-zero, ignored\n"));
-            }
+                LogRelMax(10, ("Writing HPET_STATUS + 4 with non-zero, ignored\n"));
             break;
         }
 
@@ -840,12 +818,8 @@ static int hpetConfigRegWrite32(HPET *pThis, uint32_t idxReg, uint32_t u32NewVal
         }
 
         default:
-        {
-            static unsigned s_cOccurences = 0;
-            if (s_cOccurences++ < 10)
-                LogRel(("invalid HPET config write: %x\n", idxReg));
+            LogRelMax(10, ("invalid HPET config write: %x\n", idxReg));
             break;
-        }
     }
 
     return rc;
diff --git a/src/VBox/Devices/PC/DevIoApic.cpp b/src/VBox/Devices/PC/DevIoApic.cpp
index db50421..3c1d620 100644
--- a/src/VBox/Devices/PC/DevIoApic.cpp
+++ b/src/VBox/Devices/PC/DevIoApic.cpp
@@ -491,7 +491,7 @@ PDMBOTHCBDECL(void) ioapicSendMsi(PPDMDEVINS pDevIns, RTGCPHYS GCAddr, uint32_t
 {
     PIOAPIC pThis = PDMINS_2_DATA(pDevIns, PIOAPIC);
 
-    LogFlow(("ioapicSendMsi: Address=%p uValue=%\n", GCAddr, uValue));
+    LogFlow(("ioapicSendMsi: Address=%p uValue=%u\n", GCAddr, uValue));
 
     uint8_t  dest = (GCAddr & VBOX_MSI_ADDR_DEST_ID_MASK) >> VBOX_MSI_ADDR_DEST_ID_SHIFT;
     uint8_t  vector_num = (uValue & VBOX_MSI_DATA_VECTOR_MASK) >> VBOX_MSI_DATA_VECTOR_SHIFT;
diff --git a/src/VBox/Devices/PC/DevPcBios.cpp b/src/VBox/Devices/PC/DevPcBios.cpp
index ac19fe6..8df29cc 100644
--- a/src/VBox/Devices/PC/DevPcBios.cpp
+++ b/src/VBox/Devices/PC/DevPcBios.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -267,7 +267,7 @@ static DECLCALLBACK(int) pcbiosIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTI
             if (pThis->iShutdown == 8)
             {
                 pThis->iShutdown = 0;
-                LogRel(("DevPcBios: 8900h shutdown request.\n"));
+                LogRel(("PcBios: 8900h shutdown request\n"));
                 return PDMDevHlpVMPowerOff(pDevIns);
             }
         }
@@ -457,12 +457,12 @@ static int setLogicalDiskGeometry(PPDMIBASE pBase, PPDMIBLOCKBIOS pHardDisk, PPD
         rc = pHardDisk->pfnSetLCHSGeometry(pHardDisk, &LCHSGeometry);
         if (rc == VERR_VD_IMAGE_READ_ONLY)
         {
-            LogRel(("DevPcBios: ATA failed to update LCHS geometry, read only\n"));
+            LogRel(("PcBios: ATA failed to update LCHS geometry, read only\n"));
             rc = VINF_SUCCESS;
         }
         else if (rc == VERR_PDM_GEOMETRY_NOT_SET)
         {
-            LogRel(("DevPcBios: ATA failed to update LCHS geometry, backend refused\n"));
+            LogRel(("PcBios: ATA failed to update LCHS geometry, backend refused\n"));
             rc = VINF_SUCCESS;
         }
     }
@@ -587,7 +587,7 @@ static DECLCALLBACK(int) pcbiosInitComplete(PPDMDEVINS pDevIns)
     else
     {
         c64KBAbove4GB = (pThis->cbRam - offRamHole) / _64K;
-        /* Make sure it doesn't hit the limits of the current BIOS code.   */
+        /* Make sure it doesn't hit the limits of the current BIOS code. */
         AssertLogRelMsgReturn((c64KBAbove4GB >> (3 * 8)) < 255, ("%#RX64\n", c64KBAbove4GB), VERR_OUT_OF_RANGE);
     }
     pcbiosCmosWrite(pDevIns, 0x61,  c64KBAbove4GB        & 0xff);
@@ -720,7 +720,7 @@ static DECLCALLBACK(int) pcbiosInitComplete(PPDMDEVINS pDevIns)
                 pcbiosCmosInitHardDisk(pDevIns, offType, offInfo,
                                        &LCHSGeometry);
             }
-            LogRel(("DevPcBios: ATA LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors));
+            LogRel(("PcBios: ATA LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors));
         }
     }
 
@@ -777,7 +777,7 @@ static DECLCALLBACK(int) pcbiosInitComplete(PPDMDEVINS pDevIns)
                     pcbiosCmosInitHardDisk(pDevIns, 0x00, offInfo,
                                            &LCHSGeometry);
                 }
-                LogRel(("DevPcBios: SATA LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors));
+                LogRel(("PcBios: SATA LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors));
             }
         }
     }
@@ -830,10 +830,10 @@ static DECLCALLBACK(int) pcbiosInitComplete(PPDMDEVINS pDevIns)
                             break;
                     }
                     pcbiosCmosInitHardDisk(pDevIns, 0x00, offInfo, &LCHSGeometry);
-                    LogRel(("DevPcBios: SCSI LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors));
+                    LogRel(("PcBios: SCSI LUN#%d LCHS=%u/%u/%u\n", i, LCHSGeometry.cCylinders, LCHSGeometry.cHeads, LCHSGeometry.cSectors));
                 }
                 else
-                    LogRel(("DevPcBios: SCSI LUN#%d LCHS not provided\n", i));
+                    LogRel(("PcBios: SCSI LUN#%d LCHS not provided\n", i));
             }
         }
     }
@@ -1106,7 +1106,7 @@ static DECLCALLBACK(int)  pcbiosConstruct(PPDMDEVINS pDevIns, int iInstance, PCF
                                 N_("Configuration error: Querying \"McfgLength\" as integer failed"));
 
 
-    LogRel(("[SMP] BIOS with %u CPUs\n", pThis->cCpus));
+    LogRel(("PcBios: [SMP] BIOS with %u CPUs\n", pThis->cCpus));
 
     rc = CFGMR3QueryU8Def(pCfg, "IOAPIC", &pThis->u8IOAPIC, 1);
     if (RT_FAILURE (rc))
@@ -1333,7 +1333,7 @@ static DECLCALLBACK(int)  pcbiosConstruct(PPDMDEVINS pDevIns, int iInstance, PCF
         if (RT_FAILURE(rc))
             return rc;
 
-        LogRel(("DevPcBios: Using BIOS ROM '%s' with a size of %#x bytes\n", pThis->pszPcBiosFile, pThis->cbPcBios));
+        LogRel(("PcBios: Using BIOS ROM '%s' with a size of %#x bytes\n", pThis->pszPcBiosFile, pThis->cbPcBios));
     }
     else
     {
@@ -1396,8 +1396,11 @@ static DECLCALLBACK(int)  pcbiosConstruct(PPDMDEVINS pDevIns, int iInstance, PCF
     }
 
     if (pThis->u8IOAPIC)
+    {
         FwCommonPlantMpsTable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE,
                               _4K - VBOX_DMI_TABLE_SIZE, pThis->cCpus);
+        LogRel(("PcBios: MPS table at %08x\n", VBOX_DMI_TABLE_BASE + VBOX_DMI_TABLE_SIZE));
+    }
 
     rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage, _4K,
                               PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "DMI tables");
@@ -1468,7 +1471,7 @@ static DECLCALLBACK(int)  pcbiosConstruct(PPDMDEVINS pDevIns, int iInstance, PCF
             /*
              * Ignore failure and fall back to the built-in LAN boot ROM.
              */
-            LogRel(("DevPcBios: Failed to open LAN boot ROM file '%s', rc=%Rrc!\n", pThis->pszLanBootFile, rc));
+            LogRel(("PcBios: Failed to open LAN boot ROM file '%s', rc=%Rrc!\n", pThis->pszLanBootFile, rc));
             RTFileClose(FileLanBoot);
             FileLanBoot = NIL_RTFILE;
             MMR3HeapFree(pThis->pszLanBootFile);
@@ -1481,7 +1484,7 @@ static DECLCALLBACK(int)  pcbiosConstruct(PPDMDEVINS pDevIns, int iInstance, PCF
      */
     if (pThis->pszLanBootFile)
     {
-        LogRel(("DevPcBios: Using LAN ROM '%s' with a size of %#x bytes\n", pThis->pszLanBootFile, cbFileLanBoot));
+        LogRel(("PcBios: Using LAN ROM '%s' with a size of %#x bytes\n", pThis->pszLanBootFile, cbFileLanBoot));
         /*
          * Allocate buffer for the LAN boot ROM data.
          */
diff --git a/src/VBox/Devices/PC/DevRTC.cpp b/src/VBox/Devices/PC/DevRTC.cpp
index 51028f7..231d474 100644
--- a/src/VBox/Devices/PC/DevRTC.cpp
+++ b/src/VBox/Devices/PC/DevRTC.cpp
@@ -189,6 +189,11 @@ typedef struct RTCSTATE
 
     /** HPET legacy mode notification interface. */
     PDMIHPETLEGACYNOTIFY  IHpetLegacyNotify;
+
+    /** Number of IRQs that's been raised. */
+    STAMCOUNTER             StatRTCIrq;
+    /** Number of times the timer callback handler ran. */
+    STAMCOUNTER             StatRTCTimerCB;
 } RTCSTATE;
 /** Pointer to the RTC device state. */
 typedef RTCSTATE *PRTCSTATE;
@@ -249,7 +254,11 @@ static void rtc_timer_update(PRTCSTATE pThis, int64_t current_time)
 static void rtc_raise_irq(PRTCSTATE pThis, uint32_t iLevel)
 {
     if (!pThis->fDisabledByHpet)
+    {
         PDMDevHlpISASetIrq(pThis->CTX_SUFF(pDevIns), pThis->irq, iLevel);
+        if (iLevel)
+            STAM_COUNTER_INC(&pThis->StatRTCIrq);
+    }
 }
 
 
@@ -276,9 +285,12 @@ static void rtc_set_time(PRTCSTATE pThis)
     tm->tm_sec  = from_bcd(pThis, pThis->cmos_data[RTC_SECONDS]);
     tm->tm_min  = from_bcd(pThis, pThis->cmos_data[RTC_MINUTES]);
     tm->tm_hour = from_bcd(pThis, pThis->cmos_data[RTC_HOURS] & 0x7f);
-    if (   !(pThis->cmos_data[RTC_REG_B] & 0x02)
-        && (pThis->cmos_data[RTC_HOURS] & 0x80))
-        tm->tm_hour += 12;
+    if (!(pThis->cmos_data[RTC_REG_B] & 0x02))
+    {
+        tm->tm_hour %= 12;
+        if (pThis->cmos_data[RTC_HOURS] & 0x80)
+            tm->tm_hour += 12;
+    }
     tm->tm_wday = from_bcd(pThis, pThis->cmos_data[RTC_DAY_OF_WEEK]);
     tm->tm_mday = from_bcd(pThis, pThis->cmos_data[RTC_DAY_OF_MONTH]);
     tm->tm_mon  = from_bcd(pThis, pThis->cmos_data[RTC_MONTH]) - 1;
@@ -542,6 +554,7 @@ static DECLCALLBACK(void) rtcTimerPeriodic(PPDMDEVINS pDevIns, PTMTIMER pTimer,
     Assert(PDMCritSectIsOwner(pThis->CTX_SUFF(pDevIns)->CTX_SUFF(pCritSectRo)));
 
     rtc_timer_update(pThis, pThis->next_periodic_time);
+    STAM_COUNTER_INC(&pThis->StatRTCTimerCB);
     pThis->cmos_data[RTC_REG_C] |= 0xc0;
 
     rtc_raise_irq(pThis, 1);
@@ -660,7 +673,8 @@ static void rtc_copy_date(PRTCSTATE pThis)
     else
     {
         /* 12 hour format */
-        pThis->cmos_data[RTC_HOURS] = to_bcd(pThis, tm->tm_hour % 12);
+        int h = tm->tm_hour % 12;
+        pThis->cmos_data[RTC_HOURS] = to_bcd(pThis, h ? h : 12);
         if (tm->tm_hour >= 12)
             pThis->cmos_data[RTC_HOURS] |= 0x80;
     }
@@ -1218,6 +1232,13 @@ static DECLCALLBACK(int)  rtcConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMN
     PDMDevHlpDBGFInfoRegister(pDevIns, "cmos1", "Display CMOS Bank 1 Info (0x0e-0x7f). No arguments. See also rtc.", rtcCmosBankInfo);
     PDMDevHlpDBGFInfoRegister(pDevIns, "cmos2", "Display CMOS Bank 2 Info (0x0e-0x7f). No arguments.", rtcCmosBank2Info);
     PDMDevHlpDBGFInfoRegister(pDevIns, "rtc",   "Display CMOS RTC (0x00-0x0d). No arguments. See also cmos1 & cmos2", rtcCmosClockInfo);
+
+    /*
+     * Register statistics.
+     */
+    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatRTCIrq,      STAMTYPE_COUNTER, "/TM/RTC/Irq",      STAMUNIT_OCCURENCES,  "The number of times a RTC interrupt was triggered.");
+    PDMDevHlpSTAMRegister(pDevIns, &pThis->StatRTCTimerCB,  STAMTYPE_COUNTER, "/TM/RTC/TimerCB",  STAMUNIT_OCCURENCES,  "The number of times the RTC timer callback ran.");
+
     return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/Devices/PC/ipxe/iPxeBiosBin.rom b/src/VBox/Devices/PC/ipxe/iPxeBiosBin.rom
index ec0873e..1731e2e 100644
Binary files a/src/VBox/Devices/PC/ipxe/iPxeBiosBin.rom and b/src/VBox/Devices/PC/ipxe/iPxeBiosBin.rom differ
diff --git a/src/VBox/Devices/PC/ipxe/src/config/general.h b/src/VBox/Devices/PC/ipxe/src/config/general.h
index 5145fa8..c4aeb16 100644
--- a/src/VBox/Devices/PC/ipxe/src/config/general.h
+++ b/src/VBox/Devices/PC/ipxe/src/config/general.h
@@ -55,7 +55,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
  */
 
 #define	DOWNLOAD_PROTO_TFTP	/* Trivial File Transfer Protocol */
-#define	DOWNLOAD_PROTO_HTTP	/* Hypertext Transfer Protocol */
+#define DOWNLOAD_PROTO_HTTP	/* Hypertext Transfer Protocol */
 #undef	DOWNLOAD_PROTO_HTTPS	/* Secure Hypertext Transfer Protocol */
 #undef	DOWNLOAD_PROTO_FTP	/* File Transfer Protocol */
 #undef	DOWNLOAD_PROTO_SLAM	/* Scalable Local Area Multicast */
diff --git a/src/VBox/Devices/PC/vbox.dsl b/src/VBox/Devices/PC/vbox.dsl
index f914b6a..2f73dff 100644
--- a/src/VBox/Devices/PC/vbox.dsl
+++ b/src/VBox/Devices/PC/vbox.dsl
@@ -586,7 +586,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, "VBOX  ", "VBOXBIOS", 2)
                         Return (0x00)
                      }
                      else {
-                        Return (0x0E)
+                        Return (0x0F)
                      }
                     }
                 }               
diff --git a/src/VBox/Devices/Serial/DevSerial.cpp b/src/VBox/Devices/Serial/DevSerial.cpp
index debe4a4..60dded2 100644
--- a/src/VBox/Devices/Serial/DevSerial.cpp
+++ b/src/VBox/Devices/Serial/DevSerial.cpp
@@ -67,7 +67,8 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
 #define SERIAL_SAVED_STATE_VERSION_16450        3
-#define SERIAL_SAVED_STATE_VERSION              4
+#define SERIAL_SAVED_STATE_VERSION_MISSING_BITS 4
+#define SERIAL_SAVED_STATE_VERSION              5
 
 #define UART_LCR_DLAB       0x80        /* Divisor latch access bit */
 
@@ -929,6 +930,17 @@ static DECLCALLBACK(int) serialSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     SSMR3PutU32(pSSM, pThis->base);
     SSMR3PutBool(pSSM, pThis->msr_changed);
 
+    /* Version 5, safe everything that might be of importance.  Much better than
+       missing relevant bits! */
+    SSMR3PutU8(pSSM, pThis->thr);
+    SSMR3PutU8(pSSM, pThis->tsr);
+    SSMR3PutU8(pSSM, pThis->iir);
+    SSMR3PutS32(pSSM, pThis->timeout_ipending);
+    TMR3TimerSave(pThis->fifo_timeout_timer, pSSM);
+    TMR3TimerSave(pThis->transmit_timerR3, pSSM);
+    SSMR3PutU8(pSSM, pThis->recv_fifo.itl);
+    SSMR3PutU8(pSSM, pThis->xmit_fifo.itl);
+
     /* Don't store:
      *  - the content of the FIFO
      *  - tsr_retry
@@ -943,18 +955,26 @@ static DECLCALLBACK(int) serialSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
  */
 static DECLCALLBACK(int) serialLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
 {
-    PDEVSERIAL pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL);
+    PDEVSERIAL  pThis = PDMINS_2_DATA(pDevIns, PDEVSERIAL);
+    int32_t     iIrq;
+    uint32_t    IOBase;
+
+    AssertMsgReturn(uVersion >= SERIAL_SAVED_STATE_VERSION_16450, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
 
-    if (uVersion == SERIAL_SAVED_STATE_VERSION_16450)
+    if (uPass != SSM_PASS_FINAL)
     {
-        pThis->f16550AEnabled = false;
-        LogRel(("Serial#%d: falling back to 16450 mode from load state\n", pDevIns->iInstance));
+        SSMR3GetS32(pSSM, &iIrq);
+        int rc = SSMR3GetU32(pSSM, &IOBase);
+        AssertRCReturn(rc, rc);
     }
     else
-        AssertMsgReturn(uVersion == SERIAL_SAVED_STATE_VERSION, ("%d\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
-
-    if (uPass == SSM_PASS_FINAL)
     {
+        if (uVersion == SERIAL_SAVED_STATE_VERSION_16450)
+        {
+            pThis->f16550AEnabled = false;
+            LogRel(("Serial#%d: falling back to 16450 mode from load state\n", pDevIns->iInstance));
+        }
+
         SSMR3GetU16(pSSM, &pThis->divider);
         SSMR3GetU8(pSSM, &pThis->rbr);
         SSMR3GetU8(pSSM, &pThis->ier);
@@ -964,34 +984,28 @@ static DECLCALLBACK(int) serialLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uin
         SSMR3GetU8(pSSM, &pThis->msr);
         SSMR3GetU8(pSSM, &pThis->scr);
         if (uVersion > SERIAL_SAVED_STATE_VERSION_16450)
-        {
             SSMR3GetU8(pSSM, &pThis->fcr);
-        }
         SSMR3GetS32(pSSM, &pThis->thr_ipending);
-    }
-
-    int32_t  iIrq;
-    SSMR3GetS32(pSSM, &iIrq);
-
-    if (uPass == SSM_PASS_FINAL)
+        SSMR3GetS32(pSSM, &iIrq);
         SSMR3GetS32(pSSM, &pThis->last_break_enable);
-
-    uint32_t IOBase;
-    int rc = SSMR3GetU32(pSSM, &IOBase);
-    AssertRCReturn(rc, rc);
-
-    if (    pThis->irq  != iIrq
-        ||  pThis->base != IOBase)
-        return SSMR3SetCfgError(pSSM, RT_SRC_POS,
-                                N_("Config mismatch - saved irq=%#x iobase=%#x; configured irq=%#x iobase=%#x"),
-                                iIrq, IOBase, pThis->irq, pThis->base);
-
-    if (uPass == SSM_PASS_FINAL)
-    {
+        SSMR3GetU32(pSSM, &IOBase);
         SSMR3GetBool(pSSM, &pThis->msr_changed);
 
+        if (uVersion > SERIAL_SAVED_STATE_VERSION_MISSING_BITS)
+        {
+            SSMR3GetU8(pSSM, &pThis->thr);
+            SSMR3GetU8(pSSM, &pThis->tsr);
+            SSMR3GetU8(pSSM, &pThis->iir);
+            SSMR3GetS32(pSSM, &pThis->timeout_ipending);
+            TMR3TimerLoad(pThis->fifo_timeout_timer, pSSM);
+            TMR3TimerLoad(pThis->transmit_timerR3, pSSM);
+            SSMR3GetU8(pSSM, &pThis->recv_fifo.itl);
+            SSMR3GetU8(pSSM, &pThis->xmit_fifo.itl);
+        }
+
+        /* the marker. */
         uint32_t u32;
-        rc = SSMR3GetU32(pSSM, &u32);
+        int rc = SSMR3GetU32(pSSM, &u32);
         if (RT_FAILURE(rc))
             return rc;
         AssertMsgReturn(u32 == ~0U, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
@@ -1010,6 +1024,15 @@ static DECLCALLBACK(int) serialLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uin
         pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     }
 
+    /*
+     * Check the config.
+     */
+    if (    pThis->irq  != iIrq
+        ||  pThis->base != IOBase)
+        return SSMR3SetCfgError(pSSM, RT_SRC_POS,
+                                N_("Config mismatch - saved irq=%#x iobase=%#x; configured irq=%#x iobase=%#x"),
+                                iIrq, IOBase, pThis->irq, pThis->base);
+
     return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/Devices/Serial/DrvTCP.cpp b/src/VBox/Devices/Serial/DrvTCP.cpp
new file mode 100644
index 0000000..ac7a254
--- /dev/null
+++ b/src/VBox/Devices/Serial/DrvTCP.cpp
@@ -0,0 +1,492 @@
+/* $Id: DrvTCP.cpp $ */
+/** @file
+ * TCP socket driver implementing the IStream interface.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation.
+ *
+ * This file was contributed by Alexey Eromenko (derived from DrvNamedPipe)
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_DRV_TCP
+#include <VBox/vmm/pdmdrv.h>
+#include <iprt/assert.h>
+#include <iprt/file.h>
+#include <iprt/stream.h>
+#include <iprt/alloc.h>
+#include <iprt/string.h>
+#include <iprt/semaphore.h>
+#include <iprt/uuid.h>
+#include <stdlib.h>
+
+#include "VBoxDD.h"
+
+#ifdef RT_OS_WINDOWS
+# include <ws2tcpip.h>
+#else /* !RT_OS_WINDOWS */
+# include <errno.h>
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <netdb.h>
+# ifndef SHUT_RDWR /* OS/2 */
+#  define SHUT_RDWR 3
+# endif
+#endif /* !RT_OS_WINDOWS */
+
+#ifndef SHUT_RDWR
+# ifdef SD_BOTH
+#  define SHUT_RDWR SD_BOTH
+# else
+#  define SHUT_RDWR 2
+# endif
+#endif
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** Converts a pointer to DRVTCP::IMedia to a PDRVTCP. */
+#define PDMISTREAM_2_DRVTCP(pInterface) ( (PDRVTCP)((uintptr_t)pInterface - RT_OFFSETOF(DRVTCP, IStream)) )
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * TCP driver instance data.
+ *
+ * @implements PDMISTREAM
+ */
+typedef struct DRVTCP
+{
+    /** The stream interface. */
+    PDMISTREAM          IStream;
+    /** Pointer to the driver instance. */
+    PPDMDRVINS          pDrvIns;
+    /** Pointer to the TCP server address:port or port only. (Freed by MM) */
+    char                *pszLocation;
+    /** Flag whether VirtualBox represents the server or client side. */
+    bool                fIsServer;
+
+    /** Socket handle of the TCP socket for server. */
+    int                 TCPServer;
+    /** Socket handle of the TCP socket connection. */
+    int                 TCPConnection;
+
+    /** Thread for listening for new connections. */
+    RTTHREAD            ListenThread;
+    /** Flag to signal listening thread to shut down. */
+    bool volatile       fShutdown;
+} DRVTCP, *PDRVTCP;
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+
+
+/** @copydoc PDMISTREAM::pfnRead */
+static DECLCALLBACK(int) drvTCPRead(PPDMISTREAM pInterface, void *pvBuf, size_t *pcbRead)
+{
+    int rc = VINF_SUCCESS;
+    PDRVTCP pThis = PDMISTREAM_2_DRVTCP(pInterface);
+    LogFlow(("%s: pvBuf=%p *pcbRead=%#x (%s)\n", __FUNCTION__, pvBuf, *pcbRead, pThis->pszLocation));
+
+    Assert(pvBuf);
+
+    if (pThis->TCPConnection != -1)
+    {
+        ssize_t cbReallyRead;
+        unsigned cbBuf = (unsigned)*pcbRead;
+        cbReallyRead = recv(pThis->TCPConnection, (char *)pvBuf, cbBuf, 0);
+        if (cbReallyRead == 0)
+        {
+            int tmp = pThis->TCPConnection;
+            pThis->TCPConnection = -1;
+#ifdef RT_OS_WINDOWS
+            closesocket(tmp);
+#else
+            close(tmp);
+#endif
+        }
+        else if (cbReallyRead == -1)
+        {
+            cbReallyRead = 0;
+            rc = RTErrConvertFromErrno(errno);
+        }
+        *pcbRead = cbReallyRead;
+    }
+    else
+    {
+        RTThreadSleep(100);
+        *pcbRead = 0;
+    }
+
+    LogFlow(("%s: *pcbRead=%zu returns %Rrc\n", __FUNCTION__, *pcbRead, rc));
+    return rc;
+}
+
+
+/** @copydoc PDMISTREAM::pfnWrite */
+static DECLCALLBACK(int) drvTCPWrite(PPDMISTREAM pInterface, const void *pvBuf, size_t *pcbWrite)
+{
+    int rc = VINF_SUCCESS;
+    PDRVTCP pThis = PDMISTREAM_2_DRVTCP(pInterface);
+    LogFlow(("%s: pvBuf=%p *pcbWrite=%#x (%s)\n", __FUNCTION__, pvBuf, *pcbWrite, pThis->pszLocation));
+
+    Assert(pvBuf);
+    if (pThis->TCPConnection != -1)
+    {
+        ssize_t cbWritten;
+        unsigned cbBuf = (unsigned)*pcbWrite;
+        cbWritten = send(pThis->TCPConnection, (const char *)pvBuf, cbBuf, 0);
+        if (cbWritten == 0)
+        {
+            int tmp = pThis->TCPConnection;
+            pThis->TCPConnection = -1;
+#ifdef RT_OS_WINDOWS
+            closesocket(tmp);
+#else
+            close(tmp);
+#endif
+        }
+        else if (cbWritten == -1)
+        {
+            cbWritten = 0;
+            rc = RTErrConvertFromErrno(errno);
+        }
+        *pcbWrite = cbWritten;
+    }
+
+    LogFlow(("%s: returns %Rrc\n", __FUNCTION__, rc));
+    return rc;
+}
+
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) drvTCPQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVTCP         pThis   = PDMINS_2_DATA(pDrvIns, PDRVTCP);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMISTREAM, &pThis->IStream);
+    return NULL;
+}
+
+
+/* -=-=-=-=- listen thread -=-=-=-=- */
+
+/**
+ * Receive thread loop.
+ *
+ * @returns 0 on success.
+ * @param   ThreadSelf  Thread handle to this thread.
+ * @param   pvUser      User argument.
+ */
+static DECLCALLBACK(int) drvTCPListenLoop(RTTHREAD ThreadSelf, void *pvUser)
+{
+    PDRVTCP pThis = (PDRVTCP)pvUser;
+    int     rc = VINF_SUCCESS;
+
+    while (RT_LIKELY(!pThis->fShutdown))
+    {
+        if (listen(pThis->TCPServer, 0) == -1)
+        {
+            rc = RTErrConvertFromErrno(errno);
+            LogRel(("DrvTCP%d: listen failed, rc=%Rrc\n", pThis->pDrvIns->iInstance, rc));
+            break;
+        }
+        int s = accept(pThis->TCPServer, NULL, NULL);
+        if (s == -1)
+        {
+            rc = RTErrConvertFromErrno(errno);
+            LogRel(("DrvTCP%d: accept failed, rc=%Rrc\n", pThis->pDrvIns->iInstance, rc));
+            break;
+        }
+        if (pThis->TCPConnection != -1)
+        {
+            LogRel(("DrvTCP%d: only single connection supported\n", pThis->pDrvIns->iInstance));
+#ifdef RT_OS_WINDOWS
+            closesocket(s);
+#else
+            close(s);
+#endif
+        }
+        else
+            pThis->TCPConnection = s;
+    }
+
+    return VINF_SUCCESS;
+}
+
+/* -=-=-=-=- PDMDRVREG -=-=-=-=- */
+
+/**
+ * Common worker for drvTCPPowerOff and drvTCPDestructor.
+ *
+ * @param   pThis               The instance data.
+ */
+static void drvTCPShutdownListener(PDRVTCP pThis)
+{
+    /*
+     * Signal shutdown of the listener thread.
+     */
+    pThis->fShutdown = true;
+    if (    pThis->fIsServer
+        &&  pThis->TCPServer != -1)
+    {
+        int rc = shutdown(pThis->TCPServer, SHUT_RDWR);
+        AssertRC(rc == 0); NOREF(rc);
+
+#ifdef RT_OS_WINDOWS
+        rc = closesocket(pThis->TCPServer);
+#else
+        rc = close(pThis->TCPServer);
+#endif
+        AssertRC(rc == 0);
+        pThis->TCPServer = -1;
+    }
+}
+
+
+/**
+ * Power off a TCP socket stream driver instance.
+ *
+ * This does most of the destruction work, to avoid ordering dependencies.
+ *
+ * @param   pDrvIns     The driver instance data.
+ */
+static DECLCALLBACK(void) drvTCPPowerOff(PPDMDRVINS pDrvIns)
+{
+    PDRVTCP pThis = PDMINS_2_DATA(pDrvIns, PDRVTCP);
+    LogFlow(("%s: %s\n", __FUNCTION__, pThis->pszLocation));
+
+    drvTCPShutdownListener(pThis);
+}
+
+
+/**
+ * Destruct a TCP socket stream driver instance.
+ *
+ * Most VM resources are freed by the VM. This callback is provided so that
+ * any non-VM resources can be freed correctly.
+ *
+ * @param   pDrvIns     The driver instance data.
+ */
+static DECLCALLBACK(void) drvTCPDestruct(PPDMDRVINS pDrvIns)
+{
+    PDRVTCP pThis = PDMINS_2_DATA(pDrvIns, PDRVTCP);
+    LogFlow(("%s: %s\n", __FUNCTION__, pThis->pszLocation));
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
+
+    drvTCPShutdownListener(pThis);
+
+    /*
+     * While the thread exits, clean up as much as we can.
+     */
+
+    Assert(pThis->TCPServer == -1);
+    if (pThis->TCPConnection != -1)
+    {
+        int rc = shutdown(pThis->TCPConnection, SHUT_RDWR);
+        AssertRC(rc == 0); NOREF(rc);
+
+#ifdef RT_OS_WINDOWS
+        rc = closesocket(pThis->TCPConnection);
+#else
+        rc = close(pThis->TCPConnection);
+#endif
+        Assert(rc == 0);
+        pThis->TCPConnection = -1;
+    }
+    if (   pThis->fIsServer
+        && pThis->pszLocation)
+        RTFileDelete(pThis->pszLocation);
+
+
+    MMR3HeapFree(pThis->pszLocation);
+    pThis->pszLocation = NULL;
+
+    /*
+     * Wait for the thread.
+     */
+    if (pThis->ListenThread != NIL_RTTHREAD)
+    {
+        int rc = RTThreadWait(pThis->ListenThread, 30000, NULL);
+        if (RT_SUCCESS(rc))
+            pThis->ListenThread = NIL_RTTHREAD;
+        else
+            LogRel(("DrvTCP%d: listen thread did not terminate (%Rrc)\n", pDrvIns->iInstance, rc));
+    }
+
+}
+
+
+/**
+ * Construct a TCP socket stream driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+static DECLCALLBACK(int) drvTCPConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    PDRVTCP pThis = PDMINS_2_DATA(pDrvIns, PDRVTCP);
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                      = pDrvIns;
+    pThis->pszLocation                  = NULL;
+    pThis->fIsServer                    = false;
+
+    pThis->TCPServer                    = -1;
+    pThis->TCPConnection                = -1;
+
+    pThis->ListenThread                 = NIL_RTTHREAD;
+    pThis->fShutdown                    = false;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface    = drvTCPQueryInterface;
+    /* IStream */
+    pThis->IStream.pfnRead              = drvTCPRead;
+    pThis->IStream.pfnWrite             = drvTCPWrite;
+
+    /*
+     * Validate and read the configuration.
+     */
+    PDMDRV_VALIDATE_CONFIG_RETURN(pDrvIns, "Location|IsServer", "");
+
+    int rc = CFGMR3QueryStringAlloc(pCfg, "Location", &pThis->pszLocation);
+    if (RT_FAILURE(rc))
+        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
+                                   N_("Configuration error: querying \"Location\" resulted in %Rrc"), rc);
+    rc = CFGMR3QueryBool(pCfg, "IsServer", &pThis->fIsServer);
+    if (RT_FAILURE(rc))
+        return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
+                                   N_("Configuration error: querying \"IsServer\" resulted in %Rrc"), rc);
+
+    /*
+     * Create/Open the socket.
+     */
+    int s = socket(PF_INET, SOCK_STREAM, 0);
+    if (s == -1)
+        return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
+                                   N_("DrvTCP#%d failed to create socket"), pDrvIns->iInstance);
+
+    struct sockaddr_in addr;
+    memset(&addr, 0, sizeof(addr));
+    addr.sin_family = AF_INET;
+
+    if (pThis->fIsServer)
+    {
+        addr.sin_addr.s_addr = INADDR_ANY;
+        addr.sin_port = htons(/*PORT*/ atoi(pThis->pszLocation));
+
+        /* Bind address to the telnet socket. */
+        pThis->TCPServer = s;
+        RTFileDelete(pThis->pszLocation);
+        if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) == -1)
+            return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
+                                       N_("DrvTCP#%d failed to bind to socket %s"),
+                                       pDrvIns->iInstance, pThis->pszLocation);
+        rc = RTThreadCreate(&pThis->ListenThread, drvTCPListenLoop, (void *)pThis, 0,
+                            RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "DrvTCPStream");
+        if (RT_FAILURE(rc))
+            return PDMDrvHlpVMSetError(pDrvIns, rc,  RT_SRC_POS,
+                                       N_("DrvTCP#%d failed to create listening thread"), pDrvIns->iInstance);
+    }
+    else
+    {
+        char *token;
+        const char *delim = ":";
+        struct hostent *server;
+        token = strtok(pThis->pszLocation, delim);
+        if(token) {
+            server = gethostbyname(token);
+            memmove((char *)&addr.sin_addr.s_addr,
+                    (char *)server->h_addr,
+                     server->h_length);
+        }
+        token = strtok(NULL, delim);
+        if(token) {
+            addr.sin_port = htons(/*PORT*/ atoi(token));
+        }
+
+        /* Connect to the telnet socket. */
+        pThis->TCPConnection = s;
+        if (connect(s, (struct sockaddr *)&addr, sizeof(addr)) == -1)
+            return PDMDrvHlpVMSetError(pDrvIns, RTErrConvertFromErrno(errno), RT_SRC_POS,
+                                       N_("DrvTCP#%d failed to connect to socket %s"),
+                                       pDrvIns->iInstance, pThis->pszLocation);
+    }
+
+    LogRel(("DrvTCP: %s, %s\n", pThis->pszLocation, pThis->fIsServer ? "server" : "client"));
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * TCP stream driver registration record.
+ */
+const PDMDRVREG g_DrvTCP =
+{
+    /* u32Version */
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "TCP",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "TCP serial stream driver.",
+    /* fFlags */
+    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_STREAM,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVTCP),
+    /* pfnConstruct */
+    drvTCPConstruct,
+    /* pfnDestruct */
+    drvTCPDestruct,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    drvTCPPowerOff,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
+
diff --git a/src/VBox/Devices/Storage/DevAHCI.cpp b/src/VBox/Devices/Storage/DevAHCI.cpp
index b5180d7..06efa68 100644
--- a/src/VBox/Devices/Storage/DevAHCI.cpp
+++ b/src/VBox/Devices/Storage/DevAHCI.cpp
@@ -46,6 +46,7 @@
 #include <iprt/assert.h>
 #include <iprt/asm.h>
 #include <iprt/string.h>
+#include <iprt/list.h>
 #ifdef IN_RING3
 # include <iprt/param.h>
 # include <iprt/thread.h>
@@ -80,7 +81,7 @@
 
 #define AHCI_MAX_ALLOC_TOO_MUCH 20
 
- /** The current saved state version. */
+/** The current saved state version. */
 #define AHCI_SAVED_STATE_VERSION                        8
 /** The saved state version before changing the port reset logic in an incompatible way. */
 #define AHCI_SAVED_STATE_VERSION_PRE_PORT_RESET_CHANGES 7
@@ -275,22 +276,27 @@ typedef enum AHCITXSTATE
     /** 32bit hack. */
     AHCITXSTATE_32BIT_HACK = 0x7fffffff
 } AHCITXSTATE, *PAHCITXSTATE;
+AssertCompileSize(AHCITXSTATE, sizeof(uint32_t));
 
 /** Task encountered a buffer overflow. */
-#define AHCI_REQ_OVERFLOW   RT_BIT_32(0)
+#define AHCI_REQ_OVERFLOW    RT_BIT_32(0)
 /** Request is a PIO data command, if this flag is not set it either is
  * a command which does not transfer data or a DMA command based on the transfer size. */
-#define AHCI_REQ_PIO_DATA   RT_BIT_32(1)
+#define AHCI_REQ_PIO_DATA    RT_BIT_32(1)
 /** The request has the SACT register set. */
-#define AHCI_REQ_CLEAR_SACT RT_BIT_32(2)
-/** FLag whether the request is queued. */
-#define AHCI_REQ_IS_QUEUED  RT_BIT_32(3)
+#define AHCI_REQ_CLEAR_SACT  RT_BIT_32(2)
+/** Flag whether the request is queued. */
+#define AHCI_REQ_IS_QUEUED   RT_BIT_32(3)
+/** Flag whether the request is stored on the stack. */
+#define AHCI_REQ_IS_ON_STACK RT_BIT_32(4)
 
 /**
  * A task state.
  */
 typedef struct AHCIREQ
 {
+    /** List node for the free list if the request is not in use. */
+    RTLISTNODE                 NodeList;
     /** Task state. */
     volatile AHCITXSTATE       enmTxState;
     /** Start timestamp of the request. */
@@ -420,16 +426,12 @@ typedef struct AHCIPort
     /** Command Issue. */
     uint32_t                        regCI;
 
-#if HC_ARCH_BITS == 64
-    uint32_t                        Alignment1;
-#endif
-
+    /** Current number of active tasks. */
+    volatile uint32_t               cTasksActive;
     /** Command List Base Address */
     volatile RTGCPHYS               GCPhysAddrClb;
     /** FIS Base Address */
     volatile RTGCPHYS               GCPhysAddrFb;
-    /** Current number of active tasks. */
-    volatile uint32_t               cTasksActive;
 
     /** Device is powered on. */
     bool                            fPoweredOn;
@@ -449,11 +451,15 @@ typedef struct AHCIPort
     bool                            fAsyncInterface;
     /** Flag if we are in a device reset. */
     bool                            fResetDevice;
+    /** Flag whether this port is hot plug capable. */
+    bool                            fHotpluggable;
     /** Flag whether the port is in redo task mode. */
     volatile bool                   fRedo;
     /** Flag whether the worker thread is sleeping. */
     volatile bool                   fWrkThreadSleeping;
 
+    bool                            afAlignment[3];
+
     /** Number of total sectors. */
     uint64_t                        cTotalSectors;
     /** Size of one sector. */
@@ -517,17 +523,12 @@ typedef struct AHCIPort
     /** The status LED state for this drive. */
     PDMLED                          Led;
 
-#if HC_ARCH_BITS == 64
     uint32_t                        u32Alignment3;
-#endif
 
     /** Async IO Thread. */
     R3PTRTYPE(PPDMTHREAD)           pAsyncIOThread;
-    /**
-     * Array of cached tasks. The tag number is the index value.
-     * Only used with the async interface.
-     */
-    R3PTRTYPE(PAHCIREQ)             aCachedTasks[AHCI_NR_COMMAND_SLOTS];
+    /** Array of active tasks indexed by the tag. */
+    R3PTRTYPE(volatile PAHCIREQ)    aActiveTasks[AHCI_NR_COMMAND_SLOTS];
     /** First task throwing an error. */
     R3PTRTYPE(volatile PAHCIREQ)    pTaskErr;
     /** The current tracklist of the loaded medium if passthrough is used. */
@@ -567,6 +568,12 @@ typedef struct AHCIPort
     uint32_t                        cErrors;
 
     uint32_t                        u32Alignment5;
+
+    /** Critical section protecting the global free list. */
+    RTCRITSECT                      CritSectReqsFree;
+    /** Head of the global free request list. */
+    R3PTRTYPE(PRTLISTANCHOR)        pListReqsFree;
+
 } AHCIPort;
 /** Pointer to the state of an AHCI port. */
 typedef AHCIPort *PAHCIPort;
@@ -705,8 +712,6 @@ typedef struct AHCI
 
     /** Flag whether we have written the first 4bytes in an 8byte MMIO write successfully. */
     volatile bool                   f8ByteMMIO4BytesWrittenSuccessfully;
-    /** Flag whether whether hotplugging is enabled for the controller. */
-    bool                            fPortsHotpluggable;
 
 #if HC_ARCH_BITS == 64
     uint32_t                        Alignment7;
@@ -946,6 +951,7 @@ static size_t ahciCopyFromPrdtl(PPDMDEVINS pDevIns, PAHCIREQ pAhciReq,
                                 void *pvBuf, size_t cbBuf);
 static bool ahciCancelActiveTasks(PAHCIPort pAhciPort, PAHCIREQ pAhciReqExcept);
 static void ahciReqMemFree(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, bool fForceFree);
+static void ahciR3PortCachedReqsFree(PAHCIPort pAhciPort);
 #endif
 RT_C_DECLS_END
 
@@ -2023,7 +2029,8 @@ static void ahciPortSwReset(PAHCIPort pAhciPort)
                          AHCI_PORT_CMD_SUD  | /* Device has spun up. */
                          AHCI_PORT_CMD_POD;   /* Port is powered on. */
 
-    if (pAhciPort->CTX_SUFF(pAhci)->fPortsHotpluggable)
+    /* Hotplugging supported?. */
+    if (pAhciPort->fHotpluggable)
         pAhciPort->regCMD |= AHCI_PORT_CMD_HPCP;
 
     pAhciPort->regTFD  = (1 << 8) | ATA_STAT_SEEK | ATA_STAT_WRERR;
@@ -4250,6 +4257,7 @@ static int atapiReadDVDStructureSS(PAHCIREQ pAhciReq, PAHCIPort pAhciPort, size_
 
                         /* 4 byte header + 4 byte data */
                         uASC = (4 + 4);
+                        break;
 
                     case 0x03: /* BCA information - invalid field for no BCA info */
                         uASC = -SCSI_ASC_INV_FIELD_IN_CMD_PACKET;
@@ -4643,11 +4651,7 @@ static AHCITXDIR atapiParseCmdVirtualATAPI(PAHCIPort pAhciPort, PAHCIREQ pAhciRe
                      * because the driver providing I/O memory allocation interface
                      * is about to be destroyed.
                      */
-                    for (uint32_t i = 0; i < AHCI_NR_COMMAND_SLOTS; i++)
-                    {
-                        if (pAhciPort->aCachedTasks[i])
-                            ahciReqMemFree(pAhciPort, pAhciPort->aCachedTasks[i], true /* fForceFree */);
-                    }
+                    ahciR3PortCachedReqsFree(pAhciPort);
 
                     rc = VMR3ReqPriorityCallWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY,
                                                  (PFNRT)pAhciPort->pDrvMount->pfnUnmount, 3,
@@ -5677,14 +5681,19 @@ static void ahciIoBufFree(PAHCIPort pAhciPort, PAHCIREQ pAhciReq,
  */
 static void ahciR3PortCachedReqsFree(PAHCIPort pAhciPort)
 {
-    for (uint32_t i = 0; i < AHCI_NR_COMMAND_SLOTS; i++)
+    if (pAhciPort->pListReqsFree)
     {
-        if (pAhciPort->aCachedTasks[i])
+        PAHCIREQ pReq = NULL;
+        PAHCIREQ pReqNext = NULL;
+
+        RTCritSectEnter(&pAhciPort->CritSectReqsFree);
+        RTListForEachSafe(pAhciPort->pListReqsFree, pReq, pReqNext, AHCIREQ, NodeList)
         {
-            ahciReqMemFree(pAhciPort, pAhciPort->aCachedTasks[i], true /* fForceFree */);
-            RTMemFree(pAhciPort->aCachedTasks[i]);
-            pAhciPort->aCachedTasks[i] = NULL;
+            RTListNodeRemove(&pReq->NodeList);
+            ahciReqMemFree(pAhciPort, pReq, true /* fForceFree */);
+            RTMemFree(pReq);
         }
+        RTCritSectLeave(&pAhciPort->CritSectReqsFree);
     }
 }
 
@@ -5698,16 +5707,14 @@ static void ahciR3PortCachedReqsFree(PAHCIPort pAhciPort)
  */
 static bool ahciCancelActiveTasks(PAHCIPort pAhciPort, PAHCIREQ pAhciReqExcept)
 {
-    for (unsigned i = 0; i < RT_ELEMENTS(pAhciPort->aCachedTasks); i++)
+    for (unsigned i = 0; i < RT_ELEMENTS(pAhciPort->aActiveTasks); i++)
     {
-        PAHCIREQ pAhciReq = pAhciPort->aCachedTasks[i];
+        PAHCIREQ pAhciReq = (PAHCIREQ)ASMAtomicXchgPtr((void * volatile *)&pAhciPort->aActiveTasks[i], NULL);
 
         if (   VALID_PTR(pAhciReq)
             && pAhciReq != pAhciReqExcept)
         {
-            bool fXchg = false;
-            ASMAtomicCmpXchgSize(&pAhciReq->enmTxState, AHCITXSTATE_CANCELED, AHCITXSTATE_ACTIVE, fXchg);
-
+            bool fXchg = ASMAtomicCmpXchgU32((volatile uint32_t *)&pAhciReq->enmTxState, AHCITXSTATE_CANCELED, AHCITXSTATE_ACTIVE);
             if (fXchg)
             {
                 /* Task is active and was canceled. */
@@ -5719,7 +5726,7 @@ static bool ahciCancelActiveTasks(PAHCIPort pAhciPort, PAHCIREQ pAhciReqExcept)
                  * Clear the pointer in the cached array. The controller will allocate a
                  * a new task structure for this tag.
                  */
-                ASMAtomicWriteNullPtr(&pAhciPort->aCachedTasks[i]);
+                ASMAtomicWriteNullPtr(&pAhciPort->aActiveTasks[i]);
                 LogRel(("AHCI#%uP%u: Cancelled task %u\n", pAhciPort->CTX_SUFF(pDevIns)->iInstance,
                         pAhciPort->iLUN, pAhciReq->uTag));
             }
@@ -5933,6 +5940,45 @@ static void ahciTrimRangesDestroy(PAHCIREQ pAhciReq)
 }
 
 /**
+ * Allocates a new AHCI request.
+ *
+ * @returns A new AHCI request structure or NULL if out of memory.
+ * @param   pAhciPort    The AHCI port.
+ */
+static PAHCIREQ ahciR3ReqAlloc(PAHCIPort pAhciPort)
+{
+    PAHCIREQ pAhciReq = NULL;
+
+    /* Check the global free list first. */
+    RTCritSectEnter(&pAhciPort->CritSectReqsFree);
+    pAhciReq = RTListGetFirst(pAhciPort->pListReqsFree, AHCIREQ, NodeList);
+    if (pAhciReq)
+        RTListNodeRemove(&pAhciReq->NodeList);
+    RTCritSectLeave(&pAhciPort->CritSectReqsFree);
+
+    if (!pAhciReq)
+        pAhciReq = (PAHCIREQ)RTMemAllocZ(sizeof(AHCIREQ));
+
+    pAhciReq->enmTxState = AHCITXSTATE_ACTIVE;
+    return pAhciReq;
+}
+
+/**
+ * Frees a given AHCI request structure.
+ *
+ * @returns nothing.
+ * @param   pAhciPort    The AHCI port.
+ */
+static void ahciR3ReqFree(PAHCIPort pAhciPort, PAHCIREQ pAhciReq)
+{
+    pAhciReq->enmTxState = AHCITXSTATE_FREE;
+
+    RTCritSectEnter(&pAhciPort->CritSectReqsFree);
+    RTListAppend(pAhciPort->pListReqsFree, &pAhciReq->NodeList);
+    RTCritSectLeave(&pAhciPort->CritSectReqsFree);
+}
+
+/**
  * Complete a data transfer task by freeing all occupied resources
  * and notifying the guest.
  *
@@ -5941,24 +5987,38 @@ static void ahciTrimRangesDestroy(PAHCIREQ pAhciReq)
  * @param pAhciPort    Pointer to the port where to request completed.
  * @param pAhciReq     Pointer to the task which finished.
  * @param rcReq        IPRT status code of the completed request.
- * @param fFreeReq     Flag whether to free the request if it was canceled.
  */
-static bool ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcReq, bool fFreeReq)
+static bool ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcReq)
 {
-    bool fXchg = false;
     bool fRedo = false;
     bool fCanceled = false;
     uint64_t tsNow = RTTimeMilliTS();
     AHCITXSTATE enmTxState = AHCITXSTATE_INVALID;
 
-    LogFlowFunc(("pAhciPort=%p pAhciReq=%p rcReq=%d fFreeReq=%RTbool\n",
-                 pAhciPort, pAhciReq, rcReq, fFreeReq));
+    LogFlowFunc(("pAhciPort=%p pAhciReq=%p rcReq=%d\n",
+                 pAhciPort, pAhciReq, rcReq));
 
-    ASMAtomicReadSize(&pAhciReq->enmTxState, &enmTxState);
+    enmTxState = (AHCITXSTATE)ASMAtomicReadU32((volatile uint32_t *)&pAhciReq->enmTxState);
     VBOXDD_AHCI_REQ_COMPLETED(pAhciReq, rcReq, enmTxState, pAhciReq->uOffset, pAhciReq->cbTransfer);
     VBOXDD_AHCI_REQ_COMPLETED_TIMESTAMP(pAhciReq, tsNow);
 
     /*
+     * Clear the request structure from the active request list first so it doesn't get cancelled
+     * while we complete it. If the request is not in the active list anymore it was already canceled
+     * and we have to make sure to not copy anything to guest memory because the guest might use it
+     * for other things already.
+     */
+    bool fPortReset = ASMAtomicReadBool(&pAhciPort->fPortReset);
+    bool fXchg = ASMAtomicCmpXchgPtr(&pAhciPort->aActiveTasks[pAhciReq->uTag], NULL, pAhciReq);
+
+    if (fXchg)
+    {
+        AssertReleaseMsg(ASMAtomicReadU32(&pAhciPort->cTasksActive) > 0,
+                         ("Inconsistent request counter\n"));
+        ASMAtomicDecU32(&pAhciPort->cTasksActive);
+    }
+
+    /*
      * Leave a release log entry if the request was active for more than 25 seconds
      * (30 seconds is the timeout of the guest).
      */
@@ -5988,9 +6048,6 @@ static bool ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcR
                 pAhciPort->CTX_SUFF(pDevIns)->iInstance, pAhciPort->iLUN, pcszReq, (tsNow - pAhciReq->tsStart) / 1000));
     }
 
-    bool fPortReset = ASMAtomicReadBool(&pAhciPort->fPortReset);
-    ASMAtomicCmpXchgSize(&pAhciReq->enmTxState, AHCITXSTATE_FREE, AHCITXSTATE_ACTIVE, fXchg);
-
     if (fXchg && !fPortReset)
     {
         if (pAhciReq->enmTxDir == AHCITXDIR_READ)
@@ -6047,7 +6104,7 @@ static bool ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcR
         {
             pAhciReq->cmdHdr.u32PRDBC = pAhciReq->cbTransfer;
 
-            /* Status will be set by already for non I/O requests. */
+            /* Status will be set already for non I/O requests. */
             if (pAhciReq->enmTxDir != AHCITXDIR_NONE)
             {
                 pAhciReq->uATARegError = 0;
@@ -6070,10 +6127,6 @@ static bool ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcR
             }
         }
 
-        AssertReleaseMsg(ASMAtomicReadU32(&pAhciPort->cTasksActive) > 0 ,
-                         ("Inconsistent request counter\n"));
-        ASMAtomicDecU32(&pAhciPort->cTasksActive);
-
         if (!fRedo)
         {
 
@@ -6109,20 +6162,7 @@ static bool ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcR
         AssertMsg(pAhciReq->enmTxState == AHCITXSTATE_CANCELED || fPortReset,
                   ("Task is not active but wasn't canceled and no port reset is active!\n"));
 
-        /*
-         * If this handler switched the request state from active to free the request counter
-         * must be decremented.
-         */
-        if (fXchg)
-        {
-            Assert(fPortReset);
-            AssertReleaseMsg(ASMAtomicReadU32(&pAhciPort->cTasksActive) > 0 ,
-                             ("Inconsistent request counter\n"));
-            ASMAtomicDecU32(&pAhciPort->cTasksActive);
-        }
-
         fCanceled = true;
-        ASMAtomicXchgSize(&pAhciReq->enmTxState, AHCITXSTATE_FREE);
 
         if (pAhciReq->enmTxDir == AHCITXDIR_TRIM)
             ahciTrimRangesDestroy(pAhciReq);
@@ -6147,15 +6187,13 @@ static bool ahciTransferComplete(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, int rcR
                         pAhciReq->uOffset,
                         pAhciReq->cbTransfer, rcReq));
          }
-
-        /* Finally free the task state structure because it is completely unused now. */
-        if (fFreeReq)
-            RTMemFree(pAhciReq);
     }
 
     if (pAhciPort->cTasksActive == 0 && pAhciPort->pAhciR3->fSignalIdle)
         PDMDevHlpAsyncNotificationCompleted(pAhciPort->pDevInsR3);
 
+    if (pAhciReq && !(pAhciReq->fFlags & AHCI_REQ_IS_ON_STACK))
+        ahciR3ReqFree(pAhciPort, pAhciReq);
     return fCanceled;
 }
 
@@ -6175,7 +6213,7 @@ static DECLCALLBACK(int) ahciR3TransferCompleteNotify(PPDMIBLOCKASYNCPORT pInter
     ahciLog(("%s: pInterface=%p pvUser=%p uTag=%u\n",
              __FUNCTION__, pInterface, pvUser, pAhciReq->uTag));
 
-    ahciTransferComplete(pAhciPort, pAhciReq, rcReq, true);
+    ahciTransferComplete(pAhciPort, pAhciReq, rcReq);
 
     return VINF_SUCCESS;
 }
@@ -6477,7 +6515,7 @@ static AHCITXDIR ahciProcessCmd(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, uint8_t
             pAhciReq->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR;
             break;
         default: /* For debugging purposes. */
-            AssertMsgFailed(("Unknown command issued\n"));
+            AssertMsgFailed(("Unknown command issued (%#x)\n", pCmdFis[AHCI_CMDFIS_CMD]));
             pAhciReq->uATARegError = ABRT_ERR;
             pAhciReq->uATARegStatus = ATA_STAT_READY | ATA_STAT_ERR;
     }
@@ -6578,6 +6616,164 @@ static bool ahciPortTaskGetCommandFis(PAHCIPort pAhciPort, PAHCIREQ pAhciReq)
 }
 
 /**
+ * Submits a given request for execution.
+ *
+ * @returns Flag whether the request was canceled inbetween.
+ * @param   pAhciPort    The port the request is for.
+ * @param   pAhciReq     The request to submit.
+ * @param   enmTxDir     The request type.
+ */
+static bool ahciR3ReqSubmit(PAHCIPort pAhciPort, PAHCIREQ pAhciReq, AHCITXDIR enmTxDir)
+{
+    int rc = VINF_SUCCESS;
+    bool fReqCanceled = false;
+
+    if (pAhciPort->fAsyncInterface)
+    {
+        VBOXDD_AHCI_REQ_SUBMIT(pAhciReq, pAhciReq->enmTxDir, pAhciReq->uOffset, pAhciReq->cbTransfer);
+        VBOXDD_AHCI_REQ_SUBMIT_TIMESTAMP(pAhciReq, pAhciReq->tsStart);
+        if (enmTxDir == AHCITXDIR_FLUSH)
+        {
+            rc = pAhciPort->pDrvBlockAsync->pfnStartFlush(pAhciPort->pDrvBlockAsync,
+                                                          pAhciReq);
+        }
+        else if (enmTxDir == AHCITXDIR_TRIM)
+        {
+            rc = ahciTrimRangesCreate(pAhciPort, pAhciReq);
+            if (RT_SUCCESS(rc))
+            {
+                pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
+                rc = pAhciPort->pDrvBlockAsync->pfnStartDiscard(pAhciPort->pDrvBlockAsync, pAhciReq->u.Trim.paRanges,
+                                                                pAhciReq->u.Trim.cRanges, pAhciReq);
+            }
+        }
+        else if (enmTxDir == AHCITXDIR_READ)
+        {
+            pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 1;
+            rc = pAhciPort->pDrvBlockAsync->pfnStartRead(pAhciPort->pDrvBlockAsync, pAhciReq->uOffset,
+                                                         &pAhciReq->u.Io.DataSeg, 1,
+                                                         pAhciReq->cbTransfer,
+                                                         pAhciReq);
+        }
+        else
+        {
+            pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
+            rc = pAhciPort->pDrvBlockAsync->pfnStartWrite(pAhciPort->pDrvBlockAsync, pAhciReq->uOffset,
+                                                          &pAhciReq->u.Io.DataSeg, 1,
+                                                          pAhciReq->cbTransfer,
+                                                          pAhciReq);
+        }
+        if (rc == VINF_VD_ASYNC_IO_FINISHED)
+            fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, VINF_SUCCESS);
+        else if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
+            fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, rc);
+    }
+    else
+    {
+        if (enmTxDir == AHCITXDIR_FLUSH)
+            rc = pAhciPort->pDrvBlock->pfnFlush(pAhciPort->pDrvBlock);
+        else if (enmTxDir == AHCITXDIR_TRIM)
+        {
+            rc = ahciTrimRangesCreate(pAhciPort, pAhciReq);
+            if (RT_SUCCESS(rc))
+            {
+                pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
+                rc = pAhciPort->pDrvBlock->pfnDiscard(pAhciPort->pDrvBlock, pAhciReq->u.Trim.paRanges,
+                                                      pAhciReq->u.Trim.cRanges);
+                pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 0;
+            }
+        }
+        else if (enmTxDir == AHCITXDIR_READ)
+        {
+            pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 1;
+            rc = pAhciPort->pDrvBlock->pfnRead(pAhciPort->pDrvBlock, pAhciReq->uOffset,
+                                               pAhciReq->u.Io.DataSeg.pvSeg,
+                                               pAhciReq->cbTransfer);
+            pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 0;
+        }
+        else
+        {
+            pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
+            rc = pAhciPort->pDrvBlock->pfnWrite(pAhciPort->pDrvBlock, pAhciReq->uOffset,
+                                                pAhciReq->u.Io.DataSeg.pvSeg,
+                                                pAhciReq->cbTransfer);
+            pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 0;
+        }
+        fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, rc);
+    }
+
+    return fReqCanceled;
+}
+
+/**
+ * Prepares the command for execution coping it from guest memory and doing a few
+ * validation checks on it.
+ *
+ * @returns Whether the command was successfully fetched from guest memory and
+ *          can be continued.
+ * @param   pAhciPort    The AHCI port the request is for.
+ * @param   pAhciReq     Request structure to copy the command to.
+ */
+static bool ahciR3CmdPrepare(PAHCIPort pAhciPort, PAHCIREQ pAhciReq)
+{
+    pAhciReq->tsStart       = RTTimeMilliTS();
+    pAhciReq->uATARegStatus = 0;
+    pAhciReq->uATARegError  = 0;
+
+    /* Set current command slot */
+    ASMAtomicWriteU32(&pAhciPort->u32CurrentCommandSlot, pAhciReq->uTag);
+    ASMAtomicWritePtr(&pAhciPort->aActiveTasks[pAhciReq->uTag], pAhciReq);
+
+    bool fContinue = ahciPortTaskGetCommandFis(pAhciPort, pAhciReq);
+    if (fContinue)
+    {
+        /* Mark the task as processed by the HBA if this is a queued task so that it doesn't occur in the CI register anymore. */
+        if (pAhciPort->regSACT & RT_BIT_32(pAhciReq->uTag))
+        {
+            pAhciReq->fFlags |= AHCI_REQ_CLEAR_SACT;
+            ASMAtomicOrU32(&pAhciPort->u32TasksFinished, RT_BIT_32(pAhciReq->uTag));
+        }
+
+        if (pAhciReq->cmdFis[AHCI_CMDFIS_BITS] & AHCI_CMDFIS_C)
+        {
+            AssertReleaseMsg(ASMAtomicReadU32(&pAhciPort->cTasksActive) < AHCI_NR_COMMAND_SLOTS,
+                             ("There are more than 32 requests active"));
+            ASMAtomicIncU32(&pAhciPort->cTasksActive);
+        }
+        else
+        {
+            /* If the reset bit is set put the device into reset state. */
+            if (pAhciReq->cmdFis[AHCI_CMDFIS_CTL] & AHCI_CMDFIS_CTL_SRST)
+            {
+                ahciLog(("%s: Setting device into reset state\n", __FUNCTION__));
+                pAhciPort->fResetDevice = true;
+                ahciSendD2HFis(pAhciPort, pAhciReq, pAhciReq->cmdFis, true);
+            }
+            else if (pAhciPort->fResetDevice) /* The bit is not set and we are in a reset state. */
+                ahciFinishStorageDeviceReset(pAhciPort, pAhciReq);
+            else /* We are not in a reset state update the control registers. */
+                AssertMsgFailed(("%s: Update the control register\n", __FUNCTION__));
+
+            fContinue = false;
+        }
+    }
+    else
+    {
+        /*
+         * Couldn't find anything in either the AHCI or SATA spec which
+         * indicates what should be done if the FIS is not read successfully.
+         * The closest thing is in the state machine, stating that the device
+         * should go into idle state again (SATA spec 1.0 chapter 8.7.1).
+         * Do the same here and ignore any corrupt FIS types, after all
+         * the guest messed up everything and this behavior is undefined.
+         */
+        fContinue = false;
+    }
+
+    return fContinue;
+}
+
+/**
  * Transmit queue consumer
  * Queue a new async task.
  *
@@ -6674,181 +6870,70 @@ static DECLCALLBACK(int) ahciAsyncIOLoop(PPDMDEVINS pDevIns, PPDMTHREAD pThread)
             idx--;
             ahciLog(("%s: Processing command at slot %d\n", __FUNCTION__, idx));
 
-            /*
-             * Check if there is already an allocated task struct in the cache.
-             * Allocate a new task otherwise.
-             */
-            if (!pAhciPort->aCachedTasks[idx])
-            {
-                pAhciReq = (PAHCIREQ)RTMemAllocZ(sizeof(AHCIREQ));
-                AssertMsg(pAhciReq, ("%s: Cannot allocate task state memory!\n"));
-                pAhciReq->enmTxState = AHCITXSTATE_FREE;
-                pAhciPort->aCachedTasks[idx] = pAhciReq;
-            }
-            else
-                pAhciReq = pAhciPort->aCachedTasks[idx];
-
-            bool fXchg;
-            ASMAtomicCmpXchgSize(&pAhciReq->enmTxState, AHCITXSTATE_ACTIVE, AHCITXSTATE_FREE, fXchg);
-            AssertMsg(fXchg, ("Task is already active\n"));
-
-            pAhciReq->tsStart = RTTimeMilliTS();
-            pAhciReq->uATARegStatus = 0;
-            pAhciReq->uATARegError  = 0;
-            pAhciReq->fFlags        = 0;
-
-            /* Set current command slot */
-            pAhciReq->uTag = idx;
-            ASMAtomicWriteU32(&pAhciPort->u32CurrentCommandSlot, pAhciReq->uTag);
-
-            bool fFisRead = ahciPortTaskGetCommandFis(pAhciPort, pAhciReq);
-            if (RT_UNLIKELY(!fFisRead))
+            /* Check whether the request is already active and ignore. */
+            if (ASMAtomicReadPtr((void * volatile *)&pAhciPort->aActiveTasks[idx]))
             {
-                /*
-                 * Couldn't find anything in either the AHCI or SATA spec which
-                 * indicates what should be done if the FIS is not read successfully.
-                 * The closest thing is in the state machine, stating that the device
-                 * should go into idle state again (SATA spec 1.0 chapter 8.7.1).
-                 * Do the same here and ignore any corrupt FIS types, after all
-                 * the guest messed up everything and this behavior is undefined.
-                 */
-                ASMAtomicCmpXchgSize(&pAhciReq->enmTxState, AHCITXSTATE_FREE, AHCITXSTATE_ACTIVE, fXchg);
-                Assert(fXchg);
-                u32Tasks &= ~RT_BIT_32(idx); /* Clear task bit. */
-                idx = ASMBitFirstSetU32(u32Tasks);
+                ahciLog(("%s: Ignoring command at slot %d because it is already active\n", __FUNCTION__, idx));
                 continue;
             }
 
-            /* Mark the task as processed by the HBA if this is a queued task so that it doesn't occur in the CI register anymore. */
-            if (pAhciPort->regSACT & (1 << idx))
+            pAhciReq = ahciR3ReqAlloc(pAhciPort);
+            if (RT_LIKELY(pAhciReq))
             {
-                pAhciReq->fFlags |= AHCI_REQ_CLEAR_SACT;
-                ASMAtomicOrU32(&pAhciPort->u32TasksFinished, (1 << pAhciReq->uTag));
-            }
+                pAhciReq->uTag          = idx;
+                pAhciReq->fFlags        = 0;
 
-            if (!(pAhciReq->cmdFis[AHCI_CMDFIS_BITS] & AHCI_CMDFIS_C))
-            {
-                /* If the reset bit is set put the device into reset state. */
-                if (pAhciReq->cmdFis[AHCI_CMDFIS_CTL] & AHCI_CMDFIS_CTL_SRST)
+                bool fContinue = ahciR3CmdPrepare(pAhciPort, pAhciReq);
+                if (fContinue)
                 {
-                    ahciLog(("%s: Setting device into reset state\n", __FUNCTION__));
-                    pAhciPort->fResetDevice = true;
-                    ahciSendD2HFis(pAhciPort, pAhciReq, pAhciReq->cmdFis, true);
-                }
-                else if (pAhciPort->fResetDevice) /* The bit is not set and we are in a reset state. */
-                    ahciFinishStorageDeviceReset(pAhciPort, pAhciReq);
-                else /* We are not in a reset state update the control registers. */
-                    AssertMsgFailed(("%s: Update the control register\n", __FUNCTION__));
-
-                ASMAtomicCmpXchgSize(&pAhciReq->enmTxState, AHCITXSTATE_FREE, AHCITXSTATE_ACTIVE, fXchg);
-                AssertMsg(fXchg, ("Task is not active\n"));
-                break;
-            }
-            else
-            {
-                AssertReleaseMsg(ASMAtomicReadU32(&pAhciPort->cTasksActive) < AHCI_NR_COMMAND_SLOTS,
-                                 ("There are more than 32 requests active"));
-                ASMAtomicIncU32(&pAhciPort->cTasksActive);
-
-                enmTxDir = ahciProcessCmd(pAhciPort, pAhciReq, pAhciReq->cmdFis);
-                pAhciReq->enmTxDir = enmTxDir;
+                    enmTxDir = ahciProcessCmd(pAhciPort, pAhciReq, pAhciReq->cmdFis);
+                    pAhciReq->enmTxDir = enmTxDir;
 
-                if (enmTxDir != AHCITXDIR_NONE)
-                {
-                    if (   enmTxDir != AHCITXDIR_FLUSH
-                        && enmTxDir != AHCITXDIR_TRIM)
+                    if (enmTxDir != AHCITXDIR_NONE)
                     {
-                        STAM_REL_COUNTER_INC(&pAhciPort->StatDMA);
-
-                        rc = ahciIoBufAllocate(pAhciPort, pAhciReq, pAhciReq->cbTransfer);
-                        if (RT_FAILURE(rc))
+                        if (   enmTxDir != AHCITXDIR_FLUSH
+                            && enmTxDir != AHCITXDIR_TRIM)
                         {
-                            /* In case we can't allocate enough memory fail the request with an overflow error. */
-                            AssertMsgFailed(("%s: Failed to process command %Rrc\n", __FUNCTION__, rc));
-                            pAhciReq->fFlags |= AHCI_REQ_OVERFLOW;
-                        }
-                    }
+                            STAM_REL_COUNTER_INC(&pAhciPort->StatDMA);
 
-                    if (!(pAhciReq->fFlags & AHCI_REQ_OVERFLOW))
-                    {
-                        if (pAhciPort->fAsyncInterface)
-                        {
-                            VBOXDD_AHCI_REQ_SUBMIT(pAhciReq, enmTxDir, pAhciReq->uOffset, pAhciReq->cbTransfer);
-                            VBOXDD_AHCI_REQ_SUBMIT_TIMESTAMP(pAhciReq, pAhciReq->tsStart);
-                            if (enmTxDir == AHCITXDIR_FLUSH)
-                            {
-                                rc = pAhciPort->pDrvBlockAsync->pfnStartFlush(pAhciPort->pDrvBlockAsync,
-                                                                              pAhciReq);
-                            }
-                            else if (enmTxDir == AHCITXDIR_TRIM)
-                            {
-                                rc = ahciTrimRangesCreate(pAhciPort, pAhciReq);
-                                if (RT_SUCCESS(rc))
-                                {
-                                    pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
-                                    rc = pAhciPort->pDrvBlockAsync->pfnStartDiscard(pAhciPort->pDrvBlockAsync, pAhciReq->u.Trim.paRanges,
-                                                                                    pAhciReq->u.Trim.cRanges, pAhciReq);
-                                }
-                            }
-                            else if (enmTxDir == AHCITXDIR_READ)
-                            {
-                                pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 1;
-                                rc = pAhciPort->pDrvBlockAsync->pfnStartRead(pAhciPort->pDrvBlockAsync, pAhciReq->uOffset,
-                                                                             &pAhciReq->u.Io.DataSeg, 1,
-                                                                             pAhciReq->cbTransfer,
-                                                                             pAhciReq);
-                            }
-                            else
-                            {
-                                pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
-                                rc = pAhciPort->pDrvBlockAsync->pfnStartWrite(pAhciPort->pDrvBlockAsync, pAhciReq->uOffset,
-                                                                              &pAhciReq->u.Io.DataSeg, 1,
-                                                                              pAhciReq->cbTransfer,
-                                                                              pAhciReq);
-                            }
-                            if (rc == VINF_VD_ASYNC_IO_FINISHED)
-                                fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, VINF_SUCCESS, true);
-                            else if (RT_FAILURE(rc) && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
-                                fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, rc, true);
-                        }
-                        else
-                        {
-                            if (enmTxDir == AHCITXDIR_FLUSH)
-                                rc = pAhciPort->pDrvBlock->pfnFlush(pAhciPort->pDrvBlock);
-                            else if (enmTxDir == AHCITXDIR_TRIM)
-                            {
-                                rc = ahciTrimRangesCreate(pAhciPort, pAhciReq);
-                                if (RT_SUCCESS(rc))
-                                {
-                                    pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
-                                    rc = pAhciPort->pDrvBlock->pfnDiscard(pAhciPort->pDrvBlock, pAhciReq->u.Trim.paRanges,
-                                                                          pAhciReq->u.Trim.cRanges);
-                                    pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 0;
-                                }
-                            }
-                            else if (enmTxDir == AHCITXDIR_READ)
-                            {
-                                pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 1;
-                                rc = pAhciPort->pDrvBlock->pfnRead(pAhciPort->pDrvBlock, pAhciReq->uOffset,
-                                                                   pAhciReq->u.Io.DataSeg.pvSeg,
-                                                                   pAhciReq->cbTransfer);
-                                pAhciPort->Led.Asserted.s.fReading = pAhciPort->Led.Actual.s.fReading = 0;
-                            }
-                            else
+                            rc = ahciIoBufAllocate(pAhciPort, pAhciReq, pAhciReq->cbTransfer);
+                            if (RT_FAILURE(rc))
                             {
-                                pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 1;
-                                rc = pAhciPort->pDrvBlock->pfnWrite(pAhciPort->pDrvBlock, pAhciReq->uOffset,
-                                                                    pAhciReq->u.Io.DataSeg.pvSeg,
-                                                                    pAhciReq->cbTransfer);
-                                pAhciPort->Led.Asserted.s.fWriting = pAhciPort->Led.Actual.s.fWriting = 0;
+                                /* In case we can't allocate enough memory fail the request with an overflow error. */
+                                AssertMsgFailed(("%s: Failed to process command %Rrc\n", __FUNCTION__, rc));
+                                pAhciReq->fFlags |= AHCI_REQ_OVERFLOW;
                             }
-                            fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, rc, true);
                         }
+
+                        if (!(pAhciReq->fFlags & AHCI_REQ_OVERFLOW))
+                            fReqCanceled = ahciR3ReqSubmit(pAhciPort, pAhciReq, enmTxDir);
+                        else /* Overflow is handled in completion routine. */
+                            fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, VINF_SUCCESS);
                     }
+                    else
+                        fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, VINF_SUCCESS);
+                } /* Command */
+                else
+                {
+                    ASMAtomicWriteNullPtr(&pAhciPort->aActiveTasks[pAhciReq->uTag]);
+                    ahciR3ReqFree(pAhciPort, pAhciReq);
                 }
+            }
+            else /* !Request allocated, use on stack variant to signal the error. */
+            {
+                AHCIREQ Req;
+                Req.uTag   = idx;
+                Req.fFlags = AHCI_REQ_IS_ON_STACK;
+
+                bool fContinue = ahciR3CmdPrepare(pAhciPort, &Req);
+                if (fContinue)
+                    fReqCanceled = ahciTransferComplete(pAhciPort, &Req, VERR_NO_MEMORY);
                 else
-                    fReqCanceled = ahciTransferComplete(pAhciPort, pAhciReq, VINF_SUCCESS, true);
-            } /* Command */
+                {
+                    ASMAtomicWriteNullPtr(&pAhciPort->aActiveTasks[pAhciReq->uTag]);
+                    ahciR3ReqFree(pAhciPort, pAhciReq);
+                }
+            }
 
             /*
              * Don't process other requests if the last one was canceled,
@@ -7035,7 +7120,7 @@ static DECLCALLBACK(int) ahciR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uin
     for (uint32_t i = 0; i < AHCI_MAX_NR_PORTS_IMPL; i++)
     {
         SSMR3PutBool(pSSM, pThis->ahciPort[i].pDrvBase != NULL);
-        SSMR3PutBool(pSSM, true); /* For the hotpluggable flag. */
+        SSMR3PutBool(pSSM, pThis->ahciPort[i].fHotpluggable);
         SSMR3PutStrZ(pSSM, pThis->ahciPort[i].szSerialNumber);
         SSMR3PutStrZ(pSSM, pThis->ahciPort[i].szFirmwareRevision);
         SSMR3PutStrZ(pSSM, pThis->ahciPort[i].szModelNumber);
@@ -7253,11 +7338,13 @@ static DECLCALLBACK(int) ahciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uin
                 bool fHotpluggable;
                 rc = SSMR3GetBool(pSSM, &fHotpluggable);
                 AssertRCReturn(rc, rc);
-                if (!fHotpluggable)
+                if (fHotpluggable != pThis->ahciPort[i].fHotpluggable)
                     return SSMR3SetCfgError(pSSM, RT_SRC_POS,
                                             N_("AHCI: Port %u config mismatch: Hotplug flag - saved=%RTbool config=%RTbool\n"),
-                                            i, fHotpluggable, true);
+                                            i, fHotpluggable, pThis->ahciPort[i].fHotpluggable);
             }
+            else
+                Assert(pThis->ahciPort[i].fHotpluggable);
 
             char szSerialNumber[AHCI_SERIAL_NUMBER_LENGTH+1];
             rc = SSMR3GetStrZ(pSSM, szSerialNumber,     sizeof(szSerialNumber));
@@ -7581,6 +7668,18 @@ static int ahciR3ConfigureLUN(PPDMDEVINS pDevIns, PAHCIPort pAhciPort)
     pAhciPort->fATAPI = (enmType == PDMBLOCKTYPE_CDROM || enmType == PDMBLOCKTYPE_DVD);
     pAhciPort->fATAPIPassthrough = pAhciPort->fATAPI ? (pAhciPort->pDrvBlock->pfnSendCmd != NULL) : false;
 
+    rc = RTCritSectInit(&pAhciPort->CritSectReqsFree);
+    if (RT_FAILURE(rc))
+        return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
+                                   N_("AHCI initialisation error: Failed to create critical section for free request list"));
+
+    pAhciPort->pListReqsFree = (PRTLISTANCHOR)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(RTLISTANCHOR));
+    if (!pAhciPort->pListReqsFree)
+        return PDMDevHlpVMSetError(pDevIns, VERR_NO_MEMORY, RT_SRC_POS,
+                                   N_("AHCI initialisation error: Failed to allocate memory for free request list"));
+
+    RTListInit(pAhciPort->pListReqsFree);
+
     if (pAhciPort->fATAPI)
     {
         pAhciPort->cTotalSectors = pAhciPort->pDrvBlock->pfnGetSize(pAhciPort->pDrvBlock) / 2048;
@@ -7862,6 +7961,10 @@ static DECLCALLBACK(void) ahciR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32
     Log(("%s:\n", __FUNCTION__));
 
     AssertMsg(iLUN < pAhci->cPortsImpl, ("iLUN=%u", iLUN));
+    AssertMsgReturnVoid(   pAhciPort->fHotpluggable
+                        || (fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG),
+                        ("AHCI: Port %d is not marked hotpluggable\n", pAhciPort->iLUN));
+
 
     if (pAhciPort->pAsyncIOThread)
     {
@@ -7881,6 +7984,14 @@ static DECLCALLBACK(void) ahciR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32
     /* Free all cached I/O tasks. */
     ahciR3PortCachedReqsFree(pAhciPort);
 
+    if (RTCritSectIsInitialized(&pAhciPort->CritSectReqsFree))
+        RTCritSectDelete(&pAhciPort->CritSectReqsFree);
+
+    if (pAhciPort->pListReqsFree)
+        MMR3HeapFree(pAhciPort->pListReqsFree);
+
+    pAhciPort->pListReqsFree = NULL;
+
     if (!(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG))
     {
         /*
@@ -7936,6 +8047,11 @@ static DECLCALLBACK(int)  ahciR3Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32
     AssertRelease(!pAhciPort->pDrvBlockAsync);
     Assert(pAhciPort->iLUN == iLUN);
 
+    AssertMsgReturn(   pAhciPort->fHotpluggable
+                    || (fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG),
+                    ("AHCI: Port %d is not marked hotpluggable\n", pAhciPort->iLUN),
+                    VERR_INVALID_PARAMETER);
+
     /*
      * Try attach the block device and get the interfaces,
      * required as well as optional.
@@ -7991,6 +8107,10 @@ static DECLCALLBACK(int)  ahciR3Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32
         if (   RT_SUCCESS(rc)
             && !(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG))
         {
+            AssertMsgReturn(pAhciPort->fHotpluggable,
+                            ("AHCI: Port %d is not marked hotpluggable\n", pAhciPort->iLUN),
+                            VERR_NOT_SUPPORTED);
+
             /*
              * Initialize registers
              */
@@ -8117,9 +8237,12 @@ static DECLCALLBACK(int) ahciR3Destruct(PPDMDEVINS pDevIns)
                 pAhciPort->hEvtProcess = NIL_SUPSEMEVENT;
             }
 
+            if (RTCritSectIsInitialized(&pAhciPort->CritSectReqsFree))
+                RTCritSectDelete(&pAhciPort->CritSectReqsFree);
+
 #ifdef VBOX_STRICT
             for (uint32_t i = 0; i < AHCI_NR_COMMAND_SLOTS; i++)
-                Assert(!pAhciPort->aCachedTasks[i]);
+                Assert(!pAhciPort->aActiveTasks[i]);
 #endif
         }
 
@@ -8157,8 +8280,7 @@ static DECLCALLBACK(int) ahciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
                                     "PortCount\0"
                                     "UseAsyncInterfaceIfAvailable\0"
                                     "Bootable\0"
-                                    "CmdSlotsAvail\0"
-                                    "PortsHotpluggable\0"))
+                                    "CmdSlotsAvail\0"))
         return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
                                 N_("AHCI configuration error: unknown option specified"));
 
@@ -8212,11 +8334,6 @@ static DECLCALLBACK(int) ahciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
                                    N_("AHCI configuration error: CmdSlotsAvail=%u should be at least 1"),
                                    pThis->cCmdSlotsAvail);
 
-    rc = CFGMR3QueryBoolDef(pCfg, "PortsHotpluggable", &pThis->fPortsHotpluggable, true);
-    if (RT_FAILURE(rc))
-        return PDMDEV_SET_ERROR(pDevIns, rc,
-                                N_("AHCI configuration error: failed to read \"PortsHotpluggable\" as boolean"));
-
     /*
      * Initialize the instance data (everything touched by the destructor need
      * to be initialized here!).
@@ -8278,6 +8395,7 @@ static DECLCALLBACK(int) ahciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
         pAhciPort->pDrvBase             = NULL;
         pAhciPort->pAsyncIOThread       = NULL;
         pAhciPort->hEvtProcess          = NIL_SUPSEMEVENT;
+        pAhciPort->fHotpluggable        = true;
     }
 
     /*
@@ -8421,6 +8539,16 @@ static DECLCALLBACK(int) ahciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
         pAhciPort->IMountNotify.pfnUnmountNotify        = ahciR3UnmountNotify;
         pAhciPort->fWrkThreadSleeping                   = true;
 
+        /* Query per port configuration options if available. */
+        PCFGMNODE pCfgPort = CFGMR3GetChild(pDevIns->pCfg, szName);
+        if (pCfgPort)
+        {
+            rc = CFGMR3QueryBoolDef(pCfgPort, "Hotpluggable", &pAhciPort->fHotpluggable, true);
+            if (RT_FAILURE(rc))
+                return PDMDEV_SET_ERROR(pDevIns, rc,
+                                        N_("AHCI configuration error: failed to read Hotpluggable as boolean"));
+        }
+
         /*
          * Attach the block driver
          */
diff --git a/src/VBox/Devices/Storage/DevATA.cpp b/src/VBox/Devices/Storage/DevATA.cpp
index c09d339..c47ccf4 100644
--- a/src/VBox/Devices/Storage/DevATA.cpp
+++ b/src/VBox/Devices/Storage/DevATA.cpp
@@ -2328,6 +2328,7 @@ static bool atapiReadDVDStructureSS(ATADevState *s)
 
                         /* 4 byte header + 4 byte data */
                         uASC = (4 + 4);
+                        break;
 
                     case 0x03: /* BCA information - invalid field for no BCA info */
                         uASC = -SCSI_ASC_INV_FIELD_IN_CMD_PACKET;
@@ -5900,10 +5901,10 @@ PDMBOTHCBDECL(int) ataIOPortRead1(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Por
     if (Port == pCtl->IOPortBase1)
     {
         /* Reads from the data register may be 16-bit or 32-bit. */
-        Assert(cb == 2 || cb == 4);
-        rc = ataDataRead(pCtl, Port, cb, (uint8_t *)pu32);
-        if (cb == 2)
-            *pu32 &= 0xffff;
+        Assert(cb == 1 || cb == 2 || cb == 4);
+        rc = ataDataRead(pCtl, Port, cb == 1 ? 2 : cb, (uint8_t *)pu32);
+        if (cb <= 2)
+            *pu32 &= 0xffff >> (16 - cb * 8);
     }
     else
     {
diff --git a/src/VBox/Devices/Storage/DevBusLogic.cpp b/src/VBox/Devices/Storage/DevBusLogic.cpp
index e6d6a03..be1100a 100644
--- a/src/VBox/Devices/Storage/DevBusLogic.cpp
+++ b/src/VBox/Devices/Storage/DevBusLogic.cpp
@@ -475,33 +475,33 @@ typedef struct BUSLOGIC
 /** Register offsets in the I/O port space. */
 #define BUSLOGIC_REGISTER_CONTROL   0 /**< Writeonly */
 /** Fields for the control register. */
-# define BUSLOGIC_REGISTER_CONTROL_SCSI_BUSRESET   RT_BIT(4)
-# define BUSLOGIC_REGISTER_CONTROL_INTERRUPT_RESET RT_BIT(5)
-# define BUSLOGIC_REGISTER_CONTROL_SOFT_RESET      RT_BIT(6)
-# define BUSLOGIC_REGISTER_CONTROL_HARD_RESET      RT_BIT(7)
+# define BL_CTRL_RSBUS  RT_BIT(4)   /* Reset SCSI Bus. */
+# define BL_CTRL_RINT   RT_BIT(5)   /* Reset Interrupt. */
+# define BL_CTRL_RSOFT  RT_BIT(6)   /* Soft Reset. */
+# define BL_CTRL_RHARD  RT_BIT(7)   /* Hard Reset. */
 
 #define BUSLOGIC_REGISTER_STATUS    0 /**< Readonly */
 /** Fields for the status register. */
-# define BUSLOGIC_REGISTER_STATUS_COMMAND_INVALID                 RT_BIT(0)
-# define BUSLOGIC_REGISTER_STATUS_DATA_IN_REGISTER_READY          RT_BIT(2)
-# define BUSLOGIC_REGISTER_STATUS_COMMAND_PARAMETER_REGISTER_BUSY RT_BIT(3)
-# define BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY              RT_BIT(4)
-# define BUSLOGIC_REGISTER_STATUS_INITIALIZATION_REQUIRED         RT_BIT(5)
-# define BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_FAILURE              RT_BIT(6)
-# define BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_ACTIVE               RT_BIT(7)
+# define BL_STAT_CMDINV RT_BIT(0)   /* Command Invalid. */
+# define BL_STAT_DIRRDY RT_BIT(2)   /* Data In Register Ready. */
+# define BL_STAT_CPRBSY RT_BIT(3)   /* Command/Parameter Out Register Busy. */
+# define BL_STAT_HARDY  RT_BIT(4)   /* Host Adapter Ready. */
+# define BL_STAT_INREQ  RT_BIT(5)   /* Initialization Required. */
+# define BL_STAT_DFAIL  RT_BIT(6)   /* Diagnostic Failure. */
+# define BL_STAT_DACT   RT_BIT(7)   /* Diagnistic Active. */
 
 #define BUSLOGIC_REGISTER_COMMAND   1 /**< Writeonly */
 #define BUSLOGIC_REGISTER_DATAIN    1 /**< Readonly */
 #define BUSLOGIC_REGISTER_INTERRUPT 2 /**< Readonly */
 /** Fields for the interrupt register. */
-# define BUSLOGIC_REGISTER_INTERRUPT_INCOMING_MAILBOX_LOADED      RT_BIT(0)
-# define BUSLOGIC_REGISTER_INTERRUPT_OUTGOING_MAILBOX_AVAILABLE   RT_BIT(1)
-# define BUSLOGIC_REGISTER_INTERRUPT_COMMAND_COMPLETE             RT_BIT(2)
-# define BUSLOGIC_REGISTER_INTERRUPT_EXTERNAL_BUS_RESET           RT_BIT(3)
-# define BUSLOGIC_REGISTER_INTERRUPT_INTERRUPT_VALID              RT_BIT(7)
+# define BL_INTR_IMBL   RT_BIT(0)   /* Incoming Mailbox Loaded. */
+# define BL_INTR_OMBR   RT_BIT(1)   /* Outgoing Mailbox Available. */
+# define BL_INTR_CMDC   RT_BIT(2)   /* Command Complete. */
+# define BL_INTR_RSTS   RT_BIT(3)   /* SCSO Bus Reset State. */
+# define BL_INTR_INTV   RT_BIT(7)   /* Interrupt Valid. */
 
 #define BUSLOGIC_REGISTER_GEOMETRY  3 /* Readonly */
-# define BUSLOGIC_REGISTER_GEOMETRY_EXTENTED_TRANSLATION_ENABLED  RT_BIT(7)
+# define BL_GEOM_XLATEN  RT_BIT(7)  /* Extended geometry translation enabled. */
 
 /** Structure for the INQUIRE_PCI_HOST_ADAPTER_INFORMATION reply. */
 typedef struct ReplyInquirePCIHostAdapterInformation
@@ -991,23 +991,24 @@ static void buslogicSetInterrupt(PBUSLOGIC pBusLogic, bool fSuppressIrq, uint8_t
 {
     LogFlowFunc(("pBusLogic=%#p\n", pBusLogic));
 
-    /* The CMDC interrupt has priority over IMBL and MBOR. */
-    if (uIrqType & (BUSLOGIC_REGISTER_INTERRUPT_INCOMING_MAILBOX_LOADED | BUSLOGIC_REGISTER_INTERRUPT_OUTGOING_MAILBOX_AVAILABLE))
+    /* The CMDC interrupt has priority over IMBL and OMBR. */
+    if (uIrqType & (BL_INTR_IMBL | BL_INTR_OMBR))
     {
-        if (!(pBusLogic->regInterrupt & BUSLOGIC_REGISTER_INTERRUPT_COMMAND_COMPLETE))
+        if (!(pBusLogic->regInterrupt & BL_INTR_CMDC))
             pBusLogic->regInterrupt |= uIrqType;    /* Report now. */
         else
             pBusLogic->uPendingIntr |= uIrqType;    /* Report later. */
     }
-    else if (uIrqType & BUSLOGIC_REGISTER_INTERRUPT_COMMAND_COMPLETE)
+    else if (uIrqType & BL_INTR_CMDC)
     {
-        Assert(!pBusLogic->regInterrupt);
+        AssertMsg(pBusLogic->regInterrupt == 0 || pBusLogic->regInterrupt == (BL_INTR_INTV | BL_INTR_CMDC),
+                  ("regInterrupt=%02X\n", pBusLogic->regInterrupt));
         pBusLogic->regInterrupt |= uIrqType;
     }
     else
         AssertMsgFailed(("Invalid interrupt state!\n"));
 
-    pBusLogic->regInterrupt |= BUSLOGIC_REGISTER_INTERRUPT_INTERRUPT_VALID;
+    pBusLogic->regInterrupt |= BL_INTR_INTV;
     if (pBusLogic->fIRQEnabled && !fSuppressIrq)
         PDMDevHlpPCISetIrq(pBusLogic->CTX_SUFF(pDevIns), 0, 1);
 }
@@ -1083,8 +1084,8 @@ static int buslogicR3HwReset(PBUSLOGIC pBusLogic, bool fResetIO)
     LogFlowFunc(("pBusLogic=%#p\n", pBusLogic));
 
     /* Reset registers to default values. */
-    pBusLogic->regStatus = BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY | BUSLOGIC_REGISTER_STATUS_INITIALIZATION_REQUIRED;
-    pBusLogic->regGeometry = BUSLOGIC_REGISTER_GEOMETRY_EXTENTED_TRANSLATION_ENABLED;
+    pBusLogic->regStatus = BL_STAT_HARDY | BL_STAT_INREQ;
+    pBusLogic->regGeometry = BL_GEOM_XLATEN;
     pBusLogic->uOperationCode = 0xff; /* No command executing. */
     pBusLogic->iParameter = 0;
     pBusLogic->cbCommandParametersLeft = 0;
@@ -1123,15 +1124,15 @@ static void buslogicCommandComplete(PBUSLOGIC pBusLogic, bool fSuppressIrq)
     LogFlowFunc(("pBusLogic=%#p\n", pBusLogic));
 
     pBusLogic->fUseLocalRam = false;
-    pBusLogic->regStatus |= BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY;
+    pBusLogic->regStatus |= BL_STAT_HARDY;
     pBusLogic->iReply = 0;
 
     /* Modify I/O address does not generate an interrupt. */
     if (pBusLogic->uOperationCode != BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND)
     {
         /* Notify that the command is complete. */
-        pBusLogic->regStatus &= ~BUSLOGIC_REGISTER_STATUS_DATA_IN_REGISTER_READY;
-        buslogicSetInterrupt(pBusLogic, fSuppressIrq, BUSLOGIC_REGISTER_INTERRUPT_COMMAND_COMPLETE);
+        pBusLogic->regStatus &= ~BL_STAT_DIRRDY;
+        buslogicSetInterrupt(pBusLogic, fSuppressIrq, BL_INTR_CMDC);
     }
 
     pBusLogic->uOperationCode = 0xff;
@@ -1156,8 +1157,8 @@ static void buslogicR3InitiateReset(PBUSLOGIC pBusLogic, bool fHardReset)
     if (fHardReset)
     {
         /* Set the diagnostic active bit in the status register and clear the ready state. */
-        pBusLogic->regStatus |=  BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_ACTIVE;
-        pBusLogic->regStatus &= ~BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY;
+        pBusLogic->regStatus |=  BL_STAT_DACT;
+        pBusLogic->regStatus &= ~BL_STAT_HARDY;
 
         /* Remember when the guest initiated a reset (after we're done resetting). */
         pBusLogic->u64ResetTime = PDMDevHlpTMTimeVirtGetNano(pBusLogic->CTX_SUFF(pDevIns));
@@ -1236,7 +1237,7 @@ static void buslogicR3SendIncomingMailbox(PBUSLOGIC pBusLogic, PBUSLOGICTASKSTAT
     ASMAtomicIncU32(&pBusLogic->cInMailboxesReady);
 # endif
 
-    buslogicSetInterrupt(pBusLogic, false, BUSLOGIC_REGISTER_INTERRUPT_INCOMING_MAILBOX_LOADED);
+    buslogicSetInterrupt(pBusLogic, false, BL_INTR_IMBL);
 
     PDMCritSectLeave(&pBusLogic->CritSectIntr);
 }
@@ -1910,7 +1911,7 @@ static int buslogicProcessCommand(PBUSLOGIC pBusLogic)
             Log(("cMailboxes=%u (24-bit mode)\n", pBusLogic->cMailbox));
             LogRel(("Initialized 24-bit mailbox, %d entries at %08x\n", pRequest->cMailbox, ADDR_TO_U32(pRequest->aMailboxBaseAddr)));
 
-            pBusLogic->regStatus &= ~BUSLOGIC_REGISTER_STATUS_INITIALIZATION_REQUIRED;
+            pBusLogic->regStatus &= ~BL_STAT_INREQ;
             pBusLogic->cbReplyParametersLeft = 0;
             break;
         }
@@ -1929,7 +1930,7 @@ static int buslogicProcessCommand(PBUSLOGIC pBusLogic)
             Log(("cMailboxes=%u (32-bit mode)\n", pBusLogic->cMailbox));
             LogRel(("Initialized 32-bit mailbox, %d entries at %08x\n", pRequest->cMailbox, pRequest->uMailboxBaseAddress));
 
-            pBusLogic->regStatus &= ~BUSLOGIC_REGISTER_STATUS_INITIALIZATION_REQUIRED;
+            pBusLogic->regStatus &= ~BL_STAT_INREQ;
             pBusLogic->cbReplyParametersLeft = 0;
             break;
         }
@@ -2080,7 +2081,7 @@ static int buslogicProcessCommand(PBUSLOGIC pBusLogic)
              */
             Log(("Command %#x not valid for this adapter\n", pBusLogic->uOperationCode));
             pBusLogic->cbReplyParametersLeft = 0;
-            pBusLogic->regStatus |= BUSLOGIC_REGISTER_STATUS_COMMAND_INVALID;
+            pBusLogic->regStatus |= BL_STAT_CMDINV;
             break;
         case BUSLOGICCOMMAND_EXECUTE_MAILBOX_COMMAND: /* Should be handled already. */
             AssertMsgFailed(("Invalid mailbox execute state!\n"));
@@ -2090,7 +2091,7 @@ static int buslogicProcessCommand(PBUSLOGIC pBusLogic)
 
     /* Set the data in ready bit in the status register in case the command has a reply. */
     if (pBusLogic->cbReplyParametersLeft)
-        pBusLogic->regStatus |= BUSLOGIC_REGISTER_STATUS_DATA_IN_REGISTER_READY;
+        pBusLogic->regStatus |= BL_STAT_DIRRDY;
     else if (!pBusLogic->cbCommandParametersLeft)
         buslogicCommandComplete(pBusLogic, fSuppressIrq);
 
@@ -2122,12 +2123,12 @@ static int buslogicRegisterRead(PBUSLOGIC pBusLogic, unsigned iRegister, uint32_
              * automatically after a period of time, in which case we can't show
              * the DIAG bit at all.
              */
-            if (pBusLogic->regStatus & BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_ACTIVE)
+            if (pBusLogic->regStatus & BL_STAT_DACT)
             {
                 uint64_t    u64AccessTime = PDMDevHlpTMTimeVirtGetNano(pBusLogic->CTX_SUFF(pDevIns));
 
-                pBusLogic->regStatus &= ~BUSLOGIC_REGISTER_STATUS_DIAGNOSTIC_ACTIVE;
-                pBusLogic->regStatus |= BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY;
+                pBusLogic->regStatus &= ~BL_STAT_DACT;
+                pBusLogic->regStatus |= BL_STAT_HARDY;
 
                 if (u64AccessTime - pBusLogic->u64ResetTime > BUSLOGIC_RESET_DURATION_NS)
                 {
@@ -2201,10 +2202,10 @@ static int buslogicRegisterWrite(PBUSLOGIC pBusLogic, unsigned iRegister, uint8_
     {
         case BUSLOGIC_REGISTER_CONTROL:
         {
-            if ((uVal & BUSLOGIC_REGISTER_CONTROL_HARD_RESET) || (uVal & BUSLOGIC_REGISTER_CONTROL_SOFT_RESET))
+            if ((uVal & BL_CTRL_RHARD) || (uVal & BL_CTRL_RSOFT))
             {
 #ifdef IN_RING3
-                bool    fHardReset = !!(uVal & BUSLOGIC_REGISTER_CONTROL_HARD_RESET);
+                bool    fHardReset = !!(uVal & BL_CTRL_RHARD);
 
                 LogRel(("BusLogic: %s reset\n", fHardReset ? "hard" : "soft"));
                 buslogicR3InitiateReset(pBusLogic, fHardReset);
@@ -2223,7 +2224,7 @@ static int buslogicRegisterWrite(PBUSLOGIC pBusLogic, unsigned iRegister, uint8_
             Log(("%u incoming mailboxes were ready when this interrupt was cleared\n", cMailboxesReady));
 #endif
 
-            if (uVal & BUSLOGIC_REGISTER_CONTROL_INTERRUPT_RESET)
+            if (uVal & BL_CTRL_RINT)
                 buslogicClearInterrupt(pBusLogic);
 
             PDMCritSectLeave(&pBusLogic->CritSectIntr);
@@ -2261,7 +2262,7 @@ static int buslogicRegisterWrite(PBUSLOGIC pBusLogic, unsigned iRegister, uint8_
                 pBusLogic->iParameter = 0;
 
                 /* Mark host adapter as busy and clear the invalid status bit. */
-                pBusLogic->regStatus &= ~(BUSLOGIC_REGISTER_STATUS_HOST_ADAPTER_READY | BUSLOGIC_REGISTER_STATUS_COMMAND_INVALID);
+                pBusLogic->regStatus &= ~(BL_STAT_HARDY | BL_STAT_CMDINV);
 
                 /* Get the number of bytes for parameters from the command code. */
                 switch (pBusLogic->uOperationCode)
@@ -3496,22 +3497,27 @@ static DECLCALLBACK(void) buslogicR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp,
                     !!pThis->fGCEnabled, !!pThis->fR0Enabled);
 
     /* Print mailbox state. */
-    if (pThis->regStatus & BUSLOGIC_REGISTER_STATUS_INITIALIZATION_REQUIRED)
+    if (pThis->regStatus & BL_STAT_INREQ)
         pHlp->pfnPrintf(pHlp, "Mailbox not initialized\n");
     else
-        pHlp->pfnPrintf(pHlp, "%u-bit mailbox with %u entries at %RGp\n",
+        pHlp->pfnPrintf(pHlp, "%u-bit mailbox with %u entries at %RGp (%d LUN CCBs)\n",
                         pThis->fMbxIs24Bit ? 24 : 32, pThis->cMailbox,
-                        pThis->GCPhysAddrMailboxOutgoingBase);
+                        pThis->GCPhysAddrMailboxOutgoingBase,
+                        pThis->fMbxIs24Bit ? 8 : pThis->fExtendedLunCCBFormat ? 64 : 8);
 
     /* Print register contents. */
     pHlp->pfnPrintf(pHlp, "Registers: STAT=%02x INTR=%02x GEOM=%02x\n",
                     pThis->regStatus, pThis->regInterrupt, pThis->regGeometry);
 
+    /* Print miscellaneous state. */
+    pHlp->pfnPrintf(pHlp, "HAC interrupts: %s\n",
+                    pThis->fIRQEnabled ? "on" : "off");
+
     /* Print the current command, if any. */
     if (pThis->uOperationCode != 0xff )
         pHlp->pfnPrintf(pHlp, "Current command: %02X\n", pThis->uOperationCode);
 
-    if (fVerbose && (pThis->regStatus & BUSLOGIC_REGISTER_STATUS_INITIALIZATION_REQUIRED) == 0)
+    if (fVerbose && (pThis->regStatus & BL_STAT_INREQ) == 0)
     {
         RTGCPHYS    GCMailbox;
 
diff --git a/src/VBox/Devices/Storage/DevFdc.cpp b/src/VBox/Devices/Storage/DevFdc.cpp
index 9ba27f5..a62b0fd 100644
--- a/src/VBox/Devices/Storage/DevFdc.cpp
+++ b/src/VBox/Devices/Storage/DevFdc.cpp
@@ -52,7 +52,6 @@
 #include <iprt/uuid.h>
 
 #include "VBoxDD.h"
-#include "vl_vbox.h"
 
 #define FDC_SAVESTATE_CURRENT   2       /* The new and improved saved state. */
 #define FDC_SAVESTATE_OLD       1       /* The original saved state. */
@@ -249,6 +248,7 @@ static int fd_sector(fdrive_t *drv)
  * returns 2 if track is invalid
  * returns 3 if sector is invalid
  * returns 4 if seek is disabled
+ * returns 5 if no media in drive
  */
 static int fd_seek(fdrive_t *drv, uint8_t head, uint8_t track, uint8_t sect,
                    int enable_seek)
@@ -256,6 +256,12 @@ static int fd_seek(fdrive_t *drv, uint8_t head, uint8_t track, uint8_t sect,
     int sector;
     int ret;
 
+    if (!drv->last_sect) {
+        FLOPPY_DPRINTF("no disk in drive (max=%d %d %02x %02x)\n",
+                       1, (drv->flags & FDISK_DBL_SIDES) == 0 ? 0 : 1,
+                       drv->max_track, drv->last_sect);
+        return 5;
+    }
     if (track > drv->max_track ||
         (head != 0 && (drv->flags & FDISK_DBL_SIDES) == 0)) {
         FLOPPY_DPRINTF("try to read %d %02x %02x (max=%d %d %02x %02x)\n",
@@ -342,6 +348,7 @@ static fd_format_t fd_formats[] = {
     { FDRIVE_DRV_144, FDRIVE_DISK_720, 14, 80, 1, FDRIVE_RATE_250K, "1.12 MB 3\"1/2", },
     /* 1.2 MB 5"1/4 floppy disks */
     { FDRIVE_DRV_120, FDRIVE_DISK_288, 15, 80, 1, FDRIVE_RATE_500K,  "1.2 MB 5\"1/4", },
+    { FDRIVE_DRV_120, FDRIVE_DISK_288, 16, 80, 1, FDRIVE_RATE_500K, "1.28 MB 5\"1/4", },    /* CP Backup 5.25" HD */
     { FDRIVE_DRV_120, FDRIVE_DISK_288, 18, 80, 1, FDRIVE_RATE_500K, "1.44 MB 5\"1/4", },
     { FDRIVE_DRV_120, FDRIVE_DISK_288, 18, 82, 1, FDRIVE_RATE_500K, "1.48 MB 5\"1/4", },
     { FDRIVE_DRV_120, FDRIVE_DISK_288, 18, 83, 1, FDRIVE_RATE_500K, "1.49 MB 5\"1/4", },
@@ -352,63 +359,66 @@ static fd_format_t fd_formats[] = {
     /* 360 kB 5"1/4 floppy disks (newer 9-sector formats) */
     { FDRIVE_DRV_120, FDRIVE_DISK_288,  9, 40, 1, FDRIVE_RATE_300K,  "360 kB 5\"1/4", },
     { FDRIVE_DRV_120, FDRIVE_DISK_288,  9, 40, 0, FDRIVE_RATE_300K,  "180 kB 5\"1/4", },
+    { FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 40, 1, FDRIVE_RATE_300K,  "400 kB 5\"1/4", },    /* CP Backup 5.25" DD */
     { FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 41, 1, FDRIVE_RATE_300K,  "410 kB 5\"1/4", },
     { FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 42, 1, FDRIVE_RATE_300K,  "420 kB 5\"1/4", },
     /* 320 kB 5"1/4 floppy disks (old 8-sector formats) */
     { FDRIVE_DRV_120, FDRIVE_DISK_288,  8, 40, 1, FDRIVE_RATE_300K,  "320 kB 5\"1/4", },
     { FDRIVE_DRV_120, FDRIVE_DISK_288,  8, 40, 0, FDRIVE_RATE_300K,  "160 kB 5\"1/4", },
     /* 1.2 MB and low density 3"1/2 floppy 'aliases' */
-    { FDRIVE_DRV_144, FDRIVE_DISK_144, 15, 80, 1, FDRIVE_RATE_500K, " 1.2 MB 3\"1/2", },
+    { FDRIVE_DRV_144, FDRIVE_DISK_144, 15, 80, 1, FDRIVE_RATE_500K,  "1.2 MB 3\"1/2", },
+    { FDRIVE_DRV_144, FDRIVE_DISK_144, 16, 80, 1, FDRIVE_RATE_500K, "1.28 MB 3\"1/2", },
+    { FDRIVE_DRV_144, FDRIVE_DISK_720, 10, 40, 1, FDRIVE_RATE_300K,  "400 kB 3\"1/2", },    /* CP Backup 5.25" DD */
     { FDRIVE_DRV_144, FDRIVE_DISK_720,  9, 40, 1, FDRIVE_RATE_300K,  "360 kB 3\"1/2", },
     { FDRIVE_DRV_144, FDRIVE_DISK_720,  9, 40, 0, FDRIVE_RATE_300K,  "180 kB 3\"1/2", },
     { FDRIVE_DRV_144, FDRIVE_DISK_720,  8, 40, 1, FDRIVE_RATE_300K,  "320 kB 3\"1/2", },
     { FDRIVE_DRV_144, FDRIVE_DISK_720,  8, 40, 0, FDRIVE_RATE_300K,  "160 kB 3\"1/2", },
 #ifdef VBOX /* For larger than real life floppy images (see DrvBlock.cpp). */
     /* 15.6 MB fake floppy disk (just need something big). */
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_USER,  63, 255, 1, FDRIVE_RATE_1M,   "15.6 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   36,  80, 1, FDRIVE_RATE_1M,   "2.88 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   39,  80, 1, FDRIVE_RATE_1M,   "3.12 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   40,  80, 1, FDRIVE_RATE_1M,    "3.2 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   44,  80, 1, FDRIVE_RATE_1M,   "3.52 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   48,  80, 1, FDRIVE_RATE_1M,   "3.84 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   18,  80, 1, FDRIVE_RATE_500K, "1.44 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   20,  80, 1, FDRIVE_RATE_500K,  "1.6 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   21,  80, 1, FDRIVE_RATE_500K, "1.68 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   21,  82, 1, FDRIVE_RATE_500K, "1.72 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   21,  83, 1, FDRIVE_RATE_500K, "1.74 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   22,  80, 1, FDRIVE_RATE_500K, "1.76 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   23,  80, 1, FDRIVE_RATE_500K, "1.84 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   24,  80, 1, FDRIVE_RATE_500K, "1.92 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,    9,  80, 1, FDRIVE_RATE_250K,  "720 kB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   10,  80, 1, FDRIVE_RATE_250K,  "800 kB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   10,  82, 1, FDRIVE_RATE_250K,  "820 kB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   10,  83, 1, FDRIVE_RATE_250K,  "830 kB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   13,  80, 1, FDRIVE_RATE_250K, "1.04 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   14,  80, 1, FDRIVE_RATE_250K, "1.12 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,    9,  80, 0, FDRIVE_RATE_250K,  "360 kB 3\"1/2", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_USER,  63, 255, 1, FDRIVE_RATE_1M,   "15.6 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   36,  80, 1, FDRIVE_RATE_1M,   "2.88 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   39,  80, 1, FDRIVE_RATE_1M,   "3.12 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   40,  80, 1, FDRIVE_RATE_1M,    "3.2 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   44,  80, 1, FDRIVE_RATE_1M,   "3.52 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_288,   48,  80, 1, FDRIVE_RATE_1M,   "3.84 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   18,  80, 1, FDRIVE_RATE_500K, "1.44 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   20,  80, 1, FDRIVE_RATE_500K,  "1.6 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   21,  80, 1, FDRIVE_RATE_500K, "1.68 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   21,  82, 1, FDRIVE_RATE_500K, "1.72 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   21,  83, 1, FDRIVE_RATE_500K, "1.74 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   22,  80, 1, FDRIVE_RATE_500K, "1.76 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   23,  80, 1, FDRIVE_RATE_500K, "1.84 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_144,   24,  80, 1, FDRIVE_RATE_500K, "1.92 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,    9,  80, 1, FDRIVE_RATE_250K,  "720 kB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   10,  80, 1, FDRIVE_RATE_250K,  "800 kB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   10,  82, 1, FDRIVE_RATE_250K,  "820 kB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   10,  83, 1, FDRIVE_RATE_250K,  "830 kB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   13,  80, 1, FDRIVE_RATE_250K, "1.04 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,   14,  80, 1, FDRIVE_RATE_250K, "1.12 MB fake 15.6", },
+    { FDRIVE_DRV_FAKE_15_6, FDRIVE_DISK_720,    9,  80, 0, FDRIVE_RATE_250K,  "360 kB fake 15.6", },
     /* 63.5 MB fake floppy disk (just need something big). */
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_USER, 255, 255, 1, FDRIVE_RATE_1M,   "63.5 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_USER,  63, 255, 1, FDRIVE_RATE_1M,   "15.6 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   36,  80, 1, FDRIVE_RATE_1M,   "2.88 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   39,  80, 1, FDRIVE_RATE_1M,   "3.12 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   40,  80, 1, FDRIVE_RATE_1M,    "3.2 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   44,  80, 1, FDRIVE_RATE_1M,   "3.52 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   48,  80, 1, FDRIVE_RATE_1M,   "3.84 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   18,  80, 1, FDRIVE_RATE_500K, "1.44 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   20,  80, 1, FDRIVE_RATE_500K,  "1.6 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   21,  80, 1, FDRIVE_RATE_500K, "1.68 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   21,  82, 1, FDRIVE_RATE_500K, "1.72 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   21,  83, 1, FDRIVE_RATE_500K, "1.74 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   22,  80, 1, FDRIVE_RATE_500K, "1.76 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   23,  80, 1, FDRIVE_RATE_500K, "1.84 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   24,  80, 1, FDRIVE_RATE_500K, "1.92 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,    9,  80, 1, FDRIVE_RATE_250K,  "720 kB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   10,  80, 1, FDRIVE_RATE_250K,  "800 kB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   10,  82, 1, FDRIVE_RATE_250K,  "820 kB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   10,  83, 1, FDRIVE_RATE_250K,  "830 kB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   13,  80, 1, FDRIVE_RATE_250K, "1.04 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   14,  80, 1, FDRIVE_RATE_250K, "1.12 MB 3\"1/2", },
-    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,    9,  80, 0, FDRIVE_RATE_250K,  "360 kB 3\"1/2", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_USER, 255, 255, 1, FDRIVE_RATE_1M,   "63.5 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_USER,  63, 255, 1, FDRIVE_RATE_1M,   "15.6 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   36,  80, 1, FDRIVE_RATE_1M,   "2.88 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   39,  80, 1, FDRIVE_RATE_1M,   "3.12 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   40,  80, 1, FDRIVE_RATE_1M,    "3.2 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   44,  80, 1, FDRIVE_RATE_1M,   "3.52 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_288,   48,  80, 1, FDRIVE_RATE_1M,   "3.84 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   18,  80, 1, FDRIVE_RATE_500K, "1.44 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   20,  80, 1, FDRIVE_RATE_500K,  "1.6 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   21,  80, 1, FDRIVE_RATE_500K, "1.68 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   21,  82, 1, FDRIVE_RATE_500K, "1.72 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   21,  83, 1, FDRIVE_RATE_500K, "1.74 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   22,  80, 1, FDRIVE_RATE_500K, "1.76 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   23,  80, 1, FDRIVE_RATE_500K, "1.84 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_144,   24,  80, 1, FDRIVE_RATE_500K, "1.92 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,    9,  80, 1, FDRIVE_RATE_250K,  "720 kB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   10,  80, 1, FDRIVE_RATE_250K,  "800 kB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   10,  82, 1, FDRIVE_RATE_250K,  "820 kB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   10,  83, 1, FDRIVE_RATE_250K,  "830 kB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   13,  80, 1, FDRIVE_RATE_250K, "1.04 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,   14,  80, 1, FDRIVE_RATE_250K, "1.12 MB fake 63.5", },
+    { FDRIVE_DRV_FAKE_63_5, FDRIVE_DISK_720,    9,  80, 0, FDRIVE_RATE_250K,  "360 kB fake 63.5", },
 #endif
     /* end */
     { FDRIVE_DRV_NONE, FDRIVE_DISK_NONE, (uint8_t)-1, (uint8_t)-1, 0, (fdrive_rate_t)0, NULL, },
@@ -711,7 +721,11 @@ struct fdctrl_t {
 #endif
     uint32_t io_base;
     /* Controller state */
+#ifndef VBOX
     QEMUTimer *result_timer;
+#else
+    struct TMTIMER *result_timer;
+#endif
     uint8_t sra;
     uint8_t srb;
     uint8_t dor;
@@ -1260,6 +1274,14 @@ static void fdctrl_start_transfer(fdctrl_t *fdctrl, int direction)
         fdctrl->fifo[4] = kh;
         fdctrl->fifo[5] = ks;
         return;
+    case 5:
+        /* No disk in drive */
+        ///@todo: This is wrong! Command should not complete.
+        fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM | 0x08, /*FD_SR1_MA |*/ FD_SR1_ND, 0x00);
+        fdctrl->fifo[3] = kt;
+        fdctrl->fifo[4] = kh;
+        fdctrl->fifo[5] = ks;
+        return;
     case 1:
         did_seek = 1;
         break;
@@ -1385,6 +1407,13 @@ static void fdctrl_start_format(fdctrl_t *fdctrl)
         fdctrl->fifo[4] = kh;
         fdctrl->fifo[5] = ks;
         return;
+    case 5:
+        /* No disk in drive */
+        fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM, FD_SR1_MA, 0x00);
+        fdctrl->fifo[3] = kt;
+        fdctrl->fifo[4] = kh;
+        fdctrl->fifo[5] = ks;
+        return;
     case 1:
         break;
     default:
@@ -1739,7 +1768,6 @@ static uint32_t fdctrl_read_data(fdctrl_t *fdctrl)
     }
     pos = fdctrl->data_pos % FD_SECTOR_LEN;
     if (fdctrl->msr & FD_MSR_NONDMA) {
-        pos %= FD_SECTOR_LEN;
         if (pos == 0) {
             if (fdctrl->data_pos != 0)
                 if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) {
@@ -1817,6 +1845,13 @@ static void fdctrl_format_sector(fdctrl_t *fdctrl)
         fdctrl->fifo[4] = kh;
         fdctrl->fifo[5] = ks;
         return;
+    case 5:
+        /* No disk in drive */
+        fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM, FD_SR1_MA, 0x00);
+        fdctrl->fifo[3] = kt;
+        fdctrl->fifo[4] = kh;
+        fdctrl->fifo[5] = ks;
+        return;
     case 1:
         fdctrl->data_state |= FD_STATE_SEEK;
         break;
@@ -2283,7 +2318,7 @@ static void fdctrl_write_data(fdctrl_t *fdctrl, uint32_t value)
         fdctrl->msr |= FD_MSR_CMDBUSY;
     }
 
-    FLOPPY_DPRINTF("%s: %02x\n", __func__, value);
+    FLOPPY_DPRINTF("%s: %02x\n", __FUNCTION__, value);
     fdctrl->fifo[fdctrl->data_pos++ % FD_SECTOR_LEN] = value;
     if (fdctrl->data_pos == fdctrl->data_len) {
         /* We now have all parameters
@@ -2316,6 +2351,7 @@ static void fdctrl_result_timer(void *opaque)
 #ifdef VBOX
     if (!cur_drv->max_track) {
         FLOPPY_DPRINTF("read id when no disk in drive\n");
+        ///@todo: This is wrong! Command should not complete.
         fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM, FD_SR1_MA | FD_SR1_ND, FD_SR2_MD);
     } else if ((fdctrl->dsr & FD_DSR_DRATEMASK) != cur_drv->media_rate) {
         FLOPPY_DPRINTF("read id rate mismatch (fdc=%d, media=%d)\n",
diff --git a/src/VBox/Devices/Storage/DrvBlock.cpp b/src/VBox/Devices/Storage/DrvBlock.cpp
index 21dadf4..21e26e3 100644
--- a/src/VBox/Devices/Storage/DrvBlock.cpp
+++ b/src/VBox/Devices/Storage/DrvBlock.cpp
@@ -147,7 +147,7 @@ static DECLCALLBACK(int) drvblockRead(PPDMIBLOCK pInterface, uint64_t off, void
 }
 
 
-/** @copydoc PDMIBLOCK::pfnRead */
+/** @copydoc PDMIBLOCK::pfnReadPcBios */
 static DECLCALLBACK(int) drvblockReadPcBios(PPDMIBLOCK pInterface, uint64_t off, void *pvBuf, size_t cbRead)
 {
     PDRVBLOCK pThis = PDMIBLOCK_2_DRVBLOCK(pInterface);
diff --git a/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp b/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
index 72913f3..9f53298 100644
--- a/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
+++ b/src/VBox/Devices/Storage/DrvDiskIntegrity.cpp
@@ -798,15 +798,6 @@ static DECLCALLBACK(int) drvdiskintRead(PPDMIMEDIA pInterface,
     return rc;
 }
 
-/** @copydoc PDMIMEDIA::pfnReadPcBios */
-static DECLCALLBACK(int) drvdiskintReadPcBios(PPDMIMEDIA pInterface,
-                                              uint64_t off, void *pvBuf, size_t cbRead)
-{
-    PDRVDISKINTEGRITY pThis = PDMIMEDIA_2_DRVDISKINTEGRITY(pInterface);
-
-    return pThis->pDrvMedia->pfnReadPcBios(pThis->pDrvMedia, off, pvBuf, cbRead);
-}
-
 /** @copydoc PDMIMEDIA::pfnWrite */
 static DECLCALLBACK(int) drvdiskintWrite(PPDMIMEDIA pInterface,
                                          uint64_t off, const void *pvBuf,
@@ -1386,7 +1377,6 @@ static DECLCALLBACK(int) drvdiskintConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg,
 
     /* IMedia */
     pThis->IMedia.pfnRead                = drvdiskintRead;
-    pThis->IMedia.pfnReadPcBios          = drvdiskintReadPcBios;
     pThis->IMedia.pfnWrite               = drvdiskintWrite;
     pThis->IMedia.pfnFlush               = drvdiskintFlush;
     pThis->IMedia.pfnGetSize             = drvdiskintGetSize;
diff --git a/src/VBox/Devices/Storage/DrvHostFloppy.cpp b/src/VBox/Devices/Storage/DrvHostFloppy.cpp
index ba53e80..2a23e87 100644
--- a/src/VBox/Devices/Storage/DrvHostFloppy.cpp
+++ b/src/VBox/Devices/Storage/DrvHostFloppy.cpp
@@ -1,3 +1,4 @@
+/* $Id: DrvHostFloppy.cpp $ */
 /** @file
  *
  * VBox storage devices:
diff --git a/src/VBox/Devices/Storage/DrvSCSIHost.cpp b/src/VBox/Devices/Storage/DrvSCSIHost.cpp
index f2ddd25..17693e5 100644
--- a/src/VBox/Devices/Storage/DrvSCSIHost.cpp
+++ b/src/VBox/Devices/Storage/DrvSCSIHost.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -51,7 +51,7 @@ typedef struct DRVSCSIHOST
 
     /** Pointer to the SCSI port interface of the device above. */
     PPDMISCSIPORT           pDevScsiPort;
-    /** The SCSI connector interface .   */
+    /** The SCSI connector interface. */
     PDMISCSICONNECTOR       ISCSIConnector;
 
     /** Path to the device file. */
@@ -285,7 +285,7 @@ static int drvscsihostProcessRequestOne(PDRVSCSIHOST pThis, PPDMSCSIREQUEST pReq
                 ScsiIoReq.iovec_count = pRequest->cScatterGatherEntries;
 
                 paSG = (sg_iovec_t *)RTMemAllocZ(pRequest->cScatterGatherEntries * sizeof(sg_iovec_t));
-                AssertPtrReturn(paSG, VERR_NO_MEMORY);
+                AssertReturn(paSG, VERR_NO_MEMORY);
 
                 for (unsigned i = 0; i < pRequest->cScatterGatherEntries; i++)
                 {
diff --git a/src/VBox/Devices/Storage/DrvVD.cpp b/src/VBox/Devices/Storage/DrvVD.cpp
index 5bf28fa..f7763b9 100644
--- a/src/VBox/Devices/Storage/DrvVD.cpp
+++ b/src/VBox/Devices/Storage/DrvVD.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -45,7 +45,7 @@ RT_C_DECLS_BEGIN
 #include <lwip/inet.h>
 #include <lwip/tcp.h>
 #include <lwip/sockets.h>
-# ifdef VBOX_WITH_NEW_LWIP
+# if LWIP_IPV6
 #  include <lwip/inet6.h>
 # endif
 RT_C_DECLS_END
@@ -165,7 +165,7 @@ typedef struct VBOXDISK
     /** Flag whether boot acceleration is currently active. */
     bool                     fBootAccelActive;
     /** Size of the disk, used for read truncation. */
-    size_t                   cbDisk;
+    uint64_t                 cbDisk;
     /** Size of the configured buffer. */
     size_t                   cbBootAccelBuffer;
     /** Start offset for which the buffer holds data. */
@@ -669,6 +669,34 @@ static DECLCALLBACK(int) drvvdCryptoKeyRelease(void *pvUser, const char *pszId)
     return rc;
 }
 
+static DECLCALLBACK(int) drvvdCryptoKeyStorePasswordRetain(void *pvUser, const char *pszId, const char **ppszPassword)
+{
+    PVBOXDISK pThis = (PVBOXDISK)pvUser;
+    int rc = VINF_SUCCESS;
+
+    AssertPtr(pThis->pIfSecKey);
+    if (pThis->pIfSecKey)
+        rc = pThis->pIfSecKey->pfnPasswordRetain(pThis->pIfSecKey, pszId, ppszPassword);
+    else
+        rc = VERR_NOT_SUPPORTED;
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvvdCryptoKeyStorePasswordRelease(void *pvUser, const char *pszId)
+{
+    PVBOXDISK pThis = (PVBOXDISK)pvUser;
+    int rc = VINF_SUCCESS;
+
+    AssertPtr(pThis->pIfSecKey);
+    if (pThis->pIfSecKey)
+        rc = pThis->pIfSecKey->pfnPasswordRelease(pThis->pIfSecKey, pszId);
+    else
+        rc = VERR_NOT_SUPPORTED;
+
+    return rc;
+}
+
 #ifdef VBOX_WITH_INIP
 /*******************************************************************************
 *   VD TCP network stack interface implementation - INIP case                  *
@@ -682,7 +710,7 @@ typedef union INIPSOCKADDRUNION
 {
     struct sockaddr     Addr;
     struct sockaddr_in  Ipv4;
-#ifdef VBOX_WITH_NEW_LWIP
+#if LWIP_IPV6
     struct sockaddr_in6 Ipv6;
 #endif
 } INIPSOCKADDRUNION;
@@ -734,7 +762,7 @@ static DECLCALLBACK(int) drvvdINIPClientConnect(VDSOCKET Sock, const char *pszAd
     PINIPSOCKET pSocketInt = (PINIPSOCKET)Sock;
     int iInetFamily = PF_INET;
     struct in_addr ip;
-#ifdef VBOX_WITH_NEW_LWIP
+#if LWIP_IPV6
     ip6_addr_t ip6;
 #endif
 
@@ -748,7 +776,7 @@ static DECLCALLBACK(int) drvvdINIPClientConnect(VDSOCKET Sock, const char *pszAd
     }
     /* Resolve hostname. As there is no standard resolver for lwIP yet,
      * just accept numeric IP addresses for now. */
-#ifdef VBOX_WITH_NEW_LWIP
+#if LWIP_IPV6
     if (inet6_aton(pszAddress, &ip6))
         iInetFamily = PF_INET6;
     else /* concatination with if */
@@ -775,7 +803,7 @@ static DECLCALLBACK(int) drvvdINIPClientConnect(VDSOCKET Sock, const char *pszAd
             InAddr.sin_len = sizeof(InAddr);
             pSockAddr = (struct sockaddr *)&InAddr;
         }
-#ifdef VBOX_WITH_NEW_LWIP
+#if LWIP_IPV6
         else
         {
             In6Addr.sin6_family = AF_INET6;
@@ -980,7 +1008,7 @@ static DECLCALLBACK(int) drvvdINIPGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAdd
             pAddr->uPort        = RT_N2H_U16(u.Ipv4.sin_port);
             pAddr->uAddr.IPv4.u = u.Ipv4.sin_addr.s_addr;
         }
-#ifdef VBOX_WITH_NEW_LWIP
+#if LWIP_IPV6
         else if (   cbAddr == sizeof(struct sockaddr_in6)
             && u.Addr.sa_family == AF_INET6)
         {
@@ -1017,7 +1045,7 @@ static DECLCALLBACK(int) drvvdINIPGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr
             pAddr->uPort        = RT_N2H_U16(u.Ipv4.sin_port);
             pAddr->uAddr.IPv4.u = u.Ipv4.sin_addr.s_addr;
         }
-#ifdef VBOX_WITH_NEW_LWIP
+#if LWIP_IPV6
         else if (   cbAddr == sizeof(struct sockaddr_in6)
                  && u.Addr.sa_family == AF_INET6)
         {
@@ -1625,7 +1653,7 @@ static DECLCALLBACK(int) drvvdRead(PPDMIMEDIA pInterface,
     return rc;
 }
 
-/** @copydoc PDMIMEDIA::pfnReadPcBios */
+/** @copydoc PDMIMEDIA::pfnRead */
 static DECLCALLBACK(int) drvvdReadPcBios(PPDMIMEDIA pInterface,
                                          uint64_t off, void *pvBuf, size_t cbRead)
 {
@@ -1679,6 +1707,7 @@ static DECLCALLBACK(int) drvvdReadPcBios(PPDMIMEDIA pInterface,
     return rc;
 }
 
+
 /** @copydoc PDMIMEDIA::pfnWrite */
 static DECLCALLBACK(int) drvvdWrite(PPDMIMEDIA pInterface,
                                     uint64_t off, const void *pvBuf,
@@ -1767,7 +1796,7 @@ static DECLCALLBACK(int) drvvdSetSecKeyIf(PPDMIMEDIA pInterface, PPDMISECKEY pIf
             && !pIfSecKey)
         {
             /* Unload the crypto filter first to make sure it doesn't access the keys anymore. */
-            rc = VDFilterRemove(pThis->pDisk);
+            rc = VDFilterRemove(pThis->pDisk, VD_FILTER_FLAGS_DEFAULT);
             AssertRC(rc);
 
             pThis->pIfSecKey = NULL;
@@ -1787,7 +1816,7 @@ static DECLCALLBACK(int) drvvdSetSecKeyIf(PPDMIMEDIA pInterface, PPDMISECKEY pIf
             AssertRC(rc);
 
             /* Load the crypt filter plugin. */
-            rc = VDFilterAdd(pThis->pDisk, "CRYPT", pVDIfFilter);
+            rc = VDFilterAdd(pThis->pDisk, "CRYPT", VD_FILTER_FLAGS_DEFAULT, pVDIfFilter);
             if (RT_FAILURE(rc))
                 pThis->pIfSecKey = NULL;
         }
@@ -2235,7 +2264,7 @@ static int drvvdSetupFilters(PVBOXDISK pThis, PCFGMNODE pCfg)
                                 pCfgFilterConfig, sizeof(VDINTERFACECONFIG), &pVDIfsFilter);
             AssertRC(rc);
 
-            rc = VDFilterAdd(pThis->pDisk, pszFilterName, pVDIfsFilter);
+            rc = VDFilterAdd(pThis->pDisk, pszFilterName, VD_FILTER_FLAGS_DEFAULT, pVDIfsFilter);
 
             MMR3HeapFree(pszFilterName);
         }
@@ -2300,6 +2329,44 @@ static DECLCALLBACK(int) drvvdLoadDone(PPDMDRVINS pDrvIns, PSSMHANDLE pSSM)
 *******************************************************************************/
 
 /**
+ * @copydoc FNPDMDRVPOWEROFF
+ */
+static DECLCALLBACK(void) drvvdPowerOff(PPDMDRVINS pDrvIns)
+{
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
+    PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
+    LogFlowFunc(("\n"));
+
+    RTSEMFASTMUTEX mutex;
+    ASMAtomicXchgHandle(&pThis->MergeCompleteMutex, NIL_RTSEMFASTMUTEX, &mutex);
+    if (mutex != NIL_RTSEMFASTMUTEX)
+    {
+        /* Request the semaphore to wait until a potentially running merge
+         * operation has been finished. */
+        int rc = RTSemFastMutexRequest(mutex);
+        AssertRC(rc);
+        pThis->fMergePending = false;
+        rc = RTSemFastMutexRelease(mutex);
+        AssertRC(rc);
+        rc = RTSemFastMutexDestroy(mutex);
+        AssertRC(rc);
+    }
+
+    if (RT_VALID_PTR(pThis->pBlkCache))
+    {
+        PDMR3BlkCacheRelease(pThis->pBlkCache);
+        pThis->pBlkCache = NULL;
+    }
+
+    if (RT_VALID_PTR(pThis->pDisk))
+    {
+        VDDestroy(pThis->pDisk);
+        pThis->pDisk = NULL;
+    }
+    drvvdFreeImages(pThis);
+}
+
+/**
  * VM resume notification that we use to undo what the temporary read-only image
  * mode set by drvvdSuspend.
  *
@@ -2403,34 +2470,6 @@ static DECLCALLBACK(void) drvvdDestruct(PPDMDRVINS pDrvIns)
     PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
     LogFlowFunc(("\n"));
 
-    RTSEMFASTMUTEX mutex;
-    ASMAtomicXchgHandle(&pThis->MergeCompleteMutex, NIL_RTSEMFASTMUTEX, &mutex);
-    if (mutex != NIL_RTSEMFASTMUTEX)
-    {
-        /* Request the semaphore to wait until a potentially running merge
-         * operation has been finished. */
-        int rc = RTSemFastMutexRequest(mutex);
-        AssertRC(rc);
-        pThis->fMergePending = false;
-        rc = RTSemFastMutexRelease(mutex);
-        AssertRC(rc);
-        rc = RTSemFastMutexDestroy(mutex);
-        AssertRC(rc);
-    }
-
-    if (RT_VALID_PTR(pThis->pBlkCache))
-    {
-        PDMR3BlkCacheRelease(pThis->pBlkCache);
-        pThis->pBlkCache = NULL;
-    }
-
-    if (RT_VALID_PTR(pThis->pDisk))
-    {
-        VDDestroy(pThis->pDisk);
-        pThis->pDisk = NULL;
-    }
-    drvvdFreeImages(pThis);
-
     if (pThis->MergeLock != NIL_RTSEMRW)
     {
         int rc = RTSemRWDestroy(pThis->MergeLock);
@@ -2910,8 +2949,10 @@ static DECLCALLBACK(int) drvvdConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint
             pThis->VDIfCfg.pfnQuery         = drvvdCfgQuery;
             pThis->VDIfCfg.pfnQueryBytes    = NULL;
 
-            pThis->VDIfCrypto.pfnKeyRetain  = drvvdCryptoKeyRetain;
-            pThis->VDIfCrypto.pfnKeyRelease = drvvdCryptoKeyRelease;
+            pThis->VDIfCrypto.pfnKeyRetain               = drvvdCryptoKeyRetain;
+            pThis->VDIfCrypto.pfnKeyRelease              = drvvdCryptoKeyRelease;
+            pThis->VDIfCrypto.pfnKeyStorePasswordRetain  = drvvdCryptoKeyStorePasswordRetain;
+            pThis->VDIfCrypto.pfnKeyStorePasswordRelease = drvvdCryptoKeyStorePasswordRelease;
         }
 
         /* Unconditionally insert the TCPNET interface, don't bother to check
@@ -3286,7 +3327,7 @@ const PDMDRVREG g_DrvVD =
     /* pfnDetach */
     NULL,
     /* pfnPowerOff */
-    NULL,
+    drvvdPowerOff,
     /* pfnSoftReset */
     NULL,
     /* u32EndVersion */
diff --git a/src/VBox/Devices/Storage/PIIX3ATABmDma.h b/src/VBox/Devices/Storage/PIIX3ATABmDma.h
index af7059a..6565441 100644
--- a/src/VBox/Devices/Storage/PIIX3ATABmDma.h
+++ b/src/VBox/Devices/Storage/PIIX3ATABmDma.h
@@ -1,3 +1,4 @@
+/* $Id:  $ */
 /** @file
  *
  * VBox storage devices:
diff --git a/src/VBox/Devices/Storage/UsbMsd.cpp b/src/VBox/Devices/Storage/UsbMsd.cpp
index 132b6e7..c9ba11a 100644
--- a/src/VBox/Devices/Storage/UsbMsd.cpp
+++ b/src/VBox/Devices/Storage/UsbMsd.cpp
@@ -49,6 +49,9 @@
 #define USBMSD_PID_CD               0x0031
 /** @} */
 
+/** Saved state version. */
+#define USB_MSD_SAVED_STATE_VERSION 1
+
 /*******************************************************************************
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
@@ -125,7 +128,9 @@ typedef enum USBMSDREQSTATE
      * and the only reference to this request will be with DrvSCSI. */
     USBMSDREQSTATE_DESTROY_ON_COMPLETION,
     /** The end of the valid states. */
-    USBMSDREQSTATE_END
+    USBMSDREQSTATE_END,
+    /** 32bit blow up hack. */
+    USBMSDREQSTATE_32BIT_HACK = 0x7fffffff
 } USBMSDREQSTATE;
 
 
@@ -137,7 +142,7 @@ typedef struct USBMSDREQ
     /** The state of the request. */
     USBMSDREQSTATE      enmState;
     /** The size of the data buffer. */
-    size_t              cbBuf;
+    uint32_t            cbBuf;
     /** Pointer to the data buffer. */
     uint8_t            *pbBuf;
     /** Current buffer offset. */
@@ -152,10 +157,6 @@ typedef struct USBMSDREQ
     uint8_t             ScsiReqSense[64];
     /** The status of a completed SCSI request. */
     int                 iScsiReqStatus;
-    /** Set if the request structure must be destroyed when the SCSI driver
-     * completes it.  This is used to deal with requests that runs while the
-     * device is being reset. */
-    bool                fDestoryOnCompletion;
     /** Pointer to the USB device instance owning it. */
     PPDMUSBINS          pUsbIns;
 } USBMSDREQ;
@@ -236,6 +237,9 @@ typedef struct USBMSD
     /** The reset URB.
      * This is waiting for SCSI request completion before finishing the reset. */
     PVUSBURB            pResetUrb;
+    /** Indicates that PDMUsbHlpAsyncNotificationCompleted should be called when
+     * the MSD is entering the idle state. */
+    volatile bool       fSignalIdle;
 
     /**
      * LUN\#0 data.
@@ -286,7 +290,9 @@ static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsFS[2] =
         },
         /* .pvMore = */     NULL,
         /* .pvClass = */    NULL,
-        /* .cbClass = */    0
+        /* .cbClass = */    0,
+        /* .pvSsepc = */    NULL,
+        /* .cbSsepc = */    0
     },
     {
         {
@@ -299,7 +305,9 @@ static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsFS[2] =
         },
         /* .pvMore = */     NULL,
         /* .pvClass = */    NULL,
-        /* .cbClass = */    0
+        /* .cbClass = */    0,
+        /* .pvSsepc = */    NULL,
+        /* .cbSsepc = */    0
     }
 };
 
@@ -316,7 +324,9 @@ static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsHS[2] =
         },
         /* .pvMore = */     NULL,
         /* .pvClass = */    NULL,
-        /* .cbClass = */    0
+        /* .cbClass = */    0,
+        /* .pvSsepc = */    NULL,
+        /* .cbSsepc = */    0
     },
     {
         {
@@ -329,7 +339,52 @@ static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsHS[2] =
         },
         /* .pvMore = */     NULL,
         /* .pvClass = */    NULL,
-        /* .cbClass = */    0
+        /* .cbClass = */    0,
+        /* .pvSsepc = */    NULL,
+        /* .cbSsepc = */    0
+    }
+};
+
+static const VUSBDESCSSEPCOMPANION g_aUsbMsdEpCompanionSS =
+{
+    /* .bLength = */            sizeof(VUSBDESCSSEPCOMPANION),
+    /* .bDescriptorType = */    VUSB_DT_SS_ENDPOINT_COMPANION,
+    /* .bMaxBurst = */          15  /* we can burst all the way */,
+    /* .bmAttributes = */       0   /* no streams */,
+    /* .wBytesPerInterval = */  0   /* not a periodic endpoint */
+};
+
+static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsSS[2] =
+{
+    {
+        {
+            /* .bLength = */            sizeof(VUSBDESCENDPOINT),
+            /* .bDescriptorType = */    VUSB_DT_ENDPOINT,
+            /* .bEndpointAddress = */   0x81 /* ep=1, in */,
+            /* .bmAttributes = */       2 /* bulk */,
+            /* .wMaxPacketSize = */     1024 /* SS bulk packet size */,
+            /* .bInterval = */          0 /* no NAKs */
+        },
+        /* .pvMore = */     NULL,
+        /* .pvClass = */    NULL,
+        /* .cbClass = */    0,
+        /* .pvSsepc = */    &g_aUsbMsdEpCompanionSS,
+        /* .cbSsepc = */    sizeof(g_aUsbMsdEpCompanionSS)
+    },
+    {
+        {
+            /* .bLength = */            sizeof(VUSBDESCENDPOINT),
+            /* .bDescriptorType = */    VUSB_DT_ENDPOINT,
+            /* .bEndpointAddress = */   0x02 /* ep=2, out */,
+            /* .bmAttributes = */       2 /* bulk */,
+            /* .wMaxPacketSize = */     1024 /* SS bulk packet size */,
+            /* .bInterval = */          0 /* no NAKs */
+        },
+        /* .pvMore = */     NULL,
+        /* .pvClass = */    NULL,
+        /* .cbClass = */    0,
+        /* .pvSsepc = */    &g_aUsbMsdEpCompanionSS,
+        /* .cbSsepc = */    sizeof(g_aUsbMsdEpCompanionSS)
     }
 };
 
@@ -375,6 +430,27 @@ static const VUSBDESCINTERFACEEX g_UsbMsdInterfaceDescHS =
     /* .cbIAD = */ 0
 };
 
+static const VUSBDESCINTERFACEEX g_UsbMsdInterfaceDescSS =
+{
+    {
+        /* .bLength = */                sizeof(VUSBDESCINTERFACE),
+        /* .bDescriptorType = */        VUSB_DT_INTERFACE,
+        /* .bInterfaceNumber = */       0,
+        /* .bAlternateSetting = */      0,
+        /* .bNumEndpoints = */          2,
+        /* .bInterfaceClass = */        8 /* Mass Storage */,
+        /* .bInterfaceSubClass = */     6 /* SCSI transparent command set */,
+        /* .bInterfaceProtocol = */     0x50 /* Bulk-Only Transport */,
+        /* .iInterface = */             0
+    },
+    /* .pvMore = */     NULL,
+    /* .pvClass = */    NULL,
+    /* .cbClass = */    0,
+    &g_aUsbMsdEndpointDescsSS[0],
+    /* .pIAD = */ NULL,
+    /* .cbIAD = */ 0
+};
+
 static const VUSBINTERFACE g_aUsbMsdInterfacesFS[] =
 {
     { &g_UsbMsdInterfaceDescFS, /* .cSettings = */ 1 },
@@ -385,6 +461,11 @@ static const VUSBINTERFACE g_aUsbMsdInterfacesHS[] =
     { &g_UsbMsdInterfaceDescHS, /* .cSettings = */ 1 },
 };
 
+static const VUSBINTERFACE g_aUsbMsdInterfacesSS[] =
+{
+    { &g_UsbMsdInterfaceDescSS, /* .cSettings = */ 1 },
+};
+
 static const VUSBDESCCONFIGEX g_UsbMsdConfigDescFS =
 {
     {
@@ -419,9 +500,26 @@ static const VUSBDESCCONFIGEX g_UsbMsdConfigDescHS =
     NULL                            /* pvOriginal */
 };
 
-static const VUSBDESCDEVICE g_UsbMsdDeviceDesc =
+static const VUSBDESCCONFIGEX g_UsbMsdConfigDescSS =
+{
+    {
+        /* .bLength = */            sizeof(VUSBDESCCONFIG),
+        /* .bDescriptorType = */    VUSB_DT_CONFIG,
+        /* .wTotalLength = */       0 /* recalculated on read */,
+        /* .bNumInterfaces = */     RT_ELEMENTS(g_aUsbMsdInterfacesSS),
+        /* .bConfigurationValue =*/ 1,
+        /* .iConfiguration = */     0,
+        /* .bmAttributes = */       RT_BIT(7),
+        /* .MaxPower = */           50 /* 100mA */
+    },
+    NULL,                           /* pvMore */
+    &g_aUsbMsdInterfacesSS[0],
+    NULL                            /* pvOriginal */
+};
+
+static const VUSBDESCDEVICE g_UsbMsdDeviceDesc20 =
 {
-    /* .bLength = */                sizeof(g_UsbMsdDeviceDesc),
+    /* .bLength = */                sizeof(g_UsbMsdDeviceDesc20),
     /* .bDescriptorType = */        VUSB_DT_DEVICE,
     /* .bcdUsb = */                 0x200, /* USB 2.0 */
     /* .bDeviceClass = */           0 /* Class specified in the interface desc. */,
@@ -437,6 +535,24 @@ static const VUSBDESCDEVICE g_UsbMsdDeviceDesc =
     /* .bNumConfigurations = */     1
 };
 
+static const VUSBDESCDEVICE g_UsbMsdDeviceDesc30 =
+{
+    /* .bLength = */                sizeof(g_UsbMsdDeviceDesc30),
+    /* .bDescriptorType = */        VUSB_DT_DEVICE,
+    /* .bcdUsb = */                 0x300, /* USB 2.0 */
+    /* .bDeviceClass = */           0 /* Class specified in the interface desc. */,
+    /* .bDeviceSubClass = */        0 /* Subclass specified in the interface desc. */,
+    /* .bDeviceProtocol = */        0 /* Protocol specified in the interface desc. */,
+    /* .bMaxPacketSize0 = */        9 /* 512, the only option for USB3. */,
+    /* .idVendor = */               VBOX_USB_VENDOR,
+    /* .idProduct = */              USBMSD_PID_HD,
+    /* .bcdDevice = */              0x0110, /* 1.10 */
+    /* .iManufacturer = */          USBMSD_STR_ID_MANUFACTURER,
+    /* .iProduct = */               USBMSD_STR_ID_PRODUCT_HD,
+    /* .iSerialNumber = */          0,
+    /* .bNumConfigurations = */     1
+};
+
 static const VUSBDEVICEQUALIFIER g_UsbMsdDeviceQualifier =
 {
     /* .bLength = */                sizeof(g_UsbMsdDeviceQualifier),
@@ -450,9 +566,32 @@ static const VUSBDEVICEQUALIFIER g_UsbMsdDeviceQualifier =
     /* .bReserved = */              0
 };
 
+static const struct {
+    VUSBDESCBOS         bos;
+    VUSBDESCSSDEVCAP    sscap;
+} g_UsbMsdBOS =
+{
+    {
+        /* .bLength = */                sizeof(g_UsbMsdBOS.bos),
+        /* .bDescriptorType = */        VUSB_DT_BOS,
+        /* .wTotalLength = */           sizeof(g_UsbMsdBOS),
+        /* .bNumDeviceCaps = */         1
+    },
+    {
+        /* .bLength = */                sizeof(VUSBDESCSSDEVCAP),
+        /* .bDescriptorType = */        VUSB_DT_DEVICE_CAPABILITY,
+        /* .bDevCapabilityType = */     VUSB_DCT_SUPERSPEED_USB,
+        /* .bmAttributes = */           0   /* No LTM. */,
+        /* .wSpeedsSupported = */       0xe /* Any speed is good. */,
+        /* .bFunctionalitySupport = */  2   /* Want HS at least. */,
+        /* .bU1DevExitLat = */          0,  /* We are blazingly fast. */
+        /* .wU2DevExitLat = */          0
+    }
+};
+
 static const PDMUSBDESCCACHE g_UsbMsdDescCacheFS =
 {
-    /* .pDevice = */                &g_UsbMsdDeviceDesc,
+    /* .pDevice = */                &g_UsbMsdDeviceDesc20,
     /* .paConfigs = */              &g_UsbMsdConfigDescFS,
     /* .paLanguages = */            g_aUsbMsdLanguages,
     /* .cLanguages = */             RT_ELEMENTS(g_aUsbMsdLanguages),
@@ -462,7 +601,7 @@ static const PDMUSBDESCCACHE g_UsbMsdDescCacheFS =
 
 static const PDMUSBDESCCACHE g_UsbMsdDescCacheHS =
 {
-    /* .pDevice = */                &g_UsbMsdDeviceDesc,
+    /* .pDevice = */                &g_UsbMsdDeviceDesc20,
     /* .paConfigs = */              &g_UsbMsdConfigDescHS,
     /* .paLanguages = */            g_aUsbMsdLanguages,
     /* .cLanguages = */             RT_ELEMENTS(g_aUsbMsdLanguages),
@@ -470,6 +609,15 @@ static const PDMUSBDESCCACHE g_UsbMsdDescCacheHS =
     /* .fUseCachedStringsDescriptors = */ true
 };
 
+static const PDMUSBDESCCACHE g_UsbMsdDescCacheSS =
+{
+    /* .pDevice = */                &g_UsbMsdDeviceDesc30,
+    /* .paConfigs = */              &g_UsbMsdConfigDescSS,
+    /* .paLanguages = */            g_aUsbMsdLanguages,
+    /* .cLanguages = */             RT_ELEMENTS(g_aUsbMsdLanguages),
+    /* .fUseCachedDescriptors = */  true,
+    /* .fUseCachedStringsDescriptors = */ true
+};
 
 /*******************************************************************************
 *   Internal Functions                                                         *
@@ -693,7 +841,7 @@ static void usbMsdReqPrepare(PUSBMSDREQ pReq, PCUSBCBW pCbw)
  * @param   pReq
  * @param   cbBuf       The required buffer space.
  */
-static int usbMsdReqEnsureBuffer(PUSBMSDREQ pReq, size_t cbBuf)
+static int usbMsdReqEnsureBuffer(PUSBMSDREQ pReq, uint32_t cbBuf)
 {
     if (RT_LIKELY(pReq->cbBuf >= cbBuf))
         RT_BZERO(pReq->pbBuf, cbBuf);
@@ -918,6 +1066,27 @@ static DECLCALLBACK(int) usbMsdLun0ScsiRequestCompleted(PPDMISCSIPORT pInterface
 
 
 /**
+ * @interface_method_impl{PDMISCSIPORT,pfnQueryDeviceLocation}
+ */
+static DECLCALLBACK(int) usbMsdLun0QueryDeviceLocation(PPDMISCSIPORT pInterface, const char **ppcszController,
+                                                       uint32_t *piInstance, uint32_t *piLUN)
+{
+    PUSBMSD    pThis = RT_FROM_MEMBER(pInterface, USBMSD, Lun0.IScsiPort);
+    PPDMUSBINS pUsbIns = pThis->pUsbIns;
+
+    AssertPtrReturn(ppcszController, VERR_INVALID_POINTER);
+    AssertPtrReturn(piInstance, VERR_INVALID_POINTER);
+    AssertPtrReturn(piLUN, VERR_INVALID_POINTER);
+
+    *ppcszController = pUsbIns->pReg->szName;
+    *piInstance = pUsbIns->iInstance;
+    *piLUN = 0;
+
+    return VINF_SUCCESS;
+}
+
+
+/**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
 static DECLCALLBACK(void *) usbMsdLun0QueryInterface(PPDMIBASE pInterface, const char *pszIID)
@@ -930,6 +1099,234 @@ static DECLCALLBACK(void *) usbMsdLun0QueryInterface(PPDMIBASE pInterface, const
 
 
 /**
+ * Checks if all asynchronous I/O is finished.
+ *
+ * Used by usbMsdVMReset, usbMsdVMSuspend and usbMsdVMPowerOff.
+ *
+ * @returns true if quiesced, false if busy.
+ * @param   pUsbIns         The USB device instance.
+ */
+static bool usbMsdAllAsyncIOIsFinished(PPDMUSBINS pUsbIns)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+
+    if (   VALID_PTR(pThis->pReq)
+        && pThis->pReq->enmState == USBMSDREQSTATE_EXECUTING)
+        return false;
+
+    return true;
+}
+
+/**
+ * @callback_method_impl{FNPDMDEVASYNCNOTIFY,
+ * Callback employed by usbMsdVMSuspend and usbMsdVMPowerOff.}
+ */
+static DECLCALLBACK(bool) usbMsdIsAsyncSuspendOrPowerOffDone(PPDMUSBINS pUsbIns)
+{
+    if (!usbMsdAllAsyncIOIsFinished(pUsbIns))
+        return false;
+
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+    ASMAtomicWriteBool(&pThis->fSignalIdle, false);
+    return true;
+}
+
+/**
+ * Common worker for usbMsdVMSuspend and usbMsdVMPowerOff.
+ */
+static void usbMsdSuspendOrPowerOff(PPDMUSBINS pUsbIns)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+
+    ASMAtomicWriteBool(&pThis->fSignalIdle, true);
+    if (!usbMsdAllAsyncIOIsFinished(pUsbIns))
+        PDMUsbHlpSetAsyncNotification(pUsbIns, usbMsdIsAsyncSuspendOrPowerOffDone);
+    else
+        ASMAtomicWriteBool(&pThis->fSignalIdle, false);
+}
+
+
+/* -=-=-=-=- Saved State -=-=-=-=- */
+
+/**
+ * @copydoc FNUSBSSMSAVEPREP
+ */
+static DECLCALLBACK(int) usbMsdSavePrep(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+
+    Assert(usbMsdAllAsyncIOIsFinished(pUsbIns));
+    Assert(usbMsdQueueIsEmpty(&pThis->ToHostQueue));
+    Assert(usbMsdQueueIsEmpty(&pThis->DoneQueue));
+    return VINF_SUCCESS;
+}
+
+/**
+ * @copydoc FNUSBSSMLOADPREP
+ */
+static DECLCALLBACK(int) usbMsdLoadPrep(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+
+    Assert(usbMsdAllAsyncIOIsFinished(pUsbIns));
+    Assert(usbMsdQueueIsEmpty(&pThis->ToHostQueue));
+    Assert(usbMsdQueueIsEmpty(&pThis->DoneQueue));
+    return VINF_SUCCESS;
+}
+
+/**
+ * @copydoc FNUSBSSMLIVEEXEC
+ */
+static DECLCALLBACK(int) usbMsdLiveExec(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM, uint32_t uPass)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+
+    /* config. */
+    SSMR3PutBool(pSSM, pThis->Lun0.pIBase != NULL);
+    return VINF_SSM_DONT_CALL_AGAIN;
+}
+
+/**
+ * @copydoc FNUSBSSMSAVEEXEC
+ */
+static DECLCALLBACK(int) usbMsdSaveExec(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+    int rc;
+
+    /* The config */
+    rc = usbMsdLiveExec(pUsbIns, pSSM, SSM_PASS_FINAL);
+    AssertRCReturn(rc, rc);
+
+    SSMR3PutU8(pSSM, pThis->bConfigurationValue);
+    SSMR3PutBool(pSSM, pThis->aEps[0].fHalted);
+    SSMR3PutBool(pSSM, pThis->aEps[1].fHalted);
+    SSMR3PutBool(pSSM, pThis->aEps[2].fHalted);
+    SSMR3PutBool(pSSM, pThis->pReq != NULL);
+
+    if (pThis->pReq)
+    {
+        PUSBMSDREQ pReq = pThis->pReq;
+
+        SSMR3PutU32(pSSM, pReq->enmState);
+        SSMR3PutU32(pSSM, pReq->cbBuf);
+        if (pReq->cbBuf)
+        {
+            AssertPtr(pReq->pbBuf);
+            SSMR3PutMem(pSSM, pReq->pbBuf, pReq->cbBuf);
+        }
+
+        SSMR3PutU32(pSSM, pReq->offBuf);
+        SSMR3PutMem(pSSM, &pReq->Cbw, sizeof(pReq->Cbw));
+        SSMR3PutU32(pSSM, pReq->ScsiReq.uLogicalUnit);
+        SSMR3PutU32(pSSM, pReq->ScsiReq.uDataDirection);
+        SSMR3PutU32(pSSM, pReq->ScsiReq.cbCDB);
+        SSMR3PutU32(pSSM, pReq->ScsiReq.cbScatterGather);
+        SSMR3PutMem(pSSM, &pReq->ScsiReqSense[0], sizeof(pReq->ScsiReqSense));
+        SSMR3PutS32(pSSM, pReq->iScsiReqStatus);
+    }
+
+    return SSMR3PutU32(pSSM, UINT32_MAX); /* sanity/terminator */
+}
+
+/**
+ * @copydoc FNUSBSSMLOADEXEC
+ */
+static DECLCALLBACK(int) usbMsdLoadExec(PPDMUSBINS pUsbIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+    uint32_t u32;
+    int rc;
+
+    if (uVersion > USB_MSD_SAVED_STATE_VERSION)
+        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+
+    /* Verify config. */
+    bool fInUse;
+    rc = SSMR3GetBool(pSSM, &fInUse);
+    AssertRCReturn(rc, rc);
+    if (fInUse != (pThis->Lun0.pIBase != NULL))
+        return SSMR3SetCfgError(pSSM, RT_SRC_POS,
+                                N_("The %s VM is missing a USB mass storage device. Please make sure the source and target VMs have compatible storage configurations"),
+                                fInUse ? "target" : "source");
+
+    if (uPass == SSM_PASS_FINAL)
+    {
+        /* Restore data. */
+        bool fReqAlloc = false;
+
+        Assert(!pThis->pReq);
+
+        SSMR3GetU8(pSSM, &pThis->bConfigurationValue);
+        SSMR3GetBool(pSSM, &pThis->aEps[0].fHalted);
+        SSMR3GetBool(pSSM, &pThis->aEps[1].fHalted);
+        SSMR3GetBool(pSSM, &pThis->aEps[2].fHalted);
+        SSMR3GetBool(pSSM, &fReqAlloc);
+
+        if (fReqAlloc)
+        {
+            PUSBMSDREQ pReq = usbMsdReqAlloc(pUsbIns);
+
+            if (pReq)
+            {
+                uint32_t cbBuf = 0;
+
+                pThis->pReq = pReq;
+
+                SSMR3GetU32(pSSM, (uint32_t *)&pReq->enmState);
+                SSMR3GetU32(pSSM, &cbBuf);
+                if (cbBuf)
+                {
+                    if (usbMsdReqEnsureBuffer(pReq, cbBuf))
+                    {
+                        AssertPtr(pReq->pbBuf);
+                        Assert(cbBuf == pReq->cbBuf);
+                        SSMR3GetMem(pSSM, pReq->pbBuf, pReq->cbBuf);
+                    }
+                    else
+                        rc = VERR_NO_MEMORY;
+                }
+
+                if (RT_SUCCESS(rc))
+                {
+                    SSMR3GetU32(pSSM, &pReq->offBuf);
+                    SSMR3GetMem(pSSM, &pReq->Cbw, sizeof(pReq->Cbw));
+                    SSMR3GetU32(pSSM, &pReq->ScsiReq.uLogicalUnit);
+                    SSMR3GetU32(pSSM, (uint32_t *)&pReq->ScsiReq.uDataDirection);
+                    SSMR3GetU32(pSSM, &pReq->ScsiReq.cbCDB);
+                    SSMR3GetU32(pSSM, &pReq->ScsiReq.cbScatterGather);
+                    SSMR3GetMem(pSSM, &pReq->ScsiReqSense[0], sizeof(pReq->ScsiReqSense));
+                    SSMR3GetS32(pSSM, &pReq->iScsiReqStatus);
+
+                    /* Setup the rest of the SCSI request. */
+                    pReq->ScsiReq.cbCDB             = pReq->Cbw.bCBWCBLength;
+                    pReq->ScsiReq.pbCDB             = &pReq->Cbw.CBWCB[0];
+                    pReq->ScsiReqSeg.pvSeg          = pReq->pbBuf;
+                    pReq->ScsiReqSeg.cbSeg          = pReq->ScsiReq.cbScatterGather;
+                    pReq->ScsiReq.cScatterGatherEntries = 1;
+                    pReq->ScsiReq.paScatterGatherHead = &pReq->ScsiReqSeg;
+                    pReq->ScsiReq.cbSenseBuffer     = sizeof(pReq->ScsiReqSense);
+                    pReq->ScsiReq.pbSenseBuffer     = &pReq->ScsiReqSense[0];
+                    pReq->ScsiReq.pvUser            = NULL;
+                }
+            }
+            else
+                rc = VERR_NO_MEMORY;
+        }
+
+        if (RT_SUCCESS(rc))
+            rc = SSMR3GetU32(pSSM, &u32);
+
+        if (RT_FAILURE(rc))
+            return rc;
+        AssertMsgReturn(u32 == UINT32_MAX, ("%#x\n", u32), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/**
  * @copydoc PDMUSBREG::pfnUrbReap
  */
 static DECLCALLBACK(PVUSBURB) usbMsdUrbReap(PPDMUSBINS pUsbIns, RTMSINTERVAL cMillies)
@@ -1269,7 +1666,6 @@ static int usbMsdHandleBulkHostToDev(PUSBMSD pThis, PUSBMSDEP pEp, PVUSBURB pUrb
                     return usbMsdCompleteStall(pThis, NULL, pUrb, "SCSI Submit #2");
                 }
             }
-LogRel(("DATA_FROM_HOST: %d bytes\n", cbData));
             return usbMsdCompleteOk(pThis, pUrb, cbData);
         }
 
@@ -1330,7 +1726,6 @@ static int usbMsdHandleBulkDevToHost(PUSBMSD pThis, PUSBMSDEP pEp, PVUSBURB pUrb
                 Log(("usbMsdHandleBulkDevToHost: Entering STATUS\n"));
                 pReq->enmState = USBMSDREQSTATE_STATUS;
             }
-LogRel(("DATA_TO_HOST: %d bytes\n", cbCopy));
             return usbMsdCompleteOk(pThis, pUrb, cbCopy);
         }
 
@@ -1469,6 +1864,13 @@ static int usbMsdHandleDefaultPipe(PUSBMSD pThis, PUSBMSDEP pEp, PVUSBURB pUrb)
                         cbCopy = RT_MIN(cbCopy, sizeof(g_UsbMsdDeviceQualifier));
                         memcpy(&pUrb->abData[sizeof(*pSetup)], &g_UsbMsdDeviceQualifier, cbCopy);
                         return usbMsdCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
+                    case VUSB_DT_BOS:
+                        Log(("usbMsd: GET_DESCRIPTOR DT_BOS wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));
+                        /* Returned data is written after the setup message. */
+                        cbCopy = pUrb->cbData - sizeof(*pSetup);
+                        cbCopy = RT_MIN(cbCopy, sizeof(g_UsbMsdBOS));
+                        memcpy(&pUrb->abData[sizeof(*pSetup)], &g_UsbMsdBOS, cbCopy);
+                        return usbMsdCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
                     default:
                         Log(("usbMsd: GET_DESCRIPTOR, huh? wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));
                         break;
@@ -1617,7 +2019,9 @@ static DECLCALLBACK(PCPDMUSBDESCCACHE) usbMsdUsbGetDescriptorCache(PPDMUSBINS pU
 {
     PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
     LogFlow(("usbMsdUsbGetDescriptorCache/#%u:\n", pUsbIns->iInstance));
-    if (pThis->pUsbIns->iUsbHubVersion & VUSB_STDVER_20)
+    if (pThis->pUsbIns->enmSpeed == VUSB_SPEED_SUPER)
+        return &g_UsbMsdDescCacheSS;
+    else if (pThis->pUsbIns->enmSpeed == VUSB_SPEED_HIGH)
         return &g_UsbMsdDescCacheHS;
     else
         return &g_UsbMsdDescCacheFS;
@@ -1641,6 +2045,124 @@ static DECLCALLBACK(int) usbMsdUsbReset(PPDMUSBINS pUsbIns, bool fResetOnLinux)
 
 
 /**
+ * @copydoc PDMUSBREG::pfnVMSuspend
+ */
+static DECLCALLBACK(void) usbMsdVMSuspend(PPDMUSBINS pUsbIns)
+{
+    LogFlow(("usbMsdVMSuspend/#%u:\n", pUsbIns->iInstance));
+    usbMsdSuspendOrPowerOff(pUsbIns);
+}
+
+
+/**
+ * @copydoc PDMUSBREG::pfnVMSuspend
+ */
+static DECLCALLBACK(void) usbMsdVMPowerOff(PPDMUSBINS pUsbIns)
+{
+    LogFlow(("usbMsdVMPowerOff/#%u:\n", pUsbIns->iInstance));
+    usbMsdSuspendOrPowerOff(pUsbIns);
+}
+
+
+/**
+ * @copydoc PDMUSBREG::pfnDriverAttach
+ */
+static DECLCALLBACK(int) usbMsdDriverAttach(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+    int rc;
+
+    LogFlow(("usbMsdDetach/#%u:\n", pUsbIns->iInstance));
+
+    AssertMsg(iLUN == 0, ("UsbMsd: No other LUN than 0 is supported\n"));
+    AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
+              ("UsbMsd: Device does not support hotplugging\n"));
+
+    /* the usual paranoia */
+    AssertRelease(!pThis->Lun0.pIBase);
+    AssertRelease(!pThis->Lun0.pIScsiConnector);
+
+    /*
+     * Try attach the block device and get the interfaces,
+     * required as well as optional.
+     */
+    rc = PDMUsbHlpDriverAttach(pUsbIns, iLUN, &pThis->Lun0.IBase, &pThis->Lun0.pIBase, NULL);
+    if (RT_SUCCESS(rc))
+    {
+        /* Get SCSI connector interface. */
+        pThis->Lun0.pIScsiConnector = PDMIBASE_QUERY_INTERFACE(pThis->Lun0.pIBase, PDMISCSICONNECTOR);
+        AssertMsgReturn(pThis->Lun0.pIScsiConnector, ("Missing SCSI interface below\n"), VERR_PDM_MISSING_INTERFACE);
+    }
+    else
+        AssertMsgFailed(("Failed to attach LUN#%d. rc=%Rrc\n", iLUN, rc));
+
+    if (RT_FAILURE(rc))
+    {
+        pThis->Lun0.pIBase = NULL;
+        pThis->Lun0.pIScsiConnector = NULL;
+    }
+    return rc;
+}
+
+
+/**
+ * @copydoc PDMUSBREG::pfnDriverDetach
+ */
+static DECLCALLBACK(void) usbMsdDriverDetach(PPDMUSBINS pUsbIns, unsigned iLUN, uint32_t fFlags)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+
+    LogFlow(("usbMsdDetach/#%u:\n", pUsbIns->iInstance));
+
+    AssertMsg(iLUN == 0, ("UsbMsd: No other LUN than 0 is supported\n"));
+    AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,
+              ("UsbMsd: Device does not support hotplugging\n"));
+
+    /*
+     * Zero some important members.
+     */
+    pThis->Lun0.pIBase = NULL;
+    pThis->Lun0.pIScsiConnector = NULL;
+}
+
+
+/**
+ * @callback_method_impl{FNPDMDEVASYNCNOTIFY,
+ * Callback employed by usbMsdVMReset.}
+ */
+static DECLCALLBACK(bool) usbMsdIsAsyncResetDone(PPDMUSBINS pUsbIns)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+
+    if (!usbMsdAllAsyncIOIsFinished(pUsbIns))
+        return false;
+    ASMAtomicWriteBool(&pThis->fSignalIdle, false);
+
+    int rc = usbMsdResetWorker(pThis, NULL, false /*fSetConfig*/);
+    AssertRC(rc);
+    return true;
+}
+
+/**
+ * @interface_method_impl{PDMDEVREG,pfnReset}
+ */
+static DECLCALLBACK(void) usbMsdVMReset(PPDMUSBINS pUsbIns)
+{
+    PUSBMSD pThis = PDMINS_2_DATA(pUsbIns, PUSBMSD);
+
+    ASMAtomicWriteBool(&pThis->fSignalIdle, true);
+    if (!usbMsdAllAsyncIOIsFinished(pUsbIns))
+        PDMUsbHlpSetAsyncNotification(pUsbIns, usbMsdIsAsyncResetDone);
+    else
+    {
+        ASMAtomicWriteBool(&pThis->fSignalIdle, false);
+        int rc = usbMsdResetWorker(pThis, NULL, false /*fSetConfig*/);
+        AssertRC(rc);
+    }
+}
+
+
+/**
  * @copydoc PDMUSBREG::pfnDestruct
  */
 static void usbMsdDestruct(PPDMUSBINS pUsbIns)
@@ -1692,6 +2214,7 @@ static DECLCALLBACK(int) usbMsdConstruct(PPDMUSBINS pUsbIns, int iInstance, PCFG
     pThis->hEvtReset                                = NIL_RTSEMEVENTMULTI;
     pThis->Lun0.IBase.pfnQueryInterface             = usbMsdLun0QueryInterface;
     pThis->Lun0.IScsiPort.pfnSCSIRequestCompleted   = usbMsdLun0ScsiRequestCompleted;
+    pThis->Lun0.IScsiPort.pfnQueryDeviceLocation    = usbMsdLun0QueryDeviceLocation;
     usbMsdQueueInit(&pThis->ToHostQueue);
     usbMsdQueueInit(&pThis->DoneQueue);
 
@@ -1722,6 +2245,17 @@ static DECLCALLBACK(int) usbMsdConstruct(PPDMUSBINS pUsbIns, int iInstance, PCFG
         return PDMUsbHlpVMSetError(pUsbIns, VERR_PDM_MISSING_INTERFACE_BELOW, RT_SRC_POS,
                                    N_("MSD failed to query the PDMISCSICONNECTOR from the driver below it"));
 
+    /*
+     * Register the saved state data unit.
+     */
+    rc = PDMUsbHlpSSMRegister(pUsbIns, USB_MSD_SAVED_STATE_VERSION, sizeof(*pThis),
+                              NULL,           usbMsdLiveExec, NULL,
+                              usbMsdSavePrep, usbMsdSaveExec, NULL,
+                              usbMsdLoadPrep, usbMsdLoadExec, NULL);
+    if (RT_FAILURE(rc))
+        return PDMUsbHlpVMSetError(pUsbIns, rc, RT_SRC_POS,
+                                   N_("MSD failed to register SSM save state handlers"));
+
     return VINF_SUCCESS;
 }
 
@@ -1738,7 +2272,7 @@ const PDMUSBREG g_UsbMsd =
     /* pszDescription */
     "USB Mass Storage Device, one LUN.",
     /* fFlags */
-    PDM_USBREG_HIGHSPEED_CAPABLE,
+    PDM_USBREG_HIGHSPEED_CAPABLE | PDM_USBREG_SUPERSPEED_CAPABLE | PDM_USBREG_EMULATED_DEVICE,
     /* cMaxInstances */
     ~0U,
     /* cbInstance */
@@ -1752,21 +2286,21 @@ const PDMUSBREG g_UsbMsd =
     /* pfnVMPowerOn */
     NULL,
     /* pfnVMReset */
-    NULL,
+    usbMsdVMReset,
     /* pfnVMSuspend */
-    NULL,
+    usbMsdVMSuspend,
     /* pfnVMResume */
     NULL,
     /* pfnVMPowerOff */
-    NULL,
+    usbMsdVMPowerOff,
     /* pfnHotPlugged */
     NULL,
     /* pfnHotUnplugged */
     NULL,
     /* pfnDriverAttach */
-    NULL,
+    usbMsdDriverAttach,
     /* pfnDriverDetach */
-    NULL,
+    usbMsdDriverDetach,
     /* pfnQueryInterface */
     NULL,
     /* pfnUsbReset */
diff --git a/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h b/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h
index 8e08657..c5550f1 100644
--- a/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h
+++ b/src/VBox/Devices/Storage/VSCSI/VSCSIInternal.h
@@ -244,7 +244,7 @@ void vscsiSenseInit(PVSCSISENSE pVScsiSense);
 int vscsiReqSenseOkSet(PVSCSISENSE pVScsiSense, PVSCSIREQINT pVScsiReq);
 
 /**
- * Sets a error sense code.
+ * Sets an error sense code.
  *
  * @returns SCSI status code.
  * @param   pVScsiSense   The SCSI sense state to use.
@@ -257,6 +257,20 @@ int vscsiReqSenseErrorSet(PVSCSISENSE pVScsiSense, PVSCSIREQINT pVScsiReq, uint8
                           uint8_t uSCSIASC, uint8_t uSCSIASCQ);
 
 /**
+ * Sets an error sense code with additional information.
+ *
+ * @returns SCSI status code.
+ * @param   pVScsiSense   The SCSI sense state to use.
+ * @param   pVScsiReq     The SCSI request.
+ * @param   uSCSISenseKey The SCSI sense key to set.
+ * @param   uSCSIASC      The ASC value.
+ * @param   uSCSIASC      The ASCQ value.
+ * @param   uInfo         The 32-bit sense information.
+ */
+int vscsiReqSenseErrorInfoSet(PVSCSISENSE pVScsiSense, PVSCSIREQINT pVScsiReq, uint8_t uSCSISenseKey,
+                              uint8_t uSCSIASC, uint8_t uSCSIASCQ, uint32_t uInfo);
+
+/**
  * Process a request sense command.
  *
  * @returns SCSI status code.
@@ -434,6 +448,13 @@ DECLINLINE(int) vscsiLunReqSenseErrorSet(PVSCSILUNINT pVScsiLun, PVSCSIREQINT pV
     return vscsiReqSenseErrorSet(&pVScsiLun->pVScsiDevice->VScsiSense, pVScsiReq, uSCSISenseKey, uSCSIASC, uSCSIASCQ);
 }
 
+/**
+ * Wrapper around vscsiReqSenseErrorInfoSet()
+ */
+DECLINLINE(int) vscsiLunReqSenseErrorInfoSet(PVSCSILUNINT pVScsiLun, PVSCSIREQINT pVScsiReq, uint8_t uSCSISenseKey, uint8_t uSCSIASC, uint8_t uSCSIASCQ, uint32_t uInfo)
+{
+    return vscsiReqSenseErrorInfoSet(&pVScsiLun->pVScsiDevice->VScsiSense, pVScsiReq, uSCSISenseKey, uSCSIASC, uSCSIASCQ, uInfo);
+}
 
 #endif /* ___VSCSIInternal_h */
 
diff --git a/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp b/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp
index d5a3e68..12a9473 100644
--- a/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp
+++ b/src/VBox/Devices/Storage/VSCSI/VSCSILunSbc.cpp
@@ -496,9 +496,7 @@ static int vscsiLunSbcReqProcess(PVSCSILUNINT pVScsiLun, PVSCSIREQINT pVScsiReq)
 
                     if (cBlkDesc)
                     {
-                        PRTRANGE paRanges;
-
-                        paRanges = (PRTRANGE)RTMemAllocZ(cBlkDesc * sizeof(RTRANGE));
+                        PRTRANGE paRanges = (PRTRANGE)RTMemAllocZ(cBlkDesc * sizeof(RTRANGE));
                         if (paRanges)
                         {
                             for (unsigned i = 0; i < cBlkDesc; i++)
@@ -518,6 +516,9 @@ static int vscsiLunSbcReqProcess(PVSCSILUNINT pVScsiLun, PVSCSIREQINT pVScsiReq)
 
                             if (rcReq == SCSI_STATUS_OK)
                                 rc = vscsiIoReqUnmapEnqueue(pVScsiLun, pVScsiReq, paRanges, cBlkDesc);
+                            if (   rcReq != SCSI_STATUS_OK
+                                || RT_FAILURE(rc))
+                                RTMemFree(paRanges);
                         }
                         else /* Out of memory. */
                             rcReq = vscsiLunReqSenseErrorSet(pVScsiLun, pVScsiReq, SCSI_SENSE_HARDWARE_ERROR, SCSI_ASC_SYSTEM_RESOURCE_FAILURE,
diff --git a/src/VBox/Devices/Storage/VSCSI/VSCSISense.cpp b/src/VBox/Devices/Storage/VSCSI/VSCSISense.cpp
index 673ee0b..1541cb2 100644
--- a/src/VBox/Devices/Storage/VSCSI/VSCSISense.cpp
+++ b/src/VBox/Devices/Storage/VSCSI/VSCSISense.cpp
@@ -63,6 +63,22 @@ int vscsiReqSenseErrorSet(PVSCSISENSE pVScsiSense, PVSCSIREQINT pVScsiReq, uint8
     return SCSI_STATUS_CHECK_CONDITION;
 }
 
+int vscsiReqSenseErrorInfoSet(PVSCSISENSE pVScsiSense, PVSCSIREQINT pVScsiReq, uint8_t uSCSISenseKey, uint8_t uSCSIASC, uint8_t uSCSIASCQ, uint32_t uInfo)
+{
+    memset(pVScsiSense->abSenseBuf, 0, sizeof(pVScsiSense->abSenseBuf));
+    pVScsiSense->abSenseBuf[0] = RT_BIT(7) | SCSI_SENSE_RESPONSE_CODE_CURR_FIXED; /* Fixed format */
+    pVScsiSense->abSenseBuf[2] = uSCSISenseKey;
+    vscsiH2BEU32(&pVScsiSense->abSenseBuf[3], uInfo);
+    pVScsiSense->abSenseBuf[7]  = 10;
+    pVScsiSense->abSenseBuf[12] = uSCSIASC;
+    pVScsiSense->abSenseBuf[13] = uSCSIASCQ;
+
+    if (pVScsiReq->pbSense && pVScsiReq->cbSense)
+        memcpy(pVScsiReq->pbSense, pVScsiSense->abSenseBuf, RT_MIN(sizeof(pVScsiSense->abSenseBuf), pVScsiReq->cbSense));
+
+    return SCSI_STATUS_CHECK_CONDITION;
+}
+
 int vscsiReqSenseCmd(PVSCSISENSE pVScsiSense, PVSCSIREQINT pVScsiReq)
 {
     /* Copy the current sense data to the buffer. */
diff --git a/src/VBox/Devices/Storage/swab.h b/src/VBox/Devices/Storage/swab.h
index 32c80a2..b61e9f2 100644
--- a/src/VBox/Devices/Storage/swab.h
+++ b/src/VBox/Devices/Storage/swab.h
@@ -1,3 +1,4 @@
+/* $Id: swab.h $ */
 /** @file
  *
  * VBox storage devices:
diff --git a/src/VBox/Devices/USB/DevOHCI.cpp b/src/VBox/Devices/USB/DevOHCI.cpp
index 58f3f92..df8b2ca 100644
--- a/src/VBox/Devices/USB/DevOHCI.cpp
+++ b/src/VBox/Devices/USB/DevOHCI.cpp
@@ -106,7 +106,9 @@
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
 /** The saved state version. */
-#define OHCI_SAVED_STATE_VERSION            4
+#define OHCI_SAVED_STATE_VERSION            5
+// The saved state with support of 8 ports
+#define OHCI_SAVED_STATE_VERSION_8PORTS     4
 /** The saved state version used in 3.0 and earlier.
  *
  * @remarks Because of the SSMR3MemPut/Get laziness we ended up with an
@@ -116,11 +118,18 @@
 #define OHCI_SAVED_STATE_VERSION_MEM_HELL   3
 
 
-/** Number of Downstream Ports on the root hub.
+/** Maximum supported number of Downstream Ports on the root hub. 15 ports
+ * is the maximum defined by the OHCI spec.
  * If you change this you need to add more status register words to the 'opreg'
  * array.
  */
-#define OHCI_NDP 8
+#define OHCI_NDP_MAX        15
+
+/** Default NDP, chosen to be compatible with everything. */
+#define OHCI_NDP_DEFAULT    12
+
+/* Macro to query the number of currently configured ports. */
+#define OHCI_NDP_CFG(pohci) ((pohci)->RootHub.desc_a & OHCI_RHA_NDP)
 
 /** Pointer to OHCI device data. */
 typedef struct OHCI *POHCI;
@@ -180,11 +189,11 @@ typedef struct ohci_roothub
 #if HC_ARCH_BITS == 64
     uint32_t                            Alignment0; /**< Align aPorts on a 8 byte boundary. */
 #endif
-    OHCIHUBPORT                         aPorts[OHCI_NDP];
+    OHCIHUBPORT                         aPorts[OHCI_NDP_MAX];
     R3PTRTYPE(POHCI)                    pOhci;
 } OHCIROOTHUB;
 #if HC_ARCH_BITS == 64
-AssertCompile(sizeof(OHCIROOTHUB) == 280); /* saved state */
+AssertCompile(sizeof(OHCIROOTHUB) == 392); /* saved state */
 #endif
 /** Pointer to the OHCI root hub. */
 typedef OHCIROOTHUB *POHCIROOTHUB;
@@ -201,7 +210,7 @@ typedef struct ohci_load {
     /** Number of detached devices. */
     unsigned cDevs;
     /** Array of devices which were detached. */
-    PVUSBIDEVICE apDevs[OHCI_NDP];
+    PVUSBIDEVICE apDevs[OHCI_NDP_MAX];
 } OHCILOAD;
 /** Pointer to an OHCILOAD structure. */
 typedef OHCILOAD *POHCILOAD;
@@ -758,6 +767,13 @@ static SSMFIELD const g_aOhciFields[] =
     SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[5].fReg),
     SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[6].fReg),
     SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[7].fReg),
+    SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[8].fReg),
+    SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[9].fReg),
+    SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[10].fReg),
+    SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[11].fReg),
+    SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[12].fReg),
+    SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[13].fReg),
+    SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[14].fReg),
     SSMFIELD_ENTRY(         OHCI, ctl),
     SSMFIELD_ENTRY(         OHCI, status),
     SSMFIELD_ENTRY(         OHCI, intr_status),
@@ -911,7 +927,7 @@ static DECLCALLBACK(unsigned) ohciRhGetAvailablePorts(PVUSBIROOTHUBPORT pInterfa
     memset(pAvailable, 0, sizeof(*pAvailable));
 
     PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
-    for (iPort = 0; iPort < RT_ELEMENTS(pThis->RootHub.aPorts); iPort++)
+    for (iPort = 0; iPort < OHCI_NDP_CFG(pThis); iPort++)
     {
         if (!pThis->RootHub.aPorts[iPort].pDev)
         {
@@ -953,9 +969,11 @@ static DECLCALLBACK(int) ohciRhAttach(PVUSBIROOTHUBPORT pInterface, PVUSBIDEVICE
     /*
      * Validate and adjust input.
      */
-    Assert(uPort >= 1 && uPort <= RT_ELEMENTS(pThis->RootHub.aPorts));
+    Assert(uPort >= 1 && uPort <= OHCI_NDP_CFG(pThis));
     uPort--;
     Assert(!pThis->RootHub.aPorts[uPort].pDev);
+    /* Only LS/FS devices can end up here. */
+    Assert(pDev->pfnGetSpeed(pDev) == VUSB_SPEED_LOW || pDev->pfnGetSpeed(pDev) == VUSB_SPEED_FULL);
 
     /*
      * Attach it.
@@ -988,7 +1006,7 @@ static DECLCALLBACK(void) ohciRhDetach(PVUSBIROOTHUBPORT pInterface, PVUSBIDEVIC
     /*
      * Validate and adjust input.
      */
-    Assert(uPort >= 1 && uPort <= RT_ELEMENTS(pThis->RootHub.aPorts));
+    Assert(uPort >= 1 && uPort <= OHCI_NDP_CFG(pThis));
     uPort--;
     Assert(pThis->RootHub.aPorts[uPort].pDev == pDev);
 
@@ -1045,7 +1063,7 @@ static DECLCALLBACK(int) ohciRhReset(PVUSBIROOTHUBPORT pInterface, bool fResetOn
     PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
 
     pThis->RootHub.status = 0;
-    pThis->RootHub.desc_a = OHCI_RHA_NPS | OHCI_NDP;
+    pThis->RootHub.desc_a = OHCI_RHA_NPS | OHCI_NDP_CFG(pThis); /* Preserve NDP value. */
     pThis->RootHub.desc_b = 0x0; /* Impl. specific */
 
     /*
@@ -1060,7 +1078,7 @@ static DECLCALLBACK(int) ohciRhReset(PVUSBIROOTHUBPORT pInterface, bool fResetOn
      * get trouble and see the guest doing "USB Resets" we will have to look
      * into this. For the time being we stick with simple.
      */
-    for (unsigned iPort = 0; iPort < RT_ELEMENTS(pThis->RootHub.aPorts); iPort++)
+    for (unsigned iPort = 0; iPort < OHCI_NDP_CFG(pThis); iPort++)
     {
         if (pThis->RootHub.aPorts[iPort].pDev)
         {
@@ -3723,7 +3741,7 @@ static void ohciCancelOrphanedURBs(POHCI pThis)
             pUrb = pThis->aInFlight[i].pUrb;
             if (pThis->aInFlight[i].fInactive
                 && pUrb->enmState == VUSBURBSTATE_IN_FLIGHT
-                && !pUrb->enmType == VUSBXFERTYPE_CTRL)
+                && pUrb->enmType != VUSBXFERTYPE_CTRL)
                 pThis->RootHub.pIRhConn->pfnCancelUrbsEp(pThis->RootHub.pIRhConn, pUrb);
         }
     }
@@ -4627,7 +4645,7 @@ static int HcRhDescriptorA_w(POHCI pThis, uint32_t iReg, uint32_t val)
     uint32_t chg = val ^ pThis->RootHub.desc_a; NOREF(chg);
     Log2(("HcRhDescriptorA_w(%#010x) => %sNDP=%d %sPSM=%d %sNPS=%d %sDT=%d %sOCPM=%d %sNOCP=%d %sPOTGT=%#x - %sPowerSwitching Set%sPower\n",
           val,
-          chg & 0xff      ?"!!!": "", OHCI_NDP,
+          chg & 0xff      ?"!!!": "", val & 0xff,
           (chg >>  8) & 1 ? "*" : "", (val >>  8) & 1,
           (chg >>  9) & 1 ? "*" : "", (val >>  9) & 1,
           (chg >> 10) & 1 ?"!!!": "", 0,
@@ -4640,12 +4658,12 @@ static int HcRhDescriptorA_w(POHCI pThis, uint32_t iReg, uint32_t val)
         Log2(("Unknown bits %#x are set!!!\n", val & ~0xff001fff));
 
 
-    if ((val & (OHCI_RHA_NDP | OHCI_RHA_DT)) != OHCI_NDP)
+    if ((val & (OHCI_RHA_NDP | OHCI_RHA_DT)) != OHCI_NDP_CFG(pThis))
     {
         Log(("ohci: %s: invalid write to NDP or DT in roothub descriptor A!!! val=0x%.8x\n",
                 pThis->PciDev.name, val));
         val &= ~(OHCI_RHA_NDP | OHCI_RHA_DT);
-        val |= OHCI_NDP;
+        val |= OHCI_NDP_CFG(pThis);
     }
 
     pThis->RootHub.desc_a = val;
@@ -4720,18 +4738,18 @@ static int HcRhStatus_w(POHCI pThis, uint32_t iReg, uint32_t val)
     /* SetGlobalPower */
     if ( val & OHCI_RHS_LPSC )
     {
-        int i;
+        unsigned i;
         Log2(("ohci: %s: global power up\n", pThis->PciDev.name));
-        for (i = 0; i < OHCI_NDP; i++)
+        for (i = 0; i < OHCI_NDP_CFG(pThis); i++)
             rhport_power(&pThis->RootHub, i, true /* power up */);
     }
 
     /* ClearGlobalPower */
     if ( val & OHCI_RHS_LPS )
     {
-        int i;
+        unsigned i;
         Log2(("ohci: %s: global power down\n", pThis->PciDev.name));
-        for (i = 0; i < OHCI_NDP; i++)
+        for (i = 0; i < OHCI_NDP_CFG(pThis); i++)
             rhport_power(&pThis->RootHub, i, false /* power down */);
     }
 
@@ -4794,7 +4812,7 @@ static DECLCALLBACK(void) uchi_port_reset_done(PVUSBIDEVICE pDev, int rc, void *
      */
     POHCIHUBPORT pPort = NULL;
     unsigned iPort;
-    for (iPort = 0; iPort < RT_ELEMENTS(pThis->RootHub.aPorts); iPort++) /* lazy bird */
+    for (iPort = 0; iPort < OHCI_NDP_CFG(pThis); iPort++) /* lazy bird */
         if (pThis->RootHub.aPorts[iPort].pDev == pDev)
         {
             pPort = &pThis->RootHub.aPorts[iPort];
@@ -5015,7 +5033,7 @@ static const OHCIOPREG g_aOpRegs[] =
     { "HcRhStatus",          HcRhStatus_r,           HcRhStatus_w },            /* 20 */
 
     /* The number of port status register depends on the definition
-     * of OHCI_NDP macro
+     * of OHCI_NDP_MAX macro
      */
     { "HcRhPortStatus[0]",   HcRhPortStatus_r,       HcRhPortStatus_w },        /* 21 */
     { "HcRhPortStatus[1]",   HcRhPortStatus_r,       HcRhPortStatus_w },        /* 22 */
@@ -5025,8 +5043,22 @@ static const OHCIOPREG g_aOpRegs[] =
     { "HcRhPortStatus[5]",   HcRhPortStatus_r,       HcRhPortStatus_w },        /* 26 */
     { "HcRhPortStatus[6]",   HcRhPortStatus_r,       HcRhPortStatus_w },        /* 27 */
     { "HcRhPortStatus[7]",   HcRhPortStatus_r,       HcRhPortStatus_w },        /* 28 */
+    { "HcRhPortStatus[8]",   HcRhPortStatus_r,       HcRhPortStatus_w },        /* 29 */
+    { "HcRhPortStatus[9]",   HcRhPortStatus_r,       HcRhPortStatus_w },        /* 30 */
+    { "HcRhPortStatus[10]",  HcRhPortStatus_r,       HcRhPortStatus_w },        /* 31 */
+    { "HcRhPortStatus[11]",  HcRhPortStatus_r,       HcRhPortStatus_w },        /* 32 */
+    { "HcRhPortStatus[12]",  HcRhPortStatus_r,       HcRhPortStatus_w },        /* 33 */
+    { "HcRhPortStatus[13]",  HcRhPortStatus_r,       HcRhPortStatus_w },        /* 34 */
+    { "HcRhPortStatus[14]",  HcRhPortStatus_r,       HcRhPortStatus_w },        /* 35 */
 };
 
+/* Quick way to determine how many op regs are valid. Since at least one port must
+ * be configured (and no more than 15), there will be between 22 and 36 registers.
+ */
+#define NUM_OP_REGS(pohci)  (21 + OHCI_NDP_CFG(pohci))
+
+AssertCompile(RT_ELEMENTS(g_aOpRegs) > 21);
+AssertCompile(RT_ELEMENTS(g_aOpRegs) <= 36);
 
 /**
  * @callback_method_impl{FNIOMMMIOREAD}
@@ -5044,14 +5076,14 @@ PDMBOTHCBDECL(int) ohciMmioRead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhy
      */
     int rc;
     const uint32_t iReg = (GCPhysAddr - pThis->MMIOBase) >> 2;
-    if (iReg < RT_ELEMENTS(g_aOpRegs))
+    if (iReg < NUM_OP_REGS(pThis))
     {
         const OHCIOPREG *pReg = &g_aOpRegs[iReg];
         rc = pReg->pfnRead(pThis, iReg, (uint32_t *)pv);
     }
     else
     {
-        Log(("ohci: Trying to read register %u/%u!!!\n", iReg, RT_ELEMENTS(g_aOpRegs)));
+        Log(("ohci: Trying to read register %u/%u!!!\n", iReg, NUM_OP_REGS(pThis)));
         rc = VINF_IOM_MMIO_UNUSED_FF;
     }
     return rc;
@@ -5074,14 +5106,14 @@ PDMBOTHCBDECL(int) ohciMmioWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPh
      */
     int rc;
     const uint32_t iReg = (GCPhysAddr - pThis->MMIOBase) >> 2;
-    if (iReg < RT_ELEMENTS(g_aOpRegs))
+    if (iReg < NUM_OP_REGS(pThis))
     {
         const OHCIOPREG *pReg = &g_aOpRegs[iReg];
         rc = pReg->pfnWrite(pThis, iReg, *(uint32_t const *)pv);
     }
     else
     {
-        Log(("ohci: Trying to write to register %u/%u!!!\n", iReg, RT_ELEMENTS(g_aOpRegs)));
+        Log(("ohci: Trying to write to register %u/%u!!!\n", iReg, NUM_OP_REGS(pThis)));
         rc = VINF_SUCCESS;
     }
     return rc;
@@ -5138,19 +5170,22 @@ static DECLCALLBACK(int) ohciR3SavePrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
      * Detach all proxied devices.
      */
     PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_IGNORED);
-    /** @todo we a) can't tell which are proxied, and b) this won't work well when continuing after saving! */
+    /** @todo this won't work well when continuing after saving! */
     for (unsigned i = 0; i < RT_ELEMENTS(pRh->aPorts); i++)
     {
         PVUSBIDEVICE pDev = pRh->aPorts[i].pDev;
         if (pDev)
         {
-            VUSBIRhDetachDevice(pRh->pIRhConn, pDev);
-            /*
-             * Save the device pointers here so we can reattach them afterwards.
-             * This will work fine even if the save fails since the Done handler is
-             * called unconditionally if the Prep handler was called.
-             */
-            pRh->aPorts[i].pDev = pDev;
+            if (!VUSBIDevIsEmulated(pDev))
+            {
+                VUSBIRhDetachDevice(pRh->pIRhConn, pDev);
+                /*
+                 * Save the device pointers here so we can reattach them afterwards.
+                 * This will work fine even if the save fails since the Done handler is
+                 * called unconditionally if the Prep handler was called.
+                 */
+                pRh->aPorts[i].pDev = pDev;
+            }
         }
     }
 
@@ -5223,7 +5258,11 @@ static DECLCALLBACK(int) ohciR3SaveDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
      */
     Rh = *pRh;
     for (i = 0; i < RT_ELEMENTS(pRh->aPorts); i++)
-        pRh->aPorts[i].pDev = NULL;
+    {
+        if (   pRh->aPorts[i].pDev
+            && !VUSBIDevIsEmulated(pRh->aPorts[i].pDev))
+            pRh->aPorts[i].pDev = NULL;
+    }
 
     /*
      * Attach the devices.
@@ -5231,7 +5270,8 @@ static DECLCALLBACK(int) ohciR3SaveDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     for (i = 0; i < RT_ELEMENTS(pRh->aPorts); i++)
     {
         PVUSBIDEVICE pDev = Rh.aPorts[i].pDev;
-        if (pDev)
+        if (   pDev
+            && !VUSBIDevIsEmulated(pDev))
             VUSBIRhAttachDevice(pRh->pIRhConn, pDev);
     }
 
@@ -5269,7 +5309,8 @@ static DECLCALLBACK(int) ohciR3LoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
         for (i = 0; i < RT_ELEMENTS(pRh->aPorts); i++)
         {
             PVUSBIDEVICE pDev = pRh->aPorts[i].pDev;
-            if (pDev)
+            if (   pDev
+                && !VUSBIDevIsEmulated(pDev))
             {
                 Load.apDevs[Load.cDevs++] = pDev;
                 VUSBIRhDetachDevice(pRh->pIRhConn, pDev);
@@ -5316,6 +5357,44 @@ static DECLCALLBACK(int) ohciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uin
         if (RT_FAILURE(rc))
             return rc;
     }
+    else if (uVersion == OHCI_SAVED_STATE_VERSION_8PORTS)
+    {
+        static SSMFIELD const s_aOhciFields8Ports[] =
+        {
+            SSMFIELD_ENTRY(         OHCI, SofTime),
+            SSMFIELD_ENTRY_CUSTOM(        dpic+fno, RT_OFFSETOF(OHCI, SofTime) + RT_SIZEOFMEMB(OHCI, SofTime), 4),
+            SSMFIELD_ENTRY(         OHCI, RootHub.status),
+            SSMFIELD_ENTRY(         OHCI, RootHub.desc_a),
+            SSMFIELD_ENTRY(         OHCI, RootHub.desc_b),
+            SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[0].fReg),
+            SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[1].fReg),
+            SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[2].fReg),
+            SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[3].fReg),
+            SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[4].fReg),
+            SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[5].fReg),
+            SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[6].fReg),
+            SSMFIELD_ENTRY(         OHCI, RootHub.aPorts[7].fReg),
+            SSMFIELD_ENTRY(         OHCI, ctl),
+            SSMFIELD_ENTRY(         OHCI, status),
+            SSMFIELD_ENTRY(         OHCI, intr_status),
+            SSMFIELD_ENTRY(         OHCI, intr),
+            SSMFIELD_ENTRY(         OHCI, hcca),
+            SSMFIELD_ENTRY(         OHCI, per_cur),
+            SSMFIELD_ENTRY(         OHCI, ctrl_cur),
+            SSMFIELD_ENTRY(         OHCI, ctrl_head),
+            SSMFIELD_ENTRY(         OHCI, bulk_cur),
+            SSMFIELD_ENTRY(         OHCI, bulk_head),
+            SSMFIELD_ENTRY(         OHCI, done),
+            SSMFIELD_ENTRY_CUSTOM(        fsmps+fit+fi+frt, RT_OFFSETOF(OHCI, done) + RT_SIZEOFMEMB(OHCI, done), 4),
+            SSMFIELD_ENTRY(         OHCI, HcFmNumber),
+            SSMFIELD_ENTRY(         OHCI, pstart),
+            SSMFIELD_ENTRY_TERM()
+        };
+
+        rc = SSMR3GetStructEx(pSSM, pThis, sizeof(*pThis), 0 /*fFlags*/, &s_aOhciFields8Ports[0], NULL);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
     else if (uVersion == OHCI_SAVED_STATE_VERSION_MEM_HELL)
     {
         static SSMFIELD const s_aOhciFields22[] =
@@ -5643,7 +5722,8 @@ static DECLCALLBACK(int) ohciR3Destruct(PPDMDEVINS pDevIns)
  */
 static DECLCALLBACK(int) ohciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
 {
-    POHCI pThis = PDMINS_2_DATA(pDevIns, POHCI);
+    POHCI       pThis = PDMINS_2_DATA(pDevIns, POHCI);
+    uint32_t    cPorts;
     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
 
     /*
@@ -5680,12 +5760,25 @@ static DECLCALLBACK(int) ohciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
 
 
     /*
-     * Read configuration. No configuration keys are currently supported.
+     * Read configuration.
      */
     PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "RZEnabled", "");
     int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true);
     AssertLogRelRCReturn(rc, rc);
 
+    /* Number of ports option. */
+    rc = CFGMR3QueryU32Def(pCfg, "Ports", &cPorts, OHCI_NDP_DEFAULT);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("OHCI configuration error: failed to read Ports as integer"));
+
+    if (cPorts == 0 || cPorts > OHCI_NDP_MAX)
+        return PDMDevHlpVMSetError(pDevIns, VERR_INVALID_PARAMETER, RT_SRC_POS,
+                                   N_("OHCI configuration error: Ports must be in range [%u,%u]"),
+                                   1, OHCI_NDP_MAX);
+
+    /* Store the configured NDP; it will be used everywhere else from now on. */
+    pThis->RootHub.desc_a = cPorts;
 
     /*
      * Register PCI device and I/O region.
diff --git a/src/VBox/Devices/USB/DrvVUSBRootHub.cpp b/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
index d854d02..942621c 100644
--- a/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
+++ b/src/VBox/Devices/USB/DrvVUSBRootHub.cpp
@@ -254,7 +254,7 @@ static int vusbHubAttach(PVUSBHUB pHub, PVUSBDEV pDev)
 /* -=-=-=-=-=- PDMUSBHUBREG methods -=-=-=-=-=- */
 
 /** @copydoc PDMUSBHUBREG::pfnAttachDevice */
-static DECLCALLBACK(int) vusbPDMHubAttachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, uint32_t *piPort)
+static DECLCALLBACK(int) vusbPDMHubAttachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS pUsbIns, const char *pszCaptureFilename, uint32_t *piPort)
 {
     PVUSBROOTHUB pThis = PDMINS_2_DATA(pDrvIns, PVUSBROOTHUB);
 
@@ -263,7 +263,7 @@ static DECLCALLBACK(int) vusbPDMHubAttachDevice(PPDMDRVINS pDrvIns, PPDMUSBINS p
      */
     PVUSBDEV pDev = (PVUSBDEV)RTMemAllocZ(sizeof(*pDev));
     AssertReturn(pDev, VERR_NO_MEMORY);
-    int rc = vusbDevInit(pDev, pUsbIns);
+    int rc = vusbDevInit(pDev, pUsbIns, pszCaptureFilename);
     if (RT_SUCCESS(rc))
     {
         pUsbIns->pvVUsbDev2 = pDev;
@@ -649,6 +649,57 @@ static DECLCALLBACK(void) vusbRhCancelAllUrbs(PVUSBIROOTHUBCONNECTOR pInterface)
     RTCritSectLeave(&pRh->CritSectDevices);
 }
 
+/**
+ * Worker doing the actual cancelling of all outstanding per-EP URBs on the
+ * device I/O thread.
+ *
+ * @returns VBox status code.
+ * @param   pDev    USB device instance data.
+ * @param   EndPt   Endpoint number.
+ * @param   enmDir  Endpoint direction.
+ */
+static DECLCALLBACK(int) vusbRhAbortEpWorker(PVUSBDEV pDev, int EndPt, VUSBDIRECTION enmDir)
+{
+    /*
+     * Iterate the URBs, find ones corresponding to given EP, and cancel them.
+     */
+    PVUSBURB pUrb = pDev->pAsyncUrbHead;
+    while (pUrb)
+    {
+        PVUSBURB pNext = pUrb->VUsb.pNext;
+
+        Assert(pUrb->VUsb.pDev == pDev);
+
+        if (pUrb->EndPt == EndPt && pUrb->enmDir == enmDir)
+        {
+            LogFlow(("%s: vusbRhAbortEpWorker: CANCELING URB\n", pUrb->pszDesc));
+            int rc = vusbUrbCancelWorker(pUrb, CANCELMODE_UNDO);
+            AssertRC(rc);
+        }
+        pUrb = pNext;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/** @copydoc VUSBIROOTHUBCONNECTOR::pfnAbortEp */
+static DECLCALLBACK(int) vusbRhAbortEp(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice, int EndPt, VUSBDIRECTION enmDir)
+{
+    PVUSBROOTHUB pRh = VUSBIROOTHUBCONNECTOR_2_VUSBROOTHUB(pInterface);
+    if (&pRh->Hub != ((PVUSBDEV)pDevice)->pHub)
+        AssertFailedReturn(VERR_INVALID_PARAMETER);
+
+    RTCritSectEnter(&pRh->CritSectDevices);
+    PVUSBDEV pDev = (PVUSBDEV)pDevice;
+    vusbDevIoThreadExecSync(pDev, (PFNRT)vusbRhAbortEpWorker, 3, pDev, EndPt, enmDir);
+    RTCritSectLeave(&pRh->CritSectDevices);
+
+    /* The reaper thread will take care of completing the URB. */
+
+    return VINF_SUCCESS;
+}
+
 
 /** @copydoc VUSBIROOTHUBCONNECTOR::pfnAttachDevice */
 static DECLCALLBACK(int) vusbRhAttachDevice(PVUSBIROOTHUBCONNECTOR pInterface, PVUSBIDEVICE pDevice)
@@ -779,14 +830,14 @@ static int vusbRhHubOpAttach(PVUSBHUB pHub, PVUSBDEV pDev)
         pDev->pNext = pRh->pDevices;
         pRh->pDevices = pDev;
         RTCritSectLeave(&pRh->CritSectDevices);
-        LogRel(("VUSB: attached '%s' to port %d\n", pDev->pUsbIns->pszName, iPort));
+        LogRel(("VUSB: Attached '%s' to port %d\n", pDev->pUsbIns->pszName, iPort));
     }
     else
     {
         ASMBitSet(&pRh->Bitmap, iPort);
         pHub->cDevices--;
         pDev->i16Port = -1;
-        LogRel(("VUSB: failed to attach '%s' to port %d, rc=%Rrc\n", pDev->pUsbIns->pszName, iPort, rc));
+        LogRel(("VUSB: Failed to attach '%s' to port %d, rc=%Rrc\n", pDev->pUsbIns->pszName, iPort, rc));
     }
     return rc;
 }
@@ -826,7 +877,7 @@ static void vusbRhHubOpDetach(PVUSBHUB pHub, PVUSBDEV pDev)
      */
     unsigned uPort = pDev->i16Port;
     pRh->pIRhPort->pfnDetach(pRh->pIRhPort, &pDev->IDevice, uPort);
-    LogRel(("VUSB: detached '%s' from port %u\n", pDev->pUsbIns->pszName, uPort));
+    LogRel(("VUSB: Detached '%s' from port %u\n", pDev->pUsbIns->pszName, uPort));
     ASMBitSet(&pRh->Bitmap, uPort);
     pHub->cDevices--;
 }
@@ -972,6 +1023,7 @@ static DECLCALLBACK(int) vusbRhConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
     pThis->IRhConnector.pfnReapAsyncUrbs= vusbRhReapAsyncUrbs;
     pThis->IRhConnector.pfnCancelUrbsEp = vusbRhCancelUrbsEp;
     pThis->IRhConnector.pfnCancelAllUrbs= vusbRhCancelAllUrbs;
+    pThis->IRhConnector.pfnAbortEp      = vusbRhAbortEp;
     pThis->IRhConnector.pfnAttachDevice = vusbRhAttachDevice;
     pThis->IRhConnector.pfnDetachDevice = vusbRhDetachDevice;
     pThis->hSniffer                     = VUSBSNIFFER_NIL;
@@ -1000,7 +1052,8 @@ static DECLCALLBACK(int) vusbRhConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
         rc = VUSBSnifferCreate(&pThis->hSniffer, 0, pszCaptureFilename, NULL);
         if (RT_FAILURE(rc))
             return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS,
-                                       N_("VUSBSniffer cannot open '%s' for writing. The directory must exist and it must be writable for the current user"));
+                                       N_("VUSBSniffer cannot open '%s' for writing. The directory must exist and it must be writable for the current user"),
+                                       pszCaptureFilename);
 
         MMR3HeapFree(pszCaptureFilename);
     }
diff --git a/src/VBox/Devices/USB/VUSBDevice.cpp b/src/VBox/Devices/USB/VUSBDevice.cpp
index 15afd48..ebbf86f 100644
--- a/src/VBox/Devices/USB/VUSBDevice.cpp
+++ b/src/VBox/Devices/USB/VUSBDevice.cpp
@@ -33,6 +33,7 @@
 #include <iprt/asm.h>
 #include "VUSBInternal.h"
 
+#include "VUSBSniffer.h"
 
 /*******************************************************************************
 *   Structures and Typedefs                                                    *
@@ -736,6 +737,7 @@ static void ReadCachedConfigDesc(PCVUSBDESCCONFIGEX pCfgDesc, uint8_t *pbBuf, ui
             for (unsigned k = 0; k < pIf->paSettings[j].Core.bNumEndpoints; k++)
             {
                 cbTotal += pIf->paSettings[j].paEndpoints[k].Core.bLength;
+                cbTotal += pIf->paSettings[j].paEndpoints[k].cbSsepc;
                 cbTotal += pIf->paSettings[j].paEndpoints[k].cbClass;
             }
         }
@@ -774,6 +776,7 @@ static void ReadCachedConfigDesc(PCVUSBDESCCONFIGEX pCfgDesc, uint8_t *pbBuf, ui
 
                 COPY_DATA(pbBuf, cbLeft, &EndPtDesc, VUSB_DT_ENDPOINT_MIN_LEN);
                 COPY_DATA(pbBuf, cbLeft, pIfDesc->paEndpoints[k].pvMore, EndPtDesc.bLength - VUSB_DT_ENDPOINT_MIN_LEN);
+                COPY_DATA(pbBuf, cbLeft, pIfDesc->paEndpoints[k].pvSsepc, pIfDesc->paEndpoints[k].cbSsepc);
                 COPY_DATA(pbBuf, cbLeft, pIfDesc->paEndpoints[k].pvClass, pIfDesc->paEndpoints[k].cbClass);
             }
         }
@@ -1010,23 +1013,11 @@ void vusbDevSetAddress(PVUSBDEV pDev, uint8_t u8Address)
 
     PVUSBROOTHUB pRh = vusbDevGetRh(pDev);
     AssertPtrReturnVoid(pRh);
-    if (pDev->u8Address == VUSB_DEFAULT_ADDRESS)
-        pRh->pDefaultAddress = NULL;
 
     vusbDevAddressUnHash(pDev);
 
     if (u8Address == VUSB_DEFAULT_ADDRESS)
-    {
-        if (pRh->pDefaultAddress != NULL)
-        {
-            vusbDevAddressUnHash(pRh->pDefaultAddress);
-            vusbDevSetState(pRh->pDefaultAddress, VUSB_DEVICE_STATE_POWERED);
-            Log(("2 DEFAULT ADDRS\n"));
-        }
-
-        pRh->pDefaultAddress = pDev;
         vusbDevSetState(pDev, VUSB_DEVICE_STATE_DEFAULT);
-    }
     else
         vusbDevSetState(pDev, VUSB_DEVICE_STATE_ADDRESS);
 
@@ -1175,7 +1166,8 @@ int vusbDevUrbIoThreadCreate(PVUSBDEV pDev)
 
     ASMAtomicXchgBool(&pDev->fTerminate, false);
     rc = RTThreadCreateF(&pDev->hUrbIoThread, vusbDevUrbIoThread, pDev, 0, RTTHREADTYPE_IO,
-                         RTTHREADFLAGS_WAITABLE, "USBDevIo-%d", pDev->i16Port);
+                         RTTHREADFLAGS_WAITABLE, "%s-%d", pDev->pUsbIns->pReg->szName,
+                         pDev->pUsbIns->iInstance);
     if (RT_SUCCESS(rc))
     {
         /* Wait for it to become active. */
@@ -1229,8 +1221,6 @@ int vusbDevDetach(PVUSBDEV pDev)
     PVUSBROOTHUB pRh = vusbDevGetRh(pDev);
     if (!pRh)
         AssertMsgFailedReturn(("Not attached!\n"), VERR_VUSB_DEVICE_NOT_ATTACHED);
-    if (pRh->pDefaultAddress == pDev)
-        pRh->pDefaultAddress = NULL;
 
     pDev->pHub->pOps->pfnDetach(pDev->pHub, pDev);
     pDev->i16Port = -1;
@@ -1284,6 +1274,9 @@ void vusbDevDestroy(PVUSBDEV pDev)
     int rc = RTReqQueueDestroy(pDev->hReqQueueSync);
     AssertRC(rc);
 
+    if (pDev->hSniffer != VUSBSNIFFER_NIL)
+        VUSBSnifferDestroy(pDev->hSniffer);
+
     RTCritSectDelete(&pDev->CritSectAsyncUrbs);
     /* Not using vusbDevSetState() deliberately here because it would assert on the state. */
     pDev->enmState = VUSB_DEVICE_STATE_DESTROYED;
@@ -1560,6 +1553,34 @@ DECLCALLBACK(VUSBDEVICESTATE) vusbIDeviceGetState(PVUSBIDEVICE pInterface)
 
 
 /**
+ * @interface_method_impl{VUSBIDEVICE,pfnIsEmulated}
+ */
+DECLCALLBACK(bool) vusbIDeviceIsEmulated(PVUSBIDEVICE pInterface)
+{
+    PVUSBDEV pDev = (PVUSBDEV)pInterface;
+    bool fEmulated = !!(pDev->pUsbIns->pReg->fFlags & PDM_USBREG_EMULATED_DEVICE);
+
+    LogFlowFunc(("pInterface=%p\n", pInterface));
+
+    LogFlowFunc(("returns %RTbool\n", fEmulated));
+    return fEmulated;
+}
+
+
+/**
+ * @interface_method_impl{VUSBIDEVICE,pfnGetState}
+ */
+DECLCALLBACK(VUSBSPEED) vusbIDeviceGetSpeed(PVUSBIDEVICE pInterface)
+{
+    PVUSBDEV pDev = (PVUSBDEV)pInterface;
+    VUSBSPEED enmSpeed = pDev->pUsbIns->enmSpeed;
+
+    LogFlowFunc(("pInterface=%p, returns %u\n", pInterface, enmSpeed));
+    return enmSpeed;
+}
+
+
+/**
  * The maximum number of interfaces the device can have in all of it's configuration.
  *
  * @returns Number of interfaces.
@@ -1683,7 +1704,7 @@ static DECLCALLBACK(int) vusbDevGetDescriptorCacheWorker(PPDMUSBINS pUsbIns, PCP
  * @param   pDev    The VUSB device to initialize.
  * @param   pUsbIns Pointer to the PDM USB Device instance.
  */
-int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns)
+int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns, const char *pszCaptureFilename)
 {
     /*
      * Initialize the device data members.
@@ -1693,11 +1714,14 @@ int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns)
     Assert(!pDev->IDevice.pfnPowerOn);
     Assert(!pDev->IDevice.pfnPowerOff);
     Assert(!pDev->IDevice.pfnGetState);
+    Assert(!pDev->IDevice.pfnIsEmulated);
 
     pDev->IDevice.pfnReset = vusbIDeviceReset;
     pDev->IDevice.pfnPowerOn = vusbIDevicePowerOn;
     pDev->IDevice.pfnPowerOff = vusbIDevicePowerOff;
     pDev->IDevice.pfnGetState = vusbIDeviceGetState;
+    pDev->IDevice.pfnIsEmulated = vusbIDeviceIsEmulated;
+    pDev->IDevice.pfnGetSpeed = vusbIDeviceGetSpeed;
     pDev->pUsbIns = pUsbIns;
     pDev->pNext = NULL;
     pDev->pNextHash = NULL;
@@ -1717,6 +1741,7 @@ int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns)
         AssertRCReturn(rc, rc);
     }
     pDev->pResetTimer = NULL;
+    pDev->hSniffer = VUSBSNIFFER_NIL;
 
     int rc = RTCritSectInit(&pDev->CritSectAsyncUrbs);
     AssertRCReturn(rc, rc);
@@ -1736,6 +1761,12 @@ int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns)
                                 "USB Device Reset Timer",  &pDev->pResetTimer);
     AssertRCReturn(rc, rc);
 
+    if (pszCaptureFilename)
+    {
+        rc = VUSBSnifferCreate(&pDev->hSniffer, 0, pszCaptureFilename, NULL);
+        AssertRCReturn(rc, rc);
+    }
+
     /*
      * Get the descriptor cache from the device. (shall cannot fail)
      */
diff --git a/src/VBox/Devices/USB/VUSBInternal.h b/src/VBox/Devices/USB/VUSBInternal.h
index 9c75315..277f63e 100644
--- a/src/VBox/Devices/USB/VUSBInternal.h
+++ b/src/VBox/Devices/USB/VUSBInternal.h
@@ -217,13 +217,15 @@ typedef struct VUSBDEV
     /** Request queue for executing tasks on the I/O thread which should be done
      * synchronous and without any other thread accessing the USB device. */
     RTREQQUEUE          hReqQueueSync;
+    /** Sniffer instance for this device if configured. */
+    VUSBSNIFFER         hSniffer;
     /** Flag whether the URB I/O thread should terminate. */
     bool volatile       fTerminate;
     /** Flag whether the I/O thread was woken up. */
     bool volatile       fWokenUp;
 #if HC_ARCH_BITS == 32
     /** Align the size to a 8 byte boundary. */
-    bool                afAlignment0[6];
+    bool                afAlignment0[2];
 #endif
 } VUSBDEV;
 AssertCompileSizeAlignment(VUSBDEV, 8);
@@ -249,7 +251,7 @@ typedef struct vusb_dev_ops
 } VUSBDEVOPS;
 
 
-int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns);
+int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns, const char *pszCaptureFilename);
 int vusbDevCreateOld(const char *pszDeviceName, void *pvDriverInit, PCRTUUID pUuid, PVUSBDEV *ppDev);
 void vusbDevDestroy(PVUSBDEV pDev);
 
@@ -304,6 +306,7 @@ typedef struct VUSBHUB
     /** Name of the hub. Used for logging. */
     char               *pszName;
 } VUSBHUB;
+AssertCompileMemberAlignment(VUSBHUB, pOps, 8);
 AssertCompileSizeAlignment(VUSBHUB, 8);
 
 /** @} */
@@ -350,8 +353,10 @@ typedef struct VUSBROOTHUB
     VUSBHUB                 Hub;
     /** Address hash table. */
     PVUSBDEV                apAddrHash[VUSB_ADDR_HASHSZ];
-    /** The default address. */
-    PVUSBDEV                pDefaultAddress;
+
+#if HC_ARCH_BITS == 32
+    uint32_t                Alignment0;
+#endif
 
     /** Pointer to the driver instance. */
     PPDMDRVINS              pDrvIns;
@@ -361,7 +366,7 @@ typedef struct VUSBROOTHUB
     VUSBIROOTHUBCONNECTOR   IRhConnector;
 
 #if HC_ARCH_BITS == 32
-    uint32_t                Alignment0;
+    uint32_t                Alignment1;
 #endif
 
     /** Critical section protecting the device list. */
@@ -370,7 +375,7 @@ typedef struct VUSBROOTHUB
     PVUSBDEV                pDevices;
 
 #if HC_ARCH_BITS == 32
-    uint32_t                Alignment1;
+    uint32_t                Alignment2;
 #endif
 
     /** Availability Bitmap. */
diff --git a/src/VBox/Devices/USB/VUSBReadAhead.cpp b/src/VBox/Devices/USB/VUSBReadAhead.cpp
index 9bfafb9..ecd1b69 100644
--- a/src/VBox/Devices/USB/VUSBReadAhead.cpp
+++ b/src/VBox/Devices/USB/VUSBReadAhead.cpp
@@ -257,14 +257,12 @@ static DECLCALLBACK(int) vusbDevReadAheadThread(RTTHREAD Thread, void *pvUser)
      * Free all still buffered URBs because another endpoint with a different packet size
      * and complete different data formats might be served later.
      */
-    int cFree = 0;
     while (pThis->pBuffUrbHead)
     {
         PVUSBURB pBufferedUrb = pThis->pBuffUrbHead;
 
         pThis->pBuffUrbHead = pBufferedUrb->Hci.pNext;
         pBufferedUrb->VUsb.pfnFree(pBufferedUrb);
-        cFree++;
     }
 
     RTCritSectLeave(&pThis->CritSectBuffUrbList);
diff --git a/src/VBox/Devices/USB/VUSBSniffer.cpp b/src/VBox/Devices/USB/VUSBSniffer.cpp
index dfc55a5..1b8f30f 100644
--- a/src/VBox/Devices/USB/VUSBSniffer.cpp
+++ b/src/VBox/Devices/USB/VUSBSniffer.cpp
@@ -46,6 +46,7 @@
 /** Block type for the interface descriptor block. */
 #define DUMPFILE_IDB_BLOCK_TYPE       UINT32_C(0x00000001)
 /** USB link type. */
+#define DUMPFILE_IDB_LINK_TYPE_USB_LINUX        UINT16_C(189)
 #define DUMPFILE_IDB_LINK_TYPE_USB_LINUX_MMAPED UINT16_C(220)
 
 /** Block type for an enhanced packet block. */
diff --git a/src/VBox/Devices/USB/VUSBUrb.cpp b/src/VBox/Devices/USB/VUSBUrb.cpp
index b11debf..c64bc06 100644
--- a/src/VBox/Devices/USB/VUSBUrb.cpp
+++ b/src/VBox/Devices/USB/VUSBUrb.cpp
@@ -1011,6 +1011,16 @@ void vusbUrbCompletionRh(PVUSBURB pUrb)
     AssertMsg(   pUrb->enmState == VUSBURBSTATE_REAPED
               || pUrb->enmState == VUSBURBSTATE_CANCELLED, ("%d\n", pUrb->enmState));
 
+    if (pUrb->VUsb.pDev->hSniffer)
+    {
+        int rc = VUSBSnifferRecordEvent(pUrb->VUsb.pDev->hSniffer, pUrb,
+                                          pUrb->enmStatus == VUSBSTATUS_OK
+                                        ? VUSBSNIFFEREVENT_COMPLETE
+                                        : VUSBSNIFFEREVENT_ERROR_COMPLETE);
+        if (RT_FAILURE(rc))
+            LogRel(("VUSB: Capturing URB completion event failed with %Rrc\n", rc));
+    }
+
     PVUSBROOTHUB pRh = vusbDevGetRh(pUrb->VUsb.pDev);
     AssertPtrReturnVoid(pRh);
 
@@ -1906,6 +1916,13 @@ int vusbUrbSubmit(PVUSBURB pUrb)
      */
     int rc;
 
+    if (pDev->hSniffer)
+    {
+        rc = VUSBSnifferRecordEvent(pDev->hSniffer, pUrb, VUSBSNIFFEREVENT_SUBMIT);
+        if (RT_FAILURE(rc))
+            LogRel(("VUSB: Capturing URB submit event failed with %Rrc\n", rc));
+    }
+
 #ifdef VBOX_WITH_USB
     if (pPipe && pPipe->hReadAhead)
     {
diff --git a/src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp b/src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp
index 3a265ce..44f1afd 100644
--- a/src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp
+++ b/src/VBox/Devices/USB/freebsd/USBProxyDevice-freebsd.cpp
@@ -52,6 +52,7 @@
 #include <iprt/asm.h>
 #include <iprt/string.h>
 #include <iprt/file.h>
+#include <iprt/pipe.h>
 #include "../USBProxyDevice.h"
 
 /** Maximum endpoints supported. */
@@ -95,12 +96,16 @@ typedef struct USBPROXYDEVFBSD
 {
     /** The open file. */
     RTFILE                 hFile;
-    /** Software endpoint structures */
-    USBENDPOINTFBSD        aSwEndpoint[USBFBSD_MAXENDPOINTS];
     /** Flag whether an URB is cancelling. */
     bool                   fCancelling;
     /** Flag whether initialised or not */
     bool                   fInit;
+    /** Pipe handle for waking up - writing end. */
+    RTPIPE                 hPipeWakeupW;
+    /** Pipe handle for waking up - reading end. */
+    RTPIPE                 hPipeWakeupR;
+    /** Software endpoint structures */
+    USBENDPOINTFBSD        aSwEndpoint[USBFBSD_MAXENDPOINTS];
     /** Kernel endpoint structures */
     struct usb_fs_endpoint aHwEndpoint[USBFBSD_MAXENDPOINTS];
 } USBPROXYDEVFBSD, *PUSBPROXYDEVFBSD;
@@ -383,10 +388,17 @@ static DECLCALLBACK(int) usbProxyFreeBSDOpen(PUSBPROXYDEV pProxyDev, const char
         rc = usbProxyFreeBSDFsInit(pProxyDev);
         if (RT_SUCCESS(rc))
         {
-            LogFlow(("usbProxyFreeBSDOpen(%p, %s): returns successfully hFile=%RTfile iActiveCfg=%d\n",
-                     pProxyDev, pszAddress, pDevFBSD->hFile, pProxyDev->iActiveCfg));
+            /*
+             * Create wakeup pipe.
+             */
+            rc = RTPipeCreate(&pDevFBSD->hPipeWakeupR, &pDevFBSD->hPipeWakeupW, 0);
+            if (RT_SUCCESS(rc))
+            {
+                LogFlow(("usbProxyFreeBSDOpen(%p, %s): returns successfully hFile=%RTfile iActiveCfg=%d\n",
+                         pProxyDev, pszAddress, pDevFBSD->hFile, pProxyDev->iActiveCfg));
 
-            return VINF_SUCCESS;
+                return VINF_SUCCESS;
+            }
         }
 
         RTFileClose(hFile);
@@ -449,12 +461,12 @@ static DECLCALLBACK(void) usbProxyFreeBSDClose(PUSBPROXYDEV pProxyDev)
 
     usbProxyFreeBSDFsUnInit(pProxyDev);
 
+    RTPipeClose(pDevFBSD->hPipeWakeupR);
+    RTPipeClose(pDevFBSD->hPipeWakeupW);
+
     RTFileClose(pDevFBSD->hFile);
     pDevFBSD->hFile = NIL_RTFILE;
 
-    RTMemFree(pDevFBSD);
-    pProxyDev->Backend.pv = NULL;
-
     LogFlow(("usbProxyFreeBSDClose: returns\n"));
 }
 
@@ -688,9 +700,10 @@ static DECLCALLBACK(int) usbProxyFreeBSDUrbQueue(PUSBPROXYDEV pProxyDev, PVUSBUR
              pUrb, (unsigned)pUrb->EndPt, (unsigned)pUrb->enmDir));
 
     ep_num = pUrb->EndPt;
-
-    if ((pUrb->enmType != VUSBXFERTYPE_MSG) && (pUrb->enmDir == VUSBDIRECTION_IN))
+    if ((pUrb->enmType != VUSBXFERTYPE_MSG) && (pUrb->enmDir == VUSBDIRECTION_IN)) {
+        /* set IN-direction bit */
         ep_num |= 0x80;
+    }
 
     index = 0;
 
@@ -822,7 +835,7 @@ static DECLCALLBACK(PVUSBURB) usbProxyFreeBSDUrbReap(PUSBPROXYDEV pProxyDev, RTM
     PUSBENDPOINTFBSD pEndpointFBSD;
     PVUSBURB pUrb;
     struct usb_fs_complete UsbFsComplete;
-    struct pollfd PollFd;
+    struct pollfd pfd[2];
     int rc;
 
     LogFlow(("usbProxyFreeBSDUrbReap: pProxyDev=%p, cMillies=%u\n",
@@ -946,23 +959,38 @@ repeat:
                  (unsigned)pEndpointFBSD->acbData[1]));
 
     }
-    else if (cMillies && rc == VERR_RESOURCE_BUSY)
+    else if (cMillies != 0 && rc == VERR_RESOURCE_BUSY)
     {
-        /* Poll for finished transfers */
-        PollFd.fd = RTFileToNative(pDevFBSD->hFile);
-        PollFd.events = POLLIN | POLLRDNORM;
-        PollFd.revents = 0;
-
-        rc = poll(&PollFd, 1, (cMillies == RT_INDEFINITE_WAIT) ? INFTIM : cMillies);
-        if (rc >= 1)
-        {
-            goto repeat;
-        }
-        else
+        for (;;)
         {
-            LogFlow(("usbProxyFreeBSDUrbReap: "
-                     "poll returned rc=%d\n", rc));
+            pfd[0].fd = RTFileToNative(pDevFBSD->hFile);
+            pfd[0].events = POLLIN | POLLRDNORM;
+            pfd[0].revents = 0;
+
+            pfd[1].fd = RTPipeToNative(pDevFBSD->hPipeWakeupR);
+            pfd[1].events = POLLIN | POLLRDNORM;
+            pfd[1].revents = 0;
+
+            rc = poll(pfd, 2, (cMillies == RT_INDEFINITE_WAIT) ? INFTIM : cMillies);
+            if (rc > 0)
+            {
+                if (pfd[1].revents & POLLIN)
+                {
+                    /* Got woken up, drain pipe. */
+                    uint8_t bRead;
+                    size_t cbIgnored = 0;
+                    RTPipeRead(pDevFBSD->hPipeWakeupR, &bRead, 1, &cbIgnored);
+                    /* Make sure we return from this function */
+                    cMillies = 0;
+                }
+                break;
+            }
+            if (rc == 0)
+                return NULL;
+            if (errno != EAGAIN)
+                return NULL;
         }
+        goto repeat;
     }
     return pUrb;
 }
@@ -984,6 +1012,16 @@ static DECLCALLBACK(int) usbProxyFreeBSDUrbCancel(PUSBPROXYDEV pProxyDev, PVUSBU
     return usbProxyFreeBSDEndpointClose(pProxyDev, index);
 }
 
+static DECLCALLBACK(int) usbProxyFreeBSDWakeup(PUSBPROXYDEV pProxyDev)
+{
+    PUSBPROXYDEVFBSD pDevFBSD = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVFBSD);
+    size_t cbIgnored;
+
+    LogFlowFunc(("pProxyDev=%p\n", pProxyDev));
+
+    return RTPipeWrite(pDevFBSD->hPipeWakeupW, "", 1, &cbIgnored);
+}
+
 /**
  * The FreeBSD USB Proxy Backend.
  */
@@ -992,7 +1030,7 @@ extern const USBPROXYBACK g_USBProxyDeviceHost =
     /* pszName */
     "host",
     /* cbBackend */
-    sizeof(PUSBPROXYDEVFBSD),
+    sizeof(USBPROXYDEVFBSD),
     usbProxyFreeBSDOpen,
     usbProxyFreeBSDInit,
     usbProxyFreeBSDClose,
@@ -1005,6 +1043,7 @@ extern const USBPROXYBACK g_USBProxyDeviceHost =
     usbProxyFreeBSDUrbQueue,
     usbProxyFreeBSDUrbCancel,
     usbProxyFreeBSDUrbReap,
+    usbProxyFreeBSDWakeup,
     0
 };
 
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/Devices/USB/usbip/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/Devices/USB/usbip/Makefile.kup
diff --git a/src/VBox/Devices/USB/usbip/USBProxyDevice-usbip.cpp b/src/VBox/Devices/USB/usbip/USBProxyDevice-usbip.cpp
new file mode 100644
index 0000000..7c453aa
--- /dev/null
+++ b/src/VBox/Devices/USB/usbip/USBProxyDevice-usbip.cpp
@@ -0,0 +1,1078 @@
+/* $Id: USBProxyDevice-usbip.cpp $ */
+/** @file
+ * USB device proxy - USB/IP backend.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_DRV_USBPROXY
+
+#include <VBox/log.h>
+#include <VBox/err.h>
+#include <VBox/vmm/pdm.h>
+
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/alloc.h>
+#include <iprt/string.h>
+#include <iprt/socket.h>
+#include <iprt/poll.h>
+#include <iprt/tcp.h>
+#include <iprt/pipe.h>
+#include <iprt/list.h>
+#include <iprt/semaphore.h>
+
+#include "../USBProxyDevice.h"
+
+
+/*******************************************************************************
+*   Constants And Macros, Structures and Typedefs                              *
+*******************************************************************************/
+
+/** The USB version number used for the protocol. */
+#define USBIP_VERSION         UINT16_C(0x0100)
+/** Request indicator in the command code. */
+#define USBIP_INDICATOR_REQ   RT_BIT(15)
+
+/** Command/Reply code for OP_REQ/RET_DEVLIST. */
+#define USBIP_REQ_RET_DEVLIST UINT16_C(5)
+/** Command/Reply code for OP_REQ/REP_IMPORT. */
+#define USBIP_REQ_RET_IMPORT  UINT16_C(3)
+/** USB submit command identifier. */
+#define USBIP_CMD_SUBMIT      UINT32_C(1)
+/** USB submit status identifier. */
+#define USBIP_RET_SUBMIT      UINT32_C(2)
+/** URB unlink (cancel) command identifier. */
+#define USBIP_CMD_UNLINK      UINT32_C(3)
+/** URB unlink (cancel) reply identifier. */
+#define USBIP_RET_UNLINK      UINT32_C(4)
+
+/** Short read is not okay for the specified URB. */
+#define USBIP_XFER_FLAGS_SHORT_NOT_OK        RT_BIT_32(0)
+/** Queue the isochronous URB as soon as possible. */
+#define USBIP_XFER_FLAGS_ISO_ASAP            RT_BIT_32(1)
+/** Don't use DMA mappings for this URB. */
+#define USBIP_XFER_FLAGS_NO_TRANSFER_DMA_MAP RT_BIT_32(2)
+/** Explain - only applies to UHCI. */
+#define USBIP_XFER_FLAGS_FSBR                RT_BIT_32(4)
+
+/** URB direction - input. */
+#define USBIP_DIR_IN                         UINT32_C(0)
+/** URB direction - output. */
+#define USBIP_DIR_OUT                        UINT32_C(1)
+
+/**
+ * Exported device entry in the OP_RET_DEVLIST reply.
+ */
+#pragma pack(1)
+typedef struct UsbIpExportedDevice
+{
+    /** Path of the device, zero terminated string. */
+    char    szPath[256];
+    /** Bus ID of the exported device, zero terminated string. */
+    char    szBusId[32];
+    /** Bus number. */
+    uint32_t u32BusNum;
+    /** Device number. */
+    uint32_t u32DevNum;
+    /** Speed indicator of the device. */
+    uint32_t u32Speed;
+    /** Vendor ID of the device. */
+    uint16_t u16VendorId;
+    /** Product ID of the device. */
+    uint16_t u16ProductId;
+    /** Device release number. */
+    uint16_t u16BcdDevice;
+    /** Device class. */
+    uint8_t  bDeviceClass;
+    /** Device Subclass. */
+    uint8_t  bDeviceSubClass;
+    /** Device protocol. */
+    uint8_t  bDeviceProtocol;
+    /** Current configuration value of the device. */
+    uint8_t  bNumConfigurations;
+    /** Number of interfaces for the device. */
+    uint8_t  bNumInterfaces;
+} UsbIpExportedDevice;
+/** Pointer to a exported device entry. */
+typedef UsbIpExportedDevice *PUsbIpExportedDevice;
+#pragma pack()
+
+/**
+ * Interface descriptor entry for an exported device.
+ */
+#pragma pack(1)
+typedef struct UsbIpDeviceInterface
+{
+    /** Intefrace class. */
+    uint8_t  bInterfaceClass;
+    /** Interface sub class. */
+    uint8_t  bInterfaceSubClass;
+    /** Interface protocol identifier. */
+    uint8_t  bInterfaceProtocol;
+    /** Padding byte for alignment. */
+    uint8_t  bPadding;
+} UsbIpDeviceInterface;
+/** Pointer to an interface descriptor entry. */
+typedef UsbIpDeviceInterface *PUsbIpDeviceInterface;
+#pragma pack()
+
+/**
+ * USB/IP Import request.
+ */
+#pragma pack(1)
+typedef struct UsbIpReqImport
+{
+    /** Protocol version number. */
+    uint16_t     u16Version;
+    /** Command code. */
+    uint16_t     u16Cmd;
+    /** Status field, unused. */
+    uint32_t     u32Status;
+    /** Bus Id of the device as zero terminated string. */
+    char         aszBusId[32];
+} UsbIpReqImport;
+/** Pointer to a import request. */
+typedef UsbIpReqImport *PUsbIpReqImport;
+#pragma pack()
+
+/**
+ * USB/IP Import reply.
+ *
+ * This is only the header, for successful
+ * imports the device details are sent to as
+ * defined in UsbIpExportedDevice.
+ */
+#pragma pack(1)
+typedef struct UsbIpRetImport
+{
+    /** Protocol version number. */
+    uint16_t     u16Version;
+    /** Command code. */
+    uint16_t     u16Cmd;
+    /** Status field, unused. */
+    uint32_t     u32Status;
+} UsbIpRetImport;
+/** Pointer to a import reply. */
+typedef UsbIpRetImport *PUsbIpRetImport;
+#pragma pack()
+
+/**
+ * Command/Reply header common to the submit and unlink commands
+ * replies.
+ */
+#pragma pack(1)
+typedef struct UsbIpReqRetHdr
+{
+    /** Request/Return code. */
+    uint32_t     u32ReqRet;
+    /** Sequence number to identify the URB. */
+    uint32_t     u32SeqNum;
+    /** Device id. */
+    uint32_t     u32DevId;
+    /** Direction of the endpoint (host->device, device->host). */
+    uint32_t     u32Direction;
+    /** Endpoint number. */
+    uint32_t     u32Endpoint;
+} UsbIpReqRetHdr;
+/** Pointer to a request/reply header. */
+typedef UsbIpReqRetHdr *PUsbIpReqRetHdr;
+#pragma pack()
+
+/**
+ * USB/IP Submit request.
+ */
+#pragma pack(1)
+typedef struct UsbIpReqSubmit
+{
+    /** The request header. */
+    UsbIpReqRetHdr Hdr;
+    /** Transfer flags for the URB. */
+    uint32_t       u32XferFlags;
+    /** Transfer buffer length. */
+    uint32_t       u32TransferBufferLength;
+    /** Frame to transmit an ISO frame. */
+    uint32_t       u32StartFrame;
+    /** Number of isochronous packets. */
+    uint32_t       u32NumIsocPkts;
+    /** Maximum time for the request on the server side host controller. */
+    uint32_t       u32Interval;
+    /** Setup data for a control URB. */
+    VUSBSETUP      Setup;
+} UsbIpReqSubmit;
+/** Pointer to a submit request. */
+typedef UsbIpReqSubmit *PUsbIpReqSubmit;
+#pragma pack()
+
+/**
+ * USB/IP Submit reply.
+ */
+#pragma pack(1)
+typedef struct UsbIpRetSubmit
+{
+    /** The reply header. */
+    UsbIpReqRetHdr Hdr;
+    /** Status code. */
+    uint32_t       u32Status;
+    /** Actual length of the reply buffer. */
+    uint32_t       u32ActualLength;
+    /** The actual selected frame for a isochronous transmit. */
+    uint32_t       u32StartFrame;
+    /** Number of isochronous packets. */
+    uint32_t       u32NumIsocPkts;
+    /** Number of failed isochronous packets. */
+    uint32_t       u32ErrorCount;
+    /** Setup data for a control URB. */
+    VUSBSETUP      Setup;
+} UsbIpRetSubmit;
+/** Pointer to a submit reply. */
+typedef UsbIpRetSubmit *PUsbIpRetSubmit;
+#pragma pack()
+
+/**
+ * Unlink URB request.
+ */
+#pragma pack(1)
+typedef struct UsbIpReqUnlink
+{
+    /** The request header. */
+    UsbIpReqRetHdr Hdr;
+    /** The sequence number to unlink. */
+    uint32_t       u32SeqNum;
+} UsbIpReqUnlink;
+/** Pointer to a URB unlink request. */
+typedef UsbIpReqUnlink *PUsbIpReqUnlink;
+#pragma pack()
+
+/**
+ * Unlink URB reply.
+ */
+#pragma pack(1)
+typedef struct UsbIpRetUnlink
+{
+    /** The reply header. */
+    UsbIpReqRetHdr Hdr;
+    /** Status of the request. */
+    uint32_t       u32Status;
+} UsbIpRetUnlink;
+/** Pointer to a URB unlink request. */
+typedef UsbIpRetUnlink *PUsbIpRetUnlink;
+#pragma pack()
+
+/**
+ * Union of possible replies from the server during normal operation.
+ */
+#pragma pack(1)
+typedef union UsbIpRet
+{
+    /** The header. */
+    UsbIpReqRetHdr Hdr;
+    /** Submit reply. */
+    UsbIpRetSubmit RetSubmit;
+    /** Unlink reply. */
+    UsbIpRetUnlink RetUnlink;
+    /** Byte view. */
+    uint8_t        abReply[1];
+} UsbIpRet;
+/** Pointer to a reply union. */
+typedef UsbIpRet *PUsbIpRet;
+#pragma pack()
+
+/**
+ * USB/IP backend specific data for one URB.
+ * Required for tracking in flight and landed URBs.
+ */
+typedef struct USBPROXYURBUSBIP
+{
+    /** List node for the in flight or landed URB list. */
+    RTLISTNODE         NodeList;
+    /** Sequence number the assigned URB is identified by. */
+    uint32_t           u32SeqNumUrb;
+    /** Pointer to the VUSB URB. */
+    PVUSBURB           pVUsbUrb;
+} USBPROXYURBUSBIP;
+/** Pointer to a USB/IP URB. */
+typedef USBPROXYURBUSBIP *PUSBPROXYURBUSBIP;
+
+/**
+ * Backend data for the USB/IP USB Proxy device backend.
+ */
+typedef struct USBPROXYDEVUSBIP
+{
+    /** IPRT socket handle. */
+    RTSOCKET          hSocket;
+    /** Pollset with the wakeup pipe and socket. */
+    RTPOLLSET         hPollSet;
+    /** Pipe endpoint - read (in the pollset). */
+    RTPIPE            hPipeR;
+    /** Pipe endpoint - write. */
+    RTPIPE            hPipeW;
+    /** Flag whether the reaper thread was woken up. */
+    volatile bool     fWokenUp;
+    /** Next sequence number to use for identifying submitted URBs. */
+    volatile uint32_t u32SeqNumNext;
+    /** Fast mutex protecting the lists below against concurrent access. */
+    RTSEMFASTMUTEX    hMtxLists;
+    /** List of in flight URBs. */
+    RTLISTANCHOR      ListUrbsInFlight;
+    /** List of landed URBs. */
+    RTLISTANCHOR      ListUrbsLanded;
+    /** Port of the USB/IP host to connect to. */
+    uint32_t          uPort;
+    /** USB/IP host address. */
+    char             *pszHost;
+    /** USB Bus ID of the device to capture. */
+    char             *pszBusId;
+    /** The device ID to use to identify the device. */
+    uint32_t          u32DevId;
+} USBPROXYDEVUSBIP, *PUSBPROXYDEVUSBIP;
+
+/** Pollset id of the socket. */
+#define USBIP_POLL_ID_SOCKET 0
+/** Pollset id of the pipe. */
+#define USBIP_POLL_ID_PIPE   1
+
+/**
+ * Converts a request/reply header from network to host endianness.
+ *
+ * @returns nothing.
+ * @param   pHdr    The header to convert.
+ */
+DECLINLINE(void) usbProxyUsbIpReqRetHdrN2H(PUsbIpReqRetHdr pHdr)
+{
+    pHdr->u32ReqRet    = RT_H2N_U32(pHdr->u32ReqRet);
+    pHdr->u32SeqNum    = RT_H2N_U32(pHdr->u32SeqNum);
+    pHdr->u32DevId     = RT_H2N_U32(pHdr->u32DevId);
+    pHdr->u32Direction = RT_H2N_U32(pHdr->u32Direction);
+    pHdr->u32Endpoint  = RT_H2N_U32(pHdr->u32Endpoint);
+}
+
+/**
+ * Converts a request/reply header from host to network endianness.
+ *
+ * @returns nothing.
+ * @param   pHdr              The header to convert.
+ */
+DECLINLINE(void) usbProxyUsbIpReqRetHdrH2N(PUsbIpReqRetHdr pHdr)
+{
+    pHdr->u32ReqRet    = RT_N2H_U32(pHdr->u32ReqRet);
+    pHdr->u32SeqNum    = RT_N2H_U32(pHdr->u32SeqNum);
+    pHdr->u32DevId     = RT_N2H_U32(pHdr->u32DevId);
+    pHdr->u32Direction = RT_N2H_U32(pHdr->u32Direction);
+    pHdr->u32Endpoint  = RT_N2H_U32(pHdr->u32Endpoint);
+}
+
+/**
+ * Converts a submit request from host to network endianness.
+ *
+ * @returns nothing.
+ * @param   pReqSubmit        The submit request to convert.
+ */
+DECLINLINE(void) usbProxyUsbIpReqSubmitH2N(PUsbIpReqSubmit pReqSubmit)
+{
+    usbProxyUsbIpReqRetHdrH2N(&pReqSubmit->Hdr);
+    pReqSubmit->u32XferFlags            = RT_H2N_U32(pReqSubmit->u32XferFlags);
+    pReqSubmit->u32TransferBufferLength = RT_H2N_U32(pReqSubmit->u32TransferBufferLength);
+    pReqSubmit->u32StartFrame           = RT_H2N_U32(pReqSubmit->u32StartFrame);
+    pReqSubmit->u32NumIsocPkts          = RT_H2N_U32(pReqSubmit->u32NumIsocPkts);
+    pReqSubmit->u32Interval             = RT_H2N_U32(pReqSubmit->u32Interval);
+}
+
+/**
+ * Converts a submit reply from network to host endianness.
+ *
+ * @returns nothing.
+ * @param   pReqSubmit        The submit reply to convert.
+ */
+DECLINLINE(void) usbProxyUsbIpRetSubmitN2H(PUsbIpRetSubmit pRetSubmit)
+{
+    usbProxyUsbIpReqRetHdrN2H(&pRetSubmit->Hdr);
+    pRetSubmit->u32Status       = RT_N2H_U32(pRetSubmit->u32Status);
+    pRetSubmit->u32ActualLength = RT_N2H_U32(pRetSubmit->u32ActualLength);
+    pRetSubmit->u32StartFrame   = RT_N2H_U32(pRetSubmit->u32StartFrame);
+    pRetSubmit->u32NumIsocPkts  = RT_N2H_U32(pRetSubmit->u32NumIsocPkts);
+    pRetSubmit->u32ErrorCount   = RT_N2H_U32(pRetSubmit->u32ErrorCount);
+}
+
+/**
+ * Converts a unlink request from host to network endianness.
+ *
+ * @returns nothing.
+ * @param   pReqUnlink        The unlink request to convert.
+ */
+DECLINLINE(void) usbProxyUsbIpReqUnlinkH2N(PUsbIpReqUnlink pReqUnlink)
+{
+    usbProxyUsbIpReqRetHdrH2N(&pReqUnlink->Hdr);
+    pReqUnlink->u32SeqNum = RT_H2N_U32(pReqUnlink->u32SeqNum);
+}
+
+/**
+ * Converts a unlink reply from network to host endianness.
+ *
+ * @returns nothing.
+ * @param   pRetUnlink        The unlink reply to convert.
+ */
+DECLINLINE(void) usbProxyUsbIpRetUnlinkN2H(PUsbIpRetUnlink pRetUnlink)
+{
+    usbProxyUsbIpReqRetHdrN2H(&pRetUnlink->Hdr);
+    pRetUnlink->u32Status = RT_N2H_U32(pRetUnlink->u32Status);
+}
+
+/**
+ * Convert the given exported device structure from host to network byte order.
+ *
+ * @returns nothing.
+ * @param   pDevice           The device structure to convert.
+ */
+DECLINLINE(void) usbProxyUsbIpExportedDeviceN2H(PUsbIpExportedDevice pDevice)
+{
+    pDevice->u32BusNum    = RT_N2H_U32(pDevice->u32BusNum);
+    pDevice->u32DevNum    = RT_N2H_U32(pDevice->u32DevNum);
+    pDevice->u32Speed     = RT_N2H_U16(pDevice->u32Speed);
+    pDevice->u16VendorId  = RT_N2H_U16(pDevice->u16VendorId);
+    pDevice->u16ProductId = RT_N2H_U16(pDevice->u16ProductId);
+    pDevice->u16BcdDevice = RT_N2H_U16(pDevice->u16BcdDevice);
+}
+
+/**
+ * Converts a USB/IP status code to VBox status code.
+ *
+ * @returns VBox status code.
+ * @param   u32Status    The USB/IP status code from the reply.
+ */
+DECLINLINE(int) usbProxyUsbIpErrConvertFromStatus(uint32_t u32Status)
+{
+    if (RT_LIKELY(u32Status == 0))
+        return VINF_SUCCESS;
+
+    return VERR_NOT_IMPLEMENTED;
+}
+
+/**
+ * Gets the next free sequence number.
+ *
+ * @returns Next free sequence number.
+ * @param   pProxyDevUsbIp    The USB/IP proxy device data.
+ */
+DECLINLINE(uint32_t) usbProxyUsbIpSeqNumGet(PUSBPROXYDEVUSBIP pProxyDevUsbIp)
+{
+    return ASMAtomicIncU32(&pProxyDevUsbIp->u32SeqNumNext);
+}
+
+/**
+ * Links a given URB into the given list.
+ *
+ * @returns nothing.
+ * @param   pProxyDevUsbIp    The USB/IP proxy device data.
+ * @param   pList             The list to link the URB into.
+ * @param   pUrbUsbIp         The URB to link.
+ */
+DECLINLINE(void) usbProxyUsbIpLinkUrb(PUSBPROXYDEVUSBIP pProxyDevUsbIp, PRTLISTANCHOR pList, PUSBPROXYURBUSBIP pUrbUsbIp)
+{
+    int rc = RTSemFastMutexRequest(pProxyDevUsbIp->hMtxLists);
+    AssertRC(rc);
+    RTListAppend(pList, &pUrbUsbIp->NodeList);
+    RTSemFastMutexRelease(pProxyDevUsbIp->hMtxLists);
+}
+
+/**
+ * Unlinks a given URB from the current assigned list.
+ *
+ * @returns nothing.
+ * @param   pProxyDevUsbIp    The USB/IP proxy device data.
+ * @param   pUrbUsbIp         The URB to unlink.
+ */
+DECLINLINE(void) usbProxyUsbIpUnlinkUrb(PUSBPROXYDEVUSBIP pProxyDevUsbIp, PUSBPROXYURBUSBIP pUrbUsbIp)
+{
+    int rc = RTSemFastMutexRequest(pProxyDevUsbIp->hMtxLists);
+    AssertRC(rc);
+    RTListNodeRemove(&pUrbUsbIp->NodeList);
+    RTSemFastMutexRelease(pProxyDevUsbIp->hMtxLists);
+}
+
+/**
+ * Allocates a USB/IP proxy specific URB state.
+ *
+ * @returns Pointer to the USB/IP specific URB data or NULL on failure.
+ * @param   pProxyDevUsbIp    The USB/IP proxy device data.
+ */
+static PUSBPROXYURBUSBIP usbProxyUsbIpUrbAlloc(PUSBPROXYDEVUSBIP pProxyDevUsbIp)
+{
+    NOREF(pProxyDevUsbIp);
+    return (PUSBPROXYURBUSBIP)RTMemAllocZ(sizeof(USBPROXYURBUSBIP));
+}
+
+/**
+ * Frees the given USB/IP URB state.
+ *
+ * @returns nothing.
+ * @param   pProxyDevUsbIp    The USB/IP proxy device data.
+ * @param   pUrbUsbIp         The USB/IP speciic URB data.
+ */
+static void usbProxyUsbIpUrbFree(PUSBPROXYDEVUSBIP pProxyDevUsbIp, PUSBPROXYURBUSBIP pUrbUsbIp)
+{
+    NOREF(pProxyDevUsbIp);
+    RTMemFree(pUrbUsbIp);
+}
+
+/**
+ * Parse the string representation of the host address.
+ *
+ * @returns VBox status code.
+ * @param   pProxyDevUsbIp    The USB/IP proxy device data to parse the address for.
+ * @param   pszAddress        The address string to parse.
+ */
+static int usbProxyUsbIpParseAddress(PUSBPROXYDEVUSBIP pProxyDevUsbIp, const char *pszAddress)
+{
+    int rc = VINF_SUCCESS;
+    uint32_t uPort;
+    char *pszPortStart = RTStrStr(pszAddress, ":");
+    char *pszHost = NULL;
+    if (pszPortStart)
+    {
+        size_t cbHost = pszPortStart - pszAddress;
+        pszPortStart++;
+        rc = RTStrToUInt32Ex(pszPortStart, NULL, 10 /* uBase */, &pProxyDevUsbIp->uPort);
+        if (   rc == VINF_SUCCESS
+            || cbHost == 0)
+        {
+            rc = RTStrAllocEx(&pProxyDevUsbIp->pszHost, cbHost + 1);
+            if (RT_SUCCESS(rc))
+            {
+                rc = RTStrCopyEx(pProxyDevUsbIp->pszHost, cbHost + 1, pszAddress, cbHost);
+                AssertRC(rc);
+                return VINF_SUCCESS;
+            }
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
+    }
+    else
+        rc = VERR_INVALID_PARAMETER;
+
+    return rc;
+}
+
+/**
+ * Connects to the USB/IP host and claims the device given in the proxy device data.
+ *
+ * @returns VBox status.
+ * @param   pProxyDevUsbIp    The USB/IP proxy device data.
+ */
+static int usbProxyUsbIpConnect(PUSBPROXYDEVUSBIP pProxyDevUsbIp)
+{
+    int rc = VINF_SUCCESS;
+    rc = RTTcpClientConnect(pProxyDevUsbIp->pszHost, pProxyDevUsbIp->uPort, &pProxyDevUsbIp->hSocket);
+    if (RT_SUCCESS(rc))
+    {
+        /* Disable send coalescing. */
+        rc = RTTcpSetSendCoalescing(pProxyDevUsbIp->hSocket, false);
+        if (RT_FAILURE(rc))
+            LogRel(("UsbIp: Disabling send coalescing failed (rc=%Rrc), continuing nevertheless but expect reduced performance\n", rc));
+
+        /* Import the device, i.e. claim it for our use. */
+        UsbIpReqImport ReqImport;
+        ReqImport.u16Version = RT_H2N_U16(USBIP_VERSION);
+        ReqImport.u16Cmd     = RT_H2N_U16(USBIP_INDICATOR_REQ | USBIP_REQ_RET_IMPORT);
+        ReqImport.u32Status  = RT_H2N_U32(0);
+        rc = RTStrCopy(&ReqImport.aszBusId[0], sizeof(ReqImport.aszBusId[0]), pProxyDevUsbIp->pszBusId);
+        if (rc == VINF_SUCCESS)
+        {
+            rc = RTTcpWrite(pProxyDevUsbIp->hSocket, &ReqImport, sizeof(ReqImport));
+            if (RT_SUCCESS(rc))
+            {
+                /* Read the reply. */
+                UsbIpRetImport RetImport;
+                rc = RTTcpRead(pProxyDevUsbIp->hSocket, &RetImport, sizeof(RetImport), NULL);
+                if (RT_SUCCESS(rc))
+                {
+                    RetImport.u16Version = RT_N2H_U16(RetImport.u16Version);
+                    RetImport.u16Cmd     = RT_N2H_U16(RetImport.u16Cmd);
+                    RetImport.u32Status  = RT_N2H_U16(RetImport.u32Status);
+                    if (   RetImport.u16Version == USBIP_VERSION
+                        && RetImport.u16Cmd == USBIP_REQ_RET_IMPORT
+                        && RetImport.u32Status == 0)
+                    {
+                        /* Read the device data. */
+                        UsbIpExportedDevice Device;
+                        rc = RTTcpRead(pProxyDevUsbIp->hSocket, &Device, sizeof(Device), NULL);
+                        if (RT_SUCCESS(rc))
+                        {
+                            usbProxyUsbIpExportedDeviceN2H(&Device);
+                            pProxyDevUsbIp->u32DevId = (Device.u32BusNum << 16) | Device.u32DevNum;
+
+                            rc = RTPollSetAddSocket(pProxyDevUsbIp->hPollSet, pProxyDevUsbIp->hSocket,
+                                                    RTPOLL_EVT_READ | RTPOLL_EVT_ERROR, USBIP_POLL_ID_SOCKET);
+                        }
+                    }
+                    else
+                    {
+                        /* Check what went wrong and leave a meaningful error message in the log. */
+                        if (RetImport.u16Version != USBIP_VERSION)
+                            LogRel(("UsbIp: Unexpected protocol version received from host (%#x vs. %#x)\n",
+                                    RetImport.u16Version, USBIP_VERSION));
+                        else if (RetImport.u16Cmd != USBIP_REQ_RET_IMPORT)
+                            LogRel(("UsbIp: Unexpected reply code received from host (%#x vs. %#x)\n",
+                                    RetImport.u16Cmd, USBIP_REQ_RET_IMPORT));
+                        else if (RetImport.u32Status != 0)
+                            LogRel(("UsbIp: Claiming the device has failed on the host with an unspecified error\n"));
+                        else
+                            AssertMsgFailed(("Something went wrong with if condition\n"));
+                    }
+                }
+            }
+        }
+        else
+        {
+            LogRel(("UsbIp: Given bus ID is exceeds permitted protocol length: %u vs %u\n",
+                    strlen(pProxyDevUsbIp->pszBusId) + 1, sizeof(ReqImport.aszBusId[0])));
+            rc = VERR_INVALID_PARAMETER;
+        }
+
+        if (RT_FAILURE(rc))
+            RTTcpClientCloseEx(pProxyDevUsbIp->hSocket, false /*fGracefulShutdown*/);
+    }
+    if (RT_FAILURE(rc))
+        LogRel(("UsbIp: Connecting to the host %s failed with %Rrc\n", pProxyDevUsbIp->pszHost, rc));
+    return rc;
+}
+
+/**
+ * Disconnects from the USB/IP host releasing the device given in the proxy device data.
+ *
+ * @returns VBox status code.
+ * @param   pProxyDevUsbIp    The USB/IP proxy device data.
+ */
+static int usbProxyUsbIpDisconnect(PUSBPROXYDEVUSBIP pProxyDevUsbIp)
+{
+    int rc = VINF_SUCCESS;
+
+    rc = RTTcpClientCloseEx(pProxyDevUsbIp->hSocket, false /*fGracefulShutdown*/);
+    if (RT_SUCCESS(rc))
+        pProxyDevUsbIp->hSocket = NIL_RTSOCKET;
+    return rc;
+}
+
+/**
+ * Synchronously exchange a given control message with the remote device.
+ *
+ * @eturns VBox status code.
+ * @param  pProxyDevUsbIp    The USB/IP proxy device data.
+ * @param  pSetup            The setup message.
+ *
+ * @note This method is only used to implement the *SetConfig, *SetInterface and *ClearHaltedEp
+ *       callbacks because the USB/IP protocol lacks dedicated requests for these.
+ * @remark It is assumed that this method is never called while usbProxyUsbIpUrbReap is called
+ *         on another thread.
+ */
+static int usbProxyUsbIpCtrlUrbExchangeSync(PUSBPROXYDEVUSBIP pProxyDevUsbIp, PVUSBSETUP pSetup)
+{
+    int rc = VINF_SUCCESS;
+
+    UsbIpReqSubmit ReqSubmit;
+    uint32_t u32SeqNum = usbProxyUsbIpSeqNumGet(pProxyDevUsbIp);
+    ReqSubmit.Hdr.u32ReqRet           = USBIP_CMD_SUBMIT;
+    ReqSubmit.Hdr.u32SeqNum           = u32SeqNum;
+    ReqSubmit.Hdr.u32DevId            = pProxyDevUsbIp->u32DevId;
+    ReqSubmit.Hdr.u32Direction        = USBIP_DIR_OUT;
+    ReqSubmit.Hdr.u32Endpoint         = 0; /* Only default control endpoint is allowed for these kind of messages. */
+    ReqSubmit.u32XferFlags            = 0;
+    ReqSubmit.u32TransferBufferLength = 0;
+    ReqSubmit.u32StartFrame           = 0;
+    ReqSubmit.u32NumIsocPkts          = 0;
+    ReqSubmit.u32Interval             = 0;
+    memcpy(&ReqSubmit.Setup, pSetup, sizeof(ReqSubmit.Setup));
+    usbProxyUsbIpReqSubmitH2N(&ReqSubmit);
+
+    /* Send the command. */
+    rc = RTTcpWrite(pProxyDevUsbIp->hSocket, &ReqSubmit, sizeof(ReqSubmit));
+    if (RT_SUCCESS(rc))
+    {
+        /* Wait for the response. */
+        /** @todo: Don't wait indefinitely long. */
+        UsbIpRetSubmit RetSubmit;
+        rc = RTTcpRead(pProxyDevUsbIp->hSocket, &RetSubmit, sizeof(RetSubmit), NULL);
+        if (RT_SUCCESS(rc))
+        {
+            usbProxyUsbIpRetSubmitN2H(&RetSubmit);
+            rc = usbProxyUsbIpErrConvertFromStatus(RetSubmit.u32Status);
+        }
+    }
+    return rc;
+}
+
+/*
+ * The USB proxy device functions.
+ */
+
+static DECLCALLBACK(int) usbProxyUsbIpOpen(PUSBPROXYDEV pProxyDev, const char *pszAddress, void *pvBackend)
+{
+    LogFlowFunc(("pProxyDev=%p pszAddress=%s, pvBackend=%p\n", pProxyDev, pszAddress, pvBackend));
+
+    PUSBPROXYDEVUSBIP pDevUsbIp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    int rc = VINF_SUCCESS;
+
+    RTListInit(&pDevUsbIp->ListUrbsInFlight);
+    RTListInit(&pDevUsbIp->ListUrbsLanded);
+    pDevUsbIp->hSocket       = NIL_RTSOCKET;
+    pDevUsbIp->hPollSet      = NIL_RTPOLLSET;
+    pDevUsbIp->hPipeW        = NIL_RTPIPE;
+    pDevUsbIp->hPipeR        = NIL_RTPIPE;
+    pDevUsbIp->fWokenUp      = false;
+    pDevUsbIp->u32SeqNumNext = 0;
+    pDevUsbIp->pszHost       = NULL;
+    pDevUsbIp->pszBusId      = NULL;
+
+    /* Setup wakeup pipe and poll set first. */
+    rc = RTPipeCreate(&pDevUsbIp->hPipeR, &pDevUsbIp->hPipeW, 0);
+    if (RT_SUCCESS(rc))
+    {
+        rc = RTPollSetCreate(&pDevUsbIp->hPollSet);
+        if (RT_SUCCESS(rc))
+        {
+            rc = RTPollSetAddPipe(pDevUsbIp->hPollSet, pDevUsbIp->hPipeR,
+                                  RTPOLL_EVT_READ, USBIP_POLL_ID_PIPE);
+            if (RT_SUCCESS(rc))
+            {
+                /* Connect to the USB/IP host. */
+                rc = usbProxyUsbIpParseAddress(pDevUsbIp, pszAddress);
+                if (RT_SUCCESS(rc))
+                    rc = usbProxyUsbIpConnect(pDevUsbIp);
+            }
+
+            if (RT_FAILURE(rc))
+            {
+                RTPollSetRemove(pDevUsbIp->hPollSet, USBIP_POLL_ID_PIPE);
+                int rc2 = RTPollSetDestroy(pDevUsbIp->hPollSet);
+                AssertRC(rc2);
+            }
+        }
+
+        if (RT_FAILURE(rc))
+        {
+            int rc2 = RTPipeClose(pDevUsbIp->hPipeR);
+            AssertRC(rc2);
+            rc2 = RTPipeClose(pDevUsbIp->hPipeW);
+            AssertRC(rc2);
+        }
+    }
+
+    return rc;
+}
+
+static DECLCALLBACK(void) usbProxyUsbIpClose(PUSBPROXYDEV pProxyDev)
+{
+    int rc = VINF_SUCCESS;
+    LogFlowFunc(("pProxyDev = %p\n", pProxyDev));
+
+    PUSBPROXYDEVUSBIP pDevUsbIp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    /* Destroy the pipe and pollset if necessary. */
+    if (pDevUsbIp->hPollSet != NIL_RTPOLLSET)
+    {
+        if (pDevUsbIp->hSocket != NIL_RTSOCKET)
+        {
+            rc = RTPollSetRemove(pDevUsbIp->hPollSet, USBIP_POLL_ID_SOCKET);
+            Assert(RT_SUCCESS(rc) || rc == VERR_POLL_HANDLE_ID_NOT_FOUND);
+        }
+        rc = RTPollSetRemove(pDevUsbIp->hPollSet, USBIP_POLL_ID_PIPE);
+        AssertRC(rc);
+        rc = RTPollSetDestroy(pDevUsbIp->hPollSet);
+        AssertRC(rc);
+        rc = RTPipeClose(pDevUsbIp->hPipeR);
+        AssertRC(rc);
+        rc = RTPipeClose(pDevUsbIp->hPipeW);
+        AssertRC(rc);
+    }
+
+    if (pDevUsbIp->hSocket != NIL_RTSOCKET)
+        usbProxyUsbIpDisconnect(pDevUsbIp);
+    if (pDevUsbIp->pszHost)
+        RTStrFree(pDevUsbIp->pszHost);
+    if (pDevUsbIp->pszBusId)
+        RTStrFree(pDevUsbIp->pszBusId);
+
+    /* Clear the URB lists. */
+    rc = RTSemFastMutexRequest(pDevUsbIp->hMtxLists);
+    AssertRC(rc);
+    PUSBPROXYURBUSBIP pIter = NULL;
+    PUSBPROXYURBUSBIP pIterNext = NULL;
+    RTListForEachSafe(&pDevUsbIp->ListUrbsInFlight, pIter, pIterNext, USBPROXYURBUSBIP, NodeList)
+    {
+        RTListNodeRemove(&pIter->NodeList);
+        RTMemFree(pIter);
+    }
+
+    RTListForEachSafe(&pDevUsbIp->ListUrbsLanded, pIter, pIterNext, USBPROXYURBUSBIP, NodeList)
+    {
+        RTListNodeRemove(&pIter->NodeList);
+        RTMemFree(pIter);
+    }
+    RTSemFastMutexRelease(pDevUsbIp->hMtxLists);
+    RTSemFastMutexDestroy(pDevUsbIp->hMtxLists);
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpReset(PUSBPROXYDEV pProxyDev, bool fResetOnLinux)
+{
+    LogFlowFunc(("pProxyDev = %p\n", pProxyDev));
+
+    PUSBPROXYDEVUSBIP pDev = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    return VINF_SUCCESS; /* No way to reset the device with the current protocol. */
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpSetConfig(PUSBPROXYDEV pProxyDev, int iCfg)
+{
+    LogFlowFunc(("pProxyDev=%s cfg=%#x\n", pProxyDev->pUsbIns->pszName, iCfg));
+
+    PUSBPROXYDEVUSBIP pDev = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    VUSBSETUP Setup;
+
+    Setup.bmRequestType = 0;
+    Setup.bRequest      = 0x09;
+    Setup.wValue        = iCfg;
+    Setup.wIndex        = 0;
+    Setup.wLength       = 0;
+    return usbProxyUsbIpCtrlUrbExchangeSync(pDev, &Setup);
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpClaimInterface(PUSBPROXYDEV pProxyDev, int ifnum)
+{
+    LogFlowFunc(("pProxyDev=%s ifnum=%#x\n", pProxyDev->pUsbIns->pszName, ifnum));
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpReleaseInterface(PUSBPROXYDEV pProxyDev, int ifnum)
+{
+    LogFlowFunc(("pProxyDev=%s ifnum=%#x\n", pProxyDev->pUsbIns->pszName, ifnum));
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpSetInterface(PUSBPROXYDEV pProxyDev, int ifnum, int setting)
+{
+    LogFlowFunc(("pProxyDev=%p ifnum=%#x setting=%#x\n", pProxyDev, ifnum, setting));
+
+    PUSBPROXYDEVUSBIP pDev = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    VUSBSETUP Setup;
+
+    Setup.bmRequestType = 0x1;
+    Setup.bRequest      = 0x11; /* SET_INTERFACE */
+    Setup.wValue        = setting;
+    Setup.wIndex        = ifnum;
+    Setup.wLength       = 0;
+    return usbProxyUsbIpCtrlUrbExchangeSync(pDev, &Setup);
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpClearHaltedEp(PUSBPROXYDEV pProxyDev, unsigned int iEp)
+{
+    LogFlowFunc(("pProxyDev=%s ep=%u\n", pProxyDev->pUsbIns->pszName, iEp));
+
+    PUSBPROXYDEVUSBIP pDev = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    VUSBSETUP Setup;
+
+    Setup.bmRequestType = 0x2;
+    Setup.bRequest      = 0x01; /* CLEAR_FEATURE */
+    Setup.wValue        = 0x00; /* ENDPOINT_HALT */
+    Setup.wIndex        = iEp;
+    Setup.wLength       = 0;
+    return usbProxyUsbIpCtrlUrbExchangeSync(pDev, &Setup);
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpUrbQueue(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb)
+{
+    LogFlowFunc(("pUrb=%p\n", pUrb));
+
+    PUSBPROXYDEVUSBIP pProxyDevUsbIp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+
+    /* Allocate a USB/IP Urb. */
+    PUSBPROXYURBUSBIP pUrbUsbIp = usbProxyUsbIpUrbAlloc(pProxyDevUsbIp);
+    if (!pUrbUsbIp)
+        return VERR_NO_MEMORY;
+
+    pUrbUsbIp->u32SeqNumUrb = usbProxyUsbIpSeqNumGet(pProxyDevUsbIp);
+
+    UsbIpReqSubmit ReqSubmit;
+    ReqSubmit.Hdr.u32ReqRet           = USBIP_CMD_SUBMIT;
+    ReqSubmit.Hdr.u32SeqNum           = pUrbUsbIp->u32SeqNumUrb;
+    ReqSubmit.Hdr.u32DevId            = pProxyDevUsbIp->u32DevId;
+    ReqSubmit.Hdr.u32Endpoint         = pUrb->EndPt;
+    ReqSubmit.Hdr.u32Direction        = pUrb->enmDir == VUSBDIRECTION_IN ? USBIP_DIR_IN : USBIP_DIR_OUT;
+    ReqSubmit.u32XferFlags            = 0;
+    if (pUrb->enmDir == VUSBDIRECTION_IN && pUrb->fShortNotOk)
+        ReqSubmit.u32XferFlags |= USBIP_XFER_FLAGS_SHORT_NOT_OK;
+
+    ReqSubmit.u32TransferBufferLength = pUrb->cbData;
+    ReqSubmit.u32StartFrame           = 0;
+    ReqSubmit.u32NumIsocPkts          = 0;
+    ReqSubmit.u32Interval             = 0;
+
+    switch (pUrb->enmType)
+    {
+        case VUSBXFERTYPE_MSG:
+            memcpy(&ReqSubmit.Setup, &pUrb->abData, sizeof(ReqSubmit.Setup));
+            LogFlowFunc(("Message (Control) URB\n"));
+            break;
+        case VUSBXFERTYPE_ISOC:
+            ReqSubmit.u32XferFlags |= USBIP_XFER_FLAGS_ISO_ASAP;
+            ReqSubmit.u32NumIsocPkts = pUrb->cIsocPkts;
+#if 0
+            for (unsigned i = 0; i < pUrb->cIsocPkts; i++)
+            {
+                pUrbLnx->KUrb.iso_frame_desc[i].length = pUrb->aIsocPkts[i].cb;
+                pUrbLnx->KUrb.iso_frame_desc[i].actual_length = 0;
+                pUrbLnx->KUrb.iso_frame_desc[i].status = 0x7fff;
+            }
+#else /** @todo: Implement isochronous support */
+            usbProxyUsbIpUrbFree(pProxyDevUsbIp, pUrbUsbIp);
+            return VERR_NOT_SUPPORTED;
+#endif
+            break;
+        case VUSBXFERTYPE_BULK:
+        case VUSBXFERTYPE_INTR:
+            break;
+        default:
+            usbProxyUsbIpUrbFree(pProxyDevUsbIp, pUrbUsbIp);
+            return VERR_INVALID_PARAMETER; /** @todo: better status code. */
+    }
+    usbProxyUsbIpReqSubmitH2N(&ReqSubmit);
+
+    /* Send the command. */
+    RTSGBUF SgBufReq;
+    RTSGSEG aSegReq[2];
+    aSegReq[0].pvSeg = &ReqSubmit;
+    aSegReq[0].cbSeg = sizeof(ReqSubmit);
+    aSegReq[1].pvSeg = &pUrb->abData[0];
+    aSegReq[1].cbSeg = pUrb->cbData;
+    RTSgBufInit(&SgBufReq, &aSegReq[0], RT_ELEMENTS(aSegReq));
+
+    int rc = RTTcpSgWrite(pProxyDevUsbIp->hSocket, &SgBufReq);
+    if (RT_SUCCESS(rc))
+    {
+        /* Link the URB into the list of in flight URBs. */
+        pUrb->Dev.pvPrivate = pUrbUsbIp;
+        pUrbUsbIp->pVUsbUrb = pUrb;
+        usbProxyUsbIpLinkUrb(pProxyDevUsbIp, &pProxyDevUsbIp->ListUrbsInFlight, pUrbUsbIp);
+    }
+    else
+        usbProxyUsbIpUrbFree(pProxyDevUsbIp, pUrbUsbIp);
+
+    return rc;
+}
+
+static DECLCALLBACK(PVUSBURB) usbProxyUsbIpUrbReap(PUSBPROXYDEV pProxyDev, RTMSINTERVAL cMillies)
+{
+    LogFlowFunc(("pProxyDev=%s\n", pProxyDev->pUsbIns->pszName));
+
+    PUSBPROXYDEVUSBIP pDev = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    PUSBPROXYURBUSBIP pUrbUsbIp = NULL;
+    PVUSBURB pUrb = NULL;
+
+    /* Any URBs pending delivery? */
+    if (!RTListIsEmpty(&pDev->ListUrbsLanded))
+    {
+        pUrbUsbIp = RTListGetFirst(&pDev->ListUrbsLanded, USBPROXYURBUSBIP, NodeList);
+        if (pUrbUsbIp)
+        {
+            /* unlink from the pending delivery list */
+            usbProxyUsbIpUnlinkUrb(pDev, pUrbUsbIp);
+        }
+    }
+
+    if (!pUrbUsbIp)
+    {
+        uint32_t uIdReady = 0;
+        uint32_t fEventsRecv = 0;
+
+        if (!ASMAtomicXchgBool(&pDev->fWokenUp, false))
+        {
+            int rc = RTPoll(pDev->hPollSet, cMillies, &fEventsRecv, &uIdReady);
+            Assert(RT_SUCCESS(rc) || rc == VERR_TIMEOUT);
+        }
+
+        UsbIpRet Reply;
+    }
+
+    if (pUrbUsbIp)
+    {
+
+    }
+
+    return pUrb;
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpUrbCancel(PUSBPROXYDEV pProxyDev, PVUSBURB pUrb)
+{
+    LogFlowFunc(("pUrb=%p\n", pUrb));
+
+    PUSBPROXYDEVUSBIP pProxyDevUsbIp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    PUSBPROXYURBUSBIP pUrbUsbIp = (PUSBPROXYURBUSBIP)pUrb->Dev.pvPrivate;
+    UsbIpReqUnlink ReqUnlink;
+
+    uint32_t u32SeqNum = usbProxyUsbIpSeqNumGet(pProxyDevUsbIp);
+    ReqUnlink.Hdr.u32ReqRet           = USBIP_CMD_UNLINK;
+    ReqUnlink.Hdr.u32SeqNum           = u32SeqNum;
+    ReqUnlink.Hdr.u32DevId            = pProxyDevUsbIp->u32DevId;
+    ReqUnlink.Hdr.u32Direction        = USBIP_DIR_OUT;
+    ReqUnlink.Hdr.u32Endpoint         = pUrb->EndPt;
+    ReqUnlink.u32SeqNum               = pUrbUsbIp->u32SeqNumUrb;
+
+    int rc = RTTcpWrite(pProxyDevUsbIp->hSocket, &ReqUnlink, sizeof(ReqUnlink));
+    /* Wait for the reply. */
+    return rc;
+}
+
+static DECLCALLBACK(int) usbProxyUsbIpWakeup(PUSBPROXYDEV pProxyDev)
+{
+    LogFlowFunc(("pProxyDev=%s\n", pProxyDev->pUsbIns->pszName));
+
+    PUSBPROXYDEVUSBIP pDevUsbIp = USBPROXYDEV_2_DATA(pProxyDev, PUSBPROXYDEVUSBIP);
+    int rc = VINF_SUCCESS;
+
+    if (!ASMAtomicXchgBool(&pDevUsbIp->fWokenUp, true))
+    {
+        size_t cbWritten = 0;
+
+        rc = RTPipeWrite(pDevUsbIp->hPipeW, "", 1, &cbWritten);
+        Assert(RT_SUCCESS(rc) || cbWritten == 0);
+    }
+
+    return rc;
+}
+
+/**
+ * The USB/IP USB Proxy Backend operations.
+ */
+extern const USBPROXYBACK g_USBProxyDeviceUsbIp =
+{
+    /* pszName */
+    "usbip",
+    /* cbBackend */
+    sizeof(USBPROXYDEVUSBIP),
+    usbProxyUsbIpOpen,
+    NULL,
+    usbProxyUsbIpClose,
+    usbProxyUsbIpReset,
+    usbProxyUsbIpSetConfig,
+    usbProxyUsbIpClaimInterface,
+    usbProxyUsbIpReleaseInterface,
+    usbProxyUsbIpSetInterface,
+    usbProxyUsbIpClearHaltedEp,
+    usbProxyUsbIpUrbQueue,
+    usbProxyUsbIpUrbCancel,
+    usbProxyUsbIpUrbReap,
+    usbProxyUsbIpWakeup,
+    0
+};
+
diff --git a/src/VBox/Devices/VMMDev/VMMDev.cpp b/src/VBox/Devices/VMMDev/VMMDev.cpp
index 26a4f5b..42e1c84 100644
--- a/src/VBox/Devices/VMMDev/VMMDev.cpp
+++ b/src/VBox/Devices/VMMDev/VMMDev.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -89,6 +89,10 @@
 /** The saved state version used by VirtualBox 3.0.
  *  This doesn't have the config part. */
 #define VMMDEV_SAVED_STATE_VERSION_VBOX_30                      11
+/** Default interval in nanoseconds between guest heartbeats.
+ *  Used when no HeartbeatInterval is set in CFGM and for setting
+ *  HB check timer if the guest's heartbeat frequency is less than 1Hz. */
+#define HEARTBEAT_DEFAULT_INTERVAL            UINT64_C(2000000000)
 
 
 #ifndef VBOX_DEVICE_STRUCT_TESTCASE
@@ -335,7 +339,7 @@ static int vmmdevReqHandler_ReportGuestInfo(PVMMDEV pThis, VMMDevRequestHeader *
         /* Check additions interface version. */
         pThis->fu32AdditionsOk = VBOX_GUEST_INTERFACE_VERSION_OK(pThis->guestInfo.interfaceVersion);
 
-        LogRel(("Guest Additions information report: Interface = 0x%08X osType = 0x%08X (%u-bit)\n",
+        LogRel(("VMMDev: Guest Additions information report: Interface = 0x%08X osType = 0x%08X (%u-bit)\n",
                 pThis->guestInfo.interfaceVersion, pThis->guestInfo.osType,
                 (pThis->guestInfo.osType & VBOXOSTYPE_x64) ? 64 : 32));
 
@@ -354,6 +358,109 @@ static int vmmdevReqHandler_ReportGuestInfo(PVMMDEV pThis, VMMDevRequestHeader *
 
 
 /**
+ * Resets heartbeat timer.
+ *
+ * @param   pThis           The VMMDev state.
+ * @returns VBox status code.
+ */
+static int vmmDevHeartbeatTimerReset(PVMMDEV pThis)
+{
+    if (pThis->fHBCheckEnabled)
+        return TMTimerSetNano(pThis->pHBCheckTimer, pThis->u64HeartbeatTimeout);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Handles VMMDevReq_GuestHeartbeat.
+ *
+ * @returns VBox status code that the guest should see.
+ * @param   pThis    The VMMDev instance data.
+ */
+static int vmmDevReqHandler_GuestHeartbeat(PVMMDEV pThis)
+{
+    int rc = VINF_SUCCESS;
+
+    if (pThis->fHBCheckEnabled)
+    {
+        ASMAtomicWriteU64(&pThis->uLastHBTime, TMTimerGetNano(pThis->pHBCheckTimer));
+        if (pThis->fHasMissedHB)
+        {
+            LogRel(("VMMDev: GuestHeartBeat: Guest is alive\n"));
+            ASMAtomicWriteBool(&pThis->fHasMissedHB, false);
+        }
+        rc = vmmDevHeartbeatTimerReset(pThis);
+    }
+    return rc;
+}
+
+
+/**
+ * Guest heartbeat check timer. Fires if there are no heartbeats for certain time.
+ * Timer is set in vmmDevHeartbeatTimerReset.
+ */
+static DECLCALLBACK(void) vmmDevHeartBeatCheckTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
+{
+    PVMMDEV pThis = (PVMMDEV) pvUser;
+    if (pThis->fHBCheckEnabled)
+    {
+        uint64_t uIntervalNs = TMTimerGetNano(pTimer) - pThis->uLastHBTime;
+        if (!pThis->fHasMissedHB && uIntervalNs >= pThis->u64HeartbeatInterval)
+        {
+            LogRel(("VMMDev: HeartBeatCheckTimer: Guest seems to be unresponsive. Last heartbeat received %RU64 seconds ago\n",
+                    uIntervalNs / RT_NS_1SEC_64));
+            ASMAtomicWriteBool(&pThis->fHasMissedHB, true);
+        }
+    }
+}
+
+
+/**
+ * Handles VMMDevReq_HeartbeatConfigure.
+ *
+ * @returns VBox status code that the guest should see.
+ * @param   pThis     The VMMDev instance data.
+ * @param   pReqHdr   The header of the request to handle.
+ */
+static int vmmDevReqHandler_HeartbeatConfigure(PVMMDEV pThis, VMMDevRequestHeader *pReqHdr)
+{
+    AssertMsgReturn(pReqHdr->size == sizeof(VMMDevReqHeartbeat), ("%u\n", pReqHdr->size), VERR_INVALID_PARAMETER);
+    VMMDevReqHeartbeat *pReq = (VMMDevReqHeartbeat *)pReqHdr;
+    int rc;
+
+    pReq->cNsInterval = pThis->u64HeartbeatInterval;
+
+    if (pReq->fEnabled != pThis->fHBCheckEnabled)
+    {
+        ASMAtomicWriteBool(&pThis->fHBCheckEnabled, pReq->fEnabled);
+        if (pReq->fEnabled)
+        {
+            /* set first timer explicitly */
+            rc = vmmDevHeartbeatTimerReset(pThis);
+            if (RT_SUCCESS(rc))
+                LogRel(("VMMDev: Heartbeat checking timer set to trigger every %RU64 milliseconds\n",
+                        pThis->u64HeartbeatTimeout / RT_NS_1MS));
+            else
+                LogRel(("VMMDev: Cannot create heartbeat check timer, rc=%Rrc\n", rc));
+        }
+        else
+        {
+            rc = TMTimerStop(pThis->pHBCheckTimer);
+            LogRel(("VMMDev: Heartbeat checking timer has been stopped, rc=%Rrc\n", rc));
+        }
+    }
+    else
+    {
+        LogRel(("VMMDev: vmmDevReqHandler_HeartbeatConfigure: fHBCheckEnabled=%RTbool\n", pThis->fHBCheckEnabled));
+        rc = VINF_SUCCESS;
+    }
+
+    return rc;
+}
+
+
+/**
  * Validates a publisher tag.
  *
  * @returns true / false.
@@ -413,7 +520,7 @@ static int vmmdevReqHandler_ReportGuestInfo2(PVMMDEV pThis, VMMDevRequestHeader
     AssertMsgReturn(pReqHdr->size == sizeof(VMMDevReportGuestInfo2), ("%u\n", pReqHdr->size), VERR_INVALID_PARAMETER);
     VBoxGuestInfo2 const *pInfo2 = &((VMMDevReportGuestInfo2 *)pReqHdr)->guestInfo;
 
-    LogRel(("Guest Additions information report: Version %d.%d.%d r%d '%.*s'\n",
+    LogRel(("VMMDev: Guest Additions information report: Version %d.%d.%d r%d '%.*s'\n",
             pInfo2->additionsMajor, pInfo2->additionsMinor, pInfo2->additionsBuild,
             pInfo2->additionsRevision, sizeof(pInfo2->szName), pInfo2->szName));
 
@@ -481,7 +588,7 @@ static int vmmdevReqHandler_ReportGuestInfo2(PVMMDEV pThis, VMMDevRequestHeader
             AssertLogRelMsgReturn(!fStrict, ("%s", pszName), VERR_INVALID_PARAMETER);
 
             /* non-strict mode, just zap the extra stuff. */
-            LogRel(("ReportGuestInfo2: Ignoring unparsable version name bits: '%s' -> '%s'.\n", pszName, pszRelaxedName));
+            LogRel(("VMMDev: ReportGuestInfo2: Ignoring unparsable version name bits: '%s' -> '%s'.\n", pszName, pszRelaxedName));
             pszName = pszRelaxedName;
         }
     }
@@ -636,9 +743,7 @@ static int vmmdevReqHandler_ReportGuestStatus(PVMMDEV pThis, VMMDevRequestHeader
         PVMMDEVFACILITYSTATUSENTRY pEntry = vmmdevGetFacilityStatusEntry(pThis, pStatus->facility);
         if (!pEntry)
         {
-            static int g_cLogEntries = 0;
-            if (g_cLogEntries++ < 10)
-                LogRel(("VMM: Facility table is full - facility=%u status=%u.\n", pStatus->facility, pStatus->status));
+            LogRelMax(10, ("VMMDev: Facility table is full - facility=%u status=%u.\n", pStatus->facility, pStatus->status));
             return VERR_OUT_OF_RESOURCES;
         }
 
@@ -736,7 +841,7 @@ static int vmmdevReqHandler_ReportGuestCapabilities(PVMMDEV pThis, VMMDevRequest
         /* make a copy of supplied information */
         pThis->guestCaps = fu32Caps;
 
-        LogRel(("Guest Additions capability report (legacy): (0x%x) seamless: %s, hostWindowMapping: %s, graphics: yes\n",
+        LogRel(("VMMDev: Guest Additions capability report (legacy): (0x%x) seamless: %s, hostWindowMapping: %s, graphics: yes\n",
                 fu32Caps,
                 fu32Caps & VMMDEV_GUEST_SUPPORTS_SEAMLESS ? "yes" : "no",
                 fu32Caps & VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING ? "yes" : "no"));
@@ -764,7 +869,7 @@ static int vmmdevReqHandler_SetGuestCapabilities(PVMMDEV pThis, VMMDevRequestHea
     fu32Caps |= pReq->u32OrMask;
     fu32Caps &= ~pReq->u32NotMask;
 
-    LogRel(("Guest Additions capability report: (%#x -> %#x) seamless: %s, hostWindowMapping: %s, graphics: %s\n",
+    LogRel(("VMMDev: Guest Additions capability report: (%#x -> %#x) seamless: %s, hostWindowMapping: %s, graphics: %s\n",
             pThis->guestCaps, fu32Caps,
             fu32Caps & VMMDEV_GUEST_SUPPORTS_SEAMLESS ? "yes" : "no",
             fu32Caps & VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING ? "yes" : "no",
@@ -795,7 +900,7 @@ static int vmmdevReqHandler_GetMouseStatus(PVMMDEV pThis, VMMDevRequestHeader *p
                         & VMMDEV_MOUSE_MASK;
     pReq->pointerXPos   = pThis->mouseXAbs;
     pReq->pointerYPos   = pThis->mouseYAbs;
-    LogRel2(("VMMDevReq_GetMouseStatus: features = %#x, xAbs = %d, yAbs = %d\n",
+    LogRel2(("VMMDev: vmmdevReqHandler_GetMouseStatus: mouseFeatures=%#x, xAbs=%d, yAbs=%d\n",
              pReq->mouseFeatures, pReq->pointerXPos, pReq->pointerYPos));
     return VINF_SUCCESS;
 }
@@ -813,7 +918,7 @@ static int vmmdevReqHandler_SetMouseStatus(PVMMDEV pThis, VMMDevRequestHeader *p
     VMMDevReqMouseStatus *pReq = (VMMDevReqMouseStatus *)pReqHdr;
     AssertMsgReturn(pReq->header.size == sizeof(*pReq), ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER);
 
-    LogRelFlowFunc(("mouseFeatures = %#x\n", pReq->mouseFeatures));
+    LogRelFlow(("VMMDev: vmmdevReqHandler_SetMouseStatus: mouseFeatures=%#x\n", pReq->mouseFeatures));
 
     bool fNotify = false;
     if (   (pReq->mouseFeatures & VMMDEV_MOUSE_NOTIFY_HOST_MASK)
@@ -824,14 +929,14 @@ static int vmmdevReqHandler_SetMouseStatus(PVMMDEV pThis, VMMDevRequestHeader *p
     pThis->mouseCapabilities &= ~VMMDEV_MOUSE_GUEST_MASK;
     pThis->mouseCapabilities |= (pReq->mouseFeatures & VMMDEV_MOUSE_GUEST_MASK);
 
-    LogRelFlowFunc(("new host capabilities: %#x\n", pThis->mouseCapabilities));
+    LogRelFlow(("VMMDev: vmmdevReqHandler_SetMouseStatus: New host capabilities: %#x\n", pThis->mouseCapabilities));
 
     /*
      * Notify connector if something changed.
      */
     if (fNotify)
     {
-        LogRelFlowFunc(("notifying connector\n"));
+        LogRelFlow(("VMMDev: vmmdevReqHandler_SetMouseStatus: Notifying connector\n"));
         pThis->pDrv->pfnUpdateMouseCapabilities(pThis->pDrv, pThis->mouseCapabilities);
     }
 
@@ -974,8 +1079,8 @@ static int vmmdevReqHandler_SetHypervisorInfo(PVMMDEV pThis, VMMDevRequestHeader
         {
             /* new reservation */
             rc = PGMR3MappingsFix(pVM, pReq->hypervisorStart, pReq->hypervisorSize);
-            LogRel(("Guest reported fixed hypervisor window at 0%010x (size = %#x, rc = %Rrc)\n",
-                    pReq->hypervisorStart, pReq->hypervisorSize, rc));
+            LogRel(("VMMDev: Guest reported fixed hypervisor window at 0%010x (size = %#x, rc = %Rrc)\n", pReq->hypervisorStart,
+                    pReq->hypervisorSize, rc));
         }
         else if (RT_FAILURE(rc))
             rc = VERR_TRY_AGAIN;
@@ -1032,13 +1137,13 @@ static int vmmdevReqHandler_SetPowerStatus(PVMMDEV pThis, VMMDevRequestHeader *p
     {
         case VMMDevPowerState_Pause:
         {
-            LogRel(("Guest requests the VM to be suspended (paused)\n"));
+            LogRel(("VMMDev: Guest requests the VM to be suspended (paused)\n"));
             return PDMDevHlpVMSuspend(pThis->pDevIns);
         }
 
         case VMMDevPowerState_PowerOff:
         {
-            LogRel(("Guest requests the VM to be turned off\n"));
+            LogRel(("VMMDev: Guest requests the VM to be turned off\n"));
             return PDMDevHlpVMPowerOff(pThis->pDevIns);
         }
 
@@ -1046,15 +1151,15 @@ static int vmmdevReqHandler_SetPowerStatus(PVMMDEV pThis, VMMDevRequestHeader *p
         {
             if (true /*pThis->fAllowGuestToSaveState*/)
             {
-                LogRel(("Guest requests the VM to be saved and powered off\n"));
+                LogRel(("VMMDev: Guest requests the VM to be saved and powered off\n"));
                 return PDMDevHlpVMSuspendSaveAndPowerOff(pThis->pDevIns);
             }
-            LogRel(("Guest requests the VM to be saved and powered off, declined\n"));
+            LogRel(("VMMDev: Guest requests the VM to be saved and powered off, declined\n"));
             return VERR_ACCESS_DENIED;
         }
 
         default:
-            AssertMsgFailed(("VMMDev invalid power state request: %d\n", pReq->powerState));
+            AssertMsgFailed(("VMMDev: Invalid power state request: %d\n", pReq->powerState));
             return VERR_INVALID_PARAMETER;
     }
 }
@@ -1426,7 +1531,7 @@ static int vmmdevReqHandler_CtlGuestFilterMask(PVMMDEV pThis, VMMDevRequestHeade
     VMMDevCtlGuestFilterMask *pReq = (VMMDevCtlGuestFilterMask *)pReqHdr;
     AssertMsgReturn(pReq->header.size == sizeof(*pReq), ("%u\n", pReq->header.size), VERR_INVALID_PARAMETER);
 
-    LogRelFlowFunc(("VMMDevCtlGuestFilterMask: or mask: %#x, not mask: %#x\n", pReq->u32OrMask, pReq->u32NotMask));
+    LogRelFlow(("VMMDev: vmmdevReqHandler_CtlGuestFilterMask: OR mask: %#x, NOT mask: %#x\n", pReq->u32OrMask, pReq->u32NotMask));
 
     /* HGCM event notification is enabled by the VMMDev device
      * automatically when any HGCM command is issued.  The guest
@@ -1516,8 +1621,6 @@ static int vmmdevReqHandler_HGCMCall(PVMMDEV pThis, VMMDevRequestHeader *pReqHdr
     return vmmdevHGCMCall(pThis, pReq, pReq->header.header.size, GCPhysReqHdr, f64Bits);
 }
 
-#endif /* VBOX_WITH_HGCM */
-
 /**
  * Handles VMMDevReq_HGCMCancel.
  *
@@ -1564,6 +1667,8 @@ static int vmmdevReqHandler_HGCMCancel2(PVMMDEV pThis, VMMDevRequestHeader *pReq
     return vmmdevHGCMCancel2(pThis, pReq->physReqToCancel);
 }
 
+#endif /* VBOX_WITH_HGCM */
+
 
 /**
  * Handles VMMDevReq_VideoAccelEnable.
@@ -2407,7 +2512,6 @@ static int vmmdevReqDispatcher(PVMMDEV pThis, VMMDevRequestHeader *pReqHdr, RTGC
             pReqHdr->rc = vmmdevReqHandler_HGCMCall(pThis, pReqHdr, GCPhysReqHdr);
             *pfDelayedUnlock = true;
             break;
-#endif /* VBOX_WITH_HGCM */
 
         case VMMDevReq_HGCMCancel:
             pReqHdr->rc = vmmdevReqHandler_HGCMCancel(pThis, pReqHdr, GCPhysReqHdr);
@@ -2417,6 +2521,7 @@ static int vmmdevReqDispatcher(PVMMDEV pThis, VMMDevRequestHeader *pReqHdr, RTGC
         case VMMDevReq_HGCMCancel2:
             pReqHdr->rc = vmmdevReqHandler_HGCMCancel2(pThis, pReqHdr);
             break;
+#endif /* VBOX_WITH_HGCM */
 
         case VMMDevReq_VideoAccelEnable:
             pReqHdr->rc = vmmdevReqHandler_VideoAccelEnable(pThis, pReqHdr);
@@ -2519,6 +2624,14 @@ static int vmmdevReqDispatcher(PVMMDEV pThis, VMMDevRequestHeader *pReqHdr, RTGC
             break;
         }
 
+        case VMMDevReq_GuestHeartbeat:
+            pReqHdr->rc = vmmDevReqHandler_GuestHeartbeat(pThis);
+            break;
+
+        case VMMDevReq_HeartbeatConfigure:
+            pReqHdr->rc = vmmDevReqHandler_HeartbeatConfigure(pThis, pReqHdr);
+            break;
+
         default:
         {
             pReqHdr->rc = VERR_NOT_IMPLEMENTED;
@@ -2612,24 +2725,14 @@ static DECLCALLBACK(int) vmmdevRequestHandler(PPDMDEVINS pDevIns, void *pvUser,
         }
         else
         {
-            static int s_cRelWarn;
-            if (s_cRelWarn < 10)
-            {
-                s_cRelWarn++;
-                LogRel(("VMMDev: the guest has not yet reported to us -- refusing operation of request #%d\n",
-                        requestHeader.requestType));
-            }
+            LogRelMax(10, ("VMMDev: Guest has not yet reported to us -- refusing operation of request #%d\n",
+                           requestHeader.requestType));
             requestHeader.rc = VERR_NOT_SUPPORTED;
         }
     }
     else
     {
-        static int s_cRelWarn;
-        if (s_cRelWarn < 50)
-        {
-            s_cRelWarn++;
-            LogRel(("VMMDev: request packet too big (%x). Refusing operation.\n", requestHeader.size));
-        }
+        LogRelMax(50, ("VMMDev: Request packet too big (%x). Refusing operation.\n", requestHeader.size));
         requestHeader.rc = VERR_NOT_SUPPORTED;
     }
 
@@ -2773,7 +2876,7 @@ static DECLCALLBACK(int) vmmdevBackdoorLog(PPDMDEVINS pDevIns, void *pvUser, RTI
         {
             pThis->szMsg[pThis->iMsg] = '\0';
             if (pThis->iMsg)
-                LogRelIt(LOG_REL_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP_DEV_VMM_BACKDOOR, ("Guest Log: %s\n", pThis->szMsg));
+                LogRelIt(LOG_REL_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP_DEV_VMM_BACKDOOR, ("VMMDev: Guest Log: %s\n", pThis->szMsg));
             pThis->iMsg = 0;
         }
         else
@@ -2781,7 +2884,7 @@ static DECLCALLBACK(int) vmmdevBackdoorLog(PPDMDEVINS pDevIns, void *pvUser, RTI
             if (pThis->iMsg >= sizeof(pThis->szMsg)-1)
             {
                 pThis->szMsg[pThis->iMsg] = '\0';
-                LogRelIt(LOG_REL_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP_DEV_VMM_BACKDOOR, ("Guest Log: %s\n", pThis->szMsg));
+                LogRelIt(LOG_REL_INSTANCE, RTLOGGRPFLAGS_LEVEL_1, LOG_GROUP_DEV_VMM_BACKDOOR, ("VMMDev: Guest Log: %s\n", pThis->szMsg));
                 pThis->iMsg = 0;
             }
             pThis->szMsg[pThis->iMsg] = (char )u32;
@@ -2962,7 +3065,8 @@ vmmdevIPort_UpdateMouseCapabilities(PPDMIVMMDEVPORT pInterface, uint32_t fCapsAd
                               | VMMDEV_MOUSE_HOST_RECHECKS_NEEDS_HOST_CURSOR;
     bool fNotify = fOldCaps != pThis->mouseCapabilities;
 
-    LogRelFlowFunc(("fCapsAdded=0x%x, fCapsRemoved=0x%x, fNotify=%RTbool\n", fCapsAdded, fCapsRemoved, fNotify));
+    LogRelFlow(("VMMDev: vmmdevIPort_UpdateMouseCapabilities: fCapsAdded=0x%x, fCapsRemoved=0x%x, fNotify=%RTbool\n", fCapsAdded,
+                fCapsRemoved, fNotify));
 
     if (fNotify)
         VMMDevNotifyGuest(pThis, VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED);
@@ -3208,7 +3312,7 @@ static DECLCALLBACK(int) vmmdevIPort_CpuHotUnplug(PPDMIVMMDEVPORT pInterface, ui
         VMMDevNotifyGuest(pThis, VMMDEV_EVENT_CPU_HOTPLUG);
     }
     else
-        rc = VERR_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST;
+        rc = VERR_VMMDEV_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST;
 
     PDMCritSectLeave(&pThis->CritSect);
     return rc;
@@ -3234,7 +3338,7 @@ static DECLCALLBACK(int) vmmdevIPort_CpuHotPlug(PPDMIVMMDEVPORT pInterface, uint
         VMMDevNotifyGuest(pThis, VMMDEV_EVENT_CPU_HOTPLUG);
     }
     else
-        rc = VERR_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST;
+        rc = VERR_VMMDEV_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST;
 
     PDMCritSectLeave(&pThis->CritSect);
     return rc;
@@ -3361,7 +3465,7 @@ static DECLCALLBACK(int) vmmdevLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uin
     SSMR3GetU32(pSSM, &pThis->u32GuestFilterMask);
     SSMR3GetU32(pSSM, &pThis->u32HostEventFlags);
 
-//    SSMR3GetBool(pSSM, &pThis->pVMMDevRAMR3->fHaveEvents);
+    //SSMR3GetBool(pSSM, &pThis->pVMMDevRAMR3->fHaveEvents);
     // here be dragons (probably)
     SSMR3GetMem(pSSM, &pThis->pVMMDevRAMR3->V, sizeof (pThis->pVMMDevRAMR3->V));
 
@@ -3446,16 +3550,9 @@ static DECLCALLBACK(int) vmmdevLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uin
                                                /*pvShape=*/NULL);
     }
 
-    /* Reestablish the acceleration status. */
-    if (    pThis->u32VideoAccelEnabled
-        &&  pThis->pDrv)
-    {
-        pThis->pDrv->pfnVideoAccelEnable(pThis->pDrv, !!pThis->u32VideoAccelEnabled, &pThis->pVMMDevRAMR3->vbvaMemory);
-    }
-
     if (pThis->fu32AdditionsOk)
     {
-        LogRel(("Guest Additions information report: additionsVersion = 0x%08X, osType = 0x%08X (%u-bit)\n",
+        LogRel(("VMMDev: Guest Additions information report: additionsVersion = 0x%08X, osType = 0x%08X (%u-bit)\n",
                 pThis->guestInfo.interfaceVersion, pThis->guestInfo.osType,
                 (pThis->guestInfo.osType & VBOXOSTYPE_x64) ? 64 : 32));
         if (pThis->pDrv)
@@ -3501,6 +3598,13 @@ static DECLCALLBACK(int) vmmdevLoadStateDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM
     AssertLogRelRCReturn(rc, rc);
 #endif /* VBOX_WITH_HGCM */
 
+    /* Reestablish the acceleration status. */
+    if (    pThis->u32VideoAccelEnabled
+        &&  pThis->pDrv)
+    {
+        pThis->pDrv->pfnVideoAccelEnable(pThis->pDrv, !!pThis->u32VideoAccelEnabled, &pThis->pVMMDevRAMR3->vbvaMemory);
+    }
+
     VMMDevNotifyGuest(pThis, VMMDEV_EVENT_RESTORED);
 
     return VINF_SUCCESS;
@@ -3601,8 +3705,10 @@ static DECLCALLBACK(void) vmmdevReset(PPDMDEVINS pDevIns)
     /* disabled statistics updating */
     pThis->u32LastStatIntervalSize = 0;
 
+#ifdef VBOX_WITH_HGCM
     /* Clear the "HGCM event enabled" flag so the event can be automatically reenabled.  */
     pThis->u32HGCMEnabled = 0;
+#endif
 
     /*
      * Clear the event variables.
@@ -3764,6 +3870,8 @@ static DECLCALLBACK(int) vmmdevConstruct(PPDMDEVINS pDevIns, int iInstance, PCFG
                                   "GuestCoreDumpEnabled|"
                                   "GuestCoreDumpDir|"
                                   "GuestCoreDumpCount|"
+                                  "HeartbeatInterval|"
+                                  "HeartbeatTimeout|"
                                   "TestingEnabled|"
                                   "TestingMMIO|"
                                   "TestintXmlOutputFile"
@@ -3819,6 +3927,22 @@ static DECLCALLBACK(int) vmmdevConstruct(PPDMDEVINS pDevIns, int iInstance, PCFG
         return PDMDEV_SET_ERROR(pDevIns, rc,
                                 N_("Configuration error: Failed querying \"GuestCoreDumpCount\" as a 32-bit unsigned integer"));
 
+    rc = CFGMR3QueryU64Def(pCfg, "HeartbeatInterval", &pThis->u64HeartbeatInterval, HEARTBEAT_DEFAULT_INTERVAL);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"HeartbeatInterval\" as a 64-bit unsigned integer"));
+    if (pThis->u64HeartbeatInterval < RT_NS_100MS/2)
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Heartbeat interval \"HeartbeatInterval\" too small"));
+
+    rc = CFGMR3QueryU64Def(pCfg, "HeartbeatTimeout", &pThis->u64HeartbeatTimeout, pThis->u64HeartbeatInterval * 2);
+    if (RT_FAILURE(rc))
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Failed querying \"HeartbeatTimeout\" as a 64-bit unsigned integer"));
+    if (pThis->u64HeartbeatTimeout < RT_NS_100MS)
+        return PDMDEV_SET_ERROR(pDevIns, rc,
+                                N_("Configuration error: Heartbeat timeout timer interval \"HeartbeatTimeout\" too small"));
+
 #ifndef VBOX_WITHOUT_TESTING_FEATURES
     rc = CFGMR3QueryBoolDef(pCfg, "TestingEnabled", &pThis->fTestingEnabled, false);
     if (RT_FAILURE(rc))
@@ -3965,6 +4089,13 @@ static DECLCALLBACK(int) vmmdevConstruct(PPDMDEVINS pDevIns, int iInstance, PCFG
                                 NULL, vmmdevLoadExec, vmmdevLoadStateDone);
     AssertRCReturn(rc, rc);
 
+    /*
+     * Create heartbeat checking timer.
+     */
+    rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, vmmDevHeartBeatCheckTimer, pThis,
+                        TMTIMER_FLAGS_NO_CRIT_SECT, "HB Check Timer", &pThis->pHBCheckTimer);
+    AssertRCReturn(rc, rc);
+
 #ifdef VBOX_WITH_HGCM
     pThis->pHGCMCmdList = NULL;
     rc = RTCritSectInit(&pThis->critsectHGCMCmdList);
diff --git a/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp b/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
index d495599..782b99f 100644
--- a/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
+++ b/src/VBox/Devices/VMMDev/VMMDevHGCM.cpp
@@ -651,12 +651,7 @@ int vmmdevHGCMCall (PVMMDEV pThis, VMMDevHGCMCall *pHGCMCall, uint32_t cbHGCMCal
      */
     if (cParms > VMMDEV_MAX_HGCM_PARMS)
     {
-        static int s_cRelWarn;
-        if (s_cRelWarn < 50)
-        {
-            s_cRelWarn++;
-            LogRel(("VMMDev: request packet with too many parameters (%d). Refusing operation.\n", cParms));
-        }
+        LogRelMax(50, ("VMMDev: request packet with too many parameters (%d). Refusing operation.\n", cParms));
         return VERR_INVALID_PARAMETER;
     }
 
@@ -1200,12 +1195,7 @@ static int vmmdevHGCMCallSaved (PVMMDEV pThis, VMMDevHGCMCall *pHGCMCall, RTGCPH
      */
     if (cParms > VMMDEV_MAX_HGCM_PARMS)
     {
-        static int s_cRelWarn;
-        if (s_cRelWarn < 50)
-        {
-            s_cRelWarn++;
-            LogRel(("VMMDev: request packet with too many parameters (%d). Refusing operation.\n", cParms));
-        }
+        LogRelMax(50, ("VMMDev: request packet with too many parameters (%d). Refusing operation.\n", cParms));
         return VERR_INVALID_PARAMETER;
     }
 
diff --git a/src/VBox/Devices/VMMDev/VMMDevState.h b/src/VBox/Devices/VMMDev/VMMDevState.h
index b04c0cd..c13fd70 100644
--- a/src/VBox/Devices/VMMDev/VMMDevState.h
+++ b/src/VBox/Devices/VMMDev/VMMDevState.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -229,7 +229,7 @@ typedef struct VMMDevState
 
     /* memory balloon change request */
     uint32_t    cMbMemoryBalloon;
-    /** The last balloon size queried by the guest additions.  */
+    /** The last balloon size queried by the guest additions. */
     uint32_t    cMbMemoryBalloonLast;
 
     /* guest ram size */
@@ -272,7 +272,7 @@ typedef struct VMMDevState
     /** Guest Core Dump location. */
     char szGuestCoreDumpDir[RTPATH_MAX];
 
-    /** Number of additional cores to keep around.   */
+    /** Number of additional cores to keep around. */
     uint32_t cGuestCoreDumps;
 
     bool afAlignment7[1];
@@ -358,6 +358,21 @@ typedef struct VMMDevState
     /** Testing instance for dealing with the output. */
     RTTEST                  hTestingTest;
 #endif /* !VBOX_WITHOUT_TESTING_FEATURES */
+
+    /** Timestamp of the last heartbeat from guest in nanosec. */
+    uint64_t volatile   uLastHBTime;
+    /** Indicates whether we missed HB from guest on last check. */
+    bool volatile       fHasMissedHB;
+    /** Indicates whether heartbeat check is active. */
+    bool volatile       fHBCheckEnabled;
+    /** Alignment padding. */
+    bool                afAlignment8[6];
+    /** Guest heartbeat interval in nanoseconds. */
+    uint64_t            u64HeartbeatInterval;
+    /** Guest heartbeat timeout in nanoseconds. */
+    uint64_t            u64HeartbeatTimeout;
+    /** Timer for checking guest heart beat. */
+    PTMTIMERR3          pHBCheckTimer;
 } VMMDevState;
 typedef VMMDevState VMMDEV;
 /** Pointer to the VMM device state. */
diff --git a/src/VBox/Devices/build/VBoxDD.cpp b/src/VBox/Devices/build/VBoxDD.cpp
index f7023ff..04b6e6c 100644
--- a/src/VBox/Devices/build/VBoxDD.cpp
+++ b/src/VBox/Devices/build/VBoxDD.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -124,9 +124,11 @@ extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceICH6_HDA);
     if (RT_FAILURE(rc))
         return rc;
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
     if (RT_FAILURE(rc))
         return rc;
+#endif
 #ifdef VBOX_WITH_VUSB
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceOHCI);
     if (RT_FAILURE(rc))
@@ -137,6 +139,11 @@ extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t
     if (RT_FAILURE(rc))
         return rc;
 #endif
+#ifdef VBOX_WITH_XHCI_IMPL
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceXHCI);
+    if (RT_FAILURE(rc))
+        return rc;
+#endif
 #ifdef VBOX_ACPI
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceACPI);
     if (RT_FAILURE(rc))
@@ -183,6 +190,9 @@ extern "C" DECLEXPORT(int) VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t
     if (RT_FAILURE(rc))
         return rc;
 #endif
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceGIMDev);
+    if (RT_FAILURE(rc))
+        return rc;
 #ifdef VBOX_WITH_VIRTUALKD
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceVirtualKD);
     if (RT_FAILURE(rc))
@@ -268,6 +278,46 @@ extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvAUDIO);
     if (RT_FAILURE(rc))
         return rc;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostNullAudio);
+    if (RT_FAILURE(rc))
+        return rc;
+# if defined(RT_OS_WINDOWS)
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostDSound);
+    if (RT_FAILURE(rc))
+        return rc;
+# endif
+# if defined(RT_OS_LINUX)
+#  ifdef VBOX_WITH_PULSE
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostPulseAudio);
+    if (RT_FAILURE(rc))
+        return rc;
+#  endif
+#  ifdef VBOX_WITH_ALSA
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostALSAAudio);
+    if (RT_FAILURE(rc))
+        return rc;
+#  endif
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
+    if (RT_FAILURE(rc))
+        return rc;
+# endif
+# if defined(RT_OS_FREEBSD)
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
+    if (RT_FAILURE(rc))
+        return rc;
+# endif
+# if defined(RT_OS_DARWIN)
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostCoreAudio);
+    if (RT_FAILURE(rc))
+        return rc;
+# endif
+# if defined(RT_OS_SOLARIS)
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
+    if (RT_FAILURE(rc))
+        return rc;
+# endif
+#endif
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvACPI);
     if (RT_FAILURE(rc))
         return rc;
@@ -287,6 +337,9 @@ extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvNamedPipe);
     if (RT_FAILURE(rc))
         return rc;
+    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvTCP);
+    if (RT_FAILURE(rc))
+        return rc;
     rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvRawFile);
     if (RT_FAILURE(rc))
         return rc;
diff --git a/src/VBox/Devices/build/VBoxDD.h b/src/VBox/Devices/build/VBoxDD.h
index b14bc7e..2c2d72a 100644
--- a/src/VBox/Devices/build/VBoxDD.h
+++ b/src/VBox/Devices/build/VBoxDD.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -55,9 +55,12 @@ extern const PDMDEVREG g_DeviceINIP;
 extern const PDMDEVREG g_DeviceICHAC97;
 extern const PDMDEVREG g_DeviceSB16;
 extern const PDMDEVREG g_DeviceICH6_HDA;
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
 extern const PDMDEVREG g_DeviceAudioSniffer;
+#endif
 extern const PDMDEVREG g_DeviceOHCI;
 extern const PDMDEVREG g_DeviceEHCI;
+extern const PDMDEVREG g_DeviceXHCI;
 extern const PDMDEVREG g_DeviceACPI;
 extern const PDMDEVREG g_DeviceDMA;
 extern const PDMDEVREG g_DeviceFloppyController;
@@ -114,6 +117,27 @@ extern const PDMDRVREG g_DrvNetShaper;
 #endif /* VBOX_WITH_NETSHAPER */
 extern const PDMDRVREG g_DrvNetSniffer;
 extern const PDMDRVREG g_DrvAUDIO;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+extern const PDMDRVREG g_DrvHostNullAudio;
+# if defined(RT_OS_WINDOWS)
+extern const PDMDRVREG g_DrvHostDSound;
+# endif
+# if defined(RT_OS_LINUX)
+extern const PDMDRVREG g_DrvHostPulseAudio;
+extern const PDMDRVREG g_DrvHostALSAAudio;
+extern const PDMDRVREG g_DrvHostOSSAudio;
+# endif
+# if defined(RT_OS_DARWIN)
+extern const PDMDRVREG g_DrvHostCoreAudio;
+# endif
+# if defined(RT_OS_SOLARIS)
+extern const PDMDRVREG g_DrvHostOSSAudio;
+extern const PDMDRVREG g_DrvHostSolAudio;
+# endif
+# if defined(RT_OS_FREEBSD)
+extern const PDMDRVREG g_DrvHostOSSAudio;
+# endif
+#endif
 extern const PDMDRVREG g_DrvACPI;
 extern const PDMDRVREG g_DrvAcpiCpu;
 extern const PDMDRVREG g_DrvVUSBRootHub;
@@ -122,6 +146,7 @@ extern const PDMDRVREG g_DrvHostWebcam;
 #endif
 extern const PDMDRVREG g_DrvChar;
 extern const PDMDRVREG g_DrvNamedPipe;
+extern const PDMDRVREG g_DrvTCP;
 extern const PDMDRVREG g_DrvRawFile;
 extern const PDMDRVREG g_DrvHostParallel;
 extern const PDMDRVREG g_DrvHostSerial;
diff --git a/src/VBox/Devices/build/VBoxDD.rc b/src/VBox/Devices/build/VBoxDD.rc
deleted file mode 100644
index 71c6beb..0000000
--- a/src/VBox/Devices/build/VBoxDD.rc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id: VBoxDD.rc $ */
-/** @file
- * VBoxDD - Resource file containing version info.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      VFT2_UNKNOWN
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904b0" // Lang=US English, CharSet=Unicode
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox VMM Devices and Drivers\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     "VBoxDD\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", "VBoxDD.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1200
-  END
-END
diff --git a/src/VBox/Devices/build/VBoxDD2.rc b/src/VBox/Devices/build/VBoxDD2.rc
deleted file mode 100644
index 57e9f72..0000000
--- a/src/VBox/Devices/build/VBoxDD2.rc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id: VBoxDD2.rc $ */
-/** @file
- * VBoxDD2 - Resource file containing version info.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      VFT2_UNKNOWN
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904b0" // Lang=US English, CharSet=Unicode
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox VMM Devices and Drivers 2\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     "VBoxDD2\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", "VBoxDD2.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1200
-  END
-END
diff --git a/src/VBox/Devices/build/VBoxDDU.rc b/src/VBox/Devices/build/VBoxDDU.rc
deleted file mode 100644
index b8ae01a..0000000
--- a/src/VBox/Devices/build/VBoxDDU.rc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id: VBoxDDU.rc $ */
-/** @file
- * VBoxDDU - Resource file containing version info.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      VFT2_UNKNOWN
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904b0" // Lang=US English, CharSet=Unicode
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox VMM Devices and Drivers Utilities\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     "VBoxDDU\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", "VBoxDDU.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1200
-  END
-END
diff --git a/src/VBox/Devices/testcase/Makefile.kmk b/src/VBox/Devices/testcase/Makefile.kmk
index 606c233..40bb589 100644
--- a/src/VBox/Devices/testcase/Makefile.kmk
+++ b/src/VBox/Devices/testcase/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-2014 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -25,10 +25,12 @@ VBOX_PATH_DEVICES_SRC ?= $(PATH_ROOT)/src/VBox/Devices
 VBOX_DEVICES_TEST_OUT_DIR := $(PATH_TARGET)/Devices/testcase
 BLDDIRS += $(VBOX_DEVICES_TEST_OUT_DIR)
 
+## @todo Sort the features alphabetically!
 VBOX_DEVICES_TESTS_FEATURES = \
 	$(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
 	$(if $(VBOX_WITH_USB),VBOX_WITH_USB,) \
 	$(if $(VBOX_WITH_EHCI_IMPL),VBOX_WITH_EHCI_IMPL,) \
+	$(if $(VBOX_WITH_XHCI_IMPL),VBOX_WITH_XHCI_IMPL,) \
 	$(if $(VBOX_WITH_AHCI),VBOX_WITH_AHCI,) \
 	$(if $(VBOX_WITH_E1000),VBOX_WITH_E1000,) \
 	$(if $(VBOX_WITH_VIRTIO),VBOX_WITH_VIRTIO,) \
@@ -42,7 +44,8 @@ VBOX_DEVICES_TESTS_FEATURES = \
 	$(if $(VBOX_WITH_WDDM),VBOX_WITH_WDDM,) \
 	$(if $(VBOX_WITH_VIDEOHWACCEL),VBOX_WITH_VIDEOHWACCEL,) \
 	$(if $(VBOX_WITH_PCI_PASSTHROUGH_IMPL),VBOX_WITH_PCI_PASSTHROUGH_IMPL,) \
-	$(if $(VBOX_WITH_VMSVGA),VBOX_WITH_VMSVGA,)
+	$(if $(VBOX_WITH_VMSVGA),VBOX_WITH_VMSVGA,) \
+	$(if $(VBOX_WITH_PDM_AUDIO_DRIVER),VBOX_WITH_PDM_AUDIO_DRIVER,)
 
 
 #
diff --git a/src/VBox/Devices/testcase/tstDeviceStructSize.cpp b/src/VBox/Devices/testcase/tstDeviceStructSize.cpp
index 06bdfa4..c8dc312 100644
--- a/src/VBox/Devices/testcase/tstDeviceStructSize.cpp
+++ b/src/VBox/Devices/testcase/tstDeviceStructSize.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -75,6 +75,10 @@
 #  undef LOG_GROUP
 #  include "../USB/DevEHCI.cpp"
 # endif
+# ifdef VBOX_WITH_XHCI_IMPL
+#  undef LOG_GROUP
+#  include "../USB/DevXHCI.cpp"
+# endif
 #endif
 #undef LOG_GROUP
 #include "../VMMDev/VMMDev.cpp"
@@ -100,6 +104,11 @@
 # include "../Bus/DevPciRaw.cpp"
 #endif
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+# include <VBox/vmm/pdmaudioifs.h>
+#endif
+#undef LOG_GROUP
+#include "../Audio/DevIchAc97.cpp"
 #undef LOG_GROUP
 #include "../Audio/DevIchHda.cpp"
 
@@ -122,8 +131,8 @@
             printf("tstDeviceStructSize: error! %#010x %s  Off by %d!! (off=%#x)\n", RT_OFFSETOF(type, m), #type "." #m, off - RT_OFFSETOF(type, m), off); \
             rc++; \
         } \
-        /*else */ \
-            /*printf("%#08x %s\n", RT_OFFSETOF(type, m), #m);*/ \
+        else  \
+            printf("%#08x (%d) %s\n", RT_OFFSETOF(type, m), RT_OFFSETOF(type, m), #type "." #m); \
     } while (0)
 
 /**
@@ -295,6 +304,15 @@ int main()
     CHECK_MEMBER_ALIGNMENT(EHCI, StatCanceledIsocUrbs, 8);
 #  endif
 # endif
+# ifdef VBOX_WITH_XHCI_IMPL
+    CHECK_MEMBER_ALIGNMENT(XHCI, RootHub2, 8);
+    CHECK_MEMBER_ALIGNMENT(XHCI, RootHub3, 8);
+    CHECK_MEMBER_ALIGNMENT(XHCI, cmdr_dqp, 8);
+#  ifdef VBOX_WITH_STATISTICS
+    CHECK_MEMBER_ALIGNMENT(XHCI, StatCanceledIsocUrbs, 8);
+    CHECK_MEMBER_ALIGNMENT(XHCI, StatIntrsCleared, 8);
+#  endif
+# endif
 #endif
     CHECK_MEMBER_ALIGNMENT(E1KSTATE, StatReceiveBytes, 8);
 #ifdef VBOX_WITH_STATISTICS
diff --git a/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp b/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
index ca41360..e45cd22 100644
--- a/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
+++ b/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -72,6 +72,10 @@
 #  undef LOG_GROUP
 #  include "../USB/DevEHCI.cpp"
 # endif
+# ifdef VBOX_WITH_XHCI_IMPL
+#  undef LOG_GROUP
+#  include "../USB/DevXHCI.cpp"
+# endif
 #endif
 #undef LOG_GROUP
 #include "../VMMDev/VMMDev.cpp"
@@ -102,6 +106,8 @@
 #undef LOG_GROUP
 #include "../PC/DevHPET.cpp"
 #undef LOG_GROUP
+#include "../Audio/DevIchAc97.cpp"
+#undef LOG_GROUP
 #include "../Audio/DevIchHda.cpp"
 
 /* we don't use iprt here because we're pretending to be in GC! */
@@ -467,22 +473,26 @@ int main()
     GEN_CHECK_SIZE(PS2M);
     GEN_CHECK_OFF(PS2M, u8State);
     GEN_CHECK_OFF(PS2M, u8SampleRate);
+    GEN_CHECK_OFF(PS2M, u8Resolution);
     GEN_CHECK_OFF(PS2M, u8CurrCmd);
     GEN_CHECK_OFF(PS2M, fThrottleActive);
+    GEN_CHECK_OFF(PS2M, fDelayReset);
     GEN_CHECK_OFF(PS2M, enmMode);
+    GEN_CHECK_OFF(PS2M, enmProtocol);
     GEN_CHECK_OFF(PS2M, enmKnockState);
+    GEN_CHECK_OFF(PS2M, evtQ);
+    GEN_CHECK_OFF(PS2M, cmdQ);
     GEN_CHECK_OFF(PS2M, iAccumX);
     GEN_CHECK_OFF(PS2M, fAccumB);
+    GEN_CHECK_OFF(PS2M, fCurrB);
     GEN_CHECK_OFF(PS2M, uThrottleDelay);
-    GEN_CHECK_OFF(PS2M, evtQ);
-    GEN_CHECK_OFF(PS2M, cmdQ);
-    GEN_CHECK_OFF(PS2M, pDelayTimerRC);
+    GEN_CHECK_OFF(PS2M, pCritSectR3);
     GEN_CHECK_OFF(PS2M, pDelayTimerR3);
-    GEN_CHECK_OFF(PS2M, pDelayTimerR0);
-    GEN_CHECK_OFF(PS2M, pThrottleTimerRC);
     GEN_CHECK_OFF(PS2M, pThrottleTimerR3);
+    GEN_CHECK_OFF(PS2M, pDelayTimerRC);
+    GEN_CHECK_OFF(PS2M, pThrottleTimerRC);
+    GEN_CHECK_OFF(PS2M, pDelayTimerR0);
     GEN_CHECK_OFF(PS2M, pThrottleTimerR0);
-    GEN_CHECK_OFF(PS2M, pCritSectR3);
     GEN_CHECK_OFF(PS2M, Mouse.IBase);
     GEN_CHECK_OFF(PS2M, Mouse.IPort);
     GEN_CHECK_OFF(PS2M, Mouse.pDrvBase);
@@ -985,7 +995,7 @@ int main()
     GEN_CHECK_OFF(OHCIROOTHUB, desc_b);
     GEN_CHECK_OFF(OHCIROOTHUB, aPorts);
     GEN_CHECK_OFF(OHCIROOTHUB, aPorts[1]);
-    GEN_CHECK_OFF(OHCIROOTHUB, aPorts[OHCI_NDP - 1]);
+    GEN_CHECK_OFF(OHCIROOTHUB, aPorts[OHCI_NDP_MAX - 1]);
     GEN_CHECK_OFF(OHCIROOTHUB, pOhci);
 
     GEN_CHECK_SIZE(OHCI);
@@ -1059,12 +1069,9 @@ int main()
     GEN_CHECK_OFF(EHCIROOTHUB, Led);
     GEN_CHECK_OFF(EHCIROOTHUB, ILeds);
     GEN_CHECK_OFF(EHCIROOTHUB, pLedsConnector);
-    GEN_CHECK_OFF(EHCIROOTHUB, status);
-    GEN_CHECK_OFF(EHCIROOTHUB, desc_a);
-    GEN_CHECK_OFF(EHCIROOTHUB, desc_b);
     GEN_CHECK_OFF(EHCIROOTHUB, aPorts);
     GEN_CHECK_OFF(EHCIROOTHUB, aPorts[1]);
-    GEN_CHECK_OFF(EHCIROOTHUB, aPorts[EHCI_NDP - 1]);
+    GEN_CHECK_OFF(EHCIROOTHUB, aPorts[EHCI_NDP_MAX - 1]);
     GEN_CHECK_OFF(EHCIROOTHUB, pEhci);
 
     GEN_CHECK_SIZE(EHCI);
@@ -1117,9 +1124,9 @@ int main()
     GEN_CHECK_OFF(EHCI, pEOFTimerSyncR3);
     GEN_CHECK_OFF(EHCI, pEOFTimerSyncR0);
     GEN_CHECK_OFF(EHCI, pEOFTimerSyncRC);
-    GEN_CHECK_OFF(EHCI, pEOFTimerNoSyncRC);
     GEN_CHECK_OFF(EHCI, pEOFTimerNoSyncR3);
     GEN_CHECK_OFF(EHCI, pEOFTimerNoSyncR0);
+    GEN_CHECK_OFF(EHCI, pEOFTimerNoSyncRC);
     GEN_CHECK_OFF(EHCI, hThreadFrame);
     GEN_CHECK_OFF(EHCI, hSemEventFrame);
     GEN_CHECK_OFF(EHCI, fBusStarted);
@@ -1128,6 +1135,88 @@ int main()
     GEN_CHECK_OFF(EHCI, nsWait);
     GEN_CHECK_OFF(EHCI, CritSect);
 # endif /* VBOX_WITH_EHCI_IMPL */
+
+# ifdef VBOX_WITH_XHCI_IMPL
+    /* USB/DevXHCI.cpp */
+    GEN_CHECK_SIZE(XHCIHUBPORT);
+    GEN_CHECK_OFF(XHCIHUBPORT, portsc);
+    GEN_CHECK_OFF(XHCIHUBPORT, portpm);
+    GEN_CHECK_OFF(XHCIHUBPORT, portli);
+    GEN_CHECK_OFF(XHCIHUBPORT, pDev);
+
+    GEN_CHECK_SIZE(XHCIROOTHUB);
+    GEN_CHECK_OFF(XHCIROOTHUB, pIBase);
+    GEN_CHECK_OFF(XHCIROOTHUB, pIRhConn);
+    GEN_CHECK_OFF(XHCIROOTHUB, pIDev);
+    GEN_CHECK_OFF(XHCIROOTHUB, IBase);
+    GEN_CHECK_OFF(XHCIROOTHUB, IRhPort);
+    GEN_CHECK_OFF(XHCIROOTHUB, Led);
+    GEN_CHECK_OFF(XHCIROOTHUB, cPortsImpl);
+    GEN_CHECK_OFF(XHCIROOTHUB, pXhci);
+
+    GEN_CHECK_SIZE(XHCIINTRPTR);
+    GEN_CHECK_OFF(XHCIINTRPTR, iman);
+    GEN_CHECK_OFF(XHCIINTRPTR, imod);
+    GEN_CHECK_OFF(XHCIINTRPTR, erstba);
+    GEN_CHECK_OFF(XHCIINTRPTR, erdp);
+    GEN_CHECK_OFF(XHCIINTRPTR, erep);
+    GEN_CHECK_OFF(XHCIINTRPTR, erst_idx);
+    GEN_CHECK_OFF(XHCIINTRPTR, trb_count);
+    GEN_CHECK_OFF(XHCIINTRPTR, evtr_pcs);
+    GEN_CHECK_OFF(XHCIINTRPTR, ipe);
+
+    GEN_CHECK_SIZE(XHCI);
+    GEN_CHECK_OFF(XHCI, PciDev);
+    GEN_CHECK_OFF(XHCI, pDevInsR3);
+    GEN_CHECK_OFF(XHCI, pDevInsR0);
+    GEN_CHECK_OFF(XHCI, pDevInsRC);
+    GEN_CHECK_OFF(XHCI, pNotifierQueueR3);
+    GEN_CHECK_OFF(XHCI, pNotifierQueueR0);
+    GEN_CHECK_OFF(XHCI, pNotifierQueueRC);
+    GEN_CHECK_OFF(XHCI, pWorkerThread);
+    GEN_CHECK_OFF(XHCI, pSupDrvSession);
+    GEN_CHECK_OFF(XHCI, hEvtProcess);
+    GEN_CHECK_OFF(XHCI, fWrkThreadSleeping);
+    GEN_CHECK_OFF(XHCI, u32TasksNew);
+    GEN_CHECK_OFF(XHCI, ILeds);
+    GEN_CHECK_OFF(XHCI, pLedsConnector);
+    GEN_CHECK_OFF(XHCI, MMIOBase);
+    GEN_CHECK_OFF(XHCI, RootHub2);
+    GEN_CHECK_OFF(XHCI, RootHub3);
+    GEN_CHECK_OFF(XHCI, aPorts);
+    GEN_CHECK_OFF(XHCI, aPorts[1]);
+    GEN_CHECK_OFF(XHCI, aPorts[XHCI_NDP_MAX - 1]);
+    GEN_CHECK_OFF(XHCI, cap_length);
+    GEN_CHECK_OFF(XHCI, hci_version);
+    GEN_CHECK_OFF(XHCI, hcs_params3);
+    GEN_CHECK_OFF(XHCI, hcc_params);
+    GEN_CHECK_OFF(XHCI, dbell_off);
+    GEN_CHECK_OFF(XHCI, rts_off);
+    GEN_CHECK_OFF(XHCI, cmd);
+    GEN_CHECK_OFF(XHCI, status);
+    GEN_CHECK_OFF(XHCI, dnctrl);
+    GEN_CHECK_OFF(XHCI, config);
+    GEN_CHECK_OFF(XHCI, crcr);
+    GEN_CHECK_OFF(XHCI, dcbaap);
+    GEN_CHECK_OFF(XHCI, abExtCap);
+    GEN_CHECK_OFF(XHCI, cbExtCap);
+    GEN_CHECK_OFF(XHCI, cmdr_dqp);
+    GEN_CHECK_OFF(XHCI, cmdr_ccs);
+    GEN_CHECK_OFF(XHCI, aSlotState);
+    GEN_CHECK_OFF(XHCI, aBellsRung);
+    GEN_CHECK_OFF(XHCI, pLoad);
+#  ifdef VBOX_WITH_STATISTICS
+    GEN_CHECK_OFF(XHCI, StatCanceledIsocUrbs);
+    GEN_CHECK_OFF(XHCI, StatCanceledGenUrbs);
+    GEN_CHECK_OFF(XHCI, StatDroppedUrbs);
+    GEN_CHECK_OFF(XHCI, StatEventsWritten);
+    GEN_CHECK_OFF(XHCI, StatEventsDropped);
+    GEN_CHECK_OFF(XHCI, StatIntrsPending);
+    GEN_CHECK_OFF(XHCI, StatIntrsSet);
+    GEN_CHECK_OFF(XHCI, StatIntrsNotSet);
+    GEN_CHECK_OFF(XHCI, StatIntrsCleared);
+#  endif
+# endif /* VBOX_WITH_XHCI_IMPL */
 #endif /* VBOX_WITH_USB */
 
     /* VMMDev/VBoxDev.cpp */
@@ -1222,9 +1311,9 @@ int main()
     GEN_CHECK_OFF(AHCIPort, regSERR);
     GEN_CHECK_OFF(AHCIPort, regSACT);
     GEN_CHECK_OFF(AHCIPort, regCI);
+    GEN_CHECK_OFF(AHCIPort, cTasksActive);
     GEN_CHECK_OFF(AHCIPort, GCPhysAddrClb);
     GEN_CHECK_OFF(AHCIPort, GCPhysAddrFb);
-    GEN_CHECK_OFF(AHCIPort, cTasksActive);
     GEN_CHECK_OFF(AHCIPort, fPoweredOn);
     GEN_CHECK_OFF(AHCIPort, fSpunUp);
     GEN_CHECK_OFF(AHCIPort, fFirstD2HFisSend);
@@ -1233,6 +1322,7 @@ int main()
     GEN_CHECK_OFF(AHCIPort, fPortReset);
     GEN_CHECK_OFF(AHCIPort, fAsyncInterface);
     GEN_CHECK_OFF(AHCIPort, fResetDevice);
+    GEN_CHECK_OFF(AHCIPort, fHotpluggable);
     GEN_CHECK_OFF(AHCIPort, fRedo);
     GEN_CHECK_OFF(AHCIPort, fWrkThreadSleeping);
     GEN_CHECK_OFF(AHCIPort, cTotalSectors);
@@ -1263,7 +1353,7 @@ int main()
     GEN_CHECK_OFF(AHCIPort, Led);
     GEN_CHECK_OFF(AHCIPort, pAsyncIOThread);
 
-    GEN_CHECK_OFF(AHCIPort, aCachedTasks);
+    GEN_CHECK_OFF(AHCIPort, aActiveTasks);
     GEN_CHECK_OFF(AHCIPort, pTaskErr);
     GEN_CHECK_OFF(AHCIPort, pTrackList);
     GEN_CHECK_OFF(AHCIPort, hEvtProcess);
@@ -1288,6 +1378,8 @@ int main()
     GEN_CHECK_OFF(AHCIPort, szInquiryRevision[AHCI_ATAPI_INQUIRY_REVISION_LENGTH]);
     GEN_CHECK_OFF(AHCIPort, cErrors);
     GEN_CHECK_OFF(AHCIPort, fRedo);
+    GEN_CHECK_OFF(AHCIPort, CritSectReqsFree);
+    GEN_CHECK_OFF(AHCIPort, pListReqsFree);
 
     GEN_CHECK_SIZE(AHCI);
     GEN_CHECK_OFF(AHCI, dev);
@@ -1331,7 +1423,6 @@ int main()
     GEN_CHECK_OFF(AHCI, cPortsImpl);
     GEN_CHECK_OFF(AHCI, cCmdSlotsAvail);
     GEN_CHECK_OFF(AHCI, f8ByteMMIO4BytesWrittenSuccessfully);
-    GEN_CHECK_OFF(AHCI, fPortsHotpluggable);
     GEN_CHECK_OFF(AHCI, pSupDrvSession);
 #endif /* VBOX_WITH_AHCI */
 
@@ -1574,6 +1665,12 @@ int main()
     GEN_CHECK_OFF(VMMDEV, TestingData.Value.u64Value);
     GEN_CHECK_OFF(VMMDEV, TestingData.Value.u32Unit);
     GEN_CHECK_OFF(VMMDEV, TestingData.Value.szName);
+    GEN_CHECK_OFF(VMMDEV, uLastHBTime);
+    GEN_CHECK_OFF(VMMDEV, fHasMissedHB);
+    GEN_CHECK_OFF(VMMDEV, fHBCheckEnabled);
+    GEN_CHECK_OFF(VMMDEV, u64HeartbeatInterval);
+    GEN_CHECK_OFF(VMMDEV, u64HeartbeatTimeout);
+    GEN_CHECK_OFF(VMMDEV, pHBCheckTimer);
 
 #ifdef VBOX_WITH_BUSLOGIC
     GEN_CHECK_SIZE(BUSLOGICDEVICE);
@@ -1741,6 +1838,28 @@ int main()
     GEN_CHECK_OFF(HPETTIMER, u64Period);
     GEN_CHECK_OFF(HPETTIMER, u8Wrap);
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    GEN_CHECK_SIZE(AC97DRIVER);
+    GEN_CHECK_OFF(AC97DRIVER, Node);
+    GEN_CHECK_OFF(AC97DRIVER, pAC97State);
+    GEN_CHECK_OFF(AC97DRIVER, Flags);
+    GEN_CHECK_OFF(AC97DRIVER, uLUN);
+    GEN_CHECK_OFF(AC97DRIVER, pConnector);
+    GEN_CHECK_OFF(AC97DRIVER, LineIn);
+    GEN_CHECK_OFF(AC97DRIVER, MicIn);
+    GEN_CHECK_OFF(AC97DRIVER, Out);
+
+    GEN_CHECK_SIZE(HDADRIVER);
+    GEN_CHECK_OFF(HDADRIVER, Node);
+    GEN_CHECK_OFF(HDADRIVER, pHDAState);
+    GEN_CHECK_OFF(HDADRIVER, Flags);
+    GEN_CHECK_OFF(HDADRIVER, uLUN);
+    GEN_CHECK_OFF(HDADRIVER, pConnector);
+    GEN_CHECK_OFF(HDADRIVER, LineIn);
+    GEN_CHECK_OFF(HDADRIVER, MicIn);
+    GEN_CHECK_OFF(HDADRIVER, Out);
+#endif
+
     GEN_CHECK_SIZE(HDASTATE);
     GEN_CHECK_OFF(HDASTATE, PciDev);
     GEN_CHECK_OFF(HDASTATE, pDevInsR3);
@@ -1751,9 +1870,6 @@ int main()
     GEN_CHECK_OFF(HDASTATE, MMIOBaseAddr);
     GEN_CHECK_OFF(HDASTATE, au32Regs[0]);
     GEN_CHECK_OFF(HDASTATE, au32Regs[HDA_NREGS]);
-    GEN_CHECK_OFF(HDASTATE, StInBdle);
-    GEN_CHECK_OFF(HDASTATE, StOutBdle);
-    GEN_CHECK_OFF(HDASTATE, StMicBdle);
     GEN_CHECK_OFF(HDASTATE, u64CORBBase);
     GEN_CHECK_OFF(HDASTATE, u64RIRBBase);
     GEN_CHECK_OFF(HDASTATE, u64DPBase);
@@ -1765,9 +1881,22 @@ int main()
     GEN_CHECK_OFF(HDASTATE, fCviIoc);
     GEN_CHECK_OFF(HDASTATE, fR0Enabled);
     GEN_CHECK_OFF(HDASTATE, fRCEnabled);
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    GEN_CHECK_OFF(HDASTATE, pTimer);
+    GEN_CHECK_OFF(HDASTATE, uTicks);
+# ifdef VBOX_WITH_STATISTICS
+    GEN_CHECK_OFF(HDASTATE, StatTimer);
+# endif
     GEN_CHECK_OFF(HDASTATE, pCodec);
-    GEN_CHECK_OFF(HDASTATE, u8Counter);
+    GEN_CHECK_OFF(HDASTATE, lstDrv);
+    GEN_CHECK_OFF(HDASTATE, pMixer);
+    GEN_CHECK_OFF(HDASTATE, pSinkLineIn);
+    GEN_CHECK_OFF(HDASTATE, pSinkMicIn);
+#else
+    GEN_CHECK_OFF(HDASTATE, pCodec);
+#endif
     GEN_CHECK_OFF(HDASTATE, u64BaseTS);
+    GEN_CHECK_OFF(HDASTATE, u8Counter);
 
     return (0);
 }
diff --git a/src/VBox/Disassembler/DisasmCore.cpp b/src/VBox/Disassembler/DisasmCore.cpp
index 5d53f77..c329ba9 100644
--- a/src/VBox/Disassembler/DisasmCore.cpp
+++ b/src/VBox/Disassembler/DisasmCore.cpp
@@ -100,6 +100,9 @@ static FNDISPARSE ParseGrp15;
 static FNDISPARSE ParseGrp16;
 static FNDISPARSE ParseModFence;
 static FNDISPARSE ParseNopPause;
+static FNDISPARSE ParseVex2b;
+static FNDISPARSE ParseVex3b;
+static FNDISPARSE ParseVexDest;
 
 static FNDISPARSE ParseYv;
 static FNDISPARSE ParseYb;
@@ -158,7 +161,10 @@ static PFNDISPARSE const g_apfnFullDisasm[IDX_ParseMax] =
     ParseThreeByteEsc4,
     ParseThreeByteEsc5,
     ParseImmAddrF,
-    ParseInvOpModRm
+    ParseInvOpModRm,
+    ParseVex2b,
+    ParseVex3b,
+    ParseVexDest
 };
 
 /** Parser opcode table for only calculating instruction size. */
@@ -205,7 +211,10 @@ static PFNDISPARSE const g_apfnCalcSize[IDX_ParseMax] =
     ParseThreeByteEsc4,
     ParseThreeByteEsc5,
     ParseImmAddrF_SizeOnly,
-    ParseInvOpModRm
+    ParseInvOpModRm,
+    ParseVex2b,
+    ParseVex3b,
+    ParseVexDest
 };
 
 
@@ -226,6 +235,7 @@ static PFNDISPARSE const g_apfnCalcSize[IDX_ParseMax] =
 static DECLCALLBACK(int) disReadBytesDefault(PDISSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead)
 {
 #ifdef IN_RING0
+    NOREF(cbMinRead);
     AssertMsgFailed(("disReadWord with no read callback in ring 0!!\n"));
     RT_BZERO(&pDis->abInstr[offInstr], cbMaxRead);
     pDis->cbCachedInstr = offInstr + cbMaxRead;
@@ -575,6 +585,7 @@ static size_t disParseInstruction(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pD
     pDis->Param1.fParam = pOp->fParam1;
     pDis->Param2.fParam = pOp->fParam2;
     pDis->Param3.fParam = pOp->fParam3;
+    pDis->Param4.fParam = pOp->fParam4;
 
     /* Correct the operand size if the instruction is marked as forced or default 64 bits */
     if (pDis->uCpuMode == DISCPUMODE_64BIT)
@@ -611,6 +622,12 @@ static size_t disParseInstruction(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pD
         offInstr = pDis->pfnDisasmFnTable[pOp->idxParse3](offInstr, pOp, pDis, &pDis->Param3);
         if (fFiltered == false) pDis->Param3.cb = DISGetParamSize(pDis, &pDis->Param3);
     }
+
+    if (pOp->idxParse4 != IDX_ParseNop)
+    {
+        offInstr = pDis->pfnDisasmFnTable[pOp->idxParse4](offInstr, pOp, pDis, &pDis->Param4);
+        if (fFiltered == false) pDis->Param4.cb = DISGetParamSize(pDis, &pDis->Param4);
+    }
     // else simple one byte instruction
 
     return offInstr;
@@ -691,22 +708,30 @@ static void UseSIB(PDISSTATE pDis, PDISOPPARAM pParam)
     unsigned base  = pDis->SIB.Bits.Base;
     unsigned index = pDis->SIB.Bits.Index;
 
-    unsigned regtype;
-    if (pDis->uAddrMode == DISCPUMODE_32BIT)
-        regtype    = DISUSE_REG_GEN32;
+    unsigned regtype, vregtype;
+    /* There's no way to distinguish between SIB and VSIB
+     * and having special parameter to parse explicitly VSIB
+     * is not an options since only one instruction (gather)
+     * supports it currently. May be changed in the future. */
+        if (pDis->uAddrMode == DISCPUMODE_32BIT)
+            regtype    = DISUSE_REG_GEN32;
+        else
+            regtype    = DISUSE_REG_GEN64;
+    if (pDis->pCurInstr->uOpcode == OP_GATHER)
+        vregtype = (VEXREG_IS256B(pDis->bVexDestReg) ? DISUSE_REG_YMM : DISUSE_REG_XMM);
     else
-        regtype    = DISUSE_REG_GEN64;
+        vregtype = regtype;
 
     if (index != 4)
     {
-         pParam->fUse |= DISUSE_INDEX | regtype;
-         pParam->Index.idxGenReg = index;
+        pParam->fUse |= DISUSE_INDEX | vregtype;
+        pParam->Index.idxGenReg = index;
 
-         if (scale != 0)
-         {
-             pParam->fUse  |= DISUSE_SCALE;
-             pParam->uScale = (1<<scale);
-         }
+        if (scale != 0)
+        {
+            pParam->fUse  |= DISUSE_SCALE;
+            pParam->uScale = (1<<scale);
+        }
     }
 
     if (base == 5 && pDis->ModRM.Bits.Mod == 0)
@@ -806,14 +831,12 @@ static void disasmModRMReg(unsigned idx, PCDISOPCODE pOp, PDISSTATE pDis, PDISOP
 {
     NOREF(pOp); NOREF(pDis);
 
-    unsigned mod     = pDis->ModRM.Bits.Mod;
-
     unsigned type    = OP_PARM_VTYPE(pParam->fParam);
     unsigned subtype = OP_PARM_VSUBTYPE(pParam->fParam);
     if (fRegAddr)
         subtype = (pDis->uAddrMode == DISCPUMODE_64BIT) ? OP_PARM_q : OP_PARM_d;
     else
-    if (subtype == OP_PARM_v || subtype == OP_PARM_NONE)
+    if (subtype == OP_PARM_v || subtype == OP_PARM_NONE || subtype == OP_PARM_y)
     {
         switch (pDis->uOpMode)
         {
@@ -824,7 +847,8 @@ static void disasmModRMReg(unsigned idx, PCDISOPCODE pOp, PDISSTATE pDis, PDISOP
             subtype = OP_PARM_q;
             break;
         case DISCPUMODE_16BIT:
-            subtype = OP_PARM_w;
+            if (subtype != OP_PARM_y)
+                subtype = OP_PARM_w;
             break;
         default:
             /* make gcc happy */
@@ -973,12 +997,26 @@ static size_t UseModRM(size_t const offInstr, PCDISOPCODE pOp, PDISSTATE pDis, P
             case OP_PARM_W: //XMM register or memory operand
                 if (mod != 3)
                     break;  /* memory operand */
+            case OP_PARM_U: // XMM/YMM register
                 reg = rm; /* the RM field specifies the xmm register */
                 /* else no break */
 
             case OP_PARM_V: //XMM register
-                pParam->fUse |= DISUSE_REG_XMM;
-                pParam->Base.idxXmmReg = reg;
+                if (VEXREG_IS256B(pDis->bVexDestReg)
+                    && OP_PARM_VSUBTYPE(pParam->fParam) != OP_PARM_dq
+                    && OP_PARM_VSUBTYPE(pParam->fParam) != OP_PARM_q
+                    && OP_PARM_VSUBTYPE(pParam->fParam) != OP_PARM_d
+                    && OP_PARM_VSUBTYPE(pParam->fParam) != OP_PARM_w)
+                {
+                    // Use YMM register if VEX.L is set.
+                    pParam->fUse |= DISUSE_REG_YMM;
+                    pParam->Base.idxYmmReg = reg;
+                }
+                else
+                {
+                    pParam->fUse |= DISUSE_REG_XMM;
+                    pParam->Base.idxXmmReg = reg;
+                }
                 return offInstr;
             }
         }
@@ -1327,9 +1365,23 @@ static size_t ParseModFence(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PD
 static size_t ParseImmByte(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam)
 {
     NOREF(pOp);
-    pParam->uValue = disReadByte(pDis, offInstr);
-    pParam->fUse  |= DISUSE_IMMEDIATE8;
-    pParam->cb     = sizeof(uint8_t);
+    uint8_t byte = disReadByte(pDis, offInstr);
+    if (pParam->fParam == OP_PARM_Lx)
+    {
+        pParam->fUse  |= (VEXREG_IS256B(pDis->bVexDestReg) ? DISUSE_REG_YMM : DISUSE_REG_XMM);
+
+        // Ignore MSB in 32-bit mode.
+        if (pDis->uCpuMode == DISCPUMODE_32BIT)
+            byte &= 0x7f;
+
+        pParam->Base.idxXmmReg = byte >> 4;
+    }
+    else
+    {
+        pParam->uValue = byte;
+        pParam->fUse  |= DISUSE_IMMEDIATE8;
+        pParam->cb     = sizeof(uint8_t);
+    }
     return offInstr + 1;
 }
 //*****************************************************************************
@@ -1562,6 +1614,7 @@ static size_t ParseImmVRel_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE
 //*****************************************************************************
 static size_t ParseImmAddr(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam)
 {
+    NOREF(pOp);
     if (pDis->uAddrMode == DISCPUMODE_32BIT)
     {
         if (OP_PARM_VSUBTYPE(pParam->fParam) == OP_PARM_p)
@@ -1644,6 +1697,7 @@ static size_t ParseImmAddr_SizeOnly(size_t offInstr, PCDISOPCODE pOp, PDISSTATE
 //*****************************************************************************
 static size_t ParseImmAddrF(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam)
 {
+    NOREF(pOp);
     // immediate far pointers - only 16:16 or 16:32; determined by operand, *not* address size!
     Assert(pDis->uOpMode == DISCPUMODE_16BIT || pDis->uOpMode == DISCPUMODE_32BIT);
     Assert(OP_PARM_VSUBTYPE(pParam->fParam) == OP_PARM_p);
@@ -1881,12 +1935,47 @@ static size_t ParseYb(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPA
 //*****************************************************************************
 static size_t ParseInvOpModRm(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam)
 {
+    NOREF(pOp); NOREF(pDis); NOREF(pParam);
     /* This is used to avoid a bunch of special hacks to get the ModRM byte
        included when encountering invalid opcodes in groups. */
     return offInstr + 1;
 }
 //*****************************************************************************
 //*****************************************************************************
+static size_t ParseVexDest(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam)
+{
+    NOREF(pOp);
+
+    unsigned type = OP_PARM_VTYPE(pParam->fParam);
+
+    switch (type)
+    {
+        case OP_PARM_H: //XMM or YMM register
+        if (VEXREG_IS256B(pDis->bVexDestReg))
+        {
+            pParam->fUse |= DISUSE_REG_YMM;
+            pParam->Base.idxYmmReg = (pDis->bVexDestReg >> 1) ^ 0xf;
+        }
+        else
+        {
+            pParam->fUse |= DISUSE_REG_XMM;
+            pParam->Base.idxXmmReg = (pDis->bVexDestReg >> 1) ^ 0xf;
+        }
+        break;
+        case OP_PARM_B: // Always OP_PARM_By. Change if it is not so.
+            if ((pDis->fPrefix & DISPREFIX_REX) && (pDis->fRexPrefix & DISPREFIX_REX_FLAGS_W))
+                pParam->fUse |= DISUSE_REG_GEN64;
+            else
+                pParam->fUse |= DISUSE_REG_GEN32;
+            // TODO: Check if the register number is correct
+            pParam->Base.idxGenReg = (pDis->bVexDestReg >> 1) ^ 0xf;
+        break;
+    }
+
+    return offInstr;
+}
+//*****************************************************************************
+//*****************************************************************************
 static size_t ParseTwoByteEsc(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam)
 {
     NOREF(pOp); NOREF(pParam);
@@ -1912,7 +2001,13 @@ static size_t ParseTwoByteEsc(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis,
 
                 /* Cancel prefix changes. */
                 pDis->fPrefix &= ~DISPREFIX_OPSIZE;
-                pDis->uOpMode  = pDis->uCpuMode;
+
+                if (pDis->uCpuMode == DISCPUMODE_64BIT)
+                {
+                    pDis->uOpMode = (pDis->fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT);
+                }
+                else
+                    pDis->uOpMode  = pDis->uCpuMode;
             }
             break;
 
@@ -1978,13 +2073,40 @@ static size_t ParseThreeByteEsc4(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDi
 
                 /* Cancel prefix changes. */
                 pDis->fPrefix &= ~DISPREFIX_OPSIZE;
-                pDis->uOpMode  = pDis->uCpuMode;
+                if (pDis->uCpuMode == DISCPUMODE_64BIT)
+                {
+                    pDis->uOpMode = (pDis->fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT);
+                }
+                else
+                    pDis->uOpMode  = pDis->uCpuMode;
+
             }
         }
         break;
 
     case OP_REPNE:   /* 0xF2 */
-        if (g_apThreeByteMapX86_F20F38[pDis->bOpCode >> 4])
+        if ((pDis->fPrefix & DISPREFIX_OPSIZE) && g_apThreeByteMapX86_66F20F38[pDis->bOpCode >> 4])
+        {
+        /* 0x66F2 */
+            pOpcode = g_apThreeByteMapX86_66F20F38[pDis->bOpCode >> 4];
+            pOpcode = &pOpcode[pDis->bOpCode & 0xf];
+
+            if (pOpcode->uOpcode != OP_INVALID)
+            {
+                /* Table entry is valid, so use the extension table. */
+
+                /* Cancel prefix changes. */
+                pDis->fPrefix &= ~DISPREFIX_REPNE;
+                pDis->fPrefix &= ~DISPREFIX_OPSIZE;
+                if (pDis->uCpuMode == DISCPUMODE_64BIT)
+                {
+                    pDis->uOpMode = (pDis->fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT);
+                }
+                else
+                    pDis->uOpMode  = pDis->uCpuMode;
+            }
+        }
+        else if (g_apThreeByteMapX86_F20F38[pDis->bOpCode >> 4])
         {
             pOpcode = g_apThreeByteMapX86_F20F38[pDis->bOpCode >> 4];
             pOpcode = &pOpcode[pDis->bOpCode & 0xf];
@@ -1998,6 +2120,21 @@ static size_t ParseThreeByteEsc4(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDi
             }
         }
         break;
+
+    case OP_REPE:    /* 0xF3 */
+        if (g_apThreeByteMapX86_F30F38[pDis->bOpCode >> 4])
+        {
+            pOpcode = g_apThreeByteMapX86_F30F38[pDis->bOpCode >> 4];
+            pOpcode = &pOpcode[pDis->bOpCode & 0xf];
+
+            if (pOpcode->uOpcode != OP_INVALID)
+            {
+                /* Table entry is valid, so use the extension table. */
+
+                /* Cancel prefix changes. */
+                pDis->fPrefix &= ~DISPREFIX_REP;
+            }
+        }
     }
 
     return disParseInstruction(offInstr, pOpcode, pDis);
@@ -2012,12 +2149,18 @@ static size_t ParseThreeByteEsc5(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDi
     pDis->bOpCode = disReadByte(pDis, offInstr);
     offInstr++;
 
-    /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */
-    Assert(pDis->bLastPrefix == OP_OPSIZE);
-
     /* default to the non-prefixed table. */
     PCDISOPCODE pOpcode;
-    if (g_apThreeByteMapX86_660F3A[pDis->bOpCode >> 4])
+    if (g_apThreeByteMapX86_0F3A[pDis->bOpCode >> 4])
+    {
+        pOpcode = g_apThreeByteMapX86_0F3A[pDis->bOpCode >> 4];
+        pOpcode = &pOpcode[pDis->bOpCode & 0xf];
+    }
+    else
+        pOpcode = &g_InvalidOpcode[0];
+
+    /** @todo Should we take the first or last prefix byte in case of multiple prefix bytes??? */
+    if (pDis->bLastPrefix == OP_OPSIZE && g_apThreeByteMapX86_660F3A[pDis->bOpCode >> 4])
     {
         pOpcode = g_apThreeByteMapX86_660F3A[pDis->bOpCode >> 4];
         pOpcode = &pOpcode[pDis->bOpCode & 0xf];
@@ -2028,11 +2171,15 @@ static size_t ParseThreeByteEsc5(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDi
 
             /* Cancel prefix changes. */
             pDis->fPrefix &= ~DISPREFIX_OPSIZE;
-            pDis->uOpMode  = pDis->uCpuMode;
+            if (pDis->uCpuMode == DISCPUMODE_64BIT)
+            {
+                pDis->uOpMode = (pDis->fRexPrefix & DISPREFIX_REX_FLAGS_W ? DISCPUMODE_64BIT : DISCPUMODE_32BIT);
+            }
+            else
+                pDis->uOpMode  = pDis->uCpuMode;
+
         }
     }
-    else
-        pOpcode = &g_InvalidOpcode[0];
 
     return disParseInstruction(offInstr, pOpcode, pDis);
 }
@@ -2322,7 +2469,165 @@ static size_t ParseGrp16(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISO
 
     return disParseInstruction(offInstr, pOp, pDis);
 }
+//*****************************************************************************
+//*****************************************************************************
+static size_t ParseVex2b(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam)
+{
+    NOREF(pOp); NOREF(pParam);
+
+    PCDISOPCODE pOpCode = &g_InvalidOpcode[0];
+
+    uint8_t byte = disReadByte(pDis, offInstr++);
+    pDis->bOpCode = disReadByte(pDis, offInstr++);
+
+    pDis->bVexDestReg = VEX_2B2INT(byte);
+
+    // VEX.R (equivalent to REX.R)
+    if (pDis->uCpuMode == DISCPUMODE_64BIT && !(byte & 0x80))
+    {
+        /* REX prefix byte */
+        pDis->fPrefix   |= DISPREFIX_REX;
+        pDis->fRexPrefix = DISPREFIX_REX_FLAGS_R;
+    }
+
+    switch(byte & 3)
+    {
+        case 0:
+            pOpCode = g_aVexOpcodesMap[0] + pDis->bOpCode;
+        break;
+        // 0x66 prefix
+        case 1:
+            pOpCode = g_aVexOpcodesMap_66H[0] + pDis->bOpCode;
+
+        break;
+
+        // 0xF3 prefix
+        case 2:
+            pOpCode = g_aVexOpcodesMap_F3H[0] + pDis->bOpCode;
+        break;
+
+        // 0xF2 prefix
+        case 3:
+            pOpCode = g_aVexOpcodesMap_F2H[0] + pDis->bOpCode;
+        break;
+        default:
+        break;
+    }
+
+    return disParseInstruction(offInstr, pOpCode, pDis);
+}
+//*****************************************************************************
+//*****************************************************************************
+static size_t ParseVex3b(size_t offInstr, PCDISOPCODE pOp, PDISSTATE pDis, PDISOPPARAM pParam)
+{
+    NOREF(pOp); NOREF(pParam);
+
+    PCDISOPCODE pOpCode = NULL;
 
+    uint8_t byte1 = disReadByte(pDis, offInstr++);
+    uint8_t byte2 = disReadByte(pDis, offInstr++);
+    pDis->bOpCode = disReadByte(pDis, offInstr++);
+
+    pDis->bVexDestReg = VEX_2B2INT(byte2);
+    uint8_t implOpcode = (byte1 & 0x1f);
+
+    // REX.RXB
+    if (pDis->uCpuMode == DISCPUMODE_64BIT && ~(byte1 & 0xe0))
+        pDis->fRexPrefix |= (byte1 >> 5) ^ 7;
+
+    // VEX.W
+    pDis->bVexWFlag = !(byte2 & 0x80);
+
+    if (pDis->fRexPrefix)
+        pDis->fPrefix |= DISPREFIX_REX;
+
+    switch(byte2 & 3)
+    {
+        case 0:
+            if (implOpcode >= 1 && implOpcode <= 3) // Other values are #UD.
+            {
+                pOpCode = g_aVexOpcodesMap[implOpcode - 1];
+                if (pOpCode != NULL)
+                {
+                    switch (implOpcode)
+                    {
+                        case 2:
+                            if (pDis->bOpCode >= 0xf0)
+                                pOpCode = &pOpCode[pDis->bOpCode - 0xf0];
+                            else pOpCode = g_InvalidOpcode;
+                            break;
+                        default:
+                        pOpCode = &pOpCode[pDis->bOpCode];
+                    }
+                }
+            }
+        break;
+        // 0x66 prefix
+        case 1:
+            if (implOpcode >= 1 && implOpcode <= 3) // Other values are #UD.
+            {
+                pOpCode = g_aVexOpcodesMap_66H[implOpcode - 1];
+                if (pOpCode != NULL)
+                    pOpCode = &pOpCode[pDis->bOpCode];
+            }
+        break;
+
+        // 0xF3 prefix
+        case 2:
+            if (implOpcode >= 1 && implOpcode <= 3) // Other values are #UD.
+            {
+                pOpCode = g_aVexOpcodesMap_F3H[implOpcode - 1];
+                if (pOpCode != NULL)
+                {
+                    switch (implOpcode)
+                    {
+                        case 2:
+                            if (pDis->bOpCode >= 0xf0)
+                                pOpCode = &pOpCode[pDis->bOpCode - 0xf0];
+                            else pOpCode = g_InvalidOpcode;
+                            break;
+                        default:
+                        pOpCode = &pOpCode[pDis->bOpCode];
+                    }
+                }
+
+            }
+        break;
+
+        // 0xF2 prefix
+        case 3:
+            if (implOpcode >= 1 && implOpcode <= 3) // Other values are #UD.
+            {
+                pOpCode = g_aVexOpcodesMap_F2H[implOpcode - 1];
+                if (pOpCode != NULL)
+                {
+                    switch (implOpcode)
+                    {
+                        case 2:
+                            if (pDis->bOpCode >= 0xf0)
+                                pOpCode = &pOpCode[pDis->bOpCode - 0xf0];
+                            else pOpCode = g_InvalidOpcode;
+                            break;
+                        case 3:
+                            if (pDis->bOpCode != 0xf0)
+                                pOpCode = g_InvalidOpcode;
+                            break;
+                        default:
+                        pOpCode = &pOpCode[pDis->bOpCode];
+                    }
+                }
+            }
+        break;
+
+        default:
+        break;
+    }
+
+    if (pOpCode == NULL)
+        pOpCode = g_InvalidOpcode;
+
+    return disParseInstruction(offInstr, pOpCode, pDis);
+}
 
 
 /**
@@ -2406,7 +2711,6 @@ static void disValidateLockSequence(PDISSTATE pDis)
     Assert(pDis->pCurInstr->uOpcode == OP_ILLUD2);
 }
 
-
 /**
  * Internal worker for DISInstrEx and DISInstrWithPrefetchedBytes.
  *
@@ -2500,12 +2804,23 @@ static int disInstrWorker(PDISSTATE pDis, PCDISOPCODE paOneByteMap, uint32_t *pc
                 if (pDis->fRexPrefix & DISPREFIX_REX_FLAGS_W)
                     pDis->uOpMode = DISCPUMODE_64BIT;  /* overrides size prefix byte */
                 continue;   //fetch the next byte
+            default:
+                break;
             }
         }
 
+        /* Check if this is a VEX prefix. Not for 32-bit mode. */
+        if (pDis->uCpuMode != DISCPUMODE_64BIT
+            && (opcode == OP_LES || opcode == OP_LDS)
+            && (disReadByte(pDis, offInstr) & 0xc0) == 0xc0)
+        {
+            paOneByteMap = g_aOneByteMapX64;
+        }
+
         /* first opcode byte. */
         pDis->bOpCode  = codebyte;
         pDis->cbPrefix = (uint8_t)offInstr - 1;
+
         offInstr = disParseInstruction(offInstr, &paOneByteMap[pDis->bOpCode], pDis);
         break;
     }
diff --git a/src/VBox/Disassembler/DisasmFormatYasm.cpp b/src/VBox/Disassembler/DisasmFormatYasm.cpp
index 4453cbf..e0e9f38 100644
--- a/src/VBox/Disassembler/DisasmFormatYasm.cpp
+++ b/src/VBox/Disassembler/DisasmFormatYasm.cpp
@@ -67,6 +67,10 @@ static const char g_aszYasmRegXMM[16][6] =
 {
     "xmm0\0", "xmm1\0", "xmm2\0", "xmm3\0", "xmm4\0", "xmm5\0", "xmm6\0", "xmm7\0", "xmm8\0", "xmm9\0", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"
 };
+static const char g_aszYasmRegYMM[16][6] =
+{
+    "ymm0\0", "ymm1\0", "ymm2\0", "ymm3\0", "ymm4\0", "ymm5\0", "ymm6\0", "ymm7\0", "ymm8\0", "ymm9\0", "ymm10", "ymm11", "ymm12", "ymm13", "ymm14", "ymm15"
+};
 static const char g_aszYasmRegCRx[16][5] =
 {
     "cr0\0",  "cr1\0",  "cr2\0",  "cr3\0",  "cr4\0",  "cr5\0",  "cr6\0",  "cr7\0",  "cr8\0",  "cr9\0",  "cr10",  "cr11",  "cr12",  "cr13",  "cr14",  "cr15"
@@ -93,8 +97,8 @@ static const char g_aszYasmRegTRx[16][5] =
 static const char *disasmFormatYasmBaseReg(PCDISSTATE pDis, PCDISOPPARAM pParam, size_t *pcchReg)
 {
     switch (pParam->fUse & (  DISUSE_REG_GEN8 | DISUSE_REG_GEN16 | DISUSE_REG_GEN32 | DISUSE_REG_GEN64
-                            | DISUSE_REG_FP   | DISUSE_REG_MMX   | DISUSE_REG_XMM   | DISUSE_REG_CR
-                            | DISUSE_REG_DBG  | DISUSE_REG_SEG   | DISUSE_REG_TEST))
+                            | DISUSE_REG_FP   | DISUSE_REG_MMX   | DISUSE_REG_XMM   | DISUSE_REG_YMM
+                            | DISUSE_REG_CR   | DISUSE_REG_DBG   | DISUSE_REG_SEG   | DISUSE_REG_TEST))
 
     {
         case DISUSE_REG_GEN8:
@@ -113,6 +117,9 @@ static const char *disasmFormatYasmBaseReg(PCDISSTATE pDis, PCDISOPPARAM pParam,
             return psz;
         }
 
+        // VSIB
+        case DISUSE_REG_XMM | DISUSE_REG_GEN32:
+        case DISUSE_REG_YMM | DISUSE_REG_GEN32:
         case DISUSE_REG_GEN32:
         {
             Assert(pParam->Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen32));
@@ -121,6 +128,9 @@ static const char *disasmFormatYasmBaseReg(PCDISSTATE pDis, PCDISOPPARAM pParam,
             return psz;
         }
 
+        // VSIB
+        case DISUSE_REG_XMM | DISUSE_REG_GEN64:
+        case DISUSE_REG_YMM | DISUSE_REG_GEN64:
         case DISUSE_REG_GEN64:
         {
             Assert(pParam->Base.idxGenReg < RT_ELEMENTS(g_aszYasmRegGen64));
@@ -148,7 +158,15 @@ static const char *disasmFormatYasmBaseReg(PCDISSTATE pDis, PCDISOPPARAM pParam,
         case DISUSE_REG_XMM:
         {
             Assert(pParam->Base.idxXmmReg < RT_ELEMENTS(g_aszYasmRegXMM));
-            const char *psz = g_aszYasmRegXMM[pParam->Base.idxMmxReg];
+            const char *psz = g_aszYasmRegXMM[pParam->Base.idxXmmReg];
+            *pcchReg = 4 + !!psz[4];
+            return psz;
+        }
+
+        case DISUSE_REG_YMM:
+        {
+            Assert(pParam->Base.idxYmmReg < RT_ELEMENTS(g_aszYasmRegYMM));
+            const char *psz = g_aszYasmRegYMM[pParam->Base.idxYmmReg];
             *pcchReg = 4 + !!psz[4];
             return psz;
         }
@@ -203,6 +221,22 @@ static const char *disasmFormatYasmBaseReg(PCDISSTATE pDis, PCDISOPPARAM pParam,
  */
 static const char *disasmFormatYasmIndexReg(PCDISSTATE pDis, PCDISOPPARAM pParam, size_t *pcchReg)
 {
+    if (pParam->fUse & DISUSE_REG_XMM)
+    {
+        Assert(pParam->Index.idxXmmReg < RT_ELEMENTS(g_aszYasmRegXMM));
+        const char *psz = g_aszYasmRegXMM[pParam->Index.idxXmmReg];
+        *pcchReg = 4 + !!psz[4];
+        return psz;
+    }
+    else if (pParam->fUse & DISUSE_REG_YMM)
+    {
+        Assert(pParam->Index.idxYmmReg < RT_ELEMENTS(g_aszYasmRegYMM));
+        const char *psz = g_aszYasmRegYMM[pParam->Index.idxYmmReg];
+        *pcchReg = 4 + !!psz[4];
+        return psz;
+
+    }
+    else
     switch (pDis->uAddrMode)
     {
         case DISCPUMODE_16BIT:
@@ -564,6 +598,33 @@ DISDECL(size_t) DISFormatYasmEx(PCDISSTATE pDis, char *pszBuf, size_t cchBuf, ui
                     } while (ch != '\0');
                     pszFmt = szTmpFmt;
                 }
+                if (strchr ("#@&", *pszFmt))
+                {
+                    const char *pszDelim = strchr(pszFmt, '/');
+                    const char *pszSpace = (pszDelim ? strchr(pszDelim, ' ') : NULL);
+                    if (pszDelim != NULL)
+                    {
+                        char *pszFmtDst = szTmpFmt;
+                        if (pszSpace == NULL) pszSpace = strchr(pszDelim, 0);
+                        if (   (*pszFmt == '#' && pDis->bVexWFlag)
+                            || (*pszFmt == '@' && !VEXREG_IS256B(pDis->bVexDestReg))
+                            || (*pszFmt == '&' && (   DISUSE_IS_EFFECTIVE_ADDR(pDis->Param1.fUse)
+                                                   || DISUSE_IS_EFFECTIVE_ADDR(pDis->Param2.fUse)
+                                                   || DISUSE_IS_EFFECTIVE_ADDR(pDis->Param3.fUse)
+                                                   || DISUSE_IS_EFFECTIVE_ADDR(pDis->Param4.fUse))))
+                        {
+                            strncpy(pszFmtDst, pszFmt + 1, pszDelim - pszFmt - 1);
+                            pszFmtDst += pszDelim - pszFmt - 1;
+                        }
+                        else
+                        {
+                            strncpy(pszFmtDst, pszDelim + 1, pszSpace - pszDelim - 1);
+                            pszFmtDst += pszSpace - pszDelim - 1;
+                        }
+                        strcpy (pszFmtDst, pszSpace);
+                        pszFmt = szTmpFmt;
+                    }
+                }
                 break;
 
             /*
@@ -602,22 +663,48 @@ DISDECL(size_t) DISFormatYasmEx(PCDISSTATE pDis, char *pszBuf, size_t cchBuf, ui
                 switch (OP_PARM_VSUBTYPE(pParam->fParam)) \
                 { \
                     case OP_PARM_v: \
+                    case OP_PARM_y: \
                         switch (pDis->uOpMode) \
                         { \
-                            case DISCPUMODE_16BIT: PUT_SZ("word "); break; \
-                            case DISCPUMODE_32BIT: PUT_SZ("dword "); break; \
+                            case DISCPUMODE_16BIT: if (OP_PARM_VSUBTYPE(pParam->fParam) != OP_PARM_y) PUT_SZ("word "); break; \
+                            case DISCPUMODE_32BIT: \
+                                if (pDis->pCurInstr->uOpcode != OP_GATHER || pDis->bVexWFlag) { PUT_SZ("dword "); break; } \
                             case DISCPUMODE_64BIT: PUT_SZ("qword "); break; \
                             default: break; \
                         } \
                         break; \
                     case OP_PARM_b: PUT_SZ("byte "); break; \
-                    case OP_PARM_w: PUT_SZ("word "); break; \
-                    case OP_PARM_d: PUT_SZ("dword "); break; \
-                    case OP_PARM_q: PUT_SZ("qword "); break; \
-                    case OP_PARM_dq: \
-                        if (OP_PARM_VTYPE(pParam->fParam) != OP_PARM_W) /* these are 128 bit, pray they are all unambiguous.. */ \
-                            PUT_SZ("qword "); \
+                    case OP_PARM_w: \
+                        if (OP_PARM_VTYPE(pParam->fParam) == OP_PARM_W || \
+                            OP_PARM_VTYPE(pParam->fParam) == OP_PARM_M) \
+                        { \
+                            if (VEXREG_IS256B(pDis->bVexDestReg)) PUT_SZ("dword "); \
+                                else PUT_SZ("word "); \
+                        } \
+                        break; \
+                    case OP_PARM_d: \
+                        if (OP_PARM_VTYPE(pParam->fParam) == OP_PARM_W || \
+                            OP_PARM_VTYPE(pParam->fParam) == OP_PARM_M) \
+                        { \
+                            if (VEXREG_IS256B(pDis->bVexDestReg)) PUT_SZ("qword "); \
+                                else PUT_SZ("dword "); \
+                        } \
                         break; \
+                    case OP_PARM_q: \
+                        if (OP_PARM_VTYPE(pParam->fParam) == OP_PARM_W || \
+                            OP_PARM_VTYPE(pParam->fParam) == OP_PARM_M) \
+                        { \
+                            if (VEXREG_IS256B(pDis->bVexDestReg)) PUT_SZ("oword "); \
+                                else PUT_SZ("qword "); \
+                        } \
+                       break; \
+                    case OP_PARM_ps: \
+                    case OP_PARM_pd: \
+                    case OP_PARM_x: if (VEXREG_IS256B(pDis->bVexDestReg)) { PUT_SZ("yword "); break; } \
+                    case OP_PARM_ss: \
+                    case OP_PARM_sd: \
+                    case OP_PARM_dq: PUT_SZ("oword "); break; \
+                    case OP_PARM_qq: PUT_SZ("yword "); break; \
                     case OP_PARM_p: break; /* see PUT_FAR */ \
                     case OP_PARM_s: if (pParam->fUse & DISUSE_REG_FP) PUT_SZ("tword "); break; /* ?? */ \
                     case OP_PARM_z: break; \
@@ -673,6 +760,8 @@ DISDECL(size_t) DISFormatYasmEx(PCDISSTATE pDis, char *pszBuf, size_t cchBuf, ui
                     case 'T': /* ModRM byte selects a test register (ParseModRM / UseModRM). */
                     case 'V': /* ModRM byte selects an XMM/SSE register (ParseModRM / UseModRM). */
                     case 'P': /* ModRM byte selects MMX register (ParseModRM / UseModRM). */
+                    case 'H': /* The VEX.vvvv field of the VEX prefix selects a XMM/YMM register. */
+                    case 'L': /* The upper 4 bits of the 8-bit immediate selects a XMM/YMM register. */
                     {
                         pszFmt += RT_C_IS_ALPHA(pszFmt[0]) ? RT_C_IS_ALPHA(pszFmt[1]) ? 2 : 1 : 0;
                         Assert(!(pParam->fUse & (DISUSE_INDEX | DISUSE_SCALE) /* No SIB here... */));
@@ -736,6 +825,7 @@ DISDECL(size_t) DISFormatYasmEx(PCDISSTATE pDis, char *pszBuf, size_t cchBuf, ui
                                                    | DISUSE_REG_FP
                                                    | DISUSE_REG_MMX
                                                    | DISUSE_REG_XMM
+                                                   | DISUSE_REG_YMM
                                                    | DISUSE_REG_CR
                                                    | DISUSE_REG_DBG
                                                    | DISUSE_REG_SEG
@@ -783,30 +873,46 @@ DISDECL(size_t) DISFormatYasmEx(PCDISSTATE pDis, char *pszBuf, size_t cchBuf, ui
                                 off2 = 0;
                             }
 
-                            if (fBase || (fUse & DISUSE_INDEX))
+                            int64_t off3 = off2;
+                            if (fBase || (fUse & (DISUSE_INDEX | DISUSE_RIPDISPLACEMENT32)))
                             {
-                                PUT_C(off2 >= 0 ? '+' : '-');
-                                if (off2 < 0)
-                                    off2 = -off2;
+                                PUT_C(off3 >= 0 ? '+' : '-');
+                                if (off3 < 0)
+                                    off3 = -off3;
                             }
                             if (fUse & DISUSE_DISPLACEMENT8)
-                                PUT_NUM_8( off2);
+                                PUT_NUM_8( off3);
                             else if (fUse & DISUSE_DISPLACEMENT16)
-                                PUT_NUM_16(off2);
+                                PUT_NUM_16(off3);
                             else if (fUse & DISUSE_DISPLACEMENT32)
-                                PUT_NUM_32(off2);
+                                PUT_NUM_32(off3);
                             else if (fUse & DISUSE_DISPLACEMENT64)
-                                PUT_NUM_64(off2);
+                                PUT_NUM_64(off3);
                             else
                             {
-                                PUT_NUM_32(off2);
-                                PUT_SZ(" wrt rip"); //??
+                                PUT_NUM_32(off3);
+                                PUT_SZ(" wrt rip (");
+                                off2 += pDis->uInstrAddr + pDis->cbInstr;
+                                PUT_NUM_64(off2);
+                                if (pfnGetSymbol)
+                                    PUT_SYMBOL((pDis->fPrefix & DISPREFIX_SEG)
+                                               ? DIS_FMT_SEL_FROM_REG(pDis->idxSegPrefix)
+                                               : DIS_FMT_SEL_FROM_REG(DISSELREG_DS),
+                                               pDis->uAddrMode == DISCPUMODE_64BIT
+                                               ? (uint64_t)off2
+                                               : pDis->uAddrMode == DISCPUMODE_32BIT
+                                               ? (uint32_t)off2
+                                               : (uint16_t)off2,
+                                               " = ",
+                                               ')');
+                                else
+                                    PUT_C(')');
                             }
                         }
 
                         if (DISUSE_IS_EFFECTIVE_ADDR(fUse))
                         {
-                            if (pfnGetSymbol && !fBase && !(fUse & DISUSE_INDEX) && off2 != 0)
+                            if (pfnGetSymbol && !fBase && !(fUse & (DISUSE_INDEX | DISUSE_RIPDISPLACEMENT32)) && off2 != 0)
                                 PUT_SYMBOL((pDis->fPrefix & DISPREFIX_SEG)
                                            ? DIS_FMT_SEL_FROM_REG(pDis->idxSegPrefix)
                                            : DIS_FMT_SEL_FROM_REG(DISSELREG_DS),
@@ -815,7 +921,8 @@ DISDECL(size_t) DISFormatYasmEx(PCDISSTATE pDis, char *pszBuf, size_t cchBuf, ui
                                            : pDis->uAddrMode == DISCPUMODE_32BIT
                                            ? (uint32_t)off2
                                            : (uint16_t)off2,
-                                           " (=", ')');
+                                           " (=",
+                                           ')');
                             PUT_C(']');
                         }
                         break;
@@ -1121,6 +1228,7 @@ DISDECL(size_t) DISFormatYasmEx(PCDISSTATE pDis, char *pszBuf, size_t cchBuf, ui
                     {
                         case 2: pParam = &pDis->Param2; break;
                         case 3: pParam = &pDis->Param3; break;
+                        case 4: pParam = &pDis->Param4; break;
                         default: pParam = NULL; break;
                     }
                 }
diff --git a/src/VBox/Disassembler/DisasmInternal.h b/src/VBox/Disassembler/DisasmInternal.h
index 4a8c997..06e60c4 100644
--- a/src/VBox/Disassembler/DisasmInternal.h
+++ b/src/VBox/Disassembler/DisasmInternal.h
@@ -29,49 +29,55 @@
 
 /** @name Index into g_apfnCalcSize and g_apfnFullDisasm.
  * @{ */
-#define IDX_ParseNop                0
-#define IDX_ParseModRM              1
-#define IDX_UseModRM                2
-#define IDX_ParseImmByte            3
-#define IDX_ParseImmBRel            4
-#define IDX_ParseImmUshort          5
-#define IDX_ParseImmV               6
-#define IDX_ParseImmVRel            7
-#define IDX_ParseImmAddr            8
-#define IDX_ParseFixedReg           9
-#define IDX_ParseImmUlong           10
-#define IDX_ParseImmQword           11
-#define IDX_ParseTwoByteEsc         12
-#define IDX_ParseImmGrpl            13
-#define IDX_ParseShiftGrp2          14
-#define IDX_ParseGrp3               15
-#define IDX_ParseGrp4               16
-#define IDX_ParseGrp5               17
-#define IDX_Parse3DNow              18
-#define IDX_ParseGrp6               19
-#define IDX_ParseGrp7               20
-#define IDX_ParseGrp8               21
-#define IDX_ParseGrp9               22
-#define IDX_ParseGrp10              23
-#define IDX_ParseGrp12              24
-#define IDX_ParseGrp13              25
-#define IDX_ParseGrp14              26
-#define IDX_ParseGrp15              27
-#define IDX_ParseGrp16              28
-#define IDX_ParseModFence           29
-#define IDX_ParseYv                 30
-#define IDX_ParseYb                 31
-#define IDX_ParseXv                 32
-#define IDX_ParseXb                 33
-#define IDX_ParseEscFP              34
-#define IDX_ParseNopPause           35
-#define IDX_ParseImmByteSX          36
-#define IDX_ParseImmZ               37
-#define IDX_ParseThreeByteEsc4      38
-#define IDX_ParseThreeByteEsc5      39
-#define IDX_ParseImmAddrF           40
-#define IDX_ParseInvOpModRM         41
-#define IDX_ParseMax                (IDX_ParseInvOpModRM+1)
+enum IDX_Parse
+{
+  IDX_ParseNop = 0,
+  IDX_ParseModRM,
+  IDX_UseModRM,
+  IDX_ParseImmByte,
+  IDX_ParseImmBRel,
+  IDX_ParseImmUshort,
+  IDX_ParseImmV,
+  IDX_ParseImmVRel,
+  IDX_ParseImmAddr,
+  IDX_ParseFixedReg,
+  IDX_ParseImmUlong,
+  IDX_ParseImmQword,
+  IDX_ParseTwoByteEsc,
+  IDX_ParseImmGrpl,
+  IDX_ParseShiftGrp2,
+  IDX_ParseGrp3,
+  IDX_ParseGrp4,
+  IDX_ParseGrp5,
+  IDX_Parse3DNow,
+  IDX_ParseGrp6,
+  IDX_ParseGrp7,
+  IDX_ParseGrp8,
+  IDX_ParseGrp9,
+  IDX_ParseGrp10,
+  IDX_ParseGrp12,
+  IDX_ParseGrp13,
+  IDX_ParseGrp14,
+  IDX_ParseGrp15,
+  IDX_ParseGrp16,
+  IDX_ParseModFence,
+  IDX_ParseYv,
+  IDX_ParseYb,
+  IDX_ParseXv,
+  IDX_ParseXb,
+  IDX_ParseEscFP,
+  IDX_ParseNopPause,
+  IDX_ParseImmByteSX,
+  IDX_ParseImmZ,
+  IDX_ParseThreeByteEsc4,
+  IDX_ParseThreeByteEsc5,
+  IDX_ParseImmAddrF,
+  IDX_ParseInvOpModRM,
+  IDX_ParseVex2b,
+  IDX_ParseVex3b,
+  IDX_ParseVexDest,
+  IDX_ParseMax
+};
 /** @}  */
 
 
@@ -101,8 +107,30 @@ extern PCDISOPCODE const g_apThreeByteMapX86_660F38[16];
 /** Three byte opcode map with prefix 0xF2 (0xF 0x38) */
 extern PCDISOPCODE const g_apThreeByteMapX86_F20F38[16];
 
+/** Three byte opcode map with prefix 0xF3 (0xF 0x38) */
+extern PCDISOPCODE const g_apThreeByteMapX86_F30F38[16];
+
+extern PCDISOPCODE const g_apThreeByteMapX86_0F3A[16];
+
 /** Three byte opcode map with prefix 0x66 (0xF 0x3A) */
 extern PCDISOPCODE const g_apThreeByteMapX86_660F3A[16];
+
+/** Three byte opcode map with prefixes 0x66 0xF2 (0xF 0x38) */
+extern PCDISOPCODE const g_apThreeByteMapX86_66F20F38[16];
+
+/** VEX opcodes table defined by [VEX.m-mmmm - 1].
+  * 0Fh, 0F38h, 0F3Ah correspondingly, VEX.pp = 00b */
+extern PCDISOPCODE const g_aVexOpcodesMap[3];
+
+/** VEX opcodes table defined by [VEX.m-mmmm - 1].
+  * 0Fh, 0F38h, 0F3Ah correspondingly, VEX.pp = 01b (66h) */
+extern PCDISOPCODE const g_aVexOpcodesMap_66H[3];
+
+/** 0Fh, 0F38h, 0F3Ah correspondingly, VEX.pp = 10b (F3h) */
+extern PCDISOPCODE const g_aVexOpcodesMap_F3H[3];
+
+/** 0Fh, 0F38h, 0F3Ah correspondingly, VEX.pp = 11b (F2h) */
+extern PCDISOPCODE const g_aVexOpcodesMap_F2H[3];
 /** @} */
 
 /** @name Opcode extensions (Group tables)
@@ -156,7 +184,7 @@ extern const PCDISOPCODE g_apMapX86_FP_High[8];
 /** @} */
 
 /** @def OP
- * Wrapper which initializes an OPCODE.
+ * Wrapper which initializes an DISOPCODE.
  * We must use this so that we can exclude unused fields in order
  * to save precious bytes in the GC version.
  *
@@ -164,10 +192,14 @@ extern const PCDISOPCODE g_apMapX86_FP_High[8];
  */
 #ifndef DIS_CORE_ONLY
 # define OP(pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype) \
-    { pszOpcode, idxParse1, idxParse2, idxParse3, 0, opcode, param1, param2, param3, optype }
+    { pszOpcode, idxParse1, idxParse2, idxParse3, 0, opcode, param1, param2, param3, 0, 0, optype }
+# define OPVEX(pszOpcode, idxParse1, idxParse2, idxParse3, idxParse4, opcode, param1, param2, param3, param4, optype) \
+    { pszOpcode, idxParse1, idxParse2, idxParse3, idxParse4, opcode, param1, param2, param3, param4, 0, optype | DISOPTYPE_SSE }
 #else
 # define OP(pszOpcode, idxParse1, idxParse2, idxParse3, opcode, param1, param2, param3, optype) \
-    { idxParse1, idxParse2, idxParse3, 0, opcode, param1, param2, param3, optype }
+    { idxParse1, idxParse2, idxParse3, 0, opcode, param1, param2, param3, 0, 0, optype }
+# define OPVEX(pszOpcode, idxParse1, idxParse2, idxParse3, idxParse4, opcode, param1, param2, param3, param4, optype) \
+    { idxParse1, idxParse2, idxParse3, idxParse4, opcode, param1, param2, param3, param4, 0, optype | DISOPTYPE_SSE}
 #endif
 
 
diff --git a/src/VBox/Disassembler/DisasmTables.cpp b/src/VBox/Disassembler/DisasmTables.cpp
index d316343..a2f9127 100644
--- a/src/VBox/Disassembler/DisasmTables.cpp
+++ b/src/VBox/Disassembler/DisasmTables.cpp
@@ -408,14 +408,17 @@ const DISOPCODE g_aTwoByteMapX86[256] =
     /* 1 */
     OP("movups %Vps,%Wps",   IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVUPS,          OP_PARM_Vps,        OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("movups %Wps,%Vps",   IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVUPS,          OP_PARM_Wps,        OP_PARM_Vps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    /* can also be movhlps when reg->reg */
+    /* Next instruction has the following format:
+     * &name1/name2,
+     * where name1 is used when one of the operands
+     * is a location in memory, name2 otherwise. */
+    OP("&movlps/movhlps %Vq,%Wq",     IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVLPS,          OP_PARM_Vq,         OP_PARM_Wq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("movlps %Wq,%Vq",     IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVLPS,          OP_PARM_Wq,         OP_PARM_Vq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("movlps %Vq,%Wq",     IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVLPS,          OP_PARM_Vq,         OP_PARM_Wq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("unpcklps %Vps,%Wq",  IDX_ParseModRM,     IDX_UseModRM,  0,          OP_UNPCKLPS,        OP_PARM_Vps,        OP_PARM_Wq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("unpckhps %Vps,%Wq",  IDX_ParseModRM,     IDX_UseModRM,  0,          OP_UNPCKHPS,        OP_PARM_Vps,        OP_PARM_Wq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     /* can also be movlhps when reg->reg */
-    OP("movhps %Wq,%Vq",     IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVHPS,          OP_PARM_Wq,         OP_PARM_Vq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("movhps %Vq,%Wq",     IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVHPS,          OP_PARM_Vq,         OP_PARM_Wq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("&movhps/movlhps %Vq,%Wq",     IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVHPS,          OP_PARM_Wq,         OP_PARM_Vq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("movhps %Wq,%Vq",     IDX_ParseModRM,     IDX_UseModRM,  0,          OP_MOVHPS,          OP_PARM_Vq,         OP_PARM_Wq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("prefetch Grp16",     IDX_ParseGrp16,     0,             0,          OP_PREFETCH_GRP16,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -454,10 +457,10 @@ const DISOPCODE g_aTwoByteMapX86[256] =
     OP("sysenter",           0,              0,          0,          OP_SYSENTER,OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW),
     OP("sysexit",            0,              0,          0,          OP_SYSEXIT, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_UNCOND_CONTROLFLOW),
     INVALID_OPCODE,
-    INVALID_OPCODE, /** 0x37 - GETSEC */
+    OP("getsec",             0,              0,          0,          OP_GETSEC,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("3 byte escape A4",   IDX_ParseThreeByteEsc4,0,              0,        OP_3B_ESC4,  OP_PARM_NONE,      OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
-    INVALID_OPCODE, /** 0x3A - 3-byte escape table A-5 */
+    OP("3 byte escape A5",   IDX_ParseThreeByteEsc5,0,              0,        OP_3B_ESC5,  OP_PARM_NONE,      OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     /* SSE2 */
     OP("movnti %Gv,%Ev",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVNTI,  OP_PARM_Gv,         OP_PARM_Ev,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
@@ -528,8 +531,8 @@ const DISOPCODE g_aTwoByteMapX86[256] =
     OP("pcmpeqw %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,                 OP_PCMPEQW, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pcmpeqd %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,                 OP_PCMPEQD, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("emms",               0,                  0,              0,                 OP_EMMS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("MMX UD 0x78",        0,                  0,              0,                 OP_MMX_UD78,OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS), /** @todo 0x0f 0x78 VMREAD */
-    OP("MMX UD 0x79",        0,                  0,              0,                 OP_MMX_UD79,OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS), /** @todo 0x0f 0x79 VMWRITE */
+    OP("vmread %Ey,%Gy",     IDX_ParseModRM,     IDX_UseModRM,   0,                 OP_VMREAD,  OP_PARM_Ey,         OP_PARM_Gy,     OP_PARM_NONE,   DISOPTYPE_HARMLESS|DISOPTYPE_FORCED_64_OP_SIZE),
+    OP("vmwrite %Gy,%Ey",    IDX_ParseModRM,     IDX_UseModRM,   0,                 OP_VMWRITE, OP_PARM_Gy,         OP_PARM_Ey,     OP_PARM_NONE,   DISOPTYPE_HARMLESS|DISOPTYPE_FORCED_64_OP_SIZE),
     OP("MMX UD 0x7A",        0,                  0,              0,                 OP_MMX_UD7A,OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("MMX UD 0x7B",        0,                  0,              0,                 OP_MMX_UD7B,OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("MMX UD 0x7C",        0,                  0,              0,                 OP_MMX_UD7C,OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS), /** @todo 0x0f 0x7c haddpd/haddps */
@@ -647,13 +650,13 @@ const DISOPCODE g_aTwoByteMapX86[256] =
     OP("pandn %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PANDN,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
     /* e */
-    OP("pavgn %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PAVGN,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pavgb %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PAVGB,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psraw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSRAW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psrad %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSRAD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pavgw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PAVGW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pmulhuw %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PMULHUW, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pmulhw %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PMULHW,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE, /** @todo 0x0f 0xe6 cvtpd2dq// */
+    INVALID_OPCODE,
     OP("movntq %Wq,%Vq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVNTQ,  OP_PARM_Wq,         OP_PARM_Vq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psubsb %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBSB,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psubsw %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBSW,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
@@ -665,18 +668,18 @@ const DISOPCODE g_aTwoByteMapX86[256] =
     OP("pxor %Pq,%Qq",       IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PXOR,    OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
     /* f */
-    INVALID_OPCODE, /** @todo 0x0f 0xf0 lddqu */
+    INVALID_OPCODE,
     OP("psllw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSLLW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pslld %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSLLD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psllq %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSSQ,    OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pmuludq %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PMULUDQ, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("paddwd %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PADDWD,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("psadbw %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PADBW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("maskmovq %Ppi,%Qpi", IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PMASKMOVQ, OP_PARM_Ppi,      OP_PARM_Qpi,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmaddwd %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PMADDWD, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("psadbw %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSADBW,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("maskmovq %Ppi,%Qpi", IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MASKMOVQ,OP_PARM_Ppi,        OP_PARM_Qpi,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psubb %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBB,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psubw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psubd %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("psubq %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("psubq %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBQ,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("paddb %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PADDB,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("paddw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PADDW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("paddd %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PADDD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
@@ -778,7 +781,7 @@ const DISOPCODE g_aTwoByteMapX86_PF66[256] =
     OP("punpckhdq %Pdq,%Qdq",IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PUNPCKHDQ, OP_PARM_Pdq,      OP_PARM_Qdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("packssdw %Pdq,%Qdq", IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PACKSSDW,OP_PARM_Pdq,        OP_PARM_Qdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("punpcklqdq %Vdq,%Wdq",IDX_ParseModRM,    IDX_UseModRM,   0,          OP_PUNPCKLQDQ,OP_PARM_Vdq,      OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("punpckhqd %Vdq,%Wdq",IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PUNPCKHQD, OP_PARM_Vdq,      OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("punpckhqdq %Vdq,%Wdq",IDX_ParseModRM,    IDX_UseModRM,   0,          OP_PUNPCKHQDQ,OP_PARM_Vdq,      OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("movd %Vdq,%Ed",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVD,    OP_PARM_Vdq,        OP_PARM_Ed,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("movdqa %Vdq,%Wdq",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVDQA,  OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
@@ -791,8 +794,8 @@ const DISOPCODE g_aTwoByteMapX86_PF66[256] =
     OP("pcmpeqw %Vdq,%Wdq",  IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PCMPEQW, OP_PARM_Vdq,        OP_PARM_Vdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pcmpeqd %Vdq,%Wdq",  IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PCMPEQD, OP_PARM_Vdq,        OP_PARM_Vdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
-    OP("vmread %Ed,%Gd",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_VMREAD,  OP_PARM_Ed,         OP_PARM_Gd,     OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
-    OP("vmwrite %Gd,%Ed",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_VMWRITE, OP_PARM_Gd,         OP_PARM_Ed,     OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -849,7 +852,7 @@ const DISOPCODE g_aTwoByteMapX86_PF66[256] =
     OP("pandn %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PANDN,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
     /* e */
-    OP("pavgn %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PAVGN,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pavgb %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PAVGB,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psraw %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSRAW,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psrad %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSRAD,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pavgw %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PAVGW,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
@@ -872,9 +875,9 @@ const DISOPCODE g_aTwoByteMapX86_PF66[256] =
     OP("pslld %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSLLD,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psllq %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSSQ,    OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("pmuludq %Vdq,%Wdq",  IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PMULUDQ, OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("paddwd %Vdq,%Wdq",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PADDWD,  OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("psadbw %Vdq,%Wdq",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PADBW,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("maskmovdqu %Vdq,%Wdq",IDX_ParseModRM,    IDX_UseModRM,   0,          OP_PMASKMOVDQU, OP_PARM_Vdq,    OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmaddwd %Vdq,%Wdq",  IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PMADDWD, OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("psadbw %Vdq,%Wdq",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSADBW,  OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("maskmovdqu %Vdq,%Wdq",IDX_ParseModRM,    IDX_UseModRM,   0,          OP_MASKMOVDQU, OP_PARM_Vdq,    OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psubb %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBB,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psubw %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBW,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("psubd %Vdq,%Wdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PSUBD,   OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
@@ -894,7 +897,7 @@ const DISOPCODE g_aTwoByteMapX86_PFF2[256] =
     /* 1 */
     OP("movsd %Vsd,%Wsd",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVSD,   OP_PARM_Vpd,        OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("movsd %Wsd,%Vsd",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVSD,   OP_PARM_Wpd,        OP_PARM_Vpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE,
+    OP("movddup %Vdq,%Wdq",  IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVDDUP, OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -1054,7 +1057,22 @@ const DISOPCODE g_aTwoByteMapX86_PFF2[256] =
     INVALID_OPCODE,
 
     /* f */
-    INVALID_OPCODE_BLOCK
+    OP("lddqu %Vdq,%Mdq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_LDDQU,   OP_PARM_Vdq,         OP_PARM_Mdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE
 };
 
 
@@ -1067,11 +1085,11 @@ const DISOPCODE g_aTwoByteMapX86_PFF3[256] =
     /* 1 */
     OP("movss %Vss,%Wss",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVSS,   OP_PARM_Vss,        OP_PARM_Wss,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("movss %Wss,%Vss",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVSS,   OP_PARM_Wss,        OP_PARM_Vss,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("movsldup %Vdq,%Wdq", IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVSLDUP,OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
+    OP("movshdup %Vdq,%Wdq", IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVSHDUP,OP_PARM_Vdq,        OP_PARM_Wdq,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -1110,7 +1128,7 @@ const DISOPCODE g_aTwoByteMapX86_PFF3[256] =
     INVALID_OPCODE,
     OP("sqrtss %Vss,%Wss",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_SQRTSS,  OP_PARM_Vss,        OP_PARM_Wss,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("rsqrtss %Vss,%Wss",  IDX_ParseModRM,     IDX_UseModRM,   0,          OP_RSQRTSS, OP_PARM_Vss,        OP_PARM_Wss,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE,
+    OP("rcpss %Vss,%Wss",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_RCPSS,   OP_PARM_Vss,        OP_PARM_Wss,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -1171,7 +1189,22 @@ const DISOPCODE g_aTwoByteMapX86_PFF3[256] =
     INVALID_OPCODE_BLOCK
 
     /* b */
-    INVALID_OPCODE_BLOCK
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("popcnt %Gv,%Ev",   IDX_ParseModRM,      IDX_UseModRM,   0, OP_POPCNT, OP_PARM_Gv, OP_PARM_Ev, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("tzcnt %Gv,%Ev",    IDX_ParseModRM,      IDX_UseModRM,   0, OP_TZCNT, OP_PARM_Gv, OP_PARM_Ev, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OP("lzcnt %Gv,%Ev",    IDX_ParseModRM,      IDX_UseModRM,   0, OP_LZCNT, OP_PARM_Gv, OP_PARM_Ev, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 
     /* c */
     INVALID_OPCODE,
@@ -1275,6 +1308,28 @@ const DISOPCODE g_aThreeByteMapX86_0F38_1[16] =
     INVALID_OPCODE,
 };
 
+/** Three byte opcode map (0x0F 0x38 0xFx) */
+const DISOPCODE g_aThreeByteMapX86_0F38_F[16] =
+{
+    /* F */
+    OP("movbe %Gy,%My",          IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVBEGM,     OP_PARM_Gy,          OP_PARM_My,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("movbe %My,%Gy",          IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVBEMG,     OP_PARM_My,          OP_PARM_Gy,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
+
 /** These tables are mostly sparse, so use another level of indirection to save space. */
 PCDISOPCODE const g_apThreeByteMapX86_0F38[16] =
 {
@@ -1309,7 +1364,7 @@ PCDISOPCODE const g_apThreeByteMapX86_0F38[16] =
     /* e */
     NULL,
     /* f */
-    NULL,
+    &g_aThreeByteMapX86_0F38_F[0],
 };
 
 /** Three byte opcode map (0x66 0x0F 0x38 0x0x) */
@@ -1356,14 +1411,85 @@ const DISOPCODE g_aThreeByteMapX86_660F38_1[16] =
     INVALID_OPCODE,
 };
 
-/** @todo remainder missing (too lazy now) */
+/** Three byte opcode map (0x66 0x0F 0x38 0x2x) */
+const DISOPCODE g_aThreeByteMapX86_660F38_2[16] =
+{
+    /* 2 */
+    OP("pmovsxbw %Vdq,%Wq",         IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PMOVSX,      OP_PARM_Vdq,          OP_PARM_Wq,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovsxbd %Vdq,%Wd",         IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PMOVSX,      OP_PARM_Vdq,          OP_PARM_Wd,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovsxbq %Vdq,%Ww",         IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PMOVSX,      OP_PARM_Vdq,          OP_PARM_Ww,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovsxwd %Vdq,%Wq",         IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PMOVSX,      OP_PARM_Vdq,          OP_PARM_Wq,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovsxwq %Vdq,%Wd",         IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PMOVSX,      OP_PARM_Vdq,          OP_PARM_Wd,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovsxdq %Vdq,%Wq",         IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PMOVSX,      OP_PARM_Vdq,          OP_PARM_Wq,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("pmuldq %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PMULDQ,      OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pcmpeqq %Vdq,%Wdq",         IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PCMPEQQ,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("movntdqa %Vdq,%Wdq",        IDX_ParseModRM,    IDX_UseModRM,    0,          OP_MOVNTDQA,    OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("packusdw %Vdq,%Wdq",        IDX_ParseModRM,    IDX_UseModRM,    0,          OP_PACKUSDW,    OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
+
+/** Three byte opcode map (0x66 0x0F 0x38 0x3x) */
+const DISOPCODE g_aThreeByteMapX86_660F38_3[16] =
+{
+    /* 3 */
+    OP("pmovzxbw %Vdq,%Wq",         IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMOVZX,     OP_PARM_Vdq,          OP_PARM_Wq,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovzxbd %Vdq,%Wd",         IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMOVZX,     OP_PARM_Vdq,          OP_PARM_Wd,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovzxbq %Vdq,%Ww",         IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMOVZX,     OP_PARM_Vdq,          OP_PARM_Ww,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovzxwd %Vdq,%Wq",         IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMOVZX,     OP_PARM_Vdq,          OP_PARM_Wq,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovzxwq %Vdq,%Wd",         IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMOVZX,     OP_PARM_Vdq,          OP_PARM_Wd,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmovzxdq %Vdq,%Wq",         IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMOVZX,     OP_PARM_Vdq,          OP_PARM_Wq,      OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OP("pcmpgtq %Vdq,%Wdq",         IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PCMPGTQ,    OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pminsb %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMINSB,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pminsd %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMINSB,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pminuw %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMINUW,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pminud %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMINUD,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmaxsb %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMAXSB,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmaxsd %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMAXSD,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmaxuw %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMAXUW,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmaxud %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMAXUD,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+/** Three byte opcode map (0x66 0x0F 0x38 0x4x) */
+const DISOPCODE g_aThreeByteMapX86_660F38_4[16] =
+{
+    /* 4 */
+    OP("pmulld %Vdq,%Wdq",          IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PMULLD,     OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("phminposuw %Vdq,%Wdq",      IDX_ParseModRM,    IDX_UseModRM,     0,          OP_PHMINPOSUW, OP_PARM_Vdq,          OP_PARM_Wdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
 
 /** Three byte opcode map (0x66 0x0F 0x38 0x8x) */
 const DISOPCODE g_aThreeByteMapX86_660F38_8[16] =
 {
     /* 8 */
-    OP("invept %Gd,%Mdq",       IDX_ParseModRM,     IDX_UseModRM,   0,          OP_INVEPT,      OP_PARM_Gd,          OP_PARM_Mdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("invvpid %Gd,%Mdq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_INVEPT,      OP_PARM_Gd,          OP_PARM_Mdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("invept %Gy,%Mdq",       IDX_ParseModRM,     IDX_UseModRM,   0,          OP_INVEPT,      OP_PARM_Gy,          OP_PARM_Mdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS | DISOPTYPE_FORCED_64_OP_SIZE),
+    OP("invvpid %Gy,%Mdq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_INVVPID,     OP_PARM_Gy,          OP_PARM_Mdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS | DISOPTYPE_FORCED_64_OP_SIZE),
+    OP("invpcid %Gy,%Mdq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_INVPCID,     OP_PARM_Gy,          OP_PARM_Mdq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS | DISOPTYPE_FORCED_64_OP_SIZE),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -1371,6 +1497,42 @@ const DISOPCODE g_aThreeByteMapX86_660F38_8[16] =
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
+};
+
+/** Three byte opcode map (0x66 0x0F 0x38 0xDx) */
+const DISOPCODE g_aThreeByteMapX86_660F38_D[16] =
+{
+    /* D */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("aesimc %Vdq,%Wdq",         IDX_ParseModRM,    IDX_UseModRM,       0,      OP_AESIMC,     OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OP("aesenc %Vdq,%Hdq,%Wdq",    IDX_ParseModRM,    IDX_UseModRM,       0,      OP_AESENC,     OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OP("aesenclast %Vdq,%Wdq",     IDX_ParseModRM,    IDX_UseModRM,       0,      OP_AESENCLAST, OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OP("aesdec %Vdq,%Wdq",         IDX_ParseModRM,    IDX_UseModRM,       0,      OP_AESDEC,     OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OP("aesdeclast %Vdq,%Wdq",     IDX_ParseModRM,    IDX_UseModRM,       0,      OP_AESDECLAST, OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+};
+
+const DISOPCODE g_aThreeByteMapX86_660F38_F[16] =
+{
+    /* F */
+    OP("movbe %Gw,%Mw",       IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVBEGM,      OP_PARM_Gw,          OP_PARM_Mw,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("movbe %Mw,%Gw",       IDX_ParseModRM,     IDX_UseModRM,   0,          OP_MOVBEMG,      OP_PARM_Mw,          OP_PARM_Gw,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("adcx %Gy,%Ey",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_ADCX,         OP_PARM_Gy,          OP_PARM_Ey,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -1388,11 +1550,11 @@ PCDISOPCODE const g_apThreeByteMapX86_660F38[16] =
     /* 1 */
     &g_aThreeByteMapX86_660F38_1[0],
     /* 2 */
-    NULL,
+    &g_aThreeByteMapX86_660F38_2[0],
     /* 3 */
-    NULL,
+    &g_aThreeByteMapX86_660F38_3[0],
     /* 4 */
-    NULL,
+    &g_aThreeByteMapX86_660F38_4[0],
     /* 5 */
     NULL,
     /* 6 */
@@ -1410,11 +1572,57 @@ PCDISOPCODE const g_apThreeByteMapX86_660F38[16] =
     /* c */
     NULL,
     /* d */
-    NULL,
+    &g_aThreeByteMapX86_660F38_D[0],
     /* e */
     NULL,
     /* f */
-    NULL,
+    &g_aThreeByteMapX86_660F38_F[0],
+};
+
+const DISOPCODE g_aThreeByteMapX86_F20F38_F[16] =
+{
+    /* According to Intel opcodes map in Intel® 64 and IA-32 Architectures Software Developer’s Manual dated September 2014
+       it should be %Gd (always dword regardless of operand-size attribute), but from the description of the command
+       it is clear that REX.W prefix can change this size to 64 bit, therefore it is set to %Gy. Seems to be a mistake. */
+    OP("crc32 %Gy,%Eb",   IDX_ParseModRM,   IDX_UseModRM,   0,   OP_CRC32GDEB,    OP_PARM_Gy,   OP_PARM_Eb,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("crc32 %Gy,%Ey",   IDX_ParseModRM,   IDX_UseModRM,   0,   OP_CRC32GDEY,    OP_PARM_Gy,   OP_PARM_Ey,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
+
+const DISOPCODE g_aThreeByteMapX86_66F20F38_F[16] =
+{
+    /* According to Intel opcodes map in Intel® 64 and IA-32 Architectures Software Developer’s Manual dated September 2014
+       it should be %Gd (always dword regardless of operand-size attribute), but from the description of the command
+       it is clear that REX.W prefix can change this size to 64 bit, therefore it is set to %Gy. Seems to be a mistake. */
+    OP("crc32 %Gy,%Eb",   IDX_ParseModRM,   IDX_UseModRM,   0,   OP_CRC32GDEB,    OP_PARM_Gy,   OP_PARM_Eb,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("crc32 %Gy,%Ew",   IDX_ParseModRM,   IDX_UseModRM,   0,   OP_CRC32GDEY,    OP_PARM_Gy,   OP_PARM_Ew,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 };
 
 /** Three byte opcode map with prefix 0xF2 (0xF 0x38) */
@@ -1452,12 +1660,11 @@ PCDISOPCODE const g_apThreeByteMapX86_F20F38[16] =
     /* e */
     NULL,
     /* f */
-    NULL,
+    &g_aThreeByteMapX86_F20F38_F[0],
 };
 
-/** Three byte opcode map with prefix 0x66 (0xF 0x3A) */
-/** @todo remainder missing (too lazy now) */
-PCDISOPCODE const g_apThreeByteMapX86_660F3A[16] =
+/** Three byte opcode map with prefixes 0x66 0xF2 (0xF 0x38) */
+PCDISOPCODE const g_apThreeByteMapX86_66F20F38[16] =
 {
     /* 0 */
     NULL,
@@ -1490,288 +1697,152 @@ PCDISOPCODE const g_apThreeByteMapX86_660F3A[16] =
     /* e */
     NULL,
     /* f */
-    NULL,
+    &g_aThreeByteMapX86_66F20F38_F[0],
 };
 
-/* 3DNow! map (0x0F 0x0F prefix) */
-const DISOPCODE g_aTwoByteMapX86_3DNow[256] =
+const DISOPCODE g_aThreeByteMapX86_F30F38_F[16] =
 {
-    /* 0 */
-    INVALID_OPCODE_MOD_RM(0x00),
-    INVALID_OPCODE_MOD_RM(0x01),
-    INVALID_OPCODE_MOD_RM(0x02),
-    INVALID_OPCODE_MOD_RM(0x03),
-    INVALID_OPCODE_MOD_RM(0x04),
-    INVALID_OPCODE_MOD_RM(0x05),
-    INVALID_OPCODE_MOD_RM(0x06),
-    INVALID_OPCODE_MOD_RM(0x07),
-    INVALID_OPCODE_MOD_RM(0x08),
-    INVALID_OPCODE_MOD_RM(0x09),
-    INVALID_OPCODE_MOD_RM(0x0a),
-    INVALID_OPCODE_MOD_RM(0x0c),
-    OP("pi2fw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PI2FW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("pi2fd %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PI2FD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x0e),
-    INVALID_OPCODE_MOD_RM(0x0f),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("adox %Gy,%Ey",        IDX_ParseModRM,     IDX_UseModRM,   0,          OP_ADOX,         OP_PARM_Gy,          OP_PARM_Ey,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
 
+/** Three byte opcode map with prefix 0xF3 (0xF 0x38) */
+PCDISOPCODE const g_apThreeByteMapX86_F30F38[16] =
+{
+    /* 0 */
+    NULL,
     /* 1 */
-    INVALID_OPCODE_MOD_RM(0x10),
-    INVALID_OPCODE_MOD_RM(0x11),
-    INVALID_OPCODE_MOD_RM(0x12),
-    INVALID_OPCODE_MOD_RM(0x13),
-    INVALID_OPCODE_MOD_RM(0x14),
-    INVALID_OPCODE_MOD_RM(0x15),
-    INVALID_OPCODE_MOD_RM(0x16),
-    INVALID_OPCODE_MOD_RM(0x17),
-    INVALID_OPCODE_MOD_RM(0x18),
-    INVALID_OPCODE_MOD_RM(0x19),
-    INVALID_OPCODE_MOD_RM(0x1a),
-    INVALID_OPCODE_MOD_RM(0x1b),
-    OP("pf2iw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PF2IW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("pf2id %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PF2ID,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x1e),
-    INVALID_OPCODE_MOD_RM(0x1f),
-
+    NULL,
     /* 2 */
-    INVALID_OPCODE_BLOCK_MOD_RM(0x2)
-
+    NULL,
     /* 3 */
-    INVALID_OPCODE_BLOCK_MOD_RM(0x3)
-
+    NULL,
     /* 4 */
-    INVALID_OPCODE_BLOCK_MOD_RM(0x4)
-
+    NULL,
     /* 5 */
-    INVALID_OPCODE_BLOCK_MOD_RM(0x5)
-
+    NULL,
     /* 6 */
-    INVALID_OPCODE_BLOCK_MOD_RM(0x6)
-
+    NULL,
     /* 7 */
-    INVALID_OPCODE_BLOCK_MOD_RM(0x7)
-
+    NULL,
     /* 8 */
-    INVALID_OPCODE_MOD_RM(0x80),
-    INVALID_OPCODE_MOD_RM(0x81),
-    INVALID_OPCODE_MOD_RM(0x82),
-    INVALID_OPCODE_MOD_RM(0x83),
-    INVALID_OPCODE_MOD_RM(0x84),
-    INVALID_OPCODE_MOD_RM(0x85),
-    INVALID_OPCODE_MOD_RM(0x86),
-    INVALID_OPCODE_MOD_RM(0x87),
-    INVALID_OPCODE_MOD_RM(0x88),
-    INVALID_OPCODE_MOD_RM(0x89),
-    OP("pfnacc %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFNACC,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x8b),
-    INVALID_OPCODE_MOD_RM(0x8c),
-    INVALID_OPCODE_MOD_RM(0x8d),
-    OP("pfpnacc %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFPNACC, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x8f),
-
+    NULL,
     /* 9 */
-    OP("pfcmpge %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFCMPGE, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x91),
-    INVALID_OPCODE_MOD_RM(0x92),
-    INVALID_OPCODE_MOD_RM(0x93),
-    OP("pfmin %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFMIN,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x95),
-    OP("pfrcp %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRCP,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("pfrsqrt %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRSQRT, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x98),
-    INVALID_OPCODE_MOD_RM(0x99),
-    OP("pfsub %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFSUB,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x9b),
-    INVALID_OPCODE_MOD_RM(0x9c),
-    INVALID_OPCODE_MOD_RM(0x9d),
-    OP("pfadd %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFADD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x9f),
-
+    NULL,
     /* a */
-    OP("pfcmpgt %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFCMPGT, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xa1),
-    INVALID_OPCODE_MOD_RM(0xa2),
-    INVALID_OPCODE_MOD_RM(0xa3),
-    OP("pfmax %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFMAX,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xa5),
-    OP("pfrcpit1 %Pq,%Qq",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRCPIT1,OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("pfrsqit1 %Pq,%Qq", IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRSQRTIT1,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xa8),
-    INVALID_OPCODE_MOD_RM(0xa9),
-    OP("pfsubr %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFSUBR,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xab),
-    INVALID_OPCODE_MOD_RM(0xac),
-    INVALID_OPCODE_MOD_RM(0xad),
-    OP("pfacc %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFACC,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xaf),
-
+    NULL,
     /* b */
-    OP("pfcmpeq %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFCMPEQ, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xb1),
-    INVALID_OPCODE_MOD_RM(0xb2),
-    INVALID_OPCODE_MOD_RM(0xb3),
-    OP("pfmul %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFMUL,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xb5),
-    OP("pfrcpit2 %Pq,%Qq",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRCPIT2,OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("pmulhrw %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFMULHRW,OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xb8),
-    INVALID_OPCODE_MOD_RM(0xb9),
-    INVALID_OPCODE_MOD_RM(0xba),
-    OP("pswapd %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFSWAPD, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xbc),
-    INVALID_OPCODE_MOD_RM(0xbd),
-    INVALID_OPCODE_MOD_RM(0xbe),
-    OP("pavgusb %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PAVGUSB, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
+    NULL,
     /* c */
-    INVALID_OPCODE_BLOCK_MOD_RM(0xc)
-
+    NULL,
     /* d */
-    INVALID_OPCODE_BLOCK_MOD_RM(0xd)
-
+    NULL,
     /* e */
-    INVALID_OPCODE_BLOCK_MOD_RM(0xe)
-
+    NULL,
     /* f */
-    INVALID_OPCODE_BLOCK_MOD_RM(0xf)
+    &g_aThreeByteMapX86_F30F38_F[0],
 };
 
-
-
-/* Floating point opcode starting with escape byte 0xD8 (values 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF0_Low[8] =
+const DISOPCODE g_aThreeByteMapX86_0F3A_0[16] =
 {
-    /* 0 */
-    OP("fadd %Md",           IDX_ParseModRM,     0,          0,          OP_FADD,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul %Md",           IDX_ParseModRM,     0,          0,          OP_FMUL,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom %Md",           IDX_ParseModRM,     0,          0,          OP_FCOM,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp %Md",          IDX_ParseModRM,     0,          0,          OP_FCOMP,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub %Md",           IDX_ParseModRM,     0,          0,          OP_FSUB,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr %Md",          IDX_ParseModRM,     0,          0,          OP_FSUBR,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv %Md",           IDX_ParseModRM,     0,          0,          OP_FDIV,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr %Md",          IDX_ParseModRM,     0,          0,          OP_FDIVR,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("palignr %Pq,%Qq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PALIGNR,   OP_PARM_Pq,   OP_PARM_Qq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
 };
 
-/* Floating point opcode starting with escape byte 0xD8 (outside 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF0_High[16*4] =
+PCDISOPCODE const g_apThreeByteMapX86_0F3A[16] =
 {
+    /* 0 */
+    g_aThreeByteMapX86_0F3A_0,
+    /* 1 */
+    NULL,
+    /* 2 */
+    NULL,
+    /* 3 */
+    NULL,
+    /* 4 */
+    NULL,
+    /* 5 */
+    NULL,
+    /* 6 */
+    NULL,
+    /* 7 */
+    NULL,
+    /* 8 */
+    NULL,
+    /* 9 */
+    NULL,
+    /* a */
+    NULL,
+    /* b */
+    NULL,
     /* c */
-    OP("fadd ST(0),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(0),ST(1)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(0),ST(2)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(0),ST(3)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(0),ST(4)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(0),ST(5)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(0),ST(6)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(0),ST(7)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(1)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(2)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(3)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(4)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(5)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(6)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(7)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
+    NULL,
     /* d */
-    OP("fcom ST(0),ST(0)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom ST(0),ST(1)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom ST(0),ST(2)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom ST(0),ST(3)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom ST(0),ST(4)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom ST(0),ST(5)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom ST(0),ST(6)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom ST(0),ST(7)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp ST(0),ST(0)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp ST(0),ST(1)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp ST(0),ST(2)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp ST(0),ST(3)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp ST(0),ST(4)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp ST(0),ST(5)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp ST(0),ST(6)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp ST(0),ST(7)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
-
+    NULL,
     /* e */
-    OP("fsub ST(0),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(0),ST(1)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(0),ST(2)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(0),ST(3)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(0),ST(4)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(0),ST(5)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(0),ST(6)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(0),ST(7)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(0),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(0),ST(1)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(0),ST(2)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(0),ST(3)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(0),ST(4)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(0),ST(5)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(0),ST(6)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(0),ST(7)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
+    NULL,
     /* f */
-    OP("fdiv ST(0),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(0),ST(1)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(0),ST(2)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(0),ST(3)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(0),ST(4)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(0),ST(5)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(0),ST(6)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(0),ST(7)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(0),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(0),ST(1)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(0),ST(2)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(0),ST(3)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(0),ST(4)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(0),ST(5)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(0),ST(6)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(0),ST(7)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    NULL,
 };
 
-/* Floating point opcode starting with escape byte 0xD9 (values 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF1_Low[8] =
+const DISOPCODE g_aThreeByteMapX86_660F3A_0[16] =
 {
-    /* 0 */
-    OP("fld %Md",            IDX_ParseModRM,     0,          0,          OP_FLD,     OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
-    OP("fst %Md",            IDX_ParseModRM,     0,          0,          OP_FST,     OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp %Md",           IDX_ParseModRM,     0,          0,          OP_FSTP,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    //TODO:??
-    OP("fldenv %M",          IDX_ParseModRM,     0,          0,          OP_FLDENV,  OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fldcw %Ew",          IDX_ParseModRM,     0,          0,          OP_FSUBR,   OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    //TODO:??
-    OP("fstenv %M",          IDX_ParseModRM,     0,          0,          OP_FSTENV,  OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstcw %Ew",          IDX_ParseModRM,     0,          0,          OP_FSTCW,   OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("roundps %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_ROUNDPS,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("roundpd %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_ROUNDPD,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("roundss %Vss,%Wss,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_ROUNDSS,  OP_PARM_Vss,   OP_PARM_Wss,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("roundsd %Vsd,%Wsd,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_ROUNDSD,  OP_PARM_Vsd,   OP_PARM_Wsd,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("blendps %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_BLENDPS,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("blendpd %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_BLENDPD,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("pblendw %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PBLENDW,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("palignr %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PALIGNR,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
 };
 
-
-/* Floating point opcode starting with escape byte 0xD9 (outside 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF1_High[16*4] =
+const DISOPCODE g_aThreeByteMapX86_660F3A_10[16] =
 {
-    /* c */
-    OP("fld ST(0),ST(0)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fld ST(0),ST(1)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fld ST(0),ST(2)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fld ST(0),ST(3)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fld ST(0),ST(4)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fld ST(0),ST(5)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fld ST(0),ST(6)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fld ST(0),ST(7)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxch ST(0),ST(0)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxch ST(0),ST(1)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxch ST(0),ST(2)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxch ST(0),ST(3)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxch ST(0),ST(4)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxch ST(0),ST(5)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxch ST(0),ST(6)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxch ST(0),ST(7)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
-    /* d */
-    OP("fnop",               0,              0,          0,          OP_FNOP,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
+    OP("pextrb %Eb,%Vdq,%Ib",    IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PEXTRB,    OP_PARM_Eb,  OP_PARM_Vdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("pextrw %Ew,%Vdq,%Ib",    IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PEXTRW,    OP_PARM_Ew,  OP_PARM_Vdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("pextrd %Ed,%Vdq,%Ib",    IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PEXTRD,    OP_PARM_Ed,  OP_PARM_Vdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("extractps %Ed,%Vdq,%Ib", IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_EXTRACTPS, OP_PARM_Ed,  OP_PARM_Vdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -1780,208 +1851,78 @@ const DISOPCODE g_aMapX86_EscF1_High[16*4] =
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
+};
+
+const DISOPCODE g_aThreeByteMapX86_660F3A_20[16] =
+{
+    // pinsrb %Vdq,%Ry/Mb,%Ib
+    OP("pinsrb %Vdq,%Ey,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PINSRB,    OP_PARM_Vdq, OP_PARM_Ey,   OP_PARM_Ib,  DISOPTYPE_HARMLESS),
+    // insertps %Vdq,%Udq/Md,%Ib
+    OP("insertps %Vdq,%Wdq,%Ib",IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_INSERTPS,  OP_PARM_Vdq, OP_PARM_Wdq,  OP_PARM_Ib,  DISOPTYPE_HARMLESS),
+    OP("pinsrd %Vdq,%Ey,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PINSRD,    OP_PARM_Vdq, OP_PARM_Ey,   OP_PARM_Ib,  DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-
-
-    /* e */
-    OP("fchs",               0,              0,          0,          OP_FCHS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fabs",               0,              0,          0,          OP_FABS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("ftst",               0,              0,          0,          OP_FCHS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxam",               0,              0,          0,          OP_FCHS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("fld1",               0,              0,          0,          OP_FLD1,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fldl2t",             0,              0,          0,          OP_FLDL2T,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fldl2e",             0,              0,          0,          OP_FLDL2E,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fldpi",              0,              0,          0,          OP_FLDPI,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fldlg2",             0,              0,          0,          OP_FLDLG2,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fldln2",             0,              0,          0,          OP_FLDLN2,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fldz",               0,              0,          0,          OP_FLDZ,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
 
-    /* f */
-    OP("f2xm1",              0,              0,          0,          OP_F2XM1,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fyl2x",              0,              0,          0,          OP_FYL2X,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fptan",              0,              0,          0,          OP_FPTAN,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fpatan",             0,              0,          0,          OP_FPATAN,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxtract",            0,              0,          0,          OP_FXTRACT, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("frem1",              0,              0,          0,          OP_FREM1,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdecstp",            0,              0,          0,          OP_FDECSTP, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fincstp",            0,              0,          0,          OP_FINCSTP, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fprem",              0,              0,          0,          OP_FPREM,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fyl2xp1",            0,              0,          0,          OP_FYL2XP1, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsqrt",              0,              0,          0,          OP_FSQRT,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsincos",            0,              0,          0,          OP_FSINCOS, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("frndint",            0,              0,          0,          OP_FRNDINT, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fscale",             0,              0,          0,          OP_FSCALE,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsin",               0,              0,          0,          OP_FSIN,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcos",               0,              0,          0,          OP_FCOS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-};
-
-
-/* Floating point opcode starting with escape byte 0xDA (values 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF2_Low[8] =
-{
-    /* 0 */
-    OP("fiadd %Md",          IDX_ParseModRM,     0,          0,          OP_FIADD,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fimul %Md",          IDX_ParseModRM,     0,          0,          OP_FIMUL,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ficom %Md",          IDX_ParseModRM,     0,          0,          OP_FICOM,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ficomp %Md",         IDX_ParseModRM,     0,          0,          OP_FICOMP,  OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fisub %Md",          IDX_ParseModRM,     0,          0,          OP_FISUB,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fisubr %Md",         IDX_ParseModRM,     0,          0,          OP_FISUBR,  OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fidiv %Md",          IDX_ParseModRM,     0,          0,          OP_FIDIV,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fidivr %Md",         IDX_ParseModRM,     0,          0,          OP_FIDIVR,  OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-};
-
-
-/* Floating point opcode starting with escape byte 0xD9 (outside 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF2_High[16*4] =
+const DISOPCODE g_aThreeByteMapX86_660F3A_40[16] =
 {
-    /* c */
-    OP("fcmovb ST(0),ST(0)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovb ST(0),ST(1)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovb ST(0),ST(2)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovb ST(0),ST(3)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovb ST(0),ST(4)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovb ST(0),ST(5)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovb ST(0),ST(6)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovb ST(0),ST(7)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmove ST(0),ST(0)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmove ST(0),ST(1)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmove ST(0),ST(2)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmove ST(0),ST(3)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmove ST(0),ST(4)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmove ST(0),ST(5)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmove ST(0),ST(6)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmove ST(0),ST(7)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
-    /* d */
-    OP("fcmovbe ST(0),ST(0)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovbe ST(0),ST(1)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovbe ST(0),ST(2)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovbe ST(0),ST(3)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovbe ST(0),ST(4)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovbe ST(0),ST(5)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovbe ST(0),ST(6)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovbe ST(0),ST(7)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovu ST(0),ST(0)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovu ST(0),ST(1)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovu ST(0),ST(2)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovu ST(0),ST(3)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovu ST(0),ST(4)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovu ST(0),ST(5)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovu ST(0),ST(6)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovu ST(0),ST(7)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
-    /* e */
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
+    OP("dpps %Vdq,%Wdq,%Ib",    IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_DPPS,      OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("dppd %Vdq,%Wdq,%Ib",    IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_DPPD,      OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("mpsadbw %Vdq,%Wdq,%Ib", IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_MPSADBW,   OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
+    OP("pclmulqdq %Vdq,%Wdq,%Ib",IDX_ParseModRM,   IDX_UseModRM,   IDX_ParseImmByte,   OP_PCLMULQDQ, OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("fucompp",            0,              0,          0,          OP_FUCOMPP, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-
-    /* f */
-    INVALID_OPCODE_BLOCK
 };
 
-
-/* Floating point opcode starting with escape byte 0xDB (values 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF3_Low[8] =
+const DISOPCODE g_aThreeByteMapX86_660F3A_60[16] =
 {
-    /* 0 */
-    OP("fild %Md",           IDX_ParseModRM,     0,          0,          OP_FILD,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pcmpestrm %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PCMPESTRM, OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("pcmpestri %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PCMPESTRI, OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("pcmpistrm %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PCMPISTRM, OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OP("pcmpistri %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PCMPISTRI, OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("fist %Md",           IDX_ParseModRM,     0,          0,          OP_FIST,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fistp %Md",          IDX_ParseModRM,     0,          0,          OP_FISTP,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
-    OP("fld %Mq",            IDX_ParseModRM,     0,          0,          OP_FLD,     OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
-    OP("fstp %Mq",           IDX_ParseModRM,     0,          0,          OP_FSTP,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 };
 
-
-/* Floating point opcode starting with escape byte 0xDB (outside 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF3_High[16*4] =
+const DISOPCODE g_aThreeByteMapX86_660F3A_D0[16] =
 {
-    /* c */
-    OP("fcmovnb ST(0),ST(0)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnb ST(0),ST(1)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnb ST(0),ST(2)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnb ST(0),ST(3)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnb ST(0),ST(4)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnb ST(0),ST(5)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnb ST(0),ST(6)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnb ST(0),ST(7)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovne ST(0),ST(0)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovne ST(0),ST(1)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovne ST(0),ST(2)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovne ST(0),ST(3)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovne ST(0),ST(4)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovne ST(0),ST(5)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovne ST(0),ST(6)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovne ST(0),ST(7)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
-    /* d */
-    OP("fcmovnbe ST(0),ST(0)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnbe ST(0),ST(1)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnbe ST(0),ST(2)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnbe ST(0),ST(3)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnbe ST(0),ST(4)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnbe ST(0),ST(5)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnbe ST(0),ST(6)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnbe ST(0),ST(7)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnu ST(0),ST(0)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnu ST(0),ST(1)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnu ST(0),ST(2)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnu ST(0),ST(3)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnu ST(0),ST(4)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnu ST(0),ST(5)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnu ST(0),ST(6)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcmovnu ST(0),ST(7)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
-    /* e */
     INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("fclex",              0,              0,          0,          OP_FCLEX,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("finit",              0,              0,          0,          OP_FINIT,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("fucomi ST(0),ST(0)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomi ST(0),ST(1)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomi ST(0),ST(2)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomi ST(0),ST(3)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomi ST(0),ST(4)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomi ST(0),ST(5)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomi ST(0),ST(6)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomi ST(0),ST(7)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
-
-    /* e */
-    OP("fcomi ST(0),ST(0)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomi ST(0),ST(1)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomi ST(0),ST(2)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomi ST(0),ST(3)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomi ST(0),ST(4)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomi ST(0),ST(5)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomi ST(0),ST(6)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomi ST(0),ST(7)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -1990,210 +1931,329 @@ const DISOPCODE g_aMapX86_EscF3_High[16*4] =
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("aeskeygen %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   OP_AESKEYGEN, OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
 };
 
-
-/* Floating point opcode starting with escape byte 0xDC (values 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF4_Low[8] =
+/** Three byte opcode map with prefix 0x66 (0xF 0x3A) */
+/** @todo remainder missing (too lazy now) */
+PCDISOPCODE const g_apThreeByteMapX86_660F3A[16] =
 {
     /* 0 */
-    OP("fadd %Mq",           IDX_ParseModRM,     0,          0,          OP_FADD,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul %Mq",           IDX_ParseModRM,     0,          0,          OP_FMUL,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcom %Mq",           IDX_ParseModRM,     0,          0,          OP_FCOM,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomp %Mq",          IDX_ParseModRM,     0,          0,          OP_FCOMP,   OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub %Mq",           IDX_ParseModRM,     0,          0,          OP_FSUB,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr %Mq",          IDX_ParseModRM,     0,          0,          OP_FSUBR,   OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv %Mq",           IDX_ParseModRM,     0,          0,          OP_FDIV,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr %Mq",          IDX_ParseModRM,     0,          0,          OP_FDIVR,   OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-};
-
-
-/* Floating point opcode starting with escape byte 0xDC (outside 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF4_High[16*4] =
-{
+    g_aThreeByteMapX86_660F3A_0,
+    /* 1 */
+    g_aThreeByteMapX86_660F3A_10,
+    /* 2 */
+    g_aThreeByteMapX86_660F3A_20,
+    /* 3 */
+    NULL,
+    /* 4 */
+    g_aThreeByteMapX86_660F3A_40,
+    /* 5 */
+    NULL,
+    /* 6 */
+    g_aThreeByteMapX86_660F3A_60,
+    /* 7 */
+    NULL,
+    /* 8 */
+    NULL,
+    /* 9 */
+    NULL,
+    /* a */
+    NULL,
+    /* b */
+    NULL,
     /* c */
-    OP("fadd ST(0),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(1),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(2),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(3),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(4),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(5),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(6),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fadd ST(7),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(0),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(1),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(2),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(3),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(4),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(5),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(6),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmul ST(7),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
+    NULL,
     /* d */
-    INVALID_OPCODE_BLOCK
-
-
+    g_aThreeByteMapX86_660F3A_D0,
     /* e */
-    OP("fsubr ST(0),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(1),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(2),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(3),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(4),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(5),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(6),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubr ST(7),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(0),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(1),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(2),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(3),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(4),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(5),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(6),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsub ST(7),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
+    NULL,
     /* f */
-    OP("fdivr ST(0),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(1),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(2),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(3),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(4),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(5),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(6),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivr ST(7),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(0),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(1),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(2),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(3),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(4),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(5),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(6),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdiv ST(7),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    NULL,
 };
 
-
-/* Floating point opcode starting with escape byte 0xDD (values 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF5_Low[8] =
+/* 3DNow! map (0x0F 0x0F prefix) */
+const DISOPCODE g_aTwoByteMapX86_3DNow[256] =
 {
     /* 0 */
-    OP("fld %Mq",            IDX_ParseModRM,     0,          0,          OP_FLD,     OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
-    INVALID_OPCODE,
-    OP("fst %Mq",            IDX_ParseModRM,     0,          0,          OP_FST,     OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
-    OP("fstp %Mq",           IDX_ParseModRM,     0,          0,          OP_FSTP,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
-    OP("frstor %M",          IDX_ParseModRM,     0,          0,          OP_FRSTOR,  OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
-    INVALID_OPCODE,
-    OP("fsave %M",           IDX_ParseModRM,     0,          0,          OP_FSAVE,   OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
-    OP("fnstsw %Mw",         IDX_ParseModRM,     0,          0,          OP_FNSTSW,  OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
-};
+    INVALID_OPCODE_MOD_RM(0x00),
+    INVALID_OPCODE_MOD_RM(0x01),
+    INVALID_OPCODE_MOD_RM(0x02),
+    INVALID_OPCODE_MOD_RM(0x03),
+    INVALID_OPCODE_MOD_RM(0x04),
+    INVALID_OPCODE_MOD_RM(0x05),
+    INVALID_OPCODE_MOD_RM(0x06),
+    INVALID_OPCODE_MOD_RM(0x07),
+    INVALID_OPCODE_MOD_RM(0x08),
+    INVALID_OPCODE_MOD_RM(0x09),
+    INVALID_OPCODE_MOD_RM(0x0a),
+    INVALID_OPCODE_MOD_RM(0x0c),
+    OP("pi2fw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PI2FW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pi2fd %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PI2FD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x0e),
+    INVALID_OPCODE_MOD_RM(0x0f),
+
+    /* 1 */
+    INVALID_OPCODE_MOD_RM(0x10),
+    INVALID_OPCODE_MOD_RM(0x11),
+    INVALID_OPCODE_MOD_RM(0x12),
+    INVALID_OPCODE_MOD_RM(0x13),
+    INVALID_OPCODE_MOD_RM(0x14),
+    INVALID_OPCODE_MOD_RM(0x15),
+    INVALID_OPCODE_MOD_RM(0x16),
+    INVALID_OPCODE_MOD_RM(0x17),
+    INVALID_OPCODE_MOD_RM(0x18),
+    INVALID_OPCODE_MOD_RM(0x19),
+    INVALID_OPCODE_MOD_RM(0x1a),
+    INVALID_OPCODE_MOD_RM(0x1b),
+    OP("pf2iw %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PF2IW,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pf2id %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PF2ID,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x1e),
+    INVALID_OPCODE_MOD_RM(0x1f),
+
+    /* 2 */
+    INVALID_OPCODE_BLOCK_MOD_RM(0x2)
 
+    /* 3 */
+    INVALID_OPCODE_BLOCK_MOD_RM(0x3)
+
+    /* 4 */
+    INVALID_OPCODE_BLOCK_MOD_RM(0x4)
+
+    /* 5 */
+    INVALID_OPCODE_BLOCK_MOD_RM(0x5)
+
+    /* 6 */
+    INVALID_OPCODE_BLOCK_MOD_RM(0x6)
+
+    /* 7 */
+    INVALID_OPCODE_BLOCK_MOD_RM(0x7)
+
+    /* 8 */
+    INVALID_OPCODE_MOD_RM(0x80),
+    INVALID_OPCODE_MOD_RM(0x81),
+    INVALID_OPCODE_MOD_RM(0x82),
+    INVALID_OPCODE_MOD_RM(0x83),
+    INVALID_OPCODE_MOD_RM(0x84),
+    INVALID_OPCODE_MOD_RM(0x85),
+    INVALID_OPCODE_MOD_RM(0x86),
+    INVALID_OPCODE_MOD_RM(0x87),
+    INVALID_OPCODE_MOD_RM(0x88),
+    INVALID_OPCODE_MOD_RM(0x89),
+    OP("pfnacc %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFNACC,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x8b),
+    INVALID_OPCODE_MOD_RM(0x8c),
+    INVALID_OPCODE_MOD_RM(0x8d),
+    OP("pfpnacc %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFPNACC, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x8f),
+
+    /* 9 */
+    OP("pfcmpge %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFCMPGE, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x91),
+    INVALID_OPCODE_MOD_RM(0x92),
+    INVALID_OPCODE_MOD_RM(0x93),
+    OP("pfmin %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFMIN,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x95),
+    OP("pfrcp %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRCP,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pfrsqrt %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRSQRT, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x98),
+    INVALID_OPCODE_MOD_RM(0x99),
+    OP("pfsub %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFSUB,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x9b),
+    INVALID_OPCODE_MOD_RM(0x9c),
+    INVALID_OPCODE_MOD_RM(0x9d),
+    OP("pfadd %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFADD,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x9f),
+
+    /* a */
+    OP("pfcmpgt %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFCMPGT, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xa1),
+    INVALID_OPCODE_MOD_RM(0xa2),
+    INVALID_OPCODE_MOD_RM(0xa3),
+    OP("pfmax %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFMAX,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xa5),
+    OP("pfrcpit1 %Pq,%Qq",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRCPIT1,OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pfrsqit1 %Pq,%Qq", IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRSQRTIT1,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xa8),
+    INVALID_OPCODE_MOD_RM(0xa9),
+    OP("pfsubr %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFSUBR,  OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xab),
+    INVALID_OPCODE_MOD_RM(0xac),
+    INVALID_OPCODE_MOD_RM(0xad),
+    OP("pfacc %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFACC,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xaf),
+
+    /* b */
+    OP("pfcmpeq %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFCMPEQ, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xb1),
+    INVALID_OPCODE_MOD_RM(0xb2),
+    INVALID_OPCODE_MOD_RM(0xb3),
+    OP("pfmul %Pq,%Qq",      IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFMUL,   OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xb5),
+    OP("pfrcpit2 %Pq,%Qq",   IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFRCPIT2,OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pmulhrw %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFMULHRW,OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xb8),
+    INVALID_OPCODE_MOD_RM(0xb9),
+    INVALID_OPCODE_MOD_RM(0xba),
+    OP("pswapd %Pq,%Qq",     IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PFSWAPD, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xbc),
+    INVALID_OPCODE_MOD_RM(0xbd),
+    INVALID_OPCODE_MOD_RM(0xbe),
+    OP("pavgusb %Pq,%Qq",    IDX_ParseModRM,     IDX_UseModRM,   0,          OP_PAVGUSB, OP_PARM_Pq,         OP_PARM_Qq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
-/* Floating point opcode starting with escape byte 0xDD (outside 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF5_High[16*4] =
-{
     /* c */
-    OP("ffree ST(0)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ffree ST(1)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ffree ST(2)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ffree ST(3)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ffree ST(4)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ffree ST(5)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ffree ST(6)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ffree ST(7)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
+    INVALID_OPCODE_BLOCK_MOD_RM(0xc)
 
     /* d */
-    OP("fst ST(0)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fst ST(1)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fst ST(2)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fst ST(3)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fst ST(4)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fst ST(5)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fst ST(6)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fst ST(7)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp ST(0)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp ST(1)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp ST(2)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp ST(3)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp ST(4)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp ST(5)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp ST(6)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fstp ST(7)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
+    INVALID_OPCODE_BLOCK_MOD_RM(0xd)
 
     /* e */
-    OP("fucom ST(0)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucom ST(1)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucom ST(2)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucom ST(3)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucom ST(4)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucom ST(5)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucom ST(6)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucom ST(7)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomp ST(0)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomp ST(1)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomp ST(2)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomp ST(3)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomp ST(4)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomp ST(5)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomp ST(6)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomp ST(7)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_BLOCK_MOD_RM(0xe)
 
     /* f */
-    INVALID_OPCODE_BLOCK
+    INVALID_OPCODE_BLOCK_MOD_RM(0xf)
 };
 
 
 
-/* Floating point opcode starting with escape byte 0xDE (values 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF6_Low[8] =
+/* Floating point opcode starting with escape byte 0xD8 (values 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF0_Low[8] =
 {
     /* 0 */
-    OP("fiadd %Mw",          IDX_ParseModRM,     0,          0,          OP_FIADD,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fimul %Mw",          IDX_ParseModRM,     0,          0,          OP_FIMUL,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ficom %Mw",          IDX_ParseModRM,     0,          0,          OP_FICOM,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ficomp %Mw",         IDX_ParseModRM,     0,          0,          OP_FICOMP,  OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fisub %Mw",          IDX_ParseModRM,     0,          0,          OP_FISUB,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fisubr %Mw",         IDX_ParseModRM,     0,          0,          OP_FISUBR,  OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fidiv %Mw",          IDX_ParseModRM,     0,          0,          OP_FIDIV,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fidivr %Mw",         IDX_ParseModRM,     0,          0,          OP_FIDIVR,  OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd %Md",           IDX_ParseModRM,     0,          0,          OP_FADD,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul %Md",           IDX_ParseModRM,     0,          0,          OP_FMUL,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom %Md",           IDX_ParseModRM,     0,          0,          OP_FCOM,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp %Md",          IDX_ParseModRM,     0,          0,          OP_FCOMP,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub %Md",           IDX_ParseModRM,     0,          0,          OP_FSUB,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr %Md",          IDX_ParseModRM,     0,          0,          OP_FSUBR,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv %Md",           IDX_ParseModRM,     0,          0,          OP_FDIV,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr %Md",          IDX_ParseModRM,     0,          0,          OP_FDIVR,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 };
 
-
-/* Floating point opcode starting with escape byte 0xDE (outside 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF6_High[16*4] =
+/* Floating point opcode starting with escape byte 0xD8 (outside 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF0_High[16*4] =
 {
     /* c */
-    OP("faddp ST(0),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("faddp ST(1),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("faddp ST(2),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("faddp ST(3),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("faddp ST(4),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("faddp ST(5),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("faddp ST(6),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("faddp ST(7),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmulp ST(0),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmulp ST(1),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmulp ST(2),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmulp ST(3),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmulp ST(4),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmulp ST(5),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmulp ST(6),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fmulp ST(7),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(0),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(0),ST(1)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(0),ST(2)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(0),ST(3)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(0),ST(4)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(0),ST(5)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(0),ST(6)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(0),ST(7)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(1)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(2)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(3)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(4)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(5)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(6)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(7)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
     /* d */
-    INVALID_OPCODE,
-    OP("fcompp",             0,              0,          0,          OP_FCOMPP,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
-    INVALID_OPCODE,
+    OP("fcom ST(0),ST(0)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom ST(0),ST(1)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom ST(0),ST(2)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom ST(0),ST(3)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom ST(0),ST(4)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom ST(0),ST(5)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom ST(0),ST(6)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom ST(0),ST(7)",   0,              0,          0,          OP_FCOM,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp ST(0),ST(0)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp ST(0),ST(1)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp ST(0),ST(2)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp ST(0),ST(3)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp ST(0),ST(4)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp ST(0),ST(5)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp ST(0),ST(6)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp ST(0),ST(7)",  0,              0,          0,          OP_FCOMP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+
+    /* e */
+    OP("fsub ST(0),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(0),ST(1)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(0),ST(2)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(0),ST(3)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(0),ST(4)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(0),ST(5)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(0),ST(6)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(0),ST(7)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(0),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(0),ST(1)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(0),ST(2)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(0),ST(3)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(0),ST(4)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(0),ST(5)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(0),ST(6)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(0),ST(7)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* f */
+    OP("fdiv ST(0),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(0),ST(1)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(0),ST(2)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(0),ST(3)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(0),ST(4)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(0),ST(5)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(0),ST(6)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(0),ST(7)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(0),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(0),ST(1)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(0),ST(2)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(0),ST(3)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(0),ST(4)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(0),ST(5)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(0),ST(6)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(0),ST(7)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+/* Floating point opcode starting with escape byte 0xD9 (values 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF1_Low[8] =
+{
+    /* 0 */
+    OP("fld %Md",            IDX_ParseModRM,     0,          0,          OP_FLD,     OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OP("fst %Md",            IDX_ParseModRM,     0,          0,          OP_FST,     OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp %Md",           IDX_ParseModRM,     0,          0,          OP_FSTP,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    //TODO:??
+    OP("fldenv %M",          IDX_ParseModRM,     0,          0,          OP_FLDENV,  OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fldcw %Ew",          IDX_ParseModRM,     0,          0,          OP_FSUBR,   OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    //TODO:??
+    OP("fstenv %M",          IDX_ParseModRM,     0,          0,          OP_FSTENV,  OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstcw %Ew",          IDX_ParseModRM,     0,          0,          OP_FSTCW,   OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+
+/* Floating point opcode starting with escape byte 0xD9 (outside 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF1_High[16*4] =
+{
+    /* c */
+    OP("fld ST(0),ST(0)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fld ST(0),ST(1)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fld ST(0),ST(2)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fld ST(0),ST(3)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fld ST(0),ST(4)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fld ST(0),ST(5)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fld ST(0),ST(6)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fld ST(0),ST(7)",    0,              0,          0,          OP_FLD,     OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxch ST(0),ST(0)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxch ST(0),ST(1)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxch ST(0),ST(2)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxch ST(0),ST(3)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxch ST(0),ST(4)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxch ST(0),ST(5)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxch ST(0),ST(6)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxch ST(0),ST(7)",   0,              0,          0,          OP_FXCH,    OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* d */
+    OP("fnop",               0,              0,          0,          OP_FNOP,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -2206,68 +2266,98 @@ const DISOPCODE g_aMapX86_EscF6_High[16*4] =
 
 
     /* e */
-    OP("fsubrp ST(0),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubrp ST(1),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubrp ST(2),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubrp ST(3),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubrp ST(4),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubrp ST(5),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubrp ST(6),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubrp ST(7),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubp ST(0),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubp ST(1),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubp ST(2),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubp ST(3),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubp ST(4),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubp ST(5),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubp ST(6),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fsubp ST(7),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fchs",               0,              0,          0,          OP_FCHS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fabs",               0,              0,          0,          OP_FABS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("ftst",               0,              0,          0,          OP_FCHS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxam",               0,              0,          0,          OP_FCHS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("fld1",               0,              0,          0,          OP_FLD1,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fldl2t",             0,              0,          0,          OP_FLDL2T,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fldl2e",             0,              0,          0,          OP_FLDL2E,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fldpi",              0,              0,          0,          OP_FLDPI,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fldlg2",             0,              0,          0,          OP_FLDLG2,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fldln2",             0,              0,          0,          OP_FLDLN2,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fldz",               0,              0,          0,          OP_FLDZ,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
 
     /* f */
-    OP("fdivrp ST(0),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivrp ST(1),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivrp ST(2),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivrp ST(3),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivrp ST(4),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivrp ST(5),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivrp ST(6),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivrp ST(7),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivp ST(0),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivp ST(1),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivp ST(2),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivp ST(3),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivp ST(4),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivp ST(5),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivp ST(6),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fdivp ST(7),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("f2xm1",              0,              0,          0,          OP_F2XM1,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fyl2x",              0,              0,          0,          OP_FYL2X,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fptan",              0,              0,          0,          OP_FPTAN,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fpatan",             0,              0,          0,          OP_FPATAN,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxtract",            0,              0,          0,          OP_FXTRACT, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("frem1",              0,              0,          0,          OP_FREM1,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdecstp",            0,              0,          0,          OP_FDECSTP, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fincstp",            0,              0,          0,          OP_FINCSTP, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fprem",              0,              0,          0,          OP_FPREM,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fyl2xp1",            0,              0,          0,          OP_FYL2XP1, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsqrt",              0,              0,          0,          OP_FSQRT,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsincos",            0,              0,          0,          OP_FSINCOS, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("frndint",            0,              0,          0,          OP_FRNDINT, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fscale",             0,              0,          0,          OP_FSCALE,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsin",               0,              0,          0,          OP_FSIN,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcos",               0,              0,          0,          OP_FCOS,    OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 };
 
-/* Floating point opcode starting with escape byte 0xDF (values 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF7_Low[8] =
+
+/* Floating point opcode starting with escape byte 0xDA (values 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF2_Low[8] =
 {
     /* 0 */
-    OP("fild %Mw",           IDX_ParseModRM,     0,          0,          OP_FILD,    OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE,
-    OP("fist %Mw",           IDX_ParseModRM,     0,          0,          OP_FIST,    OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fistp %Mw",          IDX_ParseModRM,     0,          0,          OP_FISTP,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fbld %M",            IDX_ParseModRM,     0,          0,          OP_FBLD,    OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fild %Mq",           IDX_ParseModRM,     0,          0,          OP_FILD,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fbstp %M",           IDX_ParseModRM,     0,          0,          OP_FBSTP,   OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fistp %Mq",          IDX_ParseModRM,     0,          0,          OP_FISTP,   OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fiadd %Md",          IDX_ParseModRM,     0,          0,          OP_FIADD,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fimul %Md",          IDX_ParseModRM,     0,          0,          OP_FIMUL,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ficom %Md",          IDX_ParseModRM,     0,          0,          OP_FICOM,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ficomp %Md",         IDX_ParseModRM,     0,          0,          OP_FICOMP,  OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fisub %Md",          IDX_ParseModRM,     0,          0,          OP_FISUB,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fisubr %Md",         IDX_ParseModRM,     0,          0,          OP_FISUBR,  OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fidiv %Md",          IDX_ParseModRM,     0,          0,          OP_FIDIV,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fidivr %Md",         IDX_ParseModRM,     0,          0,          OP_FIDIVR,  OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 };
 
 
-/* Floating point opcode starting with escape byte 0xDF (outside 0-0xBF)*/
-const DISOPCODE g_aMapX86_EscF7_High[16*4] =
+/* Floating point opcode starting with escape byte 0xD9 (outside 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF2_High[16*4] =
 {
     /* c */
-    INVALID_OPCODE_BLOCK
+    OP("fcmovb ST(0),ST(0)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovb ST(0),ST(1)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovb ST(0),ST(2)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovb ST(0),ST(3)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovb ST(0),ST(4)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovb ST(0),ST(5)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovb ST(0),ST(6)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovb ST(0),ST(7)", 0,              0,          0,          OP_FCMOVB,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmove ST(0),ST(0)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmove ST(0),ST(1)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmove ST(0),ST(2)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmove ST(0),ST(3)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmove ST(0),ST(4)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmove ST(0),ST(5)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmove ST(0),ST(6)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmove ST(0),ST(7)", 0,              0,          0,          OP_FCMOVE,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
     /* d */
-    INVALID_OPCODE_BLOCK
+    OP("fcmovbe ST(0),ST(0)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovbe ST(0),ST(1)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovbe ST(0),ST(2)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovbe ST(0),ST(3)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovbe ST(0),ST(4)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovbe ST(0),ST(5)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovbe ST(0),ST(6)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovbe ST(0),ST(7)",0,              0,          0,          OP_FCMOVBE, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovu ST(0),ST(0)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovu ST(0),ST(1)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovu ST(0),ST(2)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovu ST(0),ST(3)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovu ST(0),ST(4)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovu ST(0),ST(5)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovu ST(0),ST(6)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovu ST(0),ST(7)", 0,              0,          0,          OP_FCMOVU,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
     /* e */
-    OP("fnstsw ax",          IDX_ParseFixedReg,  0,          0,          OP_FNSTSW,  OP_PARM_REG_AX,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -2275,328 +2365,1907 @@ const DISOPCODE g_aMapX86_EscF7_High[16*4] =
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("fucomip ST(0),ST(0)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomip ST(0),ST(1)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomip ST(0),ST(2)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomip ST(0),ST(3)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomip ST(0),ST(4)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomip ST(0),ST(5)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomip ST(0),ST(6)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fucomip ST(0),ST(7)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-
-    /* f */
-    OP("fcomip ST(0),ST(0)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomip ST(0),ST(1)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomip ST(0),ST(2)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomip ST(0),ST(3)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomip ST(0),ST(4)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomip ST(0),ST(5)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomip ST(0),ST(6)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fcomip ST(0),ST(7)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
+    OP("fucompp",            0,              0,          0,          OP_FUCOMPP, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
+
+    /* f */
+    INVALID_OPCODE_BLOCK
 };
 
 
-const PCDISOPCODE g_apMapX86_FP_Low[8] =
+/* Floating point opcode starting with escape byte 0xDB (values 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF3_Low[8] =
 {
-    g_aMapX86_EscF0_Low,
-    g_aMapX86_EscF1_Low,
-    g_aMapX86_EscF2_Low,
-    g_aMapX86_EscF3_Low,
-    g_aMapX86_EscF4_Low,
-    g_aMapX86_EscF5_Low,
-    g_aMapX86_EscF6_Low,
-    g_aMapX86_EscF7_Low
+    /* 0 */
+    OP("fild %Md",           IDX_ParseModRM,     0,          0,          OP_FILD,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OP("fist %Md",           IDX_ParseModRM,     0,          0,          OP_FIST,    OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fistp %Md",          IDX_ParseModRM,     0,          0,          OP_FISTP,   OP_PARM_Md,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OP("fld %Mq",            IDX_ParseModRM,     0,          0,          OP_FLD,     OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OP("fstp %Mq",           IDX_ParseModRM,     0,          0,          OP_FSTP,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 };
 
-const PCDISOPCODE g_apMapX86_FP_High[8] =
+
+/* Floating point opcode starting with escape byte 0xDB (outside 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF3_High[16*4] =
 {
-    g_aMapX86_EscF0_High,
-    g_aMapX86_EscF1_High,
-    g_aMapX86_EscF2_High,
-    g_aMapX86_EscF3_High,
-    g_aMapX86_EscF4_High,
-    g_aMapX86_EscF5_High,
-    g_aMapX86_EscF6_High,
-    g_aMapX86_EscF7_High
+    /* c */
+    OP("fcmovnb ST(0),ST(0)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnb ST(0),ST(1)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnb ST(0),ST(2)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnb ST(0),ST(3)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnb ST(0),ST(4)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnb ST(0),ST(5)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnb ST(0),ST(6)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnb ST(0),ST(7)",0,              0,          0,          OP_FCMOVNB, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovne ST(0),ST(0)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovne ST(0),ST(1)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovne ST(0),ST(2)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovne ST(0),ST(3)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovne ST(0),ST(4)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovne ST(0),ST(5)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovne ST(0),ST(6)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovne ST(0),ST(7)",0,              0,          0,          OP_FCMOVNE, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* d */
+    OP("fcmovnbe ST(0),ST(0)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnbe ST(0),ST(1)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnbe ST(0),ST(2)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnbe ST(0),ST(3)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnbe ST(0),ST(4)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnbe ST(0),ST(5)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnbe ST(0),ST(6)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnbe ST(0),ST(7)",0,             0,          0,          OP_FCMOVNBE,OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnu ST(0),ST(0)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnu ST(0),ST(1)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnu ST(0),ST(2)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnu ST(0),ST(3)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnu ST(0),ST(4)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnu ST(0),ST(5)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnu ST(0),ST(6)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcmovnu ST(0),ST(7)",0,              0,          0,          OP_FCMOVNU, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* e */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("fclex",              0,              0,          0,          OP_FCLEX,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("finit",              0,              0,          0,          OP_FINIT,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("fucomi ST(0),ST(0)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomi ST(0),ST(1)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomi ST(0),ST(2)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomi ST(0),ST(3)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomi ST(0),ST(4)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomi ST(0),ST(5)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomi ST(0),ST(6)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomi ST(0),ST(7)",0,               0,          0,          OP_FUCOMI,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+
+    /* e */
+    OP("fcomi ST(0),ST(0)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomi ST(0),ST(1)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomi ST(0),ST(2)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomi ST(0),ST(3)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomi ST(0),ST(4)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomi ST(0),ST(5)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomi ST(0),ST(6)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomi ST(0),ST(7)",0,                0,          0,          OP_FCOMI,   OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 };
 
-/* Opcode extensions (Group tables) */
-const DISOPCODE g_aMapX86_Group1[8*4] =
+
+/* Floating point opcode starting with escape byte 0xDC (values 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF4_Low[8] =
 {
-    /* 80 */
-    OP("add %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ADD, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("or %Eb,%Ib",         IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_OR,  OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("adc %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ADC, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sbb %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SBB, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("and %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_AND, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sub %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SUB, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("xor %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_XOR, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("cmp %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_CMP, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    /* 0 */
+    OP("fadd %Mq",           IDX_ParseModRM,     0,          0,          OP_FADD,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul %Mq",           IDX_ParseModRM,     0,          0,          OP_FMUL,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcom %Mq",           IDX_ParseModRM,     0,          0,          OP_FCOM,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomp %Mq",          IDX_ParseModRM,     0,          0,          OP_FCOMP,   OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub %Mq",           IDX_ParseModRM,     0,          0,          OP_FSUB,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr %Mq",          IDX_ParseModRM,     0,          0,          OP_FSUBR,   OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv %Mq",           IDX_ParseModRM,     0,          0,          OP_FDIV,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr %Mq",          IDX_ParseModRM,     0,          0,          OP_FDIVR,   OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
 
-    /* 81 */
-    OP("add %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_ADD, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("or %Ev,%Iz",         IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_OR,  OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("adc %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_ADC, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sbb %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_SBB, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("and %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_AND, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sub %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_SUB, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("xor %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_XOR, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("cmp %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_CMP, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
-    /* 82 */
-    OP("add %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ADD, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("or %Eb,%Ib",         IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_OR,  OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("adc %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ADC, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sbb %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SBB, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("and %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_AND, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sub %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SUB, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("xor %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_XOR, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("cmp %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_CMP, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+/* Floating point opcode starting with escape byte 0xDC (outside 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF4_High[16*4] =
+{
+    /* c */
+    OP("fadd ST(0),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(1),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(2),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(3),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(4),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(5),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(6),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fadd ST(7),ST(0)",   0,              0,          0,          OP_FADD,    OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(0),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(1),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(2),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(3),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(4),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(5),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(6),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmul ST(7),ST(0)",   0,              0,          0,          OP_FMUL,    OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
 
-    /* 83 */
-    OP("add %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_ADD, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("or %Ev,%Ib",         IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_OR,  OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("adc %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_ADC, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sbb %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_SBB, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("and %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_AND, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sub %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_SUB, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("xor %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_XOR, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("cmp %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_CMP, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    /* d */
+    INVALID_OPCODE_BLOCK
+
+
+    /* e */
+    OP("fsubr ST(0),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(1),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(2),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(3),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(4),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(5),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(6),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubr ST(7),ST(0)",  0,              0,          0,          OP_FSUBR,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(0),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(1),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(2),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(3),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(4),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(5),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(6),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsub ST(7),ST(0)",   0,              0,          0,          OP_FSUB,    OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* f */
+    OP("fdivr ST(0),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(1),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(2),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(3),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(4),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(5),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(6),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivr ST(7),ST(0)",  0,              0,          0,          OP_FDIVR,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(0),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(1),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(2),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(3),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(4),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(5),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(6),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdiv ST(7),ST(0)",   0,              0,          0,          OP_FDIV,    OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+
+/* Floating point opcode starting with escape byte 0xDD (values 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF5_Low[8] =
+{
+    /* 0 */
+    OP("fld %Mq",            IDX_ParseModRM,     0,          0,          OP_FLD,     OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
+    INVALID_OPCODE,
+    OP("fst %Mq",            IDX_ParseModRM,     0,          0,          OP_FST,     OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
+    OP("fstp %Mq",           IDX_ParseModRM,     0,          0,          OP_FSTP,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
+    OP("frstor %M",          IDX_ParseModRM,     0,          0,          OP_FRSTOR,  OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
+    INVALID_OPCODE,
+    OP("fsave %M",           IDX_ParseModRM,     0,          0,          OP_FSAVE,   OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
+    OP("fnstsw %Mw",         IDX_ParseModRM,     0,          0,          OP_FNSTSW,  OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE, DISOPTYPE_HARMLESS /* fixme: wasn't initialized! */),
+};
+
+
+/* Floating point opcode starting with escape byte 0xDD (outside 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF5_High[16*4] =
+{
+    /* c */
+    OP("ffree ST(0)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ffree ST(1)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ffree ST(2)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ffree ST(3)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ffree ST(4)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ffree ST(5)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ffree ST(6)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ffree ST(7)",        0,              0,          0,          OP_FFREE,   OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* d */
+    OP("fst ST(0)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fst ST(1)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fst ST(2)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fst ST(3)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fst ST(4)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fst ST(5)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fst ST(6)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fst ST(7)",      0,                  0,          0,          OP_FST,     OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp ST(0)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp ST(1)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp ST(2)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp ST(3)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp ST(4)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp ST(5)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp ST(6)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fstp ST(7)",     0,                  0,          0,          OP_FSTP,    OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+
+    /* e */
+    OP("fucom ST(0)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucom ST(1)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucom ST(2)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucom ST(3)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucom ST(4)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucom ST(5)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucom ST(6)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucom ST(7)",        0,              0,          0,          OP_FUCOM,   OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomp ST(0)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_0,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomp ST(1)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_1,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomp ST(2)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_2,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomp ST(3)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_3,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomp ST(4)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_4,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomp ST(5)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_5,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomp ST(6)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_6,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomp ST(7)",       0,              0,          0,          OP_FUCOMP,  OP_PARM_REGFP_7,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* f */
+    INVALID_OPCODE_BLOCK
+};
+
+
+
+/* Floating point opcode starting with escape byte 0xDE (values 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF6_Low[8] =
+{
+    /* 0 */
+    OP("fiadd %Mw",          IDX_ParseModRM,     0,          0,          OP_FIADD,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fimul %Mw",          IDX_ParseModRM,     0,          0,          OP_FIMUL,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ficom %Mw",          IDX_ParseModRM,     0,          0,          OP_FICOM,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ficomp %Mw",         IDX_ParseModRM,     0,          0,          OP_FICOMP,  OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fisub %Mw",          IDX_ParseModRM,     0,          0,          OP_FISUB,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fisubr %Mw",         IDX_ParseModRM,     0,          0,          OP_FISUBR,  OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fidiv %Mw",          IDX_ParseModRM,     0,          0,          OP_FIDIV,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fidivr %Mw",         IDX_ParseModRM,     0,          0,          OP_FIDIVR,  OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+
+/* Floating point opcode starting with escape byte 0xDE (outside 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF6_High[16*4] =
+{
+    /* c */
+    OP("faddp ST(0),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("faddp ST(1),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("faddp ST(2),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("faddp ST(3),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("faddp ST(4),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("faddp ST(5),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("faddp ST(6),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("faddp ST(7),ST(0)",  0,              0,          0,          OP_FADDP,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmulp ST(0),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmulp ST(1),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmulp ST(2),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmulp ST(3),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmulp ST(4),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmulp ST(5),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmulp ST(6),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fmulp ST(7),ST(0)",  0,              0,          0,          OP_FMULP,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* d */
+    INVALID_OPCODE,
+    OP("fcompp",             0,              0,          0,          OP_FCOMPP,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+
+    /* e */
+    OP("fsubrp ST(0),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubrp ST(1),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubrp ST(2),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubrp ST(3),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubrp ST(4),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubrp ST(5),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubrp ST(6),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubrp ST(7),ST(0)", 0,              0,          0,          OP_FSUBRP,  OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubp ST(0),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubp ST(1),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubp ST(2),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubp ST(3),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubp ST(4),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubp ST(5),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubp ST(6),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fsubp ST(7),ST(0)",  0,              0,          0,          OP_FSUBP,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* f */
+    OP("fdivrp ST(0),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivrp ST(1),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivrp ST(2),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivrp ST(3),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivrp ST(4),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivrp ST(5),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivrp ST(6),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivrp ST(7),ST(0)", 0,              0,          0,          OP_FDIVRP,  OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivp ST(0),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivp ST(1),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_1,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivp ST(2),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_2,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivp ST(3),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_3,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivp ST(4),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_4,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivp ST(5),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_5,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivp ST(6),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_6,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fdivp ST(7),ST(0)",  0,              0,          0,          OP_FDIVP,   OP_PARM_REGFP_7,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+/* Floating point opcode starting with escape byte 0xDF (values 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF7_Low[8] =
+{
+    /* 0 */
+    OP("fild %Mw",           IDX_ParseModRM,     0,          0,          OP_FILD,    OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OP("fist %Mw",           IDX_ParseModRM,     0,          0,          OP_FIST,    OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fistp %Mw",          IDX_ParseModRM,     0,          0,          OP_FISTP,   OP_PARM_Mw,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fbld %M",            IDX_ParseModRM,     0,          0,          OP_FBLD,    OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fild %Mq",           IDX_ParseModRM,     0,          0,          OP_FILD,    OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fbstp %M",           IDX_ParseModRM,     0,          0,          OP_FBSTP,   OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fistp %Mq",          IDX_ParseModRM,     0,          0,          OP_FISTP,   OP_PARM_Mq,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+
+/* Floating point opcode starting with escape byte 0xDF (outside 0-0xBF)*/
+const DISOPCODE g_aMapX86_EscF7_High[16*4] =
+{
+    /* c */
+    INVALID_OPCODE_BLOCK
+
+    /* d */
+    INVALID_OPCODE_BLOCK
+
+    /* e */
+    OP("fnstsw ax",          IDX_ParseFixedReg,  0,          0,          OP_FNSTSW,  OP_PARM_REG_AX,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("fucomip ST(0),ST(0)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomip ST(0),ST(1)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomip ST(0),ST(2)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomip ST(0),ST(3)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomip ST(0),ST(4)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomip ST(0),ST(5)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomip ST(0),ST(6)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fucomip ST(0),ST(7)",0,              0,          0,          OP_FUCOMIP, OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* f */
+    OP("fcomip ST(0),ST(0)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_0,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomip ST(0),ST(1)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_1,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomip ST(0),ST(2)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_2,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomip ST(0),ST(3)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_3,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomip ST(0),ST(4)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_4,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomip ST(0),ST(5)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_5,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomip ST(0),ST(6)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_6,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fcomip ST(0),ST(7)", 0,              0,          0,          OP_FCOMIP,  OP_PARM_REGFP_0,    OP_PARM_REGFP_7,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
+
+
+const PCDISOPCODE g_apMapX86_FP_Low[8] =
+{
+    g_aMapX86_EscF0_Low,
+    g_aMapX86_EscF1_Low,
+    g_aMapX86_EscF2_Low,
+    g_aMapX86_EscF3_Low,
+    g_aMapX86_EscF4_Low,
+    g_aMapX86_EscF5_Low,
+    g_aMapX86_EscF6_Low,
+    g_aMapX86_EscF7_Low
+};
+
+const PCDISOPCODE g_apMapX86_FP_High[8] =
+{
+    g_aMapX86_EscF0_High,
+    g_aMapX86_EscF1_High,
+    g_aMapX86_EscF2_High,
+    g_aMapX86_EscF3_High,
+    g_aMapX86_EscF4_High,
+    g_aMapX86_EscF5_High,
+    g_aMapX86_EscF6_High,
+    g_aMapX86_EscF7_High
+};
+
+/* Opcode extensions (Group tables) */
+const DISOPCODE g_aMapX86_Group1[8*4] =
+{
+    /* 80 */
+    OP("add %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ADD, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("or %Eb,%Ib",         IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_OR,  OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("adc %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ADC, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sbb %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SBB, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("and %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_AND, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sub %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SUB, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("xor %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_XOR, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("cmp %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_CMP, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* 81 */
+    OP("add %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_ADD, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("or %Ev,%Iz",         IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_OR,  OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("adc %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_ADC, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sbb %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_SBB, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("and %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_AND, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sub %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_SUB, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("xor %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_XOR, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("cmp %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_CMP, OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* 82 */
+    OP("add %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ADD, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("or %Eb,%Ib",         IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_OR,  OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("adc %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ADC, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sbb %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SBB, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("and %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_AND, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sub %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SUB, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("xor %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_XOR, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("cmp %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_CMP, OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* 83 */
+    OP("add %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_ADD, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("or %Ev,%Ib",         IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_OR,  OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("adc %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_ADC, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sbb %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_SBB, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("and %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_AND, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sub %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_SUB, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("xor %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_XOR, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("cmp %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByteSX,0,         OP_CMP, OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+const DISOPCODE g_aMapX86_Group2[8*6] =
+{
+    /* C0 */
+    OP("rol %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ROL,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ror %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ROR,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcl %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_RCL,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcr %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_RCR,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Eb,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHL,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shr %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHR,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Eb,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHL,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sar %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SAR,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* C1 */
+    OP("rol %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ROL,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ror %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ROR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcl %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_RCL,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcr %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_RCR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Ev,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHL,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shr %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Ev,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHL,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sar %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SAR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* D0 */
+    OP("rol %Eb,1",          IDX_ParseModRM,     0,          0,          OP_ROL,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ror %Eb,1",          IDX_ParseModRM,     0,          0,          OP_ROR,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcl %Eb,1",          IDX_ParseModRM,     0,          0,          OP_RCL,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcr %Eb,1",          IDX_ParseModRM,     0,          0,          OP_RCR,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Eb,1",      IDX_ParseModRM,     0,          0,          OP_SHL,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shr %Eb,1",          IDX_ParseModRM,     0,          0,          OP_SHR,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Eb,1",      IDX_ParseModRM,     0,          0,          OP_SHL,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sar %Eb,1",          IDX_ParseModRM,     0,          0,          OP_SAR,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* D1 */
+    OP("rol %Ev,1",          IDX_ParseModRM,     0,          0,          OP_ROL,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ror %Ev,1",          IDX_ParseModRM,     0,          0,          OP_ROR,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcl %Ev,1",          IDX_ParseModRM,     0,          0,          OP_RCL,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcr %Ev,1",          IDX_ParseModRM,     0,          0,          OP_RCR,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Ev,1",      IDX_ParseModRM,     0,          0,          OP_SHL,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shr %Ev,1",          IDX_ParseModRM,     0,          0,          OP_SHR,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Ev,1",      IDX_ParseModRM,     0,          0,          OP_SHL,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sar %Ev,1",          IDX_ParseModRM,     0,          0,          OP_SAR,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* D2 */
+    OP("rol %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_ROL,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ror %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_ROR,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcl %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_RCL,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcr %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_RCR,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Eb,CL",     IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHL,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shr %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHR,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Eb,CL",     IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHL,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sar %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SAR,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* D3 */
+    OP("rol %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_ROL,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ror %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_ROR,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcl %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_RCL,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("rcr %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_RCR,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Ev,CL",     IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHL,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shr %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHR,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("shl/sal %Ev,CL",     IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHL,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sar %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SAR,     OP_PARM_Ev,         OP_PARM_REG_CL ,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+};
+
+
+const DISOPCODE g_aMapX86_Group3[8*2] =
+{
+    /* F6 */
+    OP("test %Eb,%Ib",       IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_TEST,   OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    //AMD manual claims test??
+    INVALID_OPCODE_MOD_RM(0xf601),
+    OP("not %Eb",            IDX_ParseModRM,     0,          0,          OP_NOT,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("neg %Eb",            IDX_ParseModRM,     0,          0,          OP_NEG,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("mul %Eb",            IDX_ParseModRM,     0,          0,          OP_MUL,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("imul %Eb",           IDX_ParseModRM,     0,          0,          OP_IMUL,    OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("div %Eb",            IDX_ParseModRM,     0,          0,          OP_DIV,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("idiv %Eb",           IDX_ParseModRM,     0,          0,          OP_IDIV,    OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* F7 */
+    OP("test %Ev,%Iz",       IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_TEST,    OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    //AMD manual claims test??
+    INVALID_OPCODE_MOD_RM(0xf701),
+    OP("not %Ev",            IDX_ParseModRM,     0,          0,          OP_NOT,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("neg %Ev",            IDX_ParseModRM,     0,          0,          OP_NEG,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("mul %Ev",            IDX_ParseModRM,     0,          0,          OP_MUL,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("imul %Ev",           IDX_ParseModRM,     0,          0,          OP_IMUL,    OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("div %Ev",            IDX_ParseModRM,     0,          0,          OP_DIV,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("idiv %Ev",           IDX_ParseModRM,     0,          0,          OP_IDIV,    OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+const DISOPCODE g_aMapX86_Group4[8] =
+{
+    /* FE */
+    OP("inc %Eb",            IDX_ParseModRM,     0,          0,          OP_INC,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("dec %Eb",            IDX_ParseModRM,     0,          0,          OP_DEC,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0xfe02),
+    INVALID_OPCODE_MOD_RM(0xfe03),
+    INVALID_OPCODE_MOD_RM(0xfe04),
+    INVALID_OPCODE_MOD_RM(0xfe05),
+    INVALID_OPCODE_MOD_RM(0xfe06),
+    INVALID_OPCODE_MOD_RM(0xfe07),
+};
+
+const DISOPCODE g_aMapX86_Group5[8] =
+{
+    /* FF */
+    OP("inc %Ev",            IDX_ParseModRM,     0,          0,          OP_INC,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("dec %Ev",            IDX_ParseModRM,     0,          0,          OP_DEC,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("call %Ev",           IDX_ParseModRM,     0,          0,          OP_CALL,    OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_FORCED_64_OP_SIZE),
+    OP("call %Ep",           IDX_ParseModRM,     0,          0,          OP_CALL,    OP_PARM_Ep,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW),
+    OP("jmp %Ev",            IDX_ParseModRM,     0,          0,          OP_JMP,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_UNCOND_CONTROLFLOW | DISOPTYPE_FORCED_64_OP_SIZE),
+    OP("jmp %Ep",            IDX_ParseModRM,     0,          0,          OP_JMP,     OP_PARM_Ep,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_UNCOND_CONTROLFLOW),
+    OP("push %Ev",           IDX_ParseModRM,     0,          0,          OP_PUSH,    OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS | DISOPTYPE_DEFAULT_64_OP_SIZE),
+    INVALID_OPCODE_MOD_RM(0xff07),
+};
+
+
+const DISOPCODE g_aMapX86_Group6[8] =
+{
+    /* 0F 00 */
+    OP("sldt %Ew",           IDX_ParseModRM,     0,          0,          OP_SLDT,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    OP("str %Ev",            IDX_ParseModRM,     0,          0,          OP_STR,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    OP("lldt %Ew",           IDX_ParseModRM,     0,          0,          OP_LLDT,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+    OP("ltr %Ew",            IDX_ParseModRM,     0,          0,          OP_LTR,     OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+    OP("verr %Ew",           IDX_ParseModRM,     0,          0,          OP_VERR,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    OP("verw %Ew",           IDX_ParseModRM,     0,          0,          OP_VERW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    INVALID_OPCODE_MOD_RM(0x0f0006),
+    INVALID_OPCODE_MOD_RM(0x0f0007),
+};
+
+/* Note!! Group 7 is NOT using the INVALID_OPCODE_MOD_RM because of monitor and vmcall. */
+const DISOPCODE g_aMapX86_Group7_mem[8] =
+{
+    /* 0F 01 */
+    OP("sgdt %Ms",           IDX_ParseModRM,     0,          0,          OP_SGDT,    OP_PARM_Ms,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    OP("sidt %Ms",           IDX_ParseModRM,     0,          0,          OP_SIDT,    OP_PARM_Ms,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    OP("lgdt %Ms",           IDX_ParseModRM,     0,          0,          OP_LGDT,    OP_PARM_Ms,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+    OP("lidt %Ms",           IDX_ParseModRM,     0,          0,          OP_LIDT,    OP_PARM_Ms,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+    OP("smsw %Ew",           IDX_ParseModRM,     0,          0,          OP_SMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    INVALID_OPCODE,
+    OP("lmsw %Ew",           IDX_ParseModRM,     0,          0,          OP_LMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+    OP("invlpg %Mb",         IDX_ParseModRM,     0,          0,          OP_INVLPG,  OP_PARM_Mb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+};
+
+/* Note!! Group 7 is NOT using the INVALID_OPCODE_MOD_RM because of monitor and vmcall. */
+const DISOPCODE g_aMapX86_Group7_mod11_rm000[8] =
+{
+    /* 0F 01 MOD=11b */
+    INVALID_OPCODE,
+    OP("monitor %eAX,%eCX,%eDX", IDX_ParseFixedReg, IDX_ParseFixedReg, IDX_ParseFixedReg,          OP_MONITOR,         OP_PARM_REG_EAX, OP_PARM_REG_ECX, OP_PARM_REG_EDX,    DISOPTYPE_HARMLESS ),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OP("smsw %Ew",           IDX_ParseModRM,     0,          0,          OP_SMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    INVALID_OPCODE,
+    OP("lmsw %Ew",           IDX_ParseModRM,     0,          0,          OP_LMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+    OP("swapgs",             0,                  0,          0,          OP_SWAPGS,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS )
+};
+
+/* Note!! Group 7 is NOT using the INVALID_OPCODE_MOD_RM because of monitor and vmcall. */
+const DISOPCODE g_aMapX86_Group7_mod11_rm001[8] =
+{
+    /* 0F 01 MOD=11b */
+    OP("vmcall",             0,                  0,          0,          OP_VMCALL,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS ),
+    OP("mwait %eAX,%eCX",    IDX_ParseFixedReg,  IDX_ParseFixedReg, 0,   OP_MWAIT,   OP_PARM_REG_EAX,    OP_PARM_REG_ECX,OP_PARM_NONE,   DISOPTYPE_HARMLESS ),
+    INVALID_OPCODE, /* xsetbv */
+    OP("vmmcall",            0,                  0,          0,          OP_VMMCALL, OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS ),
+    OP("smsw %Ew",           IDX_ParseModRM,     0,          0,          OP_SMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    INVALID_OPCODE,
+    OP("lmsw %Ew",           IDX_ParseModRM,     0,          0,          OP_LMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
+    INVALID_OPCODE,
+};
+
+const DISOPCODE g_aMapX86_Group8[8] =
+{
+    /* 0F BA */
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("bt %Ev,%Ib",         IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_BT,      OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("bts %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_BTS,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("btr %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_BTR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("btc %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_BTC,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+const DISOPCODE g_aMapX86_Group9[8] =
+{
+    /* 0F C7 */
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("cmpxchg8b %Mq",      IDX_ParseModRM,     0,          0,          OP_CMPXCHG8B, OP_PARM_Mq,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+};
+
+const DISOPCODE g_aMapX86_Group10[8] =
+{
+    /* 0F B9 */
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+};
+
+
+const DISOPCODE g_aMapX86_Group11[8*2] =
+{
+    /* 0F C6 */
+    OP("mov %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_MOV,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    /* 0F C7 */
+    OP("mov %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,      0,          OP_MOV,     OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
+
+
+/* 0xF 0x71 */
+const DISOPCODE g_aMapX86_Group12[8*2] =
+{
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psrlw %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLW,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psraw %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRAW,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psllw %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLW,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+
+    /* Group 12 with prefix 0x66 */
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psrlw %Pdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLW,  OP_PARM_Pdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psraw %Pdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRAW,  OP_PARM_Pdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psllw %Pdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLW,  OP_PARM_Pdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+};
+
+/* 0xF 0x72 */
+const DISOPCODE g_aMapX86_Group13[8*2] =
+{
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psrld %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLD,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psrad %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRAD,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("pslld %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLD,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+
+    /* Group 13 with prefix 0x66 */
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psrld %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psrad %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRAD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("pslld %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+};
+
+/* 0xF 0x73 */
+const DISOPCODE g_aMapX86_Group14[8*2] =
+{
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psrlq %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLQ,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psllq %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLQ,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+
+    /* Group 14 with prefix 0x66 */
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psrlq %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("psrldq %Wdq,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLDQ, OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("psllq %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pslldq %Wdq,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLDQ, OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+
+/* 0xF 0xAE */
+const DISOPCODE g_aMapX86_Group15_mem[8] =
+{
+    OP("fxsave %M",          IDX_ParseModRM,     0,          0,          OP_FXSAVE,  OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("fxrstor %M",         IDX_ParseModRM,     0,          0,          OP_FXRSTOR, OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("ldmxcsr %M",         IDX_ParseModRM,     0,          0,          OP_LDMXCSR, OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("stmxcsr %M",         IDX_ParseModRM,     0,          0,          OP_STMXCSR, OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    OP("clflush %Mb",        IDX_ParseModRM,     0,          0,          OP_CLFLUSH, OP_PARM_Mb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+/* 0xF 0xAE */
+const DISOPCODE g_aMapX86_Group15_mod11_rm000[8] =
+{
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    /** @todo mfence + lfence + sfence instructions do not require rm=0,
+     *        they work for any RM value. See bs2-cpu-instr-1.asm for details. */
+    OP("lfence",             IDX_ParseModFence,  0,          0,          OP_LFENCE,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("mfence",             IDX_ParseModFence,  0,          0,          OP_MFENCE,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("sfence",             IDX_ParseModFence,  0,          0,          OP_SFENCE,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+/* 0xF 0x18 */
+const DISOPCODE g_aMapX86_Group16[8] =
+{
+    OP("prefetchnta %Mb",  IDX_ParseModRM, 0,          0,          OP_PREFETCH,OP_PARM_Mb,        OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("prefetcht0 %Mb",   IDX_ParseModRM, 0,          0,          OP_PREFETCH,OP_PARM_Mb,        OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("prefetcht1 %Mb",   IDX_ParseModRM, 0,          0,          OP_PREFETCH,OP_PARM_Mb,        OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("prefetcht2 %Mb",   IDX_ParseModRM, 0,          0,          OP_PREFETCH,OP_PARM_Mb,        OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+    INVALID_OPCODE_MOD_RM(0x),
+};
+
+/* 0x90 or 0xF3 0x90 */
+const DISOPCODE g_aMapX86_NopPause[2] =
+{
+    OP("nop",                0,              0,          0,       OP_NOP,     OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("pause",              0,              0,          0,       OP_PAUSE,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+};
+
+/* Vex codes for two bytes opcodes starting with 0Fh */
+const DISOPCODE g_aMapTwoBytesVex[256] =
+{
+    /* 0 */
+    INVALID_OPCODE_BLOCK
+
+    /* 1 */
+    OPVEX("vmovups %Vps,%Wps",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVUPS,      OP_PARM_Vps,    OP_PARM_Wps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovups %Wps,%Vps",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVUPS,      OP_PARM_Wps,    OP_PARM_Vps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("&vmovlps/vmovlps %Vq,%Hq,%Wq",     IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,          OP_MOVLPS,      OP_PARM_Vq,     OP_PARM_Hq,     OP_PARM_Wq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovlps %Mq,%Vq",         IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVLPS,      OP_PARM_Mq,     OP_PARM_Vq,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vunpcklps %Vx,%Hx,%Wx",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,          OP_UNPCKLPS,    OP_PARM_Vx,     OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vunpckhps %Vx,%Hx,%Wx",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,          OP_UNPCKHPS,    OP_PARM_Vx,     OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("&vmovhps/vmovlhps %Vdq,%Hq,%Wq",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,          OP_MOVHPS,      OP_PARM_Vdq,    OP_PARM_Hq,     OP_PARM_Wq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovhps %Mq,%Vq",         IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVHPS,      OP_PARM_Mq,     OP_PARM_Vq,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* 2 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vmovaps %Vps,%Wps",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVAPS,      OP_PARM_Vps,    OP_PARM_Wps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovaps %Wps,%Vps",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVAPS,      OP_PARM_Wps,    OP_PARM_Vps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("vmovntps %Mps,%Vps",      IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVNTPS,     OP_PARM_Mps,    OP_PARM_Vps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vucomiss %Vss,%Wss",      IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_UCOMISS,     OP_PARM_Vss,    OP_PARM_Wss,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vcomiss %Vss,%Wss",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_COMISS,      OP_PARM_Vss,    OP_PARM_Wss,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* 3 */
+    INVALID_OPCODE_BLOCK
+
+    /* 4 */
+    INVALID_OPCODE_BLOCK
+
+    /* 5 */
+    OPVEX("vmovmskps %Gy,%Ups",      IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_MOVMSKPS,    OP_PARM_Gy,      OP_PARM_Ups,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vsqrtps %Vps,%Wps",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_SQRTPS,      OP_PARM_Vps,     OP_PARM_Wps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vrsqrtps %Vps,%Wps",      IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_RSQRTPS,     OP_PARM_Vps,     OP_PARM_Wps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vrcpps %Vps,%Wps",        IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_RCPPS,       OP_PARM_Vps,     OP_PARM_Wps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vandps %Vps,%Hps,%Wps",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_ANDPS,       OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vandnps %Vps,%Hps,%Wps",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_ANDNPS,      OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vorps %Vps,%Hps,%Wps",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_ORPS,        OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vxorps %Vps,%Hps,%Wps",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_XORPS,       OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vaddps %Vps,%Hps,%Wps",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_ADDPS,       OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmulps %Vps,%Hps,%Wps",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_MULPS,       OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vcvtps2pd %Vpd,%Wps",     IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_CVTPS2PD,    OP_PARM_Vpd,     OP_PARM_Wps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vcvtdq2ps %Vps,%Wdq",     IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_CVTDQ2PS,    OP_PARM_Vps,     OP_PARM_Wdq,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vsubps %Vps,%Hps,%Wps",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_SUBPS,       OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vminps %Vps,%Hps,%Wps",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_MINPS,       OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vdivps %Vps,%Hps,%Wps",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_DIVPS,       OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmaxps %Vps,%Hps,%Wps",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_MAXPS,       OP_PARM_Vps,     OP_PARM_Hps,    OP_PARM_Wps,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* 6 */
+    INVALID_OPCODE_BLOCK
+
+    /* 7 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    /* Next instruction has the following format:
+     * @name1/name2,
+     * where name2 is used when VEX.L bit is set,
+     * name1 otherwise. */
+    OPVEX("@vzeroupper/vzeroall",     0,                  0,                  0,              0,         OP_EMMS,        OP_PARM_NONE,    OP_PARM_NONE,   OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* 8 */
+    INVALID_OPCODE_BLOCK
+
+    /* 9 */
+    INVALID_OPCODE_BLOCK
+
+    /* a */
+    INVALID_OPCODE_BLOCK
+
+    /* b */
+    INVALID_OPCODE_BLOCK
+
+    /* c */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcmpss %Vps,%Hps,%Wps,%Ib",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_CMPSS,   OP_PARM_Vps,  OP_PARM_Hps,  OP_PARM_Wps,   OP_PARM_Ib,     DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vshufps %Vps,%Hps,%Wps,%Ib",  IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_SHUFPS,   OP_PARM_Vps,  OP_PARM_Hps,  OP_PARM_Wps,   OP_PARM_Ib,     DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* d */
+    INVALID_OPCODE_BLOCK
+
+    /* e */
+    INVALID_OPCODE_BLOCK
+
+    /* f */
+    INVALID_OPCODE_BLOCK
+};
+
+/* Vex codes for two bytes opcodes starting with 0Fh with prefix 66H*/
+const DISOPCODE g_aMapTwoBytesVex_66H[256] =
+{
+    /* 0 */
+    INVALID_OPCODE_BLOCK
+
+    /* 1 */
+    OPVEX("vmovupd %Vpd,%Wpd",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVUPD,      OP_PARM_Vpd,    OP_PARM_Wpd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovupd %Wpd,%Vpd",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVUPD,      OP_PARM_Wpd,    OP_PARM_Vpd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovlpd %Vq,%Hq,%Mq",     IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,          OP_MOVLPD,      OP_PARM_Vq,     OP_PARM_Hq,     OP_PARM_Mq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovlpd %Mq,%Vq",         IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVLPD,      OP_PARM_Mq,     OP_PARM_Vq,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vunpcklpd %Vx,%Hx,%Wx",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,          OP_UNPCKLPD,    OP_PARM_Vx,     OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vunpckhpd %Vx,%Hx,%Wx",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,          OP_UNPCKHPD,    OP_PARM_Vx,     OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovhpd %Vdq,%Hq,%Mq",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,          OP_MOVHPD,      OP_PARM_Vdq,    OP_PARM_Hq,     OP_PARM_Mq,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovhpd %Mq,%Vq",         IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVHPD,      OP_PARM_Mq,     OP_PARM_Vq,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* 2 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vmovapd %Vpd,%Wpd",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVAPD,      OP_PARM_Vpd,    OP_PARM_Wpd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovapd %Wpd,%Vpd",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVAPD,      OP_PARM_Wpd,    OP_PARM_Vpd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("vmovntpd %Mpd,%Vpd",      IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_MOVNTPD,     OP_PARM_Mpd,    OP_PARM_Vpd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vucomisd %Vsd,%Wsd",      IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_UCOMISD,     OP_PARM_Vsd,    OP_PARM_Wsd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vcomisd %Vsd,%Wsd",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,          OP_COMISD,      OP_PARM_Vsd,    OP_PARM_Wsd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* 3 */
+    INVALID_OPCODE_BLOCK
+
+    /* 4 */
+    INVALID_OPCODE_BLOCK
+
+    /* 5 */
+    OPVEX("vmovmskpd %Gy,%Upd",      IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_MOVMSKPD,    OP_PARM_Gy,      OP_PARM_Upd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vsqrtpd %Vpd,%Wpd",       IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_SQRTPD,      OP_PARM_Vpd,     OP_PARM_Wpd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vandpd %Vpd,%Hpd,%Wpd",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_ANDPD,       OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vandnpd %Vpd,%Hpd,%Wpd",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_ANDNPD,      OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vorpd %Vpd,%Hpd,%Wpd",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_ORPD,        OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vxorpd %Vpd,%Hpd,%Wpd",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_XORPD,       OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vaddpd %Vpd,%Hpd,%Wpd",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_ADDPD,       OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmulpd %Vpd,%Hpd,%Wpd",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_MULPD,       OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vcvtpd2ps %Vps,%Wpd",     IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_CVTPD2PS,    OP_PARM_Vps,     OP_PARM_Wpd,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vcvtps2dq %Vdq,%Wps",     IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_CVTPS2DQ,    OP_PARM_Vdq,     OP_PARM_Wps,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vsubpd %Vpd,%Hpd,%Wpd",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_SUBPD,       OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vminpd %Vpd,%Hpd,%Wpd",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_MINPD,       OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vdivpd %Vpd,%Hpd,%Wpd",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_DIVPD,       OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmaxpd %Vpd,%Hpd,%Wpd",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_MAXPD,       OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+
+    /* 6 */
+    OPVEX("vpunpcklbw %Vx,%Hx,%Wx",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PUNPCKLBW,   OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpunpcklwd %Vx,%Hx,%Wx",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PUNPCKLWD,   OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpunpckldq %Vx,%Hx,%Wx",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PUNPCKLDQ,   OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpacksswb %Vx,%Hx,%Wx",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PACKSSWB,    OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpgtb %Vx,%Hx,%Wx",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PCMPGTB,     OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpgtw %Vx,%Hx,%Wx",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PCMPGTW,     OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpgtd %Vx,%Hx,%Wx",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PCMPGTD,     OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpackuswb %Vx,%Hx,%Wx",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PACKUSWB,    OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpunpckhbw %Vx,%Hx,%Wx",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PUNPCKHBW,   OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpunpckhwd %Vx,%Hx,%Wx",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PUNPCKHWD,   OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpunpckhdq %Vx,%Hx,%Wx",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PUNPCKHDQ,   OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpackssdw %Vx,%Hx,%Wx",   IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PACKSSDW,    OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpunpcklqdq %Vx,%Hx,%Wx", IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PUNPCKLQDQ,  OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpunpckhqdq %Vx,%Hx,%Wx", IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PUNPCKHQDQ,  OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("#vmovd/vmovq %Vy,%Ey",    IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_MOVD,        OP_PARM_Vy,      OP_PARM_Ey,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovdqa %Vx,%Wx",         IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_MOVDQA,      OP_PARM_Vx,      OP_PARM_Wx,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* 7 */
+    OPVEX("vpshufd %Vx,%Wx,%Ib",     IDX_ParseModRM,     IDX_UseModRM,    IDX_ParseImmByte,  0,         OP_PSHUFD,      OP_PARM_Vx,      OP_PARM_Wx,     OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vpcmpeqb %Vx,%Hx,%Wx",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PCMPEQB,     OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpeqw %Vx,%Hx,%Wx",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PCMPEQW,     OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpeqd %Vx,%Hx,%Wx",    IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_PCMPEQD,     OP_PARM_Vx,      OP_PARM_Hx,     OP_PARM_Wx,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vhaddpd %Vpd,%Hpd,%Wpd",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_HADDPD,      OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vhsubpd %Vpd,%Hpd,%Wpd",  IDX_ParseModRM,     IDX_ParseVexDest,   IDX_UseModRM,   0,         OP_HSUBPD,      OP_PARM_Vpd,     OP_PARM_Hpd,    OP_PARM_Wpd,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovd/vmovq %Ey,%Vy",     IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_MOVD,        OP_PARM_Ey,      OP_PARM_Vy,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("vmovdqa %Wx,%Vx",         IDX_ParseModRM,     IDX_UseModRM,       0,              0,         OP_MOVDQA,      OP_PARM_Wx,      OP_PARM_Vx,     OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+
+    /* 8 */
+    INVALID_OPCODE_BLOCK
+
+    /* 9 */
+    INVALID_OPCODE_BLOCK
+
+    /* a */
+    INVALID_OPCODE_BLOCK
+
+    /* b */
+    INVALID_OPCODE_BLOCK
+
+    /* c */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcmpps %Vpd,%Hpd,%Wpd,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_CMPSS,   OP_PARM_Vpd,  OP_PARM_Hpd,  OP_PARM_Wpd,  OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    // vpinsrw Vdq,Hdq,Ry/Mw,Ib
+    OPVEX("vpinsrw %Vdq,%Hdq,%Ey,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_PINSRW,  OP_PARM_Vdq,  OP_PARM_Hdq,  OP_PARM_Ey,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    OPVEX("vpextrw %Gd,%Udq,%Ib",      IDX_ParseModRM,    IDX_UseModRM,       IDX_ParseImmByte,              0,  OP_PEXTRW,  OP_PARM_Gd,   OP_PARM_Udq,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vshufpd %Vpd,%Hpd,%Wpd,%Ib",IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_SHUFPD,  OP_PARM_Vpd,  OP_PARM_Hpd,  OP_PARM_Wpd,  OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* d */
+    OPVEX("vaddsubpd %Vpd,%Hpd,%Wpd", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_ADDSUBPD,  OP_PARM_Vpd,  OP_PARM_Hpd,  OP_PARM_Wpd,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsrlw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSRLW,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsrld %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSRLD,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsrlq %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSRLQ,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpaddq %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PADDQ,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmullw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMULLW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmovq %Wq,%Vq",            IDX_ParseModRM,    IDX_UseModRM,                  0,                0,  OP_MOVQ,      OP_PARM_Wq,   OP_PARM_Vq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovmskb %Gd,%Ux",        IDX_ParseModRM,    IDX_UseModRM,                  0,                0,  OP_PMOVMSKB,  OP_PARM_Gd,   OP_PARM_Ux,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsubusb %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSUBUSB,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsubusw %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSUBUSW,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpminub %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMINUB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpand %Vx,%Hx,%Wx",        IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PAND,      OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpaddusb %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PADDUSB,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpaddusw %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PADDUSW,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmaxub %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMAXUB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpandn %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PANDN,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+
+    /* e */
+    OPVEX("vpavgb %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PAVGB,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsraw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSRAW,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsrad %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSRAD,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpavgw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PAVGW,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmulhuw %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMULHUW,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmulhw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMULHW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vcvttpd2dq %Vx,%Wpd",      IDX_ParseModRM,    IDX_UseModRM,                  0,                0,  OP_CVTTPD2DQ, OP_PARM_Vx,   OP_PARM_Wpd,  OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmovntdq %Mx,%Vx",         IDX_ParseModRM,    IDX_UseModRM,                  0,                0,  OP_MOVNTDQ,   OP_PARM_Mx,   OP_PARM_Vx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsubsb %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSUBSB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsubsw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSUBSW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpminsw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMINSW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpor %Vx,%Hx,%Wx",         IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_POR,       OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpaddsb %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PADDSB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpaddsw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PADDSW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmaxsw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMAXSW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpxor %Vx,%Hx,%Wx",        IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PXOR,      OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+
+    /* f */
+    INVALID_OPCODE,
+    OPVEX("vpsllw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSLLW,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpslld %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSLLD,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsllq %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSLLQ,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmuludq %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMULUDQ,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmaddwd %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMADDWD,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsadbw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSADBW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmaskmovdqu %Vdq,%Udq",    IDX_ParseModRM,    IDX_UseModRM,                  0,                0,  OP_MASKMOVDQU,OP_PARM_Vdq,  OP_PARM_Udq,  OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsubb %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSUBB,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsubw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSUBW,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsubd %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSUBD,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsubq %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSUBQ,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpaddb %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PADDB,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpaddw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PADDW,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpaddd %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PADDD,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+};
+
+const DISOPCODE g_aMapTwoBytesVex_F2H[256] =
+{
+    /* 0 */
+    INVALID_OPCODE_BLOCK
+
+    /* 1 */
+    OPVEX("vmovsd %Vx,%Hx,%Wsd",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MOVSD,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmovsd %Wsd,%Hx,%Vsd",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MOVSD,     OP_PARM_Wsd,  OP_PARM_Hx,   OP_PARM_Vsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmovddup %Vx,%Wx",         IDX_ParseModRM,    IDX_UseModRM,                  0,                0,  OP_MOVDDUP,   OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* 2 */
+    INVALID_OPCODE_BLOCK
+
+    /* 3 */
+    INVALID_OPCODE_BLOCK
+
+    /* 4 */
+    INVALID_OPCODE_BLOCK
+
+    /* 5 */
+    INVALID_OPCODE,
+    OPVEX("vsqrtsd %Vsd,%Hsd,%Wsd",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_SQRTSD,   OP_PARM_Vsd,   OP_PARM_Hsd,   OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vaddsd %Vsd,%Hsd,%Wsd",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_ADDSD,    OP_PARM_Vsd,   OP_PARM_Hsd,   OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmulsd %Vsd,%Hsd,%Wsd",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MULSD,    OP_PARM_Vsd,   OP_PARM_Hsd,   OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vcvtsd2ss %Vss,%Hx,%Wsd",  IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_CVTSD2SS, OP_PARM_Vss,   OP_PARM_Hx,    OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("vsubsd %Vsd,%Hsd,%Wsd",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_SUBSD,    OP_PARM_Vsd,   OP_PARM_Hsd,   OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vminsd %Vsd,%Hsd,%Wsd",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MINSD,    OP_PARM_Vsd,   OP_PARM_Hsd,   OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vdivsd %Vsd,%Hsd,%Wsd",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_DIVSD,    OP_PARM_Vsd,   OP_PARM_Hsd,   OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmaxsd %Vsd,%Hsd,%Wsd",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MAXSD,    OP_PARM_Vsd,   OP_PARM_Hsd,   OP_PARM_Wsd,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+
+    /* 6 */
+    INVALID_OPCODE_BLOCK
+
+    /* 7 */
+    OPVEX("vpshuflw %Vx,%Wx,%Ib",     IDX_ParseModRM,    IDX_UseModRM,       IDX_ParseImmByte,            0,  OP_PSHUFLW,  OP_PARM_Vx,    OP_PARM_Wx,   OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vhaddps %Vps,%Hps,%Wps",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_HADDPS,   OP_PARM_Vps,   OP_PARM_Hps,   OP_PARM_Wps,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vhsubps %Vps,%Hps,%Wps",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_HSUBPS,   OP_PARM_Vps,   OP_PARM_Hps,   OP_PARM_Wps,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* 8 */
+    INVALID_OPCODE_BLOCK
+
+    /* 9 */
+    INVALID_OPCODE_BLOCK
+
+    /* a */
+    INVALID_OPCODE_BLOCK
+
+    /* b */
+    INVALID_OPCODE_BLOCK
+
+    /* c */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcmpsd %Vsd,%Hsd,%Wsd,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_CMPSD, OP_PARM_Vsd,  OP_PARM_Hsd,  OP_PARM_Wsd,  OP_PARM_Ib,    DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* d */
+    OPVEX("vaddsubps %Vps,%Hps,%Wps",  IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_ADDSUBPS,   OP_PARM_Vps,   OP_PARM_Hps,   OP_PARM_Wps,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* e */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcvtpd2dq %Vx,%Wpd",     IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_CVTPD2DQ,  OP_PARM_Vx,   OP_PARM_Wpd,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* f */
+    OPVEX("vlddqu %Vx,%Mx",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_LDDQU,  OP_PARM_Vx,   OP_PARM_Mx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+};
+
+/* Vex codes for two bytes opcodes starting with 0Fh with prefix F3H*/
+const DISOPCODE g_aMapTwoBytesVex_F3H[256] =
+{
+
+    /* 0 */
+    INVALID_OPCODE_BLOCK
+
+    /* 1 */
+    OPVEX("vmovss %Vx,%Hx,%Wss",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MOVSS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wss,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmovss %Wss,%Hx,%Vss",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MOVSS,     OP_PARM_Wss,  OP_PARM_Hx,   OP_PARM_Vss,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmovsldup %Vx,%Wx",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_MOVSLDUP,  OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vmovshdup %Vx,%Wx",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_MOVSHDUP,  OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* 2 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcvtsi2ss %Vss,%Hss,%Ey",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_CVTSI2SS,  OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Ey,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("vcvttss2si %Gy,%Wss",       IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_CVTTSS2SI, OP_PARM_Gy,    OP_PARM_Wss,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vcvtss2si %Gy,%Wss",        IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_CVTSS2SI,  OP_PARM_Gy,    OP_PARM_Wss,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* 3 */
+    INVALID_OPCODE_BLOCK
+
+    /* 4 */
+    INVALID_OPCODE_BLOCK
+
+    /* 5 */
+    INVALID_OPCODE,
+    OPVEX("vsqrtss %Vss,%Hss,%Wss",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_SQRTSS,     OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vrsqrtss %Vss,%Hss,%Wss",  IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_RSQRTSS,    OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vrcpss %Vss,%Hss,%Wss",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_RCPSS,      OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vaddss %Vss,%Hss,%Wss",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_ADDSS,      OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmulss %Vss,%Hss,%Wss",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MULSS,      OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vcvtss2sd %Vsd,%Hx,%Wss",  IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_CVTSS2SD,   OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vcvttps2dq %Vdq,%Wps",     IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_CVTTPS2DQ,  OP_PARM_Vdq,   OP_PARM_Wps,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vsubss %Vss,%Hss,%Wss",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_SUBSS,      OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vminss %Vss,%Hss,%Wss",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MINSS,      OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vdivss %Vss,%Hss,%Wss",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_DIVSS,      OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmaxss %Vss,%Hss,%Wss",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MAXSS,      OP_PARM_Vss,   OP_PARM_Hss,   OP_PARM_Wss,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+
+    /* 6 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vmovdqu %Vx,%Wx",          IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_MOVDQU,  OP_PARM_Vx,    OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+
+    /* 7 */
+    OPVEX("vpshufhw %Vx,%Wx,%Ib",     IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,           0,  OP_PSHUFHW, OP_PARM_Vx,    OP_PARM_Wx,   OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vmovq %Vq,%Wq",            IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_MOVQ,    OP_PARM_Vq,    OP_PARM_Wq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmovdqu %Wx,%Vx",          IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_MOVDQU,  OP_PARM_Wx,    OP_PARM_Vx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+
+    /* 8 */
+    INVALID_OPCODE_BLOCK
+
+    /* 9 */
+    INVALID_OPCODE_BLOCK
+
+    /* a */
+    INVALID_OPCODE_BLOCK
+
+    /* b */
+    INVALID_OPCODE_BLOCK
+
+    /* c */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcmpps %Vss,%Hss,%Wss,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_CMPSS, OP_PARM_Vss,  OP_PARM_Hss,  OP_PARM_Wss,  OP_PARM_Ib,    DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* d */
+    INVALID_OPCODE_BLOCK
+
+    /* e */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcvtdq2pd %Vx,%Wpd",     IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_CVTDQ2PD,  OP_PARM_Vx,   OP_PARM_Wpd,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* f */
+    INVALID_OPCODE_BLOCK
+};
+
+const DISOPCODE g_aMapThreeBytesVex_0F38_F[16] =
+{
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("andn %Gy,%By,%Ey",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_ANDN,      OP_PARM_Gy,   OP_PARM_By,   OP_PARM_Ey,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("bzhi %Gy,%By,%Ey",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_BZHI,      OP_PARM_Gy,   OP_PARM_By,   OP_PARM_Ey,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("bextr %Gy,%By,%Ey",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_BEXTR,     OP_PARM_Gy,   OP_PARM_By,   OP_PARM_Ey,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE
 };
 
-const DISOPCODE g_aMapX86_Group2[8*6] =
+const DISOPCODE g_aMapThreeBytesVex_F30F38_F[16] =
 {
-    /* C0 */
-    OP("rol %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ROL,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ror %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ROR,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcl %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_RCL,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcr %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_RCR,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Eb,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHL,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shr %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHR,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Eb,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHL,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sar %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SAR,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("pext %Gy,%By,%Ey",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PEXT,      OP_PARM_Gy,   OP_PARM_By,   OP_PARM_Ey,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("sarx %Gy,%By,%Ey",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_SARX,      OP_PARM_Gy,   OP_PARM_By,   OP_PARM_Ey,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE
+};
 
-    /* C1 */
-    OP("rol %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ROL,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ror %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_ROR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcl %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_RCL,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcr %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_RCR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Ev,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHL,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shr %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Ev,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SHL,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sar %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,0,         OP_SAR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+const DISOPCODE g_aMapThreeBytesVex_F20F38_F[16] =
+{
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("pdep %Gy,%By,%Ey",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PDEP,      OP_PARM_Gy,   OP_PARM_By,   OP_PARM_Ey,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("mulx %By,%Gy,%Ey",    IDX_ParseVexDest,    IDX_ParseModRM,   IDX_UseModRM,                0,  OP_MULX,      OP_PARM_By,   OP_PARM_Gy,   OP_PARM_Ey,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("shrx %Gy,%By,%Ey",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_SHRX,      OP_PARM_Gy,   OP_PARM_By,   OP_PARM_Ey,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE
+};
 
-    /* D0 */
-    OP("rol %Eb,1",          IDX_ParseModRM,     0,          0,          OP_ROL,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ror %Eb,1",          IDX_ParseModRM,     0,          0,          OP_ROR,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcl %Eb,1",          IDX_ParseModRM,     0,          0,          OP_RCL,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcr %Eb,1",          IDX_ParseModRM,     0,          0,          OP_RCR,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Eb,1",      IDX_ParseModRM,     0,          0,          OP_SHL,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shr %Eb,1",          IDX_ParseModRM,     0,          0,          OP_SHR,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Eb,1",      IDX_ParseModRM,     0,          0,          OP_SHL,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sar %Eb,1",          IDX_ParseModRM,     0,          0,          OP_SAR,     OP_PARM_Eb,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+const DISOPCODE g_aMapThreeBytesVex_660F38[256] =
+{
 
-    /* D1 */
-    OP("rol %Ev,1",          IDX_ParseModRM,     0,          0,          OP_ROL,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ror %Ev,1",          IDX_ParseModRM,     0,          0,          OP_ROR,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcl %Ev,1",          IDX_ParseModRM,     0,          0,          OP_RCL,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcr %Ev,1",          IDX_ParseModRM,     0,          0,          OP_RCR,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Ev,1",      IDX_ParseModRM,     0,          0,          OP_SHL,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shr %Ev,1",          IDX_ParseModRM,     0,          0,          OP_SHR,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Ev,1",      IDX_ParseModRM,     0,          0,          OP_SHL,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sar %Ev,1",          IDX_ParseModRM,     0,          0,          OP_SAR,     OP_PARM_Ev,         OP_PARM_1 ,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    /* 0 */
+    OPVEX("vpshufb %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSHUFB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vphaddw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PHADDW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vphaddd %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PHADDD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vphaddsw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PHADDSW,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmaddubsw %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMADDUBSW, OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vphsubw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PHSUBW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vphsubd %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PHSUBD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vphsubsw %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PHSUBSW,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsignb %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSIGNB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsignw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSIGNW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsignd %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSIGND,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmulhrsw %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMULHRSW,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpermilps %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PERMILPS,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpermilpd %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PERMILPD,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vtestps %Vx,%Wx",           IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_TESTPS,    OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vtestpd %Vx,%Wx",           IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_TESTPD,    OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
 
-    /* D2 */
-    OP("rol %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_ROL,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ror %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_ROR,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcl %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_RCL,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcr %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_RCR,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Eb,CL",     IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHL,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shr %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHR,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Eb,CL",     IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHL,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sar %Eb,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SAR,     OP_PARM_Eb,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    /* 1 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcvtph2ps %Vx,%Wx,%Ib",     IDX_ParseModRM,    IDX_UseModRM,       IDX_ParseImmByte,            0,  OP_CVTPH2PS,  OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vpermps %Vqq,%Hqq,%Wqq",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PERMPS,    OP_PARM_Vqq,  OP_PARM_Hqq,  OP_PARM_Wqq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vptest %Vx,%Wx",            IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PTEST,     OP_PARM_Vx,   OP_PARM_Wd,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vbroadcastss %Vx,%Wd",      IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_BROADCASTSS, OP_PARM_Vx,   OP_PARM_Wd,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vbroadcastsd %Vqq,%Wq",     IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_BROADCASTSD, OP_PARM_Vqq,   OP_PARM_Wq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vbroadcastf128 %Vqq,%Mdq",  IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_BROADCASTF128, OP_PARM_Vqq,   OP_PARM_Wdq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("vpabsb %Vx,%Wx",            IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PABSB,     OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpabsw %Vx,%Wx",            IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PABSW,     OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpabsd %Vx,%Wx",            IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PABSD,     OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
 
-    /* D3 */
-    OP("rol %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_ROL,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ror %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_ROR,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcl %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_RCL,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("rcr %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_RCR,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Ev,CL",     IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHL,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shr %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHR,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("shl/sal %Ev,CL",     IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SHL,     OP_PARM_Ev,         OP_PARM_REG_CL, OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sar %Ev,CL",         IDX_ParseModRM,     IDX_ParseFixedReg, 0,       OP_SAR,     OP_PARM_Ev,         OP_PARM_REG_CL ,OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    /* 2 */
+    OPVEX("vpmovsxbw %Vx,%Wq",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVSX,    OP_PARM_Vx,   OP_PARM_Wq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovsxbd %Vx,%Wd",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVSX,    OP_PARM_Vx,   OP_PARM_Wd,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovsxbq %Vx,%Ww",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVSX,    OP_PARM_Vx,   OP_PARM_Ww,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovsxwd %Vx,%Wq",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVSX,    OP_PARM_Vx,   OP_PARM_Wq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovsxwq %Vx,%Wd",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVSX,    OP_PARM_Vx,   OP_PARM_Wd,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovsxdq %Vx,%Wq",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVSX,    OP_PARM_Vx,   OP_PARM_Wq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vpmuldq %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMULDQ,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpeqq %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PCMPEQQ,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmovntdqa %Vx,%Wx",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_MOVNTDQA,  OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpackusdw %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PACKUSDW,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmaskmovps %Vx,%Hx,%Mx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MASKMOVPS, OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Mx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmaskmovpd %Vx,%Hx,%Mx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MASKMOVPD, OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Mx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmaskmovps %Mx,%Hx,%Vx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MASKMOVPS, OP_PARM_Mx,   OP_PARM_Hx,   OP_PARM_Vx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vmaskmovpd %Mx,%Hx,%Vx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_MASKMOVPD, OP_PARM_Mx,   OP_PARM_Hx,   OP_PARM_Vx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
 
-};
+    /* 3 */
+    OPVEX("vpmovzxbw %Vx,%Wq",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVZX,    OP_PARM_Vx,   OP_PARM_Wq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovzxbd %Vx,%Wd",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVZX,    OP_PARM_Vx,   OP_PARM_Wd,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovzxbq %Vx,%Ww",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVZX,    OP_PARM_Vx,   OP_PARM_Ww,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovzxwd %Vx,%Wq",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVZX,    OP_PARM_Vx,   OP_PARM_Wq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovzxwq %Vx,%Wd",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVZX,    OP_PARM_Vx,   OP_PARM_Wd,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmovzxdq %Vx,%Wq",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PMOVZX,    OP_PARM_Vx,   OP_PARM_Wq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpermd %Vqq,%Hqq,%Wqq",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PERMD,     OP_PARM_Vqq,  OP_PARM_Hqq,  OP_PARM_Wqq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpgtq %Vx,%Hx,%Wx",      IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PCMPGTQ,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpminsb %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMINSB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpminsd %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMINSB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpminuw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMINUW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpminud %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMINUD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmaxsb %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMAXSB,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmaxsd %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMAXSD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmaxuw %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMAXUW,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpmaxud %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMAXUD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
 
+    /* 4 */
+    OPVEX("vpmulld %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMULLD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vphminposuw %Vdq,%Wdq",     IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PHMINPOSUW,OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("#vpsrlvd/vpsrlvq %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSRLVD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpsravd %Vx,%Hx,%Wx",       IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSRAVD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vpsllvd/vpsllvq %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PSLLVD,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 
-const DISOPCODE g_aMapX86_Group3[8*2] =
-{
-    /* F6 */
-    OP("test %Eb,%Ib",       IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_TEST,   OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    //AMD manual claims test??
-    INVALID_OPCODE_MOD_RM(0xf601),
-    OP("not %Eb",            IDX_ParseModRM,     0,          0,          OP_NOT,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("neg %Eb",            IDX_ParseModRM,     0,          0,          OP_NEG,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("mul %Eb",            IDX_ParseModRM,     0,          0,          OP_MUL,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("imul %Eb",           IDX_ParseModRM,     0,          0,          OP_IMUL,    OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("div %Eb",            IDX_ParseModRM,     0,          0,          OP_DIV,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("idiv %Eb",           IDX_ParseModRM,     0,          0,          OP_IDIV,    OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    /* 5 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vpbroadcastd %Vx,%Wx",      IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PBROADCASTD, OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpbroadcastq %Vx,%Wx",      IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PBROADCASTQ, OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpbroadcasti128 %Vqq,%Mdq", IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PBROADCASTI128, OP_PARM_Vqq,   OP_PARM_Mdq,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 
-    /* F7 */
-    OP("test %Ev,%Iz",       IDX_ParseModRM,     IDX_ParseImmZ,  0,          OP_TEST,    OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    //AMD manual claims test??
-    INVALID_OPCODE_MOD_RM(0xf701),
-    OP("not %Ev",            IDX_ParseModRM,     0,          0,          OP_NOT,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("neg %Ev",            IDX_ParseModRM,     0,          0,          OP_NEG,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("mul %Ev",            IDX_ParseModRM,     0,          0,          OP_MUL,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("imul %Ev",           IDX_ParseModRM,     0,          0,          OP_IMUL,    OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("div %Ev",            IDX_ParseModRM,     0,          0,          OP_DIV,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("idiv %Ev",           IDX_ParseModRM,     0,          0,          OP_IDIV,    OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-};
+    /* 6 */
+    INVALID_OPCODE_BLOCK
 
-const DISOPCODE g_aMapX86_Group4[8] =
-{
-    /* FE */
-    OP("inc %Eb",            IDX_ParseModRM,     0,          0,          OP_INC,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("dec %Eb",            IDX_ParseModRM,     0,          0,          OP_DEC,     OP_PARM_Eb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0xfe02),
-    INVALID_OPCODE_MOD_RM(0xfe03),
-    INVALID_OPCODE_MOD_RM(0xfe04),
-    INVALID_OPCODE_MOD_RM(0xfe05),
-    INVALID_OPCODE_MOD_RM(0xfe06),
-    INVALID_OPCODE_MOD_RM(0xfe07),
-};
+    /* 7 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vpbroadcastb %Vx,%Wx",      IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PBROADCASTB, OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpbroadcastw %Vx,%Wx",      IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_PBROADCASTW, OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 
-const DISOPCODE g_aMapX86_Group5[8] =
-{
-    /* FF */
-    OP("inc %Ev",            IDX_ParseModRM,     0,          0,          OP_INC,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("dec %Ev",            IDX_ParseModRM,     0,          0,          OP_DEC,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("call %Ev",           IDX_ParseModRM,     0,          0,          OP_CALL,    OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_FORCED_64_OP_SIZE),
-    OP("call %Ep",           IDX_ParseModRM,     0,          0,          OP_CALL,    OP_PARM_Ep,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW),
-    OP("jmp %Ev",            IDX_ParseModRM,     0,          0,          OP_JMP,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_UNCOND_CONTROLFLOW | DISOPTYPE_FORCED_64_OP_SIZE),
-    OP("jmp %Ep",            IDX_ParseModRM,     0,          0,          OP_JMP,     OP_PARM_Ep,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_UNCOND_CONTROLFLOW),
-    OP("push %Ev",           IDX_ParseModRM,     0,          0,          OP_PUSH,    OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS | DISOPTYPE_DEFAULT_64_OP_SIZE),
-    INVALID_OPCODE_MOD_RM(0xff07),
-};
+    /* 8 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("#vpmaskmovd/vpmaskmovq %Vx,%Hx,%Mx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_PMASKMOVD, OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Mx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("#vpmaskmovd/vpmaskmovq %Mx,%Vx,%Hx",    IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseVexDest,                0,  OP_PMASKMOVD, OP_PARM_Mx,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
 
+    /* 9 */
+    /* Seems incorrect format is used in the Intel opcode tables.
+     * Correct form according to Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 2 (2A, 2B & 2C): Instruction Set Reference, A-Z
+     * is the following:
+     * v?gather?d/q %Vx, %Md/q, %Hx ,
+     * where d/q is defined by VEX.W bit.
+     *
+     * The instruction are in the following format:
+     * #name1/name2 format
+     * if REX.W is set name2 is used,
+     * otherwise name1.
+     */
+    OPVEX("#vpgatherdd/vpgatherdq %Vx,%My,%Hx",     IDX_ParseModRM,    IDX_UseModRM,       IDX_ParseVexDest,  0,  OP_GATHER,  OP_PARM_Vx,   OP_PARM_My,   OP_PARM_Hx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vpgatherqd/vpgatherqq %Vx,%My,%Hx",     IDX_ParseModRM,    IDX_UseModRM,       IDX_ParseVexDest,  0,  OP_GATHER,  OP_PARM_Vx,   OP_PARM_My,   OP_PARM_Hx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vgatherdps/vgatherdpd %Vx,%My,%Hx",     IDX_ParseModRM,    IDX_UseModRM,       IDX_ParseVexDest,  0,  OP_GATHER,  OP_PARM_Vx,   OP_PARM_My,   OP_PARM_Hx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vgatherqps/vgatherqpd %Vx,%My,%Hx",     IDX_ParseModRM,    IDX_UseModRM,       IDX_ParseVexDest,  0,  OP_GATHER,  OP_PARM_Vx,   OP_PARM_My,   OP_PARM_Hx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("#vfmaddsub132ps/vfmaddsub132pd %Vx,%Hx,%Wx", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADDSUB132PS,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsubadd132ps/vfmsubadd132pd %Vx,%Hx,%Wx", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUBADD132PS,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmadd132ps/vfmadd132pd %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADD132PS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmadd132ss/vfmadd132sd %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADD132SS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsub132ps/vfmsub132pd %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUB132PS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsub132ss/vfmsub132sd %Vx,%Hx,%Wx",     IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUB132SS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmadd132ps/vfnmadd132pd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMADD132PS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmadd132ss/vfnmadd132sd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMADD132SS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmsub132ps/vfnmsub132pd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMSUB132PS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmsub132ss/vfnmsub132sd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMSUB132SS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
 
-const DISOPCODE g_aMapX86_Group6[8] =
-{
-    /* 0F 00 */
-    OP("sldt %Ew",           IDX_ParseModRM,     0,          0,          OP_SLDT,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
-    OP("str %Ev",            IDX_ParseModRM,     0,          0,          OP_STR,     OP_PARM_Ev,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
-    OP("lldt %Ew",           IDX_ParseModRM,     0,          0,          OP_LLDT,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
-    OP("ltr %Ew",            IDX_ParseModRM,     0,          0,          OP_LTR,     OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
-    OP("verr %Ew",           IDX_ParseModRM,     0,          0,          OP_VERR,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
-    OP("verw %Ew",           IDX_ParseModRM,     0,          0,          OP_VERW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
-    INVALID_OPCODE_MOD_RM(0x0f0006),
-    INVALID_OPCODE_MOD_RM(0x0f0007),
-};
+    /* a */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("#vfmaddsub213ps/vfmaddsub213pd %Vx,%Hx,%Wx", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADDSUB213PS,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsubadd213ps/vfmsubadd213pd %Vx,%Hx,%Wx", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUBADD213PS,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmadd213ps/vfmadd213pd %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADD213PS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmadd213ss/vfmadd213sd %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADD213SS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsub213ps/vfmsub213pd %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUB213PS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsub213ss/vfmsub213sd %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUB213SS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmadd213ps/vfnmadd213pd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMADD213PS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmadd213ss/vfnmadd213sd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMADD213SS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmsub213ps/vfnmsub213pd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMSUB213PS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmsub213ss/vfnmsub213sd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMSUB213SS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
 
-/* Note!! Group 7 is NOT using the INVALID_OPCODE_MOD_RM because of monitor and vmcall. */
-const DISOPCODE g_aMapX86_Group7_mem[8] =
-{
-    /* 0F 01 */
-    OP("sgdt %Ms",           IDX_ParseModRM,     0,          0,          OP_SGDT,    OP_PARM_Ms,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
-    OP("sidt %Ms",           IDX_ParseModRM,     0,          0,          OP_SIDT,    OP_PARM_Ms,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
-    OP("lgdt %Ms",           IDX_ParseModRM,     0,          0,          OP_LGDT,    OP_PARM_Ms,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
-    OP("lidt %Ms",           IDX_ParseModRM,     0,          0,          OP_LIDT,    OP_PARM_Ms,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
-    OP("smsw %Ew",           IDX_ParseModRM,     0,          0,          OP_SMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
+    /* b */
     INVALID_OPCODE,
-    OP("lmsw %Ew",           IDX_ParseModRM,     0,          0,          OP_LMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
-    OP("invlpg %Mb",         IDX_ParseModRM,     0,          0,          OP_INVLPG,  OP_PARM_Mb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
-};
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("#vfmaddsub231ps/vfmaddsub231pd %Vx,%Hx,%Wx", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADDSUB231PS,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsubadd231ps/vfmsubadd231pd %Vx,%Hx,%Wx", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUBADD231PS,  OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmadd231ps/vfmadd231pd %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADD231PS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmadd231ss/vfmadd231sd %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMADD231SS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsub231ps/vfmsub231pd %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUB231PS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfmsub231ss/vfmsub231sd %Vx,%Hx,%Wx",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FMSUB231SS,     OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmadd231ps/vfnmadd231pd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMADD231PS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmadd231ss/vfnmadd231sd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMADD231SS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmsub231ps/vfnmsub231pd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMSUB231PS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vfnmsub231ss/vfnmsub231sd %Vx,%Hx,%Wx",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,  OP_FNMSUB231SS,    OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
 
-/* Note!! Group 7 is NOT using the INVALID_OPCODE_MOD_RM because of monitor and vmcall. */
-const DISOPCODE g_aMapX86_Group7_mod11_rm000[8] =
-{
-    /* 0F 01 MOD=11b */
+    /* c */
+    INVALID_OPCODE_BLOCK
+
+    /* d */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("monitor %eAX,%eCX,%eDX", IDX_ParseFixedReg, IDX_ParseFixedReg, IDX_ParseFixedReg,          OP_MONITOR,         OP_PARM_REG_EAX, OP_PARM_REG_ECX, OP_PARM_REG_EDX,    DISOPTYPE_HARMLESS ),
     INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("smsw %Ew",           IDX_ParseModRM,     0,          0,          OP_SMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
     INVALID_OPCODE,
-    OP("lmsw %Ew",           IDX_ParseModRM,     0,          0,          OP_LMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
-    OP("swapgs",             0,                  0,          0,          OP_SWAPGS,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS )
-};
+    OPVEX("vaesimc %Vdq,%Wdq",         IDX_ParseModRM,    IDX_UseModRM,       0,                           0,  OP_AESIMC,    OP_PARM_Vdq,  OP_PARM_Wdq,  OP_PARM_NONE, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vaesenc %Vdq,%Hdq,%Wdq",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_AESENC,    OP_PARM_Vdq,  OP_PARM_Hdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vaesenclast %Vdq,%Hdq,%Wdq",IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_AESENCLAST,OP_PARM_Vdq,  OP_PARM_Hdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vaesdec %Vdq,%Hdq,%Wdq",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_AESDEC,    OP_PARM_Vdq,  OP_PARM_Hdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vaesdeclast %Vdq,%Hdq,%Wdq",IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,                0,  OP_AESDECLAST,OP_PARM_Vdq,  OP_PARM_Hdq,  OP_PARM_Wdq,  OP_PARM_NONE, DISOPTYPE_HARMLESS),
 
-/* Note!! Group 7 is NOT using the INVALID_OPCODE_MOD_RM because of monitor and vmcall. */
-const DISOPCODE g_aMapX86_Group7_mod11_rm001[8] =
-{
-    /* 0F 01 MOD=11b */
-    OP("vmcall",             0,                  0,          0,          OP_VMCALL,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS ),
-    OP("mwait %eAX,%eCX",    IDX_ParseFixedReg,  IDX_ParseFixedReg, 0,   OP_MWAIT,   OP_PARM_REG_EAX,    OP_PARM_REG_ECX,OP_PARM_NONE,   DISOPTYPE_HARMLESS ),
+    /* e */
+    INVALID_OPCODE_BLOCK
+
+    /* f */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("shlx %Gy,%By,%Ey",    IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,  0,   OP_BEXTR,   OP_PARM_Gy,   OP_PARM_By,   OP_PARM_Ey, OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-    OP("smsw %Ew",           IDX_ParseModRM,     0,          0,          OP_SMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP),
     INVALID_OPCODE,
-    OP("lmsw %Ew",           IDX_ParseModRM,     0,          0,          OP_LMSW,    OP_PARM_Ew,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED),
     INVALID_OPCODE,
 };
 
-const DISOPCODE g_aMapX86_Group8[8] =
+const DISOPCODE g_aMapThreeBytesVex_660F3A[256] =
 {
-    /* 0F BA */
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("bt %Ev,%Ib",         IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_BT,      OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("bts %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_BTS,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("btr %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_BTR,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("btc %Ev,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_BTC,     OP_PARM_Ev,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-};
+    /* 0 */
+    OPVEX("vpermq %Vqq,%Wqq,%Ib",     IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_PERMQ,     OP_PARM_Vqq,  OP_PARM_Wqq,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpermpd %Vqq,%Wqq,%Ib",    IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_PERMPD,    OP_PARM_Vqq,  OP_PARM_Wqq,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpblendd %Vx,%Hx,%Wx,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PBLENDD,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("vpermilps %Vx,%Wx,%Ib",    IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_PERMILPS,  OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vpermilpd %Vx,%Wx,%Ib",    IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_PERMILPD,  OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vperm2f128 %Vqq,%Hqq,%Wqq,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PERM2F128,   OP_PARM_Vqq,  OP_PARM_Hqq,  OP_PARM_Wqq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    OPVEX("vroundps %Vx,%Wx,%Ib",     IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_ROUNDPS,   OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vroundpd %Vx,%Wx,%Ib",     IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_ROUNDPD,   OP_PARM_Vx,   OP_PARM_Wx,   OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vroundss %Vss,%Wss,%Ib",   IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_ROUNDSS,   OP_PARM_Vss,  OP_PARM_Wss,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vroundsd %Vsd,%Wsd,%Ib",   IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_ROUNDSD,   OP_PARM_Vsd,  OP_PARM_Wsd,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vblendps %Vx,%Hx,%Wx,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_BLENDPS,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    OPVEX("vblendpd %Vx,%Hx,%Wx,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_BLENDPD,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    OPVEX("vpblendw %Vx,%Hx,%Wx,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PBLENDW,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    OPVEX("vpalignr %Vx,%Hx,%Wx,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PALIGNR,   OP_PARM_Vx,   OP_PARM_Hx,   OP_PARM_Wx,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
 
-const DISOPCODE g_aMapX86_Group9[8] =
-{
-    /* 0F C7 */
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("cmpxchg8b %Mq",      IDX_ParseModRM,     0,          0,          OP_CMPXCHG8B, OP_PARM_Mq,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-};
+    /* 1 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    // vpextrb %Rd/Mb,%Vdq,%Ib
+    OPVEX("vpextrb %Eb,%Vdq,%Ib",     IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_PEXTRB,    OP_PARM_Eb,   OP_PARM_Vdq,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    // vpextrw %Rd/Mw,%Vdq,%Ib
+    OPVEX("vpextrw %Ew,%Vdq,%Ib",     IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_PEXTRW,    OP_PARM_Ew,   OP_PARM_Vdq,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("#vpextrd/vpextrq %Ey,%Vdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,     0,     OP_PEXTRD,    OP_PARM_Ey,   OP_PARM_Vdq,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vextractps %Ed,%Vdq,%Ib",  IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_EXTRACTPS, OP_PARM_Ed,   OP_PARM_Vdq,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    OPVEX("vinsertf128 %Vqq,%Hqq,%Wqq,%Ib",   IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_INSERTF128,   OP_PARM_Vqq,  OP_PARM_Hqq,  OP_PARM_Wqq,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OPVEX("vextractf128 %Wdq,%Vqq,%Ib",IDX_ParseModRM,   IDX_UseModRM,        IDX_ParseImmByte,    0,            OP_EXTRACTF128, OP_PARM_Eb,  OP_PARM_Vdq,  OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vcvtps2ph %Wx,%Vx,%Ib",    IDX_ParseModRM,    IDX_UseModRM,        IDX_ParseImmByte,    0,             OP_CVTPS2PH,  OP_PARM_Wx,   OP_PARM_Vx,   OP_PARM_Ib,   OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 
-const DISOPCODE g_aMapX86_Group10[8] =
-{
-    /* 0F B9 */
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-};
+    /* 2 */
+    // vpinsrb %Vdq,%Hdq,%Ry/Mb,%Ib
+    OPVEX("vpinsrb %Vdq,%Hdq,%Eb,%Ib",   IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_PINSRB,  OP_PARM_Vdq,  OP_PARM_Hdq,  OP_PARM_Eb,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    // vinsertps %Vdq,%Hdq,%Udq/Md,%Ib
+    OPVEX("vinsertps %Vdq,%Hdq,%Wd,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_INSERTPS,  OP_PARM_Vdq,  OP_PARM_Hdq,  OP_PARM_Wd,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    OPVEX("#vpinsrd/vpinsrq %Vdq,%Hdq,%Ey,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_PINSRD,    OP_PARM_Vdq,  OP_PARM_Hdq,  OP_PARM_Ey,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 
+    /* 3 */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vinserti128 %Vqq,%Hqq,%Wqq,%Ib", IDX_ParseModRM,    IDX_ParseVexDest,   IDX_UseModRM,   IDX_ParseImmByte,  OP_INSERTI128,  OP_PARM_Vqq,  OP_PARM_Hqq,  OP_PARM_Wqq,   OP_PARM_Ib,   DISOPTYPE_HARMLESS),
+    OPVEX("vextracti128 %Wdq,%Vqq,%Ib",     IDX_ParseModRM,    IDX_UseModRM,       IDX_ParseImmByte,   0,             OP_EXTRACTI128, OP_PARM_Wdq,  OP_PARM_Vqq,  OP_PARM_Ib,    OP_PARM_NONE, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
 
-const DISOPCODE g_aMapX86_Group11[8*2] =
-{
-    /* 0F C6 */
-    OP("mov %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,       0,          OP_MOV,     OP_PARM_Eb,         OP_PARM_Ib ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    /* 4 */
+    OPVEX("vdpps %Vx,%Hx,%Wx,%Ib",   IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_DPPS,   OP_PARM_Vx,  OP_PARM_Hx,  OP_PARM_Wx,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OPVEX("vdppd %Vdq,%Hdq,%Wdq,%Ib",IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_DPPD,   OP_PARM_Vdq, OP_PARM_Hdq, OP_PARM_Wdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    OPVEX("vmpsadbw %Vx,%Hx,%Wx,%Ib",IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_MPSADBW,OP_PARM_Vx,  OP_PARM_Hx,  OP_PARM_Wx,   OP_PARM_Ib, DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
+    OPVEX("vpclmulqdq %Vdq,%Hdq,%Wdq,%Ib",IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PCLMULQDQ,   OP_PARM_Vdq, OP_PARM_Hdq, OP_PARM_Wdq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
+    OPVEX("vperm2i128 %Vqq,%Hqq,%Wqq,%Ib",IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PERM2I128,   OP_PARM_Vqq, OP_PARM_Hqq, OP_PARM_Wqq,  OP_PARM_Ib, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vblendvps %Vx,%Hx,%Wx,%Lx",   IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_BLENDVPS,   OP_PARM_Vx,  OP_PARM_Hx,  OP_PARM_Wx,   OP_PARM_Lx, DISOPTYPE_HARMLESS),
+    OPVEX("vblendvpd %Vx,%Hx,%Wx,%Lx",   IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_BLENDVPD,   OP_PARM_Vx,  OP_PARM_Hx,  OP_PARM_Wx,   OP_PARM_Lx, DISOPTYPE_HARMLESS),
+    OPVEX("vpblendvb %Vx,%Hx,%Wx,%Lx",   IDX_ParseModRM,    IDX_ParseVexDest,    IDX_UseModRM,   IDX_ParseImmByte,   OP_PBLENDVB,    OP_PARM_Vx,  OP_PARM_Hx,  OP_PARM_Wx,   OP_PARM_Lx, DISOPTYPE_HARMLESS),
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+
+    /* 5 */
+    INVALID_OPCODE_BLOCK
+
+    /* 6 */
+    OPVEX("vpcmpestrm %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   0,   OP_PCMPESTRM,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib,  OP_PARM_NONE,  DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpestri %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   0,   OP_PCMPESTRI,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib,  OP_PARM_NONE,  DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpistrm %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   0,   OP_PCMPISTRM,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib,  OP_PARM_NONE,  DISOPTYPE_HARMLESS),
+    OPVEX("vpcmpistri %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   0,   OP_PCMPISTRI,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib,  OP_PARM_NONE,  DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-    /* 0F C7 */
-    OP("mov %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,      0,          OP_MOV,     OP_PARM_Ev,         OP_PARM_Iz ,    OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
@@ -2604,124 +4273,80 @@ const DISOPCODE g_aMapX86_Group11[8*2] =
     INVALID_OPCODE,
     INVALID_OPCODE,
     INVALID_OPCODE,
-};
 
+    /* 7 */
+    INVALID_OPCODE_BLOCK
 
-/* 0xF 0x71 */
-const DISOPCODE g_aMapX86_Group12[8*2] =
-{
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psrlw %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLW,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psraw %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRAW,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psllw %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLW,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
+    /* 8 */
+    INVALID_OPCODE_BLOCK
 
-    /* Group 12 with prefix 0x66 */
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psrlw %Pdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLW,  OP_PARM_Pdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psraw %Pdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRAW,  OP_PARM_Pdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psllw %Pdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLW,  OP_PARM_Pdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-};
+    /* 9 */
+    INVALID_OPCODE_BLOCK
 
-/* 0xF 0x72 */
-const DISOPCODE g_aMapX86_Group13[8*2] =
-{
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psrld %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLD,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psrad %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRAD,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("pslld %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLD,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
+    /* a */
+    INVALID_OPCODE_BLOCK
 
-    /* Group 13 with prefix 0x66 */
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psrld %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psrad %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRAD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("pslld %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
+    /* b */
+    INVALID_OPCODE_BLOCK
+
+    /* c */
+    INVALID_OPCODE_BLOCK
+
+    /* d */
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    INVALID_OPCODE,
+    OPVEX("vaeskeygen %Vdq,%Wdq,%Ib",   IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   0,   OP_AESKEYGEN,  OP_PARM_Vdq,   OP_PARM_Wdq,   OP_PARM_Ib,  OP_PARM_NONE,  DISOPTYPE_HARMLESS),
+
+    /* e */
+    INVALID_OPCODE_BLOCK
+
+    /* f */
+    INVALID_OPCODE_BLOCK
 };
 
-/* 0xF 0x73 */
-const DISOPCODE g_aMapX86_Group14[8*2] =
+const DISOPCODE g_aMapThreeBytesVex_F20F3A_F0[1] =
 {
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psrlq %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLQ,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psllq %Pq,%Ib",      IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLQ,  OP_PARM_Pq,         OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-
-    /* Group 14 with prefix 0x66 */
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psrlq %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("psrldq %Wdq,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSRLDQ, OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("psllq %Wdq,%Ib",     IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLD,  OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("pslldq %Wdq,%Ib",    IDX_ParseModRM,     IDX_ParseImmByte,0,          OP_PSLLDQ, OP_PARM_Wdq,        OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OPVEX("rorx %Gy,%Ey,%Ib",    IDX_ParseModRM,    IDX_UseModRM,   IDX_ParseImmByte,   0,   OP_RORX,    OP_PARM_Gy,  OP_PARM_Ey,  OP_PARM_Ib,  OP_PARM_NONE,  DISOPTYPE_HARMLESS),
 };
 
 
-/* 0xF 0xAE */
-const DISOPCODE g_aMapX86_Group15_mem[8] =
+PCDISOPCODE const g_aVexOpcodesMap[3] =
 {
-    OP("fxsave %M",          IDX_ParseModRM,     0,          0,          OP_FXSAVE,  OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("fxrstor %M",         IDX_ParseModRM,     0,          0,          OP_FXRSTOR, OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("ldmxcsr %M",         IDX_ParseModRM,     0,          0,          OP_LDMXCSR, OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("stmxcsr %M",         IDX_ParseModRM,     0,          0,          OP_STMXCSR, OP_PARM_M,          OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    OP("clflush %Mb",        IDX_ParseModRM,     0,          0,          OP_CLFLUSH, OP_PARM_Mb,         OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    &g_aMapTwoBytesVex[0],         // 0fh 2-byte opcodes
+    &g_aMapThreeBytesVex_0F38_F[0],// 0f38h 3-byte opcodes
+    NULL,                          // 0f3ah 3-byte opcodes
 };
 
-/* 0xF 0xAE */
-const DISOPCODE g_aMapX86_Group15_mod11_rm000[8] =
+PCDISOPCODE const g_aVexOpcodesMap_66H[3] =
 {
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    /** @todo mfence + lfence + sfence instructions do not require rm=0,
-     *        they work for any RM value. See bs2-cpu-instr-1.asm for details. */
-    OP("lfence",             IDX_ParseModFence,  0,          0,          OP_LFENCE,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("mfence",             IDX_ParseModFence,  0,          0,          OP_MFENCE,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("sfence",             IDX_ParseModFence,  0,          0,          OP_SFENCE,  OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    &g_aMapTwoBytesVex_66H[0],     // 0fh 2-byte opcodes
+    &g_aMapThreeBytesVex_660F38[0],// 0f38h 3-byte opcodes
+    &g_aMapThreeBytesVex_660F3A[0],// 0f3ah 3-byte opcodes
 };
 
-/* 0xF 0x18 */
-const DISOPCODE g_aMapX86_Group16[8] =
+PCDISOPCODE const g_aVexOpcodesMap_F2H[3] =
 {
-    OP("prefetchnta %Mb",  IDX_ParseModRM, 0,          0,          OP_PREFETCH,OP_PARM_Mb,        OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("prefetcht0 %Mb",   IDX_ParseModRM, 0,          0,          OP_PREFETCH,OP_PARM_Mb,        OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("prefetcht1 %Mb",   IDX_ParseModRM, 0,          0,          OP_PREFETCH,OP_PARM_Mb,        OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("prefetcht2 %Mb",   IDX_ParseModRM, 0,          0,          OP_PREFETCH,OP_PARM_Mb,        OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
-    INVALID_OPCODE_MOD_RM(0x),
+    &g_aMapTwoBytesVex_F2H[0],       // 0fh 2-byte opcodes
+    &g_aMapThreeBytesVex_F20F38_F[0],// 0f38h 3-byte opcodes
+    &g_aMapThreeBytesVex_F20F3A_F0[0],// 0f3ah 3-byte opcodes
 };
 
-/* 0x90 or 0xF3 0x90 */
-const DISOPCODE g_aMapX86_NopPause[2] =
+PCDISOPCODE const g_aVexOpcodesMap_F3H[3] =
 {
-    OP("nop",                0,              0,          0,       OP_NOP,     OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
-    OP("pause",              0,              0,          0,       OP_PAUSE,   OP_PARM_NONE,       OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    &g_aMapTwoBytesVex_F3H[0],       // 0fh 2-byte opcodes
+    &g_aMapThreeBytesVex_F30F38_F[0],// 0f38h 3-byte opcodes
+    NULL,                            // 0f3ah 3-byte opcodes
 };
-
diff --git a/src/VBox/Disassembler/DisasmTablesX64.cpp b/src/VBox/Disassembler/DisasmTablesX64.cpp
index 11a02a2..ade2a0a 100644
--- a/src/VBox/Disassembler/DisasmTablesX64.cpp
+++ b/src/VBox/Disassembler/DisasmTablesX64.cpp
@@ -284,8 +284,8 @@ const DISOPCODE g_aOneByteMapX64[256] =
     OP("Shift Grp2 %Ev,%Ib", IDX_ParseShiftGrp2, 0,                 0,          OP_SHIFT_GRP2,  OP_PARM_Ev,      OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("retn %Iw",           IDX_ParseImmUshort, 0,                 0,          OP_RETN,        OP_PARM_Iw,      OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_UNCOND_CONTROLFLOW | DISOPTYPE_FORCED_64_OP_SIZE),
     OP("retn",               0,                  0,                 0,          OP_RETN,        OP_PARM_NONE,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_CONTROLFLOW | DISOPTYPE_UNCOND_CONTROLFLOW | DISOPTYPE_FORCED_64_OP_SIZE),
-    INVALID_OPCODE,
-    INVALID_OPCODE,
+    OP("VEX 3-byte",         IDX_ParseVex3b,     0,                 0,          OP_VEX3B,       OP_PARM_NONE,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
+    OP("VEX 2-byte",         IDX_ParseVex2b,     0,                 0,          OP_VEX2B,       OP_PARM_NONE,    OP_PARM_NONE,   OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     /* @todo these two are actually group11 */
     OP("mov %Eb,%Ib",        IDX_ParseModRM,     IDX_ParseImmByte,  0,          OP_MOV,         OP_PARM_Eb,      OP_PARM_Ib,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
     OP("mov %Ev,%Iz",        IDX_ParseModRM,     IDX_ParseImmZ,     0,          OP_MOV,         OP_PARM_Ev,      OP_PARM_Iz,     OP_PARM_NONE,   DISOPTYPE_HARMLESS),
diff --git a/src/VBox/Disassembler/Makefile.kmk b/src/VBox/Disassembler/Makefile.kmk
index a3c730f..31f893f 100644
--- a/src/VBox/Disassembler/Makefile.kmk
+++ b/src/VBox/Disassembler/Makefile.kmk
@@ -19,7 +19,7 @@ SUB_DEPTH = ../../..
 include $(KBUILD_PATH)/subheader.kmk
 
 # include the sub-makefile first.
-ifdef VBOX_WITH_TESTCASES
+if defined(VBOX_WITH_TESTCASES) && !defined(VBOX_ONLY_VALIDATIONKIT)
  include $(PATH_SUB_CURRENT)/testcase/Makefile.kmk
 endif
 
@@ -36,38 +36,46 @@ DisasmR3_SOURCES        = \
 	DisasmFormatBytes.cpp \
 	DisasmFormatYasm.cpp
 
-LIBRARIES              += DisasmBldProg
-DisasmBldProg_TEMPLATE  = VBoxBldProg
-DisasmBldProg_EXTENDS   = DisasmR3
+LIBRARIES              += DisasmR3Static
+DisasmR3Static_TEMPLATE = VBoxR3Static
+DisasmR3Static_EXTENDS  = DisasmR3
 
-LIBRARIES              += DisasmCoreR3
-DisasmCoreR3_TEMPLATE   = VBOXR3
-DisasmCoreR3_DEFS       = IN_DIS DIS_CORE_ONLY
-DisasmCoreR3_SOURCES    = \
-	DisasmCore.cpp \
-	DisasmReg.cpp \
-	DisasmTables.cpp \
-	DisasmTablesX64.cpp
+ifndef VBOX_ONLY_VALIDATIONKIT
+
+ LIBRARIES              += DisasmBldProg
+ DisasmBldProg_TEMPLATE  = VBoxBldProg
+ DisasmBldProg_EXTENDS   = DisasmR3
 
-ifdef VBOX_WITH_RAW_MODE
- LIBRARIES              += DisasmRC
- DisasmRC_TEMPLATE       = VBoxRc
- DisasmRC_DEFS           = IN_DIS IN_RT_RC DIS_CORE_ONLY
- DisasmRC_SOURCES        = \
+ LIBRARIES              += DisasmCoreR3
+ DisasmCoreR3_TEMPLATE   = VBOXR3
+ DisasmCoreR3_DEFS       = IN_DIS DIS_CORE_ONLY
+ DisasmCoreR3_SOURCES    = \
  	DisasmCore.cpp \
  	DisasmReg.cpp \
  	DisasmTables.cpp \
  	DisasmTablesX64.cpp
-endif # VBOX_WITH_RAW_MODE
 
-LIBRARIES              += DisasmR0
-DisasmR0_TEMPLATE       = VBoxR0
-DisasmR0_DEFS           = IN_DIS IN_RT_R0 DIS_CORE_ONLY
-DisasmR0_SOURCES        = \
-	DisasmCore.cpp \
-	DisasmReg.cpp \
-	DisasmTables.cpp \
-	DisasmTablesX64.cpp
+ ifdef VBOX_WITH_RAW_MODE
+  LIBRARIES              += DisasmRC
+  DisasmRC_TEMPLATE       = VBoxRc
+  DisasmRC_DEFS           = IN_DIS IN_RT_RC DIS_CORE_ONLY
+  DisasmRC_SOURCES        = \
+  	DisasmCore.cpp \
+  	DisasmReg.cpp \
+  	DisasmTables.cpp \
+  	DisasmTablesX64.cpp
+ endif # VBOX_WITH_RAW_MODE
+
+ LIBRARIES              += DisasmR0
+ DisasmR0_TEMPLATE       = VBoxR0
+ DisasmR0_DEFS           = IN_DIS IN_RT_R0 DIS_CORE_ONLY
+ DisasmR0_SOURCES        = \
+ 	DisasmCore.cpp \
+ 	DisasmReg.cpp \
+ 	DisasmTables.cpp \
+ 	DisasmTablesX64.cpp
+
+endif # !VBOX_ONLY_VALIDATIONKIT
 
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/Disassembler/testcase/tstDisasm-1A.asm b/src/VBox/Disassembler/testcase/tstDisasm-1A.asm
index c4ac578..07edf86 100644
--- a/src/VBox/Disassembler/testcase/tstDisasm-1A.asm
+++ b/src/VBox/Disassembler/testcase/tstDisasm-1A.asm
@@ -50,9 +50,9 @@ BEGINPROC   TestProc32
         DB 0xF0, 0x0F, 0x22, 0xC0
         DB 0xF0, 0x0F, 0x20, 0xC0
         smsw  word [edx+16]
-        ;    invept      eax, qword [ecx]
+        ;    invept      eax, dqword [ecx]
         DB          0x66, 0x0F, 0x38, 0x80, 0x1
-        ;    invept      eax, qword [ecx]
+        ;    invept      eax, dqword [ecx]
         DB          0x66, 0x0F, 0x38, 0x81, 0x1
         mov   eax, dword [ecx]
         mov   word [edi], 0123ah
@@ -147,6 +147,85 @@ BEGINPROC   TestProc32
         cvtpi2pd    xmm0, mm3
         paddd       mm1, mm3
         paddd       xmm1, xmm3
+
+%if __YASM_VERSION_ID__ >= 001030000h ; Old yasm doesn't support the instructions below
+        adcx        eax, ebx
+        adcx        eax, [edi]
+
+        adox        eax, ebx
+        adox        eax, [edi]
+        adox        eax, [edi + 1000h]
+
+        tzcnt      ax, bx
+        tzcnt      eax, ebx
+        tzcnt      ax, [edi]
+        tzcnt      eax, [edi]
+        tzcnt      eax, [edi + 1000h]
+        vpmovsxbw  ymm0, xmm1
+        vpmovzxbq  ymm1, [100h]
+        vgatherqps xmm0,dword [eax+xmm0*2],xmm0
+        vgatherqpd xmm0,qword [eax+xmm0*2],xmm0
+%endif
+
+        movbe       eax, [edi]
+        movbe       ebx, [edi + 1000h]
+        movbe       ax, [edi]
+        movbe       [edi], eax
+
+        crc32       eax, bl
+        crc32       eax, bx
+        crc32       eax, ebx
+        crc32       eax, byte [edi]
+        crc32       eax, word [edi]
+        crc32       eax, dword [edi]
+
+        popcnt      ax, bx
+        popcnt      eax, ebx
+        popcnt      ax, [edi]
+        popcnt      eax, [edi]
+        popcnt      eax, [edi + 1000h]
+
+        lzcnt      ax, bx
+        lzcnt      eax, ebx
+        lzcnt      ax, [edi]
+        lzcnt      eax, [edi]
+        lzcnt      eax, [edi + 1000h]
+
+        vmread     eax, ebx
+        vmwrite    eax, ebx
+
+        movd       mm0, [edi]
+        movq       mm0, [edi]
+        movq       mm0, mm1
+
+        vmovups    xmm0, xmm1
+        vmovaps    ymm0, ymm1
+        vunpcklps  xmm0, xmm1, xmm2
+        vunpcklps  ymm0, ymm1, ymm2
+
+        lddqu      xmm1, [ds:ebp+edi*8+00f000001h]
+        vlddqu     xmm1, [ds:ebp+edi*8+00f000001h]
+        vlddqu      ymm1, [ds:ebp+edi*8+00f000001h]
+
+        vpmovsxbw xmm0,qword [0x100]
+        vbroadcastf128 ymm0,oword [0x100]
+
+        palignr mm0, mm1, 1
+        vpinsrb xmm0, xmm1, eax, 1
+        vpinsrb xmm0, xmm1, [100h], 1
+        vinsertps xmm0, xmm1, xmm2, 1
+        vinsertps xmm0, xmm1, [100h], 1
+
+        vblendvps xmm0, xmm1, xmm2, xmm3
+        vblendvps ymm0, ymm1, ymm2, ymm3
+
+        aesimc xmm0, xmm1
+
+        pmovzxbq xmm0, xmm1
+        pmovzxbq xmm1, [100h]
+
+        vfmaddsub132pd ymm1, ymm2, ymm3
+
 ENDPROC   TestProc32
 
 
@@ -163,13 +242,13 @@ BEGINPROC TestProc64
         mov rax, [0xfffe0080]
         mov rbx, [0xfffe0080]
         divsd xmm1, xmm0
-        ;    invept      rdi, qword [rsi]
+        ;    invept      rdi, dqword [rsi]
         DB          0x66, 0x0F, 0x38, 0x80, 0x3E
-        ;    invept      rcx, qword [rdx]
+        ;    invept      rcx, dqword [rdx]
         DB          0x66, 0x0F, 0x38, 0x80, 0xA
-        ;invvpid     rdi, qword [rsi]
+        ;invvpid     rdi, dqword [rsi]
         DB          0x66, 0x0F, 0x38, 0x81, 0x3E
-        ;    invvpid     rcx, qword [rdx]
+        ;    invvpid     rcx, dqword [rdx]
         DB          0x66, 0x0F, 0x38, 0x81, 0xA
         mov   rdi, [rsi]
         mov   rcx, [rdx]
@@ -233,6 +312,110 @@ BEGINPROC TestProc64
         movss xmm0, xmm14
         movsd xmm6, xmm1
 
+        movbe   eax, [rdi]
+        movbe   ax, [rdi]
+        movbe   rax, [rdi]
+
+        crc32       eax, bl
+        crc32       eax, bx
+        crc32       eax, ebx
+        crc32       eax, byte [edi]
+        crc32       eax, word [edi]
+        crc32       eax, dword [edi]
+
+        crc32       rax, bl
+        crc32       rax, byte [rdi]
+        crc32       rax, qword [rdi]
+
+%if __YASM_VERSION_ID__ >= 001030000h ; Old yasm doesn't support the instructions below
+
+        adcx    eax, ebx
+        adcx    rax, rbx
+        adcx    r8, r11
+        adcx    r8d, edx
+
+        adox    eax, ebx
+        adox    eax, [edi]
+        adox    eax, [edi + 1000h]
+
+        adox    rax, rbx
+        adox    rax, [rdi]
+        adox    rax, [rdi + 1000h]
+        adox    rax, [edi + 1000h]
+
+        tzcnt      ax, bx
+        tzcnt      eax, ebx
+        tzcnt      rax, rbx
+        tzcnt      ax, [edi]
+        tzcnt      eax, [edi]
+        tzcnt      eax, [edi + 1000h]
+
+        vpunpcklbw ymm1, ymm2, ymm3
+        vpmovsxbw  ymm4,[0x100]
+        vgatherqpd xmm0,qword [rbx+xmm11*2],xmm2
+%endif
+
+        popcnt      ax, bx
+        popcnt      eax, ebx
+        popcnt      rax, rbx
+        popcnt      ax, [edi]
+        popcnt      eax, [edi]
+        popcnt      eax, [edi + 1000h]
+        popcnt      rax, [rdi + 1000h]
+
+        lzcnt      ax, bx
+        lzcnt      eax, ebx
+        lzcnt      rax, rbx
+        lzcnt      ax, [edi]
+        lzcnt      eax, [edi]
+        lzcnt      eax, [edi + 1000h]
+        lzcnt      eax, [rdi]
+        lzcnt      ax, [rdi]
+        lzcnt      rax, [rdi]
+        lzcnt      r8d, [rdi]
+
+        vmread     rax, rbx
+        vmwrite    rax, rbx
+
+        getsec
+
+        movd       mm0, [rdi]
+        movq       mm0, [edi]
+        movq       mm0, mm1
+
+        vmovups    xmm0, xmm1
+        vmovaps    ymm0, ymm1
+        vunpcklps  xmm0, xmm1, xmm2
+        vunpcklps  ymm0, ymm1, ymm2
+        vunpcklps  ymm0, ymm10, ymm2
+
+        vmovups    xmm5, xmm9
+
+        vcmpps     xmm1, xmm2, xmm3, 12
+
+        lddqu      xmm1, [ebp+edi*8+00f000001h]
+        vlddqu     xmm1, [rbp+rdi*8+00f000001h]
+        vlddqu     ymm1, [rbp+rdi*8+00f000001h]
+
+        vbroadcastf128 ymm0,oword [0x100]
+        vmovlps   xmm0, xmm1, [100h]
+        vmovlps   xmm0, xmm1, [eax + ebx]
+        vmovlps   xmm0, xmm1, [rax + rbx]
+        vmovlps   xmm10, xmm1, [rax]
+
+        vblendvpd xmm0, xmm1, [100h], xmm3
+
+        dpps xmm0, xmm1, 1
+
+        extractps eax, xmm2, 3
+        vzeroupper
+        vzeroall
+
+        movlps xmm0, [100h]
+        movlps xmm0, [eax + ebx]
+        movlps xmm10, [rax + rbx]
+        movhlps xmm0, xmm1
+
         ret
 ENDPROC   TestProc64
 %endif ; !OS2
diff --git a/src/VBox/ExtPacks/Makefile.kmk b/src/VBox/ExtPacks/Makefile.kmk
index 7f3263c..ab5b797 100644
--- a/src/VBox/ExtPacks/Makefile.kmk
+++ b/src/VBox/ExtPacks/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2010-2012 Oracle Corporation
+# Copyright (C) 2010-2016 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -21,6 +21,9 @@ include $(KBUILD_PATH)/subheader.kmk
 ifdef VBOX_WITH_EXTPACK_PUEL_BUILD
  include $(PATH_SUB_CURRENT)/Puel/Makefile.kmk
 endif
+if defined(VBOX_WITH_EXTPACK_VBOXDTRACE) || defined(VBOX_WITH_DTRACE)
+ include $(PATH_SUB_CURRENT)/VBoxDTrace/Makefile.kmk
+endif
 ifdef VBOX_WITH_EXTPACK_VNC
  include $(PATH_SUB_CURRENT)/VNC/Makefile.kmk
 endif
diff --git a/src/VBox/ExtPacks/VBoxDTrace/CDDL-ONLY b/src/VBox/ExtPacks/VBoxDTrace/CDDL-ONLY
new file mode 100644
index 0000000..b36dbc6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/CDDL-ONLY
@@ -0,0 +1,2 @@
+The ExtPacks/VBoxDTrace sources are only licensed under the Common Development
+and Distribution License, Version 1.0 (CDDL), see ExtPacks/COPYING for details.
diff --git a/src/VBox/ExtPacks/VBoxDTrace/COPYING b/src/VBox/ExtPacks/VBoxDTrace/COPYING
new file mode 100644
index 0000000..11f7108
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/COPYING
@@ -0,0 +1,378 @@
+The ExtPacks/VBoxDTrace sources are licensed under the Common Development
+and Distribution License, Version 1.0 (CDDL), as shown below.
+
+---
+
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0
+
+1. Definitions.
+
+    1.1. "Contributor" means each individual or entity that creates
+         or contributes to the creation of Modifications.
+
+    1.2. "Contributor Version" means the combination of the Original
+         Software, prior Modifications used by a Contributor (if any),
+         and the Modifications made by that particular Contributor.
+
+    1.3. "Covered Software" means (a) the Original Software, or (b)
+         Modifications, or (c) the combination of files containing
+         Original Software with files containing Modifications, in
+         each case including portions thereof.
+
+    1.4. "Executable" means the Covered Software in any form other
+         than Source Code.
+
+    1.5. "Initial Developer" means the individual or entity that first
+         makes Original Software available under this License.
+
+    1.6. "Larger Work" means a work which combines Covered Software or
+         portions thereof with code not governed by the terms of this
+         License.
+
+    1.7. "License" means this document.
+
+    1.8. "Licensable" means having the right to grant, to the maximum
+         extent possible, whether at the time of the initial grant or
+         subsequently acquired, any and all of the rights conveyed
+         herein.
+
+    1.9. "Modifications" means the Source Code and Executable form of
+         any of the following:
+
+        A. Any file that results from an addition to, deletion from or
+           modification of the contents of a file containing Original
+           Software or previous Modifications;
+
+        B. Any new file that contains any part of the Original
+           Software or previous Modifications; or
+
+        C. Any new file that is contributed or otherwise made
+           available under the terms of this License.
+
+    1.10. "Original Software" means the Source Code and Executable
+          form of computer software code that is originally released
+          under this License.
+
+    1.11. "Patent Claims" means any patent claim(s), now owned or
+          hereafter acquired, including without limitation, method,
+          process, and apparatus claims, in any patent Licensable by
+          grantor.
+
+    1.12. "Source Code" means (a) the common form of computer software
+          code in which modifications are made and (b) associated
+          documentation included in or with such code.
+
+    1.13. "You" (or "Your") means an individual or a legal entity
+          exercising rights under, and complying with all of the terms
+          of, this License.  For legal entities, "You" includes any
+          entity which controls, is controlled by, or is under common
+          control with You.  For purposes of this definition,
+          "control" means (a) the power, direct or indirect, to cause
+          the direction or management of such entity, whether by
+          contract or otherwise, or (b) ownership of more than fifty
+          percent (50%) of the outstanding shares or beneficial
+          ownership of such entity.
+
+2. License Grants.
+
+    2.1. The Initial Developer Grant.
+
+    Conditioned upon Your compliance with Section 3.1 below and
+    subject to third party intellectual property claims, the Initial
+    Developer hereby grants You a world-wide, royalty-free,
+    non-exclusive license:
+
+        (a) under intellectual property rights (other than patent or
+            trademark) Licensable by Initial Developer, to use,
+            reproduce, modify, display, perform, sublicense and
+            distribute the Original Software (or portions thereof),
+            with or without Modifications, and/or as part of a Larger
+            Work; and
+
+        (b) under Patent Claims infringed by the making, using or
+            selling of Original Software, to make, have made, use,
+            practice, sell, and offer for sale, and/or otherwise
+            dispose of the Original Software (or portions thereof).
+
+        (c) The licenses granted in Sections 2.1(a) and (b) are
+            effective on the date Initial Developer first distributes
+            or otherwise makes the Original Software available to a
+            third party under the terms of this License.
+
+        (d) Notwithstanding Section 2.1(b) above, no patent license is
+            granted: (1) for code that You delete from the Original
+            Software, or (2) for infringements caused by: (i) the
+            modification of the Original Software, or (ii) the
+            combination of the Original Software with other software
+            or devices.
+
+    2.2. Contributor Grant.
+
+    Conditioned upon Your compliance with Section 3.1 below and
+    subject to third party intellectual property claims, each
+    Contributor hereby grants You a world-wide, royalty-free,
+    non-exclusive license:
+
+        (a) under intellectual property rights (other than patent or
+            trademark) Licensable by Contributor to use, reproduce,
+            modify, display, perform, sublicense and distribute the
+            Modifications created by such Contributor (or portions
+            thereof), either on an unmodified basis, with other
+            Modifications, as Covered Software and/or as part of a
+            Larger Work; and
+
+        (b) under Patent Claims infringed by the making, using, or
+            selling of Modifications made by that Contributor either
+            alone and/or in combination with its Contributor Version
+            (or portions of such combination), to make, use, sell,
+            offer for sale, have made, and/or otherwise dispose of:
+            (1) Modifications made by that Contributor (or portions
+            thereof); and (2) the combination of Modifications made by
+            that Contributor with its Contributor Version (or portions
+            of such combination).
+
+        (c) The licenses granted in Sections 2.2(a) and 2.2(b) are
+            effective on the date Contributor first distributes or
+            otherwise makes the Modifications available to a third
+            party.
+
+        (d) Notwithstanding Section 2.2(b) above, no patent license is
+            granted: (1) for any code that Contributor has deleted
+            from the Contributor Version; (2) for infringements caused
+            by: (i) third party modifications of Contributor Version,
+            or (ii) the combination of Modifications made by that
+            Contributor with other software (except as part of the
+            Contributor Version) or other devices; or (3) under Patent
+            Claims infringed by Covered Software in the absence of
+            Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+    3.1. Availability of Source Code.
+
+    Any Covered Software that You distribute or otherwise make
+    available in Executable form must also be made available in Source
+    Code form and that Source Code form must be distributed only under
+    the terms of this License.  You must include a copy of this
+    License with every copy of the Source Code form of the Covered
+    Software You distribute or otherwise make available.  You must
+    inform recipients of any such Covered Software in Executable form
+    as to how they can obtain such Covered Software in Source Code
+    form in a reasonable manner on or through a medium customarily
+    used for software exchange.
+
+    3.2. Modifications.
+
+    The Modifications that You create or to which You contribute are
+    governed by the terms of this License.  You represent that You
+    believe Your Modifications are Your original creation(s) and/or
+    You have sufficient rights to grant the rights conveyed by this
+    License.
+
+    3.3. Required Notices.
+
+    You must include a notice in each of Your Modifications that
+    identifies You as the Contributor of the Modification.  You may
+    not remove or alter any copyright, patent or trademark notices
+    contained within the Covered Software, or any notices of licensing
+    or any descriptive text giving attribution to any Contributor or
+    the Initial Developer.
+
+    3.4. Application of Additional Terms.
+
+    You may not offer or impose any terms on any Covered Software in
+    Source Code form that alters or restricts the applicable version
+    of this License or the recipients' rights hereunder.  You may
+    choose to offer, and to charge a fee for, warranty, support,
+    indemnity or liability obligations to one or more recipients of
+    Covered Software.  However, you may do so only on Your own behalf,
+    and not on behalf of the Initial Developer or any Contributor.
+    You must make it absolutely clear that any such warranty, support,
+    indemnity or liability obligation is offered by You alone, and You
+    hereby agree to indemnify the Initial Developer and every
+    Contributor for any liability incurred by the Initial Developer or
+    such Contributor as a result of warranty, support, indemnity or
+    liability terms You offer.
+
+    3.5. Distribution of Executable Versions.
+
+    You may distribute the Executable form of the Covered Software
+    under the terms of this License or under the terms of a license of
+    Your choice, which may contain terms different from this License,
+    provided that You are in compliance with the terms of this License
+    and that the license for the Executable form does not attempt to
+    limit or alter the recipient's rights in the Source Code form from
+    the rights set forth in this License.  If You distribute the
+    Covered Software in Executable form under a different license, You
+    must make it absolutely clear that any terms which differ from
+    this License are offered by You alone, not by the Initial
+    Developer or Contributor.  You hereby agree to indemnify the
+    Initial Developer and every Contributor for any liability incurred
+    by the Initial Developer or such Contributor as a result of any
+    such terms You offer.
+
+    3.6. Larger Works.
+
+    You may create a Larger Work by combining Covered Software with
+    other code not governed by the terms of this License and
+    distribute the Larger Work as a single product.  In such a case,
+    You must make sure the requirements of this License are fulfilled
+    for the Covered Software.
+
+4. Versions of the License.
+
+    4.1. New Versions.
+
+    Sun Microsystems, Inc. is the initial license steward and may
+    publish revised and/or new versions of this License from time to
+    time.  Each version will be given a distinguishing version number.
+    Except as provided in Section 4.3, no one other than the license
+    steward has the right to modify this License.
+
+    4.2. Effect of New Versions.
+
+    You may always continue to use, distribute or otherwise make the
+    Covered Software available under the terms of the version of the
+    License under which You originally received the Covered Software.
+    If the Initial Developer includes a notice in the Original
+    Software prohibiting it from being distributed or otherwise made
+    available under any subsequent version of the License, You must
+    distribute and make the Covered Software available under the terms
+    of the version of the License under which You originally received
+    the Covered Software.  Otherwise, You may also choose to use,
+    distribute or otherwise make the Covered Software available under
+    the terms of any subsequent version of the License published by
+    the license steward.
+
+    4.3. Modified Versions.
+
+    When You are an Initial Developer and You want to create a new
+    license for Your Original Software, You may create and use a
+    modified version of this License if You: (a) rename the license
+    and remove any references to the name of the license steward
+    (except to note that the license differs from this License); and
+    (b) otherwise make it clear that the license contains terms which
+    differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+    COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+    BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+    INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+    SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+    PURPOSE OR NON-INFRINGING.  THE ENTIRE RISK AS TO THE QUALITY AND
+    PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU.  SHOULD ANY
+    COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+    INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY
+    NECESSARY SERVICING, REPAIR OR CORRECTION.  THIS DISCLAIMER OF
+    WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.  NO USE OF
+    ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+    DISCLAIMER.
+
+6. TERMINATION.
+
+    6.1. This License and the rights granted hereunder will terminate
+    automatically if You fail to comply with terms herein and fail to
+    cure such breach within 30 days of becoming aware of the breach.
+    Provisions which, by their nature, must remain in effect beyond
+    the termination of this License shall survive.
+
+    6.2. If You assert a patent infringement claim (excluding
+    declaratory judgment actions) against Initial Developer or a
+    Contributor (the Initial Developer or Contributor against whom You
+    assert such claim is referred to as "Participant") alleging that
+    the Participant Software (meaning the Contributor Version where
+    the Participant is a Contributor or the Original Software where
+    the Participant is the Initial Developer) directly or indirectly
+    infringes any patent, then any and all rights granted directly or
+    indirectly to You by such Participant, the Initial Developer (if
+    the Initial Developer is not the Participant) and all Contributors
+    under Sections 2.1 and/or 2.2 of this License shall, upon 60 days
+    notice from Participant terminate prospectively and automatically
+    at the expiration of such 60 day notice period, unless if within
+    such 60 day period You withdraw Your claim with respect to the
+    Participant Software against such Participant either unilaterally
+    or pursuant to a written agreement with Participant.
+
+    6.3. In the event of termination under Sections 6.1 or 6.2 above,
+    all end user licenses that have been validly granted by You or any
+    distributor hereunder prior to termination (excluding licenses
+    granted to You by any distributor) shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+    UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+    (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+    INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+    COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+    LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+    CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+    LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+    STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+    COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+    INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.  THIS LIMITATION OF
+    LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+    INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+    APPLICABLE LAW PROHIBITS SUCH LIMITATION.  SOME JURISDICTIONS DO
+    NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+    CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+    APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+    The Covered Software is a "commercial item," as that term is
+    defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+    computer software" (as that term is defined at 48
+    C.F.R. 252.227-7014(a)(1)) and "commercial computer software
+    documentation" as such terms are used in 48 C.F.R. 12.212
+    (Sept. 1995).  Consistent with 48 C.F.R. 12.212 and 48
+    C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all
+    U.S. Government End Users acquire Covered Software with only those
+    rights set forth herein.  This U.S. Government Rights clause is in
+    lieu of, and supersedes, any other FAR, DFAR, or other clause or
+    provision that addresses Government rights in computer software
+    under this License.
+
+9. MISCELLANEOUS.
+
+    This License represents the complete agreement concerning subject
+    matter hereof.  If any provision of this License is held to be
+    unenforceable, such provision shall be reformed only to the extent
+    necessary to make it enforceable.  This License shall be governed
+    by the law of the jurisdiction specified in a notice contained
+    within the Original Software (except to the extent applicable law,
+    if any, provides otherwise), excluding such jurisdiction's
+    conflict-of-law provisions.  Any litigation relating to this
+    License shall be subject to the jurisdiction of the courts located
+    in the jurisdiction and venue specified in a notice contained
+    within the Original Software, with the losing party responsible
+    for costs, including, without limitation, court costs and
+    reasonable attorneys' fees and expenses.  The application of the
+    United Nations Convention on Contracts for the International Sale
+    of Goods is expressly excluded.  Any law or regulation which
+    provides that the language of a contract shall be construed
+    against the drafter shall not apply to this License.  You agree
+    that You alone are responsible for compliance with the United
+    States export administration regulations (and the export control
+    laws and regulation of any other countries) when You use,
+    distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+    As between Initial Developer and the Contributors, each party is
+    responsible for claims and damages arising, directly or
+    indirectly, out of its utilization of rights under this License
+    and You agree to work with Initial Developer and Contributors to
+    distribute such responsibility on an equitable basis.  Nothing
+    herein is intended or shall be deemed to constitute any admission
+    of liability.
+
+--------------------------------------------------------------------
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+For Covered Software in this distribution, this License shall be
+governed by the laws of Germany. Legal venue shall be Stuttgart,
+Germany.
diff --git a/src/VBox/ExtPacks/VBoxDTrace/ExtPack.xml b/src/VBox/ExtPacks/VBoxDTrace/ExtPack.xml
new file mode 100644
index 0000000..178a534
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/ExtPack.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<VirtualBoxExtensionPack xmlns="http://www.virtualbox.org/VirtualBoxExtensionPack" version="1.0">
+    <Name>Oracle VBoxDTrace Extension Pack</Name>
+    <Description>Experimental and unsupported extension pack providing DTrace features to VirtualBox.</Description>
+    <Version revision="@VBOX_SVN_REV@">@VBOX_VERSION_STRING@</Version>
+    <MainModule>VBoxDTraceMain</MainModule>
+</VirtualBoxExtensionPack>
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk b/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk
new file mode 100644
index 0000000..972a0f5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/Makefile.kmk
@@ -0,0 +1,349 @@
+# $Id: Makefile.kmk $
+## @file
+# Sub-makefile for VBoxDTrace.
+#
+# Contributed by: bird
+#
+
+#
+# Copyright (C) 2012-2015 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the Common
+# Development and Distribution License Version 1.0 (CDDL) only, as it
+# comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution.
+# VirtualBox OSE is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY of any kind.
+#
+
+SUB_DEPTH = ../../../../
+include $(KBUILD_PATH)/subheader.kmk
+
+
+#
+# Globals.
+#
+VBOX_EXTPACK_VBOXDTRACE_NAME         := Oracle VBoxDTrace Extension Pack
+VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME := Oracle_VBoxDTrace_Extension_Pack
+VBOX_PATH_EXTPACK_VBOXDTRACE = $(PATH_STAGE)/$(INST_EXTPACK)$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)
+INST_EXTPACK_VBOXDTRACE = $(INST_EXTPACK)$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/
+
+VBOXDT_PATH                := $(PATH_ROOT)/src/VBox/ExtPacks/VBoxDTrace
+VBOXDT_PATH_ONNV           := $(VBOXDT_PATH)/onnv
+VBOXDT_PATH_UTS            := $(VBOXDT_PATH_ONNV)/uts
+VBOXDT_PATH_CMD            := $(VBOXDT_PATH_ONNV)/cmd
+VBOXDT_PATH_LIBCTF         := $(VBOXDT_PATH_ONNV)/lib/libctf
+VBOXDT_PATH_CMN_CTF        := $(VBOXDT_PATH_ONNV)/common/ctf
+VBOXDT_PATH_LIBDTRACE      := $(VBOXDT_PATH_ONNV)/lib/libdtrace
+VBOXDT_PATH_CMN_DTRACE     := $(VBOXDT_PATH_ONNV)/common/dtrace
+
+
+ifndef VBOX_ONLY_EXTPACKS
+ #
+ # The generic wrapper that selects native or extpack dtrace cmd and adds our
+ # library path to the command line.
+ #
+ # Note! This is not installed as part of the extension pack, but always shipped
+ #       with the base VBox installation.
+ #
+ PROGRAMS += VBoxDTrace
+ VBoxDTrace_TEMPLATE := VBOXR3EXE
+ VBoxDTrace_SOURCES := VBoxDTraceWrapper.cpp
+ VBoxDTrace_LIBS = $(LIB_RUNTIME)
+ $(call VBOX_SET_VER_INFO_DLL,VBoxDTrace,VirtualBox DTrace Chooser)
+endif
+
+
+if defined(VBOX_WITH_EXTPACK_VBOXDTRACE) && defined(VBOX_WITH_EXTPACK)
+
+ #
+ # Extend the extension pack templates.
+ #
+ TEMPLATE_VBoxR3ExtPackDTrace = For the ring-3 context modules in the VBoxDTrace extension pack.
+ TEMPLATE_VBoxR3ExtPackDTrace_EXTENDS = VBoxR3ExtPack
+ TEMPLATE_VBoxR3ExtPackDTrace_INST = $(INST_EXTPACK_VBOXDTRACE)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
+ TEMPLATE_VBoxR3ExtPackDTrace_DEFS = $(TEMPLATE_VBoxR3ExtPack_DEFS) VBOX_IN_DTRACE_EXTPACK
+
+ TEMPLATE_VBoxR0ExtPackDTrace = For the ring-0 context modules in the VBoxDTrace extension pack.
+ TEMPLATE_VBoxR0ExtPackDTrace_EXTENDS = VBoxR0ExtPack
+ TEMPLATE_VBoxR0ExtPackDTrace_INST = $(INST_EXTPACK_VBOXDTRACE)$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
+ TEMPLATE_VBoxR0ExtPackDTrace_DEFS = $(TEMPLATE_VBoxR0ExtPack_DEFS) VBOX_IN_DTRACE_EXTPACK
+
+ TEMPLATE_VBoxInsExtPackDTrace = For the install targets for the VBoxDTrace extension pack.
+ TEMPLATE_VBoxInsExtPackDTrace_EXTENDS = VBoxR0ExtPack
+ TEMPLATE_VBoxInsExtPackDTrace_INST = $(INST_EXTPACK_VBOXDTRACE)
+
+
+ #
+ # Install the description.
+ #
+ INSTALLS += VBoxDTraceIns
+ VBoxDTraceIns_TEMPLATE = VBoxInsExtPackDTrace
+ VBoxDTraceIns_SOURCES = \
+ 	$(VBoxDTraceIns_0_OUTDIR)/ExtPack.xml \
+ 	COPYING=>ExtPack-SourceCodeLicense.txt
+ $(call VBOX_EDIT_VERSION_RULE_FN,VBoxDTraceIns,ExtPack.xml)
+
+
+ #
+ # VBoxDTraceMain - The module which the VirtualBox Main API talks to.
+ #
+ DLLS += VBoxDTraceMain
+ VBoxDTraceMain_TEMPLATE = VBoxR3ExtPackDTrace
+ VBoxDTraceMain_SOURCES = VBoxDTraceMain.cpp
+ $(call VBOX_SET_VER_INFO_DLL,VBoxDTraceMain,VBoxDTrace Main module)
+
+
+ #
+ # The ring-3 VBoxDTrace command implementation (library).
+ #
+ ifneq ($(KBUILD_TARGET),solaris) # Temporarily disabled on Solaris (not really needed)...
+ DLLS += VBoxDTraceCmd
+ VBoxDTraceCmd_TEMPLATE = VBoxR3ExtPackDTrace
+ VBoxDTraceCmd_DEFS = RTMEM_WRAP_TO_EF_APIS
+ #VBoxDTraceCmd_DEFS += YYDEBUG
+ VBoxDTraceCmd_DEFS.linux = _XOPEN_SOURCE=700
+ VBoxDTraceCmd_SDKS = VBOX_ZLIB
+ ifn1of ($(KBUILD_TARGET), win)
+  VBoxDTraceCmd_CFLAGS = -Wno-format $(VBOX_GCC_Wno-overlength-strings) -Wno-sign-compare -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-shadow
+ endif
+ VBoxDTraceCmd_INCS = \
+ 	include \
+ 	$(VBOXDT_PATH_UTS)/common \
+ 	$(VBOXDT_PATH_LIBCTF)/common \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common \
+ 	$(VBOXDT_PATH_CMN_CTF)
+ VBoxDTraceCmd_SOURCES = \
+ 	$(VBOXDT_PATH_CMD)/dtrace/dtrace.c \
+ 	\
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_as.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_aggregate.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_buf.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_cc.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_cg.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_consume.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_decl.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_dis.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_dof.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_error.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_handle.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_ident.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_inttab.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_list.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_map.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_module.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_program.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_open.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_options.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_parser.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pcb.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pragma.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_printf.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_proc.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_provider.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_regset.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_string.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_strtab.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_subr.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_work.c \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_xlator.c \
+ 	\
+ 	$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c \
+ 	$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c \
+ 	\
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_create.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_error.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_decl.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_hash.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_labels.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_lookup.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_open.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_types.c \
+ 	$(VBOXDT_PATH_CMN_CTF)/ctf_util.c \
+ 	\
+ 	$(VBOXDT_PATH_LIBCTF)/common/ctf_subr.c \
+ 	$(VBOXDT_PATH_LIBCTF)/common/ctf_lib.c
+
+ # Source not used or wanted:
+ #	$(VBOXDT_PATH_LIBDTRACE)/common/dt_link.c
+ #	$(VBOXDT_PATH_LIBDTRACE)/common/dt_pid.c
+
+ # Generate sources
+ $$(VBoxDTraceCmd_0_OUTDIR)/dt_errtags.c: \
+ 		$(VBOXDT_PATH_LIBDTRACE)/common/dt_errtags.h \
+ 		$(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed \
+ 		| $$(dir $$@)
+	$(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
+	$(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mkerrtags.sed --output $@ $<
+
+ $$(VBoxDTraceCmd_0_OUTDIR)/dt_names.c: \
+ 		$(VBOXDT_PATH_UTS)/common/sys/dtrace.h \
+ 		$(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed \
+ 		| $$(dir $$@)
+	$(MSG_GENERATE,VBoxDTraceCmd,$@,$<)
+	$(SED) -n -f $(VBOXDT_PATH_LIBDTRACE)/common/mknames.sed --output $@ $<
+
+ ifdef VBOX_HAVE_BISON
+  USES                   += yacc
+  VBoxDTraceCmd_USES     += yacc
+  VBoxDTraceCmd_YACCTOOL  = BISON
+  VBoxDTraceCmd_YACCFLAGS = -d -y
+  VBoxDTraceCmd_SOURCES  += \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_grammar.y
+  VBoxDTraceCmd_INCS     += $(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common
+ else
+  VBoxDTraceCmd_SOURCES  += \
+ 	$(VBOXDT_PATH)/generated/dt_grammar.c
+  VBoxDTraceCmd_INCS     += \
+ 	$(VBOXDT_PATH)/generated/
+ endif
+
+ ifdef VBOX_HAVE_FLEX
+  USES                   += lex
+  VBoxDTraceCmd_USES     += lex
+  VBoxDTraceCmd_LEXTOOL   = FLEX
+  VBoxDTraceCmd_LEXFLAGS  = -l -B #-d -T
+  VBoxDTraceCmd_SOURCES  += \
+ 	$(VBOXDT_PATH_LIBDTRACE)/common/dt_lex.l
+ else
+  VBoxDTraceCmd_SOURCES  += \
+ 	$(VBOXDT_PATH)/generated/dt_lex.c
+ endif
+ VBoxDTraceCmd_DEFS      += USING_FLEX
+ $(call VBOX_SET_VER_INFO_DLL,VBoxDTraceCmd,VBoxDTrace Command Implementation)
+
+ #
+ # Updates the sources generated by flex and biosn.
+ # The SED processing removes the paths the from #line statements.
+ #
+ vboxdtrace-update-generated-sources: \
+ 		$$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.c \
+ 		$$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.h \
+ 		$$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.c
+	$(foreach file,dt_grammar.c dt_grammar.h dt_lex.c \
+		,$(NLTAB)$(SED)  -e 's,$(VBOXDT_PATH_LIBDTRACE)/common/,,g'\
+ 		-e 's,$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/,,g' \
+ 		--output $(VBOXDT_PATH)/generated/$(file) \
+ 		$(VBoxDTraceCmd_0_OUTDIR)/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/$(file))
+ endif # Temporarily disabled on Solaris.
+
+ #
+ # The ring-0 part of VBoxDTrace.
+ #
+ ifneq ($(KBUILD_TARGET),solaris) # disabled on solaris - neiter needed nor currently able to build it here.
+  SYSMODS += VBoxDTraceR0
+ endif
+ VBoxDTraceR0_TEMPLATE = VBoxR0ExtPackDTrace
+ VBoxDTraceR0_DEFS = IN_VBOXDTRACE_R0 IN_RT_R0
+ ifeq ($(VBOX_LDR_FMT),elf)
+  VBoxDTraceR0_LDFLAGS = -e ModuleInit
+ endif
+ VBoxDTraceR0_INCS = \
+ 	include \
+ 	$(VBOXDT_PATH_UTS)/common
+ VBoxDTraceR0_SOURCES = \
+ 	VBoxDTraceR0.cpp \
+ 	VBoxDTraceR0A.asm \
+ 	$(VBOXDT_PATH_UTS)/common/dtrace/dtrace.c
+ VBoxDTraceR0_LIBS = \
+ 	$(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
+ ifneq ($(filter pe lx,$(VBOX_LDR_FMT)),)
+  VBoxDTraceR0_LIBS += \
+  	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
+ endif
+ $(call VBOX_SET_VER_INFO_R0,VBoxDTraceR0,VBoxDTrace Core (ring-0))
+
+
+ #
+ # Packing.
+ #
+ ifndef VBOX_WITHOUT_EXTPACK_VBOXDTRACE_PACKING
+  PACKING += $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack
+ endif
+
+ ifndef VBOX_WITH_EXTPACK_OS_ARCHS
+  ifeq ($(USER),bird) # for now
+   VBOX_WITH_EXTPACK_OS_ARCHS = $(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
+  endif
+ endif
+
+ # Build the file list.  The macro takes 1=darwin.x86, 2=dist/VirtualBox.app/Contents/MacOS, 3=dylib
+ VBOX_VBOXDTRACE_FILES_MACRO = \
+ 	$(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceMain.$(3)=>$(1)/VBoxDTraceMain.$(3) \
+       $(if $(intersects $1, solaris.x86 solaris.amd64),, \
+ 	 $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceCmd.$(3)=>$(1)/VBoxDTraceCmd.$(3) \
+ 	 $(PATH_OUT_BASE)/$(1)/$(KBUILD_TYPE)/$(2)/ExtensionPacks/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)/$(1)/VBoxDTraceR0.r0=>$(1)/VBoxDTraceR0.r0 \
+       )
+
+ VBOX_VBOXDTRACE_FILES := \
+ 	$(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack.xml=>ExtPack.xml \
+ 	$(VBOX_PATH_EXTPACK_VBOXDTRACE)/ExtPack-SourceCodeLicense.txt=>ExtPack-SourceCodeLicense.txt
+
+ if1of (darwin.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.amd64,dist/VirtualBox.app/Contents/MacOS,dylib)
+ endif
+ if1of (darwin.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,darwin.x86,dist/VirtualBox.app/Contents/MacOS,dylib)
+ endif
+ if1of (freebsd.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.amd64,bin,so)
+ endif
+ if1of (freebsd.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,freebsd.x86,bin,so)
+ endif
+ if1of (linux.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.amd64,bin,so)
+ endif
+ if1of (linux.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,linux.x86,bin,so)
+ endif
+ if1of (os2.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,os2.x86,bin,so)
+ endif
+ if1of (solaris.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.amd64,bin,so)
+ endif
+ if1of (solaris.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,solaris.x86,bin,so)
+ endif
+ if1of (win.amd64, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.amd64,bin,dll)
+ endif
+ if1of (win.x86, $(VBOX_WITH_EXTPACK_OS_ARCHS))
+  VBOX_VBOXDTRACE_FILES += $(call VBOX_VBOXDTRACE_FILES_MACRO,win.x86,bin,dll)
+ endif
+
+ # Pack it all up using a temporary staging directory.
+ $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-$(VBOX_VERSION_STRING)r$(VBOX_SVN_REV).vbox-extpack: \
+ 		$$(foreach file, $$(VBOX_VBOXDTRACE_FILES), $$(firstword $$(subst =>,$$(SP),$$(file)))) \
+ 		| $(VBOX_PATH_PACKAGES)/
+	$(RM) -f $(wildcard $(VBOX_PATH_PACKAGES)/$(VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME)-*.vbox-extpack) \
+		$(VBoxDTraceIns_0_OUTDIR)/ExtPack.manifest \
+		$(VBoxDTraceIns_0_OUTDIR)/ExtPack.signature
+ # Stage all the files
+	$(RM) -Rf $(VBoxDTraceIns_0_OUTDIR)/Stage/
+	$(foreach file, $(VBOX_VBOXDTRACE_FILES),\
+		$(NLTAB)$(MKDIR) -p $(dir $(lastword $(subst =>,$(SP)$(VBoxDTraceIns_0_OUTDIR)/Stage/,$(file)))) \
+		$(NLTAB)$(CP) $(subst =>,$(SP)$(VBoxDTraceIns_0_OUTDIR)/Stage/,$(file)) )
+ # Create the manifest
+	$(VBOX_RTMANIFEST) \
+		--manifest $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.manifest \
+		--chdir $(VBoxDTraceIns_0_OUTDIR)/Stage/ \
+		$(foreach file, $(VBOX_VBOXDTRACE_FILES), $(lastword $(subst =>,$(SP),$(file))))
+	$(APPEND) $(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.signature "todo"
+	$(CHMOD) a+r \
+		$(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.manifest \
+		$(VBoxDTraceIns_0_OUTDIR)/Stage/ExtPack.signature
+ # Tar it up.
+	tar -cvf - -C $(VBoxDTraceIns_0_OUTDIR)/Stage/ . | gzip -9c > $@
+ # Clean up
+	$(RM) -Rf $(VBoxDTraceIns_0_OUTDIR)/Stage/
+
+ BLDDIRS += $(VBOX_PATH_PACKAGES)/
+
+endif # VBOX_WITH_EXTPACK_VBOXDTRACE
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/Samples/Hello.d b/src/VBox/ExtPacks/VBoxDTrace/Samples/Hello.d
new file mode 100644
index 0000000..345f9f8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/Samples/Hello.d
@@ -0,0 +1,13 @@
+/* $Id: Hello.d $ */
+/** @file
+ * VBoxDTrace - Hello world sample.
+ */
+
+
+/* This works by matching the dtrace:::BEGIN probe, printing the greeting and
+   then quitting immediately. */
+BEGIN {
+    trace("Hello VBox World!");
+    exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceMain.cpp b/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceMain.cpp
new file mode 100644
index 0000000..a83bdb9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceMain.cpp
@@ -0,0 +1,137 @@
+/* $Id: VBoxDTraceMain.cpp $ */
+/** @file
+ * VBoxDTrace main module.
+ */
+
+/*
+ * Copyright (C) 2010-2016 Oracle Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/ExtPack/ExtPack.h>
+
+#include <VBox/err.h>
+#include <VBox/version.h>
+#include <VBox/vmm/cfgm.h>
+#include <iprt/string.h>
+#include <iprt/param.h>
+#include <iprt/path.h>
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** Pointer to the extension pack helpers. */
+static PCVBOXEXTPACKHLP g_pHlp;
+
+
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnInstalled}
+//  */
+// static DECLCALLBACK(void) vboxSkeletonExtPack_Installed(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnUninstall}
+//  */
+// static DECLCALLBACK(int)  vboxSkeletonExtPack_Uninstall(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
+//
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnVirtualBoxReady}
+//  */
+// static DECLCALLBACK(void)  vboxSkeletonExtPack_VirtualBoxReady(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox);
+//
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnUnload}
+//  */
+// static DECLCALLBACK(void) vboxSkeletonExtPack_Unload(PCVBOXEXTPACKREG pThis);
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnVMCreated}
+//  */
+// static DECLCALLBACK(int)  vboxSkeletonExtPack_VMCreated(PCVBOXEXTPACKREG pThis, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, IMachine *pMachine);
+//
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnVMConfigureVMM}
+//  */
+// static DECLCALLBACK(int)  vboxSkeletonExtPack_VMConfigureVMM(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
+//
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOn}
+//  */
+// static DECLCALLBACK(int)  vboxSkeletonExtPack_VMPowerOn(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOff}
+//  */
+// static DECLCALLBACK(void) vboxSkeletonExtPack_VMPowerOff(PCVBOXEXTPACKREG pThis, IConsole *pConsole, PVM pVM);
+// /**
+//  * @interface_method_impl{VBOXEXTPACKREG,pfnVMPowerOff}
+//  */
+// static DECLCALLBACK(void) vboxSkeletonExtPack_QueryObject(PCVBOXEXTPACKREG pThis, PCRTUUID pObjectId);
+
+
+static const VBOXEXTPACKREG g_vboxSkeletonExtPackReg =
+{
+    VBOXEXTPACKREG_VERSION,
+    /* .pfnInstalled =      */  NULL,
+    /* .pfnUninstall =      */  NULL,
+    /* .pfnVirtualBoxReady =*/  NULL,
+    /* .pfnConsoleReady =   */  NULL,
+    /* .pfnUnload =         */  NULL,
+    /* .pfnVMCreated =      */  NULL,
+    /* .pfnVMConfigureVMM = */  NULL,
+    /* .pfnVMPowerOn =      */  NULL,
+    /* .pfnVMPowerOff =     */  NULL,
+    /* .pfnQueryObject =    */  NULL,
+    VBOXEXTPACKREG_VERSION
+};
+
+
+/** @callback_method_impl{FNVBOXEXTPACKREGISTER}  */
+extern "C" DECLEXPORT(int) VBoxExtPackRegister(PCVBOXEXTPACKHLP pHlp, PCVBOXEXTPACKREG *ppReg, PRTERRINFO pErrInfo)
+{
+    /*
+     * Check the VirtualBox version.
+     */
+    if (!VBOXEXTPACK_IS_VER_COMPAT(pHlp->u32Version, VBOXEXTPACKHLP_VERSION))
+        return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
+                             "Helper version mismatch - expected %#x got %#x",
+                             VBOXEXTPACKHLP_VERSION, pHlp->u32Version);
+    if (   VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MAJOR
+        || VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion) != VBOX_VERSION_MINOR)
+        return RTErrInfoSetF(pErrInfo, VERR_VERSION_MISMATCH,
+                             "VirtualBox version mismatch - expected %u.%u got %u.%u",
+                             VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR,
+                             VBOX_FULL_VERSION_GET_MAJOR(pHlp->uVBoxFullVersion),
+                             VBOX_FULL_VERSION_GET_MINOR(pHlp->uVBoxFullVersion));
+
+    /*
+     * We're good, save input and return the registration structure.
+     */
+    g_pHlp = pHlp;
+    *ppReg = &g_vboxSkeletonExtPackReg;
+
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0.cpp b/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0.cpp
new file mode 100644
index 0000000..4ec143f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0.cpp
@@ -0,0 +1,2135 @@
+/* $Id: VBoxDTraceR0.cpp $ */
+/** @file
+ * VBoxDTraceR0.
+ *
+ * Contributed by: bird
+ */
+
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the Common
+ * Development and Distribution License Version 1.0 (CDDL) only, as it
+ * comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution.
+ * VirtualBox OSE is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY of any kind.
+ *
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/sup.h>
+#include <VBox/log.h>
+
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/assert.h>
+#include <iprt/ctype.h>
+#include <iprt/err.h>
+#include <iprt/mem.h>
+#include <iprt/mp.h>
+#include <iprt/process.h>
+#include <iprt/semaphore.h>
+#include <iprt/spinlock.h>
+#include <iprt/string.h>
+#include <iprt/thread.h>
+#include <iprt/time.h>
+
+#include <sys/dtrace_impl.h>
+
+#include <VBox/VBoxTpG.h>
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+//#if !defined(RT_OS_WINDOWS) && !defined(RT_OS_OS2)
+//# define HAVE_RTMEMALLOCEX_FEATURES
+//#endif
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+
+/** Caller indicator. */
+typedef enum VBOXDTCALLER
+{
+    kVBoxDtCaller_Invalid = 0,
+    kVBoxDtCaller_Generic,
+    kVBoxDtCaller_ProbeFireUser,
+    kVBoxDtCaller_ProbeFireKernel
+} VBOXDTCALLER;
+
+/**
+ * Stack data used for thread structure and such.
+ *
+ * This is planted in every external entry point and used to emulate solaris
+ * curthread, CRED, curproc and similar.  It is also used to get at the
+ * uncached probe arguments.
+ */
+typedef struct VBoxDtStackData
+{
+    /** Eyecatcher no. 1 (VBDT_STACK_DATA_MAGIC2). */
+    uint32_t                u32Magic1;
+    /** Eyecatcher no. 2 (VBDT_STACK_DATA_MAGIC2). */
+    uint32_t                u32Magic2;
+    /** The format of the caller specific data. */
+    VBOXDTCALLER            enmCaller;
+    /** Caller specific data.  */
+    union
+    {
+        /** kVBoxDtCaller_ProbeFireKernel. */
+        struct
+        {
+            /** The caller. */
+            uintptr_t               uCaller;
+            /** Pointer to the stack arguments of a probe function call. */
+            uintptr_t              *pauStackArgs;
+        } ProbeFireKernel;
+        /** kVBoxDtCaller_ProbeFireUser. */
+        struct
+        {
+            /** The user context.  */
+            PCSUPDRVTRACERUSRCTX    pCtx;
+            /** The argument displacement caused by 64-bit arguments passed directly to
+             *  dtrace_probe. */
+            int                     offArg;
+        } ProbeFireUser;
+    } u;
+    /** Credentials allocated by VBoxDtGetCurrentCreds. */
+    struct VBoxDtCred      *pCred;
+    /** Thread structure currently being held by this thread. */
+    struct VBoxDtThread    *pThread;
+    /** Pointer to this structure.
+     * This is the final bit of integrity checking. */
+    struct VBoxDtStackData *pSelf;
+} VBDTSTACKDATA;
+/** Pointer to the on-stack thread specific data. */
+typedef VBDTSTACKDATA *PVBDTSTACKDATA;
+
+/** The first magic value. */
+#define VBDT_STACK_DATA_MAGIC1      RT_MAKE_U32_FROM_U8('V', 'B', 'o', 'x')
+/** The second magic value. */
+#define VBDT_STACK_DATA_MAGIC2      RT_MAKE_U32_FROM_U8('D', 'T', 'r', 'c')
+
+/** The alignment of the stack data.
+ * The data doesn't require more than sizeof(uintptr_t) alignment, but the
+ * greater alignment the quicker lookup. */
+#define VBDT_STACK_DATA_ALIGN       32
+
+/** Plants the stack data. */
+#define VBDT_SETUP_STACK_DATA(a_enmCaller) \
+    uint8_t abBlob[sizeof(VBDTSTACKDATA) + VBDT_STACK_DATA_ALIGN - 1]; \
+    PVBDTSTACKDATA pStackData = (PVBDTSTACKDATA)(    (uintptr_t)&abBlob[VBDT_STACK_DATA_ALIGN - 1] \
+                                                 &  ~(uintptr_t)(VBDT_STACK_DATA_ALIGN - 1)); \
+    pStackData->u32Magic1   = VBDT_STACK_DATA_MAGIC1; \
+    pStackData->u32Magic2   = VBDT_STACK_DATA_MAGIC2; \
+    pStackData->enmCaller   = a_enmCaller; \
+    pStackData->pCred       = NULL; \
+    pStackData->pThread     = NULL; \
+    pStackData->pSelf       = pStackData
+
+/** Passifies the stack data and frees up resource held within it. */
+#define VBDT_CLEAR_STACK_DATA() \
+    do \
+    { \
+        pStackData->u32Magic1   = 0; \
+        pStackData->u32Magic2   = 0; \
+        pStackData->pSelf       = NULL; \
+        if (pStackData->pCred) \
+            crfree(pStackData->pCred); \
+        if (pStackData->pThread) \
+            VBoxDtReleaseThread(pStackData->pThread); \
+    } while (0)
+
+
+/** Simple SUPR0Printf-style logging.  */
+#if 0 /*def DEBUG_bird*/
+# define LOG_DTRACE(a) SUPR0Printf a
+#else
+# define LOG_DTRACE(a) do { } while (0)
+#endif
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** Per CPU information */
+cpucore_t                       g_aVBoxDtCpuCores[RTCPUSET_MAX_CPUS];
+/** Dummy mutex. */
+struct VBoxDtMutex              g_DummyMtx;
+/** Pointer to the tracer helpers provided by VBoxDrv. */
+static PCSUPDRVTRACERHLP        g_pVBoxDTraceHlp;
+
+dtrace_cacheid_t dtrace_predcache_id = DTRACE_CACHEIDNONE + 1;
+
+#if 0
+void           (*dtrace_cpu_init)(processorid_t);
+void           (*dtrace_modload)(struct modctl *);
+void           (*dtrace_modunload)(struct modctl *);
+void           (*dtrace_helpers_cleanup)(void);
+void           (*dtrace_helpers_fork)(proc_t *, proc_t *);
+void           (*dtrace_cpustart_init)(void);
+void           (*dtrace_cpustart_fini)(void);
+void           (*dtrace_cpc_fire)(uint64_t);
+void           (*dtrace_debugger_init)(void);
+void           (*dtrace_debugger_fini)(void);
+#endif
+
+
+/**
+ * Gets the stack data.
+ *
+ * @returns Pointer to the stack data.  Never NULL.
+ */
+static PVBDTSTACKDATA vboxDtGetStackData(void)
+{
+    int volatile    iDummy = 1; /* use this to get the stack address. */
+    PVBDTSTACKDATA  pData = (PVBDTSTACKDATA)(  ((uintptr_t)&iDummy + VBDT_STACK_DATA_ALIGN - 1)
+                                             & ~(uintptr_t)(VBDT_STACK_DATA_ALIGN - 1));
+    for (;;)
+    {
+        if (   pData->u32Magic1 == VBDT_STACK_DATA_MAGIC1
+            && pData->u32Magic2 == VBDT_STACK_DATA_MAGIC2
+            && pData->pSelf     == pData)
+            return pData;
+        pData = (PVBDTSTACKDATA)((uintptr_t)pData + VBDT_STACK_DATA_ALIGN);
+    }
+}
+
+
+void dtrace_toxic_ranges(void (*pfnAddOne)(uintptr_t uBase, uintptr_t cbRange))
+{
+    /** @todo ? */
+}
+
+
+
+/**
+ * Dummy callback used by dtrace_sync.
+ */
+static DECLCALLBACK(void) vboxDtSyncCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    NOREF(idCpu); NOREF(pvUser1); NOREF(pvUser2);
+}
+
+
+/**
+ * Synchronzie across all CPUs (expensive).
+ */
+void    dtrace_sync(void)
+{
+    int rc = RTMpOnAll(vboxDtSyncCallback, NULL, NULL);
+    AssertRC(rc);
+}
+
+
+/**
+ * Fetch a 8-bit "word" from userland.
+ *
+ * @return  The byte value.
+ * @param   pvUserAddr      The userland address.
+ */
+uint8_t  dtrace_fuword8( void *pvUserAddr)
+{
+    uint8_t u8;
+    int rc = RTR0MemUserCopyFrom(&u8, (uintptr_t)pvUserAddr, sizeof(u8));
+    if (RT_FAILURE(rc))
+    {
+        RTCPUID iCpu = VBDT_GET_CPUID();
+        cpu_core[iCpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR;
+        cpu_core[iCpu].cpuc_dtrace_illval = (uintptr_t)pvUserAddr;
+        u8 = 0;
+    }
+    return u8;
+}
+
+
+/**
+ * Fetch a 16-bit word from userland.
+ *
+ * @return  The word value.
+ * @param   pvUserAddr      The userland address.
+ */
+uint16_t dtrace_fuword16(void *pvUserAddr)
+{
+    uint16_t u16;
+    int rc = RTR0MemUserCopyFrom(&u16, (uintptr_t)pvUserAddr, sizeof(u16));
+    if (RT_FAILURE(rc))
+    {
+        RTCPUID iCpu = VBDT_GET_CPUID();
+        cpu_core[iCpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR;
+        cpu_core[iCpu].cpuc_dtrace_illval = (uintptr_t)pvUserAddr;
+        u16 = 0;
+    }
+    return u16;
+}
+
+
+/**
+ * Fetch a 32-bit word from userland.
+ *
+ * @return  The dword value.
+ * @param   pvUserAddr      The userland address.
+ */
+uint32_t dtrace_fuword32(void *pvUserAddr)
+{
+    uint32_t u32;
+    int rc = RTR0MemUserCopyFrom(&u32, (uintptr_t)pvUserAddr, sizeof(u32));
+    if (RT_FAILURE(rc))
+    {
+        RTCPUID iCpu = VBDT_GET_CPUID();
+        cpu_core[iCpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR;
+        cpu_core[iCpu].cpuc_dtrace_illval = (uintptr_t)pvUserAddr;
+        u32 = 0;
+    }
+    return u32;
+}
+
+
+/**
+ * Fetch a 64-bit word from userland.
+ *
+ * @return  The qword value.
+ * @param   pvUserAddr      The userland address.
+ */
+uint64_t dtrace_fuword64(void *pvUserAddr)
+{
+    uint64_t u64;
+    int rc = RTR0MemUserCopyFrom(&u64, (uintptr_t)pvUserAddr, sizeof(u64));
+    if (RT_FAILURE(rc))
+    {
+        RTCPUID iCpu = VBDT_GET_CPUID();
+        cpu_core[iCpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR;
+        cpu_core[iCpu].cpuc_dtrace_illval = (uintptr_t)pvUserAddr;
+        u64 = 0;
+    }
+    return u64;
+}
+
+
+/** copyin implementation */
+int  VBoxDtCopyIn(void const *pvUser, void *pvDst, size_t cb)
+{
+    int rc = RTR0MemUserCopyFrom(pvDst, (uintptr_t)pvUser, cb);
+    return RT_SUCCESS(rc) ? 0 : -1;
+}
+
+
+/** copyout implementation */
+int  VBoxDtCopyOut(void const *pvSrc, void *pvUser, size_t cb)
+{
+    int rc = RTR0MemUserCopyTo((uintptr_t)pvUser, pvSrc, cb);
+    return RT_SUCCESS(rc) ? 0 : -1;
+}
+
+
+/**
+ * Copy data from userland into the kernel.
+ *
+ * @param   uUserAddr           The userland address.
+ * @param   uKrnlAddr           The kernel buffer address.
+ * @param   cb                  The number of bytes to copy.
+ * @param   pfFlags             Pointer to the relevant cpuc_dtrace_flags.
+ */
+void dtrace_copyin(    uintptr_t uUserAddr, uintptr_t uKrnlAddr, size_t cb, volatile uint16_t *pfFlags)
+{
+    int rc = RTR0MemUserCopyFrom((void *)uKrnlAddr, uUserAddr, cb);
+    if (RT_FAILURE(rc))
+    {
+        *pfFlags |= CPU_DTRACE_BADADDR;
+        cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = uUserAddr;
+    }
+}
+
+
+/**
+ * Copy data from the kernel into userland.
+ *
+ * @param   uKrnlAddr           The kernel buffer address.
+ * @param   uUserAddr           The userland address.
+ * @param   cb                  The number of bytes to copy.
+ * @param   pfFlags             Pointer to the relevant cpuc_dtrace_flags.
+ */
+void dtrace_copyout(   uintptr_t uKrnlAddr, uintptr_t uUserAddr, size_t cb, volatile uint16_t *pfFlags)
+{
+    int rc = RTR0MemUserCopyTo(uUserAddr, (void const *)uKrnlAddr, cb);
+    if (RT_FAILURE(rc))
+    {
+        *pfFlags |= CPU_DTRACE_BADADDR;
+        cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = uUserAddr;
+    }
+}
+
+
+/**
+ * Copy a string from userland into the kernel.
+ *
+ * @param   uUserAddr           The userland address.
+ * @param   uKrnlAddr           The kernel buffer address.
+ * @param   cbMax               The maximum number of bytes to copy. May stop
+ *                              earlier if zero byte is encountered.
+ * @param   pfFlags             Pointer to the relevant cpuc_dtrace_flags.
+ */
+void dtrace_copyinstr( uintptr_t uUserAddr, uintptr_t uKrnlAddr, size_t cbMax, volatile uint16_t *pfFlags)
+{
+    if (!cbMax)
+        return;
+
+    char   *pszDst = (char *)uKrnlAddr;
+    int     rc = RTR0MemUserCopyFrom(pszDst, uUserAddr, cbMax);
+    if (RT_FAILURE(rc))
+    {
+        /* Byte by byte - lazy bird! */
+        size_t off = 0;
+        while (off < cbMax)
+        {
+            rc = RTR0MemUserCopyFrom(&pszDst[off], uUserAddr + off, 1);
+            if (RT_FAILURE(rc))
+            {
+                *pfFlags |= CPU_DTRACE_BADADDR;
+                cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = uUserAddr;
+                pszDst[off] = '\0';
+                return;
+            }
+            if (!pszDst[off])
+                return;
+            off++;
+        }
+    }
+
+    pszDst[cbMax - 1] = '\0';
+}
+
+
+/**
+ * Copy a string from the kernel and into user land.
+ *
+ * @param   uKrnlAddr           The kernel string address.
+ * @param   uUserAddr           The userland address.
+ * @param   cbMax               The maximum number of bytes to copy.  Will stop
+ *                              earlier if zero byte is encountered.
+ * @param   pfFlags             Pointer to the relevant cpuc_dtrace_flags.
+ */
+void dtrace_copyoutstr(uintptr_t uKrnlAddr, uintptr_t uUserAddr, size_t cbMax, volatile uint16_t *pfFlags)
+{
+    const char *pszSrc   = (const char *)uKrnlAddr;
+    size_t      cbActual = RTStrNLen(pszSrc, cbMax);
+    cbActual += cbActual < cbMax;
+    dtrace_copyout(uKrnlAddr,uUserAddr, cbActual, pfFlags);
+}
+
+
+/**
+ * Get the caller @a cCallFrames call frames up the stack.
+ *
+ * @returns The caller's return address or ~(uintptr_t)0.
+ * @param   cCallFrames         The number of frames.
+ */
+uintptr_t dtrace_caller(int cCallFrames)
+{
+    PVBDTSTACKDATA pData = vboxDtGetStackData();
+    if (pData->enmCaller == kVBoxDtCaller_ProbeFireKernel)
+        return pData->u.ProbeFireKernel.uCaller;
+    return ~(uintptr_t)0;
+}
+
+
+/**
+ * Get argument number @a iArg @a cCallFrames call frames up the stack.
+ *
+ * @returns The caller's return address or ~(uintptr_t)0.
+ * @param   iArg                The argument to get.
+ * @param   cCallFrames         The number of frames.
+ */
+uint64_t dtrace_getarg(int iArg, int cCallFrames)
+{
+    PVBDTSTACKDATA pData = vboxDtGetStackData();
+    AssertReturn(iArg >= 5, UINT64_MAX);
+
+    if (pData->enmCaller == kVBoxDtCaller_ProbeFireKernel)
+        return pData->u.ProbeFireKernel.pauStackArgs[iArg - 5];
+    return UINT64_MAX;
+}
+
+
+/**
+ * Produce a traceback of the kernel stack.
+ *
+ * @param   paPcStack           Where to return the program counters.
+ * @param   cMaxFrames          The maximum number of PCs to return.
+ * @param   cSkipFrames         The number of artificial callstack frames to
+ *                              skip at the top.
+ * @param   pIntr               Not sure what this is...
+ */
+void dtrace_getpcstack(pc_t *paPcStack, int cMaxFrames, int cSkipFrames, uint32_t *pIntr)
+{
+    int iFrame = 0;
+    while (iFrame < cMaxFrames)
+    {
+        paPcStack[iFrame] = NULL;
+        iFrame++;
+    }
+}
+
+
+/**
+ * Get the number of call frames on the stack.
+ *
+ * @returns The stack depth.
+ * @param   cSkipFrames         The number of artificial callstack frames to
+ *                              skip at the top.
+ */
+int dtrace_getstackdepth(int cSkipFrames)
+{
+    return 1;
+}
+
+
+/**
+ * Produce a traceback of the userland stack.
+ *
+ * @param   paPcStack           Where to return the program counters.
+ * @param   paFpStack           Where to return the frame pointers.
+ * @param   cMaxFrames          The maximum number of frames to return.
+ */
+void dtrace_getufpstack(uint64_t *paPcStack, uint64_t *paFpStack, int cMaxFrames)
+{
+    int iFrame = 0;
+    while (iFrame < cMaxFrames)
+    {
+        paPcStack[iFrame] = 0;
+        paFpStack[iFrame] = 0;
+        iFrame++;
+    }
+}
+
+
+/**
+ * Produce a traceback of the userland stack.
+ *
+ * @param   paPcStack           Where to return the program counters.
+ * @param   cMaxFrames          The maximum number of frames to return.
+ */
+void dtrace_getupcstack(uint64_t *paPcStack, int cMaxFrames)
+{
+    int iFrame = 0;
+    while (iFrame < cMaxFrames)
+    {
+        paPcStack[iFrame] = 0;
+        iFrame++;
+    }
+}
+
+
+/**
+ * Computes the depth of the userland stack.
+ */
+int dtrace_getustackdepth(void)
+{
+    return 0;
+}
+
+
+/**
+ * Get the current IPL/IRQL.
+ *
+ * @returns Current level.
+ */
+int dtrace_getipl(void)
+{
+#ifdef RT_ARCH_AMD64
+    /* CR8 is normally the same as IRQL / IPL on AMD64. */
+    return ASMGetCR8();
+#else
+    /* Just fake it on x86. */
+    return !ASMIntAreEnabled();
+#endif
+}
+
+
+/**
+ * Get current monotonic timestamp.
+ *
+ * @returns Timestamp, nano seconds.
+ */
+hrtime_t dtrace_gethrtime(void)
+{
+    return RTTimeNanoTS();
+}
+
+
+/**
+ * Get current walltime.
+ *
+ * @returns Timestamp, nano seconds.
+ */
+hrtime_t dtrace_gethrestime(void)
+{
+    /** @todo try get better resolution here somehow ... */
+    RTTIMESPEC Now;
+    return RTTimeSpecGetNano(RTTimeNow(&Now));
+}
+
+
+/**
+ * DTrace panic routine.
+ *
+ * @param   pszFormat           Panic message.
+ * @param   va                  Arguments to the panic message.
+ */
+void dtrace_vpanic(const char *pszFormat, va_list va)
+{
+    RTAssertMsg1(NULL, __LINE__, __FILE__, __FUNCTION__);
+    RTAssertMsg2WeakV(pszFormat, va);
+    RTR0AssertPanicSystem();
+    for (;;)
+    {
+        ASMBreakpoint();
+        volatile char *pchCrash = (volatile char *)~(uintptr_t)0;
+        *pchCrash = '\0';
+    }
+}
+
+
+/**
+ * DTrace panic routine.
+ *
+ * @param   pszFormat           Panic message.
+ * @param   ...                 Arguments to the panic message.
+ */
+void VBoxDtPanic(const char *pszFormat, ...)
+{
+    va_list va;
+    va_start(va, pszFormat);
+    dtrace_vpanic(pszFormat, va);
+    va_end(va);
+}
+
+
+/**
+ * DTrace kernel message routine.
+ *
+ * @param   pszFormat           Kernel message.
+ * @param   ...                 Arguments to the panic message.
+ */
+void VBoxDtCmnErr(int iLevel, const char *pszFormat, ...)
+{
+    va_list va;
+    va_start(va, pszFormat);
+    SUPR0Printf("%N", pszFormat, va);
+    va_end(va);
+}
+
+
+/** uprintf implementation */
+void VBoxDtUPrintf(const char *pszFormat, ...)
+{
+    va_list va;
+    va_start(va, pszFormat);
+    VBoxDtUPrintfV(pszFormat, va);
+    va_end(va);
+}
+
+
+/** vuprintf implementation */
+void VBoxDtUPrintfV(const char *pszFormat, va_list va)
+{
+    SUPR0Printf("%N", pszFormat, va);
+}
+
+
+/* CRED implementation. */
+cred_t *VBoxDtGetCurrentCreds(void)
+{
+    PVBDTSTACKDATA pData = vboxDtGetStackData();
+    if (!pData->pCred)
+    {
+        struct VBoxDtCred *pCred;
+#ifdef HAVE_RTMEMALLOCEX_FEATURES
+        int rc = RTMemAllocEx(sizeof(*pCred), 0, RTMEMALLOCEX_FLAGS_ANY_CTX, (void **)&pCred);
+#else
+        int rc = RTMemAllocEx(sizeof(*pCred), 0, 0, (void **)&pCred);
+#endif
+        AssertFatalRC(rc);
+        pCred->cr_refs  = 1;
+        /** @todo get the right creds on unix systems. */
+        pCred->cr_uid   = 0;
+        pCred->cr_ruid  = 0;
+        pCred->cr_suid  = 0;
+        pCred->cr_gid   = 0;
+        pCred->cr_rgid  = 0;
+        pCred->cr_sgid  = 0;
+        pCred->cr_zone  = 0;
+        pData->pCred = pCred;
+    }
+
+    return pData->pCred;
+}
+
+
+/* crhold implementation */
+void VBoxDtCredHold(struct VBoxDtCred *pCred)
+{
+    int32_t cRefs = ASMAtomicIncS32(&pCred->cr_refs);
+    Assert(cRefs > 1);
+}
+
+
+/* crfree implementation */
+void VBoxDtCredFree(struct VBoxDtCred *pCred)
+{
+    int32_t cRefs = ASMAtomicDecS32(&pCred->cr_refs);
+    Assert(cRefs >= 0);
+    if (!cRefs)
+        RTMemFreeEx(pCred, sizeof(*pCred));
+}
+
+/** Spinlock protecting the thread structures. */
+static RTSPINLOCK           g_hThreadSpinlock = NIL_RTSPINLOCK;
+/** List of threads by usage age. */
+static RTLISTANCHOR         g_ThreadAgeList;
+/** Hash table for looking up thread structures.  */
+static struct VBoxDtThread *g_apThreadsHash[16384];
+/** Fake kthread_t structures.
+ * The size of this array is making horrible ASSUMPTIONS about the number of
+ * thread in the system that will be subjected to DTracing. */
+static struct VBoxDtThread  g_aThreads[8192];
+
+
+static int vboxDtInitThreadDb(void)
+{
+    int rc = RTSpinlockCreate(&g_hThreadSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxDtThreadDb");
+    if (RT_FAILURE(rc))
+        return rc;
+
+    RTListInit(&g_ThreadAgeList);
+    for (uint32_t i = 0; i < RT_ELEMENTS(g_aThreads); i++)
+    {
+        g_aThreads[i].hNative = NIL_RTNATIVETHREAD;
+        g_aThreads[i].uPid    = NIL_RTPROCESS;
+        RTListPrepend(&g_ThreadAgeList, &g_aThreads[i].AgeEntry);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+static void vboxDtTermThreadDb(void)
+{
+    RTSpinlockDestroy(g_hThreadSpinlock);
+    g_hThreadSpinlock = NIL_RTSPINLOCK;
+    RTListInit(&g_ThreadAgeList);
+}
+
+
+/* curthread implementation, providing a fake kthread_t. */
+struct VBoxDtThread *VBoxDtGetCurrentThread(void)
+{
+    /*
+     * Once we've retrieved a thread, we hold on to it until the thread exits
+     * the VBoxDTrace module.
+     */
+    PVBDTSTACKDATA  pData       = vboxDtGetStackData();
+    if (pData->pThread)
+    {
+        AssertPtr(pData->pThread);
+        Assert(pData->pThread->hNative   == RTThreadNativeSelf());
+        Assert(pData->pThread->uPid      == RTProcSelf());
+        Assert(RTListIsEmpty(&pData->pThread->AgeEntry));
+        return pData->pThread;
+    }
+
+    /*
+     * Lookup the thread in the hash table.
+     */
+    RTNATIVETHREAD  hNativeSelf = RTThreadNativeSelf();
+    RTPROCESS       uPid        = RTProcSelf();
+    uintptr_t       iHash       = (hNativeSelf * 2654435761U) % RT_ELEMENTS(g_apThreadsHash);
+
+    RTSpinlockAcquire(g_hThreadSpinlock);
+
+    struct VBoxDtThread *pThread = g_apThreadsHash[iHash];
+    while (pThread)
+    {
+        if (pThread->hNative == hNativeSelf)
+        {
+            if (pThread->uPid != uPid)
+            {
+                /* Re-initialize the reused thread. */
+                pThread->uPid           = uPid;
+                pThread->t_dtrace_vtime = 0;
+                pThread->t_dtrace_start = 0;
+                pThread->t_dtrace_stop  = 0;
+                pThread->t_dtrace_scrpc = 0;
+                pThread->t_dtrace_astpc = 0;
+                pThread->t_predcache    = 0;
+            }
+
+            /* Hold the thread in the on-stack data, making sure it does not
+               get reused till the thread leaves VBoxDTrace. */
+            RTListNodeRemove(&pThread->AgeEntry);
+            pData->pThread = pThread;
+
+            RTSpinlockRelease(g_hThreadSpinlock);
+            return pThread;
+        }
+
+        pThread = pThread->pNext;
+    }
+
+    /*
+     * Unknown thread.  Allocate a new entry, recycling unused or old ones.
+     */
+    pThread = RTListGetLast(&g_ThreadAgeList, struct VBoxDtThread, AgeEntry);
+    AssertFatal(pThread);
+    RTListNodeRemove(&pThread->AgeEntry);
+    if (pThread->hNative != NIL_RTNATIVETHREAD)
+    {
+        uintptr_t   iHash2 = (pThread->hNative * 2654435761U) % RT_ELEMENTS(g_apThreadsHash);
+        if (g_apThreadsHash[iHash2] == pThread)
+            g_apThreadsHash[iHash2] = pThread->pNext;
+        else
+        {
+            for (struct VBoxDtThread *pPrev = g_apThreadsHash[iHash2]; ; pPrev = pPrev->pNext)
+            {
+                AssertPtr(pPrev);
+                if (pPrev->pNext == pThread)
+                {
+                    pPrev->pNext = pThread->pNext;
+                    break;
+                }
+            }
+        }
+    }
+
+    /*
+     * Initialize the data.
+     */
+    pThread->t_dtrace_vtime = 0;
+    pThread->t_dtrace_start = 0;
+    pThread->t_dtrace_stop  = 0;
+    pThread->t_dtrace_scrpc = 0;
+    pThread->t_dtrace_astpc = 0;
+    pThread->t_predcache    = 0;
+    pThread->hNative        = hNativeSelf;
+    pThread->uPid           = uPid;
+
+    /*
+     * Add it to the hash as well as the on-stack data.
+     */
+    pThread->pNext = g_apThreadsHash[iHash];
+    g_apThreadsHash[iHash] = pThread->pNext;
+
+    pData->pThread = pThread;
+
+    RTSpinlockRelease(g_hThreadSpinlock);
+    return pThread;
+}
+
+
+/**
+ * Called by the stack data destructor.
+ *
+ * @param   pThread         The thread to release.
+ *
+ */
+static void VBoxDtReleaseThread(struct VBoxDtThread *pThread)
+{
+    RTSpinlockAcquire(g_hThreadSpinlock);
+
+    RTListAppend(&g_ThreadAgeList, &pThread->AgeEntry);
+
+    RTSpinlockRelease(g_hThreadSpinlock);
+}
+
+
+
+
+/*
+ *
+ * Virtual Memory / Resource Allocator.
+ * Virtual Memory / Resource Allocator.
+ * Virtual Memory / Resource Allocator.
+ *
+ */
+
+
+/** The number of bits per chunk.
+ * @remarks The 32 bytes are for heap headers and such like.  */
+#define VBOXDTVMEMCHUNK_BITS    ( ((_64K - 32 - sizeof(uint32_t) * 2) / sizeof(uint32_t)) * 32)
+
+/**
+ * Resource allocator chunk.
+ */
+typedef struct  VBoxDtVMemChunk
+{
+    /** The ordinal (unbased) of the first item. */
+    uint32_t            iFirst;
+    /** The current number of free items in this chunk. */
+    uint32_t            cCurFree;
+    /** The allocation bitmap. */
+    uint32_t            bm[VBOXDTVMEMCHUNK_BITS / 32];
+} VBOXDTVMEMCHUNK;
+/** Pointer to a resource allocator chunk. */
+typedef VBOXDTVMEMCHUNK *PVBOXDTVMEMCHUNK;
+
+
+
+/**
+ * Resource allocator instance.
+ */
+typedef struct VBoxDtVMem
+{
+    /** Spinlock protecting the data (interrupt safe). */
+    RTSPINLOCK          hSpinlock;
+    /** Magic value. */
+    uint32_t            u32Magic;
+    /** The current number of free items in the chunks. */
+    uint32_t            cCurFree;
+    /** The current number of chunks that we have allocated. */
+    uint32_t            cCurChunks;
+    /** The configured resource base. */
+    uint32_t            uBase;
+    /** The configured max number of items. */
+    uint32_t            cMaxItems;
+    /** The size of the apChunks array. */
+    uint32_t            cMaxChunks;
+    /** Array of chunk pointers.
+     * (The size is determined at creation.) */
+    PVBOXDTVMEMCHUNK    apChunks[1];
+} VBOXDTVMEM;
+/** Pointer to a resource allocator instance. */
+typedef VBOXDTVMEM *PVBOXDTVMEM;
+
+/** Magic value for the VBOXDTVMEM structure. */
+#define VBOXDTVMEM_MAGIC        RT_MAKE_U32_FROM_U8('V', 'M',  'e',  'm')
+
+
+/* vmem_create implementation */
+struct VBoxDtVMem *VBoxDtVMemCreate(const char *pszName, void *pvBase, size_t cb, size_t cbUnit,
+                                    PFNRT pfnAlloc, PFNRT pfnFree, struct VBoxDtVMem *pSrc,
+                                    size_t cbQCacheMax, uint32_t fFlags)
+{
+    /*
+     * Assert preconditions of this implementation.
+     */
+    AssertMsgReturn((uintptr_t)pvBase <= UINT32_MAX, ("%p\n", pvBase), NULL);
+    AssertMsgReturn(cb <= UINT32_MAX, ("%zu\n", cb), NULL);
+    AssertMsgReturn((uintptr_t)pvBase + cb - 1 <= UINT32_MAX, ("%p %zu\n", pvBase, cb), NULL);
+    AssertMsgReturn(cbUnit == 1, ("%zu\n", cbUnit), NULL);
+    AssertReturn(!pfnAlloc, NULL);
+    AssertReturn(!pfnFree, NULL);
+    AssertReturn(!pSrc, NULL);
+    AssertReturn(!cbQCacheMax, NULL);
+    AssertReturn(fFlags & VM_SLEEP, NULL);
+    AssertReturn(fFlags & VMC_IDENTIFIER, NULL);
+
+    /*
+     * Allocate the instance.
+     */
+    uint32_t cChunks = (uint32_t)cb / VBOXDTVMEMCHUNK_BITS;
+    if (cb % VBOXDTVMEMCHUNK_BITS)
+        cChunks++;
+    PVBOXDTVMEM pThis = (PVBOXDTVMEM)RTMemAllocZ(RT_OFFSETOF(VBOXDTVMEM, apChunks[cChunks]));
+    if (!pThis)
+        return NULL;
+    int rc = RTSpinlockCreate(&pThis->hSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxDtVMem");
+    if (RT_FAILURE(rc))
+    {
+        RTMemFree(pThis);
+        return NULL;
+    }
+    pThis->u32Magic     = VBOXDTVMEM_MAGIC;
+    pThis->cCurFree     = 0;
+    pThis->cCurChunks   = 0;
+    pThis->uBase        = (uint32_t)(uintptr_t)pvBase;
+    pThis->cMaxItems    = (uint32_t)cb;
+    pThis->cMaxChunks   = cChunks;
+
+    return pThis;
+}
+
+
+/* vmem_destroy implementation */
+void  VBoxDtVMemDestroy(struct VBoxDtVMem *pThis)
+{
+    if (!pThis)
+        return;
+    AssertPtrReturnVoid(pThis);
+    AssertReturnVoid(pThis->u32Magic == VBOXDTVMEM_MAGIC);
+
+    /*
+     * Invalidate the instance.
+     */
+    RTSpinlockAcquire(pThis->hSpinlock); /* paranoia */
+    pThis->u32Magic = 0;
+    RTSpinlockRelease(pThis->hSpinlock);
+    RTSpinlockDestroy(pThis->hSpinlock);
+
+    /*
+     * Free the chunks, then the instance.
+     */
+    uint32_t iChunk = pThis->cCurChunks;
+    while (iChunk-- > 0)
+    {
+        RTMemFree(pThis->apChunks[iChunk]);
+        pThis->apChunks[iChunk] = NULL;
+    }
+    RTMemFree(pThis);
+}
+
+
+/* vmem_alloc implementation */
+void *VBoxDtVMemAlloc(struct VBoxDtVMem *pThis, size_t cbMem, uint32_t fFlags)
+{
+    /*
+     * Validate input.
+     */
+    AssertReturn(fFlags & VM_BESTFIT, NULL);
+    AssertReturn(fFlags & VM_SLEEP, NULL);
+    AssertReturn(cbMem == 1, NULL);
+    AssertPtrReturn(pThis, NULL);
+    AssertReturn(pThis->u32Magic == VBOXDTVMEM_MAGIC, NULL);
+
+    /*
+     * Allocation loop.
+     */
+    RTSpinlockAcquire(pThis->hSpinlock);
+    for (;;)
+    {
+        PVBOXDTVMEMCHUNK pChunk;
+        uint32_t const   cChunks = pThis->cCurChunks;
+
+        if (RT_LIKELY(pThis->cCurFree > 0))
+        {
+            for (uint32_t iChunk = 0; iChunk < cChunks; iChunk++)
+            {
+                pChunk = pThis->apChunks[iChunk];
+                if (pChunk->cCurFree > 0)
+                {
+                    int iBit = ASMBitFirstClear(pChunk->bm, VBOXDTVMEMCHUNK_BITS);
+                    AssertMsgReturnStmt(iBit >= 0 && (unsigned)iBit < VBOXDTVMEMCHUNK_BITS, ("%d\n", iBit),
+                                        RTSpinlockRelease(pThis->hSpinlock),
+                                        NULL);
+
+                    ASMBitSet(pChunk->bm, iBit);
+                    pChunk->cCurFree--;
+                    pThis->cCurFree--;
+
+                    uint32_t iRet = (uint32_t)iBit + pChunk->iFirst + pThis->uBase;
+                    RTSpinlockRelease(pThis->hSpinlock);
+                    return (void *)(uintptr_t)iRet;
+                }
+            }
+            AssertFailedBreak();
+        }
+
+        /* Out of resources? */
+        if (cChunks >= pThis->cMaxChunks)
+            break;
+
+        /*
+         * Allocate another chunk.
+         */
+        uint32_t const  iFirstBit = cChunks > 0 ? pThis->apChunks[cChunks - 1]->iFirst + VBOXDTVMEMCHUNK_BITS : 0;
+        uint32_t const  cFreeBits = cChunks + 1 == pThis->cMaxChunks
+                                  ? pThis->cMaxItems - (iFirstBit - pThis->uBase)
+                                  : VBOXDTVMEMCHUNK_BITS;
+        Assert(cFreeBits <= VBOXDTVMEMCHUNK_BITS);
+
+        RTSpinlockRelease(pThis->hSpinlock);
+
+        pChunk = (PVBOXDTVMEMCHUNK)RTMemAllocZ(sizeof(*pChunk));
+        if (!pChunk)
+            return NULL;
+
+        pChunk->iFirst   = iFirstBit;
+        pChunk->cCurFree = cFreeBits;
+        if (cFreeBits != VBOXDTVMEMCHUNK_BITS)
+        {
+            /* lazy bird. */
+            uint32_t iBit = cFreeBits;
+            while (iBit < VBOXDTVMEMCHUNK_BITS)
+            {
+                ASMBitSet(pChunk->bm, iBit);
+                iBit++;
+            }
+        }
+
+        RTSpinlockAcquire(pThis->hSpinlock);
+
+        /*
+         * Insert the new chunk.  If someone raced us here, we'll drop it to
+         * avoid wasting resources.
+         */
+        if (pThis->cCurChunks == cChunks)
+        {
+            pThis->apChunks[cChunks] = pChunk;
+            pThis->cCurFree   += pChunk->cCurFree;
+            pThis->cCurChunks += 1;
+        }
+        else
+        {
+            RTSpinlockRelease(pThis->hSpinlock);
+            RTMemFree(pChunk);
+            RTSpinlockAcquire(pThis->hSpinlock);
+        }
+    }
+    RTSpinlockRelease(pThis->hSpinlock);
+
+    return NULL;
+}
+
+/* vmem_free implementation */
+void VBoxDtVMemFree(struct VBoxDtVMem *pThis, void *pvMem, size_t cbMem)
+{
+    /*
+     * Validate input.
+     */
+    AssertReturnVoid(cbMem == 1);
+    AssertPtrReturnVoid(pThis);
+    AssertReturnVoid(pThis->u32Magic == VBOXDTVMEM_MAGIC);
+
+    AssertReturnVoid((uintptr_t)pvMem < UINT32_MAX);
+    uint32_t uMem = (uint32_t)(uintptr_t)pvMem;
+    AssertReturnVoid(uMem >= pThis->uBase);
+    uMem -= pThis->uBase;
+    AssertReturnVoid(uMem < pThis->cMaxItems);
+
+
+    /*
+     * Free it.
+     */
+    RTSpinlockAcquire(pThis->hSpinlock);
+    uint32_t const iChunk = uMem / VBOXDTVMEMCHUNK_BITS;
+    if (iChunk < pThis->cCurChunks)
+    {
+        PVBOXDTVMEMCHUNK pChunk = pThis->apChunks[iChunk];
+        uint32_t iBit = uMem - pChunk->iFirst;
+        AssertReturnVoidStmt(iBit < VBOXDTVMEMCHUNK_BITS, RTSpinlockRelease(pThis->hSpinlock));
+        AssertReturnVoidStmt(ASMBitTestAndClear(pChunk->bm, iBit), RTSpinlockRelease(pThis->hSpinlock));
+
+        pChunk->cCurFree++;
+        pThis->cCurFree++;
+    }
+
+    RTSpinlockRelease(pThis->hSpinlock);
+}
+
+
+/*
+ *
+ * Memory Allocators.
+ * Memory Allocators.
+ * Memory Allocators.
+ *
+ */
+
+
+/* kmem_alloc implementation */
+void *VBoxDtKMemAlloc(size_t cbMem, uint32_t fFlags)
+{
+    void    *pvMem;
+#ifdef HAVE_RTMEMALLOCEX_FEATURES
+    uint32_t fMemAllocFlags = fFlags & KM_NOSLEEP ? RTMEMALLOCEX_FLAGS_ANY_CTX : 0;
+#else
+    uint32_t fMemAllocFlags = 0;
+#endif
+    int rc = RTMemAllocEx(cbMem, 0, fMemAllocFlags, &pvMem);
+    AssertRCReturn(rc, NULL);
+    AssertPtr(pvMem);
+    return pvMem;
+}
+
+
+/* kmem_zalloc implementation */
+void *VBoxDtKMemAllocZ(size_t cbMem, uint32_t fFlags)
+{
+    void    *pvMem;
+#ifdef HAVE_RTMEMALLOCEX_FEATURES
+    uint32_t fMemAllocFlags = (fFlags & KM_NOSLEEP ? RTMEMALLOCEX_FLAGS_ANY_CTX : 0) | RTMEMALLOCEX_FLAGS_ZEROED;
+#else
+    uint32_t fMemAllocFlags = RTMEMALLOCEX_FLAGS_ZEROED;
+#endif
+    int rc = RTMemAllocEx(cbMem, 0, fMemAllocFlags, &pvMem);
+    AssertRCReturn(rc, NULL);
+    AssertPtr(pvMem);
+    return pvMem;
+}
+
+
+/* kmem_free implementation */
+void  VBoxDtKMemFree(void *pvMem, size_t cbMem)
+{
+    RTMemFreeEx(pvMem, cbMem);
+}
+
+
+/**
+ * Memory cache mockup structure.
+ * No slab allocator here!
+ */
+struct VBoxDtMemCache
+{
+    uint32_t u32Magic;
+    size_t cbBuf;
+    size_t cbAlign;
+};
+
+
+/* Limited kmem_cache_create implementation. */
+struct VBoxDtMemCache *VBoxDtKMemCacheCreate(const char *pszName, size_t cbBuf, size_t cbAlign,
+                                             PFNRT pfnCtor, PFNRT pfnDtor, PFNRT pfnReclaim,
+                                             void *pvUser, void *pvVM, uint32_t fFlags)
+{
+    /*
+     * Check the input.
+     */
+    AssertReturn(cbBuf > 0 && cbBuf < _1G, NULL);
+    AssertReturn(RT_IS_POWER_OF_TWO(cbAlign), NULL);
+    AssertReturn(!pfnCtor, NULL);
+    AssertReturn(!pfnDtor, NULL);
+    AssertReturn(!pfnReclaim, NULL);
+    AssertReturn(!pvUser, NULL);
+    AssertReturn(!pvVM, NULL);
+    AssertReturn(!fFlags, NULL);
+
+    /*
+     * Create a parameter container. Don't bother with anything fancy here yet,
+     * just get something working.
+     */
+    struct VBoxDtMemCache *pThis = (struct VBoxDtMemCache *)RTMemAlloc(sizeof(*pThis));
+    if (!pThis)
+        return NULL;
+
+    pThis->cbAlign = cbAlign;
+    pThis->cbBuf   = cbBuf;
+    return pThis;
+}
+
+
+/* Limited kmem_cache_destroy implementation. */
+void  VBoxDtKMemCacheDestroy(struct VBoxDtMemCache *pThis)
+{
+    RTMemFree(pThis);
+}
+
+
+/* kmem_cache_alloc implementation. */
+void *VBoxDtKMemCacheAlloc(struct VBoxDtMemCache *pThis, uint32_t fFlags)
+{
+    void    *pvMem;
+#ifdef HAVE_RTMEMALLOCEX_FEATURES
+    uint32_t fMemAllocFlags = (fFlags & KM_NOSLEEP ? RTMEMALLOCEX_FLAGS_ANY_CTX : 0) | RTMEMALLOCEX_FLAGS_ZEROED;
+#else
+    uint32_t fMemAllocFlags = RTMEMALLOCEX_FLAGS_ZEROED;
+#endif
+    int rc = RTMemAllocEx(pThis->cbBuf, /*pThis->cbAlign*/0, fMemAllocFlags, &pvMem);
+    AssertRCReturn(rc, NULL);
+    AssertPtr(pvMem);
+    return pvMem;
+}
+
+
+/* kmem_cache_free implementation. */
+void  VBoxDtKMemCacheFree(struct VBoxDtMemCache *pThis, void *pvMem)
+{
+    RTMemFreeEx(pvMem, pThis->cbBuf);
+}
+
+
+/*
+ *
+ * Mutex Semaphore Wrappers.
+ *
+ */
+
+
+/** Initializes a mutex. */
+int VBoxDtMutexInit(struct VBoxDtMutex *pMtx)
+{
+    AssertReturn(pMtx != &g_DummyMtx, -1);
+    AssertPtr(pMtx);
+
+    pMtx->hOwner = NIL_RTNATIVETHREAD;
+    pMtx->hMtx   = NIL_RTSEMMUTEX;
+    int rc = RTSemMutexCreate(&pMtx->hMtx);
+    if (RT_SUCCESS(rc))
+        return 0;
+    return -1;
+}
+
+
+/** Deletes a mutex. */
+void VBoxDtMutexDelete(struct VBoxDtMutex *pMtx)
+{
+    AssertReturnVoid(pMtx != &g_DummyMtx);
+    AssertPtr(pMtx);
+    if (pMtx->hMtx == NIL_RTSEMMUTEX || pMtx->hMtx == NULL)
+        return;
+
+    Assert(pMtx->hOwner == NIL_RTNATIVETHREAD);
+    int rc = RTSemMutexDestroy(pMtx->hMtx); AssertRC(rc);
+    pMtx->hMtx = NIL_RTSEMMUTEX;
+}
+
+
+/* mutex_enter implementation */
+void VBoxDtMutexEnter(struct VBoxDtMutex *pMtx)
+{
+    AssertPtr(pMtx);
+    if (pMtx == &g_DummyMtx)
+        return;
+
+    RTNATIVETHREAD hSelf = RTThreadNativeSelf();
+
+    int rc = RTSemMutexRequest(pMtx->hMtx, RT_INDEFINITE_WAIT);
+    AssertFatalRC(rc);
+
+    Assert(pMtx->hOwner == NIL_RTNATIVETHREAD);
+    pMtx->hOwner = hSelf;
+}
+
+
+/* mutex_exit implementation */
+void VBoxDtMutexExit(struct VBoxDtMutex *pMtx)
+{
+    AssertPtr(pMtx);
+    if (pMtx == &g_DummyMtx)
+        return;
+
+    Assert(pMtx->hOwner == RTThreadNativeSelf());
+
+    pMtx->hOwner = NIL_RTNATIVETHREAD;
+    int rc = RTSemMutexRelease(pMtx->hMtx);
+    AssertFatalRC(rc);
+}
+
+
+/* MUTEX_HELD implementation */
+bool VBoxDtMutexIsOwner(struct VBoxDtMutex *pMtx)
+{
+    AssertPtrReturn(pMtx, false);
+    if (pMtx == &g_DummyMtx)
+        return true;
+    return pMtx->hOwner == RTThreadNativeSelf();
+}
+
+
+
+/*
+ *
+ * Helpers for handling VTG structures.
+ * Helpers for handling VTG structures.
+ * Helpers for handling VTG structures.
+ *
+ */
+
+
+
+/**
+ * Converts an attribute from VTG description speak to DTrace.
+ *
+ * @param   pDtAttr             The DTrace attribute (dst).
+ * @param   pVtgAttr            The VTG attribute descriptor (src).
+ */
+static void vboxDtVtgConvAttr(dtrace_attribute_t *pDtAttr, PCVTGDESCATTR pVtgAttr)
+{
+    pDtAttr->dtat_name  = pVtgAttr->u8Code - 1;
+    pDtAttr->dtat_data  = pVtgAttr->u8Data - 1;
+    pDtAttr->dtat_class = pVtgAttr->u8DataDep - 1;
+}
+
+/**
+ * Gets a string from the string table.
+ *
+ * @returns Pointer to the string.
+ * @param   pVtgHdr             The VTG object header.
+ * @param   offStrTab           The string table offset.
+ */
+static const char *vboxDtVtgGetString(PVTGOBJHDR pVtgHdr, uint32_t offStrTab)
+{
+    Assert(offStrTab < pVtgHdr->cbStrTab);
+    return (const char *)pVtgHdr + pVtgHdr->offStrTab + offStrTab;
+}
+
+
+
+/*
+ *
+ * DTrace Provider Interface.
+ * DTrace Provider Interface.
+ * DTrace Provider Interface.
+ *
+ */
+
+
+/**
+ * @callback_method_impl{dtrace_pops_t,dtps_provide}
+ */
+static void     vboxDtPOps_Provide(void *pvProv, const dtrace_probedesc_t *pDtProbeDesc)
+{
+    PSUPDRVVDTPROVIDERCORE  pProv = (PSUPDRVVDTPROVIDERCORE)pvProv;
+    AssertPtrReturnVoid(pProv);
+    LOG_DTRACE(("%s: %p / %p pDtProbeDesc=%p\n", __FUNCTION__, pProv, pProv->TracerData.DTrace.idProvider, pDtProbeDesc));
+
+    if (pDtProbeDesc)
+        return;  /* We don't generate probes, so never mind these requests. */
+
+    if (pProv->TracerData.DTrace.fZombie)
+        return;
+
+    dtrace_provider_id_t const idProvider = pProv->TracerData.DTrace.idProvider;
+    AssertPtrReturnVoid(idProvider);
+
+    AssertPtrReturnVoid(pProv->pHdr);
+    AssertReturnVoid(pProv->pHdr->offProbeLocs != 0);
+    uint32_t const  cProbeLocs    = pProv->pHdr->cbProbeLocs / sizeof(VTGPROBELOC);
+
+    /* Need a buffer for extracting the function names and mangling them in
+       case of collision. */
+    size_t const cbFnNmBuf = _4K + _1K;
+    char *pszFnNmBuf = (char *)RTMemAlloc(cbFnNmBuf);
+    if (!pszFnNmBuf)
+         return;
+
+    /*
+     * Itereate the probe location list and register all probes related to
+     * this provider.
+     */
+    uint16_t const idxProv = (uint16_t)((PVTGDESCPROVIDER)((uintptr_t)pProv->pHdr + pProv->pHdr->offProviders) - pProv->pDesc);
+    for (uint32_t idxProbeLoc = 0; idxProbeLoc < cProbeLocs; idxProbeLoc++)
+    {
+        /* Skip probe location belonging to other providers or once that
+           we've already reported. */
+        PCVTGPROBELOC pProbeLocRO = &pProv->paProbeLocsRO[idxProbeLoc];
+        PVTGDESCPROBE pProbeDesc  = pProbeLocRO->pProbe;
+        if (pProbeDesc->idxProvider != idxProv)
+            continue;
+
+        uint32_t *pidProbe;
+        if (!pProv->fUmod)
+            pidProbe = (uint32_t *)&pProbeLocRO->idProbe;
+        else
+            pidProbe = &pProv->paR0ProbeLocs[idxProbeLoc].idProbe;
+        if (*pidProbe != 0)
+            continue;
+
+         /* The function name may need to be stripped since we're using C++
+            compilers for most of the code.  ASSUMES nobody are brave/stupid
+            enough to use function pointer returns without typedef'ing
+            properly them (e.g. signal). */
+         const char *pszPrbName = vboxDtVtgGetString(pProv->pHdr, pProbeDesc->offName);
+         const char *pszFunc    = pProbeLocRO->pszFunction;
+         const char *psz        = strchr(pProbeLocRO->pszFunction, '(');
+         size_t      cch;
+         if (psz)
+         {
+             /* skip blanks preceeding the parameter parenthesis. */
+             while (   (uintptr_t)psz > (uintptr_t)pProbeLocRO->pszFunction
+                    && RT_C_IS_BLANK(psz[-1]))
+                 psz--;
+
+             /* Find the start of the function name. */
+             pszFunc = psz - 1;
+             while ((uintptr_t)pszFunc > (uintptr_t)pProbeLocRO->pszFunction)
+             {
+                 char ch = pszFunc[-1];
+                 if (!RT_C_IS_ALNUM(ch) && ch != '_' && ch != ':')
+                     break;
+                 pszFunc--;
+             }
+             cch = psz - pszFunc;
+         }
+         else
+             cch = strlen(pszFunc);
+         RTStrCopyEx(pszFnNmBuf, cbFnNmBuf, pszFunc, cch);
+
+         /* Look up the probe, if we have one in the same function, mangle
+            the function name a little to avoid having to deal with having
+            multiple location entries with the same probe ID. (lazy bird) */
+         Assert(!*pidProbe);
+         if (dtrace_probe_lookup(idProvider, pProv->pszModName, pszFnNmBuf, pszPrbName) != DTRACE_IDNONE)
+         {
+             RTStrPrintf(pszFnNmBuf+cch, cbFnNmBuf - cch, "-%u", pProbeLocRO->uLine);
+             if (dtrace_probe_lookup(idProvider, pProv->pszModName, pszFnNmBuf, pszPrbName) != DTRACE_IDNONE)
+             {
+                 unsigned iOrd = 2;
+                 while (iOrd < 128)
+                 {
+                     RTStrPrintf(pszFnNmBuf+cch, cbFnNmBuf - cch, "-%u-%u", pProbeLocRO->uLine, iOrd);
+                     if (dtrace_probe_lookup(idProvider, pProv->pszModName, pszFnNmBuf, pszPrbName) == DTRACE_IDNONE)
+                         break;
+                     iOrd++;
+                 }
+                 if (iOrd >= 128)
+                 {
+                     LogRel(("VBoxDrv: More than 128 duplicate probe location instances %s at line %u in function %s [%s], probe %s\n",
+                             pProbeLocRO->uLine, pProbeLocRO->pszFunction, pszFnNmBuf, pszPrbName));
+                     continue;
+                 }
+             }
+         }
+
+         /* Create the probe. */
+         AssertCompile(sizeof(*pidProbe) == sizeof(dtrace_id_t));
+         *pidProbe = dtrace_probe_create(idProvider, pProv->pszModName, pszFnNmBuf, pszPrbName,
+                                         1 /*aframes*/, (void *)(uintptr_t)idxProbeLoc);
+         pProv->TracerData.DTrace.cProvidedProbes++;
+     }
+
+     RTMemFree(pszFnNmBuf);
+     LOG_DTRACE(("%s: returns\n", __FUNCTION__));
+}
+
+
+/**
+ * @callback_method_impl{dtrace_pops_t,dtps_enable}
+ */
+static int      vboxDtPOps_Enable(void *pvProv, dtrace_id_t idProbe, void *pvProbe)
+{
+    PSUPDRVVDTPROVIDERCORE  pProv   = (PSUPDRVVDTPROVIDERCORE)pvProv;
+    LOG_DTRACE(("%s: %p / %p - %#x / %p\n", __FUNCTION__, pProv, pProv->TracerData.DTrace.idProvider, idProbe, pvProbe));
+    AssertPtrReturn(pProv->TracerData.DTrace.idProvider, EINVAL);
+
+    if (!pProv->TracerData.DTrace.fZombie)
+    {
+        uint32_t        idxProbeLoc = (uint32_t)(uintptr_t)pvProbe;
+        PVTGPROBELOC32  pProbeLocEn = (PVTGPROBELOC32)(  (uintptr_t)pProv->pvProbeLocsEn + idxProbeLoc * pProv->cbProbeLocsEn);
+        PCVTGPROBELOC   pProbeLocRO = (PVTGPROBELOC)&pProv->paProbeLocsRO[idxProbeLoc];
+        PCVTGDESCPROBE  pProbeDesc  = pProbeLocRO->pProbe;
+        uint32_t const  idxProbe    = pProbeDesc->idxEnabled;
+
+        if (!pProv->fUmod)
+        {
+            if (!pProbeLocEn->fEnabled)
+            {
+                pProbeLocEn->fEnabled = 1;
+                ASMAtomicIncU32(&pProv->pacProbeEnabled[idxProbe]);
+            }
+        }
+        else
+        {
+            /* Update kernel mode structure */
+            if (!pProv->paR0ProbeLocs[idxProbeLoc].fEnabled)
+            {
+                pProv->paR0ProbeLocs[idxProbeLoc].fEnabled = 1;
+                ASMAtomicIncU32(&pProv->paR0Probes[idxProbe].cEnabled);
+            }
+
+            /* Update user mode structure. */
+            pProbeLocEn->fEnabled = 1;
+            pProv->pacProbeEnabled[idxProbe] = pProv->paR0Probes[idxProbe].cEnabled;
+        }
+    }
+
+    return 0;
+}
+
+
+/**
+ * @callback_method_impl{dtrace_pops_t,dtps_disable}
+ */
+static void     vboxDtPOps_Disable(void *pvProv, dtrace_id_t idProbe, void *pvProbe)
+{
+    PSUPDRVVDTPROVIDERCORE  pProv  = (PSUPDRVVDTPROVIDERCORE)pvProv;
+    AssertPtrReturnVoid(pProv);
+    LOG_DTRACE(("%s: %p / %p - %#x / %p\n", __FUNCTION__, pProv, pProv->TracerData.DTrace.idProvider, idProbe, pvProbe));
+    AssertPtrReturnVoid(pProv->TracerData.DTrace.idProvider);
+
+    if (!pProv->TracerData.DTrace.fZombie)
+    {
+        uint32_t        idxProbeLoc = (uint32_t)(uintptr_t)pvProbe;
+        PVTGPROBELOC32  pProbeLocEn = (PVTGPROBELOC32)(  (uintptr_t)pProv->pvProbeLocsEn + idxProbeLoc * pProv->cbProbeLocsEn);
+        PCVTGPROBELOC   pProbeLocRO = (PVTGPROBELOC)&pProv->paProbeLocsRO[idxProbeLoc];
+        PCVTGDESCPROBE  pProbeDesc  = pProbeLocRO->pProbe;
+        uint32_t const  idxProbe    = pProbeDesc->idxEnabled;
+
+        if (!pProv->fUmod)
+        {
+            if (pProbeLocEn->fEnabled)
+            {
+                pProbeLocEn->fEnabled = 0;
+                ASMAtomicDecU32(&pProv->pacProbeEnabled[idxProbe]);
+            }
+        }
+        else
+        {
+            /* Update kernel mode structure */
+            if (pProv->paR0ProbeLocs[idxProbeLoc].fEnabled)
+            {
+                pProv->paR0ProbeLocs[idxProbeLoc].fEnabled = 0;
+                ASMAtomicDecU32(&pProv->paR0Probes[idxProbe].cEnabled);
+            }
+
+            /* Update user mode structure. */
+            pProbeLocEn->fEnabled = 0;
+            pProv->pacProbeEnabled[idxProbe] = pProv->paR0Probes[idxProbe].cEnabled;
+        }
+    }
+}
+
+
+/**
+ * @callback_method_impl{dtrace_pops_t,dtps_getargdesc}
+ */
+static void     vboxDtPOps_GetArgDesc(void *pvProv, dtrace_id_t idProbe, void *pvProbe,
+                                      dtrace_argdesc_t *pArgDesc)
+{
+    PSUPDRVVDTPROVIDERCORE  pProv  = (PSUPDRVVDTPROVIDERCORE)pvProv;
+    unsigned                uArg   = pArgDesc->dtargd_ndx;
+
+    pArgDesc->dtargd_ndx = DTRACE_ARGNONE;
+    AssertPtrReturnVoid(pProv);
+    LOG_DTRACE(("%s: %p / %p - %#x / %p uArg=%d\n", __FUNCTION__, pProv, pProv->TracerData.DTrace.idProvider, idProbe, pvProbe, uArg));
+    AssertPtrReturnVoid(pProv->TracerData.DTrace.idProvider);
+
+    if (!pProv->TracerData.DTrace.fZombie)
+    {
+        uint32_t         idxProbeLoc = (uint32_t)(uintptr_t)pvProbe;
+        PCVTGPROBELOC    pProbeLocRO = (PVTGPROBELOC)&pProv->paProbeLocsRO[idxProbeLoc];
+        PCVTGDESCPROBE   pProbeDesc  = pProbeLocRO->pProbe;
+        PCVTGDESCARGLIST pArgList    = (PCVTGDESCARGLIST)(  (uintptr_t)pProv->pHdr
+                                                          + pProv->pHdr->offArgLists
+                                                          + pProbeDesc->offArgList);
+        AssertReturnVoid(pProbeDesc->offArgList < pProv->pHdr->cbArgLists);
+
+        if (uArg < pArgList->cArgs)
+        {
+            const char *pszType = vboxDtVtgGetString(pProv->pHdr, pArgList->aArgs[uArg].offType);
+            size_t      cchType = strlen(pszType);
+            if (cchType < sizeof(pArgDesc->dtargd_native))
+            {
+                memcpy(pArgDesc->dtargd_native, pszType, cchType + 1);
+                /** @todo mapping? */
+                pArgDesc->dtargd_ndx = uArg;
+                LOG_DTRACE(("%s: returns dtargd_native = %s\n", __FUNCTION__, pArgDesc->dtargd_native));
+                return;
+            }
+        }
+    }
+}
+
+
+/**
+ * @callback_method_impl{dtrace_pops_t,dtps_getargval}
+ */
+static uint64_t vboxDtPOps_GetArgVal(void *pvProv, dtrace_id_t idProbe, void *pvProbe,
+                                     int iArg, int cFrames)
+{
+    PSUPDRVVDTPROVIDERCORE  pProv = (PSUPDRVVDTPROVIDERCORE)pvProv;
+    AssertPtrReturn(pProv, UINT64_MAX);
+    LOG_DTRACE(("%s: %p / %p - %#x / %p iArg=%d cFrames=%u\n", __FUNCTION__, pProv, pProv->TracerData.DTrace.idProvider, idProbe, pvProbe, iArg, cFrames));
+    AssertReturn(iArg >= 5, UINT64_MAX);
+    if (pProv->TracerData.DTrace.fZombie)
+        return UINT64_MAX;
+
+    uint32_t                idxProbeLoc = (uint32_t)(uintptr_t)pvProbe;
+    PCVTGPROBELOC           pProbeLocRO = (PVTGPROBELOC)&pProv->paProbeLocsRO[idxProbeLoc];
+    PCVTGDESCPROBE          pProbeDesc  = pProbeLocRO->pProbe;
+    PCVTGDESCARGLIST        pArgList    = (PCVTGDESCARGLIST)(  (uintptr_t)pProv->pHdr
+                                                             + pProv->pHdr->offArgLists
+                                                             + pProbeDesc->offArgList);
+    AssertReturn(pProbeDesc->offArgList < pProv->pHdr->cbArgLists, UINT64_MAX);
+
+    PVBDTSTACKDATA          pData = vboxDtGetStackData();
+
+    /*
+     * Get the stack data. This is a wee bit complicated on 32-bit systems
+     * since we want to support 64-bit integer arguments.
+     */
+    uint64_t u64Ret;
+    if (iArg >= 20)
+        u64Ret = UINT64_MAX;
+    else if (pData->enmCaller == kVBoxDtCaller_ProbeFireKernel)
+    {
+#if ARCH_BITS == 64
+        u64Ret = pData->u.ProbeFireKernel.pauStackArgs[iArg - 5];
+#else
+        if (   !pArgList->fHaveLargeArgs
+            || iArg >= pArgList->cArgs)
+            u64Ret = pData->u.ProbeFireKernel.pauStackArgs[iArg - 5];
+        else
+        {
+            /* Similar to what we did for mac in when calling dtrace_probe(). */
+            uint32_t offArg = 0;
+            for (int i = 5; i < iArg; i++)
+                if (VTG_TYPE_IS_LARGE(pArgList->aArgs[iArg].fType))
+                    offArg++;
+            u64Ret = pData->u.ProbeFireKernel.pauStackArgs[iArg - 5 + offArg];
+            if (VTG_TYPE_IS_LARGE(pArgList->aArgs[iArg].fType))
+                u64Ret |= (uint64_t)pData->u.ProbeFireKernel.pauStackArgs[iArg - 5 + offArg + 1] << 32;
+        }
+#endif
+    }
+    else if (pData->enmCaller == kVBoxDtCaller_ProbeFireUser)
+    {
+        int                     offArg    = pData->u.ProbeFireUser.offArg;
+        PCSUPDRVTRACERUSRCTX    pCtx      = pData->u.ProbeFireUser.pCtx;
+        AssertPtrReturn(pCtx, UINT64_MAX);
+
+        if (pCtx->cBits == 32)
+        {
+            if (   !pArgList->fHaveLargeArgs
+                || iArg >= pArgList->cArgs)
+            {
+                if (iArg + offArg < (int)RT_ELEMENTS(pCtx->u.X86.aArgs))
+                    u64Ret = pCtx->u.X86.aArgs[iArg + offArg];
+                else
+                    u64Ret = UINT64_MAX;
+            }
+            else
+            {
+                for (int i = 5; i < iArg; i++)
+                    if (VTG_TYPE_IS_LARGE(pArgList->aArgs[iArg].fType))
+                        offArg++;
+                if (offArg + iArg < (int)RT_ELEMENTS(pCtx->u.X86.aArgs))
+                {
+                    u64Ret = pCtx->u.X86.aArgs[iArg + offArg];
+                    if (   VTG_TYPE_IS_LARGE(pArgList->aArgs[iArg].fType)
+                        && offArg + iArg + 1 < (int)RT_ELEMENTS(pCtx->u.X86.aArgs))
+                        u64Ret |= (uint64_t)pCtx->u.X86.aArgs[iArg + offArg + 1] << 32;
+                }
+                else
+                    u64Ret = UINT64_MAX;
+            }
+        }
+        else
+        {
+            if (iArg + offArg < (int)RT_ELEMENTS(pCtx->u.Amd64.aArgs))
+                u64Ret = pCtx->u.Amd64.aArgs[iArg + offArg];
+            else
+                u64Ret = UINT64_MAX;
+        }
+    }
+    else
+        AssertFailedReturn(UINT64_MAX);
+
+    LOG_DTRACE(("%s: returns %#llx\n", __FUNCTION__, u64Ret));
+    return u64Ret;
+}
+
+
+/**
+ * @callback_method_impl{dtrace_pops_t,dtps_destroy}
+ */
+static void    vboxDtPOps_Destroy(void *pvProv, dtrace_id_t idProbe, void *pvProbe)
+{
+    PSUPDRVVDTPROVIDERCORE  pProv  = (PSUPDRVVDTPROVIDERCORE)pvProv;
+    AssertPtrReturnVoid(pProv);
+    LOG_DTRACE(("%s: %p / %p - %#x / %p\n", __FUNCTION__, pProv, pProv->TracerData.DTrace.idProvider, idProbe, pvProbe));
+    AssertReturnVoid(pProv->TracerData.DTrace.cProvidedProbes > 0);
+    AssertPtrReturnVoid(pProv->TracerData.DTrace.idProvider);
+
+    if (!pProv->TracerData.DTrace.fZombie)
+    {
+        uint32_t        idxProbeLoc = (uint32_t)(uintptr_t)pvProbe;
+        PCVTGPROBELOC   pProbeLocRO = (PVTGPROBELOC)&pProv->paProbeLocsRO[idxProbeLoc];
+        uint32_t       *pidProbe;
+        if (!pProv->fUmod)
+        {
+            pidProbe = (uint32_t *)&pProbeLocRO->idProbe;
+            Assert(!pProbeLocRO->fEnabled);
+            Assert(*pidProbe == idProbe);
+        }
+        else
+        {
+            pidProbe = &pProv->paR0ProbeLocs[idxProbeLoc].idProbe;
+            Assert(!pProv->paR0ProbeLocs[idxProbeLoc].fEnabled);
+            Assert(*pidProbe == idProbe); NOREF(idProbe);
+        }
+        *pidProbe = 0;
+    }
+    pProv->TracerData.DTrace.cProvidedProbes--;
+}
+
+
+
+/**
+ * DTrace provider method table.
+ */
+static const dtrace_pops_t g_vboxDtVtgProvOps =
+{
+    /* .dtps_provide         = */ vboxDtPOps_Provide,
+    /* .dtps_provide_module  = */ NULL,
+    /* .dtps_enable          = */ vboxDtPOps_Enable,
+    /* .dtps_disable         = */ vboxDtPOps_Disable,
+    /* .dtps_suspend         = */ NULL,
+    /* .dtps_resume          = */ NULL,
+    /* .dtps_getargdesc      = */ vboxDtPOps_GetArgDesc,
+    /* .dtps_getargval       = */ vboxDtPOps_GetArgVal,
+    /* .dtps_usermode        = */ NULL,
+    /* .dtps_destroy         = */ vboxDtPOps_Destroy
+};
+
+
+
+
+/*
+ *
+ * Support Driver Tracer Interface.
+ * Support Driver Tracer Interface.
+ * Support Driver Tracer Interface.
+ *
+ */
+
+
+
+/**
+ * interface_method_impl{SUPDRVTRACERREG,pfnProbeFireKernel}
+ */
+static DECLCALLBACK(void) vboxDtTOps_ProbeFireKernel(struct VTGPROBELOC *pVtgProbeLoc, uintptr_t uArg0, uintptr_t uArg1, uintptr_t uArg2,
+                                                     uintptr_t uArg3, uintptr_t uArg4)
+{
+    AssertPtrReturnVoid(pVtgProbeLoc);
+    LOG_DTRACE(("%s: %p / %p\n", __FUNCTION__, pVtgProbeLoc, pVtgProbeLoc->idProbe));
+    AssertPtrReturnVoid(pVtgProbeLoc->pProbe);
+    AssertPtrReturnVoid(pVtgProbeLoc->pszFunction);
+
+    VBDT_SETUP_STACK_DATA(kVBoxDtCaller_ProbeFireKernel);
+
+    pStackData->u.ProbeFireKernel.pauStackArgs  = &uArg4 + 1;
+
+#if defined(RT_OS_DARWIN) && ARCH_BITS == 32
+    /*
+     * Convert arguments from uintptr_t to uint64_t.
+     */
+    PVTGDESCPROBE   pProbe   = pVtgProbeLoc->pProbe;
+    AssertPtrReturnVoid(pProbe);
+    PVTGOBJHDR      pVtgHdr  = (PVTGOBJHDR)((uintptr_t)pProbe + pProbe->offObjHdr);
+    AssertPtrReturnVoid(pVtgHdr);
+    PVTGDESCARGLIST pArgList = (PVTGDESCARGLIST)((uintptr_t)pVtgHdr + pVtgHdr->offArgLists + pProbe->offArgList);
+    AssertPtrReturnVoid(pArgList);
+    if (!pArgList->fHaveLargeArgs)
+        dtrace_probe(pVtgProbeLoc->idProbe, uArg0, uArg1, uArg2, uArg3, uArg4);
+    else
+    {
+        uintptr_t *auSrcArgs = &uArg0;
+        uint32_t   iSrcArg   = 0;
+        uint32_t   iDstArg   = 0;
+        uint64_t   au64DstArgs[5];
+
+        while (   iDstArg < RT_ELEMENTS(au64DstArgs)
+               && iSrcArg < pArgList->cArgs)
+        {
+            au64DstArgs[iDstArg] = auSrcArgs[iSrcArg];
+            if (VTG_TYPE_IS_LARGE(pArgList->aArgs[iDstArg].fType))
+                au64DstArgs[iDstArg] |= (uint64_t)auSrcArgs[++iSrcArg] << 32;
+            iSrcArg++;
+            iDstArg++;
+        }
+        while (iDstArg < RT_ELEMENTS(au64DstArgs))
+            au64DstArgs[iDstArg++] = auSrcArgs[iSrcArg++];
+
+        pStackData->u.ProbeFireKernel.pauStackArgs = &auSrcArgs[iSrcArg];
+        dtrace_probe(pVtgProbeLoc->idProbe, au64DstArgs[0], au64DstArgs[1], au64DstArgs[2], au64DstArgs[3], au64DstArgs[4]);
+    }
+#else
+    dtrace_probe(pVtgProbeLoc->idProbe, uArg0, uArg1, uArg2, uArg3, uArg4);
+#endif
+
+    VBDT_CLEAR_STACK_DATA();
+    LOG_DTRACE(("%s: returns\n", __FUNCTION__));
+}
+
+
+/**
+ * interface_method_impl{SUPDRVTRACERREG,pfnProbeFireUser}
+ */
+static DECLCALLBACK(void) vboxDtTOps_ProbeFireUser(PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, PCSUPDRVTRACERUSRCTX pCtx,
+                                                   PCVTGOBJHDR pVtgHdr, PCVTGPROBELOC pProbeLocRO)
+{
+    LOG_DTRACE(("%s: %p / %p\n", __FUNCTION__, pCtx, pCtx->idProbe));
+    AssertPtrReturnVoid(pProbeLocRO);
+    AssertPtrReturnVoid(pVtgHdr);
+
+    VBDT_SETUP_STACK_DATA(kVBoxDtCaller_ProbeFireUser);
+
+    if (pCtx->cBits == 32)
+    {
+        pStackData->u.ProbeFireUser.pCtx   = pCtx;
+        pStackData->u.ProbeFireUser.offArg = 0;
+
+#if ARCH_BITS == 64 || defined(RT_OS_DARWIN)
+        /*
+         * Combine two 32-bit arguments into one 64-bit argument where needed.
+         */
+        PVTGDESCPROBE   pProbeDesc = pProbeLocRO->pProbe;
+        AssertPtrReturnVoid(pProbeDesc);
+        PVTGDESCARGLIST pArgList   = (PVTGDESCARGLIST)((uintptr_t)pVtgHdr + pVtgHdr->offArgLists + pProbeDesc->offArgList);
+        AssertPtrReturnVoid(pArgList);
+
+        if (!pArgList->fHaveLargeArgs)
+            dtrace_probe(pCtx->idProbe,
+                         pCtx->u.X86.aArgs[0],
+                         pCtx->u.X86.aArgs[1],
+                         pCtx->u.X86.aArgs[2],
+                         pCtx->u.X86.aArgs[3],
+                         pCtx->u.X86.aArgs[4]);
+        else
+        {
+            uint32_t const *auSrcArgs = &pCtx->u.X86.aArgs[0];
+            uint32_t        iSrcArg   = 0;
+            uint32_t        iDstArg   = 0;
+            uint64_t        au64DstArgs[5];
+
+            while (   iDstArg < RT_ELEMENTS(au64DstArgs)
+                   && iSrcArg < pArgList->cArgs)
+            {
+                au64DstArgs[iDstArg] = auSrcArgs[iSrcArg];
+                if (VTG_TYPE_IS_LARGE(pArgList->aArgs[iDstArg].fType))
+                    au64DstArgs[iDstArg] |= (uint64_t)auSrcArgs[++iSrcArg] << 32;
+                iSrcArg++;
+                iDstArg++;
+            }
+            while (iDstArg < RT_ELEMENTS(au64DstArgs))
+                au64DstArgs[iDstArg++] = auSrcArgs[iSrcArg++];
+
+            pStackData->u.ProbeFireUser.offArg = iSrcArg - RT_ELEMENTS(au64DstArgs);
+            dtrace_probe(pCtx->idProbe, au64DstArgs[0], au64DstArgs[1], au64DstArgs[2], au64DstArgs[3], au64DstArgs[4]);
+        }
+#else
+        dtrace_probe(pCtx->idProbe,
+                     pCtx->u.X86.aArgs[0],
+                     pCtx->u.X86.aArgs[1],
+                     pCtx->u.X86.aArgs[2],
+                     pCtx->u.X86.aArgs[3],
+                     pCtx->u.X86.aArgs[4]);
+#endif
+    }
+    else if (pCtx->cBits == 64)
+    {
+        pStackData->u.ProbeFireUser.pCtx   = pCtx;
+        pStackData->u.ProbeFireUser.offArg = 0;
+        dtrace_probe(pCtx->idProbe,
+                     pCtx->u.Amd64.aArgs[0],
+                     pCtx->u.Amd64.aArgs[1],
+                     pCtx->u.Amd64.aArgs[2],
+                     pCtx->u.Amd64.aArgs[3],
+                     pCtx->u.Amd64.aArgs[4]);
+    }
+    else
+        AssertFailed();
+
+    VBDT_CLEAR_STACK_DATA();
+    LOG_DTRACE(("%s: returns\n", __FUNCTION__));
+}
+
+
+/**
+ * interface_method_impl{SUPDRVTRACERREG,pfnTracerOpen}
+ */
+static DECLCALLBACK(int) vboxDtTOps_TracerOpen(PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, uint32_t uCookie,
+                                               uintptr_t uArg, uintptr_t *puSessionData)
+{
+    if (uCookie != RT_MAKE_U32_FROM_U8('V', 'B', 'D', 'T'))
+        return VERR_INVALID_MAGIC;
+    if (uArg)
+        return VERR_INVALID_PARAMETER;
+
+    VBDT_SETUP_STACK_DATA(kVBoxDtCaller_Generic);
+
+    int rc = dtrace_open((dtrace_state_t **)puSessionData, VBoxDtGetCurrentCreds());
+
+    VBDT_CLEAR_STACK_DATA();
+    return RTErrConvertFromErrno(rc);
+}
+
+
+/**
+ * interface_method_impl{SUPDRVTRACERREG,pfnTracerClose}
+ */
+static DECLCALLBACK(int) vboxDtTOps_TracerIoCtl(PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, uintptr_t uSessionData,
+                                                uintptr_t uCmd, uintptr_t uArg, int32_t *piRetVal)
+{
+    AssertPtrReturn(uSessionData, VERR_INVALID_POINTER);
+    VBDT_SETUP_STACK_DATA(kVBoxDtCaller_Generic);
+
+    int rc = dtrace_ioctl((dtrace_state_t *)uSessionData, (intptr_t)uCmd, (intptr_t)uArg, piRetVal);
+
+    VBDT_CLEAR_STACK_DATA();
+    return RTErrConvertFromErrno(rc);
+}
+
+
+/**
+ * interface_method_impl{SUPDRVTRACERREG,pfnTracerClose}
+ */
+static DECLCALLBACK(void) vboxDtTOps_TracerClose(PCSUPDRVTRACERREG pThis, PSUPDRVSESSION pSession, uintptr_t uSessionData)
+{
+    AssertPtrReturnVoid(uSessionData);
+    VBDT_SETUP_STACK_DATA(kVBoxDtCaller_Generic);
+
+    dtrace_close((dtrace_state_t *)uSessionData);
+
+    VBDT_CLEAR_STACK_DATA();
+}
+
+
+/**
+ * interface_method_impl{SUPDRVTRACERREG,pfnProviderRegister}
+ */
+static DECLCALLBACK(int) vboxDtTOps_ProviderRegister(PCSUPDRVTRACERREG pThis, PSUPDRVVDTPROVIDERCORE pCore)
+{
+    LOG_DTRACE(("%s: %p %s/%s\n", __FUNCTION__, pThis, pCore->pszModName, pCore->pszName));
+    AssertReturn(pCore->TracerData.DTrace.idProvider == 0, VERR_INTERNAL_ERROR_3);
+    VBDT_SETUP_STACK_DATA(kVBoxDtCaller_Generic);
+
+    PVTGDESCPROVIDER    pDesc = pCore->pDesc;
+    dtrace_pattr_t      DtAttrs;
+    vboxDtVtgConvAttr(&DtAttrs.dtpa_provider, &pDesc->AttrSelf);
+    vboxDtVtgConvAttr(&DtAttrs.dtpa_mod,      &pDesc->AttrModules);
+    vboxDtVtgConvAttr(&DtAttrs.dtpa_func,     &pDesc->AttrFunctions);
+    vboxDtVtgConvAttr(&DtAttrs.dtpa_name,     &pDesc->AttrNames);
+    vboxDtVtgConvAttr(&DtAttrs.dtpa_args,     &pDesc->AttrArguments);
+
+    /* Note! DTrace may call us back before dtrace_register returns, so we
+             have to point it to pCore->TracerData.DTrace.idProvider. */
+    AssertCompile(sizeof(dtrace_provider_id_t) == sizeof(pCore->TracerData.DTrace.idProvider));
+    int rc = dtrace_register(pCore->pszName,
+                             &DtAttrs,
+                             DTRACE_PRIV_KERNEL,
+                             NULL /* cred */,
+                             &g_vboxDtVtgProvOps,
+                             pCore,
+                             &pCore->TracerData.DTrace.idProvider);
+    if (!rc)
+    {
+        LOG_DTRACE(("%s: idProvider=%p\n", __FUNCTION__, pCore->TracerData.DTrace.idProvider));
+        AssertPtr(pCore->TracerData.DTrace.idProvider);
+        rc = VINF_SUCCESS;
+    }
+    else
+    {
+        pCore->TracerData.DTrace.idProvider = 0;
+        rc = RTErrConvertFromErrno(rc);
+    }
+
+    VBDT_CLEAR_STACK_DATA();
+    LOG_DTRACE(("%s: returns %Rrc\n", __FUNCTION__, rc));
+    return rc;
+}
+
+
+/**
+ * interface_method_impl{SUPDRVTRACERREG,pfnProviderDeregister}
+ */
+static DECLCALLBACK(int) vboxDtTOps_ProviderDeregister(PCSUPDRVTRACERREG pThis, PSUPDRVVDTPROVIDERCORE pCore)
+{
+    uintptr_t idProvider = pCore->TracerData.DTrace.idProvider;
+    LOG_DTRACE(("%s: %p / %p\n", __FUNCTION__, pThis, idProvider));
+    AssertPtrReturn(idProvider, VERR_INTERNAL_ERROR_3);
+    VBDT_SETUP_STACK_DATA(kVBoxDtCaller_Generic);
+
+    dtrace_invalidate(idProvider);
+    int rc = dtrace_unregister(idProvider);
+    if (!rc)
+    {
+        pCore->TracerData.DTrace.idProvider = 0;
+        rc = VINF_SUCCESS;
+    }
+    else
+    {
+        AssertMsg(rc == EBUSY, ("%d\n", rc));
+        pCore->TracerData.DTrace.fZombie = true;
+        rc = VERR_TRY_AGAIN;
+    }
+
+    VBDT_CLEAR_STACK_DATA();
+    LOG_DTRACE(("%s: returns %Rrc\n", __FUNCTION__, rc));
+    return rc;
+}
+
+
+/**
+ * interface_method_impl{SUPDRVTRACERREG,pfnProviderDeregisterZombie}
+ */
+static DECLCALLBACK(int) vboxDtTOps_ProviderDeregisterZombie(PCSUPDRVTRACERREG pThis, PSUPDRVVDTPROVIDERCORE pCore)
+{
+    uintptr_t idProvider = pCore->TracerData.DTrace.idProvider;
+    LOG_DTRACE(("%s: %p / %p\n", __FUNCTION__, pThis, idProvider));
+    AssertPtrReturn(idProvider, VERR_INTERNAL_ERROR_3);
+    Assert(pCore->TracerData.DTrace.fZombie);
+    VBDT_SETUP_STACK_DATA(kVBoxDtCaller_Generic);
+
+    int rc = dtrace_unregister(idProvider);
+    if (!rc)
+    {
+        pCore->TracerData.DTrace.idProvider = 0;
+        rc = VINF_SUCCESS;
+    }
+    else
+    {
+        AssertMsg(rc == EBUSY, ("%d\n", rc));
+        rc = VERR_TRY_AGAIN;
+    }
+
+    VBDT_CLEAR_STACK_DATA();
+    LOG_DTRACE(("%s: returns %Rrc\n", __FUNCTION__, rc));
+    return rc;
+}
+
+
+
+/**
+ * The tracer registration record of the VBox DTrace implementation
+ */
+static SUPDRVTRACERREG g_VBoxDTraceReg =
+{
+    SUPDRVTRACERREG_MAGIC,
+    SUPDRVTRACERREG_VERSION,
+    vboxDtTOps_ProbeFireKernel,
+    vboxDtTOps_ProbeFireUser,
+    vboxDtTOps_TracerOpen,
+    vboxDtTOps_TracerIoCtl,
+    vboxDtTOps_TracerClose,
+    vboxDtTOps_ProviderRegister,
+    vboxDtTOps_ProviderDeregister,
+    vboxDtTOps_ProviderDeregisterZombie,
+    SUPDRVTRACERREG_MAGIC
+};
+
+
+
+/**
+ * Module termination code.
+ *
+ * @param   hMod            Opque module handle.
+ */
+DECLEXPORT(void) ModuleTerm(void *hMod)
+{
+    SUPR0TracerDeregisterImpl(hMod, NULL);
+    dtrace_detach();
+}
+
+
+/**
+ * Module initialization code.
+ *
+ * @param   hMod            Opque module handle.
+ */
+DECLEXPORT(int)  ModuleInit(void *hMod)
+{
+    int rc = dtrace_attach();
+    if (rc == DDI_SUCCESS)
+    {
+        rc = SUPR0TracerRegisterImpl(hMod, NULL, &g_VBoxDTraceReg, &g_pVBoxDTraceHlp);
+        if (RT_SUCCESS(rc))
+            return rc;
+
+        dtrace_detach();
+    }
+    else
+    {
+        SUPR0Printf("dtrace_attach -> %d\n", rc);
+        rc = VERR_INTERNAL_ERROR_5;
+    }
+
+    return rc;
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0A.asm b/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0A.asm
new file mode 100644
index 0000000..2505ef8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0A.asm
@@ -0,0 +1,32 @@
+; $Id: VBoxDTraceR0A.asm $
+;; @file
+; VBoxDTraceR0 - Assembly Hacks.
+;  
+; Contributed by: bird 
+;
+
+;
+; Copyright (C) 2012-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the Common
+; Development and Distribution License Version 1.0 (CDDL) only, as it
+; comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution.
+; VirtualBox OSE is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY of any kind.
+;
+
+
+
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+
+extern NAME(dtrace_probe)
+
+GLOBALNAME dtrace_probe6
+    jmp     NAME(dtrace_probe)
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceWrapper.cpp b/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceWrapper.cpp
new file mode 100644
index 0000000..cac34c0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceWrapper.cpp
@@ -0,0 +1,202 @@
+/* $Id: VBoxDTraceWrapper.cpp $ */
+/** @file
+ * VBoxDTrace - Wrapper that selects the right dtrace implemetation and adds
+ *              our library to the search path.
+ */
+
+/*
+ * Copyright (C) 2016 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the Common
+ * Development and Distribution License Version 1.0 (CDDL) only, as it
+ * comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution.
+ * VirtualBox OSE is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY of any kind.
+ *
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/buildconfig.h>
+#include <iprt/env.h>
+#include <iprt/file.h>
+#include <iprt/initterm.h>
+#include <iprt/ldr.h>
+#include <iprt/message.h>
+#include <iprt/path.h>
+#include <iprt/process.h>
+#include <iprt/string.h>
+
+#include <VBox/sup.h>
+
+#include "../../Main/include/ExtPackUtil.h"
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** The VBoxDTrace extension pack name.   */
+#define VBOX_EXTPACK_VBOXDTRACE_NAME            "Oracle VBoxDTrace Extension Pack"
+/** The mangled version of VBOX_EXTPACK_VBOXDTRACE_NAME (also in Config.kmk). */
+#define VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME    "Oracle_VBoxDTrace_Extension_Pack"
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/** The main function of VBoxDTrace.so/dylib/dll. */
+typedef int (RTCALL *PFNVBOXDTRACEMAIN)(int argc, char **argv);
+
+
+int main(int argc, char **argv)
+{
+    /*
+     * Init IPRT.
+     */
+    int rc = RTR3InitExe(argc, &argv, 0);
+    if (RT_FAILURE(rc))
+        return RTMsgInitFailure(rc);
+
+    /*
+     * Locate a native DTrace command binary.
+     */
+    bool fIsNativeDTrace = false;
+    char szDTraceCmd[RTPATH_MAX];
+    szDTraceCmd[0] = '\0';
+
+#if defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) || defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
+    /*
+     * 1. Try native first on platforms where it's applicable.
+     */
+    static const char * const s_apszNativeDTrace[] =
+    {
+        "/usr/sbin/dtrace",
+        "/sbin/dtrace",
+        "/usr/bin/dtrace",
+        "/bin/dtrace",
+        "/usr/local/sbin/dtrace",
+        "/usr/local/bin/dtrace"
+    };
+    if (!RTEnvExist("VBOX_DTRACE_NO_NATIVE"))
+        for (uint32_t i = 0; i < RT_ELEMENTS(s_apszNativeDTrace); i++)
+            if (RTFileExists(s_apszNativeDTrace[i]))
+            {
+                fIsNativeDTrace = true;
+                strcpy(szDTraceCmd, s_apszNativeDTrace[i]);
+# ifdef RT_OS_LINUX
+                /** @todo Warn if the dtrace modules haven't been loaded or vboxdrv isn't
+                 *        compiled against them. */
+# endif
+                break;
+            }
+    if (szDTraceCmd[0] == '\0')
+#endif
+    {
+        /*
+         * 2. VBoxDTrace extension pack installed?
+         *
+         * Note! We cannot use the COM API here because this program is usually
+         *       run thru sudo or directly as root, even if the target
+         *       VirtualBox process is running as regular user.  This is due to
+         *       the privileges required to run dtrace scripts on a host.
+         */
+        rc = RTPathAppPrivateArch(szDTraceCmd, sizeof(szDTraceCmd));
+        if (RT_SUCCESS(rc))
+            rc = RTPathAppend(szDTraceCmd, sizeof(szDTraceCmd),
+                              VBOX_EXTPACK_INSTALL_DIR RTPATH_SLASH_STR VBOX_EXTPACK_VBOXDTRACE_MANGLED_NAME);
+        if (RT_SUCCESS(rc))
+            rc = RTPathAppend(szDTraceCmd, sizeof(szDTraceCmd), RTBldCfgTargetDotArch());
+        if (RT_SUCCESS(rc))
+            rc = RTPathAppend(szDTraceCmd, sizeof(szDTraceCmd), "VBoxDTraceCmd");
+        if (RT_SUCCESS(rc))
+            rc = RTStrCat(szDTraceCmd, sizeof(szDTraceCmd), RTLdrGetSuff());
+        if (RT_FAILURE(rc))
+            return RTMsgErrorExit(RTEXITCODE_FAILURE, "Error constructing extension pack path: %Rrc", rc);
+        if (!RTFileExists(szDTraceCmd))
+            return RTMsgErrorExit(RTEXITCODE_FAILURE,
+                                  "Unable to find a DTrace implementation. VBoxDTrace Extension Pack installed?");
+        fIsNativeDTrace = false;
+    }
+
+
+    /*
+     * Construct a new command line that includes our libary.
+     */
+    char szDTraceLibDir[RTPATH_MAX];
+    rc = RTPathAppPrivateNoArch(szDTraceLibDir, sizeof(szDTraceLibDir));
+    if (RT_SUCCESS(rc))
+        rc = RTPathAppend(szDTraceLibDir, sizeof(szDTraceLibDir), "dtrace" RTPATH_SLASH_STR "lib");
+    if (RT_SUCCESS(rc))
+        rc = RTPathAppend(szDTraceLibDir, sizeof(szDTraceLibDir), RTBldCfgTargetArch());
+    if (RT_FAILURE(rc))
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Error constructing dtrace library path for VBox: %Rrc", rc);
+
+    char **papszArgs = (char **)RTMemAlloc((argc + 3) * sizeof(char *));
+    if (!papszArgs)
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "No memory for argument list.");
+
+    int cArgs    = 1;
+    papszArgs[0] = fIsNativeDTrace ? szDTraceCmd : argv[0];
+    if (argc > 1)
+    {
+        papszArgs[cArgs++] = (char *)"-L";
+        papszArgs[cArgs++] = szDTraceLibDir;
+    }
+    for (int i = 1; i < argc; i++)
+        papszArgs[cArgs++] = argv[i];
+    papszArgs[cArgs] = NULL;
+    Assert(cArgs <= argc + 3);
+
+
+    /*
+     * The native DTrace we execute as a sub-process and wait for.
+     */
+    RTEXITCODE rcExit;
+    if (fIsNativeDTrace)
+    {
+        RTPROCESS hProc;
+        rc = RTProcCreate(szDTraceCmd, papszArgs, RTENV_DEFAULT, 0, &hProc);
+        if (RT_SUCCESS(rc))
+        {
+            RTPROCSTATUS Status;
+            rc = RTProcWait(hProc, RTPROCWAIT_FLAGS_BLOCK, &Status);
+            if (RT_SUCCESS(rc))
+            {
+                if (Status.enmReason == RTPROCEXITREASON_NORMAL)
+                    rcExit = (RTEXITCODE)Status.iStatus;
+                else
+                    rcExit = RTEXITCODE_FAILURE;
+            }
+            else
+                rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Error waiting for child process: %Rrc", rc);
+        }
+        else
+            rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Error executing '%s': %Rrc", szDTraceCmd, rc);
+    }
+    /*
+     * While the VBoxDTrace we load and call the main function of.
+     */
+    else
+    {
+        RTERRINFOSTATIC ErrInfo;
+        RTLDRMOD hMod;
+        rc = SUPR3HardenedLdrLoadPlugIn(szDTraceCmd, &hMod, RTErrInfoInitStatic(&ErrInfo));
+        if (RT_SUCCESS(rc))
+        {
+            PFNVBOXDTRACEMAIN pfnVBoxDTraceMain;
+            rc = RTLdrGetSymbol(hMod, "VBoxDTraceMain", (void **)&pfnVBoxDTraceMain);
+            if (RT_SUCCESS(rc))
+                rcExit = (RTEXITCODE)pfnVBoxDTraceMain(cArgs, papszArgs);
+            else
+                rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Error locating 'VBoxDTraceMain' in '%s': %Rrc", szDTraceCmd, rc);
+        }
+        else
+            rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Error loading '%s': %Rrc (%s)", szDTraceCmd, rc, ErrInfo.szMsg);
+    }
+    return rcExit;
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/generated/dt_grammar.c b/src/VBox/ExtPacks/VBoxDTrace/generated/dt_grammar.c
new file mode 100644
index 0000000..e8102ef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/generated/dt_grammar.c
@@ -0,0 +1,3358 @@
+/* A Bison parser, made by GNU Bison 2.3.  */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+   simplifying the original so-called "semantic" parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Bison version.  */
+#define YYBISON_VERSION "2.3"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Using locations.  */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     DT_TOK_EOF = 0,
+     DT_TOK_COMMA = 258,
+     DT_TOK_ELLIPSIS = 259,
+     DT_TOK_ASGN = 260,
+     DT_TOK_ADD_EQ = 261,
+     DT_TOK_SUB_EQ = 262,
+     DT_TOK_MUL_EQ = 263,
+     DT_TOK_DIV_EQ = 264,
+     DT_TOK_MOD_EQ = 265,
+     DT_TOK_AND_EQ = 266,
+     DT_TOK_XOR_EQ = 267,
+     DT_TOK_OR_EQ = 268,
+     DT_TOK_LSH_EQ = 269,
+     DT_TOK_RSH_EQ = 270,
+     DT_TOK_QUESTION = 271,
+     DT_TOK_COLON = 272,
+     DT_TOK_LOR = 273,
+     DT_TOK_LXOR = 274,
+     DT_TOK_LAND = 275,
+     DT_TOK_BOR = 276,
+     DT_TOK_XOR = 277,
+     DT_TOK_BAND = 278,
+     DT_TOK_EQU = 279,
+     DT_TOK_NEQ = 280,
+     DT_TOK_LT = 281,
+     DT_TOK_LE = 282,
+     DT_TOK_GT = 283,
+     DT_TOK_GE = 284,
+     DT_TOK_LSH = 285,
+     DT_TOK_RSH = 286,
+     DT_TOK_ADD = 287,
+     DT_TOK_SUB = 288,
+     DT_TOK_MUL = 289,
+     DT_TOK_DIV = 290,
+     DT_TOK_MOD = 291,
+     DT_TOK_LNEG = 292,
+     DT_TOK_BNEG = 293,
+     DT_TOK_ADDADD = 294,
+     DT_TOK_SUBSUB = 295,
+     DT_TOK_PREINC = 296,
+     DT_TOK_POSTINC = 297,
+     DT_TOK_PREDEC = 298,
+     DT_TOK_POSTDEC = 299,
+     DT_TOK_IPOS = 300,
+     DT_TOK_INEG = 301,
+     DT_TOK_DEREF = 302,
+     DT_TOK_ADDROF = 303,
+     DT_TOK_OFFSETOF = 304,
+     DT_TOK_SIZEOF = 305,
+     DT_TOK_STRINGOF = 306,
+     DT_TOK_XLATE = 307,
+     DT_TOK_LPAR = 308,
+     DT_TOK_RPAR = 309,
+     DT_TOK_LBRAC = 310,
+     DT_TOK_RBRAC = 311,
+     DT_TOK_PTR = 312,
+     DT_TOK_DOT = 313,
+     DT_TOK_STRING = 314,
+     DT_TOK_IDENT = 315,
+     DT_TOK_PSPEC = 316,
+     DT_TOK_AGG = 317,
+     DT_TOK_TNAME = 318,
+     DT_TOK_INT = 319,
+     DT_KEY_AUTO = 320,
+     DT_KEY_BREAK = 321,
+     DT_KEY_CASE = 322,
+     DT_KEY_CHAR = 323,
+     DT_KEY_CONST = 324,
+     DT_KEY_CONTINUE = 325,
+     DT_KEY_COUNTER = 326,
+     DT_KEY_DEFAULT = 327,
+     DT_KEY_DO = 328,
+     DT_KEY_DOUBLE = 329,
+     DT_KEY_ELSE = 330,
+     DT_KEY_ENUM = 331,
+     DT_KEY_EXTERN = 332,
+     DT_KEY_FLOAT = 333,
+     DT_KEY_FOR = 334,
+     DT_KEY_GOTO = 335,
+     DT_KEY_IF = 336,
+     DT_KEY_IMPORT = 337,
+     DT_KEY_INLINE = 338,
+     DT_KEY_INT = 339,
+     DT_KEY_LONG = 340,
+     DT_KEY_PROBE = 341,
+     DT_KEY_PROVIDER = 342,
+     DT_KEY_REGISTER = 343,
+     DT_KEY_RESTRICT = 344,
+     DT_KEY_RETURN = 345,
+     DT_KEY_SELF = 346,
+     DT_KEY_SHORT = 347,
+     DT_KEY_SIGNED = 348,
+     DT_KEY_STATIC = 349,
+     DT_KEY_STRING = 350,
+     DT_KEY_STRUCT = 351,
+     DT_KEY_SWITCH = 352,
+     DT_KEY_THIS = 353,
+     DT_KEY_TYPEDEF = 354,
+     DT_KEY_UNION = 355,
+     DT_KEY_UNSIGNED = 356,
+     DT_KEY_VOID = 357,
+     DT_KEY_VOLATILE = 358,
+     DT_KEY_WHILE = 359,
+     DT_KEY_XLATOR = 360,
+     DT_TOK_EPRED = 361,
+     DT_CTX_DEXPR = 362,
+     DT_CTX_DPROG = 363,
+     DT_CTX_DTYPE = 364
+   };
+#endif
+/* Tokens.  */
+#define DT_TOK_EOF 0
+#define DT_TOK_COMMA 258
+#define DT_TOK_ELLIPSIS 259
+#define DT_TOK_ASGN 260
+#define DT_TOK_ADD_EQ 261
+#define DT_TOK_SUB_EQ 262
+#define DT_TOK_MUL_EQ 263
+#define DT_TOK_DIV_EQ 264
+#define DT_TOK_MOD_EQ 265
+#define DT_TOK_AND_EQ 266
+#define DT_TOK_XOR_EQ 267
+#define DT_TOK_OR_EQ 268
+#define DT_TOK_LSH_EQ 269
+#define DT_TOK_RSH_EQ 270
+#define DT_TOK_QUESTION 271
+#define DT_TOK_COLON 272
+#define DT_TOK_LOR 273
+#define DT_TOK_LXOR 274
+#define DT_TOK_LAND 275
+#define DT_TOK_BOR 276
+#define DT_TOK_XOR 277
+#define DT_TOK_BAND 278
+#define DT_TOK_EQU 279
+#define DT_TOK_NEQ 280
+#define DT_TOK_LT 281
+#define DT_TOK_LE 282
+#define DT_TOK_GT 283
+#define DT_TOK_GE 284
+#define DT_TOK_LSH 285
+#define DT_TOK_RSH 286
+#define DT_TOK_ADD 287
+#define DT_TOK_SUB 288
+#define DT_TOK_MUL 289
+#define DT_TOK_DIV 290
+#define DT_TOK_MOD 291
+#define DT_TOK_LNEG 292
+#define DT_TOK_BNEG 293
+#define DT_TOK_ADDADD 294
+#define DT_TOK_SUBSUB 295
+#define DT_TOK_PREINC 296
+#define DT_TOK_POSTINC 297
+#define DT_TOK_PREDEC 298
+#define DT_TOK_POSTDEC 299
+#define DT_TOK_IPOS 300
+#define DT_TOK_INEG 301
+#define DT_TOK_DEREF 302
+#define DT_TOK_ADDROF 303
+#define DT_TOK_OFFSETOF 304
+#define DT_TOK_SIZEOF 305
+#define DT_TOK_STRINGOF 306
+#define DT_TOK_XLATE 307
+#define DT_TOK_LPAR 308
+#define DT_TOK_RPAR 309
+#define DT_TOK_LBRAC 310
+#define DT_TOK_RBRAC 311
+#define DT_TOK_PTR 312
+#define DT_TOK_DOT 313
+#define DT_TOK_STRING 314
+#define DT_TOK_IDENT 315
+#define DT_TOK_PSPEC 316
+#define DT_TOK_AGG 317
+#define DT_TOK_TNAME 318
+#define DT_TOK_INT 319
+#define DT_KEY_AUTO 320
+#define DT_KEY_BREAK 321
+#define DT_KEY_CASE 322
+#define DT_KEY_CHAR 323
+#define DT_KEY_CONST 324
+#define DT_KEY_CONTINUE 325
+#define DT_KEY_COUNTER 326
+#define DT_KEY_DEFAULT 327
+#define DT_KEY_DO 328
+#define DT_KEY_DOUBLE 329
+#define DT_KEY_ELSE 330
+#define DT_KEY_ENUM 331
+#define DT_KEY_EXTERN 332
+#define DT_KEY_FLOAT 333
+#define DT_KEY_FOR 334
+#define DT_KEY_GOTO 335
+#define DT_KEY_IF 336
+#define DT_KEY_IMPORT 337
+#define DT_KEY_INLINE 338
+#define DT_KEY_INT 339
+#define DT_KEY_LONG 340
+#define DT_KEY_PROBE 341
+#define DT_KEY_PROVIDER 342
+#define DT_KEY_REGISTER 343
+#define DT_KEY_RESTRICT 344
+#define DT_KEY_RETURN 345
+#define DT_KEY_SELF 346
+#define DT_KEY_SHORT 347
+#define DT_KEY_SIGNED 348
+#define DT_KEY_STATIC 349
+#define DT_KEY_STRING 350
+#define DT_KEY_STRUCT 351
+#define DT_KEY_SWITCH 352
+#define DT_KEY_THIS 353
+#define DT_KEY_TYPEDEF 354
+#define DT_KEY_UNION 355
+#define DT_KEY_UNSIGNED 356
+#define DT_KEY_VOID 357
+#define DT_KEY_VOLATILE 358
+#define DT_KEY_WHILE 359
+#define DT_KEY_XLATOR 360
+#define DT_TOK_EPRED 361
+#define DT_CTX_DEXPR 362
+#define DT_CTX_DPROG 363
+#define DT_CTX_DTYPE 364
+
+
+
+
+/* Copy the first part of user declarations.  */
+#line 1 "dt_grammar.y"
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <dt_impl.h>
+
+#define	OP1(op, c)	dt_node_op1(op, c)
+#define	OP2(op, l, r)	dt_node_op2(op, l, r)
+#define	OP3(x, y, z)	dt_node_op3(x, y, z)
+#define	LINK(l, r)	dt_node_link(l, r)
+#define	DUP(s)		strdup(s)
+
+#ifdef VBOX
+# define YYMALLOC RTMemAlloc
+# define YYFREE   RTMemFree
+#endif
+
+
+
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 47 "dt_grammar.y"
+{
+	dt_node_t *l_node;
+	dt_decl_t *l_decl;
+	char *l_str;
+	uintmax_t l_int;
+	int l_tok;
+}
+/* Line 193 of yacc.c.  */
+#line 370 "dt_grammar.c"
+	YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations.  */
+
+
+/* Line 216 of yacc.c.  */
+#line 383 "dt_grammar.c"
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(msgid) dgettext ("bison-runtime", msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E.  */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(e) ((void) (e))
+#else
+# define YYUSE(e) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions.  */
+#ifndef lint
+# define YYID(n) (n)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int i)
+#else
+static int
+YYID (i)
+    int i;
+#endif
+{
+  return i;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   elif defined __BUILTIN_VA_ARG_INCR
+#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#   elif defined _AIX
+#    define YYSTACK_ALLOC __alloca
+#   elif defined _MSC_VER
+#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#    define alloca _alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#     ifndef _STDLIB_H
+#      define _STDLIB_H 1
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's `empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#  endif
+#  if (defined __cplusplus && ! defined _STDLIB_H \
+       && ! ((defined YYMALLOC || defined malloc) \
+	     && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef _STDLIB_H
+#    define _STDLIB_H 1
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yytype_int16 yyss;
+  YYSTYPE yyvs;
+  };
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+#  else
+#   define YYCOPY(To, From, Count)		\
+      do					\
+	{					\
+	  YYSIZE_T yyi;				\
+	  for (yyi = 0; yyi < (Count); yyi++)	\
+	    (To)[yyi] = (From)[yyi];		\
+	}					\
+      while (YYID (0))
+#  endif
+# endif
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack)					\
+    do									\
+      {									\
+	YYSIZE_T yynewbytes;						\
+	YYCOPY (&yyptr->Stack, Stack, yysize);				\
+	Stack = &yyptr->Stack;						\
+	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+	yyptr += yynewbytes / sizeof (*yyptr);				\
+      }									\
+    while (YYID (0))
+
+#endif
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  99
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   837
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  113
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  81
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  239
+/* YYNRULES -- Number of states.  */
+#define YYNSTATES  363
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   364
+
+#define YYTRANSLATE(YYX)						\
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+static const yytype_uint8 yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,   110,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,   111,     2,   112,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
+      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
+      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
+      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
+      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
+      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
+      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
+      95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
+     105,   106,   107,   108,   109
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+   YYRHS.  */
+static const yytype_uint16 yyprhs[] =
+{
+       0,     0,     3,     6,     9,    12,    14,    17,    19,    22,
+      24,    27,    29,    32,    34,    36,    38,    40,    42,    43,
+      51,    62,    72,    74,    77,    82,    89,    95,    97,   100,
+     107,   112,   114,   119,   124,   132,   134,   136,   140,   142,
+     144,   146,   150,   151,   153,   155,   159,   161,   163,   165,
+     167,   169,   171,   175,   177,   182,   186,   191,   195,   199,
+     203,   207,   210,   213,   220,   227,   235,   237,   240,   243,
+     246,   249,   254,   257,   259,   261,   263,   265,   267,   269,
+     271,   276,   278,   282,   286,   290,   292,   296,   300,   302,
+     306,   310,   312,   316,   320,   324,   328,   330,   334,   338,
+     340,   344,   346,   350,   352,   356,   358,   362,   364,   368,
+     370,   374,   376,   378,   384,   386,   390,   392,   394,   396,
+     398,   400,   402,   404,   406,   408,   410,   412,   414,   418,
+     421,   425,   427,   430,   432,   435,   437,   440,   442,   445,
+     447,   450,   452,   455,   457,   459,   461,   463,   465,   467,
+     469,   471,   473,   475,   477,   479,   481,   483,   485,   487,
+     489,   491,   493,   495,   497,   499,   501,   503,   507,   510,
+     513,   516,   520,   524,   526,   528,   530,   533,   535,   539,
+     541,   545,   547,   550,   552,   555,   557,   561,   563,   566,
+     570,   574,   577,   580,   583,   587,   591,   593,   597,   599,
+     603,   605,   608,   610,   614,   617,   620,   622,   624,   627,
+     630,   634,   636,   639,   641,   643,   647,   649,   653,   655,
+     658,   661,   663,   666,   668,   670,   673,   677,   680,   682,
+     685,   687,   688,   693,   694,   696,   698,   699,   704,   705
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
+static const yytype_int16 yyrhs[] =
+{
+     114,     0,    -1,   115,     0,    -1,   116,     0,    -1,   117,
+       0,    -1,   107,    -1,   107,   155,    -1,   108,    -1,   108,
+     118,    -1,   109,    -1,   109,   185,    -1,   119,    -1,   118,
+     119,    -1,   120,    -1,   122,    -1,   125,    -1,   128,    -1,
+     156,    -1,    -1,    83,   157,   177,   121,     5,   153,   110,
+      -1,   105,   185,    26,   185,    60,    28,   111,   123,   112,
+     110,    -1,   105,   185,    26,   185,    60,    28,   111,   112,
+     110,    -1,   124,    -1,   123,   124,    -1,    60,     5,   153,
+     110,    -1,    87,    60,   111,   126,   112,   110,    -1,    87,
+      60,   111,   112,   110,    -1,   127,    -1,   126,   127,    -1,
+      86,    60,   191,    17,   191,   110,    -1,    86,    60,   191,
+     110,    -1,   129,    -1,   129,   111,   132,   112,    -1,   129,
+      35,   155,   106,    -1,   129,    35,   155,   106,   111,   132,
+     112,    -1,   130,    -1,   131,    -1,   130,     3,   131,    -1,
+      61,    -1,    64,    -1,   133,    -1,   132,   110,   133,    -1,
+      -1,   155,    -1,   153,    -1,   134,     3,   153,    -1,    60,
+      -1,    62,    -1,    64,    -1,    59,    -1,    91,    -1,    98,
+      -1,    53,   155,    54,    -1,   135,    -1,   136,    55,   134,
+      56,    -1,   136,    53,    54,    -1,   136,    53,   134,    54,
+      -1,   136,    58,    60,    -1,   136,    58,    63,    -1,   136,
+      57,    60,    -1,   136,    57,    63,    -1,   136,    39,    -1,
+     136,    40,    -1,    49,    53,   185,     3,    60,    54,    -1,
+      49,    53,   185,     3,    63,    54,    -1,    52,    26,   185,
+      28,    53,   155,    54,    -1,   136,    -1,    39,   137,    -1,
+      40,   137,    -1,   138,   139,    -1,    50,   137,    -1,    50,
+      53,   185,    54,    -1,    51,   137,    -1,    23,    -1,    34,
+      -1,    32,    -1,    33,    -1,    38,    -1,    37,    -1,   137,
+      -1,    53,   185,    54,   139,    -1,   139,    -1,   140,    34,
+     139,    -1,   140,    35,   139,    -1,   140,    36,   139,    -1,
+     140,    -1,   141,    32,   140,    -1,   141,    33,   140,    -1,
+     141,    -1,   142,    30,   141,    -1,   142,    31,   141,    -1,
+     142,    -1,   143,    26,   142,    -1,   143,    28,   142,    -1,
+     143,    27,   142,    -1,   143,    29,   142,    -1,   143,    -1,
+     144,    24,   143,    -1,   144,    25,   143,    -1,   144,    -1,
+     145,    23,   144,    -1,   145,    -1,   146,    22,   145,    -1,
+     146,    -1,   147,    21,   146,    -1,   147,    -1,   148,    20,
+     147,    -1,   148,    -1,   149,    19,   148,    -1,   149,    -1,
+     150,    18,   149,    -1,   152,    -1,   150,    -1,   150,    16,
+     155,    17,   152,    -1,   152,    -1,   137,   154,   153,    -1,
+       5,    -1,     8,    -1,     9,    -1,    10,    -1,     6,    -1,
+       7,    -1,    14,    -1,    15,    -1,    11,    -1,    12,    -1,
+      13,    -1,   153,    -1,   155,     3,   153,    -1,   157,   110,
+      -1,   157,   167,   110,    -1,   160,    -1,   160,   157,    -1,
+     161,    -1,   161,   157,    -1,   162,    -1,   162,   157,    -1,
+     159,    -1,   159,   157,    -1,   161,    -1,   161,   157,    -1,
+     162,    -1,   162,   157,    -1,    65,    -1,    88,    -1,    94,
+      -1,    77,    -1,    99,    -1,   159,    -1,    91,    -1,    98,
+      -1,   102,    -1,    68,    -1,    92,    -1,    84,    -1,    85,
+      -1,    78,    -1,    74,    -1,    93,    -1,   101,    -1,    95,
+      -1,    63,    -1,   163,    -1,   173,    -1,    69,    -1,    89,
+      -1,   103,    -1,   164,   166,   112,    -1,   165,    60,    -1,
+     165,    63,    -1,   165,   111,    -1,   165,    60,   111,    -1,
+     165,    63,   111,    -1,    96,    -1,   100,    -1,   169,    -1,
+     166,   169,    -1,   168,    -1,   167,     3,   168,    -1,   177,
+      -1,   170,   171,   110,    -1,   161,    -1,   161,   170,    -1,
+     162,    -1,   162,   170,    -1,   172,    -1,   171,     3,   172,
+      -1,   177,    -1,    17,   151,    -1,   177,    17,   151,    -1,
+     174,   175,   112,    -1,    76,    60,    -1,    76,    63,    -1,
+      76,   111,    -1,    76,    60,   111,    -1,    76,    63,   111,
+      -1,   176,    -1,   175,     3,   176,    -1,    60,    -1,    60,
+       5,   155,    -1,   178,    -1,   180,   178,    -1,    60,    -1,
+     179,   177,    54,    -1,   178,   188,    -1,   178,   191,    -1,
+      53,    -1,    34,    -1,    34,   181,    -1,    34,   180,    -1,
+      34,   181,   180,    -1,   162,    -1,   181,   162,    -1,   183,
+      -1,     4,    -1,   183,     3,     4,    -1,   184,    -1,   183,
+       3,   184,    -1,   158,    -1,   158,   177,    -1,   158,   186,
+      -1,   170,    -1,   170,   186,    -1,   180,    -1,   187,    -1,
+     180,   187,    -1,   179,   186,    54,    -1,   187,   188,    -1,
+     188,    -1,   187,   191,    -1,   191,    -1,    -1,    55,   189,
+     190,    56,    -1,    -1,   151,    -1,   182,    -1,    -1,    53,
+     192,   193,    54,    -1,    -1,   182,    -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+static const yytype_uint16 yyrline[] =
+{
+       0,   217,   217,   218,   219,   222,   223,   226,   227,   230,
+     231,   235,   236,   240,   241,   242,   243,   244,   249,   248,
+     264,   268,   275,   276,   280,   286,   289,   295,   296,   300,
+     303,   310,   326,   329,   333,   340,   344,   345,   351,   352,
+     355,   356,   359,   360,   364,   365,   371,   372,   373,   374,
+     375,   376,   377,   381,   382,   386,   389,   393,   396,   399,
+     402,   405,   408,   411,   415,   419,   426,   427,   428,   429,
+     430,   431,   434,   439,   440,   441,   442,   443,   444,   448,
+     449,   455,   456,   459,   462,   468,   469,   472,   478,   479,
+     482,   488,   489,   492,   495,   498,   504,   505,   508,   514,
+     515,   521,   522,   528,   529,   535,   536,   542,   543,   549,
+     550,   555,   559,   560,   565,   566,   572,   573,   574,   575,
+     576,   577,   578,   579,   580,   581,   582,   585,   586,   591,
+     596,   604,   605,   606,   607,   608,   609,   613,   614,   615,
+     616,   617,   618,   622,   623,   624,   625,   626,   630,   631,
+     632,   635,   636,   637,   638,   639,   640,   641,   642,   643,
+     644,   647,   648,   649,   652,   653,   654,   658,   661,   662,
+     666,   667,   668,   672,   673,   677,   678,   682,   683,   689,
+     696,   702,   703,   704,   705,   709,   710,   714,   715,   716,
+     722,   723,   724,   728,   729,   730,   734,   735,   738,   739,
+     744,   745,   749,   750,   751,   752,   755,   758,   759,   760,
+     761,   765,   766,   770,   771,   772,   777,   778,   784,   787,
+     790,   795,   798,   804,   805,   806,   810,   811,   812,   813,
+     814,   817,   817,   825,   826,   827,   830,   830,   838,   839
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "DT_TOK_EOF", "error", "$undefined", "DT_TOK_COMMA", "DT_TOK_ELLIPSIS",
+  "DT_TOK_ASGN", "DT_TOK_ADD_EQ", "DT_TOK_SUB_EQ", "DT_TOK_MUL_EQ",
+  "DT_TOK_DIV_EQ", "DT_TOK_MOD_EQ", "DT_TOK_AND_EQ", "DT_TOK_XOR_EQ",
+  "DT_TOK_OR_EQ", "DT_TOK_LSH_EQ", "DT_TOK_RSH_EQ", "DT_TOK_QUESTION",
+  "DT_TOK_COLON", "DT_TOK_LOR", "DT_TOK_LXOR", "DT_TOK_LAND", "DT_TOK_BOR",
+  "DT_TOK_XOR", "DT_TOK_BAND", "DT_TOK_EQU", "DT_TOK_NEQ", "DT_TOK_LT",
+  "DT_TOK_LE", "DT_TOK_GT", "DT_TOK_GE", "DT_TOK_LSH", "DT_TOK_RSH",
+  "DT_TOK_ADD", "DT_TOK_SUB", "DT_TOK_MUL", "DT_TOK_DIV", "DT_TOK_MOD",
+  "DT_TOK_LNEG", "DT_TOK_BNEG", "DT_TOK_ADDADD", "DT_TOK_SUBSUB",
+  "DT_TOK_PREINC", "DT_TOK_POSTINC", "DT_TOK_PREDEC", "DT_TOK_POSTDEC",
+  "DT_TOK_IPOS", "DT_TOK_INEG", "DT_TOK_DEREF", "DT_TOK_ADDROF",
+  "DT_TOK_OFFSETOF", "DT_TOK_SIZEOF", "DT_TOK_STRINGOF", "DT_TOK_XLATE",
+  "DT_TOK_LPAR", "DT_TOK_RPAR", "DT_TOK_LBRAC", "DT_TOK_RBRAC",
+  "DT_TOK_PTR", "DT_TOK_DOT", "DT_TOK_STRING", "DT_TOK_IDENT",
+  "DT_TOK_PSPEC", "DT_TOK_AGG", "DT_TOK_TNAME", "DT_TOK_INT",
+  "DT_KEY_AUTO", "DT_KEY_BREAK", "DT_KEY_CASE", "DT_KEY_CHAR",
+  "DT_KEY_CONST", "DT_KEY_CONTINUE", "DT_KEY_COUNTER", "DT_KEY_DEFAULT",
+  "DT_KEY_DO", "DT_KEY_DOUBLE", "DT_KEY_ELSE", "DT_KEY_ENUM",
+  "DT_KEY_EXTERN", "DT_KEY_FLOAT", "DT_KEY_FOR", "DT_KEY_GOTO",
+  "DT_KEY_IF", "DT_KEY_IMPORT", "DT_KEY_INLINE", "DT_KEY_INT",
+  "DT_KEY_LONG", "DT_KEY_PROBE", "DT_KEY_PROVIDER", "DT_KEY_REGISTER",
+  "DT_KEY_RESTRICT", "DT_KEY_RETURN", "DT_KEY_SELF", "DT_KEY_SHORT",
+  "DT_KEY_SIGNED", "DT_KEY_STATIC", "DT_KEY_STRING", "DT_KEY_STRUCT",
+  "DT_KEY_SWITCH", "DT_KEY_THIS", "DT_KEY_TYPEDEF", "DT_KEY_UNION",
+  "DT_KEY_UNSIGNED", "DT_KEY_VOID", "DT_KEY_VOLATILE", "DT_KEY_WHILE",
+  "DT_KEY_XLATOR", "DT_TOK_EPRED", "DT_CTX_DEXPR", "DT_CTX_DPROG",
+  "DT_CTX_DTYPE", "';'", "'{'", "'}'", "$accept", "dtrace_program",
+  "d_expression", "d_program", "d_type", "translation_unit",
+  "external_declaration", "inline_definition", "@1",
+  "translator_definition", "translator_member_list", "translator_member",
+  "provider_definition", "provider_probe_list", "provider_probe",
+  "probe_definition", "probe_specifiers", "probe_specifier_list",
+  "probe_specifier", "statement_list", "statement",
+  "argument_expression_list", "primary_expression", "postfix_expression",
+  "unary_expression", "unary_operator", "cast_expression",
+  "multiplicative_expression", "additive_expression", "shift_expression",
+  "relational_expression", "equality_expression", "and_expression",
+  "exclusive_or_expression", "inclusive_or_expression",
+  "logical_and_expression", "logical_xor_expression",
+  "logical_or_expression", "constant_expression", "conditional_expression",
+  "assignment_expression", "assignment_operator", "expression",
+  "declaration", "declaration_specifiers",
+  "parameter_declaration_specifiers", "storage_class_specifier",
+  "d_storage_class_specifier", "type_specifier", "type_qualifier",
+  "struct_or_union_specifier", "struct_or_union_definition",
+  "struct_or_union", "struct_declaration_list", "init_declarator_list",
+  "init_declarator", "struct_declaration", "specifier_qualifier_list",
+  "struct_declarator_list", "struct_declarator", "enum_specifier",
+  "enum_definition", "enumerator_list", "enumerator", "declarator",
+  "direct_declarator", "lparen", "pointer", "type_qualifier_list",
+  "parameter_type_list", "parameter_list", "parameter_declaration",
+  "type_name", "abstract_declarator", "direct_abstract_declarator",
+  "array", "@2", "array_parameters", "function", "@3",
+  "function_parameters", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+   token YYLEX-NUM.  */
+static const yytype_uint16 yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
+     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
+     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
+     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
+     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
+     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
+     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
+     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
+     355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
+      59,   123,   125
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,   113,   114,   114,   114,   115,   115,   116,   116,   117,
+     117,   118,   118,   119,   119,   119,   119,   119,   121,   120,
+     122,   122,   123,   123,   124,   125,   125,   126,   126,   127,
+     127,   128,   128,   128,   128,   129,   130,   130,   131,   131,
+     132,   132,   133,   133,   134,   134,   135,   135,   135,   135,
+     135,   135,   135,   136,   136,   136,   136,   136,   136,   136,
+     136,   136,   136,   136,   136,   136,   137,   137,   137,   137,
+     137,   137,   137,   138,   138,   138,   138,   138,   138,   139,
+     139,   140,   140,   140,   140,   141,   141,   141,   142,   142,
+     142,   143,   143,   143,   143,   143,   144,   144,   144,   145,
+     145,   146,   146,   147,   147,   148,   148,   149,   149,   150,
+     150,   151,   152,   152,   153,   153,   154,   154,   154,   154,
+     154,   154,   154,   154,   154,   154,   154,   155,   155,   156,
+     156,   157,   157,   157,   157,   157,   157,   158,   158,   158,
+     158,   158,   158,   159,   159,   159,   159,   159,   160,   160,
+     160,   161,   161,   161,   161,   161,   161,   161,   161,   161,
+     161,   161,   161,   161,   162,   162,   162,   163,   163,   163,
+     164,   164,   164,   165,   165,   166,   166,   167,   167,   168,
+     169,   170,   170,   170,   170,   171,   171,   172,   172,   172,
+     173,   173,   173,   174,   174,   174,   175,   175,   176,   176,
+     177,   177,   178,   178,   178,   178,   179,   180,   180,   180,
+     180,   181,   181,   182,   182,   182,   183,   183,   184,   184,
+     184,   185,   185,   186,   186,   186,   187,   187,   187,   187,
+     187,   189,   188,   190,   190,   190,   192,   191,   193,   193
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     2,     2,     2,     1,     2,     1,     2,     1,
+       2,     1,     2,     1,     1,     1,     1,     1,     0,     7,
+      10,     9,     1,     2,     4,     6,     5,     1,     2,     6,
+       4,     1,     4,     4,     7,     1,     1,     3,     1,     1,
+       1,     3,     0,     1,     1,     3,     1,     1,     1,     1,
+       1,     1,     3,     1,     4,     3,     4,     3,     3,     3,
+       3,     2,     2,     6,     6,     7,     1,     2,     2,     2,
+       2,     4,     2,     1,     1,     1,     1,     1,     1,     1,
+       4,     1,     3,     3,     3,     1,     3,     3,     1,     3,
+       3,     1,     3,     3,     3,     3,     1,     3,     3,     1,
+       3,     1,     3,     1,     3,     1,     3,     1,     3,     1,
+       3,     1,     1,     5,     1,     3,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     3,     2,
+       3,     1,     2,     1,     2,     1,     2,     1,     2,     1,
+       2,     1,     2,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     3,     2,     2,
+       2,     3,     3,     1,     1,     1,     2,     1,     3,     1,
+       3,     1,     2,     1,     2,     1,     3,     1,     2,     3,
+       3,     2,     2,     2,     3,     3,     1,     3,     1,     3,
+       1,     2,     1,     3,     2,     2,     1,     1,     2,     2,
+       3,     1,     2,     1,     1,     3,     1,     3,     1,     2,
+       2,     1,     2,     1,     1,     2,     3,     2,     1,     2,
+       1,     0,     4,     0,     1,     1,     0,     4,     0,     1
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
+   means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       0,     5,     7,     9,     0,     0,     0,     0,    73,    75,
+      76,    74,    78,    77,     0,     0,     0,     0,     0,     0,
+       0,    49,    46,    47,    48,    50,    51,    53,    66,    79,
+       0,    81,    85,    88,    91,    96,    99,   101,   103,   105,
+     107,   109,   112,   114,   127,     6,    38,   161,    39,   143,
+     152,   164,   157,     0,   146,   156,     0,   154,   155,     0,
+     144,   165,   149,   153,   158,   145,   160,   173,   150,   147,
+     174,   159,   151,   166,     0,     8,    11,    13,    14,    15,
+      16,    31,    35,    36,    17,     0,   148,   131,   133,   135,
+     162,     0,     0,   163,     0,   181,   183,   221,    10,     1,
+       2,     3,     4,     0,    67,    68,     0,     0,    70,    72,
+       0,     0,     0,    61,    62,     0,     0,     0,     0,   116,
+     120,   121,   117,   118,   119,   124,   125,   126,   122,   123,
+       0,    79,    69,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   191,   192,   193,     0,     0,     0,
+      12,     0,    42,     0,   207,   206,   202,   129,     0,   177,
+     179,   200,     0,     0,   132,   134,   136,     0,   175,     0,
+     168,   169,   170,   198,     0,   196,   182,   184,   236,   231,
+       0,   223,   222,   224,   228,   230,     0,     0,     0,    52,
+       0,    55,     0,    44,     0,    59,    60,    57,    58,   115,
+      82,    83,    84,    86,    87,    89,    90,    92,    94,    93,
+      95,    97,    98,   100,   102,   104,   106,   108,     0,   110,
+     128,   194,   195,    18,     0,     0,     0,     0,    40,    43,
+      37,   211,   209,   208,     0,   130,   236,   204,   205,     0,
+     201,   167,   176,     0,     0,   185,   187,   171,   172,     0,
+       0,   190,   238,   233,     0,   225,   227,   229,     0,    71,
+       0,    80,     0,    56,    54,     0,     0,     0,     0,     0,
+      27,     0,    33,    42,    32,   212,   210,   178,   203,   188,
+     111,     0,   180,     0,   199,   197,   214,   218,   137,   139,
+     141,   239,   213,   216,     0,   234,   235,     0,   226,     0,
+       0,     0,    45,   113,     0,     0,    26,     0,    28,     0,
+      42,    41,   186,   189,   219,     0,   223,   220,   138,   140,
+     142,     0,   237,   232,    63,    64,     0,     0,     0,    25,
+       0,     0,   215,   217,    65,    19,     0,    30,     0,    34,
+       0,     0,     0,     0,    22,    29,     0,    21,     0,    23,
+       0,    20,    24
+};
+
+/* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int16 yydefgoto[] =
+{
+      -1,     4,     5,     6,     7,    75,    76,    77,   276,    78,
+     353,   354,    79,   279,   280,    80,    81,    82,    83,   237,
+     238,   202,    27,    28,   131,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    42,   289,    43,
+      44,   130,   111,    84,    85,   297,    86,    87,    95,    96,
+      90,    91,    92,   177,   168,   169,   178,    97,   254,   255,
+      93,    94,   184,   185,   170,   171,   172,   173,   243,   301,
+     302,   303,    98,   264,   193,   194,   263,   307,   195,   262,
+     304
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+#define YYPACT_NINF -224
+static const yytype_int16 yypact[] =
+{
+     148,   553,   641,   723,    26,    49,    57,    76,  -224,  -224,
+    -224,  -224,  -224,  -224,   596,   596,    88,   629,   596,    72,
+     446,  -224,  -224,  -224,  -224,  -224,  -224,  -224,   179,   822,
+     553,  -224,   152,    37,   118,   109,    56,   132,   137,   154,
+     149,   162,   175,  -224,  -224,   205,  -224,  -224,  -224,  -224,
+    -224,  -224,  -224,    11,  -224,  -224,   682,  -224,  -224,   155,
+    -224,  -224,  -224,  -224,  -224,  -224,  -224,  -224,  -224,  -224,
+    -224,  -224,  -224,  -224,   723,   641,  -224,  -224,  -224,  -224,
+    -224,    10,   217,  -224,  -224,     7,  -224,   682,   682,   682,
+    -224,   723,    22,  -224,   167,   723,   723,   139,  -224,  -224,
+    -224,  -224,  -224,   553,  -224,  -224,   723,   446,  -224,  -224,
+     723,    58,   177,  -224,  -224,   520,   553,    -5,    80,  -224,
+    -224,  -224,  -224,  -224,  -224,  -224,  -224,  -224,  -224,  -224,
+     553,  -224,  -224,   553,   553,   553,   553,   553,   553,   553,
+     553,   553,   553,   553,   553,   553,   553,   553,   553,   553,
+     553,   553,   553,   553,   127,   131,  -224,   110,   133,   209,
+    -224,   553,   553,    81,     4,  -224,  -224,  -224,    17,  -224,
+    -224,   145,   110,    50,  -224,  -224,  -224,   121,  -224,    94,
+     159,   161,  -224,   243,    18,  -224,  -224,  -224,   119,  -224,
+     139,   156,  -224,   145,  -224,  -224,   247,   213,   231,  -224,
+     553,  -224,    62,  -224,    48,  -224,  -224,  -224,  -224,  -224,
+    -224,  -224,  -224,   152,   152,    37,    37,   118,   118,   118,
+     118,   109,   109,    56,   132,   137,   154,   149,    45,   162,
+    -224,  -224,  -224,  -224,   -49,   723,    19,   116,  -224,   205,
+    -224,  -224,  -224,     4,   110,  -224,  -224,  -224,  -224,   219,
+     145,  -224,  -224,   553,    21,  -224,   257,  -224,  -224,   553,
+     167,  -224,   331,   289,   221,   145,  -224,  -224,   117,  -224,
+     223,  -224,   553,  -224,  -224,   553,   272,   218,   169,   -44,
+    -224,   220,   170,   553,  -224,  -224,  -224,  -224,  -224,  -224,
+    -224,    94,  -224,   553,  -224,  -224,  -224,   123,   682,   682,
+     682,  -224,   280,  -224,   230,  -224,  -224,   229,  -224,   232,
+     233,   553,  -224,  -224,   553,   236,  -224,   180,  -224,   263,
+     553,  -224,  -224,  -224,  -224,   123,    79,  -224,  -224,  -224,
+    -224,   372,  -224,  -224,  -224,  -224,    69,   182,    16,  -224,
+     183,   129,  -224,  -224,  -224,  -224,   236,  -224,   -35,  -224,
+     185,   291,   187,   -13,  -224,  -224,   553,  -224,   194,  -224,
+     195,  -224,  -224
+};
+
+/* YYPGOTO[NTERM-NUM].  */
+static const yytype_int16 yypgoto[] =
+{
+    -224,  -224,  -224,  -224,  -224,  -224,   234,  -224,  -224,  -224,
+    -224,   -47,  -224,  -224,    28,  -224,  -224,  -224,   151,   -12,
+      32,   201,  -224,  -224,    -1,  -224,   -15,    66,   122,   111,
+     124,   165,   171,   172,   181,   174,   184,  -224,  -210,  -209,
+    -107,  -224,     5,  -224,   -53,  -224,  -223,  -224,     3,     0,
+    -224,  -224,  -224,  -224,  -224,    89,   160,   -64,  -224,    41,
+    -224,  -224,  -224,    83,  -129,  -155,   -96,   -85,  -224,    82,
+    -224,    13,   -10,   -93,  -180,  -141,  -224,  -224,  -164,  -224,
+    -224
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule which
+   number is the opposite.  If zero, do what YYDEFACT says.
+   If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -207
+static const yytype_int16 yytable[] =
+{
+      29,   190,    89,   157,   192,    88,    45,   248,   203,   203,
+     112,   265,   191,   104,   105,   132,   108,   109,   250,    29,
+     244,   260,   153,   209,   291,   351,    99,   179,   233,   267,
+     247,   186,   187,   346,   174,   175,   176,   277,   164,   298,
+     298,   164,   277,   249,   290,   161,   230,   351,   153,   100,
+     256,   272,   266,   305,   290,   205,    89,   101,   206,    88,
+     165,   153,   275,   278,   159,   272,   313,   166,   317,   136,
+     137,   154,   153,    51,   155,    89,   102,   352,    88,   242,
+     144,   145,   180,   323,   290,   181,   248,    89,    89,    89,
+      88,    88,    88,    61,   190,   190,   196,   197,   110,   358,
+     198,   267,    29,   165,   274,   191,    29,    73,   298,   247,
+     166,   253,   199,   179,    29,    29,   273,   167,   210,   211,
+     212,   162,   156,   344,   266,   282,   347,   245,   164,    29,
+     261,   292,   188,   182,   189,   140,   141,   142,   143,   166,
+     207,   106,    46,   208,   164,    48,   265,   165,   138,   139,
+      29,   338,    29,  -206,   166,   146,   228,   164,   286,   147,
+      29,    29,   256,   165,   241,   312,   236,   239,   324,   149,
+     166,   250,  -206,   164,  -206,   148,   188,   309,   189,  -206,
+     310,   150,   350,   166,    47,   271,   133,   134,   135,    50,
+      51,   151,   188,   152,   189,    52,   249,    53,   246,    55,
+     189,   325,   213,   214,   327,    57,    58,   337,   153,   188,
+      61,   189,   326,    63,    64,   158,    66,    67,   113,   114,
+     163,    70,    71,    72,    73,   281,   283,   183,   284,   325,
+     325,   200,   115,   251,   116,   235,   117,   118,   231,   283,
+     326,   349,   232,   285,   234,   328,   329,   330,   259,   360,
+     268,   217,   218,   219,   220,     1,     2,     3,    29,   270,
+     215,   216,   300,   300,   294,   299,   299,   269,   221,   222,
+     257,    29,   258,   288,   293,   308,   311,   314,   315,   316,
+     319,   320,    29,   331,   332,   333,   334,   335,   239,   246,
+     339,   340,   345,   296,   348,   355,   356,   357,    89,    89,
+      89,    88,    88,    88,   361,   362,   359,   318,   341,   160,
+      29,   223,     8,    29,   240,   321,   336,   204,   224,    29,
+     225,     9,    10,    11,   227,   239,    12,    13,    14,    15,
+     226,   300,   322,   287,   299,   296,   229,   252,    16,    17,
+      18,    19,    20,   295,   343,   306,     0,     0,    21,    22,
+       0,    23,    47,    24,    49,    29,     0,    50,    51,     0,
+       0,     0,     0,    52,     0,    53,    54,    55,     0,     0,
+       0,     0,     0,    57,    58,     0,   342,    60,    61,     0,
+      25,    63,    64,    65,    66,    67,     0,    26,    69,    70,
+      71,    72,    73,     0,    47,     0,    49,     0,     0,    50,
+      51,     0,     0,     0,     0,    52,     0,    53,    54,    55,
+       0,     0,     0,     0,     0,    57,    58,     0,     0,    60,
+      61,     0,     0,    63,    64,    65,    66,    67,     0,     0,
+      69,    70,    71,    72,    73,    47,     0,    49,     0,     0,
+      50,    51,     0,     0,     0,     0,    52,     0,    53,    54,
+      55,     0,     0,     0,     0,     0,    57,    58,     0,     0,
+      60,    61,     0,     0,    63,    64,    65,    66,    67,     8,
+       0,    69,    70,    71,    72,    73,     0,     0,     9,    10,
+      11,     0,     0,    12,    13,    14,    15,     0,     0,     0,
+       0,     0,     0,     0,     0,    16,    17,    18,    19,    20,
+       0,     0,     0,     0,     0,    21,    22,     0,    23,    47,
+      24,     0,     0,     0,    50,    51,     0,     0,     0,     0,
+      52,     0,    53,     0,    55,     0,     0,     0,     0,     0,
+      57,    58,     0,     0,     0,    61,     0,    25,    63,    64,
+       0,    66,    67,     8,    26,     0,    70,    71,    72,    73,
+       0,     0,     9,    10,    11,     0,     0,    12,    13,    14,
+      15,     0,     0,     0,     0,     0,     0,     0,     0,    16,
+      17,    18,    19,    20,   201,     0,     8,     0,     0,    21,
+      22,     0,    23,     0,    24,     9,    10,    11,     0,     0,
+      12,    13,    14,    15,     0,     0,     0,     0,     0,     0,
+       0,     0,    16,    17,    18,    19,    20,     0,     0,     0,
+       0,    25,    21,    22,     0,    23,     0,    24,    26,     8,
+       0,     0,     0,     0,     0,     0,     0,     0,     9,    10,
+      11,     0,     0,    12,    13,    14,    15,     0,     0,     0,
+       0,     0,     0,     0,    25,    16,    17,    18,    19,   103,
+       0,    26,     8,     0,     0,    21,    22,     0,    23,     0,
+      24,     9,    10,    11,     0,     0,    12,    13,    14,    15,
+       0,     0,     0,     0,     0,     0,     0,     0,    16,    17,
+      18,    19,   107,     0,     0,     0,     0,    25,    21,    22,
+       0,    23,     0,    24,    26,     0,     0,     0,     0,     0,
+       0,     0,    46,     0,    47,    48,    49,     0,     0,    50,
+      51,     0,     0,     0,     0,    52,     0,    53,    54,    55,
+      25,     0,     0,     0,    56,    57,    58,    26,    59,    60,
+      61,     0,    62,    63,    64,    65,    66,    67,     0,    68,
+      69,    70,    71,    72,    73,    47,    74,    49,     0,     0,
+      50,    51,     0,     0,     0,     0,    52,     0,    53,    54,
+      55,     0,     0,     0,     0,     0,    57,    58,     0,     0,
+      60,    61,     0,    62,    63,    64,    65,    66,    67,     0,
+      68,    69,    70,    71,    72,    73,    47,     0,     0,     0,
+       0,    50,    51,     0,     0,     0,     0,    52,     0,    53,
+       0,    55,     0,     0,     0,     0,     0,    57,    58,     0,
+       0,     0,    61,     0,     0,    63,    64,     0,    66,    67,
+       0,     0,     0,    70,    71,    72,    73,   119,   120,   121,
+     122,   123,   124,   125,   126,   127,   128,   129
+};
+
+static const yytype_int16 yycheck[] =
+{
+       1,    97,     2,    56,    97,     2,     1,   171,   115,   116,
+      20,   191,    97,    14,    15,    30,    17,    18,   173,    20,
+       3,     3,     3,   130,     3,    60,     0,    91,   157,   193,
+     171,    95,    96,    17,    87,    88,    89,    86,    34,   262,
+     263,    34,    86,   172,   253,    35,   153,    60,     3,     0,
+     179,     3,   193,   263,   263,    60,    56,     0,    63,    56,
+      53,     3,    17,   112,    74,     3,   275,    60,   112,    32,
+      33,    60,     3,    69,    63,    75,     0,   112,    75,   164,
+      24,    25,    60,   293,   293,    63,   250,    87,    88,    89,
+      87,    88,    89,    89,   190,   191,   106,   107,    26,   112,
+     110,   265,   103,    53,    56,   190,   107,   103,   331,   250,
+      60,    17,    54,   177,   115,   116,    54,   110,   133,   134,
+     135,   111,   111,    54,   265,   106,   110,   110,    34,   130,
+     112,   110,    53,   111,    55,    26,    27,    28,    29,    60,
+      60,    53,    61,    63,    34,    64,   326,    53,    30,    31,
+     151,   315,   153,    34,    60,    23,   151,    34,   243,    22,
+     161,   162,   291,    53,   164,   272,   161,   162,   297,    20,
+      60,   326,    53,    34,    55,    21,    53,    60,    55,    60,
+      63,    19,   346,    60,    63,   200,    34,    35,    36,    68,
+      69,    16,    53,    18,    55,    74,   325,    76,    53,    78,
+      55,   297,   136,   137,   297,    84,    85,   314,     3,    53,
+      89,    55,   297,    92,    93,    60,    95,    96,    39,    40,
+       3,   100,   101,   102,   103,   235,   110,    60,   112,   325,
+     326,    54,    53,   112,    55,    26,    57,    58,   111,   110,
+     325,   112,   111,   243,   111,   298,   299,   300,     5,   356,
+       3,   140,   141,   142,   143,   107,   108,   109,   259,    28,
+     138,   139,   262,   263,   259,   262,   263,    54,   144,   145,
+     111,   272,   111,    54,    17,    54,    53,     5,    60,   110,
+      60,   111,   283,     3,    54,    56,    54,    54,   283,    53,
+     110,    28,   110,     4,   111,   110,     5,   110,   298,   299,
+     300,   298,   299,   300,   110,   110,   353,   279,   320,    75,
+     311,   146,    23,   314,   163,   283,   311,   116,   147,   320,
+     148,    32,    33,    34,   150,   320,    37,    38,    39,    40,
+     149,   331,   291,   244,   331,     4,   152,   177,    49,    50,
+      51,    52,    53,   260,   331,   263,    -1,    -1,    59,    60,
+      -1,    62,    63,    64,    65,   356,    -1,    68,    69,    -1,
+      -1,    -1,    -1,    74,    -1,    76,    77,    78,    -1,    -1,
+      -1,    -1,    -1,    84,    85,    -1,     4,    88,    89,    -1,
+      91,    92,    93,    94,    95,    96,    -1,    98,    99,   100,
+     101,   102,   103,    -1,    63,    -1,    65,    -1,    -1,    68,
+      69,    -1,    -1,    -1,    -1,    74,    -1,    76,    77,    78,
+      -1,    -1,    -1,    -1,    -1,    84,    85,    -1,    -1,    88,
+      89,    -1,    -1,    92,    93,    94,    95,    96,    -1,    -1,
+      99,   100,   101,   102,   103,    63,    -1,    65,    -1,    -1,
+      68,    69,    -1,    -1,    -1,    -1,    74,    -1,    76,    77,
+      78,    -1,    -1,    -1,    -1,    -1,    84,    85,    -1,    -1,
+      88,    89,    -1,    -1,    92,    93,    94,    95,    96,    23,
+      -1,    99,   100,   101,   102,   103,    -1,    -1,    32,    33,
+      34,    -1,    -1,    37,    38,    39,    40,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    49,    50,    51,    52,    53,
+      -1,    -1,    -1,    -1,    -1,    59,    60,    -1,    62,    63,
+      64,    -1,    -1,    -1,    68,    69,    -1,    -1,    -1,    -1,
+      74,    -1,    76,    -1,    78,    -1,    -1,    -1,    -1,    -1,
+      84,    85,    -1,    -1,    -1,    89,    -1,    91,    92,    93,
+      -1,    95,    96,    23,    98,    -1,   100,   101,   102,   103,
+      -1,    -1,    32,    33,    34,    -1,    -1,    37,    38,    39,
+      40,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    49,
+      50,    51,    52,    53,    54,    -1,    23,    -1,    -1,    59,
+      60,    -1,    62,    -1,    64,    32,    33,    34,    -1,    -1,
+      37,    38,    39,    40,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    49,    50,    51,    52,    53,    -1,    -1,    -1,
+      -1,    91,    59,    60,    -1,    62,    -1,    64,    98,    23,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32,    33,
+      34,    -1,    -1,    37,    38,    39,    40,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    91,    49,    50,    51,    52,    53,
+      -1,    98,    23,    -1,    -1,    59,    60,    -1,    62,    -1,
+      64,    32,    33,    34,    -1,    -1,    37,    38,    39,    40,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    49,    50,
+      51,    52,    53,    -1,    -1,    -1,    -1,    91,    59,    60,
+      -1,    62,    -1,    64,    98,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    61,    -1,    63,    64,    65,    -1,    -1,    68,
+      69,    -1,    -1,    -1,    -1,    74,    -1,    76,    77,    78,
+      91,    -1,    -1,    -1,    83,    84,    85,    98,    87,    88,
+      89,    -1,    91,    92,    93,    94,    95,    96,    -1,    98,
+      99,   100,   101,   102,   103,    63,   105,    65,    -1,    -1,
+      68,    69,    -1,    -1,    -1,    -1,    74,    -1,    76,    77,
+      78,    -1,    -1,    -1,    -1,    -1,    84,    85,    -1,    -1,
+      88,    89,    -1,    91,    92,    93,    94,    95,    96,    -1,
+      98,    99,   100,   101,   102,   103,    63,    -1,    -1,    -1,
+      -1,    68,    69,    -1,    -1,    -1,    -1,    74,    -1,    76,
+      -1,    78,    -1,    -1,    -1,    -1,    -1,    84,    85,    -1,
+      -1,    -1,    89,    -1,    -1,    92,    93,    -1,    95,    96,
+      -1,    -1,    -1,   100,   101,   102,   103,     5,     6,     7,
+       8,     9,    10,    11,    12,    13,    14,    15
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
+static const yytype_uint8 yystos[] =
+{
+       0,   107,   108,   109,   114,   115,   116,   117,    23,    32,
+      33,    34,    37,    38,    39,    40,    49,    50,    51,    52,
+      53,    59,    60,    62,    64,    91,    98,   135,   136,   137,
+     138,   139,   140,   141,   142,   143,   144,   145,   146,   147,
+     148,   149,   150,   152,   153,   155,    61,    63,    64,    65,
+      68,    69,    74,    76,    77,    78,    83,    84,    85,    87,
+      88,    89,    91,    92,    93,    94,    95,    96,    98,    99,
+     100,   101,   102,   103,   105,   118,   119,   120,   122,   125,
+     128,   129,   130,   131,   156,   157,   159,   160,   161,   162,
+     163,   164,   165,   173,   174,   161,   162,   170,   185,     0,
+       0,     0,     0,    53,   137,   137,    53,    53,   137,   137,
+      26,   155,   185,    39,    40,    53,    55,    57,    58,     5,
+       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
+     154,   137,   139,    34,    35,    36,    32,    33,    30,    31,
+      26,    27,    28,    29,    24,    25,    23,    22,    21,    20,
+      19,    16,    18,     3,    60,    63,   111,   157,    60,   185,
+     119,    35,   111,     3,    34,    53,    60,   110,   167,   168,
+     177,   178,   179,   180,   157,   157,   157,   166,   169,   170,
+      60,    63,   111,    60,   175,   176,   170,   170,    53,    55,
+     179,   180,   186,   187,   188,   191,   185,   185,   185,    54,
+      54,    54,   134,   153,   134,    60,    63,    60,    63,   153,
+     139,   139,   139,   140,   140,   141,   141,   142,   142,   142,
+     142,   143,   143,   144,   145,   146,   147,   148,   155,   149,
+     153,   111,   111,   177,   111,    26,   155,   132,   133,   155,
+     131,   162,   180,   181,     3,   110,    53,   188,   191,   177,
+     178,   112,   169,    17,   171,   172,   177,   111,   111,     5,
+       3,   112,   192,   189,   186,   187,   188,   191,     3,    54,
+      28,   139,     3,    54,    56,    17,   121,    86,   112,   126,
+     127,   185,   106,   110,   112,   162,   180,   168,    54,   151,
+     152,     3,   110,    17,   155,   176,     4,   158,   159,   161,
+     162,   182,   183,   184,   193,   151,   182,   190,    54,    60,
+      63,    53,   153,   152,     5,    60,   110,   112,   127,    60,
+     111,   133,   172,   151,   177,   179,   180,   186,   157,   157,
+     157,     3,    54,    56,    54,    54,   155,   153,   191,   110,
+      28,   132,     4,   184,    54,   110,    17,   110,   111,   112,
+     191,    60,   112,   123,   124,   110,     5,   110,   112,   124,
+     153,   110,   110
+};
+
+#define yyerrok		(yyerrstatus = 0)
+#define yyclearin	(yychar = YYEMPTY)
+#define YYEMPTY		(-2)
+#define YYEOF		0
+
+#define YYACCEPT	goto yyacceptlab
+#define YYABORT		goto yyabortlab
+#define YYERROR		goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror.  This remains here temporarily
+   to ease the transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  */
+
+#define YYFAIL		goto yyerrlab
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)					\
+do								\
+  if (yychar == YYEMPTY && yylen == 1)				\
+    {								\
+      yychar = (Token);						\
+      yylval = (Value);						\
+      yytoken = YYTRANSLATE (yychar);				\
+      YYPOPSTACK (1);						\
+      goto yybackup;						\
+    }								\
+  else								\
+    {								\
+      yyerror (YY_("syntax error: cannot back up")); \
+      YYERROR;							\
+    }								\
+while (YYID (0))
+
+
+#define YYTERROR	1
+#define YYERRCODE	256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)				\
+    do									\
+      if (YYID (N))                                                    \
+	{								\
+	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
+	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
+	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
+	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
+	}								\
+      else								\
+	{								\
+	  (Current).first_line   = (Current).last_line   =		\
+	    YYRHSLOC (Rhs, 0).last_line;				\
+	  (Current).first_column = (Current).last_column =		\
+	    YYRHSLOC (Rhs, 0).last_column;				\
+	}								\
+    while (YYID (0))
+#endif
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+   This macro was not mandated originally: define only if we know
+   we won't break user code: when these are the locations we know.  */
+
+#ifndef YY_LOCATION_PRINT
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+#  define YY_LOCATION_PRINT(File, Loc)			\
+     fprintf (File, "%d.%d-%d.%d",			\
+	      (Loc).first_line, (Loc).first_column,	\
+	      (Loc).last_line,  (Loc).last_column)
+# else
+#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments.  */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)			\
+do {						\
+  if (yydebug)					\
+    YYFPRINTF Args;				\
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
+do {									  \
+  if (yydebug)								  \
+    {									  \
+      YYFPRINTF (stderr, "%s ", Title);					  \
+      yy_symbol_print (stderr,						  \
+		  Type, Value); \
+      YYFPRINTF (stderr, "\n");						  \
+    }									  \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+#endif
+{
+  if (!yyvaluep)
+    return;
+# ifdef YYPRINT
+  if (yytype < YYNTOKENS)
+    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+  YYUSE (yyoutput);
+# endif
+  switch (yytype)
+    {
+      default:
+	break;
+    }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+#endif
+{
+  if (yytype < YYNTOKENS)
+    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+  else
+    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+  YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+#else
+static void
+yy_stack_print (bottom, top)
+    yytype_int16 *bottom;
+    yytype_int16 *top;
+#endif
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; bottom <= top; ++bottom)
+    YYFPRINTF (stderr, " %d", *bottom);
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)				\
+do {								\
+  if (yydebug)							\
+    yy_stack_print ((Bottom), (Top));				\
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+    YYSTYPE *yyvsp;
+    int yyrule;
+#endif
+{
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  unsigned long int yylno = yyrline[yyrule];
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+	     yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      fprintf (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+		       &(yyvsp[(yyi + 1) - (yynrhs)])
+		       		       );
+      fprintf (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)		\
+do {					\
+  if (yydebug)				\
+    yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef	YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+

+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+#  if defined __GLIBC__ && defined _STRING_H
+#   define yystrlen strlen
+#  else
+/* Return the length of YYSTR.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+    const char *yystr;
+#endif
+{
+  YYSIZE_T yylen;
+  for (yylen = 0; yystr[yylen]; yylen++)
+    continue;
+  return yylen;
+}
+#  endif
+# endif
+
+# ifndef yystpcpy
+#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#   define yystpcpy stpcpy
+#  else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+    char *yydest;
+    const char *yysrc;
+#endif
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+#  endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      YYSIZE_T yyn = 0;
+      char const *yyp = yystr;
+
+      for (;;)
+	switch (*++yyp)
+	  {
+	  case '\'':
+	  case ',':
+	    goto do_not_strip_quotes;
+
+	  case '\\':
+	    if (*++yyp != '\\')
+	      goto do_not_strip_quotes;
+	    /* Fall through.  */
+	  default:
+	    if (yyres)
+	      yyres[yyn] = *yyp;
+	    yyn++;
+	    break;
+
+	  case '"':
+	    if (yyres)
+	      yyres[yyn] = '\0';
+	    return yyn;
+	  }
+    do_not_strip_quotes: ;
+    }
+
+  if (! yyres)
+    return yystrlen (yystr);
+
+  return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into YYRESULT an error message about the unexpected token
+   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
+   including the terminating null byte.  If YYRESULT is null, do not
+   copy anything; just return the number of bytes that would be
+   copied.  As a special case, return 0 if an ordinary "syntax error"
+   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
+   size calculation.  */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
+{
+  int yyn = yypact[yystate];
+
+  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+    return 0;
+  else
+    {
+      int yytype = YYTRANSLATE (yychar);
+      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+      YYSIZE_T yysize = yysize0;
+      YYSIZE_T yysize1;
+      int yysize_overflow = 0;
+      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+      int yyx;
+
+# if 0
+      /* This is so xgettext sees the translatable formats that are
+	 constructed on the fly.  */
+      YY_("syntax error, unexpected %s");
+      YY_("syntax error, unexpected %s, expecting %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+      char *yyfmt;
+      char const *yyf;
+      static char const yyunexpected[] = "syntax error, unexpected %s";
+      static char const yyexpecting[] = ", expecting %s";
+      static char const yyor[] = " or %s";
+      char yyformat[sizeof yyunexpected
+		    + sizeof yyexpecting - 1
+		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+		       * (sizeof yyor - 1))];
+      char const *yyprefix = yyexpecting;
+
+      /* Start YYX at -YYN if negative to avoid negative indexes in
+	 YYCHECK.  */
+      int yyxbegin = yyn < 0 ? -yyn : 0;
+
+      /* Stay within bounds of both yycheck and yytname.  */
+      int yychecklim = YYLAST - yyn + 1;
+      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+      int yycount = 1;
+
+      yyarg[0] = yytname[yytype];
+      yyfmt = yystpcpy (yyformat, yyunexpected);
+
+      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+	  {
+	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+	      {
+		yycount = 1;
+		yysize = yysize0;
+		yyformat[sizeof yyunexpected - 1] = '\0';
+		break;
+	      }
+	    yyarg[yycount++] = yytname[yyx];
+	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+	    yysize_overflow |= (yysize1 < yysize);
+	    yysize = yysize1;
+	    yyfmt = yystpcpy (yyfmt, yyprefix);
+	    yyprefix = yyor;
+	  }
+
+      yyf = YY_(yyformat);
+      yysize1 = yysize + yystrlen (yyf);
+      yysize_overflow |= (yysize1 < yysize);
+      yysize = yysize1;
+
+      if (yysize_overflow)
+	return YYSIZE_MAXIMUM;
+
+      if (yyresult)
+	{
+	  /* Avoid sprintf, as that infringes on the user's name space.
+	     Don't have undefined behavior even if the translation
+	     produced a string with the wrong number of "%s"s.  */
+	  char *yyp = yyresult;
+	  int yyi = 0;
+	  while ((*yyp = *yyf) != '\0')
+	    {
+	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+		{
+		  yyp += yytnamerr (yyp, yyarg[yyi++]);
+		  yyf += 2;
+		}
+	      else
+		{
+		  yyp++;
+		  yyf++;
+		}
+	    }
+	}
+      return yysize;
+    }
+}
+#endif /* YYERROR_VERBOSE */
+

+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+    const char *yymsg;
+    int yytype;
+    YYSTYPE *yyvaluep;
+#endif
+{
+  YYUSE (yyvaluep);
+
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+  switch (yytype)
+    {
+
+      default:
+	break;
+    }
+}
+

+
+/* Prevent warnings from -Wmissing-prototypes.  */
+
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* The look-ahead symbol.  */
+int yychar;
+
+/* The semantic value of the look-ahead symbol.  */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far.  */
+int yynerrs;
+
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+    void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+  
+  int yystate;
+  int yyn;
+  int yyresult;
+  /* Number of tokens to shift before error messages enabled.  */
+  int yyerrstatus;
+  /* Look-ahead token as an internal (translated) token number.  */
+  int yytoken = 0;
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+  /* Three stacks and their tools:
+     `yyss': related to states,
+     `yyvs': related to semantic values,
+     `yyls': related to locations.
+
+     Refer to the stacks thru separate pointers, to allow yyoverflow
+     to reallocate them elsewhere.  */
+
+  /* The state stack.  */
+  yytype_int16 yyssa[YYINITDEPTH];
+  yytype_int16 *yyss = yyssa;
+  yytype_int16 *yyssp;
+
+  /* The semantic value stack.  */
+  YYSTYPE yyvsa[YYINITDEPTH];
+  YYSTYPE *yyvs = yyvsa;
+  YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
+
+  YYSIZE_T yystacksize = YYINITDEPTH;
+
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+
+  /* The number of symbols on the RHS of the reduced rule.
+     Keep to zero when no symbol should be popped.  */
+  int yylen = 0;
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY;		/* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+
+  yyssp = yyss;
+  yyvsp = yyvs;
+
+  goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+ yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed.  So pushing a state here evens the stacks.  */
+  yyssp++;
+
+ yysetstate:
+  *yyssp = yystate;
+
+  if (yyss + yystacksize - 1 <= yyssp)
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      {
+	/* Give user a chance to reallocate the stack.  Use copies of
+	   these so that the &'s don't force the real ones into
+	   memory.  */
+	YYSTYPE *yyvs1 = yyvs;
+	yytype_int16 *yyss1 = yyss;
+
+
+	/* Each stack pointer address is followed by the size of the
+	   data in use in that stack, in bytes.  This used to be a
+	   conditional around just the two extra args, but that might
+	   be undefined if yyoverflow is a macro.  */
+	yyoverflow (YY_("memory exhausted"),
+		    &yyss1, yysize * sizeof (*yyssp),
+		    &yyvs1, yysize * sizeof (*yyvsp),
+
+		    &yystacksize);
+
+	yyss = yyss1;
+	yyvs = yyvs1;
+      }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+      goto yyexhaustedlab;
+# else
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+	goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+	yystacksize = YYMAXDEPTH;
+
+      {
+	yytype_int16 *yyss1 = yyss;
+	union yyalloc *yyptr =
+	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+	if (! yyptr)
+	  goto yyexhaustedlab;
+	YYSTACK_RELOCATE (yyss);
+	YYSTACK_RELOCATE (yyvs);
+
+#  undef YYSTACK_RELOCATE
+	if (yyss1 != yyssa)
+	  YYSTACK_FREE (yyss1);
+      }
+# endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+		  (unsigned long int) yystacksize));
+
+      if (yyss + yystacksize - 1 <= yyssp)
+	YYABORT;
+    }
+
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+  goto yybackup;
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+
+  /* Do appropriate processing given the current state.  Read a
+     look-ahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to look-ahead token.  */
+  yyn = yypact[yystate];
+  if (yyn == YYPACT_NINF)
+    goto yydefault;
+
+  /* Not known => get a look-ahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token: "));
+      yychar = YYLEX;
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = yytoken = YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+    goto yydefault;
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yyn == 0 || yyn == YYTABLE_NINF)
+	goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the look-ahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+  /* Discard the shifted token unless it is eof.  */
+  if (yychar != YYEOF)
+    yychar = YYEMPTY;
+
+  yystate = yyn;
+  *++yyvsp = yylval;
+
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     `$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
+    {
+        case 2:
+#line 217 "dt_grammar.y"
+    { return (dt_node_root((yyvsp[(1) - (2)].l_node))); }
+    break;
+
+  case 3:
+#line 218 "dt_grammar.y"
+    { return (dt_node_root((yyvsp[(1) - (2)].l_node))); }
+    break;
+
+  case 4:
+#line 219 "dt_grammar.y"
+    { return (dt_node_root((yyvsp[(1) - (2)].l_node))); }
+    break;
+
+  case 5:
+#line 222 "dt_grammar.y"
+    { (yyval.l_node) = NULL; }
+    break;
+
+  case 6:
+#line 223 "dt_grammar.y"
+    { (yyval.l_node) = (yyvsp[(2) - (2)].l_node); }
+    break;
+
+  case 7:
+#line 226 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_program(NULL); }
+    break;
+
+  case 8:
+#line 227 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_program((yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 9:
+#line 230 "dt_grammar.y"
+    { (yyval.l_node) = NULL; }
+    break;
+
+  case 10:
+#line 231 "dt_grammar.y"
+    { (yyval.l_node) = (dt_node_t *)(yyvsp[(2) - (2)].l_decl); }
+    break;
+
+  case 12:
+#line 236 "dt_grammar.y"
+    { (yyval.l_node) = LINK((yyvsp[(1) - (2)].l_node), (yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 18:
+#line 249 "dt_grammar.y"
+    { dt_scope_push(NULL, CTF_ERR); }
+    break;
+
+  case 19:
+#line 250 "dt_grammar.y"
+    {
+			/*
+			 * We push a new declaration scope before shifting the
+			 * assignment_expression in order to preserve ds_class
+			 * and ds_ident for use in dt_node_inline().  Once the
+			 * entire inline_definition rule is matched, pop the
+			 * scope and construct the inline using the saved decl.
+			 */
+			dt_scope_pop();
+			(yyval.l_node) = dt_node_inline((yyvsp[(6) - (7)].l_node));
+		}
+    break;
+
+  case 20:
+#line 265 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_xlator((yyvsp[(2) - (10)].l_decl), (yyvsp[(4) - (10)].l_decl), (yyvsp[(5) - (10)].l_str), (yyvsp[(8) - (10)].l_node));
+		}
+    break;
+
+  case 21:
+#line 269 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_xlator((yyvsp[(2) - (9)].l_decl), (yyvsp[(4) - (9)].l_decl), (yyvsp[(5) - (9)].l_str), NULL);
+		}
+    break;
+
+  case 23:
+#line 276 "dt_grammar.y"
+    { (yyval.l_node) = LINK((yyvsp[(1) - (2)].l_node),(yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 24:
+#line 280 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_member(NULL, (yyvsp[(1) - (4)].l_str), (yyvsp[(3) - (4)].l_node));
+		}
+    break;
+
+  case 25:
+#line 286 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_provider((yyvsp[(2) - (6)].l_str), (yyvsp[(4) - (6)].l_node));
+		}
+    break;
+
+  case 26:
+#line 289 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_provider((yyvsp[(2) - (5)].l_str), NULL);
+		}
+    break;
+
+  case 28:
+#line 296 "dt_grammar.y"
+    { (yyval.l_node) = LINK((yyvsp[(1) - (2)].l_node), (yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 29:
+#line 300 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_probe((yyvsp[(2) - (6)].l_str), 2, (yyvsp[(3) - (6)].l_node), (yyvsp[(5) - (6)].l_node));
+		}
+    break;
+
+  case 30:
+#line 303 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_probe((yyvsp[(2) - (4)].l_str), 1, (yyvsp[(3) - (4)].l_node), NULL);
+		}
+    break;
+
+  case 31:
+#line 310 "dt_grammar.y"
+    {
+			/*
+			 * If the input stream is a file, do not permit a probe
+			 * specification without / <pred> / or { <act> } after
+			 * it.  This can only occur if the next token is EOF or
+			 * an ambiguous predicate was slurped up as a comment.
+			 * We cannot perform this check if input() is a string
+			 * because dtrace(1M) [-fmnP] also use the compiler and
+			 * things like dtrace -n BEGIN have to be accepted.
+			 */
+			if (yypcb->pcb_fileptr != NULL) {
+				dnerror((yyvsp[(1) - (1)].l_node), D_SYNTAX, "expected predicate and/"
+				    "or actions following probe description\n");
+			}
+			(yyval.l_node) = dt_node_clause((yyvsp[(1) - (1)].l_node), NULL, NULL);
+		}
+    break;
+
+  case 32:
+#line 326 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_clause((yyvsp[(1) - (4)].l_node), NULL, (yyvsp[(3) - (4)].l_node));
+		}
+    break;
+
+  case 33:
+#line 329 "dt_grammar.y"
+    {
+			dnerror((yyvsp[(3) - (4)].l_node), D_SYNTAX, "expected actions { } following "
+			    "probe description and predicate\n");
+		}
+    break;
+
+  case 34:
+#line 334 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_clause((yyvsp[(1) - (7)].l_node), (yyvsp[(3) - (7)].l_node), (yyvsp[(6) - (7)].l_node));
+		}
+    break;
+
+  case 35:
+#line 340 "dt_grammar.y"
+    { yybegin(YYS_EXPR); (yyval.l_node) = (yyvsp[(1) - (1)].l_node); }
+    break;
+
+  case 37:
+#line 345 "dt_grammar.y"
+    {
+			(yyval.l_node) = LINK((yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 38:
+#line 351 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_pdesc_by_name((yyvsp[(1) - (1)].l_str)); }
+    break;
+
+  case 39:
+#line 352 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_pdesc_by_id((yyvsp[(1) - (1)].l_int)); }
+    break;
+
+  case 40:
+#line 355 "dt_grammar.y"
+    { (yyval.l_node) = (yyvsp[(1) - (1)].l_node); }
+    break;
+
+  case 41:
+#line 356 "dt_grammar.y"
+    { (yyval.l_node) = LINK((yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node)); }
+    break;
+
+  case 42:
+#line 359 "dt_grammar.y"
+    { (yyval.l_node) = NULL; }
+    break;
+
+  case 43:
+#line 360 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_statement((yyvsp[(1) - (1)].l_node)); }
+    break;
+
+  case 45:
+#line 365 "dt_grammar.y"
+    {
+			(yyval.l_node) = LINK((yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 46:
+#line 371 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_ident((yyvsp[(1) - (1)].l_str)); }
+    break;
+
+  case 47:
+#line 372 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_ident((yyvsp[(1) - (1)].l_str)); }
+    break;
+
+  case 48:
+#line 373 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_int((yyvsp[(1) - (1)].l_int)); }
+    break;
+
+  case 49:
+#line 374 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_string((yyvsp[(1) - (1)].l_str)); }
+    break;
+
+  case 50:
+#line 375 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_ident(DUP("self")); }
+    break;
+
+  case 51:
+#line 376 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_ident(DUP("this")); }
+    break;
+
+  case 52:
+#line 377 "dt_grammar.y"
+    { (yyval.l_node) = (yyvsp[(2) - (3)].l_node); }
+    break;
+
+  case 54:
+#line 383 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_LBRAC, (yyvsp[(1) - (4)].l_node), (yyvsp[(3) - (4)].l_node));
+		}
+    break;
+
+  case 55:
+#line 386 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_func((yyvsp[(1) - (3)].l_node), NULL);
+		}
+    break;
+
+  case 56:
+#line 390 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_func((yyvsp[(1) - (4)].l_node), (yyvsp[(3) - (4)].l_node));
+		}
+    break;
+
+  case 57:
+#line 393 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_DOT, (yyvsp[(1) - (3)].l_node), dt_node_ident((yyvsp[(3) - (3)].l_str)));
+		}
+    break;
+
+  case 58:
+#line 396 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_DOT, (yyvsp[(1) - (3)].l_node), dt_node_ident((yyvsp[(3) - (3)].l_str)));
+		}
+    break;
+
+  case 59:
+#line 399 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_PTR, (yyvsp[(1) - (3)].l_node), dt_node_ident((yyvsp[(3) - (3)].l_str)));
+		}
+    break;
+
+  case 60:
+#line 402 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_PTR, (yyvsp[(1) - (3)].l_node), dt_node_ident((yyvsp[(3) - (3)].l_str)));
+		}
+    break;
+
+  case 61:
+#line 405 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP1(DT_TOK_POSTINC, (yyvsp[(1) - (2)].l_node));
+		}
+    break;
+
+  case 62:
+#line 408 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP1(DT_TOK_POSTDEC, (yyvsp[(1) - (2)].l_node));
+		}
+    break;
+
+  case 63:
+#line 412 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_offsetof((yyvsp[(3) - (6)].l_decl), (yyvsp[(5) - (6)].l_str));
+		}
+    break;
+
+  case 64:
+#line 416 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_offsetof((yyvsp[(3) - (6)].l_decl), (yyvsp[(5) - (6)].l_str));
+		}
+    break;
+
+  case 65:
+#line 420 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_XLATE, dt_node_type((yyvsp[(3) - (7)].l_decl)), (yyvsp[(6) - (7)].l_node));
+		}
+    break;
+
+  case 67:
+#line 427 "dt_grammar.y"
+    { (yyval.l_node) = OP1(DT_TOK_PREINC, (yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 68:
+#line 428 "dt_grammar.y"
+    { (yyval.l_node) = OP1(DT_TOK_PREDEC, (yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 69:
+#line 429 "dt_grammar.y"
+    { (yyval.l_node) = OP1((yyvsp[(1) - (2)].l_tok), (yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 70:
+#line 430 "dt_grammar.y"
+    { (yyval.l_node) = OP1(DT_TOK_SIZEOF, (yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 71:
+#line 431 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP1(DT_TOK_SIZEOF, dt_node_type((yyvsp[(3) - (4)].l_decl)));
+		}
+    break;
+
+  case 72:
+#line 434 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP1(DT_TOK_STRINGOF, (yyvsp[(2) - (2)].l_node));
+		}
+    break;
+
+  case 73:
+#line 439 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_ADDROF; }
+    break;
+
+  case 74:
+#line 440 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_DEREF; }
+    break;
+
+  case 75:
+#line 441 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_IPOS; }
+    break;
+
+  case 76:
+#line 442 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_INEG; }
+    break;
+
+  case 77:
+#line 443 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_BNEG; }
+    break;
+
+  case 78:
+#line 444 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_LNEG; }
+    break;
+
+  case 80:
+#line 449 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_LPAR, dt_node_type((yyvsp[(2) - (4)].l_decl)), (yyvsp[(4) - (4)].l_node));
+		}
+    break;
+
+  case 82:
+#line 456 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_MUL, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 83:
+#line 459 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_DIV, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 84:
+#line 462 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_MOD, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 86:
+#line 469 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_ADD, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 87:
+#line 472 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_SUB, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 89:
+#line 479 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_LSH, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 90:
+#line 482 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_RSH, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 92:
+#line 489 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_LT, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 93:
+#line 492 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_GT, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 94:
+#line 495 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_LE, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 95:
+#line 498 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_GE, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 97:
+#line 505 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_EQU, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 98:
+#line 508 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_NEQ, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 100:
+#line 515 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_BAND, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 102:
+#line 522 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_XOR, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 104:
+#line 529 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_BOR, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 106:
+#line 536 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_LAND, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 108:
+#line 543 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_LXOR, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 110:
+#line 550 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_LOR, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 113:
+#line 561 "dt_grammar.y"
+    { (yyval.l_node) = OP3((yyvsp[(1) - (5)].l_node), (yyvsp[(3) - (5)].l_node), (yyvsp[(5) - (5)].l_node)); }
+    break;
+
+  case 115:
+#line 566 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2((yyvsp[(2) - (3)].l_tok), (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 116:
+#line 572 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_ASGN; }
+    break;
+
+  case 117:
+#line 573 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_MUL_EQ; }
+    break;
+
+  case 118:
+#line 574 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_DIV_EQ; }
+    break;
+
+  case 119:
+#line 575 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_MOD_EQ; }
+    break;
+
+  case 120:
+#line 576 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_ADD_EQ; }
+    break;
+
+  case 121:
+#line 577 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_SUB_EQ; }
+    break;
+
+  case 122:
+#line 578 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_LSH_EQ; }
+    break;
+
+  case 123:
+#line 579 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_RSH_EQ; }
+    break;
+
+  case 124:
+#line 580 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_AND_EQ; }
+    break;
+
+  case 125:
+#line 581 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_XOR_EQ; }
+    break;
+
+  case 126:
+#line 582 "dt_grammar.y"
+    { (yyval.l_tok) = DT_TOK_OR_EQ; }
+    break;
+
+  case 128:
+#line 586 "dt_grammar.y"
+    {
+			(yyval.l_node) = OP2(DT_TOK_COMMA, (yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 129:
+#line 591 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_decl();
+			dt_decl_free(dt_decl_pop());
+			yybegin(YYS_CLAUSE);
+		}
+    break;
+
+  case 130:
+#line 596 "dt_grammar.y"
+    {
+			(yyval.l_node) = (yyvsp[(2) - (3)].l_node);
+			dt_decl_free(dt_decl_pop());
+			yybegin(YYS_CLAUSE);
+		}
+    break;
+
+  case 143:
+#line 622 "dt_grammar.y"
+    { dt_decl_class(DT_DC_AUTO); }
+    break;
+
+  case 144:
+#line 623 "dt_grammar.y"
+    { dt_decl_class(DT_DC_REGISTER); }
+    break;
+
+  case 145:
+#line 624 "dt_grammar.y"
+    { dt_decl_class(DT_DC_STATIC); }
+    break;
+
+  case 146:
+#line 625 "dt_grammar.y"
+    { dt_decl_class(DT_DC_EXTERN); }
+    break;
+
+  case 147:
+#line 626 "dt_grammar.y"
+    { dt_decl_class(DT_DC_TYPEDEF); }
+    break;
+
+  case 149:
+#line 631 "dt_grammar.y"
+    { dt_decl_class(DT_DC_SELF); }
+    break;
+
+  case 150:
+#line 632 "dt_grammar.y"
+    { dt_decl_class(DT_DC_THIS); }
+    break;
+
+  case 151:
+#line 635 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec(CTF_K_INTEGER, DUP("void")); }
+    break;
+
+  case 152:
+#line 636 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec(CTF_K_INTEGER, DUP("char")); }
+    break;
+
+  case 153:
+#line 637 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_attr(DT_DA_SHORT); }
+    break;
+
+  case 154:
+#line 638 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec(CTF_K_INTEGER, DUP("int")); }
+    break;
+
+  case 155:
+#line 639 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_attr(DT_DA_LONG); }
+    break;
+
+  case 156:
+#line 640 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec(CTF_K_FLOAT, DUP("float")); }
+    break;
+
+  case 157:
+#line 641 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec(CTF_K_FLOAT, DUP("double")); }
+    break;
+
+  case 158:
+#line 642 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_attr(DT_DA_SIGNED); }
+    break;
+
+  case 159:
+#line 643 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_attr(DT_DA_UNSIGNED); }
+    break;
+
+  case 160:
+#line 644 "dt_grammar.y"
+    {
+			(yyval.l_decl) = dt_decl_spec(CTF_K_TYPEDEF, DUP("string"));
+		}
+    break;
+
+  case 161:
+#line 647 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec(CTF_K_TYPEDEF, (yyvsp[(1) - (1)].l_str)); }
+    break;
+
+  case 164:
+#line 652 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_attr(DT_DA_CONST); }
+    break;
+
+  case 165:
+#line 653 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_attr(DT_DA_RESTRICT); }
+    break;
+
+  case 166:
+#line 654 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_attr(DT_DA_VOLATILE); }
+    break;
+
+  case 167:
+#line 658 "dt_grammar.y"
+    {
+			(yyval.l_decl) = dt_scope_pop();
+		}
+    break;
+
+  case 168:
+#line 661 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec((yyvsp[(1) - (2)].l_tok), (yyvsp[(2) - (2)].l_str)); }
+    break;
+
+  case 169:
+#line 662 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec((yyvsp[(1) - (2)].l_tok), (yyvsp[(2) - (2)].l_str)); }
+    break;
+
+  case 170:
+#line 666 "dt_grammar.y"
+    { dt_decl_sou((yyvsp[(1) - (2)].l_tok), NULL); }
+    break;
+
+  case 171:
+#line 667 "dt_grammar.y"
+    { dt_decl_sou((yyvsp[(1) - (3)].l_tok), (yyvsp[(2) - (3)].l_str)); }
+    break;
+
+  case 172:
+#line 668 "dt_grammar.y"
+    { dt_decl_sou((yyvsp[(1) - (3)].l_tok), (yyvsp[(2) - (3)].l_str)); }
+    break;
+
+  case 173:
+#line 672 "dt_grammar.y"
+    { (yyval.l_tok) = CTF_K_STRUCT; }
+    break;
+
+  case 174:
+#line 673 "dt_grammar.y"
+    { (yyval.l_tok) = CTF_K_UNION; }
+    break;
+
+  case 178:
+#line 683 "dt_grammar.y"
+    {
+			(yyval.l_node) = LINK((yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 179:
+#line 689 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_decl();
+			dt_decl_reset();
+		}
+    break;
+
+  case 180:
+#line 696 "dt_grammar.y"
+    {
+			dt_decl_free(dt_decl_pop());
+		}
+    break;
+
+  case 182:
+#line 703 "dt_grammar.y"
+    { (yyval.l_decl) = (yyvsp[(2) - (2)].l_decl); }
+    break;
+
+  case 184:
+#line 705 "dt_grammar.y"
+    { (yyval.l_decl) = (yyvsp[(2) - (2)].l_decl); }
+    break;
+
+  case 187:
+#line 714 "dt_grammar.y"
+    { dt_decl_member(NULL); }
+    break;
+
+  case 188:
+#line 715 "dt_grammar.y"
+    { dt_decl_member((yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 189:
+#line 716 "dt_grammar.y"
+    {
+			dt_decl_member((yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 190:
+#line 722 "dt_grammar.y"
+    { (yyval.l_decl) = dt_scope_pop(); }
+    break;
+
+  case 191:
+#line 723 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec(CTF_K_ENUM, (yyvsp[(2) - (2)].l_str)); }
+    break;
+
+  case 192:
+#line 724 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_spec(CTF_K_ENUM, (yyvsp[(2) - (2)].l_str)); }
+    break;
+
+  case 193:
+#line 728 "dt_grammar.y"
+    { dt_decl_enum(NULL); }
+    break;
+
+  case 194:
+#line 729 "dt_grammar.y"
+    { dt_decl_enum((yyvsp[(2) - (3)].l_str)); }
+    break;
+
+  case 195:
+#line 730 "dt_grammar.y"
+    { dt_decl_enum((yyvsp[(2) - (3)].l_str)); }
+    break;
+
+  case 198:
+#line 738 "dt_grammar.y"
+    { dt_decl_enumerator((yyvsp[(1) - (1)].l_str), NULL); }
+    break;
+
+  case 199:
+#line 739 "dt_grammar.y"
+    {
+			dt_decl_enumerator((yyvsp[(1) - (3)].l_str), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 202:
+#line 749 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_ident((yyvsp[(1) - (1)].l_str)); }
+    break;
+
+  case 203:
+#line 750 "dt_grammar.y"
+    { (yyval.l_decl) = (yyvsp[(2) - (3)].l_decl); }
+    break;
+
+  case 204:
+#line 751 "dt_grammar.y"
+    { dt_decl_array((yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 205:
+#line 752 "dt_grammar.y"
+    { dt_decl_func((yyvsp[(1) - (2)].l_decl), (yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 206:
+#line 755 "dt_grammar.y"
+    { dt_decl_top()->dd_attr |= DT_DA_PAREN; }
+    break;
+
+  case 207:
+#line 758 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_ptr(); }
+    break;
+
+  case 208:
+#line 759 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_ptr(); }
+    break;
+
+  case 209:
+#line 760 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_ptr(); }
+    break;
+
+  case 210:
+#line 761 "dt_grammar.y"
+    { (yyval.l_decl) = dt_decl_ptr(); }
+    break;
+
+  case 212:
+#line 766 "dt_grammar.y"
+    { (yyval.l_decl) = (yyvsp[(2) - (2)].l_decl); }
+    break;
+
+  case 214:
+#line 771 "dt_grammar.y"
+    { (yyval.l_node) = dt_node_vatype(); }
+    break;
+
+  case 215:
+#line 772 "dt_grammar.y"
+    {
+			(yyval.l_node) = LINK((yyvsp[(1) - (3)].l_node), dt_node_vatype());
+		}
+    break;
+
+  case 217:
+#line 778 "dt_grammar.y"
+    {
+			(yyval.l_node) = LINK((yyvsp[(1) - (3)].l_node), (yyvsp[(3) - (3)].l_node));
+		}
+    break;
+
+  case 218:
+#line 784 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_type(NULL);
+		}
+    break;
+
+  case 219:
+#line 787 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_type(NULL);
+		}
+    break;
+
+  case 220:
+#line 790 "dt_grammar.y"
+    {
+			(yyval.l_node) = dt_node_type(NULL);
+		}
+    break;
+
+  case 221:
+#line 795 "dt_grammar.y"
+    {
+			(yyval.l_decl) = dt_decl_pop();
+		}
+    break;
+
+  case 222:
+#line 798 "dt_grammar.y"
+    {
+			(yyval.l_decl) = dt_decl_pop();
+		}
+    break;
+
+  case 226:
+#line 810 "dt_grammar.y"
+    { (yyval.l_decl) = (yyvsp[(2) - (3)].l_decl); }
+    break;
+
+  case 227:
+#line 811 "dt_grammar.y"
+    { dt_decl_array((yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 228:
+#line 812 "dt_grammar.y"
+    { dt_decl_array((yyvsp[(1) - (1)].l_node)); (yyval.l_decl) = NULL; }
+    break;
+
+  case 229:
+#line 813 "dt_grammar.y"
+    { dt_decl_func((yyvsp[(1) - (2)].l_decl), (yyvsp[(2) - (2)].l_node)); }
+    break;
+
+  case 230:
+#line 814 "dt_grammar.y"
+    { dt_decl_func(NULL, (yyvsp[(1) - (1)].l_node)); }
+    break;
+
+  case 231:
+#line 817 "dt_grammar.y"
+    { dt_scope_push(NULL, CTF_ERR); }
+    break;
+
+  case 232:
+#line 818 "dt_grammar.y"
+    {
+			dt_scope_pop();
+			(yyval.l_node) = (yyvsp[(3) - (4)].l_node);
+		}
+    break;
+
+  case 233:
+#line 825 "dt_grammar.y"
+    { (yyval.l_node) = NULL; }
+    break;
+
+  case 234:
+#line 826 "dt_grammar.y"
+    { (yyval.l_node) = (yyvsp[(1) - (1)].l_node); }
+    break;
+
+  case 235:
+#line 827 "dt_grammar.y"
+    { (yyval.l_node) = (yyvsp[(1) - (1)].l_node); }
+    break;
+
+  case 236:
+#line 830 "dt_grammar.y"
+    { dt_scope_push(NULL, CTF_ERR); }
+    break;
+
+  case 237:
+#line 831 "dt_grammar.y"
+    {
+			dt_scope_pop();
+			(yyval.l_node) = (yyvsp[(3) - (4)].l_node);
+		}
+    break;
+
+  case 238:
+#line 838 "dt_grammar.y"
+    { (yyval.l_node) = NULL; }
+    break;
+
+  case 239:
+#line 839 "dt_grammar.y"
+    { (yyval.l_node) = (yyvsp[(1) - (1)].l_node); }
+    break;
+
+
+/* Line 1267 of yacc.c.  */
+#line 3143 "dt_grammar.c"
+      default: break;
+    }
+  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+
+  *++yyvsp = yyval;
+
+
+  /* Now `shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTOKENS];
+
+  goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+#if ! YYERROR_VERBOSE
+      yyerror (YY_("syntax error"));
+#else
+      {
+	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+	  {
+	    YYSIZE_T yyalloc = 2 * yysize;
+	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
+	    if (yymsg != yymsgbuf)
+	      YYSTACK_FREE (yymsg);
+	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+	    if (yymsg)
+	      yymsg_alloc = yyalloc;
+	    else
+	      {
+		yymsg = yymsgbuf;
+		yymsg_alloc = sizeof yymsgbuf;
+	      }
+	  }
+
+	if (0 < yysize && yysize <= yymsg_alloc)
+	  {
+	    (void) yysyntax_error (yymsg, yystate, yychar);
+	    yyerror (yymsg);
+	  }
+	else
+	  {
+	    yyerror (YY_("syntax error"));
+	    if (yysize != 0)
+	      goto yyexhaustedlab;
+	  }
+      }
+#endif
+    }
+
+
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse look-ahead token after an
+	 error, discard it.  */
+
+      if (yychar <= YYEOF)
+	{
+	  /* Return failure if at end of input.  */
+	  if (yychar == YYEOF)
+	    YYABORT;
+	}
+      else
+	{
+	  yydestruct ("Error: discarding",
+		      yytoken, &yylval);
+	  yychar = YYEMPTY;
+	}
+    }
+
+  /* Else will try to reuse look-ahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+
+  /* Pacify compilers like GCC when the user code never invokes
+     YYERROR and the label yyerrorlab therefore never appears in user
+     code.  */
+  if (/*CONSTCOND*/ 0)
+     goto yyerrorlab;
+
+  /* Do not reclaim the symbols of the rule which action triggered
+     this YYERROR.  */
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+  yystate = *yyssp;
+  goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
+
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (yyn != YYPACT_NINF)
+	{
+	  yyn += YYTERROR;
+	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+	    {
+	      yyn = yytable[yyn];
+	      if (0 < yyn)
+		break;
+	    }
+	}
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+	YYABORT;
+
+
+      yydestruct ("Error: popping",
+		  yystos[yystate], yyvsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  *++yyvsp = yylval;
+
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturn;
+
+#ifndef yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  /* Fall through.  */
+#endif
+
+yyreturn:
+  if (yychar != YYEOF && yychar != YYEMPTY)
+     yydestruct ("Cleanup: discarding lookahead",
+		 yytoken, &yylval);
+  /* Do not reclaim the symbols of the rule which action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+		  yystos[*yyssp], yyvsp);
+      YYPOPSTACK (1);
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+  if (yymsg != yymsgbuf)
+    YYSTACK_FREE (yymsg);
+#endif
+  /* Make sure YYID is used.  */
+  return YYID (yyresult);
+}
+
+
+#line 842 "dt_grammar.y"
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/generated/dt_grammar.h b/src/VBox/ExtPacks/VBoxDTrace/generated/dt_grammar.h
new file mode 100644
index 0000000..5d7538f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/generated/dt_grammar.h
@@ -0,0 +1,284 @@
+/* A Bison parser, made by GNU Bison 2.3.  */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     DT_TOK_EOF = 0,
+     DT_TOK_COMMA = 258,
+     DT_TOK_ELLIPSIS = 259,
+     DT_TOK_ASGN = 260,
+     DT_TOK_ADD_EQ = 261,
+     DT_TOK_SUB_EQ = 262,
+     DT_TOK_MUL_EQ = 263,
+     DT_TOK_DIV_EQ = 264,
+     DT_TOK_MOD_EQ = 265,
+     DT_TOK_AND_EQ = 266,
+     DT_TOK_XOR_EQ = 267,
+     DT_TOK_OR_EQ = 268,
+     DT_TOK_LSH_EQ = 269,
+     DT_TOK_RSH_EQ = 270,
+     DT_TOK_QUESTION = 271,
+     DT_TOK_COLON = 272,
+     DT_TOK_LOR = 273,
+     DT_TOK_LXOR = 274,
+     DT_TOK_LAND = 275,
+     DT_TOK_BOR = 276,
+     DT_TOK_XOR = 277,
+     DT_TOK_BAND = 278,
+     DT_TOK_EQU = 279,
+     DT_TOK_NEQ = 280,
+     DT_TOK_LT = 281,
+     DT_TOK_LE = 282,
+     DT_TOK_GT = 283,
+     DT_TOK_GE = 284,
+     DT_TOK_LSH = 285,
+     DT_TOK_RSH = 286,
+     DT_TOK_ADD = 287,
+     DT_TOK_SUB = 288,
+     DT_TOK_MUL = 289,
+     DT_TOK_DIV = 290,
+     DT_TOK_MOD = 291,
+     DT_TOK_LNEG = 292,
+     DT_TOK_BNEG = 293,
+     DT_TOK_ADDADD = 294,
+     DT_TOK_SUBSUB = 295,
+     DT_TOK_PREINC = 296,
+     DT_TOK_POSTINC = 297,
+     DT_TOK_PREDEC = 298,
+     DT_TOK_POSTDEC = 299,
+     DT_TOK_IPOS = 300,
+     DT_TOK_INEG = 301,
+     DT_TOK_DEREF = 302,
+     DT_TOK_ADDROF = 303,
+     DT_TOK_OFFSETOF = 304,
+     DT_TOK_SIZEOF = 305,
+     DT_TOK_STRINGOF = 306,
+     DT_TOK_XLATE = 307,
+     DT_TOK_LPAR = 308,
+     DT_TOK_RPAR = 309,
+     DT_TOK_LBRAC = 310,
+     DT_TOK_RBRAC = 311,
+     DT_TOK_PTR = 312,
+     DT_TOK_DOT = 313,
+     DT_TOK_STRING = 314,
+     DT_TOK_IDENT = 315,
+     DT_TOK_PSPEC = 316,
+     DT_TOK_AGG = 317,
+     DT_TOK_TNAME = 318,
+     DT_TOK_INT = 319,
+     DT_KEY_AUTO = 320,
+     DT_KEY_BREAK = 321,
+     DT_KEY_CASE = 322,
+     DT_KEY_CHAR = 323,
+     DT_KEY_CONST = 324,
+     DT_KEY_CONTINUE = 325,
+     DT_KEY_COUNTER = 326,
+     DT_KEY_DEFAULT = 327,
+     DT_KEY_DO = 328,
+     DT_KEY_DOUBLE = 329,
+     DT_KEY_ELSE = 330,
+     DT_KEY_ENUM = 331,
+     DT_KEY_EXTERN = 332,
+     DT_KEY_FLOAT = 333,
+     DT_KEY_FOR = 334,
+     DT_KEY_GOTO = 335,
+     DT_KEY_IF = 336,
+     DT_KEY_IMPORT = 337,
+     DT_KEY_INLINE = 338,
+     DT_KEY_INT = 339,
+     DT_KEY_LONG = 340,
+     DT_KEY_PROBE = 341,
+     DT_KEY_PROVIDER = 342,
+     DT_KEY_REGISTER = 343,
+     DT_KEY_RESTRICT = 344,
+     DT_KEY_RETURN = 345,
+     DT_KEY_SELF = 346,
+     DT_KEY_SHORT = 347,
+     DT_KEY_SIGNED = 348,
+     DT_KEY_STATIC = 349,
+     DT_KEY_STRING = 350,
+     DT_KEY_STRUCT = 351,
+     DT_KEY_SWITCH = 352,
+     DT_KEY_THIS = 353,
+     DT_KEY_TYPEDEF = 354,
+     DT_KEY_UNION = 355,
+     DT_KEY_UNSIGNED = 356,
+     DT_KEY_VOID = 357,
+     DT_KEY_VOLATILE = 358,
+     DT_KEY_WHILE = 359,
+     DT_KEY_XLATOR = 360,
+     DT_TOK_EPRED = 361,
+     DT_CTX_DEXPR = 362,
+     DT_CTX_DPROG = 363,
+     DT_CTX_DTYPE = 364
+   };
+#endif
+/* Tokens.  */
+#define DT_TOK_EOF 0
+#define DT_TOK_COMMA 258
+#define DT_TOK_ELLIPSIS 259
+#define DT_TOK_ASGN 260
+#define DT_TOK_ADD_EQ 261
+#define DT_TOK_SUB_EQ 262
+#define DT_TOK_MUL_EQ 263
+#define DT_TOK_DIV_EQ 264
+#define DT_TOK_MOD_EQ 265
+#define DT_TOK_AND_EQ 266
+#define DT_TOK_XOR_EQ 267
+#define DT_TOK_OR_EQ 268
+#define DT_TOK_LSH_EQ 269
+#define DT_TOK_RSH_EQ 270
+#define DT_TOK_QUESTION 271
+#define DT_TOK_COLON 272
+#define DT_TOK_LOR 273
+#define DT_TOK_LXOR 274
+#define DT_TOK_LAND 275
+#define DT_TOK_BOR 276
+#define DT_TOK_XOR 277
+#define DT_TOK_BAND 278
+#define DT_TOK_EQU 279
+#define DT_TOK_NEQ 280
+#define DT_TOK_LT 281
+#define DT_TOK_LE 282
+#define DT_TOK_GT 283
+#define DT_TOK_GE 284
+#define DT_TOK_LSH 285
+#define DT_TOK_RSH 286
+#define DT_TOK_ADD 287
+#define DT_TOK_SUB 288
+#define DT_TOK_MUL 289
+#define DT_TOK_DIV 290
+#define DT_TOK_MOD 291
+#define DT_TOK_LNEG 292
+#define DT_TOK_BNEG 293
+#define DT_TOK_ADDADD 294
+#define DT_TOK_SUBSUB 295
+#define DT_TOK_PREINC 296
+#define DT_TOK_POSTINC 297
+#define DT_TOK_PREDEC 298
+#define DT_TOK_POSTDEC 299
+#define DT_TOK_IPOS 300
+#define DT_TOK_INEG 301
+#define DT_TOK_DEREF 302
+#define DT_TOK_ADDROF 303
+#define DT_TOK_OFFSETOF 304
+#define DT_TOK_SIZEOF 305
+#define DT_TOK_STRINGOF 306
+#define DT_TOK_XLATE 307
+#define DT_TOK_LPAR 308
+#define DT_TOK_RPAR 309
+#define DT_TOK_LBRAC 310
+#define DT_TOK_RBRAC 311
+#define DT_TOK_PTR 312
+#define DT_TOK_DOT 313
+#define DT_TOK_STRING 314
+#define DT_TOK_IDENT 315
+#define DT_TOK_PSPEC 316
+#define DT_TOK_AGG 317
+#define DT_TOK_TNAME 318
+#define DT_TOK_INT 319
+#define DT_KEY_AUTO 320
+#define DT_KEY_BREAK 321
+#define DT_KEY_CASE 322
+#define DT_KEY_CHAR 323
+#define DT_KEY_CONST 324
+#define DT_KEY_CONTINUE 325
+#define DT_KEY_COUNTER 326
+#define DT_KEY_DEFAULT 327
+#define DT_KEY_DO 328
+#define DT_KEY_DOUBLE 329
+#define DT_KEY_ELSE 330
+#define DT_KEY_ENUM 331
+#define DT_KEY_EXTERN 332
+#define DT_KEY_FLOAT 333
+#define DT_KEY_FOR 334
+#define DT_KEY_GOTO 335
+#define DT_KEY_IF 336
+#define DT_KEY_IMPORT 337
+#define DT_KEY_INLINE 338
+#define DT_KEY_INT 339
+#define DT_KEY_LONG 340
+#define DT_KEY_PROBE 341
+#define DT_KEY_PROVIDER 342
+#define DT_KEY_REGISTER 343
+#define DT_KEY_RESTRICT 344
+#define DT_KEY_RETURN 345
+#define DT_KEY_SELF 346
+#define DT_KEY_SHORT 347
+#define DT_KEY_SIGNED 348
+#define DT_KEY_STATIC 349
+#define DT_KEY_STRING 350
+#define DT_KEY_STRUCT 351
+#define DT_KEY_SWITCH 352
+#define DT_KEY_THIS 353
+#define DT_KEY_TYPEDEF 354
+#define DT_KEY_UNION 355
+#define DT_KEY_UNSIGNED 356
+#define DT_KEY_VOID 357
+#define DT_KEY_VOLATILE 358
+#define DT_KEY_WHILE 359
+#define DT_KEY_XLATOR 360
+#define DT_TOK_EPRED 361
+#define DT_CTX_DEXPR 362
+#define DT_CTX_DPROG 363
+#define DT_CTX_DTYPE 364
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 47 "dt_grammar.y"
+{
+	dt_node_t *l_node;
+	dt_decl_t *l_decl;
+	char *l_str;
+	uintmax_t l_int;
+	int l_tok;
+}
+/* Line 1529 of yacc.c.  */
+#line 277 "dt_grammar.h"
+	YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE yylval;
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/generated/dt_lex.c b/src/VBox/ExtPacks/VBoxDTrace/generated/dt_lex.c
new file mode 100644
index 0000000..8026f40
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/generated/dt_lex.c
@@ -0,0 +1,3763 @@
+#line 2 "dt_lex.c"
+
+#line 4 "dt_lex.c"
+
+#define  YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with  platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types. 
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t; 
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN               (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN              (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN              (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX               (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX              (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX              (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX              (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX             (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX             (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else	/* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif	/* defined (__STDC__) */
+#endif	/* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin  )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+     *       access to the local variable yy_act. Since yyless() is a macro, it would break
+     *       existing scanners that call yyless() from OUTSIDE yylex. 
+     *       One obvious solution it to make yy_act a global. I tried that, and saw
+     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
+     *       normally declared as a register variable-- so it is not worth it.
+     */
+    #define  YY_LESS_LINENO(n) \
+            do { \
+                yy_size_t yyl;\
+                for ( yyl = n; yyl < yyleng; ++yyl )\
+                    if ( yytext[yyl] == '\n' )\
+                        --yylineno;\
+            }while(0)
+    
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		*yy_cp = (yy_hold_char); \
+		YY_RESTORE_YY_MORE_OFFSET \
+		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+		} \
+	while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr)  )
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+	{
+	FILE *yy_input_file;
+
+	char *yy_ch_buf;		/* input buffer */
+	char *yy_buf_pos;		/* current position in input buffer */
+
+	/* Size of input buffer in bytes, not including room for EOB
+	 * characters.
+	 */
+	yy_size_t yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	yy_size_t yy_n_chars;
+
+	/* Whether we "own" the buffer - i.e., we know we created it,
+	 * and can realloc() it to grow it, and should free() it to
+	 * delete it.
+	 */
+	int yy_is_our_buffer;
+
+	/* Whether this is an "interactive" input source; if so, and
+	 * if we're using stdio for input, then we want to use getc()
+	 * instead of fread(), to make sure we stop fetching input after
+	 * each newline.
+	 */
+	int yy_is_interactive;
+
+	/* Whether we're considered to be at the beginning of a line.
+	 * If so, '^' rules will be active on the next match, otherwise
+	 * not.
+	 */
+	int yy_at_bol;
+
+    int yy_bs_lineno; /**< The line count. */
+    int yy_bs_column; /**< The column count. */
+    
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
+
+	int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+	/* When an EOF's been seen but there's still some text to process
+	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+	 * shouldn't try reading from the input source any more.  We might
+	 * still have a bunch of tokens to match, though, because of
+	 * possible backing-up.
+	 *
+	 * When we actually see the EOF, we change the status to "new"
+	 * (via yyrestart()), so that the user can continue scanning by
+	 * just pointing yyin at a new input file.
+	 */
+#define YY_BUFFER_EOF_PENDING 2
+
+	};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+                          : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
+yy_size_t yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0;		/* whether we need to initialize */
+static int yy_start = 0;	/* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin.  A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file  );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
+void yy_delete_buffer (YY_BUFFER_STATE b  );
+void yy_flush_buffer (YY_BUFFER_STATE b  );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len  );
+
+void *yyalloc (yy_size_t  );
+void *yyrealloc (void *,yy_size_t  );
+void yyfree (void *  );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){ \
+        yyensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer(yyin,YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+	}
+
+#define yy_set_bol(at_bol) \
+	{ \
+	if ( ! YY_CURRENT_BUFFER ){\
+        yyensure_buffer_stack (); \
+		YY_CURRENT_BUFFER_LVALUE =    \
+            yy_create_buffer(yyin,YY_BUF_SIZE ); \
+	} \
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+	}
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+#define YY_FLEX_LEX_COMPAT
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char yytext[];
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
+static int yy_get_next_buffer (void );
+static void yy_fatal_error (yyconst char msg[]  );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+	(yytext_ptr) = yy_bp; \
+	yyleng = (size_t) (yy_cp - yy_bp); \
+	(yy_hold_char) = *yy_cp; \
+	*yy_cp = '\0'; \
+	if ( yyleng + (yy_more_offset) >= YYLMAX ) \
+		YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
+	yy_flex_strncpy( &yytext[(yy_more_offset)], (yytext_ptr), yyleng + 1 ); \
+	yyleng += (yy_more_offset); \
+	(yy_prev_more_offset) = (yy_more_offset); \
+	(yy_more_offset) = 0; \
+	(yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 162
+#define YY_END_OF_BUFFER 163
+/* This struct is not used in this scanner,
+   but its presence is necessary. */
+struct yy_trans_info
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static yyconst flex_int16_t yy_acclist[740] =
+    {   0,
+      163,  162,  149,  162,  147,  149,  162,  147,  162,  126,
+      149,  162,  149,  162,16469,  149,  162,  124,  149,  162,
+      109,  149,  162,  149,  162,16472,  100,  149,  162,  101,
+      149,  162,  123,  149,  162,  121,  149,  162,  145,  149,
+      162,  122,  149,  162,  129,  149,  162,   99,  149,  162,
+       81,   84,  149,  162,   81,   84,  149,  162,  128,  149,
+      162,  146,  149,  162,  115,  149,  162,  131,  149,  162,
+      117,  149,  162,  127,  149,  162,   80,  149,  162,   78,
+      149,  162,  102,  149,  162,  149,  162,  103,  149,  162,
+      108,  149,  162,   78,  149,  162,   78,  149,  162,   78,
+
+      149,  162,   78,  149,  162,   78,  149,  162,   78,  149,
+      162,   78,  149,  162,   78,  149,  162,   78,  149,  162,
+       78,  149,  162,   78,  149,  162,   78,  149,  162,   78,
+      149,  162,   78,  149,  162,   78,  149,  162,   78,  149,
+      162,   78,  149,  162,   78,  149,  162,  104,  149,  162,
+      107,  149,  162,  106,  149,  162,  125,  149,  162,  147,
+      149,  162,   94,  149,  162,  152,  162,  152,  162,  152,
+      162,  157,  162,  156,  157,  162,  156,  162,  153,  157,
+      162,  155,  157,  162,  154,  157,  162,   82,  157,  162,
+       82,  157,  162,  153,  157,  162,  153,  157,  162,  153,
+
+      157,  162,  153,  157,  162,  153,  157,  162,  153,  157,
+      162,  153,  157,  162,  153,  157,  162,  153,  157,  162,
+      153,  157,  162,  153,  157,  162,  153,  157,  162,  153,
+      157,  162,  105,  157,  162,  156,  157,  162,   95,  157,
+      162,  160,  161,  162,  159,  161,  162,  158,  162,  161,
+      162,16469,   83,  160,  161,  162,   83,  160,  161,  162,
+       97,  162,   98,  162,   97,  162,   96,   97,  162,  114,
+    16469, 8277,   86,   75,   77,  136,  110,  137,16472, 8280,
+       89,  134,  142,  132,  143,  133,  130,   84,   90,  135,
+       84,   81,   84,   84,   81,   84,   81,  119,  116,  113,
+
+      118,  120,   79,   78,  148,  138,  111,   78,   78,   78,
+       78,   78,   78,    9,   78,   78,   78,   78,   78,   78,
+       78,   17,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,  139,  112,   94,   92,  151,  150,  153,   91,   82,
+       82,   82,  153,  153,  153,  153,  153,  153,  153,  153,
+      153,  153,  153,  153,  153,  153,  153,  153,  153,  153,
+      153,  153,  153,   95,   93,  160,  159,16469,   87,   83,
+      160,   83,  160,   83,  160,  160,   96,   74,   76,   77,
+      144,   84,   84,   81,   81,   81,  140,  141,   79,   78,
+
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,   15,   78,   78,   78,   78,   20,   78,   78,   78,
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,   78,   78,   78,   78,   78,   78,   78,   78,   78,
+       92,   82,   82,  153,  153,  153,  153,  153,  153,  153,
+      153,  153,  153,   56,  153,  153,  153,  153,  153,  153,
+      153,  153,  153,  153,  153,  153,  153,  153,  153,  153,
+      153,   93,   83,  160,   83,  160,   76,    1,   78,   78,
+        3,   78,    4,   78,   78,   78,   78,   78,   78,   11,
+       78,   12,   78,   78,   78,   16,   78,   78,   78,   21,
+
+       78,   78,   78,   78,   78,   78,   78,   28,   78,   78,
+       78,   78,   78,   78,   78,   78,   37,   78,   78,   78,
+       78,   78,   42,   78,   78,   78,   78,   46,  153,   47,
+      153,  153,  153,  153,   51,  153,  153,  153,  153,  153,
+       57,  153,  153,  153,  153,   61,  153,  153,  153,  153,
+      153,  153,   67,  153,  153,  153,  153,  153,   72,  153,
+      153,    2,   78,    5,   78,   78,   78,   78,   78,   78,
+       14,   78,   78,   78,   78,   23,   78,   78,   78,   78,
+       78,   29,   78,   78,   78,   78,   78,   78,   78,   78,
+       78,   40,   78,   78,   78,   44,   78,   45,   78,   48,
+
+      153,  153,  153,  153,   53,  153,  153,  153,  153,  153,
+      153,   62,  153,  153,  153,  153,  153,  153,  153,   70,
+      153,  153,  153,   78,   78,   78,   10,   78,   13,   78,
+       18,   78,   19,   78,   78,   78,   78,   78,   27,   78,
+       30,   78,   31,   78,   32,   78,   33,   78,   35,   78,
+       36,   78,   78,   78,   78,   78,  153,   50,  153,   52,
+      153,   54,  153,   55,  153,  153,  153,  153,   63,  153,
+       64,  153,   65,  153,   66,  153,  153,  153,  153,  153,
+       78,    7,   78,    8,   78,   78,   78,   78,   78,   78,
+       78,   39,   78,   78,   78,   49,  153,  153,  153,  153,
+
+      153,   69,  153,  153,  153,    6,   78,   22,   78,   24,
+       78,   25,   78,   26,   78,   34,   78,   78,   41,   78,
+       43,   78,   58,  153,   59,  153,   60,  153,  153,   71,
+      153,   73,  153,   78,  153,   38,   78,   68,  153
+    } ;
+
+static yyconst flex_int16_t yy_accept[511] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    2,    3,    5,    8,   10,   13,   16,
+       18,   21,   24,   27,   30,   33,   36,   39,   42,   45,
+       48,   51,   55,   59,   62,   65,   68,   71,   74,   77,
+       80,   83,   86,   88,   91,   94,   97,  100,  103,  106,
+      109,  112,  115,  118,  121,  124,  127,  130,  133,  136,
+      139,  142,  145,  148,  151,  154,  157,  160,  163,  166,
+      168,  170,  172,  174,  177,  179,  182,  185,  188,  191,
+      194,  197,  200,  203,  206,  209,  212,  215,  218,  221,
+      224,  227,  230,  233,  236,  239,  242,  245,  248,  250,
+
+      253,  257,  261,  263,  265,  267,  270,  271,  272,  273,
+      274,  274,  274,  275,  276,  277,  278,  279,  280,  281,
+      282,  282,  283,  284,  285,  286,  287,  288,  288,  289,
+      290,  291,  292,  294,  294,  295,  297,  298,  298,  299,
+      300,  301,  302,  303,  304,  305,  306,  307,  308,  309,
+      310,  311,  312,  313,  314,  316,  317,  318,  319,  320,
+      321,  322,  324,  325,  326,  327,  328,  329,  330,  331,
+      332,  333,  334,  335,  336,  337,  338,  339,  340,  341,
+      342,  343,  344,  344,  345,  346,  347,  348,  349,  350,
+      351,  352,  353,  353,  354,  355,  356,  357,  358,  359,
+
+      360,  361,  362,  363,  364,  365,  366,  367,  368,  369,
+      370,  371,  372,  373,  374,  374,  375,  376,  377,  378,
+      379,  380,  380,  382,  384,  386,  387,  387,  388,  389,
+      390,  391,  392,  393,  393,  394,  395,  396,  397,  398,
+      399,  400,  401,  402,  403,  404,  405,  406,  407,  408,
+      409,  410,  411,  412,  414,  415,  416,  417,  419,  420,
+      421,  422,  423,  424,  425,  426,  427,  428,  429,  430,
+      431,  432,  433,  434,  435,  436,  437,  438,  439,  440,
+      441,  442,  443,  444,  445,  446,  447,  448,  449,  450,
+      451,  452,  453,  454,  456,  457,  458,  459,  460,  461,
+
+      462,  463,  464,  465,  466,  467,  468,  469,  470,  471,
+      472,  473,  475,  477,  478,  480,  481,  483,  485,  486,
+      487,  488,  489,  490,  492,  494,  495,  496,  498,  499,
+      500,  502,  503,  504,  505,  506,  507,  508,  510,  511,
+      512,  513,  514,  515,  516,  517,  519,  520,  521,  522,
+      523,  525,  526,  527,  528,  530,  532,  533,  534,  535,
+      537,  538,  539,  540,  541,  543,  544,  545,  546,  548,
+      549,  550,  551,  552,  553,  555,  556,  557,  558,  559,
+      561,  562,  564,  566,  567,  568,  569,  570,  571,  573,
+      574,  575,  576,  578,  579,  580,  581,  582,  584,  585,
+
+      586,  587,  588,  589,  590,  591,  592,  594,  595,  596,
+      598,  600,  602,  603,  604,  605,  607,  608,  609,  610,
+      611,  612,  614,  615,  616,  617,  618,  619,  620,  622,
+      623,  624,  625,  626,  627,  629,  631,  633,  635,  636,
+      637,  638,  639,  641,  643,  645,  647,  649,  651,  653,
+      654,  655,  656,  657,  658,  660,  662,  664,  666,  667,
+      668,  669,  671,  673,  675,  677,  678,  679,  680,  681,
+      682,  684,  686,  687,  688,  689,  690,  691,  692,  694,
+      695,  696,  698,  699,  700,  701,  702,  704,  705,  706,
+      708,  710,  712,  714,  716,  718,  719,  721,  723,  725,
+
+      727,  729,  730,  732,  734,  735,  736,  738,  740,  740
+    } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        2,    2,    4,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    5,    6,    7,    8,    9,   10,   11,   12,
+       13,   14,   15,   16,   17,   18,   19,   20,   21,   21,
+       21,   21,   21,   21,   21,   21,   21,   22,   23,   24,
+       25,   26,   27,   28,   29,   29,   29,   29,   30,   31,
+       32,   32,   32,   32,   32,   33,   32,   32,   32,   32,
+       32,   32,   32,   32,   34,   32,   32,   35,   32,   32,
+       36,   37,   38,   39,   32,   40,   41,   42,   43,   44,
+
+       45,   46,   47,   48,   49,   32,   50,   51,   52,   53,
+       54,   55,   32,   56,   57,   58,   59,   60,   61,   62,
+       63,   64,   65,   66,   67,   68,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int32_t yy_meta[69] =
+    {   0,
+        1,    2,    3,    1,    4,    2,    1,    5,    1,    1,
+        1,    1,    1,    4,    1,    1,    4,    4,    1,    6,
+        6,    4,    1,    1,    1,    1,    4,    1,    7,    7,
+        7,    8,    8,    8,    8,    4,    4,    4,    1,    9,
+        7,    7,    7,    7,    7,    7,    8,    8,    8,    8,
+        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
+        8,    8,    8,    8,    1,    1,    1,    1
+    } ;
+
+static yyconst flex_int16_t yy_base[530] =
+    {   0,
+        0,    0,    0,   67,   56,   57,   76,  143,  145,  150,
+      811,  152,  813,  815,  815,  815,  815,  787,  143,  152,
+      786,  151,  164,  815,  815,  785,  143,  815,  152,  161,
+      149,  184,  122,  815,  815,   48,  784,  160,  815,    0,
+        0,  815,  805,  815,  158,  748,  750,  146,  144,  137,
+      141,  751,  157,  750,  757,  746,  756,  163,  175,  747,
+      745,  750,  746,  815,  166,  815,  815,  218,  791,  815,
+      776,  780,  815,  815,  815,    0,  815,  779,  206,  216,
+      733,  159,  737,  180,  739,  192,  735,  732,  742,  203,
+      199,  733,  731,  815,  251,  779,    0,  781,  815,  253,
+
+      243,  249,  815,  815,  264,  815,  815,  278,  815,  815,
+      779,  252,  259,    0,  815,  815,  815,  282,  815,  815,
+      778,  815,  815,  815,  815,  815,  815,  762,  266,  815,
+      815,  283,  239,  303,  815,  183,  255,    0,  754,  815,
+      815,  815,  753,    0,    0,  815,  815,  815,  719,  731,
+      718,  733,  169,  727,  713,  714,  711,  711,  714,  711,
+      708,    0,  710,  240,  711,  717,  708,  274,  710,  706,
+      245,  254,  710,  709,  716,  701,  273,  113,  706,  713,
+      815,  815,  331,  748,    0,  815,  815,    0,  815,  306,
+      256,  292,    0,  694,  710,  201,  691,  690,  690,  693,
+
+      691,  284,  692,  690,  149,  692,  688,  694,  295,  691,
+      698,  683,  288,  295,  345,  732,    0,    0,  734,  347,
+      815,  732,  328,  308,  321,  368,  353,  815,  343,    0,
+        0,  815,  350,  346,  371,  815,  323,  335,  815,  815,
+        0,  680,  692,  687,  675,  318,  677,  688,  686,  682,
+      674,  680,  683,    0,  669,  668,  672,    0,  673,  662,
+      340,  669,  659,  657,  669,  658,  660,  667,  653,  344,
+      652,  652,  655,  662,  652,  656,  660,  662,  651,  643,
+        0,  815,  372,  646,  643,  641,  644,  654,  643,  649,
+      652,  638,  642,    0,  643,  629,  639,  629,  640,  629,
+
+      631,  625,  359,  625,  628,  635,  625,  629,  633,  635,
+        0,    0,  412,    0,    0,  625,    0,    0,  616,  624,
+      614,  612,  619,    0,    0,  613,  610,    0,  611,  613,
+        0,  620,  619,  614,  605,  605,  604,    0,  601,  613,
+      603,  607,  602,  611,  610,    0,  595,  607,  597,  602,
+        0,  590,  602,  601,    0,    0,  587,  586,  592,    0,
+      586,  583,  584,  586,    0,  589,  580,  580,    0,  577,
+      589,  584,  579,  588,    0,  573,  585,  575,  580,    0,
+      568,    0,    0,  572,  579,  572,  577,  568,    0,  562,
+      574,  560,    0,  573,  558,  566,  561,    0,  569,  566,
+
+      568,  563,  551,  560,  556,  561,    0,  552,  555,    0,
+        0,    0,  558,  557,  548,    0,  542,  554,  554,  529,
+      527,    0,  501,  501,  423,  411,  417,  422,    0,  413,
+      416,  405,  406,  403,    0,    0,    0,    0,  406,  414,
+      407,  408,    0,    0,    0,    0,  396,    0,    0,  408,
+      402,  402,  393,  384,    0,    0,    0,    0,  394,  393,
+      394,    0,    0,    0,    0,  395,  389,  389,  379,  384,
+        0,    0,  382,  371,  370,  367,  378,  363,    0,  376,
+      374,    0,  360,  359,  349,  332,    0,  341,  333,    0,
+        0,    0,    0,    0,    0,  323,    0,    0,    0,    0,
+
+        0,  319,    0,    0,  302,  137,    0,    0,  815,  471,
+      480,  489,  498,  507,  512,  521,  524,  527,  533,  542,
+      551,  555,  559,  563,  565,  573,  577,  584,  588
+    } ;
+
+static yyconst flex_int16_t yy_def[530] =
+    {   0,
+      510,  510,  509,    3,  511,  511,  509,    7,  512,  512,
+      513,  513,  509,  509,  509,  509,  509,  509,  514,  515,
+      509,  509,  516,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,   32,  509,  509,  509,  509,  509,  509,  517,
+      518,  509,  509,  509,  509,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  519,  509,  509,  509,  509,
+      519,  519,  519,  519,  519,  519,  519,  519,  519,  519,
+      519,  519,  519,  509,  509,  509,  520,  509,  509,  521,
+
+      520,  520,  509,  509,  509,  509,  509,  514,  509,  509,
+      514,  522,  509,  523,  509,  509,  509,  516,  509,  509,
+      516,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,   32,  509,  509,  509,  509,  524,  509,  509,
+      509,  509,  509,  525,  518,  509,  509,  509,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      509,  509,  509,  509,  526,  509,  509,  519,  509,  509,
+      509,  509,  527,  519,  519,  519,  519,  519,  519,  519,
+
+      519,  519,  519,  519,  519,  519,  519,  519,  519,  519,
+      519,  519,  519,  519,  509,  509,  528,  520,  509,  521,
+      509,  521,  520,  520,  520,  520,  509,  509,  509,  529,
+      523,  509,  509,  509,  509,  509,  509,  524,  509,  509,
+      525,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      526,  509,  527,  519,  519,  519,  519,  519,  519,  519,
+      519,  519,  519,  519,  519,  519,  519,  519,  519,  519,
+
+      519,  519,  519,  519,  519,  519,  519,  519,  519,  519,
+      528,  520,  520,  529,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  519,  519,  519,  519,  519,  519,
+      519,  519,  519,  519,  519,  519,  519,  519,  519,  519,
+      519,  519,  519,  519,  519,  519,  519,  519,  519,  519,
+      519,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  519,  519,  519,  519,  519,  519,  519,  519,  519,
+      519,  519,  519,  519,  519,  519,  519,  519,  519,  519,
+      519,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  518,  518,  519,  519,  519,  519,  519,  519,  519,
+      519,  519,  519,  519,  519,  519,  519,  519,  519,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  518,  518,
+      518,  519,  519,  519,  519,  519,  519,  519,  519,  518,
+      518,  518,  518,  518,  518,  518,  518,  518,  519,  519,
+
+      519,  519,  519,  519,  518,  519,  518,  519,    0,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509
+    } ;
+
+static yyconst flex_int16_t yy_nxt[884] =
+    {   0,
+       15,   16,   17,   16,   18,   19,   15,   20,   21,   22,
+       23,   24,   25,   26,   27,   28,   29,   30,   31,   32,
+       33,   34,   35,   36,   37,   38,   39,   40,   41,   41,
+       41,   41,   41,   41,   41,   42,   43,   44,   45,   41,
+       46,   47,   48,   49,   50,   51,   52,   41,   53,   41,
+       54,   41,   41,   55,   56,   57,   58,   59,   60,   61,
+       62,   63,   41,   41,   64,   65,   66,   67,   68,   71,
+       71,  139,  140,   69,   72,   72,   73,   74,   75,   74,
+       76,   73,   73,   76,   73,   73,   73,   73,   73,   76,
+       73,   77,   76,   76,   78,   79,   80,   76,   73,   73,
+
+       73,   73,   76,   73,   76,   76,   76,   76,   76,   76,
+       76,   76,   76,   76,   73,   73,   81,   76,   82,   83,
+       84,   85,   76,   76,   86,   76,   87,   76,   76,   76,
+       88,   89,   90,   91,   92,   93,   76,   76,   76,   76,
+       94,   73,   73,   73,   95,  109,   98,   99,  110,   96,
+      100,   98,   99,  105,  104,  100,  509,  123,  106,  112,
+      116,  277,  130,  278,  101,  102,  119,  124,  125,  101,
+      102,  113,  113,  131,  120,  117,  126,  127,  128,  111,
+      129,  129,  147,  509,  142,  143,  151,  156,  154,  157,
+      181,  159,  508,  152,  160,  297,  148,  155,  158,  153,
+
+      121,  132,  162,  133,  133,  298,  195,  169,  163,  164,
+      170,  171,  196,  134,  135,  236,  136,  137,  138,  183,
+      172,  246,  174,  173,  184,  190,  190,  247,  134,  135,
+      175,  182,  198,  236,  136,  190,  190,  176,  191,  192,
+      193,  199,  137,  201,  202,  138,  210,  206,  191,  192,
+      207,  208,  215,  286,  211,  109,  191,  216,  221,  287,
+      209,  212,  223,  223,  192,  227,  191,  193,  223,  223,
+      228,  229,  229,  509,  192,  224,  225,  226,  113,  113,
+      109,  224,  225,  110,  119,  129,  129,  237,  282,  222,
+      257,  267,  120,  224,  269,  134,  135,  258,  135,  224,
+
+      509,  225,  233,  233,  226,  237,  282,  225,  268,  270,
+      134,  135,  134,  135,  111,  135,  135,  234,  121,  234,
+      262,  275,  235,  235,  191,  190,  190,  134,  135,  276,
+      263,  264,  183,  135,  293,  302,  307,  184,  191,  192,
+      312,  294,  191,  309,  308,  310,  215,  223,  223,  109,
+      303,  216,  221,  224,  227,  236,  191,  507,  312,  228,
+      224,  225,  229,  229,  192,  235,  235,  237,  137,  233,
+      233,  224,  506,  236,  319,  320,  505,  504,  224,  134,
+      135,  333,  135,  222,  503,  237,  225,  313,  313,  502,
+      235,  235,  343,  137,  134,  135,  313,  313,  313,  334,
+
+      135,  135,  344,  135,  191,  192,  501,  373,  313,  313,
+      313,  313,  313,  313,  500,  499,  135,  374,  498,  497,
+      496,  135,  191,  495,  494,  493,  492,  491,  490,  489,
+      192,  313,  313,  488,  487,  486,  485,  484,  483,  482,
+      313,  313,  313,  481,  224,  225,  480,  479,  478,  477,
+      476,  475,  313,  313,  313,  313,  313,  313,  474,  473,
+      472,  471,  224,  470,  469,  468,  467,  466,  465,  464,
+      225,   14,   14,   14,   14,   14,   14,   14,   14,   14,
+       70,   70,   70,   70,   70,   70,   70,   70,   70,   97,
+       97,   97,   97,   97,   97,   97,   97,   97,  103,  103,
+
+      103,  103,  103,  103,  103,  103,  103,  108,  108,  108,
+      108,  108,  108,  108,  108,  108,  114,  114,  114,  114,
+      114,  118,  118,  118,  118,  118,  118,  118,  118,  118,
+      144,  144,  145,  145,  145,  145,  188,  188,  188,  188,
+      188,  188,  218,  463,  462,  218,  218,  218,  218,  218,
+      218,  220,  220,  220,  220,  220,  220,  220,  220,  220,
+      230,  230,  230,  230,  231,  231,  231,  231,  238,  238,
+      241,  241,  241,  281,  281,  461,  281,  281,  281,  281,
+      281,  281,  283,  283,  311,  311,  460,  311,  311,  311,
+      311,  311,  311,  314,  314,  314,  314,  459,  458,  457,
+
+      456,  455,  454,  453,  452,  451,  450,  449,  448,  447,
+      446,  445,  444,  443,  442,  441,  440,  439,  438,  437,
+      436,  435,  434,  433,  432,  431,  430,  429,  428,  427,
+      426,  425,  424,  423,  422,  421,  420,  419,  418,  417,
+      416,  415,  414,  413,  412,  411,  410,  409,  408,  407,
+      406,  405,  404,  403,  402,  401,  400,  399,  398,  397,
+      396,  395,  394,  393,  392,  391,  390,  389,  388,  387,
+      386,  385,  384,  383,  382,  381,  380,  379,  378,  377,
+      376,  375,  372,  371,  370,  369,  368,  367,  366,  365,
+      364,  363,  362,  361,  360,  359,  358,  357,  356,  355,
+
+      354,  353,  352,  351,  350,  349,  348,  347,  346,  345,
+      342,  341,  340,  339,  338,  337,  336,  335,  332,  331,
+      330,  329,  328,  327,  326,  325,  324,  323,  322,  321,
+      318,  317,  316,  315,  509,  219,  217,  306,  305,  304,
+      301,  300,  299,  296,  295,  292,  291,  290,  289,  288,
+      285,  284,  185,  280,  279,  274,  273,  272,  271,  266,
+      265,  261,  260,  259,  256,  255,  254,  253,  252,  251,
+      250,  249,  248,  245,  244,  243,  242,  240,  239,  232,
+      509,  509,  219,  217,  214,  213,  205,  204,  203,  200,
+      197,  194,  189,  187,  186,  185,  180,  179,  178,  177,
+
+      168,  167,  166,  165,  161,  150,  149,  146,  141,  122,
+      115,  107,  509,  104,   13,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509
+    } ;
+
+static yyconst flex_int16_t yy_chk[884] =
+    {   0,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    4,    5,
+        6,   36,   36,    4,    5,    6,    7,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
+        7,    7,    7,    7,    8,   19,    9,    9,   19,    8,
+        9,   10,   10,   12,   12,   10,   33,   27,   12,   20,
+       22,  178,   31,  178,    9,    9,   23,   27,   29,   10,
+       10,   20,   20,   31,   23,   22,   29,   29,   30,   19,
+       30,   30,   45,   33,   38,   38,   48,   50,   49,   50,
+       65,   51,  506,   48,   51,  205,   45,   49,   50,   48,
+
+       23,   32,   53,   32,   32,  205,   82,   58,   53,   53,
+       58,   58,   82,   32,   32,  136,   32,   32,   32,   68,
+       58,  153,   59,   58,   68,   79,   79,  153,   32,   32,
+       59,   65,   84,  136,   32,   80,   80,   59,   79,   79,
+       79,   84,   32,   86,   86,   32,   91,   90,   80,   80,
+       90,   90,   95,  196,   91,  100,   79,   95,  100,  196,
+       90,   91,  101,  101,   79,  105,   80,   79,  102,  102,
+      105,  112,  112,  133,   80,  101,  101,  101,  113,  113,
+      108,  102,  102,  108,  118,  129,  129,  137,  191,  100,
+      164,  171,  118,  101,  172,  129,  129,  164,  129,  102,
+
+      133,  101,  132,  132,  101,  137,  191,  102,  171,  172,
+      129,  129,  132,  132,  108,  132,  129,  134,  118,  134,
+      168,  177,  134,  134,  192,  190,  190,  132,  132,  177,
+      168,  168,  183,  132,  202,  209,  213,  183,  190,  190,
+      224,  202,  192,  214,  213,  214,  215,  223,  223,  220,
+      209,  215,  220,  225,  227,  237,  190,  505,  224,  227,
+      223,  223,  229,  229,  190,  234,  234,  238,  238,  233,
+      233,  225,  502,  237,  246,  246,  496,  489,  223,  233,
+      233,  261,  233,  220,  488,  238,  223,  226,  226,  486,
+      235,  235,  270,  238,  233,  233,  226,  226,  226,  261,
+
+      233,  235,  270,  235,  283,  283,  485,  303,  226,  226,
+      226,  226,  226,  226,  484,  483,  235,  303,  481,  480,
+      478,  235,  283,  477,  476,  475,  474,  473,  470,  469,
+      283,  313,  313,  468,  467,  466,  461,  460,  459,  454,
+      313,  313,  313,  453,  313,  313,  452,  451,  450,  447,
+      442,  441,  313,  313,  313,  313,  313,  313,  440,  439,
+      434,  433,  313,  432,  431,  430,  428,  427,  426,  425,
+      313,  510,  510,  510,  510,  510,  510,  510,  510,  510,
+      511,  511,  511,  511,  511,  511,  511,  511,  511,  512,
+      512,  512,  512,  512,  512,  512,  512,  512,  513,  513,
+
+      513,  513,  513,  513,  513,  513,  513,  514,  514,  514,
+      514,  514,  514,  514,  514,  514,  515,  515,  515,  515,
+      515,  516,  516,  516,  516,  516,  516,  516,  516,  516,
+      517,  517,  518,  518,  518,  518,  519,  519,  519,  519,
+      519,  519,  520,  424,  423,  520,  520,  520,  520,  520,
+      520,  521,  521,  521,  521,  521,  521,  521,  521,  521,
+      522,  522,  522,  522,  523,  523,  523,  523,  524,  524,
+      525,  525,  525,  526,  526,  421,  526,  526,  526,  526,
+      526,  526,  527,  527,  528,  528,  420,  528,  528,  528,
+      528,  528,  528,  529,  529,  529,  529,  419,  418,  417,
+
+      415,  414,  413,  409,  408,  406,  405,  404,  403,  402,
+      401,  400,  399,  397,  396,  395,  394,  392,  391,  390,
+      388,  387,  386,  385,  384,  381,  379,  378,  377,  376,
+      374,  373,  372,  371,  370,  368,  367,  366,  364,  363,
+      362,  361,  359,  358,  357,  354,  353,  352,  350,  349,
+      348,  347,  345,  344,  343,  342,  341,  340,  339,  337,
+      336,  335,  334,  333,  332,  330,  329,  327,  326,  323,
+      322,  321,  320,  319,  316,  310,  309,  308,  307,  306,
+      305,  304,  302,  301,  300,  299,  298,  297,  296,  295,
+      293,  292,  291,  290,  289,  288,  287,  286,  285,  284,
+
+      280,  279,  278,  277,  276,  275,  274,  273,  272,  271,
+      269,  268,  267,  266,  265,  264,  263,  262,  260,  259,
+      257,  256,  255,  253,  252,  251,  250,  249,  248,  247,
+      245,  244,  243,  242,  222,  219,  216,  212,  211,  210,
+      208,  207,  206,  204,  203,  201,  200,  199,  198,  197,
+      195,  194,  184,  180,  179,  176,  175,  174,  173,  170,
+      169,  167,  166,  165,  163,  161,  160,  159,  158,  157,
+      156,  155,  154,  152,  151,  150,  149,  143,  139,  128,
+      121,  111,   98,   96,   93,   92,   89,   88,   87,   85,
+       83,   81,   78,   72,   71,   69,   63,   62,   61,   60,
+
+       57,   56,   55,   54,   52,   47,   46,   43,   37,   26,
+       21,   18,   13,   11,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509,  509,  509,  509,  509,  509,  509,  509,
+      509,  509,  509
+    } ;
+
+/* Table of booleans, true if rule could match eol. */
+static yyconst flex_int32_t yy_rule_can_match_eol[163] =
+    {   0,
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+    0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 
+    0, 0, 0,     };
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
+static char *yy_full_match;
+static int yy_lp;
+static int yy_looking_for_trail_begin = 0;
+static int yy_full_lp;
+static int *yy_full_state;
+#define YY_TRAILING_MASK 0x2000
+#define YY_TRAILING_HEAD_MASK 0x4000
+#define REJECT \
+{ \
+*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
+yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
+(yy_lp) = (yy_full_lp); /* restore orig. accepting pos. */ \
+(yy_state_ptr) = (yy_full_state); /* restore orig. state */ \
+yy_current_state = *(yy_state_ptr); /* restore curr. state */ \
+++(yy_lp); \
+goto find_rule; \
+}
+
+static int yy_more_offset = 0;
+static int yy_prev_more_offset = 0;
+#define yymore() ((yy_more_offset) = yy_flex_strlen( yytext ))
+#define YY_NEED_STRLEN
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET \
+	{ \
+	(yy_more_offset) = (yy_prev_more_offset); \
+	yyleng -= (yy_more_offset); \
+	}
+#ifndef YYLMAX
+#define YYLMAX 8192
+#endif
+
+char yytext[YYLMAX];
+char *yytext_ptr;
+#line 1 "dt_lex.l"
+#line 2 "dt_lex.l"
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#else  /* VBOX */
+# ifdef RT_OS_WINDOWS /* No unistd.h on windows, avoid redef warnings of the [U]INTxx_MAX defines caused by no inttypes.h/stdint.h. */
+#  define YY_NO_UNISTD_H
+#  undef INT8_MAX
+#  undef INT16_MAX
+#  undef INT32_MAX
+#  undef INT64_MAX
+#  undef UINT8_MAX
+#  undef UINT16_MAX
+#  undef UINT32_MAX
+#  undef UINT64_MAX
+# endif
+# include <iprt/ctype.h>
+# define isdigit(a_ch) RT_C_IS_DIGIT(a_ch)
+#endif /* VBOX */
+
+#include <dt_impl.h>
+#include <dt_grammar.h>
+#include <dt_parser.h>
+#include <dt_string.h>
+
+#ifndef USING_FLEX
+/*
+ * We need to undefine lex's input and unput macros so that references to these
+ * call the functions provided at the end of this source file.
+ */
+#undef input
+#undef unput
+#else  /* USING_FLEX */
+# define YY_INPUT(buf, result, max_size) \
+	do { \
+		if (yypcb->pcb_fileptr != NULL) { \
+			result = (int)fread(buf, 1, max_size, yypcb->pcb_fileptr); \
+			if (!result && ferror(yypcb->pcb_fileptr)) \
+		      longjmp(yypcb->pcb_jmpbuf, EDT_FIO); \
+				/*YY_FATAL_ERROR("input in flex scanner failed");*/ \
+		} else { \
+			size_t off = yypcb->pcb_strptr - yypcb->pcb_string; \
+			if (off < yypcb->pcb_strlen) { \
+            off = yypcb->pcb_strlen - off; \
+				result = max_size; \
+				if ((size_t)result > off) \
+					result = (int)off; \
+				memcpy(buf, yypcb->pcb_strptr, result); \
+				yypcb->pcb_strptr += result; \
+            /*fprintf(stderr, "yy_input -> %d '%.*s'\n", result, result, buf);*/ \
+         } else { \
+            buf[0] = '\0'; \
+            result = 0; \
+            /*fprintf(stderr, "yy_input -> %d\n", result);*/ \
+         } \
+		} \
+	} while (0)
+#endif /* USING_FLEX */
+
+static int id_or_type(const char *);
+#ifndef USING_FLEX
+static int input(void);
+static void unput(int);
+#endif
+
+/*
+ * We first define a set of labeled states for use in the D lexer and then a
+ * set of regular expressions to simplify things below. The lexer states are:
+ *
+ * S0 - D program clause and expression lexing
+ * S1 - D comments (i.e. skip everything until end of comment)
+ * S2 - D program outer scope (probe specifiers and declarations)
+ * S3 - D control line parsing (i.e. after ^# is seen but before \n)
+ * S4 - D control line scan (locate control directives only and invoke S3)
+ */
+
+#line 1063 "dt_lex.c"
+
+#define INITIAL 0
+#define S0 1
+#define S1 2
+#define S2 3
+#define S3 4
+#define S4 5
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+   These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag  );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined  );
+
+FILE *yyget_in (void );
+
+void yyset_in  (FILE * in_str  );
+
+FILE *yyget_out (void );
+
+void yyset_out  (FILE * out_str  );
+
+yy_size_t yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number  );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+    static void yyunput (int c,char *buf_ptr  );
+    
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+		{ \
+		int c = '*'; \
+		yy_size_t n; \
+		for ( n = 0; n < max_size && \
+			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+			buf[n] = (char) c; \
+		if ( c == '\n' ) \
+			buf[n++] = (char) c; \
+		if ( c == EOF && ferror( yyin ) ) \
+			YY_FATAL_ERROR( "input in flex scanner failed" ); \
+		result = n; \
+		} \
+	else \
+		{ \
+		errno=0; \
+		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+			{ \
+			if( errno != EINTR) \
+				{ \
+				YY_FATAL_ERROR( "input in flex scanner failed" ); \
+				break; \
+				} \
+			errno=0; \
+			clearerr(yyin); \
+			} \
+		}\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+	if ( yyleng > 0 ) \
+		YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
+				(yytext[yyleng - 1] == '\n'); \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp, *yy_bp;
+	register int yy_act;
+    
+#line 124 "dt_lex.l"
+
+
+
+
+/*
+ * We insert a special prologue into yylex() itself: if the pcb contains a
+ * context token, we return that prior to running the normal lexer.  This
+ * allows libdtrace to force yacc into one of our three parsing contexts: D
+ * expression (DT_CTX_DEXPR), D program (DT_CTX_DPROG) or D type (DT_CTX_DTYPE).
+ * Once the token is returned, we clear it so this only happens once.
+ */
+if (yypcb->pcb_token != 0) {
+	int tok = yypcb->pcb_token;
+	yypcb->pcb_token = 0;
+	return (tok);
+}
+
+
+
+#line 1273 "dt_lex.c"
+
+	if ( !(yy_init) )
+		{
+		(yy_init) = 1;
+
+#ifdef YY_USER_INIT
+		YY_USER_INIT;
+#endif
+
+        /* Create the reject buffer large enough to save one state per allowed character. */
+        if ( ! (yy_state_buf) )
+            (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE  );
+            if ( ! (yy_state_buf) )
+                YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
+
+		if ( ! (yy_start) )
+			(yy_start) = 1;	/* first start state */
+
+		if ( ! yyin )
+			yyin = stdin;
+
+		if ( ! yyout )
+			yyout = stdout;
+
+		if ( ! YY_CURRENT_BUFFER ) {
+			yyensure_buffer_stack ();
+			YY_CURRENT_BUFFER_LVALUE =
+				yy_create_buffer(yyin,YY_BUF_SIZE );
+		}
+
+		yy_load_buffer_state( );
+		}
+
+	while ( 1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = (yy_c_buf_p);
+
+		/* Support of yytext. */
+		*yy_cp = (yy_hold_char);
+
+		/* yy_bp points to the position in yy_ch_buf of the start of
+		 * the current run.
+		 */
+		yy_bp = yy_cp;
+
+		yy_current_state = (yy_start);
+		yy_current_state += YY_AT_BOL();
+
+		(yy_state_ptr) = (yy_state_buf);
+		*(yy_state_ptr)++ = yy_current_state;
+
+yy_match:
+		do
+			{
+			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+				{
+				yy_current_state = (int) yy_def[yy_current_state];
+				if ( yy_current_state >= 510 )
+					yy_c = yy_meta[(unsigned int) yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+			*(yy_state_ptr)++ = yy_current_state;
+			++yy_cp;
+			}
+		while ( yy_current_state != 509 );
+
+yy_find_action:
+		yy_current_state = *--(yy_state_ptr);
+		(yy_lp) = yy_accept[yy_current_state];
+goto find_rule; /* Shut up GCC warning -Wall */
+find_rule: /* we branch to this label when backing up */
+		for ( ; ; ) /* until we find what rule we matched */
+			{
+			if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
+				{
+				yy_act = yy_acclist[(yy_lp)];
+				if ( yy_act & YY_TRAILING_HEAD_MASK ||
+				     (yy_looking_for_trail_begin) )
+					{
+					if ( yy_act == (yy_looking_for_trail_begin) )
+						{
+						(yy_looking_for_trail_begin) = 0;
+						yy_act &= ~YY_TRAILING_HEAD_MASK;
+						break;
+						}
+					}
+				else if ( yy_act & YY_TRAILING_MASK )
+					{
+					(yy_looking_for_trail_begin) = yy_act & ~YY_TRAILING_MASK;
+					(yy_looking_for_trail_begin) |= YY_TRAILING_HEAD_MASK;
+					(yy_full_match) = yy_cp;
+					(yy_full_state) = (yy_state_ptr);
+					(yy_full_lp) = (yy_lp);
+					}
+				else
+					{
+					(yy_full_match) = yy_cp;
+					(yy_full_state) = (yy_state_ptr);
+					(yy_full_lp) = (yy_lp);
+					break;
+					}
+				++(yy_lp);
+				goto find_rule;
+				}
+			--yy_cp;
+			yy_current_state = *--(yy_state_ptr);
+			(yy_lp) = yy_accept[yy_current_state];
+			}
+
+		YY_DO_BEFORE_ACTION;
+
+		if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+			{
+			yy_size_t yyl;
+			for ( yyl = (yy_prev_more_offset); yyl < yyleng; ++yyl )
+				if ( yytext[yyl] == '\n' )
+					   
+    yylineno++;
+;
+			}
+
+do_action:	/* This label is used only to access EOF actions. */
+
+		switch ( yy_act )
+	{ /* beginning of action switch */
+case 1:
+YY_RULE_SETUP
+#line 143 "dt_lex.l"
+return (DT_KEY_AUTO);
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 144 "dt_lex.l"
+return (DT_KEY_BREAK);
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 145 "dt_lex.l"
+return (DT_KEY_CASE);
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 146 "dt_lex.l"
+return (DT_KEY_CHAR);
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 147 "dt_lex.l"
+return (DT_KEY_CONST);
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 148 "dt_lex.l"
+return (DT_KEY_CONTINUE);
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 149 "dt_lex.l"
+return (DT_KEY_COUNTER);
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 150 "dt_lex.l"
+return (DT_KEY_DEFAULT);
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 151 "dt_lex.l"
+return (DT_KEY_DO);
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 152 "dt_lex.l"
+return (DT_KEY_DOUBLE);
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 153 "dt_lex.l"
+return (DT_KEY_ELSE);
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 154 "dt_lex.l"
+return (DT_KEY_ENUM);
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 155 "dt_lex.l"
+return (DT_KEY_EXTERN);
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 156 "dt_lex.l"
+return (DT_KEY_FLOAT);
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 157 "dt_lex.l"
+return (DT_KEY_FOR);
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 158 "dt_lex.l"
+return (DT_KEY_GOTO);
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 159 "dt_lex.l"
+return (DT_KEY_IF);
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 160 "dt_lex.l"
+return (DT_KEY_IMPORT);
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 161 "dt_lex.l"
+return (DT_KEY_INLINE);
+	YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 162 "dt_lex.l"
+return (DT_KEY_INT);
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 163 "dt_lex.l"
+return (DT_KEY_LONG);
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 164 "dt_lex.l"
+return (DT_TOK_OFFSETOF);
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 165 "dt_lex.l"
+return (DT_KEY_PROBE);
+	YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 166 "dt_lex.l"
+return (DT_KEY_PROVIDER);
+	YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 167 "dt_lex.l"
+return (DT_KEY_REGISTER);
+	YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 168 "dt_lex.l"
+return (DT_KEY_RESTRICT);
+	YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 169 "dt_lex.l"
+return (DT_KEY_RETURN);
+	YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 170 "dt_lex.l"
+return (DT_KEY_SELF);
+	YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 171 "dt_lex.l"
+return (DT_KEY_SHORT);
+	YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 172 "dt_lex.l"
+return (DT_KEY_SIGNED);
+	YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 173 "dt_lex.l"
+return (DT_TOK_SIZEOF);
+	YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 174 "dt_lex.l"
+return (DT_KEY_STATIC);
+	YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 175 "dt_lex.l"
+return (DT_KEY_STRING);
+	YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 176 "dt_lex.l"
+return (DT_TOK_STRINGOF);
+	YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 177 "dt_lex.l"
+return (DT_KEY_STRUCT);
+	YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 178 "dt_lex.l"
+return (DT_KEY_SWITCH);
+	YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 179 "dt_lex.l"
+return (DT_KEY_THIS);
+	YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 180 "dt_lex.l"
+return (DT_KEY_XLATOR);
+	YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 181 "dt_lex.l"
+return (DT_KEY_TYPEDEF);
+	YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 182 "dt_lex.l"
+return (DT_KEY_UNION);
+	YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 183 "dt_lex.l"
+return (DT_KEY_UNSIGNED);
+	YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 184 "dt_lex.l"
+return (DT_KEY_VOID);
+	YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 185 "dt_lex.l"
+return (DT_KEY_VOLATILE);
+	YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 186 "dt_lex.l"
+return (DT_KEY_WHILE);
+	YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 187 "dt_lex.l"
+return (DT_TOK_XLATE);
+	YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 189 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_AUTO); }
+	YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 190 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_CHAR); }
+	YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 191 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_CONST); }
+	YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 192 "dt_lex.l"
+{ yybegin(YYS_DEFINE);	return (DT_KEY_COUNTER); }
+	YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 193 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_DOUBLE); }
+	YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 194 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_ENUM); }
+	YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 195 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_EXTERN); }
+	YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 196 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_FLOAT); }
+	YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 197 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_IMPORT); }
+	YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 198 "dt_lex.l"
+{ yybegin(YYS_DEFINE);	return (DT_KEY_INLINE); }
+	YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 199 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_INT); }
+	YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 200 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_LONG); }
+	YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 201 "dt_lex.l"
+{ yybegin(YYS_DEFINE);	return (DT_KEY_PROVIDER); }
+	YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 202 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_REGISTER); }
+	YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 203 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_RESTRICT); }
+	YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 204 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_SELF); }
+	YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 205 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_SHORT); }
+	YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 206 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_SIGNED); }
+	YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 207 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_STATIC); }
+	YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 208 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_STRING); }
+	YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 209 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_STRUCT); }
+	YY_BREAK
+case 67:
+YY_RULE_SETUP
+#line 210 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_THIS); }
+	YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 211 "dt_lex.l"
+{ yybegin(YYS_DEFINE);	return (DT_KEY_XLATOR); }
+	YY_BREAK
+case 69:
+YY_RULE_SETUP
+#line 212 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_TYPEDEF); }
+	YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 213 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_UNION); }
+	YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 214 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_UNSIGNED); }
+	YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 215 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_VOID); }
+	YY_BREAK
+case 73:
+YY_RULE_SETUP
+#line 216 "dt_lex.l"
+{ yybegin(YYS_EXPR);	return (DT_KEY_VOLATILE); }
+	YY_BREAK
+case 74:
+YY_RULE_SETUP
+#line 218 "dt_lex.l"
+{
+			int i = atoi(yytext + 2);
+			char *v = "";
+
+			/*
+			 * A macro argument reference substitutes the text of
+			 * an argument in place of the current token.  When we
+			 * see $$<d> we fetch the saved string from pcb_sargv
+			 * (or use the default argument if the option has been
+			 * set and the argument hasn't been specified) and
+			 * return a token corresponding to this string.
+			 */
+			if (i < 0 || (i >= yypcb->pcb_sargc &&
+			    !(yypcb->pcb_cflags & DTRACE_C_DEFARG))) {
+				xyerror(D_MACRO_UNDEF, "macro argument %s is "
+				    "not defined\n", yytext);
+			}
+
+			if (i < yypcb->pcb_sargc) {
+				v = yypcb->pcb_sargv[i]; /* get val from pcb */
+				yypcb->pcb_sflagv[i] |= DT_IDFLG_REF;
+			}
+
+			if ((yylval.l_str = strdup(v)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			(void) stresc2chr(yylval.l_str);
+			return (DT_TOK_STRING);
+		}
+	YY_BREAK
+case 75:
+YY_RULE_SETUP
+#line 248 "dt_lex.l"
+{
+			int i = atoi(yytext + 1);
+			char *p, *v = "0";
+
+			/*
+			 * A macro argument reference substitutes the text of
+			 * one identifier or integer pattern for another.  When
+			 * we see $<d> we fetch the saved string from pcb_sargv
+			 * (or use the default argument if the option has been
+			 * set and the argument hasn't been specified) and
+			 * return a token corresponding to this string.
+			 */
+			if (i < 0 || (i >= yypcb->pcb_sargc &&
+			    !(yypcb->pcb_cflags & DTRACE_C_DEFARG))) {
+				xyerror(D_MACRO_UNDEF, "macro argument %s is "
+				    "not defined\n", yytext);
+			}
+
+			if (i < yypcb->pcb_sargc) {
+				v = yypcb->pcb_sargv[i]; /* get val from pcb */
+				yypcb->pcb_sflagv[i] |= DT_IDFLG_REF;
+			}
+
+			/*
+			 * If the macro text is not a valid integer or ident,
+			 * then we treat it as a string.  The string may be
+			 * optionally enclosed in quotes, which we strip.
+			 */
+			if (strbadidnum(v)) {
+				size_t len = strlen(v);
+
+				if (len != 1 && *v == '"' && v[len - 1] == '"')
+					yylval.l_str = strndup(v + 1, len - 2);
+				else
+					yylval.l_str = strndup(v, len);
+
+				if (yylval.l_str == NULL)
+					longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+				(void) stresc2chr(yylval.l_str);
+				return (DT_TOK_STRING);
+			}
+
+			/*
+			 * If the macro text is not a string an begins with a
+			 * digit or a +/- sign, process it as an integer token.
+			 */
+			if (isdigit(v[0]) || v[0] == '-' || v[0] == '+') {
+#ifdef VBOX
+				int rc;
+#endif
+				if (isdigit(v[0]))
+					yyintprefix = 0;
+				else
+					yyintprefix = *v++;
+
+#ifndef VBOX
+				errno = 0;
+				yylval.l_int = strtoull(v, &p, 0);
+#else
+				rc = RTStrToUInt64Ex(v, &p, 0, &yylval.l_int);
+#endif
+				(void) strncpy(yyintsuffix, p,
+				    sizeof (yyintsuffix));
+				yyintdecimal = *v != '0';
+
+#ifndef VBOX
+				if (errno == ERANGE)
+#else
+				if (rc == VWRN_NUMBER_TOO_BIG || rc == VWRN_NEGATIVE_UNSIGNED)
+#endif
+					xyerror(D_MACRO_OFLOW, "macro argument"
+					    " %s constant %s results in integer"
+					    " overflow\n", yytext, v);
+
+				return (DT_TOK_INT);
+			}
+
+			return (id_or_type(v));
+		}
+	YY_BREAK
+case 76:
+YY_RULE_SETUP
+#line 329 "dt_lex.l"
+{
+			dt_ident_t *idp = dt_idhash_lookup(
+			    yypcb->pcb_hdl->dt_macros, yytext + 2);
+
+			char s[16]; /* enough for UINT_MAX + \0 */
+
+			if (idp == NULL) {
+				xyerror(D_MACRO_UNDEF, "macro variable %s "
+				    "is not defined\n", yytext);
+			}
+
+			/*
+			 * For the moment, all current macro variables are of
+			 * type id_t (refer to dtrace_update() for details).
+			 */
+			(void) snprintf(s, sizeof (s), "%u", idp->di_id);
+			if ((yylval.l_str = strdup(s)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			return (DT_TOK_STRING);
+		}
+	YY_BREAK
+case 77:
+YY_RULE_SETUP
+#line 351 "dt_lex.l"
+{
+			dt_ident_t *idp = dt_idhash_lookup(
+			    yypcb->pcb_hdl->dt_macros, yytext + 1);
+
+			if (idp == NULL) {
+				xyerror(D_MACRO_UNDEF, "macro variable %s "
+				    "is not defined\n", yytext);
+			}
+
+			/*
+			 * For the moment, all current macro variables are of
+			 * type id_t (refer to dtrace_update() for details).
+			 */
+			yylval.l_int = (intmax_t)(int)idp->di_id;
+			yyintprefix = 0;
+			yyintsuffix[0] = '\0';
+			yyintdecimal = 1;
+
+			return (DT_TOK_INT);
+		}
+	YY_BREAK
+case 78:
+YY_RULE_SETUP
+#line 372 "dt_lex.l"
+{
+			return (id_or_type(yytext));
+		}
+	YY_BREAK
+case 79:
+YY_RULE_SETUP
+#line 376 "dt_lex.l"
+{
+			if ((yylval.l_str = strdup(yytext)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+			return (DT_TOK_AGG);
+		}
+	YY_BREAK
+case 80:
+YY_RULE_SETUP
+#line 382 "dt_lex.l"
+{
+			if ((yylval.l_str = strdup("@_")) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+			return (DT_TOK_AGG);
+		}
+	YY_BREAK
+case 81:
+#line 389 "dt_lex.l"
+case 82:
+#line 390 "dt_lex.l"
+case 83:
+YY_RULE_SETUP
+#line 390 "dt_lex.l"
+{
+			char *p;
+
+#ifndef VBOX
+			errno = 0;
+			yylval.l_int = strtoull(yytext, &p, 0);
+#else
+			int rc = RTStrToUInt64Ex(yytext, &p, 0, &yylval.l_int);
+#endif
+			yyintprefix = 0;
+			(void) strncpy(yyintsuffix, p, sizeof (yyintsuffix));
+			yyintdecimal = yytext[0] != '0';
+
+#ifndef VBOX
+			if (errno == ERANGE)
+#else
+			if (rc == VWRN_NUMBER_TOO_BIG || rc == VWRN_NEGATIVE_UNSIGNED)
+#endif
+				xyerror(D_INT_OFLOW, "constant %s results in "
+				    "integer overflow\n", yytext);
+
+			if (*p != '\0' && strchr("uUlL", *p) == NULL) {
+				xyerror(D_INT_DIGIT, "constant %s contains "
+				    "invalid digit %c\n", yytext, *p);
+			}
+
+			if ((YYSTATE) != S3)
+				return (DT_TOK_INT);
+
+			yypragma = dt_node_link(yypragma,
+			    dt_node_int(yylval.l_int));
+		}
+	YY_BREAK
+case 84:
+YY_RULE_SETUP
+#line 423 "dt_lex.l"
+yyerror("floating-point constants are not permitted\n");
+	YY_BREAK
+/* VBOX changed:
+<S0>\"{RGX_STR}$ |
+<S3>\"{RGX_STR}$ xyerror(D_STR_NL, "newline encountered in string literal");
+ input: */
+case 85:
+YY_RULE_SETUP
+#line 429 "dt_lex.l"
+xyerror(D_STR_NL, "newline encountered in string literal");
+	YY_BREAK
+case 86:
+#line 432 "dt_lex.l"
+case 87:
+YY_RULE_SETUP
+#line 432 "dt_lex.l"
+{
+			/*
+			 * Quoted string -- convert C escape sequences and
+			 * return the string as a token.
+			 */
+			yylval.l_str = strndup(yytext + 1, yyleng - 2);
+
+			if (yylval.l_str == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			(void) stresc2chr(yylval.l_str);
+			if ((YYSTATE) != S3)
+				return (DT_TOK_STRING);
+
+			yypragma = dt_node_link(yypragma,
+			    dt_node_string(yylval.l_str));
+		}
+	YY_BREAK
+case 88:
+YY_RULE_SETUP
+#line 450 "dt_lex.l"
+xyerror(D_CHR_NL, "newline encountered in character constant");
+	YY_BREAK
+case 89:
+YY_RULE_SETUP
+#line 452 "dt_lex.l"
+{
+			char *s, *p, *q;
+			size_t nbytes;
+
+			/*
+			 * Character constant -- convert C escape sequences and
+			 * return the character as an integer immediate value.
+			 */
+			if (yyleng == 2)
+				xyerror(D_CHR_NULL, "empty character constant");
+
+			s = yytext + 1;
+			yytext[yyleng - 1] = '\0';
+			nbytes = stresc2chr(s);
+			yylval.l_int = 0;
+			yyintprefix = 0;
+			yyintsuffix[0] = '\0';
+			yyintdecimal = 1;
+
+			if (nbytes > sizeof (yylval.l_int)) {
+				xyerror(D_CHR_OFLOW, "character constant is "
+				    "too long");
+			}
+#ifdef _LITTLE_ENDIAN
+			p = ((char *)&yylval.l_int) + nbytes - 1;
+			for (q = s; nbytes != 0; nbytes--)
+				*p-- = *q++;
+#else
+			bcopy(s, ((char *)&yylval.l_int) +
+			    sizeof (yylval.l_int) - nbytes, nbytes);
+#endif
+			return (DT_TOK_INT);
+		}
+	YY_BREAK
+case 90:
+#line 487 "dt_lex.l"
+case 91:
+YY_RULE_SETUP
+#line 487 "dt_lex.l"
+{
+			yypcb->pcb_cstate = (YYSTATE);
+			BEGIN(S1);
+		}
+	YY_BREAK
+case 92:
+#line 493 "dt_lex.l"
+case 93:
+YY_RULE_SETUP
+#line 493 "dt_lex.l"
+;	/* discard any #! lines */
+	YY_BREAK
+case 94:
+#line 496 "dt_lex.l"
+case 95:
+#line 497 "dt_lex.l"
+case 96:
+YY_RULE_SETUP
+#line 497 "dt_lex.l"
+{
+			assert(yypragma == NULL);
+			yypcb->pcb_cstate = (YYSTATE);
+			BEGIN(S3);
+		}
+	YY_BREAK
+case 97:
+YY_RULE_SETUP
+#line 503 "dt_lex.l"
+;	/* discard */
+	YY_BREAK
+case 98:
+/* rule 98 can match eol */
+YY_RULE_SETUP
+#line 504 "dt_lex.l"
+;	/* discard */
+	YY_BREAK
+case 99:
+YY_RULE_SETUP
+#line 506 "dt_lex.l"
+{
+			int c, tok;
+
+			/*
+			 * The use of "/" as the predicate delimiter and as the
+			 * integer division symbol requires special lookahead
+			 * to avoid a shift/reduce conflict in the D grammar.
+			 * We look ahead to the next non-whitespace character.
+			 * If we encounter EOF, ";", "{", or "/", then this "/"
+			 * closes the predicate and we return DT_TOK_EPRED.
+			 * If we encounter anything else, it's DT_TOK_DIV.
+			 */
+			while ((c = input()) != 0) {
+				if (strchr("\f\n\r\t\v ", c) == NULL)
+					break;
+			}
+
+			if (c == 0 || c == ';' || c == '{' || c == '/') {
+				if (yypcb->pcb_parens != 0) {
+					yyerror("closing ) expected in "
+					    "predicate before /\n");
+				}
+				if (yypcb->pcb_brackets != 0) {
+					yyerror("closing ] expected in "
+					    "predicate before /\n");
+				}
+				tok = DT_TOK_EPRED;
+			} else
+				tok = DT_TOK_DIV;
+
+			if (c != EOF) unput(c);
+			return (tok);
+		}
+	YY_BREAK
+case 100:
+YY_RULE_SETUP
+#line 540 "dt_lex.l"
+{
+			yypcb->pcb_parens++;
+			return (DT_TOK_LPAR);
+		}
+	YY_BREAK
+case 101:
+YY_RULE_SETUP
+#line 545 "dt_lex.l"
+{
+			if (--yypcb->pcb_parens < 0)
+				yyerror("extra ) in input stream\n");
+			return (DT_TOK_RPAR);
+		}
+	YY_BREAK
+case 102:
+YY_RULE_SETUP
+#line 551 "dt_lex.l"
+{
+			yypcb->pcb_brackets++;
+			return (DT_TOK_LBRAC);
+		}
+	YY_BREAK
+case 103:
+YY_RULE_SETUP
+#line 556 "dt_lex.l"
+{
+			if (--yypcb->pcb_brackets < 0)
+				yyerror("extra ] in input stream\n");
+			return (DT_TOK_RBRAC);
+		}
+	YY_BREAK
+case 104:
+#line 563 "dt_lex.l"
+case 105:
+YY_RULE_SETUP
+#line 563 "dt_lex.l"
+{
+			yypcb->pcb_braces++;
+			return ('{');
+		}
+	YY_BREAK
+case 106:
+YY_RULE_SETUP
+#line 568 "dt_lex.l"
+{
+			if (--yypcb->pcb_braces < 0)
+				yyerror("extra } in input stream\n");
+			return ('}');
+		}
+	YY_BREAK
+case 107:
+YY_RULE_SETUP
+#line 574 "dt_lex.l"
+return (DT_TOK_BOR);
+	YY_BREAK
+case 108:
+YY_RULE_SETUP
+#line 575 "dt_lex.l"
+return (DT_TOK_XOR);
+	YY_BREAK
+case 109:
+YY_RULE_SETUP
+#line 576 "dt_lex.l"
+return (DT_TOK_BAND);
+	YY_BREAK
+case 110:
+YY_RULE_SETUP
+#line 577 "dt_lex.l"
+return (DT_TOK_LAND);
+	YY_BREAK
+case 111:
+YY_RULE_SETUP
+#line 578 "dt_lex.l"
+return (DT_TOK_LXOR);
+	YY_BREAK
+case 112:
+YY_RULE_SETUP
+#line 579 "dt_lex.l"
+return (DT_TOK_LOR);
+	YY_BREAK
+case 113:
+YY_RULE_SETUP
+#line 580 "dt_lex.l"
+return (DT_TOK_EQU);
+	YY_BREAK
+case 114:
+YY_RULE_SETUP
+#line 581 "dt_lex.l"
+return (DT_TOK_NEQ);
+	YY_BREAK
+case 115:
+YY_RULE_SETUP
+#line 582 "dt_lex.l"
+return (DT_TOK_LT);
+	YY_BREAK
+case 116:
+YY_RULE_SETUP
+#line 583 "dt_lex.l"
+return (DT_TOK_LE);
+	YY_BREAK
+case 117:
+YY_RULE_SETUP
+#line 584 "dt_lex.l"
+return (DT_TOK_GT);
+	YY_BREAK
+case 118:
+YY_RULE_SETUP
+#line 585 "dt_lex.l"
+return (DT_TOK_GE);
+	YY_BREAK
+case 119:
+YY_RULE_SETUP
+#line 586 "dt_lex.l"
+return (DT_TOK_LSH);
+	YY_BREAK
+case 120:
+YY_RULE_SETUP
+#line 587 "dt_lex.l"
+return (DT_TOK_RSH);
+	YY_BREAK
+case 121:
+YY_RULE_SETUP
+#line 588 "dt_lex.l"
+return (DT_TOK_ADD);
+	YY_BREAK
+case 122:
+YY_RULE_SETUP
+#line 589 "dt_lex.l"
+return (DT_TOK_SUB);
+	YY_BREAK
+case 123:
+YY_RULE_SETUP
+#line 590 "dt_lex.l"
+return (DT_TOK_MUL);
+	YY_BREAK
+case 124:
+YY_RULE_SETUP
+#line 591 "dt_lex.l"
+return (DT_TOK_MOD);
+	YY_BREAK
+case 125:
+YY_RULE_SETUP
+#line 592 "dt_lex.l"
+return (DT_TOK_BNEG);
+	YY_BREAK
+case 126:
+YY_RULE_SETUP
+#line 593 "dt_lex.l"
+return (DT_TOK_LNEG);
+	YY_BREAK
+case 127:
+YY_RULE_SETUP
+#line 594 "dt_lex.l"
+return (DT_TOK_QUESTION);
+	YY_BREAK
+case 128:
+YY_RULE_SETUP
+#line 595 "dt_lex.l"
+return (DT_TOK_COLON);
+	YY_BREAK
+case 129:
+YY_RULE_SETUP
+#line 596 "dt_lex.l"
+return (DT_TOK_DOT);
+	YY_BREAK
+case 130:
+YY_RULE_SETUP
+#line 597 "dt_lex.l"
+return (DT_TOK_PTR);
+	YY_BREAK
+case 131:
+YY_RULE_SETUP
+#line 598 "dt_lex.l"
+return (DT_TOK_ASGN);
+	YY_BREAK
+case 132:
+YY_RULE_SETUP
+#line 599 "dt_lex.l"
+return (DT_TOK_ADD_EQ);
+	YY_BREAK
+case 133:
+YY_RULE_SETUP
+#line 600 "dt_lex.l"
+return (DT_TOK_SUB_EQ);
+	YY_BREAK
+case 134:
+YY_RULE_SETUP
+#line 601 "dt_lex.l"
+return (DT_TOK_MUL_EQ);
+	YY_BREAK
+case 135:
+YY_RULE_SETUP
+#line 602 "dt_lex.l"
+return (DT_TOK_DIV_EQ);
+	YY_BREAK
+case 136:
+YY_RULE_SETUP
+#line 603 "dt_lex.l"
+return (DT_TOK_MOD_EQ);
+	YY_BREAK
+case 137:
+YY_RULE_SETUP
+#line 604 "dt_lex.l"
+return (DT_TOK_AND_EQ);
+	YY_BREAK
+case 138:
+YY_RULE_SETUP
+#line 605 "dt_lex.l"
+return (DT_TOK_XOR_EQ);
+	YY_BREAK
+case 139:
+YY_RULE_SETUP
+#line 606 "dt_lex.l"
+return (DT_TOK_OR_EQ);
+	YY_BREAK
+case 140:
+YY_RULE_SETUP
+#line 607 "dt_lex.l"
+return (DT_TOK_LSH_EQ);
+	YY_BREAK
+case 141:
+YY_RULE_SETUP
+#line 608 "dt_lex.l"
+return (DT_TOK_RSH_EQ);
+	YY_BREAK
+case 142:
+YY_RULE_SETUP
+#line 609 "dt_lex.l"
+return (DT_TOK_ADDADD);
+	YY_BREAK
+case 143:
+YY_RULE_SETUP
+#line 610 "dt_lex.l"
+return (DT_TOK_SUBSUB);
+	YY_BREAK
+case 144:
+YY_RULE_SETUP
+#line 611 "dt_lex.l"
+return (DT_TOK_ELLIPSIS);
+	YY_BREAK
+case 145:
+YY_RULE_SETUP
+#line 612 "dt_lex.l"
+return (DT_TOK_COMMA);
+	YY_BREAK
+case 146:
+YY_RULE_SETUP
+#line 613 "dt_lex.l"
+return (';');
+	YY_BREAK
+case 147:
+/* rule 147 can match eol */
+YY_RULE_SETUP
+#line 614 "dt_lex.l"
+; /* discard */
+	YY_BREAK
+case 148:
+/* rule 148 can match eol */
+YY_RULE_SETUP
+#line 615 "dt_lex.l"
+; /* discard */
+	YY_BREAK
+case 149:
+YY_RULE_SETUP
+#line 616 "dt_lex.l"
+yyerror("syntax error near \"%c\"\n", yytext[0]);
+	YY_BREAK
+case 150:
+YY_RULE_SETUP
+#line 618 "dt_lex.l"
+yyerror("/* encountered inside a comment\n");
+	YY_BREAK
+case 151:
+YY_RULE_SETUP
+#line 619 "dt_lex.l"
+BEGIN(yypcb->pcb_cstate);
+	YY_BREAK
+/* VBOX - START */
+case YY_STATE_EOF(S1):
+#line 621 "dt_lex.l"
+yyerror("end-of-file encountered before matching */\n");
+	YY_BREAK
+/* VBOX - END */
+case 152:
+/* rule 152 can match eol */
+YY_RULE_SETUP
+#line 623 "dt_lex.l"
+; /* discard */
+	YY_BREAK
+case 153:
+YY_RULE_SETUP
+#line 625 "dt_lex.l"
+{
+			/*
+			 * S2 has an ambiguity because RGX_PSPEC includes '*'
+			 * as a glob character and '*' also can be DT_TOK_STAR.
+			 * Since lex always matches the longest token, this
+			 * rule can be matched by an input string like "int*",
+			 * which could begin a global variable declaration such
+			 * as "int*x;" or could begin a RGX_PSPEC with globbing
+			 * such as "int* { trace(timestamp); }".  If C_PSPEC is
+			 * not set, we must resolve the ambiguity in favor of
+			 * the type and perform lexer pushback if the fragment
+			 * before '*' or entire fragment matches a type name.
+			 * If C_PSPEC is set, we always return a PSPEC token.
+			 * If C_PSPEC is off, the user can avoid ambiguity by
+			 * including a ':' delimiter in the specifier, which
+			 * they should be doing anyway to specify the provider.
+			 */
+			if (!(yypcb->pcb_cflags & DTRACE_C_PSPEC) &&
+			    strchr(yytext, ':') == NULL) {
+
+				char *p = strchr(yytext, '*');
+				char *q = yytext + yyleng - 1;
+
+				if (p != NULL && p > yytext)
+					*p = '\0'; /* prune yytext */
+
+				if (dt_type_lookup(yytext, NULL) == 0) {
+					yylval.l_str = strdup(yytext);
+
+					if (yylval.l_str == NULL) {
+						longjmp(yypcb->pcb_jmpbuf,
+						    EDT_NOMEM);
+					}
+
+					if (p != NULL && p > yytext) {
+						for (*p = '*'; q >= p; q--)
+							unput(*q);
+					}
+
+					yybegin(YYS_EXPR);
+					return (DT_TOK_TNAME);
+				}
+
+				if (p != NULL && p > yytext)
+					*p = '*'; /* restore yytext */
+			}
+
+			if ((yylval.l_str = strdup(yytext)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			return (DT_TOK_PSPEC);
+		}
+	YY_BREAK
+case 154:
+YY_RULE_SETUP
+#line 678 "dt_lex.l"
+return (DT_TOK_DIV);
+	YY_BREAK
+case 155:
+YY_RULE_SETUP
+#line 679 "dt_lex.l"
+return (DT_TOK_COMMA);
+	YY_BREAK
+case 156:
+/* rule 156 can match eol */
+YY_RULE_SETUP
+#line 681 "dt_lex.l"
+; /* discard */
+	YY_BREAK
+case 157:
+YY_RULE_SETUP
+#line 682 "dt_lex.l"
+yyerror("syntax error near \"%c\"\n", yytext[0]);
+	YY_BREAK
+case 158:
+/* rule 158 can match eol */
+YY_RULE_SETUP
+#line 684 "dt_lex.l"
+{
+			dt_pragma(yypragma);
+			yypragma = NULL;
+			BEGIN(yypcb->pcb_cstate);
+		}
+	YY_BREAK
+case 159:
+YY_RULE_SETUP
+#line 690 "dt_lex.l"
+; /* discard */
+	YY_BREAK
+case 160:
+YY_RULE_SETUP
+#line 692 "dt_lex.l"
+{
+			dt_node_t *dnp;
+
+			if ((yylval.l_str = strdup(yytext)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			/*
+			 * We want to call dt_node_ident() here, but we can't
+			 * because it will expand inlined identifiers, which we
+			 * don't want to do from #pragma context in order to
+			 * support pragmas that apply to the ident itself.  We
+			 * call dt_node_string() and then reset dn_op instead.
+			 */
+			dnp = dt_node_string(yylval.l_str);
+			dnp->dn_kind = DT_NODE_IDENT;
+			dnp->dn_op = DT_TOK_IDENT;
+			yypragma = dt_node_link(yypragma, dnp);
+		}
+	YY_BREAK
+/* VBOX - BEGIN */
+case YY_STATE_EOF(S3):
+#line 712 "dt_lex.l"
+yyerror("end-of-file encountered before end of control line\n");
+	YY_BREAK
+/* VBOX - END */
+case 161:
+YY_RULE_SETUP
+#line 714 "dt_lex.l"
+yyerror("syntax error near \"%c\"\n", yytext[0]);
+	YY_BREAK
+case 162:
+YY_RULE_SETUP
+#line 716 "dt_lex.l"
+ECHO;
+	YY_BREAK
+#line 2575 "dt_lex.c"
+			case YY_STATE_EOF(INITIAL):
+			case YY_STATE_EOF(S0):
+			case YY_STATE_EOF(S2):
+			case YY_STATE_EOF(S4):
+				yyterminate();
+
+	case YY_END_OF_BUFFER:
+		{
+		/* Amount of text matched not including the EOB char. */
+		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+		/* Undo the effects of YY_DO_BEFORE_ACTION. */
+		*yy_cp = (yy_hold_char);
+		YY_RESTORE_YY_MORE_OFFSET
+
+		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+			{
+			/* We're scanning a new file or input source.  It's
+			 * possible that this happened because the user
+			 * just pointed yyin at a new source and called
+			 * yylex().  If so, then we have to assure
+			 * consistency between YY_CURRENT_BUFFER and our
+			 * globals.  Here is the right place to do so, because
+			 * this is the first action (other than possibly a
+			 * back-up) that will match for the new input source.
+			 */
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+			}
+
+		/* Note that here we test for yy_c_buf_p "<=" to the position
+		 * of the first EOB in the buffer, since yy_c_buf_p will
+		 * already have been incremented past the NUL character
+		 * (since all states make transitions on EOB to the
+		 * end-of-buffer state).  Contrast this with the test
+		 * in input().
+		 */
+		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			{ /* This was really a NUL. */
+			yy_state_type yy_next_state;
+
+			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+			yy_current_state = yy_get_previous_state(  );
+
+			/* Okay, we're now positioned to make the NUL
+			 * transition.  We couldn't have
+			 * yy_get_previous_state() go ahead and do it
+			 * for us because it doesn't know how to deal
+			 * with the possibility of jamming (and we don't
+			 * want to build jamming into it because then it
+			 * will run more slowly).
+			 */
+
+			yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+			if ( yy_next_state )
+				{
+				/* Consume the NUL. */
+				yy_cp = ++(yy_c_buf_p);
+				yy_current_state = yy_next_state;
+				goto yy_match;
+				}
+
+			else
+				{
+				yy_cp = (yy_c_buf_p);
+				goto yy_find_action;
+				}
+			}
+
+		else switch ( yy_get_next_buffer(  ) )
+			{
+			case EOB_ACT_END_OF_FILE:
+				{
+				(yy_did_buffer_switch_on_eof) = 0;
+
+				if ( yywrap( ) )
+					{
+					/* Note: because we've taken care in
+					 * yy_get_next_buffer() to have set up
+					 * yytext, we can now set up
+					 * yy_c_buf_p so that if some total
+					 * hoser (like flex itself) wants to
+					 * call the scanner after we return the
+					 * YY_NULL, it'll still work - another
+					 * YY_NULL will get returned.
+					 */
+					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+					yy_act = YY_STATE_EOF(YY_START);
+					goto do_action;
+					}
+
+				else
+					{
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+					}
+				break;
+				}
+
+			case EOB_ACT_CONTINUE_SCAN:
+				(yy_c_buf_p) =
+					(yytext_ptr) + yy_amount_of_matched_text;
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_match;
+
+			case EOB_ACT_LAST_MATCH:
+				(yy_c_buf_p) =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+				yy_current_state = yy_get_previous_state(  );
+
+				yy_cp = (yy_c_buf_p);
+				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+				goto yy_find_action;
+			}
+		break;
+		}
+
+	default:
+		YY_FATAL_ERROR(
+			"fatal flex scanner internal error--no action found" );
+	} /* end of action switch */
+		} /* end of scanning one token */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *	EOB_ACT_LAST_MATCH -
+ *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *	EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	register char *source = (yytext_ptr);
+	register int number_to_move, i;
+	int ret_val;
+
+	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+		YY_FATAL_ERROR(
+		"fatal flex scanner internal error--end of buffer missed" );
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+		{ /* Don't try to fill the buffer, so this is an EOF. */
+		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+			{
+			/* We matched a single character, the EOB, so
+			 * treat this as a final EOF.
+			 */
+			return EOB_ACT_END_OF_FILE;
+			}
+
+		else
+			{
+			/* We matched some text prior to the EOB, first
+			 * process it.
+			 */
+			return EOB_ACT_LAST_MATCH;
+			}
+		}
+
+	/* Try to read more data. */
+
+	/* First move last chars to start of buffer. */
+	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+	for ( i = 0; i < number_to_move; ++i )
+		*(dest++) = *(source++);
+
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+		/* don't do the read, it's not guaranteed to return an EOF,
+		 * just force an EOF
+		 */
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+	else
+		{
+			yy_size_t num_to_read =
+			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+		while ( num_to_read <= 0 )
+			{ /* Not enough room in the buffer - grow it. */
+
+			YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+
+			}
+
+		if ( num_to_read > YY_READ_BUF_SIZE )
+			num_to_read = YY_READ_BUF_SIZE;
+
+		/* Read in more data. */
+		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+			(yy_n_chars), num_to_read );
+
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	if ( (yy_n_chars) == 0 )
+		{
+		if ( number_to_move == YY_MORE_ADJ )
+			{
+			ret_val = EOB_ACT_END_OF_FILE;
+			yyrestart(yyin  );
+			}
+
+		else
+			{
+			ret_val = EOB_ACT_LAST_MATCH;
+			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+				YY_BUFFER_EOF_PENDING;
+			}
+		}
+
+	else
+		ret_val = EOB_ACT_CONTINUE_SCAN;
+
+	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+	}
+
+	(yy_n_chars) += number_to_move;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+	return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+    static yy_state_type yy_get_previous_state (void)
+{
+	register yy_state_type yy_current_state;
+	register char *yy_cp;
+    
+	yy_current_state = (yy_start);
+	yy_current_state += YY_AT_BOL();
+
+	(yy_state_ptr) = (yy_state_buf);
+	*(yy_state_ptr)++ = yy_current_state;
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+			{
+			yy_current_state = (int) yy_def[yy_current_state];
+			if ( yy_current_state >= 510 )
+				yy_c = yy_meta[(unsigned int) yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+		*(yy_state_ptr)++ = yy_current_state;
+		}
+
+	return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *	next_state = yy_try_NUL_trans( current_state );
+ */
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+{
+	register int yy_is_jam;
+    
+	register YY_CHAR yy_c = 1;
+	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+		{
+		yy_current_state = (int) yy_def[yy_current_state];
+		if ( yy_current_state >= 510 )
+			yy_c = yy_meta[(unsigned int) yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+	yy_is_jam = (yy_current_state == 509);
+	if ( ! yy_is_jam )
+		*(yy_state_ptr)++ = yy_current_state;
+
+	return yy_is_jam ? 0 : yy_current_state;
+}
+
+    static void yyunput (int c, register char * yy_bp )
+{
+	register char *yy_cp;
+    
+    yy_cp = (yy_c_buf_p);
+
+	/* undo effects of setting up yytext */
+	*yy_cp = (yy_hold_char);
+
+	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		register yy_size_t number_to_move = (yy_n_chars) + 2;
+		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		register char *source =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			*--dest = *--source;
+
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
+
+	*--yy_cp = (char) c;
+
+    if ( c == '\n' ){
+        --yylineno;
+    }
+
+	(yytext_ptr) = yy_bp;
+	(yy_hold_char) = *yy_cp;
+	(yy_c_buf_p) = yy_cp;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+    static int yyinput (void)
+#else
+    static int input  (void)
+#endif
+
+{
+	int c;
+    
+	*(yy_c_buf_p) = (yy_hold_char);
+
+	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+		{
+		/* yy_c_buf_p now points to the character we want to return.
+		 * If this occurs *before* the EOB characters, then it's a
+		 * valid NUL; if not, then we've hit the end of the buffer.
+		 */
+		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+			/* This was really a NUL. */
+			*(yy_c_buf_p) = '\0';
+
+		else
+			{ /* need more input */
+			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+			++(yy_c_buf_p);
+
+			switch ( yy_get_next_buffer(  ) )
+				{
+				case EOB_ACT_LAST_MATCH:
+					/* This happens because yy_g_n_b()
+					 * sees that we've accumulated a
+					 * token and flags that we need to
+					 * try matching the token before
+					 * proceeding.  But for input(),
+					 * there's no matching to consider.
+					 * So convert the EOB_ACT_LAST_MATCH
+					 * to EOB_ACT_END_OF_FILE.
+					 */
+
+					/* Reset buffer status. */
+					yyrestart(yyin );
+
+					/*FALLTHROUGH*/
+
+				case EOB_ACT_END_OF_FILE:
+					{
+					if ( yywrap( ) )
+						return 0;
+
+					if ( ! (yy_did_buffer_switch_on_eof) )
+						YY_NEW_FILE;
+#ifdef __cplusplus
+					return yyinput();
+#else
+					return input();
+#endif
+					}
+
+				case EOB_ACT_CONTINUE_SCAN:
+					(yy_c_buf_p) = (yytext_ptr) + offset;
+					break;
+				}
+			}
+		}
+
+	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
+	*(yy_c_buf_p) = '\0';	/* preserve yytext */
+	(yy_hold_char) = *++(yy_c_buf_p);
+
+	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
+	if ( YY_CURRENT_BUFFER_LVALUE->yy_at_bol )
+		   
+    yylineno++;
+;
+
+	return c;
+}
+#endif	/* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ * 
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+    void yyrestart  (FILE * input_file )
+{
+    
+	if ( ! YY_CURRENT_BUFFER ){
+        yyensure_buffer_stack ();
+		YY_CURRENT_BUFFER_LVALUE =
+            yy_create_buffer(yyin,YY_BUF_SIZE );
+	}
+
+	yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+	yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ * 
+ */
+    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
+{
+    
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		yypop_buffer_state();
+	 *		yypush_buffer_state(new_buffer);
+     */
+	yyensure_buffer_stack ();
+	if ( YY_CURRENT_BUFFER == new_buffer )
+		return;
+
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+	yy_load_buffer_state( );
+
+	/* We don't actually know whether we did this switch during
+	 * EOF (yywrap()) processing, but the only time this flag
+	 * is looked at is after yywrap() is called, so it's safe
+	 * to go ahead and always set it.
+	 */
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state  (void)
+{
+    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+	(yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ * 
+ * @return the allocated buffer state.
+ */
+    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
+{
+	YY_BUFFER_STATE b;
+    
+	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_buf_size = size;
+
+	/* yy_ch_buf has to be 2 characters longer than the size given because
+	 * we need to put in 2 end-of-buffer characters.
+	 */
+	b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+	b->yy_is_our_buffer = 1;
+
+	yy_init_buffer(b,file );
+
+	return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ * 
+ */
+    void yy_delete_buffer (YY_BUFFER_STATE  b )
+{
+    
+	if ( ! b )
+		return;
+
+	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+	if ( b->yy_is_our_buffer )
+		yyfree((void *) b->yy_ch_buf  );
+
+	yyfree((void *) b  );
+}
+
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+    
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
+
+{
+	int oerrno = errno;
+    
+	yy_flush_buffer(b );
+
+	b->yy_input_file = file;
+	b->yy_fill_buffer = 1;
+
+    /* If b is the current buffer, then yy_init_buffer was _probably_
+     * called from yyrestart() or through yy_get_next_buffer.
+     * In that case, we don't want to reset the lineno or column.
+     */
+    if (b != YY_CURRENT_BUFFER){
+        b->yy_bs_lineno = 1;
+        b->yy_bs_column = 0;
+    }
+
+        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+    
+	errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ * 
+ */
+    void yy_flush_buffer (YY_BUFFER_STATE  b )
+{
+    	if ( ! b )
+		return;
+
+	b->yy_n_chars = 0;
+
+	/* We always need two end-of-buffer characters.  The first causes
+	 * a transition to the end-of-buffer state.  The second causes
+	 * a jam in that state.
+	 */
+	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+	b->yy_buf_pos = &b->yy_ch_buf[0];
+
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	if ( b == YY_CURRENT_BUFFER )
+		yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ *  the current state. This function will allocate the stack
+ *  if necessary.
+ *  @param new_buffer The new state.
+ *  
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+    	if (new_buffer == NULL)
+		return;
+
+	yyensure_buffer_stack();
+
+	/* This block is copied from yy_switch_to_buffer. */
+	if ( YY_CURRENT_BUFFER )
+		{
+		/* Flush out information for old buffer. */
+		*(yy_c_buf_p) = (yy_hold_char);
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+		}
+
+	/* Only push if top exists. Otherwise, replace top. */
+	if (YY_CURRENT_BUFFER)
+		(yy_buffer_stack_top)++;
+	YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+	/* copied from yy_switch_to_buffer. */
+	yy_load_buffer_state( );
+	(yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ *  The next element becomes the new top.
+ *  
+ */
+void yypop_buffer_state (void)
+{
+    	if (!YY_CURRENT_BUFFER)
+		return;
+
+	yy_delete_buffer(YY_CURRENT_BUFFER );
+	YY_CURRENT_BUFFER_LVALUE = NULL;
+	if ((yy_buffer_stack_top) > 0)
+		--(yy_buffer_stack_top);
+
+	if (YY_CURRENT_BUFFER) {
+		yy_load_buffer_state( );
+		(yy_did_buffer_switch_on_eof) = 1;
+	}
+}
+
+/* Allocates the stack if it does not exist.
+ *  Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+	yy_size_t num_to_alloc;
+    
+	if (!(yy_buffer_stack)) {
+
+		/* First allocation is just for 2 elements, since we don't know if this
+		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
+		 * immediate realloc on the next call.
+         */
+		num_to_alloc = 1;
+		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+								(num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		if ( ! (yy_buffer_stack) )
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+								  
+		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+				
+		(yy_buffer_stack_max) = num_to_alloc;
+		(yy_buffer_stack_top) = 0;
+		return;
+	}
+
+	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+		/* Increase the buffer to prepare for a possible push. */
+		int grow_size = 8 /* arbitrary grow size */;
+
+		num_to_alloc = (yy_buffer_stack_max) + grow_size;
+		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+								((yy_buffer_stack),
+								num_to_alloc * sizeof(struct yy_buffer_state*)
+								);
+		if ( ! (yy_buffer_stack) )
+			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+		/* zero only the new slots.*/
+		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+		(yy_buffer_stack_max) = num_to_alloc;
+	}
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ * 
+ * @return the newly allocated buffer state object. 
+ */
+YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
+{
+	YY_BUFFER_STATE b;
+    
+	if ( size < 2 ||
+	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
+	     base[size-1] != YY_END_OF_BUFFER_CHAR )
+		/* They forgot to leave room for the EOB's. */
+		return 0;
+
+	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
+	if ( ! b )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
+	b->yy_buf_pos = b->yy_ch_buf = base;
+	b->yy_is_our_buffer = 0;
+	b->yy_input_file = 0;
+	b->yy_n_chars = b->yy_buf_size;
+	b->yy_is_interactive = 0;
+	b->yy_at_bol = 1;
+	b->yy_fill_buffer = 0;
+	b->yy_buffer_status = YY_BUFFER_NEW;
+
+	yy_switch_to_buffer(b  );
+
+	return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ * 
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ *       yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
+{
+    
+	return yy_scan_bytes(yystr,strlen(yystr) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * 
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
+{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n, i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = _yybytes_len + 2;
+	buf = (char *) yyalloc(n  );
+	if ( ! buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+	for ( i = 0; i < _yybytes_len; ++i )
+		buf[i] = yybytes[i];
+
+	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+	b = yy_scan_buffer(buf,n );
+	if ( ! b )
+		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+	/* It's okay to grow etc. this buffer, and we should throw it
+	 * away when we're done.
+	 */
+	b->yy_is_our_buffer = 1;
+
+	return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+    	(void) fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+	do \
+		{ \
+		/* Undo effects of setting up yytext. */ \
+        int yyless_macro_arg = (n); \
+        YY_LESS_LINENO(yyless_macro_arg);\
+		yytext[yyleng] = (yy_hold_char); \
+		(yy_c_buf_p) = yytext + yyless_macro_arg; \
+		(yy_hold_char) = *(yy_c_buf_p); \
+		*(yy_c_buf_p) = '\0'; \
+		yyleng = yyless_macro_arg; \
+		} \
+	while ( 0 )
+
+/* Accessor  methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ * 
+ */
+int yyget_lineno  (void)
+{
+        
+    return yylineno;
+}
+
+/** Get the input stream.
+ * 
+ */
+FILE *yyget_in  (void)
+{
+        return yyin;
+}
+
+/** Get the output stream.
+ * 
+ */
+FILE *yyget_out  (void)
+{
+        return yyout;
+}
+
+/** Get the length of the current token.
+ * 
+ */
+yy_size_t yyget_leng  (void)
+{
+        return yyleng;
+}
+
+/** Get the current token.
+ * 
+ */
+
+char *yyget_text  (void)
+{
+        return yytext;
+}
+
+/** Set the current line number.
+ * @param line_number
+ * 
+ */
+void yyset_lineno (int  line_number )
+{
+    
+    yylineno = line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ * 
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE *  in_str )
+{
+        yyin = in_str ;
+}
+
+void yyset_out (FILE *  out_str )
+{
+        yyout = out_str ;
+}
+
+int yyget_debug  (void)
+{
+        return yy_flex_debug;
+}
+
+void yyset_debug (int  bdebug )
+{
+        yy_flex_debug = bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+        /* Initialization is the same as for the non-reentrant scanner.
+     * This function is called from yylex_destroy(), so don't allocate here.
+     */
+
+    /* We do not touch yylineno unless the option is enabled. */
+    yylineno =  1;
+    
+    (yy_buffer_stack) = 0;
+    (yy_buffer_stack_top) = 0;
+    (yy_buffer_stack_max) = 0;
+    (yy_c_buf_p) = (char *) 0;
+    (yy_init) = 0;
+    (yy_start) = 0;
+
+    (yy_state_buf) = 0;
+    (yy_state_ptr) = 0;
+    (yy_full_match) = 0;
+    (yy_lp) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+    yyin = stdin;
+    yyout = stdout;
+#else
+    yyin = (FILE *) 0;
+    yyout = (FILE *) 0;
+#endif
+
+    /* For future reference: Set errno on error, since we are called by
+     * yylex_init()
+     */
+    return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy  (void)
+{
+    
+    /* Pop the buffer stack, destroying each element. */
+	while(YY_CURRENT_BUFFER){
+		yy_delete_buffer(YY_CURRENT_BUFFER  );
+		YY_CURRENT_BUFFER_LVALUE = NULL;
+		yypop_buffer_state();
+	}
+
+	/* Destroy the stack itself. */
+	yyfree((yy_buffer_stack) );
+	(yy_buffer_stack) = NULL;
+
+    yyfree ( (yy_state_buf) );
+    (yy_state_buf)  = NULL;
+
+    /* Reset the globals. This is important in a non-reentrant scanner so the next time
+     * yylex() is called, initialization will occur. */
+    yy_init_globals( );
+
+    return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+	register int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+	register int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *yyalloc (yy_size_t  size )
+{
+	return (void *) malloc( size );
+}
+
+void *yyrealloc  (void * ptr, yy_size_t  size )
+{
+	/* The cast to (char *) in the following accommodates both
+	 * implementations that use char* generic pointers, and those
+	 * that use void* generic pointers.  It works with the latter
+	 * because both ANSI C and C++ allow castless assignment from
+	 * any pointer type to void*, and deal with argument conversions
+	 * as though doing an assignment.
+	 */
+	return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 716 "dt_lex.l"
+
+
+
+/*
+ * yybegin provides a wrapper for use from C code around the lex BEGIN() macro.
+ * We use two main states for lexing because probe descriptions use a syntax
+ * that is incompatible with the normal D tokens (e.g. names can contain "-").
+ * yybegin also handles the job of switching between two lists of dt_nodes
+ * as we allocate persistent definitions, like inlines, and transient nodes
+ * that will be freed once we are done parsing the current program file.
+ */
+void
+yybegin(yystate_t state)
+{
+#ifdef	YYDEBUG
+	yydebug = _dtrace_debug;
+#endif
+	if (yypcb->pcb_yystate == state)
+		return; /* nothing to do if we're in the state already */
+
+	if (yypcb->pcb_yystate == YYS_DEFINE) {
+		yypcb->pcb_list = yypcb->pcb_hold;
+		yypcb->pcb_hold = NULL;
+	}
+
+	switch (state) {
+	case YYS_CLAUSE:
+		BEGIN(S2);
+		break;
+	case YYS_DEFINE:
+		assert(yypcb->pcb_hold == NULL);
+		yypcb->pcb_hold = yypcb->pcb_list;
+		yypcb->pcb_list = NULL;
+		/*FALLTHRU*/
+	case YYS_EXPR:
+		BEGIN(S0);
+		break;
+	case YYS_DONE:
+		break;
+	case YYS_CONTROL:
+		BEGIN(S4);
+		break;
+	default:
+		xyerror(D_UNKNOWN, "internal error -- bad yystate %d\n", state);
+	}
+
+	yypcb->pcb_yystate = state;
+}
+
+void
+yyinit(dt_pcb_t *pcb)
+{
+	yypcb = pcb;
+	yylineno = 1;
+	yypragma = NULL;
+#ifndef USING_FLEX
+	yysptr = yysbuf;
+#else
+   yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
+#endif
+}
+
+/*
+ * Given a lexeme 's' (typically yytext), set yylval and return an appropriate
+ * token to the parser indicating either an identifier or a typedef name.
+ * User-defined global variables always take precedence over types, but we do
+ * use some heuristics because D programs can look at an ever-changing set of
+ * kernel types and also can implicitly instantiate variables by assignment,
+ * unlike in C.  The code here is ordered carefully as lookups are not cheap.
+ */
+static int
+id_or_type(const char *s)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_decl_t *ddp = yypcb->pcb_dstack.ds_decl;
+	int c0, c1, ttok = DT_TOK_TNAME;
+	dt_ident_t *idp;
+
+	if ((s = yylval.l_str = strdup(s)) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	/*
+	 * If the lexeme is a global variable or likely identifier or *not* a
+	 * type_name, then it is an identifier token.
+	 */
+	if (dt_idstack_lookup(&yypcb->pcb_globals, s) != NULL ||
+	    dt_idhash_lookup(yypcb->pcb_idents, s) != NULL ||
+	    dt_type_lookup(s, NULL) != 0)
+		return (DT_TOK_IDENT);
+
+	/*
+	 * If we're in the midst of parsing a declaration and a type_specifier
+	 * has already been shifted, then return DT_TOK_IDENT instead of TNAME.
+	 * This semantic is necessary to permit valid ISO C code such as:
+	 *
+	 * typedef int foo;
+	 * struct s { foo foo; };
+	 *
+	 * without causing shift/reduce conflicts in the direct_declarator part
+	 * of the grammar.  The result is that we must check for conflicting
+	 * redeclarations of the same identifier as part of dt_node_decl().
+	 */
+	if (ddp != NULL && ddp->dd_name != NULL)
+		return (DT_TOK_IDENT);
+
+	/*
+	 * If the lexeme is a type name and we are not in a program clause,
+	 * then always interpret it as a type and return DT_TOK_TNAME.
+	 */
+	if ((YYSTATE) != S0)
+		return (DT_TOK_TNAME);
+
+	/*
+	 * If the lexeme matches a type name but is in a program clause, then
+	 * it could be a type or it could be an undefined variable.  Peek at
+	 * the next token to decide.  If we see ++, --, [, or =, we know there
+	 * might be an assignment that is trying to create a global variable,
+	 * so we optimistically return DT_TOK_IDENT.  There is no harm in being
+	 * wrong: a type_name followed by ++, --, [, or = is a syntax error.
+	 */
+	while ((c0 = input()) != 0) {
+		if (strchr("\f\n\r\t\v ", c0) == NULL)
+			break;
+	}
+
+	switch (c0) {
+	case '+':
+	case '-':
+		if ((c1 = input()) == c0)
+			ttok = DT_TOK_IDENT;
+		if (c1 != EOF) unput(c1);
+		break;
+
+	case '=':
+		if ((c1 = input()) != c0)
+			ttok = DT_TOK_IDENT;
+		if (c1 != EOF) unput(c1);
+		break;
+	case '[':
+		ttok = DT_TOK_IDENT;
+		break;
+	}
+
+	if (ttok == DT_TOK_IDENT) {
+		idp = dt_idhash_insert(yypcb->pcb_idents, s, DT_IDENT_SCALAR, 0,
+		    0, _dtrace_defattr, 0, &dt_idops_thaw, NULL, dtp->dt_gen);
+
+		if (idp == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	if (c0 != EOF) unput(c0);
+	return (ttok);
+}
+
+#ifndef USING_FLEX
+
+static int
+input(void)
+{
+	int c;
+
+	if (yysptr > yysbuf)
+		c = *--yysptr;
+	else if (yypcb->pcb_fileptr != NULL)
+		c = fgetc(yypcb->pcb_fileptr);
+	else if (yypcb->pcb_strptr < yypcb->pcb_string + yypcb->pcb_strlen)
+		c = *(unsigned char *)(yypcb->pcb_strptr++);
+	else
+		c = EOF;
+
+	if (c == '\n')
+		yylineno++;
+
+	if (c != EOF)
+		return (c);
+
+	if ((YYSTATE) == S1)
+		yyerror("end-of-file encountered before matching */\n");
+
+	if ((YYSTATE) == S3)
+		yyerror("end-of-file encountered before end of control line\n");
+
+	if (yypcb->pcb_fileptr != NULL && ferror(yypcb->pcb_fileptr))
+		longjmp(yypcb->pcb_jmpbuf, EDT_FIO);
+
+	return (0); /* EOF */
+}
+
+static void
+unput(int c)
+{
+	if (c == '\n')
+		yylineno--;
+
+	*yysptr++ = c;
+	yytchar = c;
+}
+
+#endif /* USING_FLEX */
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h
new file mode 100644
index 0000000..099b157
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h
@@ -0,0 +1,96 @@
+/* $Id: VBoxDTraceLibCWrappers.h $ */
+/** @file
+ * VBoxDTraceTLibCWrappers.h - IPRT wrappers/fake for lib C stuff.
+ *
+ * Contributed by: bird
+ */
+
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the Common
+ * Development and Distribution License Version 1.0 (CDDL) only, as it
+ * comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution.
+ * VirtualBox OSE is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY of any kind.
+ *
+ */
+
+#ifndef ___VBoxDTraceLibCWrappers_h___
+#define ___VBoxDTraceLibCWrappers_h___
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef RT_OS_WINDOWS
+# include <process.h>
+#else
+# include <sys/types.h>
+# include <limits.h>        /* Workaround for syslimit.h bug in gcc 4.8.3 on gentoo. */
+# ifndef RT_OS_SOLARIS
+#  include <syslimits.h>    /* PATH_MAX */
+# endif
+# include <libgen.h>        /* basename */
+# include <unistd.h>
+# include <strings.h>       /* bzero & bcopy.*/
+#endif
+
+#include <iprt/mem.h>
+#include <iprt/process.h>
+#include <iprt/param.h>
+#include <iprt/alloca.h>
+#include <iprt/assert.h>
+#include <iprt/mem.h>
+#include <iprt/string.h>
+#include <iprt/time.h>
+
+
+#undef gethrtime
+#define gethrtime()                RTTimeNanoTS()
+#undef strcasecmp
+#define strcasecmp(a_psz1, a_psz2) RTStrICmp(a_psz1, a_psz2)
+#undef strncasecmp
+#define strncasecmp(a_psz1, a_psz2, a_cch) RTStrNICmp(a_psz1, a_psz2, a_cch)
+#undef strlcpy
+#define strlcpy(a_pszDst, a_pszSrc, a_cbDst) ((void)RTStrCopy(a_pszDst, a_cbDst, a_pszSrc))
+
+#undef assert
+#define assert(expr)               Assert(expr)
+
+#undef PATH_MAX
+#define PATH_MAX                    RTPATH_MAX
+
+#undef getpid
+#define getpid                      RTProcSelf
+
+#undef basename
+#define basename(a_pszPath)         RTPathFilename(a_pszPath)
+
+#undef malloc
+#define malloc(a_cb)                RTMemAlloc(a_cb)
+#undef calloc
+#define calloc(a_cItems, a_cb)      RTMemAllocZ((size_t)(a_cb) * (a_cItems))
+#undef realloc
+#define realloc(a_pvOld, a_cbNew)   RTMemRealloc(a_pvOld, a_cbNew)
+#undef free
+#define free(a_pv)                  RTMemFree(a_pv)
+
+/* Not using RTStrDup and RTStrNDup here because the allocation won't be freed
+   by RTStrFree and thus may cause trouble when using the efence. */
+#undef strdup
+#define strdup(a_psz)               ((char *)RTMemDup(a_psz, strlen(a_psz) + 1))
+#undef strndup
+#define strndup(a_psz, a_cchMax)    ((char *)RTMemDupEx(a_psz, RTStrNLen(a_psz, a_cchMax), 1))
+
+/* For various stupid reasons, these are duplicated in VBoxDTraceTypes.h. */
+#undef bcopy
+#define bcopy(a_pSrc, a_pDst, a_cb) ((void)memmove(a_pDst, a_pSrc, a_cb))
+#undef bzero
+#define bzero(a_pDst, a_cb)         ((void)memset(a_pDst, 0, a_cb))
+#undef bcmp
+#define bcmp(a_p1, a_p2, a_cb)      (memcmp(a_p1, a_p2, a_cb))
+
+#endif
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h
new file mode 100644
index 0000000..3e8845a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h
@@ -0,0 +1,465 @@
+/* $Id: VBoxDTraceTypes.h $ */
+/** @file
+ * VBoxDTraceTypes.h - Fake a bunch of Solaris types.
+ *
+ * Contributed by: bird
+ */
+
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the Common
+ * Development and Distribution License Version 1.0 (CDDL) only, as it
+ * comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution.
+ * VirtualBox OSE is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY of any kind.
+ *
+ */
+
+#ifndef ___VBoxDTraceTypes_h___
+#define ___VBoxDTraceTypes_h___
+
+#include <iprt/types.h>
+#include <iprt/stdarg.h>
+#include <iprt/assert.h>
+#include <iprt/param.h>
+#include <iprt/errno.h>
+#ifdef IN_RING0
+# include <iprt/list.h>
+#endif
+#ifdef IN_RING3
+# include <sys/types.h>
+# include <limits.h>
+# ifdef RT_OS_LINUX
+#  include <sys/ucontext.h> /* avoid greg_t trouble */
+# endif
+# if defined(_MSC_VER)
+#  include <stdio.h>
+# endif
+#endif
+
+RT_C_DECLS_BEGIN
+
+struct modctl;
+
+typedef unsigned char               uchar_t;
+typedef unsigned short              ushort_t;
+typedef unsigned int                uint_t;
+typedef uintptr_t                   ulong_t;
+#ifndef RT_OS_SOLARIS
+typedef int64_t                     longlong_t;
+typedef uint64_t                    u_longlong_t;
+typedef uint64_t                    hrtime_t;
+typedef uint32_t                    id_t;
+typedef uint32_t                    zoneid_t;
+#endif
+#if !defined(NGREG) || !defined(RT_OS_LINUX)
+typedef RTCCINTREG                  greg_t;
+#else
+AssertCompileSize(greg_t, sizeof(RTCCINTREG));
+#endif
+typedef uintptr_t                   pc_t;
+typedef unsigned int                model_t;
+typedef RTCPUID                     processorid_t;
+#if defined(_MSC_VER) || defined(IN_RING0)
+typedef RTUID                       uid_t;
+typedef RTPROCESS                   pid_t;
+#endif
+#if defined(_MSC_VER) || defined(IN_RING0) || defined(RT_OS_LINUX)
+typedef char                       *caddr_t;
+#endif
+
+#if !defined(NANOSEC) || !defined(RT_OS_SOLARIS)
+# define NANOSEC                    RT_NS_1SEC
+#endif
+#if !defined(MICROSEC) || !defined(RT_OS_SOLARIS)
+# define MICROSEC                   RT_US_1SEC
+#endif
+#if !defined(MILLISEC) || !defined(RT_OS_SOLARIS)
+# define MILLISEC                   RT_MS_1SEC
+#endif
+#if !defined(SEC) || !defined(RT_OS_SOLARIS)
+# define SEC                        (1)
+#endif
+#define MAXPATHLEN                  RTPATH_MAX
+#undef PATH_MAX
+#define PATH_MAX                    RTPATH_MAX
+#undef NBBY
+#define NBBY                        (8)
+#define NCPU                        RTCPUSET_MAX_CPUS
+#define B_FALSE                     (0)
+#define B_TRUE                      (1)
+#define MIN(a1, a2)                 RT_MIN(a1, a2)
+#define MAX(a1, a2)                 RT_MAX(a1, a2)
+#define ABS(a_iValue)               RT_ABS(a_iValue)
+#define IS_P2ALIGNED(uWhat, uAlign) ( !((uWhat) & ((uAlign) - 1)) )
+#define P2ROUNDUP(uWhat, uAlign)    ( ((uWhat) + (uAlign) - 1) & ~(uAlign - 1) )
+#define roundup(uWhat, uUnit)       ( ( (uWhat) + ((uUnit) - 1)) / (uUnit) * (uUnit) )
+
+#if defined(RT_ARCH_X86)
+# ifndef __i386
+#  define __i386                    1
+# endif
+# ifndef __x86
+#  define __x86                     1
+# endif
+# ifndef _IPL32
+#  define _IPL32                    1
+# endif
+# if !defined(_LITTLE_ENDIAN) || !defined(RT_OS_SOLARIS)
+#  define _LITTLE_ENDIAN            1
+# endif
+
+#elif defined(RT_ARCH_AMD64)
+# ifndef __x86_64
+#  define __x86_64                  1
+# endif
+# ifndef __x86
+#  define __x86                     1
+# endif
+# ifndef _LP64
+#  define _LP64                     1
+# endif
+# if !defined(_LITTLE_ENDIAN) || !defined(RT_OS_SOLARIS)
+#  define _LITTLE_ENDIAN            1
+# endif
+
+#else
+# error "unsupported arch!"
+#endif
+
+/** Mark a cast added when porting the code to VBox.
+ * Avoids lots of \#ifdef VBOX otherwise needed to mark up the changes. */
+#define VBDTCAST(a_Type)        (a_Type)
+/** Mark a type change made when porting the code to VBox.
+ * This is usually signed -> unsigned type changes that avoids a whole lot of
+ * comparsion warnings. */
+#define VBDTTYPE(a_VBox, a_Org) a_VBox
+/** Mark missing void in a parameter list. */
+#define VBDTVOID                void
+/** Mark missing static in a function definition. */
+#define VBDTSTATIC              static
+#define VBDTUNASS(a_Value)      = a_Value
+#define VBDTGCC(a_Value)        = a_Value
+
+/*
+ * string
+ */
+#ifdef IN_RING0
+# undef bcopy
+# define bcopy(a_pSrc, a_pDst, a_cb) ((void)memmove(a_pDst, a_pSrc, a_cb))
+# undef bzero
+# define bzero(a_pDst, a_cb)        ((void)memset(a_pDst, 0, a_cb))
+# undef bcmp
+# define bcmp(a_p1, a_p2, a_cb)     (memcmp(a_p1, a_p2, a_cb))
+#endif
+#if defined(_MSC_VER) || defined(IN_RING0)
+# define snprintf                   RTStrPrintf
+# define vsnprintf                  RTStrPrintfV
+#endif
+
+/*
+ * Bitmap stuff.
+ */
+#define BT_SIZEOFMAP(a_cBits)       ( (a_cBits + 63) / 8 )
+#define BT_SET(a_aulBitmap, iBit)   ASMBitSet(a_aulBitmap, iBit)
+#define BT_CLEAR(a_aulBitmap, iBit) ASMBitClear(a_aulBitmap, iBit)
+#define BT_TEST(a_aulBitmap, iBit)  ASMBitTest(a_aulBitmap, iBit)
+#if ARCH_BITS == 32
+# define BT_NBIPUL                  32
+# define BT_ULSHIFT                 5 /* log2(32) = 5 */
+# define BT_ULMASK                  0x1f
+# define BT_BITOUL(a_cBits)         ( ((a_cBits) + 31) / 32 )
+#elif ARCH_BITS == 64
+# define BT_NBIPUL                  64
+# define BT_ULSHIFT                 6 /* log2(32) = 6 */
+# define BT_ULMASK                  0x3f
+# define BT_BITOUL(a_cBits)         ( ((a_cBits) + 63) / 64 )
+#else
+# error Bad ARCH_BITS...
+#endif
+
+
+#ifdef IN_RING0
+
+/*
+ * Kernel stuff...
+ */
+#define CPU_ON_INTR(a_pCpu)         (false)
+
+#define KERNELBASE                  VBoxDtGetKernelBase()
+uintptr_t VBoxDtGetKernelBase(void);
+
+
+typedef struct VBoxDtCred
+{
+    int32_t                 cr_refs;
+    RTUID                   cr_uid;
+    RTUID                   cr_ruid;
+    RTUID                   cr_suid;
+    RTGID                   cr_gid;
+    RTGID                   cr_rgid;
+    RTGID                   cr_sgid;
+    zoneid_t                cr_zone;
+} cred_t;
+#define PRIV_POLICY_ONLY(a_pCred, a_uPriv, a_fAll)  (true)
+#define priv_isequalset(a, b)                       (true)
+#define crgetuid(a_pCred)                           ((a_pCred)->cr_uid)
+#define crgetzoneid(a_pCred)                        ((a_pCred)->cr_zone)
+#define crhold                                      VBoxDtCredHold
+#define crfree                                      VBoxDtCredFree
+void VBoxDtCredHold(struct VBoxDtCred *pCred);
+void VBoxDtCredFree(struct VBoxDtCred *pCred);
+
+
+typedef struct RTTIMER  *cyclic_id_t;
+#define CYCLIC_NONE                                 ((struct RTTIMER *)NULL)
+#define cyclic_remove(a_hTimer)                     RTTimerDestroy(a_hTimer)
+
+typedef struct VBoxDtThread
+{
+    /** The next thread with the same hash table entry.
+     * Or the next free thread.  */
+    struct VBoxDtThread    *pNext;
+    /** Age list node. */
+    RTLISTNODE              AgeEntry;
+    /** The native thread handle. */
+    RTNATIVETHREAD          hNative;
+    /** The process ID. */
+    RTPROCESS               uPid;
+
+    uint32_t                t_predcache;
+    uintptr_t               t_dtrace_scrpc;
+    uintptr_t               t_dtrace_astpc;
+    hrtime_t                t_dtrace_vtime;
+    hrtime_t                t_dtrace_start;
+    uint8_t                 t_dtrace_stop;
+} kthread_t;
+struct VBoxDtThread *VBoxDtGetCurrentThread(void);
+#define curthread               (VBoxDtGetCurrentThread())
+
+
+typedef struct VBoxDtProcess    proc_t;
+# if 0 /* not needed ? */
+struct VBoxDtProcess    proc_t;
+{
+/*    uint32_t                p_flag; - don't bother with this */
+    RTPROCESS               p_pid;
+    struct dtrace_helpers  *p_dtrace_helpers;
+}
+proc_t *VBoxDtGetCurrentProc(void);
+# define curproc                 (VBoxDtGetCurrentProc())
+/*# define SNOCD                  RT_BIT(0) - don't bother with this */
+# endif
+
+typedef struct VBoxDtTaskQueue  taskq_t;
+
+typedef struct VBoxDtMutex
+{
+    RTSEMMUTEX              hMtx;
+    RTNATIVETHREAD volatile hOwner;
+} kmutex_t;
+#define mutex_enter             VBoxDtMutexEnter
+#define mutex_exit              VBoxDtMutexExit
+#define MUTEX_HELD(a_pMtx)      VBoxDtMutexIsOwner(a_pMtx)
+#define MUTEX_NOT_HELD(a_pMtx)  (!VBoxDtMutexIsOwner(a_pMtx))
+#define mod_lock                g_DummyMtx
+#define cpu_lock                g_DummyMtx
+int  VBoxDtMutexInit(struct VBoxDtMutex *pMtx);
+void VBoxDtMutexDelete(struct VBoxDtMutex *pMtx);
+void VBoxDtMutexEnter(struct VBoxDtMutex *pMtx);
+void VBoxDtMutexExit(struct VBoxDtMutex *pMtx);
+bool VBoxDtMutexIsOwner(struct VBoxDtMutex *pMtx);
+extern struct VBoxDtMutex       g_DummyMtx;
+
+
+typedef struct VBoxDtCpuCore
+{
+    RTCPUID             cpu_id;
+    uintptr_t           cpuc_dtrace_illval;
+    uint16_t volatile   cpuc_dtrace_flags;
+
+} cpucore_t;
+
+#define CPU_DTRACE_BADADDR      RT_BIT(0)
+#define CPU_DTRACE_BADALIGN     RT_BIT(1)
+#define CPU_DTRACE_BADSTACK     RT_BIT(2)
+#define CPU_DTRACE_KPRIV        RT_BIT(3)
+#define CPU_DTRACE_DIVZERO      RT_BIT(4)
+#define CPU_DTRACE_ILLOP        RT_BIT(5)
+#define CPU_DTRACE_NOSCRATCH    RT_BIT(6)
+#define CPU_DTRACE_UPRIV        RT_BIT(7)
+#define CPU_DTRACE_TUPOFLOW     RT_BIT(8)
+#define CPU_DTRACE_ENTRY        RT_BIT(9)
+#define CPU_DTRACE_FAULT        UINT16_C(0x03ff)
+#define CPU_DTRACE_DROP         RT_BIT(12)
+#define CPU_DTRACE_ERROR        UINT16_C(0x13ff)
+#define CPU_DTRACE_NOFAULT      RT_BIT(15)
+
+extern cpucore_t                g_aVBoxDtCpuCores[RTCPUSET_MAX_CPUS];
+#define cpu_core                (g_aVBoxDtCpuCores)
+
+struct VBoxDtCred *VBoxDtGetCurrentCreds(void);
+#define CRED()                  VBoxDtGetCurrentCreds()
+
+proc_t *VBoxDtThreadToProc(kthread_t *);
+
+
+#define ASSERT(a_Expr)          Assert(a_Expr)
+#define panic                   VBoxDtPanic
+void VBoxDtPanic(const char *pszFormat, ...);
+#define cmn_err                 VBoxDtCmnErr
+void VBoxDtCmnErr(int iLevel, const char *pszFormat, ...);
+#define CE_WARN                 10
+#define CE_NOTE                 11
+#define uprintf                 VBoxDtUPrintf
+#define vuprintf                VBoxDtUPrintfV
+void VBoxDtUPrintf(const char *pszFormat, ...);
+void VBoxDtUPrintfV(const char *pszFormat, va_list va);
+
+/*
+ * Memory allocation wrappers.
+ */
+#define KM_SLEEP                RT_BIT(0)
+#define KM_NOSLEEP              RT_BIT(1)
+#define kmem_alloc              VBoxDtKMemAlloc
+#define kmem_zalloc             VBoxDtKMemAllocZ
+#define kmem_free               VBoxDtKMemFree
+void *VBoxDtKMemAlloc(size_t cbMem, uint32_t fFlags);
+void *VBoxDtKMemAllocZ(size_t cbMem, uint32_t fFlags);
+void  VBoxDtKMemFree(void *pvMem, size_t cbMem);
+
+
+typedef struct VBoxDtMemCache   kmem_cache_t;
+#define kmem_cache_create       VBoxDtKMemCacheCreate
+#define kmem_cache_destroy      VBoxDtKMemCacheDestroy
+#define kmem_cache_alloc        VBoxDtKMemCacheAlloc
+#define kmem_cache_free         VBoxDtKMemCacheFree
+struct VBoxDtMemCache *VBoxDtKMemCacheCreate(const char *pszName, size_t cbBuf, size_t cbAlign,
+                                             PFNRT pfnCtor, PFNRT pfnDtor, PFNRT pfnReclaim,
+                                             void *pvUser, void *pvVM, uint32_t fFlags);
+void  VBoxDtKMemCacheDestroy(struct VBoxDtMemCache *pCache);
+void *VBoxDtKMemCacheAlloc(struct VBoxDtMemCache *pCache, uint32_t fFlags);
+void  VBoxDtKMemCacheFree(struct VBoxDtMemCache *pCache, void *pvMem);
+
+
+typedef struct VBoxDtVMem       vmem_t;
+#define VM_SLEEP                RT_BIT(0)
+#define VM_BESTFIT              RT_BIT(1)
+#define VMC_IDENTIFIER          RT_BIT(16)
+#define vmem_create             VBoxDtVMemCreate
+#define vmem_destroy            VBoxDtVMemDestroy
+#define vmem_alloc              VBoxDtVMemAlloc
+#define vmem_free               VBoxDtVMemFree
+struct VBoxDtVMem *VBoxDtVMemCreate(const char *pszName, void *pvBase, size_t cb, size_t cbUnit,
+                                    PFNRT pfnAlloc, PFNRT pfnFree, struct VBoxDtVMem *pSrc,
+                                    size_t cbQCacheMax, uint32_t fFlags);
+void  VBoxDtVMemDestroy(struct VBoxDtVMem *pVMemArena);
+void *VBoxDtVMemAlloc(struct VBoxDtVMem *pVMemArena, size_t cbMem, uint32_t fFlags);
+void  VBoxDtVMemFree(struct VBoxDtVMem *pVMemArena, void *pvMem, size_t cbMem);
+
+/*
+ * Copy In/Out
+ */
+#define copyin                      VBoxDtCopyIn
+#define copyout                     VBoxDtCopyOut
+int  VBoxDtCopyIn(void const *pvUser, void *pvDst, size_t cb);
+int  VBoxDtCopyOut(void const *pvSrc, void *pvUser, size_t cb);
+
+/*
+ * Device numbers.
+ */
+typedef uint64_t                    dev_t;
+typedef uint32_t                    major_t;
+typedef uint32_t                    minor_t;
+#define makedevice(a_Maj, a_Min)    RT_MAKE_U64(a_Min, a_Maj)
+#define getemajor(a_Dev)            RT_HIDWORD(a_Dev)
+#define geteminor(a_Dev)            RT_LODWORD(a_Dev)
+#define getminor(a_Dev)             RT_LODWORD(a_Dev)
+
+/*
+ * DDI
+ */
+# define DDI_SUCCESS                (0)
+# define DDI_FAILURE                (-1)
+# if 0 /* not needed */
+# define ddi_soft_state_init        VBoxDtDdiSoftStateInit
+# define ddi_soft_state_fini        VBoxDtDdiSoftStateTerm
+# define ddi_soft_state_zalloc      VBoxDtDdiSoftStateAllocZ
+# define ddi_get_soft_state         VBoxDtDdiSoftStateGet
+# define ddi_soft_state_free        VBoxDtDdiSoftStateFree
+int   VBoxDtDdiSoftStateInit(void **ppvSoftStates, size_t cbSoftState, uint32_t cMaxItems);
+int   VBoxDtDdiSoftStateTerm(void **ppvSoftStates);
+int   VBoxDtDdiSoftStateAllocZ(void *pvSoftStates, RTDEV uMinor);
+int   VBoxDtDdiSoftStateFree(void *pvSoftStates, RTDEV uMinor);
+void *VBoxDtDdiSoftStateGet(void *pvSoftStates, RTDEV uMinor);
+
+typedef enum { DDI_ATT_CMD_DUMMY }  ddi_attach_cmd_t;
+typedef enum { DDI_DETACH, DDI_SUSPEND }  ddi_detach_cmd_t;
+typedef struct VBoxDtDevInfo        dev_info_t;
+# define ddi_driver_major           VBoxDtDdiDriverMajor
+# define ddi_report_dev             VBoxDtDdiReportDev
+major_t VBoxDtDdiDriverMajor(struct VBoxDtDevInfo *pDevInfo);
+void    VBoxDtDdiReportDev(struct VBoxDtDevInfo *pDevInfo);
+# endif
+
+/*
+ * DTrace bits we've made external.
+ */
+extern int dtrace_attach(void);
+extern int dtrace_detach(void);
+struct dtrace_state;
+extern int dtrace_open(struct dtrace_state **ppState, struct VBoxDtCred *cred_p);
+extern int dtrace_ioctl(struct dtrace_state *state, int cmd, intptr_t arg, int32_t *rv);
+extern int dtrace_close(struct dtrace_state *state);
+
+#endif /* IN_RING0 */
+
+
+#ifdef IN_RING3
+/*
+ * Make life a little easier in ring-3.
+ */
+
+/* Replacement for strndup(), requires editing the code unfortunately. */
+# define MY_STRDUPA(a_pszRes, a_pszSrc) \
+    do { \
+        size_t cb = strlen(a_pszSrc) + 1; \
+        (a_pszRes) = (char *)alloca(cb); \
+        memcpy(a_pszRes, a_pszSrc, cb); \
+    } while (0)
+
+/*
+ * gelf
+ */
+# include "../../../Runtime/include/internal/ldrELF64.h"
+typedef Elf64_Half  GElf_Half;
+typedef Elf64_Xword GElf_Xword;
+typedef Elf64_Shdr  GElf_Shdr;
+typedef Elf64_Ehdr  GElf_Ehdr;
+typedef Elf64_Sym   GElf_Sym;
+typedef Elf64_Addr  GElf_Addr;
+#define GELF_ST_INFO ELF64_ST_INFO
+#define GELF_ST_TYPE ELF64_ST_TYPE
+#define GELF_ST_BIND ELF64_ST_BIND
+
+/*
+ * MSC stuff.
+ */
+# ifdef _MSC_VER
+#  ifndef SIZE_MAX
+#   if ARCH_BITS == 32
+#    define SIZE_MAX UINT32_MAX
+#   else
+#    define SIZE_MAX UINT64_MAX
+#   endif
+#  endif
+# endif /* _MSC_VER */
+
+#endif /* IN_RING3 */
+
+RT_C_DECLS_END
+#endif
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/COPYING b/src/VBox/ExtPacks/VBoxDTrace/onnv/COPYING
new file mode 100644
index 0000000..eaceed4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/COPYING
@@ -0,0 +1,378 @@
+The ExtPacks/VBoxDTrace/onnv sources are licensed under the Common Development
+and Distribution License, Version 1.0 (CDDL), as shown below.
+
+---
+
+
+COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0
+
+1. Definitions.
+
+    1.1. "Contributor" means each individual or entity that creates
+         or contributes to the creation of Modifications.
+
+    1.2. "Contributor Version" means the combination of the Original
+         Software, prior Modifications used by a Contributor (if any),
+         and the Modifications made by that particular Contributor.
+
+    1.3. "Covered Software" means (a) the Original Software, or (b)
+         Modifications, or (c) the combination of files containing
+         Original Software with files containing Modifications, in
+         each case including portions thereof.
+
+    1.4. "Executable" means the Covered Software in any form other
+         than Source Code.
+
+    1.5. "Initial Developer" means the individual or entity that first
+         makes Original Software available under this License.
+
+    1.6. "Larger Work" means a work which combines Covered Software or
+         portions thereof with code not governed by the terms of this
+         License.
+
+    1.7. "License" means this document.
+
+    1.8. "Licensable" means having the right to grant, to the maximum
+         extent possible, whether at the time of the initial grant or
+         subsequently acquired, any and all of the rights conveyed
+         herein.
+
+    1.9. "Modifications" means the Source Code and Executable form of
+         any of the following:
+
+        A. Any file that results from an addition to, deletion from or
+           modification of the contents of a file containing Original
+           Software or previous Modifications;
+
+        B. Any new file that contains any part of the Original
+           Software or previous Modifications; or
+
+        C. Any new file that is contributed or otherwise made
+           available under the terms of this License.
+
+    1.10. "Original Software" means the Source Code and Executable
+          form of computer software code that is originally released
+          under this License.
+
+    1.11. "Patent Claims" means any patent claim(s), now owned or
+          hereafter acquired, including without limitation, method,
+          process, and apparatus claims, in any patent Licensable by
+          grantor.
+
+    1.12. "Source Code" means (a) the common form of computer software
+          code in which modifications are made and (b) associated
+          documentation included in or with such code.
+
+    1.13. "You" (or "Your") means an individual or a legal entity
+          exercising rights under, and complying with all of the terms
+          of, this License.  For legal entities, "You" includes any
+          entity which controls, is controlled by, or is under common
+          control with You.  For purposes of this definition,
+          "control" means (a) the power, direct or indirect, to cause
+          the direction or management of such entity, whether by
+          contract or otherwise, or (b) ownership of more than fifty
+          percent (50%) of the outstanding shares or beneficial
+          ownership of such entity.
+
+2. License Grants.
+
+    2.1. The Initial Developer Grant.
+
+    Conditioned upon Your compliance with Section 3.1 below and
+    subject to third party intellectual property claims, the Initial
+    Developer hereby grants You a world-wide, royalty-free,
+    non-exclusive license:
+
+        (a) under intellectual property rights (other than patent or
+            trademark) Licensable by Initial Developer, to use,
+            reproduce, modify, display, perform, sublicense and
+            distribute the Original Software (or portions thereof),
+            with or without Modifications, and/or as part of a Larger
+            Work; and
+
+        (b) under Patent Claims infringed by the making, using or
+            selling of Original Software, to make, have made, use,
+            practice, sell, and offer for sale, and/or otherwise
+            dispose of the Original Software (or portions thereof).
+
+        (c) The licenses granted in Sections 2.1(a) and (b) are
+            effective on the date Initial Developer first distributes
+            or otherwise makes the Original Software available to a
+            third party under the terms of this License.
+
+        (d) Notwithstanding Section 2.1(b) above, no patent license is
+            granted: (1) for code that You delete from the Original
+            Software, or (2) for infringements caused by: (i) the
+            modification of the Original Software, or (ii) the
+            combination of the Original Software with other software
+            or devices.
+
+    2.2. Contributor Grant.
+
+    Conditioned upon Your compliance with Section 3.1 below and
+    subject to third party intellectual property claims, each
+    Contributor hereby grants You a world-wide, royalty-free,
+    non-exclusive license:
+
+        (a) under intellectual property rights (other than patent or
+            trademark) Licensable by Contributor to use, reproduce,
+            modify, display, perform, sublicense and distribute the
+            Modifications created by such Contributor (or portions
+            thereof), either on an unmodified basis, with other
+            Modifications, as Covered Software and/or as part of a
+            Larger Work; and
+
+        (b) under Patent Claims infringed by the making, using, or
+            selling of Modifications made by that Contributor either
+            alone and/or in combination with its Contributor Version
+            (or portions of such combination), to make, use, sell,
+            offer for sale, have made, and/or otherwise dispose of:
+            (1) Modifications made by that Contributor (or portions
+            thereof); and (2) the combination of Modifications made by
+            that Contributor with its Contributor Version (or portions
+            of such combination).
+
+        (c) The licenses granted in Sections 2.2(a) and 2.2(b) are
+            effective on the date Contributor first distributes or
+            otherwise makes the Modifications available to a third
+            party.
+
+        (d) Notwithstanding Section 2.2(b) above, no patent license is
+            granted: (1) for any code that Contributor has deleted
+            from the Contributor Version; (2) for infringements caused
+            by: (i) third party modifications of Contributor Version,
+            or (ii) the combination of Modifications made by that
+            Contributor with other software (except as part of the
+            Contributor Version) or other devices; or (3) under Patent
+            Claims infringed by Covered Software in the absence of
+            Modifications made by that Contributor.
+
+3. Distribution Obligations.
+
+    3.1. Availability of Source Code.
+
+    Any Covered Software that You distribute or otherwise make
+    available in Executable form must also be made available in Source
+    Code form and that Source Code form must be distributed only under
+    the terms of this License.  You must include a copy of this
+    License with every copy of the Source Code form of the Covered
+    Software You distribute or otherwise make available.  You must
+    inform recipients of any such Covered Software in Executable form
+    as to how they can obtain such Covered Software in Source Code
+    form in a reasonable manner on or through a medium customarily
+    used for software exchange.
+
+    3.2. Modifications.
+
+    The Modifications that You create or to which You contribute are
+    governed by the terms of this License.  You represent that You
+    believe Your Modifications are Your original creation(s) and/or
+    You have sufficient rights to grant the rights conveyed by this
+    License.
+
+    3.3. Required Notices.
+
+    You must include a notice in each of Your Modifications that
+    identifies You as the Contributor of the Modification.  You may
+    not remove or alter any copyright, patent or trademark notices
+    contained within the Covered Software, or any notices of licensing
+    or any descriptive text giving attribution to any Contributor or
+    the Initial Developer.
+
+    3.4. Application of Additional Terms.
+
+    You may not offer or impose any terms on any Covered Software in
+    Source Code form that alters or restricts the applicable version
+    of this License or the recipients' rights hereunder.  You may
+    choose to offer, and to charge a fee for, warranty, support,
+    indemnity or liability obligations to one or more recipients of
+    Covered Software.  However, you may do so only on Your own behalf,
+    and not on behalf of the Initial Developer or any Contributor.
+    You must make it absolutely clear that any such warranty, support,
+    indemnity or liability obligation is offered by You alone, and You
+    hereby agree to indemnify the Initial Developer and every
+    Contributor for any liability incurred by the Initial Developer or
+    such Contributor as a result of warranty, support, indemnity or
+    liability terms You offer.
+
+    3.5. Distribution of Executable Versions.
+
+    You may distribute the Executable form of the Covered Software
+    under the terms of this License or under the terms of a license of
+    Your choice, which may contain terms different from this License,
+    provided that You are in compliance with the terms of this License
+    and that the license for the Executable form does not attempt to
+    limit or alter the recipient's rights in the Source Code form from
+    the rights set forth in this License.  If You distribute the
+    Covered Software in Executable form under a different license, You
+    must make it absolutely clear that any terms which differ from
+    this License are offered by You alone, not by the Initial
+    Developer or Contributor.  You hereby agree to indemnify the
+    Initial Developer and every Contributor for any liability incurred
+    by the Initial Developer or such Contributor as a result of any
+    such terms You offer.
+
+    3.6. Larger Works.
+
+    You may create a Larger Work by combining Covered Software with
+    other code not governed by the terms of this License and
+    distribute the Larger Work as a single product.  In such a case,
+    You must make sure the requirements of this License are fulfilled
+    for the Covered Software.
+
+4. Versions of the License.
+
+    4.1. New Versions.
+
+    Sun Microsystems, Inc. is the initial license steward and may
+    publish revised and/or new versions of this License from time to
+    time.  Each version will be given a distinguishing version number.
+    Except as provided in Section 4.3, no one other than the license
+    steward has the right to modify this License.
+
+    4.2. Effect of New Versions.
+
+    You may always continue to use, distribute or otherwise make the
+    Covered Software available under the terms of the version of the
+    License under which You originally received the Covered Software.
+    If the Initial Developer includes a notice in the Original
+    Software prohibiting it from being distributed or otherwise made
+    available under any subsequent version of the License, You must
+    distribute and make the Covered Software available under the terms
+    of the version of the License under which You originally received
+    the Covered Software.  Otherwise, You may also choose to use,
+    distribute or otherwise make the Covered Software available under
+    the terms of any subsequent version of the License published by
+    the license steward.
+
+    4.3. Modified Versions.
+
+    When You are an Initial Developer and You want to create a new
+    license for Your Original Software, You may create and use a
+    modified version of this License if You: (a) rename the license
+    and remove any references to the name of the license steward
+    (except to note that the license differs from this License); and
+    (b) otherwise make it clear that the license contains terms which
+    differ from this License.
+
+5. DISCLAIMER OF WARRANTY.
+
+    COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
+    BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+    INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
+    SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
+    PURPOSE OR NON-INFRINGING.  THE ENTIRE RISK AS TO THE QUALITY AND
+    PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU.  SHOULD ANY
+    COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
+    INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY
+    NECESSARY SERVICING, REPAIR OR CORRECTION.  THIS DISCLAIMER OF
+    WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.  NO USE OF
+    ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
+    DISCLAIMER.
+
+6. TERMINATION.
+
+    6.1. This License and the rights granted hereunder will terminate
+    automatically if You fail to comply with terms herein and fail to
+    cure such breach within 30 days of becoming aware of the breach.
+    Provisions which, by their nature, must remain in effect beyond
+    the termination of this License shall survive.
+
+    6.2. If You assert a patent infringement claim (excluding
+    declaratory judgment actions) against Initial Developer or a
+    Contributor (the Initial Developer or Contributor against whom You
+    assert such claim is referred to as "Participant") alleging that
+    the Participant Software (meaning the Contributor Version where
+    the Participant is a Contributor or the Original Software where
+    the Participant is the Initial Developer) directly or indirectly
+    infringes any patent, then any and all rights granted directly or
+    indirectly to You by such Participant, the Initial Developer (if
+    the Initial Developer is not the Participant) and all Contributors
+    under Sections 2.1 and/or 2.2 of this License shall, upon 60 days
+    notice from Participant terminate prospectively and automatically
+    at the expiration of such 60 day notice period, unless if within
+    such 60 day period You withdraw Your claim with respect to the
+    Participant Software against such Participant either unilaterally
+    or pursuant to a written agreement with Participant.
+
+    6.3. In the event of termination under Sections 6.1 or 6.2 above,
+    all end user licenses that have been validly granted by You or any
+    distributor hereunder prior to termination (excluding licenses
+    granted to You by any distributor) shall survive termination.
+
+7. LIMITATION OF LIABILITY.
+
+    UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+    (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
+    INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
+    COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
+    LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
+    CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
+    LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
+    STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+    COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+    INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.  THIS LIMITATION OF
+    LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
+    INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
+    APPLICABLE LAW PROHIBITS SUCH LIMITATION.  SOME JURISDICTIONS DO
+    NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
+    CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
+    APPLY TO YOU.
+
+8. U.S. GOVERNMENT END USERS.
+
+    The Covered Software is a "commercial item," as that term is
+    defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
+    computer software" (as that term is defined at 48
+    C.F.R. 252.227-7014(a)(1)) and "commercial computer software
+    documentation" as such terms are used in 48 C.F.R. 12.212
+    (Sept. 1995).  Consistent with 48 C.F.R. 12.212 and 48
+    C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all
+    U.S. Government End Users acquire Covered Software with only those
+    rights set forth herein.  This U.S. Government Rights clause is in
+    lieu of, and supersedes, any other FAR, DFAR, or other clause or
+    provision that addresses Government rights in computer software
+    under this License.
+
+9. MISCELLANEOUS.
+
+    This License represents the complete agreement concerning subject
+    matter hereof.  If any provision of this License is held to be
+    unenforceable, such provision shall be reformed only to the extent
+    necessary to make it enforceable.  This License shall be governed
+    by the law of the jurisdiction specified in a notice contained
+    within the Original Software (except to the extent applicable law,
+    if any, provides otherwise), excluding such jurisdiction's
+    conflict-of-law provisions.  Any litigation relating to this
+    License shall be subject to the jurisdiction of the courts located
+    in the jurisdiction and venue specified in a notice contained
+    within the Original Software, with the losing party responsible
+    for costs, including, without limitation, court costs and
+    reasonable attorneys' fees and expenses.  The application of the
+    United Nations Convention on Contracts for the International Sale
+    of Goods is expressly excluded.  Any law or regulation which
+    provides that the language of a contract shall be construed
+    against the drafter shall not apply to this License.  You agree
+    that You alone are responsible for compliance with the United
+    States export administration regulations (and the export control
+    laws and regulation of any other countries) when You use,
+    distribute or otherwise make available any Covered Software.
+
+10. RESPONSIBILITY FOR CLAIMS.
+
+    As between Initial Developer and the Contributors, each party is
+    responsible for claims and damages arising, directly or
+    indirectly, out of its utilization of rights under this License
+    and You agree to work with Initial Developer and Contributors to
+    distribute such responsibility on an equitable basis.  Nothing
+    herein is intended or shall be deemed to constitute any admission
+    of liability.
+
+--------------------------------------------------------------------
+
+NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND
+DISTRIBUTION LICENSE (CDDL)
+
+For Covered Software in this distribution, this License shall be
+governed by the laws of Germany. Legal venue shall be Stuttgart,
+Germany.
diff --git a/include/VBox/vd-cache-plugin.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/Makefile.kup
similarity index 100%
copy from include/VBox/vd-cache-plugin.h
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile
new file mode 100644
index 0000000..ebb091d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile
@@ -0,0 +1,57 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+PROG= dtrace
+
+include ../Makefile.cmd
+
+SUBDIRS=	$(MACH) demo test
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all	:=	TARGET = all
+install	:=	TARGET = install
+clean	:=	TARGET = clean
+clobber	:=	TARGET = clobber
+lint	:=	TARGET = lint
+
+.KEEP_STATE:
+
+all:	$(SUBDIRS)
+
+clean clobber lint:	$(SUBDIRS)
+
+install:	$(SUBDIRS)
+	-$(RM) $(ROOTUSRSBINPROG)
+	-$(LN) $(ISAEXEC) $(ROOTUSRSBINPROG)
+
+$(SUBDIRS):	FRC
+	@cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile.com b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile.com
new file mode 100644
index 0000000..2f69e31
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile.com
@@ -0,0 +1,57 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+PROG = dtrace
+OBJS = dtrace.o
+SRCS = $(OBJS:%.o=../%.c)
+
+include ../../Makefile.cmd
+
+CFLAGS += $(CCVERBOSE)
+CFLAGS64 += $(CCVERBOSE)
+LDLIBS += -ldtrace -lproc -lctf -lelf
+
+FILEMODE = 0555
+
+CLEANFILES += $(OBJS)
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+$(PROG): $(OBJS)
+	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+clean:
+	-$(RM) $(CLEANFILES)
+
+lint: lint_SRCS
+
+%.o: ../%.c
+	$(COMPILE.c) $<
+
+include ../../Makefile.targ
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/amd64/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/amd64/Makefile
new file mode 100644
index 0000000..a34a1e5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/amd64/Makefile
@@ -0,0 +1,32 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.com
+include ../../Makefile.cmd.64
+
+install: all $(ROOTUSRSBINPROG64)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/amd64/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/amd64/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile
new file mode 100644
index 0000000..7da281e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile
@@ -0,0 +1,167 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+include ../../Makefile.cmd
+
+i386_DFILES = \
+	iprb.d
+
+DFILES = \
+	applicat.d \
+	badopen.d \
+	begin.d \
+	callout.d \
+	clause.d \
+	clear.d \
+	countdown.d \
+	counter.d \
+	dateprof.d \
+	delay.d \
+	denorm.d \
+	end.d \
+	error.d \
+	errorpath.d \
+	find.d \
+	firebird.d \
+	hello.d \
+	howlong.d \
+	interp.d \
+	interval.d \
+	intr.d \
+	iocpu.d \
+	iosnoop.d \
+	iothrough.d \
+	iotime.d \
+	ipio.d \
+	ipproto.d \
+	tcprst.d \
+	kstat.d \
+	ksyms.d \
+	libc.d \
+	lquantize.d \
+	lwptime.d \
+	normalize.d \
+	nscd.d \
+	pri.d \
+	printa.d \
+	pritime.d \
+	prof.d \
+	profpri.d \
+	progtime.d \
+	putnext.d \
+	qlen.d \
+	qtime.d \
+	renormalize.d \
+	restest.d \
+	ring.d \
+	rtime.d \
+	rwinfo.d \
+	rwtime.d \
+	sig.d \
+	soffice.d \
+	spec.d \
+	specopen.d \
+	ssd.d \
+	syscall.d \
+	tcp1stbyte.d \
+	tcpbytes.d \
+	tcpbytesstat.d \
+	tcpconnlat.d \
+	tcpio.d \
+	tcpioflags.d \
+	tcpsnoop.d \
+	tcpstate.d \
+	tcptop.d \
+	tick.d \
+	ticktime.d \
+	time.d \
+	tracewrite.d \
+	trunc.d \
+	trussrw.d \
+	udpbytes.d \
+	udpbytesstat.d \
+	udpio.d \
+	udpsnoop.d \
+	udptop.d \
+	userfunc.d \
+	whatfor.d \
+	whatlock.d \
+	where.d \
+	whererun.d \
+	whoexec.d \
+	whofor.d \
+	whoio.d \
+	whopreempt.d \
+	whoqueue.d \
+	whosteal.d \
+	whowrite.d \
+	writes.d \
+	writesbycmd.d \
+	writesbycmdfd.d \
+	writetime.d \
+	writetimeq.d \
+	xioctl.d \
+	xterm.d \
+	xwork.d \
+	$($(MACH)_DFILES)
+
+HTMLFILES = index.html
+
+DEMOFILES = \
+	$(DFILES) \
+	$(HTMLFILES) \
+	sunlogo.gif
+
+MKDEMO	= mkdemo
+CLEANFILES += $(DFILES) $(MKDEMO)
+
+ROOTDEMODIR = $(ROOT)/usr/demo/dtrace
+ROOTDEMOFILES = $(DEMOFILES:%=$(ROOTDEMODIR)/%)
+
+all:	$(DEMOFILES)
+
+clobber clean:
+	-$(RM) $(CLEANFILES)
+
+clean.lint install_h lint:
+
+install: $(ROOTDEMOFILES)
+
+$(ROOTDEMODIR):
+	$(INS.dir)
+
+$(ROOTDEMODIR)/%: %
+	$(INS.file)
+
+$(HTMLFILES):	$(DFILES) $(MKDEMO)	
+	./$(MKDEMO) $@
+
+$(DFILES):	$(MKDEMO)	
+	./$(MKDEMO) $@
+
+$(ROOTDEMOFILES): $(ROOTDEMODIR)
+
+$(ROOTDEMODIR) := DIRMODE = 755
+
+$(ROOTDEMOFILES) := FILEMODE = 644
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/time.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/time.d
new file mode 100644
index 0000000..b7afd4c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/act/time.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option switchrate=5sec
+
+tick-1sec
+/n++ < 5/
+{
+	printf("walltime  : %Y\n", walltimestamp);
+	printf("date      : ");
+	system("date");
+	printf("\n");
+}
+
+tick-1sec
+/n == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/clear.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/clear.d
new file mode 100644
index 0000000..4b90a09
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/clear.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	last = timestamp;
+}
+
+syscall:::entry
+{
+	@func[execname] = count();
+}
+
+tick-10sec
+{
+	normalize(@func, (timestamp - last) / 1000000000);
+	printa(@func);
+	clear(@func);
+	last = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/dateprof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/dateprof.d
new file mode 100644
index 0000000..19a63c5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/dateprof.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::exec:return,
+syscall::exece:return
+/execname == "date"/
+{
+	self->start = vtimestamp;
+}
+
+syscall:::entry
+/self->start/
+{
+	/*
+	 * We linearly quantize on the current virtual time minus our
+	 * process's start time.  We divide by 1000 to yield microseconds
+	 * rather than nanoseconds.  The range runs from 0 to 10 milliseconds
+	 * in steps of 100 microseconds; we expect that no date(1) process
+	 * will take longer than 10 milliseconds to complete.
+	 */
+	@["system calls over time"] =
+	    lquantize((vtimestamp - self->start) / 1000, 0, 10000, 100);
+}
+
+syscall::rexit:entry
+/self->start/
+{
+	self->start = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/denorm.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/denorm.d
new file mode 100644
index 0000000..6e58596
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/denorm.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	start = timestamp;
+}
+
+syscall:::entry
+{
+	@func[execname] = count();
+}
+
+END
+{
+	this->seconds = (timestamp - start) / 1000000000;
+	printf("Ran for %d seconds.\n", this->seconds);
+
+	printf("Per-second rate:\n");
+	normalize(@func, this->seconds);
+	printa(@func);
+
+	printf("\nRaw counts:\n");
+	denormalize(@func);
+	printa(@func);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/lquantize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/lquantize.d
new file mode 100644
index 0000000..833c73a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/lquantize.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+	@fds[execname] = lquantize(arg0, 0, 100, 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/normalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/normalize.d
new file mode 100644
index 0000000..cce1202
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/normalize.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	/*
+	 * Get the start time, in nanoseconds.
+	 */
+	start = timestamp;
+}
+
+syscall:::entry
+{
+	@func[execname] = count();
+}
+
+END
+{
+	/*
+	 * Normalize the aggregation based on the number of seconds we have
+	 * been running.  (There are 1,000,000,000 nanoseconds in one second.)
+	 */	
+	normalize(@func, (timestamp - start) / 1000000000);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/renormalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/renormalize.d
new file mode 100644
index 0000000..a6a1510
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/renormalize.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	start = timestamp;
+}
+
+syscall:::entry
+{
+	@func[execname] = count();
+}
+
+tick-10sec
+{
+	normalize(@func, (timestamp - start) / 1000000000);
+	printa(@func);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/trunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/trunc.d
new file mode 100644
index 0000000..76965f8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/trunc.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	last = timestamp;
+}
+
+syscall:::entry
+{
+	@func[execname] = count();
+}
+
+tick-10sec
+{
+	trunc(@func, 10);
+	normalize(@func, (timestamp - last) / 1000000000);
+	printa(@func);
+	clear(@func);
+	last = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writes.d
new file mode 100644
index 0000000..9de6154
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writes.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+	@counts["write system calls"] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmd.d
new file mode 100644
index 0000000..bcbefae
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmd.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+	@counts[execname] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmdfd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmdfd.d
new file mode 100644
index 0000000..8b92cb8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writesbycmdfd.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+	@counts[execname, arg0] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetime.d
new file mode 100644
index 0000000..b770f5b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetime.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+	self->ts = timestamp;
+}
+
+syscall::write:return
+/self->ts/
+{
+	@time[execname] = avg(timestamp - self->ts);
+	self->ts = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetimeq.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetimeq.d
new file mode 100644
index 0000000..9b49409
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/agg/writetimeq.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::write:entry
+{
+	self->ts = timestamp;
+}
+
+syscall::write:return
+/self->ts/
+{
+	@time[execname] = quantize(timestamp - self->ts);
+	self->ts = 0;
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/iprb.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/iprb.d
new file mode 100644
index 0000000..f73f6a7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/anon/iprb.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+fbt::iprbattach:entry
+{
+	self->trace = 1;
+}
+
+fbt:::
+/self->trace/
+{}
+
+fbt::iprbattach:return
+{
+	self->trace = 0;
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/ring.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/ring.d
new file mode 100644
index 0000000..116bbd4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/buf/ring.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option bufpolicy=ring
+#pragma D option bufsize=16k
+
+syscall:::entry
+/execname == $1/
+{
+	trace(timestamp);
+}
+
+syscall::rexit:entry
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/chapters b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/chapters
new file mode 100644
index 0000000..2160a0c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/chapters
@@ -0,0 +1,125 @@
+name: book
+title: Solaris Dynamic Tracing Guide
+index: 0
+url: http://wikis.sun.com/display/DTrace/Documentation
+
+name: act
+title: Actions and Subroutines
+index: 10
+url: http://wikis.sun.com/display/DTrace/Actions+and+Subroutines
+
+name: agg
+title: Aggregations
+index: 9
+url: http://wikis.sun.com/display/DTrace/Aggregations
+
+name: anon
+title: Anonymous Tracing
+index: 34
+url: http://wikis.sun.com/display/DTrace/Anonymous+Tracing
+
+name: buf
+title: Buffers and Buffering
+index: 11
+url: http://wikis.sun.com/display/DTrace/Buffers+and+Buffering
+
+name: dtrace
+title: dtrace Provider
+index: 17
+url: http://wikis.sun.com/display/DTrace/dtrace+Provider
+
+name: fbt
+title: fbt Provider
+index: 20
+url: http://wikis.sun.com/display/DTrace/fbt+Provider
+
+name: intro
+title: Introduction
+index: 1
+url: http://wikis.sun.com/display/DTrace/Introduction
+
+name: io
+title: io Provider
+index: 27
+url: http://wikis.sun.com/display/DTrace/io+Provider
+
+name: lockstat
+title: lockstat Provider
+index: 18
+url: http://wikis.sun.com/display/DTrace/lockstat+Provider
+
+name: out
+title: Output Formatting
+index: 12
+url: http://wikis.sun.com/display/DTrace/Output+Formatting
+
+name: proc
+title: proc Provider
+index: 25
+url: http://wikis.sun.com/display/DTrace/proc+Provider
+
+name: profile
+title: profile Provider
+index: 19
+url: http://wikis.sun.com/display/DTrace/profile+Provider
+
+name: sched
+title: sched Provider
+index: 26
+url: http://wikis.sun.com/display/DTrace/sched+Provider
+
+name: script
+title: Scripting
+index: 15
+url: http://wikis.sun.com/display/DTrace/Scripting
+
+name: sdt
+title: sdt Provider
+index: 22
+url: http://wikis.sun.com/display/DTrace/sdt+Provider
+
+name: spec
+title: Speculative Tracing
+index: 13
+url: http://wikis.sun.com/display/DTrace/Speculative+Tracing
+
+name: struct
+title: Structs and Unions
+index: 7
+url: http://wikis.sun.com/display/DTrace/Structs+and+Unions
+
+name: sysinfo
+title: sysinfo Provider
+index: 23
+url: http://wikis.sun.com/display/DTrace/sysinfo+Provider
+
+name: user
+title: User Process Tracing
+index: 32
+url: http://wikis.sun.com/display/DTrace/User+Process+Tracing
+
+name: vars
+title: Variables
+index: 3
+url: http://wikis.sun.com/display/DTrace/Variables
+
+name: vminfo
+title: vminfo Provider
+index: 24
+url: http://wikis.sun.com/display/DTrace/vminfo+Provider
+
+name: ip
+title: ip Provider
+index: 101
+url: http://wikis.sun.com/display/DTrace/ip+Provider
+
+name: tcp
+title: tcp Provider
+index: 102
+url: http://wikis.sun.com/display/DTrace/tcp+Provider
+
+name: udp
+title: udp Provider
+index: 103
+url: http://wikis.sun.com/display/DTrace/udp+Provider
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/begin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/begin.d
new file mode 100644
index 0000000..a378601
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/begin.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+BEGIN
+{
+	prot[0] = "---";
+	prot[1] = "r--";
+	prot[2] = "-w-";
+	prot[3] = "rw-";
+	prot[4] = "--x";
+	prot[5] = "r-x";
+	prot[6] = "-wx";
+	prot[7] = "rwx";
+}
+
+syscall::mmap:entry
+{
+	printf("mmap with prot = %s", prot[arg2 & 0x7]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/end.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/end.d
new file mode 100644
index 0000000..4390b10
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/end.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+BEGIN
+{
+	start = timestamp;
+}
+
+/*
+ * ... other tracing actions...
+ */
+
+END
+{
+	printf("total time: %d secs", (timestamp - start) / 1000000000);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/error.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/error.d
new file mode 100644
index 0000000..9711576
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/dtrace/error.d
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+BEGIN
+{
+	*(char *)NULL;
+}
+
+ERROR
+{
+	printf("Hit an error!");
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/delay.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/delay.d
new file mode 100644
index 0000000..1a52333
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/delay.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+fbt::delay:entry,
+fbt::drv_usecwait:entry
+{
+	self->in = timestamp
+}
+
+fbt::delay:return,
+fbt::drv_usecwait:return
+/self->in/
+{
+	@snoozers[stack()] = quantize(timestamp - self->in);
+	self->in = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/putnext.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/putnext.d
new file mode 100644
index 0000000..dd91ea0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/putnext.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+fbt::putnext:entry
+{
+	@calls[stringof(args[0]->q_qinfo->qi_minfo->mi_idname)] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/ssd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/ssd.d
new file mode 100644
index 0000000..6b78ab9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/ssd.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+fbt:ssd::return
+/arg1 == EIO/
+{
+	printf("%s+%x returned EIO.", probefunc, arg0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/xioctl.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/xioctl.d
new file mode 100644
index 0000000..3314768
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/fbt/xioctl.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * To make the output more readable, we want to indent every function entry
+ * (and unindent every function return).  This is done by setting the
+ * "flowindent" option.
+ */
+#pragma D option flowindent
+
+syscall::ioctl:entry
+/execname == "xclock" && guard++ == 0/
+{
+	self->traceme = 1;
+	printf("fd: %d", arg0);
+}
+
+fbt:::
+/self->traceme/
+{}
+
+syscall::ioctl:return
+/self->traceme/
+{
+	self->traceme = 0;
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/countdown.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/countdown.d
new file mode 100644
index 0000000..3fdb790
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/countdown.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+dtrace:::BEGIN
+{
+	i = 10;
+}
+
+profile:::tick-1sec
+/i > 0/
+{
+	trace(i--);
+}
+
+profile:::tick-1sec
+/i == 0/
+{
+	trace("blastoff!");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/counter.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/counter.d
new file mode 100644
index 0000000..bda153a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/counter.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Count off and report the number of seconds elapsed
+ */
+dtrace:::BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	i = i + 1;
+	trace(i);
+}
+
+dtrace:::END
+{
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/hello.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/hello.d
new file mode 100644
index 0000000..b584291
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/hello.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+BEGIN
+{
+	trace("hello, world");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/rwtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/rwtime.d
new file mode 100644
index 0000000..c005fbc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/rwtime.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::read:entry,
+syscall::write:entry
+/pid == $1/
+{
+	ts[probefunc] = timestamp;
+}
+
+syscall::read:return,
+syscall::write:return
+/pid == $1 && ts[probefunc] != 0/
+{
+	printf("%d nsecs", timestamp - ts[probefunc]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/trussrw.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/trussrw.d
new file mode 100644
index 0000000..590782f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/intro/trussrw.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::read:entry,
+syscall::write:entry
+/pid == $1/
+{
+	printf("%s(%d, 0x%x, %4d)", probefunc, arg0, arg1, arg2);
+}
+
+syscall::read:return, syscall::write:return
+/pid == $1/
+{
+	printf("\t\t = %d\n", arg1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/applicat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/applicat.d
new file mode 100644
index 0000000..44bce36
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/applicat.d
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+io:::start
+/execname == "soffice.bin" && args[2]->fi_name == "applicat.rdb"/
+{
+	@ = lquantize(args[2]->fi_offset != -1 ?
+	    args[2]->fi_offset / (1000 * 1024) : -1, 0, 1000);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iocpu.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iocpu.d
new file mode 100644
index 0000000..6957071
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iocpu.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::on-cpu
+/execname == "soffice.bin"/
+{
+	self->on = vtimestamp;
+}
+
+sched:::off-cpu
+/self->on/
+{
+	@time["<on cpu>"] = sum(vtimestamp - self->on);
+	self->on = 0;
+}
+
+io:::wait-start
+/execname == "soffice.bin"/
+{
+	self->wait = timestamp;
+}
+
+io:::wait-done
+/self->wait/
+{
+	@io[args[2]->fi_name] = sum(timestamp - self->wait);
+	@time["<I/O wait>"] = sum(timestamp - self->wait);
+	self->wait = 0;
+}
+
+END
+{
+	printf("Time breakdown (milliseconds):\n");
+	normalize(@time, 1000000);
+	printa("  %-50s %15 at d\n", @time);
+
+	printf("\nI/O wait breakdown (milliseconds):\n");
+	normalize(@io, 1000000);
+	printa("  %-50s %15 at d\n", @io);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iosnoop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iosnoop.d
new file mode 100644
index 0000000..1db6290
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iosnoop.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("%10s %58s %2s\n", "DEVICE", "FILE", "RW");
+}
+
+io:::start
+{
+	printf("%10s %58s %2s\n", args[1]->dev_statname,
+	    args[2]->fi_pathname, args[0]->b_flags & B_READ ? "R" : "W");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iothrough.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iothrough.d
new file mode 100644
index 0000000..b5b2e7e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iothrough.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+io:::start
+{
+	start[args[0]->b_edev, args[0]->b_blkno] = timestamp;
+}
+
+io:::done
+/start[args[0]->b_edev, args[0]->b_blkno]/
+{
+	/*
+	 * We want to get an idea of our throughput to this device in KB/sec.
+	 * What we have, however, is nanoseconds and bytes.  That is we want
+	 * to calculate:
+	 *
+	 *                        bytes / 1024
+	 *                  ------------------------
+	 *                  nanoseconds / 1000000000
+	 *
+	 * But we can't calculate this using integer arithmetic without losing
+	 * precision (the denomenator, for one, is between 0 and 1 for nearly
+	 * all I/Os).  So we restate the fraction, and cancel:
+	 * 
+	 *     bytes      1000000000         bytes        976562
+	 *   --------- * -------------  =  --------- * -------------  
+	 *      1024      nanoseconds          1        nanoseconds
+	 *
+	 * This is easy to calculate using integer arithmetic; this is what
+	 * we do below.
+	 */
+	this->elapsed = timestamp - start[args[0]->b_edev, args[0]->b_blkno];
+	@[args[1]->dev_statname, args[1]->dev_pathname] =
+	    quantize((args[0]->b_bcount * 976562) / this->elapsed);
+	start[args[0]->b_edev, args[0]->b_blkno] = 0;
+}
+
+END
+{
+	printa("  %s (%s)\n%@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iotime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iotime.d
new file mode 100644
index 0000000..0e0f6ac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/iotime.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("%10s %58s %2s %7s\n", "DEVICE", "FILE", "RW", "MS");
+}
+
+io:::start
+{
+	start[args[0]->b_edev, args[0]->b_blkno] = timestamp;
+}
+
+io:::done
+/start[args[0]->b_edev, args[0]->b_blkno]/
+{
+	this->elapsed = timestamp - start[args[0]->b_edev, args[0]->b_blkno];
+	printf("%10s %58s %2s %3d.%03d\n", args[1]->dev_statname,
+	    args[2]->fi_pathname, args[0]->b_flags & B_READ ? "R" : "W",
+	    this->elapsed / 1000000, (this->elapsed / 1000) % 1000);
+	start[args[0]->b_edev, args[0]->b_blkno] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whoio.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whoio.d
new file mode 100644
index 0000000..f660b34
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whoio.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+io:::start
+{
+	@[args[1]->dev_statname, execname, pid] = sum(args[0]->b_bcount);
+}
+
+END
+{
+	printf("%10s %20s %10s %15s\n", "DEVICE", "APP", "PID", "BYTES");
+	printa("%10s %20s %10d %15 at d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whowrite.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whowrite.d
new file mode 100644
index 0000000..6a4ffdd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/io/whowrite.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+io:::start
+/args[0]->b_flags & B_WRITE/
+{
+	@[execname, args[2]->fi_dirname] = count();
+}
+
+END
+{
+	printf("%20s %51s %5s\n", "WHO", "WHERE", "COUNT");
+	printa("%20s %51s %5 at d\n", @);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipio.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipio.d
new file mode 100644
index 0000000..0a7cc6f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipio.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=10hz
+
+dtrace:::BEGIN
+{
+	printf(" %3s %10s %15s    %15s %8s %6s\n", "CPU", "DELTA(us)",
+	    "SOURCE", "DEST", "INT", "BYTES");
+	last = timestamp;
+}
+
+ip:::send
+{
+	this->elapsed = (timestamp - last) / 1000;
+	printf(" %3d %10d %15s -> %15s %8s %6d\n", cpu, this->elapsed,
+	    args[2]->ip_saddr, args[2]->ip_daddr, args[3]->if_name,
+	    args[2]->ip_plength);
+	last = timestamp;
+}
+
+ip:::receive
+{
+	this->elapsed = (timestamp - last) / 1000;
+	printf(" %3d %10d %15s <- %15s %8s %6d\n", cpu, this->elapsed,
+	    args[2]->ip_daddr, args[2]->ip_saddr, args[3]->if_name,
+	    args[2]->ip_plength);
+	last = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipproto.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipproto.d
new file mode 100644
index 0000000..f5f3656
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/ipproto.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	printf("Tracing... Hit Ctrl-C to end.\n");
+}
+
+ip:::send,
+ip:::receive
+{
+	this->protostr = args[2]->ip_ver == 4 ?
+	    args[4]->ipv4_protostr : args[5]->ipv6_nextstr;
+	@num[args[2]->ip_saddr, args[2]->ip_daddr, this->protostr] = count();
+}
+
+dtrace:::END
+{
+	printf("   %-28s %-28s %6s %8s\n", "SADDR", "DADDR", "PROTO", "COUNT");
+	printa("   %-28s %-28s %6s %@8d\n", @num);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/tcprst.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/tcprst.d
new file mode 100755
index 0000000..a2d88e1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/ip/tcprst.d
@@ -0,0 +1,284 @@
+#!/usr/sbin/dtrace -Cqs
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option dynvarsize=64m
+
+#define TH_RST		0x04
+#define MAX_RECORDS	10
+#define M_CTL		0x0d
+
+#define PRINT_MAIN_HEADER()						\
+	(printf("\n%-25s %-6s %-25s %-6s %-10s %-10s %8s %8s\n",	\
+	    "LADDR", "LPORT", "RADDR", "RPORT", "ISS", "IRS",		\
+	    "SND_CNT", "RCV_CNT"))
+
+#define PRINT_RECORD_HEADER()						\
+	(printf("%-20s %-20s %-3s %15s %15s %8s %8s %5s\n",		\
+	    "PROBENAME", "TIME", "S/R", "SEQ", "ACK", "DATALEN",	\
+	    "WND", "FLAGS"))
+
+#define PRINT_MAIN_HEADER_VALUES()					\
+	(printf("%-25s %-6d %-25s %-6d %-10d %-10d %8d %8d\n",		\
+	    laddr[self->conn_id], lport[self->conn_id],			\
+	    faddr[self->conn_id], fport[self->conn_id],			\
+	    iss[self->conn_id], irs[self->conn_id],			\
+	    send_count[self->conn_id], recv_count[self->conn_id]))
+
+#define PRINT_HEADER()							\
+	PRINT_MAIN_HEADER(); PRINT_MAIN_HEADER_VALUES();		\
+	    PRINT_RECORD_HEADER()
+
+#define PRINT_RECORD(i)							\
+	(printf("%-20s %-20Y %-3s %15d %15d %8d %8d %2x\n",		\
+	    probe_name[self->conn_id, i],				\
+	    conn_time[self->conn_id, i],				\
+	    send_recv[self->conn_id, i],				\
+	    seqno[self->conn_id, i],					\
+	    ack[self->conn_id, i],					\
+	    datalen[self->conn_id, i],					\
+	    wnd[self->conn_id, i],					\
+	    flags[self->conn_id, i]))
+
+tcp-trace-*
+{
+	/* extract connection details */
+
+	this->mp = (mblk_t *)arg0;
+	this->mp = (this->mp->b_datap->db_type == M_CTL?
+	    this->mp->b_cont : this->mp);
+	self->tcpp = (tcp_t *)arg1;
+	this->connp = (conn_t *)self->tcpp->tcp_connp;
+
+	self->iph = (ipha_t *)this->mp->b_rptr;
+	this->iph_length =
+	    (int)(((ipha_t *)self->iph)->ipha_version_and_hdr_length
+	    & 0xF) << 2;
+	self->tcph = (tcpha_t *)((char *)self->iph + this->iph_length);
+	this->tcph_length =
+	    (((tcph_t *)self->tcph)->th_offset_and_rsrvd[0] >>2) &(0xF << 2);
+
+	/* ports */
+	self->i_lport = ntohs(this->connp->u_port.tcpu_ports.tcpu_lport);
+	self->i_fport = ntohs(this->connp->u_port.tcpu_ports.tcpu_fport);
+
+	/* IP addresses */
+	this->i_fad = (in6_addr_t *)&this->connp->connua_v6addr.connua_faddr;
+	this->i_lad = (in6_addr_t *)&this->connp->connua_v6addr.connua_laddr;
+
+	/* the address would either be IPv6 or IPv4-mapped-IPv6  */
+	self->i_faddr = inet_ntop(AF_INET6, (void *)this->i_fad);
+	self->i_laddr = inet_ntop(AF_INET6, (void *)this->i_lad);
+
+	/* create connection identifier, so we can track packets by conn */
+	self->conn_id = (uint64_t)self->tcpp->tcp_connp;
+}
+
+tcp-trace-*
+/first[self->conn_id] == 0/
+{
+	/* initialize counters - this is the first packet for this connection */
+	pcount[self->conn_id] = -1;
+	rollover[self->conn_id] = 0;
+	end_ptr[self->conn_id] = 0;
+	num[self->conn_id] = 0;
+
+	first[self->conn_id] = 1;
+
+	/* connection info */
+	laddr[self->conn_id] = self->i_laddr;
+	faddr[self->conn_id] = self->i_faddr;
+	lport[self->conn_id] = self->i_lport;
+	fport[self->conn_id] = self->i_fport;
+	iss[self->conn_id] = self->tcpp->tcp_iss;
+	irs[self->conn_id] = self->tcpp->tcp_irs;
+
+}
+
+tcp-trace-*
+{
+	/* counters, to keep track of how much info to dump */
+	pcount[self->conn_id]++;
+	rollover[self->conn_id] |= pcount[self->conn_id]/MAX_RECORDS;
+	pcount[self->conn_id] = pcount[self->conn_id]%MAX_RECORDS;
+	self->pcount = pcount[self->conn_id];
+	end_ptr[self->conn_id] = self->pcount;
+	num[self->conn_id] = (rollover[self->conn_id]?
+	    MAX_RECORDS : pcount[self->conn_id] + 1);
+	conn_time[self->conn_id, self->pcount] = walltimestamp;
+
+	/* tcp state info */
+	seqno[self->conn_id, self->pcount] = ntohl(self->tcph->tha_seq);
+	ack[self->conn_id, self->pcount] = ntohl(self->tcph->tha_ack);
+	datalen[self->conn_id, self->pcount] =  ntohs(self->iph->ipha_length);
+	wnd[self->conn_id, self->pcount] =  ntohs(self->tcph->tha_win);
+	probe_name[self->conn_id, self->pcount] = probename;
+
+	/* flag 0x04 indicates a RST packet */
+	flags[self->conn_id, self->pcount] = self->tcph->tha_flags;
+	self->flags = self->tcph->tha_flags;
+}
+
+tcp-trace-send
+{
+	send_count[self->conn_id]++;
+	send_recv[self->conn_id, self->pcount] = "S";
+}
+
+tcp-trace-recv
+{
+	recv_count[self->conn_id]++;
+	send_recv[self->conn_id, self->pcount] = "R";
+}
+
+tcp-trace-*
+/(self->flags & TH_RST)/
+{
+	PRINT_HEADER();
+
+	self->i = (end_ptr[self->conn_id] + MAX_RECORDS - num[self->conn_id]
+	    + 1)%MAX_RECORDS;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 10)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 9)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 8)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 7)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 6)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 5)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 4)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 3)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 2)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+}
+
+tcp-trace-*
+/(self->flags & TH_RST) && (num[self->conn_id] >= 1)/
+{
+	PRINT_RECORD(self->i);
+	self->i = (self->i + 1)%MAX_RECORDS;
+
+	num[self->conn_id]--;
+	self->reset = self->conn_id;
+}
+
+tcp-trace-*
+/self->reset/
+{
+	pcount[self->reset] = -1;
+	rollover[self->reset] = 0;
+	end_ptr[self->reset] = 0;
+	num[self->reset] = 0;
+
+	self->reset = 0;
+}
+
+conn-destroy
+{
+	/* clear old connection state */
+	this->conn_id = (uint64_t)arg0;
+
+	pcount[this->conn_id] = -1;
+	rollover[this->conn_id] = 0;
+	end_ptr[this->conn_id] = 0;
+	num[this->conn_id] = 0;
+	first[this->conn_id] = 0;
+
+	laddr[this->conn_id] = 0;
+	faddr[this->conn_id] = 0;
+	lport[this->conn_id] = 0;
+	fport[this->conn_id] = 0;
+	iss[this->conn_id] = 0;
+	irs[this->conn_id] = 0;
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/whatlock.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/whatlock.d
new file mode 100644
index 0000000..7ad20c5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/lockstat/whatlock.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+lockstat:::adaptive-acquire
+/execname == "date"/
+{
+	@locks["adaptive"] = count();
+}
+
+lockstat:::spin-acquire
+/execname == "date"/
+{
+	@locks["spin"] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/mkdemo.pl b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/mkdemo.pl
new file mode 100755
index 0000000..f2bc3ec
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/mkdemo.pl
@@ -0,0 +1,227 @@
+#!/usr/perl5/bin/perl -w
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+require 5.005;
+
+use strict;
+use warnings;
+use Time::localtime;
+use File::Basename;
+
+our ($cmd, $chapfile, $htmlfile, $dtrace_url, %chaps);
+
+$cmd = "mkdemo";
+$chapfile = "chapters";
+$htmlfile = "index.html";
+$dtrace_url = "http://www.sun.com/bigadmin/content/dtrace";
+
+sub chaps_read {
+	my $fatal;
+	my %hash;
+
+	open(CHAPS, "$chapfile");
+
+	while (<CHAPS>) {
+		my $field;
+		my $value;
+
+		chop;
+
+		if (/^#/) {
+			next;
+		}
+
+		if (!/:/) {
+			if (exists $hash{'name'}) {
+				if (exists $chaps{$hash{'name'}}) {
+					print "$cmd: chapter $hash{'name'} ";
+					print "has two entries.\n";
+					$fatal = 1;
+				}
+
+				$chaps{$hash{'name'}} = { %hash };
+				%hash = ();
+				next;
+			}
+
+			%hash = ();
+			next;
+		}
+
+		($field, $value) = split /:\s*/, $_, 2;
+
+		if ($field eq "descr") {
+			$value .= " ";
+		}
+
+		$hash{$field} .= $value;
+	}
+
+	if ($fatal) {
+		print "$cmd: fatal errors; cannot proceed.\n";
+		exit;
+	}
+
+	close (CHAPS);
+}	
+
+sub chaps_ascending {
+	$chaps{$a}{index} <=> $chaps{$b}{index};
+}
+
+sub demo_process {
+	my $chap = $_[0];
+	my $demo = $_[1];
+	my $year = localtime->year() + 1900;
+
+	open DEMO, "<$chap/$demo" or die "Can't open demo $chap/$demo";
+	open OUT, ">$demo" or die "Can't open $demo";
+
+	while (<DEMO>) {
+		print OUT $_;
+
+		if (/Use is subject to license terms/) {
+			print OUT <<EOF;
+ *
+ * This D script is used as an example in the Solaris Dynamic Tracing Guide
+ * wiki in the \"$chaps{$chap}{title}\" Chapter.
+ *
+ * The full text of the this chapter may be found here:
+ *
+ *   $chaps{$chap}{url}
+ *
+ * On machines that have DTrace installed, this script is available as
+ * $demo in /usr/demo/dtrace, a directory that contains all D scripts
+ * used in the Solaris Dynamic Tracing Guide.  A table of the scripts and their
+ * corresponding chapters may be found here:
+ *
+ *   file:///usr/demo/dtrace/index.html
+EOF
+		}
+	}
+
+	close (DEMO);
+	close (OUT);
+}
+
+sub demo_find {
+	my $demo = $_[0];
+	my $chap;
+
+	foreach $chap (keys %chaps) {
+		if (!stat("$chap/$demo")) {
+			next;
+		}
+
+		demo_process($chap, $demo);
+		return;
+	}
+
+	die "Couldn't find $demo in any chapter";
+}
+
+sub chaps_process {
+	my $outfile = $_[0];
+	my $chap;
+
+	open HTML, ">$outfile" or die "Can't open $outfile.";
+
+	print HTML "<html>\n<head>\n";
+	print HTML "<title>Example DTrace Scripts</title>\n";
+	print HTML "</head>\n<body bgcolor=\"#ffffff\">\n";
+
+	print HTML "<table width=\"85%\" border=0 align=\"center\"><tr><td>";
+	print HTML "<h2>DTrace Examples</h2>\n";
+
+	print HTML "<hr><p>\n";
+	print HTML "Here are the <a href=\"$dtrace_url\">DTrace</a> scripts\n";
+	print HTML "that are used as examples in the\n";
+	print HTML "<a href=\"$chaps{book}{url}\">$chaps{book}{title}</a>. ";
+	print HTML "For more information on any one script, follow the link\n";
+	print HTML "to its corresponding chapter.\n";
+	print HTML "<p>\n<hr><p>\n";
+
+	print HTML "<left><table width=\"85%\" border=1 cellpadding=4 ";
+	print HTML "cellspacing=0 align=\"center\" bgcolor=\"#ffffff\">\n";
+	print HTML "<tr bgcolor=\"#5882a1\"><td width=\"50%\">";
+	print HTML "<font color=\"#ffffff\"><b>Chapter</b></td></font>\n";
+	print HTML "<td><font color=\"#ffffff\"><b>Script</b></td>\n";
+	print HTML "</font></tr>\n";
+
+	foreach $chap (sort chaps_ascending (keys %chaps)) {
+		my @demos;
+		my $demo;
+
+		#
+		# Open the directory associated with the chapter.
+		#
+		if ($chap =~ /^book$/) {
+			next;
+		}
+
+		opendir(DEMOS, $chap) || die("Cannot open directory $chap");
+		@demos = readdir(DEMOS);
+		closedir(DEMOS);
+
+		print HTML "<tr>\n";
+		print HTML "<td align=left>";
+		print HTML "<a href=\"$chaps{$chap}{url}\">";
+		print HTML "$chaps{$chap}{title}</a></td>\n";
+
+		print HTML "<td><table border=0>\n";
+
+		foreach $demo (sort(@demos)) {
+			if ($demo !~ /^[a-z].*\.d$/) {
+				next;
+			}
+
+			print HTML "<tr><td><a href=\"$demo\">$demo</a>";
+			print HTML "</td></tr>\n";
+
+			demo_process($chap, $demo);
+		}
+
+		print HTML "</table></td></tr>\n";
+	}
+
+	print HTML "</table>\n</td>\n<p>\n\n";
+	print HTML "</td></tr>\n";
+	print HTML "<tr><td><hr><small>Copyright ";
+	print HTML localtime->year() + 1900;
+	print HTML " Sun Microsystems</small>\n";
+	print HTML "</table>\n";
+	print HTML "</body>\n</html>\n";
+	close HTML;
+}
+
+chaps_read();
+
+if (basename($ARGV[0]) ne "$htmlfile") {
+	demo_find(basename($ARGV[0]));
+} else {
+	chaps_process($htmlfile);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/printa.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/printa.d
new file mode 100644
index 0000000..f3cee56
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/out/printa.d
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+profile:::profile-997
+{
+	@a[caller] = count();
+}
+
+END
+{
+	printa("%@8u %a\n", @a);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/lwptime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/lwptime.d
new file mode 100644
index 0000000..53949af
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/lwptime.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+proc:::lwp-start
+/tid != 1/
+{
+	self->start = timestamp;
+}
+
+proc:::lwp-exit
+/self->start/
+{
+	@[execname] = quantize(timestamp - self->start);
+	self->start = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/progtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/progtime.d
new file mode 100644
index 0000000..8bfa369
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/progtime.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+proc:::start
+{
+	self->start = timestamp;
+}
+
+proc:::exit
+/self->start/
+{
+	@[execname] = quantize(timestamp - self->start);
+	self->start = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/sig.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/sig.d
new file mode 100644
index 0000000..07d9b25
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/sig.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+proc:::signal-send
+{
+	@[execname, stringof(args[1]->pr_fname), args[2]] = count();
+}
+
+END
+{
+	printf("%20s %20s %12s %s\n",
+	    "SENDER", "RECIPIENT", "SIG", "COUNT");
+	printa("%20s %20s %12d %@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/whoexec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/whoexec.d
new file mode 100644
index 0000000..ee0fe4f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/proc/whoexec.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+proc:::exec
+{
+        self->parent = execname;
+}
+
+proc:::exec-success
+/self->parent != NULL/
+{
+	@[self->parent, execname] = count();
+	self->parent = NULL;
+}
+
+proc:::exec-failure
+/self->parent != NULL/
+{
+	self->parent = NULL;
+}
+
+END
+{
+	printf("%-20s %-20s %s\n", "WHO", "WHAT", "COUNT");
+	printa("%-20s %-20s %@d\n", @);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/prof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/prof.d
new file mode 100644
index 0000000..4eedf50
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/prof.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+profile-97
+/pid != 0/
+{
+	@proc[pid, execname] = count();
+}
+
+END
+{
+	printf("%-8s %-40s %s\n", "PID", "CMD", "COUNT");
+	printa("%-8d %-40s %@d\n", @proc);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/profpri.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/profpri.d
new file mode 100644
index 0000000..615594b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/profpri.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+profile-1001
+/pid == $1/
+{
+	@proc[execname] = lquantize(curlwpsinfo->pr_pri, 0, 100, 10);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/restest.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/restest.d
new file mode 100644
index 0000000..390ea12
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/profile/restest.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+profile-5000
+{
+	/*
+	 * We divide by 1,000,000 to convert nanoseconds to milliseconds, and
+	 * then we take the value mod 10 to get the current millisecond within
+	 * a 10 millisecond window.  On platforms that do not support truly
+	 * arbitrary resolution profile probes, all of the profile-5000 probes
+	 * will fire on roughly the same millisecond.  On platforms that
+	 * support a truly arbitrary resolution, the probe firings will be
+	 * evenly distributed across the milliseconds.
+	 */
+	@ms = lquantize((timestamp / 1000000) % 10, 0, 10, 1);
+}
+
+tick-1sec
+/i++ >= 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/firebird.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/firebird.d
new file mode 100644
index 0000000..ab65e95
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/firebird.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::sleep
+/execname == "MozillaFirebird" && curlwpsinfo->pr_stype == SOBJ_CV/
+{
+	bedtime[curlwpsinfo->pr_addr] = timestamp;
+}
+
+sched:::wakeup
+/execname == "MozillaFirebird" && bedtime[args[0]->pr_addr]/
+{
+	@[args[1]->pr_pid, args[0]->pr_lwpid, pid, curlwpsinfo->pr_lwpid] = 
+	    quantize(timestamp - bedtime[args[0]->pr_addr]);
+	bedtime[args[0]->pr_addr] = 0;
+}
+
+sched:::wakeup
+/bedtime[args[0]->pr_addr]/
+{
+	bedtime[args[0]->pr_addr] = 0;
+}
+
+END
+{
+	printa("%d/%d sleeping on %d/%d:\n%@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/howlong.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/howlong.d
new file mode 100644
index 0000000..0fcfa1c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/howlong.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::off-cpu
+/curlwpsinfo->pr_state == SSLEEP/
+{
+	self->cpu = cpu;
+	self->ts = timestamp;
+}
+
+sched:::on-cpu
+/self->ts/
+{
+	@[self->cpu == cpu ?
+	    "sleep time, no CPU migration" : "sleep time, CPU migration"] =
+	    lquantize((timestamp - self->ts) / 1000000, 0, 500, 25);
+	self->ts = 0;
+	self->cpu = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/nscd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/nscd.d
new file mode 100644
index 0000000..8e30ac4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/nscd.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::sleep
+/curlwpsinfo->pr_stype == SOBJ_SHUTTLE/
+{
+	bedtime[curlwpsinfo->pr_addr] = timestamp;
+}
+
+sched:::wakeup
+/execname == "nscd" && bedtime[args[0]->pr_addr]/
+{
+	@[stringof(curpsinfo->pr_fname), stringof(args[1]->pr_fname)] =
+	    quantize(timestamp - bedtime[args[0]->pr_addr]);
+	bedtime[args[0]->pr_addr] = 0;
+}
+
+sched:::wakeup
+/bedtime[args[0]->pr_addr]/
+{
+	bedtime[args[0]->pr_addr] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pri.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pri.d
new file mode 100644
index 0000000..ea76fd7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pri.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::change-pri
+{
+	@[stringof(args[0]->pr_clname)] =
+	    lquantize(args[2] - args[0]->pr_pri, -50, 50, 5);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pritime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pritime.d
new file mode 100644
index 0000000..2c80e6a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/pritime.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	start = timestamp;
+}
+
+sched:::change-pri
+/args[1]->pr_pid == $1 && args[0]->pr_lwpid == $2/
+{
+	printf("%d %d\n", timestamp - start, args[2]);
+}
+
+tick-1sec
+/++n == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qlen.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qlen.d
new file mode 100644
index 0000000..a34ae4c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qlen.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::enqueue
+{
+	this->len = qlen[args[2]->cpu_id]++;
+	@[args[2]->cpu_id] = lquantize(this->len, 0, 100);
+}
+
+sched:::dequeue
+/qlen[args[2]->cpu_id]/
+{
+	qlen[args[2]->cpu_id]--;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qtime.d
new file mode 100644
index 0000000..54ebf5f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/qtime.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::enqueue
+{
+	ts[args[0]->pr_lwpid, args[1]->pr_pid, args[2]->cpu_id] =
+	    timestamp;
+}
+
+sched:::dequeue
+/ts[args[0]->pr_lwpid, args[1]->pr_pid, args[2]->cpu_id]/
+{
+	@[args[2]->cpu_id] = quantize(timestamp -
+	    ts[args[0]->pr_lwpid, args[1]->pr_pid, args[2]->cpu_id]);
+	ts[args[0]->pr_lwpid, args[1]->pr_pid, args[2]->cpu_id] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/tick.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/tick.d
new file mode 100644
index 0000000..8842759
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/tick.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::tick,
+sched:::enqueue
+{
+	@[probename] = lquantize((timestamp / 1000000) % 10, 0, 10);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/ticktime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/ticktime.d
new file mode 100644
index 0000000..e24a80a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/ticktime.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+uint64_t last[int];
+
+sched:::tick
+/last[cpu]/
+{
+	@[cpu] = min(timestamp - last[cpu]);
+}
+
+sched:::tick
+{
+	last[cpu] = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whatfor.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whatfor.d
new file mode 100644
index 0000000..d8b6edb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whatfor.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::off-cpu
+/curlwpsinfo->pr_state == SSLEEP/
+{
+	/*
+	 * We're sleeping.  Track our sobj type.
+	 */
+	self->sobj = curlwpsinfo->pr_stype;
+	self->bedtime = timestamp;
+}
+
+sched:::off-cpu
+/curlwpsinfo->pr_state == SRUN/
+{
+	self->bedtime = timestamp;
+}
+
+sched:::on-cpu
+/self->bedtime && !self->sobj/
+{
+	@["preempted"] = quantize(timestamp - self->bedtime);
+	self->bedtime = 0;
+}
+
+sched:::on-cpu
+/self->sobj/
+{
+	@[self->sobj == SOBJ_MUTEX ? "kernel-level lock" :
+	    self->sobj == SOBJ_RWLOCK ? "rwlock" :
+	    self->sobj == SOBJ_CV ? "condition variable" :
+	    self->sobj == SOBJ_SEMA ? "semaphore" :
+	    self->sobj == SOBJ_USER ? "user-level lock" :
+	    self->sobj == SOBJ_USER_PI ? "user-level prio-inheriting lock" :
+	    self->sobj == SOBJ_SHUTTLE ? "shuttle" : "unknown"] =
+	    quantize(timestamp - self->bedtime);
+
+	self->sobj = 0;
+	self->bedtime = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/where.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/where.d
new file mode 100644
index 0000000..af02624
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/where.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+sched:::on-cpu
+{
+	self->ts = timestamp;
+}
+
+sched:::off-cpu
+/self->ts/
+{
+	@[cpu] = quantize(timestamp - self->ts);
+	self->ts = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whererun.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whererun.d
new file mode 100644
index 0000000..ddd13f7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whererun.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	start = timestamp;
+}
+
+sched:::on-cpu
+/execname == $$1/
+{
+	self->ts = timestamp;
+}
+
+sched:::off-cpu
+/self->ts/
+{
+	@[cpu] = sum(timestamp - self->ts);
+	self->ts = 0;
+}
+
+profile:::tick-1sec
+/++x == 10/
+{
+	exit(0);
+}
+        
+dtrace:::END
+{
+	printf("CPU distribution over %d seconds:\n\n",
+	    (timestamp - start) / 1000000000);
+	printf("CPU microseconds\n--- ------------\n");
+	normalize(@, 1000);
+	printa("%3d %@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whofor.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whofor.d
new file mode 100644
index 0000000..f0243d6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whofor.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::sleep
+/!(curlwpsinfo->pr_flag & PR_ISSYS) && curlwpsinfo->pr_stype == SOBJ_CV/
+{
+	bedtime[curlwpsinfo->pr_addr] = timestamp;
+}
+
+sched:::wakeup
+/bedtime[args[0]->pr_addr]/
+{
+	@[stringof(args[1]->pr_fname), execname] =
+	    quantize(timestamp - bedtime[args[0]->pr_addr]);
+	bedtime[args[0]->pr_addr] = 0;
+}
+
+END
+{
+	printa("%s sleeping on %s:\n%@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whopreempt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whopreempt.d
new file mode 100644
index 0000000..e8dd863
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whopreempt.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::preempt
+{
+	self->preempt = 1;
+}
+
+sched:::remain-cpu
+/self->preempt/
+{
+	self->preempt = 0;
+}
+
+sched:::off-cpu
+/self->preempt/
+{
+	/*
+	 * If we were told to preempt ourselves, see who we ended up giving
+	 * the CPU to.
+	 */
+	@[stringof(args[1]->pr_fname), args[0]->pr_pri, execname,
+	    curlwpsinfo->pr_pri] = count();
+	self->preempt = 0;
+}
+
+END
+{
+	printf("%30s %3s %30s %3s %5s\n", "PREEMPTOR", "PRI",
+	    "PREEMPTED", "PRI", "#");
+	printa("%30s %3d %30s %3d %5 at d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whoqueue.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whoqueue.d
new file mode 100644
index 0000000..c2ab47a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whoqueue.d
@@ -0,0 +1,95 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+#pragma D option nspec=4
+#pragma D option specsize=100k
+
+int maxlen;
+int spec[int];
+
+sched:::enqueue
+{
+	this->len = ++qlen[this->cpu = args[2]->cpu_id];
+	in[args[0]->pr_addr] = timestamp;
+}
+
+sched:::enqueue
+/this->len > maxlen && spec[this->cpu]/
+{
+	/*
+	 * There is already a speculation for this CPU.  We just set a new
+	 * record, so we'll discard the old one.
+	 */
+	discard(spec[this->cpu]);
+}
+
+sched:::enqueue
+/this->len > maxlen/
+{
+	/*
+	 * We have a winner.  Set the new maximum length and set the timestamp
+	 * of the longest length.
+	 */
+	maxlen = this->len;
+	longtime[this->cpu] = timestamp;	
+
+	/*
+	 * Now start a new speculation, and speculatively trace the length.
+	 */
+	this->spec = spec[this->cpu] = speculation();
+	speculate(this->spec);
+	printf("Run queue of length %d:\n", this->len);
+}
+
+sched:::dequeue
+/(this->in = in[args[0]->pr_addr]) &&
+    this->in <= longtime[this->cpu = args[2]->cpu_id]/
+{
+	speculate(spec[this->cpu]);
+	printf("  %d/%d (%s)\n", 
+	    args[1]->pr_pid, args[0]->pr_lwpid,
+	    stringof(args[1]->pr_fname));
+}
+
+sched:::dequeue
+/qlen[args[2]->cpu_id]/
+{
+	in[args[0]->pr_addr] = 0;
+	this->len = --qlen[args[2]->cpu_id];
+}
+
+sched:::dequeue
+/this->len == 0 && spec[this->cpu]/
+{
+	/*
+	 * We just processed the last thread that was enqueued at the time
+	 * of longest length; commit the speculation, which by now contains
+	 * each thread that was enqueued when the queue was longest.
+	 */
+	commit(spec[this->cpu]);
+	spec[this->cpu] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whosteal.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whosteal.d
new file mode 100644
index 0000000..c698e4f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/whosteal.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sched:::dequeue
+/args[2]->cpu_id != -1 && cpu != args[2]->cpu_id &&
+    (curlwpsinfo->pr_flag & PR_IDLE)/
+{
+	@[stringof(args[1]->pr_fname), args[2]->cpu_id] =
+	    lquantize(cpu, 0, 100);
+}
+
+END
+{
+	printa("%s stolen from CPU %d by:\n%@d\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xterm.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xterm.d
new file mode 100644
index 0000000..bb5ed33
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xterm.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	start = timestamp;
+}
+
+sched:::wakeup
+/stringof(args[1]->pr_fname) == "xterm"/
+{
+	@[execname] = lquantize((timestamp - start) / 1000000000, 0, 10);
+}
+
+profile:::tick-1sec
+/++x == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xwork.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xwork.d
new file mode 100644
index 0000000..cbaf105
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sched/xwork.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+self int last;
+
+sched:::wakeup
+/self->last && args[0]->pr_stype == SOBJ_CV/
+{
+	@[stringof(args[1]->pr_fname)] = sum(vtimestamp - self->last);
+	self->last = 0;
+}
+
+sched:::wakeup
+/execname == "Xsun" && self->last == 0/
+{
+	self->last = vtimestamp;
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/interp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/interp.d
new file mode 100644
index 0000000..c3e419e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/interp.d
@@ -0,0 +1,33 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#!/usr/sbin/dtrace -s
+
+BEGIN
+{
+	trace("hello");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/syscall.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/syscall.d
new file mode 100644
index 0000000..c47fb92
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/syscall.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall:::entry
+/pid == $target/
+{
+	@[probefunc] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/tracewrite.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/tracewrite.d
new file mode 100644
index 0000000..c1336cf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/script/tracewrite.d
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#!/usr/sbin/dtrace -s
+
+syscall::write:entry
+/pid == $1/
+{
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/callout.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/callout.d
new file mode 100644
index 0000000..2044536
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/callout.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sdt:::callout-start
+{
+	@callouts[((callout_t *)arg0)->c_func] = count();
+}
+
+tick-1sec
+{
+	printa("%40a %10 at d\n", @callouts);
+	clear(@callouts);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/interval.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/interval.d
new file mode 100644
index 0000000..d4a6a32
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/interval.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D option quiet
+
+sdt:::callout-start
+{
+	self->callout = ((callout_t *)arg0)->c_func;
+}
+
+fbt::timeout:entry
+/self->callout && arg2 <= 100/
+{
+	/*
+	 * In this case, we are most interested in interval timeout(9F)s that
+	 * are short.  We therefore do a linear quantization from 0 ticks to
+	 * 100 ticks.  The system clock's frequency ? set by the variable
+	 * "hz" ? defaults to 100, so 100 system clock ticks is one second. 
+	 */
+	@callout[self->callout] = lquantize(arg2, 0, 100);
+}
+
+sdt:::callout-end
+{
+	self->callout = NULL;
+}
+
+END
+{
+	printa("%a\n%@d\n\n", @callout);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/intr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/intr.d
new file mode 100644
index 0000000..5233450
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sdt/intr.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+interrupt-start
+{
+	self->ts = vtimestamp;
+}
+
+interrupt-complete
+/self->ts/
+{
+	this->devi = (struct dev_info *)arg0;
+	@[stringof(`devnamesp[this->devi->devi_major].dn_name),
+	    this->devi->devi_instance] = quantize(vtimestamp - self->ts);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/spec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/spec.d
new file mode 100644
index 0000000..dc162a1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/spec.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::open:entry
+{
+	self->spec = speculation();
+}
+
+syscall:::
+/self->spec/
+{
+	speculate(self->spec);
+	printf("this is speculative");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/specopen.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/specopen.d
new file mode 100644
index 0000000..f1975ff
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/spec/specopen.d
@@ -0,0 +1,93 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#!/usr/sbin/dtrace -Fs
+
+syscall::open:entry,
+syscall::open64:entry
+{
+	/*
+	 * The call to speculation() creates a new speculation.  If this fails,
+	 * dtrace(1M) will generate an error message indicating the reason for
+	 * the failed speculation(), but subsequent speculative tracing will be
+	 * silently discarded.
+	 */
+	self->spec = speculation();
+	speculate(self->spec);
+
+	/*
+	 * Because this printf() follows the speculate(), it is being 
+	 * speculatively traced; it will only appear in the data buffer if the
+	 * speculation is subsequently commited.
+	 */
+	printf("%s", stringof(copyinstr(arg0)));
+}
+
+fbt:::
+/self->spec/
+{
+	/*
+	 * A speculate() with no other actions speculates the default action:
+	 * tracing the EPID.
+	 */
+	speculate(self->spec);
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec/
+{
+	/*
+	 * To balance the output with the -F option, we want to be sure that
+	 * every entry has a matching return.  Because we speculated the
+	 * open entry above, we want to also speculate the open return.
+	 * This is also a convenient time to trace the errno value.
+	 */
+	speculate(self->spec);
+	trace(errno);
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec && errno != 0/
+{
+	/*
+	 * If errno is non-zero, we want to commit the speculation.
+	 */
+	commit(self->spec);
+	self->spec = 0;
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec && errno == 0/
+{
+	/*
+	 * If errno is not set, we discard the speculation.
+	 */
+	discard(self->spec);
+	self->spec = 0;
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/kstat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/kstat.d
new file mode 100644
index 0000000..1b40dda
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/kstat.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+pid$1:libkstat:kstat_data_lookup:entry
+{
+	self->ksname = arg1;
+}
+
+pid$1:libkstat:kstat_data_lookup:return
+/self->ksname != NULL && arg1 != NULL/
+{
+	this->ksp = (kstat_named_t *) copyin(arg1, sizeof (kstat_named_t));
+	printf("%s has ui64 value %u\n",
+	    copyinstr(self->ksname), this->ksp->value.ui64);
+}
+
+pid$1:libkstat:kstat_data_lookup:return
+/self->ksname != NULL && arg1 == NULL/
+{
+	self->ksname = NULL;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/ksyms.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/ksyms.d
new file mode 100644
index 0000000..ab2f1cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/ksyms.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * When our strings(1) invocation starts a read(2), set a watched flag on
+ * the current thread.  When the read(2) finishes, clear the watched flag.
+ */
+syscall::read:entry
+/curpsinfo->pr_psargs == "strings -a /dev/ksyms"/
+{
+	printf("read %u bytes to user address %x\n", arg2, arg1);
+	self->watched = 1;
+}
+
+syscall::read:return
+/self->watched/
+{
+	self->watched = 0;
+}
+
+/*
+ * Instrument uiomove(9F).  The prototype for this function is as follows:
+ * int uiomove(caddr_t addr, size_t nbytes, enum uio_rw rwflag, uio_t *uio);
+ */
+fbt::uiomove:entry
+/self->watched/
+{
+	this->iov = args[3]->uio_iov;
+
+	printf("uiomove %u bytes to %p in pid %d\n",
+	    this->iov->iov_len, this->iov->iov_base, pid);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/rwinfo.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/rwinfo.d
new file mode 100644
index 0000000..866678e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/struct/rwinfo.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+struct callinfo {
+	uint64_t ts;      /* timestamp of last syscall entry */
+	uint64_t elapsed; /* total elapsed time in nanoseconds */
+	uint64_t calls;   /* number of calls made */
+	size_t maxbytes;  /* maximum byte count argument */
+};
+
+struct callinfo i[string];	/* declare i as an associative array */
+
+syscall::read:entry, syscall::write:entry
+/pid == $1/
+{
+	i[probefunc].ts = timestamp;
+	i[probefunc].calls++;
+	i[probefunc].maxbytes = arg2 > i[probefunc].maxbytes ?
+		arg2 : i[probefunc].maxbytes;
+}
+
+syscall::read:return, syscall::write:return
+/i[probefunc].ts != 0 && pid == $1/
+{
+	i[probefunc].elapsed += timestamp - i[probefunc].ts;
+}
+
+END
+{
+	printf("        calls  max bytes  elapsed nsecs\n");
+	printf("------  -----  ---------  -------------\n");
+	printf("  read  %5d  %9d  %d\n",
+	    i["read"].calls, i["read"].maxbytes, i["read"].elapsed);
+	printf(" write  %5d  %9d  %d\n",
+	    i["write"].calls, i["write"].maxbytes, i["write"].elapsed);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/find.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/find.d
new file mode 100644
index 0000000..d927072
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/sysinfo/find.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall:::entry
+/execname == "find"/
+{
+	self->syscall = probefunc;
+	self->insys = 1;
+}
+
+sysinfo:::xcalls
+/execname == "find"/
+{
+	@[self->insys ? self->syscall : "<none>"] = count();
+}
+
+syscall:::return
+/self->insys/
+{
+	self->insys = 0;
+	self->syscall = NULL;
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcp1stbyte.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcp1stbyte.d
new file mode 100755
index 0000000..9400129
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcp1stbyte.d
@@ -0,0 +1,37 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+tcp:::connect-established
+{
+	start[args[1]->cs_cid] = timestamp;
+}
+
+tcp:::receive
+/start[args[1]->cs_cid] && (args[2]->ip_plength - args[4]->tcp_offset) > 0/
+{
+	@latency["1st Byte Latency (ns)", args[2]->ip_saddr] =
+	    quantize(timestamp - start[args[1]->cs_cid]);
+	start[args[1]->cs_cid] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytes.d
new file mode 100755
index 0000000..7fb68de
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytes.d
@@ -0,0 +1,36 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+tcp:::receive
+{
+	@bytes[args[2]->ip_saddr, args[4]->tcp_dport] =
+	    sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+tcp:::send
+{
+	@bytes[args[2]->ip_daddr, args[4]->tcp_sport] =
+	    sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytesstat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytesstat.d
new file mode 100755
index 0000000..ecd9b04
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpbytesstat.d
@@ -0,0 +1,45 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D option quiet
+
+tcp:::receive
+{
+	@bytes[args[2]->ip_saddr, args[4]->tcp_dport] =
+	    sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+tcp:::send
+{
+	@bytes[args[2]->ip_daddr, args[4]->tcp_sport] =
+	    sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+profile:::tick-1sec
+{
+	printf("\n   %-32s %16s\n", "HOST", "BYTES/s");
+	printa("   %-32s %@16d\n", @bytes);
+	trunc(@bytes);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpconnlat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpconnlat.d
new file mode 100755
index 0000000..bc395f9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpconnlat.d
@@ -0,0 +1,37 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+tcp:::connect-request
+{
+	start[args[1]->cs_cid] = timestamp;
+}
+
+tcp:::connect-established
+/start[args[1]->cs_cid] /
+{
+	@latency["Connect Latency (ns)", args[3]->tcps_raddr] =
+	    quantize(timestamp - start[args[1]->cs_cid]);
+	start[args[1]->cs_cid] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpio.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpio.d
new file mode 100755
index 0000000..b362843
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpio.d
@@ -0,0 +1,32 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+tcp:::send,
+tcp:::receive
+{
+	printf("%15s:%-5d  ->  %15s:%-5d",
+	    args[2]->ip_saddr, args[4]->tcp_sport,
+	    args[2]->ip_daddr, args[4]->tcp_dport);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpioflags.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpioflags.d
new file mode 100755
index 0000000..cdfbd2a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpioflags.d
@@ -0,0 +1,64 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=10hz
+
+dtrace:::BEGIN
+{
+	printf(" %15s:%-5s      %15s:%-5s %6s %s\n",
+	    "LADDR", "PORT", "RADDR", "PORT", "BYTES", "FLAGS");
+}
+
+tcp:::send
+{
+	this->length = args[2]->ip_plength - args[4]->tcp_offset;
+	printf(" %15s:%-5d  ->  %15s:%-5d %6d (",
+	    args[2]->ip_saddr, args[4]->tcp_sport,
+	    args[2]->ip_daddr, args[4]->tcp_dport, this->length);
+}
+
+tcp:::receive
+{
+	this->length = args[2]->ip_plength - args[4]->tcp_offset;
+	printf(" %15s:%-5d  <-  %15s:%-5d %6d (",
+	    args[2]->ip_daddr, args[4]->tcp_dport,
+	    args[2]->ip_saddr, args[4]->tcp_sport, this->length);
+}
+
+tcp:::send,
+tcp:::receive
+{
+	printf("%s", args[4]->tcp_flags & TH_FIN ? "FIN|" : "");
+	printf("%s", args[4]->tcp_flags & TH_SYN ? "SYN|" : "");
+	printf("%s", args[4]->tcp_flags & TH_RST ? "RST|" : "");
+	printf("%s", args[4]->tcp_flags & TH_PUSH ? "PUSH|" : "");
+	printf("%s", args[4]->tcp_flags & TH_ACK ? "ACK|" : "");
+	printf("%s", args[4]->tcp_flags & TH_URG ? "URG|" : "");
+	printf("%s", args[4]->tcp_flags & TH_ECE ? "ECE|" : "");
+	printf("%s", args[4]->tcp_flags & TH_CWR ? "CWR|" : "");
+	printf("%s", args[4]->tcp_flags == 0 ? "null " : "");
+	printf("\b)\n");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpsnoop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpsnoop.d
new file mode 100755
index 0000000..9d44519
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpsnoop.d
@@ -0,0 +1,78 @@
+#!/usr/sbin/dtrace -s
+/*
+ * tcpsnoop - snoop TCP network packets by process.
+ *	Written using DTrace tcp Provider.
+ *
+ * This analyses TCP network packets and prints the responsible PID plus
+ * standard details such as IP address and port. This captures traffic
+ * from existing and newly created TCP connections. It can help identify
+ * which processes are causing TCP traffic.
+ *
+ * SEE ALSO: snoop -rS
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Portions Copyright 2010 Brendan Gregg
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=10hz
+
+dtrace:::BEGIN
+{
+	printf("%6s %6s %15s:%-5s      %15s:%-5s %6s %s\n",
+	    "TIME", "PID", "LADDR", "PORT", "RADDR", "PORT", "BYTES", "FLAGS");
+}
+
+tcp:::send
+{
+	this->length = args[2]->ip_plength - args[4]->tcp_offset;
+	printf("%6d %6d %15s:%-5d  ->  %15s:%-5d %6d (",
+	    timestamp/1000, args[1]->cs_pid, args[2]->ip_saddr,
+	    args[4]->tcp_sport, args[2]->ip_daddr, args[4]->tcp_dport,
+	    this->length);
+}
+
+tcp:::receive
+{
+	this->length = args[2]->ip_plength - args[4]->tcp_offset;
+	printf("%6d %6d %15s:%-5d  <-  %15s:%-5d %6d (",
+	    timestamp/1000, args[1]->cs_pid, args[2]->ip_daddr,
+	    args[4]->tcp_dport, args[2]->ip_saddr, args[4]->tcp_sport,
+	    this->length);
+}
+
+tcp:::send,
+tcp:::receive
+{
+	printf("%s", args[4]->tcp_flags & TH_FIN ? "FIN|" : "");
+	printf("%s", args[4]->tcp_flags & TH_SYN ? "SYN|" : "");
+	printf("%s", args[4]->tcp_flags & TH_RST ? "RST|" : "");
+	printf("%s", args[4]->tcp_flags & TH_PUSH ? "PUSH|" : "");
+	printf("%s", args[4]->tcp_flags & TH_ACK ? "ACK|" : "");
+	printf("%s", args[4]->tcp_flags & TH_URG ? "URG|" : "");
+	printf("%s", args[4]->tcp_flags & TH_ECE ? "ECE|" : "");
+	printf("%s", args[4]->tcp_flags & TH_CWR ? "CWR|" : "");
+	printf("%s", args[4]->tcp_flags == 0 ? "null " : "");
+	printf("\b)\n");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpstate.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpstate.d
new file mode 100755
index 0000000..38f0470
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcpstate.d
@@ -0,0 +1,39 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	printf("%-10s %-10s %-20s    %-20s\n", "C", "PID", "PREV", "NEW");
+}
+
+
+tcp:::state-change
+{
+	printf("%-10d %-10d %-20s -> %-20s\n", cpu, args[1]->cs_pid,
+	    tcp_state_string[args[5]->tcps_state],
+	    tcp_state_string[args[3]->tcps_state]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcptop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcptop.d
new file mode 100755
index 0000000..450f496
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/tcp/tcptop.d
@@ -0,0 +1,138 @@
+#!/usr/sbin/dtrace -s
+/*
+ * tcptop: display top TCP network packets by process.
+ *	Written using DTrace tcp Provider.
+ *
+ * Usage: dtrace -s tcptop.d [count] [interval]
+ *
+ * This analyses TCP network packets and prints the responsible PID plus
+ * standard details such as IP address and port. This captures traffic
+ * of newly created TCP connections that were established while this program
+ * was running along with traffic from existing connections. It can help
+ * identify which processes is causing TCP traffic.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Portions Copyright 2010 Brendan Gregg
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+#pragma D option switchrate=10hz
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+	/* starting values */
+	counts = $1 ? $1 : 10;
+	secs = $2 ? $2 : 5;
+	TCP_out = 0;
+	TCP_in = 0;
+
+	printf("Sampling... Please wait.\n");
+}
+
+
+tcp:::send
+/ args[1]->cs_pid != -1 /
+{
+	@out[args[1]->cs_zoneid, args[1]->cs_pid, args[2]->ip_saddr, 
+	    args[4]->tcp_sport, args[2]->ip_daddr, args[4]->tcp_dport] =
+	    sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+tcp:::receive
+/ args[1]->cs_pid != -1 /
+{
+	@out[args[1]->cs_zoneid, args[1]->cs_pid, args[2]->ip_daddr, 
+	    args[4]->tcp_dport, args[2]->ip_saddr, args[4]->tcp_sport] =
+	    sum(args[2]->ip_plength - args[4]->tcp_offset);
+}
+
+/*
+ * TCP Systemwide Stats
+ */
+mib:::tcpOutDataBytes       { TCP_out += args[0]; }
+mib:::tcpRetransBytes       { TCP_out += args[0]; }
+mib:::tcpInDataInorderBytes { TCP_in  += args[0]; }
+mib:::tcpInDataDupBytes     { TCP_in  += args[0]; }
+mib:::tcpInDataUnorderBytes { TCP_in  += args[0]; }
+
+profile:::tick-1sec
+/secs != 0/
+{
+	secs--;
+}
+
+/*
+ * Print Report
+ */
+profile:::tick-1sec
+/secs == 0/
+{
+	/* fetch 1 min load average */
+	this->load1a  = `hp_avenrun[0] / 65536;
+	this->load1b  = ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+	/* convert TCP counters to Kb */
+	TCP_out /= 1024;
+	TCP_in  /= 1024;
+
+	/* print status */
+	printf("%Y,  load: %d.%02d,  TCPin: %6d Kb,  TCPout: %6d Kb\n\n",
+	    walltimestamp, this->load1a, this->load1b, TCP_in, TCP_out);
+
+	/* print headers */
+	printf("%6s %6s %-15s %5s %-15s %5s %9s\n",
+	    "ZONE", "PID", "LADDR", "LPORT", "RADDR", "RPORT", "SIZE");
+
+	/* print data */
+	printa("%6d %6d %-15s %5d %-15s %5d %@9d\n", @out);
+	printf("\n");
+
+	/* clear data */
+	trunc(@out);
+	TCP_in = 0;
+	TCP_out = 0;
+	secs = 5;
+	counts--;
+}
+
+/*
+ * End of program
+ */
+profile:::tick-1sec
+/counts == 0/
+{
+	exit(0);
+}
+
+/*
+ * Cleanup for Ctrl-C
+ */
+dtrace:::END
+{
+	trunc(@out);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytes.d
new file mode 100755
index 0000000..29d85fc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytes.d
@@ -0,0 +1,36 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+udp:::receive
+{
+	@bytes[args[2]->ip_saddr, args[4]->udp_dport] =
+	    sum(args[4]->udp_length);
+}
+
+udp:::send
+{
+	@bytes[args[2]->ip_daddr, args[4]->udp_sport] =
+	    sum(args[4]->udp_length);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytesstat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytesstat.d
new file mode 100755
index 0000000..58fa826
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpbytesstat.d
@@ -0,0 +1,45 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D option quiet
+
+udp:::receive
+{
+	@bytes[args[2]->ip_saddr, args[4]->udp_dport] =
+	    sum(args[4]->udp_length);
+}
+
+udp:::send
+{
+	@bytes[args[2]->ip_daddr, args[4]->udp_sport] =
+	    sum(args[4]->udp_length);
+}
+
+profile:::tick-1sec
+{
+	printf("\n   %-32s %16s\n", "HOST", "BYTES/s");
+	printa("   %-32s %@16d\n", @bytes);
+	trunc(@bytes);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpio.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpio.d
new file mode 100755
index 0000000..78b3f48
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpio.d
@@ -0,0 +1,32 @@
+#!/usr/sbin/dtrace -s
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+udp:::send,
+udp:::receive
+{
+	printf("%15s:%-5d  ->  %15s:%-5d",
+	    args[2]->ip_saddr, args[4]->udp_sport,
+	    args[2]->ip_daddr, args[4]->udp_dport);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpsnoop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpsnoop.d
new file mode 100755
index 0000000..fffc290
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udpsnoop.d
@@ -0,0 +1,59 @@
+#!/usr/sbin/dtrace -s
+/*
+ * udpsnoop - snoop UDP network packets by process.
+ *	Written using DTrace udp Provider.
+ *
+ * This analyses UDP network packets and prints the responsible PID plus
+ * standard details such as IP address and port. This captures traffic
+ * from existing and newly created UDP connections. It can help identify
+ * which processes are causing UDP traffic.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Portions Copyright 2010 Brendan Gregg
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=10hz
+
+dtrace:::BEGIN
+{
+	printf("%6s %6s %15s:%-5s      %15s:%-5s %6s\n",
+	    "TIME", "PID", "LADDR", "PORT", "RADDR", "PORT", "BYTES");
+}
+
+udp:::send
+{
+	printf("%6d %6d %15s:%-5d  ->  %15s:%-5d %6d\n",
+	    timestamp/1000, args[1]->cs_pid, args[2]->ip_saddr,
+	    args[4]->udp_sport, args[2]->ip_daddr, args[4]->udp_dport,
+	    args[4]->udp_length);
+}
+
+udp:::receive
+{
+	printf("%6d %6d %15s:%-5d  <-  %15s:%-5d %6d\n",
+	    timestamp/1000, args[1]->cs_pid, args[2]->ip_daddr,
+	    args[4]->udp_dport, args[2]->ip_saddr, args[4]->udp_sport,
+	    args[4]->udp_length);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udptop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udptop.d
new file mode 100755
index 0000000..a626e57
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/udp/udptop.d
@@ -0,0 +1,133 @@
+#!/usr/sbin/dtrace -s
+/*
+ * udptop: display top UDP network packets by process.
+ *	Written using DTrace udp Provider.
+ *
+ * Usage: dtrace -s udptop.d [count] [interval]
+ *
+ * This analyses UDP network packets and prints the responsible PID plus
+ * standard details such as IP address and port. This captures traffic
+ * of newly created UDP connections that were established while this program
+ * was running along with traffic from existing connections. It can help
+ * identify which processes is causing UDP traffic.
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Portions Copyright 2010 Brendan Gregg
+ */
+
+#pragma D option quiet
+#pragma D option defaultargs
+#pragma D option switchrate=10hz
+
+/*
+ * Print header
+ */
+dtrace:::BEGIN
+{
+	/* starting values */
+	counts = $1 ? $1 : 10;
+	secs = $2 ? $2 : 5;
+	UDP_out = 0;
+	UDP_in = 0;
+
+	printf("Sampling... Please wait.\n");
+}
+
+
+udp:::send
+/ args[1]->cs_pid != -1 /
+{
+	@out[args[1]->cs_zoneid, args[1]->cs_pid, args[2]->ip_saddr, 
+	    args[4]->udp_sport, args[2]->ip_daddr, args[4]->udp_dport] =
+	    sum(args[4]->udp_length);
+}
+
+udp:::receive
+/ args[1]->cs_pid != -1 /
+{
+	@out[args[1]->cs_zoneid, args[1]->cs_pid, args[2]->ip_daddr, 
+	    args[4]->udp_dport, args[2]->ip_saddr, args[4]->udp_sport] =
+	    sum(args[4]->udp_length);
+}
+
+/*
+ * UDP Systemwide Stats
+ */
+mib:::udpHCOutDatagrams		{ UDP_out += args[0]; }
+mib:::udpHCInDatagrams		{ UDP_in  += args[0]; }
+
+profile:::tick-1sec
+/secs != 0/
+{
+	secs--;
+}
+
+/*
+ * Print Report
+ */
+profile:::tick-1sec
+/secs == 0/
+{
+	/* fetch 1 min load average */
+	this->load1a  = `hp_avenrun[0] / 65536;
+	this->load1b  = ((`hp_avenrun[0] % 65536) * 100) / 65536;
+
+	/* print status */
+	printf(%Y,  load: %d.%02d,  UDP datagrams in: %6d, ",
+	    walltimestamp, this->load1a, this->load1b, UDP_in);
+	printf("UDP datagrams out: %6d\n\n", UDP_out);
+
+	/* print headers */
+	printf("%6s %6s %-15s %5s %-15s %5s %9s\n",
+	    "ZONE", "PID", "LADDR", "LPORT", "RADDR", "RPORT", "SIZE");
+
+	/* print data */
+	printa("%6d %6d %-15s %5d %-15s %5d %@9d\n", @out);
+	printf("\n");
+
+	/* clear data */
+	trunc(@out);
+	UDP_in = 0;
+	UDP_out = 0;
+	secs = 5;
+	counts--;
+}
+
+/*
+ * End of program
+ */
+profile:::tick-1sec
+/counts == 0/
+{
+	exit(0);
+}
+
+/*
+ * Cleanup for Ctrl-C
+ */
+dtrace:::END
+{
+	trunc(@out);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/badopen.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/badopen.d
new file mode 100644
index 0000000..7e6d22b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/badopen.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::open:entry
+/pid == $1/
+{
+	self->path = copyinstr(arg0);
+}
+
+syscall::open:return
+/self->path != NULL && arg1 == -1/
+{
+	printf("open for '%s' failed", self->path);
+	ustack();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/errorpath.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/errorpath.d
new file mode 100644
index 0000000..95c82e5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/errorpath.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+pid$1::$2:entry
+{
+	self->spec = speculation();
+	speculate(self->spec);
+	printf("%x %x %x %x %x", arg0, arg1, arg2, arg3, arg4);
+}
+
+pid$1::$2:
+/self->spec/
+{
+	speculate(self->spec);
+}
+
+pid$1::$2:return
+/self->spec && arg1 == 0/
+{
+	discard(self->spec);
+	self->spec = 0;
+}
+
+pid$1::$2:return
+/self->spec && arg1 != 0/
+{
+	commit(self->spec);
+	self->spec = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/libc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/libc.d
new file mode 100644
index 0000000..92b20cf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/libc.d
@@ -0,0 +1,30 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+pid$target:libc.so::entry
+{
+	@[probefunc] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/userfunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/userfunc.d
new file mode 100644
index 0000000..0c98d67
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/user/userfunc.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+pid$1::$2:entry
+{
+	self->trace = 1;
+}
+
+pid$1::$2:return
+/self->trace/
+{
+	self->trace = 0;
+}
+
+pid$1:::entry,
+pid$1:::return
+/self->trace/
+{
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/clause.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/clause.d
new file mode 100644
index 0000000..056329f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/clause.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+int me;			/* an integer global variable */
+this int foo;		/* an integer clause-local variable */
+
+tick-1sec
+{
+	/*
+	 * Set foo to be 10 if and only if this is the first clause executed.
+	 */
+	this->foo = (me % 3 == 0) ? 10 : this->foo;
+	printf("Clause 1 is number %d; foo is %d\n", me++ % 3, this->foo++);
+}
+
+tick-1sec
+{
+	/*
+	 * Set foo to be 20 if and only if this is the first clause executed. 
+	 */
+	this->foo = (me % 3 == 0) ? 20 : this->foo;
+	printf("Clause 2 is number %d; foo is %d\n", me++ % 3, this->foo++);
+}
+
+tick-1sec
+{
+	/*
+	 * Set foo to be 30 if and only if this is the first clause executed.
+	 */
+	this->foo = (me % 3 == 0) ? 30 : this->foo;
+	printf("Clause 3 is number %d; foo is %d\n", me++ % 3, this->foo++);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/rtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/rtime.d
new file mode 100644
index 0000000..e2db52f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vars/rtime.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+syscall::read:entry
+{
+	self->t = timestamp;
+}
+
+syscall::read:return
+/self->t != 0/
+{
+	printf("%d/%d spent %d nsecs in read(2)\n",
+	    pid, tid, timestamp - self->t);
+	
+	/*
+	 * We're done with this thread-local variable; assign zero to it to
+	 * allow the DTrace runtime to reclaim the underlying storage.
+	 */
+	self->t = 0;
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/soffice.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/soffice.d
new file mode 100644
index 0000000..fa6435c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/demo/vminfo/soffice.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+vminfo:::maj_fault,
+vminfo:::zfod,
+vminfo:::as_fault
+/execname == "soffice.bin" && start == 0/
+{
+	/*
+	 * This is the first time that a vminfo probe has been hit; record
+	 * our initial timestamp.
+	 */
+	start = timestamp;
+}
+
+vminfo:::maj_fault,
+vminfo:::zfod,
+vminfo:::as_fault
+/execname == "soffice.bin"/
+{
+	/*
+	 * Aggregate on the probename, and lquantize() the number of seconds
+	 * since our initial timestamp.  (There are 1,000,000,000 nanoseconds
+	 * in a second.)  We assume that the script will be terminated before
+	 * 60 seconds elapses.
+	 */
+	@[probename] =
+	    lquantize((timestamp - start) / 1000000000, 0, 60);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/dtrace.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/dtrace.c
new file mode 100644
index 0000000..3963416
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/dtrace.c
@@ -0,0 +1,2025 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#ifndef _MSC_VER
+# include <sys/wait.h>
+#endif
+
+#include <dtrace.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#ifndef VBOX
+# include <strings.h>
+#endif
+#ifndef _MSC_VER
+# include <unistd.h>
+#else
+# include <direct.h>
+# include <io.h>
+#endif
+#include <limits.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#ifndef VBOX
+#include <alloca.h>
+#include <libgen.h>
+#include <libproc.h>
+#endif
+
+#ifdef VBOX
+# include <stdio.h>
+
+# include <iprt/alloca.h>
+# include <iprt/getopt.h>
+# include <iprt/initterm.h>
+# include <iprt/path.h>
+# include <iprt/message.h>
+# include <iprt/process.h>
+# include <iprt/string.h>
+
+# include "VBoxDTraceLibCWrappers.h"
+
+# ifdef _MSC_VER
+#  pragma warning(disable:4267) /* size_t conversion warnings */
+#  pragma warning(disable:4018) /* signed/unsigned mismatch */
+# endif
+#endif
+
+typedef struct dtrace_cmd {
+	void (*dc_func)(struct dtrace_cmd *);	/* function to compile arg */
+	dtrace_probespec_t dc_spec;		/* probe specifier context */
+	char *dc_arg;				/* argument from main argv */
+	const char *dc_name;			/* name for error messages */
+	const char *dc_desc;			/* desc for error messages */
+	dtrace_prog_t *dc_prog;			/* program compiled from arg */
+	char dc_ofile[PATH_MAX];		/* derived output file name */
+} dtrace_cmd_t;
+
+#define	DMODE_VERS	0	/* display version information and exit (-V) */
+#define	DMODE_EXEC	1	/* compile program for enabling (-a/e/E) */
+#define	DMODE_ANON	2	/* compile program for anonymous tracing (-A) */
+#define	DMODE_LINK	3	/* compile program for linking with ELF (-G) */
+#define	DMODE_LIST	4	/* compile program and list probes (-l) */
+#define	DMODE_HEADER	5	/* compile program for headergen (-h) */
+
+#define	E_SUCCESS	0
+#define	E_ERROR		1
+#define	E_USAGE		2
+
+#ifndef VBOX
+static const char DTRACE_OPTSTR[] =
+	"3:6:aAb:Bc:CD:ef:FGhHi:I:lL:m:n:o:p:P:qs:SU:vVwx:X:Z";
+#else
+static const RTGETOPTDEF g_aOptions[] =
+{
+	{ "-32", 10064, RTGETOPT_REQ_NOTHING },
+	{ "-64", 10032, RTGETOPT_REQ_NOTHING },
+	{ NULL, 'a', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'A', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'b', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'B', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'c', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'C', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'D', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'e', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'f', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'F', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'G', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'h', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'H', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'i', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'I', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'l', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'L', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'M', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'n', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'o', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'p', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'P', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'q', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 's', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'S', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'U', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'v', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'V', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'w', 	RTGETOPT_REQ_NOTHING },
+	{ NULL, 'x', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'X', 	RTGETOPT_REQ_STRING },
+	{ NULL, 'Z', 	RTGETOPT_REQ_NOTHING },
+};
+#endif /* VBOX */
+
+
+static char **g_argv;
+static int g_argc;
+#ifndef VBOX /* No linking. */
+static char **g_objv;
+static int g_objc;
+#endif
+static dtrace_cmd_t *g_cmdv;
+static int g_cmdc;
+static struct ps_prochandle **g_psv;
+static int g_psc;
+static int g_pslive;
+static char *g_pname;
+static int g_quiet;
+static int g_flowindent;
+static int g_intr;
+static int g_impatient;
+static int g_newline;
+static int g_total;
+static int g_cflags;
+static int g_oflags;
+static int g_verbose;
+static int g_exec = 1;
+static int g_mode = DMODE_EXEC;
+static int g_status = E_SUCCESS;
+static int g_grabanon = 0;
+static const char *g_ofile = NULL;
+#ifndef VBOX /* stdout isn't a necessarily constant usable like this in C code. */
+static FILE *g_ofp = stdout;
+#else
+static FILE *g_ofp = NULL;
+#endif
+static dtrace_hdl_t *g_dtp;
+static char *g_etcfile = "/etc/system";
+static const char *g_etcbegin = "* vvvv Added by DTrace";
+static const char *g_etcend = "* ^^^^ Added by DTrace";
+
+static const char *g_etc[] =  {
+"*",
+"* The following forceload directives were added by dtrace(1M) to allow for",
+"* tracing during boot.  If these directives are removed, the system will",
+"* continue to function, but tracing will not occur during boot as desired.",
+"* To remove these directives (and this block comment) automatically, run",
+"* \"dtrace -A\" without additional arguments.  See the \"Anonymous Tracing\"",
+"* chapter of the Solaris Dynamic Tracing Guide for details.",
+"*",
+NULL };
+
+static int
+usage(FILE *fp)
+{
+	static const char predact[] = "[[ predicate ] action ]";
+
+	(void) fprintf(fp, "Usage: %s [-32|-64] [-aACeFGhHlqSvVwZ] "
+	    "[-b bufsz] [-c cmd] [-D name[=def]]\n\t[-I path] [-L path] "
+	    "[-o output] [-p pid] [-s script] [-U name]\n\t"
+	    "[-x opt[=val]] [-X a|c|s|t]\n\n"
+	    "\t[-P provider %s]\n"
+	    "\t[-m [ provider: ] module %s]\n"
+	    "\t[-f [[ provider: ] module: ] func %s]\n"
+	    "\t[-n [[[ provider: ] module: ] func: ] name %s]\n"
+	    "\t[-i probe-id %s] [ args ... ]\n\n", g_pname,
+	    predact, predact, predact, predact, predact);
+
+	(void) fprintf(fp, "\tpredicate -> '/' D-expression '/'\n");
+	(void) fprintf(fp, "\t   action -> '{' D-statements '}'\n");
+
+	(void) fprintf(fp, "\n"
+	    "\t-32 generate 32-bit D programs and ELF files\n"
+	    "\t-64 generate 64-bit D programs and ELF files\n\n"
+	    "\t-a  claim anonymous tracing state\n"
+	    "\t-A  generate driver.conf(4) directives for anonymous tracing\n"
+	    "\t-b  set trace buffer size\n"
+	    "\t-c  run specified command and exit upon its completion\n"
+	    "\t-C  run cpp(1) preprocessor on script files\n"
+	    "\t-D  define symbol when invoking preprocessor\n"
+	    "\t-e  exit after compiling request but prior to enabling probes\n"
+	    "\t-f  enable or list probes matching the specified function name\n"
+	    "\t-F  coalesce trace output by function\n"
+	    "\t-G  generate an ELF file containing embedded dtrace program\n"
+	    "\t-h  generate a header file with definitions for static probes\n"
+	    "\t-H  print included files when invoking preprocessor\n"
+	    "\t-i  enable or list probes matching the specified probe id\n"
+	    "\t-I  add include directory to preprocessor search path\n"
+	    "\t-l  list probes matching specified criteria\n"
+	    "\t-L  add library directory to library search path\n"
+	    "\t-m  enable or list probes matching the specified module name\n"
+	    "\t-n  enable or list probes matching the specified probe name\n"
+	    "\t-o  set output file\n"
+	    "\t-p  grab specified process-ID and cache its symbol tables\n"
+	    "\t-P  enable or list probes matching the specified provider name\n"
+	    "\t-q  set quiet mode (only output explicitly traced data)\n"
+	    "\t-s  enable or list probes according to the specified D script\n"
+	    "\t-S  print D compiler intermediate code\n"
+	    "\t-U  undefine symbol when invoking preprocessor\n"
+	    "\t-v  set verbose mode (report stability attributes, arguments)\n"
+	    "\t-V  report DTrace API version\n"
+	    "\t-w  permit destructive actions\n"
+	    "\t-x  enable or modify compiler and tracing options\n"
+	    "\t-X  specify ISO C conformance settings for preprocessor\n"
+	    "\t-Z  permit probe descriptions that match zero probes\n");
+
+	return (E_USAGE);
+}
+
+static void
+verror(const char *fmt, va_list ap)
+{
+	int error = errno;
+
+	(void) fprintf(stderr, "%s: ", g_pname);
+	(void) vfprintf(stderr, fmt, ap);
+
+	if (fmt[strlen(fmt) - 1] != '\n')
+		(void) fprintf(stderr, ": %s\n", strerror(error));
+}
+
+/*PRINTFLIKE1*/
+static void
+fatal(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	verror(fmt, ap);
+	va_end(ap);
+
+	exit(E_ERROR);
+}
+
+/*PRINTFLIKE1*/
+static void
+dfatal(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+
+	(void) fprintf(stderr, "%s: ", g_pname);
+	if (fmt != NULL)
+		(void) vfprintf(stderr, fmt, ap);
+
+	va_end(ap);
+
+	if (fmt != NULL && fmt[strlen(fmt) - 1] != '\n') {
+		(void) fprintf(stderr, ": %s\n",
+		    dtrace_errmsg(g_dtp, dtrace_errno(g_dtp)));
+	} else if (fmt == NULL) {
+		(void) fprintf(stderr, "%s\n",
+		    dtrace_errmsg(g_dtp, dtrace_errno(g_dtp)));
+	}
+
+	/*
+	 * Close the DTrace handle to ensure that any controlled processes are
+	 * correctly restored and continued.
+	 */
+	dtrace_close(g_dtp);
+
+	exit(E_ERROR);
+}
+
+/*PRINTFLIKE1*/
+static void
+error(const char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+	verror(fmt, ap);
+	va_end(ap);
+}
+
+/*PRINTFLIKE1*/
+static void
+notice(const char *fmt, ...)
+{
+	va_list ap;
+
+	if (g_quiet)
+		return; /* -q or quiet pragma suppresses notice()s */
+
+	va_start(ap, fmt);
+	verror(fmt, ap);
+	va_end(ap);
+}
+
+/*PRINTFLIKE1*/
+static void
+oprintf(const char *fmt, ...)
+{
+	va_list ap;
+	int n;
+
+	if (g_ofp == NULL)
+		return;
+
+	va_start(ap, fmt);
+	n = vfprintf(g_ofp, fmt, ap);
+	va_end(ap);
+
+	if (n < 0) {
+		if (errno != EINTR) {
+			fatal("failed to write to %s",
+			    g_ofile ? g_ofile : "<stdout>");
+		}
+		clearerr(g_ofp);
+	}
+}
+
+static char **
+make_argv(char *s)
+{
+	const char *ws = "\f\n\r\t\v ";
+	char **argv = malloc(sizeof (char *) * (strlen(s) / 2 + 1));
+	int argc = 0;
+	char *p = s;
+
+	if (argv == NULL)
+		return (NULL);
+
+	for (p = strtok(s, ws); p != NULL; p = strtok(NULL, ws))
+		argv[argc++] = p;
+
+	if (argc == 0)
+		argv[argc++] = s;
+
+	argv[argc] = NULL;
+	return (argv);
+}
+
+static void
+dof_prune(const char *fname)
+{
+	struct stat sbuf;
+	size_t sz, i, j, mark, len;
+	char *buf;
+	int msg = 0, fd;
+
+	if ((fd = open(fname, O_RDONLY)) == -1) {
+		/*
+		 * This is okay only if the file doesn't exist at all.
+		 */
+		if (errno != ENOENT)
+			fatal("failed to open %s", fname);
+		return;
+	}
+
+	if (fstat(fd, &sbuf) == -1)
+		fatal("failed to fstat %s", fname);
+
+	if ((buf = malloc((sz = sbuf.st_size) + 1)) == NULL)
+		fatal("failed to allocate memory for %s", fname);
+
+	if (read(fd, buf, sz) != sz)
+		fatal("failed to read %s", fname);
+
+	buf[sz] = '\0';
+	(void) close(fd);
+
+	if ((fd = open(fname, O_WRONLY | O_TRUNC)) == -1)
+		fatal("failed to open %s for writing", fname);
+
+	len = strlen("dof-data-");
+
+	for (mark = 0, i = 0; i < sz; i++) {
+		if (strncmp(&buf[i], "dof-data-", len) != 0)
+			continue;
+
+		/*
+		 * This is only a match if it's in the 0th column.
+		 */
+		if (i != 0 && buf[i - 1] != '\n')
+			continue;
+
+		if (msg++ == 0) {
+			error("cleaned up old anonymous "
+			    "enabling in %s\n", fname);
+		}
+
+		/*
+		 * We have a match.  First write out our data up until now.
+		 */
+		if (i != mark) {
+			if (write(fd, &buf[mark], i - mark) != i - mark)
+				fatal("failed to write to %s", fname);
+		}
+
+		/*
+		 * Now scan forward until we scan past a newline.
+		 */
+		for (j = i; j < sz && buf[j] != '\n'; j++)
+			continue;
+
+		/*
+		 * Reset our mark.
+		 */
+		if ((mark = j + 1) >= sz)
+			break;
+
+		i = j;
+	}
+
+	if (mark < sz) {
+		if (write(fd, &buf[mark], sz - mark) != sz - mark)
+			fatal("failed to write to %s", fname);
+	}
+
+	(void) close(fd);
+	free(buf);
+}
+
+static void
+etcsystem_prune(void)
+{
+	struct stat sbuf;
+	size_t sz;
+	char *buf, *start, *end;
+	int fd;
+	char *fname = g_etcfile, *tmpname;
+
+	if ((fd = open(fname, O_RDONLY)) == -1)
+		fatal("failed to open %s", fname);
+
+	if (fstat(fd, &sbuf) == -1)
+		fatal("failed to fstat %s", fname);
+
+	if ((buf = malloc((sz = sbuf.st_size) + 1)) == NULL)
+		fatal("failed to allocate memory for %s", fname);
+
+	if (read(fd, buf, sz) != sz)
+		fatal("failed to read %s", fname);
+
+	buf[sz] = '\0';
+	(void) close(fd);
+
+	if ((start = strstr(buf, g_etcbegin)) == NULL)
+		goto out;
+
+	if (strlen(buf) != sz) {
+		fatal("embedded nul byte in %s; manual repair of %s "
+		    "required\n", fname, fname);
+	}
+
+	if (strstr(start + 1, g_etcbegin) != NULL) {
+		fatal("multiple start sentinels in %s; manual repair of %s "
+		    "required\n", fname, fname);
+	}
+
+	if ((end = strstr(buf, g_etcend)) == NULL) {
+		fatal("missing end sentinel in %s; manual repair of %s "
+		    "required\n", fname, fname);
+	}
+
+	if (start > end) {
+		fatal("end sentinel preceeds start sentinel in %s; manual "
+		    "repair of %s required\n", fname, fname);
+	}
+
+	end += strlen(g_etcend) + 1;
+	bcopy(end, start, strlen(end) + 1);
+
+	tmpname = alloca(sz = strlen(fname) + 80);
+	(void) snprintf(tmpname, sz, "%s.dtrace.%d", fname, getpid());
+
+	if ((fd = open(tmpname,
+	    O_WRONLY | O_CREAT | O_EXCL, sbuf.st_mode)) == -1)
+		fatal("failed to create %s", tmpname);
+
+	if (write(fd, buf, strlen(buf)) < strlen(buf)) {
+		(void) unlink(tmpname);
+		fatal("failed to write to %s", tmpname);
+	}
+
+	(void) close(fd);
+
+#ifndef _MSC_VER
+	if (chown(tmpname, sbuf.st_uid, sbuf.st_gid) != 0) {
+		(void) unlink(tmpname);
+		fatal("failed to chown(2) %s to uid %d, gid %d", tmpname,
+		    (int)sbuf.st_uid, (int)sbuf.st_gid);
+	}
+#endif
+
+	if (rename(tmpname, fname) == -1)
+		fatal("rename of %s to %s failed", tmpname, fname);
+
+	error("cleaned up forceload directives in %s\n", fname);
+out:
+	free(buf);
+}
+
+static void
+etcsystem_add(void)
+{
+	const char *mods[20];
+	int nmods, line;
+
+	if ((g_ofp = fopen(g_ofile = g_etcfile, "a")) == NULL)
+		fatal("failed to open output file '%s'", g_ofile);
+
+	oprintf("%s\n", g_etcbegin);
+
+	for (line = 0; g_etc[line] != NULL; line++)
+		oprintf("%s\n", g_etc[line]);
+
+	nmods = dtrace_provider_modules(g_dtp, mods,
+	    sizeof (mods) / sizeof (char *) - 1);
+
+	if (nmods >= sizeof (mods) / sizeof (char *))
+		fatal("unexpectedly large number of modules!");
+
+	mods[nmods++] = "dtrace";
+
+	for (line = 0; line < nmods; line++)
+		oprintf("forceload: drv/%s\n", mods[line]);
+
+	oprintf("%s\n", g_etcend);
+
+	if (fclose(g_ofp) == EOF)
+		fatal("failed to close output file '%s'", g_ofile);
+
+	error("added forceload directives to %s\n", g_ofile);
+}
+
+static void
+print_probe_info(const dtrace_probeinfo_t *p)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	oprintf("\n\tProbe Description Attributes\n");
+
+	oprintf("\t\tIdentifier Names: %s\n",
+	    dtrace_stability_name(p->dtp_attr.dtat_name));
+	oprintf("\t\tData Semantics:   %s\n",
+	    dtrace_stability_name(p->dtp_attr.dtat_data));
+	oprintf("\t\tDependency Class: %s\n",
+	    dtrace_class_name(p->dtp_attr.dtat_class));
+
+	oprintf("\n\tArgument Attributes\n");
+
+	oprintf("\t\tIdentifier Names: %s\n",
+	    dtrace_stability_name(p->dtp_arga.dtat_name));
+	oprintf("\t\tData Semantics:   %s\n",
+	    dtrace_stability_name(p->dtp_arga.dtat_data));
+	oprintf("\t\tDependency Class: %s\n",
+	    dtrace_class_name(p->dtp_arga.dtat_class));
+
+	oprintf("\n\tArgument Types\n");
+
+	for (i = 0; i < p->dtp_argc; i++) {
+		if (ctf_type_name(p->dtp_argv[i].dtt_ctfp,
+		    p->dtp_argv[i].dtt_type, buf, sizeof (buf)) == NULL)
+			(void) strlcpy(buf, "(unknown)", sizeof (buf));
+		oprintf("\t\targs[%d]: %s\n", i, buf);
+	}
+
+	if (p->dtp_argc == 0)
+		oprintf("\t\tNone\n");
+
+	oprintf("\n");
+}
+
+/*ARGSUSED*/
+static int
+info_stmt(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
+    dtrace_stmtdesc_t *stp, dtrace_ecbdesc_t **last)
+{
+	dtrace_ecbdesc_t *edp = stp->dtsd_ecbdesc;
+	dtrace_probedesc_t *pdp = &edp->dted_probe;
+	dtrace_probeinfo_t p;
+
+	if (edp == *last)
+		return (0);
+
+	oprintf("\n%s:%s:%s:%s\n",
+	    pdp->dtpd_provider, pdp->dtpd_mod, pdp->dtpd_func, pdp->dtpd_name);
+
+	if (dtrace_probe_info(dtp, pdp, &p) == 0)
+		print_probe_info(&p);
+
+	*last = edp;
+	return (0);
+}
+
+/*
+ * Execute the specified program by enabling the corresponding instrumentation.
+ * If -e has been specified, we get the program info but do not enable it.  If
+ * -v has been specified, we print a stability report for the program.
+ */
+static void
+exec_prog(const dtrace_cmd_t *dcp)
+{
+	dtrace_ecbdesc_t *last = NULL;
+	dtrace_proginfo_t dpi;
+
+	if (!g_exec) {
+		dtrace_program_info(g_dtp, dcp->dc_prog, &dpi);
+	} else if (dtrace_program_exec(g_dtp, dcp->dc_prog, &dpi) == -1) {
+		dfatal("failed to enable '%s'", dcp->dc_name);
+	} else {
+		notice("%s '%s' matched %u probe%s\n",
+		    dcp->dc_desc, dcp->dc_name,
+		    dpi.dpi_matches, dpi.dpi_matches == 1 ? "" : "s");
+	}
+
+	if (g_verbose) {
+		oprintf("\nStability attributes for %s %s:\n",
+		    dcp->dc_desc, dcp->dc_name);
+
+		oprintf("\n\tMinimum Probe Description Attributes\n");
+		oprintf("\t\tIdentifier Names: %s\n",
+		    dtrace_stability_name(dpi.dpi_descattr.dtat_name));
+		oprintf("\t\tData Semantics:   %s\n",
+		    dtrace_stability_name(dpi.dpi_descattr.dtat_data));
+		oprintf("\t\tDependency Class: %s\n",
+		    dtrace_class_name(dpi.dpi_descattr.dtat_class));
+
+		oprintf("\n\tMinimum Statement Attributes\n");
+
+		oprintf("\t\tIdentifier Names: %s\n",
+		    dtrace_stability_name(dpi.dpi_stmtattr.dtat_name));
+		oprintf("\t\tData Semantics:   %s\n",
+		    dtrace_stability_name(dpi.dpi_stmtattr.dtat_data));
+		oprintf("\t\tDependency Class: %s\n",
+		    dtrace_class_name(dpi.dpi_stmtattr.dtat_class));
+
+		if (!g_exec) {
+			(void) dtrace_stmt_iter(g_dtp, dcp->dc_prog,
+			    (dtrace_stmt_f *)info_stmt, &last);
+		} else
+			oprintf("\n");
+	}
+
+	g_total += dpi.dpi_matches;
+}
+
+/*
+ * Print out the specified DOF buffer as a set of ASCII bytes appropriate for
+ * storing in a driver.conf(4) file associated with the dtrace driver.
+ */
+static void
+anon_prog(const dtrace_cmd_t *dcp, dof_hdr_t *dof, int n)
+{
+	const uchar_t *p, *q;
+
+	if (dof == NULL)
+		dfatal("failed to create DOF image for '%s'", dcp->dc_name);
+
+	p = (uchar_t *)dof;
+	q = p + dof->dofh_loadsz;
+
+	oprintf("dof-data-%d=0x%x", n, *p++);
+
+	while (p < q)
+		oprintf(",0x%x", *p++);
+
+	oprintf(";\n");
+	dtrace_dof_destroy(g_dtp, dof);
+}
+
+#ifndef VBOX
+/*
+ * Link the specified D program in DOF form into an ELF file for use in either
+ * helpers, userland provider definitions, or both.  If -o was specified, that
+ * path is used as the output file name.  If -o wasn't specified and the input
+ * program is from a script whose name is %.d, use basename(%.o) as the output
+ * file name.  Otherwise we use "d.out" as the default output file name.
+ */
+static void
+link_prog(dtrace_cmd_t *dcp)
+{
+	char *p;
+
+	if (g_cmdc == 1 && g_ofile != NULL) {
+		(void) strlcpy(dcp->dc_ofile, g_ofile, sizeof (dcp->dc_ofile));
+	} else if ((p = strrchr(dcp->dc_arg, '.')) != NULL &&
+	    strcmp(p, ".d") == 0) {
+		p[0] = '\0'; /* strip .d suffix */
+		(void) snprintf(dcp->dc_ofile, sizeof (dcp->dc_ofile),
+		    "%s.o", basename(dcp->dc_arg));
+	} else {
+		(void) snprintf(dcp->dc_ofile, sizeof (dcp->dc_ofile),
+		    g_cmdc > 1 ?  "%s.%d" : "%s", "d.out", (int)(dcp - g_cmdv));
+	}
+
+	if (dtrace_program_link(g_dtp, dcp->dc_prog, DTRACE_D_PROBES,
+	    dcp->dc_ofile, g_objc, g_objv) != 0)
+		dfatal("failed to link %s %s", dcp->dc_desc, dcp->dc_name);
+}
+#endif /* !VBOX */
+
+/*ARGSUSED*/
+static int
+list_probe(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *arg)
+{
+	dtrace_probeinfo_t p;
+
+	oprintf("%5d %10s %17s %33s %s\n", pdp->dtpd_id,
+	    pdp->dtpd_provider, pdp->dtpd_mod, pdp->dtpd_func, pdp->dtpd_name);
+
+	if (g_verbose && dtrace_probe_info(dtp, pdp, &p) == 0)
+		print_probe_info(&p);
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+list_stmt(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
+    dtrace_stmtdesc_t *stp, dtrace_ecbdesc_t **last)
+{
+	dtrace_ecbdesc_t *edp = stp->dtsd_ecbdesc;
+
+	if (edp == *last)
+		return (0);
+
+	if (dtrace_probe_iter(g_dtp, &edp->dted_probe, list_probe, NULL) != 0) {
+		error("failed to match %s:%s:%s:%s: %s\n",
+		    edp->dted_probe.dtpd_provider, edp->dted_probe.dtpd_mod,
+		    edp->dted_probe.dtpd_func, edp->dted_probe.dtpd_name,
+		    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+	}
+
+	*last = edp;
+	return (0);
+}
+
+/*
+ * List the probes corresponding to the specified program by iterating over
+ * each statement and then matching probes to the statement probe descriptions.
+ */
+static void
+list_prog(const dtrace_cmd_t *dcp)
+{
+	dtrace_ecbdesc_t *last = NULL;
+
+	(void) dtrace_stmt_iter(g_dtp, dcp->dc_prog,
+	    (dtrace_stmt_f *)list_stmt, &last);
+}
+
+static void
+compile_file(dtrace_cmd_t *dcp)
+{
+	char *arg0;
+	FILE *fp;
+
+	if ((fp = fopen(dcp->dc_arg, "r")) == NULL)
+		fatal("failed to open %s", dcp->dc_arg);
+
+	arg0 = g_argv[0];
+	g_argv[0] = dcp->dc_arg;
+
+	if ((dcp->dc_prog = dtrace_program_fcompile(g_dtp, fp,
+	    g_cflags, g_argc, g_argv)) == NULL)
+		dfatal("failed to compile script %s", dcp->dc_arg);
+
+	g_argv[0] = arg0;
+	(void) fclose(fp);
+
+	dcp->dc_desc = "script";
+	dcp->dc_name = dcp->dc_arg;
+}
+
+static void
+compile_str(dtrace_cmd_t *dcp)
+{
+	char *p;
+
+	if ((dcp->dc_prog = dtrace_program_strcompile(g_dtp, dcp->dc_arg,
+	    dcp->dc_spec, g_cflags | DTRACE_C_PSPEC, g_argc, g_argv)) == NULL)
+		dfatal("invalid probe specifier %s", dcp->dc_arg);
+
+	if ((p = strpbrk(dcp->dc_arg, "{/;")) != NULL)
+		*p = '\0'; /* crop name for reporting */
+
+	dcp->dc_desc = "description";
+	dcp->dc_name = dcp->dc_arg;
+}
+
+/*ARGSUSED*/
+static void
+prochandler(struct ps_prochandle *P, const char *msg, void *arg)
+{
+#ifndef VBOX
+	const psinfo_t *prp = Ppsinfo(P);
+	int pid = Pstatus(P)->pr_pid;
+	char name[SIG2STR_MAX];
+
+	if (msg != NULL) {
+		notice("pid %d: %s\n", pid, msg);
+		return;
+	}
+
+	switch (Pstate(P)) {
+	case PS_UNDEAD:
+		/*
+		 * Ideally we would like to always report pr_wstat here, but it
+		 * isn't possible given current /proc semantics.  If we grabbed
+		 * the process, Ppsinfo() will either fail or return a zeroed
+		 * psinfo_t depending on how far the parent is in reaping it.
+		 * When /proc provides a stable pr_wstat in the status file,
+		 * this code can be improved by examining this new pr_wstat.
+		 */
+		if (prp != NULL && WIFSIGNALED(prp->pr_wstat)) {
+			notice("pid %d terminated by %s\n", pid,
+			    proc_signame(WTERMSIG(prp->pr_wstat),
+			    name, sizeof (name)));
+		} else if (prp != NULL && WEXITSTATUS(prp->pr_wstat) != 0) {
+			notice("pid %d exited with status %d\n",
+			    pid, WEXITSTATUS(prp->pr_wstat));
+		} else {
+			notice("pid %d has exited\n", pid);
+		}
+		g_pslive--;
+		break;
+
+	case PS_LOST:
+		notice("pid %d exec'd a set-id or unobservable program\n", pid);
+		g_pslive--;
+		break;
+	}
+#endif /* !VBOX */
+}
+
+/*ARGSUSED*/
+static int
+errhandler(const dtrace_errdata_t *data, void *arg)
+{
+	error(data->dteda_msg);
+	return (DTRACE_HANDLE_OK);
+}
+
+/*ARGSUSED*/
+static int
+drophandler(const dtrace_dropdata_t *data, void *arg)
+{
+	error(data->dtdda_msg);
+	return (DTRACE_HANDLE_OK);
+}
+
+/*ARGSUSED*/
+static int
+setopthandler(const dtrace_setoptdata_t *data, void *arg)
+{
+	if (strcmp(data->dtsda_option, "quiet") == 0)
+		g_quiet = data->dtsda_newval != DTRACEOPT_UNSET;
+
+	if (strcmp(data->dtsda_option, "flowindent") == 0)
+		g_flowindent = data->dtsda_newval != DTRACEOPT_UNSET;
+
+	return (DTRACE_HANDLE_OK);
+}
+
+#define	BUFDUMPHDR(hdr) \
+	(void) printf("%s: %s%s\n", g_pname, hdr, strlen(hdr) > 0 ? ":" : "");
+
+#define	BUFDUMPSTR(ptr, field) \
+	(void) printf("%s: %20s => ", g_pname, #field);	\
+	if ((ptr)->field != NULL) {			\
+		const char *c = (ptr)->field;		\
+		(void) printf("\"");			\
+		do {					\
+			if (*c == '\n') {		\
+				(void) printf("\\n");	\
+				continue;		\
+			}				\
+							\
+			(void) printf("%c", *c);	\
+		} while (*c++ != '\0');			\
+		(void) printf("\"\n");			\
+	} else {					\
+		(void) printf("<NULL>\n");		\
+	}
+
+#define	BUFDUMPASSTR(ptr, field, str) \
+	(void) printf("%s: %20s => %s\n", g_pname, #field, str);
+
+#define	BUFDUMP(ptr, field) \
+	(void) printf("%s: %20s => %lld\n", g_pname, #field, \
+	    (long long)(ptr)->field);
+
+#define	BUFDUMPPTR(ptr, field) \
+	(void) printf("%s: %20s => %s\n", g_pname, #field, \
+	    (ptr)->field != NULL ? "<non-NULL>" : "<NULL>");
+
+/*ARGSUSED*/
+static int
+bufhandler(const dtrace_bufdata_t *bufdata, void *arg)
+{
+	const dtrace_aggdata_t *agg = bufdata->dtbda_aggdata;
+	const dtrace_recdesc_t *rec = bufdata->dtbda_recdesc;
+	const dtrace_probedesc_t *pd;
+	uint32_t flags = bufdata->dtbda_flags;
+	char buf[512], *c = buf, *end = c + sizeof (buf);
+	int i, printed;
+
+	struct {
+		const char *name;
+		uint32_t value;
+	} flagnames[] = {
+	    { "AGGVAL",		DTRACE_BUFDATA_AGGVAL },
+	    { "AGGKEY",		DTRACE_BUFDATA_AGGKEY },
+	    { "AGGFORMAT",	DTRACE_BUFDATA_AGGFORMAT },
+	    { "AGGLAST",	DTRACE_BUFDATA_AGGLAST },
+	    { "???",		UINT32_MAX },
+	    { NULL }
+	};
+
+	if (bufdata->dtbda_probe != NULL) {
+		pd = bufdata->dtbda_probe->dtpda_pdesc;
+	} else if (agg != NULL) {
+		pd = agg->dtada_pdesc;
+	} else {
+		pd = NULL;
+	}
+
+	BUFDUMPHDR(">>> Called buffer handler");
+	BUFDUMPHDR("");
+
+	BUFDUMPHDR("  dtrace_bufdata");
+	BUFDUMPSTR(bufdata, dtbda_buffered);
+	BUFDUMPPTR(bufdata, dtbda_probe);
+	BUFDUMPPTR(bufdata, dtbda_aggdata);
+	BUFDUMPPTR(bufdata, dtbda_recdesc);
+
+	(void) snprintf(c, end - c, "0x%x ", bufdata->dtbda_flags);
+	c += strlen(c);
+
+	for (i = 0, printed = 0; flagnames[i].name != NULL; i++) {
+		if (!(flags & flagnames[i].value))
+			continue;
+
+		(void) snprintf(c, end - c,
+		    "%s%s", printed++ ? " | " : "(", flagnames[i].name);
+		c += strlen(c);
+		flags &= ~flagnames[i].value;
+	}
+
+	if (printed)
+		(void) snprintf(c, end - c, ")");
+
+	BUFDUMPASSTR(bufdata, dtbda_flags, buf);
+	BUFDUMPHDR("");
+
+	if (pd != NULL) {
+		BUFDUMPHDR("  dtrace_probedesc");
+		BUFDUMPSTR(pd, dtpd_provider);
+		BUFDUMPSTR(pd, dtpd_mod);
+		BUFDUMPSTR(pd, dtpd_func);
+		BUFDUMPSTR(pd, dtpd_name);
+		BUFDUMPHDR("");
+	}
+
+	if (rec != NULL) {
+		BUFDUMPHDR("  dtrace_recdesc");
+		BUFDUMP(rec, dtrd_action);
+		BUFDUMP(rec, dtrd_size);
+
+		if (agg != NULL) {
+			uint8_t *data;
+			int lim = rec->dtrd_size;
+
+			(void) sprintf(buf, "%d (data: ", rec->dtrd_offset);
+			c = buf + strlen(buf);
+
+			if (lim > sizeof (uint64_t))
+				lim = sizeof (uint64_t);
+
+			data = (uint8_t *)agg->dtada_data + rec->dtrd_offset;
+
+			for (i = 0; i < lim; i++) {
+				(void) snprintf(c, end - c, "%s%02x",
+				    i == 0 ? "" : " ", *data++);
+				c += strlen(c);
+			}
+
+			(void) snprintf(c, end - c,
+			    "%s)", lim < rec->dtrd_size ? " ..." : "");
+			BUFDUMPASSTR(rec, dtrd_offset, buf);
+		} else {
+			BUFDUMP(rec, dtrd_offset);
+		}
+
+		BUFDUMPHDR("");
+	}
+
+	if (agg != NULL) {
+		dtrace_aggdesc_t *desc = agg->dtada_desc;
+
+		BUFDUMPHDR("  dtrace_aggdesc");
+		BUFDUMPSTR(desc, dtagd_name);
+		BUFDUMP(desc, dtagd_varid);
+		BUFDUMP(desc, dtagd_id);
+		BUFDUMP(desc, dtagd_nrecs);
+		BUFDUMPHDR("");
+	}
+
+	return (DTRACE_HANDLE_OK);
+}
+
+/*ARGSUSED*/
+static int
+chewrec(const dtrace_probedata_t *data, const dtrace_recdesc_t *rec, void *arg)
+{
+	dtrace_actkind_t act;
+	uintptr_t addr;
+
+	if (rec == NULL) {
+		/*
+		 * We have processed the final record; output the newline if
+		 * we're not in quiet mode.
+		 */
+		if (!g_quiet)
+			oprintf("\n");
+
+		return (DTRACE_CONSUME_NEXT);
+	}
+
+	act = rec->dtrd_action;
+	addr = (uintptr_t)data->dtpda_data;
+
+	if (act == DTRACEACT_EXIT) {
+		g_status = *((uint32_t *)addr);
+		return (DTRACE_CONSUME_NEXT);
+	}
+
+	return (DTRACE_CONSUME_THIS);
+}
+
+/*ARGSUSED*/
+static int
+chew(const dtrace_probedata_t *data, void *arg)
+{
+	dtrace_probedesc_t *pd = data->dtpda_pdesc;
+	processorid_t cpu = data->dtpda_cpu;
+	static int heading;
+
+	if (g_impatient) {
+		g_newline = 0;
+		return (DTRACE_CONSUME_ABORT);
+	}
+
+	if (heading == 0) {
+		if (!g_flowindent) {
+			if (!g_quiet) {
+				oprintf("%3s %6s %32s\n",
+				    "CPU", "ID", "FUNCTION:NAME");
+			}
+		} else {
+			oprintf("%3s %-41s\n", "CPU", "FUNCTION");
+		}
+		heading = 1;
+	}
+
+	if (!g_flowindent) {
+		if (!g_quiet) {
+			char name[DTRACE_FUNCNAMELEN + DTRACE_NAMELEN + 2];
+
+			(void) snprintf(name, sizeof (name), "%s:%s",
+			    pd->dtpd_func, pd->dtpd_name);
+
+			oprintf("%3d %6d %32s ", cpu, pd->dtpd_id, name);
+		}
+	} else {
+		int indent = data->dtpda_indent;
+		char *name;
+		size_t len;
+
+		if (data->dtpda_flow == DTRACEFLOW_NONE) {
+			len = indent + DTRACE_FUNCNAMELEN + DTRACE_NAMELEN + 5;
+			name = alloca(len);
+			(void) snprintf(name, len, "%*s%s%s:%s", indent, "",
+			    data->dtpda_prefix, pd->dtpd_func,
+			    pd->dtpd_name);
+		} else {
+			len = indent + DTRACE_FUNCNAMELEN + 5;
+			name = alloca(len);
+			(void) snprintf(name, len, "%*s%s%s", indent, "",
+			    data->dtpda_prefix, pd->dtpd_func);
+		}
+
+		oprintf("%3d %-41s ", cpu, name);
+	}
+
+	return (DTRACE_CONSUME_THIS);
+}
+
+static void
+go(void)
+{
+	int i;
+
+	struct {
+		char *name;
+		char *optname;
+		dtrace_optval_t val;
+	} bufs[] = {
+		{ "buffer size", "bufsize" },
+		{ "aggregation size", "aggsize" },
+		{ "speculation size", "specsize" },
+		{ "dynamic variable size", "dynvarsize" },
+		{ NULL }
+	}, rates[] = {
+		{ "cleaning rate", "cleanrate" },
+		{ "status rate", "statusrate" },
+		{ NULL }
+	};
+
+	for (i = 0; bufs[i].name != NULL; i++) {
+		if (dtrace_getopt(g_dtp, bufs[i].optname, &bufs[i].val) == -1)
+			fatal("couldn't get option %s", bufs[i].optname);
+	}
+
+	for (i = 0; rates[i].name != NULL; i++) {
+		if (dtrace_getopt(g_dtp, rates[i].optname, &rates[i].val) == -1)
+			fatal("couldn't get option %s", rates[i].optname);
+	}
+
+	if (dtrace_go(g_dtp) == -1)
+		dfatal("could not enable tracing");
+
+	for (i = 0; bufs[i].name != NULL; i++) {
+		dtrace_optval_t j = 0, mul = 10;
+		dtrace_optval_t nsize;
+
+		if (bufs[i].val == DTRACEOPT_UNSET)
+			continue;
+
+		(void) dtrace_getopt(g_dtp, bufs[i].optname, &nsize);
+
+		if (nsize == DTRACEOPT_UNSET || nsize == 0)
+			continue;
+
+		if (nsize >= bufs[i].val - sizeof (uint64_t))
+			continue;
+
+		for (; (INT64_C(1) << mul) <= nsize; j++, mul += 10)
+			continue;
+
+		if (!(nsize & ((INT64_C(1) << (mul - 10)) - 1))) {
+			error("%s lowered to %lld%c\n", bufs[i].name,
+			    (long long)nsize >> (mul - 10), " kmgtpe"[j]);
+		} else {
+			error("%s lowered to %lld bytes\n", bufs[i].name,
+			    (long long)nsize);
+		}
+	}
+
+	for (i = 0; rates[i].name != NULL; i++) {
+		dtrace_optval_t nval;
+		char *dir;
+
+		if (rates[i].val == DTRACEOPT_UNSET)
+			continue;
+
+		(void) dtrace_getopt(g_dtp, rates[i].optname, &nval);
+
+		if (nval == DTRACEOPT_UNSET || nval == 0)
+			continue;
+
+		if (rates[i].val == nval)
+			continue;
+
+		dir = nval > rates[i].val ? "reduced" : "increased";
+
+		if (nval <= NANOSEC && (NANOSEC % nval) == 0) {
+			error("%s %s to %lld hz\n", rates[i].name, dir,
+			    (long long)NANOSEC / (long long)nval);
+			continue;
+		}
+
+		if ((nval % NANOSEC) == 0) {
+			error("%s %s to once every %lld seconds\n",
+			    rates[i].name, dir,
+			    (long long)nval / (long long)NANOSEC);
+			continue;
+		}
+
+		error("%s %s to once every %lld nanoseconds\n",
+		    rates[i].name, dir, (long long)nval);
+	}
+}
+
+/*ARGSUSED*/
+static void
+intr(int signo)
+{
+	if (!g_intr)
+		g_newline = 1;
+
+	if (g_intr++)
+		g_impatient = 1;
+}
+
+#ifdef VBOX
+DECLEXPORT(int) RTCALL VBoxDTraceMain(int argc, char **argv)
+#else
+int
+main(int argc, char *argv[])
+#endif
+{
+	dtrace_bufdesc_t buf;
+#ifndef _MSC_VER
+	struct sigaction act, oact;
+#endif
+	dtrace_status_t status[2];
+	dtrace_optval_t opt;
+	dtrace_cmd_t *dcp;
+
+	int done = 0, mode = 0;
+	int err, i;
+#ifndef VBOX
+	char c, *p, **v;
+	struct ps_prochandle *P;
+	pid_t pid;
+
+	g_pname = basename(argv[0]);
+#else
+	int c;
+	char *p;
+	RTGETOPTUNION ValueUnion;
+	RTGETOPTSTATE GetState;
+
+	err = RTR3InitDll(0);
+	if (RT_FAILURE(err))
+		return RTMsgInitFailure(err);
+	dtrace_init();
+
+	g_ofp = stdout;
+	g_pname = RTProcShortName();
+#endif
+
+	if (argc == 1)
+		return (usage(stderr));
+
+	if ((g_argv = malloc(sizeof (char *) * argc)) == NULL ||
+	    (g_cmdv = malloc(sizeof (dtrace_cmd_t) * argc)) == NULL ||
+	    (g_psv = malloc(sizeof (struct ps_prochandle *) * argc)) == NULL)
+		fatal("failed to allocate memory for arguments");
+
+	g_argv[g_argc++] = argv[0];	/* propagate argv[0] to D as $0/$$0 */
+	argv[0] = g_pname;		/* rewrite argv[0] for getopt errors */
+
+	bzero(status, sizeof (status));
+	bzero(&buf, sizeof (buf));
+
+	/*
+	 * Make an initial pass through argv[] processing any arguments that
+	 * affect our behavior mode (g_mode) and flags used for dtrace_open().
+	 * We also accumulate arguments that are not affiliated with getopt
+	 * options into g_argv[], and abort if any invalid options are found.
+	 */
+#ifndef VBOX
+	for (optind = 1; optind < argc; optind++) {
+		while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) {
+#else
+	RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0);
+	while ((c = RTGetOpt(&GetState, &ValueUnion))) {
+		{
+			const char *optarg = ValueUnion.psz;
+#endif
+			switch (c) {
+#ifndef VBOX
+			case '3':
+				if (strcmp(optarg, "2") != 0) {
+					(void) fprintf(stderr,
+					    "%s: illegal option -- 3%s\n",
+					    argv[0], optarg);
+					return (usage(stderr));
+				}
+#else
+			case 10032:
+#endif
+				g_oflags &= ~DTRACE_O_LP64;
+				g_oflags |= DTRACE_O_ILP32;
+				break;
+
+#ifndef VBOX
+			case '6':
+				if (strcmp(optarg, "4") != 0) {
+					(void) fprintf(stderr,
+					    "%s: illegal option -- 6%s\n",
+					    argv[0], optarg);
+					return (usage(stderr));
+				}
+#else
+			case 10064:
+#endif
+				g_oflags &= ~DTRACE_O_ILP32;
+				g_oflags |= DTRACE_O_LP64;
+				break;
+
+			case 'a':
+				g_grabanon++; /* also checked in pass 2 below */
+				break;
+
+			case 'A':
+				g_mode = DMODE_ANON;
+				g_exec = 0;
+				mode++;
+				break;
+
+			case 'e':
+				g_exec = 0;
+				done = 1;
+				break;
+
+			case 'h':
+				g_mode = DMODE_HEADER;
+				g_oflags |= DTRACE_O_NODEV;
+				g_cflags |= DTRACE_C_ZDEFS; /* -h implies -Z */
+				g_exec = 0;
+				mode++;
+				break;
+
+#ifndef VBOX
+			case 'G':
+				g_mode = DMODE_LINK;
+				g_oflags |= DTRACE_O_NODEV;
+				g_cflags |= DTRACE_C_ZDEFS; /* -G implies -Z */
+				g_exec = 0;
+				mode++;
+				break;
+#endif
+
+			case 'l':
+				g_mode = DMODE_LIST;
+				g_cflags |= DTRACE_C_ZDEFS; /* -l implies -Z */
+				mode++;
+				break;
+
+			case 'V':
+				g_mode = DMODE_VERS;
+				mode++;
+				break;
+
+#ifndef VBOX
+			default:
+				if (strchr(DTRACE_OPTSTR, c) == NULL)
+					return (usage(stderr));
+#else
+			case 'c':
+			case 'p':
+			case 'G':
+				fprintf(stderr, "%s: -%c is not supported\n", g_pname, c);
+				return (E_USAGE);
+
+			case VINF_GETOPT_NOT_OPTION:
+				g_argv[g_argc++] = (char *)ValueUnion.psz;
+				break;
+
+			default:
+				if (c < 0) { /* Note: Not all options are handled. */
+					RTGetOptPrintError(c, &ValueUnion);
+					return (usage(stderr));
+				}
+#endif
+			}
+		}
+
+#ifndef VBOX
+		if (optind < argc)
+			g_argv[g_argc++] = argv[optind];
+#endif
+	}
+
+	if (mode > 1) {
+		(void) fprintf(stderr, "%s: only one of the [-AGhlV] options "
+		    "can be specified at a time\n", g_pname);
+		return (E_USAGE);
+	}
+
+	if (g_mode == DMODE_VERS)
+		return (printf("%s: %s\n", g_pname, _dtrace_version) <= 0);
+
+#ifndef VBOX
+	/*
+	 * If we're in linker mode and the data model hasn't been specified,
+	 * we try to guess the appropriate setting by examining the object
+	 * files. We ignore certain errors since we'll catch them later when
+	 * we actually process the object files.
+	 */
+	if (g_mode == DMODE_LINK &&
+	    (g_oflags & (DTRACE_O_ILP32 | DTRACE_O_LP64)) == 0 &&
+	    elf_version(EV_CURRENT) != EV_NONE) {
+		int fd;
+		Elf *elf;
+		GElf_Ehdr ehdr;
+
+		for (i = 1; i < g_argc; i++) {
+			if ((fd = open64(g_argv[i], O_RDONLY)) == -1)
+				break;
+
+			if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) {
+				(void) close(fd);
+				break;
+			}
+
+			if (elf_kind(elf) != ELF_K_ELF ||
+			    gelf_getehdr(elf, &ehdr) == NULL) {
+				(void) close(fd);
+				(void) elf_end(elf);
+				break;
+			}
+
+			(void) close(fd);
+			(void) elf_end(elf);
+
+			if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
+				if (g_oflags & DTRACE_O_ILP32) {
+					fatal("can't mix 32-bit and 64-bit "
+					    "object files\n");
+				}
+				g_oflags |= DTRACE_O_LP64;
+			} else if (ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
+				if (g_oflags & DTRACE_O_LP64) {
+					fatal("can't mix 32-bit and 64-bit "
+					    "object files\n");
+				}
+				g_oflags |= DTRACE_O_ILP32;
+			} else {
+				break;
+			}
+		}
+	}
+#endif /* !VBOX */
+
+	/*
+	 * Open libdtrace.  If we are not actually going to be enabling any
+	 * instrumentation attempt to reopen libdtrace using DTRACE_O_NODEV.
+	 */
+	while ((g_dtp = dtrace_open(DTRACE_VERSION, g_oflags, &err)) == NULL) {
+		if (!(g_oflags & DTRACE_O_NODEV) && !g_exec && !g_grabanon) {
+			g_oflags |= DTRACE_O_NODEV;
+			continue;
+		}
+
+		fatal("failed to initialize dtrace: %s\n",
+		    dtrace_errmsg(NULL, err));
+	}
+
+	(void) dtrace_setopt(g_dtp, "bufsize", "4m");
+	(void) dtrace_setopt(g_dtp, "aggsize", "4m");
+
+	/*
+	 * If -G is specified, enable -xlink=dynamic and -xunodefs to permit
+	 * references to undefined symbols to remain as unresolved relocations.
+	 * If -A is specified, enable -xlink=primary to permit static linking
+	 * only to kernel symbols that are defined in a primary kernel module.
+	 */
+	if (g_mode == DMODE_LINK) {
+#ifndef VBOX /* No link mode. */
+		(void) dtrace_setopt(g_dtp, "linkmode", "dynamic");
+		(void) dtrace_setopt(g_dtp, "unodefs", NULL);
+
+		/*
+		 * Use the remaining arguments as the list of object files
+		 * when in linker mode.
+		 */
+		g_objc = g_argc - 1;
+		g_objv = g_argv + 1;
+
+		/*
+		 * We still use g_argv[0], the name of the executable.
+		 */
+		g_argc = 1;
+#else  /* VBOX */
+		AssertFailed();
+#endif /* VBOX */
+	} else if (g_mode == DMODE_ANON)
+		(void) dtrace_setopt(g_dtp, "linkmode", "primary");
+
+	/*
+	 * Now that we have libdtrace open, make a second pass through argv[]
+	 * to perform any dtrace_setopt() calls and change any compiler flags.
+	 * We also accumulate any program specifications into our g_cmdv[] at
+	 * this time; these will compiled as part of the fourth processing pass.
+	 */
+#ifndef VBOX
+	for (optind = 1; optind < argc; optind++) {
+		while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) {
+#else
+	RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0);
+	while ((c = RTGetOpt(&GetState, &ValueUnion))) {
+		{
+			char *optarg = (char *)ValueUnion.psz;
+#endif
+
+			switch (c) {
+			case 'a':
+				if (dtrace_setopt(g_dtp, "grabanon", 0) != 0)
+					dfatal("failed to set -a");
+				break;
+
+			case 'b':
+				if (dtrace_setopt(g_dtp,
+				    "bufsize", optarg) != 0)
+					dfatal("failed to set -b %s", optarg);
+				break;
+
+			case 'B':
+				g_ofp = NULL;
+				break;
+
+			case 'C':
+				g_cflags |= DTRACE_C_CPP;
+				break;
+
+			case 'D':
+				if (dtrace_setopt(g_dtp, "define", optarg) != 0)
+					dfatal("failed to set -D %s", optarg);
+				break;
+
+			case 'f':
+				dcp = &g_cmdv[g_cmdc++];
+				dcp->dc_func = compile_str;
+				dcp->dc_spec = DTRACE_PROBESPEC_FUNC;
+				dcp->dc_arg = optarg;
+				break;
+
+			case 'F':
+				if (dtrace_setopt(g_dtp, "flowindent", 0) != 0)
+					dfatal("failed to set -F");
+				break;
+
+			case 'H':
+				if (dtrace_setopt(g_dtp, "cpphdrs", 0) != 0)
+					dfatal("failed to set -H");
+				break;
+
+			case 'i':
+				dcp = &g_cmdv[g_cmdc++];
+				dcp->dc_func = compile_str;
+				dcp->dc_spec = DTRACE_PROBESPEC_NAME;
+				dcp->dc_arg = optarg;
+				break;
+
+			case 'I':
+				if (dtrace_setopt(g_dtp, "incdir", optarg) != 0)
+					dfatal("failed to set -I %s", optarg);
+				break;
+
+			case 'L':
+				if (dtrace_setopt(g_dtp, "libdir", optarg) != 0)
+					dfatal("failed to set -L %s", optarg);
+				break;
+
+			case 'm':
+				dcp = &g_cmdv[g_cmdc++];
+				dcp->dc_func = compile_str;
+				dcp->dc_spec = DTRACE_PROBESPEC_MOD;
+				dcp->dc_arg = optarg;
+				break;
+
+			case 'n':
+				dcp = &g_cmdv[g_cmdc++];
+				dcp->dc_func = compile_str;
+				dcp->dc_spec = DTRACE_PROBESPEC_NAME;
+				dcp->dc_arg = optarg;
+				break;
+
+			case 'P':
+				dcp = &g_cmdv[g_cmdc++];
+				dcp->dc_func = compile_str;
+				dcp->dc_spec = DTRACE_PROBESPEC_PROVIDER;
+				dcp->dc_arg = optarg;
+				break;
+
+			case 'q':
+				if (dtrace_setopt(g_dtp, "quiet", 0) != 0)
+					dfatal("failed to set -q");
+				break;
+
+			case 'o':
+				g_ofile = optarg;
+				break;
+
+			case 's':
+				dcp = &g_cmdv[g_cmdc++];
+				dcp->dc_func = compile_file;
+				dcp->dc_spec = DTRACE_PROBESPEC_NONE;
+				dcp->dc_arg = optarg;
+				break;
+
+			case 'S':
+				g_cflags |= DTRACE_C_DIFV;
+				break;
+
+			case 'U':
+				if (dtrace_setopt(g_dtp, "undef", optarg) != 0)
+					dfatal("failed to set -U %s", optarg);
+				break;
+
+			case 'v':
+				g_verbose++;
+				break;
+
+			case 'w':
+				if (dtrace_setopt(g_dtp, "destructive", 0) != 0)
+					dfatal("failed to set -w");
+				break;
+
+			case 'x':
+				if ((p = strchr(optarg, '=')) != NULL)
+					*p++ = '\0';
+
+				if (dtrace_setopt(g_dtp, optarg, p) != 0)
+					dfatal("failed to set -x %s", optarg);
+				break;
+
+			case 'X':
+				if (dtrace_setopt(g_dtp, "stdc", optarg) != 0)
+					dfatal("failed to set -X %s", optarg);
+				break;
+
+			case 'Z':
+				g_cflags |= DTRACE_C_ZDEFS;
+				break;
+
+#ifndef VBOX
+			default:
+				if (strchr(DTRACE_OPTSTR, c) == NULL)
+					return (usage(stderr));
+#else
+			default:
+				if (c < 0) { /* Note: Not all options are handled. */
+					RTGetOptPrintError(c, &ValueUnion);
+					return (usage(stderr));
+				}
+#endif
+			}
+		}
+	}
+
+	if (g_ofp == NULL && g_mode != DMODE_EXEC) {
+		(void) fprintf(stderr, "%s: -B not valid in combination"
+		    " with [-AGl] options\n", g_pname);
+		return (E_USAGE);
+	}
+
+	if (g_ofp == NULL && g_ofile != NULL) {
+		(void) fprintf(stderr, "%s: -B not valid in combination"
+		    " with -o option\n", g_pname);
+		return (E_USAGE);
+	}
+
+#ifndef VBOX
+	/*
+	 * In our third pass we handle any command-line options related to
+	 * grabbing or creating victim processes.  The behavior of these calls
+	 * may been affected by any library options set by the second pass.
+	 */
+#ifndef VBOX
+	for (optind = 1; optind < argc; optind++) {
+		while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) {
+#else
+	RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, 0);
+	while ((c = RTGetOpt(&GetState, &ValueUnion))) {
+		{
+			char *optarg = (char *)ValueUnion.psz;
+#endif
+			switch (c) {
+			case 'c':
+				if ((v = make_argv(optarg)) == NULL)
+					fatal("failed to allocate memory");
+
+				P = dtrace_proc_create(g_dtp, v[0], v);
+				if (P == NULL)
+					dfatal(NULL); /* dtrace_errmsg() only */
+
+				g_psv[g_psc++] = P;
+				free(v);
+				break;
+
+			case 'p':
+				errno = 0;
+				pid = strtol(optarg, &p, 10);
+
+				if (errno != 0 || p == optarg || p[0] != '\0')
+					fatal("invalid pid: %s\n", optarg);
+
+				P = dtrace_proc_grab(g_dtp, pid, 0);
+				if (P == NULL)
+					dfatal(NULL); /* dtrace_errmsg() only */
+
+				g_psv[g_psc++] = P;
+				break;
+			}
+		}
+	}
+#endif /* !VBOX */
+
+	/*
+	 * In our fourth pass we finish g_cmdv[] by calling dc_func to convert
+	 * each string or file specification into a compiled program structure.
+	 */
+	for (i = 0; i < g_cmdc; i++)
+		g_cmdv[i].dc_func(&g_cmdv[i]);
+
+	if (g_mode != DMODE_LIST) {
+		if (dtrace_handle_err(g_dtp, &errhandler, NULL) == -1)
+			dfatal("failed to establish error handler");
+
+		if (dtrace_handle_drop(g_dtp, &drophandler, NULL) == -1)
+			dfatal("failed to establish drop handler");
+
+		if (dtrace_handle_proc(g_dtp, &prochandler, NULL) == -1)
+			dfatal("failed to establish proc handler");
+
+		if (dtrace_handle_setopt(g_dtp, &setopthandler, NULL) == -1)
+			dfatal("failed to establish setopt handler");
+
+		if (g_ofp == NULL &&
+		    dtrace_handle_buffered(g_dtp, &bufhandler, NULL) == -1)
+			dfatal("failed to establish buffered handler");
+	}
+
+	(void) dtrace_getopt(g_dtp, "flowindent", &opt);
+	g_flowindent = opt != DTRACEOPT_UNSET;
+
+	(void) dtrace_getopt(g_dtp, "grabanon", &opt);
+	g_grabanon = opt != DTRACEOPT_UNSET;
+
+	(void) dtrace_getopt(g_dtp, "quiet", &opt);
+	g_quiet = opt != DTRACEOPT_UNSET;
+
+	/*
+	 * Now make a fifth and final pass over the options that have been
+	 * turned into programs and saved in g_cmdv[], performing any mode-
+	 * specific processing.  If g_mode is DMODE_EXEC, we will break out
+	 * of the switch() and continue on to the data processing loop.  For
+	 * other modes, we will exit dtrace once mode-specific work is done.
+	 */
+	switch (g_mode) {
+	case DMODE_EXEC:
+		if (g_ofile != NULL && (g_ofp = fopen(g_ofile, "a")) == NULL)
+			fatal("failed to open output file '%s'", g_ofile);
+
+		for (i = 0; i < g_cmdc; i++)
+			exec_prog(&g_cmdv[i]);
+
+		if (done && !g_grabanon) {
+			dtrace_close(g_dtp);
+			return (g_status);
+		}
+		break;
+
+	case DMODE_ANON:
+		if (g_ofile == NULL)
+			g_ofile = "/kernel/drv/dtrace.conf";
+
+		dof_prune(g_ofile); /* strip out any old DOF directives */
+		etcsystem_prune(); /* string out any forceload directives */
+
+		if (g_cmdc == 0) {
+			dtrace_close(g_dtp);
+			return (g_status);
+		}
+
+		if ((g_ofp = fopen(g_ofile, "a")) == NULL)
+			fatal("failed to open output file '%s'", g_ofile);
+
+		for (i = 0; i < g_cmdc; i++) {
+			anon_prog(&g_cmdv[i],
+			    dtrace_dof_create(g_dtp, g_cmdv[i].dc_prog, 0), i);
+		}
+
+		/*
+		 * Dump out the DOF corresponding to the error handler and the
+		 * current options as the final DOF property in the .conf file.
+		 */
+		anon_prog(NULL, dtrace_geterr_dof(g_dtp), i++);
+		anon_prog(NULL, dtrace_getopt_dof(g_dtp), i++);
+
+		if (fclose(g_ofp) == EOF)
+			fatal("failed to close output file '%s'", g_ofile);
+
+		/*
+		 * These messages would use notice() rather than error(), but
+		 * we don't want them suppressed when -A is run on a D program
+		 * that itself contains a #pragma D option quiet.
+		 */
+		error("saved anonymous enabling in %s\n", g_ofile);
+		etcsystem_add();
+		error("run update_drv(1M) or reboot to enable changes\n");
+
+		dtrace_close(g_dtp);
+		return (g_status);
+
+	case DMODE_LINK:
+#ifndef VBOX  /* No link mode. */
+		if (g_cmdc == 0) {
+			(void) fprintf(stderr, "%s: -G requires one or more "
+			    "scripts or enabling options\n", g_pname);
+			dtrace_close(g_dtp);
+			return (E_USAGE);
+		}
+
+		for (i = 0; i < g_cmdc; i++)
+			link_prog(&g_cmdv[i]);
+
+		if (g_cmdc > 1 && g_ofile != NULL) {
+			char **objv = alloca(g_cmdc * sizeof (char *));
+
+			for (i = 0; i < g_cmdc; i++)
+				objv[i] = g_cmdv[i].dc_ofile;
+
+			if (dtrace_program_link(g_dtp, NULL, DTRACE_D_PROBES,
+			    g_ofile, g_cmdc, objv) != 0)
+				dfatal(NULL); /* dtrace_errmsg() only */
+		}
+
+		dtrace_close(g_dtp);
+		return (g_status);
+#else  /* VBOX */
+		AssertFailed();
+		dtrace_close(g_dtp);
+		return (E_USAGE);
+#endif /* VBOX */
+
+	case DMODE_LIST:
+		if (g_ofile != NULL && (g_ofp = fopen(g_ofile, "a")) == NULL)
+			fatal("failed to open output file '%s'", g_ofile);
+
+		oprintf("%5s %10s %17s %33s %s\n",
+		    "ID", "PROVIDER", "MODULE", "FUNCTION", "NAME");
+
+		for (i = 0; i < g_cmdc; i++)
+			list_prog(&g_cmdv[i]);
+
+		if (g_cmdc == 0)
+			(void) dtrace_probe_iter(g_dtp, NULL, list_probe, NULL);
+
+		dtrace_close(g_dtp);
+		return (g_status);
+
+	case DMODE_HEADER:
+		if (g_cmdc == 0) {
+			(void) fprintf(stderr, "%s: -h requires one or more "
+			    "scripts or enabling options\n", g_pname);
+			dtrace_close(g_dtp);
+			return (E_USAGE);
+		}
+
+		if (g_ofile == NULL) {
+			char *p;
+
+			if (g_cmdc > 1) {
+				(void) fprintf(stderr, "%s: -h requires an "
+				    "output file if multiple scripts are "
+				    "specified\n", g_pname);
+				dtrace_close(g_dtp);
+				return (E_USAGE);
+			}
+
+			if ((p = strrchr(g_cmdv[0].dc_arg, '.')) == NULL ||
+			    strcmp(p, ".d") != 0) {
+				(void) fprintf(stderr, "%s: -h requires an "
+				    "output file if no scripts are "
+				    "specified\n", g_pname);
+				dtrace_close(g_dtp);
+				return (E_USAGE);
+			}
+
+			p[0] = '\0'; /* strip .d suffix */
+			g_ofile = p = g_cmdv[0].dc_ofile;
+			(void) snprintf(p, sizeof (g_cmdv[0].dc_ofile),
+			    "%s.h", basename(g_cmdv[0].dc_arg));
+		}
+
+		if ((g_ofp = fopen(g_ofile, "w")) == NULL)
+			fatal("failed to open header file '%s'", g_ofile);
+
+		oprintf("/*\n * Generated by dtrace(1M).\n */\n\n");
+
+		if (dtrace_program_header(g_dtp, g_ofp, g_ofile) != 0 ||
+		    fclose(g_ofp) == EOF)
+			dfatal("failed to create header file %s", g_ofile);
+
+		dtrace_close(g_dtp);
+		return (g_status);
+	}
+
+	/*
+	 * If -a and -Z were not specified and no probes have been matched, no
+	 * probe criteria was specified on the command line and we abort.
+	 */
+	if (g_total == 0 && !g_grabanon && !(g_cflags & DTRACE_C_ZDEFS))
+		dfatal("no probes %s\n", g_cmdc ? "matched" : "specified");
+
+	/*
+	 * Start tracing.  Once we dtrace_go(), reload any options that affect
+	 * our globals in case consuming anonymous state has changed them.
+	 */
+	go();
+
+	(void) dtrace_getopt(g_dtp, "flowindent", &opt);
+	g_flowindent = opt != DTRACEOPT_UNSET;
+
+	(void) dtrace_getopt(g_dtp, "grabanon", &opt);
+	g_grabanon = opt != DTRACEOPT_UNSET;
+
+	(void) dtrace_getopt(g_dtp, "quiet", &opt);
+	g_quiet = opt != DTRACEOPT_UNSET;
+
+	(void) dtrace_getopt(g_dtp, "destructive", &opt);
+	if (opt != DTRACEOPT_UNSET)
+		notice("allowing destructive actions\n");
+
+#ifndef _MSC_VER
+	(void) sigemptyset(&act.sa_mask);
+	act.sa_flags = 0;
+	act.sa_handler = intr;
+
+	if (sigaction(SIGINT, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
+		(void) sigaction(SIGINT, &act, NULL);
+
+	if (sigaction(SIGTERM, NULL, &oact) == 0 && oact.sa_handler != SIG_IGN)
+		(void) sigaction(SIGTERM, &act, NULL);
+#else
+	signal(SIGINT, intr);
+	signal(SIGTERM, intr);
+#endif
+
+	/*
+	 * Now that tracing is active and we are ready to consume trace data,
+	 * continue any grabbed or created processes, setting them running
+	 * using the /proc control mechanism inside of libdtrace.
+	 */
+#ifndef VBOX
+	for (i = 0; i < g_psc; i++)
+		dtrace_proc_continue(g_dtp, g_psv[i]);
+#endif
+
+	g_pslive = g_psc; /* count for prochandler() */
+
+	do {
+		if (!g_intr && !done)
+			dtrace_sleep(g_dtp);
+
+		if (g_newline) {
+			/*
+			 * Output a newline just to make the output look
+			 * slightly cleaner.  Note that we do this even in
+			 * "quiet" mode...
+			 */
+			oprintf("\n");
+			g_newline = 0;
+		}
+
+		if (done || g_intr || (g_psc != 0 && g_pslive == 0)) {
+			done = 1;
+			if (dtrace_stop(g_dtp) == -1)
+				dfatal("couldn't stop tracing");
+		}
+
+		switch (dtrace_work(g_dtp, g_ofp, chew, chewrec, NULL)) {
+		case DTRACE_WORKSTATUS_DONE:
+			done = 1;
+			break;
+		case DTRACE_WORKSTATUS_OKAY:
+			break;
+		default:
+			if (!g_impatient && dtrace_errno(g_dtp) != EINTR)
+				dfatal("processing aborted");
+		}
+
+		if (g_ofp != NULL && fflush(g_ofp) == EOF)
+			clearerr(g_ofp);
+	} while (!done);
+
+	oprintf("\n");
+
+	if (!g_impatient) {
+		if (dtrace_aggregate_print(g_dtp, g_ofp, NULL) == -1 &&
+		    dtrace_errno(g_dtp) != EINTR)
+			dfatal("failed to print aggregations");
+	}
+
+	dtrace_close(g_dtp);
+	return (g_status);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/i386/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/i386/Makefile
new file mode 100644
index 0000000..42abe33
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/i386/Makefile
@@ -0,0 +1,30 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+include ../Makefile.com
+
+install: all $(ROOTUSRSBINPROG32)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/i386/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/i386/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparc/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparc/Makefile
new file mode 100644
index 0000000..42abe33
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparc/Makefile
@@ -0,0 +1,30 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+include ../Makefile.com
+
+install: all $(ROOTUSRSBINPROG32)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparc/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparcv9/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparcv9/Makefile
new file mode 100644
index 0000000..4550807
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparcv9/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+include ../Makefile.com
+include ../../Makefile.cmd.64
+
+install: all $(ROOTUSRSBINPROG64)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparcv9/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/sparcv9/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/Makefile
new file mode 100644
index 0000000..b6af1e5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/Makefile
@@ -0,0 +1,46 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include $(SRC)/Makefile.master
+
+SUBDIRS = cmd tst
+
+ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
+
+include Makefile.subdirs
+
+install: $(ROOTOPTPKG)/README $(SUBDIRS)
+
+pkg: install
+	@cd $(SRC)/pkg; pwd; $(MAKE) SUNWdtrt.pub
+
+$(ROOTOPTPKG)/% := FILEMODE = 0444
+
+$(ROOTOPTPKG):
+	$(INS.dir)
+
+$(ROOTOPTPKG)/%: ./% $(ROOTOPTPKG)
+	$(INS.file)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/Makefile.subdirs b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/Makefile.subdirs
new file mode 100644
index 0000000..2ff551c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/Makefile.subdirs
@@ -0,0 +1,41 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+.KEEP_STATE:
+
+all := TARGET += all
+clean := TARGET += clean
+clobber := TARGET += clobber
+install := TARGET += install
+lint := TARGET += lint
+
+all clean clobber install lint: $(SUBDIRS)
+
+$(SUBDIRS): FRC
+	@cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/README b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/README
new file mode 100644
index 0000000..51ab650
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/README
@@ -0,0 +1,32 @@
+
+CDDL HEADER START
+
+The contents of this file are subject to the terms of the
+Common Development and Distribution License (the "License").
+You may not use this file except in compliance with the License.
+
+You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+or http://www.opensolaris.org/os/licensing.
+See the License for the specific language governing permissions
+and limitations under the License.
+
+When distributing Covered Code, include this CDDL HEADER in each
+file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+If applicable, add the following below this CDDL HEADER, with the
+fields enclosed by brackets "[]" replaced with your own identifying
+information: Portions Copyright [yyyy] [name of copyright owner]
+
+CDDL HEADER END
+
+Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+Use is subject to license terms.
+
+ident	"%Z%%M%	%I%	%E% SMI"
+
+DTrace Testing Suite
+
+The SUNWdtrt package delivers a set of test programs and D source
+files into the directory /opt/SUNWdtrt.  For more information see
+the following web site:
+
+	http://www.opensolaris.org/os/community/dtrace/dtest
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/Makefile
new file mode 100644
index 0000000..28af4ee
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+include $(SRC)/Makefile.master
+
+SUBDIRS = scripts baddof badioctl chkargs jdtrace
+include ../Makefile.subdirs
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/baddof/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/baddof/Makefile
new file mode 100644
index 0000000..bb7a746
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/baddof/Makefile
@@ -0,0 +1,59 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+include $(SRC)/cmd/Makefile.cmd
+
+.KEEP_STATE:
+
+ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
+ROOTBIN = $(ROOTOPTPKG)/bin
+
+LDFLAGS += $(ZNODEFS) $(ZTEXTOFF)
+LDLIBS = $(LDLIBS.cmd)
+LDLIBS += -ldtrace
+
+SRCS = baddof
+CMDS = $(SRCS:%=$(ROOTBIN)/%)
+
+$(CMDS) := FILEMODE = 0555
+
+all: $(SRCS)
+
+install: $(CMDS)
+
+clean lint:
+
+clobber:
+	$(RM) $(SRCS)
+
+$(CMDS): $(ROOTBIN) $(SRCS)
+
+$(ROOTBIN):
+	$(INS.dir)
+
+$(ROOTBIN)/%: %
+	$(INS.file)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/baddof/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/baddof/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/baddof/baddof.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/baddof/baddof.c
new file mode 100644
index 0000000..1c14c65
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/baddof/baddof.c
@@ -0,0 +1,207 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/varargs.h>
+#include <errno.h>
+#include <math.h>
+#include <dtrace.h>
+
+void
+fatal(char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+
+	fprintf(stderr, "%s: ", "baddof");
+	vfprintf(stderr, fmt, ap);
+
+	if (fmt[strlen(fmt) - 1] != '\n')
+		fprintf(stderr, ": %s\n", strerror(errno));
+
+	exit(1);
+}
+
+#define	LEAP_DISTANCE		20
+
+void
+corrupt(int fd, unsigned char *buf, int len)
+{
+	static int ttl, valid;
+	int bit, i;
+	unsigned char saved;
+	int val[LEAP_DISTANCE], pos[LEAP_DISTANCE];
+	int new, rv;
+
+again:
+	printf("valid DOF #%d\n", valid++);
+
+	/*
+	 * We are going iterate through, flipping one bit and attempting
+	 * to enable.
+	 */
+	for (bit = 0; bit < len * 8; bit++) {
+		saved = buf[bit / 8];
+		buf[bit / 8] ^= (1 << (bit % 8));
+
+		if ((bit % 100) == 0)
+			printf("%d\n", bit);
+
+		if ((rv = ioctl(fd, DTRACEIOC_ENABLE, buf)) == -1) {
+			/*
+			 * That failed -- restore the bit and drive on.
+			 */
+			buf[bit / 8] = saved;
+			continue;
+		}
+
+		/*
+		 * That worked -- and it may have enabled probes.  To keep
+		 * enabled probes down to a reasonable level, we'll close
+		 * and reopen pseudodevice if we have more than 10,000
+		 * probes enabled.
+		 */
+		ttl += rv;
+
+		if (ttl < 10000) {
+			buf[bit / 8] = saved;
+			continue;
+		}
+
+		printf("enabled %d probes; resetting device.\n", ttl);
+		close(fd);
+
+		new = open("/devices/pseudo/dtrace at 0:dtrace", O_RDWR);
+
+		if (new == -1)
+			fatal("couldn't open DTrace pseudo device");
+
+		if (new != fd) {
+			dup2(new, fd);
+			close(new);
+		}
+
+		ttl = 0;
+		buf[bit / 8] = saved;
+	}
+
+	for (;;) {
+		/*
+		 * Now we want to get as many bits away as possible.  We flip
+		 * bits randomly -- getting as far away as we can until we don't
+		 * seem to be making any progress.
+		 */
+		for (i = 0; i < LEAP_DISTANCE; i++) {
+			/*
+			 * Pick a random bit and corrupt it.
+			 */
+			bit = lrand48() % (len * 8);
+
+			val[i] = buf[bit / 8];
+			pos[i] = bit / 8;
+			buf[bit / 8] ^= (1 << (bit % 8));
+		}
+
+		/*
+		 * Let's see if that managed to get us valid DOF...
+		 */
+		if ((rv = ioctl(fd, DTRACEIOC_ENABLE, buf)) > 0) {
+			/*
+			 * Success!  This will be our new base for valid DOF.
+			 */
+			ttl += rv;
+			goto again;
+		}
+
+		/*
+		 * No luck -- we'll restore those bits and try flipping a
+		 * different set.  Note that this must be done in reverse
+		 * order...
+		 */
+		for (i = LEAP_DISTANCE - 1; i >= 0; i--)
+			buf[pos[i]] = val[i];
+	}
+}
+
+int
+main(int argc, char **argv)
+{
+	char *filename = argv[1];
+	dtrace_hdl_t *dtp;
+	dtrace_prog_t *pgp;
+	int err, fd, len;
+	FILE *fp;
+	unsigned char *dof, *copy;
+
+	if (argc < 2)
+		fatal("expected D script as argument\n");
+
+	if ((fp = fopen(filename, "r")) == NULL)
+		fatal("couldn't open %s", filename);
+
+	/*
+	 * First, we need to compile our provided D into DOF.
+	 */
+	if ((dtp = dtrace_open(DTRACE_VERSION, 0, &err)) == NULL) {
+		fatal("cannot open dtrace library: %s\n",
+		    dtrace_errmsg(NULL, err));
+	}
+
+	pgp = dtrace_program_fcompile(dtp, fp, 0, 0, NULL);
+	fclose(fp);
+
+	if (pgp == NULL) {
+		fatal("failed to compile script %s: %s\n", filename,
+		    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+	}
+
+	dof = dtrace_dof_create(dtp, pgp, 0);
+	len = ((dof_hdr_t *)dof)->dofh_loadsz;
+
+	if ((copy = malloc(len)) == NULL)
+		fatal("could not allocate copy of %d bytes", len);
+
+	for (;;) {
+		bcopy(dof, copy, len);
+		/*
+		 * Open another instance of the dtrace device.
+		 */
+		fd = open("/devices/pseudo/dtrace at 0:dtrace", O_RDWR);
+
+		if (fd == -1)
+			fatal("couldn't open DTrace pseudo device");
+
+		corrupt(fd, copy, len);
+		close(fd);
+	}
+
+	/* NOTREACHED */
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/badioctl/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/badioctl/Makefile
new file mode 100644
index 0000000..6c3257d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/badioctl/Makefile
@@ -0,0 +1,58 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+include $(SRC)/cmd/Makefile.cmd
+
+.KEEP_STATE:
+
+ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
+ROOTBIN = $(ROOTOPTPKG)/bin
+
+LDFLAGS += $(ZNODEFS) $(ZTEXTOFF)
+LDLIBS = $(LDLIBS.cmd)
+
+SRCS = badioctl
+CMDS = $(SRCS:%=$(ROOTBIN)/%)
+
+$(CMDS) := FILEMODE = 0555
+
+all: $(SRCS)
+
+install: $(CMDS)
+
+clean lint:
+
+clobber:
+	$(RM) $(SRCS)
+
+$(CMDS): $(ROOTBIN) $(SRCS)
+
+$(ROOTBIN):
+	$(INS.dir)
+
+$(ROOTBIN)/%: %
+	$(INS.file)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/badioctl/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/badioctl/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/badioctl/badioctl.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/badioctl/badioctl.c
new file mode 100644
index 0000000..8d6833d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/badioctl/badioctl.c
@@ -0,0 +1,145 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/varargs.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#define	DTRACEIOC	(('d' << 24) | ('t' << 16) | ('r' << 8))
+#define	DTRACEIOC_MAX	17
+
+void
+fatal(char *fmt, ...)
+{
+	va_list ap;
+
+	va_start(ap, fmt);
+
+	fprintf(stderr, "%s: ", "badioctl");
+	vfprintf(stderr, fmt, ap);
+
+	if (fmt[strlen(fmt) - 1] != '\n')
+		fprintf(stderr, ": %s\n", strerror(errno));
+
+	exit(1);
+}
+
+void
+badioctl(pid_t parent)
+{
+	int fd = -1, random, ps = sysconf(_SC_PAGESIZE);
+	int i = 0, seconds;
+	caddr_t addr;
+	hrtime_t now, last = 0, end;
+
+	if ((random = open("/dev/random", O_RDONLY)) == -1)
+		fatal("couldn't open /dev/random");
+
+	if ((addr = mmap(0, ps, PROT_READ | PROT_WRITE,
+	    MAP_ANON | MAP_PRIVATE, -1, 0)) == (caddr_t)-1)
+		fatal("mmap");
+
+	for (;;) {
+		unsigned int ioc;
+
+		if ((now = gethrtime()) - last > NANOSEC) {
+			if (kill(parent, 0) == -1 && errno == ESRCH) {
+				/*
+				 * Our parent died.  We will kill ourselves in
+				 * sympathy.
+				 */
+				exit(0);
+			}
+
+			/*
+			 * Once a second, we'll reopen the device.
+			 */
+			if (fd != -1)
+				close(fd);
+
+			fd = open("/devices/pseudo/dtrace at 0:dtrace", O_RDONLY);
+
+			if (fd == -1)
+				fatal("couldn't open DTrace pseudo device");
+
+			last = now;
+		}
+
+
+		if ((i++ % 1000) == 0) {
+			/*
+			 * Every thousand iterations, change our random gunk.
+			 */
+			read(random, addr, ps);
+		}
+
+		read(random, &ioc, sizeof (ioc));
+		ioc %= DTRACEIOC_MAX;
+		ioc++;
+		ioctl(fd, DTRACEIOC | ioc, addr);
+	}
+}
+
+int
+main()
+{
+	pid_t child, parent = getpid();
+	int status;
+
+	for (;;) {
+		if ((child = fork()) == 0)
+			badioctl(parent);
+
+		while (waitpid(child, &status, WEXITED) != child)
+			continue;
+
+		if (WIFEXITED(status)) {
+			/*
+			 * Our child exited by design -- we'll exit with
+			 * the same status code.
+			 */
+			exit(WEXITSTATUS(status));
+		}
+
+		/*
+		 * Our child died on a signal.  Respawn it.
+		 */
+		printf("badioctl: child died on signal %d; respawning.\n",
+		    WTERMSIG(status));
+		fflush(stdout);
+	}
+
+	/* NOTREACHED */
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/Makefile
new file mode 100644
index 0000000..0510b9b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/Makefile
@@ -0,0 +1,33 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+include $(SRC)/cmd/Makefile.cmd
+
+SUBDIRS = $(MACH)
+$(BUILD64)SUBDIRS += $(MACH64)
+
+include ../../Makefile.subdirs
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/Makefile.com b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/Makefile.com
new file mode 100644
index 0000000..f9ad960
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/Makefile.com
@@ -0,0 +1,76 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+include $(SRC)/cmd/Makefile.cmd
+
+.KEEP_STATE:
+
+ROOTBIN = $(ROOT)/opt/SUNWdtrt/bin
+ROOTBIN32 = $(ROOTBIN)/$(MACH32)
+ROOTBIN64 = $(ROOTBIN)/$(MACH64)
+
+PROG = chkargs
+LDLIBS = $(LDLIBS.cmd)
+LDLIBS += -ldtrace -lctf
+
+ROOTISAEXEC = $(ROOTBIN)/$(PROG)
+ROOTPROG32 = $(ROOTBIN32)/$(PROG)
+ROOTPROG64 = $(ROOTBIN64)/$(PROG)
+
+$(ROOTPROG32) := FILEMODE = 0555
+$(ROOTPROG64) := FILEMODE = 0555
+
+all: $(PROG)
+
+clean lint:
+
+clobber:
+	$(RM) $(PROG) $(ROOTISAEXEC)
+
+$(PROG): ../$(PROG).c
+	$(LINK.c) -o $@ ../$(PROG).c $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+$(ROOTPROG32): $(ROOTBIN32) $(PROG)
+
+$(ROOTPROG64): $(ROOTBIN64) $(PROG)
+
+$(ROOTBIN32)/%: %
+	$(INS.file)
+
+$(ROOTBIN64)/%: %
+	$(INS.file)
+
+$(ROOTISAEXEC):
+	$(RM) $@;
+	$(CP) -p $(ISAEXEC) $@
+
+$(ROOTBIN)/%: $(ROOTBIN)
+	$(INS.dir)
+
+$(ROOTBIN):
+	$(INS.dir)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/amd64/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/amd64/Makefile
new file mode 100644
index 0000000..38bbfc0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/amd64/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+include ../Makefile.com
+include $(SRC)/cmd/Makefile.cmd.64
+
+install: $(ROOTPROG64) $(ROOTISAEXEC)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/amd64/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/amd64/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/chkargs.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/chkargs.c
new file mode 100644
index 0000000..a7e0222
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/chkargs.c
@@ -0,0 +1,149 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <strings.h>
+#include <unistd.h>
+#include <dtrace.h>
+
+static int g_count;
+static int g_errs;
+static int g_fd;
+static int g_verbose;
+static int g_errexit;
+static char *g_progname;
+
+static int
+probe(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *data)
+{
+	dtrace_probeinfo_t p;
+	dtrace_argdesc_t arg;
+	char buf[BUFSIZ];
+	int i;
+
+	(void) printf("\r%6d", ++g_count);
+	(void) fflush(stdout);
+
+	if (dtrace_probe_info(dtp, pdp, &p) != 0) {
+		(void) printf(" failed to get probe info for "
+		    "%s:%s:%s:%s [%d]\n", pdp->dtpd_provider, pdp->dtpd_mod,
+		    pdp->dtpd_func, pdp->dtpd_name, pdp->dtpd_id);
+		g_errs++;
+		return (0);
+	}
+
+	for (i = 0; i < p.dtp_argc; i++) {
+		if (p.dtp_argv[i].dtt_type == CTF_ERR) {
+			bzero(&arg, sizeof (dtrace_argdesc_t));
+			arg.dtargd_id = pdp->dtpd_id;
+			arg.dtargd_ndx = i;
+			(void) ioctl(g_fd, DTRACEIOC_PROBEARG, &arg);
+
+			(void) printf(" failed to get types for args[%d] "
+			    "of %s:%s:%s:%s [%d]: <%s> -> <%s>\n", i,
+			    pdp->dtpd_provider, pdp->dtpd_mod, pdp->dtpd_func,
+			    pdp->dtpd_name, pdp->dtpd_id,
+			    arg.dtargd_native, arg.dtargd_xlate);
+
+			g_errs++;
+
+			if (g_errexit)
+				return (-1);
+
+		} else if (g_verbose) {
+			(void) printf("%d args[%d] : %s\n", pdp->dtpd_id, i,
+			    ctf_type_name(p.dtp_argv[i].dtt_ctfp,
+			    p.dtp_argv[i].dtt_type, buf, sizeof (buf)));
+		}
+	}
+
+	return (0);
+}
+
+int
+main(int argc, char *argv[])
+{
+	dtrace_probedesc_t pd, *pdp = NULL;
+	dtrace_hdl_t *dtp;
+	int err, c;
+	char *p;
+
+	g_progname = argv[0];
+
+	if ((dtp = dtrace_open(DTRACE_VERSION, 0, &err)) == NULL) {
+		(void) fprintf(stderr, "%s: failed to open dtrace: %s\n",
+		    g_progname, dtrace_errmsg(dtp, err));
+		return (1);
+	}
+
+	while ((c = getopt(argc, argv, "evx:")) != -1) {
+		switch (c) {
+		case 'e':
+			g_errexit++;
+			break;
+		case 'v':
+			g_verbose++;
+			break;
+		case 'x':
+			if ((p = strchr(optarg, '=')) != NULL)
+				*p++ = '\0';
+
+			if (dtrace_setopt(dtp, optarg, p) != 0) {
+				(void) fprintf(stderr, "%s: failed to set "
+				    "option -x %s: %s\n", g_progname, optarg,
+				    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+				return (2);
+			}
+			break;
+
+		default:
+			(void) fprintf(stderr, "Usage: %s [-ev] "
+			    "[-x opt[=arg]] [probedesc]\n", g_progname);
+			return (2);
+		}
+	}
+
+	argv += optind;
+	argc -= optind;
+
+	if (argc > 0) {
+		if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, argv[0], &pd)) {
+			(void) fprintf(stderr, "%s: invalid probe description "
+			    "%s: %s\n", g_progname, argv[0],
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+			return (2);
+		}
+		pdp = &pd;
+	}
+
+	g_fd = dtrace_ctlfd(dtp);
+	(void) dtrace_probe_iter(dtp, pdp, probe, NULL);
+	dtrace_close(dtp);
+
+	(void) printf("\nTotal probes: %d\n", g_count);
+	(void) printf("Total errors: %d\n\n", g_errs);
+
+	return (g_errs != 0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/i386/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/i386/Makefile
new file mode 100644
index 0000000..596e5b0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/i386/Makefile
@@ -0,0 +1,30 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+include ../Makefile.com
+
+install: $(ROOTPROG32) $(ROOTISAEXEC)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/i386/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/i386/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparc/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparc/Makefile
new file mode 100644
index 0000000..596e5b0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparc/Makefile
@@ -0,0 +1,30 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+include ../Makefile.com
+
+install: $(ROOTPROG32) $(ROOTISAEXEC)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparc/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparcv9/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparcv9/Makefile
new file mode 100644
index 0000000..38bbfc0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparcv9/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+include ../Makefile.com
+include $(SRC)/cmd/Makefile.cmd.64
+
+install: $(ROOTPROG64) $(ROOTISAEXEC)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparcv9/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/chkargs/sparcv9/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/Getopt.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/Getopt.java
new file mode 100644
index 0000000..e06a170
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/Getopt.java
@@ -0,0 +1,453 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+/* Copyright (c) 1988 AT&T */
+/* All Rights Reserved */
+
+import java.io.StringWriter;
+import java.io.PrintWriter;
+
+/**
+ * A Java port of Solaris {@code lib/libc/port/gen/getopt.c}, which is a
+ * port of System V UNIX getopt.  See <b>getopt(3C)</b> and SUS/XPG
+ * getopt() for function definition and requirements. Unlike that
+ * definition, this implementation moves non-options to the end of the
+ * argv array rather than quitting at the first non-option.
+ */
+public class Getopt {
+    static final int EOF = -1;
+
+    private String progname;
+    private String[] args;
+    private int argc;
+    private String optstring;
+    private int optind = 0; // args index
+    private int optopt = 0;
+    private String optarg = null;
+    private boolean opterr = true;
+
+    /*
+     * _sp is required to keep state between successive calls to
+     * getopt() while extracting aggregated short-options (ie: -abcd).
+     */
+    private int _sp = 1;
+
+    /**
+     * Creates a {Code Getopt} instance to parse the given command-line
+     * arguments. Modifies the given args array by swapping the
+     * positions of non-options and options so that non-options appear
+     * at the end of the array.
+     */
+    public Getopt(String programName, String[] args,
+	    String optionString)
+    {
+	progname = programName;
+	// No defensive copy; Getopt is expected to modify the given
+	// args array
+	this.args = args;
+	argc = this.args.length;
+	optstring = optionString;
+	validate();
+    }
+
+    private void
+    validate()
+    {
+	if (progname == null) {
+	    throw new NullPointerException("program name is null");
+	}
+	int i = 0;
+	for (String s : args) {
+	    if (s == null) {
+		throw new NullPointerException("null arg at index " + i);
+	    }
+	    ++i;
+	}
+	if (optstring == null) {
+	    throw new NullPointerException("option string is null");
+	}
+    }
+
+    private static class StringRef {
+	private String s;
+
+	public String
+	get()
+	{
+	    return s;
+	}
+
+	public StringRef
+	set(String value)
+	{
+	    s = value;
+	    return this;
+	}
+    }
+
+    /*
+     * Generalized error processing method. If the optstr parameter is
+     * null, the character c is converted to a string and displayed
+     * instead.
+     */
+    void
+    err(String format, char c, String optstr)
+    {
+	if (opterr && optstring.charAt(0) != ':') {
+	    StringWriter w = new StringWriter();
+	    PrintWriter p = new PrintWriter(w);
+	    p.printf(format, progname, (optstr == null ?
+		    Character.toString(c) : optstr.substring(2)));
+	    System.err.println(w.toString());
+	}
+    }
+
+    /*
+     * Determine if the specified character (c) is present in the string
+     * (optstring) as a regular, single character option. If the option
+     * is found, return an index into optstring where the short-option
+     * character is found, otherwise return -1. The characters ':' and
+     * '(' are not allowed.
+     */
+    static int
+    parseshort(String optstring, char c)
+    {
+	if (c == ':' || c == '(') {
+	    return -1;
+	}
+
+	int ch;
+	int len = optstring.length();
+	for (int i = 0; i < len; ++i) {
+	    ch = optstring.charAt(i);
+	    if (ch == c) {
+		return i;
+	    }
+
+	    while (i < len && ch == '(') {
+		for (++i; i < len && (ch = optstring.charAt(i)) != ')'; ++i);
+	    }
+	}
+
+	return -1;
+    }
+
+    /**
+     * Determine if the specified string (opt) is present in the string
+     * (optstring) as a long-option contained within parenthesis. If the
+     * long-option specifies option-argument, return a reference to it
+     * in longoptarg.  Otherwise set the longoptarg reference to null.
+     * If the option is found, return an index into optstring at the
+     * position of the short-option character associated with the
+     * long-option; otherwise return -1.
+     *
+     * @param optstring	the entire optstring passed to the {@code
+     * Getopt} constructor
+     * @param opt the long option read from the command line
+     * @param longoptarg the value of the option is returned in this
+     * parameter, if an option exists. Possible return values in
+     * longoptarg are:
+     * <ul>
+     * <li><b>NULL:</b> No argument was found</li>
+     * <li><b>empty string (""):</b> Argument was explicitly left empty
+     * by the user (e.g., --option= )</li>
+     * <li><b>valid string:</b> Argument found on the command line</li>
+     * </ul>
+     * @return index to equivalent short-option in optstring, or -1 if
+     * option not found in optstring.
+     */
+    static int
+    parselong(String optstring, String opt, StringRef longoptarg)
+    {
+	int cp; // index into optstring, beginning of one option spec
+	int ip; // index into optstring, traverses every char
+	char ic; // optstring char
+	int il; // optstring length
+	int op;	// index into opt
+	char oc; // opt char
+	int ol; // opt length
+	boolean	match; // true if opt is matching part of optstring
+
+	longoptarg.set(null);
+	cp = ip = 0;
+	il = optstring.length();
+	ol = opt.length();
+	do {
+	    ic = optstring.charAt(ip);
+	    if (ic != '(' && ++ip == il)
+		break;
+	    ic = optstring.charAt(ip);
+	    if (ic == ':' && ++ip == il)
+		break;
+	    ic = optstring.charAt(ip);
+	    while (ic == '(') {
+		if (++ip == il)
+		    break;
+		op = 0;
+		match = true;
+		while (ip < il && (ic = optstring.charAt(ip)) != ')' &&
+			op < ol) {
+		    oc = opt.charAt(op++);
+		    match = (ic == oc && match);
+		    ++ip;
+		}
+
+		if (match && ip < il && ic == ')' && (op >= ol ||
+			opt.charAt(op) == '=')) {
+		    if (op < ol && opt.charAt(op) == '=') {
+			/* may be an empty string - OK */
+			longoptarg.set(opt.substring(op + 1));
+		    } else {
+			longoptarg.set(null);
+		    }
+		    return cp;
+		}
+		if (ip < il && ic == ')' && ++ip == il)
+		    break;
+		ic = optstring.charAt(ip);
+	    }
+	    cp = ip;
+	    /*
+	     * Handle double-colon in optstring ("a::(longa)") The old
+	     * getopt() accepts it and treats it as a required argument.
+	     */
+	    while ((cp > 0) && (cp < il) && (optstring.charAt(cp) == ':')) {
+		--cp;
+	    }
+	} while (cp < il);
+	return -1;
+    }
+
+    /**
+     * Get the current option value.
+     */
+    public String
+    getOptarg()
+    {
+	return optarg;
+    }
+
+    /**
+     * Get the index of the next option to be parsed.
+     */
+    public int
+    getOptind()
+    {
+	return optind;
+    }
+
+    /**
+     * Gets the command-line arguments.
+     */
+    public String[]
+    getArgv()
+    {
+	// No defensive copy: Getopt is expected to modify the given
+	// args array.
+	return args;
+    }
+
+    /**
+     * Gets the aggregated short option that just failed. Since long
+     * options can't be aggregated, a failed long option can be obtained
+     * by {@code getArgv()[getOptind() - 1]}.
+     */
+    public int
+    getOptopt()
+    {
+	return optopt;
+    }
+
+    /**
+     * Set to {@code false} to suppress diagnostic messages to stderr.
+     */
+    public void
+    setOpterr(boolean err)
+    {
+	opterr = err;
+    }
+
+    /**
+     * Gets the next option character, or -1 if there are no more
+     * options. If getopt() encounters a short-option character or a
+     * long-option string not described in the {@code optionString}
+     * argument to the constructor, it returns the question-mark (?)
+     * character. If it detects a missing option-argument, it also
+     * returns the question-mark (?) character, unless the first
+     * character of the {@code optionString} argument was a colon (:),
+     * in which case getopt() returns the colon (:) character.
+     * <p>
+     * This implementation swaps the positions of options and
+     * non-options in the given argv array.
+     */
+    public int
+    getopt()
+    {
+	char c;
+	int cp;
+	boolean longopt;
+	StringRef longoptarg = new StringRef();
+
+	/*
+	 * Has the end of the options been encountered?  The following
+	 * implements the SUS requirements:
+	 *
+	 * If, when getopt() is called:
+	 *	- the first character of argv[optind] is not '-'
+	 *	- argv[optind] is the string "-"
+	 * getopt() returns -1 without changing optind if
+	 *	- argv[optind] is the string "--"
+	 * getopt() returns -1 after incrementing optind
+	 */
+	if (_sp == 1) {
+	    boolean nonOption;
+	    do {
+		nonOption = false;
+		if (optind >= argc || args[optind].equals("-")) {
+		    return EOF;
+		} else if (args[optind].equals("--")) {
+		    ++optind;
+		    return EOF;
+		} else if (args[optind].charAt(0) != '-') {
+		    // non-option: here we deviate from the SUS requirements
+		    // by not quitting, and instead move non-options to the
+		    // end of the args array
+		    nonOption = true;
+		    String tmp = args[optind];
+		    if (optind + 1 < args.length) {
+			System.arraycopy(args, optind + 1, args, optind,
+				args.length - (optind + 1));
+			args[args.length - 1] = tmp;
+		    }
+		    --argc;
+		}
+	    } while (nonOption);
+	}
+
+	/*
+	 * Getting this far indicates that an option has been encountered.
+	 * Note that the syntax of optstring applies special meanings to
+	 * the characters ':' and '(', so they are not permissible as
+	 * option letters. A special meaning is also applied to the ')'
+	 * character, but its meaning can be determined from context.
+	 * Note that the specification only requires that the alnum
+	 * characters be accepted.
+	 *
+	 * If the second character of the argument is a '-' this must be
+	 * a long-option, otherwise it must be a short option.  Scan for
+	 * the option in optstring by the appropriate algorithm. Either
+	 * scan will return an index to the short-option character in
+	 * optstring if the option is found and -1 otherwise.
+	 *
+	 * For an unrecognized long-option, optopt will equal 0, but
+	 * since long-options can't aggregate the failing option can be
+	 * identified by argv[optind-1].
+	 */
+	optopt = c = args[optind].charAt(_sp);
+	optarg = null;
+	longopt = (_sp == 1 && c == '-');
+	if (!(longopt
+		? ((cp = parselong(optstring, args[optind].substring(2),
+		longoptarg)) != -1)
+		: ((cp = parseshort(optstring, c)) != -1))) {
+	    err("%s: illegal option -- %s", c,
+		    (longopt ? args[optind] : null));
+	    /*
+	     * Note: When the long option is unrecognized, optopt will
+	     * be '-' here, which matches the specification.
+	     */
+	    if (args[optind].length() == ++_sp || longopt) {
+		++optind;
+		_sp = 1;
+	    }
+	    return '?';
+	}
+	optopt = c = optstring.charAt(cp);
+
+	/*
+	 * A valid option has been identified.  If it should have an
+	 * option-argument, process that now.  SUS defines the setting
+	 * of optarg as follows:
+	 *
+	 *   1.	If the option was the last character in an element of
+	 *   argv, then optarg contains the next element of argv, and
+	 *   optind is incremented by 2. If the resulting value of
+	 *   optind is not less than argc, this indicates a missing
+	 *   option-argument, and getopt() returns an error indication.
+	 *
+	 *   2.	Otherwise, optarg points to the string following the
+	 *   option character in that element of argv, and optind is
+	 *   incremented by 1.
+	 *
+	 * The second clause allows -abcd (where b requires an
+	 * option-argument) to be interpreted as "-a -b cd".
+	 *
+	 * Note that the option-argument can legally be an empty string,
+	 * such as:
+	 * 	command --option= operand
+	 * which explicitly sets the value of --option to nil
+	 */
+	if (cp + 1 < optstring.length() && optstring.charAt(cp + 1) == ':') {
+	    // The option takes an argument
+	    if (!longopt && ((_sp + 1) < args[optind].length())) {
+		optarg = args[optind++].substring(_sp + 1);
+	    } else if (longopt && (longoptarg.get() != null)) {
+		/*
+		 * The option argument was explicitly set to the empty
+		 * string on the command line (--option=)
+		 */
+		optind++;
+		optarg = longoptarg.get();
+	    } else if (++optind >= argc) {
+		err("%s: option requires an argument -- %s", c,
+			(longopt ? args[optind - 1] : null));
+		_sp = 1;
+		optarg = null;
+		return (optstring.charAt(0) == ':' ? ':' : '?');
+	    } else
+		optarg = args[optind++];
+		_sp = 1;
+	    } else {
+		// The option does NOT take an argument
+		if (longopt && (longoptarg.get() != null)) {
+		// User supplied an arg to an option that takes none
+		err("%s: option doesn't take an argument -- %s", (char)0,
+			(longopt ? args[optind] : null));
+		optarg = longoptarg.set(null).get();
+		c = '?';
+	    }
+
+	    if (longopt || args[optind].length() == ++_sp) {
+		_sp = 1;
+		++optind;
+	    }
+	    optarg = null;
+	}
+	return (c);
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/JDTrace.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/JDTrace.java
new file mode 100644
index 0000000..3c5654d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/JDTrace.java
@@ -0,0 +1,1042 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+import org.opensolaris.os.dtrace.*;
+import java.io.*;
+import java.util.*;
+import java.util.logging.*;
+
+/**
+ * Emulates {@code dtrace(1M)} using the Java DTrace API.
+ */
+public class JDTrace {
+    static Logger logger = Logger.getLogger(JDTrace.class.getName());
+
+    static Consumer dtrace;
+
+    static {
+	Handler handler = new ConsoleHandler();
+	handler.setLevel(Level.ALL);
+	logger.addHandler(handler);
+    }
+
+    static final String CLASSNAME = "JDTrace";
+    static final String OPTSTR =
+	    "3:6:b:c:CD:ef:Fi:I:lL:m:n:o:p:P:qs:U:vVwx:X:Z";
+    static boolean heading = false;
+    static boolean quiet = false;
+    static boolean flow = false;
+    static int stackindent = 14;
+    static int exitStatus = 0;
+    static boolean started;
+    static boolean stopped;
+    static PrintStream out = System.out;
+    static final String ATS = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
+    static final String SPACES = "                                        ";
+    static final int QUANTIZE_ZERO_BUCKET = 63;
+
+    enum Mode {
+	EXEC,
+	INFO,
+	LIST,
+	VERSION
+    }
+
+    enum ProgramType {
+	STRING,
+	FILE
+    }
+
+    static class CompileRequest {
+	String s;
+	ProgramType type;
+	ProbeDescription.Spec probespec;
+    }
+
+    // Modify program string by expanding an incomplete probe
+    // description according to the requested probespec.
+    static void
+    applyProbespec(CompileRequest req)
+    {
+	ProbeDescription.Spec spec = ((req.probespec == null)
+		? ProbeDescription.Spec.NAME
+		: req.probespec);
+
+	int colons = 0;
+	switch (req.probespec) {
+	    case PROVIDER:
+		colons = 3;
+		break;
+	    case MODULE:
+		colons = 2;
+		break;
+	    case FUNCTION:
+		colons = 1;
+		break;
+	}
+
+	StringBuffer buf = new StringBuffer();
+	if (colons > 0) {
+	    char ch;
+	    int len = req.s.length();
+
+	    int i = 0;
+	    // Find first whitespace character not including leading
+	    // whitespace (end of first token).  Ignore whitespace
+	    // inside a block if the block is concatenated with the
+	    // probe description.
+	    for (; (i < len) && Character.isWhitespace(req.s.charAt(i)); ++i);
+	    int npos = i;
+	    boolean inBlock = false;
+	    for (; (npos < len) &&
+		    (!Character.isWhitespace(ch = req.s.charAt(npos)) ||
+		    inBlock); ++npos) {
+		if (ch == '{') {
+		    inBlock = true;
+		} else if (ch == '}') {
+		    inBlock = false;
+		}
+	    }
+
+	    // libdtrace lets you concatenate multiple probe
+	    // descriptions separated by code blocks in curly braces,
+	    // for example genunix::'{printf("FOUND");}'::entry, as long
+	    // as the concatenated probe descriptions begin with ':' and
+	    // not a specific field such as 'syscall'.  So to expand the
+	    // possibly multiple probe descriptions, we need to insert
+	    // colons before each open curly brace, and again at the end
+	    // only if there is at least one non-whitespace (probe
+	    // specifying) character after the last closing curly brace.
+
+	    int prev_i = 0;
+	    while (i < npos) {
+		for (; (i < npos) && (req.s.charAt(i) != '{'); ++i);
+		buf.append(req.s.substring(prev_i, i));
+		if ((i < npos) || ((i > 0) && (req.s.charAt(i - 1) != '}'))) {
+		    for (int c = 0; c < colons; ++c) {
+			buf.append(':');
+		    }
+		}
+		if (i < npos) {
+		    buf.append(req.s.charAt(i++));
+		}
+		prev_i = i;
+	    }
+
+	    // append remainder of program text
+	    buf.append(req.s.substring(i));
+
+	    req.s = buf.toString();
+	}
+    }
+
+    static void
+    printValue(Object value, int bytes, String stringFormat)
+    {
+	if (value instanceof Integer) {
+	    if (bytes == 1) {
+		out.printf(" %3d", (Integer)value);
+	    } else if (bytes == 2) {
+		out.printf(" %5d", (Integer)value);
+	    } else {
+		out.printf(" %8d", (Integer)value);
+	    }
+	} else if (value instanceof Long) {
+	    out.printf(" %16d", (Long)value);
+	} else {
+	    out.printf(stringFormat, value.toString());
+	}
+    }
+
+    static void
+    consumeProbeData(ProbeData data)
+    {
+	if (logger.isLoggable(Level.FINER)) {
+	    logger.finer(data.toString());
+	}
+
+	if (!heading) {
+	    if (flow) {
+		out.printf("%3s %-41s\n", "CPU", "FUNCTION");
+	    } else {
+		if (!quiet) {
+		    out.printf("%3s %6s %32s\n",
+			    "CPU", "ID", "FUNCTION:NAME");
+		}
+	    }
+	    heading = true;
+	}
+	ProbeDescription probe = data.getEnabledProbeDescription();
+	if (flow) {
+	    Flow flow = data.getFlow();
+	    int indent = (flow.getDepth() * 2);
+	    StringBuffer buf = new StringBuffer();
+	    // indent
+	    buf.append(' ');
+	    for (int i = 0; i < indent; ++i) {
+		buf.append(' ');
+	    }
+	    // prefix
+	    switch (flow.getKind()) {
+		case ENTRY:
+		    if (indent == 0) {
+			buf.append("=> ");
+		    } else {
+			buf.append("-> ");
+		    }
+		    break;
+		case RETURN:
+		    if (indent == 0) {
+			buf.append("<= ");
+		    } else {
+			buf.append("<- ");
+		    }
+		    break;
+	    }
+
+	    switch (flow.getKind()) {
+		case NONE:
+		    buf.append(probe.getFunction());
+		    buf.append(':');
+		    buf.append(probe.getName());
+		    break;
+		default:
+		    buf.append(probe.getFunction());
+	    }
+
+	    out.printf("%3s %-41s ", data.getCPU(),
+		    buf.toString());
+	} else {
+	    if (!quiet) {
+		StringBuffer buf = new StringBuffer();
+		buf.append(probe.getFunction());
+		buf.append(':');
+		buf.append(probe.getName());
+		out.printf("%3s %6s %32s ",
+			data.getCPU(), probe.getID(),
+			buf.toString());
+	    }
+	}
+	Record record = null;
+	Object value;
+	List <Record> records = data.getRecords();
+	Iterator <Record> itr = records.iterator();
+	while (itr.hasNext()) {
+	    record = itr.next();
+
+	    if (record instanceof ExitRecord) {
+		exitStatus = ((ExitRecord)record).getStatus();
+	    } else if (record instanceof ScalarRecord) {
+		ScalarRecord scalar = (ScalarRecord)record;
+		value = scalar.getValue();
+		if (value instanceof byte[]) {
+		    out.print(record.toString());
+		} else {
+		    if (quiet) {
+			out.print(value);
+		    } else {
+			printValue(value, scalar.getNumberOfBytes(),
+				"  %-33s");
+		    }
+		}
+	    } else if (record instanceof PrintfRecord) {
+		out.print(record);
+	    } else if (record instanceof PrintaRecord) {
+		PrintaRecord printa = (PrintaRecord)record;
+		List <Tuple> tuples = printa.getTuples();
+		if (tuples.isEmpty()) {
+		    out.print(printa.getOutput());
+		} else {
+		    for (Tuple t : tuples) {
+			out.print(printa.getFormattedString(t));
+		    }
+		}
+
+		if (logger.isLoggable(Level.FINE)) {
+		    logger.fine(printa.toString());
+		}
+	    } else if (record instanceof StackValueRecord) {
+		printStack((StackValueRecord)record);
+	    }
+	}
+	if (!quiet) {
+	    out.println();
+	}
+    }
+
+    static void
+    printDistribution(Distribution d)
+    {
+	out.printf("\n%16s %41s %-9s\n", "value",
+		"------------- Distribution -------------",
+		"count");
+	long v; // bucket frequency (value)
+	long b; // lower bound of bucket range
+	double total = 0;
+	boolean positives = false;
+	boolean negatives = false;
+
+	Distribution.Bucket bucket;
+	int b1 = 0; // first displayed bucket
+	int b2 = d.size() - 1; // last displayed bucket
+	for (; (b1 <= b2) && (d.get(b1).getFrequency() == 0); ++b1);
+	// If possible, get one bucket before the first non-zero
+	// bucket and one bucket after the last.
+	if (b1 > b2) {
+	    // There isn't any data.  This is possible if (and only if)
+	    // negative increment values have been used.  In this case,
+	    // print the buckets around the base.
+	    if (d instanceof LinearDistribution) {
+		b1 = 0;
+		b2 = 2;
+	    } else {
+		b1 = QUANTIZE_ZERO_BUCKET - 1;
+		b2 = QUANTIZE_ZERO_BUCKET + 1;
+	    }
+	} else {
+	    if (b1 > 0) --b1;
+	    for (; (b2 > 0) && (d.get(b2).getFrequency() == 0); --b2);
+	    if (b2 < (d.size() - 1)) ++b2;
+	}
+	for (int i = b1; i <= b2; ++i) {
+	    v = d.get(i).getFrequency();
+	    if (v > 0) {
+		positives = true;
+	    }
+	    if (v < 0) {
+		negatives = true;
+	    }
+	    total += Math.abs((double)v);
+	}
+	for (int i = b1; i <= b2; ++i) {
+	    bucket = d.get(i);
+	    v = bucket.getFrequency();
+	    b = bucket.getMin();
+
+	    if (d instanceof LinearDistribution) {
+		if (b == Long.MIN_VALUE) {
+		    String lt = "< " + ((LinearDistribution)d).getBase();
+		    out.printf("%16s ", lt);
+		} else if (bucket.getMax() == Long.MAX_VALUE) {
+		    String ge = ">= " + b;
+		    out.printf("%16s ", ge);
+		} else {
+		    out.printf("%16d ", b);
+		}
+	    } else {
+		out.printf("%16d ", b);
+	    }
+
+	    printDistributionLine(v, total, positives, negatives);
+	}
+    }
+
+    static void
+    printDistributionLine(long val, double total, boolean positives,
+	    boolean negatives)
+    {
+	double f;
+	int depth, len = 40;
+
+	assert (ATS.length() == len && SPACES.length() == len);
+	assert (!(total == 0 && (positives || negatives)));
+	assert (!(val < 0 && !negatives));
+	assert (!(val > 0 && !positives));
+	assert (!(val != 0 && total == 0));
+
+	if (!negatives) {
+	    if (positives) {
+		f = (Math.abs((double)val) * (double)len) / total;
+		    depth = (int)(f + 0.5);
+	    } else {
+		depth = 0;
+	    }
+
+	    out.printf("|%s%s %-9d\n", ATS.substring(len - depth),
+		    SPACES.substring(depth), val);
+	    return;
+	}
+
+	if (!positives) {
+	    f = (Math.abs((double)val) * (double)len) / total;
+	    depth = (int)(f + 0.5);
+
+	    out.printf("%s%s| %-9d\n", SPACES.substring(depth),
+		    ATS.substring(len - depth), val);
+	    return;
+	}
+
+	/*
+	 * If we're here, we have both positive and negative bucket values.
+	 * To express this graphically, we're going to generate both positive
+	 * and negative bars separated by a centerline.  These bars are half
+	 * the size of normal quantize()/lquantize() bars, so we divide the
+	 * length in half before calculating the bar length.
+	 */
+	len /= 2;
+	String ats = ATS.substring(len);
+	String spaces = SPACES.substring(len);
+
+	f = (Math.abs((double)val) * (double)len) / total;
+	depth = (int)(f + 0.5);
+
+	if (val <= 0) {
+	    out.printf("%s%s|%s %-9d\n", spaces.substring(depth),
+		    ats.substring(len - depth), repeat(" ", len), val);
+	    return;
+	} else {
+	    out.printf("%20s|%s%s %-9d\n", "", ats.substring(len - depth),
+		    spaces.substring(depth), val);
+	}
+    }
+
+    public static String
+    repeat(String s, int n)
+    {
+        StringBuffer buf = new StringBuffer();
+        for (int i = 0; i < n; ++i) {
+            buf.append(s);
+        }
+        return buf.toString();
+    }
+
+    static void
+    printStack(StackValueRecord rec)
+    {
+	StackFrame[] frames = rec.getStackFrames();
+	int i;
+	out.println();
+	String s;
+	for (StackFrame f : frames) {
+	    for (i = 0; i < stackindent; ++i) {
+		out.print(' ');
+	    }
+	    s = f.getFrame();
+	    if (s.indexOf('[') == 0) {
+		out.print("  ");
+	    }
+	    out.println(s);
+	}
+    }
+
+    static void
+    printAggregate(Aggregate aggregate)
+    {
+	printAggregationRecords(aggregate.getOrderedRecords());
+    }
+
+    static void
+    printAggregationRecords(List <AggregationRecord> list)
+    {
+	Tuple tuple;
+	AggregationValue value;
+	ValueRecord tupleRecord;
+	int i;
+	int len;
+	for (AggregationRecord r : list) {
+	    tuple = r.getTuple();
+	    value = r.getValue();
+	    len = tuple.size();
+	    for (i = 0; i < len; ++i) {
+		tupleRecord = tuple.get(i);
+		if (tupleRecord instanceof StackValueRecord) {
+		    printStack((StackValueRecord)tupleRecord);
+		} else if (tupleRecord instanceof SymbolValueRecord) {
+		    printValue(tupleRecord.toString(), -1, "  %-50s");
+		} else {
+		    printValue(tupleRecord.getValue(),
+			    ((ScalarRecord)tupleRecord).getNumberOfBytes(),
+			    "  %-50s");
+		}
+	    }
+	    if (value instanceof Distribution) {
+		Distribution d = (Distribution)value;
+		printDistribution(d);
+	    } else {
+		Number v = value.getValue();
+		printValue(v, -1, "  %-50s");
+	    }
+	    out.println();
+	}
+    }
+
+    static void
+    exit(int status)
+    {
+	out.flush();
+	System.err.flush();
+	if (status == 0) {
+	    status = exitStatus;
+	}
+	System.exit(status);
+    }
+
+    static void
+    usage()
+    {
+	String predact = "[[ predicate ] action ]";
+	System.err.printf("Usage: java %s [-32|-64] [-CeFlqvVwZ] " +
+	    "[-b bufsz] [-c cmd] [-D name[=def]]\n\t[-I path] [-L path] " +
+	    "[-o output] [-p pid] [-s script] [-U name]\n\t" +
+	    "[-x opt[=val]] [-X a|c|s|t]\n\n" +
+	    "\t[-P provider %s]\n" +
+	    "\t[-m [ provider: ] module %s]\n" +
+	    "\t[-f [[ provider: ] module: ] func %s]\n" +
+	    "\t[-n [[[ provider: ] module: ] func: ] name %s]\n" +
+	    "\t[-i probe-id %s] [ args ... ]\n\n", CLASSNAME,
+	    predact, predact, predact, predact, predact);
+	System.err.printf("\tpredicate -> '/' D-expression '/'\n");
+	System.err.printf("\t   action -> '{' D-statements '}'\n");
+	System.err.printf("\n" +
+	    "\t-32 generate 32-bit D programs\n" +
+	    "\t-64 generate 64-bit D programs\n\n" +
+	    "\t-b  set trace buffer size\n" +
+	    "\t-c  run specified command and exit upon its completion\n" +
+	    "\t-C  run cpp(1) preprocessor on script files\n" +
+	    "\t-D  define symbol when invoking preprocessor\n" +
+	    "\t-e  exit after compiling request but prior to enabling " +
+		    "probes\n" +
+	    "\t-f  enable or list probes matching the specified " +
+		    "function name\n" +
+	    "\t-F  coalesce trace output by function\n" +
+	    "\t-i  enable or list probes matching the specified probe id\n" +
+	    "\t-I  add include directory to preprocessor search path\n" +
+	    "\t-l  list probes matching specified criteria\n" +
+	    "\t-L  add library directory to library search path\n" +
+	    "\t-m  enable or list probes matching the specified " +
+		    "module name\n" +
+	    "\t-n  enable or list probes matching the specified probe name\n" +
+	    "\t-o  set output file\n" +
+	    "\t-p  grab specified process-ID and cache its symbol tables\n" +
+	    "\t-P  enable or list probes matching the specified " +
+		    "provider name\n" +
+	    "\t-q  set quiet mode (only output explicitly traced data)\n" +
+	    "\t-s  enable or list probes according to the specified " +
+		    "D script\n" +
+	    "\t-U  undefine symbol when invoking preprocessor\n" +
+	    "\t-v  set verbose mode (report stability attributes, " +
+		    "arguments)\n" +
+	    "\t-V  report DTrace API version\n" +
+	    "\t-w  permit destructive actions\n" +
+	    "\t-x  enable or modify compiler and tracing options\n" +
+	    "\t-X  specify ISO C conformance settings for preprocessor\n" +
+	    "\t-Z  permit probe descriptions that match zero probes\n" +
+	    "\n" +
+	    "\tTo log PrintaRecord, set this environment variable:\n" +
+	    "\t\tJDTRACE_LOGGING_LEVEL=FINE\n" +
+	    "\tTo log ProbeData, set JDTRACE_LOGGING_LEVEL=FINER\n");
+	exit(2);
+    }
+
+    static void
+    printProgramStability(String programType, String programDescription,
+	    ProgramInfo info)
+    {
+	out.println();
+	out.printf("Stability data for %s %s:\n\n",
+		programType, programDescription);
+	InterfaceAttributes a;
+	out.println("\tMinimum probe description " +
+		"attributes");
+	a = info.getMinimumProbeAttributes();
+	out.printf("\t\tIdentifier Names: %s\n",
+		a.getNameStability());
+	out.printf("\t\tData Semantics:   %s\n",
+		a.getDataStability());
+	out.printf("\t\tDependency Class: %s\n",
+		a.getDependencyClass());
+	out.println("\tMinimum probe statement attributes");
+	a = info.getMinimumStatementAttributes();
+	out.printf("\t\tIdentifier Names: %s\n",
+		a.getNameStability());
+	out.printf("\t\tData Semantics:   %s\n",
+		a.getDataStability());
+	out.printf("\t\tDependency Class: %s\n",
+		a.getDependencyClass());
+    }
+
+    static void
+    printProbeDescription(ProbeDescription p)
+    {
+	out.printf("%5d %10s %17s %33s %s\n", p.getID(),
+	    p.getProvider(), p.getModule(),
+	    p.getFunction(), p.getName());
+    }
+
+    static void
+    printProbeInfo(ProbeInfo p)
+    {
+	InterfaceAttributes a;
+	out.println("\n\tProbe Description Attributes");
+
+	a = p.getProbeAttributes();
+	out.printf("\t\tIdentifier Names: %s\n",
+	    a.getNameStability());
+	out.printf("\t\tData Semantics:   %s\n",
+	    a.getDataStability());
+	out.printf("\t\tDependency Class: %s\n",
+	    a.getDependencyClass());
+
+	out.println("\n\tArgument Attributes");
+
+	a = p.getArgumentAttributes();
+	out.printf("\t\tIdentifier Names: %s\n",
+	    a.getNameStability());
+	out.printf("\t\tData Semantics:   %s\n",
+	    a.getDataStability());
+	out.printf("\t\tDependency Class: %s\n",
+	    a.getDependencyClass());
+
+	// Argument types unsupported for now.
+
+	out.println();
+    }
+
+    public static void
+    main(String[] args)
+    {
+	String loggingLevel = System.getenv().get("JDTRACE_LOGGING_LEVEL");
+	try {
+	    logger.setLevel(Level.parse(loggingLevel));
+	} catch (Exception e) {
+	    logger.setLevel(Level.OFF);
+	}
+
+	if (args.length == 0) {
+	    usage();
+	}
+
+	List <CompileRequest> compileRequests = new LinkedList
+		<CompileRequest> ();
+	List <Program> programList = new LinkedList <Program> ();
+	boolean verbose = false;
+	Mode mode = Mode.EXEC;
+
+	final ExceptionHandler exceptionHandler = new ExceptionHandler() {
+	    public void handleException(Throwable e) {
+		if (e instanceof DTraceException) {
+		    DTraceException de = (DTraceException)e;
+		    System.err.printf("dtrace: %s\n", de.getMessage());
+		} else if (e instanceof ConsumerException) {
+		    ConsumerException ce = (ConsumerException)e;
+		    Object msg = ce.getNotificationObject();
+		    if ((msg instanceof org.opensolaris.os.dtrace.Error) ||
+			(msg instanceof Drop)) {
+			System.err.printf("dtrace: %s\n", ce.getMessage());
+		    } else {
+			ce.printStackTrace();
+		    }
+		} else {
+		    e.printStackTrace();
+		}
+		exit(1);
+	    }
+	};
+
+	Getopt g = new Getopt(CLASSNAME, args, OPTSTR);
+	int c = 0;
+
+	List <Consumer.OpenFlag> openFlags =
+		new ArrayList <Consumer.OpenFlag> ();
+
+	while ((c = g.getopt()) != -1) {
+	    switch (c) {
+		case '3': {
+		    String s = g.getOptarg();
+		    if (!s.equals("2")) {
+			System.err.println("dtrace: illegal option -- 3" + s);
+			usage();
+		    }
+		    openFlags.add(Consumer.OpenFlag.ILP32);
+		    break;
+		}
+		case '6': {
+		    String s = g.getOptarg();
+		    if (!s.equals("4")) {
+			System.err.println("dtrace: illegal option -- 6" + s);
+			usage();
+		    }
+		    openFlags.add(Consumer.OpenFlag.LP64);
+		    break;
+		}
+	    }
+	}
+
+	Consumer.OpenFlag[] oflags = new Consumer.OpenFlag[openFlags.size()];
+	oflags = openFlags.toArray(oflags);
+
+	dtrace = new LocalConsumer() {
+	    protected Thread createThread() {
+		Thread t = super.createThread();
+		t.setDaemon(false);
+		t.setPriority(Thread.MIN_PRIORITY);
+		return t;
+	    }
+	};
+
+	g = new Getopt(CLASSNAME, args, OPTSTR);
+	c = 0;
+
+	try {
+	    dtrace.open(oflags);
+
+	    // Set default options that may be overriden by options or #pragma
+	    dtrace.setOption(Option.bufsize, Option.mb(4));
+	    dtrace.setOption(Option.aggsize, Option.mb(4));
+
+	    CompileRequest r;
+	    while ((c = g.getopt()) != -1) {
+		switch (c) {
+		    case 'b':
+			dtrace.setOption(Option.bufsize, g.getOptarg());
+			break;
+		    case 'c':
+			dtrace.createProcess(g.getOptarg());
+			break;
+		    case 'C':
+			dtrace.setOption(Option.cpp);
+			break;
+		    case 'D':
+			dtrace.setOption(Option.define, g.getOptarg());
+			break;
+		    case 'e':
+			mode = Mode.INFO;
+			break;
+		    case 'f':
+			r = new CompileRequest();
+			r.s = g.getOptarg();
+			r.type = ProgramType.STRING;
+			r.probespec = ProbeDescription.Spec.FUNCTION;
+			compileRequests.add(r);
+			break;
+		    case 'F':
+			dtrace.setOption(Option.flowindent);
+			break;
+		    case 'i':
+			r = new CompileRequest();
+			r.s = g.getOptarg();
+			r.type = ProgramType.STRING;
+			r.probespec = ProbeDescription.Spec.NAME;
+			compileRequests.add(r);
+			break;
+		    case 'I':
+			dtrace.setOption(Option.incdir, g.getOptarg());
+			break;
+		    case 'l':
+			mode = Mode.LIST;
+			dtrace.setOption(Option.zdefs); // -l implies -Z
+			break;
+		    case 'L':
+			dtrace.setOption(Option.libdir, g.getOptarg());
+			break;
+		    case 'm':
+			r = new CompileRequest();
+			r.s = g.getOptarg();
+			r.type = ProgramType.STRING;
+			r.probespec = ProbeDescription.Spec.MODULE;
+			compileRequests.add(r);
+			break;
+		    case 'n':
+			r = new CompileRequest();
+			r.s = g.getOptarg();
+			r.type = ProgramType.STRING;
+			r.probespec = ProbeDescription.Spec.NAME;
+			compileRequests.add(r);
+			break;
+		    case 'o':
+			String outFileName = g.getOptarg();
+			File outFile = new File(outFileName);
+			try {
+			    FileOutputStream fos = new FileOutputStream(
+				    outFile, true);
+			    out = new PrintStream(fos);
+			} catch (FileNotFoundException e) {
+			    System.err.println("failed to open " +
+				outFileName + " in write mode");
+			    exit(1);
+			} catch (SecurityException e) {
+			    System.err.println("failed to open " +
+				outFileName);
+			    exit(1);
+			}
+			break;
+		    case 'p':
+			String pidstr = g.getOptarg();
+			int pid = -1;
+			try {
+			    pid = Integer.parseInt(pidstr);
+			} catch (NumberFormatException e) {
+			    System.err.println("invalid pid: " + pidstr);
+			    exit(1);
+			}
+			dtrace.grabProcess(pid);
+			break;
+		    case 'P':
+			r = new CompileRequest();
+			r.s = g.getOptarg();
+			r.type = ProgramType.STRING;
+			r.probespec = ProbeDescription.Spec.PROVIDER;
+			compileRequests.add(r);
+			break;
+		    case 'q':
+			dtrace.setOption(Option.quiet);
+			break;
+		    case 's':
+			r = new CompileRequest();
+			r.s = g.getOptarg();
+			r.type = ProgramType.FILE;
+			compileRequests.add(r);
+			break;
+		    case 'U':
+			dtrace.setOption(Option.undef, g.getOptarg());
+			break;
+		    case 'v':
+			verbose = true;
+			break;
+		    case 'V':
+			mode = Mode.VERSION;
+			break;
+		    case 'w':
+			dtrace.setOption(Option.destructive);
+			break;
+		    case 'x':
+			String[] xarg = g.getOptarg().split("=", 2);
+			if (xarg.length > 1) {
+			    dtrace.setOption(xarg[0], xarg[1]);
+			} else if (xarg.length == 1) {
+			    dtrace.setOption(xarg[0]);
+			}
+			break;
+		    case 'X':
+			dtrace.setOption(Option.stdc, g.getOptarg());
+			break;
+		    case 'Z':
+			dtrace.setOption(Option.zdefs);
+			break;
+		    case '?':
+			usage(); // getopt() already printed an error
+			break;
+		    default:
+			System.err.print("getopt() returned " + c + "\n");
+			c = 0;
+		 }
+	    }
+	    c = 0;
+	    List <String> argList = new LinkedList <String> ();
+	    for (int i = g.getOptind(); i < args.length; ++i) {
+		argList.add(args[i]);
+	    }
+
+	    if (mode == Mode.VERSION) {
+		out.printf("dtrace: %s\n", dtrace.getVersion());
+		dtrace.close();
+		exit(0);
+	    }
+
+	    String[] compileArgs = new String[argList.size()];
+	    compileArgs = argList.toArray(compileArgs);
+
+	    Program program;
+	    for (CompileRequest req : compileRequests) {
+		switch (req.type) {
+		    case STRING:
+			applyProbespec(req);
+			program = dtrace.compile(req.s, compileArgs);
+			break;
+		    case FILE:
+			File file = new File(req.s);
+			program = dtrace.compile(file, compileArgs);
+			break;
+		    default:
+			throw new IllegalArgumentException(
+				"Unexpected program type: " + req.type);
+		}
+
+		programList.add(program);
+	    }
+
+	    // Get options set by #pragmas in compiled program
+	    long optval;
+	    quiet = (dtrace.getOption(Option.quiet) != Option.UNSET);
+	    flow = (dtrace.getOption(Option.flowindent) != Option.UNSET);
+	    optval = dtrace.getOption("stackindent");
+	    if (optval != Option.UNSET) {
+		stackindent = (int)optval;
+	    }
+
+	    if (mode == Mode.LIST) {
+		out.printf("%5s %10s %17s %33s %s\n",
+		    "ID", "PROVIDER", "MODULE", "FUNCTION", "NAME");
+
+		if (verbose) {
+		    List <List <Probe>> lists =
+			    new LinkedList <List <Probe>> ();
+		    for (Program p : programList) {
+			lists.add(dtrace.listProgramProbeDetail(p));
+		    }
+		    ProbeDescription p;
+		    ProbeInfo pinfo;
+		    for (List <Probe> list : lists) {
+			for (Probe probe : list) {
+			    p = probe.getDescription();
+			    pinfo = probe.getInfo();
+			    printProbeDescription(p);
+			    printProbeInfo(pinfo);
+			}
+		    }
+		} else {
+		    List <List <ProbeDescription>> lists =
+			    new LinkedList <List <ProbeDescription>> ();
+		    for (Program p : programList) {
+			lists.add(dtrace.listProgramProbes(p));
+		    }
+		    for (List <ProbeDescription> list : lists) {
+			for (ProbeDescription p : list) {
+			    printProbeDescription(p);
+			}
+		    }
+		}
+		exit(0);
+	    }
+
+	    String programType;
+	    String programDescription;
+	    ProgramInfo info;
+	    for (Program p : programList) {
+		if (p instanceof Program.File) {
+		    Program.File pf = (Program.File)p;
+		    programType = "script";
+		    programDescription = pf.getFile().getPath();
+		} else {
+		    programType = "description";
+		    programDescription =
+			p.getContents().split("[/{;]", 2)[0];
+		}
+
+		if (mode == Mode.EXEC) {
+		    dtrace.enable(p);
+		} else {
+		    dtrace.getProgramInfo(p);
+		}
+		info = p.getInfo();
+		if ((mode == Mode.EXEC) && !quiet) {
+		    System.err.printf("dtrace: %s '%s' matched %d probe%s\n",
+			    programType, programDescription,
+			    info.getMatchingProbeCount(),
+			    info.getMatchingProbeCount() == 1 ? "" : "s");
+		}
+		if (verbose) {
+		    printProgramStability(programType,
+			    programDescription, info);
+		}
+	    }
+	    if (mode != Mode.EXEC) {
+		exit(0);
+	    }
+	    dtrace.addConsumerListener(new ConsumerAdapter() {
+		public void consumerStarted(ConsumerEvent e) {
+		    started = true;
+		}
+		public void consumerStopped(ConsumerEvent e) {
+		    stopped = true;
+		    out.println();
+		    try {
+			Aggregate aggregate = dtrace.getAggregate();
+			if (aggregate != null) {
+			    printAggregate(aggregate);
+			}
+			dtrace.close();
+		    } catch (Throwable x) {
+			exceptionHandler.handleException(x);
+		    }
+		    exit(0);
+		}
+		public void dataDropped(DropEvent e) {
+		    System.err.printf("dtrace: %s",
+			    e.getDrop().getDefaultMessage());
+		}
+		public void errorEncountered(ErrorEvent e)
+			throws ConsumerException {
+		    org.opensolaris.os.dtrace.Error error = e.getError();
+		    if (logger.isLoggable(Level.FINE)) {
+			logger.fine(error.toString());
+		    }
+		    System.err.printf("dtrace: %s",
+			    error.getDefaultMessage());
+		}
+		public void dataReceived(DataEvent e)
+			throws ConsumerException {
+		    consumeProbeData(e.getProbeData());
+		}
+		public void processStateChanged(ProcessEvent e)
+			throws ConsumerException {
+		    if (logger.isLoggable(Level.FINE)) {
+			logger.fine(e.getProcessState().toString());
+		    }
+		}
+	    });
+	    // Print unprinted aggregations after Ctrl-C
+	    Runtime.getRuntime().addShutdownHook(new Thread() {
+		public void run() {
+		    if (stopped || !started) {
+			return;
+		    }
+
+		    try {
+			Aggregate aggregate = dtrace.getAggregate();
+			if (aggregate != null) {
+			    out.println();
+			    out.println();
+			    printAggregate(aggregate);
+			}
+		    } catch (Throwable x) {
+			exceptionHandler.handleException(x);
+		    }
+		}
+	    });
+	    dtrace.go(exceptionHandler);
+	} catch (DTraceException e) {
+	    if (c > 0) {
+		// set option error
+		if (g.getOptarg() == null) {
+		    System.err.printf("dtrace: failed to set -%c: %s\n",
+			c, e.getMessage());
+		} else {
+		    System.err.printf("dtrace: failed to set -%c %s: %s\n",
+			c, g.getOptarg(), e.getMessage());
+		}
+	    } else {
+		// any other error
+		System.err.printf("dtrace: %s\n", e.getMessage());
+	    }
+	    exit(1);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1);
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/Makefile
new file mode 100644
index 0000000..99a571b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/Makefile
@@ -0,0 +1,109 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+PROG = jdtrace
+SRCS = jdtrace.c
+
+include $(SRC)/cmd/Makefile.cmd
+
+ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
+ROOTBIN = $(ROOTOPTPKG)/bin
+ROOTLIB = $(ROOTOPTPKG)/lib
+ROOTLIBJAVA = $(ROOTLIB)/java
+
+# Use the proto dtrace.jar if it exists, otherwise use whatever is
+# installed on the system. It should be possible to build
+# usr/src/cmd/dtrace/test independently, even if only on systems that
+# have a compatible dtrace.jar installed.
+DTRACE_JAR=usr/share/lib/java/dtrace.jar
+PROTO_DTRACE_JAR=$(ROOT)/$(DTRACE_JAR)
+INSTALLED_DTRACE_JAR=/$(DTRACE_JAR)
+CLASSPATH=$(PROTO_DTRACE_JAR):$(INSTALLED_DTRACE_JAR)
+DTEST_DIR=$(SRC)/cmd/dtrace/test
+CLASSDIR=classes
+LIBDIR=lib
+MANIFESTDIR=manifest
+MANIFEST=$(MANIFESTDIR)/jdtrace.jar-manifest
+JDTRACE_JAR=$(LIBDIR)/jdtrace.jar
+
+PROTO_JDTRACE_JAR=$(ROOTLIBJAVA)/jdtrace.jar
+CMD = $(ROOTBIN)/jdtrace
+XLIST = $(ROOTBIN)/exception.lst
+
+$(PROTO_JDTRACE_JAR) := FILEMODE = 0644
+$(CMD) := FILEMODE = 0555
+$(XLIST) := FILEMODE = 0444
+
+all: $(JDTRACE_JAR) $(PROG)
+
+clean:
+	-$(RM) $(CLASSDIR)/*.class
+
+clobber: clean
+	-$(RM) $(JDTRACE_JAR)
+	-$(RM) $(PROG)
+
+lint:
+
+install: all $(PROTO_JDTRACE_JAR) $(CMD) $(XLIST)
+
+$(PROG): $(SRCS)
+	$(LINK.c) -o $@ $(SRCS) $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+JFLAGS= -g -cp $(CLASSPATH) -d $(CLASSDIR) -deprecation
+JFLAGS += -target 1.5
+JFLAGS += -Xlint
+COMPILE.java=$(JAVAC) $(JFLAGS)
+JAVASRC= JDTrace.java Getopt.java
+
+$(JDTRACE_JAR): $(JAVASRC)
+	@mkdir -p $(CLASSDIR)
+	@mkdir -p $(LIBDIR)
+	$(COMPILE.java) $(JAVASRC)
+	$(JAR) -cmf $(MANIFEST) $(JDTRACE_JAR) -C $(CLASSDIR) .
+
+$(PROTO_JDTRACE_JAR): $(ROOTLIBJAVA)
+
+$(CMD): $(ROOTBIN)
+
+$(XLIST): $(ROOTBIN)
+
+$(ROOTBIN):
+	$(INS.dir)
+
+$(ROOTLIB):
+	$(INS.dir)
+
+$(ROOTLIBJAVA): $(ROOTLIB)
+	$(INS.dir)
+
+$(ROOTLIBJAVA)/%.jar: $(LIBDIR)/%.jar
+	$(INS.file)
+
+$(ROOTBIN)/%: %
+	$(INS.file)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/exception.lst b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/exception.lst
new file mode 100644
index 0000000..261f870
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/exception.lst
@@ -0,0 +1,77 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+# Exception list: names tests that are bypassed when running in Java
+# mode (relative to /opt/SUNWdtrt/tst)
+
+# double precision (64-bit floating point) not same in java
+common/aggs/tst.neglquant.d
+common/aggs/tst.negquant.d
+
+# freopen() (to suppress output) not supported by Java DTrace API
+common/printa/tst.walltimestamp.ksh
+
+# -G option not supported by jdtrace
+common/dtraceUtil/tst.ELFGenerationOut.d.ksh
+common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
+
+# -H option not supported by jdtrace
+common/dtraceUtil/tst.PreprocessorStatement.d.ksh
+
+# -G and -h options not supported by jdtrace
+common/usdt/tst.badguess.ksh
+common/usdt/tst.dlclose1.ksh
+common/usdt/tst.dlclose2.ksh
+common/usdt/tst.dlclose3.ksh
+common/usdt/tst.eliminate.ksh
+common/usdt/tst.enabled.ksh
+common/usdt/tst.enabled2.ksh
+common/usdt/tst.entryreturn.ksh
+common/usdt/tst.fork.ksh
+common/usdt/tst.header.ksh
+common/usdt/tst.guess32.ksh
+common/usdt/tst.guess64.ksh
+common/usdt/tst.linkpriv.ksh
+common/usdt/tst.linkunpriv.ksh
+common/usdt/tst.multiple.ksh
+common/usdt/tst.nodtrace.ksh
+common/usdt/tst.onlyenabled.ksh
+common/usdt/tst.reeval.ksh
+common/usdt/tst.static.ksh
+common/usdt/tst.static2.ksh
+common/usdt/tst.user.ksh
+sparc/usdt/tst.tailcall.ksh
+common/pid/tst.provregex3.ksh
+common/pid/tst.provregex4.ksh
+
+# freopen() and ftruncate() not supported by Java DTrace API
+common/funcs/tst.badfreopen.ksh
+common/funcs/tst.freopen.ksh
+common/funcs/tst.ftruncate.ksh
+
+# jdtrace doesn't pull in library files?
+common/pragma/tst.libdepfullyconnected.ksh
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/jdtrace.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/jdtrace.c
new file mode 100644
index 0000000..0951265
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/jdtrace.c
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <alloca.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/systeminfo.h>
+
+int
+main(int argc, char **argv)
+{
+	int i, ac, has64;
+	char **av, **p;
+
+	ac = argc + 3;
+	av = p = alloca(sizeof (char *) * ac);
+
+	*p++ = "java";
+	*p++ = "-jar";
+	*p++ = "/opt/SUNWdtrt/lib/java/jdtrace.jar";
+
+	argc--;
+	argv++;
+
+	for (i = 0; i < argc; i++) {
+		p[i] = argv[i];
+	}
+	p[i] = NULL;
+
+	(void) execvp(av[0], av);
+
+	perror("exec failed");
+
+	return (0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/manifest/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/manifest/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/manifest/jdtrace.jar-manifest b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/manifest/jdtrace.jar-manifest
new file mode 100644
index 0000000..323c4a4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/jdtrace/manifest/jdtrace.jar-manifest
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: JDTrace
+Class-Path: /usr/share/lib/java/dtrace.jar
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/Makefile
new file mode 100644
index 0000000..0a7b167
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/Makefile
@@ -0,0 +1,56 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+include $(SRC)/Makefile.master
+
+.KEEP_STATE:
+
+ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
+ROOTBIN = $(ROOTOPTPKG)/bin
+
+SRCS = dtest itest dstyle
+CMDS = $(SRCS:%=$(ROOTBIN)/%)
+
+$(CMDS) := FILEMODE = 0555
+
+all clean clobber lint:
+
+install: $(CMDS)
+
+$(CMDS): $(ROOTBIN)
+
+$(ROOTBIN):
+	$(INS.dir)
+
+$(ROOTBIN)/%: %.pl
+	$(INS.rename)
+
+$(ROOTBIN)/%: %.sh
+	$(INS.rename)
+
+$(ROOTBIN)/%: %.ksh
+	$(INS.rename)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/dstyle.pl b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/dstyle.pl
new file mode 100755
index 0000000..c1075a3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/dstyle.pl
@@ -0,0 +1,235 @@
+#!/usr/perl5/bin/perl
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+require 5.8.4;
+
+$PNAME = $0;
+$PNAME =~ s:.*/::;
+$USAGE = "Usage: $PNAME [file ...]\n";
+$errs = 0;
+
+sub err
+{
+	my($msg) = @_;
+
+	print "$file: $lineno: $msg\n";
+	$errs++;
+}
+
+sub dstyle
+{
+	open(FILE, "$file");
+	$lineno = 0;
+	$inclause = 0;
+	$skipnext = 0;
+
+	while (<FILE>) {
+		$lineno++;
+
+		chop;
+
+		if ($skipnext) {
+			$skipnext = 0;
+			next;
+		}
+
+		#
+		# Amazingly, some ident strings are longer than 80 characters!
+		#
+		if (/^#pragma ident/) {
+			next;
+		}
+
+		#
+		# The algorithm to calculate line length from cstyle.
+		#
+		$line = $_;
+		if ($line =~ tr/\t/\t/ * 7 + length($line) > 80) {
+			# yes, there is a chance.
+			# replace tabs with spaces and check again.
+			$eline = $line;
+			1 while $eline =~
+			    s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
+
+			if (length($eline) > 80) {
+				err "line > 80 characters";
+			}
+		}
+
+		if (/\/\*DSTYLED\*\//) {
+			$skipnext = 1;
+			next;
+		}
+
+		if (/^#pragma/) {
+			next;
+		}
+
+		if (/^#include/) {
+			next;
+		}
+
+		#
+		# Before we do any more analysis, we want to prune out any
+		# quoted strings.  This is a bit tricky because we need
+		# to be careful of backslashed quotes within quoted strings.
+		# I'm sure there is a very crafty way to do this with a
+		# single regular expression, but that will have to wait for
+		# somone with better regex juju that I; we do this by first
+		# eliminating the backslashed quotes, and then eliminating
+		# whatever quoted strings are left.  Note that we eliminate
+		# the string by replacing it with "quotedstr"; this is to
+		# allow lines to end with a quoted string.  (If we simply
+		# eliminated the quoted string, dstyle might complain about
+		# the line ending in a space or tab.)
+		# 
+		s/\\\"//g;
+		s/\"[^\"]*\"/quotedstr/g;
+
+		if (/[ \t]$/) {
+			err "space or tab at end of line";
+		}
+
+		if (/^[\t]+[ ]+[\t]+/) {
+			err "spaces between tabs";
+		}
+
+		if (/^[\t]* \*/) {
+			next;
+		}
+
+		if (/^        /) {
+			err "indented by spaces not tabs";
+		}
+
+		if (/^{}$/) {
+			next;
+		}
+
+		if (!/^enum/ && !/^\t*struct/ && !/^\t*union/ && !/^typedef/ &&
+		    !/^translator/ && !/^provider/) {
+			if (/[\w\s]+{/) {
+				err "left brace not on its own line";
+			}
+
+			if (/{[\w\s]+/) {
+				err "left brace not on its own line";
+			}
+		}
+
+		if (!/;$/) {
+			if (/[\w\s]+}/) {
+				err "right brace not on its own line";
+			}
+
+			if (/}[\w\s]+/) {
+				err "right brace not on its own line";
+			}
+		}
+
+		if (/^}/) {
+			$inclause = 0;
+		}
+
+		if (!$inclause && /^[\w ]+\//) {
+			err "predicate not at beginning of line";
+		}
+
+		if (!$inclause && /^\/[ \t]+\w/) {
+			err "space between '/' and expression in predicate";
+		}
+
+		if (!$inclause && /\w[ \t]+\/$/) {
+			err "space between expression and '/' in predicate";
+		}
+
+		if (!$inclause && /\s,/) {
+			err "space before comma in probe description";
+		}
+
+		if (!$inclause && /\w,[\w\s]/ && !/;$/) {
+			if (!/extern/ && !/\(/ && !/inline/) {
+				err "multiple probe descriptions on same line";
+			}
+		}
+
+		if ($inclause && /sizeof\(/) {
+			err "missing space after sizeof";
+		}
+
+		if ($inclause && /^[\w ]/) {
+			err "line doesn't begin with a tab";
+		}
+
+		if ($inclause && /,[\w]/) {
+			err "comma without trailing space";
+		}
+
+		if (/\w&&/ || /&&\w/ || /\w\|\|/ || /\|\|\w/) {
+			err "logical operator not set off with spaces";
+		}
+
+		#
+		# We want to catch "i<0" variants, but we don't want to
+		# erroneously flag translators.
+		#
+		if (!/\w<\w+>\(/) {
+			if (/\w>/ || / >\w/ || /\w</ || /<\w/) {
+				err "comparison operator not set " . 
+				    "off with spaces";
+			}
+		}
+
+		if (/\w==/ || /==\w/ || /\w<=/ || />=\w/ || /\w!=/ || /!=\w/) {
+			err "comparison operator not set off with spaces";
+		}
+
+		if (/\w=/ || /=\w/) {
+			err "assignment operator not set off with spaces";
+		}
+
+		if (/^{/) {
+			$inclause = 1;
+		}
+        }
+}
+
+foreach $arg (@ARGV) {
+	if (-f $arg) {
+		push(@files, $arg);
+	} else {
+		die "$PNAME: $arg is not a valid file\n";
+	}
+}
+
+die $USAGE if (scalar(@files) == 0);
+
+foreach $file (@files) {
+	dstyle($file);
+}
+
+exit($errs != 0);
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/dtest.pl b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/dtest.pl
new file mode 100755
index 0000000..3f24429
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/cmd/scripts/dtest.pl
@@ -0,0 +1,704 @@
+#!/usr/perl5/bin/perl
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+require 5.8.4;
+
+use File::Find;
+use File::Basename;
+use Getopt::Std;
+use Cwd;
+use Cwd 'abs_path';
+
+$PNAME = $0;
+$PNAME =~ s:.*/::;
+$OPTSTR = 'abd:fghi:jlnqsx:';
+$USAGE = "Usage: $PNAME [-abfghjlnqs] [-d dir] [-i isa] "
+    . "[-x opt[=arg]] [file | dir ...]\n";
+($MACH = `uname -p`) =~ s/\W*\n//;
+($PLATFORM = `uname -i`) =~ s/\W*\n//;
+
+ at dtrace_argv = ();
+
+$ksh_path = '/usr/bin/ksh';
+
+ at files = ();
+%exceptions = ();
+%results = ();
+$errs = 0;
+
+#
+# If no test files are specified on the command-line, execute a find on "."
+# and append any tst.*.d, tst.*.ksh, err.*.d or drp.*.d files found within
+# the directory tree.
+#
+sub wanted
+{
+	push(@files, $File::Find::name)
+	    if ($_ =~ /^(tst|err|drp)\..+\.(d|ksh)$/ && -f "$_");
+}
+
+sub dirname {
+	my($s) = @_;
+	my($i);
+
+	$s = substr($s, 0, $i) if (($i = rindex($s, '/')) != -1);
+	return $i == -1 ? '.' : $i == 0 ? '/' : $s;
+}
+
+sub usage
+{
+	print $USAGE;
+	print "\t -a  execute test suite using anonymous enablings\n";
+	print "\t -b  execute bad ioctl test program\n";
+	print "\t -d  specify directory for test results files and cores\n";
+	print "\t -g  enable libumem debugging when running tests\n";
+	print "\t -f  force bypassed tests to run\n";
+	print "\t -h  display verbose usage message\n";
+	print "\t -i  specify ISA to test instead of isaexec(3C) default\n";
+	print "\t -j  execute test suite using jdtrace (Java API) only\n";
+	print "\t -l  save log file of results and PIDs used by tests\n";
+	print "\t -n  execute test suite using dtrace(1m) only\n";
+	print "\t -q  set quiet mode (only report errors and summary)\n";
+	print "\t -s  save results files even for tests that pass\n";
+	print "\t -x  pass corresponding -x argument to dtrace(1M)\n";
+	exit(2);
+}
+
+sub errmsg
+{
+	my($msg) = @_;
+
+	print STDERR $msg;
+	print LOG $msg if ($opt_l);
+	$errs++;
+}
+
+sub fail
+{
+	my(@parms) = @_;
+	my($msg) = $parms[0];
+	my($errfile) = $parms[1];
+	my($n) = 0;
+	my($dest) = basename($file);
+
+	while (-d "$opt_d/failure.$n") {
+		$n++;
+	}
+
+	unless (mkdir "$opt_d/failure.$n") {
+		warn "ERROR: failed to make directory $opt_d/failure.$n: $!\n";
+		exit(125);
+	}
+
+	open(README, ">$opt_d/failure.$n/README");
+	print README "ERROR: " . $file . " " . $msg;
+	
+	if (scalar @parms > 1) {
+		print README "; see $errfile\n";
+	} else {
+		if (-f "$opt_d/$pid.core") {
+			print README "; see $pid.core\n";
+		} else {
+			print README "\n";
+		}
+	}
+
+	close(README);
+
+	if (-f "$opt_d/$pid.out") {
+		rename("$opt_d/$pid.out", "$opt_d/failure.$n/$pid.out");
+		link("$file.out", "$opt_d/failure.$n/$dest.out");
+	}
+
+	if (-f "$opt_d/$pid.err") {
+		rename("$opt_d/$pid.err", "$opt_d/failure.$n/$pid.err");
+		link("$file.err", "$opt_d/failure.$n/$dest.err");
+	}
+
+	if (-f "$opt_d/$pid.core") {
+		rename("$opt_d/$pid.core", "$opt_d/failure.$n/$pid.core");
+	}
+
+	link("$file", "$opt_d/failure.$n/$dest");
+
+	$msg = "ERROR: " . $dest . " " . $msg;
+
+	if (scalar @parms > 1) {
+		$msg = $msg . "; see $errfile in failure.$n\n";
+	} else {
+		$msg = $msg . "; details in failure.$n\n";
+	}
+
+	errmsg($msg);
+}
+
+sub logmsg
+{
+	my($msg) = @_;
+
+	print STDOUT $msg unless ($opt_q);
+	print LOG $msg if ($opt_l);
+}
+
+# Trim leading and trailing whitespace
+sub trim {
+	my($s) = @_;
+
+	$s =~ s/^\s*//;
+	$s =~ s/\s*$//;
+	return $s;
+}
+
+# Load exception set of skipped tests from the file at the given
+# pathname. The test names are assumed to be paths relative to $dt_tst,
+# for example: common/aggs/tst.neglquant.d, and specify tests to be
+# skipped.
+sub load_exceptions {
+	my($listfile) = @_;
+	my($line) = "";
+
+	%exceptions = ();
+	if (length($listfile) > 0) {
+		exit(123) unless open(STDIN, "<$listfile");
+		while (<STDIN>) {
+			chomp;
+			$line = $_;
+			# line is non-empty and not a comment
+			if ((length($line) > 0) && ($line =~ /^\s*[^\s#]/ )) {
+				$exceptions{trim($line)} = 1;
+			}
+		}
+	}
+}
+
+# Return 1 if the test is found in the exception set, 0 otherwise.
+sub is_exception {
+	my($file) = @_;
+	my($i) = -1;
+
+	if (scalar(keys(%exceptions)) == 0) {
+		return 0;
+	}
+
+	# hash absolute pathname after $dt_tst/
+	$file = abs_path($file);
+	$i = index($file, $dt_tst);
+	if ($i == 0) {
+		$file = substr($file, length($dt_tst) + 1);
+		return $exceptions{$file};
+	}
+	return 0;
+}
+
+#
+# Iterate over the set of test files specified on the command-line or by a find
+# on "$defdir/common", "$defdir/$MACH" and "$defdir/$PLATFORM" and execute each
+# one.  If the test file is executable, we fork and exec it. If the test is a
+# .ksh file, we run it with $ksh_path. Otherwise we run dtrace -s on it.  If
+# the file is named tst.* we assume it should return exit status 0.  If the
+# file is named err.* we assume it should return exit status 1.  If the file is
+# named err.D_[A-Z0-9]+[.*].d we use dtrace -xerrtags and examine stderr to
+# ensure that a matching error tag was produced.  If the file is named
+# drp.[A-Z0-9]+[.*].d we use dtrace -xdroptags and examine stderr to ensure
+# that a matching drop tag was produced.  If any *.out or *.err files are found
+# we perform output comparisons.
+#
+# run_tests takes two arguments: The first is the pathname of the dtrace
+# command to invoke when running the tests. The second is the pathname
+# of a file (may be the empty string) listing tests that ought to be
+# skipped (skipped tests are listed as paths relative to $dt_tst, for
+# example: common/aggs/tst.neglquant.d).
+#
+sub run_tests {
+	my($dtrace, $exceptions_path) = @_;
+	my($passed) = 0;
+	my($bypassed) = 0;
+	my($failed) = $errs;
+	my($total) = 0;
+
+	die "$PNAME: $dtrace not found\n" unless (-x "$dtrace");
+	logmsg($dtrace . "\n");
+
+	load_exceptions($exceptions_path);
+
+	foreach $file (sort @files) {
+		$file =~ m:.*/((.*)\.(\w+)):;
+		$name = $1;
+		$base = $2;
+		$ext = $3;
+		
+		$dir = dirname($file);
+		$isksh = 0;
+		$tag = 0;
+		$droptag = 0;
+
+		if ($name =~ /^tst\./) {
+			$isksh = ($ext eq 'ksh');
+			$status = 0;
+		} elsif ($name =~ /^err\.(D_[A-Z0-9_]+)\./) {
+			$status = 1;
+			$tag = $1;
+		} elsif ($name =~ /^err\./) {
+			$status = 1;
+		} elsif ($name =~ /^drp\.([A-Z0-9_]+)\./) {
+			$status = 0;
+			$droptag = $1;
+		} else {
+			errmsg("ERROR: $file is not a valid test file name\n");
+			next;
+		}
+
+		$fullname = "$dir/$name";
+		$exe = "$dir/$base.exe";
+		$exe_pid = -1;
+
+		if ($opt_a && ($status != 0 || $tag != 0 || $droptag != 0 ||
+		    -x $exe || $isksh || -x $fullname)) {
+			$bypassed++;
+			next;
+		}
+
+		if (!$opt_f && is_exception("$dir/$name")) {
+			$bypassed++;
+			next;
+		}
+
+		if (!$isksh && -x $exe) {
+			if (($exe_pid = fork()) == -1) {
+				errmsg(
+				    "ERROR: failed to fork to run $exe: $!\n");
+				next;
+			}
+
+			if ($exe_pid == 0) {
+				open(STDIN, '</dev/null');
+
+				exec($exe);
+
+				warn "ERROR: failed to exec $exe: $!\n";
+			}
+		}
+
+		logmsg("testing $file ... ");
+
+		if (($pid = fork()) == -1) {
+			errmsg("ERROR: failed to fork to run test $file: $!\n");
+			next;
+		}
+
+		if ($pid == 0) {
+			open(STDIN, '</dev/null');
+			exit(125) unless open(STDOUT, ">$opt_d/$$.out");
+			exit(125) unless open(STDERR, ">$opt_d/$$.err");
+
+			unless (chdir($dir)) {
+				warn "ERROR: failed to chdir for $file: $!\n";
+				exit(126);
+			}
+
+			push(@dtrace_argv, '-xerrtags') if ($tag);
+			push(@dtrace_argv, '-xdroptags') if ($droptag);
+			push(@dtrace_argv, $exe_pid) if ($exe_pid != -1);
+
+			if ($isksh) {
+				exit(123) unless open(STDIN, "<$name");
+				exec("$ksh_path /dev/stdin $dtrace");
+			} elsif (-x $name) {
+				warn "ERROR: $name is executable\n";
+				exit(1);
+			} else {
+				if ($tag == 0 && $status == $0 && $opt_a) {
+					push(@dtrace_argv, '-A');
+				}
+
+				push(@dtrace_argv, '-C');
+				push(@dtrace_argv, '-s');
+				push(@dtrace_argv, $name);
+				exec($dtrace, @dtrace_argv);
+			}
+
+			warn "ERROR: failed to exec for $file: $!\n";
+			exit(127);
+		}
+
+		if (waitpid($pid, 0) == -1) {
+			errmsg("ERROR: timed out waiting for $file\n");
+			kill(9, $exe_pid) if ($exe_pid != -1);
+			kill(9, $pid);
+			next;
+		}
+
+		kill(9, $exe_pid) if ($exe_pid != -1);
+
+		if ($tag == 0 && $status == $0 && $opt_a) {
+			#
+			# We can chuck the earler output.
+			#
+			unlink($pid . '.out');
+			unlink($pid . '.err');
+
+			#
+			# This is an anonymous enabling.  We need to get
+			# the module unloaded.
+			#
+			system("dtrace -ae 1> /dev/null 2> /dev/null");
+			system("svcadm disable -s " .
+			    "svc:/network/nfs/mapid:default");
+			system("modunload -i 0 ; modunload -i 0 ; " .
+			    "modunload -i 0");
+			if (!system("modinfo | grep dtrace")) {
+				warn "ERROR: couldn't unload dtrace\n";
+				system("svcadm enable " . 
+				    "-s svc:/network/nfs/mapid:default");
+				exit(124);
+			}
+
+			#
+			# DTrace is gone.  Now update_drv(1M), and rip
+			# everything out again.
+			#
+			system("update_drv dtrace");
+			system("dtrace -ae 1> /dev/null 2> /dev/null");
+			system("modunload -i 0 ; modunload -i 0 ; " .
+			    "modunload -i 0");
+			if (!system("modinfo | grep dtrace")) {
+				warn "ERROR: couldn't unload dtrace\n";
+				system("svcadm enable " . 
+				    "-s svc:/network/nfs/mapid:default");
+				exit(124);
+			}
+
+			#
+			# Now bring DTrace back in.
+			#
+			system("sync ; sync");
+			system("dtrace -l -n bogusprobe 1> /dev/null " .
+			    "2> /dev/null");
+			system("svcadm enable -s " .
+			    "svc:/network/nfs/mapid:default");
+
+			#
+			# That should have caused DTrace to reload with
+			# the new configuration file.  Now we can try to
+			# snag our anonymous state.
+			#
+			if (($pid = fork()) == -1) {
+				errmsg("ERROR: failed to fork to run " .
+				    "test $file: $!\n");
+				next;
+			}
+
+			if ($pid == 0) {
+				open(STDIN, '</dev/null');
+				exit(125) unless open(STDOUT, ">$opt_d/$$.out");
+				exit(125) unless open(STDERR, ">$opt_d/$$.err");
+
+				push(@dtrace_argv, '-a');
+
+				unless (chdir($dir)) {
+					warn "ERROR: failed to chdir " .
+					    "for $file: $!\n";
+					exit(126);
+				}
+
+				exec($dtrace, @dtrace_argv);
+				warn "ERROR: failed to exec for $file: $!\n";
+				exit(127);
+			}
+
+			if (waitpid($pid, 0) == -1) {
+				errmsg("ERROR: timed out waiting for $file\n");
+				kill(9, $pid);
+				next;
+			}
+		}
+
+		logmsg("[$pid]\n");
+		$wstat = $?;
+		$wifexited = ($wstat & 0xFF) == 0;
+		$wexitstat = ($wstat >> 8) & 0xFF;
+		$wtermsig = ($wstat & 0x7F);
+
+		if (!$wifexited) {
+			fail("died from signal $wtermsig");
+			next;
+		}
+
+		if ($wexitstat == 125) {
+			die "$PNAME: failed to create output file in $opt_d " .
+			    "(cd elsewhere or use -d)\n";
+		}
+
+		if ($wexitstat != $status) {
+			fail("returned $wexitstat instead of $status");
+			next;
+		}
+
+		if (-f "$file.out" &&
+		    system("cmp -s $file.out $opt_d/$pid.out") != 0) {
+			fail("stdout mismatch", "$pid.out");
+			next;
+		}
+
+		if (-f "$file.err" &&
+		    system("cmp -s $file.err $opt_d/$pid.err") != 0) {
+			fail("stderr mismatch: see $pid.err");
+			next;
+		}
+
+		if ($tag) {
+			open(TSTERR, "<$opt_d/$pid.err");
+			$tsterr = <TSTERR>;
+			close(TSTERR);
+
+			unless ($tsterr =~ /: \[$tag\] line \d+:/) {
+				fail("errtag mismatch: see $pid.err");
+				next;
+			}
+		}
+
+		if ($droptag) {
+			$found = 0;
+			open(TSTERR, "<$opt_d/$pid.err");
+
+			while (<TSTERR>) {
+				if (/\[$droptag\] /) {
+					$found = 1;
+					last;
+				}
+			}
+
+			close (TSTERR);
+
+			unless ($found) {
+				fail("droptag mismatch: see $pid.err");
+				next;
+			}
+		}
+
+		unless ($opt_s) {
+			unlink($pid . '.out');
+			unlink($pid . '.err');
+		}
+	}
+
+	if ($opt_a) {
+		#
+		# If we're running with anonymous enablings, we need to
+		# restore the .conf file.
+		#
+		system("dtrace -A 1> /dev/null 2> /dev/null");
+		system("dtrace -ae 1> /dev/null 2> /dev/null");
+		system("modunload -i 0 ; modunload -i 0 ; modunload -i 0");
+		system("update_drv dtrace");
+	}
+
+	$total = scalar(@files);
+	$failed = $errs - $failed;
+	$passed = ($total - $failed - $bypassed);
+	$results{$dtrace} = {
+		"passed" => $passed,
+		"bypassed" => $bypassed,
+		"failed" => $failed,
+		"total" => $total
+	};
+}
+
+die $USAGE unless (getopts($OPTSTR));
+usage() if ($opt_h);
+
+foreach $arg (@ARGV) {
+	if (-f $arg) {
+		push(@files, $arg);
+	} elsif (-d $arg) {
+		find(\&wanted, $arg);
+	} else {
+		die "$PNAME: $arg is not a valid file or directory\n";
+	}
+}
+
+$dt_tst = '/opt/SUNWdtrt/tst';
+$dt_bin = '/opt/SUNWdtrt/bin';
+$defdir = -d $dt_tst ? $dt_tst : '.';
+$bindir = -d $dt_bin ? $dt_bin : '.';
+
+find(\&wanted, "$defdir/common") if (scalar(@ARGV) == 0);
+find(\&wanted, "$defdir/$MACH") if (scalar(@ARGV) == 0);
+find(\&wanted, "$defdir/$PLATFORM") if (scalar(@ARGV) == 0);
+die $USAGE if (scalar(@files) == 0);
+
+$dtrace_path = '/usr/sbin/dtrace';
+$jdtrace_path = "$bindir/jdtrace";
+
+%exception_lists = ("$jdtrace_path" => "$bindir/exception.lst");
+
+if ($opt_j || $opt_n || $opt_i) {
+	@dtrace_cmds = ();
+	push(@dtrace_cmds, $dtrace_path) if ($opt_n);
+	push(@dtrace_cmds, $jdtrace_path) if ($opt_j);
+	push(@dtrace_cmds, "/usr/sbin/$opt_i/dtrace") if ($opt_i);
+} else {
+	@dtrace_cmds = ($dtrace_path, $jdtrace_path);
+}
+
+if ($opt_d) {
+	die "$PNAME: -d arg must be absolute path\n" unless ($opt_d =~ /^\//);
+	die "$PNAME: -d arg $opt_d is not a directory\n" unless (-d "$opt_d");
+	system("coreadm -p $opt_d/%p.core");
+} else {
+	my $dir = getcwd;
+	system("coreadm -p $dir/%p.core");
+	$opt_d = '.';
+}
+
+if ($opt_x) {
+	push(@dtrace_argv, '-x');
+	push(@dtrace_argv, $opt_x);
+}
+
+die "$PNAME: failed to open $PNAME.$$.log: $!\n"
+    unless (!$opt_l || open(LOG, ">$PNAME.$$.log"));
+
+if ($opt_g) {
+	$ENV{'UMEM_DEBUG'} = 'default,verbose';
+	$ENV{'UMEM_LOGGING'} = 'fail,contents';
+	$ENV{'LD_PRELOAD'} = 'libumem.so';
+}
+
+#
+# Ensure that $PATH contains a cc(1) so that we can execute the
+# test programs that require compilation of C code.
+#
+$ENV{'PATH'} = $ENV{'PATH'} . ':/ws/onnv-tools/SUNWspro/SS11/bin';
+
+if ($opt_b) {
+	logmsg("badioctl'ing ... ");
+
+	if (($badioctl = fork()) == -1) {
+		errmsg("ERROR: failed to fork to run badioctl: $!\n");
+		next;
+	}
+
+	if ($badioctl == 0) {
+		open(STDIN, '</dev/null');
+		exit(125) unless open(STDOUT, ">$opt_d/$$.out");
+		exit(125) unless open(STDERR, ">$opt_d/$$.err");
+
+		exec($bindir . "/badioctl");
+		warn "ERROR: failed to exec badioctl: $!\n";
+		exit(127);
+	}
+
+
+	logmsg("[$badioctl]\n");
+
+	#
+	# If we're going to be bad, we're just going to iterate over each
+	# test file.
+	#
+	foreach $file (sort @files) {
+		($name = $file) =~ s:.*/::;
+		$dir = dirname($file);
+
+		if (!($name =~ /^tst\./ && $name =~ /\.d$/)) {
+			next;
+		}
+
+		logmsg("baddof'ing $file ... ");
+
+		if (($pid = fork()) == -1) {
+			errmsg("ERROR: failed to fork to run baddof: $!\n");
+			next;
+		}
+
+		if ($pid == 0) {
+			open(STDIN, '</dev/null');
+			exit(125) unless open(STDOUT, ">$opt_d/$$.out");
+			exit(125) unless open(STDERR, ">$opt_d/$$.err");
+
+			unless (chdir($dir)) {
+				warn "ERROR: failed to chdir for $file: $!\n";
+				exit(126);
+			}
+
+			exec($bindir . "/baddof", $name);
+
+			warn "ERROR: failed to exec for $file: $!\n";
+			exit(127);
+		}
+
+		sleep 60;
+		kill(9, $pid);
+		waitpid($pid, 0);
+
+		logmsg("[$pid]\n");
+
+		unless ($opt_s) {
+			unlink($pid . '.out');
+			unlink($pid . '.err');
+		}
+	}
+
+	kill(9, $badioctl);
+	waitpid($badioctl, 0);
+
+	unless ($opt_s) {
+		unlink($badioctl . '.out');
+		unlink($badioctl . '.err');
+	}
+
+	exit(0);
+}
+
+#
+# Run all the tests specified on the command-line (the entire test suite
+# by default) once for each dtrace command tested, skipping any tests
+# not valid for that command. 
+#
+foreach $dtrace_cmd (@dtrace_cmds) {
+	run_tests($dtrace_cmd, $exception_lists{$dtrace_cmd});
+}
+
+$opt_q = 0; # force final summary to appear regardless of -q option
+
+logmsg("\n==== TEST RESULTS ====\n");
+foreach $key (keys %results) {
+	my $passed = $results{$key}{"passed"};
+	my $bypassed = $results{$key}{"bypassed"};
+	my $failed = $results{$key}{"failed"};
+	my $total = $results{$key}{"total"};
+
+	logmsg("\n     mode: " . $key . "\n");
+	logmsg("   passed: " . $passed . "\n");
+	if ($bypassed) {
+		logmsg(" bypassed: " . $bypassed . "\n");
+	}
+	logmsg("   failed: " . $failed . "\n");
+	logmsg("    total: " . $total . "\n");
+}
+
+exit($errs != 0);
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile
new file mode 100644
index 0000000..27c9c69
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile
@@ -0,0 +1,39 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+include $(SRC)/Makefile.master
+
+SUBDIRS= common $(MACH:i386=i386 i86xpv)
+include ../Makefile.subdirs
+
+dstyle := TARGET += dstyle
+
+check: FRC
+	@$(ECHO) "checking dstyle"
+	@$(MAKE) dstyle
+
+dstyle: $(SUBDIRS)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile.com b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile.com
new file mode 100644
index 0000000..a23b8d6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile.com
@@ -0,0 +1,104 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include $(SRC)/cmd/Makefile.cmd
+
+.KEEP_STATE:
+
+ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
+ROOTTST = $(ROOTOPTPKG)/tst
+SUBDIR :sh= basename `pwd`
+TSTDIR = $(ROOTTST)/$(SUBDIR)
+DSTYLE = $(ROOTOPTPKG)/bin/dstyle
+
+CSRCS :sh= find . -name SCCS -prune -o -name *.c -print | cut -b3-
+SSRCS :sh= find . -name SCCS -prune -o -name *.s -print | cut -b3-
+DSRCS :sh= find . -name SCCS -prune -o -name *.d -print | cut -b3-
+
+TSTS :sh= find . -name tst.*.d -o -name err.*.d -o \
+	-name tst.*.d.out -o -name err.*.d.out -o -name tst.*.ksh \
+	-o -name err.*.ksh -o -name tst.*.ksh.out -o -name drp.*.d \
+	-o -name get.*.pl
+
+EXES :sh= find . -name SCCS -prune -o \( -name *.exe -o -name \*.pl \) -print \
+    | cut -b3-
+EXES += $(CSRCS:%.c=%.exe)
+EXES += $(SSRCS:%.s=%.exe)
+
+ROOT_TSTS = $(TSTS:%=$(TSTDIR)/%)
+ROOT_EXES = $(EXES:%=$(TSTDIR)/%)
+
+$(ROOT_TSTS) := FILEMODE = 0444
+$(ROOT_EXES) := FILEMODE = 0555
+
+all: $(EXES)
+
+clean lint:
+
+clobber: FRC
+	-$(RM) $(CSRCS:%.c=%.exe) $(CSRCS:%.c=%.o)
+	-$(RM) $(SSRCS:%.s=%.exe) $(SSRCS:%.s=%.o)
+	-$(RM) $(DSRCS:%.d=%.o)
+	-$(RM) $(CLOBBERFILES)
+
+install: $(ROOT_TSTS) $(ROOT_EXES)
+
+$(ROOT_TSTS): $(TSTDIR)
+
+$(ROOT_EXES): $(TSTDIR)
+
+$(TSTDIR):
+	$(INS.dir)
+
+$(TSTDIR)/%: %
+	$(INS) -s -d -m $(DIRMODE) $(@D)
+	$(INS.file)
+
+%.exe: %.c
+	$(LINK.c) -o $@ $< $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+%.exe: %.o
+	$(LINK.c) -o $@ $< $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+%.o: %.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
+%.o: %.s
+	$(COMPILE.s) -o $@ $<
+	$(POST_PROCESS_O)
+
+scripts: FRC
+	@cd ../cmd/scripts; pwd; $(MAKE) install
+
+dstyle: FRC
+	@if [ -n "$(DSRCS)" ]; then $(DSTYLE) $(DSRCS); fi
+
+FRC:
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/Makefile
new file mode 100644
index 0000000..065124a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/Makefile
@@ -0,0 +1,101 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include $(SRC)/Makefile.master
+include ../Makefile.com
+
+SNOOPDIR = $(SRC)/cmd/cmd-inet/usr.sbin/snoop
+SNOOPOBJS = nfs4_xdr.o
+SNOOPSRCS = ${SNOOPOBJS:%.o=%.c}
+CLOBBERFILES += nfs/$(SNOOPOBJS)
+
+RPCSVCDIR = $(SRC)/head/rpcsvc
+RPCSVCOBJS = nfs_prot.o
+RPCSVCSRCS = ${RPCSVCOBJS:%o=%c}
+CLOBBERFILES += nfs/$(RPCSVCOBJS) $(RPCSVCDIR)/$(RPCSVCSRCS)
+
+fasttrap/tst.fasttrap.exe := LDLIBS += -ldtrace
+fasttrap/tst.stack.exe := LDLIBS += -ldtrace
+
+sysevent/tst.post.exe := LDLIBS += -lsysevent
+sysevent/tst.post_chan.exe := LDLIBS += -lsysevent
+
+ustack/tst.bigstack.exe := COPTFLAG += -xO1
+
+GCC = $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc
+
+nfs/%.o: $(SNOOPDIR)/%.c
+	$(COMPILE.c) -o $@ $< -I$(SNOOPDIR)
+	$(POST_PROCESS_O)
+nfs/tst.call.exe: nfs/tst.call.o nfs/$(SNOOPOBJS)
+	$(LINK.c) -o $@ nfs/tst.call.o nfs/$(SNOOPOBJS) $(LDLIBS) -lnsl
+	$(POST_PROCESS) ; $(STRIP_STABS)
+$(RPCSVCDIR)/%.c: $(RPCSVCDIR)/%.x
+	$(RPCGEN) -Cc $< > $@
+nfs/$(RPCSVCOBJS): $(RPCSVCDIR)/$(RPCSVCSRCS)
+	$(COMPILE.c) -o $@ $(RPCSVCDIR)/$(RPCSVCSRCS)
+	$(POST_PROCESS_O)
+nfs/tst.call3.exe: nfs/tst.call3.o nfs/$(RPCSVCOBJS)
+	$(LINK.c) -o $@ nfs/tst.call3.o nfs/$(RPCSVCOBJS) \
+	$(LDLIBS) -lnsl -lrpcsvc
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+pid/tst.gcc.exe: pid/tst.gcc.c
+	$(GCC) -o pid/tst.gcc.exe pid/tst.gcc.c $(LDFLAGS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+usdt/tst.args.exe: usdt/tst.args.o usdt/args.o
+	$(LINK.c) -o usdt/tst.args.exe usdt/tst.args.o usdt/args.o $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+usdt/args.o: usdt/args.d usdt/tst.args.o
+	$(COMPILE.d) -o usdt/args.o -s usdt/args.d usdt/tst.args.o
+
+usdt/tst.argmap.exe: usdt/tst.argmap.o usdt/argmap.o
+	$(LINK.c) -o usdt/tst.argmap.exe usdt/tst.argmap.o usdt/argmap.o \
+		$(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+usdt/argmap.o: usdt/argmap.d usdt/tst.argmap.o
+	$(COMPILE.d) -o usdt/argmap.o -s usdt/argmap.d usdt/tst.argmap.o
+
+usdt/tst.forker.exe: usdt/tst.forker.o usdt/forker.o
+	$(LINK.c) -o usdt/tst.forker.exe usdt/tst.forker.o usdt/forker.o \
+		$(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+usdt/forker.o: usdt/forker.d usdt/tst.forker.o
+	$(COMPILE.d) -o usdt/forker.o -s usdt/forker.d usdt/tst.forker.o
+
+usdt/tst.forker.o: usdt/forker.h
+
+usdt/forker.h: usdt/forker.d
+	$(DTRACE) -h -s usdt/forker.d -o usdt/forker.h
+
+SUBDIRS = java_api
+include ../../Makefile.subdirs
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_FUNC.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_FUNC.bad.d
new file mode 100644
index 0000000..d12454b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_FUNC.bad.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  An aggregation must call an aggregating function.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+
+	@counts["xyz"] = breakpoint();
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_MDIM.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_MDIM.bad.d
new file mode 100644
index 0000000..2c47289
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_MDIM.bad.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  An aggregation may not be used as a multi-dimensional array
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+
+	@counts[0][2] = count();
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_NULL.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_NULL.bad.d
new file mode 100644
index 0000000..87d1818
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_NULL.bad.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  An aggregation must have an aggregating function applied.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+
+	@a[1];
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_REDEF.redef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_REDEF.redef.d
new file mode 100644
index 0000000..9b4b425
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_REDEF.redef.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test redefining the aggregation
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a = count();
+}
+
+END
+{
+	@a = max(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.avgtoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.avgtoofew.d
new file mode 100644
index 0000000..106f4cd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.avgtoofew.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   avg() should not accept a non-scalar value
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a[pid] = avg(probefunc);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.maxnoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.maxnoarg.d
new file mode 100644
index 0000000..181e196
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.maxnoarg.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *   max() should not accept a non-scalar value
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+BEGIN
+{
+	@a[pid] = max(probefunc);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.mintoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.mintoofew.d
new file mode 100644
index 0000000..3ca34ff
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.mintoofew.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  min() should not accept a non-scalar value
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[pid] = min(probefunc);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.quantizetoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.quantizetoofew.d
new file mode 100644
index 0000000..b746455
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.quantizetoofew.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  quantize() should not accept a non-scalar value
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[pid] = quantize(probefunc);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d
new file mode 100644
index 0000000..262040f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.stddevtoofew.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     stddev() should not accept a non-scalar value
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a[pid] = stddev(probefunc);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.sumtoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.sumtoofew.d
new file mode 100644
index 0000000..a77a2d5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_AGG_SCALAR.sumtoofew.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  sum() should not accept a non-scalar value
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[pid] = sum(probefunc);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_CLEAR_AGGARG.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_CLEAR_AGGARG.bad.d
new file mode 100644
index 0000000..0e6060a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_CLEAR_AGGARG.bad.d
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	The argument to clear() must be an aggregation.
+ *
+ * SECTION: Aggregations/Clearing aggregations
+ *
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggrate=10ms
+#pragma D option switchrate=10ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i%5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 10/
+{
+	printf("Aggregation data before clear():\n");
+	printa(@func);
+
+	clear(count());
+
+	printf("Aggregation data after clear():\n");
+	printa(@func);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("Final aggregation data:\n");
+	printa(@func);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_CLEAR_PROTO.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_CLEAR_PROTO.bad.d
new file mode 100644
index 0000000..57fa884
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_CLEAR_PROTO.bad.d
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	clear() should handle no args as an error.
+ *
+ * SECTION: Aggregations/Clearing aggregations
+ *
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggrate=10ms
+#pragma D option switchrate=10ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i%5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 10/
+{
+	printf("Aggregation data before clear():\n");
+	printa(@func);
+
+	clear();
+
+	printf("Aggregation data after clear():\n");
+	printa(@func);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("Final aggregation data:\n");
+	printa(@func);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_FUNC_IDENT.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_FUNC_IDENT.bad.d
new file mode 100644
index 0000000..866a7ac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_FUNC_IDENT.bad.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  An aggregation must call an aggregating function, not a probe
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+
+	@counts[0][2] = tick-1();
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_FUNC_UNDEF.badaggfunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_FUNC_UNDEF.badaggfunc.d
new file mode 100644
index 0000000..65c12da
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_FUNC_UNDEF.badaggfunc.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the use of a non-supported aggregate function.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+
+BEGIN
+{
+	@counts["badtest"] = foo();
+
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.badexpr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.badexpr.d
new file mode 100644
index 0000000..83e6ab7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.badexpr.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test using an aggregation in an expression context.
+ *  This should result in a compile-time error.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	trace(@a + 3);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.badkey3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.badkey3.d
new file mode 100644
index 0000000..67c5b64
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.badkey3.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test the use of a dynamic expression as an aggregation key.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+BEGIN
+{
+	@t[i] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.noeffect.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.noeffect.d
new file mode 100644
index 0000000..9bdff78
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_IDENT_UNDEF.noeffect.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test compiling an aggregation statement that has no effect.
+ *   This should result in a compile-time error.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey1.d
new file mode 100644
index 0000000..abf3dd8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey1.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the use of a void expression as an aggregation key.
+ *  This should result in a compile-time error.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1, (void)0] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey2.d
new file mode 100644
index 0000000..9490b82
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey2.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test the use of a dynamic expression as an aggregation key.
+ *   This should result in a compile-time error.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[0] = count();
+	@b[@a] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey4.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey4.d
new file mode 100644
index 0000000..057746e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_KEY_TYPE.badkey4.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *   Test the use of a dynamic expression as an aggregation key.
+ *   This should result in a compile-time error.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+BEGIN
+{
+	@a[curpsinfo] = count();
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASETYPE.lqbad1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASETYPE.lqbad1.d
new file mode 100644
index 0000000..6bb6765
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASETYPE.lqbad1.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  lquantize() lower bound around must be an integer constant
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+BEGIN
+{
+	x = 'a';
+	@a[1] = lquantize(timestamp, x, 1000, 1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASETYPE.lqshort.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASETYPE.lqshort.d
new file mode 100644
index 0000000..6bb6765
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASETYPE.lqshort.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  lquantize() lower bound around must be an integer constant
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+BEGIN
+{
+	x = 'a';
+	@a[1] = lquantize(timestamp, x, 1000, 1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASEVAL.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASEVAL.bad.d
new file mode 100644
index 0000000..23d318e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_BASEVAL.bad.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  lquantize() lower bound must be a 32-bit quantity
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = lquantize(timestamp, 2147483657, 1000, 1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_LIMTYPE.lqbad1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_LIMTYPE.lqbad1.d
new file mode 100644
index 0000000..894f064
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_LIMTYPE.lqbad1.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  lquantize() upper bound around must be an integer constant
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+BEGIN
+{
+	x = 'a';
+	@a[1] = lquantize(timestamp, 100, rand(), 1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_LIMVAL.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_LIMVAL.bad.d
new file mode 100644
index 0000000..0a2f5e7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_LIMVAL.bad.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  lquantize() upper bound around must be an integer constant
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	x = 'a';
+	@a[1] = lquantize(timestamp, 100, 2147483657, 1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHBASE.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHBASE.d
new file mode 100644
index 0000000..b93ffab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHBASE.d
@@ -0,0 +1,33 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@ = lquantize(0, 10, 20, 1);
+	@ = lquantize(0, 15, 20, 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHBASE.order.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHBASE.order.d
new file mode 100644
index 0000000..763c1e0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHBASE.order.d
@@ -0,0 +1,33 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@ = lquantize(0, 10, 20, 1);
+	@ = lquantize(0, 15, 30, 10);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHLIM.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHLIM.d
new file mode 100644
index 0000000..d9ba023
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHLIM.d
@@ -0,0 +1,33 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@ = lquantize(0, 10, 20, 1);
+	@ = lquantize(0, 10, 2000, 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHLIM.order.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHLIM.order.d
new file mode 100644
index 0000000..62be0c5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHLIM.order.d
@@ -0,0 +1,33 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@ = lquantize(0, 10, 20, 1);
+	@ = lquantize(0, 10, 2000, 10);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHSTEP.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHSTEP.d
new file mode 100644
index 0000000..086f439
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MATCHSTEP.d
@@ -0,0 +1,33 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@ = lquantize(0, 10, 20, 1);
+	@ = lquantize(0, 10, 20, 2);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MISMATCH.lqbadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MISMATCH.lqbadarg.d
new file mode 100644
index 0000000..a4444ad
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_MISMATCH.lqbadarg.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Upper bound must be greater than lower bound argument
+ *
+ * SECTION: Aggregations/Aggregations
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-1
+/i < 1000/
+{
+	@a[i] = lquantize(i, 1100, -100, -100 );
+	i += 100;
+}
+
+tick-1
+/i == 1000/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPLARGE.lqtoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPLARGE.lqtoofew.d
new file mode 100644
index 0000000..664f70f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPLARGE.lqtoofew.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  lquantize() should not accept more than 4 arguments.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = lquantize(1, 2, 3, 4, 5);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPSMALL.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPSMALL.bad.d
new file mode 100644
index 0000000..634e8c0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPSMALL.bad.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Number of quantization levels must be a 16-bit quantity
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a[i] = lquantize(i, 0, 1000000, 10);
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPTYPE.lqbadinc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPTYPE.lqbadinc.d
new file mode 100644
index 0000000..87c5127
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPTYPE.lqbadinc.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Upper bound must be greater than lower bound argument
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-1
+/i < 1000/
+{
+	@a[i] = lquantize(i, 0, 1100, -100);
+	i += 100;
+}
+
+tick-1
+/i == 1000/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPVAL.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPVAL.bad.d
new file mode 100644
index 0000000..a90d757
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_LQUANT_STEPVAL.bad.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  lquantize() step value should be a 16-bit quantity
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a[i] = lquantize(i, 100, 1100, 200000 );
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_AGGARG.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_AGGARG.bad.d
new file mode 100644
index 0000000..7e5974c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_AGGARG.bad.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	The first argument to normalize() should be an aggregation.
+ *
+ * SECTION: Aggregations/Clearing aggregations
+ *
+ *
+ */
+
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=1ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i % 5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+
+	printf("normalized data:\n");
+	normalize(count(), 4);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_PROTO.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_PROTO.bad.d
new file mode 100644
index 0000000..82d819d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_PROTO.bad.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	normalize() accepts 2 args - passing fewer is an error.
+ *
+ * SECTION: Aggregations/Clearing aggregations
+ *
+ *
+ */
+
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=1ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i % 5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("normalized data:\n");
+	normalize(@func);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_SCALAR.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_SCALAR.bad.d
new file mode 100644
index 0000000..14a2586
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_NORMALIZE_SCALAR.bad.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	The second argument to normalize() should be a scalar.
+ *
+ * SECTION: Aggregations/Clearing aggregations
+ *
+ *
+ */
+
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=1ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i % 5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("normalized data:\n");
+	normalize(@func, "hello");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_ARG.lquantizetoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_ARG.lquantizetoofew.d
new file mode 100644
index 0000000..db4567f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_ARG.lquantizetoofew.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *   lquantize() should not accept a non-scalar value
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[pid] = lquantize(probefunc, probefunc, probefunc, probefunc);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.avgnoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.avgnoarg.d
new file mode 100644
index 0000000..628eeab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.avgnoarg.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	avg() should not accept a call with no arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a[1] = avg();
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.avgtoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.avgtoomany.d
new file mode 100644
index 0000000..42e5c1c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.avgtoomany.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *   avg() should not more than one argument
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a[1] = avg(1, 2);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.counttoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.counttoomany.d
new file mode 100644
index 0000000..5dc5b80
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.counttoomany.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *   count() should not accept any arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a["badtest"] = count(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.lquantizenoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.lquantizenoarg.d
new file mode 100644
index 0000000..ae4b672
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.lquantizenoarg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	lquantize() should not accept a call with no arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = lquantize();
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.lquantizetoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.lquantizetoomany.d
new file mode 100644
index 0000000..bf87a46
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.lquantizetoomany.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   lquantize() should not have more than five (!) arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@[1] = lquantize(10, 0, 100, 1, 10, 20);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.maxnoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.maxnoarg.d
new file mode 100644
index 0000000..aad2c24
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.maxnoarg.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   max() should not accept a call with no arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = max();
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.maxtoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.maxtoomany.d
new file mode 100644
index 0000000..d0fb091
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.maxtoomany.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   max() should not more than one argument
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = max(1, 2);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.minnoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.minnoarg.d
new file mode 100644
index 0000000..09db51f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.minnoarg.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  min() should not accept a call with no arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = min();
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.mintoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.mintoomany.d
new file mode 100644
index 0000000..2647402
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.mintoomany.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  min() should not more than one argument
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = min(1, 2);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.quantizenoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.quantizenoarg.d
new file mode 100644
index 0000000..b33957a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.quantizenoarg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  quantize() should not accept a call with no arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = quantize();
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.quantizetoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.quantizetoomany.d
new file mode 100644
index 0000000..9b162bd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.quantizetoomany.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   quantize() should not have more than two arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[1] = quantize(1, 2, 3);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d
new file mode 100644
index 0000000..2952cf5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevnoarg.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     stddev() should not accept a call with no arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a[1] = stddev();
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d
new file mode 100644
index 0000000..c42e962
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.stddevtoomany.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     stddev() should not have more than one argument
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a[1] = stddev(1, 2);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.sumnoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.sumnoarg.d
new file mode 100644
index 0000000..4f27901
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.sumnoarg.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  sum() should not accept a call with no arguments
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[pid] = sum();
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.sumtoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.sumtoomany.d
new file mode 100644
index 0000000..5e899be
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_PROTO_LEN.sumtoomany.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  sum() should not more than one argument
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+BEGIN
+{
+	@a[pid] = sum(1, 2);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_AGGARG.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_AGGARG.bad.d
new file mode 100644
index 0000000..69cb729
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_AGGARG.bad.d
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+int i;
+
+BEGIN
+{
+	trunc(i);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_PROTO.badmany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_PROTO.badmany.d
new file mode 100644
index 0000000..61271a7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_PROTO.badmany.d
@@ -0,0 +1,34 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@[0] = count();
+	trunc(@, 10, 20);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_PROTO.badnone.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_PROTO.badnone.d
new file mode 100644
index 0000000..e141e6c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_PROTO.badnone.d
@@ -0,0 +1,33 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	trunc();
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_SCALAR.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_SCALAR.bad.d
new file mode 100644
index 0000000..e548576
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/err.D_TRUNC_SCALAR.bad.d
@@ -0,0 +1,34 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@[0] = count();
+	trunc(@, @);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.allquant.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.allquant.d
new file mode 100644
index 0000000..26241b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.allquant.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+int i;
+
+tick-10ms
+{
+	@ = quantize(1LL << i);
+	@ = quantize((1LL << i) + 1);
+	@ = quantize(-(1LL << i));
+	@ = quantize(-(1LL << i) - 1);
+	i++;
+}
+
+tick-10ms
+/i == 64/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.allquant.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.allquant.d.out
new file mode 100644
index 0000000..356d6b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.allquant.d.out
@@ -0,0 +1,131 @@
+
+
+           value  ------------- Distribution ------------- count    
+-4611686018427387904 |@                                        5        
+-2305843009213693952 |                                         2        
+-1152921504606846976 |                                         2        
+-576460752303423488 |                                         2        
+-288230376151711744 |                                         2        
+-144115188075855872 |                                         2        
+-72057594037927936 |                                         2        
+-36028797018963968 |                                         2        
+-18014398509481984 |                                         2        
+-9007199254740992 |                                         2        
+-4503599627370496 |                                         2        
+-2251799813685248 |                                         2        
+-1125899906842624 |                                         2        
+-562949953421312 |                                         2        
+-281474976710656 |                                         2        
+-140737488355328 |                                         2        
+ -70368744177664 |                                         2        
+ -35184372088832 |                                         2        
+ -17592186044416 |                                         2        
+  -8796093022208 |                                         2        
+  -4398046511104 |                                         2        
+  -2199023255552 |                                         2        
+  -1099511627776 |                                         2        
+   -549755813888 |                                         2        
+   -274877906944 |                                         2        
+   -137438953472 |                                         2        
+    -68719476736 |                                         2        
+    -34359738368 |                                         2        
+    -17179869184 |                                         2        
+     -8589934592 |                                         2        
+     -4294967296 |                                         2        
+     -2147483648 |                                         2        
+     -1073741824 |                                         2        
+      -536870912 |                                         2        
+      -268435456 |                                         2        
+      -134217728 |                                         2        
+       -67108864 |                                         2        
+       -33554432 |                                         2        
+       -16777216 |                                         2        
+        -8388608 |                                         2        
+        -4194304 |                                         2        
+        -2097152 |                                         2        
+        -1048576 |                                         2        
+         -524288 |                                         2        
+         -262144 |                                         2        
+         -131072 |                                         2        
+          -65536 |                                         2        
+          -32768 |                                         2        
+          -16384 |                                         2        
+           -8192 |                                         2        
+           -4096 |                                         2        
+           -2048 |                                         2        
+           -1024 |                                         2        
+            -512 |                                         2        
+            -256 |                                         2        
+            -128 |                                         2        
+             -64 |                                         2        
+             -32 |                                         2        
+             -16 |                                         2        
+              -8 |                                         2        
+              -4 |                                         2        
+              -2 |                                         3        
+              -1 |                                         1        
+               0 |                                         0        
+               1 |                                         1        
+               2 |                                         3        
+               4 |                                         2        
+               8 |                                         2        
+              16 |                                         2        
+              32 |                                         2        
+              64 |                                         2        
+             128 |                                         2        
+             256 |                                         2        
+             512 |                                         2        
+            1024 |                                         2        
+            2048 |                                         2        
+            4096 |                                         2        
+            8192 |                                         2        
+           16384 |                                         2        
+           32768 |                                         2        
+           65536 |                                         2        
+          131072 |                                         2        
+          262144 |                                         2        
+          524288 |                                         2        
+         1048576 |                                         2        
+         2097152 |                                         2        
+         4194304 |                                         2        
+         8388608 |                                         2        
+        16777216 |                                         2        
+        33554432 |                                         2        
+        67108864 |                                         2        
+       134217728 |                                         2        
+       268435456 |                                         2        
+       536870912 |                                         2        
+      1073741824 |                                         2        
+      2147483648 |                                         2        
+      4294967296 |                                         2        
+      8589934592 |                                         2        
+     17179869184 |                                         2        
+     34359738368 |                                         2        
+     68719476736 |                                         2        
+    137438953472 |                                         2        
+    274877906944 |                                         2        
+    549755813888 |                                         2        
+   1099511627776 |                                         2        
+   2199023255552 |                                         2        
+   4398046511104 |                                         2        
+   8796093022208 |                                         2        
+  17592186044416 |                                         2        
+  35184372088832 |                                         2        
+  70368744177664 |                                         2        
+ 140737488355328 |                                         2        
+ 281474976710656 |                                         2        
+ 562949953421312 |                                         2        
+1125899906842624 |                                         2        
+2251799813685248 |                                         2        
+4503599627370496 |                                         2        
+9007199254740992 |                                         2        
+18014398509481984 |                                         2        
+36028797018963968 |                                         2        
+72057594037927936 |                                         2        
+144115188075855872 |                                         2        
+288230376151711744 |                                         2        
+576460752303423488 |                                         2        
+1152921504606846976 |                                         2        
+2305843009213693952 |                                         2        
+4611686018427387904 |                                         3        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg.d
new file mode 100644
index 0000000..a4bfd3c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Positive avg() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is a simple verifiable positive test of the avg() function.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a = avg(i);
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg.d.out
new file mode 100644
index 0000000..e3c0687
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg.d.out
@@ -0,0 +1,2 @@
+
+              450
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg_neg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg_neg.d
new file mode 100644
index 0000000..5c1e77d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg_neg.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	Positive avg() test using negative values
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is a simple verifiable positive test of the avg() function.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@ = avg(0);
+	@ = avg(-900);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg_neg.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg_neg.d.out
new file mode 100644
index 0000000..3fafcd4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.avg_neg.d.out
@@ -0,0 +1,2 @@
+
+             -450
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clear.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clear.d
new file mode 100644
index 0000000..2acd8ee
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clear.d
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for clearing aggregations
+ *
+ * SECTION: Aggregations/Clearing aggregations
+ *
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=50ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i%5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 10/
+{
+	printf("Aggregation data before clear():\n");
+	printa(@func);
+
+	clear(@func);
+
+	printf("Aggregation data after clear():\n");
+	printa(@func);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("Final aggregation data:\n");
+	printa(@func);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clear.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clear.d.out
new file mode 100644
index 0000000..486e4ac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clear.d.out
@@ -0,0 +1,22 @@
+Aggregation data before clear():
+
+        0              500
+        1              700
+        2              900
+        3             1100
+        4             1300
+Aggregation data after clear():
+
+        0                0
+        1                0
+        2                0
+        3                0
+        4                0
+Final aggregation data:
+
+        0             1500
+        1             2700
+        2             2900
+        3             3100
+        4             3300
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg.d
new file mode 100644
index 0000000..135e511
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Positive avg() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES:
+ *	Verifies that printing a clear()'d aggregation with an avg()
+ *	aggregation function doesn't cause problems.
+ *
+ */
+
+#pragma D option quiet
+
+tick-10ms
+/i++ < 5/
+{
+	@a = avg(timestamp);
+}
+
+tick-10ms
+/i == 5/
+{
+	exit(2);
+}
+
+END
+{
+	clear(@a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg.d.out
new file mode 100644
index 0000000..8d23188
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg.d.out
@@ -0,0 +1,2 @@
+
+                0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg2.d
new file mode 100644
index 0000000..0f7a958
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg2.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Positive avg() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES:
+ *	Verifies that printing a clear()'d aggregation with an avg()
+ *	aggregation function of 0 doesn't cause divide-by-zero problems.
+ *
+ */
+
+#pragma D option quiet
+#pragma D option switchrate=50ms
+#pragma D option aggrate=1ms
+
+tick-100ms
+/(x++ % 5) == 0/
+{
+	@time = avg(0);
+}
+
+tick-100ms
+/x > 5 && x <= 20/
+{
+	printa(" %@d\n", @time);
+	clear(@time);
+}
+
+tick-100ms
+/x > 20/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg2.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg2.d.out
new file mode 100644
index 0000000..7cceedd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearavg2.d.out
@@ -0,0 +1,16 @@
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.cleardenormalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.cleardenormalize.d
new file mode 100644
index 0000000..7aefed0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.cleardenormalize.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *    Denormalized aggregations can be cleared
+ *
+ * SECTION: Aggregations/Normalization;
+ * 	Aggregations/Clearing aggregations
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=50ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i != 10 || i != 20/
+{
+	@func[i%5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 10/
+{
+	printf("Denormalized data before clear:\n");
+	denormalize(@func);
+	printa(@func);
+
+	clear(@func);
+
+	printf("Aggregation data after clear:\n");
+	printa(@func);
+	i++
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("Final (denormalized) aggregation data:\n");
+	denormalize(@func);
+	printa(@func);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.cleardenormalize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.cleardenormalize.d.out
new file mode 100644
index 0000000..ed7f2f3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.cleardenormalize.d.out
@@ -0,0 +1,22 @@
+Denormalized data before clear:
+
+        0              500
+        1              700
+        2              900
+        3             1100
+        4             1300
+Aggregation data after clear:
+
+        0                0
+        1                0
+        2                0
+        3                0
+        4                0
+Final (denormalized) aggregation data:
+
+        0             1500
+        1             2700
+        2             2900
+        3             3100
+        4             3300
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearlquantize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearlquantize.d
new file mode 100644
index 0000000..2d0ff83
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearlquantize.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Positive lquantize()/clear() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES:
+ *	Verifies that printing a clear()'d aggregation with an lquantize()
+ *	aggregation function doesn't cause problems.
+ *
+ */
+
+
+#pragma D option switchrate=50ms
+#pragma D option aggrate=1ms
+#pragma D option quiet
+
+tick-100ms
+{
+	x++;
+	@a["linear"] = lquantize(x, 0, 100, 1);
+	@b["exp"] = quantize(x);
+}
+
+tick-100ms
+/(x % 5) == 0 && y++ < 5/
+{
+	printa(@a);
+	printa(@b);
+	clear(@a);
+	clear(@b);
+}
+
+tick-100ms
+/(x % 5) == 0 && y == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearlquantize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearlquantize.d.out
new file mode 100644
index 0000000..e7e2a60
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearlquantize.d.out
@@ -0,0 +1,94 @@
+
+  linear                                            
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@                                 1        
+               2 |@@@@@@@@                                 1        
+               3 |@@@@@@@@                                 1        
+               4 |@@@@@@@@                                 1        
+               5 |@@@@@@@@                                 1        
+               6 |                                         0        
+
+
+  exp                                               
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@                                 1        
+               2 |@@@@@@@@@@@@@@@@                         2        
+               4 |@@@@@@@@@@@@@@@@                         2        
+               8 |                                         0        
+
+
+  linear                                            
+           value  ------------- Distribution ------------- count    
+               5 |                                         0        
+               6 |@@@@@@@@                                 1        
+               7 |@@@@@@@@                                 1        
+               8 |@@@@@@@@                                 1        
+               9 |@@@@@@@@                                 1        
+              10 |@@@@@@@@                                 1        
+              11 |                                         0        
+
+
+  exp                                               
+           value  ------------- Distribution ------------- count    
+               2 |                                         0        
+               4 |@@@@@@@@@@@@@@@@                         2        
+               8 |@@@@@@@@@@@@@@@@@@@@@@@@                 3        
+              16 |                                         0        
+
+
+  linear                                            
+           value  ------------- Distribution ------------- count    
+              10 |                                         0        
+              11 |@@@@@@@@                                 1        
+              12 |@@@@@@@@                                 1        
+              13 |@@@@@@@@                                 1        
+              14 |@@@@@@@@                                 1        
+              15 |@@@@@@@@                                 1        
+              16 |                                         0        
+
+
+  exp                                               
+           value  ------------- Distribution ------------- count    
+               4 |                                         0        
+               8 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+              16 |                                         0        
+
+
+  linear                                            
+           value  ------------- Distribution ------------- count    
+              15 |                                         0        
+              16 |@@@@@@@@                                 1        
+              17 |@@@@@@@@                                 1        
+              18 |@@@@@@@@                                 1        
+              19 |@@@@@@@@                                 1        
+              20 |@@@@@@@@                                 1        
+              21 |                                         0        
+
+
+  exp                                               
+           value  ------------- Distribution ------------- count    
+               8 |                                         0        
+              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+              32 |                                         0        
+
+
+  linear                                            
+           value  ------------- Distribution ------------- count    
+              20 |                                         0        
+              21 |@@@@@@@@                                 1        
+              22 |@@@@@@@@                                 1        
+              23 |@@@@@@@@                                 1        
+              24 |@@@@@@@@                                 1        
+              25 |@@@@@@@@                                 1        
+              26 |                                         0        
+
+
+  exp                                               
+           value  ------------- Distribution ------------- count    
+               8 |                                         0        
+              16 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+              32 |                                         0        
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearnormalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearnormalize.d
new file mode 100644
index 0000000..75cfa2d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearnormalize.d
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Normalized aggregation data can be cleared
+ *
+ * SECTION: Aggregations/Normalization;
+ *	Aggregations/Clearing aggregations
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=50ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i % 5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 10/
+{
+	printf("Normalized data before clear:\n");
+	normalize(@func, 5);
+	printa(@func);
+
+	clear(@func);
+
+	printf("Aggregation data after clear:\n");
+	printa(@func);
+	i++
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("Final (normalized) aggregation data:\n");
+	normalize(@func, 5);
+	printa(@func);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearnormalize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearnormalize.d.out
new file mode 100644
index 0000000..e568427
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearnormalize.d.out
@@ -0,0 +1,22 @@
+Normalized data before clear:
+
+        0              100
+        1              140
+        2              180
+        3              220
+        4              260
+Aggregation data after clear:
+
+        0                0
+        1                0
+        2                0
+        3                0
+        4                0
+Final (normalized) aggregation data:
+
+        0              300
+        1              540
+        2              580
+        3              620
+        4              660
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d
new file mode 100644
index 0000000..af3ecd5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     Positive stddev() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES:
+ *     Verifies that printing a clear()'d aggregation with an stddev()
+ *     aggregation function doesn't cause problems.
+ *
+ */
+
+#pragma D option quiet
+
+tick-10ms
+/i++ < 5/
+{
+	@a = stddev(timestamp);
+}
+
+tick-10ms
+/i == 5/
+{
+	exit(2);
+}
+
+END
+{
+	clear(@a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out
new file mode 100644
index 0000000..8d23188
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.clearstddev.d.out
@@ -0,0 +1,2 @@
+
+                0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count.d
new file mode 100644
index 0000000..e81d123
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Postive count() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a = count();
+	@a = count();
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count.d.out
new file mode 100644
index 0000000..d34fd3b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count.d.out
@@ -0,0 +1,2 @@
+
+                2
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count2.d
new file mode 100644
index 0000000..624b1b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count2.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive count() test
+ *
+ * SECTION: Aggregations/Aggregations
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i != 10/
+{
+	i++;
+	@counts["tick-count"] = count();
+}
+
+tick-10ms
+/i == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count2.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count2.d.out
new file mode 100644
index 0000000..4998a33
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count2.d.out
@@ -0,0 +1,2 @@
+
+  tick-count                                                       10
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count3.d
new file mode 100644
index 0000000..5913ff6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.count3.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Test multiple count() calls.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i != 10/
+{
+	i++;
+	@counts1[execname] = count();
+	@counts2[execname, arg0] = count();
+}
+
+tick-10ms
+/i == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalize.d
new file mode 100644
index 0000000..37269e8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalize.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *   Simple denormalization test
+ *
+ * SECTION: Aggregations/Normalization
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-10ms
+/i < 20/
+{
+	@func[i % 5] = sum(i * 100);
+	i++;
+}
+
+tick-10ms
+/i == 20/
+{
+	normalize(@func, 5);
+
+	printf("denormalized:");
+	denormalize(@func);
+	printa(@func);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalize.d.out
new file mode 100644
index 0000000..fa4d0da
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalize.d.out
@@ -0,0 +1,7 @@
+denormalized:
+        0             3000
+        1             3400
+        2             3800
+        3             4200
+        4             4600
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalizeonly.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalizeonly.d
new file mode 100644
index 0000000..d63a83e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalizeonly.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *   denormalize() should work even if normalize() isn't called.
+ *
+ * SECTION: Aggregations/Normalization
+ *
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-10ms
+/i < 20/
+{
+	@func[i%5] = sum(i * 100);
+	i++;
+}
+
+tick-10ms
+/i == 20/
+{
+	printf("denormalized:");
+	denormalize(@func);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalizeonly.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalizeonly.d.out
new file mode 100644
index 0000000..cc16f27
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.denormalizeonly.d.out
@@ -0,0 +1,6 @@
+denormalized:
+        0             3000
+        1             3400
+        2             3800
+        3             4200
+        4             4600
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.fmtnormalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.fmtnormalize.d
new file mode 100644
index 0000000..8ff3aab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.fmtnormalize.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for normalization() with printa()
+ *
+ * SECTION: Aggregations/Normalization
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=50ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i % 5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("normalized data:\n");
+	normalize(@func, 5);
+	printa("%u %@u\n", @func);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.fmtnormalize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.fmtnormalize.d.out
new file mode 100644
index 0000000..bbf345b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.fmtnormalize.d.out
@@ -0,0 +1,7 @@
+normalized data:
+0 600
+1 680
+2 760
+3 840
+4 920
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.forms.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.forms.d
new file mode 100644
index 0000000..2b08a12
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.forms.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Positive aggregation test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a = count();
+	@b = max(1);
+	@c[0] = count();
+	@d[0] = max(1);
+
+	printa("\n at a = %@u\n", @a);
+	printa("@b = %@u\n", @b);
+	printa("@c = %@u\n", @c);
+	printa("@d = %@u\n", @d);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.forms.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.forms.d.out
new file mode 100644
index 0000000..1f31450
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.forms.d.out
@@ -0,0 +1,6 @@
+
+ at a = 1
+ at b = 1
+ at c = 1
+ at d = 1
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.goodkey.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.goodkey.d
new file mode 100644
index 0000000..46becd5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.goodkey.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive aggregation key test
+ *
+ * SECTION: Aggregations/Aggregations
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i != 5/
+{
+	i++;
+	@counts[execname, pid, id, tid, arg0, vtimestamp ] = count();
+
+}
+
+tick-10ms
+/i == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.keysort.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.keysort.d
new file mode 100644
index 0000000..dbc8b6d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.keysort.d
@@ -0,0 +1,108 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+	j = 0;
+
+	@tour["Ghent", i++, j] = sum(5 - j);
+	j++;
+
+	@tour["Berlin", i++, j] = sum(5 - j);
+	j++;
+
+	@tour["London", i++, j] = sum(5 - j);
+	@tour["Dublin", i++, j] = sum(5 - j);
+	j++;
+
+	@tour["Shanghai", i++, j] = sum(5 - j);
+	j++;
+
+	@tour["Zurich", i++, j] = sum(5 - j);
+	j++;
+
+	@tour["Regina", i++, j] = sum(5 - j);
+	@tour["Winnipeg", i++, j] = sum(5 - j);
+	@tour["Edmonton", i++, j] = sum(5 - j);
+	@tour["Calgary", i++, j] = sum(5 - j);
+	@tour["Vancouver", i++, j] = sum(5 - j);
+	@tour["Victoria", i++, j] = sum(5 - j);
+	j++;
+
+	@tour["Prague", i++, j] = sum(5 - j);
+	@tour["London", i++, j] = sum(5 - j);
+	j++;
+
+	@tour["Brisbane", i++, j] = sum(5 - j);
+	@tour["Sydney", i++, j] = sum(5 - j);
+	@tour["Melbourne", i++, j] = sum(5 - j);
+	j++;
+
+	setopt("aggsortkey", "false");
+	setopt("aggsortkeypos", "0");
+	@tour["Amsterdam", i++, j] = sum(5 - j);
+
+	printf("By value:\n");
+	printa("%20s %8d %8d %8 at d\n", @tour);
+
+	setopt("aggsortkey");
+	printf("\nBy key, position 0:\n");
+	printa("%20s %8d %8d %8 at d\n", @tour);
+
+	setopt("aggsortkeypos", "1");
+	printf("\nBy key, position 1:\n");
+	printa("%20s %8d %8d %8 at d\n", @tour);
+
+	setopt("aggsortkeypos", "2");
+	printf("\nBy key, position 2:\n");
+	printa("%20s %8d %8d %8 at d\n", @tour);
+
+	setopt("aggsortkey", "false");
+	setopt("aggsortkeypos", "0");
+	setopt("aggsortrev");
+
+	printf("\nReversed by value:\n");
+	printa("%20s %8d %8d %8 at d\n", @tour);
+
+	setopt("aggsortkey");
+	printf("\nReversed by key, position 0:\n");
+	printa("%20s %8d %8d %8 at d\n", @tour);
+
+	setopt("aggsortkeypos", "1");
+	printf("\nReversed by key, position 1:\n");
+	printa("%20s %8d %8d %8 at d\n", @tour);
+
+	setopt("aggsortkeypos", "2");
+	printf("\nReversed by key, position 2:\n");
+	printa("%20s %8d %8d %8 at d\n", @tour);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.keysort.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.keysort.d.out
new file mode 100644
index 0000000..250d84b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.keysort.d.out
@@ -0,0 +1,160 @@
+By value:
+           Amsterdam       17        8       -3
+            Brisbane       14        7       -2
+           Melbourne       16        7       -2
+              Sydney       15        7       -2
+              London       13        6       -1
+              Prague       12        6       -1
+             Calgary        9        5        0
+            Edmonton        8        5        0
+              Regina        6        5        0
+           Vancouver       10        5        0
+            Victoria       11        5        0
+            Winnipeg        7        5        0
+              Zurich        5        4        1
+            Shanghai        4        3        2
+              Dublin        3        2        3
+              London        2        2        3
+              Berlin        1        1        4
+               Ghent        0        0        5
+
+By key, position 0:
+           Amsterdam       17        8       -3
+              Berlin        1        1        4
+            Brisbane       14        7       -2
+             Calgary        9        5        0
+              Dublin        3        2        3
+            Edmonton        8        5        0
+               Ghent        0        0        5
+              London        2        2        3
+              London       13        6       -1
+           Melbourne       16        7       -2
+              Prague       12        6       -1
+              Regina        6        5        0
+            Shanghai        4        3        2
+              Sydney       15        7       -2
+           Vancouver       10        5        0
+            Victoria       11        5        0
+            Winnipeg        7        5        0
+              Zurich        5        4        1
+
+By key, position 1:
+               Ghent        0        0        5
+              Berlin        1        1        4
+              London        2        2        3
+              Dublin        3        2        3
+            Shanghai        4        3        2
+              Zurich        5        4        1
+              Regina        6        5        0
+            Winnipeg        7        5        0
+            Edmonton        8        5        0
+             Calgary        9        5        0
+           Vancouver       10        5        0
+            Victoria       11        5        0
+              Prague       12        6       -1
+              London       13        6       -1
+            Brisbane       14        7       -2
+              Sydney       15        7       -2
+           Melbourne       16        7       -2
+           Amsterdam       17        8       -3
+
+By key, position 2:
+               Ghent        0        0        5
+              Berlin        1        1        4
+              Dublin        3        2        3
+              London        2        2        3
+            Shanghai        4        3        2
+              Zurich        5        4        1
+             Calgary        9        5        0
+            Edmonton        8        5        0
+              Regina        6        5        0
+           Vancouver       10        5        0
+            Victoria       11        5        0
+            Winnipeg        7        5        0
+              London       13        6       -1
+              Prague       12        6       -1
+            Brisbane       14        7       -2
+           Melbourne       16        7       -2
+              Sydney       15        7       -2
+           Amsterdam       17        8       -3
+
+Reversed by value:
+               Ghent        0        0        5
+              Berlin        1        1        4
+              London        2        2        3
+              Dublin        3        2        3
+            Shanghai        4        3        2
+              Zurich        5        4        1
+            Winnipeg        7        5        0
+            Victoria       11        5        0
+           Vancouver       10        5        0
+              Regina        6        5        0
+            Edmonton        8        5        0
+             Calgary        9        5        0
+              Prague       12        6       -1
+              London       13        6       -1
+              Sydney       15        7       -2
+           Melbourne       16        7       -2
+            Brisbane       14        7       -2
+           Amsterdam       17        8       -3
+
+Reversed by key, position 0:
+              Zurich        5        4        1
+            Winnipeg        7        5        0
+            Victoria       11        5        0
+           Vancouver       10        5        0
+              Sydney       15        7       -2
+            Shanghai        4        3        2
+              Regina        6        5        0
+              Prague       12        6       -1
+           Melbourne       16        7       -2
+              London       13        6       -1
+              London        2        2        3
+               Ghent        0        0        5
+            Edmonton        8        5        0
+              Dublin        3        2        3
+             Calgary        9        5        0
+            Brisbane       14        7       -2
+              Berlin        1        1        4
+           Amsterdam       17        8       -3
+
+Reversed by key, position 1:
+           Amsterdam       17        8       -3
+           Melbourne       16        7       -2
+              Sydney       15        7       -2
+            Brisbane       14        7       -2
+              London       13        6       -1
+              Prague       12        6       -1
+            Victoria       11        5        0
+           Vancouver       10        5        0
+             Calgary        9        5        0
+            Edmonton        8        5        0
+            Winnipeg        7        5        0
+              Regina        6        5        0
+              Zurich        5        4        1
+            Shanghai        4        3        2
+              Dublin        3        2        3
+              London        2        2        3
+              Berlin        1        1        4
+               Ghent        0        0        5
+
+Reversed by key, position 2:
+           Amsterdam       17        8       -3
+              Sydney       15        7       -2
+           Melbourne       16        7       -2
+            Brisbane       14        7       -2
+              Prague       12        6       -1
+              London       13        6       -1
+            Winnipeg        7        5        0
+            Victoria       11        5        0
+           Vancouver       10        5        0
+              Regina        6        5        0
+            Edmonton        8        5        0
+             Calgary        9        5        0
+              Zurich        5        4        1
+            Shanghai        4        3        2
+              London        2        2        3
+              Dublin        3        2        3
+              Berlin        1        1        4
+               Ghent        0        0        5
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantize.d
new file mode 100644
index 0000000..dd25f86
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantize.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive lquantize() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is verifiable simple positive test of the lquantize() function.
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a[i] = lquantize(i, -100, 1100, 100 );
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantize.d.out
new file mode 100644
index 0000000..fecb448
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantize.d.out
@@ -0,0 +1,61 @@
+
+        0
+           value  ------------- Distribution ------------- count    
+            -100 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             100 |                                         0        
+
+      100
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+             100 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             200 |                                         0        
+
+      200
+           value  ------------- Distribution ------------- count    
+             100 |                                         0        
+             200 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             300 |                                         0        
+
+      300
+           value  ------------- Distribution ------------- count    
+             200 |                                         0        
+             300 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             400 |                                         0        
+
+      400
+           value  ------------- Distribution ------------- count    
+             300 |                                         0        
+             400 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             500 |                                         0        
+
+      500
+           value  ------------- Distribution ------------- count    
+             400 |                                         0        
+             500 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             600 |                                         0        
+
+      600
+           value  ------------- Distribution ------------- count    
+             500 |                                         0        
+             600 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             700 |                                         0        
+
+      700
+           value  ------------- Distribution ------------- count    
+             600 |                                         0        
+             700 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             800 |                                         0        
+
+      800
+           value  ------------- Distribution ------------- count    
+             700 |                                         0        
+             800 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             900 |                                         0        
+
+      900
+           value  ------------- Distribution ------------- count    
+             800 |                                         0        
+             900 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+            1000 |                                         0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantnormal.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantnormal.d
new file mode 100644
index 0000000..003f846
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantnormal.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+tick-10ms
+/i++ < 10/
+{
+	@ = lquantize(i, 0, 10);
+	@ = lquantize(i, 0, 10);
+	@ = lquantize(i, 0, 10);
+	@ = lquantize(i, 0, 10);
+	@ = lquantize(i, 0, 10);
+}
+
+tick-10ms
+/i == 10/
+{
+	exit(0);
+}
+
+END
+{
+	normalize(@, 5);
+	printa(@);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantnormal.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantnormal.d.out
new file mode 100644
index 0000000..76b55b9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantnormal.d.out
@@ -0,0 +1,16 @@
+
+
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@                                     1        
+               2 |@@@@                                     1        
+               3 |@@@@                                     1        
+               4 |@@@@                                     1        
+               5 |@@@@                                     1        
+               6 |@@@@                                     1        
+               7 |@@@@                                     1        
+               8 |@@@@                                     1        
+               9 |@@@@                                     1        
+           >= 10 |@@@@                                     1        
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantrange.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantrange.d
new file mode 100644
index 0000000..e9e6716
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantrange.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@["Nixon"] = lquantize(-20, -10, 10, 1, 25);
+	@["Hoover"] = lquantize(20, -10, 10, 1, -100);
+	@["Harding"] = lquantize(-10, -10, 10, 1, 15);
+	@["Bush"] = lquantize(10, -10, 10, 1, 150);
+
+	printa(@);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantrange.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantrange.d.out
new file mode 100644
index 0000000..88d3505
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantrange.d.out
@@ -0,0 +1,23 @@
+
+  Hoover                                            
+           value  ------------- Distribution ------------- count    
+               9                                         | 0        
+           >= 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -100     
+
+  Nixon                                             
+           value  ------------- Distribution ------------- count    
+           < -10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 25       
+             -10 |                                         0        
+
+  Harding                                           
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 15       
+              -9 |                                         0        
+
+  Bush                                              
+           value  ------------- Distribution ------------- count    
+               9 |                                         0        
+           >= 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 150      
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantround.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantround.d
new file mode 100644
index 0000000..ad609ed
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantround.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+/*
+ * This test verifies that the height of the ASCII quantization bars is
+ * determined using rounding and not truncated integer arithmetic.
+ */
+tick-10ms
+/i++ >= 27/
+{
+	exit(0);
+}
+
+tick-10ms
+/i > 8/
+{
+	@ = lquantize(2, 0, 4);
+}
+
+tick-10ms
+/i > 2 && i <= 8/
+{
+	@ = lquantize(1, 0, 4);
+}
+
+tick-10ms
+/i <= 2/
+{
+	@ = lquantize(0, 0, 4);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantround.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantround.d.out
new file mode 100644
index 0000000..1aa94e3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantround.d.out
@@ -0,0 +1,9 @@
+
+
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@                                      2        
+               1 |@@@@@@@@@                                6        
+               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@             19       
+               3 |                                         0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantzero.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantzero.d
new file mode 100644
index 0000000..3905f2b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantzero.d
@@ -0,0 +1,96 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	a = 7;
+	b = 13;
+	val = (-a * b) + a;
+}
+
+tick-1ms
+{
+	incr = val % b;
+	val += a;
+}
+
+tick-1ms
+/val == 0/
+{
+	val += a;
+}
+
+tick-1ms
+/incr != 0/
+{
+	i++;
+	@one[i] = lquantize(0, 10, 20, 1, incr);
+	@two[i] = lquantize(0, 1, 20, 5, incr);
+	@three[i] = lquantize(0, 0, 20, 1, incr);
+	@four[i] = lquantize(0, -10, 10, 1, incr);
+	@five[i] = lquantize(0, -10, 0, 1, incr);
+	@six[i] = lquantize(0, -10, -1, 1, incr);
+	@seven[i] = lquantize(0, -10, -2, 1, incr);
+}
+
+tick-1ms
+/incr == 0/
+{
+	printf("Zero below the range:\n");
+	printa(@one);
+	printf("\n");
+
+	printf("Zero just below the range:\n");
+	printa(@two);
+	printf("\n");
+
+	printf("Zero at the bottom of the range:\n");
+	printa(@three);
+	printf("\n");
+
+	printf("Zero within the range:\n");
+	printa(@four);
+	printf("\n");
+
+	printf("Zero at the top of the range:\n");
+	printa(@five);
+	printf("\n");
+
+	printf("Zero just above the range:\n");
+	printa(@six);
+	printf("\n");
+
+	printf("Zero above the range:\n");
+	printa(@seven);
+	printf("\n");
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantzero.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantzero.d.out
new file mode 100644
index 0000000..330de38
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.lquantzero.d.out
@@ -0,0 +1,910 @@
+Zero below the range:
+
+                2
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+              10                                         | 0        
+
+                4
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+              10                                         | 0        
+
+                6
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+              10                                         | 0        
+
+                8
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+              10                                         | 0        
+
+               10
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+              10                                         | 0        
+
+               12
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+              10                                         | 0        
+
+                1
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+              10                                         | 0        
+
+                3
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+              10                                         | 0        
+
+                5
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+              10                                         | 0        
+
+                7
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+              10                                         | 0        
+
+                9
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+              10                                         | 0        
+
+               11
+           value  ------------- Distribution ------------- count    
+            < 10 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+              10                                         | 0        
+
+               14
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+              10 |                                         0        
+
+               16
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+              10 |                                         0        
+
+               18
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+              10 |                                         0        
+
+               20
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+              10 |                                         0        
+
+               22
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+              10 |                                         0        
+
+               24
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+              10 |                                         0        
+
+               13
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+              10 |                                         0        
+
+               15
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+              10 |                                         0        
+
+               17
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+              10 |                                         0        
+
+               19
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+              10 |                                         0        
+
+               21
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+              10 |                                         0        
+
+               23
+           value  ------------- Distribution ------------- count    
+            < 10 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+              10 |                                         0        
+
+
+Zero just below the range:
+
+                2
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+               1                                         | 0        
+
+                4
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+               1                                         | 0        
+
+                6
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+               1                                         | 0        
+
+                8
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+               1                                         | 0        
+
+               10
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+               1                                         | 0        
+
+               12
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+               1                                         | 0        
+
+                1
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+               1                                         | 0        
+
+                3
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+               1                                         | 0        
+
+                5
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+               1                                         | 0        
+
+                7
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+               1                                         | 0        
+
+                9
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+               1                                         | 0        
+
+               11
+           value  ------------- Distribution ------------- count    
+             < 1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+               1                                         | 0        
+
+               14
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               1 |                                         0        
+
+               16
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+               1 |                                         0        
+
+               18
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+               1 |                                         0        
+
+               20
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+               1 |                                         0        
+
+               22
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+               1 |                                         0        
+
+               24
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+               1 |                                         0        
+
+               13
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+               1 |                                         0        
+
+               15
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+               1 |                                         0        
+
+               17
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+               1 |                                         0        
+
+               19
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+               1 |                                         0        
+
+               21
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+               1 |                                         0        
+
+               23
+           value  ------------- Distribution ------------- count    
+             < 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+               1 |                                         0        
+
+
+Zero at the bottom of the range:
+
+                2
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+               1                                         | 0        
+
+                4
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+               1                                         | 0        
+
+                6
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+               1                                         | 0        
+
+                8
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+               1                                         | 0        
+
+               10
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+               1                                         | 0        
+
+               12
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+               1                                         | 0        
+
+                1
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+               1                                         | 0        
+
+                3
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+               1                                         | 0        
+
+                5
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+               1                                         | 0        
+
+                7
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+               1                                         | 0        
+
+                9
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+               1                                         | 0        
+
+               11
+           value  ------------- Distribution ------------- count    
+             < 0                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+               1                                         | 0        
+
+               14
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               1 |                                         0        
+
+               16
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+               1 |                                         0        
+
+               18
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+               1 |                                         0        
+
+               20
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+               1 |                                         0        
+
+               22
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+               1 |                                         0        
+
+               24
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+               1 |                                         0        
+
+               13
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+               1 |                                         0        
+
+               15
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+               1 |                                         0        
+
+               17
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+               1 |                                         0        
+
+               19
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+               1 |                                         0        
+
+               21
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+               1 |                                         0        
+
+               23
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+               1 |                                         0        
+
+
+Zero within the range:
+
+                2
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+               1                                         | 0        
+
+                4
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+               1                                         | 0        
+
+                6
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+               1                                         | 0        
+
+                8
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+               1                                         | 0        
+
+               10
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+               1                                         | 0        
+
+               12
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+               1                                         | 0        
+
+                1
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+               1                                         | 0        
+
+                3
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+               1                                         | 0        
+
+                5
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+               1                                         | 0        
+
+                7
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+               1                                         | 0        
+
+                9
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+               1                                         | 0        
+
+               11
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+               1                                         | 0        
+
+               14
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               1 |                                         0        
+
+               16
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+               1 |                                         0        
+
+               18
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+               1 |                                         0        
+
+               20
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+               1 |                                         0        
+
+               22
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+               1 |                                         0        
+
+               24
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+               1 |                                         0        
+
+               13
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+               1 |                                         0        
+
+               15
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+               1 |                                         0        
+
+               17
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+               1 |                                         0        
+
+               19
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+               1 |                                         0        
+
+               21
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+               1 |                                         0        
+
+               23
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+               1 |                                         0        
+
+
+Zero at the top of the range:
+
+                2
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+
+                4
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+
+                6
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+
+                8
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+
+               10
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+
+               12
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+
+                1
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+
+                3
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+
+                5
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+
+                7
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+
+                9
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+
+               11
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+            >= 0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+
+               14
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+
+               16
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+
+               18
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+
+               20
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+
+               22
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+
+               24
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+
+               13
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+
+               15
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+
+               17
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+
+               19
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+
+               21
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+
+               23
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+            >= 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+
+
+Zero just above the range:
+
+                2
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+
+                4
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+
+                6
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+
+                8
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+
+               10
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+
+               12
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+
+                1
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+
+                3
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+
+                5
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+
+                7
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+
+                9
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+
+               11
+           value  ------------- Distribution ------------- count    
+              -2                                         | 0        
+           >= -1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+
+               14
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+
+               16
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+
+               18
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+
+               20
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+
+               22
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+
+               24
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+
+               13
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+
+               15
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+
+               17
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+
+               19
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+
+               21
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+
+               23
+           value  ------------- Distribution ------------- count    
+              -2 |                                         0        
+           >= -1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+
+
+Zero above the range:
+
+               23
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+
+               21
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+
+               19
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+
+               17
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+
+               15
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+
+               13
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+
+               24
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+
+               22
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+
+               20
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+
+               18
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+
+               16
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+
+               14
+           value  ------------- Distribution ------------- count    
+              -3 |                                         0        
+           >= -2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+
+               11
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+
+                9
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+
+                7
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+
+                5
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+
+                3
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+
+                1
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+
+               12
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+
+               10
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+
+                8
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+
+                6
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+
+                4
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+
+                2
+           value  ------------- Distribution ------------- count    
+              -3                                         | 0        
+           >= -2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max.d
new file mode 100644
index 0000000..0c973ad
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive max() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is verifiable simple positive test of the max() function.
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a = max(i);
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	printa(@a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max.d.out
new file mode 100644
index 0000000..d3957f4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max.d.out
@@ -0,0 +1,3 @@
+
+              900
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max_neg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max_neg.d
new file mode 100644
index 0000000..63486e5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max_neg.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Positive max() test using negative values
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is verifiable simple positive test of the max() function.
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@ = max(0);
+	@ = max(-900);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max_neg.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max_neg.d.out
new file mode 100644
index 0000000..8d23188
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.max_neg.d.out
@@ -0,0 +1,2 @@
+
+                0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min.d
new file mode 100644
index 0000000..aff5452
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive min() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is verifiable simple positive test of the min() function.
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a = min(i);
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min.d.out
new file mode 100644
index 0000000..8d23188
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min.d.out
@@ -0,0 +1,2 @@
+
+                0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min_neg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min_neg.d
new file mode 100644
index 0000000..20f0a56
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min_neg.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *      Positive min() test using negative values
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is verifiable simple positive test of the min() function.
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@ = min(0);
+	@ = min(-900);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min_neg.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min_neg.d.out
new file mode 100644
index 0000000..461b29c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.min_neg.d.out
@@ -0,0 +1,2 @@
+
+             -900
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d
new file mode 100644
index 0000000..c65fb52
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs1.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     Multiple aggregates can be used within the same D script.
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	time_1 = timestamp;
+	i = 0;
+}
+
+tick-10ms
+/i <= 10/
+{
+	time_2 = timestamp;
+	new_time = time_2 - time_1;
+	@a[pid] = max(new_time);
+	@b[pid] = min(new_time);
+	@c[pid] = avg(new_time);
+	@d[pid] = sum(new_time);
+	@e[pid] = quantize(new_time);
+	@f[pid] = stddev(new_time);
+	@g[timestamp] = max(new_time);
+	@h[timestamp] = quantize(new_time);
+	@i[timestamp] = lquantize(new_time, 0, 10000, 1000);
+
+	time_1 = time_2;
+	i++;
+}
+
+tick-10ms
+/i == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d
new file mode 100644
index 0000000..b34d73f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     Test multiple aggregations and the default output order
+ *
+ * SECTION: Aggregations/Aggregations;
+ *     Aggregations/Output
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a = avg(i);
+	@b = sum(i);
+	@c = min(i);
+	@d = max(i);
+	@e = quantize(i);
+	@f = lquantize(i, 0, 1000, 100);
+	@g = stddev(i);
+
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out
new file mode 100644
index 0000000..579f78d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs2.d.out
@@ -0,0 +1,37 @@
+
+              450
+             4500
+                0
+              900
+
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@                                     1        
+               1 |                                         0        
+               2 |                                         0        
+               4 |                                         0        
+               8 |                                         0        
+              16 |                                         0        
+              32 |                                         0        
+              64 |@@@@                                     1        
+             128 |@@@@                                     1        
+             256 |@@@@@@@@@@@@                             3        
+             512 |@@@@@@@@@@@@@@@@                         4        
+            1024 |                                         0        
+
+
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@                                     1        
+             100 |@@@@                                     1        
+             200 |@@@@                                     1        
+             300 |@@@@                                     1        
+             400 |@@@@                                     1        
+             500 |@@@@                                     1        
+             600 |@@@@                                     1        
+             700 |@@@@                                     1        
+             800 |@@@@                                     1        
+             900 |@@@@                                     1        
+         >= 1000 |                                         0        
+
+              287
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d
new file mode 100644
index 0000000..21d2fa9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d
@@ -0,0 +1,74 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     Test multiple aggregations and overriding default order with
+ *     printa() statements.
+ *
+ * SECTION: Aggregations/Aggregations;
+ *     Aggregations/Output
+ *
+ * NOTES: This is a simple verifiable test.
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a = count();
+	@b = avg(i);
+	@c = sum(i);
+	@d = min(i);
+	@e = max(i);
+	@f = quantize(i);
+	@g = lquantize(i, 0, 1000, 100);
+	@h = stddev(i);
+
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	printa("%@d\n", @h);
+	printa("%@d\n", @g);
+	printa("%@d\n", @f);
+	printa("%@d\n", @e);
+	printa("%@d\n", @d);
+	printa("%@d\n", @c);
+	printa("%@d\n", @b);
+	printa("%@d\n", @a);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out
new file mode 100644
index 0000000..ab97660
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multiaggs3.d.out
@@ -0,0 +1,38 @@
+287
+
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@                                     1        
+             100 |@@@@                                     1        
+             200 |@@@@                                     1        
+             300 |@@@@                                     1        
+             400 |@@@@                                     1        
+             500 |@@@@                                     1        
+             600 |@@@@                                     1        
+             700 |@@@@                                     1        
+             800 |@@@@                                     1        
+             900 |@@@@                                     1        
+         >= 1000 |                                         0        
+
+
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@                                     1        
+               1 |                                         0        
+               2 |                                         0        
+               4 |                                         0        
+               8 |                                         0        
+              16 |                                         0        
+              32 |                                         0        
+              64 |@@@@                                     1        
+             128 |@@@@                                     1        
+             256 |@@@@@@@@@@@@                             3        
+             512 |@@@@@@@@@@@@@@@@                         4        
+            1024 |                                         0        
+
+900
+0
+4500
+450
+10
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multinormalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multinormalize.d
new file mode 100644
index 0000000..2cfa184
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multinormalize.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *    Multiple aggregations are supported
+ *
+ * SECTION: Aggregations/Normalization
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=50ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func1[i % 5] = sum(i * 100);
+	@func2[i % 5 + 1] = sum(i * 200);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("normalized data #1:\n");
+	normalize(@func1, 5);
+	printa(@func1);
+
+	printf("\nnormalized data #2:\n");
+	normalize(@func2, 5);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multinormalize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multinormalize.d.out
new file mode 100644
index 0000000..992b31e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.multinormalize.d.out
@@ -0,0 +1,15 @@
+normalized data #1:
+
+        0              600
+        1              680
+        2              760
+        3              840
+        4              920
+
+normalized data #2:
+
+        1             1200
+        2             1360
+        3             1520
+        4             1680
+        5             1840
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.neglquant.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.neglquant.d
new file mode 100644
index 0000000..d24884b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.neglquant.d
@@ -0,0 +1,150 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@["j-church"] = lquantize(1, 0, 10, 1, 100);
+	@["j-church"] = lquantize(1, 0, 10, 1, -99);
+	@["j-church"] = lquantize(1, 0, 10, 1, -1);
+	val = 123;
+}
+
+BEGIN
+{
+	@["k-ingleside"] = lquantize(1, 0, 10, 1, -val);
+}
+
+BEGIN
+{
+	@["l-taraval"] = lquantize(0, 0, 10, 1, -val);
+	@["l-taraval"] = lquantize(-1, 0, 10, 1, -val);
+	@["l-taraval"] = lquantize(1, 0, 10, 1, val);
+	@["l-taraval"] = lquantize(1, 0, 10, 1, val);
+}
+
+BEGIN
+{
+	@["m-oceanview"] = lquantize(1, 0, 10, 1, (1 << 63) - 1);
+	@["m-oceanview"] = lquantize(1, 0, 10, 1);
+	@["m-oceanview"] = lquantize(2, 0, 10, 1, (1 << 63) - 1);
+	@["m-oceanview"] = lquantize(8, 0, 10, 1, 400000);
+}
+
+BEGIN
+{
+	@["n-judah"] = lquantize(1, 0, 10, 1, val);
+	@["n-judah"] = lquantize(2, 0, 10, 1, val);
+	@["n-judah"] = lquantize(2, 0, 10, 1, val);
+	@["n-judah"] = lquantize(2, 0, 10, 1);
+}
+
+BEGIN
+{
+	this->i = 1;
+	this->val = (1 << 63) - 1;
+
+	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["f-market"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+}
+
+BEGIN
+{
+	this->i = 1;
+
+	/*
+	 * We want to test the ability to sort very large quantizations
+	 * that differ by a small amount.  Ideally, they would differ only
+	 * by 1 -- but that is smaller than the precision of long doubles of
+	 * this magnitude on x86.  To assure that the same test works on x86
+	 * just as it does on SPARC, we pick a value that is just larger than
+	 * the precision at this magnitude.  It should go without saying that
+	 * this robustness on new ISAs very much depends on the precision
+	 * of the long double representation.
+	 */
+	this->val = (1 << 63) - 7;
+
+	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+
+	@["s-castro"] = lquantize(this->i, 0, 10, 1, this->val);
+	this->i++;
+	this->val = ((1 << 63) - 1) / this->i;
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.neglquant.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.neglquant.d.out
new file mode 100644
index 0000000..3b7533b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.neglquant.d.out
@@ -0,0 +1,64 @@
+
+  k-ingleside                                       
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -123     
+               2                                         | 0        
+
+  j-church                                          
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+  l-taraval                                         
+           value  ------------- Distribution ------------- count    
+             < 0                @@@@@|                     -123     
+               0                @@@@@|                     -123     
+               1                     |@@@@@@@@@@           246      
+               2                     |                     0        
+
+  n-judah                                           
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@                            123      
+               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              247      
+               3 |                                         0        
+
+  m-oceanview                                       
+           value  ------------- Distribution ------------- count    
+               0                     |                     0        
+               1           @@@@@@@@@@|                     -9223372036854775808
+               2                     |@@@@@@@@@@           9223372036854775807
+               3                     |                     0        
+               4                     |                     0        
+               5                     |                     0        
+               6                     |                     0        
+               7                     |                     0        
+               8                     |                     400000   
+               9                     |                     0        
+
+  s-castro                                          
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@                          9223372036854775801
+               2 |@@@@@@@@                                 4611686018427387903
+               3 |@@@@@                                    3074457345618258602
+               4 |@@@@                                     2305843009213693951
+               5 |@@@                                      1844674407370955161
+               6 |@@@                                      1537228672809129301
+               7 |@@                                       1317624576693539401
+               8 |                                         0        
+
+  f-market                                          
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@                          9223372036854775807
+               2 |@@@@@@@@                                 4611686018427387903
+               3 |@@@@@                                    3074457345618258602
+               4 |@@@@                                     2305843009213693951
+               5 |@@@                                      1844674407370955161
+               6 |@@@                                      1537228672809129301
+               7 |@@                                       1317624576693539401
+               8 |                                         0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negorder.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negorder.d
new file mode 100644
index 0000000..440c483
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negorder.d
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	a = 7;
+	b = 13;
+	val = (-a * b) + a;
+}
+
+tick-1ms
+{
+	incr = val % b;
+	val += a;
+}
+
+tick-1ms
+/val == 0/
+{
+	val += a;
+}
+
+tick-1ms
+/incr != 0/
+{
+	i++;
+	@quanty[i] = quantize(1, incr);
+	@lquanty[i] = lquantize(1, -10, 10, 1, incr);
+	@summy[i] = sum(incr);
+	@maxxy[i] = max(incr);
+	@minny[i] = min(incr);
+}
+
+tick-1ms
+/incr == 0/
+{
+	printf("Ordering of quantize() with some negative weights:\n");
+	printa(@quanty);
+	printf("\n");
+
+	printf("Ordering of lquantize() with some negative weights:\n");
+	printa(@lquanty);
+	printf("\n");
+
+	printf("Ordering of sum() with some negative weights:\n");
+	printa(@summy);
+	printf("\n");
+
+	printf("Ordering of max() with some negative weights:\n");
+	printa(@maxxy);
+	printf("\n");
+
+	printf("Ordering of min() with some negative weights:\n");
+	printa(@minny);
+	printf("\n");
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negorder.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negorder.d.out
new file mode 100644
index 0000000..a03b685
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negorder.d.out
@@ -0,0 +1,376 @@
+Ordering of quantize() with some negative weights:
+
+                2
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+               2                                         | 0        
+
+                4
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+               2                                         | 0        
+
+                6
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+               2                                         | 0        
+
+                8
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+               2                                         | 0        
+
+               10
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+               2                                         | 0        
+
+               12
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+               2                                         | 0        
+
+                1
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+               2                                         | 0        
+
+                3
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+               2                                         | 0        
+
+                5
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+               2                                         | 0        
+
+                7
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+               2                                         | 0        
+
+                9
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+               2                                         | 0        
+
+               11
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+               2                                         | 0        
+
+               14
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               2 |                                         0        
+
+               16
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+               2 |                                         0        
+
+               18
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+               2 |                                         0        
+
+               20
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+               2 |                                         0        
+
+               22
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+               2 |                                         0        
+
+               24
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+               2 |                                         0        
+
+               13
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+               2 |                                         0        
+
+               15
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+               2 |                                         0        
+
+               17
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+               2 |                                         0        
+
+               19
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+               2 |                                         0        
+
+               21
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+               2 |                                         0        
+
+               23
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+               2 |                                         0        
+
+
+Ordering of lquantize() with some negative weights:
+
+                2
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+               2                                         | 0        
+
+                4
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+               2                                         | 0        
+
+                6
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+               2                                         | 0        
+
+                8
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+               2                                         | 0        
+
+               10
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+               2                                         | 0        
+
+               12
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+               2                                         | 0        
+
+                1
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+               2                                         | 0        
+
+                3
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+               2                                         | 0        
+
+                5
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+               2                                         | 0        
+
+                7
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+               2                                         | 0        
+
+                9
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+               2                                         | 0        
+
+               11
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+               2                                         | 0        
+
+               14
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               2 |                                         0        
+
+               16
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+               2 |                                         0        
+
+               18
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+               2 |                                         0        
+
+               20
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+               2 |                                         0        
+
+               22
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+               2 |                                         0        
+
+               24
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+               2 |                                         0        
+
+               13
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+               2 |                                         0        
+
+               15
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+               2 |                                         0        
+
+               17
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+               2 |                                         0        
+
+               19
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+               2 |                                         0        
+
+               21
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+               2 |                                         0        
+
+               23
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+               2 |                                         0        
+
+
+Ordering of sum() with some negative weights:
+
+                2              -12
+                4              -11
+                6              -10
+                8               -9
+               10               -8
+               12               -7
+                1               -6
+                3               -5
+                5               -4
+                7               -3
+                9               -2
+               11               -1
+               14                1
+               16                2
+               18                3
+               20                4
+               22                5
+               24                6
+               13                7
+               15                8
+               17                9
+               19               10
+               21               11
+               23               12
+
+Ordering of max() with some negative weights:
+
+                2              -12
+                4              -11
+                6              -10
+                8               -9
+               10               -8
+               12               -7
+                1               -6
+                3               -5
+                5               -4
+                7               -3
+                9               -2
+               11               -1
+               14                1
+               16                2
+               18                3
+               20                4
+               22                5
+               24                6
+               13                7
+               15                8
+               17                9
+               19               10
+               21               11
+               23               12
+
+Ordering of min() with some negative weights:
+
+                2              -12
+                4              -11
+                6              -10
+                8               -9
+               10               -8
+               12               -7
+                1               -6
+                3               -5
+                5               -4
+                7               -3
+                9               -2
+               11               -1
+               14                1
+               16                2
+               18                3
+               20                4
+               22                5
+               24                6
+               13                7
+               15                8
+               17                9
+               19               10
+               21               11
+               23               12
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negquant.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negquant.d
new file mode 100644
index 0000000..bbc7263
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negquant.d
@@ -0,0 +1,115 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@["j-church"] = quantize(1, 100);
+	@["j-church"] = quantize(1, -99);
+	@["j-church"] = quantize(1, -1);
+	val = 123;
+}
+
+BEGIN
+{
+	@["k-ingleside"] = quantize(1, -val);
+}
+
+BEGIN
+{
+	@["l-taraval"] = quantize(0, -val);
+	@["l-taraval"] = quantize(-1, -val);
+	@["l-taraval"] = quantize(1, val);
+	@["l-taraval"] = quantize(1, val);
+}
+
+BEGIN
+{
+	@["m-oceanview"] = quantize(1, (1 << 63) - 1);
+	@["m-oceanview"] = quantize(1);
+	@["m-oceanview"] = quantize(2, (1 << 63) - 1);
+	@["m-oceanview"] = quantize(8, 400000);
+}
+
+BEGIN
+{
+	@["n-judah"] = quantize(1, val);
+	@["n-judah"] = quantize(2, val);
+	@["n-judah"] = quantize(2, val);
+	@["n-judah"] = quantize(2);
+}
+
+BEGIN
+{
+	this->i = 1;
+	this->val = (1 << 63) - 1;
+
+	@["f-market"] = quantize(this->i, this->val);
+	this->i <<= 1;
+	this->val >>= 1;
+
+	@["f-market"] = quantize(this->i, this->val);
+	this->i <<= 1;
+	this->val >>= 1;
+
+	@["f-market"] = quantize(this->i, this->val);
+	this->i <<= 1;
+	this->val >>= 1;
+
+	@["f-market"] = quantize(this->i, this->val);
+	this->i <<= 1;
+	this->val >>= 1;
+}
+
+BEGIN
+{
+	this->i = 1;
+	this->val = (1 << 63) - 4;
+
+	@["s-castro"] = quantize(this->i, this->val);
+	this->i <<= 1;
+	this->val >>= 1;
+
+	@["s-castro"] = quantize(this->i, this->val);
+	this->i <<= 1;
+	this->val >>= 1;
+
+	@["s-castro"] = quantize(this->i, this->val);
+	this->i <<= 1;
+	this->val >>= 1;
+
+	@["s-castro"] = quantize(this->i, this->val);
+	this->i <<= 1;
+	this->val >>= 1;
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negquant.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negquant.d.out
new file mode 100644
index 0000000..f8466b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negquant.d.out
@@ -0,0 +1,55 @@
+
+  k-ingleside                                       
+           value  ------------- Distribution ------------- count    
+               0                                         | 0        
+               1 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -123     
+               2                                         | 0        
+
+  j-church                                          
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+  l-taraval                                         
+           value  ------------- Distribution ------------- count    
+              -2                     |                     0        
+              -1                @@@@@|                     -123     
+               0                @@@@@|                     -123     
+               1                     |@@@@@@@@@@           246      
+               2                     |                     0        
+
+  n-judah                                           
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@                            123      
+               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              247      
+               4 |                                         0        
+
+  m-oceanview                                       
+           value  ------------- Distribution ------------- count    
+               0                     |                     0        
+               1           @@@@@@@@@@|                     -9223372036854775808
+               2                     |@@@@@@@@@@           9223372036854775807
+               4                     |                     0        
+               8                     |                     400000   
+              16                     |                     0        
+
+  s-castro                                          
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@                    9223372036854775804
+               2 |@@@@@@@@@@@                              4611686018427387902
+               4 |@@@@@                                    2305843009213693951
+               8 |@@@                                      1152921504606846975
+              16 |                                         0        
+
+  f-market                                          
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@                    9223372036854775807
+               2 |@@@@@@@@@@@                              4611686018427387903
+               4 |@@@@@                                    2305843009213693951
+               8 |@@@                                      1152921504606846975
+              16 |                                         0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtrunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtrunc.d
new file mode 100644
index 0000000..f90eae1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtrunc.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+int i;
+
+tick-10ms
+/i < 100/
+{
+	@[i] = sum(i);
+	i++;
+}
+
+tick-10ms
+/i == 100/
+{
+	exit(0);
+}
+
+END
+{
+	trunc(@, -10);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtrunc.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtrunc.d.out
new file mode 100644
index 0000000..c1b07a6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtrunc.d.out
@@ -0,0 +1,11 @@
+
+        0                0
+        1                1
+        2                2
+        3                3
+        4                4
+        5                5
+        6                6
+        7                7
+        8                8
+        9                9
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtruncquant.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtruncquant.d
new file mode 100644
index 0000000..2a13d65
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtruncquant.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+int i;
+
+tick-10ms
+/i < 100/
+{
+	@[i] = lquantize(i, 0, 150);
+	@[i] = lquantize(i + 1, 0, 150);
+	@[i] = lquantize(i + 2, 0, 150);
+	@[i] = lquantize(i + 3, 0, 150);
+	i++;
+}
+
+tick-10ms
+/i == 100/
+{
+	exit(0);
+}
+
+END
+{
+	trunc(@, -5);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtruncquant.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtruncquant.d.out
new file mode 100644
index 0000000..264aa39
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.negtruncquant.d.out
@@ -0,0 +1,46 @@
+
+        0
+           value  ------------- Distribution ------------- count    
+             < 0 |                                         0        
+               0 |@@@@@@@@@@                               1        
+               1 |@@@@@@@@@@                               1        
+               2 |@@@@@@@@@@                               1        
+               3 |@@@@@@@@@@                               1        
+               4 |                                         0        
+
+        1
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@                               1        
+               2 |@@@@@@@@@@                               1        
+               3 |@@@@@@@@@@                               1        
+               4 |@@@@@@@@@@                               1        
+               5 |                                         0        
+
+        2
+           value  ------------- Distribution ------------- count    
+               1 |                                         0        
+               2 |@@@@@@@@@@                               1        
+               3 |@@@@@@@@@@                               1        
+               4 |@@@@@@@@@@                               1        
+               5 |@@@@@@@@@@                               1        
+               6 |                                         0        
+
+        3
+           value  ------------- Distribution ------------- count    
+               2 |                                         0        
+               3 |@@@@@@@@@@                               1        
+               4 |@@@@@@@@@@                               1        
+               5 |@@@@@@@@@@                               1        
+               6 |@@@@@@@@@@                               1        
+               7 |                                         0        
+
+        4
+           value  ------------- Distribution ------------- count    
+               3 |                                         0        
+               4 |@@@@@@@@@@                               1        
+               5 |@@@@@@@@@@                               1        
+               6 |@@@@@@@@@@                               1        
+               7 |@@@@@@@@@@                               1        
+               8 |                                         0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.normalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.normalize.d
new file mode 100644
index 0000000..0bcc0fe
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.normalize.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for normalization()
+ *
+ * SECTION: Aggregations/Normalization
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=50ms
+
+BEGIN
+{
+	i = 0;
+	start = timestamp;
+}
+
+tick-100ms
+/i < 20/
+{
+	@func[i % 5] = sum(i * 100);
+	i++;
+}
+
+tick-100ms
+/i == 20/
+{
+	printf("normalized data:\n");
+	normalize(@func, 5);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.normalize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.normalize.d.out
new file mode 100644
index 0000000..11193e6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.normalize.d.out
@@ -0,0 +1,7 @@
+normalized data:
+
+        0              600
+        1              680
+        2              760
+        3              840
+        4              920
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.order.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.order.d
new file mode 100644
index 0000000..1390011
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.order.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@[8] = sum(1);
+	@[6] = sum(1);
+	@[7] = sum(1);
+	@[5] = sum(1);
+	@[3] = sum(1);
+	@[0] = sum(1);
+	@[9] = sum(1);
+
+	@tour["Ghent"] = sum(1);
+	@tour["Berlin"] = sum(1);
+	@tour["London"] = sum(1);
+	@tour["Dublin"] = sum(1);
+	@tour["Shanghai"] = sum(1);
+	@tour["Zurich"] = sum(1);
+	@tour["Regina"] = sum(1);
+	@tour["Winnipeg"] = sum(1);
+	@tour["Edmonton"] = sum(1);
+	@tour["Calgary"] = sum(1);
+
+	@ate[8, "Rice"] = sum(1);
+	@ate[8, "Oatmeal"] = sum(1);
+	@ate[8, "Barley"] = sum(1);
+	@ate[8, "Carrots"] = sum(1);
+	@ate[8, "Sweet potato"] = sum(1);
+	@ate[8, "Asparagus"] = sum(1);
+	@ate[8, "Squash"] = sum(1);
+
+	@chars['a'] = sum(1);
+	@chars['s'] = sum(1);
+	@chars['d'] = sum(1);
+	@chars['f'] = sum(1);
+
+	printa("%d\n", @);
+	printf("\n");
+
+	printa("%s\n", @tour);
+	printf("\n");
+
+	printa("%d %s\n", @ate);
+	printf("\n");
+
+	printa("%c\n", @chars);
+	printf("\n");
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.order.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.order.d.out
new file mode 100644
index 0000000..505b0f3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.order.d.out
@@ -0,0 +1,33 @@
+0
+3
+5
+6
+7
+8
+9
+
+Berlin
+Calgary
+Dublin
+Edmonton
+Ghent
+London
+Regina
+Shanghai
+Winnipeg
+Zurich
+
+8 Asparagus
+8 Barley
+8 Carrots
+8 Oatmeal
+8 Rice
+8 Squash
+8 Sweet potato
+
+a
+d
+f
+s
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantize.d
new file mode 100644
index 0000000..fad472a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantize.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive quantize() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is verifiable simple positive test of the quantize() function.
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a[i] = quantize(i);
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantize.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantize.d.out
new file mode 100644
index 0000000..f4882ed
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantize.d.out
@@ -0,0 +1,61 @@
+
+        0
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               1 |                                         0        
+
+      100
+           value  ------------- Distribution ------------- count    
+              32 |                                         0        
+              64 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             128 |                                         0        
+
+      200
+           value  ------------- Distribution ------------- count    
+              64 |                                         0        
+             128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             256 |                                         0        
+
+      300
+           value  ------------- Distribution ------------- count    
+             128 |                                         0        
+             256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             512 |                                         0        
+
+      400
+           value  ------------- Distribution ------------- count    
+             128 |                                         0        
+             256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             512 |                                         0        
+
+      500
+           value  ------------- Distribution ------------- count    
+             128 |                                         0        
+             256 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+             512 |                                         0        
+
+      600
+           value  ------------- Distribution ------------- count    
+             256 |                                         0        
+             512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+            1024 |                                         0        
+
+      700
+           value  ------------- Distribution ------------- count    
+             256 |                                         0        
+             512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+            1024 |                                         0        
+
+      800
+           value  ------------- Distribution ------------- count    
+             256 |                                         0        
+             512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+            1024 |                                         0        
+
+      900
+           value  ------------- Distribution ------------- count    
+             256 |                                         0        
+             512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+            1024 |                                         0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantmany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantmany.d
new file mode 100644
index 0000000..e547b1e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantmany.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+int64_t val, shift;
+
+tick-1ms
+/val == 0/
+{
+	val = -(1 << shift);
+	shift++;
+}
+
+tick-1ms
+/shift == 32/
+{
+	exit(0);
+}
+
+tick-1ms
+/val == -1/
+{
+	val = (1 << shift);
+}
+
+tick-1ms
+{
+	@[shift] = quantize(val, val);
+	val >>= 1;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantmany.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantmany.d.out
new file mode 100644
index 0000000..45df249
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantmany.d.out
@@ -0,0 +1,1208 @@
+
+                1
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@                            1        
+               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@              2        
+               4 |                                         0        
+
+                2
+           value  ------------- Distribution ------------- count    
+              -4                     |                     0        
+              -2                 @@@@|                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |@@                   1        
+               2                     |@@@@                 2        
+               4                     |@@@@@@@@@            4        
+               8                     |                     0        
+
+                3
+           value  ------------- Distribution ------------- count    
+              -8                     |                     0        
+              -4                 @@@@|                     -4       
+              -2                   @@|                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |@                    1        
+               2                     |@@                   2        
+               4                     |@@@@                 4        
+               8                     |@@@@@@@@             8        
+              16                     |                     0        
+
+                4
+           value  ------------- Distribution ------------- count    
+             -16                     |                     0        
+              -8                 @@@@|                     -8       
+              -4                   @@|                     -4       
+              -2                    @|                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |@                    2        
+               4                     |@@                   4        
+               8                     |@@@@                 8        
+              16                     |@@@@@@@              16       
+              32                     |                     0        
+
+                5
+           value  ------------- Distribution ------------- count    
+             -32                     |                     0        
+             -16                  @@@|                     -16      
+              -8                   @@|                     -8       
+              -4                    @|                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |@                    4        
+               8                     |@@                   8        
+              16                     |@@@                  16       
+              32                     |@@@@@@@              32       
+              64                     |                     0        
+
+                6
+           value  ------------- Distribution ------------- count    
+             -64                     |                     0        
+             -32                  @@@|                     -32      
+             -16                   @@|                     -16      
+              -8                    @|                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |@                    8        
+              16                     |@@                   16       
+              32                     |@@@                  32       
+              64                     |@@@@@@@              64       
+             128                     |                     0        
+
+                7
+           value  ------------- Distribution ------------- count    
+            -128                     |                     0        
+             -64                  @@@|                     -64      
+             -32                   @@|                     -32      
+             -16                    @|                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |@                    16       
+              32                     |@@                   32       
+              64                     |@@@                  64       
+             128                     |@@@@@@@              128      
+             256                     |                     0        
+
+                8
+           value  ------------- Distribution ------------- count    
+            -256                     |                     0        
+            -128                  @@@|                     -128     
+             -64                   @@|                     -64      
+             -32                    @|                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |@                    32       
+              64                     |@@                   64       
+             128                     |@@@                  128      
+             256                     |@@@@@@@              256      
+             512                     |                     0        
+
+                9
+           value  ------------- Distribution ------------- count    
+            -512                     |                     0        
+            -256                  @@@|                     -256     
+            -128                   @@|                     -128     
+             -64                    @|                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |@                    64       
+             128                     |@@                   128      
+             256                     |@@@                  256      
+             512                     |@@@@@@@              512      
+            1024                     |                     0        
+
+               10
+           value  ------------- Distribution ------------- count    
+           -1024                     |                     0        
+            -512                  @@@|                     -512     
+            -256                   @@|                     -256     
+            -128                    @|                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |@                    128      
+             256                     |@@                   256      
+             512                     |@@@                  512      
+            1024                     |@@@@@@@              1024     
+            2048                     |                     0        
+
+               11
+           value  ------------- Distribution ------------- count    
+           -2048                     |                     0        
+           -1024                  @@@|                     -1024    
+            -512                   @@|                     -512     
+            -256                    @|                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |@                    256      
+             512                     |@@                   512      
+            1024                     |@@@                  1024     
+            2048                     |@@@@@@@              2048     
+            4096                     |                     0        
+
+               12
+           value  ------------- Distribution ------------- count    
+           -4096                     |                     0        
+           -2048                  @@@|                     -2048    
+           -1024                   @@|                     -1024    
+            -512                    @|                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |@                    512      
+            1024                     |@@                   1024     
+            2048                     |@@@                  2048     
+            4096                     |@@@@@@@              4096     
+            8192                     |                     0        
+
+               13
+           value  ------------- Distribution ------------- count    
+           -8192                     |                     0        
+           -4096                  @@@|                     -4096    
+           -2048                   @@|                     -2048    
+           -1024                    @|                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |@                    1024     
+            2048                     |@@                   2048     
+            4096                     |@@@                  4096     
+            8192                     |@@@@@@@              8192     
+           16384                     |                     0        
+
+               14
+           value  ------------- Distribution ------------- count    
+          -16384                     |                     0        
+           -8192                  @@@|                     -8192    
+           -4096                   @@|                     -4096    
+           -2048                    @|                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |@                    2048     
+            4096                     |@@                   4096     
+            8192                     |@@@                  8192     
+           16384                     |@@@@@@@              16384    
+           32768                     |                     0        
+
+               15
+           value  ------------- Distribution ------------- count    
+          -32768                     |                     0        
+          -16384                  @@@|                     -16384   
+           -8192                   @@|                     -8192    
+           -4096                    @|                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |@                    4096     
+            8192                     |@@                   8192     
+           16384                     |@@@                  16384    
+           32768                     |@@@@@@@              32768    
+           65536                     |                     0        
+
+               16
+           value  ------------- Distribution ------------- count    
+          -65536                     |                     0        
+          -32768                  @@@|                     -32768   
+          -16384                   @@|                     -16384   
+           -8192                    @|                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |@                    8192     
+           16384                     |@@                   16384    
+           32768                     |@@@                  32768    
+           65536                     |@@@@@@@              65536    
+          131072                     |                     0        
+
+               17
+           value  ------------- Distribution ------------- count    
+         -131072                     |                     0        
+          -65536                  @@@|                     -65536   
+          -32768                   @@|                     -32768   
+          -16384                    @|                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |@                    16384    
+           32768                     |@@                   32768    
+           65536                     |@@@                  65536    
+          131072                     |@@@@@@@              131072   
+          262144                     |                     0        
+
+               18
+           value  ------------- Distribution ------------- count    
+         -262144                     |                     0        
+         -131072                  @@@|                     -131072  
+          -65536                   @@|                     -65536   
+          -32768                    @|                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |@                    32768    
+           65536                     |@@                   65536    
+          131072                     |@@@                  131072   
+          262144                     |@@@@@@@              262144   
+          524288                     |                     0        
+
+               19
+           value  ------------- Distribution ------------- count    
+         -524288                     |                     0        
+         -262144                  @@@|                     -262144  
+         -131072                   @@|                     -131072  
+          -65536                    @|                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |@                    65536    
+          131072                     |@@                   131072   
+          262144                     |@@@                  262144   
+          524288                     |@@@@@@@              524288   
+         1048576                     |                     0        
+
+               20
+           value  ------------- Distribution ------------- count    
+        -1048576                     |                     0        
+         -524288                  @@@|                     -524288  
+         -262144                   @@|                     -262144  
+         -131072                    @|                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |@                    131072   
+          262144                     |@@                   262144   
+          524288                     |@@@                  524288   
+         1048576                     |@@@@@@@              1048576  
+         2097152                     |                     0        
+
+               21
+           value  ------------- Distribution ------------- count    
+        -2097152                     |                     0        
+        -1048576                  @@@|                     -1048576 
+         -524288                   @@|                     -524288  
+         -262144                    @|                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |@                    262144   
+          524288                     |@@                   524288   
+         1048576                     |@@@                  1048576  
+         2097152                     |@@@@@@@              2097152  
+         4194304                     |                     0        
+
+               22
+           value  ------------- Distribution ------------- count    
+        -4194304                     |                     0        
+        -2097152                  @@@|                     -2097152 
+        -1048576                   @@|                     -1048576 
+         -524288                    @|                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |@                    524288   
+         1048576                     |@@                   1048576  
+         2097152                     |@@@                  2097152  
+         4194304                     |@@@@@@@              4194304  
+         8388608                     |                     0        
+
+               23
+           value  ------------- Distribution ------------- count    
+        -8388608                     |                     0        
+        -4194304                  @@@|                     -4194304 
+        -2097152                   @@|                     -2097152 
+        -1048576                    @|                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |@                    1048576  
+         2097152                     |@@                   2097152  
+         4194304                     |@@@                  4194304  
+         8388608                     |@@@@@@@              8388608  
+        16777216                     |                     0        
+
+               24
+           value  ------------- Distribution ------------- count    
+       -16777216                     |                     0        
+        -8388608                  @@@|                     -8388608 
+        -4194304                   @@|                     -4194304 
+        -2097152                    @|                     -2097152 
+        -1048576                     |                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |                     1048576  
+         2097152                     |@                    2097152  
+         4194304                     |@@                   4194304  
+         8388608                     |@@@                  8388608  
+        16777216                     |@@@@@@@              16777216 
+        33554432                     |                     0        
+
+               25
+           value  ------------- Distribution ------------- count    
+       -33554432                     |                     0        
+       -16777216                  @@@|                     -16777216
+        -8388608                   @@|                     -8388608 
+        -4194304                    @|                     -4194304 
+        -2097152                     |                     -2097152 
+        -1048576                     |                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |                     1048576  
+         2097152                     |                     2097152  
+         4194304                     |@                    4194304  
+         8388608                     |@@                   8388608  
+        16777216                     |@@@                  16777216 
+        33554432                     |@@@@@@@              33554432 
+        67108864                     |                     0        
+
+               26
+           value  ------------- Distribution ------------- count    
+       -67108864                     |                     0        
+       -33554432                  @@@|                     -33554432
+       -16777216                   @@|                     -16777216
+        -8388608                    @|                     -8388608 
+        -4194304                     |                     -4194304 
+        -2097152                     |                     -2097152 
+        -1048576                     |                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |                     1048576  
+         2097152                     |                     2097152  
+         4194304                     |                     4194304  
+         8388608                     |@                    8388608  
+        16777216                     |@@                   16777216 
+        33554432                     |@@@                  33554432 
+        67108864                     |@@@@@@@              67108864 
+       134217728                     |                     0        
+
+               27
+           value  ------------- Distribution ------------- count    
+      -134217728                     |                     0        
+       -67108864                  @@@|                     -67108864
+       -33554432                   @@|                     -33554432
+       -16777216                    @|                     -16777216
+        -8388608                     |                     -8388608 
+        -4194304                     |                     -4194304 
+        -2097152                     |                     -2097152 
+        -1048576                     |                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |                     1048576  
+         2097152                     |                     2097152  
+         4194304                     |                     4194304  
+         8388608                     |                     8388608  
+        16777216                     |@                    16777216 
+        33554432                     |@@                   33554432 
+        67108864                     |@@@                  67108864 
+       134217728                     |@@@@@@@              134217728
+       268435456                     |                     0        
+
+               28
+           value  ------------- Distribution ------------- count    
+      -268435456                     |                     0        
+      -134217728                  @@@|                     -134217728
+       -67108864                   @@|                     -67108864
+       -33554432                    @|                     -33554432
+       -16777216                     |                     -16777216
+        -8388608                     |                     -8388608 
+        -4194304                     |                     -4194304 
+        -2097152                     |                     -2097152 
+        -1048576                     |                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |                     1048576  
+         2097152                     |                     2097152  
+         4194304                     |                     4194304  
+         8388608                     |                     8388608  
+        16777216                     |                     16777216 
+        33554432                     |@                    33554432 
+        67108864                     |@@                   67108864 
+       134217728                     |@@@                  134217728
+       268435456                     |@@@@@@@              268435456
+       536870912                     |                     0        
+
+               29
+           value  ------------- Distribution ------------- count    
+      -536870912                     |                     0        
+      -268435456                  @@@|                     -268435456
+      -134217728                   @@|                     -134217728
+       -67108864                    @|                     -67108864
+       -33554432                     |                     -33554432
+       -16777216                     |                     -16777216
+        -8388608                     |                     -8388608 
+        -4194304                     |                     -4194304 
+        -2097152                     |                     -2097152 
+        -1048576                     |                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |                     1048576  
+         2097152                     |                     2097152  
+         4194304                     |                     4194304  
+         8388608                     |                     8388608  
+        16777216                     |                     16777216 
+        33554432                     |                     33554432 
+        67108864                     |@                    67108864 
+       134217728                     |@@                   134217728
+       268435456                     |@@@                  268435456
+       536870912                     |@@@@@@@              536870912
+      1073741824                     |                     0        
+
+               30
+           value  ------------- Distribution ------------- count    
+     -1073741824                     |                     0        
+      -536870912                  @@@|                     -536870912
+      -268435456                   @@|                     -268435456
+      -134217728                    @|                     -134217728
+       -67108864                     |                     -67108864
+       -33554432                     |                     -33554432
+       -16777216                     |                     -16777216
+        -8388608                     |                     -8388608 
+        -4194304                     |                     -4194304 
+        -2097152                     |                     -2097152 
+        -1048576                     |                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |                     1048576  
+         2097152                     |                     2097152  
+         4194304                     |                     4194304  
+         8388608                     |                     8388608  
+        16777216                     |                     16777216 
+        33554432                     |                     33554432 
+        67108864                     |                     67108864 
+       134217728                     |@                    134217728
+       268435456                     |@@                   268435456
+       536870912                     |@@@                  536870912
+      1073741824                     |@@@@@@@              1073741824
+      2147483648                     |                     0        
+
+               31
+           value  ------------- Distribution ------------- count    
+     -2147483648                     |                     0        
+     -1073741824                  @@@|                     -1073741824
+      -536870912                   @@|                     -536870912
+      -268435456                    @|                     -268435456
+      -134217728                     |                     -134217728
+       -67108864                     |                     -67108864
+       -33554432                     |                     -33554432
+       -16777216                     |                     -16777216
+        -8388608                     |                     -8388608 
+        -4194304                     |                     -4194304 
+        -2097152                     |                     -2097152 
+        -1048576                     |                     -1048576 
+         -524288                     |                     -524288  
+         -262144                     |                     -262144  
+         -131072                     |                     -131072  
+          -65536                     |                     -65536   
+          -32768                     |                     -32768   
+          -16384                     |                     -16384   
+           -8192                     |                     -8192    
+           -4096                     |                     -4096    
+           -2048                     |                     -2048    
+           -1024                     |                     -1024    
+            -512                     |                     -512     
+            -256                     |                     -256     
+            -128                     |                     -128     
+             -64                     |                     -64      
+             -32                     |                     -32      
+             -16                     |                     -16      
+              -8                     |                     -8       
+              -4                     |                     -4       
+              -2                     |                     -2       
+              -1                     |                     0        
+               0                     |                     0        
+               1                     |                     1        
+               2                     |                     2        
+               4                     |                     4        
+               8                     |                     8        
+              16                     |                     16       
+              32                     |                     32       
+              64                     |                     64       
+             128                     |                     128      
+             256                     |                     256      
+             512                     |                     512      
+            1024                     |                     1024     
+            2048                     |                     2048     
+            4096                     |                     4096     
+            8192                     |                     8192     
+           16384                     |                     16384    
+           32768                     |                     32768    
+           65536                     |                     65536    
+          131072                     |                     131072   
+          262144                     |                     262144   
+          524288                     |                     524288   
+         1048576                     |                     1048576  
+         2097152                     |                     2097152  
+         4194304                     |                     4194304  
+         8388608                     |                     8388608  
+        16777216                     |                     16777216 
+        33554432                     |                     33554432 
+        67108864                     |                     67108864 
+       134217728                     |                     134217728
+       268435456                     |@                    268435456
+       536870912                     |@@                   536870912
+      1073741824                     |@@@                  1073741824
+      2147483648                     |@@@@@@@              2147483648
+      4294967296                     |                     0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantround.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantround.d
new file mode 100644
index 0000000..c40d69c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantround.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+/*
+ * This test verifies that the height of the ASCII quantization bars is
+ * determined using rounding and not truncated integer arithmetic.
+ */
+tick-10ms
+/i++ >= 27/
+{
+	exit(0);
+}
+
+tick-10ms
+/i > 8/
+{
+	@ = quantize(2);
+}
+
+tick-10ms
+/i > 2 && i <= 8/
+{
+	@ = quantize(1);
+}
+
+tick-10ms
+/i <= 2/
+{
+	@ = quantize(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantround.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantround.d.out
new file mode 100644
index 0000000..9b89ec1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantround.d.out
@@ -0,0 +1,9 @@
+
+
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@                                      2        
+               1 |@@@@@@@@@                                6        
+               2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@             19       
+               4 |                                         0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantzero.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantzero.d
new file mode 100644
index 0000000..bfa633c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantzero.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	a = 7;
+	b = 13;
+	val = (-a * b) + a;
+}
+
+tick-1ms
+{
+	incr = val % b;
+	val += a;
+}
+
+tick-1ms
+/val == 0/
+{
+	val += a;
+}
+
+tick-1ms
+/incr != 0/
+{
+	i++;
+	@[i] = quantize(0, incr);
+}
+
+tick-1ms
+/incr == 0/
+{
+	printa(@);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantzero.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantzero.d.out
new file mode 100644
index 0000000..c2c1cf0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.quantzero.d.out
@@ -0,0 +1,146 @@
+
+                2
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -12      
+               1                                         | 0        
+
+                4
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -11      
+               1                                         | 0        
+
+                6
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -10      
+               1                                         | 0        
+
+                8
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -9       
+               1                                         | 0        
+
+               10
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -8       
+               1                                         | 0        
+
+               12
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -7       
+               1                                         | 0        
+
+                1
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -6       
+               1                                         | 0        
+
+                3
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -5       
+               1                                         | 0        
+
+                5
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -4       
+               1                                         | 0        
+
+                7
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -3       
+               1                                         | 0        
+
+                9
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -2       
+               1                                         | 0        
+
+               11
+           value  ------------- Distribution ------------- count    
+              -1                                         | 0        
+               0 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| -1       
+               1                                         | 0        
+
+               14
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               1 |                                         0        
+
+               16
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 2        
+               1 |                                         0        
+
+               18
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3        
+               1 |                                         0        
+
+               20
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 4        
+               1 |                                         0        
+
+               22
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 5        
+               1 |                                         0        
+
+               24
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 6        
+               1 |                                         0        
+
+               13
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 7        
+               1 |                                         0        
+
+               15
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8        
+               1 |                                         0        
+
+               17
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 9        
+               1 |                                         0        
+
+               19
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 10       
+               1 |                                         0        
+
+               21
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 11       
+               1 |                                         0        
+
+               23
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 12       
+               1 |                                         0        
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signature.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signature.d
new file mode 100644
index 0000000..baa951a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signature.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * This is a simple test to make sure that signature checking works properly
+ * for the fake-o types.
+ */
+BEGIN
+{
+	@stk[ustack()] = count();
+	@symmy[sym(0)] = count();
+	@usymmy[usym(0)] = count();
+	@funky[func(0)] = count();
+	@ufunky[ufunc(0)] = count();
+	@moddy[mod(0)] = count();
+	@umoddy[umod(0)] = count();
+}
+
+BEGIN
+{
+	@stk[ustack()] = count();
+	@symmy[sym(0)] = count();
+	@usymmy[usym(0)] = count();
+	@funky[func(0)] = count();
+	@ufunky[ufunc(0)] = count();
+	@moddy[mod(0)] = count();
+	@umoddy[umod(0)] = count();
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeys.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeys.d
new file mode 100644
index 0000000..ed3d131
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeys.d
@@ -0,0 +1,120 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Signed integer keys print and sort as expected.
+ *
+ * SECTION: Aggregations, Printing Aggregations
+ *
+ * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32-
+ * and 64-bit integers as signed values. Since the Java DTrace API is
+ * expected to emulate this behavior, this test was added to ensure that
+ * the behavior is preserved. Consistency with trace() output is also
+ * tested.
+ */
+
+#pragma D option quiet
+#pragma D option aggsortkey
+
+BEGIN
+{
+	trace((char)-2);
+	trace("\n");
+	trace((char)-1);
+	trace("\n");
+	trace((char)0);
+	trace("\n");
+	trace((char)1);
+	trace("\n");
+	trace((char)2);
+	trace("\n");
+	trace("\n");
+
+	trace((short)-2);
+	trace("\n");
+	trace((short)-1);
+	trace("\n");
+	trace((short)0);
+	trace("\n");
+	trace((short)1);
+	trace("\n");
+	trace((short)2);
+	trace("\n");
+	trace("\n");
+
+	trace(-2);
+	trace("\n");
+	trace(-1);
+	trace("\n");
+	trace(0);
+	trace("\n");
+	trace(1);
+	trace("\n");
+	trace(2);
+	trace("\n");
+	trace("\n");
+
+	trace((long long)-2);
+	trace("\n");
+	trace((long long)-1);
+	trace("\n");
+	trace((long long)0);
+	trace("\n");
+	trace((long long)1);
+	trace("\n");
+	trace((long long)2);
+	trace("\n");
+
+	@i8[(char)-2] = sum(-2);
+	@i8[(char)-1] = sum(-1);
+	@i8[(char)0] = sum(0);
+	@i8[(char)1] = sum(1);
+	@i8[(char)2] = sum(2);
+
+	@i16[(short)-2] = sum(-2);
+	@i16[(short)-1] = sum(-1);
+	@i16[(short)0] = sum(0);
+	@i16[(short)1] = sum(1);
+	@i16[(short)2] = sum(2);
+
+	@i32[-2] = sum(-2);
+	@i32[-1] = sum(-1);
+	@i32[0] = sum(0);
+	@i32[1] = sum(1);
+	@i32[2] = sum(2);
+
+	@i64[(long long)-2] = sum(-2);
+	@i64[(long long)-1] = sum(-1);
+	@i64[(long long)0] = sum(0);
+	@i64[(long long)1] = sum(1);
+	@i64[(long long)2] = sum(2);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeys.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeys.d.out
new file mode 100644
index 0000000..42e619e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeys.d.out
@@ -0,0 +1,44 @@
+254
+255
+0
+1
+2
+
+65534
+65535
+0
+1
+2
+
+-2
+-1
+0
+1
+2
+
+-2
+-1
+0
+1
+2
+
+   0                0
+   1                1
+   2                2
+ 254               -2
+ 255               -1
+     0                0
+     1                1
+     2                2
+ 65534               -2
+ 65535               -1
+        0                0
+        1                1
+        2                2
+       -2               -2
+       -1               -1
+                0                0
+                1                1
+                2                2
+               -2               -2
+               -1               -1
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeyspos.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeyspos.d
new file mode 100644
index 0000000..5836c6a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeyspos.d
@@ -0,0 +1,115 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Signed integer keys print and sort as expected using the
+ * 	aggsortkeypos and aggsortrev options
+ *
+ * SECTION: Aggregations, Printing Aggregations
+ *
+ * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32-
+ * and 64-bit integers as signed values. Since the Java DTrace API is
+ * expected to emulate this behavior, this test was added to ensure that
+ * the behavior is preserved.
+ */
+
+#pragma D option quiet
+#pragma D option aggsortkey
+#pragma D option aggsortkeypos=1
+#pragma D option aggsortrev
+
+BEGIN
+{
+	@i8["cat", (char)-2] = sum(-2);
+	@i8["dog", (char)-2] = sum(-22);
+	@i8["mouse", (char)-2] = sum(-222);
+	@i8["cat", (char)-1] = sum(-1);
+	@i8["dog", (char)-1] = sum(-11);
+	@i8["mouse", (char)-1] = sum(-111);
+	@i8["cat", (char)0] = sum(0);
+	@i8["dog", (char)0] = sum(10);
+	@i8["mouse", (char)0] = sum(100);
+	@i8["cat", (char)1] = sum(1);
+	@i8["dog", (char)1] = sum(11);
+	@i8["mouse", (char)1] = sum(111);
+	@i8["cat", (char)2] = sum(2);
+	@i8["dog", (char)2] = sum(22);
+	@i8["mouse", (char)2] = sum(222);
+
+	@i16["mouse", (short)-2] = sum(-2);
+	@i16["dog", (short)-2] = sum(-22);
+	@i16["cat", (short)-2] = sum(-222);
+	@i16["mouse", (short)-1] = sum(-1);
+	@i16["dog", (short)-1] = sum(-11);
+	@i16["cat", (short)-1] = sum(-111);
+	@i16["mouse", (short)0] = sum(0);
+	@i16["dog", (short)0] = sum(10);
+	@i16["cat", (short)0] = sum(100);
+	@i16["mouse", (short)1] = sum(1);
+	@i16["dog", (short)1] = sum(11);
+	@i16["cat", (short)1] = sum(111);
+	@i16["mouse", (short)2] = sum(2);
+	@i16["dog", (short)2] = sum(22);
+	@i16["cat", (short)2] = sum(222);
+
+	@i32["mouse", -2] = sum(-2);
+	@i32["bear", -2] = sum(-22);
+	@i32["cat", -2] = sum(-222);
+	@i32["mouse", -1] = sum(-1);
+	@i32["bear", -1] = sum(-11);
+	@i32["cat", -1] = sum(-111);
+	@i32["mouse", 0] = sum(0);
+	@i32["bear", 0] = sum(10);
+	@i32["cat", 0] = sum(100);
+	@i32["mouse", 1] = sum(1);
+	@i32["bear", 1] = sum(11);
+	@i32["cat", 1] = sum(111);
+	@i32["mouse", 2] = sum(2);
+	@i32["bear", 2] = sum(22);
+	@i32["cat", 2] = sum(222);
+
+	@i64["cat", (long long)-2] = sum(-2);
+	@i64["bear", (long long)-2] = sum(-22);
+	@i64["dog", (long long)-2] = sum(-222);
+	@i64["cat", (long long)-1] = sum(-1);
+	@i64["bear", (long long)-1] = sum(-11);
+	@i64["dog", (long long)-1] = sum(-111);
+	@i64["cat", (long long)0] = sum(0);
+	@i64["bear", (long long)0] = sum(10);
+	@i64["dog", (long long)0] = sum(100);
+	@i64["cat", (long long)1] = sum(1);
+	@i64["bear", (long long)1] = sum(11);
+	@i64["dog", (long long)1] = sum(111);
+	@i64["cat", (long long)2] = sum(2);
+	@i64["bear", (long long)2] = sum(22);
+	@i64["dog", (long long)2] = sum(222);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeyspos.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeyspos.d.out
new file mode 100644
index 0000000..28e95ac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.signedkeyspos.d.out
@@ -0,0 +1,61 @@
+
+  dog                                                              -1             -111
+  cat                                                              -1               -1
+  bear                                                             -1              -11
+  dog                                                              -2             -222
+  cat                                                              -2               -2
+  bear                                                             -2              -22
+  dog                                                               2              222
+  cat                                                               2                2
+  bear                                                              2               22
+  dog                                                               1              111
+  cat                                                               1                1
+  bear                                                              1               11
+  dog                                                               0              100
+  cat                                                               0                0
+  bear                                                              0               10
+  mouse                                                    -1               -1
+  cat                                                      -1             -111
+  bear                                                     -1              -11
+  mouse                                                    -2               -2
+  cat                                                      -2             -222
+  bear                                                     -2              -22
+  mouse                                                     2                2
+  cat                                                       2              222
+  bear                                                      2               22
+  mouse                                                     1                1
+  cat                                                       1              111
+  bear                                                      1               11
+  mouse                                                     0                0
+  cat                                                       0              100
+  bear                                                      0               10
+  mouse                                              65535               -1
+  dog                                                65535              -11
+  cat                                                65535             -111
+  mouse                                              65534               -2
+  dog                                                65534              -22
+  cat                                                65534             -222
+  mouse                                                  2                2
+  dog                                                    2               22
+  cat                                                    2              222
+  mouse                                                  1                1
+  dog                                                    1               11
+  cat                                                    1              111
+  mouse                                                  0                0
+  dog                                                    0               10
+  cat                                                    0              100
+  mouse                                              255             -111
+  dog                                                255              -11
+  cat                                                255               -1
+  mouse                                              254             -222
+  dog                                                254              -22
+  cat                                                254               -2
+  mouse                                                2              222
+  dog                                                  2               22
+  cat                                                  2                2
+  mouse                                                1              111
+  dog                                                  1               11
+  cat                                                  1                1
+  mouse                                                0              100
+  dog                                                  0               10
+  cat                                                  0                0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.stddev.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.stddev.d
new file mode 100644
index 0000000..041b820
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.stddev.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     Positive stddev() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is a simple verifiable positive test of the stddev() function.
+ *     printa() for one aggregation, default printing behavior for the other
+ *     so that we exercise both code paths.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a = stddev(5000000000);
+	@a = stddev(5000000100);
+	@a = stddev(5000000200);
+	@a = stddev(5000000300);
+	@a = stddev(5000000400);
+	@a = stddev(5000000500);
+	@a = stddev(5000000600);
+	@a = stddev(5000000700);
+	@a = stddev(5000000800);
+	@a = stddev(5000000900);
+	@b = stddev(-5000000000);
+	@b = stddev(-5000000100);
+	@b = stddev(-5000000200);
+	@b = stddev(-5000000300);
+	@b = stddev(-5000000400);
+	@b = stddev(-5000000500);
+	@b = stddev(-5000000600);
+	@b = stddev(-5000000700);
+	@b = stddev(-5000000800);
+	@b = stddev(-5000000900);
+	printa("%@d\n", @a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out
new file mode 100644
index 0000000..0c02852
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.stddev.d.out
@@ -0,0 +1,3 @@
+287
+
+              287
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.subr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.subr.d
new file mode 100644
index 0000000..5ca1f1e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.subr.d
@@ -0,0 +1,112 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/dtrace.h>
+
+#define INTFUNC(x)			\
+	BEGIN				\
+	/*DSTYLED*/			\
+	{				\
+		subr++;			\
+		@[(long)x] = sum(1);	\
+	/*DSTYLED*/			\
+	}
+
+#define STRFUNC(x)			\
+	BEGIN				\
+	/*DSTYLED*/			\
+	{				\
+		subr++;			\
+		@str[x] = sum(1);	\
+	/*DSTYLED*/			\
+	}
+
+#define VOIDFUNC(x)			\
+	BEGIN				\
+	/*DSTYLED*/			\
+	{				\
+		subr++;			\
+	/*DSTYLED*/			\
+	}
+
+INTFUNC(rand())
+INTFUNC(mutex_owned(&`cpu_lock))
+INTFUNC(mutex_owner(&`cpu_lock))
+INTFUNC(mutex_type_adaptive(&`cpu_lock))
+INTFUNC(mutex_type_spin(&`cpu_lock))
+INTFUNC(rw_read_held(&`vfssw_lock))
+INTFUNC(rw_write_held(&`vfssw_lock))
+INTFUNC(rw_iswriter(&`vfssw_lock))
+INTFUNC(copyin(NULL, 1))
+STRFUNC(copyinstr(NULL, 1))
+INTFUNC(speculation())
+INTFUNC(progenyof($pid))
+INTFUNC(strlen("fooey"))
+VOIDFUNC(copyout)
+VOIDFUNC(copyoutstr)
+INTFUNC(alloca(10))
+VOIDFUNC(bcopy)
+VOIDFUNC(copyinto)
+INTFUNC(msgdsize(NULL))
+INTFUNC(msgsize(NULL))
+INTFUNC(getmajor(0))
+INTFUNC(getminor(0))
+STRFUNC(ddi_pathname(NULL, 0))
+STRFUNC(strjoin("foo", "bar"))
+STRFUNC(lltostr(12373))
+STRFUNC(basename("/var/crash/systemtap"))
+STRFUNC(dirname("/var/crash/systemtap"))
+STRFUNC(cleanpath("/var/crash/systemtap"))
+STRFUNC(strchr("The SystemTap, The.", 't'))
+STRFUNC(strrchr("The SystemTap, The.", 't'))
+STRFUNC(strstr("The SystemTap, The.", "The"))
+STRFUNC(strtok("The SystemTap, The.", "T"))
+STRFUNC(substr("The SystemTap, The.", 0))
+INTFUNC(index("The SystemTap, The.", "The"))
+INTFUNC(rindex("The SystemTap, The.", "The"))
+INTFUNC(htons(0x1234))
+INTFUNC(htonl(0x12345678))
+INTFUNC(htonll(0x1234567890abcdefL))
+INTFUNC(ntohs(0x1234))
+INTFUNC(ntohl(0x12345678))
+INTFUNC(ntohll(0x1234567890abcdefL))
+STRFUNC(inet_ntoa((ipaddr_t *)alloca(sizeof (ipaddr_t))))
+STRFUNC(inet_ntoa6((in6_addr_t *)alloca(sizeof (in6_addr_t))))
+STRFUNC(inet_ntop(AF_INET, (void *)alloca(sizeof (ipaddr_t))))
+
+BEGIN
+/subr == DIF_SUBR_MAX + 1/
+{
+	exit(0);
+}
+
+BEGIN
+{
+	printf("found %d subroutines, expected %d\n", subr, DIF_SUBR_MAX + 1);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.sum.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.sum.d
new file mode 100644
index 0000000..1b9025a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.sum.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Positive sum() test
+ *
+ * SECTION: Aggregations/Aggregations
+ *
+ * NOTES: This is verifiable simple positive test of the sum() function.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 1000/
+{
+	@a = sum(i);
+	i += 100;
+}
+
+tick-10ms
+/i == 1000/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.sum.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.sum.d.out
new file mode 100644
index 0000000..5d8b37b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.sum.d.out
@@ -0,0 +1,2 @@
+
+             4500
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc.d
new file mode 100644
index 0000000..d1c1b3c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+int i;
+
+tick-10ms
+/i < 100/
+{
+	@[i] = sum(i);
+	i++;
+}
+
+tick-10ms
+/i == 100/
+{
+	exit(0);
+}
+
+END
+{
+	trunc(@, 10);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc.d.out
new file mode 100644
index 0000000..2e18ef8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc.d.out
@@ -0,0 +1,11 @@
+
+       90               90
+       91               91
+       92               92
+       93               93
+       94               94
+       95               95
+       96               96
+       97               97
+       98               98
+       99               99
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc0.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc0.d
new file mode 100644
index 0000000..5c31069
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc0.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+#pragma D option aggrate=1ms
+#pragma D option switchrate=50ms
+
+int i;
+
+tick-100ms
+/i < 10/
+{
+	@[i] = sum(10 - i);
+	i++;
+}
+
+tick-100ms
+/i == 5/
+{
+	trunc(@);
+}
+
+tick-100ms
+/i == 10/
+{
+	exit(0);
+}
+
+END
+{
+	printa(@);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc0.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc0.d.out
new file mode 100644
index 0000000..70dc7a0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.trunc0.d.out
@@ -0,0 +1,7 @@
+
+        9                1
+        8                2
+        7                3
+        6                4
+        5                5
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.truncquant.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.truncquant.d
new file mode 100644
index 0000000..8baa56a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.truncquant.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+int i;
+
+tick-10ms
+/i < 100/
+{
+	@[i] = lquantize(i, 0, 150);
+	@[i] = lquantize(i + 1, 0, 150);
+	@[i] = lquantize(i + 2, 0, 150);
+	@[i] = lquantize(i + 3, 0, 150);
+	i++;
+}
+
+tick-10ms
+/i == 100/
+{
+	exit(0);
+}
+
+END
+{
+	trunc(@, 5);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.truncquant.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.truncquant.d.out
new file mode 100644
index 0000000..86975af
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.truncquant.d.out
@@ -0,0 +1,46 @@
+
+       95
+           value  ------------- Distribution ------------- count    
+              94 |                                         0        
+              95 |@@@@@@@@@@                               1        
+              96 |@@@@@@@@@@                               1        
+              97 |@@@@@@@@@@                               1        
+              98 |@@@@@@@@@@                               1        
+              99 |                                         0        
+
+       96
+           value  ------------- Distribution ------------- count    
+              95 |                                         0        
+              96 |@@@@@@@@@@                               1        
+              97 |@@@@@@@@@@                               1        
+              98 |@@@@@@@@@@                               1        
+              99 |@@@@@@@@@@                               1        
+             100 |                                         0        
+
+       97
+           value  ------------- Distribution ------------- count    
+              96 |                                         0        
+              97 |@@@@@@@@@@                               1        
+              98 |@@@@@@@@@@                               1        
+              99 |@@@@@@@@@@                               1        
+             100 |@@@@@@@@@@                               1        
+             101 |                                         0        
+
+       98
+           value  ------------- Distribution ------------- count    
+              97 |                                         0        
+              98 |@@@@@@@@@@                               1        
+              99 |@@@@@@@@@@                               1        
+             100 |@@@@@@@@@@                               1        
+             101 |@@@@@@@@@@                               1        
+             102 |                                         0        
+
+       99
+           value  ------------- Distribution ------------- count    
+              98 |                                         0        
+              99 |@@@@@@@@@@                               1        
+             100 |@@@@@@@@@@                               1        
+             101 |@@@@@@@@@@                               1        
+             102 |@@@@@@@@@@                               1        
+             103 |                                         0        
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.valsortkeypos.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.valsortkeypos.d
new file mode 100644
index 0000000..ec0bee3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.valsortkeypos.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	aggsortkeypos option works when sorting by values, values are
+ * 	equal, and keys are compared to break the tie
+ *
+ * SECTION: Aggregations, Printing Aggregations
+ *
+ */
+
+#pragma D option quiet
+#pragma D option aggsortkeypos=1
+
+BEGIN
+{
+	@[1, 3] = sum(0);
+	@[2, 2] = sum(0);
+	@[3, 1] = sum(0);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.valsortkeypos.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.valsortkeypos.d.out
new file mode 100644
index 0000000..9b0acf9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/aggs/tst.valsortkeypos.d.out
@@ -0,0 +1,4 @@
+
+        3        1                0
+        2        2                0
+        1        3                0
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0.d
new file mode 100644
index 0000000..0b7b661
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Verify that divide by 0 errors are caught
+ *
+ * SECTION:
+ *	Types, Operators, and Expressions/Arithmetic Operators
+ */
+
+
+BEGIN
+{
+	c = 123/0;
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0_1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0_1.d
new file mode 100644
index 0000000..1101795
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0_1.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Verify that computed divide by 0 errors are caught
+ *
+ * SECTION:
+ *	Types, Operators, and Expressions/Arithmetic Operators
+ */
+
+
+
+
+BEGIN
+{
+	c = 123/(7-7);
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0_2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0_2.d
new file mode 100644
index 0000000..4546961
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.divby0_2.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Verify that computed divide by 0 errors are caught
+ *
+ * SECTION:
+ *	Types, Operators, and Expressions/Arithmetic Operators
+ */
+
+
+
+
+
+BEGIN
+{
+	c = 123/((7-7) * 999);
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.modby0.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.modby0.d
new file mode 100644
index 0000000..b2bf146
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_DIV_ZERO.modby0.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Verify that mod by 0 errors are caught
+ *
+ * SECTION:
+ *	Types, Operators, and Expressions/Arithmetic Operators
+ */
+
+
+
+BEGIN
+{
+	c = 123%0;
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.addmin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.addmin.d
new file mode 100644
index 0000000..f20339c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.addmin.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Call invalid / impossible arithmetic operations and make sure
+ *	Test gives compilation error.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+	i+-;
+	printf("The value of i is %d\n", i);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.divmin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.divmin.d
new file mode 100644
index 0000000..c11e64f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.divmin.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Call invalid / impossible arithmetic operations and make sure
+ *	Test gives compilation error.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 1;
+	i /-= i;
+	printf("The value of i is %d\n", i);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.muladd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.muladd.d
new file mode 100644
index 0000000..bb107fb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.muladd.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Call invalid / impossible arithmetic operations and make sure
+ *	Test gives compilation error.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 1;
+	i *+= i;
+	printf("The value of i is %d\n", i);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.muldiv.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.muldiv.d
new file mode 100644
index 0000000..7d44b6c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/err.D_SYNTAX.muldiv.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Call invalid / impossible arithmetic operations and make sure
+ *	Test gives compilation error.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 1;
+	i */= i;
+	printf("The value of i is %d\n", i);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d
new file mode 100644
index 0000000..435f09f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple Arithmetic expressions.
+ *	Call simple expressions and make sure test succeeds.
+ *	Match expected output in tst.basics.d.out
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+	i = 1 + 2 + 3;
+	printf("The value of i is %d\n", i);
+
+	i = i * 3;
+	printf("The value of i is %d\n", i);
+
+	i = (i * 3) + i;
+	printf("The value of i is %d\n", i);
+
+	i = (i + (i * 3) + i) * i;
+	printf("The value of i is %d\n", i);
+
+	i = i - (i + (i * 3) + i) * i / i * i;
+	printf("The value of i is %d\n", i);
+
+	i = i * (i - 3 + 5 / i * i ) / i * 6;
+	printf("The value of i is %d\n", i);
+
+	i = i ^ 5;
+	printf("The value of i is %d\n", i);
+
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d
new file mode 100644
index 0000000..2db1b63
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Complex expressions.
+ *	Call complex expressions and make sure test succeeds.
+ *	Match expected output in tst.complex.d.out
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+	i = i++ + ++i;
+	printf("The value of i is %d\n", i);
+	i = i-- - --i;
+	printf("The value of i is %d\n", i);
+	i = i-- + ++i;
+	printf("The value of i is %d\n", i);
+	i += i++ + -- i + ++i - ++i * i ;
+	printf("The value of i is %d\n", i);
+	i -= i++ * 3;
+	printf("The value of i is %d\n", i);
+	i = i++/i--+i++-++i-++i;
+	printf("The value of i is %d\n", i);
+	exit (0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_ARR_BADREF.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_ARR_BADREF.bad.d
new file mode 100644
index 0000000..d31b1f6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_ARR_BADREF.bad.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Tuples can not be used in non-associative arrays.
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ */
+
+int x[5];
+
+BEGIN
+{
+	x[1, 2] = 1;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRBIG.toobig.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRBIG.toobig.d
new file mode 100644
index 0000000..80422e8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRBIG.toobig.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Array declarations with indexs over INT_MAX return a
+ *	D_DECL_ARRBIG errtag.
+ *
+ * SECTION:
+ * 	Pointers and Arrays/Array Declarations and Storage
+ */
+
+int x[88294967295];
+
+BEGIN
+{
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRNULL.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRNULL.bad.d
new file mode 100644
index 0000000..6e7a34f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRNULL.bad.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Arrays must have array dimensions
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ */
+
+int a[];
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRSUB.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRSUB.bad.d
new file mode 100644
index 0000000..f440367
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_ARRSUB.bad.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Arrays declarations must have a positive constant as a
+ * 	subscription.
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ */
+
+int a[-7];
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_PROTO_TYPE.badtuple.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_PROTO_TYPE.badtuple.d
new file mode 100644
index 0000000..7e879dc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_DECL_PROTO_TYPE.badtuple.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Invalid tuple types result in a DT_DECL_ARRTYPE error.
+ *
+ * SECTION:
+ * 	Pointers and Arrays/Array Declarations and Storage
+ */
+
+
+int x[void, char];
+
+BEGIN
+{
+	x[trace(), 'a'] = 456;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_IDENT_UNDEF.badureg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_IDENT_UNDEF.badureg.d
new file mode 100644
index 0000000..e48541b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/err.D_IDENT_UNDEF.badureg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Arrays declarations must have a positive constant as a
+ * 	subscription.
+ *
+ * SECTION: User Process Tracing/uregs Array
+ */
+
+BEGIN
+{
+	printf("FOO = 0x%x\n", uregs[FOO]);
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic1.d
new file mode 100644
index 0000000..ba5b2cf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic1.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple array test
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	a[1] = 0;
+}
+
+tick-1
+/a[1] == 0/
+{
+	exit(0);
+}
+
+tick-1
+/a[1] != 0/
+{
+	printf("Expected 0, got %d\n", a[1]);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic2.d
new file mode 100644
index 0000000..14e1c5c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic2.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple array test
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	a[1] = 0;
+	a[1]++;
+}
+
+tick-1
+/a[1] == 1/
+{
+	exit(0);
+}
+
+tick-1
+/a[1] != 1/
+{
+	printf("Expected 1, got %d\n", a[1]);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic3.d
new file mode 100644
index 0000000..897a12f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic3.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple array test
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	a[1] = 0;
+	++a[1];
+}
+
+tick-1
+/a[1] == 1/
+{
+	exit(0);
+}
+
+tick-1
+/a[1] != 1/
+{
+	printf("Expected 1, got %d\n", a[1]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic4.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic4.d
new file mode 100644
index 0000000..3635a42
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic4.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple array test
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	a["test"] = 0;
+}
+
+tick-1
+/a["test"] == 0/
+{
+	exit(0);
+}
+
+tick-1
+/a["test"] != 0/
+{
+	printf("Expected 0, got %d\n", a["test"]);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic5.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic5.d
new file mode 100644
index 0000000..866a8c3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic5.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple array test
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	a["test"] = 0;
+	b = ++a["test"];
+}
+
+tick-1
+/b == 1/
+{
+	exit(0);
+}
+
+tick-1
+/b != 1/
+{
+	printf("Expected b = 1, got %d\n", b);
+	exit(1);
+}
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic6.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic6.d
new file mode 100644
index 0000000..0371db3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.basic6.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple array test
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	a["test", "test"] = 0;
+	b = ++a["test", "test"];
+}
+
+tick-1
+/b == 1/
+{
+	exit(0);
+}
+
+tick-1
+/b != 1/
+{
+	printf("Expected b = 1, got %d\n", b);
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.uregsarray.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.uregsarray.d
new file mode 100644
index 0000000..b3fba0c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/arrays/tst.uregsarray.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	Positive test to make sure that we can invoke common
+ *	ureg[] aliases.
+ *
+ * SECTION: User Process Tracing/uregs Array
+ *
+ * NOTES: This test does no verification - the value of the output
+ *	is not deterministic.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("R_PC = 0x%x\n", uregs[R_PC]);
+	printf("R_SP = 0x%x\n", uregs[R_SP]);
+	printf("R_R0 = 0x%x\n", uregs[R_R0]);
+	printf("R_R1 = 0x%x\n", uregs[R_R1]);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d
new file mode 100644
index 0000000..6c4d025
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupgtype.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test assigning a variable two different incompatible types.  This should
+ *  result in a compile-time error.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ */
+
+BEGIN
+{
+	x[123] = `kmem_flags;
+	x[456] = *`rootvp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d
new file mode 100644
index 0000000..e1f17cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.dupttype.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test assigning a variable two different incompatible types.  This should
+ *   result in a compile-time error.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ */
+
+BEGIN
+{
+	self->x[123] = `kmem_flags;
+	self->x[456] = *`rootvp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.this.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.this.d
new file mode 100644
index 0000000..2af07ca
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_OP_INCOMPAT.this.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *
+ * Declare 'this int' variable and assign inappropriate data type.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ *
+ */
+
+#pragma D option quiet
+
+this int x;
+
+BEGIN
+{
+	this->x = "dummy";
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_ARG.badsig.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_ARG.badsig.d
new file mode 100644
index 0000000..d682fc6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_ARG.badsig.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test an associative array reference that is invalid because of a type
+ *   signature mismatch -- this should produce a syntax error at compile time.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ */
+
+BEGIN
+{
+	x[123, "foo"] = timestamp;
+}
+
+END
+{
+	x[123, 456] = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_LEN.toofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_LEN.toofew.d
new file mode 100644
index 0000000..b4e82b8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_LEN.toofew.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test an associative array reference that is invalid because of too few
+ *   arguments -- this should produce a syntax error at compile time.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ */
+
+BEGIN
+{
+	x[123, 456] = timestamp;
+}
+
+END
+{
+	x[123] = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_LEN.toomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_LEN.toomany.d
new file mode 100644
index 0000000..3dc5f7d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_PROTO_LEN.toomany.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test an associative array reference that is invalid because of too many
+ *   arguments -- this should produce a syntax error at compile time.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ */
+
+BEGIN
+{
+	x[123, 456] = timestamp;
+}
+
+END
+{
+	x[123, 456, 789] = timestamp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_SYNTAX.errassign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_SYNTAX.errassign.d
new file mode 100644
index 0000000..f31b66f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.D_SYNTAX.errassign.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ *   Assign one to 10 elements; make sure fails to compile.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ */
+
+BEGIN
+{
+	x[10]=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+}
+
+END
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.tupoflow.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.tupoflow.d
new file mode 100644
index 0000000..8104202
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/err.tupoflow.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Generates an associative array reference that should overflow the tuple
+ *   register stack.  We should detect and report this at compile time.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ */
+
+BEGIN
+{
+	a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.cpyarray.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.cpyarray.d
new file mode 100644
index 0000000..ca31cc3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.cpyarray.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Copy value from associative arrays to local variables.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ *
+ */
+
+#pragma D option quiet
+
+this int x;
+
+BEGIN
+{
+	a["abc", 123] = 123;
+}
+
+tick-10ms
+{
+	this->x = a["abc", 123]++;
+	printf("The value of x is %d\n", this->x);
+}
+
+tick-10ms
+{
+	this->x = a["abc", 123]++;
+	printf("The value of x is %d\n", this->x);
+}
+
+tick-10ms
+{
+	this->x = a["abc", 123]++;
+	printf("The value of x is %d\n", this->x);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.diffprofile.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.diffprofile.d
new file mode 100644
index 0000000..ad5fb37
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.diffprofile.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * To test Clause Local Variables ' this' across different profiles.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ *
+ */
+
+#pragma D option quiet
+
+this int x;
+this char c;
+
+tick-10ms
+{
+	this->x = 123;
+	this->c = 'D';
+	printf("The value of x is %d\n", this->x);
+}
+
+tick-10ms
+{
+	this->x = 235;
+	printf("The value of x is %d\n", this->x);
+}
+
+tick-10ms
+{
+	this->x = 456;
+	printf("The value of x is %d\n", this->x);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.initialize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.initialize.d
new file mode 100644
index 0000000..1ab222b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.initialize.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Clause local variables are not initialized to zero.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ *
+ */
+
+#pragma D option quiet
+
+this int x;
+
+BEGIN
+{
+	printf("the value of x is %d\n", this->x);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.invalidref.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.invalidref.d
new file mode 100644
index 0000000..446acfa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.invalidref.d
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Test to ensure that invalid stores to a global associative array
+ * are caught correctly.
+ */
+
+#pragma D option quiet
+
+int last_cmds[int][4];
+
+BEGIN
+{
+	errors = 0;
+	forward = 0;
+	backward = 0;
+}
+
+tick-1s
+/!forward/
+{
+	forward = 1;
+	last_cmds[1][4] = 0xdeadbeef;
+}
+
+tick-1s
+/!backward/
+{
+	backward = 1;
+	last_cmds[1][-5] = 0xdeadbeef;
+}
+
+tick-1s
+/errors > 1/
+{
+	exit(0);
+}
+
+tick-1s
+/n++ > 5/
+{
+	exit(1);
+}
+
+ERROR
+/arg4 == DTRACEFLT_BADADDR/
+{
+	errors++;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.misc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.misc.d
new file mode 100644
index 0000000..43147de
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.misc.d
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the different kinds of associative scalar references.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ * NOTES:
+ *  In particular, we test accessing a DTrace associative array
+ *  defined with scalar type (first ref that forces creation as both global
+ *  and TLS), and DTrace associative array scalar subsequent references
+ *  (both global and TLS).
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i != 5/
+{
+	x[123, "foo"] = 123;
+	self->x[456, "bar"] = 456;
+	i++;
+}
+
+tick-10ms
+/i != 5/
+{
+	printf("x[] = %d\n", x[123, "foo"]);
+	printf("self->x[] = %d\n", self->x[456, "bar"]);
+}
+
+tick-10ms
+/i == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d
new file mode 100644
index 0000000..f474a57
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.orthogonality.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * This test confirms the orthogonality of associative arrays and thread-local
+ * variables by intentionally deriving a matching key signature (based on
+ * t_did).
+ */
+uint64_t b[uint64_t];
+
+BEGIN
+{
+	self->a = 0xbad;
+}
+
+BEGIN
+/b[curthread->t_did] == 0/
+{
+	exit(0);
+}
+
+BEGIN
+{
+	printf("value should be 0; value is %x!", b[curthread->t_did]);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.this.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.this.d
new file mode 100644
index 0000000..c4d01fa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.this.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * To test Clause Local Variables ' this'.
+ *
+ * SECTION: Variables/Associative Arrays
+ *
+ *
+ */
+
+#pragma D option quiet
+
+this int x;
+this char c;
+
+BEGIN
+{
+	this->x = 123;
+	this->c = 'D';
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.valassign.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.valassign.d.out
new file mode 100644
index 0000000..948d82e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/assocs/tst.valassign.d.out
@@ -0,0 +1,2 @@
+The value of i is 123
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/err.D_PDESC_ZERO.begin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/err.D_PDESC_ZERO.begin.d
new file mode 100644
index 0000000..c2a6088
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/err.D_PDESC_ZERO.begin.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Arguments to BEGIN provider not allowed.
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN::read:entry
+{
+	printf("Begin fired first\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/err.D_PDESC_ZERO.tick.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/err.D_PDESC_ZERO.tick.d
new file mode 100644
index 0000000..44a363f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/err.D_PDESC_ZERO.tick.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	concat of providers not allowed with BEGIN
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+
+BEGIN:tick-1
+{
+	printf("Begin fired first\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.begin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.begin.d
new file mode 100644
index 0000000..43e7744
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.begin.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Order of provider flow, Begin, tick profile, and END.
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+END
+{
+	printf("End fired after exit\n");
+}
+
+BEGIN
+{
+	printf("Begin fired first\n");
+}
+
+tick-1ms
+{
+	printf("tick fired second\n");
+	printf("Call exit\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.begin.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.begin.d.out
new file mode 100644
index 0000000..a9d8ee1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.begin.d.out
@@ -0,0 +1,5 @@
+Begin fired first
+tick fired second
+Call exit
+End fired after exit
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.multibegin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.multibegin.d
new file mode 100644
index 0000000..3d5fd12
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.multibegin.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Multiple BEGIN providers
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("Begin fired first\n");
+}
+BEGIN
+{
+	printf("Begin fired second\n");
+}
+BEGIN
+{
+	printf("Begin fired third\n");
+}
+BEGIN
+{
+	printf("Begin fired fourth\n");
+}
+BEGIN
+{
+	printf("Begin fired fifth\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.multibegin.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.multibegin.d.out
new file mode 100644
index 0000000..e5bb996
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/begin/tst.multibegin.d.out
@@ -0,0 +1,6 @@
+Begin fired first
+Begin fired second
+Begin fired third
+Begin fired fourth
+Begin fired fifth
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_ADDROF_BITFIELD.BitfieldAddress.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_ADDROF_BITFIELD.BitfieldAddress.d
new file mode 100644
index 0000000..9c5aca4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_ADDROF_BITFIELD.BitfieldAddress.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Cannot take the address of a bit-field member using the &
+ * operator.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bitRecord{
+	int a : 1;
+	int b : 3;
+	int c : 12;
+} var;
+
+BEGIN
+{
+	printf("address of a: %d\naddress of b: %d\naddress of c: %dn",
+	&var.a, &var.b, &var.c);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFCONST.NegBitField.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFCONST.NegBitField.d
new file mode 100644
index 0000000..acb296f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFCONST.NegBitField.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Bit-field width must be positive.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bitRecord{
+	int a : 1;
+	int b : -3;
+	int c : 12;
+} var;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFCONST.ZeroBitField.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFCONST.ZeroBitField.d
new file mode 100644
index 0000000..dfe24c5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFCONST.ZeroBitField.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Bit-fields must be positive and non-zero.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bitRecord{
+	int a : 1;
+	int b : 0;
+	int c : 12;
+} var;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFSIZE.ExceedBaseType.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFSIZE.ExceedBaseType.d
new file mode 100644
index 0000000..d9abfd1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFSIZE.ExceedBaseType.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Bit-field width must be of a number of bits not larger than
+ * that of the corresponding base type.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bitRecord1{
+	char a : 10;
+} var1;
+
+struct bitRecord2{
+	short a : 33;
+} var2;
+
+struct bitRecord3{
+	long long a : 65;
+} var3;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFSIZE.GreaterThan64.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFSIZE.GreaterThan64.d
new file mode 100644
index 0000000..c1e359e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFSIZE.GreaterThan64.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Bit-field width cannot be greater than 64 bits in D.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bitRecord{
+	int a : 1;
+	int b : 65;
+	int c : 12;
+} var;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFTYPE.badtype.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFTYPE.badtype.d
new file mode 100644
index 0000000..5e7b523
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_DECL_BFTYPE.badtype.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Non-integer types used for bitfields will result in a D_DECL_BFTYPE
+ *	error.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bits {
+	float : 1;
+} xyz;
+
+BEGIN
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_OFFSETOF_BITFIELD.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_OFFSETOF_BITFIELD.d
new file mode 100644
index 0000000..402a209
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_OFFSETOF_BITFIELD.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Cannot apply offsetof operator to a bit-field member.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ *
+ */
+#pragma D option quiet
+
+struct bitRecord{
+	int a : 17;
+	int b : 3;
+	int c : 12;
+} var;
+
+BEGIN
+{
+	printf("offsetof(struct bitRecord, a): %d\n",
+	offsetof(struct bitRecord, a));
+	printf("offsetof(struct bitRecord, b): %d\n",
+	offsetof(struct bitRecord, b));
+	printf("offsetof(struct bitRecord, c): %d\n",
+	offsetof(struct bitRecord, c));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_SIZEOF_BITFIELD.SizeofBitfield.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_SIZEOF_BITFIELD.SizeofBitfield.d
new file mode 100644
index 0000000..70c2834
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/err.D_SIZEOF_BITFIELD.SizeofBitfield.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Cannot apply sizeof operator to a bit-field member.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bitRecord{
+	int a : 1;
+	int b : 3;
+	int c : 12;
+} var;
+
+BEGIN
+{
+	printf("sizeof (a): %d\nsizeof (b): %d\nsizeof (c): %n",
+	sizeof (var.a), sizeof (var.b), sizeof (var.c));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/tst.BitFieldPromotion.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/tst.BitFieldPromotion.d
new file mode 100644
index 0000000..07ec728
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/tst.BitFieldPromotion.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Bit-field will be automatically promoted to the next largest
+ * integer type for use in any expression and then the value assigned will
+ * warp around the maximum number assignable to the data type.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bitRecord{
+	int a : 1;
+	int b : 15;
+	int c : 31;
+} var;
+
+BEGIN
+{
+	var.a = 256;
+	var.b = 65536;
+	var.c = 4294967296;
+
+	printf("bitRecord.a: %d\nbitRecord.b: %d\nbitRecord.c: %d\n",
+	var.a, var.b, var.c);
+	exit(0);
+}
+
+END
+/(0 != var.a) || (0 != var.b) || (0 != var.c)/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/tst.SizeofBitField.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/tst.SizeofBitField.d
new file mode 100644
index 0000000..ce307de
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/bitfields/tst.SizeofBitField.d
@@ -0,0 +1,109 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: C and D compilers try to pack bits as efficiently as possible.
+ *
+ * SECTION: Structs and Unions/Bit-Fields
+ */
+
+#pragma D option quiet
+
+struct bitRecord1 {
+	int a : 1;
+} var1;
+
+struct bitRecord2 {
+	int a : 1;
+	int b : 3;
+} var2;
+
+struct bitRecord3 {
+	int a : 1;
+	int b : 3;
+	int c : 3;
+} var3;
+
+struct bitRecord4 {
+	int a : 1;
+	int b : 3;
+	int c : 3;
+	int d : 3;
+} var4;
+
+struct bitRecord5 {
+	int c : 12;
+	int a : 10;
+	int b : 3;
+} var5;
+
+struct bitRecord6 {
+	int a : 20;
+	int b : 3;
+	int c : 12;
+} var6;
+
+struct bitRecord7 {
+	long c : 32;
+	long long d: 9;
+	int e: 1;
+} var7;
+
+struct bitRecord8 {
+	char a : 2;
+	short b : 12;
+	long c : 32;
+} var8;
+
+struct bitRecord12 {
+	int a : 30;
+	int b : 30;
+	int c : 32;
+} var12;
+
+BEGIN
+{
+	printf("sizeof (bitRecord1): %d\n", sizeof (var1));
+	printf("sizeof (bitRecord2): %d\n", sizeof (var2));
+	printf("sizeof (bitRecord3): %d\n", sizeof (var3));
+	printf("sizeof (bitRecord4): %d\n", sizeof (var4));
+	printf("sizeof (bitRecord5): %d\n", sizeof (var5));
+	printf("sizeof (bitRecord6): %d\n", sizeof (var6));
+	printf("sizeof (bitRecord7): %d\n", sizeof (var7));
+	printf("sizeof (bitRecord8): %d\n", sizeof (var8));
+	printf("sizeof (bitRecord12): %d\n", sizeof (var12));
+	exit(0);
+}
+
+END
+/(1 != sizeof (var1)) || (2 != sizeof (var2)) || (3 != sizeof (var3)) ||
+    (4 != sizeof (var4)) || (5 != sizeof (var5)) || (6 != sizeof (var6))
+    || (7 != sizeof (var7)) || (8 != sizeof (var8)) || (12 != sizeof (var12))/
+{
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.end.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.end.d
new file mode 100644
index 0000000..a480d67
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.end.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Checks that buffer space for an END enabling is always reserved in a
+ *	fill buffer.  This will fail because the size of the END enabling
+ *	(64 bytes) exceeds the size of the buffer (32 bytes).
+ *
+ * SECTION: Buffers and Buffering/fill Policy;
+ *	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufpolicy;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/strsize
+ */
+
+#pragma D option bufpolicy=fill
+#pragma D option bufsize=32
+#pragma D option strsize=64
+
+BEGIN
+{
+	exit(0);
+}
+
+END
+{
+	trace(execname);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize1.d
new file mode 100644
index 0000000..4731bd1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize1.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Checks that setting "bufresize" to "manual" will cause buffer
+ *	allocation to fail for large principal buffer sizes.
+ *
+ * SECTION: Buffers and Buffering/Buffer Resizing Policy;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufresize
+ *
+ */
+
+#pragma D option bufresize=manual
+#pragma D option bufsize=100t
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize2.d
new file mode 100644
index 0000000..4dfe6b6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize2.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Checks that setting "bufresize" to "manual" will cause buffer
+ *	allocation to fail for large aggregation buffer sizes.
+ *
+ * SECTION: Buffers and Buffering/Buffer Resizing Policy;
+ *	Options and Tunables/bufresize;
+ *	Options and Tunables/aggsize
+ *
+ */
+
+#pragma D option bufresize=manual
+#pragma D option aggsize=100t
+
+BEGIN
+{
+	@a[probeprov] = count();
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize3.d
new file mode 100644
index 0000000..866a56c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.resize3.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Checks that setting "bufresize" to "manual" will cause buffer
+ *	allocation to fail for large speculative buffer sizes.
+ *
+ * SECTION: Buffers and Buffering/Buffer Resizing Policy;
+ *	Options and Tunables/bufresize;
+ *	Options and Tunables/specsize
+ *
+ */
+
+#pragma D option bufresize=manual
+#pragma D option specsize=100t
+
+BEGIN
+{
+	spec = speculation();
+}
+
+BEGIN
+{
+	speculate(spec);
+	trace(epid);
+}
+
+BEGIN
+{
+	commit(spec);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.zerobuf.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.zerobuf.d
new file mode 100644
index 0000000..a2e4435
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/err.zerobuf.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test with a bufsize of 0 - should return an error.
+ *
+ * SECTION:
+ *	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize
+ */
+
+#pragma D option bufsize=0
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.alignring.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.alignring.d
new file mode 100644
index 0000000..152acb6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.alignring.d
@@ -0,0 +1,81 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for ring buffer policy.
+ *
+ * SECTION: Buffers and Buffering/ring Policy;
+ *	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy
+ */
+
+#pragma D option bufpolicy=ring
+#pragma D option bufsize=4k
+
+profile:::profile-1009hz
+{
+	printf("%x %x\n", (int)0xaaaa, (int)0xbbbb);
+}
+
+profile:::profile-1237hz
+{
+	printf("%x %x %x %x %x %x\n",
+	    (int)0xcccc,
+	    (int)0xdddd,
+	    (int)0xeeee,
+	    (int)0xffff,
+	    (int)0xabab,
+	    (int)0xacac);
+	printf("%x %x\n",
+	    (uint64_t)0xaabbaabbaabbaabb,
+	    (int)0xadad);
+}
+
+profile:::profile-1789hz
+{
+	printf("%x %x %x %x %x\n",
+	    (int)0xaeae,
+	    (int)0xafaf,
+	    (unsigned char)0xaa,
+	    (int)0xbcbc,
+	    (int)0xbdbd);
+}
+
+profile-1543hz
+{}
+
+profile-1361hz
+{}
+
+tick-1sec
+/i++ >= 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.cputime.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.cputime.ksh
new file mode 100644
index 0000000..6ac0fa9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.cputime.ksh
@@ -0,0 +1,90 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -s /dev/stdin -x bufpolicy=$1 $1 <<EOF
+
+	#pragma D option quiet
+	#pragma D option statusrate=1hz
+
+	uint64_t total;
+	int thresh;
+
+	BEGIN
+	{
+		start = timestamp;
+		thresh = 10;
+	}
+
+	sched:::on-cpu
+	/pid == \$pid/
+	{
+		self->on = vtimestamp;
+	}
+
+	sched:::off-cpu
+	/self->on/
+	{
+		total += vtimestamp - self->on;
+	}
+
+	tick-1sec
+	/i++ == 10/
+	{
+		exit(0);
+	}
+
+	END
+	/((total * 100) / (timestamp - start)) > thresh/
+	{
+		printf("'%s' buffering policy took %d%% of CPU; ",
+		    \$\$1, ((total * 100) / (timestamp - start)));
+		printf("expected no more than %d%%!\n", thresh);
+		exit(1);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+for policy in "fill ring switch"; do
+	script $policy
+
+	status=$?
+
+	if [ "$status" -ne 0 ]; then
+		exit $status
+	fi
+done
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.dynvarsize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.dynvarsize.d
new file mode 100644
index 0000000..c8a0740
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.dynvarsize.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for dynamic variable size.
+ *
+ * SECTION: Buffers and Buffering/switch Policy;
+ *	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy;
+ *	Options and Tunables/switchrate
+ */
+
+#pragma D option dynvarsize=100
+#pragma D option quiet
+
+int n;
+
+tick-10ms
+/n++ < 100/
+{
+	a[n] = 1;
+}
+
+tick-10ms
+/n == 100/
+{
+	exit(2);
+}
+
+END
+/a[99]/
+{
+	exit(1);
+}
+
+END
+/!a[99]/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.fill1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.fill1.d
new file mode 100644
index 0000000..143ed64
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.fill1.d
@@ -0,0 +1,115 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for fill buffer policy.
+ *
+ * SECTION: Buffers and Buffering/fill Policy;
+ * 	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy;
+ *	Options and Tunables/statusrate
+ */
+/*
+ * This is a brute-force way of testing fill buffers.  We assume that each
+ * printf() stores 8 bytes.  Because each fill buffer is per-CPU, we must
+ * fill up our buffer in one series of enablings on a single CPU.
+ */
+#pragma D option bufpolicy=fill
+#pragma D option bufsize=64
+#pragma D option statusrate=10ms
+#pragma D option quiet
+
+int i;
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+{
+	printf("%d\n", i++);
+}
+
+tick-10ms
+/i >= 100/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.fill1.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.fill1.d.out
new file mode 100644
index 0000000..fd8abec
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.fill1.d.out
@@ -0,0 +1,9 @@
+0
+1
+2
+3
+4
+5
+6
+7
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize1.d
new file mode 100644
index 0000000..396a808
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize1.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Checks that setting "bufresize" to "auto" will cause buffer
+ *	allocation to succeed, even for large principal buffer sizes.
+ *
+ * SECTION: Buffers and Buffering/Buffer Resizing Policy;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufresize
+ *
+ * NOTES:
+ *	We use the undocumented "preallocate" option to make sure dtrace(1M)
+ *	has enough space in its heap to allocate a buffer as large as the
+ *	kernel's trace buffer.
+ */
+
+#pragma D option preallocate=100t
+#pragma D option bufresize=auto
+#pragma D option bufsize=100t
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize2.d
new file mode 100644
index 0000000..50b814b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize2.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Checks that setting "bufresize" to "auto" will cause buffer
+ *	allocation to succeed, even for large aggregation buffer sizes.
+ *
+ * SECTION: Buffers and Buffering/Buffer Resizing Policy;
+ *	Options and Tunables/aggsize;
+ *	Options and Tunables/bufresize
+ *
+ * NOTES:
+ *	We use the undocumented "preallocate" option to make sure dtrace(1M)
+ *	has enough space in its heap to allocate a buffer as large as the
+ *	kernel's trace buffer.
+ */
+
+#pragma D option preallocate=100t
+#pragma D option bufresize=auto
+#pragma D option aggsize=100t
+
+BEGIN
+{
+	@a[probeprov] = count();
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize3.d
new file mode 100644
index 0000000..eb362fb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.resize3.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Checks that setting "bufresize" to "auto" will cause buffer
+ *	allocation to succeed, even for large speculative buffer sizes.
+ *
+ * SECTION: Buffers and Buffering/Buffer Resizing Policy;
+ *	Options and Tunables/specsize;
+ *	Options and Tunables/bufresize
+ *
+ * NOTES:
+ *	On some small memory machines, this test may consume so much memory
+ *	that it induces memory allocation failure in the dtrace library.  This
+ *	will manifest itself as an error like one of the following:
+ *
+ *	    dtrace: processing aborted: Memory allocation failure
+ *	    dtrace: could not enable tracing: Memory allocation failure
+ *
+ *	These actually indicate that the test performed as expected; failures
+ *	of the above nature should therefore be ignored.
+ *
+ */
+
+#pragma D option bufresize=auto
+#pragma D option specsize=100t
+
+BEGIN
+{
+	spec = speculation();
+}
+
+BEGIN
+{
+	speculate(spec);
+	trace(epid);
+}
+
+BEGIN
+{
+	commit(spec);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring1.d
new file mode 100644
index 0000000..67e7b87
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring1.d
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for ring buffer policy.
+ *
+ * SECTION: Buffers and Buffering/ring Policy;
+ *	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy;
+ *	Options and Tunables/switchrate
+ */
+
+/*
+ * We assume that a trace() of an integer stores at least 8 bytes.  If ring
+ * buffering is not working properly, this trace() will induce a drop, and the
+ * counter won't be incremented.  We set the switchrate to one second just to
+ * sure that a high switchrate doesn't mask broken ring buffers.
+ */
+#pragma D option bufpolicy=ring
+#pragma D option bufsize=50
+#pragma D option switchrate=1sec
+
+int n;
+int i;
+
+tick-10msec
+/n < 300/
+{
+	trace(i);
+	i++;
+}
+
+tick-10msec
+/n < 300/
+{
+	n++;
+}
+
+tick-10msec
+/n == 300/
+{
+	exit(2);
+}
+
+END
+{
+	exit(i == 300 ? 0 : 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring2.d
new file mode 100644
index 0000000..cbf48f2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring2.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for ring buffer policy.
+ *
+ * SECTION: Buffers and Buffering/ring Policy;
+ * SECTION: Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy
+ */
+
+#pragma D option bufpolicy=ring
+#pragma D option bufsize=512k
+#pragma D option quiet
+
+tick-1sec
+/n < 5/
+{
+	printf("%d\n", n++);
+}
+
+tick-1sec
+/n == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring2.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring2.d.out
new file mode 100644
index 0000000..cc4d41a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring2.d.out
@@ -0,0 +1,6 @@
+0
+1
+2
+3
+4
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring3.d
new file mode 100644
index 0000000..68e3588
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring3.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for ring buffer policy.
+ *
+ * SECTION: Buffers and Buffering/ring Policy;
+ *	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy
+ */
+
+/*
+ * We make some regrettable assumptions about the implementation in this test.
+ * First, we assume that each entry for the printf() of an int takes _exactly_
+ * eight bytes (four bytes for the EPID, four bytes for the payload).  Second,
+ * we assume that by allocating storage for n + 1 records, we will get exactly
+ * n.  Here is why:  the final predicate that evaluates to false will reserve
+ * space that it won't use.  This act of reservation will advance the wrapped
+ * offset.  That record won't be subsequently used, but the wrapped offset has
+ * advanced.  (And in this case, that old record is clobbered by the exit()
+ * anyway.)  Thirdly:  we rely on t_cpu/cpu_id.  Finally:  we rely on being
+ * able to run on the CPU that we first ran on.
+ */
+#pragma D option bufpolicy=ring
+#pragma D option bufsize=40
+#pragma D option quiet
+
+int n;
+
+BEGIN
+{
+	cpuid = -1;
+}
+
+tick-10msec
+/cpuid == -1/
+{
+	cpuid = curthread->t_cpu->cpu_id;
+}
+
+tick-10msec
+/curthread->t_cpu->cpu_id == cpuid && n < 100/
+{
+	printf("%d\n", n++);
+}
+
+tick-10msec
+/n == 100/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring3.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring3.d.out
new file mode 100644
index 0000000..99fd231
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.ring3.d.out
@@ -0,0 +1,5 @@
+96
+97
+98
+99
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.smallring.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.smallring.d
new file mode 100644
index 0000000..2134a0b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.smallring.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for ring buffer policy.
+ *
+ * SECTION: Buffers and Buffering/ring Policy;
+ *	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy
+ */
+
+#pragma D option bufpolicy=ring
+#pragma D option bufsize=16
+
+tick-10ms
+{
+	trace(0xbadbaddefec8d);
+}
+
+tick-10ms
+/0/
+{
+	trace((int)1);
+}
+
+tick-100ms
+/i++ > 2/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.switch1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.switch1.d
new file mode 100644
index 0000000..2840fee
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.switch1.d
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Positive test for switch buffer policy.
+ *
+ * SECTION: Buffers and Buffering/switch Policy;
+ *	Buffers and Buffering/Buffer Sizes;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy;
+ *	Options and Tunables/switchrate
+ */
+
+/*
+ * We assume that a printf() of an integer stores at least 8 bytes, and no more
+ * than 16 bytes.
+ */
+#pragma D option bufpolicy=switch
+#pragma D option bufsize=32
+#pragma D option switchrate=500msec
+#pragma D option quiet
+
+int n;
+int i;
+
+tick-1sec
+/n < 10/
+{
+	printf("%d\n", i);
+	i++;
+}
+
+tick-1sec
+/n < 10/
+{
+	n++;
+}
+
+tick-1sec
+/n == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.switch1.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.switch1.d.out
new file mode 100644
index 0000000..ce6c2bc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/buffering/tst.switch1.d.out
@@ -0,0 +1,11 @@
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.cpuusage.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.cpuusage.d
new file mode 100644
index 0000000..e1e0dd8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.cpuusage.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print non assigned value and make sure it fails.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The cpuusage = %d\n", curlwpsinfo->pr_cpu);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.nice.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.nice.d
new file mode 100644
index 0000000..c7a4ad2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.nice.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * print non assigned value and make sure it fails.
+ *
+ * SECTION: Variables/Built-in Variables
+ *
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The nice for cpu usage %c\n", curlwpsinfo->pr_nice);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.priority.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.priority.d
new file mode 100644
index 0000000..6ebb3df
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.priority.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Print non assigned variables and make sure it fails.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The low value is high priority field = %d\n",
+		curlwpsinfo->pr_nice);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.prsize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.prsize.d
new file mode 100644
index 0000000..f467f19
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.prsize.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print non assigned variables and make sure it fails.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("Size of process image in kbytes = %ld\n", curpsinfo->pr_size);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.rssize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.rssize.d
new file mode 100644
index 0000000..48057e1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/err.D_XLATE_NOCONV.rssize.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print non assigned variables and make sure it fails.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("Size of process image in kbytes = %ld\n", curpsinfo->pr_rssize);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg0.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg0.d
new file mode 100644
index 0000000..ec3c277
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg0.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print arg0 and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The argument is %u\n", arg0);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg0clause.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg0clause.d
new file mode 100644
index 0000000..4c782f8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg0clause.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print arg0 from a profile and make sure it succeeds
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("Call probe read\n");
+}
+
+syscall:::entry
+{
+	printf("The argument is %u", arg0);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1.d
new file mode 100644
index 0000000..993a376
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print arg1 and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The argument is %u\n", arg1);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1to8.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1to8.d
new file mode 100644
index 0000000..b696d7c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1to8.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print arg1 to arg8 and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The argument is %u %u %u %u %u %u %u %u\n", arg1, arg2,
+			arg3, arg4, arg5, arg6, arg7, arg8);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1to8clause.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1to8clause.d
new file mode 100644
index 0000000..fa62b03
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.arg1to8clause.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print arg1 to arg8 from a profile and make sure it succeeds
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+syscall:::entry
+{
+	printf("The argument is %u %u %u %u %u %u %u %u\n", arg1, arg2,
+		arg3, arg4, arg5, arg6, arg7, arg8);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.caller.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.caller.d
new file mode 100644
index 0000000..db1eabc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.caller.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * print 'caller' and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The caller is %u\n", caller);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.caller1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.caller1.d
new file mode 100644
index 0000000..f1bfeed
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.caller1.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print caller form profile and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("The caller is %u\n", caller);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.epid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.epid.d
new file mode 100644
index 0000000..4f04c65
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.epid.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print 'epid'from profile and make sure it succeeds
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("epid of this probe = %d\n", epid);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.epid1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.epid1.d
new file mode 100644
index 0000000..4cba65e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.epid1.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * print epid and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("epid of this probe = %d\n", epid);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.errno.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.errno.d
new file mode 100644
index 0000000..4d7a4ff
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.errno.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print errno from profile and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("epid of this probe = %d\n", epid);
+	printf("the errno = %d\n", errno);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.errno1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.errno1.d
new file mode 100644
index 0000000..ed233bf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.errno1.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print errno and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("epid of this probe = %d\n", epid);
+	printf("the errno = %d\n", errno);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.execname.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.execname.d
new file mode 100644
index 0000000..b3007de
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.execname.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print execname and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+/execname == "dtrace" || execname == "java"/
+{
+	trace("execname matched");
+	exit(0);
+}
+
+BEGIN
+{
+	trace("execname didn't match");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.hpriority.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.hpriority.d
new file mode 100644
index 0000000..a0d8836
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.hpriority.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print hpriority and make sure it succeeds
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The high priority = %d\n", curlwpsinfo->pr_pri);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.id.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.id.d
new file mode 100644
index 0000000..291d91d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.id.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print 'id' from profile.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("id of this probe = %d\n", id);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.id1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.id1.d
new file mode 100644
index 0000000..068cff6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.id1.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print id and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("id of this probe = %d\n", id);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.ipl.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.ipl.d
new file mode 100644
index 0000000..2e6f349
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.ipl.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print variable ipl
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("The interrupt priority level = %u\n", ipl);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.ipl1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.ipl1.d
new file mode 100644
index 0000000..ef9278d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.ipl1.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print ipl and make sure it succeeds
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The interrupt priority level = %u\n", ipl);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.lwpsinfo.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.lwpsinfo.d
new file mode 100644
index 0000000..f0e9d46
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.lwpsinfo.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print lwpsinfo_t structure values.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("The current thread's pr_flag is %d\n", curlwpsinfo->pr_flag);
+	printf("The current threads lwpid is %d\n", curlwpsinfo->pr_lwpid);
+	printf("The current thread's internal address is %u\n",
+			curlwpsinfo->pr_addr);
+	printf("The current thread's wait addr for sleeping lwp is %u\n",
+			curlwpsinfo->pr_wchan);
+	printf("The current lwp stat is %d\n", curlwpsinfo->pr_state);
+	printf("The printable character for pr_state %c\n",
+		curlwpsinfo->pr_sname);
+	printf("The syscall number = %d\n", curlwpsinfo->pr_syscall);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.lwpsinfo1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.lwpsinfo1.d
new file mode 100644
index 0000000..aa11b07
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.lwpsinfo1.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print lwpsinfo_t variables and make sure it succeeds
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("The current thread's pr_flag is %d\n", curlwpsinfo->pr_flag);
+	printf("The current threads lwpid is %d\n", curlwpsinfo->pr_lwpid);
+	printf("The current thread's internal address is %u\n",
+			curlwpsinfo->pr_addr);
+	printf("The current thread's wait addr for sleeping lwp is %u\n",
+			curlwpsinfo->pr_wchan);
+	printf("The current lwp stat is %d\n", curlwpsinfo->pr_state);
+	printf("The printable character for pr_state %c\n",
+		curlwpsinfo->pr_sname);
+	printf("The syscall number = %d\n", curlwpsinfo->pr_syscall);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.pid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.pid.d
new file mode 100644
index 0000000..2dd80d7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.pid.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print 'pid' from profile.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("process id = %d \n", pid);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.pid1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.pid1.d
new file mode 100644
index 0000000..5cee07c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.pid1.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print 'pid' and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("process id = %d \n", pid);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo.d
new file mode 100644
index 0000000..c90f6e9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print psinfo structure values from profile.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("number of lwps in process = %d\n", curpsinfo->pr_nlwp);
+	printf("unique process id = %d\n", curpsinfo->pr_pid);
+	printf("process id of parent = %d\n", curpsinfo->pr_ppid);
+	printf("pid of process group leader = %d\n", curpsinfo->pr_pgid);
+	printf("session id = %d\n", curpsinfo->pr_sid);
+	printf("real user id = %d\n", curpsinfo->pr_uid);
+	printf("effective user id = %d\n", curpsinfo->pr_euid);
+	printf("real group id = %d\n", curpsinfo->pr_gid);
+	printf("effective group id = %d\n", curpsinfo->pr_egid);
+	printf("address of process = %u\n", curpsinfo->pr_addr);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo1.d
new file mode 100644
index 0000000..098f38b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.psinfo1.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print psinfo structure values.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("number of lwps in process = %d\n", curpsinfo->pr_nlwp);
+	printf("unique process id = %d\n", curpsinfo->pr_pid);
+	printf("process id of parent = %d\n", curpsinfo->pr_ppid);
+	printf("pid of process group leader = %d\n", curpsinfo->pr_pgid);
+	printf("session id = %d\n", curpsinfo->pr_sid);
+	printf("real user id = %d\n", curpsinfo->pr_uid);
+	printf("effective user id = %d\n", curpsinfo->pr_euid);
+	printf("real group id = %d\n", curpsinfo->pr_gid);
+	printf("effective group id = %d\n", curpsinfo->pr_egid);
+	printf("address of process = %u\n", curpsinfo->pr_addr);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.tid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.tid.d
new file mode 100644
index 0000000..1b16c8b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.tid.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print tid from profile
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+
+tick-10ms
+{
+	printf("Thread id = %d \n", tid);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.tid1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.tid1.d
new file mode 100644
index 0000000..a0567e7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.tid1.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * To print tid and make sure it succeeds.
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("Thread id = %d \n", tid);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.timestamp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.timestamp.d
new file mode 100644
index 0000000..cd94eac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.timestamp.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print build-in variable 'timestamp'
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	self->t = timestamp;
+	printf("The difftime = %d\n", timestamp - self->t);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.vtimestamp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.vtimestamp.d
new file mode 100644
index 0000000..cdbecfc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/builtinvar/tst.vtimestamp.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * To print build-in variable 'vtimestamp'
+ *
+ * SECTION: Variables/Built-in Variables
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	self->t = vtimestamp;
+	printf("The difftime = %d\n", vtimestamp - self->t);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.aggfun.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.aggfun.d
new file mode 100644
index 0000000..f687717
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.aggfun.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause where an unknown identifier appears in a predicated
+ *            clause inside an aggregating function.
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+/1/
+{
+	@a = max(x);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.aggtup.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.aggtup.d
new file mode 100644
index 0000000..1fa4974
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.aggtup.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause where an unknown identifier appears in a predicated
+ *            clause inside an aggregation tuple.
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+/1/
+{
+	@a[x] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.arrtup.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.arrtup.d
new file mode 100644
index 0000000..6c1cdff
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.arrtup.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause where an unknown identifier appears in a predicated
+ *            clause inside an associate array tuple.
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+/1/
+{
+	a[x]++;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.body.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.body.d
new file mode 100644
index 0000000..da499cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.body.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause where an unknown identifier appears in a clause.
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+{
+	exit(x);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.both.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.both.d
new file mode 100644
index 0000000..0070827
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.both.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause where an unknown identifier appears in a predicate
+ *            and in a clause body.
+ *
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+/x != 0/
+{
+	exit(x);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.pred.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.pred.d
new file mode 100644
index 0000000..0bfc86f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/err.D_IDENT_UNDEF.pred.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause where an unknown identifier appears in a predicate.
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+/x != 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.nopred.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.nopred.d
new file mode 100644
index 0000000..44d1167
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.nopred.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause that has a body but no predicate.
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.pred.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.pred.d
new file mode 100644
index 0000000..43bfedd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.pred.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause that has a body and a predicate.
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+/$pid != 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.predfirst.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.predfirst.d
new file mode 100644
index 0000000..c7f0b4e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.predfirst.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause that has a body and a predicate where the
+ *            predicate must be cooked first because it creates a variable.
+ *
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+/x++ == 0/
+{
+	exit(x - 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.predlast.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.predlast.d
new file mode 100644
index 0000000..9ed904f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/clauses/tst.predlast.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test a clause that has a body and a predicate where the
+ *            predicate must be cooked last because the clause creates
+ *            a variable which is referenced in the predicate.
+ *
+ * SECTION:   Program Structure / Probe Clauses and Declarations
+ *
+ */
+
+BEGIN
+/x == 0/
+{
+	exit(x++);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.lowfrequency.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.lowfrequency.d
new file mode 100644
index 0000000..1015a25
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.lowfrequency.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Test to check that attempting to enable a valid event with a frequency
+ * lower than the default platform limit will fail.
+ *
+ * This test will fail if:
+ *	1) The system under test does not define the 'PAPI_tot_ins' event.
+ *	2) The 'dcpc-min-overflow' variable in dcpc.conf has been modified.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	exit(0);
+}
+
+cpc:::PAPI_tot_ins-all-100
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.malformedoverflow.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.malformedoverflow.d
new file mode 100644
index 0000000..f9b7809
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.malformedoverflow.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Tests that specifying an overflow value containing extraneous characters
+ * (only digits are allowed) will fail.
+ */
+
+BEGIN
+{
+	exit(0);
+}
+
+cpc:::PAPI_tot_ins-all-10000bonehead
+{
+	@[probename] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.nonexistentevent.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.nonexistentevent.d
new file mode 100644
index 0000000..73f9575
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.D_PDESC_ZERO.nonexistentevent.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Tests that attempting to enable a probe containing a non existent event
+ * will fail.
+ */
+
+BEGIN
+{
+	exit(0);
+}
+
+cpc:::PAPI_cpc_bad-all-10000
+{
+	@[probename] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cpcvscpustatpart1.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cpcvscpustatpart1.ksh
new file mode 100755
index 0000000..767d493
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cpcvscpustatpart1.ksh
@@ -0,0 +1,78 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+
+#
+# This tests that cpustat(1) should fail to start if the cpc provider
+# is already calling the shots.
+#
+# This script will fail if:
+#       1) The system under test does not define the 'PAPI_tot_ins'
+#       generic event.
+
+script()
+{
+	$dtrace -o $dtraceout -s /dev/stdin <<EOF
+	#pragma D option bufsize=128k
+
+	cpc:::PAPI_tot_ins-all-10000
+	{
+		@[probename] = count();
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+dtraceout=/tmp/dtrace.out.$$
+script 2>/dev/null &
+timeout=15
+
+#
+# Sleep while the above script fires into life. To guard against dtrace dying
+# and us sleeping forever we allow 15 secs for this to happen. This should be
+# enough for even the slowest systems.
+#
+while [ ! -f $dtraceout ]; do
+	sleep 1
+	timeout=$(($timeout-1))
+	if [ $timeout -eq 0 ]; then
+		echo "dtrace failed to start. Exiting."
+		exit 1
+	fi
+done
+
+cpustat -c PAPI_tot_ins 1 5
+status=$?
+
+rm $dtraceout
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cpcvscpustatpart2.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cpcvscpustatpart2.ksh
new file mode 100755
index 0000000..584469c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cpcvscpustatpart2.ksh
@@ -0,0 +1,70 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+
+#
+# This tests that enablings from the cpc provider will fail if cpustat(1) is
+# already master of the universe.
+#
+# This script will fail if:
+#       1) The system under test does not define the 'PAPI_tot_ins'
+#       generic event.
+
+script()
+{
+        $dtrace -s /dev/stdin <<EOF
+        #pragma D option bufsize=128k
+
+        BEGIN
+        {
+                exit(0);
+        }
+
+        cpc:::PAPI_tot_ins-all-10000
+        {
+                @[probename] = count();
+        }
+EOF
+}
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+dtraceout=/tmp/dtrace.out.$$
+
+cpustat -c PAPI_tot_ins 1 20 &
+pid=$!
+sleep 5
+script 2>/dev/null
+
+status=$?
+
+kill $pid
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cputrackfailtostart.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cputrackfailtostart.ksh
new file mode 100755
index 0000000..f62b83d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cputrackfailtostart.ksh
@@ -0,0 +1,77 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+#
+# This script ensures that cputrack(1M) will fail to start when the cpc
+# provider has active enablings.
+#
+# The script will fail if:
+#	1) The system under test does not define the 'PAPI_tot_ins' event.
+#
+
+script()
+{
+        $dtrace -o $dtraceout -s /dev/stdin <<EOF
+        #pragma D option bufsize=128k
+
+        cpc:::PAPI_tot_ins-all-10000
+        {
+                @[probename] = count();
+        }
+EOF
+}
+
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+dtraceout=/tmp/dtrace.out.$$
+script 2>/dev/null &
+timeout=15
+
+#
+# Sleep while the above script fires into life. To guard against dtrace dying
+# and us sleeping forever we allow 15 secs for this to happen. This should be
+# enough for even the slowest systems.
+#
+while [ ! -f $dtraceout ]; do
+        sleep 1
+        timeout=$(($timeout-1))
+        if [ $timeout -eq 0 ]; then
+                echo "dtrace failed to start. Exiting."
+                exit 1
+        fi
+done
+
+cputrack -c PAPI_tot_ins sleep 10
+status=$?
+
+rm $dtraceout
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cputrackterminates.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cputrackterminates.ksh
new file mode 100755
index 0000000..58d1e79
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.cputrackterminates.ksh
@@ -0,0 +1,70 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+
+#
+# This script ensures that cputrack(1) will terminate when the cpc provider
+# kicks into life.
+#
+# The script will fail if:
+#	1) The system under test does not define the 'PAPI_tot_ins' event.
+#
+
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	#pragma D option bufsize=128k
+
+	cpc:::PAPI_tot_ins-all-10000
+	{
+		@[probename] = count();
+	}
+
+	tick-1s
+	/n++ > 10/
+	{
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+
+cputrack -c PAPI_tot_ins sleep 20 &
+cputrack_pid=$!
+sleep 5
+script 2>/dev/null &
+
+wait $cputrack_pid
+status=$?
+
+rm $dtraceout
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.toomanyenablings.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.toomanyenablings.d
new file mode 100644
index 0000000..a50bd71
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/err.toomanyenablings.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Test to check that attempting to enable too many probes will fail.
+ *
+ * This test will fail if:
+ *	1) We ever execute on a platform which is capable of programming 10
+ *	'PAPI_tot_ins' events simultaneously (which no current platforms are
+ *	capable of doing).
+ *	2) The system under test does not define the 'PAPI_tot_ins' event.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	exit(0);
+}
+
+cpc:::PAPI_tot_ins-all-10000,
+cpc:::PAPI_tot_ins-all-10001,
+cpc:::PAPI_tot_ins-all-10002,
+cpc:::PAPI_tot_ins-all-10003,
+cpc:::PAPI_tot_ins-all-10004,
+cpc:::PAPI_tot_ins-all-10005,
+cpc:::PAPI_tot_ins-all-10006,
+cpc:::PAPI_tot_ins-all-10007,
+cpc:::PAPI_tot_ins-all-10008,
+cpc:::PAPI_tot_ins-all-10009
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.allcpus.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.allcpus.ksh
new file mode 100755
index 0000000..7f026c9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.allcpus.ksh
@@ -0,0 +1,107 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# This script verifies that we can fire a probe on each CPU that is in
+# an online state.
+#
+# The script will fail if:
+#       1) The system under test does not define the 'PAPI_tot_ins' event.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+numproc=`psrinfo | tail -1 | cut -f1`
+cpu=0
+dtraceout=/var/tmp/dtrace.out.$$
+scriptout=/var/tmp/script.out.$$
+
+spin()
+{
+	while [ 1 ]; do
+		:
+	done
+}
+
+script()
+{
+        $dtrace -o $dtraceout -s /dev/stdin <<EOF
+	#pragma D option bufsize=128k
+	#pragma D option quiet
+
+        cpc:::PAPI_tot_ins-user-10000
+	/cpus[cpu] != 1/
+        {
+		cpus[cpu] = 1;
+		@a[cpu] = count();
+        }
+
+	tick-1s
+	/n++ > 10/
+	{
+		printa(@a);
+		exit(0);
+	}
+EOF
+}
+
+echo "" > $scriptout
+while [ $cpu -le $numproc ]
+do
+	if [ "`psrinfo -s $cpu 2> /dev/null`" -eq 1 ]; then
+		printf "%9d %16d\n" $cpu 1 >> $scriptout
+		spin &
+		allpids[$cpu]=$!
+		pbind -b $cpu $!
+	fi
+	cpu=$(($cpu+1))
+done
+echo "" >> $scriptout
+
+script
+
+diff $dtraceout $scriptout >/dev/null 2>&1
+status=$?
+
+# kill off the spinner processes
+cpu=0
+while [ $cpu -le $numproc ]
+do
+	if [ "`psrinfo -s $cpu 2> /dev/null`" -eq 1 ]; then
+		kill ${allpids[$cpu]}
+	fi
+	cpu=$(($cpu+1))
+done
+
+rm $dtraceout
+rm $scriptout
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.genericevent.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.genericevent.d
new file mode 100644
index 0000000..7ebf844
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.genericevent.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Test that we can successfully enable a probe using a generic event.
+ * Currently, all platforms implement 'PAPI_tot_ins' so we'll use that.
+ * Note that this test will fail if the system under test does not
+ * implement that event.
+ *
+ * This test will fail if:
+ *	1) The system under test does not define the 'PAPI_tot_ins' event.
+ */
+
+#pragma D option quiet
+#pragma D option bufsize=128k
+
+cpc:::PAPI_tot_ins-all-10000
+{
+	@[probename] = count();
+}
+
+tick-1s
+/n++ > 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.platformevent.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.platformevent.ksh
new file mode 100755
index 0000000..96d1ab8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/cpc/tst.platformevent.ksh
@@ -0,0 +1,81 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# This script ensures that we can enable a probe which specifies a platform
+# specific event.
+#
+
+if [ $# != 1 ]; then
+        print -u2 "expected one argument: <dtrace-path>"
+        exit 2
+fi
+
+dtrace=$1
+
+get_event()
+{
+        perl /dev/stdin /dev/stdout << EOF
+        open CPUSTAT, '/usr/sbin/cpustat -h |'
+            or die  "Couldn't run cpustat: \$!\n";
+        while (<CPUSTAT>) {
+                if (/(\s+)event\[*[0-9]-*[0-9]*\]*:/ && !/PAPI/) {
+                        @a = split(/ /, \$_);
+                        \$event = \$a[\$#a-1];
+                }
+        }
+
+        close CPUSTAT;
+        print "\$event\n";
+EOF
+}
+
+script()
+{
+        $dtrace -s /dev/stdin << EOD
+        #pragma D option quiet
+        #pragma D option bufsize=128k
+
+        cpc:::$1-all-10000
+        {
+                @[probename] = count();
+        }
+
+        tick-1s
+        /n++ > 5/
+        {
+                exit(0);
+        }
+EOD
+}
+
+event=$(get_event)
+script $event
+
+status=$?
+
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_LOCASSC.NonLocalAssoc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_LOCASSC.NonLocalAssoc.d
new file mode 100644
index 0000000..4c8ee50
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_LOCASSC.NonLocalAssoc.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * associative arrays may not be declared as local variables
+ *
+ * SECTION: Errtags/D_DECL_LOCASSC
+ *
+ */
+
+#pragma D option quiet
+
+this int a[int];
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_LONGINT.LongStruct.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_LONGINT.LongStruct.d
new file mode 100644
index 0000000..2c92bfd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_LONGINT.LongStruct.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * long and long long may only be used with integer or floating-point type
+ *
+ * SECTION: Errtags/D_DECL_LONGINT
+ *
+ */
+
+#pragma D option quiet
+
+long struct mystruct
+{
+	int i;
+};
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PARMCLASS.BadStorageClass.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PARMCLASS.BadStorageClass.d
new file mode 100644
index 0000000..8278747
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PARMCLASS.BadStorageClass.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * inappropriate storage class for function or associative array parameter
+ * throws a D_DECL_PARMCLASS
+ *
+ * SECTION: Errtags/D_DECL_PARMCLASS
+ *
+ */
+
+#pragma D option quiet
+
+
+int foo(static int);
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_NAME.VoidName.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_NAME.VoidName.d
new file mode 100644
index 0000000..3676c21
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_NAME.VoidName.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Assert that a void parameter in a declaration where void is permitted
+ * may not have a parameter formal name associated with it.
+ */
+
+int a(void v);
+
+BEGIN,
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_TYPE.Dyn.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_TYPE.Dyn.d
new file mode 100644
index 0000000..aecf549
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_TYPE.Dyn.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Assert that a function parameter in a declaration may not use a dynamic
+ * DTrace type such as an associative array type.
+ */
+
+int a(int a[int]);
+
+BEGIN,
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_VARARGS.VarLenArgs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_VARARGS.VarLenArgs.d
new file mode 100644
index 0000000..22dbbe9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_VARARGS.VarLenArgs.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * array tuples may not use variable-length argument lists
+ *
+ * SECTION: Errtags/ D_DECL_ARRVA
+ *
+ */
+
+#pragma D option quiet
+
+
+int a[...];
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_VOID.NonSoleVoid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_VOID.NonSoleVoid.d
new file mode 100644
index 0000000..620f0d7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_PROTO_VOID.NonSoleVoid.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * void must be sole parameter in a function declaration.
+ *
+ * SECTION: Errtags/D_DECL_FUNCVOID
+ *
+ */
+
+#pragma D option quiet
+
+int foo(int, void);
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_SIGNINT.UnsignedStruct.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_SIGNINT.UnsignedStruct.d
new file mode 100644
index 0000000..db2e451
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_SIGNINT.UnsignedStruct.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * signed and unsigned may only be used with integer type
+ *
+ * SECTION: Errtags/D_DECL_SIGNINT
+ *
+ */
+
+#pragma D option quiet
+
+/*DSTYLED*/
+unsigned struct mystruct {
+	int i;
+};
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_VOIDATTR.ShortVoidDecl.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_VOIDATTR.ShortVoidDecl.d
new file mode 100644
index 0000000..81f9081
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/err.D_DECL_VOIDATTR.ShortVoidDecl.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Attributes may not be used with void type.
+ *
+ * SECTION: Errtags/D_DECL_VOIDATTR
+ *
+ */
+
+#pragma D option quiet
+
+short void ptr;
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.arrays.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.arrays.d
new file mode 100644
index 0000000..34ddd5f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.arrays.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  Test various kinds of array declarations.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+extern int a1[];
+
+extern int a2[1];
+
+extern int a3[123][456];
+
+extern int a4[123][456][789];
+
+extern int a5[5], a6[6][6], a7[7][7][7];
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.basics.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.basics.d
new file mode 100644
index 0000000..4c1483e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.basics.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  Test a variety of extern declarations that exercise the different
+ *  kinds of declarations that we can process.
+ *
+ * SECTION:  Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+extern void *e1;
+extern char e2;
+extern signed char e3;
+extern unsigned char e4;
+extern short e5;
+extern signed short e6;
+extern unsigned short e7;
+extern int e8;
+extern e9;
+extern signed int e10;
+extern unsigned int e11;
+extern long e12;
+extern signed long e13;
+extern unsigned long e14;
+extern long long e15;
+extern signed long long e16;
+extern unsigned long long e17;
+extern float e18;
+extern double e19;
+extern long double e20;
+extern vnode_t e21;
+extern struct vnode e22;
+extern union sigval e23;
+extern enum uio_rw e24;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.funcs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.funcs.d
new file mode 100644
index 0000000..3b691eb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.funcs.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  Test various kinds of function declarations.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ */
+
+extern int getint(void);
+extern int *getptr(void);
+extern int *(*funcptr)(void);
+extern int **(**funcptrptr)(void);
+
+extern int noparms();
+extern int oneparm(int);
+extern int twoparms(int, int);
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.pointers.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.pointers.d
new file mode 100644
index 0000000..d0ab608
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.pointers.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  Test multiple extern declarations in a single list which build
+ *  up a chain of pointers to pointers to pointers ...
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ */
+
+extern int e0, *e1, **e2, ***e3, ****e4, *****e5;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.varargsfuncs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.varargsfuncs.d
new file mode 100644
index 0000000..c12363f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/decls/tst.varargsfuncs.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  Test functions declarations with varargs
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ */
+
+#pragma D option quiet
+
+extern int varargs1(...);
+extern int varargs2(int, ...);
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/badptr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/badptr.d
new file mode 100644
index 0000000..c48c729
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/badptr.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 5-1
+ *
+ * SECTION:
+ *	DocExamples/badptr
+ */
+
+BEGIN
+{
+	x = (int *)NULL;
+	y = *x;
+	trace(y);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/countdown.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/countdown.d
new file mode 100644
index 0000000..56b9881
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/countdown.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example
+ *
+ * SECTION:
+ *	DocExamples/other
+ */
+
+dtrace:::BEGIN
+{
+	i = 10;
+}
+
+profile:::tick-1sec
+/i > 0/
+{
+	trace(i--);
+}
+
+profile:::tick-1000
+/i == 0/
+{
+	trace("blastoff!");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/counter.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/counter.d
new file mode 100644
index 0000000..8b7b1b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/counter.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc
+ *
+ * SECTION:
+ *	DocExamples/other
+ */
+
+
+dtrace:::BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	i = i + 1;
+	trace(i);
+}
+
+dtrace:::END
+{
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/errorpath.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/errorpath.d
new file mode 100644
index 0000000..76fd07c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/errorpath.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 17-1
+ *
+ * SECTION:
+ *	DocExamples/errorpath
+ */
+
+
+BEGIN
+{
+	*(char *)NULL;
+}
+
+ERROR
+{
+	printf("Hit an error!");
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/hello.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/hello.d
new file mode 100644
index 0000000..8e1ef8f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/hello.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 1-1
+ *
+ * SECTION:
+ *	DocExamples/hello
+ */
+
+
+BEGIN
+{
+	trace("hello, world");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/kstat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/kstat.d
new file mode 100644
index 0000000..4987149
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/kstat.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 7-3
+ *
+ * SECTION:
+ *	DocExamples/kstat
+ */
+
+
+#pragma D option quiet
+
+pid$1:libkstat:kstat_data_lookup:entry
+{
+	self->ksname = arg1;
+}
+
+pid$1:libkstat:kstat_data_lookup:return
+/self->ksname != NULL && arg1 != NULL/
+{
+	this->str = copyinstr(self->ksname);
+	this->ksp = (kstat_named_t *)copyin(arg1, sizeof (kstat_named_t));
+	printf("%s has ui64 value %u\n", this->str, this->ksp->value.ui64);
+}
+
+pid$1:libkstat:kstat_data_lookup:return
+/self->ksname != NULL && arg1 == NULL/
+{
+	self->ksname = NULL;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/ksyms.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/ksyms.d
new file mode 100644
index 0000000..932262b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/ksyms.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 7-2
+ *
+ * SECTION:
+ *	DocExamples/ksyms
+ */
+
+
+/* Must run "strings -a /dev/ksyms in another shell on the system */
+
+
+#pragma D option quiet
+
+syscall::read:entry
+/curpsinfo->pr_psargs == "strings -a /dev/ksyms"/
+{
+	printf("read %u bytes to user address %x\n", arg2, arg1);
+	self->watched = 1;
+}
+
+syscall::read:return
+/self->watched/
+{
+	self->watched = 0;
+}
+
+fbt::uiomove:entry
+/self->watched/
+{
+	this->iov = args[3]->uio_iov;
+
+	printf("uiomove %u bytes to %p in pid %d\n", this->iov->iov_len,
+	    this->iov->iov_base, pid);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/renormalize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/renormalize.d
new file mode 100644
index 0000000..7d2c6af
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/renormalize.d
@@ -0,0 +1,55 @@
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	Verify doc example 9-1
+ *
+ * SECTION:
+ *	DocExamples/renormalize
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	start = timestamp;
+}
+
+syscall:::entry
+{
+	@func[execname] = count();
+}
+
+tick-10sec
+{
+	normalize(@func, (timestamp - start) / 1000000000);
+	printa(@func);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rtime.d
new file mode 100644
index 0000000..087e819
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rtime.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 3-1
+ *
+ * SECTION:
+ *	DocExamples/rtime
+ */
+
+
+#pragma D option quiet
+
+syscall::read:entry
+{
+	self->t = timestamp;
+}
+
+syscall::read:return
+/self->t != 0/
+{
+	printf("%d/%d spent %d nsecs in read(2)\n", pid,
+	    tid, timestamp - self->t);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rw.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rw.d
new file mode 100644
index 0000000..6358a7d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rw.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example
+ *
+ * SECTION:
+ *	DocExamples/other
+ */
+
+
+syscall::read:entry,
+syscall::write:entry
+/pid == 102429/
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rwinfo.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rwinfo.d
new file mode 100644
index 0000000..60f2b12
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rwinfo.d
@@ -0,0 +1,74 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 7-1
+ *
+ * SECTION:
+ *	DocExamples/rwinfo
+ */
+
+
+#pragma D option quiet
+
+struct callinfo {
+	uint64_t ts;
+	uint64_t elapsed;
+	uint64_t calls;
+	size_t maxbytes;
+};
+
+struct callinfo i[string];
+
+syscall::read:entry,
+syscall::write:entry
+/pid == 100551/
+{
+	i[probefunc].ts = timestamp;
+	i[probefunc].calls++;
+	i[probefunc].maxbytes = arg2 > i[probefunc].maxbytes ?
+	    arg2 : i[probefunc].maxbytes;
+}
+
+syscall::read:return,
+syscall::write:return
+/i[probefunc].ts != 0 && pid == 100551/
+{
+	i[probefunc].elapsed += timestamp - i[probefunc].ts;
+}
+
+END
+{
+	printf("      calls  max bytes  elapsed nsecs\n");
+	printf("-----  -----  ---------  -------------\n");
+	printf("   read %5d  %9d   %d\n", i["read"].calls,
+	    i["read"].maxbytes, i["read"].elapsed);
+	printf("   write %5d  %9d   %d\n", i["write"].calls,
+	    i["write"].maxbytes, i["write"].elapsed);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rwtime.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rwtime.d
new file mode 100644
index 0000000..2edffb9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/rwtime.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 7-1
+ *
+ * SECTION:
+ *	DocExamples/rwinfo
+ */
+
+
+syscall::read:entry,
+syscall::write:entry
+/pid == 100551/
+{
+	ts[probefunc] = timestamp;
+}
+
+syscall::read:return,
+syscall::write:return
+/(ts[probefunc] != 0) && (pid == 100551)/
+{
+	printf("%d nsecs\n", timestamp - ts[probefunc]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/specopen.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/specopen.d
new file mode 100755
index 0000000..dff3e62
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/specopen.d
@@ -0,0 +1,79 @@
+#!/usr/sbin/dtrace -Fs
+
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 13-1
+ *
+ * SECTION:
+ *	DocExamples/specopen
+ */
+
+syscall::open:entry,
+syscall::open64:entry
+{
+	self->spec = speculation();
+	speculate(self->spec);
+
+	printf("%s", stringof(copyinstr(arg0)));
+}
+
+fbt:::
+/self->spec/
+{
+	speculate(self->spec);
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec/
+{
+	speculate(self->spec);
+	trace(errno);
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec && errno != 0/
+{
+	commit(self->spec);
+	self->spec = 0;
+}
+
+syscall::open:return,
+syscall::open64:return
+/self->spec && errno == 0/
+{
+	discard(self->spec);
+	self->spec = 0;
+}
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/truss.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/truss.d
new file mode 100644
index 0000000..b792520
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/truss.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc
+ *
+ * SECTION:
+ *	DocExamples/truss
+ */
+
+
+
+dtrace:::BEGIN
+{
+	var = 30;
+	self->vaa = 24;
+}
+
+syscall::read:entry
+/pid == 102473/
+{
+	printf("var: %d, self->vaa: %d", var++, self->vaa++);
+}
+
+syscall::write:entry
+/pid == 102473/
+{
+	printf("var: %d, self->vaa: %d", var++, self->vaa++);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/trussrw.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/trussrw.d
new file mode 100644
index 0000000..9eb9bce
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/trussrw.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify doc example 1-2
+ *
+ * SECTION:
+ *	DocExamples/trussrw
+ */
+
+
+#pragma D option quiet
+
+syscall::read:entry,
+syscall::write:entry
+/pid == 100551/
+{
+	printf("%s(%d, 0x%x, %4d)", probefunc, arg0, arg1, arg2);
+}
+
+syscall::read:return,
+syscall::write:return
+/pid == 100551/
+{
+	printf("\t\t = %d\n", arg1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/userfunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/userfunc.d
new file mode 100755
index 0000000..0d83465
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/docsExamples/userfunc.d
@@ -0,0 +1,61 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   	Verifying doc example 21-1
+ *
+ * SECTION:
+ *	DocExamples/userfunc
+ *
+ */
+
+pid$1::$2:entry
+{
+	self->trace = 1;
+}
+
+pid$1::$2:return
+/self->trace/
+{
+	self->trace = 0;
+}
+
+pid$1:::entry,
+pid$1:::return
+/self->trace/
+{
+}
+
+
+
+
+
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_AGGREGATION.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_AGGREGATION.d
new file mode 100644
index 0000000..02b3243
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_AGGREGATION.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+#pragma D option strsize=1024
+#pragma D option aggsize=512
+
+BEGIN
+{
+	@["Harding"] = count();
+	@["Hoover"] = count();
+	@["Nixon"] = count();
+	@["Bush"] = count();
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_DBLERROR.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_DBLERROR.d
new file mode 100644
index 0000000..face4c8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_DBLERROR.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	trace(*(int *)NULL);
+}
+
+ERROR
+{
+	trace(*(int *)NULL);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_DYNAMIC.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_DYNAMIC.d
new file mode 100644
index 0000000..f8a90f0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_DYNAMIC.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option strsize=1024
+#pragma D option dynvarsize=512
+
+BEGIN
+{
+	a["Harding"] = 1;
+	a["Hoover"] = 1;
+	a["Nixon"] = 1;
+	a["Bush"] = 1;
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_PRINCIPAL.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_PRINCIPAL.d
new file mode 100644
index 0000000..8389ce0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_PRINCIPAL.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option strsize=1024
+#pragma D option bufsize=512
+
+BEGIN
+{
+	trace("Harding");
+	trace("Hoover");
+	trace("Nixon");
+	trace("Bush");
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_PRINCIPAL.end.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_PRINCIPAL.end.d
new file mode 100644
index 0000000..a723019
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_PRINCIPAL.end.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option strsize=1024
+#pragma D option bufsize=512
+
+BEGIN
+{
+	exit(0);
+}
+
+END
+{
+	trace("Harding");
+	trace("Hoover");
+	trace("Nixon");
+	trace("Bush");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_SPEC.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_SPEC.d
new file mode 100644
index 0000000..8f6df3c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_SPEC.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option nspec=1
+#pragma D option specsize=32
+#pragma D option strsize=512
+
+BEGIN
+{
+	spec = speculation();
+	speculate(spec);
+	trace("The, SystemTap, The.");
+}
+
+BEGIN
+{
+	commit(spec);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_SPECUNAVAIL.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_SPECUNAVAIL.d
new file mode 100644
index 0000000..1fd3974
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_SPECUNAVAIL.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option nspec=1
+
+BEGIN,
+BEGIN,
+BEGIN,
+BEGIN
+{
+	spec = speculation();
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d
new file mode 100644
index 0000000..f5d6416
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option destructive
+#pragma D option jstackstrsize=1
+#pragma D option quiet
+
+BEGIN
+{
+	system("java -version");
+}
+
+syscall:::entry
+{
+	@[jstack()] = count();
+}
+
+proc:::exit
+/progenyof($pid) && execname == "java"/
+{
+	exit(0);
+}
+
+END
+{
+	printa("\r", @);
+	printf("\n");
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/err.D_PDESC_ZERO.InvalidDescription1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/err.D_PDESC_ZERO.InvalidDescription1.d
new file mode 100644
index 0000000..a0d1767
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/err.D_PDESC_ZERO.InvalidDescription1.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: An invalid probe description throws a D_PDESC_ZERO error.
+ *
+ * SECTION: Errtags/D_PDESC_ZERO
+ *
+ */
+
+#pragma D option quiet
+
+fbt:bippity:boppity:boo
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.APIVersion.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.APIVersion.d
new file mode 100644
index 0000000..2156489
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.APIVersion.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/* Assertion:
+ * Use the -V option to printout API version.
+ *
+ * SECTION:
+ *	dtrace Utility/-V Option
+ *
+ * NOTES:
+ * Use /usr/sbin/dtrace -V on command line.
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.AddSearchPath.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.AddSearchPath.d
new file mode 100644
index 0000000..53fe67a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.AddSearchPath.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * The -I option can be used to search path for #include files when used
+ * in conjunction with the -C option. The specified directory is inserted into
+ * the search path adhead of the default directory list.
+ *
+ * SECTION: dtrace Utility/-C Option;
+ * 	dtrace Utility/-I Option
+ *
+ * NOTES:
+ * Create a file <filename> and define the variable VALUE in it. Move it a
+ * directory <dirname> different from the current directory. Change the value
+ * of <filename> appropriately in the code below.
+ * Invoke: dtrace -C -I <dirname> -s man.AddSearchPath.d
+ * Verify VALUE.
+ */
+
+
+#pragma D option quiet
+
+#include "filename"
+
+BEGIN
+{
+	printf("Value of VALUE: %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d
new file mode 100755
index 0000000..3cd9d02
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.CoalesceTrace.d
@@ -0,0 +1,67 @@
+#!/bin/ksh -p
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ *
+ * ASSERTION:
+ * Testing -F option with several probes.
+ *
+ * SECTION: dtrace Utility/-F Option
+ *
+ * NOTES: Manually verify using:
+ * "/usr/sbin/dtrace -F -s man.CoalesceTrace.d" on command line.
+ *
+ * Verify that the for the indent characters are -> <- for non-syscall
+ * entry/return pairs (e.g. fbt ones) and => <= for syscall ones and
+ * | for profile ones.
+ *
+ */
+
+BEGIN
+{
+	i = 0;
+	j = 0;
+	k = 0;
+}
+
+syscall::read:
+{
+	printf("syscall: %d\n", i++);
+}
+
+fbt:genunix:read:
+{
+	printf("fbt: %d\n", j++);
+}
+
+profile:::tick-10sec
+{
+	printf("profile: %d\n", k++);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ELFGeneration.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ELFGeneration.d
new file mode 100644
index 0000000..a30a140
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ELFGeneration.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -G option with dtrace utility produces an ELF file containing a
+ * DTrace program. If the filename used with the -s option does ends
+ * with .d, and the -o option is not used, then the output ELF file is
+ * in filename.o
+ *
+ * SECTION: dtrace Utility/-G Option
+ *
+ * NOTES: Use this file as
+ * /usr/sbin/dtrace -G -s man.ELFGeneration.d
+ * Delete the file man.ELFGeneration.d.o
+ *
+ */
+
+BEGIN
+{
+	printf("This test should compile.\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.IncludedFilePath.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.IncludedFilePath.d
new file mode 100644
index 0000000..f4e4e4e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.IncludedFilePath.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using the -CH option with dtrace invocation displays the list of
+ * pathnames of included files one per line to the stderr.
+ *
+ * SECTION: dtrace Utility/-C Option;
+ *	dtrace Utility/-H Option
+ *
+ * NOTES: Use this file as
+ * /usr/sbin/dtrace -qCH -s man.IncludedFilePath.d
+ *
+ */
+
+#include "stdio.h"
+
+BEGIN
+{
+	printf("This test should compile.\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithFunctions b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithFunctions
new file mode 100644
index 0000000..e3db127
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithFunctions
@@ -0,0 +1,99 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -l option with -f option.
+ *
+ * SECTION: dtrace Utility/-l Option;
+ * 	dtrace Utility/-f Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1)
+ * /usr/sbin/dtrace -lf profile
+ * RESULT: Silent output without any probes listed.
+ *
+ * 2)
+ * /usr/sbin/dtrace -lf genunix
+ * RESULT: Silent output without any probes listed.
+ *
+ * 3)
+ * /usr/sbin/dtrace -lf read
+ * RESULT: matching list of probes with function read.
+ *
+ * 4)
+ * /usr/sbin/dtrace -lf genunix:read
+ * RESULT: matching list of probes with module genunix and
+ * function read.
+ *
+ * 5)
+ * /usr/sbin/dtrace -lf sysinfo:genunix:read
+ * RESULT: matching list of probes with provider sysinfo, module
+ * genunix and function read.
+ *
+ * 6)
+ * /usr/sbin/dtrace -lf :genunix::
+ * RESULT: Silent output without any probes listed.
+ *
+ * 7)
+ * /usr/sbin/dtrace -lf ::read:
+ * RESULT: Silent output without any probes listed.
+ *
+ * 8)
+ * /usr/sbin/dtrace -lf profile:::profile-97
+ * RESULT: not a valid probe description.
+ *
+ * 9)
+ * /usr/sbin/dtrace -lf read -lf write
+ * RESULT: matching list of both read and write probes.
+ *
+ * 10)
+ * /usr/sbin/dtrace -lf read -lm fight
+ * RESULT: List of only read probes.
+ *
+ * 11)
+ * /usr/sbin/dtrace -lf fight -lf write
+ * RESULT: List of only write probes.
+ *
+ * 12) Has been automated.
+ * /usr/sbin/dtrace -lf fbt:des:des3_crunch_block:return
+ * RESULT: not a valid probe description.
+ *
+ * 13)
+ * /usr/sbin/dtrace -lf read'{printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ *
+ * 14)
+ * /usr/sbin/dtrace -lf read '{printf("FOUND");}'
+ * RESULT: List of only read probes.
+ *
+ * 15)
+ * /usr/sbin/dtrace -lf read'/probename == "entry"/{printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithIDs b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithIDs
new file mode 100644
index 0000000..2b46ce3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithIDs
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -l option with -i option.
+ *
+ * SECTION: dtrace Utility/-l Option;
+ * 	dtrace Utility/-i Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1)
+ * /usr/sbin/dtrace -l
+ * RESULT: List of all available probes.
+ *
+ * 2)
+ * /usr/sbin/dtrace -li 0
+ * RESULT: invalid probe identifier 0.
+ *
+ * 3) automated in tst.InvalidId1.d.ksh
+ * /usr/sbin/dtrace -li -3
+ * RESULT: not a valid id range
+ *
+ * 4)
+ * /usr/sbin/dtrace -li 0-2
+ * RESULT: List of probes including 1 and 2 or error.
+ *
+ * 5) automated in tst.InvalidId2.d.ksh
+ * /usr/sbin/dtrace -li 4-2
+ * RESULT: not a valid id range
+ *
+ * 6) automated in tst.InvalidId3.d.ksh
+ * /usr/sbin/dtrace -li 2-2
+ * RESULT: not a valid id range
+ *
+ * 7)
+ * /usr/sbin/dtrace -li 1 2 3 4
+ * RESULT: only the first probe id is listed and other extraneous
+ * charaters are not considered.
+ *
+ * 8)
+ * /usr/sbin/dtrace -li 0 - 2
+ * RESULT: only the first probe id is listed and other extraneous
+ * charaters are not considered.
+ *
+ * 9)
+ * /usr/sbin/dtrace -li 1 -li 2-4 -li 4 -li 5
+ * RESULT: Probe descriptions listed for all ids specified. Once
+ * for each specification on the command line.
+ *
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithModules b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithModules
new file mode 100644
index 0000000..167c72a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithModules
@@ -0,0 +1,91 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -l option with -m option.
+ *
+ * SECTION: dtrace Utility/-l Option;
+ *	dtrace Utility/-m Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1)
+ * /usr/sbin/dtrace -lm profile
+ * RESULT: Silent output without any probes listed.
+ *
+ * 2)
+ * /usr/sbin/dtrace -lm genunix
+ * RESULT: matching list of probes with module name genunix.
+ *
+ * 3)
+ * /usr/sbin/dtrace -lm vtrace:genunix
+ * RESULT: matching list of probes with provider vtrace and module
+ * genunix.
+ *
+ * 4) automated in tst.InvalidModule1.d.ksh
+ * /usr/sbin/dtrace -lm :genunix::
+ * RESULT: not a valid probe description
+ *
+ * 5) automated in tst.InvalidModule2.d.ksh
+ * /usr/sbin/dtrace -lm profile:::profile-97
+ * RESULT: not a valid probe description.
+ *
+ * 6)
+ * /usr/sbin/dtrace -lm genunix -lm unix
+ * RESULT: matching list of both genunix and unix probes.
+ *
+ * 7)
+ * /usr/sbin/dtrace -lm genunix -lm foounix
+ * RESULT: List of only genunix probes.
+ *
+ * 8)
+ * /usr/sbin/dtrace -lm foounix -lm unix
+ * RESULT: List of only unix probes.
+ *
+ * 9) automated in tst.InvalidModule3.d.ksh
+ * /usr/sbin/dtrace -lm fbt:des:des3_crunch_block:return
+ * RESULT: not a valid probe description.
+ *
+ * 10)
+ * /usr/sbin/dtrace -lm fbt:genunix'{printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ *
+ * 11)
+ * /usr/sbin/dtrace -lm genunix'{printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ *
+ * 12)
+ * /usr/sbin/dtrace -lm unix '{printf("FOUND");}'
+ * RESULT: List of only unix probes.
+ *
+ * 13) automated in tst.InvalidModule4.d.ksh
+ * /usr/sbin/dtrace -lm
+ * unix'/probefunc == "preempt"/{printf("FOUND");}'
+ * RESULT: not a valid probe description.
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithNames b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithNames
new file mode 100644
index 0000000..aabf1b2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithNames
@@ -0,0 +1,128 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -l option with -n option.
+ *
+ * SECTION: dtrace Utility/-l Option;
+ * 	dtrace Utility/-n Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1)
+ * /usr/sbin/dtrace -ln profile
+ * RESULT: Silent output without any probes listed.
+ *
+ * 2)
+ * /usr/sbin/dtrace -ln genunix
+ * RESULT: Silent output without any probes listed.
+ *
+ * 3)
+ * /usr/sbin/dtrace -ln read
+ * RESULT: Silent output without any probes listed.
+ *
+ * 4)
+ * /usr/sbin/dtrace -ln BEGIN
+ * RESULT: list of one probe with name BEGIN.
+ *
+ * 5)
+ * /usr/sbin/dtrace -ln begin
+ * RESULT: Silent output without any probes listed.
+ *
+ * 6)
+ * /usr/sbin/dtrace -ln genunix:read
+ * RESULT: Silent output without any probes listed.
+ *
+ * 7)
+ * /usr/sbin/dtrace -ln genunix:read:
+ * RESULT: matching list of probes with module genunix and
+ * function read.
+ *
+ * 8)
+ * /usr/sbin/dtrace -ln sysinfo:genunix:read
+ * RESULT: Silent output without any probes listed.
+ *
+ * 9)
+ * /usr/sbin/dtrace -ln sysinfo:genunix:read:
+ * RESULT: matching list of probes with provider sysinfo, module
+ * genunix and function read.
+ *
+ * 10) /usr/sbin/dtrace -ln :genunix::
+ * RESULT: matching list of probes with module genunix
+ *
+ * 11)
+ * /usr/sbin/dtrace -ln :genunix:
+ * RESULT: Silent output without any probes listed.
+ *
+ * 12)
+ * /usr/sbin/dtrace -ln ::read:
+ * RESULT: matching list of probes with and function read.
+ *
+ * 13)
+ * /usr/sbin/dtrace -ln profile:::profile-97
+ * RESULT: matching list of probes with provider profile and function
+ * profile-97
+ *
+ * 14)
+ * /usr/sbin/dtrace -ln read: -ln write:
+ * RESULT: matching list of both read and write probes.
+ *
+ * 15)
+ * /usr/sbin/dtrace -ln read: -ln fight:
+ * RESULT: List of only read probes.
+ *
+ * 16)
+ * /usr/sbin/dtrace -ln fight: -ln write:
+ * RESULT: List of only write probes.
+ *
+ * 17)
+ * /usr/sbin/dtrace -ln fbt:des:des3_crunch_block:return
+ * RESULT: Silent output of only the header.
+ *
+ * 18)
+ * /usr/sbin/dtrace -ln read:'{printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ *
+ * 19)
+ * /usr/sbin/dtrace -ln read:entry'{printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ *
+ * 20)
+ * /usr/sbin/dtrace -ln BEGIN'{Printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ *
+ * 21)
+ * /usr/sbin/dtrace -ln BEGIN '{printf("FOUND");}'
+ * RESULT: List of only BEGIN probe.
+ *
+ * 22)
+ * /usr/sbin/dtrace -ln
+ * BEGIN'/probename == "entry"/{printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithProviders b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithProviders
new file mode 100644
index 0000000..961d409
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ListProbesWithProviders
@@ -0,0 +1,82 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -l option with -P option.
+ *
+ * SECTION: dtrace Utility/-l Option;
+ * 	dtrace Utility/-P Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1)
+ * /usr/sbin/dtrace -lP profile
+ * RESULT: List of only profile probes.
+ *
+ * 2)
+ * /usr/sbin/dtrace -lP foofile
+ * RESULT: Silent output without any probes listed.
+ *
+ * 3) automated in tst.InvalidProvider2.d.ksh
+ * /usr/sbin/dtrace -lP profile:::
+ * RESULT: not a valid probe description
+ *
+ * 4) automated in tst.InvalidProvider1.d.ksh
+ * /usr/sbin/dtrace -lP profile:::profile-97
+ * RESULT: not a valid probe description.
+ *
+ * 5)
+ * /usr/sbin/dtrace -lP profile -lP syscall
+ * RESULT: matching list of both profile and syscall probes.
+ *
+ * 6)
+ * /usr/sbin/dtrace -lP profile -lP foofile
+ * RESULT: List of only profile probes.
+ *
+ * 7)
+ * /usr/sbin/dtrace -lP foofile -lP profile
+ * RESULT: List of only profile probes.
+ *
+ * 8) authomated in tst.InvalidProvider3.d.ksh
+ * /usr/sbin/dtrace -lP fbt:des:des3_crunch_block:return
+ * RESULT: not a valid probe description.
+ *
+ * 9)
+ * /usr/sbin/dtrace -lP profile'{printf("FOUND");}'
+ * RESULT: Silent output without any probes listed.
+ *
+ * 10)
+ * /usr/sbin/dtrace -lP profile '{printf("FOUND");}'
+ * RESULT: List of only profile probes.
+ *
+ * 11) automated in tst.InvalidProvider4.d.ksh
+ * /usr/sbin/dtrace -lP
+ * profile'/probename == "profile-199"/{printf("FOUND");}'
+ * RESULT: not a valid probe description.
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ShowCompilerCode.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ShowCompilerCode.d
new file mode 100644
index 0000000..556811d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.ShowCompilerCode.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -S option with dtrace utility shows the intermediate compiler code.
+ *
+ * SECTION: dtrace Utility/-S Option
+ *
+ * NOTES: Use this file as
+ * /usr/sbin/dtrace -qSs man.ShowCompilerCode.d
+ *
+ */
+
+BEGIN
+{
+	printf("This test should compile %d\n", 1);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceFunctions b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceFunctions
new file mode 100644
index 0000000..4c9c1c5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceFunctions
@@ -0,0 +1,115 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -f option.
+ *
+ * SECTION: dtrace Utility/-f Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1) automated in tst.InvalidTraceFunc1.d.ksh
+ * /usr/sbin/dtrace -f profile
+ * RESULT: invalid probe specifier
+ *
+ * 2) automated in tst.InvalidTraceFunc2.d.ksh
+ * /usr/sbin/dtrace -f genunix
+ * RESULT: invalid probe specifier
+ *
+ * 3)
+ * /usr/sbin/dtrace -f read
+ * RESULT: tracing of matching list of probes with function read.
+ *
+ * 4) automated in tst.InvalidTraceFunc3.d.ksh
+ * /usr/sbin/dtrace -f read:
+ * RESULT: invalid probe specifier
+ *
+ * 5)
+ * /usr/sbin/dtrace -f ::read
+ * RESULT: tracing of matching list of probes with function read.
+ *
+ * 6) automated in tst.InvalidTraceFunc4.d.ksh
+ * /usr/sbin/dtrace -f ::read:
+ * RESULT: invalid probe specifier
+ *
+ * 7)
+ * /usr/sbin/dtrace -f genunix:read
+ * RESULT: tracing of probes with module genunix and function read.
+ *
+ * 8)
+ * /usr/sbin/dtrace -f sysinfo:genunix:read
+ * RESULT: tracing of probes with provider sysinfo, module genunix
+ * and function read.
+ *
+ * 9)
+ * /usr/sbin/dtrace -f sysinfo::read
+ * RESULT: tracing of probes with provider sysinfo and function read.
+ *
+ * 10) automated in tst.InvalidTraceFunc5.d.ksh
+ * /usr/sbin/dtrace -f :genunix::
+ * RESULT: invalid probe specifier
+ *
+ * 11) automated in tst.InvalidTraceFunc6.d.ksh
+ * /usr/sbin/dtrace -f profile:::profile-97
+ * RESULT: invalid probe specifier.
+ *
+ * 12) 
+ * /usr/sbin/dtrace -f read -f write
+ * RESULT: tracing of both read and write probes.
+ *
+ * 13)
+ * /usr/sbin/dtrace -f read -f fight
+ * RESULT: Count of matching read probes and invalid probe specifier
+ * for fight
+ *
+ * 14) automated in tst.InvalidTraceFunc8.d.ksh
+ * /usr/sbin/dtrace -f fight -f write
+ * RESULT: invalid probe specifier.
+ *
+ * 15) automated in tst.InvalidTraceFunc7.d.ksh
+ * /usr/sbin/dtrace -f fbt:des:des3_crunch_block:return
+ * RESULT: invalid probe specifier.
+ *
+ * 16)
+ * /usr/sbin/dtrace -f read'{printf("FOUND");}'
+ * RESULT: tracing of probes with function read and with message FOUND
+ *
+ * 17)
+ * /usr/sbin/dtrace -f ::read'{printf("FOUND");}'
+ * RESULT: tracing of probes with function read and with message FOUND
+ *
+ * 18) automated in tst.InvalidTraceFunc9.d.ksh
+ * /usr/sbin/dtrace -f read '{printf("FOUND");}'
+ * RESULT: invalid probe specifier.
+ *
+ * 19)
+ * /usr/sbin/dtrace -f read'/probename == "entry"/{printf("FOUND");}'
+ * RESULT: tracing of probes with function read, name entry and with
+ * message FOUND
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceIDs b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceIDs
new file mode 100644
index 0000000..d9615b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceIDs
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -l option with -i option.
+ *
+ * SECTION: dtrace Utility/-l Option;
+ * 	dtrace Utility/-i Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1) automated in tst.InvalidTraceID1.d.ksh
+ * /usr/sbin/dtrace -i 0
+ * RESULT: invalid probe specifier.
+ *
+ * 2) automated in tst.InvalidTraceID2.d.ksh
+ * /usr/sbin/dtrace -i -3
+ * RESULT: not a valid id range
+ *
+ * 3) automated in tst.InvalidTraceID3.d.ksh
+ * /usr/sbin/dtrace -i 0-2
+ * RESULT: not a valid id range
+ *
+ * 4) automated in tst.InvalidTraceID4.d.ksh
+ * /usr/sbin/dtrace -i 4-2
+ * RESULT: not a valid id range
+ *
+ * 5) automated in tst.InvalidTraceID5.d.ksh
+ * /usr/sbin/dtrace -i 2-2
+ * RESULT: not a valid id range
+ *
+ * 6) automated in tst.InvalidTraceID6.d.ksh
+ * /usr/sbin/dtrace -i 1 2 3 4
+ * RESULT: invalid probe specifier.
+ *
+ * 7) automated in tst.InvalidTraceID7.d.ksh
+ * /usr/sbin/dtrace -i 0 - 2
+ * RESULT: invalid probe specifier.
+ *
+ * 8)
+ * /usr/sbin/dtrace -i 1 -i 2-4 -i 4 -i 5
+ * RESULT: Only the BEGIN probe is traced and the others are not.
+ *
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceModule b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceModule
new file mode 100644
index 0000000..9c4401e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceModule
@@ -0,0 +1,114 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Tracing a module using the -m option.
+ *
+ * SECTION: dtrace Utility/-m Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1) automated in tst.InvalidTraceModule1.d.ksh
+ * /usr/sbin/dtrace -m profile
+ * RESULT: invalid probe specifier
+ *
+ * 2)
+ * /usr/sbin/dtrace -m genunix
+ * RESULT: trace of all probes with module genunix.
+ *
+ * 3)
+ * /usr/sbin/dtrace -m vtrace:genunix
+ * RESULT: trace of probes with provider vtrace and module genunix.
+ *
+ * 4) automated in tst.InvalidTraceModule2.d.ksh
+ * /usr/sbin/dtrace -m :genunix::
+ * RESULT: invalid probe specifier
+ *
+ * 5)
+ * /usr/sbin/dtrace -m :genunix
+ * RESULT: trace of all probes with module genunix.
+ *
+ * 6) automated in tst.InvalidTraceModule3.d.ksh
+ * /usr/sbin/dtrace -m genunix::
+ * RESULT: invalid probe specifier
+ *
+ * 7) automated in tst.InvalidTraceModule4.d.ksh
+ * /usr/sbin/dtrace -m profile:::profile-97
+ * RESULT: not a valid probe description.
+ *
+ * 8) 
+ * /usr/sbin/dtrace -m genunix -m unix
+ * RESULT: tracing of both genunix and unix probes.
+ *
+ * 9)
+ * /usr/sbin/dtrace -m genunix -m foounix
+ * RESULT: Number of probes matching the description genunix
+ * and an invalid probe specifier for foounix.
+ *
+ * 10) automated in tst.InvalidTraceModule5.d.ksh
+ * /usr/sbin/dtrace -m foounix -m unix
+ * RESULT: invalid probe specifier for foounix.
+ *
+ * 11) automated in tst.InvalidTraceModule6.d.ksh
+ * /usr/sbin/dtrace -m fbt:des:des3_crunch_block:return
+ * RESULT: invalid probe description.
+ *
+ * 12)
+ * /usr/sbin/dtrace -m fbt:genunix'{printf("FOUND");}'
+ * RESULT: tracing of all the probes matching provider fbt and module
+ * genunix.
+ *
+ * 13)
+ * /usr/sbin/dtrace -m genunix'{printf("FOUND");}'
+ * RESULT: tracing of all the probes matching module genunix with
+ * message FOUND
+ *
+ * 14)
+ * /usr/sbin/dtrace -m :genunix'{printf("FOUND");}'
+ * RESULT: tracing of all the probes matching module genunix with
+ * message FOUND
+ *
+ * 15) automated in tst.InvalidTraceModule7.d.ksh
+ * /usr/sbin/dtrace -m genunix::'{printf("FOUND");}'
+ * RESULT: invalid probe specifier.
+ *
+ * 16) automated in tst.InvalidTraceModule8.d.ksh
+ * /usr/sbin/dtrace -m genunix:'{printf("FOUND");}'
+ * RESULT: invalid probe specifier.
+ *
+ * 17)
+ * /usr/sbin/dtrace -m unix '{printf("FOUND");}'
+ * RESULT: invalid probe specifier.
+ *
+ * 18)
+ * /usr/sbin/dtrace -m
+ * unix'/probefunc == "preempt"/{printf("FOUND");}'
+ * RESULT: tracing of all the probes matching module genunix,
+ * probe function preempt with message FOUND.
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceNames b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceNames
new file mode 100644
index 0000000..c3e7555
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceNames
@@ -0,0 +1,129 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -n option.
+ *
+ * SECTION: dtrace Utility/-n Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1) automated in tst.InvalidTraceName1.d.ksh
+ * /usr/sbin/dtrace -n profile
+ * RESULT: invalid probe specifier
+ *
+ * 2) automated in tst.InvalidTraceName2.d.ksh
+ * /usr/sbin/dtrace -n genunix
+ * RESULT: invalid probe specifier
+ *
+ * 3) automated in tst.InvalidTraceName3.d.ksh
+ * /usr/sbin/dtrace -n read
+ * RESULT: invalid probe specifier
+ *
+ * 4)
+ * /usr/sbin/dtrace -n BEGIN
+ * RESULT: trace of one probe with name BEGIN.
+ *
+ * 5) automated in tst.InvalidTraceName4.d.ksh
+ * /usr/sbin/dtrace -n begin
+ * RESULT: invalid probe specifier
+ *
+ * 6) automated in tst.InvalidTraceName5.d.ksh
+ * /usr/sbin/dtrace -n genunix:read
+ * RESULT: invalid probe specifier
+ *
+ * 7)
+ * /usr/sbin/dtrace -n genunix:read:
+ * RESULT: trace of probes with module genunix and function read.
+ *
+ * 8) automated in tst.InvalidTraceName6.d.ksh
+ * /usr/sbin/dtrace -n sysinfo:genunix:read
+ * RESULT: invalid probe specifier
+ *
+ * 9)
+ * /usr/sbin/dtrace -n sysinfo:genunix:read:
+ * RESULT: tracing of probes with provider sysinfo, module genunix
+ * and function read.
+ *
+ * 10)
+ * /usr/sbin/dtrace -n :genunix::
+ * RESULT: tracing of probes with module genunix
+ *
+ * 11) automated in tst.InvalidTraceName7.d.ksh
+ * /usr/sbin/dtrace -n :genunix:
+ * RESULT: invalid probe specifier
+ *
+ * 12)
+ * /usr/sbin/dtrace -n ::read:
+ * RESULT: tracing of probes with function read.
+ *
+ * 13)
+ * /usr/sbin/dtrace -n profile:::profile-97
+ * RESULT: tracing of probes with provider profile and name
+ * profile-97
+ *
+ * 14)
+ * /usr/sbin/dtrace -n read: -n write:
+ * RESULT: tracing of both read and write probes.
+ *
+ * 15)
+ * /usr/sbin/dtrace -n read: -n fight:
+ * RESULT: Count of mathching read probes and invalid probe specifier
+ * for fight:
+ *
+ * 16) automated in tst.InvalidTraceName8.d.ksh
+ * /usr/sbin/dtrace -n fight: -n write:
+ * RESULT: invalid probe specifier
+ *
+ * 17)
+ * /usr/sbin/dtrace -n fbt:des:des3_crunch_block:return
+ * RESULT: trace of the specified probe.
+ *
+ * 18)
+ * /usr/sbin/dtrace -n read:'{printf("FOUND");}'
+ * RESULT: Trace of all the probes with module read and a message
+ * saying FOUND.
+ *
+ * 19)
+ * /usr/sbin/dtrace -n read:entry'{printf("FOUND");}'
+ * RESULT: Trace of all the probes with module read, name entry.Output
+ * of a message saying FOUND.
+ *
+ * 20)
+ * /usr/sbin/dtrace -n BEGIN'{printf("FOUND");}'
+ * RESULT: Trace of the BEGIN probe with the message FOUND.
+ *
+ * 21) automated in tst.InvalidTraceName9.d.ksh
+ * /usr/sbin/dtrace -n BEGIN '{printf("FOUND");}'
+ * RESULT: invalid probe specifier
+ *
+ * 22)
+ * /usr/sbin/dtrace -n BEGIN'/probename == "entry"/{printf("FOUND");}'
+ * RESULT: Tracing of BEGIN function but no message FOUND.
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceProvider b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceProvider
new file mode 100644
index 0000000..f52f395
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.TraceProvider
@@ -0,0 +1,83 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -P option to trace all the probes provided by the particular
+ * provider.
+ *
+ * SECTION: dtrace Utility/-P Option
+ *
+ * NOTES: Manually check:
+ *
+ * 1)
+ * /usr/sbin/dtrace -P profile
+ * RESULT: Trace of all profile probes.
+ *
+ * 2) automated in tst.InvalidTraceProvider1.d.ksh
+ * /usr/sbin/dtrace -P foofile
+ * RESULT: invalid probe specifier
+ *
+ * 3) automated in tst.InvalidTraceProvider2.d.ksh
+ * /usr/sbin/dtrace -P profile:::
+ * RESULT: invalid probe specifier
+ *
+ * 4) automated in tst.InvalidTraceProvider3.d.ksh
+ * /usr/sbin/dtrace -P profile:::profile-97
+ * RESULT: invalid probe specifier
+ *
+ * 5)
+ * /usr/sbin/dtrace -P profile -P syscall
+ * RESULT: matching traces of both profile and syscall probes.
+ *
+ * 6)
+ * /usr/sbin/dtrace -P profile -P foofile
+ * RESULT: Count of profile probes that matched and invalid
+ * probe specifier for foofile and no tracing.
+ *
+ * 7) automated in tst.InvalidTraceProvider4.d.ksh
+ * /usr/sbin/dtrace -P fbt:des:des3_crunch_block:return
+ * RESULT: invalid probe specifier
+ *
+ * 8)
+ * /usr/sbin/dtrace -P profile'{printf("FOUND");}'
+ * RESULT: Traces of all the matching profile probes with the
+ * FOUND message.
+ *
+ * 9) automated in tst.InvalidTraceProvider5.d.ksh
+ * /usr/sbin/dtrace -P profile '{printf("FOUND");}'
+ * RESULT: invalid probe specifier
+ *
+ * 10)
+ * /usr/sbin/dtrace -P
+ * profile'/probename == "profile-199"/{printf("FOUND");}'
+ * RESULT: Traces of the matching profile probe with the
+ * FOUND message.
+ *
+ *
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.VerboseStabilityReport.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.VerboseStabilityReport.d
new file mode 100644
index 0000000..2374228
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/man.VerboseStabilityReport.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using -v option with dtrace utility produces a program stability report
+ * showing the minimum interface stability and dependency level for
+ * the specified D programs.
+ *
+ * SECTION: dtrace Utility/-s Option;
+ * 	dtrace Utility/-v Option
+ *
+ * NOTES: Use this file as
+ * /usr/sbin/dtrace -vs man.VerboseStabilityReport.d
+ *
+ */
+
+BEGIN
+{
+	printf("This test should compile: %d\n", 2);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh
new file mode 100755
index 0000000..2f49f73
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh
@@ -0,0 +1,82 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -I option can be used to search path for #include files when used
+# in conjunction with the -C option. The specified directory is inserted into
+# the search path adhead of the default directory list.
+#
+# SECTION: dtrace Utility/-C Option
+# SECTION: dtrace Utility/-I Option
+#
+##
+
+script()
+{
+	$dtrace -C -I /tmp -s /dev/stdin <<EOF
+	#pragma D option quiet
+#include "test.h"
+
+	BEGIN
+	/1520 != VALUE/
+	{
+		printf("VALUE: %d, Test should fail\n", VALUE);
+		exit(1);
+	}
+
+	BEGIN
+	/1520 == VALUE/
+	{
+		printf("VALUE: %d, Test should pass\n", VALUE);
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+tempfile=/tmp/test.h
+echo "#define VALUE 1520" > $tempfile
+
+dtrace=$1
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+	exit $status
+fi
+
+/usr/bin/rm -f $tempfile
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeGiga.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeGiga.d.ksh
new file mode 100644
index 0000000..2f0c567
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeGiga.d.ksh
@@ -0,0 +1,45 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# ASSERTION:
+# The trace buffer size can include any of the size suffixes k, m, g or t
+#
+# SECTION: dtrace Utility/-b Option
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -b 1g -b 2g -e
+
+exit $?
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeKilo.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeKilo.d.ksh
new file mode 100644
index 0000000..d969b48
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeKilo.d.ksh
@@ -0,0 +1,45 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# ASSERTION:
+# The trace buffer size can include any of the size suffixes k, m, g or t
+#
+# SECTION: dtrace Utility/-b Option
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -b 1k -b 2k -e
+
+exit $?
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeMega.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeMega.d.ksh
new file mode 100644
index 0000000..a08327a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeMega.d.ksh
@@ -0,0 +1,45 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# ASSERTION:
+# The trace buffer size can include any of the size suffixes k, m, g or t
+#
+# SECTION: dtrace Utility/-b Option
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -b 1m -b 2m -e
+
+exit $?
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeTera.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeTera.d.ksh
new file mode 100644
index 0000000..00f2c66
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.BufsizeTera.d.ksh
@@ -0,0 +1,45 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# ASSERTION:
+# The trace buffer size can include any of the size suffixes k, m, g or t
+#
+# SECTION: dtrace Utility/-b Option
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -b 1t -b 2t -e
+
+exit $?
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DataModel32.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DataModel32.d.ksh
new file mode 100755
index 0000000..e4ef38d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DataModel32.d.ksh
@@ -0,0 +1,73 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# If the -32 option is specified, dtrace will force the D compiler to
+# compile a program using the 32-bit data model.
+#
+# SECTION: dtrace Utility/-32 Option
+#
+##
+
+script()
+{
+	$dtrace -32 -s /dev/stdin <<EOF
+	BEGIN
+	/4 != sizeof(long)/
+	{
+		printf("Not targeted for 32 bit machine\n");
+		exit(1);
+	}
+
+	BEGIN
+	/4 == sizeof(long)/
+	{
+		printf("Targeted for 32 bit machine\n");
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+script 
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DataModel64.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DataModel64.d.ksh
new file mode 100755
index 0000000..8a9de0c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DataModel64.d.ksh
@@ -0,0 +1,74 @@
+#!/bin/ksh
+
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# If the -64 option is specified, dtrace will force the D compiler to
+# compile a program using the 64-bit data model.
+#
+# SECTION: dtrace Utility/-64 Option
+#
+##
+
+script()
+{
+	$dtrace -64 -s /dev/stdin <<EOF
+	BEGIN
+	/8 != sizeof(long)/
+	{
+		printf("Not targeted for 64 bit machine\n");
+		exit(1);
+	}
+
+	BEGIN
+	/8 == sizeof(long)/
+	{
+		printf("Targeted for 64 bit machine\n");
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DefineNameWithCPP.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DefineNameWithCPP.d.ksh
new file mode 100755
index 0000000..9be2b29
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DefineNameWithCPP.d.ksh
@@ -0,0 +1,68 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -D option can be used to define a name when used in conjunction
+# with the -C option. 
+#
+# SECTION: dtrace Utility/-C Option;
+# 	dtrace Utility/-D Option
+#
+##
+
+script()
+{
+	$dtrace -C -D VALUE=40 -s /dev/stdin <<EOF
+	#pragma D option quiet
+
+	BEGIN
+	{
+		printf("Value of VALUE: %d\n", VALUE);
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DefineNameWithCPP.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DefineNameWithCPP.d.ksh.out
new file mode 100644
index 0000000..5f91ad1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DefineNameWithCPP.d.ksh.out
@@ -0,0 +1,2 @@
+Value of VALUE: 40
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
new file mode 100755
index 0000000..0259db3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
@@ -0,0 +1,56 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -w option can be used to permit destructive actions in D programs.
+#
+# SECTION: dtrace Utility/-w Option;
+# 	dtrace Utility/-f Option
+#
+##
+
+
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qwf read'{chill(15); printf("Done chilling"); exit(0);}'
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh.out
new file mode 100644
index 0000000..8975980
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh.out
@@ -0,0 +1 @@
+Done chilling
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithID.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithID.d.ksh
new file mode 100755
index 0000000..6d3913f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithID.d.ksh
@@ -0,0 +1,54 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+## 
+#
+# ASSERTION:
+# The -w option can be used to permit destructive actions in D programs.
+#
+# SECTION: dtrace Utility/-w Option;
+# 	dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qwi 1'{chill(15); printf("Done chilling"); exit(0);}'
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithID.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithID.d.ksh.out
new file mode 100644
index 0000000..8975980
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithID.d.ksh.out
@@ -0,0 +1 @@
+Done chilling
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh
new file mode 100755
index 0000000..923be51
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh
@@ -0,0 +1,54 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -w option can be used to permit destructive actions in D programs.
+#
+# SECTION: dtrace Utility/-w Option;
+# 	dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qwm unix'{chill(15); printf("Done chilling"); exit(0);}'
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh.out
new file mode 100644
index 0000000..8975980
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithModule.d.ksh.out
@@ -0,0 +1 @@
+Done chilling
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithName.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithName.d.ksh
new file mode 100755
index 0000000..b21903f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithName.d.ksh
@@ -0,0 +1,54 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -w option can be used to permit destructive actions in D programs.
+#
+# SECTION: dtrace Utility/-w Option;
+# 	dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qwn BEGIN'{chill(15); printf("Done chilling"); exit(0);}'
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithName.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithName.d.ksh.out
new file mode 100644
index 0000000..8975980
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithName.d.ksh.out
@@ -0,0 +1 @@
+Done chilling
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithProvider.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithProvider.d.ksh
new file mode 100755
index 0000000..09dafec
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithProvider.d.ksh
@@ -0,0 +1,54 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -w option can be used to permit destructive actions in D programs.
+#
+# SECTION: dtrace Utility/-w Option;
+# 	dtrace Utility/-P Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qwP syscall'{chill(15); printf("Done chilling"); exit(0);}'
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithProvider.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithProvider.d.ksh.out
new file mode 100644
index 0000000..8975980
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithProvider.d.ksh.out
@@ -0,0 +1 @@
+Done chilling
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithoutW.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithoutW.d.ksh
new file mode 100755
index 0000000..9f051b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithoutW.d.ksh
@@ -0,0 +1,55 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Destructive actions will not compile or are not enabled without the
+# -w option in D programs.
+#
+# SECTION: dtrace Utility/-w Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qP syscall'{chill(15); printf("Done chilling"); exit(0);}'
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh
new file mode 100755
index 0000000..b68fc13
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationOut.d.ksh
@@ -0,0 +1,73 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Using -G option with dtrace utility produces an ELF file containing a
+# DTrace program. If the filename used with the -s option does not end
+# with .d, and the -o option is not used, then the output ELF file is
+# in d.out.
+#
+# SECTION: dtrace Utility/-G Option
+#
+##
+
+script()
+{
+	$dtrace -G -s /dev/stdin <<EOF
+	BEGIN
+	{
+		printf("This test should compile.\n");
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+	exit $status
+fi
+
+if [ ! -a "d.out" ]; then
+	echo $tst: file not generated
+	exit 1
+fi
+
+/usr/bin/rm -f "d.out"
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
new file mode 100755
index 0000000..ec38b50
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
@@ -0,0 +1,74 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Using -G option with dtrace utility produces an ELF file containing a
+# DTrace program. The output file can be named as required using the
+# -o option in conjunction with the -G option.
+#
+# SECTION: dtrace Utility/-G Option;
+# 	dtrace Utility/-o Option
+#
+##
+
+script()
+{
+	$dtrace -G -o outputFile -s /dev/stdin <<EOF
+	BEGIN
+	{
+		printf("This test should compile.\n");
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+	exit $status
+fi
+
+if [ ! -a "outputFile" ]; then
+	echo $tst: file not generated
+	exit 1
+fi
+
+/usr/bin/rm -f "outputFile"
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExitStatus1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExitStatus1.d.ksh
new file mode 100755
index 0000000..70a9f49
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExitStatus1.d.ksh
@@ -0,0 +1,56 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# When a fatal error occurs such that the program compilation fails or the
+# specified request cannot be satisfied, an exit status of 1 is returned.
+#
+#
+# SECTION: dtrace Utility/Exit Status
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -s wassup  
+status=$?
+
+if [ "$status" -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExitStatus2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExitStatus2.d.ksh
new file mode 100755
index 0000000..a058d3a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExitStatus2.d.ksh
@@ -0,0 +1,55 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# When invalid command line options or arguments are specified an exit status
+# of 2 is returned.
+#
+# SECTION: dtrace Utility/Exit Status
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -9
+status=$?
+
+if [ "$status" -ne 2 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExtraneousProbeIds.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExtraneousProbeIds.d.ksh
new file mode 100755
index 0000000..090fc4a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ExtraneousProbeIds.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -i option with extraneous probe identifiers.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 12 10 -i 23 
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidFuncName1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidFuncName1.d.ksh
new file mode 100755
index 0000000..c28c782
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidFuncName1.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f BEGIN
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidFuncName2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidFuncName2.d.ksh
new file mode 100755
index 0000000..d431579
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidFuncName2.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f 4.56
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId1.d.ksh
new file mode 100755
index 0000000..814b88d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId1.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -li option can be used to list the probes from their ids. An id of
+# negative integer is invalid
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -li -3
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId2.d.ksh
new file mode 100755
index 0000000..f9f4407
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId2.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -li option can be used to list the probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -li 4-2
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId3.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId3.d.ksh
new file mode 100755
index 0000000..efb03ae
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidId3.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -li option can be used to list the probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -li 2-2
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule1.d.ksh
new file mode 100755
index 0000000..a896ff3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule1.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -lm option can be used to list the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -lm :genunix::
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule2.d.ksh
new file mode 100755
index 0000000..820cc64
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule2.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -lm option can be used to list the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -lm profile:::profile-97
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule3.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule3.d.ksh
new file mode 100755
index 0000000..b56e6c3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule3.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -lm option can be used to list the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -lm fbt:des:des3_crunch_block:return
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule4.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule4.d.ksh
new file mode 100755
index 0000000..0ef9d95
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidModule4.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -lm option can be used to list the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -lm unix'/probefunc == "preempt"/{printf("FOUND");}'
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProbeIdentifier.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProbeIdentifier.d.ksh
new file mode 100755
index 0000000..66e0e1a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProbeIdentifier.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -i option with invalid probe identifier.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i i23
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider1.d.ksh
new file mode 100755
index 0000000..327e2d0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider1.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -lP option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-P Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -lP profile:::profile-97
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider2.d.ksh
new file mode 100755
index 0000000..2262449
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider2.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -lP option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-P Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -lP profile:::
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider3.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider3.d.ksh
new file mode 100755
index 0000000..775b327
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider3.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -lP option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-P Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -lP fbt:des:des3_crunch_block:return
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider4.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider4.d.ksh
new file mode 100755
index 0000000..04343f3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidProvider4.d.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -lP option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-l Option;
+# 	dtrace Utility/-P Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -lP profile'/probename == "profile-199"/{printf("FOUND");}'
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc1.d.ksh
new file mode 100755
index 0000000..1395f3b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc1.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f profile
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc2.d.ksh
new file mode 100755
index 0000000..4231e5c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc2.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f genunix
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc3.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc3.d.ksh
new file mode 100755
index 0000000..3c5b178
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc3.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f read:
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc4.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc4.d.ksh
new file mode 100755
index 0000000..bb8460d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc4.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f ::read:
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc5.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc5.d.ksh
new file mode 100755
index 0000000..5446676
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc5.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f :genunix::
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc6.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc6.d.ksh
new file mode 100755
index 0000000..645e6d9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc6.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f profile:::profile-97
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc7.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc7.d.ksh
new file mode 100755
index 0000000..a93d5c4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc7.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f fbt:des:des3_crunch_block:return
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc8.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc8.d.ksh
new file mode 100755
index 0000000..22ab3b1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc8.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f fight -f write
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc9.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc9.d.ksh
new file mode 100755
index 0000000..2af27a3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceFunc9.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -f option with an invalid function name.
+#
+# SECTION: dtrace Utility/-f Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -f read '{printf("FOUND");}'
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID1.d.ksh
new file mode 100755
index 0000000..46096d2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID1.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -i option can be used to enable the trace of probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 0
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID2.d.ksh
new file mode 100755
index 0000000..f406ce0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID2.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -i option can be used to enable the trace of probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i -3
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID3.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID3.d.ksh
new file mode 100755
index 0000000..fc2a24d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID3.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -i option can be used to enable the trace of probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 0-2
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID4.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID4.d.ksh
new file mode 100755
index 0000000..5fd6fd6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID4.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -i option can be used to enable the trace of probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 4-2
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID5.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID5.d.ksh
new file mode 100755
index 0000000..0ac46db
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID5.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -i option can be used to enable the trace of probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 2-2
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID6.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID6.d.ksh
new file mode 100755
index 0000000..778d485
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID6.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -i option can be used to enable the trace of probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 1 2 3 4
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID7.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID7.d.ksh
new file mode 100755
index 0000000..8a0f2d4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceID7.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -i option can be used to enable the trace of probes from their ids. A
+# non-increasing range will not list any probes.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 0 - 2
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule1.d.ksh
new file mode 100755
index 0000000..56dee0d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule1.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -m option can be used to enable the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -m profile
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule2.d.ksh
new file mode 100755
index 0000000..a508fe1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule2.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -m option can be used to enable the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -m :genunix::
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule3.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule3.d.ksh
new file mode 100755
index 0000000..599ce93
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule3.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -m option can be used to enable the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -m genunix::
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule4.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule4.d.ksh
new file mode 100755
index 0000000..e0e8786
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule4.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -m option can be used to enable the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -m profile:::profile-97
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule5.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule5.d.ksh
new file mode 100755
index 0000000..8583060
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule5.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -m option can be used to enable the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -m foounix -m unix
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule6.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule6.d.ksh
new file mode 100755
index 0000000..6125fb0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule6.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -m option can be used to enable the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -m fbt:des:des3_crunch_block:return
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule7.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule7.d.ksh
new file mode 100755
index 0000000..e689627
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule7.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -m option can be used to enable the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -m genunix::'{printf("FOUND");}'
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule8.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule8.d.ksh
new file mode 100755
index 0000000..692821b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceModule8.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -m option can be used to enable the probes from their module names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -m genunix:'{printf("FOUND");}'
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName1.d.ksh
new file mode 100755
index 0000000..43c61af
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName1.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n profile
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName2.d.ksh
new file mode 100755
index 0000000..70a5218
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName2.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n genunix
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName3.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName3.d.ksh
new file mode 100755
index 0000000..efb5ad0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName3.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n not_a_valid_probe
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName4.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName4.d.ksh
new file mode 100755
index 0000000..04845b9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName4.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n begin
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName5.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName5.d.ksh
new file mode 100755
index 0000000..df17231
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName5.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n genunix:read
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName6.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName6.d.ksh
new file mode 100755
index 0000000..10f13cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName6.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n sysinfo:genunix:read
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName7.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName7.d.ksh
new file mode 100755
index 0000000..b22561f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName7.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n :genunix:
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName8.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName8.d.ksh
new file mode 100755
index 0000000..f66055e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName8.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n fight: -n write:
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName9.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName9.d.ksh
new file mode 100755
index 0000000..a4239ff
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceName9.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -n option can be used to enable the trace of probes from their names.
+#
+# SECTION: dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n BEGIN '{printf("FOUND");}'
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider1.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider1.d.ksh
new file mode 100755
index 0000000..0a792c5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider1.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -P option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-P Option;
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -P foofile
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider2.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider2.d.ksh
new file mode 100755
index 0000000..1763142
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider2.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -P option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-P Option;
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -P profile:::
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider3.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider3.d.ksh
new file mode 100755
index 0000000..a854932
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider3.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -P option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-P Option;
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -P profile:::profile-97
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider4.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider4.d.ksh
new file mode 100755
index 0000000..f8a1359
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider4.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -P option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-P Option;
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -P fbt:des:des3_crunch_block:return
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider5.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider5.d.ksh
new file mode 100755
index 0000000..cec4297
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.InvalidTraceProvider5.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -P option can be used to list the probes from their provider names.
+# Invalid module names result in error.
+#
+# SECTION: dtrace Utility/-P Option;
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -P profile '{printf("FOUND");}'
+
+status=$?
+
+echo $status
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.MultipleInvalidProbeId.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.MultipleInvalidProbeId.d.ksh
new file mode 100755
index 0000000..8f2ceef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.MultipleInvalidProbeId.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -i option with multiple valid and invalid probe identifiers.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 12 -i 10 -i 0
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh
new file mode 100755
index 0000000..182466f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.PreprocessorStatement.d.ksh
@@ -0,0 +1,70 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -C option is used to run the C preprocessor over D programs before
+# compiling them. The -H option used in conjuction with the -C option
+# lists the pathnames of the included files to STDERR.
+#
+# SECTION: dtrace Utility/-C Option;
+# 	dtrace Utility/-H Option
+#
+##
+
+script()
+{
+	$dtrace -CH -s /dev/stdin <<EOF
+
+#include <stdio.h>
+
+	BEGIN
+	{
+		printf("This test should compile\n");
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.QuietMode.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.QuietMode.d.ksh
new file mode 100755
index 0000000..4bfbf76
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.QuietMode.d.ksh
@@ -0,0 +1,65 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Using the -q option suppresses the dtrace messages and prints only the
+# data traced by trace() and printf() to stdout.
+#
+# SECTION: dtrace Utility/-q Option
+#
+##
+
+script()
+{
+	$dtrace -q -s /dev/stdin <<EOF
+
+	BEGIN
+	{
+		printf("I am the only one.");
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.QuietMode.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.QuietMode.d.ksh.out
new file mode 100644
index 0000000..20e31b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.QuietMode.d.ksh.out
@@ -0,0 +1 @@
+I am the only one.
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.TestCompile.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.TestCompile.d.ksh
new file mode 100755
index 0000000..16cd05f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.TestCompile.d.ksh
@@ -0,0 +1,67 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Using the -e option exits after compiling any requests but before
+# enabling probes.
+#
+# SECTION: dtrace Utility/-e Option
+#
+##
+
+script()
+{
+	$dtrace -e -s /dev/stdin <<EOF
+	#pragma D option quiet
+	BEGIN
+	{
+		i = 100;
+		printf("Value of i: %d\n", i);
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/include/VBox/vd-cache-plugin.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.TestCompile.d.ksh.out
similarity index 100%
rename from include/VBox/vd-cache-plugin.h
rename to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.TestCompile.d.ksh.out
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.UnDefineNameWithCPP.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.UnDefineNameWithCPP.d.ksh
new file mode 100755
index 0000000..4c1eb50
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.UnDefineNameWithCPP.d.ksh
@@ -0,0 +1,71 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -D option can be used to define a name when used in conjunction
+# with the -C option. The -U option can be used to undefine a name in
+# conjunction with the -C option. 
+#
+# SECTION: dtrace Utility/-C Option;
+# 	dtrace Utility/-D Option;
+# 	dtrace Utility/-U Option
+#
+##
+
+script()
+{
+	$dtrace -C -D VALUE=40 -U VALUE -s /dev/stdin <<EOF
+	#pragma D option quiet
+
+	BEGIN
+	{
+		printf("Value of VALUE: %d\n", VALUE);
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+script
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
new file mode 100755
index 0000000..5e61f05
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
@@ -0,0 +1,58 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -Z option can be used to permit descriptions that match
+# zero probes.
+#
+# SECTION: dtrace Utility/-Z Option;
+# 	dtrace Utility/-f Option
+#
+##
+
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qZf wassup'{printf("Iamkool");}' \
+-qf read'{printf("I am done"); exit(0);}'
+
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh.out
new file mode 100644
index 0000000..0f2e1aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh.out
@@ -0,0 +1 @@
+I am done
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh
new file mode 100755
index 0000000..9d48f99
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -Z option can be used to permit descriptions that match
+# zero probes.
+#
+# SECTION: dtrace Utility/-Z Option;
+# 	dtrace Utility/-m Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qZm wassup'{printf("Iamkool");}' \
+-qm unix'{printf("I am done"); exit(0);}'
+
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh.out
new file mode 100644
index 0000000..0f2e1aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroModuleProbes.d.ksh.out
@@ -0,0 +1 @@
+I am done
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroNameProbes.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroNameProbes.d.ksh
new file mode 100755
index 0000000..90175a5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroNameProbes.d.ksh
@@ -0,0 +1,56 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -Z option can be used to permit descriptions that match
+# zero probes.
+#
+# SECTION: dtrace Utility/-Z Option;
+# 	dtrace Utility/-n Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qZn wassup'{printf("Iamkool");}' \
+-qn BEGIN'{printf("I am done"); exit(0);}'
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroNameProbes.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroNameProbes.d.ksh.out
new file mode 100644
index 0000000..0f2e1aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroNameProbes.d.ksh.out
@@ -0,0 +1 @@
+I am done
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProbeIdentfier.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProbeIdentfier.d.ksh
new file mode 100755
index 0000000..9af4d2b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProbeIdentfier.d.ksh
@@ -0,0 +1,53 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Testing -i option with zero probe identifier.
+#
+# SECTION: dtrace Utility/-i Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -i 0
+
+if [ $? -ne 1 ]; then
+	echo $tst: dtrace failed
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProbesWithoutZ.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProbesWithoutZ.d.ksh
new file mode 100755
index 0000000..afc7d76
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProbesWithoutZ.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# Without the -Z option probe descriptions that do not match any known
+# probes will cause an error or will not be enabled.
+#
+# SECTION: dtrace Utility/-Z Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qP wassup'{printf("Iamkool");}' \
+-qP profile'{printf("I am done"); exit(0);}'
+
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	exit 0
+fi
+
+echo $tst: dtrace failed
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProviderProbes.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProviderProbes.d.ksh
new file mode 100755
index 0000000..f2646bd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProviderProbes.d.ksh
@@ -0,0 +1,57 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+##
+#
+# ASSERTION:
+# The -Z option can be used to permit descriptions that match
+# zero probes.
+#
+# SECTION: dtrace Utility/-Z Option;
+# 	dtrace Utility/-P Option
+#
+##
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qZP wassup'{printf("Iamkool");}' \
+-qP profile'{printf("I am done"); exit(0);}'
+
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProviderProbes.d.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProviderProbes.d.ksh.out
new file mode 100644
index 0000000..0f2e1aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroProviderProbes.d.ksh.out
@@ -0,0 +1 @@
+I am done
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/err.D_IDENT_UNDEF.timespent.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/err.D_IDENT_UNDEF.timespent.d
new file mode 100644
index 0000000..04ccb72
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/err.D_IDENT_UNDEF.timespent.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Calculate timestamp between BEGIN and END.
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+END
+{
+	total = timestamp - start;
+}
+
+BEGIN
+{
+	start = timestamp;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.end.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.end.d
new file mode 100644
index 0000000..56c1a4c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.end.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Sequence flow of END profile.
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+END
+{
+	printf("End fired after exit\n");
+}
+
+BEGIN
+{
+	printf("Begin fired first\n");
+}
+
+tick-1
+{
+	printf("tick fired second\n");
+	printf("Call exit\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.endwithoutbegin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.endwithoutbegin.d
new file mode 100644
index 0000000..6291960
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.endwithoutbegin.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	END without BEGIN profile
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+END
+{
+	printf("End fired after exit\n");
+}
+
+tick-1
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.multibeginend.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.multibeginend.d
new file mode 100644
index 0000000..4f6ec92
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.multibeginend.d
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Tests multiple END profile.
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+END
+{
+	printf("End1 fired after exit\n");
+}
+END
+{
+	printf("End2 fired after exit\n");
+}
+END
+{
+	printf("End3 fired after exit\n");
+}
+END
+{
+	printf("End4 fired after exit\n");
+}
+
+BEGIN
+{
+	printf("Begin fired first\n");
+}
+BEGIN
+{
+	printf("Begin fired second\n");
+}
+BEGIN
+{
+	printf("Begin fired third\n");
+}
+BEGIN
+{
+	printf("Begin fired fourth\n");
+}
+BEGIN
+{
+	printf("Begin fired fifth\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.multiend.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.multiend.d
new file mode 100644
index 0000000..e6629fb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/end/tst.multiend.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Tests Multiple END and single BEGIN
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+END
+{
+	printf("End1 fired after exit\n");
+}
+END
+{
+	printf("End2 fired after exit\n");
+}
+END
+{
+	printf("End3 fired after exit\n");
+}
+END
+{
+	printf("End4 fired after exit\n");
+}
+
+BEGIN
+{
+	printf("Begin fired first\n");
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/err.D_DECL_IDRED.EnumSameName.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/err.D_DECL_IDRED.EnumSameName.d
new file mode 100644
index 0000000..7e5427a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/err.D_DECL_IDRED.EnumSameName.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Enumerations assigning same or different values to the same identifier in
+ *  different enumerations should throw a compiler error.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ *
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+enum colors {
+	RED,
+	GREEN,
+	BLUE
+};
+
+enum shades {
+	RED,
+	ORANGE,
+	GREEN,
+	WHITE
+};
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/err.D_UNKNOWN.RepeatIdentifiers.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/err.D_UNKNOWN.RepeatIdentifiers.d
new file mode 100644
index 0000000..2b4266d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/err.D_UNKNOWN.RepeatIdentifiers.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Repeating the same identifier in the same enumeration will throw a compiler
+ * error.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ *
+ * NOTES:
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+enum colors {
+	RED,
+	GREEN,
+	GREEN = 2,
+	BLUE
+};
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumEquality.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumEquality.d
new file mode 100644
index 0000000..cbf9369
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumEquality.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the identifiers in different D enumerations at same position for
+ * equality.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+#pragma D option quiet
+
+enum colors {
+	RED,
+	GREEN,
+	BLUE
+};
+
+enum shades {
+	WHITE,
+	BLACK,
+	YELLOW
+};
+
+
+profile:::tick-1sec
+/(WHITE == RED) && (YELLOW == BLUE) && (GREEN == BLACK)/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumSameValue.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumSameValue.d
new file mode 100644
index 0000000..26a4d50
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumSameValue.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Enumerations assigning the same value to different identifiers in the same
+ * enumeration should work okay.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ *
+ * NOTES:
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+enum colors {
+	RED = 2,
+	GREEN = 2,
+	BLUE = 2
+};
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumValAssign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumValAssign.d
new file mode 100644
index 0000000..f721c50
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/enum/tst.EnumValAssign.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Test the D enumerations with and without initilialization of the identifiers.
+ * Also test for values with negative integer assignments, expressions and
+ * fractions.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+enum colors {
+	RED,
+	ORANGE = 5 + 5,
+	YELLOW = 2,
+	GREEN,
+	BLUE = GREEN + ORANGE,
+ 	PINK = 5/4,
+	INDIGO = -2,
+	VIOLET
+};
+
+profile:::tick-1sec
+/(0 == RED) && (10 == ORANGE) && (2 == YELLOW) && (3 == GREEN) &&
+    (13 == BLUE) && (1 == PINK) && (-2 == INDIGO) && (-1 == VIOLET)/
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_BADADDR.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_BADADDR.d
new file mode 100644
index 0000000..5eb3e94
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_BADADDR.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	To test DTRACEFLT_BADADDR error
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+ERROR
+{
+	printf("The arguments are %u %u %u %u %u\n",
+		arg1, arg2, arg3, arg4, arg5);
+	printf("The value of arg4 = %u\n", DTRACEFLT_BADADDR);
+	exit(0);
+}
+
+BEGIN
+{
+	*(char *)NULL;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_DIVZERO.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_DIVZERO.d
new file mode 100644
index 0000000..5b93168
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_DIVZERO.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	To test DTRACEFLT_DIVZERO error
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+ERROR
+{
+	printf("The arguments are %u %u %u %d %u\n",
+		arg1, arg2, arg3, arg4, arg5);
+	exit(0);
+}
+
+char *s;
+
+BEGIN
+{
+	i = 1;
+	j = 2;
+	j = i/(j-2);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_UNKNOWN.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_UNKNOWN.d
new file mode 100644
index 0000000..6de75bb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.DTRACEFLT_UNKNOWN.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	To test DTRACEFLT_UNKNOWN error
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+ERROR
+{
+	printf("The arguments are %u %u %u %u %u\n",
+		arg1, arg2, arg3, arg4, arg5);
+	printf("The value of arg4 = %u\n", DTRACEFLT_UNKNOWN);
+	exit(0);
+}
+
+BEGIN
+{
+	x = (int *) 64;
+	y = *x;
+	trace(y);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.error.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.error.d
new file mode 100644
index 0000000..3b1d653
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.error.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	To fire ERROR probe
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+ERROR
+{
+	printf("Error fired\n");
+	exit(0);
+}
+
+BEGIN
+{
+	*(char *)NULL;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.errorend.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.errorend.d
new file mode 100644
index 0000000..0bb4a6e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/error/tst.errorend.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Flow of ERROR probe
+ *
+ * SECTION: dtrace Provider
+ *
+ */
+
+
+#pragma D option quiet
+
+ERROR
+{
+	printf("Error fired\n");
+	exit(0);
+}
+
+END
+{
+	printf("End fired after exit\n");
+}
+
+BEGIN
+{
+	*(char *)NULL;
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/err.D_PROTO_LEN.noarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/err.D_PROTO_LEN.noarg.d
new file mode 100644
index 0000000..9a9a8f9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/err.D_PROTO_LEN.noarg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	Call exit() without arguments.
+ *
+ * SECTION: Actions and Subroutines/exit()
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	exit()
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/err.exitarg1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/err.exitarg1.d
new file mode 100644
index 0000000..d3067d1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/err.exitarg1.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Basic test - call with 1
+ *
+ * SECTION: Actions and Subroutines/exit()
+ */
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/tst.basic1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/tst.basic1.d
new file mode 100644
index 0000000..24f841c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/exit/tst.basic1.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive test
+ *
+ * SECTION: Actions and Subroutines/exit()
+ */
+
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/err.D_PDESC_ZERO.notreturn.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/err.D_PDESC_ZERO.notreturn.d
new file mode 100644
index 0000000..5e3d5fa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/err.D_PDESC_ZERO.notreturn.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: Call fbt provider over non existent function and make
+ * sure it results in compilation error.
+ *
+ * SECTION: FBT Provider/Probes
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	self->traceme = 1;
+}
+
+void bar();
+
+fbt::bar:entry
+{
+	printf("Entering the function\n");
+}
+
+fbt::bar:return
+{
+	printf("Returning the function\n");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.basic.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.basic.d
new file mode 100644
index 0000000..ff6da26
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.basic.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: simple fbt arguments test.
+ *
+ * SECTION: FBT Provider/Probes
+ */
+
+#pragma D option quiet
+
+tick-1
+{
+	self->traceme = 1;
+}
+
+fbt:::
+/self->traceme/
+{
+	printf("The arguments are %u %u %u %u %u %u %u %u\n", arg0, arg1,
+		arg3, arg4, arg5, arg6, arg7, arg8);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.functionentry.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.functionentry.d
new file mode 100644
index 0000000..78e107e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.functionentry.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: FBT provider function entry and exit test.
+ *
+ * SECTION: FBT Provider/Probe arguments
+ */
+
+#pragma D option quiet
+#pragma D option statusrate=10ms
+
+fbt::ioctl:entry
+{
+	printf("Entering the ioctl function\n");
+}
+
+fbt::ioctl:return
+{
+	printf("Returning from ioctl function\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.functionreturnvalue.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.functionreturnvalue.d
new file mode 100644
index 0000000..6d1b8a8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.functionreturnvalue.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: Fbt provider return value verify test.
+ *
+ * SECTION: FBT Provider/Probe arguments
+ */
+
+#pragma D option quiet
+#pragma D option statusrate=10ms
+
+fbt::ioctl:return
+{
+	printf("The function return value is stored in %u\n", arg1);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.ioctlargs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.ioctlargs.d
new file mode 100644
index 0000000..c2c7bf0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.ioctlargs.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: FBT provider arguments scan test.
+ *
+ * SECTION: FBT Provider/Probe arguments
+ */
+
+#pragma D option quiet
+#pragma D option statusrate=10ms
+
+fbt::ioctl:entry
+{
+	printf("Entering the ioctl function\n");
+	printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
+}
+
+fbt::ioctl:return
+{
+	printf("Returning from ioctl function\n");
+	printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.offset.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.offset.d
new file mode 100644
index 0000000..be2c0d6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.offset.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: FBT provider return value offset verification test.
+ *
+ * SECTION: FBT Provider/Probe arguments
+ */
+
+#pragma D option quiet
+#pragma D option statusrate=10ms
+
+BEGIN
+{
+	self->traceme = 1;
+}
+
+fbt::ioctl:entry
+{
+	printf("Entering the function\n");
+}
+
+fbt::ioctl:return
+{
+	printf("The offset = %u\n", arg0);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.offsetzero.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.offsetzero.d
new file mode 100644
index 0000000..240744b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.offsetzero.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: FBT provider argument 0 test
+ *
+ * SECTION: FBT Provider/Probe arguments
+ */
+
+#pragma D option quiet
+#pragma D option statusrate=10ms
+
+fbt::ioctl:entry
+{
+	printf("Entering the ioctl function\n");
+	printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
+	exit(0);
+}
+
+fbt::ioctl:return
+{
+	printf("Returning from ioctl function\n");
+	printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.return.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.return.d
new file mode 100644
index 0000000..b269710
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.return.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: simple fbt provider return test.
+ *
+ * SECTION: FBT Provider/Probe arguments
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	self->traceme = 1;
+}
+
+fbt:::entry
+{
+	printf("Entering the function\n");
+}
+
+fbt:::return
+{
+	printf("Returning the function\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.return0.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.return0.d
new file mode 100644
index 0000000..cadbaa0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.return0.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: simple fbt provider arg0 and probfunc print test.
+ *
+ * SECTION: FBT Provider/Probe arguments
+ */
+
+#pragma D option quiet
+#pragma D option statusrate=10ms
+
+fbt::ioctl:return
+/arg1 == 0/
+{
+	printf("%s %x returned 0", probefunc, arg0);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.tailcall.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.tailcall.d
new file mode 100644
index 0000000..67ef106
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/fbtprovider/tst.tailcall.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION: simple fbt provider tailcall test.
+ *
+ * SECTION: FBT Provider/Probe arguments
+ */
+
+#pragma D option quiet
+#pragma D option statusrate=10ms
+
+fbt::ioctl:entry
+{
+	self->traceme = 1;
+}
+
+fbt:::entry
+/self->traceme/
+{
+	printf("called %s\n", probefunc);
+}
+
+fbt::ioctl:return
+/self->traceme/
+{
+	self->traceme = 0;
+	exit (0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_FUNC_UNDEF.progenyofbad1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_FUNC_UNDEF.progenyofbad1.d
new file mode 100644
index 0000000..bfd1eed
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_FUNC_UNDEF.progenyofbad1.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	progenyof() should accept one argument - a pid
+ *
+ * SECTION: Actions and Subroutines/progenyof()
+ *
+ */
+
+
+BEGIN
+{
+	progencyof(1, 2);
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_OP_VFPTR.badop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_OP_VFPTR.badop.d
new file mode 100644
index 0000000..d219bb1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_OP_VFPTR.badop.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *      +=, -= must handle invalid variables.
+ *
+ * SECTION: Types, Operators, and Expressions/Assignment Operators
+ *
+ */
+
+
+int p;
+
+BEGIN
+{
+	p = 1;
+	p -= alloca(10);
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.chillbadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.chillbadarg.d
new file mode 100644
index 0000000..08bd981
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.chillbadarg.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	chill() should handle a bad argument.
+ *
+ * SECTION: Actions and Subroutines/chill()
+ *
+ */
+
+
+BEGIN
+{
+	chill("badarg");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.copyoutbadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.copyoutbadarg.d
new file mode 100644
index 0000000..5c02378
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.copyoutbadarg.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  copyout() must handle invalid argument types.
+ *
+ * SECTION: Actions and Subroutines/copyout()
+ *
+ */
+
+
+BEGIN
+{
+	copyout("not_void_*", "not_uinptr_t", "not_size_t");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.mobadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.mobadarg.d
new file mode 100644
index 0000000..4df8d18
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.mobadarg.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	mutex_owned() should handle an invalid argument passed.
+ *
+ * SECTION: Actions and Subroutines/mutex_owned()
+ *
+ */
+
+BEGIN
+{
+	mutex_owned("badarg");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.raisebadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.raisebadarg.d
new file mode 100644
index 0000000..a3336ef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_ARG.raisebadarg.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  raise() should generate an error if any arguments are sent.
+ *
+ * SECTION: Actions and Subroutines/raise()
+ *
+ */
+
+
+BEGIN
+{
+	raise("badarg");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.allocanoarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.allocanoarg.d
new file mode 100644
index 0000000..a2af00f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.allocanoarg.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	alloca() should handle no arguments as an error
+ *
+ * SECTION: Actions and Subroutines/alloca()
+ *
+ */
+
+#pragma D option quiet
+
+
+
+BEGIN
+{
+	ptr = alloca();
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.badbreakpoint.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.badbreakpoint.d
new file mode 100644
index 0000000..0cb567a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.badbreakpoint.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	breakpoint() should handle arguments passed as an error.
+ *
+ * SECTION: Actions and Subroutines/breakpoint()
+ *
+ */
+
+
+BEGIN
+{
+	breakpoint(1, 2);
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.chilltoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.chilltoofew.d
new file mode 100644
index 0000000..a0018fa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.chilltoofew.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	chill() should handle no arguments.
+ *
+ * SECTION: Actions and Subroutines/chill()
+ *
+ */
+
+
+BEGIN
+{
+	chill();
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.chilltoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.chilltoomany.d
new file mode 100644
index 0000000..f24e9ef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.chilltoomany.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	chill() should handle too many arguments.
+ *
+ * SECTION: Actions and Subroutines/chill()
+ *
+ */
+
+BEGIN
+{
+	chill(1000, 1000, 1000);
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyoutstrbadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyoutstrbadarg.d
new file mode 100644
index 0000000..1f07814
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyoutstrbadarg.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  copyoutstr() must handle invalid argument types.
+ *
+ * SECTION: Actions and Subroutines/copyoutstr()
+ *
+ */
+
+
+BEGIN
+{
+	copyoutstr("string", "not_uintptr_t");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyoutstrtoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyoutstrtoofew.d
new file mode 100644
index 0000000..e01868c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyoutstrtoofew.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *    Calling copyoutstr() with less than 2 arguments will generate an error
+ *
+ * SECTION: Actions and Subroutines/copyoutstr()
+ *
+ */
+
+
+BEGIN
+{
+	copyoutstr("string");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyouttoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyouttoofew.d
new file mode 100644
index 0000000..f3706f6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyouttoofew.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *    Calling copyout() with less than 3 arguments will generate an error
+ *
+ * SECTION: Actions and Subroutines/copyout()
+ *
+ */
+
+
+BEGIN
+{
+	copyout(0, 20);
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyouttoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyouttoomany.d
new file mode 100644
index 0000000..6fab90d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.copyouttoomany.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   copyout() should handle too many arguments passed.
+ *
+ * SECTION: Actions and Subroutines/copyin();
+ * 	Actions and Subroutines/copyinstr()
+ *
+ */
+
+
+BEGIN
+{
+	copyout((void *)3, (uintptr_t)1000, (size_t)1000, "toomany");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d
new file mode 100644
index 0000000..e878713
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoofew.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	mutex_owned() should handle too few args passed
+ *
+ * SECTION: Actions and Subroutines/mutex_owned()
+ *
+ */
+
+lockstat:genunix:mutex_enter:adaptive-acquire
+{
+	mutex_owned();
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d
new file mode 100644
index 0000000..d3b9ed4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.motoomany.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	mutex_owned() should handle too many args passed
+ *
+ * SECTION: Actions and Subroutines/mutex_owned()
+ *
+ */
+
+lockstat:genunix:mutex_enter:adaptive-acquire
+{
+	mutex_owned((kmutex_t *)arg0, 99);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtabadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtabadarg.d
new file mode 100644
index 0000000..6ad1e47
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtabadarg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	mutex_type_adaptive() should handle an invalid argument passed.
+ *
+ * SECTION: Actions and Subroutines/mutex_type_adaptive()
+ *
+ */
+
+
+BEGIN
+{
+	mutex_type_adaptive(trace());
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d
new file mode 100644
index 0000000..98bc5c9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoofew.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	mutex_type_adaptive() should handle too few args passed
+ *
+ * SECTION: Actions and Subroutines/mutex_type_adaptive()
+ *
+ */
+
+
+lockstat:genunix:mutex_enter:adaptive-acquire
+{
+	mutex_type_adaptive();
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d
new file mode 100644
index 0000000..e4f259a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.mtatoomany.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	mutex_type_adaptive() should handle too many args passed
+ *
+ * SECTION: Actions and Subroutines/mutex_type_adaptive()
+ *
+ */
+
+
+lockstat:genunix:mutex_enter:adaptive-acquire
+{
+	mutex_type_adaptive((kmutex_t *)arg0, 99);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.panicbadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.panicbadarg.d
new file mode 100644
index 0000000..87589b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.panicbadarg.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	panic() should handle any argument passed as an error.
+ *
+ * SECTION: Actions and Subroutines/panic()
+ *
+ */
+
+
+BEGIN
+{
+	panic("badarg");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.progenyofbad2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.progenyofbad2.d
new file mode 100644
index 0000000..51c8674
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.progenyofbad2.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	progenyof() should return an error if the argument is an
+ *	incorrect type.
+ *
+ * SECTION: Actions and Subroutines/progenyof()
+ *
+ */
+
+
+BEGIN
+{
+	progenyof(trace());
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.stopbadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.stopbadarg.d
new file mode 100644
index 0000000..8b60507
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_PROTO_LEN.stopbadarg.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  stop() should generate an error if any arguments are sent.
+ *
+ * SECTION: Actions and Subroutines/stop()
+ *
+ */
+
+
+BEGIN
+{
+	stop("badarg");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_STRINGOF_TYPE.badstringof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_STRINGOF_TYPE.badstringof.d
new file mode 100644
index 0000000..fec5649
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_STRINGOF_TYPE.badstringof.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  stringof() accepts a scalar, pointer, or string
+ *
+ * SECTION: Types, Operators, and Expressions/Precedence
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("%s", stringof (trace(0)));
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_VAR_UNDEF.badvar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_VAR_UNDEF.badvar.d
new file mode 100644
index 0000000..bb4fd2d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.D_VAR_UNDEF.badvar.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *      +=, -= must handle invalid variables.
+ *
+ * SECTION: Types, Operators, and Expressions/Assignment Operators
+ *
+ */
+
+
+BEGIN
+{
+	p -= trace(0);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badalloca.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badalloca.d
new file mode 100644
index 0000000..572daa3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badalloca.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	memory allocated by alloca() is only valid within the clause
+ *	it is allocated.
+ *
+ * SECTION: Actions and Subroutines/alloca()
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	ptr = alloca(sizeof (int));
+}
+
+tick-1
+{
+	bcopy((void *)&`kmem_flags, ptr, sizeof (int));
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badalloca2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badalloca2.d
new file mode 100644
index 0000000..fbbf8e2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badalloca2.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	alloca() cannot be used to "unconsume" scratch space memory by
+ *	accepting a negative offset.
+ *
+ * SECTION: Actions and Subroutines/alloca()
+ *
+ */
+
+BEGIN
+{
+	ptr = alloca(10);
+	ptr = alloca(0xffffffffffffffff);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy.d
new file mode 100644
index 0000000..d7184b0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	bcopy should not allow a copy to memory that is not scratch memory.
+ *
+ * SECTION: Actions and Subroutines/alloca();
+ * 	Actions and Subroutines/bcopy()
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	ptr = alloca(sizeof (int));
+
+	/* Attempt a copy from scratch memory to a kernel address */
+
+	bcopy(ptr, (void *)&`kmem_flags, sizeof (int));
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy1.d
new file mode 100644
index 0000000..c29eb2b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy1.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	bcopy should not copy from one memory location to another
+ *	if the memory is not properly allocated
+ *
+ * SECTION: Actions and Subroutines/alloca();
+ * 	Actions and Subroutines/bcopy()
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	ptr = alloca(0);
+
+	/* Attempt to bcopy to scratch memory that isn't allocated */
+	bcopy((void *)&`kmem_flags, ptr, sizeof (int));
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy2.d
new file mode 100644
index 0000000..6d49e6e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy2.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	bcopy should not copy from one memory location to another
+ *	if the memory is not properly allocated
+ *
+ * SECTION: Actions and Subroutines/bcopy()
+ *
+ */
+
+#pragma D option quiet
+
+int *ptr;
+
+BEGIN
+{
+	/* Attempt to copy to non-scratch memory */
+
+	bcopy((void *)&`kmem_flags, ptr, sizeof (int));
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy3.d
new file mode 100644
index 0000000..c362caa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy3.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	bcopy should not copy from one memory location to another
+ *	if the memory is not properly allocated
+ *
+ * SECTION: Actions and Subroutines/bcopy()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	/* Attempt to copy to a NULL address */
+	bcopy((void *)&`kmem_flags, (void *)NULL, sizeof (int));
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy4.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy4.d
new file mode 100644
index 0000000..4148ae7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy4.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	bcopy should not copy from one memory location to another
+ *	if the source memory location is not valid.
+ *
+ * SECTION: Actions and Subroutines/alloca();
+ * 	Actions and Subroutines/bcopy()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	ptr = alloca(sizeof (int));
+
+	/* Attempt to copy from a NULL address */
+	bcopy((void *)NULL, ptr, sizeof (int));
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy5.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy5.d
new file mode 100644
index 0000000..a0cbd5d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy5.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	bcopy should not copy from one memory location to another
+ *	if the source memory location is not valid.
+ *
+ * SECTION: Actions and Subroutines/alloca();
+ * 	Actions and Subroutines/bcopy()
+ *
+ */
+
+#pragma D option quiet
+
+int *badptr;
+
+BEGIN
+{
+	ptr = alloca(sizeof (int));
+
+	/* Attempt to copy from a invalid address */
+	bcopy(badptr, ptr, sizeof (int));
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy6.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy6.d
new file mode 100644
index 0000000..3277014
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badbcopy6.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	bcopy("bad news", alloca(1), -1);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badchill.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badchill.d
new file mode 100644
index 0000000..b394a88
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.badchill.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	chill(200);
+	chill(((hrtime_t)1 << 63) - 1);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.chillbadarg.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.chillbadarg.ksh
new file mode 100644
index 0000000..98f04dd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.chillbadarg.ksh
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+dtrace_script()
+{
+	
+	$dtrace -w -s /dev/stdin <<EOF
+
+	/*
+ 	* ASSERTION:
+ 	*	Verify that chill() refuses args greater than 
+	* 	500 milliseconds.
+ 	*
+ 	* SECTION: Actions and Subroutines/chill()
+ 	* 
+ 	*/
+
+	BEGIN 
+	{
+		chill(500000001);
+		exit(1);
+	}
+
+	ERROR
+	{
+		exit(1)
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+dtrace_script &
+child=$!
+
+wait $child
+status=$?
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyout.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyout.d
new file mode 100644
index 0000000..6b9db3b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyout.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	copyout() should handle invalid args.
+ *
+ * SECTION: Actions and Subroutines/copyout()
+ *
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	i = 3;
+	copyout((void *)i, 0, 5);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyoutbadaddr.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyoutbadaddr.ksh
new file mode 100644
index 0000000..de5c47d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyoutbadaddr.ksh
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+
+dtrace_script()
+{
+	
+	$dtrace -w -s /dev/stdin <<EOF
+
+	/*
+ 	* ASSERTION:
+ 	*	Verify that copyout() handles bad addresses.
+ 	*
+ 	* SECTION: Actions and Subroutines/copyout()
+ 	* 
+ 	*/
+
+	BEGIN 
+	{
+        	ptr = alloca(sizeof (char *));
+        	copyinto(curpsinfo->pr_envp, sizeof (char *), ptr);
+        	copyout(ptr, 0, sizeof (char *));
+	}
+
+	ERROR
+	{
+		exit(1)
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+dtrace_script &
+child=$!
+
+wait $child
+status=$?
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyoutstrbadaddr.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyoutstrbadaddr.ksh
new file mode 100644
index 0000000..181702b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.copyoutstrbadaddr.ksh
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+
+dtrace_script()
+{
+	
+	$dtrace -w -s /dev/stdin <<EOF
+
+	/*
+ 	* ASSERTION:
+ 	*	Verify that copyout() handles bad addresses.
+ 	*
+ 	* SECTION: Actions and Subroutines/copyout()
+ 	* 
+ 	*/
+
+	BEGIN 
+	{
+        	ptr = alloca(sizeof (char *));
+        	copyinto(curpsinfo->pr_envp, sizeof (char *), ptr);
+        	copyout(ptr, 0, sizeof (char *));
+	}
+
+	ERROR
+	{
+		exit(1)
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+dtrace_script &
+child=$!
+
+wait $child
+status=$?
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntoa6badaddr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntoa6badaddr.d
new file mode 100644
index 0000000..81ce643
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntoa6badaddr.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+struct in6_addr *ip6a;
+
+BEGIN
+{
+	ip6a = 0;
+
+	printf("%s\n", inet_ntop(AF_INET6, ip6a));
+
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntoabadaddr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntoabadaddr.d
new file mode 100644
index 0000000..3f0d8e4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntoabadaddr.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+ipaddr_t *ip4a;
+
+BEGIN
+{
+	ip4a = 0;
+
+	printf("%s\n", inet_ntoa(ip4a));
+
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntopbadaddr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntopbadaddr.d
new file mode 100644
index 0000000..74ce760
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntopbadaddr.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+ipaddr_t *ip4a;
+
+BEGIN
+{
+	ip4a = 0;
+
+	printf("%s\n", inet_ntop(AF_INET, ip4a));
+
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntopbadarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntopbadarg.d
new file mode 100644
index 0000000..2731385
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/err.inet_ntopbadarg.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+ipaddr_t *ip4a;
+
+BEGIN
+{
+	this->buf4a = alloca(sizeof (ipaddr_t));
+	ip4a = this->buf4a;
+	*ip4a = htonl(0xc0a80117);
+
+	printf("%s\n", inet_ntop(-1, ip4a));
+
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.badfreopen.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.badfreopen.ksh
new file mode 100644
index 0000000..72f6b87
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.badfreopen.ksh
@@ -0,0 +1,102 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -wq -o $tmpfile -s /dev/stdin 2> $errfile <<EOF
+	BEGIN
+	{
+		/*
+		 * All of these should fail...
+		 */
+		freopen("..");
+		freopen("%s", ".");
+		freopen("%c%c", '.', '.');
+		freopen("%c", '.');
+
+		/*
+		 * ...so stdout should still be open here.
+		 */
+		printf("%d", ++i);
+
+		freopen("%s%s", ".", ".");
+		freopen("%s%s", ".", ".");
+
+		printf("%d", ++i);
+	}
+
+	BEGIN
+	/i == 2/
+	{
+		/*
+		 * ...and here.
+		 */
+		printf("%d\n", ++i);
+		exit(0);
+	}
+
+	BEGIN
+	{
+		exit(1);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+tmpfile=/tmp/tst.badfreopen.$$
+errfile=/tmp/tst.badfreopen.$$.stderr
+
+script
+status=$?
+
+if [ "$status" -eq 0 ]; then
+	i=`cat $tmpfile`
+
+	if [[ $i != "123" ]]; then
+		echo "$0: unexpected contents in $tmpfile: " \
+		    "expected 123, found $i"
+		status=100
+	fi
+	
+	i=`wc -l $errfile | nawk '{ print $1 }'`
+
+	if [ "$i" -lt 6 ]; then
+		echo "$0: expected at least 6 lines of stderr, found $i lines"
+		status=101
+	fi
+else
+	cat $errfile > /dev/fd/2
+fi
+
+rm $tmpfile $errfile
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.basename.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.basename.d
new file mode 100644
index 0000000..6fb996c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.basename.d
@@ -0,0 +1,87 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+/*
+ * This test verifies that the basename() and dirname() functions are working
+ * properly.  Note that the output of this is a ksh script.  When run,
+ * it will give no output if the output is correct.
+ */
+BEGIN
+{
+	dir[i++] = "/foo/bar/baz";
+	dir[i++] = "/foo/bar///baz/";
+	dir[i++] = "/foo/bar/baz/";
+	dir[i++] = "/foo/bar/baz//";
+	dir[i++] = "/foo/bar/baz/.";
+	dir[i++] = "/foo/bar/baz/./";
+	dir[i++] = "/foo/bar/baz/.//";
+	dir[i++] = "foo/bar/baz/";
+	dir[i++] = "/";
+	dir[i++] = "./";
+	dir[i++] = "//";
+	dir[i++] = "/.";
+	dir[i++] = "/./";
+	dir[i++] = "/./.";
+	dir[i++] = "/.//";
+	dir[i++] = ".";
+	dir[i++] = "f";
+	dir[i++] = "f/";
+	dir[i++] = "/////";
+	dir[i++] = "";
+
+	end = i;
+	i = 0;
+
+	printf("#!/usr/bin/ksh\n\n");
+}
+
+tick-1ms
+/i < end/
+{
+	printf("if [ `basename \"%s\"` != \"%s\" ]; then\n",
+	    dir[i], basename(dir[i]));
+	printf("	echo \"basename(\\\"%s\\\") is \\\"%s\\\"; ",
+	    dir[i], basename(dir[i]));
+	printf("expected \\\"`basename \"%s\"`\"\\\"\n", dir[i]);
+	printf("fi\n\n");
+	printf("if [ `dirname \"%s\"` != \"%s\" ]; then\n",
+	    dir[i], dirname(dir[i]));
+	printf("	echo \"dirname(\\\"%s\\\") is \\\"%s\\\"; ",
+	    dir[i], dirname(dir[i]));
+	printf("expected \\\"`dirname \"%s\"`\"\\\"\n", dir[i]);
+	printf("fi\n\n");
+	i++;
+}
+
+tick-1ms
+/i == end/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out
new file mode 100755
index 0000000..e16541a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.basename.d.out
@@ -0,0 +1,163 @@
+#!/usr/bin/ksh
+
+if [ `basename "/foo/bar/baz"` != "baz" ]; then
+	echo "basename(\"/foo/bar/baz\") is \"baz\"; expected \"`basename "/foo/bar/baz"`"\"
+fi
+
+if [ `dirname "/foo/bar/baz"` != "/foo/bar" ]; then
+	echo "dirname(\"/foo/bar/baz\") is \"/foo/bar\"; expected \"`dirname "/foo/bar/baz"`"\"
+fi
+
+if [ `basename "/foo/bar///baz/"` != "baz" ]; then
+	echo "basename(\"/foo/bar///baz/\") is \"baz\"; expected \"`basename "/foo/bar///baz/"`"\"
+fi
+
+if [ `dirname "/foo/bar///baz/"` != "/foo/bar" ]; then
+	echo "dirname(\"/foo/bar///baz/\") is \"/foo/bar\"; expected \"`dirname "/foo/bar///baz/"`"\"
+fi
+
+if [ `basename "/foo/bar/baz/"` != "baz" ]; then
+	echo "basename(\"/foo/bar/baz/\") is \"baz\"; expected \"`basename "/foo/bar/baz/"`"\"
+fi
+
+if [ `dirname "/foo/bar/baz/"` != "/foo/bar" ]; then
+	echo "dirname(\"/foo/bar/baz/\") is \"/foo/bar\"; expected \"`dirname "/foo/bar/baz/"`"\"
+fi
+
+if [ `basename "/foo/bar/baz//"` != "baz" ]; then
+	echo "basename(\"/foo/bar/baz//\") is \"baz\"; expected \"`basename "/foo/bar/baz//"`"\"
+fi
+
+if [ `dirname "/foo/bar/baz//"` != "/foo/bar" ]; then
+	echo "dirname(\"/foo/bar/baz//\") is \"/foo/bar\"; expected \"`dirname "/foo/bar/baz//"`"\"
+fi
+
+if [ `basename "/foo/bar/baz/."` != "." ]; then
+	echo "basename(\"/foo/bar/baz/.\") is \".\"; expected \"`basename "/foo/bar/baz/."`"\"
+fi
+
+if [ `dirname "/foo/bar/baz/."` != "/foo/bar/baz" ]; then
+	echo "dirname(\"/foo/bar/baz/.\") is \"/foo/bar/baz\"; expected \"`dirname "/foo/bar/baz/."`"\"
+fi
+
+if [ `basename "/foo/bar/baz/./"` != "." ]; then
+	echo "basename(\"/foo/bar/baz/./\") is \".\"; expected \"`basename "/foo/bar/baz/./"`"\"
+fi
+
+if [ `dirname "/foo/bar/baz/./"` != "/foo/bar/baz" ]; then
+	echo "dirname(\"/foo/bar/baz/./\") is \"/foo/bar/baz\"; expected \"`dirname "/foo/bar/baz/./"`"\"
+fi
+
+if [ `basename "/foo/bar/baz/.//"` != "." ]; then
+	echo "basename(\"/foo/bar/baz/.//\") is \".\"; expected \"`basename "/foo/bar/baz/.//"`"\"
+fi
+
+if [ `dirname "/foo/bar/baz/.//"` != "/foo/bar/baz" ]; then
+	echo "dirname(\"/foo/bar/baz/.//\") is \"/foo/bar/baz\"; expected \"`dirname "/foo/bar/baz/.//"`"\"
+fi
+
+if [ `basename "foo/bar/baz/"` != "baz" ]; then
+	echo "basename(\"foo/bar/baz/\") is \"baz\"; expected \"`basename "foo/bar/baz/"`"\"
+fi
+
+if [ `dirname "foo/bar/baz/"` != "foo/bar" ]; then
+	echo "dirname(\"foo/bar/baz/\") is \"foo/bar\"; expected \"`dirname "foo/bar/baz/"`"\"
+fi
+
+if [ `basename "/"` != "/" ]; then
+	echo "basename(\"/\") is \"/\"; expected \"`basename "/"`"\"
+fi
+
+if [ `dirname "/"` != "/" ]; then
+	echo "dirname(\"/\") is \"/\"; expected \"`dirname "/"`"\"
+fi
+
+if [ `basename "./"` != "." ]; then
+	echo "basename(\"./\") is \".\"; expected \"`basename "./"`"\"
+fi
+
+if [ `dirname "./"` != "." ]; then
+	echo "dirname(\"./\") is \".\"; expected \"`dirname "./"`"\"
+fi
+
+if [ `basename "//"` != "/" ]; then
+	echo "basename(\"//\") is \"/\"; expected \"`basename "//"`"\"
+fi
+
+if [ `dirname "//"` != "/" ]; then
+	echo "dirname(\"//\") is \"/\"; expected \"`dirname "//"`"\"
+fi
+
+if [ `basename "/."` != "." ]; then
+	echo "basename(\"/.\") is \".\"; expected \"`basename "/."`"\"
+fi
+
+if [ `dirname "/."` != "/" ]; then
+	echo "dirname(\"/.\") is \"/\"; expected \"`dirname "/."`"\"
+fi
+
+if [ `basename "/./"` != "." ]; then
+	echo "basename(\"/./\") is \".\"; expected \"`basename "/./"`"\"
+fi
+
+if [ `dirname "/./"` != "/" ]; then
+	echo "dirname(\"/./\") is \"/\"; expected \"`dirname "/./"`"\"
+fi
+
+if [ `basename "/./."` != "." ]; then
+	echo "basename(\"/./.\") is \".\"; expected \"`basename "/./."`"\"
+fi
+
+if [ `dirname "/./."` != "/." ]; then
+	echo "dirname(\"/./.\") is \"/.\"; expected \"`dirname "/./."`"\"
+fi
+
+if [ `basename "/.//"` != "." ]; then
+	echo "basename(\"/.//\") is \".\"; expected \"`basename "/.//"`"\"
+fi
+
+if [ `dirname "/.//"` != "/" ]; then
+	echo "dirname(\"/.//\") is \"/\"; expected \"`dirname "/.//"`"\"
+fi
+
+if [ `basename "."` != "." ]; then
+	echo "basename(\".\") is \".\"; expected \"`basename "."`"\"
+fi
+
+if [ `dirname "."` != "." ]; then
+	echo "dirname(\".\") is \".\"; expected \"`dirname "."`"\"
+fi
+
+if [ `basename "f"` != "f" ]; then
+	echo "basename(\"f\") is \"f\"; expected \"`basename "f"`"\"
+fi
+
+if [ `dirname "f"` != "." ]; then
+	echo "dirname(\"f\") is \".\"; expected \"`dirname "f"`"\"
+fi
+
+if [ `basename "f/"` != "f" ]; then
+	echo "basename(\"f/\") is \"f\"; expected \"`basename "f/"`"\"
+fi
+
+if [ `dirname "f/"` != "." ]; then
+	echo "dirname(\"f/\") is \".\"; expected \"`dirname "f/"`"\"
+fi
+
+if [ `basename "/////"` != "/" ]; then
+	echo "basename(\"/////\") is \"/\"; expected \"`basename "/////"`"\"
+fi
+
+if [ `dirname "/////"` != "/" ]; then
+	echo "dirname(\"/////\") is \"/\"; expected \"`dirname "/////"`"\"
+fi
+
+if [ `basename ""` != "." ]; then
+	echo "basename(\"\") is \".\"; expected \"`basename ""`"\"
+fi
+
+if [ `dirname ""` != "." ]; then
+	echo "dirname(\"\") is \".\"; expected \"`dirname ""`"\"
+fi
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.bcopy.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.bcopy.d
new file mode 100644
index 0000000..8501ff4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.bcopy.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	bcopy should copy from one memory location to another
+ *
+ * SECTION: Actions and Subroutines/alloca();
+ * 	Actions and Subroutines/bcopy()
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	ptr = alloca(sizeof (int));
+	bcopy((void *)&`kmem_flags, ptr, sizeof (int));
+	intp = (int *)ptr;
+	ret = (`kmem_flags == *intp) ? 0 : 1;
+}
+
+tick-1
+/ret == 0/
+{
+	exit(0);
+}
+
+tick-1
+/ret == 1/
+{
+	printf("memory address contained 0x%x, expected 0x%x\n",
+		*intp, `kmem_flags);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.chill.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.chill.ksh
new file mode 100644
index 0000000..aae1c68
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.chill.ksh
@@ -0,0 +1,77 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+dtrace_script()
+{
+	
+	$dtrace -w -s /dev/stdin <<EOF
+
+	/*
+ 	* ASSERTION:
+ 	*	Positive test of chill()
+ 	*
+ 	* SECTION: Actions and Subroutines/chill()
+ 	* 
+ 	* NOTES: This test does no verification - it's not possible.  So,
+ 	* 	we just run this and make sure it runs.
+ 	*/
+
+	BEGIN 
+	{
+		i = 0;
+	}
+
+	syscall:::entry
+	/i <= 5/
+	{
+		chill(100000000);
+		i++;
+	}
+
+	syscall:::entry
+	/i > 5/
+	{
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+dtrace_script &
+child=$!
+
+wait $child
+status=$?
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d
new file mode 100644
index 0000000..2f05418
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	path[i++] = "/foo/bar/baz";
+	path[i++] = "/foo/bar///baz/";
+	path[i++] = "/foo/bar/baz/";
+	path[i++] = "/foo/bar/baz//";
+	path[i++] = "/foo/bar/baz/.";
+	path[i++] = "/foo/bar/baz/./";
+	path[i++] = "/foo/bar/../../baz/.//";
+	path[i++] = "foo/bar/./././././baz/";
+	path[i++] = "/foo/bar/baz/../../../../../../";
+	path[i++] = "/../../../../../../";
+	path[i++] = "/./";
+	path[i++] = "/foo/bar/baz/../../bop/bang/../../bar/baz/";
+	path[i++] = "./";
+	path[i++] = "//";
+	path[i++] = "/.";
+	path[i++] = "/./";
+	path[i++] = "/./.";
+	path[i++] = "/.//";
+	path[i++] = ".";
+	path[i++] = "/////";
+	path[i++] = "";
+
+	end = i;
+	i = 0;
+}
+
+tick-1ms
+/i < end/
+{
+	printf("cleanpath(\"%s\") = \"%s\"\n", path[i], cleanpath(path[i]));
+	i++;
+}
+
+tick-1ms
+/i == end/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d.out
new file mode 100644
index 0000000..b8bdc09
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.cleanpath.d.out
@@ -0,0 +1,22 @@
+cleanpath("/foo/bar/baz") = "/foo/bar/baz"
+cleanpath("/foo/bar///baz/") = "/foo/bar/baz/"
+cleanpath("/foo/bar/baz/") = "/foo/bar/baz/"
+cleanpath("/foo/bar/baz//") = "/foo/bar/baz/"
+cleanpath("/foo/bar/baz/.") = "/foo/bar/baz/."
+cleanpath("/foo/bar/baz/./") = "/foo/bar/baz/"
+cleanpath("/foo/bar/../../baz/.//") = "/baz/"
+cleanpath("foo/bar/./././././baz/") = "foo/bar/baz/"
+cleanpath("/foo/bar/baz/../../../../../../") = "/"
+cleanpath("/../../../../../../") = "/"
+cleanpath("/./") = "/"
+cleanpath("/foo/bar/baz/../../bop/bang/../../bar/baz/") = "/foo/bar/baz/"
+cleanpath("./") = "./"
+cleanpath("//") = "/"
+cleanpath("/.") = "/."
+cleanpath("/./") = "/"
+cleanpath("/./.") = "/."
+cleanpath("/.//") = "/"
+cleanpath(".") = "."
+cleanpath("/////") = "/"
+cleanpath("") = ""
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.copyin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.copyin.d
new file mode 100644
index 0000000..186b974
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.copyin.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  This D ditty tests the ability to perform both copyin and copyinstr.  We
+ *  grab the value or pr_envp, read the first pointer from the user stack,
+ *  and then copyinstr the first environment variable and print it.
+ *
+ * SECTION: Actions and Subroutines/copyin();
+ * 	Actions and Subroutines/copyinstr();
+ *	User Process Tracing/copyin() and copyinstr()
+ */
+
+BEGIN
+/curpsinfo->pr_dmodel == PR_MODEL_ILP32/
+{
+	envp = *(uint32_t *)copyin(curpsinfo->pr_envp, sizeof (uint32_t));
+	printf("envp[0] = \"%s\"", copyinstr(envp));
+	exit(0);
+}
+
+BEGIN
+/curpsinfo->pr_dmodel == PR_MODEL_LP64/
+{
+	envp = *(uint64_t *)copyin(curpsinfo->pr_envp, sizeof (uint64_t));
+	printf("envp[0] = \"%s\"", copyinstr(envp));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.copyinto.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.copyinto.d
new file mode 100644
index 0000000..c282e61
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.copyinto.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	test copyinto by copying the first string of the user's
+ *	environment.
+ *
+ * SECTION: Actions and Subroutines/copyinto()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+/curpsinfo->pr_dmodel == PR_MODEL_ILP32/
+{
+	envp = alloca(sizeof (uint32_t));
+	copyinto(curpsinfo->pr_envp, sizeof (uint32_t), envp);
+	printf("envp[0] = \"%s\"", copyinstr(*(uint32_t *)envp));
+	exit(0);
+}
+
+BEGIN
+/curpsinfo->pr_dmodel == PR_MODEL_LP64/
+{
+	envp = alloca(sizeof (uint64_t));
+	copyinto(curpsinfo->pr_envp, sizeof (uint64_t), envp);
+	printf("envp[0] = \"%s\"", copyinstr(*(uint64_t *)envp));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ddi_pathname.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ddi_pathname.d
new file mode 100644
index 0000000..3716d0c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ddi_pathname.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	this->dev = (struct dev_info *)alloca(sizeof (struct dev_info));
+	this->minor1 =
+	    (struct ddi_minor_data *)alloca(sizeof (struct ddi_minor_data));
+	this->minor2 =
+	    (struct ddi_minor_data *)alloca(sizeof (struct ddi_minor_data));
+	this->minor3 =
+	    (struct ddi_minor_data *)alloca(sizeof (struct ddi_minor_data));
+
+	this->minor1->d_minor.dev = 0;
+	this->minor1->next = this->minor2;
+
+	this->minor2->d_minor.dev = 0;
+	this->minor2->next = this->minor3;
+
+	this->minor3->d_minor.dev = 0;
+	this->minor3->next = this->minor1;
+
+	this->dev->devi_minor = this->minor1;
+	trace(ddi_pathname(this->dev, 1));
+}
+
+ERROR
+/arg4 == DTRACEFLT_ILLOP/
+{
+	exit(0);
+}
+
+ERROR
+/arg4 != DTRACEFLT_ILLOP/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.default.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.default.d
new file mode 100644
index 0000000..c4a4e4f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.default.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Verify that empty clauses are OK.
+ *
+ * SECTION:  Actions and Subroutines/Default Action
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 1;
+
+}
+
+syscall:::entry
+{
+
+
+}
+
+tick-1
+/i != 0/
+{
+	exit(0);
+}
+
+
+END
+{
+
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.freopen.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.freopen.ksh
new file mode 100644
index 0000000..f87d6e1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.freopen.ksh
@@ -0,0 +1,111 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -wq -o $tmpfile -s /dev/stdin $tmpfile <<EOF
+	BEGIN
+	{
+		i = 0;
+	}
+
+	tick-10ms
+	{
+		freopen("%s.%d", \$\$1, i);
+		printf("%d\n", i)
+	}
+
+	tick-10ms
+	/++i == $iter/
+	{
+		freopen("");
+		printf("%d\n", i);
+		exit(0);
+	}
+EOF
+}
+
+cleanup()
+{
+	let i=0
+
+	if [ -f $tmpfile ]; then
+		rm $tmpfile
+	fi
+
+	while [ "$i" -lt "$iter" ]; do
+		if [ -f $tmpfile.$i ]; then
+			rm $tmpfile.$i
+		fi
+		let i=i+1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+tmpfile=/tmp/tst.freopen.$$
+iter=20
+
+script
+status=$?
+
+let i=0
+
+if [ -f $tmpfile.$iter ]; then
+	echo "$0: did not expect to find file: $tmpfile.$iter"
+	cleanup
+	exit 100
+fi
+
+mv $tmpfile $tmpfile.$iter
+let iter=iter+1
+
+while [ "$i" -lt "$iter" ]; do
+	if [ ! -f $tmpfile.$i ]; then
+		echo "$0: did not find expected file: $tmpfile.$i"
+		cleanup
+		exit 101
+	fi
+
+	j=`cat $tmpfile.$i`
+
+	if [ "$i" -ne "$j" ]; then
+		echo "$0: unexpected contents in $tmpfile.$i: " \
+		    "expected $i, found $j"
+		cleanup
+		exit 102
+	fi
+
+	rm $tmpfile.$i
+	let i=i+1
+done
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ftruncate.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ftruncate.ksh
new file mode 100644
index 0000000..b02af07
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ftruncate.ksh
@@ -0,0 +1,64 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -q -o $tmpfile -s /dev/stdin <<EOF
+	tick-10ms
+	{
+		printf("%d\n", i++);
+	}
+
+	tick-10ms
+	/i == 10/
+	{
+		ftruncate();
+	}
+
+	tick-10ms
+	/i == 20/
+	{
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+tmpfile=/tmp/tst.ftruncate.$$
+
+script
+status=$?
+
+cat $tmpfile
+rm $tmpfile
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ftruncate.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ftruncate.ksh.out
new file mode 100644
index 0000000..3360fd2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.ftruncate.ksh.out
@@ -0,0 +1,11 @@
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.hton.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.hton.d
new file mode 100644
index 0000000..f011883
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.hton.d
@@ -0,0 +1,97 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test network byte-ordering routines.
+ */
+
+#include <sys/isa_defs.h>
+
+BEGIN
+{
+	before[0] = 0x1122LL;
+	before[1] = 0x11223344LL;
+	before[2] = 0x1122334455667788LL;
+
+#ifdef _LITTLE_ENDIAN
+	after[0] = 0x2211LL;
+	after[1] = 0x44332211LL;
+	after[2] = 0x8877665544332211LL;
+#else
+	after[0] = 0x1122LL;
+	after[1] = 0x11223344LL;
+	after[2] = 0x1122334455667788LL;
+#endif
+}
+
+BEGIN
+/after[0] != htons(before[0])/
+{
+	printf("%x rather than %x", htons(before[0]), after[0]);
+	exit(1);
+}
+
+BEGIN
+/after[0] != ntohs(before[0])/
+{
+	printf("%x rather than %x", ntohs(before[0]), after[0]);
+	exit(1);
+}
+
+BEGIN
+/after[1] != htonl(before[1])/
+{
+	printf("%x rather than %x", htonl(before[1]), after[1]);
+	exit(1);
+}
+
+BEGIN
+/after[1] != ntohl(before[1])/
+{
+	printf("%x rather than %x", ntohl(before[1]), after[1]);
+	exit(1);
+}
+
+BEGIN
+/after[2] != htonll(before[2])/
+{
+	printf("%x rather than %x", htonll(before[2]), after[2]);
+	exit(1);
+}
+
+BEGIN
+/after[2] != ntohll(before[2])/
+{
+	printf("%x rather than %x", ntohll(before[2]), after[2]);
+	exit(1);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.index.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.index.d
new file mode 100644
index 0000000..547730a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.index.d
@@ -0,0 +1,226 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+struct {
+	string str;
+	string substr;
+	int haspos;
+	int position;
+} command[int];
+
+int i;
+
+BEGIN
+{
+	command[i].str = "foobarbaz";
+	command[i].substr = "barbaz";
+	i++;
+
+	command[i].str = "foofoofoo";
+	command[i].substr = "foo";
+	i++;
+
+	command[i].str = "boofoofoo";
+	command[i].substr = "foo";
+	i++;
+
+	command[i].str = "foobarbaz";
+	command[i].substr = "barbazzy";
+	i++;
+
+	command[i].str = "foobar";
+	command[i].substr = "foobar";
+	i++;
+
+	command[i].str = "foobar";
+	command[i].substr = "foobarbaz";
+	i++;
+
+	command[i].str = "";
+	command[i].substr = "foobar";
+	i++;
+
+	command[i].str = "foobar";
+	command[i].substr = "";
+	i++;
+
+	command[i].str = "";
+	command[i].substr = "";
+	i++;
+
+	command[i].str = "foo";
+	command[i].substr = "";
+	i++;
+
+	end = j = k = 0;
+	printf("#!/usr/perl5/bin/perl\n\nBEGIN {\n");
+}
+
+tick-1ms
+/j < i && end == 0/
+{
+	command[i + k].str = command[j].str;
+	command[i + k].substr = command[j].substr;
+	command[i + k].haspos = 1;
+	command[i + k].position = -400;
+	k++;
+
+	command[i + k].str = command[j].str;
+	command[i + k].substr = command[j].substr;
+	command[i + k].haspos = 1;
+	command[i + k].position = -1;
+	k++;
+
+	command[i + k].str = command[j].str;
+	command[i + k].substr = command[j].substr;
+	command[i + k].haspos = 1;
+	command[i + k].position = 0;
+	k++;
+
+	command[i + k].str = command[j].str;
+	command[i + k].substr = command[j].substr;
+	command[i + k].haspos = 1;
+	command[i + k].position = strlen(command[j].str) / 2;
+	k++;
+
+	command[i + k].str = command[j].str;
+	command[i + k].substr = command[j].substr;
+	command[i + k].haspos = 1;
+	command[i + k].position = strlen(command[j].str);
+	k++;
+
+	command[i + k].str = command[j].str;
+	command[i + k].substr = command[j].substr;
+	command[i + k].haspos = 1;
+	command[i + k].position = strlen(command[j].str) + 1;
+	k++;
+
+	command[i + k].str = command[j].str;
+	command[i + k].substr = command[j].substr;
+	command[i + k].haspos = 1;
+	command[i + k].position = strlen(command[j].str) + 2;
+	k++;
+
+	command[i + k].str = command[j].str;
+	command[i + k].substr = command[j].substr;
+	command[i + k].haspos = 1;
+	command[i + k].position = 400;
+	k++;
+
+	j++;
+}
+
+tick-1ms
+/j == i && end == 0/
+{
+	end = k;
+	i = 0;
+}
+
+tick-1ms
+/end != 0 && i < end && !command[i].haspos/
+{
+	this->result = index(command[i].str, command[i].substr);
+
+	printf("\tif (index(\"%s\", \"%s\") != %d) {\n",
+	    command[i].str, command[i].substr, this->result);
+	printf("\t\tprintf(\"perl => index(\\\"%s\\\", \\\"%s\\\") = ",
+	    command[i].str, command[i].substr);
+	printf("%%d\\n\",\n\t\t    index(\"%s\", \"%s\"));\n",
+	    command[i].str, command[i].substr);
+	printf("\t\tprintf(\"   D => index(\\\"%s\\\", \\\"%s\\\") = ",
+	    command[i].str, command[i].substr);
+	printf("%d\\n\");\n", this->result);
+	printf("\t\t$failed++;\n");
+	printf("\t}\n\n");
+}
+
+tick-1ms
+/end != 0 && i < end && !command[i].haspos/
+{
+	this->result = rindex(command[i].str, command[i].substr);
+
+	printf("\tif (rindex(\"%s\", \"%s\") != %d) {\n",
+	    command[i].str, command[i].substr, this->result);
+	printf("\t\tprintf(\"perl => rindex(\\\"%s\\\", \\\"%s\\\") = ",
+	    command[i].str, command[i].substr);
+	printf("%%d\\n\",\n\t\t    rindex(\"%s\", \"%s\"));\n",
+	    command[i].str, command[i].substr);
+	printf("\t\tprintf(\"   D => rindex(\\\"%s\\\", \\\"%s\\\") = ",
+	    command[i].str, command[i].substr);
+	printf("%d\\n\");\n", this->result);
+	printf("\t\t$failed++;\n");
+	printf("\t}\n\n");
+}
+
+tick-1ms
+/end != 0 && i < end && command[i].haspos/
+{
+	this->result = index(command[i].str,
+	    command[i].substr, command[i].position);
+
+	printf("\tif (index(\"%s\", \"%s\", %d) != %d) {\n", command[i].str,
+	    command[i].substr, command[i].position, this->result);
+	printf("\t\tprintf(\"perl => index(\\\"%s\\\", \\\"%s\\\", %d) = ",
+	    command[i].str, command[i].substr, command[i].position);
+	printf("%%d\\n\",\n\t\t    index(\"%s\", \"%s\", %d));\n",
+	    command[i].str, command[i].substr, command[i].position);
+	printf("\t\tprintf(\"   D => index(\\\"%s\\\", \\\"%s\\\", %d) = ",
+	    command[i].str, command[i].substr, command[i].position);
+	printf("%d\\n\");\n", this->result);
+	printf("\t\t$failed++;\n");
+	printf("\t}\n\n");
+}
+
+tick-1ms
+/end != 0 && i < end && command[i].haspos/
+{
+	this->result = rindex(command[i].str,
+	    command[i].substr, command[i].position);
+
+	printf("\tif (rindex(\"%s\", \"%s\", %d) != %d) {\n", command[i].str,
+	    command[i].substr, command[i].position, this->result);
+	printf("\t\tprintf(\"perl => rindex(\\\"%s\\\", \\\"%s\\\", %d) = ",
+	    command[i].str, command[i].substr, command[i].position);
+	printf("%%d\\n\",\n\t\t    rindex(\"%s\", \"%s\", %d));\n",
+	    command[i].str, command[i].substr, command[i].position);
+	printf("\t\tprintf(\"   D => rindex(\\\"%s\\\", \\\"%s\\\", %d) = ",
+	    command[i].str, command[i].substr, command[i].position);
+	printf("%d\\n\");\n", this->result);
+	printf("\t\t$failed++;\n");
+	printf("\t}\n\n");
+}
+
+tick-1ms
+/end != 0 && ++i == end/
+{
+	printf("\texit($failed);\n}\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.index.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.index.d.out
new file mode 100755
index 0000000..276576c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.index.d.out
@@ -0,0 +1,1126 @@
+#!/usr/perl5/bin/perl
+
+BEGIN {
+	if (index("foobarbaz", "barbaz") != 3) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\") = %d\n",
+		    index("foobarbaz", "barbaz"));
+		printf("   D => index(\"foobarbaz\", \"barbaz\") = 3\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz") != 3) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\") = %d\n",
+		    rindex("foobarbaz", "barbaz"));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\") = 3\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo") != 0) {
+		printf("perl => index(\"foofoofoo\", \"foo\") = %d\n",
+		    index("foofoofoo", "foo"));
+		printf("   D => index(\"foofoofoo\", \"foo\") = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo") != 6) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\") = %d\n",
+		    rindex("foofoofoo", "foo"));
+		printf("   D => rindex(\"foofoofoo\", \"foo\") = 6\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo") != 3) {
+		printf("perl => index(\"boofoofoo\", \"foo\") = %d\n",
+		    index("boofoofoo", "foo"));
+		printf("   D => index(\"boofoofoo\", \"foo\") = 3\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo") != 6) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\") = %d\n",
+		    rindex("boofoofoo", "foo"));
+		printf("   D => rindex(\"boofoofoo\", \"foo\") = 6\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy") != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\") = %d\n",
+		    index("foobarbaz", "barbazzy"));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\") = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy") != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\") = %d\n",
+		    rindex("foobarbaz", "barbazzy"));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\") = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar") != 0) {
+		printf("perl => index(\"foobar\", \"foobar\") = %d\n",
+		    index("foobar", "foobar"));
+		printf("   D => index(\"foobar\", \"foobar\") = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar") != 0) {
+		printf("perl => rindex(\"foobar\", \"foobar\") = %d\n",
+		    rindex("foobar", "foobar"));
+		printf("   D => rindex(\"foobar\", \"foobar\") = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz") != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\") = %d\n",
+		    index("foobar", "foobarbaz"));
+		printf("   D => index(\"foobar\", \"foobarbaz\") = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz") != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\") = %d\n",
+		    rindex("foobar", "foobarbaz"));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\") = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar") != -1) {
+		printf("perl => index(\"\", \"foobar\") = %d\n",
+		    index("", "foobar"));
+		printf("   D => index(\"\", \"foobar\") = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar") != -1) {
+		printf("perl => rindex(\"\", \"foobar\") = %d\n",
+		    rindex("", "foobar"));
+		printf("   D => rindex(\"\", \"foobar\") = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "") != 0) {
+		printf("perl => index(\"foobar\", \"\") = %d\n",
+		    index("foobar", ""));
+		printf("   D => index(\"foobar\", \"\") = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "") != 6) {
+		printf("perl => rindex(\"foobar\", \"\") = %d\n",
+		    rindex("foobar", ""));
+		printf("   D => rindex(\"foobar\", \"\") = 6\n");
+		$failed++;
+	}
+
+	if (index("", "") != 0) {
+		printf("perl => index(\"\", \"\") = %d\n",
+		    index("", ""));
+		printf("   D => index(\"\", \"\") = 0\n");
+		$failed++;
+	}
+
+	if (rindex("", "") != 0) {
+		printf("perl => rindex(\"\", \"\") = %d\n",
+		    rindex("", ""));
+		printf("   D => rindex(\"\", \"\") = 0\n");
+		$failed++;
+	}
+
+	if (index("foo", "") != 0) {
+		printf("perl => index(\"foo\", \"\") = %d\n",
+		    index("foo", ""));
+		printf("   D => index(\"foo\", \"\") = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foo", "") != 3) {
+		printf("perl => rindex(\"foo\", \"\") = %d\n",
+		    rindex("foo", ""));
+		printf("   D => rindex(\"foo\", \"\") = 3\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbaz", -400) != 3) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\", -400) = %d\n",
+		    index("foobarbaz", "barbaz", -400));
+		printf("   D => index(\"foobarbaz\", \"barbaz\", -400) = 3\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz", -400) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\", -400) = %d\n",
+		    rindex("foobarbaz", "barbaz", -400));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbaz", -1) != 3) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\", -1) = %d\n",
+		    index("foobarbaz", "barbaz", -1));
+		printf("   D => index(\"foobarbaz\", \"barbaz\", -1) = 3\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz", -1) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\", -1) = %d\n",
+		    rindex("foobarbaz", "barbaz", -1));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbaz", 0) != 3) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\", 0) = %d\n",
+		    index("foobarbaz", "barbaz", 0));
+		printf("   D => index(\"foobarbaz\", \"barbaz\", 0) = 3\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz", 0) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\", 0) = %d\n",
+		    rindex("foobarbaz", "barbaz", 0));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbaz", 4) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\", 4) = %d\n",
+		    index("foobarbaz", "barbaz", 4));
+		printf("   D => index(\"foobarbaz\", \"barbaz\", 4) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz", 4) != 3) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\", 4) = %d\n",
+		    rindex("foobarbaz", "barbaz", 4));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\", 4) = 3\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbaz", 9) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\", 9) = %d\n",
+		    index("foobarbaz", "barbaz", 9));
+		printf("   D => index(\"foobarbaz\", \"barbaz\", 9) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz", 9) != 3) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\", 9) = %d\n",
+		    rindex("foobarbaz", "barbaz", 9));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\", 9) = 3\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbaz", 10) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\", 10) = %d\n",
+		    index("foobarbaz", "barbaz", 10));
+		printf("   D => index(\"foobarbaz\", \"barbaz\", 10) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz", 10) != 3) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\", 10) = %d\n",
+		    rindex("foobarbaz", "barbaz", 10));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\", 10) = 3\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbaz", 11) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\", 11) = %d\n",
+		    index("foobarbaz", "barbaz", 11));
+		printf("   D => index(\"foobarbaz\", \"barbaz\", 11) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz", 11) != 3) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\", 11) = %d\n",
+		    rindex("foobarbaz", "barbaz", 11));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\", 11) = 3\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbaz", 400) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbaz\", 400) = %d\n",
+		    index("foobarbaz", "barbaz", 400));
+		printf("   D => index(\"foobarbaz\", \"barbaz\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbaz", 400) != 3) {
+		printf("perl => rindex(\"foobarbaz\", \"barbaz\", 400) = %d\n",
+		    rindex("foobarbaz", "barbaz", 400));
+		printf("   D => rindex(\"foobarbaz\", \"barbaz\", 400) = 3\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo", -400) != 0) {
+		printf("perl => index(\"foofoofoo\", \"foo\", -400) = %d\n",
+		    index("foofoofoo", "foo", -400));
+		printf("   D => index(\"foofoofoo\", \"foo\", -400) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo", -400) != -1) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\", -400) = %d\n",
+		    rindex("foofoofoo", "foo", -400));
+		printf("   D => rindex(\"foofoofoo\", \"foo\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo", -1) != 0) {
+		printf("perl => index(\"foofoofoo\", \"foo\", -1) = %d\n",
+		    index("foofoofoo", "foo", -1));
+		printf("   D => index(\"foofoofoo\", \"foo\", -1) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo", -1) != -1) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\", -1) = %d\n",
+		    rindex("foofoofoo", "foo", -1));
+		printf("   D => rindex(\"foofoofoo\", \"foo\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo", 0) != 0) {
+		printf("perl => index(\"foofoofoo\", \"foo\", 0) = %d\n",
+		    index("foofoofoo", "foo", 0));
+		printf("   D => index(\"foofoofoo\", \"foo\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo", 0) != 0) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\", 0) = %d\n",
+		    rindex("foofoofoo", "foo", 0));
+		printf("   D => rindex(\"foofoofoo\", \"foo\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo", 4) != 6) {
+		printf("perl => index(\"foofoofoo\", \"foo\", 4) = %d\n",
+		    index("foofoofoo", "foo", 4));
+		printf("   D => index(\"foofoofoo\", \"foo\", 4) = 6\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo", 4) != 3) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\", 4) = %d\n",
+		    rindex("foofoofoo", "foo", 4));
+		printf("   D => rindex(\"foofoofoo\", \"foo\", 4) = 3\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo", 9) != -1) {
+		printf("perl => index(\"foofoofoo\", \"foo\", 9) = %d\n",
+		    index("foofoofoo", "foo", 9));
+		printf("   D => index(\"foofoofoo\", \"foo\", 9) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo", 9) != 6) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\", 9) = %d\n",
+		    rindex("foofoofoo", "foo", 9));
+		printf("   D => rindex(\"foofoofoo\", \"foo\", 9) = 6\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo", 10) != -1) {
+		printf("perl => index(\"foofoofoo\", \"foo\", 10) = %d\n",
+		    index("foofoofoo", "foo", 10));
+		printf("   D => index(\"foofoofoo\", \"foo\", 10) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo", 10) != 6) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\", 10) = %d\n",
+		    rindex("foofoofoo", "foo", 10));
+		printf("   D => rindex(\"foofoofoo\", \"foo\", 10) = 6\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo", 11) != -1) {
+		printf("perl => index(\"foofoofoo\", \"foo\", 11) = %d\n",
+		    index("foofoofoo", "foo", 11));
+		printf("   D => index(\"foofoofoo\", \"foo\", 11) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo", 11) != 6) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\", 11) = %d\n",
+		    rindex("foofoofoo", "foo", 11));
+		printf("   D => rindex(\"foofoofoo\", \"foo\", 11) = 6\n");
+		$failed++;
+	}
+
+	if (index("foofoofoo", "foo", 400) != -1) {
+		printf("perl => index(\"foofoofoo\", \"foo\", 400) = %d\n",
+		    index("foofoofoo", "foo", 400));
+		printf("   D => index(\"foofoofoo\", \"foo\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foofoofoo", "foo", 400) != 6) {
+		printf("perl => rindex(\"foofoofoo\", \"foo\", 400) = %d\n",
+		    rindex("foofoofoo", "foo", 400));
+		printf("   D => rindex(\"foofoofoo\", \"foo\", 400) = 6\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo", -400) != 3) {
+		printf("perl => index(\"boofoofoo\", \"foo\", -400) = %d\n",
+		    index("boofoofoo", "foo", -400));
+		printf("   D => index(\"boofoofoo\", \"foo\", -400) = 3\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo", -400) != -1) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\", -400) = %d\n",
+		    rindex("boofoofoo", "foo", -400));
+		printf("   D => rindex(\"boofoofoo\", \"foo\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo", -1) != 3) {
+		printf("perl => index(\"boofoofoo\", \"foo\", -1) = %d\n",
+		    index("boofoofoo", "foo", -1));
+		printf("   D => index(\"boofoofoo\", \"foo\", -1) = 3\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo", -1) != -1) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\", -1) = %d\n",
+		    rindex("boofoofoo", "foo", -1));
+		printf("   D => rindex(\"boofoofoo\", \"foo\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo", 0) != 3) {
+		printf("perl => index(\"boofoofoo\", \"foo\", 0) = %d\n",
+		    index("boofoofoo", "foo", 0));
+		printf("   D => index(\"boofoofoo\", \"foo\", 0) = 3\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo", 0) != -1) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\", 0) = %d\n",
+		    rindex("boofoofoo", "foo", 0));
+		printf("   D => rindex(\"boofoofoo\", \"foo\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo", 4) != 6) {
+		printf("perl => index(\"boofoofoo\", \"foo\", 4) = %d\n",
+		    index("boofoofoo", "foo", 4));
+		printf("   D => index(\"boofoofoo\", \"foo\", 4) = 6\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo", 4) != 3) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\", 4) = %d\n",
+		    rindex("boofoofoo", "foo", 4));
+		printf("   D => rindex(\"boofoofoo\", \"foo\", 4) = 3\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo", 9) != -1) {
+		printf("perl => index(\"boofoofoo\", \"foo\", 9) = %d\n",
+		    index("boofoofoo", "foo", 9));
+		printf("   D => index(\"boofoofoo\", \"foo\", 9) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo", 9) != 6) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\", 9) = %d\n",
+		    rindex("boofoofoo", "foo", 9));
+		printf("   D => rindex(\"boofoofoo\", \"foo\", 9) = 6\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo", 10) != -1) {
+		printf("perl => index(\"boofoofoo\", \"foo\", 10) = %d\n",
+		    index("boofoofoo", "foo", 10));
+		printf("   D => index(\"boofoofoo\", \"foo\", 10) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo", 10) != 6) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\", 10) = %d\n",
+		    rindex("boofoofoo", "foo", 10));
+		printf("   D => rindex(\"boofoofoo\", \"foo\", 10) = 6\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo", 11) != -1) {
+		printf("perl => index(\"boofoofoo\", \"foo\", 11) = %d\n",
+		    index("boofoofoo", "foo", 11));
+		printf("   D => index(\"boofoofoo\", \"foo\", 11) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo", 11) != 6) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\", 11) = %d\n",
+		    rindex("boofoofoo", "foo", 11));
+		printf("   D => rindex(\"boofoofoo\", \"foo\", 11) = 6\n");
+		$failed++;
+	}
+
+	if (index("boofoofoo", "foo", 400) != -1) {
+		printf("perl => index(\"boofoofoo\", \"foo\", 400) = %d\n",
+		    index("boofoofoo", "foo", 400));
+		printf("   D => index(\"boofoofoo\", \"foo\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("boofoofoo", "foo", 400) != 6) {
+		printf("perl => rindex(\"boofoofoo\", \"foo\", 400) = %d\n",
+		    rindex("boofoofoo", "foo", 400));
+		printf("   D => rindex(\"boofoofoo\", \"foo\", 400) = 6\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy", -400) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\", -400) = %d\n",
+		    index("foobarbaz", "barbazzy", -400));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy", -400) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\", -400) = %d\n",
+		    rindex("foobarbaz", "barbazzy", -400));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy", -1) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\", -1) = %d\n",
+		    index("foobarbaz", "barbazzy", -1));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy", -1) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\", -1) = %d\n",
+		    rindex("foobarbaz", "barbazzy", -1));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy", 0) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\", 0) = %d\n",
+		    index("foobarbaz", "barbazzy", 0));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy", 0) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 0) = %d\n",
+		    rindex("foobarbaz", "barbazzy", 0));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy", 4) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\", 4) = %d\n",
+		    index("foobarbaz", "barbazzy", 4));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\", 4) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy", 4) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 4) = %d\n",
+		    rindex("foobarbaz", "barbazzy", 4));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\", 4) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy", 9) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\", 9) = %d\n",
+		    index("foobarbaz", "barbazzy", 9));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\", 9) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy", 9) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 9) = %d\n",
+		    rindex("foobarbaz", "barbazzy", 9));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\", 9) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy", 10) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\", 10) = %d\n",
+		    index("foobarbaz", "barbazzy", 10));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\", 10) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy", 10) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 10) = %d\n",
+		    rindex("foobarbaz", "barbazzy", 10));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\", 10) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy", 11) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\", 11) = %d\n",
+		    index("foobarbaz", "barbazzy", 11));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\", 11) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy", 11) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 11) = %d\n",
+		    rindex("foobarbaz", "barbazzy", 11));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\", 11) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobarbaz", "barbazzy", 400) != -1) {
+		printf("perl => index(\"foobarbaz\", \"barbazzy\", 400) = %d\n",
+		    index("foobarbaz", "barbazzy", 400));
+		printf("   D => index(\"foobarbaz\", \"barbazzy\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobarbaz", "barbazzy", 400) != -1) {
+		printf("perl => rindex(\"foobarbaz\", \"barbazzy\", 400) = %d\n",
+		    rindex("foobarbaz", "barbazzy", 400));
+		printf("   D => rindex(\"foobarbaz\", \"barbazzy\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar", -400) != 0) {
+		printf("perl => index(\"foobar\", \"foobar\", -400) = %d\n",
+		    index("foobar", "foobar", -400));
+		printf("   D => index(\"foobar\", \"foobar\", -400) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar", -400) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobar\", -400) = %d\n",
+		    rindex("foobar", "foobar", -400));
+		printf("   D => rindex(\"foobar\", \"foobar\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar", -1) != 0) {
+		printf("perl => index(\"foobar\", \"foobar\", -1) = %d\n",
+		    index("foobar", "foobar", -1));
+		printf("   D => index(\"foobar\", \"foobar\", -1) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar", -1) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobar\", -1) = %d\n",
+		    rindex("foobar", "foobar", -1));
+		printf("   D => rindex(\"foobar\", \"foobar\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar", 0) != 0) {
+		printf("perl => index(\"foobar\", \"foobar\", 0) = %d\n",
+		    index("foobar", "foobar", 0));
+		printf("   D => index(\"foobar\", \"foobar\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar", 0) != 0) {
+		printf("perl => rindex(\"foobar\", \"foobar\", 0) = %d\n",
+		    rindex("foobar", "foobar", 0));
+		printf("   D => rindex(\"foobar\", \"foobar\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar", 3) != -1) {
+		printf("perl => index(\"foobar\", \"foobar\", 3) = %d\n",
+		    index("foobar", "foobar", 3));
+		printf("   D => index(\"foobar\", \"foobar\", 3) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar", 3) != 0) {
+		printf("perl => rindex(\"foobar\", \"foobar\", 3) = %d\n",
+		    rindex("foobar", "foobar", 3));
+		printf("   D => rindex(\"foobar\", \"foobar\", 3) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar", 6) != -1) {
+		printf("perl => index(\"foobar\", \"foobar\", 6) = %d\n",
+		    index("foobar", "foobar", 6));
+		printf("   D => index(\"foobar\", \"foobar\", 6) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar", 6) != 0) {
+		printf("perl => rindex(\"foobar\", \"foobar\", 6) = %d\n",
+		    rindex("foobar", "foobar", 6));
+		printf("   D => rindex(\"foobar\", \"foobar\", 6) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar", 7) != -1) {
+		printf("perl => index(\"foobar\", \"foobar\", 7) = %d\n",
+		    index("foobar", "foobar", 7));
+		printf("   D => index(\"foobar\", \"foobar\", 7) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar", 7) != 0) {
+		printf("perl => rindex(\"foobar\", \"foobar\", 7) = %d\n",
+		    rindex("foobar", "foobar", 7));
+		printf("   D => rindex(\"foobar\", \"foobar\", 7) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar", 8) != -1) {
+		printf("perl => index(\"foobar\", \"foobar\", 8) = %d\n",
+		    index("foobar", "foobar", 8));
+		printf("   D => index(\"foobar\", \"foobar\", 8) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar", 8) != 0) {
+		printf("perl => rindex(\"foobar\", \"foobar\", 8) = %d\n",
+		    rindex("foobar", "foobar", 8));
+		printf("   D => rindex(\"foobar\", \"foobar\", 8) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobar", 400) != -1) {
+		printf("perl => index(\"foobar\", \"foobar\", 400) = %d\n",
+		    index("foobar", "foobar", 400));
+		printf("   D => index(\"foobar\", \"foobar\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobar", 400) != 0) {
+		printf("perl => rindex(\"foobar\", \"foobar\", 400) = %d\n",
+		    rindex("foobar", "foobar", 400));
+		printf("   D => rindex(\"foobar\", \"foobar\", 400) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz", -400) != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\", -400) = %d\n",
+		    index("foobar", "foobarbaz", -400));
+		printf("   D => index(\"foobar\", \"foobarbaz\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz", -400) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\", -400) = %d\n",
+		    rindex("foobar", "foobarbaz", -400));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz", -1) != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\", -1) = %d\n",
+		    index("foobar", "foobarbaz", -1));
+		printf("   D => index(\"foobar\", \"foobarbaz\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz", -1) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\", -1) = %d\n",
+		    rindex("foobar", "foobarbaz", -1));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz", 0) != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\", 0) = %d\n",
+		    index("foobar", "foobarbaz", 0));
+		printf("   D => index(\"foobar\", \"foobarbaz\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz", 0) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\", 0) = %d\n",
+		    rindex("foobar", "foobarbaz", 0));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz", 3) != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\", 3) = %d\n",
+		    index("foobar", "foobarbaz", 3));
+		printf("   D => index(\"foobar\", \"foobarbaz\", 3) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz", 3) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\", 3) = %d\n",
+		    rindex("foobar", "foobarbaz", 3));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\", 3) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz", 6) != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\", 6) = %d\n",
+		    index("foobar", "foobarbaz", 6));
+		printf("   D => index(\"foobar\", \"foobarbaz\", 6) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz", 6) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\", 6) = %d\n",
+		    rindex("foobar", "foobarbaz", 6));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\", 6) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz", 7) != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\", 7) = %d\n",
+		    index("foobar", "foobarbaz", 7));
+		printf("   D => index(\"foobar\", \"foobarbaz\", 7) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz", 7) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\", 7) = %d\n",
+		    rindex("foobar", "foobarbaz", 7));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\", 7) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz", 8) != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\", 8) = %d\n",
+		    index("foobar", "foobarbaz", 8));
+		printf("   D => index(\"foobar\", \"foobarbaz\", 8) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz", 8) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\", 8) = %d\n",
+		    rindex("foobar", "foobarbaz", 8));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\", 8) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "foobarbaz", 400) != -1) {
+		printf("perl => index(\"foobar\", \"foobarbaz\", 400) = %d\n",
+		    index("foobar", "foobarbaz", 400));
+		printf("   D => index(\"foobar\", \"foobarbaz\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "foobarbaz", 400) != -1) {
+		printf("perl => rindex(\"foobar\", \"foobarbaz\", 400) = %d\n",
+		    rindex("foobar", "foobarbaz", 400));
+		printf("   D => rindex(\"foobar\", \"foobarbaz\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar", -400) != -1) {
+		printf("perl => index(\"\", \"foobar\", -400) = %d\n",
+		    index("", "foobar", -400));
+		printf("   D => index(\"\", \"foobar\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar", -400) != -1) {
+		printf("perl => rindex(\"\", \"foobar\", -400) = %d\n",
+		    rindex("", "foobar", -400));
+		printf("   D => rindex(\"\", \"foobar\", -400) = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar", -1) != -1) {
+		printf("perl => index(\"\", \"foobar\", -1) = %d\n",
+		    index("", "foobar", -1));
+		printf("   D => index(\"\", \"foobar\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar", -1) != -1) {
+		printf("perl => rindex(\"\", \"foobar\", -1) = %d\n",
+		    rindex("", "foobar", -1));
+		printf("   D => rindex(\"\", \"foobar\", -1) = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar", 0) != -1) {
+		printf("perl => index(\"\", \"foobar\", 0) = %d\n",
+		    index("", "foobar", 0));
+		printf("   D => index(\"\", \"foobar\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar", 0) != -1) {
+		printf("perl => rindex(\"\", \"foobar\", 0) = %d\n",
+		    rindex("", "foobar", 0));
+		printf("   D => rindex(\"\", \"foobar\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar", 0) != -1) {
+		printf("perl => index(\"\", \"foobar\", 0) = %d\n",
+		    index("", "foobar", 0));
+		printf("   D => index(\"\", \"foobar\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar", 0) != -1) {
+		printf("perl => rindex(\"\", \"foobar\", 0) = %d\n",
+		    rindex("", "foobar", 0));
+		printf("   D => rindex(\"\", \"foobar\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar", 0) != -1) {
+		printf("perl => index(\"\", \"foobar\", 0) = %d\n",
+		    index("", "foobar", 0));
+		printf("   D => index(\"\", \"foobar\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar", 0) != -1) {
+		printf("perl => rindex(\"\", \"foobar\", 0) = %d\n",
+		    rindex("", "foobar", 0));
+		printf("   D => rindex(\"\", \"foobar\", 0) = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar", 1) != -1) {
+		printf("perl => index(\"\", \"foobar\", 1) = %d\n",
+		    index("", "foobar", 1));
+		printf("   D => index(\"\", \"foobar\", 1) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar", 1) != -1) {
+		printf("perl => rindex(\"\", \"foobar\", 1) = %d\n",
+		    rindex("", "foobar", 1));
+		printf("   D => rindex(\"\", \"foobar\", 1) = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar", 2) != -1) {
+		printf("perl => index(\"\", \"foobar\", 2) = %d\n",
+		    index("", "foobar", 2));
+		printf("   D => index(\"\", \"foobar\", 2) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar", 2) != -1) {
+		printf("perl => rindex(\"\", \"foobar\", 2) = %d\n",
+		    rindex("", "foobar", 2));
+		printf("   D => rindex(\"\", \"foobar\", 2) = -1\n");
+		$failed++;
+	}
+
+	if (index("", "foobar", 400) != -1) {
+		printf("perl => index(\"\", \"foobar\", 400) = %d\n",
+		    index("", "foobar", 400));
+		printf("   D => index(\"\", \"foobar\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (rindex("", "foobar", 400) != -1) {
+		printf("perl => rindex(\"\", \"foobar\", 400) = %d\n",
+		    rindex("", "foobar", 400));
+		printf("   D => rindex(\"\", \"foobar\", 400) = -1\n");
+		$failed++;
+	}
+
+	if (index("foobar", "", -400) != 0) {
+		printf("perl => index(\"foobar\", \"\", -400) = %d\n",
+		    index("foobar", "", -400));
+		printf("   D => index(\"foobar\", \"\", -400) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "", -400) != 0) {
+		printf("perl => rindex(\"foobar\", \"\", -400) = %d\n",
+		    rindex("foobar", "", -400));
+		printf("   D => rindex(\"foobar\", \"\", -400) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "", -1) != 0) {
+		printf("perl => index(\"foobar\", \"\", -1) = %d\n",
+		    index("foobar", "", -1));
+		printf("   D => index(\"foobar\", \"\", -1) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "", -1) != 0) {
+		printf("perl => rindex(\"foobar\", \"\", -1) = %d\n",
+		    rindex("foobar", "", -1));
+		printf("   D => rindex(\"foobar\", \"\", -1) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "", 0) != 0) {
+		printf("perl => index(\"foobar\", \"\", 0) = %d\n",
+		    index("foobar", "", 0));
+		printf("   D => index(\"foobar\", \"\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "", 0) != 0) {
+		printf("perl => rindex(\"foobar\", \"\", 0) = %d\n",
+		    rindex("foobar", "", 0));
+		printf("   D => rindex(\"foobar\", \"\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (index("foobar", "", 3) != 3) {
+		printf("perl => index(\"foobar\", \"\", 3) = %d\n",
+		    index("foobar", "", 3));
+		printf("   D => index(\"foobar\", \"\", 3) = 3\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "", 3) != 3) {
+		printf("perl => rindex(\"foobar\", \"\", 3) = %d\n",
+		    rindex("foobar", "", 3));
+		printf("   D => rindex(\"foobar\", \"\", 3) = 3\n");
+		$failed++;
+	}
+
+	if (index("foobar", "", 6) != 6) {
+		printf("perl => index(\"foobar\", \"\", 6) = %d\n",
+		    index("foobar", "", 6));
+		printf("   D => index(\"foobar\", \"\", 6) = 6\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "", 6) != 6) {
+		printf("perl => rindex(\"foobar\", \"\", 6) = %d\n",
+		    rindex("foobar", "", 6));
+		printf("   D => rindex(\"foobar\", \"\", 6) = 6\n");
+		$failed++;
+	}
+
+	if (index("foobar", "", 7) != 6) {
+		printf("perl => index(\"foobar\", \"\", 7) = %d\n",
+		    index("foobar", "", 7));
+		printf("   D => index(\"foobar\", \"\", 7) = 6\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "", 7) != 6) {
+		printf("perl => rindex(\"foobar\", \"\", 7) = %d\n",
+		    rindex("foobar", "", 7));
+		printf("   D => rindex(\"foobar\", \"\", 7) = 6\n");
+		$failed++;
+	}
+
+	if (index("foobar", "", 8) != 6) {
+		printf("perl => index(\"foobar\", \"\", 8) = %d\n",
+		    index("foobar", "", 8));
+		printf("   D => index(\"foobar\", \"\", 8) = 6\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "", 8) != 6) {
+		printf("perl => rindex(\"foobar\", \"\", 8) = %d\n",
+		    rindex("foobar", "", 8));
+		printf("   D => rindex(\"foobar\", \"\", 8) = 6\n");
+		$failed++;
+	}
+
+	if (index("foobar", "", 400) != 6) {
+		printf("perl => index(\"foobar\", \"\", 400) = %d\n",
+		    index("foobar", "", 400));
+		printf("   D => index(\"foobar\", \"\", 400) = 6\n");
+		$failed++;
+	}
+
+	if (rindex("foobar", "", 400) != 6) {
+		printf("perl => rindex(\"foobar\", \"\", 400) = %d\n",
+		    rindex("foobar", "", 400));
+		printf("   D => rindex(\"foobar\", \"\", 400) = 6\n");
+		$failed++;
+	}
+
+	if (index("", "", -400) != 0) {
+		printf("perl => index(\"\", \"\", -400) = %d\n",
+		    index("", "", -400));
+		printf("   D => index(\"\", \"\", -400) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("", "", -400) != 0) {
+		printf("perl => rindex(\"\", \"\", -400) = %d\n",
+		    rindex("", "", -400));
+		printf("   D => rindex(\"\", \"\", -400) = 0\n");
+		$failed++;
+	}
+
+	if (index("", "", -1) != 0) {
+		printf("perl => index(\"\", \"\", -1) = %d\n",
+		    index("", "", -1));
+		printf("   D => index(\"\", \"\", -1) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("", "", -1) != 0) {
+		printf("perl => rindex(\"\", \"\", -1) = %d\n",
+		    rindex("", "", -1));
+		printf("   D => rindex(\"\", \"\", -1) = 0\n");
+		$failed++;
+	}
+
+	if (index("", "", 0) != 0) {
+		printf("perl => index(\"\", \"\", 0) = %d\n",
+		    index("", "", 0));
+		printf("   D => index(\"\", \"\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("", "", 0) != 0) {
+		printf("perl => rindex(\"\", \"\", 0) = %d\n",
+		    rindex("", "", 0));
+		printf("   D => rindex(\"\", \"\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (index("", "", 0) != 0) {
+		printf("perl => index(\"\", \"\", 0) = %d\n",
+		    index("", "", 0));
+		printf("   D => index(\"\", \"\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("", "", 0) != 0) {
+		printf("perl => rindex(\"\", \"\", 0) = %d\n",
+		    rindex("", "", 0));
+		printf("   D => rindex(\"\", \"\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (index("", "", 0) != 0) {
+		printf("perl => index(\"\", \"\", 0) = %d\n",
+		    index("", "", 0));
+		printf("   D => index(\"\", \"\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("", "", 0) != 0) {
+		printf("perl => rindex(\"\", \"\", 0) = %d\n",
+		    rindex("", "", 0));
+		printf("   D => rindex(\"\", \"\", 0) = 0\n");
+		$failed++;
+	}
+
+	if (index("", "", 1) != 0) {
+		printf("perl => index(\"\", \"\", 1) = %d\n",
+		    index("", "", 1));
+		printf("   D => index(\"\", \"\", 1) = 0\n");
+		$failed++;
+	}
+
+	if (rindex("", "", 1) != 0) {
+		printf("perl => rindex(\"\", \"\", 1) = %d\n",
+		    rindex("", "", 1));
+		printf("   D => rindex(\"\", \"\", 1) = 0\n");
+		$failed++;
+	}
+
+	exit($failed);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d
new file mode 100644
index 0000000..cf7459d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+ipaddr_t *ip4a;
+ipaddr_t *ip4b;
+ipaddr_t *ip4c;
+ipaddr_t *ip4d;
+
+BEGIN
+{
+	this->buf4a = alloca(sizeof (ipaddr_t));
+	this->buf4b = alloca(sizeof (ipaddr_t));
+	this->buf4c = alloca(sizeof (ipaddr_t));
+	this->buf4d = alloca(sizeof (ipaddr_t));
+	ip4a = this->buf4a;
+	ip4b = this->buf4b;
+	ip4c = this->buf4c;
+	ip4d = this->buf4d;
+
+	*ip4a = htonl(0xc0a80117);
+	*ip4b = htonl(0x7f000001);
+	*ip4c = htonl(0xffffffff);
+	*ip4d = htonl(0x00000000);
+
+	printf("%s\n", inet_ntoa(ip4a));
+	printf("%s\n", inet_ntoa(ip4b));
+	printf("%s\n", inet_ntoa(ip4c));
+	printf("%s\n", inet_ntoa(ip4d));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d.out
new file mode 100644
index 0000000..ab535e7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa.d.out
@@ -0,0 +1,5 @@
+192.168.1.23
+127.0.0.1
+255.255.255.255
+0.0.0.0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d
new file mode 100644
index 0000000..9a00eb7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d
@@ -0,0 +1,95 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+struct in6_addr *ip6a;
+struct in6_addr *ip6b;
+struct in6_addr *ip6c;
+struct in6_addr *ip6d;
+struct in6_addr *ip6e;
+struct in6_addr *ip6f;
+struct in6_addr *ip6g;
+
+BEGIN
+{
+	this->buf6a = alloca(sizeof (struct in6_addr));
+	this->buf6b = alloca(sizeof (struct in6_addr));
+	this->buf6c = alloca(sizeof (struct in6_addr));
+	this->buf6d = alloca(sizeof (struct in6_addr));
+	this->buf6e = alloca(sizeof (struct in6_addr));
+	this->buf6f = alloca(sizeof (struct in6_addr));
+	this->buf6g = alloca(sizeof (struct in6_addr));
+	ip6a = this->buf6a;
+	ip6b = this->buf6b;
+	ip6c = this->buf6c;
+	ip6d = this->buf6d;
+	ip6e = this->buf6e;
+	ip6f = this->buf6f;
+	ip6g = this->buf6g;
+
+	ip6a->_S6_un._S6_u8[0] = 0xfe;
+	ip6a->_S6_un._S6_u8[1] = 0x80;
+	ip6a->_S6_un._S6_u8[8] = 0x02;
+	ip6a->_S6_un._S6_u8[9] = 0x14;
+	ip6a->_S6_un._S6_u8[10] = 0x4f;
+	ip6a->_S6_un._S6_u8[11] = 0xff;
+	ip6a->_S6_un._S6_u8[12] = 0xfe;
+	ip6a->_S6_un._S6_u8[13] = 0x0b;
+	ip6a->_S6_un._S6_u8[14] = 0x76;
+	ip6a->_S6_un._S6_u8[15] = 0xc8;
+	ip6b->_S6_un._S6_u8[0] = 0x10;
+	ip6b->_S6_un._S6_u8[1] = 0x80;
+	ip6b->_S6_un._S6_u8[10] = 0x08;
+	ip6b->_S6_un._S6_u8[11] = 0x08;
+	ip6b->_S6_un._S6_u8[13] = 0x20;
+	ip6b->_S6_un._S6_u8[13] = 0x0c;
+	ip6b->_S6_un._S6_u8[14] = 0x41;
+	ip6b->_S6_un._S6_u8[15] = 0x7a;
+	ip6c->_S6_un._S6_u8[15] = 0x01;
+	ip6e->_S6_un._S6_u8[12] = 0x7f;
+	ip6e->_S6_un._S6_u8[15] = 0x01;
+	ip6f->_S6_un._S6_u8[10] = 0xff;
+	ip6f->_S6_un._S6_u8[11] = 0xff;
+	ip6f->_S6_un._S6_u8[12] = 0x7f;
+	ip6f->_S6_un._S6_u8[15] = 0x01;
+	ip6g->_S6_un._S6_u8[10] = 0xff;
+	ip6g->_S6_un._S6_u8[11] = 0xfe;
+	ip6g->_S6_un._S6_u8[12] = 0x7f;
+	ip6g->_S6_un._S6_u8[15] = 0x01;
+
+	printf("%s\n", inet_ntoa6(ip6a));
+	printf("%s\n", inet_ntoa6(ip6b));
+	printf("%s\n", inet_ntoa6(ip6c));
+	printf("%s\n", inet_ntoa6(ip6d));
+	printf("%s\n", inet_ntoa6(ip6e));
+	printf("%s\n", inet_ntoa6(ip6f));
+	printf("%s\n", inet_ntoa6(ip6g));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d.out
new file mode 100644
index 0000000..d87c1f6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntoa6.d.out
@@ -0,0 +1,8 @@
+fe80::214:4fff:fe0b:76c8
+1080::808:c:417a
+::1
+::
+127.0.0.1
+127.0.0.1
+::fffe:7f00:1
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d
new file mode 100644
index 0000000..c1e4b1b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d
@@ -0,0 +1,135 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+ipaddr_t *ip4a;
+ipaddr_t *ip4b;
+ipaddr_t *ip4c;
+ipaddr_t *ip4d;
+struct in6_addr *ip6a;
+struct in6_addr *ip6b;
+struct in6_addr *ip6c;
+struct in6_addr *ip6d;
+struct in6_addr *ip6e;
+struct in6_addr *ip6f;
+struct in6_addr *ip6g;
+struct in6_addr *ip6h;
+
+BEGIN
+{
+	this->buf4a = alloca(sizeof (ipaddr_t));
+	this->buf4b = alloca(sizeof (ipaddr_t));
+	this->buf4c = alloca(sizeof (ipaddr_t));
+	this->buf4d = alloca(sizeof (ipaddr_t));
+	this->buf6a = alloca(sizeof (struct in6_addr));
+	this->buf6b = alloca(sizeof (struct in6_addr));
+	this->buf6c = alloca(sizeof (struct in6_addr));
+	this->buf6d = alloca(sizeof (struct in6_addr));
+	this->buf6e = alloca(sizeof (struct in6_addr));
+	this->buf6f = alloca(sizeof (struct in6_addr));
+	this->buf6g = alloca(sizeof (struct in6_addr));
+	this->buf6h = alloca(sizeof (struct in6_addr));
+	ip4a = this->buf4a;
+	ip4b = this->buf4b;
+	ip4c = this->buf4c;
+	ip4d = this->buf4d;
+	ip6a = this->buf6a;
+	ip6b = this->buf6b;
+	ip6c = this->buf6c;
+	ip6d = this->buf6d;
+	ip6e = this->buf6e;
+	ip6f = this->buf6f;
+	ip6g = this->buf6g;
+	ip6h = this->buf6h;
+
+	*ip4a = htonl(0xc0a80117);
+	*ip4b = htonl(0x7f000001);
+	*ip4c = htonl(0xffffffff);
+	*ip4d = htonl(0x00000000);
+	ip6a->_S6_un._S6_u8[0] = 0xfe;
+	ip6a->_S6_un._S6_u8[1] = 0x80;
+	ip6a->_S6_un._S6_u8[8] = 0x02;
+	ip6a->_S6_un._S6_u8[9] = 0x14;
+	ip6a->_S6_un._S6_u8[10] = 0x4f;
+	ip6a->_S6_un._S6_u8[11] = 0xff;
+	ip6a->_S6_un._S6_u8[12] = 0xfe;
+	ip6a->_S6_un._S6_u8[13] = 0x0b;
+	ip6a->_S6_un._S6_u8[14] = 0x76;
+	ip6a->_S6_un._S6_u8[15] = 0xc8;
+	ip6b->_S6_un._S6_u8[0] = 0x10;
+	ip6b->_S6_un._S6_u8[1] = 0x80;
+	ip6b->_S6_un._S6_u8[10] = 0x08;
+	ip6b->_S6_un._S6_u8[11] = 0x08;
+	ip6b->_S6_un._S6_u8[13] = 0x20;
+	ip6b->_S6_un._S6_u8[13] = 0x0c;
+	ip6b->_S6_un._S6_u8[14] = 0x41;
+	ip6b->_S6_un._S6_u8[15] = 0x7a;
+	ip6c->_S6_un._S6_u8[15] = 0x01;
+	ip6e->_S6_un._S6_u8[12] = 0x7f;
+	ip6e->_S6_un._S6_u8[15] = 0x01;
+	ip6f->_S6_un._S6_u8[10] = 0xff;
+	ip6f->_S6_un._S6_u8[11] = 0xff;
+	ip6f->_S6_un._S6_u8[12] = 0x7f;
+	ip6f->_S6_un._S6_u8[15] = 0x01;
+	ip6g->_S6_un._S6_u8[10] = 0xff;
+	ip6g->_S6_un._S6_u8[11] = 0xfe;
+	ip6g->_S6_un._S6_u8[12] = 0x7f;
+	ip6g->_S6_un._S6_u8[15] = 0x01;
+	ip6h->_S6_un._S6_u8[0] = 0xff;
+	ip6h->_S6_un._S6_u8[1] = 0xff;
+	ip6h->_S6_un._S6_u8[2] = 0xff;
+	ip6h->_S6_un._S6_u8[3] = 0xff;
+	ip6h->_S6_un._S6_u8[4] = 0xff;
+	ip6h->_S6_un._S6_u8[5] = 0xff;
+	ip6h->_S6_un._S6_u8[6] = 0xff;
+	ip6h->_S6_un._S6_u8[7] = 0xff;
+	ip6h->_S6_un._S6_u8[8] = 0xff;
+	ip6h->_S6_un._S6_u8[9] = 0xff;
+	ip6h->_S6_un._S6_u8[10] = 0xff;
+	ip6h->_S6_un._S6_u8[11] = 0xff;
+	ip6h->_S6_un._S6_u8[12] = 0xff;
+	ip6h->_S6_un._S6_u8[13] = 0xff;
+	ip6h->_S6_un._S6_u8[14] = 0xff;
+	ip6h->_S6_un._S6_u8[15] = 0xff;
+
+	printf("%s\n", inet_ntop(AF_INET, ip4a));
+	printf("%s\n", inet_ntop(AF_INET, ip4b));
+	printf("%s\n", inet_ntop(AF_INET, ip4c));
+	printf("%s\n", inet_ntop(AF_INET, ip4d));
+	printf("%s\n", inet_ntop(AF_INET6, ip6a));
+	printf("%s\n", inet_ntop(AF_INET6, ip6b));
+	printf("%s\n", inet_ntop(AF_INET6, ip6c));
+	printf("%s\n", inet_ntop(AF_INET6, ip6d));
+	printf("%s\n", inet_ntop(AF_INET6, ip6e));
+	printf("%s\n", inet_ntop(AF_INET6, ip6f));
+	printf("%s\n", inet_ntop(AF_INET6, ip6g));
+	printf("%s\n", inet_ntop(AF_INET6, ip6h));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d.out
new file mode 100644
index 0000000..7c8311c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.inet_ntop.d.out
@@ -0,0 +1,13 @@
+192.168.1.23
+127.0.0.1
+255.255.255.255
+0.0.0.0
+fe80::214:4fff:fe0b:76c8
+1080::808:c:417a
+::1
+::
+::127.0.0.1
+::ffff:127.0.0.1
+::fffe:7f00:1
+ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.lltostr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.lltostr.d
new file mode 100644
index 0000000..03e295a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.lltostr.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("%s\n", lltostr(0));
+	printf("%s\n", lltostr(1));
+	printf("%s\n", lltostr(-1));
+	printf("%s\n", lltostr(123456789));
+	printf("%s\n", lltostr(-123456789));
+	printf("%s\n", lltostr(1LL << 62));
+	printf("%s\n", lltostr(-(1LL << 62)));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.lltostr.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.lltostr.d.out
new file mode 100644
index 0000000..e007c64
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.lltostr.d.out
@@ -0,0 +1,8 @@
+0
+1
+-1
+123456789
+-123456789
+4611686018427387904
+-4611686018427387904
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_owned.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_owned.d
new file mode 100644
index 0000000..b4aa84f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_owned.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  	mutex_owned() should return a non-zero value if the calling
+ *	thread currently holds the mutex.
+ *
+ * SECTION: Actions and Subroutines/mutex_owned()
+ */
+
+#pragma D option quiet
+
+lockstat:::adaptive-acquire
+{
+	this->owned = mutex_owned((kmutex_t *)arg0);
+	this->owner = mutex_owner((kmutex_t *)arg0);
+}
+
+lockstat:::adaptive-acquire
+/!this->owned/
+{
+	printf("mutex_owned() returned 0, expected non-zero\n");
+	exit(1);
+}
+
+lockstat:::adaptive-acquire
+/this->owner != curthread/
+{
+	printf("current thread is not current owner of owned lock\n");
+	exit(1);
+}
+
+lockstat:::adaptive-acquire
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_owner.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_owner.d
new file mode 100644
index 0000000..a021d50
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_owner.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  	mutex_owner() should return a pointer to the kernel thread holding
+ *	the mutex.
+ *
+ * SECTION: Actions and Subroutines/mutex_owner()
+ *
+ * NOTES: This assertion can't be verified so we'll just call it.
+ */
+
+
+
+
+#pragma D option quiet
+
+kthread_t *ptr;
+
+BEGIN
+{
+	i = 0;
+}
+
+lockstat:genunix:mutex_enter:adaptive-acquire
+{
+
+	ptr = mutex_owner((kmutex_t *)arg0);
+	i++;
+}
+
+tick-1
+/i > 5/
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_type_adaptive.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_type_adaptive.d
new file mode 100644
index 0000000..c13abab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.mutex_type_adaptive.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  	mutex_type_adaptive() should return a non-zero value if the
+ *	mutex is an adaptive one.
+ *
+ * SECTION: Actions and Subroutines/mutex_type_adaptive()
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+	ret = -99;
+}
+
+mutex_enter:adaptive-acquire
+{
+	ret = mutex_type_adaptive((kmutex_t *)arg0);
+	i++;
+}
+
+tick-1
+/ret == 1/
+{
+	exit(0);
+}
+
+tick-1
+/i == 100 && ret == 0/
+{
+	printf("mutex_type_adaptive returned 0, expected non-zero\n");
+	exit(1);
+}
+
+tick-1
+/i == 100 && ret == -99/
+{
+	printf("No adaptive_mutexs called in the time this test was run.\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.progenyof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.progenyof.d
new file mode 100644
index 0000000..0291158
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.progenyof.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	progenyof() should return non-zero if the pid passed is in the
+ #	progeny of the calling process.
+ *
+ * SECTION: Actions and Subroutines/progenyof()
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	res_1 = -1;
+	res_2 = -1;
+	res_3 = -1;
+
+	res_1 = progenyof($ppid);	/* this will always be true */
+	res_2  = progenyof($ppid + 1);  /* this will always be false */
+	res_3 = progenyof(1);		/* this will always be true */
+}
+
+
+tick-1
+/res_1 > 0 && res_2 == 0 && res_3 > 0/
+{
+	exit(0);
+}
+
+tick-1
+/res_1 <= 0 || res_2 != 0 || res_3 <= 0/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.rand.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.rand.d
new file mode 100644
index 0000000..51f4491
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.rand.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:  Test rand()
+ *
+ * SECTION: Actions and Subroutines/rand()
+ */
+
+
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-1
+/i != 10/
+{
+	i++;
+	trace(rand());
+}
+
+tick-1
+/i == 10/
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strchr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strchr.d
new file mode 100644
index 0000000..8dc8f89
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strchr.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	str = "fooeyfooeyfoo";
+	this->success = 0;
+
+	c = 'f';
+	printf("strchr(\"%s\", '%c') = \"%s\"\n", str, c, strchr(str, c));
+	printf("strrchr(\"%s\", '%c') = \"%s\"\n", str, c, strrchr(str, c));
+
+	c = 'y';
+	printf("strchr(\"%s\", '%c') = \"%s\"\n", str, c, strchr(str, c));
+	printf("strrchr(\"%s\", '%c') = \"%s\"\n", str, c, strrchr(str, c));
+
+	printf("strrchr(\"%s\", '%c') = \"%s\"\n", strchr(str, c), c,
+	    strrchr(strchr(str, c), c));
+
+	this->success = 1;
+}
+
+BEGIN
+/!this->success/
+{
+	exit(1);
+}
+
+BEGIN
+/strchr(str, 'a') != NULL/
+{
+	exit(2);
+}
+
+BEGIN
+/strrchr(str, 'a') != NULL/
+{
+	exit(3);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strchr.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strchr.d.out
new file mode 100644
index 0000000..328b531
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strchr.d.out
@@ -0,0 +1,6 @@
+strchr("fooeyfooeyfoo", 'f') = "fooeyfooeyfoo"
+strrchr("fooeyfooeyfoo", 'f') = "foo"
+strchr("fooeyfooeyfoo", 'y') = "yfooeyfoo"
+strrchr("fooeyfooeyfoo", 'y') = "yfoo"
+strrchr("yfooeyfoo", 'y') = "yfoo"
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
new file mode 100644
index 0000000..392c18a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("%s\n", strjoin("foo", "baz"));
+	printf("%s\n", strjoin("foo", ""));
+	printf("%s\n", strjoin("", "baz"));
+	printf("%s\n", strjoin("", ""));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d.out
new file mode 100644
index 0000000..6572869
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d.out
@@ -0,0 +1,5 @@
+foobaz
+foo
+baz
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strstr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strstr.d
new file mode 100644
index 0000000..0c81b7a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strstr.d
@@ -0,0 +1,89 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	str = "foobarbarbazbarbop";
+	this->success = 0;
+
+	c = str;
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
+
+	c = "baz";
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
+
+	c = "bar";
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
+
+	c = "bazbarbop";
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
+
+	c = "barba";
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
+
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n",
+	    strstr(str, "baz"), strstr(str, "zba"),
+	    strstr(strstr(str, "baz"), strstr(str, "zba")));
+
+	c = "";
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
+
+	str = "";
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
+
+	str = "f";
+	c = "f";
+	printf("strstr(\"%s\", \"%s\") = \"%s\"\n", str, c, strstr(str, c));
+
+	this->success = 1;
+}
+
+BEGIN
+/!this->success/
+{
+	exit(1);
+}
+
+BEGIN
+/strstr(str, "barbarf") != NULL/
+{
+	exit(2);
+}
+
+BEGIN
+/strstr(str, "foobarbarbazbarbopp") != NULL/
+{
+	exit(3);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strstr.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strstr.d.out
new file mode 100644
index 0000000..f9121db
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strstr.d.out
@@ -0,0 +1,10 @@
+strstr("foobarbarbazbarbop", "foobarbarbazbarbop") = "foobarbarbazbarbop"
+strstr("foobarbarbazbarbop", "baz") = "bazbarbop"
+strstr("foobarbarbazbarbop", "bar") = "barbarbazbarbop"
+strstr("foobarbarbazbarbop", "bazbarbop") = "bazbarbop"
+strstr("foobarbarbazbarbop", "barba") = "barbarbazbarbop"
+strstr("bazbarbop", "zbarbop") = "zbarbop"
+strstr("foobarbarbazbarbop", "") = "foobarbarbazbarbop"
+strstr("", "") = ""
+strstr("f", "f") = "f"
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok.d
new file mode 100644
index 0000000..47092ba
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok.d
@@ -0,0 +1,146 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	this->str = ",,,Carrots,,Barley,Oatmeal,,,Beans,";
+}
+
+BEGIN
+/(this->field = strtok(this->str, ",")) == NULL/
+{
+	exit(1);
+}
+
+BEGIN
+{
+	printf("%s\n", this->field);
+}
+
+BEGIN
+/(this->field = strtok(NULL, ",")) == NULL/
+{
+	exit(2);
+}
+
+BEGIN
+{
+	printf("%s\n", this->field);
+}
+
+BEGIN
+/(this->field = strtok(NULL, ",")) == NULL/
+{
+	exit(3);
+}
+
+BEGIN
+{
+	printf("%s\n", this->field);
+}
+
+BEGIN
+/(this->field = strtok(NULL, ",")) == NULL/
+{
+	exit(4);
+}
+
+BEGIN
+{
+	printf("%s\n", this->field);
+}
+
+BEGIN
+/(self->a = strtok(NULL, ",")) != NULL/
+{
+	printf("unexpected field: %s\n", this->field);
+	exit(5);
+}
+
+struct {
+	string s1;
+	string s2;
+	string result;
+} command[int];
+
+int i;
+
+BEGIN
+{
+	command[i].s1 = "";
+	command[i].s2 = "";
+	command[i].result = "";
+	i++;
+
+	command[i].s1 = "foo";
+	command[i].s2 = "";
+	command[i].result = command[i].s1;
+	i++;
+
+	command[i].s1 = "foobar";
+	command[i].s2 = "o";
+	command[i].result = "f";
+	i++;
+
+	command[i].s1 = "oobar";
+	command[i].s2 = "o";
+	command[i].result = "bar";
+	i++;
+
+	command[i].s1 = "foo";
+	command[i].s2 = "bar";
+	command[i].result = command[i].s1;
+	i++;
+
+	command[i].s1 = "";
+	command[i].s2 = "foo";
+	command[i].result = "";
+	i++;
+
+	end = i;
+	i = 0;
+}
+
+tick-1ms
+/i < end &&
+    (this->result = strtok(command[i].s1, command[i].s2)) != command[i].result/
+{
+	printf("strtok(\"%s\", \"%s\") = \"%s\", expected \"%s\"",
+	    command[i].s1, command[i].s2,
+	    this->result != NULL ? this->result : "<null>",
+	    command[i].result != NULL ? command[i].result : "<null>");
+	exit(6 + i);
+}
+
+tick-1ms
+/++i == end/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok.d.out
new file mode 100644
index 0000000..4bc3727
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok.d.out
@@ -0,0 +1,5 @@
+Carrots
+Barley
+Oatmeal
+Beans
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok_null.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok_null.d
new file mode 100644
index 0000000..6de4f97
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.strtok_null.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Test that a strtok(NULL, ...) without first calling strtok(string, ...)
+ * produces an error
+ */
+
+BEGIN
+{
+	trace(strtok(NULL, "!"));
+	exit(1);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substr.d
new file mode 100644
index 0000000..edee644
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substr.d
@@ -0,0 +1,231 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+#pragma D option strsize=32
+
+struct {
+	int index;
+	int length;
+	int nolen;
+	int alt;
+} command[int];
+
+int i;
+
+BEGIN
+{
+	str = "foobarbazbop";
+	str2 = "";
+	altstr = "CRAIG: Positioned them, I don't ";
+	altstr2 = "know... I'm fairly wide guy.";
+
+	command[i].index = 3;
+	command[i].nolen = 1;
+	i++;
+
+	command[i].index = 300;
+	command[i].nolen = 1;
+	i++;
+
+	command[i].index = -10;
+	command[i].nolen = 1;
+	i++;
+
+	command[i].index = 0;
+	command[i].nolen = 1;
+	i++;
+
+	command[i].index = 1;
+	command[i].nolen = 1;
+	i++;
+
+	command[i].index = strlen(str) - 1;
+	command[i].nolen = 1;
+	i++;
+
+	command[i].index = strlen(str);
+	command[i].nolen = 1;
+	i++;
+
+	command[i].index = strlen(str) + 1;
+	command[i].nolen = 1;
+	i++;
+
+	command[i].index = 8;
+	command[i].length = 20;
+	i++;
+
+	command[i].index = 4;
+	command[i].length = 4;
+	i++;
+
+	command[i].index = 5;
+	command[i].length = strlen(str) - command[i].index + 1;
+	i++;
+
+	command[i].index = 5;
+	command[i].length = strlen(str) - command[i].index + 2;
+	i++;
+
+	command[i].index = 400;
+	command[i].length = 20;
+	i++;
+
+	command[i].index = 400;
+	command[i].length = 0;
+	i++;
+
+	command[i].index = 400;
+	command[i].length = -1;
+	i++;
+
+	command[i].index = 3;
+	command[i].length = 0;
+	i++;
+
+	command[i].index = 3;
+	command[i].length = -1;
+	i++;
+
+	command[i].index = 3;
+	command[i].length = -4;
+	i++;
+
+	command[i].index = 3;
+	command[i].length = -20;
+	i++;
+
+	command[i].index = -10;
+	command[i].length = -5;
+	i++;
+
+	command[i].index = 0;
+	command[i].length = 400;
+	i++;
+
+	command[i].index = -1;
+	command[i].length = 400;
+	i++;
+
+	command[i].index = -1;
+	command[i].length = 0;
+	i++;
+
+	command[i].index = -1;
+	command[i].length = -1;
+	i++;
+
+	command[i].index = -2 * strlen(str);
+	command[i].length = 2 * strlen(str);
+	i++;
+
+	command[i].index = -2 * strlen(str);
+	command[i].length = strlen(str);
+	i++;
+
+	command[i].index = -2 * strlen(str);
+	command[i].length = strlen(str) + 1;
+	i++;
+
+	command[i].index = -1 * strlen(str);
+	command[i].length = strlen(str);
+	i++;
+
+	command[i].index = -1 * strlen(str);
+	command[i].length = strlen(str) - 1;
+	i++;
+
+	command[i].index = 100;
+	command[i].length = 10;
+	command[i].alt = 1;
+	i++;
+
+	command[i].index = 100;
+	command[i].nolen = 1;
+	command[i].alt = 1;
+	i++;
+
+	end = i;
+	i = 0;
+	printf("#!/usr/perl5/bin/perl\n\nBEGIN {\n");
+
+}
+
+tick-1ms
+/i < end && command[i].nolen/
+{
+	this->str = command[i].alt ? altstr : str;
+	this->str2 = command[i].alt ? altstr2 : str2;
+	this->result = substr(command[i].alt ?
+	    "CRAIG: Positioned them, I don't know... I'm fairly wide guy." :
+	    str, command[i].index);
+
+	printf("\tif (substr(\"%s%s\", %d) ne \"%s\") {\n",
+	    this->str, this->str2, command[i].index, this->result);
+
+	printf("\t\tprintf(\"perl => substr(\\\"%s%s\\\", %d) = ",
+	    this->str, this->str2, command[i].index);
+	printf("\\\"%%s\\\"\\n\",\n\t\t    substr(\"%s%s\", %d));\n",
+	    this->str, this->str2, command[i].index);
+	printf("\t\tprintf(\"   D => substr(\\\"%s%s\\\", %d) = ",
+	    this->str, this->str2, command[i].index);
+	printf("\\\"%%s\\\"\\n\",\n\t\t    \"%s\");\n", this->result);
+	printf("\t\t$failed++;\n");
+	printf("\t}\n\n");
+}
+
+tick-1ms
+/i < end && !command[i].nolen/
+{
+	this->str = command[i].alt ? altstr : str;
+	this->str2 = command[i].alt ? altstr2 : str2;
+	this->result = substr(command[i].alt ?
+	    "CRAIG: Positioned them, I don't know... I'm fairly wide guy." :
+	    str, command[i].index, command[i].length);
+
+	printf("\tif (substr(\"%s%s\", %d, %d) ne \"%s\") {\n",
+	    this->str, this->str2, command[i].index, command[i].length,
+	    this->result);
+	printf("\t\tprintf(\"perl => substr(\\\"%s%s\\\", %d, %d) = ",
+	    this->str, this->str2, command[i].index, command[i].length);
+	printf("\\\"%%s\\\"\\n\",\n\t\t    substr(\"%s%s\", %d, %d));\n",
+	    this->str, this->str2, command[i].index, command[i].length);
+	printf("\t\tprintf(\"   D => substr(\\\"%s%s\\\", %d, %d) = ",
+	    this->str, this->str2, command[i].index, command[i].length);
+	printf("\\\"%%s\\\"\\n\",\n\t\t    \"%s\");\n", this->result);
+	printf("\t\t$failed++;\n");
+	printf("\t}\n\n");
+}
+
+tick-1ms
+/++i == end/
+{
+	printf("\texit($failed);\n}\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out
new file mode 100755
index 0000000..5b498ef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substr.d.out
@@ -0,0 +1,254 @@
+#!/usr/perl5/bin/perl
+
+BEGIN {
+	if (substr("foobarbazbop", 3) ne "barbazbop") {
+		printf("perl => substr(\"foobarbazbop\", 3) = \"%s\"\n",
+		    substr("foobarbazbop", 3));
+		printf("   D => substr(\"foobarbazbop\", 3) = \"%s\"\n",
+		    "barbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 300) ne "") {
+		printf("perl => substr(\"foobarbazbop\", 300) = \"%s\"\n",
+		    substr("foobarbazbop", 300));
+		printf("   D => substr(\"foobarbazbop\", 300) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -10) ne "obarbazbop") {
+		printf("perl => substr(\"foobarbazbop\", -10) = \"%s\"\n",
+		    substr("foobarbazbop", -10));
+		printf("   D => substr(\"foobarbazbop\", -10) = \"%s\"\n",
+		    "obarbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 0) ne "foobarbazbop") {
+		printf("perl => substr(\"foobarbazbop\", 0) = \"%s\"\n",
+		    substr("foobarbazbop", 0));
+		printf("   D => substr(\"foobarbazbop\", 0) = \"%s\"\n",
+		    "foobarbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 1) ne "oobarbazbop") {
+		printf("perl => substr(\"foobarbazbop\", 1) = \"%s\"\n",
+		    substr("foobarbazbop", 1));
+		printf("   D => substr(\"foobarbazbop\", 1) = \"%s\"\n",
+		    "oobarbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 11) ne "p") {
+		printf("perl => substr(\"foobarbazbop\", 11) = \"%s\"\n",
+		    substr("foobarbazbop", 11));
+		printf("   D => substr(\"foobarbazbop\", 11) = \"%s\"\n",
+		    "p");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 12) ne "") {
+		printf("perl => substr(\"foobarbazbop\", 12) = \"%s\"\n",
+		    substr("foobarbazbop", 12));
+		printf("   D => substr(\"foobarbazbop\", 12) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 13) ne "") {
+		printf("perl => substr(\"foobarbazbop\", 13) = \"%s\"\n",
+		    substr("foobarbazbop", 13));
+		printf("   D => substr(\"foobarbazbop\", 13) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 8, 20) ne "zbop") {
+		printf("perl => substr(\"foobarbazbop\", 8, 20) = \"%s\"\n",
+		    substr("foobarbazbop", 8, 20));
+		printf("   D => substr(\"foobarbazbop\", 8, 20) = \"%s\"\n",
+		    "zbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 4, 4) ne "arba") {
+		printf("perl => substr(\"foobarbazbop\", 4, 4) = \"%s\"\n",
+		    substr("foobarbazbop", 4, 4));
+		printf("   D => substr(\"foobarbazbop\", 4, 4) = \"%s\"\n",
+		    "arba");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 5, 8) ne "rbazbop") {
+		printf("perl => substr(\"foobarbazbop\", 5, 8) = \"%s\"\n",
+		    substr("foobarbazbop", 5, 8));
+		printf("   D => substr(\"foobarbazbop\", 5, 8) = \"%s\"\n",
+		    "rbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 5, 9) ne "rbazbop") {
+		printf("perl => substr(\"foobarbazbop\", 5, 9) = \"%s\"\n",
+		    substr("foobarbazbop", 5, 9));
+		printf("   D => substr(\"foobarbazbop\", 5, 9) = \"%s\"\n",
+		    "rbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 400, 20) ne "") {
+		printf("perl => substr(\"foobarbazbop\", 400, 20) = \"%s\"\n",
+		    substr("foobarbazbop", 400, 20));
+		printf("   D => substr(\"foobarbazbop\", 400, 20) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 400, 0) ne "") {
+		printf("perl => substr(\"foobarbazbop\", 400, 0) = \"%s\"\n",
+		    substr("foobarbazbop", 400, 0));
+		printf("   D => substr(\"foobarbazbop\", 400, 0) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 400, -1) ne "") {
+		printf("perl => substr(\"foobarbazbop\", 400, -1) = \"%s\"\n",
+		    substr("foobarbazbop", 400, -1));
+		printf("   D => substr(\"foobarbazbop\", 400, -1) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 3, 0) ne "") {
+		printf("perl => substr(\"foobarbazbop\", 3, 0) = \"%s\"\n",
+		    substr("foobarbazbop", 3, 0));
+		printf("   D => substr(\"foobarbazbop\", 3, 0) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 3, -1) ne "barbazbo") {
+		printf("perl => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n",
+		    substr("foobarbazbop", 3, -1));
+		printf("   D => substr(\"foobarbazbop\", 3, -1) = \"%s\"\n",
+		    "barbazbo");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 3, -4) ne "barba") {
+		printf("perl => substr(\"foobarbazbop\", 3, -4) = \"%s\"\n",
+		    substr("foobarbazbop", 3, -4));
+		printf("   D => substr(\"foobarbazbop\", 3, -4) = \"%s\"\n",
+		    "barba");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 3, -20) ne "") {
+		printf("perl => substr(\"foobarbazbop\", 3, -20) = \"%s\"\n",
+		    substr("foobarbazbop", 3, -20));
+		printf("   D => substr(\"foobarbazbop\", 3, -20) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -10, -5) ne "obarb") {
+		printf("perl => substr(\"foobarbazbop\", -10, -5) = \"%s\"\n",
+		    substr("foobarbazbop", -10, -5));
+		printf("   D => substr(\"foobarbazbop\", -10, -5) = \"%s\"\n",
+		    "obarb");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", 0, 400) ne "foobarbazbop") {
+		printf("perl => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n",
+		    substr("foobarbazbop", 0, 400));
+		printf("   D => substr(\"foobarbazbop\", 0, 400) = \"%s\"\n",
+		    "foobarbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -1, 400) ne "p") {
+		printf("perl => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n",
+		    substr("foobarbazbop", -1, 400));
+		printf("   D => substr(\"foobarbazbop\", -1, 400) = \"%s\"\n",
+		    "p");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -1, 0) ne "") {
+		printf("perl => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n",
+		    substr("foobarbazbop", -1, 0));
+		printf("   D => substr(\"foobarbazbop\", -1, 0) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -1, -1) ne "") {
+		printf("perl => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n",
+		    substr("foobarbazbop", -1, -1));
+		printf("   D => substr(\"foobarbazbop\", -1, -1) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -24, 24) ne "foobarbazbop") {
+		printf("perl => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n",
+		    substr("foobarbazbop", -24, 24));
+		printf("   D => substr(\"foobarbazbop\", -24, 24) = \"%s\"\n",
+		    "foobarbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -24, 12) ne "") {
+		printf("perl => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n",
+		    substr("foobarbazbop", -24, 12));
+		printf("   D => substr(\"foobarbazbop\", -24, 12) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -24, 13) ne "f") {
+		printf("perl => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n",
+		    substr("foobarbazbop", -24, 13));
+		printf("   D => substr(\"foobarbazbop\", -24, 13) = \"%s\"\n",
+		    "f");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -12, 12) ne "foobarbazbop") {
+		printf("perl => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n",
+		    substr("foobarbazbop", -12, 12));
+		printf("   D => substr(\"foobarbazbop\", -12, 12) = \"%s\"\n",
+		    "foobarbazbop");
+		$failed++;
+	}
+
+	if (substr("foobarbazbop", -12, 11) ne "foobarbazbo") {
+		printf("perl => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n",
+		    substr("foobarbazbop", -12, 11));
+		printf("   D => substr(\"foobarbazbop\", -12, 11) = \"%s\"\n",
+		    "foobarbazbo");
+		$failed++;
+	}
+
+	if (substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100, 10) ne "") {
+		printf("perl => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100, 10) = \"%s\"\n",
+		    substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100, 10));
+		printf("   D => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100, 10) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	if (substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100) ne "") {
+		printf("perl => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100) = \"%s\"\n",
+		    substr("CRAIG: Positioned them, I don't know... I'm fairly wide guy.", 100));
+		printf("   D => substr(\"CRAIG: Positioned them, I don't know... I'm fairly wide guy.\", 100) = \"%s\"\n",
+		    "");
+		$failed++;
+	}
+
+	exit($failed);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substrminate.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substrminate.d
new file mode 100644
index 0000000..2c02541
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substrminate.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+#pragma D option aggsortkey
+
+/*
+ * This is to check that we're correctly null-terminating the result of the
+ * substr() subroutine.
+ */
+
+tick-1ms
+/i++ > 1000/
+{
+	exit(0);
+}
+
+tick-1ms
+{
+	@[substr((i & 1) ? "Bryan is smart" : "he's not a dummy", 0,
+	    (i & 1) ? 8 : 18)] = count();
+}
+
+END
+{
+	printa("%s\n", @);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substrminate.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substrminate.d.out
new file mode 100644
index 0000000..26c19aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.substrminate.d.out
@@ -0,0 +1,3 @@
+Bryan is
+he's not a dummy
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.system.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.system.d
new file mode 100644
index 0000000..b7ffbfa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.system.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+#pragma D option destructive
+
+BEGIN
+{
+	this->a = 9;
+	this->b = -2;
+
+	system("echo %s %d %d", "foo", this->a, this->b);
+	system("ping localhost");
+	system("echo %d", ++this->a);
+	system("ping localhost");
+	system("echo %d", ++this->a);
+	system("ping localhost");
+	system("echo %d", ++this->a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.system.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.system.d.out
new file mode 100644
index 0000000..cd0d735
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/funcs/tst.system.d.out
@@ -0,0 +1,8 @@
+foo 9 -2
+localhost is alive
+10
+localhost is alive
+11
+localhost is alive
+12
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/err.D_ADDROF_LVAL.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/err.D_ADDROF_LVAL.d
new file mode 100644
index 0000000..8f5d694
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/err.D_ADDROF_LVAL.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *	& can not be applied to a non-lvalue
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ */
+
+BEGIN
+{
+	trace(&1);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/err.D_EMPTY.empty.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/err.D_EMPTY.empty.d
new file mode 100644
index 0000000..929ccc6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/err.D_EMPTY.empty.d
@@ -0,0 +1,34 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test the "empty translation unit" error path.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/tst.clauses.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/tst.clauses.d
new file mode 100644
index 0000000..a993029
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/tst.clauses.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test the kinds of probe definition clause grammar rules.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations;
+ * 	Program Structure/Actions
+ */
+
+
+BEGIN
+{}
+
+BEGIN
+/1/
+{}
+
+tick-1
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/tst.stmts.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/tst.stmts.d
new file mode 100644
index 0000000..03a015a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/grammar/tst.stmts.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test the various kinds of D probe description statement
+ *   rules in the grammar.
+ *
+ * SECTION: Program Structure/Probe Descriptions
+ *
+ */
+
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-1
+/i != 20/
+{
+	i++;
+	x = 0;
+	stack();
+	@a = count();
+	@b = max(x);
+	@c[x] = count();
+	@d[x] = max(x);
+}
+
+tick-1
+/i = 20/
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_DECL_IDRED.redef1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_DECL_IDRED.redef1.d
new file mode 100644
index 0000000..39f2996
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_DECL_IDRED.redef1.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Test handling of an inline definition that overrides a previous
+ * definition of an inline definition.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES:
+ *
+ */
+
+inline int foo = timestamp;
+inline int foo = 8;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_DECL_IDRED.redef2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_DECL_IDRED.redef2.d
new file mode 100644
index 0000000..1df5908
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_DECL_IDRED.redef2.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Test handling of an inline definition that overrides a previous
+ * definition of a dtrace built-in function.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES:
+ *
+ */
+
+inline int rand = 7;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_IDENT_UNDEF.recur.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_IDENT_UNDEF.recur.d
new file mode 100644
index 0000000..95522d0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_IDENT_UNDEF.recur.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * D program to test recursive inline definitions.  This script should
+ * properly detect that foo is undefined on the right-hand side and fail.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES:
+ *
+ */
+
+inline int foo = foo + 3;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef1.d
new file mode 100644
index 0000000..a42afb7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef1.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Attempt to create an invalid inline definition by creating an
+ * inline of a function type.  This should fail to compile.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES:
+ *
+ */
+
+inline cyc_func_t i = "i am a cyclic function";
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef2.d
new file mode 100644
index 0000000..9a246b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.baddef2.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Attempt to create an invalid inline definition by creating an
+ * inline of incompatible types.  This should fail to compile.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES:
+ *
+ */
+
+inline int i = "i am a string";
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.badxlate.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.badxlate.d
new file mode 100644
index 0000000..963b604
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/err.D_OP_INCOMPAT.badxlate.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Test an invalid inline definition of a translator.  An inlined translation
+ * must have the same type as the translator output.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES:
+ *
+ */
+
+inline vfs_t *invalid = xlate<psinfo_t>(curthread->t_procp);
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineDataAssign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineDataAssign.d
new file mode 100644
index 0000000..c7ab62f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineDataAssign.d
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Declare different types of inline data types.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES: The commented lines defining floats and doubles should be uncommented
+ * once the functionality is provided.
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+inline char new_char = 'c';
+inline short new_short = 10;
+inline int new_int = 100;
+inline long new_long = 1234567890;
+inline long long new_long_long = 1234512345;
+inline int8_t new_int8 = 'p';
+inline int16_t new_int16 = 20;
+inline int32_t new_int32 = 200;
+inline int64_t new_int64 = 2000000;
+inline intptr_t new_intptr = 0x12345;
+inline uint8_t new_uint8 = 'q';
+inline uint16_t new_uint16 = 30;
+inline uint32_t new_uint32 = 300;
+inline uint64_t new_uint64 = 3000000;
+inline uintptr_t new_uintptr = 0x67890;
+/* inline float new_float = 1.23456;
+inline double new_double = 2.34567890;
+inline long double new_long_double = 3.567890123;
+*/
+
+inline int * pointer = &`kmem_flags;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineExpression.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineExpression.d
new file mode 100644
index 0000000..d67d3f2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineExpression.d
@@ -0,0 +1,80 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *
+ * Test different inline assignments by various expressions.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES: The commented lines for the floats and doubles should be uncommented
+ * once the functionality is implemented.
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+inline char new_char = 'c' + 2;
+inline short new_short = 10 * new_char;
+inline int new_int = 100 + new_short;
+inline long new_long = 1234567890;
+inline long long new_long_long = 1234512345 * new_long;
+inline int8_t new_int8 = 'p';
+inline int16_t new_int16 = 20 / new_int8;
+inline int32_t new_int32 = 200;
+inline int64_t new_int64 = 2000000 * (-new_int16);
+inline intptr_t new_intptr = 0x12345 - 129;
+inline uint8_t new_uint8 = 'q';
+inline uint16_t new_uint16 = 30 - new_uint8;
+inline uint32_t new_uint32 = 300 - 0;
+inline uint64_t new_uint64 = 3000000;
+inline uintptr_t new_uintptr = 0x67890 / new_uint64;
+
+/* inline float new_float = 1.23456;
+inline double new_double = 2.34567890;
+inline long double new_long_double = 3.567890123;
+*/
+
+inline int * pointer = &`kmem_flags;
+inline int result = 3 > 2 ? 3 : 2;
+
+BEGIN
+{
+	printf("new_char: %c\nnew_short: %d\nnew_int: %d\nnew_long: %d\n",
+	    new_char, new_short, new_int, new_long);
+	printf("new_long_long: %d\nnew_int8: %d\nnew_int16: %d\n",
+	    new_long_long, new_int8, new_int16);
+	printf("new_int32: %d\nnew_int64: %d\n", new_int32, new_int64);
+	printf("new_intptr: %d\nnew_uint8: %d\nnew_uint16: %d\n",
+	    new_intptr, new_uint8, new_uint16);
+	printf("new_uint32:%d\nnew_uint64: %d\nnew_uintptr:%d\nresult:%d",
+	    new_uint32, new_uint64, new_uintptr, result);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineKinds.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineKinds.d
new file mode 100644
index 0000000..7f188fb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineKinds.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Test the code generation and results of the various kinds of inlines.
+ * In particular, we test constant and expression-based scalar inlines,
+ * associative array inlines, and inlines using translators.
+ */
+
+#pragma D option quiet
+
+inline int i0 = 100 + 23;		/* constant-folded integer constant */
+inline string i1 = probename;		/* string variable reference */
+inline int i2 = pid != 0;		/* expression involving a variable */
+
+struct s {
+	int s_x;
+};
+
+translator struct s < int T > {
+	s_x = T + 1;
+};
+
+inline struct s i3 = xlate < struct s > (i0);		/* translator */
+inline int i4[int x, int y] = x + y;			/* associative array */
+inline int i5[int x] = (xlate < struct s > (x)).s_x;	/* array by xlate */
+
+BEGIN
+{
+	printf("i0 = %d\n", i0);
+	printf("i1 = %s\n", i1);
+	printf("i2 = %d\n", i2);
+
+	printf("i3.s_x = %d\n", i3.s_x);
+	printf("i4[10, 20] = %d\n", i4[10, 20]);
+	printf("i5[123] = %d\n", i5[123]);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineKinds.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineKinds.d.out
new file mode 100644
index 0000000..c9a603b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineKinds.d.out
@@ -0,0 +1,7 @@
+i0 = 123
+i1 = BEGIN
+i2 = 1
+i3.s_x = 124
+i4[10, 20] = 30
+i5[123] = 124
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineTypedef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineTypedef.d
new file mode 100644
index 0000000..a624765
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineTypedef.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Create inline names from aliases created using typedef.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ *
+ * NOTES:
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+typedef char new_char;
+inline new_char char_var = 'c';
+
+typedef int * pointer;
+inline pointer p = &`kmem_flags;
+
+BEGIN
+{
+	printf("char_var: %c\npointer p: %d", char_var, *p);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineWritableAssign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineWritableAssign.d
new file mode 100644
index 0000000..a7842a3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/inline/tst.InlineWritableAssign.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Create inline names from aliases created using typedef.
+ *
+ * SECTION: Type and Constant Definitions/Inlines
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+struct record {
+	char c;
+	int i;
+};
+
+struct record rec1;
+inline struct record rec2 = rec1;
+
+union var {
+	char c;
+	int i;
+};
+
+union var un1;
+inline union var un2 = un1;
+
+
+BEGIN
+{
+	rec1.c = 'c';
+	rec1.i = 10;
+
+	un1.c = 'd';
+
+	printf("rec1.c: %c\nrec1.i:%d\nun1.c: %c\n", rec1.c, rec1.i, un1.c);
+	printf("rec2.c: %c\nrec2.i:%d\nun2.c: %c\n", rec2.c, rec2.i, un2.c);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.c
new file mode 100644
index 0000000..2785b51
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.c
@@ -0,0 +1,100 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <assert.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+static sigjmp_buf env;
+
+static void
+interrupt(int sig)
+{
+	siglongjmp(env, sig);
+}
+
+int
+main(int argc, char *argv[])
+{
+	const char *file = "/dev/null";
+	int i, n, fds[10];
+	struct sigaction act;
+
+	if (argc > 1) {
+		(void) fprintf(stderr, "Usage: %s\n", argv[0]);
+		return (EXIT_FAILURE);
+	}
+
+	act.sa_handler = interrupt;
+	act.sa_flags = 0;
+
+	(void) sigemptyset(&act.sa_mask);
+	(void) sigaction(SIGUSR1, &act, NULL);
+
+	closefrom(0);
+	n = 0;
+
+	/*
+	 * With all of our file descriptors closed, wait here spinning in bogus
+	 * ioctl() calls until DTrace hits us with a SIGUSR1 to start the test.
+	 */
+	if (sigsetjmp(env, 1) == 0) {
+		for (;;)
+			(void) ioctl(-1, -1, NULL);
+	}
+
+	/*
+	 * To test the fds[] array, we open /dev/null (a file with reliable
+	 * pathname and properties) using various flags and seek offsets.
+	 */
+	fds[n++] = open(file, O_RDONLY);
+	fds[n++] = open(file, O_WRONLY);
+	fds[n++] = open(file, O_RDWR);
+
+	fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC |
+	    O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC |
+	    O_SYNC | O_TRUNC | O_XATTR);
+
+	fds[n++] = open(file, O_RDWR);
+	(void) lseek(fds[n - 1], 123, SEEK_SET);
+
+	/*
+	 * Once we have all the file descriptors in the state we want to test,
+	 * issue a bogus ioctl() on each fd with cmd -1 and arg NULL to whack
+	 * our DTrace script into recording the content of the fds[] array.
+	 */
+	for (i = 0; i < n; i++)
+		(void) ioctl(fds[i], -1, NULL);
+
+	assert(n <= sizeof (fds) / sizeof (fds[0]));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.d
new file mode 100644
index 0000000..52a3312
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option destructive
+#pragma D option quiet
+
+syscall::ioctl:entry
+/pid == $1 && arg0 == -1u/
+{
+	raise(SIGUSR1); /* kick tst.fds.c out of its busy-wait loop */
+}
+
+syscall::ioctl:entry
+/pid == $1 && arg0 != -1u && arg1 == -1u && arg2 == NULL/
+{
+	printf("fds[%d] fi_name = %s\n", arg0, fds[arg0].fi_name);
+	printf("fds[%d] fi_dirname = %s\n", arg0, fds[arg0].fi_dirname);
+	printf("fds[%d] fi_pathname = %s\n", arg0, fds[arg0].fi_pathname);
+	printf("fds[%d] fi_fs = %s\n", arg0, fds[arg0].fi_fs);
+	printf("fds[%d] fi_mount = %s\n", arg0, fds[arg0].fi_mount);
+	printf("fds[%d] fi_offset = %d\n", arg0, fds[arg0].fi_offset);
+	printf("fds[%d] fi_oflags = 0x%x\n", arg0, fds[arg0].fi_oflags);
+}
+
+proc:::exit
+/pid == $1/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.d.out
new file mode 100644
index 0000000..9d26826
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/io/tst.fds.d.out
@@ -0,0 +1,36 @@
+fds[0] fi_name = mm at 0:null
+fds[0] fi_dirname = /devices/pseudo
+fds[0] fi_pathname = /devices/pseudo/mm at 0:null
+fds[0] fi_fs = specfs
+fds[0] fi_mount = /devices
+fds[0] fi_offset = 0
+fds[0] fi_oflags = 0x0
+fds[1] fi_name = mm at 0:null
+fds[1] fi_dirname = /devices/pseudo
+fds[1] fi_pathname = /devices/pseudo/mm at 0:null
+fds[1] fi_fs = specfs
+fds[1] fi_mount = /devices
+fds[1] fi_offset = 0
+fds[1] fi_oflags = 0x1
+fds[2] fi_name = mm at 0:null
+fds[2] fi_dirname = /devices/pseudo
+fds[2] fi_pathname = /devices/pseudo/mm at 0:null
+fds[2] fi_fs = specfs
+fds[2] fi_mount = /devices
+fds[2] fi_offset = 0
+fds[2] fi_oflags = 0x2
+fds[3] fi_name = mm at 0:null
+fds[3] fi_dirname = /devices/pseudo
+fds[3] fi_pathname = /devices/pseudo/mm at 0:null
+fds[3] fi_fs = specfs
+fds[3] fi_mount = /devices
+fds[3] fi_offset = 0
+fds[3] fi_oflags = 0xebda
+fds[4] fi_name = mm at 0:null
+fds[4] fi_dirname = /devices/pseudo
+fds[4] fi_pathname = /devices/pseudo/mm at 0:null
+fds[4] fi_fs = specfs
+fds[4] fi_mount = /devices
+fds[4] fi_offset = 123
+fds[4] fi_oflags = 0x2
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl
new file mode 100755
index 0000000..fb41255
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl
@@ -0,0 +1,104 @@
+#!/usr/bin/perl -w
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# get.ipv4remote.pl [tcpport]
+#
+# Find an IPv4 reachable remote host using both ifconfig(1M) and ping(1M).
+# If a tcpport is specified, return a host that is also listening on this
+# TCP port.  Print the local address and the remote address, or an
+# error message if no suitable remote host was found.  Exit status is 0 if
+# a host was found.
+#
+
+use strict;
+use IO::Socket;
+
+my $MAXHOSTS = 32;			# max hosts to port scan
+my $TIMEOUT = 3;			# connection timeout
+my $tcpport = @ARGV == 1 ? $ARGV[0] : 0;
+
+#
+# Determine local IP address
+#
+my $local = "";
+my $remote = "";
+my %Broadcast;
+my $up;
+open IFCONFIG, '/usr/sbin/ifconfig -a |' or die "Couldn't run ifconfig: $!\n";
+while (<IFCONFIG>) {
+	next if /^lo/;
+
+	# "UP" is always printed first (see print_flags() in ifconfig.c):
+	$up = 1 if /^[a-z].*<UP,/;
+	$up = 0 if /^[a-z].*<,/;
+
+	# assume output is "inet X ... broadcast Z":
+	if (/inet (\S+) .* broadcast (\S+)/) {
+		my ($addr, $bcast) = ($1, $2);
+		$Broadcast{$addr} = $bcast;
+		$local = $addr if $up and $local eq "";
+		$up = 0;
+	}
+}
+close IFCONFIG;
+die "Could not determine local IP address" if $local eq "";
+
+#
+# Find the first remote host that responds to an icmp echo,
+# which isn't a local address.
+#
+open PING, "/usr/sbin/ping -ns $Broadcast{$local} 56 $MAXHOSTS |" or
+    die "Couldn't run ping: $!\n";
+while (<PING>) {
+	if (/bytes from (.*): / and not defined $Broadcast{$1}) {
+		my $addr = $1;
+
+		if ($tcpport != 0) {
+			#
+			# Test TCP
+			#
+			my $socket = IO::Socket::INET->new(
+				Proto    => "tcp",
+				PeerAddr => $addr,
+				PeerPort => $tcpport,
+				Timeout  => $TIMEOUT,
+			);
+			next unless $socket;
+			close $socket;
+		}
+
+		$remote = $addr;
+		last;
+	}
+}
+close PING;
+die "Can't find a remote host for testing: No suitable response from " .
+    "$Broadcast{$local}\n" if $remote eq "";
+
+print "$local $remote\n";
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl
new file mode 100755
index 0000000..051ab8c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl
@@ -0,0 +1,88 @@
+#!/usr/bin/perl -w
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# get.ipv6remote.pl
+#
+# Find an IPv6 reachable remote host using both ifconfig(1M) and ping(1M).
+# Print the local address and the remote address, or print nothing if either
+# no IPv6 interfaces or remote hosts were found.  (Remote IPv6 testing is
+# considered optional, and so not finding another IPv6 host is not an error
+# state we need to log.)  Exit status is 0 if a host was found.
+#
+
+use strict;
+use IO::Socket;
+
+my $MAXHOSTS = 32;			# max hosts to scan
+my $TIMEOUT = 3;			# connection timeout
+my $MULTICAST = "FF02::1";		# IPv6 multicast address
+
+#
+# Determine local IP address
+#
+my $local = "";
+my $remote = "";
+my %Local;
+my $up;
+open IFCONFIG, '/usr/sbin/ifconfig -a inet6 |'
+    or die "Couldn't run ifconfig: $!\n";
+while (<IFCONFIG>) {
+	next if /^lo/;
+
+	# "UP" is always printed first (see print_flags() in ifconfig.c):
+	$up = 1 if /^[a-z].*<UP,/;
+	$up = 0 if /^[a-z].*<,/;
+
+	# assume output is "inet6 ...":
+	if (m:inet6 (\S+)/:) {
+		my $addr = $1;
+                $Local{$addr} = 1;
+                $local = $addr if $up and $local eq "";
+		$up = 0;
+	}
+}
+close IFCONFIG;
+exit 1 if $local eq "";
+
+#
+# Find the first remote host that responds to an icmp echo,
+# which isn't a local address.
+#
+open PING, "/usr/sbin/ping -ns -A inet6 $MULTICAST 56 $MAXHOSTS |" or
+    die "Couldn't run ping: $!\n";
+while (<PING>) {
+	if (/bytes from (.*): / and not defined $Local{$1}) {
+		$remote = $1;
+		last;
+	}
+}
+close PING;
+exit 2 if $remote eq "";
+
+print "$local $remote\n";
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh
new file mode 100755
index 0000000..0965040
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh
@@ -0,0 +1,70 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Test ip:::{send,receive} of IPv4 ICMP to a local address.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. The lo0 interface missing or not up.
+# 3. Unrelated ICMP on lo0 traced by accident.
+#
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+local=127.0.0.1
+
+$dtrace -c "/usr/sbin/ping $local 3" -qs /dev/stdin <<EOF | sort -n
+ip:::send
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[4]->ipv4_protocol == IPPROTO_ICMP/
+{
+	printf("1 ip:::send    (");
+	printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
+	printf("args[4]: %d %d %d %d %d)\n",
+	    args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
+	    args[4]->ipv4_offset, args[4]->ipv4_ttl);
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[4]->ipv4_protocol == IPPROTO_ICMP/
+{
+	printf("2 ip:::receive (");
+	printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
+	printf("args[4]: %d %d %d %d %d)\n",
+	    args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
+	    args[4]->ipv4_offset, args[4]->ipv4_ttl);
+}
+EOF
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh.out
new file mode 100644
index 0000000..41d6e0c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localicmp.ksh.out
@@ -0,0 +1,6 @@
+
+1 ip:::send    (args[2]: 4 64, args[4]: 4 84 0 0 255)
+1 ip:::send    (args[2]: 4 64, args[4]: 4 84 0 0 255)
+2 ip:::receive (args[2]: 4 64, args[4]: 4 84 0 0 255)
+2 ip:::receive (args[2]: 4 64, args[4]: 4 84 0 0 255)
+127.0.0.1 is alive
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
new file mode 100755
index 0000000..6fa8c35
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh
@@ -0,0 +1,125 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Test {ip,tcp}:::{send,receive} of IPv4 TCP to local host.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. The lo0 interface missing or not up.
+# 3. The local ssh service is not online.
+# 4. An unlikely race causes the unlocked global send/receive
+#    variables to be corrupted.
+#
+# This test performs a TCP connection and checks that at least the
+# following packet counts were traced:
+#
+# 3 x ip:::send (2 during the TCP handshake, then a FIN)
+# 3 x tcp:::send (2 during the TCP handshake, then a FIN)
+# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
+# 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK)
+
+# The actual count tested is 5 each way, since we are tracing both
+# source and destination events.
+#
+# For this test to work, we are assuming that the TCP handshake and
+# TCP close will enter the IP code path and not use tcp fusion.
+#
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+local=127.0.0.1
+tcpport=22
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.pl <<-EOPERL
+	use IO::Socket;
+	my \$s = IO::Socket::INET->new(
+	    Proto => "tcp",
+	    PeerAddr => "$local",
+	    PeerPort => $tcpport,
+	    Timeout => 3);
+	die "Could not connect to host $local port $tcpport" unless \$s;
+	close \$s;
+EOPERL
+
+$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
+BEGIN
+{
+	ipsend = tcpsend = ipreceive = tcpreceive = 0;
+}
+
+ip:::send
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[4]->ipv4_protocol == IPPROTO_TCP/
+{
+	ipsend++;
+}
+
+tcp:::send
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
+{
+	tcpsend++;
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[4]->ipv4_protocol == IPPROTO_TCP/
+{
+	ipreceive++;
+}
+
+tcp:::receive
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
+{
+	tcpreceive++;
+}
+
+END
+{
+	printf("Minimum TCP events seen\n\n");
+	printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no");
+	printf("tcp:::send - %s\n", tcpsend >= 5 ? "yes" : "no");
+	printf("tcp:::receive - %s\n", tcpreceive >= 5 ? "yes" : "no");
+}
+EODTRACE
+
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh.out
new file mode 100644
index 0000000..2a85b98
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh.out
@@ -0,0 +1,7 @@
+Minimum TCP events seen
+
+ip:::send - yes
+ip:::receive - yes
+tcp:::send - yes
+tcp:::receive - yes
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
new file mode 100755
index 0000000..fa8f7ac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh
@@ -0,0 +1,93 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Test ip:::{send,receive} of IPv4 UDP to a local address.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. No physical network interface is plumbed and up.
+# 3. No other hosts on this subnet are reachable and listening on rpcbind.
+# 4. An unlikely race causes the unlocked global send/receive
+#    variables to be corrupted.
+#
+# This test sends a UDP message using ping and checks that at least the
+# following counts were traced:
+#
+# 1 x ip:::send (UDP sent to ping's base UDP port)
+# 1 x udp:::send (UDP sent to ping's base UDP port)
+# 1 x ip:::receive (UDP received)
+# 
+# No udp:::receive event is expected as the response ping -U elicits is
+# an ICMP PORT_UNREACHABLE response rather than a UDP packet, and locally
+# the echo request UDP packet only reaches IP, so the udp:::receive probe
+# is not triggered by it.
+#
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+local=127.0.0.1
+
+$dtrace -c "/usr/sbin/ping -U $local" -qs /dev/stdin <<EOF | grep -v 'is alive'
+BEGIN
+{
+	ipsend = udpsend = ipreceive = 0;
+}
+
+ip:::send
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[4]->ipv4_protocol == IPPROTO_UDP/
+{
+	ipsend++;
+}
+
+udp:::send
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local"/
+{
+	udpsend++;
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[4]->ipv4_protocol == IPPROTO_UDP/
+{
+	ipreceive++;
+}
+
+END
+{
+	printf("Minimum UDP events seen\n\n");
+	printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 1 ? "yes" : "no");
+	printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no");
+}
+EOF
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out
new file mode 100644
index 0000000..bca5532
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4localudp.ksh.out
@@ -0,0 +1,6 @@
+Minimum UDP events seen
+
+ip:::send - yes
+ip:::receive - yes
+udp:::send - yes
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh
new file mode 100755
index 0000000..efe0d30
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh
@@ -0,0 +1,81 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Test ip:::{send,receive} of IPv4 ICMP to a remote host.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. No physical network interface is plumbed and up.
+# 3. No other hosts on this subnet are reachable.
+# 4. An unrelated ICMP between these hosts was traced by accident.
+#
+
+if (( $# != 1 )); then
+        print -u2 "expected one argument: <dtrace-path>"
+        exit 2
+fi
+
+dtrace=$1
+getaddr=./get.ipv4remote.pl
+
+if [[ ! -x $getaddr ]]; then
+	print -u2 "could not find or execute sub program: $getaddr"
+	exit 3
+fi
+$getaddr | read source dest
+if (( $? != 0 )); then
+	exit 4
+fi
+
+$dtrace -c "/usr/sbin/ping $dest 3" -qs /dev/stdin <<EOF | \
+    grep -v 'is alive' | sort -n
+ip:::send
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
+    args[4]->ipv4_protocol == IPPROTO_ICMP/
+{
+	printf("1 ip:::send    (");
+	printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
+	printf("args[4]: %d %d %d %d %d)\n",
+	    args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
+	    args[4]->ipv4_offset, args[4]->ipv4_ttl);
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
+    args[4]->ipv4_protocol == IPPROTO_ICMP/
+{
+	printf("2 ip:::receive (");
+	printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
+	printf("args[4]: %d %d %d %d %d)\n",
+	    args[4]->ipv4_ver, args[4]->ipv4_length, args[4]->ipv4_flags,
+	    args[4]->ipv4_offset, args[4]->ipv4_ttl);
+}
+EOF
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh.out
new file mode 100644
index 0000000..b5915f8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteicmp.ksh.out
@@ -0,0 +1,3 @@
+
+1 ip:::send    (args[2]: 4 64, args[4]: 4 84 0 0 255)
+2 ip:::receive (args[2]: 4 64, args[4]: 4 84 4 0 255)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
new file mode 100755
index 0000000..89a0cdb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh
@@ -0,0 +1,128 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Test {tcp,ip}:::{send,receive} of IPv4 TCP to a remote host.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. No physical network interface is plumbed and up.
+# 3. No other hosts on this subnet are reachable and listening on ssh.
+# 4. An unlikely race causes the unlocked global send/receive
+#    variables to be corrupted.
+#
+# This test performs a TCP connection and checks that at least the
+# following packet counts were traced:
+#
+# 3 x ip:::send (2 during the TCP handshake, then a FIN)
+# 3 x tcp:::send (2 during the TCP handshake, then a FIN)
+# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
+# 2 x tcp:::receive (1 during the TCP handshake, then the FIN ACK)
+# 
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+getaddr=./get.ipv4remote.pl
+tcpport=22
+DIR=/var/tmp/dtest.$$
+
+if [[ ! -x $getaddr ]]; then
+        print -u2 "could not find or execute sub program: $getaddr"
+        exit 3
+fi
+$getaddr $tcpport | read source dest
+if (( $? != 0 )); then
+        exit 4
+fi
+
+mkdir $DIR
+cd $DIR
+
+cat > test.pl <<-EOPERL
+	use IO::Socket;
+	my \$s = IO::Socket::INET->new(
+	    Proto => "tcp",
+	    PeerAddr => "$dest",
+	    PeerPort => $tcpport,
+	    Timeout => 3);
+	die "Could not connect to host $dest port $tcpport" unless \$s;
+	close \$s;
+EOPERL
+
+$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
+BEGIN
+{
+	ipsend = tcpsend = ipreceive = tcpreceive = 0;
+}
+
+ip:::send
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
+    args[4]->ipv4_protocol == IPPROTO_TCP/
+{
+	ipsend++;
+}
+
+tcp:::send
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest"/
+{
+	tcpsend++;
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
+    args[4]->ipv4_protocol == IPPROTO_TCP/
+{
+	ipreceive++;
+}
+
+tcp:::receive
+/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source"/
+{
+	tcpreceive++;
+}
+
+END
+{
+	printf("Minimum TCP events seen\n\n");
+	printf("ip:::send - %s\n", ipsend >= 3 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 2 ? "yes" : "no");
+	printf("tcp:::send - %s\n", tcpsend >= 3 ? "yes" : "no");
+	printf("tcp:::receive - %s\n", tcpreceive >= 2 ? "yes" : "no");
+}
+EODTRACE
+
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $?
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh.out
new file mode 100644
index 0000000..2a85b98
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh.out
@@ -0,0 +1,7 @@
+Minimum TCP events seen
+
+ip:::send - yes
+ip:::receive - yes
+tcp:::send - yes
+tcp:::receive - yes
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh
new file mode 100755
index 0000000..b0893c8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh
@@ -0,0 +1,88 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Test {udp,ip}:::{send,receive} of IPv4 UDP to a remote host.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. No physical network interface is plumbed and up.
+# 3. No other hosts on this subnet are reachable and listening on rpcbind.
+# 4. An unlikely race causes the unlocked global send/receive
+#    variables to be corrupted.
+#
+# This test sends a UDP message using ping and checks that at least the
+# following counts were traced:
+#
+# 1 x ip:::send (UDP sent to ping's base UDP port)
+# 1 x udp:::send (UDP sent to ping's base UDP port)
+# 
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+getaddr=./get.ipv4remote.pl
+
+if [[ ! -x $getaddr ]]; then
+	print -u2 "could not find or execute sub program: $getaddr"
+	exit 3
+fi
+$getaddr | read source dest
+if (( $? != 0 )); then
+	exit 4
+fi
+
+$dtrace -c "/usr/sbin/ping -U $dest" -qs /dev/stdin <<EOF | grep -v 'is alive'
+BEGIN
+{
+	ipsend = udpsend = 0;
+}
+
+ip:::send
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
+    args[4]->ipv4_protocol == IPPROTO_UDP/
+{
+	ipsend++;
+}
+
+udp:::send
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest"/
+{
+	udpsend++;
+}
+
+END
+{
+	printf("Minimum UDP events seen\n\n");
+	printf("ip:::send - %s\n", ipsend >= 1 ? "yes" : "no");
+	printf("udp:::send - %s\n", udpsend >= 1 ? "yes" : "no");
+}
+EOF
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh.out
new file mode 100644
index 0000000..bdbbe1f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv4remoteudp.ksh.out
@@ -0,0 +1,5 @@
+Minimum UDP events seen
+
+ip:::send - yes
+udp:::send - yes
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh
new file mode 100755
index 0000000..5912ee7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh
@@ -0,0 +1,82 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Test ip:::{send,receive} of IPv6 ICMP to a local address.  This creates a
+# temporary lo0/inet6 interface if one doesn't already exist.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. Unrelated ICMPv6 on lo0 traced by accident.
+#
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+local=::1
+
+if ! ifconfig lo0 inet6 > /dev/null 2>&1; then
+	if ! ifconfig lo0 inet6 plumb up; then
+		print -u2 "could not plumb lo0 inet6 for testing"
+		exit 3
+	fi
+	removeinet6=1
+else
+	removeinet6=0
+fi
+
+$dtrace -c "/usr/sbin/ping -A inet6 $local 3" -qs /dev/stdin <<EOF | sort -n
+ip:::send
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
+{
+	printf("1 ip:::send    (");
+	printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
+	printf("args[5]: %d %d %d)\n",
+	    args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
+{
+	printf("2 ip:::receive (");
+	printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
+	printf("args[5]: %d %d %d)\n",
+	    args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
+}
+EOF
+
+if (( removeinet6 )); then
+	ifconfig lo0 inet6 unplumb
+fi
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh.out
new file mode 100644
index 0000000..529d251
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6localicmp.ksh.out
@@ -0,0 +1,6 @@
+
+::1 is alive
+1 ip:::send    (args[2]: 6 64, args[5]: 6 0 64)
+1 ip:::send    (args[2]: 6 64, args[5]: 6 0 64)
+2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64)
+2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh
new file mode 100755
index 0000000..b94b784
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh
@@ -0,0 +1,88 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Test ip:::{send,receive} of IPv6 ICMP to a remote host.  This test is
+# skipped if there are no physical interfaces configured with IPv6, or no
+# other IPv6 hosts are reachable.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. An unrelated ICMPv6 between these hosts was traced by accident.
+#
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+getaddr=./get.ipv6remote.pl
+
+if [[ ! -x $getaddr ]]; then
+	print -u2 "could not find or execute sub program: $getaddr"
+	exit 3
+fi
+$getaddr | read source dest
+if (( $? != 0 )); then
+	print -nu2 "Could not find a local IPv6 interface and a remote IPv6 "
+	print -u2 "host.  Aborting test.\n"
+	print -nu2 "For this test to continue, a \"ping -ns -A inet6 FF02::1\" "
+	print -u2 "must respond with a\nremote IPv6 host."
+	exit 3
+fi
+
+#
+# Shake loose any ICMPv6 Neighbor advertisement messages before tracing.
+#
+/usr/sbin/ping $dest 3 > /dev/null 2>&1
+
+$dtrace -c "/usr/sbin/ping $dest 3" -qs /dev/stdin <<EOF | \
+    grep -v 'is alive' | sort -n
+ip:::send
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
+    args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
+{
+	printf("1 ip:::send    (");
+	printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
+	printf("args[5]: %d %d %d)\n",
+	    args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
+    args[5]->ipv6_nexthdr == IPPROTO_ICMPV6/
+{
+	printf("2 ip:::receive (");
+	printf("args[2]: %d %d, ", args[2]->ip_ver, args[2]->ip_plength);
+	printf("args[5]: %d %d %d)\n",
+	    args[5]->ipv6_ver, args[5]->ipv6_tclass, args[5]->ipv6_plen);
+}
+EOF
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh.out
new file mode 100644
index 0000000..1ddcd07
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.ipv6remoteicmp.ksh.out
@@ -0,0 +1,3 @@
+
+1 ip:::send    (args[2]: 6 64, args[5]: 6 0 64)
+2 ip:::receive (args[2]: 6 64, args[5]: 6 0 64)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh
new file mode 100755
index 0000000..8a65ce6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh
@@ -0,0 +1,182 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Test tcp:::state-change and tcp:::{send,receive} by connecting to
+# the local ssh service and sending a test message. This should result
+# in a "Protocol mismatch" response and a close of the connection.
+# A number of state transition events along with tcp fusion send and
+# receive events for the message should result.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. The lo0 interface missing or not up.
+# 3. The local ssh service is not online.
+# 4. An unlikely race causes the unlocked global send/receive
+#    variables to be corrupted.
+#
+# This test performs a TCP connection to the ssh service (port 22) and
+# checks that at least the following packet counts were traced:
+#
+# 3 x ip:::send (2 during the TCP handshake, then a FIN)
+# 4 x tcp:::send (2 during the TCP handshake, 1 message then a FIN)
+# 2 x ip:::receive (1 during the TCP handshake, then the FIN ACK)
+# 3 x tcp:::receive (1 during the TCP handshake, 1 message then the FIN ACK)
+#
+# The actual ip count tested is 5 each way, since we are tracing both
+# source and destination events.  The actual tcp count tested is 7
+# each way, since the TCP fusion send/receive events will not reach IP.
+#
+# For this test to work, we are assuming that the TCP handshake and
+# TCP close will enter the IP code path and not use tcp fusion.
+#
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+local=127.0.0.1
+tcpport=22
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.pl <<-EOPERL
+	use IO::Socket;
+	my \$s = IO::Socket::INET->new(
+	    Proto => "tcp",
+	    PeerAddr => "$local",
+	    PeerPort => $tcpport,
+	    Timeout => 3);
+	die "Could not connect to host $local port $tcpport" unless \$s;
+	print \$s "testing state machine transitions";
+	close \$s;
+EOPERL
+
+$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
+BEGIN
+{
+	ipsend = tcpsend = ipreceive = tcpreceive = 0;
+	connreq = connest = connaccept = 0;
+}
+
+ip:::send
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[4]->ipv4_protocol == IPPROTO_TCP/
+{
+	ipsend++;
+}
+
+tcp:::send
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+ (args[4]->tcp_sport == $tcpport || args[4]->tcp_dport == $tcpport)/
+{
+	tcpsend++;
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+    args[4]->ipv4_protocol == IPPROTO_TCP/
+{
+	ipreceive++;
+}
+
+tcp:::receive
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+ (args[4]->tcp_sport == $tcpport || args[4]->tcp_dport == $tcpport)/
+{
+	tcpreceive++;
+}
+
+tcp:::state-change
+{
+	state_event[args[3]->tcps_state]++;
+}
+
+tcp:::connect-request
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+ args[4]->tcp_dport == $tcpport/
+{
+	connreq++;
+}
+
+tcp:::connect-established
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+ args[4]->tcp_sport == $tcpport/
+{
+	connest++;
+}
+
+tcp:::accept-established
+/args[2]->ip_saddr == "$local" && args[2]->ip_daddr == "$local" &&
+ args[4]->tcp_dport == $tcpport/
+{
+	connaccept++;
+}
+
+END
+{
+	printf("Minimum TCP events seen\n\n");
+	printf("ip:::send - %s\n", ipsend >= 5 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 5 ? "yes" : "no");
+	printf("tcp:::send - %s\n", tcpsend >= 7 ? "yes" : "no");
+	printf("tcp:::receive - %s\n", tcpreceive >= 7 ? "yes" : "no");
+	printf("tcp:::state-change to syn-sent - %s\n",
+	    state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no");
+	printf("tcp:::state-change to syn-received - %s\n",
+	    state_event[TCP_STATE_SYN_RECEIVED] >=1 ? "yes" : "no");
+	printf("tcp:::state-change to established - %s\n",
+	    state_event[TCP_STATE_ESTABLISHED] >= 2 ? "yes" : "no");
+	printf("tcp:::state-change to fin-wait-1 - %s\n",
+	    state_event[TCP_STATE_FIN_WAIT_1] >= 1 ? "yes" : "no");
+	printf("tcp:::state-change to close-wait - %s\n",
+	    state_event[TCP_STATE_CLOSE_WAIT] >= 1 ? "yes" : "no");
+	printf("tcp:::state-change to fin-wait-2 - %s\n",
+	    state_event[TCP_STATE_FIN_WAIT_2] >= 1 ? "yes" : "no");
+	printf("tcp:::state-change to last-ack - %s\n",
+	    state_event[TCP_STATE_LAST_ACK] >= 1 ? "yes" : "no");
+	printf("tcp:::state-change to time-wait - %s\n",
+	    state_event[TCP_STATE_TIME_WAIT] >= 1 ? "yes" : "no");
+	printf("tcp:::connect-request - %s\n",
+	    connreq >=1 ? "yes" : "no");
+	printf("tcp:::connect-established - %s\n",
+	    connest >=1 ? "yes" : "no");
+	printf("tcp:::accept-established - %s\n",
+	    connaccept >=1 ? "yes" : "no");
+}
+EODTRACE
+
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh.out
new file mode 100644
index 0000000..ea1c27e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh.out
@@ -0,0 +1,18 @@
+Minimum TCP events seen
+
+ip:::send - yes
+ip:::receive - yes
+tcp:::send - yes
+tcp:::receive - yes
+tcp:::state-change to syn-sent - yes
+tcp:::state-change to syn-received - yes
+tcp:::state-change to established - yes
+tcp:::state-change to fin-wait-1 - yes
+tcp:::state-change to close-wait - yes
+tcp:::state-change to fin-wait-2 - yes
+tcp:::state-change to last-ack - yes
+tcp:::state-change to time-wait - yes
+tcp:::connect-request - yes
+tcp:::connect-established - yes
+tcp:::accept-established - yes
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
new file mode 100755
index 0000000..b6b9545
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh
@@ -0,0 +1,172 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# Test tcp:::state-change and tcp:::{send,receive} by connecting to
+# the remote ssh service and sending a test message. This should result
+# in a "Protocol mismatch" response and a close of the connection.
+# A number of state transition events along with tcp send and receive
+# events for the message should result.
+#
+# This may fail due to:
+#
+# 1. A change to the ip stack breaking expected probe behavior,
+#    which is the reason we are testing.
+# 2. The lo0 interface missing or not up.
+# 3. The remote ssh service is not online.
+# 4. An unlikely race causes the unlocked global send/receive
+#    variables to be corrupted.
+#
+# This test performs a TCP connection to the ssh service (port 22) and
+# checks that at least the following packet counts were traced:
+#
+# 4 x ip:::send (2 during the TCP handshake, the message, then a FIN)
+# 4 x tcp:::send (2 during the TCP handshake, the messages, then a FIN)
+# 3 x ip:::receive (1 during the TCP handshake, the response, then the FIN ACK)
+# 3 x tcp:::receive (1 during the TCP handshake, the response, then the FIN ACK)
+#
+# For this test to work, we are assuming that the TCP handshake and
+# TCP close will enter the IP code path and not use tcp fusion.
+#
+
+if (( $# != 1 )); then
+	print -u2 "expected one argument: <dtrace-path>"
+	exit 2
+fi
+
+dtrace=$1
+getaddr=./get.ipv4remote.pl
+tcpport=22
+DIR=/var/tmp/dtest.$$
+
+if [[ ! -x $getaddr ]]; then
+	print -u2 "could not find or execute sub program: $getaddr"
+	exit 3
+fi
+$getaddr $tcpport | read source dest
+if (( $? != 0 )); then
+	exit 4
+fi
+
+mkdir $DIR
+cd $DIR
+
+cat > test.pl <<-EOPERL
+	use IO::Socket;
+	my \$s = IO::Socket::INET->new(
+	    Proto => "tcp",
+	    PeerAddr => "$dest",
+	    PeerPort => $tcpport,
+	    Timeout => 3);
+	die "Could not connect to host $dest port $tcpport" unless \$s;
+	print \$s "testing state machine transitions";
+	close \$s;
+EOPERL
+
+$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
+BEGIN
+{
+	ipsend = tcpsend = ipreceive = tcpreceive = 0;
+	connreq = connest = 0;
+}
+
+ip:::send
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
+    args[4]->ipv4_protocol == IPPROTO_TCP/
+{
+	ipsend++;
+}
+
+tcp:::send
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
+    args[4]->tcp_dport == $tcpport/
+{
+	tcpsend++;
+}
+
+ip:::receive
+/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
+    args[4]->ipv4_protocol == IPPROTO_TCP/
+{
+	ipreceive++;
+}
+
+tcp:::receive
+/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
+    args[4]->tcp_sport == $tcpport/
+{
+	tcpreceive++;
+}
+
+tcp:::state-change
+{
+	state_event[args[3]->tcps_state]++;
+}
+
+tcp:::connect-request
+/args[2]->ip_saddr == "$source" && args[2]->ip_daddr == "$dest" &&
+ args[4]->tcp_dport == $tcpport/
+{
+	connreq++;
+}
+
+tcp:::connect-established
+/args[2]->ip_saddr == "$dest" && args[2]->ip_daddr == "$source" &&
+ args[4]->tcp_sport == $tcpport/
+{
+	connest++;
+}
+
+END
+{
+	printf("Minimum TCP events seen\n\n");
+	printf("ip:::send - %s\n", ipsend >= 4 ? "yes" : "no");
+	printf("ip:::receive - %s\n", ipreceive >= 3 ? "yes" : "no");
+	printf("tcp:::send - %s\n", tcpsend >= 4 ? "yes" : "no");
+	printf("tcp:::receive - %s\n", tcpreceive >= 3 ? "yes" : "no");
+	printf("tcp:::state-change to syn-sent - %s\n",
+	    state_event[TCP_STATE_SYN_SENT] >=1 ? "yes" : "no");
+	printf("tcp:::state-change to established - %s\n",
+	    state_event[TCP_STATE_ESTABLISHED] >= 1 ? "yes" : "no");
+	printf("tcp:::state-change to fin-wait-1 - %s\n",
+	    state_event[TCP_STATE_FIN_WAIT_1] >= 1 ? "yes" : "no");
+	printf("tcp:::state-change to fin-wait-2 - %s\n",
+	    state_event[TCP_STATE_FIN_WAIT_2] >= 1 ? "yes" : "no");
+	printf("tcp:::state-change to time-wait - %s\n",
+	    state_event[TCP_STATE_TIME_WAIT] >= 1 ? "yes" : "no");
+	printf("tcp:::connect-request - %s\n",
+	    connreq >=1 ? "yes" : "no");
+	printf("tcp:::connect-established - %s\n",
+	    connest >=1 ? "yes" : "no");
+}
+EODTRACE
+
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh.out
new file mode 100644
index 0000000..27388fb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh.out
@@ -0,0 +1,15 @@
+Minimum TCP events seen
+
+ip:::send - yes
+ip:::receive - yes
+tcp:::send - yes
+tcp:::receive - yes
+tcp:::state-change to syn-sent - yes
+tcp:::state-change to established - yes
+tcp:::state-change to fin-wait-1 - yes
+tcp:::state-change to close-wait - yes
+tcp:::state-change to fin-wait-2 - yes
+tcp:::state-change to time-wait - yes
+tcp:::connect-request - yes
+tcp:::connect-established - yes
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/Makefile
new file mode 100644
index 0000000..fe213dd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/Makefile
@@ -0,0 +1,79 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+include $(SRC)/Makefile.master
+
+ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
+JAR_DSTDIR = $(ROOTOPTPKG)/tst/common/java_api
+JAR_SRCDIR = $(SRC)/cmd/dtrace/test/tst/common/java_api
+
+# Use the proto dtrace.jar if it exists, otherwise use whatever is
+# installed on the system. It should be possible to build
+# usr/src/cmd/dtrace/test independently, even if only on systems that
+# have a compatible dtrace.jar installed.
+DTRACE_JAR=usr/share/lib/java/dtrace.jar
+PROTO_DTRACE_JAR=$(ROOT)/$(DTRACE_JAR)
+INSTALLED_DTRACE_JAR=/$(DTRACE_JAR)
+CLASSPATH=$(PROTO_DTRACE_JAR):$(INSTALLED_DTRACE_JAR)
+SRCDIR=src
+CLASSDIR=classes
+MANIFESTDIR=manifest
+MANIFEST=$(MANIFESTDIR)/test.jar-manifest
+TEST_JAR=$(JAR_SRCDIR)/test.jar
+PROTO_TEST_JAR=$(JAR_DSTDIR)/test.jar
+
+default: $(TEST_JAR)
+
+clean:
+	$(RM) $(CLASSDIR)/*.class
+
+clobber: clean
+	$(RM) $(TEST_JAR)
+
+all: default
+
+lint:
+
+install: all $(PROTO_TEST_JAR)
+
+JFLAGS= -g -cp $(CLASSPATH) -d $(CLASSDIR) -deprecation
+JFLAGS += -target 1.5
+JFLAGS += -Xlint
+COMPILE.java=$(JAVAC) $(JFLAGS)
+
+$(TEST_JAR): $(SRCDIR)/*.java
+	@mkdir -p $(CLASSDIR)
+	$(COMPILE.java) $(SRCDIR)/*.java
+	$(JAR) -cmf $(MANIFEST) $(TEST_JAR) -C $(CLASSDIR) .
+
+$(PROTO_TEST_JAR): $(JAR_DSTDIR)
+
+$(JAR_DSTDIR):
+	$(INS.dir)
+
+$(JAR_DSTDIR)/%: $(JAR_SRCDIR)/%
+	$(INS.file)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/manifest/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/manifest/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/manifest/test.jar-manifest b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/manifest/test.jar-manifest
new file mode 100644
index 0000000..7e454ad
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/manifest/test.jar-manifest
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Class-Path: /usr/share/lib/java/dtrace.jar
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestAbort.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestAbort.java
new file mode 100644
index 0000000..310dd18
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestAbort.java
@@ -0,0 +1,158 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import org.opensolaris.os.dtrace.*;
+import java.util.NoSuchElementException;
+
+/**
+ * Regression for 6426129 abort() after close() throws
+ * NoSuchElementException.
+ */
+public class TestAbort {
+    static boolean aborted = false;
+
+    public static void
+    main(String[] args)
+    {
+	Consumer consumer = new LocalConsumer();
+
+	// Test for deadlock (bug 6419880)
+	try {
+	    consumer.open();
+	    consumer.compile("syscall:::entry { @[execname] = count(); } " +
+		    "tick-101ms { printa(@); }");
+	    consumer.enable();
+	    consumer.go();
+	    try {
+		Thread.currentThread().sleep(1000);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+		System.exit(1);
+	    }
+	    consumer.close();
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+
+	consumer = new LocalConsumer();
+
+	// Should be able to abort an unopened consumer
+	try {
+	    aborted = false;
+	    consumer.addConsumerListener(new ConsumerAdapter() {
+		public void consumerStopped(ConsumerEvent e) {
+		    aborted = true;
+		}
+	    });
+	    consumer.abort();
+	    consumer.open();
+	    consumer.compile("syscall:::entry { @[execname] = count(); } " +
+		    "tick-101ms { printa(@); }");
+	    consumer.enable();
+	    consumer.go();
+	    try {
+		Thread.currentThread().sleep(1000);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+		System.exit(1);
+	    }
+	    if (!aborted) {
+		throw new IllegalStateException("consumer not aborted");
+	    }
+	    consumer.close();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+
+	consumer = new LocalConsumer();
+
+	// Should be safe to call abort() in any state
+	try {
+	    consumer.abort();
+	    consumer.open();
+	    consumer.abort();
+	    consumer.compile("syscall:::entry { @[execname] = count(); } " +
+		    "tick-101ms { printa(@); }");
+	    consumer.abort();
+	    consumer.enable();
+	    consumer.abort();
+	    consumer.go();
+	    consumer.abort();
+	    consumer.close();
+	    // Should be safe to call after close()
+	    try {
+		consumer.abort();
+	    } catch (NoSuchElementException e) {
+		e.printStackTrace();
+		System.exit(1);
+	    }
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+
+	consumer = new LocalConsumer();
+
+	// Tests that close() throws expected exception when called on
+	// synchronized consumer.
+	try {
+	    consumer.open();
+	    consumer.compile("syscall:::entry { @[execname] = count(); } " +
+		    "tick-101ms { printa(@); }");
+	    consumer.enable();
+	    consumer.go();
+	    try {
+		Thread.currentThread().sleep(1000);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+		System.exit(1);
+	    }
+	    try {
+		synchronized (consumer) {
+		    consumer.close();
+		}
+	    } catch (IllegalThreadStateException e) {
+		try {
+		    consumer.close();
+		    System.out.println("Successful");
+		    System.exit(0);
+		} catch (NoSuchElementException x) {
+		    x.printStackTrace();
+		    System.exit(1);
+		}
+	    }
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+	System.err.println("Failed");
+	System.exit(1);
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestBean.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestBean.java
new file mode 100644
index 0000000..dd4a969
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestBean.java
@@ -0,0 +1,706 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import org.opensolaris.os.dtrace.*;
+import java.util.*;
+import java.io.*;
+import java.beans.*;
+import java.lang.reflect.*;
+
+/**
+ * Regression test for serialization and XML encoding/decoding.  Tests
+ * every Serializable class in the Java DTrace API by creating a dummy
+ * instance, writing it to a file, then reading it back in and comparing
+ * the string values of the object before and after, as well as
+ * verifying object equality before and after if the class overrides the
+ * equals() method.
+ */
+public class TestBean {
+    public static final String[] TESTS = new String[] {
+	"ExitRecord",
+	"AggregationRecord",
+	"Aggregation",
+	"Tuple",
+	"ScalarRecord",
+	"KernelStackRecord",
+	"LogDistribution",
+	"LinearDistribution",
+	"Option",
+	"ProcessState",
+	"ProbeDescription",
+	"PrintaRecord",
+	"PrintfRecord",
+	"ProbeData",
+	"Aggregate",
+	"UserStackRecord",
+	"AvgValue",
+	"CountValue",
+	"SumValue",
+	"MinValue",
+	"MaxValue",
+	"Error",
+	"Drop",
+	"InterfaceAttributes",
+	"ProgramInfo",
+	"ProbeInfo",
+	"Probe",
+	"Flow",
+	"KernelSymbolRecord",
+	"UserSymbolRecord",
+	"UserSymbolRecord$Value",
+	"Program",
+	"Program$File",
+	"StddevValue"
+    };
+
+    static File file;
+
+    static void
+    exit(int status)
+    {
+	System.out.flush();
+	System.err.flush();
+	System.exit(status);
+    }
+
+    public static XMLEncoder
+    getXMLEncoder(File file)
+    {
+        XMLEncoder encoder = null;
+        try {
+            OutputStream out = new BufferedOutputStream
+                    (new FileOutputStream(file));
+            encoder = new XMLEncoder(out);
+        } catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1);
+        }
+        return encoder;
+    }
+
+    public static XMLDecoder
+    getXMLDecoder(File file)
+    {
+        return getXMLDecoder(file, null);
+    }
+
+    public static XMLDecoder
+    getXMLDecoder(File file, ExceptionListener exceptionListener)
+    {
+        XMLDecoder decoder = null;
+        try {
+            InputStream in = new BufferedInputStream
+                    (new FileInputStream(file));
+            decoder = new XMLDecoder(in, null, exceptionListener);
+        } catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1);
+        }
+        return decoder;
+    }
+
+    public static ExitRecord
+    getExitRecord()
+    {
+	ExitRecord r = new ExitRecord(1);
+	return r;
+    }
+
+    public static AggregationRecord
+    getAggregationRecord()
+    {
+	Tuple tuple = getTuple();
+	AggregationValue value = new CountValue(7);
+	AggregationRecord r = new AggregationRecord(tuple, value);
+	return r;
+    }
+
+    public static Aggregation
+    getAggregation()
+    {
+	List < AggregationRecord > list =
+	    new ArrayList < AggregationRecord > ();
+	AggregationRecord r;
+	r = getAggregationRecord();
+	list.add(r);
+
+	ValueRecord v1 = new ScalarRecord(new byte[] {(byte)1, (byte)2,
+	    (byte)3}, 3);
+	ValueRecord v2 = new ScalarRecord("shebang!", 256);
+	Tuple tuple = new Tuple(v1, v2);
+	AggregationValue value = getLinearDistribution();
+	r = new AggregationRecord(tuple, value);
+	list.add(r);
+
+	Aggregation a = new Aggregation("counts", 2, list);
+	return a;
+    }
+
+    public static Tuple
+    getTuple()
+    {
+	ValueRecord r1 = new ScalarRecord("cat", 256);
+	ValueRecord r2 = new ScalarRecord(new Integer(9), 2);
+	ValueRecord r3 = new KernelStackRecord(
+		new StackFrame[] {
+		    new StackFrame("has"),
+		    new StackFrame("nine"),
+		    new StackFrame("lives")},
+		new byte[] { (byte)0, (byte)1, (byte)2 });
+	ValueRecord r4 = new ScalarRecord(new byte[] {(byte)1, (byte)2,
+	    (byte)3}, 3);
+
+	Tuple tuple = new Tuple(r1, r2, r3, r4);
+	return tuple;
+    }
+
+    public static ScalarRecord
+    getScalarRecord()
+    {
+	Object v = new byte[] {(byte)1, (byte)2, (byte)3};
+	ScalarRecord r = new ScalarRecord(v, 3);
+	return r;
+    }
+
+    public static KernelStackRecord
+    getKernelStackRecord()
+    {
+	StackFrame[] stackFrames = new StackFrame[] {
+	    new StackFrame("Frame 1"),
+	    new StackFrame("Frame 2"),
+	    new StackFrame("Frame 3")
+	};
+	KernelStackRecord r = new KernelStackRecord(stackFrames,
+		new byte[] { (byte)0, (byte)1, (byte)2 });
+	return r;
+    }
+
+    public static LogDistribution
+    getLogDistribution()
+    {
+	List < Distribution.Bucket > buckets =
+		new ArrayList < Distribution.Bucket > ();
+	Distribution.Bucket bucket;
+	int n = 0;
+	long base = 0;
+	long i;
+	long sign;
+	long nextSign;
+	long power;
+	long nextPower;
+	long lowerBound;
+	long upperBound;
+	for (i = -62; i <= 62; ++i) {
+	    if (i == 0) {
+		bucket = new Distribution.Bucket(-1, -1, n++);
+		buckets.add(bucket);
+		bucket = new Distribution.Bucket(0, 0, n++);
+		buckets.add(bucket);
+		bucket = new Distribution.Bucket(1, 1, n++);
+		buckets.add(bucket);
+		continue;
+	    }
+	    sign = ((i < 0) ? -1L : 1L);
+	    power = (sign * i);
+	    nextSign = (((i + 1) < 0) ? -1L : 1L);
+	    nextPower = (nextSign * (i + 1));
+	    lowerBound = sign * ((long) Math.pow(2L, power));
+	    upperBound = (nextPower == 0 ? -2L :
+		    (nextSign * ((long) Math.pow(2L, nextPower))) - 1);
+	    if ((upperBound > 0) && ((upperBound * 2L) < 0)) {
+		upperBound = Long.MAX_VALUE;
+	    }
+	    bucket = new Distribution.Bucket(lowerBound, upperBound, n++);
+	    buckets.add(bucket);
+	}
+	LogDistribution d = new LogDistribution(buckets);
+	return d;
+    }
+
+    public static LinearDistribution
+    getLinearDistribution()
+    {
+	List < Distribution.Bucket > buckets =
+		new ArrayList < Distribution.Bucket > ();
+	Distribution.Bucket bucket;
+	int n = 10; // number of buckets
+	int base = 1;
+	int step = 10;
+	bucket = new Distribution.Bucket(Long.MIN_VALUE, (base - 1), 0);
+	buckets.add(bucket);
+	for (int i = base; i < (n * step); i += step) {
+	    bucket = new Distribution.Bucket(i, (i + (step - 1)),
+		    ((i - 1) / step));
+	    buckets.add(bucket);
+	}
+	bucket = new Distribution.Bucket((n * step) + 1, Long.MAX_VALUE, 0);
+	buckets.add(bucket);
+	LinearDistribution d = new LinearDistribution(base, step, buckets);
+	return d;
+    }
+
+    public static Option
+    getOption()
+    {
+	Option option = new Option("aggrate", "1s");
+	return option;
+    }
+
+    public static ProcessState
+    getProcessState()
+    {
+	ProcessState p = new ProcessState(123456, "UNDEAD",
+		3, "SIGSTOP",
+		-2, "Process stopped on dime");
+	return p;
+    }
+
+    public static ProbeDescription
+    getProbeDescription()
+    {
+	ProbeDescription d = new ProbeDescription(256, "syscall", null,
+	    "malloc", "entry");
+	return d;
+    }
+
+    public static PrintaRecord
+    getPrintaRecord()
+    {
+	List < Aggregation > aggregations = new ArrayList < Aggregation > ();
+	Aggregation a = getAggregation();
+	aggregations.add(a);
+	aggregations.add(a);
+	Map < Tuple, String > formattedOutput =
+		new HashMap < Tuple, String > ();
+	for (Tuple t : a.asMap().keySet()) {
+	    formattedOutput.put(t, "cat");
+	}
+	List < Tuple > tuples = new ArrayList < Tuple > ();
+	for (Tuple t : a.asMap().keySet()) {
+	    tuples.add(t);
+	}
+	Collections.sort(tuples);
+	PrintaRecord r = new PrintaRecord(1234567890L,
+	    aggregations, formattedOutput, tuples,
+	    "Yes, this is the formatted printa() output");
+	return r;
+    }
+
+    public static PrintfRecord
+    getPrintfRecord()
+    {
+	List < ValueRecord > list = new ArrayList < ValueRecord > ();
+	ValueRecord v1 = getScalarRecord();
+	ValueRecord v2 = new ScalarRecord(new Integer(7), 4);
+	list.add(v1);
+	list.add(v2);
+	PrintfRecord r = new PrintfRecord(list,
+		"long formatted string");
+	return r;
+    }
+
+    public static ProbeData
+    getProbeData()
+    {
+	List < Record > list = new ArrayList < Record > ();
+	list.add(getPrintaRecord());
+	list.add(getPrintfRecord());
+	list.add(getScalarRecord());
+	list.add(getUserSymbolRecord());
+	list.add(getUserStackRecord());
+	list.add(getExitRecord());
+	ProbeData d = new ProbeData(7, 1, getProbeDescription(),
+	    getFlow(), list);
+	return d;
+    }
+
+    public static Aggregate
+    getAggregate()
+    {
+	List < Aggregation > list = new ArrayList < Aggregation > ();
+	list.add(getAggregation());
+
+	List < AggregationRecord > reclist =
+	    new ArrayList < AggregationRecord > ();
+	AggregationRecord r;
+	ValueRecord v1 = new ScalarRecord("cat", 256);
+	ValueRecord v2 = new ScalarRecord("dog", 256);
+	ValueRecord v3 = new ScalarRecord("mouse", 256);
+	ValueRecord v4 = new ScalarRecord("mouse", 256);
+	ValueRecord v5 = new ScalarRecord(new Byte((byte) 'C'), 1);
+	ValueRecord v6 = new ScalarRecord(new Short((short) 7), 2);
+	Tuple tuple = new Tuple(v1, v2, v3, v4, v5, v6);
+	AggregationValue value = getCountValue();
+	r = new AggregationRecord(tuple, value);
+	reclist.add(r);
+	list.add(new Aggregation("times", 1, reclist));
+
+        Aggregate a = new Aggregate(1234567890L, list);
+	return a;
+    }
+
+    public static UserStackRecord
+    getUserStackRecord()
+    {
+	StackFrame[] frames = new StackFrame[] {
+	    new StackFrame("User Stack Frame 1"),
+	    new StackFrame("User Stack Frame 2"),
+	    new StackFrame("User Stack Frame 3")
+	};
+	UserStackRecord r = new UserStackRecord(123456, frames,
+		new byte[] { (byte)0, (byte)1, (byte)2 });
+	return r;
+    }
+
+    public static AvgValue
+    getAvgValue()
+    {
+	AvgValue v = new AvgValue(5, 20, 4);
+	return v;
+    }
+
+    public static CountValue
+    getCountValue()
+    {
+	CountValue v = new CountValue(9);
+	return v;
+    }
+
+    public static MinValue
+    getMinValue()
+    {
+	MinValue v = new MinValue(101);
+	return v;
+    }
+
+    public static MaxValue
+    getMaxValue()
+    {
+	MaxValue v = new MaxValue(101);
+	return v;
+    }
+
+    public static SumValue
+    getSumValue()
+    {
+	SumValue v = new SumValue(25);
+	return v;
+    }
+
+    public static org.opensolaris.os.dtrace.Error
+    getError()
+    {
+	ProbeDescription probe = getProbeDescription();
+	org.opensolaris.os.dtrace.Error e =
+	    new org.opensolaris.os.dtrace.Error(probe, 8, 3,
+	    1, 20, "DTRACEFLT_BADALIGN", -1, "error on enabled probe ID 8 " +
+	    "(ID " + probe.getID() + ": " + probe + "): Bad alignment " +
+	    "(0x33ef) in action #1 at DIF offset 20");
+	return e;
+    }
+
+    public static Drop
+    getDrop()
+    {
+	Drop drop = new Drop(2, "SPECBUSY", 72, 1041,
+	    "Guess we dropped stuff all over the place.");
+	return drop;
+    }
+
+    public static InterfaceAttributes
+    getInterfaceAttributes()
+    {
+	InterfaceAttributes a = new InterfaceAttributes(
+                InterfaceAttributes.Stability.UNSTABLE,
+                InterfaceAttributes.Stability.EVOLVING,
+                InterfaceAttributes.DependencyClass.ISA);
+	return a;
+    }
+
+    public static ProgramInfo
+    getProgramInfo()
+    {
+	ProgramInfo info = new ProgramInfo(getInterfaceAttributes(),
+		getInterfaceAttributes(), 256);
+	return info;
+    }
+
+    public static ProbeInfo
+    getProbeInfo()
+    {
+	ProbeInfo info = new ProbeInfo(getInterfaceAttributes(),
+		getInterfaceAttributes());
+	return info;
+    }
+
+    public static Probe
+    getProbe()
+    {
+	Probe p = new Probe(getProbeDescription(), getProbeInfo());
+	return p;
+    }
+
+    public static Flow
+    getFlow()
+    {
+	Flow f = new Flow(Flow.Kind.RETURN.name(), 3);
+	return f;
+    }
+
+    public static KernelSymbolRecord
+    getKernelSymbolRecord()
+    {
+	KernelSymbolRecord r = new KernelSymbolRecord("mod`func+0x4", -1L);
+	return r;
+    }
+
+    public static UserSymbolRecord
+    getUserSymbolRecord()
+    {
+	UserSymbolRecord r = new UserSymbolRecord(7, "mod`func+0x4", -1L);
+	return r;
+    }
+
+    public static UserSymbolRecord.Value
+    getUserSymbolRecord$Value()
+    {
+	UserSymbolRecord.Value v = new UserSymbolRecord.Value(7, -1L);
+	return v;
+    }
+
+    public static Program
+    getProgram()
+    {
+	final String PROGRAM = "syscall:::entry { @[execname] = count(); }";
+	Consumer consumer = new LocalConsumer();
+	Program p;
+	try {
+	    consumer.open();
+	    p = consumer.compile(PROGRAM);
+	    consumer.close();
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    p = null;
+	}
+	return p;
+    }
+
+    public static Program.File
+    getProgram$File()
+    {
+	final String PROGRAM = "syscall:::entry { @[execname] = count(); }";
+	Consumer consumer = new LocalConsumer();
+	Program p;
+	try {
+            OutputStream out = new FileOutputStream(file);
+	    out.write(PROGRAM.getBytes(), 0, PROGRAM.length());
+	    out.flush();
+	    out.close();
+	    consumer.open();
+	    p = consumer.compile(file);
+	    consumer.close();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    p = null;
+	}
+	return Program.File.class.cast(p);
+    }
+
+    public static StddevValue
+    getStddevValue()
+    {
+	StddevValue v = new StddevValue(37, 114, 5, Integer.toString(9544));
+	return v;
+    }
+
+    @SuppressWarnings("unchecked")
+    static String
+    getString(Object o)
+    {
+	String s;
+	if (o instanceof ScalarRecord) {
+	    o = ((ScalarRecord)o).getValue();
+	}
+
+	if (o instanceof byte[]) {
+	    s = Arrays.toString((byte[])o);
+	} else if (o instanceof Object[]) {
+	    s = Arrays.toString((Object[])o);
+	} else {
+	    Class c = o.getClass();
+	    try {
+		Method m = c.getDeclaredMethod("toLogString");
+		s = (String)m.invoke(o);
+	    } catch (Exception e) {
+		s = o.toString();
+	    }
+	}
+	return s;
+    }
+
+    static void
+    checkEquality(Object obj, Object newobj)
+    {
+	// If the class overrides equals(), make sure the re-created
+	// object still equals the original object
+	try {
+	    Method eq = obj.getClass().getDeclaredMethod("equals",
+		    Object.class);
+	    Boolean ret = (Boolean) eq.invoke(obj, newobj);
+	    if (ret != true) {
+		System.err.println("serialization failed: " +
+			obj.getClass().getName());
+		exit(1);
+	    }
+	} catch (Exception e) {
+	    // Does not override equals(), although a super-class might.
+	    // A better test would check for any superclass other than
+	    // Object.class.
+	}
+    }
+
+    static void
+    performSerializationTest(File file, String classname)
+            throws IOException, ClassNotFoundException
+    {
+	String methodName = "get" + classname;
+	Object obj = null;
+	Object newobj = null;
+	try {
+	    Method method = TestBean.class.getDeclaredMethod(methodName);
+	    obj = method.invoke(null);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1);
+	}
+
+	System.out.println(classname + ":");
+	String serialized = getString(obj);
+	System.out.println("  serialized: " + serialized);
+	FileOutputStream fos = new FileOutputStream(file);
+	ObjectOutputStream out = new ObjectOutputStream(fos);
+	out.writeObject(obj);
+	out.close();
+	FileInputStream fis = new FileInputStream(file);
+	ObjectInputStream in = new ObjectInputStream(fis);
+	newobj = in.readObject();
+	in.close();
+	String deserialized = getString(newobj);
+	System.out.println("  deserialized: " + deserialized);
+
+	if (!serialized.equals(deserialized)) {
+	    System.err.println("serialization failed: " + classname);
+	    exit(1);
+	}
+	checkEquality(obj, newobj);
+    }
+
+    static void
+    performBeanTest(File file, String classname)
+    {
+	String methodName = "get" + classname;
+	Object obj = null;
+	Object newobj = null;
+	try {
+	    Method method = TestBean.class.getDeclaredMethod(methodName);
+	    obj = method.invoke(null);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1);
+	}
+
+	Class c = obj.getClass();
+	if (c.getConstructors().length == 0) {
+	    return;
+	}
+
+	System.out.println(classname + ":");
+	XMLEncoder encoder = getXMLEncoder(file);
+	String encoded = getString(obj);
+	System.out.println("  encoded: " + encoded);
+	encoder.writeObject(obj);
+	encoder.close();
+	XMLDecoder decoder = getXMLDecoder(file);
+	newobj = decoder.readObject();
+	String decoded = getString(newobj);
+	System.out.println("  decoded: " + decoded);
+	decoder.close();
+
+	if (!encoded.equals(decoded)) {
+	    System.err.println("bean persistence failed: " + classname);
+	    exit(1);
+	}
+	checkEquality(obj, newobj);
+    }
+
+    public static void
+    main(String[] args)
+    {
+	if ((args.length != 1) && (args.length != 2)) {
+	    System.err.println("usage: java TestBean < filename > " +
+		    "[ < classname > ]");
+	    exit(1);
+	}
+
+	String filename = args[0];
+	String classname = null;
+	if (args.length >= 2) {
+	    classname = args[1];
+	}
+
+	file = new File(filename);
+	try {
+	    if (!file.canRead()) {
+		try {
+		    file.createNewFile();
+		} catch (Exception e) {
+		    System.err.println("failed to create " + filename);
+		    exit(1);
+		}
+	    }
+	} catch (SecurityException e) {
+	    System.err.println("failed to open " + filename);
+	    exit(1);
+	}
+
+	String[] tests = (classname == null ? TESTS:
+		new String[] { classname });
+	try {
+	    for (int i = 0; i < tests.length; ++i) {
+		performSerializationTest(file, tests[i]);
+		performBeanTest(file, tests[i]);
+	    }
+	} catch (IOException e) {
+	    e.printStackTrace();
+	    exit(1);
+	} catch (ClassNotFoundException e) {
+	    e.printStackTrace();
+	    exit(1);
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestClose.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestClose.java
new file mode 100644
index 0000000..c7a9e89
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestClose.java
@@ -0,0 +1,90 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Regression for bug 6419880 close() hangs running consumer.
+ */
+public class TestClose {
+    public static void
+    main(String[] args)
+    {
+	Consumer consumer = new LocalConsumer();
+
+	try {
+	    consumer.open();
+	    consumer.compile("syscall:::entry { @[execname] = count(); } " +
+		    "tick-101ms { printa(@); }");
+	    consumer.enable();
+	    consumer.go();
+	    try {
+		Thread.currentThread().sleep(1000);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+		System.exit(1);
+	    }
+	    consumer.close();
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+
+	consumer = new LocalConsumer();
+
+	try {
+	    consumer.open();
+	    consumer.compile("syscall:::entry { @[execname] = count(); } " +
+		    "tick-101ms { printa(@); }");
+	    consumer.enable();
+	    consumer.go();
+	    try {
+		Thread.currentThread().sleep(1000);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+		System.exit(1);
+	    }
+	    try {
+		// Test new rule that close() is illegal while holding
+		// lock on consumer.
+		synchronized (consumer) {
+		    consumer.close();
+		}
+	    } catch (IllegalThreadStateException e) {
+		consumer.close();
+		System.out.println("Successful");
+		System.exit(0);
+	    }
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+	System.err.println("Failed");
+	System.exit(1);
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestDrop.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestDrop.java
new file mode 100644
index 0000000..b5ace25
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestDrop.java
@@ -0,0 +1,169 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+import java.util.*;
+import java.util.concurrent.atomic.*;
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Regression test for 6521523 aggregation drops can hang the Java
+ * DTrace API.
+ */
+public class TestDrop {
+    static final String PROGRAM =
+	    "fbt:genunix::entry { @[execname, pid] = count(); }";
+
+    static AtomicLong consumerThreadID = new AtomicLong();
+    static AtomicLong getAggregateThreadID = new AtomicLong();
+    static AtomicBoolean done = new AtomicBoolean();
+    static int seconds;
+
+    private static void
+    startTimer()
+    {
+	if (seconds <= 0) {
+	    return;
+	}
+
+	final Timer timer = new Timer();
+	timer.schedule(new TimerTask() {
+	    public void run() {
+		done.set(true);
+		timer.cancel();
+	    }
+	}, seconds * 1000L);
+    }
+
+    private static void
+    sampleAggregate(Consumer consumer) throws DTraceException
+    {
+	while (consumer.isRunning() && !done.get()) {
+	    try {
+		Thread.currentThread().sleep(50);
+	    } catch (InterruptedException e) {
+	    }
+
+	    consumer.getAggregate(Collections. <String> emptySet());
+	}
+    }
+
+    private static void
+    startAggregateThread(final Consumer consumer)
+    {
+	Runnable aggregateSampler = new Runnable() {
+	    public void run() {
+		Thread t = Thread.currentThread();
+		getAggregateThreadID.set(t.getId());
+		Throwable x = null;
+		try {
+		    sampleAggregate(consumer);
+		} catch (Throwable e) {
+		    x = e;
+		}
+
+		if (Thread.holdsLock(LocalConsumer.class)) {
+		    if (x != null) {
+			x.printStackTrace();
+		    }
+		    System.out.println("Lock held");
+		    System.exit(1);
+		} else {
+		    System.out.println("Lock released");
+		    consumer.close(); // blocks if lock held
+		}
+	    }
+	};
+
+	Thread t = new Thread(aggregateSampler, "Aggregate Sampler");
+	t.start();
+    }
+
+    static void
+    usage()
+    {
+	System.err.println("usage: java TestDrop [ seconds ]");
+	System.exit(2);
+    }
+
+    public static void
+    main(String[] args)
+    {
+	if (args.length == 1) {
+	    try {
+		seconds = Integer.parseInt(args[0]);
+	    } catch (NumberFormatException e) {
+		usage();
+	    }
+	} else if (args.length > 1) {
+	    usage();
+	}
+
+	final Consumer consumer = new LocalConsumer() {
+	    protected Thread createThread() {
+		Runnable worker = new Runnable() {
+		    public void run() {
+			Thread t = Thread.currentThread();
+			consumerThreadID.set(t.getId());
+			work();
+		    }
+		};
+		Thread t = new Thread(worker);
+		return t;
+	    }
+	};
+
+	consumer.addConsumerListener(new ConsumerAdapter() {
+	    public void consumerStarted(ConsumerEvent e) {
+		startAggregateThread(consumer);
+		startTimer();
+	    }
+	    public void dataDropped(DropEvent e) throws ConsumerException {
+		Thread t = Thread.currentThread();
+		if (t.getId() == getAggregateThreadID.get()) {
+		    Drop drop = e.getDrop();
+		    throw new ConsumerException(drop.getDefaultMessage(),
+			    drop);
+		}
+	    }
+	});
+
+	try {
+	    consumer.open();
+	    consumer.setOption(Option.aggsize, Option.kb(1));
+	    consumer.setOption(Option.aggrate, Option.millis(101));
+	    consumer.compile(PROGRAM);
+	    consumer.enable();
+	    consumer.go(new ExceptionHandler() {
+		public void handleException(Throwable e) {
+		    e.printStackTrace();
+		}
+	    });
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestEnable.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestEnable.java
new file mode 100644
index 0000000..0e5a608
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestEnable.java
@@ -0,0 +1,151 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Prove that enable() handles multiple programs, recognizing programs
+ * that are already enabled and programs that were compiled by another
+ * consumer.
+ */
+public class TestEnable {
+    static void
+    exit(int status)
+    {
+	System.out.flush();
+	System.err.flush();
+	System.exit(status);
+    }
+
+    public static void
+    main(String[] args)
+    {
+	Consumer consumer = new LocalConsumer();
+
+	try {
+	    consumer.open();
+	    Program p0 = consumer.compile("dtrace:::BEGIN");
+	    Program p1 = consumer.compile("syscall:::entry");
+	    Program p2 = consumer.compile("dtrace:::END");
+	    consumer.enable(p0);
+	    consumer.enable(p1);
+	    try {
+		consumer.go();
+		System.err.println("go() illegal, not all programs " +
+			"enabled (p0, p1)");
+		exit(1);
+	    } catch (IllegalStateException e) {
+		System.out.println(e);
+	    } catch (Exception e) {
+		e.printStackTrace();
+		exit(1);
+	    }
+	    try {
+		consumer.enable();
+		System.err.println("enable() illegal, some programs " +
+			"already enabled (p0, p1)");
+		exit(1);
+	    } catch (IllegalStateException e) {
+		System.out.println(e);
+	    } catch (Exception e) {
+		e.printStackTrace();
+		exit(1);
+	    }
+	    try {
+		consumer.enable(p0);
+		System.err.println("cannot enable a program that " +
+			"has already been enabled (p0)");
+		exit(1);
+	    } catch (IllegalStateException e) {
+		System.out.println(e);
+	    } catch (Exception e) {
+		e.printStackTrace();
+		exit(1);
+	    }
+	    consumer.enable(p2);
+	    Program p3 = consumer.compile("syscall:::return");
+	    try {
+		consumer.go();
+		System.err.println("go() illegal, not all programs " +
+			"enabled (p0, p1, p2)");
+		exit(1);
+	    } catch (IllegalStateException e) {
+		System.out.println(e);
+	    } catch (Exception e) {
+		e.printStackTrace();
+		exit(1);
+	    }
+	    try {
+		consumer.enable();
+		System.err.println("enable() illegal, some programs " +
+			"already enabled (p0, p1, p2)");
+		exit(1);
+	    } catch (IllegalStateException e) {
+		System.out.println(e);
+	    } catch (Exception e) {
+		e.printStackTrace();
+		exit(1);
+	    }
+	    // Try to fool the consumer with a program compiled by
+	    // another consumer
+	    Consumer consumer2 = new LocalConsumer();
+	    consumer2.open();
+	    Program p3x = consumer2.compile("syscall:::return");
+	    try {
+		consumer.enable(p3x);
+		System.err.println("cannot enable program compiled " +
+			"by another consumer");
+		exit(1);
+	    } catch (IllegalArgumentException e) {
+		System.out.println(e);
+	    } catch (Exception e) {
+		e.printStackTrace();
+		exit(1);
+	    } finally {
+		consumer2.close();
+	    }
+	    consumer.enable(p3);
+	    consumer.go();
+	    consumer.close();
+
+	    // Enable all compiled programs at once
+	    consumer = new LocalConsumer();
+	    consumer.open();
+	    consumer.compile("dtrace:::BEGIN");
+	    consumer.compile("syscall:::entry");
+	    consumer.compile("dtrace:::END");
+	    consumer.enable();
+	    consumer.go();
+	    consumer.close();
+	    exit(0);
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    exit(1);
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java
new file mode 100644
index 0000000..2bc43ea
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestFunctionLookup.java
@@ -0,0 +1,114 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Regression for bug 6413280 lookupKernelFunction() and
+ * lookupUserFunction() truncate last character.
+ */
+public class TestFunctionLookup {
+    static final String kernelLookupProgram = "sdt:::callout-start { " +
+           "@[((callout_t *)arg0)->c_func] = count(); }";
+    static final String userLookupProgram = "pid$target::f2:entry { " +
+           "@[arg0] = count(); }";
+
+    public static void
+    main(String[] args)
+    {
+	if (args.length != 1) {
+	    System.err.println("usage: java TestFunctionLookup <command>");
+	    System.exit(1);
+	}
+	String cmd = args[0];
+
+	Consumer consumer = new LocalConsumer();
+	try {
+	    consumer.open();
+	    consumer.compile(kernelLookupProgram);
+	    consumer.enable();
+	    consumer.go();
+	    Aggregate a;
+	    Number address;
+	    String f;
+	    boolean done = false;
+	    for (int i = 0; (i < 20) && !done; ++i) {
+		Thread.currentThread().sleep(100);
+		a = consumer.getAggregate();
+		for (Aggregation agg : a.getAggregations()) {
+		    for (Tuple tuple : agg.asMap().keySet()) {
+			address = (Number)tuple.get(0).getValue();
+			if (address instanceof Integer) {
+			    int addr = (Integer)address;
+			    f = consumer.lookupKernelFunction(addr);
+			} else {
+			    long addr = (Long)address;
+			    f = consumer.lookupKernelFunction(addr);
+			}
+			if (f.equals("genunix`cv_wakeup")) {
+			    System.out.println(f);
+			    done = true;
+			}
+		    }
+		}
+	    }
+	    consumer.close();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+
+	consumer = new LocalConsumer();
+	try {
+	    consumer.open();
+	    int pid = consumer.createProcess(cmd);
+	    consumer.compile(userLookupProgram);
+	    consumer.enable();
+	    consumer.go();
+	    Thread.currentThread().sleep(500);
+	    Aggregate a = consumer.getAggregate();
+	    Number address;
+	    String f;
+	    for (Aggregation agg : a.getAggregations()) {
+		for (Tuple tuple : agg.asMap().keySet()) {
+		    address = (Number)tuple.get(0).getValue();
+		    if (address instanceof Integer) {
+			int addr = (Integer)address;
+			f = consumer.lookupUserFunction(pid, addr);
+		    } else {
+			long addr = (Long)address;
+			f = consumer.lookupUserFunction(pid, addr);
+		    }
+		    System.out.println(f);
+		}
+	    }
+	    consumer.close();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java
new file mode 100644
index 0000000..e02df85
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestGetAggregate.java
@@ -0,0 +1,252 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+import org.opensolaris.os.dtrace.*;
+import java.util.*;
+
+/**
+ * Assert getAggregate() can explicitly specify the anonymous aggregation.
+ */
+public class TestGetAggregate {
+    static final String programString =
+	    "profile:::tick-50ms" +
+	    "{" +
+	    "        @ = count();" +
+	    "        @a = count();" +
+	    "}";
+
+    static final String ANONYMOUS_AGGREGATION = "";
+    static final int TICK = 50;
+    static final int EXPECTED_TICKS = 3;
+    static final int INTERVALS = 4;
+
+    static void
+    testIncluded(Consumer consumer, String ... aggregationNames)
+	    throws DTraceException, InterruptedException
+    {
+	Aggregate aggregate;
+	Set <String> included = new HashSet <String> ();
+	int n = 1;
+
+	for (String name : aggregationNames) {
+	    included.add(name);
+	}
+
+	// Wait up to a full second to obtain aggregate data. Without a
+	// time limit, we'll loop forever if no aggregation was
+	// successfully included.
+	do {
+	    Thread.sleep(TICK);
+	    aggregate = consumer.getAggregate(included, null);
+	} while (aggregate.asMap().isEmpty() && n++ < (1000 / TICK));
+
+	for (String name : included) {
+	    if (aggregate.getAggregation(name) == null) {
+		throw new IllegalStateException("@" + name +
+			" was explicitly included but did not appear " +
+			"in the aggregate");
+	    }
+	}
+	for (Aggregation a : aggregate.getAggregations()) {
+	    if (!included.contains(a.getName())) {
+		throw new IllegalStateException("@" + a.getName() +
+			" was not explicitly included but appeared " +
+			"in the aggregate anyway");
+	    }
+	}
+
+	if (!consumer.isRunning()) {
+	    throw new IllegalStateException("consumer exited");
+	}
+    }
+
+    static void
+    testCleared(Consumer consumer, String ... aggregationNames)
+	    throws DTraceException, InterruptedException
+    {
+	Aggregate aggregate;
+	AggregationRecord rec;
+	long value;
+	Long firstValue;
+	int n = 1;
+	Map <String, Long> firstValues = new HashMap <String, Long> ();
+	Set <String> cleared = new HashSet <String> ();
+
+	for (String name : aggregationNames) {
+	    cleared.add(name);
+	}
+
+	do {
+	    Thread.sleep(TICK);
+	    aggregate = consumer.getAggregate(null, cleared);
+	} while (aggregate.asMap().isEmpty() && n++ < (1000 / TICK));
+	n = 1;
+
+	do {
+	    Thread.sleep(TICK * EXPECTED_TICKS);
+	    aggregate = consumer.getAggregate(null, cleared);
+
+	    for (Aggregation a : aggregate.getAggregations()) {
+		if (!firstValues.containsKey(a.getName())) {
+		    rec = a.getRecord(Tuple.EMPTY);
+		    value = rec.getValue().getValue().longValue();
+		    firstValues.put(a.getName(), value);
+		}
+	    }
+	} while (consumer.isRunning() && n++ < INTERVALS);
+
+	for (Aggregation a : aggregate.getAggregations()) {
+	    rec = a.getRecord(Tuple.EMPTY);
+	    value = rec.getValue().getValue().longValue();
+	    firstValue = firstValues.get(a.getName());
+
+	    if (cleared.contains(a.getName())) {
+		// last value should be about the same as first value
+		if (value > (firstValue * 2)) {
+		    throw new IllegalStateException(
+			    "@" + a.getName() + " should have " +
+			    "been cleared but instead grew from " +
+			    firstValue + " to " + value);
+		}
+	    } else {
+		// last value should be about (INTERVALS * firstValue)
+		if (value < (firstValue * 2)) {
+		    throw new IllegalStateException(
+			    "@" + a.getName() + " should have " +
+			    "accumulated a running total but " +
+			    "instead went from " +
+			    firstValue + " to " + value);
+		}
+	    }
+	}
+
+	if (!consumer.isRunning()) {
+	    throw new IllegalStateException("consumer exited");
+	}
+    }
+
+    static Integer includedStatus;
+    static Integer clearedStatus;
+
+    static void
+    startIncludedTest()
+    {
+	final Consumer consumer = new LocalConsumer();
+	consumer.addConsumerListener(new ConsumerAdapter() {
+	    public void consumerStarted(ConsumerEvent e) {
+		new Thread(new Runnable() {
+		    public void run() {
+			try {
+			    testIncluded(consumer, ANONYMOUS_AGGREGATION);
+			    includedStatus = 0;
+			} catch (Exception e) {
+			    includedStatus = 1;
+			    e.printStackTrace();
+			} finally {
+			    consumer.abort();
+			}
+		    }
+		}).start();
+	    }
+	});
+
+	try {
+	    consumer.open();
+	    consumer.setOption(Option.aggrate, Option.millis(TICK));
+	    consumer.compile(programString);
+	    consumer.enable();
+	    consumer.go();
+	} catch (Exception e) {
+	    includedStatus = 1;
+	    e.printStackTrace();
+	}
+    }
+
+    static void
+    startClearedTest()
+    {
+	final Consumer consumer = new LocalConsumer();
+	consumer.addConsumerListener(new ConsumerAdapter() {
+	    public void consumerStarted(ConsumerEvent e) {
+		new Thread(new Runnable() {
+		    public void run() {
+			try {
+			    testCleared(consumer, ANONYMOUS_AGGREGATION);
+			    clearedStatus = 0;
+			} catch (Exception e) {
+			    clearedStatus = 1;
+			    e.printStackTrace();
+			} finally {
+			    consumer.abort();
+			}
+		    }
+		}).start();
+	    }
+	});
+
+	try {
+	    consumer.open();
+	    consumer.setOption(Option.aggrate, Option.millis(TICK));
+	    consumer.compile(programString);
+	    consumer.enable();
+	    consumer.go();
+	} catch (Exception e) {
+	    clearedStatus = 1;
+	    e.printStackTrace();
+	}
+    }
+
+    public static void
+    main(String[] args)
+    {
+	startIncludedTest();
+
+	do {
+	    try {
+		Thread.sleep(TICK);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+	    }
+	} while (includedStatus == null);
+
+	startClearedTest();
+
+	do {
+	    try {
+		Thread.sleep(TICK);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+	    }
+	} while (clearedStatus == null);
+
+	if (includedStatus != 0 || clearedStatus != 0) {
+	    System.out.println("Failure");
+	    System.exit(1);
+	}
+
+	System.out.println("Success");
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestMaxConsumers.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestMaxConsumers.java
new file mode 100644
index 0000000..50eeac2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestMaxConsumers.java
@@ -0,0 +1,97 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Regression for 6506495 -DJAVA_DTRACE_MAX_CONSUMERS=N for any N < 8
+ * is treated as if it were 8.
+ */
+public class TestMaxConsumers {
+    static final String MAX_CONSUMERS_PROPERTY_NAME =
+	    "JAVA_DTRACE_MAX_CONSUMERS";
+
+    static Integer
+    getIntegerProperty(String name)
+    {
+	Integer value = null;
+	String property = System.getProperty(name);
+	if (property != null && property.length() != 0) {
+	    try {
+		value = Integer.parseInt(property);
+	    } catch (NumberFormatException e) {
+		e.printStackTrace();
+	    }
+	}
+	return value;
+    }
+
+    public static void
+    main(String[] args)
+    {
+	Integer property = getIntegerProperty(MAX_CONSUMERS_PROPERTY_NAME);
+	int max = (property == null ? 0 : property);
+	int n = (property == null ? 11 : (max < 1 ? 1 : max));
+
+	Consumer[] consumers = new Consumer[n];
+	try {
+	    for (int i = 0; i < n; ++i) {
+		consumers[i] = new LocalConsumer();
+		consumers[i].open();
+	    }
+	    for (int i = 0; i < n; ++i) {
+		consumers[i].close();
+	    }
+	    for (int i = 0; i < n; ++i) {
+		consumers[i] = new LocalConsumer();
+		consumers[i].open();
+	    }
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+
+	try {
+	    Consumer consumer = new LocalConsumer();
+	    consumer.open();
+	    if (max > 0) {
+		System.out.println("Error: " + (max + 1) + " > " +
+			MAX_CONSUMERS_PROPERTY_NAME);
+	    } else {
+		System.out.println("Success");
+	    }
+	    consumer.close();
+	} catch (Exception e) {
+	    System.out.println("Success");
+	} finally {
+	    for (int i = 0; i < n; ++i) {
+		consumers[i].close();
+	    }
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestMultiAggPrinta.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestMultiAggPrinta.java
new file mode 100644
index 0000000..facdf7f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestMultiAggPrinta.java
@@ -0,0 +1,144 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Regression for multi-aggregation printa() corner cases.
+ */
+public class TestMultiAggPrinta {
+    static int exitStatus;
+
+    // Gets a string representation of the given PrintaRecord minus the
+    // timestamp of the aggregate snapshot, so that the output is
+    // comparable across multiple test runs.
+    static String
+    printaRecordString(PrintaRecord rec)
+    {
+	StringBuffer buf = new StringBuffer();
+	buf.append(PrintaRecord.class.getName());
+	buf.append("[aggregations = ");
+	buf.append(rec.getAggregations());
+	buf.append(", formattedStrings = ");
+	buf.append(rec.getFormattedStrings());
+	buf.append(", tuples = ");
+	buf.append(rec.getTuples());
+	buf.append(", output = ");
+	buf.append(rec.getOutput());
+	buf.append(']');
+	return buf.toString();
+    }
+
+    static String
+    probeDataString(ProbeData data)
+    {
+	StringBuffer buf = new StringBuffer();
+	buf.append(ProbeData.class.getName());
+	buf.append("[epid = ");
+	buf.append(data.getEnabledProbeID());
+	// Do not include cpu, since it can change across test runs
+	buf.append(", enabledProbeDescription = ");
+	buf.append(data.getEnabledProbeDescription());
+	buf.append(", flow = ");
+	buf.append(data.getFlow());
+	buf.append(", records = ");
+
+	List <Record> records = data.getRecords();
+	Record record;
+	Object value;
+	buf.append('[');
+	for (int i = 0; i < records.size(); ++i) {
+	    if (i > 0) {
+		buf.append(", ");
+	    }
+	    record = records.get(i);
+	    if (record instanceof ValueRecord) {
+		value = ((ValueRecord)record).getValue();
+		if (value instanceof String) {
+		    buf.append("\"");
+		    buf.append((String)value);
+		    buf.append("\"");
+		} else {
+		    buf.append(record);
+		}
+	    } else if (record instanceof PrintaRecord) {
+		PrintaRecord printa = (PrintaRecord)record;
+		buf.append(printaRecordString(printa));
+	    } else {
+		buf.append(record);
+	    }
+	}
+	buf.append(']');
+	return buf.toString();
+    }
+
+    public static void
+    main(String[] args)
+    {
+	if (args.length != 1) {
+	    System.err.println("usage: java TestMultiAggPrinta <script>");
+	    System.exit(2);
+	}
+
+	final Consumer consumer = new LocalConsumer();
+	consumer.addConsumerListener(new ConsumerAdapter() {
+	    public void dataReceived(DataEvent e) {
+		ProbeData data = e.getProbeData();
+		List <Record> records = data.getRecords();
+		for (Record r : records) {
+		    if (r instanceof ExitRecord) {
+			ExitRecord exitRecord = (ExitRecord)r;
+			exitStatus = exitRecord.getStatus();
+		    }
+		}
+		System.out.println(probeDataString(e.getProbeData()));
+	    }
+	    public void consumerStopped(ConsumerEvent e) {
+		consumer.close();
+		System.exit(exitStatus);
+	    }
+	});
+
+	File file = new File(args[0]);
+	try {
+	    consumer.open();
+	    consumer.compile(file);
+	    consumer.enable();
+	    consumer.go();
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	} catch (IOException e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestProbeData.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestProbeData.java
new file mode 100644
index 0000000..78a65f9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestProbeData.java
@@ -0,0 +1,110 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import java.util.*;
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Regression test verifies that ProbeData instances sort as expected
+ * with multiple enabled probe IDs and multiple records including byte
+ * array (sorted as unsigned bytes), stand-alone ufunc() action, and
+ * signed integer.
+ */
+public class TestProbeData {
+    public static final String PROGRAM =
+	    "pid$target::fN:entry\n" +
+	    "{\n" +
+	    "        tracemem(copyin(arg1, 6), 6);\n" +
+	    "        ufunc(arg0);\n" +
+	    "        trace((int)arg2);\n" +
+	    "}" +
+	    "" +
+	    "pid$target::fN2:entry\n" +
+	    "{\n" +
+	    "        tracemem(copyin(arg1, 6), 6);\n" +
+	    "        ufunc(arg0);\n" +
+	    "        trace((int)arg2);\n" +
+	    "}";
+
+    static String
+    getString(ProbeData p)
+    {
+	StringBuilder buf = new StringBuilder();
+	buf.append("[probe ");
+	buf.append(p.getEnabledProbeID());
+	buf.append(' ');
+	ProbeDescription d = p.getEnabledProbeDescription();
+	buf.append("pid$target");
+	buf.append(':');
+	buf.append(d.getModule());
+	buf.append(':');
+	buf.append(d.getFunction());
+	buf.append(':');
+	buf.append(d.getName());
+	buf.append(' ');
+	buf.append(p.getRecords());
+	buf.append("]");
+	return buf.toString();
+    }
+
+    public static void
+    main(String[] args)
+    {
+	if (args.length != 1) {
+	    System.err.println("usage: java TestProbedata <command>");
+	    System.exit(2);
+	}
+
+	String command = args[0];
+	final Consumer consumer = new LocalConsumer();
+	final List <ProbeData> list = new ArrayList <ProbeData> ();
+	consumer.addConsumerListener(new ConsumerAdapter() {
+	    public void dataReceived(DataEvent e) {
+		list.add(e.getProbeData());
+	    }
+	    public void consumerStopped(ConsumerEvent e) {
+		Collections.sort(list);
+		for (ProbeData p : list) {
+		    System.out.println(getString(p));
+		    System.out.println();
+		}
+		consumer.close();
+	    }
+	});
+
+	try {
+	    consumer.open();
+	    consumer.createProcess(command);
+	    consumer.compile(PROGRAM);
+	    consumer.enable();
+	    consumer.go();
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestProbeDescription.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestProbeDescription.java
new file mode 100644
index 0000000..b9e9570
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestProbeDescription.java
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import org.opensolaris.os.dtrace.*;
+import java.util.logging.*;
+
+/**
+ * Regression for 6399915 ProbeDescription single arg constructor should
+ * parse probe descriptions.
+ */
+public class TestProbeDescription {
+    public static void
+    main(String[] args)
+    {
+	ProbeDescription p = null;
+	int len = args.length;
+	if (len == 0) {
+	    p = new ProbeDescription("syscall:::entry");
+	} else if (len == 1) {
+	    p = new ProbeDescription(args[0]);
+	} else if (len == 2) {
+	    p = new ProbeDescription(args[0], args[1]);
+	} else if (len == 3) {
+	    p = new ProbeDescription(args[0], args[1], args[2]);
+	} else if (len == 4) {
+	    p = new ProbeDescription(args[0], args[1], args[2], args[3]);
+	}
+	System.out.println(p);
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestStateMachine.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestStateMachine.java
new file mode 100644
index 0000000..8875d06
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestStateMachine.java
@@ -0,0 +1,627 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Regression test for the LocalConsumer state machine.  Calls Consumer
+ * methods before and after open(), compile(), enable(), go(), stop(),
+ * and close() to verify that the calls succeed as expected or fail with
+ * the expected Java exception.
+ */
+public class TestStateMachine {
+    static Program program;
+
+    static void
+    exit(int status)
+    {
+	exit(status, null);
+    }
+
+    static void
+    exit(int status, String msg)
+    {
+	if (msg != null) {
+	    System.out.println(msg);
+	}
+	System.out.flush();
+	System.err.flush();
+	System.exit(status);
+    }
+
+    static void
+    printState(Consumer consumer)
+    {
+	System.out.println("open: " + consumer.isOpen());
+	System.out.println("enabled: " + consumer.isEnabled());
+	System.out.println("closed: " + consumer.isClosed());
+    }
+
+    static void
+    beforeOpen(Consumer consumer)
+    {
+	System.out.println("before open");
+	printState(consumer);
+
+	// compile
+	try {
+	    consumer.compile("syscall:::entry");
+	    exit(1, "compile before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "compile before open");
+	}
+
+	// enable
+	try {
+	    consumer.enable();
+	    exit(1, "enable before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "enable before open");
+	}
+
+	// getOption, setOption, unsetOption
+	try {
+	    consumer.getOption(Option.bufsize);
+	    exit(1, "getOption before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getOption before open");
+	}
+	try {
+	    consumer.setOption(Option.bufsize, Option.mb(1));
+	    exit(1, "setOption before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "setOption before open");
+	}
+	try {
+	    consumer.unsetOption(Option.quiet);
+	    exit(1, "unsetOption before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "unsetOption before open");
+	}
+
+	// createProcess, grabProcess
+	try {
+	    consumer.createProcess("date");
+	    exit(1, "createProcess before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "createProcess before open");
+	}
+	try {
+	    consumer.grabProcess(1);
+	    exit(1, "grabProcess before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "grabProcess before open");
+	}
+
+	// listProbes
+	try {
+	    consumer.listProbes(ProbeDescription.EMPTY);
+	    exit(1, "listProbes before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "listProbes before open");
+	}
+
+	// getAggregate
+	try {
+	    consumer.getAggregate();
+	    exit(1, "getAggregate before open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getAggregate before open");
+	}
+
+	// getVersion
+	try {
+	    consumer.getVersion(); // allowed
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getVersion before open");
+	}
+    }
+
+    static void
+    beforeCompile(Consumer consumer)
+    {
+	System.out.println("before compile");
+	printState(consumer);
+
+	// open
+	try {
+	    consumer.open();
+	    exit(1, "open after open");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "open after open");
+	}
+
+	// enable
+	try {
+	    consumer.enable();
+	    exit(1, "enable before compile");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "enable before compile");
+	}
+    }
+
+    static void
+    beforeEnable(Consumer consumer)
+    {
+	System.out.println("before enable");
+	printState(consumer);
+
+	// go
+	try {
+	    consumer.go();
+	    exit(1, "go before enable");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "go before enable");
+	}
+    }
+
+    static void
+    beforeGo(Consumer consumer)
+    {
+	System.out.println("before go");
+	printState(consumer);
+
+	// getAggregate
+	try {
+	    consumer.getAggregate();
+	    exit(1, "getAggregate before go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getAggregate before go");
+	}
+
+	// lookupKernelFunction, lookupUserFunction
+	try {
+	    consumer.lookupKernelFunction(1);
+	    exit(1, "lookupKernelFunction before go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "lookupKernelFunction before go");
+	}
+	try {
+	    consumer.lookupUserFunction(1, 1);
+	    exit(1, "lookupUserFunction before go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "lookupUserFunction before go");
+	}
+
+	// stop
+	try {
+	    consumer.stop();
+	    exit(1, "stop before go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "stop before go");
+	}
+    }
+
+    static void
+    afterGo(Consumer consumer, Program program)
+    {
+	System.out.println("after go");
+	printState(consumer);
+
+	// go
+	try {
+	    consumer.go();
+	    exit(1, "go after go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "go after go");
+	}
+
+	// createProcess, grabProcess
+	try {
+	    consumer.createProcess("date");
+	    exit(1, "createProcess after go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "createProcess after go");
+	}
+	try {
+	    consumer.grabProcess(1);
+	    exit(1, "grabProcess after go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "grabProcess after go");
+	}
+
+	// listProbes
+	try {
+	    consumer.listProbes(ProbeDescription.EMPTY);
+	    exit(1, "listProbes after go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "listProbes after go");
+	}
+
+	// compile
+	try {
+	    consumer.compile("syscall:::entry");
+	    exit(1, "compile after go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "compile after go");
+	}
+
+	// enable
+	try {
+	    consumer.enable();
+	    exit(1, "enable after go");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "enable after go");
+	}
+
+	// getAggregate
+	try {
+	    consumer.getAggregate();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getAggregate after go");
+	}
+
+	// getProgramInfo
+	try {
+	    consumer.getProgramInfo(program);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getProgramInfo after go");
+	}
+
+	// getOption, setOption, unsetOption
+	try {
+	    consumer.getOption(Option.quiet);
+	    consumer.setOption(Option.quiet);
+	    consumer.unsetOption(Option.quiet);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "get, set, unset option after go");
+	}
+    }
+
+    static void
+    afterStop(Consumer consumer, Program program)
+    {
+	System.out.println("after stop");
+	printState(consumer);
+
+	// stop
+	try {
+	    consumer.stop();
+	    exit(1, "stop after stop");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "stop after stop");
+	}
+
+	// getAggregate
+	try {
+	    consumer.getAggregate();
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getAggregate after stop");
+	}
+
+	// getProgramInfo
+	try {
+	    consumer.getProgramInfo(program);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getProgramInfo after stop");
+	}
+
+	// getOption, setOption, unsetOption
+	try {
+	    consumer.getOption(Option.quiet);
+	    consumer.setOption(Option.quiet);
+	    consumer.unsetOption(Option.quiet);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "get, set, unset option after stop");
+	}
+    }
+
+    static void
+    afterClose(Consumer consumer, Program program)
+    {
+	System.out.println("after close");
+	printState(consumer);
+
+	// open
+	try {
+	    consumer.open();
+	    exit(1, "open after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "open after close");
+	}
+
+	// compile
+	try {
+	    consumer.compile("syscall:::entry");
+	    exit(1, "compile after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "compile after close");
+	}
+
+	// enable
+	try {
+	    consumer.enable();
+	    exit(1, "enable after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "enable after close");
+	}
+
+	// getOption, setOption, unsetOption
+	try {
+	    consumer.getOption(Option.bufsize);
+	    exit(1, "getOption after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getOption after close");
+	}
+	try {
+	    consumer.setOption(Option.bufsize, Option.mb(1));
+	    exit(1, "setOption after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "setOption after close");
+	}
+	try {
+	    consumer.unsetOption(Option.quiet);
+	    exit(1, "unsetOption after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "unsetOption after close");
+	}
+
+	// createProcess, grabProcess
+	try {
+	    consumer.createProcess("date");
+	    exit(1, "createProcess after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "createProcess after close");
+	}
+	try {
+	    consumer.grabProcess(1);
+	    exit(1, "grabProcess after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "grabProcess after close");
+	}
+
+	// listProbes
+	try {
+	    consumer.listProbes(ProbeDescription.EMPTY);
+	    exit(1, "listProbes after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "listProbes after close");
+	}
+
+	// getAggregate
+	try {
+	    consumer.getAggregate();
+	    exit(1, "getAggregate after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getAggregate after close");
+	}
+
+	// getVersion
+	try {
+	    consumer.getVersion(); // allowed
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getVersion after close");
+	}
+
+	// go
+	try {
+	    consumer.go();
+	    exit(1, "go after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "go after close");
+	}
+
+	// lookupKernelFunction, lookupUserFunction
+	try {
+	    consumer.lookupKernelFunction(1);
+	    exit(1, "lookupKernelFunction after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "lookupKernelFunction after close");
+	}
+	try {
+	    consumer.lookupUserFunction(1, 1);
+	    exit(1, "lookupUserFunction after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "lookupUserFunction after close");
+	}
+
+	// stop
+	try {
+	    consumer.stop();
+	    exit(1, "stop after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "stop after close");
+	}
+
+	// getProgramInfo
+	try {
+	    consumer.getProgramInfo(program);
+	    exit(1, "getProgramInfo after close");
+	} catch (IllegalStateException e) {
+	    System.out.println(e);
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    exit(1, "getProgramInfo after close");
+	}
+    }
+
+    public static void
+    main(String[] args)
+    {
+	final Consumer consumer = new LocalConsumer();
+	consumer.addConsumerListener(new ConsumerAdapter() {
+	    public void consumerStarted(ConsumerEvent e) {
+		System.out.println("consumerStarted, running: " +
+			consumer.isRunning());
+		afterGo(consumer, program);
+	    }
+	    public void consumerStopped(ConsumerEvent e) {
+		System.out.println("consumerStopped, running: " +
+			consumer.isRunning());
+	    }
+	});
+
+	try {
+	    beforeOpen(consumer);
+	    consumer.open();
+	    beforeCompile(consumer);
+	    program = consumer.compile(
+		    "syscall:::entry { @[execname] = count(); } " +
+		    "tick-101ms { printa(@); }");
+	    beforeEnable(consumer);
+	    consumer.enable();
+	    beforeGo(consumer);
+	    System.out.println("before go, running: " + consumer.isRunning());
+	    consumer.go();
+	    // Avoid race, call afterGo() in ConsumerListener
+	    try {
+		Thread.currentThread().sleep(300);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+		exit(1);
+	    }
+	    consumer.stop();
+	    System.out.println("after stop, running: " + consumer.isRunning());
+	    afterStop(consumer, program);
+	    consumer.close();
+	    afterClose(consumer, program);
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    exit(1);
+	}
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestStopLock.java b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestStopLock.java
new file mode 100644
index 0000000..f37c9cf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/src/TestStopLock.java
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ *
+ * ident	"%Z%%M%	%I%	%E% SMI"
+ */
+
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Test for bug 6399888 stop() hangs if ConsumerListener calls
+ * synchronized Consumer method
+ */
+public class TestStopLock {
+    public static void
+    main(String[] args)
+    {
+	final Consumer consumer = new LocalConsumer();
+	consumer.addConsumerListener(new ConsumerAdapter() {
+	    @Override
+	    public void intervalBegan(ConsumerEvent e) {
+		consumer.isRunning();
+	    }
+	});
+
+	try {
+	    consumer.open();
+	    consumer.compile("syscall:::entry { @[execname] = count(); } " +
+		    "tick-101ms { printa(@); }");
+	    consumer.enable();
+	    consumer.go();
+	    try {
+		Thread.currentThread().sleep(500);
+	    } catch (InterruptedException e) {
+		e.printStackTrace();
+		System.exit(1);
+	    }
+	    consumer.stop();
+	    consumer.close();
+	} catch (DTraceException e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+	System.out.println("Successful");
+    }
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Abort.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Abort.ksh
new file mode 100755
index 0000000..85c2c70
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Abort.ksh
@@ -0,0 +1,39 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Fixed bug 6426129 abort() after close() throws
+#	NoSuchElementException.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestAbort
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Abort.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Abort.ksh.out
new file mode 100644
index 0000000..628d787
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Abort.ksh.out
@@ -0,0 +1 @@
+Successful
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Bean.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Bean.ksh
new file mode 100755
index 0000000..99b232e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Bean.ksh
@@ -0,0 +1,41 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	All Serializable classes can be serializaed and deserialized,
+#	also encoded in XML and decoded, and still remain equal and have
+#	equal string values.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestBean TestBean.out
+rm -f TestBean.out
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Bean.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Bean.ksh.out
new file mode 100644
index 0000000..cf24c67
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Bean.ksh.out
@@ -0,0 +1,722 @@
+ExitRecord:
+  serialized: 1
+  deserialized: 1
+ExitRecord:
+  encoded: 1
+  decoded: 1
+AggregationRecord:
+  serialized: org.opensolaris.os.dtrace.AggregationRecord[tuple = [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]
+  deserialized: org.opensolaris.os.dtrace.AggregationRecord[tuple = [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]
+AggregationRecord:
+  encoded: org.opensolaris.os.dtrace.AggregationRecord[tuple = [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]
+  decoded: org.opensolaris.os.dtrace.AggregationRecord[tuple = [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]
+Aggregation:
+  serialized: org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]
+  deserialized: org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]
+Aggregation:
+  encoded: org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]
+  decoded: org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]
+Tuple:
+  serialized: [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]
+  deserialized: [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]
+Tuple:
+  encoded: [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]
+  decoded: [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]
+ScalarRecord:
+  serialized: [1, 2, 3]
+  deserialized: [1, 2, 3]
+ScalarRecord:
+  encoded: [1, 2, 3]
+  decoded: [1, 2, 3]
+KernelStackRecord:
+  serialized: 
+              Frame 1
+              Frame 2
+              Frame 3
+
+  deserialized: 
+              Frame 1
+              Frame 2
+              Frame 3
+
+KernelStackRecord:
+  encoded: 
+              Frame 1
+              Frame 2
+              Frame 3
+
+  decoded: 
+              Frame 1
+              Frame 2
+              Frame 3
+
+LogDistribution:
+  serialized: org.opensolaris.os.dtrace.Distribution[buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = -4611686018427387904, max = -2305843009213693953, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = -2305843009213693952, max = -1152921504606846977, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = -1152921504606846976, max = -576460752303423489, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = -576460752303423488, ma [...]
+  deserialized: org.opensolaris.os.dtrace.Distribution[buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = -4611686018427387904, max = -2305843009213693953, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = -2305843009213693952, max = -1152921504606846977, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = -1152921504606846976, max = -576460752303423489, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = -576460752303423488,  [...]
+LogDistribution:
+  encoded: org.opensolaris.os.dtrace.Distribution[buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = -4611686018427387904, max = -2305843009213693953, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = -2305843009213693952, max = -1152921504606846977, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = -1152921504606846976, max = -576460752303423489, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = -576460752303423488, max = [...]
+  decoded: org.opensolaris.os.dtrace.Distribution[buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = -4611686018427387904, max = -2305843009213693953, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = -2305843009213693952, max = -1152921504606846977, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = -1152921504606846976, max = -576460752303423489, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = -576460752303423488, max = [...]
+LinearDistribution:
+  serialized: class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = 50, fr [...]
+  deserialized: class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = 50,  [...]
+LinearDistribution:
+  encoded: class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = 50, frequ [...]
+  decoded: class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = 50, frequ [...]
+Option:
+  serialized: org.opensolaris.os.dtrace.Option[name = aggrate, value = 1s]
+  deserialized: org.opensolaris.os.dtrace.Option[name = aggrate, value = 1s]
+Option:
+  encoded: org.opensolaris.os.dtrace.Option[name = aggrate, value = 1s]
+  decoded: org.opensolaris.os.dtrace.Option[name = aggrate, value = 1s]
+ProcessState:
+  serialized: org.opensolaris.os.dtrace.ProcessState[pid = 123456, state = UNDEAD, terminationSignal = 3, terminationSignalName = SIGSTOP, exitStatus = -2, message = Process stopped on dime]
+  deserialized: org.opensolaris.os.dtrace.ProcessState[pid = 123456, state = UNDEAD, terminationSignal = 3, terminationSignalName = SIGSTOP, exitStatus = -2, message = Process stopped on dime]
+ProcessState:
+  encoded: org.opensolaris.os.dtrace.ProcessState[pid = 123456, state = UNDEAD, terminationSignal = 3, terminationSignalName = SIGSTOP, exitStatus = -2, message = Process stopped on dime]
+  decoded: org.opensolaris.os.dtrace.ProcessState[pid = 123456, state = UNDEAD, terminationSignal = 3, terminationSignalName = SIGSTOP, exitStatus = -2, message = Process stopped on dime]
+ProbeDescription:
+  serialized: syscall::malloc:entry
+  deserialized: syscall::malloc:entry
+ProbeDescription:
+  encoded: syscall::malloc:entry
+  decoded: syscall::malloc:entry
+PrintaRecord:
+  serialized: org.opensolaris.os.dtrace.PrintaRecord[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]], formattedStrings = {[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!]=cat, [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]=cat}, tuples = [[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]], output = Yes, this is the formatted printa() output]
+  deserialized: org.opensolaris.os.dtrace.PrintaRecord[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]], formattedStrings = {[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!]=cat, [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]=cat}, tuples = [[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]], output = Yes, this is the formatted printa() output]
+PrintaRecord:
+  encoded: org.opensolaris.os.dtrace.PrintaRecord[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]], formattedStrings = {[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!]=cat, [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]=cat}, tuples = [[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]], output = Yes, this is the formatted printa() output]
+  decoded: org.opensolaris.os.dtrace.PrintaRecord[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]], formattedStrings = {[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!]=cat, [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]=cat}, tuples = [[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]], output = Yes, this is the formatted printa() output]
+PrintfRecord:
+  serialized: long formatted string
+  deserialized: long formatted string
+PrintfRecord:
+  encoded: long formatted string
+  decoded: long formatted string
+ProbeData:
+  serialized: org.opensolaris.os.dtrace.ProbeData[epid = 7, cpu = 1, enabledProbeDescription = syscall::malloc:entry, flow = org.opensolaris.os.dtrace.Flow[kind = RETURN, depth = 3], records = [org.opensolaris.os.dtrace.PrintaRecord[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]], formattedStrings = {[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!]=cat, [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]=cat}, tuples = [[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]], output = Yes, this is the formatted printa() output], long formatted string, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, mod`func+0x4, 
+              process ID: 123456
+              User Stack Frame 1
+              User Stack Frame 2
+              User Stack Frame 3
+, 1]]
+  deserialized: org.opensolaris.os.dtrace.ProbeData[epid = 7, cpu = 1, enabledProbeDescription = syscall::malloc:entry, flow = org.opensolaris.os.dtrace.Flow[kind = RETURN, depth = 3], records = [org.opensolaris.os.dtrace.PrintaRecord[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]], formattedStrings = {[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!]=cat, [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]=cat}, tuples = [[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]], output = Yes, this is the formatted printa() output], long formatted string, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, mod`func+0x4, 
+              process ID: 123456
+              User Stack Frame 1
+              User Stack Frame 2
+              User Stack Frame 3
+, 1]]
+ProbeData:
+  encoded: org.opensolaris.os.dtrace.ProbeData[epid = 7, cpu = 1, enabledProbeDescription = syscall::malloc:entry, flow = org.opensolaris.os.dtrace.Flow[kind = RETURN, depth = 3], records = [org.opensolaris.os.dtrace.PrintaRecord[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]], formattedStrings = {[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!]=cat, [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]=cat}, tuples = [[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]], output = Yes, this is the formatted printa() output], long formatted string, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, mod`func+0x4, 
+              process ID: 123456
+              User Stack Frame 1
+              User Stack Frame 2
+              User Stack Frame 3
+, 1]]
+  decoded: org.opensolaris.os.dtrace.ProbeData[epid = 7, cpu = 1, enabledProbeDescription = syscall::malloc:entry, flow = org.opensolaris.os.dtrace.Flow[kind = RETURN, depth = 3], records = [org.opensolaris.os.dtrace.PrintaRecord[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]]], formattedStrings = {[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!]=cat, [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]=cat}, tuples = [[
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], [cat, 9, 
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+]], output = Yes, this is the formatted printa() output], long formatted string, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, mod`func+0x4, 
+              process ID: 123456
+              User Stack Frame 1
+              User Stack Frame 2
+              User Stack Frame 3
+, 1]]
+Aggregate:
+  serialized: org.opensolaris.os.dtrace.Aggregate[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = times, id = 1, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [cat, dog, mouse, mouse, 67, 7], value = 9]]]]
+  deserialized: org.opensolaris.os.dtrace.Aggregate[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = times, id = 1, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [cat, dog, mouse, mouse, 67, 7], value = 9]]]]
+Aggregate:
+  encoded: org.opensolaris.os.dtrace.Aggregate[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = times, id = 1, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [cat, dog, mouse, mouse, 67, 7], value = 9]]]]
+  decoded: org.opensolaris.os.dtrace.Aggregate[snaptime = 1234567890, aggregations = [org.opensolaris.os.dtrace.Aggregation[name = counts, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+, shebang!], value = class org.opensolaris.os.dtrace.LinearDistribution[base = 1, step = 10, buckets = [org.opensolaris.os.dtrace.Distribution$Bucket[min = 1, max = 10, frequency = 0], org.opensolaris.os.dtrace.Distribution$Bucket[min = 11, max = 20, frequency = 1], org.opensolaris.os.dtrace.Distribution$Bucket[min = 21, max = 30, frequency = 2], org.opensolaris.os.dtrace.Distribution$Bucket[min = 31, max = 40, frequency = 3], org.opensolaris.os.dtrace.Distribution$Bucket[min = 41, max = [...]
+              has
+              nine
+              lives
+, 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0:  1  2  3                                         ...
+], value = 7]], org.opensolaris.os.dtrace.Aggregation[name = times, id = 1, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [cat, dog, mouse, mouse, 67, 7], value = 9]]]]
+UserStackRecord:
+  serialized: 
+              process ID: 123456
+              User Stack Frame 1
+              User Stack Frame 2
+              User Stack Frame 3
+
+  deserialized: 
+              process ID: 123456
+              User Stack Frame 1
+              User Stack Frame 2
+              User Stack Frame 3
+
+UserStackRecord:
+  encoded: 
+              process ID: 123456
+              User Stack Frame 1
+              User Stack Frame 2
+              User Stack Frame 3
+
+  decoded: 
+              process ID: 123456
+              User Stack Frame 1
+              User Stack Frame 2
+              User Stack Frame 3
+
+AvgValue:
+  serialized: 5
+  deserialized: 5
+AvgValue:
+  encoded: 5
+  decoded: 5
+CountValue:
+  serialized: 9
+  deserialized: 9
+CountValue:
+  encoded: 9
+  decoded: 9
+SumValue:
+  serialized: 25
+  deserialized: 25
+SumValue:
+  encoded: 25
+  decoded: 25
+MinValue:
+  serialized: 101
+  deserialized: 101
+MinValue:
+  encoded: 101
+  decoded: 101
+MaxValue:
+  serialized: 101
+  deserialized: 101
+MaxValue:
+  encoded: 101
+  decoded: 101
+Error:
+  serialized: org.opensolaris.os.dtrace.Error[probeDescription = syscall::malloc:entry, epid = 8, cpu = 3, action = 1, offset = 20, fault = DTRACEFLT_BADALIGN, address = -1, defaultMessage = error on enabled probe ID 8 (ID 256: syscall::malloc:entry): Bad alignment (0x33ef) in action #1 at DIF offset 20]
+  deserialized: org.opensolaris.os.dtrace.Error[probeDescription = syscall::malloc:entry, epid = 8, cpu = 3, action = 1, offset = 20, fault = DTRACEFLT_BADALIGN, address = -1, defaultMessage = error on enabled probe ID 8 (ID 256: syscall::malloc:entry): Bad alignment (0x33ef) in action #1 at DIF offset 20]
+Error:
+  encoded: org.opensolaris.os.dtrace.Error[probeDescription = syscall::malloc:entry, epid = 8, cpu = 3, action = 1, offset = 20, fault = DTRACEFLT_BADALIGN, address = -1, defaultMessage = error on enabled probe ID 8 (ID 256: syscall::malloc:entry): Bad alignment (0x33ef) in action #1 at DIF offset 20]
+  decoded: org.opensolaris.os.dtrace.Error[probeDescription = syscall::malloc:entry, epid = 8, cpu = 3, action = 1, offset = 20, fault = DTRACEFLT_BADALIGN, address = -1, defaultMessage = error on enabled probe ID 8 (ID 256: syscall::malloc:entry): Bad alignment (0x33ef) in action #1 at DIF offset 20]
+Drop:
+  serialized: org.opensolaris.os.dtrace.Drop[cpu = 2, kind = Speculation (busy), count = 72, total = 1041, defaultMessage = Guess we dropped stuff all over the place.]
+  deserialized: org.opensolaris.os.dtrace.Drop[cpu = 2, kind = Speculation (busy), count = 72, total = 1041, defaultMessage = Guess we dropped stuff all over the place.]
+Drop:
+  encoded: org.opensolaris.os.dtrace.Drop[cpu = 2, kind = Speculation (busy), count = 72, total = 1041, defaultMessage = Guess we dropped stuff all over the place.]
+  decoded: org.opensolaris.os.dtrace.Drop[cpu = 2, kind = Speculation (busy), count = 72, total = 1041, defaultMessage = Guess we dropped stuff all over the place.]
+InterfaceAttributes:
+  serialized: Unstable / Evolving / ISA
+  deserialized: Unstable / Evolving / ISA
+InterfaceAttributes:
+  encoded: Unstable / Evolving / ISA
+  decoded: Unstable / Evolving / ISA
+ProgramInfo:
+  serialized: org.opensolaris.os.dtrace.ProgramInfo[minimumProbeAttributes = Unstable / Evolving / ISA, minimumStatementAttributes = Unstable / Evolving / ISA, matchingProbeCount = 256]
+  deserialized: org.opensolaris.os.dtrace.ProgramInfo[minimumProbeAttributes = Unstable / Evolving / ISA, minimumStatementAttributes = Unstable / Evolving / ISA, matchingProbeCount = 256]
+ProgramInfo:
+  encoded: org.opensolaris.os.dtrace.ProgramInfo[minimumProbeAttributes = Unstable / Evolving / ISA, minimumStatementAttributes = Unstable / Evolving / ISA, matchingProbeCount = 256]
+  decoded: org.opensolaris.os.dtrace.ProgramInfo[minimumProbeAttributes = Unstable / Evolving / ISA, minimumStatementAttributes = Unstable / Evolving / ISA, matchingProbeCount = 256]
+ProbeInfo:
+  serialized: org.opensolaris.os.dtrace.ProbeInfo[probeAttributes = Unstable / Evolving / ISA, argumentAttributes = Unstable / Evolving / ISA]
+  deserialized: org.opensolaris.os.dtrace.ProbeInfo[probeAttributes = Unstable / Evolving / ISA, argumentAttributes = Unstable / Evolving / ISA]
+ProbeInfo:
+  encoded: org.opensolaris.os.dtrace.ProbeInfo[probeAttributes = Unstable / Evolving / ISA, argumentAttributes = Unstable / Evolving / ISA]
+  decoded: org.opensolaris.os.dtrace.ProbeInfo[probeAttributes = Unstable / Evolving / ISA, argumentAttributes = Unstable / Evolving / ISA]
+Probe:
+  serialized: org.opensolaris.os.dtrace.Probe[description = syscall::malloc:entry, info = org.opensolaris.os.dtrace.ProbeInfo[probeAttributes = Unstable / Evolving / ISA, argumentAttributes = Unstable / Evolving / ISA]]
+  deserialized: org.opensolaris.os.dtrace.Probe[description = syscall::malloc:entry, info = org.opensolaris.os.dtrace.ProbeInfo[probeAttributes = Unstable / Evolving / ISA, argumentAttributes = Unstable / Evolving / ISA]]
+Probe:
+  encoded: org.opensolaris.os.dtrace.Probe[description = syscall::malloc:entry, info = org.opensolaris.os.dtrace.ProbeInfo[probeAttributes = Unstable / Evolving / ISA, argumentAttributes = Unstable / Evolving / ISA]]
+  decoded: org.opensolaris.os.dtrace.Probe[description = syscall::malloc:entry, info = org.opensolaris.os.dtrace.ProbeInfo[probeAttributes = Unstable / Evolving / ISA, argumentAttributes = Unstable / Evolving / ISA]]
+Flow:
+  serialized: org.opensolaris.os.dtrace.Flow[kind = RETURN, depth = 3]
+  deserialized: org.opensolaris.os.dtrace.Flow[kind = RETURN, depth = 3]
+Flow:
+  encoded: org.opensolaris.os.dtrace.Flow[kind = RETURN, depth = 3]
+  decoded: org.opensolaris.os.dtrace.Flow[kind = RETURN, depth = 3]
+KernelSymbolRecord:
+  serialized: mod`func+0x4
+  deserialized: mod`func+0x4
+KernelSymbolRecord:
+  encoded: mod`func+0x4
+  decoded: mod`func+0x4
+UserSymbolRecord:
+  serialized: mod`func+0x4
+  deserialized: mod`func+0x4
+UserSymbolRecord:
+  encoded: mod`func+0x4
+  decoded: mod`func+0x4
+UserSymbolRecord$Value:
+  serialized: org.opensolaris.os.dtrace.UserSymbolRecord$Value[processID = 7, address = -1]
+  deserialized: org.opensolaris.os.dtrace.UserSymbolRecord$Value[processID = 7, address = -1]
+UserSymbolRecord$Value:
+  encoded: org.opensolaris.os.dtrace.UserSymbolRecord$Value[processID = 7, address = -1]
+  decoded: org.opensolaris.os.dtrace.UserSymbolRecord$Value[processID = 7, address = -1]
+Program:
+  serialized: org.opensolaris.os.dtrace.Program[contents = syscall:::entry { @[execname] = count(); }, info = null]
+  deserialized: org.opensolaris.os.dtrace.Program[contents = syscall:::entry { @[execname] = count(); }, info = null]
+Program$File:
+  serialized: org.opensolaris.os.dtrace.Program$File[super = org.opensolaris.os.dtrace.Program[contents = syscall:::entry { @[execname] = count(); }, info = null], file = TestBean.out]
+  deserialized: org.opensolaris.os.dtrace.Program$File[super = org.opensolaris.os.dtrace.Program[contents = syscall:::entry { @[execname] = count(); }, info = null], file = TestBean.out]
+StddevValue:
+  serialized: 37
+  deserialized: 37
+StddevValue:
+  encoded: 37
+  decoded: 37
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Close.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Close.ksh
new file mode 100755
index 0000000..299755c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Close.ksh
@@ -0,0 +1,38 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Fixed bug 6419880 close() hangs running consumer.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestClose
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Close.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Close.ksh.out
new file mode 100644
index 0000000..628d787
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Close.ksh.out
@@ -0,0 +1 @@
+Successful
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Drop.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Drop.ksh
new file mode 100755
index 0000000..a03de95
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Drop.ksh
@@ -0,0 +1,38 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Fixed bug 6521523 aggregation drops can hang the Java DTrace API.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestDrop 3
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Drop.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Drop.ksh.out
new file mode 100644
index 0000000..266c4d4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Drop.ksh.out
@@ -0,0 +1 @@
+Lock released
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Enable.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Enable.ksh
new file mode 100755
index 0000000..df1c11f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Enable.ksh
@@ -0,0 +1,40 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Consumer enable() correctly handles multiple programs,
+#	recognizing programs that have already been enabled or that were
+#	compiled by another consumer.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestEnable
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Enable.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Enable.ksh.out
new file mode 100644
index 0000000..a13fb70
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.Enable.ksh.out
@@ -0,0 +1,6 @@
+java.lang.IllegalStateException: Not all compiled probes are enabled. Compiled description dtrace:::END not enabled.
+java.lang.IllegalStateException: program already enabled
+java.lang.IllegalStateException: program already enabled
+java.lang.IllegalStateException: Not all compiled probes are enabled. Compiled description syscall:::return not enabled.
+java.lang.IllegalStateException: program already enabled
+java.lang.IllegalArgumentException: program not compiled by this consumer
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.c
new file mode 100644
index 0000000..0e6291f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.c
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stdio.h>
+
+typedef void f(int x);
+
+static void
+f1(int i)
+{
+	printf("%d\n", i);
+}
+
+static void
+f2(f func, int i)
+{
+	func(i);
+}
+
+int
+main()
+{
+	f2(f1, 3);
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh
new file mode 100755
index 0000000..e1ffbdf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh
@@ -0,0 +1,39 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Fixed bug 6413280 lookupKernelFunction() and
+#	lookupUserFunction() truncate last character.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestFunctionLookup ./tst.FunctionLookup.exe
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh.out
new file mode 100644
index 0000000..d42e9b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.FunctionLookup.ksh.out
@@ -0,0 +1,3 @@
+genunix`cv_wakeup
+3
+tst.FunctionLookup.exe`f1
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.GetAggregate.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.GetAggregate.ksh
new file mode 100755
index 0000000..2fdd5a9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.GetAggregate.ksh
@@ -0,0 +1,36 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+############################################################################
+# ASSERTION:
+#	getAggregate() can explicitly specify the anonymous aggregation
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestGetAggregate
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh
new file mode 100755
index 0000000..992fcb5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh
@@ -0,0 +1,47 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Fixed bug 6506495 -DJAVA_DTRACE_MAX_CONSUMERS=N for any N < 8 is
+#	treated as if it were 8.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestMaxConsumers
+java -DJAVA_DTRACE_MAX_CONSUMERS=-1 -cp test.jar TestMaxConsumers
+java -DJAVA_DTRACE_MAX_CONSUMERS=0 -cp test.jar TestMaxConsumers
+java -DJAVA_DTRACE_MAX_CONSUMERS=1 -cp test.jar TestMaxConsumers
+java -DJAVA_DTRACE_MAX_CONSUMERS=2 -cp test.jar TestMaxConsumers
+java -DJAVA_DTRACE_MAX_CONSUMERS=7 -cp test.jar TestMaxConsumers
+java -DJAVA_DTRACE_MAX_CONSUMERS=8 -cp test.jar TestMaxConsumers
+java -DJAVA_DTRACE_MAX_CONSUMERS=9 -cp test.jar TestMaxConsumers
+java -DJAVA_DTRACE_MAX_CONSUMERS=19 -cp test.jar TestMaxConsumers
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh.out
new file mode 100644
index 0000000..f68fc4e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh.out
@@ -0,0 +1,17 @@
+Success
+JAVA_DTRACE_MAX_CONSUMERS=-1
+Success
+JAVA_DTRACE_MAX_CONSUMERS=0
+Success
+JAVA_DTRACE_MAX_CONSUMERS=1
+Success
+JAVA_DTRACE_MAX_CONSUMERS=2
+Success
+JAVA_DTRACE_MAX_CONSUMERS=7
+Success
+JAVA_DTRACE_MAX_CONSUMERS=8
+Success
+JAVA_DTRACE_MAX_CONSUMERS=9
+Success
+JAVA_DTRACE_MAX_CONSUMERS=19
+Success
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MultiAggPrinta.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MultiAggPrinta.ksh
new file mode 100755
index 0000000..6bb864a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MultiAggPrinta.ksh
@@ -0,0 +1,38 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Regression for multi-aggregation printa() corner cases.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestMultiAggPrinta tst.printa.d
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MultiAggPrinta.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MultiAggPrinta.ksh.out
new file mode 100644
index 0000000..8b8fd6e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.MultiAggPrinta.ksh.out
@@ -0,0 +1,78 @@
+org.opensolaris.os.dtrace.ProbeData[epid = 1, enabledProbeDescription = dtrace:::BEGIN, flow = null, records = [org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = , id = 1, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [], value = 1]]], formattedStrings = {[]=
+                1
+}, tuples = [[]], output = 
+                1
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = , id = 1, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [], value = 1]]], formattedStrings = {[]=count: 1
+}, tuples = [[]], output = count: 1
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [], formattedStrings = {[]= }, tuples = [[]], output =  ], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = a, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 1], org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 3], value = 3]]], formattedStrings = {[1, 3]=
+        1        3                3
+, [1, 2]=        1        2                1
+}, tuples = [[1, 3], [1, 2]], output = 
+        1        3                3
+        1        2                1
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = a, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 1], org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 3], value = 3], org.opensolaris.os.dtrace.AggregationRecord[tuple = [2, 3], value = 0]], org.opensolaris.os.dtrace.Aggregation[name = b, id = 3, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 2], org.opensol [...]
+        2        3                0                4
+, [1, 3]=        1        3                3                0
+, [1, 2]=        1        2                1                2
+}, tuples = [[2, 3], [1, 2], [1, 3]], output = 
+        2        3                0                4
+        1        2                1                2
+        1        3                3                0
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = c, id = 4, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [], value = 3]], org.opensolaris.os.dtrace.Aggregation[name = d, id = 5, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [], value = 4]]], formattedStrings = {[]=3 4
+}, tuples = [[]], output = 3 4
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = c, id = 4, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [], value = 3]], org.opensolaris.os.dtrace.Aggregation[name = d, id = 5, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [], value = 4]]], formattedStrings = {[]=3 4
+}, tuples = [[]], output = 3 4
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = c, id = 4, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [], value = 3]]], formattedStrings = {[]=3
+}, tuples = [[]], output = 3
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = a, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 1], org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 3], value = 3], org.opensolaris.os.dtrace.AggregationRecord[tuple = [2, 3], value = 0]], org.opensolaris.os.dtrace.Aggregation[name = b, id = 3, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 2], org.opensol [...]
+, [1, 3]=[1, 3] 3 0
+, [1, 2]=[1, 2] 1 2
+}, tuples = [[2, 3], [1, 2], [1, 3]], output = [2, 3] 0 4
+[1, 2] 1 2
+[1, 3] 3 0
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = a, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 1], org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 3], value = 3], org.opensolaris.os.dtrace.AggregationRecord[tuple = [2, 3], value = 0]], org.opensolaris.os.dtrace.Aggregation[name = b, id = 3, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 2], org.opensol [...]
+, [1, 3]=[1, 3] 3 0
+, [1, 2]=[1, 2] 1 2
+}, tuples = [[2, 3], [1, 3], [1, 2]], output = [2, 3] 0 4
+[1, 3] 3 0
+[1, 2] 1 2
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = a, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 1], org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 3], value = 3], org.opensolaris.os.dtrace.AggregationRecord[tuple = [2, 3], value = 0]], org.opensolaris.os.dtrace.Aggregation[name = b, id = 3, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 2], org.opensol [...]
+, [1, 3]=[1, 3] 3 0
+, [1, 2]=[1, 2] 1 2
+}, tuples = [[2, 3], [1, 3], [1, 2]], output = [2, 3] 0 4
+[1, 3] 3 0
+[1, 2] 1 2
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = a, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 1], org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 3], value = 3], org.opensolaris.os.dtrace.AggregationRecord[tuple = [2, 3], value = 0]], org.opensolaris.os.dtrace.Aggregation[name = b, id = 3, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 2], org.opensol [...]
+, [1, 3]=3 0 [1, 3]
+, [1, 2]=1 2 [1, 2]
+}, tuples = [[2, 3], [1, 3], [1, 2]], output = 0 4 [2, 3]
+3 0 [1, 3]
+1 2 [1, 2]
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [], formattedStrings = {[2, 3]=[2, 3]
+, [1, 3]=[1, 3]
+, [1, 2]=[1, 2]
+}, tuples = [[2, 3], [1, 3], [1, 2]], output = [2, 3]
+[1, 3]
+[1, 2]
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [], formattedStrings = {}, tuples = [], output = [2]
+[1]
+[1]
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [], formattedStrings = {}, tuples = [], output = [2] 0 4
+[1] 3 0
+[1] 1 2
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [], formattedStrings = {}, tuples = [], output = 0 4
+3 0
+1 2
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [], formattedStrings = {}, tuples = [], output = 0 4 4
+3 0 0
+1 2 2
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [], formattedStrings = {}, tuples = [], output = [2] 0 4 4
+[1] 3 0 0
+[1] 1 2 2
+], org.opensolaris.os.dtrace.PrintaRecord[aggregations = [org.opensolaris.os.dtrace.Aggregation[name = a, id = 2, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 1], org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 3], value = 3], org.opensolaris.os.dtrace.AggregationRecord[tuple = [2, 3], value = 0]], org.opensolaris.os.dtrace.Aggregation[name = b, id = 3, records = [org.opensolaris.os.dtrace.AggregationRecord[tuple = [1, 2], value = 2], org.opensol [...]
+, [1, 3]=[1, 3] 3 0 0
+, [1, 2]=[1, 2] 1 2 2
+}, tuples = [[2, 3], [1, 3], [1, 2]], output = [2, 3] 0 4 4
+[1, 3] 3 0 0
+[1, 2] 1 2 2
+], 0]
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.c
new file mode 100644
index 0000000..0833912
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.c
@@ -0,0 +1,93 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+typedef void f(char *);
+
+static void
+f_a(char *a)
+{
+}
+
+static void
+f_b(char *a)
+{
+}
+
+static void
+f_c(char *a)
+{
+}
+
+static void
+f_d(char *a)
+{
+}
+
+static void
+f_e(char *a)
+{
+}
+
+static void
+fN(f func, char *a, int i)
+{
+	func(a);
+}
+
+static void
+fN2(f func, char *a, int i)
+{
+	func(a);
+}
+
+int
+main()
+{
+	/*
+	 * Avoid length of 1, 2, 4, or 8 bytes so DTrace will treat the data as
+	 * a byte array.
+	 */
+	char a[] = {(char)-7, (char)201, (char)0, (char)0, (char)28, (char)1};
+	char b[] = {(char)84, (char)69, (char)0, (char)0, (char)28, (char)0};
+	char c[] = {(char)84, (char)69, (char)0, (char)0, (char)28, (char)1};
+	char d[] = {(char)-7, (char)201, (char)0, (char)0, (char)29, (char)0};
+	char e[] = {(char)84, (char)69, (char)0, (char)0, (char)28, (char)0};
+
+	fN(f_a, a, 1);
+	fN(f_b, b, 0);
+	fN(f_d, d, 102);
+	fN2(f_e, e, -2);
+	fN(f_c, c, 0);
+	fN(f_a, a, -1);
+	fN(f_d, d, 101);
+	fN(f_e, e, -2);
+	fN(f_e, e, 2);
+	fN2(f_e, e, 2);
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.ksh
new file mode 100755
index 0000000..97f4945
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.ksh
@@ -0,0 +1,38 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+# 	ProbeData instances sort as expected with multiple enabled probe
+# 	IDs and multiple records including byte array (sorted as
+# 	unsigned bytes), stand-alone ufunc() action, and signed integer.
+#
+############################################################################
+
+java -cp test.jar TestProbeData ./tst.ProbeData.exe
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.ksh.out
new file mode 100644
index 0000000..6789514
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeData.ksh.out
@@ -0,0 +1,50 @@
+[probe 1 pid$target:tst.ProbeData.exe:fN:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 54 45  0  0 1c  0                                TE....
+,   tst.ProbeData.exe`f_b                             , 0]]
+
+[probe 1 pid$target:tst.ProbeData.exe:fN:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 54 45  0  0 1c  0                                TE....
+,   tst.ProbeData.exe`f_e                             , -2]]
+
+[probe 2 pid$target:tst.ProbeData.exe:fN2:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 54 45  0  0 1c  0                                TE....
+,   tst.ProbeData.exe`f_e                             , -2]]
+
+[probe 1 pid$target:tst.ProbeData.exe:fN:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 54 45  0  0 1c  0                                TE....
+,   tst.ProbeData.exe`f_e                             , 2]]
+
+[probe 2 pid$target:tst.ProbeData.exe:fN2:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 54 45  0  0 1c  0                                TE....
+,   tst.ProbeData.exe`f_e                             , 2]]
+
+[probe 1 pid$target:tst.ProbeData.exe:fN:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 54 45  0  0 1c  1                                TE....
+,   tst.ProbeData.exe`f_c                             , 0]]
+
+[probe 1 pid$target:tst.ProbeData.exe:fN:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: f9 c9  0  0 1c  1                                ......
+,   tst.ProbeData.exe`f_a                             , -1]]
+
+[probe 1 pid$target:tst.ProbeData.exe:fN:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: f9 c9  0  0 1c  1                                ......
+,   tst.ProbeData.exe`f_a                             , 1]]
+
+[probe 1 pid$target:tst.ProbeData.exe:fN:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: f9 c9  0  0 1d  0                                ......
+,   tst.ProbeData.exe`f_d                             , 101]]
+
+[probe 1 pid$target:tst.ProbeData.exe:fN:entry [
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: f9 c9  0  0 1d  0                                ......
+,   tst.ProbeData.exe`f_d                             , 102]]
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeDescription.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeDescription.ksh
new file mode 100755
index 0000000..bee1cca
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeDescription.ksh
@@ -0,0 +1,45 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	ProbeDescription constructors function as expected.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestProbeDescription syscall:::entry
+java -cp test.jar TestProbeDescription BEGIN
+java -cp test.jar TestProbeDescription isdigit entry
+java -cp test.jar TestProbeDescription genunix isdigit entry
+java -cp test.jar TestProbeDescription fbt genunix isdigit entry
+java -cp test.jar TestProbeDescription fbt:genunix:isdigit:entry
+java -cp test.jar TestProbeDescription syscall::entry
+java -cp test.jar TestProbeDescription syscall:entry
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeDescription.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeDescription.ksh.out
new file mode 100644
index 0000000..326018a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.ProbeDescription.ksh.out
@@ -0,0 +1,8 @@
+syscall:::entry
+:::BEGIN
+::isdigit:entry
+:genunix:isdigit:entry
+fbt:genunix:isdigit:entry
+fbt:genunix:isdigit:entry
+:syscall::entry
+::syscall:entry
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StateMachine.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StateMachine.ksh
new file mode 100755
index 0000000..638ce7a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StateMachine.ksh
@@ -0,0 +1,40 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Consumer state machine prevents illegal calls, allows legal
+#	ones; consumer behaves predictably when methods called out of
+#	order.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestStateMachine
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StateMachine.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StateMachine.ksh.out
new file mode 100644
index 0000000..5ddb528
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StateMachine.ksh.out
@@ -0,0 +1,70 @@
+before open
+open: false
+enabled: false
+closed: false
+java.lang.IllegalStateException: consumer not open
+java.lang.IllegalStateException: consumer not open
+java.lang.IllegalStateException: consumer not open
+java.lang.IllegalStateException: consumer not open
+java.lang.IllegalStateException: consumer not open
+java.lang.IllegalStateException: consumer not open
+java.lang.IllegalStateException: consumer not open
+java.lang.IllegalStateException: consumer not open
+java.lang.IllegalStateException: consumer not open
+before compile
+open: true
+enabled: false
+closed: false
+java.lang.IllegalStateException: consumer already open
+java.lang.IllegalStateException: no compiled program
+before enable
+open: true
+enabled: false
+closed: false
+java.lang.IllegalStateException: Not all compiled probes are enabled. Compiled description syscall:::entry { @[execname] = count(); } tick-101ms { printa(@); } not enabled.
+before go
+open: true
+enabled: true
+closed: false
+java.lang.IllegalStateException: go() not called
+java.lang.IllegalStateException: go() not called
+java.lang.IllegalStateException: go() not called
+java.lang.IllegalStateException: go() not called
+before go, running: false
+consumerStarted, running: true
+after go
+open: true
+enabled: false
+closed: false
+java.lang.IllegalStateException: go() already called
+java.lang.IllegalStateException: go() already called
+java.lang.IllegalStateException: go() already called
+java.lang.IllegalStateException: go() already called
+java.lang.IllegalStateException: go() already called
+java.lang.IllegalStateException: go() already called
+consumerStopped, running: false
+after stop, running: false
+after stop
+open: true
+enabled: false
+closed: false
+java.lang.IllegalStateException: consumer already stopped
+after close
+open: false
+enabled: false
+closed: true
+java.lang.IllegalStateException: cannot reopen a closed consumer
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
+java.lang.IllegalStateException: consumer closed
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StopLock.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StopLock.ksh
new file mode 100755
index 0000000..4637a7a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StopLock.ksh
@@ -0,0 +1,39 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Fixed bug 6399888 stop() hangs if ConsumerListener calls
+#	synchronized Consumer method.
+#
+# SECTION: Java API
+#
+############################################################################
+
+java -cp test.jar TestStopLock
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StopLock.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StopLock.ksh.out
new file mode 100644
index 0000000..628d787
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.StopLock.ksh.out
@@ -0,0 +1 @@
+Successful
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.printa.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.printa.d
new file mode 100644
index 0000000..574a9ea
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.printa.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	printa() test with/without tuple, with multiple aggregations and
+ * 	mismatched format strings, and sorting options.
+ *
+ * SECTION: Aggregations/Aggregations; Output Formatting, printa()
+ *
+ * NOTES: This test attempts to cover all multi-agg printa() corner cases.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@ = count();
+	@a[1, 2] = sum(1);
+	@b[1, 2] = sum(2);
+	@a[1, 3] = sum(3);
+	@b[2, 3] = sum(4);
+	@c = sum(3);
+	@d = sum(4);
+	setopt("aggsortpos", "1");
+	setopt("aggsortrev");
+	printa(@);
+	printa("count: %@d\n", @);
+	printa(" ", @);
+	printa(@a);
+	printa(@a, @b);
+	printa("%@d %@d\n", @c, @d);
+	printa("%@d %@d\n", @c, @d);
+	printa("%@d\n", @c, @d);
+
+	printa("[%d, %d] %@d %@d\n", @a, @b);
+	setopt("aggsortkey");
+	printa("[%d, %d] %@d %@d\n", @a, @b);
+	setopt("aggsortpos", "0");
+	setopt("aggsortkeypos", "1");
+	printa("[%d, %d] %@d %@d\n", @a, @b);
+
+	printa("%@d %@d [%d, %d]\n", @a, @b);
+	printa("[%d, %d]\n", @a, @b);
+	printa("[%d]\n", @a, @b);
+	printa("[%d] %@d %@d\n", @a, @b);
+	printa("%@d %@d\n", @a, @b);
+	printa("%@d %@d %@d\n", @a, @b);
+	printa("[%d] %@d %@d %@d\n", @a, @b);
+	printa("[%d, %d] %@d %@d %@d\n", @a, @b);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.printa.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.printa.d.out
new file mode 100644
index 0000000..10b90b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/java_api/tst.printa.d.out
@@ -0,0 +1,47 @@
+
+                1
+count: 1
+ 
+        1        3                3
+        1        2                1
+
+        2        3                0                4
+        1        2                1                2
+        1        3                3                0
+3 4
+3 4
+3
+[2, 3] 0 4
+[1, 2] 1 2
+[1, 3] 3 0
+[2, 3] 0 4
+[1, 3] 3 0
+[1, 2] 1 2
+[2, 3] 0 4
+[1, 3] 3 0
+[1, 2] 1 2
+0 4 [2, 3]
+3 0 [1, 3]
+1 2 [1, 2]
+[2, 3]
+[1, 3]
+[1, 2]
+[2]
+[1]
+[1]
+[2] 0 4
+[1] 3 0
+[1] 1 2
+0 4
+3 0
+1 2
+0 4 4
+3 0 0
+1 2 2
+[2] 0 4 4
+[1] 3 0 0
+[1] 1 2 2
+[2, 3] 0 4 4
+[1, 3] 3 0 0
+[1, 2] 1 2 2
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NL.char.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NL.char.d
new file mode 100644
index 0000000..9c0280c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NL.char.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Newlines may not be embedded in character constants..
+ *
+ * SECTION: Lexer
+ */
+
+
+BEGIN
+{
+
+	h = '
+		';
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NULL.char.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NULL.char.d
new file mode 100644
index 0000000..aef5dab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_CHR_NULL.char.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Char constants may not be empty
+ *
+ * SECTION: Lexer
+ */
+
+
+BEGIN
+{
+
+	h = '';
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_INT_DIGIT.InvalidDigit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_INT_DIGIT.InvalidDigit.d
new file mode 100644
index 0000000..4fac03b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_INT_DIGIT.InvalidDigit.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: If an integer representation contains an invalid digit
+ * a D_INT_DIGIT is thrown.
+ *
+ * SECTION: Errtags/D_INT_DIGIT
+ */
+
+BEGIN
+{
+	0128;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_INT_OFLOW.BigInt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_INT_OFLOW.BigInt.d
new file mode 100644
index 0000000..1ec8be8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_INT_OFLOW.BigInt.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Using an integer constant that cannot be represented in any of the
+ * builtin integral types throws a D_INT_OFLOW error.
+ *
+ * SECTION: Errtags/D_INT_OFLOW
+ */
+
+BEGIN
+{
+	0x12345678123456781;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_STR_NL.string.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_STR_NL.string.d
new file mode 100644
index 0000000..68b4cd4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_STR_NL.string.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Newlines may not be embedded in string literals.
+ *
+ * SECTION: Lexer
+ */
+
+
+BEGIN
+{
+
+	h = "hello
+
+		there";
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brace1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brace1.d
new file mode 100644
index 0000000..ae6dc6c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brace1.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test detection of extra curly braces.
+ *
+ * SECTION: Lexer
+ */
+
+BEGIN
+{
+	trace(epid);
+}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brace2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brace2.d
new file mode 100644
index 0000000..196f7d7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brace2.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: * Test detection of missing curly braces.
+ *
+ * SECTION: Lexer
+ */
+
+BEGIN
+{
+	trace(epid);
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack1.d
new file mode 100644
index 0000000..8e4c97d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack1.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test detection of extra square brackets
+ *
+ * SECTION: Lexer
+ */
+
+BEGIN
+{
+	trace(args[0]]);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack2.d
new file mode 100644
index 0000000..307bd08
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack2.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test detection of missing square brackets
+ *
+ * SECTION: Lexer
+ */
+
+BEGIN
+{
+	args[0
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack3.d
new file mode 100644
index 0000000..2d66828
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.brack3.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test detection of missing square brackets
+ *
+ * SECTION: Lexer
+ */
+
+BEGIN
+/args[0/
+{
+	trace(epid);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren1.d
new file mode 100644
index 0000000..812dbb7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren1.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test detection of extra parentheses
+ *
+ * SECTION: Lexer
+ */
+
+BEGIN
+{
+	trace(epid));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren2.d
new file mode 100644
index 0000000..078d08c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren2.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test detection of missing parentheses
+ *
+ * SECTION: Lexer
+ */
+
+BEGIN
+{
+	rand(
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren3.d
new file mode 100644
index 0000000..38cdb7e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/err.D_SYNTAX.paren3.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test detection of missing parentheses
+ *
+ * SECTION: Lexer
+ */
+
+BEGIN
+/rand(/
+{
+	trace(epid);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/tst.D_MACRO_OFLOW.ParIntOvflow.d.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/tst.D_MACRO_OFLOW.ParIntOvflow.d.ksh
new file mode 100755
index 0000000..ad124ea
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/lexer/tst.D_MACRO_OFLOW.ParIntOvflow.d.ksh
@@ -0,0 +1,54 @@
+#!/bin/ksh -p
+
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# ASSERTION:
+# If a macro argument results in an integer overflow, a D_MACRO_OFLOW is
+# thrown.
+#
+# SECTION: Errtags/D_MACRO_OFLOW
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -n 'BEGIN { $1; }' 0x12345678123456781
+status=$?
+
+if [ "$status" -ne  0 ]; then
+	exit 0
+fi
+
+echo dtrace failed
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mdb/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mdb/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mdb/tst.dtracedcmd.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mdb/tst.dtracedcmd.ksh
new file mode 100755
index 0000000..561f854
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mdb/tst.dtracedcmd.ksh
@@ -0,0 +1,85 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+#
+# This script primarily tests that the ::dtrace dcmd is not dumping
+# core. We don't try to make sense of the output of the dcmd nor
+# do we check to see if any output is produced. We merely see if
+# mdb fails with a fatal failure.
+#
+
+script()
+{
+	$dtrace -o $dtraceout -s /dev/stdin <<EOF
+	syscall:::entry
+	{
+		@[probefunc] = count();
+	}
+EOF
+}
+
+mdbdoit()
+{
+	mdb -k <<EOF
+	::walk dtrace_state | ::dtrace
+EOF
+	status=$?
+	kill $script
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+dtraceout=/tmp/dtrace.out.$$
+script &
+script=$!
+timeout=15
+
+#
+# Sleep while the above script fires into life. To guard against dtrace dying
+# and us sleeping forever we allow 15 secs for this to happen. This should be
+# enough for even the slowest systems.
+#
+while [ ! -f $dtraceout ]; do
+	sleep 1
+	timeout=$(($timeout-1))
+	if [ $timeout -eq 0 ]; then
+		echo "dtrace failed to start. Exiting."
+		exit 1
+	fi
+done
+
+mdbdoit
+
+rm $dtraceout
+
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.icmp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.icmp.ksh
new file mode 100644
index 0000000..b1cac20
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.icmp.ksh
@@ -0,0 +1,79 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that several of the the mib:::icmp* probes fire and fire
+# with a valid args[0].
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	mib:::icmpInEchos
+	{
+		in = args[0];
+	}
+
+	mib:::icmpOutEchoReps
+	{
+		reps = args[0];
+	}
+
+	mib:::icmpOutMsgs
+	{
+		msgs = args[0];
+	}
+
+	profile:::tick-10msec
+	/in && reps && msgs/
+	{
+		exit(0);
+	}
+EOF
+}
+
+pinger()
+{
+	while true; do
+		ping -A inet localhost
+		/usr/bin/sleep 1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+pinger &
+pinger=$!
+script
+status=$?
+
+kill $pinger
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.tcp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.tcp.ksh
new file mode 100644
index 0000000..ee602e8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.tcp.ksh
@@ -0,0 +1,155 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that several of the the mib:::tcp* probes fire and fire
+# with a valid args[0].
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+dtraceout=/tmp/dtrace.out.$$
+timeout=15
+port=2000
+
+if [ -f $dtraceout ]; then
+	rm -f $dtraceout
+fi
+
+script()
+{
+	$dtrace -o $dtraceout -s /dev/stdin <<EOF
+	mib:::tcpActiveOpens
+	{
+		opens = args[0];
+	}
+
+	mib:::tcpOutDataBytes
+	{
+		bytes = args[0];
+	}
+
+	mib:::tcpOutDataSegs
+	{
+		segs = args[0];
+	}
+
+	profile:::tick-10msec
+	/opens && bytes && segs/
+	{
+		exit(0);
+	}
+
+	profile:::tick-1s
+	/n++ >= 10/
+	{
+		exit(1);
+	}
+EOF
+}
+
+server()
+{
+	perl /dev/stdin /dev/stdout << EOF
+	use strict;
+	use Socket;
+
+	socket(S, AF_INET, SOCK_STREAM, getprotobyname('tcp'))
+	    or die "socket() failed: \$!";
+
+	setsockopt(S, SOL_SOCKET, SO_REUSEADDR, 1)
+	    or die "setsockopt() failed: \$!";
+
+	my \$addr = sockaddr_in($port, INADDR_ANY);
+	bind(S, \$addr) or die "bind() failed: \$!";
+	listen(S, SOMAXCONN) or die "listen() failed: \$!";
+
+	while (1) {
+		next unless my \$raddr = accept(SESSION, S);
+
+		while (<SESSION>) {
+		}
+
+		close SESSION;
+	}
+EOF
+}
+
+client()
+{
+	perl /dev/stdin /dev/stdout <<EOF
+	use strict;
+	use Socket;
+
+	my \$peer = sockaddr_in($port, INADDR_ANY);
+
+	socket(S, AF_INET, SOCK_STREAM, getprotobyname('tcp'))
+	    or die "socket() failed: \$!";
+
+	connect(S, \$peer) or die "connect failed: \$!";
+
+	for (my \$i = 0; \$i < 10; \$i++) {
+		send(S, "There!", 0) or die "send() failed: \$!";
+		sleep (1);
+	}
+EOF
+}
+
+script &
+dtrace_pid=$!
+
+#
+# Sleep while the above script fires into life. To guard against dtrace dying
+# and us sleeping forever we allow 15 secs for this to happen. This should be
+# enough for even the slowest systems.
+#
+while [ ! -f $dtraceout ]; do
+	sleep 1
+	timeout=$(($timeout-1))
+	if [ $timeout -eq 0 ]; then
+		echo "dtrace failed to start. Exiting."
+		exit 1
+	fi
+done
+
+server &
+server_pid=$!
+sleep 2
+client &
+client_pid=$!
+
+wait $dtrace_pid
+status=$?
+
+kill $server_pid
+kill $client_pid
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.udp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.udp.ksh
new file mode 100644
index 0000000..a492124
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/mib/tst.udp.ksh
@@ -0,0 +1,74 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that several of the the mib:::udp* probes fire and fire
+# with a valid args[0].
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	mib:::udpHCOutDatagrams
+	{
+		out = args[0];
+	}
+
+	mib:::udpHCInDatagrams
+	{
+		in = args[0];
+	}
+
+	profile:::tick-10msec
+	/in && out/
+	{
+		exit(0);
+	}
+EOF
+}
+
+rupper()
+{
+	while true; do
+		rup localhost
+		/usr/bin/sleep 1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+rupper &
+rupper=$!
+script
+status=$?
+
+kill $rupper
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/err.D_PRAGMA_OPTSET.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/err.D_PRAGMA_OPTSET.d
new file mode 100644
index 0000000..5238e3f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/err.D_PRAGMA_OPTSET.d
@@ -0,0 +1,34 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet=please
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.badopt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.badopt.d
new file mode 100644
index 0000000..868b756
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.badopt.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	setopt("Nixon");
+	setopt("Harding");
+	setopt("Hoover");
+	setopt("Bush");
+	setopt("quiet", "hell no");
+	setopt("aggrate", "0.5hz");
+	setopt("bufsize", "1m");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.boolopt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.boolopt.d
new file mode 100644
index 0000000..0755271
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.boolopt.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet=yes
+#pragma D option quiet=YES
+#pragma D option quiet=true
+#pragma D option quiet=enable
+#pragma D option quiet=enabled
+#pragma D option quiet=on
+#pragma D option quiet=set
+#pragma D option quiet=SeT
+
+#pragma D option flowindent=no
+#pragma D option flowindent=NO
+#pragma D option flowindent=false
+#pragma D option flowindent=disable
+#pragma D option flowindent=disabled
+#pragma D option flowindent=off
+#pragma D option flowindent=UnSeT
+
+BEGIN
+{
+	printf(".lived eht si paTmetsyS, lived eht si paTmetsyS\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.boolopt.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.boolopt.d.out
new file mode 100644
index 0000000..2554be5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.boolopt.d.out
@@ -0,0 +1,2 @@
+.lived eht si paTmetsyS, lived eht si paTmetsyS
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.dynopt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.dynopt.d
new file mode 100644
index 0000000..cb98d73
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.dynopt.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+#pragma D option switchrate=1ms
+#pragma D option aggrate=1ms
+
+tick-100ms
+{
+	i++;
+}
+
+tick-100ms
+/i > 1/
+{
+	setopt("quiet", "no");
+	setopt("quiet");
+	setopt("quiet");
+	setopt("quiet", "yes");
+	@["abc"] = count();
+	printa("%@d\n", @);
+}
+
+tick-100ms
+/i == 5/
+{
+	setopt("switchrate", "5sec");
+	setopt("aggrate", "5sec");
+}
+
+tick-100ms
+/i == 31/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.dynopt.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.dynopt.d.out
new file mode 100644
index 0000000..092a042
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.dynopt.d.out
@@ -0,0 +1,31 @@
+1
+2
+3
+4
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+30
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.enablerace.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.enablerace.ksh
new file mode 100644
index 0000000..b4d56bb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.enablerace.ksh
@@ -0,0 +1,89 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script attempts to tease out a race when probes are initially enabled.
+#
+script()
+{
+	#
+	# Nauseatingly, the #defines below must be in the 0th column to
+	# satisfy the ancient cpp that -C defaults to.
+	#
+	$dtrace -C -s /dev/stdin <<EOF
+#define	PROF1		profile:::profile-4000hz
+#define	PROF4		PROF1, PROF1, PROF1, PROF1
+#define	PROF16		PROF4, PROF4, PROF4, PROF4
+#define	PROF64		PROF16, PROF16, PROF16, PROF16
+#define	PROF256		PROF64, PROF64, PROF64, PROF64
+#define	PROF512		PROF256, PROF256
+
+	PROF1
+	{
+		this->x = 0;
+	}
+
+	PROF512
+	{
+		this->x++;
+	}
+
+	PROF1
+	/this->x != 512/
+	{
+		printf("failed! x is %d (expected 512)", this->x);
+		exit(1);
+	}
+
+	tick-1sec
+	/secs++/
+	{
+		exit(0);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+let i=0
+
+while [ "$i" -lt 20 ]; do
+	script
+	status=$?
+
+	if [ "$status" -ne 0 ]; then
+		exit $status
+	fi
+
+	let i=i+1
+done
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.haslam.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.haslam.d
new file mode 100644
index 0000000..a0b437b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.haslam.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: test for off-by-one error in the format lookup code
+ *
+ * SECTION: Aggregations/Aggregations; Misc
+ */
+
+/*
+ * A script from Jon Haslam that induced an off-by-one error in the
+ * format lookup code.
+ */
+BEGIN
+{
+	start = timestamp;
+	allocd = 0;
+	numallocs = 0;
+	numfrees = 0;
+	numtids = 0;
+}
+
+syscall:::entry
+{
+	@sys[tid] = sum(tid);
+}
+
+END
+{
+	printf("%s, %s, %s, %d numtids", "hhh", "jjj", "ggg", numtids );
+	printa(@sys);
+}
+
+tick-1sec
+/n++ == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.include.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.include.ksh
new file mode 100644
index 0000000..ec32802
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.include.ksh
@@ -0,0 +1,135 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+CC=/usr/sfw/bin/gcc
+CFLAGS=
+
+doit()
+{
+	file=$1
+	ofile=$2
+	errfile=$3
+	cfile=${TMPDIR:-/tmp}/inc.$$.$file.c
+	cofile=${TMPDIR:-/tmp}/inc.$$.$file
+	cat > $cfile <<EOF
+#include <sys/$file>
+void
+main()
+{}
+EOF
+	if $CC $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
+		$dtrace -xerrtags -C -s /dev/stdin \
+		    >/dev/null 2>$errfile <<EOF
+#include <sys/$file>
+BEGIN
+{
+	exit(0);
+}
+EOF
+		if [ $? -ne 0 ]; then
+			echo $inc failed: `cat $errfile | head -1` > $ofile
+		else
+			echo $inc succeeded > $ofile
+		fi
+		rm -f $errfile
+	fi
+
+	rm -f $cofile $cfile 2>/dev/null
+}
+
+if [ ! -x $CC ]; then
+	echo "$0: bad compiler: $CC" >& 2
+	exit 1
+fi
+
+concurrency=`psrinfo | wc -l`
+let concurrency=concurrency*4
+let i=0
+
+files=/usr/include/sys/*.h
+
+#
+# There are a few files in /usr/include/sys that are known to be bad -- usually
+# because they include static globals (!) or function bodies (!!) in the header
+# file.  Hopefully these remain sufficiently few that the O(#files * #badfiles)
+# algorithm, below, doesn't become a problem.  (And yes, writing scripts in
+# something other than ksh1888 would probably be a good idea.)  If this script
+# becomes a problem, kindly fix it by reducing the number of bad files!  (That
+# is, fix it by fixing the broken file, not the broken script.)
+#
+badfiles="ctype.h eri_msg.h ser_sync.h sbpro.h neti.h hook_event.h \
+    bootconf.h bootstat.h dtrace.h dumphdr.h exacct_impl.h fasttrap.h \
+    kobj.h kobj_impl.h ksyms.h lockstat.h smedia.h stat.h utsname.h"
+
+for inc in $files; do
+	file=`basename $inc`
+	for bad in $badfiles; do
+		if [ "$file" = "$bad" ]; then
+			continue 2 
+		fi
+	done
+
+	ofile=${TMPDIR:-/tmp}/inc.$file.$$.out
+	errfile=${TMPDIR:-/tmp}/inc.$file.$$.err
+	doit $file $ofile $errfile &
+	let i=i+1
+
+	if [ $i -eq $concurrency ]; then
+		#
+		# This isn't optimal -- it creates a highly fluctuating load
+		# as we wait for all work to complete -- but it's an easy
+		# way of parallelizing work.
+		#
+		wait
+		let i=0
+	fi
+done
+
+wait
+
+bigofile=${TMPDIR:-/tmp}/inc.$$.out
+
+for inc in $files; do
+	file=`basename $inc`
+	ofile=${TMPDIR:-/tmp}/inc.$file.$$.out
+
+	if [ -f $ofile ]; then
+		cat $ofile >> $bigofile
+		rm $ofile
+	fi
+done
+
+status=$(grep "failed:" $bigofile | wc -l)
+cat $bigofile
+rm -f $bigofile
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh
new file mode 100644
index 0000000..a5114f4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh
@@ -0,0 +1,41 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -ln 'syscall::*$1:entry' read | awk '{print $(NF-1),$NF}' | sort
+$dtrace -ln 'syscall::$1*:entry' read | awk '{print $(NF-1),$NF}' | sort
+$dtrace -ln 'syscall::re$1*:entry' ad | awk '{print $(NF-1),$NF}' | sort
+$dtrace -ln 'syscall::$1l*:entry' read | awk '{print $(NF-1),$NF}' | sort
+$dtrace -ln 'syscall::p$1[0-9][0-9]:entry' read | awk '{print $(NF-1),$NF}' | \
+ sort
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out
new file mode 100644
index 0000000..8a9ac6d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.macroglob.ksh.out
@@ -0,0 +1,15 @@
+FUNCTION NAME
+pread entry
+read entry
+FUNCTION NAME
+read entry
+readlink entry
+readv entry
+FUNCTION NAME
+read entry
+readlink entry
+readv entry
+FUNCTION NAME
+readlink entry
+FUNCTION NAME
+pread64 entry
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.roch.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.roch.d
new file mode 100644
index 0000000..67f4462
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.roch.d
@@ -0,0 +1,93 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: test for assertion failure in the ring buffer code
+ *
+ * SECTION: Buffers and Buffering/ring Policy; Misc
+ */
+
+#pragma ident	"@(#)tst.roch.d	1.2	03/08/11 SMI"
+
+/*
+ * A script from Roch Bourbonnais that induced an assertion failure in the
+ * ring buffer code.
+ */
+#pragma D option strsize=16
+#pragma D option bufsize=10K
+#pragma D option bufpolicy=ring
+
+fbt:::entry
+/(self->done == 0) && (curthread->t_cpu->cpu_intr_actv == 0) /
+{
+	self->done = 1;
+	printf(" %u 0x%llX %d %d comm:%s csathr:%lld", timestamp,
+	    (long long)curthread, pid, tid,
+	    execname, (long long)stackdepth);
+	stack(20);
+}
+
+fbt:::return
+/(self->done == 0) && (curthread->t_cpu->cpu_intr_actv == 0) /
+{
+	self->done = 1;
+	printf(" %u 0x%llX %d %d comm:%s csathr:%lld", timestamp,
+	    (long long) curthread, pid, tid,
+	    execname, (long long) stackdepth);
+	stack(20);
+}
+
+fbt:::entry
+{
+	printf(" %u 0x%llX %d %d ", timestamp,
+	    (long long)curthread, pid, tid);
+}
+
+fbt:::return
+{
+	printf(" %u 0x%llX %d %d tag:%d off:%d ", timestamp,
+	    (long long)curthread, pid, tid, (int)arg1, (int)arg0);
+}
+
+mutex_enter:adaptive-acquire
+{
+	printf(" %u 0x%llX %d %d lock:0x%llX", timestamp,
+	    (long long)curthread, pid, tid, arg0);
+}
+
+mutex_exit:adaptive-release
+{
+	printf(" %u 0x%llX %d %d lock:0x%llX", timestamp,
+	    (long long) curthread, pid, tid, arg0);
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh
new file mode 100644
index 0000000..494f6f8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/misc/tst.schrock.ksh
@@ -0,0 +1,79 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+#
+# /usr/ccs/bin/nm execs a 64-bit version of itself. DTrace uses libproc
+# (which uses /proc) to find out when the traced process exits, but a
+# 32-bit process can't examine a 64-bit one with libproc. The
+# LD_NOEXEC_64 variable prevents nm from re-execing itself.
+#
+LD_NOEXEC_64=tomeeisrad $dtrace -F -s /dev/stdin -c \
+    '/usr/ccs/bin/nm /bin/ls' stat <<EOF
+
+pid\$target::\$1:entry
+{
+	self->start = vtimestamp;
+}
+
+pid\$target:::entry
+/self->start/
+{
+	trace(vtimestamp - self->start);
+}
+
+pid\$target:::return
+/self->start/
+{
+	trace(vtimestamp - self->start);
+}
+
+pid\$target::\$1:return
+/self->start/
+{
+	self->start = 0;
+	exit(0);
+}
+
+syscall:::
+/self->start/
+{
+	trace(vtimestamp - self->start);
+}
+
+fbt:::
+/self->start/
+{
+	trace(vtimestamp - self->start);
+}
+EOF
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/err.D_PRINTA_AGGKEY.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/err.D_PRINTA_AGGKEY.d
new file mode 100644
index 0000000..8074e6e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/err.D_PRINTA_AGGKEY.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@foo[123] = sum(123);
+	@bar = sum(456);
+
+	printa("%10d %@10d %@10d\n", @foo, @bar);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/err.D_PRINTA_AGGPROTO.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/err.D_PRINTA_AGGPROTO.d
new file mode 100644
index 0000000..dc65947
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/err.D_PRINTA_AGGPROTO.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@foo[123] = sum(123);
+	@bar["fooey"] = sum(456);
+
+	printa("%10d %@10d %@10d\n", @foo, @bar);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.many.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.many.d
new file mode 100644
index 0000000..00588c6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.many.d
@@ -0,0 +1,311 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option destructive
+#pragma D option quiet
+
+BEGIN
+/0/
+{
+	@agg996[996] = quantize(998);
+	@agg997[997] = count();
+	@agg998[998] = min(998);
+	@agg999[999] = lquantize(0, -10, 10, 1);
+}
+
+BEGIN
+{
+	@agg0[0] = sum(0);
+	@agg1[1] = sum(1);
+	@agg2[2] = sum(2);
+	@agg3[3] = sum(3);
+	@agg4[4] = sum(4);
+	@agg5[5] = sum(5);
+	@agg6[6] = sum(6);
+	@agg7[7] = sum(7);
+	@agg8[8] = sum(8);
+	@agg9[9] = sum(9);
+	@agg10[10] = sum(10);
+	@agg11[11] = sum(11);
+	@agg12[12] = sum(12);
+	@agg13[13] = sum(13);
+	@agg14[14] = sum(14);
+	@agg15[15] = sum(15);
+	@agg16[16] = sum(16);
+	@agg17[17] = sum(17);
+	@agg18[18] = sum(18);
+	@agg19[19] = sum(19);
+	@agg20[20] = sum(20);
+	@agg21[21] = sum(21);
+	@agg22[22] = sum(22);
+	@agg23[23] = sum(23);
+	@agg24[24] = sum(24);
+	@agg25[25] = sum(25);
+	@agg26[26] = sum(26);
+	@agg27[27] = sum(27);
+	@agg28[28] = sum(28);
+	@agg29[29] = sum(29);
+	@agg30[30] = sum(30);
+	@agg31[31] = sum(31);
+	@agg32[32] = sum(32);
+	@agg33[33] = sum(33);
+	@agg34[34] = sum(34);
+	@agg35[35] = sum(35);
+	@agg36[36] = sum(36);
+	@agg37[37] = sum(37);
+	@agg38[38] = sum(38);
+	@agg39[39] = sum(39);
+	@agg40[40] = sum(40);
+	@agg41[41] = sum(41);
+	@agg42[42] = sum(42);
+	@agg43[43] = sum(43);
+	@agg44[44] = sum(44);
+	@agg45[45] = sum(45);
+	@agg46[46] = sum(46);
+	@agg47[47] = sum(47);
+	@agg48[48] = sum(48);
+	@agg49[49] = sum(49);
+	@agg50[50] = sum(50);
+	@agg51[51] = sum(51);
+	@agg52[52] = sum(52);
+	@agg53[53] = sum(53);
+	@agg54[54] = sum(54);
+	@agg55[55] = sum(55);
+	@agg56[56] = sum(56);
+	@agg57[57] = sum(57);
+	@agg58[58] = sum(58);
+	@agg59[59] = sum(59);
+	@agg60[60] = sum(60);
+	@agg61[61] = sum(61);
+	@agg62[62] = sum(62);
+	@agg63[63] = sum(63);
+	@agg64[64] = sum(64);
+	@agg65[65] = sum(65);
+	@agg66[66] = sum(66);
+	@agg67[67] = sum(67);
+	@agg68[68] = sum(68);
+	@agg69[69] = sum(69);
+	@agg70[70] = sum(70);
+	@agg71[71] = sum(71);
+	@agg72[72] = sum(72);
+	@agg73[73] = sum(73);
+	@agg74[74] = sum(74);
+	@agg75[75] = sum(75);
+	@agg76[76] = sum(76);
+	@agg77[77] = sum(77);
+	@agg78[78] = sum(78);
+	@agg79[79] = sum(79);
+	@agg80[80] = sum(80);
+	@agg81[81] = sum(81);
+	@agg82[82] = sum(82);
+	@agg83[83] = sum(83);
+	@agg84[84] = sum(84);
+	@agg85[85] = sum(85);
+	@agg86[86] = sum(86);
+	@agg87[87] = sum(87);
+	@agg88[88] = sum(88);
+	@agg89[89] = sum(89);
+	@agg90[90] = sum(90);
+	@agg91[91] = sum(91);
+	@agg92[92] = sum(92);
+	@agg93[93] = sum(93);
+	@agg94[94] = sum(94);
+	@agg95[95] = sum(95);
+	@agg96[96] = sum(96);
+	@agg97[97] = sum(97);
+	@agg98[98] = sum(98);
+	@agg99[99] = sum(99);
+	@agg100[100] = sum(100);
+	@agg101[101] = sum(101);
+	@agg102[102] = sum(102);
+	@agg103[103] = sum(103);
+	@agg104[104] = sum(104);
+	@agg105[105] = sum(105);
+	@agg106[106] = sum(106);
+	@agg107[107] = sum(107);
+	@agg108[108] = sum(108);
+	@agg109[109] = sum(109);
+	@agg110[110] = sum(110);
+	@agg111[111] = sum(111);
+	@agg112[112] = sum(112);
+	@agg113[113] = sum(113);
+	@agg114[114] = sum(114);
+	@agg115[115] = sum(115);
+	@agg116[116] = sum(116);
+	@agg117[117] = sum(117);
+	@agg118[118] = sum(118);
+	@agg119[119] = sum(119);
+	@agg120[120] = sum(120);
+	@agg121[121] = sum(121);
+	@agg122[122] = sum(122);
+	@agg123[123] = sum(123);
+	@agg124[124] = sum(124);
+	@agg125[125] = sum(125);
+	@agg126[126] = sum(126);
+	@agg127[127] = sum(127);
+	@agg128[128] = sum(128);
+	@agg129[129] = sum(129);
+	@agg130[130] = sum(130);
+	@agg131[131] = sum(131);
+	@agg132[132] = sum(132);
+	@agg133[133] = sum(133);
+	@agg134[134] = sum(134);
+	@agg135[135] = sum(135);
+	@agg136[136] = sum(136);
+	@agg137[137] = sum(137);
+	@agg138[138] = sum(138);
+	@agg139[139] = sum(139);
+	@agg140[140] = sum(140);
+	@agg141[141] = sum(141);
+	@agg142[142] = sum(142);
+	@agg143[143] = sum(143);
+	@agg144[144] = sum(144);
+	@agg145[145] = sum(145);
+	@agg146[146] = sum(146);
+	@agg147[147] = sum(147);
+	@agg148[148] = sum(148);
+	@agg149[149] = sum(149);
+	@agg150[150] = sum(150);
+	@agg151[151] = sum(151);
+	@agg152[152] = sum(152);
+	@agg153[153] = sum(153);
+	@agg154[154] = sum(154);
+	@agg155[155] = sum(155);
+	@agg156[156] = sum(156);
+	@agg157[157] = sum(157);
+	@agg158[158] = sum(158);
+	@agg159[159] = sum(159);
+	@agg160[160] = sum(160);
+	@agg161[161] = sum(161);
+	@agg162[162] = sum(162);
+	@agg163[163] = sum(163);
+	@agg164[164] = sum(164);
+	@agg165[165] = sum(165);
+	@agg166[166] = sum(166);
+	@agg167[167] = sum(167);
+	@agg168[168] = sum(168);
+	@agg169[169] = sum(169);
+	@agg170[170] = sum(170);
+	@agg171[171] = sum(171);
+	@agg172[172] = sum(172);
+	@agg173[173] = sum(173);
+	@agg174[174] = sum(174);
+	@agg175[175] = sum(175);
+	@agg176[176] = sum(176);
+	@agg177[177] = sum(177);
+	@agg178[178] = sum(178);
+	@agg179[179] = sum(179);
+	@agg180[180] = sum(180);
+	@agg181[181] = sum(181);
+	@agg182[182] = sum(182);
+	@agg183[183] = sum(183);
+	@agg184[184] = sum(184);
+	@agg185[185] = sum(185);
+	@agg186[186] = sum(186);
+	@agg187[187] = sum(187);
+	@agg188[188] = sum(188);
+	@agg189[189] = sum(189);
+	@agg190[190] = sum(190);
+	@agg191[191] = sum(191);
+	@agg192[192] = sum(192);
+	@agg193[193] = sum(193);
+	@agg194[194] = sum(194);
+	@agg195[195] = sum(195);
+	@agg196[196] = sum(196);
+	@agg197[197] = sum(197);
+	@agg198[198] = sum(198);
+	@agg199[199] = sum(199);
+	@agg200[200] = sum(200);
+	@agg201[201] = sum(201);
+	@agg202[202] = sum(202);
+	@agg203[203] = sum(203);
+	@agg204[204] = sum(204);
+	@agg205[205] = sum(205);
+	@agg206[206] = sum(206);
+	@agg207[207] = sum(207);
+	@agg208[208] = sum(208);
+	@agg209[209] = sum(209);
+	@agg210[210] = sum(210);
+	@agg211[211] = sum(211);
+	@agg212[212] = sum(212);
+	@agg213[213] = sum(213);
+	@agg214[214] = sum(214);
+	@agg215[215] = sum(215);
+	@agg216[216] = sum(216);
+	@agg217[217] = sum(217);
+	@agg218[218] = sum(218);
+	@agg219[219] = sum(219);
+	@agg220[220] = sum(220);
+	@agg221[221] = sum(221);
+	@agg222[222] = sum(222);
+	@agg223[223] = sum(223);
+	@agg224[224] = sum(224);
+	@agg225[225] = sum(225);
+	@agg226[226] = sum(226);
+	@agg227[227] = sum(227);
+	@agg228[228] = sum(228);
+	@agg229[229] = sum(229);
+	@agg230[230] = sum(230);
+	@agg231[231] = sum(231);
+	@agg232[232] = sum(232);
+	@agg233[233] = sum(233);
+	@agg234[234] = sum(234);
+	@agg235[235] = sum(235);
+	@agg236[236] = sum(236);
+	@agg237[237] = sum(237);
+	@agg238[238] = sum(238);
+	@agg239[239] = sum(239);
+	@agg240[240] = sum(240);
+	@agg241[241] = sum(241);
+	@agg242[242] = sum(242);
+	@agg243[243] = sum(243);
+	@agg244[244] = sum(244);
+	@agg245[245] = sum(245);
+	@agg246[246] = sum(246);
+
+	printa("%8d %8 at d %8 at d\n", @agg0, @agg1);
+	printf("\n");
+
+	printa("%8d %8 at d %8 at d\n", @agg0, @agg996);
+	printf("\n");
+
+	printa("%4d %4 at d %4 at d %4 at d %4 at d %4 at d %4 at d %4 at d %4 at d %4 at d %4 at d %4 at d\n",
+	    @agg12, @agg3, @agg73, @agg997,
+	    @agg9, @agg9, @agg4, @agg998,
+	    @agg11, @agg23, @agg69);
+
+	printf("\n");
+
+	printa("%8d %8 at d %8 at d\n", @agg245, @agg246);
+	printf("\n");
+
+	printa("%8d %8 at d %8 at d\n", @agg999, @agg246);
+	printf("\n");
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.many.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.many.d.out
new file mode 100644
index 0000000..e048d43
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.many.d.out
@@ -0,0 +1,265 @@
+       0        0        0
+       1        0        1
+
+       0        0 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+
+  69    0    0    0    0    0    0    0    0    0    0   69
+  23    0    0    0    0    0    0    0    0    0   23    0
+  11    0    0    0    0    0    0    0    0   11    0    0
+   4    0    0    0    0    0    0    4    0    0    0    0
+   9    0    0    0    0    9    9    0    0    0    0    0
+  73    0    0   73    0    0    0    0    0    0    0    0
+   3    0    3    0    0    0    0    0    0    0    0    0
+  12   12    0    0    0    0    0    0    0    0    0    0
+
+     246        0      246
+     245      245        0
+
+     246 
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |                                         0        
+              -9 |                                         0        
+      246
+
+
+        2                2
+        5                5
+        6                6
+        7                7
+        8                8
+       10               10
+       13               13
+       14               14
+       15               15
+       16               16
+       17               17
+       18               18
+       19               19
+       20               20
+       21               21
+       22               22
+       24               24
+       25               25
+       26               26
+       27               27
+       28               28
+       29               29
+       30               30
+       31               31
+       32               32
+       33               33
+       34               34
+       35               35
+       36               36
+       37               37
+       38               38
+       39               39
+       40               40
+       41               41
+       42               42
+       43               43
+       44               44
+       45               45
+       46               46
+       47               47
+       48               48
+       49               49
+       50               50
+       51               51
+       52               52
+       53               53
+       54               54
+       55               55
+       56               56
+       57               57
+       58               58
+       59               59
+       60               60
+       61               61
+       62               62
+       63               63
+       64               64
+       65               65
+       66               66
+       67               67
+       68               68
+       70               70
+       71               71
+       72               72
+       74               74
+       75               75
+       76               76
+       77               77
+       78               78
+       79               79
+       80               80
+       81               81
+       82               82
+       83               83
+       84               84
+       85               85
+       86               86
+       87               87
+       88               88
+       89               89
+       90               90
+       91               91
+       92               92
+       93               93
+       94               94
+       95               95
+       96               96
+       97               97
+       98               98
+       99               99
+      100              100
+      101              101
+      102              102
+      103              103
+      104              104
+      105              105
+      106              106
+      107              107
+      108              108
+      109              109
+      110              110
+      111              111
+      112              112
+      113              113
+      114              114
+      115              115
+      116              116
+      117              117
+      118              118
+      119              119
+      120              120
+      121              121
+      122              122
+      123              123
+      124              124
+      125              125
+      126              126
+      127              127
+      128              128
+      129              129
+      130              130
+      131              131
+      132              132
+      133              133
+      134              134
+      135              135
+      136              136
+      137              137
+      138              138
+      139              139
+      140              140
+      141              141
+      142              142
+      143              143
+      144              144
+      145              145
+      146              146
+      147              147
+      148              148
+      149              149
+      150              150
+      151              151
+      152              152
+      153              153
+      154              154
+      155              155
+      156              156
+      157              157
+      158              158
+      159              159
+      160              160
+      161              161
+      162              162
+      163              163
+      164              164
+      165              165
+      166              166
+      167              167
+      168              168
+      169              169
+      170              170
+      171              171
+      172              172
+      173              173
+      174              174
+      175              175
+      176              176
+      177              177
+      178              178
+      179              179
+      180              180
+      181              181
+      182              182
+      183              183
+      184              184
+      185              185
+      186              186
+      187              187
+      188              188
+      189              189
+      190              190
+      191              191
+      192              192
+      193              193
+      194              194
+      195              195
+      196              196
+      197              197
+      198              198
+      199              199
+      200              200
+      201              201
+      202              202
+      203              203
+      204              204
+      205              205
+      206              206
+      207              207
+      208              208
+      209              209
+      210              210
+      211              211
+      212              212
+      213              213
+      214              214
+      215              215
+      216              216
+      217              217
+      218              218
+      219              219
+      220              220
+      221              221
+      222              222
+      223              223
+      224              224
+      225              225
+      226              226
+      227              227
+      228              228
+      229              229
+      230              230
+      231              231
+      232              232
+      233              233
+      234              234
+      235              235
+      236              236
+      237              237
+      238              238
+      239              239
+      240              240
+      241              241
+      242              242
+      243              243
+      244              244
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.same.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.same.d
new file mode 100644
index 0000000..0e67557
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.same.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@ = sum(90904);
+	printa("%@d %@d %@d\n", @, @, @);
+	printa("%@d %@d %@d\n", @);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.same.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.same.d.out
new file mode 100644
index 0000000..b382c35
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.same.d.out
@@ -0,0 +1,3 @@
+90904 90904 90904
+90904 90904 90904
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sort.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sort.d
new file mode 100644
index 0000000..7bfd9e5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sort.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+tick-1ms
+{
+	i++;
+	@a[i] = sum(100 - (i / 2));
+	@b[i] = sum(100 - (i / 4));
+	@c[i] = sum(100 - (i / 8));
+	@d[i] = sum(100 - (i / 16));
+}
+
+tick-1ms
+/i == 100/
+{
+	printa("%10d %@10d %@10d %@10d %@10d\n", @a, @b, @c, @d);
+	printa("%10d %@10d %@10d %@10d %@10d\n", @d, @c, @b, @a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sort.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sort.d.out
new file mode 100644
index 0000000..8c79190
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sort.d.out
@@ -0,0 +1,201 @@
+       100         50         75         88         94
+        98         51         76         88         94
+        99         51         76         88         94
+        96         52         76         88         94
+        97         52         76         88         94
+        94         53         77         89         95
+        95         53         77         89         95
+        92         54         77         89         95
+        93         54         77         89         95
+        90         55         78         89         95
+        91         55         78         89         95
+        88         56         78         89         95
+        89         56         78         89         95
+        86         57         79         90         95
+        87         57         79         90         95
+        84         58         79         90         95
+        85         58         79         90         95
+        82         59         80         90         95
+        83         59         80         90         95
+        80         60         80         90         95
+        81         60         80         90         95
+        78         61         81         91         96
+        79         61         81         91         96
+        76         62         81         91         96
+        77         62         81         91         96
+        74         63         82         91         96
+        75         63         82         91         96
+        72         64         82         91         96
+        73         64         82         91         96
+        70         65         83         92         96
+        71         65         83         92         96
+        68         66         83         92         96
+        69         66         83         92         96
+        66         67         84         92         96
+        67         67         84         92         96
+        64         68         84         92         96
+        65         68         84         92         96
+        62         69         85         93         97
+        63         69         85         93         97
+        60         70         85         93         97
+        61         70         85         93         97
+        58         71         86         93         97
+        59         71         86         93         97
+        56         72         86         93         97
+        57         72         86         93         97
+        54         73         87         94         97
+        55         73         87         94         97
+        52         74         87         94         97
+        53         74         87         94         97
+        50         75         88         94         97
+        51         75         88         94         97
+        48         76         88         94         97
+        49         76         88         94         97
+        46         77         89         95         98
+        47         77         89         95         98
+        44         78         89         95         98
+        45         78         89         95         98
+        42         79         90         95         98
+        43         79         90         95         98
+        40         80         90         95         98
+        41         80         90         95         98
+        38         81         91         96         98
+        39         81         91         96         98
+        36         82         91         96         98
+        37         82         91         96         98
+        34         83         92         96         98
+        35         83         92         96         98
+        32         84         92         96         98
+        33         84         92         96         98
+        30         85         93         97         99
+        31         85         93         97         99
+        28         86         93         97         99
+        29         86         93         97         99
+        26         87         94         97         99
+        27         87         94         97         99
+        24         88         94         97         99
+        25         88         94         97         99
+        22         89         95         98         99
+        23         89         95         98         99
+        20         90         95         98         99
+        21         90         95         98         99
+        18         91         96         98         99
+        19         91         96         98         99
+        16         92         96         98         99
+        17         92         96         98         99
+        14         93         97         99        100
+        15         93         97         99        100
+        12         94         97         99        100
+        13         94         97         99        100
+        10         95         98         99        100
+        11         95         98         99        100
+         8         96         98         99        100
+         9         96         98         99        100
+         6         97         99        100        100
+         7         97         99        100        100
+         4         98         99        100        100
+         5         98         99        100        100
+         2         99        100        100        100
+         3         99        100        100        100
+         1        100        100        100        100
+       100         94         88         75         50
+        98         94         88         76         51
+        99         94         88         76         51
+        96         94         88         76         52
+        97         94         88         76         52
+        94         95         89         77         53
+        95         95         89         77         53
+        92         95         89         77         54
+        93         95         89         77         54
+        90         95         89         78         55
+        91         95         89         78         55
+        88         95         89         78         56
+        89         95         89         78         56
+        86         95         90         79         57
+        87         95         90         79         57
+        84         95         90         79         58
+        85         95         90         79         58
+        82         95         90         80         59
+        83         95         90         80         59
+        80         95         90         80         60
+        81         95         90         80         60
+        78         96         91         81         61
+        79         96         91         81         61
+        76         96         91         81         62
+        77         96         91         81         62
+        74         96         91         82         63
+        75         96         91         82         63
+        72         96         91         82         64
+        73         96         91         82         64
+        70         96         92         83         65
+        71         96         92         83         65
+        68         96         92         83         66
+        69         96         92         83         66
+        66         96         92         84         67
+        67         96         92         84         67
+        64         96         92         84         68
+        65         96         92         84         68
+        62         97         93         85         69
+        63         97         93         85         69
+        60         97         93         85         70
+        61         97         93         85         70
+        58         97         93         86         71
+        59         97         93         86         71
+        56         97         93         86         72
+        57         97         93         86         72
+        54         97         94         87         73
+        55         97         94         87         73
+        52         97         94         87         74
+        53         97         94         87         74
+        50         97         94         88         75
+        51         97         94         88         75
+        48         97         94         88         76
+        49         97         94         88         76
+        46         98         95         89         77
+        47         98         95         89         77
+        44         98         95         89         78
+        45         98         95         89         78
+        42         98         95         90         79
+        43         98         95         90         79
+        40         98         95         90         80
+        41         98         95         90         80
+        38         98         96         91         81
+        39         98         96         91         81
+        36         98         96         91         82
+        37         98         96         91         82
+        34         98         96         92         83
+        35         98         96         92         83
+        32         98         96         92         84
+        33         98         96         92         84
+        30         99         97         93         85
+        31         99         97         93         85
+        28         99         97         93         86
+        29         99         97         93         86
+        26         99         97         94         87
+        27         99         97         94         87
+        24         99         97         94         88
+        25         99         97         94         88
+        22         99         98         95         89
+        23         99         98         95         89
+        20         99         98         95         90
+        21         99         98         95         90
+        18         99         98         96         91
+        19         99         98         96         91
+        16         99         98         96         92
+        17         99         98         96         92
+        14        100         99         97         93
+        15        100         99         97         93
+        12        100         99         97         94
+        13        100         99         97         94
+        10        100         99         98         95
+        11        100         99         98         95
+         8        100         99         98         96
+         9        100         99         98         96
+         6        100        100         99         97
+         7        100        100         99         97
+         4        100        100         99         98
+         5        100        100         99         98
+         2        100        100        100         99
+         3        100        100        100         99
+         1        100        100        100        100
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sortpos.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sortpos.d
new file mode 100644
index 0000000..ddb297f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sortpos.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	j = 0;
+}
+
+tick-1ms
+/i < 100/
+{
+	i++;
+	@a[i] = sum(i);
+	@b[i] = sum((25 + i) % 100);
+	@c[i] = sum((50 + i) % 100);
+	@d[i] = sum((75 + i) % 100);
+}
+
+tick-1ms
+/i == 100 && j < 10/
+{
+	printf("Sorted at position %d:\n", j);
+	setopt("aggsortpos", lltostr(j));
+	printa("%9d %@9d %@9d %@9d %@9d %@9d %@9d\n", @a, @b, @c, @a, @d, @a);
+	printf("\n");
+	j++;
+}
+
+tick-1ms
+/i == 100 && j == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sortpos.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sortpos.d.out
new file mode 100644
index 0000000..ce17539
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.sortpos.d.out
@@ -0,0 +1,1021 @@
+Sorted at position 0:
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+
+Sorted at position 1:
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+
+Sorted at position 2:
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+
+Sorted at position 3:
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+
+Sorted at position 4:
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+
+Sorted at position 5:
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+
+Sorted at position 6:
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+
+Sorted at position 7:
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+
+Sorted at position 8:
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+
+Sorted at position 9:
+        1         1        26        51         1        76         1
+        2         2        27        52         2        77         2
+        3         3        28        53         3        78         3
+        4         4        29        54         4        79         4
+        5         5        30        55         5        80         5
+        6         6        31        56         6        81         6
+        7         7        32        57         7        82         7
+        8         8        33        58         8        83         8
+        9         9        34        59         9        84         9
+       10        10        35        60        10        85        10
+       11        11        36        61        11        86        11
+       12        12        37        62        12        87        12
+       13        13        38        63        13        88        13
+       14        14        39        64        14        89        14
+       15        15        40        65        15        90        15
+       16        16        41        66        16        91        16
+       17        17        42        67        17        92        17
+       18        18        43        68        18        93        18
+       19        19        44        69        19        94        19
+       20        20        45        70        20        95        20
+       21        21        46        71        21        96        21
+       22        22        47        72        22        97        22
+       23        23        48        73        23        98        23
+       24        24        49        74        24        99        24
+       25        25        50        75        25         0        25
+       26        26        51        76        26         1        26
+       27        27        52        77        27         2        27
+       28        28        53        78        28         3        28
+       29        29        54        79        29         4        29
+       30        30        55        80        30         5        30
+       31        31        56        81        31         6        31
+       32        32        57        82        32         7        32
+       33        33        58        83        33         8        33
+       34        34        59        84        34         9        34
+       35        35        60        85        35        10        35
+       36        36        61        86        36        11        36
+       37        37        62        87        37        12        37
+       38        38        63        88        38        13        38
+       39        39        64        89        39        14        39
+       40        40        65        90        40        15        40
+       41        41        66        91        41        16        41
+       42        42        67        92        42        17        42
+       43        43        68        93        43        18        43
+       44        44        69        94        44        19        44
+       45        45        70        95        45        20        45
+       46        46        71        96        46        21        46
+       47        47        72        97        47        22        47
+       48        48        73        98        48        23        48
+       49        49        74        99        49        24        49
+       50        50        75         0        50        25        50
+       51        51        76         1        51        26        51
+       52        52        77         2        52        27        52
+       53        53        78         3        53        28        53
+       54        54        79         4        54        29        54
+       55        55        80         5        55        30        55
+       56        56        81         6        56        31        56
+       57        57        82         7        57        32        57
+       58        58        83         8        58        33        58
+       59        59        84         9        59        34        59
+       60        60        85        10        60        35        60
+       61        61        86        11        61        36        61
+       62        62        87        12        62        37        62
+       63        63        88        13        63        38        63
+       64        64        89        14        64        39        64
+       65        65        90        15        65        40        65
+       66        66        91        16        66        41        66
+       67        67        92        17        67        42        67
+       68        68        93        18        68        43        68
+       69        69        94        19        69        44        69
+       70        70        95        20        70        45        70
+       71        71        96        21        71        46        71
+       72        72        97        22        72        47        72
+       73        73        98        23        73        48        73
+       74        74        99        24        74        49        74
+       75        75         0        25        75        50        75
+       76        76         1        26        76        51        76
+       77        77         2        27        77        52        77
+       78        78         3        28        78        53        78
+       79        79         4        29        79        54        79
+       80        80         5        30        80        55        80
+       81        81         6        31        81        56        81
+       82        82         7        32        82        57        82
+       83        83         8        33        83        58        83
+       84        84         9        34        84        59        84
+       85        85        10        35        85        60        85
+       86        86        11        36        86        61        86
+       87        87        12        37        87        62        87
+       88        88        13        38        88        63        88
+       89        89        14        39        89        64        89
+       90        90        15        40        90        65        90
+       91        91        16        41        91        66        91
+       92        92        17        42        92        67        92
+       93        93        18        43        93        68        93
+       94        94        19        44        94        69        94
+       95        95        20        45        95        70        95
+       96        96        21        46        96        71        96
+       97        97        22        47        97        72        97
+       98        98        23        48        98        73        98
+       99        99        24        49        99        74        99
+      100       100        25        50       100        75       100
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.tuplecompat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.tuplecompat.d
new file mode 100644
index 0000000..ebb916a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.tuplecompat.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@one["foo", 789, "bar", curthread] = sum(123);
+	@two["foo", 789, "bar", curthread] = sum(456);
+	printa("%10s %10d %10s %@10d %@10d\n", @one, @two);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.tuplecompat.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.tuplecompat.d.out
new file mode 100644
index 0000000..002f5aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.tuplecompat.d.out
@@ -0,0 +1,2 @@
+       foo        789        bar        123        456
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero.d
new file mode 100644
index 0000000..5a57b2b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+/0/
+{
+	@bop[345] = quantize(0);
+	@baz[345] = lquantize(0, -10, 10, 1);
+}
+
+BEGIN
+{
+	@foo[123] = sum(123);
+	@bar[456] = sum(456);
+
+	@foo[789] = sum(789);
+	@bar[789] = sum(789);
+
+	printa("%10d %@10d %@10d\n", @foo, @bar);
+	printa("%10d %@10d %@10d %@10d\n", @foo, @bar, @bop);
+	printa("%10d %@10d %@10d %@10d %@10d\n", @foo, @bar, @bop, @baz);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero.d.out
new file mode 100644
index 0000000..dde9e41
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero.d.out
@@ -0,0 +1,55 @@
+       456          0        456
+       123        123          0
+       789        789        789
+       456          0        456 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+       123        123          0 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+       789        789        789 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+       456          0        456 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+ 
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |                                         0        
+              -9 |                                         0        
+
+       123        123          0 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+ 
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |                                         0        
+              -9 |                                         0        
+
+       789        789        789 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+ 
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |                                         0        
+              -9 |                                         0        
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero2.d
new file mode 100644
index 0000000..79e756b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero2.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	@bop[345] = quantize(0, 0);
+	@baz[345] = lquantize(0, -10, 10, 1, 0);
+}
+
+BEGIN
+{
+	@foo[123] = sum(123);
+	@bar[456] = sum(456);
+
+	@foo[789] = sum(789);
+	@bar[789] = sum(789);
+
+	printa("%10d %@10d %@10d\n", @foo, @bar);
+	printa("%10d %@10d %@10d %@10d\n", @foo, @bar, @bop);
+	printa("%10d %@10d %@10d %@10d %@10d\n", @foo, @bar, @bop, @baz);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero2.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero2.d.out
new file mode 100644
index 0000000..9b28d8e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero2.d.out
@@ -0,0 +1,72 @@
+       456          0        456
+       123        123          0
+       789        789        789
+       345          0          0 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+       456          0        456 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+       123        123          0 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+       789        789        789 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+
+       345          0          0 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+ 
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |                                         0        
+              -9 |                                         0        
+
+       456          0        456 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+ 
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |                                         0        
+              -9 |                                         0        
+
+       123        123          0 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+ 
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |                                         0        
+              -9 |                                         0        
+
+       789        789        789 
+           value  ------------- Distribution ------------- count    
+              -1 |                                         0        
+               0 |                                         0        
+               1 |                                         0        
+ 
+           value  ------------- Distribution ------------- count    
+           < -10 |                                         0        
+             -10 |                                         0        
+              -9 |                                         0        
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero3.d
new file mode 100644
index 0000000..bc17bc9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero3.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+/0/
+{
+	@bop[345] = quantize(0, 0);
+	@baz[345] = lquantize(0, -10, 10, 1, 0);
+}
+
+BEGIN
+{
+	printa(@bop);
+	printa(@baz);
+	printa("%@10d %@10d\n", @bop, @baz);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero3.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero3.d.out
new file mode 100644
index 0000000..b28b04f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/multiaggs/tst.zero3.d.out
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call.c
new file mode 100644
index 0000000..6194c58
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call.c
@@ -0,0 +1,120 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <strings.h>
+#include <rpc/rpc.h>
+
+#include "rpcsvc/nfs4_prot.h"
+
+int nfs4_skip_bytes;
+
+/*
+ * The waiting() function returns the value passed in, until something
+ * external modifies it.  In this case, the D script tst.call.d will
+ * modify the value of *a, and thus break the while loop in dotest().
+ *
+ * This serves the purpose of not making the RPC calls until tst.call.d
+ * is active.  Thus, the probes in tst.call.d can fire as a result of
+ * the RPC call in dotest().
+ */
+
+int
+waiting(volatile int *a)
+{
+	return (*a);
+}
+
+int
+dotest(void)
+{
+	CLIENT *client;
+	AUTH *auth;
+	COMPOUND4args args;
+	COMPOUND4res res;
+	enum clnt_stat status;
+	struct timeval timeout;
+	nfs_argop4 arg[1];
+	char *tag = "dtrace test";
+	volatile int a = 0;
+
+	while (waiting(&a) == 0)
+		continue;
+
+	timeout.tv_sec = 30;
+	timeout.tv_usec = 0;
+
+	client = clnt_create("localhost", NFS4_PROGRAM, NFS_V4, "tcp");
+	if (client == NULL) {
+		clnt_pcreateerror("test");
+		return (1);
+	}
+	auth = authsys_create_default();
+	client->cl_auth = auth;
+	args.minorversion = 0;
+	args.tag.utf8string_len = strlen(tag);
+	args.tag.utf8string_val = tag;
+	args.argarray.argarray_len = sizeof (arg) / sizeof (nfs_argop4);
+	args.argarray.argarray_val = arg;
+
+	arg[0].argop = OP_PUTROOTFH;
+	/* no need to manipulate nfs_argop4_u */
+
+	bzero(&res, sizeof (res));
+
+	status = clnt_call(client, NFSPROC4_COMPOUND,
+	    xdr_COMPOUND4args, (caddr_t)&args,
+	    xdr_COMPOUND4res, (caddr_t)&res,
+	    timeout);
+	if (status != RPC_SUCCESS) {
+		clnt_perror(client, "test");
+		return (2);
+	}
+
+	return (0);
+}
+
+/*ARGSUSED*/
+int
+main(int argc, char **argv)
+{
+	char shareline[BUFSIZ], unshareline[BUFSIZ];
+	int rc;
+
+	(void) snprintf(shareline, sizeof (shareline),
+	    "mkdir /tmp/nfsv4test.%d ; share /tmp/nfsv4test.%d", getpid(),
+	    getpid());
+	(void) snprintf(unshareline, sizeof (unshareline),
+	    "unshare /tmp/nfsv4test.%d ; rmdir /tmp/nfsv4test.%d", getpid(),
+	    getpid());
+
+	(void) system(shareline);
+	rc = dotest();
+	(void) system(unshareline);
+
+	return (rc);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call.d
new file mode 100644
index 0000000..15cf8bc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call.d
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Make sure nfs provider probes are firing
+ *
+ * SECTION: nfs4 provider
+ */
+
+#pragma D option destructive
+#pragma D option quiet
+
+pid$1:a.out:waiting:entry
+{
+	this->value = (int *)alloca(sizeof (int));
+	*this->value = 1;
+	copyout(this->value, arg0, sizeof (int));
+}
+
+nfsv4:::compound-start
+{
+	cstart++;
+}
+
+nfsv4:::op-putrootfh-start
+{
+	opstart++;
+}
+
+nfsv4:::op-putrootfh-done
+{
+	opdone++;
+}
+
+nfsv4:::compound-done
+/cstart && opstart && opdone/
+{
+	exit(0);
+}
+
+tick-1s
+/tick++ == 3/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call3.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call3.c
new file mode 100644
index 0000000..bd89fff
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call3.c
@@ -0,0 +1,441 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <strings.h>
+#include <rpc/rpc.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <rpcsvc/mount.h>
+
+#include "rpcsvc/nfs_prot.h"
+
+char sharedpath[MAXPATHLEN];
+fhandle3 *rootfh;
+
+/*
+ * The waiting() function returns the value passed in, until something
+ * external modifies it.  In this case, the D script tst.call.d will
+ * modify the value of *a, and thus break the while loop in dotest().
+ *
+ * This serves the purpose of not making the RPC calls until tst.call.d
+ * is active.  Thus, the probes in tst.call.d can fire as a result of
+ * the RPC call in dotest().
+ */
+
+int
+waiting(volatile int *a)
+{
+	return (*a);
+}
+
+static void
+getattr_arginit(void *argp)
+{
+	GETATTR3args *args = argp;
+
+	args->object.data.data_len = rootfh->fhandle3_len;
+	args->object.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+setattr_arginit(void *argp)
+{
+	SETATTR3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->object.data.data_len = rootfh->fhandle3_len;
+	args->object.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+lookup_arginit(void *argp)
+{
+	LOOKUP3args *args = argp;
+
+	args->what.name = "giant-skunk";
+	args->what.dir.data.data_len = rootfh->fhandle3_len;
+	args->what.dir.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+access_arginit(void *argp)
+{
+	ACCESS3args *args = argp;
+
+	args->object.data.data_len = rootfh->fhandle3_len;
+	args->object.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+commit_arginit(void *argp)
+{
+	COMMIT3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->file.data.data_len = rootfh->fhandle3_len;
+	args->file.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+create_arginit(void *argp)
+{
+	CREATE3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->where.name = "pinky-blue";
+	args->where.dir.data.data_len = rootfh->fhandle3_len;
+	args->where.dir.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+fsinfo_arginit(void *argp)
+{
+	FSINFO3args *args = argp;
+
+	args->fsroot.data.data_len = rootfh->fhandle3_len;
+	args->fsroot.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+fsstat_arginit(void *argp)
+{
+	FSSTAT3args *args = argp;
+
+	args->fsroot.data.data_len = rootfh->fhandle3_len;
+	args->fsroot.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+link_arginit(void *argp)
+{
+	LINK3args *args = argp;
+
+	args->file.data.data_len = rootfh->fhandle3_len;
+	args->file.data.data_val = rootfh->fhandle3_val;
+	args->link.dir.data.data_len = rootfh->fhandle3_len;
+	args->link.dir.data.data_val = rootfh->fhandle3_val;
+	args->link.name = "samf";
+}
+
+static void
+mkdir_arginit(void *argp)
+{
+	MKDIR3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->where.dir.data.data_len = rootfh->fhandle3_len;
+	args->where.dir.data.data_val = rootfh->fhandle3_val;
+	args->where.name = "cookie";
+}
+
+static void
+mknod_arginit(void *argp)
+{
+	MKNOD3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->where.dir.data.data_len = rootfh->fhandle3_len;
+	args->where.dir.data.data_val = rootfh->fhandle3_val;
+	args->where.name = "pookie";
+}
+
+static void
+null_arginit(void *argp)
+{
+}
+
+static void
+pathconf_arginit(void *argp)
+{
+	PATHCONF3args *args = argp;
+
+	args->object.data.data_len = rootfh->fhandle3_len;
+	args->object.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+read_arginit(void *argp)
+{
+	READ3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->file.data.data_len = rootfh->fhandle3_len;
+	args->file.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+readdir_arginit(void *argp)
+{
+	READDIR3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->dir.data.data_len = rootfh->fhandle3_len;
+	args->dir.data.data_val = rootfh->fhandle3_val;
+	args->count = 1024;
+}
+
+static void
+readdirplus_arginit(void *argp)
+{
+	READDIRPLUS3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->dir.data.data_len = rootfh->fhandle3_len;
+	args->dir.data.data_val = rootfh->fhandle3_val;
+	args->dircount = 1024;
+	args->maxcount = 1024;
+}
+
+static void
+readlink_arginit(void *argp)
+{
+	READLINK3args *args = argp;
+
+	args->symlink.data.data_len = rootfh->fhandle3_len;
+	args->symlink.data.data_val = rootfh->fhandle3_val;
+}
+
+static void
+remove_arginit(void *argp)
+{
+	REMOVE3args *args = argp;
+
+	args->object.dir.data.data_len = rootfh->fhandle3_len;
+	args->object.dir.data.data_val = rootfh->fhandle3_val;
+	args->object.name = "antelope";
+}
+
+static void
+rename_arginit(void *argp)
+{
+	RENAME3args *args = argp;
+
+	args->from.dir.data.data_len = rootfh->fhandle3_len;
+	args->from.dir.data.data_val = rootfh->fhandle3_val;
+	args->from.name = "walter";
+	args->to.dir.data.data_len = rootfh->fhandle3_len;
+	args->to.dir.data.data_val = rootfh->fhandle3_val;
+	args->to.name = "wendy";
+}
+
+static void
+rmdir_arginit(void *argp)
+{
+	RMDIR3args *args = argp;
+
+	args->object.dir.data.data_len = rootfh->fhandle3_len;
+	args->object.dir.data.data_val = rootfh->fhandle3_val;
+	args->object.name = "bunny";
+}
+
+static void
+symlink_arginit(void *argp)
+{
+	SYMLINK3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->where.dir.data.data_len = rootfh->fhandle3_len;
+	args->where.dir.data.data_val = rootfh->fhandle3_val;
+	args->where.name = "parlor";
+	args->symlink.symlink_data = "interior";
+}
+
+static void
+write_arginit(void *argp)
+{
+	WRITE3args *args = argp;
+
+	bzero(args, sizeof (*args));
+	args->file.data.data_len = rootfh->fhandle3_len;
+	args->file.data.data_val = rootfh->fhandle3_val;
+}
+
+typedef void (*call3_arginit_t)(void *);
+
+typedef struct {
+	call3_arginit_t arginit;
+	rpcproc_t proc;
+	xdrproc_t xdrargs;
+	size_t argsize;
+	xdrproc_t xdrres;
+	size_t ressize;
+} call3_test_t;
+call3_test_t call3_tests[] = {
+	{getattr_arginit, NFSPROC3_GETATTR, xdr_GETATTR3args,
+	    sizeof (GETATTR3args), xdr_GETATTR3res, sizeof (GETATTR3res)},
+	{setattr_arginit, NFSPROC3_SETATTR, xdr_SETATTR3args,
+	    sizeof (SETATTR3args), xdr_SETATTR3res, sizeof (SETATTR3res)},
+	{lookup_arginit, NFSPROC3_LOOKUP, xdr_LOOKUP3args,
+	    sizeof (LOOKUP3args), xdr_LOOKUP3res, sizeof (LOOKUP3res)},
+	{access_arginit, NFSPROC3_ACCESS, xdr_ACCESS3args,
+	    sizeof (ACCESS3args), xdr_ACCESS3res, sizeof (ACCESS3res)},
+	{commit_arginit, NFSPROC3_COMMIT, xdr_COMMIT3args,
+	    sizeof (COMMIT3args), xdr_COMMIT3res, sizeof (COMMIT3res)},
+	{create_arginit, NFSPROC3_CREATE, xdr_CREATE3args,
+	    sizeof (CREATE3args), xdr_CREATE3res, sizeof (CREATE3res)},
+	{fsinfo_arginit, NFSPROC3_FSINFO, xdr_FSINFO3args,
+	    sizeof (FSINFO3args), xdr_FSINFO3res, sizeof (FSINFO3res)},
+	{fsstat_arginit, NFSPROC3_FSSTAT, xdr_FSSTAT3args,
+	    sizeof (FSSTAT3args), xdr_FSSTAT3res, sizeof (FSSTAT3res)},
+	{link_arginit, NFSPROC3_LINK, xdr_LINK3args,
+	    sizeof (LINK3args), xdr_LINK3res, sizeof (LINK3res)},
+	{mkdir_arginit, NFSPROC3_MKDIR, xdr_MKDIR3args,
+	    sizeof (MKDIR3args), xdr_MKDIR3res, sizeof (MKDIR3res)},
+	{mknod_arginit, NFSPROC3_MKNOD, xdr_MKNOD3args,
+	    sizeof (MKNOD3args), xdr_MKNOD3res, sizeof (MKNOD3res)},
+	/*
+	 * NULL proc is special.  Rather than special case its zero-sized
+	 * args/results, we give it a small nonzero size, so as to not
+	 * make realloc() do the wrong thing.
+	 */
+	{null_arginit, NFSPROC3_NULL, xdr_void, sizeof (int), xdr_void,
+	    sizeof (int)},
+	{pathconf_arginit, NFSPROC3_PATHCONF, xdr_PATHCONF3args,
+	    sizeof (PATHCONF3args), xdr_PATHCONF3res, sizeof (PATHCONF3res)},
+	{read_arginit, NFSPROC3_READ, xdr_READ3args,
+	    sizeof (READ3args), xdr_READ3res, sizeof (READ3res)},
+	{readdir_arginit, NFSPROC3_READDIR, xdr_READDIR3args,
+	    sizeof (READDIR3args), xdr_READDIR3res, sizeof (READDIR3res)},
+	{readdirplus_arginit, NFSPROC3_READDIRPLUS, xdr_READDIRPLUS3args,
+	    sizeof (READDIRPLUS3args), xdr_READDIRPLUS3res,
+	    sizeof (READDIRPLUS3res)},
+	{readlink_arginit, NFSPROC3_READLINK, xdr_READLINK3args,
+	    sizeof (READLINK3args), xdr_READLINK3res, sizeof (READLINK3res)},
+	{remove_arginit, NFSPROC3_REMOVE, xdr_REMOVE3args,
+	    sizeof (REMOVE3args), xdr_REMOVE3res, sizeof (REMOVE3res)},
+	{rename_arginit, NFSPROC3_RENAME, xdr_RENAME3args,
+	    sizeof (RENAME3args), xdr_RENAME3res, sizeof (RENAME3res)},
+	{rmdir_arginit, NFSPROC3_RMDIR, xdr_RMDIR3args,
+	    sizeof (RMDIR3args), xdr_RMDIR3res, sizeof (RMDIR3res)},
+	{symlink_arginit, NFSPROC3_SYMLINK, xdr_SYMLINK3args,
+	    sizeof (SYMLINK3args), xdr_SYMLINK3res, sizeof (SYMLINK3res)},
+	{write_arginit, NFSPROC3_WRITE, xdr_WRITE3args,
+	    sizeof (WRITE3args), xdr_WRITE3res, sizeof (WRITE3res)},
+	{NULL}
+};
+
+int
+dotest(void)
+{
+	CLIENT *client, *mountclient;
+	AUTH *auth;
+	struct timeval timeout;
+	caddr_t args, res;
+	enum clnt_stat status;
+	rpcproc_t proc;
+	call3_test_t *test;
+	void *argbuf = NULL;
+	void *resbuf = NULL;
+	struct mountres3 mountres3;
+	char *sp;
+	volatile int a = 0;
+
+	while (waiting(&a) == 0)
+		continue;
+
+	timeout.tv_sec = 30;
+	timeout.tv_usec = 0;
+
+	mountclient = clnt_create("localhost", MOUNTPROG, MOUNTVERS3, "tcp");
+	if (mountclient == NULL) {
+		clnt_pcreateerror("clnt_create mount");
+		return (1);
+	}
+	auth = authsys_create_default();
+	mountclient->cl_auth = auth;
+	sp = sharedpath;
+	bzero(&mountres3, sizeof (mountres3));
+	status = clnt_call(mountclient, MOUNTPROC_MNT,
+	    xdr_dirpath, (char *)&sp,
+	    xdr_mountres3, (char *)&mountres3,
+	    timeout);
+	if (status != RPC_SUCCESS) {
+		clnt_perror(mountclient, "mnt");
+		return (1);
+	}
+	if (mountres3.fhs_status != 0) {
+		fprintf(stderr, "MOUNTPROG/MOUNTVERS3 failed %d\n",
+		    mountres3.fhs_status);
+		return (1);
+	}
+	rootfh = &mountres3.mountres3_u.mountinfo.fhandle;
+
+	client = clnt_create("localhost", NFS3_PROGRAM, NFS_V3, "tcp");
+	if (client == NULL) {
+		clnt_pcreateerror("clnt_create");
+		return (1);
+	}
+	client->cl_auth = auth;
+
+	for (test = call3_tests; test->arginit; ++test) {
+		argbuf = realloc(argbuf, test->argsize);
+		resbuf = realloc(resbuf, test->ressize);
+		if ((argbuf == NULL) || (resbuf == NULL)) {
+			perror("realloc() failed");
+			return (1);
+		}
+		(test->arginit)(argbuf);
+		bzero(resbuf, test->ressize);
+		status = clnt_call(client, test->proc,
+		    test->xdrargs, argbuf,
+		    test->xdrres, resbuf,
+		    timeout);
+		if (status != RPC_SUCCESS)
+			clnt_perror(client, "call");
+	}
+
+	status = clnt_call(mountclient, MOUNTPROC_UMNT,
+	    xdr_dirpath, (char *)&sp,
+	    xdr_void, NULL,
+	    timeout);
+	if (status != RPC_SUCCESS)
+		clnt_perror(mountclient, "umnt");
+
+	return (0);
+}
+
+/*ARGSUSED*/
+int
+main(int argc, char **argv)
+{
+	char shareline[BUFSIZ], unshareline[BUFSIZ];
+	int rc;
+
+	(void) snprintf(sharedpath, sizeof (sharedpath),
+	    "/tmp/nfsv3test.%d", getpid());
+	(void) snprintf(shareline, sizeof (shareline),
+	    "mkdir %s ; share %s", sharedpath, sharedpath);
+	(void) snprintf(unshareline, sizeof (unshareline),
+	    "unshare %s ; rmdir %s", sharedpath, sharedpath);
+
+	(void) system(shareline);
+	rc = dotest();
+	(void) system(unshareline);
+
+	return (rc);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call3.d
new file mode 100644
index 0000000..b635b16
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/nfs/tst.call3.d
@@ -0,0 +1,91 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Make sure nfsv3 provider probes are firing, and that the
+ * arguments are properly visible.
+ *
+ * SECTION: nfs3 provider
+ */
+
+#pragma D option destructive
+#pragma D option quiet
+
+pid$1:a.out:waiting:entry
+{
+	this->value = (int *)alloca(sizeof (int));
+	*this->value = 1;
+	copyout(this->value, arg0, sizeof (int));
+}
+
+nfsv3:::op-getattr-start
+{
+	printf("ci_local: %s\n", args[0]->ci_local);
+	printf("ci_remote: %s\n", args[0]->ci_remote);
+	printf("ci_protocol: %s\n", args[0]->ci_protocol);
+
+	printf("noi_xid: %d\n", args[1]->noi_xid);
+	printf("noi_cred->cr_uid: %d\n", args[1]->noi_cred->cr_uid);
+	printf("noi_curpath: %s\n", args[1]->noi_curpath);
+
+	printf("fh3_flags: %d\n", args[2]->object.fh3_flags);
+}
+
+nfsv3:::op-getattr-done
+{
+	printf("ci_local: %s\n", args[0]->ci_local);
+	printf("ci_remote: %s\n", args[0]->ci_remote);
+	printf("ci_protocol: %s\n", args[0]->ci_protocol);
+
+	printf("noi_xid: %d\n", args[1]->noi_xid);
+	printf("noi_cred->cr_uid: %d\n", args[1]->noi_cred->cr_uid);
+	printf("noi_curpath: %s\n", args[1]->noi_curpath);
+
+	printf("status: %d\n", args[2]->status);
+}
+
+nfsv3:::*-done
+/seen[probename] == 0/
+{
+	++numberseen;
+	seen[probename] = 1;
+	printf("%d ops seen, latest op is %s\n", numberseen, probename);
+}
+
+nfsv3:::*-done
+/numberseen == 22/
+{
+	exit(0);
+}
+
+tick-1s
+/tick++ == 10/
+{
+	printf("%d nfsv3 ops seen; should be 22\n", numberseen);
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_BITFIELD.bitfield.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_BITFIELD.bitfield.d
new file mode 100644
index 0000000..cc48846
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_BITFIELD.bitfield.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Test invocation of offsetof() with a member that is a bit-field.
+ * This should fail at compile time.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+struct foo {
+	int a:1;
+	int b:3;
+};
+
+BEGIN
+{
+	trace(offsetof(struct foo, b));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_TYPE.badtype.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_TYPE.badtype.d
new file mode 100644
index 0000000..4e8a885
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_TYPE.badtype.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Test invocation of offsetof() with an invalid type.
+ * This should fail at compile time.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+BEGIN
+{
+	trace(offsetof(struct no_such_type, x));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_TYPE.notsou.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_TYPE.notsou.d
new file mode 100644
index 0000000..8420953
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_OFFSETOF_TYPE.notsou.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *
+ * Test invocation of offsetof() with a type that is not a struct or union.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+BEGIN
+{
+	trace(offsetof(int, x));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.OffsetofNULL.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.OffsetofNULL.d
new file mode 100644
index 0000000..5a341a3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.OffsetofNULL.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Querying the offsetof an non-member variable of a struct throws
+ * a D_UNKNOWN error.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+#pragma D option quiet
+
+struct record {
+	int a;
+	int b;
+	int c : 4;
+};
+
+BEGIN
+{
+	printf("offsetof (struct record, NULL): %d\n",
+	offsetof (struct record, NULL));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.badmemb.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.badmemb.d
new file mode 100644
index 0000000..caf0a1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/err.D_UNKNOWN.badmemb.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Test invocation of offsetof() with an invalid member.
+ * This should fail at compile time.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+BEGIN
+{
+	trace(offsetof(vnode_t, v_no_such_member));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofAlias.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofAlias.d
new file mode 100644
index 0000000..c7494d2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofAlias.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test invocation of offsetof() with a struct type alias.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+typedef struct record {
+	char c;
+	int x;
+	int y;
+} record_t;
+
+BEGIN
+{
+	printf("offsetof(record_t, c) = %d\n", offsetof(record_t, c));
+	printf("offsetof(record_t, x) = %d\n", offsetof(record_t, x));
+	printf("offsetof(record_t, y) = %d\n", offsetof(record_t, y));
+	exit(0);
+}
+
+END
+/(8 != offsetof(record_t, y)) || (4 != offsetof(record_t, x)) ||
+    (0 != offsetof(record_t, c))/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofArith.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofArith.d
new file mode 100644
index 0000000..7e2b330
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofArith.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: offsetof can be used anywhere in a D program that an integer
+ * constant can be used.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+typedef struct record {
+	char c;
+	int x;
+	int y;
+} record_t;
+
+BEGIN
+{
+
+	add = offsetof(record_t, c) + offsetof(record_t, x) +
+	    offsetof(record_t, y);
+	sub = offsetof(record_t, y) - offsetof(record_t, x);
+	mul = offsetof(record_t, x) * offsetof(record_t, c);
+	div = offsetof(record_t, y) / offsetof(record_t, x);
+
+	printf("offsetof(record_t, c) = %d\n", offsetof(record_t, c));
+	printf("offsetof(record_t, x) = %d\n", offsetof(record_t, x));
+	printf("offsetof(record_t, y) = %d\n", offsetof(record_t, y));
+
+	printf("Addition of offsets (c+x+y)= %d\n", add);
+	printf("Subtraction of offsets (y-x)= %d\n", sub);
+	printf("Multiplication of offsets (x*c) = %d\n", mul);
+	printf("Division of offsets (y/x) = %d\n", div);
+
+	exit(0);
+}
+
+END
+/(8 != offsetof(record_t, y)) || (4 != offsetof(record_t, x)) ||
+    (0 != offsetof(record_t, c)) || (12 != add)  || (4 != sub) || (0 != mul)
+    || (2 != div)/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofUnion.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofUnion.d
new file mode 100644
index 0000000..de1a5fa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.OffsetofUnion.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test invocation of offsetof() with a union type alias.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	int x;
+	int y;
+	char c;
+};
+
+BEGIN
+{
+	printf("offsetof(record, x) = %d\n", offsetof(union D`record, x));
+	printf("offsetof(record, y) = %d\n", offsetof(union D`record, y));
+	printf("offsetof(record, c) = %d\n", offsetof(union D`record, c));
+	exit(0);
+}
+
+END
+/(0 != offsetof(union D`record, y)) && (0 != offsetof(union D`record, x)) &&
+    (0 != offsetof(union D`record, c))/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.struct.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.struct.d
new file mode 100644
index 0000000..60b8863
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.struct.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test invocation of offsetof() with a struct type.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+struct s {
+	int x;
+	int y;
+};
+
+BEGIN
+{
+	printf("offsetof(s, y) = %d\n", offsetof(struct D`s, y));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.struct.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.struct.d.out
new file mode 100644
index 0000000..04b666e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.struct.d.out
@@ -0,0 +1,2 @@
+offsetof(s, y) = 4
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.union.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.union.d
new file mode 100644
index 0000000..1b37c4c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.union.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test invocation of offsetof() with a union type.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+union s {
+	int x;
+	int y;
+};
+
+BEGIN
+{
+	printf("offsetof(s, y) = %d\n", offsetof(union D`s, y));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.union.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.union.d.out
new file mode 100644
index 0000000..e3918be
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/offsetof/tst.union.d.out
@@ -0,0 +1,2 @@
+offsetof(s, y) = 0
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/operators/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/operators/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/operators/tst.ternary.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/operators/tst.ternary.d
new file mode 100644
index 0000000..cd37519
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/operators/tst.ternary.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the ternary operator.  Test left-hand side true, right-hand side true,
+ *  and multiple nested instances of the ternary operator.
+ *
+ * SECTION:  Types, Operators, and Expressions/Conditional Expressions
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	x = 0;
+	printf("x is %s\n", x == 0 ? "zero" : "one");
+	x = 1;
+	printf("x is %s\n", x == 0 ? "zero" : "one");
+	x = 2;
+	printf("x is %s\n", x == 0 ? "zero" : x == 1 ? "one" : "two");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/operators/tst.ternary.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/operators/tst.ternary.d.out
new file mode 100644
index 0000000..ec30800
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/operators/tst.ternary.d.out
@@ -0,0 +1,4 @@
+x is zero
+x is one
+x is two
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.d
new file mode 100644
index 0000000..a3fa24f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: can't specify a bogus library name
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ */
+
+pid$1:libbmc_sucks.so.1::entry
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe
new file mode 100755
index 0000000..595db1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badlib.exe
@@ -0,0 +1,29 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badproc1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badproc1.d
new file mode 100644
index 0000000..3f3ca22
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PDESC_ZERO.badproc1.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Verify that we don't grab bogus process IDs.
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ */
+
+pidgin:::entry
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_BADPID.badproc2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_BADPID.badproc2.d
new file mode 100644
index 0000000..8e01b06
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_BADPID.badproc2.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Make sure we can't grab pid 0
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ */
+
+pid0:::entry
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.d
new file mode 100644
index 0000000..dabcd9c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.d
@@ -0,0 +1,36 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+pid$1:::
+{
+}
+
+BEGIN
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe
new file mode 100755
index 0000000..25b4ff1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_CREATEFAIL.many.exe
@@ -0,0 +1,29 @@
+#!/bin/bash
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.d
new file mode 100644
index 0000000..f1c44e8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Can't specify a bogus function name (if the module is specified)
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ * NOTES:
+ *
+ */
+
+pid$1:a.out:ahl_r00lz:entry
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe
new file mode 100755
index 0000000..595db1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_FUNC.badfunc.exe
@@ -0,0 +1,29 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.d
new file mode 100644
index 0000000..dd90530
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test that the '-' function doesn't work with random modules
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ */
+
+pid$1:libc:-:800
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe
new file mode 100755
index 0000000..595db1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_LIB.libdash.exe
@@ -0,0 +1,29 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.d
new file mode 100644
index 0000000..6acf8aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Verify that you can't enable "all" '-' function probes
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ */
+
+pid$1::-:
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe
new file mode 100755
index 0000000..595db1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.alldash.exe
@@ -0,0 +1,29 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.d
new file mode 100644
index 0000000..829c002
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Only entry, return and offsets are valid names
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ */
+
+pid$1:a.out:main:beginning
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe
new file mode 100755
index 0000000..595db1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.badname.exe
@@ -0,0 +1,29 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.d
new file mode 100644
index 0000000..36bf9d6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Verify that you can't glob the probe name with the '-' function
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ */
+
+pid$1::-:10*
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe
new file mode 100755
index 0000000..595db1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_NAME.globdash.exe
@@ -0,0 +1,29 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.d
new file mode 100644
index 0000000..60e5a8c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Can't have an offset that's outside of a function
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ * NOTES: If _exit(2) becomes _way_ more complex this could fail...
+ *
+ */
+
+pid$1::_exit:100
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe
new file mode 100755
index 0000000..595db1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/err.D_PROC_OFF.toobig.exe
@@ -0,0 +1,29 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.addprobes.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.addprobes.ksh
new file mode 100755
index 0000000..6c269ca
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.addprobes.ksh
@@ -0,0 +1,61 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+#
+# This test verifies that it's possible to add new pid probes to an existing
+# pid provider.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+sleep 60 &
+pid=$!
+
+$dtrace -n pid$pid:libc::entry -n 'tick-1s{exit(0);}'
+status=$?
+
+if [ $status -gt 0 ]; then
+	exit $status;
+fi
+
+$dtrace -n pid$pid:libc::return -n 'tick-1s{exit(0);}'
+status=$?
+
+if [ $status -gt 0 ]; then
+	exit $status;
+fi
+
+kill $pid
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.args1.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.args1.c
new file mode 100644
index 0000000..23bbab2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.args1.c
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <signal.h>
+#include <unistd.h>
+
+int
+go(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6,
+    int arg7, int arg8, int arg9)
+{
+	return (arg1);
+}
+
+static void
+handle(int sig)
+{
+	go(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
+	exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+	(void) signal(SIGUSR1, handle);
+	for (;;)
+		getpid();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.args1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.args1.d
new file mode 100644
index 0000000..a3ad6c9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.args1.d
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: test that all 10 arguments are what we expect them to be.
+ *
+ * SECTION: pid provider
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the first call to getpid(2).
+	 */
+	timeout = timestamp + 1000000000;
+}
+
+syscall::getpid:return
+/pid == $1/
+{
+	i = 0;
+	raise(SIGUSR1);
+	/*
+	 * Wait half a second after raising the signal.
+	 */
+	timeout = timestamp + 500000000;
+}
+
+pid$1:a.out:go:entry
+/arg0 == 0 && arg1 == 1 && arg2 == 2 && arg3 == 3 && arg4 == 4 &&
+arg5 == 5 && arg6 == 6 && arg7 == 7 && arg8 == 8 && arg9 == 9/
+{
+	exit(0);
+}
+
+pid$1:a.out:go:entry
+{
+	printf("wrong args: %d %d %d %d %d %d %d %d %d %d", arg0, arg1, arg2,
+	    arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+	exit(1);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.coverage.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.coverage.d
new file mode 100644
index 0000000..d3d568e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.coverage.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: test that we can trace every instruction safely
+ *
+ * SECTION: pid provider
+ *
+ */
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 2 seconds.
+	 */
+	timeout = timestamp + 2000000000;
+}
+
+pid$1:a.out::
+{}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.coverage.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.coverage.exe
new file mode 100755
index 0000000..07e8458
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.coverage.exe
@@ -0,0 +1,29 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+while true; do env > /dev/null; done
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.d
new file mode 100644
index 0000000..e0fada8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: the stack() action should be empty for all pid probes
+ *
+ * SECTION: pid provider
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	/*
+	 * Monitor the program for two seconds.
+	 */
+	timeout = timestamp + 1000000000 * 2;
+}
+
+pid$1:::return
+{
+	@[stack()] = sum(0);
+}
+
+pid$1:a.out::
+{
+	@[stack()] = sum(0);
+}
+
+pid$1:::entry
+{
+	@[stack()] = sum(0);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.d.out
new file mode 100644
index 0000000..2304a61
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.d.out
@@ -0,0 +1,3 @@
+
+
+                0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe
new file mode 100755
index 0000000..a8bc8cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.emptystack.exe
@@ -0,0 +1,29 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+exec find / > /dev/null 2>&1
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.float.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.float.c
new file mode 100644
index 0000000..450c6aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.float.c
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+
+volatile double c = 1.2;
+
+int
+main(int argc, char **argv)
+{
+	double a = 1.56;
+	double b = (double)argc;
+
+	for (;;) {
+		c *= a;
+		c += b;
+		(void) usleep(1000);
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.float.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.float.d
new file mode 100644
index 0000000..4e11ee3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.float.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Make sure we can work on processes that use the FPU
+ *
+ * SECTION: pid provider
+ */
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+pid$1:a.out:main:
+{}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.fork.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.fork.c
new file mode 100644
index 0000000..d5e90db
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.fork.c
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+
+int
+waiting(volatile int *a)
+{
+	return (*a);
+}
+
+int
+go(void)
+{
+	int i, j, total = 0;
+
+	for (i = 0; i < 10; i++) {
+		for (j = 0; j < 10; j++) {
+			total += i * j;
+		}
+	}
+
+	return (total);
+}
+
+int
+main(int argc, char **argv)
+{
+	volatile int a = 0;
+
+	while (waiting(&a) == 0)
+		continue;
+
+	(void) forkall();
+	(void) go();
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.fork.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.fork.d
new file mode 100644
index 0000000..f1b1197
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.fork.d
@@ -0,0 +1,86 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: make sure fork(2) is okay
+ *
+ * SECTION: pid provider
+ */
+
+#pragma D option destructive
+
+pid$1:a.out:waiting:entry
+{
+	this->value = (int *)alloca(sizeof (int));
+	*this->value = 1;
+	copyout(this->value, arg0, sizeof (int));
+}
+
+proc:::create
+/pid == $1/
+{
+	child = args[0]->pr_pid;
+	trace(pid);
+}
+
+pid$1:a.out:go:
+/pid == child/
+{
+	trace("wrong pid");
+	exit(1);
+}
+
+proc:::exit
+/pid == $1 || pid == child/
+{
+	out++;
+	trace(pid);
+}
+
+proc:::exit
+/out == 2/
+{
+	exit(0);
+}
+
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.gcc.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.gcc.c
new file mode 100644
index 0000000..b97fa9d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.gcc.c
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <spawn.h>
+#include <signal.h>
+
+void
+go(void)
+{
+	pid_t pid;
+
+	(void) posix_spawn(&pid, "/usr/bin/ls", NULL, NULL, NULL, NULL);
+
+	(void) waitpid(pid, NULL, 0);
+}
+
+void
+intr(int sig)
+{
+}
+
+int
+main(int argc, char **argv)
+{
+	struct sigaction sa;
+
+	sa.sa_handler = intr;
+	sigfillset(&sa.sa_mask);
+	sa.sa_flags = 0;
+
+	(void) sigaction(SIGUSR1, &sa, NULL);
+
+	for (;;) {
+		go();
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.gcc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.gcc.d
new file mode 100644
index 0000000..f119098
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.gcc.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: test that we can trace every instruction safely for gcc
+ * compiled apps.
+ *
+ * SECTION: pid provider
+ *
+ */
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 2 seconds.
+	 */
+	timeout = timestamp + 2000000000;
+}
+
+pid$1:a.out::
+{}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.killonerror.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.killonerror.ksh
new file mode 100755
index 0000000..587878c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.killonerror.ksh
@@ -0,0 +1,41 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+#
+# Make sure we kill a process if the dtrace(1M) command fails.
+#
+
+rc=`$dtrace -c date -n jarod 2>/dev/null | /usr/bin/wc -l`
+
+exit $rc
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.main.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.main.ksh
new file mode 100755
index 0000000..b3b9960
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.main.ksh
@@ -0,0 +1,59 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+#
+# Make sure we can trace main:entry properly -- this was problematic because
+# we also set a breakpoint on the same spot in libdtrace.
+#
+
+$dtrace -c date -s /dev/stdin <<EOF
+	BEGIN
+	{
+		status = 1;
+	}
+
+	pid\$target::main:entry
+	{
+		status = 0;
+	}
+
+	END
+	{
+		exit(status);
+	}
+EOF
+
+exit $?
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.manypids.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.manypids.ksh
new file mode 100644
index 0000000..869339b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.manypids.ksh
@@ -0,0 +1,70 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+set -A pids
+
+for lib in `ls -1 /lib/lib*.so.1 | grep -v ld.so.1`; do
+	preload=$lib:${preload}
+done
+
+export LD_PRELOAD=$preload
+
+let numkids=100
+let i=0
+
+tmpfile=/tmp/dtest.$$
+
+while [ "$i" -lt "$numkids" ]; do
+	sleep 500 &
+	pids[$i]=$!
+	let i=i+1
+done
+
+export LD_PRELOAD=
+
+let i=0
+
+echo "tick-1sec\n{\n\texit(0);\n}\n" > $tmpfile
+
+while [ "$i" -lt "$numkids" ]; do
+	echo "pid${pids[$i]}::malloc:entry\n{}\n" >> $tmpfile
+	let i=i+1
+done
+
+$dtrace -s $tmpfile
+status=$?
+
+rm $tmpfile
+pkill sleep
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh
new file mode 100755
index 0000000..35f0391
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh
@@ -0,0 +1,62 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -wZq -x switchrate=100ms -s /dev/stdin <<EOF
+pid*:date::
+{
+	printf("%s:%s\n", probefunc, probename);
+}
+
+tick-1s
+/i++ > 5/
+{
+	exit(0);
+}
+
+tick-1s
+/(i % 2) == 0/
+{
+	system("dtrace -c date -ln 'pid\$target::main:entry' >/dev/null");
+}
+
+tick-1s
+/(i % 2) == 1/
+{
+	system("dtrace -c date -ln 'pid\$target::main:return' >/dev/null");
+}
+EOF
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh.out
new file mode 100644
index 0000000..b2742c4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh.out
@@ -0,0 +1,7 @@
+main:return
+main:entry
+main:return
+main:entry
+main:return
+main:entry
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh
new file mode 100755
index 0000000..326fd1a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.probemod.ksh
@@ -0,0 +1,54 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+#
+# Let's see if we can successfully specify a module using partial
+# matches as well as the full module name. We'll use 'libc.so.1'
+# (and therefore 'libc' and 'libc.so') as it's definitely there.
+#
+
+for lib in libc libc.so libc.so.1 'lib[c]*'; do
+	sleep 60 &
+	pid=$!
+	dtrace -n "pid$pid:$lib::entry" -n 'tick-2s{exit(0);}'
+	status=$?
+
+	kill $pid
+
+	if [ $status -gt 0 ]; then
+		exit $status
+	fi
+done
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh
new file mode 100755
index 0000000..892ff3e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh
@@ -0,0 +1,93 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test verifies that specifying a glob in a pid provider name
+# (e.g., p*d$target) works.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=${TMPDIR:-/tmp}/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > Makefile <<EOF
+all: main
+
+main: main.o
+	cc -o main main.o
+
+main.o: main.c
+	cc -c main.c
+EOF
+
+cat > main.c <<EOF
+void
+go(void)
+{
+}
+
+int
+main(int argc, char **argv)
+{
+	go();
+
+	return (0);
+}
+EOF
+
+make > /dev/null
+if [ $? -ne 0 ]; then
+	print -u2 "failed to build"
+	exit 1
+fi
+
+cat > main.d <<'EOF'
+p*d$target::go:entry
+{
+	printf("%s:%s:%s\n", probemod, probefunc, probename);
+}
+EOF
+
+script() {
+	$dtrace -q -s ./main.d -c ./main
+}
+
+script
+status=$?
+
+cd /tmp
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
new file mode 100755
index 0000000..8d83bdd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
@@ -0,0 +1,131 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test verifies that probes will be picked up after a dlopen(3C)
+# when the pid provider is specified as a glob (e.g., p*d$target.)
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=${TMPDIR:-/tmp}/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > Makefile <<EOF
+all: main altlib.so
+
+main: main.o
+	cc -o main main.o
+
+main.o: main.c
+	cc -c main.c
+
+altlib.so: altlib.o
+	cc -z defs -G -o altlib.so altlib.o -lc
+
+altlib.o: altlib.c
+	cc -c altlib.c
+EOF
+
+cat > altlib.c <<EOF
+void
+go(void)
+{
+}
+EOF
+
+cat > main.c <<EOF
+#include <dlfcn.h>
+#include <unistd.h>
+#include <stdio.h>
+
+void
+go(void)
+{
+}
+
+int
+main(int argc, char **argv)
+{
+	void *alt;
+	void *alt_go;
+
+	go();
+
+	if ((alt = dlopen("./altlib.so", RTLD_LAZY | RTLD_LOCAL)) 
+	    == NULL) {
+		printf("dlopen of altlib.so failed: %s\n", dlerror());
+		return (1);
+	}
+
+	if ((alt_go = dlsym(alt, "go")) == NULL) {
+		printf("failed to lookup 'go' in altlib.so\n");
+		return (1);
+	}
+
+	((void (*)(void))alt_go)();
+
+	return (0);
+}
+EOF
+
+make > /dev/null
+if [ $? -ne 0 ]; then
+	print -u2 "failed to build"
+	exit 1
+fi
+
+cat > main.d <<'EOF'
+p*d$target::go:entry
+{
+	@foo[probemod, probefunc, probename] = count();
+}
+
+END
+{
+	printa("%s:%s:%s %@u\n", at foo);
+}
+EOF
+
+script() {
+	$dtrace -q -s ./main.d -c ./main
+}
+
+script
+status=$?
+
+cd /tmp
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh.out
new file mode 100644
index 0000000..824d898
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh.out
@@ -0,0 +1,3 @@
+altlib.so:go:entry 1
+main:go:entry 1
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
new file mode 100755
index 0000000..c9ac6b1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
@@ -0,0 +1,102 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test verifies that a regex in the provider name will match
+# USDT probes as well as pid probes (e.g., p*d$target matches both 
+# pid$target and pyramid$target.)
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=${TMPDIR:-/tmp}/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > Makefile <<EOF
+	all: main
+
+main: main.o prov.o
+	cc -o main main.o prov.o
+
+main.o: main.c prov.h
+	cc -c main.c
+
+prov.h: prov.d
+	$dtrace -h -s prov.d
+
+prov.o: prov.d main.o
+	$dtrace -G -32 -s prov.d main.o
+EOF
+
+cat > prov.d <<EOF
+provider pyramid {
+	probe entry();
+};
+EOF
+
+cat > main.c <<EOF
+#include <sys/sdt.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	PYRAMID_ENTRY();
+}
+EOF
+
+make > /dev/null
+if [ $? -ne 0 ]; then
+	print -u2 "failed to build"
+	exit 1
+fi
+
+cat > main.d <<'EOF'
+p*d$target::main:entry
+{
+	printf("%s:%s:%s\n", probemod, probefunc, probename);
+}
+EOF
+
+script() {
+	$dtrace -q -s ./main.d -c ./main
+}
+
+script
+status=$?
+
+cd /tmp
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh.out
new file mode 100644
index 0000000..5a8938f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh.out
@@ -0,0 +1,3 @@
+main:main:entry
+main:main:entry
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
new file mode 100755
index 0000000..278ec12
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
@@ -0,0 +1,154 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test verifies that USDT probes will be picked up after a dlopen(3C)
+# when a regex in the provider name matches both USDT probes and pid probes
+# (e.g., p*d$target matches both pid$target and pyramid$target.)
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=${TMPDIR:-/tmp}/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > Makefile <<EOF
+all: main altlib.so
+
+main: main.o provmain.o
+	cc -o main main.o provmain.o
+
+main.o: main.c prov.h
+	cc -c main.c
+
+prov.h: prov.d
+	$dtrace -h -s prov.d
+
+provmain.o: prov.d main.o
+	$dtrace -G -32 -o provmain.o -s prov.d main.o
+
+altlib.so: altlib.o provalt.o
+	cc -z defs -G -o altlib.so altlib.o provalt.o -lc
+
+altlib.o: altlib.c prov.h
+	cc -c altlib.c
+
+provalt.o: prov.d altlib.o
+	$dtrace -G -32 -o provalt.o -s prov.d altlib.o
+EOF
+
+cat > prov.d <<EOF
+provider pyramid {
+	probe entry();
+};
+EOF
+
+cat > altlib.c <<EOF
+#include <sys/sdt.h>
+#include "prov.h"
+
+void
+go(void)
+{
+	PYRAMID_ENTRY();
+}
+EOF
+
+cat > main.c <<EOF
+#include <dlfcn.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/sdt.h>
+#include "prov.h"
+
+void
+go(void)
+{
+	PYRAMID_ENTRY();
+}
+
+int
+main(int argc, char **argv)
+{
+	void *alt;
+	void *alt_go;
+
+	go();
+
+	if ((alt = dlopen("./altlib.so", RTLD_LAZY | RTLD_LOCAL)) 
+	    == NULL) {
+		printf("dlopen of altlib.so failed: %s\n", dlerror());
+		return (1);
+	}
+
+	if ((alt_go = dlsym(alt, "go")) == NULL) {
+		printf("failed to lookup 'go' in altlib.so\n");
+		return (1);
+	}
+
+	((void (*)(void))alt_go)();
+
+	return (0);
+}
+EOF
+
+make > /dev/null
+if [ $? -ne 0 ]; then
+	print -u2 "failed to build"
+	exit 1
+fi
+
+cat > main.d <<'EOF'
+p*d$target::go:entry
+{
+	@foo[probemod, probefunc, probename] = count();
+}
+
+END
+{
+	printa("%s:%s:%s %@u\n", at foo);
+}
+EOF
+
+script() {
+	$dtrace -q -s ./main.d -c ./main
+}
+
+script
+status=$?
+
+cd /tmp
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh.out
new file mode 100644
index 0000000..f471538
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh.out
@@ -0,0 +1,3 @@
+altlib.so:go:entry 2
+main:go:entry 2
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret1.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret1.c
new file mode 100644
index 0000000..cfb88a8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret1.c
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <signal.h>
+#include <unistd.h>
+
+/*
+ * The canonical name should be 'go' since we prefer symbol names with fewer
+ * leading underscores.
+ */
+
+int a = 100;
+
+int
+help(void)
+{
+	return (a);
+}
+
+int
+go(void)
+{
+	return (help() + 1);
+}
+
+static void
+handle(int sig)
+{
+	go();
+	exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+	(void) signal(SIGUSR1, handle);
+	for (;;)
+		getpid();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret1.d
new file mode 100644
index 0000000..0305d09
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret1.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: test that we get the right return value from non-leaf returns
+ *
+ * SECTION: pid provider
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the first call to getpid(2).
+	 */
+	timeout = timestamp + 1000000000;
+}
+
+syscall::getpid:return
+/pid == $1/
+{
+	i = 0;
+	raise(SIGUSR1);
+	/*
+	 * Wait half a second after raising the signal.
+	 */
+	timeout = timestamp + 500000000;
+}
+
+pid$1:a.out:go:return
+/arg1 == 101/
+{
+	exit(0);
+}
+
+pid$1:a.out:go:return
+{
+	printf("wrong return value: %d", arg1);
+	exit(1);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret2.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret2.c
new file mode 100644
index 0000000..b64aa05
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret2.c
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <signal.h>
+#include <unistd.h>
+
+/*
+ * The canonical name should be 'go' since we prefer symbol names with fewer
+ * leading underscores.
+ */
+
+int a = 100;
+
+int
+go(void)
+{
+	return (a);
+}
+
+static void
+handle(int sig)
+{
+	go();
+	exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+	(void) signal(SIGUSR1, handle);
+	for (;;)
+		getpid();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret2.d
new file mode 100644
index 0000000..0232948
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.ret2.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: test that we get the right return value from leaf returns
+ *
+ * SECTION: pid provider
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the first call to getpid(2).
+	 */
+	timeout = timestamp + 1000000000;
+}
+
+syscall::getpid:return
+/pid == $1/
+{
+	i = 0;
+	raise(SIGUSR1);
+	/*
+	 * Wait half a second after raising the signal.
+	 */
+	timeout = timestamp + 500000000;
+}
+
+pid$1:a.out:go:return
+/arg1 == 100/
+{
+	exit(0);
+}
+
+pid$1:a.out:go:return
+{
+	printf("wrong return value: %d", arg1);
+	exit(1);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.vfork.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.vfork.c
new file mode 100644
index 0000000..76fa711
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.vfork.c
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+
+int
+waiting(volatile int *a)
+{
+	return (*a);
+}
+
+int
+go(void)
+{
+	int i, j, total = 0;
+
+	for (i = 0; i < 10; i++) {
+		for (j = 0; j < 10; j++) {
+			total += i * j;
+		}
+	}
+
+	return (total);
+}
+
+int
+main(int argc, char **argv)
+{
+	volatile int a = 0;
+
+	while (waiting(&a) == 0)
+		continue;
+
+	if (vfork() == 0) {
+		int ret = go();
+		(void) _exit(ret);
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.vfork.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.vfork.d
new file mode 100644
index 0000000..b31bb7f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.vfork.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: make sure probes called from a vfork(2) child fire in the parent
+ *
+ * SECTION: pid provider
+ */
+
+#pragma D option destructive
+
+pid$1:a.out:waiting:entry
+{
+	this->value = (int *)alloca(sizeof (int));
+	*this->value = 1;
+	copyout(this->value, arg0, sizeof (int));
+}
+
+proc:::create
+/pid == $1/
+{
+	child = args[0]->pr_pid;
+}
+
+pid$1:a.out:go:
+/child != pid/
+{
+	printf("wrong pid (%d %d)", pid, child);
+	exit(1);
+}
+
+syscall::rexit:entry
+/pid == $1/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak1.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak1.c
new file mode 100644
index 0000000..1418f2a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak1.c
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <signal.h>
+#include <unistd.h>
+
+/*
+ * The canonical name should be 'go' since we prefer symbol names with fewer
+ * leading underscores.
+ */
+
+#pragma weak _go = go
+
+int
+go(int a)
+{
+	return (a + 1);
+}
+
+static void
+handle(int sig)
+{
+	_go(1);
+	exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+	(void) signal(SIGUSR1, handle);
+	for (;;)
+		getpid();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak1.d
new file mode 100644
index 0000000..458eada
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak1.d
@@ -0,0 +1,83 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: test that we prefer symbols with fewer underscores
+ *
+ * SECTION: pid provider
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the first call to getpid(2).
+	 */
+	timeout = timestamp + 1000000000;
+}
+
+syscall::getpid:return
+/pid == $1/
+{
+	i = 0;
+	raise(SIGUSR1);
+	/*
+	 * Wait half a second after raising the signal.
+	 */
+	timeout = timestamp + 500000000;
+}
+
+pid$1:a.out:go:entry,
+pid$1:a.out:_go:entry
+/probefunc == "go"/
+{
+	i++;
+}
+
+pid$1:a.out:go:entry,
+pid$1:a.out:_go:entry
+/probefunc == "_go"/
+{
+	trace("resolved to '_go' rather than 'go'");
+	exit(1);
+}
+
+pid$1:a.out:go:entry,
+pid$1:a.out:_go:entry
+/i == 2/
+{
+	exit(0);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak2.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak2.c
new file mode 100644
index 0000000..8dabbe6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak2.c
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <signal.h>
+#include <unistd.h>
+
+/*
+ * The canonical name should be 'go' since we prefer symbol names with fewer
+ * leading underscores.
+ */
+
+#pragma weak _go = go
+
+static int
+go(int a)
+{
+	return (a + 1);
+}
+
+static void
+handle(int sig)
+{
+	_go(1);
+	exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+	(void) signal(SIGUSR1, handle);
+	for (;;)
+		getpid();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak2.d
new file mode 100644
index 0000000..e3688b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pid/tst.weak2.d
@@ -0,0 +1,83 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: check that we prefer weak symbols to local ones
+ *
+ * SECTION: pid provider
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the first call to getpid(2).
+	 */
+	timeout = timestamp + 1000000000;
+}
+
+syscall::getpid:return
+/pid == $1/
+{
+	i = 0;
+	raise(SIGUSR1);
+	/*
+	 * Wait half a second after raising the signal.
+	 */
+	timeout = timestamp + 500000000;
+}
+
+pid$1:a.out:go:entry,
+pid$1:a.out:_go:entry
+/probefunc == "_go"/
+{
+	i++;
+}
+
+pid$1:a.out:go:entry,
+pid$1:a.out:_go:entry
+/probefunc == "go"/
+{
+	trace("resolved to '_go' rather than 'go'");
+	exit(1);
+}
+
+pid$1:a.out:go:entry,
+pid$1:a.out:_go:entry
+/i == 2/
+{
+	exit(0);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.available.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.available.d
new file mode 100644
index 0000000..6fc9f2f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.available.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: make sure the plockstat probes are present in libc.
+ */
+
+plockstat$1:libc.so.1::
+{}
+
+profile:::tick-1
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.available.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.available.exe
new file mode 100755
index 0000000..221e8b1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.available.exe
@@ -0,0 +1,29 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 100000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.libmap.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.libmap.d
new file mode 100644
index 0000000..5f755b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.libmap.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: make sure the plockstat probes are present in libc.
+ */
+
+plockstat$1:libc::
+{}
+
+profile:::tick-1
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe
new file mode 100755
index 0000000..221e8b1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/plockstat/tst.libmap.exe
@@ -0,0 +1,29 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 100000000
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
new file mode 100644
index 0000000..ab4106d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: This test reproduces the alignment error.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	x = (int *) 64;
+	y = *x;
+	trace(y);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.ArrayVar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.ArrayVar.d
new file mode 100644
index 0000000..b683208
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.ArrayVar.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Trying to access the address of a user defined array variable should throw
+ * a D_ADDROF_VAR error.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Address Spaces
+ */
+
+#pragma D option quiet
+
+int a[5];
+int *p;
+
+BEGIN
+{
+	p = &a;
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.DynamicVar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.DynamicVar.d
new file mode 100644
index 0000000..028a30a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.DynamicVar.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Trying to access the address of a user defined dynamic variable should throw
+ * a D_ADDROF_VAR error.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ * SECTION: Pointers and Arrays/Pointers to Dtrace Objects
+ */
+
+#pragma D option quiet
+
+int i;
+int *p;
+
+BEGIN
+{
+	i = 10;
+	p = &i;
+
+	printf("Integer: %d, Pointer: %d\n", i, *p);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.agg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.agg.d
new file mode 100644
index 0000000..8b59262
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_ADDROF_VAR.agg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test that the & operator fails with D_ADDROF_VAR if its operand
+ *  is a dynamic variable such as an aggregation.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ * SECTION: Pointers and Arrays/Pointers to Dtrace Objects
+ */
+
+BEGIN
+{
+	@a = count();
+	trace(&@a);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_NONPTR.noptr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_NONPTR.noptr.d
new file mode 100644
index 0000000..96d25b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_NONPTR.noptr.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Can not dereference non-pointers
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int x;
+
+BEGIN
+{
+	b = *x;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_VOID.VoidPointerDeref.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_VOID.VoidPointerDeref.d
new file mode 100644
index 0000000..f2fa5b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_DEREF_VOID.VoidPointerDeref.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Cannot dereference a void * pointer.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ */
+
+#pragma D option quiet
+
+void *p;
+
+int array[3];
+
+BEGIN
+{
+	array[0] = 234;
+	array[1] = 334;
+	array[2] = 434;
+
+	p = &array[0];
+
+	printf("array[0]: %d, p: %d\n", array[0], *p);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_ARRFUN.ArrayAssignment.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_ARRFUN.ArrayAssignment.d
new file mode 100644
index 0000000..94814a7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_ARRFUN.ArrayAssignment.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Arrays may not be assigned as a whole in D.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array1[3];
+int array2[3];
+
+BEGIN
+{
+	array1[0] = 200;
+	array1[1] = 400;
+	array1[2] = 600;
+
+	array2[0] = 300;
+	array2[1] = 500;
+	array2[2] = 700;
+
+	array2 = array1;
+
+	printf("array1[0]: %d\tarray2[0]: %d\n", array1[0], array2[0]);
+	printf("array1[1]: %d\tarray2[1]: %d\n", array1[1], array2[1]);
+	printf("array1[2]: %d\tarray2[2]: %d\n", array1[2], array2[2]);
+
+	exit(0);
+
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_INCOMPAT.VoidPointerArith.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_INCOMPAT.VoidPointerArith.d
new file mode 100644
index 0000000..e81c2bd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_INCOMPAT.VoidPointerArith.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * May not apply pointer arithmetic to an object of type  void *
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ */
+
+#pragma D option quiet
+
+void *p;
+
+BEGIN
+{
+	printf("p: %d\n", (int) p);
+	printf("p+1: %d\n", (int) (p+1));
+	printf("p+2: %d\n", (int) (p+2));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_LVAL.AddressChange.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_LVAL.AddressChange.d
new file mode 100644
index 0000000..9828240
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_LVAL.AddressChange.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: D pointers do not allow invalid address changes.
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	&`kmem_flags = (int *) 0x185ede4;
+	printf("Address of kmem_flags: %d\n", (int) kmemAddress);
+	printf("Value of kmem_flags: %d\n", `kmem_flags);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.NonPointerAccess.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.NonPointerAccess.d
new file mode 100644
index 0000000..6f25327
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.NonPointerAccess.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Accessing the members of a struct using the pointer notation using a
+ * nonpointer variable throws a D_OP_PTR error.
+ *
+ * SECTION: Structs and Unions/Pointers to Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct myinput_struct {
+	int i;
+	char c;
+};
+
+struct myinput_struct f;
+
+BEGIN
+{
+	f.i = 10;
+	f.c = 'c';
+
+	printf("f->i: %d\tf->c: %c\n", f->i, f->c);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.badpointer.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.badpointer.d
new file mode 100644
index 0000000..b1524e5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_PTR.badpointer.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	-> can only be used with pointer operands.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Address Spaces
+ */
+
+#pragma D option quiet
+
+struct teststruct {
+	int a;
+	int b;
+};
+
+struct teststruct xyz;
+
+BEGIN
+{
+	xyz->a = 1;
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.BadPointerAccess.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.BadPointerAccess.d
new file mode 100644
index 0000000..7563577
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.BadPointerAccess.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Accessing a pointer to a struct like a non pointer throws a D_OP_SOU.
+ *
+ * SECTION: Structs and Unions/Pointers to Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct myinput_struct {
+	int i;
+	char c;
+};
+
+struct myinput_struct *f;
+BEGIN
+{
+	f.i = 10;
+	f.c = 'c';
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.badpointer.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.badpointer.d
new file mode 100644
index 0000000..1b351f3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.D_OP_SOU.badpointer.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	-> can only be used with pointer to structs and unions.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Address Spaces
+ */
+
+#pragma D option quiet
+
+int *abc;
+
+BEGIN
+{
+	abc->a = 1;
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress1.d
new file mode 100644
index 0000000..9c9d2f0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress1.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: D pointers do not allow invalid pointer accesses.
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	kmemAddress = &`kmem_flags;
+	*kmemAddress = 20;
+	printf("Address of kmem_flags: %d\n", (int) kmemAddress);
+	printf("Value of kmem_flags: %d\n", `kmem_flags);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
new file mode 100644
index 0000000..324f401
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: D pointers do not allow invalid pointer accesses.
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	x = (int *)alloca(sizeof (int));
+	trace(x);
+	y = (int *) (x - 3300778156056);
+	*y = 3;
+	trace(*y);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
new file mode 100644
index 0000000..39bd114
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: D pointers do not allow invalid pointer accesses.
+ *
+ * SECTION: Pointers and Arrays/Pointer Safety
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	y = (int *) (-33007);
+	*y = 3;
+	trace(*y);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d
new file mode 100644
index 0000000..9d6b144
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Demonstrating valid memory access.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	x = (int *)alloca(sizeof (int));
+	printf("Address x: %x\n", (int) x);
+	y = (int *) (x - 2);
+	*y = 3;
+	printf("Address y: %x\tValue: %d\n", (int) y, *y);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d
new file mode 100644
index 0000000..64b7728
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress5.d
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using integer arithmetic providing a non-aligned memory address will throw
+ * a runtime error.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ *
+ * NOTES:
+ * This test doesn't apply to x86; for the time being, we're working
+ * around this with the preprocessor.
+ */
+
+#pragma D option quiet
+
+int array[3];
+uintptr_t uptr;
+int *p;
+int *q;
+int *r;
+
+BEGIN
+{
+#ifdef __i386
+	exit(1);
+#else
+	array[0] = 20;
+	array[1] = 40;
+	array[2] = 80;
+
+	uptr = (uintptr_t) &array[0];
+
+	p = (int *) (uptr);
+	q = (int *) (uptr + 2);
+	r = (int *) (uptr + 3);
+
+	printf("array[0]: %d\t*p: %d\n", array[0], *p);
+	printf("array[1]: %d\t*q: %d\n", array[1], *q);
+	printf("array[2]: %d\t*r: %d\n", array[2], *r);
+
+	exit(0);
+#endif
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer1.d
new file mode 100644
index 0000000..fb9db75
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer1.d
@@ -0,0 +1,174 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Declare arrays of different data types and verify that the
+ * addresses of the individual elements differ by an amount equal to the number
+ * elements separating them multiplied by the size of each element.
+ *
+ * SECTION: Pointers and Arrays/Array Declarations and Storage;
+ * 	Pointers and Arrays/Pointer Arithmetic
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+char char_array[5];
+short short_array[5];
+int int_array[5];
+long long_array[5];
+long long long_long_array[5];
+int8_t int8_array[5];
+int16_t int16_array[5];
+int32_t int32_array[5];
+int64_t int64_array[5];
+intptr_t intptr_array[5];
+uint8_t uint8_array[5];
+uint16_t uint16_array[5];
+uint32_t uint32_array[5];
+uint64_t uint64_array[5];
+uintptr_t uintptr_array[5];
+
+/*
+float float_array[5];
+double double_array[5];
+long double long_double_array[5];
+
+string string_array[5];
+*/
+
+struct record {
+	char ch;
+	int in;
+} struct_array[5];
+
+struct {
+	char ch;
+	int in;
+} anon_struct_array[5];
+
+union record {
+	char ch;
+	int in;
+} union_array[5];
+
+union {
+	char ch;
+	int in;
+} anon_union_array[5];
+
+enum colors {
+	RED,
+	GREEN,
+	BLUE
+} enum_array[5];
+
+BEGIN
+{
+	char_var0 = &char_array[0]; char_var2 = &char_array[2];
+	short_var0 = &short_array[0]; short_var3 = &short_array[3];
+	int_var3 = &int_array[3]; int_var5 = &int_array[5];
+
+	long_var0 = &long_array[0]; long_var4 = &long_array[4];
+	long_long_var0 = &long_long_array[0];
+	long_long_var2 = &long_long_array[2];
+	int8_var3 = &int8_array[3]; int8_var5 = &int8_array[5];
+
+	int16_var0 = &int16_array[0]; int16_var4 = &int16_array[4];
+	int32_var0 = &int32_array[0]; int32_var3 = &int32_array[3];
+	int64_var0 = &int64_array[0]; int64_var1 = &int64_array[1];
+
+	uintptr_var0 = &uintptr_array[0]; uintptr_var2 = &uintptr_array[2];
+	struct_var0 = &struct_array[0]; struct_var2 = &struct_array[2];
+	anon_struct_var3 = &anon_struct_array[3];
+	anon_struct_var5 = &anon_struct_array[5];
+
+	union_var0 = &union_array[0]; union_var3 = &union_array[3];
+	anon_union_var0 = &anon_union_array[0];
+	anon_union_var4 = &anon_union_array[4];
+	enum_var0 = &enum_array[0]; enum_var2 = &enum_array[2];
+
+	printf("char_var2 - char_var0: %d\n",
+	(int) char_var2 - (int) char_var0);
+	printf("short_var3 - short_var0: %d\n",
+	(int) short_var3 - (int) short_var0);
+	printf("int_var5 - int_var3: %d\n", (int) int_var5 - (int) int_var3);
+
+	printf("long_var4 - long_var0: %d\n",
+	(int) long_var4 - (int) long_var0);
+	printf("long_long_var2 - long_long_var0: %d\n",
+	(int) long_long_var2 - (int) long_long_var0);
+	printf("int8_var5 - int8_var3: %d\n",
+	(int) int8_var5 - (int) int8_var3);
+
+	printf("int16_var4 - int16_var0: %d\n",
+	(int) int16_var4 - (int) int16_var0);
+	printf("int32_var3 - int32_var0: %d\n",
+	(int) int32_var3 - (int) int32_var0);
+	printf("int64_var1 - int64_var0: %d\n",
+	(int) int64_var1 - (int) int64_var0);
+
+	printf("uintptr_var2 - uintptr_var0: %d\n",
+	(int) uintptr_var2 - (int) uintptr_var0);
+	printf("struct_var2 - struct_var0: %d\n",
+	(int) struct_var2 - (int) struct_var0);
+	printf("anon_struct_var5 - anon_struct_var3: %d\n",
+	(int) anon_struct_var5 - (int) anon_struct_var3);
+
+	printf("union_var3 - union_var0: %d\n",
+	(int) union_var3 - (int) union_var0);
+	printf("anon_union_var4 - anon_union_var0: %d\n",
+	(int) anon_union_var4 - (int) anon_union_var0);
+	printf("enum_var2 - enum_var0: %d\n",
+	(int) enum_var2 - (int) enum_var0);
+	exit(0);
+}
+
+END
+/(2 != ((int) char_var2 - (int) char_var0)) ||
+    (6 != ((int) short_var3 - (int) short_var0)) ||
+    (8 != ((int) int_var5 - (int) int_var3)) ||
+    ((32 != ((int) long_var4 - (int) long_var0)) &&
+    (16 != ((int) long_var4 - (int) long_var0))) ||
+    (16 != ((int) long_long_var2 - (int) long_long_var0)) ||
+    (2 != ((int) int8_var5 - (int) int8_var3))
+    || (8 != ((int) int16_var4 - (int) int16_var0)) ||
+    (12 != ((int) int32_var3 - (int) int32_var0)) ||
+    (8 != ((int) int64_var1 - (int) int64_var0)) ||
+    ((16 != ((int) uintptr_var2 - (int) uintptr_var0))
+    && (8 != ((int) uintptr_var2 - (int) uintptr_var0))) ||
+    (16 != ((int) struct_var2 - (int) struct_var0)) ||
+    (16 != ((int) anon_struct_var5 - (int) anon_struct_var3))
+    || (12 != ((int) union_var3 - (int) union_var0)) ||
+    (16 != ((int) anon_union_var4 - (int) anon_union_var0)) ||
+    (8 != ((int) enum_var2 - (int) enum_var0))/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer2.d
new file mode 100644
index 0000000..bf64539
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer2.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: D permits the use of array [] index notation with both pointer
+ * variables and array variables.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[5];
+BEGIN
+{
+	array[0] = 100;
+	array[1] = 200;
+	array[2] = 300;
+	array[3] = 400;
+	array[4] = 500;
+
+	p = &array[0];
+
+	printf("array[0]: %d\tp[0]: %d\n", array[0], p[0]);
+	printf("array[1]: %d\tp[1]: %d\n", array[1], p[1]);
+	printf("array[2]: %d\tp[2]: %d\n", array[2], p[2]);
+	printf("array[3]: %d\tp[3]: %d\n", array[3], p[3]);
+	printf("array[4]: %d\tp[4]: %d\n", array[4], p[4]);
+
+	exit(0);
+
+}
+
+END
+/(array[0] != p[0]) || (array[1] != p[1]) || (array[2] != p[2]) ||
+    (array[3] != p[3]) || (array[4] != p[4])/
+{
+	printf("Error");
+	exit(1);
+}
+
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer3.d
new file mode 100644
index 0000000..a0be130
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ArrayPointer3.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: In D, the an array variable can be assigned to a pointer.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[5];
+int *p;
+
+BEGIN
+{
+	array[0] = 100;
+	array[1] = 200;
+	array[2] = 300;
+	array[3] = 400;
+	array[4] = 500;
+
+	p = array;
+
+	printf("array[0]: %d\tp[0]: %d\n", array[0], p[0]);
+	printf("array[1]: %d\tp[1]: %d\n", array[1], p[1]);
+	printf("array[2]: %d\tp[2]: %d\n", array[2], p[2]);
+	printf("array[3]: %d\tp[3]: %d\n", array[3], p[3]);
+	printf("array[4]: %d\tp[4]: %d\n", array[4], p[4]);
+
+	exit(0);
+
+}
+
+END
+/(array[0] != p[0]) || (array[1] != p[1]) || (array[2] != p[2]) ||
+    (array[3] != p[3]) || (array[4] != p[4])/
+{
+	printf("Error");
+	exit(1);
+}
+
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.GlobalVar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.GlobalVar.d
new file mode 100644
index 0000000..8b7f36e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.GlobalVar.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Pointer declarations are global.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+	kmemAddress = &`kmem_flags;
+	kmemValue = *kmemAddress;
+	printf("Address of kmem_flags: %x\n", (int) kmemAddress);
+	printf("Value of kmem_flags: %d\n", kmemValue);
+}
+
+profile:::tick-1sec
+/(i < 1) && (&`kmem_flags == kmemAddress) && (*kmemAddress == kmemValue)/
+{
+	exit(1);
+}
+
+END
+/(&`kmem_flags == kmemAddress) && (*kmemAddress == kmemValue)/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.IntegerArithmetic1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.IntegerArithmetic1.d
new file mode 100644
index 0000000..99cbd7e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.IntegerArithmetic1.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Integer arithmetic can be performed on pointers by casting to uintptr_t.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[3];
+uintptr_t uptr;
+int *p;
+int *q;
+int *r;
+
+BEGIN
+{
+	array[0] = 20;
+	array[1] = 40;
+	array[2] = 80;
+
+	uptr = (uintptr_t) &array[0];
+
+	p = (int *) (uptr);
+	q = (int *) (uptr + 4);
+	r = (int *) (uptr + 8);
+
+	printf("array[0]: %d\t*p: %d\n", array[0], *p);
+	printf("array[1]: %d\t*q: %d\n", array[1], *q);
+	printf("array[2]: %d\t*r: %d\n", array[2], *r);
+
+	exit(0);
+}
+
+END
+/(20 != *p) || (40 != *q) || (80 != *r)/
+{
+	printf("Error");
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic1.d
new file mode 100644
index 0000000..3a96832
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic1.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Pointer arithmetic implicitly adjusts the underlying address by
+ * multiplying or dividing the operands by the size of the type referenced
+ * by the pointer.
+ *
+ * SECTION: Pointers and Arrays/Pointer Arithmetic
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int *x;
+
+BEGIN
+{
+	printf("x: %x\n", (int) x);
+	printf("x + 1: %x\n", (int) (x+1));
+	printf("x + 2: %x\n", (int) (x+2));
+	exit(0);
+}
+
+END
+/(0 != (int) x) || (4 != (int) (x+1)) || (8 != (int) (x+2))/
+{
+	printf("Error");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic2.d
new file mode 100644
index 0000000..ac55eb4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic2.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * D pointers can be used to refer to consecutive storage locations like
+ * arrays.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[5];
+BEGIN
+{
+	array[0] = 100;
+	array[1] = 200;
+	array[2] = 300;
+	array[3] = 400;
+	array[4] = 500;
+
+	p = &array[0];
+
+	printf("array[0]: %d\t*p: %d\n", array[0], *p);
+	printf("array[1]: %d\t*(p+1): %d\n", array[1], *(p+1));
+	printf("array[2]: %d\t*(p+2): %d\n", array[2], *(p+2));
+	printf("array[3]: %d\t*(p+3): %d\n", array[3], *(p+3));
+	printf("array[4]: %d\t*(p+4): %d\n", array[4], *(p+4));
+
+	exit(0);
+
+}
+
+END
+/(array[0] != *p) || (array[1] != *(p+1)) || (array[2] != *(p+2))
+    || (array[3] != *(p+3)) || (array[4] != *(p+4))/
+{
+	printf("Error");
+	exit(1);
+}
+
+
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic3.d
new file mode 100644
index 0000000..a4f4bfc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerArithmetic3.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Pointer arithmetic implicitly adjusts the underlying address by
+ * multiplying or dividing the operands by the size of the type referenced
+ * by the pointer.
+ *
+ * SECTION: Pointers and Arrays/Pointer Arithmetic
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int *x;
+int *y;
+int a[5];
+
+BEGIN
+{
+	x = &a[0];
+	y = &a[2];
+
+	printf("y-x: %x\n", (int) (y-x));
+	exit(0);
+}
+
+END
+/(2 != (int) (y-x)) /
+{
+	printf("Error");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerAssignment.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerAssignment.d
new file mode 100644
index 0000000..3a49686
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.PointerAssignment.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Pointers assignment simply copies over the pointer address in the
+ * variable on the right hand side into the variable on the left hand side.
+ *
+ * SECTION: Pointers and Arrays/Pointer and Array Relationship
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+int array[3];
+int *ptr1;
+int *ptr2;
+
+BEGIN
+{
+	array[0] = 200;
+	array[1] = 400;
+	array[2] = 600;
+
+	ptr1 = array;
+	ptr2 = ptr1;
+
+	ptr2[0] = 400;
+	ptr2[1] = 800;
+	ptr2[2] = 1200;
+
+	printf("array[0]: %d\tptr2[0]: %d\n", array[0], ptr2[0]);
+	printf("array[1]: %d\tptr2[1]: %d\n", array[1], ptr2[1]);
+	printf("array[2]: %d\tptr2[2]: %d\n", array[2], ptr2[2]);
+
+	exit(0);
+
+}
+
+END
+/(array[0] != 400) || (array[1] != 800) || (array[2] != 1200)/
+{
+	printf("Error");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer1.d
new file mode 100644
index 0000000..5d9db38
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer1.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Demonstrating valid memory access.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	x = (int *)alloca(sizeof (int));
+	printf("Address x: %x\n", (int) x);
+	y = (int *) (x);
+	*y = 3;
+	printf("Address y: %x\tValue: %d\n", (int) y, *y);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer2.d
new file mode 100644
index 0000000..26d698a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.ValidPointer2.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Demonstrating valid memory access.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	x = (int *)alloca(sizeof (int));
+	printf("Address x: %x\n", (int) x);
+	y = (int *) (x + 2);
+	*y = 3;
+	printf("Address y: %x\tValue: %d\n", (int) y, *y);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.VoidCast.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.VoidCast.d
new file mode 100644
index 0000000..296fdf4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.VoidCast.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Can dereference a void * pointer only by casting it to another type.
+ *
+ * SECTION: Pointers and Arrays/Generic Pointers
+ */
+
+#pragma D option quiet
+
+void *p;
+
+int array[3];
+
+BEGIN
+{
+	array[0] = 234;
+	array[1] = 334;
+	array[2] = 434;
+
+	p = &array[0];
+	newp = (int *) p;
+
+	printf("array[0]: %d, newp: %d\n", array[0], *newp);
+	exit(0);
+}
+
+END
+/234 != *newp/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.basic1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.basic1.d
new file mode 100644
index 0000000..bf3154a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.basic1.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Pointers can be stored in variables.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	kmemAddress = &`kmem_flags;
+	kmemValue = *kmemAddress;
+	printf("Address of kmem_flags: %x\n", (int) kmemAddress);
+	printf("Value of kmem_flags: %d\n", kmemValue);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.basic2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.basic2.d
new file mode 100644
index 0000000..6b72b63
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pointers/tst.basic2.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Pointers can be stored in associative arrays.
+ *
+ * SECTION: Pointers and Arrays/Pointers and Addresses
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	assoc_array["kmemAddress"] = &`kmem_flags;
+	kmemValue = *(assoc_array["kmemAddress"]);
+	printf("Address of kmem_flags: %x\n", (int) assoc_array["kmemAddress"]);
+	printf("Value of kmem_flags: %d\n", kmemValue);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGERR.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGERR.d
new file mode 100644
index 0000000..863ddc8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGERR.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *	Verify pragma errors
+ *
+ * SECTION: Pragmas
+ */
+
+
+#pragma D error "this is an error message"
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_DEPEND.main.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_DEPEND.main.d
new file mode 100644
index 0000000..0b5a340
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_DEPEND.main.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * It isn't permitted for a main program to contain a depends_on imperative.
+ */
+
+#pragma D depends_on library net.d
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_INVAL.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_INVAL.d
new file mode 100644
index 0000000..c6fd147
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_INVAL.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *	Verify invalid attributes
+ *
+ * SECTION: Pragmas;
+ *	Stabilty/Interface Attributes
+ */
+
+
+inline int foo
+
+#pragma D attributes incorrect_attr foo
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_MALFORM.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_MALFORM.d
new file mode 100644
index 0000000..7f0ba23
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_MALFORM.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *	Verify malformed pragma argument list
+ *
+ * SECTION: Pragmas
+ */
+
+
+#pragma D attributes incorrect_attr
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_UNUSED.UnusedPragma.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_UNUSED.UnusedPragma.d
new file mode 100644
index 0000000..da2336b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.D_PRAGMA_UNUSED.UnusedPragma.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Unused pragmas throw error D_PRAGMA_UNUSED
+ *
+ * SECTION: Errtags/D_PRAGMA_UNUSED
+ *
+ */
+
+void func(int, int);
+
+#pragma D option quiet
+#pragma D attributes Stable/Stable/Common func;
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.circlibdep.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.circlibdep.ksh
new file mode 100644
index 0000000..6fbace8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.circlibdep.ksh
@@ -0,0 +1,58 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+libdir=${TMPDIR:-/tmp}/libdep.$$
+dtrace=$1
+
+setup_libs()
+{
+	mkdir $libdir
+	cat > $libdir/liba.$$.d <<EOF
+#pragma D depends_on library libb.$$.d
+EOF
+	cat > $libdir/libb.$$.d <<EOF
+#pragma D depends_on library libc.$$.d
+EOF
+	cat > $libdir/libc.$$.d <<EOF
+#pragma D depends_on library liba.$$.d
+EOF
+}
+
+
+setup_libs
+
+$dtrace -L$libdir -e
+
+status=$?
+rm -rf $libdir
+return $status
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.invalidlibdep.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.invalidlibdep.ksh
new file mode 100644
index 0000000..b05ae3d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/err.invalidlibdep.ksh
@@ -0,0 +1,57 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+libdir=${TMPDIR:-/tmp}/libdep.$$
+dtrace=$1
+
+setup_libs()
+{
+	mkdir $libdir
+	cat > $libdir/liba.$$.d <<EOF
+#pragma D depends_on library libnotthere.$$.d
+EOF
+	cat > $libdir/libb.$$.d <<EOF
+#pragma D depends_on library libc.$$.d
+EOF
+	cat > $libdir/libc.$$.d <<EOF
+#pragma D depends_on library liba.$$.d
+EOF
+}
+
+
+setup_libs
+
+$dtrace -L$libdir -e
+
+status=$?
+rm -rf $libdir
+return $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libchain.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libchain.ksh
new file mode 100644
index 0000000..7c92243
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libchain.ksh
@@ -0,0 +1,58 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+libdir=${TMPDIR:-/tmp}/libdep.$$
+dtrace=$1
+
+setup_libs()
+{
+        mkdir $libdir
+        cat > $libdir/liba.$$.d <<EOF
+#pragma D depends_on library libb.$$.d
+
+inline int foo = bar;
+EOF
+        cat > $libdir/libb.$$.d <<EOF
+#pragma D depends_on module doogle_knows_all_probes
+
+inline int bar = 0xd0061e;
+EOF
+}
+
+
+setup_libs
+
+$dtrace -L$libdir -e
+
+status=$?
+rm -rf $libdir
+return $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libdep.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libdep.ksh
new file mode 100644
index 0000000..38b3460
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libdep.ksh
@@ -0,0 +1,66 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+libdir=${TMPDIR:-/tmp}/libdep.$$
+dtrace=$1
+
+setup_libs()
+{
+        mkdir $libdir
+        cat > $libdir/liba.$$.d <<EOF
+#pragma D depends_on library libb.$$.d
+#pragma D depends_on library libc.$$.d
+#pragma D depends_on library libd.$$.d
+EOF
+        cat > $libdir/libb.$$.d <<EOF
+#pragma D depends_on library libc.$$.d
+EOF
+        cat > $libdir/libc.$$.d <<EOF
+EOF
+        cat > $libdir/libd.$$.d <<EOF
+EOF
+        cat > $libdir/libe.$$.d <<EOF
+#pragma D depends_on library liba.$$.d
+EOF
+        cat > $libdir/libf.$$.d <<EOF
+EOF
+}
+
+
+setup_libs
+
+$dtrace -L$libdir -e
+
+status=$?
+rm -rf $libdir
+return $status
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libdepfullyconnected.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libdepfullyconnected.ksh
new file mode 100644
index 0000000..e95de69
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/pragma/tst.libdepfullyconnected.ksh
@@ -0,0 +1,100 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test verifies that we can generate the correct ordering for
+# a given dependency specification. All files either have a dependency
+# on another file or are the dependent of another file. In this way we
+# guarantee consistent ordering as no nodes in the dependency graph will
+# be isolated.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+tmpfile=/tmp/libdeporder.$$
+libdir=${TMPDIR:-/tmp}/libdep.$$
+dtrace=$1
+
+setup_libs()
+{
+	mkdir $libdir
+	cat > $libdir/liba.$$.d <<EOF
+#pragma D depends_on library libd.$$.d
+EOF
+	cat > $libdir/libb.$$.d <<EOF
+EOF
+	cat > $libdir/libc.$$.d <<EOF
+#pragma D depends_on library libe.$$.d
+EOF
+	cat > $libdir/libd.$$.d <<EOF
+#pragma D depends_on library libb.$$.d
+EOF
+	cat > $libdir/libe.$$.d <<EOF
+#pragma D depends_on library liba.$$.d
+EOF
+}
+
+
+setup_libs
+
+DTRACE_DEBUG=1 $dtrace -L$libdir -e >$tmpfile 2>&1 
+
+perl /dev/stdin $tmpfile <<EOF
+
+	@order = qw(libc libe liba libd libb);
+
+	while (<>) {
+		if (\$_ =~ /lib[a-e]\.[0-9]+.d/) {
+			\$pos = length \$_;
+			for (\$i=0; \$i<=1;\$i++) {
+				\$pos = rindex(\$_, "/", \$pos);
+				\$pos--;
+			}
+
+			push(@new, substr(\$_, \$pos+2, 4));
+			next;
+		}
+		next;
+	}
+
+	exit 1 if @new != @order;
+
+	while (@new) {
+		exit 1 if pop(@new) ne pop(@order);
+	}
+
+	exit 0;
+EOF
+
+
+status=$?
+rm -rf $libdir
+rm $tmpfile
+return $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_PRED_SCALAR.NonScalarPred.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_PRED_SCALAR.NonScalarPred.d
new file mode 100644
index 0000000..5f02b7a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_PRED_SCALAR.NonScalarPred.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Predicate result must be of scalar type.
+ *
+ * SECTION: Errtags/ D_PRED_SCALAR
+ *
+ */
+
+#pragma D option quiet
+int a[4];
+
+BEGIN
+/a/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_SYNTAX.invalid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_SYNTAX.invalid.d
new file mode 100644
index 0000000..391d425
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_SYNTAX.invalid.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple if,then operation test.
+ *	Call invalid conditions and make sure it gives compilation error.
+ *
+ * SECTION: Program Structure/Predicates
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile-1
+/i < != > 10/
+{
+	i++;
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_SYNTAX.operr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_SYNTAX.operr.d
new file mode 100644
index 0000000..8ffab27
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/err.D_SYNTAX.operr.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple if,then operations test.
+ *	Call impossible conditions and make sure compilation fails.
+ *
+ * SECTION: Program Structure/Predicates
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile-1
+/i != 0 && >= 5 || <= 10/
+{
+	i++;
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.argsnotcached.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.argsnotcached.d
new file mode 100644
index 0000000..f461c5d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.argsnotcached.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+int schedules;
+int executes;
+
+/*
+ * This script is a bit naughty:  it's assuming the implementation of the
+ * VM system's page scanning.  If this implementation changes -- either by
+ * changing the function that scans pages or by making that scanning
+ * multithreaded -- this script will break.
+ */
+fbt::timeout:entry
+/args[0] == (void *)&genunix`schedpaging/
+{
+	schedules++;
+}
+
+fbt::schedpaging:entry
+/executes == 10/
+{
+	printf("%d schedules, %d executes\n", schedules, executes);
+	exit(executes == schedules ? 0 : 1);
+}
+
+fbt::schedpaging:entry
+{
+	executes++;
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.basics.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.basics.d
new file mode 100644
index 0000000..9b43b61
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.basics.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple if,then operations test.
+ *	Call simple expressions and make sure test satisfy conditions.
+ *	Match expected output in tst.basics.d.out
+ *
+ * SECTION: Program Structure/Predicates
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i < 10/
+{
+	i++;
+	trace(i);
+}
+
+tick-10ms
+/i == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.basics.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.basics.d.out
new file mode 100644
index 0000000..2a5b99a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.basics.d.out
@@ -0,0 +1 @@
+12345678910
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.complex.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.complex.d
new file mode 100644
index 0000000..d08543f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.complex.d
@@ -0,0 +1,126 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Complex operations and if,then test.
+ *	Call 'n' permutation and combination of operations over if,then.
+ *	Match expected output in tst.complex.d.out
+ *
+ * SECTION: Program Structure/Predicates
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+	j = 0;
+}
+
+tick-10ms
+/i < 10/
+{
+	i++;
+	j++;
+	printf("\n\n%d\n------\n", i);
+}
+
+tick-10ms
+/i == 5 || i == 10/
+{
+	printf("i == 5 (or) i == 10\n");
+}
+
+tick-10ms
+/i <= 5/
+{
+	printf("i <= 5\n");
+}
+
+tick-10ms
+/j >= 5/
+{
+	printf("j >= 5\n");
+}
+
+tick-10ms
+/j >= 5 || i <= 5/
+{
+	printf("i >= 5 || j >= 5\n");
+}
+
+tick-10ms
+/j >= 5 && i <= 5/
+{
+	printf("j >= 5 && i <= 55\n");
+}
+
+tick-10ms
+/i < 5/
+{
+	printf("i < 5\n");
+}
+
+tick-10ms
+/i == 2 || j == 2/
+{
+	printf("i == 2 (or) j == 2\n");
+}
+
+tick-10ms
+/i == 2 && j == 2/
+{
+	printf("i == 2 (and) j == 2\n");
+}
+
+tick-10ms
+/j != 10/
+{
+	printf("j != 10\n");
+}
+
+tick-10ms
+/j == 5 || i == 2/
+{
+	printf("j == 5 || i == 2\n");
+}
+
+tick-10ms
+/j == 5 && i == 2/
+{
+	printf("j == 5 && i == 2\n");
+}
+
+tick-10ms
+/i == 10/
+{
+	printf("i == 10\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.complex.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.complex.d.out
new file mode 100644
index 0000000..5f16dbd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.complex.d.out
@@ -0,0 +1,83 @@
+
+
+1
+------
+i <= 5
+i >= 5 || j >= 5
+i < 5
+j != 10
+
+
+2
+------
+i <= 5
+i >= 5 || j >= 5
+i < 5
+i == 2 (or) j == 2
+i == 2 (and) j == 2
+j != 10
+j == 5 || i == 2
+
+
+3
+------
+i <= 5
+i >= 5 || j >= 5
+i < 5
+j != 10
+
+
+4
+------
+i <= 5
+i >= 5 || j >= 5
+i < 5
+j != 10
+
+
+5
+------
+i == 5 (or) i == 10
+i <= 5
+j >= 5
+i >= 5 || j >= 5
+j >= 5 && i <= 55
+j != 10
+j == 5 || i == 2
+
+
+6
+------
+j >= 5
+i >= 5 || j >= 5
+j != 10
+
+
+7
+------
+j >= 5
+i >= 5 || j >= 5
+j != 10
+
+
+8
+------
+j >= 5
+i >= 5 || j >= 5
+j != 10
+
+
+9
+------
+j >= 5
+i >= 5 || j >= 5
+j != 10
+
+
+10
+------
+i == 5 (or) i == 10
+j >= 5
+i >= 5 || j >= 5
+i == 10
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh
new file mode 100644
index 0000000..f06edcb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh
@@ -0,0 +1,197 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+unload()
+{
+	#
+	# Get the list of services whose processes have USDT probes.  Ideally
+	# it would be possible to unload the fasttrap provider while USDT
+	# probes exist -- once that fix is integrated, this hack can go away
+	# We create two lists -- one of regular SMF services and one of legacy
+	# services -- since each must be enabled and disabled using a specific
+	# mechanism.
+	#
+	pids=$(dtrace -l | \
+	    perl -ne 'print "$1\n" if (/^\s*\S+\s+\S*\D(\d+)\s+/);' | \
+	    sort | uniq | tr '\n' ',')
+
+	ctids=$(ps -p $pids -o ctid | tail +2 | sort | uniq)
+	svcs=
+	lrcs=
+
+	for ct in $ctids
+	do
+		line=$(svcs -o fmri,ctid | grep " $ct\$")
+		svc=$(echo $line | cut -d' ' -f1)
+
+		if [[ $(svcs -Ho STA $svc) == "LRC" ]]; then
+			lrc=$(svcs -Ho SVC $svc | tr _ '?')
+			lrcs="$lrcs $lrc"
+		else
+			svcs="$svcs $svc"
+	fi
+	done
+
+	for svc in $svcs
+	do
+		svcadm disable -ts $svc
+	done
+
+	for lrc in $lrcs
+	do
+		#
+		# Does it seem a little paternalistic that lsvcrun requires
+		# this environment variable to be set? I'd say so...
+		#
+		SMF_RESTARTER=svc:/system/svc/restarter:default \
+		    /lib/svc/bin/lsvcrun $lrc stop
+	done
+
+	modunload -i 0
+	modunload -i 0
+	modunload -i 0
+	modinfo | grep dtrace
+	success=$?
+
+	for svc in $svcs
+	do
+		svcadm enable -ts $svc
+	done
+
+	for lrc in $lrcs
+	do
+		SMF_RESTARTER=svc:/system/svc/restarter:default \
+		    /lib/svc/bin/lsvcrun $lrc start
+	done
+
+	if [ ! $success ]; then
+		echo $tst: could not unload dtrace
+		exit 1
+	fi
+}
+
+script1()
+{
+	$dtrace -s /dev/stdin <<EOF
+	syscall:::entry
+	/pid != $ppid/
+	{
+		@a[probefunc] = count();
+	}
+
+	tick-1sec
+	/i++ == 5/
+	{
+		exit(0);
+	}
+EOF
+}
+
+script2()
+{
+	$dtrace -s /dev/stdin <<EOF
+
+	#pragma D option statusrate=1ms
+
+	syscall:::entry
+	/pid == $ppid/
+	{
+		ttl++;
+	}
+
+	tick-1sec
+	/i++ == 5/
+	{
+		exit(2);
+	}
+
+	END
+	/ttl/
+	{
+		printf("success; ttl is %d", ttl);
+		exit(0);
+	}
+
+	END
+	/ttl == 0/
+	{
+		printf("error -- total should be non-zero");
+		exit(1);
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+ppid=$$
+dtrace=$1
+
+unload
+script1 &
+child=$!
+
+let waited=0
+
+while [ "$waited" -lt 5 ]; do
+	seconds=`date +%S`
+
+	if [ "$seconds" -ne "$last" ]; then
+		last=$seconds
+		let waited=waited+1
+	fi
+done
+
+wait $child
+status=$?
+
+if [ "$status" -ne 0 ]; then
+	echo $tst: first dtrace failed
+	exit $status
+fi
+
+unload
+script2 &
+child=$!
+
+let waited=0
+
+while [ "$waited" -lt 10 ]; do
+	seconds=`date +%S`
+
+	if [ "$seconds" -ne "$last" ]; then
+		last=$seconds
+		let waited=waited+1
+	fi
+done
+
+wait $child
+status=$?
+
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_IDENT_UNDEF.afterprobe.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_IDENT_UNDEF.afterprobe.d
new file mode 100644
index 0000000..ac63b43
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_IDENT_UNDEF.afterprobe.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *
+ * Declare 'ifdef' statements after probe clause definition and
+ * attempt to print the value before that.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
+#if !defined (FLAG)
+#define VALUE 5
+#endif
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_PRAGCTL_INVAL.tabdefine.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_PRAGCTL_INVAL.tabdefine.d
new file mode 100644
index 0000000..e79ad2e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_PRAGCTL_INVAL.tabdefine.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call #define statement not in first column, just after a tab.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+	#define VALUE 5
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The VALUE is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_SYNTAX.withoutpound.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_SYNTAX.withoutpound.d
new file mode 100644
index 0000000..aac2bcf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.D_SYNTAX.withoutpound.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Just call a 'define' statement without '#'
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+define VALUE 5
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.defincomp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.defincomp.d
new file mode 100644
index 0000000..750ce6d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.defincomp.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare a incomplete #define statement
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#define
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefelsenotendif.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefelsenotendif.d
new file mode 100644
index 0000000..6ad696a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefelsenotendif.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call ifdef statement without endif statement.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG)
+#define RETURN 5
+#else
+#define RETURN 10
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", RETURN);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefincomp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefincomp.d
new file mode 100644
index 0000000..37c637c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefincomp.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call a 'if !defined' incomplete statement.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined
+#define VALUE 5
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefnotendif.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefnotendif.d
new file mode 100644
index 0000000..09fdb17
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.ifdefnotendif.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Call a complete '!ifdefine' statement but without 'endif' statement.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG)
+#define VALUE 5
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.incompelse.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.incompelse.d
new file mode 100644
index 0000000..ee92f69
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.incompelse.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Just call a #else statement
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#else
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.mulelse.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.mulelse.d
new file mode 100644
index 0000000..958f4e2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/err.mulelse.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Attempt to declare a multiple else 'ifdef' declarations.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG)
+#define VALUE 5
+#else
+#define VALUE 10
+#else
+#define VALUE 15
+#else
+#define VALUE 20
+#endif
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifdef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifdef.d
new file mode 100644
index 0000000..a17ee0e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifdef.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple test to test 'if defined' 'defined' 'else' 'endif'
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if defined (FLAG)
+#define VALUE 5
+#else
+#define VALUE 10
+#endif
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifdef.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifdef.d.out
new file mode 100644
index 0000000..2bde5e9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifdef.d.out
@@ -0,0 +1,2 @@
+The value is 10
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifndef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifndef.d
new file mode 100644
index 0000000..b40cf01
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifndef.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple test for 'ifndef'.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#ifndef FLAG
+#define FLAG
+#endif
+
+#if defined (FLAG)
+#define VALUE 5
+#else
+#define VALUE 10
+#endif
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifndef.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifndef.d.out
new file mode 100644
index 0000000..d51d19f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifndef.d.out
@@ -0,0 +1,2 @@
+The value is 5
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifnotdef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifnotdef.d
new file mode 100644
index 0000000..345a82f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifnotdef.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple if !defined, define, else and endif test
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG)
+#define VALUE 5
+#else
+#define VALUE 10
+#endif
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifnotdef.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifnotdef.d.out
new file mode 100644
index 0000000..d51d19f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.ifnotdef.d.out
@@ -0,0 +1,2 @@
+The value is 5
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicaland.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicaland.d
new file mode 100644
index 0000000..c8ea348
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicaland.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple !defined, logical 'and' (&&) test.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG) && !defined(STATUS)
+#define VALUE 0
+#else
+#define VALUE 1
+#endif
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicaland.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicaland.d.out
new file mode 100644
index 0000000..350295c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicaland.d.out
@@ -0,0 +1,2 @@
+The value is 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalandor.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalandor.d
new file mode 100644
index 0000000..63637d3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalandor.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple !defined logical-or(||) and logical-and(&&) test.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG) || !defined(STATUS) && !defined(STATE)
+#define VALUE 0
+#else
+#define VALUE 1
+#endif
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalandor.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalandor.d.out
new file mode 100644
index 0000000..350295c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalandor.d.out
@@ -0,0 +1,2 @@
+The value is 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalor.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalor.d
new file mode 100644
index 0000000..b99ee1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalor.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * if !defined (logical-or) usage.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG) || !defined(STATUS)
+#define VALUE 0
+#else
+#define VALUE 1
+#endif
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalor.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalor.d.out
new file mode 100644
index 0000000..350295c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.logicalor.d.out
@@ -0,0 +1,2 @@
+The value is 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.muland.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.muland.d
new file mode 100644
index 0000000..9bca2cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.muland.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * if !defined multiple logical-and(&&) usage.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG) && !defined(STATUS) && !defined(STATE)
+#define VALUE 0
+#else
+#define VALUE 1
+#endif
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.muland.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.muland.d.out
new file mode 100644
index 0000000..350295c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.muland.d.out
@@ -0,0 +1,2 @@
+The value is 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.mulor.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.mulor.d
new file mode 100644
index 0000000..1d0c4d9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.mulor.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple multiple ifdefined logical-or(||) test.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if !defined (FLAG) || !defined(STATUS) || !defined(STATE)
+#define VALUE 0
+#else
+#define VALUE 1
+#endif
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.mulor.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.mulor.d.out
new file mode 100644
index 0000000..350295c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.mulor.d.out
@@ -0,0 +1,2 @@
+The value is 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.precondi.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.precondi.d
new file mode 100644
index 0000000..1d21d47
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.precondi.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple #define test.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#define value 5
+
+
+#pragma D option quiet
+
+tick-10ms
+/value == 5/
+{
+	printf("The value is %d\n", value);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.precondi.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.precondi.d.out
new file mode 100644
index 0000000..d51d19f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.precondi.d.out
@@ -0,0 +1,2 @@
+The value is 5
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.predicatedeclare.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.predicatedeclare.d
new file mode 100644
index 0000000..db5e94b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.predicatedeclare.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Attempt to declare 'ifdef' statement inbetween probe declaration
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-10ms
+#if !defined (FLAG)
+#define VALUE 5
+#endif
+{
+
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexp.d
new file mode 100644
index 0000000..044e5a1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexp.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple #define and predicates test.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#define MAXVAL 10 * 15
+
+
+#pragma D option quiet
+
+tick-10ms
+/MAXVAL > 5/
+{
+	printf("The value is %d\n", MAXVAL);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexp.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexp.d.out
new file mode 100644
index 0000000..7ae4979
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexp.d.out
@@ -0,0 +1,2 @@
+The value is 150
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpelse.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpelse.d
new file mode 100644
index 0000000..d917d33
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpelse.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple ifdefined, define, else, endif test.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#if defined (FLAG)
+#define VALUE 5
+#else
+#define VALUE 10
+#endif
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpelse.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpelse.d.out
new file mode 100644
index 0000000..2bde5e9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpelse.d.out
@@ -0,0 +1,2 @@
+The value is 10
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpif.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpif.d
new file mode 100644
index 0000000..b0ae395
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpif.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple define, if defined, define and endif tests.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#define FLAG 1
+#if defined (FLAG)
+#define VALUE 5
+#endif
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpif.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpif.d.out
new file mode 100644
index 0000000..d51d19f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpif.d.out
@@ -0,0 +1,2 @@
+The value is 5
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpifelse.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpifelse.d
new file mode 100644
index 0000000..c6210d0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpifelse.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple define, if defined, else, endif test.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+#define FLAG 1
+#if defined (FLAG)
+#define VALUE 5
+#else
+#define VALUE 10
+#endif
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpifelse.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpifelse.d.out
new file mode 100644
index 0000000..d51d19f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.preexpifelse.d.out
@@ -0,0 +1,2 @@
+The value is 5
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.withinprobe.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.withinprobe.d
new file mode 100644
index 0000000..83a2445
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/preprocessor/tst.withinprobe.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare a 'ifdef' section inside a probe clause.
+ *
+ * SECTION: Program Structure/Use of the C Preprocessor
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+
+#if !defined (FLAG)
+#define VALUE 5
+#endif
+
+	printf("The value is %d\n", VALUE);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badagg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badagg.d
new file mode 100644
index 0000000..817d9ac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badagg.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Invokes printa() with a bad aggregation argument.
+ *
+ * SECTION: Output Formatting/printa()
+ *
+ */
+
+BEGIN
+{
+	printa("%d", 123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badfmt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badfmt.d
new file mode 100644
index 0000000..5a41982
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badfmt.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Invokes printa() with a bad format string.
+ *
+ * SECTION: Output Formatting/printa()
+ *
+ */
+
+BEGIN
+{
+	printa(123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badval.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badval.d
new file mode 100644
index 0000000..e8663ab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_AGGARG.badval.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Invokes printa() with an argument that does not match the aggregation
+ *  convertion.
+ *
+ * SECTION: Output Formatting/printa()
+ *
+ */
+
+BEGIN
+{
+	printa("%@d\n", 123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_PROTO.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_PROTO.bad.d
new file mode 100644
index 0000000..8e202f6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTA_PROTO.bad.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Invokes printa() with a bad aggregation argument.
+ *
+ * SECTION: Output Formatting/printa()
+ *
+ */
+
+BEGIN
+{
+	printa("%d");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.jstack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.jstack.d
new file mode 100644
index 0000000..09b4b27
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.jstack.d
@@ -0,0 +1,36 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@[jstack()] = count();
+
+	printa("%p\n", @);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.stack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.stack.d
new file mode 100644
index 0000000..8815ad6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.stack.d
@@ -0,0 +1,36 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@[stack()] = count();
+
+	printa("%p\n", @);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.ustack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.ustack.d
new file mode 100644
index 0000000..bce1b67
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/err.D_PRINTF_ARG_TYPE.ustack.d
@@ -0,0 +1,36 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@[ustack()] = count();
+
+	printa("%p\n", @);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.basics.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.basics.d
new file mode 100644
index 0000000..f535387
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.basics.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     Test the basic formatting of all the supported kinds of aggregations.
+ *
+ * SECTION: Output Formatting/printa()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a = avg(1);
+	@b = count();
+	@c = lquantize(1, 1, 10);
+	@d = max(1);
+	@e = min(1);
+	@f = sum(1);
+	@g = quantize(1);
+	@h = stddev(1);
+
+	printa("@a = %@u\n", @a);
+	printa("@b = %@u\n", @b);
+	printa("@c = %@d\n", @c);
+	printa("@d = %@u\n", @d);
+	printa("@e = %@u\n", @e);
+	printa("@f = %@u\n", @f);
+	printa("@g = %@d\n", @g);
+	printa("@h = %@d\n", @h);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.basics.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.basics.d.out
new file mode 100644
index 0000000..ddad213
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.basics.d.out
@@ -0,0 +1,19 @@
+ at a = 1
+ at b = 1
+ at c = 
+           value  ------------- Distribution ------------- count    
+             < 1 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               2 |                                         0        
+
+ at d = 1
+ at e = 1
+ at f = 1
+ at g = 
+           value  ------------- Distribution ------------- count    
+               0 |                                         0        
+               1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1        
+               2 |                                         0        
+
+ at h = 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.def.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.def.d
new file mode 100644
index 0000000..50011e3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.def.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the printa() default output format.
+ *
+ * SECTION: Output Formatting/printa()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a = count();
+	printa(@a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.def.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.def.d.out
new file mode 100644
index 0000000..7cf6701
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.def.d.out
@@ -0,0 +1,3 @@
+
+                1
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.dynwidth.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.dynwidth.d
new file mode 100644
index 0000000..f3379c9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.dynwidth.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	/*
+	 * Yes, this works.  But is it useful?  And is it useful to someone
+	 * other than jwadams and/or dep?
+	 */
+	@[10, 100] = sum(1);
+	@[-10, 200] = sum(2);
+
+	printa("-->%-*d<--\n", @);
+	printa("-->%*d<--\n", @);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.dynwidth.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.dynwidth.d.out
new file mode 100644
index 0000000..f6c53eb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.dynwidth.d.out
@@ -0,0 +1,5 @@
+-->100       <--
+-->200       <--
+-->       100<--
+-->200       <--
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.fmt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.fmt.d
new file mode 100644
index 0000000..8f8cd41
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.fmt.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the printa() format string in its simplest form.
+ *
+ * SECTION: Output Formatting/printa()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a = count();
+	printa("%@u", @a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.fmt.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.fmt.d.out
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.fmt.d.out
@@ -0,0 +1 @@
+1
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh
new file mode 100644
index 0000000..ed375fd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh
@@ -0,0 +1,83 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.c <<EOF
+void
+thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydog(void)
+{
+	while (1)
+		;
+}
+
+int
+main(int argc, char *argv[])
+{
+	thequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydogthequickbrownfoxjumpsoverthelazydog();
+}
+EOF
+
+cc -o test test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+
+script()
+{
+	$dtrace -c ./test -qs /dev/stdin <<EOF
+	profile:::profile-1001hz
+	/pid == \$target/
+	{
+		@[arg1] = count();
+	}
+
+	tick-1s
+	/n++ > 10/
+	{
+		printa("%A %@d\n", @);
+		exit(0);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.many.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.many.d
new file mode 100644
index 0000000..5bd3eae
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.many.d
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=32m
+#pragma D option bufpolicy=fill
+#pragma D option destructive
+#pragma D option quiet
+
+BEGIN
+/0 == 1/
+{
+	@ = count();
+}
+
+BEGIN
+{
+	freopen("/dev/null");
+}
+
+profile-4000hz
+{
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+	printa(@);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.manyval.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.manyval.d
new file mode 100644
index 0000000..c9fae84
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.manyval.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the use of many aggregation results in the same format string.
+ *
+ * SECTION: Output Formatting/printa()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a = count();
+	printa("%@u %@u %@u %@u %@u %@u %@u\n", @a);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.manyval.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.manyval.d.out
new file mode 100644
index 0000000..f08b797
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.manyval.d.out
@@ -0,0 +1,2 @@
+1 1 1 1 1 1 1
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.stack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.stack.d
new file mode 100644
index 0000000..88dbb1a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.stack.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	@[stack()] = count();
+	@[ustack()] = count();
+	@[jstack()] = count();
+
+	printa("%k\n", @);
+	printa("%-20k\n", @);
+	printa("%60k\n", @);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.tuple.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.tuple.d
new file mode 100644
index 0000000..0eea887
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.tuple.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the use of tuple arguments in the printa() format.
+ *
+ * SECTION: Output Formatting/printa()
+ *
+ * NOTES:
+ *  We confirm that we can consume fewer arguments than in the tuple, all
+ *  the way up to the exact number.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	@a[1, 2, 3, 4, 5] = count();
+	printf("\n");
+
+	printa("%@u: -\n", @a);
+	printa("%@u: %d\n", @a);
+	printa("%@u: %d %d\n", @a);
+	printa("%@u: %d %d %d\n", @a);
+	printa("%@u: %d %d %d %d\n", @a);
+	printa("%@u: %d %d %d %d %d\n", @a);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.tuple.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.tuple.d.out
new file mode 100644
index 0000000..928119c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.tuple.d.out
@@ -0,0 +1,8 @@
+
+1: -
+1: 1
+1: 1 2
+1: 1 2 3
+1: 1 2 3 4
+1: 1 2 3 4 5
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh
new file mode 100644
index 0000000..bb0d5a0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh
@@ -0,0 +1,62 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+# The output files assumes the timezone is US/Pacific
+TZ=US/Pacific
+
+$dtrace -s /dev/stdin <<EOF
+#pragma D option quiet
+#pragma D option destructive
+
+BEGIN
+{
+	@foo = min(1075064400 * (hrtime_t)1000000000);
+	@bar = max(walltimestamp);
+	printa("%@T\n", @foo);
+	printa("%@Y\n", @foo);
+
+	freopen("/dev/null");
+	printa("%@T\n", @bar);
+	printa("%@Y\n", @bar);
+
+	exit(0);
+}
+EOF
+
+if [ $? -ne 0 ]; then
+	print -u2 "dtrace failed"
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh.out
new file mode 100644
index 0000000..7462cf8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printa/tst.walltimestamp.ksh.out
@@ -0,0 +1,2 @@
+Sun, 25 Jan 2004 13:00:00 PST
+2004 Jan 25 13:00:00
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_AGG_CONV.aggfmt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_AGG_CONV.aggfmt.d
new file mode 100644
index 0000000..9cac625
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_AGG_CONV.aggfmt.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with a bad aggregation format.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("hello %@d", 123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.toomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.toomany.d
new file mode 100644
index 0000000..de87e8d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.toomany.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with too many arguments.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("x = %d y = %d\n", 123, 456, 789);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.widths.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.widths.d
new file mode 100644
index 0000000..9381280
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.widths.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Negative test to test variety of fixed width formats.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\n");
+	x = 0;
+
+	printf("%?d\n", x++, 1);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_FMT.badfmt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_FMT.badfmt.d
new file mode 100644
index 0000000..bf4dc72
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_FMT.badfmt.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with a bad format string arg.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf(123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_PROTO.novalue.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_PROTO.novalue.d
new file mode 100644
index 0000000..68f8cf0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_PROTO.novalue.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with a missing value argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("%s");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.aggarg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.aggarg.d
new file mode 100644
index 0000000..99bb039
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.aggarg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  Test printf() with a bad aggregation arg.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	@a = count();
+	printf("hello %d %d", 123, @a);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.recursive.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.recursive.d
new file mode 100644
index 0000000..3b94ba7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.recursive.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Invalid recursive printf test.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+	printf("%s\n", printf("test"));
+
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.noprec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.noprec.d
new file mode 100644
index 0000000..ba8a1a4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.noprec.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with a missing dynamic precision argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("%s %.*d\n", "foo");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.nowidth.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.nowidth.d
new file mode 100644
index 0000000..4d72c81
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.nowidth.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with a missing dynamic width argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("%s %*d\n", "foo");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badprec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badprec.d
new file mode 100644
index 0000000..64cf912
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badprec.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test a dynamic precision argument of non-integer type.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("%.*d\n", "foo", 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badwidth.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badwidth.d
new file mode 100644
index 0000000..badc95e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badwidth.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Tet dynamic width argument of non-integer type.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("%*d\n", "foo", 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PROTO_LEN.toofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PROTO_LEN.toofew.d
new file mode 100644
index 0000000..32c877b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_PROTO_LEN.toofew.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with too few arguments.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv1.d
new file mode 100644
index 0000000..7add331
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv1.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test the unsupported %n$ conversion syntax.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("%3$d", 123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv2.d
new file mode 100644
index 0000000..5cc32e2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv2.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test an incomplete conversion.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("%3", 123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv3.d
new file mode 100644
index 0000000..0dedea3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv3.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test an undefined conversion.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	printf("%Z", 123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.basics.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.basics.d
new file mode 100644
index 0000000..8d4bb81
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.basics.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test the basics of all the format conversions in the printf dictionary.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ * NOTES:
+ *  floats and wchar_t strings missing
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = (int)'a';
+
+	printf("\n");
+
+	printf("%%a = %a\n", &`kmem_alloc);
+	printf("%%c = %c\n", i);
+	printf("%%d = %d\n", i);
+	printf("%%hd = %hd\n", (short)i);
+	printf("%%hi = %hi\n", (short)i);
+	printf("%%ho = %ho\n", (ushort_t)i);
+	printf("%%hu = %hu\n", (ushort_t)i);
+	printf("%%hx = %hx\n", (ushort_t)i);
+	printf("%%hX = %hX\n", (ushort_t)i);
+	printf("%%i = %i\n", i);
+	printf("%%lc = %lc\n", i);
+	printf("%%ld = %ld\n", (long)i);
+	printf("%%li = %li\n", (long)i);
+	printf("%%lo = %lo\n", (ulong_t)i);
+	printf("%%lu = %lu\n", (ulong_t)i);
+	printf("%%lx = %lx\n", (ulong_t)i);
+	printf("%%lX = %lX\n", (ulong_t)i);
+	printf("%%o = %o\n", (uint_t)i);
+	printf("%%p = %p\n", (void *)i);
+	printf("%%s = %s\n", "hello");
+	printf("%%u = %u\n", (uint_t)i);
+	printf("%%wc = %wc\n", i);
+	printf("%%x = %x\n", (uint_t)i);
+	printf("%%X = %X\n", (uint_t)i);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.basics.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.basics.d.out
new file mode 100644
index 0000000..55c1222
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.basics.d.out
@@ -0,0 +1,26 @@
+
+%a = genunix`kmem_alloc
+%c = a
+%d = 97
+%hd = 97
+%hi = 97
+%ho = 141
+%hu = 97
+%hx = 61
+%hX = 61
+%i = 97
+%lc = a
+%ld = 97
+%li = 97
+%lo = 141
+%lu = 97
+%lx = 61
+%lX = 61
+%o = 141
+%p = 61
+%s = hello
+%u = 97
+%wc = a
+%x = 61
+%X = 61
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.flags.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.flags.d
new file mode 100644
index 0000000..0b65315
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.flags.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test all of the various formatting flags (except %' because that
+ *  requires locale support).
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\n");
+	printf("# %#8x\n", 0x123);
+	printf("0 %08x\n", 0x123);
+	printf("- %-8x\n", 0x123);
+	printf("+ %+8d\n", 123);
+	printf("  % 8d\n", 123);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.flags.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.flags.d.out
new file mode 100644
index 0000000..4e5344e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.flags.d.out
@@ -0,0 +1,7 @@
+
+#    0x123
+0 00000123
+- 123     
++     +123
+       123
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.hello.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.hello.d
new file mode 100644
index 0000000..d58f6cd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.hello.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple printf() test.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("hello");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.hello.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.hello.d.out
new file mode 100644
index 0000000..ce01362
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.hello.d.out
@@ -0,0 +1 @@
+hello
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.ints.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.ints.d
new file mode 100644
index 0000000..d15236b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.ints.d
@@ -0,0 +1,87 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with simple integer arguments, using a variety of
+ *  sizes and thereby exercise the automatic size extension feature.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\n%d\n", (char)0x1234567890abcdef);
+	printf("%d\n", (short)0x1234567890abcdef);
+	printf("%d\n", (int)0x1234567890abcdef);
+	printf("%d\n", (long long)0x1234567890abcdef);
+
+	printf("\n%d\n", (unsigned char)0x1234567890abcdef);
+	printf("%d\n", (unsigned short)0x1234567890abcdef);
+	printf("%d\n", (unsigned int)0x1234567890abcdef);
+	printf("%d\n", (unsigned long long)0x1234567890abcdef);
+
+	printf("\n%u\n", (char)0x1234567890abcdef);
+	printf("%u\n", (short)0x1234567890abcdef);
+	printf("%u\n", (int)0x1234567890abcdef);
+	printf("%u\n", (long long)0x1234567890abcdef);
+
+	printf("\n%u\n", (unsigned char)0x1234567890abcdef);
+	printf("%u\n", (unsigned short)0x1234567890abcdef);
+	printf("%u\n", (unsigned int)0x1234567890abcdef);
+	printf("%u\n", (unsigned long long)0x1234567890abcdef);
+
+	printf("\n%x\n", (unsigned char)0x1234567890abcdef);
+	printf("%x\n", (unsigned short)0x1234567890abcdef);
+	printf("%x\n", (unsigned int)0x1234567890abcdef);
+	printf("%x\n", (unsigned long long)0x1234567890abcdef);
+
+	printf("\n%x\n", (char)0x1234567890abcdef);
+	printf("%x\n", (short)0x1234567890abcdef);
+	printf("%x\n", (int)0x1234567890abcdef);
+	printf("%x\n", (long long)0x1234567890abcdef);
+
+	printf("\n%o\n", (unsigned char)0x1234567890abcdef);
+	printf("%o\n", (unsigned short)0x1234567890abcdef);
+	printf("%o\n", (unsigned int)0x1234567890abcdef);
+	printf("%o\n", (unsigned long long)0x1234567890abcdef);
+
+	printf("\n%o\n", (char)0x1234567890abcdef);
+	printf("%o\n", (short)0x1234567890abcdef);
+	printf("%o\n", (int)0x1234567890abcdef);
+	printf("%o\n", (long long)0x1234567890abcdef);
+
+	printf("\n%p\n", (void *)0x12345678);
+	printf("%p\n", (int *)0x90abcdef);
+	printf("%p\n", (uintptr_t)0x67890abc);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.ints.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.ints.d.out
new file mode 100644
index 0000000..4d2bb11
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.ints.d.out
@@ -0,0 +1,45 @@
+
+239
+52719
+-1867788817
+1311768467294899695
+
+239
+52719
+2427178479
+1311768467294899695
+
+239
+52719
+2427178479
+1311768467294899695
+
+239
+52719
+2427178479
+1311768467294899695
+
+ef
+cdef
+90abcdef
+1234567890abcdef
+
+ef
+cdef
+90abcdef
+1234567890abcdef
+
+357
+146757
+22052746757
+110642547422052746757
+
+357
+146757
+22052746757
+110642547422052746757
+
+12345678
+90abcdef
+67890abc
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.precs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.precs.d
new file mode 100644
index 0000000..2bfff9f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.precs.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test a variety of fixed and dynamic format precisions.
+ *
+ * SECTION: Output Formatting/printf()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\n");
+	x = 0;
+
+	printf("%.0s\n", "hello");
+	printf("%.1s\n", "hello");
+	printf("%.2s\n", "hello");
+	printf("%.3s\n", "hello");
+	printf("%.4s\n", "hello");
+	printf("%.5s\n", "hello");
+
+	printf("%.*s\n", x++, "hello");
+	printf("%.*s\n", x++, "hello");
+	printf("%.*s\n", x++, "hello");
+	printf("%.*s\n", x++, "hello");
+	printf("%.*s\n", x++, "hello");
+	printf("%.*s\n", x++, "hello");
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.precs.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.precs.d.out
new file mode 100644
index 0000000..11a969d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.precs.d.out
@@ -0,0 +1,14 @@
+
+hello
+h
+he
+hel
+hell
+hello
+hello
+h
+he
+hel
+hell
+hello
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.print-f.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.print-f.d
new file mode 100644
index 0000000..3fe0bac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.print-f.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test %f format printing.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+float f;
+double d;
+
+BEGIN
+{
+	printf("\n");
+
+	printf("%%f = %f\n", f);
+	printf("%%f = %f\n", d);
+
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.print-f.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.print-f.d.out
new file mode 100644
index 0000000..4d4b864
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.print-f.d.out
@@ -0,0 +1,4 @@
+
+%f = 0.000000
+%f = 0.000000
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printT.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printT.ksh
new file mode 100644
index 0000000..5162538
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printT.ksh
@@ -0,0 +1,56 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+# The output files assumes the timezone is US/Pacific
+TZ=US/Pacific
+
+$dtrace -s /dev/stdin <<EOF
+#pragma D option quiet
+
+inline uint64_t NANOSEC = 1000000000;
+
+BEGIN
+{
+	printf("%T\n%T\n%T", (uint64_t)0, (uint64_t)1062609821 * NANOSEC,
+	    (uint64_t)0x7fffffff * NANOSEC);
+	exit(0);
+}
+EOF
+
+if [ $? -ne 0 ]; then
+	print -u2 "dtrace failed"
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printT.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printT.ksh.out
new file mode 100644
index 0000000..51c8437
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printT.ksh.out
@@ -0,0 +1,3 @@
+Wed, 31 Dec 1970 16:00:00 PST
+Wed, 03 Sep 2003 10:23:41 PDT
+Mon, 18 Jan 2038 19:14:07 PST
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printY.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printY.ksh
new file mode 100644
index 0000000..2dc3a4c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printY.ksh
@@ -0,0 +1,56 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+# The output files assumes the timezone is US/Pacific
+TZ=US/Pacific
+
+$dtrace -s /dev/stdin <<EOF
+#pragma D option quiet
+
+inline uint64_t NANOSEC = 1000000000;
+
+BEGIN
+{
+	printf("%Y\n%Y\n%Y", (uint64_t)0, (uint64_t)1062609821 * NANOSEC,
+	    (uint64_t)0x7fffffff * NANOSEC);
+	exit(0);
+}
+EOF
+
+if [ $? -ne 0 ]; then
+	print -u2 "dtrace failed"
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printY.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printY.ksh.out
new file mode 100644
index 0000000..ae8d82f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printY.ksh.out
@@ -0,0 +1,3 @@
+1969 Dec 31 16:00:00
+2003 Sep  3 10:23:41
+2038 Jan 18 19:14:07
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printcont.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printcont.d
new file mode 100644
index 0000000..ca7e1a9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printcont.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test 'uint' continously; like kinda stress.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+uint64_t ts;
+
+BEGIN
+{
+	ts = 53114233149441;
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	printf("%u\n", ts);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printcont.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printcont.d.out
new file mode 100644
index 0000000..ce33b72
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printcont.d.out
@@ -0,0 +1,16 @@
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printeE.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printeE.d
new file mode 100644
index 0000000..7aaee2a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printeE.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test %e, %E format printing.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+float f;
+double d;
+
+BEGIN
+{
+	printf("\n");
+
+	printf("%%e = %e\n", f);
+	printf("%%E = %E\n", f);
+
+	printf("%%e = %e\n", d);
+	printf("%%E = %E\n", d);
+
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printeE.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printeE.d.out
new file mode 100644
index 0000000..3fa96bc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printeE.d.out
@@ -0,0 +1,6 @@
+
+%e = 0.000000e+00
+%E = 0.000000E+00
+%e = 0.000000e+00
+%E = 0.000000E+00
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printgG.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printgG.d
new file mode 100644
index 0000000..9e7e019
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printgG.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test %g, %G format printing.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+float f;
+double d;
+
+BEGIN
+{
+	printf("\n");
+
+	printf("%%g = %g\n", f);
+	printf("%%g = %g\n", d);
+
+	printf("%%G = %G\n", f);
+	printf("%%G = %G\n", d);
+
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printgG.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printgG.d.out
new file mode 100644
index 0000000..e4175e6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.printgG.d.out
@@ -0,0 +1,6 @@
+
+%g = 0
+%g = 0
+%G = 0
+%G = 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d
new file mode 100644
index 0000000..deb4f81
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with a fixed string and no actual tracing arguments.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("hello world from BEGIN");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d.out
new file mode 100644
index 0000000..cb7c7e9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d.out
@@ -0,0 +1 @@
+hello world from BEGIN
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.str.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.str.d
new file mode 100644
index 0000000..a740413
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.str.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *  Test printf() with a simple string argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("sysname = %s", `utsname.sysname);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.str.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.str.d.out
new file mode 100644
index 0000000..ba31981
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.str.d.out
@@ -0,0 +1 @@
+sysname = SunOS
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.sym.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.sym.d
new file mode 100644
index 0000000..55f89f9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.sym.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with a simple string argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("symbol = %a", &`kmem_flags);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.sym.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
new file mode 100644
index 0000000..14f1e82
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
@@ -0,0 +1 @@
+symbol = genunix`kmem_flags
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.uints.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.uints.d
new file mode 100644
index 0000000..caa326e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.uints.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test printf() with simple unsigned integer arguments.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\n");
+	printf("%u\n", (uchar_t)123);
+	printf("%u\n", (ushort_t)123);
+	printf("%u\n", (ulong_t)123);
+	printf("%u\n", (u_longlong_t)123);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.uints.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.uints.d.out
new file mode 100644
index 0000000..d800e91
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.uints.d.out
@@ -0,0 +1,6 @@
+
+123
+123
+123
+123
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths.d
new file mode 100644
index 0000000..21595c0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test a variety of fixed and dynamic format widths.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\n");
+	x = 0;
+
+	printf("%0d\n", 1);
+	printf("%1d\n", 1);
+	printf("%2d\n", 1);
+	printf("%3d\n", 1);
+	printf("%4d\n", 1);
+	printf("%5d\n", 1);
+
+	printf("%*d\n", x++, 1);
+	printf("%*d\n", x++, 1);
+	printf("%*d\n", x++, 1);
+	printf("%*d\n", x++, 1);
+	printf("%*d\n", x++, 1);
+	printf("%*d\n", x++, 1);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths.d.out
new file mode 100644
index 0000000..39fc7a8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths.d.out
@@ -0,0 +1,14 @@
+
+1
+1
+ 1
+  1
+   1
+    1
+1
+1
+ 1
+  1
+   1
+    1
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths1.d
new file mode 100644
index 0000000..b5410ab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.widths1.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Try to print charecter wide width using '?'
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\n");
+	x = 0;
+
+	printf("%?d\n", x++);
+	printf("%?d\n", x++);
+	printf("%?d\n", x++);
+	printf("%?d\n", x++);
+	printf("%?d\n", x++);
+	printf("%?d\n", x++);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.wp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.wp.d
new file mode 100644
index 0000000..b6745e1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.wp.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test a variety of fixed and dynamic format widths combined with precisions.
+ *
+ * SECTION: Output Formatting/printf()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\n");
+	x = 0;
+
+	printf("%0.0s\n", "hello");
+	printf("%1.1s\n", "hello");
+	printf("%2.2s\n", "hello");
+	printf("%3.3s\n", "hello");
+	printf("%4.4s\n", "hello");
+	printf("%5.5s\n", "hello");
+	printf("%6.6s\n", "hello");
+	printf("%7.7s\n", "hello");
+	printf("%8.8s\n", "hello");
+	printf("%9.9s\n", "hello");
+
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+	printf("%*.*s\n", x, x++, "hello");
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.wp.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.wp.d.out
new file mode 100644
index 0000000..2f1fd9d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/printf/tst.wp.d.out
@@ -0,0 +1,22 @@
+
+hello
+h
+he
+hel
+hell
+hello
+ hello
+  hello
+   hello
+    hello
+hello
+h
+he
+hel
+hell
+hello
+ hello
+  hello
+   hello
+    hello
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh
new file mode 100644
index 0000000..ae4934c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.func_access.ksh
@@ -0,0 +1,82 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+ppriv -s A=basic,dtrace_proc,dtrace_user $$
+
+/usr/sbin/dtrace -q -s /dev/stdin <<"EOF"
+
+BEGIN {
+	errorcount = 0;
+	expected_errorcount = 23;
+}
+
+BEGIN { trace(mutex_owned(&`pidlock)); }
+BEGIN { trace(mutex_owner(&`pidlock)); }
+BEGIN { trace(mutex_type_adaptive(&`pidlock)); }
+BEGIN { trace(mutex_type_spin(&`pidlock)); }
+
+BEGIN { trace(rw_read_held(&`ksyms_lock)); }
+BEGIN { trace(rw_write_held(&`ksyms_lock)); }
+BEGIN { trace(rw_iswriter(&`ksyms_lock)); }
+
+BEGIN { x = alloca(10); bcopy(`initname, x, 10); trace(stringof(x)); }
+/* We have no reliable way to test msgsize */
+
+BEGIN { trace(strlen(`initname)); }
+BEGIN { trace(strchr(`initname, 0x69)); }
+BEGIN { trace(strrchr(`initname, 0x69)); }
+BEGIN { trace(strstr("/sbin/init/foo", `initname)); }
+BEGIN { trace(strstr(`initname, "in")); }
+BEGIN { trace(strtok(`initname, "/")); }
+BEGIN { trace(strtok(NULL, "/")); }
+BEGIN { trace(strtok("foo/bar", `initname)); }
+BEGIN { trace(strtok(NULL, `initname)); }
+BEGIN { trace(substr(`initname, 2, 3)); }
+
+BEGIN { trace(ddi_pathname(`top_devinfo, 1)); }
+BEGIN { trace(strjoin(`initname, "foo")); }
+BEGIN { trace(strjoin("foo", `initname)); }
+BEGIN { trace(dirname(`initname)); }
+BEGIN { trace(cleanpath(`initname)); }
+
+ERROR {
+	errorcount++;
+}
+
+BEGIN /errorcount == expected_errorcount/ {
+	trace("test passed");
+	exit(0);
+}
+
+BEGIN /errorcount != expected_errorcount/ {
+	printf("fail: expected %d.  saw %d.", expected_errorcount, errorcount);
+	exit(1);
+}
+EOF
+
+
+exit $?
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.op_access.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.op_access.ksh
new file mode 100644
index 0000000..08964c4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.op_access.ksh
@@ -0,0 +1,70 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+ppriv -s A=basic,dtrace_proc,dtrace_user $$
+
+/usr/sbin/dtrace -q -s /dev/stdin <<"EOF"
+BEGIN {
+	errorcount = 0;
+	expected_errorcount = 7;
+}
+
+/* BYREF */
+BEGIN { trace(`utsname); }
+BEGIN { trace(`kmem_flags); }
+
+/* DIF_OP_SCMP */
+BEGIN /`initname == "/sbin/init"/ { trace("bad"); }
+
+/* DIF_OP_COPYS */
+BEGIN { p = `p0; trace(p); }
+
+/* DIF_OP_STTS */
+BEGIN { self->p = `p0; trace(self->p); }
+
+/* DIF_OP_STGAA */
+BEGIN { a[stringof(`initname)] = 42; trace(a["/sbin/init"]); }
+
+/* DIF_OP_STTAA */
+BEGIN { self->a[stringof(`initname)] = 42; trace(self->a["/sbin/init"]); }
+
+ERROR {
+	errorcount++;
+}
+
+BEGIN /errorcount == expected_errorcount/ {
+	trace("pass");
+	exit(0);
+}
+
+BEGIN /errorcount != expected_errorcount/ {
+	printf("fail: expected %d.  saw %d.", expected_errorcount, errorcount);
+	exit(1);
+}
+EOF
+
+exit $?
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.unpriv_funcs.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.unpriv_funcs.ksh
new file mode 100644
index 0000000..c9da0ce
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/privs/tst.unpriv_funcs.ksh
@@ -0,0 +1,79 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Affirmative test of less privileged user operation.  We do so by running
+# this test case as root, then as a less privileged user.  The output should
+# be exactly the same.
+#
+
+script()
+{
+	cat <<"EOF"
+
+	BEGIN { trace("trace\n"); }
+	BEGIN { printf("%s\n", "printf"); }
+	BEGIN { printf("strlen(\"strlen\") = %d\n", strlen("strlen")); }
+	BEGIN { x = alloca(10);
+		bcopy("alloca\n", x, 7);
+		trace(stringof(x)); }
+
+	BEGIN { printf("index(\"index\", \"x\") = %d\n",
+	    index("index", "x")); }
+	BEGIN { printf("strchr(\"strchr\", \'t\') = %s\n",
+	    strchr("strchr", 't')); }
+
+	BEGIN { printf("strtok(\"strtok\", \"t\") = %s\n",
+	    strtok("strtok", "t")); }
+	BEGIN { printf("strtok(NULL, \"t\") = %s\n",
+	    strtok(NULL, "t")); }
+	BEGIN { printf("strtok(NULL, \"t\") = %s\n",
+	    strtok(NULL, "t")); }
+	BEGIN { printf("substr(\"substr\", 2, 2) = %s\n",
+	    substr("substr", 2, 2)); }
+	BEGIN { trace(strjoin("str", "join\n")); }
+	BEGIN { trace(basename("dirname/basename")); trace("/"); }
+	BEGIN { trace(dirname("dirname/basename")); }
+
+	BEGIN { exit(0); }
+	ERROR { exit(1); }
+EOF
+}
+
+privout=/tmp/$$.priv_output
+unprivout=/tmp/$$.unpriv_output
+
+script | /usr/sbin/dtrace -q -s /dev/stdin > $privout
+ppriv -s A=basic,dtrace_user $$
+script | /usr/sbin/dtrace -q -s /dev/stdin > $unprivout
+
+diff $privout $unprivout
+res=$?
+
+/bin/rm -f $privout $unprivout
+
+exit $res
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.probeqtn.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.probeqtn.d
new file mode 100644
index 0000000..3560427
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.probeqtn.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call probes with mismatch "?" and make sure it results in compilation
+ * error
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+int i;
+BEGIN
+{
+	i = 0;
+}
+
+syscall::?lwp?:entry
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.probestar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.probestar.d
new file mode 100644
index 0000000..6103f48
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.probestar.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call an undefined probe with matching character "*" and make
+ * sure it results in compilation error.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+no_such_dtrace_probe*
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.tickstar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.tickstar.d
new file mode 100644
index 0000000..391b18c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_PDESC_ZERO.tickstar.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call a probe with matching charecters "*" but does not have
+ * any matching probes.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+int i;
+BEGIN
+{
+	i = 0;
+}
+
+syscall::*tick*:entry
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.assign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.assign.d
new file mode 100644
index 0000000..e4f7dcb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.assign.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare a predicate with no spaces and make sure it results in
+ * compilation error.
+
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+int i = 0;
+
+profile-1
+/i == 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.declare.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.declare.d
new file mode 100644
index 0000000..30aa266
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.declare.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare variables inside probe clause and make sure it results
+ * in compilation error.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1
+{
+	int i = 0;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.declarein.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.declarein.d
new file mode 100644
index 0000000..9ef8590
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.declarein.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare a Variable in between definition and first brace, and make
+ * sure it results in compilation error.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1
+int i;
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.lbraces.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.lbraces.d
new file mode 100644
index 0000000..b4a4315
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.lbraces.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare a probe with one missing braces.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1
+{
+	exit(0);
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.probespec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.probespec.d
new file mode 100644
index 0000000..67c4487
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.probespec.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Try Declaring Datatypes and variables next to profile declaration and
+ * Make sure it results in compilation error.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1:int i
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.rbraces.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.rbraces.d
new file mode 100644
index 0000000..4f889d5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.rbraces.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare a probe with one missing braces.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.recdec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.recdec.d
new file mode 100644
index 0000000..5db21ea
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/err.D_SYNTAX.recdec.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare a probe clause within another probe clause.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1
+{
+	tick-10ms
+{
+}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.basic1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.basic1.d
new file mode 100644
index 0000000..df2b114
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.basic1.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple probe clause test; just a empty probe.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.check.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.check.d
new file mode 100644
index 0000000..d3f2535
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.check.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare a Variable in BEGIN and use that in another probe.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+int i;
+BEGIN
+{
+	i = 0;
+}
+
+tick-10ms
+/i == 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.declare.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.declare.d
new file mode 100644
index 0000000..845b3fa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.declare.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declaration of variable outside probe clause
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+int i;
+tick-10ms
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.declareafter.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.declareafter.d
new file mode 100644
index 0000000..1c1e2ea
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.declareafter.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declaration of a variable after probe clause definition.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	exit(0);
+}
+int i;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.emptyprobe.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.emptyprobe.d
new file mode 100644
index 0000000..e23a8db
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.emptyprobe.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Multiple probe clause declarations.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+}
+tick-10ms
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragma.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragma.d
new file mode 100644
index 0000000..035079d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragma.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ *	Test to Declare pragma in right place.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-10ms
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmaaftertab.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmaaftertab.d
new file mode 100644
index 0000000..be725f9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmaaftertab.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare pragma after a tab and make sure it results in compilation error.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+	#pragma D option quiet
+
+tick-10ms
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmainside.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmainside.d
new file mode 100644
index 0000000..e602a41
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmainside.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare pragma inside probe clause.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+
+tick-10ms
+{
+#pragma D option quiet
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmaoutside.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmaoutside.d
new file mode 100644
index 0000000..7d2ea61
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.pragmaoutside.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Declare pragma outside probe clause.
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+
+tick-10ms
+{
+	exit(0);
+}
+#pragma D option quiet
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.probestar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.probestar.d
new file mode 100644
index 0000000..3f54321
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/probes/tst.probestar.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call matching probe clauses with given name using "*"
+ *
+ * SECTION: Program Structure/Probe Clauses and Declarations
+ *
+ */
+
+
+#pragma D option quiet
+
+int i;
+BEGIN
+{
+	i = 0;
+}
+
+syscall::*lwp*:entry
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.create.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.create.ksh
new file mode 100644
index 0000000..5b484cf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.create.ksh
@@ -0,0 +1,67 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that the proc:::create probe fires with the proper
+# arguments.
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::create
+	/args[0]->pr_ppid == $child && pid == $child/
+	{
+		exit(0);
+	}
+EOF
+}
+
+sleeper()
+{
+	while true; do
+		/usr/bin/sleep 1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+sleeper &
+child=$!
+
+script
+status=$?
+
+kill $child
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.discard.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
new file mode 100644
index 0000000..5595c24
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
@@ -0,0 +1,74 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that the proc:::signal-discard probe fires correctly
+# and with the correct arguments.
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::signal-discard
+	/args[1]->pr_pid == $child &&
+	    args[1]->pr_psargs == "$longsleep" && args[2] == SIGHUP/
+	{
+		exit(0);
+	}
+EOF
+}
+
+killer()
+{
+	while true; do
+		sleep 1
+		/usr/bin/kill -HUP $child
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+longsleep="/usr/bin/sleep 10000"
+
+/usr/bin/nohup $longsleep &
+child=$!
+
+killer &
+killer=$!
+script
+status=$?
+
+kill $child
+kill $killer
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exec.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exec.ksh
new file mode 100644
index 0000000..0318ae6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exec.ksh
@@ -0,0 +1,73 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that the proc:::exec probe fires, followed by the
+# proc:::exec-success probe (in a successful exec(2)).
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::exec
+	/curpsinfo->pr_ppid == $child && args[0] == "/usr/bin/sleep"/
+	{
+		self->exec = 1;
+	}
+
+	proc:::exec-success
+	/self->exec/
+	{
+		exit(0);
+	}
+EOF
+}
+
+sleeper()
+{
+	while true; do
+		/usr/bin/sleep 1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+sleeper &
+child=$!
+
+script
+status=$?
+
+kill $child
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh
new file mode 100644
index 0000000..fb1efc5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ENOENT.ksh
@@ -0,0 +1,84 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script is identical to tst.execfail.ksh -- but it additionally checks
+# that errno is set to ENOENT in the case that an interpreter can't be
+# found.
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::exec
+	/curpsinfo->pr_ppid == $child && args[0] == "$badexec"/
+	{
+		self->exec = 1;
+	}
+
+	proc:::exec-failure
+	/self->exec && args[0] == ENOENT/
+	{
+		exit(0);
+	}
+EOF
+}
+
+sleeper()
+{
+	while true; do
+		/usr/bin/sleep 1
+		$badexec
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+badexec=/tmp/execfail.ENOENT.ksh.$$
+dtrace=$1
+
+cat > $badexec <<EOF
+#!/this_is_a_bogus_interpreter
+EOF
+
+chmod +x $badexec
+
+sleeper &
+child=$!
+
+script
+status=$?
+
+kill $child
+rm $badexec
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh
new file mode 100644
index 0000000..d2241e1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.execfail.ksh
@@ -0,0 +1,86 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that -- if a exec(2) fails -- the proc:::exec probe fires,
+# followed by the proc:::exec-success probe (in a successful exec(2)).  To
+# circumvent any potential shell cleverness, this script generates exec
+# failure by generating a file with a bogus interpreter.  (It seems unlikely
+# that a shell -- regardless of how clever it claims to be -- would bother to
+# validate the interpreter before exec'ing.)
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::exec
+	/curpsinfo->pr_ppid == $child && args[0] == "$badexec"/
+	{
+		self->exec = 1;
+	}
+
+	proc:::exec-failure
+	/self->exec/
+	{
+		exit(0);
+	}
+EOF
+}
+
+sleeper()
+{
+	while true; do
+		/usr/bin/sleep 1
+		$badexec
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+badexec=/tmp/execfail.ksh.$$
+dtrace=$1
+
+cat > $badexec <<EOF
+#!/this_is_a_bogus_interpreter
+EOF
+
+chmod +x $badexec
+
+sleeper &
+child=$!
+script
+status=$?
+
+kill $child
+rm $badexec
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh
new file mode 100644
index 0000000..df3fdb3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitcore.ksh
@@ -0,0 +1,95 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that the proc:::exit probe fires with the correct argument
+# when the process core dumps.  The problematic bit here is making sure that
+# a process _can_ dump core -- if core dumps are disabled on both a global
+# and per-process basis, this test will fail.  Rather than having this test
+# muck with coreadm(1M) settings, it will fail explicitly in this case and
+# provide a hint as to the problem.  In general, machines should never be
+# running with both per-process and global core dumps disabled -- so this
+# should be a non-issue in practice.
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::exit
+	/curpsinfo->pr_ppid == $child &&
+	    curpsinfo->pr_psargs == "$longsleep" && args[0] == CLD_DUMPED/
+	{
+		exit(0);
+	}
+
+	proc:::exit
+	/curpsinfo->pr_ppid == $child &&
+	    curpsinfo->pr_psargs == "$longsleep" && args[0] != CLD_DUMPED/
+	{
+		printf("Child process could not dump core.  Check coreadm(1M)");
+		printf(" settings; either per-process or global core dumps ");
+		printf("must be enabled for this test to work properly.");
+		exit(1);
+	}
+EOF
+}
+
+sleeper()
+{
+	/usr/bin/coreadm -p $corefile
+	while true; do
+		$longsleep &
+		/usr/bin/sleep 1
+		kill -SEGV $!
+	done
+	/usr/bin/rm -f $corefile
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+longsleep="/usr/bin/sleep 10000"
+corefile=/tmp/core.$$
+
+sleeper &
+child=$!
+
+script
+status=$?
+
+pstop $child
+pkill -P $child
+kill $child
+prun $child
+
+/usr/bin/rm -f $corefile
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh
new file mode 100644
index 0000000..13af911
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitexit.ksh
@@ -0,0 +1,67 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that the proc:::exit probe fires with the correct argument
+# when the process explicitly exits.
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::exit
+	/curpsinfo->pr_ppid == $child && args[0] == CLD_EXITED/
+	{
+		exit(0);
+	}
+EOF
+}
+
+sleeper()
+{
+	while true; do
+		/usr/bin/sleep 1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+sleeper &
+child=$!
+
+script
+status=$?
+
+kill $child
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
new file mode 100644
index 0000000..8040ade
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
@@ -0,0 +1,75 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that the proc:::exit probe fires with the correct argument
+# when the process is killed.
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::exit
+	/curpsinfo->pr_ppid == $child &&
+	    curpsinfo->pr_psargs == "$longsleep" && args[0] == CLD_KILLED/
+	{
+		exit(0);
+	}
+EOF
+}
+
+sleeper()
+{
+	while true; do
+		$longsleep &
+		/usr/bin/sleep 1
+		kill -9 $!
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+longsleep="/usr/bin/sleep 10000"
+
+sleeper &
+child=$!
+
+script
+status=$?
+
+pstop $child
+pkill -P $child
+kill $child
+prun $child
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.signal.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
new file mode 100644
index 0000000..cd3c791
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
@@ -0,0 +1,84 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that the proc:::signal-send and proc:::signal-handle
+# probes fire correctly and with the correct arguments.
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::signal-send
+	/execname == "kill" && curpsinfo->pr_ppid == $child &&
+	    args[1]->pr_psargs == "$longsleep" && args[2] == SIGUSR1/
+	{
+		/*
+		 * This is guaranteed to not race with signal-handle.
+		 */
+		target = args[1]->pr_pid;
+	}
+
+	proc:::signal-handle
+	/target == pid && args[0] == SIGUSR1/
+	{
+		exit(0);
+	}
+EOF
+}
+
+sleeper()
+{
+	while true; do
+		$longsleep &
+		sleep 1
+		/usr/bin/kill -USR1 $!
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+longsleep="/usr/bin/sleep 10000"
+
+sleeper &
+child=$!
+
+script
+status=$?
+
+pstop $child
+pkill -P $child
+kill $child
+prun $child
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.c
new file mode 100644
index 0000000..8f6231b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.c
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <signal.h>
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+int
+main(int argc, char **argv)
+{
+	struct sigevent ev;
+	struct itimerspec ts;
+	sigset_t set;
+	timer_t tid;
+	char *cmd = argv[0];
+
+	ev.sigev_notify = SIGEV_SIGNAL;
+	ev.sigev_signo = SIGUSR1;
+
+	if (timer_create(CLOCK_REALTIME, &ev, &tid) == -1) {
+		(void) fprintf(stderr, "%s: cannot create CLOCK_HIGHRES "
+		    "timer: %s\n", cmd, strerror(errno));
+		exit(EXIT_FAILURE);
+	}
+
+	(void) sigemptyset(&set);
+	(void) sigaddset(&set, SIGUSR1);
+	(void) sigprocmask(SIG_BLOCK, &set, NULL);
+
+	ts.it_value.tv_sec = 1;
+	ts.it_value.tv_nsec = 0;
+	ts.it_interval.tv_sec = 0;
+	ts.it_interval.tv_nsec = NANOSEC / 2;
+
+	if (timer_settime(tid, TIMER_RELTIME, &ts, NULL) == -1) {
+		(void) fprintf(stderr, "%s: timer_settime() failed: %s\n",
+		    cmd, strerror(errno));
+		exit(EXIT_FAILURE);
+	}
+
+	for (;;) {
+		(void) sigwait(&set);
+	}
+
+	/*NOTREACHED*/
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.d
new file mode 100644
index 0000000..851fa26
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.sigwait.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option destructive
+
+proc:::signal-send
+/pid == 0 && args[1]->pr_pid == $1 && args[2] == SIGUSR1/
+{
+	sent = 1;
+}
+
+proc:::signal-clear
+/pid == $1 && args[0] == SIGUSR1 && sent/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.startexit.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.startexit.ksh
new file mode 100644
index 0000000..4291738
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/proc/tst.startexit.ksh
@@ -0,0 +1,89 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script tests that the firing order of probes in a process is:
+# 
+#  1.  proc:::start
+#  2.  proc:::lwp-start
+#  3.  proc:::lwp-exit
+#  4.  proc:::exit
+#
+# If this fails, the script will run indefinitely; it relies on the harness
+# to time it out.
+#
+script()
+{
+	$dtrace -s /dev/stdin <<EOF
+	proc:::start
+	/curpsinfo->pr_ppid == $child/
+	{
+		self->start = 1;
+	}
+
+	proc:::lwp-start
+	/self->start/
+	{
+		self->lwp_start = 1;
+	}
+
+	proc:::lwp-exit
+	/self->lwp_start/
+	{
+		self->lwp_exit = 1;
+	}
+
+	proc:::exit
+	/self->lwp_exit == 1/
+	{
+		exit(0);
+	}
+EOF
+}
+
+sleeper()
+{
+	while true; do
+		/usr/bin/sleep 1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+sleeper &
+child=$!
+
+script
+status=$?
+
+kill $child
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZERO.profile.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZERO.profile.d
new file mode 100644
index 0000000..e4e031b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZERO.profile.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * profile without valid value keyword just call with 'n'.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-n
+{
+	printf("This test should fail\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROonens.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROonens.d
new file mode 100644
index 0000000..3ed28b1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROonens.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call profile-'ns' less than 200 micro seconds.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+profile-1ns
+{
+	printf("Calls 'ns' less than 200 micro seconds\n");
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROonensec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROonensec.d
new file mode 100644
index 0000000..7b4df19
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROonensec.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call profile-1nsec; less than 200 micro seconds.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+profile-1nsec
+{
+	printf("Call profile-1nsec; less than 200 micro seconds\n");
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROoneus.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROoneus.d
new file mode 100644
index 0000000..6a64a3a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROoneus.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call profile-us; less than 200 micro seconds.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+profile-1us
+{
+	printf(" Calling profile-us less than 200 micro seconds should fail\n");
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROoneusec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROoneusec.d
new file mode 100644
index 0000000..b6b80be
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/err.D_PDESC_ZEROoneusec.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * profile-usec; less than 200 micro seconds.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+profile-1usec
+{
+	printf("profile-usec; less than 200 micro seconds \n");
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.argtest.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.argtest.d
new file mode 100644
index 0000000..26a40b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.argtest.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Either one of arg0 (or) arg1 should be 0 and non-zero.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-1
+/(arg0 != 0 && arg1 == 0) || (arg0 == 0 && arg1 != 0)/
+{
+	printf("Test passed; either arg0/arg1 is zero\n");
+	exit(0);
+}
+
+tick-1
+/(arg0 == 0 && arg1 == 0) || (arg0 != 0 && arg1 != 0)/
+{
+	printf("Test failed; either arg0 (or) arg1 should be non zero\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.argtest.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.argtest.d.out
new file mode 100644
index 0000000..0bd3353
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.argtest.d.out
@@ -0,0 +1,2 @@
+Test passed; either arg0/arg1 is zero
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.basic.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.basic.d
new file mode 100644
index 0000000..df8bf98
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.basic.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * profile-n simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1
+{
+	printf("This test is a simple profile-n provider test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.basic.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.basic.d.out
new file mode 100644
index 0000000..09005bb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.basic.d.out
@@ -0,0 +1,2 @@
+This test is a simple profile-n provider test
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh
new file mode 100644
index 0000000..358d362
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.func.ksh
@@ -0,0 +1,74 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	profile-1234hz
+	/arg0 != 0/
+	{
+		@[func(arg0)] = count();
+	}
+
+	tick-100ms
+	/i++ == 50/
+	{
+		exit(0);
+	}
+EOF
+}
+
+spinny()
+{
+	while true; do
+		/usr/bin/date > /dev/null
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+spinny &
+child=$!
+
+#
+# This is gutsy -- we're assuming that mutex_enter(9F) will show up in the
+# output.  This is most likely _not_ to show up in the output if the 
+# platform does not support arbitrary resolution interval timers -- but
+# the above script was stress-tested down to 100 hertz and still ran
+# successfully on all platforms, so one is hopeful that this test will pass
+# even in that case.
+#
+script | tee /dev/fd/2 | grep mutex_enter > /dev/null
+status=$?
+
+kill $child
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh
new file mode 100644
index 0000000..4652ff3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.mod.ksh
@@ -0,0 +1,70 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	profile-1234hz
+	/arg0 != 0/
+	{
+		@[mod(arg0)] = count();
+	}
+
+	tick-100ms
+	/i++ == 20/
+	{
+		exit(0);
+	}
+EOF
+}
+
+spinny()
+{
+	while true; do
+		/usr/bin/date > /dev/null
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+spinny &
+child=$!
+
+#
+# The only thing we can be sure of is that some module named "unix" (or
+# "genunix") did some work -- so that's all we'll check.
+#
+script | tee /dev/fd/2 | grep unix > /dev/null
+status=$? 
+
+kill $child
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilehz.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilehz.d
new file mode 100644
index 0000000..ba69def
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilehz.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-hz test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-100hz
+{
+	printf("This test is a simple profile-hz provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilehz.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilehz.d.out
new file mode 100644
index 0000000..711f635
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilehz.d.out
@@ -0,0 +1 @@
+This test is a simple profile-hz provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilems.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilems.d
new file mode 100644
index 0000000..7ec573e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilems.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-ms simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1ms
+{
+	printf("This test is a simple profile-ms provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilems.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilems.d.out
new file mode 100644
index 0000000..1fe17e7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilems.d.out
@@ -0,0 +1 @@
+This test is a simple profile-ms provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilemsec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilemsec.d
new file mode 100644
index 0000000..80451e8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilemsec.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-msec simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1msec
+{
+	printf("This test is a simple profile-msec provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilemsec.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilemsec.d.out
new file mode 100644
index 0000000..c3fb4a3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilemsec.d.out
@@ -0,0 +1 @@
+This test is a simple profile-msec provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilenhz.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilenhz.d
new file mode 100644
index 0000000..37b2090
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilenhz.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * profile-<number> simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-100
+{
+	printf("This test is a simple profile implicit hz test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilenhz.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilenhz.d.out
new file mode 100644
index 0000000..c9409ce
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilenhz.d.out
@@ -0,0 +1 @@
+This test is a simple profile implicit hz test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilens.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilens.d
new file mode 100644
index 0000000..72f95ad
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilens.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-2000000000ns simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-2000000000ns
+{
+	printf("This test is a simple profile-ns provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilens.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilens.d.out
new file mode 100644
index 0000000..86251d0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilens.d.out
@@ -0,0 +1 @@
+This test is a simple profile-ns provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilensec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilensec.d
new file mode 100644
index 0000000..d0236e9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilensec.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-nsec simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-2000000000nsec
+{
+	printf("This test is a simple profile-nsec provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilensec.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilensec.d.out
new file mode 100644
index 0000000..890b769
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilensec.d.out
@@ -0,0 +1 @@
+This test is a simple profile-nsec provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profiles.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profiles.d
new file mode 100644
index 0000000..65201fc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profiles.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-s simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1s
+{
+	printf("This test is a simple profile-s provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profiles.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profiles.d.out
new file mode 100644
index 0000000..03a0cf2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profiles.d.out
@@ -0,0 +1 @@
+This test is a simple profile-s provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilesec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilesec.d
new file mode 100644
index 0000000..3e52ac5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilesec.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-sec simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-1sec
+{
+	printf("This test is a simple profile-sec provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilesec.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilesec.d.out
new file mode 100644
index 0000000..9091592
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profilesec.d.out
@@ -0,0 +1 @@
+This test is a simple profile-sec provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileus.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileus.d
new file mode 100644
index 0000000..32ab415
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileus.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-us simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-200us
+{
+	printf("This test is a simple profile-us provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileus.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileus.d.out
new file mode 100644
index 0000000..aa27064
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileus.d.out
@@ -0,0 +1 @@
+This test is a simple profile-us provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileusec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileusec.d
new file mode 100644
index 0000000..78df000
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileusec.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple profile-usec simple test.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+profile-200usec
+{
+	printf("This test is a simple profile-usec provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileusec.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileusec.d.out
new file mode 100644
index 0000000..96dfef1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.profileusec.d.out
@@ -0,0 +1 @@
+This test is a simple profile-usec provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh
new file mode 100644
index 0000000..218a651
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.sym.ksh
@@ -0,0 +1,70 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	profile-1234hz
+	/arg0 != 0/
+	{
+		@[sym(arg0)] = count();
+	}
+
+	tick-100ms
+	/i++ == 50/
+	{
+		exit(0);
+	}
+EOF
+}
+
+spinny()
+{
+	while true; do
+		/usr/bin/date > /dev/null
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+spinny &
+child=$!
+
+#
+# This is the same gutsy test as that found in the func() test; see that
+# test for the rationale.
+#
+script | tee /dev/fd/2 | grep mutex_enter > /dev/null
+status=$?
+
+kill $child
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh
new file mode 100644
index 0000000..69c0f84
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh
@@ -0,0 +1,71 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	profile-1234hz
+	/arg1 != 0/
+	{
+		@[ufunc(arg1)] = count();
+	}
+
+	tick-100ms
+	/i++ == 20/
+	{
+		exit(0);
+	}
+EOF
+}
+
+spinny()
+{
+	while true; do
+		let i=i+1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+spinny &
+child=$!
+
+#
+# The only thing we can be sure of here is that we caught some function in
+# ksh doing work.  (This actually goes one step further and assumes that we
+# catch some non-static function in ksh.)
+#
+script | tee /dev/fd/2 | grep 'ksh`[a-zA-Z_]' > /dev/null
+status=$? 
+
+kill $child
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.c
new file mode 100644
index 0000000..96d78a4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.c
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+typedef void f(int x);
+
+static void
+f_a(int i)
+{
+}
+
+static void
+f_b(int i)
+{
+}
+
+static void
+f_c(int i)
+{
+}
+
+static void
+f_d(int i)
+{
+}
+
+static void
+f_e(int i)
+{
+}
+
+static void
+fN(f func, int i)
+{
+	func(i);
+}
+
+int
+main()
+{
+	fN(f_a, 1);
+	fN(f_b, 2);
+	fN(f_c, 3);
+	fN(f_d, 4);
+	fN(f_e, 5);
+	fN(f_a, 11);
+	fN(f_c, 13);
+	fN(f_d, 14);
+	fN(f_a, 101);
+	fN(f_c, 103);
+	fN(f_c, 1003);
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.ksh
new file mode 100755
index 0000000..4689355
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.ksh
@@ -0,0 +1,66 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+# 	ufunc() values sort as expected
+#
+# SECTION: Aggregations, Printing Aggregations
+#
+# NOTES: Assumes that the order of user function addresses will follow
+#	the function declaration order.
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -c ./tst.ufuncsort.exe -s /dev/stdin <<EOF
+
+
+	#pragma D option quiet
+	#pragma D option aggsortkey
+
+	pid\$target::fN:entry
+	{
+		@[ufunc(arg0)] = count();
+	}
+EOF
+
+status=$?
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+	exit $status
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.ksh.out
new file mode 100644
index 0000000..a364322
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.ufuncsort.ksh.out
@@ -0,0 +1,6 @@
+
+  tst.ufuncsort.exe`f_a                                             3
+  tst.ufuncsort.exe`f_b                                             1
+  tst.ufuncsort.exe`f_c                                             4
+  tst.ufuncsort.exe`f_d                                             2
+  tst.ufuncsort.exe`f_e                                             1
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh
new file mode 100644
index 0000000..6ca823f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh
@@ -0,0 +1,69 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	profile-1234hz
+	/arg1 != 0/
+	{
+		@[umod(arg1)] = count();
+	}
+
+	tick-100ms
+	/i++ == 20/
+	{
+		exit(0);
+	}
+EOF
+}
+
+spinny()
+{
+	while true; do
+		let i=i+1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+spinny &
+child=$!
+
+#
+# The only thing we can be sure of here is that ksh is doing some work.
+#
+script | tee /dev/fd/2 | grep -w ksh > /dev/null
+status=$? 
+
+kill $child
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh
new file mode 100644
index 0000000..b1a3ab9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh
@@ -0,0 +1,70 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	profile-1234hz
+	/arg1 != 0/
+	{
+		@[usym(arg1)] = count();
+	}
+
+	tick-100ms
+	/i++ == 20/
+	{
+		exit(0);
+	}
+EOF
+}
+
+spinny()
+{
+	while true; do
+		let i=i+1
+	done
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+spinny &
+child=$!
+
+#
+# This test is essentially the same as that in the ufunc test; see that
+# test for the rationale.
+#
+script | tee /dev/fd/2 | grep 'ksh`[a-zA-Z_]' > /dev/null
+status=$? 
+
+kill $child
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_INVAL.wrongdec4.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_INVAL.wrongdec4.d
new file mode 100644
index 0000000..0a7aa14
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_INVAL.wrongdec4.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ *	call profile<provider name>; called with no "::::".
+ *	should fail with compilation error.
+ *
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile::::tick-1sec
+{
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.nonprofile.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.nonprofile.d
new file mode 100644
index 0000000..1356a89
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.nonprofile.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test;
+ *	Call user created provider. Make sure it gives compilation error.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::test
+/i < 3/
+{
+	i++;
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec1.d
new file mode 100644
index 0000000..e06edee
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec1.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ *	call profile::<provider name>; called with two "::".
+ *	should fail with compilation error.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile::tick-1sec
+{
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec2.d
new file mode 100644
index 0000000..ea8909c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec2.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ *	call profile:<provider name>; called with one ":".
+ *	should fail with compilation error.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:tick-1sec
+{
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec3.d
new file mode 100644
index 0000000..edea0b9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/err.D_PDESC_ZERO.wrongdec3.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ *	call profile<provider name>; called with no ":".
+ *	should fail with compilation error.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profiletick-1sec
+{
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.basics.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.basics.d
new file mode 100644
index 0000000..6b6e526
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.basics.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test;
+ *	Call same profile provider two times
+ *	Match expected output in tst.basics.d.out
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 3/
+{
+	i++;
+	trace(i);
+}
+
+profile:::tick-1sec
+/i == 3/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.basics.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.basics.d.out
new file mode 100644
index 0000000..190a180
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.basics.d.out
@@ -0,0 +1 @@
+123
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginexit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginexit.d
new file mode 100644
index 0000000..202abe6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginexit.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	exit(0);
+}
+
+BEGIN
+{
+	printf("shouldn't be here...");
+	here++;
+}
+
+END
+{
+	exit(here);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginprof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginprof.d
new file mode 100644
index 0000000..99989d9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginprof.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ * 	print the 'probeprov, probemod, probefunc, probename' from
+ *	BEGIN
+ *	Match the output from tst.beginprof.d.out
+ *
+ * SECTION: profile Provider/profile-n probes;
+ *	Variables/Built-in Variables
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("%s %s %s %s", probeprov, probemod, probefunc, probename);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginprof.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginprof.d.out
new file mode 100644
index 0000000..d28a057
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.beginprof.d.out
@@ -0,0 +1 @@
+dtrace   BEGIN
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probattrs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probattrs.d
new file mode 100644
index 0000000..bd24ca0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probattrs.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ * 	print the 'probeprov, probemod, probefunc, probename' at once.
+ *	Match expected output in tst.probattrs.d.out
+ *
+ *
+ * SECTION: profile Provider/tick-n probes;
+ * 	Variables/Built-in Variables
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	printf("%s %s %s %s", probeprov, probemod, probefunc, probename);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probattrs.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probattrs.d.out
new file mode 100644
index 0000000..2a13979
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probattrs.d.out
@@ -0,0 +1 @@
+profile   tick-1sec
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probefunc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probefunc.d
new file mode 100644
index 0000000..fa7c47c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probefunc.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ * 	print the 'probefunc' field i.e. Current probe description's function
+ *	field.
+ *	Match expected output in tst.probefunc.d.out
+ *
+ * SECTION: profile Provider/tick-n probes;
+ * 	Variables/Built-in Variables
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	printf("probe funct = %s", probefunc);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probefunc.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probefunc.d.out
new file mode 100644
index 0000000..de191dd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probefunc.d.out
@@ -0,0 +1 @@
+probe funct = 
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probemod.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probemod.d
new file mode 100644
index 0000000..89fd8b2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probemod.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ * 	print the 'probemod' field i.e. Current probe description's module
+ *	field.
+ *	Match expected output in tst.probemod.d.out
+ *
+ * SECTION: profile Provider/tick-n probes;
+ *	Variables/Built-in Variables
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	printf("probe description module field = %s", probemod);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probemod.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probemod.d.out
new file mode 100644
index 0000000..1c95a77
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probemod.d.out
@@ -0,0 +1 @@
+probe description module field = 
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probename.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probename.d
new file mode 100644
index 0000000..c58097f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probename.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ * 	print the 'probename' field i.e. Current probe description's name
+ *	field.
+ *	Match expected output in tst.probename.d.out
+ *
+ * SECTION: profile Provider/tick-n probes;
+ * 	Variables/Built-in Variables
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	printf("probe name = %s", probename);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probename.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probename.d.out
new file mode 100644
index 0000000..e5ff3e0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probename.d.out
@@ -0,0 +1 @@
+probe name = tick-1sec
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probprov.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probprov.d
new file mode 100644
index 0000000..3c3ccef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probprov.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ * 	print the 'probeprov' field i.e. Current probe description's provider
+ *	field.
+ *	Match expected output in tst.probeprov.d.out
+ *
+ * SECTION: profile Provider/tick-n probes;
+ * 	Variables/Built-in Variables
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	printf("probe description provider = %s", probeprov);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probprov.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probprov.d.out
new file mode 100644
index 0000000..d8ca594
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.probprov.d.out
@@ -0,0 +1 @@
+probe description provider = profile
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profend.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profend.d
new file mode 100644
index 0000000..9ab438a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profend.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ *	Call simple profile with END profile.
+ *	Match expected output in tst.profend.d.out
+ *
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	i++;
+	trace(i);
+	exit(0);
+}
+
+dtrace:::END
+{
+	printf("\nI'm at END");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profend.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profend.d.out
new file mode 100644
index 0000000..42e3005
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profend.d.out
@@ -0,0 +1,2 @@
+1
+I'm at END
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profexit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profexit.d
new file mode 100644
index 0000000..884053f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profexit.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test;
+ *	Call simple profile
+ *	Match expected output in tst.profexit.d.out
+ *
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	i++;
+	trace(i);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profexit.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profexit.d.out
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.profexit.d.out
@@ -0,0 +1 @@
+1
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.trace.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.trace.d
new file mode 100644
index 0000000..ec7053d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.trace.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ *	Call simple profile with trace() in END profile
+ *	Match expected output in tst.trace.d.out
+ *
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+{
+	i++;
+	exit(0);
+}
+
+dtrace:::END
+{
+	trace(i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.trace.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.trace.d.out
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.trace.d.out
@@ -0,0 +1 @@
+1
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.twoprof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.twoprof.d
new file mode 100644
index 0000000..352ed0b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.twoprof.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Simple profile provider test.
+ *	Call two different profile provider
+ *	Match expected output in tst.twoprof.d.out
+ *
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 3/
+{
+	i++;
+	trace(i);
+}
+
+profile:::tick-100msec
+/i == 3/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.twoprof.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.twoprof.d.out
new file mode 100644
index 0000000..190a180
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/providers/tst.twoprof.d.out
@@ -0,0 +1 @@
+123
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.c
new file mode 100644
index 0000000..e391083
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.c
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+#include <signal.h>
+
+int
+main(int argc, char **argv)
+{
+	sigset_t ss;
+
+	(void) sigemptyset(&ss);
+	(void) sigaddset(&ss, SIGINT);
+	(void) sigprocmask(SIG_BLOCK, &ss, NULL);
+
+	do {
+		(void) getpid();
+		(void) sigpending(&ss);
+	} while (!sigismember(&ss, SIGINT));
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.d
new file mode 100644
index 0000000..b3b70f2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive test for raise
+ *
+ * SECTION: Actions and Subroutines/raise()
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the process to call getpid().
+	 */
+	timeout = timestamp + 1000000000;
+}
+
+syscall::getpid:entry
+/pid == $1/
+{
+	trace("raised");
+	raise(SIGINT);
+	/*
+	 * Wait no more than half a second for the process to die.
+	 */
+	timeout = timestamp + 500000000;
+}
+
+syscall::rexit:entry
+{
+	exit(0);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.c
new file mode 100644
index 0000000..be0d982
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.c
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+#include <signal.h>
+
+static void
+handle(int sig)
+{
+	exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+	struct sigaction sa;
+
+	sa.sa_handler = handle;
+	sigemptyset(&sa.sa_mask);
+	sa.sa_flags = 0;
+
+	(void) sigaction(SIGINT, &sa, NULL);
+
+	for (;;) {
+		(void) getpid();
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.d
new file mode 100644
index 0000000..1f967a3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive test for raise
+ *
+ * SECTION: Actions and Subroutines/raise()
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the process to call getpid().
+	 */
+	timeout = timestamp + 1000000000;
+}
+
+syscall::getpid:return
+/pid == $1/
+{
+	trace("raised");
+	raise(SIGINT);
+	/*
+	 * Wait no more than half a second for the process to die.
+	 */
+	timeout = timestamp + 500000000;
+}
+
+syscall::rexit:entry
+{
+	exit(0);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.c
new file mode 100644
index 0000000..be0d982
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.c
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+#include <signal.h>
+
+static void
+handle(int sig)
+{
+	exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+	struct sigaction sa;
+
+	sa.sa_handler = handle;
+	sigemptyset(&sa.sa_mask);
+	sa.sa_flags = 0;
+
+	(void) sigaction(SIGINT, &sa, NULL);
+
+	for (;;) {
+		(void) getpid();
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.d
new file mode 100644
index 0000000..b3b70f2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive test for raise
+ *
+ * SECTION: Actions and Subroutines/raise()
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the process to call getpid().
+	 */
+	timeout = timestamp + 1000000000;
+}
+
+syscall::getpid:entry
+/pid == $1/
+{
+	trace("raised");
+	raise(SIGINT);
+	/*
+	 * Wait no more than half a second for the process to die.
+	 */
+	timeout = timestamp + 500000000;
+}
+
+syscall::rexit:entry
+{
+	exit(0);
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("timed out");
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.aggrate.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.aggrate.d
new file mode 100644
index 0000000..513cd31
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.aggrate.d
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   If the aggregation rate is set properly, there should be no aggregation
+ *   drops.
+ *
+ * SECTION: Aggregations/Minimizing drops;
+ *	Options and Tunables/aggrate;
+ *	Options and Tunables/aggsize
+ */
+
+/*
+ * We rely on the fact that at least 30 bytes must be stored per aggregation
+ * iteration, but that no more than 300 bytes are stored per iteration.
+ * We are going to let this run for ten seconds.  If the aggregation rate
+ * is being set properly, there should be no aggregation drops.  Note that
+ * this test (regrettably) may be scheduling sensitive -- but it should only
+ * fail on the most pathological systems.
+ */
+#pragma D option aggsize=300
+#pragma D option aggrate=10msec
+#pragma D option quiet
+
+int n;
+
+tick-100msec
+/n < 100/
+{
+	@a[n++] = sum(n);
+}
+
+tick-100msec
+/n == 100/
+{
+	exit(0);
+}
+
+END
+{
+	printa("%10d\n", @a);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.aggrate.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.aggrate.d.out
new file mode 100644
index 0000000..c45f929
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.aggrate.d.out
@@ -0,0 +1,101 @@
+         0
+         1
+         2
+         3
+         4
+         5
+         6
+         7
+         8
+         9
+        10
+        11
+        12
+        13
+        14
+        15
+        16
+        17
+        18
+        19
+        20
+        21
+        22
+        23
+        24
+        25
+        26
+        27
+        28
+        29
+        30
+        31
+        32
+        33
+        34
+        35
+        36
+        37
+        38
+        39
+        40
+        41
+        42
+        43
+        44
+        45
+        46
+        47
+        48
+        49
+        50
+        51
+        52
+        53
+        54
+        55
+        56
+        57
+        58
+        59
+        60
+        61
+        62
+        63
+        64
+        65
+        66
+        67
+        68
+        69
+        70
+        71
+        72
+        73
+        74
+        75
+        76
+        77
+        78
+        79
+        80
+        81
+        82
+        83
+        84
+        85
+        86
+        87
+        88
+        89
+        90
+        91
+        92
+        93
+        94
+        95
+        96
+        97
+        98
+        99
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.statusrate.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.statusrate.d
new file mode 100644
index 0000000..43c23bf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.statusrate.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Positive test of statusrate option.
+ *
+ * SECTION: Options and Tunables/statusrate
+ */
+
+/*
+ * Tests the statusrate option, by checking that the time delta between
+ * exit() and END is at least as long as mandated by the statusrate.
+ */
+
+#pragma D option statusrate=10sec
+
+inline uint64_t NANOSEC = 1000000000;
+
+tick-1sec
+/n++ > 5/
+{
+	exit(2);
+	ts = timestamp;
+}
+
+END
+/(this->delta = timestamp - ts) > 2 * NANOSEC/
+{
+	exit(0);
+}
+
+END
+/this->delta <= 2 * NANOSEC/
+{
+	printf("delta between exit() and END (%u nanos) too small",
+	    this->delta);
+	exit(1);
+}
+
+END
+/this->delta > 20 * NANOSEC/
+{
+	printf("delta between exit() and END (%u nanos) too large",
+	    this->delta);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.switchrate.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.switchrate.d
new file mode 100644
index 0000000..691b31c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.switchrate.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   If the switch rate is set properly, there should be no drops.
+ *
+ * SECTION: Buffers and Buffering/switch Policy;
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/switchrate
+ */
+
+/*
+ * We rely on the fact that at least 8 bytes must be stored per iteration
+ * (EPID plus data), but that no more than 40 bytes are stored per iteration.
+ * We are going to let this run for ten seconds.  If the switch rate
+ * is being set properly, there should be no drops.  Note that this test
+ * (regrettably) may be scheduling sensitive -- but it should only fail on
+ * the most pathological systems.
+ */
+#pragma D option bufsize=40
+#pragma D option switchrate=10msec
+#pragma D option quiet
+
+int n;
+
+tick-100msec
+/n < 100/
+{
+	printf("%10d\n", n++);
+}
+
+tick-100msec
+/n == 100/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.switchrate.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.switchrate.d.out
new file mode 100644
index 0000000..c45f929
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/rates/tst.switchrate.d.out
@@ -0,0 +1,101 @@
+         0
+         1
+         2
+         3
+         4
+         5
+         6
+         7
+         8
+         9
+        10
+        11
+        12
+        13
+        14
+        15
+        16
+        17
+        18
+        19
+        20
+        21
+        22
+        23
+        24
+        25
+        26
+        27
+        28
+        29
+        30
+        31
+        32
+        33
+        34
+        35
+        36
+        37
+        38
+        39
+        40
+        41
+        42
+        43
+        44
+        45
+        46
+        47
+        48
+        49
+        50
+        51
+        52
+        53
+        54
+        55
+        56
+        57
+        58
+        59
+        60
+        61
+        62
+        63
+        64
+        65
+        66
+        67
+        68
+        69
+        70
+        71
+        72
+        73
+        74
+        75
+        76
+        77
+        78
+        79
+        80
+        81
+        82
+        83
+        84
+        85
+        86
+        87
+        88
+        89
+        90
+        91
+        92
+        93
+        94
+        95
+        96
+        97
+        98
+        99
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.basename.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.basename.d
new file mode 100644
index 0000000..3def964
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.basename.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::entry
+/on/
+{
+	trace(basename((char *)rand()));
+}
+
+fbt:::entry
+/on/
+{
+	trace(basename((char *)arg1));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.caller.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.caller.d
new file mode 100644
index 0000000..b9777c1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.caller.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ * 	Make sure that the caller variable is safe to use at every fbt probe
+ *	point.
+ *
+ * SECTION: Variables/Built-in Variables;
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy;
+ * 	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	trace(caller);
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.cleanpath.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.cleanpath.d
new file mode 100644
index 0000000..729f320
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.cleanpath.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(cleanpath((char *)rand()));
+}
+
+fbt:::entry
+/on/
+{
+	trace(cleanpath((char *)arg1));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.copyin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.copyin.d
new file mode 100644
index 0000000..7426d19
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.copyin.d
@@ -0,0 +1,83 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   We set our buffer size absurdly low to prevent a flood of errors that we
+ *   don't care about.  We set our statusrate to be infinitely short to cause
+ *   lots of activity by the DTrace process.
+ *
+ * SECTION: Actions and Subroutines/copyin();
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy;
+ *	Options and Tunables/statusrate
+ */
+
+
+#pragma D option bufsize=16
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=1nsec
+
+syscall:::entry
+{
+	n++;
+	trace(copyin(rand(), 1));
+}
+
+syscall:::entry
+{
+	trace(copyin(rand() | 1, 1));
+}
+
+syscall:::entry
+{
+	trace(copyin(NULL, 1));
+}
+
+dtrace:::ERROR
+{
+	err++;
+}
+
+tick-1sec
+/sec++ == 10/
+{
+	exit(2);
+}
+
+END
+/n == 0 || err == 0/
+{
+	exit(1);
+}
+
+END
+/n != 0 && err != 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.copyin2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.copyin2.d
new file mode 100644
index 0000000..aef0944
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.copyin2.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Test that there is no value of 'size' which can be passed to copyin
+ * to cause mischief.  The somewhat odd order of operations ensures
+ * that we test both size = 0 and size = 0xfff...fff
+ */
+#include <sys/types.h>
+
+
+#if defined(_LP64)
+#define MAX_BITS 63
+size_t size;
+#else
+#define MAX_BITS 31
+size_t size;
+#endif
+
+syscall:::
+/pid == $pid/
+{
+	printf("size = 0x%lx\n", (ulong_t)size);
+}
+
+syscall:::
+/pid == $pid/
+{
+	tracemem(copyin(curthread->t_procp->p_user.u_envp, size), 10);
+}
+
+syscall:::
+/pid == $pid && size > (1 << MAX_BITS)/
+{
+	exit(0);
+}
+
+syscall:::
+/pid == $pid/
+{
+	size = (size << 1ULL) | 1ULL;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ddi_pathname.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ddi_pathname.d
new file mode 100644
index 0000000..7427568
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ddi_pathname.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(ddi_pathname((struct dev_info *)rand(), rand()));
+}
+
+fbt:::entry
+/on/
+{
+	trace(ddi_pathname((struct dev_info *)arg1, rand()));
+}
+
+tick-1sec
+/n++ == 20/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.dirname.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.dirname.d
new file mode 100644
index 0000000..791d9b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.dirname.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(dirname((char *)rand()));
+}
+
+fbt:::entry
+/on/
+{
+	trace(dirname((char *)arg1));
+}
+
+tick-1sec
+/n++ == 20/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.errno.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.errno.d
new file mode 100644
index 0000000..d3f238b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.errno.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	collect errno at every fbt probe and at every firing of a
+ *	high-frequency profile probe
+ */
+
+fbt:::
+{
+	@a[errno] = count();
+}
+
+profile-4999hz
+{
+	@a[errno] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.execname.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.execname.d
new file mode 100644
index 0000000..cd9ca21
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.execname.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	collect execname at every fbt probe and at every firing of a
+ *	high-frequency profile probe
+ */
+
+fbt:::
+{
+	@a[execname] = count();
+}
+
+profile-4999hz
+{
+	@a[execname] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.gid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.gid.d
new file mode 100644
index 0000000..f8f90e7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.gid.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	collect gid at every fbt probe and at every firing of a
+ *	high-frequency profile probe
+ */
+
+fbt:::
+{
+	@a[gid] = count();
+}
+
+profile-4999hz
+{
+	@a[gid] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.hton.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.hton.d
new file mode 100644
index 0000000..d573bfd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.hton.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(htons(0x1122));
+}
+
+fbt:::
+/on/
+{
+	trace(htonl(0x11223344));
+}
+
+fbt:::
+/on/
+{
+	trace(htonll(0x1122334455667788));
+}
+
+fbt:::
+/on/
+{
+	trace(ntohs(0x1122));
+}
+
+fbt:::
+/on/
+{
+	trace(ntohl(0x11223344));
+}
+
+fbt:::
+/on/
+{
+	trace(ntohll(0x1122334455667788));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.index.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.index.d
new file mode 100644
index 0000000..22b0b5b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.index.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(index((char *)rand(), (char *)(rand() ^ vtimestamp)));
+}
+
+fbt:::
+/on/
+{
+	trace(rindex((char *)rand(), (char *)(rand() ^ vtimestamp,
+	    timestamp)));
+}
+
+fbt:::entry
+/on/
+{
+	trace(index((char *)arg0, (char *)arg1, rand()));
+}
+
+fbt:::entry
+/on/
+{
+	trace(rindex((char *)arg0, (char *)arg1));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.msgdsize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.msgdsize.d
new file mode 100644
index 0000000..c4e7c34
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.msgdsize.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Make sure that the msgdsize safe to use at every fbt probe
+ *
+ * SECTION: Actions and Subroutines/msgdsize();
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy;
+ * 	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(msgdsize((mblk_t *)rand()));
+}
+
+fbt:::entry
+/on/
+{
+	trace(msgdsize((mblk_t *)arg1));
+}
+
+tick-1sec
+/n++ == 20/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.msgsize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.msgsize.d
new file mode 100644
index 0000000..42aebe4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.msgsize.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Make sure that the msgsize safe to use at every fbt probe
+ *
+ * SECTION: Actions and Subroutines/msgsize();
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy;
+ * 	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(msgsize((mblk_t *)rand()));
+}
+
+fbt:::
+/on/
+{
+	trace(msgdsize((mblk_t *)rand()));
+}
+
+tick-1sec
+/n++ == 20/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.null.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.null.d
new file mode 100644
index 0000000..cafa3af
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.null.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	trace with NULL argument - generate a bunch of errors
+ *
+ * SECTION: Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy
+ */
+
+/*
+ * We set our buffer size absurdly low to prevent a flood of errors that we
+ * don't care about.
+ */
+
+#pragma D option bufsize=16
+#pragma D option bufpolicy=ring
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	n++;
+	trace(*(int *)NULL);
+}
+
+dtrace:::ERROR
+{
+	err++;
+}
+
+tick-1sec
+/sec++ == 10/
+{
+	exit(2);
+}
+
+END
+/n == 0 || err == 0/
+{
+	exit(1);
+}
+
+END
+/n != 0 && err != 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.pid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.pid.d
new file mode 100644
index 0000000..2b7a92e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.pid.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	collect pid at every fbt probe and at every firing of a
+ *	high-frequency profile probe
+ */
+
+fbt:::
+{
+	@a[pid] = count();
+}
+
+profile-4999hz
+{
+	@a[pid] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ppid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ppid.d
new file mode 100644
index 0000000..faf07dc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ppid.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	collect ppid at every fbt probe and at every firing of a
+ *	high-frequency profile probe
+ */
+
+fbt:::
+{
+	@a[ppid] = count();
+}
+
+profile-4999hz
+{
+	@a[ppid] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.progenyof.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.progenyof.d
new file mode 100644
index 0000000..d488fe2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.progenyof.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	trace progenyof() at every fbt probe point.
+ *
+ * SECTION: Actions and Subroutines/progenyof();
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy;
+ * 	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	trace(progenyof(rand()));
+}
+
+profile-4999hz
+{
+	trace(progenyof(rand()));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.random.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.random.d
new file mode 100644
index 0000000..8d157ef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.random.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	trace rand() at every fbt probe point.
+ *
+ * SECTION: Actions and Subroutines/rand();
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy
+ */
+
+/*
+ * We set our buffer size absurdly low to prevent a flood of errors that we
+ * don't care about.
+ */
+
+#pragma D option bufsize=16
+#pragma D option bufpolicy=ring
+
+fbt:::
+{
+	n++;
+	trace(*(int *)rand());
+}
+
+dtrace:::ERROR
+{
+	err++;
+}
+
+tick-1sec
+/sec++ == 10/
+{
+	exit(2);
+}
+
+END
+/n == 0 || err == 0/
+{
+	exit(1);
+}
+
+END
+/n != 0 && err != 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.rw.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.rw.d
new file mode 100644
index 0000000..0df9787
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.rw.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	@[rw_read_held((krwlock_t *)&`clock)] = count();
+	@[rw_read_held((krwlock_t *)rand())] = count();
+}
+
+fbt:::
+/on/
+{
+	@[rw_write_held((krwlock_t *)&`clock)] = count();
+	@[rw_write_held((krwlock_t *)rand())] = count();
+}
+
+fbt:::
+/on/
+{
+	@[rw_iswriter((krwlock_t *)&`clock)] = count();
+	@[rw_iswriter((krwlock_t *)rand())] = count();
+}
+
+tick-1sec
+/n++ == 20/
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.shortstr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.shortstr.d
new file mode 100644
index 0000000..188f705
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.shortstr.d
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+#pragma D option strsize=16
+
+BEGIN
+{
+	this->str = ",,,Carrots,,Barley,Oatmeal,,,,,,,,,,,,,,,,,,Beans,";
+}
+
+BEGIN
+{
+	strtok(this->str, ",");
+}
+
+BEGIN
+{
+	this->str = ",,,,,,,,,,,,,,,,,,,,,,Carrots,";
+	strtok(this->str, ",");
+}
+
+BEGIN
+{
+	strtok(this->str, "a");
+}
+
+BEGIN
+{
+	printf("%s\n", substr(this->str, 1, 40));
+}
+
+BEGIN
+{
+	printf("%s\n", strjoin(this->str, this->str));
+}
+
+BEGIN
+{
+	this->str1 = ".........................................";
+	printf("%d\n", index(this->str, this->str1));
+}
+
+BEGIN
+{
+	printf("%d\n", rindex(this->str, this->str1));
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stack.d
new file mode 100644
index 0000000..57588b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stack.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Call stack() at every fbt probe point.
+ *
+ * SECTION: Actions and Subroutines/stack();
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy;
+ * 	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	stack();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stackdepth.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stackdepth.d
new file mode 100644
index 0000000..a39387f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stackdepth.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *    Test that the stackdepth variable is safe to use at every fbt probe
+ *    point.
+ *
+ * SECTION: Variables/Built-in Variables;
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy;
+ * 	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	trace(stackdepth);
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stddev.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stddev.d
new file mode 100644
index 0000000..927930d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.stddev.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Call stddev() at every fbt probe point.
+ *
+ * SECTION: Actions and Subroutines/stddev();
+ *	Options and Tunables/bufsize;
+ *	Options and Tunables/bufpolicy;
+ *	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	@a = stddev(1);
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strchr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strchr.d
new file mode 100644
index 0000000..bc95c48
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strchr.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(strchr((char *)(rand() ^ timestamp), rand()));
+}
+
+fbt:::
+/on/
+{
+	trace(strrchr((char *)(rand() ^ timestamp), rand()));
+}
+
+fbt:::entry
+/on/
+{
+	trace(strchr((char *)arg0, '!'));
+}
+
+fbt:::entry
+/on/
+{
+	trace(strrchr((char *)arg0, '!'));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strjoin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strjoin.d
new file mode 100644
index 0000000..5ed2935
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strjoin.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(strjoin((char *)rand(), (char *)(rand() ^ vtimestamp)));
+}
+
+fbt:::entry
+/on/
+{
+	trace(strjoin((char *)arg0, (char *)arg1));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strstr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strstr.d
new file mode 100644
index 0000000..025e547
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strstr.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(strstr((char *)rand(), (char *)(rand() ^ vtimestamp)));
+}
+
+fbt:::entry
+/on/
+{
+	trace(strstr((char *)arg0, (char *)arg1));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strtok.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strtok.d
new file mode 100644
index 0000000..1027d2e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.strtok.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(strtok((char *)rand(), (char *)(rand() ^ vtimestamp)));
+}
+
+fbt:::entry
+/on/
+{
+	trace(strtok((char *)arg0, (char *)arg1));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.substr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.substr.d
new file mode 100644
index 0000000..d5ed9a4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.substr.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	on = (timestamp / 1000000000) & 1;
+}
+
+fbt:::
+/on/
+{
+	trace(substr((char *)rand(), rand() ^ vtimestamp));
+}
+
+fbt:::
+/on/
+{
+	trace(substr((char *)rand(), -rand() ^ vtimestamp));
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ucaller.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ucaller.d
new file mode 100644
index 0000000..524c88b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ucaller.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	collect ucaller at every fbt probe and at every firing of a
+ *	high-frequency profile probe
+ */
+
+fbt:::
+{
+	@a[ucaller] = count();
+}
+
+profile-4999hz
+{
+	@a[ucaller] = count();
+}
+
+tick-1sec
+/n++ == 30/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.uid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.uid.d
new file mode 100644
index 0000000..b546457
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.uid.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	collect uid at every fbt probe and at every firing of a
+ *	high-frequency profile probe
+ */
+
+fbt:::
+{
+	@a[uid] = count();
+}
+
+profile-4999hz
+{
+	@a[uid] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.unalign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.unalign.d
new file mode 100644
index 0000000..e996cbd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.unalign.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * We set our buffer size absurdly low to prevent a flood of errors that we
+ * don't care about.  Note that this test (unlike some other safety tests)
+ * doesn't check the error count -- some architectures have no notion of
+ * alignment.
+ */
+#pragma D option bufsize=16
+#pragma D option bufpolicy=ring
+
+fbt:::
+{
+	n++;
+	trace(*(int *)(rand() | 1));
+}
+
+tick-1sec
+/sec++ == 10/
+{
+	exit(2);
+}
+
+END
+/n == 0/
+{
+	exit(1);
+}
+
+END
+/n != 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.uregs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.uregs.d
new file mode 100644
index 0000000..b13434d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.uregs.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Trace uregs[0] at every fbt probe point.
+ * SECTION: Variables/Built-in Variables;
+ *      Options and Tunables/bufsize;
+ *      Options and Tunables/bufpolicy;
+ *      Options and Tunables/statusrate
+ */
+
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	trace(uregs[0]);
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ustack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ustack.d
new file mode 100644
index 0000000..a286382
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ustack.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Call ustack() at every fbt probe point.
+ *
+ * SECTION: Actions and Subroutines/ustack();
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy;
+ * 	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	ustack();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ustackdepth.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ustackdepth.d
new file mode 100644
index 0000000..942913c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.ustackdepth.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *    Test that the ustackdepth variable is safe to use at every fbt probe
+ *    point.
+ *
+ * SECTION: Variables/Built-in Variables;
+ *	Options and Tunables/bufsize;
+ * 	Options and Tunables/bufpolicy;
+ * 	Options and Tunables/statusrate
+ */
+
+#pragma D option bufsize=1000
+#pragma D option bufpolicy=ring
+#pragma D option statusrate=10ms
+
+fbt:::
+{
+	trace(ustackdepth);
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.vahole.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.vahole.d
new file mode 100755
index 0000000..2ef40a5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.vahole.d
@@ -0,0 +1,69 @@
+#!/usr/sbin/dtrace -Cs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * We set our buffer size absurdly low to prevent a flood of errors that we
+ * don't care about.
+ */
+#pragma D option bufsize=16
+#pragma D option bufpolicy=ring
+
+fbt:::
+{
+	n++;
+#ifdef __sparc
+	trace(*(int *)0x8000000000000000 ^ rand());
+#else
+	trace(*(int *)(`kernelbase - 1));
+#endif
+}
+
+dtrace:::ERROR
+{
+	err++;
+}
+
+tick-1sec
+/sec++ == 10/
+{
+	exit(2);
+}
+
+END
+/n == 0 || err == 0/
+{
+	exit(1);
+}
+
+END
+/n != 0 && err != 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.violentdeath.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.violentdeath.ksh
new file mode 100644
index 0000000..879774a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.violentdeath.ksh
@@ -0,0 +1,51 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+script()
+{
+	$dtrace -x bufpolicy=ring -x bufsize=1k -s /dev/stdin <<EOF
+	fbt:::
+	{}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+let i=0
+
+while [ "$i" -lt 10 ]; do
+	script &
+	child=$!
+	sleep 1
+	kill -9 $child
+	let i=i+1
+done
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.zonename.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.zonename.d
new file mode 100644
index 0000000..5fc025f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/safety/tst.zonename.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	collect zonename at every fbt probe and at every firing of a
+ *	high-frequency profile probe
+ */
+
+fbt:::
+{
+	@a[zonename] = count();
+}
+
+profile-4999hz
+{
+	@a[zonename] = count();
+}
+
+tick-1sec
+/n++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_ARR_LOCAL.thisarray.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_ARR_LOCAL.thisarray.d
new file mode 100644
index 0000000..289d164
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_ARR_LOCAL.thisarray.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ * Use 'this' variables in associative array.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+
+this int y;
+this int z;
+this int res;
+
+BEGIN
+{
+	this->x[this->y, this->z] = 123;
+	this->res = this->x[this->y, this->z]++;
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_CLASS.selfthis.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_CLASS.selfthis.d
new file mode 100644
index 0000000..eda1151
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_CLASS.selfthis.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ * Declare a variable and assign inappropriate value.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+self this int x;
+
+BEGIN
+{
+	x = "dummy";
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_CLASS.thisself.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_CLASS.thisself.d
new file mode 100644
index 0000000..f9c596b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_CLASS.thisself.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *
+ * Multiple storage declarations.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+this self int x;
+
+BEGIN
+{
+	x = "dummy";
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_IDRED.errval.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_IDRED.errval.d
new file mode 100644
index 0000000..3130fbf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_DECL_IDRED.errval.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ * Declare a variable with different data types.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+int x;
+char x;
+double x;
+long x;
+
+BEGIN
+{
+	x = 123;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dec.err.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dec.err.d
new file mode 100644
index 0000000..4261e07
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dec.err.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *
+ * Declare a variable and assign inappropriate value.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+int x;
+
+BEGIN
+{
+	x = "dummy";
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupgtype.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupgtype.d
new file mode 100644
index 0000000..71f9c0b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupgtype.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *  Test assigning a variable two different incompatible types.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+
+BEGIN
+{
+	x = `kmem_flags;
+	x = *`rootvp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupltype.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupltype.d
new file mode 100644
index 0000000..c316441
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupltype.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *  Test assigning a variable two different incompatible types.
+ *
+ * SECTION:  Variables/Clause-Local Variables
+ *
+ */
+
+BEGIN
+{
+	this->x = `kmem_flags;
+	this->x = *`rootvp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupttype.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupttype.d
new file mode 100644
index 0000000..23f26f7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_OP_INCOMPAT.dupttype.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *  Test assigning a variable two different incompatible types.
+ *  Test assigning a variable two different incompatible types.
+ *
+ * SECTION:  Variables/Thread-Local Variables
+ *
+ */
+
+BEGIN
+{
+	self->x = `kmem_flags;
+	self->x = *`rootvp;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_SYNTAX.declare.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_SYNTAX.declare.d
new file mode 100644
index 0000000..246236a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/err.D_SYNTAX.declare.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *
+ * Declare a variable Inside Begin and make sure compilation fails.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+
+BEGIN
+{
+	int x = 123;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.basicvar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.basicvar.d
new file mode 100644
index 0000000..5561631
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.basicvar.d
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *
+ * 	Global variables defined once, is visible in every clause of
+ *	D program
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+
+#pragma D option quiet
+
+int x;
+
+BEGIN
+{
+	x = 123;
+}
+
+profile:::tick-1sec
+{
+	printf("The value of x is %d\n", x);
+}
+
+profile:::tick-100msec
+{
+	printf("The value of x is %d\n", x);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.basicvar.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.basicvar.d.out
new file mode 100644
index 0000000..2b8999e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.basicvar.d.out
@@ -0,0 +1,2 @@
+The value of x is 123
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.localvar.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.localvar.d
new file mode 100644
index 0000000..9a89a04
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.localvar.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *
+ *	Assign a value to a variable in a local clause.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+}
+int i;
+
+profile:::tick-1sec
+{
+	i = 0;
+}
+
+profile:::tick-100msec
+{
+	printf("The value of int i is %d\n", i);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.misc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.misc.d
new file mode 100644
index 0000000..3b6eb7a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.misc.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *  Test the different kinds of integer scalar references.  In particular, we
+ *  test accessing a kernel executable scalar, kernel scoped scalar, DTrace
+ *  scalar first ref that forces creation (both global and TLS), and DTrace
+ *  scalar subsequent reference (both global and TLS).
+ *
+ * SECTION:  Variables/External Variables
+ *
+ */
+
+BEGIN
+{
+	printf("\nkmem_flags = 0x%x\n", `kmem_flags);
+	printf("ufs`ufs_allow_shared_writes = %d\n",
+	    ufs`ufs_allow_shared_writes);
+	x = 123;
+	printf("x = %u\n", x);
+	self->x = 456;
+	printf("self->x = %u\n", self->x);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.self.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.self.d
new file mode 100644
index 0000000..514f385
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.self.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ * Declare self a variable and assign appropriate value.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+self x;
+
+BEGIN
+{
+	x = "dummy";
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfarray.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfarray.d
new file mode 100644
index 0000000..410e8de
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfarray.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *
+ * Declare a self variable and assign appropriate value.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+
+self int y;
+self int z;
+self int res;
+
+BEGIN
+{
+	self->x[self->y, self->z] = 123;
+	self->res = self->x[self->y, self->z]++;
+	printf("The result = %d\n", self->res);
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfarray2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfarray2.d
new file mode 100644
index 0000000..2fd69c6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfarray2.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+#pragma D option destructive
+#pragma D option dynvarsize=1m
+
+struct bar {
+	int pid;
+	kthread_t *curthread;
+};
+
+self struct bar foo[int];
+
+syscall:::entry
+/!self->foo[0].pid/
+{
+	self->foo[0].pid = pid;
+	self->foo[0].curthread = curthread;
+}
+
+syscall:::entry
+/self->foo[0].pid != pid/
+{
+	printf("expected %d, found %d (found curthread %p, curthread is %p)\n",
+	    pid, self->foo[0].pid, self->foo[0].curthread, curthread);
+	exit(1);
+}
+
+tick-100hz
+{
+	system("date > /dev/null")
+}
+
+tick-1sec
+/i++ == 10/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfthis.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfthis.d
new file mode 100644
index 0000000..7bbfaf7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.selfthis.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *
+ * Declare a this variable and assign value of self variable to it.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+self int x;
+this int y;
+
+BEGIN
+{
+	this->x = 123;
+	self->y = this->x;
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.this.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.this.d
new file mode 100644
index 0000000..01ea89f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.this.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *
+ *  Simple 'this' declaration.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+this x;
+
+BEGIN
+{
+	x = "dummy";
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.thisself.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.thisself.d
new file mode 100644
index 0000000..925dff2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scalars/tst.thisself.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ * Declare a self value and assign value of 'this' variable to that.
+ *
+ * SECTION:  Variables/Scalar Variables
+ *
+ */
+self int x;
+this int y;
+
+BEGIN
+{
+	self->x = 123;
+	this->y = self->x;
+	exit (0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.enqueue.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.enqueue.d
new file mode 100644
index 0000000..77105c1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.enqueue.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option switchrate=100hz
+#pragma D option destructive
+
+sched:::enqueue
+/pid == 0 && args[1]->pr_pid == $pid/
+{
+	self->one = 1;
+}
+
+sched:::enqueue
+/self->one && args[2]->cpu_id >= 0 && args[2]->cpu_id <= `max_cpuid/
+{
+	self->two = 1;
+}
+
+sched:::enqueue
+/self->two && args[0]->pr_lwpid > 0/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.oncpu.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.oncpu.d
new file mode 100644
index 0000000..2571767
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.oncpu.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option switchrate=100hz
+#pragma D option destructive
+
+sched:::on-cpu
+/pid == $pid/
+{
+	self->on++;
+}
+
+sched:::off-cpu
+/pid == $pid && self->on/
+{
+	self->off++;
+}
+
+sched:::off-cpu
+/self->on > 50 && self->off > 50/
+{
+	exit(0);
+}
+
+profile:::tick-1sec
+/n++ > 10/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.stackdepth.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.stackdepth.d
new file mode 100644
index 0000000..b425127
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sched/tst.stackdepth.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option switchrate=100hz
+
+sched:::on-cpu
+/stackdepth > 0/
+{
+	exit(0);
+}
+
+tick-1s
+/i++ == 3/
+{
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_MACRO_UNDEF.invalidargs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_MACRO_UNDEF.invalidargs.d
new file mode 100755
index 0000000..27d969e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_MACRO_UNDEF.invalidargs.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Try to print arguments not provided.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	print("The arguments are %d %d\n", $1, $2);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_OP_LVAL.rdonly.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_OP_LVAL.rdonly.d
new file mode 100755
index 0000000..5bf4675
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_OP_LVAL.rdonly.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Try to update a read-only macro.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	$pid++;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_OP_WRITE.usepidmacro.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_OP_WRITE.usepidmacro.d
new file mode 100755
index 0000000..649cbdb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_OP_WRITE.usepidmacro.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Try to assign value to Macro.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	pid = 1;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.concat.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.concat.d
new file mode 100755
index 0000000..00a2996
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.concat.d
@@ -0,0 +1,45 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ *	Try to concat macro with user variables in provider description
+ *	section.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+/i = 123$pid/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.desc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.desc.d
new file mode 100755
index 0000000..3dfa2b2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.desc.d
@@ -0,0 +1,49 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ *	Try to call providers using macro variables.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+/i = 123$pid/
+{
+	exit(0);
+}
+
+pid$pid
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.inval.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.inval.d
new file mode 100755
index 0000000..28b251c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.inval.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Attempt to print invalid arguments.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	print("The arguments are %d %d\n", $-1);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.pid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.pid.d
new file mode 100755
index 0000000..d9711d2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/err.D_SYNTAX.pid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Attempt to concat and assign a macro to a variable
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	i = 123$pid;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
new file mode 100755
index 0000000..0f4e145
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
@@ -0,0 +1,80 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+# Attempt to pass some arguments and try not to print it.
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$.d
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+BEGIN
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+$dtrace -x errtags -s $dfilename "this is test" 1>/dev/null \
+    2>/var/tmp/err.$$.txt
+
+if [ $? -ne 1 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+grep "D_MACRO_UNUSED" /var/tmp/err.$$.txt >/dev/null 2>&1
+if [ $? -ne 0 ]; then
+	print -u2 "Expected error D_MACRO_UNUSED not returned"
+	/usr/bin/rm -f /var/tmp/err.$$.txt
+	exit 1
+fi
+
+/usr/bin/rm -f $dfilename
+/usr/bin/rm -f /var/tmp/err.$$.txt
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.arg0.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.arg0.d
new file mode 100755
index 0000000..999dbc3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.arg0.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	print argument 0 I mean "$0"
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The arg0 is %s\n", $0);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
new file mode 100755
index 0000000..deb644a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
@@ -0,0 +1,90 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Pass 10 arguments and try to print them.
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+bname=`/bin/basename $0`
+
+dfilename=/var/tmp/$bname.$$
+
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+{
+	printf("%d %d %d %d %d %d %d %d %d %d", \$1, \$2, \$3, \$4, \$5, \$6,
+		\$7, \$8, \$9, \$10);
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+chmod 555 $dfilename
+
+
+output=`$dfilename 1 2 3 4 5 6 7 8 9 10 2>/dev/null`
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+set -A outarray $output
+
+if [[ ${outarray[0]} != 1 || ${outarray[1]} != 2 || ${outarray[2]} != 3 || \
+	${outarray[3]} != 4 || ${outarray[4]} != 5 || ${outarray[5]} != 6 || \
+	${outarray[6]} != 7 || ${outarray[7]} != 8 || ${outarray[8]} != 9 || \
+	${outarray[9]} != 10 ]]; then
+	print -u2 "Error in output by $dfilename"
+	exit 1
+fi
+
+/usr/bin/rm -f $dfilename
+exit 0
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.assign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.assign.d
new file mode 100755
index 0000000..5dd1740
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.assign.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Assign macros to variables
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	processid = $pid;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.basic.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.basic.d
new file mode 100755
index 0000000..a407f83
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.basic.d
@@ -0,0 +1,42 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Basic script which uses exit(0) to exit.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.egid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.egid.d
new file mode 100755
index 0000000..3899d2a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.egid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Script which prints effective group id.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The egid is %d\n", $egid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
new file mode 100755
index 0000000..9e1955f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
@@ -0,0 +1,97 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#
+#	To verify egid of current process
+#
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$.d
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+/\$egid != \$1/
+{
+	exit(1);
+}
+
+BEGIN
+/\$egid == \$1/
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#chmod 555 the .d file
+
+chmod 555 $dfilename >/dev/null 2>&1
+if [ &? -ne 0 ]; then
+	print -u2 "chmod $dfilename failed"
+	exit 1
+fi
+
+#Get the groupid of the calling process using ps
+
+groupid=`ps -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+if [ $? -ne 0 ]; then
+	print -u2 "unable to get uid of the current process with pid = $$"
+	exit 1
+fi
+
+#Pass groupid as argument to .d file
+$dfilename $groupid >/dev/null 2>&1
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+#Cleanup leftovers
+
+/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.euid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.euid.d
new file mode 100755
index 0000000..e4cdaa6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.euid.d
@@ -0,0 +1,44 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ *	Script which prints effective user id.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The euid is %d\n", $euid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
new file mode 100755
index 0000000..7112b25
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
@@ -0,0 +1,86 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	To verify euid of current process
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+/\$euid != \$1/
+{
+	exit(1);
+}
+
+BEGIN
+/\$euid == \$1/
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+chmod 555 $dfilename
+
+userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+if [ $? -ne 0 ]; then
+	print -u2 "unable to get uid of the current process with pid = $$"
+	exit 1
+fi
+
+$dfilename $userid >/dev/null 2>&1
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+#/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.gid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.gid.d
new file mode 100755
index 0000000..c3329ce
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.gid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Script which prints group id.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The gid is %d\n", $gid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
new file mode 100755
index 0000000..83955db
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
@@ -0,0 +1,86 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	To verify gid of the child process.
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+/\$gid != \$1/
+{
+	exit(1);
+}
+
+BEGIN
+/\$gid == \$1/
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+chmod 555 $dfilename
+
+groupid=`ps -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+if [ $? -ne 0 ]; then
+	print -u2 "unable to get uid of the current process with pid = $$"
+	exit 1
+fi
+
+$dfilename $groupid >/dev/null 2>&1
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+#/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.pgid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.pgid.d
new file mode 100755
index 0000000..e01b996
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.pgid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Script which prints effective process group id.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The pgid is %d\n", $pgid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.pid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.pid.d
new file mode 100755
index 0000000..1364366
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.pid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Script which prints pid.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The pid is %d\n", $pid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.ppid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.ppid.d
new file mode 100755
index 0000000..8712cd9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.ppid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Script which prints parent processid
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The ppid is %d\n", $ppid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
new file mode 100755
index 0000000..4a74ee4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
@@ -0,0 +1,86 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	To verify ppid of child process.
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$.d
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+/\$ppid != \$1/
+{
+	exit(1);
+}
+
+BEGIN
+/\$ppid == \$1/
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#chmod the .d file to 555
+
+chmod 555 $dfilename >/dev/null 2>&1
+if [ $? -ne 0 ]; then
+	print -u2 "chmod 555 $dfilename failed"
+	exit 1
+fi
+
+#Pass current pid (I mean parent pid for .d script).
+
+$dfilename $$ >/dev/null 2>&1
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+#/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.projid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.projid.d
new file mode 100755
index 0000000..a81ab8e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.projid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Script which prints current project id.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The projid is %d\n", $projid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
new file mode 100755
index 0000000..da60ea1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
@@ -0,0 +1,86 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	To verify projid of child process.
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+/\$projid != \$1/
+{
+	exit(1);
+}
+
+BEGIN
+/\$projid == \$1/
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+chmod 555 $dfilename
+
+projectid=`ps -o pid,projid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+if [ $? -ne 0 ]; then
+	print -u2 "unable to get uid of the current process with pid = $$"
+	exit 1
+fi
+
+$dfilename $projectid >/dev/null 2>&1
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+#/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.quite.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.quite.d
new file mode 100755
index 0000000..c61debe
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.quite.d
@@ -0,0 +1,42 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Script which uses -qs in scripting line
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.sid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.sid.d
new file mode 100755
index 0000000..87bab53
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.sid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Script which prints session id.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The sid is %d\n", $sid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
new file mode 100755
index 0000000..d1e122c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
@@ -0,0 +1,86 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	To verify sid of current process.
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+/\$sid != \$1/
+{
+	exit(1);
+}
+
+BEGIN
+/\$sid == \$1/
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+chmod 555 $dfilename
+
+sessionid=`ps -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+if [ $? -ne 0 ]; then
+	print -u2 "unable to get sid of the current process with pid = $$"
+	exit 1
+fi
+
+$dfilename $sessionid >/dev/null 2>&1
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+#/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
new file mode 100755
index 0000000..6903cb1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
@@ -0,0 +1,78 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	Pass a bunch of strings as a sentence and print them
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$.d
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+BEGIN
+{
+	printf("%s", \$\$1);
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+chmod 555 $dfilename
+
+output=`$dfilename 'this is test' 2>/dev/null`
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+if [ "$output" != "this is test" ]; then
+	print -u2 "Expected output not returned"
+	exit 1
+fi
+
+/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.taskid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.taskid.d
new file mode 100755
index 0000000..617827c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.taskid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Script which prints taskid.
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The taskid is %d\n", $taskid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
new file mode 100755
index 0000000..54392d2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
@@ -0,0 +1,86 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	To verify taskid of current process.
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+/\$taskid != \$1/
+{
+	exit(1);
+}
+
+BEGIN
+/\$taskid == \$1/
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+chmod 555 $dfilename
+
+taskidval=`ps -o pid,taskid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+if [ $? -ne 0 ]; then
+	print -u2 "unable to get uid of the current process with pid = $$"
+	exit 1
+fi
+
+$dfilename $taskidval >/dev/null 2>&1
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+#/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.trace.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.trace.d
new file mode 100755
index 0000000..34ba243
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.trace.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	To use trace in a script
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	trace("hello");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.uid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.uid.d
new file mode 100755
index 0000000..f3ebca6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.uid.d
@@ -0,0 +1,43 @@
+#!/usr/sbin/dtrace -s
+
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	print uid in a script
+ *
+ * SECTION: Scripting
+ *
+ */
+
+BEGIN
+{
+	printf("The uid is %d\n", $uid);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
new file mode 100755
index 0000000..2630f2f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh
@@ -0,0 +1,86 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+############################################################################
+# ASSERTION:
+#	To verify uid of current process.
+#
+# SECTION: Scripting
+#
+############################################################################
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+bname=`/bin/basename $0`
+dfilename=/var/tmp/$bname.$$
+
+## Create .d file
+##########################################################################
+cat > $dfilename <<-EOF
+#!$dtrace -qs
+
+
+BEGIN
+/\$uid != \$1/
+{
+	exit(1);
+}
+
+BEGIN
+/\$uid == \$1/
+{
+	exit(0);
+}
+EOF
+##########################################################################
+
+
+#Call dtrace -C -s <.d>
+
+chmod 555 $dfilename
+
+userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+if [ $? -ne 0 ]; then
+	print -u2 "unable to get uid of the current process with pid = $$"
+	exit 1
+fi
+
+$dfilename $userid >/dev/null 2>&1
+
+if [ $? -ne 0 ]; then
+	print -u2 "Error in executing $dfilename"
+	exit 1
+fi
+
+#/usr/bin/rm -f $dfilename
+exit 0
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sdt/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sdt/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c
new file mode 100644
index 0000000..0763550
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.c
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+#include <sys/uadmin.h>
+
+int
+main(int argc, char **argv)
+{
+	while (1) {
+		if (uadmin(A_SDTTEST, 0, 0) < 0) {
+			perror("uadmin");
+			return (1);
+		}
+
+		sleep(1);
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d
new file mode 100644
index 0000000..0523de0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sdt/tst.sdtargs.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Verify that argN (1..7) variables are properly remapped.
+ */
+
+BEGIN
+{
+	/* Timeout after 5 seconds */
+	timeout = timestamp + 5000000000;
+	ignore = $1;
+}
+
+ERROR
+{
+	printf("sdt:::test failed.\n");
+	exit(1);
+}
+
+sdt:::test
+/arg0 != 1 || arg1 != 2 || arg2 != 3 || arg3 != 4 || arg4 != 5 || arg5 != 6 ||
+    arg6 != 7/
+{
+	printf("sdt arg mismatch\n\n");
+	printf("args are  : %d, %d, %d, %d, %d, %d, %d\n", arg0, arg1, arg2,
+	    arg3, arg4, arg5, arg6);
+	printf("should be : 1, 2, 3, 4, 5, 6, 7\n");
+	exit(1);
+}
+
+sdt:::test
+{
+	exit(0);
+}
+
+profile:::tick-1
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_IDENT_BADREF.SizeofAssoc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_IDENT_BADREF.SizeofAssoc.d
new file mode 100644
index 0000000..9ace419
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_IDENT_BADREF.SizeofAssoc.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: sizeof returns the size in bytes of any D expression or data
+ * type. For an associative array, the D compiler should throw an error since
+ * an associative array does not have a fixed size.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	assoc_array[0] = 010;
+	assoc_array[1] = 100;
+	assoc_array[2] = 210;
+
+	printf("sizeof (assoc_array): %d\n", sizeof (assoc_array));
+	printf("sizeof (assoc_array[0]): %d\n", sizeof (assoc_array[0]));
+	printf("sizeof (assoc_array[1]): %d\n", sizeof (assoc_array[1]));
+	printf("sizeof (assoc_array[2]): %d\n", sizeof (assoc_array[2]));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_IDENT_UNDEF.UnknownSymbol.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_IDENT_UNDEF.UnknownSymbol.d
new file mode 100644
index 0000000..f2dcdfa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_IDENT_UNDEF.UnknownSymbol.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: The D compiler throws a D_IDENT_UNDEF error when sizeof is passed
+ * an unknown symbol.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	printf("sizeof (`): %d\n", sizeof (`));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_SIZEOF_TYPE.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_SIZEOF_TYPE.d
new file mode 100644
index 0000000..43c493a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_SIZEOF_TYPE.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI" 
+
+/*
+ * ASSERTION:
+ *	sizeof() should handle invalid types
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+
+BEGIN
+{
+	trace(sizeof (void));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_SYNTAX.SizeofBadType.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_SYNTAX.SizeofBadType.d
new file mode 100644
index 0000000..85519e6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/err.D_SYNTAX.SizeofBadType.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: sizeof returns the size in bytes of any D expression or data
+ * type. When an operator or non-symbol is passed as an argument to sizeof
+ * operator, the D_SYNTAX error is thrown by the compiler.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	printf("sizeof (*): %d\n", sizeof (*));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofArray.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofArray.d
new file mode 100644
index 0000000..8843728
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofArray.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: sizeof returns the size in bytes of any D expression or data
+ * type. For a simpler array, the sizeof on the array variable itself gives
+ * the sum total of memory allocated to the array in bytes. With individual
+ * members of the array it gives their respective sizes.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+#pragma D option quiet
+
+int array[5];
+
+BEGIN
+{
+	array[0] = 010;
+	array[1] = 100;
+	array[2] = 210;
+
+	printf("sizeof (array): %d\n", sizeof (array));
+	printf("sizeof (array[0]): %d\n", sizeof (array[0]));
+	printf("sizeof (array[1]): %d\n", sizeof (array[1]));
+	printf("sizeof (array[2]): %d\n", sizeof (array[2]));
+
+	exit(0);
+}
+
+END
+/(20 != sizeof (array)) || (4 != sizeof (array[0])) || (4 != sizeof (array[1]))
+    || (4 != sizeof (array[2]))/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofDataTypes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofDataTypes.d
new file mode 100644
index 0000000..fe558e8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofDataTypes.d
@@ -0,0 +1,122 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: sizeof returns the size in bytes of any D expression or data
+ * type.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ */
+#pragma D option quiet
+
+char new_char;
+short new_short;
+int new_int;
+long new_long;
+long long new_long_long;
+int8_t new_int8;
+int16_t new_int16;
+int32_t new_int32;
+int64_t new_int64;
+intptr_t new_intptr;
+uint8_t new_uint8;
+uint16_t new_uint16;
+uint32_t new_uint32;
+uint64_t new_uint64;
+uintptr_t new_uintptr;
+
+/*
+float new_float;
+double new_double;
+long double new_long_double;
+
+string new_string;
+*/
+
+struct record {
+	char ch;
+	int in;
+} new_struct;
+
+struct {
+	char ch;
+	int in;
+} anon_struct;
+
+union record {
+     char ch;
+     int in;
+} new_union;
+
+union {
+     char ch;
+     int in;
+} anon_union;
+
+enum colors {
+	RED,
+	GREEN,
+	BLUE
+} new_enum;
+
+
+int *pointer;
+
+BEGIN
+{
+	printf("sizeof (new_char): %d\n", sizeof (new_char));
+	printf("sizeof (new_short): %d\n", sizeof (new_short));
+	printf("sizeof (new_int): %d\n", sizeof (new_int));
+	printf("sizeof (new_long): %d\n", sizeof (new_long));
+	printf("sizeof (new_long_long): %d\n", sizeof (new_long_long));
+	printf("sizeof (new_int8): %d\n", sizeof (new_int8));
+	printf("sizeof (new_int16): %d\n", sizeof (new_int16));
+	printf("sizeof (new_int32): %d\n", sizeof (new_int32));
+	printf("sizeof (new_int64): %d\n", sizeof (new_int64));
+	printf("sizeof (pointer): %d\n", sizeof (pointer));
+	printf("sizeof (intptr_t): %d\n", sizeof (intptr_t));
+	printf("sizeof (new_struct): %d\n", sizeof (new_struct));
+	printf("sizeof (anon_struct): %d\n", sizeof (anon_struct));
+	printf("sizeof (new_union): %d\n", sizeof (new_union));
+	printf("sizeof (anon_union): %d\n", sizeof (anon_union));
+	printf("sizeof (new_enum): %d\n", sizeof (new_enum));
+	exit(0);
+}
+
+END
+/(1 != sizeof (new_char)) || (2 != sizeof (new_short)) ||
+    (4 != sizeof (new_int)) ||
+    ((4 != sizeof (new_long)) && (8 != sizeof (new_long))) ||
+    (8 != sizeof (new_long_long)) ||
+    (1 != sizeof (new_int8)) || (2 != sizeof (new_int16)) ||
+    (4 != sizeof (new_int32)) || (8 != sizeof (new_int64)) ||
+    (sizeof (pointer) != sizeof (new_intptr)) || (8 != sizeof (new_struct)) ||
+    (4 != sizeof (new_union)) || (4 != sizeof (new_enum))/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofExpression.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofExpression.d
new file mode 100644
index 0000000..0bb7f68
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofExpression.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the use of sizeof with expressions.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("sizeof ('c') : %d\n", sizeof ('c'));
+	printf("sizeof (10 * 'c') : %d\n", sizeof (10 * 'c'));
+	printf("sizeof (100 + 12345) : %d\n", sizeof (100 + 12345));
+	printf("sizeof (1234567890) : %d\n", sizeof (1234567890));
+
+	printf("sizeof (1234512345 * 1234512345 * 12345678 * 1ULL) : %d\n",
+	sizeof (1234512345 * 1234512345 * 12345678 * 1ULL));
+	printf("sizeof (-129) : %d\n", sizeof (-129));
+	printf("sizeof (0x67890/0x77000) : %d\n", sizeof (0x67890/0x77000));
+
+	printf("sizeof (3 > 2 ? 3 : 2) : %d\n", sizeof (3 > 2 ? 3 : 2));
+
+	exit(0);
+}
+
+END
+/(4 != sizeof ('c')) || (4 != sizeof (10 * 'c')) ||
+    (4 != sizeof (100 + 12345)) || (4 != sizeof (1234567890)) ||
+    (8 != sizeof (1234512345 * 1234512345 * 12345678 * 1ULL)) ||
+    (4 != sizeof (-129)) || (4 != sizeof (0x67890/0x77000)) ||
+    (4 != sizeof (3 > 2 ? 3 : 2))/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofNULL.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofNULL.d
new file mode 100644
index 0000000..4bd8a48
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofNULL.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: The size of the inbuilt variable NULL is the same as that of an
+ * integer.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	printf("sizeof (NULL): %d\n", sizeof (NULL));
+	exit(0);
+}
+
+END
+/4 != sizeof (NULL)/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofStrConst.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofStrConst.d
new file mode 100644
index 0000000..51f7250
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofStrConst.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: sizeof returns the size in bytes of any D expression or data
+ * type. When a raw string is passed to the sizeof operator, the compiler
+ * throws a D_SYNTAX error.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	printf("sizeof \"hi\": %d\n", sizeof ("hi"));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofStrConst.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofStrConst.d.out
new file mode 100644
index 0000000..3fe02aa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofStrConst.d.out
@@ -0,0 +1,2 @@
+sizeof "hi": 3
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString1.d
new file mode 100644
index 0000000..0be9e45
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString1.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: sizeof returns the size in bytes of any D expression or data
+ * type. For sizeof strings the D compiler throws D_SIZEOF_TYPE.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+#pragma D option quiet
+#pragma D option strsize=256
+
+BEGIN
+{
+	assoc_array["hello"] = "hello";
+	assoc_array["hi"] = "hi";
+	assoc_array["hello"] = "hello, world";
+
+	printf("sizeof (assoc_array[\"hello\"]): %d\n",
+	sizeof (assoc_array["hello"]));
+	printf("sizeof (assoc_array[\"hi\"]): %d\n",
+	sizeof (assoc_array["hi"]));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString1.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString1.d.out
new file mode 100644
index 0000000..9c43b1e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString1.d.out
@@ -0,0 +1,3 @@
+sizeof (assoc_array["hello"]): 256
+sizeof (assoc_array["hi"]): 256
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString2.d
new file mode 100644
index 0000000..f12a600
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString2.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: sizeof returns the size in bytes of any D expression or data
+ * type. For a string variable, the D compiler throws a D_SIZEOF_TYPE.
+ *
+ * SECTION: Structs and Unions/Member Sizes and Offsets
+ *
+ */
+#pragma D option quiet
+#pragma D option strsize=256
+
+BEGIN
+{
+	var = "hello";
+	printf("sizeof (var): %d\n", sizeof (var));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString2.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString2.d.out
new file mode 100644
index 0000000..fdeca69
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sizeof/tst.SizeofString2.d.out
@@ -0,0 +1,2 @@
+sizeof (var): 256
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/bug.1001148.SpecSizeVariations.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/bug.1001148.SpecSizeVariations.d
new file mode 100644
index 0000000..318a2d0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/bug.1001148.SpecSizeVariations.d
@@ -0,0 +1,87 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Verify the behavior of variations in specsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ *
+ * BUG: 1001148
+ *
+ * NOTES: This code has four different behaviors.
+ * 1. 0 < specsize < 8
+ * 2. 8 <= specsize <= 39 || 0 == specsize
+ * 3. 40 <= specsize
+ * 4. 0 > specsize
+ *
+ */
+
+#pragma D option quiet
+#pragma D option specsize=10
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(0);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d
new file mode 100644
index 0000000..e97506e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d
@@ -0,0 +1,88 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Verify the behavior of variations in bufsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/bufsize
+ *
+ * NOTES: This test behaves differently depending on the values
+ * assigned to bufsize.
+ * 1. 0 > bufsize.
+ * 2. 0 == bufsize.
+ * 3. 0 < bufsize <= 7
+ * 4. 8 <= bufsize <= 31
+ * 5. 32 <= bufsize <= 47
+ * 6. 48 <= bufsize <= 71
+ * 7. 72 <= bufsize
+ */
+
+#pragma D option quiet
+#pragma D option bufsize=41
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(0);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d
new file mode 100644
index 0000000..f660e9a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d
@@ -0,0 +1,88 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Verify the behavior of variations in bufsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	    Options and Tunables/bufsize
+ *
+ * NOTES: This test behaves differently depending on the values
+ * assigned to bufsize.
+ * 1. 0 > bufsize.
+ * 2. 0 == bufsize.
+ * 3. 0 < bufsize <= 7
+ * 4. 8 <= bufsize <= 31
+ * 5. 32 <= bufsize <= 47
+ * 6. 48 <= bufsize <= 71
+ * 7. 72 <= bufsize
+ */
+
+#pragma D option quiet
+#pragma D option bufsize=4
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(0);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithBreakPoint.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithBreakPoint.d
new file mode 100755
index 0000000..958ce68
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithBreakPoint.d
@@ -0,0 +1,69 @@
+#!/usr/sbin/dtrace -ws
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Destructive actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ * SECTION: dtrace(1M) Utility/ -w option
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+syscall:::
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	breakpoint();
+	i++;
+}
+
+syscall:::
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithChill.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithChill.d
new file mode 100755
index 0000000..ebb3b01
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithChill.d
@@ -0,0 +1,69 @@
+#!/usr/sbin/dtrace -ws
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Destructive actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ * SECTION: dtrace (1M) Utility/ -w option
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	chill(10);
+	i++;
+}
+
+profile:::tick-1sec
+/1 == 1/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithCopyOut.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithCopyOut.d
new file mode 100755
index 0000000..9c14bb5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithCopyOut.d
@@ -0,0 +1,69 @@
+#!/usr/sbin/dtrace -ws
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Destructive actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ * SECTION: dtrace(1M) Utility/ -w option
+ *
+ */
+#pragma D option quiet
+
+char a[2];
+void *buf;
+uintptr_t addr;
+size_t nbytes;
+BEGIN
+{
+	self->i = 0;
+	addr = (uintptr_t) &a[0];
+	nbytes = 10;
+	var = speculation();
+}
+
+BEGIN
+{
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	self->i++;
+	copyout(buf, addr, nbytes);
+}
+
+BEGIN
+{
+	printf("This test should not have compiled\n");
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithCopyOutStr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithCopyOutStr.d
new file mode 100755
index 0000000..695eb8c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithCopyOutStr.d
@@ -0,0 +1,68 @@
+#!/usr/sbin/dtrace -ws
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Destructive actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ * SECTION: dtrace(1M) Utility/ -w option
+ */
+#pragma D option quiet
+
+string str;
+char a[2];
+uintptr_t addr;
+size_t maxlen;
+BEGIN
+{
+	self->i = 0;
+	addr = (uintptr_t) &a[0];
+	maxlen = 10;
+	var = speculation();
+}
+
+BEGIN
+{
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	self->i++;
+	copyoutstr(str, addr, maxlen);
+}
+
+BEGIN
+{
+	printf("This test should not have compiled\n");
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithPanic.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithPanic.d
new file mode 100755
index 0000000..dcba080
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithPanic.d
@@ -0,0 +1,69 @@
+#!/usr/sbin/dtrace -ws
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Destructive actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ * SECTION: dtrace(1M) Utility/ -w option
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	panic();
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithRaise.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithRaise.d
new file mode 100755
index 0000000..e4fe06b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithRaise.d
@@ -0,0 +1,68 @@
+#!/usr/sbin/dtrace -ws
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Destructive actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ * SECTION: dtrace(1M) Utility/ -w option
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	raise(9);
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithStop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithStop.d
new file mode 100755
index 0000000..468e8f2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_ACT_SPEC.SpeculateWithStop.d
@@ -0,0 +1,68 @@
+#!/usr/sbin/dtrace -ws
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Destructive actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ * SECTION: dtrace(1M) Utility/ -w option
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	stop();
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_COMM.AggAftCommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_COMM.AggAftCommit.d
new file mode 100644
index 0000000..89a15c0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_COMM.AggAftCommit.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * A clause cannot contain a commit() followed by an aggregating action.
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation;
+ */
+
+BEGIN
+{
+	commit(1);
+	@a["foo"] = count();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithAvg.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithAvg.d
new file mode 100644
index 0000000..a763543
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithAvg.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Aggregating actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	@avrg["speculate"] = avg(i);
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithCount.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithCount.d
new file mode 100644
index 0000000..57d0d03
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithCount.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Aggregating functions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	@counts["speculate"] = count();
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithLquant.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithLquant.d
new file mode 100644
index 0000000..90a899d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithLquant.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Aggregating functions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+syscall:::entry
+{
+	self->ts = timestamp;
+}
+
+syscall:::return
+/self->ts/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	@Lqauntus[execname] = lquantize(timestamp - self->ts, 0, 100, 1);
+	i++;
+}
+
+syscall:::
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithMax.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithMax.d
new file mode 100644
index 0000000..a10fff1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithMax.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Aggregating functions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	@Maximus["speculate"] = max(i);
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithMin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithMin.d
new file mode 100644
index 0000000..4ad8dee
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithMin.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Aggregating functions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	@Minimus["speculate"] = min(i);
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithQuant.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithQuant.d
new file mode 100644
index 0000000..38e816e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithQuant.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Aggregating functions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+syscall:::entry
+{
+	self->ts = timestamp;
+}
+
+syscall:::return
+/self->ts/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	@Qauntus[execname] = quantize(timestamp - self->ts);
+	i++;
+}
+
+syscall:::
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithStddev.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithStddev.d
new file mode 100644
index 0000000..22953c2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithStddev.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *     Aggregating actions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	@sdev["speculate"] = stddev(i);
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithSum.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithSum.d
new file mode 100644
index 0000000..620a076
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_AGG_SPEC.SpeculateWithSum.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Aggregating functions may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+profile:::tick-1sec
+/i < 1/
+{
+	var = speculation();
+	speculate(var);
+	printf("Speculation ID: %d", var);
+	@sums["speculate"] = sum(i);
+	i++;
+}
+
+profile:::tick-1sec
+/1 == i/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_COMM.CommitAftCommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_COMM.CommitAftCommit.d
new file mode 100644
index 0000000..ebc316a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_COMM.CommitAftCommit.d
@@ -0,0 +1,82 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * A clause cannot contain multiple commit() calls to same buffer.
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation;
+ *	Options and Tunables/cleanrate
+ */
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+
+BEGIN
+{
+	self->i = 0;
+	var1 = 0;
+}
+
+profile:::tick-1sec
+/!var1/
+{
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+}
+
+profile:::tick-1sec
+/var1/
+{
+	speculate(var1);
+	printf("Speculating on id: %d\n", var1);
+	self->i++;
+}
+
+profile:::tick-1sec
+/(!self->i)/
+{
+}
+
+profile:::tick-1sec
+/(self->i)/
+{
+	commit(var1);
+	commit(var1);
+	exit(0);
+}
+
+END
+{
+	printf("Succesfully commited both buffers");
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_COMM.DisjointCommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_COMM.DisjointCommit.d
new file mode 100644
index 0000000..e482d07
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_COMM.DisjointCommit.d
@@ -0,0 +1,102 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * A clause cannot contain multiple commit() calls to disjoint buffers.
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation;
+ *	Options and Tunables/cleanrate
+ */
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+
+BEGIN
+{
+	self->i = 0;
+	self->j = 0;
+	self->commit = 0;
+	var1 = 0;
+	var2 = 0;
+}
+
+BEGIN
+{
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+}
+
+BEGIN
+{
+	var2 = speculation();
+	printf("Speculation ID: %d\n", var2);
+}
+
+BEGIN
+/var1/
+{
+	speculate(var1);
+	printf("Speculating on id: %d\n", var1);
+	self->i++;
+}
+
+BEGIN
+/var2/
+{
+	speculate(var2);
+	printf("Speculating on id: %d", var2);
+	self->j++;
+
+}
+
+BEGIN
+/(self->i) && (self->j)/
+{
+	commit(var1);
+	commit(var2);
+	self->commit++;
+}
+
+BEGIN
+/self->commit/
+{
+	printf("Succesfully commited both buffers");
+	exit(0);
+}
+
+BEGIN
+/!self->commit/
+{
+	printf("Couldnt commit both buffers");
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_DREC.CommitAftDataRec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_DREC.CommitAftDataRec.d
new file mode 100644
index 0000000..268b68f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_COMM_DREC.CommitAftDataRec.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Commit may not follow data recording actions.
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+	exit(0);
+}
+
+END
+{
+	printf("This test shouldnt have compiled\n");
+	commit(self->spec);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_DREC_COMM.DataRecAftCommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_DREC_COMM.DataRecAftCommit.d
new file mode 100644
index 0000000..75560d8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_DREC_COMM.DataRecAftCommit.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Data recording actions may not follow commit.
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation;
+ *	Options and Tunables/cleanrate
+ *
+ */
+#pragma D option quiet
+#pragma D option cleanrate=2000hz
+
+BEGIN
+{
+	self->speculateFlag = 0;
+}
+
+syscall:::entry
+{
+	self->spec = speculation();
+}
+
+syscall:::
+/self->spec/
+{
+	speculate(self->spec);
+	printf("Called speculate with id: %d\n", self->spec);
+	self->speculateFlag++;
+}
+
+syscall:::
+/(self->spec) && (self->speculateFlag)/
+{
+	commit(self->spec);
+	printf("Data recording after commit\n");
+}
+
+END
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_DREC_COMM.ExitAfterCommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_DREC_COMM.ExitAfterCommit.d
new file mode 100644
index 0000000..c190740
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_DREC_COMM.ExitAfterCommit.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Exit after commit should throw a D_DREC_COMM.
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	self->i = 0;
+	self->spec = speculation();
+}
+
+BEGIN
+/self->spec/
+{
+	speculate(self->spec);
+	self->i++;
+	printf("self->i: %d\n", self->i);
+}
+
+BEGIN
+/self->i/
+{
+	commit(self->spec);
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_EXIT_SPEC.ExitAftSpec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_EXIT_SPEC.ExitAftSpec.d
new file mode 100644
index 0000000..70964f9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_EXIT_SPEC.ExitAftSpec.d
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Exit action may never be speculative.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+BEGIN
+{
+	i = 0;
+}
+
+syscall:::entry
+{
+	self->spec = speculation();
+}
+
+syscall:::
+/self->spec/
+{
+	speculate(self->spec);
+	i++;
+	printf("i: %d\n", i);
+	exit(0);
+}
+
+syscall:::
+/1 == i/
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_MALFORM.NspecExpr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_MALFORM.NspecExpr.d
new file mode 100644
index 0000000..91168e3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_MALFORM.NspecExpr.d
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using an expression in the pragma for nspec throws a D_PRAGMA_MALFORM
+ * error.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *		Options and Tunables/nspec
+ *
+ */
+
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+#pragma D option nspec=24 * 44
+
+BEGIN
+{
+	var1 = 0;
+	var2 = 0;
+	var3 = 0;
+}
+
+BEGIN
+{
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+	var2 = speculation();
+	printf("Speculation ID: %d\n", var2);
+	var3 = speculation();
+	printf("Speculation ID: %d\n", var3);
+}
+
+BEGIN
+/var1 && var2 && (!var3)/
+{
+	printf("Succesfully got two speculative buffers");
+	exit(0);
+}
+
+BEGIN
+/(!var1) || (!var2) || var3/
+{
+	printf("Test failed");
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.HugeNspecValue.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.HugeNspecValue.d
new file mode 100644
index 0000000..d13132e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.HugeNspecValue.d
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Setting the nspec option to a huge integer throws a D_PRAGMA_OPTSET error.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/nspec
+ *
+ */
+
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+#pragma D option nspec=245566729809009887663
+
+BEGIN
+{
+	var1 = 0;
+	var2 = 0;
+	var3 = 0;
+}
+
+BEGIN
+{
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+	var2 = speculation();
+	printf("Speculation ID: %d\n", var2);
+	var3 = speculation();
+	printf("Speculation ID: %d\n", var3);
+}
+
+BEGIN
+/var1 && var2 && (!var3)/
+{
+	printf("Succesfully got two speculative buffers");
+	exit(0);
+}
+
+BEGIN
+/(!var1) || (!var2) || var3/
+{
+	printf("Test failed");
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.InvalidSpecSize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.InvalidSpecSize.d
new file mode 100644
index 0000000..d957f67
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.InvalidSpecSize.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Setting the specsize option to an illegal value throws the compiler error
+ * D_PRAGMA_OPTSET.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ */
+
+#pragma D option quiet
+#pragma D option specsize=1b
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+	exit(0);
+}
+
+END
+{
+	printf("This shouldnt have compiled\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.NegSpecSize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.NegSpecSize.d
new file mode 100644
index 0000000..c5fa9f5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PRAGMA_OPTSET.NegSpecSize.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * ASSERTION:
+ * Verify the behavior of speculations with changes in specsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ *
+ */
+
+#pragma D option quiet
+#pragma D option specsize=-40
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(0);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PROTO_LEN.SpecNoId.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PROTO_LEN.SpecNoId.d
new file mode 100644
index 0000000..65d53ba
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_PROTO_LEN.SpecNoId.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * An identifier returned from speculation must be passed to the speculate()
+ * function.
+ *
+ * SECTION: Speculative Tracing/Creating a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	var = speculation();
+	printf("Speculation ID: %d", var);
+	self->i = 0;
+}
+
+profile:::tick-1sec
+{
+	speculate();
+	self->i++;
+}
+
+profile:::tick-1sec
+/1 <= self->i/
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_COMM.SpecAftCommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_COMM.SpecAftCommit.d
new file mode 100644
index 0000000..ec4b22b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_COMM.SpecAftCommit.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * A clause cannot contain a speculate after a commit.
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation;
+ *	Options and Tunables/cleanrate
+ *
+ */
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+
+BEGIN
+{
+	self->i = 0;
+	var1 = 0;
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+}
+
+profile:::tick-1sec
+/var1/
+{
+	speculate(var1);
+	printf("Speculating on id: %d\n", var1);
+	self->i++;
+}
+
+profile:::tick-1sec
+/(!self->i)/
+{
+}
+
+profile:::tick-1sec
+/(self->i)/
+{
+	commit(var1);
+	speculate(var1);
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_DREC.SpecAftDataRec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_DREC.SpecAftDataRec.d
new file mode 100644
index 0000000..80f1fdd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_DREC.SpecAftDataRec.d
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * speculate() may not follow data recording actions.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+BEGIN
+{
+	i = 0;
+}
+
+syscall:::entry
+{
+	self->spec = speculation();
+}
+
+syscall:::
+/self->spec/
+{
+	printf("Entering syscall clause\n");
+	speculate(self->spec);
+	i++;
+	printf("i: %d\n", i);
+}
+
+syscall:::
+/1 == i/
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_SPEC.SpecAftSpec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_SPEC.SpecAftSpec.d
new file mode 100644
index 0000000..67af53b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.D_SPEC_SPEC.SpecAftSpec.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * A clause can contain only one speculate() call.
+ *
+ * SECTION: Speculative Tracing/Using a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	self->i = 0;
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+	var2 = speculation();
+	printf("Speculation ID: %d\n", var2);
+}
+
+profile:::tick-1sec
+{
+	speculate(var1);
+	printf("Speculating on id: %d\n", var1);
+	speculate(var2);
+	printf("Speculating on id: %d", var2);
+	self->i++;
+
+}
+
+profile:::tick-1sec
+/1 > self->i/
+{
+	exit(0);
+}
+
+END
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeBufSize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeBufSize.d
new file mode 100644
index 0000000..7d2f4b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeBufSize.d
@@ -0,0 +1,88 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Verify the behavior of variations in bufsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/bufsize
+ *
+ * NOTES: This test behaves differently depending on the values
+ * assigned to bufsize.
+ * 1. 0 > bufsize.
+ * 2. 0 == bufsize.
+ * 3. 0 < bufsize <= 7
+ * 4. 8 <= bufsize <= 31
+ * 5. 32 <= bufsize <= 47
+ * 6. 48 <= bufsize <= 71
+ * 7. 72 <= bufsize
+ */
+
+#pragma D option quiet
+#pragma D option bufsize=-72
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(0);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeNspec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeNspec.d
new file mode 100644
index 0000000..9e1d063
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeNspec.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Using a negative value for nspec throws a compiler error.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ * 	Options and Tunables/nspec
+ */
+
+#pragma D option quiet
+#pragma D option nspec=-72
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+	printf("This test shouldnt have compiled\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeSpecSize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeSpecSize.d
new file mode 100644
index 0000000..233257a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.NegativeSpecSize.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Setting the specsize to a negative number should throw a compiler error.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ *
+ * NOTES: Why dont we have an error tag for this error?
+ */
+
+#pragma D option quiet
+#pragma D option specsize=-10
+
+BEGIN
+{
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.SpecSizeVariations1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.SpecSizeVariations1.d
new file mode 100644
index 0000000..c42029c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.SpecSizeVariations1.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * ASSERTION:
+ * Verify the behavior of variations in specsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ *
+ */
+
+#pragma D option quiet
+#pragma D option specsize=2
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(0);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.SpecSizeVariations2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.SpecSizeVariations2.d
new file mode 100644
index 0000000..8a57280
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/err.SpecSizeVariations2.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * ASSERTION:
+ * Verify the behavior of variations in specsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ *
+ */
+
+#pragma D option quiet
+#pragma D option specsize=0
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(0);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.CommitAfterDiscard.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.CommitAfterDiscard.d
new file mode 100644
index 0000000..a874ab5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.CommitAfterDiscard.d
@@ -0,0 +1,86 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Call to commit() on a buffer after it has been discarded is silently
+ * ignored.
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation;
+ *	Options and Tunables/cleanrate
+ *
+ */
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+
+BEGIN
+{
+	self->i = 0;
+	self->commit = 0;
+	self->discard = 0;
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+}
+
+BEGIN
+/var1/
+{
+	speculate(var1);
+	printf("This statement and the following are speculative!!\n");
+	printf("Speculating on id: %d\n", var1);
+	self->i++;
+}
+
+BEGIN
+/(self->i)/
+{
+	discard(var1);
+	self->discard++;
+	commit(var1);
+	self->commit++;
+}
+
+BEGIN
+/self->commit/
+{
+	printf("Commited a discarded buffer\n");
+	exit(0);
+}
+
+
+BEGIN
+/!self->commit/
+{
+	printf("Couldnt commit a discarded buffer\n");
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.CommitWithZero.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.CommitWithZero.d
new file mode 100644
index 0000000..647552f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.CommitWithZero.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: An Id of zero though invalid may be passed to speculate(),
+ * commit() and discard() without any ill effects.
+ *
+ * SECTION: Speculative Tracing/Creating a Speculation;
+ *	Options and Tunables/cleanrate
+ */
+#pragma D option quiet
+#pragma D option cleanrate=4000hz
+
+BEGIN
+{
+	self->commitFlag = 0;
+	self->var1 = speculation();
+	printf("Speculative buffer ID: %d\n", self->var1);
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/0 < self->commitFlag/
+{
+	printf("commit(), self->commitFlag = %d\n", self->commitFlag);
+	exit(0);
+}
+
+BEGIN
+/0 == self->commitFlag/
+{
+	printf("commit(), self->commitFlag = %d\n", self->commitFlag);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DataRecAftDiscard.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DataRecAftDiscard.d
new file mode 100644
index 0000000..03ae1b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DataRecAftDiscard.d
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Data recording actions may follow discard.
+ *
+ * SECTION: Speculative Tracing/Discarding a Speculation;
+ *	Options and Tunables/cleanrate
+ */
+#pragma D option quiet
+#pragma D option cleanrate=2000hz
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->discardFlag = 0;
+	self->spec = speculation();
+}
+
+BEGIN
+/self->spec/
+{
+	speculate(self->spec);
+	printf("Called speculate with id: %d\n", self->spec);
+	self->speculateFlag++;
+}
+
+BEGIN
+/(self->spec) && (self->speculateFlag)/
+{
+	discard(self->spec);
+	self->discardFlag++;
+	printf("Data recording after discard\n");
+}
+
+BEGIN
+/self->discardFlag/
+{
+	exit(0);
+}
+
+BEGIN
+/!self->discardFlag/
+{
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftCommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftCommit.d
new file mode 100644
index 0000000..25fcfc5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftCommit.d
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Can call discard() on a buffer after it has been commited.
+ *
+ * SECTION: Speculative Tracing/Discarding a Speculation;
+ *	Options and Tunables/cleanrate
+ *
+ */
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+
+BEGIN
+{
+	self->i = 0;
+	self->commit = 0;
+	self->discard = 0;
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+}
+
+BEGIN
+/var1/
+{
+	speculate(var1);
+	printf("This statement and the following are speculative!!\n");
+	printf("Speculating on id: %d\n", var1);
+	self->i++;
+}
+
+BEGIN
+/(self->i)/
+{
+	commit(var1);
+	self->commit++;
+	discard(var1);
+	self->discard++;
+}
+
+BEGIN
+/self->discard/
+{
+	printf("Discarded a commited buffer\n");
+	exit(0);
+}
+
+
+BEGIN
+/!self->discard/
+{
+	printf("Couldnt discard a commited buffer\n");
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftDataRec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftDataRec.d
new file mode 100644
index 0000000..d5c573f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftDataRec.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Discard may not follow data recording actions.
+ *
+ * SECTION: Speculative Tracing/Discarding a Speculation
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	printf("Can have data recording before discarding\n");
+	discard(self->spec);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftDiscard.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftDiscard.d
new file mode 100644
index 0000000..8c95cee
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardAftDiscard.d
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Can call discard on an already discarded buffer.
+ *
+ * SECTION: Speculative Tracing/Discarding a Speculation;
+ *	Options and Tunables/cleanrate
+ *
+ */
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+
+BEGIN
+{
+	self->i = 0;
+	self->discard1 = 0;
+	self->discard2 = 0;
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+}
+
+BEGIN
+/var1/
+{
+	speculate(var1);
+	printf("This statement and the following are speculative!!\n");
+	printf("Speculating on id: %d\n", var1);
+	self->i++;
+}
+
+BEGIN
+/(self->i)/
+{
+	discard(var1);
+	self->discard1++;
+	discard(var1);
+	self->discard2++;
+}
+
+BEGIN
+/(self->discard2) && (self->discard1)/
+{
+	printf("Discarded a discarded buffer\n");
+	exit(0);
+}
+
+
+BEGIN
+/(!self->discard2) || (!self->discard1)/
+{
+	printf("Couldnt discard a discarded buffer\n");
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardWithZero.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardWithZero.d
new file mode 100644
index 0000000..1a78561
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.DiscardWithZero.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: An Id of zero though invalid may be passed to speculate(),
+ * commit() and discard() without any ill effects.
+ *
+ * SECTION: Speculative Tracing/Creating a Speculation;
+ *	Options and Tunables/cleanrate
+ */
+#pragma D option quiet
+#pragma D option cleanrate=4000hz
+
+BEGIN
+{
+	self->discardFlag = 0;
+	self->var1 = speculation();
+	printf("Speculative buffer ID: %d\n", self->var1);
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+/0 == self->spec/
+{
+	discard(self->spec);
+	self->discardFlag++;
+}
+
+BEGIN
+/0 < self->discardFlag/
+{
+	printf("discard(), self->discardFlag = %d\n", self->discardFlag);
+	exit(0);
+}
+
+BEGIN
+/0 == self->discardFlag/
+{
+	printf("discard(), self->discardFlag = %d\n", self->discardFlag);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.ExitAftDiscard.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.ExitAftDiscard.d
new file mode 100644
index 0000000..f5bcd66
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.ExitAftDiscard.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Using exit after discard should work fine.
+ *
+ * SECTION: Speculative Tracing/Discarding a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	self->i = 0;
+	self->spec = speculation();
+}
+
+BEGIN
+/self->spec/
+{
+	speculate(self->spec);
+	self->i++;
+	printf("self->i: %d\n", self->i);
+}
+
+BEGIN
+/self->i/
+{
+	discard(self->spec);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d
new file mode 100644
index 0000000..8fe3a19
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * The number of speculative buffers defaults to one. If no speculative buffer
+ * is available when speculation is called, an ID of zero is returned.
+ *
+ * SECTION: Speculative Tracing/Creating a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	i = 0;
+}
+
+syscall::open:entry
+/i < 2/
+{
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+	i++;
+}
+
+syscall:::
+/(2 == i) && (0 == self->spec)/
+{
+	printf("i: %d\tself->spec: %d", i, self->spec);
+	exit(0);
+}
+
+syscall:::
+/(2 == i) && (0 != self->spec)/
+{
+	printf("i: %d\tself->spec: %d", i, self->spec);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations1.d
new file mode 100644
index 0000000..17df6b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations1.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * ASSERTION:
+ * Verify the behavior of speculations with changes in specsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ *
+ */
+
+#pragma D option quiet
+#pragma D option specsize=8
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(1);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations2.d
new file mode 100644
index 0000000..bcd2f2e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations2.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * ASSERTION:
+ * Verify the behavior of speculations with changes in specsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ *
+ */
+
+#pragma D option quiet
+#pragma D option specsize=10
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(1);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d
new file mode 100644
index 0000000..6b91efd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * ASSERTION:
+ * Verify the behavior of speculations with changes in specsize.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *	Options and Tunables/specsize
+ *
+ */
+
+#pragma D option quiet
+#pragma D option specsize=40
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->commitFlag = 0;
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	printf("Lots of data\n");
+	printf("Has to be crammed into this buffer\n");
+	printf("Until it overflows\n");
+	printf("And causes flops\n");
+	self->speculateFlag++;
+
+}
+
+BEGIN
+/1 <= self->speculateFlag/
+{
+	commit(self->spec);
+	self->commitFlag++;
+}
+
+BEGIN
+/1 <= self->commitFlag/
+{
+	printf("Statement was executed\n");
+	exit(0);
+}
+
+BEGIN
+/1 > self->commitFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculateWithRandom.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculateWithRandom.d
new file mode 100644
index 0000000..24f1ff4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculateWithRandom.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When speculate() is called with an inactive buffer number, it is
+ * ignored.
+ *
+ * SECTION: Speculative Tracing/Creating a Speculation
+ *
+ */
+#pragma D option quiet
+BEGIN
+{
+	self->i = 0;
+}
+
+BEGIN
+{
+	speculate(3456710);
+	self->i++;
+	printf("self->i: %d\n", self->i);
+
+}
+
+BEGIN
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationCommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationCommit.d
new file mode 100644
index 0000000..744ba67
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationCommit.d
@@ -0,0 +1,75 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test the normal behavior of speculate() and commit().
+ *
+ * SECTION: Speculative Tracing/Committing a Speculation;
+ *	Actions and Subroutines/speculation();
+ *	Options and Tunables/cleanrate
+ *
+ */
+#pragma D option quiet
+#pragma D option cleanrate=2000hz
+
+BEGIN
+{
+	self->var = speculation();
+	printf("Speculation ID: %d\n", self->var);
+	self->speculate = 0;
+	self->commit = 0;
+}
+
+BEGIN
+/1 > self->speculate/
+{
+	speculate(self->var);
+	self->speculate++;
+	printf("Called speculate on id: %d\n", self->var);
+}
+
+BEGIN
+/1 <= self->speculate/
+{
+	commit(self->var);
+	self->commit++;
+}
+
+BEGIN
+/(1 == self->commit)/
+{
+	printf("Succesfully tested buffer commit\n");
+	exit(0);
+}
+
+BEGIN
+/(0 == self->commit)/
+{
+	printf("Failed to commit buffer\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationDiscard.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationDiscard.d
new file mode 100644
index 0000000..4ac0e23
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationDiscard.d
@@ -0,0 +1,74 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Test the normal behavior of speculate() and discard().
+ *
+ * SECTION: Speculative Tracing/Discarding a Speculation;
+ *	Options and Tunables/cleanrate
+ *
+ */
+#pragma D option quiet
+#pragma D option cleanrate=2000hz
+
+BEGIN
+{
+	self->var = speculation();
+	printf("Speculation ID: %d\n", self->var);
+	self->speculate = 0;
+	self->discard = 0;
+}
+
+BEGIN
+/1 > self->speculate/
+{
+	speculate(self->var);
+	self->speculate++;
+	printf("Called speculate on id: %d\n", self->var);
+}
+
+BEGIN
+/1 <= self->speculate/
+{
+	discard(self->var);
+	self->discard++;
+}
+
+BEGIN
+/(1 == self->discard)/
+{
+	printf("Succesfully tested buffer discard\n");
+	exit(0);
+}
+
+BEGIN
+/(0 == self->discard)/
+{
+	printf("Failed to discard buffer\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationID.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationID.d
new file mode 100644
index 0000000..b2e3678
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationID.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * The speculation() function returns a speculative identifier when a
+ * speculative buffer is available.
+ *
+ * SECTION: Speculative Tracing/Creating a Speculation
+ *
+ */
+#pragma D option quiet
+
+BEGIN
+{
+	var = speculation();
+	printf("Speculation ID: %d", var);
+	exit(0);
+}
+
+END
+/0 == var/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationWithZero.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationWithZero.d
new file mode 100644
index 0000000..76600db
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.SpeculationWithZero.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Calling speculate() with zero does not have any ill effects.
+ * Statement after speculate does not execute.
+ *
+ * SECTION: Speculative Tracing/Creating a Speculation
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	self->speculateFlag = 0;
+	self->spec = speculation();
+	self->spec = speculation();
+	printf("Speculative buffer ID: %d\n", self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+	self->speculateFlag++;
+}
+
+BEGIN
+/1 == self->speculateFlag/
+{
+	printf("Statement was executed\n");
+	exit(1);
+}
+
+BEGIN
+/1 != self->speculateFlag/
+{
+	printf("Statement wasn't executed\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.TwoSpecBuffers.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.TwoSpecBuffers.d
new file mode 100644
index 0000000..8016b20
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.TwoSpecBuffers.d
@@ -0,0 +1,77 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Increasing the value of nspec to two should will increase the number of
+ * speculative buffers to two.
+ *
+ * SECTION: Speculative Tracing/Options and Tuning;
+ *		Options and Tunables/nspec
+ *
+ */
+
+#pragma D option quiet
+#pragma D option cleanrate=3000hz
+#pragma D option nspec=2
+
+BEGIN
+{
+	var1 = 0;
+	var2 = 0;
+	var3 = 0;
+}
+
+BEGIN
+{
+	var1 = speculation();
+	printf("Speculation ID: %d\n", var1);
+	var2 = speculation();
+	printf("Speculation ID: %d\n", var2);
+	var3 = speculation();
+	printf("Speculation ID: %d\n", var3);
+}
+
+BEGIN
+/var1 && var2 && (!var3)/
+{
+	printf("Succesfully got two speculative buffers");
+	exit(0);
+}
+
+BEGIN
+/(!var1) || (!var2) || var3/
+{
+	printf("Test failed");
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.negcommit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.negcommit.d
new file mode 100644
index 0000000..cf17c71
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.negcommit.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	commit(-1);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.negspec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.negspec.d
new file mode 100644
index 0000000..72965c7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.negspec.d
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+BEGIN
+{
+	speculate(-1);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.zerosize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.zerosize.d
new file mode 100644
index 0000000..a4b4001
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/speculation/tst.zerosize.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option destructive
+
+BEGIN
+{
+	self->spec = speculation();
+	speculate(self->spec);
+}
+
+BEGIN
+{
+	this->one = 1;
+	this->two = 2;
+	chill(1);
+	speculate(self->spec);
+}
+
+BEGIN
+{
+	speculate(self->spec);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stability/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stability/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stability/err.D_ATTR_MIN.MinAttributes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stability/err.D_ATTR_MIN.MinAttributes.d
new file mode 100644
index 0000000..99fcede
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stability/err.D_ATTR_MIN.MinAttributes.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: If a program has a set of attributes less than the predefined
+ * minimum a D_ATTR_MIN is thrown
+ *
+ * SECTION: Stability/Stability Enforcement
+ * SECTION: Errtags/D_ATTR_MIN
+ *
+ */
+
+#pragma D option quiet
+#pragma D option amin=Evolving/Evolving/Common
+
+BEGIN
+{
+	trace(curthread->t_procp);
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_STACK_PROTO.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_STACK_PROTO.bad.d
new file mode 100644
index 0000000..0af06e6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_STACK_PROTO.bad.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	stack() accepts one argument
+ *
+ * SECTION: Actions and Subroutines/stack()
+ *
+ */
+
+
+BEGIN
+{
+	stack(1, 2);
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_STACK_SIZE.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_STACK_SIZE.d
new file mode 100644
index 0000000..8344e5c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_STACK_SIZE.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test stack() with an invalid argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	stack("i'm not an integer constant");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_FRAMES.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_FRAMES.bad.d
new file mode 100644
index 0000000..bfd7376
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_FRAMES.bad.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	ustack() first argument must be a non-zero positive integer constant
+ *
+ * SECTION: User Process Tracing/ustack();
+ *	Actions and Subroutines/ustack()
+ *
+ */
+
+
+BEGIN
+{
+	ustack(0, 200);
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_PROTO.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_PROTO.bad.d
new file mode 100644
index 0000000..5360d98
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_PROTO.bad.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	ustack() accepts two arguments
+ *
+ * SECTION: User Process Tracing/ustack();
+ *	Actions and Subroutines/ustack()
+ *
+ */
+
+
+BEGIN
+{
+	ustack(1, 10, "badarg");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_STRSIZE.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_STRSIZE.bad.d
new file mode 100644
index 0000000..4c89ed5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/err.D_USTACK_STRSIZE.bad.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	ustack() second argument must be a positive integer constant.
+ *
+ * SECTION: User Process Tracing/ustack();
+ *	Actions and Subroutines/ustack()
+ *
+ */
+
+
+BEGIN
+{
+	ustack(1, "badarg");
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/tst.default.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/tst.default.d
new file mode 100644
index 0000000..f7a4f06
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stack/tst.default.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test the stack action with the default stack depth.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+	stack();
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stackdepth/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stackdepth/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stackdepth/tst.default.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stackdepth/tst.default.d
new file mode 100644
index 0000000..c37380d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stackdepth/tst.default.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test the stackdepth variable.
+ *
+ * SECTION: Variables/Built-in Variables
+ *
+ */
+
+BEGIN
+{
+	trace(stackdepth);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop1.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop1.c
new file mode 100644
index 0000000..28ce1b8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop1.c
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		getpid();
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop1.d
new file mode 100644
index 0000000..dd5a4b9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop1.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive test for stop
+ *
+ * SECTION: Actions and Subroutines/stop()
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the process to call getpid().
+	 */
+	timeout = timestamp + 1000000000;
+	stopped = 0;
+}
+
+syscall::getpid:entry
+/pid == $1 && stopped == 1/
+{
+	trace("looks like it's still going");
+	exit(1);
+}
+
+syscall::getpid:entry
+/pid == $1 && stopped == 0/
+{
+	stop();
+	trace("stopped");
+	stopped = 1;
+	/*
+	 * Wait for a quarter second before declaring victory.
+	 */
+	timeout = timestamp + 1000000000 / 4;
+}
+
+profile:::tick-8
+/timestamp > timeout && stopped == 1/
+{
+	trace("looks like it really stopped");
+	exit(0);
+}
+
+profile:::tick-8
+/timestamp > timeout/
+{
+	trace("timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop2.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop2.c
new file mode 100644
index 0000000..28ce1b8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop2.c
@@ -0,0 +1,37 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		getpid();
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop2.d
new file mode 100644
index 0000000..4c79cd8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/stop/tst.stop2.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Positive test for stop
+ *
+ * SECTION: Actions and Subroutines/stop()
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	/*
+	 * Wait no more than a second for the process to call getpid().
+	 */
+	timeout = timestamp + 1000000000;
+	stopped = 0;
+}
+
+syscall::getpid:entry
+/pid == $1 && stopped == 1/
+{
+	trace("looks like it's still going");
+	exit(1);
+}
+
+syscall::getpid:return
+/pid == $1 && stopped == 0/
+{
+	stop();
+	trace("stopped");
+	stopped = 1;
+	/*
+	 * Wait for a quarter second before declaring victory.
+	 */
+	timeout = timestamp + 1000000000 / 4;
+}
+
+profile:::tick-8
+/timestamp > timeout && stopped == 1/
+{
+	trace("looks like it really stopped");
+	exit(0);
+}
+
+profile:::tick-8
+/timestamp > timeout/
+{
+	trace("timed out");
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/strlen/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/strlen/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/strlen/tst.strlen1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/strlen/tst.strlen1.d
new file mode 100644
index 0000000..7775395
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/strlen/tst.strlen1.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test the strlen() subroutine.
+ *
+ * SECTION: Actions and Subroutines/strlen()
+ *
+ */
+
+BEGIN
+/strlen("I like DTrace") == 13/
+{
+	correct = 1;
+}
+
+BEGIN
+{
+	exit(correct ? 0 : 1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_ADDROF_VAR.StructPointer.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_ADDROF_VAR.StructPointer.d
new file mode 100644
index 0000000..85e49fa
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_ADDROF_VAR.StructPointer.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Trying to access the members of a user defined struct by means of
+ * a pointer to it should throw a D_ADDROF_VAR compiler error.
+ *
+ * SECTION: Structs and Unions/Pointers to Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct record {
+	int position;
+	int content;
+
+};
+
+struct record var;
+struct record *ptr;
+BEGIN
+{
+
+	var.position = 1;
+	var.content = 'a';
+
+	ptr = &var;
+
+	printf("ptr->position: %d\tptr->content: %c\n",
+	  ptr->position, ptr->content);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_COMBO.StructWithoutColon.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_COMBO.StructWithoutColon.d
new file mode 100644
index 0000000..004e901
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_COMBO.StructWithoutColon.d
@@ -0,0 +1,74 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Combining multiple struct definitions in a single line should throw a
+ * compiler error.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#pragma D option quiet
+
+struct superStruct {
+	int position;
+	char content;
+}
+
+struct record {
+	int position;
+	char content;
+}
+
+
+struct pirate {
+	int position;
+	char content;
+};
+
+struct superStruct super;
+struct record rec;
+struct pirate pir;
+
+BEGIN
+{
+	rec.content = 'a';
+	rec.position = 1;
+
+	pir.content = 'b';
+	pir.position = 2;
+
+	printf(
+	"rec.content: %c\nrec.position: %d\npir.content: %c\npir.position: %d",
+	rec.content, rec.position, pir.content, pir.position);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_COMBO.StructWithoutColon1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_COMBO.StructWithoutColon1.d
new file mode 100644
index 0000000..1c403b6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_COMBO.StructWithoutColon1.d
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Combining multiple struct definitions in a single line should throw a
+ * compiler error.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct record {
+	int position;
+	char content;
+};
+
+
+struct pirate {
+	int position;
+	char content;
+}
+
+struct record rec;
+struct pirate pir;
+
+BEGIN
+{
+	rec.content = 'a';
+	rec.position = 1;
+
+	pir.content = 'b';
+	pir.position = 2;
+
+	printf(
+	"rec.content: %c\nrec.position: %d\npir.content: %c\npir.position: %d",
+	rec.content, rec.position, pir.content, pir.position);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.circular.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.circular.d
new file mode 100644
index 0000000..dcbc8ee
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.circular.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * A circular definition of structs (two structs defining each other as
+ * members) should throw an error at compile time.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#pragma D option quiet
+
+
+struct record {
+   struct pirate p;
+   int position;
+   char content;
+};
+
+
+struct pirate {
+   struct record r;
+   int position;
+   char content;
+};
+
+struct record rec;
+struct pirate pir;
+
+BEGIN
+{
+	rec.position = 0;
+	rec.content = 'a';
+	printf("rec.position: %d\nrec.content: %c\n",
+	 rec.position, rec.content);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.order.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.order.d
new file mode 100644
index 0000000..932f4dc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.order.d
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When two struct are defined such that one of them contains the other, the
+ * inner struct has to be defined first.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+#pragma D option quiet
+
+
+struct record {
+	struct pirate p;
+	int position;
+	char content;
+};
+
+struct pirate {
+	int position;
+	char content;
+};
+
+struct record rec;
+struct pirate pir;
+
+BEGIN
+{
+	rec.content = 'y';
+	rec.position = 2;
+
+	pir.content = 'z';
+	pir.position = 26;
+
+	printf(
+	"rec.content: %c\nrec.position: %d\npir.content: %c\npir.position: %d",
+		  rec.content, rec.position, pir.content, pir.position);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.order2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.order2.d
new file mode 100644
index 0000000..807b618
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.order2.d
@@ -0,0 +1,108 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When struct definitions are nested inside one another, the inner struct
+ * should be defined before the outer one can declare it as a variable.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct InnerMore {
+	struct InnerMost IMost;
+	int dummy_More;
+};
+
+struct InnerMost {
+	int position;
+	char content;
+};
+
+struct Inner {
+	struct InnerMore IMore;
+	int dummy_More;
+};
+
+struct Outer {
+	struct Inner I;
+	int dummy_More;
+};
+
+struct OuterMore {
+	struct Outer O;
+	int dummy_More;
+};
+
+struct OuterMost {
+	struct OuterMore OMore;
+	int dummy_More;
+} OMost;
+
+
+BEGIN
+{
+
+	OMost.dummy_More = 0;
+	OMost.OMore.dummy_More = 1;
+	OMost.OMore.O.dummy_More = 2;
+	OMost.OMore.O.I.dummy_More = 3;
+	OMost.OMore.O.I.IMore.dummy_More = 4;
+	OMost.OMore.O.I.IMore.IMost.position = 5;
+	OMost.OMore.O.I.IMore.IMost.content = 'e';
+
+	printf("OMost.dummy_More: %d\nOMost.OMore.dummy_More: %d\n",
+	OMost.dummy_More, OMost.OMore.dummy_More);
+
+	printf("OMost.OMore.O.dummy_More: %d\nOMost.OMore.O.I.dummy_More: %d\n",
+	OMost.OMore.O.dummy_More, OMost.OMore.O.I.dummy_More);
+
+	printf("OMost.OMore.O.I.IMore.dummy_More:%d\n",
+	OMost.OMore.O.I.IMore.dummy_More);
+
+	printf("OMost.OMore.O.I.IMore.IMost.position: %d\n",
+	OMost.OMore.O.I.IMore.IMost.position);
+
+	printf("OMost.OMore.O.I.IMore.IMost.content: %c\n",
+	OMost.OMore.O.I.IMore.IMost.content);
+
+	exit(0);
+}
+
+END
+/(0 != OMost.dummy_More) || (1 != OMost.OMore.dummy_More)
+    (2 != OMost.OMore.O.dummy_More) || (3 != OMost.OMore.O.I.dummy_More)
+    (4 != OMost.OMore.O.I.IMore.dummy_More)
+    (5 != OMost.OMore.O.I.IMore.IMost.position)
+    ('e' != OMost.OMore.O.I.IMore.IMost.content)/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.recursive.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.recursive.d
new file mode 100644
index 0000000..011fbdd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.recursive.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION: Recursive naming of structures should produce compiler error.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#pragma D option quiet
+
+struct record {
+	struct record rec;
+	int position;
+	char content;
+};
+
+struct record r1;
+struct record r2;
+
+BEGIN
+{
+	r1.position = 1;
+	r1.content = 'a';
+
+	r2.position = 2;
+	r2.content = 'b';
+
+	printf("r1.position: %d\nr1.content: %c\n", r1.position, r1.content);
+	printf("r2.position: %d\nr2.content: %c\n", r2.position, r2.content);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.simple.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.simple.d
new file mode 100644
index 0000000..7fc54ff
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_INCOMPLETE.simple.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Declaring an inner struct within another struct and not defining it should
+ * throw a compiler error.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#pragma D option quiet
+
+
+struct record {
+	struct pirate p;
+	int position;
+	char content;
+};
+
+
+struct record rec;
+
+BEGIN
+{
+	rec.position = 0;
+	rec.content = 'a';
+	printf("rec.position: %d\nrec.content: %c\n",
+	 rec.position, rec.content);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_VOIDOBJ.baddec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_VOIDOBJ.baddec.d
new file mode 100644
index 0000000..bba126f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_DECL_VOIDOBJ.baddec.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Declaring void objects will result in a D_DECL_VOIDOBJ error
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct {
+	int trace();
+};
+
+BEGIN
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_PROTO_ARG.DupStructAssoc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_PROTO_ARG.DupStructAssoc.d
new file mode 100644
index 0000000..0eea2d8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/err.D_PROTO_ARG.DupStructAssoc.d
@@ -0,0 +1,80 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Declaring an associative array with a struct to be its key type and trying to
+ * index with another struct having the same composition throws an error.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct record {
+	int position;
+	char content;
+};
+
+struct pirate {
+	int position;
+	char content;
+};
+
+struct record r1;
+struct record r2;
+struct pirate p1;
+struct pirate p2;
+
+BEGIN
+{
+	r1.position = 1;
+	r1.content = 'a';
+
+	r2.position = 2;
+	r2.content = 'b';
+
+	p1.position = 1;
+	p1.content = 'a';
+
+	p2.position = 2;
+	p2.content = 'b';
+
+	assoc_array[r1] = 1000;
+	assoc_array[r2] = 2000;
+	assoc_array[p1] = 3333;
+	assoc_array[p2] = 4444;
+
+	printf("assoc_array[r1]: %d\n",  assoc_array[r1]);
+	printf("assoc_array[r2]: %d\n",  assoc_array[r2]);
+	printf("assoc_array[p1]: %d\n",  assoc_array[p1]);
+	printf("assoc_array[p2]: %d\n",  assoc_array[p2]);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructAssoc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructAssoc.d
new file mode 100644
index 0000000..ead235d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructAssoc.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When a struct is used as a key for an associative array, the key is formed
+ * by using the values of the members of the struct variable and not the
+ * address of the struct variable.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct record {
+	int position;
+	char content;
+};
+
+struct record r1;
+struct record r2;
+
+BEGIN
+{
+	r1.position = 1;
+	r1.content = 'a';
+
+	r2.position = 1;
+	r2.content = 'a';
+
+	assoc_array[r1] = 1000;
+	assoc_array[r2] = 2000;
+
+	printf("assoc_array[r1]: %d\n", assoc_array[r1]);
+	printf("assoc_array[r2]: %d\n", assoc_array[r2]);
+
+	exit(0);
+}
+
+END
+/assoc_array[r1] != assoc_array[r2]/
+{
+	printf("Error");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructDataTypes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructDataTypes.d
new file mode 100644
index 0000000..5cfdc32
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructDataTypes.d
@@ -0,0 +1,133 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Declaration of the different data types within a struct and
+ * their definitions in a later clause should work fine.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ * NOTES: The floats, doubles and strings have not been implemented yet.
+ * When they do, appropriate lines in the code below should be uncommented.
+ * Similarly, the lines with the kmem_flags pointer assignment should be
+ * uncommented when the issues pertaining to it are clarified.
+ *
+ */
+#pragma D option quiet
+
+struct record {
+	char new_char;
+	short new_short;
+	int new_int;
+	long new_long;
+	long long new_long_long;
+	int8_t new_int8;
+	int16_t new_int16;
+	int32_t new_int32;
+	int64_t new_int64;
+	intptr_t new_intptr;
+	uint8_t new_uint8;
+	uint16_t new_uint16;
+	uint32_t new_uint32;
+	uint64_t new_uint64;
+	uintptr_t new_uintptr;
+
+	/*
+	float new_float;
+	double new_double;
+	long double new_long_double;
+
+	string new_string;
+	*/
+
+	struct {
+		char ch;
+		int in;
+		long lg;
+	} new_struct;
+
+	union {
+	     char ch;
+	     int in;
+	     long lg;
+	} new_union;
+
+enum colors {
+	RED,
+	GREEN,
+	BLUE
+} new_enum;
+
+
+	int *pointer;
+} var;
+
+/*
+	var.pointer = &`kmem_flags;
+*/
+BEGIN
+{
+	var.new_char = 'c';
+	var.new_short = 10;
+	var.new_int = 100;
+	var.new_long = 1234567890;
+	var.new_long_long = 1234512345;
+	var.new_int8 = 'p';
+	var.new_int16 = 20;
+	var.new_int32 = 200;
+	var.new_int64 = 2000000;
+	var.new_intptr = 0x12345;
+	var.new_uint8 = 'q';
+	var.new_uint16 = 30;
+	var.new_uint32 = 300;
+	var.new_uint64 = 3000000;
+	var.new_uintptr = 0x67890;
+
+/*	var.new_float = 1.23456;
+	var.new_double = 2.34567890;
+	var.new_long_double = 3.567890123;
+
+	var.new_string = "hello";
+*/
+
+/*
+	var.pointer = &`kmem_flags;
+*/
+
+	var.new_struct.ch = 'c';
+	var.new_struct.in = 4;
+	var.new_struct.lg = 4;
+
+	var.new_union.ch = 'd';
+	var.new_union.in = 5;
+	var.new_union.lg = 5;
+
+	this->var = var;
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructInside.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructInside.d
new file mode 100644
index 0000000..159accc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.StructInside.d
@@ -0,0 +1,124 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Verify the nested behavior of structs.
+ *
+ * SECTION: Structs and Unions/Structs
+ *
+ */
+
+#pragma D option quiet
+
+struct InnerMost {
+	int position;
+	char content;
+};
+
+struct InnerMore {
+	struct InnerMost IMost;
+	int dummy_More;
+};
+
+struct Inner {
+	struct InnerMore IMore;
+	int dummy_More;
+};
+
+struct Outer {
+	struct Inner I;
+	int dummy_More;
+};
+
+struct OuterMore {
+	struct Outer O;
+	int dummy_More;
+};
+
+struct OuterMost {
+	struct OuterMore OMore;
+	int dummy_More;
+} OMost;
+
+struct OuterMost OMostCopy;
+
+BEGIN
+{
+
+	OMost.dummy_More = 0;
+	OMost.OMore.dummy_More = 1;
+	OMost.OMore.O.dummy_More = 2;
+	OMost.OMore.O.I.dummy_More = 3;
+	OMost.OMore.O.I.IMore.dummy_More = 4;
+	OMost.OMore.O.I.IMore.IMost.position = 5;
+	OMost.OMore.O.I.IMore.IMost.content = 'e';
+
+	printf("OMost.dummy_More: %d\nOMost.OMore.dummy_More: %d\n",
+	OMost.dummy_More, OMost.OMore.dummy_More);
+
+	printf("OMost.OMore.O.dummy_More: %d\n",
+	OMost.OMore.O.dummy_More);
+
+	printf("OMost.OMore.O.I.dummy_More: %d\n",
+	OMost.OMore.O.I.dummy_More);
+
+	printf("OMost.OMore.O.I.IMore.dummy_More:%d\n",
+	OMost.OMore.O.I.IMore.dummy_More);
+
+	printf("OMost.OMore.O.I.IMore.IMost.position: %d\n",
+	OMost.OMore.O.I.IMore.IMost.position);
+
+	printf("OMost.OMore.O.I.IMore.IMost.content: %c\n",
+	OMost.OMore.O.I.IMore.IMost.content);
+
+	OMostCopy = OMost;
+
+	exit(0);
+}
+
+END
+/(0 != OMost.dummy_More) || (1 != OMost.OMore.dummy_More) ||
+    (2 != OMost.OMore.O.dummy_More) || (3 != OMost.OMore.O.I.dummy_More) ||
+    (4 != OMost.OMore.O.I.IMore.dummy_More) ||
+    (5 != OMost.OMore.O.I.IMore.IMost.position) ||
+    ('e' != OMost.OMore.O.I.IMore.IMost.content)/
+{
+	exit(1);
+}
+
+END
+/(0 != OMostCopy.dummy_More) || (1 != OMostCopy.OMore.dummy_More) ||
+    (2 != OMostCopy.OMore.O.dummy_More) ||
+    (3 != OMostCopy.OMore.O.I.dummy_More) ||
+    (4 != OMostCopy.OMore.O.I.IMore.dummy_More) ||
+    (5 != OMostCopy.OMore.O.I.IMore.IMost.position) ||
+    ('e' != OMostCopy.OMore.O.I.IMore.IMost.content)/
+{
+	exit(2);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.clauselocal.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.clauselocal.d
new file mode 100644
index 0000000..0a7e80e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.clauselocal.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+struct foo {
+	int x;
+	char y;
+	short z;
+};
+
+this struct foo bar;
+long bignum;
+
+BEGIN
+{
+	this->bar.x = 1;
+	this->bar.y = ',';
+	this->bar.z = 1234;
+}
+
+BEGIN
+{
+	printf("Die %s%c %s.\n", this->bar.x == 1 ? "SystemTap" : "DTrace",
+	    this->bar.y, this->bar.z == 1234 ? "Die" : "The");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.clauselocal.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.clauselocal.d.out
new file mode 100644
index 0000000..c3fbf22
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/struct/tst.clauselocal.d.out
@@ -0,0 +1,2 @@
+Die SystemTap, Die.
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.args.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.args.c
new file mode 100644
index 0000000..209160b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.args.c
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stdio.h>
+#include <sys/syscall.h>
+
+/*ARGSUSED*/
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		(void) syscall(SYS_mmap, NULL, 1, 2, 3, -1, 0x12345678);
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.args.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.args.d
new file mode 100644
index 0000000..8e473b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.args.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Make sure we're correctly reporting arguments to syscall probes.
+ */
+
+#pragma D option quiet
+
+syscall::mmap*:entry
+/pid == $1 && arg0 == 0 && arg1 == 1 && arg2 == 2 && arg3 == 3 &&
+ (int)arg4 == -1 && arg5 == 0x12345678/
+{
+	exit(0);
+}
+
+tick-1s
+/i++ == 3/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.openret.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.openret.ksh
new file mode 100755
index 0000000..6469db7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/syscall/tst.openret.ksh
@@ -0,0 +1,75 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+script() {
+	$dtrace -c 'cat shajirosan' -qs /dev/stdin <<EOF
+	syscall::open*:entry
+	/pid == \$target/
+	{
+		self->p = arg0;
+	}
+
+	syscall::open*:return
+	/self->p && copyinstr(self->p) == "shajirosan"/
+	{
+		self->err = 1;
+		self->p = 0;
+	}
+
+	syscall::open*:return
+	/self->err && (int)arg0 == -1 && (int)arg1 == -1/
+	{
+		exit(0);
+	}
+
+	syscall::open*:return
+	/self->err/
+	{
+		printf("a failed open(2) returned %d\n", (int)arg0);
+		exit(1);
+	}
+
+	syscall::open*:return
+	/self->p/
+	{
+		self->p = 0;
+	}
+EOF
+}
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+script
+status=$?
+
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post.c
new file mode 100644
index 0000000..1e7f957
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post.c
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <libsysevent.h>
+#include <stdio.h>
+
+int
+main(int argc, char **argv)
+{
+	sysevent_id_t id;
+
+	for (;;) {
+		if (sysevent_post_event("class_dtest", "subclass_dtest",
+		    "vendor_dtest", "publisher_dtest", NULL, &id) != 0) {
+			(void) fprintf(stderr, "failed to post sysevent\n");
+			return (1);
+		}
+
+		sleep(1);
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post.d
new file mode 100644
index 0000000..e547a26
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post.d
@@ -0,0 +1,88 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	$1 + 0;	/* make sure pid is referenced */
+
+	/*
+	 * Wait no more than a five seconds for the sysevent to be posted
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+sysevent:::post
+/args[0]->ec_name != NULL/
+{
+	printf("channel name is non-NULL (%s)\n",
+	    args[0]->ec_name);
+	exit(1);
+}
+
+sysevent:::post
+/strstr(args[1]->se_publisher, "vendor_dtest") == NULL/
+{
+	printf("missing vendor name from publisher (%s)\n",
+	    args[1]->se_publisher);
+	exit(1);
+}
+
+sysevent:::post
+/strstr(args[1]->se_publisher, "publisher_dtest") == NULL/
+{
+	printf("missing publisher name from publisher (%s)\n",
+	    args[1]->se_publisher);
+	exit(1);
+}
+
+sysevent:::post
+/args[1]->se_class != "class_dtest"/
+{
+	printf("unexpected class name (%s)\n", args[1]->se_class);
+	exit(1);
+}
+
+sysevent:::post
+/args[1]->se_subclass != "subclass_dtest"/
+{
+	printf("unexpected subclass name (%s)\n", args[1]->se_subclass);
+	exit(1);
+}
+
+sysevent:::post
+{
+	exit(0);
+}
+
+profile:::tick-8
+/timestamp > timeout/
+{
+	printf("timed out\n");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.c
new file mode 100644
index 0000000..4a452a7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.c
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <libsysevent.h>
+#include <stdio.h>
+
+int
+main(int argc, char **argv)
+{
+	evchan_t *ch;
+
+	if (sysevent_evc_bind("channel_dtest", &ch,
+	    EVCH_CREAT | EVCH_HOLD_PEND) != 0) {
+		(void) fprintf(stderr, "failed to bind to sysevent channel\n");
+		return (1);
+	}
+
+	for (;;) {
+		if (sysevent_evc_publish(ch, "class_dtest", "subclass_dtest",
+		    "vendor_dtest", "publisher_dtest", NULL, EVCH_SLEEP) != 0) {
+			(void) sysevent_evc_unbind(ch);
+			(void) fprintf(stderr, "failed to publisth sysevent\n");
+			return (1);
+		}
+		sleep(1);
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.d
new file mode 100644
index 0000000..9d12e1e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/sysevent/tst.post_chan.d
@@ -0,0 +1,87 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	$1 + 0;	/* make sure pid is referenced */
+
+	/*
+	 * Wait no more than five seconds for the sysevent to be posted
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+sysevent:::post
+/args[0]->ec_name != "channel_dtest"/
+{
+	printf("unexpected channel name (%s)\n", args[0]->ec_name);
+	exit(1);
+}
+
+sysevent:::post
+/strstr(args[1]->se_publisher, "vendor_dtest") == NULL/
+{
+	printf("missing vendor name from publisher (%s)\n",
+	    args[1]->se_publisher);
+	exit(1);
+}
+
+sysevent:::post
+/strstr(args[1]->se_publisher, "publisher_dtest") == NULL/
+{
+	printf("missing publisher name from publisher (%s)\n",
+	    args[1]->se_publisher);
+	exit(1);
+}
+
+sysevent:::post
+/args[1]->se_class != "class_dtest"/
+{
+	printf("unexpected class name (%s)\n", args[1]->se_class);
+	exit(1);
+}
+
+sysevent:::post
+/args[1]->se_subclass != "subclass_dtest"/
+{
+	printf("unexpected subclass name (%s)\n", args[1]->se_subclass);
+	exit(1);
+}
+
+sysevent:::post
+{
+	exit(0);
+}
+
+profile:::tick-8
+/timestamp > timeout/
+{
+	printf("timed out\n");
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZERO.tick.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZERO.tick.d
new file mode 100644
index 0000000..015ae2b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZERO.tick.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Negative test; calls tick without valid value.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-n
+{
+	printf("This test is a simple tick-n negative test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROonens.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROonens.d
new file mode 100644
index 0000000..3ed28b1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROonens.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call profile-'ns' less than 200 micro seconds.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+profile-1ns
+{
+	printf("Calls 'ns' less than 200 micro seconds\n");
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROonensec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROonensec.d
new file mode 100644
index 0000000..7b4df19
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROonensec.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call profile-1nsec; less than 200 micro seconds.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+profile-1nsec
+{
+	printf("Call profile-1nsec; less than 200 micro seconds\n");
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROoneus.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROoneus.d
new file mode 100644
index 0000000..6a64a3a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROoneus.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Call profile-us; less than 200 micro seconds.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+profile-1us
+{
+	printf(" Calling profile-us less than 200 micro seconds should fail\n");
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROoneusec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROoneusec.d
new file mode 100644
index 0000000..b6b80be
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/err.D_PDESC_ZEROoneusec.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * profile-usec; less than 200 micro seconds.
+ *
+ * SECTION: profile Provider/profile-n probes
+ *
+ */
+
+#pragma D option quiet
+
+profile-1usec
+{
+	printf("profile-usec; less than 200 micro seconds \n");
+	exit (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickarg0.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickarg0.d
new file mode 100644
index 0000000..4dda358
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickarg0.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * Simple tick-n 'arg0' test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-1
+{
+	printf("The arg0 is %d\n", (int)arg0);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickms.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickms.d
new file mode 100644
index 0000000..602f3a9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickms.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * tick-ms simple test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-1ms
+{
+	printf("This test is a simple tick-ms provider test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickms.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickms.d.out
new file mode 100644
index 0000000..1e26759
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickms.d.out
@@ -0,0 +1,2 @@
+This test is a simple tick-ms provider test
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickmsec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickmsec.d
new file mode 100644
index 0000000..1cf3b74
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickmsec.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * tick-msec simple test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-1msec
+{
+	printf("This test is a simple tick-msec provider test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickmsec.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickmsec.d.out
new file mode 100644
index 0000000..286bb14
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickmsec.d.out
@@ -0,0 +1,2 @@
+This test is a simple tick-msec provider test
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickns.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickns.d
new file mode 100644
index 0000000..917139c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickns.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * tick-ns simple test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-20000000ns
+{
+	printf("This test is a simple tick-ns provider test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickns.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickns.d.out
new file mode 100644
index 0000000..26addde
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickns.d.out
@@ -0,0 +1,2 @@
+This test is a simple tick-ns provider test
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticknsec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticknsec.d
new file mode 100644
index 0000000..3eedead
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticknsec.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * tick-nsec simple test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-20000000nsec
+{
+	printf("This test is a simple tick-nsec provider test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticknsec.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticknsec.d.out
new file mode 100644
index 0000000..4ad77b5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticknsec.d.out
@@ -0,0 +1,2 @@
+This test is a simple tick-nsec provider test
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticks.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticks.d
new file mode 100644
index 0000000..05f2657
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticks.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * tick-1s simple test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-1s
+{
+	printf("This test is a simple tick-s provider test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticks.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticks.d.out
new file mode 100644
index 0000000..b063121
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticks.d.out
@@ -0,0 +1,2 @@
+This test is a simple tick-s provider test
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticksec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticksec.d
new file mode 100644
index 0000000..703af4d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticksec.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * tick-1sec simple test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-1sec
+{
+	printf("This test is a simple tick-sec provider test\n");
+}
+tick-1sec
+{
+	printf("This test is a simple tick-sec provider test");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticksec.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticksec.d.out
new file mode 100644
index 0000000..d9d4f45
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.ticksec.d.out
@@ -0,0 +1,2 @@
+This test is a simple tick-sec provider test
+This test is a simple tick-sec provider test
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickus.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickus.d
new file mode 100644
index 0000000..aa10cbb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickus.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * tick-2000us simple test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-2000us
+{
+	printf("This test is a simple tick-us provider test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickus.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickus.d.out
new file mode 100644
index 0000000..00baa3d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickus.d.out
@@ -0,0 +1,2 @@
+This test is a simple tick-us provider test
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickusec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickusec.d
new file mode 100644
index 0000000..9deb8f4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickusec.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * tick-2000usec simple test.
+ *
+ * SECTION: profile Provider/tick-n probes
+ *
+ */
+
+
+#pragma D option quiet
+
+tick-2000usec
+{
+	printf("This test is a simple tick-usec provider test\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickusec.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickusec.d.out
new file mode 100644
index 0000000..40987e3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tick-n/tst.tickusec.d.out
@@ -0,0 +1,2 @@
+This test is a simple tick-usec provider test
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d
new file mode 100644
index 0000000..a1ec95c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *  Test trace() with no arguments.
+ *
+ * SECTION: Actions and Subroutines/trace()
+ */
+
+BEGIN
+{
+
+	trace();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d
new file mode 100644
index 0000000..eb9f194
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test an invalid specification of trace() with a void argument.
+ *
+ * SECTION: Actions and Subroutines/trace()
+ */
+
+BEGIN
+{
+	trace((void)`kmem_flags);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.misc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.misc.d
new file mode 100644
index 0000000..179d760
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.misc.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test a variety of trace() action invocations.
+ *
+ * SECTION: Actions and Subroutines/trace();
+ *	Output Formatting/trace()
+ *
+ * NOTES:
+ *   We test things that exercise different kinds of DIFO return types
+ *   to ensure each one can be traced.
+ */
+
+BEGIN
+{
+	i = 1;
+}
+
+
+tick-1
+/i != 5/
+{
+	trace("test trace");	/* DT_TYPE_STRING */
+	trace(12345);		/* DT_TYPE_INT (constant) */
+	trace(x++);		/* DT_TYPE_INT (derived) */
+	trace(timestamp);	/* DT_TYPE_INT (variable) */
+	trace(`kmem_flags);	/* CTF type (by value) */
+	trace(*`rootvp);	/* CTF type (by ref) */
+	i++;
+}
+
+tick-1
+/i == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.qstring.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.qstring.d
new file mode 100644
index 0000000..a81d147
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.qstring.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+/*
+ * ASSERTION:
+ *  Positive trace tests - trace with strings, using quiet option
+ *
+ * SECTION: Actions and Subroutines/trace()
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	trace("this");
+	trace(" %should work.\n");
+	trace("%don't w%orry -- this won't cause a %segfault.\n");
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.qstring.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.qstring.d.out
new file mode 100644
index 0000000..908ffb2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.qstring.d.out
@@ -0,0 +1,3 @@
+this %should work.
+%don't w%orry -- this won't cause a %segfault.
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.string.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.string.d
new file mode 100644
index 0000000..c5e7c2c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/trace/tst.string.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Positive trace tests - trace with strings
+ *
+ * SECTION: Actions and Subroutines/trace()
+ */
+
+BEGIN
+{
+	trace("this");
+	trace(" %should work.\n");
+	trace("%don't w%orry -- this won't cause a %segfault.\n");
+
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_ARG.badsize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_ARG.badsize.d
new file mode 100644
index 0000000..4e137ce
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_ARG.badsize.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test tracemem() with an invalid size argument.
+ *
+ * SECTION: Actions and Subroutines/tracemem()
+ */
+
+BEGIN
+{
+	tracemem(123, "i'm a string");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_LEN.toofew.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_LEN.toofew.d
new file mode 100644
index 0000000..91c4f77
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_LEN.toofew.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test tracemem() with too few arguments.
+ *
+ * SECTION: Actions and Subroutines/tracemem()
+ */
+
+
+BEGIN
+{
+	tracemem(123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_LEN.toomany.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_LEN.toomany.d
new file mode 100644
index 0000000..dfe8e4d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_PROTO_LEN.toomany.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test tracemem() with too many arguments.
+ *
+ * SECTION: Actions and Subroutines/tracemem()
+ */
+
+BEGIN
+{
+	tracemem(123, 456, 789);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_ADDR.badaddr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_ADDR.badaddr.d
new file mode 100644
index 0000000..6814577
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_ADDR.badaddr.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test tracemem() with an invalid address argument.
+ *
+ * SECTION: Actions and Subroutines/tracemem()
+ */
+
+BEGIN
+{
+	tracemem(`v, 123);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_SIZE.negsize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_SIZE.negsize.d
new file mode 100644
index 0000000..b3dd438
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_SIZE.negsize.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test tracemem() with a negative size argument.
+ *
+ * SECTION: Actions and Subroutines/tracemem()
+ */
+
+BEGIN
+{
+	tracemem(123, -456);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_SIZE.zerosize.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_SIZE.zerosize.d
new file mode 100644
index 0000000..595bfcc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/err.D_TRACEMEM_SIZE.zerosize.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test tracemem() with a zero size argument.
+ *
+ * SECTION: Actions and Subroutines/tracemem()
+ */
+
+BEGIN
+{
+	tracemem(123, 0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/tst.rootvp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/tst.rootvp.d
new file mode 100644
index 0000000..afa1570
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/tracemem/tst.rootvp.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test tracemem() by tracing out the contents of the root vnode
+ *  as a raw stream of bytes.
+ *
+ * SECTION: Actions and Subroutines/tracemem()
+ */
+
+
+BEGIN
+{
+	i = 1;
+}
+
+tick-1
+/i != 5/
+{
+	tracemem(`rootvp, 20);
+	i++;
+}
+
+tick-1
+/i == 5/
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_DECL_TYPERED.BadTransDecl.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_DECL_TYPERED.BadTransDecl.d
new file mode 100644
index 0000000..2a44778
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_DECL_TYPERED.BadTransDecl.d
@@ -0,0 +1,64 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator with the input type enclosed in
+ * between braces rather than angle brackets.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *uvar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct
+{
+	struct input_struct *uvar
+}
+{
+	myi = ((struct input_struct *) uvar)->i;
+	myc = ((struct input_struct *) uvar)->c;
+}
+
+BEGIN
+{
+	printf("Using braces instead of angle brackets for translator input");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_OP_INCOMPLETE.NonExistentInput1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_OP_INCOMPLETE.NonExistentInput1.d
new file mode 100644
index 0000000..0c8c84d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_OP_INCOMPLETE.NonExistentInput1.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator with a non-existent input type.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ */
+
+#pragma D option quiet
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct input_struct *ivar >
+{
+	myi = ((struct input_struct *) ivar)->nonexistentI;
+	myc = ((struct input_struct *) ivar)->nonexistentC;
+};
+
+BEGIN
+{
+	printf("Test the translation of a non existing input type");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl1.d
new file mode 100644
index 0000000..52e5c9a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl1.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator with the input type enclosed in
+ * between parantheses rather than angle brackets.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *uvar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct ( struct input_struct *uvar )
+{
+	myi = ((struct input_struct *) uvar)->i;
+	myc = ((struct input_struct *) uvar)->c;
+}
+
+BEGIN
+{
+	printf("Test translator with input type in parantheses");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl3.d
new file mode 100644
index 0000000..6be8128
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl3.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator without enclosing braces { }.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *uvar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct input_struct *uvar >
+	myi = ((struct input_struct *) uvar)->i;
+	myc = ((struct input_struct *) uvar)->c;
+;
+
+BEGIN
+{
+	printf("Test the translator definition without enclosing braces");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl4.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl4.d
new file mode 100644
index 0000000..926f74c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_SYNTAX.BadTransDecl4.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator without terminating semi-colon (;).
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *uvar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct input_struct *uvar >
+{
+	myi = ((struct input_struct *) uvar)->i;
+	myc = ((struct input_struct *) uvar)->c;
+}
+
+translator struct output_struct < struct new_struct *newvar >
+{
+};
+
+
+BEGIN
+{
+	printf("Test translator declaration without terminating semi-colon");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_TYPE_MEMBER.NonExistentInput2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_TYPE_MEMBER.NonExistentInput2.d
new file mode 100644
index 0000000..16deff8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_TYPE_MEMBER.NonExistentInput2.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator with a non-existent member
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *ivar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct input_struct *ivar >
+{
+	myi = ((struct input_struct *) ivar)->i;
+	myc = ((struct input_struct *) ivar)->nonexistent;
+};
+
+BEGIN
+{
+	printf("Testing the assignment of a non-existent input member");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_INCOMPAT.BadInputType1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_INCOMPAT.BadInputType1.d
new file mode 100644
index 0000000..26cab45
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_INCOMPAT.BadInputType1.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator with a mismatch in types.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *uvar;
+
+struct output_struct {
+	int myi;
+	char *myc;
+};
+
+translator struct output_struct < struct input_struct *uvar >
+{
+	myi = ((struct input_struct *) uvar)->i;
+	myc = ((struct input_struct *) uvar)->c;
+};
+
+BEGIN
+{
+	printf("Translating against the rules of assignment operator");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_MEMB.NonExistentOutput2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_MEMB.NonExistentOutput2.d
new file mode 100644
index 0000000..6d6eba1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_MEMB.NonExistentOutput2.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator with a non-existent output member.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *ivar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct input_struct *ivar >
+{
+	myi = ((struct input_struct *) ivar)->i;
+	yourc = ((struct input_struct *) ivar)->nonexistent;
+};
+
+BEGIN
+{
+	printf("Testing translation with non existent output member");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_NONE.BadTransDecl6.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_NONE.BadTransDecl6.d
new file mode 100644
index 0000000..4cfabce
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_NONE.BadTransDecl6.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When xlate is used on a variable for which no translation exists a
+ * D_XLATE_NONE is thrown
+ *
+ * SECTION: Translators/Translate Operator
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct myinput_struct {
+	int i;
+	char c;
+};
+
+struct myoutput_struct {
+	int myi;
+	char myc;
+};
+
+translator struct myoutput_struct < struct myinput_struct *ivar >
+{
+	myi = ((struct myinput_struct *) ivar)->i;
+	myc = ((struct myinput_struct *) ivar)->c;
+
+};
+
+struct myinput_struct f;
+BEGIN
+{
+	f.i = 10;
+	f.c = 'c';
+
+	xlate < struct myoutput_struct >(f)->myi;
+	printf("Translate operator used without correct translator decl\n");
+	exit(0);
+}
+
+ERROR
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_REDECL.RepeatTransDecl.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_REDECL.RepeatTransDecl.d
new file mode 100644
index 0000000..62f8482
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_REDECL.RepeatTransDecl.d
@@ -0,0 +1,67 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Redeclaring the same translation twice throws a D_XLATE_REDECL error.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int ii1;
+	char ic1;
+} *ivar1;
+
+struct output_struct {
+	int oi;
+	char oc;
+};
+
+
+translator struct output_struct < struct input_struct *ivar1 >
+{
+	oi = ((struct input_struct *) ivar1)->ii1;
+	oc = ((struct input_struct *) ivar1)->ic1;
+};
+
+translator struct output_struct < struct input_struct *ivar1 >
+{
+	oi = ((struct input_struct *) ivar1)->ii1;
+	oc = ((struct input_struct *) ivar1)->ic1;
+};
+
+
+BEGIN
+{
+	printf("Redeclaration of the same translation");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.BadTransDecl8.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.BadTransDecl8.d
new file mode 100644
index 0000000..63786c7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.BadTransDecl8.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When the output type of the translator declaration is not a struct or
+ * union a D_XLATE_SOU is thrown.
+ *
+ * SECTION: Translators/Translator Declarations
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int ii;
+	char ic;
+};
+
+enum colors
+{
+	RED,
+	BLUE
+};
+
+translator enum colors < struct input_struct *ivar >
+{
+};
+
+BEGIN
+{
+	printf("Output type of translation is an enum");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.BadTransInt.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.BadTransInt.d
new file mode 100644
index 0000000..6545569
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.BadTransInt.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When the output type of the translator declaration is not a struct or
+ * union a D_XLATE_SOU is thrown.
+ *
+ * SECTION: Translators/Translator Declarations
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int ii;
+	char ic;
+};
+
+translator int < struct input_struct *ivar >
+{
+};
+
+BEGIN
+{
+	printf("Output type of translation is an int");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.NonExistentOutput1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.NonExistentOutput1.d
new file mode 100644
index 0000000..1ebb94c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/err.D_XLATE_SOU.NonExistentOutput1.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator with a non-existent output type.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *ivar;
+
+translator struct output_struct < struct input_struct *ivar >
+{
+	myi = ((struct input_struct *) ivar)->i;
+	myc = ((struct input_struct *) ivar)->nonexistent;
+};
+
+BEGIN
+{
+	printf("Translation with non existent output type struct");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d
new file mode 100644
index 0000000..c664188
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * The D inline translation mechanism can be used to facilitate stable
+ * translations.
+ *
+ * SECTION: Translators/ Translator Declarations
+ * SECTION: Translators/ Translate Operator
+ * SECTION: Translators/Stable Translations
+ *
+ * NOTES: Uncomment the pragma that explicitly resets the attributes of
+ * myinfo identifier to Stable/Stable/Common from Private/Private/Unknown.
+ * Run the program with and without the comments as:
+ * /usr/sbin/dtrace -vs man.TestTransStability.d
+ */
+
+#pragma D option quiet
+
+inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
+
+/*
+#pragma D attributes Stable/Stable/Common myinfo
+*/
+
+BEGIN
+{
+	trace(myinfo->pr_flag);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.CircularTransDecl.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.CircularTransDecl.d
new file mode 100644
index 0000000..58466f7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.CircularTransDecl.d
@@ -0,0 +1,100 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test circular declaration of translations
+ *
+ * SECTION: Translators/ Translator Declarations
+ * SECTION: Translators/ Translate Operator
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+};
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct input_struct ivar >
+{
+	myi = ((struct input_struct ) ivar).i;
+	myc = ((struct input_struct ) ivar).c;
+};
+
+translator struct input_struct < struct output_struct uvar >
+{
+	i = ((struct output_struct ) uvar).myi;
+	c = ((struct output_struct ) uvar).myc;
+};
+
+struct input_struct f1;
+struct output_struct f2;
+
+BEGIN
+{
+	f1.i = 10;
+	f1.c = 'c';
+
+	f2.myi = 100;
+	f2.myc = 'd';
+
+	printf("Testing circular translations\n");
+	forwardi = xlate < struct output_struct > (f1).myi;
+	forwardc = xlate < struct output_struct > (f1).myc;
+	backwardi = xlate < struct input_struct > (f2).i;
+	backwardc = xlate < struct input_struct > (f2).c;
+
+	printf("forwardi: %d\tforwardc: %c\n", forwardi, forwardc);
+	printf("backwardi: %d\tbackwardc: %c", backwardi, backwardc);
+	exit(0);
+}
+
+BEGIN
+/(10 == forwardi) && ('c' == forwardc) && (100 == backwardi) &&
+    ('d' == backwardc)/
+{
+	exit(0);
+}
+
+BEGIN
+/(10 != forwardi) || ('c' != forwardc) || (100 != backwardi) ||
+    ('d' != backwardc)/
+{
+	exit(1);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.EmptyTransDecl.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.EmptyTransDecl.d
new file mode 100644
index 0000000..5a29207
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.EmptyTransDecl.d
@@ -0,0 +1,79 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the empty declaration of a translator
+ *
+ * SECTION: Translators/ Translator Declarations
+ * SECTION: Translators/ Translate Operator
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *uvar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct input_struct uvar >
+{
+};
+
+struct input_struct in;
+struct output_struct ou;
+
+BEGIN
+{
+	in.i = 10;
+	in.c = 'c';
+
+	ou = xlate < struct output_struct > (in);
+
+	printf("ou.myi: %d\tou.myc: %c\n", ou.myi, ou.myc);
+}
+
+BEGIN
+/(0 != ou.myi) || (0 != ou.myc)/
+{
+	printf("Failed\n");
+	exit(1);
+}
+
+BEGIN
+/(0 == ou.myi) || (0 == ou.myc)/
+{
+	printf("Passed\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.ForwardTag.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.ForwardTag.d
new file mode 100644
index 0000000..246a8d2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.ForwardTag.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a forward tag using a translator definition.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *uvar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct callmewhatever *idontcare >
+{
+	myi = ((struct input_struct *) uvar)->i;
+	myc = ((struct input_struct *) uvar)->c;
+};
+
+BEGIN
+{
+	printf("This test defines a forward tag");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.InputAliasTrans.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.InputAliasTrans.d
new file mode 100644
index 0000000..a562b39
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.InputAliasTrans.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * The input type of the tranlator declaration is an alias.
+ *
+ * SECTION: Translators/ Translator Declarations.
+ *
+ */
+
+#pragma D option quiet
+
+typedef struct input_struct {
+	int ii;
+	char ic;
+} input_t;
+
+struct output_struct {
+	int oi;
+	char oc;
+};
+
+
+translator struct output_struct < input_t *ivar >
+{
+	oi = ((input_t *) ivar)->ii;
+	oc = ((input_t *) ivar)->ic;
+};
+
+BEGIN
+{
+	printf("Input type is an alias");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.InputIntTrans.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.InputIntTrans.d
new file mode 100644
index 0000000..e5159ed
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.InputIntTrans.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of a translator the input type in the translator
+ * declaration being different from the values being assigned inside.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int i;
+	char c;
+} *uvar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < int idontcare >
+{
+	myi = ((struct input_struct *) uvar)->i;
+	myi = ((struct input_struct *) uvar)->c;
+};
+
+BEGIN
+{
+	printf("Input type to the translator decl is different from members");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.OutputAliasTrans.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.OutputAliasTrans.d
new file mode 100644
index 0000000..cd47153
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.OutputAliasTrans.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * The output type is an alias.
+ *
+ * SECTION: Translators/ Translator Declarations.
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int ii;
+	char ic;
+};
+
+struct output_struct {
+	int oi;
+	char oc;
+};
+
+typedef struct output_struct output_t;
+
+
+translator output_t < struct input_struct *ivar >
+{
+	oi = ((struct input_struct *) ivar)->ii;
+	oc = ((struct input_struct *) ivar)->ic;
+};
+
+BEGIN
+{
+	printf("Output type is an alias");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.PartialDereferencing.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.PartialDereferencing.d
new file mode 100644
index 0000000..ae532cc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.PartialDereferencing.d
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * If you dereference a single member of the translation input, then the
+ * compiler will generate the code corresponding to that member
+ *
+ * SECTION: Translators/ Translate Operator
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int ii;
+	char ic;
+};
+
+struct output_struct {
+	int oi;
+	char oc;
+};
+
+
+translator struct output_struct < struct input_struct ivar >
+{
+	oi = ((struct input_struct) ivar).ii;
+	oc = ((struct input_struct) ivar).ic;
+};
+
+struct output_struct out;
+struct input_struct in;
+
+BEGIN
+{
+	in.ii = 100;
+	in.ic = 'z';
+
+	printf("Translating only a part of the input struct\n");
+	out.oi = xlate < struct output_struct > (in).oi;
+
+	printf("out.oi: %d\t out.oc: %d\n", out.oi, out.oc);
+}
+
+BEGIN
+/(100 != out.oi) || (0 != out.oc)/
+{
+	exit(1);
+}
+
+BEGIN
+/(100 == out.oi) && (0 == out.oc)/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.PartialOutputTransDefn.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.PartialOutputTransDefn.d
new file mode 100644
index 0000000..9be52a9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.PartialOutputTransDefn.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * A translator declaration may omit expressions for one or more members
+ * of the output type
+ *
+ * SECTION: Translators/Translator Declarations;
+ * 	Translators/Translate Operator
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int ii;
+	char ic;
+};
+
+struct output_struct {
+	int oi;
+	char oc;
+};
+
+
+translator struct output_struct < struct input_struct *ivar >
+{
+	oi = ((struct input_struct *) ivar)->ii;
+};
+
+BEGIN
+{
+	printf("Translating only a part of the input struct");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.ProcModelTrans.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.ProcModelTrans.d
new file mode 100644
index 0000000..ff313ec
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.ProcModelTrans.d
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Use the translators in /usr/lib/dtrace/procfs.d
+ *
+ * SECTION: Translators/ Translator Declarations
+ * SECTION: Translators/ Translate Operator
+ * SECTION: Translators/Process Model Translators
+ *
+ */
+
+#pragma D option quiet
+
+proc_t *T;
+
+BEGIN
+{
+	mypr_addr = xlate < psinfo_t > (T).pr_addr;
+	printf("pr_addr: %d", mypr_addr);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.RepeatDeclaration.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.RepeatDeclaration.d
new file mode 100644
index 0000000..a928c3e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.RepeatDeclaration.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Reassign the members of the output struct using another translator
+ * input struct.
+ *
+ * SECTION: Translators/Translator Declarations
+ */
+
+#pragma D option quiet
+
+struct input_struct1 {
+	int ii1;
+	char ic1;
+} *ivar1;
+
+struct input_struct2 {
+	long ii2;
+	long ic2;
+} *ivar2;
+
+struct output_struct {
+	int oi;
+	char oc;
+};
+
+
+translator struct output_struct < struct input_struct1 *ivar1 >
+{
+	oi = ((struct input_struct1 *) ivar1)->ii1;
+	oc = ((struct input_struct1 *) ivar1)->ic1;
+};
+
+translator struct output_struct < struct input_struct2 *ivar2 >
+{
+	oi = ((struct input_struct2 *) ivar2)->ii2;
+	oc = ((struct input_struct2 *) ivar2)->ic2;
+};
+
+BEGIN
+{
+	printf("Reassignment of a struct's members with different input");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.SimultaneousTranslators.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.SimultaneousTranslators.d
new file mode 100644
index 0000000..63cd72c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.SimultaneousTranslators.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Assign the different members of the output of the translator using
+ * different translator declarations.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct1 {
+	int ii1;
+	char ic1;
+} *ivar1;
+
+struct input_struct2 {
+	int ii2;
+	char ic2;
+} *ivar2;
+
+struct output_struct {
+	int oi;
+	char oc;
+};
+
+
+translator struct output_struct < struct input_struct1 *ivar1 >
+{
+	oi = ((struct input_struct1 *) ivar1)->ii1;
+};
+
+translator struct output_struct < struct input_struct2 *ivar2 >
+{
+	oc = ((struct input_struct2 *) ivar2)->ic2;
+};
+
+BEGIN
+{
+	printf("Translate members of output with different input structs");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.StructureAssignment.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.StructureAssignment.d
new file mode 100644
index 0000000..277d95f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.StructureAssignment.d
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * If the entire output is copied by means of a structure assignment, any
+ * members for which no translation expressions are defined will be filled
+ * with zeroes.
+ *
+ * SECTION: Translators/ Translate Operator
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int ii;
+	char ic;
+};
+
+struct output_struct {
+	int oi;
+	char oc;
+};
+
+
+translator struct output_struct < struct input_struct ivar >
+{
+	oi = ((struct input_struct) ivar).ii;
+};
+
+struct output_struct out;
+struct input_struct in;
+
+BEGIN
+{
+	in.ii = 100;
+	in.ic = 'z';
+
+	printf("Translating via struct assignment\n");
+	out = xlate < struct output_struct > (in);
+
+	printf("out.oi: %d\t out.oc: %d\n", out.oi, out.oc);
+}
+
+BEGIN
+/(100 != out.oi) || (0 != out.oc)/
+{
+	exit(1);
+}
+
+BEGIN
+/(100 == out.oi) && (0 == out.oc)/
+{
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransNonPointer.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransNonPointer.d
new file mode 100644
index 0000000..3ec8143
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransNonPointer.d
@@ -0,0 +1,84 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Translate the input expression to output struct type
+ *
+ * SECTION: Translators/ Translator Declarations
+ * SECTION: Translators/ Translate Operator
+ *
+ */
+
+#pragma D option quiet
+
+struct myinput_struct {
+	int i;
+	char c;
+};
+
+struct myoutput_struct {
+	int myi;
+	char myc;
+};
+
+translator struct myoutput_struct < struct myinput_struct ivar >
+{
+	myi = ((struct myinput_struct ) ivar).i;
+	myc = ((struct myinput_struct ) ivar).c;
+
+};
+
+struct myinput_struct f;
+BEGIN
+{
+	f.i = 10;
+	f.c = 'c';
+
+	realmyi = xlate < struct myoutput_struct > (f).myi;
+	realmyc = xlate < struct myoutput_struct > (f).myc;
+}
+
+BEGIN
+/(10 != f.i) || ('c' != f.c)/
+{
+	exit(1);
+}
+
+BEGIN
+/(10 == f.i) && ('c' == f.c)/
+{
+	printf("realmyi: %d\n", realmyi);
+	printf("realmyc: %c\n", realmyc);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransOutputPointer.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransOutputPointer.d
new file mode 100644
index 0000000..9069bf5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransOutputPointer.d
@@ -0,0 +1,80 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Translate an input expression to a pointer to a struct
+ *
+ * SECTION: Translators/ Translator Declarations
+ * SECTION: Translators/ Translate Operator
+ *
+ */
+
+#pragma D option quiet
+
+struct myinput_struct {
+	int i;
+	char c;
+};
+
+struct myoutput_struct {
+	int myi;
+	char myc;
+};
+
+translator struct myoutput_struct < struct myinput_struct ivar >
+{
+	myi = ((struct myinput_struct ) ivar).i;
+	myc = ((struct myinput_struct ) ivar).c;
+
+};
+
+struct myinput_struct f;
+
+BEGIN
+{
+	f.i = 1203;
+	f.c = 'v';
+
+	realmyi = xlate < struct myoutput_struct *> (f)->myi;
+	realmyc = xlate < struct myoutput_struct *> (f)->myc;
+}
+
+BEGIN
+/(1203 != realmyi) || ('v' != realmyc)/
+{
+	printf("Failure");
+	exit(1);
+}
+
+BEGIN
+/(1203 == realmyi) && ('v' == realmyc)/
+{
+	printf("Success");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransPointer.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransPointer.d
new file mode 100644
index 0000000..34d31d4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TransPointer.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the normal declaration of translators.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct myinput_struct {
+	int i;
+	char c;
+};
+
+struct myoutput_struct {
+	int myi;
+	char myc;
+};
+
+translator struct myoutput_struct < struct myinput_struct *ivar >
+{
+	myi = ((struct myinput_struct *) ivar)->i;
+	myc = ((struct myinput_struct *) ivar)->c;
+
+};
+
+struct myinput_struct *f;
+
+BEGIN
+{
+	printf("Good translator defn");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TranslateSelf.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TranslateSelf.d
new file mode 100644
index 0000000..9059093
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.TranslateSelf.d
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the translation of a struct to itself.
+ *
+ * SECTION: Translators/ Translator Declarations.
+ * SECTION: Translators/ Translate operator.
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < struct output_struct uvar >
+{
+	myi = ((struct output_struct ) uvar).myi;
+	myc = ((struct output_struct ) uvar).myc;
+};
+
+struct output_struct out;
+struct output_struct outer;
+
+BEGIN
+{
+	out.myi = 1234;
+	out.myc = 'a';
+
+	printf("Test translation of a struct to itself\n");
+	outer = xlate < struct output_struct > (out);
+
+	printf("outer.myi: %d\t outer.myc: %c\n", outer.myi, outer.myc);
+}
+
+BEGIN
+/(1234 != outer.myi) || ('a' != outer.myc)/
+{
+	exit(1);
+}
+
+BEGIN
+/(1234 == outer.myi) && ('a' == outer.myc)/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.UnionInputTrans.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.UnionInputTrans.d
new file mode 100644
index 0000000..fb2dcf0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.UnionInputTrans.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the declaration of translators with a union to be the input type.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+union input_union {
+	int i;
+	char c;
+} *ivar;
+
+struct output_struct {
+	int myi;
+	char myc;
+};
+
+translator struct output_struct < union input_union *ivar >
+{
+	myi = ((union input_union *) ivar)->i;
+	myc = ((union input_union *) ivar)->c;
+
+};
+
+BEGIN
+{
+	printf("Translator definition good\n");
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.UnionOutputTrans.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.UnionOutputTrans.d
new file mode 100644
index 0000000..3b2c588
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/translators/tst.UnionOutputTrans.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * The output type in a translator definition can be a union.
+ *
+ * SECTION: Translators/Translator Declarations
+ *
+ *
+ */
+
+#pragma D option quiet
+
+struct input_struct {
+	int ii;
+	char ic;
+} *ivar;
+
+union output_union {
+	int oi;
+	char oc;
+};
+
+translator union output_union < struct input_struct *ivar >
+{
+	oi = ((struct input_struct *) ivar)->ii;
+	oc = ((struct input_struct *) ivar)->ic;
+
+};
+
+BEGIN
+{
+	printf("Test translator definition with union output");
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_DECL_IDRED.DupTypeDef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_DECL_IDRED.DupTypeDef.d
new file mode 100644
index 0000000..47a9fdf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_DECL_IDRED.DupTypeDef.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+/*
+ * ASSERTION: Cannot redeclare identifier using typedef.
+ *
+ * SECTION: Type and Constant Definitions/Typedef
+ *
+ * NOTES:
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+typedef int new_int;
+
+BEGIN
+{
+	exit(0);
+}
+
+typedef char new_int;
+
+END
+{
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_SYNTAX.BadExistingTypedef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_SYNTAX.BadExistingTypedef.d
new file mode 100644
index 0000000..38521a0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_SYNTAX.BadExistingTypedef.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+/*
+ * ASSERTION:
+ * The typedef keyword throws an D_SYNTAX error when a bad existing type is
+ * used.
+ *
+ * SECTION: Type and Constant Definitions/Typedef
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+typedef pint new_int;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_SYNTAX.TypedefInClause.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_SYNTAX.TypedefInClause.d
new file mode 100644
index 0000000..0cb8cf7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/err.D_SYNTAX.TypedefInClause.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+/*
+ * ASSERTION:
+ * The typedef keyword can be used outside of the probe clauses only.
+ *
+ * SECTION: Type and Constant Definitions/Typedef
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	typedef int new_int;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/tst.ChainTypedef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/tst.ChainTypedef.d
new file mode 100644
index 0000000..00810a5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/tst.ChainTypedef.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION: An identifier used to alias a primitive data type can be further
+ *       used to typedef other aliases. typedef is transitive.
+ *
+ * SECTION: Type and Constant Definitions/Typedef
+ *
+ * NOTES:
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+typedef int new_int;
+typedef new_int latest_int;
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/tst.TypedefDataAssign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/tst.TypedefDataAssign.d
new file mode 100644
index 0000000..4565be5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/typedef/tst.TypedefDataAssign.d
@@ -0,0 +1,118 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Test the typedef keyword with the different D data types. Declare different
+ * data types and test some of them with values.
+ *
+ * SECTION: Type and Constant Definitions/Typedef
+ *
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+typedef char new_char;
+typedef short new_short;
+typedef int new_int;
+typedef long new_long;
+typedef long long new_long_long;
+typedef int8_t new_int8;
+typedef int16_t new_int16;
+typedef int32_t new_int32;
+typedef int64_t new_int64;
+typedef intptr_t new_intptr;
+typedef uint8_t new_uint8;
+typedef uint16_t new_uint16;
+typedef uint32_t new_uint32;
+typedef uint64_t new_uint64;
+typedef uintptr_t new_uintptr;
+typedef float new_float;
+typedef double new_double;
+typedef long double new_long_double;
+
+typedef int * pointer;
+
+typedef struct {
+	char ch;
+	int in;
+	long lg;
+} new_struct;
+
+typedef union {
+	char ch;
+	int in;
+	long lg;
+} new_union;
+
+typedef enum {
+	RED,
+	GREEN,
+	BLUE
+} new_enum;
+
+new_char c;
+new_short s;
+new_int i;
+new_long l;
+new_long_long ll;
+new_int8 i8;
+new_int16 i16;
+new_int32 i32;
+new_int64 i64;
+new_intptr iptr;
+new_uint8 ui8;
+new_uint16 ui16;
+new_uint32 ui32;
+new_uint64 ui64;
+new_uintptr uiptr;
+new_float f;
+new_double d;
+new_long_double ld;
+new_struct ns;
+new_union nu;
+new_enum ne;
+
+pointer p;
+
+BEGIN
+{
+	ns.ch = 'c';
+	ns.in = 4;
+	ns.lg = 4;
+
+	nu.ch = 'd';
+	nu.in = 5;
+	nu.lg = 5;
+
+	i = 10;
+
+	printf("Struct: %c, %d, %d\n", ns.ch, ns.in, ns.lg);
+	printf("Union: %c, %d, %d\n", nu.ch, nu.in, nu.lg);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CAST_INVAL.badcast.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CAST_INVAL.badcast.d
new file mode 100644
index 0000000..13d58ea
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CAST_INVAL.badcast.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	Test an illegal cast - make sure dtrace catches it.
+ *
+ * SECTION: Aggregations/Clearing aggregations
+ *
+ *
+ */
+
+
+BEGIN
+{
+	(char)trace(`kmem_flags);
+	exit();
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CG_DYN.ResultDynType.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CG_DYN.ResultDynType.d
new file mode 100644
index 0000000..74f2d70
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CG_DYN.ResultDynType.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * An expression cannot evaluate to result of dynamic type.
+ *
+ * SECTION: Errtag/D_CG_DYN
+ */
+
+#pragma D option quiet
+
+translator lwpsinfo_t < int i >
+{
+	pr_flag = i;
+};
+
+BEGIN
+{
+	xlate < lwpsinfo_t * > (0);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CHR_OFLOW.charconst.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CHR_OFLOW.charconst.d
new file mode 100644
index 0000000..b158c3c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_CHR_OFLOW.charconst.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *	verify the use of multi-char constants in single quotes
+ *
+ * SECTION: Types, Operators, and Expressions/Constants
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	char_bad = 'abc\fefghi';
+
+	printf("decimal value = %d", char_bad);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_BADCLASS.bad.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_BADCLASS.bad.d
new file mode 100644
index 0000000..5064a59
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_BADCLASS.bad.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Invalid class names should be handled as an error.
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ *
+ */
+
+register x;
+
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_CHARATTR.badtype3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_CHARATTR.badtype3.d
new file mode 100644
index 0000000..e1407bc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_CHARATTR.badtype3.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Invalid type name
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ *
+ */
+
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	i = (char long)0;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_COMBO.badtype4.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_COMBO.badtype4.d
new file mode 100644
index 0000000..e925a86
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_COMBO.badtype4.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Invalid type name
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ *
+ */
+
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	i = (char int)0;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_COMBO.badtype5.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_COMBO.badtype5.d
new file mode 100644
index 0000000..b7a3b05
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_COMBO.badtype5.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Invalid type name
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ *
+ */
+
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	i = (double double)0;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENCONST.badeval.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENCONST.badeval.d
new file mode 100644
index 0000000..5e1c19d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENCONST.badeval.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Attempt a bogus enum declaration by assigning a non-constant expression
+ *   to an enumerator.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+enum e {
+	TAG = "i am not an integer constant!"
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENOFLOW.enoflow.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENOFLOW.enoflow.d
new file mode 100644
index 0000000..25e14a6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENOFLOW.enoflow.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Define an enumerations with a overflow value.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+enum e {
+	toobig = 2147483648
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENOFLOW.enuflow.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENOFLOW.enuflow.d
new file mode 100644
index 0000000..3709cb2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_ENOFLOW.enuflow.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Define an enumerations with a overflow value using negative value.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+
+enum e {
+	toosmall = -2147483649
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_SCOPE.scopeop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_SCOPE.scopeop.d
new file mode 100644
index 0000000..ddac451
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_SCOPE.scopeop.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Using the scope operator in a declaration will result in a
+ *	D_DECL_SCOPE error.
+ *
+ * SECTION: Variables/External Variables
+ *
+ */
+
+#pragma D option quiet
+
+int `xyz;
+
+BEGIN
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_USELESS.baddec.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_USELESS.baddec.d
new file mode 100644
index 0000000..7e3606e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_DECL_USELESS.baddec.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Bad external declarations will result in a D_DECL_USELESS
+ *	error.
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ *
+ */
+
+extern int;
+
+BEGIN
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_ACT.badcond.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_ACT.badcond.d
new file mode 100644
index 0000000..b139f9e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_ACT.badcond.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Tracing functions may not be second and third expressions
+ *	of a conditional expr.
+ *
+ * SECTION: Types, Operators, and Expressions/Conditional Expressions
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	i = 1;
+	x = i == 0 ? trace(0): trace(1);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_ARITH.badoperand.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_ARITH.badoperand.d
new file mode 100644
index 0000000..9fefb17
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_ARITH.badoperand.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Arithmetic operations with a +/- must be followed by an arithmetic
+ *	type.
+ *
+ * SECTION: Types, Operators, and Expressions/Arithmetic Operators
+ *
+ */
+
+
+
+BEGIN
+{
+	p = 123 + -trace(0);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INCOMPAT.badassign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INCOMPAT.badassign.d
new file mode 100644
index 0000000..04815a9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INCOMPAT.badassign.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Assignment operators do not supported on all types
+ *
+ * SECTION: Types, Operators, and Expressions/Assignment Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	a = 3;
+	a += "foobar";
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INT.badbitop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INT.badbitop.d
new file mode 100644
index 0000000..a210ea1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INT.badbitop.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Bitwise operators not supported on all types
+ *
+ * SECTION: Types, Operators, and Expressions/Bitwise Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+/"char" & "foo"/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INT.badshift.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INT.badshift.d
new file mode 100644
index 0000000..978df1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_INT.badshift.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Shift operators not supported on all types
+ *
+ * SECTION: Types, Operators, and Expressions/Bitwise Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	x = "char" << 2;
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badcond.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badcond.d
new file mode 100644
index 0000000..2972ac2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badcond.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Conditional expressions not supported on all types
+ *
+ * SECTION: Types, Operators, and Expressions/Conditional Expressions
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	a = "boo";
+	c = "boo" ? "should": "fail";
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badincop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badincop.d
new file mode 100644
index 0000000..dfd5a31
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badincop.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Increment operators not supported on all types
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	a = "boo";
+	c = a++;
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badlogop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badlogop.d
new file mode 100644
index 0000000..4f084c7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_OP_SCALAR.badlogop.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Logical operators not supported on all types
+ *
+ * SECTION: Types, Operators, and Expressions/Logical Operators
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+/"char" && "foo"/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_PROTO_LEN.badcond1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_PROTO_LEN.badcond1.d
new file mode 100644
index 0000000..8e32750
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_PROTO_LEN.badcond1.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	Conditional expressions do not accept tracing functions in
+ * 	the second or third expression
+ *
+ * SECTION: Types, Operators, and Expressions/Conditional Expressions
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	a = "boo";
+	c = a == "boo" ? printf("error\n") : trace();
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badenum.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badenum.d
new file mode 100644
index 0000000..3b53775
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badenum.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test a bogus enum declaration using an invalid identifer.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+
+enum foo`bar
+{
+
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badid.d
new file mode 100644
index 0000000..a28182c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badid.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *	Identifiers cannot begin with a digit
+ *
+ * SECTION: Types, Operators, and Expressions/Identifier Names and Keywords
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+int 0abc;
+
+BEGIN
+{
+	0abc = 5;
+	printf("0abc is %d", 0abc);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badstruct.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badstruct.d
new file mode 100644
index 0000000..6c57d21
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_SYNTAX.badstruct.d
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Attempt a bogus struct declaration using an invalid identifer.
+ *
+ * SECTION: Structs and Unions/Structs
+ */
+
+struct foo`bar {
+
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.badtype1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.badtype1.d
new file mode 100644
index 0000000..4f6d1e3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.badtype1.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Invalid type name
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ *
+ */
+
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	i = (long short)0;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.badtype2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.badtype2.d
new file mode 100644
index 0000000..f40e95f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.badtype2.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Invalid type name
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ *
+ */
+
+
+#pragma D option quiet
+
+dtrace:::BEGIN
+{
+	i = (short long)0;
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.dupenum.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.dupenum.d
new file mode 100644
index 0000000..2282f2d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.dupenum.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Attempt a bogus enum declaration that contains duplicated enumerator names.
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+enum foo {
+	x = 3,
+	x = 4
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.dupstruct.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.dupstruct.d
new file mode 100644
index 0000000..4102cd9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_UNKNOWN.dupstruct.d
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Attempt a bogus struct declaration that contains duplicated member names.
+ *
+ * SECTION: Structs and Unions/Structs
+ */
+
+struct foo {
+	int x;
+	char x;
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_XLATE_REDECL.ResultDynType.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_XLATE_REDECL.ResultDynType.d
new file mode 100644
index 0000000..f4e7dfd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/err.D_XLATE_REDECL.ResultDynType.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * An expression cannot evaluate to result of dynamic type.
+ *
+ * SECTION: Errtag/D_CG_DYN
+ */
+
+#pragma D option quiet
+
+translator lwpsinfo_t < kthread_t *T >
+{
+	pr_flag = T->t_flag;
+	pr_lwpid = T->t_tid;
+};
+
+BEGIN
+{
+	xlate < lwpsinfo_t * > (curthread);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.assignops.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.assignops.d
new file mode 100644
index 0000000..6bc27b0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.assignops.d
@@ -0,0 +1,82 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify assignment operators
+ *
+ * SECTION: Types, Operators, and Expressions/Assignment Operators
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	int_1 = 0x100;
+	int_2 = 0xf0f0;
+	int_3 = 0x0f0f;
+
+	intn = 0x1;
+
+	intn += int_1;
+	printf("%x\n", intn);
+	intn -= int_1;
+	printf("%x\n", intn);
+	intn *= int_1;
+	printf("%x\n", intn);
+	intn /= int_1;
+	printf("%x\n", intn);
+	intn %= int_1;
+	printf("%x\n", intn);
+	printf("\n");
+
+	intb = 0x0000;
+
+	intb |= (int_2 | intb);
+	printf("%x\n", intb);
+	intb &= (int_2 | int_3);
+	printf("%x\n", intb);
+	intb ^= (int_2 | int_3);
+	printf("%x\n", intb);
+	intb |= ~(intb);
+	printf("%x\n", intb);
+	printf("\n");
+
+	intb = int_2;
+
+	printf("%x\n", intb);
+	intb <<= 3;
+	printf("%x\n", intb);
+	intb >>= 3;
+	printf("%x\n", intb);
+
+	exit(0);
+
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.badshiftops.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.badshiftops.d
new file mode 100644
index 0000000..ac3c014
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.badshiftops.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Negative values and values greater than the LH operand are
+ * 	accepted.
+ *
+ * SECTION: Types, Operators, and Expressions/Bitwise Operators
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	int_1 = 0xffff;
+
+	nint = int_1 << -6;
+	printf("%x %x\n", int_1, nint);
+	nint = int_1 << 100;
+	printf("%x %x\n", int_1, nint);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.basics.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.basics.d
new file mode 100644
index 0000000..8e762d5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.basics.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Test declaration processing of all the fundamental kinds of type
+ *   declarations.  Check their sizes.
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("\nsizeof (char) = %u\n", sizeof (char));
+	printf("sizeof (signed char) = %u\n", sizeof (signed char));
+	printf("sizeof (unsigned char) = %u\n", sizeof (unsigned char));
+	printf("sizeof (short) = %u\n", sizeof (short));
+	printf("sizeof (signed short) = %u\n", sizeof (signed short));
+	printf("sizeof (unsigned short) = %u\n", sizeof (unsigned short));
+	printf("sizeof (int) = %u\n", sizeof (int));
+	printf("sizeof (signed int) = %u\n", sizeof (signed int));
+	printf("sizeof (unsigned int) = %u\n", sizeof (unsigned int));
+	printf("sizeof (long long) = %u\n", sizeof (long long));
+	printf("sizeof (signed long long) = %u\n", sizeof (signed long long));
+	printf("sizeof (unsigned long long) = %u\n",
+	    sizeof (unsigned long long));
+	printf("sizeof (float) = %u\n", sizeof (float));
+	printf("sizeof (double) = %u\n", sizeof (double));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.basics.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.basics.d.out
new file mode 100644
index 0000000..fd05217
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.basics.d.out
@@ -0,0 +1,16 @@
+
+sizeof (char) = 1
+sizeof (signed char) = 1
+sizeof (unsigned char) = 1
+sizeof (short) = 2
+sizeof (signed short) = 2
+sizeof (unsigned short) = 2
+sizeof (int) = 4
+sizeof (signed int) = 4
+sizeof (unsigned int) = 4
+sizeof (long long) = 8
+sizeof (signed long long) = 8
+sizeof (unsigned long long) = 8
+sizeof (float) = 4
+sizeof (double) = 8
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.bitops.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.bitops.d
new file mode 100644
index 0000000..fc643ba
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.bitops.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify relational operators with pointers
+ *
+ * SECTION: Types, Operators, and Expressions/Bitwise Operators
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	int_1 = 0xffff;
+	int_2 = 0;
+	int_3 = 0x0f0f;
+
+
+	printf("%x %x %x\n",  int_1 & int_2, int_1 & int_3, int_2 & int_3);
+	printf("%x %x %x\n",  int_1 | int_2, int_1 | int_3, int_2 | int_3);
+	printf("%x %x %x\n",  int_1 ^ int_2, int_1 ^ int_3, int_2 ^ int_3);
+
+	printf("%x\n", int_1 & int_2 & int_3);
+	printf("%x\n", int_1 & int_2 ^ int_3);
+	printf("%x\n", int_1 & int_2 | int_3);
+	printf("%x\n", int_1 | int_2 & int_3);
+	printf("%x\n", int_1 | int_2 ^ int_3);
+	printf("%x\n", int_1 | int_2 | int_3);
+	printf("%x\n", int_1 ^ int_2 & int_3);
+	printf("%x\n", int_1 ^ int_2 ^ int_3);
+	printf("%x\n", int_1 ^ int_2 | int_3);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.charconstants.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.charconstants.d
new file mode 100644
index 0000000..84aa61b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.charconstants.d
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *	verify the use of char constants
+ *
+ * SECTION: Types, Operators, and Expressions/Constants
+ *
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	char_1 = 'a';
+	char_2 = '\"';
+	char_3 = '\"\ba';
+	char_4 = '\?';
+	char_5 = '\'';
+	char_6 = '\\';
+	char_7 = '\0103';
+	char_8 = '\x4E';
+	char_9 = '\c';		/* Note - this is not an escape sequence */
+	char_10 = 'ab\"d';
+	char_11 = 'a\bcdefgh';
+
+	printf("decimal value = %d; character value = %c\n", char_1, char_1);
+	printf("decimal value = %d; character value = %c\n", char_2, char_2);
+	printf("decimal value = %d; character value = %c\n", char_3, char_3);
+	printf("decimal value = %d; character value = %c\n", char_4, char_4);
+	printf("decimal value = %d; character value = %c\n", char_5, char_5);
+	printf("decimal value = %d; character value = %c\n", char_6, char_6);
+	printf("decimal value = %d; character value = %c\n", char_7, char_7);
+	printf("decimal value = %d; character value = %c\n", char_8, char_8);
+	printf("decimal value = %d; character value = %c\n", char_9, char_9);
+	printf("decimal value = %d; character value = %c\n", char_10, char_10);
+	printf("decimal value = %d\n", char_11);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.complex.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.complex.d
new file mode 100644
index 0000000..a912670
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.complex.d
@@ -0,0 +1,74 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Test a complex structure and verify that tracemem can be used to
+ *  look at it.
+ *
+ * SECTION: Structs and Unions/Structs;
+ * 	Actions and Subroutines/tracemem()
+ */
+
+
+
+#pragma D option quiet
+
+struct s {
+	int i;
+	char c;
+	double d;
+	float f;
+	long l;
+	long long ll;
+	union sigval u;
+	enum uio_rw e;
+	struct vnode s;
+	struct s1 {
+		int i;
+		char c;
+		double d;
+		float f;
+		long l;
+		long long ll;
+		union sigval u;
+		enum uio_rw e;
+		struct vnode s;
+	} sx;
+	int a[2];
+	int *p;
+	int *ap[4];
+	int (*fp)();
+	int (*afp[2])();
+};
+
+BEGIN
+{
+	tracemem(curthread, sizeof (struct s));
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.condexpr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.condexpr.d
new file mode 100644
index 0000000..fe23a73
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.condexpr.d
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	positive check conditional expressions
+ *
+ * SECTION: Types, Operators, and Expressions/Conditional Expressions
+ *
+ * NOTES: these tests are from the User's Guide
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	i = 0;
+	x = i == 0 ? "zero" : "non-zero";
+
+	c = 'd';
+	hexval = (c >= '0' && c <= '9') ? c - '0':
+		(c >= 'a' && c <= 'z') ? c + 10 - 'a' : c + 10 - 'A';
+}
+
+tick-1
+/x == "zero" && hexval == 13/
+{
+	exit(0);
+}
+
+tick-1
+/x != "zero" || hexval != 13/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.constants.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.constants.d
new file mode 100644
index 0000000..101bb8b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.constants.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * 	verify that integer constants can be written in decimal
+ *      octal or hexadecimal
+ *
+ * SECTION: Types, Operators, and Expressions/Constants
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	decimal = 12345;
+	octal = 012345;
+	hexadecimal_1 = 0x12345;
+	hexadecimal_2 = 0X12345;
+
+	printf("%d %d %d %d", decimal, octal, hexadecimal_1, hexadecimal_2);
+	printf("%d %o %x %x", decimal, octal, hexadecimal_1, hexadecimal_2);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.conv.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.conv.d
new file mode 100644
index 0000000..9020424
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.conv.d
@@ -0,0 +1,109 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * 	positive type conversion checks
+ *
+ * SECTION: Types, Operators, and Expressions/Type Conversions
+ *
+ * NOTES: not all type conversions are checked.  A lot of this section
+ * 	is tested within other tests.
+ */
+
+#pragma D option quiet
+
+unsigned int i;
+char c;
+short s;
+long l;
+long long ll;
+
+BEGIN
+{
+/* char -> int */
+	c = 'A';
+	i = c;
+	printf("c is %c i is %d\n", c, i);
+
+/* int -> char */
+
+	i = 1601;
+	c = i;
+	printf("i is %d c is %c\n", i, c);
+
+/* char -> short */
+	c = 'A';
+	s = c;
+	printf("c is %c s is %d\n", c, s);
+
+/* short -> char */
+
+	s = 1601;
+	c = s;
+	printf("s is %d c is %c\n", s, c);
+
+/* int -> short */
+
+	i = 1601;
+	s = i;
+	printf("i is %d s is %d\n", i, s);
+
+/* short -> int */
+
+	s = 1601;
+	i = s;
+	printf("s is %d i is %d\n", s, i);
+
+/* int -> long long */
+
+	i = 4294967295;
+	ll = i;
+	printf("i is %d ll is %x\n", i, ll);
+
+/* long long -> int */
+
+	ll = 8589934591;
+	i = ll;
+	printf("ll is %d i is %x\n", ll, i);
+
+/* char -> long long */
+
+	c = 'A';
+	ll = c;
+	printf("c is %c ll is %x\n", c, ll);
+
+/* long long -> char */
+
+	ll = 8589934401;
+	c = ll;
+	printf("ll is %x c is %c\n", ll, c);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.enum.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.enum.d
new file mode 100644
index 0000000..49a97bf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.enum.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *  Positive enumeration test
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ */
+
+#pragma D option quiet
+
+enum my_enum {
+	zero,
+	one = 1,
+	two,
+	three,
+	four = 4,
+	minimum = -2147483648,
+	maximum = 2147483647
+};
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.intincop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.intincop.d
new file mode 100644
index 0000000..77eb702
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.intincop.d
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify increment operator using integers
+ *
+ * SECTION: Type and Constant Definitions/Enumerations
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	int_orig = 100;
+	int_pos = 100+1;
+	int_neg = 100-1;
+
+	int_pos_before = ++int_orig;
+	int_orig = 100;
+	int_neg_before = --int_orig;
+	int_orig = 100;
+	int_pos_after = int_orig++;
+	int_orig = 100;
+	int_neg_after = int_orig--;
+	int_orig = 100;
+
+}
+
+tick-1
+/int_pos_before  == int_pos && int_neg_before == int_neg &&
+	int_pos_after == int_orig && int_pos_after == int_orig/
+{
+	exit(0);
+}
+
+
+tick-1
+/int_pos_before  != int_pos || int_neg_before != int_neg ||
+	int_pos_after != int_orig || int_pos_after != int_orig/
+{
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.intops.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.intops.d
new file mode 100644
index 0000000..a374480
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.intops.d
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify relational operators with integers
+ *
+ * SECTION: Types, Operators, and Expressions/Relational Operators;
+ * 	Types, Operators, and Expressions/Precedence
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	int_1 = 0x100;
+	int_2 = 0x101;
+	int_3 = 0x99;
+}
+
+tick-1
+/int_1 >= int_2 || int_2 <= int_1 || int_1 == int_2/
+{
+	printf("Shouldn't end up here (1)\n");
+	printf("int_1 = %x int_2 = %x int_3 = %x\n",
+		(int) int_1, (int) int_2, (int) int_3);
+	exit(1);
+}
+
+tick-1
+/int_3 > int_1 || int_1 < int_3 || int_3 == int_1/
+{
+	printf("Shouldn't end up here (2)\n");
+	printf("int_1 = %x int_2 = %x int_3 = %x\n",
+		(int) int_1, (int) int_2, (int) int_3);
+	exit(1);
+}
+
+tick-1
+/int_2 > int_3 && int_1 < int_2 ^^ int_3 == int_2 && !(int_1 != int_2)/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.inttypes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.inttypes.d
new file mode 100644
index 0000000..80bfa1f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.inttypes.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *	Verify integer type aliases
+ *
+ * SECTION: Types, Operators, and Expressions/Data Types and Sizes
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+BEGIN
+{
+	printf("sizeof (int8_t) = %u\n", sizeof (int8_t));
+	printf("sizeof (int16_t) = %u\n", sizeof (int16_t));
+	printf("sizeof (int32_t) = %u\n", sizeof (int32_t));
+	printf("sizeof (int64_t) = %u\n", sizeof (int64_t));
+	printf("sizeof (intptr_t) = %u\n", sizeof (intptr_t));
+	printf("sizeof (uint8_t) = %u\n", sizeof (uint8_t));
+	printf("sizeof (uint16_t) = %u\n", sizeof (uint16_t));
+	printf("sizeof (uint32_t) = %u\n", sizeof (uint32_t));
+	printf("sizeof (uint64_t) = %u\n", sizeof (uint64_t));
+	printf("sizeof (uintptr_t) = %u\n", sizeof (uintptr_t));
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.ptrincop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.ptrincop.d
new file mode 100644
index 0000000..0fdd561
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.ptrincop.d
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify increment/decrement operator using pointers
+ *
+ * SECTION: Types, Operators, and Expressions/Increment and Decrement Operators
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	ptr_orig = &`kmem_flags;
+	ptr_pos = &`kmem_flags+1;
+	ptr_neg = &`kmem_flags-1;
+
+	ptr_pos_before = ++ptr_orig;
+	ptr_orig = &`kmem_flags;
+	ptr_neg_before = --ptr_orig;
+
+	ptr_orig = &`kmem_flags;
+	ptr_pos_after = ptr_orig++;
+	ptr_orig = &`kmem_flags;
+	ptr_neg_after = ptr_orig--;
+	ptr_orig = &`kmem_flags;
+
+}
+
+tick-1
+/ptr_pos_before  == ptr_pos && ptr_neg_before == ptr_neg &&
+	ptr_pos_after == ptr_orig && ptr_pos_after == ptr_orig/
+{
+	exit(0);
+}
+
+
+tick-1
+/ptr_pos_before  != ptr_pos || ptr_neg_before != ptr_neg ||
+	ptr_pos_after != ptr_orig || ptr_pos_after != ptr_orig/
+{
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.ptrops.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.ptrops.d
new file mode 100644
index 0000000..d4144b0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.ptrops.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify relational operators with pointers
+ *
+ * SECTION: Types, Operators, and Expressions/Relational Operators;
+ *	Types, Operators, and Expressions/Logical Operators;
+ *	Types, Operators, and Expressions/Precedence
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	ptr_1 = &`kmem_flags;
+	ptr_2 = (&`kmem_flags) + 1;
+	ptr_3 = (&`kmem_flags) - 1 ;
+}
+
+tick-1
+/ptr_1 >= ptr_2 || ptr_2 <= ptr_1 || ptr_1 == ptr_2/
+{
+	printf("Shouldn't end up here (1)\n");
+	printf("ptr_1 = %x ptr_2 = %x ptr_3 = %x\n",
+		(int) ptr_1, (int) ptr_2, (int) ptr_3);
+	exit(1);
+}
+
+tick-1
+/ptr_3 > ptr_1 || ptr_1 < ptr_3 || ptr_3 == ptr_1/
+{
+	printf("Shouldn't end up here (2)\n");
+	printf("ptr_1 = %x ptr_2 = %x ptr_3 = %x\n",
+		(int) ptr_1, (int) ptr_2, (int) ptr_3);
+	exit(1);
+}
+
+tick-1
+/ptr_3 > ptr_2 || ptr_1 < ptr_2 ^^ ptr_3 == ptr_2 && !(ptr_1 != ptr_2)/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.relenum.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.relenum.d
new file mode 100644
index 0000000..8fa6d58
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.relenum.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify relational operators with enumerations
+ *
+ * SECTION: Types, Operators, and Expressions/Relational Operators
+ *
+ */
+
+#pragma D option quiet
+
+enum numbers_1 {
+	zero,
+	one,
+	two
+};
+
+enum numbers_2 {
+	null,
+	first,
+	second
+};
+
+tick-1
+/zero >= one || second <= first || zero == second/
+{
+	printf("Shouldn't end up here (1)\n");
+	printf("zero = %d; one = %d; two = %d", zero, one, two);
+	printf("null = %d; first = %d; second = %d", null, first, second);
+	exit(1);
+}
+
+tick-1
+/second < one || two > second || null == first/
+{
+	printf("Shouldn't end up here (2)\n");
+	printf("zero = %d; one = %d; two = %d", zero, one, two);
+	printf("null = %d; first = %d; second = %d", null, first, second);
+	exit(1);
+}
+
+tick-1
+/first < two && second > one && one != two && zero != first/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.relstring.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.relstring.d
new file mode 100644
index 0000000..9e9ef29
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.relstring.d
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify relational operators with strings
+ *
+ * SECTION: Types, Operators, and Expressions/Relational Operators
+ *
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	string_1 = "abcde";
+	string_2 = "aabcde";
+	string_3 = "abcdef";
+}
+
+tick-1
+/string_1 <= string_2 || string_2 >= string_1 || string_1 == string_2/
+{
+	printf("Shouldn't end up here (1)\n");
+	printf("string_1 = %s string_2 = %s string_3 = %s\n",
+		string_1, string_2, string_3);
+	exit(1);
+}
+
+tick-1
+/string_3 < string_1 || string_1 > string_3 || string_3 == string_1/
+{
+	printf("Shouldn't end up here (2)\n");
+	printf("string_1 = %s string_2 = %s string_3 = %s n",
+		string_1, string_2, string_3);
+	exit(1);
+}
+
+tick-1
+/string_3 > string_1 && string_1 > string_2 &&
+	string_1 != string_2 && string_2 != string_3/
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.shiftops.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.shiftops.d
new file mode 100644
index 0000000..a260238
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.shiftops.d
@@ -0,0 +1,62 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify shift operators
+ *
+ * SECTION: Types, Operators, and Expressions/Bitwise Operators;
+ * 	Types, Operators, and Expressions/Precedence
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	int_1 = 0xffff;
+
+	nint = (((((((((((int_1 << 2 >> 2) << 3 >> 3) << 4 >> 4) << 5 >> 5)
+		<< 6 >> 6) << 7 >> 7) << 8 >>8) << 9 >> 9) << 10 >> 10)
+		<< 11 >> 11) << 12 >> 12);
+
+}
+
+tick-1
+/nint != int_1/
+{
+	printf("Unexpected error nint = %x, expected %x\n", nint, int_1);
+	exit(1);
+}
+
+tick-1
+/nint == int_1/
+{
+	exit(0);
+
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.stringconstants.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.stringconstants.d
new file mode 100644
index 0000000..9fa0805
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.stringconstants.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *	verify the use of char type
+ *
+ * SECTION: Types, Operators, and Expressions/Constants
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+string string_1;
+
+BEGIN
+{
+	string_1 = "abcd\n\n\nefg";
+	string_2 = "abc\"\t\044\?\x4D";
+	string_3 = "\?\\\'\"\0";
+
+	printf("string_1 = %s\n", string_1);
+	printf("string_2 = %s\n", string_2);
+	printf("string_3 = %s\n", string_3);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.struct.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.struct.d
new file mode 100644
index 0000000..86610f6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.struct.d
@@ -0,0 +1,84 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Declare a dynamic type and then use it to copyin the first 3 environment
+ *   variable pointers from the current process.
+ *
+ * SECTION: Structs and Unions/Structs;
+ *	Actions and Subroutines/copyin();
+ * 	Actions and Subroutines/copyinstr();
+ *	Variables/External Variables
+ *
+ * NOTES:
+ *  This test program declares a dynamic type and then uses it to copyin the
+ *  first three environment variable pointers from the current process.  We
+ *  then use the dynamic type to access the result of our copyin().  The
+ *  special "D" module type scope is also tested.
+ */
+
+#pragma D option quiet
+
+struct env_vars_32 {
+	uint32_t e1;
+	uint32_t e2;
+	uint32_t e3;
+};
+
+struct env_vars_64 {
+	uint64_t e1;
+	uint64_t e2;
+	uint64_t e3;
+};
+
+BEGIN
+/curpsinfo->pr_dmodel == PR_MODEL_ILP32/
+{
+	e32 = (struct D`env_vars_32 *)
+	    copyin(curpsinfo->pr_envp, sizeof (struct D`env_vars_32));
+
+	printf("e1 = \"%s\"\n", stringof(copyinstr(e32->e1)));
+	printf("e2 = \"%s\"\n", stringof(copyinstr(e32->e2)));
+	printf("e3 = \"%s\"\n", stringof(copyinstr(e32->e3)));
+
+	exit(0);
+}
+
+BEGIN
+/curpsinfo->pr_dmodel == PR_MODEL_LP64/
+{
+	e64 = (struct D`env_vars_64 *)
+	    copyin(curpsinfo->pr_envp, sizeof (struct D`env_vars_64));
+
+	printf("e1 = \"%s\"\n", stringof(copyinstr(e64->e1)));
+	printf("e2 = \"%s\"\n", stringof(copyinstr(e64->e2)));
+	printf("e3 = \"%s\"\n", stringof(copyinstr(e64->e3)));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.typedef.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.typedef.d
new file mode 100644
index 0000000..aabfc9b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.typedef.d
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *   Declares a dynamic type and then uses it to copyin the first three
+ *   environment variable pointers from the current process.
+ *
+ * SECTION: Structs and Unions/Structs;
+ *	Actions and Subroutines/copyin();
+ * 	Actions and Subroutines/copyinstr();
+ *	Variables/External Variables
+ *
+ * NOTES:
+ *  This test program declares a dynamic type and then uses it to copyin the
+ *  first three environment variable pointers from the current process.  We
+ *  then use the dynamic type to access the result of our copyin().  The
+ *  special "D" module type scope is also tested.  This is similar to our
+ *  struct declaration test but here we use a typedef.
+ */
+
+#pragma D option quiet
+
+typedef struct env_vars_32 {
+	uint32_t e1;
+	uint32_t e2;
+	uint32_t e3;
+} env_vars_32_t;
+
+typedef struct env_vars_64 {
+	uint64_t e1;
+	uint64_t e2;
+	uint64_t e3;
+} env_vars_64_t;
+
+BEGIN
+/curpsinfo->pr_dmodel == PR_MODEL_ILP32/
+{
+	e32 = (D`env_vars_32_t *)
+	    copyin(curpsinfo->pr_envp, sizeof (D`env_vars_32_t));
+
+	printf("e1 = \"%s\"\n", stringof(copyinstr(e32->e1)));
+	printf("e2 = \"%s\"\n", stringof(copyinstr(e32->e2)));
+	printf("e3 = \"%s\"\n", stringof(copyinstr(e32->e3)));
+
+	exit(0);
+}
+
+BEGIN
+/curpsinfo->pr_dmodel == PR_MODEL_LP64/
+{
+	e64 = (D`env_vars_64_t *)
+	    copyin(curpsinfo->pr_envp, sizeof (D`env_vars_64_t));
+
+	printf("e1 = \"%s\"\n", stringof(copyinstr(e64->e1)));
+	printf("e2 = \"%s\"\n", stringof(copyinstr(e64->e2)));
+	printf("e3 = \"%s\"\n", stringof(copyinstr(e64->e3)));
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.unaryop.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.unaryop.d
new file mode 100644
index 0000000..b9938e4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/types/tst.unaryop.d
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	Verify unary operator
+ *
+ * SECTION: Types, Operators, and Expressions/Bitwise Operators
+ */
+
+#pragma D option quiet
+
+
+BEGIN
+{
+	int_1 = 0xffff;
+	int_2 = 0;
+	int_3 = 0x0f0f;
+
+	printf("%x %x %x\n", int_1, int_2, int_3);
+	printf("%x %x %x\n", ~int_1, ~int_2, ~int_3);
+	printf("%x %x %x\n", ~~int_1, ~~int_2, ~~int_3);
+	printf("%x %x %x\n", ~~~int_1, ~~~int_2, ~~~int_3);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_ADDROF_VAR.UnionPointer.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_ADDROF_VAR.UnionPointer.d
new file mode 100644
index 0000000..0a292cd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_ADDROF_VAR.UnionPointer.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Trying to access the members of a user defined union by means of
+ * a pointer to it should throw a D_ADDROF_VAR compiler error.
+ *
+ * SECTION: Structs and Unions/Pointers to Structs
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	int position;
+		  int content;
+
+};
+
+union record var;
+union record *ptr;
+
+BEGIN
+{
+
+	var.position = 1;
+	var.content = 'a';
+
+	ptr = &var;
+
+	printf("ptr->position: %d\tptr->content: %c\n",
+	  ptr->position, ptr->content);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_COMBO.UnionWithoutColon.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_COMBO.UnionWithoutColon.d
new file mode 100644
index 0000000..4adb36e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_COMBO.UnionWithoutColon.d
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Combining multiple union definitions in a single line should throw a
+ * compiler error.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	int position;
+	char content;
+}
+
+
+union pirate {
+	int position;
+	char content;
+};
+
+union superStruct super;
+union record rec;
+union pirate pir;
+
+BEGIN
+{
+	rec.content = 'a';
+	rec.position = 1;
+
+	pir.content = 'b';
+	pir.position = 2;
+
+	printf(
+	"rec.content: %c\nrec.position: %d\npir.content: %c\npir.position: %d",
+	rec.content, rec.position, pir.content, pir.position);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_COMBO.UnionWithoutColon1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_COMBO.UnionWithoutColon1.d
new file mode 100644
index 0000000..5506a97
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_COMBO.UnionWithoutColon1.d
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Combining multiple union definitions in a single line should throw a
+ * compiler error.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	int position;
+	char content;
+};
+
+
+union pirate {
+	int position;
+	char content;
+}
+
+union record rec;
+union pirate pir;
+
+BEGIN
+{
+	rec.content = 'a';
+	rec.position = 1;
+
+	pir.content = 'b';
+	pir.position = 2;
+
+	printf(
+	"rec.content: %c\nrec.position: %d\npir.content: %c\npir.position: %d",
+	rec.content, rec.position, pir.content, pir.position);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.circular.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.circular.d
new file mode 100644
index 0000000..ae6e647
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.circular.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * A circular definition of unions (two unions defining each other as
+ * members) should throw an error at compile time.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	union pirate p;
+	int position;
+	char content;
+};
+
+
+union pirate {
+	union record r;
+	int position;
+	char content;
+};
+
+union record rec;
+union pirate pir;
+
+BEGIN
+{
+	rec.position = 0;
+	rec.content = 'a';
+	printf(
+	"rec.position: %d\nrec.content: %c\n", rec.position, rec.content);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.order.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.order.d
new file mode 100644
index 0000000..9e2ec69
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.order.d
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When two unions are defined such that one of them contains the other, the
+ * inner union has to be defined first.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+
+#pragma D option quiet
+
+
+union record {
+	union pirate p;
+	int position;
+	char content;
+};
+
+union pirate {
+	int position;
+	char content;
+};
+
+union record rec;
+union pirate pir;
+
+BEGIN
+{
+	rec.content = 'y';
+	rec.position = 2;
+
+	pir.content = 'z';
+	pir.position = 26;
+
+	printf(
+	"rec.content: %c\nrec.position: %d\npir.content: %c\npir.position: %d",
+	rec.content, rec.position, pir.content, pir.position);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.recursive.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.recursive.d
new file mode 100644
index 0000000..2a86b9c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.recursive.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Recursive naming of unions should produce compiler error.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	union record rec;
+	int position;
+	char content;
+};
+
+union record r1;
+union record r2;
+
+BEGIN
+{
+	r1.position = 1;
+	r1.content = 'a';
+
+	r2.position = 2;
+	r2.content = 'b';
+
+	printf("r1.position: %d\nr1.content: %c\n", r1.position, r1.content);
+	printf("r2.position: %d\nr2.content: %c\n", r2.position, r2.content);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.simple.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.simple.d
new file mode 100644
index 0000000..781d726
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_DECL_INCOMPLETE.simple.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Declaring an inner union without defining it else where should throw
+ * a compiler error.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+#pragma D option quiet
+
+
+union record {
+	union pirate p;
+	int position;
+	char content;
+};
+
+
+union record rec;
+
+BEGIN
+{
+	rec.position = 0;
+	rec.content = 'a';
+	printf("rec.position: %d\nrec.content: %c\n",
+	rec.position, rec.content);
+
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_PROTO_ARG.DupUnionAssoc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_PROTO_ARG.DupUnionAssoc.d
new file mode 100644
index 0000000..f918741
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/err.D_PROTO_ARG.DupUnionAssoc.d
@@ -0,0 +1,80 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Declaring an associative array with a union to be its key type and trying to
+ * index with another union having the same composition throws an error.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	int position;
+	char content;
+};
+
+union pirate {
+	int position;
+	char content;
+};
+
+union record r1;
+union record r2;
+union pirate p1;
+union pirate p2;
+
+BEGIN
+{
+	r1.position = 1;
+	r1.content = 'a';
+
+	r2.position = 2;
+	r2.content = 'b';
+
+	p1.position = 1;
+	p1.content = 'a';
+
+	p2.position = 2;
+	p2.content = 'b';
+
+	assoc_array[r1] = 1000;
+	assoc_array[r2] = 2000;
+	assoc_array[p1] = 3333;
+	assoc_array[p2] = 4444;
+
+	printf("assoc_array[r1]: %d\n",  assoc_array[r1]);
+	printf("assoc_array[r2]: %d\n",  assoc_array[r2]);
+	printf("assoc_array[p1]: %d\n",  assoc_array[p1]);
+	printf("assoc_array[p2]: %d\n",  assoc_array[p2]);
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionAssoc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionAssoc.d
new file mode 100644
index 0000000..882b6ae
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionAssoc.d
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * When a union is used as a key for an associative array, the key is formed
+ * by using the values of the members of the union variable and not the
+ * address of the union variable.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	int position;
+	char content;
+};
+
+union record r1;
+union record r2;
+
+BEGIN
+{
+	r1.position = 1;
+	r1.content = 'a';
+
+	r2.position = 1;
+	r2.content = 'a';
+
+	assoc_array[r1] = 1000;
+	assoc_array[r2] = 2000;
+
+	printf("assoc_array[r1]: %d\n",  assoc_array[r1]);
+	printf("assoc_array[r2]: %d\n",  assoc_array[r2]);
+
+	exit(0);
+}
+
+END
+/assoc_array[r1] != assoc_array[r2]/
+{
+	printf("Error");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionDataTypes.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionDataTypes.d
new file mode 100644
index 0000000..d5d292d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionDataTypes.d
@@ -0,0 +1,132 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Declaration of the different data types within a union and
+ * their definitions in a later clause should work fine.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ * NOTES: The floats, doubles and strings have not been implemented yet.
+ * When they do, appropriate lines in the code below should be uncommented.
+ * Similarly, the lines with the kmem_flags pointer assignment should be
+ * uncommented when the issues pertaining to it are clarified.
+ *
+ */
+
+#pragma D option quiet
+
+union record {
+	char new_char;
+	short new_short;
+	int new_int;
+	long new_long;
+	long long new_long_long;
+	int8_t new_int8;
+	int16_t new_int16;
+	int32_t new_int32;
+	int64_t new_int64;
+	intptr_t new_intptr;
+	uint8_t new_uint8;
+	uint16_t new_uint16;
+	uint32_t new_uint32;
+	uint64_t new_uint64;
+	uintptr_t new_uintptr;
+
+	/*float new_float;
+	double new_double;
+	long double new_long_double;
+
+	string new_string;
+	*/
+
+	struct {
+	     char ch;
+	     int in;
+	     long lg;
+	} new_struct;
+
+	union {
+	     char ch;
+	     int in;
+	     long lg;
+	} new_union;
+
+enum {
+	RED,
+	GREEN,
+	BLUE
+} new_enum;
+
+
+	int *pointer;
+} var;
+
+/*
+	var.pointer = &`kmem_flags;
+*/
+BEGIN
+{
+	var.new_char = 'c';
+	var.new_short = 10;
+	var.new_int = 100;
+	var.new_long = 1234567890;
+	var.new_long_long = 1234512345;
+	var.new_int8 = 'p';
+	var.new_int16 = 20;
+	var.new_int32 = 200;
+	var.new_int64 = 2000000;
+	var.new_intptr = 0x12345;
+	var.new_uint8 = 'q';
+	var.new_uint16 = 30;
+	var.new_uint32 = 300;
+	var.new_uint64 = 3000000;
+	var.new_uintptr = 0x67890;
+
+	/* var.new_float = 1.23456;
+	var.new_double = 2.34567890;
+	var.new_long_double = 3.567890123;
+
+	var.new_string = "hello";
+	*/
+
+	/*
+	var.pointer = &`kmem_flags;
+	*/
+
+	var.new_struct.ch = 'c';
+	var.new_struct.in = 4;
+	var.new_struct.lg = 4;
+
+	var.new_union.ch = 'd';
+	var.new_union.in = 5;
+	var.new_union.lg = 5;
+
+
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionInside.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionInside.d
new file mode 100644
index 0000000..9569002
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/union/tst.UnionInside.d
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ * Verify the nested behavior of unions.
+ *
+ * SECTION: Structs and Unions/Unions
+ *
+ */
+#pragma D option quiet
+
+union InnerMost {
+	int position;
+	char content;
+};
+
+union InnerMore {
+	union InnerMost IMost;
+	int dummy_More;
+};
+
+union Inner {
+	union InnerMore IMore;
+	int dummy_More;
+};
+
+union Outer {
+	union Inner I;
+	int dummy_More;
+};
+
+union OuterMore {
+	union Outer O;
+	int dummy_More;
+};
+
+union OuterMost {
+	union OuterMore OMore;
+	int dummy_More;
+} OMost;
+
+
+BEGIN
+{
+
+	OMost.OMore.O.I.IMore.IMost.position = 5;
+	OMost.OMore.O.I.IMore.IMost.content = 'e';
+
+	printf("OMost.OMore.O.I.IMore.IMost.content: %c\n",
+	       OMost.OMore.O.I.IMore.IMost.content);
+
+	exit(0);
+}
+
+END
+/'e' != OMost.OMore.O.I.IMore.IMost.content/
+{
+	exit(1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/argmap.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/argmap.d
new file mode 100644
index 0000000..0a1c360
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/argmap.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+provider test_prov {
+	probe place(int i, int j) : (int j, int i, int i, int j);
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/args.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/args.d
new file mode 100644
index 0000000..a11984c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/args.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+provider test_prov {
+	probe place(int i, int j);
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/forker.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/forker.d
new file mode 100644
index 0000000..f63b965
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/forker.d
@@ -0,0 +1,31 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+provider forker {
+	probe fire();
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh
new file mode 100644
index 0000000..2096422
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh
@@ -0,0 +1,46 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -c date -s /dev/stdin <<EOF
+plockstat\$target::mutex_lock_impl:,
+pid\$target::mutex_lock_impl:
+{}
+EOF
+
+if [ $? -ne 0 ]; then
+	print -u2 "dtrace failed"
+	exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.c
new file mode 100644
index 0000000..5697ef5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.c
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/sdt.h>
+
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		DTRACE_PROBE2(test_prov, place, 10, 4);
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.d
new file mode 100644
index 0000000..fd9f9f4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.d
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Verify that argN and args[N] variables are properly remapped.
+ */
+
+BEGIN
+{
+	/* Timeout after 5 seconds */
+	timeout = timestamp + 5000000000;
+}
+
+test_prov$1:::place
+/arg0 != 4 || arg1 != 10 || arg2 != 10 || arg3 != 4/
+{
+	printf("args are %d, %d, %d, %d; should be 4, 10, 10, 4",
+	    arg0, arg1, arg2, arg3);
+	exit(1);
+}
+
+test_prov$1:::place
+/args[0] != 4 || args[1] != 10 || args[2] != 10 || args[3] != 4/
+{
+	printf("args are %d, %d, %d, %d; should be 4, 10, 10, 4",
+	    args[0], args[1], args[2], args[3]);
+	exit(1);
+}
+
+test_prov$1:::place
+{
+	exit(0);
+}
+
+profile:::tick-1
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.c
new file mode 100644
index 0000000..5697ef5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.c
@@ -0,0 +1,39 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/sdt.h>
+
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		DTRACE_PROBE2(test_prov, place, 10, 4);
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.d
new file mode 100644
index 0000000..bb74e80
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * SECTION:
+ *
+ * NOTES:
+ *
+ */
+BEGIN
+{
+	/* Timeout after 5 seconds */
+	timeout = timestamp + 5000000000;
+}
+
+test_prov$1:::place
+/arg0 == 10 && arg1 == 4/
+{
+	exit(0);
+}
+
+test_prov$1:::place
+{
+	printf("args are %d, %d; should be 10, 4", arg0, arg1);
+	exit(1);
+}
+
+profile:::tick-1
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh
new file mode 100644
index 0000000..291fe83
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh
@@ -0,0 +1,84 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	if (TEST_PROV_GO_ENABLED()) {
+		TEST_PROV_GO();
+	}
+}
+EOF
+
+cc -xarch=generic64 -c -o test64.o test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c 64-bit"
+	exit 1
+fi
+cc -xarch=generic -c -o test32.o test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c 32-bit"
+	exit 1
+fi
+
+$dtrace -G -s prov.d test32.o test64.o
+if [ $? -eq 0 ]; then
+	print -u2 "DOF generation failed to generate a warning"
+	exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
new file mode 100755
index 0000000..68dbb03
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
@@ -0,0 +1,107 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# This test verifies that a program that corrupts its own environment
+# without inducing a crash does not crash solely due to drti.o's use of
+# getenv(3C).
+#
+
+PATH=/usr/bin:/usr/sbin:$PATH
+
+if (( $# != 1 )); then
+	print -u2 'expected one argument: <dtrace-path>'
+	exit 2
+fi
+
+#
+# jdtrace does not implement the -h option that is required to generate
+# C header files.
+#
+if [[ "$1" == */jdtrace ]]; then
+	exit 0
+fi
+
+dtrace="$1"
+startdir="$PWD"
+dir=$(mktemp -td drtiXXXXXX)
+if (( $? != 0 )); then
+	print -u2 'Could not create safe temporary directory'
+	exit 2
+fi
+
+cd "$dir"
+
+cat > Makefile <<EOF
+all: main
+
+main: main.o prov.o
+	\$(CC) -o main main.o prov.o
+
+main.o: main.c prov.h
+	\$(CC) -c main.c
+
+prov.h: prov.d
+	$dtrace -h -s prov.d
+
+prov.o: prov.d main.o
+	$dtrace -G -32 -s prov.d main.o
+EOF
+
+cat > prov.d <<EOF
+provider tester {
+	probe entry();
+};
+EOF
+
+cat > main.c <<EOF
+#include <stdlib.h>
+#include <sys/sdt.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv, char **envp)
+{
+	envp[0] = (char*)0xff;
+	TESTER_ENTRY();
+	return 0;
+}
+EOF
+
+make > /dev/null
+status=$?
+if (( $status != 0 )) ; then
+	print -u2 "failed to build"
+else
+	./main
+	status=$?
+fi
+
+cd "$startdir"
+rm -rf "$dir"
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh
new file mode 100755
index 0000000..0a66666
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh
@@ -0,0 +1,159 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test verifies that USDT providers are removed when its associated
+# load object is closed via dlclose(3dl).
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > Makefile <<EOF
+all: main livelib.so deadlib.so
+
+main: main.o prov.o
+	cc -o main main.o
+
+main.o: main.c
+	cc -c main.c
+
+
+livelib.so: livelib.o prov.o
+	cc -z defs -G -o livelib.so livelib.o prov.o -lc
+
+livelib.o: livelib.c prov.h
+	cc -c livelib.c
+
+prov.o: livelib.o prov.d
+	$dtrace -G -s prov.d livelib.o
+
+prov.h: prov.d
+	$dtrace -h -s prov.d
+
+
+deadlib.so: deadlib.o
+	cc -z defs -G -o deadlib.so deadlib.o -lc
+
+deadlib.o: deadlib.c
+	cc -c deadlib.c
+
+clean:
+	rm -f main.o livelib.o prov.o prov.h deadlib.o
+
+clobber: clean
+	rm -f main livelib.so deadlib.so
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+cat > livelib.c <<EOF
+#include "prov.h"
+
+void
+go(void)
+{
+	TEST_PROV_GO();
+}
+EOF
+
+cat > deadlib.c <<EOF
+void
+go(void)
+{
+}
+EOF
+
+
+cat > main.c <<EOF
+#include <dlfcn.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int
+main(int argc, char **argv)
+{
+	void *live;
+
+	if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
+		printf("dlopen of livelib.so failed: %s\n", dlerror());
+		return (1);
+	}
+
+	(void) dlclose(live);
+
+	pause();
+
+	return (0);
+}
+EOF
+
+/usr/ccs/bin/make > /dev/null
+if [ $? -ne 0 ]; then
+	print -u2 "failed to build"
+	exit 1
+fi
+
+script() {
+	$dtrace -w -x bufsize=1k -c ./main -qs /dev/stdin <<EOF
+	syscall::pause:entry
+	/pid == \$target/
+	{
+		system("$dtrace -l -P test_prov*");
+		system("kill %d", \$target);
+		exit(0);
+	}
+
+	tick-1s
+	/i++ == 5/
+	{
+		printf("failed\n");
+		exit(1);
+	}
+EOF
+}
+
+script 2>&1
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh.out
new file mode 100644
index 0000000..2f5bb15
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh.out
@@ -0,0 +1,3 @@
+dtrace: failed to match test_prov*:::: No probe matches description
+   ID   PROVIDER            MODULE                          FUNCTION NAME
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh
new file mode 100755
index 0000000..c83d8bf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh
@@ -0,0 +1,160 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > Makefile <<EOF
+all: main livelib.so deadlib.so
+
+main: main.o prov.o
+	cc -o main main.o
+
+main.o: main.c
+	cc -c main.c
+
+
+livelib.so: livelib.o prov.o
+	cc -z defs -G -o livelib.so livelib.o prov.o -lc
+
+livelib.o: livelib.c prov.h
+	cc -c livelib.c
+
+prov.o: livelib.o prov.d
+	$dtrace -G -s prov.d livelib.o
+
+prov.h: prov.d
+	$dtrace -h -s prov.d
+
+
+deadlib.so: deadlib.o
+	cc -z defs -G -o deadlib.so deadlib.o -lc
+
+deadlib.o: deadlib.c
+	cc -c deadlib.c
+
+clean:
+	rm -f main.o livelib.o prov.o prov.h deadlib.o
+
+clobber: clean
+	rm -f main livelib.so deadlib.so
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+cat > livelib.c <<EOF
+#include "prov.h"
+
+void
+go(void)
+{
+	TEST_PROV_GO();
+}
+EOF
+
+cat > deadlib.c <<EOF
+void
+go(void)
+{
+}
+EOF
+
+
+cat > main.c <<EOF
+#include <dlfcn.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int
+main(int argc, char **argv)
+{
+	void *live, *dead;
+	void *go;
+
+	if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
+		printf("dlopen of livelib.so failed: %s\n", dlerror());
+		return (1);
+	}
+
+	(void) dlclose(live);
+
+	if ((dead = dlopen("./deadlib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
+		printf("dlopen of deadlib.so failed: %s\n", dlerror());
+		return (1);
+	}
+
+	if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
+		printf("dlopen of livelib.so failed: %s\n", dlerror());
+		return (1);
+	}
+
+	if ((go = dlsym(live, "go")) == NULL) {
+		printf("failed to lookup 'go' in livelib.so\n");
+		return (1);
+	}
+
+	((void (*)(void))go)();
+
+	return (0);
+}
+EOF
+
+/usr/ccs/bin/make > /dev/null
+if [ $? -ne 0 ]; then
+	print -u2 "failed to build"
+	exit 1
+fi
+
+script() {
+	$dtrace -w -c ./main -Zqs /dev/stdin <<EOF
+	test_prov*:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh.out
new file mode 100644
index 0000000..2164eab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh.out
@@ -0,0 +1,2 @@
+livelib.so:go:go
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh
new file mode 100755
index 0000000..72f24ce
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh
@@ -0,0 +1,170 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test verifies that performing a dlclose(3dl) on a library doesn't
+# cause existing pid provider probes to become invalid.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > Makefile <<EOF
+all: main livelib.so deadlib.so
+
+main: main.o prov.o
+	cc -o main main.o
+
+main.o: main.c
+	cc -c main.c
+
+
+livelib.so: livelib.o prov.o
+	cc -z defs -G -o livelib.so livelib.o prov.o -lc
+
+livelib.o: livelib.c prov.h
+	cc -c livelib.c
+
+prov.o: livelib.o prov.d
+	$dtrace -G -s prov.d livelib.o
+
+prov.h: prov.d
+	$dtrace -h -s prov.d
+
+
+deadlib.so: deadlib.o
+	cc -z defs -G -o deadlib.so deadlib.o -lc
+
+deadlib.o: deadlib.c
+	cc -c deadlib.c
+
+clean:
+	rm -f main.o livelib.o prov.o prov.h deadlib.o
+
+clobber: clean
+	rm -f main livelib.so deadlib.so
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+cat > livelib.c <<EOF
+#include "prov.h"
+
+void
+go(void)
+{
+	TEST_PROV_GO();
+}
+EOF
+
+cat > deadlib.c <<EOF
+void
+go(void)
+{
+}
+EOF
+
+
+cat > main.c <<EOF
+#include <dlfcn.h>
+#include <unistd.h>
+#include <stdio.h>
+
+static void
+foo(void)
+{
+	(void) close(-1);
+}
+
+int
+main(int argc, char **argv)
+{
+	void *live;
+
+	if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
+		printf("dlopen of livelib.so failed: %s\n", dlerror());
+		return (1);
+	}
+
+	(void) dlclose(live);
+
+	foo();
+
+	return (0);
+}
+EOF
+
+/usr/ccs/bin/make > /dev/null
+if [ $? -ne 0 ]; then
+	print -u2 "failed to build"
+	exit 1
+fi
+
+script() {
+	$dtrace -c ./main -s /dev/stdin <<EOF
+	pid\$target:a.out:foo:entry
+	{
+		gotit = 1;
+		exit(0);
+	}
+
+	tick-1s
+	/i++ == 5/
+	{
+		printf("test timed out");
+		exit(1);
+	}
+
+	END
+	/!gotit/
+	{
+		printf("program ended without hitting probe");
+		exit(1);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh
new file mode 100644
index 0000000..687e435
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh
@@ -0,0 +1,106 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# Make sure temporary symbols generated due to DTrace probes in static
+# functions are removed in the final link step.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+static void
+foo(void)
+{
+	TEST_PROV_GO();
+}
+
+int
+main(int argc, char **argv)
+{
+	foo();
+
+	return (0);
+}
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+nm test.o | grep \$dtrace > /dev/null
+if [ $? -ne 0 ]; then
+	print -u2 "no temporary symbols in the object file"
+	exit 1
+fi
+
+nm test | grep \$dtrace > /dev/null
+if [ $? -eq 0 ]; then
+	print -u2 "failed to eliminate temporary symbols"
+	exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh
new file mode 100644
index 0000000..ba62be7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh
@@ -0,0 +1,96 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	if (TEST_PROV_GO_ENABLED()) {
+		TEST_PROV_GO();
+	}
+}
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script()
+{
+	$dtrace -c ./test -qs /dev/stdin <<EOF
+	test_prov\$target:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh.out
new file mode 100644
index 0000000..b856cc5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh.out
@@ -0,0 +1,2 @@
+test:main:go
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
new file mode 100644
index 0000000..3401648
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
@@ -0,0 +1,113 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test is primarily intended to verify a fix for SPARC, but there's no
+# harm in running it on other platforms. Here, we verify that is-enabled
+# probes don't interfere with return values from previously invoked functions.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <stdio.h>
+#include "prov.h"
+
+int
+foo(void)
+{
+	return (24);
+}
+
+int
+main(int argc, char **argv)
+{
+	int a = foo();
+	if (TEST_PROV_GO_ENABLED()) {
+		TEST_PROV_GO();
+	}
+	(void) printf("%d %d %d\n", a, a, a);
+
+	return (0);
+}
+EOF
+
+cc -c -xO2 test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script()
+{
+	./test
+
+	$dtrace -c ./test -qs /dev/stdin <<EOF
+	test_prov\$target:::
+	{
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh.out
new file mode 100644
index 0000000..563d68f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh.out
@@ -0,0 +1,3 @@
+24 24 24
+24 24 24
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh
new file mode 100644
index 0000000..9d2646c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh
@@ -0,0 +1,118 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.c <<EOF
+#include <sys/sdt.h>
+
+int
+main(int argc, char **argv)
+{
+	DTRACE_PROBE(test_prov, entry);
+	DTRACE_PROBE(test_prov, __entry);
+	DTRACE_PROBE(test_prov, foo__entry);
+	DTRACE_PROBE(test_prov, carpentry);
+	DTRACE_PROBE(test_prov, miniatureturn);
+	DTRACE_PROBE(test_prov, foo__return);
+	DTRACE_PROBE(test_prov, __return);
+	/*
+	 * Unfortunately, a "return" probe is not currently possible due to
+	 * the conflict with a reserved word.
+	 */
+	DTRACE_PROBE(test_prov, done);
+}
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe entry();
+	probe __entry();
+	probe foo__entry();
+	probe carpentry();
+	probe miniatureturn();
+	probe foo__return();
+	probe __return();
+	probe done();
+};
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script()
+{
+	$dtrace -wqZFs /dev/stdin <<EOF
+	BEGIN
+	{
+		system("$DIR/test");
+		printf("\n");
+	}
+
+	test_prov*:::done
+	/progenyof(\$pid)/
+	{
+		exit(0);
+	}
+
+	test_prov*:::
+	/progenyof(\$pid)/
+	{
+		printf("\n");
+	}
+EOF
+}
+
+script | cut -c5-
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh.out
new file mode 100644
index 0000000..3bf2890
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh.out
@@ -0,0 +1,10 @@
+FUNCTION                                 
+| :BEGIN                                  
+ -> main                                  
+   -> main                                
+     -> main                              
+      | main:carpentry                    
+      | main:miniatureturn                
+     <- main                              
+   <- main                                
+  | main:done                             
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh
new file mode 100755
index 0000000..9c12e6d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh
@@ -0,0 +1,105 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	TEST_PROV_GO();
+	if (fork() == 0) {
+		TEST_PROV_GO();
+		return (0);
+	}
+
+	(void) wait(NULL);
+	TEST_PROV_GO();
+
+	return (0);
+}
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script() {
+	$dtrace -c ./test -Zqs /dev/stdin <<EOF
+	test_prov*:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh.out
new file mode 100644
index 0000000..c656c33
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh.out
@@ -0,0 +1,4 @@
+test:main:go
+test:main:go
+test:main:go
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.c
new file mode 100644
index 0000000..ade7f83
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.c
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+
+#include "forker.h"
+
+int
+main(int argc, char **argv)
+{
+	int i;
+
+	for (i = 0; i < 10000; i++) {
+		FORKER_FIRE();
+		if (fork() == 0)
+			exit(0);
+
+		(void) wait(NULL);
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.ksh
new file mode 100755
index 0000000..d35fc4d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.ksh
@@ -0,0 +1,55 @@
+#!/usr/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+#
+# Test that we don't deadlock between forking and enabling/disabling USDT
+# probes. This test has succeeded if it completes at all.
+#
+
+./tst.forker.exe &
+id=$!
+
+while kill -0 $id >/dev/null 2>&1; do
+	$dtrace -p $id -s /dev/stdin <<-EOF
+		forker*:::fire
+		/i++ == 4/
+		{
+			exit(0);
+		}
+	EOF
+done
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh
new file mode 100644
index 0000000..68a8d01
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh
@@ -0,0 +1,96 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	if (TEST_PROV_GO_ENABLED()) {
+		TEST_PROV_GO();
+	}
+}
+EOF
+
+cc -xarch=generic -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -xarch=generic -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script()
+{
+	$dtrace -c ./test -qs /dev/stdin <<EOF
+	test_prov\$target:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh
new file mode 100644
index 0000000..39de8e0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh
@@ -0,0 +1,100 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	if (TEST_PROV_GO_ENABLED()) {
+		TEST_PROV_GO();
+	}
+}
+EOF
+
+cc -xarch=generic64 -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -xarch=generic64 -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script()
+{
+	$dtrace -c ./test -qs /dev/stdin <<EOF
+	test_prov\$target:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+if [ `isainfo -b` -ne '64']; then
+	script
+	status=$?
+else
+	status=0
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.header.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.header.ksh
new file mode 100644
index 0000000..08a1912
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.header.ksh
@@ -0,0 +1,85 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe zero();
+	probe one(uintptr_t);
+	probe u_nder(char *);
+	probe d__ash(int **);
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	TEST_PROV_ZERO();
+	TEST_PROV_ONE(1);
+	TEST_PROV_U_NDER("hi there");
+	TEST_PROV_D_ASH(argv);
+}
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.include.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
new file mode 100644
index 0000000..5683f47
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.include.ksh
@@ -0,0 +1,61 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+# Make sure <unistd.h> defines _DTRACE_VERSION
+
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.c <<EOF
+#include <unistd.h>
+
+int
+main(int argc, char **argv)
+{
+#ifdef _DTRACE_VERSION
+	return (0);
+#else
+	return (1);
+#endif
+}
+EOF
+
+cc -xarch=generic -o test test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+
+./test
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh
new file mode 100644
index 0000000..ec07e05
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh
@@ -0,0 +1,82 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.c <<EOF
+#include <sys/sdt.h>
+
+int
+main(int argc, char **argv)
+{
+	DTRACE_PROBE(test_prov, zero);
+	DTRACE_PROBE1(test_prov, one, 1);
+	DTRACE_PROBE2(test_prov, two, 2, 3);
+	DTRACE_PROBE3(test_prov, three, 4, 5, 7);
+	DTRACE_PROBE4(test_prov, four, 7, 8, 9, 10);
+	DTRACE_PROBE5(test_prov, five, 11, 12, 13, 14, 15);
+}
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe zero();
+	probe one(uintptr_t);
+	probe two(uintptr_t, uintptr_t);
+	probe three(uintptr_t, uintptr_t, uintptr_t);
+	probe four(uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+	probe five(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+};
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh
new file mode 100644
index 0000000..01b2126
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh
@@ -0,0 +1,84 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+ppriv -s A=basic $$
+
+cat > test.c <<EOF
+#include <sys/sdt.h>
+
+int
+main(int argc, char **argv)
+{
+	DTRACE_PROBE(test_prov, zero);
+	DTRACE_PROBE1(test_prov, one, 1);
+	DTRACE_PROBE2(test_prov, two, 2, 3);
+	DTRACE_PROBE3(test_prov, three, 4, 5, 7);
+	DTRACE_PROBE4(test_prov, four, 7, 8, 9, 10);
+	DTRACE_PROBE5(test_prov, five, 11, 12, 13, 14, 15);
+}
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe zero();
+	probe one(uintptr_t);
+	probe two(uintptr_t, uintptr_t);
+	probe three(uintptr_t, uintptr_t, uintptr_t);
+	probe four(uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+	probe five(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t);
+};
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh
new file mode 100755
index 0000000..0c8b072
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh
@@ -0,0 +1,99 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	TEST_PROV_GO();
+	TEST_PROV_GO();
+	TEST_PROV_GO();
+	TEST_PROV_GO();
+
+	return (0);
+}
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script() {
+	$dtrace -c ./test -qs /dev/stdin <<EOF
+	test_prov\$target:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh.out
new file mode 100644
index 0000000..5e82619
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh.out
@@ -0,0 +1,5 @@
+test:main:go
+test:main:go
+test:main:go
+test:main:go
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh
new file mode 100644
index 0000000..a911bcd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh
@@ -0,0 +1,90 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+# Fake up a scenario where _DTRACE_VERSION is not defined by having our own
+# <unistd.h>. This tests that dtrace -h will produce a header file which can
+# be used on a system where DTrace is not present.
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+touch unistd.h
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	TEST_PROV_GO();
+
+	if (TEST_PROV_GO_ENABLED()) {
+		TEST_PROV_GO();
+	}
+
+	return (0);
+}
+EOF
+
+cc -I. -xarch=generic -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+cc -xarch=generic -o test test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+./test
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh
new file mode 100644
index 0000000..989d6d3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh
@@ -0,0 +1,82 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	if (TEST_PROV_GO_ENABLED())
+		return (2);
+
+	return (0);
+}
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh
new file mode 100644
index 0000000..7fad401
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh
@@ -0,0 +1,98 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.c <<EOF
+#include <sys/sdt.h>
+
+int
+main(int argc, char **argv)
+{
+	DTRACE_PROBE(test_prov, zero);
+}
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe zero();
+};
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script()
+{
+	$dtrace -wZs /dev/stdin <<EOF
+	BEGIN
+	{
+		system("$DIR/test");
+	}
+
+	test_prov*:::
+	{
+		seen = 1;
+	}
+
+	proc:::exit
+	/progenyof(\$pid) && execname == "test"/
+	{
+		exit(seen ? 0 : 2);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static.ksh
new file mode 100644
index 0000000..1ebcdb9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static.ksh
@@ -0,0 +1,98 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.c <<EOF
+#include <unistd.h>
+#include <sys/sdt.h>
+
+static void
+foo(void)
+{
+	DTRACE_PROBE(test_prov, probe1);
+	DTRACE_PROBE(test_prov, probe2);
+}
+
+int
+main(int argc, char **argv)
+{
+	DTRACE_PROBE(test_prov, probe1);
+	DTRACE_PROBE(test_prov, probe2);
+	foo();
+}
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe probe1();
+	probe probe2();
+};
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script()
+{
+	$dtrace -c ./test -qs /dev/stdin <<EOF
+	test_prov\$target:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static.ksh.out
new file mode 100644
index 0000000..a559d97
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static.ksh.out
@@ -0,0 +1,5 @@
+test:main:probe1
+test:main:probe2
+test:foo:probe1
+test:foo:probe2
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh
new file mode 100644
index 0000000..7cf9004
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh
@@ -0,0 +1,108 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+# Rebuilding an object file containing DOF changes slightly when the object
+# files containing the probes have already been modified. This tests that
+# case by generating the DOF object, removing it, and building it again.
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.c <<EOF
+#include <unistd.h>
+#include <sys/sdt.h>
+
+static void
+foo(void)
+{
+	DTRACE_PROBE(test_prov, probe1);
+	DTRACE_PROBE(test_prov, probe2);
+}
+
+int
+main(int argc, char **argv)
+{
+	DTRACE_PROBE(test_prov, probe1);
+	DTRACE_PROBE(test_prov, probe2);
+	foo();
+}
+EOF
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe probe1();
+	probe probe2();
+};
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create initial DOF"
+	exit 1
+fi
+rm -f prov.o
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create final DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script()
+{
+	$dtrace -c ./test -qs /dev/stdin <<EOF
+	test_prov\$target:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh.out
new file mode 100644
index 0000000..a559d97
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh.out
@@ -0,0 +1,5 @@
+test:main:probe1
+test:main:probe2
+test:foo:probe1
+test:foo:probe2
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.user.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.user.ksh
new file mode 100755
index 0000000..d5d9fdc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.user.ksh
@@ -0,0 +1,96 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > prov.d <<EOF
+provider test_prov {
+	probe go();
+};
+EOF
+
+$dtrace -h -s prov.d
+if [ $? -ne 0 ]; then
+	print -u2 "failed to generate header file"
+	exit 1
+fi
+
+cat > test.c <<EOF
+#include <sys/types.h>
+#include "prov.h"
+
+int
+main(int argc, char **argv)
+{
+	TEST_PROV_GO();
+
+	return (0);
+}
+EOF
+
+cc -c test.c
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.c"
+	exit 1
+fi
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+script() {
+	$dtrace -c 'ppriv -e -s A=basic ./test' -Zqs /dev/stdin <<EOF
+	test_prov\$target:::
+	{
+		printf("%s:%s:%s\n", probemod, probefunc, probename);
+	}
+EOF
+}
+
+script
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.user.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.user.ksh.out
new file mode 100644
index 0000000..b856cc5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.user.ksh.out
@@ -0,0 +1,2 @@
+test:main:go
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.c
new file mode 100644
index 0000000..edd3dd1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.c
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+void grow1(int);
+
+void
+grow(int frame)
+{
+	/*
+	 * Create a ridiculously large stack - enough to push us over
+	 * the default setting of 'dtrace_ustackdepth_max' (2048).
+	 */
+	if (frame >= 2048)
+		for (;;)
+			getpid();
+
+	grow1(++frame);
+}
+
+void
+grow1(int frame)
+{
+	grow(++frame);
+}
+
+int
+main(int argc, char *argv[])
+{
+	grow(1);
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.d
new file mode 100644
index 0000000..66fda5b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.d
@@ -0,0 +1,45 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+syscall::getpid:entry
+/pid == $1/
+{
+	@[ustackdepth] = count();
+}
+
+ERROR
+/arg4 == DTRACEFLT_BADSTACK/
+{
+	exit(0);
+}
+
+profile:::tick-1s
+/++n  == 10/
+{
+	exit(1)
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.depth.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.depth.ksh
new file mode 100644
index 0000000..26cff42
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.depth.ksh
@@ -0,0 +1,110 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+file=out.$$
+dtrace=$1
+
+rm -f $file
+
+$dtrace -o $file -c date -s /dev/stdin <<EOF
+
+	#pragma D option quiet
+	#pragma D option bufsize=1M
+	#pragma D option bufpolicy=fill
+
+	pid\$target:::entry,
+	pid\$target:::return,
+	pid\$target:a.out::,
+	syscall:::return,
+	profile:::profile-997
+	/pid == \$target/
+	{
+        	printf("START %s:%s:%s:%s\n",
+            	probeprov, probemod, probefunc, probename);
+        	trace(ustackdepth);
+        	ustack(100);
+        	trace("END\n");
+	}
+
+	tick-1sec
+	/n++ == 10/
+	{
+		trace("test timed out...");
+		exit(1);
+	}
+EOF
+
+status=$?
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+	exit $status
+fi
+
+perl /dev/stdin $file <<EOF
+	while (<>) {
+		chomp;
+
+		last if /^\$/;
+
+		die "expected START at \$.\n" unless /^START/;
+
+		\$_ = <>;
+		chomp;
+		die "expected depth (\$_) at \$.\n" unless /^(\d+)\$/;
+		\$depth = \$1;
+
+		for (\$i = 0; \$i < \$depth; \$i++) {
+			\$_ = <>;
+			chomp;
+			die "unexpected END at \$.\n" if /^END/;
+		}
+
+		\$_ = <>;
+		chomp;
+		die "expected END at \$.\n" unless /^END\$/;
+	}
+EOF
+
+status=$?
+
+count=`wc -l $file | cut -f1 -do`
+if [ "$count" -lt 1000 ]; then
+	echo $tst: output was too short
+	status=1
+fi
+
+
+if [ "$status" -eq 0 ]; then
+	rm -f $file
+fi
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.c
new file mode 100644
index 0000000..bdeb16d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.c
@@ -0,0 +1,61 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <unistd.h>
+
+volatile long long count = 0;
+
+int
+baz(int a)
+{
+	(void) getpid();
+	while (count != -1) {
+		count++;
+		a++;
+	}
+
+	return (a + 1);
+}
+
+int
+bar(int a)
+{
+	return (baz(a + 1) - 1);
+}
+
+int
+foo(int a, int b)
+{
+	return (bar(a) - b);
+}
+
+int
+main(int argc, char **argv)
+{
+	return (foo(argc, (int)argv) == 0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.ksh
new file mode 100644
index 0000000..1a7e0e1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.ksh
@@ -0,0 +1,139 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+file=out.$$
+dtrace=$1
+
+rm -f $file
+
+dir=`dirname $tst`
+
+$dtrace -o $file -c $dir/tst.spin.exe -s /dev/stdin <<EOF
+
+	#pragma D option quiet
+	#pragma D option destructive
+	#pragma D option evaltime=main
+
+	/*
+	 * Toss out the first 100 samples to wait for the program to enter
+	 * its steady state.
+	 */
+
+	profile-1999
+	/pid == \$target && n++ > 100/
+	{
+		@total = count();
+		@stacks[ustack(4)] = count();
+	}
+
+	tick-1s
+	{
+		secs++;
+	}
+
+	tick-1s
+	/secs > 5/
+	{
+		done = 1;
+	}
+
+	tick-1s
+	/secs > 10/
+	{
+		trace("test timed out");
+		exit(1);
+	}
+
+	profile-1999
+	/pid == \$target && done/
+	{
+		raise(SIGINT);
+		exit(0);
+	}
+
+	END
+	{
+		printa("TOTAL %@u\n", @total);
+		printa("START%kEND\n", @stacks);
+	}
+EOF
+
+status=$?
+if [ "$status" -ne 0 ]; then
+	echo $tst: dtrace failed
+	exit $status
+fi
+
+perl /dev/stdin $file <<EOF
+	\$_ = <>;
+	chomp;
+	die "output problem\n" unless /^TOTAL (\d+)/;
+	\$count = \$1;
+	die "too few samples (\$count)\n" unless \$count >= 1000;
+
+	while (<>) {
+		chomp;
+
+		last if /^$/;
+
+		die "expected START at \$.\n" unless /^START/;
+
+
+		\$_ = <>;
+		chomp;
+		die "expected END at \$.\n" unless /\`baz\+/;
+
+		\$_ = <>;
+		chomp;
+		die "expected END at \$.\n" unless /\`bar\+/;
+
+		\$_ = <>;
+		chomp;
+		die "expected END at \$.\n" unless /\`foo\+/;
+
+		\$_ = <>;
+		chomp;
+		die "expected END at \$.\n" unless /\`main\+/;
+
+		\$_ = <>;
+		chomp;
+		die "expected END at \$.\n" unless /^END\$/;
+	}
+
+EOF
+
+status=$?
+if [ "$status" -eq 0 ]; then
+	rm -f $file
+fi
+
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.gid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.gid.d
new file mode 100644
index 0000000..23fcf38
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.gid.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+/curpsinfo->pr_gid == gid/
+{
+	exit(0);
+}
+
+BEGIN
+{
+	printf("%d != %d\n", curpsinfo->pr_gid, gid);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.nullassign.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.nullassign.d
new file mode 100644
index 0000000..accc763
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.nullassign.d
@@ -0,0 +1,94 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+{
+	die = "Die";
+	tap = ", SystemTap, ";
+	the = "The";
+}
+
+BEGIN
+{
+	phrase = strjoin(die, tap);
+	phrase = strjoin(phrase, die);
+	expected = "Die, SystemTap, Die";
+}
+
+BEGIN
+/phrase != expected/
+{
+	printf("global: expected '%s', found '%s'\n", expected, phrase);
+	exit(1);
+}
+
+BEGIN
+{
+	this->phrase = strjoin(the, tap);
+}
+
+BEGIN
+{
+	this->phrase = strjoin(this->phrase, the);
+	expected = "The, SystemTap, The";
+}
+
+BEGIN
+/this->phrase != expected/
+{
+	printf("clause-local: expected '%s', found '%s'\n",
+	    expected, this->phrase);
+	exit(2);
+}
+
+BEGIN
+{
+	phrase = NULL;
+	this->phrase = NULL;
+}
+
+BEGIN
+/phrase != NULL/
+{
+	printf("expected global to be NULL\n");
+	exit(3);
+}
+
+BEGIN
+/this->phrase != NULL/
+{
+	printf("expected clause-local to be NULL\n");
+	exit(4);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ppid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ppid.d
new file mode 100644
index 0000000..5f0da5f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ppid.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+/curpsinfo->pr_ppid == ppid/
+{
+	exit(0);
+}
+
+BEGIN
+{
+	printf("%d != %d\n", curpsinfo->pr_ppid, ppid);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh
new file mode 100644
index 0000000..8427ea0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh
@@ -0,0 +1,65 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This test is a bit naughty; it's assuming that ld.so.1 has an implementation
+# of calloc(3C), and that it's implemented in terms of the ld.so.1
+# implementation of malloc(3C).  If you're reading this comment because
+# those assumptions have become false, please accept my apologies...
+#
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -qs /dev/stdin -c "/usr/bin/echo" <<EOF
+pid\$target:ld.so.1:calloc:entry
+{
+	self->calloc = 1;
+}
+
+pid\$target:ld.so.1:malloc:entry
+/self->calloc/
+{
+	@[umod(ucaller), ufunc(ucaller)] = count();
+}
+
+pid\$target:ld.so.1:calloc:return
+/self->calloc/
+{
+	self->calloc = 0;
+}
+
+END
+{
+	printa("%A %A\n", @);
+}
+EOF
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh.out
new file mode 100644
index 0000000..86c72a4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.ucaller.ksh.out
@@ -0,0 +1,3 @@
+
+ld.so.1 ld.so.1`calloc
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.uid.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.uid.d
new file mode 100644
index 0000000..bf1c9dc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.uid.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+BEGIN
+/curpsinfo->pr_uid == uid/
+{
+	exit(0);
+}
+
+BEGIN
+{
+	printf("%d != %d\n", curpsinfo->pr_uid, uid);
+	exit(1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.walltimestamp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.walltimestamp.d
new file mode 100644
index 0000000..e17bb94
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/vars/tst.walltimestamp.d
@@ -0,0 +1,55 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+uint64_t now;
+
+BEGIN
+{
+	now = 18252813184; /* Jan 1, 2004 00:00:00 */
+}
+
+BEGIN
+/walltimestamp < timestamp/
+{
+	printf("%d < %d", walltimestamp, timestamp);
+	exit(1);
+}
+
+BEGIN
+/walltimestamp < now/
+{
+	printf("%d (%Y) is before %Y", walltimestamp, walltimestamp, now);
+	exit(2);
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/version/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/version/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/version/tst.1.0.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/version/tst.1.0.d
new file mode 100644
index 0000000..0ab2af7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/version/tst.1.0.d
@@ -0,0 +1,48 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option version=1.0
+
+/*
+ * The following identifiers were added as D built-ins as of version 1.1.
+ * Using these identifiers as user-specified variables should be illegal in
+ * that and any later versions, but legal in earlier versions.
+ */
+int strstr;
+int strchr;
+int strrchr;
+int strtok;
+int substr;
+int index;
+int freopen;
+
+BEGIN
+{
+	exit(0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/Makefile
new file mode 100644
index 0000000..05e9a03
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/Makefile
@@ -0,0 +1,51 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.com
+
+ASFLAGS += -P -D_ASM $(CPPFLAGS)
+CLOBBER_FILES += helper_helper.o annotated_helper.o
+
+# For the helper test we require an executable data section.
+ustack/tst.helper.exe := MAPFILE.NED=  
+
+ustack/tst.helper.exe: ustack/tst.helper.o ustack/helper_helper.o
+	$(LINK.c) -o ustack/tst.helper.exe \
+		 ustack/tst.helper.o ustack/helper_helper.o $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+ustack/helper_helper.o: ustack/helper_helper.d
+	$(COMPILE.d) -o ustack/helper_helper.o -s ustack/helper_helper.d
+
+ustack/tst.annotated.exe: ustack/tst.annotated.o ustack/annotated_helper.o
+	$(LINK.c) -o ustack/tst.annotated.exe  \
+		 ustack/tst.annotated.o ustack/annotated_helper.o $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+ustack/annotated_helper.o: ustack/annotated_helper.d
+	$(COMPILE.d) -o ustack/annotated_helper.o -s ustack/annotated_helper.d
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/arrays/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/arrays/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/arrays/tst.uregsarray.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/arrays/tst.uregsarray.d
new file mode 100644
index 0000000..5543c0a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/arrays/tst.uregsarray.d
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	Positive test to make sure that we can invoke x86
+ *	ureg[] aliases.
+ *
+ * SECTION: User Process Tracing/uregs Array
+ *
+ * NOTES: This test does no verification - the value of the output
+ *	is not deterministic.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("R_GS = 0x%x\n", uregs[R_GS]);
+	printf("R_ES = 0x%x\n", uregs[R_ES]);
+	printf("R_DS = 0x%x\n", uregs[R_DS]);
+	printf("R_EDI = 0x%x\n", uregs[R_EDI]);
+	printf("R_ESI = 0x%x\n", uregs[R_ESI]);
+	printf("R_EBP = 0x%x\n", uregs[R_EBP]);
+	printf("R_EBX = 0x%x\n", uregs[R_EBX]);
+	printf("R_EDX = 0x%x\n", uregs[R_EDX]);
+	printf("R_ECX = 0x%x\n", uregs[R_ECX]);
+	printf("R_EAX = 0x%x\n", uregs[R_EAX]);
+	printf("R_TRAPNO = 0x%x\n", uregs[R_TRAPNO]);
+	printf("R_ERR = 0x%x\n", uregs[R_ERR]);
+	printf("R_EIP = 0x%x\n", uregs[R_EIP]);
+	printf("R_CS = 0x%x\n", uregs[R_CS]);
+	printf("R_EFL = 0x%x\n", uregs[R_EFL]);
+	printf("R_UESP = 0x%x\n", uregs[R_UESP]);
+	printf("R_SS = 0x%x\n", uregs[R_SS]);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d
new file mode 100644
index 0000000..f14c8af
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyin.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ *	On IA/32, there is a single 32-bit address space that is partitioned
+ *	between user-level and kernel-level.  copyin()/copyinstr() and
+ *	copyout()/copyoutstr() must check that addresses specified as
+ *	user-level addresses are actually at user-level.  This test attempts
+ *	to perform an illegal copyin() from a kernel address.  It asserts that
+ *	the fault type is DTRACEFLT_BADADDR and that the bad address is set to
+ *	the kernel address from which the copyin() was attempted.
+ *
+ * SECTION: Actions and Subroutines/copyin();
+ * 	Actions and Subroutines/copyin();
+ *	User Process Tracing/copyin() and copyinstr()
+ */
+
+BEGIN
+{
+	dtrace_zero = copyin((uintptr_t)&`dtrace_zero, sizeof (int));
+	exit(1);
+}
+
+ERROR
+{
+	exit(arg4 == DTRACEFLT_BADADDR &&
+	    arg5 == (uint64_t)&`dtrace_zero ? 0 : 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyinstr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyinstr.d
new file mode 100644
index 0000000..ac04993
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyinstr.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	On IA/32, there is a single 32-bit address space that is partitioned
+ *	between user-level and kernel-level.  copyin()/copyinstr() and
+ *	copyout()/copyoutstr() must check that addresses specified as
+ *	user-level addresses are actually at user-level.  This test attempts
+ *	to perform an illegal copyinstr() from a kernel address.  It asserts
+ *	that the fault type is DTRACEFLT_BADADDR and that the bad address is
+ *	set to the kernel address from which the copyinstr() was attempted.
+ *
+ * SECTION: Actions and Subroutines/copyinstr();
+ *	User Process Tracing/copyin() and copyinstr()
+ */
+
+BEGIN
+{
+	os = copyinstr((uintptr_t)&`utsname);
+	exit(1);
+}
+
+ERROR
+{
+	exit(arg4 == DTRACEFLT_BADADDR && arg5 == (uint64_t)&`utsname ? 0 : 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyout.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyout.d
new file mode 100644
index 0000000..8909cd3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyout.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	On IA/32, there is a single 32-bit address space that is partitioned
+ *	between user-level and kernel-level.  copyin()/copyinstr() and
+ *	copyout()/copyoutstr() must check that addresses specified as
+ *	user-level addresses are actually at user-level.  This test attempts
+ *	to perform an illegal copyout() to a kernel address.  It asserts that
+ *	the fault type is DTRACEFLT_BADADDR and that the bad address is set to
+ *	the kernel address to which the copyout() was attempted.
+ *
+ * SECTION: Actions and Subroutines/copyout()
+ *
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	this->a = (uint32_t *)alloca(4);
+	*this->a = -1;
+	copyout(this->a, (uintptr_t)&`clock, 4);
+	exit(1);
+}
+
+ERROR
+{
+	exit(arg4 == DTRACEFLT_BADADDR && arg5 == (uint64_t)&`clock ? 0 : 1);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyoutstr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyoutstr.d
new file mode 100644
index 0000000..d7166cd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/funcs/tst.badcopyoutstr.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *	On IA/32, there is a single 32-bit address space that is partitioned
+ *	between user-level and kernel-level.  copyin()/copyinstr() and
+ *	copyout()/copyoutstr() must check that addresses specified as
+ *	user-level addresses are actually at user-level.  This test attempts
+ *	to perform an illegal copyoutstr() to a kernel address.  It asserts
+ *	that the fault type is DTRACEFLT_BADADDR and that the bad address is
+ *	set to the kernel address to which the copyoutstr() was attempted.
+ *
+ * SECTION: Actions and Subroutines/copyoutstr()
+ *
+ */
+
+#pragma D option destructive
+
+BEGIN
+{
+	this->str = alloca(10);
+	bcopy("kablammo!", this->str, 10);
+	copyoutstr(this->str, (uintptr_t)&`clock, 10);
+	exit(1);
+}
+
+ERROR
+{
+	exit(arg4 == DTRACEFLT_BADADDR && arg5 == (uint64_t)&`clock ? 0 : 1);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.badinstr.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.badinstr.d
new file mode 100644
index 0000000..50753b8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.badinstr.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Make sure that DTrace doesn't explode on an invalid instruction.
+ */
+
+pid$1:a.out:badfunc:entry
+{
+}
+
+BEGIN
+{
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.badinstr.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.badinstr.s
new file mode 100644
index 0000000..27f7f99
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.badinstr.s
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.long 0
+
+	ENTRY(badfunc)
+	.byte	0xff
+	.byte	0xff
+	SET_SIZE(badfunc)
+
+	ENTRY(main)
+1:	jmp 1b
+	SET_SIZE(main)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.branch.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.branch.d
new file mode 100644
index 0000000..cfcf0a7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.branch.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * SECTION:
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option destructive
+
+pid$1:a.out:waiting:entry
+{
+	this->a = (char *)alloca(1);
+	*this->a = 1;
+	copyout(this->a, arg0, 1);
+}
+
+pid$1:a.out:main:,
+pid$1:a.out:other:
+{
+}
+
+pid$1:a.out:bad:entry
+{
+	exit(1);
+}
+
+syscall::rexit:entry
+/pid == $1/
+{
+	exit(0);
+}
+
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.branch.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.branch.s
new file mode 100644
index 0000000..82a5892
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.branch.s
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.long 0
+
+	ENTRY(waiting)
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	8(%ebp), %eax
+	movl	(%eax), %eax
+	popl	%ebp
+	ret
+	SET_SIZE(waiting)
+
+	ENTRY(main)
+	pushl	%ebp
+	movl	%esp, %ebp
+	subl	$0x4, %esp
+	movl	$0x0, -4(%ebp)
+
+1:
+	leal	-4(%ebp), %eax
+	pushl	%eax
+	call	waiting
+	addl	$0x4, %esp
+
+	testl	%eax, %eax
+	jz	1b
+
+	addl	$0x4, %esp
+
+	xorl	%eax, %eax
+	testl	%eax, %eax
+	jz	other
+
+	ALTENTRY(bad)
+	movl	0x0, %eax
+	SET_SIZE(bad)
+	SET_SIZE(main)
+
+	ENTRY(other)
+	xorl	%eax, %eax
+	popl	%ebp
+	ret
+	SET_SIZE(other)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.embedded.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.embedded.d
new file mode 100644
index 0000000..c484c3f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.embedded.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * SECTION:
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option destructive
+
+pid$1:a.out:waiting:entry
+{
+	this->a = (char *)alloca(1);
+	*this->a = 1;
+	copyout(this->a, arg0, 1);
+}
+
+pid$1:a.out:main:,
+pid$1:a.out:inner:
+{
+}
+
+syscall::rexit:entry
+/pid == $1/
+{
+	exit(0);
+}
+
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.embedded.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.embedded.s
new file mode 100644
index 0000000..134a5af
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.embedded.s
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.long 0
+
+	ENTRY(waiting)
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	8(%ebp), %eax
+	movl	(%eax), %eax
+	popl	%ebp
+	ret
+	SET_SIZE(waiting)
+
+	ENTRY(main)
+	pushl	%ebp
+	movl	%esp, %ebp
+	subl	$0x4, %esp
+	movl	$0x0, -4(%ebp)
+1:
+	leal	-4(%ebp), %eax
+	pushl	%eax
+	call	waiting
+	addl	$0x4, %esp
+
+	testl	%eax, %eax
+	jz	1b
+
+	addl	$0x4, %esp
+
+	ALTENTRY(inner)
+	nop
+	nop
+	nop
+	SET_SIZE(inner)
+
+	xorl	%eax, %eax
+	popl	%ebp
+	ret
+	SET_SIZE(main)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.ret.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.ret.d
new file mode 100644
index 0000000..358466f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.ret.d
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Validated the emulation of various flavors of the return
+ * instruction.
+ */
+
+#pragma D option destructive
+
+pid$1:a.out:waiting:entry
+{
+	this->a = (char *)alloca(1);
+	*this->a = 1;
+	copyout(this->a, arg0, 1);
+}
+
+pid$1:a.out:ret*:
+{
+	printf("%%sp = %x", uregs[R_SP]);
+}
+
+pid$1:a.out:ret*:return
+{
+}
+
+pid$1:a.out:done:entry
+{
+	exit(0);
+}
+
+pid$1:a.out:main:return
+{
+	printf("%%eax = %x", uregs[R_EAX]);
+}
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.ret.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.ret.s
new file mode 100644
index 0000000..bccdb1a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.ret.s
@@ -0,0 +1,114 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.long 0
+
+	ENTRY(ret1)
+	ret
+	SET_SIZE(ret1)
+
+	ENTRY(ret2)
+	repz
+	ret
+	SET_SIZE(ret2)
+
+	ENTRY(ret3)
+	ret	$0
+	SET_SIZE(ret3)
+
+	ENTRY(ret4)
+	repz
+	ret	$0
+	SET_SIZE(ret4)
+
+	ENTRY(ret5)
+	pushl	(%esp)
+	ret	$4
+	SET_SIZE(ret5)
+
+	ENTRY(ret6)
+	pushl	(%esp)
+	repz
+	ret	$4
+	SET_SIZE(ret6)
+
+	ENTRY(waiting)
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	8(%ebp), %eax
+	movl	(%eax), %eax
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+	SET_SIZE(waiting)
+
+	ENTRY(main)
+	pushl	%ebp
+	movl	%esp, %ebp
+	subl	$0x4, %esp
+	movl	$0x0, -4(%ebp)
+
+1:
+	leal	-4(%ebp), %eax
+	pushl	%eax
+	call	waiting
+	addl	$0x4, %esp
+
+	testl	%eax, %eax
+	jz	1b
+
+	movl	%esp, %esi
+
+	call	ret1
+	call	ret2
+	call	ret3
+	call	ret4
+	call	ret5
+	call	ret6
+
+	cmpl	%esp, %esi
+	jne	1f
+
+	ALTENTRY(done)
+	nop
+	SET_SIZE(done)
+
+	movl	$0, %eax
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+
+1:
+	movl	$1, %eax
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+	SET_SIZE(main)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.retlist.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.retlist.ksh
new file mode 100755
index 0000000..5477f5c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.retlist.ksh
@@ -0,0 +1,50 @@
+#!/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+# Make sure we can match against 2-byte rets
+
+./tst.retlist.exe&
+PID=$!
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+match=`$dtrace -l -n pid$PID:a.out:simple: -n pid$PID:a.out:complex: | wc -l`
+
+kill $PID
+
+if [ "$match" -ne 12 ]; then
+        echo wrong number of matched probes: $match
+        exit 1
+fi
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.retlist.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.retlist.s
new file mode 100644
index 0000000..e85e9f5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/pid/tst.retlist.s
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.long 0
+
+	ENTRY(simple)
+	repz
+	ret
+	SET_SIZE(simple)
+
+	ENTRY(complex)
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	8(%ebp), %eax
+	movl	(%eax), %eax
+	popl	%ebp
+	repz
+	ret
+	SET_SIZE(complex)
+
+	ENTRY(main)
+1:	jmp 1b
+	SET_SIZE(main)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/annotated_helper.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/annotated_helper.d
new file mode 100644
index 0000000..3b97709
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/annotated_helper.d
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+dtrace:helper:ustack:
+{
+	"@it's annotated"
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/helper_helper.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/helper_helper.d
new file mode 100644
index 0000000..8abc47d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/helper_helper.d
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+dtrace:helper:ustack:
+{
+	"<it's working>"
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.c
new file mode 100644
index 0000000..8cdf8ab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.c
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+int
+baz(void)
+{
+	return (8);
+}
+
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		baz();
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.d
new file mode 100644
index 0000000..dd795be
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.d
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+pid$1:a.out:baz:entry
+{
+	ustack(1, 1024);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.d.out
new file mode 100644
index 0000000..806d6a2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.annotated.d.out
@@ -0,0 +1,4 @@
+
+              tst.annotated.exe`baz
+                [ it's annotated ]
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.circstack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.circstack.d
new file mode 100644
index 0000000..78218bd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.circstack.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+syscall::getpid:entry
+/pid == $1/
+{
+	@[ustackdepth] = count();
+}
+
+ERROR
+/arg4 == DTRACEFLT_BADSTACK/
+{
+	exit(0);
+}
+
+profile:::tick-1s
+/++n  == 10/
+{
+	exit(1)
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.circstack.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.circstack.s
new file mode 100644
index 0000000..3bf7c0b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.circstack.s
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.long 0
+
+	ENTRY(main)
+	pushl	%ebp
+	movl	%esp, %ebp
+	movl	%esp, (%ebp)
+loop:
+	call	getpid
+	jmp	loop
+	leave
+	ret
+	SET_SIZE(main)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.c
new file mode 100644
index 0000000..69ab6a8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.c
@@ -0,0 +1,82 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <strings.h>
+
+int
+baz(void)
+{
+	return (8);
+}
+
+static int
+foo(void)
+{
+	/*
+	 * In order to assure that our helper is properly employed to identify
+	 * the frame, we're going to trampoline through data.
+	 */
+	uint8_t instr[] = {
+	    0x55,			/* pushl %ebp		*/
+	    0x8b, 0xec,			/* movl  %esp, %ebp	*/
+	    0xe8, 0x0, 0x0, 0x0, 0x0,	/* call  baz		*/
+	    0x8b, 0xe5,			/* movl  %ebp, %esp	*/
+	    0x5d,			/* popl  %ebp		*/
+	    0xc3			/* ret			*/
+	};
+	uint8_t *fp = malloc(sizeof (instr));
+
+	/*
+	 * Do our little relocation dance.
+	 */
+	*((int *)&instr[4]) = (uintptr_t)baz - (uintptr_t)&fp[8];
+
+	/*
+	 * Copy the code to the heap (it's a pain to build in ON with an
+	 * executable stack).
+	 */
+	bcopy(instr, fp, sizeof (instr));
+
+	(*(int (*)(void))fp)();
+
+	free(fp);
+
+	return (0);
+}
+
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		foo();
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.d
new file mode 100644
index 0000000..ce2b9b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * SECTION:
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+pid$1:a.out:baz:entry
+{
+	ustack(2, 1024);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.d.out
new file mode 100644
index 0000000..2964628
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i386/ustack/tst.helper.d.out
@@ -0,0 +1,4 @@
+
+              tst.helper.exe`baz
+              <it's working>
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/Makefile
new file mode 100644
index 0000000..68378bb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/Makefile
@@ -0,0 +1,29 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.com
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh
new file mode 100644
index 0000000..3a5ce6f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh
@@ -0,0 +1,77 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# ASSERTION: Make sure that we can map in and read the Xen trace buffers.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+#
+# Do not fail the test in a domU
+#
+if [ ! -c /dev/xen/privcmd ]; then
+	exit 0
+fi
+
+dtrace=$1
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	xdt:sched::on-cpu
+	/arg0 == 0/
+	{
+		self->on++;
+	}
+
+	xdt:sched::off-cpu
+	/arg0 == 0 && self->on/
+	{
+		self->off++;
+	}
+
+	xdt:sched::off-cpu
+	/self->on > 50 && self->off > 50/
+	{
+		exit(0);
+	}
+
+	profile:::tick-1sec
+	/n++ > 10/
+	{
+		exit(1);
+	}
+EOF
+}
+
+script
+status=$?
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.hvmenable.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.hvmenable.ksh
new file mode 100644
index 0000000..3719c20
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.hvmenable.ksh
@@ -0,0 +1,64 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+#
+# ASSERTION: HVM probes should enable successfully.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+#
+# Do not fail the test in a domU
+#
+if [ ! -c /dev/xen/privcmd ]; then
+	exit 0
+fi
+
+dtrace=$1
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	dtrace:::BEGIN
+	{
+		exit(0);
+	}
+
+	xdt:hvm::vmentry,
+	xdt:hvm::vmexit
+	{}
+EOF
+}
+
+script
+status=$?
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.memenable.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.memenable.ksh
new file mode 100644
index 0000000..25d39cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.memenable.ksh
@@ -0,0 +1,65 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+#
+# ASSERTION: Mem probes should enable successfully.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+#
+# Do not fail the test in a domU
+#
+if [ ! -c /dev/xen/privcmd ]; then
+	exit 0
+fi
+
+dtrace=$1
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	dtrace:::BEGIN
+	{
+		exit(0);
+	}
+
+	xdt:mem::page-grant-map,
+	xdt:mem::page-grant-unmap,
+	xdt:mem::page-grant-transfer
+	{}
+EOF
+}
+
+script
+status=$?
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh
new file mode 100644
index 0000000..5b14fc9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedargs.ksh
@@ -0,0 +1,121 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# ASSERTION: Sched probe arguments should be valid. 
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+#
+# do not fail test in a domU
+#
+if [ ! -c /dev/xen/privcmd ]; then
+	exit 0
+fi
+
+dtrace=$1
+outf=/tmp/sched.args.$$
+
+script()
+{
+	$dtrace -c '/usr/bin/sleep 10' -o $outf -qs /dev/stdin <<EOF
+	xdt:sched::off-cpu,
+	xdt:sched::on-cpu,
+	xdt:sched::block,
+	xdt:sched::sleep,
+	xdt:sched::wake,
+	xdt:sched::yield
+	{
+		/* print domid vcpu pcpu probename */
+		printf("%d %d %d %s\n", arg0, arg1, \`xdt_curpcpu, probename);
+	}
+EOF
+}
+
+validate()
+{
+	/usr/bin/nawk '
+	BEGIN {
+		while (("/usr/sbin/xm vcpu-list" | getline)) {
+			if ($1 != "Name") {
+				domid = $2
+				vcpu = $3
+
+				vcpumap[domid, vcpu] = 1
+
+				split($7, affinity, ",")
+				for (i in affinity) {
+					if (split(affinity[i], p, "-") > 1) {
+						for (pcpu = p[1]; pcpu <= p[2];\
+						    pcpu++) {
+							cpumap[domid, vcpu,
+							    pcpu] = 1
+						}
+					} else {
+						cpumap[domid, vcpu,
+						    affinity[i]] = 1
+					}
+				}
+			}
+		}
+	}
+
+	/^$/ { next }
+
+	/wake/ {
+		if (vcpumap[$1, $2]) {
+			next
+		} else {
+			print "error: " $0
+			exit 1
+		}
+	}
+
+	{
+		if (cpumap[$1, $2, "any"] || cpumap[$1, $2, $3]) {
+			next
+		} else {
+			print "error: " $0
+			exit 1
+		}
+	}
+	' $outf
+}
+
+script
+status=$?
+
+if [ $status == 0 ]; then
+	validate
+	status=$?
+fi
+
+rm $outf
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedenable.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedenable.ksh
new file mode 100644
index 0000000..54c3352
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/i86xpv/xdt/tst.schedenable.ksh
@@ -0,0 +1,74 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+#
+# ASSERTION: Sched probes should enable successfully.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+#
+# do not fail test in a domU
+#
+if [ ! -c /dev/xen/privcmd ]; then
+	exit 0
+fi
+
+dtrace=$1
+
+script()
+{
+	$dtrace -qs /dev/stdin <<EOF
+	dtrace:::BEGIN
+	{
+		exit(0);
+	}
+
+	xdt:sched::off-cpu,
+	xdt:sched::on-cpu,
+	xdt:sched::idle-off-cpu,
+	xdt:sched::idle-on-cpu,
+	xdt:sched::block,
+	xdt:sched::sleep,
+	xdt:sched::wake,
+	xdt:sched::yield,
+	xdt:sched::shutdown-poweroff,
+	xdt:sched::shutdown-reboot,
+	xdt:sched::shutdown-suspend,
+	xdt:sched::shutdown-crash
+	{}
+EOF
+}
+
+script
+status=$?
+
+exit $status
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/Makefile
new file mode 100644
index 0000000..28e814d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/Makefile
@@ -0,0 +1,51 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.com
+
+ASFLAGS += -P -D_ASM
+
+pid/tst.br.o := ASFLAGS += -xarch=v8plus
+
+all:	ustack/tst.helper.exe ustack/tst.annotated.exe
+
+ustack/tst.helper.exe: ustack/tst.helper.o ustack/helper_helper.o
+	$(LINK.c) -o ustack/tst.helper.exe \
+		 ustack/tst.helper.o ustack/helper_helper.o $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+ustack/helper_helper.o: ustack/helper_helper.d
+	$(COMPILE.d) -o ustack/helper_helper.o -s ustack/helper_helper.d
+
+ustack/tst.annotated.exe: ustack/tst.annotated.o ustack/annotated_helper.o
+	$(LINK.c) -o ustack/tst.annotated.exe \
+		 ustack/tst.annotated.o ustack/annotated_helper.o $(LDLIBS)
+	$(POST_PROCESS) ; $(STRIP_STABS)
+
+ustack/annotated_helper.o: ustack/annotated_helper.d
+	$(COMPILE.d) -o ustack/annotated_helper.o -s ustack/annotated_helper.d
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/arrays/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/arrays/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/arrays/tst.uregsarray.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/arrays/tst.uregsarray.d
new file mode 100644
index 0000000..3ef3898
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/arrays/tst.uregsarray.d
@@ -0,0 +1,85 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#pragma	ident	"%Z%%M%	%I%	%E% SMI"
+
+
+/*
+ * ASSERTION:
+ *	Positive test to make sure that we can invoke sparc
+ *	ureg[] aliases.
+ *
+ * SECTION: User Process Tracing/uregs Array
+ *
+ * NOTES: This test does no verification - the value of the output
+ *	is not deterministic.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	printf("R_G0 = 0x%x\n", uregs[R_G0]);
+	printf("R_G1 = 0x%x\n", uregs[R_G1]);
+	printf("R_G2 = 0x%x\n", uregs[R_G2]);
+	printf("R_G3 = 0x%x\n", uregs[R_G3]);
+	printf("R_G4 = 0x%x\n", uregs[R_G4]);
+	printf("R_G5 = 0x%x\n", uregs[R_G5]);
+	printf("R_G6 = 0x%x\n", uregs[R_G6]);
+	printf("R_G7 = 0x%x\n", uregs[R_G7]);
+	printf("R_O0 = 0x%x\n", uregs[R_O0]);
+	printf("R_O1 = 0x%x\n", uregs[R_O1]);
+	printf("R_O2 = 0x%x\n", uregs[R_O2]);
+	printf("R_O3 = 0x%x\n", uregs[R_O3]);
+	printf("R_O4 = 0x%x\n", uregs[R_O4]);
+	printf("R_O5 = 0x%x\n", uregs[R_O5]);
+	printf("R_O6 = 0x%x\n", uregs[R_O6]);
+	printf("R_O7 = 0x%x\n", uregs[R_O7]);
+	printf("R_L0 = 0x%x\n", uregs[R_L0]);
+	printf("R_L1 = 0x%x\n", uregs[R_L1]);
+	printf("R_L2 = 0x%x\n", uregs[R_L2]);
+	printf("R_L3 = 0x%x\n", uregs[R_L3]);
+	printf("R_L4 = 0x%x\n", uregs[R_L4]);
+	printf("R_L5 = 0x%x\n", uregs[R_L5]);
+	printf("R_L6 = 0x%x\n", uregs[R_L6]);
+	printf("R_L7 = 0x%x\n", uregs[R_L7]);
+	printf("R_I0 = 0x%x\n", uregs[R_I0]);
+	printf("R_I1 = 0x%x\n", uregs[R_I1]);
+	printf("R_I2 = 0x%x\n", uregs[R_I2]);
+	printf("R_I3 = 0x%x\n", uregs[R_I3]);
+	printf("R_I4 = 0x%x\n", uregs[R_I4]);
+	printf("R_I5 = 0x%x\n", uregs[R_I5]);
+	printf("R_I6 = 0x%x\n", uregs[R_I6]);
+	printf("R_I7 = 0x%x\n", uregs[R_I7]);
+	printf("R_CCR = 0x%x\n", uregs[R_CCR]);
+	printf("R_PC = 0x%x\n", uregs[R_PC]);
+	printf("R_NPC = 0x%x\n", uregs[R_NPC]);
+	printf("R_Y = 0x%x\n", uregs[R_Y]);
+	printf("R_ASI = 0x%x\n", uregs[R_ASI]);
+	printf("R_FPRS = 0x%x\n", uregs[R_FPRS]);
+	exit(0);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/err.D_PROC_ALIGN.misaligned.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/err.D_PROC_ALIGN.misaligned.d
new file mode 100644
index 0000000..3e46627
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/err.D_PROC_ALIGN.misaligned.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: On SPARC, you can't trace misaligned offsets
+ *
+ * SECTION: User Process Tracing/pid Provider
+ *
+ * NOTES:
+ *
+ */
+
+pid$1:a.out:main:7
+{
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/err.D_PROC_ALIGN.misaligned.exe b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/err.D_PROC_ALIGN.misaligned.exe
new file mode 100755
index 0000000..595db1d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/err.D_PROC_ALIGN.misaligned.exe
@@ -0,0 +1,29 @@
+#!/bin/ksh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+sleep 1000000
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.d
new file mode 100644
index 0000000..cf1dc02
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.d
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION: Trace all instructions in the function 'test' to verify that
+ * the branches are emulated correctly.
+ */
+
+#pragma D option destructive
+#pragma D option quiet
+
+pid$1:a.out:waiting:entry
+{
+	this->a = (char *)alloca(1);
+	*this->a = 1;
+	copyout(this->a, arg0, 1);
+}
+
+pid$1:a.out:test:
+{
+	printf("%s:%s\n", probefunc, probename);
+}
+
+syscall::rexit:entry
+/pid == $1/
+{
+	exit(0);
+}
+
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.d.out
new file mode 100644
index 0000000..8559271
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.d.out
@@ -0,0 +1,23 @@
+test:entry
+test:0
+test:4
+test:8
+test:c
+test:10
+test:14
+test:18
+test:1c
+test:20
+test:24
+test:28
+test:2c
+test:30
+test:34
+test:38
+test:3c
+test:40
+test:44
+test:48
+test:4c
+test:return
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.s
new file mode 100644
index 0000000..dfa7d27
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.br.s
@@ -0,0 +1,81 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.word 0
+
+	ENTRY(waiting)
+	retl
+	ldub	[%o0], %o0
+	SET_SIZE(waiting)
+
+	ENTRY(test)
+	mov	1, %g1
+
+	brz	%g1, 1f
+	nop
+	brlez	%g1, 1f
+	nop
+	brlz	%g0, 1f
+	nop
+	brlz	%g1, 1f
+	nop
+	brnz	%g0, 1f
+	sub	%g0, 2, %g1
+	brgz	%g1, 1f
+	nop
+	brgz	%g0, 1f
+	nop
+	brgez	%g1, 1f
+	nop
+
+	mov	%g1, %o0
+
+1:
+	retl
+	nop
+	SET_SIZE(test)
+
+	ENTRY(main)
+	save	%sp, -SA(MINFRAME + 4), %sp
+	stb	%g0, [%fp - 4]
+1:
+	call	waiting
+	sub	%fp, 4, %o0
+	tst	%o0
+	bz	1b
+	nop
+
+	call	test
+	nop
+
+	ret
+	restore	%g0, %g0, %o0
+	SET_SIZE(main)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.branch.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.branch.d
new file mode 100644
index 0000000..cfcf0a7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.branch.d
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * SECTION:
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option destructive
+
+pid$1:a.out:waiting:entry
+{
+	this->a = (char *)alloca(1);
+	*this->a = 1;
+	copyout(this->a, arg0, 1);
+}
+
+pid$1:a.out:main:,
+pid$1:a.out:other:
+{
+}
+
+pid$1:a.out:bad:entry
+{
+	exit(1);
+}
+
+syscall::rexit:entry
+/pid == $1/
+{
+	exit(0);
+}
+
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.branch.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.branch.s
new file mode 100644
index 0000000..3e6531f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.branch.s
@@ -0,0 +1,63 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.word 0
+
+	ENTRY(waiting)
+	retl
+	ldub	[%o0], %o0
+	SET_SIZE(waiting)
+
+	ENTRY(main)
+	save	%sp, -SA(MINFRAME + 4), %sp
+	stb	%g0, [%fp - 4]
+1:
+	call	waiting
+	sub	%fp, 4, %o0
+	tst	%o0
+	bz	1b
+	nop
+
+	restore
+
+	tst	%g0
+	be	other
+	nop
+
+	ALTENTRY(bad)
+	illtrap
+	SET_SIZE(bad)
+	SET_SIZE(main)
+
+	ENTRY(other)
+	retl
+	clr	%o0
+	SET_SIZE(other)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.embedded.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.embedded.d
new file mode 100644
index 0000000..c484c3f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.embedded.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * SECTION:
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option destructive
+
+pid$1:a.out:waiting:entry
+{
+	this->a = (char *)alloca(1);
+	*this->a = 1;
+	copyout(this->a, arg0, 1);
+}
+
+pid$1:a.out:main:,
+pid$1:a.out:inner:
+{
+}
+
+syscall::rexit:entry
+/pid == $1/
+{
+	exit(0);
+}
+
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.embedded.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.embedded.s
new file mode 100644
index 0000000..612f0b9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/pid/tst.embedded.s
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.word 0
+
+	ENTRY(waiting)
+	retl
+	ldub	[%o0], %o0
+	SET_SIZE(waiting)
+
+	ENTRY(main)
+	save	%sp, -SA(MINFRAME + 4), %sp
+	stb	%g0, [%fp - 4]
+1:
+	call	waiting
+	sub	%fp, 4, %o0
+	tst	%o0
+	bz	1b
+	nop
+
+	restore
+
+	ALTENTRY(inner)
+	nop
+	nop
+	nop
+	SET_SIZE(inner)
+
+	retl
+	clr	%o0
+	SET_SIZE(main)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/usdt/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/usdt/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh
new file mode 100644
index 0000000..cfd7a63
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh
@@ -0,0 +1,132 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# ASSERTION: Make sure USDT probes work as tail-calls on SPARC.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+cat > test.s <<EOF
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.word 0
+
+	ENTRY(test)
+	save	%sp, -SA(MINFRAME + 4), %sp
+	mov	9, %i0
+	mov	19, %i1
+	mov	2006, %i2
+	call	__dtrace_test___fire
+	restore
+	SET_SIZE(test)
+
+	ENTRY(main)
+	save	%sp, -SA(MINFRAME + 4), %sp
+
+1:
+	call	test
+	nop
+
+	ba	1b
+	nop
+
+	ret
+	restore	%g0, %g0, %o0
+	SET_SIZE(main)
+EOF
+
+cat > prov.d <<EOF
+provider test {
+	probe fire(int, int, int);
+};
+EOF
+
+/usr/ccs/bin/as -xregsym=no -P -D_ASM -o test.o test.s
+if [ $? -ne 0 ]; then
+	print -u2 "failed to compile test.s"
+	exit 1
+fi
+
+$dtrace -G -32 -s prov.d test.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to create DOF"
+	exit 1
+fi
+
+cc -o test test.o prov.o
+if [ $? -ne 0 ]; then
+	print -u2 "failed to link final executable"
+	exit 1
+fi
+
+$dtrace -c ./test -s /dev/stdin <<EOF
+test\$target:::fire
+/arg0 == 9 && arg1 == 19 && arg2 == 2006/
+{
+	printf("%d/%d/%d", arg0, arg1, arg2);
+	exit(0);
+}
+
+test\$target:::fire
+{
+	printf("%d/%d/%d", arg0, arg1, arg2);
+	exit(1);
+}
+
+BEGIN
+{
+	/*
+	 * Let's just do this for 5 seconds.
+	 */
+	timeout = timestamp + 5000000000;
+}
+
+profile:::tick-4
+/timestamp > timeout/
+{
+	trace("test timed out");
+	exit(1);
+}
+EOF
+
+status=$?
+
+cd /
+/usr/bin/rm -rf $DIR
+
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/annotated_helper.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/annotated_helper.d
new file mode 100644
index 0000000..3577f86
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/annotated_helper.d
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+dtrace:helper:ustack:
+{
+	"@it's annotated"
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/helper_helper.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/helper_helper.d
new file mode 100644
index 0000000..8abc47d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/helper_helper.d
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+dtrace:helper:ustack:
+{
+	"<it's working>"
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.c
new file mode 100644
index 0000000..8cdf8ab
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.c
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+int
+baz(void)
+{
+	return (8);
+}
+
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		baz();
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.d
new file mode 100644
index 0000000..dd795be
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.d
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D option quiet
+
+pid$1:a.out:baz:entry
+{
+	ustack(1, 1024);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.d.out
new file mode 100644
index 0000000..806d6a2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.annotated.d.out
@@ -0,0 +1,4 @@
+
+              tst.annotated.exe`baz
+                [ it's annotated ]
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.circstack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.circstack.d
new file mode 100644
index 0000000..78218bd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.circstack.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+syscall::getpid:entry
+/pid == $1/
+{
+	@[ustackdepth] = count();
+}
+
+ERROR
+/arg4 == DTRACEFLT_BADSTACK/
+{
+	exit(0);
+}
+
+profile:::tick-1s
+/++n  == 10/
+{
+	exit(1)
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.circstack.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.circstack.s
new file mode 100644
index 0000000..a5076c9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.circstack.s
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+
+	DGDEF(__fsr_init_value)
+	.word 0
+
+	ENTRY(main)
+	save	%sp, -SA(MINFRAME), %sp
+	mov	%sp, %fp
+loop:
+	call	getpid
+	nop
+	ba	loop
+	nop
+	ret
+	restore
+	SET_SIZE(main)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.c
new file mode 100644
index 0000000..fa4802a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.c
@@ -0,0 +1,81 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <strings.h>
+
+int
+baz(void)
+{
+	return (8);
+}
+
+static int
+foo(void)
+{
+	/*
+	 * In order to assure that our helper is properly employed to identify
+	 * the frame, we're going to trampoline through data.
+	 */
+	uint32_t instr[] = {
+	    0x9de3bfa0,		/* save %sp, -0x60, %sp	*/
+	    0x40000000,		/* call baz		*/
+	    0x01000000,		/* nop			*/
+	    0x81c7e008,		/* ret			*/
+	    0x81e80000		/* restore		*/
+	};
+	uint32_t *fp = malloc(sizeof (instr));
+
+	/*
+	 * Do our little relocation dance.
+	 */
+	instr[1] |= ((uintptr_t)baz - (uintptr_t)&fp[1]) >> 2;
+
+	/*
+	 * Copy the code to the heap (it's a pain to build in ON with an
+	 * executable stack).
+	 */
+	bcopy(instr, fp, sizeof (instr));
+
+	(*(int (*)(void))fp)();
+
+	free(fp);
+
+	return (0);
+}
+
+int
+main(int argc, char **argv)
+{
+	for (;;) {
+		foo();
+	}
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.d
new file mode 100644
index 0000000..ce2b9b3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * ASSERTION:
+ *
+ * SECTION:
+ *
+ * NOTES:
+ *
+ */
+
+#pragma D option quiet
+
+pid$1:a.out:baz:entry
+{
+	ustack(2, 1024);
+	exit(0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.d.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.d.out
new file mode 100644
index 0000000..2964628
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.helper.d.out
@@ -0,0 +1,4 @@
+
+              tst.helper.exe`baz
+              <it's working>
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.trapstat.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.trapstat.ksh
new file mode 100644
index 0000000..84af800
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/sparc/ustack/tst.trapstat.ksh
@@ -0,0 +1,87 @@
+#/bin/ksh -p
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+
+#
+# This script verifies that user-land stacks can be walked safely
+# when the trapstat(1M) utility is running. An arbitrary program, w(1),
+# is started once a second to ensure stacks can be walked at all stages
+# of the process lifecycle.
+#
+
+script()
+{
+        $dtrace -o $dtraceout -s /dev/stdin <<EOF
+        fbt:::
+        {
+                @[ustackdepth] = count();
+        }
+EOF
+}
+
+run_commands()
+{
+	cnt=0
+
+	while [ $cnt -lt 10 ]; do
+		w > /dev/null
+		sleep 1
+		cnt=$(($cnt+1))	
+	done
+}
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+dtraceout=/tmp/dtrace.out.$$
+script 2>/dev/null &
+timeout=15
+
+#
+# Sleep while the above script fires into life. To guard against dtrace dying
+# and us sleeping forever we allow 15 secs for this to happen. This should be
+# enough for even the slowest systems.
+#
+while [ ! -f $dtraceout ]; do
+        sleep 1
+        timeout=$(($timeout-1))
+        if [ $timeout -eq 0 ]; then
+                echo "dtrace failed to start. Exiting."
+                exit 1
+        fi
+done
+
+run_commands &
+trapstat -t 1 10
+status=$?
+
+rm $dtraceout
+
+exit $status
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/common/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_create.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_create.c
new file mode 100644
index 0000000..ac8420c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_create.c
@@ -0,0 +1,1369 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/sysmacros.h>
+#include <sys/param.h>
+#include <sys/mman.h>
+#else  /* VBOX */
+#endif /* VBOX */
+#include <ctf_impl.h>
+
+/*
+ * This static string is used as the template for initially populating a
+ * dynamic container's string table.  We always store \0 in the first byte,
+ * and we use the generic string "PARENT" to mark this container's parent
+ * if one is associated with the container using ctf_import().
+ */
+static const char _CTF_STRTAB_TEMPLATE[] = "\0PARENT";
+
+/*
+ * To create an empty CTF container, we just declare a zeroed header and call
+ * ctf_bufopen() on it.  If ctf_bufopen succeeds, we mark the new container r/w
+ * and initialize the dynamic members.  We set dtstrlen to 1 to reserve the
+ * first byte of the string table for a \0 byte, and we start assigning type
+ * IDs at 1 because type ID 0 is used as a sentinel.
+ */
+ctf_file_t *
+ctf_create(int *errp)
+{
+	static const ctf_header_t hdr = { { CTF_MAGIC, CTF_VERSION, 0 } };
+
+	const ulong_t hashlen = 128;
+	ctf_dtdef_t **hash = ctf_alloc(hashlen * sizeof (ctf_dtdef_t *));
+	ctf_sect_t cts;
+	ctf_file_t *fp;
+
+	if (hash == NULL)
+		return (ctf_set_open_errno(errp, EAGAIN));
+
+	cts.cts_name = _CTF_SECTION;
+	cts.cts_type = SHT_PROGBITS;
+	cts.cts_flags = 0;
+	cts.cts_data = &hdr;
+	cts.cts_size = sizeof (hdr);
+	cts.cts_entsize = 1;
+	cts.cts_offset = 0;
+
+	if ((fp = ctf_bufopen(&cts, NULL, NULL, errp)) == NULL) {
+		ctf_free(hash, hashlen * sizeof (ctf_dtdef_t *));
+		return (NULL);
+	}
+
+	fp->ctf_flags |= LCTF_RDWR;
+	fp->ctf_dthashlen = hashlen;
+	bzero(hash, hashlen * sizeof (ctf_dtdef_t *));
+	fp->ctf_dthash = hash;
+	fp->ctf_dtstrlen = sizeof (_CTF_STRTAB_TEMPLATE);
+	fp->ctf_dtnextid = 1;
+	fp->ctf_dtoldid = 0;
+
+	return (fp);
+}
+
+static uchar_t *
+ctf_copy_smembers(ctf_dtdef_t *dtd, uint_t soff, uchar_t *t)
+{
+	ctf_dmdef_t *dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+	ctf_member_t ctm;
+
+	for (; dmd != NULL; dmd = ctf_list_next(dmd)) {
+		if (dmd->dmd_name) {
+			ctm.ctm_name = soff;
+			soff += VBDTCAST(uint_t)strlen(dmd->dmd_name) + 1;
+		} else
+			ctm.ctm_name = 0;
+
+		ctm.ctm_type = (ushort_t)dmd->dmd_type;
+		ctm.ctm_offset = (ushort_t)dmd->dmd_offset;
+
+		bcopy(&ctm, t, sizeof (ctm));
+		t += sizeof (ctm);
+	}
+
+	return (t);
+}
+
+static uchar_t *
+ctf_copy_lmembers(ctf_dtdef_t *dtd, uint_t soff, uchar_t *t)
+{
+	ctf_dmdef_t *dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+	ctf_lmember_t ctlm;
+
+	for (; dmd != NULL; dmd = ctf_list_next(dmd)) {
+		if (dmd->dmd_name) {
+			ctlm.ctlm_name = soff;
+			soff += VBDTCAST(uint_t)strlen(dmd->dmd_name) + 1;
+		} else
+			ctlm.ctlm_name = 0;
+
+		ctlm.ctlm_type = (ushort_t)dmd->dmd_type;
+		ctlm.ctlm_pad = 0;
+		ctlm.ctlm_offsethi = CTF_OFFSET_TO_LMEMHI(dmd->dmd_offset);
+		ctlm.ctlm_offsetlo = CTF_OFFSET_TO_LMEMLO(dmd->dmd_offset);
+
+		bcopy(&ctlm, t, sizeof (ctlm));
+		t += sizeof (ctlm);
+	}
+
+	return (t);
+}
+
+static uchar_t *
+ctf_copy_emembers(ctf_dtdef_t *dtd, uint_t soff, uchar_t *t)
+{
+	ctf_dmdef_t *dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+	ctf_enum_t cte;
+
+	for (; dmd != NULL; dmd = ctf_list_next(dmd)) {
+		cte.cte_name = soff;
+		cte.cte_value = dmd->dmd_value;
+		soff += VBDTCAST(uint_t)strlen(dmd->dmd_name) + 1;
+		bcopy(&cte, t, sizeof (cte));
+		t += sizeof (cte);
+	}
+
+	return (t);
+}
+
+static uchar_t *
+ctf_copy_membnames(ctf_dtdef_t *dtd, uchar_t *s)
+{
+	ctf_dmdef_t *dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+	size_t len;
+
+	for (; dmd != NULL; dmd = ctf_list_next(dmd)) {
+		if (dmd->dmd_name == NULL)
+			continue; /* skip anonymous members */
+		len = strlen(dmd->dmd_name) + 1;
+		bcopy(dmd->dmd_name, s, len);
+		s += len;
+	}
+
+	return (s);
+}
+
+/*
+ * If the specified CTF container is writable and has been modified, reload
+ * this container with the updated type definitions.  In order to make this
+ * code and the rest of libctf as simple as possible, we perform updates by
+ * taking the dynamic type definitions and creating an in-memory CTF file
+ * containing the definitions, and then call ctf_bufopen() on it.  This not
+ * only leverages ctf_bufopen(), but also avoids having to bifurcate the rest
+ * of the library code with different lookup paths for static and dynamic
+ * type definitions.  We are therefore optimizing greatly for lookup over
+ * update, which we assume will be an uncommon operation.  We perform one
+ * extra trick here for the benefit of callers and to keep our code simple:
+ * ctf_bufopen() will return a new ctf_file_t, but we want to keep the fp
+ * constant for the caller, so after ctf_bufopen() returns, we use bcopy to
+ * swap the interior of the old and new ctf_file_t's, and then free the old.
+ */
+int
+ctf_update(ctf_file_t *fp)
+{
+	ctf_file_t ofp, *nfp;
+	ctf_header_t hdr;
+	ctf_dtdef_t *dtd;
+	ctf_sect_t cts;
+
+	uchar_t *s, *s0, *t;
+	size_t size;
+	void *buf;
+	int err;
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return (ctf_set_errno(fp, ECTF_RDONLY));
+
+	if (!(fp->ctf_flags & LCTF_DIRTY))
+		return (0); /* no update required */
+
+	/*
+	 * Fill in an initial CTF header.  We will leave the label, object,
+	 * and function sections empty and only output a header, type section,
+	 * and string table.  The type section begins at a 4-byte aligned
+	 * boundary past the CTF header itself (at relative offset zero).
+	 */
+	bzero(&hdr, sizeof (hdr));
+	hdr.cth_magic = CTF_MAGIC;
+	hdr.cth_version = CTF_VERSION;
+
+	if (fp->ctf_flags & LCTF_CHILD)
+		hdr.cth_parname = 1; /* i.e. _CTF_STRTAB_TEMPLATE[1] */
+
+	/*
+	 * Iterate through the dynamic type definition list and compute the
+	 * size of the CTF type section we will need to generate.
+	 */
+	for (size = 0, dtd = ctf_list_next(&fp->ctf_dtdefs);
+	    dtd != NULL; dtd = ctf_list_next(dtd)) {
+
+		uint_t kind = CTF_INFO_KIND(dtd->dtd_data.ctt_info);
+		uint_t vlen = CTF_INFO_VLEN(dtd->dtd_data.ctt_info);
+
+		if (dtd->dtd_data.ctt_size != CTF_LSIZE_SENT)
+			size += sizeof (ctf_stype_t);
+		else
+			size += sizeof (ctf_type_t);
+
+		switch (kind) {
+		case CTF_K_INTEGER:
+		case CTF_K_FLOAT:
+			size += sizeof (uint_t);
+			break;
+		case CTF_K_ARRAY:
+			size += sizeof (ctf_array_t);
+			break;
+		case CTF_K_FUNCTION:
+			size += sizeof (ushort_t) * (vlen + (vlen & 1));
+			break;
+		case CTF_K_STRUCT:
+		case CTF_K_UNION:
+			if (dtd->dtd_data.ctt_size < CTF_LSTRUCT_THRESH)
+				size += sizeof (ctf_member_t) * vlen;
+			else
+				size += sizeof (ctf_lmember_t) * vlen;
+			break;
+		case CTF_K_ENUM:
+			size += sizeof (ctf_enum_t) * vlen;
+			break;
+		}
+	}
+
+	/*
+	 * Fill in the string table offset and size, compute the size of the
+	 * entire CTF buffer we need, and then allocate a new buffer and
+	 * bcopy the finished header to the start of the buffer.
+	 */
+	hdr.cth_stroff = hdr.cth_typeoff + VBDTCAST(uint_t)size;
+	hdr.cth_strlen = VBDTCAST(uint_t)fp->ctf_dtstrlen;
+	size = sizeof (ctf_header_t) + hdr.cth_stroff + hdr.cth_strlen;
+
+	if ((buf = ctf_data_alloc(size)) == MAP_FAILED)
+		return (ctf_set_errno(fp, EAGAIN));
+
+	bcopy(&hdr, buf, sizeof (ctf_header_t));
+	t = (uchar_t *)buf + sizeof (ctf_header_t);
+	s = s0 = (uchar_t *)buf + sizeof (ctf_header_t) + hdr.cth_stroff;
+
+	bcopy(_CTF_STRTAB_TEMPLATE, s, sizeof (_CTF_STRTAB_TEMPLATE));
+	s += sizeof (_CTF_STRTAB_TEMPLATE);
+
+	/*
+	 * We now take a final lap through the dynamic type definition list and
+	 * copy the appropriate type records and strings to the output buffer.
+	 */
+	for (dtd = ctf_list_next(&fp->ctf_dtdefs);
+	    dtd != NULL; dtd = ctf_list_next(dtd)) {
+
+		uint_t kind = CTF_INFO_KIND(dtd->dtd_data.ctt_info);
+		uint_t vlen = CTF_INFO_VLEN(dtd->dtd_data.ctt_info);
+
+		ctf_array_t cta;
+		uint_t encoding;
+		size_t len;
+
+		if (dtd->dtd_name != NULL) {
+			dtd->dtd_data.ctt_name = (uint_t)(s - s0);
+			len = strlen(dtd->dtd_name) + 1;
+			bcopy(dtd->dtd_name, s, len);
+			s += len;
+		} else
+			dtd->dtd_data.ctt_name = 0;
+
+		if (dtd->dtd_data.ctt_size != CTF_LSIZE_SENT)
+			len = sizeof (ctf_stype_t);
+		else
+			len = sizeof (ctf_type_t);
+
+		bcopy(&dtd->dtd_data, t, len);
+		t += len;
+
+		switch (kind) {
+		case CTF_K_INTEGER:
+		case CTF_K_FLOAT:
+			if (kind == CTF_K_INTEGER) {
+				encoding = CTF_INT_DATA(
+				    dtd->dtd_u.dtu_enc.cte_format,
+				    dtd->dtd_u.dtu_enc.cte_offset,
+				    dtd->dtd_u.dtu_enc.cte_bits);
+			} else {
+				encoding = CTF_FP_DATA(
+				    dtd->dtd_u.dtu_enc.cte_format,
+				    dtd->dtd_u.dtu_enc.cte_offset,
+				    dtd->dtd_u.dtu_enc.cte_bits);
+			}
+			bcopy(&encoding, t, sizeof (encoding));
+			t += sizeof (encoding);
+			break;
+
+		case CTF_K_ARRAY:
+			cta.cta_contents = (ushort_t)
+			    dtd->dtd_u.dtu_arr.ctr_contents;
+			cta.cta_index = (ushort_t)
+			    dtd->dtd_u.dtu_arr.ctr_index;
+			cta.cta_nelems = dtd->dtd_u.dtu_arr.ctr_nelems;
+			bcopy(&cta, t, sizeof (cta));
+			t += sizeof (cta);
+			break;
+
+		case CTF_K_FUNCTION: {
+			ushort_t *argv = (ushort_t *)(uintptr_t)t;
+			uint_t argc;
+
+			for (argc = 0; argc < vlen; argc++)
+				*argv++ = (ushort_t)dtd->dtd_u.dtu_argv[argc];
+
+			if (vlen & 1)
+				*argv++ = 0; /* pad to 4-byte boundary */
+
+			t = (uchar_t *)argv;
+			break;
+		}
+
+		case CTF_K_STRUCT:
+		case CTF_K_UNION:
+			if (dtd->dtd_data.ctt_size < CTF_LSTRUCT_THRESH)
+				t = ctf_copy_smembers(dtd, (uint_t)(s - s0), t);
+			else
+				t = ctf_copy_lmembers(dtd, (uint_t)(s - s0), t);
+			s = ctf_copy_membnames(dtd, s);
+			break;
+
+		case CTF_K_ENUM:
+			t = ctf_copy_emembers(dtd, (uint_t)(s - s0), t);
+			s = ctf_copy_membnames(dtd, s);
+			break;
+		}
+	}
+
+	/*
+	 * Finally, we are ready to ctf_bufopen() the new container.  If this
+	 * is successful, we then switch nfp and fp and free the old container.
+	 */
+	ctf_data_protect(buf, size);
+	cts.cts_name = _CTF_SECTION;
+	cts.cts_type = SHT_PROGBITS;
+	cts.cts_flags = 0;
+	cts.cts_data = buf;
+	cts.cts_size = size;
+	cts.cts_entsize = 1;
+	cts.cts_offset = 0;
+
+	if ((nfp = ctf_bufopen(&cts, NULL, NULL, &err)) == NULL) {
+		ctf_data_free(buf, size);
+		return (ctf_set_errno(fp, err));
+	}
+
+	(void) ctf_setmodel(nfp, ctf_getmodel(fp));
+	(void) ctf_import(nfp, fp->ctf_parent);
+
+	nfp->ctf_refcnt = fp->ctf_refcnt;
+	nfp->ctf_flags |= fp->ctf_flags & ~LCTF_DIRTY;
+	nfp->ctf_data.cts_data = NULL; /* force ctf_data_free() on close */
+	nfp->ctf_dthash = fp->ctf_dthash;
+	nfp->ctf_dthashlen = fp->ctf_dthashlen;
+	nfp->ctf_dtdefs = fp->ctf_dtdefs;
+	nfp->ctf_dtstrlen = fp->ctf_dtstrlen;
+	nfp->ctf_dtnextid = fp->ctf_dtnextid;
+	nfp->ctf_dtoldid = fp->ctf_dtnextid - 1;
+	nfp->ctf_specific = fp->ctf_specific;
+
+	fp->ctf_dthash = NULL;
+	fp->ctf_dthashlen = 0;
+	bzero(&fp->ctf_dtdefs, sizeof (ctf_list_t));
+
+	bcopy(fp, &ofp, sizeof (ctf_file_t));
+	bcopy(nfp, fp, sizeof (ctf_file_t));
+	bcopy(&ofp, nfp, sizeof (ctf_file_t));
+
+	/*
+	 * Initialize the ctf_lookup_by_name top-level dictionary.  We keep an
+	 * array of type name prefixes and the corresponding ctf_hash to use.
+	 * NOTE: This code must be kept in sync with the code in ctf_bufopen().
+	 */
+	fp->ctf_lookups[0].ctl_hash = &fp->ctf_structs;
+	fp->ctf_lookups[1].ctl_hash = &fp->ctf_unions;
+	fp->ctf_lookups[2].ctl_hash = &fp->ctf_enums;
+	fp->ctf_lookups[3].ctl_hash = &fp->ctf_names;
+
+	nfp->ctf_refcnt = 1; /* force nfp to be freed */
+	ctf_close(nfp);
+
+	return (0);
+}
+
+void
+ctf_dtd_insert(ctf_file_t *fp, ctf_dtdef_t *dtd)
+{
+	ulong_t h = dtd->dtd_type & (fp->ctf_dthashlen - 1);
+
+	dtd->dtd_hash = fp->ctf_dthash[h];
+	fp->ctf_dthash[h] = dtd;
+	ctf_list_append(&fp->ctf_dtdefs, dtd);
+}
+
+void
+ctf_dtd_delete(ctf_file_t *fp, ctf_dtdef_t *dtd)
+{
+	ulong_t h = dtd->dtd_type & (fp->ctf_dthashlen - 1);
+	ctf_dtdef_t *p, **q = &fp->ctf_dthash[h];
+	ctf_dmdef_t *dmd, *nmd;
+	size_t len;
+
+	for (p = *q; p != NULL; p = p->dtd_hash) {
+		if (p != dtd)
+			q = &p->dtd_hash;
+		else
+			break;
+	}
+
+	if (p != NULL)
+		*q = p->dtd_hash;
+
+	switch (CTF_INFO_KIND(dtd->dtd_data.ctt_info)) {
+	case CTF_K_STRUCT:
+	case CTF_K_UNION:
+	case CTF_K_ENUM:
+		for (dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+		    dmd != NULL; dmd = nmd) {
+			if (dmd->dmd_name != NULL) {
+				len = strlen(dmd->dmd_name) + 1;
+				ctf_free(dmd->dmd_name, len);
+				fp->ctf_dtstrlen -= len;
+			}
+			nmd = ctf_list_next(dmd);
+			ctf_free(dmd, sizeof (ctf_dmdef_t));
+		}
+		break;
+	case CTF_K_FUNCTION:
+		ctf_free(dtd->dtd_u.dtu_argv, sizeof (ctf_id_t) *
+		    CTF_INFO_VLEN(dtd->dtd_data.ctt_info));
+		break;
+	}
+
+	if (dtd->dtd_name) {
+		len = strlen(dtd->dtd_name) + 1;
+		ctf_free(dtd->dtd_name, len);
+		fp->ctf_dtstrlen -= len;
+	}
+
+	ctf_list_delete(&fp->ctf_dtdefs, dtd);
+	ctf_free(dtd, sizeof (ctf_dtdef_t));
+}
+
+ctf_dtdef_t *
+ctf_dtd_lookup(ctf_file_t *fp, ctf_id_t type)
+{
+	ulong_t h = type & (fp->ctf_dthashlen - 1);
+	ctf_dtdef_t *dtd;
+
+	if (fp->ctf_dthash == NULL)
+		return (NULL);
+
+	for (dtd = fp->ctf_dthash[h]; dtd != NULL; dtd = dtd->dtd_hash) {
+		if (dtd->dtd_type == type)
+			break;
+	}
+
+	return (dtd);
+}
+
+/*
+ * Discard all of the dynamic type definitions that have been added to the
+ * container since the last call to ctf_update().  We locate such types by
+ * scanning the list and deleting elements that have type IDs greater than
+ * ctf_dtoldid, which is set by ctf_update(), above.
+ */
+int
+ctf_discard(ctf_file_t *fp)
+{
+	ctf_dtdef_t *dtd, *ntd;
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return (ctf_set_errno(fp, ECTF_RDONLY));
+
+	if (!(fp->ctf_flags & LCTF_DIRTY))
+		return (0); /* no update required */
+
+	for (dtd = ctf_list_next(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
+		if (dtd->dtd_type <= fp->ctf_dtoldid)
+			continue; /* skip types that have been committed */
+
+		ntd = ctf_list_next(dtd);
+		ctf_dtd_delete(fp, dtd);
+	}
+
+	fp->ctf_dtnextid = fp->ctf_dtoldid + 1;
+	fp->ctf_flags &= ~LCTF_DIRTY;
+
+	return (0);
+}
+
+static ctf_id_t
+ctf_add_generic(ctf_file_t *fp, uint_t flag, const char *name, ctf_dtdef_t **rp)
+{
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+	char *s = NULL;
+
+	if (flag != CTF_ADD_NONROOT && flag != CTF_ADD_ROOT)
+		return (ctf_set_errno(fp, EINVAL));
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return (ctf_set_errno(fp, ECTF_RDONLY));
+
+	if (CTF_INDEX_TO_TYPE(fp->ctf_dtnextid, 1) > CTF_MAX_TYPE)
+		return (ctf_set_errno(fp, ECTF_FULL));
+
+	if ((dtd = ctf_alloc(sizeof (ctf_dtdef_t))) == NULL)
+		return (ctf_set_errno(fp, EAGAIN));
+
+	if (name != NULL && (s = ctf_strdup(name)) == NULL) {
+		ctf_free(dtd, sizeof (ctf_dtdef_t));
+		return (ctf_set_errno(fp, EAGAIN));
+	}
+
+	type = fp->ctf_dtnextid++;
+	type = CTF_INDEX_TO_TYPE(type, (fp->ctf_flags & LCTF_CHILD));
+
+	bzero(dtd, sizeof (ctf_dtdef_t));
+	dtd->dtd_name = s;
+	dtd->dtd_type = type;
+
+	if (s != NULL)
+		fp->ctf_dtstrlen += strlen(s) + 1;
+
+	ctf_dtd_insert(fp, dtd);
+	fp->ctf_flags |= LCTF_DIRTY;
+
+	*rp = dtd;
+	return (type);
+}
+
+/*
+ * When encoding integer sizes, we want to convert a byte count in the range
+ * 1-8 to the closest power of 2 (e.g. 3->4, 5->8, etc).  The clp2() function
+ * is a clever implementation from "Hacker's Delight" by Henry Warren, Jr.
+ */
+static size_t
+clp2(size_t x)
+{
+	x--;
+
+	x |= (x >> 1);
+	x |= (x >> 2);
+	x |= (x >> 4);
+	x |= (x >> 8);
+	x |= (x >> 16);
+
+	return (x + 1);
+}
+
+static ctf_id_t
+ctf_add_encoded(ctf_file_t *fp, uint_t flag,
+    const char *name, const ctf_encoding_t *ep, uint_t kind)
+{
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+
+	if (ep == NULL)
+		return (ctf_set_errno(fp, EINVAL));
+
+	if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(kind, flag, 0);
+	dtd->dtd_data.ctt_size = VBDTCAST(ushort_t)clp2(P2ROUNDUP(ep->cte_bits, NBBY) / NBBY);
+	dtd->dtd_u.dtu_enc = *ep;
+
+	return (type);
+}
+
+static ctf_id_t
+ctf_add_reftype(ctf_file_t *fp, uint_t flag, ctf_id_t ref, uint_t kind)
+{
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+
+	if (ref == CTF_ERR || ref < 0 || ref > CTF_MAX_TYPE)
+		return (ctf_set_errno(fp, EINVAL));
+
+	if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(kind, flag, 0);
+	dtd->dtd_data.ctt_type = (ushort_t)ref;
+
+	return (type);
+}
+
+ctf_id_t
+ctf_add_integer(ctf_file_t *fp, uint_t flag,
+    const char *name, const ctf_encoding_t *ep)
+{
+	return (ctf_add_encoded(fp, flag, name, ep, CTF_K_INTEGER));
+}
+
+ctf_id_t
+ctf_add_float(ctf_file_t *fp, uint_t flag,
+    const char *name, const ctf_encoding_t *ep)
+{
+	return (ctf_add_encoded(fp, flag, name, ep, CTF_K_FLOAT));
+}
+
+ctf_id_t
+ctf_add_pointer(ctf_file_t *fp, uint_t flag, ctf_id_t ref)
+{
+	return (ctf_add_reftype(fp, flag, ref, CTF_K_POINTER));
+}
+
+ctf_id_t
+ctf_add_array(ctf_file_t *fp, uint_t flag, const ctf_arinfo_t *arp)
+{
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+
+	if (arp == NULL)
+		return (ctf_set_errno(fp, EINVAL));
+
+	if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_ARRAY, flag, 0);
+	dtd->dtd_data.ctt_size = 0;
+	dtd->dtd_u.dtu_arr = *arp;
+
+	return (type);
+}
+
+int
+ctf_set_array(ctf_file_t *fp, ctf_id_t type, const ctf_arinfo_t *arp)
+{
+	ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type);
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return (ctf_set_errno(fp, ECTF_RDONLY));
+
+	if (dtd == NULL || CTF_INFO_KIND(dtd->dtd_data.ctt_info) != CTF_K_ARRAY)
+		return (ctf_set_errno(fp, ECTF_BADID));
+
+	fp->ctf_flags |= LCTF_DIRTY;
+	dtd->dtd_u.dtu_arr = *arp;
+
+	return (0);
+}
+
+ctf_id_t
+ctf_add_function(ctf_file_t *fp, uint_t flag,
+    const ctf_funcinfo_t *ctc, const ctf_id_t *argv)
+{
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+	uint_t vlen;
+	ctf_id_t *vdat = NULL;
+
+	if (ctc == NULL || (ctc->ctc_flags & ~CTF_FUNC_VARARG) != 0 ||
+	    (ctc->ctc_argc != 0 && argv == NULL))
+		return (ctf_set_errno(fp, EINVAL));
+
+	vlen = ctc->ctc_argc;
+	if (ctc->ctc_flags & CTF_FUNC_VARARG)
+		vlen++; /* add trailing zero to indicate varargs (see below) */
+
+	if (vlen > CTF_MAX_VLEN)
+		return (ctf_set_errno(fp, EOVERFLOW));
+
+	if (vlen != 0 && (vdat = ctf_alloc(sizeof (ctf_id_t) * vlen)) == NULL)
+		return (ctf_set_errno(fp, EAGAIN));
+
+	if ((type = ctf_add_generic(fp, flag, NULL, &dtd)) == CTF_ERR) {
+		ctf_free(vdat, sizeof (ctf_id_t) * vlen);
+		return (CTF_ERR); /* errno is set for us */
+	}
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_FUNCTION, flag, vlen);
+	dtd->dtd_data.ctt_type = (ushort_t)ctc->ctc_return;
+
+	bcopy(argv, vdat, sizeof (ctf_id_t) * ctc->ctc_argc);
+	if (ctc->ctc_flags & CTF_FUNC_VARARG)
+		vdat[vlen - 1] = 0; /* add trailing zero to indicate varargs */
+	dtd->dtd_u.dtu_argv = vdat;
+
+	return (type);
+}
+
+ctf_id_t
+ctf_add_struct(ctf_file_t *fp, uint_t flag, const char *name)
+{
+	ctf_hash_t *hp = &fp->ctf_structs;
+	ctf_helem_t *hep = NULL;
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+
+	if (name != NULL)
+		hep = ctf_hash_lookup(hp, fp, name, strlen(name));
+
+	if (hep != NULL && ctf_type_kind(fp, hep->h_type) == CTF_K_FORWARD)
+		dtd = ctf_dtd_lookup(fp, type = hep->h_type);
+	else if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_STRUCT, flag, 0);
+	dtd->dtd_data.ctt_size = 0;
+
+	return (type);
+}
+
+ctf_id_t
+ctf_add_union(ctf_file_t *fp, uint_t flag, const char *name)
+{
+	ctf_hash_t *hp = &fp->ctf_unions;
+	ctf_helem_t *hep = NULL;
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+
+	if (name != NULL)
+		hep = ctf_hash_lookup(hp, fp, name, strlen(name));
+
+	if (hep != NULL && ctf_type_kind(fp, hep->h_type) == CTF_K_FORWARD)
+		dtd = ctf_dtd_lookup(fp, type = hep->h_type);
+	else if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_UNION, flag, 0);
+	dtd->dtd_data.ctt_size = 0;
+
+	return (type);
+}
+
+ctf_id_t
+ctf_add_enum(ctf_file_t *fp, uint_t flag, const char *name)
+{
+	ctf_hash_t *hp = &fp->ctf_enums;
+	ctf_helem_t *hep = NULL;
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+
+	if (name != NULL)
+		hep = ctf_hash_lookup(hp, fp, name, strlen(name));
+
+	if (hep != NULL && ctf_type_kind(fp, hep->h_type) == CTF_K_FORWARD)
+		dtd = ctf_dtd_lookup(fp, type = hep->h_type);
+	else if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_ENUM, flag, 0);
+	dtd->dtd_data.ctt_size = VBDTCAST(ushort_t)fp->ctf_dmodel->ctd_int;
+
+	return (type);
+}
+
+ctf_id_t
+ctf_add_forward(ctf_file_t *fp, uint_t flag, const char *name, uint_t kind)
+{
+	ctf_hash_t *hp;
+	ctf_helem_t *hep;
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+
+	switch (kind) {
+	case CTF_K_STRUCT:
+		hp = &fp->ctf_structs;
+		break;
+	case CTF_K_UNION:
+		hp = &fp->ctf_unions;
+		break;
+	case CTF_K_ENUM:
+		hp = &fp->ctf_enums;
+		break;
+	default:
+		return (ctf_set_errno(fp, ECTF_NOTSUE));
+	}
+
+	/*
+	 * If the type is already defined or exists as a forward tag, just
+	 * return the ctf_id_t of the existing definition.
+	 */
+	if (name != NULL && (hep = ctf_hash_lookup(hp,
+	    fp, name, strlen(name))) != NULL)
+		return (hep->h_type);
+
+	if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_FORWARD, flag, 0);
+	dtd->dtd_data.ctt_type = kind;
+
+	return (type);
+}
+
+ctf_id_t
+ctf_add_typedef(ctf_file_t *fp, uint_t flag, const char *name, ctf_id_t ref)
+{
+	ctf_dtdef_t *dtd;
+	ctf_id_t type;
+
+	if (ref == CTF_ERR || ref < 0 || ref > CTF_MAX_TYPE)
+		return (ctf_set_errno(fp, EINVAL));
+
+	if ((type = ctf_add_generic(fp, flag, name, &dtd)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(CTF_K_TYPEDEF, flag, 0);
+	dtd->dtd_data.ctt_type = (ushort_t)ref;
+
+	return (type);
+}
+
+ctf_id_t
+ctf_add_volatile(ctf_file_t *fp, uint_t flag, ctf_id_t ref)
+{
+	return (ctf_add_reftype(fp, flag, ref, CTF_K_VOLATILE));
+}
+
+ctf_id_t
+ctf_add_const(ctf_file_t *fp, uint_t flag, ctf_id_t ref)
+{
+	return (ctf_add_reftype(fp, flag, ref, CTF_K_CONST));
+}
+
+ctf_id_t
+ctf_add_restrict(ctf_file_t *fp, uint_t flag, ctf_id_t ref)
+{
+	return (ctf_add_reftype(fp, flag, ref, CTF_K_RESTRICT));
+}
+
+int
+ctf_add_enumerator(ctf_file_t *fp, ctf_id_t enid, const char *name, int value)
+{
+	ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, enid);
+	ctf_dmdef_t *dmd;
+
+	uint_t kind, vlen, root;
+	char *s;
+
+	if (name == NULL)
+		return (ctf_set_errno(fp, EINVAL));
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return (ctf_set_errno(fp, ECTF_RDONLY));
+
+	if (dtd == NULL)
+		return (ctf_set_errno(fp, ECTF_BADID));
+
+	kind = CTF_INFO_KIND(dtd->dtd_data.ctt_info);
+	root = CTF_INFO_ISROOT(dtd->dtd_data.ctt_info);
+	vlen = CTF_INFO_VLEN(dtd->dtd_data.ctt_info);
+
+	if (kind != CTF_K_ENUM)
+		return (ctf_set_errno(fp, ECTF_NOTENUM));
+
+	if (vlen == CTF_MAX_VLEN)
+		return (ctf_set_errno(fp, ECTF_DTFULL));
+
+	for (dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+	    dmd != NULL; dmd = ctf_list_next(dmd)) {
+		if (strcmp(dmd->dmd_name, name) == 0)
+			return (ctf_set_errno(fp, ECTF_DUPMEMBER));
+	}
+
+	if ((dmd = ctf_alloc(sizeof (ctf_dmdef_t))) == NULL)
+		return (ctf_set_errno(fp, EAGAIN));
+
+	if ((s = ctf_strdup(name)) == NULL) {
+		ctf_free(dmd, sizeof (ctf_dmdef_t));
+		return (ctf_set_errno(fp, EAGAIN));
+	}
+
+	dmd->dmd_name = s;
+	dmd->dmd_type = CTF_ERR;
+	dmd->dmd_offset = 0;
+	dmd->dmd_value = value;
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(kind, root, vlen + 1);
+	ctf_list_append(&dtd->dtd_u.dtu_members, dmd);
+
+	fp->ctf_dtstrlen += strlen(s) + 1;
+	fp->ctf_flags |= LCTF_DIRTY;
+
+	return (0);
+}
+
+int
+ctf_add_member(ctf_file_t *fp, ctf_id_t souid, const char *name, ctf_id_t type)
+{
+	ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, souid);
+	ctf_dmdef_t *dmd;
+
+	ssize_t msize, malign, ssize;
+	uint_t kind, vlen, root;
+	char *s = NULL;
+
+	if (!(fp->ctf_flags & LCTF_RDWR))
+		return (ctf_set_errno(fp, ECTF_RDONLY));
+
+	if (dtd == NULL)
+		return (ctf_set_errno(fp, ECTF_BADID));
+
+	kind = CTF_INFO_KIND(dtd->dtd_data.ctt_info);
+	root = CTF_INFO_ISROOT(dtd->dtd_data.ctt_info);
+	vlen = CTF_INFO_VLEN(dtd->dtd_data.ctt_info);
+
+	if (kind != CTF_K_STRUCT && kind != CTF_K_UNION)
+		return (ctf_set_errno(fp, ECTF_NOTSOU));
+
+	if (vlen == CTF_MAX_VLEN)
+		return (ctf_set_errno(fp, ECTF_DTFULL));
+
+	if (name != NULL) {
+		for (dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+		    dmd != NULL; dmd = ctf_list_next(dmd)) {
+			if (dmd->dmd_name != NULL &&
+			    strcmp(dmd->dmd_name, name) == 0)
+				return (ctf_set_errno(fp, ECTF_DUPMEMBER));
+		}
+	}
+
+	if ((msize = ctf_type_size(fp, type)) == CTF_ERR ||
+	    (malign = ctf_type_align(fp, type)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	if ((dmd = ctf_alloc(sizeof (ctf_dmdef_t))) == NULL)
+		return (ctf_set_errno(fp, EAGAIN));
+
+	if (name != NULL && (s = ctf_strdup(name)) == NULL) {
+		ctf_free(dmd, sizeof (ctf_dmdef_t));
+		return (ctf_set_errno(fp, EAGAIN));
+	}
+
+	dmd->dmd_name = s;
+	dmd->dmd_type = type;
+	dmd->dmd_value = -1;
+
+	if (kind == CTF_K_STRUCT && vlen != 0) {
+		ctf_dmdef_t *lmd = ctf_list_prev(&dtd->dtd_u.dtu_members);
+		ctf_id_t ltype = ctf_type_resolve(fp, lmd->dmd_type);
+		size_t off = lmd->dmd_offset;
+
+		ctf_encoding_t linfo;
+		ssize_t lsize;
+
+		if (ctf_type_encoding(fp, ltype, &linfo) != CTF_ERR)
+			off += linfo.cte_bits;
+		else if ((lsize = ctf_type_size(fp, ltype)) != CTF_ERR)
+			off += lsize * NBBY;
+
+		/*
+		 * Round up the offset of the end of the last member to the
+		 * next byte boundary, convert 'off' to bytes, and then round
+		 * it up again to the next multiple of the alignment required
+		 * by the new member.  Finally, convert back to bits and store
+		 * the result in dmd_offset.  Technically we could do more
+		 * efficient packing if the new member is a bit-field, but
+		 * we're the "compiler" and ANSI says we can do as we choose.
+		 */
+		off = roundup(off, NBBY) / NBBY;
+		off = roundup(off, MAX(malign, 1));
+		dmd->dmd_offset = off * NBBY;
+		ssize = off + msize;
+	} else {
+		dmd->dmd_offset = 0;
+		ssize = ctf_get_ctt_size(fp, &dtd->dtd_data, NULL, NULL);
+		ssize = MAX(ssize, msize);
+	}
+
+	if (ssize > CTF_MAX_SIZE) {
+		dtd->dtd_data.ctt_size = CTF_LSIZE_SENT;
+		dtd->dtd_data.ctt_lsizehi = CTF_SIZE_TO_LSIZE_HI(ssize);
+		dtd->dtd_data.ctt_lsizelo = CTF_SIZE_TO_LSIZE_LO(ssize);
+	} else
+		dtd->dtd_data.ctt_size = (ushort_t)ssize;
+
+	dtd->dtd_data.ctt_info = CTF_TYPE_INFO(kind, root, vlen + 1);
+	ctf_list_append(&dtd->dtd_u.dtu_members, dmd);
+
+	if (s != NULL)
+		fp->ctf_dtstrlen += strlen(s) + 1;
+
+	fp->ctf_flags |= LCTF_DIRTY;
+	return (0);
+}
+
+static int
+enumcmp(const char *name, int value, void *arg)
+{
+	ctf_bundle_t *ctb = arg;
+	int bvalue;
+
+	return (ctf_enum_value(ctb->ctb_file, ctb->ctb_type,
+	    name, &bvalue) == CTF_ERR || value != bvalue);
+}
+
+static int
+enumadd(const char *name, int value, void *arg)
+{
+	ctf_bundle_t *ctb = arg;
+
+	return (ctf_add_enumerator(ctb->ctb_file, ctb->ctb_type,
+	    name, value) == CTF_ERR);
+}
+
+/*ARGSUSED*/
+static int
+membcmp(const char *name, ctf_id_t type, ulong_t offset, void *arg)
+{
+	ctf_bundle_t *ctb = arg;
+	ctf_membinfo_t ctm;
+
+	return (ctf_member_info(ctb->ctb_file, ctb->ctb_type,
+	    name, &ctm) == CTF_ERR || ctm.ctm_offset != offset);
+}
+
+static int
+membadd(const char *name, ctf_id_t type, ulong_t offset, void *arg)
+{
+	ctf_bundle_t *ctb = arg;
+	ctf_dmdef_t *dmd;
+	char *s = NULL;
+
+	if ((dmd = ctf_alloc(sizeof (ctf_dmdef_t))) == NULL)
+		return (ctf_set_errno(ctb->ctb_file, EAGAIN));
+
+	if (name != NULL && (s = ctf_strdup(name)) == NULL) {
+		ctf_free(dmd, sizeof (ctf_dmdef_t));
+		return (ctf_set_errno(ctb->ctb_file, EAGAIN));
+	}
+
+	/*
+	 * For now, dmd_type is copied as the src_fp's type; it is reset to an
+	 * equivalent dst_fp type by a final loop in ctf_add_type(), below.
+	 */
+	dmd->dmd_name = s;
+	dmd->dmd_type = type;
+	dmd->dmd_offset = offset;
+	dmd->dmd_value = -1;
+
+	ctf_list_append(&ctb->ctb_dtd->dtd_u.dtu_members, dmd);
+
+	if (s != NULL)
+		ctb->ctb_file->ctf_dtstrlen += strlen(s) + 1;
+
+	ctb->ctb_file->ctf_flags |= LCTF_DIRTY;
+	return (0);
+}
+
+/*
+ * The ctf_add_type routine is used to copy a type from a source CTF container
+ * to a dynamic destination container.  This routine operates recursively by
+ * following the source type's links and embedded member types.  If the
+ * destination container already contains a named type which has the same
+ * attributes, then we succeed and return this type but no changes occur.
+ */
+ctf_id_t
+ctf_add_type(ctf_file_t *dst_fp, ctf_file_t *src_fp, ctf_id_t src_type)
+{
+	ctf_id_t dst_type = CTF_ERR;
+	uint_t dst_kind = CTF_K_UNKNOWN;
+
+	const ctf_type_t *tp;
+	const char *name;
+	uint_t kind, flag, vlen;
+
+	ctf_bundle_t src, dst;
+	ctf_encoding_t src_en, dst_en;
+	ctf_arinfo_t src_ar, dst_ar;
+
+	ctf_dtdef_t *dtd;
+	ctf_funcinfo_t ctc;
+	ssize_t size;
+
+	ctf_hash_t *hp;
+	ctf_helem_t *hep;
+
+	if (!(dst_fp->ctf_flags & LCTF_RDWR))
+		return (ctf_set_errno(dst_fp, ECTF_RDONLY));
+
+	if ((tp = ctf_lookup_by_id(&src_fp, src_type)) == NULL)
+		return (ctf_set_errno(dst_fp, ctf_errno(src_fp)));
+
+	name = ctf_strptr(src_fp, tp->ctt_name);
+	kind = LCTF_INFO_KIND(src_fp, tp->ctt_info);
+	flag = LCTF_INFO_ROOT(src_fp, tp->ctt_info);
+	vlen = LCTF_INFO_VLEN(src_fp, tp->ctt_info);
+
+	switch (kind) {
+	case CTF_K_STRUCT:
+		hp = &dst_fp->ctf_structs;
+		break;
+	case CTF_K_UNION:
+		hp = &dst_fp->ctf_unions;
+		break;
+	case CTF_K_ENUM:
+		hp = &dst_fp->ctf_enums;
+		break;
+	default:
+		hp = &dst_fp->ctf_names;
+		break;
+	}
+
+	/*
+	 * If the source type has a name and is a root type (visible at the
+	 * top-level scope), lookup the name in the destination container and
+	 * verify that it is of the same kind before we do anything else.
+	 */
+	if ((flag & CTF_ADD_ROOT) && name[0] != '\0' &&
+	    (hep = ctf_hash_lookup(hp, dst_fp, name, strlen(name))) != NULL) {
+		dst_type = (ctf_id_t)hep->h_type;
+		dst_kind = ctf_type_kind(dst_fp, dst_type);
+	}
+
+	/*
+	 * If an identically named dst_type exists, fail with ECTF_CONFLICT
+	 * unless dst_type is a forward declaration and src_type is a struct,
+	 * union, or enum (i.e. the definition of the previous forward decl).
+	 */
+	if (dst_type != CTF_ERR && dst_kind != kind && (
+	    dst_kind != CTF_K_FORWARD || (kind != CTF_K_ENUM &&
+	    kind != CTF_K_STRUCT && kind != CTF_K_UNION)))
+		return (ctf_set_errno(dst_fp, ECTF_CONFLICT));
+
+	/*
+	 * If the non-empty name was not found in the appropriate hash, search
+	 * the list of pending dynamic definitions that are not yet committed.
+	 * If a matching name and kind are found, assume this is the type that
+	 * we are looking for.  This is necessary to permit ctf_add_type() to
+	 * operate recursively on entities such as a struct that contains a
+	 * pointer member that refers to the same struct type.
+	 */
+	if (dst_type == CTF_ERR && name[0] != '\0') {
+		for (dtd = ctf_list_prev(&dst_fp->ctf_dtdefs); dtd != NULL &&
+		    dtd->dtd_type > dst_fp->ctf_dtoldid;
+		    dtd = ctf_list_prev(dtd)) {
+			if (CTF_INFO_KIND(dtd->dtd_data.ctt_info) == kind &&
+			    dtd->dtd_name != NULL &&
+			    strcmp(dtd->dtd_name, name) == 0)
+				return (dtd->dtd_type);
+		}
+	}
+
+	src.ctb_file = src_fp;
+	src.ctb_type = src_type;
+	src.ctb_dtd = NULL;
+
+	dst.ctb_file = dst_fp;
+	dst.ctb_type = dst_type;
+	dst.ctb_dtd = NULL;
+
+	/*
+	 * Now perform kind-specific processing.  If dst_type is CTF_ERR, then
+	 * we add a new type with the same properties as src_type to dst_fp.
+	 * If dst_type is not CTF_ERR, then we verify that dst_type has the
+	 * same attributes as src_type.  We recurse for embedded references.
+	 */
+	switch (kind) {
+	case CTF_K_INTEGER:
+	case CTF_K_FLOAT:
+		if (ctf_type_encoding(src_fp, src_type, &src_en) != 0)
+			return (ctf_set_errno(dst_fp, ctf_errno(src_fp)));
+
+		if (dst_type != CTF_ERR) {
+			if (ctf_type_encoding(dst_fp, dst_type, &dst_en) != 0)
+				return (CTF_ERR); /* errno is set for us */
+
+			if (bcmp(&src_en, &dst_en, sizeof (ctf_encoding_t)))
+				return (ctf_set_errno(dst_fp, ECTF_CONFLICT));
+
+		} else if (kind == CTF_K_INTEGER) {
+			dst_type = ctf_add_integer(dst_fp, flag, name, &src_en);
+		} else
+			dst_type = ctf_add_float(dst_fp, flag, name, &src_en);
+		break;
+
+	case CTF_K_POINTER:
+	case CTF_K_VOLATILE:
+	case CTF_K_CONST:
+	case CTF_K_RESTRICT:
+		src_type = ctf_type_reference(src_fp, src_type);
+		src_type = ctf_add_type(dst_fp, src_fp, src_type);
+
+		if (src_type == CTF_ERR)
+			return (CTF_ERR); /* errno is set for us */
+
+		dst_type = ctf_add_reftype(dst_fp, flag, src_type, kind);
+		break;
+
+	case CTF_K_ARRAY:
+		if (ctf_array_info(src_fp, src_type, &src_ar) == CTF_ERR)
+			return (ctf_set_errno(dst_fp, ctf_errno(src_fp)));
+
+		src_ar.ctr_contents =
+		    ctf_add_type(dst_fp, src_fp, src_ar.ctr_contents);
+		src_ar.ctr_index =
+		    ctf_add_type(dst_fp, src_fp, src_ar.ctr_index);
+		src_ar.ctr_nelems = src_ar.ctr_nelems;
+
+		if (src_ar.ctr_contents == CTF_ERR ||
+		    src_ar.ctr_index == CTF_ERR)
+			return (CTF_ERR); /* errno is set for us */
+
+		if (dst_type != CTF_ERR) {
+			if (ctf_array_info(dst_fp, dst_type, &dst_ar) != 0)
+				return (CTF_ERR); /* errno is set for us */
+
+			if (bcmp(&src_ar, &dst_ar, sizeof (ctf_arinfo_t)))
+				return (ctf_set_errno(dst_fp, ECTF_CONFLICT));
+		} else
+			dst_type = ctf_add_array(dst_fp, flag, &src_ar);
+		break;
+
+	case CTF_K_FUNCTION:
+		ctc.ctc_return = ctf_add_type(dst_fp, src_fp, tp->ctt_type);
+		ctc.ctc_argc = 0;
+		ctc.ctc_flags = 0;
+
+		if (ctc.ctc_return == CTF_ERR)
+			return (CTF_ERR); /* errno is set for us */
+
+		dst_type = ctf_add_function(dst_fp, flag, &ctc, NULL);
+		break;
+
+	case CTF_K_STRUCT:
+	case CTF_K_UNION: {
+		ctf_dmdef_t *dmd;
+		int errs = 0;
+
+		/*
+		 * Technically to match a struct or union we need to check both
+		 * ways (src members vs. dst, dst members vs. src) but we make
+		 * this more optimal by only checking src vs. dst and comparing
+		 * the total size of the structure (which we must do anyway)
+		 * which covers the possibility of dst members not in src.
+		 * This optimization can be defeated for unions, but is so
+		 * pathological as to render it irrelevant for our purposes.
+		 */
+		if (dst_type != CTF_ERR && dst_kind != CTF_K_FORWARD) {
+			if (ctf_type_size(src_fp, src_type) !=
+			    ctf_type_size(dst_fp, dst_type))
+				return (ctf_set_errno(dst_fp, ECTF_CONFLICT));
+
+			if (ctf_member_iter(src_fp, src_type, membcmp, &dst))
+				return (ctf_set_errno(dst_fp, ECTF_CONFLICT));
+
+			break;
+		}
+
+		/*
+		 * Unlike the other cases, copying structs and unions is done
+		 * manually so as to avoid repeated lookups in ctf_add_member
+		 * and to ensure the exact same member offsets as in src_type.
+		 */
+		dst_type = ctf_add_generic(dst_fp, flag, name, &dtd);
+		if (dst_type == CTF_ERR)
+			return (CTF_ERR); /* errno is set for us */
+
+		dst.ctb_type = dst_type;
+		dst.ctb_dtd = dtd;
+
+		if (ctf_member_iter(src_fp, src_type, membadd, &dst) != 0)
+			errs++; /* increment errs and fail at bottom of case */
+
+		if ((size = ctf_type_size(src_fp, src_type)) > CTF_MAX_SIZE) {
+			dtd->dtd_data.ctt_size = CTF_LSIZE_SENT;
+			dtd->dtd_data.ctt_lsizehi = CTF_SIZE_TO_LSIZE_HI(size);
+			dtd->dtd_data.ctt_lsizelo = CTF_SIZE_TO_LSIZE_LO(size);
+		} else
+			dtd->dtd_data.ctt_size = (ushort_t)size;
+
+		dtd->dtd_data.ctt_info = CTF_TYPE_INFO(kind, flag, vlen);
+
+		/*
+		 * Make a final pass through the members changing each dmd_type
+		 * (a src_fp type) to an equivalent type in dst_fp.  We pass
+		 * through all members, leaving any that fail set to CTF_ERR.
+		 */
+		for (dmd = ctf_list_next(&dtd->dtd_u.dtu_members);
+		    dmd != NULL; dmd = ctf_list_next(dmd)) {
+			if ((dmd->dmd_type = ctf_add_type(dst_fp, src_fp,
+			    dmd->dmd_type)) == CTF_ERR)
+				errs++;
+		}
+
+		if (errs)
+			return (CTF_ERR); /* errno is set for us */
+		break;
+	}
+
+	case CTF_K_ENUM:
+		if (dst_type != CTF_ERR && dst_kind != CTF_K_FORWARD) {
+			if (ctf_enum_iter(src_fp, src_type, enumcmp, &dst) ||
+			    ctf_enum_iter(dst_fp, dst_type, enumcmp, &src))
+				return (ctf_set_errno(dst_fp, ECTF_CONFLICT));
+		} else {
+			dst_type = ctf_add_enum(dst_fp, flag, name);
+			if ((dst.ctb_type = dst_type) == CTF_ERR ||
+			    ctf_enum_iter(src_fp, src_type, enumadd, &dst))
+				return (CTF_ERR); /* errno is set for us */
+		}
+		break;
+
+	case CTF_K_FORWARD:
+		if (dst_type == CTF_ERR) {
+			dst_type = ctf_add_forward(dst_fp,
+			    flag, name, CTF_K_STRUCT); /* assume STRUCT */
+		}
+		break;
+
+	case CTF_K_TYPEDEF:
+		src_type = ctf_type_reference(src_fp, src_type);
+		src_type = ctf_add_type(dst_fp, src_fp, src_type);
+
+		if (src_type == CTF_ERR)
+			return (CTF_ERR); /* errno is set for us */
+
+		/*
+		 * If dst_type is not CTF_ERR at this point, we should check if
+		 * ctf_type_reference(dst_fp, dst_type) != src_type and if so
+		 * fail with ECTF_CONFLICT.  However, this causes problems with
+		 * <sys/types.h> typedefs that vary based on things like if
+		 * _ILP32x then pid_t is int otherwise long.  We therefore omit
+		 * this check and assume that if the identically named typedef
+		 * already exists in dst_fp, it is correct or equivalent.
+		 */
+		if (dst_type == CTF_ERR) {
+			dst_type = ctf_add_typedef(dst_fp, flag,
+			    name, src_type);
+		}
+		break;
+
+	default:
+		return (ctf_set_errno(dst_fp, ECTF_CORRUPT));
+	}
+
+	return (dst_type);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_decl.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_decl.c
new file mode 100644
index 0000000..f544d8f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_decl.c
@@ -0,0 +1,190 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+/*
+ * CTF Declaration Stack
+ *
+ * In order to implement ctf_type_name(), we must convert a type graph back
+ * into a C type declaration.  Unfortunately, a type graph represents a storage
+ * class ordering of the type whereas a type declaration must obey the C rules
+ * for operator precedence, and the two orderings are frequently in conflict.
+ * For example, consider these CTF type graphs and their C declarations:
+ *
+ * CTF_K_POINTER -> CTF_K_FUNCTION -> CTF_K_INTEGER  : int (*)()
+ * CTF_K_POINTER -> CTF_K_ARRAY -> CTF_K_INTEGER     : int (*)[]
+ *
+ * In each case, parentheses are used to raise operator * to higher lexical
+ * precedence, so the string form of the C declaration cannot be constructed by
+ * walking the type graph links and forming the string from left to right.
+ *
+ * The functions in this file build a set of stacks from the type graph nodes
+ * corresponding to the C operator precedence levels in the appropriate order.
+ * The code in ctf_type_name() can then iterate over the levels and nodes in
+ * lexical precedence order and construct the final C declaration string.
+ */
+
+#include <ctf_impl.h>
+
+void
+ctf_decl_init(ctf_decl_t *cd, char *buf, size_t len)
+{
+	int i;
+
+	bzero(cd, sizeof (ctf_decl_t));
+
+	for (i = CTF_PREC_BASE; i < CTF_PREC_MAX; i++)
+		cd->cd_order[i] = CTF_PREC_BASE - 1;
+
+	cd->cd_qualp = CTF_PREC_BASE;
+	cd->cd_ordp = CTF_PREC_BASE;
+
+	cd->cd_buf = buf;
+	cd->cd_ptr = buf;
+	cd->cd_end = buf + len;
+}
+
+void
+ctf_decl_fini(ctf_decl_t *cd)
+{
+	ctf_decl_node_t *cdp, *ndp;
+	int i;
+
+	for (i = CTF_PREC_BASE; i < CTF_PREC_MAX; i++) {
+		for (cdp = ctf_list_next(&cd->cd_nodes[i]);
+		    cdp != NULL; cdp = ndp) {
+			ndp = ctf_list_next(cdp);
+			ctf_free(cdp, sizeof (ctf_decl_node_t));
+		}
+	}
+}
+
+void
+ctf_decl_push(ctf_decl_t *cd, ctf_file_t *fp, ctf_id_t type)
+{
+	ctf_decl_node_t *cdp;
+	ctf_decl_prec_t prec;
+	uint_t kind, n = 1;
+	int is_qual = 0;
+
+	const ctf_type_t *tp;
+	ctf_arinfo_t ar;
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) {
+		cd->cd_err = fp->ctf_errno;
+		return;
+	}
+
+	switch (kind = LCTF_INFO_KIND(fp, tp->ctt_info)) {
+	case CTF_K_ARRAY:
+		(void) ctf_array_info(fp, type, &ar);
+		ctf_decl_push(cd, fp, ar.ctr_contents);
+		n = ar.ctr_nelems;
+		prec = CTF_PREC_ARRAY;
+		break;
+
+	case CTF_K_TYPEDEF:
+		if (ctf_strptr(fp, tp->ctt_name)[0] == '\0') {
+			ctf_decl_push(cd, fp, tp->ctt_type);
+			return;
+		}
+		prec = CTF_PREC_BASE;
+		break;
+
+	case CTF_K_FUNCTION:
+		ctf_decl_push(cd, fp, tp->ctt_type);
+		prec = CTF_PREC_FUNCTION;
+		break;
+
+	case CTF_K_POINTER:
+		ctf_decl_push(cd, fp, tp->ctt_type);
+		prec = CTF_PREC_POINTER;
+		break;
+
+	case CTF_K_VOLATILE:
+	case CTF_K_CONST:
+	case CTF_K_RESTRICT:
+		ctf_decl_push(cd, fp, tp->ctt_type);
+		prec = cd->cd_qualp;
+		is_qual++;
+		break;
+
+	default:
+		prec = CTF_PREC_BASE;
+	}
+
+	if ((cdp = ctf_alloc(sizeof (ctf_decl_node_t))) == NULL) {
+		cd->cd_err = EAGAIN;
+		return;
+	}
+
+	cdp->cd_type = type;
+	cdp->cd_kind = kind;
+	cdp->cd_n = n;
+
+	if (ctf_list_next(&cd->cd_nodes[prec]) == NULL)
+		cd->cd_order[prec] = cd->cd_ordp++;
+
+	/*
+	 * Reset cd_qualp to the highest precedence level that we've seen so
+	 * far that can be qualified (CTF_PREC_BASE or CTF_PREC_POINTER).
+	 */
+	if (prec > cd->cd_qualp && prec < CTF_PREC_ARRAY)
+		cd->cd_qualp = prec;
+
+	/*
+	 * C array declarators are ordered inside out so prepend them.  Also by
+	 * convention qualifiers of base types precede the type specifier (e.g.
+	 * const int vs. int const) even though the two forms are equivalent.
+	 */
+	if (kind == CTF_K_ARRAY || (is_qual && prec == CTF_PREC_BASE))
+		ctf_list_prepend(&cd->cd_nodes[prec], cdp);
+	else
+		ctf_list_append(&cd->cd_nodes[prec], cdp);
+}
+
+/*PRINTFLIKE2*/
+void
+ctf_decl_sprintf(ctf_decl_t *cd, const char *format, ...)
+{
+	size_t len = (size_t)(cd->cd_end - cd->cd_ptr);
+	va_list ap;
+	size_t n;
+
+	va_start(ap, format);
+#ifndef VBOX
+	n = vsnprintf(cd->cd_ptr, len, format, ap);
+#else
+	n = RTStrPrintfV(cd->cd_ptr, len, format, ap);
+#endif
+	va_end(ap);
+
+	cd->cd_ptr += MIN(n, len);
+	cd->cd_len += n;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_error.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_error.c
new file mode 100644
index 0000000..414cb07
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_error.c
@@ -0,0 +1,99 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <ctf_impl.h>
+
+static const char *const _ctf_errlist[] = {
+	"File is not in CTF or ELF format",		 /* ECTF_FMT */
+	"File uses more recent ELF version than libctf", /* ECTF_ELFVERS */
+	"File uses more recent CTF version than libctf", /* ECTF_CTFVERS */
+	"File is a different endian-ness than libctf",	 /* ECTF_ENDIAN */
+	"Symbol table uses invalid entry size",		 /* ECTF_SYMTAB */
+	"Symbol table data buffer is not valid",	 /* ECTF_SYMBAD */
+	"String table data buffer is not valid",	 /* ECTF_STRBAD */
+	"File data structure corruption detected",	 /* ECTF_CORRUPT */
+	"File does not contain CTF data",		 /* ECTF_NOCTFDATA */
+	"Buffer does not contain CTF data",		 /* ECTF_NOCTFBUF */
+	"Symbol table information is not available",	 /* ECTF_NOSYMTAB */
+	"Type information is in parent and unavailable", /* ECTF_NOPARENT */
+	"Cannot import types with different data model", /* ECTF_DMODEL */
+	"Failed to mmap a needed data section",		 /* ECTF_MMAP */
+	"Decompression package SUNWzlib not installed",	 /* ECTF_ZMISSING */
+	"Failed to initialize decompression library",	 /* ECTF_ZINIT */
+	"Failed to allocate decompression buffer",	 /* ECTF_ZALLOC */
+	"Failed to decompress CTF data",		 /* ECTF_DECOMPRESS */
+	"External string table is not available",	 /* ECTF_STRTAB */
+	"String name offset is corrupt",		 /* ECTF_BADNAME */
+	"Invalid type identifier",			 /* ECTF_BADID */
+	"Type is not a struct or union",		 /* ECTF_NOTSOU */
+	"Type is not an enum",				 /* ECTF_NOTENUM */
+	"Type is not a struct, union, or enum",		 /* ECTF_NOTSUE */
+	"Type is not an integer or float",		 /* ECTF_NOTINTFP */
+	"Type is not an array",				 /* ECTF_NOTARRAY */
+	"Type does not reference another type",		 /* ECTF_NOTREF */
+	"Input buffer is too small for type name",	 /* ECTF_NAMELEN */
+	"No type information available for that name",	 /* ECTF_NOTYPE */
+	"Syntax error in type name",			 /* ECTF_SYNTAX */
+	"Symbol table entry is not a function",		 /* ECTF_NOTFUNC */
+	"No function information available for symbol",	 /* ECTF_NOFUNCDAT */
+	"Symbol table entry is not a data object",	 /* ECTF_NOTDATA */
+	"No type information available for symbol",	 /* ECTF_NOTYPEDAT */
+	"No label information available for that name",	 /* ECTF_NOLABEL */
+	"File does not contain any labels",		 /* ECTF_NOLABELDATA */
+	"Feature not supported",			 /* ECTF_NOTSUP */
+	"Invalid enum element name",			 /* ECTF_NOENUMNAM */
+	"Invalid member name",				 /* ECTF_NOMEMBNAM */
+	"CTF container is read-only",			 /* ECTF_RDONLY */
+	"Limit on number of dynamic type members reached", /* ECTF_DTFULL */
+	"Limit on number of dynamic types reached",	 /* ECTF_FULL */
+	"Duplicate member name definition",		 /* ECTF_DUPMEMBER */
+	"Conflicting type is already defined",		 /* ECTF_CONFLICT */
+};
+
+static const int _ctf_nerr = sizeof (_ctf_errlist) / sizeof (_ctf_errlist[0]);
+
+const char *
+ctf_errmsg(int error)
+{
+	const char *str;
+
+	if (error >= ECTF_BASE && (error - ECTF_BASE) < _ctf_nerr)
+		str = _ctf_errlist[error - ECTF_BASE];
+	else
+		str = ctf_strerror(error);
+
+	return (str ? str : "Unknown error");
+}
+
+int
+ctf_errno(ctf_file_t *fp)
+{
+	return (fp->ctf_errno);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_hash.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_hash.c
new file mode 100644
index 0000000..e2f390c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_hash.c
@@ -0,0 +1,180 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <ctf_impl.h>
+
+static const ushort_t _CTF_EMPTY[1] = { 0 };
+
+int
+ctf_hash_create(ctf_hash_t *hp, ulong_t nelems)
+{
+	if (nelems > USHRT_MAX)
+		return (EOVERFLOW);
+
+	/*
+	 * If the hash table is going to be empty, don't bother allocating any
+	 * memory and make the only bucket point to a zero so lookups fail.
+	 */
+	if (nelems == 0) {
+		bzero(hp, sizeof (ctf_hash_t));
+		hp->h_buckets = (ushort_t *)_CTF_EMPTY;
+		hp->h_nbuckets = 1;
+		return (0);
+	}
+
+	hp->h_nbuckets = 211;		/* use a prime number of hash buckets */
+	hp->h_nelems = nelems + 1;	/* we use index zero as a sentinel */
+	hp->h_free = 1;			/* first free element is index 1 */
+
+	hp->h_buckets = ctf_alloc(sizeof (ushort_t) * hp->h_nbuckets);
+	hp->h_chains = ctf_alloc(sizeof (ctf_helem_t) * hp->h_nelems);
+
+	if (hp->h_buckets == NULL || hp->h_chains == NULL) {
+		ctf_hash_destroy(hp);
+		return (EAGAIN);
+	}
+
+	bzero(hp->h_buckets, sizeof (ushort_t) * hp->h_nbuckets);
+	bzero(hp->h_chains, sizeof (ctf_helem_t) * hp->h_nelems);
+
+	return (0);
+}
+
+uint_t
+ctf_hash_size(const ctf_hash_t *hp)
+{
+	return (hp->h_nelems ? hp->h_nelems - 1 : 0);
+}
+
+static ulong_t
+ctf_hash_compute(const char *key, size_t len)
+{
+	ulong_t g, h = 0;
+	const char *p, *q = key + len;
+	size_t n = 0;
+
+	for (p = key; p < q; p++, n++) {
+		h = (h << 4) + *p;
+
+		if ((g = (h & 0xf0000000)) != 0) {
+			h ^= (g >> 24);
+			h ^= g;
+		}
+	}
+
+	return (h);
+}
+
+int
+ctf_hash_insert(ctf_hash_t *hp, ctf_file_t *fp, ushort_t type, uint_t name)
+{
+	ctf_strs_t *ctsp = &fp->ctf_str[CTF_NAME_STID(name)];
+	const char *str = ctsp->cts_strs + CTF_NAME_OFFSET(name);
+	ctf_helem_t *hep = &hp->h_chains[hp->h_free];
+	ulong_t h;
+
+	if (type == 0)
+		return (EINVAL);
+
+	if (hp->h_free >= hp->h_nelems)
+		return (EOVERFLOW);
+
+	if (ctsp->cts_strs == NULL)
+		return (ECTF_STRTAB);
+
+	if (ctsp->cts_len <= CTF_NAME_OFFSET(name))
+		return (ECTF_BADNAME);
+
+	if (str[0] == '\0')
+		return (0); /* just ignore empty strings on behalf of caller */
+
+	hep->h_name = name;
+	hep->h_type = type;
+	h = ctf_hash_compute(str, strlen(str)) % hp->h_nbuckets;
+	hep->h_next = hp->h_buckets[h];
+	hp->h_buckets[h] = hp->h_free++;
+
+	return (0);
+}
+
+/*
+ * Wrapper for ctf_hash_lookup/ctf_hash_insert: if the key is already in the
+ * hash, override the previous definition with this new official definition.
+ * If the key is not present, then call ctf_hash_insert() and hash it in.
+ */
+int
+ctf_hash_define(ctf_hash_t *hp, ctf_file_t *fp, ushort_t type, uint_t name)
+{
+	const char *str = ctf_strptr(fp, name);
+	ctf_helem_t *hep = ctf_hash_lookup(hp, fp, str, strlen(str));
+
+	if (hep == NULL)
+		return (ctf_hash_insert(hp, fp, type, name));
+
+	hep->h_type = type;
+	return (0);
+}
+
+ctf_helem_t *
+ctf_hash_lookup(ctf_hash_t *hp, ctf_file_t *fp, const char *key, size_t len)
+{
+	ctf_helem_t *hep;
+	ctf_strs_t *ctsp;
+	const char *str;
+	ushort_t i;
+
+	ulong_t h = ctf_hash_compute(key, len) % hp->h_nbuckets;
+
+	for (i = hp->h_buckets[h]; i != 0; i = hep->h_next) {
+		hep = &hp->h_chains[i];
+		ctsp = &fp->ctf_str[CTF_NAME_STID(hep->h_name)];
+		str = ctsp->cts_strs + CTF_NAME_OFFSET(hep->h_name);
+
+		if (strncmp(key, str, len) == 0 && str[len] == '\0')
+			return (hep);
+	}
+
+	return (NULL);
+}
+
+void
+ctf_hash_destroy(ctf_hash_t *hp)
+{
+	if (hp->h_buckets != NULL && hp->h_nbuckets != 1) {
+		ctf_free(hp->h_buckets, sizeof (ushort_t) * hp->h_nbuckets);
+		hp->h_buckets = NULL;
+	}
+
+	if (hp->h_chains != NULL) {
+		ctf_free(hp->h_chains, sizeof (ctf_helem_t) * hp->h_nelems);
+		hp->h_chains = NULL;
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_impl.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_impl.h
new file mode 100644
index 0000000..cbf2b15
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_impl.h
@@ -0,0 +1,353 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_CTF_IMPL_H
+#define	_CTF_IMPL_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#include <sys/errno.h>
+#include <sys/sysmacros.h>
+#else  /* VBOX */
+# include "../../../../../Runtime/include/internal/ldrELF32.h"
+# include "../../../../../Runtime/include/internal/ldrELF64.h"
+# include <errno.h>
+# include "VBoxDTraceLibCWrappers.h"
+#endif /* VBOX */
+#include <sys/ctf_api.h>
+
+#ifdef _KERNEL
+
+#ifndef VBOX
+#include <sys/systm.h>
+#include <sys/cmn_err.h>
+#include <sys/varargs.h>
+#endif
+
+#define	isspace(c) \
+	((c) == ' ' || (c) == '\t' || (c) == '\n' || \
+	(c) == '\r' || (c) == '\f' || (c) == '\v')
+
+#define	MAP_FAILED	((void *)-1)
+
+#else	/* _KERNEL */
+
+#ifndef VBOX
+#include <strings.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <limits.h>
+#include <ctype.h>
+#endif
+
+#endif	/* _KERNEL */
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct ctf_helem {
+	uint_t h_name;		/* reference to name in string table */
+	ushort_t h_type;	/* corresponding type ID number */
+	ushort_t h_next;	/* index of next element in hash chain */
+} ctf_helem_t;
+
+typedef struct ctf_hash {
+	ushort_t *h_buckets;	/* hash bucket array (chain indices) */
+	ctf_helem_t *h_chains;	/* hash chains buffer */
+	ushort_t h_nbuckets;	/* number of elements in bucket array */
+	ushort_t h_nelems;	/* number of elements in hash table */
+	uint_t h_free;		/* index of next free hash element */
+} ctf_hash_t;
+
+typedef struct ctf_strs {
+	const char *cts_strs;	/* base address of string table */
+	size_t cts_len;		/* size of string table in bytes */
+} ctf_strs_t;
+
+typedef struct ctf_dmodel {
+	const char *ctd_name;	/* data model name */
+	int ctd_code;		/* data model code */
+	size_t ctd_pointer;	/* size of void * in bytes */
+	size_t ctd_char;	/* size of char in bytes */
+	size_t ctd_short;	/* size of short in bytes */
+	size_t ctd_int;		/* size of int in bytes */
+	size_t ctd_long;	/* size of long in bytes */
+} ctf_dmodel_t;
+
+typedef struct ctf_lookup {
+	const char *ctl_prefix;	/* string prefix for this lookup */
+	size_t ctl_len;		/* length of prefix string in bytes */
+	ctf_hash_t *ctl_hash;	/* pointer to hash table for lookup */
+} ctf_lookup_t;
+
+typedef struct ctf_fileops {
+	ushort_t (*ctfo_get_kind)(ushort_t);
+	ushort_t (*ctfo_get_root)(ushort_t);
+	ushort_t (*ctfo_get_vlen)(ushort_t);
+} ctf_fileops_t;
+
+typedef struct ctf_list {
+	struct ctf_list *l_prev; /* previous pointer or tail pointer */
+	struct ctf_list *l_next; /* next pointer or head pointer */
+} ctf_list_t;
+
+typedef enum {
+	CTF_PREC_BASE,
+	CTF_PREC_POINTER,
+	CTF_PREC_ARRAY,
+	CTF_PREC_FUNCTION,
+	CTF_PREC_MAX
+} ctf_decl_prec_t;
+
+typedef struct ctf_decl_node {
+	ctf_list_t cd_list;			/* linked list pointers */
+	ctf_id_t cd_type;			/* type identifier */
+	uint_t cd_kind;				/* type kind */
+	uint_t cd_n;				/* type dimension if array */
+} ctf_decl_node_t;
+
+typedef struct ctf_decl {
+	ctf_list_t cd_nodes[CTF_PREC_MAX];	/* declaration node stacks */
+	int cd_order[CTF_PREC_MAX];		/* storage order of decls */
+	ctf_decl_prec_t cd_qualp;		/* qualifier precision */
+	ctf_decl_prec_t cd_ordp;		/* ordered precision */
+	char *cd_buf;				/* buffer for output */
+	char *cd_ptr;				/* buffer location */
+	char *cd_end;				/* buffer limit */
+	size_t cd_len;				/* buffer space required */
+	int cd_err;				/* saved error value */
+} ctf_decl_t;
+
+typedef struct ctf_dmdef {
+	ctf_list_t dmd_list;	/* list forward/back pointers */
+	char *dmd_name;		/* name of this member */
+	ctf_id_t dmd_type;	/* type of this member (for sou) */
+	ulong_t dmd_offset;	/* offset of this member in bits (for sou) */
+	int dmd_value;		/* value of this member (for enum) */
+} ctf_dmdef_t;
+
+typedef struct ctf_dtdef {
+	ctf_list_t dtd_list;	/* list forward/back pointers */
+	struct ctf_dtdef *dtd_hash; /* hash chain pointer for ctf_dthash */
+	char *dtd_name;		/* name associated with definition (if any) */
+	ctf_id_t dtd_type;	/* type identifier for this definition */
+	ctf_type_t dtd_data;	/* type node (see <sys/ctf.h>) */
+	union {
+		ctf_list_t dtu_members;	/* struct, union, or enum */
+		ctf_arinfo_t dtu_arr;	/* array */
+		ctf_encoding_t dtu_enc;	/* integer or float */
+		ctf_id_t *dtu_argv;	/* function */
+	} dtd_u;
+} ctf_dtdef_t;
+
+typedef struct ctf_bundle {
+	ctf_file_t *ctb_file;	/* CTF container handle */
+	ctf_id_t ctb_type;	/* CTF type identifier */
+	ctf_dtdef_t *ctb_dtd;	/* CTF dynamic type definition (if any) */
+} ctf_bundle_t;
+
+/*
+ * The ctf_file is the structure used to represent a CTF container to library
+ * clients, who see it only as an opaque pointer.  Modifications can therefore
+ * be made freely to this structure without regard to client versioning.  The
+ * ctf_file_t typedef appears in <sys/ctf_api.h> and declares a forward tag.
+ *
+ * NOTE: ctf_update() requires that everything inside of ctf_file either be an
+ * immediate value, a pointer to dynamically allocated data *outside* of the
+ * ctf_file itself, or a pointer to statically allocated data.  If you add a
+ * pointer to ctf_file that points to something within the ctf_file itself,
+ * you must make corresponding changes to ctf_update().
+ */
+struct ctf_file {
+	const ctf_fileops_t *ctf_fileops; /* version-specific file operations */
+	ctf_sect_t ctf_data;	/* CTF data from object file */
+	ctf_sect_t ctf_symtab;	/* symbol table from object file */
+	ctf_sect_t ctf_strtab;	/* string table from object file */
+	ctf_hash_t ctf_structs;	/* hash table of struct types */
+	ctf_hash_t ctf_unions;	/* hash table of union types */
+	ctf_hash_t ctf_enums;	/* hash table of enum types */
+	ctf_hash_t ctf_names;	/* hash table of remaining type names */
+	ctf_lookup_t ctf_lookups[5];	/* pointers to hashes for name lookup */
+	ctf_strs_t ctf_str[2];	/* array of string table base and bounds */
+	const uchar_t *ctf_base; /* base of CTF header + uncompressed buffer */
+	const uchar_t *ctf_buf;	/* uncompressed CTF data buffer */
+	size_t ctf_size;	/* size of CTF header + uncompressed data */
+	uint_t *ctf_sxlate;	/* translation table for symtab entries */
+	ulong_t ctf_nsyms;	/* number of entries in symtab xlate table */
+	uint_t *ctf_txlate;	/* translation table for type IDs */
+	ushort_t *ctf_ptrtab;	/* translation table for pointer-to lookups */
+	ulong_t ctf_typemax;	/* maximum valid type ID number */
+	const ctf_dmodel_t *ctf_dmodel;	/* data model pointer (see above) */
+	struct ctf_file *ctf_parent;	/* parent CTF container (if any) */
+	const char *ctf_parlabel;	/* label in parent container (if any) */
+	const char *ctf_parname;	/* basename of parent (if any) */
+	uint_t ctf_refcnt;	/* reference count (for parent links) */
+	uint_t ctf_flags;	/* libctf flags (see below) */
+	int ctf_errno;		/* error code for most recent error */
+	int ctf_version;	/* CTF data version */
+	ctf_dtdef_t **ctf_dthash; /* hash of dynamic type definitions */
+	ulong_t ctf_dthashlen;	/* size of dynamic type hash bucket array */
+	ctf_list_t ctf_dtdefs;	/* list of dynamic type definitions */
+	size_t ctf_dtstrlen;	/* total length of dynamic type strings */
+	ulong_t ctf_dtnextid;	/* next dynamic type id to assign */
+	ulong_t ctf_dtoldid;	/* oldest id that has been committed */
+	void *ctf_specific;	/* data for ctf_get/setspecific */
+};
+
+#define	LCTF_INDEX_TO_TYPEPTR(fp, i) \
+	((ctf_type_t *)((uintptr_t)(fp)->ctf_buf + (fp)->ctf_txlate[(i)]))
+
+#define	LCTF_INFO_KIND(fp, info)	((fp)->ctf_fileops->ctfo_get_kind(info))
+#define	LCTF_INFO_ROOT(fp, info)	((fp)->ctf_fileops->ctfo_get_root(info))
+#define	LCTF_INFO_VLEN(fp, info)	((fp)->ctf_fileops->ctfo_get_vlen(info))
+
+#define	LCTF_MMAP	0x0001	/* libctf should munmap buffers on close */
+#define	LCTF_CHILD	0x0002	/* CTF container is a child */
+#define	LCTF_RDWR	0x0004	/* CTF container is writable */
+#define	LCTF_DIRTY	0x0008	/* CTF container has been modified */
+
+#define	ECTF_BASE	1000	/* base value for libctf errnos */
+
+enum {
+	ECTF_FMT = ECTF_BASE,	/* file is not in CTF or ELF format */
+	ECTF_ELFVERS,		/* ELF version is more recent than libctf */
+	ECTF_CTFVERS,		/* CTF version is more recent than libctf */
+	ECTF_ENDIAN,		/* data is different endian-ness than lib */
+	ECTF_SYMTAB,		/* symbol table uses invalid entry size */
+	ECTF_SYMBAD,		/* symbol table data buffer invalid */
+	ECTF_STRBAD,		/* string table data buffer invalid */
+	ECTF_CORRUPT,		/* file data corruption detected */
+	ECTF_NOCTFDATA,		/* ELF file does not contain CTF data */
+	ECTF_NOCTFBUF,		/* buffer does not contain CTF data */
+	ECTF_NOSYMTAB,		/* symbol table data is not available */
+	ECTF_NOPARENT,		/* parent CTF container is not available */
+	ECTF_DMODEL,		/* data model mismatch */
+	ECTF_MMAP,		/* failed to mmap a data section */
+	ECTF_ZMISSING,		/* decompression library not installed */
+	ECTF_ZINIT,		/* failed to initialize decompression library */
+	ECTF_ZALLOC,		/* failed to allocate decompression buffer */
+	ECTF_DECOMPRESS,	/* failed to decompress CTF data */
+	ECTF_STRTAB,		/* string table for this string is missing */
+	ECTF_BADNAME,		/* string offset is corrupt w.r.t. strtab */
+	ECTF_BADID,		/* invalid type ID number */
+	ECTF_NOTSOU,		/* type is not a struct or union */
+	ECTF_NOTENUM,		/* type is not an enum */
+	ECTF_NOTSUE,		/* type is not a struct, union, or enum */
+	ECTF_NOTINTFP,		/* type is not an integer or float */
+	ECTF_NOTARRAY,		/* type is not an array */
+	ECTF_NOTREF,		/* type does not reference another type */
+	ECTF_NAMELEN,		/* buffer is too small to hold type name */
+	ECTF_NOTYPE,		/* no type found corresponding to name */
+	ECTF_SYNTAX,		/* syntax error in type name */
+	ECTF_NOTFUNC,		/* symtab entry does not refer to a function */
+	ECTF_NOFUNCDAT,		/* no func info available for function */
+	ECTF_NOTDATA,		/* symtab entry does not refer to a data obj */
+	ECTF_NOTYPEDAT,		/* no type info available for object */
+	ECTF_NOLABEL,		/* no label found corresponding to name */
+	ECTF_NOLABELDATA,	/* file does not contain any labels */
+	ECTF_NOTSUP,		/* feature not supported */
+	ECTF_NOENUMNAM,		/* enum element name not found */
+	ECTF_NOMEMBNAM,		/* member name not found */
+	ECTF_RDONLY,		/* CTF container is read-only */
+	ECTF_DTFULL,		/* CTF type is full (no more members allowed) */
+	ECTF_FULL,		/* CTF container is full */
+	ECTF_DUPMEMBER,		/* duplicate member name definition */
+	ECTF_CONFLICT		/* conflicting type definition present */
+};
+
+extern ssize_t ctf_get_ctt_size(const ctf_file_t *, const ctf_type_t *,
+    ssize_t *, ssize_t *);
+
+extern const ctf_type_t *ctf_lookup_by_id(ctf_file_t **, ctf_id_t);
+
+extern int ctf_hash_create(ctf_hash_t *, ulong_t);
+extern int ctf_hash_insert(ctf_hash_t *, ctf_file_t *, ushort_t, uint_t);
+extern int ctf_hash_define(ctf_hash_t *, ctf_file_t *, ushort_t, uint_t);
+extern ctf_helem_t *ctf_hash_lookup(ctf_hash_t *, ctf_file_t *,
+    const char *, size_t);
+extern uint_t ctf_hash_size(const ctf_hash_t *);
+extern void ctf_hash_destroy(ctf_hash_t *);
+
+#define	ctf_list_prev(elem)	((void *)(((ctf_list_t *)(elem))->l_prev))
+#define	ctf_list_next(elem)	((void *)(((ctf_list_t *)(elem))->l_next))
+
+extern void ctf_list_append(ctf_list_t *, void *);
+extern void ctf_list_prepend(ctf_list_t *, void *);
+extern void ctf_list_delete(ctf_list_t *, void *);
+
+extern void ctf_dtd_insert(ctf_file_t *, ctf_dtdef_t *);
+extern void ctf_dtd_delete(ctf_file_t *, ctf_dtdef_t *);
+extern ctf_dtdef_t *ctf_dtd_lookup(ctf_file_t *, ctf_id_t);
+
+extern void ctf_decl_init(ctf_decl_t *, char *, size_t);
+extern void ctf_decl_fini(ctf_decl_t *);
+extern void ctf_decl_push(ctf_decl_t *, ctf_file_t *, ctf_id_t);
+extern void ctf_decl_sprintf(ctf_decl_t *, const char *, ...);
+
+extern const char *ctf_strraw(ctf_file_t *, uint_t);
+extern const char *ctf_strptr(ctf_file_t *, uint_t);
+
+extern ctf_file_t *ctf_set_open_errno(int *, int);
+extern long ctf_set_errno(ctf_file_t *, int);
+
+extern const void *ctf_sect_mmap(ctf_sect_t *, int);
+extern void ctf_sect_munmap(const ctf_sect_t *);
+
+extern void *ctf_data_alloc(size_t);
+extern void ctf_data_free(void *, size_t);
+extern void ctf_data_protect(void *, size_t);
+
+extern void *ctf_alloc(size_t);
+extern void ctf_free(void *, size_t);
+
+extern char *ctf_strdup(const char *);
+extern const char *ctf_strerror(int);
+extern void ctf_dprintf(const char *, ...);
+
+extern void *ctf_zopen(int *);
+
+extern const char _CTF_SECTION[];	/* name of CTF ELF section */
+extern const char _CTF_NULLSTR[];	/* empty string */
+
+extern int _libctf_version;		/* library client version */
+extern int _libctf_debug;		/* debugging messages enabled */
+
+#ifdef VBOX
+# ifndef MAP_FAILED /* returned by ctf_data_alloc on failure. */
+#  define MAP_FAILED ((void *)~(uintptr_t)0)
+# endif
+#endif
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _CTF_IMPL_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_labels.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_labels.c
new file mode 100644
index 0000000..14ef2e5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_labels.c
@@ -0,0 +1,155 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2002-2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <ctf_impl.h>
+
+static int
+extract_label_info(ctf_file_t *fp, const ctf_lblent_t **ctl, uint_t *num_labels)
+{
+	const ctf_header_t *h;
+
+	/*
+	 * Labels are only supported in V2 or later
+	 */
+	if (fp->ctf_version < CTF_VERSION_2)
+		return (ctf_set_errno(fp, ECTF_NOTSUP));
+
+	h = (const ctf_header_t *)fp->ctf_data.cts_data;
+
+	/* LINTED - pointer alignment */
+	*ctl = (const ctf_lblent_t *)(fp->ctf_buf + h->cth_lbloff);
+	*num_labels = (h->cth_objtoff - h->cth_lbloff) / sizeof (ctf_lblent_t);
+
+	return (0);
+}
+
+/*
+ * Returns the topmost label, or NULL if any errors are encountered
+ */
+const char *
+ctf_label_topmost(ctf_file_t *fp)
+{
+	const ctf_lblent_t *ctlp;
+	const char *s;
+	uint_t num_labels;
+
+	if (extract_label_info(fp, &ctlp, &num_labels) == CTF_ERR)
+		return (NULL); /* errno is set */
+
+	if (num_labels == 0) {
+		(void) ctf_set_errno(fp, ECTF_NOLABELDATA);
+		return (NULL);
+	}
+
+	if ((s = ctf_strraw(fp, (ctlp + num_labels - 1)->ctl_label)) == NULL)
+		(void) ctf_set_errno(fp, ECTF_CORRUPT);
+
+	return (s);
+}
+
+/*
+ * Iterate over all labels.  We pass the label string and the lblinfo_t struct
+ * to the specified callback function.
+ */
+int
+ctf_label_iter(ctf_file_t *fp, ctf_label_f *func, void *arg)
+{
+	const ctf_lblent_t *ctlp;
+	uint_t i, num_labels;
+	ctf_lblinfo_t linfo;
+	const char *lname;
+	int rc;
+
+	if (extract_label_info(fp, &ctlp, &num_labels) == CTF_ERR)
+		return (CTF_ERR); /* errno is set */
+
+	if (num_labels == 0)
+		return (ctf_set_errno(fp, ECTF_NOLABELDATA));
+
+	for (i = 0; i < num_labels; i++, ctlp++) {
+		if ((lname = ctf_strraw(fp, ctlp->ctl_label)) == NULL) {
+			ctf_dprintf("failed to decode label %u with "
+			    "typeidx %u\n", ctlp->ctl_label, ctlp->ctl_typeidx);
+			return (ctf_set_errno(fp, ECTF_CORRUPT));
+		}
+
+		linfo.ctb_typeidx = ctlp->ctl_typeidx;
+		if ((rc = func(lname, &linfo, arg)) != 0)
+			return (rc);
+	}
+
+	return (0);
+}
+
+typedef struct linfo_cb_arg {
+	const char *lca_name;    /* Label we want to retrieve info for */
+	ctf_lblinfo_t *lca_info; /* Where to store the info about the label */
+} linfo_cb_arg_t;
+
+static int
+label_info_cb(const char *lname, const ctf_lblinfo_t *linfo, void *arg)
+{
+	/*
+	 * If lname matches the label we are looking for, copy the
+	 * lblinfo_t struct for the caller.
+	 */
+	if (strcmp(lname, ((linfo_cb_arg_t *)arg)->lca_name) == 0) {
+		/*
+		 * Allow caller not to allocate storage to test if label exists
+		 */
+		if (((linfo_cb_arg_t *)arg)->lca_info != NULL)
+			bcopy(linfo, ((linfo_cb_arg_t *)arg)->lca_info,
+			    sizeof (ctf_lblinfo_t));
+		return (1); /* Indicate we found a match */
+	}
+
+	return (0);
+}
+
+/*
+ * Retrieve information about the label with name "lname"
+ */
+int
+ctf_label_info(ctf_file_t *fp, const char *lname, ctf_lblinfo_t *linfo)
+{
+	linfo_cb_arg_t cb_arg;
+	int rc;
+
+	cb_arg.lca_name = lname;
+	cb_arg.lca_info = linfo;
+
+	if ((rc = ctf_label_iter(fp, label_info_cb, &cb_arg)) == CTF_ERR)
+		return (rc);
+
+	if (rc != 1)
+		return (ctf_set_errno(fp, ECTF_NOLABEL));
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_lookup.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_lookup.c
new file mode 100644
index 0000000..2d80388
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_lookup.c
@@ -0,0 +1,317 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/sysmacros.h>
+#else  /* VBOX */
+# include <ctype.h>
+#endif /* VBOX */
+#include <ctf_impl.h>
+
+/*
+ * Compare the given input string and length against a table of known C storage
+ * qualifier keywords.  We just ignore these in ctf_lookup_by_name, below.  To
+ * do this quickly, we use a pre-computed Perfect Hash Function similar to the
+ * technique originally described in the classic paper:
+ *
+ * R.J. Cichelli, "Minimal Perfect Hash Functions Made Simple",
+ * Communications of the ACM, Volume 23, Issue 1, January 1980, pp. 17-19.
+ *
+ * For an input string S of length N, we use hash H = S[N - 1] + N - 105, which
+ * for the current set of qualifiers yields a unique H in the range [0 .. 20].
+ * The hash can be modified when the keyword set changes as necessary.  We also
+ * store the length of each keyword and check it prior to the final strcmp().
+ */
+static int
+isqualifier(const char *s, size_t len)
+{
+	static const struct qual {
+		const char *q_name;
+		size_t q_len;
+	} qhash[] = {
+		{ "static", 6 }, { "", 0 }, { "", 0 }, { "", 0 },
+		{ "volatile", 8 }, { "", 0 }, { "", 0 }, { "", 0 }, { "", 0 },
+		{ "", 0 }, { "auto", 4 }, { "extern", 6 }, { "", 0 }, { "", 0 },
+		{ "", 0 }, { "", 0 }, { "const", 5 }, { "register", 8 },
+		{ "", 0 }, { "restrict", 8 }, { "_Restrict", 9 }
+	};
+
+	int h = s[len - 1] + (int)len - 105;
+	const struct qual *qp = &qhash[h];
+
+	return (h >= 0 && h < sizeof (qhash) / sizeof (qhash[0]) &&
+	    len == qp->q_len && strncmp(qp->q_name, s, qp->q_len) == 0);
+}
+
+/*
+ * Attempt to convert the given C type name into the corresponding CTF type ID.
+ * It is not possible to do complete and proper conversion of type names
+ * without implementing a more full-fledged parser, which is necessary to
+ * handle things like types that are function pointers to functions that
+ * have arguments that are function pointers, and fun stuff like that.
+ * Instead, this function implements a very simple conversion algorithm that
+ * finds the things that we actually care about: structs, unions, enums,
+ * integers, floats, typedefs, and pointers to any of these named types.
+ */
+ctf_id_t
+ctf_lookup_by_name(ctf_file_t *fp, const char *name)
+{
+	static const char delimiters[] = " \t\n\r\v\f*";
+
+	const ctf_lookup_t *lp;
+	const ctf_helem_t *hp;
+	const char *p, *q, *end;
+	ctf_id_t type = 0;
+	ctf_id_t ntype, ptype;
+
+	if (name == NULL)
+		return (ctf_set_errno(fp, EINVAL));
+
+	for (p = name, end = name + strlen(name); *p != '\0'; p = q) {
+		while (isspace(*p))
+			p++; /* skip leading ws */
+
+		if (p == end)
+			break;
+
+		if ((q = strpbrk(p + 1, delimiters)) == NULL)
+			q = end; /* compare until end */
+
+		if (*p == '*') {
+			/*
+			 * Find a pointer to type by looking in fp->ctf_ptrtab.
+			 * If we can't find a pointer to the given type, see if
+			 * we can compute a pointer to the type resulting from
+			 * resolving the type down to its base type and use
+			 * that instead.  This helps with cases where the CTF
+			 * data includes "struct foo *" but not "foo_t *" and
+			 * the user tries to access "foo_t *" in the debugger.
+			 */
+			ntype = fp->ctf_ptrtab[CTF_TYPE_TO_INDEX(type)];
+			if (ntype == 0) {
+				ntype = ctf_type_resolve(fp, type);
+				if (ntype == CTF_ERR || (ntype = fp->ctf_ptrtab[
+				    CTF_TYPE_TO_INDEX(ntype)]) == 0) {
+					(void) ctf_set_errno(fp, ECTF_NOTYPE);
+					goto err;
+				}
+			}
+
+			type = CTF_INDEX_TO_TYPE(ntype,
+			    (fp->ctf_flags & LCTF_CHILD));
+
+			q = p + 1;
+			continue;
+		}
+
+		if (isqualifier(p, (size_t)(q - p)))
+			continue; /* skip qualifier keyword */
+
+		for (lp = fp->ctf_lookups; lp->ctl_prefix != NULL; lp++) {
+			if (lp->ctl_prefix[0] == '\0' ||
+			    strncmp(p, lp->ctl_prefix, (size_t)(q - p)) == 0) {
+				for (p += lp->ctl_len; isspace(*p); p++)
+					continue; /* skip prefix and next ws */
+
+				if ((q = strchr(p, '*')) == NULL)
+					q = end;  /* compare until end */
+
+				while (isspace(q[-1]))
+					q--;	  /* exclude trailing ws */
+
+				if ((hp = ctf_hash_lookup(lp->ctl_hash, fp, p,
+				    (size_t)(q - p))) == NULL) {
+					(void) ctf_set_errno(fp, ECTF_NOTYPE);
+					goto err;
+				}
+
+				type = hp->h_type;
+				break;
+			}
+		}
+
+		if (lp->ctl_prefix == NULL) {
+			(void) ctf_set_errno(fp, ECTF_NOTYPE);
+			goto err;
+		}
+	}
+
+	if (*p != '\0' || type == 0)
+		return (ctf_set_errno(fp, ECTF_SYNTAX));
+
+	return (type);
+
+err:
+	if (fp->ctf_parent != NULL &&
+	    (ptype = ctf_lookup_by_name(fp->ctf_parent, name)) != CTF_ERR)
+		return (ptype);
+
+	return (CTF_ERR);
+}
+
+/*
+ * Given a symbol table index, return the type of the data object described
+ * by the corresponding entry in the symbol table.
+ */
+ctf_id_t
+ctf_lookup_by_symbol(ctf_file_t *fp, ulong_t symidx)
+{
+	const ctf_sect_t *sp = &fp->ctf_symtab;
+	ctf_id_t type;
+
+	if (sp->cts_data == NULL)
+		return (ctf_set_errno(fp, ECTF_NOSYMTAB));
+
+	if (symidx >= fp->ctf_nsyms)
+		return (ctf_set_errno(fp, EINVAL));
+
+	if (sp->cts_entsize == sizeof (Elf32_Sym)) {
+		const Elf32_Sym *symp = (Elf32_Sym *)sp->cts_data + symidx;
+		if (ELF32_ST_TYPE(symp->st_info) != STT_OBJECT)
+			return (ctf_set_errno(fp, ECTF_NOTDATA));
+	} else {
+		const Elf64_Sym *symp = (Elf64_Sym *)sp->cts_data + symidx;
+		if (ELF64_ST_TYPE(symp->st_info) != STT_OBJECT)
+			return (ctf_set_errno(fp, ECTF_NOTDATA));
+	}
+
+	if (fp->ctf_sxlate[symidx] == ~0u /*VBOX: -1u*/)
+		return (ctf_set_errno(fp, ECTF_NOTYPEDAT));
+
+	type = *(ushort_t *)((uintptr_t)fp->ctf_buf + fp->ctf_sxlate[symidx]);
+	if (type == 0)
+		return (ctf_set_errno(fp, ECTF_NOTYPEDAT));
+
+	return (type);
+}
+
+/*
+ * Return the pointer to the internal CTF type data corresponding to the
+ * given type ID.  If the ID is invalid, the function returns NULL.
+ * This function is not exported outside of the library.
+ */
+const ctf_type_t *
+ctf_lookup_by_id(ctf_file_t **fpp, ctf_id_t type)
+{
+	ctf_file_t *fp = *fpp; /* caller passes in starting CTF container */
+
+	if ((fp->ctf_flags & LCTF_CHILD) && CTF_TYPE_ISPARENT(type) &&
+	    (fp = fp->ctf_parent) == NULL) {
+		(void) ctf_set_errno(*fpp, ECTF_NOPARENT);
+		return (NULL);
+	}
+
+	type = CTF_TYPE_TO_INDEX(type);
+	if (type > 0 && type <= fp->ctf_typemax) {
+		*fpp = fp; /* function returns ending CTF container */
+		return (LCTF_INDEX_TO_TYPEPTR(fp, type));
+	}
+
+	(void) ctf_set_errno(fp, ECTF_BADID);
+	return (NULL);
+}
+
+/*
+ * Given a symbol table index, return the info for the function described
+ * by the corresponding entry in the symbol table.
+ */
+int
+ctf_func_info(ctf_file_t *fp, ulong_t symidx, ctf_funcinfo_t *fip)
+{
+	const ctf_sect_t *sp = &fp->ctf_symtab;
+	const ushort_t *dp;
+	ushort_t info, kind, n;
+
+	if (sp->cts_data == NULL)
+		return (ctf_set_errno(fp, ECTF_NOSYMTAB));
+
+	if (symidx >= fp->ctf_nsyms)
+		return (ctf_set_errno(fp, EINVAL));
+
+	if (sp->cts_entsize == sizeof (Elf32_Sym)) {
+		const Elf32_Sym *symp = (Elf32_Sym *)sp->cts_data + symidx;
+		if (ELF32_ST_TYPE(symp->st_info) != STT_FUNC)
+			return (ctf_set_errno(fp, ECTF_NOTFUNC));
+	} else {
+		const Elf64_Sym *symp = (Elf64_Sym *)sp->cts_data + symidx;
+		if (ELF64_ST_TYPE(symp->st_info) != STT_FUNC)
+			return (ctf_set_errno(fp, ECTF_NOTFUNC));
+	}
+
+	if (fp->ctf_sxlate[symidx] == ~0u /*VBOX: -1u*/)
+		return (ctf_set_errno(fp, ECTF_NOFUNCDAT));
+
+	dp = (ushort_t *)((uintptr_t)fp->ctf_buf + fp->ctf_sxlate[symidx]);
+
+	info = *dp++;
+	kind = LCTF_INFO_KIND(fp, info);
+	n = LCTF_INFO_VLEN(fp, info);
+
+	if (kind == CTF_K_UNKNOWN && n == 0)
+		return (ctf_set_errno(fp, ECTF_NOFUNCDAT));
+
+	if (kind != CTF_K_FUNCTION)
+		return (ctf_set_errno(fp, ECTF_CORRUPT));
+
+	fip->ctc_return = *dp++;
+	fip->ctc_argc = n;
+	fip->ctc_flags = 0;
+
+	if (n != 0 && dp[n - 1] == 0) {
+		fip->ctc_flags |= CTF_FUNC_VARARG;
+		fip->ctc_argc--;
+	}
+
+	return (0);
+}
+
+/*
+ * Given a symbol table index, return the arguments for the function described
+ * by the corresponding entry in the symbol table.
+ */
+int
+ctf_func_args(ctf_file_t *fp, ulong_t symidx, uint_t argc, ctf_id_t *argv)
+{
+	const ushort_t *dp;
+	ctf_funcinfo_t f;
+
+	if (ctf_func_info(fp, symidx, &f) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	/*
+	 * The argument data is two ushort_t's past the translation table
+	 * offset: one for the function info, and one for the return type.
+	 */
+	dp = (ushort_t *)((uintptr_t)fp->ctf_buf + fp->ctf_sxlate[symidx]) + 2;
+
+	for (argc = MIN(argc, f.ctc_argc); argc != 0; argc--)
+		*argv++ = *dp++;
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_open.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_open.c
new file mode 100644
index 0000000..125f6bc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_open.c
@@ -0,0 +1,972 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#ifndef VBOX
+#include <ctf_impl.h>
+#include <sys/mman.h>
+#include <sys/zmod.h>
+#else  /* VBOX */
+# define CTF_OLD_VERSIONS
+# include <ctf_impl.h>
+# include <zlib.h>
+# define z_compress     compress
+# define z_uncompress   uncompress
+# define z_strerror     zError
+#endif /* VBOX */
+
+static const ctf_dmodel_t _libctf_models[] = {
+	{ "ILP32", CTF_MODEL_ILP32, 4, 1, 2, 4, 4 },
+	{ "LP64", CTF_MODEL_LP64, 8, 1, 2, 4, 8 },
+	{ NULL, 0, 0, 0, 0, 0, 0 }
+};
+
+const char _CTF_SECTION[] = ".SUNW_ctf";
+const char _CTF_NULLSTR[] = "";
+
+int _libctf_version = CTF_VERSION;	/* library client version */
+int _libctf_debug = 0;			/* debugging messages enabled */
+
+static ushort_t
+get_kind_v1(ushort_t info)
+{
+	return (CTF_INFO_KIND_V1(info));
+}
+
+static ushort_t
+get_kind_v2(ushort_t info)
+{
+	return (CTF_INFO_KIND(info));
+}
+
+static ushort_t
+get_root_v1(ushort_t info)
+{
+	return (CTF_INFO_ISROOT_V1(info));
+}
+
+static ushort_t
+get_root_v2(ushort_t info)
+{
+	return (CTF_INFO_ISROOT(info));
+}
+
+static ushort_t
+get_vlen_v1(ushort_t info)
+{
+	return (CTF_INFO_VLEN_V1(info));
+}
+
+static ushort_t
+get_vlen_v2(ushort_t info)
+{
+	return (CTF_INFO_VLEN(info));
+}
+
+static const ctf_fileops_t ctf_fileops[] = {
+	{ NULL, NULL },
+	{ get_kind_v1, get_root_v1, get_vlen_v1 },
+	{ get_kind_v2, get_root_v2, get_vlen_v2 },
+};
+
+/*
+ * Convert a 32-bit ELF symbol into GElf (Elf64) and return a pointer to it.
+ */
+static Elf64_Sym *
+sym_to_gelf(const Elf32_Sym *src, Elf64_Sym *dst)
+{
+	dst->st_name = src->st_name;
+	dst->st_value = src->st_value;
+	dst->st_size = src->st_size;
+	dst->st_info = src->st_info;
+	dst->st_other = src->st_other;
+	dst->st_shndx = src->st_shndx;
+
+	return (dst);
+}
+
+/*
+ * Initialize the symtab translation table by filling each entry with the
+ * offset of the CTF type or function data corresponding to each STT_FUNC or
+ * STT_OBJECT entry in the symbol table.
+ */
+static int
+init_symtab(ctf_file_t *fp, const ctf_header_t *hp,
+    const ctf_sect_t *sp, const ctf_sect_t *strp)
+{
+	const uchar_t *symp = sp->cts_data;
+	uint_t *xp = fp->ctf_sxlate;
+	uint_t *xend = xp + fp->ctf_nsyms;
+
+	uint_t objtoff = hp->cth_objtoff;
+	uint_t funcoff = hp->cth_funcoff;
+
+	ushort_t info, vlen;
+	Elf64_Sym sym, *gsp;
+	const char *name;
+
+	/*
+	 * The CTF data object and function type sections are ordered to match
+	 * the relative order of the respective symbol types in the symtab.
+	 * If no type information is available for a symbol table entry, a
+	 * pad is inserted in the CTF section.  As a further optimization,
+	 * anonymous or undefined symbols are omitted from the CTF data.
+	 */
+	for (; xp < xend; xp++, symp += sp->cts_entsize) {
+		if (sp->cts_entsize == sizeof (Elf32_Sym))
+			gsp = sym_to_gelf((Elf32_Sym *)(uintptr_t)symp, &sym);
+		else
+			gsp = (Elf64_Sym *)(uintptr_t)symp;
+
+		if (gsp->st_name < strp->cts_size)
+			name = (const char *)strp->cts_data + gsp->st_name;
+		else
+			name = _CTF_NULLSTR;
+
+		if (gsp->st_name == 0 || gsp->st_shndx == SHN_UNDEF ||
+		    strcmp(name, "_START_") == 0 ||
+		    strcmp(name, "_END_") == 0) {
+			*xp = ~0u /*VBOX: -1u*/;
+			continue;
+		}
+
+		switch (ELF64_ST_TYPE(gsp->st_info)) {
+		case STT_OBJECT:
+			if (objtoff >= hp->cth_funcoff ||
+			    (gsp->st_shndx == SHN_ABS && gsp->st_value == 0)) {
+				*xp = ~0u /*VBOX: -1u*/;
+				break;
+			}
+
+			*xp = objtoff;
+			objtoff += sizeof (ushort_t);
+			break;
+
+		case STT_FUNC:
+			if (funcoff >= hp->cth_typeoff) {
+				*xp = ~0u /*VBOX: -1u*/;
+				break;
+			}
+
+			*xp = funcoff;
+
+			info = *(ushort_t *)((uintptr_t)fp->ctf_buf + funcoff);
+			vlen = LCTF_INFO_VLEN(fp, info);
+
+			/*
+			 * If we encounter a zero pad at the end, just skip it.
+			 * Otherwise skip over the function and its return type
+			 * (+2) and the argument list (vlen).
+			 */
+			if (LCTF_INFO_KIND(fp, info) == CTF_K_UNKNOWN &&
+			    vlen == 0)
+				funcoff += sizeof (ushort_t); /* skip pad */
+			else
+				funcoff += sizeof (ushort_t) * (vlen + 2);
+			break;
+
+		default:
+			*xp = ~0u /*VBOX: -1u*/;
+			break;
+		}
+	}
+
+	ctf_dprintf("loaded %lu symtab entries\n", fp->ctf_nsyms);
+	return (0);
+}
+
+/*
+ * Initialize the type ID translation table with the byte offset of each type,
+ * and initialize the hash tables of each named type.
+ */
+static int
+init_types(ctf_file_t *fp, const ctf_header_t *cth)
+{
+	/* LINTED - pointer alignment */
+	const ctf_type_t *tbuf = (ctf_type_t *)(fp->ctf_buf + cth->cth_typeoff);
+	/* LINTED - pointer alignment */
+	const ctf_type_t *tend = (ctf_type_t *)(fp->ctf_buf + cth->cth_stroff);
+
+	ulong_t pop[CTF_K_MAX + 1] = { 0 };
+	const ctf_type_t *tp;
+	ctf_hash_t *hp;
+	ushort_t id, dst;
+	uint_t *xp;
+
+	/*
+	 * We initially determine whether the container is a child or a parent
+	 * based on the value of cth_parname.  To support containers that pre-
+	 * date cth_parname, we also scan the types themselves for references
+	 * to values in the range reserved for child types in our first pass.
+	 */
+	int child = cth->cth_parname != 0;
+	int nlstructs = 0, nlunions = 0;
+	int err;
+
+	/*
+	 * We make two passes through the entire type section.  In this first
+	 * pass, we count the number of each type and the total number of types.
+	 */
+	for (tp = tbuf; tp < tend; fp->ctf_typemax++) {
+		ushort_t kind = LCTF_INFO_KIND(fp, tp->ctt_info);
+		ulong_t vlen = LCTF_INFO_VLEN(fp, tp->ctt_info);
+		ssize_t size, increment;
+
+		size_t vbytes;
+		uint_t n;
+
+		(void) ctf_get_ctt_size(fp, tp, &size, &increment);
+
+		switch (kind) {
+		case CTF_K_INTEGER:
+		case CTF_K_FLOAT:
+			vbytes = sizeof (uint_t);
+			break;
+		case CTF_K_ARRAY:
+			vbytes = sizeof (ctf_array_t);
+			break;
+		case CTF_K_FUNCTION:
+			vbytes = sizeof (ushort_t) * (vlen + (vlen & 1));
+			break;
+		case CTF_K_STRUCT:
+		case CTF_K_UNION:
+			if (fp->ctf_version == CTF_VERSION_1 ||
+			    size < CTF_LSTRUCT_THRESH) {
+				ctf_member_t *mp = (ctf_member_t *)
+				    ((uintptr_t)tp + increment);
+
+				vbytes = sizeof (ctf_member_t) * vlen;
+				for (n = vlen; n != 0; n--, mp++)
+					child |= CTF_TYPE_ISCHILD(mp->ctm_type);
+			} else {
+				ctf_lmember_t *lmp = (ctf_lmember_t *)
+				    ((uintptr_t)tp + increment);
+
+				vbytes = sizeof (ctf_lmember_t) * vlen;
+				for (n = vlen; n != 0; n--, lmp++)
+					child |=
+					    CTF_TYPE_ISCHILD(lmp->ctlm_type);
+			}
+			break;
+		case CTF_K_ENUM:
+			vbytes = sizeof (ctf_enum_t) * vlen;
+			break;
+		case CTF_K_FORWARD:
+			/*
+			 * For forward declarations, ctt_type is the CTF_K_*
+			 * kind for the tag, so bump that population count too.
+			 * If ctt_type is unknown, treat the tag as a struct.
+			 */
+			if (tp->ctt_type == CTF_K_UNKNOWN ||
+			    tp->ctt_type >= CTF_K_MAX)
+				pop[CTF_K_STRUCT]++;
+			else
+				pop[tp->ctt_type]++;
+			/*FALLTHRU*/
+		case CTF_K_UNKNOWN:
+			vbytes = 0;
+			break;
+		case CTF_K_POINTER:
+		case CTF_K_TYPEDEF:
+		case CTF_K_VOLATILE:
+		case CTF_K_CONST:
+		case CTF_K_RESTRICT:
+			child |= CTF_TYPE_ISCHILD(tp->ctt_type);
+			vbytes = 0;
+			break;
+		default:
+			ctf_dprintf("detected invalid CTF kind -- %u\n", kind);
+			return (ECTF_CORRUPT);
+		}
+		tp = (ctf_type_t *)((uintptr_t)tp + increment + vbytes);
+		pop[kind]++;
+	}
+
+	/*
+	 * If we detected a reference to a child type ID, then we know this
+	 * container is a child and may have a parent's types imported later.
+	 */
+	if (child) {
+		ctf_dprintf("CTF container %p is a child\n", (void *)fp);
+		fp->ctf_flags |= LCTF_CHILD;
+	} else
+		ctf_dprintf("CTF container %p is a parent\n", (void *)fp);
+
+	/*
+	 * Now that we've counted up the number of each type, we can allocate
+	 * the hash tables, type translation table, and pointer table.
+	 */
+	if ((err = ctf_hash_create(&fp->ctf_structs, pop[CTF_K_STRUCT])) != 0)
+		return (err);
+
+	if ((err = ctf_hash_create(&fp->ctf_unions, pop[CTF_K_UNION])) != 0)
+		return (err);
+
+	if ((err = ctf_hash_create(&fp->ctf_enums, pop[CTF_K_ENUM])) != 0)
+		return (err);
+
+	if ((err = ctf_hash_create(&fp->ctf_names,
+	    pop[CTF_K_INTEGER] + pop[CTF_K_FLOAT] + pop[CTF_K_FUNCTION] +
+	    pop[CTF_K_TYPEDEF] + pop[CTF_K_POINTER] + pop[CTF_K_VOLATILE] +
+	    pop[CTF_K_CONST] + pop[CTF_K_RESTRICT])) != 0)
+		return (err);
+
+	fp->ctf_txlate = ctf_alloc(sizeof (uint_t) * (fp->ctf_typemax + 1));
+	fp->ctf_ptrtab = ctf_alloc(sizeof (ushort_t) * (fp->ctf_typemax + 1));
+
+	if (fp->ctf_txlate == NULL || fp->ctf_ptrtab == NULL)
+		return (EAGAIN); /* memory allocation failed */
+
+	xp = fp->ctf_txlate;
+	*xp++ = 0; /* type id 0 is used as a sentinel value */
+
+	bzero(fp->ctf_txlate, sizeof (uint_t) * (fp->ctf_typemax + 1));
+	bzero(fp->ctf_ptrtab, sizeof (ushort_t) * (fp->ctf_typemax + 1));
+
+	/*
+	 * In the second pass through the types, we fill in each entry of the
+	 * type and pointer tables and add names to the appropriate hashes.
+	 */
+	for (id = 1, tp = tbuf; tp < tend; xp++, id++) {
+		ushort_t kind = LCTF_INFO_KIND(fp, tp->ctt_info);
+		ulong_t vlen = LCTF_INFO_VLEN(fp, tp->ctt_info);
+		ssize_t size, increment;
+
+		const char *name;
+		size_t vbytes;
+		ctf_helem_t *hep;
+		ctf_encoding_t cte;
+
+		(void) ctf_get_ctt_size(fp, tp, &size, &increment);
+		name = ctf_strptr(fp, tp->ctt_name);
+
+		switch (kind) {
+		case CTF_K_INTEGER:
+		case CTF_K_FLOAT:
+			/*
+			 * Only insert a new integer base type definition if
+			 * this type name has not been defined yet.  We re-use
+			 * the names with different encodings for bit-fields.
+			 */
+			if ((hep = ctf_hash_lookup(&fp->ctf_names, fp,
+			    name, strlen(name))) == NULL) {
+				err = ctf_hash_insert(&fp->ctf_names, fp,
+				    CTF_INDEX_TO_TYPE(id, child), tp->ctt_name);
+				if (err != 0 && err != ECTF_STRTAB)
+					return (err);
+			} else if (ctf_type_encoding(fp, hep->h_type,
+			    &cte) == 0 && cte.cte_bits == 0) {
+				/*
+				 * Work-around SOS8 stabs bug: replace existing
+				 * intrinsic w/ same name if it was zero bits.
+				 */
+				hep->h_type = CTF_INDEX_TO_TYPE(id, child);
+			}
+			vbytes = sizeof (uint_t);
+			break;
+
+		case CTF_K_ARRAY:
+			vbytes = sizeof (ctf_array_t);
+			break;
+
+		case CTF_K_FUNCTION:
+			err = ctf_hash_insert(&fp->ctf_names, fp,
+			    CTF_INDEX_TO_TYPE(id, child), tp->ctt_name);
+			if (err != 0 && err != ECTF_STRTAB)
+				return (err);
+			vbytes = sizeof (ushort_t) * (vlen + (vlen & 1));
+			break;
+
+		case CTF_K_STRUCT:
+			err = ctf_hash_define(&fp->ctf_structs, fp,
+			    CTF_INDEX_TO_TYPE(id, child), tp->ctt_name);
+
+			if (err != 0 && err != ECTF_STRTAB)
+				return (err);
+
+			if (fp->ctf_version == CTF_VERSION_1 ||
+			    size < CTF_LSTRUCT_THRESH)
+				vbytes = sizeof (ctf_member_t) * vlen;
+			else {
+				vbytes = sizeof (ctf_lmember_t) * vlen;
+				nlstructs++;
+			}
+			break;
+
+		case CTF_K_UNION:
+			err = ctf_hash_define(&fp->ctf_unions, fp,
+			    CTF_INDEX_TO_TYPE(id, child), tp->ctt_name);
+
+			if (err != 0 && err != ECTF_STRTAB)
+				return (err);
+
+			if (fp->ctf_version == CTF_VERSION_1 ||
+			    size < CTF_LSTRUCT_THRESH)
+				vbytes = sizeof (ctf_member_t) * vlen;
+			else {
+				vbytes = sizeof (ctf_lmember_t) * vlen;
+				nlunions++;
+			}
+			break;
+
+		case CTF_K_ENUM:
+			err = ctf_hash_define(&fp->ctf_enums, fp,
+			    CTF_INDEX_TO_TYPE(id, child), tp->ctt_name);
+
+			if (err != 0 && err != ECTF_STRTAB)
+				return (err);
+
+			vbytes = sizeof (ctf_enum_t) * vlen;
+			break;
+
+		case CTF_K_TYPEDEF:
+			err = ctf_hash_insert(&fp->ctf_names, fp,
+			    CTF_INDEX_TO_TYPE(id, child), tp->ctt_name);
+			if (err != 0 && err != ECTF_STRTAB)
+				return (err);
+			vbytes = 0;
+			break;
+
+		case CTF_K_FORWARD:
+			/*
+			 * Only insert forward tags into the given hash if the
+			 * type or tag name is not already present.
+			 */
+			switch (tp->ctt_type) {
+			case CTF_K_STRUCT:
+				hp = &fp->ctf_structs;
+				break;
+			case CTF_K_UNION:
+				hp = &fp->ctf_unions;
+				break;
+			case CTF_K_ENUM:
+				hp = &fp->ctf_enums;
+				break;
+			default:
+				hp = &fp->ctf_structs;
+			}
+
+			if (ctf_hash_lookup(hp, fp,
+			    name, strlen(name)) == NULL) {
+				err = ctf_hash_insert(hp, fp,
+				    CTF_INDEX_TO_TYPE(id, child), tp->ctt_name);
+				if (err != 0 && err != ECTF_STRTAB)
+					return (err);
+			}
+			vbytes = 0;
+			break;
+
+		case CTF_K_POINTER:
+			/*
+			 * If the type referenced by the pointer is in this CTF
+			 * container, then store the index of the pointer type
+			 * in fp->ctf_ptrtab[ index of referenced type ].
+			 */
+			if (CTF_TYPE_ISCHILD(tp->ctt_type) == child &&
+			    CTF_TYPE_TO_INDEX(tp->ctt_type) <= fp->ctf_typemax)
+				fp->ctf_ptrtab[
+				    CTF_TYPE_TO_INDEX(tp->ctt_type)] = id;
+			/*FALLTHRU*/
+
+		case CTF_K_VOLATILE:
+		case CTF_K_CONST:
+		case CTF_K_RESTRICT:
+			err = ctf_hash_insert(&fp->ctf_names, fp,
+			    CTF_INDEX_TO_TYPE(id, child), tp->ctt_name);
+			if (err != 0 && err != ECTF_STRTAB)
+				return (err);
+			/*FALLTHRU*/
+
+		default:
+			vbytes = 0;
+			break;
+		}
+
+		*xp = (uint_t)((uintptr_t)tp - (uintptr_t)fp->ctf_buf);
+		tp = (ctf_type_t *)((uintptr_t)tp + increment + vbytes);
+	}
+
+	ctf_dprintf("%lu total types processed\n", fp->ctf_typemax);
+	ctf_dprintf("%u enum names hashed\n", ctf_hash_size(&fp->ctf_enums));
+	ctf_dprintf("%u struct names hashed (%d long)\n",
+	    ctf_hash_size(&fp->ctf_structs), nlstructs);
+	ctf_dprintf("%u union names hashed (%d long)\n",
+	    ctf_hash_size(&fp->ctf_unions), nlunions);
+	ctf_dprintf("%u base type names hashed\n",
+	    ctf_hash_size(&fp->ctf_names));
+
+	/*
+	 * Make an additional pass through the pointer table to find pointers
+	 * that point to anonymous typedef nodes.  If we find one, modify the
+	 * pointer table so that the pointer is also known to point to the
+	 * node that is referenced by the anonymous typedef node.
+	 */
+	for (id = 1; id <= fp->ctf_typemax; id++) {
+		if ((dst = fp->ctf_ptrtab[id]) != 0) {
+			tp = LCTF_INDEX_TO_TYPEPTR(fp, id);
+
+			if (LCTF_INFO_KIND(fp, tp->ctt_info) == CTF_K_TYPEDEF &&
+			    strcmp(ctf_strptr(fp, tp->ctt_name), "") == 0 &&
+			    CTF_TYPE_ISCHILD(tp->ctt_type) == child &&
+			    CTF_TYPE_TO_INDEX(tp->ctt_type) <= fp->ctf_typemax)
+				fp->ctf_ptrtab[
+				    CTF_TYPE_TO_INDEX(tp->ctt_type)] = dst;
+		}
+	}
+
+	return (0);
+}
+
+/*
+ * Decode the specified CTF buffer and optional symbol table and create a new
+ * CTF container representing the symbolic debugging information.  This code
+ * can be used directly by the debugger, or it can be used as the engine for
+ * ctf_fdopen() or ctf_open(), below.
+ */
+ctf_file_t *
+ctf_bufopen(const ctf_sect_t *ctfsect, const ctf_sect_t *symsect,
+    const ctf_sect_t *strsect, int *errp)
+{
+	const ctf_preamble_t *pp;
+	ctf_header_t hp;
+	ctf_file_t *fp;
+	void *buf, *base;
+	size_t size, hdrsz;
+	int err;
+
+	if (ctfsect == NULL || ((symsect == NULL) != (strsect == NULL)))
+		return (ctf_set_open_errno(errp, EINVAL));
+
+	if (symsect != NULL && symsect->cts_entsize != sizeof (Elf32_Sym) &&
+	    symsect->cts_entsize != sizeof (Elf64_Sym))
+		return (ctf_set_open_errno(errp, ECTF_SYMTAB));
+
+	if (symsect != NULL && symsect->cts_data == NULL)
+		return (ctf_set_open_errno(errp, ECTF_SYMBAD));
+
+	if (strsect != NULL && strsect->cts_data == NULL)
+		return (ctf_set_open_errno(errp, ECTF_STRBAD));
+
+	if (ctfsect->cts_size < sizeof (ctf_preamble_t))
+		return (ctf_set_open_errno(errp, ECTF_NOCTFBUF));
+
+	pp = (const ctf_preamble_t *)ctfsect->cts_data;
+
+	ctf_dprintf("ctf_bufopen: magic=0x%x version=%u\n",
+	    pp->ctp_magic, pp->ctp_version);
+
+	/*
+	 * Validate each part of the CTF header (either V1 or V2).
+	 * First, we validate the preamble (common to all versions).  At that
+	 * point, we know specific header version, and can validate the
+	 * version-specific parts including section offsets and alignments.
+	 */
+	if (pp->ctp_magic != CTF_MAGIC)
+		return (ctf_set_open_errno(errp, ECTF_NOCTFBUF));
+
+	if (pp->ctp_version == CTF_VERSION_2) {
+		if (ctfsect->cts_size < sizeof (ctf_header_t))
+			return (ctf_set_open_errno(errp, ECTF_NOCTFBUF));
+
+		bcopy(ctfsect->cts_data, &hp, sizeof (hp));
+		hdrsz = sizeof (ctf_header_t);
+
+	} else if (pp->ctp_version == CTF_VERSION_1) {
+		const ctf_header_v1_t *h1p =
+		    (const ctf_header_v1_t *)ctfsect->cts_data;
+
+		if (ctfsect->cts_size < sizeof (ctf_header_v1_t))
+			return (ctf_set_open_errno(errp, ECTF_NOCTFBUF));
+
+		bzero(&hp, sizeof (hp));
+		hp.cth_preamble = h1p->cth_preamble;
+		hp.cth_objtoff = h1p->cth_objtoff;
+		hp.cth_funcoff = h1p->cth_funcoff;
+		hp.cth_typeoff = h1p->cth_typeoff;
+		hp.cth_stroff = h1p->cth_stroff;
+		hp.cth_strlen = h1p->cth_strlen;
+
+		hdrsz = sizeof (ctf_header_v1_t);
+	} else
+		return (ctf_set_open_errno(errp, ECTF_CTFVERS));
+
+	size = hp.cth_stroff + hp.cth_strlen;
+
+	ctf_dprintf("ctf_bufopen: uncompressed size=%lu\n", (ulong_t)size);
+
+	if (hp.cth_lbloff > size || hp.cth_objtoff > size ||
+	    hp.cth_funcoff > size || hp.cth_typeoff > size ||
+	    hp.cth_stroff > size)
+		return (ctf_set_open_errno(errp, ECTF_CORRUPT));
+
+	if (hp.cth_lbloff > hp.cth_objtoff ||
+	    hp.cth_objtoff > hp.cth_funcoff ||
+	    hp.cth_funcoff > hp.cth_typeoff ||
+	    hp.cth_typeoff > hp.cth_stroff)
+		return (ctf_set_open_errno(errp, ECTF_CORRUPT));
+
+	if ((hp.cth_lbloff & 3) || (hp.cth_objtoff & 1) ||
+	    (hp.cth_funcoff & 1) || (hp.cth_typeoff & 3))
+		return (ctf_set_open_errno(errp, ECTF_CORRUPT));
+
+	/*
+	 * Once everything is determined to be valid, attempt to decompress
+	 * the CTF data buffer if it is compressed.  Otherwise we just put
+	 * the data section's buffer pointer into ctf_buf, below.
+	 */
+	if (hp.cth_flags & CTF_F_COMPRESS) {
+#ifndef VBOX
+		size_t srclen, dstlen;
+#else
+		uLong srclen;
+		uLong dstlen;
+#endif
+		const void *src;
+		int rc = Z_OK;
+
+#ifndef VBOX
+		if (ctf_zopen(errp) == NULL)
+			return (NULL); /* errp is set for us */
+#endif
+
+		if ((base = ctf_data_alloc(size + hdrsz)) == MAP_FAILED)
+			return (ctf_set_open_errno(errp, ECTF_ZALLOC));
+
+		bcopy(ctfsect->cts_data, base, hdrsz);
+		((ctf_preamble_t *)base)->ctp_flags &= ~CTF_F_COMPRESS;
+		buf = (uchar_t *)base + hdrsz;
+
+		src = (uchar_t *)ctfsect->cts_data + hdrsz;
+		srclen = VBDTCAST(uLong)(ctfsect->cts_size - hdrsz);
+		dstlen = VBDTCAST(uLong)size;
+
+		if ((rc = z_uncompress(buf, &dstlen, src, srclen)) != Z_OK) {
+			ctf_dprintf("zlib inflate err: %s\n", z_strerror(rc));
+			ctf_data_free(base, size + hdrsz);
+			return (ctf_set_open_errno(errp, ECTF_DECOMPRESS));
+		}
+
+		if (dstlen != size) {
+			ctf_dprintf("zlib inflate short -- got %lu of %lu "
+			    "bytes\n", (ulong_t)dstlen, (ulong_t)size);
+			ctf_data_free(base, size + hdrsz);
+			return (ctf_set_open_errno(errp, ECTF_CORRUPT));
+		}
+
+		ctf_data_protect(base, size + hdrsz);
+
+	} else {
+		base = (void *)ctfsect->cts_data;
+		buf = (uchar_t *)base + hdrsz;
+	}
+
+	/*
+	 * Once we have uncompressed and validated the CTF data buffer, we can
+	 * proceed with allocating a ctf_file_t and initializing it.
+	 */
+	if ((fp = ctf_alloc(sizeof (ctf_file_t))) == NULL)
+		return (ctf_set_open_errno(errp, EAGAIN));
+
+	bzero(fp, sizeof (ctf_file_t));
+	fp->ctf_version = hp.cth_version;
+	fp->ctf_fileops = &ctf_fileops[hp.cth_version];
+	bcopy(ctfsect, &fp->ctf_data, sizeof (ctf_sect_t));
+
+	if (symsect != NULL) {
+		bcopy(symsect, &fp->ctf_symtab, sizeof (ctf_sect_t));
+		bcopy(strsect, &fp->ctf_strtab, sizeof (ctf_sect_t));
+	}
+
+	if (fp->ctf_data.cts_name != NULL)
+		fp->ctf_data.cts_name = ctf_strdup(fp->ctf_data.cts_name);
+	if (fp->ctf_symtab.cts_name != NULL)
+		fp->ctf_symtab.cts_name = ctf_strdup(fp->ctf_symtab.cts_name);
+	if (fp->ctf_strtab.cts_name != NULL)
+		fp->ctf_strtab.cts_name = ctf_strdup(fp->ctf_strtab.cts_name);
+
+	if (fp->ctf_data.cts_name == NULL)
+		fp->ctf_data.cts_name = _CTF_NULLSTR;
+	if (fp->ctf_symtab.cts_name == NULL)
+		fp->ctf_symtab.cts_name = _CTF_NULLSTR;
+	if (fp->ctf_strtab.cts_name == NULL)
+		fp->ctf_strtab.cts_name = _CTF_NULLSTR;
+
+	fp->ctf_str[CTF_STRTAB_0].cts_strs = (const char *)buf + hp.cth_stroff;
+	fp->ctf_str[CTF_STRTAB_0].cts_len = hp.cth_strlen;
+
+	if (strsect != NULL) {
+		fp->ctf_str[CTF_STRTAB_1].cts_strs = strsect->cts_data;
+		fp->ctf_str[CTF_STRTAB_1].cts_len = strsect->cts_size;
+	}
+
+	fp->ctf_base = base;
+	fp->ctf_buf = buf;
+	fp->ctf_size = size + hdrsz;
+
+	/*
+	 * If we have a parent container name and label, store the relocated
+	 * string pointers in the CTF container for easy access later.
+	 */
+	if (hp.cth_parlabel != 0)
+		fp->ctf_parlabel = ctf_strptr(fp, hp.cth_parlabel);
+	if (hp.cth_parname != 0)
+		fp->ctf_parname = ctf_strptr(fp, hp.cth_parname);
+
+	ctf_dprintf("ctf_bufopen: parent name %s (label %s)\n",
+	    fp->ctf_parname ? fp->ctf_parname : "<NULL>",
+	    fp->ctf_parlabel ? fp->ctf_parlabel : "<NULL>");
+
+	/*
+	 * If we have a symbol table section, allocate and initialize
+	 * the symtab translation table, pointed to by ctf_sxlate.
+	 */
+	if (symsect != NULL) {
+		fp->ctf_nsyms = symsect->cts_size / symsect->cts_entsize;
+		fp->ctf_sxlate = ctf_alloc(fp->ctf_nsyms * sizeof (uint_t));
+
+		if (fp->ctf_sxlate == NULL) {
+			(void) ctf_set_open_errno(errp, EAGAIN);
+			goto bad;
+		}
+
+		if ((err = init_symtab(fp, &hp, symsect, strsect)) != 0) {
+			(void) ctf_set_open_errno(errp, err);
+			goto bad;
+		}
+	}
+
+	if ((err = init_types(fp, &hp)) != 0) {
+		(void) ctf_set_open_errno(errp, err);
+		goto bad;
+	}
+
+	/*
+	 * Initialize the ctf_lookup_by_name top-level dictionary.  We keep an
+	 * array of type name prefixes and the corresponding ctf_hash to use.
+	 * NOTE: This code must be kept in sync with the code in ctf_update().
+	 */
+	fp->ctf_lookups[0].ctl_prefix = "struct";
+	fp->ctf_lookups[0].ctl_len = strlen(fp->ctf_lookups[0].ctl_prefix);
+	fp->ctf_lookups[0].ctl_hash = &fp->ctf_structs;
+	fp->ctf_lookups[1].ctl_prefix = "union";
+	fp->ctf_lookups[1].ctl_len = strlen(fp->ctf_lookups[1].ctl_prefix);
+	fp->ctf_lookups[1].ctl_hash = &fp->ctf_unions;
+	fp->ctf_lookups[2].ctl_prefix = "enum";
+	fp->ctf_lookups[2].ctl_len = strlen(fp->ctf_lookups[2].ctl_prefix);
+	fp->ctf_lookups[2].ctl_hash = &fp->ctf_enums;
+	fp->ctf_lookups[3].ctl_prefix = _CTF_NULLSTR;
+	fp->ctf_lookups[3].ctl_len = strlen(fp->ctf_lookups[3].ctl_prefix);
+	fp->ctf_lookups[3].ctl_hash = &fp->ctf_names;
+	fp->ctf_lookups[4].ctl_prefix = NULL;
+	fp->ctf_lookups[4].ctl_len = 0;
+	fp->ctf_lookups[4].ctl_hash = NULL;
+
+	if (symsect != NULL) {
+		if (symsect->cts_entsize == sizeof (Elf64_Sym))
+			(void) ctf_setmodel(fp, CTF_MODEL_LP64);
+		else
+			(void) ctf_setmodel(fp, CTF_MODEL_ILP32);
+	} else
+		(void) ctf_setmodel(fp, CTF_MODEL_NATIVE);
+
+	fp->ctf_refcnt = 1;
+	return (fp);
+
+bad:
+	ctf_close(fp);
+	return (NULL);
+}
+
+/*
+ * Close the specified CTF container and free associated data structures.  Note
+ * that ctf_close() is a reference counted operation: if the specified file is
+ * the parent of other active containers, its reference count will be greater
+ * than one and it will be freed later when no active children exist.
+ */
+void
+ctf_close(ctf_file_t *fp)
+{
+	ctf_dtdef_t *dtd, *ntd;
+
+	if (fp == NULL)
+		return; /* allow ctf_close(NULL) to simplify caller code */
+
+	ctf_dprintf("ctf_close(%p) refcnt=%u\n", (void *)fp, fp->ctf_refcnt);
+
+	if (fp->ctf_refcnt > 1) {
+		fp->ctf_refcnt--;
+		return;
+	}
+
+	if (fp->ctf_parent != NULL)
+		ctf_close(fp->ctf_parent);
+
+	for (dtd = ctf_list_next(&fp->ctf_dtdefs); dtd != NULL; dtd = ntd) {
+		ntd = ctf_list_next(dtd);
+		ctf_dtd_delete(fp, dtd);
+	}
+
+	ctf_free(fp->ctf_dthash, fp->ctf_dthashlen * sizeof (ctf_dtdef_t *));
+
+	if (fp->ctf_flags & LCTF_MMAP) {
+		if (fp->ctf_data.cts_data != NULL)
+			ctf_sect_munmap(&fp->ctf_data);
+		if (fp->ctf_symtab.cts_data != NULL)
+			ctf_sect_munmap(&fp->ctf_symtab);
+		if (fp->ctf_strtab.cts_data != NULL)
+			ctf_sect_munmap(&fp->ctf_strtab);
+	}
+
+	if (fp->ctf_data.cts_name != _CTF_NULLSTR &&
+	    fp->ctf_data.cts_name != NULL) {
+		ctf_free((char *)fp->ctf_data.cts_name,
+		    strlen(fp->ctf_data.cts_name) + 1);
+	}
+
+	if (fp->ctf_symtab.cts_name != _CTF_NULLSTR &&
+	    fp->ctf_symtab.cts_name != NULL) {
+		ctf_free((char *)fp->ctf_symtab.cts_name,
+		    strlen(fp->ctf_symtab.cts_name) + 1);
+	}
+
+	if (fp->ctf_strtab.cts_name != _CTF_NULLSTR &&
+	    fp->ctf_strtab.cts_name != NULL) {
+		ctf_free((char *)fp->ctf_strtab.cts_name,
+		    strlen(fp->ctf_strtab.cts_name) + 1);
+	}
+
+	if (fp->ctf_base != fp->ctf_data.cts_data && fp->ctf_base != NULL)
+		ctf_data_free((void *)fp->ctf_base, fp->ctf_size);
+
+	if (fp->ctf_sxlate != NULL)
+		ctf_free(fp->ctf_sxlate, sizeof (uint_t) * fp->ctf_nsyms);
+
+	if (fp->ctf_txlate != NULL) {
+		ctf_free(fp->ctf_txlate,
+		    sizeof (uint_t) * (fp->ctf_typemax + 1));
+	}
+
+	if (fp->ctf_ptrtab != NULL) {
+		ctf_free(fp->ctf_ptrtab,
+		    sizeof (ushort_t) * (fp->ctf_typemax + 1));
+	}
+
+	ctf_hash_destroy(&fp->ctf_structs);
+	ctf_hash_destroy(&fp->ctf_unions);
+	ctf_hash_destroy(&fp->ctf_enums);
+	ctf_hash_destroy(&fp->ctf_names);
+
+	ctf_free(fp, sizeof (ctf_file_t));
+}
+
+/*
+ * Return the CTF handle for the parent CTF container, if one exists.
+ * Otherwise return NULL to indicate this container has no imported parent.
+ */
+ctf_file_t *
+ctf_parent_file(ctf_file_t *fp)
+{
+	return (fp->ctf_parent);
+}
+
+/*
+ * Return the name of the parent CTF container, if one exists.  Otherwise
+ * return NULL to indicate this container is a root container.
+ */
+const char *
+ctf_parent_name(ctf_file_t *fp)
+{
+	return (fp->ctf_parname);
+}
+
+/*
+ * Import the types from the specified parent container by storing a pointer
+ * to it in ctf_parent and incrementing its reference count.  Only one parent
+ * is allowed: if a parent already exists, it is replaced by the new parent.
+ */
+int
+ctf_import(ctf_file_t *fp, ctf_file_t *pfp)
+{
+	if (fp == NULL || fp == pfp || (pfp != NULL && pfp->ctf_refcnt == 0))
+		return (ctf_set_errno(fp, EINVAL));
+
+	if (pfp != NULL && pfp->ctf_dmodel != fp->ctf_dmodel)
+		return (ctf_set_errno(fp, ECTF_DMODEL));
+
+	if (fp->ctf_parent != NULL)
+		ctf_close(fp->ctf_parent);
+
+	if (pfp != NULL) {
+		fp->ctf_flags |= LCTF_CHILD;
+		pfp->ctf_refcnt++;
+	}
+
+	fp->ctf_parent = pfp;
+	return (0);
+}
+
+/*
+ * Set the data model constant for the CTF container.
+ */
+int
+ctf_setmodel(ctf_file_t *fp, int model)
+{
+	const ctf_dmodel_t *dp;
+
+	for (dp = _libctf_models; dp->ctd_name != NULL; dp++) {
+		if (dp->ctd_code == model) {
+			fp->ctf_dmodel = dp;
+			return (0);
+		}
+	}
+
+	return (ctf_set_errno(fp, EINVAL));
+}
+
+/*
+ * Return the data model constant for the CTF container.
+ */
+int
+ctf_getmodel(ctf_file_t *fp)
+{
+	return (fp->ctf_dmodel->ctd_code);
+}
+
+void
+ctf_setspecific(ctf_file_t *fp, void *data)
+{
+	fp->ctf_specific = data;
+}
+
+void *
+ctf_getspecific(ctf_file_t *fp)
+{
+	return (fp->ctf_specific);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_types.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_types.c
new file mode 100644
index 0000000..7375c06
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_types.c
@@ -0,0 +1,847 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <ctf_impl.h>
+
+ssize_t
+ctf_get_ctt_size(const ctf_file_t *fp, const ctf_type_t *tp, ssize_t *sizep,
+    ssize_t *incrementp)
+{
+	ssize_t size, increment;
+
+	if (fp->ctf_version > CTF_VERSION_1 &&
+	    tp->ctt_size == CTF_LSIZE_SENT) {
+		size = CTF_TYPE_LSIZE(tp);
+		increment = sizeof (ctf_type_t);
+	} else {
+		size = tp->ctt_size;
+		increment = sizeof (ctf_stype_t);
+	}
+
+	if (sizep)
+		*sizep = size;
+	if (incrementp)
+		*incrementp = increment;
+
+	return (size);
+}
+
+/*
+ * Iterate over the members of a STRUCT or UNION.  We pass the name, member
+ * type, and offset of each member to the specified callback function.
+ */
+int
+ctf_member_iter(ctf_file_t *fp, ctf_id_t type, ctf_member_f *func, void *arg)
+{
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+	ssize_t size, increment;
+	uint_t kind, n;
+	int rc;
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	(void) ctf_get_ctt_size(fp, tp, &size, &increment);
+	kind = LCTF_INFO_KIND(fp, tp->ctt_info);
+
+	if (kind != CTF_K_STRUCT && kind != CTF_K_UNION)
+		return (ctf_set_errno(ofp, ECTF_NOTSOU));
+
+	if (fp->ctf_version == CTF_VERSION_1 || size < CTF_LSTRUCT_THRESH) {
+		const ctf_member_t *mp = (const ctf_member_t *)
+		    ((uintptr_t)tp + increment);
+
+		for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) {
+			const char *name = ctf_strptr(fp, mp->ctm_name);
+			if ((rc = func(name, mp->ctm_type, mp->ctm_offset,
+			    arg)) != 0)
+				return (rc);
+		}
+
+	} else {
+		const ctf_lmember_t *lmp = (const ctf_lmember_t *)
+		    ((uintptr_t)tp + increment);
+
+		for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) {
+			const char *name = ctf_strptr(fp, lmp->ctlm_name);
+			if ((rc = func(name, lmp->ctlm_type,
+			    (ulong_t)CTF_LMEM_OFFSET(lmp), arg)) != 0)
+				return (rc);
+		}
+	}
+
+	return (0);
+}
+
+/*
+ * Iterate over the members of an ENUM.  We pass the string name and associated
+ * integer value of each enum element to the specified callback function.
+ */
+int
+ctf_enum_iter(ctf_file_t *fp, ctf_id_t type, ctf_enum_f *func, void *arg)
+{
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+	const ctf_enum_t *ep;
+	ssize_t increment;
+	uint_t n;
+	int rc;
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_ENUM)
+		return (ctf_set_errno(ofp, ECTF_NOTENUM));
+
+	(void) ctf_get_ctt_size(fp, tp, NULL, &increment);
+
+	ep = (const ctf_enum_t *)((uintptr_t)tp + increment);
+
+	for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, ep++) {
+		const char *name = ctf_strptr(fp, ep->cte_name);
+		if ((rc = func(name, ep->cte_value, arg)) != 0)
+			return (rc);
+	}
+
+	return (0);
+}
+
+/*
+ * Iterate over every root (user-visible) type in the given CTF container.
+ * We pass the type ID of each type to the specified callback function.
+ */
+int
+ctf_type_iter(ctf_file_t *fp, ctf_type_f *func, void *arg)
+{
+	ctf_id_t id, max = fp->ctf_typemax;
+	int rc, child = (fp->ctf_flags & LCTF_CHILD);
+
+	for (id = 1; id <= max; id++) {
+		const ctf_type_t *tp = LCTF_INDEX_TO_TYPEPTR(fp, id);
+		if (CTF_INFO_ISROOT(tp->ctt_info) &&
+		    (rc = func(CTF_INDEX_TO_TYPE(id, child), arg)) != 0)
+			return (rc);
+	}
+
+	return (0);
+}
+
+/*
+ * Follow a given type through the graph for TYPEDEF, VOLATILE, CONST, and
+ * RESTRICT nodes until we reach a "base" type node.  This is useful when
+ * we want to follow a type ID to a node that has members or a size.  To guard
+ * against infinite loops, we implement simplified cycle detection and check
+ * each link against itself, the previous node, and the topmost node.
+ */
+ctf_id_t
+ctf_type_resolve(ctf_file_t *fp, ctf_id_t type)
+{
+	ctf_id_t prev = type, otype = type;
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+
+	while ((tp = ctf_lookup_by_id(&fp, type)) != NULL) {
+		switch (LCTF_INFO_KIND(fp, tp->ctt_info)) {
+		case CTF_K_TYPEDEF:
+		case CTF_K_VOLATILE:
+		case CTF_K_CONST:
+		case CTF_K_RESTRICT:
+			if (tp->ctt_type == type || tp->ctt_type == otype ||
+			    tp->ctt_type == prev) {
+				ctf_dprintf("type %ld cycle detected\n", otype);
+				return (ctf_set_errno(ofp, ECTF_CORRUPT));
+			}
+			prev = type;
+			type = tp->ctt_type;
+			break;
+		default:
+			return (type);
+		}
+	}
+
+	return (CTF_ERR); /* errno is set for us */
+}
+
+/*
+ * Lookup the given type ID and print a string name for it into buf.  Return
+ * the actual number of bytes (not including \0) needed to format the name.
+ */
+ssize_t
+ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
+{
+	ctf_decl_t cd;
+	ctf_decl_node_t *cdp;
+	ctf_decl_prec_t prec, lp, rp;
+	int ptr, arr;
+	uint_t k;
+
+	if (fp == NULL && type == CTF_ERR)
+		return (-1); /* simplify caller code by permitting CTF_ERR */
+
+	ctf_decl_init(&cd, buf, len);
+	ctf_decl_push(&cd, fp, type);
+
+	if (cd.cd_err != 0) {
+		ctf_decl_fini(&cd);
+		return (ctf_set_errno(fp, cd.cd_err));
+	}
+
+	/*
+	 * If the type graph's order conflicts with lexical precedence order
+	 * for pointers or arrays, then we need to surround the declarations at
+	 * the corresponding lexical precedence with parentheses.  This can
+	 * result in either a parenthesized pointer (*) as in int (*)() or
+	 * int (*)[], or in a parenthesized pointer and array as in int (*[])().
+	 */
+	ptr = cd.cd_order[CTF_PREC_POINTER] > CTF_PREC_POINTER;
+	arr = cd.cd_order[CTF_PREC_ARRAY] > CTF_PREC_ARRAY;
+
+	rp = arr ? CTF_PREC_ARRAY : ptr ? CTF_PREC_POINTER : -1;
+	lp = ptr ? CTF_PREC_POINTER : arr ? CTF_PREC_ARRAY : -1;
+
+	k = CTF_K_POINTER; /* avoid leading whitespace (see below) */
+
+	for (prec = CTF_PREC_BASE; prec < CTF_PREC_MAX; prec++) {
+		for (cdp = ctf_list_next(&cd.cd_nodes[prec]);
+		    cdp != NULL; cdp = ctf_list_next(cdp)) {
+
+			ctf_file_t *rfp = fp;
+			const ctf_type_t *tp =
+			    ctf_lookup_by_id(&rfp, cdp->cd_type);
+			const char *name = ctf_strptr(rfp, tp->ctt_name);
+
+			if (k != CTF_K_POINTER && k != CTF_K_ARRAY)
+				ctf_decl_sprintf(&cd, " ");
+
+			if (lp == prec) {
+				ctf_decl_sprintf(&cd, "(");
+				lp = -1;
+			}
+
+			switch (cdp->cd_kind) {
+			case CTF_K_INTEGER:
+			case CTF_K_FLOAT:
+			case CTF_K_TYPEDEF:
+				ctf_decl_sprintf(&cd, "%s", name);
+				break;
+			case CTF_K_POINTER:
+				ctf_decl_sprintf(&cd, "*");
+				break;
+			case CTF_K_ARRAY:
+				ctf_decl_sprintf(&cd, "[%u]", cdp->cd_n);
+				break;
+			case CTF_K_FUNCTION:
+				ctf_decl_sprintf(&cd, "()");
+				break;
+			case CTF_K_STRUCT:
+			case CTF_K_FORWARD:
+				ctf_decl_sprintf(&cd, "struct %s", name);
+				break;
+			case CTF_K_UNION:
+				ctf_decl_sprintf(&cd, "union %s", name);
+				break;
+			case CTF_K_ENUM:
+				ctf_decl_sprintf(&cd, "enum %s", name);
+				break;
+			case CTF_K_VOLATILE:
+				ctf_decl_sprintf(&cd, "volatile");
+				break;
+			case CTF_K_CONST:
+				ctf_decl_sprintf(&cd, "const");
+				break;
+			case CTF_K_RESTRICT:
+				ctf_decl_sprintf(&cd, "restrict");
+				break;
+			}
+
+			k = cdp->cd_kind;
+		}
+
+		if (rp == prec)
+			ctf_decl_sprintf(&cd, ")");
+	}
+
+	if (cd.cd_len >= len)
+		(void) ctf_set_errno(fp, ECTF_NAMELEN);
+
+	ctf_decl_fini(&cd);
+	return (cd.cd_len);
+}
+
+/*
+ * Lookup the given type ID and print a string name for it into buf.  If buf
+ * is too small, return NULL: the ECTF_NAMELEN error is set on 'fp' for us.
+ */
+char *
+ctf_type_name(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
+{
+	ssize_t rv = ctf_type_lname(fp, type, buf, len);
+	return (rv >= 0 && VBDTCAST(size_t)rv < len ? buf : NULL);
+}
+
+/*
+ * Resolve the type down to a base type node, and then return the size
+ * of the type storage in bytes.
+ */
+ssize_t
+ctf_type_size(ctf_file_t *fp, ctf_id_t type)
+{
+	const ctf_type_t *tp;
+	ssize_t size;
+	ctf_arinfo_t ar;
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (-1); /* errno is set for us */
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (-1); /* errno is set for us */
+
+	switch (LCTF_INFO_KIND(fp, tp->ctt_info)) {
+	case CTF_K_POINTER:
+		return (fp->ctf_dmodel->ctd_pointer);
+
+	case CTF_K_FUNCTION:
+		return (0); /* function size is only known by symtab */
+
+	case CTF_K_ENUM:
+		return (fp->ctf_dmodel->ctd_int);
+
+	case CTF_K_ARRAY:
+		/*
+		 * Array size is not directly returned by stabs data.  Instead,
+		 * it defines the element type and requires the user to perform
+		 * the multiplication.  If ctf_get_ctt_size() returns zero, the
+		 * current version of ctfconvert does not compute member sizes
+		 * and we compute the size here on its behalf.
+		 */
+		if ((size = ctf_get_ctt_size(fp, tp, NULL, NULL)) > 0)
+			return (size);
+
+		if (ctf_array_info(fp, type, &ar) == CTF_ERR ||
+		    (size = ctf_type_size(fp, ar.ctr_contents)) == CTF_ERR)
+			return (-1); /* errno is set for us */
+
+		return (size * ar.ctr_nelems);
+
+	default:
+		return (ctf_get_ctt_size(fp, tp, NULL, NULL));
+	}
+}
+
+/*
+ * Resolve the type down to a base type node, and then return the alignment
+ * needed for the type storage in bytes.
+ */
+ssize_t
+ctf_type_align(ctf_file_t *fp, ctf_id_t type)
+{
+	const ctf_type_t *tp;
+	ctf_arinfo_t r;
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (-1); /* errno is set for us */
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (-1); /* errno is set for us */
+
+	switch (LCTF_INFO_KIND(fp, tp->ctt_info)) {
+	case CTF_K_POINTER:
+	case CTF_K_FUNCTION:
+		return (fp->ctf_dmodel->ctd_pointer);
+
+	case CTF_K_ARRAY:
+		if (ctf_array_info(fp, type, &r) == CTF_ERR)
+			return (-1); /* errno is set for us */
+		return (ctf_type_align(fp, r.ctr_contents));
+
+	case CTF_K_STRUCT:
+	case CTF_K_UNION: {
+		uint_t n = LCTF_INFO_VLEN(fp, tp->ctt_info);
+		ssize_t size, increment;
+		size_t align = 0;
+		const void *vmp;
+
+		(void) ctf_get_ctt_size(fp, tp, &size, &increment);
+		vmp = (uchar_t *)tp + increment;
+
+		if (LCTF_INFO_KIND(fp, tp->ctt_info) == CTF_K_STRUCT)
+			n = MIN(n, 1); /* only use first member for structs */
+
+		if (fp->ctf_version == CTF_VERSION_1 ||
+		    size < CTF_LSTRUCT_THRESH) {
+			const ctf_member_t *mp = vmp;
+			for (; n != 0; n--, mp++) {
+				ssize_t am = ctf_type_align(fp, mp->ctm_type);
+				align = MAX(VBDTCAST(ssize_t)align, am);
+			}
+		} else {
+			const ctf_lmember_t *lmp = vmp;
+			for (; n != 0; n--, lmp++) {
+				ssize_t am = ctf_type_align(fp, lmp->ctlm_type);
+				align = MAX(VBDTCAST(ssize_t)align, am);
+			}
+		}
+
+		return (align);
+	}
+
+	case CTF_K_ENUM:
+		return (fp->ctf_dmodel->ctd_int);
+
+	default:
+		return (ctf_get_ctt_size(fp, tp, NULL, NULL));
+	}
+}
+
+/*
+ * Return the kind (CTF_K_* constant) for the specified type ID.
+ */
+int
+ctf_type_kind(ctf_file_t *fp, ctf_id_t type)
+{
+	const ctf_type_t *tp;
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	return (LCTF_INFO_KIND(fp, tp->ctt_info));
+}
+
+/*
+ * If the type is one that directly references another type (such as POINTER),
+ * then return the ID of the type to which it refers.
+ */
+ctf_id_t
+ctf_type_reference(ctf_file_t *fp, ctf_id_t type)
+{
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	switch (LCTF_INFO_KIND(fp, tp->ctt_info)) {
+	case CTF_K_POINTER:
+	case CTF_K_TYPEDEF:
+	case CTF_K_VOLATILE:
+	case CTF_K_CONST:
+	case CTF_K_RESTRICT:
+		return (tp->ctt_type);
+	default:
+		return (ctf_set_errno(ofp, ECTF_NOTREF));
+	}
+}
+
+/*
+ * Find a pointer to type by looking in fp->ctf_ptrtab.  If we can't find a
+ * pointer to the given type, see if we can compute a pointer to the type
+ * resulting from resolving the type down to its base type and use that
+ * instead.  This helps with cases where the CTF data includes "struct foo *"
+ * but not "foo_t *" and the user accesses "foo_t *" in the debugger.
+ */
+ctf_id_t
+ctf_type_pointer(ctf_file_t *fp, ctf_id_t type)
+{
+	ctf_file_t *ofp = fp;
+	ctf_id_t ntype;
+
+	if (ctf_lookup_by_id(&fp, type) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	if ((ntype = fp->ctf_ptrtab[CTF_TYPE_TO_INDEX(type)]) != 0)
+		return (CTF_INDEX_TO_TYPE(ntype, (fp->ctf_flags & LCTF_CHILD)));
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (ctf_set_errno(ofp, ECTF_NOTYPE));
+
+	if (ctf_lookup_by_id(&fp, type) == NULL)
+		return (ctf_set_errno(ofp, ECTF_NOTYPE));
+
+	if ((ntype = fp->ctf_ptrtab[CTF_TYPE_TO_INDEX(type)]) != 0)
+		return (CTF_INDEX_TO_TYPE(ntype, (fp->ctf_flags & LCTF_CHILD)));
+
+	return (ctf_set_errno(ofp, ECTF_NOTYPE));
+}
+
+/*
+ * Return the encoding for the specified INTEGER or FLOAT.
+ */
+int
+ctf_type_encoding(ctf_file_t *fp, ctf_id_t type, ctf_encoding_t *ep)
+{
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+	ssize_t increment;
+	uint_t data;
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	(void) ctf_get_ctt_size(fp, tp, NULL, &increment);
+
+	switch (LCTF_INFO_KIND(fp, tp->ctt_info)) {
+	case CTF_K_INTEGER:
+		data = *(const uint_t *)((uintptr_t)tp + increment);
+		ep->cte_format = CTF_INT_ENCODING(data);
+		ep->cte_offset = CTF_INT_OFFSET(data);
+		ep->cte_bits = CTF_INT_BITS(data);
+		break;
+	case CTF_K_FLOAT:
+		data = *(const uint_t *)((uintptr_t)tp + increment);
+		ep->cte_format = CTF_FP_ENCODING(data);
+		ep->cte_offset = CTF_FP_OFFSET(data);
+		ep->cte_bits = CTF_FP_BITS(data);
+		break;
+	default:
+		return (ctf_set_errno(ofp, ECTF_NOTINTFP));
+	}
+
+	return (0);
+}
+
+int
+ctf_type_cmp(ctf_file_t *lfp, ctf_id_t ltype, ctf_file_t *rfp, ctf_id_t rtype)
+{
+	int rval;
+
+	if (ltype < rtype)
+		rval = -1;
+	else if (ltype > rtype)
+		rval = 1;
+	else
+		rval = 0;
+
+	if (lfp == rfp)
+		return (rval);
+
+	if (CTF_TYPE_ISPARENT(ltype) && lfp->ctf_parent != NULL)
+		lfp = lfp->ctf_parent;
+
+	if (CTF_TYPE_ISPARENT(rtype) && rfp->ctf_parent != NULL)
+		rfp = rfp->ctf_parent;
+
+	if (lfp < rfp)
+		return (-1);
+
+	if (lfp > rfp)
+		return (1);
+
+	return (rval);
+}
+
+/*
+ * Return a boolean value indicating if two types are compatible integers or
+ * floating-pointer values.  This function returns true if the two types are
+ * the same, or if they have the same ASCII name and encoding properties.
+ * This function could be extended to test for compatibility for other kinds.
+ */
+int
+ctf_type_compat(ctf_file_t *lfp, ctf_id_t ltype,
+    ctf_file_t *rfp, ctf_id_t rtype)
+{
+	const ctf_type_t *ltp, *rtp;
+	ctf_encoding_t le, re;
+	ctf_arinfo_t la, ra;
+	uint_t lkind, rkind;
+
+	if (ctf_type_cmp(lfp, ltype, rfp, rtype) == 0)
+		return (1);
+
+	ltype = ctf_type_resolve(lfp, ltype);
+	lkind = ctf_type_kind(lfp, ltype);
+
+	rtype = ctf_type_resolve(rfp, rtype);
+	rkind = ctf_type_kind(rfp, rtype);
+
+	if (lkind != rkind ||
+	    (ltp = ctf_lookup_by_id(&lfp, ltype)) == NULL ||
+	    (rtp = ctf_lookup_by_id(&rfp, rtype)) == NULL ||
+	    strcmp(ctf_strptr(lfp, ltp->ctt_name),
+	    ctf_strptr(rfp, rtp->ctt_name)) != 0)
+		return (0);
+
+	switch (lkind) {
+	case CTF_K_INTEGER:
+	case CTF_K_FLOAT:
+		return (ctf_type_encoding(lfp, ltype, &le) == 0 &&
+		    ctf_type_encoding(rfp, rtype, &re) == 0 &&
+		    bcmp(&le, &re, sizeof (ctf_encoding_t)) == 0);
+	case CTF_K_POINTER:
+		return (ctf_type_compat(lfp, ctf_type_reference(lfp, ltype),
+		    rfp, ctf_type_reference(rfp, rtype)));
+	case CTF_K_ARRAY:
+		return (ctf_array_info(lfp, ltype, &la) == 0 &&
+		    ctf_array_info(rfp, rtype, &ra) == 0 &&
+		    la.ctr_nelems == ra.ctr_nelems && ctf_type_compat(
+		    lfp, la.ctr_contents, rfp, ra.ctr_contents) &&
+		    ctf_type_compat(lfp, la.ctr_index, rfp, ra.ctr_index));
+	case CTF_K_STRUCT:
+	case CTF_K_UNION:
+		return (ctf_type_size(lfp, ltype) == ctf_type_size(rfp, rtype));
+	case CTF_K_ENUM:
+	case CTF_K_FORWARD:
+		return (1); /* no other checks required for these type kinds */
+	default:
+		return (0); /* should not get here since we did a resolve */
+	}
+}
+
+/*
+ * Return the type and offset for a given member of a STRUCT or UNION.
+ */
+int
+ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
+    ctf_membinfo_t *mip)
+{
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+	ssize_t size, increment;
+	uint_t kind, n;
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	(void) ctf_get_ctt_size(fp, tp, &size, &increment);
+	kind = LCTF_INFO_KIND(fp, tp->ctt_info);
+
+	if (kind != CTF_K_STRUCT && kind != CTF_K_UNION)
+		return (ctf_set_errno(ofp, ECTF_NOTSOU));
+
+	if (fp->ctf_version == CTF_VERSION_1 || size < CTF_LSTRUCT_THRESH) {
+		const ctf_member_t *mp = (const ctf_member_t *)
+		    ((uintptr_t)tp + increment);
+
+		for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) {
+			if (strcmp(ctf_strptr(fp, mp->ctm_name), name) == 0) {
+				mip->ctm_type = mp->ctm_type;
+				mip->ctm_offset = mp->ctm_offset;
+				return (0);
+			}
+		}
+	} else {
+		const ctf_lmember_t *lmp = (const ctf_lmember_t *)
+		    ((uintptr_t)tp + increment);
+
+		for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) {
+			if (strcmp(ctf_strptr(fp, lmp->ctlm_name), name) == 0) {
+				mip->ctm_type = lmp->ctlm_type;
+				mip->ctm_offset = (ulong_t)CTF_LMEM_OFFSET(lmp);
+				return (0);
+			}
+		}
+	}
+
+	return (ctf_set_errno(ofp, ECTF_NOMEMBNAM));
+}
+
+/*
+ * Return the array type, index, and size information for the specified ARRAY.
+ */
+int
+ctf_array_info(ctf_file_t *fp, ctf_id_t type, ctf_arinfo_t *arp)
+{
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+	const ctf_array_t *ap;
+	ssize_t increment;
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_ARRAY)
+		return (ctf_set_errno(ofp, ECTF_NOTARRAY));
+
+	(void) ctf_get_ctt_size(fp, tp, NULL, &increment);
+
+	ap = (const ctf_array_t *)((uintptr_t)tp + increment);
+	arp->ctr_contents = ap->cta_contents;
+	arp->ctr_index = ap->cta_index;
+	arp->ctr_nelems = ap->cta_nelems;
+
+	return (0);
+}
+
+/*
+ * Convert the specified value to the corresponding enum member name, if a
+ * matching name can be found.  Otherwise NULL is returned.
+ */
+const char *
+ctf_enum_name(ctf_file_t *fp, ctf_id_t type, int value)
+{
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+	const ctf_enum_t *ep;
+	ssize_t increment;
+	uint_t n;
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (NULL); /* errno is set for us */
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (NULL); /* errno is set for us */
+
+	if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_ENUM) {
+		(void) ctf_set_errno(ofp, ECTF_NOTENUM);
+		return (NULL);
+	}
+
+	(void) ctf_get_ctt_size(fp, tp, NULL, &increment);
+
+	ep = (const ctf_enum_t *)((uintptr_t)tp + increment);
+
+	for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, ep++) {
+		if (ep->cte_value == value)
+			return (ctf_strptr(fp, ep->cte_name));
+	}
+
+	(void) ctf_set_errno(ofp, ECTF_NOENUMNAM);
+	return (NULL);
+}
+
+/*
+ * Convert the specified enum tag name to the corresponding value, if a
+ * matching name can be found.  Otherwise CTF_ERR is returned.
+ */
+int
+ctf_enum_value(ctf_file_t *fp, ctf_id_t type, const char *name, int *valp)
+{
+	ctf_file_t *ofp = fp;
+	const ctf_type_t *tp;
+	const ctf_enum_t *ep;
+	ssize_t size, increment;
+	uint_t n;
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_ENUM) {
+		(void) ctf_set_errno(ofp, ECTF_NOTENUM);
+		return (CTF_ERR);
+	}
+
+	(void) ctf_get_ctt_size(fp, tp, &size, &increment);
+
+	ep = (const ctf_enum_t *)((uintptr_t)tp + increment);
+
+	for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, ep++) {
+		if (strcmp(ctf_strptr(fp, ep->cte_name), name) == 0) {
+			if (valp != NULL)
+				*valp = ep->cte_value;
+			return (0);
+		}
+	}
+
+	(void) ctf_set_errno(ofp, ECTF_NOENUMNAM);
+	return (CTF_ERR);
+}
+
+/*
+ * Recursively visit the members of any type.  This function is used as the
+ * engine for ctf_type_visit, below.  We resolve the input type, recursively
+ * invoke ourself for each type member if the type is a struct or union, and
+ * then invoke the callback function on the current type.  If any callback
+ * returns non-zero, we abort and percolate the error code back up to the top.
+ */
+static int
+ctf_type_rvisit(ctf_file_t *fp, ctf_id_t type, ctf_visit_f *func, void *arg,
+    const char *name, ulong_t offset, int depth)
+{
+	ctf_id_t otype = type;
+	const ctf_type_t *tp;
+	ssize_t size, increment;
+	uint_t kind, n;
+	int rc;
+
+	if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
+		return (CTF_ERR); /* errno is set for us */
+
+	if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
+		return (CTF_ERR); /* errno is set for us */
+
+	if ((rc = func(name, otype, offset, depth, arg)) != 0)
+		return (rc);
+
+	kind = LCTF_INFO_KIND(fp, tp->ctt_info);
+
+	if (kind != CTF_K_STRUCT && kind != CTF_K_UNION)
+		return (0);
+
+	(void) ctf_get_ctt_size(fp, tp, &size, &increment);
+
+	if (fp->ctf_version == CTF_VERSION_1 || size < CTF_LSTRUCT_THRESH) {
+		const ctf_member_t *mp = (const ctf_member_t *)
+		    ((uintptr_t)tp + increment);
+
+		for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) {
+			if ((rc = ctf_type_rvisit(fp, mp->ctm_type,
+			    func, arg, ctf_strptr(fp, mp->ctm_name),
+			    offset + mp->ctm_offset, depth + 1)) != 0)
+				return (rc);
+		}
+
+	} else {
+		const ctf_lmember_t *lmp = (const ctf_lmember_t *)
+		    ((uintptr_t)tp + increment);
+
+		for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) {
+			if ((rc = ctf_type_rvisit(fp, lmp->ctlm_type,
+			    func, arg, ctf_strptr(fp, lmp->ctlm_name),
+			    offset + (ulong_t)CTF_LMEM_OFFSET(lmp),
+			    depth + 1)) != 0)
+				return (rc);
+		}
+	}
+
+	return (0);
+}
+
+/*
+ * Recursively visit the members of any type.  We pass the name, member
+ * type, and offset of each member to the specified callback function.
+ */
+int
+ctf_type_visit(ctf_file_t *fp, ctf_id_t type, ctf_visit_f *func, void *arg)
+{
+	return (ctf_type_rvisit(fp, type, func, arg, "", 0, 0));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_util.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_util.c
new file mode 100644
index 0000000..c13c1d6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/ctf/ctf_util.c
@@ -0,0 +1,154 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <ctf_impl.h>
+
+/*
+ * Simple doubly-linked list append routine.  This implementation assumes that
+ * each list element contains an embedded ctf_list_t as the first member.
+ * An additional ctf_list_t is used to store the head (l_next) and tail
+ * (l_prev) pointers.  The current head and tail list elements have their
+ * previous and next pointers set to NULL, respectively.
+ */
+void
+ctf_list_append(ctf_list_t *lp, void *new)
+{
+	ctf_list_t *p = lp->l_prev;	/* p = tail list element */
+	ctf_list_t *q = new;		/* q = new list element */
+
+	lp->l_prev = q;
+	q->l_prev = p;
+	q->l_next = NULL;
+
+	if (p != NULL)
+		p->l_next = q;
+	else
+		lp->l_next = q;
+}
+
+/*
+ * Prepend the specified existing element to the given ctf_list_t.  The
+ * existing pointer should be pointing at a struct with embedded ctf_list_t.
+ */
+void
+ctf_list_prepend(ctf_list_t *lp, void *new)
+{
+	ctf_list_t *p = new;		/* p = new list element */
+	ctf_list_t *q = lp->l_next;	/* q = head list element */
+
+	lp->l_next = p;
+	p->l_prev = NULL;
+	p->l_next = q;
+
+	if (q != NULL)
+		q->l_prev = p;
+	else
+		lp->l_prev = p;
+}
+
+/*
+ * Delete the specified existing element from the given ctf_list_t.  The
+ * existing pointer should be pointing at a struct with embedded ctf_list_t.
+ */
+void
+ctf_list_delete(ctf_list_t *lp, void *existing)
+{
+	ctf_list_t *p = existing;
+
+	if (p->l_prev != NULL)
+		p->l_prev->l_next = p->l_next;
+	else
+		lp->l_next = p->l_next;
+
+	if (p->l_next != NULL)
+		p->l_next->l_prev = p->l_prev;
+	else
+		lp->l_prev = p->l_prev;
+}
+
+/*
+ * Convert an encoded CTF string name into a pointer to a C string by looking
+ * up the appropriate string table buffer and then adding the offset.
+ */
+const char *
+ctf_strraw(ctf_file_t *fp, uint_t name)
+{
+	ctf_strs_t *ctsp = &fp->ctf_str[CTF_NAME_STID(name)];
+
+	if (ctsp->cts_strs != NULL && CTF_NAME_OFFSET(name) < ctsp->cts_len)
+		return (ctsp->cts_strs + CTF_NAME_OFFSET(name));
+
+	/* string table not loaded or corrupt offset */
+	return (NULL);
+}
+
+const char *
+ctf_strptr(ctf_file_t *fp, uint_t name)
+{
+	const char *s = ctf_strraw(fp, name);
+	return (s != NULL ? s : "(?)");
+}
+
+/*
+ * Same strdup(3C), but use ctf_alloc() to do the memory allocation.
+ */
+char *
+ctf_strdup(const char *s1)
+{
+	char *s2 = ctf_alloc(strlen(s1) + 1);
+
+	if (s2 != NULL)
+		(void) strcpy(s2, s1);
+
+	return (s2);
+}
+
+/*
+ * Store the specified error code into errp if it is non-NULL, and then
+ * return NULL for the benefit of the caller.
+ */
+ctf_file_t *
+ctf_set_open_errno(int *errp, int error)
+{
+	if (errp != NULL)
+		*errp = error;
+	return (NULL);
+}
+
+/*
+ * Store the specified error code into the CTF container, and then return
+ * CTF_ERR for the benefit of the caller.
+ */
+long
+ctf_set_errno(ctf_file_t *fp, int err)
+{
+	fp->ctf_errno = err;
+	return (CTF_ERR);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/dtrace/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/common/dtrace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/common/dtrace/dtrace_data.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/dtrace/dtrace_data.c
new file mode 100644
index 0000000..7e1d3d9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/common/dtrace/dtrace_data.c
@@ -0,0 +1,113 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+
+/*
+ * In order to let the DTrace fasttrap provider trace processes before libc
+ * is initialized, we place this structure in the thread pointer register.
+ * This is communicated to the kernel (in the elfexec() function) by
+ * placing the address of this structure in the PT_SUNWDTRACE program
+ * header with the -zdtrace_data=<object> option to ld(1).
+ *
+ * Besides DTrace use, the initialization sequence carried out for the
+ * PT_SUNWDTRACE data is an essential step required for the correct
+ * initialization of any process.  Therefore, PT_SUNWDTRACE data must
+ * exist in any interpretor available on Solaris.
+ *
+ * ld.so.1 is the standard interpretor on all Solaris platforms.  However,
+ * for ABI compliance, 32-bit executables are able to identify libc.so.1
+ * as their interpretor.  Therefore, this data file is used to build all
+ * instances of ld.so.1, and the 32-bit versions of libc.so.1.  Note,
+ * although libc.so.1 can act as an interpretor for 32-bit applications,
+ * libc.so.1 only provides a bootstrap mechanism to load and jump to
+ * ld.so.1.
+ *
+ * The fields of the program header are set as follows:
+ *	p_type:         PT_SUNWDTRACE
+ *	p_vaddr:        address of dtrace_data
+ *	p_memsz:        size of dtrace_data
+ *	p_flags:        flags of segment dtrace_data is assigned to
+ *	p_paddr:        <reserved>
+ *	p_filesz:       <reserved>
+ *	p_offset:       <reserved>
+ *	p_align:        <reserved>
+ *
+ * See the comment in fasttrap.h for information on how to safely change
+ * this data structure and the other places that need to be kept in sync.
+ */
+
+#if defined(__sparc)
+
+#pragma align 64(dtrace_data)
+uint32_t	dtrace_data[32] = {
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0x9de04000,			/* save %g1, %g0, %sp */
+	0x81e80000,			/* restore %g0, %g0, %g0 */
+	0x91d0203a,			/* ta 0x3a */
+	0x81ca0000,			/* return %o0 */
+	0, 0,				/* self pointer (must be zero) */
+	0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0
+};
+
+#elif defined(__amd64)
+
+#pragma align 64(dtrace_data)
+uint8_t	dtrace_data[64] = {
+	0, 0, 0, 0, 0, 0, 0, 0,		/* self pointer (must be zero) */
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0
+};
+
+#elif defined(__i386)
+
+#pragma align 64(dtrace_data)
+uint8_t	dtrace_data[64] = {
+	0, 0, 0, 0,			/* self pointer (must be zero)  */
+	0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0
+};
+
+#else
+
+#error "unknown ISA"
+
+#endif
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile
new file mode 100644
index 0000000..5a8b3f9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile
@@ -0,0 +1,55 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.lib
+
+HDRS = libctf.h
+HDRDIR = common
+
+SUBDIRS = $(MACH) 
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET = all
+clean := TARGET = clean
+clobber := TARGET = clobber
+install := TARGET = install
+lint := TARGET = lint
+
+.KEEP_STATE:
+
+all clean clobber install lint: $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+check: $(CHECKHDRS)
+
+$(SUBDIRS): FRC
+	@cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile.com b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile.com
new file mode 100644
index 0000000..267d67a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile.com
@@ -0,0 +1,72 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+LIBRARY = libctf.a
+VERS = .1
+
+COMMON_OBJS = \
+	ctf_create.o \
+	ctf_decl.o \
+	ctf_error.o \
+	ctf_hash.o \
+	ctf_labels.o \
+	ctf_lookup.o \
+	ctf_open.o \
+	ctf_types.o \
+	ctf_util.o
+
+LIB_OBJS = \
+	ctf_lib.o \
+	ctf_subr.o
+
+OBJECTS = $(COMMON_OBJS) $(LIB_OBJS)
+
+include ../../Makefile.lib
+include ../../Makefile.rootfs
+
+SRCS = $(COMMON_OBJS:%.o=../../../common/ctf/%.c) $(LIB_OBJS:%.o=../common/%.c)
+LIBS = $(DYNLIB) $(LINTLIB)
+
+SRCDIR = ../common
+
+CPPFLAGS += -I../common -I../../../common/ctf -DCTF_OLD_VERSIONS
+CFLAGS += $(CCVERBOSE)
+LDLIBS += -lc
+
+$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
+
+.KEEP_STATE:
+
+all: $(LIBS)
+
+lint: lintcheck
+
+include ../../Makefile.targ
+
+objs/%.o pics/%.o: ../../../common/ctf/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/amd64/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/amd64/Makefile
new file mode 100644
index 0000000..c9bd26c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/amd64/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/ctf_lib.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/ctf_lib.c
new file mode 100644
index 0000000..d50f5fc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/ctf_lib.c
@@ -0,0 +1,595 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <ctf_impl.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <gelf.h>
+#else
+# include <libctf.h>
+# include <ctf_impl.h>
+# include <iprt/param.h>
+# include <sys/stat.h>
+# include <stdio.h>
+# include <fcntl.h>
+# ifdef _MSC_VER
+#  include <io.h>
+# else
+#  include <unistd.h>
+# endif
+# define stat64  stat
+# define fstat64 fstat
+# define open64  open
+# define off64_t int64_t
+#endif
+
+#ifndef VBOX /* staticly linked in */
+#ifdef _LP64
+static const char *_libctf_zlib = "/usr/lib/64/libz.so";
+#else
+static const char *_libctf_zlib = "/usr/lib/libz.so";
+#endif
+
+static struct {
+	int (*z_uncompress)(uchar_t *, ulong_t *, const uchar_t *, ulong_t);
+	const char *(*z_error)(int);
+	void *z_dlp;
+} zlib;
+#endif /* !VBOX */
+
+static size_t _PAGESIZE;
+static size_t _PAGEMASK;
+
+#ifndef VBOX
+#pragma init(_libctf_init)
+void
+_libctf_init(void)
+#else
+void libctf_init(void)
+#endif
+{
+#ifndef VBOX
+	const char *p = getenv("LIBCTF_DECOMPRESSOR");
+
+	if (p != NULL)
+		_libctf_zlib = p; /* use alternate decompression library */
+#endif
+
+	_libctf_debug = getenv("LIBCTF_DEBUG") != NULL;
+
+#ifndef VBOX
+	_PAGESIZE = getpagesize();
+#else
+	_PAGESIZE = PAGE_SIZE;
+#endif
+	_PAGEMASK = ~(_PAGESIZE - 1);
+}
+
+#ifdef VBOX
+/*
+ * Fake MMAP for read only access.
+ */
+# define munmap(a_pvMem, a_cbMem) \
+	RTMemPageFree(a_pvMem, a_cbMem)
+
+# define mmap64(a_pvAddr, a_cb, a_fProt, a_fFlags, a_fd, a_offFile) \
+	VBoxCtfMap64Fake(a_pvAddr, a_cb, a_fProt, a_fFlags, a_fd, a_offFile)
+
+# undef PROT_READ
+# define PROT_READ 		0xfeed
+# undef MAP_PRIVATE
+# define MAP_PRIVATE	0xbeef
+
+static void *VBoxCtfMap64Fake(void *pvAddr, size_t cb, int fProt, int fFlags, int fd, int64_t offFile)
+{
+	off_t const offSaved = lseek(fd, 0, SEEK_CUR);
+	void *pvRet;
+	int err;
+
+	Assert(pvAddr == NULL); NOREF(pvAddr);
+	Assert(fProt == PROT_READ);
+	Assert(fFlags == MAP_PRIVATE);
+	if ((off_t)offFile != offFile) {
+		errno = EIO;
+		return MAP_FAILED;
+	}
+
+	if (lseek(offFile, offFile, SEEK_SET) >= 0) {
+
+		pvRet = RTMemPageAllocZ(cb);
+		if (!pvRet) {
+#ifdef _MSC_VER
+			ssize_t cbRead = read(fd, pvRet, (unsigned int)cb);
+#else
+			ssize_t cbRead = read(fd, pvRet, cb);
+#endif
+			if (cbRead < 0) {
+				RTMemPageFree(pvRet, cb);
+				pvRet = MAP_FAILED;
+			}
+		} else {
+			errno = ENOMEM;
+			pvRet = MAP_FAILED;
+		}
+
+		/* restore original position */
+		err = errno;
+		lseek(offSaved, 0, SEEK_SET);
+		errno = err;
+	}
+
+	return pvRet;
+}
+
+/*
+ * pread64
+ */
+#define pread64(a_fd, a_pvBuf, a_cbToRead, a_offFile) \
+	VBoxCtfPRead64(a_fd, a_pvBuf, a_cbToRead, a_offFile)
+
+static ssize_t VBoxCtfPRead64(int fd, void *pvBuf, size_t cbToRead, int64_t offFile)
+{
+	if ((off_t)offFile != offFile) {
+		errno = EIO;
+		return -1;
+	}
+
+	if (lseek(fd, offFile, SEEK_SET) < 0)
+		return -1;
+#ifndef _MSC_VER
+	return read(fd, pvBuf, cbToRead);
+#else
+	return read(fd, pvBuf, (unsigned int)cbToRead);
+#endif
+}
+
+
+
+#endif /* VBOX */
+
+#ifndef VBOX
+
+/*
+ * Attempt to dlopen the decompression library and locate the symbols of
+ * interest that we will need to call.  This information in cached so
+ * that multiple calls to ctf_bufopen() do not need to reopen the library.
+ */
+void *
+ctf_zopen(int *errp)
+{
+	ctf_dprintf("decompressing CTF data using %s\n", _libctf_zlib);
+
+	if (zlib.z_dlp != NULL)
+		return (zlib.z_dlp); /* library is already loaded */
+
+	if (access(_libctf_zlib, R_OK) == -1)
+		return (ctf_set_open_errno(errp, ECTF_ZMISSING));
+
+	if ((zlib.z_dlp = dlopen(_libctf_zlib, RTLD_LAZY | RTLD_LOCAL)) == NULL)
+		return (ctf_set_open_errno(errp, ECTF_ZINIT));
+
+	zlib.z_uncompress = (int (*)()) dlsym(zlib.z_dlp, "uncompress");
+	zlib.z_error = (const char *(*)()) dlsym(zlib.z_dlp, "zError");
+
+	if (zlib.z_uncompress == NULL || zlib.z_error == NULL) {
+		(void) dlclose(zlib.z_dlp);
+		bzero(&zlib, sizeof (zlib));
+		return (ctf_set_open_errno(errp, ECTF_ZINIT));
+	}
+
+	return (zlib.z_dlp);
+}
+
+/*
+ * The ctf_bufopen() routine calls these subroutines, defined by <sys/zmod.h>,
+ * which we then patch through to the functions in the decompression library.
+ */
+int
+z_uncompress(void *dst, size_t *dstlen, const void *src, size_t srclen)
+{
+	return (zlib.z_uncompress(dst, (ulong_t *)dstlen, src, srclen));
+}
+
+const char *
+z_strerror(int err)
+{
+	return (zlib.z_error(err));
+}
+
+#endif /* VBOX */
+
+/*
+ * Convert a 32-bit ELF file header into GElf.
+ */
+static void
+ehdr_to_gelf(const Elf32_Ehdr *src, GElf_Ehdr *dst)
+{
+	bcopy(src->e_ident, dst->e_ident, EI_NIDENT);
+	dst->e_type = src->e_type;
+	dst->e_machine = src->e_machine;
+	dst->e_version = src->e_version;
+	dst->e_entry = (Elf64_Addr)src->e_entry;
+	dst->e_phoff = (Elf64_Off)src->e_phoff;
+	dst->e_shoff = (Elf64_Off)src->e_shoff;
+	dst->e_flags = src->e_flags;
+	dst->e_ehsize = src->e_ehsize;
+	dst->e_phentsize = src->e_phentsize;
+	dst->e_phnum = src->e_phnum;
+	dst->e_shentsize = src->e_shentsize;
+	dst->e_shnum = src->e_shnum;
+	dst->e_shstrndx = src->e_shstrndx;
+}
+
+/*
+ * Convert a 32-bit ELF section header into GElf.
+ */
+static void
+shdr_to_gelf(const Elf32_Shdr *src, GElf_Shdr *dst)
+{
+	dst->sh_name = src->sh_name;
+	dst->sh_type = src->sh_type;
+	dst->sh_flags = src->sh_flags;
+	dst->sh_addr = src->sh_addr;
+	dst->sh_offset = src->sh_offset;
+	dst->sh_size = src->sh_size;
+	dst->sh_link = src->sh_link;
+	dst->sh_info = src->sh_info;
+	dst->sh_addralign = src->sh_addralign;
+	dst->sh_entsize = src->sh_entsize;
+}
+
+/*
+ * In order to mmap a section from the ELF file, we must round down sh_offset
+ * to the previous page boundary, and mmap the surrounding page.  We store
+ * the pointer to the start of the actual section data back into sp->cts_data.
+ */
+const void *
+ctf_sect_mmap(ctf_sect_t *sp, int fd)
+{
+	size_t pageoff = sp->cts_offset & ~_PAGEMASK;
+
+	caddr_t base = mmap64(NULL, sp->cts_size + pageoff, PROT_READ,
+	    MAP_PRIVATE, fd, sp->cts_offset & _PAGEMASK);
+
+	if (base != MAP_FAILED)
+		sp->cts_data = base + pageoff;
+
+	return (base);
+}
+
+/*
+ * Since sp->cts_data has the adjusted offset, we have to again round down
+ * to get the actual mmap address and round up to get the size.
+ */
+void
+ctf_sect_munmap(const ctf_sect_t *sp)
+{
+	uintptr_t addr = (uintptr_t)sp->cts_data;
+	uintptr_t pageoff = addr & ~_PAGEMASK;
+
+	(void) munmap((void *)(addr - pageoff), sp->cts_size + pageoff);
+}
+
+/*
+ * Open the specified file descriptor and return a pointer to a CTF container.
+ * The file can be either an ELF file or raw CTF file.  The caller is
+ * responsible for closing the file descriptor when it is no longer needed.
+ */
+ctf_file_t *
+ctf_fdopen(int fd, int *errp)
+{
+	ctf_sect_t ctfsect, symsect, strsect;
+	ctf_file_t *fp = NULL;
+
+	struct stat64 st;
+	ssize_t nbytes;
+
+	union {
+		ctf_preamble_t ctf;
+		Elf32_Ehdr e32;
+		GElf_Ehdr e64;
+	} hdr;
+
+	bzero(&ctfsect, sizeof (ctf_sect_t));
+	bzero(&symsect, sizeof (ctf_sect_t));
+	bzero(&strsect, sizeof (ctf_sect_t));
+	bzero(&hdr.ctf, sizeof (hdr));
+
+	if (fstat64(fd, &st) == -1)
+		return (ctf_set_open_errno(errp, errno));
+
+	if ((nbytes = pread64(fd, &hdr.ctf, sizeof (hdr), 0)) <= 0)
+		return (ctf_set_open_errno(errp, nbytes < 0? errno : ECTF_FMT));
+
+	/*
+	 * If we have read enough bytes to form a CTF header and the magic
+	 * string matches, attempt to interpret the file as raw CTF.
+	 */
+	if (nbytes >= sizeof (ctf_preamble_t) &&
+	    hdr.ctf.ctp_magic == CTF_MAGIC) {
+		if (hdr.ctf.ctp_version > CTF_VERSION)
+			return (ctf_set_open_errno(errp, ECTF_CTFVERS));
+
+		ctfsect.cts_data = mmap64(NULL, st.st_size, PROT_READ,
+		    MAP_PRIVATE, fd, 0);
+
+		if (ctfsect.cts_data == MAP_FAILED)
+			return (ctf_set_open_errno(errp, errno));
+
+		ctfsect.cts_name = _CTF_SECTION;
+		ctfsect.cts_type = SHT_PROGBITS;
+		ctfsect.cts_flags = SHF_ALLOC;
+		ctfsect.cts_size = (size_t)st.st_size;
+		ctfsect.cts_entsize = 1;
+		ctfsect.cts_offset = 0;
+
+		if ((fp = ctf_bufopen(&ctfsect, NULL, NULL, errp)) == NULL)
+			ctf_sect_munmap(&ctfsect);
+
+		return (fp);
+	}
+
+	/*
+	 * If we have read enough bytes to form an ELF header and the magic
+	 * string matches, attempt to interpret the file as an ELF file.  We
+	 * do our own largefile ELF processing, and convert everything to
+	 * GElf structures so that clients can operate on any data model.
+	 */
+	if (nbytes >= sizeof (Elf32_Ehdr) &&
+	    bcmp(&hdr.e32.e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) {
+#ifdef	_BIG_ENDIAN
+		uchar_t order = ELFDATA2MSB;
+#else
+		uchar_t order = ELFDATA2LSB;
+#endif
+		GElf_Half i, n;
+		GElf_Shdr *sp;
+
+		void *strs_map;
+		size_t strs_mapsz;
+		const char *strs;
+
+		if (hdr.e32.e_ident[EI_DATA] != order)
+			return (ctf_set_open_errno(errp, ECTF_ENDIAN));
+		if (hdr.e32.e_version != EV_CURRENT)
+			return (ctf_set_open_errno(errp, ECTF_ELFVERS));
+
+		if (hdr.e32.e_ident[EI_CLASS] == ELFCLASS64) {
+			if (nbytes < sizeof (GElf_Ehdr))
+				return (ctf_set_open_errno(errp, ECTF_FMT));
+		} else {
+			Elf32_Ehdr e32 = hdr.e32;
+			ehdr_to_gelf(&e32, &hdr.e64);
+		}
+
+		if (hdr.e64.e_shstrndx >= hdr.e64.e_shnum)
+			return (ctf_set_open_errno(errp, ECTF_CORRUPT));
+
+		n = hdr.e64.e_shnum;
+		nbytes = sizeof (GElf_Shdr) * n;
+
+		if ((sp = malloc(nbytes)) == NULL)
+			return (ctf_set_open_errno(errp, errno));
+
+		/*
+		 * Read in and convert to GElf the array of Shdr structures
+		 * from e_shoff so we can locate sections of interest.
+		 */
+		if (hdr.e32.e_ident[EI_CLASS] == ELFCLASS32) {
+			Elf32_Shdr *sp32;
+
+			nbytes = sizeof (Elf32_Shdr) * n;
+
+			if ((sp32 = malloc(nbytes)) == NULL || pread64(fd,
+			    sp32, nbytes, hdr.e64.e_shoff) != nbytes) {
+				free(sp);
+				return (ctf_set_open_errno(errp, errno));
+			}
+
+			for (i = 0; i < n; i++)
+				shdr_to_gelf(&sp32[i], &sp[i]);
+
+			free(sp32);
+
+		} else if (pread64(fd, sp, nbytes, hdr.e64.e_shoff) != nbytes) {
+			free(sp);
+			return (ctf_set_open_errno(errp, errno));
+		}
+
+		/*
+		 * Now mmap the section header strings section so that we can
+		 * perform string comparison on the section names.
+		 */
+		strs_mapsz = sp[hdr.e64.e_shstrndx].sh_size +
+		    (sp[hdr.e64.e_shstrndx].sh_offset & ~_PAGEMASK);
+
+		strs_map = mmap64(NULL, strs_mapsz, PROT_READ, MAP_PRIVATE,
+		    fd, sp[hdr.e64.e_shstrndx].sh_offset & _PAGEMASK);
+
+		strs = (const char *)strs_map +
+		    (sp[hdr.e64.e_shstrndx].sh_offset & ~_PAGEMASK);
+
+		if (strs_map == MAP_FAILED) {
+			free(sp);
+			return (ctf_set_open_errno(errp, ECTF_MMAP));
+		}
+
+		/*
+		 * Iterate over the section header array looking for the CTF
+		 * section and symbol table.  The strtab is linked to symtab.
+		 */
+		for (i = 0; i < n; i++) {
+			const GElf_Shdr *shp = &sp[i];
+			const GElf_Shdr *lhp = &sp[shp->sh_link];
+
+			if (shp->sh_link >= hdr.e64.e_shnum)
+				continue; /* corrupt sh_link field */
+
+			if (shp->sh_name >= sp[hdr.e64.e_shstrndx].sh_size ||
+			    lhp->sh_name >= sp[hdr.e64.e_shstrndx].sh_size)
+				continue; /* corrupt sh_name field */
+
+			if (shp->sh_type == SHT_PROGBITS &&
+			    strcmp(strs + shp->sh_name, _CTF_SECTION) == 0) {
+				ctfsect.cts_name = strs + shp->sh_name;
+				ctfsect.cts_type = shp->sh_type;
+				ctfsect.cts_flags = shp->sh_flags;
+				ctfsect.cts_size = shp->sh_size;
+				ctfsect.cts_entsize = shp->sh_entsize;
+				ctfsect.cts_offset = (off64_t)shp->sh_offset;
+
+			} else if (shp->sh_type == SHT_SYMTAB) {
+				symsect.cts_name = strs + shp->sh_name;
+				symsect.cts_type = shp->sh_type;
+				symsect.cts_flags = shp->sh_flags;
+				symsect.cts_size = shp->sh_size;
+				symsect.cts_entsize = shp->sh_entsize;
+				symsect.cts_offset = (off64_t)shp->sh_offset;
+
+				strsect.cts_name = strs + lhp->sh_name;
+				strsect.cts_type = lhp->sh_type;
+				strsect.cts_flags = lhp->sh_flags;
+				strsect.cts_size = lhp->sh_size;
+				strsect.cts_entsize = lhp->sh_entsize;
+				strsect.cts_offset = (off64_t)lhp->sh_offset;
+			}
+		}
+
+		free(sp); /* free section header array */
+
+		if (ctfsect.cts_type == SHT_NULL) {
+			(void) munmap(strs_map, strs_mapsz);
+			return (ctf_set_open_errno(errp, ECTF_NOCTFDATA));
+		}
+
+		/*
+		 * Now mmap the CTF data, symtab, and strtab sections and
+		 * call ctf_bufopen() to do the rest of the work.
+		 */
+		if (ctf_sect_mmap(&ctfsect, fd) == MAP_FAILED) {
+			(void) munmap(strs_map, strs_mapsz);
+			return (ctf_set_open_errno(errp, ECTF_MMAP));
+		}
+
+		if (symsect.cts_type != SHT_NULL &&
+		    strsect.cts_type != SHT_NULL) {
+			if (ctf_sect_mmap(&symsect, fd) == MAP_FAILED ||
+			    ctf_sect_mmap(&strsect, fd) == MAP_FAILED) {
+				(void) ctf_set_open_errno(errp, ECTF_MMAP);
+				goto bad; /* unmap all and abort */
+			}
+			fp = ctf_bufopen(&ctfsect, &symsect, &strsect, errp);
+		} else
+			fp = ctf_bufopen(&ctfsect, NULL, NULL, errp);
+bad:
+		if (fp == NULL) {
+			ctf_sect_munmap(&ctfsect);
+			ctf_sect_munmap(&symsect);
+			ctf_sect_munmap(&strsect);
+		} else
+			fp->ctf_flags |= LCTF_MMAP;
+
+		(void) munmap(strs_map, strs_mapsz);
+		return (fp);
+	}
+
+	return (ctf_set_open_errno(errp, ECTF_FMT));
+}
+
+/*
+ * Open the specified file and return a pointer to a CTF container.  The file
+ * can be either an ELF file or raw CTF file.  This is just a convenient
+ * wrapper around ctf_fdopen() for callers.
+ */
+ctf_file_t *
+ctf_open(const char *filename, int *errp)
+{
+	ctf_file_t *fp;
+	int fd;
+
+	if ((fd = open64(filename, O_RDONLY)) == -1) {
+		if (errp != NULL)
+			*errp = errno;
+		return (NULL);
+	}
+
+	fp = ctf_fdopen(fd, errp);
+	(void) close(fd);
+	return (fp);
+}
+
+/*
+ * Write the uncompressed CTF data stream to the specified file descriptor.
+ * This is useful for saving the results of dynamic CTF containers.
+ */
+int
+ctf_write(ctf_file_t *fp, int fd)
+{
+	const uchar_t *buf = fp->ctf_base;
+	ssize_t resid = fp->ctf_size;
+	ssize_t len;
+
+	while (resid != 0) {
+		if ((len = write(fd, buf, resid)) <= 0)
+			return (ctf_set_errno(fp, errno));
+		resid -= len;
+		buf += len;
+	}
+
+	return (0);
+}
+
+/*
+ * Set the CTF library client version to the specified version.  If version is
+ * zero, we just return the default library version number.
+ */
+int
+ctf_version(int version)
+{
+	if (version < 0) {
+		errno = EINVAL;
+		return (-1);
+	}
+
+	if (version > 0) {
+		if (version > CTF_VERSION) {
+			errno = ENOTSUP;
+			return (-1);
+		}
+		ctf_dprintf("ctf_version: client using version %d\n", version);
+		_libctf_version = version;
+	}
+
+	return (_libctf_version);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/ctf_subr.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/ctf_subr.c
new file mode 100644
index 0000000..c6a6967
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/ctf_subr.c
@@ -0,0 +1,118 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <ctf_impl.h>
+#include <libctf.h>
+#ifndef VBOX
+#include <sys/mman.h>
+#include <stdarg.h>
+#else
+# include <iprt/asm.h>
+# include <iprt/log.h>
+#endif
+
+void *
+ctf_data_alloc(size_t size)
+{
+#ifndef VBOX
+	return (mmap(NULL, size, PROT_READ | PROT_WRITE,
+	    MAP_PRIVATE | MAP_ANON, -1, 0));
+#else
+    void *pv = RTMemPageAlloc(size);
+    return pv == NULL ? MAP_FAILED : pv;
+#endif
+}
+
+void
+ctf_data_free(void *buf, size_t size)
+{
+#ifndef VBOX
+	(void) munmap(buf, size);
+#else
+    RTMemProtect(buf, size, RTMEM_PROT_WRITE | RTMEM_PROT_READ);
+    RTMemPageFree(buf, size);
+#endif
+}
+
+void
+ctf_data_protect(void *buf, size_t size)
+{
+#ifndef VBOX
+	(void) mprotect(buf, size, PROT_READ);
+#else
+    int rc = RTMemProtect(buf, size, RTMEM_PROT_READ);
+    AssertRC(rc);
+#endif
+}
+
+void *
+ctf_alloc(size_t size)
+{
+#ifndef VBOX
+	return (malloc(size));
+#else
+    return RTMemAlloc(size);
+#endif
+}
+
+/*ARGSUSED*/
+void
+ctf_free(void *buf, size_t size)
+{
+#ifndef VBOX
+	free(buf);
+#else
+    RTMemFree(buf);
+#endif
+}
+
+const char *
+ctf_strerror(int err)
+{
+	return (strerror(err));
+}
+
+/*PRINTFLIKE1*/
+void
+ctf_dprintf(const char *format, ...)
+{
+	if (_libctf_debug) {
+		va_list alist;
+
+		va_start(alist, format);
+#ifndef VBOX
+		(void) fputs("libctf DEBUG: ", stderr);
+		(void) vfprintf(stderr, format, alist);
+#else
+        RTLogPrintf("libctf DEBUG: %N", format, alist);
+#endif
+		va_end(alist);
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/libctf.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/libctf.h
new file mode 100644
index 0000000..ac7b9a4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/libctf.h
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * This header file defines the interfaces available from the CTF debugger
+ * library, libctf.  This library provides functions that a debugger can
+ * use to operate on data in the Compact ANSI-C Type Format (CTF).  This
+ * is NOT a public interface, although it may eventually become one in
+ * the fullness of time after we gain more experience with the interfaces.
+ *
+ * In the meantime, be aware that any program linked with libctf in this
+ * release of Solaris is almost guaranteed to break in the next release.
+ *
+ * In short, do not user this header file or libctf for any purpose.
+ */
+
+#ifndef	_LIBCTF_H
+#define	_LIBCTF_H
+
+#ifndef VBOX
+# pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <sys/ctf_api.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/*
+ * This flag can be used to enable debug messages.
+ */
+extern int _libctf_debug;
+
+#ifdef VBOX
+extern void libctf_init(void);
+#endif
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _LIBCTF_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/llib-lctf b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/llib-lctf
new file mode 100644
index 0000000..53310de
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/llib-lctf
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2001 by Sun Microsystems, Inc.
+ * All rights reserved.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*LINTLIBRARY*/
+/*PROTOLIB1*/
+
+#include <libctf.h>
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/mapfile-vers b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/mapfile-vers
new file mode 100644
index 0000000..c218edc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/common/mapfile-vers
@@ -0,0 +1,114 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING:  STOP NOW.  DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+#	usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+# There really should be only one SUNWprivate version.
+# Don't add any more.  Add new private symbols to SUNWprivate_1.2
+
+SYMBOL_VERSION SUNWprivate_1.2 {
+    global:
+	ctf_add_array;
+	ctf_add_const;
+	ctf_add_enum;
+	ctf_add_enumerator;
+	ctf_add_float;
+	ctf_add_forward;
+	ctf_add_function;
+	ctf_add_integer;
+	ctf_add_member;
+	ctf_add_pointer;
+	ctf_add_restrict;
+	ctf_add_struct;
+	ctf_add_type;
+	ctf_add_typedef;
+	ctf_add_union;
+	ctf_add_volatile;
+	ctf_create;
+	ctf_discard;
+	ctf_enum_value;
+	ctf_label_info;
+	ctf_label_iter;
+	ctf_label_topmost;
+	ctf_member_info;
+	ctf_parent_file;
+	ctf_parent_name;
+	ctf_set_array;
+	ctf_type_align;
+	ctf_type_cmp;
+	ctf_type_compat;
+	ctf_type_pointer;
+	ctf_update;
+	ctf_write;
+} SUNWprivate_1.1;
+
+SYMBOL_VERSION SUNWprivate_1.1 {
+    global:
+	ctf_array_info;
+	ctf_bufopen;
+	ctf_close;
+	ctf_enum_iter;
+	ctf_enum_name;
+	ctf_errmsg;
+	ctf_errno;
+	ctf_fdopen;
+	ctf_func_args;
+	ctf_func_info;
+	ctf_getmodel;
+	ctf_getspecific;
+	ctf_import;
+	ctf_lookup_by_name;
+	ctf_lookup_by_symbol;
+	ctf_member_iter;
+	ctf_open;
+	ctf_setmodel;
+	ctf_setspecific;
+	ctf_type_encoding;
+	ctf_type_iter;
+	ctf_type_kind;
+	ctf_type_lname;
+	ctf_type_name;
+	ctf_type_reference;
+	ctf_type_resolve;
+	ctf_type_size;
+	ctf_type_visit;
+	ctf_version;
+	_libctf_debug;
+    local:
+	*;
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/i386/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/i386/Makefile
new file mode 100644
index 0000000..a333224
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/i386/Makefile
@@ -0,0 +1,30 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/sparc/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/sparc/Makefile
new file mode 100644
index 0000000..a333224
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/sparc/Makefile
@@ -0,0 +1,30 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.com
+
+install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/sparcv9/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/sparcv9/Makefile
new file mode 100644
index 0000000..c9bd26c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libctf/sparcv9/Makefile
@@ -0,0 +1,31 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/Makefile
new file mode 100644
index 0000000..c24a080
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/Makefile
@@ -0,0 +1,63 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+include ../Makefile.lib
+
+HDRS = dtrace.h
+HDRDIR = common
+
+SUBDIRS = $(MACH) 
+$(BUILD64)SUBDIRS += $(MACH64)
+
+all := TARGET = all
+clean := TARGET = clean
+clobber := TARGET = clobber
+install := TARGET = install
+lint := TARGET = lint
+yydebug := TARGET = yydebug
+
+.KEEP_STATE:
+
+all clean clobber lint yydebug: $(SUBDIRS)
+
+install: install_h $(SUBDIRS)
+
+install_h: $(ROOTHDRS)
+
+check: $(CHECKHDRS)
+
+$(SUBDIRS): FRC
+	@cd $@; pwd; $(MAKE) $(TARGET)
+
+FRC:
+
+include ../Makefile.targ
+
+#
+# Cross-reference customization: build the cross-reference only over the
+# source directories, and ignore Makefiles and machine-generated source.
+#
+XRDIRS = common i386 sparc sparcv9
+XRDEL = dt_lex.c dt_grammar.c Makefile*
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/Makefile.com b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/Makefile.com
new file mode 100644
index 0000000..c4f967f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/Makefile.com
@@ -0,0 +1,233 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+#
+
+LIBRARY = libdtrace.a
+VERS = .1
+
+LIBSRCS = \
+	dt_aggregate.c \
+	dt_as.c \
+	dt_buf.c \
+	dt_cc.c \
+	dt_cg.c \
+	dt_consume.c \
+	dt_decl.c \
+	dt_dis.c \
+	dt_dof.c \
+	dt_error.c \
+	dt_errtags.c \
+	dt_handle.c \
+	dt_ident.c \
+	dt_inttab.c \
+	dt_link.c \
+	dt_list.c \
+	dt_open.c \
+	dt_options.c \
+	dt_program.c \
+	dt_map.c \
+	dt_module.c \
+	dt_names.c \
+	dt_parser.c \
+	dt_pcb.c \
+	dt_pid.c \
+	dt_pragma.c \
+	dt_printf.c \
+	dt_proc.c \
+	dt_provider.c \
+	dt_regset.c \
+        dt_string.c \
+	dt_strtab.c \
+	dt_subr.c \
+	dt_work.c \
+	dt_xlator.c
+
+LIBISASRCS = \
+	dt_isadep.c
+
+OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
+
+DRTISRC = drti.c
+DRTIOBJ = $(DRTISRC:%.c=%.o)
+
+DLIBSRCS += \
+	errno.d \
+	fc.d \
+	io.d \
+	ip.d \
+	iscsit.d \
+	net.d \
+	nfs.d \
+	procfs.d \
+	regs.d \
+	sched.d \
+	signal.d \
+	scsi.d \
+	srp.d \
+	sysevent.d \
+	tcp.d \
+	udp.d \
+	unistd.d
+
+include ../../Makefile.lib
+
+SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c) 
+LIBS = $(DYNLIB) $(LINTLIB)
+
+SRCDIR = ../common
+
+CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
+CLEANFILES += ../common/procfs.sed ../common/procfs.d
+CLEANFILES += ../common/io.sed ../common/io.d
+CLEANFILES += ../common/ip.sed ../common/ip.d
+CLEANFILES += ../common/net.sed ../common/net.d
+CLEANFILES += ../common/errno.d ../common/signal.d
+CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
+CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
+CLEANFILES += ../common/tcp.sed ../common/tcp.d
+CLEANFILES += ../common/udp.sed ../common/udp.d
+
+CLOBBERFILES += drti.o
+
+CPPFLAGS += -I../common -I.
+CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
+CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
+YYCFLAGS =
+LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc
+DRTILDLIBS = $(LDLIBS.lib) -lc
+
+yydebug := YYCFLAGS += -DYYDEBUG
+
+$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
+
+LFLAGS = -t -v
+YFLAGS = -d -v
+
+ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
+ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
+
+ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
+ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
+ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
+
+.KEEP_STATE:
+
+all: $(LIBS) $(DRTIOBJ)
+
+lint: lintdrti lintcheck
+
+lintdrti: ../common/$(DRTISRC)
+	$(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
+
+dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
+	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
+
+dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
+	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
+	@mv y.tab.h dt_grammar.h
+	@mv y.tab.c dt_grammar.c
+
+pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
+pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
+
+pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
+pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
+
+../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
+	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
+
+../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
+	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
+
+../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
+	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
+
+../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
+	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
+
+../common/%.sed: ../common/%.sed.in
+	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
+	    sed 's/\&/\\\&/g' | grep '^s/' > $@
+
+../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
+	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
+
+../common/io.d: ../common/io.sed ../common/io.d.in
+	sed -f ../common/io.sed < ../common/io.d.in > $@
+
+../common/ip.d: ../common/ip.sed ../common/ip.d.in
+	sed -f ../common/ip.sed < ../common/ip.d.in > $@
+
+../common/net.d: ../common/net.sed ../common/net.d.in
+	sed -f ../common/net.sed < ../common/net.d.in > $@
+
+../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
+	sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
+
+../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in
+	sed -f ../common/tcp.sed < ../common/tcp.d.in > $@
+
+../common/udp.d: ../common/udp.sed ../common/udp.d.in
+	sed -f ../common/udp.sed < ../common/udp.d.in > $@
+
+pics/%.o: ../$(MACH)/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
+pics/%.o: ../$(MACH)/%.s
+	$(COMPILE.s) -o $@ $<
+	$(POST_PROCESS_O)
+
+%.o: ../common/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
+$(ROOTDLIBDIR):
+	$(INS.dir)
+
+$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
+	$(INS.dir)
+
+$(ROOTDLIBDIR)/%.d: ../common/%.d
+	$(INS.file)
+
+$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
+	$(INS.file)
+
+$(ROOTDLIBDIR)/%.d: %.d
+	$(INS.file)
+
+$(ROOTDLIBDIR)/%.o: %.o
+	$(INS.file)
+
+$(ROOTDLIBDIR64)/%.o: %.o
+	$(INS.file)
+
+$(ROOTDLIBS): $(ROOTDLIBDIR)
+
+$(ROOTDOBJS): $(ROOTDLIBDIR)
+
+$(ROOTDOBJS64): $(ROOTDLIBDIR64)
+
+include ../../Makefile.targ
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/amd64/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/amd64/Makefile
new file mode 100644
index 0000000..e9cdd5b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/amd64/Makefile
@@ -0,0 +1,46 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+ASFLAGS += $(AS_PICFLAGS) -P -D_ASM
+
+MACHOBJS = dis_tables.o
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+SRCS += $(SRC)/common/dis/i386/dis_tables.c
+CPPFLAGS += -I$(SRC)/common/dis/i386
+CPPFLAGS += -D_ELF64
+
+LINTFLAGS64 += -erroff=E_BAD_PTR_CAST_ALIGN
+
+pics/%.o: $(SRC)/common/dis/i386/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
+install yydebug: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64) \
+	$(ROOTDLIBS) $(ROOTDOBJS64)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/amd64/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/amd64/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/drti.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/drti.c
new file mode 100644
index 0000000..3b5f0cb
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/drti.c
@@ -0,0 +1,190 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <dlfcn.h>
+#include <link.h>
+#include <sys/dtrace.h>
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+/*
+ * In Solaris 10 GA, the only mechanism for communicating helper information
+ * is through the DTrace helper pseudo-device node in /devices; there is
+ * no /dev link. Because of this, USDT providers and helper actions don't
+ * work inside of non-global zones. This issue was addressed by adding
+ * the /dev and having this initialization code use that /dev link. If the
+ * /dev link doesn't exist it falls back to looking for the /devices node
+ * as this code may be embedded in a binary which runs on Solaris 10 GA.
+ *
+ * Users may set the following environment variable to affect the way
+ * helper initialization takes place:
+ *
+ *	DTRACE_DOF_INIT_DEBUG		enable debugging output
+ *	DTRACE_DOF_INIT_DISABLE		disable helper loading
+ *	DTRACE_DOF_INIT_DEVNAME		set the path to the helper node
+ */
+
+static const char *devname = "/dev/dtrace/helper";
+static const char *olddevname = "/devices/pseudo/dtrace at 0:helper";
+
+static const char *modname;	/* Name of this load object */
+static int gen;			/* DOF helper generation */
+extern dof_hdr_t __SUNW_dof;	/* DOF defined in the .SUNW_dof section */
+static boolean_t dof_init_debug = B_FALSE;	/* From DTRACE_DOF_INIT_DEBUG */
+
+static void
+dprintf(int debug, const char *fmt, ...)
+{
+	va_list ap;
+
+	if (debug && !dof_init_debug)
+		return;
+
+	va_start(ap, fmt);
+
+	if (modname == NULL)
+		(void) fprintf(stderr, "dtrace DOF: ");
+	else
+		(void) fprintf(stderr, "dtrace DOF %s: ", modname);
+
+	(void) vfprintf(stderr, fmt, ap);
+
+	if (fmt[strlen(fmt) - 1] != '\n')
+		(void) fprintf(stderr, ": %s\n", strerror(errno));
+
+	va_end(ap);
+}
+
+#pragma init(dtrace_dof_init)
+static void
+dtrace_dof_init(void)
+{
+	dof_hdr_t *dof = &__SUNW_dof;
+#ifdef _LP64
+	Elf64_Ehdr *elf;
+#else
+	Elf32_Ehdr *elf;
+#endif
+	dof_helper_t dh;
+	Link_map *lmp;
+	Lmid_t lmid;
+	int fd;
+	const char *p;
+
+	if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL)
+		return;
+
+	if (getenv("DTRACE_DOF_INIT_DEBUG") != NULL)
+		dof_init_debug = B_TRUE;
+
+	if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lmp) == -1 || lmp == NULL) {
+		dprintf(1, "couldn't discover module name or address\n");
+		return;
+	}
+
+	if (dlinfo(RTLD_SELF, RTLD_DI_LMID, &lmid) == -1) {
+		dprintf(1, "couldn't discover link map ID\n");
+		return;
+	}
+
+	if ((modname = strrchr(lmp->l_name, '/')) == NULL)
+		modname = lmp->l_name;
+	else
+		modname++;
+
+	if (dof->dofh_ident[DOF_ID_MAG0] != DOF_MAG_MAG0 ||
+	    dof->dofh_ident[DOF_ID_MAG1] != DOF_MAG_MAG1 ||
+	    dof->dofh_ident[DOF_ID_MAG2] != DOF_MAG_MAG2 ||
+	    dof->dofh_ident[DOF_ID_MAG3] != DOF_MAG_MAG3) {
+		dprintf(0, ".SUNW_dof section corrupt\n");
+		return;
+	}
+
+	elf = (void *)lmp->l_addr;
+
+	dh.dofhp_dof = (uintptr_t)dof;
+	dh.dofhp_addr = elf->e_type == ET_DYN ? lmp->l_addr : 0;
+
+	if (lmid == 0) {
+		(void) snprintf(dh.dofhp_mod, sizeof (dh.dofhp_mod),
+		    "%s", modname);
+	} else {
+		(void) snprintf(dh.dofhp_mod, sizeof (dh.dofhp_mod),
+		    "LM%lu`%s", lmid, modname);
+	}
+
+	if ((p = getenv("DTRACE_DOF_INIT_DEVNAME")) != NULL)
+		devname = p;
+
+	if ((fd = open64(devname, O_RDWR)) < 0) {
+		dprintf(1, "failed to open helper device %s", devname);
+
+		/*
+		 * If the device path wasn't explicitly set, try again with
+		 * the old device path.
+		 */
+		if (p != NULL)
+			return;
+
+		devname = olddevname;
+
+		if ((fd = open64(devname, O_RDWR)) < 0) {
+			dprintf(1, "failed to open helper device %s", devname);
+			return;
+		}
+	}
+
+	if ((gen = ioctl(fd, DTRACEHIOC_ADDDOF, &dh)) == -1)
+		dprintf(1, "DTrace ioctl failed for DOF at %p", dof);
+	else
+		dprintf(1, "DTrace ioctl succeeded for DOF at %p\n", dof);
+
+	(void) close(fd);
+}
+
+#pragma fini(dtrace_dof_fini)
+static void
+dtrace_dof_fini(void)
+{
+	int fd;
+
+	if ((fd = open64(devname, O_RDWR)) < 0) {
+		dprintf(1, "failed to open helper device %s", devname);
+		return;
+	}
+
+	if ((gen = ioctl(fd, DTRACEHIOC_REMOVE, gen)) == -1)
+		dprintf(1, "DTrace ioctl failed to remove DOF (%d)\n", gen);
+	else
+		dprintf(1, "DTrace ioctl removed DOF (%d)\n", gen);
+
+	(void) close(fd);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_aggregate.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_aggregate.c
new file mode 100644
index 0000000..21b2b42
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_aggregate.c
@@ -0,0 +1,1910 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stdlib.h>
+#include <strings.h>
+#include <errno.h>
+#include <unistd.h>
+#include <dt_impl.h>
+#include <assert.h>
+#include <alloca.h>
+#include <limits.h>
+#else  /* VBOX */
+# include "dt_impl.h"
+# ifdef _MSC_VER
+#  pragma warning(disable:4018) /* signed/unsigned comparsion mismatch warning */
+# endif
+# include <iprt/mp.h>
+#endif /* VBOX */
+
+#define	DTRACE_AHASHSIZE	32779		/* big 'ol prime */
+
+/*
+ * Because qsort(3C) does not allow an argument to be passed to a comparison
+ * function, the variables that affect comparison must regrettably be global;
+ * they are protected by a global static lock, dt_qsort_lock.
+ */
+#ifndef VBOX
+static pthread_mutex_t dt_qsort_lock = PTHREAD_MUTEX_INITIALIZER;
+#else
+RTCRITSECT dt_qsort_lock;
+#endif
+
+static int dt_revsort;
+static int dt_keysort;
+static int dt_keypos;
+
+#define	DT_LESSTHAN	(dt_revsort == 0 ? -1 : 1)
+#define	DT_GREATERTHAN	(dt_revsort == 0 ? 1 : -1)
+
+static void
+dt_aggregate_count(int64_t *existing, int64_t *new, size_t size)
+{
+	int i;
+
+	for (i = 0; i < size / sizeof (int64_t); i++)
+		existing[i] = existing[i] + new[i];
+}
+
+static int
+dt_aggregate_countcmp(int64_t *lhs, int64_t *rhs)
+{
+	int64_t lvar = *lhs;
+	int64_t rvar = *rhs;
+
+	if (lvar < rvar)
+		return (DT_LESSTHAN);
+
+	if (lvar > rvar)
+		return (DT_GREATERTHAN);
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+dt_aggregate_min(int64_t *existing, int64_t *new, size_t size)
+{
+	if (*new < *existing)
+		*existing = *new;
+}
+
+/*ARGSUSED*/
+static void
+dt_aggregate_max(int64_t *existing, int64_t *new, size_t size)
+{
+	if (*new > *existing)
+		*existing = *new;
+}
+
+static int
+dt_aggregate_averagecmp(int64_t *lhs, int64_t *rhs)
+{
+	int64_t lavg = lhs[0] ? (lhs[1] / lhs[0]) : 0;
+	int64_t ravg = rhs[0] ? (rhs[1] / rhs[0]) : 0;
+
+	if (lavg < ravg)
+		return (DT_LESSTHAN);
+
+	if (lavg > ravg)
+		return (DT_GREATERTHAN);
+
+	return (0);
+}
+
+static int
+dt_aggregate_stddevcmp(int64_t *lhs, int64_t *rhs)
+{
+	uint64_t lsd = dt_stddev((uint64_t *)lhs, 1);
+	uint64_t rsd = dt_stddev((uint64_t *)rhs, 1);
+
+	if (lsd < rsd)
+		return (DT_LESSTHAN);
+
+	if (lsd > rsd)
+		return (DT_GREATERTHAN);
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+dt_aggregate_lquantize(int64_t *existing, int64_t *new, size_t size)
+{
+	int64_t arg = *existing++;
+	uint16_t levels = DTRACE_LQUANTIZE_LEVELS(arg);
+	int i;
+
+	for (i = 0; i <= levels + 1; i++)
+		existing[i] = existing[i] + new[i + 1];
+}
+
+static long double
+dt_aggregate_lquantizedsum(int64_t *lquanta)
+{
+	int64_t arg = *lquanta++;
+	int32_t base = DTRACE_LQUANTIZE_BASE(arg);
+	uint16_t step = DTRACE_LQUANTIZE_STEP(arg);
+	uint16_t levels = DTRACE_LQUANTIZE_LEVELS(arg), i;
+	long double total = (long double)lquanta[0] * (long double)(base - 1);
+
+	for (i = 0; i < levels; base += step, i++)
+		total += (long double)lquanta[i + 1] * (long double)base;
+
+	return (total + (long double)lquanta[levels + 1] *
+	    (long double)(base + 1));
+}
+
+static int64_t
+dt_aggregate_lquantizedzero(int64_t *lquanta)
+{
+	int64_t arg = *lquanta++;
+	int32_t base = DTRACE_LQUANTIZE_BASE(arg);
+	uint16_t step = DTRACE_LQUANTIZE_STEP(arg);
+	uint16_t levels = DTRACE_LQUANTIZE_LEVELS(arg), i;
+
+	if (base - 1 == 0)
+		return (lquanta[0]);
+
+	for (i = 0; i < levels; base += step, i++) {
+		if (base != 0)
+			continue;
+
+		return (lquanta[i + 1]);
+	}
+
+	if (base + 1 == 0)
+		return (lquanta[levels + 1]);
+
+	return (0);
+}
+
+static int
+dt_aggregate_lquantizedcmp(int64_t *lhs, int64_t *rhs)
+{
+	long double lsum = dt_aggregate_lquantizedsum(lhs);
+	long double rsum = dt_aggregate_lquantizedsum(rhs);
+	int64_t lzero, rzero;
+
+	if (lsum < rsum)
+		return (DT_LESSTHAN);
+
+	if (lsum > rsum)
+		return (DT_GREATERTHAN);
+
+	/*
+	 * If they're both equal, then we will compare based on the weights at
+	 * zero.  If the weights at zero are equal (or if zero is not within
+	 * the range of the linear quantization), then this will be judged a
+	 * tie and will be resolved based on the key comparison.
+	 */
+	lzero = dt_aggregate_lquantizedzero(lhs);
+	rzero = dt_aggregate_lquantizedzero(rhs);
+
+	if (lzero < rzero)
+		return (DT_LESSTHAN);
+
+	if (lzero > rzero)
+		return (DT_GREATERTHAN);
+
+	return (0);
+}
+
+static int
+dt_aggregate_quantizedcmp(int64_t *lhs, int64_t *rhs)
+{
+	int nbuckets = DTRACE_QUANTIZE_NBUCKETS, i;
+	long double ltotal = 0, rtotal = 0;
+	int64_t lzero, rzero;
+
+	for (i = 0; i < nbuckets; i++) {
+		int64_t bucketval = DTRACE_QUANTIZE_BUCKETVAL(i);
+
+		if (bucketval == 0) {
+			lzero = lhs[i];
+			rzero = rhs[i];
+		}
+
+		ltotal += (long double)bucketval * (long double)lhs[i];
+		rtotal += (long double)bucketval * (long double)rhs[i];
+	}
+
+	if (ltotal < rtotal)
+		return (DT_LESSTHAN);
+
+	if (ltotal > rtotal)
+		return (DT_GREATERTHAN);
+
+	/*
+	 * If they're both equal, then we will compare based on the weights at
+	 * zero.  If the weights at zero are equal, then this will be judged a
+	 * tie and will be resolved based on the key comparison.
+	 */
+	if (lzero < rzero)
+		return (DT_LESSTHAN);
+
+	if (lzero > rzero)
+		return (DT_GREATERTHAN);
+
+	return (0);
+}
+
+static void
+dt_aggregate_usym(dtrace_hdl_t *dtp, uint64_t *data)
+{
+#ifndef VBOX
+	uint64_t pid = data[0];
+	uint64_t *pc = &data[1];
+	struct ps_prochandle *P;
+	GElf_Sym sym;
+
+	if (dtp->dt_vector != NULL)
+		return;
+
+	if ((P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, 0)) == NULL)
+		return;
+
+	dt_proc_lock(dtp, P);
+
+	if (Plookup_by_addr(P, *pc, NULL, 0, &sym) == 0)
+		*pc = sym.st_value;
+
+	dt_proc_unlock(dtp, P);
+	dt_proc_release(dtp, P);
+#endif
+}
+
+static void
+dt_aggregate_umod(dtrace_hdl_t *dtp, uint64_t *data)
+{
+#ifndef VBOX
+	uint64_t pid = data[0];
+	uint64_t *pc = &data[1];
+	struct ps_prochandle *P;
+	const prmap_t *map;
+
+	if (dtp->dt_vector != NULL)
+		return;
+
+	if ((P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, 0)) == NULL)
+		return;
+
+	dt_proc_lock(dtp, P);
+
+	if ((map = Paddr_to_map(P, *pc)) != NULL)
+		*pc = map->pr_vaddr;
+
+	dt_proc_unlock(dtp, P);
+	dt_proc_release(dtp, P);
+#endif
+}
+
+static void
+dt_aggregate_sym(dtrace_hdl_t *dtp, uint64_t *data)
+{
+	GElf_Sym sym;
+	uint64_t *pc = data;
+
+	if (dtrace_lookup_by_addr(dtp, *pc, &sym, NULL) == 0)
+		*pc = sym.st_value;
+}
+
+static void
+dt_aggregate_mod(dtrace_hdl_t *dtp, uint64_t *data)
+{
+	uint64_t *pc = data;
+	dt_module_t *dmp;
+
+	if (dtp->dt_vector != NULL) {
+		/*
+		 * We don't have a way of just getting the module for a
+		 * vectored open, and it doesn't seem to be worth defining
+		 * one.  This means that use of mod() won't get true
+		 * aggregation in the postmortem case (some modules may
+		 * appear more than once in aggregation output).  It seems
+		 * unlikely that anyone will ever notice or care...
+		 */
+		return;
+	}
+
+	for (dmp = dt_list_next(&dtp->dt_modlist); dmp != NULL;
+	    dmp = dt_list_next(dmp)) {
+		if (*pc - dmp->dm_text_va < dmp->dm_text_size) {
+			*pc = dmp->dm_text_va;
+			return;
+		}
+	}
+}
+
+static dtrace_aggvarid_t
+dt_aggregate_aggvarid(dt_ahashent_t *ent)
+{
+	dtrace_aggdesc_t *agg = ent->dtahe_data.dtada_desc;
+	caddr_t data = ent->dtahe_data.dtada_data;
+	dtrace_recdesc_t *rec = agg->dtagd_rec;
+
+	/*
+	 * First, we'll check the variable ID in the aggdesc.  If it's valid,
+	 * we'll return it.  If not, we'll use the compiler-generated ID
+	 * present as the first record.
+	 */
+	if (agg->dtagd_varid != DTRACE_AGGVARIDNONE)
+		return (agg->dtagd_varid);
+
+	agg->dtagd_varid = *((dtrace_aggvarid_t *)(uintptr_t)(data +
+	    rec->dtrd_offset));
+
+	return (agg->dtagd_varid);
+}
+
+
+static int
+dt_aggregate_snap_cpu(dtrace_hdl_t *dtp, processorid_t cpu)
+{
+	dtrace_epid_t id;
+	uint64_t hashval;
+	size_t offs, roffs, size, ndx;
+	int i, j, rval;
+	caddr_t addr, data;
+	dtrace_recdesc_t *rec;
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+	dtrace_aggdesc_t *agg;
+	dt_ahash_t *hash = &agp->dtat_hash;
+	dt_ahashent_t *h;
+	dtrace_bufdesc_t b = agp->dtat_buf, *buf = &b;
+	dtrace_aggdata_t *aggdata;
+	int flags = agp->dtat_flags;
+
+	buf->dtbd_cpu = cpu;
+
+	if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, buf) == -1) {
+		if (errno == ENOENT) {
+			/*
+			 * If that failed with ENOENT, it may be because the
+			 * CPU was unconfigured.  This is okay; we'll just
+			 * do nothing but return success.
+			 */
+			return (0);
+		}
+
+		return (dt_set_errno(dtp, errno));
+	}
+
+	if (buf->dtbd_drops != 0) {
+		if (dt_handle_cpudrop(dtp, cpu,
+		    DTRACEDROP_AGGREGATION, buf->dtbd_drops) == -1)
+			return (-1);
+	}
+
+	if (buf->dtbd_size == 0)
+		return (0);
+
+	if (hash->dtah_hash == NULL) {
+		size_t size;
+
+		hash->dtah_size = DTRACE_AHASHSIZE;
+		size = hash->dtah_size * sizeof (dt_ahashent_t *);
+
+		if ((hash->dtah_hash = malloc(size)) == NULL)
+			return (dt_set_errno(dtp, EDT_NOMEM));
+
+		bzero(hash->dtah_hash, size);
+	}
+
+	for (offs = 0; offs < buf->dtbd_size; ) {
+		/*
+		 * We're guaranteed to have an ID.
+		 */
+		id = *((dtrace_epid_t *)((uintptr_t)buf->dtbd_data +
+		    (uintptr_t)offs));
+
+		if (id == DTRACE_AGGIDNONE) {
+			/*
+			 * This is filler to assure proper alignment of the
+			 * next record; we simply ignore it.
+			 */
+			offs += sizeof (id);
+			continue;
+		}
+
+		if ((rval = dt_aggid_lookup(dtp, id, &agg)) != 0)
+			return (rval);
+
+		addr = buf->dtbd_data + offs;
+		size = agg->dtagd_size;
+		hashval = 0;
+
+		for (j = 0; j < agg->dtagd_nrecs - 1; j++) {
+			rec = &agg->dtagd_rec[j];
+			roffs = rec->dtrd_offset;
+
+			switch (rec->dtrd_action) {
+			case DTRACEACT_USYM:
+				dt_aggregate_usym(dtp,
+				    /* LINTED - alignment */
+				    (uint64_t *)&addr[roffs]);
+				break;
+
+			case DTRACEACT_UMOD:
+				dt_aggregate_umod(dtp,
+				    /* LINTED - alignment */
+				    (uint64_t *)&addr[roffs]);
+				break;
+
+			case DTRACEACT_SYM:
+				/* LINTED - alignment */
+				dt_aggregate_sym(dtp, (uint64_t *)&addr[roffs]);
+				break;
+
+			case DTRACEACT_MOD:
+				/* LINTED - alignment */
+				dt_aggregate_mod(dtp, (uint64_t *)&addr[roffs]);
+				break;
+
+			default:
+				break;
+			}
+
+			for (i = 0; i < rec->dtrd_size; i++)
+				hashval += addr[roffs + i];
+		}
+
+		ndx = hashval % hash->dtah_size;
+
+		for (h = hash->dtah_hash[ndx]; h != NULL; h = h->dtahe_next) {
+			if (h->dtahe_hashval != hashval)
+				continue;
+
+			if (h->dtahe_size != size)
+				continue;
+
+			aggdata = &h->dtahe_data;
+			data = aggdata->dtada_data;
+
+			for (j = 0; j < agg->dtagd_nrecs - 1; j++) {
+				rec = &agg->dtagd_rec[j];
+				roffs = rec->dtrd_offset;
+
+				for (i = 0; i < rec->dtrd_size; i++)
+					if (addr[roffs + i] != data[roffs + i])
+						goto hashnext;
+			}
+
+			/*
+			 * We found it.  Now we need to apply the aggregating
+			 * action on the data here.
+			 */
+			rec = &agg->dtagd_rec[agg->dtagd_nrecs - 1];
+			roffs = rec->dtrd_offset;
+			/* LINTED - alignment */
+			h->dtahe_aggregate((int64_t *)&data[roffs],
+			    /* LINTED - alignment */
+			    (int64_t *)&addr[roffs], rec->dtrd_size);
+
+			/*
+			 * If we're keeping per CPU data, apply the aggregating
+			 * action there as well.
+			 */
+			if (aggdata->dtada_percpu != NULL) {
+				data = aggdata->dtada_percpu[cpu];
+
+				/* LINTED - alignment */
+				h->dtahe_aggregate((int64_t *)data,
+				    /* LINTED - alignment */
+				    (int64_t *)&addr[roffs], rec->dtrd_size);
+			}
+
+			goto bufnext;
+hashnext:
+			continue;
+		}
+
+		/*
+		 * If we're here, we couldn't find an entry for this record.
+		 */
+		if ((h = malloc(sizeof (dt_ahashent_t))) == NULL)
+			return (dt_set_errno(dtp, EDT_NOMEM));
+		bzero(h, sizeof (dt_ahashent_t));
+		aggdata = &h->dtahe_data;
+
+		if ((aggdata->dtada_data = malloc(size)) == NULL) {
+			free(h);
+			return (dt_set_errno(dtp, EDT_NOMEM));
+		}
+
+		bcopy(addr, aggdata->dtada_data, size);
+		aggdata->dtada_size = size;
+		aggdata->dtada_desc = agg;
+		aggdata->dtada_handle = dtp;
+		(void) dt_epid_lookup(dtp, agg->dtagd_epid,
+		    &aggdata->dtada_edesc, &aggdata->dtada_pdesc);
+		aggdata->dtada_normal = 1;
+
+		h->dtahe_hashval = hashval;
+		h->dtahe_size = size;
+		(void) dt_aggregate_aggvarid(h);
+
+		rec = &agg->dtagd_rec[agg->dtagd_nrecs - 1];
+
+		if (flags & DTRACE_A_PERCPU) {
+			int max_cpus = agp->dtat_maxcpu;
+			caddr_t *percpu = malloc(max_cpus * sizeof (caddr_t));
+
+			if (percpu == NULL) {
+				free(aggdata->dtada_data);
+				free(h);
+				return (dt_set_errno(dtp, EDT_NOMEM));
+			}
+
+			for (j = 0; j < max_cpus; j++) {
+				percpu[j] = malloc(rec->dtrd_size);
+
+				if (percpu[j] == NULL) {
+					while (--j >= 0)
+						free(percpu[j]);
+
+					free(aggdata->dtada_data);
+					free(h);
+					return (dt_set_errno(dtp, EDT_NOMEM));
+				}
+
+				if (j == cpu) {
+					bcopy(&addr[rec->dtrd_offset],
+					    percpu[j], rec->dtrd_size);
+				} else {
+					bzero(percpu[j], rec->dtrd_size);
+				}
+			}
+
+			aggdata->dtada_percpu = percpu;
+		}
+
+		switch (rec->dtrd_action) {
+		case DTRACEAGG_MIN:
+			h->dtahe_aggregate = dt_aggregate_min;
+			break;
+
+		case DTRACEAGG_MAX:
+			h->dtahe_aggregate = dt_aggregate_max;
+			break;
+
+		case DTRACEAGG_LQUANTIZE:
+			h->dtahe_aggregate = dt_aggregate_lquantize;
+			break;
+
+		case DTRACEAGG_COUNT:
+		case DTRACEAGG_SUM:
+		case DTRACEAGG_AVG:
+		case DTRACEAGG_STDDEV:
+		case DTRACEAGG_QUANTIZE:
+			h->dtahe_aggregate = dt_aggregate_count;
+			break;
+
+		default:
+			return (dt_set_errno(dtp, EDT_BADAGG));
+		}
+
+		if (hash->dtah_hash[ndx] != NULL)
+			hash->dtah_hash[ndx]->dtahe_prev = h;
+
+		h->dtahe_next = hash->dtah_hash[ndx];
+		hash->dtah_hash[ndx] = h;
+
+		if (hash->dtah_all != NULL)
+			hash->dtah_all->dtahe_prevall = h;
+
+		h->dtahe_nextall = hash->dtah_all;
+		hash->dtah_all = h;
+bufnext:
+		offs += agg->dtagd_size;
+	}
+
+	return (0);
+}
+
+int
+dtrace_aggregate_snap(dtrace_hdl_t *dtp)
+{
+	int i, rval;
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+	hrtime_t now = gethrtime();
+	dtrace_optval_t interval = dtp->dt_options[DTRACEOPT_AGGRATE];
+
+	if (dtp->dt_lastagg != 0) {
+		if (now - dtp->dt_lastagg < interval)
+			return (0);
+
+		dtp->dt_lastagg += interval;
+	} else {
+		dtp->dt_lastagg = now;
+	}
+
+	if (!dtp->dt_active)
+		return (dt_set_errno(dtp, EINVAL));
+
+	if (agp->dtat_buf.dtbd_size == 0)
+		return (0);
+
+	for (i = 0; i < agp->dtat_ncpus; i++) {
+		if ((rval = dt_aggregate_snap_cpu(dtp, agp->dtat_cpus[i])))
+			return (rval);
+	}
+
+	return (0);
+}
+
+static int
+dt_aggregate_hashcmp(const void *lhs, const void *rhs)
+{
+	dt_ahashent_t *lh = *((dt_ahashent_t **)lhs);
+	dt_ahashent_t *rh = *((dt_ahashent_t **)rhs);
+	dtrace_aggdesc_t *lagg = lh->dtahe_data.dtada_desc;
+	dtrace_aggdesc_t *ragg = rh->dtahe_data.dtada_desc;
+
+	if (lagg->dtagd_nrecs < ragg->dtagd_nrecs)
+		return (DT_LESSTHAN);
+
+	if (lagg->dtagd_nrecs > ragg->dtagd_nrecs)
+		return (DT_GREATERTHAN);
+
+	return (0);
+}
+
+static int
+dt_aggregate_varcmp(const void *lhs, const void *rhs)
+{
+	dt_ahashent_t *lh = *((dt_ahashent_t **)lhs);
+	dt_ahashent_t *rh = *((dt_ahashent_t **)rhs);
+	dtrace_aggvarid_t lid, rid;
+
+	lid = dt_aggregate_aggvarid(lh);
+	rid = dt_aggregate_aggvarid(rh);
+
+	if (lid < rid)
+		return (DT_LESSTHAN);
+
+	if (lid > rid)
+		return (DT_GREATERTHAN);
+
+	return (0);
+}
+
+static int
+dt_aggregate_keycmp(const void *lhs, const void *rhs)
+{
+	dt_ahashent_t *lh = *((dt_ahashent_t **)lhs);
+	dt_ahashent_t *rh = *((dt_ahashent_t **)rhs);
+	dtrace_aggdesc_t *lagg = lh->dtahe_data.dtada_desc;
+	dtrace_aggdesc_t *ragg = rh->dtahe_data.dtada_desc;
+	dtrace_recdesc_t *lrec, *rrec;
+	char *ldata, *rdata;
+	int rval, i, j, keypos, nrecs;
+
+	if ((rval = dt_aggregate_hashcmp(lhs, rhs)) != 0)
+		return (rval);
+
+	nrecs = lagg->dtagd_nrecs - 1;
+	assert(nrecs == ragg->dtagd_nrecs - 1);
+
+	keypos = dt_keypos + 1 >= nrecs ? 0 : dt_keypos;
+
+	for (i = 1; i < nrecs; i++) {
+		uint64_t lval, rval;
+		int ndx = i + keypos;
+
+		if (ndx >= nrecs)
+			ndx = ndx - nrecs + 1;
+
+		lrec = &lagg->dtagd_rec[ndx];
+		rrec = &ragg->dtagd_rec[ndx];
+
+		ldata = lh->dtahe_data.dtada_data + lrec->dtrd_offset;
+		rdata = rh->dtahe_data.dtada_data + rrec->dtrd_offset;
+
+		if (lrec->dtrd_size < rrec->dtrd_size)
+			return (DT_LESSTHAN);
+
+		if (lrec->dtrd_size > rrec->dtrd_size)
+			return (DT_GREATERTHAN);
+
+		switch (lrec->dtrd_size) {
+		case sizeof (uint64_t):
+			/* LINTED - alignment */
+			lval = *((uint64_t *)ldata);
+			/* LINTED - alignment */
+			rval = *((uint64_t *)rdata);
+			break;
+
+		case sizeof (uint32_t):
+			/* LINTED - alignment */
+			lval = *((uint32_t *)ldata);
+			/* LINTED - alignment */
+			rval = *((uint32_t *)rdata);
+			break;
+
+		case sizeof (uint16_t):
+			/* LINTED - alignment */
+			lval = *((uint16_t *)ldata);
+			/* LINTED - alignment */
+			rval = *((uint16_t *)rdata);
+			break;
+
+		case sizeof (uint8_t):
+			lval = *((uint8_t *)ldata);
+			rval = *((uint8_t *)rdata);
+			break;
+
+		default:
+			switch (lrec->dtrd_action) {
+			case DTRACEACT_UMOD:
+			case DTRACEACT_UADDR:
+			case DTRACEACT_USYM:
+				for (j = 0; j < 2; j++) {
+					/* LINTED - alignment */
+					lval = ((uint64_t *)ldata)[j];
+					/* LINTED - alignment */
+					rval = ((uint64_t *)rdata)[j];
+
+					if (lval < rval)
+						return (DT_LESSTHAN);
+
+					if (lval > rval)
+						return (DT_GREATERTHAN);
+				}
+
+				break;
+
+			default:
+				for (j = 0; j < lrec->dtrd_size; j++) {
+					lval = ((uint8_t *)ldata)[j];
+					rval = ((uint8_t *)rdata)[j];
+
+					if (lval < rval)
+						return (DT_LESSTHAN);
+
+					if (lval > rval)
+						return (DT_GREATERTHAN);
+				}
+			}
+
+			continue;
+		}
+
+		if (lval < rval)
+			return (DT_LESSTHAN);
+
+		if (lval > rval)
+			return (DT_GREATERTHAN);
+	}
+
+	return (0);
+}
+
+static int
+dt_aggregate_valcmp(const void *lhs, const void *rhs)
+{
+	dt_ahashent_t *lh = *((dt_ahashent_t **)lhs);
+	dt_ahashent_t *rh = *((dt_ahashent_t **)rhs);
+	dtrace_aggdesc_t *lagg = lh->dtahe_data.dtada_desc;
+	dtrace_aggdesc_t *ragg = rh->dtahe_data.dtada_desc;
+	caddr_t ldata = lh->dtahe_data.dtada_data;
+	caddr_t rdata = rh->dtahe_data.dtada_data;
+	dtrace_recdesc_t *lrec, *rrec;
+	int64_t *laddr, *raddr;
+	int rval, i;
+
+	if ((rval = dt_aggregate_hashcmp(lhs, rhs)) != 0)
+		return (rval);
+
+	if (lagg->dtagd_nrecs > ragg->dtagd_nrecs)
+		return (DT_GREATERTHAN);
+
+	if (lagg->dtagd_nrecs < ragg->dtagd_nrecs)
+		return (DT_LESSTHAN);
+
+	for (i = 0; i < lagg->dtagd_nrecs; i++) {
+		lrec = &lagg->dtagd_rec[i];
+		rrec = &ragg->dtagd_rec[i];
+
+		if (lrec->dtrd_offset < rrec->dtrd_offset)
+			return (DT_LESSTHAN);
+
+		if (lrec->dtrd_offset > rrec->dtrd_offset)
+			return (DT_GREATERTHAN);
+
+		if (lrec->dtrd_action < rrec->dtrd_action)
+			return (DT_LESSTHAN);
+
+		if (lrec->dtrd_action > rrec->dtrd_action)
+			return (DT_GREATERTHAN);
+	}
+
+	laddr = (int64_t *)(uintptr_t)(ldata + lrec->dtrd_offset);
+	raddr = (int64_t *)(uintptr_t)(rdata + rrec->dtrd_offset);
+
+	switch (lrec->dtrd_action) {
+	case DTRACEAGG_AVG:
+		rval = dt_aggregate_averagecmp(laddr, raddr);
+		break;
+
+	case DTRACEAGG_STDDEV:
+		rval = dt_aggregate_stddevcmp(laddr, raddr);
+		break;
+
+	case DTRACEAGG_QUANTIZE:
+		rval = dt_aggregate_quantizedcmp(laddr, raddr);
+		break;
+
+	case DTRACEAGG_LQUANTIZE:
+		rval = dt_aggregate_lquantizedcmp(laddr, raddr);
+		break;
+
+	case DTRACEAGG_COUNT:
+	case DTRACEAGG_SUM:
+	case DTRACEAGG_MIN:
+	case DTRACEAGG_MAX:
+		rval = dt_aggregate_countcmp(laddr, raddr);
+		break;
+
+	default:
+		assert(0);
+	}
+
+	return (rval);
+}
+
+static int
+dt_aggregate_valkeycmp(const void *lhs, const void *rhs)
+{
+	int rval;
+
+	if ((rval = dt_aggregate_valcmp(lhs, rhs)) != 0)
+		return (rval);
+
+	/*
+	 * If we're here, the values for the two aggregation elements are
+	 * equal.  We already know that the key layout is the same for the two
+	 * elements; we must now compare the keys themselves as a tie-breaker.
+	 */
+	return (dt_aggregate_keycmp(lhs, rhs));
+}
+
+static int
+dt_aggregate_keyvarcmp(const void *lhs, const void *rhs)
+{
+	int rval;
+
+	if ((rval = dt_aggregate_keycmp(lhs, rhs)) != 0)
+		return (rval);
+
+	return (dt_aggregate_varcmp(lhs, rhs));
+}
+
+static int
+dt_aggregate_varkeycmp(const void *lhs, const void *rhs)
+{
+	int rval;
+
+	if ((rval = dt_aggregate_varcmp(lhs, rhs)) != 0)
+		return (rval);
+
+	return (dt_aggregate_keycmp(lhs, rhs));
+}
+
+static int
+dt_aggregate_valvarcmp(const void *lhs, const void *rhs)
+{
+	int rval;
+
+	if ((rval = dt_aggregate_valkeycmp(lhs, rhs)) != 0)
+		return (rval);
+
+	return (dt_aggregate_varcmp(lhs, rhs));
+}
+
+static int
+dt_aggregate_varvalcmp(const void *lhs, const void *rhs)
+{
+	int rval;
+
+	if ((rval = dt_aggregate_varcmp(lhs, rhs)) != 0)
+		return (rval);
+
+	return (dt_aggregate_valkeycmp(lhs, rhs));
+}
+
+static int
+dt_aggregate_keyvarrevcmp(const void *lhs, const void *rhs)
+{
+	return (dt_aggregate_keyvarcmp(rhs, lhs));
+}
+
+static int
+dt_aggregate_varkeyrevcmp(const void *lhs, const void *rhs)
+{
+	return (dt_aggregate_varkeycmp(rhs, lhs));
+}
+
+static int
+dt_aggregate_valvarrevcmp(const void *lhs, const void *rhs)
+{
+	return (dt_aggregate_valvarcmp(rhs, lhs));
+}
+
+static int
+dt_aggregate_varvalrevcmp(const void *lhs, const void *rhs)
+{
+	return (dt_aggregate_varvalcmp(rhs, lhs));
+}
+
+static int
+dt_aggregate_bundlecmp(const void *lhs, const void *rhs)
+{
+	dt_ahashent_t **lh = *((dt_ahashent_t ***)lhs);
+	dt_ahashent_t **rh = *((dt_ahashent_t ***)rhs);
+	int i, rval;
+
+	if (dt_keysort) {
+		/*
+		 * If we're sorting on keys, we need to scan until we find the
+		 * last entry -- that's the representative key.  (The order of
+		 * the bundle is values followed by key to accommodate the
+		 * default behavior of sorting by value.)  If the keys are
+		 * equal, we'll fall into the value comparison loop, below.
+		 */
+		for (i = 0; lh[i + 1] != NULL; i++)
+			continue;
+
+		assert(i != 0);
+		assert(rh[i + 1] == NULL);
+
+		if ((rval = dt_aggregate_keycmp(&lh[i], &rh[i])) != 0)
+			return (rval);
+	}
+
+	for (i = 0; ; i++) {
+		if (lh[i + 1] == NULL) {
+			/*
+			 * All of the values are equal; if we're sorting on
+			 * keys, then we're only here because the keys were
+			 * found to be equal and these records are therefore
+			 * equal.  If we're not sorting on keys, we'll use the
+			 * key comparison from the representative key as the
+			 * tie-breaker.
+			 */
+			if (dt_keysort)
+				return (0);
+
+			assert(i != 0);
+			assert(rh[i + 1] == NULL);
+			return (dt_aggregate_keycmp(&lh[i], &rh[i]));
+		} else {
+			if ((rval = dt_aggregate_valcmp(&lh[i], &rh[i])) != 0)
+				return (rval);
+		}
+	}
+}
+
+int
+dt_aggregate_go(dtrace_hdl_t *dtp)
+{
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+	dtrace_optval_t size, cpu;
+	dtrace_bufdesc_t *buf = &agp->dtat_buf;
+	int rval, i;
+
+	assert(agp->dtat_maxcpu == 0);
+	assert(agp->dtat_ncpu == 0);
+	assert(agp->dtat_cpus == NULL);
+
+#ifndef VBOX
+	agp->dtat_maxcpu = dt_sysconf(dtp, _SC_CPUID_MAX) + 1;
+	agp->dtat_ncpu = dt_sysconf(dtp, _SC_NPROCESSORS_MAX);
+#else
+	agp->dtat_maxcpu = RTMpGetMaxCpuId() + 1;
+	agp->dtat_ncpu = RTMpGetCount();
+#endif
+	agp->dtat_cpus = malloc(agp->dtat_ncpu * sizeof (processorid_t));
+
+	if (agp->dtat_cpus == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	/*
+	 * Use the aggregation buffer size as reloaded from the kernel.
+	 */
+	size = dtp->dt_options[DTRACEOPT_AGGSIZE];
+
+	rval = dtrace_getopt(dtp, "aggsize", &size);
+	assert(rval == 0);
+
+	if (size == 0 || size == DTRACEOPT_UNSET)
+		return (0);
+
+	buf = &agp->dtat_buf;
+	buf->dtbd_size = size;
+
+	if ((buf->dtbd_data = malloc(buf->dtbd_size)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	/*
+	 * Now query for the CPUs enabled.
+	 */
+	rval = dtrace_getopt(dtp, "cpu", &cpu);
+	assert(rval == 0 && cpu != DTRACEOPT_UNSET);
+
+	if (cpu != DTRACE_CPUALL) {
+		assert(cpu < agp->dtat_ncpu);
+		agp->dtat_cpus[agp->dtat_ncpus++] = (processorid_t)cpu;
+
+		return (0);
+	}
+
+	agp->dtat_ncpus = 0;
+	for (i = 0; i < agp->dtat_maxcpu; i++) {
+		if (dt_status(dtp, i) == -1)
+			continue;
+
+		agp->dtat_cpus[agp->dtat_ncpus++] = i;
+	}
+
+	return (0);
+}
+
+static int
+dt_aggwalk_rval(dtrace_hdl_t *dtp, dt_ahashent_t *h, int rval)
+{
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+	dtrace_aggdata_t *data;
+	dtrace_aggdesc_t *aggdesc;
+	dtrace_recdesc_t *rec;
+	int i;
+
+	switch (rval) {
+	case DTRACE_AGGWALK_NEXT:
+		break;
+
+	case DTRACE_AGGWALK_CLEAR: {
+		uint32_t size, offs = 0;
+
+		aggdesc = h->dtahe_data.dtada_desc;
+		rec = &aggdesc->dtagd_rec[aggdesc->dtagd_nrecs - 1];
+		size = rec->dtrd_size;
+		data = &h->dtahe_data;
+
+		if (rec->dtrd_action == DTRACEAGG_LQUANTIZE) {
+			offs = sizeof (uint64_t);
+			size -= sizeof (uint64_t);
+		}
+
+		bzero(&data->dtada_data[rec->dtrd_offset] + offs, size);
+
+		if (data->dtada_percpu == NULL)
+			break;
+
+		for (i = 0; i < dtp->dt_aggregate.dtat_maxcpu; i++)
+			bzero(data->dtada_percpu[i] + offs, size);
+		break;
+	}
+
+	case DTRACE_AGGWALK_ERROR:
+		/*
+		 * We assume that errno is already set in this case.
+		 */
+		return (dt_set_errno(dtp, errno));
+
+	case DTRACE_AGGWALK_ABORT:
+		return (dt_set_errno(dtp, EDT_DIRABORT));
+
+	case DTRACE_AGGWALK_DENORMALIZE:
+		h->dtahe_data.dtada_normal = 1;
+		return (0);
+
+	case DTRACE_AGGWALK_NORMALIZE:
+		if (h->dtahe_data.dtada_normal == 0) {
+			h->dtahe_data.dtada_normal = 1;
+			return (dt_set_errno(dtp, EDT_BADRVAL));
+		}
+
+		return (0);
+
+	case DTRACE_AGGWALK_REMOVE: {
+		dtrace_aggdata_t *aggdata = &h->dtahe_data;
+		int i, max_cpus = agp->dtat_maxcpu;
+
+		/*
+		 * First, remove this hash entry from its hash chain.
+		 */
+		if (h->dtahe_prev != NULL) {
+			h->dtahe_prev->dtahe_next = h->dtahe_next;
+		} else {
+			dt_ahash_t *hash = &agp->dtat_hash;
+			size_t ndx = h->dtahe_hashval % hash->dtah_size;
+
+			assert(hash->dtah_hash[ndx] == h);
+			hash->dtah_hash[ndx] = h->dtahe_next;
+		}
+
+		if (h->dtahe_next != NULL)
+			h->dtahe_next->dtahe_prev = h->dtahe_prev;
+
+		/*
+		 * Now remove it from the list of all hash entries.
+		 */
+		if (h->dtahe_prevall != NULL) {
+			h->dtahe_prevall->dtahe_nextall = h->dtahe_nextall;
+		} else {
+			dt_ahash_t *hash = &agp->dtat_hash;
+
+			assert(hash->dtah_all == h);
+			hash->dtah_all = h->dtahe_nextall;
+		}
+
+		if (h->dtahe_nextall != NULL)
+			h->dtahe_nextall->dtahe_prevall = h->dtahe_prevall;
+
+		/*
+		 * We're unlinked.  We can safely destroy the data.
+		 */
+		if (aggdata->dtada_percpu != NULL) {
+			for (i = 0; i < max_cpus; i++)
+				free(aggdata->dtada_percpu[i]);
+			free(aggdata->dtada_percpu);
+		}
+
+		free(aggdata->dtada_data);
+		free(h);
+
+		return (0);
+	}
+
+	default:
+		return (dt_set_errno(dtp, EDT_BADRVAL));
+	}
+
+	return (0);
+}
+
+void
+dt_aggregate_qsort(dtrace_hdl_t *dtp, void *base, size_t nel, size_t width,
+    int (*compar)(const void *, const void *))
+{
+	int rev = dt_revsort, key = dt_keysort, keypos = dt_keypos;
+	dtrace_optval_t keyposopt = dtp->dt_options[DTRACEOPT_AGGSORTKEYPOS];
+
+	dt_revsort = (dtp->dt_options[DTRACEOPT_AGGSORTREV] != DTRACEOPT_UNSET);
+	dt_keysort = (dtp->dt_options[DTRACEOPT_AGGSORTKEY] != DTRACEOPT_UNSET);
+
+	if (keyposopt != DTRACEOPT_UNSET && keyposopt <= INT_MAX) {
+		dt_keypos = (int)keyposopt;
+	} else {
+		dt_keypos = 0;
+	}
+
+	if (compar == NULL) {
+		if (!dt_keysort) {
+			compar = dt_aggregate_varvalcmp;
+		} else {
+			compar = dt_aggregate_varkeycmp;
+		}
+	}
+
+	qsort(base, nel, width, compar);
+
+	dt_revsort = rev;
+	dt_keysort = key;
+	dt_keypos = keypos;
+}
+
+int
+dtrace_aggregate_walk(dtrace_hdl_t *dtp, dtrace_aggregate_f *func, void *arg)
+{
+	dt_ahashent_t *h, *next;
+	dt_ahash_t *hash = &dtp->dt_aggregate.dtat_hash;
+
+	for (h = hash->dtah_all; h != NULL; h = next) {
+		/*
+		 * dt_aggwalk_rval() can potentially remove the current hash
+		 * entry; we need to load the next hash entry before calling
+		 * into it.
+		 */
+		next = h->dtahe_nextall;
+
+		if (dt_aggwalk_rval(dtp, h, func(&h->dtahe_data, arg)) == -1)
+			return (-1);
+	}
+
+	return (0);
+}
+
+static int
+dt_aggregate_walk_sorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg,
+    int (*sfunc)(const void *, const void *))
+{
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+	dt_ahashent_t *h, **sorted;
+	dt_ahash_t *hash = &agp->dtat_hash;
+	size_t i, nentries = 0;
+
+	for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall)
+		nentries++;
+
+	sorted = dt_alloc(dtp, nentries * sizeof (dt_ahashent_t *));
+
+	if (sorted == NULL)
+		return (-1);
+
+	for (h = hash->dtah_all, i = 0; h != NULL; h = h->dtahe_nextall)
+		sorted[i++] = h;
+
+#ifndef VBOX
+	(void) pthread_mutex_lock(&dt_qsort_lock);
+#else
+	RTCritSectEnter(&dt_qsort_lock);
+#endif
+
+	if (sfunc == NULL) {
+		dt_aggregate_qsort(dtp, sorted, nentries,
+		    sizeof (dt_ahashent_t *), NULL);
+	} else {
+		/*
+		 * If we've been explicitly passed a sorting function,
+		 * we'll use that -- ignoring the values of the "aggsortrev",
+		 * "aggsortkey" and "aggsortkeypos" options.
+		 */
+		qsort(sorted, nentries, sizeof (dt_ahashent_t *), sfunc);
+	}
+
+#ifndef VBOX
+	(void) pthread_mutex_unlock(&dt_qsort_lock);
+#else
+	RTCritSectLeave(&dt_qsort_lock);
+#endif
+
+	for (i = 0; i < nentries; i++) {
+		h = sorted[i];
+
+		if (dt_aggwalk_rval(dtp, h, func(&h->dtahe_data, arg)) == -1) {
+			dt_free(dtp, sorted);
+			return (-1);
+		}
+	}
+
+	dt_free(dtp, sorted);
+	return (0);
+}
+
+int
+dtrace_aggregate_walk_sorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func, arg, NULL));
+}
+
+int
+dtrace_aggregate_walk_keysorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func,
+	    arg, dt_aggregate_varkeycmp));
+}
+
+int
+dtrace_aggregate_walk_valsorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func,
+	    arg, dt_aggregate_varvalcmp));
+}
+
+int
+dtrace_aggregate_walk_keyvarsorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func,
+	    arg, dt_aggregate_keyvarcmp));
+}
+
+int
+dtrace_aggregate_walk_valvarsorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func,
+	    arg, dt_aggregate_valvarcmp));
+}
+
+int
+dtrace_aggregate_walk_keyrevsorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func,
+	    arg, dt_aggregate_varkeyrevcmp));
+}
+
+int
+dtrace_aggregate_walk_valrevsorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func,
+	    arg, dt_aggregate_varvalrevcmp));
+}
+
+int
+dtrace_aggregate_walk_keyvarrevsorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func,
+	    arg, dt_aggregate_keyvarrevcmp));
+}
+
+int
+dtrace_aggregate_walk_valvarrevsorted(dtrace_hdl_t *dtp,
+    dtrace_aggregate_f *func, void *arg)
+{
+	return (dt_aggregate_walk_sorted(dtp, func,
+	    arg, dt_aggregate_valvarrevcmp));
+}
+
+int
+dtrace_aggregate_walk_joined(dtrace_hdl_t *dtp, dtrace_aggvarid_t *aggvars,
+    int naggvars, dtrace_aggregate_walk_joined_f *func, void *arg)
+{
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+	dt_ahashent_t *h, **sorted = NULL, ***bundle, **nbundle;
+	const dtrace_aggdata_t **data;
+	dt_ahashent_t *zaggdata = NULL;
+	dt_ahash_t *hash = &agp->dtat_hash;
+	size_t nentries = 0, nbundles = 0, start, zsize = 0, bundlesize;
+	dtrace_aggvarid_t max = 0, aggvar;
+	int rval = -1, *map, *remap = NULL;
+	int i, j;
+	dtrace_optval_t sortpos = dtp->dt_options[DTRACEOPT_AGGSORTPOS];
+
+	/*
+	 * If the sorting position is greater than the number of aggregation
+	 * variable IDs, we silently set it to 0.
+	 */
+	if (sortpos == DTRACEOPT_UNSET || sortpos >= naggvars)
+		sortpos = 0;
+
+	/*
+	 * First we need to translate the specified aggregation variable IDs
+	 * into a linear map that will allow us to translate an aggregation
+	 * variable ID into its position in the specified aggvars.
+	 */
+	for (i = 0; i < naggvars; i++) {
+		if (aggvars[i] == DTRACE_AGGVARIDNONE || aggvars[i] < 0)
+			return (dt_set_errno(dtp, EDT_BADAGGVAR));
+
+		if (aggvars[i] > max)
+			max = aggvars[i];
+	}
+
+	if ((map = dt_zalloc(dtp, (max + 1) * sizeof (int))) == NULL)
+		return (-1);
+
+	zaggdata = dt_zalloc(dtp, naggvars * sizeof (dt_ahashent_t));
+
+	if (zaggdata == NULL)
+		goto out;
+
+	for (i = 0; i < naggvars; i++) {
+		int ndx = i + sortpos;
+
+		if (ndx >= naggvars)
+			ndx -= naggvars;
+
+		aggvar = aggvars[ndx];
+		assert(aggvar <= max);
+
+		if (map[aggvar]) {
+			/*
+			 * We have an aggregation variable that is present
+			 * more than once in the array of aggregation
+			 * variables.  While it's unclear why one might want
+			 * to do this, it's legal.  To support this construct,
+			 * we will allocate a remap that will indicate the
+			 * position from which this aggregation variable
+			 * should be pulled.  (That is, where the remap will
+			 * map from one position to another.)
+			 */
+			if (remap == NULL) {
+				remap = dt_zalloc(dtp, naggvars * sizeof (int));
+
+				if (remap == NULL)
+					goto out;
+			}
+
+			/*
+			 * Given that the variable is already present, assert
+			 * that following through the mapping and adjusting
+			 * for the sort position yields the same aggregation
+			 * variable ID.
+			 */
+			assert(aggvars[(map[aggvar] - 1 + sortpos) %
+			    naggvars] == aggvars[ndx]);
+
+			remap[i] = map[aggvar];
+			continue;
+		}
+
+		map[aggvar] = i + 1;
+	}
+
+	/*
+	 * We need to take two passes over the data to size our allocation, so
+	 * we'll use the first pass to also fill in the zero-filled data to be
+	 * used to properly format a zero-valued aggregation.
+	 */
+	for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) {
+		dtrace_aggvarid_t id;
+		int ndx;
+
+		if ((id = dt_aggregate_aggvarid(h)) > max || !(ndx = map[id]))
+			continue;
+
+		if (zaggdata[ndx - 1].dtahe_size == 0) {
+			zaggdata[ndx - 1].dtahe_size = h->dtahe_size;
+			zaggdata[ndx - 1].dtahe_data = h->dtahe_data;
+		}
+
+		nentries++;
+	}
+
+	if (nentries == 0) {
+		/*
+		 * We couldn't find any entries; there is nothing else to do.
+		 */
+		rval = 0;
+		goto out;
+	}
+
+	/*
+	 * Before we sort the data, we're going to look for any holes in our
+	 * zero-filled data.  This will occur if an aggregation variable that
+	 * we are being asked to print has not yet been assigned the result of
+	 * any aggregating action for _any_ tuple.  The issue becomes that we
+	 * would like a zero value to be printed for all columns for this
+	 * aggregation, but without any record description, we don't know the
+	 * aggregating action that corresponds to the aggregation variable.  To
+	 * try to find a match, we're simply going to lookup aggregation IDs
+	 * (which are guaranteed to be contiguous and to start from 1), looking
+	 * for the specified aggregation variable ID.  If we find a match,
+	 * we'll use that.  If we iterate over all aggregation IDs and don't
+	 * find a match, then we must be an anonymous enabling.  (Anonymous
+	 * enablings can't currently derive either aggregation variable IDs or
+	 * aggregation variable names given only an aggregation ID.)  In this
+	 * obscure case (anonymous enabling, multiple aggregation printa() with
+	 * some aggregations not represented for any tuple), our defined
+	 * behavior is that the zero will be printed in the format of the first
+	 * aggregation variable that contains any non-zero value.
+	 */
+	for (i = 0; i < naggvars; i++) {
+		if (zaggdata[i].dtahe_size == 0) {
+			dtrace_aggvarid_t aggvar;
+
+			aggvar = aggvars[(i - sortpos + naggvars) % naggvars];
+			assert(zaggdata[i].dtahe_data.dtada_data == NULL);
+
+			for (j = DTRACE_AGGIDNONE + 1; ; j++) {
+				dtrace_aggdesc_t *agg;
+				dtrace_aggdata_t *aggdata;
+
+				if (dt_aggid_lookup(dtp, j, &agg) != 0)
+					break;
+
+				if (agg->dtagd_varid != aggvar)
+					continue;
+
+				/*
+				 * We have our description -- now we need to
+				 * cons up the zaggdata entry for it.
+				 */
+				aggdata = &zaggdata[i].dtahe_data;
+				aggdata->dtada_size = agg->dtagd_size;
+				aggdata->dtada_desc = agg;
+				aggdata->dtada_handle = dtp;
+				(void) dt_epid_lookup(dtp, agg->dtagd_epid,
+				    &aggdata->dtada_edesc,
+				    &aggdata->dtada_pdesc);
+				aggdata->dtada_normal = 1;
+				zaggdata[i].dtahe_hashval = 0;
+				zaggdata[i].dtahe_size = agg->dtagd_size;
+				break;
+			}
+
+			if (zaggdata[i].dtahe_size == 0) {
+				caddr_t data;
+
+				/*
+				 * We couldn't find this aggregation, meaning
+				 * that we have never seen it before for any
+				 * tuple _and_ this is an anonymous enabling.
+				 * That is, we're in the obscure case outlined
+				 * above.  In this case, our defined behavior
+				 * is to format the data in the format of the
+				 * first non-zero aggregation -- of which, of
+				 * course, we know there to be at least one
+				 * (or nentries would have been zero).
+				 */
+				for (j = 0; j < naggvars; j++) {
+					if (zaggdata[j].dtahe_size != 0)
+						break;
+				}
+
+				assert(j < naggvars);
+				zaggdata[i] = zaggdata[j];
+
+				data = zaggdata[i].dtahe_data.dtada_data;
+				assert(data != NULL);
+			}
+		}
+	}
+
+	/*
+	 * Now we need to allocate our zero-filled data for use for
+	 * aggregations that don't have a value corresponding to a given key.
+	 */
+	for (i = 0; i < naggvars; i++) {
+		dtrace_aggdata_t *aggdata = &zaggdata[i].dtahe_data;
+		dtrace_aggdesc_t *aggdesc = aggdata->dtada_desc;
+		dtrace_recdesc_t *rec;
+		uint64_t larg;
+		caddr_t zdata;
+
+		zsize = zaggdata[i].dtahe_size;
+		assert(zsize != 0);
+
+		if ((zdata = dt_zalloc(dtp, zsize)) == NULL) {
+			/*
+			 * If we failed to allocated some zero-filled data, we
+			 * need to zero out the remaining dtada_data pointers
+			 * to prevent the wrong data from being freed below.
+			 */
+			for (j = i; j < naggvars; j++)
+				zaggdata[j].dtahe_data.dtada_data = NULL;
+			goto out;
+		}
+
+		aggvar = aggvars[(i - sortpos + naggvars) % naggvars];
+
+		/*
+		 * First, the easy bit.  To maintain compatibility with
+		 * consumers that pull the compiler-generated ID out of the
+		 * data, we put that ID at the top of the zero-filled data.
+		 */
+		rec = &aggdesc->dtagd_rec[0];
+		/* LINTED - alignment */
+		*((dtrace_aggvarid_t *)(zdata + rec->dtrd_offset)) = aggvar;
+
+		rec = &aggdesc->dtagd_rec[aggdesc->dtagd_nrecs - 1];
+
+		/*
+		 * Now for the more complicated part.  If (and only if) this
+		 * is an lquantize() aggregating action, zero-filled data is
+		 * not equivalent to an empty record:  we must also get the
+		 * parameters for the lquantize().
+		 */
+		if (rec->dtrd_action == DTRACEAGG_LQUANTIZE) {
+			if (aggdata->dtada_data != NULL) {
+				/*
+				 * The easier case here is if we actually have
+				 * some prototype data -- in which case we
+				 * manually dig it out of the aggregation
+				 * record.
+				 */
+				/* LINTED - alignment */
+				larg = *((uint64_t *)(aggdata->dtada_data +
+				    rec->dtrd_offset));
+			} else {
+				/*
+				 * We don't have any prototype data.  As a
+				 * result, we know that we _do_ have the
+				 * compiler-generated information.  (If this
+				 * were an anonymous enabling, all of our
+				 * zero-filled data would have prototype data
+				 * -- either directly or indirectly.) So as
+				 * gross as it is, we'll grovel around in the
+				 * compiler-generated information to find the
+				 * lquantize() parameters.
+				 */
+				dtrace_stmtdesc_t *sdp;
+				dt_ident_t *aid;
+				dt_idsig_t *isp;
+
+				sdp = (dtrace_stmtdesc_t *)(uintptr_t)
+				    aggdesc->dtagd_rec[0].dtrd_uarg;
+				aid = sdp->dtsd_aggdata;
+				isp = (dt_idsig_t *)aid->di_data;
+				assert(isp->dis_auxinfo != 0);
+				larg = isp->dis_auxinfo;
+			}
+
+			/* LINTED - alignment */
+			*((uint64_t *)(zdata + rec->dtrd_offset)) = larg;
+		}
+
+		aggdata->dtada_data = zdata;
+	}
+
+	/*
+	 * Now that we've dealt with setting up our zero-filled data, we can
+	 * allocate our sorted array, and take another pass over the data to
+	 * fill it.
+	 */
+	sorted = dt_alloc(dtp, nentries * sizeof (dt_ahashent_t *));
+
+	if (sorted == NULL)
+		goto out;
+
+	for (h = hash->dtah_all, i = 0; h != NULL; h = h->dtahe_nextall) {
+		dtrace_aggvarid_t id;
+
+		if ((id = dt_aggregate_aggvarid(h)) > max || !map[id])
+			continue;
+
+		sorted[i++] = h;
+	}
+
+	assert(i == nentries);
+
+	/*
+	 * We've loaded our array; now we need to sort by value to allow us
+	 * to create bundles of like value.  We're going to acquire the
+	 * dt_qsort_lock here, and hold it across all of our subsequent
+	 * comparison and sorting.
+	 */
+#ifndef VBOX
+	(void) pthread_mutex_lock(&dt_qsort_lock);
+#else
+	RTCritSectEnter(&dt_qsort_lock);
+#endif
+
+	qsort(sorted, nentries, sizeof (dt_ahashent_t *),
+	    dt_aggregate_keyvarcmp);
+
+	/*
+	 * Now we need to go through and create bundles.  Because the number
+	 * of bundles is bounded by the size of the sorted array, we're going
+	 * to reuse the underlying storage.  And note that "bundle" is an
+	 * array of pointers to arrays of pointers to dt_ahashent_t -- making
+	 * its type (regrettably) "dt_ahashent_t ***".  (Regrettable because
+	 * '*' -- like '_' and 'X' -- should never appear in triplicate in
+	 * an ideal world.)
+	 */
+	bundle = (dt_ahashent_t ***)sorted;
+
+	for (i = 1, start = 0; i <= nentries; i++) {
+		if (i < nentries &&
+		    dt_aggregate_keycmp(&sorted[i], &sorted[i - 1]) == 0)
+			continue;
+
+		/*
+		 * We have a bundle boundary.  Everything from start to
+		 * (i - 1) belongs in one bundle.
+		 */
+		assert(i - start <= naggvars);
+		bundlesize = (naggvars + 2) * sizeof (dt_ahashent_t *);
+
+		if ((nbundle = dt_zalloc(dtp, bundlesize)) == NULL) {
+#ifndef VBOX
+			(void) pthread_mutex_unlock(&dt_qsort_lock);
+#else
+			RTCritSectLeave(&dt_qsort_lock);
+#endif
+			goto out;
+		}
+
+		for (j = VBDTCAST(int)start; j < i; j++) {
+			dtrace_aggvarid_t id = dt_aggregate_aggvarid(sorted[j]);
+
+			assert(id <= max);
+			assert(map[id] != 0);
+			assert(map[id] - 1 < naggvars);
+			assert(nbundle[map[id] - 1] == NULL);
+			nbundle[map[id] - 1] = sorted[j];
+
+			if (nbundle[naggvars] == NULL)
+				nbundle[naggvars] = sorted[j];
+		}
+
+		for (j = 0; j < naggvars; j++) {
+			if (nbundle[j] != NULL)
+				continue;
+
+			/*
+			 * Before we assume that this aggregation variable
+			 * isn't present (and fall back to using the
+			 * zero-filled data allocated earlier), check the
+			 * remap.  If we have a remapping, we'll drop it in
+			 * here.  Note that we might be remapping an
+			 * aggregation variable that isn't present for this
+			 * key; in this case, the aggregation data that we
+			 * copy will point to the zeroed data.
+			 */
+			if (remap != NULL && remap[j]) {
+				assert(remap[j] - 1 < j);
+				assert(nbundle[remap[j] - 1] != NULL);
+				nbundle[j] = nbundle[remap[j] - 1];
+			} else {
+				nbundle[j] = &zaggdata[j];
+			}
+		}
+
+		bundle[nbundles++] = nbundle;
+		start = i;
+	}
+
+	/*
+	 * Now we need to re-sort based on the first value.
+	 */
+	dt_aggregate_qsort(dtp, bundle, nbundles, sizeof (dt_ahashent_t **),
+	    dt_aggregate_bundlecmp);
+
+#ifndef VBOX
+	(void) pthread_mutex_unlock(&dt_qsort_lock);
+#else
+	RTCritSectLeave(&dt_qsort_lock);
+#endif
+
+	/*
+	 * We're done!  Now we just need to go back over the sorted bundles,
+	 * calling the function.
+	 */
+	data = alloca((naggvars + 1) * sizeof (dtrace_aggdata_t *));
+
+	for (i = 0; i < nbundles; i++) {
+		for (j = 0; j < naggvars; j++)
+			data[j + 1] = NULL;
+
+		for (j = 0; j < naggvars; j++) {
+			int ndx = j - sortpos;
+
+			if (ndx < 0)
+				ndx += naggvars;
+
+			assert(bundle[i][ndx] != NULL);
+			data[j + 1] = &bundle[i][ndx]->dtahe_data;
+		}
+
+		for (j = 0; j < naggvars; j++)
+			assert(data[j + 1] != NULL);
+
+		/*
+		 * The representative key is the last element in the bundle.
+		 * Assert that we have one, and then set it to be the first
+		 * element of data.
+		 */
+		assert(bundle[i][j] != NULL);
+		data[0] = &bundle[i][j]->dtahe_data;
+
+		if ((rval = func(data, naggvars + 1, arg)) == -1)
+			goto out;
+	}
+
+	rval = 0;
+out:
+	for (i = 0; i < nbundles; i++)
+		dt_free(dtp, bundle[i]);
+
+	if (zaggdata != NULL) {
+		for (i = 0; i < naggvars; i++)
+			dt_free(dtp, zaggdata[i].dtahe_data.dtada_data);
+	}
+
+	dt_free(dtp, zaggdata);
+	dt_free(dtp, sorted);
+	dt_free(dtp, remap);
+	dt_free(dtp, map);
+
+	return (rval);
+}
+
+int
+dtrace_aggregate_print(dtrace_hdl_t *dtp, FILE *fp,
+    dtrace_aggregate_walk_f *func)
+{
+	dt_print_aggdata_t pd;
+
+	pd.dtpa_dtp = dtp;
+	pd.dtpa_fp = fp;
+	pd.dtpa_allunprint = 1;
+
+	if (func == NULL)
+		func = dtrace_aggregate_walk_sorted;
+
+	if ((*func)(dtp, dt_print_agg, &pd) == -1)
+		return (dt_set_errno(dtp, dtp->dt_errno));
+
+	return (0);
+}
+
+void
+dtrace_aggregate_clear(dtrace_hdl_t *dtp)
+{
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+	dt_ahash_t *hash = &agp->dtat_hash;
+	dt_ahashent_t *h;
+	dtrace_aggdata_t *data;
+	dtrace_aggdesc_t *aggdesc;
+	dtrace_recdesc_t *rec;
+	int i, max_cpus = agp->dtat_maxcpu;
+
+	for (h = hash->dtah_all; h != NULL; h = h->dtahe_nextall) {
+		aggdesc = h->dtahe_data.dtada_desc;
+		rec = &aggdesc->dtagd_rec[aggdesc->dtagd_nrecs - 1];
+		data = &h->dtahe_data;
+
+		bzero(&data->dtada_data[rec->dtrd_offset], rec->dtrd_size);
+
+		if (data->dtada_percpu == NULL)
+			continue;
+
+		for (i = 0; i < max_cpus; i++)
+			bzero(data->dtada_percpu[i], rec->dtrd_size);
+	}
+}
+
+void
+dt_aggregate_destroy(dtrace_hdl_t *dtp)
+{
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+	dt_ahash_t *hash = &agp->dtat_hash;
+	dt_ahashent_t *h, *next;
+	dtrace_aggdata_t *aggdata;
+	int i, max_cpus = agp->dtat_maxcpu;
+
+	if (hash->dtah_hash == NULL) {
+		assert(hash->dtah_all == NULL);
+	} else {
+		free(hash->dtah_hash);
+
+		for (h = hash->dtah_all; h != NULL; h = next) {
+			next = h->dtahe_nextall;
+
+			aggdata = &h->dtahe_data;
+
+			if (aggdata->dtada_percpu != NULL) {
+				for (i = 0; i < max_cpus; i++)
+					free(aggdata->dtada_percpu[i]);
+				free(aggdata->dtada_percpu);
+			}
+
+			free(aggdata->dtada_data);
+			free(h);
+		}
+
+		hash->dtah_hash = NULL;
+		hash->dtah_all = NULL;
+		hash->dtah_size = 0;
+	}
+
+	free(agp->dtat_buf.dtbd_data);
+	free(agp->dtat_cpus);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_as.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_as.c
new file mode 100644
index 0000000..a90e0f7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_as.c
@@ -0,0 +1,505 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <assert.h>
+#else  /* VBOX */
+# include <iprt/asm.h>
+#endif /* VBOX */
+
+#include <dt_impl.h>
+#include <dt_parser.h>
+#include <dt_as.h>
+
+void
+dt_irlist_create(dt_irlist_t *dlp)
+{
+	bzero(dlp, sizeof (dt_irlist_t));
+	dlp->dl_label = 1;
+}
+
+void
+dt_irlist_destroy(dt_irlist_t *dlp)
+{
+	dt_irnode_t *dip, *nip;
+
+	for (dip = dlp->dl_list; dip != NULL; dip = nip) {
+		nip = dip->di_next;
+		free(dip);
+	}
+}
+
+void
+dt_irlist_append(dt_irlist_t *dlp, dt_irnode_t *dip)
+{
+	if (dlp->dl_last != NULL)
+		dlp->dl_last->di_next = dip;
+	else
+		dlp->dl_list = dip;
+
+	dlp->dl_last = dip;
+
+	if (dip->di_label == DT_LBL_NONE || dip->di_instr != DIF_INSTR_NOP)
+		dlp->dl_len++; /* don't count forward refs in instr count */
+}
+
+uint_t
+dt_irlist_label(dt_irlist_t *dlp)
+{
+	return (dlp->dl_label++);
+}
+
+/*ARGSUSED*/
+static int
+dt_countvar(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
+{
+	size_t *np = data;
+
+	if (idp->di_flags & (DT_IDFLG_DIFR | DT_IDFLG_DIFW))
+		(*np)++; /* include variable in vartab */
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_copyvar(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
+{
+	dt_pcb_t *pcb = data;
+	dtrace_difv_t *dvp;
+	ssize_t stroff;
+	dt_node_t dn;
+
+	if (!(idp->di_flags & (DT_IDFLG_DIFR | DT_IDFLG_DIFW)))
+		return (0); /* omit variable from vartab */
+
+	dvp = &pcb->pcb_difo->dtdo_vartab[pcb->pcb_asvidx++];
+	stroff = dt_strtab_insert(pcb->pcb_strtab, idp->di_name);
+
+	if (stroff == -1L)
+		longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+	if (stroff > DIF_STROFF_MAX)
+		longjmp(pcb->pcb_jmpbuf, EDT_STR2BIG);
+
+	dvp->dtdv_name = (uint_t)stroff;
+	dvp->dtdv_id = idp->di_id;
+	dvp->dtdv_flags = 0;
+
+	dvp->dtdv_kind = (idp->di_kind == DT_IDENT_ARRAY) ?
+	    DIFV_KIND_ARRAY : DIFV_KIND_SCALAR;
+
+	if (idp->di_flags & DT_IDFLG_LOCAL)
+		dvp->dtdv_scope = DIFV_SCOPE_LOCAL;
+	else if (idp->di_flags & DT_IDFLG_TLS)
+		dvp->dtdv_scope = DIFV_SCOPE_THREAD;
+	else
+		dvp->dtdv_scope = DIFV_SCOPE_GLOBAL;
+
+	if (idp->di_flags & DT_IDFLG_DIFR)
+		dvp->dtdv_flags |= DIFV_F_REF;
+	if (idp->di_flags & DT_IDFLG_DIFW)
+		dvp->dtdv_flags |= DIFV_F_MOD;
+
+	bzero(&dn, sizeof (dn));
+	dt_node_type_assign(&dn, idp->di_ctfp, idp->di_type);
+	dt_node_diftype(pcb->pcb_hdl, &dn, &dvp->dtdv_type);
+
+	idp->di_flags &= ~(DT_IDFLG_DIFR | DT_IDFLG_DIFW);
+	return (0);
+}
+
+static ssize_t
+dt_copystr(const char *s, size_t n, size_t off, dt_pcb_t *pcb)
+{
+	bcopy(s, pcb->pcb_difo->dtdo_strtab + off, n);
+	return (n);
+}
+
+/*
+ * Rewrite the xlate/xlarg instruction at dtdo_buf[i] so that the instruction's
+ * xltab index reflects the offset 'xi' of the assigned dtdo_xlmtab[] location.
+ * We track the cumulative references to translators and members in the pcb's
+ * pcb_asxrefs[] array, a two-dimensional array of bitmaps indexed by the
+ * global translator id and then by the corresponding translator member id.
+ */
+static void
+dt_as_xlate(dt_pcb_t *pcb, dtrace_difo_t *dp,
+    uint_t i, uint_t xi, dt_node_t *dnp)
+{
+	dtrace_hdl_t *dtp = pcb->pcb_hdl;
+	dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator;
+
+	assert(i < dp->dtdo_len);
+	assert(xi < dp->dtdo_xlmlen);
+
+	assert(dnp->dn_kind == DT_NODE_MEMBER);
+	assert(dnp->dn_membexpr->dn_kind == DT_NODE_XLATOR);
+
+	assert(dxp->dx_id < dtp->dt_xlatorid);
+	assert(dnp->dn_membid < dxp->dx_nmembers);
+
+	if (pcb->pcb_asxrefs == NULL) {
+		pcb->pcb_asxreflen = dtp->dt_xlatorid;
+		pcb->pcb_asxrefs =
+		    dt_zalloc(dtp, sizeof (ulong_t *) * pcb->pcb_asxreflen);
+		if (pcb->pcb_asxrefs == NULL)
+			longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	if (pcb->pcb_asxrefs[dxp->dx_id] == NULL) {
+		pcb->pcb_asxrefs[dxp->dx_id] =
+		    dt_zalloc(dtp, BT_SIZEOFMAP(dxp->dx_nmembers));
+		if (pcb->pcb_asxrefs[dxp->dx_id] == NULL)
+			longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	dp->dtdo_buf[i] = DIF_INSTR_XLATE(
+	    DIF_INSTR_OP(dp->dtdo_buf[i]), xi, DIF_INSTR_RD(dp->dtdo_buf[i]));
+
+	BT_SET(pcb->pcb_asxrefs[dxp->dx_id], dnp->dn_membid);
+	dp->dtdo_xlmtab[xi] = dnp;
+}
+
+static void
+dt_as_undef(const dt_ident_t *idp, uint_t offset)
+{
+	const char *kind, *mark = (idp->di_flags & DT_IDFLG_USER) ? "``" : "`";
+	const dtrace_syminfo_t *dts = idp->di_data;
+
+	if (idp->di_flags & DT_IDFLG_USER)
+		kind = "user";
+	else if (idp->di_flags & DT_IDFLG_PRIM)
+		kind = "primary kernel";
+	else
+		kind = "loadable kernel";
+
+	yylineno = idp->di_lineno;
+
+	xyerror(D_ASRELO, "relocation remains against %s symbol %s%s%s (offset "
+	    "0x%x)\n", kind, dts->dts_object, mark, dts->dts_name, offset);
+}
+
+dtrace_difo_t *
+dt_as(dt_pcb_t *pcb)
+{
+	dtrace_hdl_t *dtp = pcb->pcb_hdl;
+	dt_irlist_t *dlp = &pcb->pcb_ir;
+	uint_t *labels = NULL;
+	dt_irnode_t *dip;
+	dtrace_difo_t *dp;
+	dt_ident_t *idp;
+
+	size_t n = 0;
+	uint_t i;
+
+	uint_t kmask, kbits, umask, ubits;
+	uint_t krel = 0, urel = 0, xlrefs = 0;
+
+	/*
+	 * Select bitmasks based upon the desired symbol linking policy.  We
+	 * test (di_extern->di_flags & xmask) == xbits to determine if the
+	 * symbol should have a relocation entry generated in the loop below.
+	 *
+	 * DT_LINK_KERNEL = kernel symbols static, user symbols dynamic
+	 * DT_LINK_PRIMARY = primary kernel symbols static, others dynamic
+	 * DT_LINK_DYNAMIC = all symbols dynamic
+	 * DT_LINK_STATIC = all symbols static
+	 *
+	 * By 'static' we mean that we use the symbol's value at compile-time
+	 * in the final DIF.  By 'dynamic' we mean that we create a relocation
+	 * table entry for the symbol's value so it can be relocated later.
+	 */
+	switch (dtp->dt_linkmode) {
+	case DT_LINK_KERNEL:
+		kmask = 0;
+		kbits = ~0u;
+		umask = DT_IDFLG_USER;
+		ubits = DT_IDFLG_USER;
+		break;
+	case DT_LINK_PRIMARY:
+		kmask = DT_IDFLG_USER | DT_IDFLG_PRIM;
+		kbits = 0;
+		umask = DT_IDFLG_USER;
+		ubits = DT_IDFLG_USER;
+		break;
+	case DT_LINK_DYNAMIC:
+		kmask = DT_IDFLG_USER;
+		kbits = 0;
+		umask = DT_IDFLG_USER;
+		ubits = DT_IDFLG_USER;
+		break;
+	case DT_LINK_STATIC:
+		kmask = umask = 0;
+		kbits = ubits = ~0u;
+		break;
+	default:
+		xyerror(D_UNKNOWN, "internal error -- invalid link mode %u\n",
+		    dtp->dt_linkmode);
+	}
+
+	assert(pcb->pcb_difo == NULL);
+	pcb->pcb_difo = dt_zalloc(dtp, sizeof (dtrace_difo_t));
+
+	if ((dp = pcb->pcb_difo) == NULL)
+		longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dp->dtdo_buf = dt_alloc(dtp, sizeof (dif_instr_t) * dlp->dl_len);
+
+	if (dp->dtdo_buf == NULL)
+		longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+	if ((labels = dt_alloc(dtp, sizeof (uint_t) * dlp->dl_label)) == NULL)
+		longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+	/*
+	 * Make an initial pass through the instruction list, filling in the
+	 * instruction buffer with valid instructions and skipping labeled nops.
+	 * While doing this, we also fill in our labels[] translation table
+	 * and we count up the number of relocation table entries we will need.
+	 */
+	for (i = 0, dip = dlp->dl_list; dip != NULL; dip = dip->di_next) {
+		if (dip->di_label != DT_LBL_NONE)
+			labels[dip->di_label] = i;
+
+		if (dip->di_label == DT_LBL_NONE ||
+		    dip->di_instr != DIF_INSTR_NOP)
+			dp->dtdo_buf[i++] = dip->di_instr;
+
+		if (dip->di_extern == NULL)
+			continue; /* no external references needed */
+
+		switch (DIF_INSTR_OP(dip->di_instr)) {
+		case DIF_OP_SETX:
+			idp = dip->di_extern;
+			if ((idp->di_flags & kmask) == kbits)
+				krel++;
+			else if ((idp->di_flags & umask) == ubits)
+				urel++;
+			break;
+		case DIF_OP_XLATE:
+		case DIF_OP_XLARG:
+			xlrefs++;
+			break;
+		default:
+			xyerror(D_UNKNOWN, "unexpected assembler relocation "
+			    "for opcode 0x%x\n", DIF_INSTR_OP(dip->di_instr));
+		}
+	}
+
+	assert(i == dlp->dl_len);
+	dp->dtdo_len = dlp->dl_len;
+
+	/*
+	 * Make a second pass through the instructions, relocating each branch
+	 * label to the index of the final instruction in the buffer and noting
+	 * any other instruction-specific DIFO flags such as dtdo_destructive.
+	 */
+	for (i = 0; i < dp->dtdo_len; i++) {
+		dif_instr_t instr = dp->dtdo_buf[i];
+		uint_t op = DIF_INSTR_OP(instr);
+
+		if (op == DIF_OP_CALL) {
+			if (DIF_INSTR_SUBR(instr) == DIF_SUBR_COPYOUT ||
+			    DIF_INSTR_SUBR(instr) == DIF_SUBR_COPYOUTSTR)
+				dp->dtdo_destructive = 1;
+			continue;
+		}
+
+		if (op >= DIF_OP_BA && op <= DIF_OP_BLEU) {
+			assert(DIF_INSTR_LABEL(instr) < dlp->dl_label);
+			dp->dtdo_buf[i] = DIF_INSTR_BRANCH(op,
+			    labels[DIF_INSTR_LABEL(instr)]);
+		}
+	}
+
+	dt_free(dtp, labels);
+	pcb->pcb_asvidx = 0;
+
+	/*
+	 * Allocate memory for the appropriate number of variable records and
+	 * then fill in each variable record.  As we populate the variable
+	 * table we insert the corresponding variable names into the strtab.
+	 */
+	(void) dt_idhash_iter(dtp->dt_tls, dt_countvar, &n);
+	(void) dt_idhash_iter(dtp->dt_globals, dt_countvar, &n);
+	(void) dt_idhash_iter(pcb->pcb_locals, dt_countvar, &n);
+
+	if (n != 0) {
+		dp->dtdo_vartab = dt_alloc(dtp, n * sizeof (dtrace_difv_t));
+		dp->dtdo_varlen = (uint32_t)n;
+
+		if (dp->dtdo_vartab == NULL)
+			longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+		(void) dt_idhash_iter(dtp->dt_tls, dt_copyvar, pcb);
+		(void) dt_idhash_iter(dtp->dt_globals, dt_copyvar, pcb);
+		(void) dt_idhash_iter(pcb->pcb_locals, dt_copyvar, pcb);
+	}
+
+	/*
+	 * Allocate memory for the appropriate number of relocation table
+	 * entries based upon our kernel and user counts from the first pass.
+	 */
+	if (krel != 0) {
+		dp->dtdo_kreltab = dt_alloc(dtp,
+		    krel * sizeof (dof_relodesc_t));
+		dp->dtdo_krelen = krel;
+
+		if (dp->dtdo_kreltab == NULL)
+			longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	if (urel != 0) {
+		dp->dtdo_ureltab = dt_alloc(dtp,
+		    urel * sizeof (dof_relodesc_t));
+		dp->dtdo_urelen = urel;
+
+		if (dp->dtdo_ureltab == NULL)
+			longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	if (xlrefs != 0) {
+		dp->dtdo_xlmtab = dt_zalloc(dtp, sizeof (dt_node_t *) * xlrefs);
+		dp->dtdo_xlmlen = xlrefs;
+
+		if (dp->dtdo_xlmtab == NULL)
+			longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	/*
+	 * If any relocations are needed, make another pass through the
+	 * instruction list and fill in the relocation table entries.
+	 */
+	if (krel + urel + xlrefs != 0) {
+		uint_t knodef = pcb->pcb_cflags & DTRACE_C_KNODEF;
+		uint_t unodef = pcb->pcb_cflags & DTRACE_C_UNODEF;
+
+		dof_relodesc_t *krp = dp->dtdo_kreltab;
+		dof_relodesc_t *urp = dp->dtdo_ureltab;
+		dt_node_t **xlp = dp->dtdo_xlmtab;
+
+		i = 0; /* dtdo_buf[] index */
+
+		for (dip = dlp->dl_list; dip != NULL; dip = dip->di_next) {
+			dof_relodesc_t *rp;
+			ssize_t soff;
+			uint_t nodef;
+
+			if (dip->di_label != DT_LBL_NONE &&
+			    dip->di_instr == DIF_INSTR_NOP)
+				continue; /* skip label declarations */
+
+			i++; /* advance dtdo_buf[] index */
+
+			if (DIF_INSTR_OP(dip->di_instr) == DIF_OP_XLATE ||
+			    DIF_INSTR_OP(dip->di_instr) == DIF_OP_XLARG) {
+				assert(dp->dtdo_buf[i - 1] == dip->di_instr);
+				dt_as_xlate(pcb, dp, i - 1, (uint_t)
+				    (xlp++ - dp->dtdo_xlmtab), dip->di_extern);
+				continue;
+			}
+
+			if ((idp = dip->di_extern) == NULL)
+				continue; /* no relocation entry needed */
+
+			if ((idp->di_flags & kmask) == kbits) {
+				nodef = knodef;
+				rp = krp++;
+			} else if ((idp->di_flags & umask) == ubits) {
+				nodef = unodef;
+				rp = urp++;
+			} else
+				continue;
+
+			if (!nodef)
+				dt_as_undef(idp, i);
+
+			assert(DIF_INSTR_OP(dip->di_instr) == DIF_OP_SETX);
+			soff = dt_strtab_insert(pcb->pcb_strtab, idp->di_name);
+
+			if (soff == -1L)
+				longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+			if (soff > DIF_STROFF_MAX)
+				longjmp(pcb->pcb_jmpbuf, EDT_STR2BIG);
+
+			rp->dofr_name = (dof_stridx_t)soff;
+			rp->dofr_type = DOF_RELO_SETX;
+			rp->dofr_offset = DIF_INSTR_INTEGER(dip->di_instr) *
+			    sizeof (uint64_t);
+			rp->dofr_data = 0;
+		}
+
+		assert(krp == dp->dtdo_kreltab + dp->dtdo_krelen);
+		assert(urp == dp->dtdo_ureltab + dp->dtdo_urelen);
+		assert(xlp == dp->dtdo_xlmtab + dp->dtdo_xlmlen);
+		assert(i == dp->dtdo_len);
+	}
+
+	/*
+	 * Allocate memory for the compiled string table and then copy the
+	 * chunks from the string table into the final string buffer.
+	 */
+	if ((n = dt_strtab_size(pcb->pcb_strtab)) != 0) {
+		if ((dp->dtdo_strtab = dt_alloc(dtp, n)) == NULL)
+			longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+		(void) dt_strtab_write(pcb->pcb_strtab,
+		    (dt_strtab_write_f *)dt_copystr, pcb);
+		dp->dtdo_strlen = (uint32_t)n;
+	}
+
+	/*
+	 * Allocate memory for the compiled integer table and then copy the
+	 * integer constants from the table into the final integer buffer.
+	 */
+	if ((n = dt_inttab_size(pcb->pcb_inttab)) != 0) {
+		if ((dp->dtdo_inttab = dt_alloc(dtp,
+		    n * sizeof (uint64_t))) == NULL)
+			longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+		dt_inttab_write(pcb->pcb_inttab, dp->dtdo_inttab);
+		dp->dtdo_intlen = (uint32_t)n;
+	}
+
+	/*
+	 * Fill in the DIFO return type from the type associated with the
+	 * node saved in pcb_dret, and then clear pcb_difo and pcb_dret
+	 * now that the assembler has completed successfully.
+	 */
+	dt_node_diftype(dtp, pcb->pcb_dret, &dp->dtdo_rtype);
+	pcb->pcb_difo = NULL;
+	pcb->pcb_dret = NULL;
+
+	if (pcb->pcb_cflags & DTRACE_C_DIFV)
+		dt_dis(dp, stderr);
+
+	return (dp);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_as.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_as.h
new file mode 100644
index 0000000..cb24640
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_as.h
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_AS_H
+#define	_DT_AS_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#endif
+#include <sys/dtrace.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct dt_irnode {
+	uint_t di_label;		/* label number or DT_LBL_NONE */
+	dif_instr_t di_instr;		/* instruction opcode */
+	void *di_extern;		/* opcode-specific external reference */
+	struct dt_irnode *di_next;	/* next instruction */
+} dt_irnode_t;
+
+#define	DT_LBL_NONE	0		/* no label on this instruction */
+
+typedef struct dt_irlist {
+	dt_irnode_t *dl_list;		/* pointer to first node in list */
+	dt_irnode_t *dl_last;		/* pointer to last node in list */
+	uint_t dl_len;			/* number of valid instructions */
+	uint_t dl_label;		/* next label number to assign */
+} dt_irlist_t;
+
+extern void dt_irlist_create(dt_irlist_t *);
+extern void dt_irlist_destroy(dt_irlist_t *);
+extern void dt_irlist_append(dt_irlist_t *, dt_irnode_t *);
+extern uint_t dt_irlist_label(dt_irlist_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_AS_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.c
new file mode 100644
index 0000000..e7b22bd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.c
@@ -0,0 +1,181 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+/*
+ * DTrace Memory Buffer Routines
+ *
+ * The routines in this file are used to create an automatically resizing
+ * memory buffer that can be written to like a file.  Memory buffers are
+ * used to construct DOF to ioctl() to dtrace(7D), and provide semantics that
+ * simplify caller code.  Specifically, any allocation errors result in an
+ * error code being set inside the buffer which is maintained persistently and
+ * propagates to another buffer if the buffer in error is concatenated.  These
+ * semantics permit callers to execute a large series of writes without needing
+ * to check for errors and then perform a single check before using the buffer.
+ */
+
+#ifndef VBOX
+#include <sys/sysmacros.h>
+#include <strings.h>
+#endif
+
+#include <dt_impl.h>
+#include <dt_buf.h>
+
+void
+dt_buf_create(dtrace_hdl_t *dtp, dt_buf_t *bp, const char *name, size_t len)
+{
+	if (len == 0)
+		len = _dtrace_bufsize;
+
+	bp->dbu_buf = bp->dbu_ptr = dt_zalloc(dtp, len);
+	bp->dbu_len = len;
+
+	if (bp->dbu_buf == NULL)
+		bp->dbu_err = dtrace_errno(dtp);
+	else
+		bp->dbu_err = 0;
+
+	bp->dbu_resizes = 0;
+	bp->dbu_name = name;
+}
+
+void
+dt_buf_destroy(dtrace_hdl_t *dtp, dt_buf_t *bp)
+{
+	dt_dprintf("dt_buf_destroy(%s): size=%lu resizes=%u\n",
+	    bp->dbu_name, (ulong_t)bp->dbu_len, bp->dbu_resizes);
+
+	dt_free(dtp, bp->dbu_buf);
+}
+
+void
+dt_buf_reset(dtrace_hdl_t *dtp, dt_buf_t *bp)
+{
+	if ((bp->dbu_ptr = bp->dbu_buf) != NULL)
+		bp->dbu_err = 0;
+	else
+		dt_buf_create(dtp, bp, bp->dbu_name, bp->dbu_len);
+}
+
+void
+dt_buf_write(dtrace_hdl_t *dtp, dt_buf_t *bp,
+    const void *buf, size_t len, size_t align)
+{
+	size_t off = (size_t)(bp->dbu_ptr - bp->dbu_buf);
+	size_t adj = roundup(off, align) - off;
+
+	if (bp->dbu_err != 0) {
+		(void) dt_set_errno(dtp, bp->dbu_err);
+		return; /* write silently fails */
+	}
+
+	if (bp->dbu_ptr + adj + len > bp->dbu_buf + bp->dbu_len) {
+		size_t new_len = bp->dbu_len * 2;
+		uchar_t *new_buf;
+		uint_t r = 1;
+
+		while (bp->dbu_ptr + adj + len > bp->dbu_buf + new_len) {
+			new_len *= 2;
+			r++;
+		}
+
+		if ((new_buf = dt_zalloc(dtp, new_len)) == NULL) {
+			bp->dbu_err = dtrace_errno(dtp);
+			return;
+		}
+
+		bcopy(bp->dbu_buf, new_buf, off);
+		dt_free(dtp, bp->dbu_buf);
+
+		bp->dbu_buf = new_buf;
+		bp->dbu_ptr = new_buf + off;
+		bp->dbu_len = new_len;
+		bp->dbu_resizes += r;
+	}
+
+	bp->dbu_ptr += adj;
+	bcopy(buf, bp->dbu_ptr, len);
+	bp->dbu_ptr += len;
+}
+
+void
+dt_buf_concat(dtrace_hdl_t *dtp, dt_buf_t *dst,
+    const dt_buf_t *src, size_t align)
+{
+	if (dst->dbu_err == 0 && src->dbu_err != 0) {
+		(void) dt_set_errno(dtp, src->dbu_err);
+		dst->dbu_err = src->dbu_err;
+	} else {
+		dt_buf_write(dtp, dst, src->dbu_buf,
+		    (size_t)(src->dbu_ptr - src->dbu_buf), align);
+	}
+}
+
+size_t
+dt_buf_offset(const dt_buf_t *bp, size_t align)
+{
+	size_t off = (size_t)(bp->dbu_ptr - bp->dbu_buf);
+	return (roundup(off, align));
+}
+
+size_t
+dt_buf_len(const dt_buf_t *bp)
+{
+	return (bp->dbu_ptr - bp->dbu_buf);
+}
+
+int
+dt_buf_error(const dt_buf_t *bp)
+{
+	return (bp->dbu_err);
+}
+
+void *
+dt_buf_ptr(const dt_buf_t *bp)
+{
+	return (bp->dbu_buf);
+}
+
+void *
+dt_buf_claim(dtrace_hdl_t *dtp, dt_buf_t *bp)
+{
+	void *buf = bp->dbu_buf;
+
+	if (bp->dbu_err != 0) {
+		dt_free(dtp, buf);
+		buf = NULL;
+	}
+
+	bp->dbu_buf = bp->dbu_ptr = NULL;
+	bp->dbu_len = 0;
+
+	return (buf);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.h
new file mode 100644
index 0000000..a8b465f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_buf.h
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_BUF_H
+#define	_DT_BUF_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#include <dtrace.h>
+
+typedef struct dt_buf {
+	const char *dbu_name;	/* string name for debugging */
+	uchar_t *dbu_buf;	/* buffer base address */
+	uchar_t *dbu_ptr;	/* current buffer location */
+	size_t dbu_len;		/* buffer size in bytes */
+	int dbu_err;		/* errno value if error */
+	int dbu_resizes;	/* number of resizes */
+} dt_buf_t;
+
+extern void dt_buf_create(dtrace_hdl_t *, dt_buf_t *, const char *, size_t);
+extern void dt_buf_destroy(dtrace_hdl_t *, dt_buf_t *);
+extern void dt_buf_reset(dtrace_hdl_t *, dt_buf_t *);
+
+extern void dt_buf_write(dtrace_hdl_t *, dt_buf_t *,
+    const void *, size_t, size_t);
+
+extern void dt_buf_concat(dtrace_hdl_t *, dt_buf_t *,
+    const dt_buf_t *, size_t);
+
+extern size_t dt_buf_offset(const dt_buf_t *, size_t);
+extern size_t dt_buf_len(const dt_buf_t *);
+
+extern int dt_buf_error(const dt_buf_t *);
+extern void *dt_buf_ptr(const dt_buf_t *);
+
+extern void *dt_buf_claim(dtrace_hdl_t *, dt_buf_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_BUF_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_cc.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_cc.c
new file mode 100644
index 0000000..33dd0a3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_cc.c
@@ -0,0 +1,2306 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/*
+ * DTrace D Language Compiler
+ *
+ * The code in this source file implements the main engine for the D language
+ * compiler.  The driver routine for the compiler is dt_compile(), below.  The
+ * compiler operates on either stdio FILEs or in-memory strings as its input
+ * and can produce either dtrace_prog_t structures from a D program or a single
+ * dtrace_difo_t structure from a D expression.  Multiple entry points are
+ * provided as wrappers around dt_compile() for the various input/output pairs.
+ * The compiler itself is implemented across the following source files:
+ *
+ * dt_lex.l - lex scanner
+ * dt_grammar.y - yacc grammar
+ * dt_parser.c - parse tree creation and semantic checking
+ * dt_decl.c - declaration stack processing
+ * dt_xlator.c - D translator lookup and creation
+ * dt_ident.c - identifier and symbol table routines
+ * dt_pragma.c - #pragma processing and D pragmas
+ * dt_printf.c - D printf() and printa() argument checking and processing
+ * dt_cc.c - compiler driver and dtrace_prog_t construction
+ * dt_cg.c - DIF code generator
+ * dt_as.c - DIF assembler
+ * dt_dof.c - dtrace_prog_t -> DOF conversion
+ *
+ * Several other source files provide collections of utility routines used by
+ * these major files.  The compiler itself is implemented in multiple passes:
+ *
+ * (1) The input program is scanned and parsed by dt_lex.l and dt_grammar.y
+ *     and parse tree nodes are constructed using the routines in dt_parser.c.
+ *     This node construction pass is described further in dt_parser.c.
+ *
+ * (2) The parse tree is "cooked" by assigning each clause a context (see the
+ *     routine dt_setcontext(), below) based on its probe description and then
+ *     recursively descending the tree performing semantic checking.  The cook
+ *     routines are also implemented in dt_parser.c and described there.
+ *
+ * (3) For actions that are DIF expression statements, the DIF code generator
+ *     and assembler are invoked to create a finished DIFO for the statement.
+ *
+ * (4) The dtrace_prog_t data structures for the program clauses and actions
+ *     are built, containing pointers to any DIFOs created in step (3).
+ *
+ * (5) The caller invokes a routine in dt_dof.c to convert the finished program
+ *     into DOF format for use in anonymous tracing or enabling in the kernel.
+ *
+ * In the implementation, steps 2-4 are intertwined in that they are performed
+ * in order for each clause as part of a loop that executes over the clauses.
+ *
+ * The D compiler currently implements nearly no optimization.  The compiler
+ * implements integer constant folding as part of pass (1), and a set of very
+ * simple peephole optimizations as part of pass (3).  As with any C compiler,
+ * a large number of optimizations are possible on both the intermediate data
+ * structures and the generated DIF code.  These possibilities should be
+ * investigated in the context of whether they will have any substantive effect
+ * on the overall DTrace probe effect before they are undertaken.
+ */
+
+#ifndef VBOX
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <assert.h>
+#include <strings.h>
+#include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <ucontext.h>
+#include <limits.h>
+#include <ctype.h>
+#include <dirent.h>
+#else  /* VBOX */
+# include <ctype.h>
+# include <iprt/dir.h>
+# ifdef _MSC_VER
+#  include <io.h>
+# else
+#  include <unistd.h>
+# endif
+# if defined(RT_OS_WINDOWS) || defined(RT_OS_DARWIN)
+#  ifdef _MSC_VER
+#   define ftruncate64  _chsize
+#  else
+#   define ftruncate64  ftruncate
+#  endif
+#  define lseek64       lseek
+# endif
+#endif /* VBOX */
+#include <dt_module.h>
+#include <dt_program.h>
+#include <dt_provider.h>
+#include <dt_printf.h>
+#include <dt_pid.h>
+#include <dt_grammar.h>
+#include <dt_ident.h>
+#include <dt_string.h>
+#include <dt_impl.h>
+
+static const dtrace_diftype_t dt_void_rtype = {
+	DIF_TYPE_CTF, CTF_K_INTEGER, 0, 0, 0
+};
+
+static const dtrace_diftype_t dt_int_rtype = {
+	DIF_TYPE_CTF, CTF_K_INTEGER, 0, 0, sizeof (uint64_t)
+};
+
+static void *dt_compile(dtrace_hdl_t *, int, dtrace_probespec_t, void *,
+    uint_t, int, char *const[], FILE *, const char *);
+
+
+/*ARGSUSED*/
+static int
+dt_idreset(dt_idhash_t *dhp, dt_ident_t *idp, void *ignored)
+{
+	idp->di_flags &= ~(DT_IDFLG_REF | DT_IDFLG_MOD |
+	    DT_IDFLG_DIFR | DT_IDFLG_DIFW);
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_idpragma(dt_idhash_t *dhp, dt_ident_t *idp, void *ignored)
+{
+	yylineno = idp->di_lineno;
+	xyerror(D_PRAGMA_UNUSED, "unused #pragma %s\n", (char *)idp->di_iarg);
+	return (0);
+}
+
+static dtrace_stmtdesc_t *
+dt_stmt_create(dtrace_hdl_t *dtp, dtrace_ecbdesc_t *edp,
+    dtrace_attribute_t descattr, dtrace_attribute_t stmtattr)
+{
+	dtrace_stmtdesc_t *sdp = dtrace_stmt_create(dtp, edp);
+
+	if (sdp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	assert(yypcb->pcb_stmt == NULL);
+	yypcb->pcb_stmt = sdp;
+
+	sdp->dtsd_descattr = descattr;
+	sdp->dtsd_stmtattr = stmtattr;
+
+	return (sdp);
+}
+
+static dtrace_actdesc_t *
+dt_stmt_action(dtrace_hdl_t *dtp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *new;
+
+	if ((new = dtrace_stmt_action(dtp, sdp)) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	return (new);
+}
+
+/*
+ * Utility function to determine if a given action description is destructive.
+ * The dtdo_destructive bit is set for us by the DIF assembler (see dt_as.c).
+ */
+static int
+dt_action_destructive(const dtrace_actdesc_t *ap)
+{
+	return (DTRACEACT_ISDESTRUCTIVE(ap->dtad_kind) || (ap->dtad_kind ==
+	    DTRACEACT_DIFEXPR && ap->dtad_difo->dtdo_destructive));
+}
+
+static void
+dt_stmt_append(dtrace_stmtdesc_t *sdp, const dt_node_t *dnp)
+{
+	dtrace_ecbdesc_t *edp = sdp->dtsd_ecbdesc;
+	dtrace_actdesc_t *ap, *tap;
+	int commit = 0;
+	int speculate = 0;
+	int datarec = 0;
+
+	/*
+	 * Make sure that the new statement jibes with the rest of the ECB.
+	 */
+	for (ap = edp->dted_action; ap != NULL; ap = ap->dtad_next) {
+		if (ap->dtad_kind == DTRACEACT_COMMIT) {
+			if (commit) {
+				dnerror(dnp, D_COMM_COMM, "commit( ) may "
+				    "not follow commit( )\n");
+			}
+
+			if (datarec) {
+				dnerror(dnp, D_COMM_DREC, "commit( ) may "
+				    "not follow data-recording action(s)\n");
+			}
+
+			for (tap = ap; tap != NULL; tap = tap->dtad_next) {
+				if (!DTRACEACT_ISAGG(tap->dtad_kind))
+					continue;
+
+				dnerror(dnp, D_AGG_COMM, "aggregating actions "
+				    "may not follow commit( )\n");
+			}
+
+			commit = 1;
+			continue;
+		}
+
+		if (ap->dtad_kind == DTRACEACT_SPECULATE) {
+			if (speculate) {
+				dnerror(dnp, D_SPEC_SPEC, "speculate( ) may "
+				    "not follow speculate( )\n");
+			}
+
+			if (commit) {
+				dnerror(dnp, D_SPEC_COMM, "speculate( ) may "
+				    "not follow commit( )\n");
+			}
+
+			if (datarec) {
+				dnerror(dnp, D_SPEC_DREC, "speculate( ) may "
+				    "not follow data-recording action(s)\n");
+			}
+
+			speculate = 1;
+			continue;
+		}
+
+		if (DTRACEACT_ISAGG(ap->dtad_kind)) {
+			if (speculate) {
+				dnerror(dnp, D_AGG_SPEC, "aggregating actions "
+				    "may not follow speculate( )\n");
+			}
+
+			datarec = 1;
+			continue;
+		}
+
+		if (speculate) {
+			if (dt_action_destructive(ap)) {
+				dnerror(dnp, D_ACT_SPEC, "destructive actions "
+				    "may not follow speculate( )\n");
+			}
+
+			if (ap->dtad_kind == DTRACEACT_EXIT) {
+				dnerror(dnp, D_EXIT_SPEC, "exit( ) may not "
+				    "follow speculate( )\n");
+			}
+		}
+
+		/*
+		 * Exclude all non data-recording actions.
+		 */
+		if (dt_action_destructive(ap) ||
+		    ap->dtad_kind == DTRACEACT_DISCARD)
+			continue;
+
+		if (ap->dtad_kind == DTRACEACT_DIFEXPR &&
+		    ap->dtad_difo->dtdo_rtype.dtdt_kind == DIF_TYPE_CTF &&
+		    ap->dtad_difo->dtdo_rtype.dtdt_size == 0)
+			continue;
+
+		if (commit) {
+			dnerror(dnp, D_DREC_COMM, "data-recording actions "
+			    "may not follow commit( )\n");
+		}
+
+		if (!speculate)
+			datarec = 1;
+	}
+
+	if (dtrace_stmt_add(yypcb->pcb_hdl, yypcb->pcb_prog, sdp) != 0)
+		longjmp(yypcb->pcb_jmpbuf, dtrace_errno(yypcb->pcb_hdl));
+
+	if (yypcb->pcb_stmt == sdp)
+		yypcb->pcb_stmt = NULL;
+}
+
+/*
+ * For the first element of an aggregation tuple or for printa(), we create a
+ * simple DIF program that simply returns the immediate value that is the ID
+ * of the aggregation itself.  This could be optimized in the future by
+ * creating a new in-kernel dtad_kind that just returns an integer.
+ */
+static void
+dt_action_difconst(dtrace_actdesc_t *ap, uint_t id, dtrace_actkind_t kind)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dtrace_difo_t *dp = dt_zalloc(dtp, sizeof (dtrace_difo_t));
+
+	if (dp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dp->dtdo_buf = dt_alloc(dtp, sizeof (dif_instr_t) * 2);
+	dp->dtdo_inttab = dt_alloc(dtp, sizeof (uint64_t));
+
+	if (dp->dtdo_buf == NULL || dp->dtdo_inttab == NULL) {
+		dt_difo_free(dtp, dp);
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	dp->dtdo_buf[0] = DIF_INSTR_SETX(0, 1); /* setx	DIF_INTEGER[0], %r1 */
+	dp->dtdo_buf[1] = DIF_INSTR_RET(1);	/* ret	%r1 */
+	dp->dtdo_len = 2;
+	dp->dtdo_inttab[0] = id;
+	dp->dtdo_intlen = 1;
+	dp->dtdo_rtype = dt_int_rtype;
+
+	ap->dtad_difo = dp;
+	ap->dtad_kind = kind;
+}
+
+static void
+dt_action_clear(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dt_ident_t *aid;
+	dtrace_actdesc_t *ap;
+	dt_node_t *anp;
+
+	char n[DT_TYPE_NAMELEN];
+	int argc = 0;
+
+	for (anp = dnp->dn_args; anp != NULL; anp = anp->dn_list)
+		argc++; /* count up arguments for error messages below */
+
+	if (argc != 1) {
+		dnerror(dnp, D_CLEAR_PROTO,
+		    "%s( ) prototype mismatch: %d args passed, 1 expected\n",
+		    dnp->dn_ident->di_name, argc);
+	}
+
+	anp = dnp->dn_args;
+	assert(anp != NULL);
+
+	if (anp->dn_kind != DT_NODE_AGG) {
+		dnerror(dnp, D_CLEAR_AGGARG,
+		    "%s( ) argument #1 is incompatible with prototype:\n"
+		    "\tprototype: aggregation\n\t argument: %s\n",
+		    dnp->dn_ident->di_name,
+		    dt_node_type_name(anp, n, sizeof (n)));
+	}
+
+	aid = anp->dn_ident;
+
+	if (aid->di_gen == dtp->dt_gen && !(aid->di_flags & DT_IDFLG_MOD)) {
+		dnerror(dnp, D_CLEAR_AGGBAD,
+		    "undefined aggregation: @%s\n", aid->di_name);
+	}
+
+	ap = dt_stmt_action(dtp, sdp);
+	dt_action_difconst(ap, anp->dn_ident->di_id, DTRACEACT_LIBACT);
+	ap->dtad_arg = DT_ACT_CLEAR;
+}
+
+static void
+dt_action_normalize(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dt_ident_t *aid;
+	dtrace_actdesc_t *ap;
+	dt_node_t *anp, *normal;
+	int denormal = (strcmp(dnp->dn_ident->di_name, "denormalize") == 0);
+
+	char n[DT_TYPE_NAMELEN];
+	int argc = 0;
+
+	for (anp = dnp->dn_args; anp != NULL; anp = anp->dn_list)
+		argc++; /* count up arguments for error messages below */
+
+	if ((denormal && argc != 1) || (!denormal && argc != 2)) {
+		dnerror(dnp, D_NORMALIZE_PROTO,
+		    "%s( ) prototype mismatch: %d args passed, %d expected\n",
+		    dnp->dn_ident->di_name, argc, denormal ? 1 : 2);
+	}
+
+	anp = dnp->dn_args;
+	assert(anp != NULL);
+
+	if (anp->dn_kind != DT_NODE_AGG) {
+		dnerror(dnp, D_NORMALIZE_AGGARG,
+		    "%s( ) argument #1 is incompatible with prototype:\n"
+		    "\tprototype: aggregation\n\t argument: %s\n",
+		    dnp->dn_ident->di_name,
+		    dt_node_type_name(anp, n, sizeof (n)));
+	}
+
+	if ((normal = anp->dn_list) != NULL && !dt_node_is_scalar(normal)) {
+		dnerror(dnp, D_NORMALIZE_SCALAR,
+		    "%s( ) argument #2 must be of scalar type\n",
+		    dnp->dn_ident->di_name);
+	}
+
+	aid = anp->dn_ident;
+
+	if (aid->di_gen == dtp->dt_gen && !(aid->di_flags & DT_IDFLG_MOD)) {
+		dnerror(dnp, D_NORMALIZE_AGGBAD,
+		    "undefined aggregation: @%s\n", aid->di_name);
+	}
+
+	ap = dt_stmt_action(dtp, sdp);
+	dt_action_difconst(ap, anp->dn_ident->di_id, DTRACEACT_LIBACT);
+
+	if (denormal) {
+		ap->dtad_arg = DT_ACT_DENORMALIZE;
+		return;
+	}
+
+	ap->dtad_arg = DT_ACT_NORMALIZE;
+
+	assert(normal != NULL);
+	ap = dt_stmt_action(dtp, sdp);
+	dt_cg(yypcb, normal);
+
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_LIBACT;
+	ap->dtad_arg = DT_ACT_NORMALIZE;
+}
+
+static void
+dt_action_trunc(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dt_ident_t *aid;
+	dtrace_actdesc_t *ap;
+	dt_node_t *anp, *trunc;
+
+	char n[DT_TYPE_NAMELEN];
+	int argc = 0;
+
+	for (anp = dnp->dn_args; anp != NULL; anp = anp->dn_list)
+		argc++; /* count up arguments for error messages below */
+
+	if (argc > 2 || argc < 1) {
+		dnerror(dnp, D_TRUNC_PROTO,
+		    "%s( ) prototype mismatch: %d args passed, %s expected\n",
+		    dnp->dn_ident->di_name, argc,
+		    argc < 1 ? "at least 1" : "no more than 2");
+	}
+
+	anp = dnp->dn_args;
+	assert(anp != NULL);
+	trunc = anp->dn_list;
+
+	if (anp->dn_kind != DT_NODE_AGG) {
+		dnerror(dnp, D_TRUNC_AGGARG,
+		    "%s( ) argument #1 is incompatible with prototype:\n"
+		    "\tprototype: aggregation\n\t argument: %s\n",
+		    dnp->dn_ident->di_name,
+		    dt_node_type_name(anp, n, sizeof (n)));
+	}
+
+	if (argc == 2) {
+		assert(trunc != NULL);
+		if (!dt_node_is_scalar(trunc)) {
+			dnerror(dnp, D_TRUNC_SCALAR,
+			    "%s( ) argument #2 must be of scalar type\n",
+			    dnp->dn_ident->di_name);
+		}
+	}
+
+	aid = anp->dn_ident;
+
+	if (aid->di_gen == dtp->dt_gen && !(aid->di_flags & DT_IDFLG_MOD)) {
+		dnerror(dnp, D_TRUNC_AGGBAD,
+		    "undefined aggregation: @%s\n", aid->di_name);
+	}
+
+	ap = dt_stmt_action(dtp, sdp);
+	dt_action_difconst(ap, anp->dn_ident->di_id, DTRACEACT_LIBACT);
+	ap->dtad_arg = DT_ACT_TRUNC;
+
+	ap = dt_stmt_action(dtp, sdp);
+
+	if (argc == 1) {
+		dt_action_difconst(ap, 0, DTRACEACT_LIBACT);
+	} else {
+		assert(trunc != NULL);
+		dt_cg(yypcb, trunc);
+		ap->dtad_difo = dt_as(yypcb);
+		ap->dtad_kind = DTRACEACT_LIBACT;
+	}
+
+	ap->dtad_arg = DT_ACT_TRUNC;
+}
+
+static void
+dt_action_printa(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dt_ident_t *aid, *fid;
+	dtrace_actdesc_t *ap;
+	const char *format;
+	dt_node_t *anp, *proto = NULL;
+
+	char n[DT_TYPE_NAMELEN];
+	int argc = 0, argr = 0;
+
+	for (anp = dnp->dn_args; anp != NULL; anp = anp->dn_list)
+		argc++; /* count up arguments for error messages below */
+
+	switch (dnp->dn_args->dn_kind) {
+	case DT_NODE_STRING:
+		format = dnp->dn_args->dn_string;
+		anp = dnp->dn_args->dn_list;
+		argr = 2;
+		break;
+	case DT_NODE_AGG:
+		format = NULL;
+		anp = dnp->dn_args;
+		argr = 1;
+		break;
+	default:
+		format = NULL;
+		anp = dnp->dn_args;
+		argr = 1;
+	}
+
+	if (argc < argr) {
+		dnerror(dnp, D_PRINTA_PROTO,
+		    "%s( ) prototype mismatch: %d args passed, %d expected\n",
+		    dnp->dn_ident->di_name, argc, argr);
+	}
+
+	assert(anp != NULL);
+
+	while (anp != NULL) {
+		if (anp->dn_kind != DT_NODE_AGG) {
+			dnerror(dnp, D_PRINTA_AGGARG,
+			    "%s( ) argument #%d is incompatible with "
+			    "prototype:\n\tprototype: aggregation\n"
+			    "\t argument: %s\n", dnp->dn_ident->di_name, argr,
+			    dt_node_type_name(anp, n, sizeof (n)));
+		}
+
+		aid = anp->dn_ident;
+		fid = aid->di_iarg;
+
+		if (aid->di_gen == dtp->dt_gen &&
+		    !(aid->di_flags & DT_IDFLG_MOD)) {
+			dnerror(dnp, D_PRINTA_AGGBAD,
+			    "undefined aggregation: @%s\n", aid->di_name);
+		}
+
+		/*
+		 * If we have multiple aggregations, we must be sure that
+		 * their key signatures match.
+		 */
+		if (proto != NULL) {
+			dt_printa_validate(proto, anp);
+		} else {
+			proto = anp;
+		}
+
+		if (format != NULL) {
+			yylineno = dnp->dn_line;
+
+			sdp->dtsd_fmtdata =
+			    dt_printf_create(yypcb->pcb_hdl, format);
+			dt_printf_validate(sdp->dtsd_fmtdata,
+			    DT_PRINTF_AGGREGATION, dnp->dn_ident, 1,
+			    fid->di_id, ((dt_idsig_t *)aid->di_data)->dis_args);
+			format = NULL;
+		}
+
+		ap = dt_stmt_action(dtp, sdp);
+		dt_action_difconst(ap, anp->dn_ident->di_id, DTRACEACT_PRINTA);
+
+		anp = anp->dn_list;
+		argr++;
+	}
+}
+
+static void
+dt_action_printflike(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp,
+    dtrace_actkind_t kind)
+{
+	dt_node_t *anp, *arg1;
+	dtrace_actdesc_t *ap = NULL;
+	char n[DT_TYPE_NAMELEN], *str;
+
+	assert(DTRACEACT_ISPRINTFLIKE(kind));
+
+	if (dnp->dn_args->dn_kind != DT_NODE_STRING) {
+		dnerror(dnp, D_PRINTF_ARG_FMT,
+		    "%s( ) argument #1 is incompatible with prototype:\n"
+		    "\tprototype: string constant\n\t argument: %s\n",
+		    dnp->dn_ident->di_name,
+		    dt_node_type_name(dnp->dn_args, n, sizeof (n)));
+	}
+
+	arg1 = dnp->dn_args->dn_list;
+	yylineno = dnp->dn_line;
+	str = dnp->dn_args->dn_string;
+
+
+	/*
+	 * If this is an freopen(), we use an empty string to denote that
+	 * stdout should be restored.  For other printf()-like actions, an
+	 * empty format string is illegal:  an empty format string would
+	 * result in malformed DOF, and the compiler thus flags an empty
+	 * format string as a compile-time error.  To avoid propagating the
+	 * freopen() special case throughout the system, we simply transpose
+	 * an empty string into a sentinel string (DT_FREOPEN_RESTORE) that
+	 * denotes that stdout should be restored.
+	 */
+	if (kind == DTRACEACT_FREOPEN) {
+		if (strcmp(str, DT_FREOPEN_RESTORE) == 0) {
+			/*
+			 * Our sentinel is always an invalid argument to
+			 * freopen(), but if it's been manually specified, we
+			 * must fail now instead of when the freopen() is
+			 * actually evaluated.
+			 */
+			dnerror(dnp, D_FREOPEN_INVALID,
+			    "%s( ) argument #1 cannot be \"%s\"\n",
+			    dnp->dn_ident->di_name, DT_FREOPEN_RESTORE);
+		}
+
+		if (str[0] == '\0')
+			str = DT_FREOPEN_RESTORE;
+	}
+
+	sdp->dtsd_fmtdata = dt_printf_create(dtp, str);
+
+	dt_printf_validate(sdp->dtsd_fmtdata, DT_PRINTF_EXACTLEN,
+	    dnp->dn_ident, 1, DTRACEACT_AGGREGATION, arg1);
+
+	if (arg1 == NULL) {
+		dif_instr_t *dbuf;
+		dtrace_difo_t *dp;
+
+		if ((dbuf = dt_alloc(dtp, sizeof (dif_instr_t))) == NULL ||
+		    (dp = dt_zalloc(dtp, sizeof (dtrace_difo_t))) == NULL) {
+			dt_free(dtp, dbuf);
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+		}
+
+		dbuf[0] = DIF_INSTR_RET(DIF_REG_R0); /* ret %r0 */
+
+		dp->dtdo_buf = dbuf;
+		dp->dtdo_len = 1;
+		dp->dtdo_rtype = dt_int_rtype;
+
+		ap = dt_stmt_action(dtp, sdp);
+		ap->dtad_difo = dp;
+		ap->dtad_kind = kind;
+		return;
+	}
+
+	for (anp = arg1; anp != NULL; anp = anp->dn_list) {
+		ap = dt_stmt_action(dtp, sdp);
+		dt_cg(yypcb, anp);
+		ap->dtad_difo = dt_as(yypcb);
+		ap->dtad_kind = kind;
+	}
+}
+
+static void
+dt_action_trace(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	if (dt_node_is_void(dnp->dn_args)) {
+		dnerror(dnp->dn_args, D_TRACE_VOID,
+		    "trace( ) may not be applied to a void expression\n");
+	}
+
+	if (dt_node_is_dynamic(dnp->dn_args)) {
+		dnerror(dnp->dn_args, D_TRACE_DYN,
+		    "trace( ) may not be applied to a dynamic expression\n");
+	}
+
+	dt_cg(yypcb, dnp->dn_args);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_DIFEXPR;
+}
+
+static void
+dt_action_tracemem(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_node_t *addr = dnp->dn_args;
+	dt_node_t *size = dnp->dn_args->dn_list;
+
+	char n[DT_TYPE_NAMELEN];
+
+	if (dt_node_is_integer(addr) == 0 && dt_node_is_pointer(addr) == 0) {
+		dnerror(addr, D_TRACEMEM_ADDR,
+		    "tracemem( ) argument #1 is incompatible with "
+		    "prototype:\n\tprototype: pointer or integer\n"
+		    "\t argument: %s\n",
+		    dt_node_type_name(addr, n, sizeof (n)));
+	}
+
+	if (dt_node_is_posconst(size) == 0) {
+		dnerror(size, D_TRACEMEM_SIZE, "tracemem( ) argument #2 must "
+		    "be a non-zero positive integral constant expression\n");
+	}
+
+	dt_cg(yypcb, addr);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_DIFEXPR;
+
+	ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF;
+	ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value;
+}
+
+static void
+dt_action_stack_args(dtrace_hdl_t *dtp, dtrace_actdesc_t *ap, dt_node_t *arg0)
+{
+	ap->dtad_kind = DTRACEACT_STACK;
+
+	if (dtp->dt_options[DTRACEOPT_STACKFRAMES] != DTRACEOPT_UNSET) {
+		ap->dtad_arg = dtp->dt_options[DTRACEOPT_STACKFRAMES];
+	} else {
+		ap->dtad_arg = 0;
+	}
+
+	if (arg0 != NULL) {
+		if (arg0->dn_list != NULL) {
+			dnerror(arg0, D_STACK_PROTO, "stack( ) prototype "
+			    "mismatch: too many arguments\n");
+		}
+
+		if (dt_node_is_posconst(arg0) == 0) {
+			dnerror(arg0, D_STACK_SIZE, "stack( ) size must be a "
+			    "non-zero positive integral constant expression\n");
+		}
+
+		ap->dtad_arg = arg0->dn_value;
+	}
+}
+
+static void
+dt_action_stack(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+	dt_action_stack_args(dtp, ap, dnp->dn_args);
+}
+
+static void
+dt_action_ustack_args(dtrace_hdl_t *dtp, dtrace_actdesc_t *ap, dt_node_t *dnp)
+{
+	uint32_t nframes = 0;
+	uint32_t strsize = 0;	/* default string table size */
+	dt_node_t *arg0 = dnp->dn_args;
+	dt_node_t *arg1 = arg0 != NULL ? arg0->dn_list : NULL;
+
+	assert(dnp->dn_ident->di_id == DT_ACT_JSTACK ||
+	    dnp->dn_ident->di_id == DT_ACT_USTACK);
+
+	if (dnp->dn_ident->di_id == DT_ACT_JSTACK) {
+		if (dtp->dt_options[DTRACEOPT_JSTACKFRAMES] != DTRACEOPT_UNSET)
+			nframes = dtp->dt_options[DTRACEOPT_JSTACKFRAMES];
+
+		if (dtp->dt_options[DTRACEOPT_JSTACKSTRSIZE] != DTRACEOPT_UNSET)
+			strsize = dtp->dt_options[DTRACEOPT_JSTACKSTRSIZE];
+
+		ap->dtad_kind = DTRACEACT_JSTACK;
+	} else {
+		assert(dnp->dn_ident->di_id == DT_ACT_USTACK);
+
+		if (dtp->dt_options[DTRACEOPT_USTACKFRAMES] != DTRACEOPT_UNSET)
+			nframes = dtp->dt_options[DTRACEOPT_USTACKFRAMES];
+
+		ap->dtad_kind = DTRACEACT_USTACK;
+	}
+
+	if (arg0 != NULL) {
+		if (!dt_node_is_posconst(arg0)) {
+			dnerror(arg0, D_USTACK_FRAMES, "ustack( ) argument #1 "
+			    "must be a non-zero positive integer constant\n");
+		}
+		nframes = (uint32_t)arg0->dn_value;
+	}
+
+	if (arg1 != NULL) {
+		if (arg1->dn_kind != DT_NODE_INT ||
+		    ((arg1->dn_flags & DT_NF_SIGNED) &&
+		    (int64_t)arg1->dn_value < 0)) {
+			dnerror(arg1, D_USTACK_STRSIZE, "ustack( ) argument #2 "
+			    "must be a positive integer constant\n");
+		}
+
+		if (arg1->dn_list != NULL) {
+			dnerror(arg1, D_USTACK_PROTO, "ustack( ) prototype "
+			    "mismatch: too many arguments\n");
+		}
+
+		strsize = (uint32_t)arg1->dn_value;
+	}
+
+	ap->dtad_arg = DTRACE_USTACK_ARG(nframes, strsize);
+}
+
+static void
+dt_action_ustack(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+	dt_action_ustack_args(dtp, ap, dnp);
+}
+
+static void
+dt_action_setopt(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap;
+	dt_node_t *arg0, *arg1;
+
+	/*
+	 * The prototype guarantees that we are called with either one or
+	 * two arguments, and that any arguments that are present are strings.
+	 */
+	arg0 = dnp->dn_args;
+	arg1 = arg0->dn_list;
+
+	ap = dt_stmt_action(dtp, sdp);
+	dt_cg(yypcb, arg0);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_LIBACT;
+	ap->dtad_arg = DT_ACT_SETOPT;
+
+	ap = dt_stmt_action(dtp, sdp);
+
+	if (arg1 == NULL) {
+		dt_action_difconst(ap, 0, DTRACEACT_LIBACT);
+	} else {
+		dt_cg(yypcb, arg1);
+		ap->dtad_difo = dt_as(yypcb);
+		ap->dtad_kind = DTRACEACT_LIBACT;
+	}
+
+	ap->dtad_arg = DT_ACT_SETOPT;
+}
+
+/*ARGSUSED*/
+static void
+dt_action_symmod_args(dtrace_hdl_t *dtp, dtrace_actdesc_t *ap,
+    dt_node_t *dnp, dtrace_actkind_t kind)
+{
+	assert(kind == DTRACEACT_SYM || kind == DTRACEACT_MOD ||
+	    kind == DTRACEACT_USYM || kind == DTRACEACT_UMOD ||
+	    kind == DTRACEACT_UADDR);
+
+	dt_cg(yypcb, dnp);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = kind;
+	ap->dtad_difo->dtdo_rtype.dtdt_size = sizeof (uint64_t);
+}
+
+static void
+dt_action_symmod(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp,
+    dtrace_actkind_t kind)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+	dt_action_symmod_args(dtp, ap, dnp->dn_args, kind);
+}
+
+/*ARGSUSED*/
+static void
+dt_action_ftruncate(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	/*
+	 * Library actions need a DIFO that serves as an argument.  As
+	 * ftruncate() doesn't take an argument, we generate the constant 0
+	 * in a DIFO; this constant will be ignored when the ftruncate() is
+	 * processed.
+	 */
+	dt_action_difconst(ap, 0, DTRACEACT_LIBACT);
+	ap->dtad_arg = DT_ACT_FTRUNCATE;
+}
+
+/*ARGSUSED*/
+static void
+dt_action_stop(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	ap->dtad_kind = DTRACEACT_STOP;
+	ap->dtad_arg = 0;
+}
+
+/*ARGSUSED*/
+static void
+dt_action_breakpoint(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	ap->dtad_kind = DTRACEACT_BREAKPOINT;
+	ap->dtad_arg = 0;
+}
+
+/*ARGSUSED*/
+static void
+dt_action_panic(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	ap->dtad_kind = DTRACEACT_PANIC;
+	ap->dtad_arg = 0;
+}
+
+static void
+dt_action_chill(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_cg(yypcb, dnp->dn_args);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_CHILL;
+}
+
+static void
+dt_action_raise(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_cg(yypcb, dnp->dn_args);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_RAISE;
+}
+
+static void
+dt_action_exit(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_cg(yypcb, dnp->dn_args);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_EXIT;
+	ap->dtad_difo->dtdo_rtype.dtdt_size = sizeof (int);
+}
+
+static void
+dt_action_speculate(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_cg(yypcb, dnp->dn_args);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_SPECULATE;
+}
+
+static void
+dt_action_commit(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_cg(yypcb, dnp->dn_args);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_COMMIT;
+}
+
+static void
+dt_action_discard(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_cg(yypcb, dnp->dn_args);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_kind = DTRACEACT_DISCARD;
+}
+
+static void
+dt_compile_fun(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	switch (dnp->dn_expr->dn_ident->di_id) {
+	case DT_ACT_BREAKPOINT:
+		dt_action_breakpoint(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_CHILL:
+		dt_action_chill(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_CLEAR:
+		dt_action_clear(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_COMMIT:
+		dt_action_commit(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_DENORMALIZE:
+		dt_action_normalize(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_DISCARD:
+		dt_action_discard(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_EXIT:
+		dt_action_exit(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_FREOPEN:
+		dt_action_printflike(dtp, dnp->dn_expr, sdp, DTRACEACT_FREOPEN);
+		break;
+	case DT_ACT_FTRUNCATE:
+		dt_action_ftruncate(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_MOD:
+		dt_action_symmod(dtp, dnp->dn_expr, sdp, DTRACEACT_MOD);
+		break;
+	case DT_ACT_NORMALIZE:
+		dt_action_normalize(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_PANIC:
+		dt_action_panic(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_PRINTA:
+		dt_action_printa(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_PRINTF:
+		dt_action_printflike(dtp, dnp->dn_expr, sdp, DTRACEACT_PRINTF);
+		break;
+	case DT_ACT_RAISE:
+		dt_action_raise(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_SETOPT:
+		dt_action_setopt(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_SPECULATE:
+		dt_action_speculate(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_STACK:
+		dt_action_stack(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_STOP:
+		dt_action_stop(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_SYM:
+		dt_action_symmod(dtp, dnp->dn_expr, sdp, DTRACEACT_SYM);
+		break;
+	case DT_ACT_SYSTEM:
+		dt_action_printflike(dtp, dnp->dn_expr, sdp, DTRACEACT_SYSTEM);
+		break;
+	case DT_ACT_TRACE:
+		dt_action_trace(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_TRACEMEM:
+		dt_action_tracemem(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_TRUNC:
+		dt_action_trunc(dtp, dnp->dn_expr, sdp);
+		break;
+	case DT_ACT_UADDR:
+		dt_action_symmod(dtp, dnp->dn_expr, sdp, DTRACEACT_UADDR);
+		break;
+	case DT_ACT_UMOD:
+		dt_action_symmod(dtp, dnp->dn_expr, sdp, DTRACEACT_UMOD);
+		break;
+	case DT_ACT_USYM:
+		dt_action_symmod(dtp, dnp->dn_expr, sdp, DTRACEACT_USYM);
+		break;
+	case DT_ACT_USTACK:
+	case DT_ACT_JSTACK:
+		dt_action_ustack(dtp, dnp->dn_expr, sdp);
+		break;
+	default:
+		dnerror(dnp->dn_expr, D_UNKNOWN, "tracing function %s( ) is "
+		    "not yet supported\n", dnp->dn_expr->dn_ident->di_name);
+	}
+}
+
+static void
+dt_compile_exp(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_cg(yypcb, dnp->dn_expr);
+	ap->dtad_difo = dt_as(yypcb);
+	ap->dtad_difo->dtdo_rtype = dt_void_rtype;
+	ap->dtad_kind = DTRACEACT_DIFEXPR;
+}
+
+static void
+dt_compile_agg(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dt_ident_t *aid, *fid;
+	dt_node_t *anp, *incr = NULL;
+	dtrace_actdesc_t *ap;
+	uint_t n = 1, argmax;
+	uint64_t arg = 0;
+
+	/*
+	 * If the aggregation has no aggregating function applied to it, then
+	 * this statement has no effect.  Flag this as a programming error.
+	 */
+	if (dnp->dn_aggfun == NULL) {
+		dnerror(dnp, D_AGG_NULL, "expression has null effect: @%s\n",
+		    dnp->dn_ident->di_name);
+	}
+
+	aid = dnp->dn_ident;
+	fid = dnp->dn_aggfun->dn_ident;
+
+	if (dnp->dn_aggfun->dn_args != NULL &&
+	    dt_node_is_scalar(dnp->dn_aggfun->dn_args) == 0) {
+		dnerror(dnp->dn_aggfun, D_AGG_SCALAR, "%s( ) argument #1 must "
+		    "be of scalar type\n", fid->di_name);
+	}
+
+	/*
+	 * The ID of the aggregation itself is implicitly recorded as the first
+	 * member of each aggregation tuple so we can distinguish them later.
+	 */
+	ap = dt_stmt_action(dtp, sdp);
+	dt_action_difconst(ap, aid->di_id, DTRACEACT_DIFEXPR);
+
+	for (anp = dnp->dn_aggtup; anp != NULL; anp = anp->dn_list) {
+		ap = dt_stmt_action(dtp, sdp);
+		n++;
+
+		if (anp->dn_kind == DT_NODE_FUNC) {
+			if (anp->dn_ident->di_id == DT_ACT_STACK) {
+				dt_action_stack_args(dtp, ap, anp->dn_args);
+				continue;
+			}
+
+			if (anp->dn_ident->di_id == DT_ACT_USTACK ||
+			    anp->dn_ident->di_id == DT_ACT_JSTACK) {
+				dt_action_ustack_args(dtp, ap, anp);
+				continue;
+			}
+
+			switch (anp->dn_ident->di_id) {
+			case DT_ACT_UADDR:
+				dt_action_symmod_args(dtp, ap,
+				    anp->dn_args, DTRACEACT_UADDR);
+				continue;
+
+			case DT_ACT_USYM:
+				dt_action_symmod_args(dtp, ap,
+				    anp->dn_args, DTRACEACT_USYM);
+				continue;
+
+			case DT_ACT_UMOD:
+				dt_action_symmod_args(dtp, ap,
+				    anp->dn_args, DTRACEACT_UMOD);
+				continue;
+
+			case DT_ACT_SYM:
+				dt_action_symmod_args(dtp, ap,
+				    anp->dn_args, DTRACEACT_SYM);
+				continue;
+
+			case DT_ACT_MOD:
+				dt_action_symmod_args(dtp, ap,
+				    anp->dn_args, DTRACEACT_MOD);
+				continue;
+
+			default:
+				break;
+			}
+		}
+
+		dt_cg(yypcb, anp);
+		ap->dtad_difo = dt_as(yypcb);
+		ap->dtad_kind = DTRACEACT_DIFEXPR;
+	}
+
+	if (fid->di_id == DTRACEAGG_LQUANTIZE) {
+		/*
+		 * For linear quantization, we have between two and four
+		 * arguments in addition to the expression:
+		 *
+		 *    arg1 => Base value
+		 *    arg2 => Limit value
+		 *    arg3 => Quantization level step size (defaults to 1)
+		 *    arg4 => Quantization increment value (defaults to 1)
+		 */
+		dt_node_t *arg1 = dnp->dn_aggfun->dn_args->dn_list;
+		dt_node_t *arg2 = arg1->dn_list;
+		dt_node_t *arg3 = arg2->dn_list;
+		dt_idsig_t *isp;
+		uint64_t nlevels, step = 1, oarg;
+		int64_t baseval, limitval;
+
+		if (arg1->dn_kind != DT_NODE_INT) {
+			dnerror(arg1, D_LQUANT_BASETYPE, "lquantize( ) "
+			    "argument #1 must be an integer constant\n");
+		}
+
+		baseval = (int64_t)arg1->dn_value;
+
+		if (baseval < INT32_MIN || baseval > INT32_MAX) {
+			dnerror(arg1, D_LQUANT_BASEVAL, "lquantize( ) "
+			    "argument #1 must be a 32-bit quantity\n");
+		}
+
+		if (arg2->dn_kind != DT_NODE_INT) {
+			dnerror(arg2, D_LQUANT_LIMTYPE, "lquantize( ) "
+			    "argument #2 must be an integer constant\n");
+		}
+
+		limitval = (int64_t)arg2->dn_value;
+
+		if (limitval < INT32_MIN || limitval > INT32_MAX) {
+			dnerror(arg2, D_LQUANT_LIMVAL, "lquantize( ) "
+			    "argument #2 must be a 32-bit quantity\n");
+		}
+
+		if (limitval < baseval) {
+			dnerror(dnp, D_LQUANT_MISMATCH,
+			    "lquantize( ) base (argument #1) must be less "
+			    "than limit (argument #2)\n");
+		}
+
+		if (arg3 != NULL) {
+			if (!dt_node_is_posconst(arg3)) {
+				dnerror(arg3, D_LQUANT_STEPTYPE, "lquantize( ) "
+				    "argument #3 must be a non-zero positive "
+				    "integer constant\n");
+			}
+
+			if ((step = arg3->dn_value) > UINT16_MAX) {
+				dnerror(arg3, D_LQUANT_STEPVAL, "lquantize( ) "
+				    "argument #3 must be a 16-bit quantity\n");
+			}
+		}
+
+		nlevels = (limitval - baseval) / step;
+
+		if (nlevels == 0) {
+			dnerror(dnp, D_LQUANT_STEPLARGE,
+			    "lquantize( ) step (argument #3) too large: must "
+			    "have at least one quantization level\n");
+		}
+
+		if (nlevels > UINT16_MAX) {
+			dnerror(dnp, D_LQUANT_STEPSMALL, "lquantize( ) step "
+			    "(argument #3) too small: number of quantization "
+			    "levels must be a 16-bit quantity\n");
+		}
+
+		arg = (step << DTRACE_LQUANTIZE_STEPSHIFT) |
+		    (nlevels << DTRACE_LQUANTIZE_LEVELSHIFT) |
+		    ((baseval << DTRACE_LQUANTIZE_BASESHIFT) &
+		    DTRACE_LQUANTIZE_BASEMASK);
+
+		assert(arg != 0);
+
+		isp = (dt_idsig_t *)aid->di_data;
+
+		if (isp->dis_auxinfo == 0) {
+			/*
+			 * This is the first time we've seen an lquantize()
+			 * for this aggregation; we'll store our argument
+			 * as the auxiliary signature information.
+			 */
+			isp->dis_auxinfo = arg;
+		} else if ((oarg = isp->dis_auxinfo) != arg) {
+			/*
+			 * If we have seen this lquantize() before and the
+			 * argument doesn't match the original argument, pick
+			 * the original argument apart to concisely report the
+			 * mismatch.
+			 */
+			int obaseval = DTRACE_LQUANTIZE_BASE(oarg);
+			int onlevels = DTRACE_LQUANTIZE_LEVELS(oarg);
+			int ostep = DTRACE_LQUANTIZE_STEP(oarg);
+
+			if (obaseval != baseval) {
+				dnerror(dnp, D_LQUANT_MATCHBASE, "lquantize( ) "
+				    "base (argument #1) doesn't match previous "
+				    "declaration: expected %d, found %d\n",
+				    obaseval, (int)baseval);
+			}
+
+			if (onlevels * ostep != nlevels * step) {
+				dnerror(dnp, D_LQUANT_MATCHLIM, "lquantize( ) "
+				    "limit (argument #2) doesn't match previous"
+				    " declaration: expected %d, found %d\n",
+				    obaseval + onlevels * ostep,
+				    (int)baseval + (int)nlevels * (int)step);
+			}
+
+			if (ostep != step) {
+				dnerror(dnp, D_LQUANT_MATCHSTEP, "lquantize( ) "
+				    "step (argument #3) doesn't match previous "
+				    "declaration: expected %d, found %d\n",
+				    ostep, (int)step);
+			}
+
+			/*
+			 * We shouldn't be able to get here -- one of the
+			 * parameters must be mismatched if the arguments
+			 * didn't match.
+			 */
+			assert(0);
+		}
+
+		incr = arg3 != NULL ? arg3->dn_list : NULL;
+		argmax = 5;
+	}
+
+	if (fid->di_id == DTRACEAGG_QUANTIZE) {
+		incr = dnp->dn_aggfun->dn_args->dn_list;
+		argmax = 2;
+	}
+
+	if (incr != NULL) {
+		if (!dt_node_is_scalar(incr)) {
+			dnerror(dnp, D_PROTO_ARG, "%s( ) increment value "
+			    "(argument #%d) must be of scalar type\n",
+			    fid->di_name, argmax);
+		}
+
+		if ((anp = incr->dn_list) != NULL) {
+			int argc = argmax;
+
+			for (; anp != NULL; anp = anp->dn_list)
+				argc++;
+
+			dnerror(incr, D_PROTO_LEN, "%s( ) prototype "
+			    "mismatch: %d args passed, at most %d expected",
+			    fid->di_name, argc, argmax);
+		}
+
+		ap = dt_stmt_action(dtp, sdp);
+		n++;
+
+		dt_cg(yypcb, incr);
+		ap->dtad_difo = dt_as(yypcb);
+		ap->dtad_difo->dtdo_rtype = dt_void_rtype;
+		ap->dtad_kind = DTRACEACT_DIFEXPR;
+	}
+
+	assert(sdp->dtsd_aggdata == NULL);
+	sdp->dtsd_aggdata = aid;
+
+	ap = dt_stmt_action(dtp, sdp);
+	assert(fid->di_kind == DT_IDENT_AGGFUNC);
+	assert(DTRACEACT_ISAGG(fid->di_id));
+	ap->dtad_kind = fid->di_id;
+	ap->dtad_ntuple = n;
+	ap->dtad_arg = arg;
+
+	if (dnp->dn_aggfun->dn_args != NULL) {
+		dt_cg(yypcb, dnp->dn_aggfun->dn_args);
+		ap->dtad_difo = dt_as(yypcb);
+	}
+}
+
+static void
+dt_compile_one_clause(dtrace_hdl_t *dtp, dt_node_t *cnp, dt_node_t *pnp)
+{
+	dtrace_ecbdesc_t *edp;
+	dtrace_stmtdesc_t *sdp;
+	dt_node_t *dnp;
+
+	yylineno = pnp->dn_line;
+	dt_setcontext(dtp, pnp->dn_desc);
+	(void) dt_node_cook(cnp, DT_IDFLG_REF);
+
+	if (DT_TREEDUMP_PASS(dtp, 2))
+		dt_node_printr(cnp, stderr, 0);
+
+	if ((edp = dt_ecbdesc_create(dtp, pnp->dn_desc)) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	assert(yypcb->pcb_ecbdesc == NULL);
+	yypcb->pcb_ecbdesc = edp;
+
+	if (cnp->dn_pred != NULL) {
+		dt_cg(yypcb, cnp->dn_pred);
+		edp->dted_pred.dtpdd_difo = dt_as(yypcb);
+	}
+
+	if (cnp->dn_acts == NULL) {
+		dt_stmt_append(dt_stmt_create(dtp, edp,
+		    cnp->dn_ctxattr, _dtrace_defattr), cnp);
+	}
+
+	for (dnp = cnp->dn_acts; dnp != NULL; dnp = dnp->dn_list) {
+		assert(yypcb->pcb_stmt == NULL);
+		sdp = dt_stmt_create(dtp, edp, cnp->dn_ctxattr, cnp->dn_attr);
+
+		switch (dnp->dn_kind) {
+		case DT_NODE_DEXPR:
+			if (dnp->dn_expr->dn_kind == DT_NODE_AGG)
+				dt_compile_agg(dtp, dnp->dn_expr, sdp);
+			else
+				dt_compile_exp(dtp, dnp, sdp);
+			break;
+		case DT_NODE_DFUNC:
+			dt_compile_fun(dtp, dnp, sdp);
+			break;
+		case DT_NODE_AGG:
+			dt_compile_agg(dtp, dnp, sdp);
+			break;
+		default:
+			dnerror(dnp, D_UNKNOWN, "internal error -- node kind "
+			    "%u is not a valid statement\n", dnp->dn_kind);
+		}
+
+		assert(yypcb->pcb_stmt == sdp);
+		dt_stmt_append(sdp, dnp);
+	}
+
+	assert(yypcb->pcb_ecbdesc == edp);
+	dt_ecbdesc_release(dtp, edp);
+	dt_endcontext(dtp);
+	yypcb->pcb_ecbdesc = NULL;
+}
+
+static void
+dt_compile_clause(dtrace_hdl_t *dtp, dt_node_t *cnp)
+{
+	dt_node_t *pnp;
+
+	for (pnp = cnp->dn_pdescs; pnp != NULL; pnp = pnp->dn_list)
+		dt_compile_one_clause(dtp, cnp, pnp);
+}
+
+static void
+dt_compile_xlator(dt_node_t *dnp)
+{
+	dt_xlator_t *dxp = dnp->dn_xlator;
+	dt_node_t *mnp;
+
+	for (mnp = dnp->dn_members; mnp != NULL; mnp = mnp->dn_list) {
+		assert(dxp->dx_membdif[mnp->dn_membid] == NULL);
+		dt_cg(yypcb, mnp);
+		dxp->dx_membdif[mnp->dn_membid] = dt_as(yypcb);
+	}
+}
+
+void
+dt_setcontext(dtrace_hdl_t *dtp, dtrace_probedesc_t *pdp)
+{
+	const dtrace_pattr_t *pap;
+	dt_probe_t *prp;
+#ifndef VBOX
+	dt_provider_t *pvp;
+#endif
+	dt_ident_t *idp;
+	char attrstr[8];
+	int err;
+
+#ifndef VBOX
+	/*
+	 * Both kernel and pid based providers are allowed to have names
+	 * ending with what could be interpreted as a number. We assume it's
+	 * a pid and that we may need to dynamically create probes for
+	 * that process if:
+	 *
+	 * (1) The provider doesn't exist, or,
+	 * (2) The provider exists and has DTRACE_PRIV_PROC privilege.
+	 *
+	 * On an error, dt_pid_create_probes() will set the error message
+	 * and tag -- we just have to longjmp() out of here.
+	 */
+	if (isdigit(pdp->dtpd_provider[strlen(pdp->dtpd_provider) - 1]) &&
+	    ((pvp = dt_provider_lookup(dtp, pdp->dtpd_provider)) == NULL ||
+	    pvp->pv_desc.dtvd_priv.dtpp_flags & DTRACE_PRIV_PROC) &&
+	    dt_pid_create_probes(pdp, dtp, yypcb) != 0) {
+		longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+	}
+#endif
+
+	/*
+	 * Call dt_probe_info() to get the probe arguments and attributes.  If
+	 * a representative probe is found, set 'pap' to the probe provider's
+	 * attributes.  Otherwise set 'pap' to default Unstable attributes.
+	 */
+	if ((prp = dt_probe_info(dtp, pdp, &yypcb->pcb_pinfo)) == NULL) {
+		pap = &_dtrace_prvdesc;
+		err = dtrace_errno(dtp);
+		bzero(&yypcb->pcb_pinfo, sizeof (dtrace_probeinfo_t));
+		yypcb->pcb_pinfo.dtp_attr = pap->dtpa_provider;
+		yypcb->pcb_pinfo.dtp_arga = pap->dtpa_args;
+	} else {
+		pap = &prp->pr_pvp->pv_desc.dtvd_attr;
+		err = 0;
+	}
+
+	if (err == EDT_NOPROBE && !(yypcb->pcb_cflags & DTRACE_C_ZDEFS)) {
+		xyerror(D_PDESC_ZERO, "probe description %s:%s:%s:%s does not "
+		    "match any probes\n", pdp->dtpd_provider, pdp->dtpd_mod,
+		    pdp->dtpd_func, pdp->dtpd_name);
+	}
+
+	if (err != EDT_NOPROBE && err != EDT_UNSTABLE && err != 0)
+		xyerror(D_PDESC_INVAL, "%s\n", dtrace_errmsg(dtp, err));
+
+	dt_dprintf("set context to %s:%s:%s:%s [%u] prp=%p attr=%s argc=%d\n",
+	    pdp->dtpd_provider, pdp->dtpd_mod, pdp->dtpd_func, pdp->dtpd_name,
+	    pdp->dtpd_id, (void *)prp, dt_attr_str(yypcb->pcb_pinfo.dtp_attr,
+	    attrstr, sizeof (attrstr)), yypcb->pcb_pinfo.dtp_argc);
+
+	/*
+	 * Reset the stability attributes of D global variables that vary
+	 * based on the attributes of the provider and context itself.
+	 */
+	if ((idp = dt_idhash_lookup(dtp->dt_globals, "probeprov")) != NULL)
+		idp->di_attr = pap->dtpa_provider;
+	if ((idp = dt_idhash_lookup(dtp->dt_globals, "probemod")) != NULL)
+		idp->di_attr = pap->dtpa_mod;
+	if ((idp = dt_idhash_lookup(dtp->dt_globals, "probefunc")) != NULL)
+		idp->di_attr = pap->dtpa_func;
+	if ((idp = dt_idhash_lookup(dtp->dt_globals, "probename")) != NULL)
+		idp->di_attr = pap->dtpa_name;
+	if ((idp = dt_idhash_lookup(dtp->dt_globals, "args")) != NULL)
+		idp->di_attr = pap->dtpa_args;
+
+	yypcb->pcb_pdesc = pdp;
+	yypcb->pcb_probe = prp;
+}
+
+/*
+ * Reset context-dependent variables and state at the end of cooking a D probe
+ * definition clause.  This ensures that external declarations between clauses
+ * do not reference any stale context-dependent data from the previous clause.
+ */
+void
+dt_endcontext(dtrace_hdl_t *dtp)
+{
+	static const char *const cvars[] = {
+		"probeprov", "probemod", "probefunc", "probename", "args", NULL
+	};
+
+	dt_ident_t *idp;
+	int i;
+
+	for (i = 0; cvars[i] != NULL; i++) {
+		if ((idp = dt_idhash_lookup(dtp->dt_globals, cvars[i])) != NULL)
+			idp->di_attr = _dtrace_defattr;
+	}
+
+	yypcb->pcb_pdesc = NULL;
+	yypcb->pcb_probe = NULL;
+}
+
+static int
+dt_reduceid(dt_idhash_t *dhp, dt_ident_t *idp, dtrace_hdl_t *dtp)
+{
+	if (idp->di_vers != 0 && idp->di_vers > dtp->dt_vmax)
+		dt_idhash_delete(dhp, idp);
+
+	return (0);
+}
+
+/*
+ * When dtrace_setopt() is called for "version", it calls dt_reduce() to remove
+ * any identifiers or translators that have been previously defined as bound to
+ * a version greater than the specified version.  Therefore, in our current
+ * version implementation, establishing a binding is a one-way transformation.
+ * In addition, no versioning is currently provided for types as our .d library
+ * files do not define any types and we reserve prefixes DTRACE_ and dtrace_
+ * for our exclusive use.  If required, type versioning will require more work.
+ */
+int
+dt_reduce(dtrace_hdl_t *dtp, dt_version_t v)
+{
+	char s[DT_VERSION_STRMAX];
+	dt_xlator_t *dxp, *nxp;
+
+	if (v > dtp->dt_vmax)
+		return (dt_set_errno(dtp, EDT_VERSREDUCED));
+	else if (v == dtp->dt_vmax)
+		return (0); /* no reduction necessary */
+
+	dt_dprintf("reducing api version to %s\n",
+	    dt_version_num2str(v, s, sizeof (s)));
+
+	dtp->dt_vmax = v;
+
+	for (dxp = dt_list_next(&dtp->dt_xlators); dxp != NULL; dxp = nxp) {
+		nxp = dt_list_next(dxp);
+		if ((dxp->dx_souid.di_vers != 0 && dxp->dx_souid.di_vers > v) ||
+		    (dxp->dx_ptrid.di_vers != 0 && dxp->dx_ptrid.di_vers > v))
+			dt_list_delete(&dtp->dt_xlators, dxp);
+	}
+
+	(void) dt_idhash_iter(dtp->dt_macros, (dt_idhash_f *)dt_reduceid, dtp);
+	(void) dt_idhash_iter(dtp->dt_aggs, (dt_idhash_f *)dt_reduceid, dtp);
+	(void) dt_idhash_iter(dtp->dt_globals, (dt_idhash_f *)dt_reduceid, dtp);
+	(void) dt_idhash_iter(dtp->dt_tls, (dt_idhash_f *)dt_reduceid, dtp);
+
+	return (0);
+}
+
+/*
+ * Fork and exec the cpp(1) preprocessor to run over the specified input file,
+ * and return a FILE handle for the cpp output.  We use the /dev/fd filesystem
+ * here to simplify the code by leveraging file descriptor inheritance.
+ */
+static FILE *
+dt_preproc(dtrace_hdl_t *dtp, FILE *ifp)
+{
+#ifndef VBOX
+	int argc = dtp->dt_cpp_argc;
+	char **argv = malloc(sizeof (char *) * (argc + 5));
+	FILE *ofp = tmpfile();
+
+	char ipath[20], opath[20]; /* big enough for /dev/fd/ + INT_MAX + \0 */
+	char verdef[32]; /* big enough for -D__SUNW_D_VERSION=0x%08x + \0 */
+
+	struct sigaction act, oact;
+	sigset_t mask, omask;
+
+	int wstat, estat;
+	pid_t pid;
+	off64_t off;
+	int c;
+
+	if (argv == NULL || ofp == NULL) {
+		(void) dt_set_errno(dtp, errno);
+		goto err;
+	}
+
+	/*
+	 * If the input is a seekable file, see if it is an interpreter file.
+	 * If we see #!, seek past the first line because cpp will choke on it.
+	 * We start cpp just prior to the \n at the end of this line so that
+	 * it still sees the newline, ensuring that #line values are correct.
+	 */
+	if (isatty(fileno(ifp)) == 0 && (off = ftello64(ifp)) != -1) {
+		if ((c = fgetc(ifp)) == '#' && (c = fgetc(ifp)) == '!') {
+			for (off += 2; c != '\n'; off++) {
+				if ((c = fgetc(ifp)) == EOF)
+					break;
+			}
+			if (c == '\n')
+				off--; /* start cpp just prior to \n */
+		}
+		(void) fflush(ifp);
+		(void) fseeko64(ifp, off, SEEK_SET);
+	}
+
+	(void) snprintf(ipath, sizeof (ipath), "/dev/fd/%d", fileno(ifp));
+	(void) snprintf(opath, sizeof (opath), "/dev/fd/%d", fileno(ofp));
+
+	bcopy(dtp->dt_cpp_argv, argv, sizeof (char *) * argc);
+
+	(void) snprintf(verdef, sizeof (verdef),
+	    "-D__SUNW_D_VERSION=0x%08x", dtp->dt_vmax);
+	argv[argc++] = verdef;
+
+	switch (dtp->dt_stdcmode) {
+	case DT_STDC_XA:
+	case DT_STDC_XT:
+		argv[argc++] = "-D__STDC__=0";
+		break;
+	case DT_STDC_XC:
+		argv[argc++] = "-D__STDC__=1";
+		break;
+	}
+
+	argv[argc++] = ipath;
+	argv[argc++] = opath;
+	argv[argc] = NULL;
+
+	/*
+	 * libdtrace must be able to be embedded in other programs that may
+	 * include application-specific signal handlers.  Therefore, if we
+	 * need to fork to run cpp(1), we must avoid generating a SIGCHLD
+	 * that could confuse the containing application.  To do this,
+	 * we block SIGCHLD and reset its disposition to SIG_DFL.
+	 * We restore our signal state once we are done.
+	 */
+	(void) sigemptyset(&mask);
+	(void) sigaddset(&mask, SIGCHLD);
+	(void) sigprocmask(SIG_BLOCK, &mask, &omask);
+
+	bzero(&act, sizeof (act));
+	act.sa_handler = SIG_DFL;
+	(void) sigaction(SIGCHLD, &act, &oact);
+
+	if ((pid = fork1()) == -1) {
+		(void) sigaction(SIGCHLD, &oact, NULL);
+		(void) sigprocmask(SIG_SETMASK, &omask, NULL);
+		(void) dt_set_errno(dtp, EDT_CPPFORK);
+		goto err;
+	}
+
+	if (pid == 0) {
+		(void) execvp(dtp->dt_cpp_path, argv);
+		_exit(errno == ENOENT ? 127 : 126);
+	}
+
+	do {
+		dt_dprintf("waiting for %s (PID %d)\n", dtp->dt_cpp_path,
+		    (int)pid);
+	} while (waitpid(pid, &wstat, 0) == -1 && errno == EINTR);
+
+	(void) sigaction(SIGCHLD, &oact, NULL);
+	(void) sigprocmask(SIG_SETMASK, &omask, NULL);
+
+	dt_dprintf("%s returned exit status 0x%x\n", dtp->dt_cpp_path, wstat);
+	estat = WIFEXITED(wstat) ? WEXITSTATUS(wstat) : -1;
+
+	if (estat != 0) {
+		switch (estat) {
+		case 126:
+			(void) dt_set_errno(dtp, EDT_CPPEXEC);
+			break;
+		case 127:
+			(void) dt_set_errno(dtp, EDT_CPPENT);
+			break;
+		default:
+			(void) dt_set_errno(dtp, EDT_CPPERR);
+		}
+		goto err;
+	}
+
+	free(argv);
+	(void) fflush(ofp);
+	(void) fseek(ofp, 0, SEEK_SET);
+	return (ofp);
+
+err:
+	free(argv);
+	(void) fclose(ofp);
+	return (NULL);
+#else  /* VBOX */
+	(void) dt_set_errno(dtp, EDT_CPPERR);
+	return (NULL);
+#endif /* VBOX */
+}
+
+static void
+dt_lib_depend_error(dtrace_hdl_t *dtp, const char *format, ...)
+{
+	va_list ap;
+
+	va_start(ap, format);
+	dt_set_errmsg(dtp, NULL, NULL, NULL, 0, format, ap);
+	va_end(ap);
+}
+
+int
+dt_lib_depend_add(dtrace_hdl_t *dtp, dt_list_t *dlp, const char *arg)
+{
+	dt_lib_depend_t *dld;
+	const char *end;
+
+	assert(arg != NULL);
+
+	if ((end = strrchr(arg, '/')) == NULL)
+		return (dt_set_errno(dtp, EINVAL));
+
+	if ((dld = dt_zalloc(dtp, sizeof (dt_lib_depend_t))) == NULL)
+		return (-1);
+
+	if ((dld->dtld_libpath = dt_alloc(dtp, MAXPATHLEN)) == NULL) {
+		dt_free(dtp, dld);
+		return (-1);
+	}
+
+	(void) strlcpy(dld->dtld_libpath, arg, end - arg + 2);
+	if ((dld->dtld_library = strdup(arg)) == NULL) {
+		dt_free(dtp, dld->dtld_libpath);
+		dt_free(dtp, dld);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	dt_list_append(dlp, dld);
+	return (0);
+}
+
+dt_lib_depend_t *
+dt_lib_depend_lookup(dt_list_t *dld, const char *arg)
+{
+	dt_lib_depend_t *dldn;
+
+	for (dldn = dt_list_next(dld); dldn != NULL;
+	    dldn = dt_list_next(dldn)) {
+		if (strcmp(dldn->dtld_library, arg) == 0)
+			return (dldn);
+	}
+
+	return (NULL);
+}
+
+/*
+ * Go through all the library files, and, if any library dependencies exist for
+ * that file, add it to that node's list of dependents. The result of this
+ * will be a graph which can then be topologically sorted to produce a
+ * compilation order.
+ */
+static int
+dt_lib_build_graph(dtrace_hdl_t *dtp)
+{
+	dt_lib_depend_t *dld, *dpld;
+
+	for (dld = dt_list_next(&dtp->dt_lib_dep); dld != NULL;
+	    dld = dt_list_next(dld)) {
+		char *library = dld->dtld_library;
+
+		for (dpld = dt_list_next(&dld->dtld_dependencies); dpld != NULL;
+		    dpld = dt_list_next(dpld)) {
+			dt_lib_depend_t *dlda;
+
+			if ((dlda = dt_lib_depend_lookup(&dtp->dt_lib_dep,
+			    dpld->dtld_library)) == NULL) {
+				dt_lib_depend_error(dtp,
+				    "Invalid library dependency in %s: %s\n",
+				    dld->dtld_library, dpld->dtld_library);
+
+				return (dt_set_errno(dtp, EDT_COMPILER));
+			}
+
+			if ((dt_lib_depend_add(dtp, &dlda->dtld_dependents,
+			    library)) != 0) {
+				return (-1); /* preserve dt_errno */
+			}
+		}
+	}
+	return (0);
+}
+
+static int
+dt_topo_sort(dtrace_hdl_t *dtp, dt_lib_depend_t *dld, int *count)
+{
+	dt_lib_depend_t *dpld, *dlda, *new;
+
+	dld->dtld_start = ++(*count);
+
+	for (dpld = dt_list_next(&dld->dtld_dependents); dpld != NULL;
+	    dpld = dt_list_next(dpld)) {
+		dlda = dt_lib_depend_lookup(&dtp->dt_lib_dep,
+		    dpld->dtld_library);
+		assert(dlda != NULL);
+
+		if (dlda->dtld_start == 0 &&
+		    dt_topo_sort(dtp, dlda, count) == -1)
+			return (-1);
+	}
+
+	if ((new = dt_zalloc(dtp, sizeof (dt_lib_depend_t))) == NULL)
+		return (-1);
+
+	if ((new->dtld_library = strdup(dld->dtld_library)) == NULL) {
+		dt_free(dtp, new);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	new->dtld_start = dld->dtld_start;
+	new->dtld_finish = dld->dtld_finish = ++(*count);
+	dt_list_prepend(&dtp->dt_lib_dep_sorted, new);
+
+	dt_dprintf("library %s sorted (%d/%d)\n", new->dtld_library,
+	    new->dtld_start, new->dtld_finish);
+
+	return (0);
+}
+
+static int
+dt_lib_depend_sort(dtrace_hdl_t *dtp)
+{
+	dt_lib_depend_t *dld, *dpld, *dlda;
+	int count = 0;
+
+	if (dt_lib_build_graph(dtp) == -1)
+		return (-1); /* preserve dt_errno */
+
+	/*
+	 * Perform a topological sort of the graph that hangs off
+	 * dtp->dt_lib_dep. The result of this process will be a
+	 * dependency ordered list located at dtp->dt_lib_dep_sorted.
+	 */
+	for (dld = dt_list_next(&dtp->dt_lib_dep); dld != NULL;
+	    dld = dt_list_next(dld)) {
+		if (dld->dtld_start == 0 &&
+		    dt_topo_sort(dtp, dld, &count) == -1)
+			return (-1); /* preserve dt_errno */;
+	}
+
+	/*
+	 * Check the graph for cycles. If an ancestor's finishing time is
+	 * less than any of its dependent's finishing times then a back edge
+	 * exists in the graph and this is a cycle.
+	 */
+	for (dld = dt_list_next(&dtp->dt_lib_dep); dld != NULL;
+	    dld = dt_list_next(dld)) {
+		for (dpld = dt_list_next(&dld->dtld_dependents); dpld != NULL;
+		    dpld = dt_list_next(dpld)) {
+			dlda = dt_lib_depend_lookup(&dtp->dt_lib_dep_sorted,
+			    dpld->dtld_library);
+			assert(dlda != NULL);
+
+			if (dlda->dtld_finish > dld->dtld_finish) {
+				dt_lib_depend_error(dtp,
+				    "Cyclic dependency detected: %s => %s\n",
+				    dld->dtld_library, dpld->dtld_library);
+
+				return (dt_set_errno(dtp, EDT_COMPILER));
+			}
+		}
+	}
+
+	return (0);
+}
+
+static void
+dt_lib_depend_free(dtrace_hdl_t *dtp)
+{
+	dt_lib_depend_t *dld, *dlda;
+
+	while ((dld = dt_list_next(&dtp->dt_lib_dep)) != NULL) {
+		while ((dlda = dt_list_next(&dld->dtld_dependencies)) != NULL) {
+			dt_list_delete(&dld->dtld_dependencies, dlda);
+			dt_free(dtp, dlda->dtld_library);
+			dt_free(dtp, dlda->dtld_libpath);
+			dt_free(dtp, dlda);
+		}
+		while ((dlda = dt_list_next(&dld->dtld_dependents)) != NULL) {
+			dt_list_delete(&dld->dtld_dependents, dlda);
+			dt_free(dtp, dlda->dtld_library);
+			dt_free(dtp, dlda->dtld_libpath);
+			dt_free(dtp, dlda);
+		}
+		dt_list_delete(&dtp->dt_lib_dep, dld);
+		dt_free(dtp, dld->dtld_library);
+		dt_free(dtp, dld->dtld_libpath);
+		dt_free(dtp, dld);
+	}
+
+	while ((dld = dt_list_next(&dtp->dt_lib_dep_sorted)) != NULL) {
+		dt_list_delete(&dtp->dt_lib_dep_sorted, dld);
+		dt_free(dtp, dld->dtld_library);
+		dt_free(dtp, dld);
+	}
+}
+
+
+/*
+ * Open all of the .d library files found in the specified directory and
+ * compile each one in topological order to cache its inlines and translators,
+ * etc.  We silently ignore any missing directories and other files found
+ * therein. We only fail (and thereby fail dt_load_libs()) if we fail to
+ * compile a library and the error is something other than #pragma D depends_on.
+ * Dependency errors are silently ignored to permit a library directory to
+ * contain libraries which may not be accessible depending on our privileges.
+ */
+static int
+dt_load_libs_dir(dtrace_hdl_t *dtp, const char *path)
+{
+#ifndef VBOX
+	struct dirent *dp;
+	const char *p;
+	DIR *dirp;
+#else
+	PRTDIR pDir;
+	RTDIRENTRY DirEntry;
+	const char *p;
+	int rc;
+#endif
+
+	char fname[PATH_MAX];
+	dtrace_prog_t *pgp;
+	FILE *fp;
+	void *rv;
+	dt_lib_depend_t *dld;
+
+#ifndef VBOX
+	if ((dirp = opendir(path)) == NULL) {
+		dt_dprintf("skipping lib dir %s: %s\n", path, strerror(errno));
+		return (0);
+	}
+#else
+	rc = RTDirOpen(&pDir, path);
+	if (RT_FAILURE(rc)) {
+		dt_dprintf("skipping lib dir %s: %s\n", path, RTErrGetShort(rc));
+		return (0);
+	}
+#endif
+
+	/* First, parse each file for library dependencies. */
+#ifndef VBOX
+	while ((dp = readdir(dirp)) != NULL) {
+#else
+	while (RT_SUCCESS(RTDirRead(pDir, &DirEntry, 0))) {
+		struct FakeDirEntry {
+			const char *d_name;
+		} FakeDirEntry = { DirEntry.szName }, *dp = &FakeDirEntry;
+#endif
+		if ((p = strrchr(dp->d_name, '.')) == NULL || strcmp(p, ".d"))
+			continue; /* skip any filename not ending in .d */
+
+		(void) snprintf(fname, sizeof (fname),
+		    "%s/%s", path, dp->d_name);
+
+		if ((fp = fopen(fname, "r")) == NULL) {
+			dt_dprintf("skipping library %s: %s\n",
+			    fname, strerror(errno));
+			continue;
+		}
+
+		dtp->dt_filetag = fname;
+		if (dt_lib_depend_add(dtp, &dtp->dt_lib_dep, fname) != 0)
+			goto err;
+
+		rv = dt_compile(dtp, DT_CTX_DPROG,
+		    DTRACE_PROBESPEC_NAME, NULL,
+		    DTRACE_C_EMPTY | DTRACE_C_CTL, 0, NULL, fp, NULL);
+
+		if (rv != NULL && dtp->dt_errno &&
+		    (dtp->dt_errno != EDT_COMPILER ||
+		    dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND)))
+			goto err;
+
+		if (dtp->dt_errno)
+			dt_dprintf("error parsing library %s: %s\n",
+			    fname, dtrace_errmsg(dtp, dtrace_errno(dtp)));
+
+		(void) fclose(fp);
+		dtp->dt_filetag = NULL;
+	}
+
+#ifndef VBOX
+	(void) closedir(dirp);
+#else
+	RTDirClose(pDir);
+#endif
+	/*
+	 * Finish building the graph containing the library dependencies
+	 * and perform a topological sort to generate an ordered list
+	 * for compilation.
+	 */
+	if (dt_lib_depend_sort(dtp) == -1)
+		goto err;
+
+	for (dld = dt_list_next(&dtp->dt_lib_dep_sorted); dld != NULL;
+	    dld = dt_list_next(dld)) {
+
+		if ((fp = fopen(dld->dtld_library, "r")) == NULL) {
+			dt_dprintf("skipping library %s: %s\n",
+			    dld->dtld_library, strerror(errno));
+			continue;
+		}
+
+		dtp->dt_filetag = dld->dtld_library;
+		pgp = dtrace_program_fcompile(dtp, fp, DTRACE_C_EMPTY, 0, NULL);
+		(void) fclose(fp);
+		dtp->dt_filetag = NULL;
+
+		if (pgp == NULL && (dtp->dt_errno != EDT_COMPILER ||
+		    dtp->dt_errtag != dt_errtag(D_PRAGMA_DEPEND)))
+			goto err;
+
+		if (pgp == NULL) {
+			dt_dprintf("skipping library %s: %s\n",
+			    dld->dtld_library,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		} else {
+			dld->dtld_loaded = B_TRUE;
+			dt_program_destroy(dtp, pgp);
+		}
+	}
+
+	dt_lib_depend_free(dtp);
+	return (0);
+
+err:
+	dt_lib_depend_free(dtp);
+	return (-1); /* preserve dt_errno */
+}
+
+/*
+ * Load the contents of any appropriate DTrace .d library files.  These files
+ * contain inlines and translators that will be cached by the compiler.  We
+ * defer this activity until the first compile to permit libdtrace clients to
+ * add their own library directories and so that we can properly report errors.
+ */
+static int
+dt_load_libs(dtrace_hdl_t *dtp)
+{
+	dt_dirpath_t *dirp;
+
+	if (dtp->dt_cflags & DTRACE_C_NOLIBS)
+		return (0); /* libraries already processed */
+
+	dtp->dt_cflags |= DTRACE_C_NOLIBS;
+
+	for (dirp = dt_list_next(&dtp->dt_lib_path);
+	    dirp != NULL; dirp = dt_list_next(dirp)) {
+		if (dt_load_libs_dir(dtp, dirp->dir_path) != 0) {
+			dtp->dt_cflags &= ~DTRACE_C_NOLIBS;
+			return (-1); /* errno is set for us */
+		}
+	}
+
+	return (0);
+}
+
+static void *
+dt_compile(dtrace_hdl_t *dtp, int context, dtrace_probespec_t pspec, void *arg,
+    uint_t cflags, int argc, char *const argv[], FILE *fp, const char *s)
+{
+	dt_node_t *dnp;
+	dt_decl_t *ddp;
+	dt_pcb_t pcb;
+	void *rv;
+	int err;
+
+	if ((fp == NULL && s == NULL) || (cflags & ~DTRACE_C_MASK) != 0) {
+		(void) dt_set_errno(dtp, EINVAL);
+		return (NULL);
+	}
+
+	if (dt_list_next(&dtp->dt_lib_path) != NULL && dt_load_libs(dtp) != 0)
+		return (NULL); /* errno is set for us */
+
+	if (dtp->dt_globals->dh_nelems != 0)
+		(void) dt_idhash_iter(dtp->dt_globals, dt_idreset, NULL);
+
+	if (dtp->dt_tls->dh_nelems != 0)
+		(void) dt_idhash_iter(dtp->dt_tls, dt_idreset, NULL);
+
+	if (fp && (cflags & DTRACE_C_CPP) && (fp = dt_preproc(dtp, fp)) == NULL)
+		return (NULL); /* errno is set for us */
+
+	dt_pcb_push(dtp, &pcb);
+
+	pcb.pcb_fileptr = fp;
+	pcb.pcb_string = s;
+	pcb.pcb_strptr = s;
+	pcb.pcb_strlen = s ? strlen(s) : 0;
+	pcb.pcb_sargc = argc;
+	pcb.pcb_sargv = argv;
+	pcb.pcb_sflagv = argc ? calloc(argc, sizeof (ushort_t)) : NULL;
+	pcb.pcb_pspec = pspec;
+	pcb.pcb_cflags = dtp->dt_cflags | cflags;
+	pcb.pcb_amin = dtp->dt_amin;
+	pcb.pcb_yystate = -1;
+	pcb.pcb_context = context;
+	pcb.pcb_token = context;
+
+#ifdef USING_FLEX /* In case flex starts work too early. Moved from dt_pcb_push. */
+	yyinit(&pcb);
+#endif
+	if (context != DT_CTX_DPROG)
+		yybegin(YYS_EXPR);
+	else if (cflags & DTRACE_C_CTL)
+		yybegin(YYS_CONTROL);
+	else
+		yybegin(YYS_CLAUSE);
+
+	if ((err = setjmp(yypcb->pcb_jmpbuf)) != 0)
+		goto out;
+
+	if (yypcb->pcb_sargc != 0 && yypcb->pcb_sflagv == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	yypcb->pcb_idents = dt_idhash_create("ambiguous", NULL, 0, 0);
+	yypcb->pcb_locals = dt_idhash_create("clause local", NULL,
+	    DIF_VAR_OTHER_UBASE, DIF_VAR_OTHER_MAX);
+
+	if (yypcb->pcb_idents == NULL || yypcb->pcb_locals == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	/*
+	 * Invoke the parser to evaluate the D source code.  If any errors
+	 * occur during parsing, an error function will be called and we
+	 * will longjmp back to pcb_jmpbuf to abort.  If parsing succeeds,
+	 * we optionally display the parse tree if debugging is enabled.
+	 */
+	if (yyparse() != 0 || yypcb->pcb_root == NULL)
+		xyerror(D_EMPTY, "empty D program translation unit\n");
+
+	yybegin(YYS_DONE);
+
+	if (cflags & DTRACE_C_CTL)
+		goto out;
+
+	if (context != DT_CTX_DTYPE && DT_TREEDUMP_PASS(dtp, 1))
+		dt_node_printr(yypcb->pcb_root, stderr, 0);
+
+	if (yypcb->pcb_pragmas != NULL)
+		(void) dt_idhash_iter(yypcb->pcb_pragmas, dt_idpragma, NULL);
+
+	if (argc > 1 && !(yypcb->pcb_cflags & DTRACE_C_ARGREF) &&
+	    !(yypcb->pcb_sflagv[argc - 1] & DT_IDFLG_REF)) {
+		xyerror(D_MACRO_UNUSED, "extraneous argument '%s' ($%d is "
+		    "not referenced)\n", yypcb->pcb_sargv[argc - 1], argc - 1);
+	}
+
+	/*
+	 * If we have successfully created a parse tree for a D program, loop
+	 * over the clauses and actions and instantiate the corresponding
+	 * libdtrace program.  If we are parsing a D expression, then we
+	 * simply run the code generator and assembler on the resulting tree.
+	 */
+	switch (context) {
+	case DT_CTX_DPROG:
+		assert(yypcb->pcb_root->dn_kind == DT_NODE_PROG);
+
+		if ((dnp = yypcb->pcb_root->dn_list) == NULL &&
+		    !(yypcb->pcb_cflags & DTRACE_C_EMPTY))
+			xyerror(D_EMPTY, "empty D program translation unit\n");
+
+		if ((yypcb->pcb_prog = dt_program_create(dtp)) == NULL)
+			longjmp(yypcb->pcb_jmpbuf, dtrace_errno(dtp));
+
+		for (; dnp != NULL; dnp = dnp->dn_list) {
+			switch (dnp->dn_kind) {
+			case DT_NODE_CLAUSE:
+				dt_compile_clause(dtp, dnp);
+				break;
+			case DT_NODE_XLATOR:
+				if (dtp->dt_xlatemode == DT_XL_DYNAMIC)
+					dt_compile_xlator(dnp);
+				break;
+			case DT_NODE_PROVIDER:
+				(void) dt_node_cook(dnp, DT_IDFLG_REF);
+				break;
+			}
+		}
+
+		yypcb->pcb_prog->dp_xrefs = yypcb->pcb_asxrefs;
+		yypcb->pcb_prog->dp_xrefslen = yypcb->pcb_asxreflen;
+		yypcb->pcb_asxrefs = NULL;
+		yypcb->pcb_asxreflen = 0;
+
+		rv = yypcb->pcb_prog;
+		break;
+
+	case DT_CTX_DEXPR:
+		(void) dt_node_cook(yypcb->pcb_root, DT_IDFLG_REF);
+		dt_cg(yypcb, yypcb->pcb_root);
+		rv = dt_as(yypcb);
+		break;
+
+	case DT_CTX_DTYPE:
+		ddp = (dt_decl_t *)yypcb->pcb_root; /* root is really a decl */
+		err = dt_decl_type(ddp, arg);
+		dt_decl_free(ddp);
+
+		if (err != 0)
+			longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+
+		rv = NULL;
+		break;
+	}
+
+out:
+	if (context != DT_CTX_DTYPE && DT_TREEDUMP_PASS(dtp, 3))
+		dt_node_printr(yypcb->pcb_root, stderr, 0);
+
+	if (dtp->dt_cdefs_fd != -1 && (ftruncate64(dtp->dt_cdefs_fd, 0) == -1 ||
+	    lseek64(dtp->dt_cdefs_fd, 0, SEEK_SET) == -1 ||
+	    ctf_write(dtp->dt_cdefs->dm_ctfp, dtp->dt_cdefs_fd) == CTF_ERR))
+		dt_dprintf("failed to update CTF cache: %s\n", strerror(errno));
+
+	if (dtp->dt_ddefs_fd != -1 && (ftruncate64(dtp->dt_ddefs_fd, 0) == -1 ||
+	    lseek64(dtp->dt_ddefs_fd, 0, SEEK_SET) == -1 ||
+	    ctf_write(dtp->dt_ddefs->dm_ctfp, dtp->dt_ddefs_fd) == CTF_ERR))
+		dt_dprintf("failed to update CTF cache: %s\n", strerror(errno));
+
+	if (yypcb->pcb_fileptr && (cflags & DTRACE_C_CPP))
+		(void) fclose(yypcb->pcb_fileptr); /* close dt_preproc() file */
+
+	dt_pcb_pop(dtp, err);
+	(void) dt_set_errno(dtp, err);
+	return (err ? NULL : rv);
+}
+
+dtrace_prog_t *
+dtrace_program_strcompile(dtrace_hdl_t *dtp, const char *s,
+    dtrace_probespec_t spec, uint_t cflags, int argc, char *const argv[])
+{
+	return (dt_compile(dtp, DT_CTX_DPROG,
+	    spec, NULL, cflags, argc, argv, NULL, s));
+}
+
+dtrace_prog_t *
+dtrace_program_fcompile(dtrace_hdl_t *dtp, FILE *fp,
+    uint_t cflags, int argc, char *const argv[])
+{
+	return (dt_compile(dtp, DT_CTX_DPROG,
+	    DTRACE_PROBESPEC_NAME, NULL, cflags, argc, argv, fp, NULL));
+}
+
+int
+dtrace_type_strcompile(dtrace_hdl_t *dtp, const char *s, dtrace_typeinfo_t *dtt)
+{
+	(void) dt_compile(dtp, DT_CTX_DTYPE,
+	    DTRACE_PROBESPEC_NONE, dtt, 0, 0, NULL, NULL, s);
+	return (dtp->dt_errno ? -1 : 0);
+}
+
+int
+dtrace_type_fcompile(dtrace_hdl_t *dtp, FILE *fp, dtrace_typeinfo_t *dtt)
+{
+	(void) dt_compile(dtp, DT_CTX_DTYPE,
+	    DTRACE_PROBESPEC_NONE, dtt, 0, 0, NULL, fp, NULL);
+	return (dtp->dt_errno ? -1 : 0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_cg.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_cg.c
new file mode 100644
index 0000000..d56bf44
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_cg.c
@@ -0,0 +1,1973 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#include <sys/sysmacros.h>
+#include <sys/isa_defs.h>
+
+#include <strings.h>
+#include <stdlib.h>
+#include <setjmp.h>
+#include <assert.h>
+#include <errno.h>
+#else  /* VBOX */
+#endif /* VBOX */
+
+#include <dt_impl.h>
+#include <dt_grammar.h>
+#include <dt_parser.h>
+#include <dt_provider.h>
+
+static void dt_cg_node(dt_node_t *, dt_irlist_t *, dt_regset_t *);
+
+static dt_irnode_t *
+dt_cg_node_alloc(uint_t label, dif_instr_t instr)
+{
+	dt_irnode_t *dip = malloc(sizeof (dt_irnode_t));
+
+	if (dip == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dip->di_label = label;
+	dip->di_instr = instr;
+	dip->di_extern = NULL;
+	dip->di_next = NULL;
+
+	return (dip);
+}
+
+/*
+ * Code generator wrapper function for ctf_member_info.  If we are given a
+ * reference to a forward declaration tag, search the entire type space for
+ * the actual definition and then call ctf_member_info on the result.
+ */
+static ctf_file_t *
+dt_cg_membinfo(ctf_file_t *fp, ctf_id_t type, const char *s, ctf_membinfo_t *mp)
+{
+	while (ctf_type_kind(fp, type) == CTF_K_FORWARD) {
+		char n[DT_TYPE_NAMELEN];
+		dtrace_typeinfo_t dtt;
+
+		if (ctf_type_name(fp, type, n, sizeof (n)) == NULL ||
+		    dt_type_lookup(n, &dtt) == -1 || (
+		    dtt.dtt_ctfp == fp && dtt.dtt_type == type))
+			break; /* unable to improve our position */
+
+		fp = dtt.dtt_ctfp;
+		type = ctf_type_resolve(fp, dtt.dtt_type);
+	}
+
+	if (ctf_member_info(fp, type, s, mp) == CTF_ERR)
+		return (NULL); /* ctf_errno is set for us */
+
+	return (fp);
+}
+
+static void
+dt_cg_xsetx(dt_irlist_t *dlp, dt_ident_t *idp, uint_t lbl, int reg, uint64_t x)
+{
+	int flag = idp != NULL ? DT_INT_PRIVATE : DT_INT_SHARED;
+	int intoff = dt_inttab_insert(yypcb->pcb_inttab, x, flag);
+	dif_instr_t instr = DIF_INSTR_SETX((uint_t)intoff, reg);
+
+	if (intoff == -1)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	if (intoff > DIF_INTOFF_MAX)
+		longjmp(yypcb->pcb_jmpbuf, EDT_INT2BIG);
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl, instr));
+
+	if (idp != NULL)
+		dlp->dl_last->di_extern = idp;
+}
+
+static void
+dt_cg_setx(dt_irlist_t *dlp, int reg, uint64_t x)
+{
+	dt_cg_xsetx(dlp, NULL, DT_LBL_NONE, reg, x);
+}
+
+/*
+ * When loading bit-fields, we want to convert a byte count in the range
+ * 1-8 to the closest power of 2 (e.g. 3->4, 5->8, etc).  The clp2() function
+ * is a clever implementation from "Hacker's Delight" by Henry Warren, Jr.
+ */
+static size_t
+clp2(size_t x)
+{
+	x--;
+
+	x |= (x >> 1);
+	x |= (x >> 2);
+	x |= (x >> 4);
+	x |= (x >> 8);
+	x |= (x >> 16);
+
+	return (x + 1);
+}
+
+/*
+ * Lookup the correct load opcode to use for the specified node and CTF type.
+ * We determine the size and convert it to a 3-bit index.  Our lookup table
+ * is constructed to use a 5-bit index, consisting of the 3-bit size 0-7, a
+ * bit for the sign, and a bit for userland address.  For example, a 4-byte
+ * signed load from userland would be at the following table index:
+ * user=1 sign=1 size=4 => binary index 11011 = decimal index 27
+ */
+static uint_t
+dt_cg_load(dt_node_t *dnp, ctf_file_t *ctfp, ctf_id_t type)
+{
+	static const uint_t ops[] = {
+		DIF_OP_LDUB,	DIF_OP_LDUH,	0,	DIF_OP_LDUW,
+		0,		0,		0,	DIF_OP_LDX,
+		DIF_OP_LDSB,	DIF_OP_LDSH,	0,	DIF_OP_LDSW,
+		0,		0,		0,	DIF_OP_LDX,
+		DIF_OP_ULDUB,	DIF_OP_ULDUH,	0,	DIF_OP_ULDUW,
+		0,		0,		0,	DIF_OP_ULDX,
+		DIF_OP_ULDSB,	DIF_OP_ULDSH,	0,	DIF_OP_ULDSW,
+		0,		0,		0,	DIF_OP_ULDX,
+	};
+
+	ctf_encoding_t e;
+	ssize_t size;
+
+	/*
+	 * If we're loading a bit-field, the size of our load is found by
+	 * rounding cte_bits up to a byte boundary and then finding the
+	 * nearest power of two to this value (see clp2(), above).
+	 */
+	if ((dnp->dn_flags & DT_NF_BITFIELD) &&
+	    ctf_type_encoding(ctfp, type, &e) != CTF_ERR)
+		size = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY);
+	else
+		size = ctf_type_size(ctfp, type);
+
+	if (size < 1 || size > 8 || (size & (size - 1)) != 0) {
+		xyerror(D_UNKNOWN, "internal error -- cg cannot load "
+		    "size %ld when passed by value\n", (long)size);
+	}
+
+	size--; /* convert size to 3-bit index */
+
+	if (dnp->dn_flags & DT_NF_SIGNED)
+		size |= 0x08;
+	if (dnp->dn_flags & DT_NF_USERLAND)
+		size |= 0x10;
+
+	return (ops[size]);
+}
+
+static void
+dt_cg_ptrsize(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp,
+    uint_t op, int dreg)
+{
+	ctf_file_t *ctfp = dnp->dn_ctfp;
+	ctf_arinfo_t r;
+	dif_instr_t instr;
+	ctf_id_t type;
+	uint_t kind;
+	ssize_t size;
+	int sreg;
+
+	if ((sreg = dt_regset_alloc(drp)) == -1)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+	type = ctf_type_resolve(ctfp, dnp->dn_type);
+	kind = ctf_type_kind(ctfp, type);
+	assert(kind == CTF_K_POINTER || kind == CTF_K_ARRAY);
+
+	if (kind == CTF_K_ARRAY) {
+		if (ctf_array_info(ctfp, type, &r) != 0) {
+			yypcb->pcb_hdl->dt_ctferr = ctf_errno(ctfp);
+			longjmp(yypcb->pcb_jmpbuf, EDT_CTF);
+		}
+		type = r.ctr_contents;
+	} else
+		type = ctf_type_reference(ctfp, type);
+
+	if ((size = ctf_type_size(ctfp, type)) == 1)
+		return; /* multiply or divide by one can be omitted */
+
+	dt_cg_setx(dlp, sreg, size);
+	instr = DIF_INSTR_FMT(op, dreg, sreg, dreg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_regset_free(drp, sreg);
+}
+
+/*
+ * If the result of a "." or "->" operation is a bit-field, we use this routine
+ * to generate an epilogue to the load instruction that extracts the value.  In
+ * the diagrams below the "ld??" is the load instruction that is generated to
+ * load the containing word that is generating prior to calling this function.
+ *
+ * Epilogue for unsigned fields:	Epilogue for signed fields:
+ *
+ * ldu?	[r1], r1			lds? [r1], r1
+ * setx	USHIFT, r2			setx 64 - SSHIFT, r2
+ * srl	r1, r2, r1			sll  r1, r2, r1
+ * setx	(1 << bits) - 1, r2		setx 64 - bits, r2
+ * and	r1, r2, r1			sra  r1, r2, r1
+ *
+ * The *SHIFT constants above changes value depending on the endian-ness of our
+ * target architecture.  Refer to the comments below for more details.
+ */
+static void
+dt_cg_field_get(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp,
+    ctf_file_t *fp, const ctf_membinfo_t *mp)
+{
+	ctf_encoding_t e;
+	dif_instr_t instr;
+	uint64_t shift;
+	int r1, r2;
+
+	if (ctf_type_encoding(fp, mp->ctm_type, &e) != 0 || e.cte_bits > 64) {
+		xyerror(D_UNKNOWN, "cg: bad field: off %lu type <%ld> "
+		    "bits %u\n", mp->ctm_offset, mp->ctm_type, e.cte_bits);
+	}
+
+	assert(dnp->dn_op == DT_TOK_PTR || dnp->dn_op == DT_TOK_DOT);
+	r1 = dnp->dn_left->dn_reg;
+
+	if ((r2 = dt_regset_alloc(drp)) == -1)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+	/*
+	 * On little-endian architectures, ctm_offset counts from the right so
+	 * ctm_offset % NBBY itself is the amount we want to shift right to
+	 * move the value bits to the little end of the register to mask them.
+	 * On big-endian architectures, ctm_offset counts from the left so we
+	 * must subtract (ctm_offset % NBBY + cte_bits) from the size in bits
+	 * we used for the load.  The size of our load in turn is found by
+	 * rounding cte_bits up to a byte boundary and then finding the
+	 * nearest power of two to this value (see clp2(), above).  These
+	 * properties are used to compute shift as USHIFT or SSHIFT, below.
+	 */
+	if (dnp->dn_flags & DT_NF_SIGNED) {
+#ifdef _BIG_ENDIAN
+		shift = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY) * NBBY -
+		    mp->ctm_offset % NBBY;
+#else
+		shift = mp->ctm_offset % NBBY + e.cte_bits;
+#endif
+		dt_cg_setx(dlp, r2, 64 - shift);
+		instr = DIF_INSTR_FMT(DIF_OP_SLL, r1, r2, r1);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		dt_cg_setx(dlp, r2, 64 - e.cte_bits);
+		instr = DIF_INSTR_FMT(DIF_OP_SRA, r1, r2, r1);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	} else {
+#ifdef _BIG_ENDIAN
+		shift = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY) * NBBY -
+		    (mp->ctm_offset % NBBY + e.cte_bits);
+#else
+		shift = mp->ctm_offset % NBBY;
+#endif
+		dt_cg_setx(dlp, r2, shift);
+		instr = DIF_INSTR_FMT(DIF_OP_SRL, r1, r2, r1);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		dt_cg_setx(dlp, r2, (1ULL << e.cte_bits) - 1);
+		instr = DIF_INSTR_FMT(DIF_OP_AND, r1, r2, r1);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	}
+
+	dt_regset_free(drp, r2);
+}
+
+/*
+ * If the destination of a store operation is a bit-field, we use this routine
+ * to generate a prologue to the store instruction that loads the surrounding
+ * bits, clears the destination field, and ORs in the new value of the field.
+ * In the diagram below the "st?" is the store instruction that is generated to
+ * store the containing word that is generating after calling this function.
+ *
+ * ld	[dst->dn_reg], r1
+ * setx	~(((1 << cte_bits) - 1) << (ctm_offset % NBBY)), r2
+ * and	r1, r2, r1
+ *
+ * setx	(1 << cte_bits) - 1, r2
+ * and	src->dn_reg, r2, r2
+ * setx ctm_offset % NBBY, r3
+ * sll	r2, r3, r2
+ *
+ * or	r1, r2, r1
+ * st?	r1, [dst->dn_reg]
+ *
+ * This routine allocates a new register to hold the value to be stored and
+ * returns it.  The caller is responsible for freeing this register later.
+ */
+static int
+dt_cg_field_set(dt_node_t *src, dt_irlist_t *dlp,
+    dt_regset_t *drp, dt_node_t *dst)
+{
+	uint64_t cmask, fmask, shift;
+	dif_instr_t instr;
+	int r1, r2, r3;
+
+	ctf_membinfo_t m;
+	ctf_encoding_t e;
+	ctf_file_t *fp, *ofp;
+	ctf_id_t type;
+
+	assert(dst->dn_op == DT_TOK_PTR || dst->dn_op == DT_TOK_DOT);
+	assert(dst->dn_right->dn_kind == DT_NODE_IDENT);
+
+	fp = dst->dn_left->dn_ctfp;
+	type = ctf_type_resolve(fp, dst->dn_left->dn_type);
+
+	if (dst->dn_op == DT_TOK_PTR) {
+		type = ctf_type_reference(fp, type);
+		type = ctf_type_resolve(fp, type);
+	}
+
+	if ((fp = dt_cg_membinfo(ofp = fp, type,
+	    dst->dn_right->dn_string, &m)) == NULL) {
+		yypcb->pcb_hdl->dt_ctferr = ctf_errno(ofp);
+		longjmp(yypcb->pcb_jmpbuf, EDT_CTF);
+	}
+
+	if (ctf_type_encoding(fp, m.ctm_type, &e) != 0 || e.cte_bits > 64) {
+		xyerror(D_UNKNOWN, "cg: bad field: off %lu type <%ld> "
+		    "bits %u\n", m.ctm_offset, m.ctm_type, e.cte_bits);
+	}
+
+	if ((r1 = dt_regset_alloc(drp)) == -1 ||
+	    (r2 = dt_regset_alloc(drp)) == -1 ||
+	    (r3 = dt_regset_alloc(drp)) == -1)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+	/*
+	 * Compute shifts and masks.  We need to compute "shift" as the amount
+	 * we need to shift left to position our field in the containing word.
+	 * Refer to the comments in dt_cg_field_get(), above, for more info.
+	 * We then compute fmask as the mask that truncates the value in the
+	 * input register to width cte_bits, and cmask as the mask used to
+	 * pass through the containing bits and zero the field bits.
+	 */
+#ifdef _BIG_ENDIAN
+	shift = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY) * NBBY -
+	    (m.ctm_offset % NBBY + e.cte_bits);
+#else
+	shift = m.ctm_offset % NBBY;
+#endif
+	fmask = (1ULL << e.cte_bits) - 1;
+	cmask = ~(fmask << shift);
+
+	instr = DIF_INSTR_LOAD(
+	    dt_cg_load(dst, fp, m.ctm_type), dst->dn_reg, r1);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_setx(dlp, r2, cmask);
+	instr = DIF_INSTR_FMT(DIF_OP_AND, r1, r2, r1);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_setx(dlp, r2, fmask);
+	instr = DIF_INSTR_FMT(DIF_OP_AND, src->dn_reg, r2, r2);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_setx(dlp, r3, shift);
+	instr = DIF_INSTR_FMT(DIF_OP_SLL, r2, r3, r2);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_FMT(DIF_OP_OR, r1, r2, r1);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_regset_free(drp, r3);
+	dt_regset_free(drp, r2);
+
+	return (r1);
+}
+
+static void
+dt_cg_store(dt_node_t *src, dt_irlist_t *dlp, dt_regset_t *drp, dt_node_t *dst)
+{
+	ctf_encoding_t e;
+	dif_instr_t instr;
+	size_t size;
+	int reg;
+
+	/*
+	 * If we're loading a bit-field, the size of our store is found by
+	 * rounding dst's cte_bits up to a byte boundary and then finding the
+	 * nearest power of two to this value (see clp2(), above).
+	 */
+	if ((dst->dn_flags & DT_NF_BITFIELD) &&
+	    ctf_type_encoding(dst->dn_ctfp, dst->dn_type, &e) != CTF_ERR)
+		size = clp2(P2ROUNDUP(e.cte_bits, NBBY) / NBBY);
+	else
+		size = dt_node_type_size(src);
+
+	if (src->dn_flags & DT_NF_REF) {
+		if ((reg = dt_regset_alloc(drp)) == -1)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+		dt_cg_setx(dlp, reg, size);
+		instr = DIF_INSTR_COPYS(src->dn_reg, reg, dst->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		dt_regset_free(drp, reg);
+	} else {
+		if (dst->dn_flags & DT_NF_BITFIELD)
+			reg = dt_cg_field_set(src, dlp, drp, dst);
+		else
+			reg = src->dn_reg;
+
+		switch (size) {
+		case 1:
+			instr = DIF_INSTR_STORE(DIF_OP_STB, reg, dst->dn_reg);
+			break;
+		case 2:
+			instr = DIF_INSTR_STORE(DIF_OP_STH, reg, dst->dn_reg);
+			break;
+		case 4:
+			instr = DIF_INSTR_STORE(DIF_OP_STW, reg, dst->dn_reg);
+			break;
+		case 8:
+			instr = DIF_INSTR_STORE(DIF_OP_STX, reg, dst->dn_reg);
+			break;
+		default:
+			xyerror(D_UNKNOWN, "internal error -- cg cannot store "
+			    "size %lu when passed by value\n", (ulong_t)size);
+		}
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		if (dst->dn_flags & DT_NF_BITFIELD)
+			dt_regset_free(drp, reg);
+	}
+}
+
+/*
+ * Generate code for a typecast or for argument promotion from the type of the
+ * actual to the type of the formal.  We need to generate code for casts when
+ * a scalar type is being narrowed or changing signed-ness.  We first shift the
+ * desired bits high (losing excess bits if narrowing) and then shift them down
+ * using logical shift (unsigned result) or arithmetic shift (signed result).
+ */
+static void
+dt_cg_typecast(const dt_node_t *src, const dt_node_t *dst,
+    dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	size_t srcsize = dt_node_type_size(src);
+	size_t dstsize = dt_node_type_size(dst);
+
+	dif_instr_t instr;
+#ifndef VBOX
+	int reg, n;
+#else
+	int reg;
+	uint64_t n;
+#endif
+
+	if (dt_node_is_scalar(dst) && (dstsize < srcsize ||
+	    (src->dn_flags & DT_NF_SIGNED) ^ (dst->dn_flags & DT_NF_SIGNED))) {
+		if ((reg = dt_regset_alloc(drp)) == -1)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+		if (dstsize < srcsize)
+			n = sizeof (uint64_t) * NBBY - dstsize * NBBY;
+		else
+			n = sizeof (uint64_t) * NBBY - srcsize * NBBY;
+
+		dt_cg_setx(dlp, reg, n);
+
+		instr = DIF_INSTR_FMT(DIF_OP_SLL,
+		    src->dn_reg, reg, dst->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		instr = DIF_INSTR_FMT((dst->dn_flags & DT_NF_SIGNED) ?
+		    DIF_OP_SRA : DIF_OP_SRL, dst->dn_reg, reg, dst->dn_reg);
+
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		dt_regset_free(drp, reg);
+	}
+}
+
+/*
+ * Generate code to push the specified argument list on to the tuple stack.
+ * We use this routine for handling subroutine calls and associative arrays.
+ * We must first generate code for all subexpressions before loading the stack
+ * because any subexpression could itself require the use of the tuple stack.
+ * This holds a number of registers equal to the number of arguments, but this
+ * is not a huge problem because the number of arguments can't exceed the
+ * number of tuple register stack elements anyway.  At most one extra register
+ * is required (either by dt_cg_typecast() or for dtdt_size, below).  This
+ * implies that a DIF implementation should offer a number of general purpose
+ * registers at least one greater than the number of tuple registers.
+ */
+static void
+dt_cg_arglist(dt_ident_t *idp, dt_node_t *args,
+    dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	const dt_idsig_t *isp = idp->di_data;
+	dt_node_t *dnp;
+	VBDTTYPE(uint_t,int) i = 0;
+
+	for (dnp = args; dnp != NULL; dnp = dnp->dn_list)
+		dt_cg_node(dnp, dlp, drp);
+
+	dt_irlist_append(dlp,
+	    dt_cg_node_alloc(DT_LBL_NONE, DIF_INSTR_FLUSHTS));
+
+	for (dnp = args; dnp != NULL; dnp = dnp->dn_list, i++) {
+		dtrace_diftype_t t;
+		dif_instr_t instr;
+		uint_t op;
+		int reg;
+
+		dt_node_diftype(yypcb->pcb_hdl, dnp, &t);
+
+		isp->dis_args[i].dn_reg = dnp->dn_reg; /* re-use register */
+		dt_cg_typecast(dnp, &isp->dis_args[i], dlp, drp);
+		isp->dis_args[i].dn_reg = -1;
+
+		if (t.dtdt_flags & DIF_TF_BYREF)
+			op = DIF_OP_PUSHTR;
+		else
+			op = DIF_OP_PUSHTV;
+
+		if (t.dtdt_size != 0) {
+			if ((reg = dt_regset_alloc(drp)) == -1)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+			dt_cg_setx(dlp, reg, t.dtdt_size);
+		} else
+			reg = DIF_REG_R0;
+
+		instr = DIF_INSTR_PUSHTS(op, t.dtdt_kind, reg, dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		dt_regset_free(drp, dnp->dn_reg);
+
+		if (reg != DIF_REG_R0)
+			dt_regset_free(drp, reg);
+	}
+
+	if (i > yypcb->pcb_hdl->dt_conf.dtc_diftupregs)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOTUPREG);
+}
+
+static void
+dt_cg_arithmetic_op(dt_node_t *dnp, dt_irlist_t *dlp,
+    dt_regset_t *drp, uint_t op)
+{
+	int is_ptr_op = (dnp->dn_op == DT_TOK_ADD || dnp->dn_op == DT_TOK_SUB ||
+	    dnp->dn_op == DT_TOK_ADD_EQ || dnp->dn_op == DT_TOK_SUB_EQ);
+
+	int lp_is_ptr = dt_node_is_pointer(dnp->dn_left);
+	int rp_is_ptr = dt_node_is_pointer(dnp->dn_right);
+
+	dif_instr_t instr;
+
+	if (lp_is_ptr && rp_is_ptr) {
+		assert(dnp->dn_op == DT_TOK_SUB);
+		is_ptr_op = 0;
+	}
+
+	dt_cg_node(dnp->dn_left, dlp, drp);
+	if (is_ptr_op && rp_is_ptr)
+		dt_cg_ptrsize(dnp, dlp, drp, DIF_OP_MUL, dnp->dn_left->dn_reg);
+
+	dt_cg_node(dnp->dn_right, dlp, drp);
+	if (is_ptr_op && lp_is_ptr)
+		dt_cg_ptrsize(dnp, dlp, drp, DIF_OP_MUL, dnp->dn_right->dn_reg);
+
+	instr = DIF_INSTR_FMT(op, dnp->dn_left->dn_reg,
+	    dnp->dn_right->dn_reg, dnp->dn_left->dn_reg);
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_regset_free(drp, dnp->dn_right->dn_reg);
+	dnp->dn_reg = dnp->dn_left->dn_reg;
+
+	if (lp_is_ptr && rp_is_ptr)
+		dt_cg_ptrsize(dnp->dn_right,
+		    dlp, drp, DIF_OP_UDIV, dnp->dn_reg);
+}
+
+static uint_t
+dt_cg_stvar(const dt_ident_t *idp)
+{
+	static const uint_t aops[] = { DIF_OP_STGAA, DIF_OP_STTAA, DIF_OP_NOP };
+	static const uint_t sops[] = { DIF_OP_STGS, DIF_OP_STTS, DIF_OP_STLS };
+
+	uint_t i = (((idp->di_flags & DT_IDFLG_LOCAL) != 0) << 1) |
+	    ((idp->di_flags & DT_IDFLG_TLS) != 0);
+
+	return (idp->di_kind == DT_IDENT_ARRAY ? aops[i] : sops[i]);
+}
+
+static void
+dt_cg_prearith_op(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp, uint_t op)
+{
+	ctf_file_t *ctfp = dnp->dn_ctfp;
+	dif_instr_t instr;
+	ctf_id_t type;
+	ssize_t size = 1;
+	int reg;
+
+	if (dt_node_is_pointer(dnp)) {
+		type = ctf_type_resolve(ctfp, dnp->dn_type);
+		assert(ctf_type_kind(ctfp, type) == CTF_K_POINTER);
+		size = ctf_type_size(ctfp, ctf_type_reference(ctfp, type));
+	}
+
+	dt_cg_node(dnp->dn_child, dlp, drp);
+	dnp->dn_reg = dnp->dn_child->dn_reg;
+
+	if ((reg = dt_regset_alloc(drp)) == -1)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+	dt_cg_setx(dlp, reg, size);
+
+	instr = DIF_INSTR_FMT(op, dnp->dn_reg, reg, dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_regset_free(drp, reg);
+
+	/*
+	 * If we are modifying a variable, generate an stv instruction from
+	 * the variable specified by the identifier.  If we are storing to a
+	 * memory address, generate code again for the left-hand side using
+	 * DT_NF_REF to get the address, and then generate a store to it.
+	 * In both paths, we store the value in dnp->dn_reg (the new value).
+	 */
+	if (dnp->dn_child->dn_kind == DT_NODE_VAR) {
+		dt_ident_t *idp = dt_ident_resolve(dnp->dn_child->dn_ident);
+
+		idp->di_flags |= DT_IDFLG_DIFW;
+		instr = DIF_INSTR_STV(dt_cg_stvar(idp),
+		    idp->di_id, dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	} else {
+		uint_t rbit = dnp->dn_child->dn_flags & DT_NF_REF;
+
+		assert(dnp->dn_child->dn_flags & DT_NF_WRITABLE);
+		assert(dnp->dn_child->dn_flags & DT_NF_LVALUE);
+
+		dnp->dn_child->dn_flags |= DT_NF_REF; /* force pass-by-ref */
+		dt_cg_node(dnp->dn_child, dlp, drp);
+
+		dt_cg_store(dnp, dlp, drp, dnp->dn_child);
+		dt_regset_free(drp, dnp->dn_child->dn_reg);
+
+		dnp->dn_left->dn_flags &= ~DT_NF_REF;
+		dnp->dn_left->dn_flags |= rbit;
+	}
+}
+
+static void
+dt_cg_postarith_op(dt_node_t *dnp, dt_irlist_t *dlp,
+    dt_regset_t *drp, uint_t op)
+{
+	ctf_file_t *ctfp = dnp->dn_ctfp;
+	dif_instr_t instr;
+	ctf_id_t type;
+	ssize_t size = 1;
+	int nreg;
+
+	if (dt_node_is_pointer(dnp)) {
+		type = ctf_type_resolve(ctfp, dnp->dn_type);
+		assert(ctf_type_kind(ctfp, type) == CTF_K_POINTER);
+		size = ctf_type_size(ctfp, ctf_type_reference(ctfp, type));
+	}
+
+	dt_cg_node(dnp->dn_child, dlp, drp);
+	dnp->dn_reg = dnp->dn_child->dn_reg;
+
+	if ((nreg = dt_regset_alloc(drp)) == -1)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+	dt_cg_setx(dlp, nreg, size);
+	instr = DIF_INSTR_FMT(op, dnp->dn_reg, nreg, nreg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	/*
+	 * If we are modifying a variable, generate an stv instruction from
+	 * the variable specified by the identifier.  If we are storing to a
+	 * memory address, generate code again for the left-hand side using
+	 * DT_NF_REF to get the address, and then generate a store to it.
+	 * In both paths, we store the value from 'nreg' (the new value).
+	 */
+	if (dnp->dn_child->dn_kind == DT_NODE_VAR) {
+		dt_ident_t *idp = dt_ident_resolve(dnp->dn_child->dn_ident);
+
+		idp->di_flags |= DT_IDFLG_DIFW;
+		instr = DIF_INSTR_STV(dt_cg_stvar(idp), idp->di_id, nreg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	} else {
+		uint_t rbit = dnp->dn_child->dn_flags & DT_NF_REF;
+		int oreg = dnp->dn_reg;
+
+		assert(dnp->dn_child->dn_flags & DT_NF_WRITABLE);
+		assert(dnp->dn_child->dn_flags & DT_NF_LVALUE);
+
+		dnp->dn_child->dn_flags |= DT_NF_REF; /* force pass-by-ref */
+		dt_cg_node(dnp->dn_child, dlp, drp);
+
+		dnp->dn_reg = nreg;
+		dt_cg_store(dnp, dlp, drp, dnp->dn_child);
+		dnp->dn_reg = oreg;
+
+		dt_regset_free(drp, dnp->dn_child->dn_reg);
+		dnp->dn_left->dn_flags &= ~DT_NF_REF;
+		dnp->dn_left->dn_flags |= rbit;
+	}
+
+	dt_regset_free(drp, nreg);
+}
+
+/*
+ * Determine if we should perform signed or unsigned comparison for an OP2.
+ * If both operands are of arithmetic type, perform the usual arithmetic
+ * conversions to determine the common real type for comparison [ISOC 6.5.8.3].
+ */
+static int
+dt_cg_compare_signed(dt_node_t *dnp)
+{
+	dt_node_t dn;
+
+	if (dt_node_is_string(dnp->dn_left) ||
+	    dt_node_is_string(dnp->dn_right))
+		return (1); /* strings always compare signed */
+	else if (!dt_node_is_arith(dnp->dn_left) ||
+	    !dt_node_is_arith(dnp->dn_right))
+		return (0); /* non-arithmetic types always compare unsigned */
+
+	bzero(&dn, sizeof (dn));
+	dt_node_promote(dnp->dn_left, dnp->dn_right, &dn);
+	return (dn.dn_flags & DT_NF_SIGNED);
+}
+
+static void
+dt_cg_compare_op(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp, uint_t op)
+{
+	uint_t lbl_true = dt_irlist_label(dlp);
+	uint_t lbl_post = dt_irlist_label(dlp);
+
+	dif_instr_t instr;
+	uint_t opc;
+
+	dt_cg_node(dnp->dn_left, dlp, drp);
+	dt_cg_node(dnp->dn_right, dlp, drp);
+
+	if (dt_node_is_string(dnp->dn_left) || dt_node_is_string(dnp->dn_right))
+		opc = DIF_OP_SCMP;
+	else
+		opc = DIF_OP_CMP;
+
+	instr = DIF_INSTR_CMP(opc, dnp->dn_left->dn_reg, dnp->dn_right->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_regset_free(drp, dnp->dn_right->dn_reg);
+	dnp->dn_reg = dnp->dn_left->dn_reg;
+
+	instr = DIF_INSTR_BRANCH(op, lbl_true);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_MOV(DIF_REG_R0, dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BA, lbl_post);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_xsetx(dlp, NULL, lbl_true, dnp->dn_reg, 1);
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_post, DIF_INSTR_NOP));
+}
+
+/*
+ * Code generation for the ternary op requires some trickery with the assembler
+ * in order to conserve registers.  We generate code for dn_expr and dn_left
+ * and free their registers so they do not have be consumed across codegen for
+ * dn_right.  We insert a dummy MOV at the end of dn_left into the destination
+ * register, which is not yet known because we haven't done dn_right yet, and
+ * save the pointer to this instruction node.  We then generate code for
+ * dn_right and use its register as our output.  Finally, we reach back and
+ * patch the instruction for dn_left to move its output into this register.
+ */
+static void
+dt_cg_ternary_op(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	uint_t lbl_false = dt_irlist_label(dlp);
+	uint_t lbl_post = dt_irlist_label(dlp);
+
+	dif_instr_t instr;
+	dt_irnode_t *dip;
+
+	dt_cg_node(dnp->dn_expr, dlp, drp);
+	instr = DIF_INSTR_TST(dnp->dn_expr->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_regset_free(drp, dnp->dn_expr->dn_reg);
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BE, lbl_false);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_node(dnp->dn_left, dlp, drp);
+	instr = DIF_INSTR_MOV(dnp->dn_left->dn_reg, DIF_REG_R0);
+	dip = dt_cg_node_alloc(DT_LBL_NONE, instr); /* save dip for below */
+	dt_irlist_append(dlp, dip);
+	dt_regset_free(drp, dnp->dn_left->dn_reg);
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BA, lbl_post);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_false, DIF_INSTR_NOP));
+	dt_cg_node(dnp->dn_right, dlp, drp);
+	dnp->dn_reg = dnp->dn_right->dn_reg;
+
+	/*
+	 * Now that dn_reg is assigned, reach back and patch the correct MOV
+	 * instruction into the tail of dn_left.  We know dn_reg was unused
+	 * at that point because otherwise dn_right couldn't have allocated it.
+	 */
+	dip->di_instr = DIF_INSTR_MOV(dnp->dn_left->dn_reg, dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_post, DIF_INSTR_NOP));
+}
+
+static void
+dt_cg_logical_and(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	uint_t lbl_false = dt_irlist_label(dlp);
+	uint_t lbl_post = dt_irlist_label(dlp);
+
+	dif_instr_t instr;
+
+	dt_cg_node(dnp->dn_left, dlp, drp);
+	instr = DIF_INSTR_TST(dnp->dn_left->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_regset_free(drp, dnp->dn_left->dn_reg);
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BE, lbl_false);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_node(dnp->dn_right, dlp, drp);
+	instr = DIF_INSTR_TST(dnp->dn_right->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dnp->dn_reg = dnp->dn_right->dn_reg;
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BE, lbl_false);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_setx(dlp, dnp->dn_reg, 1);
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BA, lbl_post);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_MOV(DIF_REG_R0, dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_false, instr));
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_post, DIF_INSTR_NOP));
+}
+
+static void
+dt_cg_logical_xor(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	uint_t lbl_next = dt_irlist_label(dlp);
+	uint_t lbl_tail = dt_irlist_label(dlp);
+
+	dif_instr_t instr;
+
+	dt_cg_node(dnp->dn_left, dlp, drp);
+	instr = DIF_INSTR_TST(dnp->dn_left->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BE, lbl_next);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_cg_setx(dlp, dnp->dn_left->dn_reg, 1);
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_next, DIF_INSTR_NOP));
+	dt_cg_node(dnp->dn_right, dlp, drp);
+
+	instr = DIF_INSTR_TST(dnp->dn_right->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BE, lbl_tail);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_cg_setx(dlp, dnp->dn_right->dn_reg, 1);
+
+	instr = DIF_INSTR_FMT(DIF_OP_XOR, dnp->dn_left->dn_reg,
+	    dnp->dn_right->dn_reg, dnp->dn_left->dn_reg);
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_tail, instr));
+
+	dt_regset_free(drp, dnp->dn_right->dn_reg);
+	dnp->dn_reg = dnp->dn_left->dn_reg;
+}
+
+static void
+dt_cg_logical_or(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	uint_t lbl_true = dt_irlist_label(dlp);
+	uint_t lbl_false = dt_irlist_label(dlp);
+	uint_t lbl_post = dt_irlist_label(dlp);
+
+	dif_instr_t instr;
+
+	dt_cg_node(dnp->dn_left, dlp, drp);
+	instr = DIF_INSTR_TST(dnp->dn_left->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_regset_free(drp, dnp->dn_left->dn_reg);
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BNE, lbl_true);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_node(dnp->dn_right, dlp, drp);
+	instr = DIF_INSTR_TST(dnp->dn_right->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dnp->dn_reg = dnp->dn_right->dn_reg;
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BE, lbl_false);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_xsetx(dlp, NULL, lbl_true, dnp->dn_reg, 1);
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BA, lbl_post);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_MOV(DIF_REG_R0, dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_false, instr));
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_post, DIF_INSTR_NOP));
+}
+
+static void
+dt_cg_logical_neg(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	uint_t lbl_zero = dt_irlist_label(dlp);
+	uint_t lbl_post = dt_irlist_label(dlp);
+
+	dif_instr_t instr;
+
+	dt_cg_node(dnp->dn_child, dlp, drp);
+	dnp->dn_reg = dnp->dn_child->dn_reg;
+
+	instr = DIF_INSTR_TST(dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BE, lbl_zero);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_MOV(DIF_REG_R0, dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_BRANCH(DIF_OP_BA, lbl_post);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	dt_cg_xsetx(dlp, NULL, lbl_zero, dnp->dn_reg, 1);
+	dt_irlist_append(dlp, dt_cg_node_alloc(lbl_post, DIF_INSTR_NOP));
+}
+
+static void
+dt_cg_asgn_op(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	dif_instr_t instr;
+	dt_ident_t *idp;
+
+	/*
+	 * If we are performing a structure assignment of a translated type,
+	 * we must instantiate all members and create a snapshot of the object
+	 * in scratch space.  We allocs a chunk of memory, generate code for
+	 * each member, and then set dnp->dn_reg to the scratch object address.
+	 */
+	if ((idp = dt_node_resolve(dnp->dn_right, DT_IDENT_XLSOU)) != NULL) {
+		ctf_membinfo_t ctm;
+		dt_xlator_t *dxp = idp->di_data;
+		dt_node_t *mnp, dn, mn;
+		int r1, r2;
+
+		/*
+		 * Create two fake dt_node_t's representing operator "." and a
+		 * right-hand identifier child node.  These will be repeatedly
+		 * modified according to each instantiated member so that we
+		 * can pass them to dt_cg_store() and effect a member store.
+		 */
+		bzero(&dn, sizeof (dt_node_t));
+		dn.dn_kind = DT_NODE_OP2;
+		dn.dn_op = DT_TOK_DOT;
+		dn.dn_left = dnp;
+		dn.dn_right = &mn;
+
+		bzero(&mn, sizeof (dt_node_t));
+		mn.dn_kind = DT_NODE_IDENT;
+		mn.dn_op = DT_TOK_IDENT;
+
+		/*
+		 * Allocate a register for our scratch data pointer.  First we
+		 * set it to the size of our data structure, and then replace
+		 * it with the result of an allocs of the specified size.
+		 */
+		if ((r1 = dt_regset_alloc(drp)) == -1)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+		dt_cg_setx(dlp, r1,
+		    ctf_type_size(dxp->dx_dst_ctfp, dxp->dx_dst_base));
+
+		instr = DIF_INSTR_ALLOCS(r1, r1);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		/*
+		 * When dt_cg_asgn_op() is called, we have already generated
+		 * code for dnp->dn_right, which is the translator input.  We
+		 * now associate this register with the translator's input
+		 * identifier so it can be referenced during our member loop.
+		 */
+		dxp->dx_ident->di_flags |= DT_IDFLG_CGREG;
+		dxp->dx_ident->di_id = dnp->dn_right->dn_reg;
+
+		for (mnp = dxp->dx_members; mnp != NULL; mnp = mnp->dn_list) {
+			/*
+			 * Generate code for the translator member expression,
+			 * and then cast the result to the member type.
+			 */
+			dt_cg_node(mnp->dn_membexpr, dlp, drp);
+			mnp->dn_reg = mnp->dn_membexpr->dn_reg;
+			dt_cg_typecast(mnp->dn_membexpr, mnp, dlp, drp);
+
+			/*
+			 * Ask CTF for the offset of the member so we can store
+			 * to the appropriate offset.  This call has already
+			 * been done once by the parser, so it should succeed.
+			 */
+			if (ctf_member_info(dxp->dx_dst_ctfp, dxp->dx_dst_base,
+			    mnp->dn_membname, &ctm) == CTF_ERR) {
+				yypcb->pcb_hdl->dt_ctferr =
+				    ctf_errno(dxp->dx_dst_ctfp);
+				longjmp(yypcb->pcb_jmpbuf, EDT_CTF);
+			}
+
+			/*
+			 * If the destination member is at offset 0, store the
+			 * result directly to r1 (the scratch buffer address).
+			 * Otherwise allocate another temporary for the offset
+			 * and add r1 to it before storing the result.
+			 */
+			if (ctm.ctm_offset != 0) {
+				if ((r2 = dt_regset_alloc(drp)) == -1)
+					longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+				/*
+				 * Add the member offset rounded down to the
+				 * nearest byte.  If the offset was not aligned
+				 * on a byte boundary, this member is a bit-
+				 * field and dt_cg_store() will handle masking.
+				 */
+				dt_cg_setx(dlp, r2, ctm.ctm_offset / NBBY);
+				instr = DIF_INSTR_FMT(DIF_OP_ADD, r1, r2, r2);
+				dt_irlist_append(dlp,
+				    dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+				dt_node_type_propagate(mnp, &dn);
+				dn.dn_right->dn_string = mnp->dn_membname;
+				dn.dn_reg = r2;
+
+				dt_cg_store(mnp, dlp, drp, &dn);
+				dt_regset_free(drp, r2);
+
+			} else {
+				dt_node_type_propagate(mnp, &dn);
+				dn.dn_right->dn_string = mnp->dn_membname;
+				dn.dn_reg = r1;
+
+				dt_cg_store(mnp, dlp, drp, &dn);
+			}
+
+			dt_regset_free(drp, mnp->dn_reg);
+		}
+
+		dxp->dx_ident->di_flags &= ~DT_IDFLG_CGREG;
+		dxp->dx_ident->di_id = 0;
+
+		if (dnp->dn_right->dn_reg != -1)
+			dt_regset_free(drp, dnp->dn_right->dn_reg);
+
+		assert(dnp->dn_reg == dnp->dn_right->dn_reg);
+		dnp->dn_reg = r1;
+	}
+
+	/*
+	 * If we are storing to a variable, generate an stv instruction from
+	 * the variable specified by the identifier.  If we are storing to a
+	 * memory address, generate code again for the left-hand side using
+	 * DT_NF_REF to get the address, and then generate a store to it.
+	 * In both paths, we assume dnp->dn_reg already has the new value.
+	 */
+	if (dnp->dn_left->dn_kind == DT_NODE_VAR) {
+		idp = dt_ident_resolve(dnp->dn_left->dn_ident);
+
+		if (idp->di_kind == DT_IDENT_ARRAY)
+			dt_cg_arglist(idp, dnp->dn_left->dn_args, dlp, drp);
+
+		idp->di_flags |= DT_IDFLG_DIFW;
+		instr = DIF_INSTR_STV(dt_cg_stvar(idp),
+		    idp->di_id, dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	} else {
+		uint_t rbit = dnp->dn_left->dn_flags & DT_NF_REF;
+
+		assert(dnp->dn_left->dn_flags & DT_NF_WRITABLE);
+		assert(dnp->dn_left->dn_flags & DT_NF_LVALUE);
+
+		dnp->dn_left->dn_flags |= DT_NF_REF; /* force pass-by-ref */
+
+		dt_cg_node(dnp->dn_left, dlp, drp);
+		dt_cg_store(dnp, dlp, drp, dnp->dn_left);
+		dt_regset_free(drp, dnp->dn_left->dn_reg);
+
+		dnp->dn_left->dn_flags &= ~DT_NF_REF;
+		dnp->dn_left->dn_flags |= rbit;
+	}
+}
+
+static void
+dt_cg_assoc_op(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	dif_instr_t instr;
+	uint_t op;
+
+	assert(dnp->dn_kind == DT_NODE_VAR);
+	assert(!(dnp->dn_ident->di_flags & DT_IDFLG_LOCAL));
+	assert(dnp->dn_args != NULL);
+
+	dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp);
+
+	if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+	if (dnp->dn_ident->di_flags & DT_IDFLG_TLS)
+		op = DIF_OP_LDTAA;
+	else
+		op = DIF_OP_LDGAA;
+
+	dnp->dn_ident->di_flags |= DT_IDFLG_DIFR;
+	instr = DIF_INSTR_LDV(op, dnp->dn_ident->di_id, dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	/*
+	 * If the associative array is a pass-by-reference type, then we are
+	 * loading its value as a pointer to either load or store through it.
+	 * The array element in question may not have been faulted in yet, in
+	 * which case DIF_OP_LD*AA will return zero.  We append an epilogue
+	 * of instructions similar to the following:
+	 *
+	 *	  ld?aa	 id, %r1	! base ld?aa instruction above
+	 *	  tst	 %r1		! start of epilogue
+	 *   +--- bne	 label
+	 *   |    setx	 size, %r1
+	 *   |    allocs %r1, %r1
+	 *   |    st?aa	 id, %r1
+	 *   |    ld?aa	 id, %r1
+	 *   v
+	 * label: < rest of code >
+	 *
+	 * The idea is that we allocs a zero-filled chunk of scratch space and
+	 * do a DIF_OP_ST*AA to fault in and initialize the array element, and
+	 * then reload it to get the faulted-in address of the new variable
+	 * storage.  This isn't cheap, but pass-by-ref associative array values
+	 * are (thus far) uncommon and the allocs cost only occurs once.  If
+	 * this path becomes important to DTrace users, we can improve things
+	 * by adding a new DIF opcode to fault in associative array elements.
+	 */
+	if (dnp->dn_flags & DT_NF_REF) {
+		uint_t stvop = op == DIF_OP_LDTAA ? DIF_OP_STTAA : DIF_OP_STGAA;
+		uint_t label = dt_irlist_label(dlp);
+
+		instr = DIF_INSTR_TST(dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		instr = DIF_INSTR_BRANCH(DIF_OP_BNE, label);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		dt_cg_setx(dlp, dnp->dn_reg, dt_node_type_size(dnp));
+		instr = DIF_INSTR_ALLOCS(dnp->dn_reg, dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		dnp->dn_ident->di_flags |= DT_IDFLG_DIFW;
+		instr = DIF_INSTR_STV(stvop, dnp->dn_ident->di_id, dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		instr = DIF_INSTR_LDV(op, dnp->dn_ident->di_id, dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+		dt_irlist_append(dlp, dt_cg_node_alloc(label, DIF_INSTR_NOP));
+	}
+}
+
+static void
+dt_cg_array_op(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	dt_probe_t *prp = yypcb->pcb_probe;
+	uintmax_t saved = dnp->dn_args->dn_value;
+	dt_ident_t *idp = dnp->dn_ident;
+
+	dif_instr_t instr;
+	uint_t op;
+	size_t size;
+#ifndef VBOX
+	int reg, n;
+#else
+	int reg;
+	uint64_t n;
+#endif
+
+	assert(dnp->dn_kind == DT_NODE_VAR);
+	assert(!(idp->di_flags & DT_IDFLG_LOCAL));
+
+	assert(dnp->dn_args->dn_kind == DT_NODE_INT);
+	assert(dnp->dn_args->dn_list == NULL);
+
+	/*
+	 * If this is a reference in the args[] array, temporarily modify the
+	 * array index according to the static argument mapping (if any),
+	 * unless the argument reference is provided by a dynamic translator.
+	 * If we're using a dynamic translator for args[], then just set dn_reg
+	 * to an invalid reg and return: DIF_OP_XLARG will fetch the arg later.
+	 */
+	if (idp->di_id == DIF_VAR_ARGS) {
+		if ((idp->di_kind == DT_IDENT_XLPTR ||
+		    idp->di_kind == DT_IDENT_XLSOU) &&
+		    dt_xlator_dynamic(idp->di_data)) {
+			dnp->dn_reg = -1;
+			return;
+		}
+		dnp->dn_args->dn_value = prp->pr_mapping[saved];
+	}
+
+	dt_cg_node(dnp->dn_args, dlp, drp);
+	dnp->dn_args->dn_value = saved;
+
+	dnp->dn_reg = dnp->dn_args->dn_reg;
+
+	if (idp->di_flags & DT_IDFLG_TLS)
+		op = DIF_OP_LDTA;
+	else
+		op = DIF_OP_LDGA;
+
+	idp->di_flags |= DT_IDFLG_DIFR;
+
+	instr = DIF_INSTR_LDA(op, idp->di_id,
+	    dnp->dn_args->dn_reg, dnp->dn_reg);
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	/*
+	 * If this is a reference to the args[] array, we need to take the
+	 * additional step of explicitly eliminating any bits larger than the
+	 * type size: the DIF interpreter in the kernel will always give us
+	 * the raw (64-bit) argument value, and any bits larger than the type
+	 * size may be junk.  As a practical matter, this arises only on 64-bit
+	 * architectures and only when the argument index is larger than the
+	 * number of arguments passed directly to DTrace: if a 8-, 16- or
+	 * 32-bit argument must be retrieved from the stack, it is possible
+	 * (and it some cases, likely) that the upper bits will be garbage.
+	 */
+	if (idp->di_id != DIF_VAR_ARGS || !dt_node_is_scalar(dnp))
+		return;
+
+	if ((size = dt_node_type_size(dnp)) == sizeof (uint64_t))
+		return;
+
+	if ((reg = dt_regset_alloc(drp)) == -1)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+	assert(size < sizeof (uint64_t));
+	n = sizeof (uint64_t) * NBBY - size * NBBY;
+
+	dt_cg_setx(dlp, reg, n);
+
+	instr = DIF_INSTR_FMT(DIF_OP_SLL, dnp->dn_reg, reg, dnp->dn_reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_FMT((dnp->dn_flags & DT_NF_SIGNED) ?
+	    DIF_OP_SRA : DIF_OP_SRL, dnp->dn_reg, reg, dnp->dn_reg);
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+	dt_regset_free(drp, reg);
+}
+
+/*
+ * Generate code for an inlined variable reference.  Inlines can be used to
+ * define either scalar or associative array substitutions.  For scalars, we
+ * simply generate code for the parse tree saved in the identifier's din_root,
+ * and then cast the resulting expression to the inline's declaration type.
+ * For arrays, we take the input parameter subtrees from dnp->dn_args and
+ * temporarily store them in the din_root of each din_argv[i] identifier,
+ * which are themselves inlines and were set up for us by the parser.  The
+ * result is that any reference to the inlined parameter inside the top-level
+ * din_root will turn into a recursive call to dt_cg_inline() for a scalar
+ * inline whose din_root will refer to the subtree pointed to by the argument.
+ */
+static void
+dt_cg_inline(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	dt_ident_t *idp = dnp->dn_ident;
+	dt_idnode_t *inp = idp->di_iarg;
+
+	dt_idnode_t *pinp;
+	dt_node_t *pnp;
+	int i;
+
+	assert(idp->di_flags & DT_IDFLG_INLINE);
+	assert(idp->di_ops == &dt_idops_inline);
+
+	if (idp->di_kind == DT_IDENT_ARRAY) {
+		for (i = 0, pnp = dnp->dn_args;
+		    pnp != NULL; pnp = pnp->dn_list, i++) {
+			if (inp->din_argv[i] != NULL) {
+				pinp = inp->din_argv[i]->di_iarg;
+				pinp->din_root = pnp;
+			}
+		}
+	}
+
+	dt_cg_node(inp->din_root, dlp, drp);
+	dnp->dn_reg = inp->din_root->dn_reg;
+	dt_cg_typecast(inp->din_root, dnp, dlp, drp);
+
+	if (idp->di_kind == DT_IDENT_ARRAY) {
+		for (i = 0; i < inp->din_argc; i++) {
+			pinp = inp->din_argv[i]->di_iarg;
+			pinp->din_root = NULL;
+		}
+	}
+}
+
+static void
+dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
+{
+	ctf_file_t *ctfp = dnp->dn_ctfp;
+	ctf_file_t *octfp;
+	ctf_membinfo_t m;
+	ctf_id_t type;
+
+	dif_instr_t instr;
+	dt_ident_t *idp;
+	ssize_t stroff;
+	uint_t op;
+	int reg;
+
+	switch (dnp->dn_op) {
+	case DT_TOK_COMMA:
+		dt_cg_node(dnp->dn_left, dlp, drp);
+		dt_regset_free(drp, dnp->dn_left->dn_reg);
+		dt_cg_node(dnp->dn_right, dlp, drp);
+		dnp->dn_reg = dnp->dn_right->dn_reg;
+		break;
+
+	case DT_TOK_ASGN:
+		dt_cg_node(dnp->dn_right, dlp, drp);
+		dnp->dn_reg = dnp->dn_right->dn_reg;
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_ADD_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_ADD);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_SUB_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_SUB);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_MUL_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_MUL);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_DIV_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp,
+		    (dnp->dn_flags & DT_NF_SIGNED) ? DIF_OP_SDIV : DIF_OP_UDIV);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_MOD_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp,
+		    (dnp->dn_flags & DT_NF_SIGNED) ? DIF_OP_SREM : DIF_OP_UREM);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_AND_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_AND);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_XOR_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_XOR);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_OR_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_OR);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_LSH_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_SLL);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_RSH_EQ:
+		dt_cg_arithmetic_op(dnp, dlp, drp,
+		    (dnp->dn_flags & DT_NF_SIGNED) ? DIF_OP_SRA : DIF_OP_SRL);
+		dt_cg_asgn_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_QUESTION:
+		dt_cg_ternary_op(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_LOR:
+		dt_cg_logical_or(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_LXOR:
+		dt_cg_logical_xor(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_LAND:
+		dt_cg_logical_and(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_BOR:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_OR);
+		break;
+
+	case DT_TOK_XOR:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_XOR);
+		break;
+
+	case DT_TOK_BAND:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_AND);
+		break;
+
+	case DT_TOK_EQU:
+		dt_cg_compare_op(dnp, dlp, drp, DIF_OP_BE);
+		break;
+
+	case DT_TOK_NEQ:
+		dt_cg_compare_op(dnp, dlp, drp, DIF_OP_BNE);
+		break;
+
+	case DT_TOK_LT:
+		dt_cg_compare_op(dnp, dlp, drp,
+		    dt_cg_compare_signed(dnp) ? DIF_OP_BL : DIF_OP_BLU);
+		break;
+
+	case DT_TOK_LE:
+		dt_cg_compare_op(dnp, dlp, drp,
+		    dt_cg_compare_signed(dnp) ? DIF_OP_BLE : DIF_OP_BLEU);
+		break;
+
+	case DT_TOK_GT:
+		dt_cg_compare_op(dnp, dlp, drp,
+		    dt_cg_compare_signed(dnp) ? DIF_OP_BG : DIF_OP_BGU);
+		break;
+
+	case DT_TOK_GE:
+		dt_cg_compare_op(dnp, dlp, drp,
+		    dt_cg_compare_signed(dnp) ? DIF_OP_BGE : DIF_OP_BGEU);
+		break;
+
+	case DT_TOK_LSH:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_SLL);
+		break;
+
+	case DT_TOK_RSH:
+		dt_cg_arithmetic_op(dnp, dlp, drp,
+		    (dnp->dn_flags & DT_NF_SIGNED) ? DIF_OP_SRA : DIF_OP_SRL);
+		break;
+
+	case DT_TOK_ADD:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_ADD);
+		break;
+
+	case DT_TOK_SUB:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_SUB);
+		break;
+
+	case DT_TOK_MUL:
+		dt_cg_arithmetic_op(dnp, dlp, drp, DIF_OP_MUL);
+		break;
+
+	case DT_TOK_DIV:
+		dt_cg_arithmetic_op(dnp, dlp, drp,
+		    (dnp->dn_flags & DT_NF_SIGNED) ? DIF_OP_SDIV : DIF_OP_UDIV);
+		break;
+
+	case DT_TOK_MOD:
+		dt_cg_arithmetic_op(dnp, dlp, drp,
+		    (dnp->dn_flags & DT_NF_SIGNED) ? DIF_OP_SREM : DIF_OP_UREM);
+		break;
+
+	case DT_TOK_LNEG:
+		dt_cg_logical_neg(dnp, dlp, drp);
+		break;
+
+	case DT_TOK_BNEG:
+		dt_cg_node(dnp->dn_child, dlp, drp);
+		dnp->dn_reg = dnp->dn_child->dn_reg;
+		instr = DIF_INSTR_NOT(dnp->dn_reg, dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		break;
+
+	case DT_TOK_PREINC:
+		dt_cg_prearith_op(dnp, dlp, drp, DIF_OP_ADD);
+		break;
+
+	case DT_TOK_POSTINC:
+		dt_cg_postarith_op(dnp, dlp, drp, DIF_OP_ADD);
+		break;
+
+	case DT_TOK_PREDEC:
+		dt_cg_prearith_op(dnp, dlp, drp, DIF_OP_SUB);
+		break;
+
+	case DT_TOK_POSTDEC:
+		dt_cg_postarith_op(dnp, dlp, drp, DIF_OP_SUB);
+		break;
+
+	case DT_TOK_IPOS:
+		dt_cg_node(dnp->dn_child, dlp, drp);
+		dnp->dn_reg = dnp->dn_child->dn_reg;
+		break;
+
+	case DT_TOK_INEG:
+		dt_cg_node(dnp->dn_child, dlp, drp);
+		dnp->dn_reg = dnp->dn_child->dn_reg;
+
+		instr = DIF_INSTR_FMT(DIF_OP_SUB, DIF_REG_R0,
+		    dnp->dn_reg, dnp->dn_reg);
+
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		break;
+
+	case DT_TOK_DEREF:
+		dt_cg_node(dnp->dn_child, dlp, drp);
+		dnp->dn_reg = dnp->dn_child->dn_reg;
+
+		if (!(dnp->dn_flags & DT_NF_REF)) {
+			uint_t ubit = dnp->dn_flags & DT_NF_USERLAND;
+
+			/*
+			 * Save and restore DT_NF_USERLAND across dt_cg_load():
+			 * we need the sign bit from dnp and the user bit from
+			 * dnp->dn_child in order to get the proper opcode.
+			 */
+			dnp->dn_flags |=
+			    (dnp->dn_child->dn_flags & DT_NF_USERLAND);
+
+			instr = DIF_INSTR_LOAD(dt_cg_load(dnp, ctfp,
+			    dnp->dn_type), dnp->dn_reg, dnp->dn_reg);
+
+			dnp->dn_flags &= ~DT_NF_USERLAND;
+			dnp->dn_flags |= ubit;
+
+			dt_irlist_append(dlp,
+			    dt_cg_node_alloc(DT_LBL_NONE, instr));
+		}
+		break;
+
+	case DT_TOK_ADDROF: {
+		uint_t rbit = dnp->dn_child->dn_flags & DT_NF_REF;
+
+		dnp->dn_child->dn_flags |= DT_NF_REF; /* force pass-by-ref */
+		dt_cg_node(dnp->dn_child, dlp, drp);
+		dnp->dn_reg = dnp->dn_child->dn_reg;
+
+		dnp->dn_child->dn_flags &= ~DT_NF_REF;
+		dnp->dn_child->dn_flags |= rbit;
+		break;
+	}
+
+	case DT_TOK_SIZEOF: {
+		size_t size = dt_node_sizeof(dnp->dn_child);
+
+		if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+		assert(size != 0);
+		dt_cg_setx(dlp, dnp->dn_reg, size);
+		break;
+	}
+
+	case DT_TOK_STRINGOF:
+		dt_cg_node(dnp->dn_child, dlp, drp);
+		dnp->dn_reg = dnp->dn_child->dn_reg;
+		break;
+
+	case DT_TOK_XLATE:
+		/*
+		 * An xlate operator appears in either an XLATOR, indicating a
+		 * reference to a dynamic translator, or an OP2, indicating
+		 * use of the xlate operator in the user's program.  For the
+		 * dynamic case, generate an xlate opcode with a reference to
+		 * the corresponding member, pre-computed for us in dn_members.
+		 */
+		if (dnp->dn_kind == DT_NODE_XLATOR) {
+			dt_xlator_t *dxp = dnp->dn_xlator;
+
+			assert(dxp->dx_ident->di_flags & DT_IDFLG_CGREG);
+			assert(dxp->dx_ident->di_id != 0);
+
+			if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+			if (dxp->dx_arg == -1) {
+				instr = DIF_INSTR_MOV(
+				    dxp->dx_ident->di_id, dnp->dn_reg);
+				dt_irlist_append(dlp,
+				    dt_cg_node_alloc(DT_LBL_NONE, instr));
+				op = DIF_OP_XLATE;
+			} else
+				op = DIF_OP_XLARG;
+
+			instr = DIF_INSTR_XLATE(op, 0, dnp->dn_reg);
+			dt_irlist_append(dlp,
+			    dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+			dlp->dl_last->di_extern = dnp->dn_xmember;
+			break;
+		}
+
+		assert(dnp->dn_kind == DT_NODE_OP2);
+		dt_cg_node(dnp->dn_right, dlp, drp);
+		dnp->dn_reg = dnp->dn_right->dn_reg;
+		break;
+
+	case DT_TOK_LPAR:
+		dt_cg_node(dnp->dn_right, dlp, drp);
+		dnp->dn_reg = dnp->dn_right->dn_reg;
+		dt_cg_typecast(dnp->dn_right, dnp, dlp, drp);
+		break;
+
+	case DT_TOK_PTR:
+	case DT_TOK_DOT:
+		assert(dnp->dn_right->dn_kind == DT_NODE_IDENT);
+		dt_cg_node(dnp->dn_left, dlp, drp);
+
+		/*
+		 * If the left-hand side of PTR or DOT is a dynamic variable,
+		 * we expect it to be the output of a D translator.   In this
+		 * case, we look up the parse tree corresponding to the member
+		 * that is being accessed and run the code generator over it.
+		 * We then cast the result as if by the assignment operator.
+		 */
+		if ((idp = dt_node_resolve(
+		    dnp->dn_left, DT_IDENT_XLSOU)) != NULL ||
+		    (idp = dt_node_resolve(
+		    dnp->dn_left, DT_IDENT_XLPTR)) != NULL) {
+
+			dt_xlator_t *dxp;
+			dt_node_t *mnp;
+
+			dxp = idp->di_data;
+			mnp = dt_xlator_member(dxp, dnp->dn_right->dn_string);
+			assert(mnp != NULL);
+
+			dxp->dx_ident->di_flags |= DT_IDFLG_CGREG;
+			dxp->dx_ident->di_id = dnp->dn_left->dn_reg;
+
+			dt_cg_node(mnp->dn_membexpr, dlp, drp);
+			dnp->dn_reg = mnp->dn_membexpr->dn_reg;
+			dt_cg_typecast(mnp->dn_membexpr, dnp, dlp, drp);
+
+			dxp->dx_ident->di_flags &= ~DT_IDFLG_CGREG;
+			dxp->dx_ident->di_id = 0;
+
+			if (dnp->dn_left->dn_reg != -1)
+				dt_regset_free(drp, dnp->dn_left->dn_reg);
+			break;
+		}
+
+		ctfp = dnp->dn_left->dn_ctfp;
+		type = ctf_type_resolve(ctfp, dnp->dn_left->dn_type);
+
+		if (dnp->dn_op == DT_TOK_PTR) {
+			type = ctf_type_reference(ctfp, type);
+			type = ctf_type_resolve(ctfp, type);
+		}
+
+		if ((ctfp = dt_cg_membinfo(octfp = ctfp, type,
+		    dnp->dn_right->dn_string, &m)) == NULL) {
+			yypcb->pcb_hdl->dt_ctferr = ctf_errno(octfp);
+			longjmp(yypcb->pcb_jmpbuf, EDT_CTF);
+		}
+
+		if (m.ctm_offset != 0) {
+			if ((reg = dt_regset_alloc(drp)) == -1)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+			/*
+			 * If the offset is not aligned on a byte boundary, it
+			 * is a bit-field member and we will extract the value
+			 * bits below after we generate the appropriate load.
+			 */
+			dt_cg_setx(dlp, reg, m.ctm_offset / NBBY);
+
+			instr = DIF_INSTR_FMT(DIF_OP_ADD,
+			    dnp->dn_left->dn_reg, reg, dnp->dn_left->dn_reg);
+
+			dt_irlist_append(dlp,
+			    dt_cg_node_alloc(DT_LBL_NONE, instr));
+			dt_regset_free(drp, reg);
+		}
+
+		if (!(dnp->dn_flags & DT_NF_REF)) {
+			uint_t ubit = dnp->dn_flags & DT_NF_USERLAND;
+
+			/*
+			 * Save and restore DT_NF_USERLAND across dt_cg_load():
+			 * we need the sign bit from dnp and the user bit from
+			 * dnp->dn_left in order to get the proper opcode.
+			 */
+			dnp->dn_flags |=
+			    (dnp->dn_left->dn_flags & DT_NF_USERLAND);
+
+			instr = DIF_INSTR_LOAD(dt_cg_load(dnp,
+			    ctfp, m.ctm_type), dnp->dn_left->dn_reg,
+			    dnp->dn_left->dn_reg);
+
+			dnp->dn_flags &= ~DT_NF_USERLAND;
+			dnp->dn_flags |= ubit;
+
+			dt_irlist_append(dlp,
+			    dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+			if (dnp->dn_flags & DT_NF_BITFIELD)
+				dt_cg_field_get(dnp, dlp, drp, ctfp, &m);
+		}
+
+		dnp->dn_reg = dnp->dn_left->dn_reg;
+		break;
+
+	case DT_TOK_STRING:
+		if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+		assert(dnp->dn_kind == DT_NODE_STRING);
+		stroff = dt_strtab_insert(yypcb->pcb_strtab, dnp->dn_string);
+
+		if (stroff == -1L)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+		if (stroff > DIF_STROFF_MAX)
+			longjmp(yypcb->pcb_jmpbuf, EDT_STR2BIG);
+
+		instr = DIF_INSTR_SETS((ulong_t)stroff, dnp->dn_reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		break;
+
+	case DT_TOK_IDENT:
+		/*
+		 * If the specified identifier is a variable on which we have
+		 * set the code generator register flag, then this variable
+		 * has already had code generated for it and saved in di_id.
+		 * Allocate a new register and copy the existing value to it.
+		 */
+		if (dnp->dn_kind == DT_NODE_VAR &&
+		    (dnp->dn_ident->di_flags & DT_IDFLG_CGREG)) {
+			if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+			instr = DIF_INSTR_MOV(dnp->dn_ident->di_id,
+			    dnp->dn_reg);
+			dt_irlist_append(dlp,
+			    dt_cg_node_alloc(DT_LBL_NONE, instr));
+			break;
+		}
+
+		/*
+		 * Identifiers can represent function calls, variable refs, or
+		 * symbols.  First we check for inlined variables, and handle
+		 * them by generating code for the inline parse tree.
+		 */
+		if (dnp->dn_kind == DT_NODE_VAR &&
+		    (dnp->dn_ident->di_flags & DT_IDFLG_INLINE)) {
+			dt_cg_inline(dnp, dlp, drp);
+			break;
+		}
+
+		switch (dnp->dn_kind) {
+		case DT_NODE_FUNC:
+			if ((idp = dnp->dn_ident)->di_kind != DT_IDENT_FUNC) {
+				dnerror(dnp, D_CG_EXPR, "%s %s( ) may not be "
+				    "called from a D expression (D program "
+				    "context required)\n",
+				    dt_idkind_name(idp->di_kind), idp->di_name);
+			}
+
+			dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp);
+
+			if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+			instr = DIF_INSTR_CALL(
+			    dnp->dn_ident->di_id, dnp->dn_reg);
+
+			dt_irlist_append(dlp,
+			    dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+			break;
+
+		case DT_NODE_VAR:
+			if (dnp->dn_ident->di_kind == DT_IDENT_XLSOU ||
+			    dnp->dn_ident->di_kind == DT_IDENT_XLPTR) {
+				/*
+				 * This can only happen if we have translated
+				 * args[].  See dt_idcook_args() for details.
+				 */
+				assert(dnp->dn_ident->di_id == DIF_VAR_ARGS);
+				dt_cg_array_op(dnp, dlp, drp);
+				break;
+			}
+
+			if (dnp->dn_ident->di_kind == DT_IDENT_ARRAY) {
+				if (dnp->dn_ident->di_id > DIF_VAR_ARRAY_MAX)
+					dt_cg_assoc_op(dnp, dlp, drp);
+				else
+					dt_cg_array_op(dnp, dlp, drp);
+				break;
+			}
+
+			if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+			if (dnp->dn_ident->di_flags & DT_IDFLG_LOCAL)
+				op = DIF_OP_LDLS;
+			else if (dnp->dn_ident->di_flags & DT_IDFLG_TLS)
+				op = DIF_OP_LDTS;
+			else
+				op = DIF_OP_LDGS;
+
+			dnp->dn_ident->di_flags |= DT_IDFLG_DIFR;
+
+			instr = DIF_INSTR_LDV(op,
+			    dnp->dn_ident->di_id, dnp->dn_reg);
+
+			dt_irlist_append(dlp,
+			    dt_cg_node_alloc(DT_LBL_NONE, instr));
+			break;
+
+		case DT_NODE_SYM: {
+			dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+			dtrace_syminfo_t *sip = dnp->dn_ident->di_data;
+			GElf_Sym sym;
+
+			if (dtrace_lookup_by_name(dtp,
+			    sip->dts_object, sip->dts_name, &sym, NULL) == -1) {
+				xyerror(D_UNKNOWN, "cg failed for symbol %s`%s:"
+				    " %s\n", sip->dts_object, sip->dts_name,
+				    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+			}
+
+			if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+			dt_cg_xsetx(dlp, dnp->dn_ident,
+			    DT_LBL_NONE, dnp->dn_reg, sym.st_value);
+
+			if (!(dnp->dn_flags & DT_NF_REF)) {
+				instr = DIF_INSTR_LOAD(dt_cg_load(dnp, ctfp,
+				    dnp->dn_type), dnp->dn_reg, dnp->dn_reg);
+				dt_irlist_append(dlp,
+				    dt_cg_node_alloc(DT_LBL_NONE, instr));
+			}
+			break;
+		}
+
+		default:
+			xyerror(D_UNKNOWN, "internal error -- node type %u is "
+			    "not valid for an identifier\n", dnp->dn_kind);
+		}
+		break;
+
+	case DT_TOK_INT:
+		if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
+
+		dt_cg_setx(dlp, dnp->dn_reg, dnp->dn_value);
+		break;
+
+	default:
+		xyerror(D_UNKNOWN, "internal error -- token type %u is not a "
+		    "valid D compilation token\n", dnp->dn_op);
+	}
+}
+
+void
+dt_cg(dt_pcb_t *pcb, dt_node_t *dnp)
+{
+	dif_instr_t instr;
+	dt_xlator_t *dxp;
+
+	if (pcb->pcb_regs == NULL && (pcb->pcb_regs =
+	    dt_regset_create(pcb->pcb_hdl->dt_conf.dtc_difintregs)) == NULL)
+		longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dt_regset_reset(pcb->pcb_regs);
+	(void) dt_regset_alloc(pcb->pcb_regs); /* allocate %r0 */
+
+	if (pcb->pcb_inttab != NULL)
+		dt_inttab_destroy(pcb->pcb_inttab);
+
+	if ((pcb->pcb_inttab = dt_inttab_create(yypcb->pcb_hdl)) == NULL)
+		longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+	if (pcb->pcb_strtab != NULL)
+		dt_strtab_destroy(pcb->pcb_strtab);
+
+	if ((pcb->pcb_strtab = dt_strtab_create(BUFSIZ)) == NULL)
+		longjmp(pcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dt_irlist_destroy(&pcb->pcb_ir);
+	dt_irlist_create(&pcb->pcb_ir);
+
+	assert(pcb->pcb_dret == NULL);
+	pcb->pcb_dret = dnp;
+
+	if (dt_node_is_dynamic(dnp)) {
+		dnerror(dnp, D_CG_DYN, "expression cannot evaluate to result "
+		    "of dynamic type\n");
+	}
+
+	/*
+	 * If we're generating code for a translator body, assign the input
+	 * parameter to the first available register (i.e. caller passes %r1).
+	 */
+	if (dnp->dn_kind == DT_NODE_MEMBER) {
+		dxp = dnp->dn_membxlator;
+		dnp = dnp->dn_membexpr;
+
+		dxp->dx_ident->di_flags |= DT_IDFLG_CGREG;
+		dxp->dx_ident->di_id = dt_regset_alloc(pcb->pcb_regs);
+	}
+
+	dt_cg_node(dnp, &pcb->pcb_ir, pcb->pcb_regs);
+	instr = DIF_INSTR_RET(dnp->dn_reg);
+	dt_regset_free(pcb->pcb_regs, dnp->dn_reg);
+	dt_irlist_append(&pcb->pcb_ir, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	if (dnp->dn_kind == DT_NODE_MEMBER) {
+		dt_regset_free(pcb->pcb_regs, dxp->dx_ident->di_id);
+		dxp->dx_ident->di_id = 0;
+		dxp->dx_ident->di_flags &= ~DT_IDFLG_CGREG;
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_consume.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_consume.c
new file mode 100644
index 0000000..4392330
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_consume.c
@@ -0,0 +1,2329 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#include <stdlib.h>
+#include <strings.h>
+#include <errno.h>
+#include <unistd.h>
+#include <limits.h>
+#include <assert.h>
+#include <ctype.h>
+#include <alloca.h>
+#else  /* VBOX */
+# include <ctype.h>
+# include <iprt/mp.h>
+# ifdef _MSC_VER
+#  pragma warning(disable:4146) /* -uint64_t warnings */
+#  include <io.h>
+#  define ftruncate 	_chsize
+#  define fseeko		fseek
+# else
+#  include <unistd.h>
+# endif
+#endif /* VBOX */
+#include <dt_impl.h>
+
+#define	DT_MASK_LO 0x00000000FFFFFFFFULL
+
+/*
+ * We declare this here because (1) we need it and (2) we want to avoid a
+ * dependency on libm in libdtrace.
+ */
+static long double
+dt_fabsl(long double x)
+{
+	if (x < 0)
+		return (-x);
+
+	return (x);
+}
+
+/*
+ * 128-bit arithmetic functions needed to support the stddev() aggregating
+ * action.
+ */
+static int
+dt_gt_128(uint64_t *a, uint64_t *b)
+{
+	return (a[1] > b[1] || (a[1] == b[1] && a[0] > b[0]));
+}
+
+static int
+dt_ge_128(uint64_t *a, uint64_t *b)
+{
+	return (a[1] > b[1] || (a[1] == b[1] && a[0] >= b[0]));
+}
+
+static int
+dt_le_128(uint64_t *a, uint64_t *b)
+{
+	return (a[1] < b[1] || (a[1] == b[1] && a[0] <= b[0]));
+}
+
+/*
+ * Shift the 128-bit value in a by b. If b is positive, shift left.
+ * If b is negative, shift right.
+ */
+static void
+dt_shift_128(uint64_t *a, int b)
+{
+	uint64_t mask;
+
+	if (b == 0)
+		return;
+
+	if (b < 0) {
+		b = -b;
+		if (b >= 64) {
+			a[0] = a[1] >> (b - 64);
+			a[1] = 0;
+		} else {
+			a[0] >>= b;
+			mask = 1LL << (64 - b);
+			mask -= 1;
+			a[0] |= ((a[1] & mask) << (64 - b));
+			a[1] >>= b;
+		}
+	} else {
+		if (b >= 64) {
+			a[1] = a[0] << (b - 64);
+			a[0] = 0;
+		} else {
+			a[1] <<= b;
+			mask = a[0] >> (64 - b);
+			a[1] |= mask;
+			a[0] <<= b;
+		}
+	}
+}
+
+static int
+dt_nbits_128(uint64_t *a)
+{
+	int nbits = 0;
+	uint64_t tmp[2];
+	uint64_t zero[2] = { 0, 0 };
+
+	tmp[0] = a[0];
+	tmp[1] = a[1];
+
+	dt_shift_128(tmp, -1);
+	while (dt_gt_128(tmp, zero)) {
+		dt_shift_128(tmp, -1);
+		nbits++;
+	}
+
+	return (nbits);
+}
+
+static void
+dt_subtract_128(uint64_t *minuend, uint64_t *subtrahend, uint64_t *difference)
+{
+	uint64_t result[2];
+
+	result[0] = minuend[0] - subtrahend[0];
+	result[1] = minuend[1] - subtrahend[1] -
+	    (minuend[0] < subtrahend[0] ? 1 : 0);
+
+	difference[0] = result[0];
+	difference[1] = result[1];
+}
+
+static void
+dt_add_128(uint64_t *addend1, uint64_t *addend2, uint64_t *sum)
+{
+	uint64_t result[2];
+
+	result[0] = addend1[0] + addend2[0];
+	result[1] = addend1[1] + addend2[1] +
+	    (result[0] < addend1[0] || result[0] < addend2[0] ? 1 : 0);
+
+	sum[0] = result[0];
+	sum[1] = result[1];
+}
+
+/*
+ * The basic idea is to break the 2 64-bit values into 4 32-bit values,
+ * use native multiplication on those, and then re-combine into the
+ * resulting 128-bit value.
+ *
+ * (hi1 << 32 + lo1) * (hi2 << 32 + lo2) =
+ *     hi1 * hi2 << 64 +
+ *     hi1 * lo2 << 32 +
+ *     hi2 * lo1 << 32 +
+ *     lo1 * lo2
+ */
+static void
+dt_multiply_128(uint64_t factor1, uint64_t factor2, uint64_t *product)
+{
+	uint64_t hi1, hi2, lo1, lo2;
+	uint64_t tmp[2];
+
+	hi1 = factor1 >> 32;
+	hi2 = factor2 >> 32;
+
+	lo1 = factor1 & DT_MASK_LO;
+	lo2 = factor2 & DT_MASK_LO;
+
+	product[0] = lo1 * lo2;
+	product[1] = hi1 * hi2;
+
+	tmp[0] = hi1 * lo2;
+	tmp[1] = 0;
+	dt_shift_128(tmp, 32);
+	dt_add_128(product, tmp, product);
+
+	tmp[0] = hi2 * lo1;
+	tmp[1] = 0;
+	dt_shift_128(tmp, 32);
+	dt_add_128(product, tmp, product);
+}
+
+/*
+ * This is long-hand division.
+ *
+ * We initialize subtrahend by shifting divisor left as far as possible. We
+ * loop, comparing subtrahend to dividend:  if subtrahend is smaller, we
+ * subtract and set the appropriate bit in the result.  We then shift
+ * subtrahend right by one bit for the next comparison.
+ */
+static void
+dt_divide_128(uint64_t *dividend, uint64_t divisor, uint64_t *quotient)
+{
+	uint64_t result[2] = { 0, 0 };
+	uint64_t remainder[2];
+	uint64_t subtrahend[2];
+	uint64_t divisor_128[2];
+	uint64_t mask[2] = { 1, 0 };
+	int log = 0;
+
+	assert(divisor != 0);
+
+	divisor_128[0] = divisor;
+	divisor_128[1] = 0;
+
+	remainder[0] = dividend[0];
+	remainder[1] = dividend[1];
+
+	subtrahend[0] = divisor;
+	subtrahend[1] = 0;
+
+	while (divisor > 0) {
+		log++;
+		divisor >>= 1;
+	}
+
+	dt_shift_128(subtrahend, 128 - log);
+	dt_shift_128(mask, 128 - log);
+
+	while (dt_ge_128(remainder, divisor_128)) {
+		if (dt_ge_128(remainder, subtrahend)) {
+			dt_subtract_128(remainder, subtrahend, remainder);
+			result[0] |= mask[0];
+			result[1] |= mask[1];
+		}
+
+		dt_shift_128(subtrahend, -1);
+		dt_shift_128(mask, -1);
+	}
+
+	quotient[0] = result[0];
+	quotient[1] = result[1];
+}
+
+/*
+ * This is the long-hand method of calculating a square root.
+ * The algorithm is as follows:
+ *
+ * 1. Group the digits by 2 from the right.
+ * 2. Over the leftmost group, find the largest single-digit number
+ *    whose square is less than that group.
+ * 3. Subtract the result of the previous step (2 or 4, depending) and
+ *    bring down the next two-digit group.
+ * 4. For the result R we have so far, find the largest single-digit number
+ *    x such that 2 * R * 10 * x + x^2 is less than the result from step 3.
+ *    (Note that this is doubling R and performing a decimal left-shift by 1
+ *    and searching for the appropriate decimal to fill the one's place.)
+ *    The value x is the next digit in the square root.
+ * Repeat steps 3 and 4 until the desired precision is reached.  (We're
+ * dealing with integers, so the above is sufficient.)
+ *
+ * In decimal, the square root of 582,734 would be calculated as so:
+ *
+ *     __7__6__3
+ *    | 58 27 34
+ *     -49       (7^2 == 49 => 7 is the first digit in the square root)
+ *      --
+ *       9 27    (Subtract and bring down the next group.)
+ * 146   8 76    (2 * 7 * 10 * 6 + 6^2 == 876 => 6 is the next digit in
+ *      -----     the square root)
+ *         51 34 (Subtract and bring down the next group.)
+ * 1523    45 69 (2 * 76 * 10 * 3 + 3^2 == 4569 => 3 is the next digit in
+ *         -----  the square root)
+ *          5 65 (remainder)
+ *
+ * The above algorithm applies similarly in binary, but note that the
+ * only possible non-zero value for x in step 4 is 1, so step 4 becomes a
+ * simple decision: is 2 * R * 2 * 1 + 1^2 (aka R << 2 + 1) less than the
+ * preceding difference?
+ *
+ * In binary, the square root of 11011011 would be calculated as so:
+ *
+ *     __1__1__1__0
+ *    | 11 01 10 11
+ *      01          (0 << 2 + 1 == 1 < 11 => this bit is 1)
+ *      --
+ *      10 01 10 11
+ * 101   1 01       (1 << 2 + 1 == 101 < 1001 => next bit is 1)
+ *      -----
+ *       1 00 10 11
+ * 1101    11 01    (11 << 2 + 1 == 1101 < 10010 => next bit is 1)
+ *       -------
+ *          1 01 11
+ * 11101    1 11 01 (111 << 2 + 1 == 11101 > 10111 => last bit is 0)
+ *
+ */
+static uint64_t
+dt_sqrt_128(uint64_t *square)
+{
+	uint64_t result[2] = { 0, 0 };
+	uint64_t diff[2] = { 0, 0 };
+	uint64_t one[2] = { 1, 0 };
+	uint64_t next_pair[2];
+	uint64_t next_try[2];
+	uint64_t bit_pairs, pair_shift;
+	int i;
+
+	bit_pairs = dt_nbits_128(square) / 2;
+	pair_shift = bit_pairs * 2;
+
+	for (i = 0; i <= bit_pairs; i++) {
+		/*
+		 * Bring down the next pair of bits.
+		 */
+		next_pair[0] = square[0];
+		next_pair[1] = square[1];
+		dt_shift_128(next_pair, -pair_shift);
+		next_pair[0] &= 0x3;
+		next_pair[1] = 0;
+
+		dt_shift_128(diff, 2);
+		dt_add_128(diff, next_pair, diff);
+
+		/*
+		 * next_try = R << 2 + 1
+		 */
+		next_try[0] = result[0];
+		next_try[1] = result[1];
+		dt_shift_128(next_try, 2);
+		dt_add_128(next_try, one, next_try);
+
+		if (dt_le_128(next_try, diff)) {
+			dt_subtract_128(diff, next_try, diff);
+			dt_shift_128(result, 1);
+			dt_add_128(result, one, result);
+		} else {
+			dt_shift_128(result, 1);
+		}
+
+		pair_shift -= 2;
+	}
+
+	assert(result[1] == 0);
+
+	return (result[0]);
+}
+
+uint64_t
+dt_stddev(uint64_t *data, uint64_t normal)
+{
+	uint64_t avg_of_squares[2];
+	uint64_t square_of_avg[2];
+	int64_t norm_avg;
+	uint64_t diff[2];
+
+	/*
+	 * The standard approximation for standard deviation is
+	 * sqrt(average(x**2) - average(x)**2), i.e. the square root
+	 * of the average of the squares minus the square of the average.
+	 */
+	dt_divide_128(data + 2, normal, avg_of_squares);
+	dt_divide_128(avg_of_squares, data[0], avg_of_squares);
+
+	norm_avg = (int64_t)data[1] / (int64_t)normal / (int64_t)data[0];
+
+	if (norm_avg < 0)
+		norm_avg = -norm_avg;
+
+	dt_multiply_128((uint64_t)norm_avg, (uint64_t)norm_avg, square_of_avg);
+
+	dt_subtract_128(avg_of_squares, square_of_avg, diff);
+
+	return (dt_sqrt_128(diff));
+}
+
+static int
+dt_flowindent(dtrace_hdl_t *dtp, dtrace_probedata_t *data, dtrace_epid_t last,
+    dtrace_bufdesc_t *buf, size_t offs)
+{
+	dtrace_probedesc_t *pd = data->dtpda_pdesc, *npd;
+	dtrace_eprobedesc_t *epd = data->dtpda_edesc, *nepd;
+	char *p = pd->dtpd_provider, *n = pd->dtpd_name, *sub;
+	dtrace_flowkind_t flow = DTRACEFLOW_NONE;
+	const char *str = NULL;
+	static const char *e_str[2] = { " -> ", " => " };
+	static const char *r_str[2] = { " <- ", " <= " };
+	static const char *ent = "entry", *ret = "return";
+	static VBDTTYPE(size_t,int) entlen = 0, retlen = 0;
+	dtrace_epid_t next, id = epd->dtepd_epid;
+	int rval;
+
+	if (entlen == 0) {
+		assert(retlen == 0);
+		entlen = strlen(ent);
+		retlen = strlen(ret);
+	}
+
+	/*
+	 * If the name of the probe is "entry" or ends with "-entry", we
+	 * treat it as an entry; if it is "return" or ends with "-return",
+	 * we treat it as a return.  (This allows application-provided probes
+	 * like "method-entry" or "function-entry" to participate in flow
+	 * indentation -- without accidentally misinterpreting popular probe
+	 * names like "carpentry", "gentry" or "Coventry".)
+	 */
+	if ((sub = strstr(n, ent)) != NULL && sub[entlen] == '\0' &&
+	    (sub == n || sub[-1] == '-')) {
+		flow = DTRACEFLOW_ENTRY;
+		str = e_str[strcmp(p, "syscall") == 0];
+	} else if ((sub = strstr(n, ret)) != NULL && sub[retlen] == '\0' &&
+	    (sub == n || sub[-1] == '-')) {
+		flow = DTRACEFLOW_RETURN;
+		str = r_str[strcmp(p, "syscall") == 0];
+	}
+
+	/*
+	 * If we're going to indent this, we need to check the ID of our last
+	 * call.  If we're looking at the same probe ID but a different EPID,
+	 * we _don't_ want to indent.  (Yes, there are some minor holes in
+	 * this scheme -- it's a heuristic.)
+	 */
+	if (flow == DTRACEFLOW_ENTRY) {
+		if ((last != DTRACE_EPIDNONE && id != last &&
+		    pd->dtpd_id == dtp->dt_pdesc[last]->dtpd_id))
+			flow = DTRACEFLOW_NONE;
+	}
+
+	/*
+	 * If we're going to unindent this, it's more difficult to see if
+	 * we don't actually want to unindent it -- we need to look at the
+	 * _next_ EPID.
+	 */
+	if (flow == DTRACEFLOW_RETURN) {
+		offs += epd->dtepd_size;
+
+		do {
+			if (offs >= buf->dtbd_size) {
+				/*
+				 * We're at the end -- maybe.  If the oldest
+				 * record is non-zero, we need to wrap.
+				 */
+				if (buf->dtbd_oldest != 0) {
+					offs = 0;
+				} else {
+					goto out;
+				}
+			}
+
+			next = *(uint32_t *)((uintptr_t)buf->dtbd_data + offs);
+
+			if (next == DTRACE_EPIDNONE)
+				offs += sizeof (id);
+		} while (next == DTRACE_EPIDNONE);
+
+		if ((rval = dt_epid_lookup(dtp, next, &nepd, &npd)) != 0)
+			return (rval);
+
+		if (next != id && npd->dtpd_id == pd->dtpd_id)
+			flow = DTRACEFLOW_NONE;
+	}
+
+out:
+	if (flow == DTRACEFLOW_ENTRY || flow == DTRACEFLOW_RETURN) {
+		data->dtpda_prefix = str;
+	} else {
+		data->dtpda_prefix = "| ";
+	}
+
+	if (flow == DTRACEFLOW_RETURN && data->dtpda_indent > 0)
+		data->dtpda_indent -= 2;
+
+	data->dtpda_flow = flow;
+
+	return (0);
+}
+
+static int
+dt_nullprobe()
+{
+	return (DTRACE_CONSUME_THIS);
+}
+
+static int
+dt_nullrec()
+{
+	return (DTRACE_CONSUME_NEXT);
+}
+
+int
+dt_print_quantline(dtrace_hdl_t *dtp, FILE *fp, int64_t val,
+    uint64_t normal, long double total, char positives, char negatives)
+{
+	long double f;
+	uint_t depth, len = 40;
+
+	const char *ats = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
+	const char *spaces = "                                        ";
+
+	assert(strlen(ats) == len && strlen(spaces) == len);
+	assert(!(total == 0 && (positives || negatives)));
+	assert(!(val < 0 && !negatives));
+	assert(!(val > 0 && !positives));
+	assert(!(val != 0 && total == 0));
+
+	if (!negatives) {
+		if (positives) {
+			f = (dt_fabsl((long double)val) * len) / total;
+			depth = (uint_t)(f + 0.5);
+		} else {
+			depth = 0;
+		}
+
+		return (dt_printf(dtp, fp, "|%s%s %-9lld\n", ats + len - depth,
+		    spaces + depth, (long long)val / normal));
+	}
+
+	if (!positives) {
+		f = (dt_fabsl((long double)val) * len) / total;
+		depth = (uint_t)(f + 0.5);
+
+		return (dt_printf(dtp, fp, "%s%s| %-9lld\n", spaces + depth,
+		    ats + len - depth, (long long)val / normal));
+	}
+
+	/*
+	 * If we're here, we have both positive and negative bucket values.
+	 * To express this graphically, we're going to generate both positive
+	 * and negative bars separated by a centerline.  These bars are half
+	 * the size of normal quantize()/lquantize() bars, so we divide the
+	 * length in half before calculating the bar length.
+	 */
+	len /= 2;
+	ats = &ats[len];
+	spaces = &spaces[len];
+
+	f = (dt_fabsl((long double)val) * len) / total;
+	depth = (uint_t)(f + 0.5);
+
+	if (val <= 0) {
+		return (dt_printf(dtp, fp, "%s%s|%*s %-9lld\n", spaces + depth,
+		    ats + len - depth, len, "", (long long)val / normal));
+	} else {
+		return (dt_printf(dtp, fp, "%20s|%s%s %-9lld\n", "",
+		    ats + len - depth, spaces + depth,
+		    (long long)val / normal));
+	}
+}
+
+int
+dt_print_quantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr,
+    size_t size, uint64_t normal)
+{
+	const int64_t *data = addr;
+	int i, first_bin = 0, last_bin = DTRACE_QUANTIZE_NBUCKETS - 1;
+	long double total = 0;
+	char positives = 0, negatives = 0;
+
+	if (size != DTRACE_QUANTIZE_NBUCKETS * sizeof (uint64_t))
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+	while (first_bin < DTRACE_QUANTIZE_NBUCKETS - 1 && data[first_bin] == 0)
+		first_bin++;
+
+	if (first_bin == DTRACE_QUANTIZE_NBUCKETS - 1) {
+		/*
+		 * There isn't any data.  This is possible if (and only if)
+		 * negative increment values have been used.  In this case,
+		 * we'll print the buckets around 0.
+		 */
+		first_bin = DTRACE_QUANTIZE_ZEROBUCKET - 1;
+		last_bin = DTRACE_QUANTIZE_ZEROBUCKET + 1;
+	} else {
+		if (first_bin > 0)
+			first_bin--;
+
+		while (last_bin > 0 && data[last_bin] == 0)
+			last_bin--;
+
+		if (last_bin < DTRACE_QUANTIZE_NBUCKETS - 1)
+			last_bin++;
+	}
+
+	for (i = first_bin; i <= last_bin; i++) {
+		positives |= (data[i] > 0);
+		negatives |= (data[i] < 0);
+		total += dt_fabsl((long double)data[i]);
+	}
+
+	if (dt_printf(dtp, fp, "\n%16s %41s %-9s\n", "value",
+	    "------------- Distribution -------------", "count") < 0)
+		return (-1);
+
+	for (i = first_bin; i <= last_bin; i++) {
+		if (dt_printf(dtp, fp, "%16lld ",
+		    (long long)DTRACE_QUANTIZE_BUCKETVAL(i)) < 0)
+			return (-1);
+
+		if (dt_print_quantline(dtp, fp, data[i], normal, total,
+		    positives, negatives) < 0)
+			return (-1);
+	}
+
+	return (0);
+}
+
+int
+dt_print_lquantize(dtrace_hdl_t *dtp, FILE *fp, const void *addr,
+    size_t size, uint64_t normal)
+{
+	const int64_t *data = addr;
+	int i, first_bin, last_bin, base;
+	uint64_t arg;
+	long double total = 0;
+	uint16_t step, levels;
+	char positives = 0, negatives = 0;
+
+	if (size < sizeof (uint64_t))
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+	arg = *data++;
+	size -= sizeof (uint64_t);
+
+	base = DTRACE_LQUANTIZE_BASE(arg);
+	step = DTRACE_LQUANTIZE_STEP(arg);
+	levels = DTRACE_LQUANTIZE_LEVELS(arg);
+
+	first_bin = 0;
+	last_bin = levels + 1;
+
+	if (size != sizeof (uint64_t) * (levels + 2))
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+	while (first_bin <= levels + 1 && data[first_bin] == 0)
+		first_bin++;
+
+	if (first_bin > levels + 1) {
+		first_bin = 0;
+		last_bin = 2;
+	} else {
+		if (first_bin > 0)
+			first_bin--;
+
+		while (last_bin > 0 && data[last_bin] == 0)
+			last_bin--;
+
+		if (last_bin < levels + 1)
+			last_bin++;
+	}
+
+	for (i = first_bin; i <= last_bin; i++) {
+		positives |= (data[i] > 0);
+		negatives |= (data[i] < 0);
+		total += dt_fabsl((long double)data[i]);
+	}
+
+	if (dt_printf(dtp, fp, "\n%16s %41s %-9s\n", "value",
+	    "------------- Distribution -------------", "count") < 0)
+		return (-1);
+
+	for (i = first_bin; i <= last_bin; i++) {
+		char c[32];
+		int err;
+
+		if (i == 0) {
+			(void) snprintf(c, sizeof (c), "< %d",
+			    base / (uint32_t)normal);
+			err = dt_printf(dtp, fp, "%16s ", c);
+		} else if (i == levels + 1) {
+			(void) snprintf(c, sizeof (c), ">= %d",
+			    base + (levels * step));
+			err = dt_printf(dtp, fp, "%16s ", c);
+		} else {
+			err = dt_printf(dtp, fp, "%16d ",
+			    base + (i - 1) * step);
+		}
+
+		if (err < 0 || dt_print_quantline(dtp, fp, data[i], normal,
+		    total, positives, negatives) < 0)
+			return (-1);
+	}
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_print_average(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
+    size_t size, uint64_t normal)
+{
+	/* LINTED - alignment */
+	int64_t *data = (int64_t *)addr;
+
+	return (dt_printf(dtp, fp, " %16lld", data[0] ?
+	    (long long)(data[1] / (int64_t)normal / data[0]) : 0));
+}
+
+/*ARGSUSED*/
+static int
+dt_print_stddev(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
+    size_t size, uint64_t normal)
+{
+	/* LINTED - alignment */
+	uint64_t *data = (uint64_t *)addr;
+
+	return (dt_printf(dtp, fp, " %16llu", data[0] ?
+	    (unsigned long long) dt_stddev(data, normal) : 0));
+}
+
+/*ARGSUSED*/
+int
+dt_print_bytes(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr,
+    size_t nbytes, int width, int quiet)
+{
+	/*
+	 * If the byte stream is a series of printable characters, followed by
+	 * a terminating byte, we print it out as a string.  Otherwise, we
+	 * assume that it's something else and just print the bytes.
+	 */
+	int i, j, margin = 5;
+	char *c = (char *)addr;
+
+	if (nbytes == 0)
+		return (0);
+
+	if (dtp->dt_options[DTRACEOPT_RAWBYTES] != DTRACEOPT_UNSET)
+		goto raw;
+
+	for (i = 0; i < nbytes; i++) {
+		/*
+		 * We define a "printable character" to be one for which
+		 * isprint(3C) returns non-zero, isspace(3C) returns non-zero,
+		 * or a character which is either backspace or the bell.
+		 * Backspace and the bell are regrettably special because
+		 * they fail the first two tests -- and yet they are entirely
+		 * printable.  These are the only two control characters that
+		 * have meaning for the terminal and for which isprint(3C) and
+		 * isspace(3C) return 0.
+		 */
+		if (isprint(c[i]) || isspace(c[i]) ||
+		    c[i] == '\b' || c[i] == '\a')
+			continue;
+
+		if (c[i] == '\0' && i > 0) {
+			/*
+			 * This looks like it might be a string.  Before we
+			 * assume that it is indeed a string, check the
+			 * remainder of the byte range; if it contains
+			 * additional non-nul characters, we'll assume that
+			 * it's a binary stream that just happens to look like
+			 * a string, and we'll print out the individual bytes.
+			 */
+			for (j = i + 1; j < nbytes; j++) {
+				if (c[j] != '\0')
+					break;
+			}
+
+			if (j != nbytes)
+				break;
+
+			if (quiet)
+				return (dt_printf(dtp, fp, "%s", c));
+			else
+				return (dt_printf(dtp, fp, "  %-*s", width, c));
+		}
+
+		break;
+	}
+
+	if (i == nbytes) {
+		/*
+		 * The byte range is all printable characters, but there is
+		 * no trailing nul byte.  We'll assume that it's a string and
+		 * print it as such.
+		 */
+		char *s = alloca(nbytes + 1);
+		bcopy(c, s, nbytes);
+		s[nbytes] = '\0';
+		return (dt_printf(dtp, fp, "  %-*s", width, s));
+	}
+
+raw:
+	if (dt_printf(dtp, fp, "\n%*s      ", margin, "") < 0)
+		return (-1);
+
+	for (i = 0; i < 16; i++)
+		if (dt_printf(dtp, fp, "  %c", "0123456789abcdef"[i]) < 0)
+			return (-1);
+
+	if (dt_printf(dtp, fp, "  0123456789abcdef\n") < 0)
+		return (-1);
+
+
+	for (i = 0; i < nbytes; i += 16) {
+		if (dt_printf(dtp, fp, "%*s%5x:", margin, "", i) < 0)
+			return (-1);
+
+		for (j = i; j < i + 16 && j < nbytes; j++) {
+			if (dt_printf(dtp, fp, " %02x", (uchar_t)c[j]) < 0)
+				return (-1);
+		}
+
+		while (j++ % 16) {
+			if (dt_printf(dtp, fp, "   ") < 0)
+				return (-1);
+		}
+
+		if (dt_printf(dtp, fp, "  ") < 0)
+			return (-1);
+
+		for (j = i; j < i + 16 && j < nbytes; j++) {
+			if (dt_printf(dtp, fp, "%c",
+			    c[j] < ' ' || c[j] > '~' ? '.' : c[j]) < 0)
+				return (-1);
+		}
+
+		if (dt_printf(dtp, fp, "\n") < 0)
+			return (-1);
+	}
+
+	return (0);
+}
+
+int
+dt_print_stack(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    caddr_t addr, int depth, int size)
+{
+	dtrace_syminfo_t dts;
+	GElf_Sym sym;
+	int i, indent;
+	char c[PATH_MAX * 2];
+	uint64_t pc;
+
+	if (dt_printf(dtp, fp, "\n") < 0)
+		return (-1);
+
+	if (format == NULL)
+		format = "%s";
+
+	if (dtp->dt_options[DTRACEOPT_STACKINDENT] != DTRACEOPT_UNSET)
+		indent = (int)dtp->dt_options[DTRACEOPT_STACKINDENT];
+	else
+		indent = _dtrace_stkindent;
+
+	for (i = 0; i < depth; i++) {
+		switch (size) {
+		case sizeof (uint32_t):
+			/* LINTED - alignment */
+			pc = *((uint32_t *)addr);
+			break;
+
+		case sizeof (uint64_t):
+			/* LINTED - alignment */
+			pc = *((uint64_t *)addr);
+			break;
+
+		default:
+			return (dt_set_errno(dtp, EDT_BADSTACKPC));
+		}
+
+		if (pc == 0 /*VBOX: NULL is a ptr */)
+			break;
+
+		addr += size;
+
+		if (dt_printf(dtp, fp, "%*s", indent, "") < 0)
+			return (-1);
+
+		if (dtrace_lookup_by_addr(dtp, pc, &sym, &dts) == 0) {
+			if (pc > sym.st_value) {
+				(void) snprintf(c, sizeof (c), "%s`%s+0x%llx",
+				    dts.dts_object, dts.dts_name,
+				    pc - sym.st_value);
+			} else {
+				(void) snprintf(c, sizeof (c), "%s`%s",
+				    dts.dts_object, dts.dts_name);
+			}
+		} else {
+			/*
+			 * We'll repeat the lookup, but this time we'll specify
+			 * a NULL GElf_Sym -- indicating that we're only
+			 * interested in the containing module.
+			 */
+			if (dtrace_lookup_by_addr(dtp, pc, NULL, &dts) == 0) {
+				(void) snprintf(c, sizeof (c), "%s`0x%llx",
+				    dts.dts_object, pc);
+			} else {
+				(void) snprintf(c, sizeof (c), "0x%llx", pc);
+			}
+		}
+
+		if (dt_printf(dtp, fp, format, c) < 0)
+			return (-1);
+
+		if (dt_printf(dtp, fp, "\n") < 0)
+			return (-1);
+	}
+
+	return (0);
+}
+
+int
+dt_print_ustack(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    caddr_t addr, uint64_t arg)
+{
+	/* LINTED - alignment */
+	uint64_t *pc = (uint64_t *)addr;
+	uint32_t depth = DTRACE_USTACK_NFRAMES(arg);
+	uint32_t strsize = DTRACE_USTACK_STRSIZE(arg);
+	const char *strbase = addr + (depth + 1) * sizeof (uint64_t);
+	const char *str = strsize ? strbase : NULL;
+	int err = 0;
+
+#ifndef VBOX
+	char name[PATH_MAX], objname[PATH_MAX], c[PATH_MAX * 2];
+	struct ps_prochandle *P;
+	GElf_Sym sym;
+#else
+	char c[PATH_MAX * 2];
+#endif
+	int i, indent;
+	pid_t pid;
+
+	if (depth == 0)
+		return (0);
+
+	pid = (pid_t)*pc++;
+
+	if (dt_printf(dtp, fp, "\n") < 0)
+		return (-1);
+
+	if (format == NULL)
+		format = "%s";
+
+	if (dtp->dt_options[DTRACEOPT_STACKINDENT] != DTRACEOPT_UNSET)
+		indent = (int)dtp->dt_options[DTRACEOPT_STACKINDENT];
+	else
+		indent = _dtrace_stkindent;
+
+	/*
+	 * Ultimately, we need to add an entry point in the library vector for
+	 * determining <symbol, offset> from <pid, address>.  For now, if
+	 * this is a vector open, we just print the raw address or string.
+	 */
+#ifndef VBOX
+	if (dtp->dt_vector == NULL)
+		P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, 0);
+	else
+		P = NULL;
+
+	if (P != NULL)
+		dt_proc_lock(dtp, P); /* lock handle while we perform lookups */
+#endif
+
+	for (i = 0; VBDTCAST(uint_t)i < depth && pc[i] != 0/*NULL*/; i++) {
+#ifndef VBOX
+		const prmap_t *map;
+#endif
+
+		if ((err = dt_printf(dtp, fp, "%*s", indent, "")) < 0)
+			break;
+
+#ifndef VBOX
+		if (P != NULL && Plookup_by_addr(P, pc[i],
+		    name, sizeof (name), &sym) == 0) {
+			(void) Pobjname(P, pc[i], objname, sizeof (objname));
+
+			if (pc[i] > sym.st_value) {
+				(void) snprintf(c, sizeof (c),
+				    "%s`%s+0x%llx", dt_basename(objname), name,
+				    (u_longlong_t)(pc[i] - sym.st_value));
+			} else {
+				(void) snprintf(c, sizeof (c),
+				    "%s`%s", dt_basename(objname), name);
+			}
+		} else if (str != NULL && str[0] != '\0' && str[0] != '@' &&
+		    (P != NULL && ((map = Paddr_to_map(P, pc[i])) == NULL ||
+		    (map->pr_mflags & MA_WRITE)))) {
+			/*
+			 * If the current string pointer in the string table
+			 * does not point to an empty string _and_ the program
+			 * counter falls in a writable region, we'll use the
+			 * string from the string table instead of the raw
+			 * address.  This last condition is necessary because
+			 * some (broken) ustack helpers will return a string
+			 * even for a program counter that they can't
+			 * identify.  If we have a string for a program
+			 * counter that falls in a segment that isn't
+			 * writable, we assume that we have fallen into this
+			 * case and we refuse to use the string.
+			 */
+			(void) snprintf(c, sizeof (c), "%s", str);
+		} else {
+			if (P != NULL && Pobjname(P, pc[i], objname,
+			    sizeof (objname)) != NULL) {
+				(void) snprintf(c, sizeof (c), "%s`0x%llx",
+				    dt_basename(objname), (u_longlong_t)pc[i]);
+			} else {
+#else
+		{	{
+#endif
+				(void) snprintf(c, sizeof (c), "0x%llx",
+				    (u_longlong_t)pc[i]);
+			}
+		}
+
+		if ((err = dt_printf(dtp, fp, format, c)) < 0)
+			break;
+
+		if ((err = dt_printf(dtp, fp, "\n")) < 0)
+			break;
+
+		if (str != NULL && str[0] == '@') {
+			/*
+			 * If the first character of the string is an "at" sign,
+			 * then the string is inferred to be an annotation --
+			 * and it is printed out beneath the frame and offset
+			 * with brackets.
+			 */
+			if ((err = dt_printf(dtp, fp, "%*s", indent, "")) < 0)
+				break;
+
+			(void) snprintf(c, sizeof (c), "  [ %s ]", &str[1]);
+
+			if ((err = dt_printf(dtp, fp, format, c)) < 0)
+				break;
+
+			if ((err = dt_printf(dtp, fp, "\n")) < 0)
+				break;
+		}
+
+		if (str != NULL) {
+			str += strlen(str) + 1;
+			if (str - strbase >= strsize)
+				str = NULL;
+		}
+	}
+
+#ifndef VBOX
+	if (P != NULL) {
+		dt_proc_unlock(dtp, P);
+		dt_proc_release(dtp, P);
+	}
+#endif
+
+	return (err);
+}
+
+static int
+dt_print_usym(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr, dtrace_actkind_t act)
+{
+	/* LINTED - alignment */
+	uint64_t pid = ((uint64_t *)addr)[0];
+	/* LINTED - alignment */
+	uint64_t pc = ((uint64_t *)addr)[1];
+	const char *format = "  %-50s";
+	char *s;
+	int n, len = 256;
+
+#ifndef VBOX
+	if (act == DTRACEACT_USYM && dtp->dt_vector == NULL) {
+		struct ps_prochandle *P;
+
+		if ((P = dt_proc_grab(dtp, pid,
+		    PGRAB_RDONLY | PGRAB_FORCE, 0)) != NULL) {
+			GElf_Sym sym;
+
+			dt_proc_lock(dtp, P);
+
+			if (Plookup_by_addr(P, pc, NULL, 0, &sym) == 0)
+				pc = sym.st_value;
+
+			dt_proc_unlock(dtp, P);
+			dt_proc_release(dtp, P);
+		}
+	}
+#endif
+
+	do {
+		n = len;
+		s = alloca(n);
+	} while ((len = dtrace_uaddr2str(dtp, pid, pc, s, n)) > n);
+
+	return (dt_printf(dtp, fp, format, s));
+}
+
+int
+dt_print_umod(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
+{
+	/* LINTED - alignment */
+	uint64_t pid = ((uint64_t *)addr)[0];
+	/* LINTED - alignment */
+	uint64_t pc = ((uint64_t *)addr)[1];
+	int err = 0;
+
+#ifndef VBOX
+	char objname[PATH_MAX], c[PATH_MAX * 2];
+	struct ps_prochandle *P;
+#else
+	char c[64];
+#endif
+
+	if (format == NULL)
+		format = "  %-50s";
+
+#ifndef VBOX
+	/*
+	 * See the comment in dt_print_ustack() for the rationale for
+	 * printing raw addresses in the vectored case.
+	 */
+	if (dtp->dt_vector == NULL)
+		P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, 0);
+	else
+		P = NULL;
+
+	if (P != NULL)
+		dt_proc_lock(dtp, P); /* lock handle while we perform lookups */
+
+	if (P != NULL && Pobjname(P, pc, objname, sizeof (objname)) != NULL) {
+		(void) snprintf(c, sizeof (c), "%s", dt_basename(objname));
+	} else {
+		(void) snprintf(c, sizeof (c), "0x%llx", (u_longlong_t)pc);
+	}
+
+	err = dt_printf(dtp, fp, format, c);
+
+	if (P != NULL) {
+		dt_proc_unlock(dtp, P);
+		dt_proc_release(dtp, P);
+	}
+#else  /* VBOX */
+	snprintf(c, sizeof (c), "0x%llx", (u_longlong_t)pc);
+	err = dt_printf(dtp, fp, format, c);
+#endif /* VBOX */
+
+	return (err);
+}
+
+static int
+dt_print_sym(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
+{
+	/* LINTED - alignment */
+	uint64_t pc = *((uint64_t *)addr);
+	dtrace_syminfo_t dts;
+	GElf_Sym sym;
+	char c[PATH_MAX * 2];
+
+	if (format == NULL)
+		format = "  %-50s";
+
+	if (dtrace_lookup_by_addr(dtp, pc, &sym, &dts) == 0) {
+		(void) snprintf(c, sizeof (c), "%s`%s",
+		    dts.dts_object, dts.dts_name);
+	} else {
+		/*
+		 * We'll repeat the lookup, but this time we'll specify a
+		 * NULL GElf_Sym -- indicating that we're only interested in
+		 * the containing module.
+		 */
+		if (dtrace_lookup_by_addr(dtp, pc, NULL, &dts) == 0) {
+			(void) snprintf(c, sizeof (c), "%s`0x%llx",
+			    dts.dts_object, (u_longlong_t)pc);
+		} else {
+			(void) snprintf(c, sizeof (c), "0x%llx",
+			    (u_longlong_t)pc);
+		}
+	}
+
+	if (dt_printf(dtp, fp, format, c) < 0)
+		return (-1);
+
+	return (0);
+}
+
+int
+dt_print_mod(dtrace_hdl_t *dtp, FILE *fp, const char *format, caddr_t addr)
+{
+	/* LINTED - alignment */
+	uint64_t pc = *((uint64_t *)addr);
+	dtrace_syminfo_t dts;
+	char c[PATH_MAX * 2];
+
+	if (format == NULL)
+		format = "  %-50s";
+
+	if (dtrace_lookup_by_addr(dtp, pc, NULL, &dts) == 0) {
+		(void) snprintf(c, sizeof (c), "%s", dts.dts_object);
+	} else {
+		(void) snprintf(c, sizeof (c), "0x%llx", (u_longlong_t)pc);
+	}
+
+	if (dt_printf(dtp, fp, format, c) < 0)
+		return (-1);
+
+	return (0);
+}
+
+typedef struct dt_normal {
+	dtrace_aggvarid_t dtnd_id;
+	uint64_t dtnd_normal;
+} dt_normal_t;
+
+static int
+dt_normalize_agg(const dtrace_aggdata_t *aggdata, void *arg)
+{
+	dt_normal_t *normal = arg;
+	dtrace_aggdesc_t *agg = aggdata->dtada_desc;
+	dtrace_aggvarid_t id = normal->dtnd_id;
+
+	if (agg->dtagd_nrecs == 0)
+		return (DTRACE_AGGWALK_NEXT);
+
+	if (agg->dtagd_varid != id)
+		return (DTRACE_AGGWALK_NEXT);
+
+	((dtrace_aggdata_t *)aggdata)->dtada_normal = normal->dtnd_normal;
+	return (DTRACE_AGGWALK_NORMALIZE);
+}
+
+static int
+dt_normalize(dtrace_hdl_t *dtp, caddr_t base, dtrace_recdesc_t *rec)
+{
+	dt_normal_t normal;
+	caddr_t addr;
+
+	/*
+	 * We (should) have two records:  the aggregation ID followed by the
+	 * normalization value.
+	 */
+	addr = base + rec->dtrd_offset;
+
+	if (rec->dtrd_size != sizeof (dtrace_aggvarid_t))
+		return (dt_set_errno(dtp, EDT_BADNORMAL));
+
+	/* LINTED - alignment */
+	normal.dtnd_id = *((dtrace_aggvarid_t *)addr);
+	rec++;
+
+	if (rec->dtrd_action != DTRACEACT_LIBACT)
+		return (dt_set_errno(dtp, EDT_BADNORMAL));
+
+	if (rec->dtrd_arg != DT_ACT_NORMALIZE)
+		return (dt_set_errno(dtp, EDT_BADNORMAL));
+
+	addr = base + rec->dtrd_offset;
+
+	switch (rec->dtrd_size) {
+	case sizeof (uint64_t):
+		/* LINTED - alignment */
+		normal.dtnd_normal = *((uint64_t *)addr);
+		break;
+	case sizeof (uint32_t):
+		/* LINTED - alignment */
+		normal.dtnd_normal = *((uint32_t *)addr);
+		break;
+	case sizeof (uint16_t):
+		/* LINTED - alignment */
+		normal.dtnd_normal = *((uint16_t *)addr);
+		break;
+	case sizeof (uint8_t):
+		normal.dtnd_normal = *((uint8_t *)addr);
+		break;
+	default:
+		return (dt_set_errno(dtp, EDT_BADNORMAL));
+	}
+
+	(void) dtrace_aggregate_walk(dtp, dt_normalize_agg, &normal);
+
+	return (0);
+}
+
+static int
+dt_denormalize_agg(const dtrace_aggdata_t *aggdata, void *arg)
+{
+	dtrace_aggdesc_t *agg = aggdata->dtada_desc;
+	dtrace_aggvarid_t id = *((dtrace_aggvarid_t *)arg);
+
+	if (agg->dtagd_nrecs == 0)
+		return (DTRACE_AGGWALK_NEXT);
+
+	if (agg->dtagd_varid != id)
+		return (DTRACE_AGGWALK_NEXT);
+
+	return (DTRACE_AGGWALK_DENORMALIZE);
+}
+
+static int
+dt_clear_agg(const dtrace_aggdata_t *aggdata, void *arg)
+{
+	dtrace_aggdesc_t *agg = aggdata->dtada_desc;
+	dtrace_aggvarid_t id = *((dtrace_aggvarid_t *)arg);
+
+	if (agg->dtagd_nrecs == 0)
+		return (DTRACE_AGGWALK_NEXT);
+
+	if (agg->dtagd_varid != id)
+		return (DTRACE_AGGWALK_NEXT);
+
+	return (DTRACE_AGGWALK_CLEAR);
+}
+
+typedef struct dt_trunc {
+	dtrace_aggvarid_t dttd_id;
+	uint64_t dttd_remaining;
+} dt_trunc_t;
+
+static int
+dt_trunc_agg(const dtrace_aggdata_t *aggdata, void *arg)
+{
+	dt_trunc_t *trunc = arg;
+	dtrace_aggdesc_t *agg = aggdata->dtada_desc;
+	dtrace_aggvarid_t id = trunc->dttd_id;
+
+	if (agg->dtagd_nrecs == 0)
+		return (DTRACE_AGGWALK_NEXT);
+
+	if (agg->dtagd_varid != id)
+		return (DTRACE_AGGWALK_NEXT);
+
+	if (trunc->dttd_remaining == 0)
+		return (DTRACE_AGGWALK_REMOVE);
+
+	trunc->dttd_remaining--;
+	return (DTRACE_AGGWALK_NEXT);
+}
+
+static int
+dt_trunc(dtrace_hdl_t *dtp, caddr_t base, dtrace_recdesc_t *rec)
+{
+	dt_trunc_t trunc;
+	caddr_t addr;
+	int64_t remaining;
+	int (*func)(dtrace_hdl_t *, dtrace_aggregate_f *, void *);
+
+	/*
+	 * We (should) have two records:  the aggregation ID followed by the
+	 * number of aggregation entries after which the aggregation is to be
+	 * truncated.
+	 */
+	addr = base + rec->dtrd_offset;
+
+	if (rec->dtrd_size != sizeof (dtrace_aggvarid_t))
+		return (dt_set_errno(dtp, EDT_BADTRUNC));
+
+	/* LINTED - alignment */
+	trunc.dttd_id = *((dtrace_aggvarid_t *)addr);
+	rec++;
+
+	if (rec->dtrd_action != DTRACEACT_LIBACT)
+		return (dt_set_errno(dtp, EDT_BADTRUNC));
+
+	if (rec->dtrd_arg != DT_ACT_TRUNC)
+		return (dt_set_errno(dtp, EDT_BADTRUNC));
+
+	addr = base + rec->dtrd_offset;
+
+	switch (rec->dtrd_size) {
+	case sizeof (uint64_t):
+		/* LINTED - alignment */
+		remaining = *((int64_t *)addr);
+		break;
+	case sizeof (uint32_t):
+		/* LINTED - alignment */
+		remaining = *((int32_t *)addr);
+		break;
+	case sizeof (uint16_t):
+		/* LINTED - alignment */
+		remaining = *((int16_t *)addr);
+		break;
+	case sizeof (uint8_t):
+		remaining = *((int8_t *)addr);
+		break;
+	default:
+		return (dt_set_errno(dtp, EDT_BADNORMAL));
+	}
+
+	if (remaining < 0) {
+		func = dtrace_aggregate_walk_valsorted;
+		remaining = -remaining;
+	} else {
+		func = dtrace_aggregate_walk_valrevsorted;
+	}
+
+	assert(remaining >= 0);
+	trunc.dttd_remaining = remaining;
+
+	(void) func(dtp, dt_trunc_agg, &trunc);
+
+	return (0);
+}
+
+static int
+dt_print_datum(dtrace_hdl_t *dtp, FILE *fp, dtrace_recdesc_t *rec,
+    caddr_t addr, size_t size, uint64_t normal)
+{
+	int err;
+	dtrace_actkind_t act = rec->dtrd_action;
+
+	switch (act) {
+	case DTRACEACT_STACK:
+		return (dt_print_stack(dtp, fp, NULL, addr,
+		    rec->dtrd_arg, rec->dtrd_size / rec->dtrd_arg));
+
+	case DTRACEACT_USTACK:
+	case DTRACEACT_JSTACK:
+		return (dt_print_ustack(dtp, fp, NULL, addr, rec->dtrd_arg));
+
+	case DTRACEACT_USYM:
+	case DTRACEACT_UADDR:
+		return (dt_print_usym(dtp, fp, addr, act));
+
+	case DTRACEACT_UMOD:
+		return (dt_print_umod(dtp, fp, NULL, addr));
+
+	case DTRACEACT_SYM:
+		return (dt_print_sym(dtp, fp, NULL, addr));
+
+	case DTRACEACT_MOD:
+		return (dt_print_mod(dtp, fp, NULL, addr));
+
+	case DTRACEAGG_QUANTIZE:
+		return (dt_print_quantize(dtp, fp, addr, size, normal));
+
+	case DTRACEAGG_LQUANTIZE:
+		return (dt_print_lquantize(dtp, fp, addr, size, normal));
+
+	case DTRACEAGG_AVG:
+		return (dt_print_average(dtp, fp, addr, size, normal));
+
+	case DTRACEAGG_STDDEV:
+		return (dt_print_stddev(dtp, fp, addr, size, normal));
+
+	default:
+		break;
+	}
+
+	switch (size) {
+	case sizeof (uint64_t):
+		err = dt_printf(dtp, fp, " %16lld",
+		    /* LINTED - alignment */
+		    (long long)*((uint64_t *)addr) / normal);
+		break;
+	case sizeof (uint32_t):
+		/* LINTED - alignment */
+		err = dt_printf(dtp, fp, " %8d", *((uint32_t *)addr) /
+		    (uint32_t)normal);
+		break;
+	case sizeof (uint16_t):
+		/* LINTED - alignment */
+		err = dt_printf(dtp, fp, " %5d", *((uint16_t *)addr) /
+		    (uint32_t)normal);
+		break;
+	case sizeof (uint8_t):
+		err = dt_printf(dtp, fp, " %3d", *((uint8_t *)addr) /
+		    (uint32_t)normal);
+		break;
+	default:
+		err = dt_print_bytes(dtp, fp, addr, size, 50, 0);
+		break;
+	}
+
+	return (err);
+}
+
+int
+dt_print_aggs(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg)
+{
+	int i, aggact = 0;
+	dt_print_aggdata_t *pd = arg;
+	const dtrace_aggdata_t *aggdata = aggsdata[0];
+	dtrace_aggdesc_t *agg = aggdata->dtada_desc;
+	FILE *fp = pd->dtpa_fp;
+	dtrace_hdl_t *dtp = pd->dtpa_dtp;
+	dtrace_recdesc_t *rec;
+	dtrace_actkind_t act;
+	caddr_t addr;
+	size_t size;
+
+	/*
+	 * Iterate over each record description in the key, printing the traced
+	 * data, skipping the first datum (the tuple member created by the
+	 * compiler).
+	 */
+	for (i = 1; i < agg->dtagd_nrecs; i++) {
+		rec = &agg->dtagd_rec[i];
+		act = rec->dtrd_action;
+		addr = aggdata->dtada_data + rec->dtrd_offset;
+		size = rec->dtrd_size;
+
+		if (DTRACEACT_ISAGG(act)) {
+			aggact = i;
+			break;
+		}
+
+		if (dt_print_datum(dtp, fp, rec, addr, size, 1) < 0)
+			return (-1);
+
+		if (dt_buffered_flush(dtp, NULL, rec, aggdata,
+		    DTRACE_BUFDATA_AGGKEY) < 0)
+			return (-1);
+	}
+
+	assert(aggact != 0);
+
+	for (i = (naggvars == 1 ? 0 : 1); i < naggvars; i++) {
+		uint64_t normal;
+
+		aggdata = aggsdata[i];
+		agg = aggdata->dtada_desc;
+		rec = &agg->dtagd_rec[aggact];
+		act = rec->dtrd_action;
+		addr = aggdata->dtada_data + rec->dtrd_offset;
+		size = rec->dtrd_size;
+
+		assert(DTRACEACT_ISAGG(act));
+		normal = aggdata->dtada_normal;
+
+		if (dt_print_datum(dtp, fp, rec, addr, size, normal) < 0)
+			return (-1);
+
+		if (dt_buffered_flush(dtp, NULL, rec, aggdata,
+		    DTRACE_BUFDATA_AGGVAL) < 0)
+			return (-1);
+
+		if (!pd->dtpa_allunprint)
+			agg->dtagd_flags |= DTRACE_AGD_PRINTED;
+	}
+
+	if (dt_printf(dtp, fp, "\n") < 0)
+		return (-1);
+
+	if (dt_buffered_flush(dtp, NULL, NULL, aggdata,
+	    DTRACE_BUFDATA_AGGFORMAT | DTRACE_BUFDATA_AGGLAST) < 0)
+		return (-1);
+
+	return (0);
+}
+
+int
+dt_print_agg(const dtrace_aggdata_t *aggdata, void *arg)
+{
+	dt_print_aggdata_t *pd = arg;
+	dtrace_aggdesc_t *agg = aggdata->dtada_desc;
+	dtrace_aggvarid_t aggvarid = pd->dtpa_id;
+
+	if (pd->dtpa_allunprint) {
+		if (agg->dtagd_flags & DTRACE_AGD_PRINTED)
+			return (0);
+	} else {
+		/*
+		 * If we're not printing all unprinted aggregations, then the
+		 * aggregation variable ID denotes a specific aggregation
+		 * variable that we should print -- skip any other aggregations
+		 * that we encounter.
+		 */
+		if (agg->dtagd_nrecs == 0)
+			return (0);
+
+		if (aggvarid != agg->dtagd_varid)
+			return (0);
+	}
+
+	return (dt_print_aggs(&aggdata, 1, arg));
+}
+
+int
+dt_setopt(dtrace_hdl_t *dtp, const dtrace_probedata_t *data,
+    const char *option, const char *value)
+{
+#ifndef VBOX
+	int len, rval;
+#else
+	size_t len;
+	int rval;
+#endif
+	char *msg;
+	const char *errstr;
+	dtrace_setoptdata_t optdata;
+
+	bzero(&optdata, sizeof (optdata));
+	(void) dtrace_getopt(dtp, option, &optdata.dtsda_oldval);
+
+	if (dtrace_setopt(dtp, option, value) == 0) {
+		(void) dtrace_getopt(dtp, option, &optdata.dtsda_newval);
+		optdata.dtsda_probe = data;
+		optdata.dtsda_option = option;
+		optdata.dtsda_handle = dtp;
+
+		if ((rval = dt_handle_setopt(dtp, &optdata)) != 0)
+			return (rval);
+
+		return (0);
+	}
+
+	errstr = dtrace_errmsg(dtp, dtrace_errno(dtp));
+	len = strlen(option) + strlen(value) + strlen(errstr) + 80;
+	msg = alloca(len);
+
+	(void) snprintf(msg, len, "couldn't set option \"%s\" to \"%s\": %s\n",
+	    option, value, errstr);
+
+	if ((rval = dt_handle_liberr(dtp, data, msg)) == 0)
+		return (0);
+
+	return (rval);
+}
+
+static int
+dt_consume_cpu(dtrace_hdl_t *dtp, FILE *fp, int cpu, dtrace_bufdesc_t *buf,
+    dtrace_consume_probe_f *efunc, dtrace_consume_rec_f *rfunc, void *arg)
+{
+	dtrace_epid_t id;
+	size_t offs, start = buf->dtbd_oldest, end = buf->dtbd_size;
+	int flow = (dtp->dt_options[DTRACEOPT_FLOWINDENT] != DTRACEOPT_UNSET);
+	int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
+	int rval, i, n;
+	dtrace_epid_t last = DTRACE_EPIDNONE;
+	dtrace_probedata_t data;
+	uint64_t drops;
+	caddr_t addr;
+
+	bzero(&data, sizeof (data));
+	data.dtpda_handle = dtp;
+	data.dtpda_cpu = cpu;
+
+again:
+	for (offs = start; offs < end; ) {
+		dtrace_eprobedesc_t *epd;
+
+		/*
+		 * We're guaranteed to have an ID.
+		 */
+		id = *(uint32_t *)((uintptr_t)buf->dtbd_data + offs);
+
+		if (id == DTRACE_EPIDNONE) {
+			/*
+			 * This is filler to assure proper alignment of the
+			 * next record; we simply ignore it.
+			 */
+			offs += sizeof (id);
+			continue;
+		}
+
+		if ((rval = dt_epid_lookup(dtp, id, &data.dtpda_edesc,
+		    &data.dtpda_pdesc)) != 0)
+			return (rval);
+
+		epd = data.dtpda_edesc;
+		data.dtpda_data = buf->dtbd_data + offs;
+
+		if (data.dtpda_edesc->dtepd_uarg != DT_ECB_DEFAULT) {
+			rval = dt_handle(dtp, &data);
+
+			if (rval == DTRACE_CONSUME_NEXT)
+				goto nextepid;
+
+			if (rval == DTRACE_CONSUME_ERROR)
+				return (-1);
+		}
+
+		if (flow)
+			(void) dt_flowindent(dtp, &data, last, buf, offs);
+
+		rval = (*efunc)(&data, arg);
+
+		if (flow) {
+			if (data.dtpda_flow == DTRACEFLOW_ENTRY)
+				data.dtpda_indent += 2;
+		}
+
+		if (rval == DTRACE_CONSUME_NEXT)
+			goto nextepid;
+
+		if (rval == DTRACE_CONSUME_ABORT)
+			return (dt_set_errno(dtp, EDT_DIRABORT));
+
+		if (rval != DTRACE_CONSUME_THIS)
+			return (dt_set_errno(dtp, EDT_BADRVAL));
+
+		for (i = 0; i < epd->dtepd_nrecs; i++) {
+			dtrace_recdesc_t *rec = &epd->dtepd_rec[i];
+			dtrace_actkind_t act = rec->dtrd_action;
+
+			data.dtpda_data = buf->dtbd_data + offs +
+			    rec->dtrd_offset;
+			addr = data.dtpda_data;
+
+			if (act == DTRACEACT_LIBACT) {
+				uint64_t arg = rec->dtrd_arg;
+				dtrace_aggvarid_t id;
+
+				switch (arg) {
+				case DT_ACT_CLEAR:
+					/* LINTED - alignment */
+					id = *((dtrace_aggvarid_t *)addr);
+					(void) dtrace_aggregate_walk(dtp,
+					    dt_clear_agg, &id);
+					continue;
+
+				case DT_ACT_DENORMALIZE:
+					/* LINTED - alignment */
+					id = *((dtrace_aggvarid_t *)addr);
+					(void) dtrace_aggregate_walk(dtp,
+					    dt_denormalize_agg, &id);
+					continue;
+
+				case DT_ACT_FTRUNCATE:
+					if (fp == NULL)
+						continue;
+
+					(void) fflush(fp);
+					(void) ftruncate(fileno(fp), 0);
+					(void) fseeko(fp, 0, SEEK_SET);
+					continue;
+
+				case DT_ACT_NORMALIZE:
+					if (i == epd->dtepd_nrecs - 1)
+						return (dt_set_errno(dtp,
+						    EDT_BADNORMAL));
+
+					if (dt_normalize(dtp,
+					    buf->dtbd_data + offs, rec) != 0)
+						return (-1);
+
+					i++;
+					continue;
+
+				case DT_ACT_SETOPT: {
+					uint64_t *opts = dtp->dt_options;
+					dtrace_recdesc_t *valrec;
+					uint32_t valsize;
+					caddr_t val;
+					int rv;
+
+					if (i == epd->dtepd_nrecs - 1) {
+						return (dt_set_errno(dtp,
+						    EDT_BADSETOPT));
+					}
+
+					valrec = &epd->dtepd_rec[++i];
+					valsize = valrec->dtrd_size;
+
+					if (valrec->dtrd_action != act ||
+					    valrec->dtrd_arg != arg) {
+						return (dt_set_errno(dtp,
+						    EDT_BADSETOPT));
+					}
+
+					if (valsize > sizeof (uint64_t)) {
+						val = buf->dtbd_data + offs +
+						    valrec->dtrd_offset;
+					} else {
+						val = "1";
+					}
+
+					rv = dt_setopt(dtp, &data, addr, val);
+
+					if (rv != 0)
+						return (-1);
+
+					flow = (opts[DTRACEOPT_FLOWINDENT] !=
+					    DTRACEOPT_UNSET);
+					quiet = (opts[DTRACEOPT_QUIET] !=
+					    DTRACEOPT_UNSET);
+
+					continue;
+				}
+
+				case DT_ACT_TRUNC:
+					if (i == epd->dtepd_nrecs - 1)
+						return (dt_set_errno(dtp,
+						    EDT_BADTRUNC));
+
+					if (dt_trunc(dtp,
+					    buf->dtbd_data + offs, rec) != 0)
+						return (-1);
+
+					i++;
+					continue;
+
+				default:
+					continue;
+				}
+			}
+
+			rval = (*rfunc)(&data, rec, arg);
+
+			if (rval == DTRACE_CONSUME_NEXT)
+				continue;
+
+			if (rval == DTRACE_CONSUME_ABORT)
+				return (dt_set_errno(dtp, EDT_DIRABORT));
+
+			if (rval != DTRACE_CONSUME_THIS)
+				return (dt_set_errno(dtp, EDT_BADRVAL));
+
+			if (act == DTRACEACT_STACK) {
+				int depth = rec->dtrd_arg;
+
+				if (dt_print_stack(dtp, fp, NULL, addr, depth,
+				    rec->dtrd_size / depth) < 0)
+					return (-1);
+				goto nextrec;
+			}
+
+			if (act == DTRACEACT_USTACK ||
+			    act == DTRACEACT_JSTACK) {
+				if (dt_print_ustack(dtp, fp, NULL,
+				    addr, rec->dtrd_arg) < 0)
+					return (-1);
+				goto nextrec;
+			}
+
+			if (act == DTRACEACT_SYM) {
+				if (dt_print_sym(dtp, fp, NULL, addr) < 0)
+					return (-1);
+				goto nextrec;
+			}
+
+			if (act == DTRACEACT_MOD) {
+				if (dt_print_mod(dtp, fp, NULL, addr) < 0)
+					return (-1);
+				goto nextrec;
+			}
+
+			if (act == DTRACEACT_USYM || act == DTRACEACT_UADDR) {
+				if (dt_print_usym(dtp, fp, addr, act) < 0)
+					return (-1);
+				goto nextrec;
+			}
+
+			if (act == DTRACEACT_UMOD) {
+				if (dt_print_umod(dtp, fp, NULL, addr) < 0)
+					return (-1);
+				goto nextrec;
+			}
+
+			if (DTRACEACT_ISPRINTFLIKE(act)) {
+				void *fmtdata;
+				int (*func)(dtrace_hdl_t *, FILE *, void *,
+				    const dtrace_probedata_t *,
+				    const dtrace_recdesc_t *, uint_t,
+				    const void *buf, size_t);
+
+				if ((fmtdata = dt_format_lookup(dtp,
+				    rec->dtrd_format)) == NULL)
+					goto nofmt;
+
+				switch (act) {
+				case DTRACEACT_PRINTF:
+					func = dtrace_fprintf;
+					break;
+				case DTRACEACT_PRINTA:
+					func = dtrace_fprinta;
+					break;
+				case DTRACEACT_SYSTEM:
+					func = dtrace_system;
+					break;
+				case DTRACEACT_FREOPEN:
+					func = dtrace_freopen;
+					break;
+				}
+
+				n = (*func)(dtp, fp, fmtdata, &data,
+				    rec, epd->dtepd_nrecs - i,
+				    (uchar_t *)buf->dtbd_data + offs,
+				    buf->dtbd_size - offs);
+
+				if (n < 0)
+					return (-1); /* errno is set for us */
+
+				if (n > 0)
+					i += n - 1;
+				goto nextrec;
+			}
+
+nofmt:
+			if (act == DTRACEACT_PRINTA) {
+				dt_print_aggdata_t pd;
+				dtrace_aggvarid_t *aggvars;
+				int j, naggvars = 0;
+				size_t size = ((epd->dtepd_nrecs - i) *
+				    sizeof (dtrace_aggvarid_t));
+
+				if ((aggvars = dt_alloc(dtp, size)) == NULL)
+					return (-1);
+
+				/*
+				 * This might be a printa() with multiple
+				 * aggregation variables.  We need to scan
+				 * forward through the records until we find
+				 * a record from a different statement.
+				 */
+				for (j = i; j < epd->dtepd_nrecs; j++) {
+					dtrace_recdesc_t *nrec;
+					caddr_t naddr;
+
+					nrec = &epd->dtepd_rec[j];
+
+					if (nrec->dtrd_uarg != rec->dtrd_uarg)
+						break;
+
+					if (nrec->dtrd_action != act) {
+						return (dt_set_errno(dtp,
+						    EDT_BADAGG));
+					}
+
+					naddr = buf->dtbd_data + offs +
+					    nrec->dtrd_offset;
+
+					aggvars[naggvars++] =
+					    /* LINTED - alignment */
+					    *((dtrace_aggvarid_t *)naddr);
+				}
+
+				i = j - 1;
+				bzero(&pd, sizeof (pd));
+				pd.dtpa_dtp = dtp;
+				pd.dtpa_fp = fp;
+
+				assert(naggvars >= 1);
+
+				if (naggvars == 1) {
+					pd.dtpa_id = aggvars[0];
+					dt_free(dtp, aggvars);
+
+					if (dt_printf(dtp, fp, "\n") < 0 ||
+					    dtrace_aggregate_walk_sorted(dtp,
+					    dt_print_agg, &pd) < 0)
+						return (-1);
+					goto nextrec;
+				}
+
+				if (dt_printf(dtp, fp, "\n") < 0 ||
+				    dtrace_aggregate_walk_joined(dtp, aggvars,
+				    naggvars, dt_print_aggs, &pd) < 0) {
+					dt_free(dtp, aggvars);
+					return (-1);
+				}
+
+				dt_free(dtp, aggvars);
+				goto nextrec;
+			}
+
+			switch (rec->dtrd_size) {
+			case sizeof (uint64_t):
+				n = dt_printf(dtp, fp,
+				    quiet ? "%lld" : " %16lld",
+				    /* LINTED - alignment */
+				    *((unsigned long long *)addr));
+				break;
+			case sizeof (uint32_t):
+				n = dt_printf(dtp, fp, quiet ? "%d" : " %8d",
+				    /* LINTED - alignment */
+				    *((uint32_t *)addr));
+				break;
+			case sizeof (uint16_t):
+				n = dt_printf(dtp, fp, quiet ? "%d" : " %5d",
+				    /* LINTED - alignment */
+				    *((uint16_t *)addr));
+				break;
+			case sizeof (uint8_t):
+				n = dt_printf(dtp, fp, quiet ? "%d" : " %3d",
+				    *((uint8_t *)addr));
+				break;
+			default:
+				n = dt_print_bytes(dtp, fp, addr,
+				    rec->dtrd_size, 33, quiet);
+				break;
+			}
+
+			if (n < 0)
+				return (-1); /* errno is set for us */
+
+nextrec:
+			if (dt_buffered_flush(dtp, &data, rec, NULL, 0) < 0)
+				return (-1); /* errno is set for us */
+		}
+
+		/*
+		 * Call the record callback with a NULL record to indicate
+		 * that we're done processing this EPID.
+		 */
+		rval = (*rfunc)(&data, NULL, arg);
+nextepid:
+		offs += epd->dtepd_size;
+		last = id;
+	}
+
+	if (buf->dtbd_oldest != 0 && start == buf->dtbd_oldest) {
+		end = buf->dtbd_oldest;
+		start = 0;
+		goto again;
+	}
+
+	if ((drops = buf->dtbd_drops) == 0)
+		return (0);
+
+	/*
+	 * Explicitly zero the drops to prevent us from processing them again.
+	 */
+	buf->dtbd_drops = 0;
+
+	return (dt_handle_cpudrop(dtp, cpu, DTRACEDROP_PRINCIPAL, drops));
+}
+
+typedef struct dt_begin {
+	dtrace_consume_probe_f *dtbgn_probefunc;
+	dtrace_consume_rec_f *dtbgn_recfunc;
+	void *dtbgn_arg;
+	dtrace_handle_err_f *dtbgn_errhdlr;
+	void *dtbgn_errarg;
+	int dtbgn_beginonly;
+} dt_begin_t;
+
+static int
+dt_consume_begin_probe(const dtrace_probedata_t *data, void *arg)
+{
+	dt_begin_t *begin = (dt_begin_t *)arg;
+	dtrace_probedesc_t *pd = data->dtpda_pdesc;
+
+	int r1 = (strcmp(pd->dtpd_provider, "dtrace") == 0);
+	int r2 = (strcmp(pd->dtpd_name, "BEGIN") == 0);
+
+	if (begin->dtbgn_beginonly) {
+		if (!(r1 && r2))
+			return (DTRACE_CONSUME_NEXT);
+	} else {
+		if (r1 && r2)
+			return (DTRACE_CONSUME_NEXT);
+	}
+
+	/*
+	 * We have a record that we're interested in.  Now call the underlying
+	 * probe function...
+	 */
+	return (begin->dtbgn_probefunc(data, begin->dtbgn_arg));
+}
+
+static int
+dt_consume_begin_record(const dtrace_probedata_t *data,
+    const dtrace_recdesc_t *rec, void *arg)
+{
+	dt_begin_t *begin = (dt_begin_t *)arg;
+
+	return (begin->dtbgn_recfunc(data, rec, begin->dtbgn_arg));
+}
+
+static int
+dt_consume_begin_error(const dtrace_errdata_t *data, void *arg)
+{
+	dt_begin_t *begin = (dt_begin_t *)arg;
+	dtrace_probedesc_t *pd = data->dteda_pdesc;
+
+	int r1 = (strcmp(pd->dtpd_provider, "dtrace") == 0);
+	int r2 = (strcmp(pd->dtpd_name, "BEGIN") == 0);
+
+	if (begin->dtbgn_beginonly) {
+		if (!(r1 && r2))
+			return (DTRACE_HANDLE_OK);
+	} else {
+		if (r1 && r2)
+			return (DTRACE_HANDLE_OK);
+	}
+
+	return (begin->dtbgn_errhdlr(data, begin->dtbgn_errarg));
+}
+
+static int
+dt_consume_begin(dtrace_hdl_t *dtp, FILE *fp, dtrace_bufdesc_t *buf,
+    dtrace_consume_probe_f *pf, dtrace_consume_rec_f *rf, void *arg)
+{
+	/*
+	 * There's this idea that the BEGIN probe should be processed before
+	 * everything else, and that the END probe should be processed after
+	 * anything else.  In the common case, this is pretty easy to deal
+	 * with.  However, a situation may arise where the BEGIN enabling and
+	 * END enabling are on the same CPU, and some enabling in the middle
+	 * occurred on a different CPU.  To deal with this (blech!) we need to
+	 * consume the BEGIN buffer up until the end of the BEGIN probe, and
+	 * then set it aside.  We will then process every other CPU, and then
+	 * we'll return to the BEGIN CPU and process the rest of the data
+	 * (which will inevitably include the END probe, if any).  Making this
+	 * even more complicated (!) is the library's ERROR enabling.  Because
+	 * this enabling is processed before we even get into the consume call
+	 * back, any ERROR firing would result in the library's ERROR enabling
+	 * being processed twice -- once in our first pass (for BEGIN probes),
+	 * and again in our second pass (for everything but BEGIN probes).  To
+	 * deal with this, we interpose on the ERROR handler to assure that we
+	 * only process ERROR enablings induced by BEGIN enablings in the
+	 * first pass, and that we only process ERROR enablings _not_ induced
+	 * by BEGIN enablings in the second pass.
+	 */
+	dt_begin_t begin;
+	processorid_t cpu = dtp->dt_beganon;
+	dtrace_bufdesc_t nbuf;
+	int rval, i;
+	static int max_ncpus;
+	dtrace_optval_t size;
+
+	dtp->dt_beganon = -1;
+
+	if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
+		/*
+		 * We really don't expect this to fail, but it is at least
+		 * technically possible for this to fail with ENOENT.  In this
+		 * case, we just drive on...
+		 */
+		if (errno == ENOENT)
+			return (0);
+
+		return (dt_set_errno(dtp, errno));
+	}
+
+	if (!dtp->dt_stopped || buf->dtbd_cpu != dtp->dt_endedon) {
+		/*
+		 * This is the simple case.  We're either not stopped, or if
+		 * we are, we actually processed any END probes on another
+		 * CPU.  We can simply consume this buffer and return.
+		 */
+		return (dt_consume_cpu(dtp, fp, cpu, buf, pf, rf, arg));
+	}
+
+	begin.dtbgn_probefunc = pf;
+	begin.dtbgn_recfunc = rf;
+	begin.dtbgn_arg = arg;
+	begin.dtbgn_beginonly = 1;
+
+	/*
+	 * We need to interpose on the ERROR handler to be sure that we
+	 * only process ERRORs induced by BEGIN.
+	 */
+	begin.dtbgn_errhdlr = dtp->dt_errhdlr;
+	begin.dtbgn_errarg = dtp->dt_errarg;
+	dtp->dt_errhdlr = dt_consume_begin_error;
+	dtp->dt_errarg = &begin;
+
+	rval = dt_consume_cpu(dtp, fp, cpu, buf, dt_consume_begin_probe,
+	    dt_consume_begin_record, &begin);
+
+	dtp->dt_errhdlr = begin.dtbgn_errhdlr;
+	dtp->dt_errarg = begin.dtbgn_errarg;
+
+	if (rval != 0)
+		return (rval);
+
+	/*
+	 * Now allocate a new buffer.  We'll use this to deal with every other
+	 * CPU.
+	 */
+	bzero(&nbuf, sizeof (dtrace_bufdesc_t));
+	(void) dtrace_getopt(dtp, "bufsize", &size);
+	if ((nbuf.dtbd_data = malloc(size)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	if (max_ncpus == 0)
+#ifndef VBOX
+		max_ncpus = dt_sysconf(dtp, _SC_CPUID_MAX) + 1;
+#else
+		max_ncpus = RTMpGetMaxCpuId() + 1;
+#endif
+
+	for (i = 0; i < max_ncpus; i++) {
+		nbuf.dtbd_cpu = i;
+
+		if (i == cpu)
+			continue;
+
+		if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, &nbuf) == -1) {
+			/*
+			 * If we failed with ENOENT, it may be because the
+			 * CPU was unconfigured -- this is okay.  Any other
+			 * error, however, is unexpected.
+			 */
+			if (errno == ENOENT)
+				continue;
+
+			free(nbuf.dtbd_data);
+
+			return (dt_set_errno(dtp, errno));
+		}
+
+		if ((rval = dt_consume_cpu(dtp, fp,
+		    i, &nbuf, pf, rf, arg)) != 0) {
+			free(nbuf.dtbd_data);
+			return (rval);
+		}
+	}
+
+	free(nbuf.dtbd_data);
+
+	/*
+	 * Okay -- we're done with the other buffers.  Now we want to
+	 * reconsume the first buffer -- but this time we're looking for
+	 * everything _but_ BEGIN.  And of course, in order to only consume
+	 * those ERRORs _not_ associated with BEGIN, we need to reinstall our
+	 * ERROR interposition function...
+	 */
+	begin.dtbgn_beginonly = 0;
+
+	assert(begin.dtbgn_errhdlr == dtp->dt_errhdlr);
+	assert(begin.dtbgn_errarg == dtp->dt_errarg);
+	dtp->dt_errhdlr = dt_consume_begin_error;
+	dtp->dt_errarg = &begin;
+
+	rval = dt_consume_cpu(dtp, fp, cpu, buf, dt_consume_begin_probe,
+	    dt_consume_begin_record, &begin);
+
+	dtp->dt_errhdlr = begin.dtbgn_errhdlr;
+	dtp->dt_errarg = begin.dtbgn_errarg;
+
+	return (rval);
+}
+
+int
+dtrace_consume(dtrace_hdl_t *dtp, FILE *fp,
+    dtrace_consume_probe_f *pf, dtrace_consume_rec_f *rf, void *arg)
+{
+	dtrace_bufdesc_t *buf = &dtp->dt_buf;
+	dtrace_optval_t size;
+	static int max_ncpus;
+	int i, rval;
+	dtrace_optval_t interval = dtp->dt_options[DTRACEOPT_SWITCHRATE];
+	hrtime_t now = gethrtime();
+
+	if (dtp->dt_lastswitch != 0) {
+		if (now - dtp->dt_lastswitch < VBDTCAST(hrtime_t)interval)
+			return (0);
+
+		dtp->dt_lastswitch += interval;
+	} else {
+		dtp->dt_lastswitch = now;
+	}
+
+	if (!dtp->dt_active)
+		return (dt_set_errno(dtp, EINVAL));
+
+	if (max_ncpus == 0)
+#ifndef VBOX
+		max_ncpus = dt_sysconf(dtp, _SC_CPUID_MAX) + 1;
+#else
+		max_ncpus = RTMpGetMaxCpuId() + 1;
+#endif
+
+	if (pf == NULL)
+		pf = (dtrace_consume_probe_f *)dt_nullprobe;
+
+	if (rf == NULL)
+		rf = (dtrace_consume_rec_f *)dt_nullrec;
+
+	if (buf->dtbd_data == NULL) {
+		(void) dtrace_getopt(dtp, "bufsize", &size);
+		if ((buf->dtbd_data = malloc(size)) == NULL)
+			return (dt_set_errno(dtp, EDT_NOMEM));
+
+		buf->dtbd_size = size;
+	}
+
+	/*
+	 * If we have just begun, we want to first process the CPU that
+	 * executed the BEGIN probe (if any).
+	 */
+	if (dtp->dt_active && dtp->dt_beganon != -1) {
+		buf->dtbd_cpu = dtp->dt_beganon;
+		if ((rval = dt_consume_begin(dtp, fp, buf, pf, rf, arg)) != 0)
+			return (rval);
+	}
+
+	for (i = 0; i < max_ncpus; i++) {
+		buf->dtbd_cpu = i;
+
+		/*
+		 * If we have stopped, we want to process the CPU on which the
+		 * END probe was processed only _after_ we have processed
+		 * everything else.
+		 */
+		if (dtp->dt_stopped && (i == dtp->dt_endedon))
+			continue;
+
+		if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
+			/*
+			 * If we failed with ENOENT, it may be because the
+			 * CPU was unconfigured -- this is okay.  Any other
+			 * error, however, is unexpected.
+			 */
+			if (errno == ENOENT)
+				continue;
+
+			return (dt_set_errno(dtp, errno));
+		}
+
+		if ((rval = dt_consume_cpu(dtp, fp, i, buf, pf, rf, arg)) != 0)
+			return (rval);
+	}
+
+	if (!dtp->dt_stopped)
+		return (0);
+
+	buf->dtbd_cpu = dtp->dt_endedon;
+
+	if (dt_ioctl(dtp, DTRACEIOC_BUFSNAP, buf) == -1) {
+		/*
+		 * This _really_ shouldn't fail, but it is strictly speaking
+		 * possible for this to return ENOENT if the CPU that called
+		 * the END enabling somehow managed to become unconfigured.
+		 * It's unclear how the user can possibly expect anything
+		 * rational to happen in this case -- the state has been thrown
+		 * out along with the unconfigured CPU -- so we'll just drive
+		 * on...
+		 */
+		if (errno == ENOENT)
+			return (0);
+
+		return (dt_set_errno(dtp, errno));
+	}
+
+	return (dt_consume_cpu(dtp, fp, dtp->dt_endedon, buf, pf, rf, arg));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.c
new file mode 100644
index 0000000..9e8491a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.c
@@ -0,0 +1,1129 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <strings.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <alloca.h>
+#include <assert.h>
+#endif
+
+#include <dt_decl.h>
+#include <dt_parser.h>
+#include <dt_module.h>
+#include <dt_impl.h>
+
+static dt_decl_t *
+dt_decl_check(dt_decl_t *ddp)
+{
+	if (ddp->dd_kind == CTF_K_UNKNOWN)
+		return (ddp); /* nothing to check if the type is not yet set */
+
+	if (ddp->dd_name != NULL && strcmp(ddp->dd_name, "char") == 0 &&
+	    (ddp->dd_attr & (DT_DA_SHORT | DT_DA_LONG | DT_DA_LONGLONG))) {
+		xyerror(D_DECL_CHARATTR, "invalid type declaration: short and "
+		    "long may not be used with char type\n");
+	}
+
+	if (ddp->dd_name != NULL && strcmp(ddp->dd_name, "void") == 0 &&
+	    (ddp->dd_attr & (DT_DA_SHORT | DT_DA_LONG | DT_DA_LONGLONG |
+	    (DT_DA_SIGNED | DT_DA_UNSIGNED)))) {
+		xyerror(D_DECL_VOIDATTR, "invalid type declaration: attributes "
+		    "may not be used with void type\n");
+	}
+
+	if (ddp->dd_kind != CTF_K_INTEGER &&
+	    (ddp->dd_attr & (DT_DA_SIGNED | DT_DA_UNSIGNED))) {
+		xyerror(D_DECL_SIGNINT, "invalid type declaration: signed and "
+		    "unsigned may only be used with integer type\n");
+	}
+
+	if (ddp->dd_kind != CTF_K_INTEGER && ddp->dd_kind != CTF_K_FLOAT &&
+	    (ddp->dd_attr & (DT_DA_LONG | DT_DA_LONGLONG))) {
+		xyerror(D_DECL_LONGINT, "invalid type declaration: long and "
+		    "long long may only be used with integer or "
+		    "floating-point type\n");
+	}
+
+	return (ddp);
+}
+
+dt_decl_t *
+dt_decl_alloc(ushort_t kind, char *name)
+{
+	dt_decl_t *ddp = malloc(sizeof (dt_decl_t));
+
+	if (ddp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	ddp->dd_kind = kind;
+	ddp->dd_attr = 0;
+	ddp->dd_ctfp = NULL;
+	ddp->dd_type = CTF_ERR;
+	ddp->dd_name = name;
+	ddp->dd_node = NULL;
+	ddp->dd_next = NULL;
+
+	return (ddp);
+}
+
+void
+dt_decl_free(dt_decl_t *ddp)
+{
+	dt_decl_t *ndp;
+
+	for (; ddp != NULL; ddp = ndp) {
+		ndp = ddp->dd_next;
+		free(ddp->dd_name);
+		dt_node_list_free(&ddp->dd_node);
+		free(ddp);
+	}
+}
+
+void
+dt_decl_reset(void)
+{
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+	dt_decl_t *ddp = dsp->ds_decl;
+
+	while (ddp->dd_next != NULL) {
+		dsp->ds_decl = ddp->dd_next;
+		ddp->dd_next = NULL;
+		dt_decl_free(ddp);
+		ddp = dsp->ds_decl;
+	}
+}
+
+dt_decl_t *
+dt_decl_push(dt_decl_t *ddp)
+{
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+	dt_decl_t *top = dsp->ds_decl;
+
+	if (top != NULL &&
+	    top->dd_kind == CTF_K_UNKNOWN && top->dd_name == NULL) {
+		top->dd_kind = CTF_K_INTEGER;
+		(void) dt_decl_check(top);
+	}
+
+	assert(ddp->dd_next == NULL);
+	ddp->dd_next = top;
+	dsp->ds_decl = ddp;
+
+	return (ddp);
+}
+
+dt_decl_t *
+dt_decl_pop(void)
+{
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+	dt_decl_t *ddp = dt_decl_top();
+
+	dsp->ds_decl = NULL;
+	free(dsp->ds_ident);
+	dsp->ds_ident = NULL;
+	dsp->ds_ctfp = NULL;
+	dsp->ds_type = CTF_ERR;
+	dsp->ds_class = DT_DC_DEFAULT;
+	dsp->ds_enumval = -1;
+
+	return (ddp);
+}
+
+dt_decl_t *
+dt_decl_pop_param(char **idp)
+{
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+
+	if (dsp->ds_class != DT_DC_DEFAULT && dsp->ds_class != DT_DC_REGISTER) {
+		xyerror(D_DECL_PARMCLASS, "inappropriate storage class "
+		    "for function or associative array parameter\n");
+	}
+
+	if (idp != NULL && dt_decl_top() != NULL) {
+		*idp = dsp->ds_ident;
+		dsp->ds_ident = NULL;
+	}
+
+	return (dt_decl_pop());
+}
+
+dt_decl_t *
+dt_decl_top(void)
+{
+	dt_decl_t *ddp = yypcb->pcb_dstack.ds_decl;
+
+	if (ddp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NODECL);
+
+	if (ddp->dd_kind == CTF_K_UNKNOWN && ddp->dd_name == NULL) {
+		ddp->dd_kind = CTF_K_INTEGER;
+		(void) dt_decl_check(ddp);
+	}
+
+	return (ddp);
+}
+
+dt_decl_t *
+dt_decl_ident(char *name)
+{
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+	dt_decl_t *ddp = dsp->ds_decl;
+
+	if (dsp->ds_ident != NULL) {
+		free(name);
+		xyerror(D_DECL_IDENT, "old-style declaration or "
+		    "incorrect type specified\n");
+	}
+
+	dsp->ds_ident = name;
+
+	if (ddp == NULL)
+		ddp = dt_decl_push(dt_decl_alloc(CTF_K_UNKNOWN, NULL));
+
+	return (ddp);
+}
+
+void
+dt_decl_class(dt_dclass_t class)
+{
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+
+	if (dsp->ds_class != DT_DC_DEFAULT) {
+		xyerror(D_DECL_CLASS, "only one storage class allowed "
+		    "in a declaration\n");
+	}
+
+	dsp->ds_class = class;
+}
+
+/*
+ * Set the kind and name of the current declaration.  If none is allocated,
+ * make a new decl and push it on to the top of our stack.  If the name or kind
+ * is already set for the current decl, then we need to fail this declaration.
+ * This can occur because too many types were given (e.g. "int int"), etc.
+ */
+dt_decl_t *
+dt_decl_spec(ushort_t kind, char *name)
+{
+	dt_decl_t *ddp = yypcb->pcb_dstack.ds_decl;
+
+	if (ddp == NULL)
+		return (dt_decl_push(dt_decl_alloc(kind, name)));
+
+	/*
+	 * If we already have a type name specified and we see another type
+	 * name, this is an error if the declaration is a typedef.  If the
+	 * declaration is not a typedef, then the user may be trying to declare
+	 * a variable whose name has been returned by lex as a TNAME token:
+	 * call dt_decl_ident() as if the grammar's IDENT rule was matched.
+	 */
+	if (ddp->dd_name != NULL && kind == CTF_K_TYPEDEF) {
+		if (yypcb->pcb_dstack.ds_class != DT_DC_TYPEDEF)
+			return (dt_decl_ident(name));
+		xyerror(D_DECL_IDRED, "identifier redeclared: %s\n", name);
+	}
+
+	if (ddp->dd_name != NULL || ddp->dd_kind != CTF_K_UNKNOWN)
+		xyerror(D_DECL_COMBO, "invalid type combination\n");
+
+	ddp->dd_kind = kind;
+	ddp->dd_name = name;
+
+	if (name != NULL && strchr(name, '`') != NULL) {
+		xyerror(D_DECL_SCOPE, "D scoping operator may not be used "
+		    "in a type name\n");
+	}
+
+	return (dt_decl_check(ddp));
+}
+
+dt_decl_t *
+dt_decl_attr(ushort_t attr)
+{
+	dt_decl_t *ddp = yypcb->pcb_dstack.ds_decl;
+
+	if (ddp == NULL) {
+		ddp = dt_decl_push(dt_decl_alloc(CTF_K_UNKNOWN, NULL));
+		ddp->dd_attr = attr;
+		return (ddp);
+	}
+
+	if (attr == DT_DA_LONG && (ddp->dd_attr & DT_DA_LONG)) {
+		ddp->dd_attr &= ~DT_DA_LONG;
+		attr = DT_DA_LONGLONG;
+	}
+
+	ddp->dd_attr |= attr;
+	return (dt_decl_check(ddp));
+}
+
+/*
+ * Examine the list of formal parameters 'flist' and determine if the formal
+ * name fnp->dn_string is defined in this list (B_TRUE) or not (B_FALSE).
+ * If 'fnp' is in 'flist', do not search beyond 'fnp' itself in 'flist'.
+ */
+static int
+dt_decl_protoform(dt_node_t *fnp, dt_node_t *flist)
+{
+	dt_node_t *dnp;
+
+	for (dnp = flist; dnp != fnp && dnp != NULL; dnp = dnp->dn_list) {
+		if (dnp->dn_string != NULL &&
+		    strcmp(dnp->dn_string, fnp->dn_string) == 0)
+			return (B_TRUE);
+	}
+
+	return (B_FALSE);
+}
+
+/*
+ * Common code for parsing array, function, and probe definition prototypes.
+ * The prototype node list is specified as 'plist'.  The formal prototype
+ * against which to compare the prototype is specified as 'flist'.  If plist
+ * and flist are the same, we require that named parameters are unique.  If
+ * plist and flist are different, we require that named parameters in plist
+ * match a name that is present in flist.
+ */
+int
+dt_decl_prototype(dt_node_t *plist,
+    dt_node_t *flist, const char *kind, uint_t flags)
+{
+	char n[DT_TYPE_NAMELEN];
+	int is_void, v = 0, i = 1;
+	int form = plist != flist;
+	dt_node_t *dnp;
+
+	for (dnp = plist; dnp != NULL; dnp = dnp->dn_list, i++) {
+
+		if (dnp->dn_type == CTF_ERR && !(flags & DT_DP_VARARGS)) {
+			dnerror(dnp, D_DECL_PROTO_VARARGS, "%s prototype may "
+			    "not use a variable-length argument list\n", kind);
+		}
+
+		if (dt_node_is_dynamic(dnp) && !(flags & DT_DP_DYNAMIC)) {
+			dnerror(dnp, D_DECL_PROTO_TYPE, "%s prototype may not "
+			    "use parameter of type %s: %s, parameter #%d\n",
+			    kind, dt_node_type_name(dnp, n, sizeof (n)),
+			    dnp->dn_string ? dnp->dn_string : "(anonymous)", i);
+		}
+
+		is_void = dt_node_is_void(dnp);
+		v += is_void;
+
+		if (is_void && !(flags & DT_DP_VOID)) {
+			dnerror(dnp, D_DECL_PROTO_TYPE, "%s prototype may not "
+			    "use parameter of type %s: %s, parameter #%d\n",
+			    kind, dt_node_type_name(dnp, n, sizeof (n)),
+			    dnp->dn_string ? dnp->dn_string : "(anonymous)", i);
+		}
+
+		if (is_void && dnp->dn_string != NULL) {
+			dnerror(dnp, D_DECL_PROTO_NAME, "void parameter may "
+			    "not have a name: %s\n", dnp->dn_string);
+		}
+
+		if (dnp->dn_string != NULL &&
+		    dt_decl_protoform(dnp, flist) != form) {
+			dnerror(dnp, D_DECL_PROTO_FORM, "parameter is "
+			    "%s declared in %s prototype: %s, parameter #%d\n",
+			    form ? "not" : "already", kind, dnp->dn_string, i);
+		}
+
+		if (dnp->dn_string == NULL &&
+		    !is_void && !(flags & DT_DP_ANON)) {
+			dnerror(dnp, D_DECL_PROTO_NAME, "parameter declaration "
+			    "requires a name: parameter #%d\n", i);
+		}
+	}
+
+	if (v != 0 && plist->dn_list != NULL)
+		xyerror(D_DECL_PROTO_VOID, "void must be sole parameter\n");
+
+	return (v ? 0 : i - 1); /* return zero if sole parameter is 'void' */
+}
+
+dt_decl_t *
+dt_decl_array(dt_node_t *dnp)
+{
+	dt_decl_t *ddp = dt_decl_push(dt_decl_alloc(CTF_K_ARRAY, NULL));
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+	dt_decl_t *ndp = ddp;
+
+	/*
+	 * After pushing the array on to the decl stack, scan ahead for multi-
+	 * dimensional array declarations and push the current decl to the
+	 * bottom to match the resulting CTF type tree and data layout.  Refer
+	 * to the comments in dt_decl_type() and ISO C 6.5.2.1 for more info.
+	 */
+	while (ndp->dd_next != NULL && ndp->dd_next->dd_kind == CTF_K_ARRAY)
+		ndp = ndp->dd_next; /* skip to bottom-most array declaration */
+
+	if (ndp != ddp) {
+		if (dnp != NULL && dnp->dn_kind == DT_NODE_TYPE) {
+			xyerror(D_DECL_DYNOBJ,
+			    "cannot declare array of associative arrays\n");
+		}
+		dsp->ds_decl = ddp->dd_next;
+		ddp->dd_next = ndp->dd_next;
+		ndp->dd_next = ddp;
+	}
+
+	if (ddp->dd_next->dd_name != NULL &&
+	    strcmp(ddp->dd_next->dd_name, "void") == 0)
+		xyerror(D_DECL_VOIDOBJ, "cannot declare array of void\n");
+
+	if (dnp != NULL && dnp->dn_kind != DT_NODE_TYPE) {
+		dnp = ddp->dd_node = dt_node_cook(dnp, DT_IDFLG_REF);
+
+		if (dt_node_is_posconst(dnp) == 0) {
+			xyerror(D_DECL_ARRSUB, "positive integral constant "
+			    "expression or tuple signature expected as "
+			    "array declaration subscript\n");
+		}
+
+		if (dnp->dn_value > UINT_MAX)
+			xyerror(D_DECL_ARRBIG, "array dimension too big\n");
+
+	} else if (dnp != NULL) {
+		ddp->dd_node = dnp;
+		(void) dt_decl_prototype(dnp, dnp, "array", DT_DP_ANON);
+	}
+
+	return (ddp);
+}
+
+/*
+ * When a function is declared, we need to fudge the decl stack a bit if the
+ * declaration uses the function pointer (*)() syntax.  In this case, the
+ * dt_decl_func() call occurs *after* the dt_decl_ptr() call, even though the
+ * resulting type is "pointer to function".  To make the pointer land on top,
+ * we check to see if 'pdp' is non-NULL and a pointer.  If it is, we search
+ * backward for a decl tagged with DT_DA_PAREN, and if one is found, the func
+ * decl is inserted behind this node in the decl list instead of at the top.
+ * In all cases, the func decl's dd_next pointer is set to the decl chain
+ * for the function's return type and the function parameter list is discarded.
+ */
+dt_decl_t *
+dt_decl_func(dt_decl_t *pdp, dt_node_t *dnp)
+{
+	dt_decl_t *ddp = dt_decl_alloc(CTF_K_FUNCTION, NULL);
+
+	ddp->dd_node = dnp;
+
+	(void) dt_decl_prototype(dnp, dnp, "function",
+	    DT_DP_VARARGS | DT_DP_VOID | DT_DP_ANON);
+
+	if (pdp == NULL || pdp->dd_kind != CTF_K_POINTER)
+		return (dt_decl_push(ddp));
+
+	while (pdp->dd_next != NULL && !(pdp->dd_next->dd_attr & DT_DA_PAREN))
+		pdp = pdp->dd_next;
+
+	if (pdp->dd_next == NULL)
+		return (dt_decl_push(ddp));
+
+	ddp->dd_next = pdp->dd_next;
+	pdp->dd_next = ddp;
+
+	return (pdp);
+}
+
+dt_decl_t *
+dt_decl_ptr(void)
+{
+	return (dt_decl_push(dt_decl_alloc(CTF_K_POINTER, NULL)));
+}
+
+dt_decl_t *
+dt_decl_sou(uint_t kind, char *name)
+{
+	dt_decl_t *ddp = dt_decl_spec(kind, name);
+	char n[DT_TYPE_NAMELEN];
+	ctf_file_t *ctfp;
+	ctf_id_t type;
+	uint_t flag;
+
+	if (yypcb->pcb_idepth != 0)
+		ctfp = yypcb->pcb_hdl->dt_cdefs->dm_ctfp;
+	else
+		ctfp = yypcb->pcb_hdl->dt_ddefs->dm_ctfp;
+
+	if (yypcb->pcb_dstack.ds_next != NULL)
+		flag = CTF_ADD_NONROOT;
+	else
+		flag = CTF_ADD_ROOT;
+
+	(void) snprintf(n, sizeof (n), "%s %s",
+	    kind == CTF_K_STRUCT ? "struct" : "union",
+	    name == NULL ? "(anon)" : name);
+
+	if (name != NULL && (type = ctf_lookup_by_name(ctfp, n)) != CTF_ERR &&
+	    ctf_type_kind(ctfp, type) != CTF_K_FORWARD)
+		xyerror(D_DECL_TYPERED, "type redeclared: %s\n", n);
+
+	if (kind == CTF_K_STRUCT)
+		type = ctf_add_struct(ctfp, flag, name);
+	else
+		type = ctf_add_union(ctfp, flag, name);
+
+	if (type == CTF_ERR || ctf_update(ctfp) == CTF_ERR) {
+		xyerror(D_UNKNOWN, "failed to define %s: %s\n",
+		    n, ctf_errmsg(ctf_errno(ctfp)));
+	}
+
+	ddp->dd_ctfp = ctfp;
+	ddp->dd_type = type;
+
+	dt_scope_push(ctfp, type);
+	return (ddp);
+}
+
+void
+dt_decl_member(dt_node_t *dnp)
+{
+	dt_scope_t *dsp = yypcb->pcb_dstack.ds_next;
+	dt_decl_t *ddp = yypcb->pcb_dstack.ds_decl;
+	char *ident = yypcb->pcb_dstack.ds_ident;
+
+	const char *idname = ident ? ident : "(anon)";
+	char n[DT_TYPE_NAMELEN];
+
+	dtrace_typeinfo_t dtt;
+	ctf_encoding_t cte;
+	ctf_id_t base;
+	uint_t kind;
+	ssize_t size;
+
+	if (dsp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOSCOPE);
+
+	if (ddp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NODECL);
+
+	if (dnp == NULL && ident == NULL)
+		xyerror(D_DECL_MNAME, "member declaration requires a name\n");
+
+	if (ddp->dd_kind == CTF_K_UNKNOWN && ddp->dd_name == NULL) {
+		ddp->dd_kind = CTF_K_INTEGER;
+		(void) dt_decl_check(ddp);
+	}
+
+	if (dt_decl_type(ddp, &dtt) != 0)
+		longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+
+	if (ident != NULL && strchr(ident, '`') != NULL) {
+		xyerror(D_DECL_SCOPE, "D scoping operator may not be used "
+		    "in a member name (%s)\n", ident);
+	}
+
+	if (dtt.dtt_ctfp == DT_DYN_CTFP(yypcb->pcb_hdl) &&
+	    dtt.dtt_type == DT_DYN_TYPE(yypcb->pcb_hdl)) {
+		xyerror(D_DECL_DYNOBJ,
+		    "cannot have dynamic member: %s\n", ident);
+	}
+
+	base = ctf_type_resolve(dtt.dtt_ctfp, dtt.dtt_type);
+	kind = ctf_type_kind(dtt.dtt_ctfp, base);
+	size = ctf_type_size(dtt.dtt_ctfp, base);
+
+	if (kind == CTF_K_FORWARD || ((kind == CTF_K_STRUCT ||
+	    kind == CTF_K_UNION) && size == 0)) {
+		xyerror(D_DECL_INCOMPLETE, "incomplete struct/union/enum %s: "
+		    "%s\n", dt_type_name(dtt.dtt_ctfp, dtt.dtt_type,
+		    n, sizeof (n)), ident);
+	}
+
+	if (size == 0)
+		xyerror(D_DECL_VOIDOBJ, "cannot have void member: %s\n", ident);
+
+	/*
+	 * If a bit-field qualifier was part of the member declaration, create
+	 * a new integer type of the same name and attributes as the base type
+	 * and size equal to the specified number of bits.  We reset 'dtt' to
+	 * refer to this new bit-field type and continue on to add the member.
+	 */
+	if (dnp != NULL) {
+		dnp = dt_node_cook(dnp, DT_IDFLG_REF);
+
+		/*
+		 * A bit-field member with no declarator is permitted to have
+		 * size zero and indicates that no more fields are to be packed
+		 * into the current storage unit.  We ignore these directives
+		 * as the underlying ctf code currently does so for all fields.
+		 */
+		if (ident == NULL && dnp->dn_kind == DT_NODE_INT &&
+		    dnp->dn_value == 0) {
+			dt_node_free(dnp);
+			goto done;
+		}
+
+		if (dt_node_is_posconst(dnp) == 0) {
+			xyerror(D_DECL_BFCONST, "positive integral constant "
+			    "expression expected as bit-field size\n");
+		}
+
+		if (ctf_type_kind(dtt.dtt_ctfp, base) != CTF_K_INTEGER ||
+		    ctf_type_encoding(dtt.dtt_ctfp, base, &cte) == CTF_ERR ||
+		    IS_VOID(cte)) {
+			xyerror(D_DECL_BFTYPE, "invalid type for "
+			    "bit-field: %s\n", idname);
+		}
+
+		if (dnp->dn_value > cte.cte_bits) {
+			xyerror(D_DECL_BFSIZE, "bit-field too big "
+			    "for type: %s\n", idname);
+		}
+
+		cte.cte_offset = 0;
+		cte.cte_bits = (uint_t)dnp->dn_value;
+
+		dtt.dtt_type = ctf_add_integer(dsp->ds_ctfp,
+		    CTF_ADD_NONROOT, ctf_type_name(dtt.dtt_ctfp,
+		    dtt.dtt_type, n, sizeof (n)), &cte);
+
+		if (dtt.dtt_type == CTF_ERR ||
+		    ctf_update(dsp->ds_ctfp) == CTF_ERR) {
+			xyerror(D_UNKNOWN, "failed to create type for "
+			    "member '%s': %s\n", idname,
+			    ctf_errmsg(ctf_errno(dsp->ds_ctfp)));
+		}
+
+		dtt.dtt_ctfp = dsp->ds_ctfp;
+		dt_node_free(dnp);
+	}
+
+	/*
+	 * If the member type is not defined in the same CTF container as the
+	 * one associated with the current scope (i.e. the container for the
+	 * struct or union itself) or its parent, copy the member type into
+	 * this container and reset dtt to refer to the copied type.
+	 */
+	if (dtt.dtt_ctfp != dsp->ds_ctfp &&
+	    dtt.dtt_ctfp != ctf_parent_file(dsp->ds_ctfp)) {
+
+		dtt.dtt_type = ctf_add_type(dsp->ds_ctfp,
+		    dtt.dtt_ctfp, dtt.dtt_type);
+		dtt.dtt_ctfp = dsp->ds_ctfp;
+
+		if (dtt.dtt_type == CTF_ERR ||
+		    ctf_update(dtt.dtt_ctfp) == CTF_ERR) {
+			xyerror(D_UNKNOWN, "failed to copy type of '%s': %s\n",
+			    idname, ctf_errmsg(ctf_errno(dtt.dtt_ctfp)));
+		}
+	}
+
+	if (ctf_add_member(dsp->ds_ctfp, dsp->ds_type,
+	    ident, dtt.dtt_type) == CTF_ERR) {
+		xyerror(D_UNKNOWN, "failed to define member '%s': %s\n",
+		    idname, ctf_errmsg(ctf_errno(dsp->ds_ctfp)));
+	}
+
+done:
+	free(ident);
+	yypcb->pcb_dstack.ds_ident = NULL;
+	dt_decl_reset();
+}
+
+/*ARGSUSED*/
+static int
+dt_decl_hasmembers(const char *name, int value, void *private)
+{
+	return (1); /* abort search and return true if a member exists */
+}
+
+dt_decl_t *
+dt_decl_enum(char *name)
+{
+	dt_decl_t *ddp = dt_decl_spec(CTF_K_ENUM, name);
+	char n[DT_TYPE_NAMELEN];
+	ctf_file_t *ctfp;
+	ctf_id_t type;
+	uint_t flag;
+
+	if (yypcb->pcb_idepth != 0)
+		ctfp = yypcb->pcb_hdl->dt_cdefs->dm_ctfp;
+	else
+		ctfp = yypcb->pcb_hdl->dt_ddefs->dm_ctfp;
+
+	if (yypcb->pcb_dstack.ds_next != NULL)
+		flag = CTF_ADD_NONROOT;
+	else
+		flag = CTF_ADD_ROOT;
+
+	(void) snprintf(n, sizeof (n), "enum %s", name ? name : "(anon)");
+
+	if (name != NULL && (type = ctf_lookup_by_name(ctfp, n)) != CTF_ERR) {
+		if (ctf_enum_iter(ctfp, type, dt_decl_hasmembers, NULL))
+			xyerror(D_DECL_TYPERED, "type redeclared: %s\n", n);
+	} else if ((type = ctf_add_enum(ctfp, flag, name)) == CTF_ERR) {
+		xyerror(D_UNKNOWN, "failed to define %s: %s\n",
+		    n, ctf_errmsg(ctf_errno(ctfp)));
+	}
+
+	ddp->dd_ctfp = ctfp;
+	ddp->dd_type = type;
+
+	dt_scope_push(ctfp, type);
+	return (ddp);
+}
+
+void
+dt_decl_enumerator(char *s, dt_node_t *dnp)
+{
+	dt_scope_t *dsp = yypcb->pcb_dstack.ds_next;
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+
+	dt_idnode_t *inp;
+	dt_ident_t *idp;
+	char *name;
+	int value;
+
+#ifndef VBOX
+	name = strdupa(s);
+#else
+	MY_STRDUPA(name, s);
+#endif
+	free(s);
+
+	if (dsp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOSCOPE);
+
+	assert(dsp->ds_decl->dd_kind == CTF_K_ENUM);
+	value = dsp->ds_enumval + 1; /* default is previous value plus one */
+
+	if (strchr(name, '`') != NULL) {
+		xyerror(D_DECL_SCOPE, "D scoping operator may not be used in "
+		    "an enumerator name (%s)\n", name);
+	}
+
+	/*
+	 * If the enumerator is being assigned a value, cook and check the node
+	 * and then free it after we get the value.  We also permit references
+	 * to identifiers which are previously defined enumerators in the type.
+	 */
+	if (dnp != NULL) {
+		if (dnp->dn_kind != DT_NODE_IDENT || ctf_enum_value(
+		    dsp->ds_ctfp, dsp->ds_type, dnp->dn_string, &value) != 0) {
+			dnp = dt_node_cook(dnp, DT_IDFLG_REF);
+
+			if (dnp->dn_kind != DT_NODE_INT) {
+				xyerror(D_DECL_ENCONST, "enumerator '%s' must "
+				    "be assigned to an integral constant "
+				    "expression\n", name);
+			}
+
+			if ((intmax_t)dnp->dn_value > INT_MAX ||
+			    (intmax_t)dnp->dn_value < INT_MIN) {
+				xyerror(D_DECL_ENOFLOW, "enumerator '%s' value "
+				    "overflows INT_MAX (%d)\n", name, INT_MAX);
+			}
+
+			value = (int)dnp->dn_value;
+		}
+		dt_node_free(dnp);
+	}
+
+	if (ctf_add_enumerator(dsp->ds_ctfp, dsp->ds_type,
+	    name, value) == CTF_ERR || ctf_update(dsp->ds_ctfp) == CTF_ERR) {
+		xyerror(D_UNKNOWN, "failed to define enumerator '%s': %s\n",
+		    name, ctf_errmsg(ctf_errno(dsp->ds_ctfp)));
+	}
+
+	dsp->ds_enumval = value; /* save most recent value */
+
+	/*
+	 * If the enumerator name matches an identifier in the global scope,
+	 * flag this as an error.  We only do this for "D" enumerators to
+	 * prevent "C" header file enumerators from conflicting with the ever-
+	 * growing list of D built-in global variables and inlines.  If a "C"
+	 * enumerator conflicts with a global identifier, we add the enumerator
+	 * but do not insert a corresponding inline (i.e. the D variable wins).
+	 */
+	if (dt_idstack_lookup(&yypcb->pcb_globals, name) != NULL) {
+		if (dsp->ds_ctfp == dtp->dt_ddefs->dm_ctfp) {
+			xyerror(D_DECL_IDRED,
+			    "identifier redeclared: %s\n", name);
+		} else
+			return;
+	}
+
+	dt_dprintf("add global enumerator %s = %d\n", name, value);
+
+	idp = dt_idhash_insert(dtp->dt_globals, name, DT_IDENT_ENUM,
+	    DT_IDFLG_INLINE | DT_IDFLG_REF, 0, _dtrace_defattr, 0,
+	    &dt_idops_inline, NULL, dtp->dt_gen);
+
+	if (idp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	yyintprefix = 0;
+	yyintsuffix[0] = '\0';
+	yyintdecimal = 0;
+
+	dnp = dt_node_int(value);
+	dt_node_type_assign(dnp, dsp->ds_ctfp, dsp->ds_type);
+
+	if ((inp = malloc(sizeof (dt_idnode_t))) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	/*
+	 * Remove the INT node from the node allocation list and store it in
+	 * din_list and din_root so it persists with and is freed by the ident.
+	 */
+	assert(yypcb->pcb_list == dnp);
+	yypcb->pcb_list = dnp->dn_link;
+	dnp->dn_link = NULL;
+
+	bzero(inp, sizeof (dt_idnode_t));
+	inp->din_list = dnp;
+	inp->din_root = dnp;
+
+	idp->di_iarg = inp;
+	idp->di_ctfp = dsp->ds_ctfp;
+	idp->di_type = dsp->ds_type;
+}
+
+/*
+ * Look up the type corresponding to the specified decl stack.  The scoping of
+ * the underlying type names is handled by dt_type_lookup().  We build up the
+ * name from the specified string and prefixes and then lookup the type.  If
+ * we fail, an errmsg is saved and the caller must abort with EDT_COMPILER.
+ */
+int
+dt_decl_type(dt_decl_t *ddp, dtrace_typeinfo_t *tip)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+
+	dt_module_t *dmp;
+	ctf_arinfo_t r;
+	ctf_id_t type;
+
+	char n[DT_TYPE_NAMELEN];
+	uint_t flag;
+	char *name;
+	int rv;
+
+	/*
+	 * Based on our current #include depth and decl stack depth, determine
+	 * which dynamic CTF module and scope to use when adding any new types.
+	 */
+	dmp = yypcb->pcb_idepth ? dtp->dt_cdefs : dtp->dt_ddefs;
+	flag = yypcb->pcb_dstack.ds_next ? CTF_ADD_NONROOT : CTF_ADD_ROOT;
+
+	/*
+	 * If we have already cached a CTF type for this decl, then we just
+	 * return the type information for the cached type.
+	 */
+	if (ddp->dd_ctfp != NULL &&
+	    (dmp = dt_module_lookup_by_ctf(dtp, ddp->dd_ctfp)) != NULL) {
+		tip->dtt_object = dmp->dm_name;
+		tip->dtt_ctfp = ddp->dd_ctfp;
+		tip->dtt_type = ddp->dd_type;
+		return (0);
+	}
+
+	/*
+	 * Currently CTF treats all function pointers identically.  We cache a
+	 * representative ID of kind CTF_K_FUNCTION and just return that type.
+	 * If we want to support full function declarations, dd_next refers to
+	 * the declaration of the function return type, and the parameter list
+	 * should be parsed and hung off a new pointer inside of this decl.
+	 */
+	if (ddp->dd_kind == CTF_K_FUNCTION) {
+		tip->dtt_object = dtp->dt_ddefs->dm_name;
+		tip->dtt_ctfp = DT_FUNC_CTFP(dtp);
+		tip->dtt_type = DT_FUNC_TYPE(dtp);
+		return (0);
+	}
+
+	/*
+	 * If the decl is a pointer, resolve the rest of the stack by calling
+	 * dt_decl_type() recursively and then compute a pointer to the result.
+	 * Similar to the code above, we return a cached id for function ptrs.
+	 */
+	if (ddp->dd_kind == CTF_K_POINTER) {
+		if (ddp->dd_next->dd_kind == CTF_K_FUNCTION) {
+			tip->dtt_object = dtp->dt_ddefs->dm_name;
+			tip->dtt_ctfp = DT_FPTR_CTFP(dtp);
+			tip->dtt_type = DT_FPTR_TYPE(dtp);
+			return (0);
+		}
+
+		if ((rv = dt_decl_type(ddp->dd_next, tip)) == 0 &&
+		    (rv = dt_type_pointer(tip)) != 0) {
+			xywarn(D_UNKNOWN, "cannot find type: %s*: %s\n",
+			    dt_type_name(tip->dtt_ctfp, tip->dtt_type,
+			    n, sizeof (n)), ctf_errmsg(dtp->dt_ctferr));
+		}
+
+		return (rv);
+	}
+
+	/*
+	 * If the decl is an array, we must find the base type and then call
+	 * dt_decl_type() recursively and then build an array of the result.
+	 * The C and D multi-dimensional array syntax requires that consecutive
+	 * array declarations be processed from right-to-left (i.e. top-down
+	 * from the perspective of the declaration stack).  For example, an
+	 * array declaration such as int x[3][5] is stored on the stack as:
+	 *
+	 * (bottom) NULL <- ( INT "int" ) <- ( ARR [3] ) <- ( ARR [5] ) (top)
+	 *
+	 * but means that x is declared to be an array of 3 objects each of
+	 * which is an array of 5 integers, or in CTF representation:
+	 *
+	 * type T1:( content=int, nelems=5 ) type T2:( content=T1, nelems=3 )
+	 *
+	 * For more details, refer to K&R[5.7] and ISO C 6.5.2.1.  Rather than
+	 * overcomplicate the implementation of dt_decl_type(), we push array
+	 * declarations down into the stack in dt_decl_array(), above, so that
+	 * by the time dt_decl_type() is called, the decl stack looks like:
+	 *
+	 * (bottom) NULL <- ( INT "int" ) <- ( ARR [5] ) <- ( ARR [3] ) (top)
+	 *
+	 * which permits a straightforward recursive descent of the decl stack
+	 * to build the corresponding CTF type tree in the appropriate order.
+	 */
+	if (ddp->dd_kind == CTF_K_ARRAY) {
+		/*
+		 * If the array decl has a parameter list associated with it,
+		 * this is an associative array declaration: return <DYN>.
+		 */
+		if (ddp->dd_node != NULL &&
+		    ddp->dd_node->dn_kind == DT_NODE_TYPE) {
+			tip->dtt_object = dtp->dt_ddefs->dm_name;
+			tip->dtt_ctfp = DT_DYN_CTFP(dtp);
+			tip->dtt_type = DT_DYN_TYPE(dtp);
+			return (0);
+		}
+
+		if ((rv = dt_decl_type(ddp->dd_next, tip)) != 0)
+			return (rv);
+
+		/*
+		 * If the array base type is not defined in the target
+		 * container or its parent, copy the type to the target
+		 * container and reset dtt_ctfp and dtt_type to the copy.
+		 */
+		if (tip->dtt_ctfp != dmp->dm_ctfp &&
+		    tip->dtt_ctfp != ctf_parent_file(dmp->dm_ctfp)) {
+
+			tip->dtt_type = ctf_add_type(dmp->dm_ctfp,
+			    tip->dtt_ctfp, tip->dtt_type);
+			tip->dtt_ctfp = dmp->dm_ctfp;
+
+			if (tip->dtt_type == CTF_ERR ||
+			    ctf_update(tip->dtt_ctfp) == CTF_ERR) {
+				xywarn(D_UNKNOWN, "failed to copy type: %s\n",
+				    ctf_errmsg(ctf_errno(tip->dtt_ctfp)));
+				return (-1);
+			}
+		}
+
+		/*
+		 * The array index type is irrelevant in C and D: just set it
+		 * to "long" for all array types that we create on-the-fly.
+		 */
+		r.ctr_contents = tip->dtt_type;
+		r.ctr_index = ctf_lookup_by_name(tip->dtt_ctfp, "long");
+		r.ctr_nelems = ddp->dd_node ?
+		    (uint_t)ddp->dd_node->dn_value : 0;
+
+		tip->dtt_object = dmp->dm_name;
+		tip->dtt_ctfp = dmp->dm_ctfp;
+		tip->dtt_type = ctf_add_array(dmp->dm_ctfp, CTF_ADD_ROOT, &r);
+
+		if (tip->dtt_type == CTF_ERR ||
+		    ctf_update(tip->dtt_ctfp) == CTF_ERR) {
+			xywarn(D_UNKNOWN, "failed to create array type: %s\n",
+			    ctf_errmsg(ctf_errno(tip->dtt_ctfp)));
+			return (-1);
+		}
+
+		return (0);
+	}
+
+	/*
+	 * Allocate space for the type name and enough space for the maximum
+	 * additional text ("unsigned long long \0" requires 20 more bytes).
+	 */
+	name = alloca(ddp->dd_name ? strlen(ddp->dd_name) + 20 : 20);
+	name[0] = '\0';
+
+	switch (ddp->dd_kind) {
+	case CTF_K_INTEGER:
+	case CTF_K_FLOAT:
+		if (ddp->dd_attr & DT_DA_SIGNED)
+			(void) strcat(name, "signed ");
+		if (ddp->dd_attr & DT_DA_UNSIGNED)
+			(void) strcat(name, "unsigned ");
+		if (ddp->dd_attr & DT_DA_SHORT)
+			(void) strcat(name, "short ");
+		if (ddp->dd_attr & DT_DA_LONG)
+			(void) strcat(name, "long ");
+		if (ddp->dd_attr & DT_DA_LONGLONG)
+			(void) strcat(name, "long long ");
+		if (ddp->dd_attr == 0 && ddp->dd_name == NULL)
+			(void) strcat(name, "int");
+		break;
+	case CTF_K_STRUCT:
+		(void) strcpy(name, "struct ");
+		break;
+	case CTF_K_UNION:
+		(void) strcpy(name, "union ");
+		break;
+	case CTF_K_ENUM:
+		(void) strcpy(name, "enum ");
+		break;
+	case CTF_K_TYPEDEF:
+		break;
+	default:
+		xywarn(D_UNKNOWN, "internal error -- "
+		    "bad decl kind %u\n", ddp->dd_kind);
+		return (-1);
+	}
+
+	/*
+	 * Add dd_name unless a short, long, or long long is explicitly
+	 * suffixed by int.  We use the C/CTF canonical names for integers.
+	 */
+	if (ddp->dd_name != NULL && (ddp->dd_kind != CTF_K_INTEGER ||
+	    (ddp->dd_attr & (DT_DA_SHORT | DT_DA_LONG | DT_DA_LONGLONG)) == 0))
+		(void) strcat(name, ddp->dd_name);
+
+	/*
+	 * Lookup the type.  If we find it, we're done.  Otherwise create a
+	 * forward tag for the type if it is a struct, union, or enum.  If
+	 * we can't find it and we can't create a tag, return failure.
+	 */
+	if ((rv = dt_type_lookup(name, tip)) == 0)
+		return (rv);
+
+	switch (ddp->dd_kind) {
+	case CTF_K_STRUCT:
+	case CTF_K_UNION:
+	case CTF_K_ENUM:
+		type = ctf_add_forward(dmp->dm_ctfp, flag,
+		    ddp->dd_name, ddp->dd_kind);
+		break;
+	default:
+		xywarn(D_UNKNOWN, "failed to resolve type %s: %s\n", name,
+		    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		return (rv);
+	}
+
+	if (type == CTF_ERR || ctf_update(dmp->dm_ctfp) == CTF_ERR) {
+		xywarn(D_UNKNOWN, "failed to add forward tag for %s: %s\n",
+		    name, ctf_errmsg(ctf_errno(dmp->dm_ctfp)));
+		return (-1);
+	}
+
+	ddp->dd_ctfp = dmp->dm_ctfp;
+	ddp->dd_type = type;
+
+	tip->dtt_object = dmp->dm_name;
+	tip->dtt_ctfp = dmp->dm_ctfp;
+	tip->dtt_type = type;
+
+	return (0);
+}
+
+void
+dt_scope_create(dt_scope_t *dsp)
+{
+	dsp->ds_decl = NULL;
+	dsp->ds_next = NULL;
+	dsp->ds_ident = NULL;
+	dsp->ds_ctfp = NULL;
+	dsp->ds_type = CTF_ERR;
+	dsp->ds_class = DT_DC_DEFAULT;
+	dsp->ds_enumval = -1;
+}
+
+void
+dt_scope_destroy(dt_scope_t *dsp)
+{
+	dt_scope_t *nsp;
+
+	for (; dsp != NULL; dsp = nsp) {
+		dt_decl_free(dsp->ds_decl);
+		free(dsp->ds_ident);
+		nsp = dsp->ds_next;
+		if (dsp != &yypcb->pcb_dstack)
+			free(dsp);
+	}
+}
+
+void
+dt_scope_push(ctf_file_t *ctfp, ctf_id_t type)
+{
+	dt_scope_t *rsp = &yypcb->pcb_dstack;
+	dt_scope_t *dsp = malloc(sizeof (dt_scope_t));
+
+	if (dsp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dsp->ds_decl = rsp->ds_decl;
+	dsp->ds_next = rsp->ds_next;
+	dsp->ds_ident = rsp->ds_ident;
+	dsp->ds_ctfp = ctfp;
+	dsp->ds_type = type;
+	dsp->ds_class = rsp->ds_class;
+	dsp->ds_enumval = rsp->ds_enumval;
+
+	dt_scope_create(rsp);
+	rsp->ds_next = dsp;
+}
+
+dt_decl_t *
+dt_scope_pop(void)
+{
+	dt_scope_t *rsp = &yypcb->pcb_dstack;
+	dt_scope_t *dsp = rsp->ds_next;
+
+	if (dsp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOSCOPE);
+
+	if (dsp->ds_ctfp != NULL && ctf_update(dsp->ds_ctfp) == CTF_ERR) {
+		xyerror(D_UNKNOWN, "failed to update type definitions: %s\n",
+		    ctf_errmsg(ctf_errno(dsp->ds_ctfp)));
+	}
+
+	dt_decl_free(rsp->ds_decl);
+	free(rsp->ds_ident);
+
+	rsp->ds_decl = dsp->ds_decl;
+	rsp->ds_next = dsp->ds_next;
+	rsp->ds_ident = dsp->ds_ident;
+	rsp->ds_ctfp = dsp->ds_ctfp;
+	rsp->ds_type = dsp->ds_type;
+	rsp->ds_class = dsp->ds_class;
+	rsp->ds_enumval = dsp->ds_enumval;
+
+	free(dsp);
+	return (rsp->ds_decl);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.h
new file mode 100644
index 0000000..af38339
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_decl.h
@@ -0,0 +1,128 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_DECL_H
+#define	_DT_DECL_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#endif
+#include <libctf.h>
+#include <dtrace.h>
+#include <stdio.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+struct dt_node;				/* forward declaration of dt_node_t */
+
+typedef struct dt_decl {
+	ushort_t dd_kind;		/* declaration kind (CTF_K_* kind) */
+	ushort_t dd_attr;		/* attributes (DT_DA_* flags) */
+	ctf_file_t *dd_ctfp;		/* CTF container for decl's type */
+	ctf_id_t dd_type;		/* CTF identifier for decl's type */
+	char *dd_name;			/* string name of this decl (or NULL) */
+	struct dt_node *dd_node;	/* node for array size or parm list */
+	struct dt_decl *dd_next;	/* next declaration in list */
+} dt_decl_t;
+
+#define	DT_DA_SIGNED	0x0001		/* signed integer value */
+#define	DT_DA_UNSIGNED	0x0002		/* unsigned integer value */
+#define	DT_DA_SHORT	0x0004		/* short integer value */
+#define	DT_DA_LONG	0x0008		/* long integer or double */
+#define	DT_DA_LONGLONG	0x0010		/* long long integer value */
+#define	DT_DA_CONST	0x0020		/* qualify type as const */
+#define	DT_DA_RESTRICT	0x0040		/* qualify type as restrict */
+#define	DT_DA_VOLATILE	0x0080		/* qualify type as volatile */
+#define	DT_DA_PAREN	0x0100		/* parenthesis tag */
+
+typedef enum dt_dclass {
+	DT_DC_DEFAULT,			/* no storage class specified */
+	DT_DC_AUTO,			/* automatic storage */
+	DT_DC_REGISTER,			/* register storage */
+	DT_DC_STATIC,			/* static storage */
+	DT_DC_EXTERN,			/* extern storage */
+	DT_DC_TYPEDEF,			/* type definition */
+	DT_DC_SELF,			/* thread-local storage */
+	DT_DC_THIS			/* clause-local storage */
+} dt_dclass_t;
+
+typedef struct dt_scope {
+	dt_decl_t *ds_decl;		/* pointer to top of decl stack */
+	struct dt_scope *ds_next;	/* pointer to next scope */
+	char *ds_ident;			/* identifier for this scope (if any) */
+	ctf_file_t *ds_ctfp;		/* CTF container for this scope */
+	ctf_id_t ds_type;		/* CTF id of enclosing type */
+	dt_dclass_t ds_class;		/* declaration class for this scope */
+	int ds_enumval;			/* most recent enumerator value */
+} dt_scope_t;
+
+extern dt_decl_t *dt_decl_alloc(ushort_t, char *);
+extern void dt_decl_free(dt_decl_t *);
+extern void dt_decl_reset(void);
+extern dt_decl_t *dt_decl_push(dt_decl_t *);
+extern dt_decl_t *dt_decl_pop(void);
+extern dt_decl_t *dt_decl_pop_param(char **);
+extern dt_decl_t *dt_decl_top(void);
+
+extern dt_decl_t *dt_decl_ident(char *);
+extern void dt_decl_class(dt_dclass_t);
+
+#define	DT_DP_VARARGS	0x1		/* permit varargs in prototype */
+#define	DT_DP_DYNAMIC	0x2		/* permit dynamic type in prototype */
+#define	DT_DP_VOID	0x4		/* permit void type in prototype */
+#define	DT_DP_ANON	0x8		/* permit anonymous parameters */
+
+extern int dt_decl_prototype(struct dt_node *, struct dt_node *,
+    const char *, uint_t);
+
+extern dt_decl_t *dt_decl_spec(ushort_t, char *);
+extern dt_decl_t *dt_decl_attr(ushort_t);
+extern dt_decl_t *dt_decl_array(struct dt_node *);
+extern dt_decl_t *dt_decl_func(dt_decl_t *, struct dt_node *);
+extern dt_decl_t *dt_decl_ptr(void);
+
+extern dt_decl_t *dt_decl_sou(uint_t, char *);
+extern void dt_decl_member(struct dt_node *);
+
+extern dt_decl_t *dt_decl_enum(char *);
+extern void dt_decl_enumerator(char *, struct dt_node *);
+
+extern int dt_decl_type(dt_decl_t *, dtrace_typeinfo_t *);
+
+extern void dt_scope_create(dt_scope_t *);
+extern void dt_scope_destroy(dt_scope_t *);
+extern void dt_scope_push(ctf_file_t *, ctf_id_t);
+extern dt_decl_t *dt_scope_pop(void);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_DECL_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dis.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dis.c
new file mode 100644
index 0000000..712d123
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dis.c
@@ -0,0 +1,513 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <strings.h>
+#include <stdio.h>
+#endif
+
+#include <dt_impl.h>
+#include <dt_ident.h>
+
+/*ARGSUSED*/
+static void
+dt_dis_log(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%-4s %%r%u, %%r%u, %%r%u", name,
+	    DIF_INSTR_R1(in), DIF_INSTR_R2(in), DIF_INSTR_RD(in));
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_branch(const dtrace_difo_t *dp, const char *name,
+	dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%-4s %u", name, DIF_INSTR_LABEL(in));
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_load(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%-4s [%%r%u], %%r%u", name,
+	    DIF_INSTR_R1(in), DIF_INSTR_RD(in));
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_store(const dtrace_difo_t *dp, const char *name,
+	dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%-4s %%r%u, [%%r%u]", name,
+	    DIF_INSTR_R1(in), DIF_INSTR_RD(in));
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_str(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%s", name);
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_r1rd(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%-4s %%r%u, %%r%u", name,
+	    DIF_INSTR_R1(in), DIF_INSTR_RD(in));
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_cmp(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%-4s %%r%u, %%r%u", name,
+	    DIF_INSTR_R1(in), DIF_INSTR_R2(in));
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_tst(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%-4s %%r%u", name, DIF_INSTR_R1(in));
+}
+
+static const char *
+dt_dis_varname(const dtrace_difo_t *dp, uint_t id, uint_t scope)
+{
+	const dtrace_difv_t *dvp = dp->dtdo_vartab;
+	uint_t i;
+
+	for (i = 0; i < dp->dtdo_varlen; i++, dvp++) {
+		if (dvp->dtdv_id == id && dvp->dtdv_scope == scope) {
+			if (dvp->dtdv_name < dp->dtdo_strlen)
+				return (dp->dtdo_strtab + dvp->dtdv_name);
+			break;
+		}
+	}
+
+	return (NULL);
+}
+
+static uint_t
+dt_dis_scope(const char *name)
+{
+	switch (name[2]) {
+	case 'l': return (DIFV_SCOPE_LOCAL);
+	case 't': return (DIFV_SCOPE_THREAD);
+	case 'g': return (DIFV_SCOPE_GLOBAL);
+	default: return (~0u /*VBOX: was -1u*/);
+	}
+}
+
+static void
+dt_dis_lda(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	uint_t var = DIF_INSTR_R1(in);
+	const char *vname;
+
+	(void) fprintf(fp, "%-4s DT_VAR(%u), %%r%u, %%r%u", name,
+	    var, DIF_INSTR_R2(in), DIF_INSTR_RD(in));
+
+	if ((vname = dt_dis_varname(dp, var, dt_dis_scope(name))) != NULL)
+		(void) fprintf(fp, "\t\t! DT_VAR(%u) = \"%s\"", var, vname);
+}
+
+static void
+dt_dis_ldv(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	uint_t var = DIF_INSTR_VAR(in);
+	const char *vname;
+
+	(void) fprintf(fp, "%-4s DT_VAR(%u), %%r%u",
+	    name, var, DIF_INSTR_RD(in));
+
+	if ((vname = dt_dis_varname(dp, var, dt_dis_scope(name))) != NULL)
+		(void) fprintf(fp, "\t\t! DT_VAR(%u) = \"%s\"", var, vname);
+}
+
+static void
+dt_dis_stv(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	uint_t var = DIF_INSTR_VAR(in);
+	const char *vname;
+
+	(void) fprintf(fp, "%-4s %%r%u, DT_VAR(%u)",
+	    name, DIF_INSTR_RS(in), var);
+
+	if ((vname = dt_dis_varname(dp, var, dt_dis_scope(name))) != NULL)
+		(void) fprintf(fp, "\t\t! DT_VAR(%u) = \"%s\"", var, vname);
+}
+
+static void
+dt_dis_setx(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	uint_t intptr = DIF_INSTR_INTEGER(in);
+
+	(void) fprintf(fp, "%-4s DT_INTEGER[%u], %%r%u", name,
+	    intptr, DIF_INSTR_RD(in));
+
+	if (intptr < dp->dtdo_intlen) {
+		(void) fprintf(fp, "\t\t! 0x%llx",
+		    (u_longlong_t)dp->dtdo_inttab[intptr]);
+	}
+}
+
+static void
+dt_dis_sets(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	uint_t strptr = DIF_INSTR_STRING(in);
+
+	(void) fprintf(fp, "%-4s DT_STRING[%u], %%r%u", name,
+	    strptr, DIF_INSTR_RD(in));
+
+	if (strptr < dp->dtdo_strlen)
+		(void) fprintf(fp, "\t\t! \"%s\"", dp->dtdo_strtab + strptr);
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_ret(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	(void) fprintf(fp, "%-4s %%r%u", name, DIF_INSTR_RD(in));
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_call(const dtrace_difo_t *dp, const char *name, dif_instr_t in, FILE *fp)
+{
+	uint_t subr = DIF_INSTR_SUBR(in);
+
+	(void) fprintf(fp, "%-4s DIF_SUBR(%u), %%r%u\t\t! %s",
+	    name, subr, DIF_INSTR_RD(in), dtrace_subrstr(NULL, subr));
+}
+
+/*ARGSUSED*/
+static void
+dt_dis_pushts(const dtrace_difo_t *dp,
+    const char *name, dif_instr_t in, FILE *fp)
+{
+	static const char *const tnames[] = { "D type", "string" };
+	uint_t type = DIF_INSTR_TYPE(in);
+
+	(void) fprintf(fp, "%-4s DT_TYPE(%u), %%r%u, %%r%u",
+	    name, type, DIF_INSTR_R2(in), DIF_INSTR_RS(in));
+
+	if (type < sizeof (tnames) / sizeof (tnames[0]))
+		(void) fprintf(fp, "\t! DT_TYPE(%u) = %s", type, tnames[type]);
+}
+
+static void
+dt_dis_xlate(const dtrace_difo_t *dp,
+    const char *name, dif_instr_t in, FILE *fp)
+{
+	uint_t xlr = DIF_INSTR_XLREF(in);
+
+	(void) fprintf(fp, "%-4s DT_XLREF[%u], %%r%u",
+	    name, xlr, DIF_INSTR_RD(in));
+
+	if (xlr < dp->dtdo_xlmlen) {
+		(void) fprintf(fp, "\t\t! DT_XLREF[%u] = %u.%s", xlr,
+		    (uint_t)dp->dtdo_xlmtab[xlr]->dn_membexpr->dn_xlator->dx_id,
+		    dp->dtdo_xlmtab[xlr]->dn_membname);
+	}
+}
+
+static char *
+dt_dis_typestr(const dtrace_diftype_t *t, char *buf, size_t len)
+{
+	char kind[16], ckind[16];
+
+	switch (t->dtdt_kind) {
+	case DIF_TYPE_CTF:
+		(void) strcpy(kind, "D type");
+		break;
+	case DIF_TYPE_STRING:
+		(void) strcpy(kind, "string");
+		break;
+	default:
+		(void) snprintf(kind, sizeof (kind), "0x%x", t->dtdt_kind);
+	}
+
+	switch (t->dtdt_ckind) {
+	case CTF_K_UNKNOWN:
+		(void) strcpy(ckind, "unknown");
+		break;
+	case CTF_K_INTEGER:
+		(void) strcpy(ckind, "integer");
+		break;
+	case CTF_K_FLOAT:
+		(void) strcpy(ckind, "float");
+		break;
+	case CTF_K_POINTER:
+		(void) strcpy(ckind, "pointer");
+		break;
+	case CTF_K_ARRAY:
+		(void) strcpy(ckind, "array");
+		break;
+	case CTF_K_FUNCTION:
+		(void) strcpy(ckind, "function");
+		break;
+	case CTF_K_STRUCT:
+		(void) strcpy(ckind, "struct");
+		break;
+	case CTF_K_UNION:
+		(void) strcpy(ckind, "union");
+		break;
+	case CTF_K_ENUM:
+		(void) strcpy(ckind, "enum");
+		break;
+	case CTF_K_FORWARD:
+		(void) strcpy(ckind, "forward");
+		break;
+	case CTF_K_TYPEDEF:
+		(void) strcpy(ckind, "typedef");
+		break;
+	case CTF_K_VOLATILE:
+		(void) strcpy(ckind, "volatile");
+		break;
+	case CTF_K_CONST:
+		(void) strcpy(ckind, "const");
+		break;
+	case CTF_K_RESTRICT:
+		(void) strcpy(ckind, "restrict");
+		break;
+	default:
+		(void) snprintf(ckind, sizeof (ckind), "0x%x", t->dtdt_ckind);
+	}
+
+	if (t->dtdt_flags & DIF_TF_BYREF) {
+		(void) snprintf(buf, len, "%s (%s) by ref (size %lu)",
+		    kind, ckind, (ulong_t)t->dtdt_size);
+	} else {
+		(void) snprintf(buf, len, "%s (%s) (size %lu)",
+		    kind, ckind, (ulong_t)t->dtdt_size);
+	}
+
+	return (buf);
+}
+
+static void
+dt_dis_rtab(const char *rtag, const dtrace_difo_t *dp, FILE *fp,
+    const dof_relodesc_t *rp, uint32_t len)
+{
+	(void) fprintf(fp, "\n%-4s %-8s %-8s %s\n",
+	    rtag, "OFFSET", "DATA", "NAME");
+
+	for (; len != 0; len--, rp++) {
+		(void) fprintf(fp, "%-4u %-8llu %-8llu %s\n",
+		    rp->dofr_type, (u_longlong_t)rp->dofr_offset,
+		    (u_longlong_t)rp->dofr_data,
+		    &dp->dtdo_strtab[rp->dofr_name]);
+	}
+}
+
+void
+dt_dis(const dtrace_difo_t *dp, FILE *fp)
+{
+	static const struct opent {
+		const char *op_name;
+		void (*op_func)(const dtrace_difo_t *, const char *,
+		    dif_instr_t, FILE *);
+	} optab[] = {
+		{ "(illegal opcode)", dt_dis_str },
+		{ "or", dt_dis_log },		/* DIF_OP_OR */
+		{ "xor", dt_dis_log },		/* DIF_OP_XOR */
+		{ "and", dt_dis_log },		/* DIF_OP_AND */
+		{ "sll", dt_dis_log },		/* DIF_OP_SLL */
+		{ "srl", dt_dis_log },		/* DIF_OP_SRL */
+		{ "sub", dt_dis_log },		/* DIF_OP_SUB */
+		{ "add", dt_dis_log },		/* DIF_OP_ADD */
+		{ "mul", dt_dis_log },		/* DIF_OP_MUL */
+		{ "sdiv", dt_dis_log },		/* DIF_OP_SDIV */
+		{ "udiv", dt_dis_log },		/* DIF_OP_UDIV */
+		{ "srem", dt_dis_log },		/* DIF_OP_SREM */
+		{ "urem", dt_dis_log },		/* DIF_OP_UREM */
+		{ "not", dt_dis_r1rd },		/* DIF_OP_NOT */
+		{ "mov", dt_dis_r1rd },		/* DIF_OP_MOV */
+		{ "cmp", dt_dis_cmp },		/* DIF_OP_CMP */
+		{ "tst", dt_dis_tst },		/* DIF_OP_TST */
+		{ "ba", dt_dis_branch },	/* DIF_OP_BA */
+		{ "be", dt_dis_branch },	/* DIF_OP_BE */
+		{ "bne", dt_dis_branch },	/* DIF_OP_BNE */
+		{ "bg", dt_dis_branch },	/* DIF_OP_BG */
+		{ "bgu", dt_dis_branch },	/* DIF_OP_BGU */
+		{ "bge", dt_dis_branch },	/* DIF_OP_BGE */
+		{ "bgeu", dt_dis_branch },	/* DIF_OP_BGEU */
+		{ "bl", dt_dis_branch },	/* DIF_OP_BL */
+		{ "blu", dt_dis_branch },	/* DIF_OP_BLU */
+		{ "ble", dt_dis_branch },	/* DIF_OP_BLE */
+		{ "bleu", dt_dis_branch },	/* DIF_OP_BLEU */
+		{ "ldsb", dt_dis_load },	/* DIF_OP_LDSB */
+		{ "ldsh", dt_dis_load },	/* DIF_OP_LDSH */
+		{ "ldsw", dt_dis_load },	/* DIF_OP_LDSW */
+		{ "ldub", dt_dis_load },	/* DIF_OP_LDUB */
+		{ "lduh", dt_dis_load },	/* DIF_OP_LDUH */
+		{ "lduw", dt_dis_load },	/* DIF_OP_LDUW */
+		{ "ldx", dt_dis_load },		/* DIF_OP_LDX */
+		{ "ret", dt_dis_ret },		/* DIF_OP_RET */
+		{ "nop", dt_dis_str },		/* DIF_OP_NOP */
+		{ "setx", dt_dis_setx },	/* DIF_OP_SETX */
+		{ "sets", dt_dis_sets },	/* DIF_OP_SETS */
+		{ "scmp", dt_dis_cmp },		/* DIF_OP_SCMP */
+		{ "ldga", dt_dis_lda },		/* DIF_OP_LDGA */
+		{ "ldgs", dt_dis_ldv },		/* DIF_OP_LDGS */
+		{ "stgs", dt_dis_stv },		/* DIF_OP_STGS */
+		{ "ldta", dt_dis_lda },		/* DIF_OP_LDTA */
+		{ "ldts", dt_dis_ldv },		/* DIF_OP_LDTS */
+		{ "stts", dt_dis_stv },		/* DIF_OP_STTS */
+		{ "sra", dt_dis_log },		/* DIF_OP_SRA */
+		{ "call", dt_dis_call },	/* DIF_OP_CALL */
+		{ "pushtr", dt_dis_pushts },	/* DIF_OP_PUSHTR */
+		{ "pushtv", dt_dis_pushts },	/* DIF_OP_PUSHTV */
+		{ "popts", dt_dis_str },	/* DIF_OP_POPTS */
+		{ "flushts", dt_dis_str },	/* DIF_OP_FLUSHTS */
+		{ "ldgaa", dt_dis_ldv },	/* DIF_OP_LDGAA */
+		{ "ldtaa", dt_dis_ldv },	/* DIF_OP_LDTAA */
+		{ "stgaa", dt_dis_stv },	/* DIF_OP_STGAA */
+		{ "sttaa", dt_dis_stv },	/* DIF_OP_STTAA */
+		{ "ldls", dt_dis_ldv },		/* DIF_OP_LDLS */
+		{ "stls", dt_dis_stv },		/* DIF_OP_STLS */
+		{ "allocs", dt_dis_r1rd },	/* DIF_OP_ALLOCS */
+		{ "copys", dt_dis_log },	/* DIF_OP_COPYS */
+		{ "stb", dt_dis_store },	/* DIF_OP_STB */
+		{ "sth", dt_dis_store },	/* DIF_OP_STH */
+		{ "stw", dt_dis_store },	/* DIF_OP_STW */
+		{ "stx", dt_dis_store },	/* DIF_OP_STX */
+		{ "uldsb", dt_dis_load },	/* DIF_OP_ULDSB */
+		{ "uldsh", dt_dis_load },	/* DIF_OP_ULDSH */
+		{ "uldsw", dt_dis_load },	/* DIF_OP_ULDSW */
+		{ "uldub", dt_dis_load },	/* DIF_OP_ULDUB */
+		{ "ulduh", dt_dis_load },	/* DIF_OP_ULDUH */
+		{ "ulduw", dt_dis_load },	/* DIF_OP_ULDUW */
+		{ "uldx", dt_dis_load },	/* DIF_OP_ULDX */
+		{ "rldsb", dt_dis_load },	/* DIF_OP_RLDSB */
+		{ "rldsh", dt_dis_load },	/* DIF_OP_RLDSH */
+		{ "rldsw", dt_dis_load },	/* DIF_OP_RLDSW */
+		{ "rldub", dt_dis_load },	/* DIF_OP_RLDUB */
+		{ "rlduh", dt_dis_load },	/* DIF_OP_RLDUH */
+		{ "rlduw", dt_dis_load },	/* DIF_OP_RLDUW */
+		{ "rldx", dt_dis_load },	/* DIF_OP_RLDX */
+		{ "xlate", dt_dis_xlate },	/* DIF_OP_XLATE */
+		{ "xlarg", dt_dis_xlate },	/* DIF_OP_XLARG */
+	};
+
+	const struct opent *op;
+	ulong_t i = 0;
+	char type[DT_TYPE_NAMELEN];
+
+	(void) fprintf(fp, "\nDIFO 0x%p returns %s\n", (void *)dp,
+	    dt_dis_typestr(&dp->dtdo_rtype, type, sizeof (type)));
+
+	(void) fprintf(fp, "%-3s %-8s    %s\n",
+	    "OFF", "OPCODE", "INSTRUCTION");
+
+	for (i = 0; i < dp->dtdo_len; i++) {
+		dif_instr_t instr = dp->dtdo_buf[i];
+		dif_instr_t opcode = DIF_INSTR_OP(instr);
+
+		if (opcode >= sizeof (optab) / sizeof (optab[0]))
+			opcode = 0; /* force invalid opcode message */
+
+		op = &optab[opcode];
+		(void) fprintf(fp, "%02lu: %08x    ", i, instr);
+		op->op_func(dp, op->op_name, instr, fp);
+		(void) fprintf(fp, "\n");
+	}
+
+	if (dp->dtdo_varlen != 0) {
+		(void) fprintf(fp, "\n%-16s %-4s %-3s %-3s %-4s %s\n",
+		    "NAME", "ID", "KND", "SCP", "FLAG", "TYPE");
+	}
+
+	for (i = 0; i < dp->dtdo_varlen; i++) {
+		dtrace_difv_t *v = &dp->dtdo_vartab[i];
+		char kind[4], scope[4], flags[16] = { 0 };
+
+		switch (v->dtdv_kind) {
+		case DIFV_KIND_ARRAY:
+			(void) strcpy(kind, "arr");
+			break;
+		case DIFV_KIND_SCALAR:
+			(void) strcpy(kind, "scl");
+			break;
+		default:
+			(void) snprintf(kind, sizeof (kind),
+			    "%u", v->dtdv_kind);
+		}
+
+		switch (v->dtdv_scope) {
+		case DIFV_SCOPE_GLOBAL:
+			(void) strcpy(scope, "glb");
+			break;
+		case DIFV_SCOPE_THREAD:
+			(void) strcpy(scope, "tls");
+			break;
+		case DIFV_SCOPE_LOCAL:
+			(void) strcpy(scope, "loc");
+			break;
+		default:
+			(void) snprintf(scope, sizeof (scope),
+			    "%u", v->dtdv_scope);
+		}
+
+		if (v->dtdv_flags & ~(DIFV_F_REF | DIFV_F_MOD)) {
+			(void) snprintf(flags, sizeof (flags), "/0x%x",
+			    v->dtdv_flags & ~(DIFV_F_REF | DIFV_F_MOD));
+		}
+
+		if (v->dtdv_flags & DIFV_F_REF)
+			(void) strcat(flags, "/r");
+		if (v->dtdv_flags & DIFV_F_MOD)
+			(void) strcat(flags, "/w");
+
+		(void) fprintf(fp, "%-16s %-4x %-3s %-3s %-4s %s\n",
+		    &dp->dtdo_strtab[v->dtdv_name],
+		    v->dtdv_id, kind, scope, flags + 1,
+		    dt_dis_typestr(&v->dtdv_type, type, sizeof (type)));
+	}
+
+	if (dp->dtdo_xlmlen != 0) {
+		(void) fprintf(fp, "\n%-4s %-3s %-12s %s\n",
+		    "XLID", "ARG", "MEMBER", "TYPE");
+	}
+
+	for (i = 0; i < dp->dtdo_xlmlen; i++) {
+		dt_node_t *dnp = dp->dtdo_xlmtab[i];
+		dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator;
+		(void) fprintf(fp, "%-4u %-3d %-12s %s\n",
+		    (uint_t)dxp->dx_id, dxp->dx_arg, dnp->dn_membname,
+		    dt_node_type_name(dnp, type, sizeof (type)));
+	}
+
+	if (dp->dtdo_krelen != 0)
+		dt_dis_rtab("KREL", dp, fp, dp->dtdo_kreltab, dp->dtdo_krelen);
+
+	if (dp->dtdo_urelen != 0)
+		dt_dis_rtab("UREL", dp, fp, dp->dtdo_ureltab, dp->dtdo_urelen);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.c
new file mode 100644
index 0000000..8356f44
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.c
@@ -0,0 +1,968 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <sys/types.h>
+#include <sys/sysmacros.h>
+
+#include <strings.h>
+#include <alloca.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <limits.h>
+#else  /* VBOX */
+# include <iprt/asm.h>
+#endif /* VBOX */
+
+#include <dt_impl.h>
+#include <dt_strtab.h>
+#include <dt_program.h>
+#include <dt_provider.h>
+#include <dt_xlator.h>
+#include <dt_dof.h>
+
+void
+dt_dof_init(dtrace_hdl_t *dtp)
+{
+	dt_dof_t *ddo = &dtp->dt_dof;
+
+	ddo->ddo_hdl = dtp;
+	ddo->ddo_nsecs = 0;
+	ddo->ddo_strsec = DOF_SECIDX_NONE;
+	ddo->ddo_xlimport = NULL;
+	ddo->ddo_xlexport = NULL;
+
+	dt_buf_create(dtp, &ddo->ddo_secs, "section headers", 0);
+	dt_buf_create(dtp, &ddo->ddo_strs, "string table", 0);
+	dt_buf_create(dtp, &ddo->ddo_ldata, "loadable data", 0);
+	dt_buf_create(dtp, &ddo->ddo_udata, "unloadable data", 0);
+
+	dt_buf_create(dtp, &ddo->ddo_probes, "probe data", 0);
+	dt_buf_create(dtp, &ddo->ddo_args, "probe args", 0);
+	dt_buf_create(dtp, &ddo->ddo_offs, "probe offs", 0);
+	dt_buf_create(dtp, &ddo->ddo_enoffs, "probe is-enabled offs", 0);
+	dt_buf_create(dtp, &ddo->ddo_rels, "probe rels", 0);
+
+	dt_buf_create(dtp, &ddo->ddo_xlms, "xlate members", 0);
+}
+
+void
+dt_dof_fini(dtrace_hdl_t *dtp)
+{
+	dt_dof_t *ddo = &dtp->dt_dof;
+
+	dt_free(dtp, ddo->ddo_xlimport);
+	dt_free(dtp, ddo->ddo_xlexport);
+
+	dt_buf_destroy(dtp, &ddo->ddo_secs);
+	dt_buf_destroy(dtp, &ddo->ddo_strs);
+	dt_buf_destroy(dtp, &ddo->ddo_ldata);
+	dt_buf_destroy(dtp, &ddo->ddo_udata);
+
+	dt_buf_destroy(dtp, &ddo->ddo_probes);
+	dt_buf_destroy(dtp, &ddo->ddo_args);
+	dt_buf_destroy(dtp, &ddo->ddo_offs);
+	dt_buf_destroy(dtp, &ddo->ddo_enoffs);
+	dt_buf_destroy(dtp, &ddo->ddo_rels);
+
+	dt_buf_destroy(dtp, &ddo->ddo_xlms);
+}
+
+static int
+dt_dof_reset(dtrace_hdl_t *dtp, dtrace_prog_t *pgp)
+{
+	dt_dof_t *ddo = &dtp->dt_dof;
+	uint_t i, nx = dtp->dt_xlatorid;
+
+	assert(ddo->ddo_hdl == dtp);
+	ddo->ddo_pgp = pgp;
+
+	ddo->ddo_nsecs = 0;
+	ddo->ddo_strsec = DOF_SECIDX_NONE;
+
+	dt_free(dtp, ddo->ddo_xlimport);
+	dt_free(dtp, ddo->ddo_xlexport);
+
+	ddo->ddo_xlimport = dt_alloc(dtp, sizeof (dof_secidx_t) * nx);
+	ddo->ddo_xlexport = dt_alloc(dtp, sizeof (dof_secidx_t) * nx);
+
+	if (nx != 0 && (ddo->ddo_xlimport == NULL || ddo->ddo_xlexport == NULL))
+		return (-1); /* errno is set for us */
+
+	for (i = 0; i < nx; i++) {
+		ddo->ddo_xlimport[i] = DOF_SECIDX_NONE;
+		ddo->ddo_xlexport[i] = DOF_SECIDX_NONE;
+	}
+
+	dt_buf_reset(dtp, &ddo->ddo_secs);
+	dt_buf_reset(dtp, &ddo->ddo_strs);
+	dt_buf_reset(dtp, &ddo->ddo_ldata);
+	dt_buf_reset(dtp, &ddo->ddo_udata);
+
+	dt_buf_reset(dtp, &ddo->ddo_probes);
+	dt_buf_reset(dtp, &ddo->ddo_args);
+	dt_buf_reset(dtp, &ddo->ddo_offs);
+	dt_buf_reset(dtp, &ddo->ddo_enoffs);
+	dt_buf_reset(dtp, &ddo->ddo_rels);
+
+	dt_buf_reset(dtp, &ddo->ddo_xlms);
+	return (0);
+}
+
+/*
+ * Add a loadable DOF section to the file using the specified data buffer and
+ * the specified DOF section attributes.  DOF_SECF_LOAD must be set in flags.
+ * If 'data' is NULL, the caller is responsible for manipulating the ldata buf.
+ */
+static dof_secidx_t
+dof_add_lsect(dt_dof_t *ddo, const void *data, uint32_t type,
+    uint32_t align, uint32_t flags, uint32_t entsize, uint64_t size)
+{
+	dtrace_hdl_t *dtp = ddo->ddo_hdl;
+	dof_sec_t s;
+
+	s.dofs_type = type;
+	s.dofs_align = align;
+	s.dofs_flags = flags | DOF_SECF_LOAD;
+	s.dofs_entsize = entsize;
+	s.dofs_offset = dt_buf_offset(&ddo->ddo_ldata, align);
+	s.dofs_size = size;
+
+	dt_buf_write(dtp, &ddo->ddo_secs, &s, sizeof (s), sizeof (uint64_t));
+
+	if (data != NULL)
+		dt_buf_write(dtp, &ddo->ddo_ldata, data, size, align);
+
+	return (ddo->ddo_nsecs++);
+}
+
+/*
+ * Add an unloadable DOF section to the file using the specified data buffer
+ * and DOF section attributes.  DOF_SECF_LOAD must *not* be set in flags.
+ * If 'data' is NULL, the caller is responsible for manipulating the udata buf.
+ */
+static dof_secidx_t
+dof_add_usect(dt_dof_t *ddo, const void *data, uint32_t type,
+    uint32_t align, uint32_t flags, uint32_t entsize, uint64_t size)
+{
+	dtrace_hdl_t *dtp = ddo->ddo_hdl;
+	dof_sec_t s;
+
+	s.dofs_type = type;
+	s.dofs_align = align;
+	s.dofs_flags = flags & ~DOF_SECF_LOAD;
+	s.dofs_entsize = entsize;
+	s.dofs_offset = dt_buf_offset(&ddo->ddo_udata, align);
+	s.dofs_size = size;
+
+	dt_buf_write(dtp, &ddo->ddo_secs, &s, sizeof (s), sizeof (uint64_t));
+
+	if (data != NULL)
+		dt_buf_write(dtp, &ddo->ddo_udata, data, size, align);
+
+	return (ddo->ddo_nsecs++);
+}
+
+/*
+ * Add a string to the global string table associated with the DOF.  The offset
+ * of the string is returned as an index into the string table.
+ */
+static dof_stridx_t
+dof_add_string(dt_dof_t *ddo, const char *s)
+{
+	dt_buf_t *bp = &ddo->ddo_strs;
+	dof_stridx_t i = VBDTCAST(dof_stridx_t)dt_buf_len(bp);
+
+	if (i != 0 && (s == NULL || *s == '\0'))
+		return (0); /* string table has \0 at offset 0 */
+
+	dt_buf_write(ddo->ddo_hdl, bp, s, strlen(s) + 1, sizeof (char));
+	return (i);
+}
+
+static dof_attr_t
+dof_attr(const dtrace_attribute_t *ap)
+{
+	return (DOF_ATTR(ap->dtat_name, ap->dtat_data, ap->dtat_class));
+}
+
+static dof_secidx_t
+dof_add_difo(dt_dof_t *ddo, const dtrace_difo_t *dp)
+{
+	dof_secidx_t dsecs[5]; /* enough for all possible DIFO sections */
+	uint_t nsecs = 0;
+
+	dof_difohdr_t *dofd;
+	dof_relohdr_t dofr;
+	dof_secidx_t relsec;
+
+	dof_secidx_t strsec = DOF_SECIDX_NONE;
+	dof_secidx_t intsec = DOF_SECIDX_NONE;
+	dof_secidx_t hdrsec = DOF_SECIDX_NONE;
+
+	if (dp->dtdo_buf != NULL) {
+		dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_buf,
+		    DOF_SECT_DIF, sizeof (dif_instr_t), 0,
+		    sizeof (dif_instr_t), sizeof (dif_instr_t) * dp->dtdo_len);
+	}
+
+	if (dp->dtdo_inttab != NULL) {
+		dsecs[nsecs++] = intsec = dof_add_lsect(ddo, dp->dtdo_inttab,
+		    DOF_SECT_INTTAB, sizeof (uint64_t), 0,
+		    sizeof (uint64_t), sizeof (uint64_t) * dp->dtdo_intlen);
+	}
+
+	if (dp->dtdo_strtab != NULL) {
+		dsecs[nsecs++] = strsec = dof_add_lsect(ddo, dp->dtdo_strtab,
+		    DOF_SECT_STRTAB, sizeof (char), 0, 0, dp->dtdo_strlen);
+	}
+
+	if (dp->dtdo_vartab != NULL) {
+		dsecs[nsecs++] = dof_add_lsect(ddo, dp->dtdo_vartab,
+		    DOF_SECT_VARTAB, sizeof (uint_t), 0, sizeof (dtrace_difv_t),
+		    sizeof (dtrace_difv_t) * dp->dtdo_varlen);
+	}
+
+	if (dp->dtdo_xlmtab != NULL) {
+		dof_xlref_t *xlt, *xlp;
+		dt_node_t **pnp;
+
+		xlt = alloca(sizeof (dof_xlref_t) * dp->dtdo_xlmlen);
+		pnp = dp->dtdo_xlmtab;
+
+		/*
+		 * dtdo_xlmtab contains pointers to the translator members.
+		 * The translator itself is in sect ddo_xlimport[dxp->dx_id].
+		 * The XLMEMBERS entries are in order by their dn_membid, so
+		 * the member section offset is the population count of bits
+		 * in ddo_pgp->dp_xlrefs[] up to and not including dn_membid.
+		 */
+		for (xlp = xlt; xlp < xlt + dp->dtdo_xlmlen; xlp++) {
+			dt_node_t *dnp = *pnp++;
+			dt_xlator_t *dxp = dnp->dn_membexpr->dn_xlator;
+
+			xlp->dofxr_xlator = ddo->ddo_xlimport[dxp->dx_id];
+			xlp->dofxr_member = dt_popcb(
+			    ddo->ddo_pgp->dp_xrefs[dxp->dx_id], dnp->dn_membid);
+			xlp->dofxr_argn = (uint32_t)dxp->dx_arg;
+		}
+
+		dsecs[nsecs++] = dof_add_lsect(ddo, xlt, DOF_SECT_XLTAB,
+		    sizeof (dof_secidx_t), 0, sizeof (dof_xlref_t),
+		    sizeof (dof_xlref_t) * dp->dtdo_xlmlen);
+	}
+
+	/*
+	 * Copy the return type and the array of section indices that form the
+	 * DIFO into a single dof_difohdr_t and then add DOF_SECT_DIFOHDR.
+	 */
+	assert(nsecs <= sizeof (dsecs) / sizeof (dsecs[0]));
+	dofd = alloca(sizeof (dtrace_diftype_t) + sizeof (dsecs));
+	bcopy(&dp->dtdo_rtype, &dofd->dofd_rtype, sizeof (dtrace_diftype_t));
+	bcopy(dsecs, &dofd->dofd_links, sizeof (dof_secidx_t) * nsecs);
+
+	hdrsec = dof_add_lsect(ddo, dofd, DOF_SECT_DIFOHDR,
+	    sizeof (dof_secidx_t), 0, 0,
+	    sizeof (dtrace_diftype_t) + sizeof (dof_secidx_t) * nsecs);
+
+	/*
+	 * Add any other sections related to dtrace_difo_t.  These are not
+	 * referenced in dof_difohdr_t because they are not used by emulation.
+	 */
+	if (dp->dtdo_kreltab != NULL) {
+		relsec = dof_add_lsect(ddo, dp->dtdo_kreltab, DOF_SECT_RELTAB,
+		    sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
+		    sizeof (dof_relodesc_t) * dp->dtdo_krelen);
+
+		/*
+		 * This code assumes the target of all relocations is the
+		 * integer table 'intsec' (DOF_SECT_INTTAB).  If other sections
+		 * need relocation in the future this will need to change.
+		 */
+		dofr.dofr_strtab = strsec;
+		dofr.dofr_relsec = relsec;
+		dofr.dofr_tgtsec = intsec;
+
+		(void) dof_add_lsect(ddo, &dofr, DOF_SECT_KRELHDR,
+		    sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
+	}
+
+	if (dp->dtdo_ureltab != NULL) {
+		relsec = dof_add_lsect(ddo, dp->dtdo_ureltab, DOF_SECT_RELTAB,
+		    sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
+		    sizeof (dof_relodesc_t) * dp->dtdo_urelen);
+
+		/*
+		 * This code assumes the target of all relocations is the
+		 * integer table 'intsec' (DOF_SECT_INTTAB).  If other sections
+		 * need relocation in the future this will need to change.
+		 */
+		dofr.dofr_strtab = strsec;
+		dofr.dofr_relsec = relsec;
+		dofr.dofr_tgtsec = intsec;
+
+		(void) dof_add_lsect(ddo, &dofr, DOF_SECT_URELHDR,
+		    sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
+	}
+
+	return (hdrsec);
+}
+
+static void
+dof_add_translator(dt_dof_t *ddo, const dt_xlator_t *dxp, uint_t type)
+{
+	dtrace_hdl_t *dtp = ddo->ddo_hdl;
+	dof_xlmember_t dofxm;
+	dof_xlator_t dofxl;
+	dof_secidx_t *xst;
+
+	char buf[DT_TYPE_NAMELEN];
+	dt_node_t *dnp;
+	uint_t i = 0;
+
+	assert(type == DOF_SECT_XLIMPORT || type == DOF_SECT_XLEXPORT);
+	xst = type == DOF_SECT_XLIMPORT ? ddo->ddo_xlimport : ddo->ddo_xlexport;
+
+	if (xst[dxp->dx_id] != DOF_SECIDX_NONE)
+		return; /* translator has already been emitted */
+
+	dt_buf_reset(dtp, &ddo->ddo_xlms);
+
+	/*
+	 * Generate an array of dof_xlmember_t's into ddo_xlms.  If we are
+	 * importing the translator, add only those members referenced by the
+	 * program and set the dofxm_difo reference of each member to NONE.  If
+	 * we're exporting the translator, add all members and a DIFO for each.
+	 */
+	for (dnp = dxp->dx_members; dnp != NULL; dnp = dnp->dn_list, i++) {
+		if (type == DOF_SECT_XLIMPORT) {
+			if (!BT_TEST(ddo->ddo_pgp->dp_xrefs[dxp->dx_id], i))
+				continue; /* member is not referenced */
+			dofxm.dofxm_difo = DOF_SECIDX_NONE;
+		} else {
+			dofxm.dofxm_difo = dof_add_difo(ddo,
+			    dxp->dx_membdif[dnp->dn_membid]);
+		}
+
+		dofxm.dofxm_name = dof_add_string(ddo, dnp->dn_membname);
+		dt_node_diftype(dtp, dnp, &dofxm.dofxm_type);
+
+		dt_buf_write(dtp, &ddo->ddo_xlms,
+		    &dofxm, sizeof (dofxm), sizeof (uint32_t));
+	}
+
+	dofxl.dofxl_members = dof_add_lsect(ddo, NULL, DOF_SECT_XLMEMBERS,
+	    sizeof (uint32_t), 0, sizeof (dofxm), dt_buf_len(&ddo->ddo_xlms));
+
+	dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_xlms, sizeof (uint32_t));
+
+	dofxl.dofxl_strtab = ddo->ddo_strsec;
+	dofxl.dofxl_argv = dof_add_string(ddo, ctf_type_name(
+	    dxp->dx_src_ctfp, dxp->dx_src_type, buf, sizeof (buf)));
+	dofxl.dofxl_argc = 1;
+	dofxl.dofxl_type = dof_add_string(ddo, ctf_type_name(
+	    dxp->dx_dst_ctfp, dxp->dx_dst_type, buf, sizeof (buf)));
+	dofxl.dofxl_attr = dof_attr(&dxp->dx_souid.di_attr);
+
+	xst[dxp->dx_id] = dof_add_lsect(ddo, &dofxl, type,
+	    sizeof (uint32_t), 0, 0, sizeof (dofxl));
+}
+
+/*ARGSUSED*/
+static int
+dof_add_probe(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
+{
+	dt_dof_t *ddo = data;
+	dtrace_hdl_t *dtp = ddo->ddo_hdl;
+	dt_probe_t *prp = idp->di_data;
+
+	dof_probe_t dofpr;
+	dof_relodesc_t dofr;
+	dt_probe_instance_t *pip;
+	dt_node_t *dnp;
+
+	char buf[DT_TYPE_NAMELEN];
+	uint_t i;
+
+	dofpr.dofpr_addr = 0;
+	dofpr.dofpr_name = dof_add_string(ddo, prp->pr_name);
+	dofpr.dofpr_nargv = VBDTCAST(dof_stridx_t)dt_buf_len(&ddo->ddo_strs);
+
+	for (dnp = prp->pr_nargs; dnp != NULL; dnp = dnp->dn_list) {
+		(void) dof_add_string(ddo, ctf_type_name(dnp->dn_ctfp,
+		    dnp->dn_type, buf, sizeof (buf)));
+	}
+
+	dofpr.dofpr_xargv = VBDTCAST(dof_stridx_t)dt_buf_len(&ddo->ddo_strs);
+
+	for (dnp = prp->pr_xargs; dnp != NULL; dnp = dnp->dn_list) {
+		(void) dof_add_string(ddo, ctf_type_name(dnp->dn_ctfp,
+		    dnp->dn_type, buf, sizeof (buf)));
+	}
+
+	dofpr.dofpr_argidx = VBDTCAST(uint32_t)dt_buf_len(&ddo->ddo_args) / sizeof (uint8_t);
+
+	for (i = 0; i < prp->pr_xargc; i++) {
+		dt_buf_write(dtp, &ddo->ddo_args, &prp->pr_mapping[i],
+		    sizeof (uint8_t), sizeof (uint8_t));
+	}
+
+	dofpr.dofpr_nargc = prp->pr_nargc;
+	dofpr.dofpr_xargc = prp->pr_xargc;
+	dofpr.dofpr_pad1 = 0;
+	dofpr.dofpr_pad2 = 0;
+
+	for (pip = prp->pr_inst; pip != NULL; pip = pip->pi_next) {
+		dt_dprintf("adding probe for %s:%s\n", pip->pi_fname,
+		    prp->pr_name);
+
+		dofpr.dofpr_func = dof_add_string(ddo, pip->pi_fname);
+
+		/*
+		 * There should be one probe offset or is-enabled probe offset
+		 * or else this probe instance won't have been created. The
+		 * kernel will reject DOF which has a probe with no offsets.
+		 */
+		assert(pip->pi_noffs + pip->pi_nenoffs > 0);
+
+		dofpr.dofpr_offidx =
+		    VBDTCAST(uint32_t)(dt_buf_len(&ddo->ddo_offs) / sizeof (uint32_t));
+		dofpr.dofpr_noffs = pip->pi_noffs;
+		dt_buf_write(dtp, &ddo->ddo_offs, pip->pi_offs,
+		    pip->pi_noffs * sizeof (uint32_t), sizeof (uint32_t));
+
+		dofpr.dofpr_enoffidx =
+		    VBDTCAST(uint32_t)(dt_buf_len(&ddo->ddo_enoffs) / sizeof (uint32_t));
+		dofpr.dofpr_nenoffs = pip->pi_nenoffs;
+		dt_buf_write(dtp, &ddo->ddo_enoffs, pip->pi_enoffs,
+		    pip->pi_nenoffs * sizeof (uint32_t), sizeof (uint32_t));
+
+		/*
+		 * If pi_rname isn't set, the relocation will be against the
+		 * function name. If it is, the relocation will be against
+		 * pi_rname. This will be used if the function is scoped
+		 * locally so an alternate symbol is added for the purpose
+		 * of this relocation.
+		 */
+		if (pip->pi_rname[0] == '\0')
+			dofr.dofr_name = dofpr.dofpr_func;
+		else
+			dofr.dofr_name = dof_add_string(ddo, pip->pi_rname);
+		dofr.dofr_type = DOF_RELO_SETX;
+		dofr.dofr_offset = dt_buf_len(&ddo->ddo_probes);
+		dofr.dofr_data = 0;
+
+		dt_buf_write(dtp, &ddo->ddo_rels, &dofr,
+		    sizeof (dofr), sizeof (uint64_t));
+
+		dt_buf_write(dtp, &ddo->ddo_probes, &dofpr,
+		    sizeof (dofpr), sizeof (uint64_t));
+	}
+
+	return (0);
+}
+
+static void
+dof_add_provider(dt_dof_t *ddo, const dt_provider_t *pvp)
+{
+	dtrace_hdl_t *dtp = ddo->ddo_hdl;
+	dof_provider_t dofpv;
+	dof_relohdr_t dofr;
+	dof_secidx_t *dofs;
+	ulong_t xr, nxr;
+	size_t sz;
+	id_t i;
+
+	if (pvp->pv_flags & DT_PROVIDER_IMPL)
+		return; /* ignore providers that are exported by dtrace(7D) */
+
+	nxr = dt_popcb(pvp->pv_xrefs, pvp->pv_xrmax);
+	dofs = alloca(sizeof (dof_secidx_t) * (nxr + 1));
+	xr = 1; /* reserve dofs[0] for the provider itself */
+
+	/*
+	 * For each translator referenced by the provider (pv_xrefs), emit an
+	 * exported translator section for it if one hasn't been created yet.
+	 */
+	for (i = 0; i < pvp->pv_xrmax; i++) {
+		if (BT_TEST(pvp->pv_xrefs, i) &&
+		    dtp->dt_xlatemode == DT_XL_DYNAMIC) {
+			dof_add_translator(ddo,
+			    dt_xlator_lookup_id(dtp, i), DOF_SECT_XLEXPORT);
+			dofs[xr++] = ddo->ddo_xlexport[i];
+		}
+	}
+
+	dt_buf_reset(dtp, &ddo->ddo_probes);
+	dt_buf_reset(dtp, &ddo->ddo_args);
+	dt_buf_reset(dtp, &ddo->ddo_offs);
+	dt_buf_reset(dtp, &ddo->ddo_enoffs);
+	dt_buf_reset(dtp, &ddo->ddo_rels);
+
+	(void) dt_idhash_iter(pvp->pv_probes, dof_add_probe, ddo);
+
+	dofpv.dofpv_probes = dof_add_lsect(ddo, NULL, DOF_SECT_PROBES,
+	    sizeof (uint64_t), 0, sizeof (dof_probe_t),
+	    dt_buf_len(&ddo->ddo_probes));
+
+	dt_buf_concat(dtp, &ddo->ddo_ldata,
+	    &ddo->ddo_probes, sizeof (uint64_t));
+
+	dofpv.dofpv_prargs = dof_add_lsect(ddo, NULL, DOF_SECT_PRARGS,
+	    sizeof (uint8_t), 0, sizeof (uint8_t), dt_buf_len(&ddo->ddo_args));
+
+	dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_args, sizeof (uint8_t));
+
+	dofpv.dofpv_proffs = dof_add_lsect(ddo, NULL, DOF_SECT_PROFFS,
+	    sizeof (uint_t), 0, sizeof (uint_t), dt_buf_len(&ddo->ddo_offs));
+
+	dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_offs, sizeof (uint_t));
+
+	if ((sz = dt_buf_len(&ddo->ddo_enoffs)) != 0) {
+		dofpv.dofpv_prenoffs = dof_add_lsect(ddo, NULL,
+		    DOF_SECT_PRENOFFS, sizeof (uint_t), 0, sizeof (uint_t), sz);
+	} else {
+		dofpv.dofpv_prenoffs = DOF_SECT_NONE;
+	}
+
+	dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_enoffs, sizeof (uint_t));
+
+	dofpv.dofpv_strtab = ddo->ddo_strsec;
+	dofpv.dofpv_name = dof_add_string(ddo, pvp->pv_desc.dtvd_name);
+
+	dofpv.dofpv_provattr = dof_attr(&pvp->pv_desc.dtvd_attr.dtpa_provider);
+	dofpv.dofpv_modattr = dof_attr(&pvp->pv_desc.dtvd_attr.dtpa_mod);
+	dofpv.dofpv_funcattr = dof_attr(&pvp->pv_desc.dtvd_attr.dtpa_func);
+	dofpv.dofpv_nameattr = dof_attr(&pvp->pv_desc.dtvd_attr.dtpa_name);
+	dofpv.dofpv_argsattr = dof_attr(&pvp->pv_desc.dtvd_attr.dtpa_args);
+
+	dofs[0] = dof_add_lsect(ddo, &dofpv, DOF_SECT_PROVIDER,
+	    sizeof (dof_secidx_t), 0, 0, sizeof (dof_provider_t));
+
+	dofr.dofr_strtab = dofpv.dofpv_strtab;
+	dofr.dofr_tgtsec = dofpv.dofpv_probes;
+	dofr.dofr_relsec = dof_add_lsect(ddo, NULL, DOF_SECT_RELTAB,
+	    sizeof (uint64_t), 0, sizeof (dof_relodesc_t),
+	    dt_buf_len(&ddo->ddo_rels));
+
+	dt_buf_concat(dtp, &ddo->ddo_ldata, &ddo->ddo_rels, sizeof (uint64_t));
+
+	(void) dof_add_lsect(ddo, &dofr, DOF_SECT_URELHDR,
+	    sizeof (dof_secidx_t), 0, 0, sizeof (dof_relohdr_t));
+
+	if (nxr != 0 && dtp->dt_xlatemode == DT_XL_DYNAMIC) {
+		(void) dof_add_lsect(ddo, dofs, DOF_SECT_PREXPORT,
+		    sizeof (dof_secidx_t), 0, sizeof (dof_secidx_t),
+		    sizeof (dof_secidx_t) * (nxr + 1));
+	}
+}
+
+static int
+dof_hdr(dtrace_hdl_t *dtp, uint8_t dofversion, dof_hdr_t *hp)
+{
+	/*
+	 * If our config values cannot fit in a uint8_t, we can't generate a
+	 * DOF header since the values won't fit.  This can only happen if the
+	 * user forcibly compiles a program with an artificial configuration.
+	 */
+	if (dtp->dt_conf.dtc_difversion > UINT8_MAX ||
+	    dtp->dt_conf.dtc_difintregs > UINT8_MAX ||
+	    dtp->dt_conf.dtc_diftupregs > UINT8_MAX)
+		return (dt_set_errno(dtp, EOVERFLOW));
+
+	bzero(hp, sizeof (dof_hdr_t));
+
+	hp->dofh_ident[DOF_ID_MAG0] = DOF_MAG_MAG0;
+	hp->dofh_ident[DOF_ID_MAG1] = DOF_MAG_MAG1;
+	hp->dofh_ident[DOF_ID_MAG2] = DOF_MAG_MAG2;
+	hp->dofh_ident[DOF_ID_MAG3] = DOF_MAG_MAG3;
+
+	if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64)
+		hp->dofh_ident[DOF_ID_MODEL] = DOF_MODEL_LP64;
+	else
+		hp->dofh_ident[DOF_ID_MODEL] = DOF_MODEL_ILP32;
+
+	hp->dofh_ident[DOF_ID_ENCODING] = DOF_ENCODE_NATIVE;
+	hp->dofh_ident[DOF_ID_VERSION] = dofversion;
+	hp->dofh_ident[DOF_ID_DIFVERS] = dtp->dt_conf.dtc_difversion;
+	hp->dofh_ident[DOF_ID_DIFIREG] = dtp->dt_conf.dtc_difintregs;
+	hp->dofh_ident[DOF_ID_DIFTREG] = dtp->dt_conf.dtc_diftupregs;
+
+	hp->dofh_hdrsize = sizeof (dof_hdr_t);
+	hp->dofh_secsize = sizeof (dof_sec_t);
+	hp->dofh_secoff = sizeof (dof_hdr_t);
+
+	return (0);
+}
+
+void *
+dtrace_dof_create(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t flags)
+{
+	dt_dof_t *ddo = &dtp->dt_dof;
+
+	const dtrace_ecbdesc_t *edp, *last;
+	const dtrace_probedesc_t *pdp;
+	const dtrace_actdesc_t *ap;
+	const dt_stmt_t *stp;
+
+	uint_t maxacts = 0;
+	uint_t maxfmt = 0;
+
+	dt_provider_t *pvp;
+	dt_xlator_t *dxp;
+	dof_actdesc_t *dofa;
+	dof_sec_t *sp;
+	size_t ssize, lsize;
+	dof_hdr_t h;
+
+	dt_buf_t dof;
+	char *fmt;
+	uint_t i;
+
+	if (flags & ~DTRACE_D_MASK) {
+		(void) dt_set_errno(dtp, EINVAL);
+		return (NULL);
+	}
+
+	flags |= dtp->dt_dflags;
+
+	if (dof_hdr(dtp, pgp->dp_dofversion, &h) != 0)
+		return (NULL);
+
+	if (dt_dof_reset(dtp, pgp) != 0)
+		return (NULL);
+
+	/*
+	 * Iterate through the statement list computing the maximum number of
+	 * actions and the maximum format string for allocating local buffers.
+	 */
+	for (last = NULL, stp = dt_list_next(&pgp->dp_stmts);
+	    stp != NULL; stp = dt_list_next(stp), last = edp) {
+
+		dtrace_stmtdesc_t *sdp = stp->ds_desc;
+		dtrace_actdesc_t *ap = sdp->dtsd_action;
+
+		if (sdp->dtsd_fmtdata != NULL) {
+			i = VBDTCAST(uint_t)dtrace_printf_format(dtp,
+			    sdp->dtsd_fmtdata, NULL, 0);
+			maxfmt = MAX(maxfmt, i);
+		}
+
+		if ((edp = sdp->dtsd_ecbdesc) == last)
+			continue; /* same ecb as previous statement */
+
+		for (i = 0, ap = edp->dted_action; ap; ap = ap->dtad_next)
+			i++;
+
+		maxacts = MAX(maxacts, i);
+	}
+
+	dofa = alloca(sizeof (dof_actdesc_t) * maxacts);
+	fmt = alloca(maxfmt + 1);
+
+	ddo->ddo_strsec = dof_add_lsect(ddo, NULL, DOF_SECT_STRTAB, 1, 0, 0, 0);
+	(void) dof_add_string(ddo, "");
+
+	/*
+	 * If there are references to dynamic translators in the program, add
+	 * an imported translator table entry for each referenced translator.
+	 */
+	if (pgp->dp_xrefslen != 0) {
+		for (dxp = dt_list_next(&dtp->dt_xlators);
+		    dxp != NULL; dxp = dt_list_next(dxp)) {
+			if (dxp->dx_id < pgp->dp_xrefslen &&
+			    pgp->dp_xrefs[dxp->dx_id] != NULL)
+				dof_add_translator(ddo, dxp, DOF_SECT_XLIMPORT);
+		}
+	}
+
+	/*
+	 * Now iterate through the statement list, creating the DOF section
+	 * headers and data for each one and adding them to our buffers.
+	 */
+	for (last = NULL, stp = dt_list_next(&pgp->dp_stmts);
+	    stp != NULL; stp = dt_list_next(stp), last = edp) {
+
+		dof_secidx_t probesec = DOF_SECIDX_NONE;
+		dof_secidx_t prdsec = DOF_SECIDX_NONE;
+		dof_secidx_t actsec = DOF_SECIDX_NONE;
+
+		const dt_stmt_t *next = stp;
+		dtrace_stmtdesc_t *sdp = stp->ds_desc;
+		dof_stridx_t strndx = 0;
+		dof_probedesc_t dofp;
+		dof_ecbdesc_t dofe;
+		uint_t i;
+
+		if ((edp = stp->ds_desc->dtsd_ecbdesc) == last)
+			continue; /* same ecb as previous statement */
+
+		pdp = &edp->dted_probe;
+
+		/*
+		 * Add a DOF_SECT_PROBEDESC for the ECB's probe description,
+		 * and copy the probe description strings into the string table.
+		 */
+		dofp.dofp_strtab = ddo->ddo_strsec;
+		dofp.dofp_provider = dof_add_string(ddo, pdp->dtpd_provider);
+		dofp.dofp_mod = dof_add_string(ddo, pdp->dtpd_mod);
+		dofp.dofp_func = dof_add_string(ddo, pdp->dtpd_func);
+		dofp.dofp_name = dof_add_string(ddo, pdp->dtpd_name);
+		dofp.dofp_id = pdp->dtpd_id;
+
+		probesec = dof_add_lsect(ddo, &dofp, DOF_SECT_PROBEDESC,
+		    sizeof (dof_secidx_t), 0,
+		    sizeof (dof_probedesc_t), sizeof (dof_probedesc_t));
+
+		/*
+		 * If there is a predicate DIFO associated with the ecbdesc,
+		 * write out the DIFO sections and save the DIFO section index.
+		 */
+		if (edp->dted_pred.dtpdd_difo != NULL)
+			prdsec = dof_add_difo(ddo, edp->dted_pred.dtpdd_difo);
+
+		/*
+		 * Now iterate through the action list generating DIFOs as
+		 * referenced therein and adding action descriptions to 'dofa'.
+		 */
+		for (i = 0, ap = edp->dted_action;
+		    ap != NULL; ap = ap->dtad_next, i++) {
+
+			if (ap->dtad_difo != NULL) {
+				dofa[i].dofa_difo =
+				    dof_add_difo(ddo, ap->dtad_difo);
+			} else
+				dofa[i].dofa_difo = DOF_SECIDX_NONE;
+
+			/*
+			 * If the first action in a statement has format data,
+			 * add the format string to the global string table.
+			 */
+			if (sdp != NULL && ap == sdp->dtsd_action) {
+				if (sdp->dtsd_fmtdata != NULL) {
+					(void) dtrace_printf_format(dtp,
+					    sdp->dtsd_fmtdata, fmt, maxfmt + 1);
+					strndx = dof_add_string(ddo, fmt);
+				} else
+					strndx = 0; /* use dtad_arg instead */
+
+				if ((next = dt_list_next(next)) != NULL)
+					sdp = next->ds_desc;
+				else
+					sdp = NULL;
+			}
+
+			if (strndx != 0) {
+				dofa[i].dofa_arg = strndx;
+				dofa[i].dofa_strtab = ddo->ddo_strsec;
+			} else {
+				dofa[i].dofa_arg = ap->dtad_arg;
+				dofa[i].dofa_strtab = DOF_SECIDX_NONE;
+			}
+
+			dofa[i].dofa_kind = ap->dtad_kind;
+			dofa[i].dofa_ntuple = ap->dtad_ntuple;
+			dofa[i].dofa_uarg = ap->dtad_uarg;
+		}
+
+		if (i > 0) {
+			actsec = dof_add_lsect(ddo, dofa, DOF_SECT_ACTDESC,
+			    sizeof (uint64_t), 0, sizeof (dof_actdesc_t),
+			    sizeof (dof_actdesc_t) * i);
+		}
+
+		/*
+		 * Now finally, add the DOF_SECT_ECBDESC referencing all the
+		 * previously created sub-sections.
+		 */
+		dofe.dofe_probes = probesec;
+		dofe.dofe_pred = prdsec;
+		dofe.dofe_actions = actsec;
+		dofe.dofe_pad = 0;
+		dofe.dofe_uarg = edp->dted_uarg;
+
+		(void) dof_add_lsect(ddo, &dofe, DOF_SECT_ECBDESC,
+		    sizeof (uint64_t), 0, 0, sizeof (dof_ecbdesc_t));
+	}
+
+	/*
+	 * If any providers are user-defined, output DOF sections corresponding
+	 * to the providers and the probes and arguments that they define.
+	 */
+	if (flags & DTRACE_D_PROBES) {
+		for (pvp = dt_list_next(&dtp->dt_provlist);
+		    pvp != NULL; pvp = dt_list_next(pvp))
+			dof_add_provider(ddo, pvp);
+	}
+
+	/*
+	 * If we're not stripping unloadable sections, generate compiler
+	 * comments and any other unloadable miscellany.
+	 */
+	if (!(flags & DTRACE_D_STRIP)) {
+		(void) dof_add_usect(ddo, _dtrace_version, DOF_SECT_COMMENTS,
+		    sizeof (char), 0, 0, strlen(_dtrace_version) + 1);
+#ifndef VBOX
+		(void) dof_add_usect(ddo, &dtp->dt_uts, DOF_SECT_UTSNAME,
+		    sizeof (char), 0, 0, sizeof (struct utsname));
+#endif
+	}
+
+	/*
+	 * Compute and fill in the appropriate values for the dof_hdr_t's
+	 * dofh_secnum, dofh_loadsz, and dofh_filez values.
+	 */
+	h.dofh_secnum = ddo->ddo_nsecs;
+	ssize = sizeof (h) + dt_buf_len(&ddo->ddo_secs);
+
+	h.dofh_loadsz = ssize +
+	    dt_buf_len(&ddo->ddo_ldata) +
+	    dt_buf_len(&ddo->ddo_strs);
+
+	if (dt_buf_len(&ddo->ddo_udata) != 0) {
+		lsize = roundup(h.dofh_loadsz, sizeof (uint64_t));
+		h.dofh_filesz = lsize + dt_buf_len(&ddo->ddo_udata);
+	} else {
+		lsize = h.dofh_loadsz;
+		h.dofh_filesz = lsize;
+	}
+
+	/*
+	 * Set the global DOF_SECT_STRTAB's offset to be after the header,
+	 * section headers, and other loadable data.  Since we're going to
+	 * iterate over the buffer data directly, we must check for errors.
+	 */
+	if ((i = dt_buf_error(&ddo->ddo_secs)) != 0) {
+		(void) dt_set_errno(dtp, i);
+		return (NULL);
+	}
+
+	sp = dt_buf_ptr(&ddo->ddo_secs);
+	assert(sp[ddo->ddo_strsec].dofs_type == DOF_SECT_STRTAB);
+	assert(ssize == sizeof (h) + sizeof (dof_sec_t) * ddo->ddo_nsecs);
+
+	sp[ddo->ddo_strsec].dofs_offset = ssize + dt_buf_len(&ddo->ddo_ldata);
+	sp[ddo->ddo_strsec].dofs_size = dt_buf_len(&ddo->ddo_strs);
+
+	/*
+	 * Now relocate all the other section headers by adding the appropriate
+	 * delta to their respective dofs_offset values.
+	 */
+	for (i = 0; i < ddo->ddo_nsecs; i++, sp++) {
+		if (i == ddo->ddo_strsec)
+			continue; /* already relocated above */
+
+		if (sp->dofs_flags & DOF_SECF_LOAD)
+			sp->dofs_offset += ssize;
+		else
+			sp->dofs_offset += lsize;
+	}
+
+	/*
+	 * Finally, assemble the complete in-memory DOF buffer by writing the
+	 * header and then concatenating all our buffers.  dt_buf_concat() will
+	 * propagate any errors and cause dt_buf_claim() to return NULL.
+	 */
+	dt_buf_create(dtp, &dof, "dof", h.dofh_filesz);
+
+	dt_buf_write(dtp, &dof, &h, sizeof (h), sizeof (uint64_t));
+	dt_buf_concat(dtp, &dof, &ddo->ddo_secs, sizeof (uint64_t));
+	dt_buf_concat(dtp, &dof, &ddo->ddo_ldata, sizeof (uint64_t));
+	dt_buf_concat(dtp, &dof, &ddo->ddo_strs, sizeof (char));
+	dt_buf_concat(dtp, &dof, &ddo->ddo_udata, sizeof (uint64_t));
+
+	return (dt_buf_claim(dtp, &dof));
+}
+
+void
+dtrace_dof_destroy(dtrace_hdl_t *dtp, void *dof)
+{
+	dt_free(dtp, dof);
+}
+
+void *
+dtrace_getopt_dof(dtrace_hdl_t *dtp)
+{
+	dof_hdr_t *dof;
+	dof_sec_t *sec;
+	dof_optdesc_t *dofo;
+	int i, nopts = 0, len = sizeof (dof_hdr_t) +
+	    roundup(sizeof (dof_sec_t), sizeof (uint64_t));
+
+	for (i = 0; i < DTRACEOPT_MAX; i++) {
+		if (dtp->dt_options[i] != DTRACEOPT_UNSET)
+			nopts++;
+	}
+
+	len += sizeof (dof_optdesc_t) * nopts;
+
+	if ((dof = dt_zalloc(dtp, len)) == NULL ||
+	    dof_hdr(dtp, DOF_VERSION, dof) != 0) {
+		dt_free(dtp, dof);
+		return (NULL);
+	}
+
+	dof->dofh_secnum = 1;	/* only DOF_SECT_OPTDESC */
+	dof->dofh_loadsz = len;
+	dof->dofh_filesz = len;
+
+	/*
+	 * Fill in the option section header...
+	 */
+	sec = (dof_sec_t *)((uintptr_t)dof + sizeof (dof_hdr_t));
+	sec->dofs_type = DOF_SECT_OPTDESC;
+	sec->dofs_align = sizeof (uint64_t);
+	sec->dofs_flags = DOF_SECF_LOAD;
+	sec->dofs_entsize = sizeof (dof_optdesc_t);
+
+	dofo = (dof_optdesc_t *)((uintptr_t)sec +
+	    roundup(sizeof (dof_sec_t), sizeof (uint64_t)));
+
+	sec->dofs_offset = (uintptr_t)dofo - (uintptr_t)dof;
+	sec->dofs_size = sizeof (dof_optdesc_t) * nopts;
+
+	for (i = 0; i < DTRACEOPT_MAX; i++) {
+		if (dtp->dt_options[i] == DTRACEOPT_UNSET)
+			continue;
+
+		dofo->dofo_option = i;
+		dofo->dofo_strtab = DOF_SECIDX_NONE;
+		dofo->dofo_value = dtp->dt_options[i];
+		dofo++;
+	}
+
+	return (dof);
+}
+
+void *
+dtrace_geterr_dof(dtrace_hdl_t *dtp)
+{
+	if (dtp->dt_errprog != NULL)
+		return (dtrace_dof_create(dtp, dtp->dt_errprog, 0));
+
+	(void) dt_set_errno(dtp, EDT_BADERROR);
+	return (NULL);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.h
new file mode 100644
index 0000000..a896497
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_dof.h
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_DOF_H
+#define	_DT_DOF_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <dtrace.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#include <dt_buf.h>
+
+typedef struct dt_dof {
+	dtrace_hdl_t *ddo_hdl;		/* libdtrace handle */
+	dtrace_prog_t *ddo_pgp;		/* current program */
+	uint_t ddo_nsecs;		/* number of sections */
+	dof_secidx_t ddo_strsec; 	/* global strings section index */
+	dof_secidx_t *ddo_xlimport;	/* imported xlator section indices */
+	dof_secidx_t *ddo_xlexport;	/* exported xlator section indices */
+	dt_buf_t ddo_secs;		/* section headers */
+	dt_buf_t ddo_strs;		/* global strings */
+	dt_buf_t ddo_ldata;		/* loadable section data */
+	dt_buf_t ddo_udata;		/* unloadable section data */
+	dt_buf_t ddo_probes;		/* probe section data */
+	dt_buf_t ddo_args;		/* probe arguments section data */
+	dt_buf_t ddo_offs;		/* probe offsets section data */
+	dt_buf_t ddo_enoffs;		/* is-enabled offsets section data */
+	dt_buf_t ddo_rels;		/* probe relocation section data */
+	dt_buf_t ddo_xlms;		/* xlate members section data */
+} dt_dof_t;
+
+extern void dt_dof_init(dtrace_hdl_t *);
+extern void dt_dof_fini(dtrace_hdl_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_DOF_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_error.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_error.c
new file mode 100644
index 0000000..9dd2ba7
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_error.c
@@ -0,0 +1,218 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#include <strings.h>
+#endif
+#include <dt_impl.h>
+
+static const struct {
+	int err;
+	const char *msg;
+} _dt_errlist[] = {
+	{ EDT_VERSION,	"Client requested version newer than library" },
+	{ EDT_VERSINVAL, "Version is not properly formatted or is too large" },
+	{ EDT_VERSUNDEF, "Requested version is not supported by compiler" },
+	{ EDT_VERSREDUCED, "Requested version conflicts with earlier setting" },
+	{ EDT_CTF,	"Unexpected libctf error" },
+	{ EDT_COMPILER, "Error in D program compilation" },
+	{ EDT_NOREG,	"Insufficient registers to generate code" },
+	{ EDT_NOTUPREG,	"Insufficient tuple registers to generate code" },
+	{ EDT_NOMEM,	"Memory allocation failure" },
+	{ EDT_INT2BIG,	"Integer constant table limit exceeded" },
+	{ EDT_STR2BIG,	"String constant table limit exceeded" },
+	{ EDT_NOMOD,	"Unknown module name" },
+	{ EDT_NOPROV,	"Unknown provider name" },
+	{ EDT_NOPROBE,	"No probe matches description" },
+	{ EDT_NOSYM,	"Unknown symbol name" },
+	{ EDT_NOSYMADDR, "No symbol corresponds to address" },
+	{ EDT_NOTYPE,	"Unknown type name" },
+	{ EDT_NOVAR,	"Unknown variable name" },
+	{ EDT_NOAGG,	"Unknown aggregation name" },
+	{ EDT_BADSCOPE,	"Improper use of scoping operator in type name" },
+	{ EDT_BADSPEC,	"Overspecified probe description" },
+	{ EDT_BADSPCV,	"Undefined macro variable in probe description" },
+	{ EDT_BADID,	"Unknown probe identifier" },
+	{ EDT_NOTLOADED, "Module is no longer loaded" },
+	{ EDT_NOCTF,	"Module does not contain any CTF data" },
+	{ EDT_DATAMODEL, "Module and program data models do not match" },
+	{ EDT_DIFVERS,	"Library uses newer DIF version than kernel" },
+	{ EDT_BADAGG,	"Unknown aggregating action" },
+	{ EDT_FIO,	"Error occurred while reading from input stream" },
+	{ EDT_DIFINVAL,	"DIF program content is invalid" },
+	{ EDT_DIFSIZE,	"DIF program exceeds maximum program size" },
+	{ EDT_DIFFAULT,	"DIF program contains invalid pointer" },
+	{ EDT_BADPROBE,	"Invalid probe specification" },
+	{ EDT_BADPGLOB, "Probe description has too many globbing characters" },
+	{ EDT_NOSCOPE,	"Declaration scope stack underflow" },
+	{ EDT_NODECL,	"Declaration stack underflow" },
+	{ EDT_DMISMATCH, "Data record list does not match statement" },
+	{ EDT_DOFFSET,	"Data record offset exceeds buffer boundary" },
+	{ EDT_DALIGN,	"Data record has inappropriate alignment" },
+	{ EDT_BADOPTNAME, "Invalid option name" },
+	{ EDT_BADOPTVAL, "Invalid value for specified option" },
+	{ EDT_BADOPTCTX, "Option cannot be used from within a D program" },
+	{ EDT_CPPFORK,	"Failed to fork preprocessor" },
+	{ EDT_CPPEXEC,	"Failed to exec preprocessor" },
+	{ EDT_CPPENT,	"Preprocessor not found" },
+	{ EDT_CPPERR,	"Preprocessor failed to process input program" },
+	{ EDT_SYMOFLOW,	"Symbol table identifier space exhausted" },
+	{ EDT_ACTIVE,	"Operation illegal when tracing is active" },
+	{ EDT_DESTRUCTIVE, "Destructive actions not allowed" },
+	{ EDT_NOANON,	"No anonymous tracing state" },
+	{ EDT_ISANON,	"Can't claim anonymous state and enable probes" },
+	{ EDT_ENDTOOBIG, "END enablings exceed size of principal buffer" },
+	{ EDT_NOCONV,	"Failed to load type for printf conversion" },
+	{ EDT_BADCONV,	"Incomplete printf conversion" },
+	{ EDT_BADERROR,	"Invalid library ERROR action" },
+	{ EDT_ERRABORT,	"Abort due to error" },
+	{ EDT_DROPABORT, "Abort due to drop" },
+	{ EDT_DIRABORT,	"Abort explicitly directed" },
+	{ EDT_BADRVAL,	"Invalid return value from callback" },
+	{ EDT_BADNORMAL, "Invalid normalization" },
+	{ EDT_BUFTOOSMALL, "Enabling exceeds size of buffer" },
+	{ EDT_BADTRUNC, "Invalid truncation" },
+	{ EDT_BUSY, "DTrace cannot be used when kernel debugger is active" },
+	{ EDT_ACCESS, "DTrace requires additional privileges" },
+	{ EDT_NOENT, "DTrace device not available on system" },
+	{ EDT_BRICKED, "Abort due to systemic unresponsiveness" },
+	{ EDT_HARDWIRE, "Failed to load language definitions" },
+	{ EDT_ELFVERSION, "libelf is out-of-date with respect to libdtrace" },
+	{ EDT_NOBUFFERED, "Attempt to buffer output without handler" },
+	{ EDT_UNSTABLE, "Description matched an unstable set of probes" },
+	{ EDT_BADSETOPT, "Invalid setopt() library action" },
+	{ EDT_BADSTACKPC, "Invalid stack program counter size" },
+	{ EDT_BADAGGVAR, "Invalid aggregation variable identifier" },
+	{ EDT_OVERSION,	"Client requested deprecated version of library" },
+	{ EDT_ENABLING_ERR, "Failed to enable probe" }
+};
+
+static const int _dt_nerr = sizeof (_dt_errlist) / sizeof (_dt_errlist[0]);
+
+const char *
+dtrace_errmsg(dtrace_hdl_t *dtp, int error)
+{
+	const char *str;
+	int i;
+
+	if (error == EDT_COMPILER && dtp != NULL && dtp->dt_errmsg[0] != '\0')
+		str = dtp->dt_errmsg;
+	else if (error == EDT_CTF && dtp != NULL && dtp->dt_ctferr != 0)
+		str = ctf_errmsg(dtp->dt_ctferr);
+	else if (error >= EDT_BASE && (error - EDT_BASE) < _dt_nerr) {
+		for (i = 0; i < _dt_nerr; i++) {
+			if (_dt_errlist[i].err == error)
+				return (_dt_errlist[i].msg);
+		}
+		str = NULL;
+	} else
+		str = strerror(error);
+
+	return (str ? str : "Unknown error");
+}
+
+int
+dtrace_errno(dtrace_hdl_t *dtp)
+{
+	return (dtp->dt_errno);
+}
+
+int
+dt_set_errno(dtrace_hdl_t *dtp, int err)
+{
+	dtp->dt_errno = err;
+	return (-1);
+}
+
+void
+dt_set_errmsg(dtrace_hdl_t *dtp, const char *errtag, const char *region,
+    const char *filename, int lineno, const char *format, va_list ap)
+{
+	size_t len, n;
+	char *p, *s;
+
+	s = dtp->dt_errmsg;
+	n = sizeof (dtp->dt_errmsg);
+
+	if (errtag != NULL && (yypcb->pcb_cflags & DTRACE_C_ETAGS))
+		(void) snprintf(s, n, "[%s] ", errtag);
+	else
+		s[0] = '\0';
+
+	len = strlen(dtp->dt_errmsg);
+	s = dtp->dt_errmsg + len;
+	n = sizeof (dtp->dt_errmsg) - len;
+
+	if (filename == NULL)
+		filename = dtp->dt_filetag;
+
+	if (filename != NULL)
+		(void) snprintf(s, n, "\"%s\", line %d: ", filename, lineno);
+	else if (lineno != 0)
+		(void) snprintf(s, n, "line %d: ", lineno);
+	else if (region != NULL)
+		(void) snprintf(s, n, "in %s: ", region);
+
+	len = strlen(dtp->dt_errmsg);
+	s = dtp->dt_errmsg + len;
+	n = sizeof (dtp->dt_errmsg) - len;
+	(void) vsnprintf(s, n, format, ap);
+
+	if ((p = strrchr(dtp->dt_errmsg, '\n')) != NULL)
+		*p = '\0'; /* remove trailing \n from message buffer */
+
+	dtp->dt_errtag = errtag;
+}
+
+/*ARGSUSED*/
+const char *
+dtrace_faultstr(dtrace_hdl_t *dtp, int fault)
+{
+	int i;
+
+	static const struct {
+		int code;
+		const char *str;
+	} faults[] = {
+		{ DTRACEFLT_BADADDR,	"invalid address" },
+		{ DTRACEFLT_BADALIGN,	"invalid alignment" },
+		{ DTRACEFLT_ILLOP,	"illegal operation" },
+		{ DTRACEFLT_DIVZERO,	"divide-by-zero" },
+		{ DTRACEFLT_NOSCRATCH,	"out of scratch space" },
+		{ DTRACEFLT_KPRIV,	"invalid kernel access" },
+		{ DTRACEFLT_UPRIV,	"invalid user access" },
+		{ DTRACEFLT_TUPOFLOW,	"tuple stack overflow" },
+		{ DTRACEFLT_BADSTACK,	"bad stack" },
+		{ DTRACEFLT_LIBRARY,	"library-level fault" },
+		{ 0,			NULL }
+	};
+
+	for (i = 0; faults[i].str != NULL; i++) {
+		if (faults[i].code == fault)
+			return (faults[i].str);
+	}
+
+	return ("unknown fault");
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_errtags.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_errtags.h
new file mode 100644
index 0000000..c81142d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_errtags.h
@@ -0,0 +1,249 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_ERRTAGS_H
+#define	_DT_ERRTAGS_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/*
+ * This enum definition is used to define a set of error tags associated with
+ * the D compiler's various error conditions.  The shell script mkerrtags.sh is
+ * used to parse this file and create a corresponding dt_errtags.c source file.
+ * If you do something other than add a new error tag here, you may need to
+ * update the mkerrtags shell script as it is based upon simple regexps.
+ */
+typedef enum {
+	D_UNKNOWN,			/* unknown D compiler error */
+	D_SYNTAX,			/* syntax error in input stream */
+	D_EMPTY,			/* empty translation unit */
+	D_TYPE_ERR,			/* type definition missing */
+	D_TYPE_MEMBER,			/* type member not found */
+	D_ASRELO,			/* relocation remains against symbol */
+	D_CG_EXPR,			/* tracing function called from expr */
+	D_CG_DYN,			/* expression returns dynamic result */
+	D_ATTR_MIN,			/* attributes less than amin setting */
+	D_ID_OFLOW,			/* identifier space overflow */
+	D_PDESC_ZERO,			/* probedesc matches zero probes */
+	D_PDESC_INVAL,			/* probedesc is not valid */
+	D_PRED_SCALAR,			/* predicate must be of scalar type */
+	D_FUNC_IDENT,			/* function designator is not ident */
+	D_FUNC_UNDEF,			/* function ident is not defined */
+	D_FUNC_IDKIND,			/* function ident is of wrong idkind */
+	D_OFFSETOF_TYPE,		/* offsetof arg is not sou type */
+	D_OFFSETOF_BITFIELD,		/* offsetof applied to field member */
+	D_SIZEOF_TYPE,			/* invalid sizeof type */
+	D_SIZEOF_BITFIELD,		/* sizeof applied to field member */
+	D_STRINGOF_TYPE,		/* invalid stringof type */
+	D_OP_IDENT,			/* operand must be an identifier */
+	D_OP_INT,			/* operand must be integral type */
+	D_OP_SCALAR,			/* operand must be scalar type */
+	D_OP_ARITH,			/* operand must be arithmetic type */
+	D_OP_WRITE,			/* operand must be writable variable */
+	D_OP_LVAL,			/* operand must be lvalue */
+	D_OP_INCOMPAT,			/* operand types are not compatible */
+	D_OP_VFPTR,			/* operand cannot be void or func ptr */
+	D_OP_ARRFUN,			/* operand cannot be array or func */
+	D_OP_PTR,			/* operand must be a pointer */
+	D_OP_SOU,			/* operand must be struct or union */
+	D_OP_INCOMPLETE,		/* operand is an incomplete type */
+	D_OP_DYN,			/* operand cannot be of dynamic type */
+	D_OP_ACT,			/* operand cannot be action */
+	D_AGG_REDEF,			/* aggregation cannot be redefined */
+	D_AGG_FUNC,			/* aggregating function required */
+	D_AGG_MDIM,			/* aggregation used as multi-dim arr */
+	D_ARR_BADREF,			/* access non-array using tuple */
+	D_ARR_LOCAL,			/* cannot define local assc array */
+	D_DIV_ZERO,			/* division by zero detected */
+	D_DEREF_NONPTR,			/* dereference non-pointer type */
+	D_DEREF_VOID,			/* dereference void pointer */
+	D_DEREF_FUNC,			/* dereference function pointer */
+	D_ADDROF_LVAL,			/* unary & applied to non-lvalue */
+	D_ADDROF_VAR,			/* unary & applied to variable */
+	D_ADDROF_BITFIELD,		/* unary & applied to field member */
+	D_XLATE_REDECL,			/* translator redeclared */
+	D_XLATE_NOCONV,			/* no conversion for member defined */
+	D_XLATE_NONE,			/* no translator for type combo */
+	D_XLATE_SOU,			/* dst must be struct or union type */
+	D_XLATE_INCOMPAT,		/* translator member type incompat */
+	D_XLATE_MEMB,			/* translator member is not valid */
+	D_CAST_INVAL,			/* invalid cast expression */
+	D_PRAGERR,			/* #pragma error message */
+	D_PRAGCTL_INVAL,		/* invalid control directive */
+	D_PRAGMA_INVAL,			/* invalid compiler pragma */
+	D_PRAGMA_UNUSED,		/* unused compiler pragma */
+	D_PRAGMA_MALFORM,		/* malformed #pragma argument list */
+	D_PRAGMA_OPTSET,		/* failed to set #pragma option */
+	D_PRAGMA_SCOPE,			/* #pragma identifier scope error */
+	D_PRAGMA_DEPEND,		/* #pragma dependency not satisfied */
+	D_MACRO_UNDEF,			/* macro parameter is not defined */
+	D_MACRO_OFLOW,			/* macro parameter integer overflow */
+	D_MACRO_UNUSED,			/* macro parameter is never used */
+	D_INT_OFLOW,			/* integer constant overflow */
+	D_INT_DIGIT,			/* integer digit is not valid */
+	D_STR_NL,			/* newline in string literal */
+	D_CHR_NL,			/* newline in character constant */
+	D_CHR_NULL,			/* empty character constant */
+	D_CHR_OFLOW,			/* character constant is too long */
+	D_IDENT_BADREF,			/* identifier expected type mismatch */
+	D_IDENT_UNDEF,			/* identifier is not known/defined */
+	D_IDENT_AMBIG,			/* identifier is ambiguous (var/enum) */
+	D_SYM_BADREF,			/* kernel/user symbol ref mismatch */
+	D_SYM_NOTYPES,			/* no CTF data available for sym ref */
+	D_SYM_MODEL,			/* module/program data model mismatch */
+	D_VAR_UNDEF,			/* reference to undefined variable */
+	D_VAR_UNSUP,			/* unsupported variable specification */
+	D_PROTO_LEN,			/* prototype length mismatch */
+	D_PROTO_ARG,			/* prototype argument mismatch */
+	D_ARGS_MULTI,			/* description matches unstable set */
+	D_ARGS_XLATOR,			/* no args[] translator defined */
+	D_ARGS_NONE,			/* no args[] available */
+	D_ARGS_TYPE,			/* invalid args[] type */
+	D_ARGS_IDX,			/* invalid args[] index */
+	D_REGS_IDX,			/* invalid regs[] index */
+	D_KEY_TYPE,			/* invalid agg or array key type */
+	D_PRINTF_DYN_PROTO,		/* dynamic size argument missing */
+	D_PRINTF_DYN_TYPE,		/* dynamic size type mismatch */
+	D_PRINTF_AGG_CONV,		/* improper use of %@ conversion */
+	D_PRINTF_ARG_PROTO,		/* conversion missing value argument */
+	D_PRINTF_ARG_TYPE,		/* conversion arg has wrong type */
+	D_PRINTF_ARG_EXTRA,		/* extra arguments specified */
+	D_PRINTF_ARG_FMT,		/* format string is not a constant */
+	D_PRINTF_FMT_EMPTY,		/* format string is empty */
+	D_DECL_CHARATTR,		/* bad attributes for char decl */
+	D_DECL_VOIDATTR,		/* bad attributes for void decl */
+	D_DECL_SIGNINT,			/* sign/unsign with non-integer decl */
+	D_DECL_LONGINT,			/* long with non-arithmetic decl */
+	D_DECL_IDENT,			/* old-style declaration or bad type */
+	D_DECL_CLASS,			/* more than one storage class given */
+	D_DECL_BADCLASS,		/* decl class not supported in D */
+	D_DECL_PARMCLASS,		/* invalid class for parameter type */
+	D_DECL_COMBO, 			/* bad decl specifier combination */
+	D_DECL_ARRSUB,			/* const int required for array size */
+	D_DECL_ARRNULL,			/* array decl requires dim or tuple */
+	D_DECL_ARRBIG,			/* array size too big */
+	D_DECL_IDRED,			/* decl identifier redeclared */
+	D_DECL_TYPERED,			/* decl type redeclared */
+	D_DECL_MNAME,			/* member name missing */
+	D_DECL_SCOPE,			/* scoping operator used in decl */
+	D_DECL_BFCONST,			/* bit-field requires const size expr */
+	D_DECL_BFSIZE,			/* bit-field size too big for type */
+	D_DECL_BFTYPE,			/* bit-field type is not valid */
+	D_DECL_ENCONST,			/* enum tag requires const size expr */
+	D_DECL_ENOFLOW,			/* enumerator value overflows INT_MAX */
+	D_DECL_USELESS,			/* useless external declaration */
+	D_DECL_LOCASSC,			/* attempt to decl local assc array */
+	D_DECL_VOIDOBJ,			/* attempt to decl void object */
+	D_DECL_DYNOBJ,			/* attempt to decl dynamic object */
+	D_DECL_INCOMPLETE,		/* declaration uses incomplete type */
+	D_DECL_PROTO_VARARGS,		/* varargs not allowed in prototype */
+	D_DECL_PROTO_TYPE,		/* type not allowed in prototype */
+	D_DECL_PROTO_VOID,		/* void must be sole parameter */
+	D_DECL_PROTO_NAME,		/* void parameter may not have a name */
+	D_DECL_PROTO_FORM,		/* parameter name has no formal */
+	D_COMM_COMM,			/* commit() after commit() */
+	D_COMM_DREC,			/* commit() after data action */
+	D_SPEC_SPEC,			/* speculate() after speculate() */
+	D_SPEC_COMM,			/* speculate() after commit() */
+	D_SPEC_DREC,			/* speculate() after data action */
+	D_AGG_COMM,			/* aggregating act after commit() */
+	D_AGG_SPEC,			/* aggregating act after speculate() */
+	D_AGG_NULL,			/* aggregation stmt has null effect */
+	D_AGG_SCALAR,			/* aggregating function needs scalar */
+	D_ACT_SPEC,			/* destructive action after speculate */
+	D_EXIT_SPEC,			/* exit() action after speculate */
+	D_DREC_COMM,			/* data action after commit() */
+	D_PRINTA_PROTO,			/* printa() prototype mismatch */
+	D_PRINTA_AGGARG,		/* aggregation arg type mismatch */
+	D_PRINTA_AGGBAD,		/* printa() aggregation not defined */
+	D_PRINTA_AGGKEY,		/* printa() aggregation key mismatch */
+	D_PRINTA_AGGPROTO,		/* printa() aggregation mismatch */
+	D_TRACE_VOID,			/* trace() argument has void type */
+	D_TRACE_DYN,			/* trace() argument has dynamic type */
+	D_TRACEMEM_ADDR,		/* tracemem() address bad type */
+	D_TRACEMEM_SIZE,		/* tracemem() size bad type */
+	D_STACK_PROTO,			/* stack() prototype mismatch */
+	D_STACK_SIZE,			/* stack() size argument bad type */
+	D_USTACK_FRAMES,		/* ustack() frames arg bad type */
+	D_USTACK_STRSIZE,		/* ustack() strsize arg bad type */
+	D_USTACK_PROTO,			/* ustack() prototype mismatch */
+	D_LQUANT_BASETYPE,		/* lquantize() bad base type */
+	D_LQUANT_BASEVAL,		/* lquantize() bad base value */
+	D_LQUANT_LIMTYPE,		/* lquantize() bad limit type */
+	D_LQUANT_LIMVAL,		/* lquantize() bad limit value */
+	D_LQUANT_MISMATCH,		/* lquantize() limit < base */
+	D_LQUANT_STEPTYPE,		/* lquantize() bad step type */
+	D_LQUANT_STEPVAL,		/* lquantize() bad step value */
+	D_LQUANT_STEPLARGE,		/* lquantize() step too large */
+	D_LQUANT_STEPSMALL,		/* lquantize() step too small */
+	D_QUANT_PROTO,			/* quantize() prototype mismatch */
+	D_PROC_OFF,			/* byte offset exceeds function size */
+	D_PROC_ALIGN,			/* byte offset has invalid alignment */
+	D_PROC_NAME,			/* invalid process probe name */
+	D_PROC_GRAB,			/* failed to grab process */
+	D_PROC_DYN,			/* process is not dynamically linked */
+	D_PROC_LIB,			/* invalid process library name */
+	D_PROC_FUNC,			/* no such function in process */
+	D_PROC_CREATEFAIL,		/* pid probe creation failed */
+	D_PROC_NODEV,			/* fasttrap device is not installed */
+	D_PROC_BADPID,			/* user probe pid invalid */
+	D_PROC_BADPROV,			/* user probe provider invalid */
+	D_PROC_USDT,			/* problem initializing usdt */
+	D_CLEAR_PROTO,			/* clear() prototype mismatch */
+	D_CLEAR_AGGARG,			/* aggregation arg type mismatch */
+	D_CLEAR_AGGBAD,			/* clear() aggregation not defined */
+	D_NORMALIZE_PROTO,		/* normalize() prototype mismatch */
+	D_NORMALIZE_SCALAR,		/* normalize() value must be scalar */
+	D_NORMALIZE_AGGARG,		/* aggregation arg type mismatch */
+	D_NORMALIZE_AGGBAD,		/* normalize() aggregation not def. */
+	D_TRUNC_PROTO,			/* trunc() prototype mismatch */
+	D_TRUNC_SCALAR,			/* trunc() value must be scalar */
+	D_TRUNC_AGGARG,			/* aggregation arg type mismatch */
+	D_TRUNC_AGGBAD,			/* trunc() aggregation not def. */
+	D_PROV_BADNAME,			/* invalid provider name */
+	D_PROV_INCOMPAT,		/* provider/probe interface mismatch */
+	D_PROV_PRDUP,			/* duplicate probe declaration */
+	D_PROV_PRARGLEN,		/* probe argument list too long */
+	D_PROV_PRXLATOR,		/* probe argument translator missing */
+	D_FREOPEN_INVALID,		/* frename() filename is invalid */
+	D_LQUANT_MATCHBASE,		/* lquantize() mismatch on base */
+	D_LQUANT_MATCHLIM,		/* lquantize() mismatch on limit */
+	D_LQUANT_MATCHSTEP		/* lquantize() mismatch on step */
+} dt_errtag_t;
+
+extern const char *dt_errtag(dt_errtag_t);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_ERRTAGS_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.y b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.y
new file mode 100644
index 0000000..dc3ace3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_grammar.y
@@ -0,0 +1,842 @@
+%{
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <dt_impl.h>
+
+#define	OP1(op, c)	dt_node_op1(op, c)
+#define	OP2(op, l, r)	dt_node_op2(op, l, r)
+#define	OP3(x, y, z)	dt_node_op3(x, y, z)
+#define	LINK(l, r)	dt_node_link(l, r)
+#define	DUP(s)		strdup(s)
+
+#ifdef VBOX
+# define YYMALLOC RTMemAlloc
+# define YYFREE   RTMemFree
+#endif
+
+
+%}
+
+%union {
+	dt_node_t *l_node;
+	dt_decl_t *l_decl;
+	char *l_str;
+	uintmax_t l_int;
+	int l_tok;
+}
+
+%token	DT_TOK_COMMA DT_TOK_ELLIPSIS
+%token	DT_TOK_ASGN DT_TOK_ADD_EQ DT_TOK_SUB_EQ DT_TOK_MUL_EQ
+%token	DT_TOK_DIV_EQ DT_TOK_MOD_EQ DT_TOK_AND_EQ DT_TOK_XOR_EQ DT_TOK_OR_EQ
+%token	DT_TOK_LSH_EQ DT_TOK_RSH_EQ DT_TOK_QUESTION DT_TOK_COLON
+%token	DT_TOK_LOR DT_TOK_LXOR DT_TOK_LAND
+%token	DT_TOK_BOR DT_TOK_XOR DT_TOK_BAND DT_TOK_EQU DT_TOK_NEQ
+%token	DT_TOK_LT DT_TOK_LE DT_TOK_GT DT_TOK_GE DT_TOK_LSH DT_TOK_RSH
+%token	DT_TOK_ADD DT_TOK_SUB DT_TOK_MUL DT_TOK_DIV DT_TOK_MOD
+%token	DT_TOK_LNEG DT_TOK_BNEG DT_TOK_ADDADD DT_TOK_SUBSUB
+%token	DT_TOK_PREINC DT_TOK_POSTINC DT_TOK_PREDEC DT_TOK_POSTDEC
+%token	DT_TOK_IPOS DT_TOK_INEG DT_TOK_DEREF DT_TOK_ADDROF
+%token	DT_TOK_OFFSETOF DT_TOK_SIZEOF DT_TOK_STRINGOF DT_TOK_XLATE
+%token	DT_TOK_LPAR DT_TOK_RPAR DT_TOK_LBRAC DT_TOK_RBRAC DT_TOK_PTR DT_TOK_DOT
+
+%token <l_str>	DT_TOK_STRING
+%token <l_str>	DT_TOK_IDENT
+%token <l_str>	DT_TOK_PSPEC
+%token <l_str>	DT_TOK_AGG
+%token <l_str>	DT_TOK_TNAME
+%token <l_int>	DT_TOK_INT
+
+%token	DT_KEY_AUTO
+%token	DT_KEY_BREAK
+%token	DT_KEY_CASE
+%token	DT_KEY_CHAR
+%token	DT_KEY_CONST
+%token	DT_KEY_CONTINUE
+%token	DT_KEY_COUNTER
+%token	DT_KEY_DEFAULT
+%token	DT_KEY_DO
+%token	DT_KEY_DOUBLE
+%token	DT_KEY_ELSE
+%token	DT_KEY_ENUM
+%token	DT_KEY_EXTERN
+%token	DT_KEY_FLOAT
+%token	DT_KEY_FOR
+%token	DT_KEY_GOTO
+%token	DT_KEY_IF
+%token	DT_KEY_IMPORT
+%token	DT_KEY_INLINE
+%token	DT_KEY_INT
+%token	DT_KEY_LONG
+%token	DT_KEY_PROBE
+%token	DT_KEY_PROVIDER
+%token	DT_KEY_REGISTER
+%token	DT_KEY_RESTRICT
+%token	DT_KEY_RETURN
+%token	DT_KEY_SELF
+%token	DT_KEY_SHORT
+%token	DT_KEY_SIGNED
+%token	DT_KEY_STATIC
+%token	DT_KEY_STRING
+%token	DT_KEY_STRUCT
+%token	DT_KEY_SWITCH
+%token	DT_KEY_THIS
+%token	DT_KEY_TYPEDEF
+%token	DT_KEY_UNION
+%token	DT_KEY_UNSIGNED
+%token	DT_KEY_VOID
+%token	DT_KEY_VOLATILE
+%token	DT_KEY_WHILE
+%token	DT_KEY_XLATOR
+
+%token	DT_TOK_EPRED
+%token	DT_CTX_DEXPR
+%token	DT_CTX_DPROG
+%token	DT_CTX_DTYPE
+%token	DT_TOK_EOF	0
+
+%left	DT_TOK_COMMA
+%right	DT_TOK_ASGN DT_TOK_ADD_EQ DT_TOK_SUB_EQ DT_TOK_MUL_EQ DT_TOK_DIV_EQ
+	DT_TOK_MOD_EQ DT_TOK_AND_EQ DT_TOK_XOR_EQ DT_TOK_OR_EQ DT_TOK_LSH_EQ
+	DT_TOK_RSH_EQ
+%left	DT_TOK_QUESTION DT_TOK_COLON
+%left	DT_TOK_LOR
+%left	DT_TOK_LXOR
+%left	DT_TOK_LAND
+%left	DT_TOK_BOR
+%left	DT_TOK_XOR
+%left	DT_TOK_BAND
+%left	DT_TOK_EQU DT_TOK_NEQ
+%left	DT_TOK_LT DT_TOK_LE DT_TOK_GT DT_TOK_GE
+%left	DT_TOK_LSH DT_TOK_RSH
+%left	DT_TOK_ADD DT_TOK_SUB
+%left	DT_TOK_MUL DT_TOK_DIV DT_TOK_MOD
+%right	DT_TOK_LNEG DT_TOK_BNEG DT_TOK_ADDADD DT_TOK_SUBSUB
+	DT_TOK_IPOS DT_TOK_INEG
+%right	DT_TOK_DEREF DT_TOK_ADDROF DT_TOK_SIZEOF DT_TOK_STRINGOF DT_TOK_XLATE
+%left	DT_TOK_LPAR DT_TOK_RPAR DT_TOK_LBRAC DT_TOK_RBRAC DT_TOK_PTR DT_TOK_DOT
+
+%type	<l_node>	d_expression
+%type	<l_node>	d_program
+%type	<l_node>	d_type
+
+%type	<l_node>	translation_unit
+%type	<l_node>	external_declaration
+%type	<l_node>	inline_definition
+%type	<l_node>	translator_definition
+%type	<l_node>	translator_member_list
+%type	<l_node>	translator_member
+%type	<l_node>	provider_definition
+%type	<l_node>	provider_probe_list
+%type	<l_node>	provider_probe
+%type	<l_node>	probe_definition
+%type	<l_node>	probe_specifiers
+%type	<l_node>	probe_specifier_list
+%type	<l_node>	probe_specifier
+%type	<l_node>	statement_list
+%type	<l_node>	statement
+%type	<l_node>	declaration
+%type	<l_node>	init_declarator_list
+%type	<l_node>	init_declarator
+
+%type	<l_decl>	type_specifier
+%type	<l_decl>	type_qualifier
+%type	<l_decl>	struct_or_union_specifier
+%type	<l_decl>	specifier_qualifier_list
+%type	<l_decl>	enum_specifier
+%type	<l_decl>	declarator
+%type	<l_decl>	direct_declarator
+%type	<l_decl>	pointer
+%type	<l_decl>	type_qualifier_list
+%type	<l_decl>	type_name
+%type	<l_decl>	abstract_declarator
+%type	<l_decl>	direct_abstract_declarator
+
+%type	<l_node>	parameter_type_list
+%type	<l_node>	parameter_list
+%type	<l_node>	parameter_declaration
+
+%type	<l_node>	array
+%type	<l_node>	array_parameters
+%type	<l_node>	function
+%type	<l_node>	function_parameters
+
+%type	<l_node>	expression
+%type	<l_node>	assignment_expression
+%type	<l_node>	conditional_expression
+%type	<l_node>	constant_expression
+%type	<l_node>	logical_or_expression
+%type	<l_node>	logical_xor_expression
+%type	<l_node>	logical_and_expression
+%type	<l_node>	inclusive_or_expression
+%type	<l_node>	exclusive_or_expression
+%type	<l_node>	and_expression
+%type	<l_node>	equality_expression
+%type	<l_node>	relational_expression
+%type	<l_node>	shift_expression
+%type	<l_node>	additive_expression
+%type	<l_node>	multiplicative_expression
+%type	<l_node>	cast_expression
+%type	<l_node>	unary_expression
+%type	<l_node>	postfix_expression
+%type	<l_node>	primary_expression
+%type	<l_node>	argument_expression_list
+
+%type	<l_tok>		assignment_operator
+%type	<l_tok>		unary_operator
+%type	<l_tok>		struct_or_union
+
+%%
+
+dtrace_program: d_expression DT_TOK_EOF { return (dt_node_root($1)); }
+	|	d_program DT_TOK_EOF { return (dt_node_root($1)); }
+	|	d_type DT_TOK_EOF { return (dt_node_root($1)); }
+	;
+
+d_expression:	DT_CTX_DEXPR { $$ = NULL; }
+	|	DT_CTX_DEXPR expression { $$ = $2; }
+	;
+
+d_program:	DT_CTX_DPROG { $$ = dt_node_program(NULL); }
+	|	DT_CTX_DPROG translation_unit { $$ = dt_node_program($2); }
+	;
+
+d_type:		DT_CTX_DTYPE { $$ = NULL; }
+	|	DT_CTX_DTYPE type_name { $$ = (dt_node_t *)$2; }
+	;
+
+translation_unit:
+		external_declaration
+	|	translation_unit external_declaration { $$ = LINK($1, $2); }
+	;
+
+external_declaration:
+		inline_definition
+	|	translator_definition
+	|	provider_definition
+	|	probe_definition
+	|	declaration
+	;
+
+inline_definition:
+		DT_KEY_INLINE declaration_specifiers declarator
+		    { dt_scope_push(NULL, CTF_ERR); } DT_TOK_ASGN
+		    assignment_expression ';' {
+			/*
+			 * We push a new declaration scope before shifting the
+			 * assignment_expression in order to preserve ds_class
+			 * and ds_ident for use in dt_node_inline().  Once the
+			 * entire inline_definition rule is matched, pop the
+			 * scope and construct the inline using the saved decl.
+			 */
+			dt_scope_pop();
+			$$ = dt_node_inline($6);
+		}
+	;
+
+translator_definition:
+		DT_KEY_XLATOR type_name DT_TOK_LT type_name
+		    DT_TOK_IDENT DT_TOK_GT '{' translator_member_list '}' ';' {
+			$$ = dt_node_xlator($2, $4, $5, $8);
+		}
+	|	DT_KEY_XLATOR type_name DT_TOK_LT type_name
+		    DT_TOK_IDENT DT_TOK_GT '{' '}' ';' {
+			$$ = dt_node_xlator($2, $4, $5, NULL);
+		}
+	;
+
+translator_member_list:
+		translator_member
+	|	translator_member_list translator_member { $$ = LINK($1,$2); }
+	;
+
+translator_member:
+		DT_TOK_IDENT DT_TOK_ASGN assignment_expression ';' {
+			$$ = dt_node_member(NULL, $1, $3);
+		}
+	;
+
+provider_definition:
+		DT_KEY_PROVIDER DT_TOK_IDENT '{' provider_probe_list '}' ';' {
+			$$ = dt_node_provider($2, $4);
+		}
+	|	DT_KEY_PROVIDER DT_TOK_IDENT '{' '}' ';' {
+			$$ = dt_node_provider($2, NULL);
+		}
+	;
+
+provider_probe_list:
+		provider_probe
+	|	provider_probe_list provider_probe { $$ = LINK($1, $2); }
+	;
+
+provider_probe:
+		DT_KEY_PROBE DT_TOK_IDENT function DT_TOK_COLON function ';' {
+			$$ = dt_node_probe($2, 2, $3, $5);
+		}
+	|	DT_KEY_PROBE DT_TOK_IDENT function ';' {
+			$$ = dt_node_probe($2, 1, $3, NULL);
+		}
+	;
+
+
+probe_definition:
+		probe_specifiers {
+			/*
+			 * If the input stream is a file, do not permit a probe
+			 * specification without / <pred> / or { <act> } after
+			 * it.  This can only occur if the next token is EOF or
+			 * an ambiguous predicate was slurped up as a comment.
+			 * We cannot perform this check if input() is a string
+			 * because dtrace(1M) [-fmnP] also use the compiler and
+			 * things like dtrace -n BEGIN have to be accepted.
+			 */
+			if (yypcb->pcb_fileptr != NULL) {
+				dnerror($1, D_SYNTAX, "expected predicate and/"
+				    "or actions following probe description\n");
+			}
+			$$ = dt_node_clause($1, NULL, NULL);
+		}
+	|	probe_specifiers '{' statement_list '}' {
+			$$ = dt_node_clause($1, NULL, $3);
+		}
+	|	probe_specifiers DT_TOK_DIV expression DT_TOK_EPRED {
+			dnerror($3, D_SYNTAX, "expected actions { } following "
+			    "probe description and predicate\n");
+		}
+	|	probe_specifiers DT_TOK_DIV expression DT_TOK_EPRED
+		    '{' statement_list '}' {
+			$$ = dt_node_clause($1, $3, $6);
+		}
+	;
+
+probe_specifiers:
+		probe_specifier_list { yybegin(YYS_EXPR); $$ = $1; }
+	;
+
+probe_specifier_list:
+		probe_specifier
+	|	probe_specifier_list DT_TOK_COMMA probe_specifier {
+			$$ = LINK($1, $3);
+		}
+	;
+
+probe_specifier:
+		DT_TOK_PSPEC { $$ = dt_node_pdesc_by_name($1); }
+	|	DT_TOK_INT   { $$ = dt_node_pdesc_by_id($1); }
+	;
+
+statement_list:	statement { $$ = $1; }
+	|	statement_list ';' statement { $$ = LINK($1, $3); }
+	;
+
+statement:	/* empty */ { $$ = NULL; }
+	|	expression { $$ = dt_node_statement($1); }
+	;
+
+argument_expression_list:
+		assignment_expression
+	|	argument_expression_list DT_TOK_COMMA assignment_expression {
+			$$ = LINK($1, $3);
+		}
+	;
+
+primary_expression:
+		DT_TOK_IDENT { $$ = dt_node_ident($1); }
+	|	DT_TOK_AGG { $$ = dt_node_ident($1); }
+	|	DT_TOK_INT { $$ = dt_node_int($1); }
+	|	DT_TOK_STRING { $$ = dt_node_string($1); }
+	|	DT_KEY_SELF { $$ = dt_node_ident(DUP("self")); }
+	|	DT_KEY_THIS { $$ = dt_node_ident(DUP("this")); }
+	|	DT_TOK_LPAR expression DT_TOK_RPAR { $$ = $2; }
+	;
+
+postfix_expression:
+		primary_expression
+	|	postfix_expression
+		    DT_TOK_LBRAC argument_expression_list DT_TOK_RBRAC {
+			$$ = OP2(DT_TOK_LBRAC, $1, $3);
+		}
+	|	postfix_expression DT_TOK_LPAR DT_TOK_RPAR {
+			$$ = dt_node_func($1, NULL);
+		}
+	|	postfix_expression
+		    DT_TOK_LPAR argument_expression_list DT_TOK_RPAR {
+			$$ = dt_node_func($1, $3);
+		}
+	|	postfix_expression DT_TOK_DOT DT_TOK_IDENT {
+			$$ = OP2(DT_TOK_DOT, $1, dt_node_ident($3));
+		}
+	|	postfix_expression DT_TOK_DOT DT_TOK_TNAME {
+			$$ = OP2(DT_TOK_DOT, $1, dt_node_ident($3));
+		}
+	|	postfix_expression DT_TOK_PTR DT_TOK_IDENT {
+			$$ = OP2(DT_TOK_PTR, $1, dt_node_ident($3));
+		}
+	|	postfix_expression DT_TOK_PTR DT_TOK_TNAME {
+			$$ = OP2(DT_TOK_PTR, $1, dt_node_ident($3));
+		}
+	|	postfix_expression DT_TOK_ADDADD {
+			$$ = OP1(DT_TOK_POSTINC, $1);
+		}
+	|	postfix_expression DT_TOK_SUBSUB {
+			$$ = OP1(DT_TOK_POSTDEC, $1);
+		}
+	|	DT_TOK_OFFSETOF DT_TOK_LPAR type_name DT_TOK_COMMA
+		    DT_TOK_IDENT DT_TOK_RPAR {
+			$$ = dt_node_offsetof($3, $5);
+		}
+	|	DT_TOK_OFFSETOF DT_TOK_LPAR type_name DT_TOK_COMMA
+		    DT_TOK_TNAME DT_TOK_RPAR {
+			$$ = dt_node_offsetof($3, $5);
+		}
+	|	DT_TOK_XLATE DT_TOK_LT type_name DT_TOK_GT
+		    DT_TOK_LPAR expression DT_TOK_RPAR {
+			$$ = OP2(DT_TOK_XLATE, dt_node_type($3), $6);
+		}
+	;
+
+unary_expression:
+		postfix_expression
+	|	DT_TOK_ADDADD unary_expression { $$ = OP1(DT_TOK_PREINC, $2); }
+	|	DT_TOK_SUBSUB unary_expression { $$ = OP1(DT_TOK_PREDEC, $2); }
+	|	unary_operator cast_expression { $$ = OP1($1, $2); }
+	|	DT_TOK_SIZEOF unary_expression { $$ = OP1(DT_TOK_SIZEOF, $2); }
+	|	DT_TOK_SIZEOF DT_TOK_LPAR type_name DT_TOK_RPAR {
+			$$ = OP1(DT_TOK_SIZEOF, dt_node_type($3));
+		}
+	|	DT_TOK_STRINGOF unary_expression {
+			$$ = OP1(DT_TOK_STRINGOF, $2);
+		}
+	;
+
+unary_operator:	DT_TOK_BAND { $$ = DT_TOK_ADDROF; }
+	|	DT_TOK_MUL { $$ = DT_TOK_DEREF; }
+	|	DT_TOK_ADD { $$ = DT_TOK_IPOS; }
+	|	DT_TOK_SUB { $$ = DT_TOK_INEG; }
+	|	DT_TOK_BNEG { $$ = DT_TOK_BNEG; }
+	|	DT_TOK_LNEG { $$ = DT_TOK_LNEG; }
+	;
+
+cast_expression:
+		unary_expression
+	|	DT_TOK_LPAR type_name DT_TOK_RPAR cast_expression {
+			$$ = OP2(DT_TOK_LPAR, dt_node_type($2), $4);
+		}
+	;
+
+multiplicative_expression:
+		cast_expression
+	|	multiplicative_expression DT_TOK_MUL cast_expression {
+			$$ = OP2(DT_TOK_MUL, $1, $3);
+		}
+	|	multiplicative_expression DT_TOK_DIV cast_expression {
+			$$ = OP2(DT_TOK_DIV, $1, $3);
+		}
+	|	multiplicative_expression DT_TOK_MOD cast_expression {
+			$$ = OP2(DT_TOK_MOD, $1, $3);
+		}
+	;
+
+additive_expression:
+		multiplicative_expression
+	|	additive_expression DT_TOK_ADD multiplicative_expression {
+			$$ = OP2(DT_TOK_ADD, $1, $3);
+		}
+	|	additive_expression DT_TOK_SUB multiplicative_expression {
+			$$ = OP2(DT_TOK_SUB, $1, $3);
+		}
+	;
+
+shift_expression:
+		additive_expression
+	|	shift_expression DT_TOK_LSH additive_expression {
+			$$ = OP2(DT_TOK_LSH, $1, $3);
+		}
+	|	shift_expression DT_TOK_RSH additive_expression {
+			$$ = OP2(DT_TOK_RSH, $1, $3);
+		}
+	;
+
+relational_expression:
+		shift_expression
+	|	relational_expression DT_TOK_LT shift_expression {
+			$$ = OP2(DT_TOK_LT, $1, $3);
+		}
+	|	relational_expression DT_TOK_GT shift_expression {
+			$$ = OP2(DT_TOK_GT, $1, $3);
+		}
+	|	relational_expression DT_TOK_LE shift_expression {
+			$$ = OP2(DT_TOK_LE, $1, $3);
+		}
+	|	relational_expression DT_TOK_GE shift_expression {
+			$$ = OP2(DT_TOK_GE, $1, $3);
+		}
+	;
+
+equality_expression:
+		relational_expression
+	|	equality_expression DT_TOK_EQU relational_expression {
+			$$ = OP2(DT_TOK_EQU, $1, $3);
+		}
+	|	equality_expression DT_TOK_NEQ relational_expression {
+			$$ = OP2(DT_TOK_NEQ, $1, $3);
+		}
+	;
+
+and_expression:
+		equality_expression
+	|	and_expression DT_TOK_BAND equality_expression {
+			$$ = OP2(DT_TOK_BAND, $1, $3);
+		}
+	;
+
+exclusive_or_expression:
+		and_expression
+	|	exclusive_or_expression DT_TOK_XOR and_expression {
+			$$ = OP2(DT_TOK_XOR, $1, $3);
+		}
+	;
+
+inclusive_or_expression:
+		exclusive_or_expression
+	|	inclusive_or_expression DT_TOK_BOR exclusive_or_expression {
+			$$ = OP2(DT_TOK_BOR, $1, $3);
+		}
+	;
+
+logical_and_expression:
+		inclusive_or_expression
+	|	logical_and_expression DT_TOK_LAND inclusive_or_expression {
+			$$ = OP2(DT_TOK_LAND, $1, $3);
+		}
+	;
+
+logical_xor_expression:
+		logical_and_expression
+	|	logical_xor_expression DT_TOK_LXOR logical_and_expression {
+			$$ = OP2(DT_TOK_LXOR, $1, $3);
+		}
+	;
+
+logical_or_expression:
+		logical_xor_expression
+	|	logical_or_expression DT_TOK_LOR logical_xor_expression {
+			$$ = OP2(DT_TOK_LOR, $1, $3);
+		}
+	;
+
+constant_expression: conditional_expression
+	;
+
+conditional_expression:
+		logical_or_expression
+	|	logical_or_expression DT_TOK_QUESTION expression DT_TOK_COLON
+		    conditional_expression { $$ = OP3($1, $3, $5); }
+	;
+
+assignment_expression:
+		conditional_expression
+	|	unary_expression assignment_operator assignment_expression {
+			$$ = OP2($2, $1, $3);
+		}
+	;
+
+assignment_operator:
+		DT_TOK_ASGN   { $$ = DT_TOK_ASGN; }
+	|	DT_TOK_MUL_EQ { $$ = DT_TOK_MUL_EQ; }
+	|	DT_TOK_DIV_EQ { $$ = DT_TOK_DIV_EQ; }
+	|	DT_TOK_MOD_EQ { $$ = DT_TOK_MOD_EQ; }
+	|	DT_TOK_ADD_EQ { $$ = DT_TOK_ADD_EQ; }
+	|	DT_TOK_SUB_EQ { $$ = DT_TOK_SUB_EQ; }
+	|	DT_TOK_LSH_EQ { $$ = DT_TOK_LSH_EQ; }
+	|	DT_TOK_RSH_EQ { $$ = DT_TOK_RSH_EQ; }
+	|	DT_TOK_AND_EQ { $$ = DT_TOK_AND_EQ; }
+	|	DT_TOK_XOR_EQ { $$ = DT_TOK_XOR_EQ; }
+	|	DT_TOK_OR_EQ  { $$ = DT_TOK_OR_EQ; }
+	;
+
+expression:	assignment_expression
+	|	expression DT_TOK_COMMA assignment_expression {
+			$$ = OP2(DT_TOK_COMMA, $1, $3);
+		}
+	;
+
+declaration:	declaration_specifiers ';' {
+			$$ = dt_node_decl();
+			dt_decl_free(dt_decl_pop());
+			yybegin(YYS_CLAUSE);
+		}
+	|	declaration_specifiers init_declarator_list ';' {
+			$$ = $2;
+			dt_decl_free(dt_decl_pop());
+			yybegin(YYS_CLAUSE);
+		}
+	;
+
+declaration_specifiers:
+		d_storage_class_specifier
+	|	d_storage_class_specifier declaration_specifiers
+	|	type_specifier
+	|	type_specifier declaration_specifiers
+	|	type_qualifier
+	|	type_qualifier declaration_specifiers
+	;
+
+parameter_declaration_specifiers:
+		storage_class_specifier
+	|	storage_class_specifier declaration_specifiers
+	|	type_specifier
+	|	type_specifier declaration_specifiers
+	|	type_qualifier
+	|	type_qualifier declaration_specifiers
+	;
+
+storage_class_specifier:
+		DT_KEY_AUTO { dt_decl_class(DT_DC_AUTO); }
+	|	DT_KEY_REGISTER { dt_decl_class(DT_DC_REGISTER); }
+	|	DT_KEY_STATIC { dt_decl_class(DT_DC_STATIC); }
+	|	DT_KEY_EXTERN { dt_decl_class(DT_DC_EXTERN); }
+	|	DT_KEY_TYPEDEF { dt_decl_class(DT_DC_TYPEDEF); }
+	;
+
+d_storage_class_specifier:
+		storage_class_specifier
+	|	DT_KEY_SELF { dt_decl_class(DT_DC_SELF); }
+	|	DT_KEY_THIS { dt_decl_class(DT_DC_THIS); }
+	;
+
+type_specifier:	DT_KEY_VOID { $$ = dt_decl_spec(CTF_K_INTEGER, DUP("void")); }
+	|	DT_KEY_CHAR { $$ = dt_decl_spec(CTF_K_INTEGER, DUP("char")); }
+	|	DT_KEY_SHORT { $$ = dt_decl_attr(DT_DA_SHORT); }
+	|	DT_KEY_INT { $$ = dt_decl_spec(CTF_K_INTEGER, DUP("int")); }
+	|	DT_KEY_LONG { $$ = dt_decl_attr(DT_DA_LONG); }
+	|	DT_KEY_FLOAT { $$ = dt_decl_spec(CTF_K_FLOAT, DUP("float")); }
+	|	DT_KEY_DOUBLE { $$ = dt_decl_spec(CTF_K_FLOAT, DUP("double")); }
+	|	DT_KEY_SIGNED { $$ = dt_decl_attr(DT_DA_SIGNED); }
+	|	DT_KEY_UNSIGNED { $$ = dt_decl_attr(DT_DA_UNSIGNED); }
+	|	DT_KEY_STRING {
+			$$ = dt_decl_spec(CTF_K_TYPEDEF, DUP("string"));
+		}
+	|	DT_TOK_TNAME { $$ = dt_decl_spec(CTF_K_TYPEDEF, $1); }
+	|	struct_or_union_specifier
+	|	enum_specifier
+	;
+
+type_qualifier:	DT_KEY_CONST { $$ = dt_decl_attr(DT_DA_CONST); }
+	|	DT_KEY_RESTRICT { $$ = dt_decl_attr(DT_DA_RESTRICT); }
+	|	DT_KEY_VOLATILE { $$ = dt_decl_attr(DT_DA_VOLATILE); }
+	;
+
+struct_or_union_specifier:
+		struct_or_union_definition struct_declaration_list '}' {
+			$$ = dt_scope_pop();
+		}
+	|	struct_or_union DT_TOK_IDENT { $$ = dt_decl_spec($1, $2); }
+	|	struct_or_union DT_TOK_TNAME { $$ = dt_decl_spec($1, $2); }
+	;
+
+struct_or_union_definition:
+		struct_or_union '{' { dt_decl_sou($1, NULL); }
+	|	struct_or_union DT_TOK_IDENT '{' { dt_decl_sou($1, $2); }
+	|	struct_or_union DT_TOK_TNAME '{' { dt_decl_sou($1, $2); }
+	;
+
+struct_or_union:
+		DT_KEY_STRUCT { $$ = CTF_K_STRUCT; }
+	|	DT_KEY_UNION { $$ = CTF_K_UNION; }
+	;
+
+struct_declaration_list:
+		struct_declaration
+	|	struct_declaration_list struct_declaration
+	;
+
+init_declarator_list:
+		init_declarator
+	|	init_declarator_list DT_TOK_COMMA init_declarator {
+			$$ = LINK($1, $3);
+		}
+	;
+
+init_declarator:
+		declarator {
+			$$ = dt_node_decl();
+			dt_decl_reset();
+		}
+	;
+
+struct_declaration:
+		specifier_qualifier_list struct_declarator_list ';' {
+			dt_decl_free(dt_decl_pop());
+		}
+	;
+
+specifier_qualifier_list:
+		type_specifier
+	|	type_specifier specifier_qualifier_list { $$ = $2; }
+	|	type_qualifier
+	|	type_qualifier specifier_qualifier_list { $$ = $2; }
+	;
+
+struct_declarator_list:
+		struct_declarator
+	|	struct_declarator_list DT_TOK_COMMA struct_declarator
+	;
+
+struct_declarator:
+		declarator { dt_decl_member(NULL); }
+	|	DT_TOK_COLON constant_expression { dt_decl_member($2); }
+	|	declarator DT_TOK_COLON constant_expression {
+			dt_decl_member($3);
+		}
+	;
+
+enum_specifier:
+		enum_definition enumerator_list '}' { $$ = dt_scope_pop(); }
+	|	DT_KEY_ENUM DT_TOK_IDENT { $$ = dt_decl_spec(CTF_K_ENUM, $2); }
+	|	DT_KEY_ENUM DT_TOK_TNAME { $$ = dt_decl_spec(CTF_K_ENUM, $2); }
+	;
+
+enum_definition:
+		DT_KEY_ENUM '{' { dt_decl_enum(NULL); }
+	|	DT_KEY_ENUM DT_TOK_IDENT '{' { dt_decl_enum($2); }
+	|	DT_KEY_ENUM DT_TOK_TNAME '{' { dt_decl_enum($2); }
+	;
+
+enumerator_list:
+		enumerator
+	|	enumerator_list DT_TOK_COMMA enumerator
+	;
+
+enumerator:	DT_TOK_IDENT { dt_decl_enumerator($1, NULL); }
+	|	DT_TOK_IDENT DT_TOK_ASGN expression {
+			dt_decl_enumerator($1, $3);
+		}
+	;
+
+declarator:	direct_declarator
+	|	pointer direct_declarator
+	;
+
+direct_declarator:
+		DT_TOK_IDENT { $$ = dt_decl_ident($1); }
+	|	lparen declarator DT_TOK_RPAR { $$ = $2; }
+	|	direct_declarator array { dt_decl_array($2); }
+	|	direct_declarator function { dt_decl_func($1, $2); }
+	;
+
+lparen:		DT_TOK_LPAR { dt_decl_top()->dd_attr |= DT_DA_PAREN; }
+	;
+
+pointer:	DT_TOK_MUL { $$ = dt_decl_ptr(); }
+	|	DT_TOK_MUL type_qualifier_list { $$ = dt_decl_ptr(); }
+	|	DT_TOK_MUL pointer { $$ = dt_decl_ptr(); }
+	|	DT_TOK_MUL type_qualifier_list pointer { $$ = dt_decl_ptr(); }
+	;
+
+type_qualifier_list:
+		type_qualifier
+	|	type_qualifier_list type_qualifier { $$ = $2; }
+	;
+
+parameter_type_list:
+		parameter_list
+	|	DT_TOK_ELLIPSIS { $$ = dt_node_vatype(); }
+	|	parameter_list DT_TOK_COMMA DT_TOK_ELLIPSIS {
+			$$ = LINK($1, dt_node_vatype());
+		}
+	;
+
+parameter_list:	parameter_declaration
+	|	parameter_list DT_TOK_COMMA parameter_declaration {
+			$$ = LINK($1, $3);
+		}
+	;
+
+parameter_declaration:
+		parameter_declaration_specifiers {
+			$$ = dt_node_type(NULL);
+		}
+	|	parameter_declaration_specifiers declarator {
+			$$ = dt_node_type(NULL);
+		}
+	|	parameter_declaration_specifiers abstract_declarator {
+			$$ = dt_node_type(NULL);
+		}
+	;
+
+type_name:	specifier_qualifier_list {
+			$$ = dt_decl_pop();
+		}
+	|	specifier_qualifier_list abstract_declarator {
+			$$ = dt_decl_pop();
+		}
+	;
+
+abstract_declarator:
+		pointer
+	|	direct_abstract_declarator
+	|	pointer direct_abstract_declarator
+	;
+
+direct_abstract_declarator:
+		lparen abstract_declarator DT_TOK_RPAR { $$ = $2; }
+	|	direct_abstract_declarator array { dt_decl_array($2); }
+	|	array { dt_decl_array($1); $$ = NULL; }
+	|	direct_abstract_declarator function { dt_decl_func($1, $2); }
+	|	function { dt_decl_func(NULL, $1); }
+	;
+
+array:		DT_TOK_LBRAC { dt_scope_push(NULL, CTF_ERR); }
+		    array_parameters DT_TOK_RBRAC {
+			dt_scope_pop();
+			$$ = $3;
+		}
+	;
+
+array_parameters:
+		/* empty */ 		{ $$ = NULL; }
+	|	constant_expression	{ $$ = $1; }
+	|	parameter_type_list	{ $$ = $1; }
+	;
+
+function:	DT_TOK_LPAR { dt_scope_push(NULL, CTF_ERR); }
+		    function_parameters DT_TOK_RPAR {
+			dt_scope_pop();
+			$$ = $3;
+		}
+	;
+
+function_parameters:
+		/* empty */ 		{ $$ = NULL; }
+	|	parameter_type_list	{ $$ = $1; }
+	;
+
+%%
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_handle.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_handle.c
new file mode 100644
index 0000000..b02e5cc
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_handle.c
@@ -0,0 +1,483 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <strings.h>
+#include <errno.h>
+#include <unistd.h>
+#include <assert.h>
+#include <alloca.h>
+#endif
+
+#include <dt_impl.h>
+#include <dt_program.h>
+
+static const char _dt_errprog[] =
+"dtrace:::ERROR"
+"{"
+"	trace(arg1);"
+"	trace(arg2);"
+"	trace(arg3);"
+"	trace(arg4);"
+"	trace(arg5);"
+"}";
+
+int
+dtrace_handle_err(dtrace_hdl_t *dtp, dtrace_handle_err_f *hdlr, void *arg)
+{
+	dtrace_prog_t *pgp = NULL;
+	dt_stmt_t *stp;
+	dtrace_ecbdesc_t *edp;
+
+	/*
+	 * We don't currently support multiple error handlers.
+	 */
+	if (dtp->dt_errhdlr != NULL)
+		return (dt_set_errno(dtp, EALREADY));
+
+	/*
+	 * If the DTRACEOPT_GRABANON is enabled, the anonymous enabling will
+	 * already have a dtrace:::ERROR probe enabled; save 'hdlr' and 'arg'
+	 * but do not bother compiling and enabling _dt_errprog.
+	 */
+	if (dtp->dt_options[DTRACEOPT_GRABANON] != DTRACEOPT_UNSET)
+		goto out;
+
+	if ((pgp = dtrace_program_strcompile(dtp, _dt_errprog,
+	    DTRACE_PROBESPEC_NAME, DTRACE_C_ZDEFS, 0, NULL)) == NULL)
+		return (dt_set_errno(dtp, dtrace_errno(dtp)));
+
+	stp = dt_list_next(&pgp->dp_stmts);
+	assert(stp != NULL);
+
+	edp = stp->ds_desc->dtsd_ecbdesc;
+	assert(edp != NULL);
+	edp->dted_uarg = DT_ECB_ERROR;
+
+out:
+	dtp->dt_errhdlr = hdlr;
+	dtp->dt_errarg = arg;
+	dtp->dt_errprog = pgp;
+
+	return (0);
+}
+
+int
+dtrace_handle_drop(dtrace_hdl_t *dtp, dtrace_handle_drop_f *hdlr, void *arg)
+{
+	if (dtp->dt_drophdlr != NULL)
+		return (dt_set_errno(dtp, EALREADY));
+
+	dtp->dt_drophdlr = hdlr;
+	dtp->dt_droparg = arg;
+
+	return (0);
+}
+
+int
+dtrace_handle_proc(dtrace_hdl_t *dtp, dtrace_handle_proc_f *hdlr, void *arg)
+{
+	if (dtp->dt_prochdlr != NULL)
+		return (dt_set_errno(dtp, EALREADY));
+
+	dtp->dt_prochdlr = hdlr;
+	dtp->dt_procarg = arg;
+
+	return (0);
+}
+
+int
+dtrace_handle_buffered(dtrace_hdl_t *dtp, dtrace_handle_buffered_f *hdlr,
+    void *arg)
+{
+	if (dtp->dt_bufhdlr != NULL)
+		return (dt_set_errno(dtp, EALREADY));
+
+	if (hdlr == NULL)
+		return (dt_set_errno(dtp, EINVAL));
+
+	dtp->dt_bufhdlr = hdlr;
+	dtp->dt_bufarg = arg;
+
+	return (0);
+}
+
+int
+dtrace_handle_setopt(dtrace_hdl_t *dtp, dtrace_handle_setopt_f *hdlr,
+    void *arg)
+{
+	if (hdlr == NULL)
+		return (dt_set_errno(dtp, EINVAL));
+
+	dtp->dt_setopthdlr = hdlr;
+	dtp->dt_setoptarg = arg;
+
+	return (0);
+}
+
+#define	DT_REC(type, ndx) *((type *)((uintptr_t)data->dtpda_data + \
+    epd->dtepd_rec[(ndx)].dtrd_offset))
+
+static int
+dt_handle_err(dtrace_hdl_t *dtp, dtrace_probedata_t *data)
+{
+	dtrace_eprobedesc_t *epd = data->dtpda_edesc, *errepd;
+	dtrace_probedesc_t *pd = data->dtpda_pdesc, *errpd;
+	dtrace_errdata_t err;
+	dtrace_epid_t epid;
+
+	char where[30];
+	char details[30];
+	char offinfo[30];
+	const int slop = 80;
+	const char *faultstr;
+	char *str;
+	VBDTTYPE(size_t,int) len;
+
+	assert(epd->dtepd_uarg == DT_ECB_ERROR);
+
+	if (epd->dtepd_nrecs != 5 || strcmp(pd->dtpd_provider, "dtrace") != 0 ||
+	    strcmp(pd->dtpd_name, "ERROR") != 0)
+		return (dt_set_errno(dtp, EDT_BADERROR));
+
+	/*
+	 * This is an error.  We have the following items here:  EPID,
+	 * faulting action, DIF offset, fault code and faulting address.
+	 */
+	epid = (uint32_t)DT_REC(uint64_t, 0);
+
+	if (dt_epid_lookup(dtp, epid, &errepd, &errpd) != 0)
+		return (dt_set_errno(dtp, EDT_BADERROR));
+
+	err.dteda_edesc = errepd;
+	err.dteda_pdesc = errpd;
+	err.dteda_cpu = data->dtpda_cpu;
+	err.dteda_action = (int)DT_REC(uint64_t, 1);
+	err.dteda_offset = (int)DT_REC(uint64_t, 2);
+	err.dteda_fault = (int)DT_REC(uint64_t, 3);
+	err.dteda_addr = DT_REC(uint64_t, 4);
+
+	faultstr = dtrace_faultstr(dtp, err.dteda_fault);
+	len = sizeof (where) + sizeof (offinfo) + strlen(faultstr) +
+	    strlen(errpd->dtpd_provider) + strlen(errpd->dtpd_mod) +
+	    strlen(errpd->dtpd_name) + strlen(errpd->dtpd_func) +
+	    slop;
+
+	str = (char *)alloca(len);
+
+	if (err.dteda_action == 0) {
+		(void) sprintf(where, "predicate");
+	} else {
+		(void) sprintf(where, "action #%d", err.dteda_action);
+	}
+
+	if (err.dteda_offset != -1) {
+		(void) sprintf(offinfo, " at DIF offset %d", err.dteda_offset);
+	} else {
+		offinfo[0] = 0;
+	}
+
+	switch (err.dteda_fault) {
+	case DTRACEFLT_BADADDR:
+	case DTRACEFLT_BADALIGN:
+	case DTRACEFLT_BADSTACK:
+		(void) sprintf(details, " (0x%llx)",
+		    (u_longlong_t)err.dteda_addr);
+		break;
+
+	default:
+		details[0] = 0;
+	}
+
+	(void) snprintf(str, len, "error on enabled probe ID %u "
+	    "(ID %u: %s:%s:%s:%s): %s%s in %s%s\n",
+	    epid, errpd->dtpd_id, errpd->dtpd_provider,
+	    errpd->dtpd_mod, errpd->dtpd_func,
+	    errpd->dtpd_name, dtrace_faultstr(dtp, err.dteda_fault),
+	    details, where, offinfo);
+
+	err.dteda_msg = str;
+
+	if (dtp->dt_errhdlr == NULL)
+		return (dt_set_errno(dtp, EDT_ERRABORT));
+
+	if ((*dtp->dt_errhdlr)(&err, dtp->dt_errarg) == DTRACE_HANDLE_ABORT)
+		return (dt_set_errno(dtp, EDT_ERRABORT));
+
+	return (0);
+}
+
+int
+dt_handle_liberr(dtrace_hdl_t *dtp, const dtrace_probedata_t *data,
+    const char *faultstr)
+{
+	dtrace_probedesc_t *errpd = data->dtpda_pdesc;
+	dtrace_errdata_t err;
+	const int slop = 80;
+	char *str;
+	VBDTTYPE(size_t,int) len;
+
+	err.dteda_edesc = data->dtpda_edesc;
+	err.dteda_pdesc = errpd;
+	err.dteda_cpu = data->dtpda_cpu;
+	err.dteda_action = -1;
+	err.dteda_offset = -1;
+	err.dteda_fault = DTRACEFLT_LIBRARY;
+	err.dteda_addr = 0 /*NULL*/;
+
+	len = strlen(faultstr) +
+	    strlen(errpd->dtpd_provider) + strlen(errpd->dtpd_mod) +
+	    strlen(errpd->dtpd_name) + strlen(errpd->dtpd_func) +
+	    slop;
+
+	str = alloca(len);
+
+	(void) snprintf(str, len, "error on enabled probe ID %u "
+	    "(ID %u: %s:%s:%s:%s): %s\n",
+	    data->dtpda_edesc->dtepd_epid,
+	    errpd->dtpd_id, errpd->dtpd_provider,
+	    errpd->dtpd_mod, errpd->dtpd_func,
+	    errpd->dtpd_name, faultstr);
+
+	err.dteda_msg = str;
+
+	if (dtp->dt_errhdlr == NULL)
+		return (dt_set_errno(dtp, EDT_ERRABORT));
+
+	if ((*dtp->dt_errhdlr)(&err, dtp->dt_errarg) == DTRACE_HANDLE_ABORT)
+		return (dt_set_errno(dtp, EDT_ERRABORT));
+
+	return (0);
+}
+
+#define	DROPTAG(x)	x, #x
+
+static const struct {
+	dtrace_dropkind_t dtdrg_kind;
+	char *dtdrg_tag;
+} _dt_droptags[] = {
+	{ DROPTAG(DTRACEDROP_PRINCIPAL) },
+	{ DROPTAG(DTRACEDROP_AGGREGATION) },
+	{ DROPTAG(DTRACEDROP_DYNAMIC) },
+	{ DROPTAG(DTRACEDROP_DYNRINSE) },
+	{ DROPTAG(DTRACEDROP_DYNDIRTY) },
+	{ DROPTAG(DTRACEDROP_SPEC) },
+	{ DROPTAG(DTRACEDROP_SPECBUSY) },
+	{ DROPTAG(DTRACEDROP_SPECUNAVAIL) },
+	{ DROPTAG(DTRACEDROP_DBLERROR) },
+	{ DROPTAG(DTRACEDROP_STKSTROVERFLOW) },
+	{ 0, NULL }
+};
+
+static const char *
+dt_droptag(dtrace_dropkind_t kind)
+{
+	int i;
+
+	for (i = 0; _dt_droptags[i].dtdrg_tag != NULL; i++) {
+		if (_dt_droptags[i].dtdrg_kind == kind)
+			return (_dt_droptags[i].dtdrg_tag);
+	}
+
+	return ("DTRACEDROP_UNKNOWN");
+}
+
+int
+dt_handle_cpudrop(dtrace_hdl_t *dtp, processorid_t cpu,
+    dtrace_dropkind_t what, uint64_t howmany)
+{
+	dtrace_dropdata_t drop;
+	char str[80], *s;
+	VBDTTYPE(size_t,int) size;
+
+	assert(what == DTRACEDROP_PRINCIPAL || what == DTRACEDROP_AGGREGATION);
+
+	bzero(&drop, sizeof (drop));
+	drop.dtdda_handle = dtp;
+	drop.dtdda_cpu = cpu;
+	drop.dtdda_kind = what;
+	drop.dtdda_drops = howmany;
+	drop.dtdda_msg = str;
+
+	if (dtp->dt_droptags) {
+		(void) snprintf(str, sizeof (str), "[%s] ", dt_droptag(what));
+		s = &str[strlen(str)];
+		size = sizeof (str) - (s - str);
+	} else {
+		s = str;
+		size = sizeof (str);
+	}
+
+	(void) snprintf(s, size, "%llu %sdrop%s on CPU %d\n",
+	    howmany, what == DTRACEDROP_PRINCIPAL ? "" : "aggregation ",
+	    howmany > 1 ? "s" : "", cpu);
+
+	if (dtp->dt_drophdlr == NULL)
+		return (dt_set_errno(dtp, EDT_DROPABORT));
+
+	if ((*dtp->dt_drophdlr)(&drop, dtp->dt_droparg) == DTRACE_HANDLE_ABORT)
+		return (dt_set_errno(dtp, EDT_DROPABORT));
+
+	return (0);
+}
+
+static const struct {
+	dtrace_dropkind_t dtdrt_kind;
+	uintptr_t dtdrt_offset;
+	const char *dtdrt_str;
+	const char *dtdrt_msg;
+} _dt_droptab[] = {
+	{ DTRACEDROP_DYNAMIC,
+	    offsetof(dtrace_status_t, dtst_dyndrops),
+	    "dynamic variable drop" },
+
+	{ DTRACEDROP_DYNRINSE,
+	    offsetof(dtrace_status_t, dtst_dyndrops_rinsing),
+	    "dynamic variable drop", " with non-empty rinsing list" },
+
+	{ DTRACEDROP_DYNDIRTY,
+	    offsetof(dtrace_status_t, dtst_dyndrops_dirty),
+	    "dynamic variable drop", " with non-empty dirty list" },
+
+	{ DTRACEDROP_SPEC,
+	    offsetof(dtrace_status_t, dtst_specdrops),
+	    "speculative drop" },
+
+	{ DTRACEDROP_SPECBUSY,
+	    offsetof(dtrace_status_t, dtst_specdrops_busy),
+	    "failed speculation", " (available buffer(s) still busy)" },
+
+	{ DTRACEDROP_SPECUNAVAIL,
+	    offsetof(dtrace_status_t, dtst_specdrops_unavail),
+	    "failed speculation", " (no speculative buffer available)" },
+
+	{ DTRACEDROP_STKSTROVERFLOW,
+	    offsetof(dtrace_status_t, dtst_stkstroverflows),
+	    "jstack()/ustack() string table overflow" },
+
+	{ DTRACEDROP_DBLERROR,
+	    offsetof(dtrace_status_t, dtst_dblerrors),
+	    "error", " in ERROR probe enabling" },
+
+	{ 0, 0, NULL }
+};
+
+int
+dt_handle_status(dtrace_hdl_t *dtp, dtrace_status_t *old, dtrace_status_t *new)
+{
+	dtrace_dropdata_t drop;
+	char str[80], *s;
+	uintptr_t base = (uintptr_t)new, obase = (uintptr_t)old;
+	int i, size;
+
+	bzero(&drop, sizeof (drop));
+	drop.dtdda_handle = dtp;
+	drop.dtdda_cpu = DTRACE_CPUALL;
+	drop.dtdda_msg = str;
+
+	/*
+	 * First, check to see if we've been killed -- in which case we abort.
+	 */
+	if (new->dtst_killed && !old->dtst_killed)
+		return (dt_set_errno(dtp, EDT_BRICKED));
+
+	for (i = 0; _dt_droptab[i].dtdrt_str != NULL; i++) {
+		uintptr_t naddr = base + _dt_droptab[i].dtdrt_offset;
+		uintptr_t oaddr = obase + _dt_droptab[i].dtdrt_offset;
+
+		uint64_t nval = *((uint64_t *)naddr);
+		uint64_t oval = *((uint64_t *)oaddr);
+
+		if (nval == oval)
+			continue;
+
+		if (dtp->dt_droptags) {
+			(void) snprintf(str, sizeof (str), "[%s] ",
+			    dt_droptag(_dt_droptab[i].dtdrt_kind));
+			s = &str[strlen(str)];
+			size = VBDTCAST(int)sizeof (str) - (s - str);
+		} else {
+			s = str;
+			size = sizeof (str);
+		}
+
+		(void) snprintf(s, size, "%llu %s%s%s\n", nval - oval,
+		    _dt_droptab[i].dtdrt_str, (nval - oval > 1) ? "s" : "",
+		    _dt_droptab[i].dtdrt_msg != NULL ?
+		    _dt_droptab[i].dtdrt_msg : "");
+
+		drop.dtdda_kind = _dt_droptab[i].dtdrt_kind;
+		drop.dtdda_total = nval;
+		drop.dtdda_drops = nval - oval;
+
+		if (dtp->dt_drophdlr == NULL)
+			return (dt_set_errno(dtp, EDT_DROPABORT));
+
+		if ((*dtp->dt_drophdlr)(&drop,
+		    dtp->dt_droparg) == DTRACE_HANDLE_ABORT)
+			return (dt_set_errno(dtp, EDT_DROPABORT));
+	}
+
+	return (0);
+}
+
+int
+dt_handle_setopt(dtrace_hdl_t *dtp, dtrace_setoptdata_t *data)
+{
+	void *arg = dtp->dt_setoptarg;
+
+	if (dtp->dt_setopthdlr == NULL)
+		return (0);
+
+	if ((*dtp->dt_setopthdlr)(data, arg) == DTRACE_HANDLE_ABORT)
+		return (dt_set_errno(dtp, EDT_DIRABORT));
+
+	return (0);
+}
+
+int
+dt_handle(dtrace_hdl_t *dtp, dtrace_probedata_t *data)
+{
+	dtrace_eprobedesc_t *epd = data->dtpda_edesc;
+	int rval;
+
+	switch (epd->dtepd_uarg) {
+	case DT_ECB_ERROR:
+		rval = dt_handle_err(dtp, data);
+		break;
+
+	default:
+		return (DTRACE_CONSUME_THIS);
+	}
+
+	if (rval == 0)
+		return (DTRACE_CONSUME_NEXT);
+
+	return (DTRACE_CONSUME_ERROR);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_ident.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_ident.c
new file mode 100644
index 0000000..dfb873e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_ident.c
@@ -0,0 +1,1045 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <sys/sysmacros.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <alloca.h>
+#include <assert.h>
+#include <errno.h>
+#include <ctype.h>
+#include <sys/procfs_isa.h>
+#include <limits.h>
+#else  /* VBOX */
+# include <ctype.h>
+#endif /* VBOX */
+
+#include <dt_ident.h>
+#include <dt_parser.h>
+#include <dt_provider.h>
+#include <dt_strtab.h>
+#include <dt_impl.h>
+
+/*
+ * Common code for cooking an identifier that uses a typed signature list (we
+ * use this for associative arrays and functions).  If the argument list is
+ * of the same length and types, then return the return type.  Otherwise
+ * print an appropriate compiler error message and abort the compile.
+ */
+static void
+dt_idcook_sign(dt_node_t *dnp, dt_ident_t *idp,
+    int argc, dt_node_t *args, const char *prefix, const char *suffix)
+{
+	dt_idsig_t *isp = idp->di_data;
+	int i, compat, mismatch, arglimit, iskey;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	iskey = idp->di_kind == DT_IDENT_ARRAY || idp->di_kind == DT_IDENT_AGG;
+
+	if (isp->dis_varargs >= 0) {
+		mismatch = argc < isp->dis_varargs;
+		arglimit = isp->dis_varargs;
+	} else if (isp->dis_optargs >= 0) {
+		mismatch = (argc < isp->dis_optargs || argc > isp->dis_argc);
+		arglimit = argc;
+	} else {
+		mismatch = argc != isp->dis_argc;
+		arglimit = isp->dis_argc;
+	}
+
+	if (mismatch) {
+		xyerror(D_PROTO_LEN, "%s%s%s prototype mismatch: %d %s%s"
+		    "passed, %s%d expected\n", prefix, idp->di_name, suffix,
+		    argc, iskey ? "key" : "arg", argc == 1 ? " " : "s ",
+		    isp->dis_optargs >= 0 ? "at least " : "",
+		    isp->dis_optargs >= 0 ? isp->dis_optargs : arglimit);
+	}
+
+	for (i = 0; i < arglimit; i++, args = args->dn_list) {
+		if (isp->dis_args[i].dn_ctfp != NULL)
+			compat = dt_node_is_argcompat(&isp->dis_args[i], args);
+		else
+			compat = 1; /* "@" matches any type */
+
+		if (!compat) {
+			xyerror(D_PROTO_ARG,
+			    "%s%s%s %s #%d is incompatible with "
+			    "prototype:\n\tprototype: %s\n\t%9s: %s\n",
+			    prefix, idp->di_name, suffix,
+			    iskey ? "key" : "argument", i + 1,
+			    dt_node_type_name(&isp->dis_args[i], n1,
+			    sizeof (n1)),
+			    iskey ? "key" : "argument",
+			    dt_node_type_name(args, n2, sizeof (n2)));
+		}
+	}
+
+	dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
+}
+
+/*
+ * Cook an associative array identifier.  If this is the first time we are
+ * cooking this array, create its signature based on the argument list.
+ * Otherwise validate the argument list against the existing signature.
+ */
+static void
+dt_idcook_assc(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
+{
+	if (idp->di_data == NULL) {
+		dt_idsig_t *isp = idp->di_data = malloc(sizeof (dt_idsig_t));
+		char n[DT_TYPE_NAMELEN];
+		int i;
+
+		if (isp == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+		isp->dis_varargs = -1;
+		isp->dis_optargs = -1;
+		isp->dis_argc = argc;
+		isp->dis_args = NULL;
+		isp->dis_auxinfo = 0;
+
+		if (argc != 0 && (isp->dis_args = calloc(argc,
+		    sizeof (dt_node_t))) == NULL) {
+			idp->di_data = NULL;
+			free(isp);
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+		}
+
+		/*
+		 * If this identifier has not been explicitly declared earlier,
+		 * set the identifier's base type to be our special type <DYN>.
+		 * If this ident is an aggregation, it will remain as is.  If
+		 * this ident is an associative array, it will be reassigned
+		 * based on the result type of the first assignment statement.
+		 */
+		if (!(idp->di_flags & DT_IDFLG_DECL)) {
+			idp->di_ctfp = DT_DYN_CTFP(yypcb->pcb_hdl);
+			idp->di_type = DT_DYN_TYPE(yypcb->pcb_hdl);
+		}
+
+		for (i = 0; i < argc; i++, args = args->dn_list) {
+			if (dt_node_is_dynamic(args) || dt_node_is_void(args)) {
+				xyerror(D_KEY_TYPE, "%s expression may not be "
+				    "used as %s index: key #%d\n",
+				    dt_node_type_name(args, n, sizeof (n)),
+				    dt_idkind_name(idp->di_kind), i + 1);
+			}
+
+			dt_node_type_propagate(args, &isp->dis_args[i]);
+			isp->dis_args[i].dn_list = &isp->dis_args[i + 1];
+		}
+
+		if (argc != 0)
+			isp->dis_args[argc - 1].dn_list = NULL;
+
+		dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
+
+	} else {
+		dt_idcook_sign(dnp, idp, argc, args,
+		    idp->di_kind == DT_IDENT_AGG ? "@" : "", "[ ]");
+	}
+}
+
+/*
+ * Cook a function call.  If this is the first time we are cooking this
+ * identifier, create its type signature based on predefined prototype stored
+ * in di_iarg.  We then validate the argument list against this signature.
+ */
+static void
+dt_idcook_func(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
+{
+	if (idp->di_data == NULL) {
+		dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+		dtrace_typeinfo_t dtt;
+		dt_idsig_t *isp;
+		char *s, *p1, *p2;
+		int i = 0;
+
+		assert(idp->di_iarg != NULL);
+#ifndef VBOX
+		s = strdupa(idp->di_iarg);
+#else
+		MY_STRDUPA(s, idp->di_iarg);
+#endif
+
+		if ((p2 = strrchr(s, ')')) != NULL)
+			*p2 = '\0'; /* mark end of parameter list string */
+
+		if ((p1 = strchr(s, '(')) != NULL)
+			*p1++ = '\0'; /* mark end of return type string */
+
+		if (p1 == NULL || p2 == NULL) {
+			xyerror(D_UNKNOWN, "internal error: malformed entry "
+			    "for built-in function %s\n", idp->di_name);
+		}
+
+		for (p2 = p1; *p2 != '\0'; p2++) {
+			if (!isspace(*p2)) {
+				i++;
+				break;
+			}
+		}
+
+		for (p2 = strchr(p2, ','); p2++ != NULL; i++)
+			p2 = strchr(p2, ',');
+
+		/*
+		 * We first allocate a new ident signature structure with the
+		 * appropriate number of argument entries, and then look up
+		 * the return type and store its CTF data in di_ctfp/type.
+		 */
+		if ((isp = idp->di_data = malloc(sizeof (dt_idsig_t))) == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+		isp->dis_varargs = -1;
+		isp->dis_optargs = -1;
+		isp->dis_argc = i;
+		isp->dis_args = NULL;
+		isp->dis_auxinfo = 0;
+
+		if (i != 0 && (isp->dis_args = calloc(i,
+		    sizeof (dt_node_t))) == NULL) {
+			idp->di_data = NULL;
+			free(isp);
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+		}
+
+		if (dt_type_lookup(s, &dtt) == -1) {
+			xyerror(D_UNKNOWN, "failed to resolve type of %s (%s):"
+			    " %s\n", idp->di_name, s,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		}
+
+		if (idp->di_kind == DT_IDENT_AGGFUNC) {
+			idp->di_ctfp = DT_DYN_CTFP(dtp);
+			idp->di_type = DT_DYN_TYPE(dtp);
+		} else {
+			idp->di_ctfp = dtt.dtt_ctfp;
+			idp->di_type = dtt.dtt_type;
+		}
+
+		/*
+		 * For each comma-delimited parameter in the prototype string,
+		 * we look up the corresponding type and store its CTF data in
+		 * the corresponding location in dis_args[].  We also recognize
+		 * the special type string "@" to indicate that the specified
+		 * parameter may be a D expression of *any* type (represented
+		 * as a dis_args[] element with ctfp = NULL, type == CTF_ERR).
+		 * If a varargs "..." is present, we record the argument index
+		 * in dis_varargs for the benefit of dt_idcook_sign(), above.
+		 * If the type of an argument is enclosed in square brackets
+		 * (e.g. "[int]"), the argument is considered optional:  the
+		 * argument may be absent, but if it is present, it must be of
+		 * the specified type.  Note that varargs may not optional,
+		 * optional arguments may not follow varargs, and non-optional
+		 * arguments may not follow optional arguments.
+		 */
+		for (i = 0; i < isp->dis_argc; i++, p1 = p2) {
+			while (isspace(*p1))
+				p1++; /* skip leading whitespace */
+
+			if ((p2 = strchr(p1, ',')) == NULL)
+				p2 = p1 + strlen(p1);
+			else
+				*p2++ = '\0';
+
+			if (strcmp(p1, "@") == 0 || strcmp(p1, "...") == 0) {
+				isp->dis_args[i].dn_ctfp = NULL;
+				isp->dis_args[i].dn_type = CTF_ERR;
+				if (*p1 == '.')
+					isp->dis_varargs = i;
+				continue;
+			}
+
+			if (*p1 == '[' && p1[strlen(p1) - 1] == ']') {
+				if (isp->dis_varargs != -1) {
+					xyerror(D_UNKNOWN, "optional arg#%d "
+					    "may not follow variable arg#%d\n",
+					    i + 1, isp->dis_varargs + 1);
+				}
+
+				if (isp->dis_optargs == -1)
+					isp->dis_optargs = i;
+
+				p1[strlen(p1) - 1] = '\0';
+				p1++;
+			} else if (isp->dis_optargs != -1) {
+				xyerror(D_UNKNOWN, "required arg#%d may not "
+				    "follow optional arg#%d\n", i + 1,
+				    isp->dis_optargs + 1);
+			}
+
+			if (dt_type_lookup(p1, &dtt) == -1) {
+				xyerror(D_UNKNOWN, "failed to resolve type of "
+				    "%s arg#%d (%s): %s\n", idp->di_name, i + 1,
+				    p1, dtrace_errmsg(dtp, dtrace_errno(dtp)));
+			}
+
+			dt_node_type_assign(&isp->dis_args[i],
+			    dtt.dtt_ctfp, dtt.dtt_type);
+		}
+	}
+
+	dt_idcook_sign(dnp, idp, argc, args, "", "( )");
+}
+
+/*
+ * Cook a reference to the dynamically typed args[] array.  We verify that the
+ * reference is using a single integer constant, and then construct a new ident
+ * representing the appropriate type or translation specifically for this node.
+ */
+static void
+dt_idcook_args(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *ap)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_probe_t *prp = yypcb->pcb_probe;
+
+	dt_node_t tag, *nnp, *xnp;
+	dt_xlator_t *dxp;
+	dt_ident_t *xidp;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	if (argc != 1) {
+		xyerror(D_PROTO_LEN, "%s[ ] prototype mismatch: %d arg%s"
+		    "passed, 1 expected\n", idp->di_name, argc,
+		    argc == 1 ? " " : "s ");
+	}
+
+	if (ap->dn_kind != DT_NODE_INT) {
+		xyerror(D_PROTO_ARG, "%s[ ] argument #1 is incompatible with "
+		    "prototype:\n\tprototype: %s\n\t argument: %s\n",
+		    idp->di_name, "integer constant",
+		    dt_type_name(ap->dn_ctfp, ap->dn_type, n1, sizeof (n1)));
+	}
+
+	if (yypcb->pcb_pdesc == NULL) {
+		xyerror(D_ARGS_NONE, "%s[ ] may not be referenced outside "
+		    "of a probe clause\n", idp->di_name);
+	}
+
+	if (prp == NULL) {
+		xyerror(D_ARGS_MULTI,
+		    "%s[ ] may not be referenced because probe description %s "
+		    "matches an unstable set of probes\n", idp->di_name,
+		    dtrace_desc2str(yypcb->pcb_pdesc, n1, sizeof (n1)));
+	}
+
+	if (ap->dn_value >= prp->pr_argc) {
+		xyerror(D_ARGS_IDX, "index %lld is out of range for %s %s[ ]\n",
+		    (longlong_t)ap->dn_value, dtrace_desc2str(yypcb->pcb_pdesc,
+		    n1, sizeof (n1)), idp->di_name);
+	}
+
+	/*
+	 * Look up the native and translated argument types for the probe.
+	 * If no translation is needed, these will be the same underlying node.
+	 * If translation is needed, look up the appropriate translator.  Once
+	 * we have the appropriate node, create a new dt_ident_t for this node,
+	 * assign it the appropriate attributes, and set the type of 'dnp'.
+	 */
+	xnp = prp->pr_xargv[ap->dn_value];
+	nnp = prp->pr_nargv[prp->pr_mapping[ap->dn_value]];
+
+	if (xnp->dn_type == CTF_ERR) {
+		xyerror(D_ARGS_TYPE, "failed to resolve translated type for "
+		    "%s[%lld]\n", idp->di_name, (longlong_t)ap->dn_value);
+	}
+
+	if (nnp->dn_type == CTF_ERR) {
+		xyerror(D_ARGS_TYPE, "failed to resolve native type for "
+		    "%s[%lld]\n", idp->di_name, (longlong_t)ap->dn_value);
+	}
+
+	if (dtp->dt_xlatemode == DT_XL_STATIC && (
+	    nnp == xnp || dt_node_is_argcompat(nnp, xnp))) {
+		dnp->dn_ident = dt_ident_create(idp->di_name, idp->di_kind,
+		    idp->di_flags | DT_IDFLG_ORPHAN, idp->di_id, idp->di_attr,
+		    idp->di_vers, idp->di_ops, idp->di_iarg, idp->di_gen);
+
+		if (dnp->dn_ident == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+		dt_node_type_assign(dnp,
+		    prp->pr_argv[ap->dn_value].dtt_ctfp,
+		    prp->pr_argv[ap->dn_value].dtt_type);
+
+	} else if ((dxp = dt_xlator_lookup(dtp,
+	    nnp, xnp, DT_XLATE_FUZZY)) != NULL || (
+	    dxp = dt_xlator_lookup(dtp, dt_probe_tag(prp, ap->dn_value, &tag),
+	    xnp, DT_XLATE_EXACT | DT_XLATE_EXTERN)) != NULL) {
+
+		xidp = dt_xlator_ident(dxp, xnp->dn_ctfp, xnp->dn_type);
+
+		dnp->dn_ident = dt_ident_create(idp->di_name, xidp->di_kind,
+		    xidp->di_flags | DT_IDFLG_ORPHAN, idp->di_id, idp->di_attr,
+		    idp->di_vers, idp->di_ops, idp->di_iarg, idp->di_gen);
+
+		if (dnp->dn_ident == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+		if (dt_xlator_dynamic(dxp))
+			dxp->dx_arg = (int)ap->dn_value;
+
+		/*
+		 * Propagate relevant members from the translator's internal
+		 * dt_ident_t.  This code must be kept in sync with the state
+		 * that is initialized for idents in dt_xlator_create().
+		 */
+		dnp->dn_ident->di_data = xidp->di_data;
+		dnp->dn_ident->di_ctfp = xidp->di_ctfp;
+		dnp->dn_ident->di_type = xidp->di_type;
+
+		dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
+
+	} else {
+		xyerror(D_ARGS_XLATOR, "translator for %s[%lld] from %s to %s "
+		    "is not defined\n", idp->di_name, (longlong_t)ap->dn_value,
+		    dt_node_type_name(nnp, n1, sizeof (n1)),
+		    dt_node_type_name(xnp, n2, sizeof (n2)));
+	}
+
+	assert(dnp->dn_ident->di_flags & DT_IDFLG_ORPHAN);
+	assert(dnp->dn_ident->di_id == idp->di_id);
+}
+
+static void
+dt_idcook_regs(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *ap)
+{
+	dtrace_typeinfo_t dtt;
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	char n[DT_TYPE_NAMELEN];
+
+	if (argc != 1) {
+		xyerror(D_PROTO_LEN, "%s[ ] prototype mismatch: %d arg%s"
+		    "passed, 1 expected\n", idp->di_name,
+		    argc, argc == 1 ? " " : "s ");
+	}
+
+	if (ap->dn_kind != DT_NODE_INT) {
+		xyerror(D_PROTO_ARG, "%s[ ] argument #1 is incompatible with "
+		    "prototype:\n\tprototype: %s\n\t argument: %s\n",
+		    idp->di_name, "integer constant",
+		    dt_type_name(ap->dn_ctfp, ap->dn_type, n, sizeof (n)));
+	}
+
+	if ((ap->dn_flags & DT_NF_SIGNED) && (int64_t)ap->dn_value < 0) {
+		xyerror(D_REGS_IDX, "index %lld is out of range for array %s\n",
+		    (longlong_t)ap->dn_value, idp->di_name);
+	}
+
+	if (dt_type_lookup("uint64_t", &dtt) == -1) {
+		xyerror(D_UNKNOWN, "failed to resolve type of %s: %s\n",
+		    idp->di_name, dtrace_errmsg(dtp, dtrace_errno(dtp)));
+	}
+
+	idp->di_ctfp = dtt.dtt_ctfp;
+	idp->di_type = dtt.dtt_type;
+
+	dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
+}
+
+/*ARGSUSED*/
+static void
+dt_idcook_type(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
+{
+	if (idp->di_type == CTF_ERR) {
+		dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+		dtrace_typeinfo_t dtt;
+
+		if (dt_type_lookup(idp->di_iarg, &dtt) == -1) {
+			xyerror(D_UNKNOWN,
+			    "failed to resolve type %s for identifier %s: %s\n",
+			    (const char *)idp->di_iarg, idp->di_name,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		}
+
+		idp->di_ctfp = dtt.dtt_ctfp;
+		idp->di_type = dtt.dtt_type;
+	}
+
+	dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
+}
+
+/*ARGSUSED*/
+static void
+dt_idcook_thaw(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
+{
+	if (idp->di_ctfp != NULL && idp->di_type != CTF_ERR)
+		dt_node_type_assign(dnp, idp->di_ctfp, idp->di_type);
+}
+
+static void
+dt_idcook_inline(dt_node_t *dnp, dt_ident_t *idp, int argc, dt_node_t *args)
+{
+	if (idp->di_kind == DT_IDENT_ARRAY)
+		dt_idcook_assc(dnp, idp, argc, args);
+	else
+		dt_idcook_thaw(dnp, idp, argc, args);
+}
+
+static void
+dt_iddtor_sign(dt_ident_t *idp)
+{
+	if (idp->di_data != NULL)
+		free(((dt_idsig_t *)idp->di_data)->dis_args);
+	free(idp->di_data);
+}
+
+static void
+dt_iddtor_free(dt_ident_t *idp)
+{
+	free(idp->di_data);
+}
+
+static void
+dt_iddtor_inline(dt_ident_t *idp)
+{
+	dt_idnode_t *inp = idp->di_iarg;
+
+	if (inp != NULL) {
+		dt_node_link_free(&inp->din_list);
+
+		if (inp->din_hash != NULL)
+			dt_idhash_destroy(inp->din_hash);
+
+		free(inp->din_argv);
+		free(inp);
+	}
+
+	if (idp->di_kind == DT_IDENT_ARRAY)
+		dt_iddtor_sign(idp);
+	else
+		dt_iddtor_free(idp);
+}
+
+/*ARGSUSED*/
+static void
+dt_iddtor_none(dt_ident_t *idp)
+{
+	/* do nothing */
+}
+
+static void
+dt_iddtor_probe(dt_ident_t *idp)
+{
+	if (idp->di_data != NULL)
+		dt_probe_destroy(idp->di_data);
+}
+
+static size_t
+dt_idsize_type(dt_ident_t *idp)
+{
+	return (ctf_type_size(idp->di_ctfp, idp->di_type));
+}
+
+/*ARGSUSED*/
+static size_t
+dt_idsize_none(dt_ident_t *idp)
+{
+	return (0);
+}
+
+const dt_idops_t dt_idops_assc = {
+	dt_idcook_assc,
+	dt_iddtor_sign,
+	dt_idsize_none,
+};
+
+const dt_idops_t dt_idops_func = {
+	dt_idcook_func,
+	dt_iddtor_sign,
+	dt_idsize_none,
+};
+
+const dt_idops_t dt_idops_args = {
+	dt_idcook_args,
+	dt_iddtor_none,
+	dt_idsize_none,
+};
+
+const dt_idops_t dt_idops_regs = {
+	dt_idcook_regs,
+	dt_iddtor_free,
+	dt_idsize_none,
+};
+
+const dt_idops_t dt_idops_type = {
+	dt_idcook_type,
+	dt_iddtor_free,
+	dt_idsize_type,
+};
+
+const dt_idops_t dt_idops_thaw = {
+	dt_idcook_thaw,
+	dt_iddtor_free,
+	dt_idsize_type,
+};
+
+const dt_idops_t dt_idops_inline = {
+	dt_idcook_inline,
+	dt_iddtor_inline,
+	dt_idsize_type,
+};
+
+const dt_idops_t dt_idops_probe = {
+	dt_idcook_thaw,
+	dt_iddtor_probe,
+	dt_idsize_none,
+};
+
+static void
+dt_idhash_populate(dt_idhash_t *dhp)
+{
+	const dt_ident_t *idp = dhp->dh_tmpl;
+
+	dhp->dh_tmpl = NULL; /* clear dh_tmpl first to avoid recursion */
+	dt_dprintf("populating %s idhash from %p\n", dhp->dh_name, (void *)idp);
+
+	for (; idp->di_name != NULL; idp++) {
+		if (dt_idhash_insert(dhp, idp->di_name,
+		    idp->di_kind, idp->di_flags, idp->di_id, idp->di_attr,
+		    idp->di_vers, idp->di_ops ? idp->di_ops : &dt_idops_thaw,
+		    idp->di_iarg, 0) == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+}
+
+dt_idhash_t *
+dt_idhash_create(const char *name, const dt_ident_t *tmpl,
+    uint_t min, uint_t max)
+{
+	dt_idhash_t *dhp;
+	size_t size;
+
+	assert(min <= max);
+
+	size = sizeof (dt_idhash_t) +
+	    sizeof (dt_ident_t *) * (_dtrace_strbuckets - 1);
+
+	if ((dhp = malloc(size)) == NULL)
+		return (NULL);
+
+	bzero(dhp, size);
+	dhp->dh_name = name;
+	dhp->dh_tmpl = tmpl;
+	dhp->dh_nextid = min;
+	dhp->dh_minid = min;
+	dhp->dh_maxid = max;
+	dhp->dh_hashsz = _dtrace_strbuckets;
+
+	return (dhp);
+}
+
+/*
+ * Destroy an entire identifier hash.  This must be done using two passes with
+ * an inlined version of dt_ident_destroy() to avoid referencing freed memory.
+ * In the first pass di_dtor() is called for all identifiers; then the second
+ * pass frees the actual dt_ident_t's.  These must be done separately because
+ * a di_dtor() may operate on data structures which contain references to other
+ * identifiers inside of this hash itself (e.g. a global inline definition
+ * which contains a parse tree that refers to another global variable).
+ */
+void
+dt_idhash_destroy(dt_idhash_t *dhp)
+{
+	dt_ident_t *idp, *next;
+	ulong_t i;
+
+	for (i = 0; i < dhp->dh_hashsz; i++) {
+		for (idp = dhp->dh_hash[i]; idp != NULL; idp = next) {
+			next = idp->di_next;
+			idp->di_ops->di_dtor(idp);
+		}
+	}
+
+	for (i = 0; i < dhp->dh_hashsz; i++) {
+		for (idp = dhp->dh_hash[i]; idp != NULL; idp = next) {
+			next = idp->di_next;
+			free(idp->di_name);
+			free(idp);
+		}
+	}
+
+	free(dhp);
+}
+
+void
+dt_idhash_update(dt_idhash_t *dhp)
+{
+	uint_t nextid = dhp->dh_minid;
+	dt_ident_t *idp;
+	ulong_t i;
+
+	for (i = 0; i < dhp->dh_hashsz; i++) {
+		for (idp = dhp->dh_hash[i]; idp != NULL; idp = idp->di_next) {
+			/*
+			 * Right now we're hard coding which types need to be
+			 * reset, but ideally this would be done dynamically.
+			 */
+			if (idp->di_kind == DT_IDENT_ARRAY ||
+			    idp->di_kind == DT_IDENT_SCALAR ||
+			    idp->di_kind == DT_IDENT_AGG)
+				nextid = MAX(nextid, idp->di_id + 1);
+		}
+	}
+
+	dhp->dh_nextid = nextid;
+}
+
+dt_ident_t *
+dt_idhash_lookup(dt_idhash_t *dhp, const char *name)
+{
+	size_t len;
+	ulong_t h = dt_strtab_hash(name, &len) % dhp->dh_hashsz;
+	dt_ident_t *idp;
+
+	if (dhp->dh_tmpl != NULL)
+		dt_idhash_populate(dhp); /* fill hash w/ initial population */
+
+	for (idp = dhp->dh_hash[h]; idp != NULL; idp = idp->di_next) {
+		if (strcmp(idp->di_name, name) == 0)
+			return (idp);
+	}
+
+	return (NULL);
+}
+
+int
+dt_idhash_nextid(dt_idhash_t *dhp, uint_t *p)
+{
+	if (dhp->dh_nextid >= dhp->dh_maxid)
+		return (-1); /* no more id's are free to allocate */
+
+	*p = dhp->dh_nextid++;
+	return (0);
+}
+
+ulong_t
+dt_idhash_size(const dt_idhash_t *dhp)
+{
+	return (dhp->dh_nelems);
+}
+
+const char *
+dt_idhash_name(const dt_idhash_t *dhp)
+{
+	return (dhp->dh_name);
+}
+
+dt_ident_t *
+dt_idhash_insert(dt_idhash_t *dhp, const char *name, ushort_t kind,
+    ushort_t flags, uint_t id, dtrace_attribute_t attr, uint_t vers,
+    const dt_idops_t *ops, void *iarg, ulong_t gen)
+{
+	dt_ident_t *idp;
+	ulong_t h;
+
+	if (dhp->dh_tmpl != NULL)
+		dt_idhash_populate(dhp); /* fill hash w/ initial population */
+
+	idp = dt_ident_create(name, kind, flags, id,
+	    attr, vers, ops, iarg, gen);
+
+	if (idp == NULL)
+		return (NULL);
+
+	h = dt_strtab_hash(name, NULL) % dhp->dh_hashsz;
+	idp->di_next = dhp->dh_hash[h];
+
+	dhp->dh_hash[h] = idp;
+	dhp->dh_nelems++;
+
+	if (dhp->dh_defer != NULL)
+		dhp->dh_defer(dhp, idp);
+
+	return (idp);
+}
+
+void
+dt_idhash_xinsert(dt_idhash_t *dhp, dt_ident_t *idp)
+{
+	ulong_t h;
+
+	if (dhp->dh_tmpl != NULL)
+		dt_idhash_populate(dhp); /* fill hash w/ initial population */
+
+	h = dt_strtab_hash(idp->di_name, NULL) % dhp->dh_hashsz;
+	idp->di_next = dhp->dh_hash[h];
+	idp->di_flags &= ~DT_IDFLG_ORPHAN;
+
+	dhp->dh_hash[h] = idp;
+	dhp->dh_nelems++;
+
+	if (dhp->dh_defer != NULL)
+		dhp->dh_defer(dhp, idp);
+}
+
+void
+dt_idhash_delete(dt_idhash_t *dhp, dt_ident_t *key)
+{
+	size_t len;
+	ulong_t h = dt_strtab_hash(key->di_name, &len) % dhp->dh_hashsz;
+	dt_ident_t **pp = &dhp->dh_hash[h];
+	dt_ident_t *idp;
+
+	for (idp = dhp->dh_hash[h]; idp != NULL; idp = idp->di_next) {
+		if (idp == key)
+			break;
+		else
+			pp = &idp->di_next;
+	}
+
+	assert(idp == key);
+	*pp = idp->di_next;
+
+	assert(dhp->dh_nelems != 0);
+	dhp->dh_nelems--;
+
+	if (!(idp->di_flags & DT_IDFLG_ORPHAN))
+		dt_ident_destroy(idp);
+}
+
+static int
+dt_idhash_comp(const void *lp, const void *rp)
+{
+	const dt_ident_t *lhs = *((const dt_ident_t **)lp);
+	const dt_ident_t *rhs = *((const dt_ident_t **)rp);
+
+	if (lhs->di_id != rhs->di_id)
+		return ((int)(lhs->di_id - rhs->di_id));
+	else
+		return (strcmp(lhs->di_name, rhs->di_name));
+}
+
+int
+dt_idhash_iter(dt_idhash_t *dhp, dt_idhash_f *func, void *data)
+{
+	dt_ident_t **ids;
+	dt_ident_t *idp;
+	ulong_t i, j, n;
+	int rv;
+
+	if (dhp->dh_tmpl != NULL)
+		dt_idhash_populate(dhp); /* fill hash w/ initial population */
+
+	n = dhp->dh_nelems;
+	ids = alloca(sizeof (dt_ident_t *) * n);
+
+	for (i = 0, j = 0; i < dhp->dh_hashsz; i++) {
+		for (idp = dhp->dh_hash[i]; idp != NULL; idp = idp->di_next)
+			ids[j++] = idp;
+	}
+
+	qsort(ids, dhp->dh_nelems, sizeof (dt_ident_t *), dt_idhash_comp);
+
+	for (i = 0; i < n; i++) {
+		if ((rv = func(dhp, ids[i], data)) != 0)
+			return (rv);
+	}
+
+	return (0);
+}
+
+dt_ident_t *
+dt_idstack_lookup(dt_idstack_t *sp, const char *name)
+{
+	dt_idhash_t *dhp;
+	dt_ident_t *idp;
+
+	for (dhp = dt_list_prev(&sp->dids_list);
+	    dhp != NULL; dhp = dt_list_prev(dhp)) {
+		if ((idp = dt_idhash_lookup(dhp, name)) != NULL)
+			return (idp);
+	}
+
+	return (NULL);
+}
+
+void
+dt_idstack_push(dt_idstack_t *sp, dt_idhash_t *dhp)
+{
+	dt_list_append(&sp->dids_list, dhp);
+}
+
+void
+dt_idstack_pop(dt_idstack_t *sp, dt_idhash_t *dhp)
+{
+	assert(dt_list_prev(&sp->dids_list) == dhp);
+	dt_list_delete(&sp->dids_list, dhp);
+}
+
+dt_ident_t *
+dt_ident_create(const char *name, ushort_t kind, ushort_t flags, uint_t id,
+    dtrace_attribute_t attr, uint_t vers,
+    const dt_idops_t *ops, void *iarg, ulong_t gen)
+{
+	dt_ident_t *idp;
+	char *s = NULL;
+
+	if ((name != NULL && (s = strdup(name)) == NULL) ||
+	    (idp = malloc(sizeof (dt_ident_t))) == NULL) {
+		free(s);
+		return (NULL);
+	}
+
+	idp->di_name = s;
+	idp->di_kind = kind;
+	idp->di_flags = flags;
+	idp->di_id = id;
+	idp->di_attr = attr;
+	idp->di_vers = vers;
+	idp->di_ops = ops;
+	idp->di_iarg = iarg;
+	idp->di_data = NULL;
+	idp->di_ctfp = NULL;
+	idp->di_type = CTF_ERR;
+	idp->di_next = NULL;
+	idp->di_gen = gen;
+	idp->di_lineno = yylineno;
+
+	return (idp);
+}
+
+/*
+ * Destroy an individual identifier.  This code must be kept in sync with the
+ * dt_idhash_destroy() function below, which separates out the call to di_dtor.
+ */
+void
+dt_ident_destroy(dt_ident_t *idp)
+{
+	idp->di_ops->di_dtor(idp);
+	free(idp->di_name);
+	free(idp);
+}
+
+void
+dt_ident_morph(dt_ident_t *idp, ushort_t kind,
+    const dt_idops_t *ops, void *iarg)
+{
+	idp->di_ops->di_dtor(idp);
+	idp->di_kind = kind;
+	idp->di_ops = ops;
+	idp->di_iarg = iarg;
+	idp->di_data = NULL;
+}
+
+dtrace_attribute_t
+dt_ident_cook(dt_node_t *dnp, dt_ident_t *idp, dt_node_t **pargp)
+{
+	dtrace_attribute_t attr;
+	dt_node_t *args, *argp;
+	int argc = 0;
+
+	attr = dt_node_list_cook(pargp, DT_IDFLG_REF);
+	args = pargp ? *pargp : NULL;
+
+	for (argp = args; argp != NULL; argp = argp->dn_list)
+		argc++;
+
+	idp->di_ops->di_cook(dnp, idp, argc, args);
+
+	if (idp->di_flags & DT_IDFLG_USER)
+		dnp->dn_flags |= DT_NF_USERLAND;
+
+	return (dt_attr_min(attr, idp->di_attr));
+}
+
+void
+dt_ident_type_assign(dt_ident_t *idp, ctf_file_t *fp, ctf_id_t type)
+{
+	idp->di_ctfp = fp;
+	idp->di_type = type;
+}
+
+dt_ident_t *
+dt_ident_resolve(dt_ident_t *idp)
+{
+	while (idp->di_flags & DT_IDFLG_INLINE) {
+		const dt_node_t *dnp = ((dt_idnode_t *)idp->di_iarg)->din_root;
+
+		if (dnp == NULL)
+			break; /* can't resolve any further yet */
+
+		switch (dnp->dn_kind) {
+		case DT_NODE_VAR:
+		case DT_NODE_SYM:
+		case DT_NODE_FUNC:
+		case DT_NODE_AGG:
+		case DT_NODE_INLINE:
+		case DT_NODE_PROBE:
+			idp = dnp->dn_ident;
+			continue;
+		}
+
+		if (dt_node_is_dynamic(dnp))
+			idp = dnp->dn_ident;
+		else
+			break;
+	}
+
+	return (idp);
+}
+
+size_t
+dt_ident_size(dt_ident_t *idp)
+{
+	idp = dt_ident_resolve(idp);
+	return (idp->di_ops->di_size(idp));
+}
+
+int
+dt_ident_unref(const dt_ident_t *idp)
+{
+	return (idp->di_gen == yypcb->pcb_hdl->dt_gen &&
+	    (idp->di_flags & (DT_IDFLG_REF|DT_IDFLG_MOD|DT_IDFLG_DECL)) == 0);
+}
+
+const char *
+dt_idkind_name(uint_t kind)
+{
+	switch (kind) {
+	case DT_IDENT_ARRAY:	return ("associative array");
+	case DT_IDENT_SCALAR:	return ("scalar");
+	case DT_IDENT_PTR:	return ("pointer");
+	case DT_IDENT_FUNC:	return ("function");
+	case DT_IDENT_AGG:	return ("aggregation");
+	case DT_IDENT_AGGFUNC:	return ("aggregating function");
+	case DT_IDENT_ACTFUNC:	return ("tracing function");
+	case DT_IDENT_XLSOU:	return ("translated data");
+	case DT_IDENT_XLPTR:	return ("pointer to translated data");
+	case DT_IDENT_SYMBOL:	return ("external symbol reference");
+	case DT_IDENT_ENUM:	return ("enumerator");
+	case DT_IDENT_PRAGAT:	return ("#pragma attributes");
+	case DT_IDENT_PRAGBN:	return ("#pragma binding");
+	case DT_IDENT_PROBE:	return ("probe definition");
+	default:		return ("<?>");
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_ident.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_ident.h
new file mode 100644
index 0000000..367ed5e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_ident.h
@@ -0,0 +1,185 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_IDENT_H
+#define	_DT_IDENT_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <libctf.h>
+#include <dtrace.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#include <dt_list.h>
+
+struct dt_node;
+struct dt_ident;
+struct dt_idhash;
+struct dt_irlist;
+struct dt_regset;
+
+typedef struct dt_idsig {
+	int dis_varargs;	/* argument index of start of varargs (or -1) */
+	int dis_optargs;	/* argument index of start of optargs (or -1) */
+	int dis_argc;		/* number of types in this signature */
+	struct dt_node *dis_args; /* array of nodes representing formal types */
+	uint64_t dis_auxinfo;	/* auxiliary signature information, if any */
+} dt_idsig_t;
+
+typedef struct dt_idnode {
+	struct dt_node *din_list; /* allocation list for parse tree nodes */
+	struct dt_node *din_root; /* root of this identifier's parse tree */
+	struct dt_idhash *din_hash; /* identifiers private to this subtree */
+	struct dt_ident **din_argv; /* identifiers in din_hash for arguments */
+	int din_argc;		  /* length of din_argv[] array */
+} dt_idnode_t;
+
+typedef struct dt_idops {
+	void (*di_cook)(struct dt_node *, struct dt_ident *,
+	    int, struct dt_node *);
+	void (*di_dtor)(struct dt_ident *);
+	size_t (*di_size)(struct dt_ident *);
+} dt_idops_t;
+
+typedef struct dt_ident {
+	char *di_name;		/* identifier name */
+	ushort_t di_kind;	/* identifier kind (see below) */
+	ushort_t di_flags;	/* identifier flags (see below) */
+	uint_t di_id;		/* variable or subr id (see <sys/dtrace.h>) */
+	dtrace_attribute_t di_attr; /* identifier stability attributes */
+	uint_t di_vers;		/* identifier version number (dt_version_t) */
+	const dt_idops_t *di_ops; /* identifier's class-specific ops vector */
+	void *di_iarg;		/* initial argument pointer for ops vector */
+	void *di_data;		/* private data pointer for ops vector */
+	ctf_file_t *di_ctfp;	/* CTF container for the variable data type */
+	ctf_id_t di_type;	/* CTF identifier for the variable data type */
+	struct dt_ident *di_next; /* pointer to next ident in hash chain */
+	ulong_t di_gen;		/* generation number (pass that created me) */
+	int di_lineno;		/* line number that defined this identifier */
+} dt_ident_t;
+
+#define	DT_IDENT_ARRAY	0	/* identifier is an array variable */
+#define	DT_IDENT_SCALAR	1	/* identifier is a scalar variable */
+#define	DT_IDENT_PTR	2	/* identifier is a magic pointer */
+#define	DT_IDENT_FUNC	3	/* identifier is a built-in function */
+#define	DT_IDENT_AGG	4	/* identifier is an aggregation */
+#define	DT_IDENT_AGGFUNC 5	/* identifier is an aggregating function */
+#define	DT_IDENT_ACTFUNC 6	/* identifier is an action function */
+#define	DT_IDENT_XLSOU	7	/* identifier is a translated struct or union */
+#define	DT_IDENT_XLPTR	8	/* identifier is a translated pointer */
+#define	DT_IDENT_SYMBOL	9	/* identifier is an external symbol */
+#define	DT_IDENT_ENUM	10	/* identifier is an enumerator */
+#define	DT_IDENT_PRAGAT	11	/* identifier is #pragma attributes */
+#define	DT_IDENT_PRAGBN	12	/* identifier is #pragma binding */
+#define	DT_IDENT_PROBE	13	/* identifier is a probe definition */
+
+#define	DT_IDFLG_TLS	0x0001	/* variable is thread-local storage */
+#define	DT_IDFLG_LOCAL	0x0002	/* variable is local storage */
+#define	DT_IDFLG_WRITE	0x0004	/* variable is writable (can be modified) */
+#define	DT_IDFLG_INLINE	0x0008	/* variable is an inline definition */
+#define	DT_IDFLG_REF	0x0010	/* variable is referenced by this program */
+#define	DT_IDFLG_MOD	0x0020	/* variable is modified by this program */
+#define	DT_IDFLG_DIFR	0x0040	/* variable is referenced by current DIFO */
+#define	DT_IDFLG_DIFW	0x0080	/* variable is modified by current DIFO */
+#define	DT_IDFLG_CGREG	0x0100	/* variable is inlined by code generator */
+#define	DT_IDFLG_USER	0x0200	/* variable is associated with userland */
+#define	DT_IDFLG_PRIM	0x0400	/* variable is associated with primary object */
+#define	DT_IDFLG_DECL	0x0800	/* variable is associated with explicit decl */
+#define	DT_IDFLG_ORPHAN	0x1000	/* variable is in a dt_node and not dt_idhash */
+
+typedef struct dt_idhash {
+	dt_list_t dh_list;	/* list prev/next pointers for dt_idstack */
+	const char *dh_name;	/* name of this hash table */
+	void (*dh_defer)(struct dt_idhash *, dt_ident_t *); /* defer callback */
+	const dt_ident_t *dh_tmpl; /* template for initial ident population */
+	uint_t dh_nextid;	/* next id to be returned by idhash_nextid() */
+	uint_t dh_minid;	/* min id to be returned by idhash_nextid() */
+	uint_t dh_maxid;	/* max id to be returned by idhash_nextid() */
+	ulong_t dh_nelems;	/* number of identifiers in hash table */
+	ulong_t dh_hashsz;	/* number of entries in dh_buckets array */
+	dt_ident_t *dh_hash[1];	/* array of hash table bucket pointers */
+} dt_idhash_t;
+
+typedef struct dt_idstack {
+	dt_list_t dids_list;	/* list meta-data for dt_idhash_t stack */
+} dt_idstack_t;
+
+extern const dt_idops_t dt_idops_assc;	/* associative array or aggregation */
+extern const dt_idops_t dt_idops_func;	/* function call built-in */
+extern const dt_idops_t dt_idops_args;	/* args[] built-in */
+extern const dt_idops_t dt_idops_regs;	/* regs[]/uregs[] built-in */
+extern const dt_idops_t dt_idops_type;	/* predefined type name string */
+extern const dt_idops_t dt_idops_thaw;	/* prefrozen type identifier */
+extern const dt_idops_t dt_idops_inline; /* inline variable */
+extern const dt_idops_t dt_idops_probe;	/* probe definition */
+
+extern dt_idhash_t *dt_idhash_create(const char *, const dt_ident_t *,
+    uint_t, uint_t);
+extern void dt_idhash_destroy(dt_idhash_t *);
+extern void dt_idhash_update(dt_idhash_t *);
+extern dt_ident_t *dt_idhash_lookup(dt_idhash_t *, const char *);
+extern int dt_idhash_nextid(dt_idhash_t *, uint_t *);
+extern ulong_t dt_idhash_size(const dt_idhash_t *);
+extern const char *dt_idhash_name(const dt_idhash_t *);
+
+extern dt_ident_t *dt_idhash_insert(dt_idhash_t *, const char *, ushort_t,
+    ushort_t, uint_t, dtrace_attribute_t, uint_t,
+    const dt_idops_t *, void *, ulong_t);
+
+extern void dt_idhash_xinsert(dt_idhash_t *, dt_ident_t *);
+extern void dt_idhash_delete(dt_idhash_t *, dt_ident_t *);
+
+typedef int dt_idhash_f(dt_idhash_t *, dt_ident_t *, void *);
+extern int dt_idhash_iter(dt_idhash_t *, dt_idhash_f *, void *);
+
+extern dt_ident_t *dt_idstack_lookup(dt_idstack_t *, const char *);
+extern void dt_idstack_push(dt_idstack_t *, dt_idhash_t *);
+extern void dt_idstack_pop(dt_idstack_t *, dt_idhash_t *);
+
+extern dt_ident_t *dt_ident_create(const char *, ushort_t, ushort_t, uint_t,
+    dtrace_attribute_t, uint_t, const dt_idops_t *, void *, ulong_t);
+extern void dt_ident_destroy(dt_ident_t *);
+extern void dt_ident_morph(dt_ident_t *, ushort_t, const dt_idops_t *, void *);
+extern dtrace_attribute_t dt_ident_cook(struct dt_node *,
+    dt_ident_t *, struct dt_node **);
+
+extern void dt_ident_type_assign(dt_ident_t *, ctf_file_t *, ctf_id_t);
+extern dt_ident_t *dt_ident_resolve(dt_ident_t *);
+extern size_t dt_ident_size(dt_ident_t *);
+extern int dt_ident_unref(const dt_ident_t *);
+
+extern const char *dt_idkind_name(uint_t);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_IDENT_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_impl.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_impl.h
new file mode 100644
index 0000000..0e40f72
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_impl.h
@@ -0,0 +1,669 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_IMPL_H
+#define	_DT_IMPL_H
+
+#ifndef VBOX
+#include <sys/param.h>
+#include <sys/objfs.h>
+#include <setjmp.h>
+#include <libctf.h>
+#include <dtrace.h>
+#include <gelf.h>
+#include <synch.h>
+#else  /* VBOX */
+# include <setjmp.h>
+# include <libctf.h>
+# include <dtrace.h>
+# include <errno.h>
+# include "VBoxDTraceLibCWrappers.h"
+#endif /* VBOX*/
+
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#include <dt_parser.h>
+#include <dt_regset.h>
+#include <dt_inttab.h>
+#include <dt_strtab.h>
+#include <dt_ident.h>
+#include <dt_list.h>
+#include <dt_decl.h>
+#include <dt_as.h>
+#include <dt_proc.h>
+#include <dt_dof.h>
+#include <dt_pcb.h>
+
+struct dt_module;		/* see below */
+struct dt_pfdict;		/* see <dt_printf.h> */
+struct dt_arg;			/* see below */
+struct dt_provider;		/* see <dt_provider.h> */
+struct dt_xlator;		/* see <dt_xlator.h> */
+
+typedef struct dt_intrinsic {
+	const char *din_name;	/* string name of the intrinsic type */
+	ctf_encoding_t din_data; /* integer or floating-point CTF encoding */
+	uint_t din_kind;	/* CTF type kind to instantiate */
+} dt_intrinsic_t;
+
+typedef struct dt_typedef {
+	const char *dty_src;	/* string name of typedef source type */
+	const char *dty_dst;	/* string name of typedef destination type */
+} dt_typedef_t;
+
+typedef struct dt_intdesc {
+	const char *did_name;	/* string name of the integer type */
+	ctf_file_t *did_ctfp;	/* CTF container for this type reference */
+	ctf_id_t did_type;	/* CTF type reference for this type */
+	uintmax_t did_limit;	/* maximum positive value held by type */
+} dt_intdesc_t;
+
+typedef struct dt_modops {
+	uint_t (*do_syminit)(struct dt_module *);
+	void (*do_symsort)(struct dt_module *);
+	GElf_Sym *(*do_symname)(struct dt_module *,
+	    const char *, GElf_Sym *, uint_t *);
+	GElf_Sym *(*do_symaddr)(struct dt_module *,
+	    GElf_Addr, GElf_Sym *, uint_t *);
+} dt_modops_t;
+
+typedef struct dt_arg {
+	int da_ndx;		/* index of this argument */
+	int da_mapping;		/* mapping of argument indices to arguments */
+	ctf_id_t da_type;	/* type of argument */
+	ctf_file_t *da_ctfp;	/* CTF container for type */
+	dt_ident_t *da_xlator;	/* translator, if any */
+	struct dt_arg *da_next;	/* next argument */
+} dt_arg_t;
+
+typedef struct dt_sym {
+	uint_t ds_symid;	/* id of corresponding symbol */
+	uint_t ds_next;		/* index of next element in hash chain */
+} dt_sym_t;
+
+typedef struct dt_module {
+	dt_list_t dm_list;	/* list forward/back pointers */
+	char dm_name[DTRACE_MODNAMELEN]; /* string name of module */
+	char dm_file[MAXPATHLEN]; /* file path of module (if any) */
+	struct dt_module *dm_next; /* pointer to next module in hash chain */
+	const dt_modops_t *dm_ops; /* pointer to data model's ops vector */
+#ifndef VBOX
+	Elf *dm_elf;		/* libelf handle for module object */
+	objfs_info_t dm_info;	/* object filesystem private info */
+#endif
+	ctf_sect_t dm_symtab;	/* symbol table for module */
+	ctf_sect_t dm_strtab;	/* string table for module */
+	ctf_sect_t dm_ctdata;	/* CTF data for module */
+	ctf_file_t *dm_ctfp;	/* CTF container handle */
+	uint_t *dm_symbuckets;	/* symbol table hash buckets (chain indices) */
+	dt_sym_t *dm_symchains;	/* symbol table hash chains buffer */
+	void *dm_asmap;		/* symbol pointers sorted by value */
+	uint_t dm_symfree;	/* index of next free hash element */
+	uint_t dm_nsymbuckets;	/* number of elements in bucket array */
+	uint_t dm_nsymelems;	/* number of elements in hash table */
+	uint_t dm_asrsv;	/* actual reserved size of dm_asmap */
+	uint_t dm_aslen;	/* number of entries in dm_asmap */
+	uint_t dm_flags;	/* module flags (see below) */
+	int dm_modid;		/* modinfo(1M) module identifier */
+	GElf_Addr dm_text_va;	/* virtual address of text section */
+	GElf_Xword dm_text_size; /* size in bytes of text section */
+	GElf_Addr dm_data_va;	/* virtual address of data section */
+	GElf_Xword dm_data_size; /* size in bytes of data section */
+	GElf_Addr dm_bss_va;	/* virtual address of BSS */
+	GElf_Xword dm_bss_size;	/* size in bytes of BSS */
+	dt_idhash_t *dm_extern;	/* external symbol definitions */
+} dt_module_t;
+
+#define	DT_DM_LOADED	0x1	/* module symbol and type data is loaded */
+#define	DT_DM_KERNEL	0x2	/* module is associated with a kernel object */
+#define	DT_DM_PRIMARY	0x4	/* module is a krtld primary kernel object */
+
+typedef struct dt_provmod {
+	char *dp_name;				/* name of provider module */
+	struct dt_provmod *dp_next;		/* next module */
+} dt_provmod_t;
+
+typedef struct dt_ahashent {
+	struct dt_ahashent *dtahe_prev;		/* prev on hash chain */
+	struct dt_ahashent *dtahe_next;		/* next on hash chain */
+	struct dt_ahashent *dtahe_prevall;	/* prev on list of all */
+	struct dt_ahashent *dtahe_nextall;	/* next on list of all */
+	uint64_t dtahe_hashval;			/* hash value */
+	size_t dtahe_size;			/* size of data */
+	dtrace_aggdata_t dtahe_data;		/* data */
+	void (*dtahe_aggregate)(int64_t *, int64_t *, size_t); /* function */
+} dt_ahashent_t;
+
+typedef struct dt_ahash {
+	dt_ahashent_t	**dtah_hash;		/* hash table */
+	dt_ahashent_t	*dtah_all;		/* list of all elements */
+	size_t		dtah_size;		/* size of hash table */
+} dt_ahash_t;
+
+typedef struct dt_aggregate {
+	dtrace_bufdesc_t dtat_buf; 	/* buf aggregation snapshot */
+	int dtat_flags;			/* aggregate flags */
+	processorid_t dtat_ncpus;	/* number of CPUs in aggregate */
+	processorid_t *dtat_cpus;	/* CPUs in aggregate */
+	processorid_t dtat_ncpu;	/* size of dtat_cpus array */
+	processorid_t dtat_maxcpu;	/* maximum number of CPUs */
+	dt_ahash_t dtat_hash;		/* aggregate hash table */
+} dt_aggregate_t;
+
+typedef struct dt_print_aggdata {
+	dtrace_hdl_t *dtpa_dtp;		/* pointer to libdtrace handle */
+	dtrace_aggvarid_t dtpa_id;	/* aggregation variable of interest */
+	FILE *dtpa_fp;			/* file pointer */
+	int dtpa_allunprint;		/* print only unprinted aggregations */
+} dt_print_aggdata_t;
+
+typedef struct dt_dirpath {
+	dt_list_t dir_list;		/* linked-list forward/back pointers */
+	char *dir_path;			/* directory pathname */
+} dt_dirpath_t;
+
+typedef struct dt_lib_depend {
+	dt_list_t dtld_deplist;		/* linked-list forward/back pointers */
+	char *dtld_library;		/* library name */
+	char *dtld_libpath;		/* library pathname */
+	uint_t dtld_finish;		/* completion time in tsort for lib */
+	uint_t dtld_start;		/* starting time in tsort for lib */
+	uint_t dtld_loaded;		/* boolean: is this library loaded */
+	dt_list_t dtld_dependencies;	/* linked-list of lib dependencies */
+	dt_list_t dtld_dependents;	/* linked-list of lib dependents */
+} dt_lib_depend_t;
+
+typedef uint32_t dt_version_t;		/* encoded version (see below) */
+
+struct dtrace_hdl {
+	const dtrace_vector_t *dt_vector; /* library vector, if vectored open */
+	void *dt_varg;	/* vector argument, if vectored open */
+	dtrace_conf_t dt_conf;	/* DTrace driver configuration profile */
+	char dt_errmsg[BUFSIZ];	/* buffer for formatted syntax error msgs */
+	const char *dt_errtag;	/* tag used with last call to dt_set_errmsg() */
+	dt_pcb_t *dt_pcb;	/* pointer to current parsing control block */
+	ulong_t dt_gen;		/* compiler generation number */
+	dt_list_t dt_programs;	/* linked list of dtrace_prog_t's */
+	dt_list_t dt_xlators;	/* linked list of dt_xlator_t's */
+	struct dt_xlator **dt_xlatormap; /* dt_xlator_t's indexed by dx_id */
+	id_t dt_xlatorid;	/* next dt_xlator_t id to assign */
+	dt_ident_t *dt_externs;	/* linked list of external symbol identifiers */
+	dt_idhash_t *dt_macros;	/* hash table of macro variable identifiers */
+	dt_idhash_t *dt_aggs;	/* hash table of aggregation identifiers */
+	dt_idhash_t *dt_globals; /* hash table of global identifiers */
+	dt_idhash_t *dt_tls;	/* hash table of thread-local identifiers */
+	dt_list_t dt_modlist;	/* linked list of dt_module_t's */
+	dt_module_t **dt_mods;	/* hash table of dt_module_t's */
+	uint_t dt_modbuckets;	/* number of module hash buckets */
+	uint_t dt_nmods;	/* number of modules in hash and list */
+	dt_provmod_t *dt_provmod; /* linked list of provider modules */
+	dt_module_t *dt_exec;	/* pointer to executable module */
+	dt_module_t *dt_rtld;	/* pointer to run-time linker module */
+	dt_module_t *dt_cdefs;	/* pointer to C dynamic type module */
+	dt_module_t *dt_ddefs;	/* pointer to D dynamic type module */
+	dt_list_t dt_provlist;	/* linked list of dt_provider_t's */
+	struct dt_provider **dt_provs; /* hash table of dt_provider_t's */
+	uint_t dt_provbuckets;	/* number of provider hash buckets */
+	uint_t dt_nprovs;	/* number of providers in hash and list */
+	dt_proc_hash_t *dt_procs; /* hash table of grabbed process handles */
+	dt_intdesc_t dt_ints[6]; /* cached integer type descriptions */
+	ctf_id_t dt_type_func;	/* cached CTF identifier for function type */
+	ctf_id_t dt_type_fptr;	/* cached CTF identifier for function pointer */
+	ctf_id_t dt_type_str;	/* cached CTF identifier for string type */
+	ctf_id_t dt_type_dyn;	/* cached CTF identifier for <DYN> type */
+	ctf_id_t dt_type_stack;	/* cached CTF identifier for stack type */
+	ctf_id_t dt_type_symaddr; /* cached CTF identifier for _symaddr type */
+	ctf_id_t dt_type_usymaddr; /* cached CTF ident. for _usymaddr type */
+	size_t dt_maxprobe;	/* max enabled probe ID */
+	dtrace_eprobedesc_t **dt_edesc; /* enabled probe descriptions */
+	dtrace_probedesc_t **dt_pdesc; /* probe descriptions for enabled prbs */
+	size_t dt_maxagg;	/* max aggregation ID */
+	dtrace_aggdesc_t **dt_aggdesc; /* aggregation descriptions */
+	int dt_maxformat;	/* max format ID */
+	void **dt_formats;	/* pointer to format array */
+	dt_aggregate_t dt_aggregate; /* aggregate */
+	dtrace_bufdesc_t dt_buf; /* staging buffer */
+	struct dt_pfdict *dt_pfdict; /* dictionary of printf conversions */
+	dt_version_t dt_vmax;	/* optional ceiling on program API binding */
+	dtrace_attribute_t dt_amin; /* optional floor on program attributes */
+	char *dt_cpp_path;	/* pathname of cpp(1) to invoke if needed */
+	char **dt_cpp_argv;	/* argument vector for exec'ing cpp(1) */
+	int dt_cpp_argc;	/* count of initialized cpp(1) arguments */
+	int dt_cpp_args;	/* size of dt_cpp_argv[] array */
+	char *dt_ld_path;	/* pathname of ld(1) to invoke if needed */
+	dt_list_t dt_lib_path;	/* linked-list forming library search path */
+	uint_t dt_lazyload;	/* boolean:  set via -xlazyload */
+	uint_t dt_droptags;	/* boolean:  set via -xdroptags */
+	uint_t dt_active;	/* boolean:  set once tracing is active */
+	uint_t dt_stopped;	/* boolean:  set once tracing is stopped */
+	processorid_t dt_beganon; /* CPU that executed BEGIN probe (if any) */
+	processorid_t dt_endedon; /* CPU that executed END probe (if any) */
+	uint_t dt_oflags;	/* dtrace open-time options (see dtrace.h) */
+	uint_t dt_cflags;	/* dtrace compile-time options (see dtrace.h) */
+	uint_t dt_dflags;	/* dtrace link-time options (see dtrace.h) */
+	uint_t dt_prcmode;	/* dtrace process create mode (see dt_proc.h) */
+	uint_t dt_linkmode;	/* dtrace symbol linking mode (see below) */
+	uint_t dt_linktype;	/* dtrace link output file type (see below) */
+	uint_t dt_xlatemode;	/* dtrace translator linking mode (see below) */
+	uint_t dt_stdcmode;	/* dtrace stdc compatibility mode (see below) */
+	uint_t dt_treedump;	/* dtrace tree debug bitmap (see below) */
+	uint64_t dt_options[DTRACEOPT_MAX]; /* dtrace run-time options */
+	int dt_version;		/* library version requested by client */
+	int dt_ctferr;		/* error resulting from last CTF failure */
+	int dt_errno;		/* error resulting from last failed operation */
+	int dt_fd;		/* file descriptor for dtrace pseudo-device */
+	int dt_ftfd;		/* file descriptor for fasttrap pseudo-device */
+	int dt_fterr;		/* saved errno from failed open of dt_ftfd */
+	int dt_cdefs_fd;	/* file descriptor for C CTF debugging cache */
+	int dt_ddefs_fd;	/* file descriptor for D CTF debugging cache */
+	int dt_stdout_fd;	/* file descriptor for saved stdout */
+	dtrace_handle_err_f *dt_errhdlr; /* error handler, if any */
+	void *dt_errarg;	/* error handler argument */
+	dtrace_prog_t *dt_errprog; /* error handler program, if any */
+	dtrace_handle_drop_f *dt_drophdlr; /* drop handler, if any */
+	void *dt_droparg;	/* drop handler argument */
+	dtrace_handle_proc_f *dt_prochdlr; /* proc handler, if any */
+	void *dt_procarg;	/* proc handler argument */
+	dtrace_handle_setopt_f *dt_setopthdlr; /* setopt handler, if any */
+	void *dt_setoptarg;	/* setopt handler argument */
+	dtrace_status_t dt_status[2]; /* status cache */
+	int dt_statusgen;	/* current status generation */
+	hrtime_t dt_laststatus;	/* last status */
+	hrtime_t dt_lastswitch;	/* last switch of buffer data */
+	hrtime_t dt_lastagg;	/* last snapshot of aggregation data */
+	char *dt_sprintf_buf;	/* buffer for dtrace_sprintf() */
+	int dt_sprintf_buflen;	/* length of dtrace_sprintf() buffer */
+	const char *dt_filetag;	/* default filetag for dt_set_errmsg() */
+	char *dt_buffered_buf;	/* buffer for buffered output */
+	size_t dt_buffered_offs; /* current offset into buffered buffer */
+	size_t dt_buffered_size; /* size of buffered buffer */
+	dtrace_handle_buffered_f *dt_bufhdlr; /* buffered handler, if any */
+	void *dt_bufarg;	/* buffered handler argument */
+	dt_dof_t dt_dof;	/* DOF generation buffers (see dt_dof.c) */
+#ifndef VBOX
+	struct utsname dt_uts;	/* uname(2) information for system */
+#endif
+	dt_list_t dt_lib_dep;	/* scratch linked-list of lib dependencies */
+	dt_list_t dt_lib_dep_sorted;	/* dependency sorted library list */
+};
+
+/*
+ * Values for the user arg of the ECB.
+ */
+#define	DT_ECB_DEFAULT		0
+#define	DT_ECB_ERROR		1
+
+/*
+ * Values for the dt_linkmode property, which is used by the assembler when
+ * processing external symbol references.  User can set using -xlink=<mode>.
+ */
+#define	DT_LINK_KERNEL	0	/* kernel syms static, user syms dynamic */
+#define	DT_LINK_PRIMARY	1	/* primary kernel syms static, others dynamic */
+#define	DT_LINK_DYNAMIC	2	/* all symbols dynamic */
+#define	DT_LINK_STATIC	3	/* all symbols static */
+
+/*
+ * Values for the dt_linktype property, which is used by dtrace_program_link()
+ * to determine the type of output file that is desired by the client.
+ */
+#define	DT_LTYP_ELF	0	/* produce ELF containing DOF */
+#define	DT_LTYP_DOF	1	/* produce stand-alone DOF */
+
+/*
+ * Values for the dt_xlatemode property, which is used to determine whether
+ * references to dynamic translators are permitted.  Set using -xlate=<mode>.
+ */
+#define	DT_XL_STATIC	0	/* require xlators to be statically defined */
+#define	DT_XL_DYNAMIC	1	/* produce references to dynamic translators */
+
+/*
+ * Values for the dt_stdcmode property, which is used by the compiler when
+ * running cpp to determine the presence and setting of the __STDC__ macro.
+ */
+#define	DT_STDC_XA	0	/* ISO C + K&R C compat w/o ISO: __STDC__=0 */
+#define	DT_STDC_XC	1	/* Strict ISO C: __STDC__=1 */
+#define	DT_STDC_XS	2	/* K&R C: __STDC__ not defined */
+#define	DT_STDC_XT	3	/* ISO C + K&R C compat with ISO: __STDC__=0 */
+
+/*
+ * Macro to test whether a given pass bit is set in the dt_treedump bit-vector.
+ * If the bit for pass 'p' is set, the D compiler displays the parse tree for
+ * the program by printing it to stderr at the end of compiler pass 'p'.
+ */
+#define	DT_TREEDUMP_PASS(dtp, p)	((dtp)->dt_treedump & (1 << ((p) - 1)))
+
+/*
+ * Macros for accessing the cached CTF container and type ID for the common
+ * types "int", "string", and <DYN>, which we need to use frequently in the D
+ * compiler.  The DT_INT_* macro relies upon "int" being at index 0 in the
+ * _dtrace_ints_* tables in dt_open.c; the others are also set up there.
+ */
+#define	DT_INT_CTFP(dtp)	((dtp)->dt_ints[0].did_ctfp)
+#define	DT_INT_TYPE(dtp)	((dtp)->dt_ints[0].did_type)
+
+#define	DT_FUNC_CTFP(dtp)	((dtp)->dt_ddefs->dm_ctfp)
+#define	DT_FUNC_TYPE(dtp)	((dtp)->dt_type_func)
+
+#define	DT_FPTR_CTFP(dtp)	((dtp)->dt_ddefs->dm_ctfp)
+#define	DT_FPTR_TYPE(dtp)	((dtp)->dt_type_fptr)
+
+#define	DT_STR_CTFP(dtp)	((dtp)->dt_ddefs->dm_ctfp)
+#define	DT_STR_TYPE(dtp)	((dtp)->dt_type_str)
+
+#define	DT_DYN_CTFP(dtp)	((dtp)->dt_ddefs->dm_ctfp)
+#define	DT_DYN_TYPE(dtp)	((dtp)->dt_type_dyn)
+
+#define	DT_STACK_CTFP(dtp)	((dtp)->dt_ddefs->dm_ctfp)
+#define	DT_STACK_TYPE(dtp)	((dtp)->dt_type_stack)
+
+#define	DT_SYMADDR_CTFP(dtp)	((dtp)->dt_ddefs->dm_ctfp)
+#define	DT_SYMADDR_TYPE(dtp)	((dtp)->dt_type_symaddr)
+
+#define	DT_USYMADDR_CTFP(dtp)	((dtp)->dt_ddefs->dm_ctfp)
+#define	DT_USYMADDR_TYPE(dtp)	((dtp)->dt_type_usymaddr)
+
+/*
+ * Actions and subroutines are both DT_NODE_FUNC nodes; to avoid confusing
+ * an action for a subroutine (or vice versa), we assure that the DT_ACT_*
+ * constants and the DIF_SUBR_* constants occupy non-overlapping ranges by
+ * starting the DT_ACT_* constants at DIF_SUBR_MAX + 1.
+ */
+#define	DT_ACT_BASE		DIF_SUBR_MAX + 1
+#define	DT_ACT(n)		(DT_ACT_BASE + (n))
+
+#define	DT_ACT_PRINTF		DT_ACT(0)	/* printf() action */
+#define	DT_ACT_TRACE		DT_ACT(1)	/* trace() action */
+#define	DT_ACT_TRACEMEM		DT_ACT(2)	/* tracemem() action */
+#define	DT_ACT_STACK		DT_ACT(3)	/* stack() action */
+#define	DT_ACT_STOP		DT_ACT(4)	/* stop() action */
+#define	DT_ACT_BREAKPOINT	DT_ACT(5)	/* breakpoint() action */
+#define	DT_ACT_PANIC		DT_ACT(6)	/* panic() action */
+#define	DT_ACT_SPECULATE	DT_ACT(7)	/* speculate() action */
+#define	DT_ACT_COMMIT		DT_ACT(8)	/* commit() action */
+#define	DT_ACT_DISCARD		DT_ACT(9)	/* discard() action */
+#define	DT_ACT_CHILL		DT_ACT(10)	/* chill() action */
+#define	DT_ACT_EXIT		DT_ACT(11)	/* exit() action */
+#define	DT_ACT_USTACK		DT_ACT(12)	/* ustack() action */
+#define	DT_ACT_PRINTA		DT_ACT(13)	/* printa() action */
+#define	DT_ACT_RAISE		DT_ACT(14)	/* raise() action */
+#define	DT_ACT_CLEAR		DT_ACT(15)	/* clear() action */
+#define	DT_ACT_NORMALIZE	DT_ACT(16)	/* normalize() action */
+#define	DT_ACT_DENORMALIZE	DT_ACT(17)	/* denormalize() action */
+#define	DT_ACT_TRUNC		DT_ACT(18)	/* trunc() action */
+#define	DT_ACT_SYSTEM		DT_ACT(19)	/* system() action */
+#define	DT_ACT_JSTACK		DT_ACT(20)	/* jstack() action */
+#define	DT_ACT_FTRUNCATE	DT_ACT(21)	/* ftruncate() action */
+#define	DT_ACT_FREOPEN		DT_ACT(22)	/* freopen() action */
+#define	DT_ACT_SYM		DT_ACT(23)	/* sym()/func() actions */
+#define	DT_ACT_MOD		DT_ACT(24)	/* mod() action */
+#define	DT_ACT_USYM		DT_ACT(25)	/* usym()/ufunc() actions */
+#define	DT_ACT_UMOD		DT_ACT(26)	/* umod() action */
+#define	DT_ACT_UADDR		DT_ACT(27)	/* uaddr() action */
+#define	DT_ACT_SETOPT		DT_ACT(28)	/* setopt() action */
+
+/*
+ * Sentinel to tell freopen() to restore the saved stdout.  This must not
+ * be ever valid for opening for write access via freopen(3C), which of
+ * course, "." never is.
+ */
+#define	DT_FREOPEN_RESTORE	"."
+
+#define	EDT_BASE	1000	/* base value for libdtrace errnos */
+
+enum {
+	EDT_VERSION = EDT_BASE,	/* client is requesting unsupported version */
+	EDT_VERSINVAL,		/* version string is invalid or overflows */
+	EDT_VERSUNDEF,		/* requested API version is not defined */
+	EDT_VERSREDUCED,	/* requested API version has been reduced */
+	EDT_CTF,		/* libctf called failed (dt_ctferr has more) */
+	EDT_COMPILER,		/* error in D program compilation */
+	EDT_NOREG,		/* register allocation failure */
+	EDT_NOTUPREG,		/* tuple register allocation failure */
+	EDT_NOMEM,		/* memory allocation failure */
+	EDT_INT2BIG,		/* integer limit exceeded */
+	EDT_STR2BIG,		/* string limit exceeded */
+	EDT_NOMOD,		/* unknown module name */
+	EDT_NOPROV,		/* unknown provider name */
+	EDT_NOPROBE,		/* unknown probe name */
+	EDT_NOSYM,		/* unknown symbol name */
+	EDT_NOSYMADDR,		/* no symbol corresponds to address */
+	EDT_NOTYPE,		/* unknown type name */
+	EDT_NOVAR,		/* unknown variable name */
+	EDT_NOAGG,		/* unknown aggregation name */
+	EDT_BADSCOPE,		/* improper use of type name scoping operator */
+	EDT_BADSPEC,		/* overspecified probe description */
+	EDT_BADSPCV,		/* bad macro variable in probe description */
+	EDT_BADID,		/* invalid probe identifier */
+	EDT_NOTLOADED,		/* module is not currently loaded */
+	EDT_NOCTF,		/* module does not contain any CTF data */
+	EDT_DATAMODEL,		/* module and program data models don't match */
+	EDT_DIFVERS,		/* library has newer DIF version than driver */
+	EDT_BADAGG,		/* unrecognized aggregating action */
+	EDT_FIO,		/* file i/o error */
+	EDT_DIFINVAL,		/* invalid DIF program */
+	EDT_DIFSIZE,		/* invalid DIF size */
+	EDT_DIFFAULT,		/* failed to copyin DIF program */
+	EDT_BADPROBE,		/* bad probe description */
+	EDT_BADPGLOB,		/* bad probe description globbing pattern */
+	EDT_NOSCOPE,		/* declaration scope stack underflow */
+	EDT_NODECL,		/* declaration stack underflow */
+	EDT_DMISMATCH,		/* record list does not match statement */
+	EDT_DOFFSET,		/* record data offset error */
+	EDT_DALIGN,		/* record data alignment error */
+	EDT_BADOPTNAME,		/* invalid dtrace_setopt option name */
+	EDT_BADOPTVAL,		/* invalid dtrace_setopt option value */
+	EDT_BADOPTCTX,		/* invalid dtrace_setopt option context */
+	EDT_CPPFORK,		/* failed to fork preprocessor */
+	EDT_CPPEXEC,		/* failed to exec preprocessor */
+	EDT_CPPENT,		/* preprocessor not found */
+	EDT_CPPERR,		/* unknown preprocessor error */
+	EDT_SYMOFLOW,		/* external symbol table overflow */
+	EDT_ACTIVE,		/* operation illegal when tracing is active */
+	EDT_DESTRUCTIVE,	/* destructive actions not allowed */
+	EDT_NOANON,		/* no anonymous tracing state */
+	EDT_ISANON,		/* can't claim anon state and enable probes */
+	EDT_ENDTOOBIG,		/* END enablings exceed size of prncpl buffer */
+	EDT_NOCONV,		/* failed to load type for printf conversion */
+	EDT_BADCONV,		/* incomplete printf conversion */
+	EDT_BADERROR,		/* invalid library ERROR action */
+	EDT_ERRABORT,		/* abort due to error */
+	EDT_DROPABORT,		/* abort due to drop */
+	EDT_DIRABORT,		/* abort explicitly directed */
+	EDT_BADRVAL,		/* invalid return value from callback */
+	EDT_BADNORMAL,		/* invalid normalization */
+	EDT_BUFTOOSMALL,	/* enabling exceeds size of buffer */
+	EDT_BADTRUNC,		/* invalid truncation */
+	EDT_BUSY,		/* device busy (active kernel debugger) */
+	EDT_ACCESS,		/* insufficient privileges to use DTrace */
+	EDT_NOENT,		/* dtrace device not available */
+	EDT_BRICKED,		/* abort due to systemic unresponsiveness */
+	EDT_HARDWIRE,		/* failed to load hard-wired definitions */
+	EDT_ELFVERSION,		/* libelf is out-of-date w.r.t libdtrace */
+	EDT_NOBUFFERED,		/* attempt to buffer output without handler */
+	EDT_UNSTABLE,		/* description matched unstable set of probes */
+	EDT_BADSETOPT,		/* invalid setopt library action */
+	EDT_BADSTACKPC,		/* invalid stack program counter size */
+	EDT_BADAGGVAR,		/* invalid aggregation variable identifier */
+	EDT_OVERSION,		/* client is requesting deprecated version */
+	EDT_ENABLING_ERR	/* failed to enable probe */
+};
+
+/*
+ * Interfaces for parsing and comparing DTrace attribute tuples, which describe
+ * stability and architectural binding information.  The dtrace_attribute_t
+ * structure and associated constant definitions are found in <sys/dtrace.h>.
+ */
+extern dtrace_attribute_t dt_attr_min(dtrace_attribute_t, dtrace_attribute_t);
+extern dtrace_attribute_t dt_attr_max(dtrace_attribute_t, dtrace_attribute_t);
+extern char *dt_attr_str(dtrace_attribute_t, char *, size_t);
+extern int dt_attr_cmp(dtrace_attribute_t, dtrace_attribute_t);
+
+/*
+ * Interfaces for parsing and handling DTrace version strings.  Version binding
+ * is a feature of the D compiler that is handled completely independently of
+ * the DTrace kernel infrastructure, so the definitions are here in libdtrace.
+ * Version strings are compiled into an encoded uint32_t which can be compared
+ * using C comparison operators.  Version definitions are found in dt_open.c.
+ */
+#define	DT_VERSION_STRMAX	16	/* enough for "255.4095.4095\0" */
+#define	DT_VERSION_MAJMAX	0xFF	/* maximum major version number */
+#define	DT_VERSION_MINMAX	0xFFF	/* maximum minor version number */
+#define	DT_VERSION_MICMAX	0xFFF	/* maximum micro version number */
+
+#define	DT_VERSION_NUMBER(M, m, u) \
+	((((M) & 0xFF) << 24) | (((m) & 0xFFF) << 12) | ((u) & 0xFFF))
+
+#define	DT_VERSION_MAJOR(v)	(((v) & 0xFF000000) >> 24)
+#define	DT_VERSION_MINOR(v)	(((v) & 0x00FFF000) >> 12)
+#define	DT_VERSION_MICRO(v)	((v) & 0x00000FFF)
+
+extern char *dt_version_num2str(dt_version_t, char *, size_t);
+extern int dt_version_str2num(const char *, dt_version_t *);
+extern int dt_version_defined(dt_version_t);
+
+/*
+ * Miscellaneous internal libdtrace interfaces.  The definitions below are for
+ * libdtrace routines that do not yet merit their own separate header file.
+ */
+extern char *dt_cpp_add_arg(dtrace_hdl_t *, const char *);
+extern char *dt_cpp_pop_arg(dtrace_hdl_t *);
+
+extern int dt_set_errno(dtrace_hdl_t *, int);
+extern void dt_set_errmsg(dtrace_hdl_t *, const char *, const char *,
+    const char *, int, const char *, va_list);
+
+extern int dt_ioctl(dtrace_hdl_t *, int, void *);
+extern int dt_status(dtrace_hdl_t *, processorid_t);
+extern long dt_sysconf(dtrace_hdl_t *, int);
+extern ssize_t dt_write(dtrace_hdl_t *, int, const void *, size_t);
+extern int dt_printf(dtrace_hdl_t *, FILE *, const char *, ...);
+
+extern void *dt_zalloc(dtrace_hdl_t *, size_t);
+extern void *dt_alloc(dtrace_hdl_t *, size_t);
+extern void dt_free(dtrace_hdl_t *, void *);
+extern void dt_difo_free(dtrace_hdl_t *, dtrace_difo_t *);
+
+extern int dt_gmatch(const char *, const char *);
+extern char *dt_basename(char *);
+
+extern ulong_t dt_popc(ulong_t);
+extern ulong_t dt_popcb(const ulong_t *, ulong_t);
+
+extern int dt_buffered_enable(dtrace_hdl_t *);
+extern int dt_buffered_flush(dtrace_hdl_t *, dtrace_probedata_t *,
+    const dtrace_recdesc_t *, const dtrace_aggdata_t *, uint32_t flags);
+extern void dt_buffered_disable(dtrace_hdl_t *);
+extern void dt_buffered_destroy(dtrace_hdl_t *);
+
+extern uint64_t dt_stddev(uint64_t *, uint64_t);
+
+extern int dt_options_load(dtrace_hdl_t *);
+
+extern void dt_dprintf(const char *, ...);
+
+extern void dt_setcontext(dtrace_hdl_t *, dtrace_probedesc_t *);
+extern void dt_endcontext(dtrace_hdl_t *);
+
+extern void dt_pragma(dt_node_t *);
+extern int dt_reduce(dtrace_hdl_t *, dt_version_t);
+extern void dt_cg(dt_pcb_t *, dt_node_t *);
+extern dtrace_difo_t *dt_as(dt_pcb_t *);
+extern void dt_dis(const dtrace_difo_t *, FILE *);
+
+extern int dt_aggregate_go(dtrace_hdl_t *);
+extern int dt_aggregate_init(dtrace_hdl_t *);
+extern void dt_aggregate_destroy(dtrace_hdl_t *);
+
+extern int dt_epid_lookup(dtrace_hdl_t *, dtrace_epid_t,
+    dtrace_eprobedesc_t **, dtrace_probedesc_t **);
+extern void dt_epid_destroy(dtrace_hdl_t *);
+extern int dt_aggid_lookup(dtrace_hdl_t *, dtrace_aggid_t, dtrace_aggdesc_t **);
+extern void dt_aggid_destroy(dtrace_hdl_t *);
+
+extern void *dt_format_lookup(dtrace_hdl_t *, int);
+extern void dt_format_destroy(dtrace_hdl_t *);
+
+extern int dt_print_quantize(dtrace_hdl_t *, FILE *,
+    const void *, size_t, uint64_t);
+extern int dt_print_lquantize(dtrace_hdl_t *, FILE *,
+    const void *, size_t, uint64_t);
+extern int dt_print_agg(const dtrace_aggdata_t *, void *);
+
+extern int dt_handle(dtrace_hdl_t *, dtrace_probedata_t *);
+extern int dt_handle_liberr(dtrace_hdl_t *,
+    const dtrace_probedata_t *, const char *);
+extern int dt_handle_cpudrop(dtrace_hdl_t *, processorid_t,
+    dtrace_dropkind_t, uint64_t);
+extern int dt_handle_status(dtrace_hdl_t *,
+    dtrace_status_t *, dtrace_status_t *);
+extern int dt_handle_setopt(dtrace_hdl_t *, dtrace_setoptdata_t *);
+
+extern int dt_lib_depend_add(dtrace_hdl_t *, dt_list_t *, const char *);
+extern dt_lib_depend_t *dt_lib_depend_lookup(dt_list_t *, const char *);
+
+extern dt_pcb_t *yypcb;		/* pointer to current parser control block */
+extern char yyintprefix;	/* int token prefix for macros (+/-) */
+extern char yyintsuffix[4];	/* int token suffix ([uUlL]*) */
+extern int yyintdecimal;	/* int token is decimal (1) or octal/hex (0) */
+extern char yytext[];		/* lex input buffer */
+extern int yylineno;		/* lex line number */
+extern int yydebug;		/* lex debugging */
+extern dt_node_t *yypragma;	/* lex token list for control lines */
+#ifdef VBOX
+extern int yylex(void);
+#endif
+
+extern const dtrace_attribute_t _dtrace_maxattr; /* maximum attributes */
+extern const dtrace_attribute_t _dtrace_defattr; /* default attributes */
+extern const dtrace_attribute_t _dtrace_symattr; /* symbol ref attributes */
+extern const dtrace_attribute_t _dtrace_typattr; /* type ref attributes */
+extern const dtrace_attribute_t _dtrace_prvattr; /* provider attributes */
+extern const dtrace_pattr_t _dtrace_prvdesc;	 /* provider attribute bundle */
+
+extern const dt_version_t _dtrace_versions[];	 /* array of valid versions */
+extern const char *const _dtrace_version;	 /* current version string */
+
+extern int _dtrace_strbuckets;		/* number of hash buckets for strings */
+extern int _dtrace_intbuckets;		/* number of hash buckets for ints */
+extern uint_t _dtrace_stkindent;	/* default indent for stack/ustack */
+extern uint_t _dtrace_pidbuckets;	/* number of hash buckets for pids */
+extern uint_t _dtrace_pidlrulim;	/* number of proc handles to cache */
+extern int _dtrace_debug;		/* debugging messages enabled */
+extern size_t _dtrace_bufsize;		/* default dt_buf_create() size */
+extern int _dtrace_argmax;		/* default maximum probe arguments */
+
+extern const char *_dtrace_libdir;	/* default library directory */
+extern const char *_dtrace_moddir;	/* default kernel module directory */
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_IMPL_H */
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_inttab.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_inttab.c
new file mode 100644
index 0000000..9055f43
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_inttab.c
@@ -0,0 +1,117 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <assert.h>
+#endif
+
+#include <dt_inttab.h>
+#include <dt_impl.h>
+
+dt_inttab_t *
+dt_inttab_create(dtrace_hdl_t *dtp)
+{
+	uint_t len = _dtrace_intbuckets;
+	dt_inttab_t *ip;
+
+	assert((len & (len - 1)) == 0);
+
+	if ((ip = dt_zalloc(dtp, sizeof (dt_inttab_t))) == NULL ||
+	    (ip->int_hash = dt_zalloc(dtp, sizeof (void *) * len)) == NULL) {
+		dt_free(dtp, ip);
+		return (NULL);
+	}
+
+	ip->int_hdl = dtp;
+	ip->int_hashlen = len;
+
+	return (ip);
+}
+
+void
+dt_inttab_destroy(dt_inttab_t *ip)
+{
+	dt_inthash_t *hp, *np;
+
+	for (hp = ip->int_head; hp != NULL; hp = np) {
+		np = hp->inh_next;
+		dt_free(ip->int_hdl, hp);
+	}
+
+	dt_free(ip->int_hdl, ip->int_hash);
+	dt_free(ip->int_hdl, ip);
+}
+
+int
+dt_inttab_insert(dt_inttab_t *ip, uint64_t value, uint_t flags)
+{
+	uint_t h = value & (ip->int_hashlen - 1);
+	dt_inthash_t *hp;
+
+	if (flags & DT_INT_SHARED) {
+		for (hp = ip->int_hash[h]; hp != NULL; hp = hp->inh_hash) {
+			if (hp->inh_value == value && hp->inh_flags == flags)
+				return (hp->inh_index);
+		}
+	}
+
+	if ((hp = dt_alloc(ip->int_hdl, sizeof (dt_inthash_t))) == NULL)
+		return (-1);
+
+	hp->inh_hash = ip->int_hash[h];
+	hp->inh_next = NULL;
+	hp->inh_value = value;
+	hp->inh_index = ip->int_index++;
+	hp->inh_flags = flags;
+
+	ip->int_hash[h] = hp;
+	ip->int_nelems++;
+
+	if (ip->int_head == NULL)
+		ip->int_head = hp;
+	else
+		ip->int_tail->inh_next = hp;
+
+	ip->int_tail = hp;
+	return (hp->inh_index);
+}
+
+uint_t
+dt_inttab_size(const dt_inttab_t *ip)
+{
+	return (ip->int_nelems);
+}
+
+void
+dt_inttab_write(const dt_inttab_t *ip, uint64_t *dst)
+{
+	const dt_inthash_t *hp;
+
+	for (hp = ip->int_head; hp != NULL; hp = hp->inh_next)
+		*dst++ = hp->inh_value;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_inttab.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_inttab.h
new file mode 100644
index 0000000..08daa4b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_inttab.h
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_INTTAB_H
+#define	_DT_INTTAB_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <dtrace.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct dt_inthash {
+	struct dt_inthash *inh_hash;	/* next dt_inthash in hash chain */
+	struct dt_inthash *inh_next;	/* next dt_inthash in output table */
+	uint64_t inh_value;		/* value associated with this element */
+	uint_t inh_index;		/* index associated with this element */
+	uint_t inh_flags;		/* flags (see below) */
+} dt_inthash_t;
+
+typedef struct dt_inttab {
+	dtrace_hdl_t *int_hdl;		/* pointer back to library handle */
+	dt_inthash_t **int_hash;	/* array of hash buckets */
+	uint_t int_hashlen;		/* size of hash bucket array */
+	uint_t int_nelems;		/* number of elements hashed */
+	dt_inthash_t *int_head;		/* head of table in index order */
+	dt_inthash_t *int_tail;		/* tail of table in index order */
+	uint_t int_index;		/* next index to hand out */
+} dt_inttab_t;
+
+#define	DT_INT_PRIVATE	0		/* only a single ref for this entry */
+#define	DT_INT_SHARED	1		/* multiple refs can share entry */
+
+extern dt_inttab_t *dt_inttab_create(dtrace_hdl_t *);
+extern void dt_inttab_destroy(dt_inttab_t *);
+extern int dt_inttab_insert(dt_inttab_t *, uint64_t, uint_t);
+extern uint_t dt_inttab_size(const dt_inttab_t *);
+extern void dt_inttab_write(const dt_inttab_t *, uint64_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_INTTAB_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.l b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.l
new file mode 100644
index 0000000..2b42a9a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.l
@@ -0,0 +1,914 @@
+%{
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#else  /* VBOX */
+# ifdef RT_OS_WINDOWS /* No unistd.h on windows, avoid redef warnings of the [U]INTxx_MAX defines caused by no inttypes.h/stdint.h. */
+#  define YY_NO_UNISTD_H
+#  undef INT8_MAX
+#  undef INT16_MAX
+#  undef INT32_MAX
+#  undef INT64_MAX
+#  undef UINT8_MAX
+#  undef UINT16_MAX
+#  undef UINT32_MAX
+#  undef UINT64_MAX
+# endif
+# include <iprt/ctype.h>
+# define isdigit(a_ch) RT_C_IS_DIGIT(a_ch)
+#endif /* VBOX */
+
+#include <dt_impl.h>
+#include <dt_grammar.h>
+#include <dt_parser.h>
+#include <dt_string.h>
+
+#ifndef USING_FLEX
+/*
+ * We need to undefine lex's input and unput macros so that references to these
+ * call the functions provided at the end of this source file.
+ */
+#undef input
+#undef unput
+#else  /* USING_FLEX */
+# define YY_INPUT(buf, result, max_size) \
+	do { \
+		if (yypcb->pcb_fileptr != NULL) { \
+			result = (int)fread(buf, 1, max_size, yypcb->pcb_fileptr); \
+			if (!result && ferror(yypcb->pcb_fileptr)) \
+		      longjmp(yypcb->pcb_jmpbuf, EDT_FIO); \
+				/*YY_FATAL_ERROR("input in flex scanner failed");*/ \
+		} else { \
+			size_t off = yypcb->pcb_strptr - yypcb->pcb_string; \
+			if (off < yypcb->pcb_strlen) { \
+            off = yypcb->pcb_strlen - off; \
+				result = max_size; \
+				if ((size_t)result > off) \
+					result = (int)off; \
+				memcpy(buf, yypcb->pcb_strptr, result); \
+				yypcb->pcb_strptr += result; \
+            /*fprintf(stderr, "yy_input -> %d '%.*s'\n", result, result, buf);*/ \
+         } else { \
+            buf[0] = '\0'; \
+            result = 0; \
+            /*fprintf(stderr, "yy_input -> %d\n", result);*/ \
+         } \
+		} \
+	} while (0)
+#endif /* USING_FLEX */
+
+static int id_or_type(const char *);
+#ifndef USING_FLEX
+static int input(void);
+static void unput(int);
+#endif
+
+/*
+ * We first define a set of labeled states for use in the D lexer and then a
+ * set of regular expressions to simplify things below. The lexer states are:
+ *
+ * S0 - D program clause and expression lexing
+ * S1 - D comments (i.e. skip everything until end of comment)
+ * S2 - D program outer scope (probe specifiers and declarations)
+ * S3 - D control line parsing (i.e. after ^# is seen but before \n)
+ * S4 - D control line scan (locate control directives only and invoke S3)
+ */
+%}
+
+%e 1500		/* maximum nodes */
+%p 3700		/* maximum positions */
+%n 600		/* maximum states */
+
+%s S0 S1 S2 S3 S4
+
+RGX_AGG		"@"[a-zA-Z_][0-9a-zA-Z_]*
+RGX_PSPEC	[-$:a-zA-Z_.?*\\\[\]!][-$:0-9a-zA-Z_.`?*\\\[\]!]*
+RGX_IDENT	[a-zA-Z_`][0-9a-zA-Z_`]*
+RGX_INT		([0-9]+|0[xX][0-9A-Fa-f]+)[uU]?[lL]?[lL]?
+RGX_FP		([0-9]+("."?)[0-9]*|"."[0-9]+)((e|E)("+"|-)?[0-9]+)?[fFlL]?
+RGX_WS		[\f\n\r\t\v ]
+RGX_STR		([^"\\\n]|\\[^"\n]|\\\")*
+RGX_CHR		([^'\\\n]|\\[^'\n]|\\')*
+RGX_INTERP	^[\f\t\v ]*#!.*
+RGX_CTL		^[\f\t\v ]*#
+
+%%
+
+%{
+
+/*
+ * We insert a special prologue into yylex() itself: if the pcb contains a
+ * context token, we return that prior to running the normal lexer.  This
+ * allows libdtrace to force yacc into one of our three parsing contexts: D
+ * expression (DT_CTX_DEXPR), D program (DT_CTX_DPROG) or D type (DT_CTX_DTYPE).
+ * Once the token is returned, we clear it so this only happens once.
+ */
+if (yypcb->pcb_token != 0) {
+	int tok = yypcb->pcb_token;
+	yypcb->pcb_token = 0;
+	return (tok);
+}
+
+%}
+
+<S0>auto	return (DT_KEY_AUTO);
+<S0>break	return (DT_KEY_BREAK);
+<S0>case	return (DT_KEY_CASE);
+<S0>char	return (DT_KEY_CHAR);
+<S0>const	return (DT_KEY_CONST);
+<S0>continue	return (DT_KEY_CONTINUE);
+<S0>counter	return (DT_KEY_COUNTER);
+<S0>default	return (DT_KEY_DEFAULT);
+<S0>do		return (DT_KEY_DO);
+<S0>double	return (DT_KEY_DOUBLE);
+<S0>else	return (DT_KEY_ELSE);
+<S0>enum	return (DT_KEY_ENUM);
+<S0>extern	return (DT_KEY_EXTERN);
+<S0>float	return (DT_KEY_FLOAT);
+<S0>for		return (DT_KEY_FOR);
+<S0>goto	return (DT_KEY_GOTO);
+<S0>if		return (DT_KEY_IF);
+<S0>import	return (DT_KEY_IMPORT);
+<S0>inline	return (DT_KEY_INLINE);
+<S0>int		return (DT_KEY_INT);
+<S0>long	return (DT_KEY_LONG);
+<S0>offsetof	return (DT_TOK_OFFSETOF);
+<S0>probe	return (DT_KEY_PROBE);
+<S0>provider	return (DT_KEY_PROVIDER);
+<S0>register	return (DT_KEY_REGISTER);
+<S0>restrict	return (DT_KEY_RESTRICT);
+<S0>return	return (DT_KEY_RETURN);
+<S0>self	return (DT_KEY_SELF);
+<S0>short	return (DT_KEY_SHORT);
+<S0>signed	return (DT_KEY_SIGNED);
+<S0>sizeof	return (DT_TOK_SIZEOF);
+<S0>static	return (DT_KEY_STATIC);
+<S0>string	return (DT_KEY_STRING);
+<S0>stringof	return (DT_TOK_STRINGOF);
+<S0>struct	return (DT_KEY_STRUCT);
+<S0>switch	return (DT_KEY_SWITCH);
+<S0>this	return (DT_KEY_THIS);
+<S0>translator	return (DT_KEY_XLATOR);
+<S0>typedef	return (DT_KEY_TYPEDEF);
+<S0>union	return (DT_KEY_UNION);
+<S0>unsigned	return (DT_KEY_UNSIGNED);
+<S0>void	return (DT_KEY_VOID);
+<S0>volatile	return (DT_KEY_VOLATILE);
+<S0>while	return (DT_KEY_WHILE);
+<S0>xlate	return (DT_TOK_XLATE);
+
+<S2>auto	{ yybegin(YYS_EXPR);	return (DT_KEY_AUTO); }
+<S2>char	{ yybegin(YYS_EXPR);	return (DT_KEY_CHAR); }
+<S2>const	{ yybegin(YYS_EXPR);	return (DT_KEY_CONST); }
+<S2>counter	{ yybegin(YYS_DEFINE);	return (DT_KEY_COUNTER); }
+<S2>double	{ yybegin(YYS_EXPR);	return (DT_KEY_DOUBLE); }
+<S2>enum	{ yybegin(YYS_EXPR);	return (DT_KEY_ENUM); }
+<S2>extern	{ yybegin(YYS_EXPR);	return (DT_KEY_EXTERN); }
+<S2>float	{ yybegin(YYS_EXPR);	return (DT_KEY_FLOAT); }
+<S2>import	{ yybegin(YYS_EXPR);	return (DT_KEY_IMPORT); }
+<S2>inline	{ yybegin(YYS_DEFINE);	return (DT_KEY_INLINE); }
+<S2>int		{ yybegin(YYS_EXPR);	return (DT_KEY_INT); }
+<S2>long	{ yybegin(YYS_EXPR);	return (DT_KEY_LONG); }
+<S2>provider	{ yybegin(YYS_DEFINE);	return (DT_KEY_PROVIDER); }
+<S2>register	{ yybegin(YYS_EXPR);	return (DT_KEY_REGISTER); }
+<S2>restrict	{ yybegin(YYS_EXPR);	return (DT_KEY_RESTRICT); }
+<S2>self	{ yybegin(YYS_EXPR);	return (DT_KEY_SELF); }
+<S2>short	{ yybegin(YYS_EXPR);	return (DT_KEY_SHORT); }
+<S2>signed	{ yybegin(YYS_EXPR);	return (DT_KEY_SIGNED); }
+<S2>static	{ yybegin(YYS_EXPR);	return (DT_KEY_STATIC); }
+<S2>string	{ yybegin(YYS_EXPR);	return (DT_KEY_STRING); }
+<S2>struct	{ yybegin(YYS_EXPR);	return (DT_KEY_STRUCT); }
+<S2>this	{ yybegin(YYS_EXPR);	return (DT_KEY_THIS); }
+<S2>translator	{ yybegin(YYS_DEFINE);	return (DT_KEY_XLATOR); }
+<S2>typedef	{ yybegin(YYS_EXPR);	return (DT_KEY_TYPEDEF); }
+<S2>union	{ yybegin(YYS_EXPR);	return (DT_KEY_UNION); }
+<S2>unsigned	{ yybegin(YYS_EXPR);	return (DT_KEY_UNSIGNED); }
+<S2>void	{ yybegin(YYS_EXPR);	return (DT_KEY_VOID); }
+<S2>volatile	{ yybegin(YYS_EXPR);	return (DT_KEY_VOLATILE); }
+
+<S0>"$$"[0-9]+	{
+			int i = atoi(yytext + 2);
+			char *v = "";
+
+			/*
+			 * A macro argument reference substitutes the text of
+			 * an argument in place of the current token.  When we
+			 * see $$<d> we fetch the saved string from pcb_sargv
+			 * (or use the default argument if the option has been
+			 * set and the argument hasn't been specified) and
+			 * return a token corresponding to this string.
+			 */
+			if (i < 0 || (i >= yypcb->pcb_sargc &&
+			    !(yypcb->pcb_cflags & DTRACE_C_DEFARG))) {
+				xyerror(D_MACRO_UNDEF, "macro argument %s is "
+				    "not defined\n", yytext);
+			}
+
+			if (i < yypcb->pcb_sargc) {
+				v = yypcb->pcb_sargv[i]; /* get val from pcb */
+				yypcb->pcb_sflagv[i] |= DT_IDFLG_REF;
+			}
+
+			if ((yylval.l_str = strdup(v)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			(void) stresc2chr(yylval.l_str);
+			return (DT_TOK_STRING);
+		}
+
+<S0>"$"[0-9]+	{
+			int i = atoi(yytext + 1);
+			char *p, *v = "0";
+
+			/*
+			 * A macro argument reference substitutes the text of
+			 * one identifier or integer pattern for another.  When
+			 * we see $<d> we fetch the saved string from pcb_sargv
+			 * (or use the default argument if the option has been
+			 * set and the argument hasn't been specified) and
+			 * return a token corresponding to this string.
+			 */
+			if (i < 0 || (i >= yypcb->pcb_sargc &&
+			    !(yypcb->pcb_cflags & DTRACE_C_DEFARG))) {
+				xyerror(D_MACRO_UNDEF, "macro argument %s is "
+				    "not defined\n", yytext);
+			}
+
+			if (i < yypcb->pcb_sargc) {
+				v = yypcb->pcb_sargv[i]; /* get val from pcb */
+				yypcb->pcb_sflagv[i] |= DT_IDFLG_REF;
+			}
+
+			/*
+			 * If the macro text is not a valid integer or ident,
+			 * then we treat it as a string.  The string may be
+			 * optionally enclosed in quotes, which we strip.
+			 */
+			if (strbadidnum(v)) {
+				size_t len = strlen(v);
+
+				if (len != 1 && *v == '"' && v[len - 1] == '"')
+					yylval.l_str = strndup(v + 1, len - 2);
+				else
+					yylval.l_str = strndup(v, len);
+
+				if (yylval.l_str == NULL)
+					longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+				(void) stresc2chr(yylval.l_str);
+				return (DT_TOK_STRING);
+			}
+
+			/*
+			 * If the macro text is not a string an begins with a
+			 * digit or a +/- sign, process it as an integer token.
+			 */
+			if (isdigit(v[0]) || v[0] == '-' || v[0] == '+') {
+#ifdef VBOX
+				int rc;
+#endif
+				if (isdigit(v[0]))
+					yyintprefix = 0;
+				else
+					yyintprefix = *v++;
+
+#ifndef VBOX
+				errno = 0;
+				yylval.l_int = strtoull(v, &p, 0);
+#else
+				rc = RTStrToUInt64Ex(v, &p, 0, &yylval.l_int);
+#endif
+				(void) strncpy(yyintsuffix, p,
+				    sizeof (yyintsuffix));
+				yyintdecimal = *v != '0';
+
+#ifndef VBOX
+				if (errno == ERANGE)
+#else
+				if (rc == VWRN_NUMBER_TOO_BIG || rc == VWRN_NEGATIVE_UNSIGNED)
+#endif
+					xyerror(D_MACRO_OFLOW, "macro argument"
+					    " %s constant %s results in integer"
+					    " overflow\n", yytext, v);
+
+				return (DT_TOK_INT);
+			}
+
+			return (id_or_type(v));
+		}
+
+<S0>"$$"{RGX_IDENT} {
+			dt_ident_t *idp = dt_idhash_lookup(
+			    yypcb->pcb_hdl->dt_macros, yytext + 2);
+
+			char s[16]; /* enough for UINT_MAX + \0 */
+
+			if (idp == NULL) {
+				xyerror(D_MACRO_UNDEF, "macro variable %s "
+				    "is not defined\n", yytext);
+			}
+
+			/*
+			 * For the moment, all current macro variables are of
+			 * type id_t (refer to dtrace_update() for details).
+			 */
+			(void) snprintf(s, sizeof (s), "%u", idp->di_id);
+			if ((yylval.l_str = strdup(s)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			return (DT_TOK_STRING);
+		}
+
+<S0>"$"{RGX_IDENT} {
+			dt_ident_t *idp = dt_idhash_lookup(
+			    yypcb->pcb_hdl->dt_macros, yytext + 1);
+
+			if (idp == NULL) {
+				xyerror(D_MACRO_UNDEF, "macro variable %s "
+				    "is not defined\n", yytext);
+			}
+
+			/*
+			 * For the moment, all current macro variables are of
+			 * type id_t (refer to dtrace_update() for details).
+			 */
+			yylval.l_int = (intmax_t)(int)idp->di_id;
+			yyintprefix = 0;
+			yyintsuffix[0] = '\0';
+			yyintdecimal = 1;
+
+			return (DT_TOK_INT);
+		}
+
+<S0>{RGX_IDENT}	{
+			return (id_or_type(yytext));
+		}
+
+<S0>{RGX_AGG}	{
+			if ((yylval.l_str = strdup(yytext)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+			return (DT_TOK_AGG);
+		}
+
+<S0>"@"		{
+			if ((yylval.l_str = strdup("@_")) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+			return (DT_TOK_AGG);
+		}
+
+<S0>{RGX_INT}	|
+<S2>{RGX_INT}	|
+<S3>{RGX_INT}	{
+			char *p;
+
+#ifndef VBOX
+			errno = 0;
+			yylval.l_int = strtoull(yytext, &p, 0);
+#else
+			int rc = RTStrToUInt64Ex(yytext, &p, 0, &yylval.l_int);
+#endif
+			yyintprefix = 0;
+			(void) strncpy(yyintsuffix, p, sizeof (yyintsuffix));
+			yyintdecimal = yytext[0] != '0';
+
+#ifndef VBOX
+			if (errno == ERANGE)
+#else
+			if (rc == VWRN_NUMBER_TOO_BIG || rc == VWRN_NEGATIVE_UNSIGNED)
+#endif
+				xyerror(D_INT_OFLOW, "constant %s results in "
+				    "integer overflow\n", yytext);
+
+			if (*p != '\0' && strchr("uUlL", *p) == NULL) {
+				xyerror(D_INT_DIGIT, "constant %s contains "
+				    "invalid digit %c\n", yytext, *p);
+			}
+
+			if ((YYSTATE) != S3)
+				return (DT_TOK_INT);
+
+			yypragma = dt_node_link(yypragma,
+			    dt_node_int(yylval.l_int));
+		}
+
+<S0>{RGX_FP}	yyerror("floating-point constants are not permitted\n");
+
+ /* VBOX changed:
+<S0>\"{RGX_STR}$ |
+<S3>\"{RGX_STR}$ xyerror(D_STR_NL, "newline encountered in string literal");
+ input: */
+<S0,S3>\"{RGX_STR}$ xyerror(D_STR_NL, "newline encountered in string literal");
+
+<S0>\"{RGX_STR}\" |
+<S3>\"{RGX_STR}\" {
+			/*
+			 * Quoted string -- convert C escape sequences and
+			 * return the string as a token.
+			 */
+			yylval.l_str = strndup(yytext + 1, yyleng - 2);
+
+			if (yylval.l_str == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			(void) stresc2chr(yylval.l_str);
+			if ((YYSTATE) != S3)
+				return (DT_TOK_STRING);
+
+			yypragma = dt_node_link(yypragma,
+			    dt_node_string(yylval.l_str));
+		}
+
+<S0>'{RGX_CHR}$	xyerror(D_CHR_NL, "newline encountered in character constant");
+
+<S0>'{RGX_CHR}'	{
+			char *s, *p, *q;
+			size_t nbytes;
+
+			/*
+			 * Character constant -- convert C escape sequences and
+			 * return the character as an integer immediate value.
+			 */
+			if (yyleng == 2)
+				xyerror(D_CHR_NULL, "empty character constant");
+
+			s = yytext + 1;
+			yytext[yyleng - 1] = '\0';
+			nbytes = stresc2chr(s);
+			yylval.l_int = 0;
+			yyintprefix = 0;
+			yyintsuffix[0] = '\0';
+			yyintdecimal = 1;
+
+			if (nbytes > sizeof (yylval.l_int)) {
+				xyerror(D_CHR_OFLOW, "character constant is "
+				    "too long");
+			}
+#ifdef _LITTLE_ENDIAN
+			p = ((char *)&yylval.l_int) + nbytes - 1;
+			for (q = s; nbytes != 0; nbytes--)
+				*p-- = *q++;
+#else
+			bcopy(s, ((char *)&yylval.l_int) +
+			    sizeof (yylval.l_int) - nbytes, nbytes);
+#endif
+			return (DT_TOK_INT);
+		}
+
+<S0>"/*"	|
+<S2>"/*"	{
+			yypcb->pcb_cstate = (YYSTATE);
+			BEGIN(S1);
+		}
+
+<S0>{RGX_INTERP} |
+<S2>{RGX_INTERP} ;	/* discard any #! lines */
+
+<S0>{RGX_CTL}	|
+<S2>{RGX_CTL}	|
+<S4>{RGX_CTL}	{
+			assert(yypragma == NULL);
+			yypcb->pcb_cstate = (YYSTATE);
+			BEGIN(S3);
+		}
+
+<S4>.		;	/* discard */
+<S4>"\n"	;	/* discard */
+
+<S0>"/"		{
+			int c, tok;
+
+			/*
+			 * The use of "/" as the predicate delimiter and as the
+			 * integer division symbol requires special lookahead
+			 * to avoid a shift/reduce conflict in the D grammar.
+			 * We look ahead to the next non-whitespace character.
+			 * If we encounter EOF, ";", "{", or "/", then this "/"
+			 * closes the predicate and we return DT_TOK_EPRED.
+			 * If we encounter anything else, it's DT_TOK_DIV.
+			 */
+			while ((c = input()) != 0) {
+				if (strchr("\f\n\r\t\v ", c) == NULL)
+					break;
+			}
+
+			if (c == 0 || c == ';' || c == '{' || c == '/') {
+				if (yypcb->pcb_parens != 0) {
+					yyerror("closing ) expected in "
+					    "predicate before /\n");
+				}
+				if (yypcb->pcb_brackets != 0) {
+					yyerror("closing ] expected in "
+					    "predicate before /\n");
+				}
+				tok = DT_TOK_EPRED;
+			} else
+				tok = DT_TOK_DIV;
+
+			if (c != EOF) unput(c);
+			return (tok);
+		}
+
+<S0>"("		{
+			yypcb->pcb_parens++;
+			return (DT_TOK_LPAR);
+		}
+
+<S0>")"		{
+			if (--yypcb->pcb_parens < 0)
+				yyerror("extra ) in input stream\n");
+			return (DT_TOK_RPAR);
+		}
+
+<S0>"["		{
+			yypcb->pcb_brackets++;
+			return (DT_TOK_LBRAC);
+		}
+
+<S0>"]"		{
+			if (--yypcb->pcb_brackets < 0)
+				yyerror("extra ] in input stream\n");
+			return (DT_TOK_RBRAC);
+		}
+
+<S0>"{"		|
+<S2>"{"		{
+			yypcb->pcb_braces++;
+			return ('{');
+		}
+
+<S0>"}"		{
+			if (--yypcb->pcb_braces < 0)
+				yyerror("extra } in input stream\n");
+			return ('}');
+		}
+
+<S0>"|"		return (DT_TOK_BOR);
+<S0>"^"		return (DT_TOK_XOR);
+<S0>"&"		return (DT_TOK_BAND);
+<S0>"&&"	return (DT_TOK_LAND);
+<S0>"^^"	return (DT_TOK_LXOR);
+<S0>"||"	return (DT_TOK_LOR);
+<S0>"=="	return (DT_TOK_EQU);
+<S0>"!="	return (DT_TOK_NEQ);
+<S0>"<"		return (DT_TOK_LT);
+<S0>"<="	return (DT_TOK_LE);
+<S0>">"		return (DT_TOK_GT);
+<S0>">="	return (DT_TOK_GE);
+<S0>"<<"	return (DT_TOK_LSH);
+<S0>">>"	return (DT_TOK_RSH);
+<S0>"+"		return (DT_TOK_ADD);
+<S0>"-"		return (DT_TOK_SUB);
+<S0>"*"		return (DT_TOK_MUL);
+<S0>"%"		return (DT_TOK_MOD);
+<S0>"~"		return (DT_TOK_BNEG);
+<S0>"!"		return (DT_TOK_LNEG);
+<S0>"?"		return (DT_TOK_QUESTION);
+<S0>":"		return (DT_TOK_COLON);
+<S0>"."		return (DT_TOK_DOT);
+<S0>"->"	return (DT_TOK_PTR);
+<S0>"="		return (DT_TOK_ASGN);
+<S0>"+="	return (DT_TOK_ADD_EQ);
+<S0>"-="	return (DT_TOK_SUB_EQ);
+<S0>"*="	return (DT_TOK_MUL_EQ);
+<S0>"/="	return (DT_TOK_DIV_EQ);
+<S0>"%="	return (DT_TOK_MOD_EQ);
+<S0>"&="	return (DT_TOK_AND_EQ);
+<S0>"^="	return (DT_TOK_XOR_EQ);
+<S0>"|="	return (DT_TOK_OR_EQ);
+<S0>"<<="	return (DT_TOK_LSH_EQ);
+<S0>">>="	return (DT_TOK_RSH_EQ);
+<S0>"++"	return (DT_TOK_ADDADD);
+<S0>"--"	return (DT_TOK_SUBSUB);
+<S0>"..."	return (DT_TOK_ELLIPSIS);
+<S0>","		return (DT_TOK_COMMA);
+<S0>";"		return (';');
+<S0>{RGX_WS}	; /* discard */
+<S0>"\\"\n	; /* discard */
+<S0>.		yyerror("syntax error near \"%c\"\n", yytext[0]);
+
+<S1>"/*"	yyerror("/* encountered inside a comment\n");
+<S1>"*/"	BEGIN(yypcb->pcb_cstate);
+ /* VBOX - START */
+<S1><<EOF>>	yyerror("end-of-file encountered before matching */\n");
+ /* VBOX - END */
+<S1>.|\n	; /* discard */
+
+<S2>{RGX_PSPEC}	{
+			/*
+			 * S2 has an ambiguity because RGX_PSPEC includes '*'
+			 * as a glob character and '*' also can be DT_TOK_STAR.
+			 * Since lex always matches the longest token, this
+			 * rule can be matched by an input string like "int*",
+			 * which could begin a global variable declaration such
+			 * as "int*x;" or could begin a RGX_PSPEC with globbing
+			 * such as "int* { trace(timestamp); }".  If C_PSPEC is
+			 * not set, we must resolve the ambiguity in favor of
+			 * the type and perform lexer pushback if the fragment
+			 * before '*' or entire fragment matches a type name.
+			 * If C_PSPEC is set, we always return a PSPEC token.
+			 * If C_PSPEC is off, the user can avoid ambiguity by
+			 * including a ':' delimiter in the specifier, which
+			 * they should be doing anyway to specify the provider.
+			 */
+			if (!(yypcb->pcb_cflags & DTRACE_C_PSPEC) &&
+			    strchr(yytext, ':') == NULL) {
+
+				char *p = strchr(yytext, '*');
+				char *q = yytext + yyleng - 1;
+
+				if (p != NULL && p > yytext)
+					*p = '\0'; /* prune yytext */
+
+				if (dt_type_lookup(yytext, NULL) == 0) {
+					yylval.l_str = strdup(yytext);
+
+					if (yylval.l_str == NULL) {
+						longjmp(yypcb->pcb_jmpbuf,
+						    EDT_NOMEM);
+					}
+
+					if (p != NULL && p > yytext) {
+						for (*p = '*'; q >= p; q--)
+							unput(*q);
+					}
+
+					yybegin(YYS_EXPR);
+					return (DT_TOK_TNAME);
+				}
+
+				if (p != NULL && p > yytext)
+					*p = '*'; /* restore yytext */
+			}
+
+			if ((yylval.l_str = strdup(yytext)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			return (DT_TOK_PSPEC);
+		}
+
+<S2>"/"		return (DT_TOK_DIV);
+<S2>","		return (DT_TOK_COMMA);
+
+<S2>{RGX_WS}	; /* discard */
+<S2>.		yyerror("syntax error near \"%c\"\n", yytext[0]);
+
+<S3>\n		{
+			dt_pragma(yypragma);
+			yypragma = NULL;
+			BEGIN(yypcb->pcb_cstate);
+		}
+
+<S3>[\f\t\v ]+	; /* discard */
+
+<S3>[^\f\n\t\v "]+ {
+			dt_node_t *dnp;
+
+			if ((yylval.l_str = strdup(yytext)) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			/*
+			 * We want to call dt_node_ident() here, but we can't
+			 * because it will expand inlined identifiers, which we
+			 * don't want to do from #pragma context in order to
+			 * support pragmas that apply to the ident itself.  We
+			 * call dt_node_string() and then reset dn_op instead.
+			 */
+			dnp = dt_node_string(yylval.l_str);
+			dnp->dn_kind = DT_NODE_IDENT;
+			dnp->dn_op = DT_TOK_IDENT;
+			yypragma = dt_node_link(yypragma, dnp);
+		}
+
+ /* VBOX - BEGIN */
+<S3><<EOF>>	yyerror("end-of-file encountered before end of control line\n");
+ /* VBOX - END */
+<S3>.		yyerror("syntax error near \"%c\"\n", yytext[0]);
+
+%%
+
+/*
+ * yybegin provides a wrapper for use from C code around the lex BEGIN() macro.
+ * We use two main states for lexing because probe descriptions use a syntax
+ * that is incompatible with the normal D tokens (e.g. names can contain "-").
+ * yybegin also handles the job of switching between two lists of dt_nodes
+ * as we allocate persistent definitions, like inlines, and transient nodes
+ * that will be freed once we are done parsing the current program file.
+ */
+void
+yybegin(yystate_t state)
+{
+#ifdef	YYDEBUG
+	yydebug = _dtrace_debug;
+#endif
+	if (yypcb->pcb_yystate == state)
+		return; /* nothing to do if we're in the state already */
+
+	if (yypcb->pcb_yystate == YYS_DEFINE) {
+		yypcb->pcb_list = yypcb->pcb_hold;
+		yypcb->pcb_hold = NULL;
+	}
+
+	switch (state) {
+	case YYS_CLAUSE:
+		BEGIN(S2);
+		break;
+	case YYS_DEFINE:
+		assert(yypcb->pcb_hold == NULL);
+		yypcb->pcb_hold = yypcb->pcb_list;
+		yypcb->pcb_list = NULL;
+		/*FALLTHRU*/
+	case YYS_EXPR:
+		BEGIN(S0);
+		break;
+	case YYS_DONE:
+		break;
+	case YYS_CONTROL:
+		BEGIN(S4);
+		break;
+	default:
+		xyerror(D_UNKNOWN, "internal error -- bad yystate %d\n", state);
+	}
+
+	yypcb->pcb_yystate = state;
+}
+
+void
+yyinit(dt_pcb_t *pcb)
+{
+	yypcb = pcb;
+	yylineno = 1;
+	yypragma = NULL;
+#ifndef USING_FLEX
+	yysptr = yysbuf;
+#else
+   yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
+#endif
+}
+
+/*
+ * Given a lexeme 's' (typically yytext), set yylval and return an appropriate
+ * token to the parser indicating either an identifier or a typedef name.
+ * User-defined global variables always take precedence over types, but we do
+ * use some heuristics because D programs can look at an ever-changing set of
+ * kernel types and also can implicitly instantiate variables by assignment,
+ * unlike in C.  The code here is ordered carefully as lookups are not cheap.
+ */
+static int
+id_or_type(const char *s)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_decl_t *ddp = yypcb->pcb_dstack.ds_decl;
+	int c0, c1, ttok = DT_TOK_TNAME;
+	dt_ident_t *idp;
+
+	if ((s = yylval.l_str = strdup(s)) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	/*
+	 * If the lexeme is a global variable or likely identifier or *not* a
+	 * type_name, then it is an identifier token.
+	 */
+	if (dt_idstack_lookup(&yypcb->pcb_globals, s) != NULL ||
+	    dt_idhash_lookup(yypcb->pcb_idents, s) != NULL ||
+	    dt_type_lookup(s, NULL) != 0)
+		return (DT_TOK_IDENT);
+
+	/*
+	 * If we're in the midst of parsing a declaration and a type_specifier
+	 * has already been shifted, then return DT_TOK_IDENT instead of TNAME.
+	 * This semantic is necessary to permit valid ISO C code such as:
+	 *
+	 * typedef int foo;
+	 * struct s { foo foo; };
+	 *
+	 * without causing shift/reduce conflicts in the direct_declarator part
+	 * of the grammar.  The result is that we must check for conflicting
+	 * redeclarations of the same identifier as part of dt_node_decl().
+	 */
+	if (ddp != NULL && ddp->dd_name != NULL)
+		return (DT_TOK_IDENT);
+
+	/*
+	 * If the lexeme is a type name and we are not in a program clause,
+	 * then always interpret it as a type and return DT_TOK_TNAME.
+	 */
+	if ((YYSTATE) != S0)
+		return (DT_TOK_TNAME);
+
+	/*
+	 * If the lexeme matches a type name but is in a program clause, then
+	 * it could be a type or it could be an undefined variable.  Peek at
+	 * the next token to decide.  If we see ++, --, [, or =, we know there
+	 * might be an assignment that is trying to create a global variable,
+	 * so we optimistically return DT_TOK_IDENT.  There is no harm in being
+	 * wrong: a type_name followed by ++, --, [, or = is a syntax error.
+	 */
+	while ((c0 = input()) != 0) {
+		if (strchr("\f\n\r\t\v ", c0) == NULL)
+			break;
+	}
+
+	switch (c0) {
+	case '+':
+	case '-':
+		if ((c1 = input()) == c0)
+			ttok = DT_TOK_IDENT;
+		if (c1 != EOF) unput(c1);
+		break;
+
+	case '=':
+		if ((c1 = input()) != c0)
+			ttok = DT_TOK_IDENT;
+		if (c1 != EOF) unput(c1);
+		break;
+	case '[':
+		ttok = DT_TOK_IDENT;
+		break;
+	}
+
+	if (ttok == DT_TOK_IDENT) {
+		idp = dt_idhash_insert(yypcb->pcb_idents, s, DT_IDENT_SCALAR, 0,
+		    0, _dtrace_defattr, 0, &dt_idops_thaw, NULL, dtp->dt_gen);
+
+		if (idp == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	if (c0 != EOF) unput(c0);
+	return (ttok);
+}
+
+#ifndef USING_FLEX
+
+static int
+input(void)
+{
+	int c;
+
+	if (yysptr > yysbuf)
+		c = *--yysptr;
+	else if (yypcb->pcb_fileptr != NULL)
+		c = fgetc(yypcb->pcb_fileptr);
+	else if (yypcb->pcb_strptr < yypcb->pcb_string + yypcb->pcb_strlen)
+		c = *(unsigned char *)(yypcb->pcb_strptr++);
+	else
+		c = EOF;
+
+	if (c == '\n')
+		yylineno++;
+
+	if (c != EOF)
+		return (c);
+
+	if ((YYSTATE) == S1)
+		yyerror("end-of-file encountered before matching */\n");
+
+	if ((YYSTATE) == S3)
+		yyerror("end-of-file encountered before end of control line\n");
+
+	if (yypcb->pcb_fileptr != NULL && ferror(yypcb->pcb_fileptr))
+		longjmp(yypcb->pcb_jmpbuf, EDT_FIO);
+
+	return (0); /* EOF */
+}
+
+static void
+unput(int c)
+{
+	if (c == '\n')
+		yylineno--;
+
+	*yysptr++ = c;
+	yytchar = c;
+}
+
+#endif /* USING_FLEX */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_link.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_link.c
new file mode 100644
index 0000000..e910ac3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_link.c
@@ -0,0 +1,1634 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#define	ELF_TARGET_ALL
+#include <elf.h>
+
+#include <sys/types.h>
+#include <sys/sysmacros.h>
+
+#include <unistd.h>
+#include <strings.h>
+#include <alloca.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <wait.h>
+#include <assert.h>
+#include <sys/ipc.h>
+
+#include <dt_impl.h>
+#include <dt_provider.h>
+#include <dt_program.h>
+#include <dt_string.h>
+
+#define	ESHDR_NULL	0
+#define	ESHDR_SHSTRTAB	1
+#define	ESHDR_DOF	2
+#define	ESHDR_STRTAB	3
+#define	ESHDR_SYMTAB	4
+#define	ESHDR_REL	5
+#define	ESHDR_NUM	6
+
+#define	PWRITE_SCN(index, data) \
+	(lseek64(fd, (off64_t)elf_file.shdr[(index)].sh_offset, SEEK_SET) != \
+	(off64_t)elf_file.shdr[(index)].sh_offset || \
+	dt_write(dtp, fd, (data), elf_file.shdr[(index)].sh_size) != \
+	elf_file.shdr[(index)].sh_size)
+
+static const char DTRACE_SHSTRTAB32[] = "\0"
+".shstrtab\0"		/* 1 */
+".SUNW_dof\0"		/* 11 */
+".strtab\0"		/* 21 */
+".symtab\0"		/* 29 */
+#ifdef __sparc
+".rela.SUNW_dof";	/* 37 */
+#else
+".rel.SUNW_dof";	/* 37 */
+#endif
+
+static const char DTRACE_SHSTRTAB64[] = "\0"
+".shstrtab\0"		/* 1 */
+".SUNW_dof\0"		/* 11 */
+".strtab\0"		/* 21 */
+".symtab\0"		/* 29 */
+".rela.SUNW_dof";	/* 37 */
+
+static const char DOFSTR[] = "__SUNW_dof";
+static const char DOFLAZYSTR[] = "___SUNW_dof";
+
+typedef struct dt_link_pair {
+	struct dt_link_pair *dlp_next;	/* next pair in linked list */
+	void *dlp_str;			/* buffer for string table */
+	void *dlp_sym;			/* buffer for symbol table */
+} dt_link_pair_t;
+
+typedef struct dof_elf32 {
+	uint32_t de_nrel;		/* relocation count */
+#ifdef __sparc
+	Elf32_Rela *de_rel;		/* array of relocations for sparc */
+#else
+	Elf32_Rel *de_rel;		/* array of relocations for x86 */
+#endif
+	uint32_t de_nsym;		/* symbol count */
+	Elf32_Sym *de_sym;		/* array of symbols */
+	uint32_t de_strlen;		/* size of of string table */
+	char *de_strtab;		/* string table */
+	uint32_t de_global;		/* index of the first global symbol */
+} dof_elf32_t;
+
+static int
+prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf32_t *dep)
+{
+	dof_sec_t *dofs, *s;
+	dof_relohdr_t *dofrh;
+	dof_relodesc_t *dofr;
+	char *strtab;
+	int i, j, nrel;
+	size_t strtabsz = 1;
+	uint32_t count = 0;
+	size_t base;
+	Elf32_Sym *sym;
+#ifdef __sparc
+	Elf32_Rela *rel;
+#else
+	Elf32_Rel *rel;
+#endif
+
+	/*LINTED*/
+	dofs = (dof_sec_t *)((char *)dof + dof->dofh_secoff);
+
+	/*
+	 * First compute the size of the string table and the number of
+	 * relocations present in the DOF.
+	 */
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		if (dofs[i].dofs_type != DOF_SECT_URELHDR)
+			continue;
+
+		/*LINTED*/
+		dofrh = (dof_relohdr_t *)((char *)dof + dofs[i].dofs_offset);
+
+		s = &dofs[dofrh->dofr_strtab];
+		strtab = (char *)dof + s->dofs_offset;
+		assert(strtab[0] == '\0');
+		strtabsz += s->dofs_size - 1;
+
+		s = &dofs[dofrh->dofr_relsec];
+		/*LINTED*/
+		dofr = (dof_relodesc_t *)((char *)dof + s->dofs_offset);
+		count += s->dofs_size / s->dofs_entsize;
+	}
+
+	dep->de_strlen = strtabsz;
+	dep->de_nrel = count;
+	dep->de_nsym = count + 1; /* the first symbol is always null */
+
+	if (dtp->dt_lazyload) {
+		dep->de_strlen += sizeof (DOFLAZYSTR);
+		dep->de_nsym++;
+	} else {
+		dep->de_strlen += sizeof (DOFSTR);
+		dep->de_nsym++;
+	}
+
+	if ((dep->de_rel = calloc(dep->de_nrel,
+	    sizeof (dep->de_rel[0]))) == NULL) {
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	if ((dep->de_sym = calloc(dep->de_nsym, sizeof (Elf32_Sym))) == NULL) {
+		free(dep->de_rel);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	if ((dep->de_strtab = calloc(dep->de_strlen, 1)) == NULL) {
+		free(dep->de_rel);
+		free(dep->de_sym);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	count = 0;
+	strtabsz = 1;
+	dep->de_strtab[0] = '\0';
+	rel = dep->de_rel;
+	sym = dep->de_sym;
+	dep->de_global = 1;
+
+	/*
+	 * The first symbol table entry must be zeroed and is always ignored.
+	 */
+	bzero(sym, sizeof (Elf32_Sym));
+	sym++;
+
+	/*
+	 * Take a second pass through the DOF sections filling in the
+	 * memory we allocated.
+	 */
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		if (dofs[i].dofs_type != DOF_SECT_URELHDR)
+			continue;
+
+		/*LINTED*/
+		dofrh = (dof_relohdr_t *)((char *)dof + dofs[i].dofs_offset);
+
+		s = &dofs[dofrh->dofr_strtab];
+		strtab = (char *)dof + s->dofs_offset;
+		bcopy(strtab + 1, dep->de_strtab + strtabsz, s->dofs_size);
+		base = strtabsz;
+		strtabsz += s->dofs_size - 1;
+
+		s = &dofs[dofrh->dofr_relsec];
+		/*LINTED*/
+		dofr = (dof_relodesc_t *)((char *)dof + s->dofs_offset);
+		nrel = s->dofs_size / s->dofs_entsize;
+
+		s = &dofs[dofrh->dofr_tgtsec];
+
+		for (j = 0; j < nrel; j++) {
+#if defined(__i386) || defined(__amd64)
+			rel->r_offset = s->dofs_offset +
+			    dofr[j].dofr_offset;
+			rel->r_info = ELF32_R_INFO(count + dep->de_global,
+			    R_386_32);
+#elif defined(__sparc)
+			/*
+			 * Add 4 bytes to hit the low half of this 64-bit
+			 * big-endian address.
+			 */
+			rel->r_offset = s->dofs_offset +
+			    dofr[j].dofr_offset + 4;
+			rel->r_info = ELF32_R_INFO(count + dep->de_global,
+			    R_SPARC_32);
+#else
+#error unknown ISA
+#endif
+
+			sym->st_name = base + dofr[j].dofr_name - 1;
+			sym->st_value = 0;
+			sym->st_size = 0;
+			sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_FUNC);
+			sym->st_other = 0;
+			sym->st_shndx = SHN_UNDEF;
+
+			rel++;
+			sym++;
+			count++;
+		}
+	}
+
+	/*
+	 * Add a symbol for the DOF itself. We use a different symbol for
+	 * lazily and actively loaded DOF to make them easy to distinguish.
+	 */
+	sym->st_name = strtabsz;
+	sym->st_value = 0;
+	sym->st_size = dof->dofh_filesz;
+	sym->st_info = ELF32_ST_INFO(STB_GLOBAL, STT_OBJECT);
+	sym->st_other = 0;
+	sym->st_shndx = ESHDR_DOF;
+	sym++;
+
+	if (dtp->dt_lazyload) {
+		bcopy(DOFLAZYSTR, dep->de_strtab + strtabsz,
+		    sizeof (DOFLAZYSTR));
+		strtabsz += sizeof (DOFLAZYSTR);
+	} else {
+		bcopy(DOFSTR, dep->de_strtab + strtabsz, sizeof (DOFSTR));
+		strtabsz += sizeof (DOFSTR);
+	}
+
+	assert(count == dep->de_nrel);
+	assert(strtabsz == dep->de_strlen);
+
+	return (0);
+}
+
+
+typedef struct dof_elf64 {
+	uint32_t de_nrel;
+	Elf64_Rela *de_rel;
+	uint32_t de_nsym;
+	Elf64_Sym *de_sym;
+
+	uint32_t de_strlen;
+	char *de_strtab;
+
+	uint32_t de_global;
+} dof_elf64_t;
+
+static int
+prepare_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, dof_elf64_t *dep)
+{
+	dof_sec_t *dofs, *s;
+	dof_relohdr_t *dofrh;
+	dof_relodesc_t *dofr;
+	char *strtab;
+	int i, j, nrel;
+	size_t strtabsz = 1;
+	uint32_t count = 0;
+	size_t base;
+	Elf64_Sym *sym;
+	Elf64_Rela *rel;
+
+	/*LINTED*/
+	dofs = (dof_sec_t *)((char *)dof + dof->dofh_secoff);
+
+	/*
+	 * First compute the size of the string table and the number of
+	 * relocations present in the DOF.
+	 */
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		if (dofs[i].dofs_type != DOF_SECT_URELHDR)
+			continue;
+
+		/*LINTED*/
+		dofrh = (dof_relohdr_t *)((char *)dof + dofs[i].dofs_offset);
+
+		s = &dofs[dofrh->dofr_strtab];
+		strtab = (char *)dof + s->dofs_offset;
+		assert(strtab[0] == '\0');
+		strtabsz += s->dofs_size - 1;
+
+		s = &dofs[dofrh->dofr_relsec];
+		/*LINTED*/
+		dofr = (dof_relodesc_t *)((char *)dof + s->dofs_offset);
+		count += s->dofs_size / s->dofs_entsize;
+	}
+
+	dep->de_strlen = strtabsz;
+	dep->de_nrel = count;
+	dep->de_nsym = count + 1; /* the first symbol is always null */
+
+	if (dtp->dt_lazyload) {
+		dep->de_strlen += sizeof (DOFLAZYSTR);
+		dep->de_nsym++;
+	} else {
+		dep->de_strlen += sizeof (DOFSTR);
+		dep->de_nsym++;
+	}
+
+	if ((dep->de_rel = calloc(dep->de_nrel,
+	    sizeof (dep->de_rel[0]))) == NULL) {
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	if ((dep->de_sym = calloc(dep->de_nsym, sizeof (Elf64_Sym))) == NULL) {
+		free(dep->de_rel);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	if ((dep->de_strtab = calloc(dep->de_strlen, 1)) == NULL) {
+		free(dep->de_rel);
+		free(dep->de_sym);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	count = 0;
+	strtabsz = 1;
+	dep->de_strtab[0] = '\0';
+	rel = dep->de_rel;
+	sym = dep->de_sym;
+	dep->de_global = 1;
+
+	/*
+	 * The first symbol table entry must be zeroed and is always ignored.
+	 */
+	bzero(sym, sizeof (Elf64_Sym));
+	sym++;
+
+	/*
+	 * Take a second pass through the DOF sections filling in the
+	 * memory we allocated.
+	 */
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		if (dofs[i].dofs_type != DOF_SECT_URELHDR)
+			continue;
+
+		/*LINTED*/
+		dofrh = (dof_relohdr_t *)((char *)dof + dofs[i].dofs_offset);
+
+		s = &dofs[dofrh->dofr_strtab];
+		strtab = (char *)dof + s->dofs_offset;
+		bcopy(strtab + 1, dep->de_strtab + strtabsz, s->dofs_size);
+		base = strtabsz;
+		strtabsz += s->dofs_size - 1;
+
+		s = &dofs[dofrh->dofr_relsec];
+		/*LINTED*/
+		dofr = (dof_relodesc_t *)((char *)dof + s->dofs_offset);
+		nrel = s->dofs_size / s->dofs_entsize;
+
+		s = &dofs[dofrh->dofr_tgtsec];
+
+		for (j = 0; j < nrel; j++) {
+#if defined(__i386) || defined(__amd64)
+			rel->r_offset = s->dofs_offset +
+			    dofr[j].dofr_offset;
+			rel->r_info = ELF64_R_INFO(count + dep->de_global,
+			    R_AMD64_64);
+#elif defined(__sparc)
+			rel->r_offset = s->dofs_offset +
+			    dofr[j].dofr_offset;
+			rel->r_info = ELF64_R_INFO(count + dep->de_global,
+			    R_SPARC_64);
+#else
+#error unknown ISA
+#endif
+
+			sym->st_name = base + dofr[j].dofr_name - 1;
+			sym->st_value = 0;
+			sym->st_size = 0;
+			sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_FUNC);
+			sym->st_other = 0;
+			sym->st_shndx = SHN_UNDEF;
+
+			rel++;
+			sym++;
+			count++;
+		}
+	}
+
+	/*
+	 * Add a symbol for the DOF itself. We use a different symbol for
+	 * lazily and actively loaded DOF to make them easy to distinguish.
+	 */
+	sym->st_name = strtabsz;
+	sym->st_value = 0;
+	sym->st_size = dof->dofh_filesz;
+	sym->st_info = GELF_ST_INFO(STB_GLOBAL, STT_OBJECT);
+	sym->st_other = 0;
+	sym->st_shndx = ESHDR_DOF;
+	sym++;
+
+	if (dtp->dt_lazyload) {
+		bcopy(DOFLAZYSTR, dep->de_strtab + strtabsz,
+		    sizeof (DOFLAZYSTR));
+		strtabsz += sizeof (DOFLAZYSTR);
+	} else {
+		bcopy(DOFSTR, dep->de_strtab + strtabsz, sizeof (DOFSTR));
+		strtabsz += sizeof (DOFSTR);
+	}
+
+	assert(count == dep->de_nrel);
+	assert(strtabsz == dep->de_strlen);
+
+	return (0);
+}
+
+/*
+ * Write out an ELF32 file prologue consisting of a header, section headers,
+ * and a section header string table.  The DOF data will follow this prologue
+ * and complete the contents of the given ELF file.
+ */
+static int
+dump_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
+{
+	struct {
+		Elf32_Ehdr ehdr;
+		Elf32_Shdr shdr[ESHDR_NUM];
+	} elf_file;
+
+	Elf32_Shdr *shp;
+	Elf32_Off off;
+	dof_elf32_t de;
+	int ret = 0;
+	uint_t nshdr;
+
+	if (prepare_elf32(dtp, dof, &de) != 0)
+		return (-1); /* errno is set for us */
+
+	/*
+	 * If there are no relocations, we only need enough sections for
+	 * the shstrtab and the DOF.
+	 */
+	nshdr = de.de_nrel == 0 ? ESHDR_SYMTAB + 1 : ESHDR_NUM;
+
+	bzero(&elf_file, sizeof (elf_file));
+
+	elf_file.ehdr.e_ident[EI_MAG0] = ELFMAG0;
+	elf_file.ehdr.e_ident[EI_MAG1] = ELFMAG1;
+	elf_file.ehdr.e_ident[EI_MAG2] = ELFMAG2;
+	elf_file.ehdr.e_ident[EI_MAG3] = ELFMAG3;
+	elf_file.ehdr.e_ident[EI_VERSION] = EV_CURRENT;
+	elf_file.ehdr.e_ident[EI_CLASS] = ELFCLASS32;
+#if defined(_BIG_ENDIAN)
+	elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2MSB;
+#elif defined(_LITTLE_ENDIAN)
+	elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB;
+#endif
+	elf_file.ehdr.e_type = ET_REL;
+#if defined(__sparc)
+	elf_file.ehdr.e_machine = EM_SPARC;
+#elif defined(__i386) || defined(__amd64)
+	elf_file.ehdr.e_machine = EM_386;
+#endif
+	elf_file.ehdr.e_version = EV_CURRENT;
+	elf_file.ehdr.e_shoff = sizeof (Elf32_Ehdr);
+	elf_file.ehdr.e_ehsize = sizeof (Elf32_Ehdr);
+	elf_file.ehdr.e_phentsize = sizeof (Elf32_Phdr);
+	elf_file.ehdr.e_shentsize = sizeof (Elf32_Shdr);
+	elf_file.ehdr.e_shnum = nshdr;
+	elf_file.ehdr.e_shstrndx = ESHDR_SHSTRTAB;
+	off = sizeof (elf_file) + nshdr * sizeof (Elf32_Shdr);
+
+	shp = &elf_file.shdr[ESHDR_SHSTRTAB];
+	shp->sh_name = 1; /* DTRACE_SHSTRTAB32[1] = ".shstrtab" */
+	shp->sh_type = SHT_STRTAB;
+	shp->sh_offset = off;
+	shp->sh_size = sizeof (DTRACE_SHSTRTAB32);
+	shp->sh_addralign = sizeof (char);
+	off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 8);
+
+	shp = &elf_file.shdr[ESHDR_DOF];
+	shp->sh_name = 11; /* DTRACE_SHSTRTAB32[11] = ".SUNW_dof" */
+	shp->sh_flags = SHF_ALLOC;
+	shp->sh_type = SHT_SUNW_dof;
+	shp->sh_offset = off;
+	shp->sh_size = dof->dofh_filesz;
+	shp->sh_addralign = 8;
+	off = shp->sh_offset + shp->sh_size;
+
+	shp = &elf_file.shdr[ESHDR_STRTAB];
+	shp->sh_name = 21; /* DTRACE_SHSTRTAB32[21] = ".strtab" */
+	shp->sh_flags = SHF_ALLOC;
+	shp->sh_type = SHT_STRTAB;
+	shp->sh_offset = off;
+	shp->sh_size = de.de_strlen;
+	shp->sh_addralign = sizeof (char);
+	off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 4);
+
+	shp = &elf_file.shdr[ESHDR_SYMTAB];
+	shp->sh_name = 29; /* DTRACE_SHSTRTAB32[29] = ".symtab" */
+	shp->sh_flags = SHF_ALLOC;
+	shp->sh_type = SHT_SYMTAB;
+	shp->sh_entsize = sizeof (Elf32_Sym);
+	shp->sh_link = ESHDR_STRTAB;
+	shp->sh_offset = off;
+	shp->sh_info = de.de_global;
+	shp->sh_size = de.de_nsym * sizeof (Elf32_Sym);
+	shp->sh_addralign = 4;
+	off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 4);
+
+	if (de.de_nrel == 0) {
+		if (dt_write(dtp, fd, &elf_file,
+		    sizeof (elf_file)) != sizeof (elf_file) ||
+		    PWRITE_SCN(ESHDR_SHSTRTAB, DTRACE_SHSTRTAB32) ||
+		    PWRITE_SCN(ESHDR_STRTAB, de.de_strtab) ||
+		    PWRITE_SCN(ESHDR_SYMTAB, de.de_sym) ||
+		    PWRITE_SCN(ESHDR_DOF, dof)) {
+			ret = dt_set_errno(dtp, errno);
+		}
+	} else {
+		shp = &elf_file.shdr[ESHDR_REL];
+		shp->sh_name = 37; /* DTRACE_SHSTRTAB32[37] = ".rel.SUNW_dof" */
+		shp->sh_flags = SHF_ALLOC;
+#ifdef __sparc
+		shp->sh_type = SHT_RELA;
+#else
+		shp->sh_type = SHT_REL;
+#endif
+		shp->sh_entsize = sizeof (de.de_rel[0]);
+		shp->sh_link = ESHDR_SYMTAB;
+		shp->sh_info = ESHDR_DOF;
+		shp->sh_offset = off;
+		shp->sh_size = de.de_nrel * sizeof (de.de_rel[0]);
+		shp->sh_addralign = 4;
+
+		if (dt_write(dtp, fd, &elf_file,
+		    sizeof (elf_file)) != sizeof (elf_file) ||
+		    PWRITE_SCN(ESHDR_SHSTRTAB, DTRACE_SHSTRTAB32) ||
+		    PWRITE_SCN(ESHDR_STRTAB, de.de_strtab) ||
+		    PWRITE_SCN(ESHDR_SYMTAB, de.de_sym) ||
+		    PWRITE_SCN(ESHDR_REL, de.de_rel) ||
+		    PWRITE_SCN(ESHDR_DOF, dof)) {
+			ret = dt_set_errno(dtp, errno);
+		}
+	}
+
+	free(de.de_strtab);
+	free(de.de_sym);
+	free(de.de_rel);
+
+	return (ret);
+}
+
+/*
+ * Write out an ELF64 file prologue consisting of a header, section headers,
+ * and a section header string table.  The DOF data will follow this prologue
+ * and complete the contents of the given ELF file.
+ */
+static int
+dump_elf64(dtrace_hdl_t *dtp, const dof_hdr_t *dof, int fd)
+{
+	struct {
+		Elf64_Ehdr ehdr;
+		Elf64_Shdr shdr[ESHDR_NUM];
+	} elf_file;
+
+	Elf64_Shdr *shp;
+	Elf64_Off off;
+	dof_elf64_t de;
+	int ret = 0;
+	uint_t nshdr;
+
+	if (prepare_elf64(dtp, dof, &de) != 0)
+		return (-1); /* errno is set for us */
+
+	/*
+	 * If there are no relocations, we only need enough sections for
+	 * the shstrtab and the DOF.
+	 */
+	nshdr = de.de_nrel == 0 ? ESHDR_SYMTAB + 1 : ESHDR_NUM;
+
+	bzero(&elf_file, sizeof (elf_file));
+
+	elf_file.ehdr.e_ident[EI_MAG0] = ELFMAG0;
+	elf_file.ehdr.e_ident[EI_MAG1] = ELFMAG1;
+	elf_file.ehdr.e_ident[EI_MAG2] = ELFMAG2;
+	elf_file.ehdr.e_ident[EI_MAG3] = ELFMAG3;
+	elf_file.ehdr.e_ident[EI_VERSION] = EV_CURRENT;
+	elf_file.ehdr.e_ident[EI_CLASS] = ELFCLASS64;
+#if defined(_BIG_ENDIAN)
+	elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2MSB;
+#elif defined(_LITTLE_ENDIAN)
+	elf_file.ehdr.e_ident[EI_DATA] = ELFDATA2LSB;
+#endif
+	elf_file.ehdr.e_type = ET_REL;
+#if defined(__sparc)
+	elf_file.ehdr.e_machine = EM_SPARCV9;
+#elif defined(__i386) || defined(__amd64)
+	elf_file.ehdr.e_machine = EM_AMD64;
+#endif
+	elf_file.ehdr.e_version = EV_CURRENT;
+	elf_file.ehdr.e_shoff = sizeof (Elf64_Ehdr);
+	elf_file.ehdr.e_ehsize = sizeof (Elf64_Ehdr);
+	elf_file.ehdr.e_phentsize = sizeof (Elf64_Phdr);
+	elf_file.ehdr.e_shentsize = sizeof (Elf64_Shdr);
+	elf_file.ehdr.e_shnum = nshdr;
+	elf_file.ehdr.e_shstrndx = ESHDR_SHSTRTAB;
+	off = sizeof (elf_file) + nshdr * sizeof (Elf64_Shdr);
+
+	shp = &elf_file.shdr[ESHDR_SHSTRTAB];
+	shp->sh_name = 1; /* DTRACE_SHSTRTAB64[1] = ".shstrtab" */
+	shp->sh_type = SHT_STRTAB;
+	shp->sh_offset = off;
+	shp->sh_size = sizeof (DTRACE_SHSTRTAB64);
+	shp->sh_addralign = sizeof (char);
+	off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 8);
+
+	shp = &elf_file.shdr[ESHDR_DOF];
+	shp->sh_name = 11; /* DTRACE_SHSTRTAB64[11] = ".SUNW_dof" */
+	shp->sh_flags = SHF_ALLOC;
+	shp->sh_type = SHT_SUNW_dof;
+	shp->sh_offset = off;
+	shp->sh_size = dof->dofh_filesz;
+	shp->sh_addralign = 8;
+	off = shp->sh_offset + shp->sh_size;
+
+	shp = &elf_file.shdr[ESHDR_STRTAB];
+	shp->sh_name = 21; /* DTRACE_SHSTRTAB64[21] = ".strtab" */
+	shp->sh_flags = SHF_ALLOC;
+	shp->sh_type = SHT_STRTAB;
+	shp->sh_offset = off;
+	shp->sh_size = de.de_strlen;
+	shp->sh_addralign = sizeof (char);
+	off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 8);
+
+	shp = &elf_file.shdr[ESHDR_SYMTAB];
+	shp->sh_name = 29; /* DTRACE_SHSTRTAB64[29] = ".symtab" */
+	shp->sh_flags = SHF_ALLOC;
+	shp->sh_type = SHT_SYMTAB;
+	shp->sh_entsize = sizeof (Elf64_Sym);
+	shp->sh_link = ESHDR_STRTAB;
+	shp->sh_offset = off;
+	shp->sh_info = de.de_global;
+	shp->sh_size = de.de_nsym * sizeof (Elf64_Sym);
+	shp->sh_addralign = 8;
+	off = P2ROUNDUP(shp->sh_offset + shp->sh_size, 8);
+
+	if (de.de_nrel == 0) {
+		if (dt_write(dtp, fd, &elf_file,
+		    sizeof (elf_file)) != sizeof (elf_file) ||
+		    PWRITE_SCN(ESHDR_SHSTRTAB, DTRACE_SHSTRTAB64) ||
+		    PWRITE_SCN(ESHDR_STRTAB, de.de_strtab) ||
+		    PWRITE_SCN(ESHDR_SYMTAB, de.de_sym) ||
+		    PWRITE_SCN(ESHDR_DOF, dof)) {
+			ret = dt_set_errno(dtp, errno);
+		}
+	} else {
+		shp = &elf_file.shdr[ESHDR_REL];
+		shp->sh_name = 37; /* DTRACE_SHSTRTAB64[37] = ".rel.SUNW_dof" */
+		shp->sh_flags = SHF_ALLOC;
+		shp->sh_type = SHT_RELA;
+		shp->sh_entsize = sizeof (de.de_rel[0]);
+		shp->sh_link = ESHDR_SYMTAB;
+		shp->sh_info = ESHDR_DOF;
+		shp->sh_offset = off;
+		shp->sh_size = de.de_nrel * sizeof (de.de_rel[0]);
+		shp->sh_addralign = 8;
+
+		if (dt_write(dtp, fd, &elf_file,
+		    sizeof (elf_file)) != sizeof (elf_file) ||
+		    PWRITE_SCN(ESHDR_SHSTRTAB, DTRACE_SHSTRTAB64) ||
+		    PWRITE_SCN(ESHDR_STRTAB, de.de_strtab) ||
+		    PWRITE_SCN(ESHDR_SYMTAB, de.de_sym) ||
+		    PWRITE_SCN(ESHDR_REL, de.de_rel) ||
+		    PWRITE_SCN(ESHDR_DOF, dof)) {
+			ret = dt_set_errno(dtp, errno);
+		}
+	}
+
+	free(de.de_strtab);
+	free(de.de_sym);
+	free(de.de_rel);
+
+	return (ret);
+}
+
+static int
+dt_symtab_lookup(Elf_Data *data_sym, int nsym, uintptr_t addr, uint_t shn,
+    GElf_Sym *sym)
+{
+	int i, ret = -1;
+	GElf_Sym s;
+
+	for (i = 0; i < nsym && gelf_getsym(data_sym, i, sym) != NULL; i++) {
+		if (GELF_ST_TYPE(sym->st_info) == STT_FUNC &&
+		    shn == sym->st_shndx &&
+		    sym->st_value <= addr &&
+		    addr < sym->st_value + sym->st_size) {
+			if (GELF_ST_BIND(sym->st_info) == STB_GLOBAL)
+				return (0);
+
+			ret = 0;
+			s = *sym;
+		}
+	}
+
+	if (ret == 0)
+		*sym = s;
+	return (ret);
+}
+
+#if defined(__sparc)
+
+#define	DT_OP_RET		0x81c7e008
+#define	DT_OP_NOP		0x01000000
+#define	DT_OP_CALL		0x40000000
+#define	DT_OP_CLR_O0		0x90102000
+
+#define	DT_IS_MOV_O7(inst)	(((inst) & 0xffffe000) == 0x9e100000)
+#define	DT_IS_RESTORE(inst)	(((inst) & 0xc1f80000) == 0x81e80000)
+#define	DT_IS_RETL(inst)	(((inst) & 0xfff83fff) == 0x81c02008)
+
+#define	DT_RS2(inst)		((inst) & 0x1f)
+#define	DT_MAKE_RETL(reg)	(0x81c02008 | ((reg) << 14))
+
+/*ARGSUSED*/
+static int
+dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
+    uint32_t *off)
+{
+	uint32_t *ip;
+
+	if ((rela->r_offset & (sizeof (uint32_t) - 1)) != 0)
+		return (-1);
+
+	/*LINTED*/
+	ip = (uint32_t *)(p + rela->r_offset);
+
+	/*
+	 * We only know about some specific relocation types.
+	 */
+	if (GELF_R_TYPE(rela->r_info) != R_SPARC_WDISP30 &&
+	    GELF_R_TYPE(rela->r_info) != R_SPARC_WPLT30)
+		return (-1);
+
+	/*
+	 * We may have already processed this object file in an earlier linker
+	 * invocation. Check to see if the present instruction sequence matches
+	 * the one we would install below.
+	 */
+	if (isenabled) {
+		if (ip[0] == DT_OP_NOP) {
+			(*off) += sizeof (ip[0]);
+			return (0);
+		}
+	} else {
+		if (DT_IS_RESTORE(ip[1])) {
+			if (ip[0] == DT_OP_RET) {
+				(*off) += sizeof (ip[0]);
+				return (0);
+			}
+		} else if (DT_IS_MOV_O7(ip[1])) {
+			if (DT_IS_RETL(ip[0]))
+				return (0);
+		} else {
+			if (ip[0] == DT_OP_NOP) {
+				(*off) += sizeof (ip[0]);
+				return (0);
+			}
+		}
+	}
+
+	/*
+	 * We only expect call instructions with a displacement of 0.
+	 */
+	if (ip[0] != DT_OP_CALL) {
+		dt_dprintf("found %x instead of a call instruction at %llx\n",
+		    ip[0], (u_longlong_t)rela->r_offset);
+		return (-1);
+	}
+
+	if (isenabled) {
+		/*
+		 * It would necessarily indicate incorrect usage if an is-
+		 * enabled probe were tail-called so flag that as an error.
+		 * It's also potentially (very) tricky to handle gracefully,
+		 * but could be done if this were a desired use scenario.
+		 */
+		if (DT_IS_RESTORE(ip[1]) || DT_IS_MOV_O7(ip[1])) {
+			dt_dprintf("tail call to is-enabled probe at %llx\n",
+			    (u_longlong_t)rela->r_offset);
+			return (-1);
+		}
+
+
+		/*
+		 * On SPARC, we take advantage of the fact that the first
+		 * argument shares the same register as for the return value.
+		 * The macro handles the work of zeroing that register so we
+		 * don't need to do anything special here. We instrument the
+		 * instruction in the delay slot as we'll need to modify the
+		 * return register after that instruction has been emulated.
+		 */
+		ip[0] = DT_OP_NOP;
+		(*off) += sizeof (ip[0]);
+	} else {
+		/*
+		 * If the call is followed by a restore, it's a tail call so
+		 * change the call to a ret. If the call if followed by a mov
+		 * of a register into %o7, it's a tail call in leaf context
+		 * so change the call to a retl-like instruction that returns
+		 * to that register value + 8 (rather than the typical %o7 +
+		 * 8); the delay slot instruction is left, but should have no
+		 * effect. Otherwise we change the call to be a nop. We
+		 * identify the subsequent instruction as the probe point in
+		 * all but the leaf tail-call case to ensure that arguments to
+		 * the probe are complete and consistent. An astute, though
+		 * largely hypothetical, observer would note that there is the
+		 * possibility of a false-positive probe firing if the function
+		 * contained a branch to the instruction in the delay slot of
+		 * the call. Fixing this would require significant in-kernel
+		 * modifications, and isn't worth doing until we see it in the
+		 * wild.
+		 */
+		if (DT_IS_RESTORE(ip[1])) {
+			ip[0] = DT_OP_RET;
+			(*off) += sizeof (ip[0]);
+		} else if (DT_IS_MOV_O7(ip[1])) {
+			ip[0] = DT_MAKE_RETL(DT_RS2(ip[1]));
+		} else {
+			ip[0] = DT_OP_NOP;
+			(*off) += sizeof (ip[0]);
+		}
+	}
+
+	return (0);
+}
+
+#elif defined(__i386) || defined(__amd64)
+
+#define	DT_OP_NOP		0x90
+#define	DT_OP_RET		0xc3
+#define	DT_OP_CALL		0xe8
+#define	DT_OP_JMP32		0xe9
+#define	DT_OP_REX_RAX		0x48
+#define	DT_OP_XOR_EAX_0		0x33
+#define	DT_OP_XOR_EAX_1		0xc0
+
+static int
+dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela,
+    uint32_t *off)
+{
+	uint8_t *ip = (uint8_t *)(p + rela->r_offset - 1);
+	uint8_t ret;
+
+	/*
+	 * On x86, the first byte of the instruction is the call opcode and
+	 * the next four bytes are the 32-bit address; the relocation is for
+	 * the address operand. We back up the offset to the first byte of
+	 * the instruction. For is-enabled probes, we later advance the offset
+	 * so that it hits the first nop in the instruction sequence.
+	 */
+	(*off) -= 1;
+
+	/*
+	 * We only know about some specific relocation types. Luckily
+	 * these types have the same values on both 32-bit and 64-bit
+	 * x86 architectures.
+	 */
+	if (GELF_R_TYPE(rela->r_info) != R_386_PC32 &&
+	    GELF_R_TYPE(rela->r_info) != R_386_PLT32)
+		return (-1);
+
+	/*
+	 * We may have already processed this object file in an earlier linker
+	 * invocation. Check to see if the present instruction sequence matches
+	 * the one we would install. For is-enabled probes, we advance the
+	 * offset to the first nop instruction in the sequence to match the
+	 * text modification code below.
+	 */
+	if (!isenabled) {
+		if ((ip[0] == DT_OP_NOP || ip[0] == DT_OP_RET) &&
+		    ip[1] == DT_OP_NOP && ip[2] == DT_OP_NOP &&
+		    ip[3] == DT_OP_NOP && ip[4] == DT_OP_NOP)
+			return (0);
+	} else if (dtp->dt_oflags & DTRACE_O_LP64) {
+		if (ip[0] == DT_OP_REX_RAX &&
+		    ip[1] == DT_OP_XOR_EAX_0 && ip[2] == DT_OP_XOR_EAX_1 &&
+		    (ip[3] == DT_OP_NOP || ip[3] == DT_OP_RET) &&
+		    ip[4] == DT_OP_NOP) {
+			(*off) += 3;
+			return (0);
+		}
+	} else {
+		if (ip[0] == DT_OP_XOR_EAX_0 && ip[1] == DT_OP_XOR_EAX_1 &&
+		    (ip[2] == DT_OP_NOP || ip[2] == DT_OP_RET) &&
+		    ip[3] == DT_OP_NOP && ip[4] == DT_OP_NOP) {
+			(*off) += 2;
+			return (0);
+		}
+	}
+
+	/*
+	 * We expect either a call instrution with a 32-bit displacement or a
+	 * jmp instruction with a 32-bit displacement acting as a tail-call.
+	 */
+	if (ip[0] != DT_OP_CALL && ip[0] != DT_OP_JMP32) {
+		dt_dprintf("found %x instead of a call or jmp instruction at "
+		    "%llx\n", ip[0], (u_longlong_t)rela->r_offset);
+		return (-1);
+	}
+
+	ret = (ip[0] == DT_OP_JMP32) ? DT_OP_RET : DT_OP_NOP;
+
+	/*
+	 * Establish the instruction sequence -- all nops for probes, and an
+	 * instruction to clear the return value register (%eax/%rax) followed
+	 * by nops for is-enabled probes. For is-enabled probes, we advance
+	 * the offset to the first nop. This isn't stricly necessary but makes
+	 * for more readable disassembly when the probe is enabled.
+	 */
+	if (!isenabled) {
+		ip[0] = ret;
+		ip[1] = DT_OP_NOP;
+		ip[2] = DT_OP_NOP;
+		ip[3] = DT_OP_NOP;
+		ip[4] = DT_OP_NOP;
+	} else if (dtp->dt_oflags & DTRACE_O_LP64) {
+		ip[0] = DT_OP_REX_RAX;
+		ip[1] = DT_OP_XOR_EAX_0;
+		ip[2] = DT_OP_XOR_EAX_1;
+		ip[3] = ret;
+		ip[4] = DT_OP_NOP;
+		(*off) += 3;
+	} else {
+		ip[0] = DT_OP_XOR_EAX_0;
+		ip[1] = DT_OP_XOR_EAX_1;
+		ip[2] = ret;
+		ip[3] = DT_OP_NOP;
+		ip[4] = DT_OP_NOP;
+		(*off) += 2;
+	}
+
+	return (0);
+}
+
+#else
+#error unknown ISA
+#endif
+
+/*PRINTFLIKE5*/
+static int
+dt_link_error(dtrace_hdl_t *dtp, Elf *elf, int fd, dt_link_pair_t *bufs,
+    const char *format, ...)
+{
+	va_list ap;
+	dt_link_pair_t *pair;
+
+	va_start(ap, format);
+	dt_set_errmsg(dtp, NULL, NULL, NULL, 0, format, ap);
+	va_end(ap);
+
+	if (elf != NULL)
+		(void) elf_end(elf);
+
+	if (fd >= 0)
+		(void) close(fd);
+
+	while ((pair = bufs) != NULL) {
+		bufs = pair->dlp_next;
+		dt_free(dtp, pair->dlp_str);
+		dt_free(dtp, pair->dlp_sym);
+		dt_free(dtp, pair);
+	}
+
+	return (dt_set_errno(dtp, EDT_COMPILER));
+}
+
+static int
+process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
+{
+	static const char dt_prefix[] = "__dtrace";
+	static const char dt_enabled[] = "enabled";
+	static const char dt_symprefix[] = "$dtrace";
+	static const char dt_symfmt[] = "%s%d.%s";
+	int fd, i, ndx, eprobe, mod = 0;
+	Elf *elf = NULL;
+	GElf_Ehdr ehdr;
+	Elf_Scn *scn_rel, *scn_sym, *scn_str, *scn_tgt;
+	Elf_Data *data_rel, *data_sym, *data_str, *data_tgt;
+	GElf_Shdr shdr_rel, shdr_sym, shdr_str, shdr_tgt;
+	GElf_Sym rsym, fsym, dsym;
+	GElf_Rela rela;
+	char *s, *p, *r;
+	char pname[DTRACE_PROVNAMELEN];
+	dt_provider_t *pvp;
+	dt_probe_t *prp;
+	uint32_t off, eclass, emachine1, emachine2;
+	size_t symsize, nsym, isym, istr, len;
+	key_t objkey;
+	dt_link_pair_t *pair, *bufs = NULL;
+	dt_strtab_t *strtab;
+
+	if ((fd = open64(obj, O_RDWR)) == -1) {
+		return (dt_link_error(dtp, elf, fd, bufs,
+		    "failed to open %s: %s", obj, strerror(errno)));
+	}
+
+	if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
+		return (dt_link_error(dtp, elf, fd, bufs,
+		    "failed to process %s: %s", obj, elf_errmsg(elf_errno())));
+	}
+
+	switch (elf_kind(elf)) {
+	case ELF_K_ELF:
+		break;
+	case ELF_K_AR:
+		return (dt_link_error(dtp, elf, fd, bufs, "archives are not "
+		    "permitted; use the contents of the archive instead: %s",
+		    obj));
+	default:
+		return (dt_link_error(dtp, elf, fd, bufs,
+		    "invalid file type: %s", obj));
+	}
+
+	if (gelf_getehdr(elf, &ehdr) == NULL) {
+		return (dt_link_error(dtp, elf, fd, bufs, "corrupt file: %s",
+		    obj));
+	}
+
+	if (dtp->dt_oflags & DTRACE_O_LP64) {
+		eclass = ELFCLASS64;
+#if defined(__sparc)
+		emachine1 = emachine2 = EM_SPARCV9;
+#elif defined(__i386) || defined(__amd64)
+		emachine1 = emachine2 = EM_AMD64;
+#endif
+		symsize = sizeof (Elf64_Sym);
+	} else {
+		eclass = ELFCLASS32;
+#if defined(__sparc)
+		emachine1 = EM_SPARC;
+		emachine2 = EM_SPARC32PLUS;
+#elif defined(__i386) || defined(__amd64)
+		emachine1 = emachine2 = EM_386;
+#endif
+		symsize = sizeof (Elf32_Sym);
+	}
+
+	if (ehdr.e_ident[EI_CLASS] != eclass) {
+		return (dt_link_error(dtp, elf, fd, bufs,
+		    "incorrect ELF class for object file: %s", obj));
+	}
+
+	if (ehdr.e_machine != emachine1 && ehdr.e_machine != emachine2) {
+		return (dt_link_error(dtp, elf, fd, bufs,
+		    "incorrect ELF machine type for object file: %s", obj));
+	}
+
+	/*
+	 * We use this token as a relatively unique handle for this file on the
+	 * system in order to disambiguate potential conflicts between files of
+	 * the same name which contain identially named local symbols.
+	 */
+	if ((objkey = ftok(obj, 0)) == (key_t)-1) {
+		return (dt_link_error(dtp, elf, fd, bufs,
+		    "failed to generate unique key for object file: %s", obj));
+	}
+
+	scn_rel = NULL;
+	while ((scn_rel = elf_nextscn(elf, scn_rel)) != NULL) {
+		if (gelf_getshdr(scn_rel, &shdr_rel) == NULL)
+			goto err;
+
+		/*
+		 * Skip any non-relocation sections.
+		 */
+		if (shdr_rel.sh_type != SHT_RELA && shdr_rel.sh_type != SHT_REL)
+			continue;
+
+		if ((data_rel = elf_getdata(scn_rel, NULL)) == NULL)
+			goto err;
+
+		/*
+		 * Grab the section, section header and section data for the
+		 * symbol table that this relocation section references.
+		 */
+		if ((scn_sym = elf_getscn(elf, shdr_rel.sh_link)) == NULL ||
+		    gelf_getshdr(scn_sym, &shdr_sym) == NULL ||
+		    (data_sym = elf_getdata(scn_sym, NULL)) == NULL)
+			goto err;
+
+		/*
+		 * Ditto for that symbol table's string table.
+		 */
+		if ((scn_str = elf_getscn(elf, shdr_sym.sh_link)) == NULL ||
+		    gelf_getshdr(scn_str, &shdr_str) == NULL ||
+		    (data_str = elf_getdata(scn_str, NULL)) == NULL)
+			goto err;
+
+		/*
+		 * Grab the section, section header and section data for the
+		 * target section for the relocations. For the relocations
+		 * we're looking for -- this will typically be the text of the
+		 * object file.
+		 */
+		if ((scn_tgt = elf_getscn(elf, shdr_rel.sh_info)) == NULL ||
+		    gelf_getshdr(scn_tgt, &shdr_tgt) == NULL ||
+		    (data_tgt = elf_getdata(scn_tgt, NULL)) == NULL)
+			goto err;
+
+		/*
+		 * We're looking for relocations to symbols matching this form:
+		 *
+		 *   __dtrace[enabled]_<prov>___<probe>
+		 *
+		 * For the generated object, we need to record the location
+		 * identified by the relocation, and create a new relocation
+		 * in the generated object that will be resolved at link time
+		 * to the location of the function in which the probe is
+		 * embedded. In the target object, we change the matched symbol
+		 * so that it will be ignored at link time, and we modify the
+		 * target (text) section to replace the call instruction with
+		 * one or more nops.
+		 *
+		 * If the function containing the probe is locally scoped
+		 * (static), we create an alias used by the relocation in the
+		 * generated object. The alias, a new symbol, will be global
+		 * (so that the relocation from the generated object can be
+		 * resolved), and hidden (so that it is converted to a local
+		 * symbol at link time). Such aliases have this form:
+		 *
+		 *   $dtrace<key>.<function>
+		 *
+		 * We take a first pass through all the relocations to
+		 * populate our string table and count the number of extra
+		 * symbols we'll require.
+		 */
+		strtab = dt_strtab_create(1);
+		nsym = 0;
+		isym = data_sym->d_size / symsize;
+		istr = data_str->d_size;
+
+		for (i = 0; i < shdr_rel.sh_size / shdr_rel.sh_entsize; i++) {
+
+			if (shdr_rel.sh_type == SHT_RELA) {
+				if (gelf_getrela(data_rel, i, &rela) == NULL)
+					continue;
+			} else {
+				GElf_Rel rel;
+				if (gelf_getrel(data_rel, i, &rel) == NULL)
+					continue;
+				rela.r_offset = rel.r_offset;
+				rela.r_info = rel.r_info;
+				rela.r_addend = 0;
+			}
+
+			if (gelf_getsym(data_sym, GELF_R_SYM(rela.r_info),
+			    &rsym) == NULL) {
+				dt_strtab_destroy(strtab);
+				goto err;
+			}
+
+			s = (char *)data_str->d_buf + rsym.st_name;
+
+			if (strncmp(s, dt_prefix, sizeof (dt_prefix) - 1) != 0)
+				continue;
+
+			if (dt_symtab_lookup(data_sym, isym, rela.r_offset,
+			    shdr_rel.sh_info, &fsym) != 0) {
+				dt_strtab_destroy(strtab);
+				goto err;
+			}
+
+			if (GELF_ST_BIND(fsym.st_info) != STB_LOCAL)
+				continue;
+
+			if (fsym.st_name > data_str->d_size) {
+				dt_strtab_destroy(strtab);
+				goto err;
+			}
+
+			s = (char *)data_str->d_buf + fsym.st_name;
+
+			/*
+			 * If this symbol isn't of type function, we've really
+			 * driven off the rails or the object file is corrupt.
+			 */
+			if (GELF_ST_TYPE(fsym.st_info) != STT_FUNC) {
+				dt_strtab_destroy(strtab);
+				return (dt_link_error(dtp, elf, fd, bufs,
+				    "expected %s to be of type function", s));
+			}
+
+			len = snprintf(NULL, 0, dt_symfmt, dt_symprefix,
+			    objkey, s) + 1;
+			if ((p = dt_alloc(dtp, len)) == NULL) {
+				dt_strtab_destroy(strtab);
+				goto err;
+			}
+			(void) snprintf(p, len, dt_symfmt, dt_symprefix,
+			    objkey, s);
+
+			if (dt_strtab_index(strtab, p) == -1) {
+				nsym++;
+				(void) dt_strtab_insert(strtab, p);
+			}
+
+			dt_free(dtp, p);
+		}
+
+		/*
+		 * If needed, allocate the additional space for the symbol
+		 * table and string table copying the old data into the new
+		 * buffers, and marking the buffers as dirty. We inject those
+		 * newly allocated buffers into the libelf data structures, but
+		 * are still responsible for freeing them once we're done with
+		 * the elf handle.
+		 */
+		if (nsym > 0) {
+			/*
+			 * The first byte of the string table is reserved for
+			 * the \0 entry.
+			 */
+			len = dt_strtab_size(strtab) - 1;
+
+			assert(len > 0);
+			assert(dt_strtab_index(strtab, "") == 0);
+
+			dt_strtab_destroy(strtab);
+
+			if ((pair = dt_alloc(dtp, sizeof (*pair))) == NULL)
+				goto err;
+
+			if ((pair->dlp_str = dt_alloc(dtp, data_str->d_size +
+			    len)) == NULL) {
+				dt_free(dtp, pair);
+				goto err;
+			}
+
+			if ((pair->dlp_sym = dt_alloc(dtp, data_sym->d_size +
+			    nsym * symsize)) == NULL) {
+				dt_free(dtp, pair->dlp_str);
+				dt_free(dtp, pair);
+				goto err;
+			}
+
+			pair->dlp_next = bufs;
+			bufs = pair;
+
+			bcopy(data_str->d_buf, pair->dlp_str, data_str->d_size);
+			data_str->d_buf = pair->dlp_str;
+			data_str->d_size += len;
+			(void) elf_flagdata(data_str, ELF_C_SET, ELF_F_DIRTY);
+
+			shdr_str.sh_size += len;
+			(void) gelf_update_shdr(scn_str, &shdr_str);
+
+			bcopy(data_sym->d_buf, pair->dlp_sym, data_sym->d_size);
+			data_sym->d_buf = pair->dlp_sym;
+			data_sym->d_size += nsym * symsize;
+			(void) elf_flagdata(data_sym, ELF_C_SET, ELF_F_DIRTY);
+
+			shdr_sym.sh_size += nsym * symsize;
+			(void) gelf_update_shdr(scn_sym, &shdr_sym);
+
+			nsym += isym;
+		} else {
+			dt_strtab_destroy(strtab);
+		}
+
+		/*
+		 * Now that the tables have been allocated, perform the
+		 * modifications described above.
+		 */
+		for (i = 0; i < shdr_rel.sh_size / shdr_rel.sh_entsize; i++) {
+
+			if (shdr_rel.sh_type == SHT_RELA) {
+				if (gelf_getrela(data_rel, i, &rela) == NULL)
+					continue;
+			} else {
+				GElf_Rel rel;
+				if (gelf_getrel(data_rel, i, &rel) == NULL)
+					continue;
+				rela.r_offset = rel.r_offset;
+				rela.r_info = rel.r_info;
+				rela.r_addend = 0;
+			}
+
+			ndx = GELF_R_SYM(rela.r_info);
+
+			if (gelf_getsym(data_sym, ndx, &rsym) == NULL ||
+			    rsym.st_name > data_str->d_size)
+				goto err;
+
+			s = (char *)data_str->d_buf + rsym.st_name;
+
+			if (strncmp(s, dt_prefix, sizeof (dt_prefix) - 1) != 0)
+				continue;
+
+			s += sizeof (dt_prefix) - 1;
+
+			/*
+			 * Check to see if this is an 'is-enabled' check as
+			 * opposed to a normal probe.
+			 */
+			if (strncmp(s, dt_enabled,
+			    sizeof (dt_enabled) - 1) == 0) {
+				s += sizeof (dt_enabled) - 1;
+				eprobe = 1;
+				*eprobesp = 1;
+				dt_dprintf("is-enabled probe\n");
+			} else {
+				eprobe = 0;
+				dt_dprintf("normal probe\n");
+			}
+
+			if (*s++ != '_')
+				goto err;
+
+			if ((p = strstr(s, "___")) == NULL ||
+			    p - s >= sizeof (pname))
+				goto err;
+
+			bcopy(s, pname, p - s);
+			pname[p - s] = '\0';
+
+			p = strhyphenate(p + 3); /* strlen("___") */
+
+			if (dt_symtab_lookup(data_sym, isym, rela.r_offset,
+			    shdr_rel.sh_info, &fsym) != 0)
+				goto err;
+
+			if (fsym.st_name > data_str->d_size)
+				goto err;
+
+			assert(GELF_ST_TYPE(fsym.st_info) == STT_FUNC);
+
+			/*
+			 * If a NULL relocation name is passed to
+			 * dt_probe_define(), the function name is used for the
+			 * relocation. The relocation needs to use a mangled
+			 * name if the symbol is locally scoped; the function
+			 * name may need to change if we've found the global
+			 * alias for the locally scoped symbol (we prefer
+			 * global symbols to locals in dt_symtab_lookup()).
+			 */
+			s = (char *)data_str->d_buf + fsym.st_name;
+			r = NULL;
+
+			if (GELF_ST_BIND(fsym.st_info) == STB_LOCAL) {
+				dsym = fsym;
+				dsym.st_name = istr;
+				dsym.st_info = GELF_ST_INFO(STB_GLOBAL,
+				    STT_FUNC);
+				dsym.st_other =
+				    ELF64_ST_VISIBILITY(STV_ELIMINATE);
+				(void) gelf_update_sym(data_sym, isym, &dsym);
+
+				r = (char *)data_str->d_buf + istr;
+				istr += 1 + sprintf(r, dt_symfmt,
+				    dt_symprefix, objkey, s);
+				isym++;
+				assert(isym <= nsym);
+
+			} else if (strncmp(s, dt_symprefix,
+			    strlen(dt_symprefix)) == 0) {
+				r = s;
+				if ((s = strchr(s, '.')) == NULL)
+					goto err;
+				s++;
+			}
+
+			if ((pvp = dt_provider_lookup(dtp, pname)) == NULL) {
+				return (dt_link_error(dtp, elf, fd, bufs,
+				    "no such provider %s", pname));
+			}
+
+			if ((prp = dt_probe_lookup(pvp, p)) == NULL) {
+				return (dt_link_error(dtp, elf, fd, bufs,
+				    "no such probe %s", p));
+			}
+
+			assert(fsym.st_value <= rela.r_offset);
+
+			off = rela.r_offset - fsym.st_value;
+			if (dt_modtext(dtp, data_tgt->d_buf, eprobe,
+			    &rela, &off) != 0) {
+				goto err;
+			}
+
+			if (dt_probe_define(pvp, prp, s, r, off, eprobe) != 0) {
+				return (dt_link_error(dtp, elf, fd, bufs,
+				    "failed to allocate space for probe"));
+			}
+
+			mod = 1;
+			(void) elf_flagdata(data_tgt, ELF_C_SET, ELF_F_DIRTY);
+
+			/*
+			 * This symbol may already have been marked to
+			 * be ignored by another relocation referencing
+			 * the same symbol or if this object file has
+			 * already been processed by an earlier link
+			 * invocation.
+			 */
+			if (rsym.st_shndx != SHN_SUNW_IGNORE) {
+				rsym.st_shndx = SHN_SUNW_IGNORE;
+				(void) gelf_update_sym(data_sym, ndx, &rsym);
+			}
+		}
+	}
+
+	if (mod && elf_update(elf, ELF_C_WRITE) == -1)
+		goto err;
+
+	(void) elf_end(elf);
+	(void) close(fd);
+
+	while ((pair = bufs) != NULL) {
+		bufs = pair->dlp_next;
+		dt_free(dtp, pair->dlp_str);
+		dt_free(dtp, pair->dlp_sym);
+		dt_free(dtp, pair);
+	}
+
+	return (0);
+
+err:
+	return (dt_link_error(dtp, elf, fd, bufs,
+	    "an error was encountered while processing %s", obj));
+}
+
+int
+dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
+    const char *file, int objc, char *const objv[])
+{
+	char drti[PATH_MAX];
+	dof_hdr_t *dof;
+	int fd, status, i, cur;
+	char *cmd, tmp;
+	size_t len;
+	int eprobes = 0, ret = 0;
+
+	/*
+	 * A NULL program indicates a special use in which we just link
+	 * together a bunch of object files specified in objv and then
+	 * unlink(2) those object files.
+	 */
+	if (pgp == NULL) {
+		const char *fmt = "%s -o %s -r";
+
+		len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file) + 1;
+
+		for (i = 0; i < objc; i++)
+			len += strlen(objv[i]) + 1;
+
+		cmd = alloca(len);
+
+		cur = snprintf(cmd, len, fmt, dtp->dt_ld_path, file);
+
+		for (i = 0; i < objc; i++)
+			cur += snprintf(cmd + cur, len - cur, " %s", objv[i]);
+
+		if ((status = system(cmd)) == -1) {
+			return (dt_link_error(dtp, NULL, -1, NULL,
+			    "failed to run %s: %s", dtp->dt_ld_path,
+			    strerror(errno)));
+		}
+
+		if (WIFSIGNALED(status)) {
+			return (dt_link_error(dtp, NULL, -1, NULL,
+			    "failed to link %s: %s failed due to signal %d",
+			    file, dtp->dt_ld_path, WTERMSIG(status)));
+		}
+
+		if (WEXITSTATUS(status) != 0) {
+			return (dt_link_error(dtp, NULL, -1, NULL,
+			    "failed to link %s: %s exited with status %d\n",
+			    file, dtp->dt_ld_path, WEXITSTATUS(status)));
+		}
+
+		for (i = 0; i < objc; i++) {
+			if (strcmp(objv[i], file) != 0)
+				(void) unlink(objv[i]);
+		}
+
+		return (0);
+	}
+
+	for (i = 0; i < objc; i++) {
+		if (process_obj(dtp, objv[i], &eprobes) != 0)
+			return (-1); /* errno is set for us */
+	}
+
+	/*
+	 * If there are is-enabled probes then we need to force use of DOF
+	 * version 2.
+	 */
+	if (eprobes && pgp->dp_dofversion < DOF_VERSION_2)
+		pgp->dp_dofversion = DOF_VERSION_2;
+
+	if ((dof = dtrace_dof_create(dtp, pgp, dflags)) == NULL)
+		return (-1); /* errno is set for us */
+
+	/*
+	 * Create a temporary file and then unlink it if we're going to
+	 * combine it with drti.o later.  We can still refer to it in child
+	 * processes as /dev/fd/<fd>.
+	 */
+	if ((fd = open64(file, O_RDWR | O_CREAT | O_TRUNC, 0666)) == -1) {
+		return (dt_link_error(dtp, NULL, -1, NULL,
+		    "failed to open %s: %s", file, strerror(errno)));
+	}
+
+	/*
+	 * If -xlinktype=DOF has been selected, just write out the DOF.
+	 * Otherwise proceed to the default of generating and linking ELF.
+	 */
+	switch (dtp->dt_linktype) {
+	case DT_LTYP_DOF:
+		if (dt_write(dtp, fd, dof, dof->dofh_filesz) < dof->dofh_filesz)
+			ret = errno;
+
+		if (close(fd) != 0 && ret == 0)
+			ret = errno;
+
+		if (ret != 0) {
+			return (dt_link_error(dtp, NULL, -1, NULL,
+			    "failed to write %s: %s", file, strerror(ret)));
+		}
+
+		return (0);
+
+	case DT_LTYP_ELF:
+		break; /* fall through to the rest of dtrace_program_link() */
+
+	default:
+		return (dt_link_error(dtp, NULL, -1, NULL,
+		    "invalid link type %u\n", dtp->dt_linktype));
+	}
+
+
+	if (!dtp->dt_lazyload)
+		(void) unlink(file);
+
+	if (dtp->dt_oflags & DTRACE_O_LP64)
+		status = dump_elf64(dtp, dof, fd);
+	else
+		status = dump_elf32(dtp, dof, fd);
+
+	if (status != 0 || lseek(fd, 0, SEEK_SET) != 0) {
+		return (dt_link_error(dtp, NULL, -1, NULL,
+		    "failed to write %s: %s", file, strerror(errno)));
+	}
+
+	if (!dtp->dt_lazyload) {
+		const char *fmt = "%s -o %s -r -Blocal -Breduce /dev/fd/%d %s";
+
+		if (dtp->dt_oflags & DTRACE_O_LP64) {
+			(void) snprintf(drti, sizeof (drti),
+			    "%s/64/drti.o", _dtrace_libdir);
+		} else {
+			(void) snprintf(drti, sizeof (drti),
+			    "%s/drti.o", _dtrace_libdir);
+		}
+
+		len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file, fd,
+		    drti) + 1;
+
+		cmd = alloca(len);
+
+		(void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file, fd, drti);
+
+		if ((status = system(cmd)) == -1) {
+			ret = dt_link_error(dtp, NULL, -1, NULL,
+			    "failed to run %s: %s", dtp->dt_ld_path,
+			    strerror(errno));
+			goto done;
+		}
+
+		(void) close(fd); /* release temporary file */
+
+		if (WIFSIGNALED(status)) {
+			ret = dt_link_error(dtp, NULL, -1, NULL,
+			    "failed to link %s: %s failed due to signal %d",
+			    file, dtp->dt_ld_path, WTERMSIG(status));
+			goto done;
+		}
+
+		if (WEXITSTATUS(status) != 0) {
+			ret = dt_link_error(dtp, NULL, -1, NULL,
+			    "failed to link %s: %s exited with status %d\n",
+			    file, dtp->dt_ld_path, WEXITSTATUS(status));
+			goto done;
+		}
+	} else {
+		(void) close(fd);
+	}
+
+done:
+	dtrace_dof_destroy(dtp, dof);
+	return (ret);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.c
new file mode 100644
index 0000000..598433e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.c
@@ -0,0 +1,117 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+/*
+ * Simple doubly-linked list implementation.  This implementation assumes that
+ * each list element contains an embedded dt_list_t (previous and next
+ * pointers), which is typically the first member of the element struct.
+ * An additional dt_list_t is used to store the head (dl_next) and tail
+ * (dl_prev) pointers.  The current head and tail list elements have their
+ * previous and next pointers set to NULL, respectively.
+ */
+
+#ifndef VBOX
+#include <unistd.h>
+#include <assert.h>
+#else
+# include "VBoxDTraceLibCWrappers.h"
+#endif
+#include <dt_list.h>
+
+void
+dt_list_append(dt_list_t *dlp, void *new)
+{
+	dt_list_t *p = dlp->dl_prev;	/* p = tail list element */
+	dt_list_t *q = new;		/* q = new list element */
+
+	dlp->dl_prev = q;
+	q->dl_prev = p;
+	q->dl_next = NULL;
+
+	if (p != NULL) {
+		assert(p->dl_next == NULL);
+		p->dl_next = q;
+	} else {
+		assert(dlp->dl_next == NULL);
+		dlp->dl_next = q;
+	}
+}
+
+void
+dt_list_prepend(dt_list_t *dlp, void *new)
+{
+	dt_list_t *p = new;		/* p = new list element */
+	dt_list_t *q = dlp->dl_next;	/* q = head list element */
+
+	dlp->dl_next = p;
+	p->dl_prev = NULL;
+	p->dl_next = q;
+
+	if (q != NULL) {
+		assert(q->dl_prev == NULL);
+		q->dl_prev = p;
+	} else {
+		assert(dlp->dl_prev == NULL);
+		dlp->dl_prev = p;
+	}
+}
+
+void
+dt_list_insert(dt_list_t *dlp, void *after_me, void *new)
+{
+	dt_list_t *p = after_me;
+	dt_list_t *q = new;
+
+	if (p == NULL || p->dl_next == NULL) {
+		dt_list_append(dlp, new);
+		return;
+	}
+
+	q->dl_next = p->dl_next;
+	q->dl_prev = p;
+	p->dl_next = q;
+	q->dl_next->dl_prev = q;
+}
+
+void
+dt_list_delete(dt_list_t *dlp, void *existing)
+{
+	dt_list_t *p = existing;
+
+	if (p->dl_prev != NULL)
+		p->dl_prev->dl_next = p->dl_next;
+	else
+		dlp->dl_next = p->dl_next;
+
+	if (p->dl_next != NULL)
+		p->dl_next->dl_prev = p->dl_prev;
+	else
+		dlp->dl_prev = p->dl_prev;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.h
new file mode 100644
index 0000000..d13987d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_list.h
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_LIST_H
+#define	_DT_LIST_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#else
+# include "VBoxDTraceTypes.h"
+#endif
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct dt_list {
+	struct dt_list *dl_prev;
+	struct dt_list *dl_next;
+} dt_list_t;
+
+#define	dt_list_prev(elem)	((void *)(((dt_list_t *)(elem))->dl_prev))
+#define	dt_list_next(elem)	((void *)(((dt_list_t *)(elem))->dl_next))
+
+extern void dt_list_append(dt_list_t *, void *);
+extern void dt_list_prepend(dt_list_t *, void *);
+extern void dt_list_insert(dt_list_t *, void *, void *);
+extern void dt_list_delete(dt_list_t *, void *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_LIST_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_map.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_map.c
new file mode 100644
index 0000000..89921df
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_map.c
@@ -0,0 +1,428 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stdlib.h>
+#include <strings.h>
+#include <errno.h>
+#include <unistd.h>
+#include <assert.h>
+#endif
+
+#include <dt_impl.h>
+#include <dt_printf.h>
+
+static int
+dt_epid_add(dtrace_hdl_t *dtp, dtrace_epid_t id)
+{
+	dtrace_id_t max;
+	int rval, i, maxformat;
+	dtrace_eprobedesc_t *enabled, *nenabled;
+	dtrace_probedesc_t *probe;
+
+	while (id >= (max = VBDTCAST(dtrace_id_t)dtp->dt_maxprobe) || dtp->dt_pdesc == NULL) {
+		dtrace_id_t new_max = max ? (max << 1) : 1;
+		size_t nsize = new_max * sizeof (void *);
+		dtrace_probedesc_t **new_pdesc;
+		dtrace_eprobedesc_t **new_edesc;
+
+		if ((new_pdesc = malloc(nsize)) == NULL ||
+		    (new_edesc = malloc(nsize)) == NULL) {
+			free(new_pdesc);
+			return (dt_set_errno(dtp, EDT_NOMEM));
+		}
+
+		bzero(new_pdesc, nsize);
+		bzero(new_edesc, nsize);
+
+		if (dtp->dt_pdesc != NULL) {
+			size_t osize = max * sizeof (void *);
+
+			bcopy(dtp->dt_pdesc, new_pdesc, osize);
+			free(dtp->dt_pdesc);
+
+			bcopy(dtp->dt_edesc, new_edesc, osize);
+			free(dtp->dt_edesc);
+		}
+
+		dtp->dt_pdesc = new_pdesc;
+		dtp->dt_edesc = new_edesc;
+		dtp->dt_maxprobe = new_max;
+	}
+
+	if (dtp->dt_pdesc[id] != NULL)
+		return (0);
+
+	if ((enabled = malloc(sizeof (dtrace_eprobedesc_t))) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	bzero(enabled, sizeof (dtrace_eprobedesc_t));
+	enabled->dtepd_epid = id;
+	enabled->dtepd_nrecs = 1;
+
+	if (dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled) == -1) {
+		rval = dt_set_errno(dtp, errno);
+		free(enabled);
+		return (rval);
+	}
+
+	if (DTRACE_SIZEOF_EPROBEDESC(enabled) != sizeof (*enabled)) {
+		/*
+		 * There must be more than one action.  Allocate the
+		 * appropriate amount of space and try again.
+		 */
+		if ((nenabled =
+		    malloc(DTRACE_SIZEOF_EPROBEDESC(enabled))) != NULL)
+			bcopy(enabled, nenabled, sizeof (*enabled));
+
+		free(enabled);
+
+		if ((enabled = nenabled) == NULL)
+			return (dt_set_errno(dtp, EDT_NOMEM));
+
+		rval = dt_ioctl(dtp, DTRACEIOC_EPROBE, enabled);
+
+		if (rval == -1) {
+			rval = dt_set_errno(dtp, errno);
+			free(enabled);
+			return (rval);
+		}
+	}
+
+	if ((probe = malloc(sizeof (dtrace_probedesc_t))) == NULL) {
+		free(enabled);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	probe->dtpd_id = enabled->dtepd_probeid;
+
+	if (dt_ioctl(dtp, DTRACEIOC_PROBES, probe) == -1) {
+		rval = dt_set_errno(dtp, errno);
+		goto err;
+	}
+
+	for (i = 0; i < enabled->dtepd_nrecs; i++) {
+		dtrace_fmtdesc_t fmt;
+		dtrace_recdesc_t *rec = &enabled->dtepd_rec[i];
+
+		if (!DTRACEACT_ISPRINTFLIKE(rec->dtrd_action))
+			continue;
+
+		if (rec->dtrd_format == 0)
+			continue;
+
+		if (rec->dtrd_format <= dtp->dt_maxformat &&
+		    dtp->dt_formats[rec->dtrd_format - 1] != NULL)
+			continue;
+
+		bzero(&fmt, sizeof (fmt));
+		fmt.dtfd_format = rec->dtrd_format;
+		fmt.dtfd_string = NULL;
+		fmt.dtfd_length = 0;
+
+		if (dt_ioctl(dtp, DTRACEIOC_FORMAT, &fmt) == -1) {
+			rval = dt_set_errno(dtp, errno);
+			goto err;
+		}
+
+		if ((fmt.dtfd_string = malloc(fmt.dtfd_length)) == NULL) {
+			rval = dt_set_errno(dtp, EDT_NOMEM);
+			goto err;
+		}
+
+		if (dt_ioctl(dtp, DTRACEIOC_FORMAT, &fmt) == -1) {
+			rval = dt_set_errno(dtp, errno);
+			free(fmt.dtfd_string);
+			goto err;
+		}
+
+		while (rec->dtrd_format > (maxformat = dtp->dt_maxformat)) {
+			int new_max = maxformat ? (maxformat << 1) : 1;
+			size_t nsize = new_max * sizeof (void *);
+			size_t osize = maxformat * sizeof (void *);
+			void **new_formats = malloc(nsize);
+
+			if (new_formats == NULL) {
+				rval = dt_set_errno(dtp, EDT_NOMEM);
+				free(fmt.dtfd_string);
+				goto err;
+			}
+
+			bzero(new_formats, nsize);
+			bcopy(dtp->dt_formats, new_formats, osize);
+			free(dtp->dt_formats);
+
+			dtp->dt_formats = new_formats;
+			dtp->dt_maxformat = new_max;
+		}
+
+		dtp->dt_formats[rec->dtrd_format - 1] =
+		    rec->dtrd_action == DTRACEACT_PRINTA ?
+		    dtrace_printa_create(dtp, fmt.dtfd_string) :
+		    dtrace_printf_create(dtp, fmt.dtfd_string);
+
+		free(fmt.dtfd_string);
+
+		if (dtp->dt_formats[rec->dtrd_format - 1] == NULL) {
+			rval = -1; /* dt_errno is set for us */
+			goto err;
+		}
+	}
+
+	dtp->dt_pdesc[id] = probe;
+	dtp->dt_edesc[id] = enabled;
+
+	return (0);
+
+err:
+	/*
+	 * If we failed, free our allocated probes.  Note that if we failed
+	 * while allocating formats, we aren't going to free formats that
+	 * we have already allocated.  This is okay; these formats are
+	 * hanging off of dt_formats and will therefore not be leaked.
+	 */
+	free(enabled);
+	free(probe);
+	return (rval);
+}
+
+int
+dt_epid_lookup(dtrace_hdl_t *dtp, dtrace_epid_t epid,
+    dtrace_eprobedesc_t **epdp, dtrace_probedesc_t **pdp)
+{
+	int rval;
+
+	if (epid >= dtp->dt_maxprobe || dtp->dt_pdesc[epid] == NULL) {
+		if ((rval = dt_epid_add(dtp, epid)) != 0)
+			return (rval);
+	}
+
+	assert(epid < dtp->dt_maxprobe);
+	assert(dtp->dt_edesc[epid] != NULL);
+	assert(dtp->dt_pdesc[epid] != NULL);
+	*epdp = dtp->dt_edesc[epid];
+	*pdp = dtp->dt_pdesc[epid];
+
+	return (0);
+}
+
+void
+dt_epid_destroy(dtrace_hdl_t *dtp)
+{
+	size_t i;
+
+	assert((dtp->dt_pdesc != NULL && dtp->dt_edesc != NULL &&
+	    dtp->dt_maxprobe > 0) || (dtp->dt_pdesc == NULL &&
+	    dtp->dt_edesc == NULL && dtp->dt_maxprobe == 0));
+
+	if (dtp->dt_pdesc == NULL)
+		return;
+
+	for (i = 0; i < dtp->dt_maxprobe; i++) {
+		if (dtp->dt_edesc[i] == NULL) {
+			assert(dtp->dt_pdesc[i] == NULL);
+			continue;
+		}
+
+		assert(dtp->dt_pdesc[i] != NULL);
+		free(dtp->dt_edesc[i]);
+		free(dtp->dt_pdesc[i]);
+	}
+
+	free(dtp->dt_pdesc);
+	dtp->dt_pdesc = NULL;
+
+	free(dtp->dt_edesc);
+	dtp->dt_edesc = NULL;
+	dtp->dt_maxprobe = 0;
+}
+
+void *
+dt_format_lookup(dtrace_hdl_t *dtp, int format)
+{
+	if (format == 0 || format > dtp->dt_maxformat)
+		return (NULL);
+
+	if (dtp->dt_formats == NULL)
+		return (NULL);
+
+	return (dtp->dt_formats[format - 1]);
+}
+
+void
+dt_format_destroy(dtrace_hdl_t *dtp)
+{
+	int i;
+
+	for (i = 0; i < dtp->dt_maxformat; i++) {
+		if (dtp->dt_formats[i] != NULL)
+			dt_printf_destroy(dtp->dt_formats[i]);
+	}
+
+	free(dtp->dt_formats);
+	dtp->dt_formats = NULL;
+}
+
+static int
+dt_aggid_add(dtrace_hdl_t *dtp, dtrace_aggid_t id)
+{
+	dtrace_id_t max;
+	dtrace_epid_t epid;
+	int rval;
+
+	while (id >= (max = VBDTCAST(dtrace_id_t)dtp->dt_maxagg) || dtp->dt_aggdesc == NULL) {
+		dtrace_id_t new_max = max ? (max << 1) : 1;
+		size_t nsize = new_max * sizeof (void *);
+		dtrace_aggdesc_t **new_aggdesc;
+
+		if ((new_aggdesc = malloc(nsize)) == NULL)
+			return (dt_set_errno(dtp, EDT_NOMEM));
+
+		bzero(new_aggdesc, nsize);
+
+		if (dtp->dt_aggdesc != NULL) {
+			bcopy(dtp->dt_aggdesc, new_aggdesc,
+			    max * sizeof (void *));
+			free(dtp->dt_aggdesc);
+		}
+
+		dtp->dt_aggdesc = new_aggdesc;
+		dtp->dt_maxagg = new_max;
+	}
+
+	if (dtp->dt_aggdesc[id] == NULL) {
+		dtrace_aggdesc_t *agg, *nagg;
+
+		if ((agg = malloc(sizeof (dtrace_aggdesc_t))) == NULL)
+			return (dt_set_errno(dtp, EDT_NOMEM));
+
+		bzero(agg, sizeof (dtrace_aggdesc_t));
+		agg->dtagd_id = id;
+		agg->dtagd_nrecs = 1;
+
+		if (dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg) == -1) {
+			rval = dt_set_errno(dtp, errno);
+			free(agg);
+			return (rval);
+		}
+
+		if (DTRACE_SIZEOF_AGGDESC(agg) != sizeof (*agg)) {
+			/*
+			 * There must be more than one action.  Allocate the
+			 * appropriate amount of space and try again.
+			 */
+			if ((nagg = malloc(DTRACE_SIZEOF_AGGDESC(agg))) != NULL)
+				bcopy(agg, nagg, sizeof (*agg));
+
+			free(agg);
+
+			if ((agg = nagg) == NULL)
+				return (dt_set_errno(dtp, EDT_NOMEM));
+
+			rval = dt_ioctl(dtp, DTRACEIOC_AGGDESC, agg);
+
+			if (rval == -1) {
+				rval = dt_set_errno(dtp, errno);
+				free(agg);
+				return (rval);
+			}
+		}
+
+		/*
+		 * If we have a uarg, it's a pointer to the compiler-generated
+		 * statement; we'll use this value to get the name and
+		 * compiler-generated variable ID for the aggregation.  If
+		 * we're grabbing an anonymous enabling, this pointer value
+		 * is obviously meaningless -- and in this case, we can't
+		 * provide the compiler-generated aggregation information.
+		 */
+		if (dtp->dt_options[DTRACEOPT_GRABANON] == DTRACEOPT_UNSET &&
+		    agg->dtagd_rec[0].dtrd_uarg != 0 /*NULL*/) {
+			dtrace_stmtdesc_t *sdp;
+			dt_ident_t *aid;
+
+			sdp = (dtrace_stmtdesc_t *)(uintptr_t)
+			    agg->dtagd_rec[0].dtrd_uarg;
+			aid = sdp->dtsd_aggdata;
+			agg->dtagd_name = aid->di_name;
+			agg->dtagd_varid = aid->di_id;
+		} else {
+			agg->dtagd_varid = DTRACE_AGGVARIDNONE;
+		}
+
+		if ((epid = agg->dtagd_epid) >= dtp->dt_maxprobe ||
+		    dtp->dt_pdesc[epid] == NULL) {
+			if ((rval = dt_epid_add(dtp, epid)) != 0) {
+				free(agg);
+				return (rval);
+			}
+		}
+
+		dtp->dt_aggdesc[id] = agg;
+	}
+
+	return (0);
+}
+
+int
+dt_aggid_lookup(dtrace_hdl_t *dtp, dtrace_aggid_t aggid,
+    dtrace_aggdesc_t **adp)
+{
+	int rval;
+
+	if (aggid >= dtp->dt_maxagg || dtp->dt_aggdesc[aggid] == NULL) {
+		if ((rval = dt_aggid_add(dtp, aggid)) != 0)
+			return (rval);
+	}
+
+	assert(aggid < dtp->dt_maxagg);
+	assert(dtp->dt_aggdesc[aggid] != NULL);
+	*adp = dtp->dt_aggdesc[aggid];
+
+	return (0);
+}
+
+void
+dt_aggid_destroy(dtrace_hdl_t *dtp)
+{
+	size_t i;
+
+	assert((dtp->dt_aggdesc != NULL && dtp->dt_maxagg != 0) ||
+	    (dtp->dt_aggdesc == NULL && dtp->dt_maxagg == 0));
+
+	if (dtp->dt_aggdesc == NULL)
+		return;
+
+	for (i = 0; i < dtp->dt_maxagg; i++) {
+		if (dtp->dt_aggdesc[i] != NULL)
+			free(dtp->dt_aggdesc[i]);
+	}
+
+	free(dtp->dt_aggdesc);
+	dtp->dt_aggdesc = NULL;
+	dtp->dt_maxagg = 0;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_module.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_module.c
new file mode 100644
index 0000000..7ff5a51
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_module.c
@@ -0,0 +1,1344 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <sys/types.h>
+#include <sys/modctl.h>
+#include <sys/kobj.h>
+#include <sys/kobj_impl.h>
+#include <sys/sysmacros.h>
+#include <sys/elf.h>
+#include <sys/task.h>
+
+#include <unistd.h>
+#include <project.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <libelf.h>
+#include <limits.h>
+#include <assert.h>
+#include <errno.h>
+#include <dirent.h>
+#else  /* VBOX */
+# include "../../../../../../Runtime/include/internal/ldrELF32.h"
+# ifdef _MSC_VER
+#  include <process.h>
+#  define getuid() 0
+#  define getgid() 0
+#  define geteuid() 0
+#  define getegid() 0
+#  define getpid() _getpid()
+#  define getppid() 0
+
+#  define getpgid(a) 0
+#  define getsid(a) 0
+# else
+#  include <unistd.h>
+# endif
+# define getprojid() 0
+# define gettaskid() 0
+
+#endif /* VBOX */
+
+#include <dt_strtab.h>
+#include <dt_module.h>
+#include <dt_impl.h>
+
+
+static const char *dt_module_strtab; /* active strtab for qsort callbacks */
+
+static void
+dt_module_symhash_insert(dt_module_t *dmp, const char *name, uint_t id)
+{
+	dt_sym_t *dsp = &dmp->dm_symchains[dmp->dm_symfree];
+	uint_t h;
+
+	assert(dmp->dm_symfree < dmp->dm_nsymelems + 1);
+
+	dsp->ds_symid = id;
+	h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets;
+	dsp->ds_next = dmp->dm_symbuckets[h];
+	dmp->dm_symbuckets[h] = dmp->dm_symfree++;
+}
+
+static uint_t
+dt_module_syminit32(dt_module_t *dmp)
+{
+#if STT_NUM != (STT_TLS + 1)
+#error "STT_NUM has grown. update dt_module_syminit32()"
+#endif
+
+	const Elf32_Sym *sym = dmp->dm_symtab.cts_data;
+	const char *base = dmp->dm_strtab.cts_data;
+	size_t ss_size = dmp->dm_strtab.cts_size;
+	uint_t i, n = dmp->dm_nsymelems;
+	uint_t asrsv = 0;
+
+	for (i = 0; i < n; i++, sym++) {
+		const char *name = base + sym->st_name;
+		uchar_t type = ELF32_ST_TYPE(sym->st_info);
+
+		if (type >= STT_NUM || type == STT_SECTION)
+			continue; /* skip sections and unknown types */
+
+		if (sym->st_name == 0 || sym->st_name >= ss_size)
+			continue; /* skip null or invalid names */
+
+		if (sym->st_value != 0 &&
+		    (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size))
+			asrsv++; /* reserve space in the address map */
+
+		dt_module_symhash_insert(dmp, name, i);
+	}
+
+	return (asrsv);
+}
+
+static uint_t
+dt_module_syminit64(dt_module_t *dmp)
+{
+#if STT_NUM != (STT_TLS + 1)
+#error "STT_NUM has grown. update dt_module_syminit64()"
+#endif
+
+	const Elf64_Sym *sym = dmp->dm_symtab.cts_data;
+	const char *base = dmp->dm_strtab.cts_data;
+	size_t ss_size = dmp->dm_strtab.cts_size;
+	uint_t i, n = dmp->dm_nsymelems;
+	uint_t asrsv = 0;
+
+	for (i = 0; i < n; i++, sym++) {
+		const char *name = base + sym->st_name;
+		uchar_t type = ELF64_ST_TYPE(sym->st_info);
+
+		if (type >= STT_NUM || type == STT_SECTION)
+			continue; /* skip sections and unknown types */
+
+		if (sym->st_name == 0 || sym->st_name >= ss_size)
+			continue; /* skip null or invalid names */
+
+		if (sym->st_value != 0 &&
+		    (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size))
+			asrsv++; /* reserve space in the address map */
+
+		dt_module_symhash_insert(dmp, name, i);
+	}
+
+	return (asrsv);
+}
+
+/*
+ * Sort comparison function for 32-bit symbol address-to-name lookups.  We sort
+ * symbols by value.  If values are equal, we prefer the symbol that is
+ * non-zero sized, typed, not weak, or lexically first, in that order.
+ */
+static int
+dt_module_symcomp32(const void *lp, const void *rp)
+{
+	Elf32_Sym *lhs = *((Elf32_Sym **)lp);
+	Elf32_Sym *rhs = *((Elf32_Sym **)rp);
+
+	if (lhs->st_value != rhs->st_value)
+		return (lhs->st_value > rhs->st_value ? 1 : -1);
+
+	if ((lhs->st_size == 0) != (rhs->st_size == 0))
+		return (lhs->st_size == 0 ? 1 : -1);
+
+	if ((ELF32_ST_TYPE(lhs->st_info) == STT_NOTYPE) !=
+	    (ELF32_ST_TYPE(rhs->st_info) == STT_NOTYPE))
+		return (ELF32_ST_TYPE(lhs->st_info) == STT_NOTYPE ? 1 : -1);
+
+	if ((ELF32_ST_BIND(lhs->st_info) == STB_WEAK) !=
+	    (ELF32_ST_BIND(rhs->st_info) == STB_WEAK))
+		return (ELF32_ST_BIND(lhs->st_info) == STB_WEAK ? 1 : -1);
+
+	return (strcmp(dt_module_strtab + lhs->st_name,
+	    dt_module_strtab + rhs->st_name));
+}
+
+/*
+ * Sort comparison function for 64-bit symbol address-to-name lookups.  We sort
+ * symbols by value.  If values are equal, we prefer the symbol that is
+ * non-zero sized, typed, not weak, or lexically first, in that order.
+ */
+static int
+dt_module_symcomp64(const void *lp, const void *rp)
+{
+	Elf64_Sym *lhs = *((Elf64_Sym **)lp);
+	Elf64_Sym *rhs = *((Elf64_Sym **)rp);
+
+	if (lhs->st_value != rhs->st_value)
+		return (lhs->st_value > rhs->st_value ? 1 : -1);
+
+	if ((lhs->st_size == 0) != (rhs->st_size == 0))
+		return (lhs->st_size == 0 ? 1 : -1);
+
+	if ((ELF64_ST_TYPE(lhs->st_info) == STT_NOTYPE) !=
+	    (ELF64_ST_TYPE(rhs->st_info) == STT_NOTYPE))
+		return (ELF64_ST_TYPE(lhs->st_info) == STT_NOTYPE ? 1 : -1);
+
+	if ((ELF64_ST_BIND(lhs->st_info) == STB_WEAK) !=
+	    (ELF64_ST_BIND(rhs->st_info) == STB_WEAK))
+		return (ELF64_ST_BIND(lhs->st_info) == STB_WEAK ? 1 : -1);
+
+	return (strcmp(dt_module_strtab + lhs->st_name,
+	    dt_module_strtab + rhs->st_name));
+}
+
+static void
+dt_module_symsort32(dt_module_t *dmp)
+{
+	Elf32_Sym *symtab = (Elf32_Sym *)dmp->dm_symtab.cts_data;
+	Elf32_Sym **sympp = (Elf32_Sym **)dmp->dm_asmap;
+	const dt_sym_t *dsp = dmp->dm_symchains + 1;
+	uint_t i, n = dmp->dm_symfree;
+
+	for (i = 1; i < n; i++, dsp++) {
+		Elf32_Sym *sym = symtab + dsp->ds_symid;
+		if (sym->st_value != 0 &&
+		    (ELF32_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size))
+			*sympp++ = sym;
+	}
+
+	dmp->dm_aslen = (uint_t)(sympp - (Elf32_Sym **)dmp->dm_asmap);
+	assert(dmp->dm_aslen <= dmp->dm_asrsv);
+
+	dt_module_strtab = dmp->dm_strtab.cts_data;
+	qsort(dmp->dm_asmap, dmp->dm_aslen,
+	    sizeof (Elf32_Sym *), dt_module_symcomp32);
+	dt_module_strtab = NULL;
+}
+
+static void
+dt_module_symsort64(dt_module_t *dmp)
+{
+	Elf64_Sym *symtab = (Elf64_Sym *)dmp->dm_symtab.cts_data;
+	Elf64_Sym **sympp = (Elf64_Sym **)dmp->dm_asmap;
+	const dt_sym_t *dsp = dmp->dm_symchains + 1;
+	uint_t i, n = dmp->dm_symfree;
+
+	for (i = 1; i < n; i++, dsp++) {
+		Elf64_Sym *sym = symtab + dsp->ds_symid;
+		if (sym->st_value != 0 &&
+		    (ELF64_ST_BIND(sym->st_info) != STB_LOCAL || sym->st_size))
+			*sympp++ = sym;
+	}
+
+	dmp->dm_aslen = (uint_t)(sympp - (Elf64_Sym **)dmp->dm_asmap);
+	assert(dmp->dm_aslen <= dmp->dm_asrsv);
+
+	dt_module_strtab = dmp->dm_strtab.cts_data;
+	qsort(dmp->dm_asmap, dmp->dm_aslen,
+	    sizeof (Elf64_Sym *), dt_module_symcomp64);
+	dt_module_strtab = NULL;
+}
+
+static GElf_Sym *
+dt_module_symgelf32(const Elf32_Sym *src, GElf_Sym *dst)
+{
+	if (dst != NULL) {
+		dst->st_name = src->st_name;
+		dst->st_info = src->st_info;
+		dst->st_other = src->st_other;
+		dst->st_shndx = src->st_shndx;
+		dst->st_value = src->st_value;
+		dst->st_size = src->st_size;
+	}
+
+	return (dst);
+}
+
+static GElf_Sym *
+dt_module_symgelf64(const Elf64_Sym *src, GElf_Sym *dst)
+{
+	if (dst != NULL)
+		bcopy(src, dst, sizeof (GElf_Sym));
+
+	return (dst);
+}
+
+static GElf_Sym *
+dt_module_symname32(dt_module_t *dmp, const char *name,
+    GElf_Sym *symp, uint_t *idp)
+{
+	const Elf32_Sym *symtab = dmp->dm_symtab.cts_data;
+	const char *strtab = dmp->dm_strtab.cts_data;
+
+	const Elf32_Sym *sym;
+	const dt_sym_t *dsp;
+	uint_t i, h;
+
+	if (dmp->dm_nsymelems == 0)
+		return (NULL);
+
+	h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets;
+
+	for (i = dmp->dm_symbuckets[h]; i != 0; i = dsp->ds_next) {
+		dsp = &dmp->dm_symchains[i];
+		sym = symtab + dsp->ds_symid;
+
+		if (strcmp(name, strtab + sym->st_name) == 0) {
+			if (idp != NULL)
+				*idp = dsp->ds_symid;
+			return (dt_module_symgelf32(sym, symp));
+		}
+	}
+
+	return (NULL);
+}
+
+static GElf_Sym *
+dt_module_symname64(dt_module_t *dmp, const char *name,
+    GElf_Sym *symp, uint_t *idp)
+{
+	const Elf64_Sym *symtab = dmp->dm_symtab.cts_data;
+	const char *strtab = dmp->dm_strtab.cts_data;
+
+	const Elf64_Sym *sym;
+	const dt_sym_t *dsp;
+	uint_t i, h;
+
+	if (dmp->dm_nsymelems == 0)
+		return (NULL);
+
+	h = dt_strtab_hash(name, NULL) % dmp->dm_nsymbuckets;
+
+	for (i = dmp->dm_symbuckets[h]; i != 0; i = dsp->ds_next) {
+		dsp = &dmp->dm_symchains[i];
+		sym = symtab + dsp->ds_symid;
+
+		if (strcmp(name, strtab + sym->st_name) == 0) {
+			if (idp != NULL)
+				*idp = dsp->ds_symid;
+			return (dt_module_symgelf64(sym, symp));
+		}
+	}
+
+	return (NULL);
+}
+
+static GElf_Sym *
+dt_module_symaddr32(dt_module_t *dmp, GElf_Addr addr,
+    GElf_Sym *symp, uint_t *idp)
+{
+	const Elf32_Sym **asmap = (const Elf32_Sym **)dmp->dm_asmap;
+	const Elf32_Sym *symtab = dmp->dm_symtab.cts_data;
+	const Elf32_Sym *sym;
+
+	uint_t i, mid, lo = 0, hi = dmp->dm_aslen - 1;
+	Elf32_Addr v;
+
+	if (dmp->dm_aslen == 0)
+		return (NULL);
+
+	while (hi - lo > 1) {
+		mid = (lo + hi) / 2;
+		if (addr >= asmap[mid]->st_value)
+			lo = mid;
+		else
+			hi = mid;
+	}
+
+	i = addr < asmap[hi]->st_value ? lo : hi;
+	sym = asmap[i];
+	v = sym->st_value;
+
+	/*
+	 * If the previous entry has the same value, improve our choice.  The
+	 * order of equal-valued symbols is determined by the comparison func.
+	 */
+	while (i-- != 0 && asmap[i]->st_value == v)
+		sym = asmap[i];
+
+	if (addr - sym->st_value < MAX(sym->st_size, 1)) {
+		if (idp != NULL)
+			*idp = (uint_t)(sym - symtab);
+		return (dt_module_symgelf32(sym, symp));
+	}
+
+	return (NULL);
+}
+
+static GElf_Sym *
+dt_module_symaddr64(dt_module_t *dmp, GElf_Addr addr,
+    GElf_Sym *symp, uint_t *idp)
+{
+	const Elf64_Sym **asmap = (const Elf64_Sym **)dmp->dm_asmap;
+	const Elf64_Sym *symtab = dmp->dm_symtab.cts_data;
+	const Elf64_Sym *sym;
+
+	uint_t i, mid, lo = 0, hi = dmp->dm_aslen - 1;
+	Elf64_Addr v;
+
+	if (dmp->dm_aslen == 0)
+		return (NULL);
+
+	while (hi - lo > 1) {
+		mid = (lo + hi) / 2;
+		if (addr >= asmap[mid]->st_value)
+			lo = mid;
+		else
+			hi = mid;
+	}
+
+	i = addr < asmap[hi]->st_value ? lo : hi;
+	sym = asmap[i];
+	v = sym->st_value;
+
+	/*
+	 * If the previous entry has the same value, improve our choice.  The
+	 * order of equal-valued symbols is determined by the comparison func.
+	 */
+	while (i-- != 0 && asmap[i]->st_value == v)
+		sym = asmap[i];
+
+	if (addr - sym->st_value < MAX(sym->st_size, 1)) {
+		if (idp != NULL)
+			*idp = (uint_t)(sym - symtab);
+		return (dt_module_symgelf64(sym, symp));
+	}
+
+	return (NULL);
+}
+
+static const dt_modops_t dt_modops_32 = {
+	dt_module_syminit32,
+	dt_module_symsort32,
+	dt_module_symname32,
+	dt_module_symaddr32
+};
+
+static const dt_modops_t dt_modops_64 = {
+	dt_module_syminit64,
+	dt_module_symsort64,
+	dt_module_symname64,
+	dt_module_symaddr64
+};
+
+dt_module_t *
+dt_module_create(dtrace_hdl_t *dtp, const char *name)
+{
+	uint_t h = dt_strtab_hash(name, NULL) % dtp->dt_modbuckets;
+	dt_module_t *dmp;
+
+	for (dmp = dtp->dt_mods[h]; dmp != NULL; dmp = dmp->dm_next) {
+		if (strcmp(dmp->dm_name, name) == 0)
+			return (dmp);
+	}
+
+	if ((dmp = malloc(sizeof (dt_module_t))) == NULL)
+		return (NULL); /* caller must handle allocation failure */
+
+	bzero(dmp, sizeof (dt_module_t));
+	(void) strlcpy(dmp->dm_name, name, sizeof (dmp->dm_name));
+	dt_list_append(&dtp->dt_modlist, dmp);
+	dmp->dm_next = dtp->dt_mods[h];
+	dtp->dt_mods[h] = dmp;
+	dtp->dt_nmods++;
+
+	if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64)
+		dmp->dm_ops = &dt_modops_64;
+	else
+		dmp->dm_ops = &dt_modops_32;
+
+	return (dmp);
+}
+
+dt_module_t *
+dt_module_lookup_by_name(dtrace_hdl_t *dtp, const char *name)
+{
+	uint_t h = dt_strtab_hash(name, NULL) % dtp->dt_modbuckets;
+	dt_module_t *dmp;
+
+	for (dmp = dtp->dt_mods[h]; dmp != NULL; dmp = dmp->dm_next) {
+		if (strcmp(dmp->dm_name, name) == 0)
+			return (dmp);
+	}
+
+	return (NULL);
+}
+
+/*ARGSUSED*/
+dt_module_t *
+dt_module_lookup_by_ctf(dtrace_hdl_t *dtp, ctf_file_t *ctfp)
+{
+	return (ctfp ? ctf_getspecific(ctfp) : NULL);
+}
+
+static int
+dt_module_load_sect(dtrace_hdl_t *dtp, dt_module_t *dmp, ctf_sect_t *ctsp)
+{
+#ifndef VBOX  /** @todo consider this later */
+	const char *s;
+	size_t shstrs;
+	GElf_Shdr sh;
+	Elf_Data *dp;
+	Elf_Scn *sp;
+
+	if (elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1)
+		return (dt_set_errno(dtp, EDT_NOTLOADED));
+
+	for (sp = NULL; (sp = elf_nextscn(dmp->dm_elf, sp)) != NULL; ) {
+		if (gelf_getshdr(sp, &sh) == NULL || sh.sh_type == SHT_NULL ||
+		    (s = elf_strptr(dmp->dm_elf, shstrs, sh.sh_name)) == NULL)
+			continue; /* skip any malformed sections */
+
+		if (sh.sh_type == ctsp->cts_type &&
+		    sh.sh_entsize == ctsp->cts_entsize &&
+		    strcmp(s, ctsp->cts_name) == 0)
+			break; /* section matches specification */
+	}
+
+	/*
+	 * If the section isn't found, return success but leave cts_data set
+	 * to NULL and cts_size set to zero for our caller.
+	 */
+	if (sp == NULL || (dp = elf_getdata(sp, NULL)) == NULL)
+		return (0);
+
+	ctsp->cts_data = dp->d_buf;
+	ctsp->cts_size = dp->d_size;
+
+	dt_dprintf("loaded %s [%s] (%lu bytes)\n",
+	    dmp->dm_name, ctsp->cts_name, (ulong_t)ctsp->cts_size);
+
+#endif /* !VBOX */
+	return (0);
+}
+
+int
+dt_module_load(dtrace_hdl_t *dtp, dt_module_t *dmp)
+{
+	if (dmp->dm_flags & DT_DM_LOADED)
+		return (0); /* module is already loaded */
+
+	dmp->dm_ctdata.cts_name = ".SUNW_ctf";
+	dmp->dm_ctdata.cts_type = SHT_PROGBITS;
+	dmp->dm_ctdata.cts_flags = 0;
+	dmp->dm_ctdata.cts_data = NULL;
+	dmp->dm_ctdata.cts_size = 0;
+	dmp->dm_ctdata.cts_entsize = 0;
+	dmp->dm_ctdata.cts_offset = 0;
+
+	dmp->dm_symtab.cts_name = ".symtab";
+	dmp->dm_symtab.cts_type = SHT_SYMTAB;
+	dmp->dm_symtab.cts_flags = 0;
+	dmp->dm_symtab.cts_data = NULL;
+	dmp->dm_symtab.cts_size = 0;
+	dmp->dm_symtab.cts_entsize = dmp->dm_ops == &dt_modops_64 ?
+	    sizeof (Elf64_Sym) : sizeof (Elf32_Sym);
+	dmp->dm_symtab.cts_offset = 0;
+
+	dmp->dm_strtab.cts_name = ".strtab";
+	dmp->dm_strtab.cts_type = SHT_STRTAB;
+	dmp->dm_strtab.cts_flags = 0;
+	dmp->dm_strtab.cts_data = NULL;
+	dmp->dm_strtab.cts_size = 0;
+	dmp->dm_strtab.cts_entsize = 0;
+	dmp->dm_strtab.cts_offset = 0;
+
+	/*
+	 * Attempt to load the module's CTF section, symbol table section, and
+	 * string table section.  Note that modules may not contain CTF data:
+	 * this will result in a successful load_sect but data of size zero.
+	 * We will then fail if dt_module_getctf() is called, as shown below.
+	 */
+	if (dt_module_load_sect(dtp, dmp, &dmp->dm_ctdata) == -1 ||
+	    dt_module_load_sect(dtp, dmp, &dmp->dm_symtab) == -1 ||
+	    dt_module_load_sect(dtp, dmp, &dmp->dm_strtab) == -1) {
+		dt_module_unload(dtp, dmp);
+		return (-1); /* dt_errno is set for us */
+	}
+
+	/*
+	 * Allocate the hash chains and hash buckets for symbol name lookup.
+	 * This is relatively simple since the symbol table is of fixed size
+	 * and is known in advance.  We allocate one extra element since we
+	 * use element indices instead of pointers and zero is our sentinel.
+	 */
+	dmp->dm_nsymelems =
+	    VBDTCAST(uint_t)(dmp->dm_symtab.cts_size / dmp->dm_symtab.cts_entsize);
+
+	dmp->dm_nsymbuckets = _dtrace_strbuckets;
+	dmp->dm_symfree = 1;		/* first free element is index 1 */
+
+	dmp->dm_symbuckets = malloc(sizeof (uint_t) * dmp->dm_nsymbuckets);
+	dmp->dm_symchains = malloc(sizeof (dt_sym_t) * dmp->dm_nsymelems + 1);
+
+	if (dmp->dm_symbuckets == NULL || dmp->dm_symchains == NULL) {
+		dt_module_unload(dtp, dmp);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	bzero(dmp->dm_symbuckets, sizeof (uint_t) * dmp->dm_nsymbuckets);
+	bzero(dmp->dm_symchains, sizeof (dt_sym_t) * dmp->dm_nsymelems + 1);
+
+	/*
+	 * Iterate over the symbol table data buffer and insert each symbol
+	 * name into the name hash if the name and type are valid.  Then
+	 * allocate the address map, fill it in, and sort it.
+	 */
+	dmp->dm_asrsv = dmp->dm_ops->do_syminit(dmp);
+
+	dt_dprintf("hashed %s [%s] (%u symbols)\n",
+	    dmp->dm_name, dmp->dm_symtab.cts_name, dmp->dm_symfree - 1);
+
+	if ((dmp->dm_asmap = malloc(sizeof (void *) * dmp->dm_asrsv)) == NULL) {
+		dt_module_unload(dtp, dmp);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	dmp->dm_ops->do_symsort(dmp);
+
+	dt_dprintf("sorted %s [%s] (%u symbols)\n",
+	    dmp->dm_name, dmp->dm_symtab.cts_name, dmp->dm_aslen);
+
+	dmp->dm_flags |= DT_DM_LOADED;
+	return (0);
+}
+
+ctf_file_t *
+dt_module_getctf(dtrace_hdl_t *dtp, dt_module_t *dmp)
+{
+	const char *parent;
+	dt_module_t *pmp;
+	ctf_file_t *pfp;
+	int model;
+
+	if (dmp->dm_ctfp != NULL || dt_module_load(dtp, dmp) != 0)
+		return (dmp->dm_ctfp);
+
+	if (dmp->dm_ops == &dt_modops_64)
+		model = CTF_MODEL_LP64;
+	else
+		model = CTF_MODEL_ILP32;
+
+	/*
+	 * If the data model of the module does not match our program data
+	 * model, then do not permit CTF from this module to be opened and
+	 * returned to the compiler.  If we support mixed data models in the
+	 * future for combined kernel/user tracing, this can be removed.
+	 */
+	if (dtp->dt_conf.dtc_ctfmodel != model) {
+		(void) dt_set_errno(dtp, EDT_DATAMODEL);
+		return (NULL);
+	}
+
+	if (dmp->dm_ctdata.cts_size == 0) {
+		(void) dt_set_errno(dtp, EDT_NOCTF);
+		return (NULL);
+	}
+
+	dmp->dm_ctfp = ctf_bufopen(&dmp->dm_ctdata,
+	    &dmp->dm_symtab, &dmp->dm_strtab, &dtp->dt_ctferr);
+
+	if (dmp->dm_ctfp == NULL) {
+		(void) dt_set_errno(dtp, EDT_CTF);
+		return (NULL);
+	}
+
+	(void) ctf_setmodel(dmp->dm_ctfp, model);
+	ctf_setspecific(dmp->dm_ctfp, dmp);
+
+	if ((parent = ctf_parent_name(dmp->dm_ctfp)) != NULL) {
+		if ((pmp = dt_module_create(dtp, parent)) == NULL ||
+		    (pfp = dt_module_getctf(dtp, pmp)) == NULL) {
+			if (pmp == NULL)
+				(void) dt_set_errno(dtp, EDT_NOMEM);
+			goto err;
+		}
+
+		if (ctf_import(dmp->dm_ctfp, pfp) == CTF_ERR) {
+			dtp->dt_ctferr = ctf_errno(dmp->dm_ctfp);
+			(void) dt_set_errno(dtp, EDT_CTF);
+			goto err;
+		}
+	}
+
+	dt_dprintf("loaded CTF container for %s (%p)\n",
+	    dmp->dm_name, (void *)dmp->dm_ctfp);
+
+	return (dmp->dm_ctfp);
+
+err:
+	ctf_close(dmp->dm_ctfp);
+	dmp->dm_ctfp = NULL;
+	return (NULL);
+}
+
+/*ARGSUSED*/
+void
+dt_module_unload(dtrace_hdl_t *dtp, dt_module_t *dmp)
+{
+	ctf_close(dmp->dm_ctfp);
+	dmp->dm_ctfp = NULL;
+
+	bzero(&dmp->dm_ctdata, sizeof (ctf_sect_t));
+	bzero(&dmp->dm_symtab, sizeof (ctf_sect_t));
+	bzero(&dmp->dm_strtab, sizeof (ctf_sect_t));
+
+	if (dmp->dm_symbuckets != NULL) {
+		free(dmp->dm_symbuckets);
+		dmp->dm_symbuckets = NULL;
+	}
+
+	if (dmp->dm_symchains != NULL) {
+		free(dmp->dm_symchains);
+		dmp->dm_symchains = NULL;
+	}
+
+	if (dmp->dm_asmap != NULL) {
+		free(dmp->dm_asmap);
+		dmp->dm_asmap = NULL;
+	}
+
+	dmp->dm_symfree = 0;
+	dmp->dm_nsymbuckets = 0;
+	dmp->dm_nsymelems = 0;
+	dmp->dm_asrsv = 0;
+	dmp->dm_aslen = 0;
+
+	dmp->dm_text_va = 0/*NULL*/;
+	dmp->dm_text_size = 0;
+	dmp->dm_data_va = 0/*NULL*/;
+	dmp->dm_data_size = 0;
+	dmp->dm_bss_va = 0/*NULL*/;
+	dmp->dm_bss_size = 0;
+
+	if (dmp->dm_extern != NULL) {
+		dt_idhash_destroy(dmp->dm_extern);
+		dmp->dm_extern = NULL;
+	}
+
+#ifndef VBOX
+	(void) elf_end(dmp->dm_elf);
+	dmp->dm_elf = NULL;
+#endif
+
+	dmp->dm_flags &= ~DT_DM_LOADED;
+}
+
+void
+dt_module_destroy(dtrace_hdl_t *dtp, dt_module_t *dmp)
+{
+	uint_t h = dt_strtab_hash(dmp->dm_name, NULL) % dtp->dt_modbuckets;
+	dt_module_t **dmpp = &dtp->dt_mods[h];
+
+	dt_list_delete(&dtp->dt_modlist, dmp);
+	assert(dtp->dt_nmods != 0);
+	dtp->dt_nmods--;
+
+	/*
+	 * Now remove this module from its hash chain.  We expect to always
+	 * find the module on its hash chain, so in this loop we assert that
+	 * we don't run off the end of the list.
+	 */
+	while (*dmpp != dmp) {
+		dmpp = &((*dmpp)->dm_next);
+		assert(*dmpp != NULL);
+	}
+
+	*dmpp = dmp->dm_next;
+
+	dt_module_unload(dtp, dmp);
+	free(dmp);
+}
+
+/*
+ * Insert a new external symbol reference into the specified module.  The new
+ * symbol will be marked as undefined and is assigned a symbol index beyond
+ * any existing cached symbols from this module.  We use the ident's di_data
+ * field to store a pointer to a copy of the dtrace_syminfo_t for this symbol.
+ */
+dt_ident_t *
+dt_module_extern(dtrace_hdl_t *dtp, dt_module_t *dmp,
+    const char *name, const dtrace_typeinfo_t *tip)
+{
+	dtrace_syminfo_t *sip;
+	dt_ident_t *idp;
+	uint_t id;
+
+	if (dmp->dm_extern == NULL && (dmp->dm_extern = dt_idhash_create(
+	    "extern", NULL, dmp->dm_nsymelems, UINT_MAX)) == NULL) {
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+		return (NULL);
+	}
+
+	if (dt_idhash_nextid(dmp->dm_extern, &id) == -1) {
+		(void) dt_set_errno(dtp, EDT_SYMOFLOW);
+		return (NULL);
+	}
+
+	if ((sip = malloc(sizeof (dtrace_syminfo_t))) == NULL) {
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+		return (NULL);
+	}
+
+	idp = dt_idhash_insert(dmp->dm_extern, name, DT_IDENT_SYMBOL, 0, id,
+	    _dtrace_symattr, 0, &dt_idops_thaw, NULL, dtp->dt_gen);
+
+	if (idp == NULL) {
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+		free(sip);
+		return (NULL);
+	}
+
+	sip->dts_object = dmp->dm_name;
+	sip->dts_name = idp->di_name;
+	sip->dts_id = idp->di_id;
+
+	idp->di_data = sip;
+	idp->di_ctfp = tip->dtt_ctfp;
+	idp->di_type = tip->dtt_type;
+
+	return (idp);
+}
+
+const char *
+dt_module_modelname(dt_module_t *dmp)
+{
+	if (dmp->dm_ops == &dt_modops_64)
+		return ("64-bit");
+	else
+		return ("32-bit");
+}
+
+/*
+ * Update our module cache by adding an entry for the specified module 'name'.
+ * We create the dt_module_t and populate it using /system/object/<name>/.
+ */
+static void
+dt_module_update(dtrace_hdl_t *dtp, const char *name)
+{
+#ifndef VBOX
+	char fname[MAXPATHLEN];
+	struct stat64 st;
+	int fd, err, bits;
+
+	dt_module_t *dmp;
+	const char *s;
+	size_t shstrs;
+	GElf_Shdr sh;
+	Elf_Data *dp;
+	Elf_Scn *sp;
+
+	(void) snprintf(fname, sizeof (fname),
+	    "%s/%s/object", OBJFS_ROOT, name);
+
+	if ((fd = open(fname, O_RDONLY)) == -1 || fstat64(fd, &st) == -1 ||
+	    (dmp = dt_module_create(dtp, name)) == NULL) {
+		dt_dprintf("failed to open %s: %s\n", fname, strerror(errno));
+		(void) close(fd);
+		return;
+	}
+
+	/*
+	 * Since the module can unload out from under us (and /system/object
+	 * will return ENOENT), tell libelf to cook the entire file now and
+	 * then close the underlying file descriptor immediately.  If this
+	 * succeeds, we know that we can continue safely using dmp->dm_elf.
+	 */
+	dmp->dm_elf = elf_begin(fd, ELF_C_READ, NULL);
+	err = elf_cntl(dmp->dm_elf, ELF_C_FDREAD);
+	(void) close(fd);
+
+	if (dmp->dm_elf == NULL || err == -1 ||
+	    elf_getshdrstrndx(dmp->dm_elf, &shstrs) == -1) {
+		dt_dprintf("failed to load %s: %s\n",
+		    fname, elf_errmsg(elf_errno()));
+		dt_module_destroy(dtp, dmp);
+		return;
+	}
+
+	switch (gelf_getclass(dmp->dm_elf)) {
+	case ELFCLASS32:
+		dmp->dm_ops = &dt_modops_32;
+		bits = 32;
+		break;
+	case ELFCLASS64:
+		dmp->dm_ops = &dt_modops_64;
+		bits = 64;
+		break;
+	default:
+		dt_dprintf("failed to load %s: unknown ELF class\n", fname);
+		dt_module_destroy(dtp, dmp);
+		return;
+	}
+
+	/*
+	 * Iterate over the section headers locating various sections of
+	 * interest and use their attributes to flesh out the dt_module_t.
+	 */
+	for (sp = NULL; (sp = elf_nextscn(dmp->dm_elf, sp)) != NULL; ) {
+		if (gelf_getshdr(sp, &sh) == NULL || sh.sh_type == SHT_NULL ||
+		    (s = elf_strptr(dmp->dm_elf, shstrs, sh.sh_name)) == NULL)
+			continue; /* skip any malformed sections */
+
+		if (strcmp(s, ".text") == 0) {
+			dmp->dm_text_size = sh.sh_size;
+			dmp->dm_text_va = sh.sh_addr;
+		} else if (strcmp(s, ".data") == 0) {
+			dmp->dm_data_size = sh.sh_size;
+			dmp->dm_data_va = sh.sh_addr;
+		} else if (strcmp(s, ".bss") == 0) {
+			dmp->dm_bss_size = sh.sh_size;
+			dmp->dm_bss_va = sh.sh_addr;
+		} else if (strcmp(s, ".info") == 0 &&
+		    (dp = elf_getdata(sp, NULL)) != NULL) {
+			bcopy(dp->d_buf, &dmp->dm_info,
+			    MIN(sh.sh_size, sizeof (dmp->dm_info)));
+		} else if (strcmp(s, ".filename") == 0 &&
+		    (dp = elf_getdata(sp, NULL)) != NULL) {
+			(void) strlcpy(dmp->dm_file,
+			    dp->d_buf, sizeof (dmp->dm_file));
+		}
+	}
+
+	dmp->dm_flags |= DT_DM_KERNEL;
+	dmp->dm_modid = (int)OBJFS_MODID(st.st_ino);
+
+	if (dmp->dm_info.objfs_info_primary)
+		dmp->dm_flags |= DT_DM_PRIMARY;
+
+	dt_dprintf("opened %d-bit module %s (%s) [%d]\n",
+	    bits, dmp->dm_name, dmp->dm_file, dmp->dm_modid);
+#endif /* !VBOX */
+}
+
+/*
+ * Unload all the loaded modules and then refresh the module cache with the
+ * latest list of loaded modules and their address ranges.
+ */
+void
+dtrace_update(dtrace_hdl_t *dtp)
+{
+#ifndef VBOX
+	dt_module_t *dmp;
+	DIR *dirp;
+
+	for (dmp = dt_list_next(&dtp->dt_modlist);
+	    dmp != NULL; dmp = dt_list_next(dmp))
+		dt_module_unload(dtp, dmp);
+
+	/*
+	 * Open /system/object and attempt to create a libdtrace module for
+	 * each kernel module that is loaded on the current system.
+	 */
+	if (!(dtp->dt_oflags & DTRACE_O_NOSYS) &&
+	    (dirp = opendir(OBJFS_ROOT)) != NULL) {
+		struct dirent *dp;
+
+		while ((dp = readdir(dirp)) != NULL) {
+			if (dp->d_name[0] != '.')
+				dt_module_update(dtp, dp->d_name);
+		}
+
+		(void) closedir(dirp);
+	}
+#endif /* !VBOX */
+
+	/*
+	 * Look up all the macro identifiers and set di_id to the latest value.
+	 * This code collaborates with dt_lex.l on the use of di_id.  We will
+	 * need to implement something fancier if we need to support non-ints.
+	 */
+	dt_idhash_lookup(dtp->dt_macros, "egid")->di_id = getegid();
+	dt_idhash_lookup(dtp->dt_macros, "euid")->di_id = geteuid();
+	dt_idhash_lookup(dtp->dt_macros, "gid")->di_id = getgid();
+	dt_idhash_lookup(dtp->dt_macros, "pid")->di_id = getpid();
+	dt_idhash_lookup(dtp->dt_macros, "pgid")->di_id = getpgid(0);
+	dt_idhash_lookup(dtp->dt_macros, "ppid")->di_id = getppid();
+	dt_idhash_lookup(dtp->dt_macros, "projid")->di_id = getprojid();
+	dt_idhash_lookup(dtp->dt_macros, "sid")->di_id = getsid(0);
+	dt_idhash_lookup(dtp->dt_macros, "taskid")->di_id = gettaskid();
+	dt_idhash_lookup(dtp->dt_macros, "uid")->di_id = getuid();
+
+	/*
+	 * Cache the pointers to the modules representing the base executable
+	 * and the run-time linker in the dtrace client handle. Note that on
+	 * x86 krtld is folded into unix, so if we don't find it, use unix
+	 * instead.
+	 */
+	dtp->dt_exec = dt_module_lookup_by_name(dtp, "genunix");
+	dtp->dt_rtld = dt_module_lookup_by_name(dtp, "krtld");
+	if (dtp->dt_rtld == NULL)
+		dtp->dt_rtld = dt_module_lookup_by_name(dtp, "unix");
+
+	/*
+	 * If this is the first time we are initializing the module list,
+	 * remove the module for genunix from the module list and then move it
+	 * to the front of the module list.  We do this so that type and symbol
+	 * queries encounter genunix and thereby optimize for the common case
+	 * in dtrace_lookup_by_name() and dtrace_lookup_by_type(), below.
+	 */
+	if (dtp->dt_exec != NULL &&
+	    dtp->dt_cdefs == NULL && dtp->dt_ddefs == NULL) {
+		dt_list_delete(&dtp->dt_modlist, dtp->dt_exec);
+		dt_list_prepend(&dtp->dt_modlist, dtp->dt_exec);
+	}
+}
+
+static dt_module_t *
+dt_module_from_object(dtrace_hdl_t *dtp, const char *object)
+{
+	int err = EDT_NOMOD;
+	dt_module_t *dmp;
+
+	switch ((uintptr_t)object) {
+	case (uintptr_t)DTRACE_OBJ_EXEC:
+		dmp = dtp->dt_exec;
+		break;
+	case (uintptr_t)DTRACE_OBJ_RTLD:
+		dmp = dtp->dt_rtld;
+		break;
+	case (uintptr_t)DTRACE_OBJ_CDEFS:
+		dmp = dtp->dt_cdefs;
+		break;
+	case (uintptr_t)DTRACE_OBJ_DDEFS:
+		dmp = dtp->dt_ddefs;
+		break;
+	default:
+		dmp = dt_module_create(dtp, object);
+		err = EDT_NOMEM;
+	}
+
+	if (dmp == NULL)
+		(void) dt_set_errno(dtp, err);
+
+	return (dmp);
+}
+
+/*
+ * Exported interface to look up a symbol by name.  We return the GElf_Sym and
+ * complete symbol information for the matching symbol.
+ */
+int
+dtrace_lookup_by_name(dtrace_hdl_t *dtp, const char *object, const char *name,
+    GElf_Sym *symp, dtrace_syminfo_t *sip)
+{
+	dt_module_t *dmp;
+	dt_ident_t *idp;
+	uint_t n, id;
+	GElf_Sym sym;
+
+	uint_t mask = 0; /* mask of dt_module flags to match */
+	uint_t bits = 0; /* flag bits that must be present */
+
+	if (object != DTRACE_OBJ_EVERY &&
+	    object != DTRACE_OBJ_KMODS &&
+	    object != DTRACE_OBJ_UMODS) {
+		if ((dmp = dt_module_from_object(dtp, object)) == NULL)
+			return (-1); /* dt_errno is set for us */
+
+		if (dt_module_load(dtp, dmp) == -1)
+			return (-1); /* dt_errno is set for us */
+		n = 1;
+
+	} else {
+		if (object == DTRACE_OBJ_KMODS)
+			mask = bits = DT_DM_KERNEL;
+		else if (object == DTRACE_OBJ_UMODS)
+			mask = DT_DM_KERNEL;
+
+		dmp = dt_list_next(&dtp->dt_modlist);
+		n = dtp->dt_nmods;
+	}
+
+	if (symp == NULL)
+		symp = &sym;
+
+	for (; n > 0; n--, dmp = dt_list_next(dmp)) {
+		if ((dmp->dm_flags & mask) != bits)
+			continue; /* failed to match required attributes */
+
+		if (dt_module_load(dtp, dmp) == -1)
+			continue; /* failed to load symbol table */
+
+		if (dmp->dm_ops->do_symname(dmp, name, symp, &id) != NULL) {
+			if (sip != NULL) {
+				sip->dts_object = dmp->dm_name;
+				sip->dts_name = (const char *)
+				    dmp->dm_strtab.cts_data + symp->st_name;
+				sip->dts_id = id;
+			}
+			return (0);
+		}
+
+		if (dmp->dm_extern != NULL &&
+		    (idp = dt_idhash_lookup(dmp->dm_extern, name)) != NULL) {
+			if (symp != &sym) {
+				symp->st_name = (uintptr_t)idp->di_name;
+				symp->st_info =
+				    GELF_ST_INFO(STB_GLOBAL, STT_NOTYPE);
+				symp->st_other = 0;
+				symp->st_shndx = SHN_UNDEF;
+				symp->st_value = 0;
+				symp->st_size =
+				    ctf_type_size(idp->di_ctfp, idp->di_type);
+			}
+
+			if (sip != NULL) {
+				sip->dts_object = dmp->dm_name;
+				sip->dts_name = idp->di_name;
+				sip->dts_id = idp->di_id;
+			}
+
+			return (0);
+		}
+	}
+
+	return (dt_set_errno(dtp, EDT_NOSYM));
+}
+
+/*
+ * Exported interface to look up a symbol by address.  We return the GElf_Sym
+ * and complete symbol information for the matching symbol.
+ */
+int
+dtrace_lookup_by_addr(dtrace_hdl_t *dtp, GElf_Addr addr,
+    GElf_Sym *symp, dtrace_syminfo_t *sip)
+{
+	dt_module_t *dmp;
+	uint_t id;
+	const dtrace_vector_t *v = dtp->dt_vector;
+
+	if (v != NULL)
+		return (v->dtv_lookup_by_addr(dtp->dt_varg, addr, symp, sip));
+
+	for (dmp = dt_list_next(&dtp->dt_modlist); dmp != NULL;
+	    dmp = dt_list_next(dmp)) {
+		if (addr - dmp->dm_text_va < dmp->dm_text_size ||
+		    addr - dmp->dm_data_va < dmp->dm_data_size ||
+		    addr - dmp->dm_bss_va < dmp->dm_bss_size)
+			break;
+	}
+
+	if (dmp == NULL)
+		return (dt_set_errno(dtp, EDT_NOSYMADDR));
+
+	if (dt_module_load(dtp, dmp) == -1)
+		return (-1); /* dt_errno is set for us */
+
+	if (symp != NULL) {
+		if (dmp->dm_ops->do_symaddr(dmp, addr, symp, &id) == NULL)
+			return (dt_set_errno(dtp, EDT_NOSYMADDR));
+	}
+
+	if (sip != NULL) {
+		sip->dts_object = dmp->dm_name;
+
+		if (symp != NULL) {
+			sip->dts_name = (const char *)
+			    dmp->dm_strtab.cts_data + symp->st_name;
+			sip->dts_id = id;
+		} else {
+			sip->dts_name = NULL;
+			sip->dts_id = 0;
+		}
+	}
+
+	return (0);
+}
+
+int
+dtrace_lookup_by_type(dtrace_hdl_t *dtp, const char *object, const char *name,
+    dtrace_typeinfo_t *tip)
+{
+	dtrace_typeinfo_t ti;
+	dt_module_t *dmp;
+	int found = 0;
+	ctf_id_t id;
+	uint_t n;
+	int justone;
+
+	uint_t mask = 0; /* mask of dt_module flags to match */
+	uint_t bits = 0; /* flag bits that must be present */
+
+	if (object != DTRACE_OBJ_EVERY &&
+	    object != DTRACE_OBJ_KMODS &&
+	    object != DTRACE_OBJ_UMODS) {
+		if ((dmp = dt_module_from_object(dtp, object)) == NULL)
+			return (-1); /* dt_errno is set for us */
+
+		if (dt_module_load(dtp, dmp) == -1)
+			return (-1); /* dt_errno is set for us */
+		n = 1;
+		justone = 1;
+
+	} else {
+		if (object == DTRACE_OBJ_KMODS)
+			mask = bits = DT_DM_KERNEL;
+		else if (object == DTRACE_OBJ_UMODS)
+			mask = DT_DM_KERNEL;
+
+		dmp = dt_list_next(&dtp->dt_modlist);
+		n = dtp->dt_nmods;
+		justone = 0;
+	}
+
+	if (tip == NULL)
+		tip = &ti;
+
+	for (; n > 0; n--, dmp = dt_list_next(dmp)) {
+		if ((dmp->dm_flags & mask) != bits)
+			continue; /* failed to match required attributes */
+
+		/*
+		 * If we can't load the CTF container, continue on to the next
+		 * module.  If our search was scoped to only one module then
+		 * return immediately leaving dt_errno unmodified.
+		 */
+		if (dt_module_getctf(dtp, dmp) == NULL) {
+			if (justone)
+				return (-1);
+			continue;
+		}
+
+		/*
+		 * Look up the type in the module's CTF container.  If our
+		 * match is a forward declaration tag, save this choice in
+		 * 'tip' and keep going in the hope that we will locate the
+		 * underlying structure definition.  Otherwise just return.
+		 */
+		if ((id = ctf_lookup_by_name(dmp->dm_ctfp, name)) != CTF_ERR) {
+			tip->dtt_object = dmp->dm_name;
+			tip->dtt_ctfp = dmp->dm_ctfp;
+			tip->dtt_type = id;
+
+			if (ctf_type_kind(dmp->dm_ctfp, ctf_type_resolve(
+			    dmp->dm_ctfp, id)) != CTF_K_FORWARD)
+				return (0);
+
+			found++;
+		}
+	}
+
+	if (found == 0)
+		return (dt_set_errno(dtp, EDT_NOTYPE));
+
+	return (0);
+}
+
+int
+dtrace_symbol_type(dtrace_hdl_t *dtp, const GElf_Sym *symp,
+    const dtrace_syminfo_t *sip, dtrace_typeinfo_t *tip)
+{
+	dt_module_t *dmp;
+
+	tip->dtt_object = NULL;
+	tip->dtt_ctfp = NULL;
+	tip->dtt_type = CTF_ERR;
+
+	if ((dmp = dt_module_lookup_by_name(dtp, sip->dts_object)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMOD));
+
+	if (symp->st_shndx == SHN_UNDEF && dmp->dm_extern != NULL) {
+		dt_ident_t *idp =
+		    dt_idhash_lookup(dmp->dm_extern, sip->dts_name);
+
+		if (idp == NULL)
+			return (dt_set_errno(dtp, EDT_NOSYM));
+
+		tip->dtt_ctfp = idp->di_ctfp;
+		tip->dtt_type = idp->di_type;
+
+	} else if (GELF_ST_TYPE(symp->st_info) != STT_FUNC) {
+		if (dt_module_getctf(dtp, dmp) == NULL)
+			return (-1); /* errno is set for us */
+
+		tip->dtt_ctfp = dmp->dm_ctfp;
+		tip->dtt_type = ctf_lookup_by_symbol(dmp->dm_ctfp, sip->dts_id);
+
+		if (tip->dtt_type == CTF_ERR) {
+			dtp->dt_ctferr = ctf_errno(tip->dtt_ctfp);
+			return (dt_set_errno(dtp, EDT_CTF));
+		}
+
+	} else {
+		tip->dtt_ctfp = DT_FPTR_CTFP(dtp);
+		tip->dtt_type = DT_FPTR_TYPE(dtp);
+	}
+
+	tip->dtt_object = dmp->dm_name;
+	return (0);
+}
+
+static dtrace_objinfo_t *
+dt_module_info(const dt_module_t *dmp, dtrace_objinfo_t *dto)
+{
+	dto->dto_name = dmp->dm_name;
+	dto->dto_file = dmp->dm_file;
+	dto->dto_id = dmp->dm_modid;
+	dto->dto_flags = 0;
+
+	if (dmp->dm_flags & DT_DM_KERNEL)
+		dto->dto_flags |= DTRACE_OBJ_F_KERNEL;
+	if (dmp->dm_flags & DT_DM_PRIMARY)
+		dto->dto_flags |= DTRACE_OBJ_F_PRIMARY;
+
+	dto->dto_text_va = dmp->dm_text_va;
+	dto->dto_text_size = dmp->dm_text_size;
+	dto->dto_data_va = dmp->dm_data_va;
+	dto->dto_data_size = dmp->dm_data_size;
+	dto->dto_bss_va = dmp->dm_bss_va;
+	dto->dto_bss_size = dmp->dm_bss_size;
+
+	return (dto);
+}
+
+int
+dtrace_object_iter(dtrace_hdl_t *dtp, dtrace_obj_f *func, void *data)
+{
+	const dt_module_t *dmp = dt_list_next(&dtp->dt_modlist);
+	dtrace_objinfo_t dto;
+	int rv;
+
+	for (; dmp != NULL; dmp = dt_list_next(dmp)) {
+		if ((rv = (*func)(dtp, dt_module_info(dmp, &dto), data)) != 0)
+			return (rv);
+	}
+
+	return (0);
+}
+
+int
+dtrace_object_info(dtrace_hdl_t *dtp, const char *object, dtrace_objinfo_t *dto)
+{
+	dt_module_t *dmp;
+
+	if (object == DTRACE_OBJ_EVERY || object == DTRACE_OBJ_KMODS ||
+	    object == DTRACE_OBJ_UMODS || dto == NULL)
+		return (dt_set_errno(dtp, EINVAL));
+
+	if ((dmp = dt_module_from_object(dtp, object)) == NULL)
+		return (-1); /* dt_errno is set for us */
+
+	if (dt_module_load(dtp, dmp) == -1)
+		return (-1); /* dt_errno is set for us */
+
+	(void) dt_module_info(dmp, dto);
+	return (0);
+}
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_module.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_module.h
new file mode 100644
index 0000000..bf6cede
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_module.h
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_MODULE_H
+#define	_DT_MODULE_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <dt_impl.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+extern dt_module_t *dt_module_create(dtrace_hdl_t *, const char *);
+extern int dt_module_load(dtrace_hdl_t *, dt_module_t *);
+extern void dt_module_unload(dtrace_hdl_t *, dt_module_t *);
+extern void dt_module_destroy(dtrace_hdl_t *, dt_module_t *);
+
+extern dt_module_t *dt_module_lookup_by_name(dtrace_hdl_t *, const char *);
+extern dt_module_t *dt_module_lookup_by_ctf(dtrace_hdl_t *, ctf_file_t *);
+
+extern ctf_file_t *dt_module_getctf(dtrace_hdl_t *, dt_module_t *);
+extern dt_ident_t *dt_module_extern(dtrace_hdl_t *, dt_module_t *,
+    const char *, const dtrace_typeinfo_t *);
+
+extern const char *dt_module_modelname(dt_module_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_MODULE_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_open.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_open.c
new file mode 100644
index 0000000..92fe6f3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_open.c
@@ -0,0 +1,1498 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <sys/types.h>
+#include <sys/modctl.h>
+#include <sys/systeminfo.h>
+
+#include <libelf.h>
+#include <strings.h>
+#include <alloca.h>
+#include <limits.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <assert.h>
+
+#ifndef _MSC_VER
+# define	_POSIX_PTHREAD_SEMANTICS
+# include <dirent.h>
+# undef	_POSIX_PTHREAD_SEMANTICS
+#endif
+
+#else  /* VBOX */
+# ifndef _MSC_VER
+# include <sys/resource.h>
+# include <unistd.h>
+# else
+# include <io.h>
+# endif
+# include <VBox/sup.h>
+# include <VBox/err.h>
+# include <iprt/path.h>
+# include <iprt/stream.h>
+#endif /* VBOX */
+
+#include <dt_impl.h>
+#include <dt_program.h>
+#include <dt_module.h>
+#include <dt_printf.h>
+#include <dt_string.h>
+#include <dt_provider.h>
+
+/*
+ * Stability and versioning definitions.  These #defines are used in the tables
+ * of identifiers below to fill in the attribute and version fields associated
+ * with each identifier.  The DT_ATTR_* macros are a convenience to permit more
+ * concise declarations of common attributes such as Stable/Stable/Common.  The
+ * DT_VERS_* macros declare the encoded integer values of all versions used so
+ * far.  DT_VERS_LATEST must correspond to the latest version value among all
+ * versions exported by the D compiler.  DT_VERS_STRING must be an ASCII string
+ * that contains DT_VERS_LATEST within it along with any suffixes (e.g. Beta).
+ * You must update DT_VERS_LATEST and DT_VERS_STRING when adding a new version,
+ * and then add the new version to the _dtrace_versions[] array declared below.
+ * Refer to the Solaris Dynamic Tracing Guide Stability and Versioning chapters
+ * respectively for an explanation of these DTrace features and their values.
+ *
+ * NOTE: Although the DTrace versioning scheme supports the labeling and
+ *       introduction of incompatible changes (e.g. dropping an interface in a
+ *       major release), the libdtrace code does not currently support this.
+ *       All versions are assumed to strictly inherit from one another.  If
+ *       we ever need to provide divergent interfaces, this will need work.
+ */
+#define	DT_ATTR_STABCMN	{ DTRACE_STABILITY_STABLE, \
+	DTRACE_STABILITY_STABLE, DTRACE_CLASS_COMMON }
+
+#define	DT_ATTR_EVOLCMN { DTRACE_STABILITY_EVOLVING, \
+	DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON \
+}
+
+/*
+ * The version number should be increased for every customer visible release
+ * of Solaris. The major number should be incremented when a fundamental
+ * change has been made that would affect all consumers, and would reflect
+ * sweeping changes to DTrace or the D language. The minor number should be
+ * incremented when a change is introduced that could break scripts that had
+ * previously worked; for example, adding a new built-in variable could break
+ * a script which was already using that identifier. The micro number should
+ * be changed when introducing functionality changes or major bug fixes that
+ * do not affect backward compatibility -- this is merely to make capabilities
+ * easily determined from the version number. Minor bugs do not require any
+ * modification to the version number.
+ */
+#define	DT_VERS_1_0	DT_VERSION_NUMBER(1, 0, 0)
+#define	DT_VERS_1_1	DT_VERSION_NUMBER(1, 1, 0)
+#define	DT_VERS_1_2	DT_VERSION_NUMBER(1, 2, 0)
+#define	DT_VERS_1_2_1	DT_VERSION_NUMBER(1, 2, 1)
+#define	DT_VERS_1_2_2	DT_VERSION_NUMBER(1, 2, 2)
+#define	DT_VERS_1_3	DT_VERSION_NUMBER(1, 3, 0)
+#define	DT_VERS_1_4	DT_VERSION_NUMBER(1, 4, 0)
+#define	DT_VERS_1_4_1	DT_VERSION_NUMBER(1, 4, 1)
+#define	DT_VERS_1_5	DT_VERSION_NUMBER(1, 5, 0)
+#define	DT_VERS_1_6	DT_VERSION_NUMBER(1, 6, 0)
+#define	DT_VERS_1_6_1	DT_VERSION_NUMBER(1, 6, 1)
+#define	DT_VERS_1_6_2	DT_VERSION_NUMBER(1, 6, 2)
+#define	DT_VERS_1_6_3	DT_VERSION_NUMBER(1, 6, 3)
+#define	DT_VERS_LATEST	DT_VERS_1_6_3
+#define	DT_VERS_STRING	"Sun D 1.6.3"
+
+const dt_version_t _dtrace_versions[] = {
+	DT_VERS_1_0,	/* D API 1.0.0 (PSARC 2001/466) Solaris 10 FCS */
+	DT_VERS_1_1,	/* D API 1.1.0 Solaris Express 6/05 */
+	DT_VERS_1_2,	/* D API 1.2.0 Solaris 10 Update 1 */
+	DT_VERS_1_2_1,	/* D API 1.2.1 Solaris Express 4/06 */
+	DT_VERS_1_2_2,	/* D API 1.2.2 Solaris Express 6/06 */
+	DT_VERS_1_3,	/* D API 1.3 Solaris Express 10/06 */
+	DT_VERS_1_4,	/* D API 1.4 Solaris Express 2/07 */
+	DT_VERS_1_4_1,	/* D API 1.4.1 Solaris Express 4/07 */
+	DT_VERS_1_5,	/* D API 1.5 Solaris Express 7/07 */
+	DT_VERS_1_6,	/* D API 1.6 */
+	DT_VERS_1_6_1,	/* D API 1.6.1 */
+	DT_VERS_1_6_2,	/* D API 1.6.2 */
+	DT_VERS_1_6_3,	/* D API 1.6.3 */
+	0
+};
+
+/*
+ * Table of global identifiers.  This is used to populate the global identifier
+ * hash when a new dtrace client open occurs.  For more info see dt_ident.h.
+ * The global identifiers that represent functions use the dt_idops_func ops
+ * and specify the private data pointer as a prototype string which is parsed
+ * when the identifier is first encountered.  These prototypes look like ANSI
+ * C function prototypes except that the special symbol "@" can be used as a
+ * wildcard to represent a single parameter of any type (i.e. any dt_node_t).
+ * The standard "..." notation can also be used to represent varargs.  An empty
+ * parameter list is taken to mean void (that is, no arguments are permitted).
+ * A parameter enclosed in square brackets (e.g. "[int]") denotes an optional
+ * argument.
+ */
+static const dt_ident_t _dtrace_globals[] = {
+{ "alloca", DT_IDENT_FUNC, 0, DIF_SUBR_ALLOCA, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void *(size_t)" },
+{ "arg0", DT_IDENT_SCALAR, 0, DIF_VAR_ARG0, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg1", DT_IDENT_SCALAR, 0, DIF_VAR_ARG1, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg2", DT_IDENT_SCALAR, 0, DIF_VAR_ARG2, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg3", DT_IDENT_SCALAR, 0, DIF_VAR_ARG3, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg4", DT_IDENT_SCALAR, 0, DIF_VAR_ARG4, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg5", DT_IDENT_SCALAR, 0, DIF_VAR_ARG5, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg6", DT_IDENT_SCALAR, 0, DIF_VAR_ARG6, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg7", DT_IDENT_SCALAR, 0, DIF_VAR_ARG7, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg8", DT_IDENT_SCALAR, 0, DIF_VAR_ARG8, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "arg9", DT_IDENT_SCALAR, 0, DIF_VAR_ARG9, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "args", DT_IDENT_ARRAY, 0, DIF_VAR_ARGS, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_args, NULL },
+{ "avg", DT_IDENT_AGGFUNC, 0, DTRACEAGG_AVG, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@)" },
+{ "basename", DT_IDENT_FUNC, 0, DIF_SUBR_BASENAME, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "string(const char *)" },
+{ "bcopy", DT_IDENT_FUNC, 0, DIF_SUBR_BCOPY, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(void *, void *, size_t)" },
+{ "breakpoint", DT_IDENT_ACTFUNC, 0, DT_ACT_BREAKPOINT,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void()" },
+{ "caller", DT_IDENT_SCALAR, 0, DIF_VAR_CALLER, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "uintptr_t" },
+{ "chill", DT_IDENT_ACTFUNC, 0, DT_ACT_CHILL, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(int)" },
+{ "cleanpath", DT_IDENT_FUNC, 0, DIF_SUBR_CLEANPATH, DT_ATTR_STABCMN,
+	DT_VERS_1_0, &dt_idops_func, "string(const char *)" },
+{ "clear", DT_IDENT_ACTFUNC, 0, DT_ACT_CLEAR, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(...)" },
+{ "commit", DT_IDENT_ACTFUNC, 0, DT_ACT_COMMIT, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(int)" },
+{ "copyin", DT_IDENT_FUNC, 0, DIF_SUBR_COPYIN, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void *(uintptr_t, size_t)" },
+{ "copyinstr", DT_IDENT_FUNC, 0, DIF_SUBR_COPYINSTR,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "string(uintptr_t, [size_t])" },
+{ "copyinto", DT_IDENT_FUNC, 0, DIF_SUBR_COPYINTO, DT_ATTR_STABCMN,
+	DT_VERS_1_0, &dt_idops_func, "void(uintptr_t, size_t, void *)" },
+{ "copyout", DT_IDENT_FUNC, 0, DIF_SUBR_COPYOUT, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(void *, uintptr_t, size_t)" },
+{ "copyoutstr", DT_IDENT_FUNC, 0, DIF_SUBR_COPYOUTSTR,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(char *, uintptr_t, size_t)" },
+{ "count", DT_IDENT_AGGFUNC, 0, DTRACEAGG_COUNT, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void()" },
+{ "curthread", DT_IDENT_SCALAR, 0, DIF_VAR_CURTHREAD,
+	{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_PRIVATE,
+	DTRACE_CLASS_COMMON }, DT_VERS_1_0,
+	&dt_idops_type, "genunix`kthread_t *" },
+{ "ddi_pathname", DT_IDENT_FUNC, 0, DIF_SUBR_DDI_PATHNAME,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "string(void *, int64_t)" },
+{ "denormalize", DT_IDENT_ACTFUNC, 0, DT_ACT_DENORMALIZE, DT_ATTR_STABCMN,
+	DT_VERS_1_0, &dt_idops_func, "void(...)" },
+{ "dirname", DT_IDENT_FUNC, 0, DIF_SUBR_DIRNAME, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "string(const char *)" },
+{ "discard", DT_IDENT_ACTFUNC, 0, DT_ACT_DISCARD, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(int)" },
+{ "epid", DT_IDENT_SCALAR, 0, DIF_VAR_EPID, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "uint_t" },
+{ "errno", DT_IDENT_SCALAR, 0, DIF_VAR_ERRNO, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int" },
+{ "execname", DT_IDENT_SCALAR, 0, DIF_VAR_EXECNAME,
+	DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
+{ "exit", DT_IDENT_ACTFUNC, 0, DT_ACT_EXIT, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(int)" },
+{ "freopen", DT_IDENT_ACTFUNC, 0, DT_ACT_FREOPEN, DT_ATTR_STABCMN,
+	DT_VERS_1_1, &dt_idops_func, "void(@, ...)" },
+{ "ftruncate", DT_IDENT_ACTFUNC, 0, DT_ACT_FTRUNCATE, DT_ATTR_STABCMN,
+	DT_VERS_1_0, &dt_idops_func, "void()" },
+{ "func", DT_IDENT_ACTFUNC, 0, DT_ACT_SYM, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_func, "_symaddr(uintptr_t)" },
+{ "getmajor", DT_IDENT_FUNC, 0, DIF_SUBR_GETMAJOR,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "genunix`major_t(genunix`dev_t)" },
+{ "getminor", DT_IDENT_FUNC, 0, DIF_SUBR_GETMINOR,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "genunix`minor_t(genunix`dev_t)" },
+{ "htonl", DT_IDENT_FUNC, 0, DIF_SUBR_HTONL, DT_ATTR_EVOLCMN, DT_VERS_1_3,
+	&dt_idops_func, "uint32_t(uint32_t)" },
+{ "htonll", DT_IDENT_FUNC, 0, DIF_SUBR_HTONLL, DT_ATTR_EVOLCMN, DT_VERS_1_3,
+	&dt_idops_func, "uint64_t(uint64_t)" },
+{ "htons", DT_IDENT_FUNC, 0, DIF_SUBR_HTONS, DT_ATTR_EVOLCMN, DT_VERS_1_3,
+	&dt_idops_func, "uint16_t(uint16_t)" },
+{ "gid", DT_IDENT_SCALAR, 0, DIF_VAR_GID, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "gid_t" },
+{ "id", DT_IDENT_SCALAR, 0, DIF_VAR_ID, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "uint_t" },
+{ "index", DT_IDENT_FUNC, 0, DIF_SUBR_INDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
+	&dt_idops_func, "int(const char *, const char *, [int])" },
+{ "inet_ntoa", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA, DT_ATTR_STABCMN,
+	DT_VERS_1_5, &dt_idops_func, "string(ipaddr_t *)" },
+{ "inet_ntoa6", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOA6, DT_ATTR_STABCMN,
+	DT_VERS_1_5, &dt_idops_func, "string(in6_addr_t *)" },
+{ "inet_ntop", DT_IDENT_FUNC, 0, DIF_SUBR_INET_NTOP, DT_ATTR_STABCMN,
+	DT_VERS_1_5, &dt_idops_func, "string(int, void *)" },
+{ "ipl", DT_IDENT_SCALAR, 0, DIF_VAR_IPL, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "uint_t" },
+{ "jstack", DT_IDENT_ACTFUNC, 0, DT_ACT_JSTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "stack(...)" },
+{ "lltostr", DT_IDENT_FUNC, 0, DIF_SUBR_LLTOSTR, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "string(int64_t)" },
+{ "lquantize", DT_IDENT_AGGFUNC, 0, DTRACEAGG_LQUANTIZE,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@, int32_t, int32_t, ...)" },
+{ "max", DT_IDENT_AGGFUNC, 0, DTRACEAGG_MAX, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@)" },
+{ "min", DT_IDENT_AGGFUNC, 0, DTRACEAGG_MIN, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@)" },
+{ "mod", DT_IDENT_ACTFUNC, 0, DT_ACT_MOD, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_func, "_symaddr(uintptr_t)" },
+{ "msgdsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGDSIZE,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "size_t(mblk_t *)" },
+{ "msgsize", DT_IDENT_FUNC, 0, DIF_SUBR_MSGSIZE,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "size_t(mblk_t *)" },
+{ "mutex_owned", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNED,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "int(genunix`kmutex_t *)" },
+{ "mutex_owner", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_OWNER,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "genunix`kthread_t *(genunix`kmutex_t *)" },
+{ "mutex_type_adaptive", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_TYPE_ADAPTIVE,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "int(genunix`kmutex_t *)" },
+{ "mutex_type_spin", DT_IDENT_FUNC, 0, DIF_SUBR_MUTEX_TYPE_SPIN,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "int(genunix`kmutex_t *)" },
+{ "ntohl", DT_IDENT_FUNC, 0, DIF_SUBR_NTOHL, DT_ATTR_EVOLCMN, DT_VERS_1_3,
+	&dt_idops_func, "uint32_t(uint32_t)" },
+{ "ntohll", DT_IDENT_FUNC, 0, DIF_SUBR_NTOHLL, DT_ATTR_EVOLCMN, DT_VERS_1_3,
+	&dt_idops_func, "uint64_t(uint64_t)" },
+{ "ntohs", DT_IDENT_FUNC, 0, DIF_SUBR_NTOHS, DT_ATTR_EVOLCMN, DT_VERS_1_3,
+	&dt_idops_func, "uint16_t(uint16_t)" },
+{ "normalize", DT_IDENT_ACTFUNC, 0, DT_ACT_NORMALIZE, DT_ATTR_STABCMN,
+	DT_VERS_1_0, &dt_idops_func, "void(...)" },
+{ "panic", DT_IDENT_ACTFUNC, 0, DT_ACT_PANIC, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void()" },
+{ "pid", DT_IDENT_SCALAR, 0, DIF_VAR_PID, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "pid_t" },
+{ "ppid", DT_IDENT_SCALAR, 0, DIF_VAR_PPID, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "pid_t" },
+{ "printa", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTA, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@, ...)" },
+{ "printf", DT_IDENT_ACTFUNC, 0, DT_ACT_PRINTF, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@, ...)" },
+{ "probefunc", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEFUNC,
+	DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
+{ "probemod", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEMOD,
+	DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
+{ "probename", DT_IDENT_SCALAR, 0, DIF_VAR_PROBENAME,
+	DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
+{ "probeprov", DT_IDENT_SCALAR, 0, DIF_VAR_PROBEPROV,
+	DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
+{ "progenyof", DT_IDENT_FUNC, 0, DIF_SUBR_PROGENYOF,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "int(pid_t)" },
+{ "quantize", DT_IDENT_AGGFUNC, 0, DTRACEAGG_QUANTIZE,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@, ...)" },
+{ "raise", DT_IDENT_ACTFUNC, 0, DT_ACT_RAISE, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(int)" },
+{ "rand", DT_IDENT_FUNC, 0, DIF_SUBR_RAND, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "int()" },
+{ "rindex", DT_IDENT_FUNC, 0, DIF_SUBR_RINDEX, DT_ATTR_STABCMN, DT_VERS_1_1,
+	&dt_idops_func, "int(const char *, const char *, [int])" },
+{ "rw_iswriter", DT_IDENT_FUNC, 0, DIF_SUBR_RW_ISWRITER,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "int(genunix`krwlock_t *)" },
+{ "rw_read_held", DT_IDENT_FUNC, 0, DIF_SUBR_RW_READ_HELD,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "int(genunix`krwlock_t *)" },
+{ "rw_write_held", DT_IDENT_FUNC, 0, DIF_SUBR_RW_WRITE_HELD,
+	DT_ATTR_EVOLCMN, DT_VERS_1_0,
+	&dt_idops_func, "int(genunix`krwlock_t *)" },
+{ "self", DT_IDENT_PTR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "void" },
+{ "setopt", DT_IDENT_ACTFUNC, 0, DT_ACT_SETOPT, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_func, "void(const char *, [const char *])" },
+{ "speculate", DT_IDENT_ACTFUNC, 0, DT_ACT_SPECULATE,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(int)" },
+{ "speculation", DT_IDENT_FUNC, 0, DIF_SUBR_SPECULATION,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "int()" },
+{ "stack", DT_IDENT_ACTFUNC, 0, DT_ACT_STACK, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "stack(...)" },
+{ "stackdepth", DT_IDENT_SCALAR, 0, DIF_VAR_STACKDEPTH,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "uint32_t" },
+{ "stddev", DT_IDENT_AGGFUNC, 0, DTRACEAGG_STDDEV, DT_ATTR_STABCMN,
+	DT_VERS_1_6, &dt_idops_func, "void(@)" },
+{ "stop", DT_IDENT_ACTFUNC, 0, DT_ACT_STOP, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void()" },
+{ "strchr", DT_IDENT_FUNC, 0, DIF_SUBR_STRCHR, DT_ATTR_STABCMN, DT_VERS_1_1,
+	&dt_idops_func, "string(const char *, char)" },
+{ "strlen", DT_IDENT_FUNC, 0, DIF_SUBR_STRLEN, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "size_t(const char *)" },
+{ "strjoin", DT_IDENT_FUNC, 0, DIF_SUBR_STRJOIN, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "string(const char *, const char *)" },
+{ "strrchr", DT_IDENT_FUNC, 0, DIF_SUBR_STRRCHR, DT_ATTR_STABCMN, DT_VERS_1_1,
+	&dt_idops_func, "string(const char *, char)" },
+{ "strstr", DT_IDENT_FUNC, 0, DIF_SUBR_STRSTR, DT_ATTR_STABCMN, DT_VERS_1_1,
+	&dt_idops_func, "string(const char *, const char *)" },
+{ "strtok", DT_IDENT_FUNC, 0, DIF_SUBR_STRTOK, DT_ATTR_STABCMN, DT_VERS_1_1,
+	&dt_idops_func, "string(const char *, const char *)" },
+{ "substr", DT_IDENT_FUNC, 0, DIF_SUBR_SUBSTR, DT_ATTR_STABCMN, DT_VERS_1_1,
+	&dt_idops_func, "string(const char *, int, [int])" },
+{ "sum", DT_IDENT_AGGFUNC, 0, DTRACEAGG_SUM, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@)" },
+{ "sym", DT_IDENT_ACTFUNC, 0, DT_ACT_SYM, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_func, "_symaddr(uintptr_t)" },
+{ "system", DT_IDENT_ACTFUNC, 0, DT_ACT_SYSTEM, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@, ...)" },
+{ "this", DT_IDENT_PTR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "void" },
+{ "tid", DT_IDENT_SCALAR, 0, DIF_VAR_TID, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "id_t" },
+{ "timestamp", DT_IDENT_SCALAR, 0, DIF_VAR_TIMESTAMP,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "uint64_t" },
+{ "trace", DT_IDENT_ACTFUNC, 0, DT_ACT_TRACE, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@)" },
+{ "tracemem", DT_IDENT_ACTFUNC, 0, DT_ACT_TRACEMEM,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "void(@, size_t)" },
+{ "trunc", DT_IDENT_ACTFUNC, 0, DT_ACT_TRUNC, DT_ATTR_STABCMN,
+	DT_VERS_1_0, &dt_idops_func, "void(...)" },
+{ "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
+{ "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_type, "uint64_t" },
+{ "ufunc", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
+{ "uid", DT_IDENT_SCALAR, 0, DIF_VAR_UID, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "uid_t" },
+{ "umod", DT_IDENT_ACTFUNC, 0, DT_ACT_UMOD, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
+{ "uregs", DT_IDENT_ARRAY, 0, DIF_VAR_UREGS, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_regs, NULL },
+{ "ustack", DT_IDENT_ACTFUNC, 0, DT_ACT_USTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_func, "stack(...)" },
+{ "ustackdepth", DT_IDENT_SCALAR, 0, DIF_VAR_USTACKDEPTH,
+	DT_ATTR_STABCMN, DT_VERS_1_2,
+	&dt_idops_type, "uint32_t" },
+{ "usym", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN,
+	DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
+{ "vtimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_VTIMESTAMP,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "uint64_t" },
+{ "walltimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_WALLTIMESTAMP,
+	DT_ATTR_STABCMN, DT_VERS_1_0,
+	&dt_idops_type, "int64_t" },
+{ "zonename", DT_IDENT_SCALAR, 0, DIF_VAR_ZONENAME,
+	DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_type, "string" },
+{ NULL, 0, 0, 0, { 0, 0, 0 }, 0, NULL, NULL }
+};
+
+/*
+ * Tables of ILP32 intrinsic integer and floating-point type templates to use
+ * to populate the dynamic "C" CTF type container.
+ */
+static const dt_intrinsic_t _dtrace_intrinsics_32[] = {
+{ "void", { CTF_INT_SIGNED, 0, 0 }, CTF_K_INTEGER },
+{ "signed", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "char", { CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "short", { CTF_INT_SIGNED, 0, 16 }, CTF_K_INTEGER },
+{ "int", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "long", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "long long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "signed char", { CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "signed short", { CTF_INT_SIGNED, 0, 16 }, CTF_K_INTEGER },
+{ "signed int", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "signed long", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "signed long long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "unsigned char", { CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "unsigned short", { 0, 0, 16 }, CTF_K_INTEGER },
+{ "unsigned int", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned long", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned long long", { 0, 0, 64 }, CTF_K_INTEGER },
+{ "_Bool", { CTF_INT_BOOL, 0, 8 }, CTF_K_INTEGER },
+{ "float", { CTF_FP_SINGLE, 0, 32 }, CTF_K_FLOAT },
+{ "double", { CTF_FP_DOUBLE, 0, 64 }, CTF_K_FLOAT },
+{ "long double", { CTF_FP_LDOUBLE, 0, 128 }, CTF_K_FLOAT },
+{ "float imaginary", { CTF_FP_IMAGRY, 0, 32 }, CTF_K_FLOAT },
+{ "double imaginary", { CTF_FP_DIMAGRY, 0, 64 }, CTF_K_FLOAT },
+{ "long double imaginary", { CTF_FP_LDIMAGRY, 0, 128 }, CTF_K_FLOAT },
+{ "float complex", { CTF_FP_CPLX, 0, 64 }, CTF_K_FLOAT },
+{ "double complex", { CTF_FP_DCPLX, 0, 128 }, CTF_K_FLOAT },
+{ "long double complex", { CTF_FP_LDCPLX, 0, 256 }, CTF_K_FLOAT },
+{ NULL, { 0, 0, 0 }, 0 }
+};
+
+/*
+ * Tables of LP64 intrinsic integer and floating-point type templates to use
+ * to populate the dynamic "C" CTF type container.
+ */
+static const dt_intrinsic_t _dtrace_intrinsics_64[] = {
+{ "void", { CTF_INT_SIGNED, 0, 0 }, CTF_K_INTEGER },
+{ "signed", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "char", { CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "short", { CTF_INT_SIGNED, 0, 16 }, CTF_K_INTEGER },
+{ "int", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "long long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "signed char", { CTF_INT_SIGNED | CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "signed short", { CTF_INT_SIGNED, 0, 16 }, CTF_K_INTEGER },
+{ "signed int", { CTF_INT_SIGNED, 0, 32 }, CTF_K_INTEGER },
+{ "signed long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "signed long long", { CTF_INT_SIGNED, 0, 64 }, CTF_K_INTEGER },
+{ "unsigned char", { CTF_INT_CHAR, 0, 8 }, CTF_K_INTEGER },
+{ "unsigned short", { 0, 0, 16 }, CTF_K_INTEGER },
+{ "unsigned int", { 0, 0, 32 }, CTF_K_INTEGER },
+{ "unsigned long", { 0, 0, 64 }, CTF_K_INTEGER },
+{ "unsigned long long", { 0, 0, 64 }, CTF_K_INTEGER },
+{ "_Bool", { CTF_INT_BOOL, 0, 8 }, CTF_K_INTEGER },
+{ "float", { CTF_FP_SINGLE, 0, 32 }, CTF_K_FLOAT },
+{ "double", { CTF_FP_DOUBLE, 0, 64 }, CTF_K_FLOAT },
+{ "long double", { CTF_FP_LDOUBLE, 0, 128 }, CTF_K_FLOAT },
+{ "float imaginary", { CTF_FP_IMAGRY, 0, 32 }, CTF_K_FLOAT },
+{ "double imaginary", { CTF_FP_DIMAGRY, 0, 64 }, CTF_K_FLOAT },
+{ "long double imaginary", { CTF_FP_LDIMAGRY, 0, 128 }, CTF_K_FLOAT },
+{ "float complex", { CTF_FP_CPLX, 0, 64 }, CTF_K_FLOAT },
+{ "double complex", { CTF_FP_DCPLX, 0, 128 }, CTF_K_FLOAT },
+{ "long double complex", { CTF_FP_LDCPLX, 0, 256 }, CTF_K_FLOAT },
+{ NULL, { 0, 0, 0 }, 0 }
+};
+
+/*
+ * Tables of ILP32 typedefs to use to populate the dynamic "D" CTF container.
+ * These aliases ensure that D definitions can use typical <sys/types.h> names.
+ */
+static const dt_typedef_t _dtrace_typedefs_32[] = {
+{ "char", "int8_t" },
+{ "short", "int16_t" },
+{ "int", "int32_t" },
+{ "long long", "int64_t" },
+{ "int", "intptr_t" },
+{ "int", "ssize_t" },
+{ "unsigned char", "uint8_t" },
+{ "unsigned short", "uint16_t" },
+{ "unsigned", "uint32_t" },
+{ "unsigned long long", "uint64_t" },
+{ "unsigned char", "uchar_t" },
+{ "unsigned short", "ushort_t" },
+{ "unsigned", "uint_t" },
+{ "unsigned long", "ulong_t" },
+{ "unsigned long long", "u_longlong_t" },
+{ "int", "ptrdiff_t" },
+{ "unsigned", "uintptr_t" },
+{ "unsigned", "size_t" },
+{ "long", "id_t" },
+{ "long", "pid_t" },
+{ NULL, NULL }
+};
+
+/*
+ * Tables of LP64 typedefs to use to populate the dynamic "D" CTF container.
+ * These aliases ensure that D definitions can use typical <sys/types.h> names.
+ */
+static const dt_typedef_t _dtrace_typedefs_64[] = {
+{ "char", "int8_t" },
+{ "short", "int16_t" },
+{ "int", "int32_t" },
+{ "long", "int64_t" },
+{ "long", "intptr_t" },
+{ "long", "ssize_t" },
+{ "unsigned char", "uint8_t" },
+{ "unsigned short", "uint16_t" },
+{ "unsigned", "uint32_t" },
+{ "unsigned long", "uint64_t" },
+{ "unsigned char", "uchar_t" },
+{ "unsigned short", "ushort_t" },
+{ "unsigned", "uint_t" },
+{ "unsigned long", "ulong_t" },
+{ "unsigned long long", "u_longlong_t" },
+{ "long", "ptrdiff_t" },
+{ "unsigned long", "uintptr_t" },
+{ "unsigned long", "size_t" },
+{ "int", "id_t" },
+{ "int", "pid_t" },
+{ NULL, NULL }
+};
+
+/*
+ * Tables of ILP32 integer type templates used to populate the dtp->dt_ints[]
+ * cache when a new dtrace client open occurs.  Values are set by dtrace_open().
+ */
+static const dt_intdesc_t _dtrace_ints_32[] = {
+{ "int", NULL, CTF_ERR, 0x7fffffffULL },
+{ "unsigned int", NULL, CTF_ERR, 0xffffffffULL },
+{ "long", NULL, CTF_ERR, 0x7fffffffULL },
+{ "unsigned long", NULL, CTF_ERR, 0xffffffffULL },
+{ "long long", NULL, CTF_ERR, 0x7fffffffffffffffULL },
+{ "unsigned long long", NULL, CTF_ERR, 0xffffffffffffffffULL }
+};
+
+/*
+ * Tables of LP64 integer type templates used to populate the dtp->dt_ints[]
+ * cache when a new dtrace client open occurs.  Values are set by dtrace_open().
+ */
+static const dt_intdesc_t _dtrace_ints_64[] = {
+{ "int", NULL, CTF_ERR, 0x7fffffffULL },
+{ "unsigned int", NULL, CTF_ERR, 0xffffffffULL },
+{ "long", NULL, CTF_ERR, 0x7fffffffffffffffULL },
+{ "unsigned long", NULL, CTF_ERR, 0xffffffffffffffffULL },
+{ "long long", NULL, CTF_ERR, 0x7fffffffffffffffULL },
+{ "unsigned long long", NULL, CTF_ERR, 0xffffffffffffffffULL }
+};
+
+/*
+ * Table of macro variable templates used to populate the macro identifier hash
+ * when a new dtrace client open occurs.  Values are set by dtrace_update().
+ */
+static const dt_ident_t _dtrace_macros[] = {
+{ "egid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "euid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "gid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "pid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "pgid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "ppid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "projid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "sid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "taskid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "target", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ "uid", DT_IDENT_SCALAR, 0, 0, DT_ATTR_STABCMN, DT_VERS_1_0 },
+{ NULL, 0, 0, 0, { 0, 0, 0 }, 0 }
+};
+
+/*
+ * Hard-wired definition string to be compiled and cached every time a new
+ * DTrace library handle is initialized.  This string should only be used to
+ * contain definitions that should be present regardless of DTRACE_O_NOLIBS.
+ */
+static const char _dtrace_hardwire[] = "\
+inline long NULL = 0; \n\
+#pragma D binding \"1.0\" NULL\n\
+";
+
+/*
+ * Default DTrace configuration to use when opening libdtrace DTRACE_O_NODEV.
+ * If DTRACE_O_NODEV is not set, we load the configuration from the kernel.
+ * The use of CTF_MODEL_NATIVE is more subtle than it might appear: we are
+ * relying on the fact that when running dtrace(1M), isaexec will invoke the
+ * binary with the same bitness as the kernel, which is what we want by default
+ * when generating our DIF.  The user can override the choice using oflags.
+ */
+static const dtrace_conf_t _dtrace_conf = {
+	DIF_VERSION,		/* dtc_difversion */
+	DIF_DIR_NREGS,		/* dtc_difintregs */
+	DIF_DTR_NREGS,		/* dtc_diftupregs */
+	CTF_MODEL_NATIVE	/* dtc_ctfmodel */
+};
+
+const dtrace_attribute_t _dtrace_maxattr = {
+	DTRACE_STABILITY_MAX,
+	DTRACE_STABILITY_MAX,
+	DTRACE_CLASS_MAX
+};
+
+const dtrace_attribute_t _dtrace_defattr = {
+	DTRACE_STABILITY_STABLE,
+	DTRACE_STABILITY_STABLE,
+	DTRACE_CLASS_COMMON
+};
+
+const dtrace_attribute_t _dtrace_symattr = {
+	DTRACE_STABILITY_PRIVATE,
+	DTRACE_STABILITY_PRIVATE,
+	DTRACE_CLASS_UNKNOWN
+};
+
+const dtrace_attribute_t _dtrace_typattr = {
+	DTRACE_STABILITY_PRIVATE,
+	DTRACE_STABILITY_PRIVATE,
+	DTRACE_CLASS_UNKNOWN
+};
+
+const dtrace_attribute_t _dtrace_prvattr = {
+	DTRACE_STABILITY_PRIVATE,
+	DTRACE_STABILITY_PRIVATE,
+	DTRACE_CLASS_UNKNOWN
+};
+
+const dtrace_pattr_t _dtrace_prvdesc = {
+{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_COMMON },
+};
+
+const char *_dtrace_defcpp = "/usr/ccs/lib/cpp"; /* default cpp(1) to invoke */
+const char *_dtrace_defld = "/usr/ccs/bin/ld";   /* default ld(1) to invoke */
+
+const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */
+const char *_dtrace_provdir = "/dev/dtrace/provider"; /* provider directory */
+
+int _dtrace_strbuckets = 211;	/* default number of hash buckets (prime) */
+int _dtrace_intbuckets = 256;	/* default number of integer buckets (Pof2) */
+uint_t _dtrace_strsize = 256;	/* default size of string intrinsic type */
+uint_t _dtrace_stkindent = 14;	/* default whitespace indent for stack/ustack */
+uint_t _dtrace_pidbuckets = 64; /* default number of pid hash buckets */
+uint_t _dtrace_pidlrulim = 8;	/* default number of pid handles to cache */
+size_t _dtrace_bufsize = 512;	/* default dt_buf_create() size */
+int _dtrace_argmax = 32;	/* default maximum number of probe arguments */
+
+int _dtrace_debug = 0;		/* debug messages enabled (off) */
+const char *const _dtrace_version = DT_VERS_STRING; /* API version string */
+#ifndef VBOX
+int _dtrace_rdvers = RD_VERSION; /* rtld_db feature version */
+#endif
+
+typedef struct dt_fdlist {
+	int *df_fds;		/* array of provider driver file descriptors */
+	uint_t df_ents;		/* number of valid elements in df_fds[] */
+	uint_t df_size;		/* size of df_fds[] */
+} dt_fdlist_t;
+
+
+#ifdef VBOX
+# include <iprt/critsect.h>
+# include <libctf.h>
+extern RTCRITSECT dt_qsort_lock; /* dt_aggregate.c */
+
+void dtrace_init(void)
+#else  /* !VBOX */
+#pragma init(_dtrace_init)
+void
+_dtrace_init(void)
+#endif /* !VBOX */
+{
+	_dtrace_debug = getenv("DTRACE_DEBUG") != NULL;
+
+#ifndef VBOX
+	for (; _dtrace_rdvers > 0; _dtrace_rdvers--) {
+		if (rd_init(_dtrace_rdvers) == RD_OK)
+			break;
+	}
+#else
+
+	libctf_init();
+	RTCritSectInit(&dt_qsort_lock);
+#endif
+}
+
+static dtrace_hdl_t *
+set_open_errno(dtrace_hdl_t *dtp, int *errp, int err)
+{
+	if (dtp != NULL)
+		dtrace_close(dtp);
+	if (errp != NULL)
+		*errp = err;
+	return (NULL);
+}
+
+#ifndef VBOX
+static void
+dt_provmod_open(dt_provmod_t **provmod, dt_fdlist_t *dfp)
+{
+	dt_provmod_t *prov;
+	char path[PATH_MAX];
+	struct dirent *dp, *ep;
+	DIR *dirp;
+	int fd;
+
+	if ((dirp = opendir(_dtrace_provdir)) == NULL)
+		return; /* failed to open directory; just skip it */
+
+	ep = alloca(sizeof (struct dirent) + PATH_MAX + 1);
+	bzero(ep, sizeof (struct dirent) + PATH_MAX + 1);
+
+	while (readdir_r(dirp, ep, &dp) == 0 && dp != NULL) {
+		if (dp->d_name[0] == '.')
+			continue; /* skip "." and ".." */
+
+		if (dfp->df_ents == dfp->df_size) {
+			uint_t size = dfp->df_size ? dfp->df_size * 2 : 16;
+			int *fds = realloc(dfp->df_fds, size * sizeof (int));
+
+			if (fds == NULL)
+				break; /* skip the rest of this directory */
+
+			dfp->df_fds = fds;
+			dfp->df_size = size;
+		}
+
+		(void) snprintf(path, sizeof (path), "%s/%s",
+		    _dtrace_provdir, dp->d_name);
+
+		if ((fd = open(path, O_RDONLY)) == -1)
+			continue; /* failed to open driver; just skip it */
+
+		if (((prov = malloc(sizeof (dt_provmod_t))) == NULL) ||
+		    (prov->dp_name = malloc(strlen(dp->d_name) + 1)) == NULL) {
+			free(prov);
+			(void) close(fd);
+			break;
+		}
+
+		(void) strcpy(prov->dp_name, dp->d_name);
+		prov->dp_next = *provmod;
+		*provmod = prov;
+
+		dt_dprintf("opened provider %s\n", dp->d_name);
+		dfp->df_fds[dfp->df_ents++] = fd;
+	}
+
+	(void) closedir(dirp);
+}
+#endif /* !VBOX */
+
+static void
+dt_provmod_destroy(dt_provmod_t **provmod)
+{
+	dt_provmod_t *next, *current;
+
+	for (current = *provmod; current != NULL; current = next) {
+		next = current->dp_next;
+		free(current->dp_name);
+		free(current);
+	}
+
+	*provmod = NULL;
+}
+
+static const char *
+dt_get_sysinfo(int cmd, char *buf, size_t len)
+{
+#ifndef VBOX
+	ssize_t rv = sysinfo(cmd, buf, len);
+	char *p = buf;
+
+	if (rv < 0 || rv > len)
+		(void) snprintf(buf, len, "%s", "Unknown");
+
+	while ((p = strchr(p, '.')) != NULL)
+		*p++ = '_';
+#else
+	snprintf(buf, len, "%s", "Unknown");
+#endif
+	return (buf);
+}
+
+static dtrace_hdl_t *
+dt_vopen(int version, int flags, int *errp,
+    const dtrace_vector_t *vector, void *arg)
+{
+	dtrace_hdl_t *dtp = NULL;
+	int dtfd = -1, ftfd = -1, fterr = 0;
+	dtrace_prog_t *pgp;
+	dt_module_t *dmp;
+	dt_provmod_t *provmod = NULL;
+	int i, err;
+#ifndef _MSC_VER
+	struct rlimit rl;
+#endif
+
+	const dt_intrinsic_t *dinp;
+	const dt_typedef_t *dtyp;
+	const dt_ident_t *idp;
+
+	dtrace_typeinfo_t dtt;
+	ctf_funcinfo_t ctc;
+	ctf_arinfo_t ctr;
+
+#ifndef VBOX
+	dt_fdlist_t df = { NULL, 0, 0 };
+#endif
+
+	char isadef[32], utsdef[32];
+#ifndef VBOX
+	char s1[64], s2[64];
+#endif
+
+#ifdef VBOX
+	char szModPath[RTPATH_MAX];
+	void *pvImageBase;
+	int rc;
+#endif
+
+	if (version <= 0)
+		return (set_open_errno(dtp, errp, EINVAL));
+
+	if (version > DTRACE_VERSION)
+		return (set_open_errno(dtp, errp, EDT_VERSION));
+
+	if (version < DTRACE_VERSION) {
+		/*
+		 * Currently, increasing the library version number is used to
+		 * denote a binary incompatible change.  That is, a consumer
+		 * of the library cannot run on a version of the library with
+		 * a higher DTRACE_VERSION number than the consumer compiled
+		 * against.  Once the library API has been committed to,
+		 * backwards binary compatibility will be required; at that
+		 * time, this check should change to return EDT_OVERSION only
+		 * if the specified version number is less than the version
+		 * number at the time of interface commitment.
+		 */
+		return (set_open_errno(dtp, errp, EDT_OVERSION));
+	}
+
+	if (flags & ~DTRACE_O_MASK)
+		return (set_open_errno(dtp, errp, EINVAL));
+
+	if ((flags & DTRACE_O_LP64) && (flags & DTRACE_O_ILP32))
+		return (set_open_errno(dtp, errp, EINVAL));
+
+	if (vector == NULL && arg != NULL)
+		return (set_open_errno(dtp, errp, EINVAL));
+
+#ifndef VBOX
+	if (elf_version(EV_CURRENT) == EV_NONE)
+		return (set_open_errno(dtp, errp, EDT_ELFVERSION));
+#endif
+
+	if (vector != NULL || (flags & DTRACE_O_NODEV))
+		goto alloc; /* do not attempt to open dtrace device */
+
+#ifndef _MSC_VER
+	/*
+	 * Before we get going, crank our limit on file descriptors up to the
+	 * hard limit.  This is to allow for the fact that libproc keeps file
+	 * descriptors to objects open for the lifetime of the proc handle;
+	 * without raising our hard limit, we would have an acceptably small
+	 * bound on the number of processes that we could concurrently
+	 * instrument with the pid provider.
+	 */
+	if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
+		rl.rlim_cur = rl.rlim_max;
+		(void) setrlimit(RLIMIT_NOFILE, &rl);
+	}
+#endif
+
+#ifndef VBOX
+	/*
+	 * Get the device path of each of the providers.  We hold them open
+	 * in the df.df_fds list until we open the DTrace driver itself,
+	 * allowing us to see all of the probes provided on this system.  Once
+	 * we have the DTrace driver open, we can safely close all the providers
+	 * now that they have registered with the framework.
+	 */
+	dt_provmod_open(&provmod, &df);
+
+	dtfd = open("/dev/dtrace/dtrace", O_RDWR);
+	err = errno; /* save errno from opening dtfd */
+
+	ftfd = open("/dev/dtrace/provider/fasttrap", O_RDWR);
+	fterr = ftfd == -1 ? errno : 0; /* save errno from open ftfd */
+
+	while (df.df_ents-- != 0)
+		(void) close(df.df_fds[df.df_ents]);
+
+	free(df.df_fds);
+
+	/*
+	 * If we failed to open the dtrace device, fail dtrace_open().
+	 * We convert some kernel errnos to custom libdtrace errnos to
+	 * improve the resulting message from the usual strerror().
+	 */
+	if (dtfd == -1) {
+		dt_provmod_destroy(&provmod);
+		switch (err) {
+		case ENOENT:
+			err = EDT_NOENT;
+			break;
+		case EBUSY:
+			err = EDT_BUSY;
+			break;
+		case EACCES:
+			err = EDT_ACCESS;
+			break;
+		}
+		return (set_open_errno(dtp, errp, err));
+	}
+
+	(void) fcntl(dtfd, F_SETFD, FD_CLOEXEC);
+	(void) fcntl(ftfd, F_SETFD, FD_CLOEXEC);
+
+#else  /* VBOX */
+
+	rc = SUPR3Init(NULL);
+	if (RT_FAILURE(rc)) {
+		switch (rc) {
+		case VERR_VM_DRIVER_LOAD_ERROR:
+		case VERR_VM_DRIVER_OPEN_ERROR:
+			err = EDT_BUSY;
+			break;
+		case VERR_VM_DRIVER_NOT_INSTALLED:
+			err = EDT_NOENT;
+			break;
+		case VERR_VERSION_MISMATCH:
+		case VERR_VM_DRIVER_VERSION_MISMATCH:
+			err = EDT_VERSION;
+			break;
+		case VERR_VM_DRIVER_NOT_ACCESSIBLE:
+		default:
+			err = EDT_ACCESS;
+			break;
+		}
+		RTStrmPrintf(g_pStdErr, "SUPR3Init: -> %Rrc\n", rc);
+		return (set_open_errno(dtp, errp, err));
+	}
+
+	/** @todo this needs to be changed if this becomes and extension pack. */
+	rc = RTPathAppPrivateArch(szModPath, sizeof(szModPath));
+	if (RT_SUCCESS(rc)) {
+		rc = RTPathAppend(szModPath, sizeof(szModPath), "VBoxDTraceR0.r0");
+		if (RT_SUCCESS(rc))
+		{
+			PRTERRINFO pErrInfo = RTErrInfoAlloc(1024);
+			rc = SUPR3LoadModule(szModPath, "VBoxDTraceR0.r0", &pvImageBase, pErrInfo);
+			if (RT_FAILURE(rc)) {
+				RTStrmPrintf(g_pStdErr, "SUPR3LoadModule: %s -> %Rrc; %s\n", szModPath, rc, pErrInfo->pszMsg);
+				RTErrInfoFree(pErrInfo);
+				return (set_open_errno(dtp, errp, EDT_NOTLOADED));
+			}
+			RTErrInfoFree(pErrInfo);
+		}
+	}
+	if (RT_FAILURE(rc)) {
+		RTStrmPrintf(g_pStdErr, "SUPR3LoadModule: path buffer too small (%Rrc)\n", rc);
+		return (set_open_errno(dtp, errp, EDT_BUFTOOSMALL));
+	}
+
+	rc = SUPR3TracerOpen(RT_MAKE_U32_FROM_U8('V', 'B', 'D', 'T'), 0);
+	if (RT_FAILURE(rc)) {
+		RTStrmPrintf(g_pStdErr, "SUPR3TracerOpen: %Rrc\n", rc);
+		return (set_open_errno(dtp, errp, EDT_ACCESS));
+	}
+#endif /* VBOX */
+
+alloc:
+	if ((dtp = malloc(sizeof (dtrace_hdl_t))) == NULL)
+		return (set_open_errno(dtp, errp, EDT_NOMEM));
+
+	bzero(dtp, sizeof (dtrace_hdl_t));
+	dtp->dt_oflags = flags;
+	dtp->dt_prcmode = DT_PROC_STOP_PREINIT;
+	dtp->dt_linkmode = DT_LINK_KERNEL;
+	dtp->dt_linktype = DT_LTYP_ELF;
+	dtp->dt_xlatemode = DT_XL_STATIC;
+	dtp->dt_stdcmode = DT_STDC_XA;
+	dtp->dt_version = version;
+	dtp->dt_fd = dtfd;
+	dtp->dt_ftfd = ftfd;
+	dtp->dt_fterr = fterr;
+	dtp->dt_cdefs_fd = -1;
+	dtp->dt_ddefs_fd = -1;
+	dtp->dt_stdout_fd = -1;
+	dtp->dt_modbuckets = _dtrace_strbuckets;
+	dtp->dt_mods = calloc(dtp->dt_modbuckets, sizeof (dt_module_t *));
+	dtp->dt_provbuckets = _dtrace_strbuckets;
+	dtp->dt_provs = calloc(dtp->dt_provbuckets, sizeof (dt_provider_t *));
+	dt_proc_hash_create(dtp);
+	dtp->dt_vmax = DT_VERS_LATEST;
+	dtp->dt_cpp_path = strdup(_dtrace_defcpp);
+	dtp->dt_cpp_argv = malloc(sizeof (char *));
+	dtp->dt_cpp_argc = 1;
+	dtp->dt_cpp_args = 1;
+	dtp->dt_ld_path = strdup(_dtrace_defld);
+	dtp->dt_provmod = provmod;
+	dtp->dt_vector = vector;
+	dtp->dt_varg = arg;
+	dt_dof_init(dtp);
+#ifndef VBOX
+	(void) uname(&dtp->dt_uts);
+#endif
+
+	if (dtp->dt_mods == NULL || dtp->dt_provs == NULL ||
+	    dtp->dt_procs == NULL || dtp->dt_ld_path == NULL ||
+	    dtp->dt_cpp_path == NULL || dtp->dt_cpp_argv == NULL)
+		return (set_open_errno(dtp, errp, EDT_NOMEM));
+
+	for (i = 0; i < DTRACEOPT_MAX; i++)
+		dtp->dt_options[i] = DTRACEOPT_UNSET;
+
+	dtp->dt_cpp_argv[0] = (char *)strbasename(dtp->dt_cpp_path);
+
+	(void) snprintf(isadef, sizeof (isadef), "-D__SUNW_D_%u",
+	    (uint_t)(sizeof (void *) * NBBY));
+
+#ifndef VBOX
+	(void) snprintf(utsdef, sizeof (utsdef), "-D__%s_%s",
+	    dt_get_sysinfo(SI_SYSNAME, s1, sizeof (s1)),
+	    dt_get_sysinfo(SI_RELEASE, s2, sizeof (s2)));
+#endif
+
+	if (dt_cpp_add_arg(dtp, "-D__sun") == NULL ||
+	    dt_cpp_add_arg(dtp, "-D__unix") == NULL ||
+	    dt_cpp_add_arg(dtp, "-D__SVR4") == NULL ||
+	    dt_cpp_add_arg(dtp, "-D__SUNW_D=1") == NULL ||
+	    dt_cpp_add_arg(dtp, isadef) == NULL ||
+	    dt_cpp_add_arg(dtp, utsdef) == NULL)
+		return (set_open_errno(dtp, errp, EDT_NOMEM));
+
+	if (flags & DTRACE_O_NODEV)
+		bcopy(&_dtrace_conf, &dtp->dt_conf, sizeof (_dtrace_conf));
+	else if (dt_ioctl(dtp, DTRACEIOC_CONF, &dtp->dt_conf) != 0)
+		return (set_open_errno(dtp, errp, errno));
+
+	if (flags & DTRACE_O_LP64)
+		dtp->dt_conf.dtc_ctfmodel = CTF_MODEL_LP64;
+	else if (flags & DTRACE_O_ILP32)
+		dtp->dt_conf.dtc_ctfmodel = CTF_MODEL_ILP32;
+
+#ifdef __sparc
+	/*
+	 * On SPARC systems, __sparc is always defined for <sys/isa_defs.h>
+	 * and __sparcv9 is defined if we are doing a 64-bit compile.
+	 */
+	if (dt_cpp_add_arg(dtp, "-D__sparc") == NULL)
+		return (set_open_errno(dtp, errp, EDT_NOMEM));
+
+	if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64 &&
+	    dt_cpp_add_arg(dtp, "-D__sparcv9") == NULL)
+		return (set_open_errno(dtp, errp, EDT_NOMEM));
+#endif
+
+#ifdef __x86
+	/*
+	 * On x86 systems, __i386 is defined for <sys/isa_defs.h> for 32-bit
+	 * compiles and __amd64 is defined for 64-bit compiles.  Unlike SPARC,
+	 * they are defined exclusive of one another (see PSARC 2004/619).
+	 */
+	if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64) {
+		if (dt_cpp_add_arg(dtp, "-D__amd64") == NULL)
+			return (set_open_errno(dtp, errp, EDT_NOMEM));
+	} else {
+		if (dt_cpp_add_arg(dtp, "-D__i386") == NULL)
+			return (set_open_errno(dtp, errp, EDT_NOMEM));
+	}
+#endif
+
+	if (dtp->dt_conf.dtc_difversion < DIF_VERSION)
+		return (set_open_errno(dtp, errp, EDT_DIFVERS));
+
+	if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_ILP32)
+		bcopy(_dtrace_ints_32, dtp->dt_ints, sizeof (_dtrace_ints_32));
+	else
+		bcopy(_dtrace_ints_64, dtp->dt_ints, sizeof (_dtrace_ints_64));
+
+	dtp->dt_macros = dt_idhash_create("macro", NULL, 0, UINT_MAX);
+	dtp->dt_aggs = dt_idhash_create("aggregation", NULL,
+	    DTRACE_AGGVARIDNONE + 1, UINT_MAX);
+
+	dtp->dt_globals = dt_idhash_create("global", _dtrace_globals,
+	    DIF_VAR_OTHER_UBASE, DIF_VAR_OTHER_MAX);
+
+	dtp->dt_tls = dt_idhash_create("thread local", NULL,
+	    DIF_VAR_OTHER_UBASE, DIF_VAR_OTHER_MAX);
+
+	if (dtp->dt_macros == NULL || dtp->dt_aggs == NULL ||
+	    dtp->dt_globals == NULL || dtp->dt_tls == NULL)
+		return (set_open_errno(dtp, errp, EDT_NOMEM));
+
+	/*
+	 * Populate the dt_macros identifier hash table by hand: we can't use
+	 * the dt_idhash_populate() mechanism because we're not yet compiling
+	 * and dtrace_update() needs to immediately reference these idents.
+	 */
+	for (idp = _dtrace_macros; idp->di_name != NULL; idp++) {
+		if (dt_idhash_insert(dtp->dt_macros, idp->di_name,
+		    idp->di_kind, idp->di_flags, idp->di_id, idp->di_attr,
+		    idp->di_vers, idp->di_ops ? idp->di_ops : &dt_idops_thaw,
+		    idp->di_iarg, 0) == NULL)
+			return (set_open_errno(dtp, errp, EDT_NOMEM));
+	}
+
+	/*
+	 * Update the module list using /system/object and load the values for
+	 * the macro variable definitions according to the current process.
+	 */
+	dtrace_update(dtp);
+
+	/*
+	 * Select the intrinsics and typedefs we want based on the data model.
+	 * The intrinsics are under "C".  The typedefs are added under "D".
+	 */
+	if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_ILP32) {
+		dinp = _dtrace_intrinsics_32;
+		dtyp = _dtrace_typedefs_32;
+	} else {
+		dinp = _dtrace_intrinsics_64;
+		dtyp = _dtrace_typedefs_64;
+	}
+
+	/*
+	 * Create a dynamic CTF container under the "C" scope for intrinsic
+	 * types and types defined in ANSI-C header files that are included.
+	 */
+	if ((dmp = dtp->dt_cdefs = dt_module_create(dtp, "C")) == NULL)
+		return (set_open_errno(dtp, errp, EDT_NOMEM));
+
+	if ((dmp->dm_ctfp = ctf_create(&dtp->dt_ctferr)) == NULL)
+		return (set_open_errno(dtp, errp, EDT_CTF));
+
+	dt_dprintf("created CTF container for %s (%p)\n",
+	    dmp->dm_name, (void *)dmp->dm_ctfp);
+
+	(void) ctf_setmodel(dmp->dm_ctfp, dtp->dt_conf.dtc_ctfmodel);
+	ctf_setspecific(dmp->dm_ctfp, dmp);
+
+	dmp->dm_flags = DT_DM_LOADED; /* fake up loaded bit */
+	dmp->dm_modid = -1; /* no module ID */
+
+	/*
+	 * Fill the dynamic "C" CTF container with all of the intrinsic
+	 * integer and floating-point types appropriate for this data model.
+	 */
+	for (; dinp->din_name != NULL; dinp++) {
+		if (dinp->din_kind == CTF_K_INTEGER) {
+			err = ctf_add_integer(dmp->dm_ctfp, CTF_ADD_ROOT,
+			    dinp->din_name, &dinp->din_data);
+		} else {
+			err = ctf_add_float(dmp->dm_ctfp, CTF_ADD_ROOT,
+			    dinp->din_name, &dinp->din_data);
+		}
+
+		if (err == CTF_ERR) {
+			dt_dprintf("failed to add %s to C container: %s\n",
+			    dinp->din_name, ctf_errmsg(
+			    ctf_errno(dmp->dm_ctfp)));
+			return (set_open_errno(dtp, errp, EDT_CTF));
+		}
+	}
+
+	if (ctf_update(dmp->dm_ctfp) != 0) {
+		dt_dprintf("failed to update C container: %s\n",
+		    ctf_errmsg(ctf_errno(dmp->dm_ctfp)));
+		return (set_open_errno(dtp, errp, EDT_CTF));
+	}
+
+	/*
+	 * Add intrinsic pointer types that are needed to initialize printf
+	 * format dictionary types (see table in dt_printf.c).
+	 */
+	(void) ctf_add_pointer(dmp->dm_ctfp, CTF_ADD_ROOT,
+	    ctf_lookup_by_name(dmp->dm_ctfp, "void"));
+
+	(void) ctf_add_pointer(dmp->dm_ctfp, CTF_ADD_ROOT,
+	    ctf_lookup_by_name(dmp->dm_ctfp, "char"));
+
+	(void) ctf_add_pointer(dmp->dm_ctfp, CTF_ADD_ROOT,
+	    ctf_lookup_by_name(dmp->dm_ctfp, "int"));
+
+	if (ctf_update(dmp->dm_ctfp) != 0) {
+		dt_dprintf("failed to update C container: %s\n",
+		    ctf_errmsg(ctf_errno(dmp->dm_ctfp)));
+		return (set_open_errno(dtp, errp, EDT_CTF));
+	}
+
+	/*
+	 * Create a dynamic CTF container under the "D" scope for types that
+	 * are defined by the D program itself or on-the-fly by the D compiler.
+	 * The "D" CTF container is a child of the "C" CTF container.
+	 */
+	if ((dmp = dtp->dt_ddefs = dt_module_create(dtp, "D")) == NULL)
+		return (set_open_errno(dtp, errp, EDT_NOMEM));
+
+	if ((dmp->dm_ctfp = ctf_create(&dtp->dt_ctferr)) == NULL)
+		return (set_open_errno(dtp, errp, EDT_CTF));
+
+	dt_dprintf("created CTF container for %s (%p)\n",
+	    dmp->dm_name, (void *)dmp->dm_ctfp);
+
+	(void) ctf_setmodel(dmp->dm_ctfp, dtp->dt_conf.dtc_ctfmodel);
+	ctf_setspecific(dmp->dm_ctfp, dmp);
+
+	dmp->dm_flags = DT_DM_LOADED; /* fake up loaded bit */
+	dmp->dm_modid = -1; /* no module ID */
+
+	if (ctf_import(dmp->dm_ctfp, dtp->dt_cdefs->dm_ctfp) == CTF_ERR) {
+		dt_dprintf("failed to import D parent container: %s\n",
+		    ctf_errmsg(ctf_errno(dmp->dm_ctfp)));
+		return (set_open_errno(dtp, errp, EDT_CTF));
+	}
+
+	/*
+	 * Fill the dynamic "D" CTF container with all of the built-in typedefs
+	 * that we need to use for our D variable and function definitions.
+	 * This ensures that basic inttypes.h names are always available to us.
+	 */
+	for (; dtyp->dty_src != NULL; dtyp++) {
+		if (ctf_add_typedef(dmp->dm_ctfp, CTF_ADD_ROOT,
+		    dtyp->dty_dst, ctf_lookup_by_name(dmp->dm_ctfp,
+		    dtyp->dty_src)) == CTF_ERR) {
+			dt_dprintf("failed to add typedef %s %s to D "
+			    "container: %s", dtyp->dty_src, dtyp->dty_dst,
+			    ctf_errmsg(ctf_errno(dmp->dm_ctfp)));
+			return (set_open_errno(dtp, errp, EDT_CTF));
+		}
+	}
+
+	/*
+	 * Insert a CTF ID corresponding to a pointer to a type of kind
+	 * CTF_K_FUNCTION we can use in the compiler for function pointers.
+	 * CTF treats all function pointers as "int (*)()" so we only need one.
+	 */
+	ctc.ctc_return = ctf_lookup_by_name(dmp->dm_ctfp, "int");
+	ctc.ctc_argc = 0;
+	ctc.ctc_flags = 0;
+
+	dtp->dt_type_func = ctf_add_function(dmp->dm_ctfp,
+	    CTF_ADD_ROOT, &ctc, NULL);
+
+	dtp->dt_type_fptr = ctf_add_pointer(dmp->dm_ctfp,
+	    CTF_ADD_ROOT, dtp->dt_type_func);
+
+	/*
+	 * We also insert CTF definitions for the special D intrinsic types
+	 * string and <DYN> into the D container.  The string type is added
+	 * as a typedef of char[n].  The <DYN> type is an alias for void.
+	 * We compare types to these special CTF ids throughout the compiler.
+	 */
+	ctr.ctr_contents = ctf_lookup_by_name(dmp->dm_ctfp, "char");
+	ctr.ctr_index = ctf_lookup_by_name(dmp->dm_ctfp, "long");
+	ctr.ctr_nelems = _dtrace_strsize;
+
+	dtp->dt_type_str = ctf_add_typedef(dmp->dm_ctfp, CTF_ADD_ROOT,
+	    "string", ctf_add_array(dmp->dm_ctfp, CTF_ADD_ROOT, &ctr));
+
+	dtp->dt_type_dyn = ctf_add_typedef(dmp->dm_ctfp, CTF_ADD_ROOT,
+	    "<DYN>", ctf_lookup_by_name(dmp->dm_ctfp, "void"));
+
+	dtp->dt_type_stack = ctf_add_typedef(dmp->dm_ctfp, CTF_ADD_ROOT,
+	    "stack", ctf_lookup_by_name(dmp->dm_ctfp, "void"));
+
+	dtp->dt_type_symaddr = ctf_add_typedef(dmp->dm_ctfp, CTF_ADD_ROOT,
+	    "_symaddr", ctf_lookup_by_name(dmp->dm_ctfp, "void"));
+
+	dtp->dt_type_usymaddr = ctf_add_typedef(dmp->dm_ctfp, CTF_ADD_ROOT,
+	    "_usymaddr", ctf_lookup_by_name(dmp->dm_ctfp, "void"));
+
+	if (dtp->dt_type_func == CTF_ERR || dtp->dt_type_fptr == CTF_ERR ||
+	    dtp->dt_type_str == CTF_ERR || dtp->dt_type_dyn == CTF_ERR ||
+	    dtp->dt_type_stack == CTF_ERR || dtp->dt_type_symaddr == CTF_ERR ||
+	    dtp->dt_type_usymaddr == CTF_ERR) {
+		dt_dprintf("failed to add intrinsic to D container: %s\n",
+		    ctf_errmsg(ctf_errno(dmp->dm_ctfp)));
+		return (set_open_errno(dtp, errp, EDT_CTF));
+	}
+
+	if (ctf_update(dmp->dm_ctfp) != 0) {
+		dt_dprintf("failed update D container: %s\n",
+		    ctf_errmsg(ctf_errno(dmp->dm_ctfp)));
+		return (set_open_errno(dtp, errp, EDT_CTF));
+	}
+
+	/*
+	 * Initialize the integer description table used to convert integer
+	 * constants to the appropriate types.  Refer to the comments above
+	 * dt_node_int() for a complete description of how this table is used.
+	 */
+	for (i = 0; i < sizeof (dtp->dt_ints) / sizeof (dtp->dt_ints[0]); i++) {
+		if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY,
+		    dtp->dt_ints[i].did_name, &dtt) != 0) {
+			dt_dprintf("failed to lookup integer type %s: %s\n",
+			    dtp->dt_ints[i].did_name,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+			return (set_open_errno(dtp, errp, dtp->dt_errno));
+		}
+		dtp->dt_ints[i].did_ctfp = dtt.dtt_ctfp;
+		dtp->dt_ints[i].did_type = dtt.dtt_type;
+	}
+
+	/*
+	 * Now that we've created the "C" and "D" containers, move them to the
+	 * start of the module list so that these types and symbols are found
+	 * first (for stability) when iterating through the module list.
+	 */
+	dt_list_delete(&dtp->dt_modlist, dtp->dt_ddefs);
+	dt_list_prepend(&dtp->dt_modlist, dtp->dt_ddefs);
+
+	dt_list_delete(&dtp->dt_modlist, dtp->dt_cdefs);
+	dt_list_prepend(&dtp->dt_modlist, dtp->dt_cdefs);
+
+	if (dt_pfdict_create(dtp) == -1)
+		return (set_open_errno(dtp, errp, dtp->dt_errno));
+
+	/*
+	 * If we are opening libdtrace DTRACE_O_NODEV enable C_ZDEFS by default
+	 * because without /dev/dtrace open, we will not be able to load the
+	 * names and attributes of any providers or probes from the kernel.
+	 */
+	if (flags & DTRACE_O_NODEV)
+		dtp->dt_cflags |= DTRACE_C_ZDEFS;
+
+	/*
+	 * Load hard-wired inlines into the definition cache by calling the
+	 * compiler on the raw definition string defined above.
+	 */
+	if ((pgp = dtrace_program_strcompile(dtp, _dtrace_hardwire,
+	    DTRACE_PROBESPEC_NONE, DTRACE_C_EMPTY, 0, NULL)) == NULL) {
+		dt_dprintf("failed to load hard-wired definitions: %s\n",
+		    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		return (set_open_errno(dtp, errp, EDT_HARDWIRE));
+	}
+
+	dt_program_destroy(dtp, pgp);
+
+#ifndef VBOX
+	/*
+	 * Set up the default DTrace library path.  Once set, the next call to
+	 * dt_compile() will compile all the libraries.  We intentionally defer
+	 * library processing to improve overhead for clients that don't ever
+	 * compile, and to provide better error reporting (because the full
+	 * reporting of compiler errors requires dtrace_open() to succeed).
+	 */
+	if (dtrace_setopt(dtp, "libdir", _dtrace_libdir) != 0)
+		return (set_open_errno(dtp, errp, dtp->dt_errno));
+#endif
+
+	return (dtp);
+}
+
+dtrace_hdl_t *
+dtrace_open(int version, int flags, int *errp)
+{
+	return (dt_vopen(version, flags, errp, NULL, NULL));
+}
+
+dtrace_hdl_t *
+dtrace_vopen(int version, int flags, int *errp,
+    const dtrace_vector_t *vector, void *arg)
+{
+	return (dt_vopen(version, flags, errp, vector, arg));
+}
+
+void
+dtrace_close(dtrace_hdl_t *dtp)
+{
+	dt_ident_t *idp, *ndp;
+	dt_module_t *dmp;
+	dt_provider_t *pvp;
+	dtrace_prog_t *pgp;
+	dt_xlator_t *dxp;
+	dt_dirpath_t *dirp;
+	int i;
+
+	if (dtp->dt_procs != NULL)
+		dt_proc_hash_destroy(dtp);
+
+	while ((pgp = dt_list_next(&dtp->dt_programs)) != NULL)
+		dt_program_destroy(dtp, pgp);
+
+	while ((dxp = dt_list_next(&dtp->dt_xlators)) != NULL)
+		dt_xlator_destroy(dtp, dxp);
+
+	dt_free(dtp, dtp->dt_xlatormap);
+
+	for (idp = dtp->dt_externs; idp != NULL; idp = ndp) {
+		ndp = idp->di_next;
+		dt_ident_destroy(idp);
+	}
+
+	if (dtp->dt_macros != NULL)
+		dt_idhash_destroy(dtp->dt_macros);
+	if (dtp->dt_aggs != NULL)
+		dt_idhash_destroy(dtp->dt_aggs);
+	if (dtp->dt_globals != NULL)
+		dt_idhash_destroy(dtp->dt_globals);
+	if (dtp->dt_tls != NULL)
+		dt_idhash_destroy(dtp->dt_tls);
+
+	while ((dmp = dt_list_next(&dtp->dt_modlist)) != NULL)
+		dt_module_destroy(dtp, dmp);
+
+	while ((pvp = dt_list_next(&dtp->dt_provlist)) != NULL)
+		dt_provider_destroy(dtp, pvp);
+
+	if (dtp->dt_fd != -1)
+		(void) close(dtp->dt_fd);
+	if (dtp->dt_ftfd != -1)
+		(void) close(dtp->dt_ftfd);
+	if (dtp->dt_cdefs_fd != -1)
+		(void) close(dtp->dt_cdefs_fd);
+	if (dtp->dt_ddefs_fd != -1)
+		(void) close(dtp->dt_ddefs_fd);
+	if (dtp->dt_stdout_fd != -1)
+		(void) close(dtp->dt_stdout_fd);
+
+	dt_epid_destroy(dtp);
+	dt_aggid_destroy(dtp);
+	dt_format_destroy(dtp);
+	dt_buffered_destroy(dtp);
+	dt_aggregate_destroy(dtp);
+	free(dtp->dt_buf.dtbd_data);
+	dt_pfdict_destroy(dtp);
+	dt_provmod_destroy(&dtp->dt_provmod);
+	dt_dof_fini(dtp);
+
+	for (i = 1; i < dtp->dt_cpp_argc; i++)
+		free(dtp->dt_cpp_argv[i]);
+
+	while ((dirp = dt_list_next(&dtp->dt_lib_path)) != NULL) {
+		dt_list_delete(&dtp->dt_lib_path, dirp);
+		free(dirp->dir_path);
+		free(dirp);
+	}
+
+	free(dtp->dt_cpp_argv);
+	free(dtp->dt_cpp_path);
+	free(dtp->dt_ld_path);
+
+	free(dtp->dt_mods);
+	free(dtp->dt_provs);
+	free(dtp);
+}
+
+int
+dtrace_provider_modules(dtrace_hdl_t *dtp, const char **mods, int nmods)
+{
+	dt_provmod_t *prov;
+	int i = 0;
+
+	for (prov = dtp->dt_provmod; prov != NULL; prov = prov->dp_next, i++) {
+		if (i < nmods)
+			mods[i] = prov->dp_name;
+	}
+
+	return (i);
+}
+
+int
+dtrace_ctlfd(dtrace_hdl_t *dtp)
+{
+	return (dtp->dt_fd);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_options.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_options.c
new file mode 100644
index 0000000..46ac208
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_options.c
@@ -0,0 +1,1080 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/resource.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+
+#include <strings.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <alloca.h>
+#include <errno.h>
+#include <fcntl.h>
+
+#else  /* VBOX */
+# ifndef _MSC_VER
+#  include <sys/resource.h>
+#  include <unistd.h>
+#  include <signal.h>
+#  if defined(RT_OS_DARWIN)
+#   define open64 open
+#  endif
+# else
+#  include <io.h>
+#  define STDERR_FILENO 2
+#  define open64 open
+# endif
+# include <fcntl.h>
+# include <stdlib.h>
+
+#endif /* VBOX */
+
+#include <dt_impl.h>
+#include <dt_string.h>
+
+static int
+dt_opt_agg(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dt_aggregate_t *agp = &dtp->dt_aggregate;
+
+	if (arg != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	agp->dtat_flags |= option;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_amin(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	char str[DTRACE_ATTR2STR_MAX];
+	dtrace_attribute_t attr;
+
+	if (arg == NULL || dtrace_str2attr(arg, &attr) == -1)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dt_dprintf("set compiler attribute minimum to %s\n",
+	    dtrace_attr2str(attr, str, sizeof (str)));
+
+	if (dtp->dt_pcb != NULL) {
+		dtp->dt_pcb->pcb_cflags |= DTRACE_C_EATTR;
+		dtp->dt_pcb->pcb_amin = attr;
+	} else {
+		dtp->dt_cflags |= DTRACE_C_EATTR;
+		dtp->dt_amin = attr;
+	}
+
+	return (0);
+}
+
+static void
+dt_coredump(void)
+{
+	const char msg[] = "libdtrace DEBUG: [ forcing coredump ]\n";
+
+#ifndef _MSC_VER
+	struct sigaction act;
+	struct rlimit lim;
+#endif
+
+	(void) write(STDERR_FILENO, msg, sizeof (msg) - 1);
+
+#ifndef _MSC_VER
+	act.sa_handler = SIG_DFL;
+	act.sa_flags = 0;
+
+	(void) sigemptyset(&act.sa_mask);
+	(void) sigaction(SIGABRT, &act, NULL);
+
+	lim.rlim_cur = RLIM_INFINITY;
+	lim.rlim_max = RLIM_INFINITY;
+
+	(void) setrlimit(RLIMIT_CORE, &lim);
+#endif /* !_MSC_VER */
+	abort();
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_core(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	static int enabled = 0;
+
+	if (arg != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (enabled++ || atexit(dt_coredump) == 0)
+		return (0);
+
+	return (dt_set_errno(dtp, errno));
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_cpp_hdrs(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (dtp->dt_pcb != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTCTX));
+
+	if (dt_cpp_add_arg(dtp, "-H") == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_cpp_path(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	char *cpp;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (dtp->dt_pcb != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTCTX));
+
+	if ((cpp = strdup(arg)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	dtp->dt_cpp_argv[0] = (char *)strbasename(cpp);
+	free(dtp->dt_cpp_path);
+	dtp->dt_cpp_path = cpp;
+
+	return (0);
+}
+
+static int
+dt_opt_cpp_opts(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	char *buf;
+	size_t len;
+	const char *opt = (const char *)option;
+
+	if (opt == NULL || arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (dtp->dt_pcb != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTCTX));
+
+	len = strlen(opt) + strlen(arg) + 1;
+	buf = alloca(len);
+
+	(void) strcpy(buf, opt);
+	(void) strcat(buf, arg);
+
+	if (dt_cpp_add_arg(dtp, buf) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_ctypes(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	int fd;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if ((fd = open64(arg, O_CREAT | O_WRONLY, 0666)) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	(void) close(dtp->dt_cdefs_fd);
+	dtp->dt_cdefs_fd = fd;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_droptags(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dtp->dt_droptags = 1;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_dtypes(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	int fd;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if ((fd = open64(arg, O_CREAT | O_WRONLY, 0666)) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	(void) close(dtp->dt_ddefs_fd);
+	dtp->dt_ddefs_fd = fd;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_debug(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	_dtrace_debug = 1;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_iregs(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	int n;
+
+	if (arg == NULL || (n = atoi(arg)) <= 0)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dtp->dt_conf.dtc_difintregs = n;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_lazyload(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dtp->dt_lazyload = 1;
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_ld_path(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	char *ld;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (dtp->dt_pcb != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTCTX));
+
+	if ((ld = strdup(arg)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	free(dtp->dt_ld_path);
+	dtp->dt_ld_path = ld;
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_libdir(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dt_dirpath_t *dp;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if ((dp = malloc(sizeof (dt_dirpath_t))) == NULL ||
+	    (dp->dir_path = strdup(arg)) == NULL) {
+		free(dp);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	dt_list_append(&dtp->dt_lib_path, dp);
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_linkmode(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (strcmp(arg, "kernel") == 0)
+		dtp->dt_linkmode = DT_LINK_KERNEL;
+	else if (strcmp(arg, "primary") == 0)
+		dtp->dt_linkmode = DT_LINK_PRIMARY;
+	else if (strcmp(arg, "dynamic") == 0)
+		dtp->dt_linkmode = DT_LINK_DYNAMIC;
+	else if (strcmp(arg, "static") == 0)
+		dtp->dt_linkmode = DT_LINK_STATIC;
+	else
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_linktype(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (strcasecmp(arg, "elf") == 0)
+		dtp->dt_linktype = DT_LTYP_ELF;
+	else if (strcasecmp(arg, "dof") == 0)
+		dtp->dt_linktype = DT_LTYP_DOF;
+	else
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_evaltime(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (strcmp(arg, "exec") == 0)
+		dtp->dt_prcmode = DT_PROC_STOP_CREATE;
+	else if (strcmp(arg, "preinit") == 0)
+		dtp->dt_prcmode = DT_PROC_STOP_PREINIT;
+	else if (strcmp(arg, "postinit") == 0)
+		dtp->dt_prcmode = DT_PROC_STOP_POSTINIT;
+	else if (strcmp(arg, "main") == 0)
+		dtp->dt_prcmode = DT_PROC_STOP_MAIN;
+	else
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_pgmax(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	int n;
+
+	if (arg == NULL || (n = atoi(arg)) < 0)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dtp->dt_procs->dph_lrulim = n;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_stdc(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (dtp->dt_pcb != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTCTX));
+
+	if (strcmp(arg, "a") == 0)
+		dtp->dt_stdcmode = DT_STDC_XA;
+	else if (strcmp(arg, "c") == 0)
+		dtp->dt_stdcmode = DT_STDC_XC;
+	else if (strcmp(arg, "s") == 0)
+		dtp->dt_stdcmode = DT_STDC_XS;
+	else if (strcmp(arg, "t") == 0)
+		dtp->dt_stdcmode = DT_STDC_XT;
+	else
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_syslibdir(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dt_dirpath_t *dp = dt_list_next(&dtp->dt_lib_path);
+	char *path;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if ((path = strdup(arg)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	free(dp->dir_path);
+	dp->dir_path = path;
+
+	return (0);
+}
+
+
+/*ARGSUSED*/
+static int
+dt_opt_tree(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	int m;
+
+	if (arg == NULL || (m = atoi(arg)) <= 0)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dtp->dt_treedump = m;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_tregs(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	int n;
+
+	if (arg == NULL || (n = atoi(arg)) <= 0)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dtp->dt_conf.dtc_diftupregs = n;
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_xlate(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (strcmp(arg, "dynamic") == 0)
+		dtp->dt_xlatemode = DT_XL_DYNAMIC;
+	else if (strcmp(arg, "static") == 0)
+		dtp->dt_xlatemode = DT_XL_STATIC;
+	else
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_cflags(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (dtp->dt_pcb != NULL)
+		dtp->dt_pcb->pcb_cflags |= option;
+	else
+		dtp->dt_cflags |= option;
+
+	return (0);
+}
+
+static int
+dt_opt_dflags(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dtp->dt_dflags |= option;
+	return (0);
+}
+
+static int
+dt_opt_invcflags(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	if (arg != NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (dtp->dt_pcb != NULL)
+		dtp->dt_pcb->pcb_cflags &= ~option;
+	else
+		dtp->dt_cflags &= ~option;
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_version(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dt_version_t v;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (dt_version_str2num(arg, &v) == -1)
+		return (dt_set_errno(dtp, EDT_VERSINVAL));
+
+	if (!dt_version_defined(v))
+		return (dt_set_errno(dtp, EDT_VERSUNDEF));
+
+	return (dt_reduce(dtp, v));
+}
+
+static int
+dt_opt_runtime(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+#ifndef VBOX
+	char *end;
+#endif
+	dtrace_optval_t val = 0;
+	int i;
+
+	const struct {
+		char *positive;
+		char *negative;
+	} couples[] = {
+		{ "yes",	"no" },
+		{ "enable",	"disable" },
+		{ "enabled",	"disabled" },
+		{ "true",	"false" },
+		{ "on",		"off" },
+		{ "set",	"unset" },
+		{ NULL }
+	};
+
+	if (arg != NULL) {
+		if (arg[0] == '\0') {
+			val = DTRACEOPT_UNSET;
+			goto out;
+		}
+
+		for (i = 0; couples[i].positive != NULL; i++) {
+			if (strcasecmp(couples[i].positive, arg) == 0) {
+				val = 1;
+				goto out;
+			}
+
+			if (strcasecmp(couples[i].negative, arg) == 0) {
+				val = DTRACEOPT_UNSET;
+				goto out;
+			}
+		}
+
+#ifndef VBOX
+		errno = 0;
+		val = strtoull(arg, &end, 0);
+
+		if (*end != '\0' || errno != 0 || val < 0)
+			return (dt_set_errno(dtp, EDT_BADOPTVAL));
+#else
+		i = RTStrToInt64Full(arg, 0, &val);
+		if (i != VINF_SUCCESS)
+			return (dt_set_errno(dtp, EDT_BADOPTVAL));
+#endif
+	}
+
+out:
+	dtp->dt_options[option] = val;
+	return (0);
+}
+
+static int
+dt_optval_parse(const char *arg, dtrace_optval_t *rval)
+{
+	dtrace_optval_t mul = 1;
+	size_t len;
+	char *end;
+#ifdef VBOX
+	int rc;
+#endif
+
+	len = strlen(arg);
+#ifndef VBOX
+	errno = 0;
+#endif
+
+	switch (arg[len - 1]) {
+	case 't':
+	case 'T':
+		mul *= 1024;
+		/*FALLTHRU*/
+	case 'g':
+	case 'G':
+		mul *= 1024;
+		/*FALLTHRU*/
+	case 'm':
+	case 'M':
+		mul *= 1024;
+		/*FALLTHRU*/
+	case 'k':
+	case 'K':
+		mul *= 1024;
+		/*FALLTHRU*/
+	default:
+		break;
+	}
+
+#ifndef VBOX
+	errno = 0;
+	*rval = strtoull(arg, &end, 0) * mul;
+
+	if ((mul > 1 && end != &arg[len - 1]) || (mul == 1 && *end != '\0') ||
+	    *rval < 0 || errno != 0)
+		return (-1);
+#else
+	*rval = -1;
+	if (mul == 1) {
+		rc = RTStrToInt64Full(arg, 0, rval);
+		if (rc != VINF_SUCCESS || *rval < 0)
+			return (-1);
+	} else {
+		rc = RTStrToInt64Ex(arg, &end, 0, rval);
+		if (   rc != VWRN_TRAILING_CHARS
+			|| end != &arg[len - 1]
+			|| *rval < 0)
+			return (-1);
+		*rval *= mul;
+		if (*rval < 0)
+			return (-1);
+	}
+#endif
+
+	return (0);
+}
+
+static int
+dt_opt_size(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dtrace_optval_t val = 0;
+
+	if (arg != NULL && dt_optval_parse(arg, &val) != 0)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dtp->dt_options[option] = val;
+	return (0);
+}
+
+static int
+dt_opt_rate(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	char *end;
+	int i;
+	dtrace_optval_t mul = 1, val = 0;
+
+	const struct {
+		char *name;
+		hrtime_t mul;
+	} suffix[] = {
+		{ "ns", 	NANOSEC / NANOSEC },
+		{ "nsec",	NANOSEC / NANOSEC },
+		{ "us",		NANOSEC / MICROSEC },
+		{ "usec",	NANOSEC / MICROSEC },
+		{ "ms",		NANOSEC / MILLISEC },
+		{ "msec",	NANOSEC / MILLISEC },
+		{ "s",		NANOSEC / SEC },
+		{ "sec",	NANOSEC / SEC },
+		{ "m",		NANOSEC * (hrtime_t)60 },
+		{ "min",	NANOSEC * (hrtime_t)60 },
+		{ "h",		NANOSEC * (hrtime_t)60 * (hrtime_t)60 },
+		{ "hour",	NANOSEC * (hrtime_t)60 * (hrtime_t)60 },
+		{ "d",		NANOSEC * (hrtime_t)(24 * 60 * 60) },
+		{ "day",	NANOSEC * (hrtime_t)(24 * 60 * 60) },
+		{ "hz",		0 },
+		{ NULL }
+	};
+
+	if (arg != NULL) {
+#ifndef VBOX
+		errno = 0;
+		val = strtoull(arg, &end, 0);
+#else
+		int rc = RTStrToInt64Ex(arg, &end, 0, &val);
+		if (rc != VWRN_TRAILING_CHARS)
+			return (dt_set_errno(dtp, EDT_BADOPTVAL));
+#endif
+
+		for (i = 0; suffix[i].name != NULL; i++) {
+			if (strcasecmp(suffix[i].name, end) == 0) {
+				mul = suffix[i].mul;
+				break;
+			}
+		}
+
+		if (suffix[i].name == NULL && *end != '\0' || val < 0)
+			return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+		if (mul == 0) {
+			/*
+			 * The rate has been specified in frequency-per-second.
+			 */
+			if (val != 0)
+				val = NANOSEC / val;
+		} else {
+			val *= mul;
+		}
+	}
+
+	dtp->dt_options[option] = val;
+	return (0);
+}
+
+/*
+ * When setting the strsize option, set the option in the dt_options array
+ * using dt_opt_size() as usual, and then update the definition of the CTF
+ * type for the D intrinsic "string" to be an array of the corresponding size.
+ * If any errors occur, reset dt_options[option] to its previous value.
+ */
+static int
+dt_opt_strsize(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dtrace_optval_t val = dtp->dt_options[option];
+	ctf_file_t *fp = DT_STR_CTFP(dtp);
+	ctf_id_t type = ctf_type_resolve(fp, DT_STR_TYPE(dtp));
+	ctf_arinfo_t r;
+
+	if (dt_opt_size(dtp, arg, option) != 0)
+		return (-1); /* dt_errno is set for us */
+
+	if (dtp->dt_options[option] > UINT_MAX) {
+		dtp->dt_options[option] = val;
+		return (dt_set_errno(dtp, EOVERFLOW));
+	}
+
+	if (ctf_array_info(fp, type, &r) == CTF_ERR) {
+		dtp->dt_options[option] = val;
+		dtp->dt_ctferr = ctf_errno(fp);
+		return (dt_set_errno(dtp, EDT_CTF));
+	}
+
+	r.ctr_nelems = (uint_t)dtp->dt_options[option];
+
+	if (ctf_set_array(fp, type, &r) == CTF_ERR ||
+	    ctf_update(fp) == CTF_ERR) {
+		dtp->dt_options[option] = val;
+		dtp->dt_ctferr = ctf_errno(fp);
+		return (dt_set_errno(dtp, EDT_CTF));
+	}
+
+	return (0);
+}
+
+static const struct {
+	const char *dtbp_name;
+	int dtbp_policy;
+} _dtrace_bufpolicies[] = {
+	{ "ring", DTRACEOPT_BUFPOLICY_RING },
+	{ "fill", DTRACEOPT_BUFPOLICY_FILL },
+	{ "switch", DTRACEOPT_BUFPOLICY_SWITCH },
+	{ NULL, 0 }
+};
+
+/*ARGSUSED*/
+static int
+dt_opt_bufpolicy(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dtrace_optval_t policy = DTRACEOPT_UNSET;
+	int i;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	for (i = 0; _dtrace_bufpolicies[i].dtbp_name != NULL; i++) {
+		if (strcmp(_dtrace_bufpolicies[i].dtbp_name, arg) == 0) {
+			policy = _dtrace_bufpolicies[i].dtbp_policy;
+			break;
+		}
+	}
+
+	if (policy == DTRACEOPT_UNSET)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dtp->dt_options[DTRACEOPT_BUFPOLICY] = policy;
+
+	return (0);
+}
+
+static const struct {
+	const char *dtbr_name;
+	int dtbr_policy;
+} _dtrace_bufresize[] = {
+	{ "auto", DTRACEOPT_BUFRESIZE_AUTO },
+	{ "manual", DTRACEOPT_BUFRESIZE_MANUAL },
+	{ NULL, 0 }
+};
+
+/*ARGSUSED*/
+static int
+dt_opt_bufresize(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dtrace_optval_t policy = DTRACEOPT_UNSET;
+	int i;
+
+	if (arg == NULL)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	for (i = 0; _dtrace_bufresize[i].dtbr_name != NULL; i++) {
+		if (strcmp(_dtrace_bufresize[i].dtbr_name, arg) == 0) {
+			policy = _dtrace_bufresize[i].dtbr_policy;
+			break;
+		}
+	}
+
+	if (policy == DTRACEOPT_UNSET)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	dtp->dt_options[DTRACEOPT_BUFRESIZE] = policy;
+
+	return (0);
+}
+
+int
+dt_options_load(dtrace_hdl_t *dtp)
+{
+	dof_hdr_t hdr, *dof;
+	dof_sec_t *sec;
+	size_t offs;
+	VBDTTYPE(uint32_t,int) i;
+
+	/*
+	 * To load the option values, we need to ask the kernel to provide its
+	 * DOF, which we'll sift through to look for OPTDESC sections.
+	 */
+	bzero(&hdr, sizeof (dof_hdr_t));
+	hdr.dofh_loadsz = sizeof (dof_hdr_t);
+
+	if (dt_ioctl(dtp, DTRACEIOC_DOFGET, &hdr) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	if (hdr.dofh_loadsz < sizeof (dof_hdr_t))
+		return (dt_set_errno(dtp, EINVAL));
+
+	dof = alloca(hdr.dofh_loadsz);
+	bzero(dof, sizeof (dof_hdr_t));
+	dof->dofh_loadsz = hdr.dofh_loadsz;
+
+	for (i = 0; i < DTRACEOPT_MAX; i++)
+		dtp->dt_options[i] = DTRACEOPT_UNSET;
+
+	if (dt_ioctl(dtp, DTRACEIOC_DOFGET, dof) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		sec = (dof_sec_t *)(uintptr_t)((uintptr_t)dof +
+		    dof->dofh_secoff + i * dof->dofh_secsize);
+
+		if (sec->dofs_type != DOF_SECT_OPTDESC)
+			continue;
+
+		break;
+	}
+
+	for (offs = 0; offs < sec->dofs_size; offs += sec->dofs_entsize) {
+		dof_optdesc_t *opt = (dof_optdesc_t *)(uintptr_t)
+		    ((uintptr_t)dof + sec->dofs_offset + offs);
+
+		if (opt->dofo_strtab != DOF_SECIDX_NONE)
+			continue;
+
+		if (opt->dofo_option >= DTRACEOPT_MAX)
+			continue;
+
+		dtp->dt_options[opt->dofo_option] = opt->dofo_value;
+	}
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_opt_preallocate(dtrace_hdl_t *dtp, const char *arg, uintptr_t option)
+{
+	dtrace_optval_t size;
+	void *p;
+
+	if (arg == NULL || dt_optval_parse(arg, &size) != 0)
+		return (dt_set_errno(dtp, EDT_BADOPTVAL));
+
+	if (size > SIZE_MAX)
+		size = SIZE_MAX;
+
+	if ((p = dt_zalloc(dtp, size)) == NULL) {
+		do {
+			size /= 2;
+		} while ((p = dt_zalloc(dtp, size)) == NULL);
+	}
+
+	dt_free(dtp, p);
+
+	return (0);
+}
+
+typedef struct dt_option {
+	const char *o_name;
+	int (*o_func)(dtrace_hdl_t *, const char *, uintptr_t);
+	uintptr_t o_option;
+} dt_option_t;
+
+/*
+ * Compile-time options.
+ */
+static const dt_option_t _dtrace_ctoptions[] = {
+	{ "aggpercpu", dt_opt_agg, DTRACE_A_PERCPU },
+	{ "amin", dt_opt_amin },
+	{ "argref", dt_opt_cflags, DTRACE_C_ARGREF },
+	{ "core", dt_opt_core },
+	{ "cpp", dt_opt_cflags, DTRACE_C_CPP },
+	{ "cpphdrs", dt_opt_cpp_hdrs },
+	{ "cpppath", dt_opt_cpp_path },
+	{ "ctypes", dt_opt_ctypes },
+	{ "defaultargs", dt_opt_cflags, DTRACE_C_DEFARG },
+	{ "dtypes", dt_opt_dtypes },
+	{ "debug", dt_opt_debug },
+	{ "define", dt_opt_cpp_opts, (uintptr_t)"-D" },
+	{ "droptags", dt_opt_droptags },
+	{ "empty", dt_opt_cflags, DTRACE_C_EMPTY },
+	{ "errtags", dt_opt_cflags, DTRACE_C_ETAGS },
+	{ "evaltime", dt_opt_evaltime },
+	{ "incdir", dt_opt_cpp_opts, (uintptr_t)"-I" },
+	{ "iregs", dt_opt_iregs },
+	{ "kdefs", dt_opt_invcflags, DTRACE_C_KNODEF },
+	{ "knodefs", dt_opt_cflags, DTRACE_C_KNODEF },
+	{ "late", dt_opt_xlate },
+	{ "lazyload", dt_opt_lazyload },
+	{ "ldpath", dt_opt_ld_path },
+	{ "libdir", dt_opt_libdir },
+	{ "linkmode", dt_opt_linkmode },
+	{ "linktype", dt_opt_linktype },
+	{ "nolibs", dt_opt_cflags, DTRACE_C_NOLIBS },
+	{ "pgmax", dt_opt_pgmax },
+	{ "preallocate", dt_opt_preallocate },
+	{ "pspec", dt_opt_cflags, DTRACE_C_PSPEC },
+	{ "stdc", dt_opt_stdc },
+	{ "strip", dt_opt_dflags, DTRACE_D_STRIP },
+	{ "syslibdir", dt_opt_syslibdir },
+	{ "tree", dt_opt_tree },
+	{ "tregs", dt_opt_tregs },
+	{ "udefs", dt_opt_invcflags, DTRACE_C_UNODEF },
+	{ "undef", dt_opt_cpp_opts, (uintptr_t)"-U" },
+	{ "unodefs", dt_opt_cflags, DTRACE_C_UNODEF },
+	{ "verbose", dt_opt_cflags, DTRACE_C_DIFV },
+	{ "version", dt_opt_version },
+	{ "zdefs", dt_opt_cflags, DTRACE_C_ZDEFS },
+	{ NULL }
+};
+
+/*
+ * Run-time options.
+ */
+static const dt_option_t _dtrace_rtoptions[] = {
+	{ "aggsize", dt_opt_size, DTRACEOPT_AGGSIZE },
+	{ "bufsize", dt_opt_size, DTRACEOPT_BUFSIZE },
+	{ "bufpolicy", dt_opt_bufpolicy, DTRACEOPT_BUFPOLICY },
+	{ "bufresize", dt_opt_bufresize, DTRACEOPT_BUFRESIZE },
+	{ "cleanrate", dt_opt_rate, DTRACEOPT_CLEANRATE },
+	{ "cpu", dt_opt_runtime, DTRACEOPT_CPU },
+	{ "destructive", dt_opt_runtime, DTRACEOPT_DESTRUCTIVE },
+	{ "dynvarsize", dt_opt_size, DTRACEOPT_DYNVARSIZE },
+	{ "grabanon", dt_opt_runtime, DTRACEOPT_GRABANON },
+	{ "jstackframes", dt_opt_runtime, DTRACEOPT_JSTACKFRAMES },
+	{ "jstackstrsize", dt_opt_size, DTRACEOPT_JSTACKSTRSIZE },
+	{ "nspec", dt_opt_runtime, DTRACEOPT_NSPEC },
+	{ "specsize", dt_opt_size, DTRACEOPT_SPECSIZE },
+	{ "stackframes", dt_opt_runtime, DTRACEOPT_STACKFRAMES },
+	{ "statusrate", dt_opt_rate, DTRACEOPT_STATUSRATE },
+	{ "strsize", dt_opt_strsize, DTRACEOPT_STRSIZE },
+	{ "ustackframes", dt_opt_runtime, DTRACEOPT_USTACKFRAMES },
+	{ NULL }
+};
+
+/*
+ * Dynamic run-time options.
+ */
+static const dt_option_t _dtrace_drtoptions[] = {
+	{ "aggrate", dt_opt_rate, DTRACEOPT_AGGRATE },
+	{ "aggsortkey", dt_opt_runtime, DTRACEOPT_AGGSORTKEY },
+	{ "aggsortkeypos", dt_opt_runtime, DTRACEOPT_AGGSORTKEYPOS },
+	{ "aggsortpos", dt_opt_runtime, DTRACEOPT_AGGSORTPOS },
+	{ "aggsortrev", dt_opt_runtime, DTRACEOPT_AGGSORTREV },
+	{ "flowindent", dt_opt_runtime, DTRACEOPT_FLOWINDENT },
+	{ "quiet", dt_opt_runtime, DTRACEOPT_QUIET },
+	{ "rawbytes", dt_opt_runtime, DTRACEOPT_RAWBYTES },
+	{ "stackindent", dt_opt_runtime, DTRACEOPT_STACKINDENT },
+	{ "switchrate", dt_opt_rate, DTRACEOPT_SWITCHRATE },
+	{ NULL }
+};
+
+int
+dtrace_getopt(dtrace_hdl_t *dtp, const char *opt, dtrace_optval_t *val)
+{
+	const dt_option_t *op;
+
+	if (opt == NULL)
+		return (dt_set_errno(dtp, EINVAL));
+
+	/*
+	 * We only need to search the run-time options -- it's not legal
+	 * to get the values of compile-time options.
+	 */
+	for (op = _dtrace_rtoptions; op->o_name != NULL; op++) {
+		if (strcmp(op->o_name, opt) == 0) {
+			*val = dtp->dt_options[op->o_option];
+			return (0);
+		}
+	}
+
+	for (op = _dtrace_drtoptions; op->o_name != NULL; op++) {
+		if (strcmp(op->o_name, opt) == 0) {
+			*val = dtp->dt_options[op->o_option];
+			return (0);
+		}
+	}
+
+	return (dt_set_errno(dtp, EDT_BADOPTNAME));
+}
+
+int
+dtrace_setopt(dtrace_hdl_t *dtp, const char *opt, const char *val)
+{
+	const dt_option_t *op;
+
+	if (opt == NULL)
+		return (dt_set_errno(dtp, EINVAL));
+
+	for (op = _dtrace_ctoptions; op->o_name != NULL; op++) {
+		if (strcmp(op->o_name, opt) == 0)
+			return (op->o_func(dtp, val, op->o_option));
+	}
+
+	for (op = _dtrace_drtoptions; op->o_name != NULL; op++) {
+		if (strcmp(op->o_name, opt) == 0)
+			return (op->o_func(dtp, val, op->o_option));
+	}
+
+	for (op = _dtrace_rtoptions; op->o_name != NULL; op++) {
+		if (strcmp(op->o_name, opt) == 0) {
+			/*
+			 * Only dynamic run-time options may be set while
+			 * tracing is active.
+			 */
+			if (dtp->dt_active)
+				return (dt_set_errno(dtp, EDT_ACTIVE));
+
+			return (op->o_func(dtp, val, op->o_option));
+		}
+	}
+
+	return (dt_set_errno(dtp, EDT_BADOPTNAME));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_parser.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_parser.c
new file mode 100644
index 0000000..fe857b4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_parser.c
@@ -0,0 +1,4897 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/*
+ * DTrace D Language Parser
+ *
+ * The D Parser is a lex/yacc parser consisting of the lexer dt_lex.l, the
+ * parsing grammar dt_grammar.y, and this file, dt_parser.c, which handles
+ * the construction of the parse tree nodes and their syntactic validation.
+ * The parse tree is constructed of dt_node_t structures (see <dt_parser.h>)
+ * that are built in two passes: (1) the "create" pass, where the parse tree
+ * nodes are allocated by calls from the grammar to dt_node_*() subroutines,
+ * and (2) the "cook" pass, where nodes are coalesced, assigned D types, and
+ * validated according to the syntactic rules of the language.
+ *
+ * All node allocations are performed using dt_node_alloc().  All node frees
+ * during the parsing phase are performed by dt_node_free(), which frees node-
+ * internal state but does not actually free the nodes.  All final node frees
+ * are done as part of the end of dt_compile() or as part of destroying
+ * persistent identifiers or translators which have embedded nodes.
+ *
+ * The dt_node_* routines that implement pass (1) may allocate new nodes.  The
+ * dt_cook_* routines that implement pass (2) may *not* allocate new nodes.
+ * They may free existing nodes using dt_node_free(), but they may not actually
+ * deallocate any dt_node_t's.  Currently dt_cook_op2() is an exception to this
+ * rule: see the comments therein for how this issue is resolved.
+ *
+ * The dt_cook_* routines are responsible for (at minimum) setting the final
+ * node type (dn_ctfp/dn_type) and attributes (dn_attr).  If dn_ctfp/dn_type
+ * are set manually (i.e. not by one of the type assignment functions), then
+ * the DT_NF_COOKED flag must be set manually on the node.
+ *
+ * The cooking pass can be applied to the same parse tree more than once (used
+ * in the case of a comma-separated list of probe descriptions).  As such, the
+ * cook routines must not perform any parse tree transformations which would
+ * be invalid if the tree were subsequently cooked using a different context.
+ *
+ * The dn_ctfp and dn_type fields form the type of the node.  This tuple can
+ * take on the following set of values, which form our type invariants:
+ *
+ * 1. dn_ctfp = NULL, dn_type = CTF_ERR
+ *
+ *    In this state, the node has unknown type and is not yet cooked.  The
+ *    DT_NF_COOKED flag is not yet set on the node.
+ *
+ * 2. dn_ctfp = DT_DYN_CTFP(dtp), dn_type = DT_DYN_TYPE(dtp)
+ *
+ *    In this state, the node is a dynamic D type.  This means that generic
+ *    operations are not valid on this node and only code that knows how to
+ *    examine the inner details of the node can operate on it.  A <DYN> node
+ *    must have dn_ident set to point to an identifier describing the object
+ *    and its type.  The DT_NF_REF flag is set for all nodes of type <DYN>.
+ *    At present, the D compiler uses the <DYN> type for:
+ *
+ *    - associative arrays that do not yet have a value type defined
+ *    - translated data (i.e. the result of the xlate operator)
+ *    - aggregations
+ *
+ * 3. dn_ctfp = DT_STR_CTFP(dtp), dn_type = DT_STR_TYPE(dtp)
+ *
+ *    In this state, the node is of type D string.  The string type is really
+ *    a char[0] typedef, but requires special handling throughout the compiler.
+ *
+ * 4. dn_ctfp != NULL, dn_type = any other type ID
+ *
+ *    In this state, the node is of some known D/CTF type.  The normal libctf
+ *    APIs can be used to learn more about the type name or structure.  When
+ *    the type is assigned, the DT_NF_SIGNED, DT_NF_REF, and DT_NF_BITFIELD
+ *    flags cache the corresponding attributes of the underlying CTF type.
+ */
+
+#ifndef VBOX
+#include <sys/param.h>
+#include <limits.h>
+#include <setjmp.h>
+#include <strings.h>
+#include <assert.h>
+#include <alloca.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <errno.h>
+#include <ctype.h>
+#else  /* VBOX */
+# include <ctype.h>
+# ifdef _MSC_VER
+#  pragma warning(disable:4146) /* -unsigned */
+#  pragma warning(disable:4267) /* size_t to int */
+# endif
+#endif /* VBOX */
+
+#include <dt_impl.h>
+#include <dt_grammar.h>
+#include <dt_module.h>
+#include <dt_provider.h>
+#include <dt_string.h>
+#include <dt_as.h>
+
+dt_pcb_t *yypcb;	/* current control block for parser */
+dt_node_t *yypragma;	/* lex token list for control lines */
+char yyintprefix;	/* int token macro prefix (+/-) */
+char yyintsuffix[4];	/* int token suffix string [uU][lL] */
+int yyintdecimal;	/* int token format flag (1=decimal, 0=octal/hex) */
+
+static const char *
+opstr(int op)
+{
+	switch (op) {
+	case DT_TOK_COMMA:	return (",");
+	case DT_TOK_ELLIPSIS:	return ("...");
+	case DT_TOK_ASGN:	return ("=");
+	case DT_TOK_ADD_EQ:	return ("+=");
+	case DT_TOK_SUB_EQ:	return ("-=");
+	case DT_TOK_MUL_EQ:	return ("*=");
+	case DT_TOK_DIV_EQ:	return ("/=");
+	case DT_TOK_MOD_EQ:	return ("%=");
+	case DT_TOK_AND_EQ:	return ("&=");
+	case DT_TOK_XOR_EQ:	return ("^=");
+	case DT_TOK_OR_EQ:	return ("|=");
+	case DT_TOK_LSH_EQ:	return ("<<=");
+	case DT_TOK_RSH_EQ:	return (">>=");
+	case DT_TOK_QUESTION:	return ("?");
+	case DT_TOK_COLON:	return (":");
+	case DT_TOK_LOR:	return ("||");
+	case DT_TOK_LXOR:	return ("^^");
+	case DT_TOK_LAND:	return ("&&");
+	case DT_TOK_BOR:	return ("|");
+	case DT_TOK_XOR:	return ("^");
+	case DT_TOK_BAND:	return ("&");
+	case DT_TOK_EQU:	return ("==");
+	case DT_TOK_NEQ:	return ("!=");
+	case DT_TOK_LT:		return ("<");
+	case DT_TOK_LE:		return ("<=");
+	case DT_TOK_GT:		return (">");
+	case DT_TOK_GE:		return (">=");
+	case DT_TOK_LSH:	return ("<<");
+	case DT_TOK_RSH:	return (">>");
+	case DT_TOK_ADD:	return ("+");
+	case DT_TOK_SUB:	return ("-");
+	case DT_TOK_MUL:	return ("*");
+	case DT_TOK_DIV:	return ("/");
+	case DT_TOK_MOD:	return ("%");
+	case DT_TOK_LNEG:	return ("!");
+	case DT_TOK_BNEG:	return ("~");
+	case DT_TOK_ADDADD:	return ("++");
+	case DT_TOK_PREINC:	return ("++");
+	case DT_TOK_POSTINC:	return ("++");
+	case DT_TOK_SUBSUB:	return ("--");
+	case DT_TOK_PREDEC:	return ("--");
+	case DT_TOK_POSTDEC:	return ("--");
+	case DT_TOK_IPOS:	return ("+");
+	case DT_TOK_INEG:	return ("-");
+	case DT_TOK_DEREF:	return ("*");
+	case DT_TOK_ADDROF:	return ("&");
+	case DT_TOK_OFFSETOF:	return ("offsetof");
+	case DT_TOK_SIZEOF:	return ("sizeof");
+	case DT_TOK_STRINGOF:	return ("stringof");
+	case DT_TOK_XLATE:	return ("xlate");
+	case DT_TOK_LPAR:	return ("(");
+	case DT_TOK_RPAR:	return (")");
+	case DT_TOK_LBRAC:	return ("[");
+	case DT_TOK_RBRAC:	return ("]");
+	case DT_TOK_PTR:	return ("->");
+	case DT_TOK_DOT:	return (".");
+	case DT_TOK_STRING:	return ("<string>");
+	case DT_TOK_IDENT:	return ("<ident>");
+	case DT_TOK_TNAME:	return ("<type>");
+	case DT_TOK_INT:	return ("<int>");
+	default:		return ("<?>");
+	}
+}
+
+int
+dt_type_lookup(const char *s, dtrace_typeinfo_t *tip)
+{
+	static const char delimiters[] = " \t\n\r\v\f*`";
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	const char *p, *q, *end, *obj;
+
+	for (p = s, end = s + strlen(s); *p != '\0'; p = q) {
+		while (isspace(*p))
+			p++;	/* skip leading whitespace prior to token */
+
+		if (p == end || (q = strpbrk(p + 1, delimiters)) == NULL)
+			break;	/* empty string or single token remaining */
+
+		if (*q == '`') {
+			char *object = alloca((size_t)(q - p) + 1);
+			char *type = alloca((size_t)(end - s) + 1);
+
+			/*
+			 * Copy from the start of the token (p) to the location
+			 * backquote (q) to extract the nul-terminated object.
+			 */
+			bcopy(p, object, (size_t)(q - p));
+			object[(size_t)(q - p)] = '\0';
+
+			/*
+			 * Copy the original string up to the start of this
+			 * token (p) into type, and then concatenate everything
+			 * after q.  This is the type name without the object.
+			 */
+			bcopy(s, type, (size_t)(p - s));
+			bcopy(q + 1, type + (size_t)(p - s), strlen(q + 1) + 1);
+
+			if (strchr(q + 1, '`') != NULL)
+				return (dt_set_errno(dtp, EDT_BADSCOPE));
+
+			return (dtrace_lookup_by_type(dtp, object, type, tip));
+		}
+	}
+
+	if (yypcb->pcb_idepth != 0)
+		obj = DTRACE_OBJ_CDEFS;
+	else
+		obj = DTRACE_OBJ_EVERY;
+
+	return (dtrace_lookup_by_type(dtp, obj, s, tip));
+}
+
+/*
+ * When we parse type expressions or parse an expression with unary "&", we
+ * need to find a type that is a pointer to a previously known type.
+ * Unfortunately CTF is limited to a per-container view, so ctf_type_pointer()
+ * alone does not suffice for our needs.  We provide a more intelligent wrapper
+ * for the compiler that attempts to compute a pointer to either the given type
+ * or its base (that is, we try both "foo_t *" and "struct foo *"), and also
+ * to potentially construct the required type on-the-fly.
+ */
+int
+dt_type_pointer(dtrace_typeinfo_t *tip)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	ctf_file_t *ctfp = tip->dtt_ctfp;
+	ctf_id_t type = tip->dtt_type;
+	ctf_id_t base = ctf_type_resolve(ctfp, type);
+
+	dt_module_t *dmp;
+	ctf_id_t ptr;
+
+	if ((ptr = ctf_type_pointer(ctfp, type)) != CTF_ERR ||
+	    (ptr = ctf_type_pointer(ctfp, base)) != CTF_ERR) {
+		tip->dtt_type = ptr;
+		return (0);
+	}
+
+	if (yypcb->pcb_idepth != 0)
+		dmp = dtp->dt_cdefs;
+	else
+		dmp = dtp->dt_ddefs;
+
+	if (ctfp != dmp->dm_ctfp && ctfp != ctf_parent_file(dmp->dm_ctfp) &&
+	    (type = ctf_add_type(dmp->dm_ctfp, ctfp, type)) == CTF_ERR) {
+		dtp->dt_ctferr = ctf_errno(dmp->dm_ctfp);
+		return (dt_set_errno(dtp, EDT_CTF));
+	}
+
+	ptr = ctf_add_pointer(dmp->dm_ctfp, CTF_ADD_ROOT, type);
+
+	if (ptr == CTF_ERR || ctf_update(dmp->dm_ctfp) == CTF_ERR) {
+		dtp->dt_ctferr = ctf_errno(dmp->dm_ctfp);
+		return (dt_set_errno(dtp, EDT_CTF));
+	}
+
+	tip->dtt_object = dmp->dm_name;
+	tip->dtt_ctfp = dmp->dm_ctfp;
+	tip->dtt_type = ptr;
+
+	return (0);
+}
+
+const char *
+dt_type_name(ctf_file_t *ctfp, ctf_id_t type, char *buf, size_t len)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+
+	if (ctfp == DT_FPTR_CTFP(dtp) && type == DT_FPTR_TYPE(dtp))
+		(void) snprintf(buf, len, "function pointer");
+	else if (ctfp == DT_FUNC_CTFP(dtp) && type == DT_FUNC_TYPE(dtp))
+		(void) snprintf(buf, len, "function");
+	else if (ctfp == DT_DYN_CTFP(dtp) && type == DT_DYN_TYPE(dtp))
+		(void) snprintf(buf, len, "dynamic variable");
+	else if (ctfp == NULL)
+		(void) snprintf(buf, len, "<none>");
+	else if (ctf_type_name(ctfp, type, buf, len) == NULL)
+		(void) snprintf(buf, len, "unknown");
+
+	return (buf);
+}
+
+/*
+ * Perform the "usual arithmetic conversions" to determine which of the two
+ * input operand types should be promoted and used as a result type.  The
+ * rules for this are described in ISOC[6.3.1.8] and K&R[A6.5].
+ */
+static void
+dt_type_promote(dt_node_t *lp, dt_node_t *rp, ctf_file_t **ofp, ctf_id_t *otype)
+{
+	ctf_file_t *lfp = lp->dn_ctfp;
+	ctf_id_t ltype = lp->dn_type;
+
+	ctf_file_t *rfp = rp->dn_ctfp;
+	ctf_id_t rtype = rp->dn_type;
+
+	ctf_id_t lbase = ctf_type_resolve(lfp, ltype);
+	uint_t lkind = ctf_type_kind(lfp, lbase);
+
+	ctf_id_t rbase = ctf_type_resolve(rfp, rtype);
+	uint_t rkind = ctf_type_kind(rfp, rbase);
+
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	ctf_encoding_t le, re;
+	uint_t lrank, rrank;
+
+	assert(lkind == CTF_K_INTEGER || lkind == CTF_K_ENUM);
+	assert(rkind == CTF_K_INTEGER || rkind == CTF_K_ENUM);
+
+	if (lkind == CTF_K_ENUM) {
+		lfp = DT_INT_CTFP(dtp);
+		ltype = lbase = DT_INT_TYPE(dtp);
+	}
+
+	if (rkind == CTF_K_ENUM) {
+		rfp = DT_INT_CTFP(dtp);
+		rtype = rbase = DT_INT_TYPE(dtp);
+	}
+
+	if (ctf_type_encoding(lfp, lbase, &le) == CTF_ERR) {
+		yypcb->pcb_hdl->dt_ctferr = ctf_errno(lfp);
+		longjmp(yypcb->pcb_jmpbuf, EDT_CTF);
+	}
+
+	if (ctf_type_encoding(rfp, rbase, &re) == CTF_ERR) {
+		yypcb->pcb_hdl->dt_ctferr = ctf_errno(rfp);
+		longjmp(yypcb->pcb_jmpbuf, EDT_CTF);
+	}
+
+	/*
+	 * Compute an integer rank based on the size and unsigned status.
+	 * If rank is identical, pick the "larger" of the equivalent types
+	 * which we define as having a larger base ctf_id_t.  If rank is
+	 * different, pick the type with the greater rank.
+	 */
+	lrank = le.cte_bits + ((le.cte_format & CTF_INT_SIGNED) == 0);
+	rrank = re.cte_bits + ((re.cte_format & CTF_INT_SIGNED) == 0);
+
+	if (lrank == rrank) {
+		if (lbase - rbase < 0)
+			goto return_rtype;
+		else
+			goto return_ltype;
+	} else if (lrank > rrank) {
+		goto return_ltype;
+	} else
+		goto return_rtype;
+
+return_ltype:
+	*ofp = lfp;
+	*otype = ltype;
+	return;
+
+return_rtype:
+	*ofp = rfp;
+	*otype = rtype;
+}
+
+void
+dt_node_promote(dt_node_t *lp, dt_node_t *rp, dt_node_t *dnp)
+{
+	dt_type_promote(lp, rp, &dnp->dn_ctfp, &dnp->dn_type);
+	dt_node_type_assign(dnp, dnp->dn_ctfp, dnp->dn_type);
+	dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+}
+
+const char *
+dt_node_name(const dt_node_t *dnp, char *buf, size_t len)
+{
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	const char *prefix = "", *suffix = "";
+	const dtrace_syminfo_t *dts;
+	char *s;
+
+	switch (dnp->dn_kind) {
+	case DT_NODE_INT:
+		(void) snprintf(buf, len, "integer constant 0x%llx",
+		    (u_longlong_t)dnp->dn_value);
+		break;
+	case DT_NODE_STRING:
+		s = strchr2esc(dnp->dn_string, strlen(dnp->dn_string));
+		(void) snprintf(buf, len, "string constant \"%s\"",
+		    s != NULL ? s : dnp->dn_string);
+		free(s);
+		break;
+	case DT_NODE_IDENT:
+		(void) snprintf(buf, len, "identifier %s", dnp->dn_string);
+		break;
+	case DT_NODE_VAR:
+	case DT_NODE_FUNC:
+	case DT_NODE_AGG:
+	case DT_NODE_INLINE:
+		switch (dnp->dn_ident->di_kind) {
+		case DT_IDENT_FUNC:
+		case DT_IDENT_AGGFUNC:
+		case DT_IDENT_ACTFUNC:
+			suffix = "( )";
+			break;
+		case DT_IDENT_AGG:
+			prefix = "@";
+			break;
+		}
+		(void) snprintf(buf, len, "%s %s%s%s",
+		    dt_idkind_name(dnp->dn_ident->di_kind),
+		    prefix, dnp->dn_ident->di_name, suffix);
+		break;
+	case DT_NODE_SYM:
+		dts = dnp->dn_ident->di_data;
+		(void) snprintf(buf, len, "symbol %s`%s",
+		    dts->dts_object, dts->dts_name);
+		break;
+	case DT_NODE_TYPE:
+		(void) snprintf(buf, len, "type %s",
+		    dt_node_type_name(dnp, n1, sizeof (n1)));
+		break;
+	case DT_NODE_OP1:
+	case DT_NODE_OP2:
+	case DT_NODE_OP3:
+		(void) snprintf(buf, len, "operator %s", opstr(dnp->dn_op));
+		break;
+	case DT_NODE_DEXPR:
+	case DT_NODE_DFUNC:
+		if (dnp->dn_expr)
+			return (dt_node_name(dnp->dn_expr, buf, len));
+		(void) snprintf(buf, len, "%s", "statement");
+		break;
+	case DT_NODE_PDESC:
+		if (dnp->dn_desc->dtpd_id == 0) {
+			(void) snprintf(buf, len,
+			    "probe description %s:%s:%s:%s",
+			    dnp->dn_desc->dtpd_provider, dnp->dn_desc->dtpd_mod,
+			    dnp->dn_desc->dtpd_func, dnp->dn_desc->dtpd_name);
+		} else {
+			(void) snprintf(buf, len, "probe description %u",
+			    dnp->dn_desc->dtpd_id);
+		}
+		break;
+	case DT_NODE_CLAUSE:
+		(void) snprintf(buf, len, "%s", "clause");
+		break;
+	case DT_NODE_MEMBER:
+		(void) snprintf(buf, len, "member %s", dnp->dn_membname);
+		break;
+	case DT_NODE_XLATOR:
+		(void) snprintf(buf, len, "translator <%s> (%s)",
+		    dt_type_name(dnp->dn_xlator->dx_dst_ctfp,
+		    dnp->dn_xlator->dx_dst_type, n1, sizeof (n1)),
+		    dt_type_name(dnp->dn_xlator->dx_src_ctfp,
+		    dnp->dn_xlator->dx_src_type, n2, sizeof (n2)));
+		break;
+	case DT_NODE_PROG:
+		(void) snprintf(buf, len, "%s", "program");
+		break;
+	default:
+		(void) snprintf(buf, len, "node <%u>", dnp->dn_kind);
+		break;
+	}
+
+	return (buf);
+}
+
+/*
+ * dt_node_xalloc() can be used to create new parse nodes from any libdtrace
+ * caller.  The caller is responsible for assigning dn_link appropriately.
+ */
+dt_node_t *
+dt_node_xalloc(dtrace_hdl_t *dtp, int kind)
+{
+	dt_node_t *dnp = dt_alloc(dtp, sizeof (dt_node_t));
+
+	if (dnp == NULL)
+		return (NULL);
+
+	dnp->dn_ctfp = NULL;
+	dnp->dn_type = CTF_ERR;
+	dnp->dn_kind = (uchar_t)kind;
+	dnp->dn_flags = 0;
+	dnp->dn_op = 0;
+	dnp->dn_line = -1;
+	dnp->dn_reg = -1;
+	dnp->dn_attr = _dtrace_defattr;
+	dnp->dn_list = NULL;
+	dnp->dn_link = NULL;
+	bzero(&dnp->dn_u, sizeof (dnp->dn_u));
+
+	return (dnp);
+}
+
+/*
+ * dt_node_alloc() is used to create new parse nodes from the parser.  It
+ * assigns the node location based on the current lexer line number and places
+ * the new node on the default allocation list.  If allocation fails, we
+ * automatically longjmp the caller back to the enclosing compilation call.
+ */
+static dt_node_t *
+dt_node_alloc(int kind)
+{
+	dt_node_t *dnp = dt_node_xalloc(yypcb->pcb_hdl, kind);
+
+	if (dnp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dnp->dn_line = yylineno;
+	dnp->dn_link = yypcb->pcb_list;
+	yypcb->pcb_list = dnp;
+
+	return (dnp);
+}
+
+void
+dt_node_free(dt_node_t *dnp)
+{
+	uchar_t kind = dnp->dn_kind;
+
+	dnp->dn_kind = DT_NODE_FREE;
+
+	switch (kind) {
+	case DT_NODE_STRING:
+	case DT_NODE_IDENT:
+	case DT_NODE_TYPE:
+		free(dnp->dn_string);
+		dnp->dn_string = NULL;
+		break;
+
+	case DT_NODE_VAR:
+	case DT_NODE_FUNC:
+	case DT_NODE_PROBE:
+		if (dnp->dn_ident != NULL) {
+			if (dnp->dn_ident->di_flags & DT_IDFLG_ORPHAN)
+				dt_ident_destroy(dnp->dn_ident);
+			dnp->dn_ident = NULL;
+		}
+		dt_node_list_free(&dnp->dn_args);
+		break;
+
+	case DT_NODE_OP1:
+		if (dnp->dn_child != NULL) {
+			dt_node_free(dnp->dn_child);
+			dnp->dn_child = NULL;
+		}
+		break;
+
+	case DT_NODE_OP3:
+		if (dnp->dn_expr != NULL) {
+			dt_node_free(dnp->dn_expr);
+			dnp->dn_expr = NULL;
+		}
+		/*FALLTHRU*/
+	case DT_NODE_OP2:
+		if (dnp->dn_left != NULL) {
+			dt_node_free(dnp->dn_left);
+			dnp->dn_left = NULL;
+		}
+		if (dnp->dn_right != NULL) {
+			dt_node_free(dnp->dn_right);
+			dnp->dn_right = NULL;
+		}
+		break;
+
+	case DT_NODE_DEXPR:
+	case DT_NODE_DFUNC:
+		if (dnp->dn_expr != NULL) {
+			dt_node_free(dnp->dn_expr);
+			dnp->dn_expr = NULL;
+		}
+		break;
+
+	case DT_NODE_AGG:
+		if (dnp->dn_aggfun != NULL) {
+			dt_node_free(dnp->dn_aggfun);
+			dnp->dn_aggfun = NULL;
+		}
+		dt_node_list_free(&dnp->dn_aggtup);
+		break;
+
+	case DT_NODE_PDESC:
+		free(dnp->dn_spec);
+		dnp->dn_spec = NULL;
+		free(dnp->dn_desc);
+		dnp->dn_desc = NULL;
+		break;
+
+	case DT_NODE_CLAUSE:
+		if (dnp->dn_pred != NULL)
+			dt_node_free(dnp->dn_pred);
+		if (dnp->dn_locals != NULL)
+			dt_idhash_destroy(dnp->dn_locals);
+		dt_node_list_free(&dnp->dn_pdescs);
+		dt_node_list_free(&dnp->dn_acts);
+		break;
+
+	case DT_NODE_MEMBER:
+		free(dnp->dn_membname);
+		dnp->dn_membname = NULL;
+		if (dnp->dn_membexpr != NULL) {
+			dt_node_free(dnp->dn_membexpr);
+			dnp->dn_membexpr = NULL;
+		}
+		break;
+
+	case DT_NODE_PROVIDER:
+		dt_node_list_free(&dnp->dn_probes);
+		free(dnp->dn_provname);
+		dnp->dn_provname = NULL;
+		break;
+
+	case DT_NODE_PROG:
+		dt_node_list_free(&dnp->dn_list);
+		break;
+	}
+}
+
+void
+dt_node_attr_assign(dt_node_t *dnp, dtrace_attribute_t attr)
+{
+	if ((yypcb->pcb_cflags & DTRACE_C_EATTR) &&
+	    (dt_attr_cmp(attr, yypcb->pcb_amin) < 0)) {
+		char a[DTRACE_ATTR2STR_MAX];
+		char s[BUFSIZ];
+
+		dnerror(dnp, D_ATTR_MIN, "attributes for %s (%s) are less than "
+		    "predefined minimum\n", dt_node_name(dnp, s, sizeof (s)),
+		    dtrace_attr2str(attr, a, sizeof (a)));
+	}
+
+	dnp->dn_attr = attr;
+}
+
+void
+dt_node_type_assign(dt_node_t *dnp, ctf_file_t *fp, ctf_id_t type)
+{
+	ctf_id_t base = ctf_type_resolve(fp, type);
+	uint_t kind = ctf_type_kind(fp, base);
+	ctf_encoding_t e;
+
+	dnp->dn_flags &=
+	    ~(DT_NF_SIGNED | DT_NF_REF | DT_NF_BITFIELD | DT_NF_USERLAND);
+
+	if (kind == CTF_K_INTEGER && ctf_type_encoding(fp, base, &e) == 0) {
+		size_t size = e.cte_bits / NBBY;
+
+		if (size > 8 || (e.cte_bits % NBBY) != 0 || (size & (size - 1)))
+			dnp->dn_flags |= DT_NF_BITFIELD;
+
+		if (e.cte_format & CTF_INT_SIGNED)
+			dnp->dn_flags |= DT_NF_SIGNED;
+	}
+
+	if (kind == CTF_K_FLOAT && ctf_type_encoding(fp, base, &e) == 0) {
+		if (e.cte_bits / NBBY > sizeof (uint64_t))
+			dnp->dn_flags |= DT_NF_REF;
+	}
+
+	if (kind == CTF_K_STRUCT || kind == CTF_K_UNION ||
+	    kind == CTF_K_FORWARD ||
+	    kind == CTF_K_ARRAY || kind == CTF_K_FUNCTION)
+		dnp->dn_flags |= DT_NF_REF;
+	else if (yypcb != NULL && fp == DT_DYN_CTFP(yypcb->pcb_hdl) &&
+	    type == DT_DYN_TYPE(yypcb->pcb_hdl))
+		dnp->dn_flags |= DT_NF_REF;
+
+	dnp->dn_flags |= DT_NF_COOKED;
+	dnp->dn_ctfp = fp;
+	dnp->dn_type = type;
+}
+
+void
+dt_node_type_propagate(const dt_node_t *src, dt_node_t *dst)
+{
+	assert(src->dn_flags & DT_NF_COOKED);
+	dst->dn_flags = src->dn_flags & ~DT_NF_LVALUE;
+	dst->dn_ctfp = src->dn_ctfp;
+	dst->dn_type = src->dn_type;
+}
+
+const char *
+dt_node_type_name(const dt_node_t *dnp, char *buf, size_t len)
+{
+	if (dt_node_is_dynamic(dnp) && dnp->dn_ident != NULL) {
+		(void) snprintf(buf, len, "%s",
+		    dt_idkind_name(dt_ident_resolve(dnp->dn_ident)->di_kind));
+		return (buf);
+	}
+
+	if (dnp->dn_flags & DT_NF_USERLAND) {
+		size_t n = snprintf(buf, len, "userland ");
+		len = len > n ? len - n : 0;
+		(void) dt_type_name(dnp->dn_ctfp, dnp->dn_type, buf + n, len);
+		return (buf);
+	}
+
+	return (dt_type_name(dnp->dn_ctfp, dnp->dn_type, buf, len));
+}
+
+size_t
+dt_node_type_size(const dt_node_t *dnp)
+{
+	if (dnp->dn_kind == DT_NODE_STRING)
+		return (strlen(dnp->dn_string) + 1);
+
+	if (dt_node_is_dynamic(dnp) && dnp->dn_ident != NULL)
+		return (dt_ident_size(dnp->dn_ident));
+
+	return (ctf_type_size(dnp->dn_ctfp, dnp->dn_type));
+}
+
+/*
+ * Determine if the specified parse tree node references an identifier of the
+ * specified kind, and if so return a pointer to it; otherwise return NULL.
+ * This function resolves the identifier itself, following through any inlines.
+ */
+dt_ident_t *
+dt_node_resolve(const dt_node_t *dnp, uint_t idkind)
+{
+	dt_ident_t *idp;
+
+	switch (dnp->dn_kind) {
+	case DT_NODE_VAR:
+	case DT_NODE_SYM:
+	case DT_NODE_FUNC:
+	case DT_NODE_AGG:
+	case DT_NODE_INLINE:
+	case DT_NODE_PROBE:
+		idp = dt_ident_resolve(dnp->dn_ident);
+		return (idp->di_kind == idkind ? idp : NULL);
+	}
+
+	if (dt_node_is_dynamic(dnp)) {
+		idp = dt_ident_resolve(dnp->dn_ident);
+		return (idp->di_kind == idkind ? idp : NULL);
+	}
+
+	return (NULL);
+}
+
+size_t
+dt_node_sizeof(const dt_node_t *dnp)
+{
+	dtrace_syminfo_t *sip;
+	GElf_Sym sym;
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+
+	/*
+	 * The size of the node as used for the sizeof() operator depends on
+	 * the kind of the node.  If the node is a SYM, the size is obtained
+	 * from the symbol table; if it is not a SYM, the size is determined
+	 * from the node's type.  This is slightly different from C's sizeof()
+	 * operator in that (for example) when applied to a function, sizeof()
+	 * will evaluate to the length of the function rather than the size of
+	 * the function type.
+	 */
+	if (dnp->dn_kind != DT_NODE_SYM)
+		return (dt_node_type_size(dnp));
+
+	sip = dnp->dn_ident->di_data;
+
+	if (dtrace_lookup_by_name(dtp, sip->dts_object,
+	    sip->dts_name, &sym, NULL) == -1)
+		return (0);
+
+	return (sym.st_size);
+}
+
+int
+dt_node_is_integer(const dt_node_t *dnp)
+{
+	ctf_file_t *fp = dnp->dn_ctfp;
+	ctf_encoding_t e;
+	ctf_id_t type;
+	uint_t kind;
+
+	assert(dnp->dn_flags & DT_NF_COOKED);
+
+	type = ctf_type_resolve(fp, dnp->dn_type);
+	kind = ctf_type_kind(fp, type);
+
+	if (kind == CTF_K_INTEGER &&
+	    ctf_type_encoding(fp, type, &e) == 0 && IS_VOID(e))
+		return (0); /* void integer */
+
+	return (kind == CTF_K_INTEGER || kind == CTF_K_ENUM);
+}
+
+int
+dt_node_is_float(const dt_node_t *dnp)
+{
+	ctf_file_t *fp = dnp->dn_ctfp;
+	ctf_encoding_t e;
+	ctf_id_t type;
+	uint_t kind;
+
+	assert(dnp->dn_flags & DT_NF_COOKED);
+
+	type = ctf_type_resolve(fp, dnp->dn_type);
+	kind = ctf_type_kind(fp, type);
+
+	return (kind == CTF_K_FLOAT &&
+	    ctf_type_encoding(dnp->dn_ctfp, type, &e) == 0 && (
+	    e.cte_format == CTF_FP_SINGLE || e.cte_format == CTF_FP_DOUBLE ||
+	    e.cte_format == CTF_FP_LDOUBLE));
+}
+
+int
+dt_node_is_scalar(const dt_node_t *dnp)
+{
+	ctf_file_t *fp = dnp->dn_ctfp;
+	ctf_encoding_t e;
+	ctf_id_t type;
+	uint_t kind;
+
+	assert(dnp->dn_flags & DT_NF_COOKED);
+
+	type = ctf_type_resolve(fp, dnp->dn_type);
+	kind = ctf_type_kind(fp, type);
+
+	if (kind == CTF_K_INTEGER &&
+	    ctf_type_encoding(fp, type, &e) == 0 && IS_VOID(e))
+		return (0); /* void cannot be used as a scalar */
+
+	return (kind == CTF_K_INTEGER || kind == CTF_K_ENUM ||
+	    kind == CTF_K_POINTER);
+}
+
+int
+dt_node_is_arith(const dt_node_t *dnp)
+{
+	ctf_file_t *fp = dnp->dn_ctfp;
+	ctf_encoding_t e;
+	ctf_id_t type;
+	uint_t kind;
+
+	assert(dnp->dn_flags & DT_NF_COOKED);
+
+	type = ctf_type_resolve(fp, dnp->dn_type);
+	kind = ctf_type_kind(fp, type);
+
+	if (kind == CTF_K_INTEGER)
+		return (ctf_type_encoding(fp, type, &e) == 0 && !IS_VOID(e));
+	else
+		return (kind == CTF_K_ENUM);
+}
+
+int
+dt_node_is_vfptr(const dt_node_t *dnp)
+{
+	ctf_file_t *fp = dnp->dn_ctfp;
+	ctf_encoding_t e;
+	ctf_id_t type;
+	uint_t kind;
+
+	assert(dnp->dn_flags & DT_NF_COOKED);
+
+	type = ctf_type_resolve(fp, dnp->dn_type);
+	if (ctf_type_kind(fp, type) != CTF_K_POINTER)
+		return (0); /* type is not a pointer */
+
+	type = ctf_type_resolve(fp, ctf_type_reference(fp, type));
+	kind = ctf_type_kind(fp, type);
+
+	return (kind == CTF_K_FUNCTION || (kind == CTF_K_INTEGER &&
+	    ctf_type_encoding(fp, type, &e) == 0 && IS_VOID(e)));
+}
+
+int
+dt_node_is_dynamic(const dt_node_t *dnp)
+{
+	if (dnp->dn_kind == DT_NODE_VAR &&
+	    (dnp->dn_ident->di_flags & DT_IDFLG_INLINE)) {
+		const dt_idnode_t *inp = dnp->dn_ident->di_iarg;
+		return (inp->din_root ? dt_node_is_dynamic(inp->din_root) : 0);
+	}
+
+	return (dnp->dn_ctfp == DT_DYN_CTFP(yypcb->pcb_hdl) &&
+	    dnp->dn_type == DT_DYN_TYPE(yypcb->pcb_hdl));
+}
+
+int
+dt_node_is_string(const dt_node_t *dnp)
+{
+	return (dnp->dn_ctfp == DT_STR_CTFP(yypcb->pcb_hdl) &&
+	    dnp->dn_type == DT_STR_TYPE(yypcb->pcb_hdl));
+}
+
+int
+dt_node_is_stack(const dt_node_t *dnp)
+{
+	return (dnp->dn_ctfp == DT_STACK_CTFP(yypcb->pcb_hdl) &&
+	    dnp->dn_type == DT_STACK_TYPE(yypcb->pcb_hdl));
+}
+
+int
+dt_node_is_symaddr(const dt_node_t *dnp)
+{
+	return (dnp->dn_ctfp == DT_SYMADDR_CTFP(yypcb->pcb_hdl) &&
+	    dnp->dn_type == DT_SYMADDR_TYPE(yypcb->pcb_hdl));
+}
+
+int
+dt_node_is_usymaddr(const dt_node_t *dnp)
+{
+	return (dnp->dn_ctfp == DT_USYMADDR_CTFP(yypcb->pcb_hdl) &&
+	    dnp->dn_type == DT_USYMADDR_TYPE(yypcb->pcb_hdl));
+}
+
+int
+dt_node_is_strcompat(const dt_node_t *dnp)
+{
+	ctf_file_t *fp = dnp->dn_ctfp;
+	ctf_encoding_t e;
+	ctf_arinfo_t r;
+	ctf_id_t base;
+	uint_t kind;
+
+	assert(dnp->dn_flags & DT_NF_COOKED);
+
+	base = ctf_type_resolve(fp, dnp->dn_type);
+	kind = ctf_type_kind(fp, base);
+
+	if (kind == CTF_K_POINTER &&
+	    (base = ctf_type_reference(fp, base)) != CTF_ERR &&
+	    (base = ctf_type_resolve(fp, base)) != CTF_ERR &&
+	    ctf_type_encoding(fp, base, &e) == 0 && IS_CHAR(e))
+		return (1); /* promote char pointer to string */
+
+	if (kind == CTF_K_ARRAY && ctf_array_info(fp, base, &r) == 0 &&
+	    (base = ctf_type_resolve(fp, r.ctr_contents)) != CTF_ERR &&
+	    ctf_type_encoding(fp, base, &e) == 0 && IS_CHAR(e))
+		return (1); /* promote char array to string */
+
+	return (0);
+}
+
+int
+dt_node_is_pointer(const dt_node_t *dnp)
+{
+	ctf_file_t *fp = dnp->dn_ctfp;
+	uint_t kind;
+
+	assert(dnp->dn_flags & DT_NF_COOKED);
+
+	if (dt_node_is_string(dnp))
+		return (0); /* string are pass-by-ref but act like structs */
+
+	kind = ctf_type_kind(fp, ctf_type_resolve(fp, dnp->dn_type));
+	return (kind == CTF_K_POINTER || kind == CTF_K_ARRAY);
+}
+
+int
+dt_node_is_void(const dt_node_t *dnp)
+{
+	ctf_file_t *fp = dnp->dn_ctfp;
+	ctf_encoding_t e;
+	ctf_id_t type;
+
+	if (dt_node_is_dynamic(dnp))
+		return (0); /* <DYN> is an alias for void but not the same */
+
+	if (dt_node_is_stack(dnp))
+		return (0);
+
+	if (dt_node_is_symaddr(dnp) || dt_node_is_usymaddr(dnp))
+		return (0);
+
+	type = ctf_type_resolve(fp, dnp->dn_type);
+
+	return (ctf_type_kind(fp, type) == CTF_K_INTEGER &&
+	    ctf_type_encoding(fp, type, &e) == 0 && IS_VOID(e));
+}
+
+int
+dt_node_is_ptrcompat(const dt_node_t *lp, const dt_node_t *rp,
+    ctf_file_t **fpp, ctf_id_t *tp)
+{
+	ctf_file_t *lfp = lp->dn_ctfp;
+	ctf_file_t *rfp = rp->dn_ctfp;
+
+	ctf_id_t lbase = CTF_ERR, rbase = CTF_ERR;
+	ctf_id_t lref = CTF_ERR, rref = CTF_ERR;
+
+	int lp_is_void, rp_is_void, lp_is_int, rp_is_int, compat;
+	uint_t lkind, rkind;
+	ctf_encoding_t e;
+	ctf_arinfo_t r;
+
+	assert(lp->dn_flags & DT_NF_COOKED);
+	assert(rp->dn_flags & DT_NF_COOKED);
+
+	if (dt_node_is_dynamic(lp) || dt_node_is_dynamic(rp))
+		return (0); /* fail if either node is a dynamic variable */
+
+	lp_is_int = dt_node_is_integer(lp);
+	rp_is_int = dt_node_is_integer(rp);
+
+	if (lp_is_int && rp_is_int)
+		return (0); /* fail if both nodes are integers */
+
+	if (lp_is_int && (lp->dn_kind != DT_NODE_INT || lp->dn_value != 0))
+		return (0); /* fail if lp is an integer that isn't 0 constant */
+
+	if (rp_is_int && (rp->dn_kind != DT_NODE_INT || rp->dn_value != 0))
+		return (0); /* fail if rp is an integer that isn't 0 constant */
+
+	if ((lp_is_int == 0 && rp_is_int == 0) && (
+	    (lp->dn_flags & DT_NF_USERLAND) ^ (rp->dn_flags & DT_NF_USERLAND)))
+		return (0); /* fail if only one pointer is a userland address */
+
+	/*
+	 * Resolve the left-hand and right-hand types to their base type, and
+	 * then resolve the referenced type as well (assuming the base type
+	 * is CTF_K_POINTER or CTF_K_ARRAY).  Otherwise [lr]ref = CTF_ERR.
+	 */
+	if (!lp_is_int) {
+		lbase = ctf_type_resolve(lfp, lp->dn_type);
+		lkind = ctf_type_kind(lfp, lbase);
+
+		if (lkind == CTF_K_POINTER) {
+			lref = ctf_type_resolve(lfp,
+			    ctf_type_reference(lfp, lbase));
+		} else if (lkind == CTF_K_ARRAY &&
+		    ctf_array_info(lfp, lbase, &r) == 0) {
+			lref = ctf_type_resolve(lfp, r.ctr_contents);
+		}
+	}
+
+	if (!rp_is_int) {
+		rbase = ctf_type_resolve(rfp, rp->dn_type);
+		rkind = ctf_type_kind(rfp, rbase);
+
+		if (rkind == CTF_K_POINTER) {
+			rref = ctf_type_resolve(rfp,
+			    ctf_type_reference(rfp, rbase));
+		} else if (rkind == CTF_K_ARRAY &&
+		    ctf_array_info(rfp, rbase, &r) == 0) {
+			rref = ctf_type_resolve(rfp, r.ctr_contents);
+		}
+	}
+
+	/*
+	 * We know that one or the other type may still be a zero-valued
+	 * integer constant.  To simplify the code below, set the integer
+	 * type variables equal to the non-integer types and proceed.
+	 */
+	if (lp_is_int) {
+		lbase = rbase;
+		lkind = rkind;
+		lref = rref;
+		lfp = rfp;
+	} else if (rp_is_int) {
+		rbase = lbase;
+		rkind = lkind;
+		rref = lref;
+		rfp = lfp;
+	}
+
+	lp_is_void = ctf_type_encoding(lfp, lref, &e) == 0 && IS_VOID(e);
+	rp_is_void = ctf_type_encoding(rfp, rref, &e) == 0 && IS_VOID(e);
+
+	/*
+	 * The types are compatible if both are pointers to the same type, or
+	 * if either pointer is a void pointer.  If they are compatible, set
+	 * tp to point to the more specific pointer type and return it.
+	 */
+	compat = (lkind == CTF_K_POINTER || lkind == CTF_K_ARRAY) &&
+	    (rkind == CTF_K_POINTER || rkind == CTF_K_ARRAY) &&
+	    (lp_is_void || rp_is_void || ctf_type_compat(lfp, lref, rfp, rref));
+
+	if (compat) {
+		if (fpp != NULL)
+			*fpp = rp_is_void ? lfp : rfp;
+		if (tp != NULL)
+			*tp = rp_is_void ? lbase : rbase;
+	}
+
+	return (compat);
+}
+
+/*
+ * The rules for checking argument types against parameter types are described
+ * in the ANSI-C spec (see K&R[A7.3.2] and K&R[A7.17]).  We use the same rule
+ * set to determine whether associative array arguments match the prototype.
+ */
+int
+dt_node_is_argcompat(const dt_node_t *lp, const dt_node_t *rp)
+{
+	ctf_file_t *lfp = lp->dn_ctfp;
+	ctf_file_t *rfp = rp->dn_ctfp;
+
+	assert(lp->dn_flags & DT_NF_COOKED);
+	assert(rp->dn_flags & DT_NF_COOKED);
+
+	if (dt_node_is_integer(lp) && dt_node_is_integer(rp))
+		return (1); /* integer types are compatible */
+
+	if (dt_node_is_strcompat(lp) && dt_node_is_strcompat(rp))
+		return (1); /* string types are compatible */
+
+	if (dt_node_is_stack(lp) && dt_node_is_stack(rp))
+		return (1); /* stack types are compatible */
+
+	if (dt_node_is_symaddr(lp) && dt_node_is_symaddr(rp))
+		return (1); /* symaddr types are compatible */
+
+	if (dt_node_is_usymaddr(lp) && dt_node_is_usymaddr(rp))
+		return (1); /* usymaddr types are compatible */
+
+	switch (ctf_type_kind(lfp, ctf_type_resolve(lfp, lp->dn_type))) {
+	case CTF_K_FUNCTION:
+	case CTF_K_STRUCT:
+	case CTF_K_UNION:
+		return (ctf_type_compat(lfp, lp->dn_type, rfp, rp->dn_type));
+	default:
+		return (dt_node_is_ptrcompat(lp, rp, NULL, NULL));
+	}
+}
+
+/*
+ * We provide dt_node_is_posconst() as a convenience routine for callers who
+ * wish to verify that an argument is a positive non-zero integer constant.
+ */
+int
+dt_node_is_posconst(const dt_node_t *dnp)
+{
+	return (dnp->dn_kind == DT_NODE_INT && dnp->dn_value != 0 && (
+	    (dnp->dn_flags & DT_NF_SIGNED) == 0 || (int64_t)dnp->dn_value > 0));
+}
+
+int
+dt_node_is_actfunc(const dt_node_t *dnp)
+{
+	return (dnp->dn_kind == DT_NODE_FUNC &&
+	    dnp->dn_ident->di_kind == DT_IDENT_ACTFUNC);
+}
+
+/*
+ * The original rules for integer constant typing are described in K&R[A2.5.1].
+ * However, since we support long long, we instead use the rules from ISO C99
+ * clause 6.4.4.1 since that is where long longs are formally described.  The
+ * rules require us to know whether the constant was specified in decimal or
+ * in octal or hex, which we do by looking at our lexer's 'yyintdecimal' flag.
+ * The type of an integer constant is the first of the corresponding list in
+ * which its value can be represented:
+ *
+ * unsuffixed decimal:   int, long, long long
+ * unsuffixed oct/hex:   int, unsigned int, long, unsigned long,
+ *                       long long, unsigned long long
+ * suffix [uU]:          unsigned int, unsigned long, unsigned long long
+ * suffix [lL] decimal:  long, long long
+ * suffix [lL] oct/hex:  long, unsigned long, long long, unsigned long long
+ * suffix [uU][Ll]:      unsigned long, unsigned long long
+ * suffix ll/LL decimal: long long
+ * suffix ll/LL oct/hex: long long, unsigned long long
+ * suffix [uU][ll/LL]:   unsigned long long
+ *
+ * Given that our lexer has already validated the suffixes by regexp matching,
+ * there is an obvious way to concisely encode these rules: construct an array
+ * of the types in the order int, unsigned int, long, unsigned long, long long,
+ * unsigned long long.  Compute an integer array starting index based on the
+ * suffix (e.g. none = 0, u = 1, ull = 5), and compute an increment based on
+ * the specifier (dec/oct/hex) and suffix (u).  Then iterate from the starting
+ * index to the end, advancing using the increment, and searching until we
+ * find a limit that matches or we run out of choices (overflow).  To make it
+ * even faster, we precompute the table of type information in dtrace_open().
+ */
+dt_node_t *
+dt_node_int(uintmax_t value)
+{
+	dt_node_t *dnp = dt_node_alloc(DT_NODE_INT);
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+
+	int n = (yyintdecimal | (yyintsuffix[0] == 'u')) + 1;
+	int i = 0;
+
+	const char *p;
+	char c;
+
+	dnp->dn_op = DT_TOK_INT;
+	dnp->dn_value = value;
+
+	for (p = yyintsuffix; (c = *p) != '\0'; p++) {
+		if (c == 'U' || c == 'u')
+			i += 1;
+		else if (c == 'L' || c == 'l')
+			i += 2;
+	}
+
+	for (; i < sizeof (dtp->dt_ints) / sizeof (dtp->dt_ints[0]); i += n) {
+		if (value <= dtp->dt_ints[i].did_limit) {
+			dt_node_type_assign(dnp,
+			    dtp->dt_ints[i].did_ctfp,
+			    dtp->dt_ints[i].did_type);
+
+			/*
+			 * If a prefix character is present in macro text, add
+			 * in the corresponding operator node (see dt_lex.l).
+			 */
+			switch (yyintprefix) {
+			case '+':
+				return (dt_node_op1(DT_TOK_IPOS, dnp));
+			case '-':
+				return (dt_node_op1(DT_TOK_INEG, dnp));
+			default:
+				return (dnp);
+			}
+		}
+	}
+
+	xyerror(D_INT_OFLOW, "integer constant 0x%llx cannot be represented "
+	    "in any built-in integral type\n", (u_longlong_t)value);
+	/*NOTREACHED*/
+	return (NULL);		/* keep gcc happy */
+}
+
+dt_node_t *
+dt_node_string(char *string)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_node_t *dnp;
+
+	if (string == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dnp = dt_node_alloc(DT_NODE_STRING);
+	dnp->dn_op = DT_TOK_STRING;
+	dnp->dn_string = string;
+	dt_node_type_assign(dnp, DT_STR_CTFP(dtp), DT_STR_TYPE(dtp));
+
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_ident(char *name)
+{
+	dt_ident_t *idp;
+	dt_node_t *dnp;
+
+	if (name == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	/*
+	 * If the identifier is an inlined integer constant, then create an INT
+	 * node that is a clone of the inline parse tree node and return that
+	 * immediately, allowing this inline to be used in parsing contexts
+	 * that require constant expressions (e.g. scalar array sizes).
+	 */
+	if ((idp = dt_idstack_lookup(&yypcb->pcb_globals, name)) != NULL &&
+	    (idp->di_flags & DT_IDFLG_INLINE)) {
+		dt_idnode_t *inp = idp->di_iarg;
+
+		if (inp->din_root != NULL &&
+		    inp->din_root->dn_kind == DT_NODE_INT) {
+			free(name);
+
+			dnp = dt_node_alloc(DT_NODE_INT);
+			dnp->dn_op = DT_TOK_INT;
+			dnp->dn_value = inp->din_root->dn_value;
+			dt_node_type_propagate(inp->din_root, dnp);
+
+			return (dnp);
+		}
+	}
+
+	dnp = dt_node_alloc(DT_NODE_IDENT);
+	dnp->dn_op = name[0] == '@' ? DT_TOK_AGG : DT_TOK_IDENT;
+	dnp->dn_string = name;
+
+	return (dnp);
+}
+
+/*
+ * Create an empty node of type corresponding to the given declaration.
+ * Explicit references to user types (C or D) are assigned the default
+ * stability; references to other types are _dtrace_typattr (Private).
+ */
+dt_node_t *
+dt_node_type(dt_decl_t *ddp)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dtrace_typeinfo_t dtt;
+	dt_node_t *dnp;
+	char *name = NULL;
+	int err;
+
+	/*
+	 * If 'ddp' is NULL, we get a decl by popping the decl stack.  This
+	 * form of dt_node_type() is used by parameter rules in dt_grammar.y.
+	 */
+	if (ddp == NULL)
+		ddp = dt_decl_pop_param(&name);
+
+	err = dt_decl_type(ddp, &dtt);
+	dt_decl_free(ddp);
+
+	if (err != 0) {
+		free(name);
+		longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+	}
+
+	dnp = dt_node_alloc(DT_NODE_TYPE);
+	dnp->dn_op = DT_TOK_IDENT;
+	dnp->dn_string = name;
+	dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type);
+
+	if (dtt.dtt_ctfp == dtp->dt_cdefs->dm_ctfp ||
+	    dtt.dtt_ctfp == dtp->dt_ddefs->dm_ctfp)
+		dt_node_attr_assign(dnp, _dtrace_defattr);
+	else
+		dt_node_attr_assign(dnp, _dtrace_typattr);
+
+	return (dnp);
+}
+
+/*
+ * Create a type node corresponding to a varargs (...) parameter by just
+ * assigning it type CTF_ERR.  The decl processing code will handle this.
+ */
+dt_node_t *
+dt_node_vatype(void)
+{
+	dt_node_t *dnp = dt_node_alloc(DT_NODE_TYPE);
+
+	dnp->dn_op = DT_TOK_IDENT;
+	dnp->dn_ctfp = yypcb->pcb_hdl->dt_cdefs->dm_ctfp;
+	dnp->dn_type = CTF_ERR;
+	dnp->dn_attr = _dtrace_defattr;
+
+	return (dnp);
+}
+
+/*
+ * Instantiate a decl using the contents of the current declaration stack.  As
+ * we do not currently permit decls to be initialized, this function currently
+ * returns NULL and no parse node is created.  When this function is called,
+ * the topmost scope's ds_ident pointer will be set to NULL (indicating no
+ * init_declarator rule was matched) or will point to the identifier to use.
+ */
+dt_node_t *
+dt_node_decl(void)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+	dt_dclass_t class = dsp->ds_class;
+	dt_decl_t *ddp = dt_decl_top();
+
+	dt_module_t *dmp;
+	dtrace_typeinfo_t dtt;
+	ctf_id_t type;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	if (dt_decl_type(ddp, &dtt) != 0)
+		longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+
+	/*
+	 * If we have no declaration identifier, then this is either a spurious
+	 * declaration of an intrinsic type (e.g. "extern int;") or declaration
+	 * or redeclaration of a struct, union, or enum type or tag.
+	 */
+	if (dsp->ds_ident == NULL) {
+		if (ddp->dd_kind != CTF_K_STRUCT &&
+		    ddp->dd_kind != CTF_K_UNION && ddp->dd_kind != CTF_K_ENUM)
+			xyerror(D_DECL_USELESS, "useless declaration\n");
+
+		dt_dprintf("type %s added as id %ld\n", dt_type_name(
+		    ddp->dd_ctfp, ddp->dd_type, n1, sizeof (n1)), ddp->dd_type);
+
+		return (NULL);
+	}
+
+	if (strchr(dsp->ds_ident, '`') != NULL) {
+		xyerror(D_DECL_SCOPE, "D scoping operator may not be used in "
+		    "a declaration name (%s)\n", dsp->ds_ident);
+	}
+
+	/*
+	 * If we are nested inside of a C include file, add the declaration to
+	 * the C definition module; otherwise use the D definition module.
+	 */
+	if (yypcb->pcb_idepth != 0)
+		dmp = dtp->dt_cdefs;
+	else
+		dmp = dtp->dt_ddefs;
+
+	/*
+	 * If we see a global or static declaration of a function prototype,
+	 * treat this as equivalent to a D extern declaration.
+	 */
+	if (ctf_type_kind(dtt.dtt_ctfp, dtt.dtt_type) == CTF_K_FUNCTION &&
+	    (class == DT_DC_DEFAULT || class == DT_DC_STATIC))
+		class = DT_DC_EXTERN;
+
+	switch (class) {
+	case DT_DC_AUTO:
+	case DT_DC_REGISTER:
+	case DT_DC_STATIC:
+		xyerror(D_DECL_BADCLASS, "specified storage class not "
+		    "appropriate in D\n");
+		/*NOTREACHED*/
+
+	case DT_DC_EXTERN: {
+		dtrace_typeinfo_t ott;
+		dtrace_syminfo_t dts;
+		GElf_Sym sym;
+
+		int exists = dtrace_lookup_by_name(dtp,
+		    dmp->dm_name, dsp->ds_ident, &sym, &dts) == 0;
+
+		if (exists && (dtrace_symbol_type(dtp, &sym, &dts, &ott) != 0 ||
+		    ctf_type_cmp(dtt.dtt_ctfp, dtt.dtt_type,
+		    ott.dtt_ctfp, ott.dtt_type) != 0)) {
+			xyerror(D_DECL_IDRED, "identifier redeclared: %s`%s\n"
+			    "\t current: %s\n\tprevious: %s\n",
+			    dmp->dm_name, dsp->ds_ident,
+			    dt_type_name(dtt.dtt_ctfp, dtt.dtt_type,
+			    n1, sizeof (n1)),
+			    dt_type_name(ott.dtt_ctfp, ott.dtt_type,
+			    n2, sizeof (n2)));
+		} else if (!exists && dt_module_extern(dtp, dmp,
+		    dsp->ds_ident, &dtt) == NULL) {
+			xyerror(D_UNKNOWN,
+			    "failed to extern %s: %s\n", dsp->ds_ident,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		} else {
+			dt_dprintf("extern %s`%s type=<%s>\n",
+			    dmp->dm_name, dsp->ds_ident,
+			    dt_type_name(dtt.dtt_ctfp, dtt.dtt_type,
+			    n1, sizeof (n1)));
+		}
+		break;
+	}
+
+	case DT_DC_TYPEDEF:
+		if (dt_idstack_lookup(&yypcb->pcb_globals, dsp->ds_ident)) {
+			xyerror(D_DECL_IDRED, "global variable identifier "
+			    "redeclared: %s\n", dsp->ds_ident);
+		}
+
+		if (ctf_lookup_by_name(dmp->dm_ctfp,
+		    dsp->ds_ident) != CTF_ERR) {
+			xyerror(D_DECL_IDRED,
+			    "typedef redeclared: %s\n", dsp->ds_ident);
+		}
+
+		/*
+		 * If the source type for the typedef is not defined in the
+		 * target container or its parent, copy the type to the target
+		 * container and reset dtt_ctfp and dtt_type to the copy.
+		 */
+		if (dtt.dtt_ctfp != dmp->dm_ctfp &&
+		    dtt.dtt_ctfp != ctf_parent_file(dmp->dm_ctfp)) {
+
+			dtt.dtt_type = ctf_add_type(dmp->dm_ctfp,
+			    dtt.dtt_ctfp, dtt.dtt_type);
+			dtt.dtt_ctfp = dmp->dm_ctfp;
+
+			if (dtt.dtt_type == CTF_ERR ||
+			    ctf_update(dtt.dtt_ctfp) == CTF_ERR) {
+				xyerror(D_UNKNOWN, "failed to copy typedef %s "
+				    "source type: %s\n", dsp->ds_ident,
+				    ctf_errmsg(ctf_errno(dtt.dtt_ctfp)));
+			}
+		}
+
+		type = ctf_add_typedef(dmp->dm_ctfp,
+		    CTF_ADD_ROOT, dsp->ds_ident, dtt.dtt_type);
+
+		if (type == CTF_ERR || ctf_update(dmp->dm_ctfp) == CTF_ERR) {
+			xyerror(D_UNKNOWN, "failed to typedef %s: %s\n",
+			    dsp->ds_ident, ctf_errmsg(ctf_errno(dmp->dm_ctfp)));
+		}
+
+		dt_dprintf("typedef %s added as id %ld\n", dsp->ds_ident, type);
+		break;
+
+	default: {
+		ctf_encoding_t cte;
+		dt_idhash_t *dhp;
+		dt_ident_t *idp;
+		dt_node_t idn;
+		int assc, idkind;
+		uint_t id, kind;
+		ushort_t idflags;
+
+		switch (class) {
+		case DT_DC_THIS:
+			dhp = yypcb->pcb_locals;
+			idflags = DT_IDFLG_LOCAL;
+			idp = dt_idhash_lookup(dhp, dsp->ds_ident);
+			break;
+		case DT_DC_SELF:
+			dhp = dtp->dt_tls;
+			idflags = DT_IDFLG_TLS;
+			idp = dt_idhash_lookup(dhp, dsp->ds_ident);
+			break;
+		default:
+			dhp = dtp->dt_globals;
+			idflags = 0;
+			idp = dt_idstack_lookup(
+			    &yypcb->pcb_globals, dsp->ds_ident);
+			break;
+		}
+
+		if (ddp->dd_kind == CTF_K_ARRAY && ddp->dd_node == NULL) {
+			xyerror(D_DECL_ARRNULL,
+			    "array declaration requires array dimension or "
+			    "tuple signature: %s\n", dsp->ds_ident);
+		}
+
+		if (idp != NULL && idp->di_gen == 0) {
+			xyerror(D_DECL_IDRED, "built-in identifier "
+			    "redeclared: %s\n", idp->di_name);
+		}
+
+		if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_CDEFS,
+		    dsp->ds_ident, NULL) == 0 ||
+		    dtrace_lookup_by_type(dtp, DTRACE_OBJ_DDEFS,
+		    dsp->ds_ident, NULL) == 0) {
+			xyerror(D_DECL_IDRED, "typedef identifier "
+			    "redeclared: %s\n", dsp->ds_ident);
+		}
+
+		/*
+		 * Cache some attributes of the decl to make the rest of this
+		 * code simpler: if the decl is an array which is subscripted
+		 * by a type rather than an integer, then it's an associative
+		 * array (assc).  We then expect to match either DT_IDENT_ARRAY
+		 * for associative arrays or DT_IDENT_SCALAR for anything else.
+		 */
+		assc = ddp->dd_kind == CTF_K_ARRAY &&
+		    ddp->dd_node->dn_kind == DT_NODE_TYPE;
+
+		idkind = assc ? DT_IDENT_ARRAY : DT_IDENT_SCALAR;
+
+		/*
+		 * Create a fake dt_node_t on the stack so we can determine the
+		 * type of any matching identifier by assigning to this node.
+		 * If the pre-existing ident has its di_type set, propagate
+		 * the type by hand so as not to trigger a prototype check for
+		 * arrays (yet); otherwise we use dt_ident_cook() on the ident
+		 * to ensure it is fully initialized before looking at it.
+		 */
+		bzero(&idn, sizeof (dt_node_t));
+
+		if (idp != NULL && idp->di_type != CTF_ERR)
+			dt_node_type_assign(&idn, idp->di_ctfp, idp->di_type);
+		else if (idp != NULL)
+			(void) dt_ident_cook(&idn, idp, NULL);
+
+		if (assc) {
+			if (class == DT_DC_THIS) {
+				xyerror(D_DECL_LOCASSC, "associative arrays "
+				    "may not be declared as local variables:"
+				    " %s\n", dsp->ds_ident);
+			}
+
+			if (dt_decl_type(ddp->dd_next, &dtt) != 0)
+				longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+		}
+
+		if (idp != NULL && (idp->di_kind != idkind ||
+		    ctf_type_cmp(dtt.dtt_ctfp, dtt.dtt_type,
+		    idn.dn_ctfp, idn.dn_type) != 0)) {
+			xyerror(D_DECL_IDRED, "identifier redeclared: %s\n"
+			    "\t current: %s %s\n\tprevious: %s %s\n",
+			    dsp->ds_ident, dt_idkind_name(idkind),
+			    dt_type_name(dtt.dtt_ctfp,
+			    dtt.dtt_type, n1, sizeof (n1)),
+			    dt_idkind_name(idp->di_kind),
+			    dt_node_type_name(&idn, n2, sizeof (n2)));
+
+		} else if (idp != NULL && assc) {
+			const dt_idsig_t *isp = idp->di_data;
+			dt_node_t *dnp = ddp->dd_node;
+			int argc = 0;
+
+			for (; dnp != NULL; dnp = dnp->dn_list, argc++) {
+				const dt_node_t *pnp = &isp->dis_args[argc];
+
+				if (argc >= isp->dis_argc)
+					continue; /* tuple length mismatch */
+
+				if (ctf_type_cmp(dnp->dn_ctfp, dnp->dn_type,
+				    pnp->dn_ctfp, pnp->dn_type) == 0)
+					continue;
+
+				xyerror(D_DECL_IDRED,
+				    "identifier redeclared: %s\n"
+				    "\t current: %s, key #%d of type %s\n"
+				    "\tprevious: %s, key #%d of type %s\n",
+				    dsp->ds_ident,
+				    dt_idkind_name(idkind), argc + 1,
+				    dt_node_type_name(dnp, n1, sizeof (n1)),
+				    dt_idkind_name(idp->di_kind), argc + 1,
+				    dt_node_type_name(pnp, n2, sizeof (n2)));
+			}
+
+			if (isp->dis_argc != argc) {
+				xyerror(D_DECL_IDRED,
+				    "identifier redeclared: %s\n"
+				    "\t current: %s of %s, tuple length %d\n"
+				    "\tprevious: %s of %s, tuple length %d\n",
+				    dsp->ds_ident, dt_idkind_name(idkind),
+				    dt_type_name(dtt.dtt_ctfp, dtt.dtt_type,
+				    n1, sizeof (n1)), argc,
+				    dt_idkind_name(idp->di_kind),
+				    dt_node_type_name(&idn, n2, sizeof (n2)),
+				    isp->dis_argc);
+			}
+
+		} else if (idp == NULL) {
+			type = ctf_type_resolve(dtt.dtt_ctfp, dtt.dtt_type);
+			kind = ctf_type_kind(dtt.dtt_ctfp, type);
+
+			switch (kind) {
+			case CTF_K_INTEGER:
+				if (ctf_type_encoding(dtt.dtt_ctfp, type,
+				    &cte) == 0 && IS_VOID(cte)) {
+					xyerror(D_DECL_VOIDOBJ, "cannot have "
+					    "void object: %s\n", dsp->ds_ident);
+				}
+				break;
+			case CTF_K_STRUCT:
+			case CTF_K_UNION:
+				if (ctf_type_size(dtt.dtt_ctfp, type) != 0)
+					break; /* proceed to declaring */
+				/*FALLTHRU*/
+			case CTF_K_FORWARD:
+				xyerror(D_DECL_INCOMPLETE,
+				    "incomplete struct/union/enum %s: %s\n",
+				    dt_type_name(dtt.dtt_ctfp, dtt.dtt_type,
+				    n1, sizeof (n1)), dsp->ds_ident);
+				/*NOTREACHED*/
+			}
+
+			if (dt_idhash_nextid(dhp, &id) == -1) {
+				xyerror(D_ID_OFLOW, "cannot create %s: limit "
+				    "on number of %s variables exceeded\n",
+				    dsp->ds_ident, dt_idhash_name(dhp));
+			}
+
+			dt_dprintf("declare %s %s variable %s, id=%u\n",
+			    dt_idhash_name(dhp), dt_idkind_name(idkind),
+			    dsp->ds_ident, id);
+
+			idp = dt_idhash_insert(dhp, dsp->ds_ident, idkind,
+			    idflags | DT_IDFLG_WRITE | DT_IDFLG_DECL, id,
+			    _dtrace_defattr, 0, assc ? &dt_idops_assc :
+			    &dt_idops_thaw, NULL, dtp->dt_gen);
+
+			if (idp == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			dt_ident_type_assign(idp, dtt.dtt_ctfp, dtt.dtt_type);
+
+			/*
+			 * If we are declaring an associative array, use our
+			 * fake parse node to cook the new assoc identifier.
+			 * This will force the ident code to instantiate the
+			 * array type signature corresponding to the list of
+			 * types pointed to by ddp->dd_node.  We also reset
+			 * the identifier's attributes based upon the result.
+			 */
+			if (assc) {
+				idp->di_attr =
+				    dt_ident_cook(&idn, idp, &ddp->dd_node);
+			}
+		}
+	}
+
+	} /* end of switch */
+
+	free(dsp->ds_ident);
+	dsp->ds_ident = NULL;
+
+	return (NULL);
+}
+
+dt_node_t *
+dt_node_func(dt_node_t *dnp, dt_node_t *args)
+{
+	dt_ident_t *idp;
+
+	if (dnp->dn_kind != DT_NODE_IDENT) {
+		xyerror(D_FUNC_IDENT,
+		    "function designator is not of function type\n");
+	}
+
+	idp = dt_idstack_lookup(&yypcb->pcb_globals, dnp->dn_string);
+
+	if (idp == NULL) {
+		xyerror(D_FUNC_UNDEF,
+		    "undefined function name: %s\n", dnp->dn_string);
+	}
+
+	if (idp->di_kind != DT_IDENT_FUNC &&
+	    idp->di_kind != DT_IDENT_AGGFUNC &&
+	    idp->di_kind != DT_IDENT_ACTFUNC) {
+		xyerror(D_FUNC_IDKIND, "%s '%s' may not be referenced as a "
+		    "function\n", dt_idkind_name(idp->di_kind), idp->di_name);
+	}
+
+	free(dnp->dn_string);
+	dnp->dn_string = NULL;
+
+	dnp->dn_kind = DT_NODE_FUNC;
+	dnp->dn_flags &= ~DT_NF_COOKED;
+	dnp->dn_ident = idp;
+	dnp->dn_args = args;
+	dnp->dn_list = NULL;
+
+	return (dnp);
+}
+
+/*
+ * The offsetof() function is special because it takes a type name as an
+ * argument.  It does not actually construct its own node; after looking up the
+ * structure or union offset, we just return an integer node with the offset.
+ */
+dt_node_t *
+dt_node_offsetof(dt_decl_t *ddp, char *s)
+{
+	dtrace_typeinfo_t dtt;
+	dt_node_t dn;
+	char *name;
+	int err;
+
+	ctf_membinfo_t ctm;
+	ctf_id_t type;
+	uint_t kind;
+
+#ifndef VBOX
+	name = strdupa(s);
+#else
+	MY_STRDUPA(name, s);
+#endif
+	free(s);
+
+	err = dt_decl_type(ddp, &dtt);
+	dt_decl_free(ddp);
+
+	if (err != 0)
+		longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+
+	type = ctf_type_resolve(dtt.dtt_ctfp, dtt.dtt_type);
+	kind = ctf_type_kind(dtt.dtt_ctfp, type);
+
+	if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) {
+		xyerror(D_OFFSETOF_TYPE,
+		    "offsetof operand must be a struct or union type\n");
+	}
+
+	if (ctf_member_info(dtt.dtt_ctfp, type, name, &ctm) == CTF_ERR) {
+		xyerror(D_UNKNOWN, "failed to determine offset of %s: %s\n",
+		    name, ctf_errmsg(ctf_errno(dtt.dtt_ctfp)));
+	}
+
+	bzero(&dn, sizeof (dn));
+	dt_node_type_assign(&dn, dtt.dtt_ctfp, ctm.ctm_type);
+
+	if (dn.dn_flags & DT_NF_BITFIELD) {
+		xyerror(D_OFFSETOF_BITFIELD,
+		    "cannot take offset of a bit-field: %s\n", name);
+	}
+
+	return (dt_node_int(ctm.ctm_offset / NBBY));
+}
+
+dt_node_t *
+dt_node_op1(int op, dt_node_t *cp)
+{
+	dt_node_t *dnp;
+
+	if (cp->dn_kind == DT_NODE_INT) {
+		switch (op) {
+		case DT_TOK_INEG:
+			/*
+			 * If we're negating an unsigned integer, zero out any
+			 * extra top bits to truncate the value to the size of
+			 * the effective type determined by dt_node_int().
+			 */
+			cp->dn_value = -cp->dn_value;
+			if (!(cp->dn_flags & DT_NF_SIGNED)) {
+				cp->dn_value &= ~0ULL >>
+				    (64 - dt_node_type_size(cp) * NBBY);
+			}
+			/*FALLTHRU*/
+		case DT_TOK_IPOS:
+			return (cp);
+		case DT_TOK_BNEG:
+			cp->dn_value = ~cp->dn_value;
+			return (cp);
+		case DT_TOK_LNEG:
+			cp->dn_value = !cp->dn_value;
+			return (cp);
+		}
+	}
+
+	/*
+	 * If sizeof is applied to a type_name or string constant, we can
+	 * transform 'cp' into an integer constant in the node construction
+	 * pass so that it can then be used for arithmetic in this pass.
+	 */
+	if (op == DT_TOK_SIZEOF &&
+	    (cp->dn_kind == DT_NODE_STRING || cp->dn_kind == DT_NODE_TYPE)) {
+		dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+		size_t size = dt_node_type_size(cp);
+
+		if (size == 0) {
+			xyerror(D_SIZEOF_TYPE, "cannot apply sizeof to an "
+			    "operand of unknown size\n");
+		}
+
+		dt_node_type_assign(cp, dtp->dt_ddefs->dm_ctfp,
+		    ctf_lookup_by_name(dtp->dt_ddefs->dm_ctfp, "size_t"));
+
+		cp->dn_kind = DT_NODE_INT;
+		cp->dn_op = DT_TOK_INT;
+		cp->dn_value = size;
+
+		return (cp);
+	}
+
+	dnp = dt_node_alloc(DT_NODE_OP1);
+	assert(op <= USHRT_MAX);
+	dnp->dn_op = (ushort_t)op;
+	dnp->dn_child = cp;
+
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_op2(int op, dt_node_t *lp, dt_node_t *rp)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_node_t *dnp;
+
+	/*
+	 * First we check for operations that are illegal -- namely those that
+	 * might result in integer division by zero, and abort if one is found.
+	 */
+	if (rp->dn_kind == DT_NODE_INT && rp->dn_value == 0 &&
+	    (op == DT_TOK_MOD || op == DT_TOK_DIV ||
+	    op == DT_TOK_MOD_EQ || op == DT_TOK_DIV_EQ))
+		xyerror(D_DIV_ZERO, "expression contains division by zero\n");
+
+	/*
+	 * If both children are immediate values, we can just perform inline
+	 * calculation and return a new immediate node with the result.
+	 */
+	if (lp->dn_kind == DT_NODE_INT && rp->dn_kind == DT_NODE_INT) {
+		uintmax_t l = lp->dn_value;
+		uintmax_t r = rp->dn_value;
+
+		dnp = dt_node_int(0); /* allocate new integer node for result */
+
+		switch (op) {
+		case DT_TOK_LOR:
+			dnp->dn_value = l || r;
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_LXOR:
+			dnp->dn_value = (l != 0) ^ (r != 0);
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_LAND:
+			dnp->dn_value = l && r;
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_BOR:
+			dnp->dn_value = l | r;
+			dt_node_promote(lp, rp, dnp);
+			break;
+		case DT_TOK_XOR:
+			dnp->dn_value = l ^ r;
+			dt_node_promote(lp, rp, dnp);
+			break;
+		case DT_TOK_BAND:
+			dnp->dn_value = l & r;
+			dt_node_promote(lp, rp, dnp);
+			break;
+		case DT_TOK_EQU:
+			dnp->dn_value = l == r;
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_NEQ:
+			dnp->dn_value = l != r;
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_LT:
+			dt_node_promote(lp, rp, dnp);
+			if (dnp->dn_flags & DT_NF_SIGNED)
+				dnp->dn_value = (intmax_t)l < (intmax_t)r;
+			else
+				dnp->dn_value = l < r;
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_LE:
+			dt_node_promote(lp, rp, dnp);
+			if (dnp->dn_flags & DT_NF_SIGNED)
+				dnp->dn_value = (intmax_t)l <= (intmax_t)r;
+			else
+				dnp->dn_value = l <= r;
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_GT:
+			dt_node_promote(lp, rp, dnp);
+			if (dnp->dn_flags & DT_NF_SIGNED)
+				dnp->dn_value = (intmax_t)l > (intmax_t)r;
+			else
+				dnp->dn_value = l > r;
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_GE:
+			dt_node_promote(lp, rp, dnp);
+			if (dnp->dn_flags & DT_NF_SIGNED)
+				dnp->dn_value = (intmax_t)l >= (intmax_t)r;
+			else
+				dnp->dn_value = l >= r;
+			dt_node_type_assign(dnp,
+			    DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+			break;
+		case DT_TOK_LSH:
+			dnp->dn_value = l << r;
+			dt_node_type_propagate(lp, dnp);
+			dt_node_attr_assign(rp,
+			    dt_attr_min(lp->dn_attr, rp->dn_attr));
+			break;
+		case DT_TOK_RSH:
+			dnp->dn_value = l >> r;
+			dt_node_type_propagate(lp, dnp);
+			dt_node_attr_assign(rp,
+			    dt_attr_min(lp->dn_attr, rp->dn_attr));
+			break;
+		case DT_TOK_ADD:
+			dnp->dn_value = l + r;
+			dt_node_promote(lp, rp, dnp);
+			break;
+		case DT_TOK_SUB:
+			dnp->dn_value = l - r;
+			dt_node_promote(lp, rp, dnp);
+			break;
+		case DT_TOK_MUL:
+			dnp->dn_value = l * r;
+			dt_node_promote(lp, rp, dnp);
+			break;
+		case DT_TOK_DIV:
+			dt_node_promote(lp, rp, dnp);
+			if (dnp->dn_flags & DT_NF_SIGNED)
+				dnp->dn_value = (intmax_t)l / (intmax_t)r;
+			else
+				dnp->dn_value = l / r;
+			break;
+		case DT_TOK_MOD:
+			dt_node_promote(lp, rp, dnp);
+			if (dnp->dn_flags & DT_NF_SIGNED)
+				dnp->dn_value = (intmax_t)l % (intmax_t)r;
+			else
+				dnp->dn_value = l % r;
+			break;
+		default:
+			dt_node_free(dnp);
+			dnp = NULL;
+		}
+
+		if (dnp != NULL) {
+			dt_node_free(lp);
+			dt_node_free(rp);
+			return (dnp);
+		}
+	}
+
+	/*
+	 * If an integer constant is being cast to another integer type, we can
+	 * perform the cast as part of integer constant folding in this pass.
+	 * We must take action when the integer is being cast to a smaller type
+	 * or if it is changing signed-ness.  If so, we first shift rp's bits
+	 * bits high (losing excess bits if narrowing) and then shift them down
+	 * with either a logical shift (unsigned) or arithmetic shift (signed).
+	 */
+	if (op == DT_TOK_LPAR && rp->dn_kind == DT_NODE_INT &&
+	    dt_node_is_integer(lp)) {
+		size_t srcsize = dt_node_type_size(rp);
+		size_t dstsize = dt_node_type_size(lp);
+
+		if ((dstsize < srcsize) || ((lp->dn_flags & DT_NF_SIGNED) ^
+		    (rp->dn_flags & DT_NF_SIGNED))) {
+			int n = dstsize < srcsize ?
+			    (sizeof (uint64_t) * NBBY - dstsize * NBBY) :
+			    (sizeof (uint64_t) * NBBY - srcsize * NBBY);
+
+			rp->dn_value <<= n;
+			if (lp->dn_flags & DT_NF_SIGNED)
+				rp->dn_value = (intmax_t)rp->dn_value >> n;
+			else
+				rp->dn_value = rp->dn_value >> n;
+		}
+
+		dt_node_type_propagate(lp, rp);
+		dt_node_attr_assign(rp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+		dt_node_free(lp);
+
+		return (rp);
+	}
+
+	/*
+	 * If no immediate optimizations are available, create an new OP2 node
+	 * and glue the left and right children into place and return.
+	 */
+	dnp = dt_node_alloc(DT_NODE_OP2);
+	assert(op <= USHRT_MAX);
+	dnp->dn_op = (ushort_t)op;
+	dnp->dn_left = lp;
+	dnp->dn_right = rp;
+
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_op3(dt_node_t *expr, dt_node_t *lp, dt_node_t *rp)
+{
+	dt_node_t *dnp;
+
+	if (expr->dn_kind == DT_NODE_INT)
+		return (expr->dn_value != 0 ? lp : rp);
+
+	dnp = dt_node_alloc(DT_NODE_OP3);
+	dnp->dn_op = DT_TOK_QUESTION;
+	dnp->dn_expr = expr;
+	dnp->dn_left = lp;
+	dnp->dn_right = rp;
+
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_statement(dt_node_t *expr)
+{
+	dt_node_t *dnp;
+
+	if (expr->dn_kind == DT_NODE_AGG)
+		return (expr);
+
+	if (expr->dn_kind == DT_NODE_FUNC &&
+	    expr->dn_ident->di_kind == DT_IDENT_ACTFUNC)
+		dnp = dt_node_alloc(DT_NODE_DFUNC);
+	else
+		dnp = dt_node_alloc(DT_NODE_DEXPR);
+
+	dnp->dn_expr = expr;
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_pdesc_by_name(char *spec)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_node_t *dnp;
+
+	if (spec == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dnp = dt_node_alloc(DT_NODE_PDESC);
+	dnp->dn_spec = spec;
+	dnp->dn_desc = malloc(sizeof (dtrace_probedesc_t));
+
+	if (dnp->dn_desc == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	if (dtrace_xstr2desc(dtp, yypcb->pcb_pspec, dnp->dn_spec,
+	    yypcb->pcb_sargc, yypcb->pcb_sargv, dnp->dn_desc) != 0) {
+		xyerror(D_PDESC_INVAL, "invalid probe description \"%s\": %s\n",
+		    dnp->dn_spec, dtrace_errmsg(dtp, dtrace_errno(dtp)));
+	}
+
+	free(dnp->dn_spec);
+	dnp->dn_spec = NULL;
+
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_pdesc_by_id(uintmax_t id)
+{
+	static const char *const names[] = {
+		"providers", "modules", "functions"
+	};
+
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_node_t *dnp = dt_node_alloc(DT_NODE_PDESC);
+
+	if ((dnp->dn_desc = malloc(sizeof (dtrace_probedesc_t))) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	if (id > UINT_MAX) {
+		xyerror(D_PDESC_INVAL, "identifier %llu exceeds maximum "
+		    "probe id\n", (u_longlong_t)id);
+	}
+
+	if (yypcb->pcb_pspec != DTRACE_PROBESPEC_NAME) {
+		xyerror(D_PDESC_INVAL, "probe identifier %llu not permitted "
+		    "when specifying %s\n", (u_longlong_t)id,
+		    names[yypcb->pcb_pspec]);
+	}
+
+	if (dtrace_id2desc(dtp, (dtrace_id_t)id, dnp->dn_desc) != 0) {
+		xyerror(D_PDESC_INVAL, "invalid probe identifier %llu: %s\n",
+		    (u_longlong_t)id, dtrace_errmsg(dtp, dtrace_errno(dtp)));
+	}
+
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_clause(dt_node_t *pdescs, dt_node_t *pred, dt_node_t *acts)
+{
+	dt_node_t *dnp = dt_node_alloc(DT_NODE_CLAUSE);
+
+	dnp->dn_pdescs = pdescs;
+	dnp->dn_pred = pred;
+	dnp->dn_acts = acts;
+
+	yybegin(YYS_CLAUSE);
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_inline(dt_node_t *expr)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_scope_t *dsp = &yypcb->pcb_dstack;
+	dt_decl_t *ddp = dt_decl_top();
+
+	char n[DT_TYPE_NAMELEN];
+	dtrace_typeinfo_t dtt;
+
+	dt_ident_t *idp, *rdp;
+	dt_idnode_t *inp;
+	dt_node_t *dnp;
+
+	if (dt_decl_type(ddp, &dtt) != 0)
+		longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+
+	if (dsp->ds_class != DT_DC_DEFAULT) {
+		xyerror(D_DECL_BADCLASS, "specified storage class not "
+		    "appropriate for inline declaration\n");
+	}
+
+	if (dsp->ds_ident == NULL)
+		xyerror(D_DECL_USELESS, "inline declaration requires a name\n");
+
+	if ((idp = dt_idstack_lookup(
+	    &yypcb->pcb_globals, dsp->ds_ident)) != NULL) {
+		xyerror(D_DECL_IDRED, "identifier redefined: %s\n\t current: "
+		    "inline definition\n\tprevious: %s %s\n",
+		    idp->di_name, dt_idkind_name(idp->di_kind),
+		    (idp->di_flags & DT_IDFLG_INLINE) ? "inline" : "");
+	}
+
+	/*
+	 * If we are declaring an inlined array, verify that we have a tuple
+	 * signature, and then recompute 'dtt' as the array's value type.
+	 */
+	if (ddp->dd_kind == CTF_K_ARRAY) {
+		if (ddp->dd_node == NULL) {
+			xyerror(D_DECL_ARRNULL, "inline declaration requires "
+			    "array tuple signature: %s\n", dsp->ds_ident);
+		}
+
+		if (ddp->dd_node->dn_kind != DT_NODE_TYPE) {
+			xyerror(D_DECL_ARRNULL, "inline declaration cannot be "
+			    "of scalar array type: %s\n", dsp->ds_ident);
+		}
+
+		if (dt_decl_type(ddp->dd_next, &dtt) != 0)
+			longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+	}
+
+	/*
+	 * If the inline identifier is not defined, then create it with the
+	 * orphan flag set.  We do not insert the identifier into dt_globals
+	 * until we have successfully cooked the right-hand expression, below.
+	 */
+	dnp = dt_node_alloc(DT_NODE_INLINE);
+	dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type);
+	dt_node_attr_assign(dnp, _dtrace_defattr);
+
+	if (dt_node_is_void(dnp)) {
+		xyerror(D_DECL_VOIDOBJ,
+		    "cannot declare void inline: %s\n", dsp->ds_ident);
+	}
+
+	if (ctf_type_kind(dnp->dn_ctfp, ctf_type_resolve(
+	    dnp->dn_ctfp, dnp->dn_type)) == CTF_K_FORWARD) {
+		xyerror(D_DECL_INCOMPLETE,
+		    "incomplete struct/union/enum %s: %s\n",
+		    dt_node_type_name(dnp, n, sizeof (n)), dsp->ds_ident);
+	}
+
+	if ((inp = malloc(sizeof (dt_idnode_t))) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	bzero(inp, sizeof (dt_idnode_t));
+
+	idp = dnp->dn_ident = dt_ident_create(dsp->ds_ident,
+	    ddp->dd_kind == CTF_K_ARRAY ? DT_IDENT_ARRAY : DT_IDENT_SCALAR,
+	    DT_IDFLG_INLINE | DT_IDFLG_REF | DT_IDFLG_DECL | DT_IDFLG_ORPHAN, 0,
+	    _dtrace_defattr, 0, &dt_idops_inline, inp, dtp->dt_gen);
+
+	if (idp == NULL) {
+		free(inp);
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+	}
+
+	/*
+	 * If we're inlining an associative array, create a private identifier
+	 * hash containing the named parameters and store it in inp->din_hash.
+	 * We then push this hash on to the top of the pcb_globals stack.
+	 */
+	if (ddp->dd_kind == CTF_K_ARRAY) {
+		dt_idnode_t *pinp;
+		dt_ident_t *pidp;
+		dt_node_t *pnp;
+		uint_t i = 0;
+
+		for (pnp = ddp->dd_node; pnp != NULL; pnp = pnp->dn_list)
+			i++; /* count up parameters for din_argv[] */
+
+		inp->din_hash = dt_idhash_create("inline args", NULL, 0, 0);
+		inp->din_argv = calloc(i, sizeof (dt_ident_t *));
+
+		if (inp->din_hash == NULL || inp->din_argv == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+		/*
+		 * Create an identifier for each parameter as a scalar inline,
+		 * and store it in din_hash and in position in din_argv[].  The
+		 * parameter identifiers also use dt_idops_inline, but we leave
+		 * the dt_idnode_t argument 'pinp' zeroed.  This will be filled
+		 * in by the code generation pass with references to the args.
+		 */
+		for (i = 0, pnp = ddp->dd_node;
+		    pnp != NULL; pnp = pnp->dn_list, i++) {
+
+			if (pnp->dn_string == NULL)
+				continue; /* ignore anonymous parameters */
+
+			if ((pinp = malloc(sizeof (dt_idnode_t))) == NULL)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+			pidp = dt_idhash_insert(inp->din_hash, pnp->dn_string,
+			    DT_IDENT_SCALAR, DT_IDFLG_DECL | DT_IDFLG_INLINE, 0,
+			    _dtrace_defattr, 0, &dt_idops_inline,
+			    pinp, dtp->dt_gen);
+
+			if (pidp == NULL) {
+				free(pinp);
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+			}
+
+			inp->din_argv[i] = pidp;
+			bzero(pinp, sizeof (dt_idnode_t));
+			dt_ident_type_assign(pidp, pnp->dn_ctfp, pnp->dn_type);
+		}
+
+		dt_idstack_push(&yypcb->pcb_globals, inp->din_hash);
+	}
+
+	/*
+	 * Unlike most constructors, we need to explicitly cook the right-hand
+	 * side of the inline definition immediately to prevent recursion.  If
+	 * the right-hand side uses the inline itself, the cook will fail.
+	 */
+	expr = dt_node_cook(expr, DT_IDFLG_REF);
+
+	if (ddp->dd_kind == CTF_K_ARRAY)
+		dt_idstack_pop(&yypcb->pcb_globals, inp->din_hash);
+
+	/*
+	 * Set the type, attributes, and flags for the inline.  If the right-
+	 * hand expression has an identifier, propagate its flags.  Then cook
+	 * the identifier to fully initialize it: if we're declaring an inline
+	 * associative array this will construct a type signature from 'ddp'.
+	 */
+	if (dt_node_is_dynamic(expr))
+		rdp = dt_ident_resolve(expr->dn_ident);
+	else if (expr->dn_kind == DT_NODE_VAR || expr->dn_kind == DT_NODE_SYM)
+		rdp = expr->dn_ident;
+	else
+		rdp = NULL;
+
+	if (rdp != NULL) {
+		idp->di_flags |= (rdp->di_flags &
+		    (DT_IDFLG_WRITE | DT_IDFLG_USER | DT_IDFLG_PRIM));
+	}
+
+	idp->di_attr = dt_attr_min(_dtrace_defattr, expr->dn_attr);
+	dt_ident_type_assign(idp, dtt.dtt_ctfp, dtt.dtt_type);
+	(void) dt_ident_cook(dnp, idp, &ddp->dd_node);
+
+	/*
+	 * Store the parse tree nodes for 'expr' inside of idp->di_data ('inp')
+	 * so that they will be preserved with this identifier.  Then pop the
+	 * inline declaration from the declaration stack and restore the lexer.
+	 */
+	inp->din_list = yypcb->pcb_list;
+	inp->din_root = expr;
+
+	dt_decl_free(dt_decl_pop());
+	yybegin(YYS_CLAUSE);
+
+	/*
+	 * Finally, insert the inline identifier into dt_globals to make it
+	 * visible, and then cook 'dnp' to check its type against 'expr'.
+	 */
+	dt_idhash_xinsert(dtp->dt_globals, idp);
+	return (dt_node_cook(dnp, DT_IDFLG_REF));
+}
+
+dt_node_t *
+dt_node_member(dt_decl_t *ddp, char *name, dt_node_t *expr)
+{
+	dtrace_typeinfo_t dtt;
+	dt_node_t *dnp;
+	int err;
+
+	if (ddp != NULL) {
+		err = dt_decl_type(ddp, &dtt);
+		dt_decl_free(ddp);
+
+		if (err != 0)
+			longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+	}
+
+	dnp = dt_node_alloc(DT_NODE_MEMBER);
+	dnp->dn_membname = name;
+	dnp->dn_membexpr = expr;
+
+	if (ddp != NULL)
+		dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type);
+
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_xlator(dt_decl_t *ddp, dt_decl_t *sdp, char *name, dt_node_t *members)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dtrace_typeinfo_t src, dst;
+	dt_node_t sn, dn;
+	dt_xlator_t *dxp;
+	dt_node_t *dnp;
+	int edst, esrc;
+	uint_t kind;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	edst = dt_decl_type(ddp, &dst);
+	dt_decl_free(ddp);
+
+	esrc = dt_decl_type(sdp, &src);
+	dt_decl_free(sdp);
+
+	if (edst != 0 || esrc != 0) {
+		free(name);
+		longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+	}
+
+	bzero(&sn, sizeof (sn));
+	dt_node_type_assign(&sn, src.dtt_ctfp, src.dtt_type);
+
+	bzero(&dn, sizeof (dn));
+	dt_node_type_assign(&dn, dst.dtt_ctfp, dst.dtt_type);
+
+	if (dt_xlator_lookup(dtp, &sn, &dn, DT_XLATE_EXACT) != NULL) {
+		xyerror(D_XLATE_REDECL,
+		    "translator from %s to %s has already been declared\n",
+		    dt_node_type_name(&sn, n1, sizeof (n1)),
+		    dt_node_type_name(&dn, n2, sizeof (n2)));
+	}
+
+	kind = ctf_type_kind(dst.dtt_ctfp,
+	    ctf_type_resolve(dst.dtt_ctfp, dst.dtt_type));
+
+	if (kind == CTF_K_FORWARD) {
+		xyerror(D_XLATE_SOU, "incomplete struct/union/enum %s\n",
+		    dt_type_name(dst.dtt_ctfp, dst.dtt_type, n1, sizeof (n1)));
+	}
+
+	if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) {
+		xyerror(D_XLATE_SOU,
+		    "translator output type must be a struct or union\n");
+	}
+
+	dxp = dt_xlator_create(dtp, &src, &dst, name, members, yypcb->pcb_list);
+	yybegin(YYS_CLAUSE);
+	free(name);
+
+	if (dxp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	dnp = dt_node_alloc(DT_NODE_XLATOR);
+	dnp->dn_xlator = dxp;
+	dnp->dn_members = members;
+
+	return (dt_node_cook(dnp, DT_IDFLG_REF));
+}
+
+dt_node_t *
+dt_node_probe(char *s, int protoc, dt_node_t *nargs, dt_node_t *xargs)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	int nargc, xargc;
+	dt_node_t *dnp;
+
+	size_t len = strlen(s) + 3; /* +3 for :: and \0 */
+	char *name = alloca(len);
+
+	(void) snprintf(name, len, "::%s", s);
+	(void) strhyphenate(name);
+	free(s);
+
+	if (strchr(name, '`') != NULL) {
+		xyerror(D_PROV_BADNAME, "probe name may not "
+		    "contain scoping operator: %s\n", name);
+	}
+
+	if (strlen(name) - 2 >= DTRACE_NAMELEN) {
+		xyerror(D_PROV_BADNAME, "probe name may not exceed %d "
+		    "characters: %s\n", DTRACE_NAMELEN - 1, name);
+	}
+
+	dnp = dt_node_alloc(DT_NODE_PROBE);
+
+	dnp->dn_ident = dt_ident_create(name, DT_IDENT_PROBE,
+	    DT_IDFLG_ORPHAN, DTRACE_IDNONE, _dtrace_defattr, 0,
+	    &dt_idops_probe, NULL, dtp->dt_gen);
+
+	nargc = dt_decl_prototype(nargs, nargs,
+	    "probe input", DT_DP_VOID | DT_DP_ANON);
+
+	xargc = dt_decl_prototype(xargs, nargs,
+	    "probe output", DT_DP_VOID);
+
+	if (nargc > UINT8_MAX) {
+		xyerror(D_PROV_PRARGLEN, "probe %s input prototype exceeds %u "
+		    "parameters: %d params used\n", name, UINT8_MAX, nargc);
+	}
+
+	if (xargc > UINT8_MAX) {
+		xyerror(D_PROV_PRARGLEN, "probe %s output prototype exceeds %u "
+		    "parameters: %d params used\n", name, UINT8_MAX, xargc);
+	}
+
+	if (dnp->dn_ident == NULL || dt_probe_create(dtp,
+	    dnp->dn_ident, protoc, nargs, nargc, xargs, xargc) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_provider(char *name, dt_node_t *probes)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_node_t *dnp = dt_node_alloc(DT_NODE_PROVIDER);
+	dt_node_t *lnp;
+	size_t len;
+
+	dnp->dn_provname = name;
+	dnp->dn_probes = probes;
+
+	if (strchr(name, '`') != NULL) {
+		dnerror(dnp, D_PROV_BADNAME, "provider name may not "
+		    "contain scoping operator: %s\n", name);
+	}
+
+	if ((len = strlen(name)) >= DTRACE_PROVNAMELEN) {
+		dnerror(dnp, D_PROV_BADNAME, "provider name may not exceed %d "
+		    "characters: %s\n", DTRACE_PROVNAMELEN - 1, name);
+	}
+
+	if (isdigit(name[len - 1])) {
+		dnerror(dnp, D_PROV_BADNAME, "provider name may not "
+		    "end with a digit: %s\n", name);
+	}
+
+	/*
+	 * Check to see if the provider is already defined or visible through
+	 * dtrace(7D).  If so, set dn_provred to treat it as a re-declaration.
+	 * If not, create a new provider and set its interface-only flag.  This
+	 * flag may be cleared later by calls made to dt_probe_declare().
+	 */
+	if ((dnp->dn_provider = dt_provider_lookup(dtp, name)) != NULL)
+		dnp->dn_provred = B_TRUE;
+	else if ((dnp->dn_provider = dt_provider_create(dtp, name)) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+	else
+		dnp->dn_provider->pv_flags |= DT_PROVIDER_INTF;
+
+	/*
+	 * Store all parse nodes created since we consumed the DT_KEY_PROVIDER
+	 * token with the provider and then restore our lexing state to CLAUSE.
+	 * Note that if dnp->dn_provred is true, we may end up storing dups of
+	 * a provider's interface and implementation: we eat this space because
+	 * the implementation will likely need to redeclare probe members, and
+	 * therefore may result in those member nodes becoming persistent.
+	 */
+	for (lnp = yypcb->pcb_list; lnp->dn_link != NULL; lnp = lnp->dn_link)
+		continue; /* skip to end of allocation list */
+
+	lnp->dn_link = dnp->dn_provider->pv_nodes;
+	dnp->dn_provider->pv_nodes = yypcb->pcb_list;
+
+	yybegin(YYS_CLAUSE);
+	return (dnp);
+}
+
+dt_node_t *
+dt_node_program(dt_node_t *lnp)
+{
+	dt_node_t *dnp = dt_node_alloc(DT_NODE_PROG);
+	dnp->dn_list = lnp;
+	return (dnp);
+}
+
+/*
+ * This function provides the underlying implementation of cooking an
+ * identifier given its node, a hash of dynamic identifiers, an identifier
+ * kind, and a boolean flag indicating whether we are allowed to instantiate
+ * a new identifier if the string is not found.  This function is either
+ * called from dt_cook_ident(), below, or directly by the various cooking
+ * routines that are allowed to instantiate identifiers (e.g. op2 TOK_ASGN).
+ */
+static void
+dt_xcook_ident(dt_node_t *dnp, dt_idhash_t *dhp, uint_t idkind, int create)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	const char *sname = dt_idhash_name(dhp);
+	int uref = 0;
+
+	dtrace_attribute_t attr = _dtrace_defattr;
+	dt_ident_t *idp;
+	dtrace_syminfo_t dts;
+	GElf_Sym sym;
+
+	const char *scope, *mark;
+	uchar_t dnkind;
+	char *name;
+
+	/*
+	 * Look for scoping marks in the identifier.  If one is found, set our
+	 * scope to either DTRACE_OBJ_KMODS or UMODS or to the first part of
+	 * the string that specifies the scope using an explicit module name.
+	 * If two marks in a row are found, set 'uref' (user symbol reference).
+	 * Otherwise we set scope to DTRACE_OBJ_EXEC, indicating that normal
+	 * scope is desired and we should search the specified idhash.
+	 */
+	if ((name = strrchr(dnp->dn_string, '`')) != NULL) {
+		if (name > dnp->dn_string && name[-1] == '`') {
+			uref++;
+			name[-1] = '\0';
+		}
+
+		if (name == dnp->dn_string + uref)
+			scope = uref ? DTRACE_OBJ_UMODS : DTRACE_OBJ_KMODS;
+		else
+			scope = dnp->dn_string;
+
+		*name++ = '\0'; /* leave name pointing after scoping mark */
+		dnkind = DT_NODE_VAR;
+
+	} else if (idkind == DT_IDENT_AGG) {
+		scope = DTRACE_OBJ_EXEC;
+		name = dnp->dn_string + 1;
+		dnkind = DT_NODE_AGG;
+	} else {
+		scope = DTRACE_OBJ_EXEC;
+		name = dnp->dn_string;
+		dnkind = DT_NODE_VAR;
+	}
+
+	/*
+	 * If create is set to false, and we fail our idhash lookup, preset
+	 * the errno code to EDT_NOVAR for our final error message below.
+	 * If we end up calling dtrace_lookup_by_name(), it will reset the
+	 * errno appropriately and that error will be reported instead.
+	 */
+	(void) dt_set_errno(dtp, EDT_NOVAR);
+	mark = uref ? "``" : "`";
+
+	if (scope == DTRACE_OBJ_EXEC && (
+	    (dhp != dtp->dt_globals &&
+	    (idp = dt_idhash_lookup(dhp, name)) != NULL) ||
+	    (dhp == dtp->dt_globals &&
+	    (idp = dt_idstack_lookup(&yypcb->pcb_globals, name)) != NULL))) {
+		/*
+		 * Check that we are referencing the ident in the manner that
+		 * matches its type if this is a global lookup.  In the TLS or
+		 * local case, we don't know how the ident will be used until
+		 * the time operator -> is seen; more parsing is needed.
+		 */
+		if (idp->di_kind != idkind && dhp == dtp->dt_globals) {
+			xyerror(D_IDENT_BADREF, "%s '%s' may not be referenced "
+			    "as %s\n", dt_idkind_name(idp->di_kind),
+			    idp->di_name, dt_idkind_name(idkind));
+		}
+
+		/*
+		 * Arrays and aggregations are not cooked individually. They
+		 * have dynamic types and must be referenced using operator [].
+		 * This is handled explicitly by the code for DT_TOK_LBRAC.
+		 */
+		if (idp->di_kind != DT_IDENT_ARRAY &&
+		    idp->di_kind != DT_IDENT_AGG)
+			attr = dt_ident_cook(dnp, idp, NULL);
+		else {
+			dt_node_type_assign(dnp,
+			    DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
+			attr = idp->di_attr;
+		}
+
+		free(dnp->dn_string);
+		dnp->dn_string = NULL;
+		dnp->dn_kind = dnkind;
+		dnp->dn_ident = idp;
+		dnp->dn_flags |= DT_NF_LVALUE;
+
+		if (idp->di_flags & DT_IDFLG_WRITE)
+			dnp->dn_flags |= DT_NF_WRITABLE;
+
+		dt_node_attr_assign(dnp, attr);
+
+	} else if (dhp == dtp->dt_globals && scope != DTRACE_OBJ_EXEC &&
+	    dtrace_lookup_by_name(dtp, scope, name, &sym, &dts) == 0) {
+
+		dt_module_t *mp = dt_module_lookup_by_name(dtp, dts.dts_object);
+		int umod = (mp->dm_flags & DT_DM_KERNEL) == 0;
+		static const char *const kunames[] = { "kernel", "user" };
+
+		dtrace_typeinfo_t dtt;
+		dtrace_syminfo_t *sip;
+
+		if (uref ^ umod) {
+			xyerror(D_SYM_BADREF, "%s module '%s' symbol '%s' may "
+			    "not be referenced as a %s symbol\n", kunames[umod],
+			    dts.dts_object, dts.dts_name, kunames[uref]);
+		}
+
+		if (dtrace_symbol_type(dtp, &sym, &dts, &dtt) != 0) {
+			/*
+			 * For now, we special-case EDT_DATAMODEL to clarify
+			 * that mixed data models are not currently supported.
+			 */
+			if (dtp->dt_errno == EDT_DATAMODEL) {
+				xyerror(D_SYM_MODEL, "cannot use %s symbol "
+				    "%s%s%s in a %s D program\n",
+				    dt_module_modelname(mp),
+				    dts.dts_object, mark, dts.dts_name,
+				    dt_module_modelname(dtp->dt_ddefs));
+			}
+
+			xyerror(D_SYM_NOTYPES,
+			    "no symbolic type information is available for "
+			    "%s%s%s: %s\n", dts.dts_object, mark, dts.dts_name,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		}
+
+		idp = dt_ident_create(name, DT_IDENT_SYMBOL, 0, 0,
+		    _dtrace_symattr, 0, &dt_idops_thaw, NULL, dtp->dt_gen);
+
+		if (idp == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+		if (mp->dm_flags & DT_DM_PRIMARY)
+			idp->di_flags |= DT_IDFLG_PRIM;
+
+		idp->di_next = dtp->dt_externs;
+		dtp->dt_externs = idp;
+
+		if ((sip = malloc(sizeof (dtrace_syminfo_t))) == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+		bcopy(&dts, sip, sizeof (dtrace_syminfo_t));
+		idp->di_data = sip;
+		idp->di_ctfp = dtt.dtt_ctfp;
+		idp->di_type = dtt.dtt_type;
+
+		free(dnp->dn_string);
+		dnp->dn_string = NULL;
+		dnp->dn_kind = DT_NODE_SYM;
+		dnp->dn_ident = idp;
+		dnp->dn_flags |= DT_NF_LVALUE;
+
+		dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type);
+		dt_node_attr_assign(dnp, _dtrace_symattr);
+
+		if (uref) {
+			idp->di_flags |= DT_IDFLG_USER;
+			dnp->dn_flags |= DT_NF_USERLAND;
+		}
+	} else if (scope == DTRACE_OBJ_EXEC && create == B_TRUE) {
+		uint_t flags = DT_IDFLG_WRITE;
+		uint_t id;
+
+		if (dt_idhash_nextid(dhp, &id) == -1) {
+			xyerror(D_ID_OFLOW, "cannot create %s: limit on number "
+			    "of %s variables exceeded\n", name, sname);
+		}
+
+		if (dhp == yypcb->pcb_locals)
+			flags |= DT_IDFLG_LOCAL;
+		else if (dhp == dtp->dt_tls)
+			flags |= DT_IDFLG_TLS;
+
+		dt_dprintf("create %s %s variable %s, id=%u\n",
+		    sname, dt_idkind_name(idkind), name, id);
+
+		if (idkind == DT_IDENT_ARRAY || idkind == DT_IDENT_AGG) {
+			idp = dt_idhash_insert(dhp, name,
+			    idkind, flags, id, _dtrace_defattr, 0,
+			    &dt_idops_assc, NULL, dtp->dt_gen);
+		} else {
+			idp = dt_idhash_insert(dhp, name,
+			    idkind, flags, id, _dtrace_defattr, 0,
+			    &dt_idops_thaw, NULL, dtp->dt_gen);
+		}
+
+		if (idp == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+		/*
+		 * Arrays and aggregations are not cooked individually. They
+		 * have dynamic types and must be referenced using operator [].
+		 * This is handled explicitly by the code for DT_TOK_LBRAC.
+		 */
+		if (idp->di_kind != DT_IDENT_ARRAY &&
+		    idp->di_kind != DT_IDENT_AGG)
+			attr = dt_ident_cook(dnp, idp, NULL);
+		else {
+			dt_node_type_assign(dnp,
+			    DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
+			attr = idp->di_attr;
+		}
+
+		free(dnp->dn_string);
+		dnp->dn_string = NULL;
+		dnp->dn_kind = dnkind;
+		dnp->dn_ident = idp;
+		dnp->dn_flags |= DT_NF_LVALUE | DT_NF_WRITABLE;
+
+		dt_node_attr_assign(dnp, attr);
+
+	} else if (scope != DTRACE_OBJ_EXEC) {
+		xyerror(D_IDENT_UNDEF, "failed to resolve %s%s%s: %s\n",
+		    dnp->dn_string, mark, name,
+		    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+	} else {
+		xyerror(D_IDENT_UNDEF, "failed to resolve %s: %s\n",
+		    dnp->dn_string, dtrace_errmsg(dtp, dtrace_errno(dtp)));
+	}
+}
+
+static dt_node_t *
+dt_cook_ident(dt_node_t *dnp, uint_t idflags)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+
+	if (dnp->dn_op == DT_TOK_AGG)
+		dt_xcook_ident(dnp, dtp->dt_aggs, DT_IDENT_AGG, B_FALSE);
+	else
+		dt_xcook_ident(dnp, dtp->dt_globals, DT_IDENT_SCALAR, B_FALSE);
+
+	return (dt_node_cook(dnp, idflags));
+}
+
+/*
+ * Since operators [ and -> can instantiate new variables before we know
+ * whether the reference is for a read or a write, we need to check read
+ * references to determine if the identifier is currently dt_ident_unref().
+ * If so, we report that this first access was to an undefined variable.
+ */
+static dt_node_t *
+dt_cook_var(dt_node_t *dnp, uint_t idflags)
+{
+	dt_ident_t *idp = dnp->dn_ident;
+
+	if ((idflags & DT_IDFLG_REF) && dt_ident_unref(idp)) {
+		dnerror(dnp, D_VAR_UNDEF,
+		    "%s%s has not yet been declared or assigned\n",
+		    (idp->di_flags & DT_IDFLG_LOCAL) ? "this->" :
+		    (idp->di_flags & DT_IDFLG_TLS) ? "self->" : "",
+		    idp->di_name);
+	}
+
+	dt_node_attr_assign(dnp, dt_ident_cook(dnp, idp, &dnp->dn_args));
+	return (dnp);
+}
+
+/*ARGSUSED*/
+static dt_node_t *
+dt_cook_func(dt_node_t *dnp, uint_t idflags)
+{
+	dt_node_attr_assign(dnp,
+	    dt_ident_cook(dnp, dnp->dn_ident, &dnp->dn_args));
+
+	return (dnp);
+}
+
+static dt_node_t *
+dt_cook_op1(dt_node_t *dnp, uint_t idflags)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_node_t *cp = dnp->dn_child;
+
+	char n[DT_TYPE_NAMELEN];
+	dtrace_typeinfo_t dtt;
+	dt_ident_t *idp;
+
+	ctf_encoding_t e;
+	ctf_arinfo_t r;
+	ctf_id_t type, base;
+	uint_t kind;
+
+	if (dnp->dn_op == DT_TOK_PREINC || dnp->dn_op == DT_TOK_POSTINC ||
+	    dnp->dn_op == DT_TOK_PREDEC || dnp->dn_op == DT_TOK_POSTDEC)
+		idflags = DT_IDFLG_REF | DT_IDFLG_MOD;
+	else
+		idflags = DT_IDFLG_REF;
+
+	/*
+	 * We allow the unary ++ and -- operators to instantiate new scalar
+	 * variables if applied to an identifier; otherwise just cook as usual.
+	 */
+	if (cp->dn_kind == DT_NODE_IDENT && (idflags & DT_IDFLG_MOD))
+		dt_xcook_ident(cp, dtp->dt_globals, DT_IDENT_SCALAR, B_TRUE);
+
+	cp = dnp->dn_child = dt_node_cook(cp, 0); /* don't set idflags yet */
+
+	if (cp->dn_kind == DT_NODE_VAR && dt_ident_unref(cp->dn_ident)) {
+		if (dt_type_lookup("int64_t", &dtt) != 0)
+			xyerror(D_TYPE_ERR, "failed to lookup int64_t\n");
+
+		dt_ident_type_assign(cp->dn_ident, dtt.dtt_ctfp, dtt.dtt_type);
+		dt_node_type_assign(cp, dtt.dtt_ctfp, dtt.dtt_type);
+	}
+
+	if (cp->dn_kind == DT_NODE_VAR)
+		cp->dn_ident->di_flags |= idflags;
+
+	switch (dnp->dn_op) {
+	case DT_TOK_DEREF:
+		/*
+		 * If the deref operator is applied to a translated pointer,
+		 * we can just set our output type to the base translation.
+		 */
+		if ((idp = dt_node_resolve(cp, DT_IDENT_XLPTR)) != NULL) {
+			dt_xlator_t *dxp = idp->di_data;
+
+			dnp->dn_ident = &dxp->dx_souid;
+			dt_node_type_assign(dnp,
+			    DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
+			break;
+		}
+
+		type = ctf_type_resolve(cp->dn_ctfp, cp->dn_type);
+		kind = ctf_type_kind(cp->dn_ctfp, type);
+
+		if (kind == CTF_K_ARRAY) {
+			if (ctf_array_info(cp->dn_ctfp, type, &r) != 0) {
+				dtp->dt_ctferr = ctf_errno(cp->dn_ctfp);
+				longjmp(yypcb->pcb_jmpbuf, EDT_CTF);
+			} else
+				type = r.ctr_contents;
+		} else if (kind == CTF_K_POINTER) {
+			type = ctf_type_reference(cp->dn_ctfp, type);
+		} else {
+			xyerror(D_DEREF_NONPTR,
+			    "cannot dereference non-pointer type\n");
+		}
+
+		dt_node_type_assign(dnp, cp->dn_ctfp, type);
+		base = ctf_type_resolve(cp->dn_ctfp, type);
+		kind = ctf_type_kind(cp->dn_ctfp, base);
+
+		if (kind == CTF_K_INTEGER && ctf_type_encoding(cp->dn_ctfp,
+		    base, &e) == 0 && IS_VOID(e)) {
+			xyerror(D_DEREF_VOID,
+			    "cannot dereference pointer to void\n");
+		}
+
+		if (kind == CTF_K_FUNCTION) {
+			xyerror(D_DEREF_FUNC,
+			    "cannot dereference pointer to function\n");
+		}
+
+		if (kind != CTF_K_ARRAY || dt_node_is_string(dnp))
+			dnp->dn_flags |= DT_NF_LVALUE; /* see K&R[A7.4.3] */
+
+		/*
+		 * If we propagated the l-value bit and the child operand was
+		 * a writable D variable or a binary operation of the form
+		 * a + b where a is writable, then propagate the writable bit.
+		 * This is necessary to permit assignments to scalar arrays,
+		 * which are converted to expressions of the form *(a + i).
+		 */
+		if ((cp->dn_flags & DT_NF_WRITABLE) ||
+		    (cp->dn_kind == DT_NODE_OP2 && cp->dn_op == DT_TOK_ADD &&
+		    (cp->dn_left->dn_flags & DT_NF_WRITABLE)))
+			dnp->dn_flags |= DT_NF_WRITABLE;
+
+		if ((cp->dn_flags & DT_NF_USERLAND) &&
+		    (kind == CTF_K_POINTER || (dnp->dn_flags & DT_NF_REF)))
+			dnp->dn_flags |= DT_NF_USERLAND;
+		break;
+
+	case DT_TOK_IPOS:
+	case DT_TOK_INEG:
+		if (!dt_node_is_arith(cp)) {
+			xyerror(D_OP_ARITH, "operator %s requires an operand "
+			    "of arithmetic type\n", opstr(dnp->dn_op));
+		}
+		dt_node_type_propagate(cp, dnp); /* see K&R[A7.4.4-6] */
+		break;
+
+	case DT_TOK_BNEG:
+		if (!dt_node_is_integer(cp)) {
+			xyerror(D_OP_INT, "operator %s requires an operand of "
+			    "integral type\n", opstr(dnp->dn_op));
+		}
+		dt_node_type_propagate(cp, dnp); /* see K&R[A7.4.4-6] */
+		break;
+
+	case DT_TOK_LNEG:
+		if (!dt_node_is_scalar(cp)) {
+			xyerror(D_OP_SCALAR, "operator %s requires an operand "
+			    "of scalar type\n", opstr(dnp->dn_op));
+		}
+		dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+		break;
+
+	case DT_TOK_ADDROF:
+		if (cp->dn_kind == DT_NODE_VAR || cp->dn_kind == DT_NODE_AGG) {
+			xyerror(D_ADDROF_VAR,
+			    "cannot take address of dynamic variable\n");
+		}
+
+		if (dt_node_is_dynamic(cp)) {
+			xyerror(D_ADDROF_VAR,
+			    "cannot take address of dynamic object\n");
+		}
+
+		if (!(cp->dn_flags & DT_NF_LVALUE)) {
+			xyerror(D_ADDROF_LVAL, /* see K&R[A7.4.2] */
+			    "unacceptable operand for unary & operator\n");
+		}
+
+		if (cp->dn_flags & DT_NF_BITFIELD) {
+			xyerror(D_ADDROF_BITFIELD,
+			    "cannot take address of bit-field\n");
+		}
+
+		dtt.dtt_object = NULL;
+		dtt.dtt_ctfp = cp->dn_ctfp;
+		dtt.dtt_type = cp->dn_type;
+
+		if (dt_type_pointer(&dtt) == -1) {
+			xyerror(D_TYPE_ERR, "cannot find type for \"&\": %s*\n",
+			    dt_node_type_name(cp, n, sizeof (n)));
+		}
+
+		dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type);
+
+		if (cp->dn_flags & DT_NF_USERLAND)
+			dnp->dn_flags |= DT_NF_USERLAND;
+		break;
+
+	case DT_TOK_SIZEOF:
+		if (cp->dn_flags & DT_NF_BITFIELD) {
+			xyerror(D_SIZEOF_BITFIELD,
+			    "cannot apply sizeof to a bit-field\n");
+		}
+
+		if (dt_node_sizeof(cp) == 0) {
+			xyerror(D_SIZEOF_TYPE, "cannot apply sizeof to an "
+			    "operand of unknown size\n");
+		}
+
+		dt_node_type_assign(dnp, dtp->dt_ddefs->dm_ctfp,
+		    ctf_lookup_by_name(dtp->dt_ddefs->dm_ctfp, "size_t"));
+		break;
+
+	case DT_TOK_STRINGOF:
+		if (!dt_node_is_scalar(cp) && !dt_node_is_pointer(cp) &&
+		    !dt_node_is_strcompat(cp)) {
+			xyerror(D_STRINGOF_TYPE,
+			    "cannot apply stringof to a value of type %s\n",
+			    dt_node_type_name(cp, n, sizeof (n)));
+		}
+		dt_node_type_assign(dnp, DT_STR_CTFP(dtp), DT_STR_TYPE(dtp));
+		break;
+
+	case DT_TOK_PREINC:
+	case DT_TOK_POSTINC:
+	case DT_TOK_PREDEC:
+	case DT_TOK_POSTDEC:
+		if (dt_node_is_scalar(cp) == 0) {
+			xyerror(D_OP_SCALAR, "operator %s requires operand of "
+			    "scalar type\n", opstr(dnp->dn_op));
+		}
+
+		if (dt_node_is_vfptr(cp)) {
+			xyerror(D_OP_VFPTR, "operator %s requires an operand "
+			    "of known size\n", opstr(dnp->dn_op));
+		}
+
+		if (!(cp->dn_flags & DT_NF_LVALUE)) {
+			xyerror(D_OP_LVAL, "operator %s requires modifiable "
+			    "lvalue as an operand\n", opstr(dnp->dn_op));
+		}
+
+		if (!(cp->dn_flags & DT_NF_WRITABLE)) {
+			xyerror(D_OP_WRITE, "operator %s can only be applied "
+			    "to a writable variable\n", opstr(dnp->dn_op));
+		}
+
+		dt_node_type_propagate(cp, dnp); /* see K&R[A7.4.1] */
+		break;
+
+	default:
+		xyerror(D_UNKNOWN, "invalid unary op %s\n", opstr(dnp->dn_op));
+	}
+
+	dt_node_attr_assign(dnp, cp->dn_attr);
+	return (dnp);
+}
+
+static dt_node_t *
+dt_cook_op2(dt_node_t *dnp, uint_t idflags)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_node_t *lp = dnp->dn_left;
+	dt_node_t *rp = dnp->dn_right;
+	int op = dnp->dn_op;
+
+	ctf_membinfo_t m;
+	ctf_file_t *ctfp;
+	ctf_id_t type;
+	int kind, val, uref;
+	dt_ident_t *idp;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	/*
+	 * The expression E1[E2] is identical by definition to *((E1)+(E2)) so
+	 * we convert "[" to "+" and glue on "*" at the end (see K&R[A7.3.1])
+	 * unless the left-hand side is an untyped D scalar, associative array,
+	 * or aggregation.  In these cases, we proceed to case DT_TOK_LBRAC and
+	 * handle associative array and aggregation references there.
+	 */
+	if (op == DT_TOK_LBRAC) {
+		if (lp->dn_kind == DT_NODE_IDENT) {
+			dt_idhash_t *dhp;
+			uint_t idkind;
+
+			if (lp->dn_op == DT_TOK_AGG) {
+				dhp = dtp->dt_aggs;
+				idp = dt_idhash_lookup(dhp, lp->dn_string + 1);
+				idkind = DT_IDENT_AGG;
+			} else {
+				dhp = dtp->dt_globals;
+				idp = dt_idstack_lookup(
+				    &yypcb->pcb_globals, lp->dn_string);
+				idkind = DT_IDENT_ARRAY;
+			}
+
+			if (idp == NULL || dt_ident_unref(idp))
+				dt_xcook_ident(lp, dhp, idkind, B_TRUE);
+			else
+				dt_xcook_ident(lp, dhp, idp->di_kind, B_FALSE);
+		} else
+			lp = dnp->dn_left = dt_node_cook(lp, 0);
+
+		/*
+		 * Switch op to '+' for *(E1 + E2) array mode in these cases:
+		 * (a) lp is a DT_IDENT_ARRAY variable that has already been
+		 *	referenced using [] notation (dn_args != NULL).
+		 * (b) lp is a non-ARRAY variable that has already been given
+		 *	a type by assignment or declaration (!dt_ident_unref())
+		 * (c) lp is neither a variable nor an aggregation
+		 */
+		if (lp->dn_kind == DT_NODE_VAR) {
+			if (lp->dn_ident->di_kind == DT_IDENT_ARRAY) {
+				if (lp->dn_args != NULL)
+					op = DT_TOK_ADD;
+			} else if (!dt_ident_unref(lp->dn_ident))
+				op = DT_TOK_ADD;
+		} else if (lp->dn_kind != DT_NODE_AGG)
+			op = DT_TOK_ADD;
+	}
+
+	switch (op) {
+	case DT_TOK_BAND:
+	case DT_TOK_XOR:
+	case DT_TOK_BOR:
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		if (!dt_node_is_integer(lp) || !dt_node_is_integer(rp)) {
+			xyerror(D_OP_INT, "operator %s requires operands of "
+			    "integral type\n", opstr(op));
+		}
+
+		dt_node_promote(lp, rp, dnp); /* see K&R[A7.11-13] */
+		break;
+
+	case DT_TOK_LSH:
+	case DT_TOK_RSH:
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		if (!dt_node_is_integer(lp) || !dt_node_is_integer(rp)) {
+			xyerror(D_OP_INT, "operator %s requires operands of "
+			    "integral type\n", opstr(op));
+		}
+
+		dt_node_type_propagate(lp, dnp); /* see K&R[A7.8] */
+		dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+		break;
+
+	case DT_TOK_MOD:
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		if (!dt_node_is_integer(lp) || !dt_node_is_integer(rp)) {
+			xyerror(D_OP_INT, "operator %s requires operands of "
+			    "integral type\n", opstr(op));
+		}
+
+		dt_node_promote(lp, rp, dnp); /* see K&R[A7.6] */
+		break;
+
+	case DT_TOK_MUL:
+	case DT_TOK_DIV:
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		if (!dt_node_is_arith(lp) || !dt_node_is_arith(rp)) {
+			xyerror(D_OP_ARITH, "operator %s requires operands of "
+			    "arithmetic type\n", opstr(op));
+		}
+
+		dt_node_promote(lp, rp, dnp); /* see K&R[A7.6] */
+		break;
+
+	case DT_TOK_LAND:
+	case DT_TOK_LXOR:
+	case DT_TOK_LOR:
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		if (!dt_node_is_scalar(lp) || !dt_node_is_scalar(rp)) {
+			xyerror(D_OP_SCALAR, "operator %s requires operands "
+			    "of scalar type\n", opstr(op));
+		}
+
+		dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+		dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+		break;
+
+	case DT_TOK_LT:
+	case DT_TOK_LE:
+	case DT_TOK_GT:
+	case DT_TOK_GE:
+	case DT_TOK_EQU:
+	case DT_TOK_NEQ:
+		/*
+		 * The D comparison operators provide the ability to transform
+		 * a right-hand identifier into a corresponding enum tag value
+		 * if the left-hand side is an enum type.  To do this, we cook
+		 * the left-hand side, and then see if the right-hand side is
+		 * an unscoped identifier defined in the enum.  If so, we
+		 * convert into an integer constant node with the tag's value.
+		 */
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+
+		kind = ctf_type_kind(lp->dn_ctfp,
+		    ctf_type_resolve(lp->dn_ctfp, lp->dn_type));
+
+		if (kind == CTF_K_ENUM && rp->dn_kind == DT_NODE_IDENT &&
+		    strchr(rp->dn_string, '`') == NULL && ctf_enum_value(
+		    lp->dn_ctfp, lp->dn_type, rp->dn_string, &val) == 0) {
+
+			if ((idp = dt_idstack_lookup(&yypcb->pcb_globals,
+			    rp->dn_string)) != NULL) {
+				xyerror(D_IDENT_AMBIG,
+				    "ambiguous use of operator %s: %s is "
+				    "both a %s enum tag and a global %s\n",
+				    opstr(op), rp->dn_string,
+				    dt_node_type_name(lp, n1, sizeof (n1)),
+				    dt_idkind_name(idp->di_kind));
+			}
+
+			free(rp->dn_string);
+			rp->dn_string = NULL;
+			rp->dn_kind = DT_NODE_INT;
+			rp->dn_flags |= DT_NF_COOKED;
+			rp->dn_op = DT_TOK_INT;
+			rp->dn_value = (intmax_t)val;
+
+			dt_node_type_assign(rp, lp->dn_ctfp, lp->dn_type);
+			dt_node_attr_assign(rp, _dtrace_symattr);
+		}
+
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		/*
+		 * The rules for type checking for the relational operators are
+		 * described in the ANSI-C spec (see K&R[A7.9-10]).  We perform
+		 * the various tests in order from least to most expensive.  We
+		 * also allow derived strings to be compared as a first-class
+		 * type (resulting in a strcmp(3C)-style comparison), and we
+		 * slightly relax the A7.9 rules to permit void pointer
+		 * comparisons as in A7.10.  Our users won't be confused by
+		 * this since they understand pointers are just numbers, and
+		 * relaxing this constraint simplifies the implementation.
+		 */
+		if (ctf_type_compat(lp->dn_ctfp, lp->dn_type,
+		    rp->dn_ctfp, rp->dn_type))
+			/*EMPTY*/;
+		else if (dt_node_is_integer(lp) && dt_node_is_integer(rp))
+			/*EMPTY*/;
+		else if (dt_node_is_strcompat(lp) && dt_node_is_strcompat(rp) &&
+		    (dt_node_is_string(lp) || dt_node_is_string(rp)))
+			/*EMPTY*/;
+		else if (dt_node_is_ptrcompat(lp, rp, NULL, NULL) == 0) {
+			xyerror(D_OP_INCOMPAT, "operands have "
+			    "incompatible types: \"%s\" %s \"%s\"\n",
+			    dt_node_type_name(lp, n1, sizeof (n1)), opstr(op),
+			    dt_node_type_name(rp, n2, sizeof (n2)));
+		}
+
+		dt_node_type_assign(dnp, DT_INT_CTFP(dtp), DT_INT_TYPE(dtp));
+		dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+		break;
+
+	case DT_TOK_ADD:
+	case DT_TOK_SUB: {
+		/*
+		 * The rules for type checking for the additive operators are
+		 * described in the ANSI-C spec (see K&R[A7.7]).  Pointers and
+		 * integers may be manipulated according to specific rules.  In
+		 * these cases D permits strings to be treated as pointers.
+		 */
+		int lp_is_ptr, lp_is_int, rp_is_ptr, rp_is_int;
+
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		lp_is_ptr = dt_node_is_string(lp) ||
+		    (dt_node_is_pointer(lp) && !dt_node_is_vfptr(lp));
+		lp_is_int = dt_node_is_integer(lp);
+
+		rp_is_ptr = dt_node_is_string(rp) ||
+		    (dt_node_is_pointer(rp) && !dt_node_is_vfptr(rp));
+		rp_is_int = dt_node_is_integer(rp);
+
+		if (lp_is_int && rp_is_int) {
+			dt_type_promote(lp, rp, &ctfp, &type);
+			uref = 0;
+		} else if (lp_is_ptr && rp_is_int) {
+			ctfp = lp->dn_ctfp;
+			type = lp->dn_type;
+			uref = lp->dn_flags & DT_NF_USERLAND;
+		} else if (lp_is_int && rp_is_ptr && op == DT_TOK_ADD) {
+			ctfp = rp->dn_ctfp;
+			type = rp->dn_type;
+			uref = rp->dn_flags & DT_NF_USERLAND;
+		} else if (lp_is_ptr && rp_is_ptr && op == DT_TOK_SUB &&
+		    dt_node_is_ptrcompat(lp, rp, NULL, NULL)) {
+			ctfp = dtp->dt_ddefs->dm_ctfp;
+			type = ctf_lookup_by_name(ctfp, "ptrdiff_t");
+			uref = 0;
+		} else {
+			xyerror(D_OP_INCOMPAT, "operands have incompatible "
+			    "types: \"%s\" %s \"%s\"\n",
+			    dt_node_type_name(lp, n1, sizeof (n1)), opstr(op),
+			    dt_node_type_name(rp, n2, sizeof (n2)));
+		}
+
+		dt_node_type_assign(dnp, ctfp, type);
+		dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+
+		if (uref)
+			dnp->dn_flags |= DT_NF_USERLAND;
+		break;
+	}
+
+	case DT_TOK_OR_EQ:
+	case DT_TOK_XOR_EQ:
+	case DT_TOK_AND_EQ:
+	case DT_TOK_LSH_EQ:
+	case DT_TOK_RSH_EQ:
+	case DT_TOK_MOD_EQ:
+		if (lp->dn_kind == DT_NODE_IDENT) {
+			dt_xcook_ident(lp, dtp->dt_globals,
+			    DT_IDENT_SCALAR, B_TRUE);
+		}
+
+		lp = dnp->dn_left =
+		    dt_node_cook(lp, DT_IDFLG_REF | DT_IDFLG_MOD);
+
+		rp = dnp->dn_right =
+		    dt_node_cook(rp, DT_IDFLG_REF | DT_IDFLG_MOD);
+
+		if (!dt_node_is_integer(lp) || !dt_node_is_integer(rp)) {
+			xyerror(D_OP_INT, "operator %s requires operands of "
+			    "integral type\n", opstr(op));
+		}
+		goto asgn_common;
+
+	case DT_TOK_MUL_EQ:
+	case DT_TOK_DIV_EQ:
+		if (lp->dn_kind == DT_NODE_IDENT) {
+			dt_xcook_ident(lp, dtp->dt_globals,
+			    DT_IDENT_SCALAR, B_TRUE);
+		}
+
+		lp = dnp->dn_left =
+		    dt_node_cook(lp, DT_IDFLG_REF | DT_IDFLG_MOD);
+
+		rp = dnp->dn_right =
+		    dt_node_cook(rp, DT_IDFLG_REF | DT_IDFLG_MOD);
+
+		if (!dt_node_is_arith(lp) || !dt_node_is_arith(rp)) {
+			xyerror(D_OP_ARITH, "operator %s requires operands of "
+			    "arithmetic type\n", opstr(op));
+		}
+		goto asgn_common;
+
+	case DT_TOK_ASGN:
+		/*
+		 * If the left-hand side is an identifier, attempt to resolve
+		 * it as either an aggregation or scalar variable.  We pass
+		 * B_TRUE to dt_xcook_ident to indicate that a new variable can
+		 * be created if no matching variable exists in the namespace.
+		 */
+		if (lp->dn_kind == DT_NODE_IDENT) {
+			if (lp->dn_op == DT_TOK_AGG) {
+				dt_xcook_ident(lp, dtp->dt_aggs,
+				    DT_IDENT_AGG, B_TRUE);
+			} else {
+				dt_xcook_ident(lp, dtp->dt_globals,
+				    DT_IDENT_SCALAR, B_TRUE);
+			}
+		}
+
+		lp = dnp->dn_left = dt_node_cook(lp, 0); /* don't set mod yet */
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		/*
+		 * If the left-hand side is an aggregation, verify that we are
+		 * assigning it the result of an aggregating function.  Once
+		 * we've done so, hide the func node in the aggregation and
+		 * return the aggregation itself up to the parse tree parent.
+		 * This transformation is legal since the assigned function
+		 * cannot change identity across disjoint cooking passes and
+		 * the argument list subtree is retained for later cooking.
+		 */
+		if (lp->dn_kind == DT_NODE_AGG) {
+			const char *aname = lp->dn_ident->di_name;
+			dt_ident_t *oid = lp->dn_ident->di_iarg;
+
+			if (rp->dn_kind != DT_NODE_FUNC ||
+			    rp->dn_ident->di_kind != DT_IDENT_AGGFUNC) {
+				xyerror(D_AGG_FUNC,
+				    "@%s must be assigned the result of "
+				    "an aggregating function\n", aname);
+			}
+
+			if (oid != NULL && oid != rp->dn_ident) {
+				xyerror(D_AGG_REDEF,
+				    "aggregation redefined: @%s\n\t "
+				    "current: @%s = %s( )\n\tprevious: @%s = "
+				    "%s( ) : line %d\n", aname, aname,
+				    rp->dn_ident->di_name, aname, oid->di_name,
+				    lp->dn_ident->di_lineno);
+			} else if (oid == NULL)
+				lp->dn_ident->di_iarg = rp->dn_ident;
+
+			/*
+			 * Do not allow multiple aggregation assignments in a
+			 * single statement, e.g. (@a = count()) = count();
+			 * We produce a message as if the result of aggregating
+			 * function does not propagate DT_NF_LVALUE.
+			 */
+			if (lp->dn_aggfun != NULL) {
+				xyerror(D_OP_LVAL, "operator = requires "
+				    "modifiable lvalue as an operand\n");
+			}
+
+			lp->dn_aggfun = rp;
+			lp = dt_node_cook(lp, DT_IDFLG_MOD);
+
+			dnp->dn_left = dnp->dn_right = NULL;
+			dt_node_free(dnp);
+
+			return (lp);
+		}
+
+		/*
+		 * If the right-hand side is a dynamic variable that is the
+		 * output of a translator, our result is the translated type.
+		 */
+		if ((idp = dt_node_resolve(rp, DT_IDENT_XLSOU)) != NULL) {
+			ctfp = idp->di_ctfp;
+			type = idp->di_type;
+			uref = idp->di_flags & DT_IDFLG_USER;
+		} else {
+			ctfp = rp->dn_ctfp;
+			type = rp->dn_type;
+			uref = rp->dn_flags & DT_NF_USERLAND;
+		}
+
+		/*
+		 * If the left-hand side of an assignment statement is a virgin
+		 * variable created by this compilation pass, reset the type of
+		 * this variable to the type of the right-hand side.
+		 */
+		if (lp->dn_kind == DT_NODE_VAR &&
+		    dt_ident_unref(lp->dn_ident)) {
+			dt_node_type_assign(lp, ctfp, type);
+			dt_ident_type_assign(lp->dn_ident, ctfp, type);
+
+			if (uref) {
+				lp->dn_flags |= DT_NF_USERLAND;
+				lp->dn_ident->di_flags |= DT_IDFLG_USER;
+			}
+		}
+
+		if (lp->dn_kind == DT_NODE_VAR)
+			lp->dn_ident->di_flags |= DT_IDFLG_MOD;
+
+		/*
+		 * The rules for type checking for the assignment operators are
+		 * described in the ANSI-C spec (see K&R[A7.17]).  We share
+		 * most of this code with the argument list checking code.
+		 */
+		if (!dt_node_is_string(lp)) {
+			kind = ctf_type_kind(lp->dn_ctfp,
+			    ctf_type_resolve(lp->dn_ctfp, lp->dn_type));
+
+			if (kind == CTF_K_ARRAY || kind == CTF_K_FUNCTION) {
+				xyerror(D_OP_ARRFUN, "operator %s may not be "
+				    "applied to operand of type \"%s\"\n",
+				    opstr(op),
+				    dt_node_type_name(lp, n1, sizeof (n1)));
+			}
+		}
+
+		if (idp != NULL && idp->di_kind == DT_IDENT_XLSOU &&
+		    ctf_type_compat(lp->dn_ctfp, lp->dn_type, ctfp, type))
+			goto asgn_common;
+
+		if (dt_node_is_argcompat(lp, rp))
+			goto asgn_common;
+
+		xyerror(D_OP_INCOMPAT,
+		    "operands have incompatible types: \"%s\" %s \"%s\"\n",
+		    dt_node_type_name(lp, n1, sizeof (n1)), opstr(op),
+		    dt_node_type_name(rp, n2, sizeof (n2)));
+		/*NOTREACHED*/
+
+	case DT_TOK_ADD_EQ:
+	case DT_TOK_SUB_EQ:
+		if (lp->dn_kind == DT_NODE_IDENT) {
+			dt_xcook_ident(lp, dtp->dt_globals,
+			    DT_IDENT_SCALAR, B_TRUE);
+		}
+
+		lp = dnp->dn_left =
+		    dt_node_cook(lp, DT_IDFLG_REF | DT_IDFLG_MOD);
+
+		rp = dnp->dn_right =
+		    dt_node_cook(rp, DT_IDFLG_REF | DT_IDFLG_MOD);
+
+		if (dt_node_is_string(lp) || dt_node_is_string(rp)) {
+			xyerror(D_OP_INCOMPAT, "operands have "
+			    "incompatible types: \"%s\" %s \"%s\"\n",
+			    dt_node_type_name(lp, n1, sizeof (n1)), opstr(op),
+			    dt_node_type_name(rp, n2, sizeof (n2)));
+		}
+
+		/*
+		 * The rules for type checking for the assignment operators are
+		 * described in the ANSI-C spec (see K&R[A7.17]).  To these
+		 * rules we add that only writable D nodes can be modified.
+		 */
+		if (dt_node_is_integer(lp) == 0 ||
+		    dt_node_is_integer(rp) == 0) {
+			if (!dt_node_is_pointer(lp) || dt_node_is_vfptr(lp)) {
+				xyerror(D_OP_VFPTR,
+				    "operator %s requires left-hand scalar "
+				    "operand of known size\n", opstr(op));
+			} else if (dt_node_is_integer(rp) == 0 &&
+			    dt_node_is_ptrcompat(lp, rp, NULL, NULL) == 0) {
+				xyerror(D_OP_INCOMPAT, "operands have "
+				    "incompatible types: \"%s\" %s \"%s\"\n",
+				    dt_node_type_name(lp, n1, sizeof (n1)),
+				    opstr(op),
+				    dt_node_type_name(rp, n2, sizeof (n2)));
+			}
+		}
+asgn_common:
+		if (!(lp->dn_flags & DT_NF_LVALUE)) {
+			xyerror(D_OP_LVAL, "operator %s requires modifiable "
+			    "lvalue as an operand\n", opstr(op));
+			/* see K&R[A7.17] */
+		}
+
+		if (!(lp->dn_flags & DT_NF_WRITABLE)) {
+			xyerror(D_OP_WRITE, "operator %s can only be applied "
+			    "to a writable variable\n", opstr(op));
+		}
+
+		dt_node_type_propagate(lp, dnp); /* see K&R[A7.17] */
+		dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+		break;
+
+	case DT_TOK_PTR:
+		/*
+		 * If the left-hand side of operator -> is the name "self",
+		 * then we permit a TLS variable to be created or referenced.
+		 */
+		if (lp->dn_kind == DT_NODE_IDENT &&
+		    strcmp(lp->dn_string, "self") == 0) {
+			if (rp->dn_kind != DT_NODE_VAR) {
+				dt_xcook_ident(rp, dtp->dt_tls,
+				    DT_IDENT_SCALAR, B_TRUE);
+			}
+
+			if (idflags != 0)
+				rp = dt_node_cook(rp, idflags);
+
+			dnp->dn_right = dnp->dn_left; /* avoid freeing rp */
+			dt_node_free(dnp);
+			return (rp);
+		}
+
+		/*
+		 * If the left-hand side of operator -> is the name "this",
+		 * then we permit a local variable to be created or referenced.
+		 */
+		if (lp->dn_kind == DT_NODE_IDENT &&
+		    strcmp(lp->dn_string, "this") == 0) {
+			if (rp->dn_kind != DT_NODE_VAR) {
+				dt_xcook_ident(rp, yypcb->pcb_locals,
+				    DT_IDENT_SCALAR, B_TRUE);
+			}
+
+			if (idflags != 0)
+				rp = dt_node_cook(rp, idflags);
+
+			dnp->dn_right = dnp->dn_left; /* avoid freeing rp */
+			dt_node_free(dnp);
+			return (rp);
+		}
+
+		/*FALLTHRU*/
+
+	case DT_TOK_DOT:
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+
+		if (rp->dn_kind != DT_NODE_IDENT) {
+			xyerror(D_OP_IDENT, "operator %s must be followed by "
+			    "an identifier\n", opstr(op));
+		}
+
+		if ((idp = dt_node_resolve(lp, DT_IDENT_XLSOU)) != NULL ||
+		    (idp = dt_node_resolve(lp, DT_IDENT_XLPTR)) != NULL) {
+			/*
+			 * If the left-hand side is a translated struct or ptr,
+			 * the type of the left is the translation output type.
+			 */
+			dt_xlator_t *dxp = idp->di_data;
+
+			if (dt_xlator_member(dxp, rp->dn_string) == NULL) {
+				xyerror(D_XLATE_NOCONV,
+				    "translator does not define conversion "
+				    "for member: %s\n", rp->dn_string);
+			}
+
+			ctfp = idp->di_ctfp;
+			type = ctf_type_resolve(ctfp, idp->di_type);
+			uref = idp->di_flags & DT_IDFLG_USER;
+		} else {
+			ctfp = lp->dn_ctfp;
+			type = ctf_type_resolve(ctfp, lp->dn_type);
+			uref = lp->dn_flags & DT_NF_USERLAND;
+		}
+
+		kind = ctf_type_kind(ctfp, type);
+
+		if (op == DT_TOK_PTR) {
+			if (kind != CTF_K_POINTER) {
+				xyerror(D_OP_PTR, "operator %s must be "
+				    "applied to a pointer\n", opstr(op));
+			}
+			type = ctf_type_reference(ctfp, type);
+			type = ctf_type_resolve(ctfp, type);
+			kind = ctf_type_kind(ctfp, type);
+		}
+
+		/*
+		 * If we follow a reference to a forward declaration tag,
+		 * search the entire type space for the actual definition.
+		 */
+		while (kind == CTF_K_FORWARD) {
+			char *tag = ctf_type_name(ctfp, type, n1, sizeof (n1));
+			dtrace_typeinfo_t dtt;
+
+			if (tag != NULL && dt_type_lookup(tag, &dtt) == 0 &&
+			    (dtt.dtt_ctfp != ctfp || dtt.dtt_type != type)) {
+				ctfp = dtt.dtt_ctfp;
+				type = ctf_type_resolve(ctfp, dtt.dtt_type);
+				kind = ctf_type_kind(ctfp, type);
+			} else {
+				xyerror(D_OP_INCOMPLETE,
+				    "operator %s cannot be applied to a "
+				    "forward declaration: no %s definition "
+				    "is available\n", opstr(op), tag);
+			}
+		}
+
+		if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) {
+			if (op == DT_TOK_PTR) {
+				xyerror(D_OP_SOU, "operator -> cannot be "
+				    "applied to pointer to type \"%s\"; must "
+				    "be applied to a struct or union pointer\n",
+				    ctf_type_name(ctfp, type, n1, sizeof (n1)));
+			} else {
+				xyerror(D_OP_SOU, "operator %s cannot be "
+				    "applied to type \"%s\"; must be applied "
+				    "to a struct or union\n", opstr(op),
+				    ctf_type_name(ctfp, type, n1, sizeof (n1)));
+			}
+		}
+
+		if (ctf_member_info(ctfp, type, rp->dn_string, &m) == CTF_ERR) {
+			xyerror(D_TYPE_MEMBER,
+			    "%s is not a member of %s\n", rp->dn_string,
+			    ctf_type_name(ctfp, type, n1, sizeof (n1)));
+		}
+
+		type = ctf_type_resolve(ctfp, m.ctm_type);
+		kind = ctf_type_kind(ctfp, type);
+
+		dt_node_type_assign(dnp, ctfp, m.ctm_type);
+		dt_node_attr_assign(dnp, lp->dn_attr);
+
+		if (op == DT_TOK_PTR && (kind != CTF_K_ARRAY ||
+		    dt_node_is_string(dnp)))
+			dnp->dn_flags |= DT_NF_LVALUE; /* see K&R[A7.3.3] */
+
+		if (op == DT_TOK_DOT && (lp->dn_flags & DT_NF_LVALUE) &&
+		    (kind != CTF_K_ARRAY || dt_node_is_string(dnp)))
+			dnp->dn_flags |= DT_NF_LVALUE; /* see K&R[A7.3.3] */
+
+		if (lp->dn_flags & DT_NF_WRITABLE)
+			dnp->dn_flags |= DT_NF_WRITABLE;
+
+		if (uref && (kind == CTF_K_POINTER ||
+		    (dnp->dn_flags & DT_NF_REF)))
+			dnp->dn_flags |= DT_NF_USERLAND;
+		break;
+
+	case DT_TOK_LBRAC: {
+		/*
+		 * If op is DT_TOK_LBRAC, we know from the special-case code at
+		 * the top that lp is either a D variable or an aggregation.
+		 */
+		dt_node_t *lnp;
+
+		/*
+		 * If the left-hand side is an aggregation, just set dn_aggtup
+		 * to the right-hand side and return the cooked aggregation.
+		 * This transformation is legal since we are just collapsing
+		 * nodes to simplify later processing, and the entire aggtup
+		 * parse subtree is retained for subsequent cooking passes.
+		 */
+		if (lp->dn_kind == DT_NODE_AGG) {
+			if (lp->dn_aggtup != NULL) {
+				xyerror(D_AGG_MDIM, "improper attempt to "
+				    "reference @%s as a multi-dimensional "
+				    "array\n", lp->dn_ident->di_name);
+			}
+
+			lp->dn_aggtup = rp;
+			lp = dt_node_cook(lp, 0);
+
+			dnp->dn_left = dnp->dn_right = NULL;
+			dt_node_free(dnp);
+
+			return (lp);
+		}
+
+		assert(lp->dn_kind == DT_NODE_VAR);
+		idp = lp->dn_ident;
+
+		/*
+		 * If the left-hand side is a non-global scalar that hasn't yet
+		 * been referenced or modified, it was just created by self->
+		 * or this-> and we can convert it from scalar to assoc array.
+		 */
+		if (idp->di_kind == DT_IDENT_SCALAR && dt_ident_unref(idp) &&
+		    (idp->di_flags & (DT_IDFLG_LOCAL | DT_IDFLG_TLS)) != 0) {
+
+			if (idp->di_flags & DT_IDFLG_LOCAL) {
+				xyerror(D_ARR_LOCAL,
+				    "local variables may not be used as "
+				    "associative arrays: %s\n", idp->di_name);
+			}
+
+			dt_dprintf("morph variable %s (id %u) from scalar to "
+			    "array\n", idp->di_name, idp->di_id);
+
+			dt_ident_morph(idp, DT_IDENT_ARRAY,
+			    &dt_idops_assc, NULL);
+		}
+
+		if (idp->di_kind != DT_IDENT_ARRAY) {
+			xyerror(D_IDENT_BADREF, "%s '%s' may not be referenced "
+			    "as %s\n", dt_idkind_name(idp->di_kind),
+			    idp->di_name, dt_idkind_name(DT_IDENT_ARRAY));
+		}
+
+		/*
+		 * Now that we've confirmed our left-hand side is a DT_NODE_VAR
+		 * of idkind DT_IDENT_ARRAY, we need to splice the [ node from
+		 * the parse tree and leave a cooked DT_NODE_VAR in its place
+		 * where dn_args for the VAR node is the right-hand 'rp' tree,
+		 * as shown in the parse tree diagram below:
+		 *
+		 *	  /			    /
+		 * [ OP2 "[" ]=dnp		[ VAR ]=dnp
+		 *	 /	\	  =>	   |
+		 *	/	 \		   +- dn_args -> [ ??? ]=rp
+		 * [ VAR ]=lp  [ ??? ]=rp
+		 *
+		 * Since the final dt_node_cook(dnp) can fail using longjmp we
+		 * must perform the transformations as a group first by over-
+		 * writing 'dnp' to become the VAR node, so that the parse tree
+		 * is guaranteed to be in a consistent state if the cook fails.
+		 */
+		assert(lp->dn_kind == DT_NODE_VAR);
+		assert(lp->dn_args == NULL);
+
+		lnp = dnp->dn_link;
+		bcopy(lp, dnp, sizeof (dt_node_t));
+		dnp->dn_link = lnp;
+
+		dnp->dn_args = rp;
+		dnp->dn_list = NULL;
+
+		dt_node_free(lp);
+		return (dt_node_cook(dnp, idflags));
+	}
+
+	case DT_TOK_XLATE: {
+		dt_xlator_t *dxp;
+
+		assert(lp->dn_kind == DT_NODE_TYPE);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+		dxp = dt_xlator_lookup(dtp, rp, lp, DT_XLATE_FUZZY);
+
+		if (dxp == NULL) {
+			xyerror(D_XLATE_NONE,
+			    "cannot translate from \"%s\" to \"%s\"\n",
+			    dt_node_type_name(rp, n1, sizeof (n1)),
+			    dt_node_type_name(lp, n2, sizeof (n2)));
+		}
+
+		dnp->dn_ident = dt_xlator_ident(dxp, lp->dn_ctfp, lp->dn_type);
+		dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
+		dt_node_attr_assign(dnp,
+		    dt_attr_min(rp->dn_attr, dnp->dn_ident->di_attr));
+		break;
+	}
+
+	case DT_TOK_LPAR: {
+		ctf_id_t ltype, rtype;
+		uint_t lkind, rkind;
+
+		assert(lp->dn_kind == DT_NODE_TYPE);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		ltype = ctf_type_resolve(lp->dn_ctfp, lp->dn_type);
+		lkind = ctf_type_kind(lp->dn_ctfp, ltype);
+
+		rtype = ctf_type_resolve(rp->dn_ctfp, rp->dn_type);
+		rkind = ctf_type_kind(rp->dn_ctfp, rtype);
+
+		/*
+		 * The rules for casting are loosely explained in K&R[A7.5]
+		 * and K&R[A6].  Basically, we can cast to the same type or
+		 * same base type, between any kind of scalar values, from
+		 * arrays to pointers, and we can cast anything to void.
+		 * To these rules D adds casts from scalars to strings.
+		 */
+		if (ctf_type_compat(lp->dn_ctfp, lp->dn_type,
+		    rp->dn_ctfp, rp->dn_type))
+			/*EMPTY*/;
+		else if (dt_node_is_scalar(lp) &&
+		    (dt_node_is_scalar(rp) || rkind == CTF_K_FUNCTION))
+			/*EMPTY*/;
+		else if (dt_node_is_void(lp))
+			/*EMPTY*/;
+		else if (lkind == CTF_K_POINTER && dt_node_is_pointer(rp))
+			/*EMPTY*/;
+		else if (dt_node_is_string(lp) && (dt_node_is_scalar(rp) ||
+		    dt_node_is_pointer(rp) || dt_node_is_strcompat(rp)))
+			/*EMPTY*/;
+		else {
+			xyerror(D_CAST_INVAL,
+			    "invalid cast expression: \"%s\" to \"%s\"\n",
+			    dt_node_type_name(rp, n1, sizeof (n1)),
+			    dt_node_type_name(lp, n2, sizeof (n2)));
+		}
+
+		dt_node_type_propagate(lp, dnp); /* see K&R[A7.5] */
+		dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+		break;
+	}
+
+	case DT_TOK_COMMA:
+		lp = dnp->dn_left = dt_node_cook(lp, DT_IDFLG_REF);
+		rp = dnp->dn_right = dt_node_cook(rp, DT_IDFLG_REF);
+
+		if (dt_node_is_dynamic(lp) || dt_node_is_dynamic(rp)) {
+			xyerror(D_OP_DYN, "operator %s operands "
+			    "cannot be of dynamic type\n", opstr(op));
+		}
+
+		if (dt_node_is_actfunc(lp) || dt_node_is_actfunc(rp)) {
+			xyerror(D_OP_ACT, "operator %s operands "
+			    "cannot be actions\n", opstr(op));
+		}
+
+		dt_node_type_propagate(rp, dnp); /* see K&R[A7.18] */
+		dt_node_attr_assign(dnp, dt_attr_min(lp->dn_attr, rp->dn_attr));
+		break;
+
+	default:
+		xyerror(D_UNKNOWN, "invalid binary op %s\n", opstr(op));
+	}
+
+	/*
+	 * Complete the conversion of E1[E2] to *((E1)+(E2)) that we started
+	 * at the top of our switch() above (see K&R[A7.3.1]).  Since E2 is
+	 * parsed as an argument_expression_list by dt_grammar.y, we can
+	 * end up with a comma-separated list inside of a non-associative
+	 * array reference.  We check for this and report an appropriate error.
+	 */
+	if (dnp->dn_op == DT_TOK_LBRAC && op == DT_TOK_ADD) {
+		dt_node_t *pnp;
+
+		if (rp->dn_list != NULL) {
+			xyerror(D_ARR_BADREF,
+			    "cannot access %s as an associative array\n",
+			    dt_node_name(lp, n1, sizeof (n1)));
+		}
+
+		dnp->dn_op = DT_TOK_ADD;
+		pnp = dt_node_op1(DT_TOK_DEREF, dnp);
+
+		/*
+		 * Cook callbacks are not typically permitted to allocate nodes.
+		 * When we do, we must insert them in the middle of an existing
+		 * allocation list rather than having them appended to the pcb
+		 * list because the sub-expression may be part of a definition.
+		 */
+		assert(yypcb->pcb_list == pnp);
+		yypcb->pcb_list = pnp->dn_link;
+
+		pnp->dn_link = dnp->dn_link;
+		dnp->dn_link = pnp;
+
+		return (dt_node_cook(pnp, DT_IDFLG_REF));
+	}
+
+	return (dnp);
+}
+
+/*ARGSUSED*/
+static dt_node_t *
+dt_cook_op3(dt_node_t *dnp, uint_t idflags)
+{
+	dt_node_t *lp, *rp;
+	ctf_file_t *ctfp;
+	ctf_id_t type;
+
+	dnp->dn_expr = dt_node_cook(dnp->dn_expr, DT_IDFLG_REF);
+	lp = dnp->dn_left = dt_node_cook(dnp->dn_left, DT_IDFLG_REF);
+	rp = dnp->dn_right = dt_node_cook(dnp->dn_right, DT_IDFLG_REF);
+
+	if (!dt_node_is_scalar(dnp->dn_expr)) {
+		xyerror(D_OP_SCALAR,
+		    "operator ?: expression must be of scalar type\n");
+	}
+
+	if (dt_node_is_dynamic(lp) || dt_node_is_dynamic(rp)) {
+		xyerror(D_OP_DYN,
+		    "operator ?: operands cannot be of dynamic type\n");
+	}
+
+	/*
+	 * The rules for type checking for the ternary operator are complex and
+	 * are described in the ANSI-C spec (see K&R[A7.16]).  We implement
+	 * the various tests in order from least to most expensive.
+	 */
+	if (ctf_type_compat(lp->dn_ctfp, lp->dn_type,
+	    rp->dn_ctfp, rp->dn_type)) {
+		ctfp = lp->dn_ctfp;
+		type = lp->dn_type;
+	} else if (dt_node_is_integer(lp) && dt_node_is_integer(rp)) {
+		dt_type_promote(lp, rp, &ctfp, &type);
+	} else if (dt_node_is_strcompat(lp) && dt_node_is_strcompat(rp) &&
+	    (dt_node_is_string(lp) || dt_node_is_string(rp))) {
+		ctfp = DT_STR_CTFP(yypcb->pcb_hdl);
+		type = DT_STR_TYPE(yypcb->pcb_hdl);
+	} else if (dt_node_is_ptrcompat(lp, rp, &ctfp, &type) == 0) {
+		xyerror(D_OP_INCOMPAT,
+		    "operator ?: operands must have compatible types\n");
+	}
+
+	if (dt_node_is_actfunc(lp) || dt_node_is_actfunc(rp)) {
+		xyerror(D_OP_ACT, "action cannot be "
+		    "used in a conditional context\n");
+	}
+
+	dt_node_type_assign(dnp, ctfp, type);
+	dt_node_attr_assign(dnp, dt_attr_min(dnp->dn_expr->dn_attr,
+	    dt_attr_min(lp->dn_attr, rp->dn_attr)));
+
+	return (dnp);
+}
+
+static dt_node_t *
+dt_cook_statement(dt_node_t *dnp, uint_t idflags)
+{
+	dnp->dn_expr = dt_node_cook(dnp->dn_expr, idflags);
+	dt_node_attr_assign(dnp, dnp->dn_expr->dn_attr);
+
+	return (dnp);
+}
+
+/*
+ * If dn_aggfun is set, this node is a collapsed aggregation assignment (see
+ * the special case code for DT_TOK_ASGN in dt_cook_op2() above), in which
+ * case we cook both the tuple and the function call.  If dn_aggfun is NULL,
+ * this node is just a reference to the aggregation's type and attributes.
+ */
+/*ARGSUSED*/
+static dt_node_t *
+dt_cook_aggregation(dt_node_t *dnp, uint_t idflags)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+
+	if (dnp->dn_aggfun != NULL) {
+		dnp->dn_aggfun = dt_node_cook(dnp->dn_aggfun, DT_IDFLG_REF);
+		dt_node_attr_assign(dnp, dt_ident_cook(dnp,
+		    dnp->dn_ident, &dnp->dn_aggtup));
+	} else {
+		dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
+		dt_node_attr_assign(dnp, dnp->dn_ident->di_attr);
+	}
+
+	return (dnp);
+}
+
+/*
+ * Since D permits new variable identifiers to be instantiated in any program
+ * expression, we may need to cook a clause's predicate either before or after
+ * the action list depending on the program code in question.  Consider:
+ *
+ * probe-description-list	probe-description-list
+ * /x++/			/x == 0/
+ * {				{
+ *     trace(x);		    trace(x++);
+ * }				}
+ *
+ * In the left-hand example, the predicate uses operator ++ to instantiate 'x'
+ * as a variable of type int64_t.  The predicate must be cooked first because
+ * otherwise the statement trace(x) refers to an unknown identifier.  In the
+ * right-hand example, the action list uses ++ to instantiate 'x'; the action
+ * list must be cooked first because otherwise the predicate x == 0 refers to
+ * an unknown identifier.  In order to simplify programming, we support both.
+ *
+ * When cooking a clause, we cook the action statements before the predicate by
+ * default, since it seems more common to create or modify identifiers in the
+ * action list.  If cooking fails due to an unknown identifier, we attempt to
+ * cook the predicate (i.e. do it first) and then go back and cook the actions.
+ * If this, too, fails (or if we get an error other than D_IDENT_UNDEF) we give
+ * up and report failure back to the user.  There are five possible paths:
+ *
+ * cook actions = OK, cook predicate = OK -> OK
+ * cook actions = OK, cook predicate = ERR -> ERR
+ * cook actions = ERR, cook predicate = ERR -> ERR
+ * cook actions = ERR, cook predicate = OK, cook actions = OK -> OK
+ * cook actions = ERR, cook predicate = OK, cook actions = ERR -> ERR
+ *
+ * The programmer can still defeat our scheme by creating circular definition
+ * dependencies between predicates and actions, as in this example clause:
+ *
+ * probe-description-list
+ * /x++ && y == 0/
+ * {
+ * 	trace(x + y++);
+ * }
+ *
+ * but it doesn't seem worth the complexity to handle such rare cases.  The
+ * user can simply use the D variable declaration syntax to work around them.
+ */
+static dt_node_t *
+dt_cook_clause(dt_node_t *dnp, uint_t idflags)
+{
+	volatile int err, tries;
+	jmp_buf ojb;
+
+	/*
+	 * Before assigning dn_ctxattr, temporarily assign the probe attribute
+	 * to 'dnp' itself to force an attribute check and minimum violation.
+	 */
+	dt_node_attr_assign(dnp, yypcb->pcb_pinfo.dtp_attr);
+	dnp->dn_ctxattr = yypcb->pcb_pinfo.dtp_attr;
+
+	bcopy(yypcb->pcb_jmpbuf, ojb, sizeof (jmp_buf));
+	tries = 0;
+
+	if (dnp->dn_pred != NULL && (err = setjmp(yypcb->pcb_jmpbuf)) != 0) {
+		bcopy(ojb, yypcb->pcb_jmpbuf, sizeof (jmp_buf));
+		if (tries++ != 0 || err != EDT_COMPILER || (
+		    yypcb->pcb_hdl->dt_errtag != dt_errtag(D_IDENT_UNDEF) &&
+		    yypcb->pcb_hdl->dt_errtag != dt_errtag(D_VAR_UNDEF)))
+			longjmp(yypcb->pcb_jmpbuf, err);
+	}
+
+	if (tries == 0) {
+		yylabel("action list");
+
+		dt_node_attr_assign(dnp,
+		    dt_node_list_cook(&dnp->dn_acts, idflags));
+
+		bcopy(ojb, yypcb->pcb_jmpbuf, sizeof (jmp_buf));
+		yylabel(NULL);
+	}
+
+	if (dnp->dn_pred != NULL) {
+		yylabel("predicate");
+
+		dnp->dn_pred = dt_node_cook(dnp->dn_pred, idflags);
+		dt_node_attr_assign(dnp,
+		    dt_attr_min(dnp->dn_attr, dnp->dn_pred->dn_attr));
+
+		if (!dt_node_is_scalar(dnp->dn_pred)) {
+			xyerror(D_PRED_SCALAR,
+			    "predicate result must be of scalar type\n");
+		}
+
+		yylabel(NULL);
+	}
+
+	if (tries != 0) {
+		yylabel("action list");
+
+		dt_node_attr_assign(dnp,
+		    dt_node_list_cook(&dnp->dn_acts, idflags));
+
+		yylabel(NULL);
+	}
+
+	return (dnp);
+}
+
+/*ARGSUSED*/
+static dt_node_t *
+dt_cook_inline(dt_node_t *dnp, uint_t idflags)
+{
+	dt_idnode_t *inp = dnp->dn_ident->di_iarg;
+	dt_ident_t *rdp;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	assert(dnp->dn_ident->di_flags & DT_IDFLG_INLINE);
+	assert(inp->din_root->dn_flags & DT_NF_COOKED);
+
+	/*
+	 * If we are inlining a translation, verify that the inline declaration
+	 * type exactly matches the type that is returned by the translation.
+	 * Otherwise just use dt_node_is_argcompat() to check the types.
+	 */
+	if ((rdp = dt_node_resolve(inp->din_root, DT_IDENT_XLSOU)) != NULL ||
+	    (rdp = dt_node_resolve(inp->din_root, DT_IDENT_XLPTR)) != NULL) {
+
+		ctf_file_t *lctfp = dnp->dn_ctfp;
+		ctf_id_t ltype = ctf_type_resolve(lctfp, dnp->dn_type);
+
+		dt_xlator_t *dxp = rdp->di_data;
+		ctf_file_t *rctfp = dxp->dx_dst_ctfp;
+		ctf_id_t rtype = dxp->dx_dst_base;
+
+		if (ctf_type_kind(lctfp, ltype) == CTF_K_POINTER) {
+			ltype = ctf_type_reference(lctfp, ltype);
+			ltype = ctf_type_resolve(lctfp, ltype);
+		}
+
+		if (ctf_type_compat(lctfp, ltype, rctfp, rtype) == 0) {
+			dnerror(dnp, D_OP_INCOMPAT,
+			    "inline %s definition uses incompatible types: "
+			    "\"%s\" = \"%s\"\n", dnp->dn_ident->di_name,
+			    dt_type_name(lctfp, ltype, n1, sizeof (n1)),
+			    dt_type_name(rctfp, rtype, n2, sizeof (n2)));
+		}
+
+	} else if (dt_node_is_argcompat(dnp, inp->din_root) == 0) {
+		dnerror(dnp, D_OP_INCOMPAT,
+		    "inline %s definition uses incompatible types: "
+		    "\"%s\" = \"%s\"\n", dnp->dn_ident->di_name,
+		    dt_node_type_name(dnp, n1, sizeof (n1)),
+		    dt_node_type_name(inp->din_root, n2, sizeof (n2)));
+	}
+
+	return (dnp);
+}
+
+static dt_node_t *
+dt_cook_member(dt_node_t *dnp, uint_t idflags)
+{
+	dnp->dn_membexpr = dt_node_cook(dnp->dn_membexpr, idflags);
+	dt_node_attr_assign(dnp, dnp->dn_membexpr->dn_attr);
+	return (dnp);
+}
+
+/*ARGSUSED*/
+static dt_node_t *
+dt_cook_xlator(dt_node_t *dnp, uint_t idflags)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_xlator_t *dxp = dnp->dn_xlator;
+	dt_node_t *mnp;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	dtrace_attribute_t attr = _dtrace_maxattr;
+	ctf_membinfo_t ctm;
+
+	/*
+	 * Before cooking each translator member, we push a reference to the
+	 * hash containing translator-local identifiers on to pcb_globals to
+	 * temporarily interpose these identifiers in front of other globals.
+	 */
+	dt_idstack_push(&yypcb->pcb_globals, dxp->dx_locals);
+
+	for (mnp = dnp->dn_members; mnp != NULL; mnp = mnp->dn_list) {
+		if (ctf_member_info(dxp->dx_dst_ctfp, dxp->dx_dst_type,
+		    mnp->dn_membname, &ctm) == CTF_ERR) {
+			xyerror(D_XLATE_MEMB,
+			    "translator member %s is not a member of %s\n",
+			    mnp->dn_membname, ctf_type_name(dxp->dx_dst_ctfp,
+			    dxp->dx_dst_type, n1, sizeof (n1)));
+		}
+
+		(void) dt_node_cook(mnp, DT_IDFLG_REF);
+		dt_node_type_assign(mnp, dxp->dx_dst_ctfp, ctm.ctm_type);
+		attr = dt_attr_min(attr, mnp->dn_attr);
+
+		if (dt_node_is_argcompat(mnp, mnp->dn_membexpr) == 0) {
+			xyerror(D_XLATE_INCOMPAT,
+			    "translator member %s definition uses "
+			    "incompatible types: \"%s\" = \"%s\"\n",
+			    mnp->dn_membname,
+			    dt_node_type_name(mnp, n1, sizeof (n1)),
+			    dt_node_type_name(mnp->dn_membexpr,
+			    n2, sizeof (n2)));
+		}
+	}
+
+	dt_idstack_pop(&yypcb->pcb_globals, dxp->dx_locals);
+
+	dxp->dx_souid.di_attr = attr;
+	dxp->dx_ptrid.di_attr = attr;
+
+	dt_node_type_assign(dnp, DT_DYN_CTFP(dtp), DT_DYN_TYPE(dtp));
+	dt_node_attr_assign(dnp, _dtrace_defattr);
+
+	return (dnp);
+}
+
+static void
+dt_node_provider_cmp_argv(dt_provider_t *pvp, dt_node_t *pnp, const char *kind,
+    uint_t old_argc, dt_node_t *old_argv, uint_t new_argc, dt_node_t *new_argv)
+{
+	dt_probe_t *prp = pnp->dn_ident->di_data;
+	uint_t i;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	if (old_argc != new_argc) {
+		dnerror(pnp, D_PROV_INCOMPAT,
+		    "probe %s:%s %s prototype mismatch:\n"
+		    "\t current: %u arg%s\n\tprevious: %u arg%s\n",
+		    pvp->pv_desc.dtvd_name, prp->pr_ident->di_name, kind,
+		    new_argc, new_argc != 1 ? "s" : "",
+		    old_argc, old_argc != 1 ? "s" : "");
+	}
+
+	for (i = 0; i < old_argc; i++,
+	    old_argv = old_argv->dn_list, new_argv = new_argv->dn_list) {
+		if (ctf_type_cmp(old_argv->dn_ctfp, old_argv->dn_type,
+		    new_argv->dn_ctfp, new_argv->dn_type) == 0)
+			continue;
+
+		dnerror(pnp, D_PROV_INCOMPAT,
+		    "probe %s:%s %s prototype argument #%u mismatch:\n"
+		    "\t current: %s\n\tprevious: %s\n",
+		    pvp->pv_desc.dtvd_name, prp->pr_ident->di_name, kind, i + 1,
+		    dt_node_type_name(new_argv, n1, sizeof (n1)),
+		    dt_node_type_name(old_argv, n2, sizeof (n2)));
+	}
+}
+
+/*
+ * Compare a new probe declaration with an existing probe definition (either
+ * from a previous declaration or cached from the kernel).  If the existing
+ * definition and declaration both have an input and output parameter list,
+ * compare both lists.  Otherwise compare only the output parameter lists.
+ */
+static void
+dt_node_provider_cmp(dt_provider_t *pvp, dt_node_t *pnp,
+    dt_probe_t *old, dt_probe_t *new)
+{
+	dt_node_provider_cmp_argv(pvp, pnp, "output",
+	    old->pr_xargc, old->pr_xargs, new->pr_xargc, new->pr_xargs);
+
+	if (old->pr_nargs != old->pr_xargs && new->pr_nargs != new->pr_xargs) {
+		dt_node_provider_cmp_argv(pvp, pnp, "input",
+		    old->pr_nargc, old->pr_nargs, new->pr_nargc, new->pr_nargs);
+	}
+
+	if (old->pr_nargs == old->pr_xargs && new->pr_nargs != new->pr_xargs) {
+		if (pvp->pv_flags & DT_PROVIDER_IMPL) {
+			dnerror(pnp, D_PROV_INCOMPAT,
+			    "provider interface mismatch: %s\n"
+			    "\t current: probe %s:%s has an output prototype\n"
+			    "\tprevious: probe %s:%s has no output prototype\n",
+			    pvp->pv_desc.dtvd_name, pvp->pv_desc.dtvd_name,
+			    new->pr_ident->di_name, pvp->pv_desc.dtvd_name,
+			    old->pr_ident->di_name);
+		}
+
+		if (old->pr_ident->di_gen == yypcb->pcb_hdl->dt_gen)
+			old->pr_ident->di_flags |= DT_IDFLG_ORPHAN;
+
+		dt_idhash_delete(pvp->pv_probes, old->pr_ident);
+		dt_probe_declare(pvp, new);
+	}
+}
+
+static void
+dt_cook_probe(dt_node_t *dnp, dt_provider_t *pvp)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_probe_t *prp = dnp->dn_ident->di_data;
+
+	dt_xlator_t *dxp;
+	uint_t i;
+
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	if (prp->pr_nargs == prp->pr_xargs)
+		return;
+
+	for (i = 0; i < prp->pr_xargc; i++) {
+		dt_node_t *xnp = prp->pr_xargv[i];
+		dt_node_t *nnp = prp->pr_nargv[prp->pr_mapping[i]];
+
+		if ((dxp = dt_xlator_lookup(dtp,
+		    nnp, xnp, DT_XLATE_FUZZY)) != NULL) {
+			if (dt_provider_xref(dtp, pvp, dxp->dx_id) != 0)
+				longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+			continue;
+		}
+
+		if (dt_node_is_argcompat(nnp, xnp))
+			continue; /* no translator defined and none required */
+
+		dnerror(dnp, D_PROV_PRXLATOR, "translator for %s:%s output "
+		    "argument #%u from %s to %s is not defined\n",
+		    pvp->pv_desc.dtvd_name, dnp->dn_ident->di_name, i + 1,
+		    dt_node_type_name(nnp, n1, sizeof (n1)),
+		    dt_node_type_name(xnp, n2, sizeof (n2)));
+	}
+}
+
+/*ARGSUSED*/
+static dt_node_t *
+dt_cook_provider(dt_node_t *dnp, uint_t idflags)
+{
+	dt_provider_t *pvp = dnp->dn_provider;
+	dt_node_t *pnp;
+
+	/*
+	 * If we're declaring a provider for the first time and it is unknown
+	 * to dtrace(7D), insert the probe definitions into the provider's hash.
+	 * If we're redeclaring a known provider, verify the interface matches.
+	 */
+	for (pnp = dnp->dn_probes; pnp != NULL; pnp = pnp->dn_list) {
+		const char *probename = pnp->dn_ident->di_name;
+		dt_probe_t *prp = dt_probe_lookup(pvp, probename);
+
+		assert(pnp->dn_kind == DT_NODE_PROBE);
+
+		if (prp != NULL && dnp->dn_provred) {
+			dt_node_provider_cmp(pvp, pnp,
+			    prp, pnp->dn_ident->di_data);
+		} else if (prp == NULL && dnp->dn_provred) {
+			dnerror(pnp, D_PROV_INCOMPAT,
+			    "provider interface mismatch: %s\n"
+			    "\t current: probe %s:%s defined\n"
+			    "\tprevious: probe %s:%s not defined\n",
+			    dnp->dn_provname, dnp->dn_provname,
+			    probename, dnp->dn_provname, probename);
+		} else if (prp != NULL) {
+			dnerror(pnp, D_PROV_PRDUP, "probe redeclared: %s:%s\n",
+			    dnp->dn_provname, probename);
+		} else
+			dt_probe_declare(pvp, pnp->dn_ident->di_data);
+
+		dt_cook_probe(pnp, pvp);
+	}
+
+	return (dnp);
+}
+
+/*ARGSUSED*/
+static dt_node_t *
+dt_cook_none(dt_node_t *dnp, uint_t idflags)
+{
+	return (dnp);
+}
+
+static dt_node_t *(*dt_cook_funcs[])(dt_node_t *, uint_t) = {
+	dt_cook_none,		/* DT_NODE_FREE */
+	dt_cook_none,		/* DT_NODE_INT */
+	dt_cook_none,		/* DT_NODE_STRING */
+	dt_cook_ident,		/* DT_NODE_IDENT */
+	dt_cook_var,		/* DT_NODE_VAR */
+	dt_cook_none,		/* DT_NODE_SYM */
+	dt_cook_none,		/* DT_NODE_TYPE */
+	dt_cook_func,		/* DT_NODE_FUNC */
+	dt_cook_op1,		/* DT_NODE_OP1 */
+	dt_cook_op2,		/* DT_NODE_OP2 */
+	dt_cook_op3,		/* DT_NODE_OP3 */
+	dt_cook_statement,	/* DT_NODE_DEXPR */
+	dt_cook_statement,	/* DT_NODE_DFUNC */
+	dt_cook_aggregation,	/* DT_NODE_AGG */
+	dt_cook_none,		/* DT_NODE_PDESC */
+	dt_cook_clause,		/* DT_NODE_CLAUSE */
+	dt_cook_inline,		/* DT_NODE_INLINE */
+	dt_cook_member,		/* DT_NODE_MEMBER */
+	dt_cook_xlator,		/* DT_NODE_XLATOR */
+	dt_cook_none,		/* DT_NODE_PROBE */
+	dt_cook_provider,	/* DT_NODE_PROVIDER */
+	dt_cook_none		/* DT_NODE_PROG */
+};
+
+/*
+ * Recursively cook the parse tree starting at the specified node.  The idflags
+ * parameter is used to indicate the type of reference (r/w) and is applied to
+ * the resulting identifier if it is a D variable or D aggregation.
+ */
+dt_node_t *
+dt_node_cook(dt_node_t *dnp, uint_t idflags)
+{
+	int oldlineno = yylineno;
+
+	yylineno = dnp->dn_line;
+
+	dnp = dt_cook_funcs[dnp->dn_kind](dnp, idflags);
+	dnp->dn_flags |= DT_NF_COOKED;
+
+	if (dnp->dn_kind == DT_NODE_VAR || dnp->dn_kind == DT_NODE_AGG)
+		dnp->dn_ident->di_flags |= idflags;
+
+	yylineno = oldlineno;
+	return (dnp);
+}
+
+dtrace_attribute_t
+dt_node_list_cook(dt_node_t **pnp, uint_t idflags)
+{
+	dtrace_attribute_t attr = _dtrace_defattr;
+	dt_node_t *dnp, *nnp;
+
+	for (dnp = (pnp != NULL ? *pnp : NULL); dnp != NULL; dnp = nnp) {
+		nnp = dnp->dn_list;
+		dnp = *pnp = dt_node_cook(dnp, idflags);
+		attr = dt_attr_min(attr, dnp->dn_attr);
+		dnp->dn_list = nnp;
+		pnp = &dnp->dn_list;
+	}
+
+	return (attr);
+}
+
+void
+dt_node_list_free(dt_node_t **pnp)
+{
+	dt_node_t *dnp, *nnp;
+
+	for (dnp = (pnp != NULL ? *pnp : NULL); dnp != NULL; dnp = nnp) {
+		nnp = dnp->dn_list;
+		dt_node_free(dnp);
+	}
+
+	if (pnp != NULL)
+		*pnp = NULL;
+}
+
+void
+dt_node_link_free(dt_node_t **pnp)
+{
+	dt_node_t *dnp, *nnp;
+
+	for (dnp = (pnp != NULL ? *pnp : NULL); dnp != NULL; dnp = nnp) {
+		nnp = dnp->dn_link;
+		dt_node_free(dnp);
+	}
+
+	for (dnp = (pnp != NULL ? *pnp : NULL); dnp != NULL; dnp = nnp) {
+		nnp = dnp->dn_link;
+		free(dnp);
+	}
+
+	if (pnp != NULL)
+		*pnp = NULL;
+}
+
+dt_node_t *
+dt_node_link(dt_node_t *lp, dt_node_t *rp)
+{
+	dt_node_t *dnp;
+
+	if (lp == NULL)
+		return (rp);
+	else if (rp == NULL)
+		return (lp);
+
+	for (dnp = lp; dnp->dn_list != NULL; dnp = dnp->dn_list)
+		continue;
+
+	dnp->dn_list = rp;
+	return (lp);
+}
+
+/*
+ * Compute the DOF dtrace_diftype_t representation of a node's type.  This is
+ * called from a variety of places in the library so it cannot assume yypcb
+ * is valid: any references to handle-specific data must be made through 'dtp'.
+ */
+void
+dt_node_diftype(dtrace_hdl_t *dtp, const dt_node_t *dnp, dtrace_diftype_t *tp)
+{
+	if (dnp->dn_ctfp == DT_STR_CTFP(dtp) &&
+	    dnp->dn_type == DT_STR_TYPE(dtp)) {
+		tp->dtdt_kind = DIF_TYPE_STRING;
+		tp->dtdt_ckind = CTF_K_UNKNOWN;
+	} else {
+		tp->dtdt_kind = DIF_TYPE_CTF;
+		tp->dtdt_ckind = ctf_type_kind(dnp->dn_ctfp,
+		    ctf_type_resolve(dnp->dn_ctfp, dnp->dn_type));
+	}
+
+	tp->dtdt_flags = (dnp->dn_flags & DT_NF_REF) ? DIF_TF_BYREF : 0;
+	tp->dtdt_pad = 0;
+	tp->dtdt_size = ctf_type_size(dnp->dn_ctfp, dnp->dn_type);
+}
+
+void
+dt_node_printr(dt_node_t *dnp, FILE *fp, int depth)
+{
+	char n[DT_TYPE_NAMELEN], buf[BUFSIZ], a[8];
+	const dtrace_syminfo_t *dts;
+	const dt_idnode_t *inp;
+	dt_node_t *arg;
+
+	(void) fprintf(fp, "%*s", depth * 2, "");
+	(void) dt_attr_str(dnp->dn_attr, a, sizeof (a));
+
+	if (dnp->dn_ctfp != NULL && dnp->dn_type != CTF_ERR &&
+	    ctf_type_name(dnp->dn_ctfp, dnp->dn_type, n, sizeof (n)) != NULL) {
+		(void) snprintf(buf, BUFSIZ, "type=<%s> attr=%s flags=", n, a);
+	} else {
+		(void) snprintf(buf, BUFSIZ, "type=<%ld> attr=%s flags=",
+		    dnp->dn_type, a);
+	}
+
+	if (dnp->dn_flags != 0) {
+		n[0] = '\0';
+		if (dnp->dn_flags & DT_NF_SIGNED)
+			(void) strcat(n, ",SIGN");
+		if (dnp->dn_flags & DT_NF_COOKED)
+			(void) strcat(n, ",COOK");
+		if (dnp->dn_flags & DT_NF_REF)
+			(void) strcat(n, ",REF");
+		if (dnp->dn_flags & DT_NF_LVALUE)
+			(void) strcat(n, ",LVAL");
+		if (dnp->dn_flags & DT_NF_WRITABLE)
+			(void) strcat(n, ",WRITE");
+		if (dnp->dn_flags & DT_NF_BITFIELD)
+			(void) strcat(n, ",BITF");
+		if (dnp->dn_flags & DT_NF_USERLAND)
+			(void) strcat(n, ",USER");
+		(void) strcat(buf, n + 1);
+	} else
+		(void) strcat(buf, "0");
+
+	switch (dnp->dn_kind) {
+	case DT_NODE_FREE:
+		(void) fprintf(fp, "FREE <node %p>\n", (void *)dnp);
+		break;
+
+	case DT_NODE_INT:
+		(void) fprintf(fp, "INT 0x%llx (%s)\n",
+		    (u_longlong_t)dnp->dn_value, buf);
+		break;
+
+	case DT_NODE_STRING:
+		(void) fprintf(fp, "STRING \"%s\" (%s)\n", dnp->dn_string, buf);
+		break;
+
+	case DT_NODE_IDENT:
+		(void) fprintf(fp, "IDENT %s (%s)\n", dnp->dn_string, buf);
+		break;
+
+	case DT_NODE_VAR:
+		(void) fprintf(fp, "VARIABLE %s%s (%s)\n",
+		    (dnp->dn_ident->di_flags & DT_IDFLG_LOCAL) ? "this->" :
+		    (dnp->dn_ident->di_flags & DT_IDFLG_TLS) ? "self->" : "",
+		    dnp->dn_ident->di_name, buf);
+
+		if (dnp->dn_args != NULL)
+			(void) fprintf(fp, "%*s[\n", depth * 2, "");
+
+		for (arg = dnp->dn_args; arg != NULL; arg = arg->dn_list) {
+			dt_node_printr(arg, fp, depth + 1);
+			if (arg->dn_list != NULL)
+				(void) fprintf(fp, "%*s,\n", depth * 2, "");
+		}
+
+		if (dnp->dn_args != NULL)
+			(void) fprintf(fp, "%*s]\n", depth * 2, "");
+		break;
+
+	case DT_NODE_SYM:
+		dts = dnp->dn_ident->di_data;
+		(void) fprintf(fp, "SYMBOL %s`%s (%s)\n",
+		    dts->dts_object, dts->dts_name, buf);
+		break;
+
+	case DT_NODE_TYPE:
+		if (dnp->dn_string != NULL) {
+			(void) fprintf(fp, "TYPE (%s) %s\n",
+			    buf, dnp->dn_string);
+		} else
+			(void) fprintf(fp, "TYPE (%s)\n", buf);
+		break;
+
+	case DT_NODE_FUNC:
+		(void) fprintf(fp, "FUNC %s (%s)\n",
+		    dnp->dn_ident->di_name, buf);
+
+		for (arg = dnp->dn_args; arg != NULL; arg = arg->dn_list) {
+			dt_node_printr(arg, fp, depth + 1);
+			if (arg->dn_list != NULL)
+				(void) fprintf(fp, "%*s,\n", depth * 2, "");
+		}
+		break;
+
+	case DT_NODE_OP1:
+		(void) fprintf(fp, "OP1 %s (%s)\n", opstr(dnp->dn_op), buf);
+		dt_node_printr(dnp->dn_child, fp, depth + 1);
+		break;
+
+	case DT_NODE_OP2:
+		(void) fprintf(fp, "OP2 %s (%s)\n", opstr(dnp->dn_op), buf);
+		dt_node_printr(dnp->dn_left, fp, depth + 1);
+		dt_node_printr(dnp->dn_right, fp, depth + 1);
+		break;
+
+	case DT_NODE_OP3:
+		(void) fprintf(fp, "OP3 (%s)\n", buf);
+		dt_node_printr(dnp->dn_expr, fp, depth + 1);
+		(void) fprintf(fp, "%*s?\n", depth * 2, "");
+		dt_node_printr(dnp->dn_left, fp, depth + 1);
+		(void) fprintf(fp, "%*s:\n", depth * 2, "");
+		dt_node_printr(dnp->dn_right, fp, depth + 1);
+		break;
+
+	case DT_NODE_DEXPR:
+	case DT_NODE_DFUNC:
+		(void) fprintf(fp, "D EXPRESSION attr=%s\n", a);
+		dt_node_printr(dnp->dn_expr, fp, depth + 1);
+		break;
+
+	case DT_NODE_AGG:
+		(void) fprintf(fp, "AGGREGATE @%s attr=%s [\n",
+		    dnp->dn_ident->di_name, a);
+
+		for (arg = dnp->dn_aggtup; arg != NULL; arg = arg->dn_list) {
+			dt_node_printr(arg, fp, depth + 1);
+			if (arg->dn_list != NULL)
+				(void) fprintf(fp, "%*s,\n", depth * 2, "");
+		}
+
+		if (dnp->dn_aggfun) {
+			(void) fprintf(fp, "%*s] = ", depth * 2, "");
+			dt_node_printr(dnp->dn_aggfun, fp, depth + 1);
+		} else
+			(void) fprintf(fp, "%*s]\n", depth * 2, "");
+
+		if (dnp->dn_aggfun)
+			(void) fprintf(fp, "%*s)\n", depth * 2, "");
+		break;
+
+	case DT_NODE_PDESC:
+		(void) fprintf(fp, "PDESC %s:%s:%s:%s [%u]\n",
+		    dnp->dn_desc->dtpd_provider, dnp->dn_desc->dtpd_mod,
+		    dnp->dn_desc->dtpd_func, dnp->dn_desc->dtpd_name,
+		    dnp->dn_desc->dtpd_id);
+		break;
+
+	case DT_NODE_CLAUSE:
+		(void) fprintf(fp, "CLAUSE attr=%s\n", a);
+
+		for (arg = dnp->dn_pdescs; arg != NULL; arg = arg->dn_list)
+			dt_node_printr(arg, fp, depth + 1);
+
+		(void) fprintf(fp, "%*sCTXATTR %s\n", depth * 2, "",
+		    dt_attr_str(dnp->dn_ctxattr, a, sizeof (a)));
+
+		if (dnp->dn_pred != NULL) {
+			(void) fprintf(fp, "%*sPREDICATE /\n", depth * 2, "");
+			dt_node_printr(dnp->dn_pred, fp, depth + 1);
+			(void) fprintf(fp, "%*s/\n", depth * 2, "");
+		}
+
+		for (arg = dnp->dn_acts; arg != NULL; arg = arg->dn_list)
+			dt_node_printr(arg, fp, depth + 1);
+		break;
+
+	case DT_NODE_INLINE:
+		inp = dnp->dn_ident->di_iarg;
+
+		(void) fprintf(fp, "INLINE %s (%s)\n",
+		    dnp->dn_ident->di_name, buf);
+		dt_node_printr(inp->din_root, fp, depth + 1);
+		break;
+
+	case DT_NODE_MEMBER:
+		(void) fprintf(fp, "MEMBER %s (%s)\n", dnp->dn_membname, buf);
+		if (dnp->dn_membexpr)
+			dt_node_printr(dnp->dn_membexpr, fp, depth + 1);
+		break;
+
+	case DT_NODE_XLATOR:
+		(void) fprintf(fp, "XLATOR (%s)", buf);
+
+		if (ctf_type_name(dnp->dn_xlator->dx_src_ctfp,
+		    dnp->dn_xlator->dx_src_type, n, sizeof (n)) != NULL)
+			(void) fprintf(fp, " from <%s>", n);
+
+		if (ctf_type_name(dnp->dn_xlator->dx_dst_ctfp,
+		    dnp->dn_xlator->dx_dst_type, n, sizeof (n)) != NULL)
+			(void) fprintf(fp, " to <%s>", n);
+
+		(void) fprintf(fp, "\n");
+
+		for (arg = dnp->dn_members; arg != NULL; arg = arg->dn_list)
+			dt_node_printr(arg, fp, depth + 1);
+		break;
+
+	case DT_NODE_PROBE:
+		(void) fprintf(fp, "PROBE %s\n", dnp->dn_ident->di_name);
+		break;
+
+	case DT_NODE_PROVIDER:
+		(void) fprintf(fp, "PROVIDER %s (%s)\n",
+		    dnp->dn_provname, dnp->dn_provred ? "redecl" : "decl");
+		for (arg = dnp->dn_probes; arg != NULL; arg = arg->dn_list)
+			dt_node_printr(arg, fp, depth + 1);
+		break;
+
+	case DT_NODE_PROG:
+		(void) fprintf(fp, "PROGRAM attr=%s\n", a);
+		for (arg = dnp->dn_list; arg != NULL; arg = arg->dn_list)
+			dt_node_printr(arg, fp, depth + 1);
+		break;
+
+	default:
+		(void) fprintf(fp, "<bad node %p, kind %d>\n",
+		    (void *)dnp, dnp->dn_kind);
+	}
+}
+
+int
+dt_node_root(dt_node_t *dnp)
+{
+	yypcb->pcb_root = dnp;
+	return (0);
+}
+
+/*PRINTFLIKE3*/
+void
+dnerror(const dt_node_t *dnp, dt_errtag_t tag, const char *format, ...)
+{
+	int oldlineno = yylineno;
+	va_list ap;
+
+	yylineno = dnp->dn_line;
+
+	va_start(ap, format);
+	xyvwarn(tag, format, ap);
+	va_end(ap);
+
+	yylineno = oldlineno;
+	longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+}
+
+/*PRINTFLIKE3*/
+void
+dnwarn(const dt_node_t *dnp, dt_errtag_t tag, const char *format, ...)
+{
+	int oldlineno = yylineno;
+	va_list ap;
+
+	yylineno = dnp->dn_line;
+
+	va_start(ap, format);
+	xyvwarn(tag, format, ap);
+	va_end(ap);
+
+	yylineno = oldlineno;
+}
+
+/*PRINTFLIKE2*/
+void
+xyerror(dt_errtag_t tag, const char *format, ...)
+{
+	va_list ap;
+
+	va_start(ap, format);
+	xyvwarn(tag, format, ap);
+	va_end(ap);
+
+	longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+}
+
+/*PRINTFLIKE2*/
+void
+xywarn(dt_errtag_t tag, const char *format, ...)
+{
+	va_list ap;
+
+	va_start(ap, format);
+	xyvwarn(tag, format, ap);
+	va_end(ap);
+}
+
+void
+xyvwarn(dt_errtag_t tag, const char *format, va_list ap)
+{
+	if (yypcb == NULL)
+		return; /* compiler is not currently active: act as a no-op */
+
+	dt_set_errmsg(yypcb->pcb_hdl, dt_errtag(tag), yypcb->pcb_region,
+	    yypcb->pcb_filetag, yypcb->pcb_fileptr ? yylineno : 0, format, ap);
+}
+
+/*PRINTFLIKE1*/
+void
+yyerror(const char *format, ...)
+{
+	va_list ap;
+
+	va_start(ap, format);
+	yyvwarn(format, ap);
+	va_end(ap);
+
+	longjmp(yypcb->pcb_jmpbuf, EDT_COMPILER);
+}
+
+/*PRINTFLIKE1*/
+void
+yywarn(const char *format, ...)
+{
+	va_list ap;
+
+	va_start(ap, format);
+	yyvwarn(format, ap);
+	va_end(ap);
+}
+
+void
+yyvwarn(const char *format, va_list ap)
+{
+	if (yypcb == NULL)
+		return; /* compiler is not currently active: act as a no-op */
+
+	dt_set_errmsg(yypcb->pcb_hdl, dt_errtag(D_SYNTAX), yypcb->pcb_region,
+	    yypcb->pcb_filetag, yypcb->pcb_fileptr ? yylineno : 0, format, ap);
+
+	if (strchr(format, '\n') == NULL) {
+		dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+		size_t len = strlen(dtp->dt_errmsg);
+		char *p, *s = dtp->dt_errmsg + len;
+		size_t n = sizeof (dtp->dt_errmsg) - len;
+
+		if (yytext[0] == '\0')
+			(void) snprintf(s, n, " near end of input");
+		else if (yytext[0] == '\n')
+			(void) snprintf(s, n, " near end of line");
+		else {
+			if ((p = strchr(yytext, '\n')) != NULL)
+				*p = '\0'; /* crop at newline */
+			(void) snprintf(s, n, " near \"%s\"", yytext);
+		}
+	}
+}
+
+void
+yylabel(const char *label)
+{
+	dt_dprintf("set label to <%s>\n", label ? label : "NULL");
+	yypcb->pcb_region = label;
+}
+
+int
+yywrap(void)
+{
+	return (1); /* indicate that lex should return a zero token for EOF */
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_parser.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_parser.h
new file mode 100644
index 0000000..54659de
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_parser.h
@@ -0,0 +1,290 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_PARSER_H
+#define	_DT_PARSER_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#include <sys/dtrace.h>
+
+#include <libctf.h>
+#include <stdarg.h>
+#include <stdio.h>
+#else  /* VBOX */
+# include <sys/dtrace.h>
+# include <stdio.h>
+#endif /* VBOX */
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#include <dt_errtags.h>
+#include <dt_ident.h>
+#include <dt_decl.h>
+#include <dt_xlator.h>
+#include <dt_list.h>
+
+typedef struct dt_node {
+	ctf_file_t *dn_ctfp;	/* CTF type container for node's type */
+	ctf_id_t dn_type;	/* CTF type reference for node's type */
+	uchar_t dn_kind;	/* node kind (DT_NODE_*, defined below) */
+	uchar_t dn_flags;	/* node flags (DT_NF_*, defined below) */
+	ushort_t dn_op;		/* operator (DT_TOK_*, defined by lex) */
+	int dn_line;		/* line number for error messages */
+	int dn_reg;		/* register allocated by cg */
+	dtrace_attribute_t dn_attr; /* node stability attributes */
+
+	/*
+	 * D compiler nodes, as is the usual style, contain a union of the
+	 * different sub-elements required by the various kinds of nodes.
+	 * These sub-elements are accessed using the macros defined below.
+	 */
+	union {
+		struct {
+			uintmax_t _value;	/* integer value */
+			char *_string;		/* string value */
+		} _const;
+
+		struct {
+			dt_ident_t *_ident;	/* identifier reference */
+			struct dt_node *_links[3]; /* child node pointers */
+		} _nodes;
+
+		struct {
+			struct dt_node *_descs;	/* list of descriptions */
+			struct dt_node *_pred;	/* predicate expression */
+			struct dt_node *_acts;	/* action statement list */
+			dt_idhash_t *_locals;	/* local variable hash */
+			dtrace_attribute_t _attr; /* context attributes */
+		} _clause;
+
+		struct {
+			char *_spec;		/* specifier string (if any) */
+			dtrace_probedesc_t *_desc; /* final probe description */
+		} _pdesc;
+
+		struct {
+			char *_name;		/* string name of member */
+			struct dt_node *_expr;	/* expression node pointer */
+			dt_xlator_t *_xlator;	/* translator reference */
+			uint_t _id;		/* member identifier */
+		} _member;
+
+		struct {
+			dt_xlator_t *_xlator;	/* translator reference */
+			struct dt_node *_xmemb;	/* individual xlator member */
+			struct dt_node *_membs;	/* list of member nodes */
+		} _xlator;
+
+		struct {
+			char *_name;		/* string name of provider */
+			struct dt_provider *_pvp; /* provider references */
+			struct dt_node *_probes;  /* list of probe nodes */
+			int _redecl;		/* provider redeclared */
+		} _provider;
+	} dn_u;
+
+	struct dt_node *dn_list; /* parse tree list link */
+	struct dt_node *dn_link; /* allocation list link */
+} dt_node_t;
+
+#define	dn_value	dn_u._const._value	/* DT_NODE_INT */
+#define	dn_string	dn_u._const._string	/* STRING, IDENT, TYPE */
+#define	dn_ident	dn_u._nodes._ident	/* VAR,SYM,FUN,AGG,INL,PROBE */
+#define	dn_args		dn_u._nodes._links[0]	/* DT_NODE_VAR, FUNC */
+#define	dn_child	dn_u._nodes._links[0]	/* DT_NODE_OP1 */
+#define	dn_left		dn_u._nodes._links[0]	/* DT_NODE_OP2, OP3 */
+#define	dn_right	dn_u._nodes._links[1]	/* DT_NODE_OP2, OP3 */
+#define	dn_expr		dn_u._nodes._links[2]	/* DT_NODE_OP3, DEXPR */
+#define	dn_aggfun	dn_u._nodes._links[0]	/* DT_NODE_AGG */
+#define	dn_aggtup	dn_u._nodes._links[1]	/* DT_NODE_AGG */
+#define	dn_pdescs	dn_u._clause._descs	/* DT_NODE_CLAUSE */
+#define	dn_pred		dn_u._clause._pred	/* DT_NODE_CLAUSE */
+#define	dn_acts		dn_u._clause._acts	/* DT_NODE_CLAUSE */
+#define	dn_locals	dn_u._clause._locals	/* DT_NODE_CLAUSE */
+#define	dn_ctxattr	dn_u._clause._attr	/* DT_NODE_CLAUSE */
+#define	dn_spec		dn_u._pdesc._spec	/* DT_NODE_PDESC */
+#define	dn_desc		dn_u._pdesc._desc	/* DT_NODE_PDESC */
+#define	dn_membname	dn_u._member._name	/* DT_NODE_MEMBER */
+#define	dn_membexpr	dn_u._member._expr	/* DT_NODE_MEMBER */
+#define	dn_membxlator	dn_u._member._xlator	/* DT_NODE_MEMBER */
+#define	dn_membid	dn_u._member._id	/* DT_NODE_MEMBER */
+#define	dn_xlator	dn_u._xlator._xlator	/* DT_NODE_XLATOR */
+#define	dn_xmember	dn_u._xlator._xmemb	/* DT_NODE_XLATOR */
+#define	dn_members	dn_u._xlator._membs	/* DT_NODE_XLATOR */
+#define	dn_provname	dn_u._provider._name	/* DT_NODE_PROVIDER */
+#define	dn_provider	dn_u._provider._pvp	/* DT_NODE_PROVIDER */
+#define	dn_provred	dn_u._provider._redecl	/* DT_NODE_PROVIDER */
+#define	dn_probes	dn_u._provider._probes	/* DT_NODE_PROVIDER */
+
+#define	DT_NODE_FREE	0	/* unused node (waiting to be freed) */
+#define	DT_NODE_INT	1	/* integer value */
+#define	DT_NODE_STRING	2	/* string value */
+#define	DT_NODE_IDENT	3	/* identifier */
+#define	DT_NODE_VAR	4	/* variable reference */
+#define	DT_NODE_SYM	5	/* symbol reference */
+#define	DT_NODE_TYPE	6	/* type reference or formal parameter */
+#define	DT_NODE_FUNC	7	/* function call */
+#define	DT_NODE_OP1	8	/* unary operator */
+#define	DT_NODE_OP2	9	/* binary operator */
+#define	DT_NODE_OP3	10	/* ternary operator */
+#define	DT_NODE_DEXPR	11	/* D expression action */
+#define	DT_NODE_DFUNC	12	/* D function action */
+#define	DT_NODE_AGG	13	/* aggregation */
+#define	DT_NODE_PDESC	14	/* probe description */
+#define	DT_NODE_CLAUSE	15	/* clause definition */
+#define	DT_NODE_INLINE	16	/* inline definition */
+#define	DT_NODE_MEMBER	17	/* member definition */
+#define	DT_NODE_XLATOR	18	/* translator definition */
+#define	DT_NODE_PROBE	19	/* probe definition */
+#define	DT_NODE_PROVIDER 20	/* provider definition */
+#define	DT_NODE_PROG	21	/* program translation unit */
+
+#define	DT_NF_SIGNED	0x01	/* data is a signed quantity (else unsigned) */
+#define	DT_NF_COOKED	0x02	/* data is a known type (else still cooking) */
+#define	DT_NF_REF	0x04	/* pass by reference (array, struct, union) */
+#define	DT_NF_LVALUE	0x08	/* node is an l-value according to ANSI-C */
+#define	DT_NF_WRITABLE	0x10	/* node is writable (can be modified) */
+#define	DT_NF_BITFIELD	0x20	/* node is an integer bitfield */
+#define	DT_NF_USERLAND	0x40	/* data is a userland address */
+
+#define	DT_TYPE_NAMELEN	128	/* reasonable size for ctf_type_name() */
+
+extern int dt_node_is_integer(const dt_node_t *);
+extern int dt_node_is_float(const dt_node_t *);
+extern int dt_node_is_scalar(const dt_node_t *);
+extern int dt_node_is_arith(const dt_node_t *);
+extern int dt_node_is_vfptr(const dt_node_t *);
+extern int dt_node_is_dynamic(const dt_node_t *);
+extern int dt_node_is_stack(const dt_node_t *);
+extern int dt_node_is_symaddr(const dt_node_t *);
+extern int dt_node_is_usymaddr(const dt_node_t *);
+extern int dt_node_is_string(const dt_node_t *);
+extern int dt_node_is_strcompat(const dt_node_t *);
+extern int dt_node_is_pointer(const dt_node_t *);
+extern int dt_node_is_void(const dt_node_t *);
+extern int dt_node_is_ptrcompat(const dt_node_t *, const dt_node_t *,
+	ctf_file_t **, ctf_id_t *);
+extern int dt_node_is_argcompat(const dt_node_t *, const dt_node_t *);
+extern int dt_node_is_posconst(const dt_node_t *);
+extern int dt_node_is_actfunc(const dt_node_t *);
+
+extern dt_node_t *dt_node_int(uintmax_t);
+extern dt_node_t *dt_node_string(char *);
+extern dt_node_t *dt_node_ident(char *);
+extern dt_node_t *dt_node_type(dt_decl_t *);
+extern dt_node_t *dt_node_vatype(void);
+extern dt_node_t *dt_node_decl(void);
+extern dt_node_t *dt_node_func(dt_node_t *, dt_node_t *);
+extern dt_node_t *dt_node_offsetof(dt_decl_t *, char *);
+extern dt_node_t *dt_node_op1(int, dt_node_t *);
+extern dt_node_t *dt_node_op2(int, dt_node_t *, dt_node_t *);
+extern dt_node_t *dt_node_op3(dt_node_t *, dt_node_t *, dt_node_t *);
+extern dt_node_t *dt_node_statement(dt_node_t *);
+extern dt_node_t *dt_node_pdesc_by_name(char *);
+extern dt_node_t *dt_node_pdesc_by_id(uintmax_t);
+extern dt_node_t *dt_node_clause(dt_node_t *, dt_node_t *, dt_node_t *);
+extern dt_node_t *dt_node_inline(dt_node_t *);
+extern dt_node_t *dt_node_member(dt_decl_t *, char *, dt_node_t *);
+extern dt_node_t *dt_node_xlator(dt_decl_t *, dt_decl_t *, char *, dt_node_t *);
+extern dt_node_t *dt_node_probe(char *, int, dt_node_t *, dt_node_t *);
+extern dt_node_t *dt_node_provider(char *, dt_node_t *);
+extern dt_node_t *dt_node_program(dt_node_t *);
+
+extern dt_node_t *dt_node_link(dt_node_t *, dt_node_t *);
+extern dt_node_t *dt_node_cook(dt_node_t *, uint_t);
+
+extern dt_node_t *dt_node_xalloc(dtrace_hdl_t *, int);
+extern void dt_node_free(dt_node_t *);
+
+extern dtrace_attribute_t dt_node_list_cook(dt_node_t **, uint_t);
+extern void dt_node_list_free(dt_node_t **);
+extern void dt_node_link_free(dt_node_t **);
+
+extern void dt_node_attr_assign(dt_node_t *, dtrace_attribute_t);
+extern void dt_node_type_assign(dt_node_t *, ctf_file_t *, ctf_id_t);
+extern void dt_node_type_propagate(const dt_node_t *, dt_node_t *);
+extern const char *dt_node_type_name(const dt_node_t *, char *, size_t);
+extern size_t dt_node_type_size(const dt_node_t *);
+
+extern dt_ident_t *dt_node_resolve(const dt_node_t *, uint_t);
+extern size_t dt_node_sizeof(const dt_node_t *);
+extern void dt_node_promote(dt_node_t *, dt_node_t *, dt_node_t *);
+
+extern void dt_node_diftype(dtrace_hdl_t *,
+    const dt_node_t *, dtrace_diftype_t *);
+extern void dt_node_printr(dt_node_t *, FILE *, int);
+extern const char *dt_node_name(const dt_node_t *, char *, size_t);
+extern int dt_node_root(dt_node_t *);
+
+struct dtrace_typeinfo;	/* see <dtrace.h> */
+struct dt_pcb;		/* see <dt_impl.h> */
+
+#define	IS_CHAR(e) \
+	(((e).cte_format & (CTF_INT_CHAR | CTF_INT_SIGNED)) == \
+	(CTF_INT_CHAR | CTF_INT_SIGNED) && (e).cte_bits == NBBY)
+
+#define	IS_VOID(e) \
+	((e).cte_offset == 0 && (e).cte_bits == 0)
+
+extern int dt_type_lookup(const char *, struct dtrace_typeinfo *);
+extern int dt_type_pointer(struct dtrace_typeinfo *);
+extern const char *dt_type_name(ctf_file_t *, ctf_id_t, char *, size_t);
+
+typedef enum {
+	YYS_CLAUSE,	/* lex/yacc state for finding program clauses */
+	YYS_DEFINE,	/* lex/yacc state for parsing persistent definitions */
+	YYS_EXPR,	/* lex/yacc state for parsing D expressions */
+	YYS_DONE,	/* lex/yacc state for indicating parse tree is done */
+	YYS_CONTROL	/* lex/yacc state for parsing control lines */
+} yystate_t;
+
+extern void dnerror(const dt_node_t *, dt_errtag_t, const char *, ...);
+extern void dnwarn(const dt_node_t *, dt_errtag_t, const char *, ...);
+
+extern void xyerror(dt_errtag_t, const char *, ...);
+extern void xywarn(dt_errtag_t, const char *, ...);
+extern void xyvwarn(dt_errtag_t, const char *, va_list);
+
+extern void yyerror(const char *, ...);
+extern void yywarn(const char *, ...);
+extern void yyvwarn(const char *, va_list);
+
+extern void yylabel(const char *);
+extern void yybegin(yystate_t);
+extern void yyinit(struct dt_pcb *);
+
+extern int yyparse(void);
+extern int yyinput(void);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_PARSER_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.c
new file mode 100644
index 0000000..05a99dd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.c
@@ -0,0 +1,193 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+/*
+ * DTrace Parsing Control Block
+ *
+ * A DTrace Parsing Control Block (PCB) contains all of the state that is used
+ * by a single pass of the D compiler, other than the global variables used by
+ * lex and yacc.  The routines in this file are used to set up and tear down
+ * PCBs, which are kept on a stack pointed to by the libdtrace global 'yypcb'.
+ * The main engine of the compiler, dt_compile(), is located in dt_cc.c and is
+ * responsible for calling these routines to begin and end a compilation pass.
+ *
+ * Sun's lex/yacc are not MT-safe or re-entrant, but we permit limited nested
+ * use of dt_compile() once the entire parse tree has been constructed but has
+ * not yet executed the "cooking" pass (see dt_cc.c for more information).  The
+ * PCB design also makes it easier to debug (since all global state is kept in
+ * one place) and could permit us to make the D compiler MT-safe or re-entrant
+ * in the future by adding locks to libdtrace or switching to Flex and Bison.
+ */
+
+#ifndef VBOX
+#include <strings.h>
+#include <stdlib.h>
+#include <assert.h>
+#endif
+
+#include <dt_impl.h>
+#include <dt_program.h>
+#include <dt_provider.h>
+#include <dt_pcb.h>
+
+/*
+ * Initialize the specified PCB by zeroing it and filling in a few default
+ * members, and then pushing it on to the top of the PCB stack and setting
+ * yypcb to point to it.  Increment the current handle's generation count.
+ */
+void
+dt_pcb_push(dtrace_hdl_t *dtp, dt_pcb_t *pcb)
+{
+	/*
+	 * Since lex/yacc are not re-entrant and we don't implement state save,
+	 * assert that if another PCB is active, it is from the same handle and
+	 * has completed execution of yyparse().  If the first assertion fires,
+	 * the caller is calling libdtrace without proper MT locking.  If the
+	 * second assertion fires, dt_compile() is being called recursively
+	 * from an illegal location in libdtrace, or a dt_pcb_pop() is missing.
+	 */
+	if (yypcb != NULL) {
+		assert(yypcb->pcb_hdl == dtp);
+		assert(yypcb->pcb_yystate == YYS_DONE);
+	}
+
+	bzero(pcb, sizeof (dt_pcb_t));
+
+	dt_scope_create(&pcb->pcb_dstack);
+	dt_idstack_push(&pcb->pcb_globals, dtp->dt_globals);
+	dt_irlist_create(&pcb->pcb_ir);
+
+	pcb->pcb_hdl = dtp;
+	pcb->pcb_prev = dtp->dt_pcb;
+
+	dtp->dt_pcb = pcb;
+	dtp->dt_gen++;
+
+#ifndef USING_FLEX /* In case flex starts work too early. Moved to dt_compile. */
+	yyinit(pcb);
+#endif
+}
+
+static int
+dt_pcb_pop_ident(dt_idhash_t *dhp, dt_ident_t *idp, void *arg)
+{
+	dtrace_hdl_t *dtp = arg;
+
+	if (idp->di_gen == dtp->dt_gen)
+		dt_idhash_delete(dhp, idp);
+
+	return (0);
+}
+
+/*
+ * Pop the topmost PCB from the PCB stack and destroy any data structures that
+ * are associated with it.  If 'err' is non-zero, destroy any intermediate
+ * state that is left behind as part of a compilation that has failed.
+ */
+void
+dt_pcb_pop(dtrace_hdl_t *dtp, int err)
+{
+	dt_pcb_t *pcb = yypcb;
+	uint_t i;
+
+	assert(pcb != NULL);
+	assert(pcb == dtp->dt_pcb);
+
+	while (pcb->pcb_dstack.ds_next != NULL)
+		(void) dt_scope_pop();
+
+	dt_scope_destroy(&pcb->pcb_dstack);
+	dt_irlist_destroy(&pcb->pcb_ir);
+
+	dt_node_link_free(&pcb->pcb_list);
+	dt_node_link_free(&pcb->pcb_hold);
+
+	if (err != 0) {
+		dt_xlator_t *dxp, *nxp;
+		dt_provider_t *pvp, *nvp;
+
+		if (pcb->pcb_prog != NULL)
+			dt_program_destroy(dtp, pcb->pcb_prog);
+		if (pcb->pcb_stmt != NULL)
+			dtrace_stmt_destroy(dtp, pcb->pcb_stmt);
+		if (pcb->pcb_ecbdesc != NULL)
+			dt_ecbdesc_release(dtp, pcb->pcb_ecbdesc);
+
+		for (dxp = dt_list_next(&dtp->dt_xlators); dxp; dxp = nxp) {
+			nxp = dt_list_next(dxp);
+			if (dxp->dx_gen == dtp->dt_gen)
+				dt_xlator_destroy(dtp, dxp);
+		}
+
+		for (pvp = dt_list_next(&dtp->dt_provlist); pvp; pvp = nvp) {
+			nvp = dt_list_next(pvp);
+			if (pvp->pv_gen == dtp->dt_gen)
+				dt_provider_destroy(dtp, pvp);
+		}
+
+		(void) dt_idhash_iter(dtp->dt_aggs, dt_pcb_pop_ident, dtp);
+		dt_idhash_update(dtp->dt_aggs);
+
+		(void) dt_idhash_iter(dtp->dt_globals, dt_pcb_pop_ident, dtp);
+		dt_idhash_update(dtp->dt_globals);
+
+		(void) dt_idhash_iter(dtp->dt_tls, dt_pcb_pop_ident, dtp);
+		dt_idhash_update(dtp->dt_tls);
+
+		(void) ctf_discard(dtp->dt_cdefs->dm_ctfp);
+		(void) ctf_discard(dtp->dt_ddefs->dm_ctfp);
+	}
+
+	if (pcb->pcb_pragmas != NULL)
+		dt_idhash_destroy(pcb->pcb_pragmas);
+	if (pcb->pcb_locals != NULL)
+		dt_idhash_destroy(pcb->pcb_locals);
+	if (pcb->pcb_idents != NULL)
+		dt_idhash_destroy(pcb->pcb_idents);
+	if (pcb->pcb_inttab != NULL)
+		dt_inttab_destroy(pcb->pcb_inttab);
+	if (pcb->pcb_strtab != NULL)
+		dt_strtab_destroy(pcb->pcb_strtab);
+	if (pcb->pcb_regs != NULL)
+		dt_regset_destroy(pcb->pcb_regs);
+
+	for (i = 0; i < pcb->pcb_asxreflen; i++)
+		dt_free(dtp, pcb->pcb_asxrefs[i]);
+
+	dt_free(dtp, pcb->pcb_asxrefs);
+	dt_difo_free(dtp, pcb->pcb_difo);
+
+	free(pcb->pcb_filetag);
+	free(pcb->pcb_sflagv);
+
+	dtp->dt_pcb = pcb->pcb_prev;
+	bzero(pcb, sizeof (dt_pcb_t));
+	yyinit(dtp->dt_pcb);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.h
new file mode 100644
index 0000000..04f7308
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pcb.h
@@ -0,0 +1,105 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_PCB_H
+#define	_DT_PCB_H
+
+#ifndef VBOX
+# pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <dtrace.h>
+#include <setjmp.h>
+#include <stdio.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#include <dt_parser.h>
+#include <dt_regset.h>
+#include <dt_inttab.h>
+#include <dt_strtab.h>
+#include <dt_decl.h>
+#include <dt_as.h>
+
+typedef struct dt_pcb {
+	dtrace_hdl_t *pcb_hdl;	/* pointer to library handle */
+	struct dt_pcb *pcb_prev; /* pointer to previous pcb in stack */
+	FILE *pcb_fileptr;	/* pointer to input file (or NULL) */
+	char *pcb_filetag;	/* optional file name string (or NULL) */
+	const char *pcb_string;	/* pointer to input string (or NULL) */
+	const char *pcb_strptr;	/* pointer to input position */
+	size_t pcb_strlen;	/* length of pcb_string */
+	int pcb_sargc;		/* number of script arguments (if any) */
+	char *const *pcb_sargv;	/* script argument strings (if any) */
+	ushort_t *pcb_sflagv;	/* script argument flags (DT_IDFLG_* bits) */
+	dt_scope_t pcb_dstack;	/* declaration processing stack */
+	dt_node_t *pcb_list;	/* list of allocated parse tree nodes */
+	dt_node_t *pcb_hold;	/* parse tree nodes on hold until end of defn */
+	dt_node_t *pcb_root;	/* root of current parse tree */
+	dt_idstack_t pcb_globals; /* stack of global identifier hash tables */
+	dt_idhash_t *pcb_locals; /* current hash table of local identifiers */
+	dt_idhash_t *pcb_idents; /* current hash table of ambiguous idents */
+	dt_idhash_t *pcb_pragmas; /* current hash table of pending pragmas */
+	dt_inttab_t *pcb_inttab; /* integer table for constant references */
+	dt_strtab_t *pcb_strtab; /* string table for string references */
+	dt_regset_t *pcb_regs;	/* register set for code generation */
+	dt_irlist_t pcb_ir;	/* list of unrelocated IR instructions */
+	uint_t pcb_asvidx;	/* assembler vartab index (see dt_as.c) */
+	ulong_t **pcb_asxrefs;	/* assembler imported xlators (see dt_as.c) */
+	uint_t pcb_asxreflen;	/* assembler xlator map length (see dt_as.c) */
+	const dtrace_probedesc_t *pcb_pdesc; /* probedesc for current context */
+	struct dt_probe *pcb_probe; /* probe associated with current context */
+	dtrace_probeinfo_t pcb_pinfo; /* info associated with current context */
+	dtrace_attribute_t pcb_amin; /* stability minimum for compilation */
+	dt_node_t *pcb_dret;	/* node containing return type for assembler */
+	dtrace_difo_t *pcb_difo; /* intermediate DIF object made by assembler */
+	dtrace_prog_t *pcb_prog; /* intermediate program made by compiler */
+	dtrace_stmtdesc_t *pcb_stmt; /* intermediate stmt made by compiler */
+	dtrace_ecbdesc_t *pcb_ecbdesc; /* intermediate ecbdesc made by cmplr */
+	jmp_buf pcb_jmpbuf;	/* setjmp(3C) buffer for error return */
+	const char *pcb_region;	/* optional region name for yyerror() suffix */
+	dtrace_probespec_t pcb_pspec; /* probe description evaluation context */
+	uint_t pcb_cflags;	/* optional compilation flags (see dtrace.h) */
+	uint_t pcb_idepth;	/* preprocessor #include nesting depth */
+	yystate_t pcb_yystate;	/* lex/yacc parsing state (see yybegin()) */
+	int pcb_context;	/* yyparse() rules context (DT_CTX_* value) */
+	int pcb_token;		/* token to be returned by yylex() (if != 0) */
+	int pcb_cstate;		/* state to be restored by lexer at state end */
+	int pcb_braces;		/* number of open curly braces in lexer */
+	int pcb_brackets;	/* number of open square brackets in lexer */
+	int pcb_parens;		/* number of open parentheses in lexer */
+} dt_pcb_t;
+
+extern void dt_pcb_push(dtrace_hdl_t *, dt_pcb_t *);
+extern void dt_pcb_pop(dtrace_hdl_t *, int);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_PCB_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.c
new file mode 100644
index 0000000..2418051
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.c
@@ -0,0 +1,757 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <assert.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <ctype.h>
+#include <alloca.h>
+#include <libgen.h>
+#include <stddef.h>
+
+#include <dt_impl.h>
+#include <dt_program.h>
+#include <dt_pid.h>
+#include <dt_string.h>
+
+typedef struct dt_pid_probe {
+	dtrace_hdl_t *dpp_dtp;
+	dt_pcb_t *dpp_pcb;
+	dt_proc_t *dpp_dpr;
+	struct ps_prochandle *dpp_pr;
+	const char *dpp_mod;
+	char *dpp_func;
+	const char *dpp_name;
+	const char *dpp_obj;
+	uintptr_t dpp_pc;
+	size_t dpp_size;
+	Lmid_t dpp_lmid;
+	uint_t dpp_nmatches;
+	uint64_t dpp_stret[4];
+	GElf_Sym dpp_last;
+	uint_t dpp_last_taken;
+} dt_pid_probe_t;
+
+/*
+ * Compose the lmid and object name into the canonical representation. We
+ * omit the lmid for the default link map for convenience.
+ */
+static void
+dt_pid_objname(char *buf, size_t len, Lmid_t lmid, const char *obj)
+{
+	if (lmid == LM_ID_BASE)
+		(void) strncpy(buf, obj, len);
+	else
+		(void) snprintf(buf, len, "LM%lx`%s", lmid, obj);
+}
+
+static int
+dt_pid_error(dtrace_hdl_t *dtp, dt_pcb_t *pcb, dt_proc_t *dpr,
+    fasttrap_probe_spec_t *ftp, dt_errtag_t tag, const char *fmt, ...)
+{
+	va_list ap;
+	int len;
+
+	if (ftp != NULL)
+		dt_free(dtp, ftp);
+
+	va_start(ap, fmt);
+	if (pcb == NULL) {
+		assert(dpr != NULL);
+		len = vsnprintf(dpr->dpr_errmsg, sizeof (dpr->dpr_errmsg),
+		    fmt, ap);
+		assert(len >= 2);
+		if (dpr->dpr_errmsg[len - 2] == '\n')
+			dpr->dpr_errmsg[len - 2] = '\0';
+	} else {
+		dt_set_errmsg(dtp, dt_errtag(tag), pcb->pcb_region,
+		    pcb->pcb_filetag, pcb->pcb_fileptr ? yylineno : 0, fmt, ap);
+	}
+	va_end(ap);
+
+	return (1);
+}
+
+static int
+dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
+{
+	dtrace_hdl_t *dtp = pp->dpp_dtp;
+	dt_pcb_t *pcb = pp->dpp_pcb;
+	dt_proc_t *dpr = pp->dpp_dpr;
+	fasttrap_probe_spec_t *ftp;
+	uint64_t off;
+	char *end;
+	uint_t nmatches = 0;
+	ulong_t sz;
+	int glob, err;
+	int isdash = strcmp("-", func) == 0;
+	pid_t pid;
+
+	pid = Pstatus(pp->dpp_pr)->pr_pid;
+
+	dt_dprintf("creating probe pid%d:%s:%s:%s\n", (int)pid, pp->dpp_obj,
+	    func, pp->dpp_name);
+
+	sz = sizeof (fasttrap_probe_spec_t) + (isdash ? 4 :
+	    (symp->st_size - 1) * sizeof (ftp->ftps_offs[0]));
+
+	if ((ftp = dt_alloc(dtp, sz)) == NULL) {
+		dt_dprintf("proc_per_sym: dt_alloc(%lu) failed\n", sz);
+		return (1); /* errno is set for us */
+	}
+
+	ftp->ftps_pid = pid;
+	(void) strncpy(ftp->ftps_func, func, sizeof (ftp->ftps_func));
+
+	dt_pid_objname(ftp->ftps_mod, sizeof (ftp->ftps_mod), pp->dpp_lmid,
+	    pp->dpp_obj);
+
+	if (!isdash && gmatch("return", pp->dpp_name)) {
+		if (dt_pid_create_return_probe(pp->dpp_pr, dtp, ftp, symp,
+		    pp->dpp_stret) < 0) {
+			return (dt_pid_error(dtp, pcb, dpr, ftp,
+			    D_PROC_CREATEFAIL, "failed to create return probe "
+			    "for '%s': %s", func,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp))));
+		}
+
+		nmatches++;
+	}
+
+	if (!isdash && gmatch("entry", pp->dpp_name)) {
+		if (dt_pid_create_entry_probe(pp->dpp_pr, dtp, ftp, symp) < 0) {
+			return (dt_pid_error(dtp, pcb, dpr, ftp,
+			    D_PROC_CREATEFAIL, "failed to create entry probe "
+			    "for '%s': %s", func,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp))));
+		}
+
+		nmatches++;
+	}
+
+	glob = strisglob(pp->dpp_name);
+	if (!glob && nmatches == 0) {
+		off = strtoull(pp->dpp_name, &end, 16);
+		if (*end != '\0') {
+			return (dt_pid_error(dtp, pcb, dpr, ftp, D_PROC_NAME,
+			    "'%s' is an invalid probe name", pp->dpp_name));
+		}
+
+		if (off >= symp->st_size) {
+			return (dt_pid_error(dtp, pcb, dpr, ftp, D_PROC_OFF,
+			    "offset 0x%llx outside of function '%s'",
+			    (u_longlong_t)off, func));
+		}
+
+		err = dt_pid_create_offset_probe(pp->dpp_pr, pp->dpp_dtp, ftp,
+		    symp, off);
+
+		if (err == DT_PROC_ERR) {
+			return (dt_pid_error(dtp, pcb, dpr, ftp,
+			    D_PROC_CREATEFAIL, "failed to create probe at "
+			    "'%s+0x%llx': %s", func, (u_longlong_t)off,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp))));
+		}
+
+		if (err == DT_PROC_ALIGN) {
+			return (dt_pid_error(dtp, pcb, dpr, ftp, D_PROC_ALIGN,
+			    "offset 0x%llx is not aligned on an instruction",
+			    (u_longlong_t)off));
+		}
+
+		nmatches++;
+
+	} else if (glob && !isdash) {
+		if (dt_pid_create_glob_offset_probes(pp->dpp_pr,
+		    pp->dpp_dtp, ftp, symp, pp->dpp_name) < 0) {
+			return (dt_pid_error(dtp, pcb, dpr, ftp,
+			    D_PROC_CREATEFAIL,
+			    "failed to create offset probes in '%s': %s", func,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp))));
+		}
+
+		nmatches++;
+	}
+
+	pp->dpp_nmatches += nmatches;
+
+	dt_free(dtp, ftp);
+
+	return (0);
+}
+
+static int
+dt_pid_sym_filt(void *arg, const GElf_Sym *symp, const char *func)
+{
+	dt_pid_probe_t *pp = arg;
+
+	if (symp->st_shndx == SHN_UNDEF)
+		return (0);
+
+	if (symp->st_size == 0) {
+		dt_dprintf("st_size of %s is zero\n", func);
+		return (0);
+	}
+
+	if (pp->dpp_last_taken == 0 ||
+	    symp->st_value != pp->dpp_last.st_value ||
+	    symp->st_size != pp->dpp_last.st_size) {
+		/*
+		 * Due to 4524008, _init and _fini may have a bloated st_size.
+		 * While this bug has been fixed for a while, old binaries
+		 * may exist that still exhibit this problem. As a result, we
+		 * don't match _init and _fini though we allow users to
+		 * specify them explicitly.
+		 */
+		if (strcmp(func, "_init") == 0 || strcmp(func, "_fini") == 0)
+			return (0);
+
+		if ((pp->dpp_last_taken = gmatch(func, pp->dpp_func)) != 0) {
+			pp->dpp_last = *symp;
+			return (dt_pid_per_sym(pp, symp, func));
+		}
+	}
+
+	return (0);
+}
+
+static int
+dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
+{
+	dt_pid_probe_t *pp = arg;
+	dtrace_hdl_t *dtp = pp->dpp_dtp;
+	dt_pcb_t *pcb = pp->dpp_pcb;
+	dt_proc_t *dpr = pp->dpp_dpr;
+	GElf_Sym sym;
+
+	if (obj == NULL)
+		return (0);
+
+	(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
+
+	if ((pp->dpp_obj = strrchr(obj, '/')) == NULL)
+		pp->dpp_obj = obj;
+	else
+		pp->dpp_obj++;
+
+	if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret1", &sym,
+	    NULL) == 0)
+		pp->dpp_stret[0] = sym.st_value;
+	else
+		pp->dpp_stret[0] = 0;
+
+	if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret2", &sym,
+	    NULL) == 0)
+		pp->dpp_stret[1] = sym.st_value;
+	else
+		pp->dpp_stret[1] = 0;
+
+	if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret4", &sym,
+	    NULL) == 0)
+		pp->dpp_stret[2] = sym.st_value;
+	else
+		pp->dpp_stret[2] = 0;
+
+	if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj, ".stret8", &sym,
+	    NULL) == 0)
+		pp->dpp_stret[3] = sym.st_value;
+	else
+		pp->dpp_stret[3] = 0;
+
+	dt_dprintf("%s stret %llx %llx %llx %llx\n", obj,
+	    (u_longlong_t)pp->dpp_stret[0], (u_longlong_t)pp->dpp_stret[1],
+	    (u_longlong_t)pp->dpp_stret[2], (u_longlong_t)pp->dpp_stret[3]);
+
+	/*
+	 * If pp->dpp_func contains any globbing meta-characters, we need
+	 * to iterate over the symbol table and compare each function name
+	 * against the pattern.
+	 */
+	if (!strisglob(pp->dpp_func)) {
+		/*
+		 * If we fail to lookup the symbol, try interpreting the
+		 * function as the special "-" function that indicates that the
+		 * probe name should be interpreted as a absolute virtual
+		 * address. If that fails and we were matching a specific
+		 * function in a specific module, report the error, otherwise
+		 * just fail silently in the hopes that some other object will
+		 * contain the desired symbol.
+		 */
+		if (Pxlookup_by_name(pp->dpp_pr, pp->dpp_lmid, obj,
+		    pp->dpp_func, &sym, NULL) != 0) {
+			if (strcmp("-", pp->dpp_func) == 0) {
+				sym.st_name = 0;
+				sym.st_info =
+				    GELF_ST_INFO(STB_LOCAL, STT_FUNC);
+				sym.st_other = 0;
+				sym.st_value = 0;
+				sym.st_size = Pstatus(pp->dpp_pr)->pr_dmodel ==
+				    PR_MODEL_ILP32 ? -1U : -1ULL;
+
+			} else if (!strisglob(pp->dpp_mod)) {
+				return (dt_pid_error(dtp, pcb, dpr, NULL,
+				    D_PROC_FUNC,
+				    "failed to lookup '%s' in module '%s'",
+				    pp->dpp_func, pp->dpp_mod));
+			} else {
+				return (0);
+			}
+		}
+
+		/*
+		 * Only match defined functions of non-zero size.
+		 */
+		if (GELF_ST_TYPE(sym.st_info) != STT_FUNC ||
+		    sym.st_shndx == SHN_UNDEF || sym.st_size == 0)
+			return (0);
+
+		/*
+		 * We don't instrument PLTs -- they're dynamically rewritten,
+		 * and, so, inherently dicey to instrument.
+		 */
+		if (Ppltdest(pp->dpp_pr, sym.st_value) != NULL)
+			return (0);
+
+		(void) Plookup_by_addr(pp->dpp_pr, sym.st_value, pp->dpp_func,
+		    DTRACE_FUNCNAMELEN, &sym);
+
+		return (dt_pid_per_sym(pp, &sym, pp->dpp_func));
+	} else {
+		uint_t nmatches = pp->dpp_nmatches;
+
+		if (Psymbol_iter_by_addr(pp->dpp_pr, obj, PR_SYMTAB,
+		    BIND_ANY | TYPE_FUNC, dt_pid_sym_filt, pp) == 1)
+			return (1);
+
+		if (nmatches == pp->dpp_nmatches) {
+			/*
+			 * If we didn't match anything in the PR_SYMTAB, try
+			 * the PR_DYNSYM.
+			 */
+			if (Psymbol_iter_by_addr(pp->dpp_pr, obj, PR_DYNSYM,
+			    BIND_ANY | TYPE_FUNC, dt_pid_sym_filt, pp) == 1)
+				return (1);
+		}
+	}
+
+	return (0);
+}
+
+static int
+dt_pid_mod_filt(void *arg, const prmap_t *pmp, const char *obj)
+{
+	char name[DTRACE_MODNAMELEN];
+	dt_pid_probe_t *pp = arg;
+
+	if ((pp->dpp_obj = strrchr(obj, '/')) == NULL)
+		pp->dpp_obj = obj;
+	else
+		pp->dpp_obj++;
+
+	if (gmatch(pp->dpp_obj, pp->dpp_mod))
+		return (dt_pid_per_mod(pp, pmp, obj));
+
+	(void) Plmid(pp->dpp_pr, pmp->pr_vaddr, &pp->dpp_lmid);
+
+	dt_pid_objname(name, sizeof (name), pp->dpp_lmid, pp->dpp_obj);
+
+	if (gmatch(name, pp->dpp_mod))
+		return (dt_pid_per_mod(pp, pmp, obj));
+
+	return (0);
+}
+
+static const prmap_t *
+dt_pid_fix_mod(dtrace_probedesc_t *pdp, struct ps_prochandle *P)
+{
+	char m[MAXPATHLEN];
+	Lmid_t lmid = PR_LMID_EVERY;
+	const char *obj;
+	const prmap_t *pmp;
+
+	/*
+	 * Pick apart the link map from the library name.
+	 */
+	if (strchr(pdp->dtpd_mod, '`') != NULL) {
+		char *end;
+
+		if (strncmp(pdp->dtpd_mod, "LM", 2) != 0 ||
+		    !isdigit(pdp->dtpd_mod[2]))
+			return (NULL);
+
+		lmid = strtoul(&pdp->dtpd_mod[2], &end, 16);
+
+		obj = end + 1;
+
+		if (*end != '`' || strchr(obj, '`') != NULL)
+			return (NULL);
+
+	} else {
+		obj = pdp->dtpd_mod;
+	}
+
+	if ((pmp = Plmid_to_map(P, lmid, obj)) == NULL)
+		return (NULL);
+
+	(void) Pobjname(P, pmp->pr_vaddr, m, sizeof (m));
+	if ((obj = strrchr(m, '/')) == NULL)
+		obj = &m[0];
+	else
+		obj++;
+
+	(void) Plmid(P, pmp->pr_vaddr, &lmid);
+	dt_pid_objname(pdp->dtpd_mod, sizeof (pdp->dtpd_mod), lmid, obj);
+
+	return (pmp);
+}
+
+
+static int
+dt_pid_create_pid_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
+    dt_pcb_t *pcb, dt_proc_t *dpr)
+{
+	dt_pid_probe_t pp;
+	int ret = 0;
+
+	pp.dpp_dtp = dtp;
+	pp.dpp_dpr = dpr;
+	pp.dpp_pr = dpr->dpr_proc;
+	pp.dpp_pcb = pcb;
+
+	/*
+	 * We can only trace dynamically-linked executables (since we've
+	 * hidden some magic in ld.so.1 as well as libc.so.1).
+	 */
+	if (Pname_to_map(pp.dpp_pr, PR_OBJ_LDSO) == NULL) {
+		return (dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_DYN,
+		    "process %s is not a dynamically-linked executable",
+		    &pdp->dtpd_provider[3]));
+	}
+
+	pp.dpp_mod = pdp->dtpd_mod[0] != '\0' ? pdp->dtpd_mod : "*";
+	pp.dpp_func = pdp->dtpd_func[0] != '\0' ? pdp->dtpd_func : "*";
+	pp.dpp_name = pdp->dtpd_name[0] != '\0' ? pdp->dtpd_name : "*";
+	pp.dpp_last_taken = 0;
+
+	if (strcmp(pp.dpp_func, "-") == 0) {
+		const prmap_t *aout, *pmp;
+
+		if (pdp->dtpd_mod[0] == '\0') {
+			pp.dpp_mod = pdp->dtpd_mod;
+			(void) strcpy(pdp->dtpd_mod, "a.out");
+		} else if (strisglob(pp.dpp_mod) ||
+		    (aout = Pname_to_map(pp.dpp_pr, "a.out")) == NULL ||
+		    (pmp = Pname_to_map(pp.dpp_pr, pp.dpp_mod)) == NULL ||
+		    aout->pr_vaddr != pmp->pr_vaddr) {
+			return (dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_LIB,
+			    "only the a.out module is valid with the "
+			    "'-' function"));
+		}
+
+		if (strisglob(pp.dpp_name)) {
+			return (dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_NAME,
+			    "only individual addresses may be specified "
+			    "with the '-' function"));
+		}
+	}
+
+	/*
+	 * If pp.dpp_mod contains any globbing meta-characters, we need
+	 * to iterate over each module and compare its name against the
+	 * pattern. An empty module name is treated as '*'.
+	 */
+	if (strisglob(pp.dpp_mod)) {
+		ret = Pobject_iter(pp.dpp_pr, dt_pid_mod_filt, &pp);
+	} else {
+		const prmap_t *pmp;
+		char *obj;
+
+		/*
+		 * If we can't find a matching module, don't sweat it -- either
+		 * we'll fail the enabling because the probes don't exist or
+		 * we'll wait for that module to come along.
+		 */
+		if ((pmp = dt_pid_fix_mod(pdp, pp.dpp_pr)) != NULL) {
+			if ((obj = strchr(pdp->dtpd_mod, '`')) == NULL)
+				obj = pdp->dtpd_mod;
+			else
+				obj++;
+
+			ret = dt_pid_per_mod(&pp, pmp, obj);
+		}
+	}
+
+	return (ret);
+}
+
+static int
+dt_pid_usdt_mapping(void *data, const prmap_t *pmp, const char *oname)
+{
+	struct ps_prochandle *P = data;
+	GElf_Sym sym;
+	prsyminfo_t sip;
+	dof_helper_t dh;
+	GElf_Half e_type;
+	const char *mname;
+	const char *syms[] = { "___SUNW_dof", "__SUNW_dof" };
+	int i, fd = -1;
+
+	/*
+	 * The symbol ___SUNW_dof is for lazy-loaded DOF sections, and
+	 * __SUNW_dof is for actively-loaded DOF sections. We try to force
+	 * in both types of DOF section since the process may not yet have
+	 * run the code to instantiate these providers.
+	 */
+	for (i = 0; i < 2; i++) {
+		if (Pxlookup_by_name(P, PR_LMID_EVERY, oname, syms[i], &sym,
+		    &sip) != 0) {
+			continue;
+		}
+
+		if ((mname = strrchr(oname, '/')) == NULL)
+			mname = oname;
+		else
+			mname++;
+
+		dt_dprintf("lookup of %s succeeded for %s\n", syms[i], mname);
+
+		if (Pread(P, &e_type, sizeof (e_type), pmp->pr_vaddr +
+		    offsetof(Elf64_Ehdr, e_type)) != sizeof (e_type)) {
+			dt_dprintf("read of ELF header failed");
+			continue;
+		}
+
+		dh.dofhp_dof = sym.st_value;
+		dh.dofhp_addr = (e_type == ET_EXEC) ? 0 : pmp->pr_vaddr;
+
+		dt_pid_objname(dh.dofhp_mod, sizeof (dh.dofhp_mod),
+		    sip.prs_lmid, mname);
+
+		if (fd == -1 &&
+		    (fd = pr_open(P, "/dev/dtrace/helper", O_RDWR, 0)) < 0) {
+			dt_dprintf("pr_open of helper device failed: %s\n",
+			    strerror(errno));
+			return (-1); /* errno is set for us */
+		}
+
+		if (pr_ioctl(P, fd, DTRACEHIOC_ADDDOF, &dh, sizeof (dh)) < 0)
+			dt_dprintf("DOF was rejected for %s\n", dh.dofhp_mod);
+	}
+
+	if (fd != -1)
+		(void) pr_close(P, fd);
+
+	return (0);
+}
+
+static int
+dt_pid_create_usdt_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp,
+    dt_pcb_t *pcb, dt_proc_t *dpr)
+{
+	struct ps_prochandle *P = dpr->dpr_proc;
+	int ret = 0;
+
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+
+	(void) Pupdate_maps(P);
+	if (Pobject_iter(P, dt_pid_usdt_mapping, P) != 0) {
+		ret = -1;
+		(void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_USDT,
+		    "failed to instantiate probes for pid %d: %s",
+		    (int)Pstatus(P)->pr_pid, strerror(errno));
+	}
+
+	/*
+	 * Put the module name in its canonical form.
+	 */
+	(void) dt_pid_fix_mod(pdp, P);
+
+	return (ret);
+}
+
+static pid_t
+dt_pid_get_pid(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb,
+    dt_proc_t *dpr)
+{
+	pid_t pid;
+	char *c, *last = NULL, *end;
+
+	for (c = &pdp->dtpd_provider[0]; *c != '\0'; c++) {
+		if (!isdigit(*c))
+			last = c;
+	}
+
+	if (last == NULL || (*(++last) == '\0')) {
+		(void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_BADPROV,
+		    "'%s' is not a valid provider", pdp->dtpd_provider);
+		return (-1);
+	}
+
+	errno = 0;
+	pid = strtol(last, &end, 10);
+
+	if (errno != 0 || end == last || end[0] != '\0' || pid <= 0) {
+		(void) dt_pid_error(dtp, pcb, dpr, NULL, D_PROC_BADPID,
+		    "'%s' does not contain a valid pid", pdp->dtpd_provider);
+		return (-1);
+	}
+
+	return (pid);
+}
+
+int
+dt_pid_create_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb)
+{
+	char provname[DTRACE_PROVNAMELEN];
+	struct ps_prochandle *P;
+	dt_proc_t *dpr;
+	pid_t pid;
+	int err = 0;
+
+	assert(pcb != NULL);
+
+	if ((pid = dt_pid_get_pid(pdp, dtp, pcb, NULL)) == -1)
+		return (-1);
+
+	if (dtp->dt_ftfd == -1) {
+		if (dtp->dt_fterr == ENOENT) {
+			(void) dt_pid_error(dtp, pcb, NULL, NULL, D_PROC_NODEV,
+			    "pid provider is not installed on this system");
+		} else {
+			(void) dt_pid_error(dtp, pcb, NULL, NULL, D_PROC_NODEV,
+			    "pid provider is not available: %s",
+			    strerror(dtp->dt_fterr));
+		}
+
+		return (-1);
+	}
+
+	(void) snprintf(provname, sizeof (provname), "pid%d", (int)pid);
+
+	if (gmatch(provname, pdp->dtpd_provider) != 0) {
+		if ((P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE,
+		    0)) == NULL) {
+			(void) dt_pid_error(dtp, pcb, NULL, NULL, D_PROC_GRAB,
+			    "failed to grab process %d", (int)pid);
+			return (-1);
+		}
+
+		dpr = dt_proc_lookup(dtp, P, 0);
+		assert(dpr != NULL);
+		(void) pthread_mutex_lock(&dpr->dpr_lock);
+
+		if ((err = dt_pid_create_pid_probes(pdp, dtp, pcb, dpr)) == 0) {
+			/*
+			 * Alert other retained enablings which may match
+			 * against the newly created probes.
+			 */
+			(void) dt_ioctl(dtp, DTRACEIOC_ENABLE, NULL);
+		}
+
+		(void) pthread_mutex_unlock(&dpr->dpr_lock);
+		dt_proc_release(dtp, P);
+	}
+
+	/*
+	 * If it's not strictly a pid provider, we might match a USDT provider.
+	 */
+	if (strcmp(provname, pdp->dtpd_provider) != 0) {
+		if ((P = dt_proc_grab(dtp, pid, 0, 1)) == NULL) {
+			(void) dt_pid_error(dtp, pcb, NULL, NULL, D_PROC_GRAB,
+			    "failed to grab process %d", (int)pid);
+			return (-1);
+		}
+
+		dpr = dt_proc_lookup(dtp, P, 0);
+		assert(dpr != NULL);
+		(void) pthread_mutex_lock(&dpr->dpr_lock);
+
+		if (!dpr->dpr_usdt) {
+			err = dt_pid_create_usdt_probes(pdp, dtp, pcb, dpr);
+			dpr->dpr_usdt = B_TRUE;
+		}
+
+		(void) pthread_mutex_unlock(&dpr->dpr_lock);
+		dt_proc_release(dtp, P);
+	}
+
+	return (err ? -1 : 0);
+}
+
+int
+dt_pid_create_probes_module(dtrace_hdl_t *dtp, dt_proc_t *dpr)
+{
+	dtrace_prog_t *pgp;
+	dt_stmt_t *stp;
+	dtrace_probedesc_t *pdp, pd;
+	pid_t pid;
+	int ret = 0, found = B_FALSE;
+	char provname[DTRACE_PROVNAMELEN];
+
+	(void) snprintf(provname, sizeof (provname), "pid%d",
+	    (int)dpr->dpr_pid);
+
+	for (pgp = dt_list_next(&dtp->dt_programs); pgp != NULL;
+	    pgp = dt_list_next(pgp)) {
+
+		for (stp = dt_list_next(&pgp->dp_stmts); stp != NULL;
+		    stp = dt_list_next(stp)) {
+
+			pdp = &stp->ds_desc->dtsd_ecbdesc->dted_probe;
+			pid = dt_pid_get_pid(pdp, dtp, NULL, dpr);
+			if (pid != dpr->dpr_pid)
+				continue;
+
+			found = B_TRUE;
+
+			pd = *pdp;
+
+			if (gmatch(provname, pdp->dtpd_provider) != 0 &&
+			    dt_pid_create_pid_probes(&pd, dtp, NULL, dpr) != 0)
+				ret = 1;
+
+			/*
+			 * If it's not strictly a pid provider, we might match
+			 * a USDT provider.
+			 */
+			if (strcmp(provname, pdp->dtpd_provider) != 0 &&
+			    dt_pid_create_usdt_probes(&pd, dtp, NULL, dpr) != 0)
+				ret = 1;
+		}
+	}
+
+	if (found) {
+		/*
+		 * Give DTrace a shot to the ribs to get it to check
+		 * out the newly created probes.
+		 */
+		(void) dt_ioctl(dtp, DTRACEIOC_ENABLE, NULL);
+	}
+
+	return (ret);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.h
new file mode 100644
index 0000000..ca7162c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pid.h
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_PID_H
+#define	_DT_PID_H
+#ifndef VBOX
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <libproc.h>
+#include <sys/fasttrap.h>
+#include <dt_impl.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#define	DT_PROC_ERR	(-1)
+#define	DT_PROC_ALIGN	(-2)
+
+extern int dt_pid_create_probes(dtrace_probedesc_t *, dtrace_hdl_t *,
+    dt_pcb_t *pcb);
+extern int dt_pid_create_probes_module(dtrace_hdl_t *, dt_proc_t *);
+
+extern int dt_pid_create_entry_probe(struct ps_prochandle *, dtrace_hdl_t *,
+    fasttrap_probe_spec_t *, const GElf_Sym *);
+
+extern int dt_pid_create_return_probe(struct ps_prochandle *, dtrace_hdl_t *,
+    fasttrap_probe_spec_t *, const GElf_Sym *, uint64_t *);
+
+extern int dt_pid_create_offset_probe(struct ps_prochandle *, dtrace_hdl_t *,
+    fasttrap_probe_spec_t *, const GElf_Sym *, ulong_t);
+
+extern int dt_pid_create_glob_offset_probes(struct ps_prochandle *,
+    dtrace_hdl_t *, fasttrap_probe_spec_t *, const GElf_Sym *, const char *);
+
+#endif /* !VBOX */
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_PID_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pragma.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pragma.c
new file mode 100644
index 0000000..5fa396a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_pragma.c
@@ -0,0 +1,507 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <assert.h>
+#include <strings.h>
+#include <alloca.h>
+#include <stdlib.h>
+#include <stdio.h>
+#endif
+
+#include <dt_parser.h>
+#include <dt_impl.h>
+#include <dt_provider.h>
+#include <dt_module.h>
+
+/*
+ * This callback function is installed in a given identifier hash to search for
+ * and apply deferred pragmas that are pending for a given new identifier name.
+ * Multiple pragmas may be pending for a given name; we processs all of them.
+ */
+/*ARGSUSED*/
+static void
+dt_pragma_apply(dt_idhash_t *dhp, dt_ident_t *idp)
+{
+	dt_idhash_t *php;
+	dt_ident_t *pdp;
+
+	if ((php = yypcb->pcb_pragmas) == NULL)
+		return; /* no pragmas pending for current compilation pass */
+
+	while ((pdp = dt_idhash_lookup(php, idp->di_name)) != NULL) {
+		switch (pdp->di_kind) {
+		case DT_IDENT_PRAGAT:
+			idp->di_attr = pdp->di_attr;
+			break;
+		case DT_IDENT_PRAGBN:
+			idp->di_vers = pdp->di_vers;
+			break;
+		}
+		dt_idhash_delete(php, pdp);
+	}
+}
+
+/*
+ * The #pragma attributes directive can be used to reset stability attributes
+ * on a global identifier or inline definition.  If the identifier is already
+ * defined, we can just change di_attr.  If not, we insert the pragma into a
+ * hash table of the current pcb's deferred pragmas for later processing.
+ */
+static void
+dt_pragma_attributes(const char *prname, dt_node_t *dnp)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dtrace_attribute_t attr, *a;
+	dt_provider_t *pvp;
+	const char *name, *part;
+	dt_ident_t *idp;
+
+	if (dnp == NULL || dnp->dn_kind != DT_NODE_IDENT ||
+	    dnp->dn_list == NULL || dnp->dn_list->dn_kind != DT_NODE_IDENT) {
+		xyerror(D_PRAGMA_MALFORM, "malformed #pragma %s "
+		    "<attributes> <ident>\n", prname);
+	}
+
+	if (dtrace_str2attr(dnp->dn_string, &attr) == -1) {
+		xyerror(D_PRAGMA_INVAL, "invalid attributes "
+		    "specified by #pragma %s\n", prname);
+	}
+
+	dnp = dnp->dn_list;
+	name = dnp->dn_string;
+
+	if (strcmp(name, "provider") == 0) {
+		dnp = dnp->dn_list;
+		name = dnp->dn_string;
+
+		dnp = dnp->dn_list;
+		part = dnp->dn_string;
+
+		if ((pvp = dt_provider_lookup(dtp, name)) != NULL) {
+			if (strcmp(part, "provider") == 0) {
+				a = &pvp->pv_desc.dtvd_attr.dtpa_provider;
+			} else if (strcmp(part, "module") == 0) {
+				a = &pvp->pv_desc.dtvd_attr.dtpa_mod;
+			} else if (strcmp(part, "function") == 0) {
+				a = &pvp->pv_desc.dtvd_attr.dtpa_func;
+			} else if (strcmp(part, "name") == 0) {
+				a = &pvp->pv_desc.dtvd_attr.dtpa_name;
+			} else if (strcmp(part, "args") == 0) {
+				a = &pvp->pv_desc.dtvd_attr.dtpa_args;
+			} else {
+				xyerror(D_PRAGMA_INVAL, "invalid component "
+				    "\"%s\" in attribute #pragma "
+				    "for provider %s\n", name, part);
+			}
+
+			*a = attr;
+			return;
+		}
+
+	} else if ((idp = dt_idstack_lookup(
+	    &yypcb->pcb_globals, name)) != NULL) {
+
+		if (idp->di_gen != dtp->dt_gen) {
+			xyerror(D_PRAGMA_SCOPE, "#pragma %s cannot modify "
+			    "entity defined outside program scope\n", prname);
+		}
+
+		idp->di_attr = attr;
+		return;
+	}
+
+	if (yypcb->pcb_pragmas == NULL && (yypcb->pcb_pragmas =
+	    dt_idhash_create("pragma", NULL, 0, 0)) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	idp = dt_idhash_insert(yypcb->pcb_pragmas, name, DT_IDENT_PRAGAT, 0, 0,
+	    attr, 0, &dt_idops_thaw, (void *)prname, dtp->dt_gen);
+
+	if (idp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	if (dtp->dt_globals->dh_defer == NULL)
+		dtp->dt_globals->dh_defer = &dt_pragma_apply;
+}
+
+/*
+ * The #pragma binding directive can be used to reset the version binding
+ * on a global identifier or inline definition.  If the identifier is already
+ * defined, we can just change di_vers.  If not, we insert the pragma into a
+ * hash table of the current pcb's deferred pragmas for later processing.
+ */
+static void
+dt_pragma_binding(const char *prname, dt_node_t *dnp)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_version_t vers;
+	const char *name;
+	dt_ident_t *idp;
+
+	if (dnp == NULL || dnp->dn_kind != DT_NODE_STRING ||
+	    dnp->dn_list == NULL || dnp->dn_list->dn_kind != DT_NODE_IDENT) {
+		xyerror(D_PRAGMA_MALFORM, "malformed #pragma %s "
+		    "\"version\" <ident>\n", prname);
+	}
+
+	if (dt_version_str2num(dnp->dn_string, &vers) == -1) {
+		xyerror(D_PRAGMA_INVAL, "invalid version string "
+		    "specified by #pragma %s\n", prname);
+	}
+
+	name = dnp->dn_list->dn_string;
+	idp = dt_idstack_lookup(&yypcb->pcb_globals, name);
+
+	if (idp != NULL) {
+		if (idp->di_gen != dtp->dt_gen) {
+			xyerror(D_PRAGMA_SCOPE, "#pragma %s cannot modify "
+			    "entity defined outside program scope\n", prname);
+		}
+		idp->di_vers = vers;
+		return;
+	}
+
+	if (yypcb->pcb_pragmas == NULL && (yypcb->pcb_pragmas =
+	    dt_idhash_create("pragma", NULL, 0, 0)) == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	idp = dt_idhash_insert(yypcb->pcb_pragmas, name, DT_IDENT_PRAGBN, 0, 0,
+	    _dtrace_defattr, vers, &dt_idops_thaw, (void *)prname, dtp->dt_gen);
+
+	if (idp == NULL)
+		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+
+	if (dtp->dt_globals->dh_defer == NULL)
+		dtp->dt_globals->dh_defer = &dt_pragma_apply;
+}
+
+/*
+ * The #pragma depends_on directive can be used to express a dependency on a
+ * module, provider or library which if not present will cause processing to
+ * abort.
+ */
+static void
+dt_pragma_depends(const char *prname, dt_node_t *cnp)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	dt_node_t *nnp = cnp ? cnp->dn_list : NULL;
+	int found;
+	dt_lib_depend_t *dld;
+	char lib[MAXPATHLEN];
+
+	if (cnp == NULL || nnp == NULL ||
+	    cnp->dn_kind != DT_NODE_IDENT || nnp->dn_kind != DT_NODE_IDENT) {
+		xyerror(D_PRAGMA_MALFORM, "malformed #pragma %s "
+		    "<class> <name>\n", prname);
+	}
+
+	if (strcmp(cnp->dn_string, "provider") == 0)
+		found = dt_provider_lookup(dtp, nnp->dn_string) != NULL;
+	else if (strcmp(cnp->dn_string, "module") == 0) {
+		dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string);
+		found = mp != NULL && dt_module_getctf(dtp, mp) != NULL;
+	} else if (strcmp(cnp->dn_string, "library") == 0) {
+		if (yypcb->pcb_cflags & DTRACE_C_CTL) {
+			assert(dtp->dt_filetag != NULL);
+
+			/*
+			 * We have the file we are working on in dtp->dt_filetag
+			 * so find that node and add the dependency in.
+			 */
+			dld = dt_lib_depend_lookup(&dtp->dt_lib_dep,
+			    dtp->dt_filetag);
+			assert(dld != NULL);
+
+			(void) snprintf(lib, sizeof (lib), "%s%s",
+			    dld->dtld_libpath, nnp->dn_string);
+			if ((dt_lib_depend_add(dtp, &dld->dtld_dependencies,
+			    lib)) != 0) {
+				xyerror(D_PRAGMA_DEPEND,
+				    "failed to add dependency %s:%s\n", lib,
+				    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+			}
+		} else {
+			/*
+			 * By this point we have already performed a topological
+			 * sort of the dependencies; we process this directive
+			 * as satisfied as long as the dependency was properly
+			 * loaded.
+			 */
+			if (dtp->dt_filetag == NULL)
+				xyerror(D_PRAGMA_DEPEND, "main program may "
+				    "not explicitly depend on a library");
+
+			dld = dt_lib_depend_lookup(&dtp->dt_lib_dep,
+			    dtp->dt_filetag);
+			assert(dld != NULL);
+
+			(void) snprintf(lib, sizeof (lib), "%s%s",
+			    dld->dtld_libpath, nnp->dn_string);
+			dld = dt_lib_depend_lookup(&dtp->dt_lib_dep_sorted,
+			    lib);
+			assert(dld != NULL);
+
+			if (!dld->dtld_loaded)
+				xyerror(D_PRAGMA_DEPEND, "program requires "
+				    "library \"%s\" which failed to load",
+				    lib);
+		}
+
+		found = B_TRUE;
+	} else {
+		xyerror(D_PRAGMA_INVAL, "invalid class %s "
+		    "specified by #pragma %s\n", cnp->dn_string, prname);
+	}
+
+	if (!found) {
+		xyerror(D_PRAGMA_DEPEND, "program requires %s %s\n",
+		    cnp->dn_string, nnp->dn_string);
+	}
+}
+
+/*
+ * The #pragma error directive can be followed by any list of tokens, which we
+ * just concatenate and print as part of our error message.
+ */
+static void
+dt_pragma_error(const char *prname, dt_node_t *dnp)
+{
+	dt_node_t *enp;
+	size_t n = 0;
+	char *s;
+
+	for (enp = dnp; enp != NULL; enp = enp->dn_list) {
+		if (enp->dn_kind == DT_NODE_IDENT ||
+		    enp->dn_kind == DT_NODE_STRING)
+			n += strlen(enp->dn_string) + 1;
+	}
+
+	s = alloca(n + 1);
+	s[0] = '\0';
+
+	for (enp = dnp; enp != NULL; enp = enp->dn_list) {
+		if (enp->dn_kind == DT_NODE_IDENT ||
+		    enp->dn_kind == DT_NODE_STRING) {
+			(void) strcat(s, enp->dn_string);
+			(void) strcat(s, " ");
+		}
+	}
+
+	xyerror(D_PRAGERR, "#%s: %s\n", prname, s);
+}
+
+/*ARGSUSED*/
+static void
+dt_pragma_ident(const char *prname, dt_node_t *dnp)
+{
+	/* ignore any #ident or #pragma ident lines */
+}
+
+static void
+dt_pragma_option(const char *prname, dt_node_t *dnp)
+{
+	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+	char *opt, *val;
+
+	if (dnp == NULL || dnp->dn_kind != DT_NODE_IDENT) {
+		xyerror(D_PRAGMA_MALFORM,
+		    "malformed #pragma %s <option>=<val>\n", prname);
+	}
+
+	if (dnp->dn_list != NULL) {
+		xyerror(D_PRAGMA_MALFORM,
+		    "superfluous arguments specified for #pragma %s\n", prname);
+	}
+
+#ifndef VBOX
+	opt = strdupa(dnp->dn_string);
+#else
+	MY_STRDUPA(opt, dnp->dn_string);
+#endif
+
+	if ((val = strchr(opt, '=')) != NULL)
+		*val++ = '\0';
+
+	if (dtrace_setopt(dtp, opt, val) == -1) {
+		if (val == NULL) {
+			xyerror(D_PRAGMA_OPTSET,
+			    "failed to set option '%s': %s\n", opt,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		} else {
+			xyerror(D_PRAGMA_OPTSET,
+			    "failed to set option '%s' to '%s': %s\n",
+			    opt, val, dtrace_errmsg(dtp, dtrace_errno(dtp)));
+		}
+	}
+}
+
+/*
+ * The #line directive is used to reset the input line number and to optionally
+ * note the file name for use in error messages.  Sun cpp(1) also produces a
+ * third integer token after the filename which is one of the following:
+ *
+ * 0 - line change has nothing to do with an #include file
+ * 1 - line change because we just entered a #include file
+ * 2 - line change because we just exited a #include file
+ *
+ * We use these state tokens to adjust pcb_idepth, which in turn controls
+ * whether type lookups access the global type space or not.
+ */
+static void
+dt_pragma_line(const char *prname, dt_node_t *dnp)
+{
+	dt_node_t *fnp = dnp ? dnp->dn_list : NULL;
+	dt_node_t *inp = fnp ? fnp->dn_list : NULL;
+
+	if ((dnp == NULL || dnp->dn_kind != DT_NODE_INT) ||
+	    (fnp != NULL && fnp->dn_kind != DT_NODE_STRING) ||
+	    (inp != NULL && inp->dn_kind != DT_NODE_INT)) {
+		xyerror(D_PRAGMA_MALFORM, "malformed #%s "
+		    "<line> [ [\"file\"] state ]\n", prname);
+	}
+
+	/*
+	 * If a file is specified, free any old pcb_filetag and swap fnp's
+	 * dn_string into pcb_filetag as the new filename for error messages.
+	 */
+	if (fnp != NULL) {
+		if (yypcb->pcb_filetag != NULL)
+			free(yypcb->pcb_filetag);
+
+		/*
+		 * This is not pretty, but is a necessary evil until we either
+		 * write "dpp" or get a useful standalone cpp from DevPro.  If
+		 * the filename begins with /dev/fd, we know it's the master
+		 * input file (see dt_preproc() in dt_cc.c), so just clear the
+		 * dt_filetag pointer so error messages refer to the main file.
+		 */
+		if (strncmp(fnp->dn_string, "/dev/fd/", 8) != 0) {
+			yypcb->pcb_filetag = fnp->dn_string;
+			fnp->dn_string = NULL;
+		} else
+			yypcb->pcb_filetag = NULL;
+	}
+
+	if (inp != NULL) {
+		if (inp->dn_value == 1)
+			yypcb->pcb_idepth++;
+		else if (inp->dn_value == 2 && yypcb->pcb_idepth != 0)
+			yypcb->pcb_idepth--;
+	}
+
+	yylineno = dnp->dn_value;
+}
+
+/*
+ * D compiler pragma types range from control directives to common pragmas to
+ * D custom pragmas, in order of specificity.  Similar to gcc, we use #pragma D
+ * as a special prefix for our pragmas so they can be used in mixed headers.
+ */
+#define	DT_PRAGMA_DIR	0	/* pragma directive may be used after naked # */
+#define	DT_PRAGMA_SUB	1	/* pragma directive may be used after #pragma */
+#define	DT_PRAGMA_DCP	2	/* pragma may only be used after #pragma D */
+
+static const struct dt_pragmadesc {
+	const char *dpd_name;
+	void (*dpd_func)(const char *, dt_node_t *);
+	int dpd_kind;
+} dt_pragmas[] = {
+	{ "attributes", dt_pragma_attributes, DT_PRAGMA_DCP },
+	{ "binding", dt_pragma_binding, DT_PRAGMA_DCP },
+	{ "depends_on", dt_pragma_depends, DT_PRAGMA_DCP },
+	{ "error", dt_pragma_error, DT_PRAGMA_DIR },
+	{ "ident", dt_pragma_ident, DT_PRAGMA_DIR },
+	{ "line", dt_pragma_line, DT_PRAGMA_DIR },
+	{ "option", dt_pragma_option, DT_PRAGMA_DCP },
+	{ NULL, NULL }
+};
+
+/*
+ * Process a control line #directive by looking up the directive name in our
+ * lookup table and invoking the corresponding function with the token list.
+ * According to K&R[A12.9], we silently ignore null directive lines.
+ */
+void
+dt_pragma(dt_node_t *pnp)
+{
+	const struct dt_pragmadesc *dpd;
+	dt_node_t *dnp;
+	int kind = DT_PRAGMA_DIR;
+
+	for (dnp = pnp; dnp != NULL; dnp = dnp->dn_list) {
+		if (dnp->dn_kind == DT_NODE_INT) {
+			dt_pragma_line("line", dnp);
+			break;
+		}
+
+		if (dnp->dn_kind != DT_NODE_IDENT)
+			xyerror(D_PRAGCTL_INVAL, "invalid control directive\n");
+
+		if (kind == DT_PRAGMA_DIR &&
+		    strcmp(dnp->dn_string, "pragma") == 0) {
+			kind = DT_PRAGMA_SUB;
+			continue;
+		}
+
+		if (kind == DT_PRAGMA_SUB &&
+		    strcmp(dnp->dn_string, "D") == 0) {
+			kind = DT_PRAGMA_DCP;
+			continue;
+		}
+
+		for (dpd = dt_pragmas; dpd->dpd_name != NULL; dpd++) {
+			if (dpd->dpd_kind <= kind &&
+			    strcmp(dpd->dpd_name, dnp->dn_string) == 0)
+				break;
+		}
+
+		yylineno--; /* since we've already seen \n */
+
+		if (dpd->dpd_name != NULL) {
+			dpd->dpd_func(dpd->dpd_name, dnp->dn_list);
+			yylineno++;
+			break;
+		}
+
+		switch (kind) {
+		case DT_PRAGMA_DIR:
+			xyerror(D_PRAGCTL_INVAL, "invalid control directive: "
+			    "#%s\n", dnp->dn_string);
+			/*NOTREACHED*/
+		case DT_PRAGMA_SUB:
+			break; /* K&R[A12.8] says to ignore unknown pragmas */
+		case DT_PRAGMA_DCP:
+		default:
+			xyerror(D_PRAGMA_INVAL, "invalid D pragma: %s\n",
+			    dnp->dn_string);
+		}
+
+		yylineno++;
+		break;
+	}
+
+	dt_node_list_free(&pnp);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_printf.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_printf.c
new file mode 100644
index 0000000..a6200a0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_printf.c
@@ -0,0 +1,2016 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <sys/sysmacros.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <alloca.h>
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#else  /* VBOX */
+# include <iprt/asm.h>
+# include <ctype.h>
+#endif /* VBOX */
+
+#include <dt_printf.h>
+#include <dt_string.h>
+#include <dt_impl.h>
+
+#ifdef VBOX
+static const char g_aszMonth[12][4] =
+{ "Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+static const char g_aszDay[7][4] =
+{ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
+#endif
+
+/*ARGSUSED*/
+static int
+pfcheck_addr(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	return (dt_node_is_pointer(dnp) || dt_node_is_integer(dnp));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_kaddr(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	return (dt_node_is_pointer(dnp) || dt_node_is_integer(dnp) ||
+	    dt_node_is_symaddr(dnp));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_uaddr(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	dtrace_hdl_t *dtp = pfv->pfv_dtp;
+	dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target");
+
+	if (dt_node_is_usymaddr(dnp))
+		return (1);
+
+	if (idp == NULL || idp->di_id == 0)
+		return (0);
+
+	return (dt_node_is_pointer(dnp) || dt_node_is_integer(dnp));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_stack(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	return (dt_node_is_stack(dnp));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_time(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	return (dt_node_is_integer(dnp) &&
+	    dt_node_type_size(dnp) == sizeof (uint64_t));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_str(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	ctf_file_t *ctfp;
+	ctf_encoding_t e;
+	ctf_arinfo_t r;
+	ctf_id_t base;
+	uint_t kind;
+
+	if (dt_node_is_string(dnp))
+		return (1);
+
+	ctfp = dnp->dn_ctfp;
+	base = ctf_type_resolve(ctfp, dnp->dn_type);
+	kind = ctf_type_kind(ctfp, base);
+
+	return (kind == CTF_K_ARRAY && ctf_array_info(ctfp, base, &r) == 0 &&
+	    (base = ctf_type_resolve(ctfp, r.ctr_contents)) != CTF_ERR &&
+	    ctf_type_encoding(ctfp, base, &e) == 0 && IS_CHAR(e));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_wstr(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	ctf_file_t *ctfp = dnp->dn_ctfp;
+	ctf_id_t base = ctf_type_resolve(ctfp, dnp->dn_type);
+	uint_t kind = ctf_type_kind(ctfp, base);
+
+	ctf_encoding_t e;
+	ctf_arinfo_t r;
+
+	return (kind == CTF_K_ARRAY && ctf_array_info(ctfp, base, &r) == 0 &&
+	    (base = ctf_type_resolve(ctfp, r.ctr_contents)) != CTF_ERR &&
+	    ctf_type_kind(ctfp, base) == CTF_K_INTEGER &&
+	    ctf_type_encoding(ctfp, base, &e) == 0 && e.cte_bits == 32);
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_csi(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	return (dt_node_is_integer(dnp) &&
+	    dt_node_type_size(dnp) <= sizeof (int));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_fp(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	return (dt_node_is_float(dnp));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_xint(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	return (dt_node_is_integer(dnp));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_dint(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	if (dnp->dn_flags & DT_NF_SIGNED)
+		pfd->pfd_flags |= DT_PFCONV_SIGNED;
+	else
+		pfd->pfd_fmt[strlen(pfd->pfd_fmt) - 1] = 'u';
+
+	return (dt_node_is_integer(dnp));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_xshort(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	ctf_file_t *ctfp = dnp->dn_ctfp;
+	ctf_id_t type = ctf_type_resolve(ctfp, dnp->dn_type);
+	char n[DT_TYPE_NAMELEN];
+
+	return (ctf_type_name(ctfp, type, n, sizeof (n)) != NULL && (
+	    strcmp(n, "short") == 0 || strcmp(n, "signed short") == 0 ||
+	    strcmp(n, "unsigned short") == 0));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_xlong(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	ctf_file_t *ctfp = dnp->dn_ctfp;
+	ctf_id_t type = ctf_type_resolve(ctfp, dnp->dn_type);
+	char n[DT_TYPE_NAMELEN];
+
+	return (ctf_type_name(ctfp, type, n, sizeof (n)) != NULL && (
+	    strcmp(n, "long") == 0 || strcmp(n, "signed long") == 0 ||
+	    strcmp(n, "unsigned long") == 0));
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_xlonglong(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	ctf_file_t *ctfp = dnp->dn_ctfp;
+	ctf_id_t type = dnp->dn_type;
+	char n[DT_TYPE_NAMELEN];
+
+	if (ctf_type_name(ctfp, ctf_type_resolve(ctfp, type), n,
+	    sizeof (n)) != NULL && (strcmp(n, "long long") == 0 ||
+	    strcmp(n, "signed long long") == 0 ||
+	    strcmp(n, "unsigned long long") == 0))
+		return (1);
+
+	/*
+	 * If the type used for %llx or %llX is not an [unsigned] long long, we
+	 * also permit it to be a [u]int64_t or any typedef thereof.  We know
+	 * that these typedefs are guaranteed to work with %ll[xX] in either
+	 * compilation environment even though they alias to "long" in LP64.
+	 */
+	while (ctf_type_kind(ctfp, type) == CTF_K_TYPEDEF) {
+		if (ctf_type_name(ctfp, type, n, sizeof (n)) != NULL &&
+		    (strcmp(n, "int64_t") == 0 || strcmp(n, "uint64_t") == 0))
+			return (1);
+
+		type = ctf_type_reference(ctfp, type);
+	}
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+pfcheck_type(dt_pfargv_t *pfv, dt_pfargd_t *pfd, dt_node_t *dnp)
+{
+	return (ctf_type_compat(dnp->dn_ctfp, ctf_type_resolve(dnp->dn_ctfp,
+	    dnp->dn_type), pfd->pfd_conv->pfc_dctfp, pfd->pfd_conv->pfc_dtype));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_sint(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t unormal)
+{
+	int64_t normal = (int64_t)unormal;
+	int32_t n = (int32_t)normal;
+
+	switch (size) {
+	case sizeof (int8_t):
+		return (dt_printf(dtp, fp, format,
+		    (int32_t)*((int8_t *)addr) / n));
+	case sizeof (int16_t):
+		return (dt_printf(dtp, fp, format,
+		    (int32_t)*((int16_t *)addr) / n));
+	case sizeof (int32_t):
+		return (dt_printf(dtp, fp, format,
+		    *((int32_t *)addr) / n));
+	case sizeof (int64_t):
+		return (dt_printf(dtp, fp, format,
+		    *((int64_t *)addr) / normal));
+	default:
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+	}
+}
+
+/*ARGSUSED*/
+static int
+pfprint_uint(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	uint32_t n = (uint32_t)normal;
+
+	switch (size) {
+	case sizeof (uint8_t):
+		return (dt_printf(dtp, fp, format,
+		    (uint32_t)*((uint8_t *)addr) / n));
+	case sizeof (uint16_t):
+		return (dt_printf(dtp, fp, format,
+		    (uint32_t)*((uint16_t *)addr) / n));
+	case sizeof (uint32_t):
+		return (dt_printf(dtp, fp, format,
+		    *((uint32_t *)addr) / n));
+	case sizeof (uint64_t):
+		return (dt_printf(dtp, fp, format,
+		    *((uint64_t *)addr) / normal));
+	default:
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+	}
+}
+
+static int
+pfprint_dint(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	if (pfd->pfd_flags & DT_PFCONV_SIGNED)
+		return (pfprint_sint(dtp, fp, format, pfd, addr, size, normal));
+	else
+		return (pfprint_uint(dtp, fp, format, pfd, addr, size, normal));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_fp(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	double n = (double)normal;
+	long double ldn = (long double)normal;
+
+	switch (size) {
+	case sizeof (float):
+		return (dt_printf(dtp, fp, format,
+		    (double)*((float *)addr) / n));
+	case sizeof (double):
+		return (dt_printf(dtp, fp, format,
+		    *((double *)addr) / n));
+#ifndef _MSC_VER
+	case sizeof (long double):
+		return (dt_printf(dtp, fp, format,
+		    *((long double *)addr) / ldn));
+#endif
+	default:
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+	}
+}
+
+/*ARGSUSED*/
+static int
+pfprint_addr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	char *s;
+	int n, len = 256;
+	uint64_t val;
+
+	switch (size) {
+	case sizeof (uint32_t):
+		val = *((uint32_t *)addr);
+		break;
+	case sizeof (uint64_t):
+		val = *((uint64_t *)addr);
+		break;
+	default:
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+	}
+
+	do {
+		n = len;
+		s = alloca(n);
+	} while ((len = dtrace_addr2str(dtp, val, s, n)) > n);
+
+	return (dt_printf(dtp, fp, format, s));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_mod(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	return (dt_print_mod(dtp, fp, format, (caddr_t)addr));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_umod(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	return (dt_print_umod(dtp, fp, format, (caddr_t)addr));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_uaddr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	char *s;
+	int n, len = 256;
+	uint64_t val, pid = 0;
+
+	dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target");
+
+	switch (size) {
+	case sizeof (uint32_t):
+		val = (u_longlong_t)*((uint32_t *)addr);
+		break;
+	case sizeof (uint64_t):
+		val = (u_longlong_t)*((uint64_t *)addr);
+		break;
+	case sizeof (uint64_t) * 2:
+		pid = ((uint64_t *)(uintptr_t)addr)[0];
+		val = ((uint64_t *)(uintptr_t)addr)[1];
+		break;
+	default:
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+	}
+
+	if (pid == 0 && dtp->dt_vector == NULL && idp != NULL)
+		pid = idp->di_id;
+
+	do {
+		n = len;
+		s = alloca(n);
+	} while ((len = dtrace_uaddr2str(dtp, pid, val, s, n)) > n);
+
+	return (dt_printf(dtp, fp, format, s));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_stack(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *vaddr, size_t size, uint64_t normal)
+{
+	int width;
+	dtrace_optval_t saved = dtp->dt_options[DTRACEOPT_STACKINDENT];
+	const dtrace_recdesc_t *rec = pfd->pfd_rec;
+	caddr_t addr = (caddr_t)vaddr;
+	int err = 0;
+
+	/*
+	 * We have stashed the value of the STACKINDENT option, and we will
+	 * now override it for the purposes of formatting the stack.  If the
+	 * field has been specified as left-aligned (i.e. (%-#), we set the
+	 * indentation to be the width.  This is a slightly odd semantic, but
+	 * it's useful functionality -- and it's slightly odd to begin with to
+	 * be using a single format specifier to be formatting multiple lines
+	 * of text...
+	 */
+	if (pfd->pfd_dynwidth < 0) {
+		assert(pfd->pfd_flags & DT_PFCONV_DYNWIDTH);
+		width = -pfd->pfd_dynwidth;
+	} else if (pfd->pfd_flags & DT_PFCONV_LEFT) {
+		width = pfd->pfd_dynwidth ? pfd->pfd_dynwidth : pfd->pfd_width;
+	} else {
+		width = 0;
+	}
+
+	dtp->dt_options[DTRACEOPT_STACKINDENT] = width;
+
+	switch (rec->dtrd_action) {
+	case DTRACEACT_USTACK:
+	case DTRACEACT_JSTACK:
+		err = dt_print_ustack(dtp, fp, format, addr, rec->dtrd_arg);
+		break;
+
+	case DTRACEACT_STACK:
+		err = dt_print_stack(dtp, fp, format, addr, rec->dtrd_arg,
+		    rec->dtrd_size / rec->dtrd_arg);
+		break;
+
+	default:
+		assert(0);
+	}
+
+	dtp->dt_options[DTRACEOPT_STACKINDENT] = saved;
+
+	return (err);
+}
+
+/*ARGSUSED*/
+static int
+pfprint_time(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+#ifndef VBOX
+	char src[32], buf[32], *dst = buf;
+	hrtime_t time = *((uint64_t *)addr);
+	time_t sec = (time_t)(time / NANOSEC);
+	int i;
+
+	/*
+	 * ctime(3C) returns a string of the form "Dec  3 17:20:00 1973\n\0".
+	 * Below, we turn this into the canonical adb/mdb /[yY] format,
+	 * "1973 Dec  3 17:20:00".
+	 */
+	(void) ctime_r(&sec, src, sizeof (src));
+
+	/*
+	 * Place the 4-digit year at the head of the string...
+	 */
+	for (i = 20; i < 24; i++)
+		*dst++ = src[i];
+
+	/*
+	 * ...and follow it with the remainder (month, day, hh:mm:ss).
+	 */
+	for (i = 3; i < 19; i++)
+		*dst++ = src[i];
+
+	*dst = '\0';
+#else
+	RTTIMESPEC 	TimeSpec;
+	RTTIME 		Time;
+	char 		buf[32];
+
+	RTTimeLocalExplode(&Time, RTTimeSpecSetNano(&TimeSpec, *(uint64_t *)addr));
+	RTStrPrintf(buf, sizeof(buf), "%u %s %2u %02u:%02u:%02u",
+				Time.i32Year, g_aszMonth[Time.u8Month - 1],
+				Time.u8MonthDay, Time.u8Hour, Time.u8Minute, Time.u8Second);
+#endif
+	return (dt_printf(dtp, fp, format, buf));
+}
+
+/*
+ * This prints the time in RFC 822 standard form.  This is useful for emitting
+ * notions of time that are consumed by standard tools (e.g., as part of an
+ * RSS feed).
+ */
+/*ARGSUSED*/
+static int
+pfprint_time822(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+#ifndef VBOX
+	hrtime_t time = *((uint64_t *)addr);
+	time_t sec = (time_t)(time / NANOSEC);
+	struct tm tm;
+	char buf[64];
+
+	(void) localtime_r(&sec, &tm);
+	(void) strftime(buf, sizeof (buf), "%a, %d %b %G %T %Z", &tm);
+#else
+	RTTIMESPEC 	TimeSpec;
+	RTTIME 		Time;
+	char 		buf[64];
+
+	RTTimeLocalExplode(&Time, RTTimeSpecSetNano(&TimeSpec, *(uint64_t *)addr));
+	RTStrPrintf(buf, sizeof(buf), "%s, %u %s %u %02u:%02u:%02u %s%u%s",
+				g_aszDay[Time.u8WeekDay], Time.u8MonthDay, g_aszMonth[Time.u8Month - 1],
+				Time.u8Hour, Time.u8Minute, Time.u8Second,
+				Time.offUTC >= 0 ? "UTC+" : "UTC", Time.offUTC / 60,
+				Time.offUTC % 60 == 30 ? ".5" : "");
+#endif
+	return (dt_printf(dtp, fp, format, buf));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_port(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+#ifndef VBOX
+	uint16_t port = htons(*((uint16_t *)addr));
+	char buf[256];
+	struct servent *sv, res;
+
+	if ((sv = getservbyport_r(port, NULL, &res, buf, sizeof (buf))) != NULL)
+		return (dt_printf(dtp, fp, format, sv->s_name));
+
+	(void) snprintf(buf, sizeof (buf), "%d", *((uint16_t *)addr));
+#else
+	uint16_t uPortNet = *(uint16_t *)addr;
+	char buf[32];
+
+	RTStrPrintf(buf, sizeof(buf), "%d", RT_N2H_U16(uPortNet));
+#endif
+	return (dt_printf(dtp, fp, format, buf));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_inetaddr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	char *s = alloca(size + 1);
+#ifndef VBOX
+	struct hostent *host, res;
+	char inetaddr[NS_IN6ADDRSZ];
+	char buf[1024];
+	int e;
+#endif
+
+	bcopy(addr, s, size);
+	s[size] = '\0';
+
+#ifndef VBOX
+	if (strchr(s, ':') == NULL && inet_pton(AF_INET, s, inetaddr) != -1) {
+		if ((host = gethostbyaddr_r(inetaddr, NS_INADDRSZ,
+		    AF_INET, &res, buf, sizeof (buf), &e)) != NULL)
+			return (dt_printf(dtp, fp, format, host->h_name));
+	} else if (inet_pton(AF_INET6, s, inetaddr) != -1) {
+		if ((host = getipnodebyaddr(inetaddr, NS_IN6ADDRSZ,
+		    AF_INET6, &e)) != NULL)
+			return (dt_printf(dtp, fp, format, host->h_name));
+	}
+#endif
+
+	return (dt_printf(dtp, fp, format, s));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_cstr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	char *s = alloca(size + 1);
+
+	bcopy(addr, s, size);
+	s[size] = '\0';
+	return (dt_printf(dtp, fp, format, s));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_wstr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	wchar_t *ws = alloca(size + sizeof (wchar_t));
+
+	bcopy(addr, ws, size);
+	ws[size / sizeof (wchar_t)] = L'\0';
+	return (dt_printf(dtp, fp, format, ws));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_estr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	char *s;
+	int n;
+
+	if ((s = strchr2esc(addr, size)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	n = dt_printf(dtp, fp, format, s);
+	free(s);
+	return (n);
+}
+
+static int
+pfprint_echr(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	char c;
+
+	switch (size) {
+	case sizeof (int8_t):
+		c = *(int8_t *)addr;
+		break;
+	case sizeof (int16_t):
+		c = *(int16_t *)addr;
+		break;
+	case sizeof (int32_t):
+		c = *(int32_t *)addr;
+		break;
+	default:
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+	}
+
+	return (pfprint_estr(dtp, fp, format, pfd, &c, 1, normal));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_pct(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	return (dt_printf(dtp, fp, "%%"));
+}
+
+static const char pfproto_xint[] = "char, short, int, long, or long long";
+static const char pfproto_csi[] = "char, short, or int";
+static const char pfproto_fp[] = "float, double, or long double";
+static const char pfproto_addr[] = "pointer or integer";
+static const char pfproto_uaddr[] =
+	"pointer or integer (with -p/-c) or _usymaddr (without -p/-c)";
+static const char pfproto_cstr[] = "char [] or string (or use stringof)";
+static const char pfproto_wstr[] = "wchar_t []";
+
+/*
+ * Printf format conversion dictionary.  This table should match the set of
+ * conversions offered by printf(3C), as well as some additional extensions.
+ * The second parameter is an ASCII string which is either an actual type
+ * name we should look up (if pfcheck_type is specified), or just a descriptive
+ * string of the types expected for use in error messages.
+ */
+static const dt_pfconv_t _dtrace_conversions[] = {
+{ "a", "s", pfproto_addr, pfcheck_kaddr, pfprint_addr },
+{ "A", "s", pfproto_uaddr, pfcheck_uaddr, pfprint_uaddr },
+{ "c", "c", pfproto_csi, pfcheck_csi, pfprint_sint },
+{ "C", "s", pfproto_csi, pfcheck_csi, pfprint_echr },
+{ "d", "d", pfproto_xint, pfcheck_dint, pfprint_dint },
+{ "e", "e", pfproto_fp, pfcheck_fp, pfprint_fp },
+{ "E", "E", pfproto_fp, pfcheck_fp, pfprint_fp },
+{ "f", "f", pfproto_fp, pfcheck_fp, pfprint_fp },
+{ "g", "g", pfproto_fp, pfcheck_fp, pfprint_fp },
+{ "G", "G", pfproto_fp, pfcheck_fp, pfprint_fp },
+{ "hd", "d", "short", pfcheck_type, pfprint_sint },
+{ "hi", "i", "short", pfcheck_type, pfprint_sint },
+{ "ho", "o", "unsigned short", pfcheck_type, pfprint_uint },
+{ "hu", "u", "unsigned short", pfcheck_type, pfprint_uint },
+{ "hx", "x", "short", pfcheck_xshort, pfprint_uint },
+{ "hX", "X", "short", pfcheck_xshort, pfprint_uint },
+{ "i", "i", pfproto_xint, pfcheck_dint, pfprint_dint },
+{ "I", "s", pfproto_cstr, pfcheck_str, pfprint_inetaddr },
+{ "k", "s", "stack", pfcheck_stack, pfprint_stack },
+{ "lc", "lc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wint_t */
+{ "ld",	"d", "long", pfcheck_type, pfprint_sint },
+{ "li",	"i", "long", pfcheck_type, pfprint_sint },
+{ "lo",	"o", "unsigned long", pfcheck_type, pfprint_uint },
+{ "lu", "u", "unsigned long", pfcheck_type, pfprint_uint },
+{ "ls",	"ls", pfproto_wstr, pfcheck_wstr, pfprint_wstr },
+{ "lx",	"x", "long", pfcheck_xlong, pfprint_uint },
+{ "lX",	"X", "long", pfcheck_xlong, pfprint_uint },
+{ "lld", "d", "long long", pfcheck_type, pfprint_sint },
+{ "lli", "i", "long long", pfcheck_type, pfprint_sint },
+{ "llo", "o", "unsigned long long", pfcheck_type, pfprint_uint },
+{ "llu", "u", "unsigned long long", pfcheck_type, pfprint_uint },
+{ "llx", "x", "long long", pfcheck_xlonglong, pfprint_uint },
+{ "llX", "X", "long long", pfcheck_xlonglong, pfprint_uint },
+{ "Le",	"e", "long double", pfcheck_type, pfprint_fp },
+{ "LE",	"E", "long double", pfcheck_type, pfprint_fp },
+{ "Lf",	"f", "long double", pfcheck_type, pfprint_fp },
+{ "Lg",	"g", "long double", pfcheck_type, pfprint_fp },
+{ "LG",	"G", "long double", pfcheck_type, pfprint_fp },
+{ "o", "o", pfproto_xint, pfcheck_xint, pfprint_uint },
+{ "p", "x", pfproto_addr, pfcheck_addr, pfprint_uint },
+{ "P", "s", "uint16_t", pfcheck_type, pfprint_port },
+{ "s", "s", "char [] or string (or use stringof)", pfcheck_str, pfprint_cstr },
+{ "S", "s", pfproto_cstr, pfcheck_str, pfprint_estr },
+{ "T", "s", "int64_t", pfcheck_time, pfprint_time822 },
+{ "u", "u", pfproto_xint, pfcheck_xint, pfprint_uint },
+{ "wc",	"wc", "int", pfcheck_type, pfprint_sint }, /* a.k.a. wchar_t */
+{ "ws", "ws", pfproto_wstr, pfcheck_wstr, pfprint_wstr },
+{ "x", "x", pfproto_xint, pfcheck_xint, pfprint_uint },
+{ "X", "X", pfproto_xint, pfcheck_xint, pfprint_uint },
+{ "Y", "s", "int64_t", pfcheck_time, pfprint_time },
+{ "%", "%", "void", pfcheck_type, pfprint_pct },
+{ NULL, NULL, NULL, NULL, NULL }
+};
+
+int
+dt_pfdict_create(dtrace_hdl_t *dtp)
+{
+	uint_t n = _dtrace_strbuckets;
+	const dt_pfconv_t *pfd;
+	dt_pfdict_t *pdi;
+
+	if ((pdi = malloc(sizeof (dt_pfdict_t))) == NULL ||
+	    (pdi->pdi_buckets = malloc(sizeof (dt_pfconv_t *) * n)) == NULL) {
+		free(pdi);
+		return (dt_set_errno(dtp, EDT_NOMEM));
+	}
+
+	dtp->dt_pfdict = pdi;
+	bzero(pdi->pdi_buckets, sizeof (dt_pfconv_t *) * n);
+	pdi->pdi_nbuckets = n;
+
+	for (pfd = _dtrace_conversions; pfd->pfc_name != NULL; pfd++) {
+		dtrace_typeinfo_t dtt;
+		dt_pfconv_t *pfc;
+		uint_t h;
+
+		if ((pfc = malloc(sizeof (dt_pfconv_t))) == NULL) {
+			dt_pfdict_destroy(dtp);
+			return (dt_set_errno(dtp, EDT_NOMEM));
+		}
+
+		bcopy(pfd, pfc, sizeof (dt_pfconv_t));
+		h = dt_strtab_hash(pfc->pfc_name, NULL) % n;
+		pfc->pfc_next = pdi->pdi_buckets[h];
+		pdi->pdi_buckets[h] = pfc;
+
+		dtt.dtt_ctfp = NULL;
+		dtt.dtt_type = CTF_ERR;
+
+		/*
+		 * The "D" container or its parent must contain a definition of
+		 * any type referenced by a printf conversion.  If none can be
+		 * found, we fail to initialize the printf dictionary.
+		 */
+		if (pfc->pfc_check == &pfcheck_type && dtrace_lookup_by_type(
+		    dtp, DTRACE_OBJ_DDEFS, pfc->pfc_tstr, &dtt) != 0) {
+			dt_pfdict_destroy(dtp);
+			return (dt_set_errno(dtp, EDT_NOCONV));
+		}
+
+		pfc->pfc_dctfp = dtt.dtt_ctfp;
+		pfc->pfc_dtype = dtt.dtt_type;
+
+		/*
+		 * The "C" container may contain an alternate definition of an
+		 * explicit conversion type.  If it does, use it; otherwise
+		 * just set pfc_ctype to pfc_dtype so it is always valid.
+		 */
+		if (pfc->pfc_check == &pfcheck_type && dtrace_lookup_by_type(
+		    dtp, DTRACE_OBJ_CDEFS, pfc->pfc_tstr, &dtt) == 0) {
+			pfc->pfc_cctfp = dtt.dtt_ctfp;
+			pfc->pfc_ctype = dtt.dtt_type;
+		} else {
+			pfc->pfc_cctfp = pfc->pfc_dctfp;
+			pfc->pfc_ctype = pfc->pfc_dtype;
+		}
+
+		if (pfc->pfc_check == NULL || pfc->pfc_print == NULL ||
+		    pfc->pfc_ofmt == NULL || pfc->pfc_tstr == NULL) {
+			dt_pfdict_destroy(dtp);
+			return (dt_set_errno(dtp, EDT_BADCONV));
+		}
+
+		dt_dprintf("loaded printf conversion %%%s\n", pfc->pfc_name);
+	}
+
+	return (0);
+}
+
+void
+dt_pfdict_destroy(dtrace_hdl_t *dtp)
+{
+	dt_pfdict_t *pdi = dtp->dt_pfdict;
+	dt_pfconv_t *pfc, *nfc;
+	uint_t i;
+
+	if (pdi == NULL)
+		return;
+
+	for (i = 0; i < pdi->pdi_nbuckets; i++) {
+		for (pfc = pdi->pdi_buckets[i]; pfc != NULL; pfc = nfc) {
+			nfc = pfc->pfc_next;
+			free(pfc);
+		}
+	}
+
+	free(pdi->pdi_buckets);
+	free(pdi);
+	dtp->dt_pfdict = NULL;
+}
+
+static const dt_pfconv_t *
+dt_pfdict_lookup(dtrace_hdl_t *dtp, const char *name)
+{
+	dt_pfdict_t *pdi = dtp->dt_pfdict;
+	uint_t h = dt_strtab_hash(name, NULL) % pdi->pdi_nbuckets;
+	const dt_pfconv_t *pfc;
+
+	for (pfc = pdi->pdi_buckets[h]; pfc != NULL; pfc = pfc->pfc_next) {
+		if (strcmp(pfc->pfc_name, name) == 0)
+			break;
+	}
+
+	return (pfc);
+}
+
+static dt_pfargv_t *
+dt_printf_error(dtrace_hdl_t *dtp, int err)
+{
+	if (yypcb != NULL)
+		longjmp(yypcb->pcb_jmpbuf, err);
+
+	(void) dt_set_errno(dtp, err);
+	return (NULL);
+}
+
+dt_pfargv_t *
+dt_printf_create(dtrace_hdl_t *dtp, const char *s)
+{
+	dt_pfargd_t *pfd, *nfd = NULL;
+	dt_pfargv_t *pfv;
+	const char *p, *q;
+	char *format;
+
+	if ((pfv = malloc(sizeof (dt_pfargv_t))) == NULL ||
+	    (format = strdup(s)) == NULL) {
+		free(pfv);
+		return (dt_printf_error(dtp, EDT_NOMEM));
+	}
+
+	pfv->pfv_format = format;
+	pfv->pfv_argv = NULL;
+	pfv->pfv_argc = 0;
+	pfv->pfv_flags = 0;
+	pfv->pfv_dtp = dtp;
+
+	for (q = format; (p = strchr(q, '%')) != NULL; q = *p ? p + 1 : p) {
+		uint_t namelen = 0;
+		int digits = 0;
+		int dot = 0;
+
+		char name[8];
+		char c;
+		int n;
+
+		if ((pfd = malloc(sizeof (dt_pfargd_t))) == NULL) {
+			dt_printf_destroy(pfv);
+			return (dt_printf_error(dtp, EDT_NOMEM));
+		}
+
+		if (pfv->pfv_argv != NULL)
+			nfd->pfd_next = pfd;
+		else
+			pfv->pfv_argv = pfd;
+
+		bzero(pfd, sizeof (dt_pfargd_t));
+		pfv->pfv_argc++;
+		nfd = pfd;
+
+		if (p > q) {
+			pfd->pfd_preflen = (size_t)(p - q);
+			pfd->pfd_prefix = q;
+		}
+
+		fmt_switch:
+		switch (c = *++p) {
+		case '0': case '1': case '2': case '3': case '4':
+		case '5': case '6': case '7': case '8': case '9':
+			if (dot == 0 && digits == 0 && c == '0') {
+				pfd->pfd_flags |= DT_PFCONV_ZPAD;
+				pfd->pfd_flags &= ~DT_PFCONV_LEFT;
+				goto fmt_switch;
+			}
+
+			for (n = 0; isdigit(c); c = *++p)
+				n = n * 10 + c - '0';
+
+			if (dot)
+				pfd->pfd_prec = n;
+			else
+				pfd->pfd_width = n;
+
+			p--;
+			digits++;
+			goto fmt_switch;
+
+		case '#':
+			pfd->pfd_flags |= DT_PFCONV_ALT;
+			goto fmt_switch;
+
+		case '*':
+			n = dot ? DT_PFCONV_DYNPREC : DT_PFCONV_DYNWIDTH;
+
+			if (pfd->pfd_flags & n) {
+				yywarn("format conversion #%u has more than "
+				    "one '*' specified for the output %s\n",
+				    pfv->pfv_argc, n ? "precision" : "width");
+
+				dt_printf_destroy(pfv);
+				return (dt_printf_error(dtp, EDT_COMPILER));
+			}
+
+			pfd->pfd_flags |= n;
+			goto fmt_switch;
+
+		case '+':
+			pfd->pfd_flags |= DT_PFCONV_SPOS;
+			goto fmt_switch;
+
+		case '-':
+			pfd->pfd_flags |= DT_PFCONV_LEFT;
+			pfd->pfd_flags &= ~DT_PFCONV_ZPAD;
+			goto fmt_switch;
+
+		case '.':
+			if (dot++ != 0) {
+				yywarn("format conversion #%u has more than "
+				    "one '.' specified\n", pfv->pfv_argc);
+
+				dt_printf_destroy(pfv);
+				return (dt_printf_error(dtp, EDT_COMPILER));
+			}
+			digits = 0;
+			goto fmt_switch;
+
+		case '?':
+			if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64)
+				pfd->pfd_width = 16;
+			else
+				pfd->pfd_width = 8;
+			goto fmt_switch;
+
+		case '@':
+			pfd->pfd_flags |= DT_PFCONV_AGG;
+			goto fmt_switch;
+
+		case '\'':
+			pfd->pfd_flags |= DT_PFCONV_GROUP;
+			goto fmt_switch;
+
+		case ' ':
+			pfd->pfd_flags |= DT_PFCONV_SPACE;
+			goto fmt_switch;
+
+		case '$':
+			yywarn("format conversion #%u uses unsupported "
+			    "positional format (%%n$)\n", pfv->pfv_argc);
+
+			dt_printf_destroy(pfv);
+			return (dt_printf_error(dtp, EDT_COMPILER));
+
+		case '%':
+			if (p[-1] == '%')
+				goto default_lbl; /* if %% then use "%" conv */
+
+			yywarn("format conversion #%u cannot be combined "
+			    "with other format flags: %%%%\n", pfv->pfv_argc);
+
+			dt_printf_destroy(pfv);
+			return (dt_printf_error(dtp, EDT_COMPILER));
+
+		case '\0':
+			yywarn("format conversion #%u name expected before "
+			    "end of format string\n", pfv->pfv_argc);
+
+			dt_printf_destroy(pfv);
+			return (dt_printf_error(dtp, EDT_COMPILER));
+
+		case 'h':
+		case 'l':
+		case 'L':
+		case 'w':
+			if (namelen < sizeof (name) - 2)
+				name[namelen++] = c;
+			goto fmt_switch;
+
+		default_lbl:
+		default:
+			name[namelen++] = c;
+			name[namelen] = '\0';
+		}
+
+		pfd->pfd_conv = dt_pfdict_lookup(dtp, name);
+
+		if (pfd->pfd_conv == NULL) {
+			yywarn("format conversion #%u is undefined: %%%s\n",
+			    pfv->pfv_argc, name);
+			dt_printf_destroy(pfv);
+			return (dt_printf_error(dtp, EDT_COMPILER));
+		}
+	}
+
+	if (*q != '\0' || *format == '\0') {
+		if ((pfd = malloc(sizeof (dt_pfargd_t))) == NULL) {
+			dt_printf_destroy(pfv);
+			return (dt_printf_error(dtp, EDT_NOMEM));
+		}
+
+		if (pfv->pfv_argv != NULL)
+			nfd->pfd_next = pfd;
+		else
+			pfv->pfv_argv = pfd;
+
+		bzero(pfd, sizeof (dt_pfargd_t));
+		pfv->pfv_argc++;
+
+		pfd->pfd_prefix = q;
+		pfd->pfd_preflen = strlen(q);
+	}
+
+	return (pfv);
+}
+
+void
+dt_printf_destroy(dt_pfargv_t *pfv)
+{
+	dt_pfargd_t *pfd, *nfd;
+
+	for (pfd = pfv->pfv_argv; pfd != NULL; pfd = nfd) {
+		nfd = pfd->pfd_next;
+		free(pfd);
+	}
+
+	free(pfv->pfv_format);
+	free(pfv);
+}
+
+void
+dt_printf_validate(dt_pfargv_t *pfv, uint_t flags,
+    dt_ident_t *idp, int foff, dtrace_actkind_t kind, dt_node_t *dnp)
+{
+	dt_pfargd_t *pfd = pfv->pfv_argv;
+	const char *func = idp->di_name;
+
+	char n[DT_TYPE_NAMELEN];
+	dtrace_typeinfo_t dtt;
+	const char *aggtype;
+	dt_node_t aggnode;
+	VBDTTYPE(uint_t,int) i, j;
+
+	if (pfv->pfv_format[0] == '\0') {
+		xyerror(D_PRINTF_FMT_EMPTY,
+		    "%s( ) format string is empty\n", func);
+	}
+
+	pfv->pfv_flags = flags;
+
+	/*
+	 * We fake up a parse node representing the type that can be used with
+	 * an aggregation result conversion, which -- for all but count() --
+	 * is a signed quantity.
+	 */
+	if (kind != DTRACEAGG_COUNT)
+		aggtype = "int64_t";
+	else
+		aggtype = "uint64_t";
+
+	if (dt_type_lookup(aggtype, &dtt) != 0)
+		xyerror(D_TYPE_ERR, "failed to lookup agg type %s\n", aggtype);
+
+	bzero(&aggnode, sizeof (aggnode));
+	dt_node_type_assign(&aggnode, dtt.dtt_ctfp, dtt.dtt_type);
+
+	for (i = 0, j = 0; i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) {
+		const dt_pfconv_t *pfc = pfd->pfd_conv;
+		const char *dyns[2];
+		int dync = 0;
+
+		char vname[64];
+		dt_node_t *vnp;
+
+		if (pfc == NULL)
+			continue; /* no checking if argd is just a prefix */
+
+		if (pfc->pfc_print == &pfprint_pct) {
+			(void) strcat(pfd->pfd_fmt, pfc->pfc_ofmt);
+			continue;
+		}
+
+		if (pfd->pfd_flags & DT_PFCONV_DYNPREC)
+			dyns[dync++] = ".*";
+		if (pfd->pfd_flags & DT_PFCONV_DYNWIDTH)
+			dyns[dync++] = "*";
+
+		for (; dync != 0; dync--) {
+			if (dnp == NULL) {
+				xyerror(D_PRINTF_DYN_PROTO,
+				    "%s( ) prototype mismatch: conversion "
+				    "#%d (%%%s) is missing a corresponding "
+				    "\"%s\" argument\n", func, i + 1,
+				    pfc->pfc_name, dyns[dync - 1]);
+			}
+
+			if (dt_node_is_integer(dnp) == 0) {
+				xyerror(D_PRINTF_DYN_TYPE,
+				    "%s( ) argument #%d is incompatible "
+				    "with conversion #%d prototype:\n"
+				    "\tconversion: %% %s %s\n"
+				    "\t prototype: int\n\t  argument: %s\n",
+				    func, j + foff + 1, i + 1,
+				    dyns[dync - 1], pfc->pfc_name,
+				    dt_node_type_name(dnp, n, sizeof (n)));
+			}
+
+			dnp = dnp->dn_list;
+			j++;
+		}
+
+		/*
+		 * If this conversion is consuming the aggregation data, set
+		 * the value node pointer (vnp) to a fake node based on the
+		 * aggregating function result type.  Otherwise assign vnp to
+		 * the next parse node in the argument list, if there is one.
+		 */
+		if (pfd->pfd_flags & DT_PFCONV_AGG) {
+			if (!(flags & DT_PRINTF_AGGREGATION)) {
+				xyerror(D_PRINTF_AGG_CONV,
+				    "%%@ conversion requires an aggregation"
+				    " and is not for use with %s( )\n", func);
+			}
+			(void) strlcpy(vname, "aggregating action",
+			    sizeof (vname));
+			vnp = &aggnode;
+		} else if (dnp == NULL) {
+			xyerror(D_PRINTF_ARG_PROTO,
+			    "%s( ) prototype mismatch: conversion #%d (%%"
+			    "%s) is missing a corresponding value argument\n",
+			    func, i + 1, pfc->pfc_name);
+		} else {
+			(void) snprintf(vname, sizeof (vname),
+			    "argument #%d", j + foff + 1);
+			vnp = dnp;
+			dnp = dnp->dn_list;
+			j++;
+		}
+
+		/*
+		 * Fill in the proposed final format string by prepending any
+		 * size-related prefixes to the pfconv's format string.  The
+		 * pfc_check() function below may optionally modify the format
+		 * as part of validating the type of the input argument.
+		 */
+		if (pfc->pfc_print == &pfprint_sint ||
+		    pfc->pfc_print == &pfprint_uint ||
+		    pfc->pfc_print == &pfprint_dint) {
+			if (dt_node_type_size(vnp) == sizeof (uint64_t))
+				(void) strcpy(pfd->pfd_fmt, "ll");
+		} else if (pfc->pfc_print == &pfprint_fp) {
+			if (dt_node_type_size(vnp) == sizeof (long double))
+				(void) strcpy(pfd->pfd_fmt, "L");
+		}
+
+		(void) strcat(pfd->pfd_fmt, pfc->pfc_ofmt);
+
+		/*
+		 * Validate the format conversion against the value node type.
+		 * If the conversion is good, create the descriptor format
+		 * string by concatenating together any required printf(3C)
+		 * size prefixes with the conversion's native format string.
+		 */
+		if (pfc->pfc_check(pfv, pfd, vnp) == 0) {
+			xyerror(D_PRINTF_ARG_TYPE,
+			    "%s( ) %s is incompatible with "
+			    "conversion #%d prototype:\n\tconversion: %%%s\n"
+			    "\t prototype: %s\n\t  argument: %s\n", func,
+			    vname, i + 1, pfc->pfc_name, pfc->pfc_tstr,
+			    dt_node_type_name(vnp, n, sizeof (n)));
+		}
+	}
+
+	if ((flags & DT_PRINTF_EXACTLEN) && dnp != NULL) {
+		xyerror(D_PRINTF_ARG_EXTRA,
+		    "%s( ) prototype mismatch: only %d arguments "
+		    "required by this format string\n", func, j);
+	}
+}
+
+void
+dt_printa_validate(dt_node_t *lhs, dt_node_t *rhs)
+{
+	dt_ident_t *lid, *rid;
+	dt_node_t *lproto, *rproto;
+	int largc, rargc, argn;
+	char n1[DT_TYPE_NAMELEN];
+	char n2[DT_TYPE_NAMELEN];
+
+	assert(lhs->dn_kind == DT_NODE_AGG);
+	assert(rhs->dn_kind == DT_NODE_AGG);
+
+	lid = lhs->dn_ident;
+	rid = rhs->dn_ident;
+
+	lproto = ((dt_idsig_t *)lid->di_data)->dis_args;
+	rproto = ((dt_idsig_t *)rid->di_data)->dis_args;
+
+	/*
+	 * First, get an argument count on each side.  These must match.
+	 */
+	for (largc = 0; lproto != NULL; lproto = lproto->dn_list)
+		largc++;
+
+	for (rargc = 0; rproto != NULL; rproto = rproto->dn_list)
+		rargc++;
+
+	if (largc != rargc) {
+		xyerror(D_PRINTA_AGGKEY, "printa( ): @%s and @%s do not have "
+		    "matching key signatures: @%s has %d key%s, @%s has %d "
+		    "key%s", lid->di_name, rid->di_name,
+		    lid->di_name, largc, largc == 1 ? "" : "s",
+		    rid->di_name, rargc, rargc == 1 ? "" : "s");
+	}
+
+	/*
+	 * Now iterate over the keys to verify that each type matches.
+	 */
+	lproto = ((dt_idsig_t *)lid->di_data)->dis_args;
+	rproto = ((dt_idsig_t *)rid->di_data)->dis_args;
+
+	for (argn = 1; lproto != NULL; argn++, lproto = lproto->dn_list,
+	    rproto = rproto->dn_list) {
+		assert(rproto != NULL);
+
+		if (dt_node_is_argcompat(lproto, rproto))
+			continue;
+
+		xyerror(D_PRINTA_AGGPROTO, "printa( ): @%s[ ] key #%d is "
+		    "incompatible with @%s:\n%9s key #%d: %s\n"
+		    "%9s key #%d: %s\n",
+		    rid->di_name, argn, lid->di_name, lid->di_name, argn,
+		    dt_node_type_name(lproto, n1, sizeof (n1)), rid->di_name,
+		    argn, dt_node_type_name(rproto, n2, sizeof (n2)));
+	}
+}
+
+static int
+dt_printf_getint(dtrace_hdl_t *dtp, const dtrace_recdesc_t *recp,
+    uint_t nrecs, const void *buf, size_t len, int *ip)
+{
+	uintptr_t addr;
+
+	if (nrecs == 0)
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+	addr = (uintptr_t)buf + recp->dtrd_offset;
+
+	if (addr + sizeof (int) > (uintptr_t)buf + len)
+		return (dt_set_errno(dtp, EDT_DOFFSET));
+
+	if (addr & (recp->dtrd_alignment - 1))
+		return (dt_set_errno(dtp, EDT_DALIGN));
+
+	switch (recp->dtrd_size) {
+	case sizeof (int8_t):
+		*ip = (int)*((int8_t *)addr);
+		break;
+	case sizeof (int16_t):
+		*ip = (int)*((int16_t *)addr);
+		break;
+	case sizeof (int32_t):
+		*ip = (int)*((int32_t *)addr);
+		break;
+	case sizeof (int64_t):
+		*ip = (int)*((int64_t *)addr);
+		break;
+	default:
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+	}
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+pfprint_average(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	const uint64_t *data = addr;
+
+	if (size != sizeof (uint64_t) * 2)
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+	return (dt_printf(dtp, fp, format,
+	    data[0] ? data[1] / normal / data[0] : 0));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_stddev(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	const uint64_t *data = addr;
+
+	if (size != sizeof (uint64_t) * 4)
+		return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+	return (dt_printf(dtp, fp, format,
+	    dt_stddev((uint64_t *)data, normal)));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_quantize(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	return (dt_print_quantize(dtp, fp, addr, size, normal));
+}
+
+/*ARGSUSED*/
+static int
+pfprint_lquantize(dtrace_hdl_t *dtp, FILE *fp, const char *format,
+    const dt_pfargd_t *pfd, const void *addr, size_t size, uint64_t normal)
+{
+	return (dt_print_lquantize(dtp, fp, addr, size, normal));
+}
+
+static int
+dt_printf_format(dtrace_hdl_t *dtp, FILE *fp, const dt_pfargv_t *pfv,
+    const dtrace_recdesc_t *recs, uint_t nrecs, const void *buf,
+    size_t len, const dtrace_aggdata_t **aggsdata, int naggvars)
+{
+	dt_pfargd_t *pfd = pfv->pfv_argv;
+	const dtrace_recdesc_t *recp = recs;
+	const dtrace_aggdata_t *aggdata;
+	dtrace_aggdesc_t *agg;
+	caddr_t lim = (caddr_t)buf + len, limit;
+	char format[64] = "%";
+	int i, aggrec, curagg = -1;
+	uint64_t normal;
+
+	/*
+	 * If we are formatting an aggregation, set 'aggrec' to the index of
+	 * the final record description (the aggregation result) so we can use
+	 * this record index with any conversion where DT_PFCONV_AGG is set.
+	 * (The actual aggregation used will vary as we increment through the
+	 * aggregation variables that we have been passed.)  Finally, we
+	 * decrement nrecs to prevent this record from being used with any
+	 * other conversion.
+	 */
+	if (pfv->pfv_flags & DT_PRINTF_AGGREGATION) {
+		assert(aggsdata != NULL);
+		assert(naggvars > 0);
+
+		if (nrecs == 0)
+			return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+		curagg = naggvars > 1 ? 1 : 0;
+		aggdata = aggsdata[0];
+		aggrec = aggdata->dtada_desc->dtagd_nrecs - 1;
+		nrecs--;
+	}
+
+	for (i = 0; VBDTCAST(uint_t)i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) {
+		const dt_pfconv_t *pfc = pfd->pfd_conv;
+		int width = pfd->pfd_width;
+		int prec = pfd->pfd_prec;
+		int rval;
+
+		char *f = format + 1; /* skip initial '%' */
+		const dtrace_recdesc_t *rec;
+		dt_pfprint_f *func;
+		caddr_t addr;
+		size_t size;
+		uint32_t flags;
+
+		if (pfd->pfd_preflen != 0) {
+			char *tmp = alloca(pfd->pfd_preflen + 1);
+
+			bcopy(pfd->pfd_prefix, tmp, pfd->pfd_preflen);
+			tmp[pfd->pfd_preflen] = '\0';
+
+			if ((rval = dt_printf(dtp, fp, tmp)) < 0)
+				return (rval);
+
+			if (pfv->pfv_flags & DT_PRINTF_AGGREGATION) {
+				/*
+				 * For printa(), we flush the buffer after each
+				 * prefix, setting the flags to indicate that
+				 * this is part of the printa() format string.
+				 */
+				flags = DTRACE_BUFDATA_AGGFORMAT;
+
+				if (pfc == NULL && i == pfv->pfv_argc - 1)
+					flags |= DTRACE_BUFDATA_AGGLAST;
+
+				if (dt_buffered_flush(dtp, NULL, NULL,
+				    aggdata, flags) < 0)
+					return (-1);
+			}
+		}
+
+		if (pfc == NULL) {
+			if (pfv->pfv_argc == 1)
+				return (nrecs != 0);
+			continue;
+		}
+
+		/*
+		 * If the conversion is %%, just invoke the print callback
+		 * with no data record and continue; it consumes no record.
+		 */
+		if (pfc->pfc_print == &pfprint_pct) {
+			if (pfc->pfc_print(dtp, fp, NULL, pfd, NULL, 0, 1) >= 0)
+				continue;
+			return (-1); /* errno is set for us */
+		}
+
+		if (pfd->pfd_flags & DT_PFCONV_DYNWIDTH) {
+			if (dt_printf_getint(dtp, recp++, nrecs--, buf,
+			    len, &width) == -1)
+				return (-1); /* errno is set for us */
+			pfd->pfd_dynwidth = width;
+		} else {
+			pfd->pfd_dynwidth = 0;
+		}
+
+		if ((pfd->pfd_flags & DT_PFCONV_DYNPREC) && dt_printf_getint(
+		    dtp, recp++, nrecs--, buf, len, &prec) == -1)
+			return (-1); /* errno is set for us */
+
+		if (pfd->pfd_flags & DT_PFCONV_AGG) {
+			/*
+			 * This should be impossible -- the compiler shouldn't
+			 * create a DT_PFCONV_AGG conversion without an
+			 * aggregation present.  Still, we'd rather fail
+			 * gracefully than blow up...
+			 */
+			if (aggsdata == NULL)
+				return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+			aggdata = aggsdata[curagg];
+			agg = aggdata->dtada_desc;
+
+			/*
+			 * We increment the current aggregation variable, but
+			 * not beyond the number of aggregation variables that
+			 * we're printing. This has the (desired) effect that
+			 * DT_PFCONV_AGG conversions beyond the number of
+			 * aggregation variables (re-)convert the aggregation
+			 * value of the last aggregation variable.
+			 */
+			if (curagg < naggvars - 1)
+				curagg++;
+
+			rec = &agg->dtagd_rec[aggrec];
+			addr = aggdata->dtada_data + rec->dtrd_offset;
+			limit = addr + aggdata->dtada_size;
+			normal = aggdata->dtada_normal;
+			flags = DTRACE_BUFDATA_AGGVAL;
+		} else {
+			if (nrecs == 0)
+				return (dt_set_errno(dtp, EDT_DMISMATCH));
+
+			if (pfv->pfv_flags & DT_PRINTF_AGGREGATION) {
+				/*
+				 * When printing aggregation keys, we always
+				 * set the aggdata to be the representative
+				 * (zeroth) aggregation.  The aggdata isn't
+				 * actually used here in this case, but it is
+				 * passed to the buffer handler and must
+				 * therefore still be correct.
+				 */
+				aggdata = aggsdata[0];
+				flags = DTRACE_BUFDATA_AGGKEY;
+			}
+
+			rec = recp++;
+			nrecs--;
+			addr = (caddr_t)buf + rec->dtrd_offset;
+			limit = lim;
+			normal = 1;
+		}
+
+		size = rec->dtrd_size;
+
+		if (addr + size > limit) {
+			dt_dprintf("bad size: addr=%p size=0x%x lim=%p\n",
+			    (void *)addr, rec->dtrd_size, (void *)lim);
+			return (dt_set_errno(dtp, EDT_DOFFSET));
+		}
+
+		if (rec->dtrd_alignment != 0 &&
+		    ((uintptr_t)addr & (rec->dtrd_alignment - 1)) != 0) {
+			dt_dprintf("bad align: addr=%p size=0x%x align=0x%x\n",
+			    (void *)addr, rec->dtrd_size, rec->dtrd_alignment);
+			return (dt_set_errno(dtp, EDT_DALIGN));
+		}
+
+		switch (rec->dtrd_action) {
+		case DTRACEAGG_AVG:
+			func = pfprint_average;
+			break;
+		case DTRACEAGG_STDDEV:
+			func = pfprint_stddev;
+			break;
+		case DTRACEAGG_QUANTIZE:
+			func = pfprint_quantize;
+			break;
+		case DTRACEAGG_LQUANTIZE:
+			func = pfprint_lquantize;
+			break;
+		case DTRACEACT_MOD:
+			func = pfprint_mod;
+			break;
+		case DTRACEACT_UMOD:
+			func = pfprint_umod;
+			break;
+		default:
+			func = pfc->pfc_print;
+			break;
+		}
+
+		if (pfd->pfd_flags & DT_PFCONV_ALT)
+			*f++ = '#';
+		if (pfd->pfd_flags & DT_PFCONV_ZPAD)
+			*f++ = '0';
+		if (width < 0 || (pfd->pfd_flags & DT_PFCONV_LEFT))
+			*f++ = '-';
+		if (pfd->pfd_flags & DT_PFCONV_SPOS)
+			*f++ = '+';
+		if (pfd->pfd_flags & DT_PFCONV_GROUP)
+			*f++ = '\'';
+		if (pfd->pfd_flags & DT_PFCONV_SPACE)
+			*f++ = ' ';
+
+		/*
+		 * If we're printing a stack and DT_PFCONV_LEFT is set, we
+		 * don't add the width to the format string.  See the block
+		 * comment in pfprint_stack() for a description of the
+		 * behavior in this case.
+		 */
+		if (func == pfprint_stack && (pfd->pfd_flags & DT_PFCONV_LEFT))
+			width = 0;
+
+		if (width != 0)
+			f += snprintf(f, sizeof (format), "%d", ABS(width));
+
+		if (prec > 0)
+			f += snprintf(f, sizeof (format), ".%d", prec);
+
+		(void) strcpy(f, pfd->pfd_fmt);
+		pfd->pfd_rec = rec;
+
+		if (func(dtp, fp, format, pfd, addr, size, normal) < 0)
+			return (-1); /* errno is set for us */
+
+		if (pfv->pfv_flags & DT_PRINTF_AGGREGATION) {
+			/*
+			 * For printa(), we flush the buffer after each tuple
+			 * element, inidicating that this is the last record
+			 * as appropriate.
+			 */
+			if (i == pfv->pfv_argc - 1)
+				flags |= DTRACE_BUFDATA_AGGLAST;
+
+			if (dt_buffered_flush(dtp, NULL,
+			    rec, aggdata, flags) < 0)
+				return (-1);
+		}
+	}
+
+	return ((int)(recp - recs));
+}
+
+int
+dtrace_sprintf(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
+    const dtrace_recdesc_t *recp, uint_t nrecs, const void *buf, size_t len)
+{
+	dtrace_optval_t size;
+	int rval;
+
+	rval = dtrace_getopt(dtp, "strsize", &size);
+	assert(rval == 0);
+	assert(dtp->dt_sprintf_buflen == 0);
+
+	if (dtp->dt_sprintf_buf != NULL)
+		free(dtp->dt_sprintf_buf);
+
+	if ((dtp->dt_sprintf_buf = malloc(size)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	bzero(dtp->dt_sprintf_buf, size);
+	dtp->dt_sprintf_buflen = size;
+	rval = dt_printf_format(dtp, fp, fmtdata, recp, nrecs, buf, len,
+	    NULL, 0);
+	dtp->dt_sprintf_buflen = 0;
+
+	if (rval == -1)
+		free(dtp->dt_sprintf_buf);
+
+	return (rval);
+}
+
+/*ARGSUSED*/
+int
+dtrace_system(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
+    const dtrace_probedata_t *data, const dtrace_recdesc_t *recp,
+    uint_t nrecs, const void *buf, size_t len)
+{
+	int rval = dtrace_sprintf(dtp, fp, fmtdata, recp, nrecs, buf, len);
+
+	if (rval == -1)
+		return (rval);
+
+	/*
+	 * Before we execute the specified command, flush fp to assure that
+	 * any prior dt_printf()'s appear before the output of the command
+	 * not after it.
+	 */
+	(void) fflush(fp);
+
+	if (system(dtp->dt_sprintf_buf) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	return (rval);
+}
+
+int
+dtrace_freopen(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
+    const dtrace_probedata_t *data, const dtrace_recdesc_t *recp,
+    uint_t nrecs, const void *buf, size_t len)
+{
+#ifndef VBOX
+	char selfbuf[40], restorebuf[40], *filename;
+	FILE *nfp;
+	dt_pfargv_t *pfv = fmtdata;
+	dt_pfargd_t *pfd = pfv->pfv_argv;
+#else
+	int rval, errval;
+#endif
+
+	rval = dtrace_sprintf(dtp, fp, fmtdata, recp, nrecs, buf, len);
+
+	if (rval == -1 || fp == NULL)
+		return (rval);
+
+#ifndef VBOX
+	if (pfd->pfd_preflen != 0 &&
+	    strcmp(pfd->pfd_prefix, DT_FREOPEN_RESTORE) == 0) {
+		/*
+		 * The only way to have the format string set to the value
+		 * DT_FREOPEN_RESTORE is via the empty freopen() string --
+		 * denoting that we should restore the old stdout.
+		 */
+		assert(strcmp(dtp->dt_sprintf_buf, DT_FREOPEN_RESTORE) == 0);
+
+		if (dtp->dt_stdout_fd == -1) {
+			/*
+			 * We could complain here by generating an error,
+			 * but it seems like overkill:  it seems that calling
+			 * freopen() to restore stdout when freopen() has
+			 * never before been called should just be a no-op,
+			 * so we just return in this case.
+			 */
+			return (rval);
+		}
+
+		(void) snprintf(restorebuf, sizeof (restorebuf),
+		    "/dev/fd/%d", dtp->dt_stdout_fd);
+		filename = restorebuf;
+	} else {
+		filename = dtp->dt_sprintf_buf;
+	}
+
+	/*
+	 * freopen(3C) will always close the specified stream and underlying
+	 * file descriptor -- even if the specified file can't be opened.
+	 * Even for the semantic cesspool that is standard I/O, this is
+	 * surprisingly brain-dead behavior:  it means that any failure to
+	 * open the specified file destroys the specified stream in the
+	 * process -- which is particularly relevant when the specified stream
+	 * happens (or rather, happened) to be stdout.  This could be resolved
+	 * were there an "fdreopen()" equivalent of freopen() that allowed one
+	 * to pass a file descriptor instead of the name of a file, but there
+	 * is no such thing.  However, we can effect this ourselves by first
+	 * fopen()'ing the desired file, and then (assuming that that works),
+	 * freopen()'ing "/dev/fd/[fileno]", where [fileno] is the underlying
+	 * file descriptor for the fopen()'d file.  This way, if the fopen()
+	 * fails, we can fail the operation without destroying stdout.
+	 */
+	if ((nfp = fopen(filename, "aF")) == NULL) {
+		char *msg = strerror(errno), *faultstr;
+		int len = 80;
+
+		len += strlen(msg) + strlen(filename);
+		faultstr = alloca(len);
+
+		(void) snprintf(faultstr, len, "couldn't freopen() \"%s\": %s",
+		    filename, strerror(errno));
+
+		if ((errval = dt_handle_liberr(dtp, data, faultstr)) == 0)
+			return (rval);
+
+		return (errval);
+	}
+
+	(void) snprintf(selfbuf, sizeof (selfbuf), "/dev/fd/%d", fileno(nfp));
+
+	if (dtp->dt_stdout_fd == -1) {
+		/*
+		 * If this is the first time that we're calling freopen(),
+		 * we're going to stash away the file descriptor for stdout.
+		 * We don't expect the dup(2) to fail, so if it does we must
+		 * return failure.
+		 */
+		if ((dtp->dt_stdout_fd = dup(fileno(fp))) == -1) {
+			(void) fclose(nfp);
+			return (dt_set_errno(dtp, errno));
+		}
+	}
+
+	if (freopen(selfbuf, "aF", fp) == NULL) {
+		(void) fclose(nfp);
+		return (dt_set_errno(dtp, errno));
+	}
+
+	(void) fclose(nfp);
+
+	return (rval);
+
+#else  /* VBOX  - the above is not easily portable because of /dev/fd/xxx. */
+	if ((errval = dt_handle_liberr(dtp, data, "reopening stdout is not implemented")) == 0)
+		return (rval);
+	return (errval);
+#endif
+}
+
+/*ARGSUSED*/
+int
+dtrace_fprintf(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
+    const dtrace_probedata_t *data, const dtrace_recdesc_t *recp,
+    uint_t nrecs, const void *buf, size_t len)
+{
+	return (dt_printf_format(dtp, fp, fmtdata,
+	    recp, nrecs, buf, len, NULL, 0));
+}
+
+void *
+dtrace_printf_create(dtrace_hdl_t *dtp, const char *s)
+{
+	dt_pfargv_t *pfv = dt_printf_create(dtp, s);
+	dt_pfargd_t *pfd;
+	VBDTTYPE(uint_t,int) i;
+
+	if (pfv == NULL)
+		return (NULL);		/* errno has been set for us */
+
+	pfd = pfv->pfv_argv;
+
+	for (i = 0; i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) {
+		const dt_pfconv_t *pfc = pfd->pfd_conv;
+
+		if (pfc == NULL)
+			continue;
+
+		/*
+		 * If the output format is not %s then we assume that we have
+		 * been given a correctly-sized format string, so we copy the
+		 * true format name including the size modifier.  If the output
+		 * format is %s, then either the input format is %s as well or
+		 * it is one of our custom formats (e.g. pfprint_addr), so we
+		 * must set pfd_fmt to be the output format conversion "s".
+		 */
+		if (strcmp(pfc->pfc_ofmt, "s") != 0)
+			(void) strcat(pfd->pfd_fmt, pfc->pfc_name);
+		else
+			(void) strcat(pfd->pfd_fmt, pfc->pfc_ofmt);
+	}
+
+	return (pfv);
+}
+
+void *
+dtrace_printa_create(dtrace_hdl_t *dtp, const char *s)
+{
+	dt_pfargv_t *pfv = dtrace_printf_create(dtp, s);
+
+	if (pfv == NULL)
+		return (NULL);		/* errno has been set for us */
+
+	pfv->pfv_flags |= DT_PRINTF_AGGREGATION;
+
+	return (pfv);
+}
+
+/*ARGSUSED*/
+size_t
+dtrace_printf_format(dtrace_hdl_t *dtp, void *fmtdata, char *s, size_t len)
+{
+	dt_pfargv_t *pfv = fmtdata;
+	dt_pfargd_t *pfd = pfv->pfv_argv;
+
+	/*
+	 * An upper bound on the string length is the length of the original
+	 * format string, plus three times the number of conversions (each
+	 * conversion could add up an additional "ll" and/or pfd_width digit
+	 * in the case of converting %? to %16) plus one for a terminating \0.
+	 */
+	size_t formatlen = strlen(pfv->pfv_format) + 3 * pfv->pfv_argc + 1;
+	char *format = alloca(formatlen);
+	char *f = format;
+#ifndef VBOX
+	int i, j;
+#else
+	uint_t i;
+	size_t j;
+#endif
+
+	for (i = 0; i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) {
+		const dt_pfconv_t *pfc = pfd->pfd_conv;
+		const char *str;
+		int width = pfd->pfd_width;
+		int prec = pfd->pfd_prec;
+
+		if (pfd->pfd_preflen != 0) {
+			for (j = 0; j < pfd->pfd_preflen; j++)
+				*f++ = pfd->pfd_prefix[j];
+		}
+
+		if (pfc == NULL)
+			continue;
+
+		*f++ = '%';
+
+		if (pfd->pfd_flags & DT_PFCONV_ALT)
+			*f++ = '#';
+		if (pfd->pfd_flags & DT_PFCONV_ZPAD)
+			*f++ = '0';
+		if (pfd->pfd_flags & DT_PFCONV_LEFT)
+			*f++ = '-';
+		if (pfd->pfd_flags & DT_PFCONV_SPOS)
+			*f++ = '+';
+		if (pfd->pfd_flags & DT_PFCONV_DYNWIDTH)
+			*f++ = '*';
+		if (pfd->pfd_flags & DT_PFCONV_DYNPREC) {
+			*f++ = '.';
+			*f++ = '*';
+		}
+		if (pfd->pfd_flags & DT_PFCONV_GROUP)
+			*f++ = '\'';
+		if (pfd->pfd_flags & DT_PFCONV_SPACE)
+			*f++ = ' ';
+		if (pfd->pfd_flags & DT_PFCONV_AGG)
+			*f++ = '@';
+
+		if (width != 0)
+			f += snprintf(f, sizeof (format), "%d", width);
+
+		if (prec != 0)
+			f += snprintf(f, sizeof (format), ".%d", prec);
+
+		/*
+		 * If the output format is %s, then either %s is the underlying
+		 * conversion or the conversion is one of our customized ones,
+		 * e.g. pfprint_addr.  In these cases, put the original string
+		 * name of the conversion (pfc_name) into the pickled format
+		 * string rather than the derived conversion (pfd_fmt).
+		 */
+		if (strcmp(pfc->pfc_ofmt, "s") == 0)
+			str = pfc->pfc_name;
+		else
+			str = pfd->pfd_fmt;
+
+		for (j = 0; str[j] != '\0'; j++)
+			*f++ = str[j];
+	}
+
+	*f = '\0'; /* insert nul byte; do not count in return value */
+
+	assert(f < format + formatlen);
+	(void) strncpy(s, format, len);
+
+	return ((size_t)(f - format));
+}
+
+static int
+dt_fprinta(const dtrace_aggdata_t *adp, void *arg)
+{
+	const dtrace_aggdesc_t *agg = adp->dtada_desc;
+	const dtrace_recdesc_t *recp = &agg->dtagd_rec[0];
+	uint_t nrecs = agg->dtagd_nrecs;
+	dt_pfwalk_t *pfw = arg;
+	dtrace_hdl_t *dtp = pfw->pfw_argv->pfv_dtp;
+	int id;
+
+	if (dt_printf_getint(dtp, recp++, nrecs--,
+	    adp->dtada_data, adp->dtada_size, &id) != 0 || pfw->pfw_aid != id)
+		return (0); /* no aggregation id or id does not match */
+
+	if (dt_printf_format(dtp, pfw->pfw_fp, pfw->pfw_argv,
+	    recp, nrecs, adp->dtada_data, adp->dtada_size, &adp, 1) == -1)
+		return (pfw->pfw_err = dtp->dt_errno);
+
+	/*
+	 * Cast away the const to set the bit indicating that this aggregation
+	 * has been printed.
+	 */
+	((dtrace_aggdesc_t *)agg)->dtagd_flags |= DTRACE_AGD_PRINTED;
+
+	return (0);
+}
+
+static int
+dt_fprintas(const dtrace_aggdata_t **aggsdata, int naggvars, void *arg)
+{
+	const dtrace_aggdata_t *aggdata = aggsdata[0];
+	const dtrace_aggdesc_t *agg = aggdata->dtada_desc;
+	const dtrace_recdesc_t *rec = &agg->dtagd_rec[1];
+	uint_t nrecs = agg->dtagd_nrecs - 1;
+	dt_pfwalk_t *pfw = arg;
+	dtrace_hdl_t *dtp = pfw->pfw_argv->pfv_dtp;
+	int i;
+
+	if (dt_printf_format(dtp, pfw->pfw_fp, pfw->pfw_argv,
+	    rec, nrecs, aggdata->dtada_data, aggdata->dtada_size,
+	    aggsdata, naggvars) == -1)
+		return (pfw->pfw_err = dtp->dt_errno);
+
+	/*
+	 * For each aggregation, indicate that it has been printed, casting
+	 * away the const as necessary.
+	 */
+	for (i = 1; i < naggvars; i++) {
+		agg = aggsdata[i]->dtada_desc;
+		((dtrace_aggdesc_t *)agg)->dtagd_flags |= DTRACE_AGD_PRINTED;
+	}
+
+	return (0);
+}
+/*ARGSUSED*/
+int
+dtrace_fprinta(dtrace_hdl_t *dtp, FILE *fp, void *fmtdata,
+    const dtrace_probedata_t *data, const dtrace_recdesc_t *recs,
+    uint_t nrecs, const void *buf, size_t len)
+{
+	dt_pfwalk_t pfw;
+	int i, naggvars = 0;
+	dtrace_aggvarid_t *aggvars;
+
+	aggvars = alloca(nrecs * sizeof (dtrace_aggvarid_t));
+
+	/*
+	 * This might be a printa() with multiple aggregation variables.  We
+	 * need to scan forward through the records until we find a record from
+	 * a different statement.
+	 */
+	for (i = 0; VBDTCAST(uint_t)i < nrecs; i++) {
+		const dtrace_recdesc_t *nrec = &recs[i];
+
+		if (nrec->dtrd_uarg != recs->dtrd_uarg)
+			break;
+
+		if (nrec->dtrd_action != recs->dtrd_action)
+			return (dt_set_errno(dtp, EDT_BADAGG));
+
+		aggvars[naggvars++] =
+		    /* LINTED - alignment */
+		    *((dtrace_aggvarid_t *)((caddr_t)buf + nrec->dtrd_offset));
+	}
+
+	if (naggvars == 0)
+		return (dt_set_errno(dtp, EDT_BADAGG));
+
+	pfw.pfw_argv = fmtdata;
+	pfw.pfw_fp = fp;
+	pfw.pfw_err = 0;
+
+	if (naggvars == 1) {
+		pfw.pfw_aid = aggvars[0];
+
+		if (dtrace_aggregate_walk_sorted(dtp,
+		    dt_fprinta, &pfw) == -1 || pfw.pfw_err != 0)
+			return (-1); /* errno is set for us */
+	} else {
+		if (dtrace_aggregate_walk_joined(dtp, aggvars, naggvars,
+		    dt_fprintas, &pfw) == -1 || pfw.pfw_err != 0)
+			return (-1); /* errno is set for us */
+	}
+
+	return (i);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_printf.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_printf.h
new file mode 100644
index 0000000..7f32189
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_printf.h
@@ -0,0 +1,137 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_PRINTF_H
+#define	_DT_PRINTF_H
+
+#ifndef VBOX
+# pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#endif
+#include <libctf.h>
+#include <dtrace.h>
+#include <stdio.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+struct dt_node;
+struct dt_ident;
+
+struct dt_pfconv;
+struct dt_pfargv;
+struct dt_pfargd;
+
+typedef int dt_pfcheck_f(struct dt_pfargv *,
+    struct dt_pfargd *, struct dt_node *);
+typedef int dt_pfprint_f(dtrace_hdl_t *, FILE *, const char *,
+    const struct dt_pfargd *, const void *, size_t, uint64_t);
+
+typedef struct dt_pfconv {
+	const char *pfc_name;		/* string name of input conversion */
+	const char *pfc_ofmt;		/* string name of output conversion */
+	const char *pfc_tstr;		/* string name for conversion type */
+	dt_pfcheck_f *pfc_check;	/* function to use for type checking */
+	dt_pfprint_f *pfc_print;	/* function to use for formatting */
+	ctf_file_t *pfc_cctfp;		/* CTF container for "C" defn of type */
+	ctf_id_t pfc_ctype;		/* CTF type ID for "C" defn of type */
+	ctf_file_t *pfc_dctfp;		/* CTF container for "D" defn of type */
+	ctf_id_t pfc_dtype;		/* CTF type ID for "D" defn of type */
+	struct dt_pfconv *pfc_next;	/* next conversion in hash chain */
+} dt_pfconv_t;
+
+typedef struct dt_pfdict {
+	dt_pfconv_t **pdi_buckets;	/* hash bucket array */
+	uint_t pdi_nbuckets;		/* size of hash bucket array */
+} dt_pfdict_t;
+
+typedef struct dt_pfargd {
+	const char *pfd_prefix;		/* prefix string pointer (or NULL) */
+	size_t pfd_preflen;		/* length of prefix in bytes */
+	char pfd_fmt[8];		/* output format name to use */
+	uint_t pfd_flags;		/* format flags (see below) */
+	int pfd_width;			/* field width (or 0) */
+	int pfd_dynwidth;		/* dynamic field width (or 0) */
+	int pfd_prec;			/* field precision (or 0) */
+	const dt_pfconv_t *pfd_conv;	/* conversion specification */
+	const dtrace_recdesc_t *pfd_rec; /* pointer to current record */
+	struct dt_pfargd *pfd_next;	/* pointer to next arg descriptor */
+} dt_pfargd_t;
+
+#define	DT_PFCONV_ALT		0x0001	/* alternate print format (%#) */
+#define	DT_PFCONV_ZPAD		0x0002	/* zero-pad integer field (%0) */
+#define	DT_PFCONV_LEFT		0x0004	/* left-align field (%-) */
+#define	DT_PFCONV_SPOS		0x0008	/* sign positive values (%+) */
+#define	DT_PFCONV_DYNWIDTH	0x0010	/* dynamic width (%*.) */
+#define	DT_PFCONV_DYNPREC	0x0020	/* dynamic precision (%.*) */
+#define	DT_PFCONV_GROUP		0x0040	/* group thousands (%') */
+#define	DT_PFCONV_SPACE		0x0080	/* insert leading space (% ) */
+#define	DT_PFCONV_AGG		0x0100	/* use aggregation result (%@) */
+#define	DT_PFCONV_SIGNED	0x0200	/* arg is a signed integer */
+
+typedef struct dt_pfargv {
+	dtrace_hdl_t *pfv_dtp;		/* libdtrace client handle */
+	char *pfv_format;		/* format string pointer */
+	dt_pfargd_t *pfv_argv;		/* list of argument descriptors */
+	uint_t pfv_argc;		/* number of argument descriptors */
+	uint_t pfv_flags;		/* flags used for validation */
+} dt_pfargv_t;
+
+typedef struct dt_pfwalk {
+	const dt_pfargv_t *pfw_argv;	/* argument description list */
+	uint_t pfw_aid;			/* aggregation variable identifier */
+	FILE *pfw_fp;			/* file pointer to use for output */
+	int pfw_err;			/* error status code */
+} dt_pfwalk_t;
+
+extern int dt_pfdict_create(dtrace_hdl_t *);
+extern void dt_pfdict_destroy(dtrace_hdl_t *);
+
+extern dt_pfargv_t *dt_printf_create(dtrace_hdl_t *, const char *);
+extern void dt_printf_destroy(dt_pfargv_t *);
+
+#define	DT_PRINTF_EXACTLEN	0x1	/* do not permit extra arguments */
+#define	DT_PRINTF_AGGREGATION	0x2	/* enable aggregation conversion */
+
+extern void dt_printf_validate(dt_pfargv_t *, uint_t,
+    struct dt_ident *, int, dtrace_actkind_t, struct dt_node *);
+
+extern void dt_printa_validate(struct dt_node *, struct dt_node *);
+
+extern int dt_print_stack(dtrace_hdl_t *, FILE *,
+    const char *, caddr_t, int, int);
+extern int dt_print_ustack(dtrace_hdl_t *, FILE *,
+    const char *, caddr_t, uint64_t);
+extern int dt_print_mod(dtrace_hdl_t *, FILE *, const char *, caddr_t);
+extern int dt_print_umod(dtrace_hdl_t *, FILE *, const char *, caddr_t);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_PRINTF_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.c
new file mode 100644
index 0000000..5a46ee3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.c
@@ -0,0 +1,1111 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * DTrace Process Control
+ *
+ * This file provides a set of routines that permit libdtrace and its clients
+ * to create and grab process handles using libproc, and to share these handles
+ * between library mechanisms that need libproc access, such as ustack(), and
+ * client mechanisms that need libproc access, such as dtrace(1M) -c and -p.
+ * The library provides several mechanisms in the libproc control layer:
+ *
+ * Reference Counting: The library code and client code can independently grab
+ * the same process handles without interfering with one another.  Only when
+ * the reference count drops to zero and the handle is not being cached (see
+ * below for more information on caching) will Prelease() be called on it.
+ *
+ * Handle Caching: If a handle is grabbed PGRAB_RDONLY (e.g. by ustack()) and
+ * the reference count drops to zero, the handle is not immediately released.
+ * Instead, libproc handles are maintained on dph_lrulist in order from most-
+ * recently accessed to least-recently accessed.  Idle handles are maintained
+ * until a pre-defined LRU cache limit is exceeded, permitting repeated calls
+ * to ustack() to avoid the overhead of releasing and re-grabbing processes.
+ *
+ * Process Control: For processes that are grabbed for control (~PGRAB_RDONLY)
+ * or created by dt_proc_create(), a control thread is created to provide
+ * callbacks on process exit and symbol table caching on dlopen()s.
+ *
+ * MT-Safety: Libproc is not MT-Safe, so dt_proc_lock() and dt_proc_unlock()
+ * are provided to synchronize access to the libproc handle between libdtrace
+ * code and client code and the control thread's use of the ps_prochandle.
+ *
+ * NOTE: MT-Safety is NOT provided for libdtrace itself, or for use of the
+ * dtrace_proc_grab/dtrace_proc_create mechanisms.  Like all exported libdtrace
+ * calls, these are assumed to be MT-Unsafe.  MT-Safety is ONLY provided for
+ * synchronization between libdtrace control threads and the client thread.
+ *
+ * The ps_prochandles themselves are maintained along with a dt_proc_t struct
+ * in a hash table indexed by PID.  This provides basic locking and reference
+ * counting.  The dt_proc_t is also maintained in LRU order on dph_lrulist.
+ * The dph_lrucnt and dph_lrulim count the number of cacheable processes and
+ * the current limit on the number of actively cached entries.
+ *
+ * The control thread for a process establishes breakpoints at the rtld_db
+ * locations of interest, updates mappings and symbol tables at these points,
+ * and handles exec and fork (by always following the parent).  The control
+ * thread automatically exits when the process dies or control is lost.
+ *
+ * A simple notification mechanism is provided for libdtrace clients using
+ * dtrace_handle_proc() for notification of PS_UNDEAD or PS_LOST events.  If
+ * such an event occurs, the dt_proc_t itself is enqueued on a notification
+ * list and the control thread broadcasts to dph_cv.  dtrace_sleep() will wake
+ * up using this condition and will then call the client handler as necessary.
+ */
+
+#ifndef VBOX
+#include <sys/wait.h>
+#include <sys/lwp.h>
+#include <strings.h>
+#include <signal.h>
+#include <assert.h>
+#include <errno.h>
+#endif
+
+#include <dt_proc.h>
+#include <dt_pid.h>
+#include <dt_impl.h>
+
+#ifndef VBOX
+
+#define	IS_SYS_EXEC(w)	(w == SYS_execve)
+#define	IS_SYS_FORK(w)	(w == SYS_vfork || w == SYS_forksys)
+
+static dt_bkpt_t *
+dt_proc_bpcreate(dt_proc_t *dpr, uintptr_t addr, dt_bkpt_f *func, void *data)
+{
+	struct ps_prochandle *P = dpr->dpr_proc;
+	dt_bkpt_t *dbp;
+
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+
+	if ((dbp = dt_zalloc(dpr->dpr_hdl, sizeof (dt_bkpt_t))) != NULL) {
+		dbp->dbp_func = func;
+		dbp->dbp_data = data;
+		dbp->dbp_addr = addr;
+
+		if (Psetbkpt(P, dbp->dbp_addr, &dbp->dbp_instr) == 0)
+			dbp->dbp_active = B_TRUE;
+
+		dt_list_append(&dpr->dpr_bps, dbp);
+	}
+
+	return (dbp);
+}
+
+static void
+dt_proc_bpdestroy(dt_proc_t *dpr, int delbkpts)
+{
+	int state = Pstate(dpr->dpr_proc);
+	dt_bkpt_t *dbp, *nbp;
+
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+
+	for (dbp = dt_list_next(&dpr->dpr_bps); dbp != NULL; dbp = nbp) {
+		if (delbkpts && dbp->dbp_active &&
+		    state != PS_LOST && state != PS_UNDEAD) {
+			(void) Pdelbkpt(dpr->dpr_proc,
+			    dbp->dbp_addr, dbp->dbp_instr);
+		}
+		nbp = dt_list_next(dbp);
+		dt_list_delete(&dpr->dpr_bps, dbp);
+		dt_free(dpr->dpr_hdl, dbp);
+	}
+}
+
+static void
+dt_proc_bpmatch(dtrace_hdl_t *dtp, dt_proc_t *dpr)
+{
+	const lwpstatus_t *psp = &Pstatus(dpr->dpr_proc)->pr_lwp;
+	dt_bkpt_t *dbp;
+
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+
+	for (dbp = dt_list_next(&dpr->dpr_bps);
+	    dbp != NULL; dbp = dt_list_next(dbp)) {
+		if (psp->pr_reg[R_PC] == dbp->dbp_addr)
+			break;
+	}
+
+	if (dbp == NULL) {
+		dt_dprintf("pid %d: spurious breakpoint wakeup for %lx\n",
+		    (int)dpr->dpr_pid, (ulong_t)psp->pr_reg[R_PC]);
+		return;
+	}
+
+	dt_dprintf("pid %d: hit breakpoint at %lx (%lu)\n",
+	    (int)dpr->dpr_pid, (ulong_t)dbp->dbp_addr, ++dbp->dbp_hits);
+
+	dbp->dbp_func(dtp, dpr, dbp->dbp_data);
+	(void) Pxecbkpt(dpr->dpr_proc, dbp->dbp_instr);
+}
+
+static void
+dt_proc_bpenable(dt_proc_t *dpr)
+{
+	dt_bkpt_t *dbp;
+
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+
+	for (dbp = dt_list_next(&dpr->dpr_bps);
+	    dbp != NULL; dbp = dt_list_next(dbp)) {
+		if (!dbp->dbp_active && Psetbkpt(dpr->dpr_proc,
+		    dbp->dbp_addr, &dbp->dbp_instr) == 0)
+			dbp->dbp_active = B_TRUE;
+	}
+
+	dt_dprintf("breakpoints enabled\n");
+}
+
+static void
+dt_proc_bpdisable(dt_proc_t *dpr)
+{
+	dt_bkpt_t *dbp;
+
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+
+	for (dbp = dt_list_next(&dpr->dpr_bps);
+	    dbp != NULL; dbp = dt_list_next(dbp)) {
+		if (dbp->dbp_active && Pdelbkpt(dpr->dpr_proc,
+		    dbp->dbp_addr, dbp->dbp_instr) == 0)
+			dbp->dbp_active = B_FALSE;
+	}
+
+	dt_dprintf("breakpoints disabled\n");
+}
+
+static void
+dt_proc_notify(dtrace_hdl_t *dtp, dt_proc_hash_t *dph, dt_proc_t *dpr,
+    const char *msg)
+{
+	dt_proc_notify_t *dprn = dt_alloc(dtp, sizeof (dt_proc_notify_t));
+
+	if (dprn == NULL) {
+		dt_dprintf("failed to allocate notification for %d %s\n",
+		    (int)dpr->dpr_pid, msg);
+	} else {
+		dprn->dprn_dpr = dpr;
+		if (msg == NULL)
+			dprn->dprn_errmsg[0] = '\0';
+		else
+			(void) strlcpy(dprn->dprn_errmsg, msg,
+			    sizeof (dprn->dprn_errmsg));
+
+		(void) pthread_mutex_lock(&dph->dph_lock);
+
+		dprn->dprn_next = dph->dph_notify;
+		dph->dph_notify = dprn;
+
+		(void) pthread_cond_broadcast(&dph->dph_cv);
+		(void) pthread_mutex_unlock(&dph->dph_lock);
+	}
+}
+
+/*
+ * Check to see if the control thread was requested to stop when the victim
+ * process reached a particular event (why) rather than continuing the victim.
+ * If 'why' is set in the stop mask, we wait on dpr_cv for dt_proc_continue().
+ * If 'why' is not set, this function returns immediately and does nothing.
+ */
+static void
+dt_proc_stop(dt_proc_t *dpr, uint8_t why)
+{
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+	assert(why != DT_PROC_STOP_IDLE);
+
+	if (dpr->dpr_stop & why) {
+		dpr->dpr_stop |= DT_PROC_STOP_IDLE;
+		dpr->dpr_stop &= ~why;
+
+		(void) pthread_cond_broadcast(&dpr->dpr_cv);
+
+		/*
+		 * We disable breakpoints while stopped to preserve the
+		 * integrity of the program text for both our own disassembly
+		 * and that of the kernel.
+		 */
+		dt_proc_bpdisable(dpr);
+
+		while (dpr->dpr_stop & DT_PROC_STOP_IDLE)
+			(void) pthread_cond_wait(&dpr->dpr_cv, &dpr->dpr_lock);
+
+		dt_proc_bpenable(dpr);
+	}
+}
+
+/*ARGSUSED*/
+static void
+dt_proc_bpmain(dtrace_hdl_t *dtp, dt_proc_t *dpr, const char *fname)
+{
+	dt_dprintf("pid %d: breakpoint at %s()\n", (int)dpr->dpr_pid, fname);
+	dt_proc_stop(dpr, DT_PROC_STOP_MAIN);
+}
+
+static void
+dt_proc_rdevent(dtrace_hdl_t *dtp, dt_proc_t *dpr, const char *evname)
+{
+	rd_event_msg_t rdm;
+	rd_err_e err;
+
+	if ((err = rd_event_getmsg(dpr->dpr_rtld, &rdm)) != RD_OK) {
+		dt_dprintf("pid %d: failed to get %s event message: %s\n",
+		    (int)dpr->dpr_pid, evname, rd_errstr(err));
+		return;
+	}
+
+	dt_dprintf("pid %d: rtld event %s type=%d state %d\n",
+	    (int)dpr->dpr_pid, evname, rdm.type, rdm.u.state);
+
+	switch (rdm.type) {
+	case RD_DLACTIVITY:
+		if (rdm.u.state != RD_CONSISTENT)
+			break;
+
+		Pupdate_syms(dpr->dpr_proc);
+		if (dt_pid_create_probes_module(dtp, dpr) != 0)
+			dt_proc_notify(dtp, dtp->dt_procs, dpr,
+			    dpr->dpr_errmsg);
+
+		break;
+	case RD_PREINIT:
+		Pupdate_syms(dpr->dpr_proc);
+		dt_proc_stop(dpr, DT_PROC_STOP_PREINIT);
+		break;
+	case RD_POSTINIT:
+		Pupdate_syms(dpr->dpr_proc);
+		dt_proc_stop(dpr, DT_PROC_STOP_POSTINIT);
+		break;
+	}
+}
+
+static void
+dt_proc_rdwatch(dt_proc_t *dpr, rd_event_e event, const char *evname)
+{
+	rd_notify_t rdn;
+	rd_err_e err;
+
+	if ((err = rd_event_addr(dpr->dpr_rtld, event, &rdn)) != RD_OK) {
+		dt_dprintf("pid %d: failed to get event address for %s: %s\n",
+		    (int)dpr->dpr_pid, evname, rd_errstr(err));
+		return;
+	}
+
+	if (rdn.type != RD_NOTIFY_BPT) {
+		dt_dprintf("pid %d: event %s has unexpected type %d\n",
+		    (int)dpr->dpr_pid, evname, rdn.type);
+		return;
+	}
+
+	(void) dt_proc_bpcreate(dpr, rdn.u.bptaddr,
+	    (dt_bkpt_f *)dt_proc_rdevent, (void *)evname);
+}
+
+/*
+ * Common code for enabling events associated with the run-time linker after
+ * attaching to a process or after a victim process completes an exec(2).
+ */
+static void
+dt_proc_attach(dt_proc_t *dpr, int exec)
+{
+	const pstatus_t *psp = Pstatus(dpr->dpr_proc);
+	rd_err_e err;
+	GElf_Sym sym;
+
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+
+	if (exec) {
+		if (psp->pr_lwp.pr_errno != 0)
+			return; /* exec failed: nothing needs to be done */
+
+		dt_proc_bpdestroy(dpr, B_FALSE);
+		Preset_maps(dpr->dpr_proc);
+	}
+
+	if ((dpr->dpr_rtld = Prd_agent(dpr->dpr_proc)) != NULL &&
+	    (err = rd_event_enable(dpr->dpr_rtld, B_TRUE)) == RD_OK) {
+		dt_proc_rdwatch(dpr, RD_PREINIT, "RD_PREINIT");
+		dt_proc_rdwatch(dpr, RD_POSTINIT, "RD_POSTINIT");
+		dt_proc_rdwatch(dpr, RD_DLACTIVITY, "RD_DLACTIVITY");
+	} else {
+		dt_dprintf("pid %d: failed to enable rtld events: %s\n",
+		    (int)dpr->dpr_pid, dpr->dpr_rtld ? rd_errstr(err) :
+		    "rtld_db agent initialization failed");
+	}
+
+	Pupdate_maps(dpr->dpr_proc);
+
+	if (Pxlookup_by_name(dpr->dpr_proc, LM_ID_BASE,
+	    "a.out", "main", &sym, NULL) == 0) {
+		(void) dt_proc_bpcreate(dpr, (uintptr_t)sym.st_value,
+		    (dt_bkpt_f *)dt_proc_bpmain, "a.out`main");
+	} else {
+		dt_dprintf("pid %d: failed to find a.out`main: %s\n",
+		    (int)dpr->dpr_pid, strerror(errno));
+	}
+}
+
+/*
+ * Wait for a stopped process to be set running again by some other debugger.
+ * This is typically not required by /proc-based debuggers, since the usual
+ * model is that one debugger controls one victim.  But DTrace, as usual, has
+ * its own needs: the stop() action assumes that prun(1) or some other tool
+ * will be applied to resume the victim process.  This could be solved by
+ * adding a PCWRUN directive to /proc, but that seems like overkill unless
+ * other debuggers end up needing this functionality, so we implement a cheap
+ * equivalent to PCWRUN using the set of existing kernel mechanisms.
+ *
+ * Our intent is really not just to wait for the victim to run, but rather to
+ * wait for it to run and then stop again for a reason other than the current
+ * PR_REQUESTED stop.  Since PCWSTOP/Pstopstatus() can be applied repeatedly
+ * to a stopped process and will return the same result without affecting the
+ * victim, we can just perform these operations repeatedly until Pstate()
+ * changes, the representative LWP ID changes, or the stop timestamp advances.
+ * dt_proc_control() will then rediscover the new state and continue as usual.
+ * When the process is still stopped in the same exact state, we sleep for a
+ * brief interval before waiting again so as not to spin consuming CPU cycles.
+ */
+static void
+dt_proc_waitrun(dt_proc_t *dpr)
+{
+	struct ps_prochandle *P = dpr->dpr_proc;
+	const lwpstatus_t *psp = &Pstatus(P)->pr_lwp;
+
+	int krflag = psp->pr_flags & (PR_KLC | PR_RLC);
+	timestruc_t tstamp = psp->pr_tstamp;
+	lwpid_t lwpid = psp->pr_lwpid;
+
+	const long wstop = PCWSTOP;
+	int pfd = Pctlfd(P);
+
+	assert(MUTEX_HELD(&dpr->dpr_lock));
+	assert(psp->pr_flags & PR_STOPPED);
+	assert(Pstate(P) == PS_STOP);
+
+	/*
+	 * While we are waiting for the victim to run, clear PR_KLC and PR_RLC
+	 * so that if the libdtrace client is killed, the victim stays stopped.
+	 * dt_proc_destroy() will also observe this and perform PRELEASE_HANG.
+	 */
+	(void) Punsetflags(P, krflag);
+	Psync(P);
+
+	(void) pthread_mutex_unlock(&dpr->dpr_lock);
+
+	while (!dpr->dpr_quit) {
+		if (write(pfd, &wstop, sizeof (wstop)) == -1 && errno == EINTR)
+			continue; /* check dpr_quit and continue waiting */
+
+		(void) pthread_mutex_lock(&dpr->dpr_lock);
+		(void) Pstopstatus(P, PCNULL, 0);
+		psp = &Pstatus(P)->pr_lwp;
+
+		/*
+		 * If we've reached a new state, found a new representative, or
+		 * the stop timestamp has changed, restore PR_KLC/PR_RLC to its
+		 * original setting and then return with dpr_lock held.
+		 */
+		if (Pstate(P) != PS_STOP || psp->pr_lwpid != lwpid ||
+		    bcmp(&psp->pr_tstamp, &tstamp, sizeof (tstamp)) != 0) {
+			(void) Psetflags(P, krflag);
+			Psync(P);
+			return;
+		}
+
+		(void) pthread_mutex_unlock(&dpr->dpr_lock);
+		(void) poll(NULL, 0, MILLISEC / 2);
+	}
+
+	(void) pthread_mutex_lock(&dpr->dpr_lock);
+}
+
+typedef struct dt_proc_control_data {
+	dtrace_hdl_t *dpcd_hdl;			/* DTrace handle */
+	dt_proc_t *dpcd_proc;			/* proccess to control */
+} dt_proc_control_data_t;
+
+/*
+ * Main loop for all victim process control threads.  We initialize all the
+ * appropriate /proc control mechanisms, and then enter a loop waiting for
+ * the process to stop on an event or die.  We process any events by calling
+ * appropriate subroutines, and exit when the victim dies or we lose control.
+ *
+ * The control thread synchronizes the use of dpr_proc with other libdtrace
+ * threads using dpr_lock.  We hold the lock for all of our operations except
+ * waiting while the process is running: this is accomplished by writing a
+ * PCWSTOP directive directly to the underlying /proc/<pid>/ctl file.  If the
+ * libdtrace client wishes to exit or abort our wait, SIGCANCEL can be used.
+ */
+static void *
+dt_proc_control(void *arg)
+{
+	dt_proc_control_data_t *datap = arg;
+	dtrace_hdl_t *dtp = datap->dpcd_hdl;
+	dt_proc_t *dpr = datap->dpcd_proc;
+	dt_proc_hash_t *dph = dpr->dpr_hdl->dt_procs;
+	struct ps_prochandle *P = dpr->dpr_proc;
+
+	int pfd = Pctlfd(P);
+	int pid = dpr->dpr_pid;
+
+	const long wstop = PCWSTOP;
+	int notify = B_FALSE;
+
+	/*
+	 * We disable the POSIX thread cancellation mechanism so that the
+	 * client program using libdtrace can't accidentally cancel our thread.
+	 * dt_proc_destroy() uses SIGCANCEL explicitly to simply poke us out
+	 * of PCWSTOP with EINTR, at which point we will see dpr_quit and exit.
+	 */
+	(void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
+
+	/*
+	 * Set up the corresponding process for tracing by libdtrace.  We want
+	 * to be able to catch breakpoints and efficiently single-step over
+	 * them, and we need to enable librtld_db to watch libdl activity.
+	 */
+	(void) pthread_mutex_lock(&dpr->dpr_lock);
+
+	(void) Punsetflags(P, PR_ASYNC);	/* require synchronous mode */
+	(void) Psetflags(P, PR_BPTADJ);		/* always adjust eip on x86 */
+	(void) Punsetflags(P, PR_FORK);		/* do not inherit on fork */
+
+	(void) Pfault(P, FLTBPT, B_TRUE);	/* always trace breakpoints */
+	(void) Pfault(P, FLTTRACE, B_TRUE);	/* always trace single-step */
+
+	/*
+	 * We must trace exit from exec() system calls so that if the exec is
+	 * successful, we can reset our breakpoints and re-initialize libproc.
+	 */
+	(void) Psysexit(P, SYS_execve, B_TRUE);
+
+	/*
+	 * We must trace entry and exit for fork() system calls in order to
+	 * disable our breakpoints temporarily during the fork.  We do not set
+	 * the PR_FORK flag, so if fork succeeds the child begins executing and
+	 * does not inherit any other tracing behaviors or a control thread.
+	 */
+	(void) Psysentry(P, SYS_vfork, B_TRUE);
+	(void) Psysexit(P, SYS_vfork, B_TRUE);
+	(void) Psysentry(P, SYS_forksys, B_TRUE);
+	(void) Psysexit(P, SYS_forksys, B_TRUE);
+
+	Psync(P);				/* enable all /proc changes */
+	dt_proc_attach(dpr, B_FALSE);		/* enable rtld breakpoints */
+
+	/*
+	 * If PR_KLC is set, we created the process; otherwise we grabbed it.
+	 * Check for an appropriate stop request and wait for dt_proc_continue.
+	 */
+	if (Pstatus(P)->pr_flags & PR_KLC)
+		dt_proc_stop(dpr, DT_PROC_STOP_CREATE);
+	else
+		dt_proc_stop(dpr, DT_PROC_STOP_GRAB);
+
+	if (Psetrun(P, 0, 0) == -1) {
+		dt_dprintf("pid %d: failed to set running: %s\n",
+		    (int)dpr->dpr_pid, strerror(errno));
+	}
+
+	(void) pthread_mutex_unlock(&dpr->dpr_lock);
+
+	/*
+	 * Wait for the process corresponding to this control thread to stop,
+	 * process the event, and then set it running again.  We want to sleep
+	 * with dpr_lock *unheld* so that other parts of libdtrace can use the
+	 * ps_prochandle in the meantime (e.g. ustack()).  To do this, we write
+	 * a PCWSTOP directive directly to the underlying /proc/<pid>/ctl file.
+	 * Once the process stops, we wake up, grab dpr_lock, and then call
+	 * Pwait() (which will return immediately) and do our processing.
+	 */
+	while (!dpr->dpr_quit) {
+		const lwpstatus_t *psp;
+
+		if (write(pfd, &wstop, sizeof (wstop)) == -1 && errno == EINTR)
+			continue; /* check dpr_quit and continue waiting */
+
+		(void) pthread_mutex_lock(&dpr->dpr_lock);
+pwait_locked:
+		if (Pstopstatus(P, PCNULL, 0) == -1 && errno == EINTR) {
+			(void) pthread_mutex_unlock(&dpr->dpr_lock);
+			continue; /* check dpr_quit and continue waiting */
+		}
+
+		switch (Pstate(P)) {
+		case PS_STOP:
+			psp = &Pstatus(P)->pr_lwp;
+
+			dt_dprintf("pid %d: proc stopped showing %d/%d\n",
+			    pid, psp->pr_why, psp->pr_what);
+
+			/*
+			 * If the process stops showing PR_REQUESTED, then the
+			 * DTrace stop() action was applied to it or another
+			 * debugging utility (e.g. pstop(1)) asked it to stop.
+			 * In either case, the user's intention is for the
+			 * process to remain stopped until another external
+			 * mechanism (e.g. prun(1)) is applied.  So instead of
+			 * setting the process running ourself, we wait for
+			 * someone else to do so.  Once that happens, we return
+			 * to our normal loop waiting for an event of interest.
+			 */
+			if (psp->pr_why == PR_REQUESTED) {
+				dt_proc_waitrun(dpr);
+				(void) pthread_mutex_unlock(&dpr->dpr_lock);
+				continue;
+			}
+
+			/*
+			 * If the process stops showing one of the events that
+			 * we are tracing, perform the appropriate response.
+			 * Note that we ignore PR_SUSPENDED, PR_CHECKPOINT, and
+			 * PR_JOBCONTROL by design: if one of these conditions
+			 * occurs, we will fall through to Psetrun() but the
+			 * process will remain stopped in the kernel by the
+			 * corresponding mechanism (e.g. job control stop).
+			 */
+			if (psp->pr_why == PR_FAULTED && psp->pr_what == FLTBPT)
+				dt_proc_bpmatch(dtp, dpr);
+			else if (psp->pr_why == PR_SYSENTRY &&
+			    IS_SYS_FORK(psp->pr_what))
+				dt_proc_bpdisable(dpr);
+			else if (psp->pr_why == PR_SYSEXIT &&
+			    IS_SYS_FORK(psp->pr_what))
+				dt_proc_bpenable(dpr);
+			else if (psp->pr_why == PR_SYSEXIT &&
+			    IS_SYS_EXEC(psp->pr_what))
+				dt_proc_attach(dpr, B_TRUE);
+			break;
+
+		case PS_LOST:
+			if (Preopen(P) == 0)
+				goto pwait_locked;
+
+			dt_dprintf("pid %d: proc lost: %s\n",
+			    pid, strerror(errno));
+
+			dpr->dpr_quit = B_TRUE;
+			notify = B_TRUE;
+			break;
+
+		case PS_UNDEAD:
+			dt_dprintf("pid %d: proc died\n", pid);
+			dpr->dpr_quit = B_TRUE;
+			notify = B_TRUE;
+			break;
+		}
+
+		if (Pstate(P) != PS_UNDEAD && Psetrun(P, 0, 0) == -1) {
+			dt_dprintf("pid %d: failed to set running: %s\n",
+			    (int)dpr->dpr_pid, strerror(errno));
+		}
+
+		(void) pthread_mutex_unlock(&dpr->dpr_lock);
+	}
+
+	/*
+	 * If the control thread detected PS_UNDEAD or PS_LOST, then enqueue
+	 * the dt_proc_t structure on the dt_proc_hash_t notification list.
+	 */
+	if (notify)
+		dt_proc_notify(dtp, dph, dpr, NULL);
+
+	/*
+	 * Destroy and remove any remaining breakpoints, set dpr_done and clear
+	 * dpr_tid to indicate the control thread has exited, and notify any
+	 * waiting thread in dt_proc_destroy() that we have succesfully exited.
+	 */
+	(void) pthread_mutex_lock(&dpr->dpr_lock);
+
+	dt_proc_bpdestroy(dpr, B_TRUE);
+	dpr->dpr_done = B_TRUE;
+	dpr->dpr_tid = 0;
+
+	(void) pthread_cond_broadcast(&dpr->dpr_cv);
+	(void) pthread_mutex_unlock(&dpr->dpr_lock);
+
+	return (NULL);
+}
+
+/*PRINTFLIKE3*/
+static struct ps_prochandle *
+dt_proc_error(dtrace_hdl_t *dtp, dt_proc_t *dpr, const char *format, ...)
+{
+	va_list ap;
+
+	va_start(ap, format);
+	dt_set_errmsg(dtp, NULL, NULL, NULL, 0, format, ap);
+	va_end(ap);
+
+	if (dpr->dpr_proc != NULL)
+		Prelease(dpr->dpr_proc, 0);
+
+	dt_free(dtp, dpr);
+	(void) dt_set_errno(dtp, EDT_COMPILER);
+	return (NULL);
+}
+
+dt_proc_t *
+dt_proc_lookup(dtrace_hdl_t *dtp, struct ps_prochandle *P, int remove)
+{
+	dt_proc_hash_t *dph = dtp->dt_procs;
+	pid_t pid = Pstatus(P)->pr_pid;
+	dt_proc_t *dpr, **dpp = &dph->dph_hash[pid & (dph->dph_hashlen - 1)];
+
+	for (dpr = *dpp; dpr != NULL; dpr = dpr->dpr_hash) {
+		if (dpr->dpr_pid == pid)
+			break;
+		else
+			dpp = &dpr->dpr_hash;
+	}
+
+	assert(dpr != NULL);
+	assert(dpr->dpr_proc == P);
+
+	if (remove)
+		*dpp = dpr->dpr_hash; /* remove from pid hash chain */
+
+	return (dpr);
+}
+
+static void
+dt_proc_destroy(dtrace_hdl_t *dtp, struct ps_prochandle *P)
+{
+	dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_FALSE);
+	dt_proc_hash_t *dph = dtp->dt_procs;
+	dt_proc_notify_t *npr, **npp;
+	int rflag;
+
+	assert(dpr != NULL);
+
+	/*
+	 * If neither PR_KLC nor PR_RLC is set, then the process is stopped by
+	 * an external debugger and we were waiting in dt_proc_waitrun().
+	 * Leave the process in this condition using PRELEASE_HANG.
+	 */
+	if (!(Pstatus(dpr->dpr_proc)->pr_flags & (PR_KLC | PR_RLC))) {
+		dt_dprintf("abandoning pid %d\n", (int)dpr->dpr_pid);
+		rflag = PRELEASE_HANG;
+	} else if (Pstatus(dpr->dpr_proc)->pr_flags & PR_KLC) {
+		dt_dprintf("killing pid %d\n", (int)dpr->dpr_pid);
+		rflag = PRELEASE_KILL; /* apply kill-on-last-close */
+	} else {
+		dt_dprintf("releasing pid %d\n", (int)dpr->dpr_pid);
+		rflag = 0; /* apply run-on-last-close */
+	}
+
+	if (dpr->dpr_tid) {
+		/*
+		 * Set the dpr_quit flag to tell the daemon thread to exit.  We
+		 * send it a SIGCANCEL to poke it out of PCWSTOP or any other
+		 * long-term /proc system call.  Our daemon threads have POSIX
+		 * cancellation disabled, so EINTR will be the only effect.  We
+		 * then wait for dpr_done to indicate the thread has exited.
+		 *
+		 * We can't use pthread_kill() to send SIGCANCEL because the
+		 * interface forbids it and we can't use pthread_cancel()
+		 * because with cancellation disabled it won't actually
+		 * send SIGCANCEL to the target thread, so we use _lwp_kill()
+		 * to do the job.  This is all built on evil knowledge of
+		 * the details of the cancellation mechanism in libc.
+		 */
+		(void) pthread_mutex_lock(&dpr->dpr_lock);
+		dpr->dpr_quit = B_TRUE;
+		(void) _lwp_kill(dpr->dpr_tid, SIGCANCEL);
+
+		/*
+		 * If the process is currently idling in dt_proc_stop(), re-
+		 * enable breakpoints and poke it into running again.
+		 */
+		if (dpr->dpr_stop & DT_PROC_STOP_IDLE) {
+			dt_proc_bpenable(dpr);
+			dpr->dpr_stop &= ~DT_PROC_STOP_IDLE;
+			(void) pthread_cond_broadcast(&dpr->dpr_cv);
+		}
+
+		while (!dpr->dpr_done)
+			(void) pthread_cond_wait(&dpr->dpr_cv, &dpr->dpr_lock);
+
+		(void) pthread_mutex_unlock(&dpr->dpr_lock);
+	}
+
+	/*
+	 * Before we free the process structure, remove this dt_proc_t from the
+	 * lookup hash, and then walk the dt_proc_hash_t's notification list
+	 * and remove this dt_proc_t if it is enqueued.
+	 */
+	(void) pthread_mutex_lock(&dph->dph_lock);
+	(void) dt_proc_lookup(dtp, P, B_TRUE);
+	npp = &dph->dph_notify;
+
+	while ((npr = *npp) != NULL) {
+		if (npr->dprn_dpr == dpr) {
+			*npp = npr->dprn_next;
+			dt_free(dtp, npr);
+		} else {
+			npp = &npr->dprn_next;
+		}
+	}
+
+	(void) pthread_mutex_unlock(&dph->dph_lock);
+
+	/*
+	 * Remove the dt_proc_list from the LRU list, release the underlying
+	 * libproc handle, and free our dt_proc_t data structure.
+	 */
+	if (dpr->dpr_cacheable) {
+		assert(dph->dph_lrucnt != 0);
+		dph->dph_lrucnt--;
+	}
+
+	dt_list_delete(&dph->dph_lrulist, dpr);
+	Prelease(dpr->dpr_proc, rflag);
+	dt_free(dtp, dpr);
+}
+
+static int
+dt_proc_create_thread(dtrace_hdl_t *dtp, dt_proc_t *dpr, uint_t stop)
+{
+	dt_proc_control_data_t data;
+	sigset_t nset, oset;
+	pthread_attr_t a;
+	int err;
+
+	(void) pthread_mutex_lock(&dpr->dpr_lock);
+	dpr->dpr_stop |= stop; /* set bit for initial rendezvous */
+
+	(void) pthread_attr_init(&a);
+	(void) pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
+
+	(void) sigfillset(&nset);
+	(void) sigdelset(&nset, SIGABRT);	/* unblocked for assert() */
+	(void) sigdelset(&nset, SIGCANCEL);	/* see dt_proc_destroy() */
+
+	data.dpcd_hdl = dtp;
+	data.dpcd_proc = dpr;
+
+	(void) pthread_sigmask(SIG_SETMASK, &nset, &oset);
+	err = pthread_create(&dpr->dpr_tid, &a, dt_proc_control, &data);
+	(void) pthread_sigmask(SIG_SETMASK, &oset, NULL);
+
+	/*
+	 * If the control thread was created, then wait on dpr_cv for either
+	 * dpr_done to be set (the victim died or the control thread failed)
+	 * or DT_PROC_STOP_IDLE to be set, indicating that the victim is now
+	 * stopped by /proc and the control thread is at the rendezvous event.
+	 * On success, we return with the process and control thread stopped:
+	 * the caller can then apply dt_proc_continue() to resume both.
+	 */
+	if (err == 0) {
+		while (!dpr->dpr_done && !(dpr->dpr_stop & DT_PROC_STOP_IDLE))
+			(void) pthread_cond_wait(&dpr->dpr_cv, &dpr->dpr_lock);
+
+		/*
+		 * If dpr_done is set, the control thread aborted before it
+		 * reached the rendezvous event.  This is either due to PS_LOST
+		 * or PS_UNDEAD (i.e. the process died).  We try to provide a
+		 * small amount of useful information to help figure it out.
+		 */
+		if (dpr->dpr_done) {
+			const psinfo_t *prp = Ppsinfo(dpr->dpr_proc);
+			int stat = prp ? prp->pr_wstat : 0;
+			int pid = dpr->dpr_pid;
+
+			if (Pstate(dpr->dpr_proc) == PS_LOST) {
+				(void) dt_proc_error(dpr->dpr_hdl, dpr,
+				    "failed to control pid %d: process exec'd "
+				    "set-id or unobservable program\n", pid);
+			} else if (WIFSIGNALED(stat)) {
+				(void) dt_proc_error(dpr->dpr_hdl, dpr,
+				    "failed to control pid %d: process died "
+				    "from signal %d\n", pid, WTERMSIG(stat));
+			} else {
+				(void) dt_proc_error(dpr->dpr_hdl, dpr,
+				    "failed to control pid %d: process exited "
+				    "with status %d\n", pid, WEXITSTATUS(stat));
+			}
+
+			err = ESRCH; /* cause grab() or create() to fail */
+		}
+	} else {
+		(void) dt_proc_error(dpr->dpr_hdl, dpr,
+		    "failed to create control thread for process-id %d: %s\n",
+		    (int)dpr->dpr_pid, strerror(err));
+	}
+
+	(void) pthread_mutex_unlock(&dpr->dpr_lock);
+	(void) pthread_attr_destroy(&a);
+
+	return (err);
+}
+
+struct ps_prochandle *
+dt_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
+{
+	dt_proc_hash_t *dph = dtp->dt_procs;
+	dt_proc_t *dpr;
+	int err;
+
+	if ((dpr = dt_zalloc(dtp, sizeof (dt_proc_t))) == NULL)
+		return (NULL); /* errno is set for us */
+
+	(void) pthread_mutex_init(&dpr->dpr_lock, NULL);
+	(void) pthread_cond_init(&dpr->dpr_cv, NULL);
+
+	if ((dpr->dpr_proc = Pcreate(file, argv, &err, NULL, 0)) == NULL) {
+		return (dt_proc_error(dtp, dpr,
+		    "failed to execute %s: %s\n", file, Pcreate_error(err)));
+	}
+
+	dpr->dpr_hdl = dtp;
+	dpr->dpr_pid = Pstatus(dpr->dpr_proc)->pr_pid;
+
+	(void) Punsetflags(dpr->dpr_proc, PR_RLC);
+	(void) Psetflags(dpr->dpr_proc, PR_KLC);
+
+	if (dt_proc_create_thread(dtp, dpr, dtp->dt_prcmode) != 0)
+		return (NULL); /* dt_proc_error() has been called for us */
+
+	dpr->dpr_hash = dph->dph_hash[dpr->dpr_pid & (dph->dph_hashlen - 1)];
+	dph->dph_hash[dpr->dpr_pid & (dph->dph_hashlen - 1)] = dpr;
+	dt_list_prepend(&dph->dph_lrulist, dpr);
+
+	dt_dprintf("created pid %d\n", (int)dpr->dpr_pid);
+	dpr->dpr_refs++;
+
+	return (dpr->dpr_proc);
+}
+
+struct ps_prochandle *
+dt_proc_grab(dtrace_hdl_t *dtp, pid_t pid, int flags, int nomonitor)
+{
+	dt_proc_hash_t *dph = dtp->dt_procs;
+	uint_t h = pid & (dph->dph_hashlen - 1);
+	dt_proc_t *dpr, *opr;
+	int err;
+
+	/*
+	 * Search the hash table for the pid.  If it is already grabbed or
+	 * created, move the handle to the front of the lrulist, increment
+	 * the reference count, and return the existing ps_prochandle.
+	 */
+	for (dpr = dph->dph_hash[h]; dpr != NULL; dpr = dpr->dpr_hash) {
+		if (dpr->dpr_pid == pid && !dpr->dpr_stale) {
+			/*
+			 * If the cached handle was opened read-only and
+			 * this request is for a writeable handle, mark
+			 * the cached handle as stale and open a new handle.
+			 * Since it's stale, unmark it as cacheable.
+			 */
+			if (dpr->dpr_rdonly && !(flags & PGRAB_RDONLY)) {
+				dt_dprintf("upgrading pid %d\n", (int)pid);
+				dpr->dpr_stale = B_TRUE;
+				dpr->dpr_cacheable = B_FALSE;
+				dph->dph_lrucnt--;
+				break;
+			}
+
+			dt_dprintf("grabbed pid %d (cached)\n", (int)pid);
+			dt_list_delete(&dph->dph_lrulist, dpr);
+			dt_list_prepend(&dph->dph_lrulist, dpr);
+			dpr->dpr_refs++;
+			return (dpr->dpr_proc);
+		}
+	}
+
+	if ((dpr = dt_zalloc(dtp, sizeof (dt_proc_t))) == NULL)
+		return (NULL); /* errno is set for us */
+
+	(void) pthread_mutex_init(&dpr->dpr_lock, NULL);
+	(void) pthread_cond_init(&dpr->dpr_cv, NULL);
+
+	if ((dpr->dpr_proc = Pgrab(pid, flags, &err)) == NULL) {
+		return (dt_proc_error(dtp, dpr,
+		    "failed to grab pid %d: %s\n", (int)pid, Pgrab_error(err)));
+	}
+
+	dpr->dpr_hdl = dtp;
+	dpr->dpr_pid = pid;
+
+	(void) Punsetflags(dpr->dpr_proc, PR_KLC);
+	(void) Psetflags(dpr->dpr_proc, PR_RLC);
+
+	/*
+	 * If we are attempting to grab the process without a monitor
+	 * thread, then mark the process cacheable only if it's being
+	 * grabbed read-only.  If we're currently caching more process
+	 * handles than dph_lrulim permits, attempt to find the
+	 * least-recently-used handle that is currently unreferenced and
+	 * release it from the cache.  Otherwise we are grabbing the process
+	 * for control: create a control thread for this process and store
+	 * its ID in dpr->dpr_tid.
+	 */
+	if (nomonitor || (flags & PGRAB_RDONLY)) {
+		if (dph->dph_lrucnt >= dph->dph_lrulim) {
+			for (opr = dt_list_prev(&dph->dph_lrulist);
+			    opr != NULL; opr = dt_list_prev(opr)) {
+				if (opr->dpr_cacheable && opr->dpr_refs == 0) {
+					dt_proc_destroy(dtp, opr->dpr_proc);
+					break;
+				}
+			}
+		}
+
+		if (flags & PGRAB_RDONLY) {
+			dpr->dpr_cacheable = B_TRUE;
+			dpr->dpr_rdonly = B_TRUE;
+			dph->dph_lrucnt++;
+		}
+
+	} else if (dt_proc_create_thread(dtp, dpr, DT_PROC_STOP_GRAB) != 0)
+		return (NULL); /* dt_proc_error() has been called for us */
+
+	dpr->dpr_hash = dph->dph_hash[h];
+	dph->dph_hash[h] = dpr;
+	dt_list_prepend(&dph->dph_lrulist, dpr);
+
+	dt_dprintf("grabbed pid %d\n", (int)pid);
+	dpr->dpr_refs++;
+
+	return (dpr->dpr_proc);
+}
+
+void
+dt_proc_release(dtrace_hdl_t *dtp, struct ps_prochandle *P)
+{
+	dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_FALSE);
+	dt_proc_hash_t *dph = dtp->dt_procs;
+
+	assert(dpr != NULL);
+	assert(dpr->dpr_refs != 0);
+
+	if (--dpr->dpr_refs == 0 &&
+	    (!dpr->dpr_cacheable || dph->dph_lrucnt > dph->dph_lrulim))
+		dt_proc_destroy(dtp, P);
+}
+
+void
+dt_proc_continue(dtrace_hdl_t *dtp, struct ps_prochandle *P)
+{
+	dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_FALSE);
+
+	(void) pthread_mutex_lock(&dpr->dpr_lock);
+
+	if (dpr->dpr_stop & DT_PROC_STOP_IDLE) {
+		dpr->dpr_stop &= ~DT_PROC_STOP_IDLE;
+		(void) pthread_cond_broadcast(&dpr->dpr_cv);
+	}
+
+	(void) pthread_mutex_unlock(&dpr->dpr_lock);
+}
+
+void
+dt_proc_lock(dtrace_hdl_t *dtp, struct ps_prochandle *P)
+{
+	dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_FALSE);
+	int err = pthread_mutex_lock(&dpr->dpr_lock);
+	assert(err == 0); /* check for recursion */
+}
+
+void
+dt_proc_unlock(dtrace_hdl_t *dtp, struct ps_prochandle *P)
+{
+	dt_proc_t *dpr = dt_proc_lookup(dtp, P, B_FALSE);
+	int err = pthread_mutex_unlock(&dpr->dpr_lock);
+	assert(err == 0); /* check for unheld lock */
+}
+#endif /* !VBOX */
+
+void
+dt_proc_hash_create(dtrace_hdl_t *dtp)
+{
+	if ((dtp->dt_procs = dt_zalloc(dtp, sizeof (dt_proc_hash_t) +
+	    sizeof (dt_proc_t *) * _dtrace_pidbuckets - 1)) != NULL) {
+
+#ifndef VBOX /** @todo This needs more work... */
+		(void) pthread_mutex_init(&dtp->dt_procs->dph_lock, NULL);
+		(void) pthread_cond_init(&dtp->dt_procs->dph_cv, NULL);
+#else
+
+#endif
+
+		dtp->dt_procs->dph_hashlen = _dtrace_pidbuckets;
+		dtp->dt_procs->dph_lrulim = _dtrace_pidlrulim;
+	}
+}
+
+void
+dt_proc_hash_destroy(dtrace_hdl_t *dtp)
+{
+	dt_proc_hash_t *dph = dtp->dt_procs;
+#ifndef VBOX
+	dt_proc_t *dpr;
+
+	while ((dpr = dt_list_next(&dph->dph_lrulist)) != NULL)
+		dt_proc_destroy(dtp, dpr->dpr_proc);
+#endif
+
+	dtp->dt_procs = NULL;
+	dt_free(dtp, dph);
+}
+
+#ifndef VBOX
+
+struct ps_prochandle *
+dtrace_proc_create(dtrace_hdl_t *dtp, const char *file, char *const *argv)
+{
+	dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target");
+	struct ps_prochandle *P = dt_proc_create(dtp, file, argv);
+
+	if (P != NULL && idp != NULL && idp->di_id == 0)
+		idp->di_id = Pstatus(P)->pr_pid; /* $target = created pid */
+
+	return (P);
+}
+
+struct ps_prochandle *
+dtrace_proc_grab(dtrace_hdl_t *dtp, pid_t pid, int flags)
+{
+	dt_ident_t *idp = dt_idhash_lookup(dtp->dt_macros, "target");
+	struct ps_prochandle *P = dt_proc_grab(dtp, pid, flags, 0);
+
+	if (P != NULL && idp != NULL && idp->di_id == 0)
+		idp->di_id = pid; /* $target = grabbed pid */
+
+	return (P);
+}
+
+void
+dtrace_proc_release(dtrace_hdl_t *dtp, struct ps_prochandle *P)
+{
+	dt_proc_release(dtp, P);
+}
+
+void
+dtrace_proc_continue(dtrace_hdl_t *dtp, struct ps_prochandle *P)
+{
+	dt_proc_continue(dtp, P);
+}
+#endif /* !VBOX */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.h
new file mode 100644
index 0000000..d6c82a0
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_proc.h
@@ -0,0 +1,136 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_PROC_H
+#define	_DT_PROC_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <libproc.h>
+#include <dtrace.h>
+#include <pthread.h>
+#include <dt_list.h>
+#else  /* VBOX */
+# include <dtrace.h>
+# include <dt_list.h>
+# include <iprt/critsect.h>
+#endif /* VBOX */
+
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct dt_proc {
+	dt_list_t dpr_list;		/* prev/next pointers for lru chain */
+	struct dt_proc *dpr_hash;	/* next pointer for pid hash chain */
+	dtrace_hdl_t *dpr_hdl;		/* back pointer to libdtrace handle */
+	struct ps_prochandle *dpr_proc;	/* proc handle for libproc calls */
+	char dpr_errmsg[BUFSIZ];	/* error message */
+#ifndef VBOX
+	rd_agent_t *dpr_rtld;		/* rtld handle for librtld_db calls */
+	pthread_mutex_t dpr_lock;	/* lock for manipulating dpr_hdl */
+	pthread_cond_t dpr_cv;		/* cond for dpr_stop/quit/done */
+#else
+	RTCRITSECT dpr_lock;
+	RTSEMEVENT dpr_cv;
+#endif
+	pid_t dpr_pid;			/* pid of process */
+	uint_t dpr_refs;		/* reference count */
+	uint8_t dpr_cacheable;		/* cache handle using lru list */
+	uint8_t dpr_stop;		/* stop mask: see flag bits below */
+	uint8_t dpr_quit;		/* quit flag: ctl thread should quit */
+	uint8_t dpr_done;		/* done flag: ctl thread has exited */
+	uint8_t dpr_usdt;		/* usdt flag: usdt initialized */
+	uint8_t dpr_stale;		/* proc flag: been deprecated */
+	uint8_t dpr_rdonly;		/* proc flag: opened read-only */
+#ifndef VBOX
+	pthread_t dpr_tid;		/* control thread (or zero if none) */
+#else
+	RTTHREAD dpr_tid;
+#endif
+	dt_list_t dpr_bps;		/* list of dt_bkpt_t structures */
+} dt_proc_t;
+
+typedef struct dt_proc_notify {
+	dt_proc_t *dprn_dpr;		/* process associated with the event */
+	char dprn_errmsg[BUFSIZ];	/* error message */
+	struct dt_proc_notify *dprn_next; /* next pointer */
+} dt_proc_notify_t;
+
+#define	DT_PROC_STOP_IDLE	0x01	/* idle on owner's stop request */
+#define	DT_PROC_STOP_CREATE	0x02	/* wait on dpr_cv at process exec */
+#define	DT_PROC_STOP_GRAB	0x04	/* wait on dpr_cv at process grab */
+#define	DT_PROC_STOP_PREINIT	0x08	/* wait on dpr_cv at rtld preinit */
+#define	DT_PROC_STOP_POSTINIT	0x10	/* wait on dpr_cv at rtld postinit */
+#define	DT_PROC_STOP_MAIN	0x20	/* wait on dpr_cv at a.out`main() */
+
+typedef void dt_bkpt_f(dtrace_hdl_t *, dt_proc_t *, void *);
+
+typedef struct dt_bkpt {
+	dt_list_t dbp_list;		/* prev/next pointers for bkpt list */
+	dt_bkpt_f *dbp_func;		/* callback function to execute */
+	void *dbp_data;			/* callback function private data */
+	uintptr_t dbp_addr;		/* virtual address of breakpoint */
+	ulong_t dbp_instr;		/* saved instruction from breakpoint */
+	ulong_t dbp_hits;		/* count of breakpoint hits for debug */
+	int dbp_active;			/* flag indicating breakpoint is on */
+} dt_bkpt_t;
+
+typedef struct dt_proc_hash {
+#ifndef VBOX
+	pthread_mutex_t dph_lock;	/* lock protecting dph_notify list */
+	pthread_cond_t dph_cv;		/* cond for waiting for dph_notify */
+#else
+	RTSEMEVENT dph_event;
+#endif
+	dt_proc_notify_t *dph_notify;	/* list of pending proc notifications */
+	dt_list_t dph_lrulist;		/* list of dt_proc_t's in lru order */
+	uint_t dph_lrulim;		/* limit on number of procs to hold */
+	uint_t dph_lrucnt;		/* count of cached process handles */
+	uint_t dph_hashlen;		/* size of hash chains array */
+	dt_proc_t *dph_hash[1];		/* hash chains array */
+} dt_proc_hash_t;
+
+extern struct ps_prochandle *dt_proc_create(dtrace_hdl_t *,
+    const char *, char *const *);
+
+extern struct ps_prochandle *dt_proc_grab(dtrace_hdl_t *, pid_t, int, int);
+extern void dt_proc_release(dtrace_hdl_t *, struct ps_prochandle *);
+extern void dt_proc_continue(dtrace_hdl_t *, struct ps_prochandle *);
+extern void dt_proc_lock(dtrace_hdl_t *, struct ps_prochandle *);
+extern void dt_proc_unlock(dtrace_hdl_t *, struct ps_prochandle *);
+extern dt_proc_t *dt_proc_lookup(dtrace_hdl_t *, struct ps_prochandle *, int);
+
+extern void dt_proc_hash_create(dtrace_hdl_t *);
+extern void dt_proc_hash_destroy(dtrace_hdl_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_PROC_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_program.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_program.c
new file mode 100644
index 0000000..1f7b0ca
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_program.c
@@ -0,0 +1,619 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <unistd.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <assert.h>
+#include <ctype.h>
+#include <alloca.h>
+#else
+# include <ctype.h>
+#endif
+
+#include <dt_impl.h>
+#include <dt_program.h>
+#include <dt_printf.h>
+#include <dt_provider.h>
+
+dtrace_prog_t *
+dt_program_create(dtrace_hdl_t *dtp)
+{
+	dtrace_prog_t *pgp = dt_zalloc(dtp, sizeof (dtrace_prog_t));
+
+	if (pgp != NULL) {
+		dt_list_append(&dtp->dt_programs, pgp);
+	} else {
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+		return (NULL);
+	}
+
+	/*
+	 * By default, programs start with DOF version 1 so that output files
+	 * containing DOF are backward compatible. If a program requires new
+	 * DOF features, the version is increased as needed.
+	 */
+	pgp->dp_dofversion = DOF_VERSION_1;
+
+	return (pgp);
+}
+
+void
+dt_program_destroy(dtrace_hdl_t *dtp, dtrace_prog_t *pgp)
+{
+	dt_stmt_t *stp, *next;
+	uint_t i;
+
+	for (stp = dt_list_next(&pgp->dp_stmts); stp != NULL; stp = next) {
+		next = dt_list_next(stp);
+		dtrace_stmt_destroy(dtp, stp->ds_desc);
+		dt_free(dtp, stp);
+	}
+
+	for (i = 0; i < pgp->dp_xrefslen; i++)
+		dt_free(dtp, pgp->dp_xrefs[i]);
+
+	dt_free(dtp, pgp->dp_xrefs);
+	dt_list_delete(&dtp->dt_programs, pgp);
+	dt_free(dtp, pgp);
+}
+
+/*ARGSUSED*/
+void
+dtrace_program_info(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
+    dtrace_proginfo_t *pip)
+{
+	dt_stmt_t *stp;
+	dtrace_actdesc_t *ap;
+	dtrace_ecbdesc_t *last = NULL;
+
+	if (pip == NULL)
+		return;
+
+	bzero(pip, sizeof (dtrace_proginfo_t));
+
+	if (dt_list_next(&pgp->dp_stmts) != NULL) {
+		pip->dpi_descattr = _dtrace_maxattr;
+		pip->dpi_stmtattr = _dtrace_maxattr;
+	} else {
+		pip->dpi_descattr = _dtrace_defattr;
+		pip->dpi_stmtattr = _dtrace_defattr;
+	}
+
+	for (stp = dt_list_next(&pgp->dp_stmts); stp; stp = dt_list_next(stp)) {
+		dtrace_ecbdesc_t *edp = stp->ds_desc->dtsd_ecbdesc;
+
+		if (edp == last)
+			continue;
+		last = edp;
+
+		pip->dpi_descattr =
+		    dt_attr_min(stp->ds_desc->dtsd_descattr, pip->dpi_descattr);
+
+		pip->dpi_stmtattr =
+		    dt_attr_min(stp->ds_desc->dtsd_stmtattr, pip->dpi_stmtattr);
+
+		/*
+		 * If there aren't any actions, account for the fact that
+		 * recording the epid will generate a record.
+		 */
+		if (edp->dted_action == NULL)
+			pip->dpi_recgens++;
+
+		for (ap = edp->dted_action; ap != NULL; ap = ap->dtad_next) {
+			if (ap->dtad_kind == DTRACEACT_SPECULATE) {
+				pip->dpi_speculations++;
+				continue;
+			}
+
+			if (DTRACEACT_ISAGG(ap->dtad_kind)) {
+				pip->dpi_recgens -= ap->dtad_arg;
+				pip->dpi_aggregates++;
+				continue;
+			}
+
+			if (DTRACEACT_ISDESTRUCTIVE(ap->dtad_kind))
+				continue;
+
+			if (ap->dtad_kind == DTRACEACT_DIFEXPR &&
+			    ap->dtad_difo->dtdo_rtype.dtdt_kind ==
+			    DIF_TYPE_CTF &&
+			    ap->dtad_difo->dtdo_rtype.dtdt_size == 0)
+				continue;
+
+			pip->dpi_recgens++;
+		}
+	}
+}
+
+int
+dtrace_program_exec(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
+    dtrace_proginfo_t *pip)
+{
+	void *dof;
+	int n, err;
+
+	dtrace_program_info(dtp, pgp, pip);
+
+	if ((dof = dtrace_dof_create(dtp, pgp, DTRACE_D_STRIP)) == NULL)
+		return (-1);
+
+	n = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
+	dtrace_dof_destroy(dtp, dof);
+
+	if (n == -1) {
+		switch (errno) {
+		case EINVAL:
+			err = EDT_DIFINVAL;
+			break;
+		case EFAULT:
+			err = EDT_DIFFAULT;
+			break;
+		case E2BIG:
+			err = EDT_DIFSIZE;
+			break;
+		case EBUSY:
+			err = EDT_ENABLING_ERR;
+			break;
+		default:
+			err = errno;
+		}
+
+		return (dt_set_errno(dtp, err));
+	}
+
+	if (pip != NULL)
+		pip->dpi_matches += n;
+
+	return (0);
+}
+
+static void
+dt_ecbdesc_hold(dtrace_ecbdesc_t *edp)
+{
+	edp->dted_refcnt++;
+}
+
+void
+dt_ecbdesc_release(dtrace_hdl_t *dtp, dtrace_ecbdesc_t *edp)
+{
+	if (--edp->dted_refcnt > 0)
+		return;
+
+	dt_difo_free(dtp, edp->dted_pred.dtpdd_difo);
+	assert(edp->dted_action == NULL);
+	dt_free(dtp, edp);
+}
+
+dtrace_ecbdesc_t *
+dt_ecbdesc_create(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp)
+{
+	dtrace_ecbdesc_t *edp;
+
+	if ((edp = dt_zalloc(dtp, sizeof (dtrace_ecbdesc_t))) == NULL) {
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+		return (NULL);
+	}
+
+	edp->dted_probe = *pdp;
+	dt_ecbdesc_hold(edp);
+	return (edp);
+}
+
+dtrace_stmtdesc_t *
+dtrace_stmt_create(dtrace_hdl_t *dtp, dtrace_ecbdesc_t *edp)
+{
+	dtrace_stmtdesc_t *sdp;
+
+	if ((sdp = dt_zalloc(dtp, sizeof (dtrace_stmtdesc_t))) == NULL)
+		return (NULL);
+
+	dt_ecbdesc_hold(edp);
+	sdp->dtsd_ecbdesc = edp;
+	sdp->dtsd_descattr = _dtrace_defattr;
+	sdp->dtsd_stmtattr = _dtrace_defattr;
+
+	return (sdp);
+}
+
+dtrace_actdesc_t *
+dtrace_stmt_action(dtrace_hdl_t *dtp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *new;
+	dtrace_ecbdesc_t *edp = sdp->dtsd_ecbdesc;
+
+	if ((new = dt_alloc(dtp, sizeof (dtrace_actdesc_t))) == NULL)
+		return (NULL);
+
+	if (sdp->dtsd_action_last != NULL) {
+		assert(sdp->dtsd_action != NULL);
+		assert(sdp->dtsd_action_last->dtad_next == NULL);
+		sdp->dtsd_action_last->dtad_next = new;
+	} else {
+		dtrace_actdesc_t *ap = edp->dted_action;
+
+		assert(sdp->dtsd_action == NULL);
+		sdp->dtsd_action = new;
+
+		while (ap != NULL && ap->dtad_next != NULL)
+			ap = ap->dtad_next;
+
+		if (ap == NULL)
+			edp->dted_action = new;
+		else
+			ap->dtad_next = new;
+	}
+
+	sdp->dtsd_action_last = new;
+	bzero(new, sizeof (dtrace_actdesc_t));
+	new->dtad_uarg = (uintptr_t)sdp;
+
+	return (new);
+}
+
+int
+dtrace_stmt_add(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, dtrace_stmtdesc_t *sdp)
+{
+	dt_stmt_t *stp = dt_alloc(dtp, sizeof (dt_stmt_t));
+
+	if (stp == NULL)
+		return (-1); /* errno is set for us */
+
+	dt_list_append(&pgp->dp_stmts, stp);
+	stp->ds_desc = sdp;
+
+	return (0);
+}
+
+int
+dtrace_stmt_iter(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
+    dtrace_stmt_f *func, void *data)
+{
+	dt_stmt_t *stp, *next;
+	int status = 0;
+
+	for (stp = dt_list_next(&pgp->dp_stmts); stp != NULL; stp = next) {
+		next = dt_list_next(stp);
+		if ((status = func(dtp, pgp, stp->ds_desc, data)) != 0)
+			break;
+	}
+
+	return (status);
+}
+
+void
+dtrace_stmt_destroy(dtrace_hdl_t *dtp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_ecbdesc_t *edp = sdp->dtsd_ecbdesc;
+
+	/*
+	 * We need to remove any actions that we have on this ECB, and
+	 * remove our hold on the ECB itself.
+	 */
+	if (sdp->dtsd_action != NULL) {
+		dtrace_actdesc_t *last = sdp->dtsd_action_last;
+		dtrace_actdesc_t *ap, *next;
+
+		assert(last != NULL);
+
+		for (ap = edp->dted_action; ap != NULL; ap = ap->dtad_next) {
+			if (ap == sdp->dtsd_action)
+				break;
+
+			if (ap->dtad_next == sdp->dtsd_action)
+				break;
+		}
+
+		assert(ap != NULL);
+
+		if (ap == edp->dted_action)
+			edp->dted_action = last->dtad_next;
+		else
+			ap->dtad_next = last->dtad_next;
+
+		/*
+		 * We have now removed our action list from its ECB; we can
+		 * safely destroy the list.
+		 */
+		last->dtad_next = NULL;
+
+		for (ap = sdp->dtsd_action; ap != NULL; ap = next) {
+			assert(ap->dtad_uarg == (uintptr_t)sdp);
+			dt_difo_free(dtp, ap->dtad_difo);
+			next = ap->dtad_next;
+			dt_free(dtp, ap);
+		}
+	}
+
+	if (sdp->dtsd_fmtdata != NULL)
+		dt_printf_destroy(sdp->dtsd_fmtdata);
+
+	dt_ecbdesc_release(dtp, sdp->dtsd_ecbdesc);
+	dt_free(dtp, sdp);
+}
+
+typedef struct dt_header_info {
+	dtrace_hdl_t *dthi_dtp;	/* consumer handle */
+	FILE *dthi_out;		/* output file */
+	char *dthi_pmname;	/* provider macro name */
+	char *dthi_pfname;	/* provider function name */
+	int dthi_empty;		/* should we generate empty macros */
+} dt_header_info_t;
+
+static void
+dt_header_fmt_macro(char *buf, const char *str)
+{
+	for (;;) {
+		if (islower(*str)) {
+			*buf++ = *str++ + 'A' - 'a';
+		} else if (*str == '-') {
+			*buf++ = '_';
+			str++;
+		} else if (*str == '.') {
+			*buf++ = '_';
+			str++;
+		} else if ((*buf++ = *str++) == '\0') {
+			break;
+		}
+	}
+}
+
+static void
+dt_header_fmt_func(char *buf, const char *str)
+{
+	for (;;) {
+		if (*str == '-') {
+			*buf++ = '_';
+			*buf++ = '_';
+			str++;
+		} else if ((*buf++ = *str++) == '\0') {
+			break;
+		}
+	}
+}
+
+/*ARGSUSED*/
+static int
+dt_header_decl(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
+{
+	dt_header_info_t *infop = data;
+	dtrace_hdl_t *dtp = infop->dthi_dtp;
+	dt_probe_t *prp = idp->di_data;
+	dt_node_t *dnp;
+	char buf[DT_TYPE_NAMELEN];
+	char *fname;
+	const char *p;
+	int i;
+
+	p = prp->pr_name;
+	for (i = 0; (p = strchr(p, '-')) != NULL; i++)
+		p++;
+
+	fname = alloca(strlen(prp->pr_name) + 1 + i);
+	dt_header_fmt_func(fname, prp->pr_name);
+
+	if (fprintf(infop->dthi_out, "extern void __dtrace_%s___%s(",
+	    infop->dthi_pfname, fname) < 0)
+		return (dt_set_errno(dtp, errno));
+
+	for (dnp = prp->pr_nargs, i = 0; dnp != NULL; dnp = dnp->dn_list, i++) {
+		if (fprintf(infop->dthi_out, "%s",
+		    ctf_type_name(dnp->dn_ctfp, dnp->dn_type,
+		    buf, sizeof (buf))) < 0)
+			return (dt_set_errno(dtp, errno));
+
+		if (i + 1 != prp->pr_nargc &&
+		    fprintf(infop->dthi_out, ", ") < 0)
+			return (dt_set_errno(dtp, errno));
+	}
+
+	if (i == 0 && fprintf(infop->dthi_out, "void") < 0)
+		return (dt_set_errno(dtp, errno));
+
+	if (fprintf(infop->dthi_out, ");\n") < 0)
+		return (dt_set_errno(dtp, errno));
+
+	if (fprintf(infop->dthi_out,
+	    "#ifndef\t__sparc\n"
+	    "extern int __dtraceenabled_%s___%s(void);\n"
+	    "#else\n"
+	    "extern int __dtraceenabled_%s___%s(long);\n"
+	    "#endif\n",
+	    infop->dthi_pfname, fname, infop->dthi_pfname, fname) < 0)
+		return (dt_set_errno(dtp, errno));
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dt_header_probe(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
+{
+	dt_header_info_t *infop = data;
+	dtrace_hdl_t *dtp = infop->dthi_dtp;
+	dt_probe_t *prp = idp->di_data;
+	char *mname, *fname;
+	const char *p;
+	VBDTTYPE(uint_t,int) i;
+
+	p = prp->pr_name;
+	for (i = 0; (p = strchr(p, '-')) != NULL; i++)
+		p++;
+
+	mname = alloca(strlen(prp->pr_name) + 1);
+	dt_header_fmt_macro(mname, prp->pr_name);
+
+	fname = alloca(strlen(prp->pr_name) + 1 + i);
+	dt_header_fmt_func(fname, prp->pr_name);
+
+	if (fprintf(infop->dthi_out, "#define\t%s_%s(",
+	    infop->dthi_pmname, mname) < 0)
+		return (dt_set_errno(dtp, errno));
+
+	for (i = 0; i < prp->pr_nargc; i++) {
+		if (fprintf(infop->dthi_out, "arg%d", i) < 0)
+			return (dt_set_errno(dtp, errno));
+
+		if (i + 1 != prp->pr_nargc &&
+		    fprintf(infop->dthi_out, ", ") < 0)
+			return (dt_set_errno(dtp, errno));
+	}
+
+	if (!infop->dthi_empty) {
+		if (fprintf(infop->dthi_out, ") \\\n\t") < 0)
+			return (dt_set_errno(dtp, errno));
+
+		if (fprintf(infop->dthi_out, "__dtrace_%s___%s(",
+		    infop->dthi_pfname, fname) < 0)
+			return (dt_set_errno(dtp, errno));
+
+		for (i = 0; i < prp->pr_nargc; i++) {
+			if (fprintf(infop->dthi_out, "arg%d", i) < 0)
+				return (dt_set_errno(dtp, errno));
+
+			if (i + 1 != prp->pr_nargc &&
+			    fprintf(infop->dthi_out, ", ") < 0)
+				return (dt_set_errno(dtp, errno));
+		}
+	}
+
+	if (fprintf(infop->dthi_out, ")\n") < 0)
+		return (dt_set_errno(dtp, errno));
+
+	if (!infop->dthi_empty) {
+		if (fprintf(infop->dthi_out,
+		    "#ifndef\t__sparc\n"
+		    "#define\t%s_%s_ENABLED() \\\n"
+		    "\t__dtraceenabled_%s___%s()\n"
+		    "#else\n"
+		    "#define\t%s_%s_ENABLED() \\\n"
+		    "\t__dtraceenabled_%s___%s(0)\n"
+		    "#endif\n",
+		    infop->dthi_pmname, mname,
+		    infop->dthi_pfname, fname,
+		    infop->dthi_pmname, mname,
+		    infop->dthi_pfname, fname) < 0)
+			return (dt_set_errno(dtp, errno));
+
+	} else {
+		if (fprintf(infop->dthi_out, "#define\t%s_%s_ENABLED() (0)\n",
+		    infop->dthi_pmname, mname) < 0)
+			return (dt_set_errno(dtp, errno));
+	}
+
+	return (0);
+}
+
+static int
+dt_header_provider(dtrace_hdl_t *dtp, dt_provider_t *pvp, FILE *out)
+{
+	dt_header_info_t info;
+	const char *p;
+	int i;
+
+	if (pvp->pv_flags & DT_PROVIDER_IMPL)
+		return (0);
+
+	/*
+	 * Count the instances of the '-' character since we'll need to double
+	 * those up.
+	 */
+	p = pvp->pv_desc.dtvd_name;
+	for (i = 0; (p = strchr(p, '-')) != NULL; i++)
+		p++;
+
+	info.dthi_dtp = dtp;
+	info.dthi_out = out;
+	info.dthi_empty = 0;
+
+	info.dthi_pmname = alloca(strlen(pvp->pv_desc.dtvd_name) + 1);
+	dt_header_fmt_macro(info.dthi_pmname, pvp->pv_desc.dtvd_name);
+
+	info.dthi_pfname = alloca(strlen(pvp->pv_desc.dtvd_name) + 1 + i);
+	dt_header_fmt_func(info.dthi_pfname, pvp->pv_desc.dtvd_name);
+
+	if (fprintf(out, "#if _DTRACE_VERSION\n\n") < 0)
+		return (dt_set_errno(dtp, errno));
+
+	if (dt_idhash_iter(pvp->pv_probes, dt_header_probe, &info) != 0)
+		return (-1); /* dt_errno is set for us */
+	if (fprintf(out, "\n\n") < 0)
+		return (dt_set_errno(dtp, errno));
+	if (dt_idhash_iter(pvp->pv_probes, dt_header_decl, &info) != 0)
+		return (-1); /* dt_errno is set for us */
+
+	if (fprintf(out, "\n#else\n\n") < 0)
+		return (dt_set_errno(dtp, errno));
+
+	info.dthi_empty = 1;
+
+	if (dt_idhash_iter(pvp->pv_probes, dt_header_probe, &info) != 0)
+		return (-1); /* dt_errno is set for us */
+
+	if (fprintf(out, "\n#endif\n\n") < 0)
+		return (dt_set_errno(dtp, errno));
+
+	return (0);
+}
+
+int
+dtrace_program_header(dtrace_hdl_t *dtp, FILE *out, const char *fname)
+{
+	dt_provider_t *pvp;
+	char *mfname, *p;
+
+	if (fname != NULL) {
+		if ((p = strrchr(fname, '/')) != NULL)
+			fname = p + 1;
+
+		mfname = alloca(strlen(fname) + 1);
+		dt_header_fmt_macro(mfname, fname);
+		if (fprintf(out, "#ifndef\t_%s\n#define\t_%s\n\n",
+		    mfname, mfname) < 0)
+			return (dt_set_errno(dtp, errno));
+	}
+
+	if (fprintf(out, "#include <unistd.h>\n\n") < 0)
+		return (-1);
+
+	if (fprintf(out, "#ifdef\t__cplusplus\nextern \"C\" {\n#endif\n\n") < 0)
+		return (-1);
+
+	for (pvp = dt_list_next(&dtp->dt_provlist);
+	    pvp != NULL; pvp = dt_list_next(pvp)) {
+		if (dt_header_provider(dtp, pvp, out) != 0)
+			return (-1); /* dt_errno is set for us */
+	}
+
+	if (fprintf(out, "\n#ifdef\t__cplusplus\n}\n#endif\n") < 0)
+		return (dt_set_errno(dtp, errno));
+
+	if (fname != NULL && fprintf(out, "\n#endif\t/* _%s */\n", mfname) < 0)
+		return (dt_set_errno(dtp, errno));
+
+	return (0);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_program.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_program.h
new file mode 100644
index 0000000..100f357
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_program.h
@@ -0,0 +1,65 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_PROGRAM_H
+#define	_DT_PROGRAM_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#include <dtrace.h>
+#include <dt_list.h>
+
+typedef struct dt_stmt {
+	dt_list_t ds_list;	/* list forward/back pointers */
+	dtrace_stmtdesc_t *ds_desc; /* pointer to statement description */
+} dt_stmt_t;
+
+struct dtrace_prog {
+	dt_list_t dp_list;	/* list forward/back pointers */
+	dt_list_t dp_stmts;	/* linked list of dt_stmt_t's */
+	ulong_t **dp_xrefs;	/* array of translator reference bitmaps */
+	uint_t dp_xrefslen;	/* length of dp_xrefs array */
+	uint8_t dp_dofversion;	/* DOF version this program requires */
+};
+
+extern dtrace_prog_t *dt_program_create(dtrace_hdl_t *);
+extern void dt_program_destroy(dtrace_hdl_t *, dtrace_prog_t *);
+
+extern dtrace_ecbdesc_t *dt_ecbdesc_create(dtrace_hdl_t *,
+    const dtrace_probedesc_t *);
+extern void dt_ecbdesc_release(dtrace_hdl_t *, dtrace_ecbdesc_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_PROGRAM_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_provider.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_provider.c
new file mode 100644
index 0000000..3a47ef5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_provider.c
@@ -0,0 +1,883 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#include <sys/sysmacros.h>
+
+#include <assert.h>
+#include <limits.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <alloca.h>
+#include <unistd.h>
+#include <errno.h>
+#else  /* VBOX */
+# include <iprt/asm.h>
+#endif /* VBOX */
+
+#include <dt_provider.h>
+#include <dt_module.h>
+#include <dt_string.h>
+#include <dt_list.h>
+
+static dt_provider_t *
+dt_provider_insert(dtrace_hdl_t *dtp, dt_provider_t *pvp, uint_t h)
+{
+	dt_list_append(&dtp->dt_provlist, pvp);
+
+	pvp->pv_next = dtp->dt_provs[h];
+	dtp->dt_provs[h] = pvp;
+	dtp->dt_nprovs++;
+
+	return (pvp);
+}
+
+dt_provider_t *
+dt_provider_lookup(dtrace_hdl_t *dtp, const char *name)
+{
+	uint_t h = dt_strtab_hash(name, NULL) % dtp->dt_provbuckets;
+	dtrace_providerdesc_t desc;
+	dt_provider_t *pvp;
+
+	for (pvp = dtp->dt_provs[h]; pvp != NULL; pvp = pvp->pv_next) {
+		if (strcmp(pvp->pv_desc.dtvd_name, name) == 0)
+			return (pvp);
+	}
+
+	if (strisglob(name) || name[0] == '\0') {
+		(void) dt_set_errno(dtp, EDT_NOPROV);
+		return (NULL);
+	}
+
+	bzero(&desc, sizeof (desc));
+	(void) strlcpy(desc.dtvd_name, name, DTRACE_PROVNAMELEN);
+
+	if (dt_ioctl(dtp, DTRACEIOC_PROVIDER, &desc) == -1) {
+		(void) dt_set_errno(dtp, errno == ESRCH ? EDT_NOPROV : errno);
+		return (NULL);
+	}
+
+	if ((pvp = dt_provider_create(dtp, name)) == NULL)
+		return (NULL); /* dt_errno is set for us */
+
+	bcopy(&desc, &pvp->pv_desc, sizeof (desc));
+	pvp->pv_flags |= DT_PROVIDER_IMPL;
+	return (pvp);
+}
+
+dt_provider_t *
+dt_provider_create(dtrace_hdl_t *dtp, const char *name)
+{
+	dt_provider_t *pvp;
+
+	if ((pvp = dt_zalloc(dtp, sizeof (dt_provider_t))) == NULL)
+		return (NULL);
+
+	(void) strlcpy(pvp->pv_desc.dtvd_name, name, DTRACE_PROVNAMELEN);
+	pvp->pv_probes = dt_idhash_create(pvp->pv_desc.dtvd_name, NULL, 0, 0);
+	pvp->pv_gen = dtp->dt_gen;
+	pvp->pv_hdl = dtp;
+
+	if (pvp->pv_probes == NULL) {
+		dt_free(dtp, pvp);
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+		return (NULL);
+	}
+
+	pvp->pv_desc.dtvd_attr.dtpa_provider = _dtrace_prvattr;
+	pvp->pv_desc.dtvd_attr.dtpa_mod = _dtrace_prvattr;
+	pvp->pv_desc.dtvd_attr.dtpa_func = _dtrace_prvattr;
+	pvp->pv_desc.dtvd_attr.dtpa_name = _dtrace_prvattr;
+	pvp->pv_desc.dtvd_attr.dtpa_args = _dtrace_prvattr;
+
+	return (dt_provider_insert(dtp, pvp,
+	    dt_strtab_hash(name, NULL) % dtp->dt_provbuckets));
+}
+
+void
+dt_provider_destroy(dtrace_hdl_t *dtp, dt_provider_t *pvp)
+{
+	dt_provider_t **pp;
+	uint_t h;
+
+	assert(pvp->pv_hdl == dtp);
+
+	h = dt_strtab_hash(pvp->pv_desc.dtvd_name, NULL) % dtp->dt_provbuckets;
+	pp = &dtp->dt_provs[h];
+
+	while (*pp != NULL && *pp != pvp)
+		pp = &(*pp)->pv_next;
+
+	assert(*pp != NULL && *pp == pvp);
+	*pp = pvp->pv_next;
+
+	dt_list_delete(&dtp->dt_provlist, pvp);
+	dtp->dt_nprovs--;
+
+	if (pvp->pv_probes != NULL)
+		dt_idhash_destroy(pvp->pv_probes);
+
+	dt_node_link_free(&pvp->pv_nodes);
+	dt_free(dtp, pvp->pv_xrefs);
+	dt_free(dtp, pvp);
+}
+
+int
+dt_provider_xref(dtrace_hdl_t *dtp, dt_provider_t *pvp, id_t id)
+{
+	size_t oldsize = BT_SIZEOFMAP(pvp->pv_xrmax);
+	size_t newsize = BT_SIZEOFMAP(dtp->dt_xlatorid);
+
+	assert(id >= 0 && id < dtp->dt_xlatorid);
+
+	if (newsize > oldsize) {
+		ulong_t *xrefs = dt_zalloc(dtp, newsize);
+
+		if (xrefs == NULL)
+			return (-1);
+
+		bcopy(pvp->pv_xrefs, xrefs, oldsize);
+		dt_free(dtp, pvp->pv_xrefs);
+
+		pvp->pv_xrefs = xrefs;
+		pvp->pv_xrmax = dtp->dt_xlatorid;
+	}
+
+	BT_SET(pvp->pv_xrefs, id);
+	return (0);
+}
+
+static uint8_t
+dt_probe_argmap(dt_node_t *xnp, dt_node_t *nnp)
+{
+	uint8_t i;
+
+	for (i = 0; nnp != NULL; i++) {
+		if (nnp->dn_string != NULL &&
+		    strcmp(nnp->dn_string, xnp->dn_string) == 0)
+			break;
+		else
+			nnp = nnp->dn_list;
+	}
+
+	return (i);
+}
+
+static dt_node_t *
+dt_probe_alloc_args(dt_provider_t *pvp, int argc)
+{
+	dt_node_t *args = NULL, *pnp = NULL, *dnp;
+	int i;
+
+	for (i = 0; i < argc; i++, pnp = dnp) {
+		if ((dnp = dt_node_xalloc(pvp->pv_hdl, DT_NODE_TYPE)) == NULL)
+			return (NULL);
+
+		dnp->dn_link = pvp->pv_nodes;
+		pvp->pv_nodes = dnp;
+
+		if (args == NULL)
+			args = dnp;
+		else
+			pnp->dn_list = dnp;
+	}
+
+	return (args);
+}
+
+static size_t
+dt_probe_keylen(const dtrace_probedesc_t *pdp)
+{
+	return (strlen(pdp->dtpd_mod) + 1 +
+	    strlen(pdp->dtpd_func) + 1 + strlen(pdp->dtpd_name) + 1);
+}
+
+static char *
+dt_probe_key(const dtrace_probedesc_t *pdp, char *s)
+{
+	(void) snprintf(s, INT_MAX, "%s:%s:%s",
+	    pdp->dtpd_mod, pdp->dtpd_func, pdp->dtpd_name);
+	return (s);
+}
+
+/*
+ * If a probe was discovered from the kernel, ask dtrace(7D) for a description
+ * of each of its arguments, including native and translated types.
+ */
+static dt_probe_t *
+dt_probe_discover(dt_provider_t *pvp, const dtrace_probedesc_t *pdp)
+{
+	dtrace_hdl_t *dtp = pvp->pv_hdl;
+	char *name = dt_probe_key(pdp, alloca(dt_probe_keylen(pdp)));
+
+	dt_node_t *xargs, *nargs;
+	dt_ident_t *idp;
+	dt_probe_t *prp;
+
+	dtrace_typeinfo_t dtt;
+	int i, nc, xc;
+
+	int adc = _dtrace_argmax;
+	dtrace_argdesc_t *adv = alloca(sizeof (dtrace_argdesc_t) * adc);
+	dtrace_argdesc_t *adp = adv;
+
+	assert(strcmp(pvp->pv_desc.dtvd_name, pdp->dtpd_provider) == 0);
+	assert(pdp->dtpd_id != DTRACE_IDNONE);
+
+	dt_dprintf("discovering probe %s:%s id=%d\n",
+	    pvp->pv_desc.dtvd_name, name, pdp->dtpd_id);
+
+	for (nc = -1, i = 0; i < adc; i++, adp++) {
+		bzero(adp, sizeof (dtrace_argdesc_t));
+		adp->dtargd_ndx = i;
+		adp->dtargd_id = pdp->dtpd_id;
+
+		if (dt_ioctl(dtp, DTRACEIOC_PROBEARG, adp) != 0) {
+			(void) dt_set_errno(dtp, errno);
+			return (NULL);
+		}
+
+		if (adp->dtargd_ndx == DTRACE_ARGNONE)
+			break; /* all argument descs have been retrieved */
+
+		nc = MAX(nc, adp->dtargd_mapping);
+	}
+
+	xc = i;
+	nc++;
+
+	/*
+	 * Now that we have discovered the number of native and translated
+	 * arguments from the argument descriptions, allocate a new probe ident
+	 * and corresponding dt_probe_t and hash it into the provider.
+	 */
+	xargs = dt_probe_alloc_args(pvp, xc);
+	nargs = dt_probe_alloc_args(pvp, nc);
+
+	if ((xc != 0 && xargs == NULL) || (nc != 0 && nargs == NULL))
+		return (NULL); /* dt_errno is set for us */
+
+	idp = dt_ident_create(name, DT_IDENT_PROBE,
+	    DT_IDFLG_ORPHAN, pdp->dtpd_id, _dtrace_defattr, 0,
+	    &dt_idops_probe, NULL, dtp->dt_gen);
+
+	if (idp == NULL) {
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+		return (NULL);
+	}
+
+	if ((prp = dt_probe_create(dtp, idp, 2,
+	    nargs, nc, xargs, xc)) == NULL) {
+		dt_ident_destroy(idp);
+		return (NULL);
+	}
+
+	dt_probe_declare(pvp, prp);
+
+	/*
+	 * Once our new dt_probe_t is fully constructed, iterate over the
+	 * cached argument descriptions and assign types to prp->pr_nargv[]
+	 * and prp->pr_xargv[] and assign mappings to prp->pr_mapping[].
+	 */
+	for (adp = adv, i = 0; i < xc; i++, adp++) {
+		if (dtrace_type_strcompile(dtp,
+		    adp->dtargd_native, &dtt) != 0) {
+			dt_dprintf("failed to resolve input type %s "
+			    "for %s:%s arg #%d: %s\n", adp->dtargd_native,
+			    pvp->pv_desc.dtvd_name, name, i + 1,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+
+			dtt.dtt_object = NULL;
+			dtt.dtt_ctfp = NULL;
+			dtt.dtt_type = CTF_ERR;
+		} else {
+			dt_node_type_assign(prp->pr_nargv[adp->dtargd_mapping],
+			    dtt.dtt_ctfp, dtt.dtt_type);
+		}
+
+		if (dtt.dtt_type != CTF_ERR && (adp->dtargd_xlate[0] == '\0' ||
+		    strcmp(adp->dtargd_native, adp->dtargd_xlate) == 0)) {
+			dt_node_type_propagate(prp->pr_nargv[
+			    adp->dtargd_mapping], prp->pr_xargv[i]);
+		} else if (dtrace_type_strcompile(dtp,
+		    adp->dtargd_xlate, &dtt) != 0) {
+			dt_dprintf("failed to resolve output type %s "
+			    "for %s:%s arg #%d: %s\n", adp->dtargd_xlate,
+			    pvp->pv_desc.dtvd_name, name, i + 1,
+			    dtrace_errmsg(dtp, dtrace_errno(dtp)));
+
+			dtt.dtt_object = NULL;
+			dtt.dtt_ctfp = NULL;
+			dtt.dtt_type = CTF_ERR;
+		} else {
+			dt_node_type_assign(prp->pr_xargv[i],
+			    dtt.dtt_ctfp, dtt.dtt_type);
+		}
+
+		prp->pr_mapping[i] = adp->dtargd_mapping;
+		prp->pr_argv[i] = dtt;
+	}
+
+	return (prp);
+}
+
+/*
+ * Lookup a probe declaration based on a known provider and full or partially
+ * specified module, function, and name.  If the probe is not known to us yet,
+ * ask dtrace(7D) to match the description and then cache any useful results.
+ */
+dt_probe_t *
+dt_probe_lookup(dt_provider_t *pvp, const char *s)
+{
+	dtrace_hdl_t *dtp = pvp->pv_hdl;
+	dtrace_probedesc_t pd;
+	dt_ident_t *idp;
+	size_t keylen;
+	char *key;
+
+	if (dtrace_str2desc(dtp, DTRACE_PROBESPEC_NAME, s, &pd) != 0)
+		return (NULL); /* dt_errno is set for us */
+
+	keylen = dt_probe_keylen(&pd);
+	key = dt_probe_key(&pd, alloca(keylen));
+
+	/*
+	 * If the probe is already declared, then return the dt_probe_t from
+	 * the existing identifier.  This could come from a static declaration
+	 * or it could have been cached from an earlier call to this function.
+	 */
+	if ((idp = dt_idhash_lookup(pvp->pv_probes, key)) != NULL)
+		return (idp->di_data);
+
+	/*
+	 * If the probe isn't known, use the probe description computed above
+	 * to ask dtrace(7D) to find the first matching probe.
+	 */
+	if (dt_ioctl(dtp, DTRACEIOC_PROBEMATCH, &pd) == 0)
+		return (dt_probe_discover(pvp, &pd));
+
+	if (errno == ESRCH || errno == EBADF)
+		(void) dt_set_errno(dtp, EDT_NOPROBE);
+	else
+		(void) dt_set_errno(dtp, errno);
+
+	return (NULL);
+}
+
+dt_probe_t *
+dt_probe_create(dtrace_hdl_t *dtp, dt_ident_t *idp, int protoc,
+    dt_node_t *nargs, uint_t nargc, dt_node_t *xargs, uint_t xargc)
+{
+	dt_module_t *dmp;
+	dt_probe_t *prp;
+	const char *p;
+	uint_t i;
+
+	assert(idp->di_kind == DT_IDENT_PROBE);
+	assert(idp->di_data == NULL);
+
+	/*
+	 * If only a single prototype is given, set xargc/s to nargc/s to
+	 * simplify subsequent use.  Note that we can have one or both of nargs
+	 * and xargs be specified but set to NULL, indicating a void prototype.
+	 */
+	if (protoc < 2) {
+		assert(xargs == NULL);
+		assert(xargc == 0);
+		xargs = nargs;
+		xargc = nargc;
+	}
+
+	if ((prp = dt_alloc(dtp, sizeof (dt_probe_t))) == NULL)
+		return (NULL);
+
+	prp->pr_pvp = NULL;
+	prp->pr_ident = idp;
+
+	p = strrchr(idp->di_name, ':');
+	assert(p != NULL);
+	prp->pr_name = p + 1;
+
+	prp->pr_nargs = nargs;
+	prp->pr_nargv = dt_alloc(dtp, sizeof (dt_node_t *) * nargc);
+	prp->pr_nargc = nargc;
+	prp->pr_xargs = xargs;
+	prp->pr_xargv = dt_alloc(dtp, sizeof (dt_node_t *) * xargc);
+	prp->pr_xargc = xargc;
+	prp->pr_mapping = dt_alloc(dtp, sizeof (uint8_t) * xargc);
+	prp->pr_inst = NULL;
+	prp->pr_argv = dt_alloc(dtp, sizeof (dtrace_typeinfo_t) * xargc);
+	prp->pr_argc = xargc;
+
+	if ((prp->pr_nargc != 0 && prp->pr_nargv == NULL) ||
+	    (prp->pr_xargc != 0 && prp->pr_xargv == NULL) ||
+	    (prp->pr_xargc != 0 && prp->pr_mapping == NULL) ||
+	    (prp->pr_argc != 0 && prp->pr_argv == NULL)) {
+		dt_probe_destroy(prp);
+		return (NULL);
+	}
+
+	for (i = 0; i < xargc; i++, xargs = xargs->dn_list) {
+		if (xargs->dn_string != NULL)
+			prp->pr_mapping[i] = dt_probe_argmap(xargs, nargs);
+		else
+			prp->pr_mapping[i] = i;
+
+		prp->pr_xargv[i] = xargs;
+
+		if ((dmp = dt_module_lookup_by_ctf(dtp,
+		    xargs->dn_ctfp)) != NULL)
+			prp->pr_argv[i].dtt_object = dmp->dm_name;
+		else
+			prp->pr_argv[i].dtt_object = NULL;
+
+		prp->pr_argv[i].dtt_ctfp = xargs->dn_ctfp;
+		prp->pr_argv[i].dtt_type = xargs->dn_type;
+	}
+
+	for (i = 0; i < nargc; i++, nargs = nargs->dn_list)
+		prp->pr_nargv[i] = nargs;
+
+	idp->di_data = prp;
+	return (prp);
+}
+
+void
+dt_probe_declare(dt_provider_t *pvp, dt_probe_t *prp)
+{
+	assert(prp->pr_ident->di_kind == DT_IDENT_PROBE);
+	assert(prp->pr_ident->di_data == prp);
+	assert(prp->pr_pvp == NULL);
+
+	if (prp->pr_xargs != prp->pr_nargs)
+		pvp->pv_flags &= ~DT_PROVIDER_INTF;
+
+	prp->pr_pvp = pvp;
+	dt_idhash_xinsert(pvp->pv_probes, prp->pr_ident);
+}
+
+void
+dt_probe_destroy(dt_probe_t *prp)
+{
+	dt_probe_instance_t *pip, *pip_next;
+	dtrace_hdl_t *dtp;
+
+	if (prp->pr_pvp != NULL)
+		dtp = prp->pr_pvp->pv_hdl;
+	else
+		dtp = yypcb->pcb_hdl;
+
+	dt_node_list_free(&prp->pr_nargs);
+	dt_node_list_free(&prp->pr_xargs);
+
+	dt_free(dtp, prp->pr_nargv);
+	dt_free(dtp, prp->pr_xargv);
+
+	for (pip = prp->pr_inst; pip != NULL; pip = pip_next) {
+		pip_next = pip->pi_next;
+		dt_free(dtp, pip->pi_offs);
+		dt_free(dtp, pip->pi_enoffs);
+		dt_free(dtp, pip);
+	}
+
+	dt_free(dtp, prp->pr_mapping);
+	dt_free(dtp, prp->pr_argv);
+	dt_free(dtp, prp);
+}
+
+int
+dt_probe_define(dt_provider_t *pvp, dt_probe_t *prp,
+    const char *fname, const char *rname, uint32_t offset, int isenabled)
+{
+	dtrace_hdl_t *dtp = pvp->pv_hdl;
+	dt_probe_instance_t *pip;
+	uint32_t **offs;
+	uint_t *noffs, *maxoffs;
+
+	assert(fname != NULL);
+
+	for (pip = prp->pr_inst; pip != NULL; pip = pip->pi_next) {
+		if (strcmp(pip->pi_fname, fname) == 0 &&
+		    ((rname == NULL && pip->pi_rname[0] == '\0') ||
+		    (rname != NULL && strcmp(pip->pi_rname, rname)) == 0))
+			break;
+	}
+
+	if (pip == NULL) {
+		if ((pip = dt_zalloc(dtp, sizeof (*pip))) == NULL)
+			return (-1);
+
+		if ((pip->pi_offs = dt_zalloc(dtp,
+		    sizeof (uint32_t))) == NULL) {
+			dt_free(dtp, pip);
+			return (-1);
+		}
+
+		if ((pip->pi_enoffs = dt_zalloc(dtp,
+		    sizeof (uint32_t))) == NULL) {
+			dt_free(dtp, pip->pi_offs);
+			dt_free(dtp, pip);
+			return (-1);
+		}
+
+		(void) strlcpy(pip->pi_fname, fname, sizeof (pip->pi_fname));
+		if (rname != NULL) {
+			if (strlen(rname) + 1 > sizeof (pip->pi_rname)) {
+				dt_free(dtp, pip->pi_offs);
+				dt_free(dtp, pip);
+				return (dt_set_errno(dtp, EDT_COMPILER));
+			}
+			(void) strcpy(pip->pi_rname, rname);
+		}
+
+		pip->pi_noffs = 0;
+		pip->pi_maxoffs = 1;
+		pip->pi_nenoffs = 0;
+		pip->pi_maxenoffs = 1;
+
+		pip->pi_next = prp->pr_inst;
+
+		prp->pr_inst = pip;
+	}
+
+	if (isenabled) {
+		offs = &pip->pi_enoffs;
+		noffs = &pip->pi_nenoffs;
+		maxoffs = &pip->pi_maxenoffs;
+	} else {
+		offs = &pip->pi_offs;
+		noffs = &pip->pi_noffs;
+		maxoffs = &pip->pi_maxoffs;
+	}
+
+	if (*noffs == *maxoffs) {
+		uint_t new_max = *maxoffs * 2;
+		uint32_t *new_offs = dt_alloc(dtp, sizeof (uint32_t) * new_max);
+
+		if (new_offs == NULL)
+			return (-1);
+
+		bcopy(*offs, new_offs, sizeof (uint32_t) * *maxoffs);
+
+		dt_free(dtp, *offs);
+		*maxoffs = new_max;
+		*offs = new_offs;
+	}
+
+	dt_dprintf("defined probe %s %s:%s %s() +0x%x (%s)\n",
+	    isenabled ? "(is-enabled)" : "",
+	    pvp->pv_desc.dtvd_name, prp->pr_ident->di_name, fname, offset,
+	    rname != NULL ? rname : fname);
+
+	assert(*noffs < *maxoffs);
+	(*offs)[(*noffs)++] = offset;
+
+	return (0);
+}
+
+/*
+ * Lookup the dynamic translator type tag for the specified probe argument and
+ * assign the type to the specified node.  If the type is not yet defined, add
+ * it to the "D" module's type container as a typedef for an unknown type.
+ */
+dt_node_t *
+dt_probe_tag(dt_probe_t *prp, uint_t argn, dt_node_t *dnp)
+{
+	dtrace_hdl_t *dtp = prp->pr_pvp->pv_hdl;
+	dtrace_typeinfo_t dtt;
+	size_t len;
+	char *tag;
+
+	len = snprintf(NULL, 0, "__dtrace_%s___%s_arg%u",
+	    prp->pr_pvp->pv_desc.dtvd_name, prp->pr_name, argn);
+
+	tag = alloca(len + 1);
+
+	(void) snprintf(tag, len + 1, "__dtrace_%s___%s_arg%u",
+	    prp->pr_pvp->pv_desc.dtvd_name, prp->pr_name, argn);
+
+	if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_DDEFS, tag, &dtt) != 0) {
+		dtt.dtt_object = DTRACE_OBJ_DDEFS;
+		dtt.dtt_ctfp = DT_DYN_CTFP(dtp);
+		dtt.dtt_type = ctf_add_typedef(DT_DYN_CTFP(dtp),
+		    CTF_ADD_ROOT, tag, DT_DYN_TYPE(dtp));
+
+		if (dtt.dtt_type == CTF_ERR ||
+		    ctf_update(dtt.dtt_ctfp) == CTF_ERR) {
+			xyerror(D_UNKNOWN, "cannot define type %s: %s\n",
+			    tag, ctf_errmsg(ctf_errno(dtt.dtt_ctfp)));
+		}
+	}
+
+	bzero(dnp, sizeof (dt_node_t));
+	dnp->dn_kind = DT_NODE_TYPE;
+
+	dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type);
+	dt_node_attr_assign(dnp, _dtrace_defattr);
+
+	return (dnp);
+}
+
+/*ARGSUSED*/
+static int
+dt_probe_desc(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *arg)
+{
+	if (((dtrace_probedesc_t *)arg)->dtpd_id == DTRACE_IDNONE) {
+		bcopy(pdp, arg, sizeof (dtrace_probedesc_t));
+		return (0);
+	}
+
+	return (1);
+}
+
+dt_probe_t *
+dt_probe_info(dtrace_hdl_t *dtp,
+    const dtrace_probedesc_t *pdp, dtrace_probeinfo_t *pip)
+{
+	int m_is_glob = pdp->dtpd_mod[0] == '\0' || strisglob(pdp->dtpd_mod);
+	int f_is_glob = pdp->dtpd_func[0] == '\0' || strisglob(pdp->dtpd_func);
+	int n_is_glob = pdp->dtpd_name[0] == '\0' || strisglob(pdp->dtpd_name);
+
+	dt_probe_t *prp = NULL;
+	const dtrace_pattr_t *pap;
+	dt_provider_t *pvp;
+	dt_ident_t *idp;
+
+	/*
+	 * Attempt to lookup the probe in our existing cache for this provider.
+	 * If none is found and an explicit probe ID was specified, discover
+	 * that specific probe and cache its description and arguments.
+	 */
+	if ((pvp = dt_provider_lookup(dtp, pdp->dtpd_provider)) != NULL) {
+		size_t keylen = dt_probe_keylen(pdp);
+		char *key = dt_probe_key(pdp, alloca(keylen));
+
+		if ((idp = dt_idhash_lookup(pvp->pv_probes, key)) != NULL)
+			prp = idp->di_data;
+		else if (pdp->dtpd_id != DTRACE_IDNONE)
+			prp = dt_probe_discover(pvp, pdp);
+	}
+
+	/*
+	 * If no probe was found in our cache, convert the caller's partial
+	 * probe description into a fully-formed matching probe description by
+	 * iterating over up to at most two probes that match 'pdp'.  We then
+	 * call dt_probe_discover() on the resulting probe identifier.
+	 */
+	if (prp == NULL) {
+		dtrace_probedesc_t pd;
+		int m;
+
+		bzero(&pd, sizeof (pd));
+		pd.dtpd_id = DTRACE_IDNONE;
+
+		/*
+		 * Call dtrace_probe_iter() to find matching probes.  Our
+		 * dt_probe_desc() callback will produce the following results:
+		 *
+		 * m < 0 dtrace_probe_iter() found zero matches (or failed).
+		 * m > 0 dtrace_probe_iter() found more than one match.
+		 * m = 0 dtrace_probe_iter() found exactly one match.
+		 */
+		if ((m = dtrace_probe_iter(dtp, pdp, dt_probe_desc, &pd)) < 0)
+			return (NULL); /* dt_errno is set for us */
+
+		if ((pvp = dt_provider_lookup(dtp, pd.dtpd_provider)) == NULL)
+			return (NULL); /* dt_errno is set for us */
+
+		/*
+		 * If more than one probe was matched, then do not report probe
+		 * information if either of the following conditions is true:
+		 *
+		 * (a) The Arguments Data stability of the matched provider is
+		 *	less than Evolving.
+		 *
+		 * (b) Any description component that is at least Evolving is
+		 *	empty or is specified using a globbing expression.
+		 *
+		 * These conditions imply that providers that provide Evolving
+		 * or better Arguments Data stability must guarantee that all
+		 * probes with identical field names in a field of Evolving or
+		 * better Name stability have identical argument signatures.
+		 */
+		if (m > 0) {
+			if (pvp->pv_desc.dtvd_attr.dtpa_args.dtat_data <
+			    DTRACE_STABILITY_EVOLVING) {
+				(void) dt_set_errno(dtp, EDT_UNSTABLE);
+				return (NULL);
+			}
+
+
+			if (pvp->pv_desc.dtvd_attr.dtpa_mod.dtat_name >=
+			    DTRACE_STABILITY_EVOLVING && m_is_glob) {
+				(void) dt_set_errno(dtp, EDT_UNSTABLE);
+				return (NULL);
+			}
+
+			if (pvp->pv_desc.dtvd_attr.dtpa_func.dtat_name >=
+			    DTRACE_STABILITY_EVOLVING && f_is_glob) {
+				(void) dt_set_errno(dtp, EDT_UNSTABLE);
+				return (NULL);
+			}
+
+			if (pvp->pv_desc.dtvd_attr.dtpa_name.dtat_name >=
+			    DTRACE_STABILITY_EVOLVING && n_is_glob) {
+				(void) dt_set_errno(dtp, EDT_UNSTABLE);
+				return (NULL);
+			}
+		}
+
+		/*
+		 * If we matched a probe exported by dtrace(7D), then discover
+		 * the real attributes.  Otherwise grab the static declaration.
+		 */
+		if (pd.dtpd_id != DTRACE_IDNONE)
+			prp = dt_probe_discover(pvp, &pd);
+		else
+			prp = dt_probe_lookup(pvp, pd.dtpd_name);
+
+		if (prp == NULL)
+			return (NULL); /* dt_errno is set for us */
+	}
+
+	assert(pvp != NULL && prp != NULL);
+
+	/*
+	 * Compute the probe description attributes by taking the minimum of
+	 * the attributes of the specified fields.  If no provider is specified
+	 * or a glob pattern is used for the provider, use Unstable attributes.
+	 */
+	if (pdp->dtpd_provider[0] == '\0' || strisglob(pdp->dtpd_provider))
+		pap = &_dtrace_prvdesc;
+	else
+		pap = &pvp->pv_desc.dtvd_attr;
+
+	pip->dtp_attr = pap->dtpa_provider;
+
+	if (!m_is_glob)
+		pip->dtp_attr = dt_attr_min(pip->dtp_attr, pap->dtpa_mod);
+	if (!f_is_glob)
+		pip->dtp_attr = dt_attr_min(pip->dtp_attr, pap->dtpa_func);
+	if (!n_is_glob)
+		pip->dtp_attr = dt_attr_min(pip->dtp_attr, pap->dtpa_name);
+
+	pip->dtp_arga = pap->dtpa_args;
+	pip->dtp_argv = prp->pr_argv;
+	pip->dtp_argc = prp->pr_argc;
+
+	return (prp);
+}
+
+int
+dtrace_probe_info(dtrace_hdl_t *dtp,
+    const dtrace_probedesc_t *pdp, dtrace_probeinfo_t *pip)
+{
+	return (dt_probe_info(dtp, pdp, pip) != NULL ? 0 : -1);
+}
+
+/*ARGSUSED*/
+static int
+dt_probe_iter(dt_idhash_t *ihp, dt_ident_t *idp, dt_probe_iter_t *pit)
+{
+	const dt_probe_t *prp = idp->di_data;
+
+	if (!dt_gmatch(prp->pr_name, pit->pit_pat))
+		return (0); /* continue on and examine next probe in hash */
+
+	(void) strlcpy(pit->pit_desc.dtpd_name, prp->pr_name, DTRACE_NAMELEN);
+	pit->pit_desc.dtpd_id = idp->di_id;
+	pit->pit_matches++;
+
+	return (pit->pit_func(pit->pit_hdl, &pit->pit_desc, pit->pit_arg));
+}
+
+int
+dtrace_probe_iter(dtrace_hdl_t *dtp,
+    const dtrace_probedesc_t *pdp, dtrace_probe_f *func, void *arg)
+{
+	const char *provider = pdp ? pdp->dtpd_provider : NULL;
+	dtrace_id_t id = DTRACE_IDNONE;
+
+	dtrace_probedesc_t pd;
+	dt_probe_iter_t pit;
+	int cmd, rv;
+
+	bzero(&pit, sizeof (pit));
+	pit.pit_hdl = dtp;
+	pit.pit_func = func;
+	pit.pit_arg = arg;
+	pit.pit_pat = pdp ? pdp->dtpd_name : NULL;
+
+	for (pit.pit_pvp = dt_list_next(&dtp->dt_provlist);
+	    pit.pit_pvp != NULL; pit.pit_pvp = dt_list_next(pit.pit_pvp)) {
+
+		if (pit.pit_pvp->pv_flags & DT_PROVIDER_IMPL)
+			continue; /* we'll get these later using dt_ioctl() */
+
+		if (!dt_gmatch(pit.pit_pvp->pv_desc.dtvd_name, provider))
+			continue;
+
+		(void) strlcpy(pit.pit_desc.dtpd_provider,
+		    pit.pit_pvp->pv_desc.dtvd_name, DTRACE_PROVNAMELEN);
+
+		if ((rv = dt_idhash_iter(pit.pit_pvp->pv_probes,
+		    (dt_idhash_f *)dt_probe_iter, &pit)) != 0)
+			return (rv);
+	}
+
+	if (pdp != NULL)
+		cmd = DTRACEIOC_PROBEMATCH;
+	else
+		cmd = DTRACEIOC_PROBES;
+
+	for (;;) {
+		if (pdp != NULL)
+			bcopy(pdp, &pd, sizeof (pd));
+
+		pd.dtpd_id = id;
+
+		if (dt_ioctl(dtp, cmd, &pd) != 0)
+			break;
+		else if ((rv = func(dtp, &pd, arg)) != 0)
+			return (rv);
+
+		pit.pit_matches++;
+		id = pd.dtpd_id + 1;
+	}
+
+	switch (errno) {
+	case ESRCH:
+	case EBADF:
+		return (pit.pit_matches ? 0 : dt_set_errno(dtp, EDT_NOPROBE));
+	case EINVAL:
+		return (dt_set_errno(dtp, EDT_BADPGLOB));
+	default:
+		return (dt_set_errno(dtp, errno));
+	}
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_provider.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_provider.h
new file mode 100644
index 0000000..c7b5138
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_provider.h
@@ -0,0 +1,120 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_PROVIDER_H
+#define	_DT_PROVIDER_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <dt_impl.h>
+#include <dt_ident.h>
+#include <dt_list.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct dt_provider {
+	dt_list_t pv_list;		/* list forward/back pointers */
+	struct dt_provider *pv_next;	/* pointer to next provider in hash */
+	dtrace_providerdesc_t pv_desc;	/* provider name and attributes */
+	dt_idhash_t *pv_probes;		/* probe defs (if user-declared) */
+	dt_node_t *pv_nodes;		/* parse node allocation list */
+	ulong_t *pv_xrefs;		/* translator reference bitmap */
+	ulong_t pv_xrmax;		/* number of valid bits in pv_xrefs */
+	ulong_t pv_gen;			/* generation # that created me */
+	dtrace_hdl_t *pv_hdl;		/* pointer to containing dtrace_hdl */
+	uint_t pv_flags;		/* flags (see below) */
+} dt_provider_t;
+
+#define	DT_PROVIDER_INTF	0x1	/* provider interface declaration */
+#define	DT_PROVIDER_IMPL	0x2	/* provider implementation is loaded */
+
+typedef struct dt_probe_iter {
+	dtrace_probedesc_t pit_desc;	/* description storage */
+	dtrace_hdl_t *pit_hdl;		/* libdtrace handle */
+	dt_provider_t *pit_pvp;		/* current provider */
+	const char *pit_pat;		/* caller's name pattern (or NULL) */
+	dtrace_probe_f *pit_func;	/* caller's function */
+	void *pit_arg;			/* caller's argument */
+	uint_t pit_matches;		/* number of matches */
+} dt_probe_iter_t;
+
+typedef struct dt_probe_instance {
+	char pi_fname[DTRACE_FUNCNAMELEN]; /* function name */
+	char pi_rname[DTRACE_FUNCNAMELEN + 20]; /* mangled relocation name */
+	uint32_t *pi_offs;		/* offsets into the function */
+	uint32_t *pi_enoffs;		/* is-enabled offsets */
+	uint_t pi_noffs;		/* number of offsets */
+	uint_t pi_maxoffs;		/* size of pi_offs allocation */
+	uint_t pi_nenoffs;		/* number of is-enabled offsets */
+	uint_t pi_maxenoffs;		/* size of pi_enoffs allocation */
+	struct dt_probe_instance *pi_next; /* next instance in the list */
+} dt_probe_instance_t;
+
+typedef struct dt_probe {
+	dt_provider_t *pr_pvp;		/* pointer to containing provider */
+	dt_ident_t *pr_ident;		/* pointer to probe identifier */
+	const char *pr_name;		/* pointer to name component */
+	dt_node_t *pr_nargs;		/* native argument list */
+	dt_node_t **pr_nargv;		/* native argument vector */
+	uint_t pr_nargc;		/* native argument count */
+	dt_node_t *pr_xargs;		/* translated argument list */
+	dt_node_t **pr_xargv;		/* translated argument vector */
+	uint_t pr_xargc;		/* translated argument count */
+	uint8_t *pr_mapping;		/* translated argument mapping */
+	dt_probe_instance_t *pr_inst;	/* list of functions and offsets */
+	dtrace_typeinfo_t *pr_argv;	/* output argument types */
+	int pr_argc;			/* output argument count */
+} dt_probe_t;
+
+extern dt_provider_t *dt_provider_lookup(dtrace_hdl_t *, const char *);
+extern dt_provider_t *dt_provider_create(dtrace_hdl_t *, const char *);
+extern void dt_provider_destroy(dtrace_hdl_t *, dt_provider_t *);
+extern int dt_provider_xref(dtrace_hdl_t *, dt_provider_t *, id_t);
+
+extern dt_probe_t *dt_probe_create(dtrace_hdl_t *, dt_ident_t *, int,
+    dt_node_t *, uint_t, dt_node_t *, uint_t);
+
+extern dt_probe_t *dt_probe_info(dtrace_hdl_t *,
+    const dtrace_probedesc_t *, dtrace_probeinfo_t *);
+
+extern dt_probe_t *dt_probe_lookup(dt_provider_t *, const char *);
+extern void dt_probe_declare(dt_provider_t *, dt_probe_t *);
+extern void dt_probe_destroy(dt_probe_t *);
+
+extern int dt_probe_define(dt_provider_t *, dt_probe_t *,
+    const char *, const char *, uint32_t, int);
+
+extern dt_node_t *dt_probe_tag(dt_probe_t *, uint_t, dt_node_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_PROVIDER_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.c
new file mode 100644
index 0000000..35032d9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.c
@@ -0,0 +1,112 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#include <sys/bitmap.h>
+#include <assert.h>
+#include <strings.h>
+#include <stdlib.h>
+#else  /* VBOX */
+# include <iprt/asm.h>
+# include "VBoxDTraceLibCWrappers.h"
+#endif /* VBOX */
+
+#include <dt_regset.h>
+
+dt_regset_t *
+dt_regset_create(ulong_t size)
+{
+	ulong_t n = BT_BITOUL(size + 1); /* + 1 for %r0 */
+	dt_regset_t *drp = malloc(sizeof (dt_regset_t));
+
+	if (drp == NULL)
+		return (NULL);
+
+	drp->dr_bitmap = malloc(sizeof (ulong_t) * n);
+	drp->dr_size = size + 1;
+
+	if (drp->dr_bitmap == NULL) {
+		dt_regset_destroy(drp);
+		return (NULL);
+	}
+
+	bzero(drp->dr_bitmap, sizeof (ulong_t) * n);
+	return (drp);
+}
+
+void
+dt_regset_destroy(dt_regset_t *drp)
+{
+	free(drp->dr_bitmap);
+	free(drp);
+}
+
+void
+dt_regset_reset(dt_regset_t *drp)
+{
+	bzero(drp->dr_bitmap, sizeof (ulong_t) * BT_BITOUL(drp->dr_size));
+}
+
+int
+dt_regset_alloc(dt_regset_t *drp)
+{
+	ulong_t nbits = drp->dr_size - 1;
+	ulong_t maxw = nbits >> BT_ULSHIFT;
+	ulong_t wx;
+
+	for (wx = 0; wx <= maxw; wx++) {
+		if (drp->dr_bitmap[wx] != ~0UL)
+			break;
+	}
+
+	if (wx <= maxw) {
+		ulong_t maxb = (wx == maxw) ? nbits & BT_ULMASK : BT_NBIPUL - 1;
+		ulong_t word = drp->dr_bitmap[wx];
+		ulong_t bit, bx;
+		int reg;
+
+		for (bit = 1, bx = 0; bx <= maxb; bx++, bit <<= 1) {
+			if ((word & bit) == 0) {
+				reg = (int)((wx << BT_ULSHIFT) | bx);
+				BT_SET(drp->dr_bitmap, reg);
+				return (reg);
+			}
+		}
+	}
+
+	return (-1); /* no available registers */
+}
+
+void
+dt_regset_free(dt_regset_t *drp, int reg)
+{
+	assert(reg > 0 && reg < drp->dr_size);
+	assert(BT_TEST(drp->dr_bitmap, reg) != 0);
+	BT_CLEAR(drp->dr_bitmap, reg);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.h
new file mode 100644
index 0000000..3dc20d5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_regset.h
@@ -0,0 +1,57 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_REGSET_H
+#define	_DT_REGSET_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#else  /* VBOX */
+# include "VBoxDTraceTypes.h"
+#endif /* VBOX */
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct dt_regset {
+	ulong_t dr_size;		/* number of registers in set */
+	ulong_t *dr_bitmap;		/* bitmap of active registers */
+} dt_regset_t;
+
+extern dt_regset_t *dt_regset_create(ulong_t);
+extern void dt_regset_destroy(dt_regset_t *);
+extern void dt_regset_reset(dt_regset_t *);
+extern int dt_regset_alloc(dt_regset_t *);
+extern void dt_regset_free(dt_regset_t *, int);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_REGSET_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_string.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_string.c
new file mode 100644
index 0000000..166bfbf
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_string.c
@@ -0,0 +1,348 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <strings.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <ctype.h>
+
+#include <dt_string.h>
+
+#else  /* VBOX */
+# include <dt_string.h>
+# include <dt_impl.h>
+# include <iprt/ctype.h>
+# define isalnum(a_ch) RT_C_IS_ALNUM(a_ch)
+#endif /* VBOX */
+
+/*
+ * Transform string s inline, converting each embedded C escape sequence string
+ * to the corresponding character.  For example, the substring "\n" is replaced
+ * by an inline '\n' character.  The length of the resulting string is returned.
+ */
+size_t
+stresc2chr(char *s)
+{
+	char *p, *q, c;
+	int esc = 0;
+	int x;
+
+	for (p = q = s; (c = *p) != '\0'; p++) {
+		if (esc) {
+			switch (c) {
+			case '0':
+			case '1':
+			case '2':
+			case '3':
+			case '4':
+			case '5':
+			case '6':
+			case '7':
+				c -= '0';
+				p++;
+
+				if (*p >= '0' && *p <= '7') {
+					c = c * 8 + *p++ - '0';
+
+					if (*p >= '0' && *p <= '7')
+						c = c * 8 + *p - '0';
+					else
+						p--;
+				} else
+					p--;
+
+				*q++ = c;
+				break;
+
+			case 'a':
+				*q++ = '\a';
+				break;
+			case 'b':
+				*q++ = '\b';
+				break;
+			case 'f':
+				*q++ = '\f';
+				break;
+			case 'n':
+				*q++ = '\n';
+				break;
+			case 'r':
+				*q++ = '\r';
+				break;
+			case 't':
+				*q++ = '\t';
+				break;
+			case 'v':
+				*q++ = '\v';
+				break;
+
+			case 'x':
+				for (x = 0; (c = *++p) != '\0'; ) {
+					if (c >= '0' && c <= '9')
+						x = x * 16 + c - '0';
+					else if (c >= 'a' && c <= 'f')
+						x = x * 16 + c - 'a' + 10;
+					else if (c >= 'A' && c <= 'F')
+						x = x * 16 + c - 'A' + 10;
+					else
+						break;
+				}
+				*q++ = (char)x;
+				p--;
+				break;
+
+			case '"':
+			case '\\':
+				*q++ = c;
+				break;
+			default:
+				*q++ = '\\';
+				*q++ = c;
+			}
+
+			esc = 0;
+
+		} else {
+			if ((esc = c == '\\') == 0)
+				*q++ = c;
+		}
+	}
+
+	*q = '\0';
+	return ((size_t)(q - s));
+}
+
+/*
+ * Create a copy of string s in which certain unprintable or special characters
+ * have been converted to the string representation of their C escape sequence.
+ * For example, the newline character is expanded to the string "\n".
+ */
+char *
+strchr2esc(const char *s, size_t n)
+{
+	const char *p;
+	char *q, *s2, c;
+	size_t addl = 0;
+
+	for (p = s; p < s + n; p++) {
+		switch (c = *p) {
+		case '\0':
+		case '\a':
+		case '\b':
+		case '\f':
+		case '\n':
+		case '\r':
+		case '\t':
+		case '\v':
+		case '"':
+		case '\\':
+			addl++;		/* 1 add'l char needed to follow \ */
+			break;
+		case ' ':
+			break;
+		default:
+			if (c < '!' || c > '~')
+				addl += 3; /* 3 add'l chars following \ */
+		}
+	}
+
+	if ((s2 = malloc(n + addl + 1)) == NULL)
+		return (NULL);
+
+	for (p = s, q = s2; p < s + n; p++) {
+		switch (c = *p) {
+		case '\0':
+			*q++ = '\\';
+			*q++ = '0';
+			break;
+		case '\a':
+			*q++ = '\\';
+			*q++ = 'a';
+			break;
+		case '\b':
+			*q++ = '\\';
+			*q++ = 'b';
+			break;
+		case '\f':
+			*q++ = '\\';
+			*q++ = 'f';
+			break;
+		case '\n':
+			*q++ = '\\';
+			*q++ = 'n';
+			break;
+		case '\r':
+			*q++ = '\\';
+			*q++ = 'r';
+			break;
+		case '\t':
+			*q++ = '\\';
+			*q++ = 't';
+			break;
+		case '\v':
+			*q++ = '\\';
+			*q++ = 'v';
+			break;
+		case '"':
+			*q++ = '\\';
+			*q++ = '"';
+			break;
+		case '\\':
+			*q++ = '\\';
+			*q++ = '\\';
+			break;
+		case ' ':
+			*q++ = c;
+			break;
+		default:
+			if (c < '!' || c > '~') {
+				*q++ = '\\';
+				*q++ = ((c >> 6) & 3) + '0';
+				*q++ = ((c >> 3) & 7) + '0';
+				*q++ = (c & 7) + '0';
+			} else
+				*q++ = c;
+		}
+
+		if (c == '\0')
+			break; /* don't continue past \0 even if p < s + n */
+	}
+
+	*q = '\0';
+	return (s2);
+}
+
+/*
+ * Return the basename (name after final /) of the given string.  We use
+ * strbasename rather than basename to avoid conflicting with libgen.h's
+ * non-const function prototype.
+ */
+const char *
+strbasename(const char *s)
+{
+	const char *p = strrchr(s, '/');
+
+	if (p == NULL)
+		return (s);
+
+	return (++p);
+}
+
+/*
+ * This function tests a string against the regular expression used for idents
+ * and integers in the D lexer, and should match the superset of RGX_IDENT and
+ * RGX_INT in dt_lex.l.  If an invalid character is found, the function returns
+ * a pointer to it.  Otherwise NULL is returned for a valid string.
+ */
+const char *
+strbadidnum(const char *s)
+{
+#ifndef VBOX
+	char *p;
+#endif
+	int c;
+
+	if (*s == '\0')
+		return (s);
+
+#ifndef VBOX
+	errno = 0;
+	(void) strtoull(s, &p, 0);
+
+	if (errno == 0 && *p == '\0')
+		return (NULL); /* matches RGX_INT */
+#else
+	/* A number? */
+	c = *s;
+	if (RT_C_IS_DIGIT(c)) {
+		s++;
+		if (c == '0') {
+			c = *s;
+			if (c == 'x' || c == 'X') {
+				s++;
+				while ((c = *s++) != '\0') {
+					if (RT_C_IS_XDIGIT(c) == 0)
+						return (s - 1);
+				}
+			} else  {
+				while ((c = *s++) != '\0') {
+					if (RT_C_IS_ODIGIT(c) == 0)
+						return (s - 1);
+				}
+			}
+		} else {
+			while ((c = *s++) != '\0') {
+				if (RT_C_IS_DIGIT(c) == 0)
+					return (s - 1);
+			}
+		}
+		return (NULL); /* matches RGX_INT */
+	}
+#endif
+
+	while ((c = *s++) != '\0') {
+		if (isalnum(c) == 0 && c != '_' && c != '`')
+			return (s - 1);
+	}
+
+	return (NULL); /* matches RGX_IDENT */
+}
+
+/*
+ * Determine whether the string contains a glob matching pattern or is just a
+ * simple string.  See gmatch(3GEN) and sh(1) for the glob syntax definition.
+ */
+int
+strisglob(const char *s)
+{
+	char c;
+
+	while ((c = *s++) != '\0') {
+		if (c == '[' || c == '?' || c == '*' || c == '\\')
+			return (1);
+	}
+
+	return (0);
+}
+
+/*
+ * Hyphenate a string in-place by converting any instances of "__" to "-",
+ * which we use for probe names to improve readability, and return the string.
+ */
+char *
+strhyphenate(char *s)
+{
+	char *p, *q;
+
+	for (p = s, q = p + strlen(p); p < q; p++) {
+		if (p[0] == '_' && p[1] == '_') {
+			p[0] = '-';
+			bcopy(p + 2, p + 1, (size_t)(q - p) - 1);
+		}
+	}
+
+	return (s);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_string.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_string.h
new file mode 100644
index 0000000..0c9bb40
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_string.h
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef	_DT_STRING_H
+#define	_DT_STRING_H
+
+#ifndef VBOX
+#include <sys/types.h>
+#include <strings.h>
+#else  /* VBOX */
+# include <iprt/string.h>
+#endif /* VBOX */
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+extern size_t stresc2chr(char *);
+extern char *strchr2esc(const char *, size_t);
+extern const char *strbasename(const char *);
+extern const char *strbadidnum(const char *);
+extern int strisglob(const char *);
+extern char *strhyphenate(char *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_STRING_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.c
new file mode 100644
index 0000000..c19d1b9
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.c
@@ -0,0 +1,295 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#include <sys/sysmacros.h>
+#include <strings.h>
+#include <stdlib.h>
+#include <assert.h>
+#endif
+
+#include <dt_strtab.h>
+#include <dt_impl.h>
+
+static int
+dt_strtab_grow(dt_strtab_t *sp)
+{
+	char *ptr, **bufs;
+
+	if ((ptr = malloc(sp->str_bufsz)) == NULL)
+		return (-1);
+
+	bufs = realloc(sp->str_bufs, (sp->str_nbufs + 1) * sizeof (char *));
+
+	if (bufs == NULL) {
+		free(ptr);
+		return (-1);
+	}
+
+	sp->str_nbufs++;
+	sp->str_bufs = bufs;
+	sp->str_ptr = ptr;
+	sp->str_bufs[sp->str_nbufs - 1] = sp->str_ptr;
+
+	return (0);
+}
+
+dt_strtab_t *
+dt_strtab_create(size_t bufsz)
+{
+	dt_strtab_t *sp = malloc(sizeof (dt_strtab_t));
+	uint_t nbuckets = _dtrace_strbuckets;
+
+	assert(bufsz != 0);
+
+	if (sp == NULL)
+		return (NULL);
+
+	bzero(sp, sizeof (dt_strtab_t));
+	sp->str_hash = malloc(nbuckets * sizeof (dt_strhash_t *));
+
+	if (sp->str_hash == NULL)
+		goto err;
+
+	bzero(sp->str_hash, nbuckets * sizeof (dt_strhash_t *));
+	sp->str_hashsz = nbuckets;
+	sp->str_bufs = NULL;
+	sp->str_ptr = NULL;
+	sp->str_nbufs = 0;
+	sp->str_bufsz = bufsz;
+	sp->str_nstrs = 1;
+	sp->str_size = 1;
+
+	if (dt_strtab_grow(sp) == -1)
+		goto err;
+
+	*sp->str_ptr++ = '\0';
+	return (sp);
+
+err:
+	dt_strtab_destroy(sp);
+	return (NULL);
+}
+
+void
+dt_strtab_destroy(dt_strtab_t *sp)
+{
+	dt_strhash_t *hp, *hq;
+	ulong_t i;
+
+	for (i = 0; i < sp->str_hashsz; i++) {
+		for (hp = sp->str_hash[i]; hp != NULL; hp = hq) {
+			hq = hp->str_next;
+			free(hp);
+		}
+	}
+
+	for (i = 0; i < sp->str_nbufs; i++)
+		free(sp->str_bufs[i]);
+
+	if (sp->str_hash != NULL)
+		free(sp->str_hash);
+	if (sp->str_bufs != NULL)
+		free(sp->str_bufs);
+
+	free(sp);
+}
+
+ulong_t
+dt_strtab_hash(const char *key, size_t *len)
+{
+	ulong_t g, h = 0;
+	const char *p;
+	size_t n = 0;
+
+	for (p = key; *p != '\0'; p++, n++) {
+		h = (h << 4) + *p;
+
+		if ((g = (h & 0xf0000000)) != 0) {
+			h ^= (g >> 24);
+			h ^= g;
+		}
+	}
+
+	if (len != NULL)
+		*len = n;
+
+	return (h);
+}
+
+static int
+dt_strtab_compare(dt_strtab_t *sp, dt_strhash_t *hp,
+    const char *str, size_t len)
+{
+	ulong_t b = hp->str_buf;
+	const char *buf = hp->str_data;
+	size_t resid, n;
+	int rv;
+
+	while (len != 0) {
+		if (buf == sp->str_bufs[b] + sp->str_bufsz)
+			buf = sp->str_bufs[++b];
+
+		resid = sp->str_bufs[b] + sp->str_bufsz - buf;
+		n = MIN(resid, len);
+
+		if ((rv = strncmp(buf, str, n)) != 0)
+			return (rv);
+
+		buf += n;
+		str += n;
+		len -= n;
+	}
+
+	return (0);
+}
+
+static int
+dt_strtab_copyin(dt_strtab_t *sp, const char *str, size_t len)
+{
+	char *old_p = sp->str_ptr;
+	ulong_t old_n = sp->str_nbufs;
+
+	ulong_t b = sp->str_nbufs - 1;
+	size_t resid, n;
+
+	while (len != 0) {
+		if (sp->str_ptr == sp->str_bufs[b] + sp->str_bufsz) {
+			if (dt_strtab_grow(sp) == -1)
+				goto err;
+			b++;
+		}
+
+		resid = sp->str_bufs[b] + sp->str_bufsz - sp->str_ptr;
+		n = MIN(resid, len);
+		bcopy(str, sp->str_ptr, n);
+
+		sp->str_ptr += n;
+		str += n;
+		len -= n;
+	}
+
+	return (0);
+
+err:
+	while (sp->str_nbufs != old_n)
+		free(sp->str_bufs[--sp->str_nbufs]);
+
+	sp->str_ptr = old_p;
+	return (-1);
+}
+
+ssize_t
+dt_strtab_index(dt_strtab_t *sp, const char *str)
+{
+	dt_strhash_t *hp;
+	size_t len;
+	ulong_t h;
+
+	if (str == NULL || str[0] == '\0')
+		return (0); /* we keep a \0 at offset 0 to simplify things */
+
+	h = dt_strtab_hash(str, &len) % sp->str_hashsz;
+
+	for (hp = sp->str_hash[h]; hp != NULL; hp = hp->str_next) {
+		if (dt_strtab_compare(sp, hp, str, len + 1) == 0)
+			return (hp->str_off);
+	}
+
+	return (-1);
+}
+
+ssize_t
+dt_strtab_insert(dt_strtab_t *sp, const char *str)
+{
+	dt_strhash_t *hp;
+	size_t len;
+	ssize_t off;
+	ulong_t h;
+
+	if ((off = dt_strtab_index(sp, str)) != -1)
+		return (off);
+
+	h = dt_strtab_hash(str, &len) % sp->str_hashsz;
+
+	/*
+	 * Create a new hash bucket, initialize it, and insert it at the front
+	 * of the hash chain for the appropriate bucket.
+	 */
+	if ((hp = malloc(sizeof (dt_strhash_t))) == NULL)
+		return (-1L);
+
+	hp->str_data = sp->str_ptr;
+	hp->str_buf = sp->str_nbufs - 1;
+	hp->str_off = sp->str_size;
+	hp->str_len = len;
+	hp->str_next = sp->str_hash[h];
+
+	/*
+	 * Now copy the string data into our buffer list, and then update
+	 * the global counts of strings and bytes.  Return str's byte offset.
+	 */
+	if (dt_strtab_copyin(sp, str, len + 1) == -1)
+		return (-1L);
+
+	sp->str_nstrs++;
+	sp->str_size += len + 1;
+	sp->str_hash[h] = hp;
+
+	return (hp->str_off);
+}
+
+size_t
+dt_strtab_size(const dt_strtab_t *sp)
+{
+	return (sp->str_size);
+}
+
+ssize_t
+dt_strtab_write(const dt_strtab_t *sp, dt_strtab_write_f *func, void *private)
+{
+	ssize_t res, total = 0;
+	ulong_t i;
+	size_t n;
+
+	for (i = 0; i < sp->str_nbufs; i++, total += res) {
+		if (i == sp->str_nbufs - 1)
+			n = sp->str_ptr - sp->str_bufs[i];
+		else
+			n = sp->str_bufsz;
+
+		if ((res = func(sp->str_bufs[i], n, total, private)) <= 0)
+			break;
+	}
+
+	if (total == 0 && sp->str_size != 0)
+		return (-1);
+
+	return (total);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.h
new file mode 100644
index 0000000..e70da98
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_strtab.h
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_STRTAB_H
+#define	_DT_STRTAB_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/types.h>
+#else
+# include "VBoxDTraceTypes.h"
+#endif
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+typedef struct dt_strhash {
+	const char *str_data;		/* pointer to actual string data */
+	ulong_t str_buf;		/* index of string data buffer */
+	size_t str_off;			/* offset in bytes of this string */
+	size_t str_len;			/* length in bytes of this string */
+	struct dt_strhash *str_next;	/* next string in hash chain */
+} dt_strhash_t;
+
+typedef struct dt_strtab {
+	dt_strhash_t **str_hash;	/* array of hash buckets */
+	ulong_t str_hashsz;		/* size of hash bucket array */
+	char **str_bufs;		/* array of buffer pointers */
+	char *str_ptr;			/* pointer to current buffer location */
+	ulong_t str_nbufs;		/* size of buffer pointer array */
+	size_t str_bufsz;		/* size of individual buffer */
+	ulong_t str_nstrs;		/* total number of strings in strtab */
+	size_t str_size;		/* total size of strings in bytes */
+} dt_strtab_t;
+
+typedef ssize_t dt_strtab_write_f(const char *, size_t, size_t, void *);
+
+extern dt_strtab_t *dt_strtab_create(size_t);
+extern void dt_strtab_destroy(dt_strtab_t *);
+extern ssize_t dt_strtab_index(dt_strtab_t *, const char *);
+extern ssize_t dt_strtab_insert(dt_strtab_t *, const char *);
+extern size_t dt_strtab_size(const dt_strtab_t *);
+extern ssize_t dt_strtab_write(const dt_strtab_t *,
+    dt_strtab_write_f *, void *);
+extern ulong_t dt_strtab_hash(const char *, size_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_STRTAB_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_subr.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_subr.c
new file mode 100644
index 0000000..2e29e09
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_subr.c
@@ -0,0 +1,1002 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#ifndef VBOX
+#include <sys/sysmacros.h>
+
+#include <strings.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <ctype.h>
+#include <alloca.h>
+#include <assert.h>
+#include <libgen.h>
+#include <limits.h>
+#else  /* VBOX */
+# include <ctype.h>
+# include <iprt/mp.h>
+# ifdef _MSC_VER
+#  include <io.h>
+# else
+#  include <unistd.h>
+# endif
+# include <VBox/sup.h>
+# include <VBox/err.h>
+#endif /* VBOX */
+
+#include <dt_impl.h>
+
+static const struct {
+	size_t dtps_offset;
+	size_t dtps_len;
+} dtrace_probespecs[] = {
+	{ offsetof(dtrace_probedesc_t, dtpd_provider),	DTRACE_PROVNAMELEN },
+	{ offsetof(dtrace_probedesc_t, dtpd_mod),	DTRACE_MODNAMELEN },
+	{ offsetof(dtrace_probedesc_t, dtpd_func),	DTRACE_FUNCNAMELEN },
+	{ offsetof(dtrace_probedesc_t, dtpd_name),	DTRACE_NAMELEN }
+};
+
+int
+dtrace_xstr2desc(dtrace_hdl_t *dtp, dtrace_probespec_t spec,
+    const char *s, int argc, char *const argv[], dtrace_probedesc_t *pdp)
+{
+	size_t off, len, vlen, wlen;
+	const char *p, *q, *v, *w;
+
+	char buf[32]; /* for id_t as %d (see below) */
+
+	if (spec < DTRACE_PROBESPEC_NONE || spec > DTRACE_PROBESPEC_NAME)
+		return (dt_set_errno(dtp, EINVAL));
+
+	bzero(pdp, sizeof (dtrace_probedesc_t));
+	p = s + strlen(s) - 1;
+
+	do {
+		for (len = 0; p >= s && *p != ':'; len++)
+			p--; /* move backward until we find a delimiter */
+
+		q = p + 1;
+		vlen = 0;
+		w = NULL;
+		wlen = 0;
+
+		if ((v = strchr(q, '$')) != NULL && v < q + len) {
+			/*
+			 * Set vlen to the length of the variable name and then
+			 * reset len to the length of the text prior to '$'. If
+			 * the name begins with a digit, interpret it using the
+			 * the argv[] array.  Otherwise we look in dt_macros.
+			 * For the moment, all dt_macros variables are of type
+			 * id_t (see dtrace_update() for more details on that).
+			 */
+			vlen = (size_t)(q + len - v);
+			len = (size_t)(v - q);
+
+			/*
+			 * If the variable string begins with $$, skip past the
+			 * leading dollar sign since $ and $$ are equivalent
+			 * macro reference operators in a probe description.
+			 */
+			if (vlen > 2 && v[1] == '$') {
+				vlen--;
+				v++;
+			}
+
+			if (isdigit(v[1])) {
+				long i;
+
+				errno = 0;
+				i = strtol(v + 1, (char **)&w, 10);
+
+				wlen = vlen - (w - v);
+
+				if (i < 0 || i >= argc || errno != 0)
+					return (dt_set_errno(dtp, EDT_BADSPCV));
+
+				v = argv[i];
+				vlen = strlen(v);
+
+				if (yypcb != NULL && yypcb->pcb_sargv == argv)
+					yypcb->pcb_sflagv[i] |= DT_IDFLG_REF;
+
+			} else if (vlen > 1) {
+				char *vstr = alloca(vlen);
+				dt_ident_t *idp;
+
+				(void) strncpy(vstr, v + 1, vlen - 1);
+				vstr[vlen - 1] = '\0';
+				idp = dt_idhash_lookup(dtp->dt_macros, vstr);
+
+				if (idp == NULL)
+					return (dt_set_errno(dtp, EDT_BADSPCV));
+
+				v = buf;
+				vlen = snprintf(buf, 32, "%d", idp->di_id);
+
+			} else
+				return (dt_set_errno(dtp, EDT_BADSPCV));
+		}
+
+		if (spec == DTRACE_PROBESPEC_NONE)
+			return (dt_set_errno(dtp, EDT_BADSPEC));
+
+		if (len + vlen >= dtrace_probespecs[spec].dtps_len)
+			return (dt_set_errno(dtp, ENAMETOOLONG));
+
+		off = dtrace_probespecs[spec--].dtps_offset;
+		bcopy(q, (char *)pdp + off, len);
+		bcopy(v, (char *)pdp + off + len, vlen);
+		bcopy(w, (char *)pdp + off + len + vlen, wlen);
+	} while (--p >= s);
+
+	pdp->dtpd_id = DTRACE_IDNONE;
+	return (0);
+}
+
+int
+dtrace_str2desc(dtrace_hdl_t *dtp, dtrace_probespec_t spec,
+    const char *s, dtrace_probedesc_t *pdp)
+{
+	return (dtrace_xstr2desc(dtp, spec, s, 0, NULL, pdp));
+}
+
+int
+dtrace_id2desc(dtrace_hdl_t *dtp, dtrace_id_t id, dtrace_probedesc_t *pdp)
+{
+	bzero(pdp, sizeof (dtrace_probedesc_t));
+	pdp->dtpd_id = id;
+
+	if (dt_ioctl(dtp, DTRACEIOC_PROBES, pdp) == -1 ||
+	    pdp->dtpd_id != id)
+		return (dt_set_errno(dtp, EDT_BADID));
+
+	return (0);
+}
+
+char *
+dtrace_desc2str(const dtrace_probedesc_t *pdp, char *buf, size_t len)
+{
+	if (pdp->dtpd_id == 0) {
+		(void) snprintf(buf, len, "%s:%s:%s:%s", pdp->dtpd_provider,
+		    pdp->dtpd_mod, pdp->dtpd_func, pdp->dtpd_name);
+	} else
+		(void) snprintf(buf, len, "%u", pdp->dtpd_id);
+
+	return (buf);
+}
+
+char *
+dtrace_attr2str(dtrace_attribute_t attr, char *buf, size_t len)
+{
+	const char *name = dtrace_stability_name(attr.dtat_name);
+	const char *data = dtrace_stability_name(attr.dtat_data);
+	const char *class = dtrace_class_name(attr.dtat_class);
+
+	if (name == NULL || data == NULL || class == NULL)
+		return (NULL); /* one or more invalid attributes */
+
+	(void) snprintf(buf, len, "%s/%s/%s", name, data, class);
+	return (buf);
+}
+
+static char *
+dt_getstrattr(char *p, char **qp)
+{
+	char *q;
+
+	if (*p == '\0')
+		return (NULL);
+
+	if ((q = strchr(p, '/')) == NULL)
+		q = p + strlen(p);
+	else
+		*q++ = '\0';
+
+	*qp = q;
+	return (p);
+}
+
+int
+dtrace_str2attr(const char *str, dtrace_attribute_t *attr)
+{
+	dtrace_stability_t s;
+	dtrace_class_t c;
+	char *p, *q;
+
+	if (str == NULL || attr == NULL)
+		return (-1); /* invalid function arguments */
+
+	*attr = _dtrace_maxattr;
+#ifndef VBOX
+	p = strdupa(str);
+#else
+	MY_STRDUPA(p, str);
+#endif
+
+	if ((p = dt_getstrattr(p, &q)) == NULL)
+		return (0);
+
+	for (s = 0; s <= DTRACE_STABILITY_MAX; s++) {
+		if (strcasecmp(p, dtrace_stability_name(s)) == 0) {
+			attr->dtat_name = s;
+			break;
+		}
+	}
+
+	if (s > DTRACE_STABILITY_MAX)
+		return (-1);
+
+	if ((p = dt_getstrattr(q, &q)) == NULL)
+		return (0);
+
+	for (s = 0; s <= DTRACE_STABILITY_MAX; s++) {
+		if (strcasecmp(p, dtrace_stability_name(s)) == 0) {
+			attr->dtat_data = s;
+			break;
+		}
+	}
+
+	if (s > DTRACE_STABILITY_MAX)
+		return (-1);
+
+	if ((p = dt_getstrattr(q, &q)) == NULL)
+		return (0);
+
+	for (c = 0; c <= DTRACE_CLASS_MAX; c++) {
+		if (strcasecmp(p, dtrace_class_name(c)) == 0) {
+			attr->dtat_class = c;
+			break;
+		}
+	}
+
+	if (c > DTRACE_CLASS_MAX || (p = dt_getstrattr(q, &q)) != NULL)
+		return (-1);
+
+	return (0);
+}
+
+const char *
+dtrace_stability_name(dtrace_stability_t s)
+{
+	switch (s) {
+	case DTRACE_STABILITY_INTERNAL:	return ("Internal");
+	case DTRACE_STABILITY_PRIVATE:	return ("Private");
+	case DTRACE_STABILITY_OBSOLETE:	return ("Obsolete");
+	case DTRACE_STABILITY_EXTERNAL:	return ("External");
+	case DTRACE_STABILITY_UNSTABLE:	return ("Unstable");
+	case DTRACE_STABILITY_EVOLVING:	return ("Evolving");
+	case DTRACE_STABILITY_STABLE:	return ("Stable");
+	case DTRACE_STABILITY_STANDARD:	return ("Standard");
+	default:			return (NULL);
+	}
+}
+
+const char *
+dtrace_class_name(dtrace_class_t c)
+{
+	switch (c) {
+	case DTRACE_CLASS_UNKNOWN:	return ("Unknown");
+	case DTRACE_CLASS_CPU:		return ("CPU");
+	case DTRACE_CLASS_PLATFORM:	return ("Platform");
+	case DTRACE_CLASS_GROUP:	return ("Group");
+	case DTRACE_CLASS_ISA:		return ("ISA");
+	case DTRACE_CLASS_COMMON:	return ("Common");
+	default:			return (NULL);
+	}
+}
+
+dtrace_attribute_t
+dt_attr_min(dtrace_attribute_t a1, dtrace_attribute_t a2)
+{
+	dtrace_attribute_t am;
+
+	am.dtat_name = MIN(a1.dtat_name, a2.dtat_name);
+	am.dtat_data = MIN(a1.dtat_data, a2.dtat_data);
+	am.dtat_class = MIN(a1.dtat_class, a2.dtat_class);
+
+	return (am);
+}
+
+dtrace_attribute_t
+dt_attr_max(dtrace_attribute_t a1, dtrace_attribute_t a2)
+{
+	dtrace_attribute_t am;
+
+	am.dtat_name = MAX(a1.dtat_name, a2.dtat_name);
+	am.dtat_data = MAX(a1.dtat_data, a2.dtat_data);
+	am.dtat_class = MAX(a1.dtat_class, a2.dtat_class);
+
+	return (am);
+}
+
+/*
+ * Compare two attributes and return an integer value in the following ranges:
+ *
+ * <0 if any of a1's attributes are less than a2's attributes
+ * =0 if all of a1's attributes are equal to a2's attributes
+ * >0 if all of a1's attributes are greater than or equal to a2's attributes
+ *
+ * To implement this function efficiently, we subtract a2's attributes from
+ * a1's to obtain a negative result if an a1 attribute is less than its a2
+ * counterpart.  We then OR the intermediate results together, relying on the
+ * twos-complement property that if any result is negative, the bitwise union
+ * will also be negative since the highest bit will be set in the result.
+ */
+int
+dt_attr_cmp(dtrace_attribute_t a1, dtrace_attribute_t a2)
+{
+	return (((int)a1.dtat_name - a2.dtat_name) |
+	    ((int)a1.dtat_data - a2.dtat_data) |
+	    ((int)a1.dtat_class - a2.dtat_class));
+}
+
+char *
+dt_attr_str(dtrace_attribute_t a, char *buf, size_t len)
+{
+	static const char stability[] = "ipoxuesS";
+	static const char class[] = "uCpgIc";
+
+	if (a.dtat_name < sizeof (stability) &&
+	    a.dtat_data < sizeof (stability) && a.dtat_class < sizeof (class)) {
+		(void) snprintf(buf, len, "[%c/%c/%c]", stability[a.dtat_name],
+		    stability[a.dtat_data], class[a.dtat_class]);
+	} else {
+		(void) snprintf(buf, len, "[%u/%u/%u]",
+		    a.dtat_name, a.dtat_data, a.dtat_class);
+	}
+
+	return (buf);
+}
+
+char *
+dt_version_num2str(dt_version_t v, char *buf, size_t len)
+{
+	uint_t M = DT_VERSION_MAJOR(v);
+	uint_t m = DT_VERSION_MINOR(v);
+	uint_t u = DT_VERSION_MICRO(v);
+
+	if (u == 0)
+		(void) snprintf(buf, len, "%u.%u", M, m);
+	else
+		(void) snprintf(buf, len, "%u.%u.%u", M, m, u);
+
+	return (buf);
+}
+
+int
+dt_version_str2num(const char *s, dt_version_t *vp)
+{
+	int i = 0, n[3] = { 0, 0, 0 };
+	char c;
+
+	while ((c = *s++) != '\0') {
+		if (isdigit(c))
+			n[i] = n[i] * 10 + c - '0';
+		else if (c != '.' || i++ >= sizeof (n) / sizeof (n[0]) - 1)
+			return (-1);
+	}
+
+	if (n[0] > DT_VERSION_MAJMAX ||
+	    n[1] > DT_VERSION_MINMAX ||
+	    n[2] > DT_VERSION_MICMAX)
+		return (-1);
+
+	if (vp != NULL)
+		*vp = DT_VERSION_NUMBER(n[0], n[1], n[2]);
+
+	return (0);
+}
+
+int
+dt_version_defined(dt_version_t v)
+{
+	int i;
+
+	for (i = 0; _dtrace_versions[i] != 0; i++) {
+		if (_dtrace_versions[i] == v)
+			return (1);
+	}
+
+	return (0);
+}
+
+char *
+dt_cpp_add_arg(dtrace_hdl_t *dtp, const char *str)
+{
+	char *arg;
+
+	if (dtp->dt_cpp_argc == dtp->dt_cpp_args) {
+		int olds = dtp->dt_cpp_args;
+		int news = olds * 2;
+		char **argv = realloc(dtp->dt_cpp_argv, sizeof (char *) * news);
+
+		if (argv == NULL)
+			return (NULL);
+
+		bzero(&argv[olds], sizeof (char *) * olds);
+		dtp->dt_cpp_argv = argv;
+		dtp->dt_cpp_args = news;
+	}
+
+	if ((arg = strdup(str)) == NULL)
+		return (NULL);
+
+	assert(dtp->dt_cpp_argc < dtp->dt_cpp_args);
+	dtp->dt_cpp_argv[dtp->dt_cpp_argc++] = arg;
+	return (arg);
+}
+
+char *
+dt_cpp_pop_arg(dtrace_hdl_t *dtp)
+{
+	char *arg;
+
+	if (dtp->dt_cpp_argc <= 1)
+		return (NULL); /* dt_cpp_argv[0] cannot be popped */
+
+	arg = dtp->dt_cpp_argv[--dtp->dt_cpp_argc];
+	dtp->dt_cpp_argv[dtp->dt_cpp_argc] = NULL;
+
+	return (arg);
+}
+
+/*PRINTFLIKE1*/
+void
+dt_dprintf(const char *format, ...)
+{
+	if (_dtrace_debug) {
+		va_list alist;
+
+		va_start(alist, format);
+		(void) fputs("libdtrace DEBUG: ", stderr);
+		(void) vfprintf(stderr, format, alist);
+		va_end(alist);
+	}
+}
+
+int
+dt_ioctl(dtrace_hdl_t *dtp, int val, void *arg)
+{
+	const dtrace_vector_t *v = dtp->dt_vector;
+#ifdef VBOX
+	int rc;
+	int32_t iRetVal = 0;
+#endif
+
+	if (v != NULL)
+		return (v->dtv_ioctl(dtp->dt_varg, val, arg));
+
+#ifndef VBOX
+	if (dtp->dt_fd >= 0)
+		return (ioctl(dtp->dt_fd, val, arg));
+#else
+# if 1
+	rc = SUPR3TracerIoCtl(val, (uintptr_t)arg, &iRetVal);
+	if (RT_FAILURE(rc)) {
+		switch (rc) {
+		case VERR_SUPDRV_TRACER_NOT_OPENED: errno = EBADF; break;
+		default:
+			errno = RTErrConvertToErrno(rc);
+		}
+		return (-1);
+	}
+	return iRetVal;
+# else
+	/* Fake ioctl */
+	switch (val) {
+		case DTRACEIOC_CONF: {
+			dtrace_conf_t *pConf = (dtrace_conf_t *)arg;
+			RT_ZERO(*pConf);
+			pConf->dtc_difversion = DIF_VERSION;
+			pConf->dtc_difintregs = DIF_DIR_NREGS;
+			pConf->dtc_diftupregs = DIF_DTR_NREGS;
+			pConf->dtc_ctfmodel = CTF_MODEL_NATIVE;
+			return 0;
+		}
+
+		case DTRACEIOC_PROVIDER: {
+			dtrace_providerdesc_t *pDesc = (dtrace_providerdesc_t *)arg;
+			if (strcmp(pDesc->dtvd_name, "dtrace") == 0) {
+				RT_ZERO(pDesc->dtvd_attr);
+				RT_ZERO(pDesc->dtvd_priv);
+				return 0;
+			}
+			errno = ESRCH;
+			return -1;
+		}
+
+		case DTRACEIOC_PROBES: {
+			/*dtrace_probedesc_t *pDesc = (dtrace_probedesc_t *)arg;*/
+			errno = ESRCH;
+			return -1;
+		}
+
+		case DTRACEIOC_PROBEMATCH: {
+			dtrace_probedesc_t *pDesc = (dtrace_probedesc_t *)arg;
+			if (strcmp(pDesc->dtpd_name, "BEGIN") == 0) {
+				pDesc->dtpd_id = 1;
+				return 0;
+			}
+			errno = ESRCH;
+			return -1;
+		}
+
+	}
+# endif
+#endif
+
+	errno = EBADF;
+	return (-1);
+}
+
+int
+dt_status(dtrace_hdl_t *dtp, processorid_t cpu)
+{
+	const dtrace_vector_t *v = dtp->dt_vector;
+
+	if (v == NULL)
+#ifndef VBOX
+		return (p_online(cpu, P_STATUS));
+#else
+		return RTMpIsCpuOnline(cpu) ? 1
+			: RTMpIsCpuPresent(cpu) ? 0 : -1; /* Only -1 is checked. */
+#endif
+
+	return (v->dtv_status(dtp->dt_varg, cpu));
+}
+
+#ifndef VBOX
+long
+dt_sysconf(dtrace_hdl_t *dtp, int name)
+{
+	const dtrace_vector_t *v = dtp->dt_vector;
+
+	if (v == NULL)
+		return (sysconf(name));
+
+	return (v->dtv_sysconf(dtp->dt_varg, name));
+}
+#endif /* !VBOX */
+
+/*
+ * Wrapper around write(2) to handle partial writes.  For maximum safety of
+ * output files and proper error reporting, we continuing writing in the
+ * face of partial writes until write(2) fails or 'buf' is completely written.
+ * We also record any errno in the specified dtrace_hdl_t as well as 'errno'.
+ */
+ssize_t
+dt_write(dtrace_hdl_t *dtp, int fd, const void *buf, size_t n)
+{
+	ssize_t resid = n;
+	ssize_t len;
+
+	while (resid != 0) {
+		if ((len = write(fd, buf, resid)) <= 0)
+			break;
+
+		resid -= len;
+		buf = (char *)buf + len;
+	}
+
+	if (resid == n && n != 0)
+		return (dt_set_errno(dtp, errno));
+
+	return (n - resid);
+}
+
+/*
+ * This function handles all output from libdtrace, as well as the
+ * dtrace_sprintf() case.  If we're here due to dtrace_sprintf(), then
+ * dt_sprintf_buflen will be non-zero; in this case, we sprintf into the
+ * specified buffer and return.  Otherwise, if output is buffered (denoted by
+ * a NULL fp), we sprintf the desired output into the buffered buffer
+ * (expanding the buffer if required).  If we don't satisfy either of these
+ * conditions (that is, if we are to actually generate output), then we call
+ * fprintf with the specified fp.  In this case, we need to deal with one of
+ * the more annoying peculiarities of libc's printf routines:  any failed
+ * write persistently sets an error flag inside the FILE causing every
+ * subsequent write to fail, but only the caller that initiated the error gets
+ * the errno.  Since libdtrace clients often intercept SIGINT, this case is
+ * particularly frustrating since we don't want the EINTR on one attempt to
+ * write to the output file to preclude later attempts to write.  This
+ * function therefore does a clearerr() if any error occurred, and saves the
+ * errno for the caller inside the specified dtrace_hdl_t.
+ */
+/*PRINTFLIKE3*/
+int
+dt_printf(dtrace_hdl_t *dtp, FILE *fp, const char *format, ...)
+{
+	va_list ap;
+	int n;
+
+	va_start(ap, format);
+
+	if (dtp->dt_sprintf_buflen != 0) {
+		int len;
+		char *buf;
+
+		assert(dtp->dt_sprintf_buf != NULL);
+
+		buf = &dtp->dt_sprintf_buf[len = VBDTCAST(int)strlen(dtp->dt_sprintf_buf)];
+		len = dtp->dt_sprintf_buflen - len;
+		assert(len >= 0);
+
+		if ((n = vsnprintf(buf, len, format, ap)) < 0)
+			n = dt_set_errno(dtp, errno);
+
+		va_end(ap);
+
+		return (n);
+	}
+
+	if (fp == NULL) {
+		int needed, rval;
+		size_t avail;
+
+		/*
+		 * It's not legal to use buffered ouput if there is not a
+		 * handler for buffered output.
+		 */
+		if (dtp->dt_bufhdlr == NULL) {
+			va_end(ap);
+			return (dt_set_errno(dtp, EDT_NOBUFFERED));
+		}
+
+		if (dtp->dt_buffered_buf == NULL) {
+			assert(dtp->dt_buffered_size == 0);
+			dtp->dt_buffered_size = 1;
+			dtp->dt_buffered_buf = malloc(dtp->dt_buffered_size);
+
+			if (dtp->dt_buffered_buf == NULL) {
+				va_end(ap);
+				return (dt_set_errno(dtp, EDT_NOMEM));
+			}
+
+			dtp->dt_buffered_offs = 0;
+			dtp->dt_buffered_buf[0] = '\0';
+		}
+
+		if ((needed = vsnprintf(NULL, 0, format, ap)) < 0) {
+			rval = dt_set_errno(dtp, errno);
+			va_end(ap);
+			return (rval);
+		}
+
+		if (needed == 0) {
+			va_end(ap);
+			return (0);
+		}
+
+		for (;;) {
+			char *newbuf;
+
+			assert(dtp->dt_buffered_offs < dtp->dt_buffered_size);
+			avail = dtp->dt_buffered_size - dtp->dt_buffered_offs;
+
+			if (needed + 1 < avail)
+				break;
+
+			if ((newbuf = realloc(dtp->dt_buffered_buf,
+			    dtp->dt_buffered_size << 1)) == NULL) {
+				va_end(ap);
+				return (dt_set_errno(dtp, EDT_NOMEM));
+			}
+
+			dtp->dt_buffered_buf = newbuf;
+			dtp->dt_buffered_size <<= 1;
+		}
+
+		if (vsnprintf(&dtp->dt_buffered_buf[dtp->dt_buffered_offs],
+		    avail, format, ap) < 0) {
+			rval = dt_set_errno(dtp, errno);
+			va_end(ap);
+			return (rval);
+		}
+
+		dtp->dt_buffered_offs += needed;
+		assert(dtp->dt_buffered_buf[dtp->dt_buffered_offs] == '\0');
+		return (0);
+	}
+
+	n = vfprintf(fp, format, ap);
+	va_end(ap);
+
+	if (n < 0) {
+		clearerr(fp);
+		return (dt_set_errno(dtp, errno));
+	}
+
+	return (n);
+}
+
+int
+dt_buffered_flush(dtrace_hdl_t *dtp, dtrace_probedata_t *pdata,
+    const dtrace_recdesc_t *rec, const dtrace_aggdata_t *agg, uint32_t flags)
+{
+	dtrace_bufdata_t data;
+
+	if (dtp->dt_buffered_offs == 0)
+		return (0);
+
+	data.dtbda_handle = dtp;
+	data.dtbda_buffered = dtp->dt_buffered_buf;
+	data.dtbda_probe = pdata;
+	data.dtbda_recdesc = rec;
+	data.dtbda_aggdata = agg;
+	data.dtbda_flags = flags;
+
+	if ((*dtp->dt_bufhdlr)(&data, dtp->dt_bufarg) == DTRACE_HANDLE_ABORT)
+		return (dt_set_errno(dtp, EDT_DIRABORT));
+
+	dtp->dt_buffered_offs = 0;
+	dtp->dt_buffered_buf[0] = '\0';
+
+	return (0);
+}
+
+void
+dt_buffered_destroy(dtrace_hdl_t *dtp)
+{
+	free(dtp->dt_buffered_buf);
+	dtp->dt_buffered_buf = NULL;
+	dtp->dt_buffered_offs = 0;
+	dtp->dt_buffered_size = 0;
+}
+
+void *
+dt_zalloc(dtrace_hdl_t *dtp, size_t size)
+{
+	void *data;
+
+	if ((data = malloc(size)) == NULL)
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+	else
+		bzero(data, size);
+
+	return (data);
+}
+
+void *
+dt_alloc(dtrace_hdl_t *dtp, size_t size)
+{
+	void *data;
+
+	if ((data = malloc(size)) == NULL)
+		(void) dt_set_errno(dtp, EDT_NOMEM);
+
+	return (data);
+}
+
+void
+dt_free(dtrace_hdl_t *dtp, void *data)
+{
+	assert(dtp != NULL); /* ensure sane use of this interface */
+	free(data);
+}
+
+void
+dt_difo_free(dtrace_hdl_t *dtp, dtrace_difo_t *dp)
+{
+	if (dp == NULL)
+		return; /* simplify caller code */
+
+	dt_free(dtp, dp->dtdo_buf);
+	dt_free(dtp, dp->dtdo_inttab);
+	dt_free(dtp, dp->dtdo_strtab);
+	dt_free(dtp, dp->dtdo_vartab);
+	dt_free(dtp, dp->dtdo_kreltab);
+	dt_free(dtp, dp->dtdo_ureltab);
+	dt_free(dtp, dp->dtdo_xlmtab);
+
+	dt_free(dtp, dp);
+}
+
+/*
+ * dt_gmatch() is similar to gmatch(3GEN) and dtrace(7D) globbing, but also
+ * implements the behavior that an empty pattern matches any string.
+ */
+int
+dt_gmatch(const char *s, const char *p)
+{
+#ifndef VBOX
+	return (p == NULL || *p == '\0' || gmatch(s, p));
+#else
+	return (p == NULL || *p == '\0' || RTStrSimplePatternMatch(p, s)); /** @todo implement gmatch. */
+#endif
+}
+
+char *
+dt_basename(char *str)
+{
+	char *last = strrchr(str, '/');
+
+	if (last == NULL)
+		return (str);
+
+	return (last + 1);
+}
+
+/*
+ * dt_popc() is a fast implementation of population count.  The algorithm is
+ * from "Hacker's Delight" by Henry Warren, Jr with a 64-bit equivalent added.
+ */
+ulong_t
+dt_popc(ulong_t x)
+{
+#ifdef _ILP32
+	x = x - ((x >> 1) & 0x55555555UL);
+	x = (x & 0x33333333UL) + ((x >> 2) & 0x33333333UL);
+	x = (x + (x >> 4)) & 0x0F0F0F0FUL;
+	x = x + (x >> 8);
+	x = x + (x >> 16);
+	return (x & 0x3F);
+#endif
+#ifdef _LP64
+	x = x - ((x >> 1) & 0x5555555555555555ULL);
+	x = (x & 0x3333333333333333ULL) + ((x >> 2) & 0x3333333333333333ULL);
+	x = (x + (x >> 4)) & 0x0F0F0F0F0F0F0F0FULL;
+	x = x + (x >> 8);
+	x = x + (x >> 16);
+	x = x + (x >> 32);
+	return (x & 0x7F);
+#endif
+}
+
+/*
+ * dt_popcb() is a bitmap-based version of population count that returns the
+ * number of one bits in the specified bitmap 'bp' at bit positions below 'n'.
+ */
+ulong_t
+dt_popcb(const ulong_t *bp, ulong_t n)
+{
+	ulong_t maxb = n & BT_ULMASK;
+	ulong_t maxw = n >> BT_ULSHIFT;
+	ulong_t w, popc = 0;
+
+	if (n == 0)
+		return (0);
+
+	for (w = 0; w < maxw; w++)
+		popc += dt_popc(bp[w]);
+
+	return (popc + dt_popc(bp[maxw] & ((1UL << maxb) - 1)));
+}
+
+static int
+dt_string2str(char *s, char *str, int nbytes)
+{
+	int len = VBDTCAST(int)strlen(s);
+
+	if (nbytes == 0) {
+		/*
+		 * Like snprintf(3C), we don't check the value of str if the
+		 * number of bytes is 0.
+		 */
+		return (len);
+	}
+
+	if (nbytes <= len) {
+		(void) strncpy(str, s, nbytes - 1);
+		/*
+		 * Like snprintf(3C) (and unlike strncpy(3C)), we guarantee
+		 * that the string is null-terminated.
+		 */
+		str[nbytes - 1] = '\0';
+	} else {
+		(void) strcpy(str, s);
+	}
+
+	return (len);
+}
+
+int
+dtrace_addr2str(dtrace_hdl_t *dtp, uint64_t addr, char *str, int nbytes)
+{
+	dtrace_syminfo_t dts;
+	GElf_Sym sym;
+
+	size_t n = 20; /* for 0x%llx\0 */
+	char *s;
+	int err;
+
+	if ((err = dtrace_lookup_by_addr(dtp, addr, &sym, &dts)) == 0)
+		n += strlen(dts.dts_object) + strlen(dts.dts_name) + 2; /* +` */
+
+	s = alloca(n);
+
+	if (err == 0 && addr != sym.st_value) {
+		(void) snprintf(s, n, "%s`%s+0x%llx", dts.dts_object,
+		    dts.dts_name, (u_longlong_t)addr - sym.st_value);
+	} else if (err == 0) {
+		(void) snprintf(s, n, "%s`%s",
+		    dts.dts_object, dts.dts_name);
+	} else {
+		/*
+		 * We'll repeat the lookup, but this time we'll specify a NULL
+		 * GElf_Sym -- indicating that we're only interested in the
+		 * containing module.
+		 */
+		if (dtrace_lookup_by_addr(dtp, addr, NULL, &dts) == 0) {
+			(void) snprintf(s, n, "%s`0x%llx", dts.dts_object,
+			    (u_longlong_t)addr);
+		} else {
+			(void) snprintf(s, n, "0x%llx", (u_longlong_t)addr);
+		}
+	}
+
+	return (dt_string2str(s, str, nbytes));
+}
+
+int
+dtrace_uaddr2str(dtrace_hdl_t *dtp, pid_t pid,
+    uint64_t addr, char *str, int nbytes)
+{
+#ifndef VBOX
+	char name[PATH_MAX], objname[PATH_MAX], c[PATH_MAX * 2];
+	struct ps_prochandle *P = NULL;
+	GElf_Sym sym;
+	char *obj;
+
+	if (pid != 0)
+		P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, 0);
+
+	if (P == NULL) {
+		(void) snprintf(c, sizeof (c), "0x%llx", addr);
+		return (dt_string2str(c, str, nbytes));
+	}
+
+	dt_proc_lock(dtp, P);
+
+	if (Plookup_by_addr(P, addr, name, sizeof (name), &sym) == 0) {
+		(void) Pobjname(P, addr, objname, sizeof (objname));
+
+		obj = dt_basename(objname);
+
+		if (addr > sym.st_value) {
+			(void) snprintf(c, sizeof (c), "%s`%s+0x%llx", obj,
+			    name, (u_longlong_t)(addr - sym.st_value));
+		} else {
+			(void) snprintf(c, sizeof (c), "%s`%s", obj, name);
+		}
+	} else if (Pobjname(P, addr, objname, sizeof (objname)) != NULL) {
+		(void) snprintf(c, sizeof (c), "%s`0x%llx",
+		    dt_basename(objname), addr);
+	} else {
+		(void) snprintf(c, sizeof (c), "0x%llx", addr);
+	}
+
+	dt_proc_unlock(dtp, P);
+	dt_proc_release(dtp, P);
+#else
+	char c[32];
+	RTStrPrintf(c, sizeof (c), "0x%llx", addr);
+#endif
+
+	return (dt_string2str(c, str, nbytes));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_work.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_work.c
new file mode 100644
index 0000000..3cbd60a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_work.c
@@ -0,0 +1,322 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <dt_impl.h>
+#include <stddef.h>
+#include <errno.h>
+#include <assert.h>
+#include <time.h>
+#else  /* VBOX */
+# include <dt_impl.h>
+//# include <stddef.h>
+//# include <time.h>
+# include <iprt/semaphore.h>
+#endif /* VBOX */
+
+static const struct {
+	int dtslt_option;
+	size_t dtslt_offs;
+} _dtrace_sleeptab[] = {
+	{ DTRACEOPT_STATUSRATE, offsetof(dtrace_hdl_t, dt_laststatus) },
+	{ DTRACEOPT_AGGRATE, offsetof(dtrace_hdl_t, dt_lastagg) },
+	{ DTRACEOPT_SWITCHRATE, offsetof(dtrace_hdl_t, dt_lastswitch) },
+	{ DTRACEOPT_MAX, 0 }
+};
+
+void
+dtrace_sleep(dtrace_hdl_t *dtp)
+{
+	dt_proc_hash_t *dph = dtp->dt_procs;
+	dtrace_optval_t policy = dtp->dt_options[DTRACEOPT_BUFPOLICY];
+	dt_proc_notify_t *dprn;
+
+	hrtime_t earliest = INT64_MAX;
+#ifndef VBOX
+	struct timespec tv;
+#endif
+	hrtime_t now;
+	int i;
+
+	for (i = 0; _dtrace_sleeptab[i].dtslt_option < DTRACEOPT_MAX; i++) {
+		uintptr_t a = (uintptr_t)dtp + _dtrace_sleeptab[i].dtslt_offs;
+		int opt = _dtrace_sleeptab[i].dtslt_option;
+		dtrace_optval_t interval = dtp->dt_options[opt];
+
+		/*
+		 * If the buffering policy is set to anything other than
+		 * "switch", we ignore the aggrate and switchrate -- they're
+		 * meaningless.
+		 */
+		if (policy != DTRACEOPT_BUFPOLICY_SWITCH &&
+		    _dtrace_sleeptab[i].dtslt_option != DTRACEOPT_STATUSRATE)
+			continue;
+
+		if (*((hrtime_t *)a) + interval < earliest)
+			earliest = *((hrtime_t *)a) + interval;
+	}
+
+#ifndef VBOX
+	(void) pthread_mutex_lock(&dph->dph_lock);
+#endif
+
+	now = gethrtime();
+
+	if (earliest < now) {
+#ifndef VBOX
+		(void) pthread_mutex_unlock(&dph->dph_lock);
+#endif
+		return; /* sleep duration has already past */
+	}
+
+#ifndef VBOX
+	tv.tv_sec = (earliest - now) / NANOSEC;
+	tv.tv_nsec = (earliest - now) % NANOSEC;
+#endif
+
+	/*
+	 * Wait for either 'tv' nanoseconds to pass or to receive notification
+	 * that a process is in an interesting state.  Regardless of why we
+	 * awaken, iterate over any pending notifications and process them.
+	 */
+#ifndef VBOX
+	(void) pthread_cond_reltimedwait_np(&dph->dph_cv, &dph->dph_lock, &tv);
+#else
+	if (dph->dph_event)
+		RTSemEventWait(dph->dph_event, (earliest - now) / RT_NS_1MS);
+	else
+		RTThreadSleep((earliest - now) / RT_NS_1MS);
+#endif
+
+	while ((dprn = dph->dph_notify) != NULL) {
+		if (dtp->dt_prochdlr != NULL) {
+			char *err = dprn->dprn_errmsg;
+			if (*err == '\0')
+				err = NULL;
+
+			dtp->dt_prochdlr(dprn->dprn_dpr->dpr_proc, err,
+			    dtp->dt_procarg);
+		}
+
+		dph->dph_notify = dprn->dprn_next;
+		dt_free(dtp, dprn);
+	}
+
+#ifndef VBOX
+	(void) pthread_mutex_unlock(&dph->dph_lock);
+#endif
+}
+
+int
+dtrace_status(dtrace_hdl_t *dtp)
+{
+	int gen = dtp->dt_statusgen;
+	dtrace_optval_t interval = dtp->dt_options[DTRACEOPT_STATUSRATE];
+	hrtime_t now = gethrtime();
+
+	if (!dtp->dt_active)
+		return (DTRACE_STATUS_NONE);
+
+	if (dtp->dt_stopped)
+		return (DTRACE_STATUS_STOPPED);
+
+	if (dtp->dt_laststatus != 0) {
+		if (now - dtp->dt_laststatus < VBDTCAST(hrtime_t)interval)
+			return (DTRACE_STATUS_NONE);
+
+		dtp->dt_laststatus += interval;
+	} else {
+		dtp->dt_laststatus = now;
+	}
+
+	if (dt_ioctl(dtp, DTRACEIOC_STATUS, &dtp->dt_status[gen]) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	dtp->dt_statusgen ^= 1;
+
+	if (dt_handle_status(dtp, &dtp->dt_status[dtp->dt_statusgen],
+	    &dtp->dt_status[gen]) == -1)
+		return (-1);
+
+	if (dtp->dt_status[gen].dtst_exiting) {
+		if (!dtp->dt_stopped)
+			(void) dtrace_stop(dtp);
+
+		return (DTRACE_STATUS_EXITED);
+	}
+
+	if (dtp->dt_status[gen].dtst_filled == 0)
+		return (DTRACE_STATUS_OKAY);
+
+	if (dtp->dt_options[DTRACEOPT_BUFPOLICY] != DTRACEOPT_BUFPOLICY_FILL)
+		return (DTRACE_STATUS_OKAY);
+
+	if (!dtp->dt_stopped) {
+		if (dtrace_stop(dtp) == -1)
+			return (-1);
+	}
+
+	return (DTRACE_STATUS_FILLED);
+}
+
+int
+dtrace_go(dtrace_hdl_t *dtp)
+{
+	void *dof;
+	int err;
+
+	if (dtp->dt_active)
+		return (dt_set_errno(dtp, EINVAL));
+
+	/*
+	 * If a dtrace:::ERROR program and callback are registered, enable the
+	 * program before we start tracing.  If this fails for a vector open
+	 * with ENOTTY, we permit dtrace_go() to succeed so that vector clients
+	 * such as mdb's dtrace module can execute the rest of dtrace_go() even
+	 * though they do not provide support for the DTRACEIOC_ENABLE ioctl.
+	 */
+	if (dtp->dt_errprog != NULL &&
+	    dtrace_program_exec(dtp, dtp->dt_errprog, NULL) == -1 && (
+	    dtp->dt_errno != ENOTTY || dtp->dt_vector == NULL))
+		return (-1); /* dt_errno has been set for us */
+
+	if ((dof = dtrace_getopt_dof(dtp)) == NULL)
+		return (-1); /* dt_errno has been set for us */
+
+	err = dt_ioctl(dtp, DTRACEIOC_ENABLE, dof);
+	dtrace_dof_destroy(dtp, dof);
+
+	if (err == -1 && (errno != ENOTTY || dtp->dt_vector == NULL))
+		return (dt_set_errno(dtp, errno));
+
+	if (dt_ioctl(dtp, DTRACEIOC_GO, &dtp->dt_beganon) == -1) {
+		if (errno == EACCES)
+			return (dt_set_errno(dtp, EDT_DESTRUCTIVE));
+
+		if (errno == EALREADY)
+			return (dt_set_errno(dtp, EDT_ISANON));
+
+		if (errno == ENOENT)
+			return (dt_set_errno(dtp, EDT_NOANON));
+
+		if (errno == E2BIG)
+			return (dt_set_errno(dtp, EDT_ENDTOOBIG));
+
+		if (errno == ENOSPC)
+			return (dt_set_errno(dtp, EDT_BUFTOOSMALL));
+
+		return (dt_set_errno(dtp, errno));
+	}
+
+	dtp->dt_active = 1;
+
+	if (dt_options_load(dtp) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	return (dt_aggregate_go(dtp));
+}
+
+int
+dtrace_stop(dtrace_hdl_t *dtp)
+{
+	int gen = dtp->dt_statusgen;
+
+	if (dtp->dt_stopped)
+		return (0);
+
+	if (dt_ioctl(dtp, DTRACEIOC_STOP, &dtp->dt_endedon) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	dtp->dt_stopped = 1;
+
+	/*
+	 * Now that we're stopped, we're going to get status one final time.
+	 */
+	if (dt_ioctl(dtp, DTRACEIOC_STATUS, &dtp->dt_status[gen]) == -1)
+		return (dt_set_errno(dtp, errno));
+
+	if (dt_handle_status(dtp, &dtp->dt_status[gen ^ 1],
+	    &dtp->dt_status[gen]) == -1)
+		return (-1);
+
+	return (0);
+}
+
+
+dtrace_workstatus_t
+dtrace_work(dtrace_hdl_t *dtp, FILE *fp,
+    dtrace_consume_probe_f *pfunc, dtrace_consume_rec_f *rfunc, void *arg)
+{
+	int status = dtrace_status(dtp);
+	dtrace_optval_t policy = dtp->dt_options[DTRACEOPT_BUFPOLICY];
+	dtrace_workstatus_t rval;
+
+	switch (status) {
+	case DTRACE_STATUS_EXITED:
+	case DTRACE_STATUS_FILLED:
+	case DTRACE_STATUS_STOPPED:
+		/*
+		 * Tracing is stopped.  We now want to force dtrace_consume()
+		 * and dtrace_aggregate_snap() to proceed, regardless of
+		 * switchrate and aggrate.  We do this by clearing the times.
+		 */
+		dtp->dt_lastswitch = 0;
+		dtp->dt_lastagg = 0;
+		rval = DTRACE_WORKSTATUS_DONE;
+		break;
+
+	case DTRACE_STATUS_NONE:
+	case DTRACE_STATUS_OKAY:
+		rval = DTRACE_WORKSTATUS_OKAY;
+		break;
+
+	case -1:
+		return (DTRACE_WORKSTATUS_ERROR);
+	}
+
+	if ((status == DTRACE_STATUS_NONE || status == DTRACE_STATUS_OKAY) &&
+	    policy != DTRACEOPT_BUFPOLICY_SWITCH) {
+		/*
+		 * There either isn't any status or things are fine -- and
+		 * this is a "ring" or "fill" buffer.  We don't want to consume
+		 * any of the trace data or snapshot the aggregations; we just
+		 * return.
+		 */
+		assert(rval == DTRACE_WORKSTATUS_OKAY);
+		return (rval);
+	}
+
+	if (dtrace_aggregate_snap(dtp) == -1)
+		return (DTRACE_WORKSTATUS_ERROR);
+
+	if (dtrace_consume(dtp, fp, pfunc, rfunc, arg) == -1)
+		return (DTRACE_WORKSTATUS_ERROR);
+
+	return (rval);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_xlator.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_xlator.c
new file mode 100644
index 0000000..6533eb8
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_xlator.c
@@ -0,0 +1,385 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <strings.h>
+#include <assert.h>
+#endif
+
+#include <dt_xlator.h>
+#include <dt_parser.h>
+#include <dt_grammar.h>
+#include <dt_module.h>
+#include <dt_impl.h>
+
+/*
+ * Create a member node corresponding to one of the output members of a dynamic
+ * translator.  We set the member's dn_membexpr to a DT_NODE_XLATOR node that
+ * has dn_op set to DT_TOK_XLATE and refers back to the translator itself.  The
+ * code generator will then use this as the indicator for dynamic translation.
+ */
+/*ARGSUSED*/
+static int
+dt_xlator_create_member(const char *name, ctf_id_t type, ulong_t off, void *arg)
+{
+	dt_xlator_t *dxp = arg;
+	dtrace_hdl_t *dtp = dxp->dx_hdl;
+	dt_node_t *enp, *mnp;
+
+	if ((enp = dt_node_xalloc(dtp, DT_NODE_XLATOR)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	enp->dn_link = dxp->dx_nodes;
+	dxp->dx_nodes = enp;
+
+	if ((mnp = dt_node_xalloc(dtp, DT_NODE_MEMBER)) == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	mnp->dn_link = dxp->dx_nodes;
+	dxp->dx_nodes = mnp;
+
+	/*
+	 * For the member expression, we use a DT_NODE_XLATOR/TOK_XLATE whose
+	 * xlator refers back to the translator and whose dn_xmember refers to
+	 * the current member.  These refs will be used by dt_cg.c and dt_as.c.
+	 */
+	enp->dn_op = DT_TOK_XLATE;
+	enp->dn_xlator = dxp;
+	enp->dn_xmember = mnp;
+	dt_node_type_assign(enp, dxp->dx_dst_ctfp, type);
+
+	/*
+	 * For the member itself, we use a DT_NODE_MEMBER as usual with the
+	 * appropriate name, output type, and member expression set to 'enp'.
+	 */
+	if (dxp->dx_members != NULL) {
+		assert(enp->dn_link->dn_kind == DT_NODE_MEMBER);
+		enp->dn_link->dn_list = mnp;
+	} else
+		dxp->dx_members = mnp;
+
+	mnp->dn_membname = strdup(name);
+	mnp->dn_membexpr = enp;
+	dt_node_type_assign(mnp, dxp->dx_dst_ctfp, type);
+
+	if (mnp->dn_membname == NULL)
+		return (dt_set_errno(dtp, EDT_NOMEM));
+
+	return (0);
+}
+
+dt_xlator_t *
+dt_xlator_create(dtrace_hdl_t *dtp,
+    const dtrace_typeinfo_t *src, const dtrace_typeinfo_t *dst,
+    const char *name, dt_node_t *members, dt_node_t *nodes)
+{
+	dt_xlator_t *dxp = dt_zalloc(dtp, sizeof (dt_xlator_t));
+	dtrace_typeinfo_t ptr = *dst;
+	dt_xlator_t **map;
+	dt_node_t *dnp;
+	uint_t kind;
+
+	if (dxp == NULL)
+		return (NULL);
+
+	dxp->dx_hdl = dtp;
+	dxp->dx_id = dtp->dt_xlatorid++;
+	dxp->dx_gen = dtp->dt_gen;
+	dxp->dx_arg = -1;
+
+	if ((map = dt_alloc(dtp, sizeof (void *) * (dxp->dx_id + 1))) == NULL) {
+		dt_free(dtp, dxp);
+		return (NULL);
+	}
+
+	dt_list_append(&dtp->dt_xlators, dxp);
+	bcopy(dtp->dt_xlatormap, map, sizeof (void *) * dxp->dx_id);
+	dt_free(dtp, dtp->dt_xlatormap);
+	dtp->dt_xlatormap = map;
+	dtp->dt_xlatormap[dxp->dx_id] = dxp;
+
+	if (dt_type_pointer(&ptr) == -1) {
+		ptr.dtt_ctfp = NULL;
+		ptr.dtt_type = CTF_ERR;
+	}
+
+	dxp->dx_ident = dt_ident_create(name ? name : "T",
+	    DT_IDENT_SCALAR, DT_IDFLG_REF | DT_IDFLG_ORPHAN, 0,
+	    _dtrace_defattr, 0, &dt_idops_thaw, NULL, dtp->dt_gen);
+
+	if (dxp->dx_ident == NULL)
+		goto err; /* no memory for identifier */
+
+	dxp->dx_ident->di_ctfp = src->dtt_ctfp;
+	dxp->dx_ident->di_type = src->dtt_type;
+
+	/*
+	 * If an input parameter name is given, this is a static translator
+	 * definition: create an idhash and identifier for the parameter.
+	 */
+	if (name != NULL) {
+		dxp->dx_locals = dt_idhash_create("xlparams", NULL, 0, 0);
+
+		if (dxp->dx_locals == NULL)
+			goto err; /* no memory for identifier hash */
+
+		dt_idhash_xinsert(dxp->dx_locals, dxp->dx_ident);
+	}
+
+	dxp->dx_souid.di_name = "translator";
+	dxp->dx_souid.di_kind = DT_IDENT_XLSOU;
+	dxp->dx_souid.di_flags = DT_IDFLG_REF;
+	dxp->dx_souid.di_id = dxp->dx_id;
+	dxp->dx_souid.di_attr = _dtrace_defattr;
+	dxp->dx_souid.di_ops = &dt_idops_thaw;
+	dxp->dx_souid.di_data = dxp;
+	dxp->dx_souid.di_ctfp = dst->dtt_ctfp;
+	dxp->dx_souid.di_type = dst->dtt_type;
+	dxp->dx_souid.di_gen = dtp->dt_gen;
+
+	dxp->dx_ptrid.di_name = "translator";
+	dxp->dx_ptrid.di_kind = DT_IDENT_XLPTR;
+	dxp->dx_ptrid.di_flags = DT_IDFLG_REF;
+	dxp->dx_ptrid.di_id = dxp->dx_id;
+	dxp->dx_ptrid.di_attr = _dtrace_defattr;
+	dxp->dx_ptrid.di_ops = &dt_idops_thaw;
+	dxp->dx_ptrid.di_data = dxp;
+	dxp->dx_ptrid.di_ctfp = ptr.dtt_ctfp;
+	dxp->dx_ptrid.di_type = ptr.dtt_type;
+	dxp->dx_ptrid.di_gen = dtp->dt_gen;
+
+	/*
+	 * If a deferred pragma is pending on the keyword "translator", run all
+	 * the deferred pragmas on dx_souid and then copy results to dx_ptrid.
+	 * See the code in dt_pragma.c for details on deferred ident pragmas.
+	 */
+	if (dtp->dt_globals->dh_defer != NULL && yypcb->pcb_pragmas != NULL &&
+	    dt_idhash_lookup(yypcb->pcb_pragmas, "translator") != NULL) {
+		dtp->dt_globals->dh_defer(dtp->dt_globals, &dxp->dx_souid);
+		dxp->dx_ptrid.di_attr = dxp->dx_souid.di_attr;
+		dxp->dx_ptrid.di_vers = dxp->dx_souid.di_vers;
+	}
+
+	dxp->dx_src_ctfp = src->dtt_ctfp;
+	dxp->dx_src_type = src->dtt_type;
+	dxp->dx_src_base = ctf_type_resolve(src->dtt_ctfp, src->dtt_type);
+
+	dxp->dx_dst_ctfp = dst->dtt_ctfp;
+	dxp->dx_dst_type = dst->dtt_type;
+	dxp->dx_dst_base = ctf_type_resolve(dst->dtt_ctfp, dst->dtt_type);
+
+	kind = ctf_type_kind(dst->dtt_ctfp, dxp->dx_dst_base);
+	assert(kind == CTF_K_STRUCT || kind == CTF_K_UNION);
+
+	/*
+	 * If no input parameter is given, we're making a dynamic translator:
+	 * create member nodes for every member of the output type.  Otherwise
+	 * retain the member and allocation node lists presented by the parser.
+	 */
+	if (name == NULL) {
+		if (ctf_member_iter(dxp->dx_dst_ctfp, dxp->dx_dst_base,
+		    dt_xlator_create_member, dxp) != 0)
+			goto err;
+	} else {
+		dxp->dx_members = members;
+		dxp->dx_nodes = nodes;
+	}
+
+	/*
+	 * Assign member IDs to each member and allocate space for DIFOs
+	 * if and when this translator is eventually compiled.
+	 */
+	for (dnp = dxp->dx_members; dnp != NULL; dnp = dnp->dn_list) {
+		dnp->dn_membxlator = dxp;
+		dnp->dn_membid = dxp->dx_nmembers++;
+	}
+
+	dxp->dx_membdif = dt_zalloc(dtp,
+	    sizeof (dtrace_difo_t *) * dxp->dx_nmembers);
+
+	if (dxp->dx_membdif == NULL) {
+		dxp->dx_nmembers = 0;
+		goto err;
+	}
+
+	return (dxp);
+
+err:
+	dt_xlator_destroy(dtp, dxp);
+	return (NULL);
+}
+
+void
+dt_xlator_destroy(dtrace_hdl_t *dtp, dt_xlator_t *dxp)
+{
+	uint_t i;
+
+	dt_node_link_free(&dxp->dx_nodes);
+
+	if (dxp->dx_locals != NULL)
+		dt_idhash_destroy(dxp->dx_locals);
+	else if (dxp->dx_ident != NULL)
+		dt_ident_destroy(dxp->dx_ident);
+
+	for (i = 0; i < dxp->dx_nmembers; i++)
+		dt_difo_free(dtp, dxp->dx_membdif[i]);
+
+	dt_free(dtp, dxp->dx_membdif);
+	dt_list_delete(&dtp->dt_xlators, dxp);
+	dt_free(dtp, dxp);
+}
+
+dt_xlator_t *
+dt_xlator_lookup(dtrace_hdl_t *dtp, dt_node_t *src, dt_node_t *dst, int flags)
+{
+	ctf_file_t *src_ctfp = src->dn_ctfp;
+	ctf_id_t src_type = src->dn_type;
+	ctf_id_t src_base = ctf_type_resolve(src_ctfp, src_type);
+
+	ctf_file_t *dst_ctfp = dst->dn_ctfp;
+	ctf_id_t dst_type = dst->dn_type;
+	ctf_id_t dst_base = ctf_type_resolve(dst_ctfp, dst_type);
+	uint_t dst_kind = ctf_type_kind(dst_ctfp, dst_base);
+
+	int ptr = dst_kind == CTF_K_POINTER;
+	dtrace_typeinfo_t src_dtt, dst_dtt;
+	dt_node_t xn = { 0 };
+	dt_xlator_t *dxp = NULL;
+
+	if (src_base == CTF_ERR || dst_base == CTF_ERR)
+		return (NULL); /* fail if these are unresolvable types */
+
+	/*
+	 * Translators are always defined using a struct or union type, so if
+	 * we are attempting to translate to type "T *", we internally look
+	 * for a translation to type "T" by following the pointer reference.
+	 */
+	if (ptr) {
+		dst_type = ctf_type_reference(dst_ctfp, dst_type);
+		dst_base = ctf_type_resolve(dst_ctfp, dst_type);
+		dst_kind = ctf_type_kind(dst_ctfp, dst_base);
+	}
+
+	if (dst_kind != CTF_K_UNION && dst_kind != CTF_K_STRUCT)
+		return (NULL); /* fail if the output isn't a struct or union */
+
+	/*
+	 * In order to find a matching translator, we iterate over the set of
+	 * available translators in three passes.  First, we look for a
+	 * translation from the exact source type to the resolved destination.
+	 * Second, we look for a translation from the resolved source type to
+	 * the resolved destination.  Third, we look for a translation from a
+	 * compatible source type (using the same rules as parameter formals)
+	 * to the resolved destination.  If all passes fail, return NULL.
+	 */
+	for (dxp = dt_list_next(&dtp->dt_xlators); dxp != NULL;
+	    dxp = dt_list_next(dxp)) {
+		if (ctf_type_compat(dxp->dx_src_ctfp, dxp->dx_src_type,
+		    src_ctfp, src_type) &&
+		    ctf_type_compat(dxp->dx_dst_ctfp, dxp->dx_dst_base,
+		    dst_ctfp, dst_base))
+			goto out;
+	}
+
+	if (flags & DT_XLATE_EXACT)
+		goto out; /* skip remaining passes if exact match required */
+
+	for (dxp = dt_list_next(&dtp->dt_xlators); dxp != NULL;
+	    dxp = dt_list_next(dxp)) {
+		if (ctf_type_compat(dxp->dx_src_ctfp, dxp->dx_src_base,
+		    src_ctfp, src_type) &&
+		    ctf_type_compat(dxp->dx_dst_ctfp, dxp->dx_dst_base,
+		    dst_ctfp, dst_base))
+			goto out;
+	}
+
+	for (dxp = dt_list_next(&dtp->dt_xlators); dxp != NULL;
+	    dxp = dt_list_next(dxp)) {
+		dt_node_type_assign(&xn, dxp->dx_src_ctfp, dxp->dx_src_type);
+		if (ctf_type_compat(dxp->dx_dst_ctfp, dxp->dx_dst_base,
+		    dst_ctfp, dst_base) && dt_node_is_argcompat(src, &xn))
+			goto out;
+	}
+
+out:
+	if (ptr && dxp != NULL && dxp->dx_ptrid.di_type == CTF_ERR)
+		return (NULL);	/* no translation available to pointer type */
+
+	if (dxp != NULL || !(flags & DT_XLATE_EXTERN) ||
+	    dtp->dt_xlatemode == DT_XL_STATIC)
+		return (dxp);	/* we succeeded or not allowed to extern */
+
+	/*
+	 * If we get here, then we didn't find an existing translator, but the
+	 * caller and xlatemode permit us to create an extern to a dynamic one.
+	 */
+	src_dtt.dtt_object = dt_module_lookup_by_ctf(dtp, src_ctfp)->dm_name;
+	src_dtt.dtt_ctfp = src_ctfp;
+	src_dtt.dtt_type = src_type;
+
+	dst_dtt.dtt_object = dt_module_lookup_by_ctf(dtp, dst_ctfp)->dm_name;
+	dst_dtt.dtt_ctfp = dst_ctfp;
+	dst_dtt.dtt_type = dst_type;
+
+	return (dt_xlator_create(dtp, &src_dtt, &dst_dtt, NULL, NULL, NULL));
+}
+
+dt_xlator_t *
+dt_xlator_lookup_id(dtrace_hdl_t *dtp, id_t id)
+{
+	assert(id >= 0 && id < dtp->dt_xlatorid);
+	return (dtp->dt_xlatormap[id]);
+}
+
+dt_ident_t *
+dt_xlator_ident(dt_xlator_t *dxp, ctf_file_t *ctfp, ctf_id_t type)
+{
+	if (ctf_type_kind(ctfp, ctf_type_resolve(ctfp, type)) == CTF_K_POINTER)
+		return (&dxp->dx_ptrid);
+	else
+		return (&dxp->dx_souid);
+}
+
+dt_node_t *
+dt_xlator_member(dt_xlator_t *dxp, const char *name)
+{
+	dt_node_t *dnp;
+
+	for (dnp = dxp->dx_members; dnp != NULL; dnp = dnp->dn_list) {
+		if (strcmp(dnp->dn_membname, name) == 0)
+			return (dnp);
+	}
+
+	return (NULL);
+}
+
+int
+dt_xlator_dynamic(const dt_xlator_t *dxp)
+{
+	return (dxp->dx_locals == NULL);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_xlator.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_xlator.h
new file mode 100644
index 0000000..01d047d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_xlator.h
@@ -0,0 +1,89 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DT_XLATOR_H
+#define	_DT_XLATOR_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#include <libctf.h>
+#include <dtrace.h>
+#include <dt_ident.h>
+#include <dt_list.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+struct dt_node;
+
+typedef struct dt_xlator {
+	dt_list_t dx_list;		/* list forward/back pointers */
+	dt_idhash_t *dx_locals;		/* hash of local scope identifiers */
+	dt_ident_t *dx_ident;		/* identifier ref for input param */
+	dt_ident_t dx_souid;		/* fake identifier for sou output */
+	dt_ident_t dx_ptrid;		/* fake identifier for ptr output */
+	ctf_file_t *dx_src_ctfp;	/* CTF container for input type */
+	ctf_id_t dx_src_type;		/* CTF reference for input type */
+	ctf_id_t dx_src_base;		/* CTF reference for input base */
+	ctf_file_t *dx_dst_ctfp;	/* CTF container for output type */
+	ctf_id_t dx_dst_type;		/* CTF reference for output type */
+	ctf_id_t dx_dst_base;		/* CTF reference for output base */
+	struct dt_node *dx_members;	/* list of member translations */
+	uint_t dx_nmembers;		/* length of dx_members list */
+	dtrace_difo_t **dx_membdif;	/* DIF for member expressions */
+	struct dt_node *dx_nodes;	/* list of parse tree nodes */
+	dtrace_hdl_t *dx_hdl;		/* back pointer to containing handle */
+	ulong_t dx_gen;			/* generation number that created me */
+	id_t dx_id;			/* global translator id */
+	int dx_arg;			/* dynamic argument index */
+} dt_xlator_t;
+
+extern dt_xlator_t *dt_xlator_create(dtrace_hdl_t *,
+    const dtrace_typeinfo_t *, const dtrace_typeinfo_t *,
+    const char *, struct dt_node *, struct dt_node *);
+
+extern void dt_xlator_destroy(dtrace_hdl_t *, dt_xlator_t *);
+
+#define	DT_XLATE_FUZZY	0x0		/* lookup any matching translator */
+#define	DT_XLATE_EXACT	0x1		/* lookup only exact type matches */
+#define	DT_XLATE_EXTERN	0x2		/* extern translator if none exists */
+
+extern dt_xlator_t *dt_xlator_lookup(dtrace_hdl_t *,
+    struct dt_node *, struct dt_node *, int);
+
+extern dt_xlator_t *dt_xlator_lookup_id(dtrace_hdl_t *, id_t);
+extern dt_ident_t *dt_xlator_ident(dt_xlator_t *, ctf_file_t *, ctf_id_t);
+extern struct dt_node *dt_xlator_member(dt_xlator_t *, const char *);
+extern int dt_xlator_dynamic(const dt_xlator_t *);
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DT_XLATOR_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dtrace.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dtrace.h
new file mode 100644
index 0000000..7a419c2
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dtrace.h
@@ -0,0 +1,587 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_DTRACE_H
+#define	_DTRACE_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/dtrace.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <gelf.h>
+#else  /* VBOX */
+# include <sys/dtrace.h>
+# include <stdio.h>
+#endif /* VBOX */
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/*
+ * DTrace Dynamic Tracing Software: Library Interfaces
+ *
+ * Note: The contents of this file are private to the implementation of the
+ * Solaris system and DTrace subsystem and are subject to change at any time
+ * without notice.  Applications and drivers using these interfaces will fail
+ * to run on future releases.  These interfaces should not be used for any
+ * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB).
+ * Please refer to the "Solaris Dynamic Tracing Guide" for more information.
+ */
+
+#define	DTRACE_VERSION	3		/* library ABI interface version */
+
+struct ps_prochandle;
+typedef struct dtrace_hdl dtrace_hdl_t;
+typedef struct dtrace_prog dtrace_prog_t;
+typedef struct dtrace_vector dtrace_vector_t;
+typedef struct dtrace_aggdata dtrace_aggdata_t;
+
+#define	DTRACE_O_NODEV		0x01	/* do not open dtrace(7D) device */
+#define	DTRACE_O_NOSYS		0x02	/* do not load /system/object modules */
+#define	DTRACE_O_LP64		0x04	/* force D compiler to be LP64 */
+#define	DTRACE_O_ILP32		0x08	/* force D compiler to be ILP32 */
+#define	DTRACE_O_MASK		0x0f	/* mask of valid flags to dtrace_open */
+
+extern dtrace_hdl_t *dtrace_open(int, int, int *);
+extern dtrace_hdl_t *dtrace_vopen(int, int, int *,
+    const dtrace_vector_t *, void *);
+
+extern int dtrace_go(dtrace_hdl_t *);
+extern int dtrace_stop(dtrace_hdl_t *);
+extern void dtrace_sleep(dtrace_hdl_t *);
+extern void dtrace_close(dtrace_hdl_t *);
+
+extern int dtrace_errno(dtrace_hdl_t *);
+extern const char *dtrace_errmsg(dtrace_hdl_t *, int);
+extern const char *dtrace_faultstr(dtrace_hdl_t *, int);
+extern const char *dtrace_subrstr(dtrace_hdl_t *, int);
+
+extern int dtrace_setopt(dtrace_hdl_t *, const char *, const char *);
+extern int dtrace_getopt(dtrace_hdl_t *, const char *, dtrace_optval_t *);
+
+extern void dtrace_update(dtrace_hdl_t *);
+extern int dtrace_ctlfd(dtrace_hdl_t *);
+
+/*
+ * DTrace Program Interface
+ *
+ * DTrace programs can be created by compiling ASCII text files containing
+ * D programs or by compiling in-memory C strings that specify a D program.
+ * Once created, callers can examine the list of program statements and
+ * enable the probes and actions described by these statements.
+ */
+
+typedef struct dtrace_proginfo {
+	dtrace_attribute_t dpi_descattr; /* minimum probedesc attributes */
+	dtrace_attribute_t dpi_stmtattr; /* minimum statement attributes */
+	uint_t dpi_aggregates;	/* number of aggregates specified in program */
+	uint_t dpi_recgens;	/* number of record generating probes in prog */
+	uint_t dpi_matches;	/* number of probes matched by program */
+	uint_t dpi_speculations; /* number of speculations specified in prog */
+} dtrace_proginfo_t;
+
+#define	DTRACE_C_DIFV	0x0001	/* DIF verbose mode: show each compiled DIFO */
+#define	DTRACE_C_EMPTY	0x0002	/* Permit compilation of empty D source files */
+#define	DTRACE_C_ZDEFS	0x0004	/* Permit probe defs that match zero probes */
+#define	DTRACE_C_EATTR	0x0008	/* Error if program attributes less than min */
+#define	DTRACE_C_CPP	0x0010	/* Preprocess input file with cpp(1) utility */
+#define	DTRACE_C_KNODEF	0x0020	/* Permit unresolved kernel symbols in DIFO */
+#define	DTRACE_C_UNODEF	0x0040	/* Permit unresolved user symbols in DIFO */
+#define	DTRACE_C_PSPEC	0x0080	/* Intepret ambiguous specifiers as probes */
+#define	DTRACE_C_ETAGS	0x0100	/* Prefix error messages with error tags */
+#define	DTRACE_C_ARGREF	0x0200	/* Do not require all macro args to be used */
+#define	DTRACE_C_DEFARG	0x0800	/* Use 0/"" as value for unspecified args */
+#define	DTRACE_C_NOLIBS	0x1000	/* Do not process D system libraries */
+#define	DTRACE_C_CTL	0x2000	/* Only process control directives */
+#define	DTRACE_C_MASK	0x3bff	/* mask of all valid flags to dtrace_*compile */
+
+extern dtrace_prog_t *dtrace_program_strcompile(dtrace_hdl_t *,
+    const char *, dtrace_probespec_t, uint_t, int, char *const []);
+
+extern dtrace_prog_t *dtrace_program_fcompile(dtrace_hdl_t *,
+    FILE *, uint_t, int, char *const []);
+
+extern int dtrace_program_exec(dtrace_hdl_t *, dtrace_prog_t *,
+    dtrace_proginfo_t *);
+extern void dtrace_program_info(dtrace_hdl_t *, dtrace_prog_t *,
+    dtrace_proginfo_t *);
+
+#define	DTRACE_D_STRIP	0x01	/* strip non-loadable sections from program */
+#define	DTRACE_D_PROBES	0x02	/* include provider and probe definitions */
+#define	DTRACE_D_MASK	0x03	/* mask of valid flags to dtrace_dof_create */
+
+extern int dtrace_program_link(dtrace_hdl_t *, dtrace_prog_t *,
+    uint_t, const char *, int, char *const []);
+
+extern int dtrace_program_header(dtrace_hdl_t *, FILE *, const char *);
+
+extern void *dtrace_dof_create(dtrace_hdl_t *, dtrace_prog_t *, uint_t);
+extern void dtrace_dof_destroy(dtrace_hdl_t *, void *);
+
+extern void *dtrace_getopt_dof(dtrace_hdl_t *);
+extern void *dtrace_geterr_dof(dtrace_hdl_t *);
+
+typedef struct dtrace_stmtdesc {
+	dtrace_ecbdesc_t *dtsd_ecbdesc;		/* ECB description */
+	dtrace_actdesc_t *dtsd_action;		/* action list */
+	dtrace_actdesc_t *dtsd_action_last;	/* last action in action list */
+	void *dtsd_aggdata;			/* aggregation data */
+	void *dtsd_fmtdata;			/* type-specific output data */
+	void (*dtsd_callback)();		/* callback function for EPID */
+	void *dtsd_data;			/* callback data pointer */
+	dtrace_attribute_t dtsd_descattr;	/* probedesc attributes */
+	dtrace_attribute_t dtsd_stmtattr;	/* statement attributes */
+#if defined(VBOX) && defined(__GNUC__) && defined(RT_ARCH_AMD64)
+	/* gcc 4.4.5 p1.3 hass been seen doing a 64-bit access to read
+	   dtsd_stmtattr (which is 3 bytes), thereby accessing bytes beyond the
+	   end of the structure. */
+	uint32_t u32Padding;
+#endif
+} dtrace_stmtdesc_t;
+
+typedef int dtrace_stmt_f(dtrace_hdl_t *, dtrace_prog_t *,
+    dtrace_stmtdesc_t *, void *);
+
+extern dtrace_stmtdesc_t *dtrace_stmt_create(dtrace_hdl_t *,
+    dtrace_ecbdesc_t *);
+extern dtrace_actdesc_t *dtrace_stmt_action(dtrace_hdl_t *,
+    dtrace_stmtdesc_t *);
+extern int dtrace_stmt_add(dtrace_hdl_t *, dtrace_prog_t *,
+    dtrace_stmtdesc_t *);
+extern int dtrace_stmt_iter(dtrace_hdl_t *, dtrace_prog_t *,
+    dtrace_stmt_f *, void *);
+extern void dtrace_stmt_destroy(dtrace_hdl_t *, dtrace_stmtdesc_t *);
+
+/*
+ * DTrace Data Consumption Interface
+ */
+typedef enum {
+	DTRACEFLOW_ENTRY,
+	DTRACEFLOW_RETURN,
+	DTRACEFLOW_NONE
+} dtrace_flowkind_t;
+
+#define	DTRACE_CONSUME_ERROR		-1	/* error while processing */
+#define	DTRACE_CONSUME_THIS		0	/* consume this probe/record */
+#define	DTRACE_CONSUME_NEXT		1	/* advance to next probe/rec */
+#define	DTRACE_CONSUME_ABORT		2	/* abort consumption */
+
+typedef struct dtrace_probedata {
+	dtrace_hdl_t *dtpda_handle;		/* handle to DTrace library */
+	dtrace_eprobedesc_t *dtpda_edesc;	/* enabled probe description */
+	dtrace_probedesc_t *dtpda_pdesc;	/* probe description */
+	processorid_t dtpda_cpu;		/* CPU for data */
+	caddr_t dtpda_data;			/* pointer to raw data */
+	dtrace_flowkind_t dtpda_flow;		/* flow kind */
+	const char *dtpda_prefix;		/* recommended flow prefix */
+	int dtpda_indent;			/* recommended flow indent */
+} dtrace_probedata_t;
+
+typedef int dtrace_consume_probe_f(const dtrace_probedata_t *, void *);
+typedef int dtrace_consume_rec_f(const dtrace_probedata_t *,
+    const dtrace_recdesc_t *, void *);
+
+extern int dtrace_consume(dtrace_hdl_t *, FILE *,
+    dtrace_consume_probe_f *, dtrace_consume_rec_f *, void *);
+
+#define	DTRACE_STATUS_NONE	0	/* no status; not yet time */
+#define	DTRACE_STATUS_OKAY	1	/* status okay */
+#define	DTRACE_STATUS_EXITED	2	/* exit() was called; tracing stopped */
+#define	DTRACE_STATUS_FILLED	3	/* fill buffer filled; tracing stoped */
+#define	DTRACE_STATUS_STOPPED	4	/* tracing already stopped */
+
+extern int dtrace_status(dtrace_hdl_t *);
+
+/*
+ * DTrace Formatted Output Interfaces
+ *
+ * To format output associated with a given dtrace_stmtdesc, the caller can
+ * invoke one of the following functions, passing the opaque dtsd_fmtdata and a
+ * list of record descriptions.  These functions return either -1 to indicate
+ * an error, or a positive integer indicating the number of records consumed.
+ * For anonymous enablings, the consumer can use the dtrd_format member of
+ * the record description to obtain a format description.  The dtfd_string
+ * member of the format description may be passed to dtrace_print{fa}_create()
+ * to create the opaque format data.
+ */
+extern void *dtrace_printf_create(dtrace_hdl_t *, const char *);
+extern void *dtrace_printa_create(dtrace_hdl_t *, const char *);
+extern size_t dtrace_printf_format(dtrace_hdl_t *, void *, char *, size_t);
+
+extern int dtrace_fprintf(dtrace_hdl_t *, FILE *, void *,
+    const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t,
+    const void *, size_t);
+
+extern int dtrace_fprinta(dtrace_hdl_t *, FILE *, void *,
+    const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t,
+    const void *, size_t);
+
+extern int dtrace_system(dtrace_hdl_t *, FILE *, void *,
+    const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t,
+    const void *, size_t);
+
+extern int dtrace_freopen(dtrace_hdl_t *, FILE *, void *,
+    const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t,
+    const void *, size_t);
+
+/*
+ * DTrace Work Interface
+ */
+typedef enum {
+	DTRACE_WORKSTATUS_ERROR = -1,
+	DTRACE_WORKSTATUS_OKAY,
+	DTRACE_WORKSTATUS_DONE
+} dtrace_workstatus_t;
+
+extern dtrace_workstatus_t dtrace_work(dtrace_hdl_t *, FILE *,
+    dtrace_consume_probe_f *, dtrace_consume_rec_f *, void *);
+
+/*
+ * DTrace Handler Interface
+ */
+#define	DTRACE_HANDLE_ABORT		-1	/* abort current operation */
+#define	DTRACE_HANDLE_OK		0	/* handled okay; continue */
+
+typedef struct dtrace_errdata {
+	dtrace_hdl_t *dteda_handle;		/* handle to DTrace library */
+	dtrace_eprobedesc_t *dteda_edesc;	/* enabled probe inducing err */
+	dtrace_probedesc_t *dteda_pdesc;	/* probe inducing error */
+	processorid_t dteda_cpu;		/* CPU of error */
+	int dteda_action;			/* action inducing error */
+	int dteda_offset;			/* offset in DIFO of error */
+	int dteda_fault;			/* specific fault */
+	uint64_t dteda_addr;			/* address of fault, if any */
+	const char *dteda_msg;			/* preconstructed message */
+} dtrace_errdata_t;
+
+typedef int dtrace_handle_err_f(const dtrace_errdata_t *, void *);
+extern int dtrace_handle_err(dtrace_hdl_t *, dtrace_handle_err_f *, void *);
+
+typedef enum {
+	DTRACEDROP_PRINCIPAL,			/* drop to principal buffer */
+	DTRACEDROP_AGGREGATION,			/* drop to aggregation buffer */
+	DTRACEDROP_DYNAMIC,			/* dynamic drop */
+	DTRACEDROP_DYNRINSE,			/* dyn drop due to rinsing */
+	DTRACEDROP_DYNDIRTY,			/* dyn drop due to dirty */
+	DTRACEDROP_SPEC,			/* speculative drop */
+	DTRACEDROP_SPECBUSY,			/* spec drop due to busy */
+	DTRACEDROP_SPECUNAVAIL,			/* spec drop due to unavail */
+	DTRACEDROP_STKSTROVERFLOW,		/* stack string tab overflow */
+	DTRACEDROP_DBLERROR			/* error in ERROR probe */
+} dtrace_dropkind_t;
+
+typedef struct dtrace_dropdata {
+	dtrace_hdl_t *dtdda_handle;		/* handle to DTrace library */
+	processorid_t dtdda_cpu;		/* CPU, if any */
+	dtrace_dropkind_t dtdda_kind;		/* kind of drop */
+	uint64_t dtdda_drops;			/* number of drops */
+	uint64_t dtdda_total;			/* total drops */
+	const char *dtdda_msg;			/* preconstructed message */
+} dtrace_dropdata_t;
+
+typedef int dtrace_handle_drop_f(const dtrace_dropdata_t *, void *);
+extern int dtrace_handle_drop(dtrace_hdl_t *, dtrace_handle_drop_f *, void *);
+
+typedef void dtrace_handle_proc_f(struct ps_prochandle *, const char *, void *);
+extern int dtrace_handle_proc(dtrace_hdl_t *, dtrace_handle_proc_f *, void *);
+
+#define	DTRACE_BUFDATA_AGGKEY		0x0001	/* aggregation key */
+#define	DTRACE_BUFDATA_AGGVAL		0x0002	/* aggregation value */
+#define	DTRACE_BUFDATA_AGGFORMAT	0x0004	/* aggregation format data */
+#define	DTRACE_BUFDATA_AGGLAST		0x0008	/* last for this key/val */
+
+typedef struct dtrace_bufdata {
+	dtrace_hdl_t *dtbda_handle;		/* handle to DTrace library */
+	const char *dtbda_buffered;		/* buffered output */
+	dtrace_probedata_t *dtbda_probe;	/* probe data */
+	const dtrace_recdesc_t *dtbda_recdesc;	/* record description */
+	const dtrace_aggdata_t *dtbda_aggdata;	/* aggregation data, if agg. */
+	uint32_t dtbda_flags;			/* flags; see above */
+} dtrace_bufdata_t;
+
+typedef int dtrace_handle_buffered_f(const dtrace_bufdata_t *, void *);
+extern int dtrace_handle_buffered(dtrace_hdl_t *,
+    dtrace_handle_buffered_f *, void *);
+
+typedef struct dtrace_setoptdata {
+	dtrace_hdl_t *dtsda_handle;		/* handle to DTrace library */
+	const dtrace_probedata_t *dtsda_probe;	/* probe data */
+	const char *dtsda_option;		/* option that was set */
+	dtrace_optval_t dtsda_oldval;		/* old value */
+	dtrace_optval_t dtsda_newval;		/* new value */
+} dtrace_setoptdata_t;
+
+typedef int dtrace_handle_setopt_f(const dtrace_setoptdata_t *, void *);
+extern int dtrace_handle_setopt(dtrace_hdl_t *,
+    dtrace_handle_setopt_f *, void *);
+
+/*
+ * DTrace Aggregate Interface
+ */
+
+#define	DTRACE_A_PERCPU		0x0001
+#define	DTRACE_A_KEEPDELTA	0x0002
+#define	DTRACE_A_ANONYMOUS	0x0004
+
+#define	DTRACE_AGGWALK_ERROR		-1	/* error while processing */
+#define	DTRACE_AGGWALK_NEXT		0	/* proceed to next element */
+#define	DTRACE_AGGWALK_ABORT		1	/* abort aggregation walk */
+#define	DTRACE_AGGWALK_CLEAR		2	/* clear this element */
+#define	DTRACE_AGGWALK_NORMALIZE	3	/* normalize this element */
+#define	DTRACE_AGGWALK_DENORMALIZE	4	/* denormalize this element */
+#define	DTRACE_AGGWALK_REMOVE		5	/* remove this element */
+
+struct dtrace_aggdata {
+	dtrace_hdl_t *dtada_handle;		/* handle to DTrace library */
+	dtrace_aggdesc_t *dtada_desc;		/* aggregation description */
+	dtrace_eprobedesc_t *dtada_edesc;	/* enabled probe description */
+	dtrace_probedesc_t *dtada_pdesc;	/* probe description */
+	caddr_t dtada_data;			/* pointer to raw data */
+	uint64_t dtada_normal;			/* the normal -- 1 for denorm */
+	size_t dtada_size;			/* total size of the data */
+	caddr_t dtada_delta;			/* delta data, if available */
+	caddr_t *dtada_percpu;			/* per CPU data, if avail */
+	caddr_t *dtada_percpu_delta;		/* per CPU delta, if avail */
+};
+
+typedef int dtrace_aggregate_f(const dtrace_aggdata_t *, void *);
+typedef int dtrace_aggregate_walk_f(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+typedef int dtrace_aggregate_walk_joined_f(const dtrace_aggdata_t **,
+    const int, void *);
+
+extern void dtrace_aggregate_clear(dtrace_hdl_t *);
+extern int dtrace_aggregate_snap(dtrace_hdl_t *);
+extern int dtrace_aggregate_print(dtrace_hdl_t *, FILE *,
+    dtrace_aggregate_walk_f *);
+
+extern int dtrace_aggregate_walk(dtrace_hdl_t *, dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_joined(dtrace_hdl_t *,
+    dtrace_aggvarid_t *, int, dtrace_aggregate_walk_joined_f *, void *);
+
+extern int dtrace_aggregate_walk_sorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_keysorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_valsorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_keyvarsorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_valvarsorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_keyrevsorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_valrevsorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_keyvarrevsorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+extern int dtrace_aggregate_walk_valvarrevsorted(dtrace_hdl_t *,
+    dtrace_aggregate_f *, void *);
+
+#define	DTRACE_AGD_PRINTED	0x1	/* aggregation printed in program */
+
+/*
+ * DTrace Process Control Interface
+ *
+ * Library clients who wish to have libdtrace create or grab processes for
+ * monitoring of their symbol table changes may use these interfaces to
+ * request that libdtrace obtain control of the process using libproc.
+ */
+
+extern struct ps_prochandle *dtrace_proc_create(dtrace_hdl_t *,
+    const char *, char *const *);
+
+extern struct ps_prochandle *dtrace_proc_grab(dtrace_hdl_t *, pid_t, int);
+extern void dtrace_proc_release(dtrace_hdl_t *, struct ps_prochandle *);
+extern void dtrace_proc_continue(dtrace_hdl_t *, struct ps_prochandle *);
+
+/*
+ * DTrace Object, Symbol, and Type Interfaces
+ *
+ * Library clients can use libdtrace to perform symbol and C type information
+ * lookups by symbol name, symbol address, or C type name, or to lookup meta-
+ * information cached for each of the program objects in use by DTrace.  The
+ * resulting struct contain pointers to arbitrary-length strings, including
+ * object, symbol, and type names, that are persistent until the next call to
+ * dtrace_update().  Once dtrace_update() is called, any cached values must
+ * be flushed and not used subsequently by the client program.
+ */
+
+#define	DTRACE_OBJ_EXEC	 ((const char *)0L)	/* primary executable file */
+#define	DTRACE_OBJ_RTLD	 ((const char *)1L)	/* run-time link-editor */
+#define	DTRACE_OBJ_CDEFS ((const char *)2L)	/* C include definitions */
+#define	DTRACE_OBJ_DDEFS ((const char *)3L)	/* D program definitions */
+#define	DTRACE_OBJ_EVERY ((const char *)-1L)	/* all known objects */
+#define	DTRACE_OBJ_KMODS ((const char *)-2L)	/* all kernel objects */
+#define	DTRACE_OBJ_UMODS ((const char *)-3L)	/* all user objects */
+
+typedef struct dtrace_objinfo {
+	const char *dto_name;			/* object file scope name */
+	const char *dto_file;			/* object file path (if any) */
+	int dto_id;				/* object file id (if any) */
+	uint_t dto_flags;			/* object flags (see below) */
+
+	GElf_Addr dto_text_va;			/* address of text section */
+	GElf_Xword dto_text_size;		/* size of text section */
+	GElf_Addr dto_data_va;			/* address of data section */
+	GElf_Xword dto_data_size;		/* size of data section */
+	GElf_Addr dto_bss_va;			/* address of BSS */
+	GElf_Xword dto_bss_size;		/* size of BSS */
+} dtrace_objinfo_t;
+
+#define	DTRACE_OBJ_F_KERNEL	0x1		/* object is a kernel module */
+#define	DTRACE_OBJ_F_PRIMARY	0x2		/* object is a primary module */
+
+typedef int dtrace_obj_f(dtrace_hdl_t *, const dtrace_objinfo_t *, void *);
+
+extern int dtrace_object_iter(dtrace_hdl_t *, dtrace_obj_f *, void *);
+extern int dtrace_object_info(dtrace_hdl_t *, const char *, dtrace_objinfo_t *);
+
+typedef struct dtrace_syminfo {
+	const char *dts_object;			/* object name */
+	const char *dts_name;			/* symbol name */
+	ulong_t dts_id;				/* symbol id */
+} dtrace_syminfo_t;
+
+extern int dtrace_lookup_by_name(dtrace_hdl_t *, const char *, const char *,
+    GElf_Sym *, dtrace_syminfo_t *);
+
+extern int dtrace_lookup_by_addr(dtrace_hdl_t *, GElf_Addr addr,
+    GElf_Sym *, dtrace_syminfo_t *);
+
+typedef struct dtrace_typeinfo {
+	const char *dtt_object;			/* object containing type */
+	ctf_file_t *dtt_ctfp;			/* CTF container handle */
+	ctf_id_t dtt_type;			/* CTF type identifier */
+} dtrace_typeinfo_t;
+
+extern int dtrace_lookup_by_type(dtrace_hdl_t *, const char *, const char *,
+    dtrace_typeinfo_t *);
+
+extern int dtrace_symbol_type(dtrace_hdl_t *, const GElf_Sym *,
+    const dtrace_syminfo_t *, dtrace_typeinfo_t *);
+
+extern int dtrace_type_strcompile(dtrace_hdl_t *,
+    const char *, dtrace_typeinfo_t *);
+
+extern int dtrace_type_fcompile(dtrace_hdl_t *,
+    FILE *, dtrace_typeinfo_t *);
+
+/*
+ * DTrace Probe Interface
+ *
+ * Library clients can use these functions to iterate over the set of available
+ * probe definitions and inquire as to their attributes.  The probe iteration
+ * interfaces report probes that are declared as well as those from dtrace(7D).
+ */
+typedef struct dtrace_probeinfo {
+	dtrace_attribute_t dtp_attr;		/* name attributes */
+	dtrace_attribute_t dtp_arga;		/* arg attributes */
+	const dtrace_typeinfo_t *dtp_argv;	/* arg types */
+	int dtp_argc;				/* arg count */
+} dtrace_probeinfo_t;
+
+typedef int dtrace_probe_f(dtrace_hdl_t *, const dtrace_probedesc_t *, void *);
+
+extern int dtrace_probe_iter(dtrace_hdl_t *,
+    const dtrace_probedesc_t *pdp, dtrace_probe_f *, void *);
+
+extern int dtrace_probe_info(dtrace_hdl_t *,
+    const dtrace_probedesc_t *, dtrace_probeinfo_t *);
+
+/*
+ * DTrace Vector Interface
+ *
+ * The DTrace library normally speaks directly to dtrace(7D).  However,
+ * this communication may be vectored elsewhere.  Consumers who wish to
+ * perform a vectored open must fill in the vector, and use the dtrace_vopen()
+ * entry point to obtain a library handle.
+ */
+struct dtrace_vector {
+	int (*dtv_ioctl)(void *, int, void *);
+	int (*dtv_lookup_by_addr)(void *, GElf_Addr, GElf_Sym *,
+	    dtrace_syminfo_t *);
+	int (*dtv_status)(void *, processorid_t);
+	long (*dtv_sysconf)(void *, int);
+};
+
+/*
+ * DTrace Utility Functions
+ *
+ * Library clients can use these functions to convert addresses strings, to
+ * convert between string and integer probe descriptions and the
+ * dtrace_probedesc_t representation, and to perform similar conversions on
+ * stability attributes.
+ */
+extern int dtrace_addr2str(dtrace_hdl_t *, uint64_t, char *, int);
+extern int dtrace_uaddr2str(dtrace_hdl_t *, pid_t, uint64_t, char *, int);
+
+extern int dtrace_xstr2desc(dtrace_hdl_t *, dtrace_probespec_t,
+    const char *, int, char *const [], dtrace_probedesc_t *);
+
+extern int dtrace_str2desc(dtrace_hdl_t *, dtrace_probespec_t,
+    const char *, dtrace_probedesc_t *);
+
+extern int dtrace_id2desc(dtrace_hdl_t *, dtrace_id_t, dtrace_probedesc_t *);
+
+#define	DTRACE_DESC2STR_MAX	1024	/* min buf size for dtrace_desc2str() */
+
+extern char *dtrace_desc2str(const dtrace_probedesc_t *, char *, size_t);
+
+#define	DTRACE_ATTR2STR_MAX	64	/* min buf size for dtrace_attr2str() */
+
+extern char *dtrace_attr2str(dtrace_attribute_t, char *, size_t);
+extern int dtrace_str2attr(const char *, dtrace_attribute_t *);
+
+extern const char *dtrace_stability_name(dtrace_stability_t);
+extern const char *dtrace_class_name(dtrace_class_t);
+
+extern int dtrace_provider_modules(dtrace_hdl_t *, const char **, int);
+
+extern const char *const _dtrace_version;
+extern int _dtrace_debug;
+
+#ifdef VBOX
+extern void dtrace_init(void);
+#endif
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _DTRACE_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/fc.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/fc.d
new file mode 100644
index 0000000..433e645
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/fc.d
@@ -0,0 +1,183 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	D depends_on library net.d
+#pragma	D depends_on library scsi.d
+#pragma	D depends_on module genunix
+#pragma	D depends_on module fct
+
+/*
+ * FC port information.
+ */
+typedef struct fc_port_info {
+	string fcp_node_wwn;		/* node WWN */
+	string fcp_sym_node_name;	/* node symbolic name */
+	string fcp_sym_port_name;	/* port symbolic name */
+	uint32_t fcp_port_hard_address;	/* port hard address */
+} fc_port_info_t;
+
+/*
+ * FC transfer info (somewhat analogous to iscsiinfo_t)
+ * Represents data transfer details.
+ */
+typedef struct fc_xferinfo {
+	uint32_t fcx_len;
+	uint32_t fcx_offset;
+	uint16_t fcx_flags;	/* db_flags as defined in sys/stmf.h */
+} fc_xferinfo_t;
+
+/*
+ * conninfo translators
+ */
+
+/*
+ * Translator for conninfo, translating from the local port.
+ */
+#pragma D binding "1.5" translator
+translator conninfo_t < fct_local_port_t *P > {
+ 	ci_local = P->port_pwwn_str[0] ?
+	    P->port_pwwn_str : "<unknown>";
+ 	ci_remote = "<unknown>";
+	ci_protocol = "fc";
+};
+
+/*
+ * Translator for conninfo, translating from the local port implementation.
+ */
+#pragma D binding "1.5" translator
+translator conninfo_t < fct_i_local_port_t *P > {
+ 	ci_local = P->iport_port->port_pwwn_str[0] ?
+		 P->iport_port->port_pwwn_str : "<unknown>";
+ 	ci_remote = "<unknown>";
+	ci_protocol = "fc";
+};
+
+/*
+ * Translator for conninfo, translating from fct cmd struct.
+ */
+#pragma D binding "1.5" translator
+translator conninfo_t < fct_cmd_t *C > {
+ 	ci_local = (C->cmd_port ?
+		 (C->cmd_port->port_pwwn_str[0] ?
+		  C->cmd_port->port_pwwn_str : "<unknown>") :
+		 "<unknown>");
+
+ 	ci_remote = (C->cmd_rp ?
+		 (C->cmd_rp->rp_pwwn_str[0] ?
+		  C->cmd_rp->rp_pwwn_str : "<unknown>") :
+		 "<unknown>");
+
+	ci_protocol = "fc";
+};
+
+
+/*
+ * fc_port_info_t translators.
+ */
+
+/*
+ * Translator for fc_port_info_t, translating from the local port.
+ */
+#pragma D binding "1.5" translator
+translator fc_port_info_t < fct_local_port_t *P > {
+        /* node WWN */
+	fcp_node_wwn = P->port_nwwn_str[0] ?
+		     P->port_nwwn_str : "<unknown>";
+
+	/* node symbolic name */
+	fcp_sym_node_name = P->port_sym_node_name ? 
+		P->port_sym_node_name : `utsname.nodename;
+
+	/* port symbolic name */
+	fcp_sym_port_name = P->port_sym_port_name ?
+			P->port_sym_port_name : "<unknown>";
+
+	/* port hard address */
+	fcp_port_hard_address = P->port_hard_address;
+};
+
+
+/*
+ * Translator for fc_port_info_t, translating from the local port impl.
+ */
+#pragma D binding "1.5" translator
+translator fc_port_info_t < fct_i_local_port_t *P > {
+        /* node WWN */
+
+	fcp_node_wwn = (P->iport_port ?
+			   (P->iport_port->port_nwwn_str[0] ?
+		               P->iport_port->port_nwwn_str :
+			       "<unknown>") : 
+		           "<bad iport_port ptr>");
+
+	fcp_sym_node_name = 
+			 (P->iport_port ?
+			   (P->iport_port->port_sym_node_name ?
+		            P->iport_port->port_sym_node_name : "<unknown>") : 
+		           "<bad iport_port ptr>");
+
+	fcp_sym_port_name =
+			 (P->iport_port ?
+			   (P->iport_port->port_sym_port_name ?
+		            P->iport_port->port_sym_port_name : "<unknown>") : 
+		           "<bad iport_port ptr>");
+
+	fcp_port_hard_address = 
+			 (P->iport_port ?
+			   P->iport_port->port_hard_address : 0);
+};
+
+/*
+ * Translator for fc_port_info, translating from the remote port impl
+ */
+#pragma D binding "1.5" translator
+translator fc_port_info_t < fct_i_remote_port_t *P > {
+
+        /* node WWN */
+	fcp_node_wwn = P->irp_rp ?
+			   (P->irp_rp->rp_nwwn_str[0] ?
+			     P->irp_rp->rp_nwwn_str : "<unknown>") :
+                           "<unknown>";
+
+	/* node symbolic name */
+	fcp_sym_node_name = P->irp_snn ? P->irp_snn : "<unknown>";
+
+	/* port symbolic name */
+	fcp_sym_port_name = P->irp_spn ? P->irp_spn : "<unknown>";
+
+	/* port hard address */
+	fcp_port_hard_address = P->irp_rp ? P->irp_rp->rp_id : 0;
+};
+
+/*
+ * Translator for fc_xferinfo, translating from stmf_data_buf_t.
+ */
+#pragma D binding "1.5" translator
+translator fc_xferinfo_t < stmf_data_buf_t *B > {
+	   fcx_len = B->db_data_size;
+	   fcx_offset = B->db_relative_offset;
+	   fcx_flags = B->db_flags;
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/io.d.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/io.d.in
new file mode 100644
index 0000000..cb1e32c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/io.d.in
@@ -0,0 +1,218 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D depends_on module unix
+#pragma D depends_on provider io
+
+inline int B_BUSY = @B_BUSY@;
+#pragma D binding "1.0" B_BUSY
+inline int B_DONE = @B_DONE@;
+#pragma D binding "1.0" B_DONE
+inline int B_ERROR = @B_ERROR@;
+#pragma D binding "1.0" B_ERROR
+inline int B_PAGEIO = @B_PAGEIO@;
+#pragma D binding "1.0" B_PAGEIO
+inline int B_PHYS = @B_PHYS@;
+#pragma D binding "1.0" B_PHYS
+inline int B_READ = @B_READ@;
+#pragma D binding "1.0" B_READ
+inline int B_WRITE = @B_WRITE@;
+#pragma D binding "1.0" B_WRITE
+inline int B_ASYNC = @B_ASYNC@;
+#pragma D binding "1.0" B_ASYNC
+
+typedef struct bufinfo {
+	int b_flags;			/* buffer status */
+	size_t b_bcount;		/* number of bytes */
+	caddr_t b_addr;			/* buffer address */
+	uint64_t b_lblkno;		/* block # on device */
+	uint64_t b_blkno;		/* expanded block # on device */
+	size_t b_resid;			/* # of bytes not transferred */
+	size_t b_bufsize;		/* size of allocated buffer */
+	caddr_t b_iodone;		/* I/O completion routine */
+	int b_error;			/* expanded error field */
+	dev_t b_edev;			/* extended device */
+} bufinfo_t;
+
+#pragma D binding "1.0" translator
+translator bufinfo_t < struct buf *B > {
+	b_flags = B->b_flags;
+	b_addr = B->b_un.b_addr;
+	b_bcount = B->b_bcount;
+	b_lblkno = B->_b_blkno._f;
+	b_blkno = sizeof (long) == 8 ? B->_b_blkno._f : B->_b_blkno._p._l;
+	b_resid = B->b_resid;
+	b_bufsize = B->b_bufsize;
+	b_iodone = (caddr_t)B->b_iodone;
+	b_error = B->b_error;
+	b_edev = B->b_edev;
+}; 
+
+typedef struct devinfo {
+	int dev_major;			/* major number */
+	int dev_minor;			/* minor number */
+	int dev_instance;		/* instance number */
+	string dev_name;		/* name of device */
+	string dev_statname;		/* name of device + instance/minor */
+	string dev_pathname;		/* pathname of device */
+} devinfo_t;
+
+#pragma D binding "1.0" translator
+translator devinfo_t < struct buf *B > {
+	dev_major = B->b_dip != NULL ? getmajor(B->b_edev) :
+	    getmajor(B->b_file->v_vfsp->vfs_dev);
+	dev_minor = B->b_dip != NULL ? getminor(B->b_edev) :
+	    getminor(B->b_file->v_vfsp->vfs_dev);
+	dev_instance = B->b_dip == NULL ? 
+	    getminor(B->b_file->v_vfsp->vfs_dev) :
+	    ((struct dev_info *)B->b_dip)->devi_instance;
+	dev_name = B->b_dip == NULL ? "nfs" :
+	    stringof(`devnamesp[getmajor(B->b_edev)].dn_name);
+	dev_statname = strjoin(B->b_dip == NULL ? "nfs" :
+	    stringof(`devnamesp[getmajor(B->b_edev)].dn_name),
+	    lltostr(B->b_dip == NULL ? getminor(B->b_file->v_vfsp->vfs_dev) :
+	    ((struct dev_info *)B->b_dip)->devi_instance == 0 &&
+	    ((struct dev_info *)B->b_dip)->devi_parent != NULL &&
+	    ((struct dev_info *)B->b_dip)->devi_parent->devi_node_name ==
+	    "pseudo" ? getminor(B->b_edev) :
+	    ((struct dev_info *)B->b_dip)->devi_instance));
+	dev_pathname = B->b_dip == NULL ? "<nfs>" :
+	    ddi_pathname(B->b_dip, getminor(B->b_edev));
+};
+
+typedef struct fileinfo {
+	string fi_name;			/* name (basename of fi_pathname) */
+	string fi_dirname;		/* directory (dirname of fi_pathname) */
+	string fi_pathname;		/* full pathname */
+	offset_t fi_offset;		/* offset within file */
+	string fi_fs;			/* filesystem */
+	string fi_mount;		/* mount point of file system */
+	int fi_oflags;			/* open(2) flags for file descriptor */
+} fileinfo_t;
+
+#pragma D binding "1.0" translator
+translator fileinfo_t < struct buf *B > {
+	fi_name = B->b_file == NULL ? "<none>" :
+	    B->b_file->v_path == NULL ? "<unknown>" :
+	    basename(cleanpath(B->b_file->v_path));
+	fi_dirname = B->b_file == NULL ? "<none>" :
+	    B->b_file->v_path == NULL ? "<unknown>" :
+	    dirname(cleanpath(B->b_file->v_path));
+	fi_pathname = B->b_file == NULL ? "<none>" :
+	    B->b_file->v_path == NULL ? "<unknown>" :
+	    cleanpath(B->b_file->v_path);
+	fi_offset = B->b_offset;
+	fi_fs = B->b_file == NULL ? "<none>" :
+	    stringof(B->b_file->v_op->vnop_name);
+	fi_mount = B->b_file == NULL ? "<none>" :
+	    B->b_file->v_vfsp->vfs_vnodecovered == NULL ? "/" :
+	    B->b_file->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
+	    cleanpath(B->b_file->v_vfsp->vfs_vnodecovered->v_path);
+	fi_oflags = 0;
+};
+
+/*
+ * The following inline constants can be used to examine fi_oflags when using
+ * the fds[] array or a translated fileinfo_t.  Note that the various open
+ * flags behave as a bit-field *except* for O_RDONLY, O_WRONLY, and O_RDWR.
+ * To test the open mode, you write code similar to that used with the fcntl(2)
+ * F_GET[X]FL command, such as: if ((fi_oflags & O_ACCMODE) == O_WRONLY).
+ */
+inline int O_ACCMODE = @O_ACCMODE@;
+#pragma D binding "1.1" O_ACCMODE
+
+inline int O_RDONLY = @O_RDONLY@;
+#pragma D binding "1.1" O_RDONLY
+inline int O_WRONLY = @O_WRONLY@;
+#pragma D binding "1.1" O_WRONLY
+inline int O_RDWR = @O_RDWR@;
+#pragma D binding "1.1" O_RDWR
+
+inline int O_APPEND = @O_APPEND@;
+#pragma D binding "1.1" O_APPEND
+inline int O_CREAT = @O_CREAT@;
+#pragma D binding "1.1" O_CREAT
+inline int O_DSYNC = @O_DSYNC@;
+#pragma D binding "1.1" O_DSYNC
+inline int O_EXCL = @O_EXCL@;
+#pragma D binding "1.1" O_EXCL
+inline int O_LARGEFILE = @O_LARGEFILE@;
+#pragma D binding "1.1" O_LARGEFILE
+inline int O_NOCTTY = @O_NOCTTY@;
+#pragma D binding "1.1" O_NOCTTY
+inline int O_NONBLOCK = @O_NONBLOCK@;
+#pragma D binding "1.1" O_NONBLOCK
+inline int O_NDELAY = @O_NDELAY@;
+#pragma D binding "1.1" O_NDELAY
+inline int O_RSYNC = @O_RSYNC@;
+#pragma D binding "1.1" O_RSYNC
+inline int O_SYNC = @O_SYNC@;
+#pragma D binding "1.1" O_SYNC
+inline int O_TRUNC = @O_TRUNC@;
+#pragma D binding "1.1" O_TRUNC
+inline int O_XATTR = @O_XATTR@;
+#pragma D binding "1.1" O_XATTR
+
+#pragma D binding "1.1" translator
+translator fileinfo_t < struct file *F > {
+	fi_name = F == NULL ? "<none>" :
+	    F->f_vnode->v_path == NULL ? "<unknown>" :
+	    basename(cleanpath(F->f_vnode->v_path));
+	fi_dirname = F == NULL ? "<none>" :
+	    F->f_vnode->v_path == NULL ? "<unknown>" :
+	    dirname(cleanpath(F->f_vnode->v_path));
+	fi_pathname = F == NULL ? "<none>" :
+	    F->f_vnode->v_path == NULL ? "<unknown>" :
+	    cleanpath(F->f_vnode->v_path);
+	fi_offset = F == NULL ? 0 : F->f_offset;
+	fi_fs = F == NULL ? "<none>" : stringof(F->f_vnode->v_op->vnop_name);
+	fi_mount = F == NULL ? "<none>" :
+	    F->f_vnode->v_vfsp->vfs_vnodecovered == NULL ? "/" :
+	    F->f_vnode->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
+	    cleanpath(F->f_vnode->v_vfsp->vfs_vnodecovered->v_path);
+	fi_oflags = F == NULL ? 0 : F->f_flag + (int)@FOPEN@;
+};
+
+inline fileinfo_t fds[int fd] = xlate <fileinfo_t> (
+    fd >= 0 && fd < curthread->t_procp->p_user.u_finfo.fi_nfiles ?
+    curthread->t_procp->p_user.u_finfo.fi_list[fd].uf_file : NULL);
+
+#pragma D attributes Stable/Stable/Common fds
+#pragma D binding "1.1" fds
+
+#pragma D binding "1.2" translator
+translator fileinfo_t < struct vnode *V > {
+	fi_name = V->v_path == NULL ? "<unknown>" :
+	    basename(cleanpath(V->v_path));
+	fi_dirname = V->v_path == NULL ? "<unknown>" :
+	    dirname(cleanpath(V->v_path));
+	fi_pathname = V->v_path == NULL ? "<unknown>" : cleanpath(V->v_path);
+	fi_fs = stringof(V->v_op->vnop_name);
+	fi_mount = V->v_vfsp->vfs_vnodecovered == NULL ? "/" :
+	    V->v_vfsp->vfs_vnodecovered->v_path == NULL ? "<unknown>" :
+	    cleanpath(V->v_vfsp->vfs_vnodecovered->v_path);
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/io.sed.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/io.sed.in
new file mode 100644
index 0000000..87fad5b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/io.sed.in
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * This file is a sed script which is first preprocessed by cpp or cc -E to
+ * define a set of sed directives which replace #define tokens with their
+ * values.  After preprocessing, the sed script is run over io.d.in to
+ * replace the #define tokens listed below to create the finished io.d.
+ * Refer to the rules in libdtrace/Makefile.com for more information.
+ */
+
+#include <sys/buf.h>
+#include <sys/file.h>
+#include <sys/fcntl.h>
+
+#define	SED_REPLACE(x)	s/#x/x/g
+
+SED_REPLACE(B_BUSY)
+SED_REPLACE(B_DONE)
+SED_REPLACE(B_ERROR)
+SED_REPLACE(B_PAGEIO)
+SED_REPLACE(B_PHYS)
+SED_REPLACE(B_READ)
+SED_REPLACE(B_WRITE)
+SED_REPLACE(B_ASYNC)
+
+SED_REPLACE(FOPEN)
+
+SED_REPLACE(O_ACCMODE)
+SED_REPLACE(O_RDONLY)
+SED_REPLACE(O_WRONLY)
+SED_REPLACE(O_RDWR)
+SED_REPLACE(O_APPEND)
+SED_REPLACE(O_CREAT)
+SED_REPLACE(O_DSYNC)
+SED_REPLACE(O_EXCL)
+SED_REPLACE(O_LARGEFILE)
+SED_REPLACE(O_NOCTTY)
+SED_REPLACE(O_NONBLOCK)
+SED_REPLACE(O_NDELAY)
+SED_REPLACE(O_RSYNC)
+SED_REPLACE(O_SYNC)
+SED_REPLACE(O_TRUNC)
+SED_REPLACE(O_XATTR)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/ip.d.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/ip.d.in
new file mode 100644
index 0000000..f1e6332
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/ip.d.in
@@ -0,0 +1,374 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D depends_on module ip
+#pragma D depends_on provider ip
+
+inline int IPH_DF = @IPH_DF@;
+#pragma D binding "1.5" IPH_DF
+inline int IPH_MF = @IPH_MF@;
+#pragma D binding "1.5" IPH_MF
+
+#pragma D binding "1.5" IPPROTO_IP
+inline int IPPROTO_IP = @IPPROTO_IP@;
+#pragma D binding "1.5" IPPROTO_HOPOPTS
+inline int IPPROTO_HOPOPTS = @IPPROTO_HOPOPTS@;
+#pragma D binding "1.5" IPPROTO_ICMP
+inline int IPPROTO_ICMP = @IPPROTO_ICMP@;
+#pragma D binding "1.5" IPPROTO_IGMP
+inline int IPPROTO_IGMP = @IPPROTO_IGMP@;
+#pragma D binding "1.5" IPPROTO_GGP
+inline int IPPROTO_GGP = @IPPROTO_GGP@;
+#pragma D binding "1.5" IPPROTO_ENCAP
+inline int IPPROTO_ENCAP = @IPPROTO_ENCAP@;
+#pragma D binding "1.5" IPPROTO_TCP
+inline int IPPROTO_TCP = @IPPROTO_TCP@;
+#pragma D binding "1.5" IPPROTO_EGP
+inline int IPPROTO_EGP = @IPPROTO_EGP@;
+#pragma D binding "1.5" IPPROTO_PUP
+inline int IPPROTO_PUP = @IPPROTO_PUP@;
+#pragma D binding "1.5" IPPROTO_UDP
+inline int IPPROTO_UDP = @IPPROTO_UDP@;
+#pragma D binding "1.5" IPPROTO_IDP
+inline int IPPROTO_IDP = @IPPROTO_IDP@;
+#pragma D binding "1.5" IPPROTO_IPV6
+inline int IPPROTO_IPV6 = @IPPROTO_IPV6@;
+#pragma D binding "1.5" IPPROTO_ROUTING
+inline int IPPROTO_ROUTING = @IPPROTO_ROUTING@;
+#pragma D binding "1.5" IPPROTO_FRAGMENT
+inline int IPPROTO_FRAGMENT = @IPPROTO_FRAGMENT@;
+#pragma D binding "1.5" IPPROTO_RSVP
+inline int IPPROTO_RSVP = @IPPROTO_RSVP@;
+#pragma D binding "1.5" IPPROTO_ESP
+inline int IPPROTO_ESP = @IPPROTO_ESP@;
+#pragma D binding "1.5" IPPROTO_AH
+inline int IPPROTO_AH = @IPPROTO_AH@;
+#pragma D binding "1.5" IPPROTO_ICMPV6
+inline int IPPROTO_ICMPV6 = @IPPROTO_ICMPV6@;
+#pragma D binding "1.5" IPPROTO_NONE
+inline int IPPROTO_NONE = @IPPROTO_NONE@;
+#pragma D binding "1.5" IPPROTO_DSTOPTS
+inline int IPPROTO_DSTOPTS = @IPPROTO_DSTOPTS@;
+#pragma D binding "1.5" IPPROTO_HELLO
+inline int IPPROTO_HELLO = @IPPROTO_HELLO@;
+#pragma D binding "1.5" IPPROTO_ND
+inline int IPPROTO_ND = @IPPROTO_ND@;
+#pragma D binding "1.5" IPPROTO_EON
+inline int IPPROTO_EON = @IPPROTO_EON@;
+#pragma D binding "1.5" IPPROTO_OSPF
+inline int IPPROTO_OSPF = @IPPROTO_OSPF@;
+#pragma D binding "1.5" IPPROTO_PIM
+inline int IPPROTO_PIM = @IPPROTO_PIM@;
+#pragma D binding "1.5" IPPROTO_SCTP
+inline int IPPROTO_SCTP = @IPPROTO_SCTP@;
+#pragma D binding "1.5" IPPROTO_RAW
+inline int IPPROTO_RAW = @IPPROTO_RAW@;
+#pragma D binding "1.5" IPPROTO_MAX
+inline int IPPROTO_MAX = @IPPROTO_MAX@;
+
+/*
+ * pktinfo is where packet ID info can be made available for deeper
+ * analysis if packet IDs become supported by the kernel in the future.
+ * The pkt_addr member is currently always NULL.
+ */
+typedef struct pktinfo {
+	uintptr_t pkt_addr;
+} pktinfo_t;
+
+/*
+ * csinfo is where connection state info is made available.
+ */
+typedef struct csinfo {
+	uintptr_t cs_addr;
+	uint64_t cs_cid;
+	pid_t cs_pid;
+	zoneid_t cs_zoneid;
+} csinfo_t;
+
+/*
+ * ipinfo contains common IP info for both IPv4 and IPv6.
+ */
+typedef struct ipinfo {
+	uint8_t ip_ver;			/* IP version (4, 6) */
+	uint32_t ip_plength;		/* payload length */
+	string ip_saddr;		/* source address */
+	string ip_daddr;		/* destination address */
+} ipinfo_t;
+
+/*
+ * ifinfo contains network interface info.
+ */
+typedef struct ifinfo {
+	string if_name;			/* interface name */
+	int8_t if_local;		/* is delivered locally */
+	netstackid_t if_ipstack;	/* ipstack ID */
+	uintptr_t if_addr;		/* pointer to raw ill_t */
+} ifinfo_t;
+
+/*
+ * ipv4info is a translated version of the IPv4 header (with raw pointer).
+ * These values are NULL if the packet is not IPv4.
+ */
+typedef struct ipv4info {
+	uint8_t ipv4_ver;		/* IP version (4) */
+	uint8_t ipv4_ihl;		/* header length, bytes */
+	uint8_t ipv4_tos;		/* type of service field */
+	uint16_t ipv4_length;		/* length (header + payload) */
+	uint16_t ipv4_ident;		/* identification */
+	uint8_t ipv4_flags;		/* IP flags */
+	uint16_t ipv4_offset;		/* fragment offset */
+	uint8_t ipv4_ttl;		/* time to live */
+	uint8_t ipv4_protocol;		/* next level protocol */
+	string ipv4_protostr;		/* next level protocol, as a string */
+	uint16_t ipv4_checksum;		/* header checksum */
+	ipaddr_t ipv4_src;		/* source address */
+	ipaddr_t ipv4_dst;		/* destination address */
+	string ipv4_saddr;		/* source address, string */
+	string ipv4_daddr;		/* destination address, string */
+	ipha_t *ipv4_hdr;		/* pointer to raw header */
+} ipv4info_t;
+
+/*
+ * ipv6info is a translated version of the IPv6 header (with raw pointer).
+ * These values are NULL if the packet is not IPv6.
+ */
+typedef struct ipv6info {
+	uint8_t ipv6_ver;		/* IP version (6) */
+	uint8_t ipv6_tclass;		/* traffic class */
+	uint32_t ipv6_flow;		/* flow label */
+	uint16_t ipv6_plen;		/* payload length */
+	uint8_t ipv6_nexthdr;		/* next header protocol */
+	string ipv6_nextstr;		/* next header protocol, as a string */
+	uint8_t ipv6_hlim;		/* hop limit */
+	in6_addr_t *ipv6_src;		/* source address */
+	in6_addr_t *ipv6_dst;		/* destination address */
+	string ipv6_saddr;		/* source address, string */
+	string ipv6_daddr;		/* destination address, string */
+	ip6_t *ipv6_hdr;		/* pointer to raw header */
+} ipv6info_t;
+
+/*
+ * void_ip_t is a void pointer to either an IPv4 or IPv6 header.  It has
+ * its own type name so that a translator can be determined.
+ */
+typedef uintptr_t void_ip_t;
+
+/*
+ * __dtrace_ipsr_ill_t is used by the translator to take an ill_t plus an
+ * additional arg6 from the ip:::send and ip:::recieve probes, and translate
+ * them to an ifinfo_t.
+ */
+typedef ill_t __dtrace_ipsr_ill_t;
+
+/*
+ * __dtrace_tcp_void_ip_t is used by the translator to take either the
+ * non-NULL void_ip_t * passed in or, if it is NULL, uses arg3 (tcp_t *)
+ * from the tcp:::send and tcp:::recieve probes to translate to an ipinfo_t.
+ * When no headers are available in the TCP fusion case for tcp:::send
+ * and tcp:::receive case, this allows us to present the consumer with header
+ * data based on the tcp_t * content in order to hide the implementation
+ * details of TCP fusion.
+ */
+typedef void * __dtrace_tcp_void_ip_t;
+
+#pragma D binding "1.5" translator
+translator pktinfo_t < mblk_t *M > {
+	pkt_addr = NULL;
+};
+
+#pragma D binding "1.5" translator
+translator csinfo_t < conn_t *C > {
+	cs_addr = NULL;
+};
+
+#pragma D binding "1.6.3" translator
+translator csinfo_t < ip_xmit_attr_t *C > {
+	cs_addr = (uintptr_t)C;
+	cs_cid = C ? C->ixa_conn_id : NULL;
+	cs_pid = C ? C->ixa_cpid : -1;
+	cs_zoneid = C ?
+	    (C->ixa_ipst == NULL || C->ixa_ipst->ips_netstack == NULL ||
+	    C->ixa_ipst->ips_netstack->netstack_stackid ==
+	    @GLOBAL_NETSTACKID@ ||
+	    C->ixa_cred == NULL ||
+	    C->ixa_cred->cr_zone == NULL ||
+	    C->ixa_cred->cr_uid == -1 ?
+	    C->ixa_zoneid : C->ixa_cred->cr_zone->zone_id) : -1;
+};
+
+#pragma D binding "1.5" translator
+translator ipinfo_t < ipha_t *I > {
+	ip_ver = I->ipha_version_and_hdr_length >> 4;
+	ip_plength = ntohs(I->ipha_length) -
+	    ((I->ipha_version_and_hdr_length & 0xf) << 2);
+	ip_saddr = inet_ntoa(&I->ipha_src);
+	ip_daddr = inet_ntoa(&I->ipha_dst);
+};
+
+#pragma D binding "1.5" translator
+translator ipinfo_t < ip6_t *I > {
+	ip_ver = *(uint8_t *)I >> 4;
+	ip_plength = ntohs(I->ip6_ctlun.ip6_un1.ip6_un1_plen);
+	ip_saddr = inet_ntoa6(&I->ip6_src);
+	ip_daddr = inet_ntoa6(&I->ip6_dst);
+};
+
+#pragma D binding "1.5" translator
+translator ipinfo_t < void_ip_t *I > {
+	ip_ver = I != NULL ? *(uint8_t *)I >> 4 : 0;
+	ip_plength = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
+	    ntohs(((ipha_t *)I)->ipha_length) -
+	    ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
+	    *(uint8_t *)I >> 4 == 6 ?
+	    ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0) : 0;
+	ip_saddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
+	    inet_ntoa(&((ipha_t *)I)->ipha_src) : *(uint8_t *)I >> 4 == 6 ?
+	    inet_ntoa6(&((ip6_t *)I)->ip6_src) : "<unknown>") : "<unknown>";
+	ip_daddr = I != NULL ? (*(uint8_t *)I >> 4 == 4 ?
+	    inet_ntoa(&((ipha_t *)I)->ipha_dst) : *(uint8_t *)I >> 4 == 6 ?
+	    inet_ntoa6(&((ip6_t *)I)->ip6_dst) : "<unknown>") : "<unknown>";
+};
+
+#pragma D binding "1.5" translator
+translator ifinfo_t < __dtrace_ipsr_ill_t *I > {
+	if_name = I != NULL ? stringof(I->ill_name) : "<null>";
+	if_ipstack = I != NULL ? I->ill_ipst->ips_netstack->netstack_stackid
+	    : 0;
+	if_local = arg6;		/* probe dependent */
+	if_addr = (uintptr_t)I;
+};
+
+/*
+ * Translate to an ipinfo_t * from either the non-NULL void_ip_t * passed in,
+ * or use arg3 (tcp_t *) to fabricate ip header info.
+ */
+#pragma D binding "1.6.3" translator
+translator ipinfo_t < __dtrace_tcp_void_ip_t *I > {
+	ip_ver = I != NULL ? *(uint8_t *)I >> 4 :
+	    arg3 != NULL ? ((tcp_t *)arg3)->tcp_connp->conn_ipversion : 0;
+	ip_plength =
+	    I != NULL && *(uint8_t *)I >> 4 == 4 ?
+	    ntohs(((ipha_t *)I)->ipha_length) -
+	    ((((ipha_t *)I)->ipha_version_and_hdr_length & 0xf) << 2) :
+	    I != NULL && *(uint8_t *)I >> 4 == 6 ?
+	    ntohs(((ip6_t *)I)->ip6_ctlun.ip6_un1.ip6_un1_plen) :
+	    I != NULL ? 0 :
+	    arg3 != NULL && probename == "send" ?
+	    ((tcp_t *)arg3)->tcp_last_sent_len + @TCP_MIN_HEADER_LENGTH@ :
+	    arg3 != NULL && probename == "receive" ?
+	    ((tcp_t *)arg3)->tcp_last_recv_len + @TCP_MIN_HEADER_LENGTH@ :
+	    0;
+	ip_saddr =
+	    I != NULL && *(uint8_t *)I >> 4 == 4 ?
+	    inet_ntoa(&((ipha_t *)I)->ipha_src) :
+	    I != NULL && *(uint8_t *)I >> 4 == 6 ?
+	    inet_ntoa6(&((ip6_t *)I)->ip6_src) :
+	    I != NULL ? "<unknown>" :
+	    arg3 != NULL && probename == "send" ?
+	    inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_laddr):
+	    arg3 != NULL && probename == "receive" ?
+	    inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_faddr):
+	    "<unknown>";
+	ip_daddr =
+	    I != NULL && *(uint8_t *)I >> 4 == 4 ?
+	    inet_ntoa(&((ipha_t *)I)->ipha_dst) :
+	    I != NULL && *(uint8_t *)I >> 4 == 6 ?
+	    inet_ntoa6(&((ip6_t *)I)->ip6_dst) :
+	    I != NULL ? "<unknown>" :
+	    arg3 != NULL && probename == "send" ?
+	    inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_faddr):
+	    arg3 != NULL && probename == "receive" ?
+	    inet_ntoa6(&((tcp_t *)arg3)->tcp_connp->connua_v6addr.connua_laddr):
+	    "<unknown>";
+};
+
+#pragma D binding "1.5" translator
+translator ipv4info_t < ipha_t *I > {
+	ipv4_ver = I != NULL ? I->ipha_version_and_hdr_length >> 4 : 0;
+	ipv4_ihl = I != NULL ? (I->ipha_version_and_hdr_length & 0xf) << 2 : 0;
+	ipv4_tos = I != NULL ? I->ipha_type_of_service : 0;
+	ipv4_length = I != NULL ? ntohs(I->ipha_length) : 0;
+	ipv4_ident = I != NULL ? ntohs(I->ipha_ident) : 0;
+	ipv4_flags = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) >>
+	    12 : 0;
+	ipv4_offset = I != NULL ? ntohs(I->ipha_fragment_offset_and_flags) &
+	    0x0fff : 0;
+	ipv4_ttl = I != NULL ? I->ipha_ttl : 0;
+	ipv4_protocol = I != NULL ? I->ipha_protocol : 0;
+	ipv4_protostr = I == NULL ? "<null>" :
+	    I->ipha_protocol == IPPROTO_TCP     ? "TCP"    :
+	    I->ipha_protocol == IPPROTO_UDP     ? "UDP"    :
+	    I->ipha_protocol == IPPROTO_IP      ? "IP"     :
+	    I->ipha_protocol == IPPROTO_ICMP    ? "ICMP"   :
+	    I->ipha_protocol == IPPROTO_IGMP    ? "IGMP"   :
+	    I->ipha_protocol == IPPROTO_EGP     ? "EGP"    :
+	    I->ipha_protocol == IPPROTO_IPV6    ? "IPv6"   :
+	    I->ipha_protocol == IPPROTO_ROUTING ? "ROUTE"  :
+	    I->ipha_protocol == IPPROTO_ESP     ? "ESP"    :
+	    I->ipha_protocol == IPPROTO_AH      ? "AH"     :
+	    I->ipha_protocol == IPPROTO_ICMPV6  ? "ICMPv6" :
+	    I->ipha_protocol == IPPROTO_OSPF    ? "OSPF"   :
+	    I->ipha_protocol == IPPROTO_SCTP    ? "SCTP"   :
+	    I->ipha_protocol == IPPROTO_RAW     ? "RAW"    :
+	    lltostr((uint64_t)I->ipha_protocol);
+	ipv4_checksum = I != NULL ? ntohs(I->ipha_hdr_checksum) : 0;
+	ipv4_src = I != NULL ? I->ipha_src : 0;
+	ipv4_dst = I != NULL ? I->ipha_dst : 0;
+	ipv4_saddr = I != NULL ? inet_ntoa(&I->ipha_src) : "<null>";
+	ipv4_daddr = I != NULL ? inet_ntoa(&I->ipha_dst) : "<null>";
+	ipv4_hdr = I;
+};
+
+#pragma D binding "1.5" translator
+translator ipv6info_t < ip6_t *I > {
+	ipv6_ver = I != NULL ? I->ip6_ctlun.ip6_un2_vfc >> 4 : 0;
+	ipv6_tclass = I != NULL ? ((I->ip6_ctlun.ip6_un1.ip6_un1_flow &&
+	    0x0fffffff) >> 20) : 0;
+	ipv6_flow = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_flow &&
+	    0x000fffff : 0;
+	ipv6_plen = I != NULL ? ntohs(I->ip6_ctlun.ip6_un1.ip6_un1_plen) : 0;
+	ipv6_nexthdr = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_nxt : 0;
+	ipv6_nextstr = I == NULL ? "<null>" :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_TCP     ? "TCP"    :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_UDP     ? "UDP"    :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IP      ? "IP"     :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ICMP    ? "ICMP"   :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IGMP    ? "IGMP"   :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_EGP     ? "EGP"    :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_IPV6    ? "IPv6"   :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ROUTING ? "ROUTE"  :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ESP     ? "ESP"    :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_AH      ? "AH"     :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_ICMPV6  ? "ICMPv6" :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_OSPF    ? "OSPF"   :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_SCTP    ? "SCTP"   :
+	    I->ip6_ctlun.ip6_un1.ip6_un1_nxt == IPPROTO_RAW     ? "RAW"    :
+	    lltostr((uint64_t)I->ip6_ctlun.ip6_un1.ip6_un1_nxt);
+	ipv6_hlim = I != NULL ? I->ip6_ctlun.ip6_un1.ip6_un1_hlim : 0;
+	ipv6_src = I != NULL ? &I->ip6_src : 0;
+	ipv6_dst = I != NULL ? &I->ip6_dst : 0;
+	ipv6_saddr = I != NULL ? inet_ntoa6(&I->ip6_src) : "<null>";
+	ipv6_daddr = I != NULL ? inet_ntoa6(&I->ip6_dst) : "<null>";
+	ipv6_hdr = I;
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/ip.sed.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/ip.sed.in
new file mode 100644
index 0000000..5d514e3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/ip.sed.in
@@ -0,0 +1,78 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/*
+ * This file is a sed script which is first preprocessed by cpp or cc -E to
+ * define a set of sed directives which replace #define tokens with their
+ * values.  After preprocessing, the sed script is run over ip.d.in to
+ * replace the #define tokens listed below to create the finished ip.d.
+ * Refer to the rules in libdtrace/Makefile.com for more information.
+ */
+
+#include <sys/netstack.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <inet/ip.h>
+#include <inet/tcp.h>
+
+#define	SED_REPLACE(x)	s/#x/x/g
+
+SED_REPLACE(AF_INET)
+SED_REPLACE(AF_INET6)
+
+SED_REPLACE(IPH_DF)
+SED_REPLACE(IPH_MF)
+
+SED_REPLACE(IPPROTO_IP)
+SED_REPLACE(IPPROTO_HOPOPTS)
+SED_REPLACE(IPPROTO_ICMP)
+SED_REPLACE(IPPROTO_IGMP)
+SED_REPLACE(IPPROTO_GGP)
+SED_REPLACE(IPPROTO_ENCAP)
+SED_REPLACE(IPPROTO_TCP)
+SED_REPLACE(IPPROTO_EGP)
+SED_REPLACE(IPPROTO_PUP)
+SED_REPLACE(IPPROTO_UDP)
+SED_REPLACE(IPPROTO_IDP)
+SED_REPLACE(IPPROTO_IPV6)
+SED_REPLACE(IPPROTO_ROUTING)
+SED_REPLACE(IPPROTO_FRAGMENT)
+SED_REPLACE(IPPROTO_RSVP)
+SED_REPLACE(IPPROTO_ESP)
+SED_REPLACE(IPPROTO_AH)
+SED_REPLACE(IPPROTO_ICMPV6)
+SED_REPLACE(IPPROTO_NONE)
+SED_REPLACE(IPPROTO_DSTOPTS)
+SED_REPLACE(IPPROTO_HELLO)
+SED_REPLACE(IPPROTO_ND)
+SED_REPLACE(IPPROTO_EON)
+SED_REPLACE(IPPROTO_OSPF)
+SED_REPLACE(IPPROTO_PIM)
+SED_REPLACE(IPPROTO_SCTP)
+SED_REPLACE(IPPROTO_RAW)
+SED_REPLACE(IPPROTO_MAX)
+
+SED_REPLACE(TCP_MIN_HEADER_LENGTH)
+
+SED_REPLACE(GLOBAL_NETSTACKID)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/iscsit.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/iscsit.d
new file mode 100644
index 0000000..fba5e20
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/iscsit.d
@@ -0,0 +1,454 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma D depends_on library ip.d
+#pragma D depends_on library net.d	/* conninfo_t */
+#pragma D depends_on library scsi.d	/* scsicmd_t and iscsiinfo_t */
+#pragma D depends_on module genunix
+#pragma D depends_on module iscsit
+#pragma D depends_on module idm
+
+#pragma D binding "1.5" translator
+translator conninfo_t < idm_conn_t *P > {
+	ci_local = (P->ic_laddr.ss_family == AF_INET) ?
+	    inet_ntoa((ipaddr_t *)
+	    &((struct sockaddr_in *)&P->ic_laddr)->sin_addr) :
+	    inet_ntoa6(&((struct sockaddr_in6 *)&P->ic_laddr)->sin6_addr);
+
+	ci_remote = (P->ic_raddr.ss_family == AF_INET) ?
+	    inet_ntoa((ipaddr_t *)
+	    &((struct sockaddr_in *)&P->ic_raddr)->sin_addr) :
+	    inet_ntoa6(&((struct sockaddr_in6 *)&P->ic_raddr)->sin6_addr);
+
+	ci_protocol = (P->ic_laddr.ss_family == AF_INET) ? "ipv4" : "ipv6";
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_async_evt_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = (((uint64_t)P->lun[0] << (64 - 0*8 - 8)) +
+            ((uint64_t)P->lun[1] << (64 - 1*8 - 8)) +
+            ((uint64_t)P->lun[2] << (64 - 2*8 - 8)) +
+            ((uint64_t)P->lun[3] << (64 - 3*8 - 8)) +
+            ((uint64_t)P->lun[4] << (64 - 4*8 - 8)) +
+            ((uint64_t)P->lun[5] << (64 - 5*8 - 8)) +
+            ((uint64_t)P->lun[6] << (64 - 6*8 - 8)) +
+            ((uint64_t)P->lun[7] << (64 - 7*8 - 8)));
+	ii_itt = 0;
+	ii_ttt = 0;
+	ii_cmdsn = 0;
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_login_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = 0xffffffff;
+	ii_cmdsn = ntohl(P->cmdsn);
+	ii_statsn = ntohl(P->expstatsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_login_rsp_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = 0xffffffff;
+	ii_cmdsn = ntohl(P->expcmdsn);
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_logout_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = 0xffffffff;
+	ii_cmdsn = ntohl(P->cmdsn);
+	ii_statsn = ntohl(P->expstatsn);
+	ii_datasn = 0;
+	ii_datalen = 0;
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_logout_rsp_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = 0xffffffff;
+	ii_cmdsn = 0;
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = 0;
+	ii_datalen = 0;
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_rtt_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->ttt);
+	ii_cmdsn = ntohl(P->expcmdsn);
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = ntohl(P->rttsn);
+	ii_datalen = 0;
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_data_rsp_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = (((uint64_t)P->lun[0] << (64 - 0*8 - 8)) +
+	    ((uint64_t)P->lun[1] << (64 - 1*8 - 8)) +
+            ((uint64_t)P->lun[2] << (64 - 2*8 - 8)) +
+            ((uint64_t)P->lun[3] << (64 - 3*8 - 8)) +
+            ((uint64_t)P->lun[4] << (64 - 4*8 - 8)) +
+            ((uint64_t)P->lun[5] << (64 - 5*8 - 8)) +
+            ((uint64_t)P->lun[6] << (64 - 6*8 - 8)) +
+            ((uint64_t)P->lun[7] << (64 - 7*8 - 8)));
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->ttt);
+	ii_cmdsn = ntohl(P->expcmdsn);
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = ntohl(P->datasn);
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_data_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = (((uint64_t)P->lun[0] << (64 - 0*8 - 8)) +
+            ((uint64_t)P->lun[1] << (64 - 1*8 - 8)) +
+            ((uint64_t)P->lun[2] << (64 - 2*8 - 8)) +
+            ((uint64_t)P->lun[3] << (64 - 3*8 - 8)) +
+            ((uint64_t)P->lun[4] << (64 - 4*8 - 8)) +
+            ((uint64_t)P->lun[5] << (64 - 5*8 - 8)) +
+            ((uint64_t)P->lun[6] << (64 - 6*8 - 8)) +
+            ((uint64_t)P->lun[7] << (64 - 7*8 - 8)));
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->ttt);
+	ii_cmdsn = 0;
+	ii_statsn = ntohl(P->expstatsn);
+	ii_datasn = ntohl(P->datasn);
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_nop_in_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = (((uint64_t)P->lun[0] << (64 - 0*8 - 8)) +
+            ((uint64_t)P->lun[1] << (64 - 1*8 - 8)) +
+            ((uint64_t)P->lun[2] << (64 - 2*8 - 8)) +
+            ((uint64_t)P->lun[3] << (64 - 3*8 - 8)) +
+            ((uint64_t)P->lun[4] << (64 - 4*8 - 8)) +
+            ((uint64_t)P->lun[5] << (64 - 5*8 - 8)) +
+            ((uint64_t)P->lun[6] << (64 - 6*8 - 8)) +
+            ((uint64_t)P->lun[7] << (64 - 7*8 - 8)));
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->ttt);
+	ii_cmdsn = ntohl(P->expcmdsn);
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_nop_out_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = (((uint64_t)P->lun[0] << (64 - 0*8 - 8)) +
+            ((uint64_t)P->lun[1] << (64 - 1*8 - 8)) +
+            ((uint64_t)P->lun[2] << (64 - 2*8 - 8)) +
+            ((uint64_t)P->lun[3] << (64 - 3*8 - 8)) +
+            ((uint64_t)P->lun[4] << (64 - 4*8 - 8)) +
+            ((uint64_t)P->lun[5] << (64 - 5*8 - 8)) +
+            ((uint64_t)P->lun[6] << (64 - 6*8 - 8)) +
+            ((uint64_t)P->lun[7] << (64 - 7*8 - 8)));
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->ttt);
+	ii_cmdsn = ntohl(P->cmdsn);
+	ii_statsn = ntohl(P->expstatsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_scsi_cmd_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = (((uint64_t)P->lun[0] << (64 - 0*8 - 8)) +
+            ((uint64_t)P->lun[1] << (64 - 1*8 - 8)) +
+            ((uint64_t)P->lun[2] << (64 - 2*8 - 8)) +
+            ((uint64_t)P->lun[3] << (64 - 3*8 - 8)) +
+            ((uint64_t)P->lun[4] << (64 - 4*8 - 8)) +
+            ((uint64_t)P->lun[5] << (64 - 5*8 - 8)) +
+            ((uint64_t)P->lun[6] << (64 - 6*8 - 8)) +
+            ((uint64_t)P->lun[7] << (64 - 7*8 - 8)));
+	ii_itt = ntohl(P->itt);
+	ii_ttt = 0xffffffff;
+	ii_cmdsn = ntohl(P->cmdsn);
+	ii_statsn = ntohl(P->expstatsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_scsi_rsp_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = 0xffffffff;
+	ii_cmdsn = ntohl(P->expcmdsn);
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = ntohl(P->expdatasn);
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_scsi_task_mgt_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = (((uint64_t)P->lun[0] << (64 - 0*8 - 8)) +
+            ((uint64_t)P->lun[1] << (64 - 1*8 - 8)) +
+            ((uint64_t)P->lun[2] << (64 - 2*8 - 8)) +
+            ((uint64_t)P->lun[3] << (64 - 3*8 - 8)) +
+            ((uint64_t)P->lun[4] << (64 - 4*8 - 8)) +
+            ((uint64_t)P->lun[5] << (64 - 5*8 - 8)) +
+            ((uint64_t)P->lun[6] << (64 - 6*8 - 8)) +
+            ((uint64_t)P->lun[7] << (64 - 7*8 - 8)));
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->rtt); 
+	ii_cmdsn = ntohl(P->cmdsn);
+	ii_statsn = ntohl(P->expstatsn);
+	ii_datasn = 0;
+	ii_datalen = 0;
+	ii_flags = 0;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_scsi_task_mgt_rsp_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->rtt);
+	ii_cmdsn = ntohl(P->expcmdsn);
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_text_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->ttt);
+	ii_cmdsn = ntohl(P->cmdsn);
+	ii_statsn = ntohl(P->expstatsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < iscsi_text_rsp_hdr_t *P > {
+	ii_initiator = ((idm_conn_t *)arg0)->ic_initiator_name;
+	ii_target = ((idm_conn_t *)arg0)->ic_target_name;
+	ii_isid = ((idm_conn_t *)arg0)->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (((idm_conn_t *)arg0)->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0; /* NA */
+	ii_itt = ntohl(P->itt);
+	ii_ttt = ntohl(P->ttt);
+	ii_cmdsn = ntohl(P->expcmdsn);
+	ii_statsn = ntohl(P->statsn);
+	ii_datasn = 0;
+	ii_datalen = P->dlength[0] << 16 | P->dlength[1] << 8 | P->dlength[2];
+	ii_flags = P->flags;
+};
+
+#pragma D binding "1.5" translator
+translator iscsiinfo_t < idm_conn_t *P > {
+	ii_initiator = P->ic_initiator_name;
+	ii_target = P->ic_target_name;
+	ii_isid = P->ic_isid;
+	ii_tsih = ((idm_conn_t *)arg0)->ic_tsih;
+	ii_transport = (P->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_ISER) ? "iser-ib" :
+	    (P->ic_transport_type ==
+	    IDM_TRANSPORT_TYPE_SOCKETS) ? "sockets" : "Unknown";
+	ii_lun = 0;
+	ii_itt = 0;
+	ii_ttt = 0;
+	ii_cmdsn = 0;
+	ii_statsn = 0;
+	ii_datasn = 0;
+	ii_datalen = 0;
+	ii_flags = 0;
+};
+
+#pragma D binding "1.5" translator
+translator xferinfo_t < uintptr_t P > {
+	xfer_laddr = (arg1 == NULL) ? 0xffffffff : (uintptr_t)arg1;
+	xfer_loffset = arg2;
+	xfer_lkey = 0; /* not used */
+	xfer_len = arg6;
+	xfer_raddr = arg3;
+	xfer_roffset = arg4;
+	xfer_rkey = arg5;
+	xfer_type = arg7;
+};
+
+inline int IDM_TRANSPORT_TYPE_ISER = 0;
+#pragma D binding "1.5" IDM_TRANSPORT_TYPE_ISER
+inline int IDM_TRANSPORT_TYPE_SOCKETS = 1;
+#pragma D binding "1.5" IDM_TRANSPORT_TYPE_SOCKETS
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/llib-ldtrace b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/llib-ldtrace
new file mode 100644
index 0000000..313e78c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/llib-ldtrace
@@ -0,0 +1,32 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*LINTLIBRARY*/
+/*PROTOLIB1*/
+
+#include <dtrace.h>
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mapfile-vers b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mapfile-vers
new file mode 100644
index 0000000..c46ac0a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mapfile-vers
@@ -0,0 +1,127 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# MAPFILE HEADER START
+#
+# WARNING:  STOP NOW.  DO NOT MODIFY THIS FILE.
+# Object versioning must comply with the rules detailed in
+#
+#	usr/src/lib/README.mapfiles
+#
+# You should not be making modifications here until you've read the most current
+# copy of that file. If you need help, contact a gatekeeper for guidance.
+#
+# MAPFILE HEADER END
+#
+
+$mapfile_version 2
+
+SYMBOL_VERSION SUNWprivate_1.1 {
+    global:
+	dtrace_addr2str;
+	dtrace_aggregate_clear;
+	dtrace_aggregate_print;
+	dtrace_aggregate_snap;
+	dtrace_aggregate_walk;
+	dtrace_aggregate_walk_joined;
+	dtrace_aggregate_walk_keyrevsorted;
+	dtrace_aggregate_walk_keysorted;
+	dtrace_aggregate_walk_keyvarrevsorted;
+	dtrace_aggregate_walk_keyvarsorted;
+	dtrace_aggregate_walk_valrevsorted;
+	dtrace_aggregate_walk_valsorted;
+	dtrace_aggregate_walk_valvarrevsorted;
+	dtrace_aggregate_walk_valvarsorted;
+	dtrace_attr2str;
+	dtrace_class_name;
+	dtrace_close;
+	dtrace_consume;
+	dtrace_ctlfd;
+	_dtrace_debug;
+	dtrace_desc2str;
+	dtrace_dof_create;
+	dtrace_dof_destroy;
+	dtrace_errmsg;
+	dtrace_errno;
+	dtrace_faultstr;
+	dtrace_fprinta;
+	dtrace_fprintf;
+	dtrace_geterr_dof;
+	dtrace_getopt;
+	dtrace_getopt_dof;
+	dtrace_go;
+	dtrace_handle_buffered;
+	dtrace_handle_drop;
+	dtrace_handle_err;
+	dtrace_handle_proc;
+	dtrace_handle_setopt;
+	dtrace_id2desc;
+	dtrace_lookup_by_addr;
+	dtrace_lookup_by_name;
+	dtrace_lookup_by_type;
+	dtrace_object_info;
+	dtrace_object_iter;
+	dtrace_open;
+	dtrace_printa_create;
+	dtrace_printf_create;
+	dtrace_printf_format;
+	dtrace_probe_info;
+	dtrace_probe_iter;
+	dtrace_proc_continue;
+	dtrace_proc_create;
+	dtrace_proc_grab;
+	dtrace_proc_release;
+	dtrace_program_exec;
+	dtrace_program_fcompile;
+	dtrace_program_header;
+	dtrace_program_info;
+	dtrace_program_link;
+	dtrace_program_strcompile;
+	dtrace_provider_modules;
+	dtrace_setopt;
+	dtrace_sleep;
+	dtrace_stability_name;
+	dtrace_status;
+	dtrace_stmt_action;
+	dtrace_stmt_add;
+	dtrace_stmt_create;
+	dtrace_stmt_destroy;
+	dtrace_stmt_iter;
+	dtrace_stop;
+	dtrace_str2attr;
+	dtrace_str2desc;
+	dtrace_subrstr;
+	dtrace_symbol_type;
+	dtrace_type_fcompile;
+	dtrace_type_strcompile;
+	dtrace_uaddr2str;
+	dtrace_update;
+	_dtrace_version;
+	dtrace_vopen;
+	dtrace_work;
+	dtrace_xstr2desc;
+    local:
+	*;
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrno.sh b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrno.sh
new file mode 100755
index 0000000..50b7f1c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrno.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+echo "\
+/*\n\
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.\n\
+ * Use is subject to license terms.\n\
+ */\n\
+\n\
+#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n"
+
+pattern='^#define[	 ]\(E[A-Z0-9]*\)[	 ]*\([A-Z0-9]*\).*$'
+replace='inline int \1 = \2;@#pragma D binding "1.0" \1'
+
+sed -n "s/$pattern/$replace/p" | tr '@' '\n'
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrtags.sed b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrtags.sed
new file mode 100644
index 0000000..2da2290
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrtags.sed
@@ -0,0 +1,33 @@
+#$Id: mkerrtags.sed $
+## @file
+# pure sed version of mkerrtags.sh.
+#
+
+1b heading
+$b footer
+s/^[[:space:]][[:space:]]*\(D_[A-Z0-9_]*\)\(,*\).*$/    "\1"\2/p
+b end
+
+
+:heading
+i\/* Autogenerated source file - DO NOT EDIT! */
+i\/*
+i\ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+i\ * Use is subject to license terms.
+i\ */
+i\#include <dt_errtags.h>
+i\static const char * const _dt_errtags[] = {
+b end
+
+:footer
+i\};
+i\const char *dt_errtag(dt_errtag_t tag)
+i\{
+i\    if ((unsigned)tag >= sizeof(_dt_errtags)/sizeof(_dt_errtags[0]))
+i\        return _dt_errtags[0];
+i\    return _dt_errtags[tag];
+i\}
+b end
+
+
+:end
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrtags.sh b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrtags.sh
new file mode 100755
index 0000000..5263fb6
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mkerrtags.sh
@@ -0,0 +1,61 @@
+#!/usr/bin/env kmk_ash
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+
+echo "\
+/*\n\
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.\n\
+ * Use is subject to license terms.\n\
+ */\n\
+\n\
+#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\
+\n\
+#include <dt_errtags.h>
+\n\
+static const char *const _dt_errtags[] = {"
+
+# WARNING: Tabs in expressions.
+#pattern='^	\(D_[A-Z0-9_]*\),*'
+#replace='	"\1",'
+#
+#sed -n "s/$pattern/$replace/p" || exit 1
+set -x
+kmk_sed --lang_c -n 's/^[[:space:]]*\(D_[A-Z0-9_]*\),*/	"\1",/p' $1 || exit 1
+
+echo "\
+};\n\
+\n\
+static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]);\n\
+\n\
+const char *
+dt_errtag(dt_errtag_t tag)
+{
+	return (_dt_errtags[(tag > 0 && tag < _dt_ntag) ? tag : 0]);
+}"
+
+exit 0
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mknames.sed b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mknames.sed
new file mode 100644
index 0000000..9c9efc4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mknames.sed
@@ -0,0 +1,37 @@
+#$Id: mknames.sed $
+## @file
+# pure sed version of mknames.sh.
+#
+
+1b heading
+$b footer
+/DIF_SUBR_MAX/b end
+s/^#[[:space:]]*define[[:space:]][[:space:]]*\(DIF_SUBR_[a-zA-Z0-9_]*\).*$/        case \1: \
+            return "\L\1";/p
+b end
+
+:heading
+i\/* Autogenerated source file - DO NOT EDIT! */
+i\/*
+i\ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+i\ * Use is subject to license terms.
+i\ */
+i\#include <dtrace.h>
+i\const char *dtrace_subrstr(dtrace_hdl_t *dtp, int subr)
+i\{
+i\    switch (subr)
+i\    {
+b end
+
+:footer
+i\        default:
+i\            return "unknown";
+i\    }
+i\}
+b end
+
+
+
+
+:end
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mknames.sh b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mknames.sh
new file mode 100755
index 0000000..7f90b7d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mknames.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+echo "\
+/*\n\
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.\n\
+ * Use is subject to license terms.\n\
+ */\n\
+\n\
+#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\
+\n\
+#include <dtrace.h>\n\
+\n\
+/*ARGSUSED*/
+const char *\n\
+dtrace_subrstr(dtrace_hdl_t *dtp, int subr)\n\
+{\n\
+	switch (subr) {"
+
+nawk '
+/^#define[ 	]*DIF_SUBR_/ && $2 != "DIF_SUBR_MAX" {
+	printf("\tcase %s: return (\"%s\");\n", $2, tolower(substr($2, 10)));
+}'
+
+echo "\
+	default: return (\"unknown\");\n\
+	}\n\
+}"
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mksignal.sh b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mksignal.sh
new file mode 100755
index 0000000..1bffa64
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/mksignal.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+echo "\
+/*\n\
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.\n\
+ * Use is subject to license terms.\n\
+ */\n\
+\n\
+#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n"
+
+pattern='^#define[	 ]*_*\(SIG[A-Z0-9]*\)[	 ]\{1,\}\([A-Z0-9]*\).*$'
+replace='inline int \1 = \2;@#pragma D binding "1.0" \1'
+
+sed -n "s/$pattern/$replace/p;/SIGRTMAX/q" | tr '@' '\n'
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/net.d.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/net.d.in
new file mode 100644
index 0000000..be7343a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/net.d.in
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+inline int AF_INET = @AF_INET@;
+#pragma D binding "1.0" AF_INET
+inline int AF_INET6 = @AF_INET6@;
+#pragma D binding "1.0" AF_INET6
+
+/*
+ * The conninfo_t structure should be used by all application protocol
+ * providers as the first arguments to indicate some basic information
+ * about the connection. This structure may be augmented to accomodate
+ * the particularities of additional protocols in the future.
+ */
+typedef struct conninfo {
+	string ci_local;	/* local host address */
+	string ci_remote;	/* remote host address */
+	string ci_protocol;	/* protocol (ipv4, ipv6, etc) */
+} conninfo_t;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/net.sed.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/net.sed.in
new file mode 100644
index 0000000..68c6e1c
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/net.sed.in
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * This file is a sed script which is first preprocessed by cpp or cc -E to
+ * define a set of sed directives which replace #define tokens with their
+ * values.  After preprocessing, the sed script is run over net.d.in to
+ * replace the #define tokens listed below to create the finished net.d.
+ * Refer to the rules in libdtrace/Makefile.com for more information.
+ */
+
+#include <sys/socket.h>
+
+#define	SED_REPLACE(x)	s/#x/x/g
+
+SED_REPLACE(AF_INET)
+SED_REPLACE(AF_INET6)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/nfs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/nfs.d
new file mode 100644
index 0000000..c1552fd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/nfs.d
@@ -0,0 +1,138 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	D depends_on library ip.d
+#pragma	D depends_on library net.d
+#pragma	D depends_on module genunix
+
+inline int T_RDMA = 4;
+#pragma D binding "1.5" T_RDMA
+
+typedef struct nfsv4opinfo {
+	uint64_t noi_xid;	/* unique transation ID */
+	cred_t *noi_cred;	/* credentials for operation */
+	string noi_curpath;	/* current file handle path (if any) */
+} nfsv4opinfo_t;
+
+typedef struct nfsv4cbinfo {
+	string nci_curpath;	/* current file handle path (if any) */
+} nfsv4cbinfo_t;
+
+#pragma D binding "1.5" translator
+translator conninfo_t < struct svc_req *P > {
+	ci_protocol = P->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" :
+	    P->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" :
+	    P->rq_xprt->xp_xpc.xpc_netid == "udp" ? "ipv4" :
+	    P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" :
+	    P->rq_xprt->xp_xpc.xpc_netid == "udp6" ? "ipv6" :
+	    "<unknown>";
+
+	ci_local = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" ||
+	    P->rq_xprt->xp_xpc.xpc_netid == "udp") ?
+	    inet_ntoa(&((struct sockaddr_in *)
+	    P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) :
+	    (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ||
+	    P->rq_xprt->xp_xpc.xpc_netid == "udp6") ?
+	    inet_ntoa6(&((struct sockaddr_in6 *)
+	    P->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) :
+	    "unknown";
+
+	ci_remote = (P->rq_xprt->xp_xpc.xpc_netid == "tcp" ||
+	    P->rq_xprt->xp_xpc.xpc_netid == "udp") ?
+	    inet_ntoa(&((struct sockaddr_in *)
+	    P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) :
+	    (P->rq_xprt->xp_xpc.xpc_netid == "tcp6" ||
+	    P->rq_xprt->xp_xpc.xpc_netid == "udp6") ?
+	    inet_ntoa6(&((struct sockaddr_in6 *)
+	    P->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) :
+	    "unknown";
+};
+
+#pragma D binding "1.5" translator
+translator conninfo_t < struct compound_state *P > {
+	ci_protocol = P->req->rq_xprt->xp_xpc.xpc_type == T_RDMA ? "rdma" :
+	    P->req->rq_xprt->xp_xpc.xpc_netid == "tcp" ? "ipv4" :
+	    P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6" ? "ipv6" :
+	    "<unknown>";
+
+	ci_local = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ?
+	    inet_ntoa(&((struct sockaddr_in *)
+	    P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin_addr.S_un.S_addr) :
+	    (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ?
+	    inet_ntoa6(&((struct sockaddr_in6 *)
+	    P->req->rq_xprt->xp_xpc.xpc_lcladdr.buf)->sin6_addr) :
+	    "unknown";
+
+	ci_remote = (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp") ?
+	    inet_ntoa(&((struct sockaddr_in *)
+	    P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin_addr.S_un.S_addr) :
+	    (P->req->rq_xprt->xp_xpc.xpc_netid == "tcp6") ?
+	    inet_ntoa6(&((struct sockaddr_in6 *)
+	    P->req->rq_xprt->xp_xpc.xpc_rtaddr.buf)->sin6_addr) :
+	    "unknown";
+
+};
+
+#pragma D binding "1.5" translator
+translator nfsv4opinfo_t < struct compound_state *P > {
+	noi_xid = P->req->rq_xprt->xp_xid;
+	noi_cred = P->basecr;
+	noi_curpath = (P->vp == NULL) ? "<unknown>" : P->vp->v_path;
+};
+
+#pragma D binding "1.5" translator
+translator conninfo_t < rfs4_client_t *P > {
+	ci_protocol = (P->rc_addr.ss_family == AF_INET) ? "ipv4" : "ipv6";
+
+	ci_local = "<unknown>";
+
+	ci_remote = (P->rc_addr.ss_family == AF_INET) ?
+	    inet_ntoa((ipaddr_t *)
+	    &((struct sockaddr_in *)&P->rc_addr)->sin_addr) :
+	    inet_ntoa6(&((struct sockaddr_in6 *)&P->rc_addr)->sin6_addr);
+};
+
+#pragma D binding "1.5" translator
+translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > {
+	nci_curpath = (P->rds_finfo->rf_vp == NULL) ? "<unknown>" :
+	    P->rds_finfo->rf_vp->v_path;
+};
+
+typedef struct nfsv3opinfo {
+	uint64_t noi_xid;	/* unique transation ID */
+	cred_t *noi_cred;	/* credentials for operation */
+	string noi_curpath;	/* current file handle path (if any) */
+} nfsv3opinfo_t;
+
+typedef struct nfsv3oparg nfsv3oparg_t;
+
+#pragma D binding "1.5" translator
+translator nfsv3opinfo_t < nfsv3oparg_t *P > {
+	noi_xid = ((struct svc_req *)arg0)->rq_xprt->xp_xid;
+	noi_cred = (cred_t *)arg1;
+	noi_curpath = (arg2 == 0 || ((vnode_t *)arg2)->v_path == NULL) ?
+	    "<unknown>" : ((vnode_t *)arg2)->v_path;
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/procfs.d.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/procfs.d.in
new file mode 100644
index 0000000..9381e1e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/procfs.d.in
@@ -0,0 +1,365 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * This file defines the standard set of inlines and translators to be made
+ * available for all D programs to use to examine process model state.
+ */
+
+#pragma D depends_on module procfs
+
+/*
+ * The following miscellaneous constants are used by the proc(4) translators
+ * defined below.  These are assigned the latest values from the system .h's.
+ */
+inline char SSLEEP = @SSLEEP@;
+#pragma D binding "1.0" SSLEEP
+inline char SRUN = @SRUN@;
+#pragma D binding "1.0" SRUN
+inline char SZOMB = @SZOMB@;
+#pragma D binding "1.0" SZOMB
+inline char SSTOP = @SSTOP@;
+#pragma D binding "1.0" SSTOP
+inline char SIDL = @SIDL@;
+#pragma D binding "1.0" SIDL
+inline char SONPROC = @SONPROC@;
+#pragma D binding "1.0" SONPROC
+inline char SWAIT = @SWAIT@;
+#pragma D binding "1.0" SWAIT
+
+inline int PR_STOPPED = @PR_STOPPED@;
+#pragma D binding "1.0" PR_STOPPED
+inline int PR_ISTOP = @PR_ISTOP@;
+#pragma D binding "1.0" PR_ISTOP
+inline int PR_DSTOP = @PR_DSTOP@;
+#pragma D binding "1.0" PR_DSTOP
+inline int PR_STEP = @PR_STEP@;
+#pragma D binding "1.0" PR_STEP
+inline int PR_ASLEEP = @PR_ASLEEP@;
+#pragma D binding "1.0" PR_ASLEEP
+inline int PR_PCINVAL = @PR_PCINVAL@;
+#pragma D binding "1.0" PR_PCINVAL
+inline int PR_ASLWP = @PR_ASLWP@;
+#pragma D binding "1.0" PR_ASLWP
+inline int PR_AGENT = @PR_AGENT@;
+#pragma D binding "1.0" PR_AGENT
+inline int PR_DETACH = @PR_DETACH@;
+#pragma D binding "1.0" PR_DETACH
+inline int PR_DAEMON = @PR_DAEMON@;
+#pragma D binding "1.0" PR_DAEMON
+inline int PR_IDLE = @PR_IDLE@;
+#pragma D binding "1.4" PR_IDLE
+inline int PR_ISSYS = @PR_ISSYS@;
+#pragma D binding "1.0" PR_ISSYS
+inline int PR_VFORKP = @PR_VFORKP@;
+#pragma D binding "1.0" PR_VFORKP
+inline int PR_ORPHAN = @PR_ORPHAN@;
+#pragma D binding "1.0" PR_ORPHAN
+inline int PR_NOSIGCHLD = @PR_NOSIGCHLD@;
+#pragma D binding "1.4" PR_NOSIGCHLD
+inline int PR_WAITPID = @PR_WAITPID@;
+#pragma D binding "1.4" PR_WAITPID
+inline int PR_FORK = @PR_FORK@;
+#pragma D binding "1.0" PR_FORK
+inline int PR_RLC = @PR_RLC@;
+#pragma D binding "1.0" PR_RLC
+inline int PR_KLC = @PR_KLC@;
+#pragma D binding "1.0" PR_KLC
+inline int PR_ASYNC = @PR_ASYNC@;
+#pragma D binding "1.0" PR_ASYNC
+inline int PR_MSACCT = @PR_MSACCT@;
+#pragma D binding "1.0" PR_MSACCT
+inline int PR_BPTADJ = @PR_BPTADJ@;
+#pragma D binding "1.0" PR_BPTADJ
+inline int PR_PTRACE = @PR_PTRACE@;
+#pragma D binding "1.0" PR_PTRACE
+inline int PR_MSFORK = @PR_MSFORK@;
+#pragma D binding "1.0" PR_MSFORK
+
+inline char PR_MODEL_ILP32 = @PR_MODEL_ILP32@;
+#pragma D binding "1.0" PR_MODEL_ILP32
+inline char PR_MODEL_LP64 = @PR_MODEL_LP64@;
+#pragma D binding "1.0" PR_MODEL_LP64
+
+inline char SOBJ_NONE = @SOBJ_NONE@;
+#pragma D binding "1.0" SOBJ_NONE
+inline char SOBJ_MUTEX = @SOBJ_MUTEX@;
+#pragma D binding "1.0" SOBJ_MUTEX
+inline char SOBJ_RWLOCK = @SOBJ_RWLOCK@;
+#pragma D binding "1.0" SOBJ_RWLOCK
+inline char SOBJ_CV = @SOBJ_CV@;
+#pragma D binding "1.0" SOBJ_CV
+inline char SOBJ_SEMA = @SOBJ_SEMA@;
+#pragma D binding "1.0" SOBJ_SEMA
+inline char SOBJ_USER = @SOBJ_USER@;
+#pragma D binding "1.0" SOBJ_USER
+inline char SOBJ_USER_PI = @SOBJ_USER_PI@;
+#pragma D binding "1.0" SOBJ_USER_PI
+inline char SOBJ_SHUTTLE = @SOBJ_SHUTTLE@;
+#pragma D binding "1.0" SOBJ_SHUTTLE
+
+inline int SI_USER = @SI_USER@;
+#pragma D binding "1.0" SI_USER
+inline int SI_LWP = @SI_LWP@;
+#pragma D binding "1.0" SI_LWP
+inline int SI_QUEUE = @SI_QUEUE@;
+#pragma D binding "1.0" SI_QUEUE
+inline int SI_TIMER = @SI_TIMER@;
+#pragma D binding "1.0" SI_TIMER
+inline int SI_ASYNCIO = @SI_ASYNCIO@;
+#pragma D binding "1.0" SI_ASYNCIO
+inline int SI_MESGQ = @SI_MESGQ@;
+#pragma D binding "1.0" SI_MESGQ
+inline int SI_RCTL = @SI_RCTL@;
+#pragma D binding "1.0" SI_RCTL
+inline int ILL_ILLOPC = @ILL_ILLOPC@;
+#pragma D binding "1.0" ILL_ILLOPC
+inline int ILL_ILLOPN = @ILL_ILLOPN@;
+#pragma D binding "1.0" ILL_ILLOPN
+inline int ILL_ILLADR = @ILL_ILLADR@;
+#pragma D binding "1.0" ILL_ILLADR
+inline int ILL_ILLTRP = @ILL_ILLTRP@;
+#pragma D binding "1.0" ILL_ILLTRP
+inline int ILL_PRVOPC = @ILL_PRVOPC@;
+#pragma D binding "1.0" ILL_PRVOPC
+inline int ILL_PRVREG = @ILL_PRVREG@;
+#pragma D binding "1.0" ILL_PRVREG
+inline int ILL_COPROC = @ILL_COPROC@;
+#pragma D binding "1.0" ILL_COPROC
+inline int ILL_BADSTK = @ILL_BADSTK@;
+#pragma D binding "1.0" ILL_BADSTK
+inline int FPE_INTDIV = @FPE_INTDIV@;
+#pragma D binding "1.0" FPE_INTDIV
+inline int FPE_INTOVF = @FPE_INTOVF@;
+#pragma D binding "1.0" FPE_INTOVF
+inline int FPE_FLTDIV = @FPE_FLTDIV@;
+#pragma D binding "1.0" FPE_FLTDIV
+inline int FPE_FLTOVF = @FPE_FLTOVF@;
+#pragma D binding "1.0" FPE_FLTOVF
+inline int FPE_FLTUND = @FPE_FLTUND@;
+#pragma D binding "1.0" FPE_FLTUND
+inline int FPE_FLTRES = @FPE_FLTRES@;
+#pragma D binding "1.0" FPE_FLTRES
+inline int FPE_FLTINV = @FPE_FLTINV@;
+#pragma D binding "1.0" FPE_FLTINV
+inline int FPE_FLTSUB = @FPE_FLTSUB@;
+#pragma D binding "1.0" FPE_FLTSUB
+inline int SEGV_MAPERR = @SEGV_MAPERR@;
+#pragma D binding "1.0" SEGV_MAPERR
+inline int SEGV_ACCERR = @SEGV_ACCERR@;
+#pragma D binding "1.0" SEGV_ACCERR
+inline int BUS_ADRALN = @BUS_ADRALN@;
+#pragma D binding "1.0" BUS_ADRALN
+inline int BUS_ADRERR = @BUS_ADRERR@;
+#pragma D binding "1.0" BUS_ADRERR
+inline int BUS_OBJERR = @BUS_OBJERR@;
+#pragma D binding "1.0" BUS_OBJERR
+inline int TRAP_BRKPT = @TRAP_BRKPT@;
+#pragma D binding "1.0" TRAP_BRKPT
+inline int TRAP_TRACE = @TRAP_TRACE@;
+#pragma D binding "1.0" TRAP_TRACE
+inline int CLD_EXITED = @CLD_EXITED@;
+#pragma D binding "1.0" CLD_EXITED
+inline int CLD_KILLED = @CLD_KILLED@;
+#pragma D binding "1.0" CLD_KILLED
+inline int CLD_DUMPED = @CLD_DUMPED@;
+#pragma D binding "1.0" CLD_DUMPED
+inline int CLD_TRAPPED = @CLD_TRAPPED@;
+#pragma D binding "1.0" CLD_TRAPPED
+inline int CLD_STOPPED = @CLD_STOPPED@;
+#pragma D binding "1.0" CLD_STOPPED
+inline int CLD_CONTINUED = @CLD_CONTINUED@;
+#pragma D binding "1.0" CLD_CONTINUED
+inline int POLL_IN = @POLL_IN@;
+#pragma D binding "1.0" POLL_IN
+inline int POLL_OUT = @POLL_OUT@;
+#pragma D binding "1.0" POLL_OUT
+inline int POLL_MSG = @POLL_MSG@;
+#pragma D binding "1.0" POLL_MSG
+inline int POLL_ERR = @POLL_ERR@;
+#pragma D binding "1.0" POLL_ERR
+inline int POLL_PRI = @POLL_PRI@;
+#pragma D binding "1.0" POLL_PRI
+inline int POLL_HUP = @POLL_HUP@;
+#pragma D binding "1.0" POLL_HUP
+
+/*
+ * Translate from the kernel's proc_t structure to a proc(4) psinfo_t struct.
+ * We do not provide support for pr_size, pr_rssize, pr_pctcpu, and pr_pctmem.
+ * We also do not fill in pr_lwp (the lwpsinfo_t for the representative LWP)
+ * because we do not have the ability to select and stop any representative.
+ * Also, for the moment, pr_wstat, pr_time, and pr_ctime are not supported,
+ * but these could be supported by DTrace in the future using subroutines.
+ * Note that any member added to this translator should also be added to the
+ * kthread_t-to-psinfo_t translator, below.
+ */
+#pragma D binding "1.0" translator
+translator psinfo_t < proc_t *T > {
+	pr_nlwp = T->p_lwpcnt;
+	pr_pid = T->p_pidp->pid_id;
+	pr_ppid = T->p_ppid;
+	pr_pgid = T->p_pgidp->pid_id;
+	pr_sid = T->p_sessp->s_sidp->pid_id;
+	pr_uid = T->p_cred->cr_ruid;
+	pr_euid = T->p_cred->cr_uid;
+	pr_gid = T->p_cred->cr_rgid;
+	pr_egid = T->p_cred->cr_gid;
+	pr_addr = (uintptr_t)T;
+
+	pr_ttydev = (T->p_sessp->s_vp == NULL) ? (dev_t)-1 :
+	    (T->p_sessp->s_dev == `rwsconsdev) ? `uconsdev :
+	    (T->p_sessp->s_dev == `rconsdev) ? `uconsdev : T->p_sessp->s_dev;
+
+	pr_start = T->p_user.u_start;
+	pr_fname = T->p_user.u_comm;
+	pr_psargs = T->p_user.u_psargs;
+	pr_argc = T->p_user.u_argc;
+	pr_argv = T->p_user.u_argv;
+	pr_envp = T->p_user.u_envp;
+
+	pr_dmodel = (T->p_model == @DATAMODEL_ILP32@) ?
+	    PR_MODEL_ILP32 : PR_MODEL_LP64;
+
+	pr_taskid = T->p_task->tk_tkid;
+	pr_projid = T->p_task->tk_proj->kpj_id;
+	pr_poolid = T->p_pool->pool_id;
+	pr_zoneid = T->p_zone->zone_id;
+	pr_contract = (T->p_ct_process == NULL) ? -1 :
+	    T->p_ct_process->conp_contract.ct_id;
+};
+
+/*
+ * Translate from the kernel's kthread_t structure to a proc(4) psinfo_t
+ * struct.  Lacking a facility to define one translator only in terms of
+ * another, we explicitly define each member by using the proc_t-to-psinfo_t
+ * translator, above; any members added to that translator should also be
+ * added here.  (The only exception to this is pr_start, which -- due to it
+ * being a structure -- cannot be defined in terms of a translator at all.)
+ */
+#pragma D binding "1.0" translator
+translator psinfo_t < kthread_t *T > {
+	pr_nlwp = xlate <psinfo_t> (T->t_procp).pr_nlwp;
+	pr_pid = xlate <psinfo_t> (T->t_procp).pr_pid;
+	pr_ppid = xlate <psinfo_t> (T->t_procp).pr_ppid;
+	pr_pgid = xlate <psinfo_t> (T->t_procp).pr_pgid;
+	pr_sid = xlate <psinfo_t> (T->t_procp).pr_sid;
+	pr_uid = xlate <psinfo_t> (T->t_procp).pr_uid;
+	pr_euid = xlate <psinfo_t> (T->t_procp).pr_euid;
+	pr_gid = xlate <psinfo_t> (T->t_procp).pr_gid;
+	pr_egid = xlate <psinfo_t> (T->t_procp).pr_egid;
+	pr_addr = xlate <psinfo_t> (T->t_procp).pr_addr;
+	pr_ttydev = xlate <psinfo_t> (T->t_procp).pr_ttydev;
+	pr_start = (timestruc_t)xlate <psinfo_t> (T->t_procp).pr_start;
+	pr_fname = xlate <psinfo_t> (T->t_procp).pr_fname;
+	pr_psargs = xlate <psinfo_t> (T->t_procp).pr_psargs;
+	pr_argc = xlate <psinfo_t> (T->t_procp).pr_argc;
+	pr_argv = xlate <psinfo_t> (T->t_procp).pr_argv;
+	pr_envp = xlate <psinfo_t> (T->t_procp).pr_envp;
+	pr_dmodel = xlate <psinfo_t> (T->t_procp).pr_dmodel;
+	pr_taskid = xlate <psinfo_t> (T->t_procp).pr_taskid;
+	pr_projid = xlate <psinfo_t> (T->t_procp).pr_projid;
+	pr_poolid = xlate <psinfo_t> (T->t_procp).pr_poolid;
+	pr_zoneid = xlate <psinfo_t> (T->t_procp).pr_zoneid;
+	pr_contract = xlate <psinfo_t> (T->t_procp).pr_contract;
+};
+
+/*
+ * Translate from the kernel's kthread_t structure to a proc(4) lwpsinfo_t.
+ * We do not provide support for pr_nice, pr_oldpri, pr_cpu, or pr_pctcpu.
+ * Also, for the moment, pr_start and pr_time are not supported, but these
+ * could be supported by DTrace in the future using subroutines.
+ */
+#pragma D binding "1.0" translator
+translator lwpsinfo_t < kthread_t *T > {
+	pr_flag = ((T->t_state == @TS_STOPPED@) ? (PR_STOPPED |
+	    ((!(T->t_schedflag & @TS_PSTART@)) ? PR_ISTOP : 0)) :
+	    ((T->t_proc_flag & @TP_PRVSTOP@) ? PR_STOPPED | PR_ISTOP : 0)) |
+	    ((T == T->t_procp->p_agenttp) ? PR_AGENT : 0) |
+	    ((!(T->t_proc_flag & @TP_TWAIT@)) ? PR_DETACH : 0) |
+	    ((T->t_proc_flag & @TP_DAEMON@) ? PR_DAEMON : 0) |
+	    ((T->t_procp->p_pidflag & @CLDNOSIGCHLD@) ? PR_NOSIGCHLD : 0) |
+	    ((T->t_procp->p_pidflag & @CLDWAITPID@) ? PR_WAITPID : 0) |
+	    ((T->t_procp->p_proc_flag & @P_PR_FORK@) ? PR_FORK : 0) |
+	    ((T->t_procp->p_proc_flag & @P_PR_RUNLCL@) ? PR_RLC : 0) |
+	    ((T->t_procp->p_proc_flag & @P_PR_KILLCL@) ? PR_KLC : 0) |
+	    ((T->t_procp->p_proc_flag & @P_PR_ASYNC@) ? PR_ASYNC : 0) |
+	    ((T->t_procp->p_proc_flag & @P_PR_BPTADJ@) ? PR_BPTADJ : 0) |
+	    ((T->t_procp->p_proc_flag & @P_PR_PTRACE@) ? PR_PTRACE : 0) |
+	    ((T->t_procp->p_flag & @SMSACCT@) ? PR_MSACCT : 0) |
+	    ((T->t_procp->p_flag & @SMSFORK@) ? PR_MSFORK : 0) |
+	    ((T->t_procp->p_flag & @SVFWAIT@) ? PR_VFORKP : 0) |
+	    (((T->t_procp->p_flag & @SSYS@) ||
+	    (T->t_procp->p_as == &`kas)) ? PR_ISSYS : 0) |
+	    ((T == T->t_cpu->cpu_idle_thread) ? PR_IDLE : 0);
+
+	pr_lwpid = T->t_tid;
+	pr_addr = (uintptr_t)T;
+	pr_wchan = (uintptr_t)T->t_lwpchan.lc_wchan;
+	pr_stype = T->t_sobj_ops ? T->t_sobj_ops->sobj_type : 0;
+
+	pr_state = (T->t_proc_flag & @TP_PRVSTOP@) ? SSTOP :
+	    (T->t_state == @TS_SLEEP@) ? SSLEEP :
+	    (T->t_state == @TS_RUN@) ? SRUN :
+	    (T->t_state == @TS_ONPROC@) ? SONPROC :
+	    (T->t_state == @TS_ZOMB@) ? SZOMB :
+	    (T->t_state == @TS_STOPPED@) ? SSTOP :
+	    (T->t_state == @TS_WAIT@) ? SWAIT : 0;
+
+	pr_sname = (T->t_proc_flag & @TP_PRVSTOP@) ? 'T' :
+	    (T->t_state == @TS_SLEEP@) ? 'S' :
+	    (T->t_state == @TS_RUN@) ? 'R' :
+	    (T->t_state == @TS_ONPROC@) ? 'O' :
+	    (T->t_state == @TS_ZOMB@) ? 'Z' :
+	    (T->t_state == @TS_STOPPED@) ? 'T' :
+	    (T->t_state == @TS_WAIT@) ? 'W' : '?';
+
+	pr_syscall = T->t_sysnum;
+	pr_pri = T->t_pri;
+	pr_clname = `sclass[T->t_cid].cl_name;
+	pr_onpro = T->t_cpu->cpu_id;
+	pr_bindpro = T->t_bind_cpu;
+	pr_bindpset = T->t_bind_pset;
+	pr_lgrp = T->t_lpl->lpl_lgrpid;
+};
+
+inline psinfo_t *curpsinfo = xlate <psinfo_t *> (curthread->t_procp);
+#pragma D attributes Stable/Stable/Common curpsinfo
+#pragma D binding "1.0" curpsinfo
+
+inline lwpsinfo_t *curlwpsinfo = xlate <lwpsinfo_t *> (curthread);
+#pragma D attributes Stable/Stable/Common curlwpsinfo
+#pragma D binding "1.0" curlwpsinfo
+
+inline string cwd = curthread->t_procp->p_user.u_cdir->v_path == NULL ?
+    "<unknown>" : stringof(curthread->t_procp->p_user.u_cdir->v_path);
+#pragma D attributes Stable/Stable/Common cwd
+#pragma D binding "1.0" cwd
+
+inline string root = curthread->t_procp->p_user.u_rdir == NULL ? "/" :
+    curthread->t_procp->p_user.u_rdir->v_path == NULL ? "<unknown>" :
+    stringof(curthread->t_procp->p_user.u_rdir->v_path);
+#pragma D attributes Stable/Stable/Common root
+#pragma D binding "1.0" root
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/procfs.sed.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/procfs.sed.in
new file mode 100644
index 0000000..b4a7087
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/procfs.sed.in
@@ -0,0 +1,163 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * This file is a sed script which is first preprocessed by cpp or cc -E to
+ * define a set of sed directives which replace #define tokens with their
+ * values.  After preprocessing, the sed script is run over procfs.d.in to
+ * replace the #define tokens listed below to create the finished procfs.d.
+ * Refer to the rules in libdtrace/Makefile.com for more information.
+ */
+
+#include <sys/model.h>
+#include <sys/thread.h>
+#include <sys/proc.h>
+#include <sys/procfs.h>
+#include <sys/sobject.h>
+#include <sys/siginfo.h>
+
+#define	SED_REPLACE(x)	s/#x/x/g
+
+SED_REPLACE(DATAMODEL_ILP32)
+SED_REPLACE(DATAMODEL_LP64)
+
+SED_REPLACE(TP_DAEMON)
+SED_REPLACE(TP_TWAIT)
+SED_REPLACE(TP_PRVSTOP)
+SED_REPLACE(TS_PSTART)
+SED_REPLACE(TS_FREE)
+SED_REPLACE(TS_SLEEP)
+SED_REPLACE(TS_RUN)
+SED_REPLACE(TS_ONPROC)
+SED_REPLACE(TS_ZOMB)
+SED_REPLACE(TS_STOPPED)
+SED_REPLACE(TS_WAIT)
+
+SED_REPLACE(P_PR_FORK)
+SED_REPLACE(P_PR_RUNLCL)
+SED_REPLACE(P_PR_KILLCL)
+SED_REPLACE(P_PR_ASYNC)
+SED_REPLACE(P_PR_BPTADJ)
+SED_REPLACE(P_PR_PTRACE)
+
+SED_REPLACE(SSYS)
+SED_REPLACE(SMSACCT)
+SED_REPLACE(SMSFORK)
+SED_REPLACE(SVFWAIT)
+
+SED_REPLACE(SSLEEP)
+SED_REPLACE(SRUN)
+SED_REPLACE(SZOMB)
+SED_REPLACE(SSTOP)
+SED_REPLACE(SIDL)
+SED_REPLACE(SONPROC)
+SED_REPLACE(SWAIT)
+
+SED_REPLACE(CLDNOSIGCHLD)
+SED_REPLACE(CLDWAITPID)
+
+SED_REPLACE(PR_STOPPED)
+SED_REPLACE(PR_ISTOP)
+SED_REPLACE(PR_DSTOP)
+SED_REPLACE(PR_STEP)
+SED_REPLACE(PR_ASLEEP)
+SED_REPLACE(PR_PCINVAL)
+SED_REPLACE(PR_ASLWP)
+SED_REPLACE(PR_AGENT)
+SED_REPLACE(PR_DETACH)
+SED_REPLACE(PR_DAEMON)
+SED_REPLACE(PR_IDLE)
+SED_REPLACE(PR_ISSYS)
+SED_REPLACE(PR_VFORKP)
+SED_REPLACE(PR_ORPHAN)
+SED_REPLACE(PR_NOSIGCHLD)
+SED_REPLACE(PR_WAITPID)
+SED_REPLACE(PR_FORK)
+SED_REPLACE(PR_RLC)
+SED_REPLACE(PR_KLC)
+SED_REPLACE(PR_ASYNC)
+SED_REPLACE(PR_MSACCT)
+SED_REPLACE(PR_BPTADJ)
+SED_REPLACE(PR_PTRACE)
+SED_REPLACE(PR_MSFORK)
+
+SED_REPLACE(PR_MODEL_ILP32)
+SED_REPLACE(PR_MODEL_LP64)
+
+SED_REPLACE(SOBJ_NONE)
+SED_REPLACE(SOBJ_MUTEX)
+SED_REPLACE(SOBJ_RWLOCK)
+SED_REPLACE(SOBJ_CV)
+SED_REPLACE(SOBJ_SEMA)
+SED_REPLACE(SOBJ_USER)
+SED_REPLACE(SOBJ_USER_PI)
+SED_REPLACE(SOBJ_SHUTTLE)
+
+SED_REPLACE(SI_USER)
+SED_REPLACE(SI_LWP)
+SED_REPLACE(SI_QUEUE)
+SED_REPLACE(SI_TIMER)
+SED_REPLACE(SI_ASYNCIO)
+SED_REPLACE(SI_MESGQ)
+SED_REPLACE(SI_RCTL)
+SED_REPLACE(ILL_ILLOPC)
+SED_REPLACE(ILL_ILLOPN)
+SED_REPLACE(ILL_ILLOPN)
+SED_REPLACE(ILL_ILLADR)
+SED_REPLACE(ILL_ILLTRP)
+SED_REPLACE(ILL_PRVOPC)
+SED_REPLACE(ILL_PRVREG)
+SED_REPLACE(ILL_COPROC)
+SED_REPLACE(ILL_BADSTK)
+SED_REPLACE(FPE_INTDIV)
+SED_REPLACE(FPE_INTOVF)
+SED_REPLACE(FPE_FLTDIV)
+SED_REPLACE(FPE_FLTOVF)
+SED_REPLACE(FPE_FLTUND)
+SED_REPLACE(FPE_FLTRES)
+SED_REPLACE(FPE_FLTINV)
+SED_REPLACE(FPE_FLTSUB)
+SED_REPLACE(SEGV_MAPERR)
+SED_REPLACE(SEGV_ACCERR)
+SED_REPLACE(BUS_ADRALN)
+SED_REPLACE(BUS_ADRERR)
+SED_REPLACE(BUS_OBJERR)
+SED_REPLACE(TRAP_BRKPT)
+SED_REPLACE(TRAP_TRACE)
+SED_REPLACE(CLD_EXITED)
+SED_REPLACE(CLD_KILLED)
+SED_REPLACE(CLD_DUMPED)
+SED_REPLACE(CLD_TRAPPED)
+SED_REPLACE(CLD_STOPPED)
+SED_REPLACE(CLD_CONTINUED)
+SED_REPLACE(POLL_IN)
+SED_REPLACE(POLL_OUT)
+SED_REPLACE(POLL_MSG)
+SED_REPLACE(POLL_ERR)
+SED_REPLACE(POLL_PRI)
+SED_REPLACE(POLL_HUP)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sched.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sched.d
new file mode 100644
index 0000000..722b58a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sched.d
@@ -0,0 +1,82 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D depends_on module unix
+#pragma D depends_on provider sched
+
+struct cpuinfo {
+	processorid_t cpu_id;		/* CPU identifier */
+	psetid_t cpu_pset;		/* processor set identifier */
+	chipid_t cpu_chip;		/* chip identifier */
+	lgrp_id_t cpu_lgrp;		/* locality group identifer */
+	processor_info_t cpu_info;	/* CPU information */
+};
+
+typedef struct cpuinfo cpuinfo_t;
+
+translator cpuinfo_t < cpu_t *C > {
+	cpu_id = C->cpu_id;
+	cpu_pset = C->cpu_part->cp_id;
+	cpu_chip = C->cpu_physid->cpu_chipid;
+	cpu_lgrp = C->cpu_lpl->lpl_lgrpid;
+	cpu_info = (processor_info_t)C->cpu_type_info;
+}; 
+
+translator cpuinfo_t < disp_t *D > {
+	cpu_id = D->disp_cpu == NULL ? -1 :
+	    xlate <cpuinfo_t> (D->disp_cpu).cpu_id;
+	cpu_pset = D->disp_cpu == NULL ? -1 :
+	    xlate <cpuinfo_t> (D->disp_cpu).cpu_pset;
+	cpu_chip = D->disp_cpu == NULL ? -1 :
+	    xlate <cpuinfo_t> (D->disp_cpu).cpu_chip;
+	cpu_lgrp = D->disp_cpu == NULL ? -1 :
+	    xlate <cpuinfo_t> (D->disp_cpu).cpu_lgrp;
+	cpu_info = D->disp_cpu == NULL ?
+	    *((processor_info_t *)dtrace`dtrace_zero) :
+	    (processor_info_t)xlate <cpuinfo_t> (D->disp_cpu).cpu_info;
+};
+
+inline cpuinfo_t *curcpu = xlate <cpuinfo_t *> (curthread->t_cpu);
+#pragma D attributes Stable/Stable/Common curcpu
+#pragma D binding "1.0" curcpu
+
+inline processorid_t cpu = curcpu->cpu_id;
+#pragma D attributes Stable/Stable/Common cpu
+#pragma D binding "1.0" cpu
+
+inline psetid_t pset = curcpu->cpu_pset;
+#pragma D attributes Stable/Stable/Common pset
+#pragma D binding "1.0" pset
+
+inline chipid_t chip = curcpu->cpu_chip;
+#pragma D attributes Stable/Stable/Common chip
+#pragma D binding "1.0" chip
+
+inline lgrp_id_t lgrp = curcpu->cpu_lgrp;
+#pragma D attributes Stable/Stable/Common lgrp
+#pragma D binding "1.0" lgrp
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/scsi.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/scsi.d
new file mode 100644
index 0000000..5a6e04f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/scsi.d
@@ -0,0 +1,89 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	D depends_on module genunix
+#pragma	D depends_on module stmf
+
+/*
+ * The scsicmd_t structure should be used by providers
+ * to represent a SCSI command block (cdb).
+ */
+typedef struct scsicmd {
+	uint64_t ic_len;	/* CDB length */
+	uint8_t  *ic_cdb;	/* CDB data */
+} scsicmd_t;
+
+/*
+ * Translator for scsicmd_t, translating from a scsi_task_t
+ */ 
+#pragma D binding "1.5" translator
+translator scsicmd_t < scsi_task_t *T > {
+	ic_len = T->task_cdb_length;
+	ic_cdb = T->task_cdb;
+};
+
+/*
+ * The xferinfo_t structure can be used by providers to
+ * represent transfer information related to a single
+ * buffer. The members describing the remote memory
+ * are only valid if the transport layer is an RDMA-
+ * capable transport like Infiniband
+ */
+typedef struct xferinfo {
+	uintptr_t xfer_laddr;   /* local buffer address */
+	uint32_t xfer_loffset;
+	uint32_t xfer_lkey;     /* access control to local memory */
+	uintptr_t xfer_raddr;   /* remote virtual address */
+	uint32_t xfer_roffset;  /* offset from the remote address */
+	uint32_t xfer_rkey;     /* access control to remote virtual address */
+	uint32_t xfer_len;      /* transfer length */
+	uint32_t xfer_type;     /* Read (0) or Write (1) */
+} xferinfo_t;
+
+/*
+ * the iscsiinfo_t is used to provide identifying information about
+ * the target and the initiator and also some PDU level information
+ * such as lun, data length and sequence numbers.
+ */
+typedef struct iscsiinfo {
+	string ii_target;	/* target iqn */
+	string ii_initiator;	/* initiator iqn */
+	string ii_isid;         /* initiator session identifier */
+	string ii_tsih;         /* target session identifying handle */
+	string ii_transport;    /* transport type ("iser-ib", "sockets") */
+
+	uint64_t ii_lun;	/* target logical unit number */
+
+	uint32_t ii_itt;	/* initiator task tag */
+	uint32_t ii_ttt;	/* target transfer tag */
+
+	uint32_t ii_cmdsn;	/* command sequence number */
+	uint32_t ii_statsn;	/* status sequence number */
+	uint32_t ii_datasn;	/* data sequence number */
+
+	uint32_t ii_datalen;	/* length of data payload */
+	uint32_t ii_flags;	/* probe-specific flags */
+} iscsiinfo_t;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/srp.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/srp.d
new file mode 100644
index 0000000..70cb230
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/srp.d
@@ -0,0 +1,168 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma	D depends_on library net.d
+#pragma D depends_on library scsi.d
+#pragma D depends_on module genunix
+#pragma	D depends_on module srpt
+
+typedef struct srp_portinfo {
+	/* initiator */
+	string  pi_initiator;	/* Initiator: eui.xxxxxxxxxxxxxxx */
+	string	pi_i_sid;	/* Initiator session id */
+
+	/* target */
+	string	pi_target;	/* Target: eui.xxxxxxxxxxxxxxx */
+	string  pi_t_sid;	/* Target session id */
+
+	uintptr_t pi_chan_id;	/* Channel identifier */
+} srp_portinfo_t;
+
+#pragma D binding "1.5" translator
+translator conninfo_t < srpt_session_t *P > {
+	ci_local = P->ss_t_gid;
+	ci_remote = P->ss_i_gid;
+	ci_protocol = "ib";
+};
+
+#pragma D binding "1.5" translator
+translator srp_portinfo_t < srpt_session_t *P > {
+	pi_initiator = P->ss_i_name;
+	pi_i_sid = P->ss_i_alias;
+	pi_target = P->ss_t_name;
+	pi_t_sid = P->ss_t_alias;
+	pi_chan_id = 0; 
+};
+
+#pragma D binding "1.5" translator
+translator conninfo_t < srpt_channel_t *P > {
+	ci_local = P->ch_session->ss_i_gid;
+	ci_remote = P->ch_session->ss_t_gid;
+};
+
+#pragma D binding "1.5" translator
+translator srp_portinfo_t < srpt_channel_t *P > {
+	pi_initiator = P->ch_session->ss_i_name;
+	pi_i_sid = P->ch_session->ss_i_alias;
+	pi_target = P->ch_session->ss_t_name;
+	pi_t_sid = P->ch_session->ss_t_alias;
+	pi_chan_id = (uintptr_t)P->ch_chan_hdl;
+};
+
+typedef struct srp_logininfo {
+	uint64_t li_task_tag;	   /* SRP task tag */
+	uint32_t li_max_it_iu_len; /* Maximum iu length that initiator can
+				      send to target */
+	uint32_t li_max_ti_iu_len; /* Maximum iu length that target can
+				      send to initiator */
+	uint32_t li_request_limit; /* Maximun number of SRP requests 
+				      that initiator can send on a channel */
+	uint32_t li_reason_code;   /* Reason code */
+} srp_logininfo_t;
+
+#pragma D binding "1.5" translator
+translator srp_logininfo_t < srp_login_req_t *P > {
+	li_task_tag = P->lreq_tag; 
+	li_max_it_iu_len = ntohl(P->lreq_req_it_iu_len);
+	li_max_ti_iu_len = 0;
+	li_request_limit = 0;
+	li_reason_code = 0;
+};
+
+#pragma D binding "1.5" translator
+translator srp_logininfo_t < srp_login_rsp_t *P > {
+	li_task_tag = P->lrsp_tag; 
+	li_max_it_iu_len = ntohl(P->lrsp_max_it_iu_len);
+	li_max_ti_iu_len = ntohl(P->lrsp_max_ti_iu_len);
+	li_request_limit = ntohl(P->lrsp_req_limit_delta);
+	li_reason_code = ntohl(((srp_login_rej_t *)arg2)->lrej_reason);
+};
+
+typedef struct srp_taskinfo {
+	uint64_t ti_task_tag;	/* SRP task tag */
+	uint64_t ti_lun;	/* Target logical unit number */
+	uint8_t  ti_function;	/* Task management function */
+	uint32_t ti_req_limit_delta; /* Increment of channel's request limit */
+	uint8_t  ti_flag;	     /* bit 2: DOOVER */
+	                             /* bit 3: DOUNDER */
+	                             /* bit 4: DIOVER */
+	                             /* bit 5: DIUNDER */
+	uint32_t ti_do_resid_cnt;    /* Data-out residual count */
+	uint32_t ti_di_resid_cnt;    /* Data-in residual count */
+	uint8_t  ti_status;     /* Status of this task */
+} srp_taskinfo_t;
+
+#pragma D binding "1.5" translator
+translator srp_taskinfo_t < srp_cmd_req_t *P > {
+	ti_task_tag = P->cr_tag;
+	ti_lun = (ntohl(*((uint32_t *)P->cr_lun)) << 32) +
+	    ntohl(*((uint32_t *)&P->cr_lun[4]));
+	ti_function = P->cr_type == 1 ?  /* 1: MGMT CMD 2: SRP CMD */
+	    ((srp_tsk_mgmt_t *)P)->tm_function : 0;
+	ti_req_limit_delta = 0;
+	ti_flag = 0;
+	ti_do_resid_cnt = 0;
+	ti_di_resid_cnt = 0;
+	ti_status = 0;
+};
+
+#pragma D binding "1.5" translator
+translator srp_taskinfo_t < srp_rsp_t *P > {
+	ti_task_tag = P->rsp_tag;
+	ti_lun = ntohll(*(uint64_t *)((scsi_task_t *)arg2)->task_lun_no);
+	ti_function = ((scsi_task_t *)arg2)->task_mgmt_function;
+	ti_req_limit_delta = ntohl(P->rsp_req_limit_delta);
+	ti_flag = P->rsp_flags;
+	ti_do_resid_cnt = ntohl(P->rsp_do_resid_cnt);
+	ti_di_resid_cnt = ntohl(P->rsp_di_resid_cnt);
+	ti_status = arg3;
+};
+
+#pragma D binding "1.5" translator
+translator srp_taskinfo_t < srpt_iu_t *P > {
+	ti_task_tag = P->iu_tag;
+	ti_lun = ntohll(*(uint64_t *)P->iu_stmf_task->task_lun_no);
+	ti_function = 0;
+	ti_req_limit_delta = 0;
+	ti_flag = 0;
+	ti_do_resid_cnt = 0;
+	ti_di_resid_cnt = 0;
+	ti_status = 0;
+};
+
+#pragma D binding "1.5" translator
+translator xferinfo_t < ibt_wr_ds_t *P > {
+	xfer_laddr = P->ds_va + arg4;
+	xfer_lkey = P->ds_key;
+	xfer_raddr = (arg3 == 0) ? 0 :
+	    ((ibt_send_wr_t *)arg3)->wr.rc.rcwr.rdma.rdma_raddr;
+	xfer_rkey = (arg3 == 0) ? 0 :
+	    ((ibt_send_wr_t *)arg3)->wr.rc.rcwr.rdma.rdma_rkey;
+	xfer_len = arg4;
+	xfer_loffset = arg5;
+	xfer_roffset = arg6;
+	xfer_type = arg7;
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sysevent.d.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sysevent.d.in
new file mode 100644
index 0000000..135dfa3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sysevent.d.in
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma D depends_on module unix
+
+typedef struct syseventinfo {
+	string	se_class;		/* event class */
+	string	se_subclass;		/* event subclass */
+	string	se_publisher;		/* event publisher */
+} syseventinfo_t;
+
+#pragma D binding "1.0" translator
+translator syseventinfo_t < sysevent_impl_t *ev > {
+	se_class = stringof(@SE_CLASS_NAME@(ev));
+	se_subclass = stringof(@SE_SUBCLASS_NAME@(ev));
+	se_publisher = stringof(@SE_PUB_NAME@(ev));
+};
+
+typedef struct syseventchaninfo {
+	string	ec_name;		/* channel name, or NULL if default */
+} syseventchaninfo_t;
+
+#pragma D binding "1.0" translator
+translator syseventchaninfo_t < evch_bind_t *bind > {
+	ec_name = (bind ? stringof(bind->bd_channel->ch_name) : NULL);
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sysevent.sed.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sysevent.sed.in
new file mode 100644
index 0000000..5d9f958
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/sysevent.sed.in
@@ -0,0 +1,34 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/sysevent_impl.h>
+
+#define	SED_MACRO(x)	s/#x(ev)/x(ev)/g
+
+SED_MACRO(SE_CLASS_NAME)
+SED_MACRO(SE_SUBCLASS_NAME)
+SED_MACRO(SE_PUB_NAME)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/tcp.d.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/tcp.d.in
new file mode 100644
index 0000000..2733e52
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/tcp.d.in
@@ -0,0 +1,269 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D depends_on module unix
+#pragma D depends_on provider tcp
+
+inline int TH_FIN = @TH_FIN@;
+#pragma D binding "1.6.3" TH_FIN
+inline int TH_SYN = @TH_SYN@;
+#pragma D binding "1.6.3" TH_SYN
+inline int TH_RST = @TH_RST@;
+#pragma D binding "1.6.3" TH_RST
+inline int TH_PUSH = @TH_PUSH@;
+#pragma D binding "1.6.3" TH_PUSH
+inline int TH_ACK = @TH_ACK@;
+#pragma D binding "1.6.3" TH_ACK
+inline int TH_URG = @TH_URG@;
+#pragma D binding "1.6.3" TH_URG
+inline int TH_ECE = @TH_ECE@;
+#pragma D binding "1.6.3" TH_ECE
+inline int TH_CWR = @TH_CWR@;
+#pragma D binding "1.6.3" TH_CWR
+
+inline int32_t TCP_STATE_CLOSED = @TCPS_CLOSED@;
+#pragma D binding "1.6.3" TCP_STATE_CLOSED
+inline int32_t TCP_STATE_IDLE = @TCPS_IDLE@;
+#pragma D binding "1.6.3" TCP_STATE_IDLE
+inline int32_t TCP_STATE_BOUND = @TCPS_BOUND@;
+#pragma D binding "1.6.3" TCP_STATE_BOUND
+inline int32_t TCP_STATE_LISTEN = @TCPS_LISTEN@;
+#pragma D binding "1.6.3" TCP_STATE_LISTEN
+inline int32_t TCP_STATE_SYN_SENT = @TCPS_SYN_SENT@;
+#pragma D binding "1.6.3" TCP_STATE_SYN_SENT
+inline int32_t TCP_STATE_SYN_RECEIVED = @TCPS_SYN_RCVD@;
+#pragma D binding "1.6.3" TCP_STATE_SYN_RECEIVED
+inline int32_t TCP_STATE_ESTABLISHED = @TCPS_ESTABLISHED@;
+#pragma D binding "1.6.3" TCP_STATE_ESTABLISHED
+inline int32_t TCP_STATE_CLOSE_WAIT = @TCPS_CLOSE_WAIT@;
+#pragma D binding "1.6.3" TCP_STATE_CLOSE_WAIT
+inline int32_t TCP_STATE_FIN_WAIT_1 = @TCPS_FIN_WAIT_1@;
+#pragma D binding "1.6.3" TCP_STATE_FIN_WAIT_1
+inline int32_t TCP_STATE_CLOSING = @TCPS_CLOSING@;
+#pragma D binding "1.6.3" TCP_STATE_CLOSING
+inline int32_t TCP_STATE_LAST_ACK = @TCPS_LAST_ACK@;
+#pragma D binding "1.6.3" TCP_STATE_LAST_ACK
+inline int32_t TCP_STATE_FIN_WAIT_2 = @TCPS_FIN_WAIT_2@;
+#pragma D binding "1.6.3" TCP_STATE_FIN_WAIT_2
+inline int32_t TCP_STATE_TIME_WAIT = @TCPS_TIME_WAIT@;
+#pragma D binding "1.6.3" TCP_STATE_TIME_WAIT
+
+/*
+ * Convert a TCP state value to a string.
+ */
+inline string tcp_state_string[int32_t state] =
+	state == TCP_STATE_CLOSED ? "state-closed" :
+	state == TCP_STATE_IDLE ? "state-idle" :
+	state == TCP_STATE_BOUND ? "state-bound" :
+	state == TCP_STATE_LISTEN ? "state-listen" :
+	state == TCP_STATE_SYN_SENT ? "state-syn-sent" :
+	state == TCP_STATE_SYN_RECEIVED ? "state-syn-received" :
+	state == TCP_STATE_ESTABLISHED ? "state-established" :
+	state == TCP_STATE_CLOSE_WAIT ? "state-close-wait" :
+	state == TCP_STATE_FIN_WAIT_1 ? "state-fin-wait-1" :
+	state == TCP_STATE_CLOSING ? "state-closing" :
+	state == TCP_STATE_LAST_ACK ? "state-last-ack" :
+	state == TCP_STATE_FIN_WAIT_2 ? "state-fin-wait-2" :
+	state == TCP_STATE_TIME_WAIT ? "state-time-wait" :
+	"<unknown>";
+#pragma D binding "1.6.3" tcp_state_string
+
+/*
+ * tcpinfo is the TCP header fields.
+ */
+typedef struct tcpinfo {
+	uint16_t tcp_sport;		/* source port */
+	uint16_t tcp_dport;		/* destination port */
+	uint32_t tcp_seq;		/* sequence number */
+	uint32_t tcp_ack;		/* acknowledgment number */
+	uint8_t tcp_offset;		/* data offset, in bytes */
+	uint8_t tcp_flags;		/* flags */
+	uint16_t tcp_window;		/* window size */
+	uint16_t tcp_checksum;		/* checksum */
+	uint16_t tcp_urgent;		/* urgent data pointer */
+	tcph_t *tcp_hdr;		/* raw TCP header */
+} tcpinfo_t;
+
+/*
+ * tcpsinfo contains stable TCP details from tcp_t.
+ */
+typedef struct tcpsinfo {
+	uintptr_t tcps_addr;
+	int tcps_local;			/* is delivered locally, boolean */
+	int tcps_active;		/* active open (from here), boolean */
+	uint16_t tcps_lport;		/* local port */
+	uint16_t tcps_rport;		/* remote port */
+	string tcps_laddr;		/* local address, as a string */
+	string tcps_raddr;		/* remote address, as a string */
+	int32_t tcps_state;		/* TCP state */
+	uint32_t tcps_iss;		/* Initial sequence # sent */
+	uint32_t tcps_suna;		/* sequence # sent but unacked */
+	uint32_t tcps_snxt;		/* next sequence # to send */
+	uint32_t tcps_rack;		/* sequence # we have acked */
+	uint32_t tcps_rnxt;		/* next sequence # expected */
+	uint32_t tcps_swnd;		/* send window size */
+	int32_t tcps_snd_ws;		/* send window scaling */
+	uint32_t tcps_rwnd;		/* receive window size */
+	int32_t tcps_rcv_ws;		/* receive window scaling */
+	uint32_t tcps_cwnd;		/* congestion window */
+	uint32_t tcps_cwnd_ssthresh;	/* threshold for congestion avoidance */
+	uint32_t tcps_sack_fack;	/* SACK sequence # we have acked */
+	uint32_t tcps_sack_snxt;	/* next SACK seq # for retransmission */
+	uint32_t tcps_rto;		/* round-trip timeout, msec */
+	uint32_t tcps_mss;		/* max segment size */
+	int tcps_retransmit;		/* retransmit send event, boolean */
+} tcpsinfo_t;
+
+/*
+ * tcplsinfo provides the old tcp state for state changes.
+ */
+typedef struct tcplsinfo {
+	int32_t tcps_state;		/* previous TCP state */
+} tcplsinfo_t;
+
+/*
+ * __dtrace_tcp_tcph_t is used by the tcpinfo_t * translator to take either
+ * the non-NULL tcph_t * passed in or, if it is NULL, uses arg3 (tcp_t *)
+ * from the tcp:::send and tcp:::recieve probes and translates the tcp_t *
+ * into the tcpinfo_t.  When no headers are available - as is the case for
+ * TCP fusion tcp:::send and tcp:::receive - this allows us to present the
+ * consumer with header data based on tcp_t * content and hide TCP fusion
+ * implementation details.
+ */
+typedef tcph_t * __dtrace_tcp_tcph_t;
+
+#pragma D binding "1.6.3" translator
+translator tcpinfo_t < tcph_t *T > {
+	tcp_sport = ntohs(*(uint16_t *)T->th_lport);
+	tcp_dport = ntohs(*(uint16_t *)T->th_fport);
+	tcp_seq = ntohl(*(uint32_t *)T->th_seq);
+	tcp_ack = ntohl(*(uint32_t *)T->th_ack);
+	tcp_offset = (*(uint8_t *)T->th_offset_and_rsrvd & 0xf0) >> 2;
+	tcp_flags = *(uint8_t *)T->th_flags;
+	tcp_window = ntohs(*(uint16_t *)T->th_win);
+	tcp_checksum = ntohs(*(uint16_t *)T->th_sum);
+	tcp_urgent = ntohs(*(uint16_t *)T->th_urp);
+	tcp_hdr = T;
+};
+
+#pragma D binding "1.6.3" translator
+translator tcpinfo_t < __dtrace_tcp_tcph_t *T > {
+	tcp_sport =
+	    T != NULL ? ntohs(*(uint16_t *)((tcph_t *)T)->th_lport) :
+	    arg3 != NULL && probename == "send" ?
+	    ntohs(((tcp_t *)arg3)->tcp_connp->u_port.connu_ports.connu_lport) :
+	    arg3 != NULL && probename == "receive" ?
+	    ntohs(((tcp_t *)arg3)->tcp_connp->u_port.connu_ports.connu_fport) :
+	    0;
+	tcp_dport =
+	    T != NULL ? ntohs(*(uint16_t *)((tcph_t *)T)->th_fport) :
+	    arg3 != NULL && probename == "send" ?
+	    ntohs(((tcp_t *)arg3)->tcp_connp->u_port.connu_ports.connu_fport) :
+	    arg3 != NULL && probename == "receive" ?
+	    ntohs(((tcp_t *)arg3)->tcp_connp->u_port.connu_ports.connu_lport) :
+	    0;
+	tcp_seq =
+	    T != NULL ? ntohl(*(uint32_t *)((tcph_t *)T)->th_seq) :
+	    arg3 != NULL && probename == "send" ?
+	    ((tcp_t *)arg3)->tcp_snxt - ((tcp_t *)arg3)->tcp_last_sent_len :
+	    arg3 != NULL && probename == "receive" ?
+	    ((tcp_t *)arg3)->tcp_rnxt - ((tcp_t *)arg3)->tcp_last_recv_len :
+	    0;
+	tcp_ack =
+	    T != NULL ? ntohl(*(uint32_t *)((tcph_t *)T)->th_ack) :
+	    arg3 != NULL && probename == "send" ?
+	    ((tcp_t *)arg3)->tcp_rnxt :
+	    arg3 != NULL && probename == "receive" ?
+	    ((tcp_t *)arg3)->tcp_snxt :
+	    0;
+	tcp_offset = T != NULL ? 
+	    (*(uint8_t *)((tcph_t *)T)->th_offset_and_rsrvd & 0xf0) >> 2 :
+	    @TCP_MIN_HEADER_LENGTH@;
+	tcp_flags = T != NULL ? *(uint8_t *)((tcph_t *)T)->th_flags : TH_ACK;
+	tcp_window = T != NULL ? ntohs(*(uint16_t *)((tcph_t *)T)->th_win) :
+	    arg3 != NULL ? ((tcp_t *)arg3)->tcp_swnd : 0;
+	tcp_checksum = T != NULL ? ntohs(*(uint16_t *)((tcph_t *)T)->th_sum) :
+	    0;
+	tcp_urgent = T != NULL ? ntohs(*(uint16_t *)((tcph_t *)T)->th_urp) : 0;
+	tcp_hdr = NULL;
+};
+
+#pragma D binding "1.6.3" translator
+translator tcpsinfo_t < tcp_t *T > {
+	tcps_addr = (uintptr_t)T;
+	/*
+	 * The following two members should just use tcp_t->tcp_loopback
+	 * and tcp_t->tcp_active_open, however these are bit fields and
+	 * can't be used until CR 6876830 is fixed.  Meanwhile we source
+	 * them a different way.
+	 */
+	tcps_local = T ? T->tcp_ipha ?
+	    T->tcp_ipha->ipha_src == T->tcp_ipha->ipha_dst : 1 : 0;
+	tcps_active = T ? !T->tcp_saved_listener : 0;
+	tcps_lport = T ?
+	    ntohs(T->tcp_connp->u_port.connu_ports.connu_lport) : 0;
+	tcps_rport = T ?
+	    ntohs(T->tcp_connp->u_port.connu_ports.connu_fport) : 0;
+	tcps_laddr = T ?
+	    inet_ntoa6(&T->tcp_connp->connua_v6addr.connua_laddr) : "<unknown>";
+	tcps_raddr = T ?
+	    inet_ntoa6(&T->tcp_connp->connua_v6addr.connua_faddr) : "<unknown>";
+	tcps_state = T ? T->tcp_state : TCP_STATE_CLOSED;
+	tcps_iss = T ? T->tcp_iss : 0;
+	tcps_suna = T ? T->tcp_suna : 0;
+	tcps_snxt = T ? T->tcp_snxt : 0;
+	tcps_rack = T ? T->tcp_rack : 0;
+	tcps_rnxt = T ? T->tcp_rnxt : 0;
+	tcps_swnd = T ? T->tcp_swnd : 0;
+	tcps_snd_ws = T ? T->tcp_snd_ws : 0;
+	tcps_rwnd = T ? T->tcp_rwnd : 0;
+	tcps_rcv_ws = T ? T->tcp_rcv_ws : 0;
+	tcps_cwnd = T ? T->tcp_cwnd : 0;
+	tcps_cwnd_ssthresh = T ? T->tcp_cwnd_ssthresh : 0;
+	tcps_sack_fack = T ? T->tcp_sack_info.tcp_fack : 0;
+	tcps_sack_snxt = T ? T->tcp_sack_info.tcp_sack_snxt : 0;
+	tcps_rto = T ? T->tcp_rto : 0;
+	tcps_mss = T ? T->tcp_mss : 0;
+	/*
+	 * Determine if send is a retransmission by comparing the seq # to
+	 * tcp_rexmit_nxt/tcp_rexmit_max - if the value is >= rexmit_nxt and
+	 * < rexmit_max, this is a retransmission.  Cannot use tcp_rexmit
+	 * bitfield value due to CR 6876830.
+	 */
+	tcps_retransmit = T && probename == "send" && arg4 != NULL &&
+	    ntohl(*(uint32_t *)((tcph_t *)arg4)->th_seq) >= T->tcp_rexmit_nxt &&
+	    ntohl(*(uint32_t *)((tcph_t *)arg4)->th_seq) <  T->tcp_rexmit_max ?
+	    1 : 0;
+};
+
+/*
+ * Note: although we specify that the old state argument used as the
+ * input to the tcplsinfo_t translator is an int32_t, it reaches us as an
+ * int64_t (since it is a probe argument) so explicitly cast it back to
+ * interpret the negatively-valued states correctly.
+ */
+#pragma D binding "1.6.3" translator
+translator tcplsinfo_t < int64_t I > {
+	tcps_state = (int32_t) I;
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/tcp.sed.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/tcp.sed.in
new file mode 100644
index 0000000..230264b
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/tcp.sed.in
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#include <inet/tcp.h>
+#include <sys/netstack.h>
+
+#define	SED_REPLACE(x)	s/#x/x/g
+
+SED_REPLACE(TH_FIN)
+SED_REPLACE(TH_SYN)
+SED_REPLACE(TH_RST)
+SED_REPLACE(TH_PUSH)
+SED_REPLACE(TH_ACK)
+SED_REPLACE(TH_URG)
+SED_REPLACE(TH_ECE)
+SED_REPLACE(TH_CWR)
+
+SED_REPLACE(TCPS_CLOSED)
+SED_REPLACE(TCPS_IDLE)
+SED_REPLACE(TCPS_BOUND)
+SED_REPLACE(TCPS_LISTEN)
+SED_REPLACE(TCPS_SYN_SENT)
+SED_REPLACE(TCPS_SYN_RCVD)
+SED_REPLACE(TCPS_ESTABLISHED)
+SED_REPLACE(TCPS_CLOSE_WAIT)
+SED_REPLACE(TCPS_FIN_WAIT_1)
+SED_REPLACE(TCPS_CLOSING)
+SED_REPLACE(TCPS_LAST_ACK)
+SED_REPLACE(TCPS_FIN_WAIT_2)
+SED_REPLACE(TCPS_TIME_WAIT)
+
+SED_REPLACE(TCP_MIN_HEADER_LENGTH)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/udp.d.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/udp.d.in
new file mode 100644
index 0000000..c215901
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/udp.d.in
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#pragma D depends_on module unix
+#pragma D depends_on provider udp
+
+inline int UDPH_SIZE = @UDPH_SIZE@;
+#pragma D binding "1.6.3" UDPH_SIZE
+
+/*
+ * udpinfo is the UDP header fields.
+ */
+typedef struct udpinfo {
+	uint16_t udp_sport;		/* source port */
+	uint16_t udp_dport;		/* destination port */
+	uint16_t udp_length;		/* total length */
+	uint16_t udp_checksum;          /* headers + data checksum */
+	udpha_t *udp_hdr;		/* raw UDP header */
+} udpinfo_t;
+
+/*
+ * udpsinfo contains stable UDP details from udp_t.
+ */
+typedef struct udpsinfo {
+	uintptr_t udps_addr;
+	uint16_t udps_lport;		/* local port */
+	uint16_t udps_rport;		/* remote port */
+	string udps_laddr;		/* local address, as a string */
+	string udps_raddr;		/* remote address, as a string */
+} udpsinfo_t;
+
+#pragma D binding "1.6.3" translator
+translator udpinfo_t < udpha_t *U > {
+	udp_sport = ntohs(U->uha_src_port);
+	udp_dport = ntohs(U->uha_dst_port);
+	udp_length = ntohs(U->uha_length);
+	udp_checksum = ntohs(U->uha_checksum);
+	udp_hdr = U;
+};
+
+#pragma D binding "1.6.3" translator
+translator udpsinfo_t < udp_t *U > {
+	udps_addr = (uintptr_t)U;
+	udps_lport = U ?
+	    ntohs(U->udp_connp->u_port.connu_ports.connu_lport) : 0;
+	udps_rport = U ?
+	    ntohs(U->udp_connp->u_port.connu_ports.connu_fport) : 0;
+	udps_laddr = U ?
+	    inet_ntoa6(&U->udp_connp->connua_v6addr.connua_laddr) : "<unknown>";
+	udps_raddr = U ?
+	    inet_ntoa6(&U->udp_connp->connua_v6addr.connua_faddr) : "<unknown>";
+};
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/udp.sed.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/udp.sed.in
new file mode 100644
index 0000000..9c23a96
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/udp.sed.in
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#include <inet/ip.h>
+
+#define	SED_REPLACE(x)	s/#x/x/g
+
+SED_REPLACE(UDPH_SIZE)
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/unistd.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/unistd.d
new file mode 100644
index 0000000..c561ad3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/unistd.d
@@ -0,0 +1,56 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+inline int DTRACEFLT_UNKNOWN = 0;	/* Unknown fault */
+#pragma D binding "1.0" DTRACEFLT_UNKNOWN
+
+inline int DTRACEFLT_BADADDR = 1;	/* Bad address */
+#pragma D binding "1.0" DTRACEFLT_BADADDR
+
+inline int DTRACEFLT_BADALIGN = 2;	/* Bad alignment */
+#pragma D binding "1.0" DTRACEFLT_BADALIGN
+
+inline int DTRACEFLT_ILLOP = 3;		/* Illegal operation */
+#pragma D binding "1.0" DTRACEFLT_ILLOP
+
+inline int DTRACEFLT_DIVZERO = 4;	/* Divide-by-zero */
+#pragma D binding "1.0" DTRACEFLT_DIVZERO
+
+inline int DTRACEFLT_NOSCRATCH = 5;	/* Out of scratch space */
+#pragma D binding "1.0" DTRACEFLT_NOSCRATCH
+
+inline int DTRACEFLT_KPRIV = 6;		/* Illegal kernel access */
+#pragma D binding "1.0" DTRACEFLT_KPRIV
+
+inline int DTRACEFLT_UPRIV = 7;		/* Illegal user access */
+#pragma D binding "1.0" DTRACEFLT_UPRIV
+
+inline int DTRACEFLT_TUPOFLOW = 8;	/* Tuple stack overflow */
+#pragma D binding "1.0" DTRACEFLT_TUPOFLOW
+
+inline int DTRACEFLT_BADSTACK = 9;	/* Bad stack */
+#pragma D binding "1.4.1" DTRACEFLT_BADSTACK
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/Makefile
new file mode 100644
index 0000000..6c47939
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/Makefile
@@ -0,0 +1,54 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+ASFLAGS += $(AS_PICFLAGS) -P -D_ASM
+
+MACHOBJS = dis_tables.o
+DLIBSRCS = regs.d
+
+include ../Makefile.com
+
+SRCS += $(SRC)/common/dis/i386/dis_tables.c
+CPPFLAGS += -I$(SRC)/common/dis/i386
+
+LINTFLAGS += -erroff=E_BAD_PTR_CAST_ALIGN
+
+CLEANFILES += regs.sed regs.d
+
+%.sed: %.sed.in
+	$(COMPILE.cpp) -D_KERNEL $< | \
+	tr -d ' ' | tr '@' ' ' | tr '"' '@' | grep '^s/' > $@
+
+../$(MACH)/regs.d: regs.sed regs.d.in
+	sed -f regs.sed < regs.d.in > $@
+
+pics/%.o: $(SRC)/common/dis/i386/%.c
+	$(COMPILE.c) -o $@ $<
+	$(POST_PROCESS_O)
+
+install yydebug: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) \
+	$(ROOTDLIBS) $(ROOTDOBJS)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/dt_isadep.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/dt_isadep.c
new file mode 100644
index 0000000..c1484a4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/dt_isadep.c
@@ -0,0 +1,488 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <stdlib.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <libgen.h>
+
+#include <dt_impl.h>
+#include <dt_pid.h>
+
+#include <dis_tables.h>
+
+#define	DT_POPL_EBP	0x5d
+#define	DT_RET		0xc3
+#define	DT_RET16	0xc2
+#define	DT_LEAVE	0xc9
+#define	DT_JMP32	0xe9
+#define	DT_JMP8		0xeb
+#define	DT_REP		0xf3
+
+#define	DT_MOVL_EBP_ESP	0xe58b
+
+#define	DT_ISJ32(op16)	(((op16) & 0xfff0) == 0x0f80)
+#define	DT_ISJ8(op8)	(((op8) & 0xf0) == 0x70)
+
+#define	DT_MODRM_REG(modrm)	(((modrm) >> 3) & 0x7)
+
+static int dt_instr_size(uchar_t *, dtrace_hdl_t *, pid_t, uintptr_t, char);
+
+/*ARGSUSED*/
+int
+dt_pid_create_entry_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp)
+{
+	ftp->ftps_type = DTFTP_ENTRY;
+	ftp->ftps_pc = (uintptr_t)symp->st_value;
+	ftp->ftps_size = (size_t)symp->st_size;
+	ftp->ftps_noffs = 1;
+	ftp->ftps_offs[0] = 0;
+
+	if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+		dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+		    strerror(errno));
+		return (dt_set_errno(dtp, errno));
+	}
+
+	return (1);
+}
+
+static int
+dt_pid_has_jump_table(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    uint8_t *text, fasttrap_probe_spec_t *ftp, const GElf_Sym *symp)
+{
+	ulong_t i;
+	int size;
+	pid_t pid = Pstatus(P)->pr_pid;
+	char dmodel = Pstatus(P)->pr_dmodel;
+
+	/*
+	 * Take a pass through the function looking for a register-dependant
+	 * jmp instruction. This could be a jump table so we have to be
+	 * ultra conservative.
+	 */
+	for (i = 0; i < ftp->ftps_size; i += size) {
+		size = dt_instr_size(&text[i], dtp, pid, symp->st_value + i,
+		    dmodel);
+
+		/*
+		 * Assume the worst if we hit an illegal instruction.
+		 */
+		if (size <= 0) {
+			dt_dprintf("error at %#lx (assuming jump table)\n", i);
+			return (1);
+		}
+
+		/*
+		 * Register-dependant jmp instructions start with a 0xff byte
+		 * and have the modrm.reg field set to 4. They can have an
+		 * optional REX prefix on the 64-bit ISA.
+		 */
+		if ((text[i] == 0xff && DT_MODRM_REG(text[i + 1]) == 4) ||
+		    (dmodel == PR_MODEL_LP64 && (text[i] & 0xf0) == 0x40 &&
+		    text[i + 1] == 0xff && DT_MODRM_REG(text[i + 2]) == 4)) {
+			dt_dprintf("found a suspected jump table at %s:%lx\n",
+			    ftp->ftps_func, i);
+			return (1);
+		}
+	}
+
+	return (0);
+}
+
+/*ARGSUSED*/
+int
+dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, uint64_t *stret)
+{
+	uint8_t *text;
+	ulong_t i, end;
+	int size;
+	pid_t pid = Pstatus(P)->pr_pid;
+	char dmodel = Pstatus(P)->pr_dmodel;
+
+	/*
+	 * We allocate a few extra bytes at the end so we don't have to check
+	 * for overrunning the buffer.
+	 */
+	if ((text = calloc(1, symp->st_size + 4)) == NULL) {
+		dt_dprintf("mr sparkle: malloc() failed\n");
+		return (DT_PROC_ERR);
+	}
+
+	if (Pread(P, text, symp->st_size, symp->st_value) != symp->st_size) {
+		dt_dprintf("mr sparkle: Pread() failed\n");
+		free(text);
+		return (DT_PROC_ERR);
+	}
+
+	ftp->ftps_type = DTFTP_RETURN;
+	ftp->ftps_pc = (uintptr_t)symp->st_value;
+	ftp->ftps_size = (size_t)symp->st_size;
+	ftp->ftps_noffs = 0;
+
+	/*
+	 * If there's a jump table in the function we're only willing to
+	 * instrument these specific (and equivalent) instruction sequences:
+	 *	leave
+	 *	[rep] ret
+	 * and
+	 *	movl	%ebp,%esp
+	 *	popl	%ebp
+	 *	[rep] ret
+	 *
+	 * We do this to avoid accidentally interpreting jump table
+	 * offsets as actual instructions.
+	 */
+	if (dt_pid_has_jump_table(P, dtp, text, ftp, symp)) {
+		for (i = 0, end = ftp->ftps_size; i < end; i += size) {
+			size = dt_instr_size(&text[i], dtp, pid,
+			    symp->st_value + i, dmodel);
+
+			/* bail if we hit an invalid opcode */
+			if (size <= 0)
+				break;
+
+			if (text[i] == DT_LEAVE && text[i + 1] == DT_RET) {
+				dt_dprintf("leave/ret at %lx\n", i + 1);
+				ftp->ftps_offs[ftp->ftps_noffs++] = i + 1;
+				size = 2;
+			} else if (text[i] == DT_LEAVE &&
+			    text[i + 1] == DT_REP && text[i + 2] == DT_RET) {
+				dt_dprintf("leave/rep ret at %lx\n", i + 1);
+				ftp->ftps_offs[ftp->ftps_noffs++] = i + 1;
+				size = 3;
+			} else if (*(uint16_t *)&text[i] == DT_MOVL_EBP_ESP &&
+			    text[i + 2] == DT_POPL_EBP &&
+			    text[i + 3] == DT_RET) {
+				dt_dprintf("movl/popl/ret at %lx\n", i + 3);
+				ftp->ftps_offs[ftp->ftps_noffs++] = i + 3;
+				size = 4;
+			} else if (*(uint16_t *)&text[i] == DT_MOVL_EBP_ESP &&
+			    text[i + 2] == DT_POPL_EBP &&
+			    text[i + 3] == DT_REP &&
+			    text[i + 4] == DT_RET) {
+				dt_dprintf("movl/popl/rep ret at %lx\n", i + 3);
+				ftp->ftps_offs[ftp->ftps_noffs++] = i + 3;
+				size = 5;
+			}
+		}
+	} else {
+		for (i = 0, end = ftp->ftps_size; i < end; i += size) {
+			size = dt_instr_size(&text[i], dtp, pid,
+			    symp->st_value + i, dmodel);
+
+			/* bail if we hit an invalid opcode */
+			if (size <= 0)
+				break;
+
+			/* ordinary ret */
+			if (size == 1 && text[i] == DT_RET)
+				goto is_ret;
+
+			/* two-byte ret */
+			if (size == 2 && text[i] == DT_REP &&
+			    text[i + 1] == DT_RET)
+				goto is_ret;
+
+			/* ret <imm16> */
+			if (size == 3 && text[i] == DT_RET16)
+				goto is_ret;
+
+			/* two-byte ret <imm16> */
+			if (size == 4 && text[i] == DT_REP &&
+			    text[i + 1] == DT_RET16)
+				goto is_ret;
+
+			/* 32-bit displacement jmp outside of the function */
+			if (size == 5 && text[i] == DT_JMP32 && symp->st_size <=
+			    (uintptr_t)(i + size + *(int32_t *)&text[i + 1]))
+				goto is_ret;
+
+			/* 8-bit displacement jmp outside of the function */
+			if (size == 2 && text[i] == DT_JMP8 && symp->st_size <=
+			    (uintptr_t)(i + size + *(int8_t *)&text[i + 1]))
+				goto is_ret;
+
+			/* 32-bit disp. conditional jmp outside of the func. */
+			if (size == 6 && DT_ISJ32(*(uint16_t *)&text[i]) &&
+			    symp->st_size <=
+			    (uintptr_t)(i + size + *(int32_t *)&text[i + 2]))
+				goto is_ret;
+
+			/* 8-bit disp. conditional jmp outside of the func. */
+			if (size == 2 && DT_ISJ8(text[i]) && symp->st_size <=
+			    (uintptr_t)(i + size + *(int8_t *)&text[i + 1]))
+				goto is_ret;
+
+			continue;
+is_ret:
+			dt_dprintf("return at offset %lx\n", i);
+			ftp->ftps_offs[ftp->ftps_noffs++] = i;
+		}
+	}
+
+	free(text);
+	if (ftp->ftps_noffs > 0) {
+		if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+			dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+			    strerror(errno));
+			return (dt_set_errno(dtp, errno));
+		}
+	}
+
+	return (ftp->ftps_noffs);
+}
+
+/*ARGSUSED*/
+int
+dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, ulong_t off)
+{
+	ftp->ftps_type = DTFTP_OFFSETS;
+	ftp->ftps_pc = (uintptr_t)symp->st_value;
+	ftp->ftps_size = (size_t)symp->st_size;
+	ftp->ftps_noffs = 1;
+
+	if (strcmp("-", ftp->ftps_func) == 0) {
+		ftp->ftps_offs[0] = off;
+	} else {
+		uint8_t *text;
+		ulong_t i;
+		int size;
+		pid_t pid = Pstatus(P)->pr_pid;
+		char dmodel = Pstatus(P)->pr_dmodel;
+
+		if ((text = malloc(symp->st_size)) == NULL) {
+			dt_dprintf("mr sparkle: malloc() failed\n");
+			return (DT_PROC_ERR);
+		}
+
+		if (Pread(P, text, symp->st_size, symp->st_value) !=
+		    symp->st_size) {
+			dt_dprintf("mr sparkle: Pread() failed\n");
+			free(text);
+			return (DT_PROC_ERR);
+		}
+
+		/*
+		 * We can't instrument offsets in functions with jump tables
+		 * as we might interpret a jump table offset as an
+		 * instruction.
+		 */
+		if (dt_pid_has_jump_table(P, dtp, text, ftp, symp)) {
+			free(text);
+			return (0);
+		}
+
+		for (i = 0; i < symp->st_size; i += size) {
+			if (i == off) {
+				ftp->ftps_offs[0] = i;
+				break;
+			}
+
+			/*
+			 * If we've passed the desired offset without a
+			 * match, then the given offset must not lie on a
+			 * instruction boundary.
+			 */
+			if (i > off) {
+				free(text);
+				return (DT_PROC_ALIGN);
+			}
+
+			size = dt_instr_size(&text[i], dtp, pid,
+			    symp->st_value + i, dmodel);
+
+			/*
+			 * If we hit an invalid instruction, bail as if we
+			 * couldn't find the offset.
+			 */
+			if (size <= 0) {
+				free(text);
+				return (DT_PROC_ALIGN);
+			}
+		}
+
+		free(text);
+	}
+
+	if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+		dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+		    strerror(errno));
+		return (dt_set_errno(dtp, errno));
+	}
+
+	return (ftp->ftps_noffs);
+}
+
+/*ARGSUSED*/
+int
+dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern)
+{
+	uint8_t *text;
+	int size;
+	ulong_t i, end = symp->st_size;
+	pid_t pid = Pstatus(P)->pr_pid;
+	char dmodel = Pstatus(P)->pr_dmodel;
+
+	ftp->ftps_type = DTFTP_OFFSETS;
+	ftp->ftps_pc = (uintptr_t)symp->st_value;
+	ftp->ftps_size = (size_t)symp->st_size;
+	ftp->ftps_noffs = 0;
+
+	if ((text = malloc(symp->st_size)) == NULL) {
+		dt_dprintf("mr sparkle: malloc() failed\n");
+		return (DT_PROC_ERR);
+	}
+
+	if (Pread(P, text, symp->st_size, symp->st_value) != symp->st_size) {
+		dt_dprintf("mr sparkle: Pread() failed\n");
+		free(text);
+		return (DT_PROC_ERR);
+	}
+
+	/*
+	 * We can't instrument offsets in functions with jump tables as
+	 * we might interpret a jump table offset as an instruction.
+	 */
+	if (dt_pid_has_jump_table(P, dtp, text, ftp, symp)) {
+		free(text);
+		return (0);
+	}
+
+	if (strcmp("*", pattern) == 0) {
+		for (i = 0; i < end; i += size) {
+			ftp->ftps_offs[ftp->ftps_noffs++] = i;
+
+			size = dt_instr_size(&text[i], dtp, pid,
+			    symp->st_value + i, dmodel);
+
+			/* bail if we hit an invalid opcode */
+			if (size <= 0)
+				break;
+		}
+	} else {
+		char name[sizeof (i) * 2 + 1];
+
+		for (i = 0; i < end; i += size) {
+			(void) snprintf(name, sizeof (name), "%x", i);
+			if (gmatch(name, pattern))
+				ftp->ftps_offs[ftp->ftps_noffs++] = i;
+
+			size = dt_instr_size(&text[i], dtp, pid,
+			    symp->st_value + i, dmodel);
+
+			/* bail if we hit an invalid opcode */
+			if (size <= 0)
+				break;
+		}
+	}
+
+	free(text);
+	if (ftp->ftps_noffs > 0) {
+		if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+			dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+			    strerror(errno));
+			return (dt_set_errno(dtp, errno));
+		}
+	}
+
+	return (ftp->ftps_noffs);
+}
+
+typedef struct dtrace_dis {
+	uchar_t	*instr;
+	dtrace_hdl_t *dtp;
+	pid_t pid;
+	uintptr_t addr;
+} dtrace_dis_t;
+
+static int
+dt_getbyte(void *data)
+{
+	dtrace_dis_t	*dis = data;
+	int ret = *dis->instr;
+
+	if (ret == FASTTRAP_INSTR) {
+		fasttrap_instr_query_t instr;
+
+		instr.ftiq_pid = dis->pid;
+		instr.ftiq_pc = dis->addr;
+
+		/*
+		 * If we hit a byte that looks like the fasttrap provider's
+		 * trap instruction (which doubles as the breakpoint
+		 * instruction for debuggers) we need to query the kernel
+		 * for the real value. This may just be part of an immediate
+		 * value so there's no need to return an error if the
+		 * kernel doesn't know about this address.
+		 */
+		if (ioctl(dis->dtp->dt_ftfd, FASTTRAPIOC_GETINSTR, &instr) == 0)
+			ret = instr.ftiq_instr;
+	}
+
+	dis->addr++;
+	dis->instr++;
+
+	return (ret);
+}
+
+static int
+dt_instr_size(uchar_t *instr, dtrace_hdl_t *dtp, pid_t pid, uintptr_t addr,
+    char dmodel)
+{
+	dtrace_dis_t data;
+	dis86_t x86dis;
+	uint_t cpu_mode;
+
+	data.instr = instr;
+	data.dtp = dtp;
+	data.pid = pid;
+	data.addr = addr;
+
+	x86dis.d86_data = &data;
+	x86dis.d86_get_byte = dt_getbyte;
+	x86dis.d86_check_func = NULL;
+
+	cpu_mode = (dmodel == PR_MODEL_ILP32) ? SIZE32 : SIZE64;
+
+	if (dtrace_disx86(&x86dis, cpu_mode) != 0)
+		return (-1);
+
+	/*
+	 * If the instruction was a single-byte breakpoint, there may be
+	 * another debugger attached to this process. The original instruction
+	 * can't be recovered so this must fail.
+	 */
+	if (x86dis.d86_len == 1 && instr[0] == FASTTRAP_INSTR)
+		return (-1);
+
+	return (x86dis.d86_len);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/regs.d.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/regs.d.in
new file mode 100644
index 0000000..3328f33
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/regs.d.in
@@ -0,0 +1,117 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+inline int R_GS = @GS@;
+#pragma D binding "1.0" R_GS
+inline int R_FS = @FS@;
+#pragma D binding "1.0" R_FS
+inline int R_ES = @ES@;
+#pragma D binding "1.0" R_ES
+inline int R_DS = @DS@;
+#pragma D binding "1.0" R_DS
+
+inline int R_EDI = @EDI@;
+#pragma D binding "1.0" R_EDI
+inline int R_ESI = @ESI@;
+#pragma D binding "1.0" R_ESI
+inline int R_EBP = @EBP@;
+#pragma D binding "1.0" R_EBP
+inline int R_ESP = @ESP@;
+#pragma D binding "1.0" R_ESP
+inline int R_EBX = @EBX@;
+#pragma D binding "1.0" R_EBX
+inline int R_EDX = @EDX@;
+#pragma D binding "1.0" R_EDX
+inline int R_ECX = @ECX@;
+#pragma D binding "1.0" R_ECX
+inline int R_EAX = @EAX@;
+#pragma D binding "1.0" R_EAX
+
+inline int R_TRAPNO = @TRAPNO@;
+#pragma D binding "1.0" R_TRAPNO
+inline int R_ERR = @ERR@;
+#pragma D binding "1.0" R_ERR
+inline int R_EIP = @EIP@;
+#pragma D binding "1.0" R_EIP
+inline int R_CS = @CS@;
+#pragma D binding "1.0" R_CS
+inline int R_EFL = @EFL@;
+#pragma D binding "1.0" R_EFL
+inline int R_UESP = @UESP@;
+#pragma D binding "1.0" R_UESP
+inline int R_SS = @SS@;
+#pragma D binding "1.0" R_SS
+
+inline int R_PC = R_EIP;
+#pragma D binding "1.0" R_PC
+inline int R_SP = R_UESP;
+#pragma D binding "1.0" R_SP
+inline int R_PS = R_EFL;
+#pragma D binding "1.0" R_PS
+inline int R_R0 = R_EAX;
+#pragma D binding "1.0" R_R0
+inline int R_R1 = R_EBX;
+#pragma D binding "1.0" R_R1
+
+inline int R_RSP = @REG_RSP@;
+#pragma D binding "1.0" R_RSP
+inline int R_RFL = @REG_RFL@;
+#pragma D binding "1.0" R_RFL
+inline int R_RIP = @REG_RIP@;
+#pragma D binding "1.0" R_RIP
+inline int R_RAX = @REG_RAX@;
+#pragma D binding "1.0" R_RAX
+inline int R_RCX = @REG_RCX@;
+#pragma D binding "1.0" R_RCX
+inline int R_RDX = @REG_RDX@;
+#pragma D binding "1.0" R_RDX
+inline int R_RBX = @REG_RBX@;
+#pragma D binding "1.0" R_RBX
+inline int R_RBP = @REG_RBP@;
+#pragma D binding "1.0" R_RBP
+inline int R_RSI = @REG_RSI@;
+#pragma D binding "1.0" R_RSI
+inline int R_RDI = @REG_RDI@;
+#pragma D binding "1.0" R_RDI
+inline int R_R8 = @REG_R8@;
+#pragma D binding "1.0" R_R8
+inline int R_R9 = @REG_R9@;
+#pragma D binding "1.0" R_R9
+inline int R_R10 = @REG_R10@;
+#pragma D binding "1.0" R_R10
+inline int R_R11 = @REG_R11@;
+#pragma D binding "1.0" R_R11
+inline int R_R12 = @REG_R12@;
+#pragma D binding "1.0" R_R12
+inline int R_R13 = @REG_R13@;
+#pragma D binding "1.0" R_R13
+inline int R_R14 = @REG_R14@;
+#pragma D binding "1.0" R_R14
+inline int R_R15 = @REG_R15@;
+#pragma D binding "1.0" R_R15
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/regs.sed.in b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/regs.sed.in
new file mode 100644
index 0000000..2b2080f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/i386/regs.sed.in
@@ -0,0 +1,82 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * This file is a sed script which is first preprocessed by cpp or cc -E to
+ * define a set of sed directives which replace #define tokens with their
+ * values.  After preprocessing, whitespace is eliminated, and any @ symbols
+ * are translated into single space.  The resulting sed script is then run
+ * over regs.d.in to replace the #define tokens listed below to create the
+ * finished regs.d.  Refer to the rules in libdtrace/i386/Makefile for more
+ * information.
+ */
+
+#include <sys/regset.h>
+
+#define	SED_REPLACE(x)		s/#x/x/g
+#define	SED_REPLACE64(x)	s/#x/SS @+ at 1@+@ x/g
+
+SED_REPLACE(GS)
+SED_REPLACE(FS)
+SED_REPLACE(ES)
+SED_REPLACE(DS)
+SED_REPLACE(EDI)
+SED_REPLACE(ESI)
+SED_REPLACE(EBP)
+SED_REPLACE(ESP)
+SED_REPLACE(EBX)
+SED_REPLACE(EDX)
+SED_REPLACE(ECX)
+SED_REPLACE(EAX)
+SED_REPLACE(TRAPNO)
+SED_REPLACE(ERR)
+SED_REPLACE(EIP)
+SED_REPLACE(CS)
+SED_REPLACE(EFL)
+SED_REPLACE(UESP)
+SED_REPLACE(SS)
+
+SED_REPLACE64(REG_RSP)
+SED_REPLACE64(REG_RFL)
+SED_REPLACE64(REG_RIP)
+SED_REPLACE64(REG_RAX)
+SED_REPLACE64(REG_RCX)
+SED_REPLACE64(REG_RDX)
+SED_REPLACE64(REG_RBX)
+SED_REPLACE64(REG_RBP)
+SED_REPLACE64(REG_RSI)
+SED_REPLACE64(REG_RDI)
+SED_REPLACE64(REG_R8)
+SED_REPLACE64(REG_R9)
+SED_REPLACE64(REG_R10)
+SED_REPLACE64(REG_R11)
+SED_REPLACE64(REG_R12)
+SED_REPLACE64(REG_R13)
+SED_REPLACE64(REG_R14)
+SED_REPLACE64(REG_R15)
+
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/Makefile
new file mode 100644
index 0000000..99c63ef
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/Makefile
@@ -0,0 +1,33 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+ASFLAGS += -D_ASM -K PIC -P
+
+include ../Makefile.com
+
+install yydebug: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) \
+	$(ROOTDLIBS) $(ROOTDOBJS)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/dt_isadep.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/dt_isadep.c
new file mode 100644
index 0000000..ed05275
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/dt_isadep.c
@@ -0,0 +1,338 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <stdlib.h>
+#include <assert.h>
+#include <errno.h>
+#include <string.h>
+#include <libgen.h>
+
+#include <dt_impl.h>
+#include <dt_pid.h>
+
+#define	OP(x)		((x) >> 30)
+#define	OP2(x)		(((x) >> 22) & 0x07)
+#define	COND(x)		(((x) >> 25) & 0x0f)
+#define	A(x)		(((x) >> 29) & 0x01)
+
+#define	OP_BRANCH	0
+
+#define	OP2_BPcc	0x1
+#define	OP2_Bicc	0x2
+#define	OP2_BPr		0x3
+#define	OP2_FBPfcc	0x5
+#define	OP2_FBfcc	0x6
+
+/*ARGSUSED*/
+int
+dt_pid_create_entry_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp)
+{
+	ftp->ftps_type = DTFTP_ENTRY;
+	ftp->ftps_pc = (uintptr_t)symp->st_value;
+	ftp->ftps_size = (size_t)symp->st_size;
+	ftp->ftps_noffs = 1;
+	ftp->ftps_offs[0] = 0;
+
+	if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+		dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+		    strerror(errno));
+		return (dt_set_errno(dtp, errno));
+	}
+
+	return (1);
+}
+
+int
+dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, uint64_t *stret)
+{
+
+	uint32_t *text;
+	int i;
+	int srdepth = 0;
+
+	if ((text = malloc(symp->st_size + 4)) == NULL) {
+		dt_dprintf("mr sparkle: malloc() failed\n");
+		return (DT_PROC_ERR);
+	}
+
+	if (Pread(P, text, symp->st_size, symp->st_value) != symp->st_size) {
+		dt_dprintf("mr sparkle: Pread() failed\n");
+		free(text);
+		return (DT_PROC_ERR);
+	}
+
+	/*
+	 * Leave a dummy instruction in the last slot to simplify edge
+	 * conditions.
+	 */
+	text[symp->st_size / 4] = 0;
+
+	ftp->ftps_type = DTFTP_RETURN;
+	ftp->ftps_pc = symp->st_value;
+	ftp->ftps_size = symp->st_size;
+	ftp->ftps_noffs = 0;
+
+	for (i = 0; i < symp->st_size / 4; i++) {
+		/*
+		 * If we encounter an existing tracepoint, query the
+		 * kernel to find out the instruction that was
+		 * replaced at this spot.
+		 */
+		while (text[i] == FASTTRAP_INSTR) {
+			fasttrap_instr_query_t instr;
+
+			instr.ftiq_pid = Pstatus(P)->pr_pid;
+			instr.ftiq_pc = symp->st_value + i * 4;
+
+			if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_GETINSTR,
+			    &instr) != 0) {
+
+				if (errno == ESRCH || errno == ENOENT) {
+					if (Pread(P, &text[i], 4,
+					    instr.ftiq_pc) != 4) {
+						dt_dprintf("mr sparkle: "
+						    "Pread() failed\n");
+						free(text);
+						return (DT_PROC_ERR);
+					}
+					continue;
+				}
+
+				free(text);
+				dt_dprintf("mr sparkle: getinstr query "
+				    "failed: %s\n", strerror(errno));
+				return (DT_PROC_ERR);
+			}
+
+			text[i] = instr.ftiq_instr;
+			break;
+		}
+
+		/* save */
+		if ((text[i] & 0xc1f80000) == 0x81e00000) {
+			srdepth++;
+			continue;
+		}
+
+		/* restore */
+		if ((text[i] & 0xc1f80000) == 0x81e80000) {
+			srdepth--;
+			continue;
+		}
+
+		if (srdepth > 0) {
+			/* ret */
+			if (text[i] == 0x81c7e008)
+				goto is_ret;
+
+			/* return */
+			if (text[i] == 0x81cfe008)
+				goto is_ret;
+
+			/* call or jmpl w/ restore in the slot */
+			if (((text[i] & 0xc0000000) == 0x40000000 ||
+			    (text[i] & 0xc1f80000) == 0x81c00000) &&
+			    (text[i + 1] & 0xc1f80000) == 0x81e80000)
+				goto is_ret;
+
+			/* call to one of the stret routines */
+			if ((text[i] & 0xc0000000) == 0x40000000) {
+				int32_t	disp = text[i] << 2;
+				uint64_t dest = ftp->ftps_pc + i * 4 + disp;
+
+				dt_dprintf("dest = %llx\n", (u_longlong_t)dest);
+
+				if (dest == stret[0] || dest == stret[1] ||
+				    dest == stret[2] || dest == stret[3])
+					goto is_ret;
+			}
+		} else {
+			/* external call */
+			if ((text[i] & 0xc0000000) == 0x40000000) {
+				int32_t dst = text[i] << 2;
+
+				dst += i * 4;
+
+				if ((uintptr_t)dst >= (uintptr_t)symp->st_size)
+					goto is_ret;
+			}
+
+			/* jmpl into %g0 -- this includes the retl pseudo op */
+			if ((text[i] & 0xfff80000) == 0x81c00000)
+				goto is_ret;
+
+			/* external branch -- possible return site */
+			if (OP(text[i]) == OP_BRANCH) {
+				int32_t dst;
+				int baa;
+
+				switch (OP2(text[i])) {
+				case OP2_BPcc:
+					dst = text[i] & 0x7ffff;
+					dst <<= 13;
+					dst >>= 11;
+
+					baa = COND(text[i]) == 8 && A(text[i]);
+					break;
+				case OP2_Bicc:
+					dst = text[i] & 0x3fffff;
+					dst <<= 10;
+					dst >>= 8;
+
+					baa = COND(text[i]) == 8 && A(text[i]);
+					break;
+				case OP2_BPr:
+					dst = (((text[i]) >> 6) & 0xc000) |
+					    ((text[i]) & 0x3fff);
+					dst <<= 16;
+					dst >>= 14;
+
+					baa = 0;
+					break;
+				case OP2_FBPfcc:
+					dst = text[i] & 0x7ffff;
+					dst <<= 13;
+					dst >>= 11;
+
+					baa = COND(text[i]) == 8 && A(text[i]);
+					break;
+				case OP2_FBfcc:
+					dst = text[i] & 0x3fffff;
+					dst <<= 10;
+					dst >>= 8;
+
+					baa = COND(text[i]) == 8 && A(text[i]);
+					break;
+				default:
+					continue;
+				}
+
+				dst += i * 4;
+
+				/*
+				 * Interpret branches outside of the function's
+				 * bounds as potential return sites. If the
+				 * branch is a ba,a don't skip the instruction
+				 * in the delay slot.
+				 */
+				if ((uintptr_t)dst >=
+				    (uintptr_t)symp->st_size) {
+					if (baa)
+						goto is_ret_baa;
+					else
+						goto is_ret;
+				}
+			}
+		}
+
+		continue;
+is_ret:
+		i++;
+is_ret_baa:
+		dt_dprintf("return at offset %x\n", i * 4);
+		ftp->ftps_offs[ftp->ftps_noffs++] = i * 4;
+	}
+
+	free(text);
+	if (ftp->ftps_noffs > 0) {
+		if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+			dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+			    strerror(errno));
+			return (dt_set_errno(dtp, errno));
+		}
+	}
+
+
+	return (ftp->ftps_noffs);
+}
+
+/*ARGSUSED*/
+int
+dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, ulong_t off)
+{
+	if (off & 0x3)
+		return (DT_PROC_ALIGN);
+
+	ftp->ftps_type = DTFTP_OFFSETS;
+	ftp->ftps_pc = (uintptr_t)symp->st_value;
+	ftp->ftps_size = (size_t)symp->st_size;
+	ftp->ftps_noffs = 1;
+	ftp->ftps_offs[0] = off;
+
+	if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+		dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+		    strerror(errno));
+		return (dt_set_errno(dtp, errno));
+	}
+
+	return (1);
+}
+
+/*ARGSUSED*/
+int
+dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp,
+    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern)
+{
+	ulong_t i;
+
+	ftp->ftps_type = DTFTP_OFFSETS;
+	ftp->ftps_pc = (uintptr_t)symp->st_value;
+	ftp->ftps_size = (size_t)symp->st_size;
+	ftp->ftps_noffs = 0;
+
+	/*
+	 * If we're matching against everything, just iterate through each
+	 * instruction in the function, otherwise look for matching offset
+	 * names by constructing the string and comparing it against the
+	 * pattern.
+	 */
+	if (strcmp("*", pattern) == 0) {
+		for (i = 0; i < symp->st_size; i += 4) {
+			ftp->ftps_offs[ftp->ftps_noffs++] = i;
+		}
+	} else {
+		char name[sizeof (i) * 2 + 1];
+
+		for (i = 0; i < symp->st_size; i += 4) {
+			(void) sprintf(name, "%lx", i);
+			if (gmatch(name, pattern))
+				ftp->ftps_offs[ftp->ftps_noffs++] = i;
+		}
+	}
+
+	if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
+		dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
+		    strerror(errno));
+		return (dt_set_errno(dtp, errno));
+	}
+
+	return (ftp->ftps_noffs);
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/regs.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/regs.d
new file mode 100644
index 0000000..7c4bc0f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparc/regs.d
@@ -0,0 +1,120 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+inline int R_G0	= 0;
+#pragma D binding "1.0" R_G0
+inline int R_G1	= 1;
+#pragma D binding "1.0" R_G1
+inline int R_G2	= 2;
+#pragma D binding "1.0" R_G2
+inline int R_G3	= 3;
+#pragma D binding "1.0" R_G3
+inline int R_G4	= 4;
+#pragma D binding "1.0" R_G4
+inline int R_G5	= 5;
+#pragma D binding "1.0" R_G5
+inline int R_G6	= 6;
+#pragma D binding "1.0" R_G6
+inline int R_G7	= 7;
+#pragma D binding "1.0" R_G7
+
+inline int R_O0	= 8;
+#pragma D binding "1.0" R_O0
+inline int R_O1	= 9;
+#pragma D binding "1.0" R_O1
+inline int R_O2	= 10;
+#pragma D binding "1.0" R_O2
+inline int R_O3	= 11;
+#pragma D binding "1.0" R_O3
+inline int R_O4	= 12;
+#pragma D binding "1.0" R_O4
+inline int R_O5	= 13;
+#pragma D binding "1.0" R_O5
+inline int R_O6	= 14;
+#pragma D binding "1.0" R_O6
+inline int R_O7	= 15;
+#pragma D binding "1.0" R_O7
+
+inline int R_L0	= 16;
+#pragma D binding "1.0" R_L0
+inline int R_L1	= 17;
+#pragma D binding "1.0" R_L1
+inline int R_L2	= 18;
+#pragma D binding "1.0" R_L2
+inline int R_L3	= 19;
+#pragma D binding "1.0" R_L3
+inline int R_L4	= 20;
+#pragma D binding "1.0" R_L4
+inline int R_L5	= 21;
+#pragma D binding "1.0" R_L5
+inline int R_L6	= 22;
+#pragma D binding "1.0" R_L6
+inline int R_L7	= 23;
+#pragma D binding "1.0" R_L7
+
+inline int R_I0	= 24;
+#pragma D binding "1.0" R_I0
+inline int R_I1	= 25;
+#pragma D binding "1.0" R_I1
+inline int R_I2	= 26;
+#pragma D binding "1.0" R_I2
+inline int R_I3	= 27;
+#pragma D binding "1.0" R_I3
+inline int R_I4	= 28;
+#pragma D binding "1.0" R_I4
+inline int R_I5	= 29;
+#pragma D binding "1.0" R_I5
+inline int R_I6	= 30;
+#pragma D binding "1.0" R_I6
+inline int R_I7	= 31;
+#pragma D binding "1.0" R_I7
+
+inline int R_CCR = 32;
+#pragma D binding "1.0" R_CCR
+inline int R_PC = 33;
+#pragma D binding "1.0" R_PC
+inline int R_nPC = 34;
+#pragma D binding "1.0" R_nPC
+inline int R_NPC = R_nPC;
+#pragma D binding "1.0" R_NPC
+inline int R_Y = 35;
+#pragma D binding "1.0" R_Y
+inline int R_ASI = 36;
+#pragma D binding "1.0" R_ASI
+inline int R_FPRS = 37;
+#pragma D binding "1.0" R_FPRS
+inline int R_PS = R_CCR;
+#pragma D binding "1.0" R_PS
+inline int R_SP = R_O6;
+#pragma D binding "1.0" R_SP
+inline int R_FP = R_I6;
+#pragma D binding "1.0" R_FP
+inline int R_R0 = R_O0;
+#pragma D binding "1.0" R_R0
+inline int R_R1 = R_O1;
+#pragma D binding "1.0" R_R1
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparcv9/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparcv9/Makefile
new file mode 100644
index 0000000..0e3892d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparcv9/Makefile
@@ -0,0 +1,36 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+# ident	"%Z%%M%	%I%	%E% SMI"
+#
+
+ASFLAGS += -D_ASM -K PIC -P
+
+include ../Makefile.com
+include ../../Makefile.lib.64
+
+CPPFLAGS += -D_ELF64
+
+install yydebug: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64) \
+	$(ROOTDLIBS) $(ROOTDOBJS64)
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparcv9/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/sparcv9/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dcpc.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dcpc.c
new file mode 100644
index 0000000..d4ca1d3
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dcpc.c
@@ -0,0 +1,1214 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/errno.h>
+#include <sys/cpuvar.h>
+#include <sys/stat.h>
+#include <sys/modctl.h>
+#include <sys/cmn_err.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/ksynch.h>
+#include <sys/conf.h>
+#include <sys/kmem.h>
+#include <sys/kcpc.h>
+#include <sys/cap_util.h>
+#include <sys/cpc_pcbe.h>
+#include <sys/cpc_impl.h>
+#include <sys/dtrace_impl.h>
+
+/*
+ * DTrace CPU Performance Counter Provider
+ * ---------------------------------------
+ *
+ * The DTrace cpc provider allows DTrace consumers to access the CPU
+ * performance counter overflow mechanism of a CPU. The configuration
+ * presented in a probe specification is programmed into the performance
+ * counter hardware of all available CPUs on a system. Programming the
+ * hardware causes a counter on each CPU to begin counting events of the
+ * given type. When the specified number of events have occurred, an overflow
+ * interrupt will be generated and the probe is fired.
+ *
+ * The required configuration for the performance counter is encoded into
+ * the probe specification and this includes the performance counter event
+ * name, processor mode, overflow rate and an optional unit mask.
+ *
+ * Most processors provide several counters (PICs) which can count all or a
+ * subset of the events available for a given CPU. However, when overflow
+ * profiling is being used, not all CPUs can detect which counter generated the
+ * overflow interrupt. In this case we cannot reliably determine which counter
+ * overflowed and we therefore only allow such CPUs to configure one event at
+ * a time. Processors that can determine the counter which overflowed are
+ * allowed to program as many events at one time as possible (in theory up to
+ * the number of instrumentation counters supported by that platform).
+ * Therefore, multiple consumers can enable multiple probes at the same time
+ * on such platforms. Platforms which cannot determine the source of an
+ * overflow interrupt are only allowed to program a single event at one time.
+ *
+ * The performance counter hardware is made available to consumers on a
+ * first-come, first-served basis. Only a finite amount of hardware resource
+ * is available and, while we make every attempt to accomodate requests from
+ * consumers, we must deny requests when hardware resources have been exhausted.
+ * A consumer will fail to enable probes when resources are currently in use.
+ *
+ * The cpc provider contends for shared hardware resources along with other
+ * consumers of the kernel CPU performance counter subsystem (e.g. cpustat(1M)).
+ * Only one such consumer can use the performance counters at any one time and
+ * counters are made available on a first-come, first-served basis. As with
+ * cpustat, the cpc provider has priority over per-LWP libcpc usage (e.g.
+ * cputrack(1)). Invoking the cpc provider will cause all existing per-LWP
+ * counter contexts to be invalidated.
+ */
+
+typedef struct dcpc_probe {
+	char		dcpc_event_name[CPC_MAX_EVENT_LEN];
+	int		dcpc_flag;	/* flags (USER/SYS) */
+	uint32_t	dcpc_ovfval;	/* overflow value */
+	int64_t		dcpc_umask;	/* umask/emask for this event */
+	int		dcpc_picno;	/* pic this event is programmed in */
+	int		dcpc_enabled;	/* probe is actually enabled? */
+	int		dcpc_disabling;	/* probe is currently being disabled */
+	dtrace_id_t	dcpc_id;	/* probeid this request is enabling */
+	int		dcpc_actv_req_idx;	/* idx into dcpc_actv_reqs[] */
+} dcpc_probe_t;
+
+static dev_info_t			*dcpc_devi;
+static dtrace_provider_id_t		dcpc_pid;
+static dcpc_probe_t			**dcpc_actv_reqs;
+static uint32_t				dcpc_enablings = 0;
+static int				dcpc_ovf_mask = 0;
+static int				dcpc_mult_ovf_cap = 0;
+static int				dcpc_mask_type = 0;
+
+/*
+ * When the dcpc provider is loaded, dcpc_min_overflow is set to either
+ * DCPC_MIN_OVF_DEFAULT or the value that dcpc-min-overflow is set to in
+ * the dcpc.conf file. Decrease this value to set probes with smaller
+ * overflow values. Remember that very small values could render a system
+ * unusable with frequently occurring events.
+ */
+#define	DCPC_MIN_OVF_DEFAULT		5000
+static uint32_t				dcpc_min_overflow;
+
+static int dcpc_aframes = 0;	/* override for artificial frame setting */
+#if defined(__x86)
+#define	DCPC_ARTIFICIAL_FRAMES	8
+#elif defined(__sparc)
+#define	DCPC_ARTIFICIAL_FRAMES	2
+#endif
+
+/*
+ * Called from the platform overflow interrupt handler. 'bitmap' is a mask
+ * which contains the pic(s) that have overflowed.
+ */
+static void
+dcpc_fire(uint64_t bitmap)
+{
+	int i;
+
+	/*
+	 * No counter was marked as overflowing. Shout about it and get out.
+	 */
+	if ((bitmap & dcpc_ovf_mask) == 0) {
+		cmn_err(CE_NOTE, "dcpc_fire: no counter overflow found\n");
+		return;
+	}
+
+	/*
+	 * This is the common case of a processor that doesn't support
+	 * multiple overflow events. Such systems are only allowed a single
+	 * enabling and therefore we just look for the first entry in
+	 * the active request array.
+	 */
+	if (!dcpc_mult_ovf_cap) {
+		for (i = 0; i < cpc_ncounters; i++) {
+			if (dcpc_actv_reqs[i] != NULL) {
+				dtrace_probe(dcpc_actv_reqs[i]->dcpc_id,
+				    CPU->cpu_cpcprofile_pc,
+				    CPU->cpu_cpcprofile_upc, 0, 0, 0);
+				return;
+			}
+		}
+		return;
+	}
+
+	/*
+	 * This is a processor capable of handling multiple overflow events.
+	 * Iterate over the array of active requests and locate the counters
+	 * that overflowed (note: it is possible for more than one counter to
+	 * have overflowed at the same time).
+	 */
+	for (i = 0; i < cpc_ncounters; i++) {
+		if (dcpc_actv_reqs[i] != NULL &&
+		    (bitmap & (1ULL << dcpc_actv_reqs[i]->dcpc_picno))) {
+			dtrace_probe(dcpc_actv_reqs[i]->dcpc_id,
+			    CPU->cpu_cpcprofile_pc,
+			    CPU->cpu_cpcprofile_upc, 0, 0, 0);
+		}
+	}
+}
+
+static void
+dcpc_create_probe(dtrace_provider_id_t id, const char *probename,
+    char *eventname, int64_t umask, uint32_t ovfval, char flag)
+{
+	dcpc_probe_t *pp;
+	int nr_frames = DCPC_ARTIFICIAL_FRAMES + dtrace_mach_aframes();
+
+	if (dcpc_aframes)
+		nr_frames = dcpc_aframes;
+
+	if (dtrace_probe_lookup(id, NULL, NULL, probename) != 0)
+		return;
+
+	pp = kmem_zalloc(sizeof (dcpc_probe_t), KM_SLEEP);
+	(void) strncpy(pp->dcpc_event_name, eventname,
+	    sizeof (pp->dcpc_event_name) - 1);
+	pp->dcpc_event_name[sizeof (pp->dcpc_event_name) - 1] = '\0';
+	pp->dcpc_flag = flag | CPC_OVF_NOTIFY_EMT;
+	pp->dcpc_ovfval = ovfval;
+	pp->dcpc_umask = umask;
+	pp->dcpc_actv_req_idx = pp->dcpc_picno = pp->dcpc_disabling = -1;
+
+	pp->dcpc_id = dtrace_probe_create(id, NULL, NULL, probename,
+	    nr_frames, pp);
+}
+
+/*ARGSUSED*/
+static void
+dcpc_provide(void *arg, const dtrace_probedesc_t *desc)
+{
+	/*
+	 * The format of a probe is:
+	 *
+	 *	event_name-mode-{optional_umask}-overflow_rate
+	 * e.g.
+	 *	DC_refill_from_system-user-0x1e-50000, or,
+	 *	DC_refill_from_system-all-10000
+	 *
+	 */
+	char *str, *end, *p;
+	int i, flag = 0;
+	char event[CPC_MAX_EVENT_LEN];
+	long umask = -1, val = 0;
+	size_t evlen, len;
+
+	/*
+	 * The 'cpc' provider offers no probes by default.
+	 */
+	if (desc == NULL)
+		return;
+
+	len = strlen(desc->dtpd_name);
+	p = str = kmem_alloc(len + 1, KM_SLEEP);
+	(void) strcpy(str, desc->dtpd_name);
+
+	/*
+	 * We have a poor man's strtok() going on here. Replace any hyphens
+	 * in the the probe name with NULL characters in order to make it
+	 * easy to parse the string with regular string functions.
+	 */
+	for (i = 0; i < len; i++) {
+		if (str[i] == '-')
+			str[i] = '\0';
+	}
+
+	/*
+	 * The first part of the string must be either a platform event
+	 * name or a generic event name.
+	 */
+	evlen = strlen(p);
+	(void) strncpy(event, p, CPC_MAX_EVENT_LEN - 1);
+	event[CPC_MAX_EVENT_LEN - 1] = '\0';
+
+	/*
+	 * The next part of the name is the mode specification. Valid
+	 * settings are "user", "kernel" or "all".
+	 */
+	p += evlen + 1;
+
+	if (strcmp(p, "user") == 0)
+		flag |= CPC_COUNT_USER;
+	else if (strcmp(p, "kernel") == 0)
+		flag |= CPC_COUNT_SYSTEM;
+	else if (strcmp(p, "all") == 0)
+		flag |= CPC_COUNT_USER | CPC_COUNT_SYSTEM;
+	else
+		goto err;
+
+	/*
+	 * Next we either have a mask specification followed by an overflow
+	 * rate or just an overflow rate on its own.
+	 */
+	p += strlen(p) + 1;
+	if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) {
+		/*
+		 * A unit mask can only be specified if:
+		 * 1) this performance counter back end supports masks.
+		 * 2) the specified event is platform specific.
+		 * 3) a valid hex number is converted.
+		 * 4) no extraneous characters follow the mask specification.
+		 */
+		if (dcpc_mask_type != 0 && strncmp(event, "PAPI", 4) != 0 &&
+		    ddi_strtol(p, &end, 16, &umask) == 0 &&
+		    end == p + strlen(p)) {
+			p += strlen(p) + 1;
+		} else {
+			goto err;
+		}
+	}
+
+	/*
+	 * This final part must be an overflow value which has to be greater
+	 * than the minimum permissible overflow rate.
+	 */
+	if ((ddi_strtol(p, &end, 10, &val) != 0) || end != p + strlen(p) ||
+	    val < dcpc_min_overflow)
+		goto err;
+
+	/*
+	 * Validate the event and create the probe.
+	 */
+	for (i = 0; i < cpc_ncounters; i++) {
+		char *events, *cp, *p, *end;
+		int found = 0, j;
+		size_t llen;
+
+		if ((events = kcpc_list_events(i)) == NULL)
+			goto err;
+
+		llen = strlen(events);
+		p = cp = ddi_strdup(events, KM_NOSLEEP);
+		end = cp + llen;
+
+		for (j = 0; j < llen; j++) {
+			if (cp[j] == ',')
+				cp[j] = '\0';
+		}
+
+		while (p < end && found == 0) {
+			if (strcmp(p, event) == 0) {
+				dcpc_create_probe(dcpc_pid, desc->dtpd_name,
+				    event, umask, (uint32_t)val, flag);
+				found = 1;
+			}
+			p += strlen(p) + 1;
+		}
+		kmem_free(cp, llen + 1);
+
+		if (found)
+			break;
+	}
+
+err:
+	kmem_free(str, len + 1);
+}
+
+/*ARGSUSED*/
+static void
+dcpc_destroy(void *arg, dtrace_id_t id, void *parg)
+{
+	dcpc_probe_t *pp = parg;
+
+	ASSERT(pp->dcpc_enabled == 0);
+	kmem_free(pp, sizeof (dcpc_probe_t));
+}
+
+/*ARGSUSED*/
+static int
+dcpc_usermode(void *arg, dtrace_id_t id, void *parg)
+{
+	return (CPU->cpu_cpcprofile_pc == 0);
+}
+
+static void
+dcpc_populate_set(cpu_t *c, dcpc_probe_t *pp, kcpc_set_t *set, int reqno)
+{
+	kcpc_set_t *oset;
+	int i;
+
+	(void) strncpy(set->ks_req[reqno].kr_event, pp->dcpc_event_name,
+	    CPC_MAX_EVENT_LEN);
+	set->ks_req[reqno].kr_config = NULL;
+	set->ks_req[reqno].kr_index = reqno;
+	set->ks_req[reqno].kr_picnum = -1;
+	set->ks_req[reqno].kr_flags =  pp->dcpc_flag;
+
+	/*
+	 * If a unit mask has been specified then detect which attribute
+	 * the platform needs. For now, it's either "umask" or "emask".
+	 */
+	if (pp->dcpc_umask >= 0) {
+		set->ks_req[reqno].kr_attr =
+		    kmem_zalloc(sizeof (kcpc_attr_t), KM_SLEEP);
+		set->ks_req[reqno].kr_nattrs = 1;
+		if (dcpc_mask_type & DCPC_UMASK)
+			(void) strncpy(set->ks_req[reqno].kr_attr->ka_name,
+			    "umask", 5);
+		else
+			(void) strncpy(set->ks_req[reqno].kr_attr->ka_name,
+			    "emask", 5);
+		set->ks_req[reqno].kr_attr->ka_val = pp->dcpc_umask;
+	} else {
+		set->ks_req[reqno].kr_attr = NULL;
+		set->ks_req[reqno].kr_nattrs = 0;
+	}
+
+	/*
+	 * If this probe is enabled, obtain its current countdown value
+	 * and use that. The CPUs cpc context might not exist yet if we
+	 * are dealing with a CPU that is just coming online.
+	 */
+	if (pp->dcpc_enabled && (c->cpu_cpc_ctx != NULL)) {
+		oset = c->cpu_cpc_ctx->kc_set;
+
+		for (i = 0; i < oset->ks_nreqs; i++) {
+			if (strcmp(oset->ks_req[i].kr_event,
+			    set->ks_req[reqno].kr_event) == 0) {
+				set->ks_req[reqno].kr_preset =
+				    *(oset->ks_req[i].kr_data);
+			}
+		}
+	} else {
+		set->ks_req[reqno].kr_preset = UINT64_MAX - pp->dcpc_ovfval;
+	}
+
+	set->ks_nreqs++;
+}
+
+
+/*
+ * Create a fresh request set for the enablings represented in the
+ * 'dcpc_actv_reqs' array which contains the probes we want to be
+ * in the set. This can be called for several reasons:
+ *
+ * 1)	We are on a single or multi overflow platform and we have no
+ *	current events so we can just create the set and initialize it.
+ * 2)	We are on a multi-overflow platform and we already have one or
+ *	more existing events and we are adding a new enabling. Create a
+ *	new set and copy old requests in and then add the new request.
+ * 3)	We are on a multi-overflow platform and we have just removed an
+ *	enabling but we still have enablings whch are valid. Create a new
+ *	set and copy in still valid requests.
+ */
+static kcpc_set_t *
+dcpc_create_set(cpu_t *c)
+{
+	int i, reqno = 0;
+	int active_requests = 0;
+	kcpc_set_t *set;
+
+	/*
+	 * First get a count of the number of currently active requests.
+	 * Note that dcpc_actv_reqs[] should always reflect which requests
+	 * we want to be in the set that is to be created. It is the
+	 * responsibility of the caller of dcpc_create_set() to adjust that
+	 * array accordingly beforehand.
+	 */
+	for (i = 0; i < cpc_ncounters; i++) {
+		if (dcpc_actv_reqs[i] != NULL)
+			active_requests++;
+	}
+
+	set = kmem_zalloc(sizeof (kcpc_set_t), KM_SLEEP);
+
+	set->ks_req =
+	    kmem_zalloc(sizeof (kcpc_request_t) * active_requests, KM_SLEEP);
+
+	set->ks_data =
+	    kmem_zalloc(active_requests * sizeof (uint64_t), KM_SLEEP);
+
+	/*
+	 * Look for valid entries in the active requests array and populate
+	 * the request set for any entries found.
+	 */
+	for (i = 0; i < cpc_ncounters; i++) {
+		if (dcpc_actv_reqs[i] != NULL) {
+			dcpc_populate_set(c, dcpc_actv_reqs[i], set, reqno);
+			reqno++;
+		}
+	}
+
+	return (set);
+}
+
+static int
+dcpc_program_cpu_event(cpu_t *c)
+{
+	int i, j, subcode;
+	kcpc_ctx_t *ctx, *octx;
+	kcpc_set_t *set;
+
+	set = dcpc_create_set(c);
+
+	set->ks_ctx = ctx = kcpc_ctx_alloc(KM_SLEEP);
+	ctx->kc_set = set;
+	ctx->kc_cpuid = c->cpu_id;
+
+	if (kcpc_assign_reqs(set, ctx) != 0)
+		goto err;
+
+	if (kcpc_configure_reqs(ctx, set, &subcode) != 0)
+		goto err;
+
+	for (i = 0; i < set->ks_nreqs; i++) {
+		for (j = 0; j < cpc_ncounters; j++) {
+			if (dcpc_actv_reqs[j] != NULL &&
+			    strcmp(set->ks_req[i].kr_event,
+			    dcpc_actv_reqs[j]->dcpc_event_name) == 0) {
+				dcpc_actv_reqs[j]->dcpc_picno =
+				    set->ks_req[i].kr_picnum;
+			}
+		}
+	}
+
+	/*
+	 * If we already have an active enabling then save the current cpc
+	 * context away.
+	 */
+	octx = c->cpu_cpc_ctx;
+
+	kcpc_cpu_program(c, ctx);
+
+	if (octx != NULL) {
+		kcpc_set_t *oset = octx->kc_set;
+		kmem_free(oset->ks_data, oset->ks_nreqs * sizeof (uint64_t));
+		kcpc_free_configs(oset);
+		kcpc_free_set(oset);
+		kcpc_ctx_free(octx);
+	}
+
+	return (0);
+
+err:
+	/*
+	 * We failed to configure this request up so free things up and
+	 * get out.
+	 */
+	kcpc_free_configs(set);
+	kmem_free(set->ks_data, set->ks_nreqs * sizeof (uint64_t));
+	kcpc_free_set(set);
+	kcpc_ctx_free(ctx);
+
+	return (-1);
+}
+
+static void
+dcpc_disable_cpu(cpu_t *c)
+{
+	kcpc_ctx_t *ctx;
+	kcpc_set_t *set;
+
+	/*
+	 * Leave this CPU alone if it's already offline.
+	 */
+	if (c->cpu_flags & CPU_OFFLINE)
+		return;
+
+	/*
+	 * Grab CPUs CPC context before kcpc_cpu_stop() stops counters and
+	 * changes it.
+	 */
+	ctx = c->cpu_cpc_ctx;
+
+	kcpc_cpu_stop(c, B_FALSE);
+
+	set = ctx->kc_set;
+
+	kcpc_free_configs(set);
+	kmem_free(set->ks_data, set->ks_nreqs * sizeof (uint64_t));
+	kcpc_free_set(set);
+	kcpc_ctx_free(ctx);
+}
+
+/*
+ * The dcpc_*_interrupts() routines are responsible for manipulating the
+ * per-CPU dcpc interrupt state byte. The purpose of the state byte is to
+ * synchronize processing of hardware overflow interrupts wth configuration
+ * changes made to the CPU performance counter subsystem by the dcpc provider.
+ *
+ * The dcpc provider claims ownership of the overflow interrupt mechanism
+ * by transitioning the state byte from DCPC_INTR_INACTIVE (indicating the
+ * dcpc provider is not in use) to DCPC_INTR_FREE (the dcpc provider owns the
+ * overflow mechanism and interrupts may be processed). Before modifying
+ * a CPUs configuration state the state byte is transitioned from
+ * DCPC_INTR_FREE to DCPC_INTR_CONFIG ("configuration in process" state).
+ * The hardware overflow handler, kcpc_hw_overflow_intr(), will only process
+ * an interrupt when a configuration is not in process (i.e. the state is
+ * marked as free). During interrupt processing the state is set to
+ * DCPC_INTR_PROCESSING by the overflow handler. When the last dcpc based
+ * enabling is removed, the state byte is set to DCPC_INTR_INACTIVE to indicate
+ * the dcpc provider is no longer interested in overflow interrupts.
+ */
+static void
+dcpc_block_interrupts(void)
+{
+	cpu_t *c = cpu_list;
+	uint8_t *state;
+
+	ASSERT(cpu_core[c->cpu_id].cpuc_dcpc_intr_state != DCPC_INTR_INACTIVE);
+
+	do {
+		state = &cpu_core[c->cpu_id].cpuc_dcpc_intr_state;
+
+		while (atomic_cas_8(state, DCPC_INTR_FREE,
+		    DCPC_INTR_CONFIG) != DCPC_INTR_FREE)
+			continue;
+
+	} while ((c = c->cpu_next) != cpu_list);
+}
+
+/*
+ * Set all CPUs dcpc interrupt state to DCPC_INTR_FREE to indicate that
+ * overflow interrupts can be processed safely.
+ */
+static void
+dcpc_release_interrupts(void)
+{
+	cpu_t *c = cpu_list;
+
+	ASSERT(cpu_core[c->cpu_id].cpuc_dcpc_intr_state != DCPC_INTR_INACTIVE);
+
+	do {
+		cpu_core[c->cpu_id].cpuc_dcpc_intr_state = DCPC_INTR_FREE;
+		membar_producer();
+	} while ((c = c->cpu_next) != cpu_list);
+}
+
+/*
+ * Transition all CPUs dcpc interrupt state from DCPC_INTR_INACTIVE to
+ * to DCPC_INTR_FREE. This indicates that the dcpc provider is now
+ * responsible for handling all overflow interrupt activity. Should only be
+ * called before enabling the first dcpc based probe.
+ */
+static void
+dcpc_claim_interrupts(void)
+{
+	cpu_t *c = cpu_list;
+
+	ASSERT(cpu_core[c->cpu_id].cpuc_dcpc_intr_state == DCPC_INTR_INACTIVE);
+
+	do {
+		cpu_core[c->cpu_id].cpuc_dcpc_intr_state = DCPC_INTR_FREE;
+		membar_producer();
+	} while ((c = c->cpu_next) != cpu_list);
+}
+
+/*
+ * Set all CPUs dcpc interrupt state to DCPC_INTR_INACTIVE to indicate that
+ * the dcpc provider is no longer processing overflow interrupts. Only called
+ * during removal of the last dcpc based enabling.
+ */
+static void
+dcpc_surrender_interrupts(void)
+{
+	cpu_t *c = cpu_list;
+
+	ASSERT(cpu_core[c->cpu_id].cpuc_dcpc_intr_state != DCPC_INTR_INACTIVE);
+
+	do {
+		cpu_core[c->cpu_id].cpuc_dcpc_intr_state = DCPC_INTR_INACTIVE;
+		membar_producer();
+	} while ((c = c->cpu_next) != cpu_list);
+}
+
+/*
+ * dcpc_program_event() can be called owing to a new enabling or if a multi
+ * overflow platform has disabled a request but needs to  program the requests
+ * that are still valid.
+ *
+ * Every invocation of dcpc_program_event() will create a new kcpc_ctx_t
+ * and a new request set which contains the new enabling and any old enablings
+ * which are still valid (possible with multi-overflow platforms).
+ */
+static int
+dcpc_program_event(dcpc_probe_t *pp)
+{
+	cpu_t *c;
+	int ret = 0;
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	kpreempt_disable();
+
+	dcpc_block_interrupts();
+
+	c = cpu_list;
+
+	do {
+		/*
+		 * Skip CPUs that are currently offline.
+		 */
+		if (c->cpu_flags & CPU_OFFLINE)
+			continue;
+
+		/*
+		 * Stop counters but preserve existing DTrace CPC context
+		 * if there is one.
+		 *
+		 * If we come here when the first event is programmed for a CPU,
+		 * there should be no DTrace CPC context installed. In this
+		 * case, kcpc_cpu_stop() will ensure that there is no other
+		 * context on the CPU.
+		 *
+		 * If we add new enabling to the original one, the CPU should
+		 * have the old DTrace CPC context which we need to keep around
+		 * since dcpc_program_event() will add to it.
+		 */
+		if (c->cpu_cpc_ctx != NULL)
+			kcpc_cpu_stop(c, B_TRUE);
+	} while ((c = c->cpu_next) != cpu_list);
+
+	dcpc_release_interrupts();
+
+	/*
+	 * If this enabling is being removed (in the case of a multi event
+	 * capable system with more than one active enabling), we can now
+	 * update the active request array to reflect the enablings that need
+	 * to be reprogrammed.
+	 */
+	if (pp->dcpc_disabling == 1)
+		dcpc_actv_reqs[pp->dcpc_actv_req_idx] = NULL;
+
+	do {
+		/*
+		 * Skip CPUs that are currently offline.
+		 */
+		if (c->cpu_flags & CPU_OFFLINE)
+			continue;
+
+		ret = dcpc_program_cpu_event(c);
+	} while ((c = c->cpu_next) != cpu_list && ret == 0);
+
+	/*
+	 * If dcpc_program_cpu_event() fails then it is because we couldn't
+	 * configure the requests in the set for the CPU and not because of
+	 * an error programming the hardware. If we have a failure here then
+	 * we assume no CPUs have been programmed in the above step as they
+	 * are all configured identically.
+	 */
+	if (ret != 0) {
+		pp->dcpc_enabled = 0;
+		kpreempt_enable();
+		return (-1);
+	}
+
+	if (pp->dcpc_disabling != 1)
+		pp->dcpc_enabled = 1;
+
+	kpreempt_enable();
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dcpc_enable(void *arg, dtrace_id_t id, void *parg)
+{
+	dcpc_probe_t *pp = parg;
+	int i, found = 0;
+	cpu_t *c;
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	/*
+	 * Bail out if the counters are being used by a libcpc consumer.
+	 */
+	rw_enter(&kcpc_cpuctx_lock, RW_READER);
+	if (kcpc_cpuctx > 0) {
+		rw_exit(&kcpc_cpuctx_lock);
+		return (-1);
+	}
+
+	dtrace_cpc_in_use++;
+	rw_exit(&kcpc_cpuctx_lock);
+
+	/*
+	 * Locate this enabling in the first free entry of the active
+	 * request array.
+	 */
+	for (i = 0; i < cpc_ncounters; i++) {
+		if (dcpc_actv_reqs[i] == NULL) {
+			dcpc_actv_reqs[i] = pp;
+			pp->dcpc_actv_req_idx = i;
+			found = 1;
+			break;
+		}
+	}
+
+	/*
+	 * If we couldn't find a slot for this probe then there is no
+	 * room at the inn.
+	 */
+	if (!found) {
+		dtrace_cpc_in_use--;
+		return (-1);
+	}
+
+	ASSERT(pp->dcpc_actv_req_idx >= 0);
+
+	/*
+	 * DTrace is taking over CPC contexts, so stop collecting
+	 * capacity/utilization data for all CPUs.
+	 */
+	if (dtrace_cpc_in_use == 1)
+		cu_disable();
+
+	/*
+	 * The following must hold true if we are to (attempt to) enable
+	 * this request:
+	 *
+	 * 1) No enablings currently exist. We allow all platforms to
+	 * proceed if this is true.
+	 *
+	 * OR
+	 *
+	 * 2) If the platform is multi overflow capable and there are
+	 * less valid enablings than there are counters. There is no
+	 * guarantee that a platform can accommodate as many events as
+	 * it has counters for but we will at least try to program
+	 * up to that many requests.
+	 *
+	 * The 'dcpc_enablings' variable is implictly protected by locking
+	 * provided by the DTrace framework and the cpu management framework.
+	 */
+	if (dcpc_enablings == 0 || (dcpc_mult_ovf_cap &&
+	    dcpc_enablings < cpc_ncounters)) {
+		/*
+		 * Before attempting to program the first enabling we need to
+		 * invalidate any lwp-based contexts and lay claim to the
+		 * overflow interrupt mechanism.
+		 */
+		if (dcpc_enablings == 0) {
+			kcpc_invalidate_all();
+			dcpc_claim_interrupts();
+		}
+
+		if (dcpc_program_event(pp) == 0) {
+			dcpc_enablings++;
+			return (0);
+		}
+	}
+
+	/*
+	 * If active enablings existed before we failed to enable this probe
+	 * on a multi event capable platform then we need to restart counters
+	 * as they will have been stopped in the attempted configuration. The
+	 * context should now just contain the request prior to this failed
+	 * enabling.
+	 */
+	if (dcpc_enablings > 0 && dcpc_mult_ovf_cap) {
+		c = cpu_list;
+
+		ASSERT(dcpc_mult_ovf_cap == 1);
+		do {
+			/*
+			 * Skip CPUs that are currently offline.
+			 */
+			if (c->cpu_flags & CPU_OFFLINE)
+				continue;
+
+			kcpc_cpu_program(c, c->cpu_cpc_ctx);
+		} while ((c = c->cpu_next) != cpu_list);
+	}
+
+	/*
+	 * Give up any claim to the overflow interrupt mechanism if no
+	 * dcpc based enablings exist.
+	 */
+	if (dcpc_enablings == 0)
+		dcpc_surrender_interrupts();
+
+	dtrace_cpc_in_use--;
+	dcpc_actv_reqs[pp->dcpc_actv_req_idx] = NULL;
+	pp->dcpc_actv_req_idx = pp->dcpc_picno = -1;
+
+	/*
+	 * If all probes are removed, enable capacity/utilization data
+	 * collection for every CPU.
+	 */
+	if (dtrace_cpc_in_use == 0)
+		cu_enable();
+
+	return (-1);
+}
+
+/*
+ * If only one enabling is active then remove the context and free
+ * everything up. If there are multiple enablings active then remove this
+ * one, its associated meta-data and re-program the hardware.
+ */
+/*ARGSUSED*/
+static void
+dcpc_disable(void *arg, dtrace_id_t id, void *parg)
+{
+	cpu_t *c;
+	dcpc_probe_t *pp = parg;
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	kpreempt_disable();
+
+	/*
+	 * This probe didn't actually make it as far as being fully enabled
+	 * so we needn't do anything with it.
+	 */
+	if (pp->dcpc_enabled == 0) {
+		/*
+		 * If we actually allocated this request a slot in the
+		 * request array but failed to enabled it then remove the
+		 * entry in the array.
+		 */
+		if (pp->dcpc_actv_req_idx >= 0) {
+			dcpc_actv_reqs[pp->dcpc_actv_req_idx] = NULL;
+			pp->dcpc_actv_req_idx = pp->dcpc_picno =
+			    pp->dcpc_disabling = -1;
+		}
+
+		kpreempt_enable();
+		return;
+	}
+
+	/*
+	 * If this is the only enabling then stop all the counters and
+	 * free up the meta-data.
+	 */
+	if (dcpc_enablings == 1) {
+		ASSERT(dtrace_cpc_in_use == 1);
+
+		dcpc_block_interrupts();
+
+		c = cpu_list;
+
+		do {
+			dcpc_disable_cpu(c);
+		} while ((c = c->cpu_next) != cpu_list);
+
+		dcpc_actv_reqs[pp->dcpc_actv_req_idx] = NULL;
+		dcpc_surrender_interrupts();
+	} else {
+		/*
+		 * This platform can support multiple overflow events and
+		 * the enabling being disabled is not the last one. Remove this
+		 * enabling and re-program the hardware with the new config.
+		 */
+		ASSERT(dcpc_mult_ovf_cap);
+		ASSERT(dcpc_enablings > 1);
+
+		pp->dcpc_disabling = 1;
+		(void) dcpc_program_event(pp);
+	}
+
+	kpreempt_enable();
+
+	dcpc_enablings--;
+	dtrace_cpc_in_use--;
+	pp->dcpc_enabled = 0;
+	pp->dcpc_actv_req_idx = pp->dcpc_picno = pp->dcpc_disabling = -1;
+
+	/*
+	 * If all probes are removed, enable capacity/utilization data
+	 * collection for every CPU
+	 */
+	if (dtrace_cpc_in_use == 0)
+		cu_enable();
+}
+
+/*ARGSUSED*/
+static int
+dcpc_cpu_setup(cpu_setup_t what, processorid_t cpu, void *arg)
+{
+	cpu_t *c;
+	uint8_t *state;
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	switch (what) {
+	case CPU_OFF:
+		/*
+		 * Offline CPUs are not allowed to take part so remove this
+		 * CPU if we are actively tracing.
+		 */
+		if (dtrace_cpc_in_use) {
+			c = cpu_get(cpu);
+			state = &cpu_core[c->cpu_id].cpuc_dcpc_intr_state;
+
+			/*
+			 * Indicate that a configuration is in process in
+			 * order to stop overflow interrupts being processed
+			 * on this CPU while we disable it.
+			 */
+			while (atomic_cas_8(state, DCPC_INTR_FREE,
+			    DCPC_INTR_CONFIG) != DCPC_INTR_FREE)
+				continue;
+
+			dcpc_disable_cpu(c);
+
+			/*
+			 * Reset this CPUs interrupt state as the configuration
+			 * has ended.
+			 */
+			cpu_core[c->cpu_id].cpuc_dcpc_intr_state =
+			    DCPC_INTR_FREE;
+			membar_producer();
+		}
+		break;
+
+	case CPU_ON:
+	case CPU_SETUP:
+		/*
+		 * This CPU is being initialized or brought online so program
+		 * it with the current request set if we are actively tracing.
+		 */
+		if (dtrace_cpc_in_use) {
+			c = cpu_get(cpu);
+			(void) dcpc_program_cpu_event(c);
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	return (0);
+}
+
+static dtrace_pattr_t dcpc_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_CPU },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+};
+
+static dtrace_pops_t dcpc_pops = {
+    dcpc_provide,
+    NULL,
+    dcpc_enable,
+    dcpc_disable,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    dcpc_usermode,
+    dcpc_destroy
+};
+
+/*ARGSUSED*/
+static int
+dcpc_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
+{
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+dcpc_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+	int error;
+
+	switch (infocmd) {
+	case DDI_INFO_DEVT2DEVINFO:
+		*result = (void *)dcpc_devi;
+		error = DDI_SUCCESS;
+		break;
+	case DDI_INFO_DEVT2INSTANCE:
+		*result = (void *)0;
+		error = DDI_SUCCESS;
+		break;
+	default:
+		error = DDI_FAILURE;
+	}
+	return (error);
+}
+
+static int
+dcpc_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_DETACH:
+		break;
+	case DDI_SUSPEND:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (dtrace_unregister(dcpc_pid) != 0)
+		return (DDI_FAILURE);
+
+	ddi_remove_minor_node(devi, NULL);
+
+	mutex_enter(&cpu_lock);
+	unregister_cpu_setup_func(dcpc_cpu_setup, NULL);
+	mutex_exit(&cpu_lock);
+
+	kmem_free(dcpc_actv_reqs, cpc_ncounters * sizeof (dcpc_probe_t *));
+
+	kcpc_unregister_dcpc();
+
+	return (DDI_SUCCESS);
+}
+
+static int
+dcpc_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
+{
+	uint_t caps;
+	char *attrs;
+
+	switch (cmd) {
+	case DDI_ATTACH:
+		break;
+	case DDI_RESUME:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (kcpc_pcbe_loaded() == -1)
+		return (DDI_FAILURE);
+
+	caps = kcpc_pcbe_capabilities();
+
+	if (!(caps & CPC_CAP_OVERFLOW_INTERRUPT)) {
+		cmn_err(CE_NOTE, "!dcpc: Counter Overflow not supported"\
+		    " on this processor");
+		return (DDI_FAILURE);
+	}
+
+	if (ddi_create_minor_node(devi, "dcpc", S_IFCHR, 0,
+	    DDI_PSEUDO, NULL) == DDI_FAILURE ||
+	    dtrace_register("cpc", &dcpc_attr, DTRACE_PRIV_KERNEL,
+	    NULL, &dcpc_pops, NULL, &dcpc_pid) != 0) {
+		ddi_remove_minor_node(devi, NULL);
+		return (DDI_FAILURE);
+	}
+
+	mutex_enter(&cpu_lock);
+	register_cpu_setup_func(dcpc_cpu_setup, NULL);
+	mutex_exit(&cpu_lock);
+
+	dcpc_ovf_mask = (1 << cpc_ncounters) - 1;
+	ASSERT(dcpc_ovf_mask != 0);
+
+	if (caps & CPC_CAP_OVERFLOW_PRECISE)
+		dcpc_mult_ovf_cap = 1;
+
+	/*
+	 * Determine which, if any, mask attribute the back-end can use.
+	 */
+	attrs = kcpc_list_attrs();
+	if (strstr(attrs, "umask") != NULL)
+		dcpc_mask_type |= DCPC_UMASK;
+	else if (strstr(attrs, "emask") != NULL)
+		dcpc_mask_type |= DCPC_EMASK;
+
+	/*
+	 * The dcpc_actv_reqs array is used to store the requests that
+	 * we currently have programmed. The order of requests in this
+	 * array is not necessarily the order that the event appears in
+	 * the kcpc_request_t array. Once entered into a slot in the array
+	 * the entry is not moved until it's removed.
+	 */
+	dcpc_actv_reqs =
+	    kmem_zalloc(cpc_ncounters * sizeof (dcpc_probe_t *), KM_SLEEP);
+
+	dcpc_min_overflow = ddi_prop_get_int(DDI_DEV_T_ANY, devi,
+	    DDI_PROP_DONTPASS, "dcpc-min-overflow", DCPC_MIN_OVF_DEFAULT);
+
+	kcpc_register_dcpc(dcpc_fire);
+
+	ddi_report_dev(devi);
+	dcpc_devi = devi;
+
+	return (DDI_SUCCESS);
+}
+
+static struct cb_ops dcpc_cb_ops = {
+	dcpc_open,		/* open */
+	nodev,			/* close */
+	nulldev,		/* strategy */
+	nulldev,		/* print */
+	nodev,			/* dump */
+	nodev,			/* read */
+	nodev,			/* write */
+	nodev,			/* ioctl */
+	nodev,			/* devmap */
+	nodev,			/* mmap */
+	nodev,			/* segmap */
+	nochpoll,		/* poll */
+	ddi_prop_op,		/* cb_prop_op */
+	0,			/* streamtab  */
+	D_NEW | D_MP		/* Driver compatibility flag */
+};
+
+static struct dev_ops dcpc_ops = {
+	DEVO_REV,		/* devo_rev, */
+	0,			/* refcnt  */
+	dcpc_info,		/* get_dev_info */
+	nulldev,		/* identify */
+	nulldev,		/* probe */
+	dcpc_attach,		/* attach */
+	dcpc_detach,		/* detach */
+	nodev,			/* reset */
+	&dcpc_cb_ops,		/* driver operations */
+	NULL,			/* bus operations */
+	nodev,			/* dev power */
+	ddi_quiesce_not_needed	/* quiesce */
+};
+
+/*
+ * Module linkage information for the kernel.
+ */
+static struct modldrv modldrv = {
+	&mod_driverops,		/* module type */
+	"DTrace CPC Module",	/* name of module */
+	&dcpc_ops,		/* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+	MODREV_1,
+	(void *)&modldrv,
+	NULL
+};
+
+int
+_init(void)
+{
+	return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+	return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+	return (mod_remove(&modlinkage));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dcpc.conf b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dcpc.conf
new file mode 100644
index 0000000..3f18694
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dcpc.conf
@@ -0,0 +1,33 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+name="dcpc" parent="pseudo" instance=0;
+
+#
+# dcpc-min-overflow is the lower limit on the rate of overflow that can be
+# set on a probe. The default value is 5000. Decrease this value to create
+# probes with lower overflow values. Setting this value too low on a rapidly
+# increasing event could render a system unusable.
+#
+#dcpc-min-overflow=5000;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
new file mode 100644
index 0000000..7f76c86
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
@@ -0,0 +1,16255 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+/*
+ * DTrace - Dynamic Tracing for Solaris
+ *
+ * This is the implementation of the Solaris Dynamic Tracing framework
+ * (DTrace).  The user-visible interface to DTrace is described at length in
+ * the "Solaris Dynamic Tracing Guide".  The interfaces between the libdtrace
+ * library, the in-kernel DTrace framework, and the DTrace providers are
+ * described in the block comments in the <sys/dtrace.h> header file.  The
+ * internal architecture of DTrace is described in the block comments in the
+ * <sys/dtrace_impl.h> header file.  The comments contained within the DTrace
+ * implementation very much assume mastery of all of these sources; if one has
+ * an unanswered question about the implementation, one should consult them
+ * first.
+ *
+ * The functions here are ordered roughly as follows:
+ *
+ *   - Probe context functions
+ *   - Probe hashing functions
+ *   - Non-probe context utility functions
+ *   - Matching functions
+ *   - Provider-to-Framework API functions
+ *   - Probe management functions
+ *   - DIF object functions
+ *   - Format functions
+ *   - Predicate functions
+ *   - ECB functions
+ *   - Buffer functions
+ *   - Enabling functions
+ *   - DOF functions
+ *   - Anonymous enabling functions
+ *   - Consumer state functions
+ *   - Helper functions
+ *   - Hook functions
+ *   - Driver cookbook functions
+ *
+ * Each group of functions begins with a block comment labelled the "DTrace
+ * [Group] Functions", allowing one to find each block by searching forward
+ * on capital-f functions.
+ */
+#ifndef VBOX
+#include <sys/errno.h>
+#include <sys/stat.h>
+#include <sys/modctl.h>
+#include <sys/conf.h>
+#include <sys/systm.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/cpuvar.h>
+#include <sys/kmem.h>
+#include <sys/strsubr.h>
+#include <sys/sysmacros.h>
+#include <sys/dtrace_impl.h>
+#include <sys/atomic.h>
+#include <sys/cmn_err.h>
+#include <sys/mutex_impl.h>
+#include <sys/rwlock_impl.h>
+#include <sys/ctf_api.h>
+#include <sys/panic.h>
+#include <sys/priv_impl.h>
+#include <sys/policy.h>
+#include <sys/cred_impl.h>
+#include <sys/procfs_isa.h>
+#include <sys/taskq.h>
+#include <sys/mkdev.h>
+#include <sys/kdi.h>
+#include <sys/zone.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#else  /* VBOX */
+# include <sys/dtrace_impl.h>
+# include <VBox/sup.h>
+# include <iprt/assert.h>
+# include <iprt/cpuset.h>
+# include <iprt/mem.h>
+# include <iprt/mp.h>
+# include <iprt/string.h>
+# include <iprt/process.h>
+# include <iprt/thread.h>
+# include <iprt/timer.h>
+# include <limits.h>
+
+/*
+ * Use asm.h to implemente some of the simple stuff in dtrace_asm.s.
+ */
+# include <iprt/asm.h>
+# include <iprt/asm-amd64-x86.h>
+# define dtrace_casptr(a_ppvDst, a_pvOld, a_pvNew) \
+	VBoxDtCompareAndSwapPtr((void * volatile *)a_ppvDst, a_pvOld, a_pvNew)
+DECLINLINE(void *) VBoxDtCompareAndSwapPtr(void * volatile *ppvDst, void *pvOld, void *pvNew)
+{
+	void *pvRet;
+	ASMAtomicCmpXchgExPtrVoid(ppvDst, pvNew, pvOld, &pvRet);
+	return pvRet;
+}
+
+# define dtrace_cas32(a_pu32Dst, a_pu32Old, a_pu32New) \
+	VBoxDtCompareAndSwapU32(a_pu32Dst, a_pu32Old, a_pu32New)
+DECLINLINE(uint32_t) VBoxDtCompareAndSwapU32(uint32_t volatile *pu32Dst, uint32_t u32Old, uint32_t u32New)
+{
+	uint32_t u32Ret;
+	ASMAtomicCmpXchgExU32(pu32Dst, u32New, u32Old, &u32Ret);
+	return u32Ret;
+}
+
+#define dtrace_membar_consumer()		ASMReadFence()
+#define dtrace_membar_producer()		ASMWriteFence()
+#define dtrace_interrupt_disable()		ASMIntDisableFlags()
+#define dtrace_interrupt_enable(a_EFL)	ASMSetFlags(a_EFL)
+
+/*
+ * NULL must be set to 0 or we'll end up with a billion warnings(=errors).
+ */
+# undef NULL
+# define NULL (0)
+#endif /* VBOX */
+
+/** Check if the given address is a valid kernel address.
+ * The value can be uintptr_t or uint64_t.  */
+#ifndef VBOX
+# define VBDT_IS_VALID_KRNL_ADDR(a_uAddr)   ((a_uAddr) >= KERNELBASE)
+#else
+# define VBDT_IS_VALID_KRNL_ADDR(a_uAddr)   \
+    (   (sizeof(a_uAddr) == sizeof(uintptr_t) || (uintptr_t)(a_uAddr) == (a_uAddr)) \
+     && RTR0MemKernelIsValidAddr((void *)(uintptr_t)(a_uAddr)) )
+#endif
+
+
+/*
+ * DTrace Tunable Variables
+ *
+ * The following variables may be tuned by adding a line to /etc/system that
+ * includes both the name of the DTrace module ("dtrace") and the name of the
+ * variable.  For example:
+ *
+ *   set dtrace:dtrace_destructive_disallow = 1
+ *
+ * In general, the only variables that one should be tuning this way are those
+ * that affect system-wide DTrace behavior, and for which the default behavior
+ * is undesirable.  Most of these variables are tunable on a per-consumer
+ * basis using DTrace options, and need not be tuned on a system-wide basis.
+ * When tuning these variables, avoid pathological values; while some attempt
+ * is made to verify the integrity of these variables, they are not considered
+ * part of the supported interface to DTrace, and they are therefore not
+ * checked comprehensively.  Further, these variables should not be tuned
+ * dynamically via "mdb -kw" or other means; they should only be tuned via
+ * /etc/system.
+ */
+int		dtrace_destructive_disallow = 0;
+dtrace_optval_t	dtrace_nonroot_maxsize = (16 * 1024 * 1024);
+size_t		dtrace_difo_maxsize = (256 * 1024);
+dtrace_optval_t	dtrace_dof_maxsize = (256 * 1024);
+size_t		dtrace_global_maxsize = (16 * 1024);
+size_t		dtrace_actions_max = (16 * 1024);
+size_t		dtrace_retain_max = 1024;
+dtrace_optval_t	dtrace_helper_actions_max = 32;
+dtrace_optval_t	dtrace_helper_providers_max = 32;
+dtrace_optval_t	dtrace_dstate_defsize = (1 * 1024 * 1024);
+size_t		dtrace_strsize_default = 256;
+dtrace_optval_t	dtrace_cleanrate_default = 9900990;		/* 101 hz */
+dtrace_optval_t	dtrace_cleanrate_min = 200000;			/* 5000 hz */
+dtrace_optval_t	dtrace_cleanrate_max = (uint64_t)60 * NANOSEC;	/* 1/minute */
+dtrace_optval_t	dtrace_aggrate_default = NANOSEC;		/* 1 hz */
+dtrace_optval_t	dtrace_statusrate_default = NANOSEC;		/* 1 hz */
+dtrace_optval_t dtrace_statusrate_max = (hrtime_t)10 * NANOSEC;	 /* 6/minute */
+dtrace_optval_t	dtrace_switchrate_default = NANOSEC;		/* 1 hz */
+dtrace_optval_t	dtrace_nspec_default = 1;
+dtrace_optval_t	dtrace_specsize_default = 32 * 1024;
+dtrace_optval_t dtrace_stackframes_default = 20;
+dtrace_optval_t dtrace_ustackframes_default = 20;
+dtrace_optval_t dtrace_jstackframes_default = 50;
+dtrace_optval_t dtrace_jstackstrsize_default = 512;
+int		dtrace_msgdsize_max = 128;
+hrtime_t	dtrace_chill_max = 500 * (NANOSEC / MILLISEC);	/* 500 ms */
+hrtime_t	dtrace_chill_interval = NANOSEC;		/* 1000 ms */
+int		dtrace_devdepth_max = 32;
+int		dtrace_err_verbose;
+hrtime_t	dtrace_deadman_interval = NANOSEC;
+hrtime_t	dtrace_deadman_timeout = (hrtime_t)10 * NANOSEC;
+hrtime_t	dtrace_deadman_user = (hrtime_t)30 * NANOSEC;
+
+/*
+ * DTrace External Variables
+ *
+ * As dtrace(7D) is a kernel module, any DTrace variables are obviously
+ * available to DTrace consumers via the backtick (`) syntax.  One of these,
+ * dtrace_zero, is made deliberately so:  it is provided as a source of
+ * well-known, zero-filled memory.  While this variable is not documented,
+ * it is used by some translators as an implementation detail.
+ */
+const char	dtrace_zero[256] = { 0 };	/* zero-filled memory */
+
+/*
+ * DTrace Internal Variables
+ */
+#ifndef VBOX
+static dev_info_t	*dtrace_devi;		/* device info */
+#endif
+static vmem_t		*dtrace_arena;		/* probe ID arena */
+#ifndef VBOX
+static vmem_t		*dtrace_minor;		/* minor number arena */
+static taskq_t		*dtrace_taskq;		/* task queue */
+#endif
+static dtrace_probe_t	**dtrace_probes;	/* array of all probes */
+static VBDTTYPE(uint32_t,int) dtrace_nprobes;		/* number of probes */
+static dtrace_provider_t *dtrace_provider;	/* provider list */
+static dtrace_meta_t	*dtrace_meta_pid;	/* user-land meta provider */
+static int		dtrace_opens;		/* number of opens */
+static int		dtrace_helpers;		/* number of helpers */
+#ifndef VBOX
+static void		*dtrace_softstate;	/* softstate pointer */
+#endif
+static dtrace_hash_t	*dtrace_bymod;		/* probes hashed by module */
+static dtrace_hash_t	*dtrace_byfunc;		/* probes hashed by function */
+static dtrace_hash_t	*dtrace_byname;		/* probes hashed by name */
+static dtrace_toxrange_t *dtrace_toxrange;	/* toxic range array */
+static int		dtrace_toxranges;	/* number of toxic ranges */
+static int		dtrace_toxranges_max;	/* size of toxic range array */
+static dtrace_anon_t	dtrace_anon;		/* anonymous enabling */
+static kmem_cache_t	*dtrace_state_cache;	/* cache for dynamic state */
+static uint64_t		dtrace_vtime_references; /* number of vtimestamp refs */
+#ifndef VBOX
+static kthread_t	*dtrace_panicked;	/* panicking thread */
+#endif
+static dtrace_ecb_t	*dtrace_ecb_create_cache; /* cached created ECB */
+static dtrace_genid_t	dtrace_probegen;	/* current probe generation */
+static dtrace_helpers_t *dtrace_deferred_pid;	/* deferred helper list */
+static dtrace_enabling_t *dtrace_retained;	/* list of retained enablings */
+static dtrace_genid_t	dtrace_retained_gen;	/* current retained enab gen */
+static dtrace_dynvar_t	dtrace_dynhash_sink;	/* end of dynamic hash chains */
+static int		dtrace_dynvar_failclean; /* dynvars failed to clean */
+
+/*
+ * DTrace Locking
+ * DTrace is protected by three (relatively coarse-grained) locks:
+ *
+ * (1) dtrace_lock is required to manipulate essentially any DTrace state,
+ *     including enabling state, probes, ECBs, consumer state, helper state,
+ *     etc.  Importantly, dtrace_lock is _not_ required when in probe context;
+ *     probe context is lock-free -- synchronization is handled via the
+ *     dtrace_sync() cross call mechanism.
+ *
+ * (2) dtrace_provider_lock is required when manipulating provider state, or
+ *     when provider state must be held constant.
+ *
+ * (3) dtrace_meta_lock is required when manipulating meta provider state, or
+ *     when meta provider state must be held constant.
+ *
+ * The lock ordering between these three locks is dtrace_meta_lock before
+ * dtrace_provider_lock before dtrace_lock.  (In particular, there are
+ * several places where dtrace_provider_lock is held by the framework as it
+ * calls into the providers -- which then call back into the framework,
+ * grabbing dtrace_lock.)
+ *
+ * There are two other locks in the mix:  mod_lock and cpu_lock.  With respect
+ * to dtrace_provider_lock and dtrace_lock, cpu_lock continues its historical
+ * role as a coarse-grained lock; it is acquired before both of these locks.
+ * With respect to dtrace_meta_lock, its behavior is stranger:  cpu_lock must
+ * be acquired _between_ dtrace_meta_lock and any other DTrace locks.
+ * mod_lock is similar with respect to dtrace_provider_lock in that it must be
+ * acquired _between_ dtrace_provider_lock and dtrace_lock.
+ */
+static kmutex_t		dtrace_lock;		/* probe state lock */
+static kmutex_t		dtrace_provider_lock;	/* provider state lock */
+static kmutex_t		dtrace_meta_lock;	/* meta-provider state lock */
+
+/*
+ * DTrace Provider Variables
+ *
+ * These are the variables relating to DTrace as a provider (that is, the
+ * provider of the BEGIN, END, and ERROR probes).
+ */
+static dtrace_pattr_t	dtrace_provider_attr = {
+{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_STABLE, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_STABLE, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_STABLE, DTRACE_STABILITY_STABLE, DTRACE_CLASS_COMMON },
+};
+
+static void
+dtrace_nullop(void)
+{}
+
+static int
+dtrace_enable_nullop(void)
+{
+	return (0);
+}
+
+static dtrace_pops_t	dtrace_provider_ops = {
+	(void (*)(void *, const dtrace_probedesc_t *))dtrace_nullop,
+	(void (*)(void *, struct modctl *))dtrace_nullop,
+	(int (*)(void *, dtrace_id_t, void *))dtrace_enable_nullop,
+	(void (*)(void *, dtrace_id_t, void *))dtrace_nullop,
+	(void (*)(void *, dtrace_id_t, void *))dtrace_nullop,
+	(void (*)(void *, dtrace_id_t, void *))dtrace_nullop,
+	NULL,
+	NULL,
+	NULL,
+	(void (*)(void *, dtrace_id_t, void *))dtrace_nullop
+};
+
+static dtrace_id_t	dtrace_probeid_begin;	/* special BEGIN probe */
+static dtrace_id_t	dtrace_probeid_end;	/* special END probe */
+dtrace_id_t		dtrace_probeid_error;	/* special ERROR probe */
+
+/*
+ * DTrace Helper Tracing Variables
+ */
+uint32_t dtrace_helptrace_next = 0;
+uint32_t dtrace_helptrace_nlocals;
+char	*dtrace_helptrace_buffer;
+int	dtrace_helptrace_bufsize = 512 * 1024;
+
+#ifdef DEBUG
+int	dtrace_helptrace_enabled = 1;
+#else
+int	dtrace_helptrace_enabled = 0;
+#endif
+
+/*
+ * DTrace Error Hashing
+ *
+ * On DEBUG kernels, DTrace will track the errors that has seen in a hash
+ * table.  This is very useful for checking coverage of tests that are
+ * expected to induce DIF or DOF processing errors, and may be useful for
+ * debugging problems in the DIF code generator or in DOF generation .  The
+ * error hash may be examined with the ::dtrace_errhash MDB dcmd.
+ */
+#ifdef DEBUG
+static dtrace_errhash_t	dtrace_errhash[DTRACE_ERRHASHSZ];
+static const char *dtrace_errlast;
+static kthread_t *dtrace_errthread;
+static kmutex_t dtrace_errlock;
+#endif
+
+/*
+ * DTrace Macros and Constants
+ *
+ * These are various macros that are useful in various spots in the
+ * implementation, along with a few random constants that have no meaning
+ * outside of the implementation.  There is no real structure to this cpp
+ * mishmash -- but is there ever?
+ */
+#define	DTRACE_HASHSTR(hash, probe)	\
+	dtrace_hash_str(*((char **)((uintptr_t)(probe) + (hash)->dth_stroffs)))
+
+#define	DTRACE_HASHNEXT(hash, probe)	\
+	(dtrace_probe_t **)((uintptr_t)(probe) + (hash)->dth_nextoffs)
+
+#define	DTRACE_HASHPREV(hash, probe)	\
+	(dtrace_probe_t **)((uintptr_t)(probe) + (hash)->dth_prevoffs)
+
+#define	DTRACE_HASHEQ(hash, lhs, rhs)	\
+	(strcmp(*((char **)((uintptr_t)(lhs) + (hash)->dth_stroffs)), \
+	    *((char **)((uintptr_t)(rhs) + (hash)->dth_stroffs))) == 0)
+
+#define	DTRACE_AGGHASHSIZE_SLEW		17
+
+#define	DTRACE_V4MAPPED_OFFSET		(sizeof (uint32_t) * 3)
+
+/*
+ * The key for a thread-local variable consists of the lower 61 bits of the
+ * t_did, plus the 3 bits of the highest active interrupt above LOCK_LEVEL.
+ * We add DIF_VARIABLE_MAX to t_did to assure that the thread key is never
+ * equal to a variable identifier.  This is necessary (but not sufficient) to
+ * assure that global associative arrays never collide with thread-local
+ * variables.  To guarantee that they cannot collide, we must also define the
+ * order for keying dynamic variables.  That order is:
+ *
+ *   [ key0 ] ... [ keyn ] [ variable-key ] [ tls-key ]
+ *
+ * Because the variable-key and the tls-key are in orthogonal spaces, there is
+ * no way for a global variable key signature to match a thread-local key
+ * signature.
+ */
+#ifndef VBOX
+#define	DTRACE_TLS_THRKEY(where) { \
+	uint_t intr = 0; \
+	uint_t actv = CPU->cpu_intr_actv >> (LOCK_LEVEL + 1); \
+	for (; actv; actv >>= 1) \
+		intr++; \
+	ASSERT(intr < (1 << 3)); \
+	(where) = ((curthread->t_did + DIF_VARIABLE_MAX) & \
+	    (((uint64_t)1 << 61) - 1)) | ((uint64_t)intr << 61); \
+}
+#else
+#define	DTRACE_TLS_THRKEY(where) do { \
+	(where) = (((uintptr_t)RTThreadNativeSelf() + DIF_VARIABLE_MAX) & (RT_BIT_64(61) - 1)) \
+			| (RTThreadIsInInterrupt(NIL_RTTHREAD) ? RT_BIT_64(61) : 0); \
+} while (0)
+#endif
+
+#define	DT_BSWAP_8(x)	((x) & 0xff)
+#define	DT_BSWAP_16(x)	((DT_BSWAP_8(x) << 8) | DT_BSWAP_8((x) >> 8))
+#define	DT_BSWAP_32(x)	((DT_BSWAP_16(x) << 16) | DT_BSWAP_16((x) >> 16))
+#define	DT_BSWAP_64(x)	((DT_BSWAP_32(x) << 32) | DT_BSWAP_32((x) >> 32))
+
+#define	DT_MASK_LO 0x00000000FFFFFFFFULL
+
+#define	DTRACE_STORE(type, tomax, offset, what) \
+	*((type *)((uintptr_t)(tomax) + (uintptr_t)offset)) = (type)(what);
+
+#ifndef __i386
+#define	DTRACE_ALIGNCHECK(addr, size, flags)				\
+	if (addr & (size - 1)) {					\
+		*flags |= CPU_DTRACE_BADALIGN;				\
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = addr;	\
+		return (0);						\
+	}
+#else
+#define	DTRACE_ALIGNCHECK(addr, size, flags)
+#endif
+
+/*
+ * Test whether a range of memory starting at testaddr of size testsz falls
+ * within the range of memory described by addr, sz.  We take care to avoid
+ * problems with overflow and underflow of the unsigned quantities, and
+ * disallow all negative sizes.  Ranges of size 0 are allowed.
+ */
+#define	DTRACE_INRANGE(testaddr, testsz, baseaddr, basesz) \
+	((testaddr) - (baseaddr) < (basesz) && \
+	(testaddr) + (testsz) - (baseaddr) <= (basesz) && \
+	(testaddr) + (testsz) >= (testaddr))
+
+/*
+ * Test whether alloc_sz bytes will fit in the scratch region.  We isolate
+ * alloc_sz on the righthand side of the comparison in order to avoid overflow
+ * or underflow in the comparison with it.  This is simpler than the INRANGE
+ * check above, because we know that the dtms_scratch_ptr is valid in the
+ * range.  Allocations of size zero are allowed.
+ */
+#define	DTRACE_INSCRATCH(mstate, alloc_sz) \
+	((mstate)->dtms_scratch_base + (mstate)->dtms_scratch_size - \
+	(mstate)->dtms_scratch_ptr >= (alloc_sz))
+
+#ifndef VBOX
+#define	DTRACE_LOADFUNC(bits)						\
+/*CSTYLED*/								\
+VBDTSTATIC uint##bits##_t						\
+dtrace_load##bits(uintptr_t addr)					\
+{									\
+	size_t size = bits / NBBY;					\
+	/*CSTYLED*/							\
+	uint##bits##_t rval;						\
+	int i;								\
+	processorid_t me = VBDT_GET_CPUID();				\
+	volatile uint16_t *flags = (volatile uint16_t *)		\
+	    &cpu_core[me].cpuc_dtrace_flags;				\
+									\
+	DTRACE_ALIGNCHECK(addr, size, flags);				\
+									\
+	for (i = 0; i < dtrace_toxranges; i++) {			\
+		if (addr >= dtrace_toxrange[i].dtt_limit)		\
+			continue;					\
+									\
+		if (addr + size <= dtrace_toxrange[i].dtt_base)		\
+			continue;					\
+									\
+		/*							\
+		 * This address falls within a toxic region; return 0.	\
+		 */							\
+		*flags |= CPU_DTRACE_BADADDR;				\
+		cpu_core[me].cpuc_dtrace_illval = addr;			\
+		return (0);						\
+	}								\
+									\
+	*flags |= CPU_DTRACE_NOFAULT;					\
+	/*CSTYLED*/							\
+	rval = *((volatile uint##bits##_t *)addr);			\
+	*flags &= ~CPU_DTRACE_NOFAULT;					\
+									\
+	return (!(*flags & CPU_DTRACE_FAULT) ? rval : 0);		\
+}
+#else  /* VBOX */
+# define DTRACE_LOADFUNC(bits)						\
+VBDTSTATIC uint##bits##_t						\
+dtrace_load##bits(uintptr_t addr)					\
+{									\
+	size_t const size = bits / NBBY;				\
+	uint##bits##_t rval;						\
+	processorid_t me;						\
+	int i, rc;							\
+									\
+	/*DTRACE_ALIGNCHECK(addr, size, flags);*/			\
+									\
+	for (i = 0; i < dtrace_toxranges; i++) {			\
+		if (addr >= dtrace_toxrange[i].dtt_limit)		\
+			continue;					\
+									\
+		if (addr + size <= dtrace_toxrange[i].dtt_base)		\
+			continue;					\
+									\
+		/*							\
+		 * This address falls within a toxic region; return 0.	\
+		 */							\
+		me = VBDT_GET_CPUID();					\
+		cpu_core[me].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR;	\
+		cpu_core[me].cpuc_dtrace_illval = addr;			\
+		return (0);						\
+	}								\
+									\
+	rc = RTR0MemKernelCopyFrom(&rval, (void const *)addr, size);	\
+	if (RT_SUCCESS(rc))     					\
+		return rval;						\
+									\
+	/*      							\
+	 * If not supported, pray it won't fault...     		\
+	 */     							\
+	if (rc == VERR_NOT_SUPPORTED)					\
+		return *(uint##bits##_t const *)addr;   		\
+									\
+	me = VBDT_GET_CPUID();						\
+	cpu_core[me].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR;		\
+	cpu_core[me].cpuc_dtrace_illval = addr;				\
+	return (0);							\
+}
+
+#endif /* VBOX */
+
+#ifdef _LP64
+#define	dtrace_loadptr	dtrace_load64
+#else
+#define	dtrace_loadptr	dtrace_load32
+#endif
+
+#define	DTRACE_DYNHASH_FREE	0
+#define	DTRACE_DYNHASH_SINK	1
+#define	DTRACE_DYNHASH_VALID	2
+
+#define	DTRACE_MATCH_FAIL	-1
+#define	DTRACE_MATCH_NEXT	0
+#define	DTRACE_MATCH_DONE	1
+#define	DTRACE_ANCHORED(probe)	((probe)->dtpr_func[0] != '\0')
+#define	DTRACE_STATE_ALIGN	64
+
+#define	DTRACE_FLAGS2FLT(flags)						\
+	(((flags) & CPU_DTRACE_BADADDR) ? DTRACEFLT_BADADDR :		\
+	((flags) & CPU_DTRACE_ILLOP) ? DTRACEFLT_ILLOP :		\
+	((flags) & CPU_DTRACE_DIVZERO) ? DTRACEFLT_DIVZERO :		\
+	((flags) & CPU_DTRACE_KPRIV) ? DTRACEFLT_KPRIV :		\
+	((flags) & CPU_DTRACE_UPRIV) ? DTRACEFLT_UPRIV :		\
+	((flags) & CPU_DTRACE_TUPOFLOW) ?  DTRACEFLT_TUPOFLOW :		\
+	((flags) & CPU_DTRACE_BADALIGN) ?  DTRACEFLT_BADALIGN :		\
+	((flags) & CPU_DTRACE_NOSCRATCH) ?  DTRACEFLT_NOSCRATCH :	\
+	((flags) & CPU_DTRACE_BADSTACK) ?  DTRACEFLT_BADSTACK :		\
+	DTRACEFLT_UNKNOWN)
+
+#define	DTRACEACT_ISSTRING(act)						\
+	((act)->dta_kind == DTRACEACT_DIFEXPR &&			\
+	(act)->dta_difo->dtdo_rtype.dtdt_kind == DIF_TYPE_STRING)
+
+static size_t dtrace_strlen(const char *, size_t);
+static dtrace_probe_t *dtrace_probe_lookup_id(dtrace_id_t id);
+static void dtrace_enabling_provide(dtrace_provider_t *);
+static int dtrace_enabling_match(dtrace_enabling_t *, int *);
+static void dtrace_enabling_matchall(void);
+static dtrace_state_t *dtrace_anon_grab(void);
+#ifndef VBOX
+static uint64_t dtrace_helper(int, dtrace_mstate_t *,
+    dtrace_state_t *, uint64_t, uint64_t);
+static dtrace_helpers_t *dtrace_helpers_create(proc_t *);
+#endif
+static void dtrace_buffer_drop(dtrace_buffer_t *);
+static intptr_t dtrace_buffer_reserve(dtrace_buffer_t *, size_t, size_t,
+    dtrace_state_t *, dtrace_mstate_t *);
+static int dtrace_state_option(dtrace_state_t *, dtrace_optid_t,
+    dtrace_optval_t);
+static int dtrace_ecb_create_enable(dtrace_probe_t *, void *);
+static void dtrace_helper_provider_destroy(dtrace_helper_provider_t *);
+
+/*
+ * DTrace Probe Context Functions
+ *
+ * These functions are called from probe context.  Because probe context is
+ * any context in which C may be called, arbitrarily locks may be held,
+ * interrupts may be disabled, we may be in arbitrary dispatched state, etc.
+ * As a result, functions called from probe context may only call other DTrace
+ * support functions -- they may not interact at all with the system at large.
+ * (Note that the ASSERT macro is made probe-context safe by redefining it in
+ * terms of dtrace_assfail(), a probe-context safe function.) If arbitrary
+ * loads are to be performed from probe context, they _must_ be in terms of
+ * the safe dtrace_load*() variants.
+ *
+ * Some functions in this block are not actually called from probe context;
+ * for these functions, there will be a comment above the function reading
+ * "Note:  not called from probe context."
+ */
+void
+dtrace_panic(const char *format, ...)
+{
+	va_list alist;
+
+	va_start(alist, format);
+	dtrace_vpanic(format, alist);
+	va_end(alist);
+}
+
+#ifndef VBOX /* We have our own assertion machinery. */
+int
+dtrace_assfail(const char *a, const char *f, int l)
+{
+	dtrace_panic("assertion failed: %s, file: %s, line: %d", a, f, l);
+
+	/*
+	 * We just need something here that even the most clever compiler
+	 * cannot optimize away.
+	 */
+	return (a[(uintptr_t)f]);
+}
+#endif
+
+/*
+ * Atomically increment a specified error counter from probe context.
+ */
+static void
+dtrace_error(uint32_t *counter)
+{
+	/*
+	 * Most counters stored to in probe context are per-CPU counters.
+	 * However, there are some error conditions that are sufficiently
+	 * arcane that they don't merit per-CPU storage.  If these counters
+	 * are incremented concurrently on different CPUs, scalability will be
+	 * adversely affected -- but we don't expect them to be white-hot in a
+	 * correctly constructed enabling...
+	 */
+	uint32_t oval, nval;
+
+	do {
+		oval = *counter;
+
+		if ((nval = oval + 1) == 0) {
+			/*
+			 * If the counter would wrap, set it to 1 -- assuring
+			 * that the counter is never zero when we have seen
+			 * errors.  (The counter must be 32-bits because we
+			 * aren't guaranteed a 64-bit compare&swap operation.)
+			 * To save this code both the infamy of being fingered
+			 * by a priggish news story and the indignity of being
+			 * the target of a neo-puritan witch trial, we're
+			 * carefully avoiding any colorful description of the
+			 * likelihood of this condition -- but suffice it to
+			 * say that it is only slightly more likely than the
+			 * overflow of predicate cache IDs, as discussed in
+			 * dtrace_predicate_create().
+			 */
+			nval = 1;
+		}
+	} while (dtrace_cas32(counter, oval, nval) != oval);
+}
+
+/*
+ * Use the DTRACE_LOADFUNC macro to define functions for each of loading a
+ * uint8_t, a uint16_t, a uint32_t and a uint64_t.
+ */
+DTRACE_LOADFUNC(8)
+DTRACE_LOADFUNC(16)
+DTRACE_LOADFUNC(32)
+DTRACE_LOADFUNC(64)
+
+static int
+dtrace_inscratch(uintptr_t dest, size_t size, dtrace_mstate_t *mstate)
+{
+	if (dest < mstate->dtms_scratch_base)
+		return (0);
+
+	if (dest + size < dest)
+		return (0);
+
+	if (dest + size > mstate->dtms_scratch_ptr)
+		return (0);
+
+	return (1);
+}
+
+static int
+dtrace_canstore_statvar(uint64_t addr, size_t sz,
+    dtrace_statvar_t **svars, int nsvars)
+{
+	int i;
+
+	for (i = 0; i < nsvars; i++) {
+		dtrace_statvar_t *svar = svars[i];
+
+		if (svar == NULL || svar->dtsv_size == 0)
+			continue;
+
+		if (DTRACE_INRANGE(addr, sz, svar->dtsv_data, svar->dtsv_size))
+			return (1);
+	}
+
+	return (0);
+}
+
+/*
+ * Check to see if the address is within a memory region to which a store may
+ * be issued.  This includes the DTrace scratch areas, and any DTrace variable
+ * region.  The caller of dtrace_canstore() is responsible for performing any
+ * alignment checks that are needed before stores are actually executed.
+ */
+static int
+dtrace_canstore(uint64_t addr, size_t sz, dtrace_mstate_t *mstate,
+    dtrace_vstate_t *vstate)
+{
+	/*
+	 * First, check to see if the address is in scratch space...
+	 */
+	if (DTRACE_INRANGE(addr, sz, mstate->dtms_scratch_base,
+	    mstate->dtms_scratch_size))
+		return (1);
+
+	/*
+	 * Now check to see if it's a dynamic variable.  This check will pick
+	 * up both thread-local variables and any global dynamically-allocated
+	 * variables.
+	 */
+	if (DTRACE_INRANGE(addr, sz, (uintptr_t)vstate->dtvs_dynvars.dtds_base,
+	    vstate->dtvs_dynvars.dtds_size)) {
+		dtrace_dstate_t *dstate = &vstate->dtvs_dynvars;
+		uintptr_t base = (uintptr_t)dstate->dtds_base +
+		    (dstate->dtds_hashsize * sizeof (dtrace_dynhash_t));
+		uintptr_t chunkoffs;
+
+		/*
+		 * Before we assume that we can store here, we need to make
+		 * sure that it isn't in our metadata -- storing to our
+		 * dynamic variable metadata would corrupt our state.  For
+		 * the range to not include any dynamic variable metadata,
+		 * it must:
+		 *
+		 *	(1) Start above the hash table that is at the base of
+		 *	the dynamic variable space
+		 *
+		 *	(2) Have a starting chunk offset that is beyond the
+		 *	dtrace_dynvar_t that is at the base of every chunk
+		 *
+		 *	(3) Not span a chunk boundary
+		 *
+		 */
+		if (addr < base)
+			return (0);
+
+		chunkoffs = (addr - base) % dstate->dtds_chunksize;
+
+		if (chunkoffs < sizeof (dtrace_dynvar_t))
+			return (0);
+
+		if (chunkoffs + sz > dstate->dtds_chunksize)
+			return (0);
+
+		return (1);
+	}
+
+	/*
+	 * Finally, check the static local and global variables.  These checks
+	 * take the longest, so we perform them last.
+	 */
+	if (dtrace_canstore_statvar(addr, sz,
+	    vstate->dtvs_locals, vstate->dtvs_nlocals))
+		return (1);
+
+	if (dtrace_canstore_statvar(addr, sz,
+	    vstate->dtvs_globals, vstate->dtvs_nglobals))
+		return (1);
+
+	return (0);
+}
+
+
+/*
+ * Convenience routine to check to see if the address is within a memory
+ * region in which a load may be issued given the user's privilege level;
+ * if not, it sets the appropriate error flags and loads 'addr' into the
+ * illegal value slot.
+ *
+ * DTrace subroutines (DIF_SUBR_*) should use this helper to implement
+ * appropriate memory access protection.
+ */
+static int
+dtrace_canload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate,
+    dtrace_vstate_t *vstate)
+{
+	volatile uintptr_t *illval = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval;
+
+	/*
+	 * If we hold the privilege to read from kernel memory, then
+	 * everything is readable.
+	 */
+	if ((mstate->dtms_access & DTRACE_ACCESS_KERNEL) != 0)
+		return (1);
+
+	/*
+	 * You can obviously read that which you can store.
+	 */
+	if (dtrace_canstore(addr, sz, mstate, vstate))
+		return (1);
+
+	/*
+	 * We're allowed to read from our own string table.
+	 */
+	if (DTRACE_INRANGE(addr, sz, (uintptr_t)mstate->dtms_difo->dtdo_strtab,
+	    mstate->dtms_difo->dtdo_strlen))
+		return (1);
+
+	DTRACE_CPUFLAG_SET(CPU_DTRACE_KPRIV);
+	*illval = addr;
+	return (0);
+}
+
+/*
+ * Convenience routine to check to see if a given string is within a memory
+ * region in which a load may be issued given the user's privilege level;
+ * this exists so that we don't need to issue unnecessary dtrace_strlen()
+ * calls in the event that the user has all privileges.
+ */
+static int
+dtrace_strcanload(uint64_t addr, size_t sz, dtrace_mstate_t *mstate,
+    dtrace_vstate_t *vstate)
+{
+	size_t strsz;
+
+	/*
+	 * If we hold the privilege to read from kernel memory, then
+	 * everything is readable.
+	 */
+	if ((mstate->dtms_access & DTRACE_ACCESS_KERNEL) != 0)
+		return (1);
+
+	strsz = 1 + dtrace_strlen((char *)(uintptr_t)addr, sz);
+	if (dtrace_canload(addr, strsz, mstate, vstate))
+		return (1);
+
+	return (0);
+}
+
+/*
+ * Convenience routine to check to see if a given variable is within a memory
+ * region in which a load may be issued given the user's privilege level.
+ */
+static int
+dtrace_vcanload(void *src, dtrace_diftype_t *type, dtrace_mstate_t *mstate,
+    dtrace_vstate_t *vstate)
+{
+	size_t sz;
+	ASSERT(type->dtdt_flags & DIF_TF_BYREF);
+
+	/*
+	 * If we hold the privilege to read from kernel memory, then
+	 * everything is readable.
+	 */
+	if ((mstate->dtms_access & DTRACE_ACCESS_KERNEL) != 0)
+		return (1);
+
+	if (type->dtdt_kind == DIF_TYPE_STRING)
+		sz = dtrace_strlen(src,
+		    vstate->dtvs_state->dts_options[DTRACEOPT_STRSIZE]) + 1;
+	else
+		sz = type->dtdt_size;
+
+	return (dtrace_canload((uintptr_t)src, sz, mstate, vstate));
+}
+
+/*
+ * Compare two strings using safe loads.
+ */
+static int
+dtrace_strncmp(char *s1, char *s2, size_t limit)
+{
+	uint8_t c1, c2;
+	volatile uint16_t *flags;
+
+	if (s1 == s2 || limit == 0)
+		return (0);
+
+	flags = (volatile uint16_t *)&cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+
+	do {
+		if (s1 == NULL) {
+			c1 = '\0';
+		} else {
+			c1 = dtrace_load8((uintptr_t)s1++);
+		}
+
+		if (s2 == NULL) {
+			c2 = '\0';
+		} else {
+			c2 = dtrace_load8((uintptr_t)s2++);
+		}
+
+		if (c1 != c2)
+			return (c1 - c2);
+	} while (--limit && c1 != '\0' && !(*flags & CPU_DTRACE_FAULT));
+
+	return (0);
+}
+
+/*
+ * Compute strlen(s) for a string using safe memory accesses.  The additional
+ * len parameter is used to specify a maximum length to ensure completion.
+ */
+static size_t
+dtrace_strlen(const char *s, size_t lim)
+{
+	uint_t len;
+
+	for (len = 0; len != lim; len++) {
+		if (dtrace_load8((uintptr_t)s++) == '\0')
+			break;
+	}
+
+	return (len);
+}
+
+/*
+ * Check if an address falls within a toxic region.
+ */
+static int
+dtrace_istoxic(uintptr_t kaddr, size_t size)
+{
+	uintptr_t taddr, tsize;
+	int i;
+
+	for (i = 0; i < dtrace_toxranges; i++) {
+		taddr = dtrace_toxrange[i].dtt_base;
+		tsize = dtrace_toxrange[i].dtt_limit - taddr;
+
+		if (kaddr - taddr < tsize) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
+			cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = kaddr;
+			return (1);
+		}
+
+		if (taddr - kaddr < size) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
+			cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = taddr;
+			return (1);
+		}
+	}
+
+	return (0);
+}
+
+/*
+ * Copy src to dst using safe memory accesses.  The src is assumed to be unsafe
+ * memory specified by the DIF program.  The dst is assumed to be safe memory
+ * that we can store to directly because it is managed by DTrace.  As with
+ * standard bcopy, overlapping copies are handled properly.
+ */
+static void
+dtrace_bcopy(const void *src, void *dst, size_t len)
+{
+	if (len != 0) {
+		uint8_t *s1 = dst;
+		const uint8_t *s2 = src;
+
+		if (s1 <= s2) {
+			do {
+				*s1++ = dtrace_load8((uintptr_t)s2++);
+			} while (--len != 0);
+		} else {
+			s2 += len;
+			s1 += len;
+
+			do {
+				*--s1 = dtrace_load8((uintptr_t)--s2);
+			} while (--len != 0);
+		}
+	}
+}
+
+/*
+ * Copy src to dst using safe memory accesses, up to either the specified
+ * length, or the point that a nul byte is encountered.  The src is assumed to
+ * be unsafe memory specified by the DIF program.  The dst is assumed to be
+ * safe memory that we can store to directly because it is managed by DTrace.
+ * Unlike dtrace_bcopy(), overlapping regions are not handled.
+ */
+static void
+dtrace_strcpy(const void *src, void *dst, size_t len)
+{
+	if (len != 0) {
+		uint8_t *s1 = dst, c;
+		const uint8_t *s2 = src;
+
+		do {
+			*s1++ = c = dtrace_load8((uintptr_t)s2++);
+		} while (--len != 0 && c != '\0');
+	}
+}
+
+/*
+ * Copy src to dst, deriving the size and type from the specified (BYREF)
+ * variable type.  The src is assumed to be unsafe memory specified by the DIF
+ * program.  The dst is assumed to be DTrace variable memory that is of the
+ * specified type; we assume that we can store to directly.
+ */
+static void
+dtrace_vcopy(void *src, void *dst, dtrace_diftype_t *type)
+{
+	ASSERT(type->dtdt_flags & DIF_TF_BYREF);
+
+	if (type->dtdt_kind == DIF_TYPE_STRING) {
+		dtrace_strcpy(src, dst, type->dtdt_size);
+	} else {
+		dtrace_bcopy(src, dst, type->dtdt_size);
+	}
+}
+
+/*
+ * Compare s1 to s2 using safe memory accesses.  The s1 data is assumed to be
+ * unsafe memory specified by the DIF program.  The s2 data is assumed to be
+ * safe memory that we can access directly because it is managed by DTrace.
+ */
+static int
+dtrace_bcmp(const void *s1, const void *s2, size_t len)
+{
+	volatile uint16_t *flags;
+
+	flags = (volatile uint16_t *)&cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+
+	if (s1 == s2)
+		return (0);
+
+	if (s1 == NULL || s2 == NULL)
+		return (1);
+
+	if (s1 != s2 && len != 0) {
+		const uint8_t *ps1 = s1;
+		const uint8_t *ps2 = s2;
+
+		do {
+			if (dtrace_load8((uintptr_t)ps1++) != *ps2++)
+				return (1);
+		} while (--len != 0 && !(*flags & CPU_DTRACE_FAULT));
+	}
+	return (0);
+}
+
+/*
+ * Zero the specified region using a simple byte-by-byte loop.  Note that this
+ * is for safe DTrace-managed memory only.
+ */
+static void
+dtrace_bzero(void *dst, size_t len)
+{
+	uchar_t *cp;
+
+	for (cp = dst; len != 0; len--)
+		*cp++ = 0;
+}
+
+static void
+dtrace_add_128(uint64_t *addend1, uint64_t *addend2, uint64_t *sum)
+{
+	uint64_t result[2];
+
+	result[0] = addend1[0] + addend2[0];
+	result[1] = addend1[1] + addend2[1] +
+	    (result[0] < addend1[0] || result[0] < addend2[0] ? 1 : 0);
+
+	sum[0] = result[0];
+	sum[1] = result[1];
+}
+
+/*
+ * Shift the 128-bit value in a by b. If b is positive, shift left.
+ * If b is negative, shift right.
+ */
+static void
+dtrace_shift_128(uint64_t *a, int b)
+{
+	uint64_t mask;
+
+	if (b == 0)
+		return;
+
+	if (b < 0) {
+		b = -b;
+		if (b >= 64) {
+			a[0] = a[1] >> (b - 64);
+			a[1] = 0;
+		} else {
+			a[0] >>= b;
+			mask = 1LL << (64 - b);
+			mask -= 1;
+			a[0] |= ((a[1] & mask) << (64 - b));
+			a[1] >>= b;
+		}
+	} else {
+		if (b >= 64) {
+			a[1] = a[0] << (b - 64);
+			a[0] = 0;
+		} else {
+			a[1] <<= b;
+			mask = a[0] >> (64 - b);
+			a[1] |= mask;
+			a[0] <<= b;
+		}
+	}
+}
+
+/*
+ * The basic idea is to break the 2 64-bit values into 4 32-bit values,
+ * use native multiplication on those, and then re-combine into the
+ * resulting 128-bit value.
+ *
+ * (hi1 << 32 + lo1) * (hi2 << 32 + lo2) =
+ *     hi1 * hi2 << 64 +
+ *     hi1 * lo2 << 32 +
+ *     hi2 * lo1 << 32 +
+ *     lo1 * lo2
+ */
+static void
+dtrace_multiply_128(uint64_t factor1, uint64_t factor2, uint64_t *product)
+{
+	uint64_t hi1, hi2, lo1, lo2;
+	uint64_t tmp[2];
+
+	hi1 = factor1 >> 32;
+	hi2 = factor2 >> 32;
+
+	lo1 = factor1 & DT_MASK_LO;
+	lo2 = factor2 & DT_MASK_LO;
+
+	product[0] = lo1 * lo2;
+	product[1] = hi1 * hi2;
+
+	tmp[0] = hi1 * lo2;
+	tmp[1] = 0;
+	dtrace_shift_128(tmp, 32);
+	dtrace_add_128(product, tmp, product);
+
+	tmp[0] = hi2 * lo1;
+	tmp[1] = 0;
+	dtrace_shift_128(tmp, 32);
+	dtrace_add_128(product, tmp, product);
+}
+
+/*
+ * This privilege check should be used by actions and subroutines to
+ * verify that the user credentials of the process that enabled the
+ * invoking ECB match the target credentials
+ */
+static int
+dtrace_priv_proc_common_user(dtrace_state_t *state)
+{
+	cred_t *cr, *s_cr = state->dts_cred.dcr_cred;
+
+	/*
+	 * We should always have a non-NULL state cred here, since if cred
+	 * is null (anonymous tracing), we fast-path bypass this routine.
+	 */
+	ASSERT(s_cr != NULL);
+
+	if ((cr = CRED()) != NULL &&
+	    s_cr->cr_uid == cr->cr_uid &&
+	    s_cr->cr_uid == cr->cr_ruid &&
+	    s_cr->cr_uid == cr->cr_suid &&
+	    s_cr->cr_gid == cr->cr_gid &&
+	    s_cr->cr_gid == cr->cr_rgid &&
+	    s_cr->cr_gid == cr->cr_sgid)
+		return (1);
+
+	return (0);
+}
+
+/*
+ * This privilege check should be used by actions and subroutines to
+ * verify that the zone of the process that enabled the invoking ECB
+ * matches the target credentials
+ */
+static int
+dtrace_priv_proc_common_zone(dtrace_state_t *state)
+{
+	cred_t *cr, *s_cr = state->dts_cred.dcr_cred;
+
+	/*
+	 * We should always have a non-NULL state cred here, since if cred
+	 * is null (anonymous tracing), we fast-path bypass this routine.
+	 */
+	ASSERT(s_cr != NULL);
+
+	if ((cr = CRED()) != NULL &&
+	    s_cr->cr_zone == cr->cr_zone)
+		return (1);
+
+	return (0);
+}
+
+/*
+ * This privilege check should be used by actions and subroutines to
+ * verify that the process has not setuid or changed credentials.
+ */
+static int
+dtrace_priv_proc_common_nocd(VBDTVOID)
+{
+#ifndef VBOX
+	proc_t *proc;
+
+	if ((proc = VBDT_GET_PROC()) != NULL &&
+	    !(proc->p_flag & SNOCD))
+		return (1);
+
+	return (0);
+#else
+	return (1);
+#endif
+}
+
+static int
+dtrace_priv_proc_destructive(dtrace_state_t *state)
+{
+	int action = state->dts_cred.dcr_action;
+
+	if (((action & DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE) == 0) &&
+	    dtrace_priv_proc_common_zone(state) == 0)
+		goto bad;
+
+	if (((action & DTRACE_CRA_PROC_DESTRUCTIVE_ALLUSER) == 0) &&
+	    dtrace_priv_proc_common_user(state) == 0)
+		goto bad;
+
+	if (((action & DTRACE_CRA_PROC_DESTRUCTIVE_CREDCHG) == 0) &&
+	    dtrace_priv_proc_common_nocd() == 0)
+		goto bad;
+
+	return (1);
+
+bad:
+	cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV;
+
+	return (0);
+}
+
+static int
+dtrace_priv_proc_control(dtrace_state_t *state)
+{
+	if (state->dts_cred.dcr_action & DTRACE_CRA_PROC_CONTROL)
+		return (1);
+
+	if (dtrace_priv_proc_common_zone(state) &&
+	    dtrace_priv_proc_common_user(state) &&
+	    dtrace_priv_proc_common_nocd())
+		return (1);
+
+	cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV;
+
+	return (0);
+}
+
+static int
+dtrace_priv_proc(dtrace_state_t *state)
+{
+	if (state->dts_cred.dcr_action & DTRACE_CRA_PROC)
+		return (1);
+
+	cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_UPRIV;
+
+	return (0);
+}
+
+static int
+dtrace_priv_kernel(dtrace_state_t *state)
+{
+	if (state->dts_cred.dcr_action & DTRACE_CRA_KERNEL)
+		return (1);
+
+	cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_KPRIV;
+
+	return (0);
+}
+
+static int
+dtrace_priv_kernel_destructive(dtrace_state_t *state)
+{
+	if (state->dts_cred.dcr_action & DTRACE_CRA_KERNEL_DESTRUCTIVE)
+		return (1);
+
+	cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_KPRIV;
+
+	return (0);
+}
+
+/*
+ * Note:  not called from probe context.  This function is called
+ * asynchronously (and at a regular interval) from outside of probe context to
+ * clean the dirty dynamic variable lists on all CPUs.  Dynamic variable
+ * cleaning is explained in detail in <sys/dtrace_impl.h>.
+ */
+VBDTSTATIC void
+dtrace_dynvar_clean(dtrace_dstate_t *dstate)
+{
+	dtrace_dynvar_t *dirty;
+	dtrace_dstate_percpu_t *dcpu;
+	dtrace_dynvar_t **rinsep;
+	int i, j, work = 0;
+
+	for (i = 0; i < NCPU; i++) {
+		dcpu = &dstate->dtds_percpu[i];
+		rinsep = &dcpu->dtdsc_rinsing;
+
+		/*
+		 * If the dirty list is NULL, there is no dirty work to do.
+		 */
+		if (dcpu->dtdsc_dirty == NULL)
+			continue;
+
+		if (dcpu->dtdsc_rinsing != NULL) {
+			/*
+			 * If the rinsing list is non-NULL, then it is because
+			 * this CPU was selected to accept another CPU's
+			 * dirty list -- and since that time, dirty buffers
+			 * have accumulated.  This is a highly unlikely
+			 * condition, but we choose to ignore the dirty
+			 * buffers -- they'll be picked up a future cleanse.
+			 */
+			continue;
+		}
+
+		if (dcpu->dtdsc_clean != NULL) {
+			/*
+			 * If the clean list is non-NULL, then we're in a
+			 * situation where a CPU has done deallocations (we
+			 * have a non-NULL dirty list) but no allocations (we
+			 * also have a non-NULL clean list).  We can't simply
+			 * move the dirty list into the clean list on this
+			 * CPU, yet we also don't want to allow this condition
+			 * to persist, lest a short clean list prevent a
+			 * massive dirty list from being cleaned (which in
+			 * turn could lead to otherwise avoidable dynamic
+			 * drops).  To deal with this, we look for some CPU
+			 * with a NULL clean list, NULL dirty list, and NULL
+			 * rinsing list -- and then we borrow this CPU to
+			 * rinse our dirty list.
+			 */
+			for (j = 0; j < NCPU; j++) {
+				dtrace_dstate_percpu_t *rinser;
+
+				rinser = &dstate->dtds_percpu[j];
+
+				if (rinser->dtdsc_rinsing != NULL)
+					continue;
+
+				if (rinser->dtdsc_dirty != NULL)
+					continue;
+
+				if (rinser->dtdsc_clean != NULL)
+					continue;
+
+				rinsep = &rinser->dtdsc_rinsing;
+				break;
+			}
+
+			if (j == NCPU) {
+				/*
+				 * We were unable to find another CPU that
+				 * could accept this dirty list -- we are
+				 * therefore unable to clean it now.
+				 */
+				dtrace_dynvar_failclean++;
+				continue;
+			}
+		}
+
+		work = 1;
+
+		/*
+		 * Atomically move the dirty list aside.
+		 */
+		do {
+			dirty = dcpu->dtdsc_dirty;
+
+			/*
+			 * Before we zap the dirty list, set the rinsing list.
+			 * (This allows for a potential assertion in
+			 * dtrace_dynvar():  if a free dynamic variable appears
+			 * on a hash chain, either the dirty list or the
+			 * rinsing list for some CPU must be non-NULL.)
+			 */
+			*rinsep = dirty;
+			dtrace_membar_producer();
+		} while (dtrace_casptr(&dcpu->dtdsc_dirty,
+		    dirty, NULL) != dirty);
+	}
+
+	if (!work) {
+		/*
+		 * We have no work to do; we can simply return.
+		 */
+		return;
+	}
+
+	dtrace_sync();
+
+	for (i = 0; i < NCPU; i++) {
+		dcpu = &dstate->dtds_percpu[i];
+
+		if (dcpu->dtdsc_rinsing == NULL)
+			continue;
+
+		/*
+		 * We are now guaranteed that no hash chain contains a pointer
+		 * into this dirty list; we can make it clean.
+		 */
+		ASSERT(dcpu->dtdsc_clean == NULL);
+		dcpu->dtdsc_clean = dcpu->dtdsc_rinsing;
+		dcpu->dtdsc_rinsing = NULL;
+	}
+
+	/*
+	 * Before we actually set the state to be DTRACE_DSTATE_CLEAN, make
+	 * sure that all CPUs have seen all of the dtdsc_clean pointers.
+	 * This prevents a race whereby a CPU incorrectly decides that
+	 * the state should be something other than DTRACE_DSTATE_CLEAN
+	 * after dtrace_dynvar_clean() has completed.
+	 */
+	dtrace_sync();
+
+	dstate->dtds_state = DTRACE_DSTATE_CLEAN;
+}
+
+/*
+ * Depending on the value of the op parameter, this function looks-up,
+ * allocates or deallocates an arbitrarily-keyed dynamic variable.  If an
+ * allocation is requested, this function will return a pointer to a
+ * dtrace_dynvar_t corresponding to the allocated variable -- or NULL if no
+ * variable can be allocated.  If NULL is returned, the appropriate counter
+ * will be incremented.
+ */
+VBDTSTATIC dtrace_dynvar_t *
+dtrace_dynvar(dtrace_dstate_t *dstate, uint_t nkeys,
+    dtrace_key_t *key, size_t dsize, dtrace_dynvar_op_t op,
+    dtrace_mstate_t *mstate, dtrace_vstate_t *vstate)
+{
+	uint64_t hashval = DTRACE_DYNHASH_VALID;
+	dtrace_dynhash_t *hash = dstate->dtds_hash;
+	dtrace_dynvar_t *free, *new_free, *next, *dvar, *start, *prev = NULL;
+	processorid_t me = VBDT_GET_CPUID(), cpu = me;
+	dtrace_dstate_percpu_t *dcpu = &dstate->dtds_percpu[me];
+	size_t bucket, ksize;
+	size_t chunksize = dstate->dtds_chunksize;
+	uintptr_t kdata, lock, nstate;
+	uint_t i;
+
+	ASSERT(nkeys != 0);
+
+	/*
+	 * Hash the key.  As with aggregations, we use Jenkins' "One-at-a-time"
+	 * algorithm.  For the by-value portions, we perform the algorithm in
+	 * 16-bit chunks (as opposed to 8-bit chunks).  This speeds things up a
+	 * bit, and seems to have only a minute effect on distribution.  For
+	 * the by-reference data, we perform "One-at-a-time" iterating (safely)
+	 * over each referenced byte.  It's painful to do this, but it's much
+	 * better than pathological hash distribution.  The efficacy of the
+	 * hashing algorithm (and a comparison with other algorithms) may be
+	 * found by running the ::dtrace_dynstat MDB dcmd.
+	 */
+	for (i = 0; i < nkeys; i++) {
+		if (key[i].dttk_size == 0) {
+			uint64_t val = key[i].dttk_value;
+
+			hashval += (val >> 48) & 0xffff;
+			hashval += (hashval << 10);
+			hashval ^= (hashval >> 6);
+
+			hashval += (val >> 32) & 0xffff;
+			hashval += (hashval << 10);
+			hashval ^= (hashval >> 6);
+
+			hashval += (val >> 16) & 0xffff;
+			hashval += (hashval << 10);
+			hashval ^= (hashval >> 6);
+
+			hashval += val & 0xffff;
+			hashval += (hashval << 10);
+			hashval ^= (hashval >> 6);
+		} else {
+			/*
+			 * This is incredibly painful, but it beats the hell
+			 * out of the alternative.
+			 */
+			uint64_t j, size = key[i].dttk_size;
+			uintptr_t base = (uintptr_t)key[i].dttk_value;
+
+			if (!dtrace_canload(base, size, mstate, vstate))
+				break;
+
+			for (j = 0; j < size; j++) {
+				hashval += dtrace_load8(base + j);
+				hashval += (hashval << 10);
+				hashval ^= (hashval >> 6);
+			}
+		}
+	}
+
+	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT))
+		return (NULL);
+
+	hashval += (hashval << 3);
+	hashval ^= (hashval >> 11);
+	hashval += (hashval << 15);
+
+	/*
+	 * There is a remote chance (ideally, 1 in 2^31) that our hashval
+	 * comes out to be one of our two sentinel hash values.  If this
+	 * actually happens, we set the hashval to be a value known to be a
+	 * non-sentinel value.
+	 */
+	if (hashval == DTRACE_DYNHASH_FREE || hashval == DTRACE_DYNHASH_SINK)
+		hashval = DTRACE_DYNHASH_VALID;
+
+	/*
+	 * Yes, it's painful to do a divide here.  If the cycle count becomes
+	 * important here, tricks can be pulled to reduce it.  (However, it's
+	 * critical that hash collisions be kept to an absolute minimum;
+	 * they're much more painful than a divide.)  It's better to have a
+	 * solution that generates few collisions and still keeps things
+	 * relatively simple.
+	 */
+	bucket = hashval % dstate->dtds_hashsize;
+
+	if (op == DTRACE_DYNVAR_DEALLOC) {
+		volatile uintptr_t *lockp = &hash[bucket].dtdh_lock;
+
+		for (;;) {
+			while ((lock = *lockp) & 1)
+				continue;
+
+			if (dtrace_casptr((void *)lockp,
+			    (void *)lock, (void *)(lock + 1)) == (void *)lock)
+				break;
+		}
+
+		dtrace_membar_producer();
+	}
+
+top:
+	prev = NULL;
+	lock = hash[bucket].dtdh_lock;
+
+	dtrace_membar_consumer();
+
+	start = hash[bucket].dtdh_chain;
+	ASSERT(start != NULL && (start->dtdv_hashval == DTRACE_DYNHASH_SINK ||
+	    start->dtdv_hashval != DTRACE_DYNHASH_FREE ||
+	    op != DTRACE_DYNVAR_DEALLOC));
+
+	for (dvar = start; dvar != NULL; dvar = dvar->dtdv_next) {
+		dtrace_tuple_t *dtuple = &dvar->dtdv_tuple;
+		dtrace_key_t *dkey = &dtuple->dtt_key[0];
+
+		if (dvar->dtdv_hashval != hashval) {
+			if (dvar->dtdv_hashval == DTRACE_DYNHASH_SINK) {
+				/*
+				 * We've reached the sink, and therefore the
+				 * end of the hash chain; we can kick out of
+				 * the loop knowing that we have seen a valid
+				 * snapshot of state.
+				 */
+				ASSERT(dvar->dtdv_next == NULL);
+				ASSERT(dvar == &dtrace_dynhash_sink);
+				break;
+			}
+
+			if (dvar->dtdv_hashval == DTRACE_DYNHASH_FREE) {
+				/*
+				 * We've gone off the rails:  somewhere along
+				 * the line, one of the members of this hash
+				 * chain was deleted.  Note that we could also
+				 * detect this by simply letting this loop run
+				 * to completion, as we would eventually hit
+				 * the end of the dirty list.  However, we
+				 * want to avoid running the length of the
+				 * dirty list unnecessarily (it might be quite
+				 * long), so we catch this as early as
+				 * possible by detecting the hash marker.  In
+				 * this case, we simply set dvar to NULL and
+				 * break; the conditional after the loop will
+				 * send us back to top.
+				 */
+				dvar = NULL;
+				break;
+			}
+
+			goto next;
+		}
+
+		if (dtuple->dtt_nkeys != nkeys)
+			goto next;
+
+		for (i = 0; i < nkeys; i++, dkey++) {
+			if (dkey->dttk_size != key[i].dttk_size)
+				goto next; /* size or type mismatch */
+
+			if (dkey->dttk_size != 0) {
+				if (dtrace_bcmp(
+				    (void *)(uintptr_t)key[i].dttk_value,
+				    (void *)(uintptr_t)dkey->dttk_value,
+				    dkey->dttk_size))
+					goto next;
+			} else {
+				if (dkey->dttk_value != key[i].dttk_value)
+					goto next;
+			}
+		}
+
+		if (op != DTRACE_DYNVAR_DEALLOC)
+			return (dvar);
+
+		ASSERT(dvar->dtdv_next == NULL ||
+		    dvar->dtdv_next->dtdv_hashval != DTRACE_DYNHASH_FREE);
+
+		if (prev != NULL) {
+			ASSERT(hash[bucket].dtdh_chain != dvar);
+			ASSERT(start != dvar);
+			ASSERT(prev->dtdv_next == dvar);
+			prev->dtdv_next = dvar->dtdv_next;
+		} else {
+			if (dtrace_casptr(&hash[bucket].dtdh_chain,
+			    start, dvar->dtdv_next) != start) {
+				/*
+				 * We have failed to atomically swing the
+				 * hash table head pointer, presumably because
+				 * of a conflicting allocation on another CPU.
+				 * We need to reread the hash chain and try
+				 * again.
+				 */
+				goto top;
+			}
+		}
+
+		dtrace_membar_producer();
+
+		/*
+		 * Now set the hash value to indicate that it's free.
+		 */
+		ASSERT(hash[bucket].dtdh_chain != dvar);
+		dvar->dtdv_hashval = DTRACE_DYNHASH_FREE;
+
+		dtrace_membar_producer();
+
+		/*
+		 * Set the next pointer to point at the dirty list, and
+		 * atomically swing the dirty pointer to the newly freed dvar.
+		 */
+		do {
+			next = dcpu->dtdsc_dirty;
+			dvar->dtdv_next = next;
+		} while (dtrace_casptr(&dcpu->dtdsc_dirty, next, dvar) != next);
+
+		/*
+		 * Finally, unlock this hash bucket.
+		 */
+		ASSERT(hash[bucket].dtdh_lock == lock);
+		ASSERT(lock & 1);
+		hash[bucket].dtdh_lock++;
+
+		return (NULL);
+next:
+		prev = dvar;
+		continue;
+	}
+
+	if (dvar == NULL) {
+		/*
+		 * If dvar is NULL, it is because we went off the rails:
+		 * one of the elements that we traversed in the hash chain
+		 * was deleted while we were traversing it.  In this case,
+		 * we assert that we aren't doing a dealloc (deallocs lock
+		 * the hash bucket to prevent themselves from racing with
+		 * one another), and retry the hash chain traversal.
+		 */
+		ASSERT(op != DTRACE_DYNVAR_DEALLOC);
+		goto top;
+	}
+
+	if (op != DTRACE_DYNVAR_ALLOC) {
+		/*
+		 * If we are not to allocate a new variable, we want to
+		 * return NULL now.  Before we return, check that the value
+		 * of the lock word hasn't changed.  If it has, we may have
+		 * seen an inconsistent snapshot.
+		 */
+		if (op == DTRACE_DYNVAR_NOALLOC) {
+			if (hash[bucket].dtdh_lock != lock)
+				goto top;
+		} else {
+			ASSERT(op == DTRACE_DYNVAR_DEALLOC);
+			ASSERT(hash[bucket].dtdh_lock == lock);
+			ASSERT(lock & 1);
+			hash[bucket].dtdh_lock++;
+		}
+
+		return (NULL);
+	}
+
+	/*
+	 * We need to allocate a new dynamic variable.  The size we need is the
+	 * size of dtrace_dynvar plus the size of nkeys dtrace_key_t's plus the
+	 * size of any auxiliary key data (rounded up to 8-byte alignment) plus
+	 * the size of any referred-to data (dsize).  We then round the final
+	 * size up to the chunksize for allocation.
+	 */
+	for (ksize = 0, i = 0; i < nkeys; i++)
+		ksize += P2ROUNDUP(key[i].dttk_size, sizeof (uint64_t));
+
+	/*
+	 * This should be pretty much impossible, but could happen if, say,
+	 * strange DIF specified the tuple.  Ideally, this should be an
+	 * assertion and not an error condition -- but that requires that the
+	 * chunksize calculation in dtrace_difo_chunksize() be absolutely
+	 * bullet-proof.  (That is, it must not be able to be fooled by
+	 * malicious DIF.)  Given the lack of backwards branches in DIF,
+	 * solving this would presumably not amount to solving the Halting
+	 * Problem -- but it still seems awfully hard.
+	 */
+	if (sizeof (dtrace_dynvar_t) + sizeof (dtrace_key_t) * (nkeys - 1) +
+	    ksize + dsize > chunksize) {
+		dcpu->dtdsc_drops++;
+		return (NULL);
+	}
+
+	nstate = DTRACE_DSTATE_EMPTY;
+
+	do {
+retry:
+		free = dcpu->dtdsc_free;
+
+		if (free == NULL) {
+			dtrace_dynvar_t *clean = dcpu->dtdsc_clean;
+			void *rval;
+
+			if (clean == NULL) {
+				/*
+				 * We're out of dynamic variable space on
+				 * this CPU.  Unless we have tried all CPUs,
+				 * we'll try to allocate from a different
+				 * CPU.
+				 */
+				switch (dstate->dtds_state) {
+				case DTRACE_DSTATE_CLEAN: {
+					void *sp = &dstate->dtds_state;
+
+					if (++cpu >= NCPU)
+						cpu = 0;
+
+					if (dcpu->dtdsc_dirty != NULL &&
+					    nstate == DTRACE_DSTATE_EMPTY)
+						nstate = DTRACE_DSTATE_DIRTY;
+
+					if (dcpu->dtdsc_rinsing != NULL)
+						nstate = DTRACE_DSTATE_RINSING;
+
+					dcpu = &dstate->dtds_percpu[cpu];
+
+					if (cpu != me)
+						goto retry;
+
+					(void) dtrace_cas32(sp,
+					    DTRACE_DSTATE_CLEAN, nstate);
+
+					/*
+					 * To increment the correct bean
+					 * counter, take another lap.
+					 */
+					goto retry;
+				}
+
+				case DTRACE_DSTATE_DIRTY:
+					dcpu->dtdsc_dirty_drops++;
+					break;
+
+				case DTRACE_DSTATE_RINSING:
+					dcpu->dtdsc_rinsing_drops++;
+					break;
+
+				case DTRACE_DSTATE_EMPTY:
+					dcpu->dtdsc_drops++;
+					break;
+				}
+
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_DROP);
+				return (NULL);
+			}
+
+			/*
+			 * The clean list appears to be non-empty.  We want to
+			 * move the clean list to the free list; we start by
+			 * moving the clean pointer aside.
+			 */
+			if (dtrace_casptr(&dcpu->dtdsc_clean,
+			    clean, NULL) != clean) {
+				/*
+				 * We are in one of two situations:
+				 *
+				 *  (a)	The clean list was switched to the
+				 *	free list by another CPU.
+				 *
+				 *  (b)	The clean list was added to by the
+				 *	cleansing cyclic.
+				 *
+				 * In either of these situations, we can
+				 * just reattempt the free list allocation.
+				 */
+				goto retry;
+			}
+
+			ASSERT(clean->dtdv_hashval == DTRACE_DYNHASH_FREE);
+
+			/*
+			 * Now we'll move the clean list to our free list.
+			 * It's impossible for this to fail:  the only way
+			 * the free list can be updated is through this
+			 * code path, and only one CPU can own the clean list.
+			 * Thus, it would only be possible for this to fail if
+			 * this code were racing with dtrace_dynvar_clean().
+			 * (That is, if dtrace_dynvar_clean() updated the clean
+			 * list, and we ended up racing to update the free
+			 * list.)  This race is prevented by the dtrace_sync()
+			 * in dtrace_dynvar_clean() -- which flushes the
+			 * owners of the clean lists out before resetting
+			 * the clean lists.
+			 */
+			dcpu = &dstate->dtds_percpu[me];
+			rval = dtrace_casptr(&dcpu->dtdsc_free, NULL, clean);
+			ASSERT(rval == NULL);
+			goto retry;
+		}
+
+		dvar = free;
+		new_free = dvar->dtdv_next;
+	} while (dtrace_casptr(&dcpu->dtdsc_free, free, new_free) != free);
+
+	/*
+	 * We have now allocated a new chunk.  We copy the tuple keys into the
+	 * tuple array and copy any referenced key data into the data space
+	 * following the tuple array.  As we do this, we relocate dttk_value
+	 * in the final tuple to point to the key data address in the chunk.
+	 */
+	kdata = (uintptr_t)&dvar->dtdv_tuple.dtt_key[nkeys];
+	dvar->dtdv_data = (void *)(kdata + ksize);
+	dvar->dtdv_tuple.dtt_nkeys = nkeys;
+
+	for (i = 0; i < nkeys; i++) {
+		dtrace_key_t *dkey = &dvar->dtdv_tuple.dtt_key[i];
+		size_t kesize = key[i].dttk_size;
+
+		if (kesize != 0) {
+			dtrace_bcopy(
+			    (const void *)(uintptr_t)key[i].dttk_value,
+			    (void *)kdata, kesize);
+			dkey->dttk_value = kdata;
+			kdata += P2ROUNDUP(kesize, sizeof (uint64_t));
+		} else {
+			dkey->dttk_value = key[i].dttk_value;
+		}
+
+		dkey->dttk_size = kesize;
+	}
+
+	ASSERT(dvar->dtdv_hashval == DTRACE_DYNHASH_FREE);
+	dvar->dtdv_hashval = hashval;
+	dvar->dtdv_next = start;
+
+	if (dtrace_casptr(&hash[bucket].dtdh_chain, start, dvar) == start)
+		return (dvar);
+
+	/*
+	 * The cas has failed.  Either another CPU is adding an element to
+	 * this hash chain, or another CPU is deleting an element from this
+	 * hash chain.  The simplest way to deal with both of these cases
+	 * (though not necessarily the most efficient) is to free our
+	 * allocated block and tail-call ourselves.  Note that the free is
+	 * to the dirty list and _not_ to the free list.  This is to prevent
+	 * races with allocators, above.
+	 */
+	dvar->dtdv_hashval = DTRACE_DYNHASH_FREE;
+
+	dtrace_membar_producer();
+
+	do {
+		free = dcpu->dtdsc_dirty;
+		dvar->dtdv_next = free;
+	} while (dtrace_casptr(&dcpu->dtdsc_dirty, free, dvar) != free);
+
+	return (dtrace_dynvar(dstate, nkeys, key, dsize, op, mstate, vstate));
+}
+
+/*ARGSUSED*/
+static void
+dtrace_aggregate_min(uint64_t *oval, uint64_t nval, uint64_t arg)
+{
+	if ((int64_t)nval < (int64_t)*oval)
+		*oval = nval;
+}
+
+/*ARGSUSED*/
+static void
+dtrace_aggregate_max(uint64_t *oval, uint64_t nval, uint64_t arg)
+{
+	if ((int64_t)nval > (int64_t)*oval)
+		*oval = nval;
+}
+
+static void
+dtrace_aggregate_quantize(uint64_t *quanta, uint64_t nval, uint64_t incr)
+{
+	int i, zero = DTRACE_QUANTIZE_ZEROBUCKET;
+	int64_t val = (int64_t)nval;
+
+	if (val < 0) {
+		for (i = 0; i < zero; i++) {
+			if (val <= DTRACE_QUANTIZE_BUCKETVAL(i)) {
+				quanta[i] += incr;
+				return;
+			}
+		}
+	} else {
+		for (i = zero + 1; i < VBDTCAST(int)DTRACE_QUANTIZE_NBUCKETS; i++) {
+			if (val < DTRACE_QUANTIZE_BUCKETVAL(i)) {
+				quanta[i - 1] += incr;
+				return;
+			}
+		}
+
+		quanta[DTRACE_QUANTIZE_NBUCKETS - 1] += incr;
+		return;
+	}
+
+#ifndef VBOX
+	ASSERT(0);
+#else
+	AssertFatalFailed();
+#endif
+}
+
+static void
+dtrace_aggregate_lquantize(uint64_t *lquanta, uint64_t nval, uint64_t incr)
+{
+	uint64_t arg = *lquanta++;
+	int32_t base = DTRACE_LQUANTIZE_BASE(arg);
+	uint16_t step = DTRACE_LQUANTIZE_STEP(arg);
+	uint16_t levels = DTRACE_LQUANTIZE_LEVELS(arg);
+	int32_t val = (int32_t)nval, level;
+
+	ASSERT(step != 0);
+	ASSERT(levels != 0);
+
+	if (val < base) {
+		/*
+		 * This is an underflow.
+		 */
+		lquanta[0] += incr;
+		return;
+	}
+
+	level = (val - base) / step;
+
+	if (level < levels) {
+		lquanta[level + 1] += incr;
+		return;
+	}
+
+	/*
+	 * This is an overflow.
+	 */
+	lquanta[levels + 1] += incr;
+}
+
+/*ARGSUSED*/
+static void
+dtrace_aggregate_avg(uint64_t *data, uint64_t nval, uint64_t arg)
+{
+	data[0]++;
+	data[1] += nval;
+}
+
+/*ARGSUSED*/
+static void
+dtrace_aggregate_stddev(uint64_t *data, uint64_t nval, uint64_t arg)
+{
+	int64_t snval = (int64_t)nval;
+	uint64_t tmp[2];
+
+	data[0]++;
+	data[1] += nval;
+
+	/*
+	 * What we want to say here is:
+	 *
+	 * data[2] += nval * nval;
+	 *
+	 * But given that nval is 64-bit, we could easily overflow, so
+	 * we do this as 128-bit arithmetic.
+	 */
+	if (snval < 0)
+		snval = -snval;
+
+	dtrace_multiply_128((uint64_t)snval, (uint64_t)snval, tmp);
+	dtrace_add_128(data + 2, tmp, data + 2);
+}
+
+/*ARGSUSED*/
+static void
+dtrace_aggregate_count(uint64_t *oval, uint64_t nval, uint64_t arg)
+{
+	*oval = *oval + 1;
+}
+
+/*ARGSUSED*/
+static void
+dtrace_aggregate_sum(uint64_t *oval, uint64_t nval, uint64_t arg)
+{
+	*oval += nval;
+}
+
+/*
+ * Aggregate given the tuple in the principal data buffer, and the aggregating
+ * action denoted by the specified dtrace_aggregation_t.  The aggregation
+ * buffer is specified as the buf parameter.  This routine does not return
+ * failure; if there is no space in the aggregation buffer, the data will be
+ * dropped, and a corresponding counter incremented.
+ */
+static void
+dtrace_aggregate(dtrace_aggregation_t *agg, dtrace_buffer_t *dbuf,
+    intptr_t offset, dtrace_buffer_t *buf, uint64_t expr, uint64_t arg)
+{
+	dtrace_recdesc_t *rec = &agg->dtag_action.dta_rec;
+	uint32_t i, ndx, size, fsize;
+	uint32_t align = sizeof (uint64_t) - 1;
+	dtrace_aggbuffer_t *agb;
+	dtrace_aggkey_t *key;
+	uint32_t hashval = 0, limit, isstr;
+	caddr_t tomax, data, kdata;
+	dtrace_actkind_t action;
+	dtrace_action_t *act;
+	uintptr_t offs;
+
+	if (buf == NULL)
+		return;
+
+	if (!agg->dtag_hasarg) {
+		/*
+		 * Currently, only quantize() and lquantize() take additional
+		 * arguments, and they have the same semantics:  an increment
+		 * value that defaults to 1 when not present.  If additional
+		 * aggregating actions take arguments, the setting of the
+		 * default argument value will presumably have to become more
+		 * sophisticated...
+		 */
+		arg = 1;
+	}
+
+	action = agg->dtag_action.dta_kind - DTRACEACT_AGGREGATION;
+	size = rec->dtrd_offset - agg->dtag_base;
+	fsize = size + rec->dtrd_size;
+
+	ASSERT(dbuf->dtb_tomax != NULL);
+	data = dbuf->dtb_tomax + offset + agg->dtag_base;
+
+	if ((tomax = buf->dtb_tomax) == NULL) {
+		dtrace_buffer_drop(buf);
+		return;
+	}
+
+	/*
+	 * The metastructure is always at the bottom of the buffer.
+	 */
+	agb = (dtrace_aggbuffer_t *)(tomax + buf->dtb_size -
+	    sizeof (dtrace_aggbuffer_t));
+
+	if (buf->dtb_offset == 0) {
+		/*
+		 * We just kludge up approximately 1/8th of the size to be
+		 * buckets.  If this guess ends up being routinely
+		 * off-the-mark, we may need to dynamically readjust this
+		 * based on past performance.
+		 */
+		uintptr_t hashsize = (buf->dtb_size >> 3) / sizeof (uintptr_t);
+
+		if ((uintptr_t)agb - hashsize * sizeof (dtrace_aggkey_t *) <
+		    (uintptr_t)tomax || hashsize == 0) {
+			/*
+			 * We've been given a ludicrously small buffer;
+			 * increment our drop count and leave.
+			 */
+			dtrace_buffer_drop(buf);
+			return;
+		}
+
+		/*
+		 * And now, a pathetic attempt to try to get a an odd (or
+		 * perchance, a prime) hash size for better hash distribution.
+		 */
+		if (hashsize > (DTRACE_AGGHASHSIZE_SLEW << 3))
+			hashsize -= DTRACE_AGGHASHSIZE_SLEW;
+
+		agb->dtagb_hashsize = hashsize;
+		agb->dtagb_hash = (dtrace_aggkey_t **)((uintptr_t)agb -
+		    agb->dtagb_hashsize * sizeof (dtrace_aggkey_t *));
+		agb->dtagb_free = (uintptr_t)agb->dtagb_hash;
+
+		for (i = 0; i < agb->dtagb_hashsize; i++)
+			agb->dtagb_hash[i] = NULL;
+	}
+
+	ASSERT(agg->dtag_first != NULL);
+	ASSERT(agg->dtag_first->dta_intuple);
+
+	/*
+	 * Calculate the hash value based on the key.  Note that we _don't_
+	 * include the aggid in the hashing (but we will store it as part of
+	 * the key).  The hashing algorithm is Bob Jenkins' "One-at-a-time"
+	 * algorithm: a simple, quick algorithm that has no known funnels, and
+	 * gets good distribution in practice.  The efficacy of the hashing
+	 * algorithm (and a comparison with other algorithms) may be found by
+	 * running the ::dtrace_aggstat MDB dcmd.
+	 */
+	for (act = agg->dtag_first; act->dta_intuple; act = act->dta_next) {
+		i = act->dta_rec.dtrd_offset - agg->dtag_base;
+		limit = i + act->dta_rec.dtrd_size;
+		ASSERT(limit <= size);
+		isstr = DTRACEACT_ISSTRING(act);
+
+		for (; i < limit; i++) {
+			hashval += data[i];
+			hashval += (hashval << 10);
+			hashval ^= (hashval >> 6);
+
+			if (isstr && data[i] == '\0')
+				break;
+		}
+	}
+
+	hashval += (hashval << 3);
+	hashval ^= (hashval >> 11);
+	hashval += (hashval << 15);
+
+	/*
+	 * Yes, the divide here is expensive -- but it's generally the least
+	 * of the performance issues given the amount of data that we iterate
+	 * over to compute hash values, compare data, etc.
+	 */
+	ndx = hashval % agb->dtagb_hashsize;
+
+	for (key = agb->dtagb_hash[ndx]; key != NULL; key = key->dtak_next) {
+		ASSERT((caddr_t)key >= tomax);
+		ASSERT((caddr_t)key < tomax + buf->dtb_size);
+
+		if (hashval != key->dtak_hashval || key->dtak_size != size)
+			continue;
+
+		kdata = key->dtak_data;
+		ASSERT(kdata >= tomax && kdata < tomax + buf->dtb_size);
+
+		for (act = agg->dtag_first; act->dta_intuple;
+		    act = act->dta_next) {
+			i = act->dta_rec.dtrd_offset - agg->dtag_base;
+			limit = i + act->dta_rec.dtrd_size;
+			ASSERT(limit <= size);
+			isstr = DTRACEACT_ISSTRING(act);
+
+			for (; i < limit; i++) {
+				if (kdata[i] != data[i])
+					goto next;
+
+				if (isstr && data[i] == '\0')
+					break;
+			}
+		}
+
+		if (action != key->dtak_action) {
+			/*
+			 * We are aggregating on the same value in the same
+			 * aggregation with two different aggregating actions.
+			 * (This should have been picked up in the compiler,
+			 * so we may be dealing with errant or devious DIF.)
+			 * This is an error condition; we indicate as much,
+			 * and return.
+			 */
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+			return;
+		}
+
+		/*
+		 * This is a hit:  we need to apply the aggregator to
+		 * the value at this key.
+		 */
+		agg->dtag_aggregate((uint64_t *)(kdata + size), expr, arg);
+		return;
+next:
+		continue;
+	}
+
+	/*
+	 * We didn't find it.  We need to allocate some zero-filled space,
+	 * link it into the hash table appropriately, and apply the aggregator
+	 * to the (zero-filled) value.
+	 */
+	offs = buf->dtb_offset;
+	while (offs & (align - 1))
+		offs += sizeof (uint32_t);
+
+	/*
+	 * If we don't have enough room to both allocate a new key _and_
+	 * its associated data, increment the drop count and return.
+	 */
+	if ((uintptr_t)tomax + offs + fsize >
+	    agb->dtagb_free - sizeof (dtrace_aggkey_t)) {
+		dtrace_buffer_drop(buf);
+		return;
+	}
+
+	/*CONSTCOND*/
+	ASSERT(!(sizeof (dtrace_aggkey_t) & (sizeof (uintptr_t) - 1)));
+	key = (dtrace_aggkey_t *)(agb->dtagb_free - sizeof (dtrace_aggkey_t));
+	agb->dtagb_free -= sizeof (dtrace_aggkey_t);
+
+	key->dtak_data = kdata = tomax + offs;
+	buf->dtb_offset = offs + fsize;
+
+	/*
+	 * Now copy the data across.
+	 */
+	*((dtrace_aggid_t *)kdata) = agg->dtag_id;
+
+	for (i = sizeof (dtrace_aggid_t); i < size; i++)
+		kdata[i] = data[i];
+
+	/*
+	 * Because strings are not zeroed out by default, we need to iterate
+	 * looking for actions that store strings, and we need to explicitly
+	 * pad these strings out with zeroes.
+	 */
+	for (act = agg->dtag_first; act->dta_intuple; act = act->dta_next) {
+		int nul;
+
+		if (!DTRACEACT_ISSTRING(act))
+			continue;
+
+		i = act->dta_rec.dtrd_offset - agg->dtag_base;
+		limit = i + act->dta_rec.dtrd_size;
+		ASSERT(limit <= size);
+
+		for (nul = 0; i < limit; i++) {
+			if (nul) {
+				kdata[i] = '\0';
+				continue;
+			}
+
+			if (data[i] != '\0')
+				continue;
+
+			nul = 1;
+		}
+	}
+
+	for (i = size; i < fsize; i++)
+		kdata[i] = 0;
+
+	key->dtak_hashval = hashval;
+	key->dtak_size = size;
+	key->dtak_action = action;
+	key->dtak_next = agb->dtagb_hash[ndx];
+	agb->dtagb_hash[ndx] = key;
+
+	/*
+	 * Finally, apply the aggregator.
+	 */
+	*((uint64_t *)(key->dtak_data + size)) = agg->dtag_initial;
+	agg->dtag_aggregate((uint64_t *)(key->dtak_data + size), expr, arg);
+}
+
+/*
+ * Given consumer state, this routine finds a speculation in the INACTIVE
+ * state and transitions it into the ACTIVE state.  If there is no speculation
+ * in the INACTIVE state, 0 is returned.  In this case, no error counter is
+ * incremented -- it is up to the caller to take appropriate action.
+ */
+static int
+dtrace_speculation(dtrace_state_t *state)
+{
+	int i = 0;
+	dtrace_speculation_state_t current;
+	uint32_t *stat = &state->dts_speculations_unavail, count;
+
+	while (i < state->dts_nspeculations) {
+		dtrace_speculation_t *spec = &state->dts_speculations[i];
+
+		current = spec->dtsp_state;
+
+		if (current != DTRACESPEC_INACTIVE) {
+			if (current == DTRACESPEC_COMMITTINGMANY ||
+			    current == DTRACESPEC_COMMITTING ||
+			    current == DTRACESPEC_DISCARDING)
+				stat = &state->dts_speculations_busy;
+			i++;
+			continue;
+		}
+
+		if (dtrace_cas32((uint32_t *)&spec->dtsp_state,
+		    current, DTRACESPEC_ACTIVE) == current)
+			return (i + 1);
+	}
+
+	/*
+	 * We couldn't find a speculation.  If we found as much as a single
+	 * busy speculation buffer, we'll attribute this failure as "busy"
+	 * instead of "unavail".
+	 */
+	do {
+		count = *stat;
+	} while (dtrace_cas32(stat, count, count + 1) != count);
+
+	return (0);
+}
+
+/*
+ * This routine commits an active speculation.  If the specified speculation
+ * is not in a valid state to perform a commit(), this routine will silently do
+ * nothing.  The state of the specified speculation is transitioned according
+ * to the state transition diagram outlined in <sys/dtrace_impl.h>
+ */
+static void
+dtrace_speculation_commit(dtrace_state_t *state, processorid_t cpu,
+    dtrace_specid_t which)
+{
+	dtrace_speculation_t *spec;
+	dtrace_buffer_t *src, *dest;
+	uintptr_t daddr, saddr, dlimit;
+	dtrace_speculation_state_t current, new VBDTUNASS(-1);
+	intptr_t offs;
+
+	if (which == 0)
+		return;
+
+	if (which > VBDTCAST(unsigned)state->dts_nspeculations) {
+		cpu_core[cpu].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return;
+	}
+
+	spec = &state->dts_speculations[which - 1];
+	src = &spec->dtsp_buffer[cpu];
+	dest = &state->dts_buffer[cpu];
+
+	do {
+		current = spec->dtsp_state;
+
+		if (current == DTRACESPEC_COMMITTINGMANY)
+			break;
+
+		switch (current) {
+		case DTRACESPEC_INACTIVE:
+		case DTRACESPEC_DISCARDING:
+			return;
+
+		case DTRACESPEC_COMMITTING:
+			/*
+			 * This is only possible if we are (a) commit()'ing
+			 * without having done a prior speculate() on this CPU
+			 * and (b) racing with another commit() on a different
+			 * CPU.  There's nothing to do -- we just assert that
+			 * our offset is 0.
+			 */
+			ASSERT(src->dtb_offset == 0);
+			return;
+
+		case DTRACESPEC_ACTIVE:
+			new = DTRACESPEC_COMMITTING;
+			break;
+
+		case DTRACESPEC_ACTIVEONE:
+			/*
+			 * This speculation is active on one CPU.  If our
+			 * buffer offset is non-zero, we know that the one CPU
+			 * must be us.  Otherwise, we are committing on a
+			 * different CPU from the speculate(), and we must
+			 * rely on being asynchronously cleaned.
+			 */
+			if (src->dtb_offset != 0) {
+				new = DTRACESPEC_COMMITTING;
+				break;
+			}
+			/*FALLTHROUGH*/
+
+		case DTRACESPEC_ACTIVEMANY:
+			new = DTRACESPEC_COMMITTINGMANY;
+			break;
+
+		default:
+#ifndef VBOX
+			ASSERT(0);
+#else
+			AssertFatalMsgFailed(("%d\n",  current));
+#endif
+		}
+	} while (dtrace_cas32((uint32_t *)&spec->dtsp_state,
+	    current, new) != current);
+
+	/*
+	 * We have set the state to indicate that we are committing this
+	 * speculation.  Now reserve the necessary space in the destination
+	 * buffer.
+	 */
+	if ((offs = dtrace_buffer_reserve(dest, src->dtb_offset,
+	    sizeof (uint64_t), state, NULL)) < 0) {
+		dtrace_buffer_drop(dest);
+		goto out;
+	}
+
+	/*
+	 * We have the space; copy the buffer across.  (Note that this is a
+	 * highly subobtimal bcopy(); in the unlikely event that this becomes
+	 * a serious performance issue, a high-performance DTrace-specific
+	 * bcopy() should obviously be invented.)
+	 */
+	daddr = (uintptr_t)dest->dtb_tomax + offs;
+	dlimit = daddr + src->dtb_offset;
+	saddr = (uintptr_t)src->dtb_tomax;
+
+	/*
+	 * First, the aligned portion.
+	 */
+	while (dlimit - daddr >= sizeof (uint64_t)) {
+		*((uint64_t *)daddr) = *((uint64_t *)saddr);
+
+		daddr += sizeof (uint64_t);
+		saddr += sizeof (uint64_t);
+	}
+
+	/*
+	 * Now any left-over bit...
+	 */
+	while (dlimit - daddr)
+		*((uint8_t *)daddr++) = *((uint8_t *)saddr++);
+
+	/*
+	 * Finally, commit the reserved space in the destination buffer.
+	 */
+	dest->dtb_offset = offs + src->dtb_offset;
+
+out:
+	/*
+	 * If we're lucky enough to be the only active CPU on this speculation
+	 * buffer, we can just set the state back to DTRACESPEC_INACTIVE.
+	 */
+	if (current == DTRACESPEC_ACTIVE ||
+	    (current == DTRACESPEC_ACTIVEONE && new == DTRACESPEC_COMMITTING)) {
+		uint32_t rval = dtrace_cas32((uint32_t *)&spec->dtsp_state,
+		    DTRACESPEC_COMMITTING, DTRACESPEC_INACTIVE);
+
+		ASSERT(rval == DTRACESPEC_COMMITTING);
+	}
+
+	src->dtb_offset = 0;
+	src->dtb_xamot_drops += src->dtb_drops;
+	src->dtb_drops = 0;
+}
+
+/*
+ * This routine discards an active speculation.  If the specified speculation
+ * is not in a valid state to perform a discard(), this routine will silently
+ * do nothing.  The state of the specified speculation is transitioned
+ * according to the state transition diagram outlined in <sys/dtrace_impl.h>
+ */
+static void
+dtrace_speculation_discard(dtrace_state_t *state, processorid_t cpu,
+    dtrace_specid_t which)
+{
+	dtrace_speculation_t *spec;
+	dtrace_speculation_state_t current, new;
+	dtrace_buffer_t *buf;
+
+	if (which == 0)
+		return;
+
+	if (which > VBDTCAST(unsigned)state->dts_nspeculations) {
+		cpu_core[cpu].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return;
+	}
+
+	spec = &state->dts_speculations[which - 1];
+	buf = &spec->dtsp_buffer[cpu];
+
+	do {
+		current = spec->dtsp_state;
+
+		switch (current) {
+		case DTRACESPEC_INACTIVE:
+		case DTRACESPEC_COMMITTINGMANY:
+		case DTRACESPEC_COMMITTING:
+		case DTRACESPEC_DISCARDING:
+			return;
+
+		case DTRACESPEC_ACTIVE:
+		case DTRACESPEC_ACTIVEMANY:
+			new = DTRACESPEC_DISCARDING;
+			break;
+
+		case DTRACESPEC_ACTIVEONE:
+			if (buf->dtb_offset != 0) {
+				new = DTRACESPEC_INACTIVE;
+			} else {
+				new = DTRACESPEC_DISCARDING;
+			}
+			break;
+
+		default:
+#ifndef VBOX
+			ASSERT(0);
+#else
+			AssertFatalMsgFailed(("%d\n", current));
+#endif
+		}
+	} while (dtrace_cas32((uint32_t *)&spec->dtsp_state,
+	    current, new) != current);
+
+	buf->dtb_offset = 0;
+	buf->dtb_drops = 0;
+}
+
+/*
+ * Note:  not called from probe context.  This function is called
+ * asynchronously from cross call context to clean any speculations that are
+ * in the COMMITTINGMANY or DISCARDING states.  These speculations may not be
+ * transitioned back to the INACTIVE state until all CPUs have cleaned the
+ * speculation.
+ */
+static void
+dtrace_speculation_clean_here(dtrace_state_t *state)
+{
+	dtrace_icookie_t cookie;
+	processorid_t cpu = VBDT_GET_CPUID();
+	dtrace_buffer_t *dest = &state->dts_buffer[cpu];
+	dtrace_specid_t i;
+
+	cookie = dtrace_interrupt_disable();
+
+	if (dest->dtb_tomax == NULL) {
+		dtrace_interrupt_enable(cookie);
+		return;
+	}
+
+	for (i = 0; i < VBDTCAST(unsigned)state->dts_nspeculations; i++) {
+		dtrace_speculation_t *spec = &state->dts_speculations[i];
+		dtrace_buffer_t *src = &spec->dtsp_buffer[cpu];
+
+		if (src->dtb_tomax == NULL)
+			continue;
+
+		if (spec->dtsp_state == DTRACESPEC_DISCARDING) {
+			src->dtb_offset = 0;
+			continue;
+		}
+
+		if (spec->dtsp_state != DTRACESPEC_COMMITTINGMANY)
+			continue;
+
+		if (src->dtb_offset == 0)
+			continue;
+
+		dtrace_speculation_commit(state, cpu, i + 1);
+	}
+
+	dtrace_interrupt_enable(cookie);
+}
+
+#ifdef VBOX
+/** */
+static DECLCALLBACK(void) dtrace_speculation_clean_here_wrapper(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    dtrace_speculation_clean_here((dtrace_state_t *)pvUser1);
+    NOREF(pvUser2); NOREF(idCpu);
+}
+#endif
+
+/*
+ * Note:  not called from probe context.  This function is called
+ * asynchronously (and at a regular interval) to clean any speculations that
+ * are in the COMMITTINGMANY or DISCARDING states.  If it discovers that there
+ * is work to be done, it cross calls all CPUs to perform that work;
+ * COMMITMANY and DISCARDING speculations may not be transitioned back to the
+ * INACTIVE state until they have been cleaned by all CPUs.
+ */
+static void
+dtrace_speculation_clean(dtrace_state_t *state)
+{
+	int work = 0, rv;
+	dtrace_specid_t i;
+
+	for (i = 0; i < VBDTCAST(unsigned)state->dts_nspeculations; i++) {
+		dtrace_speculation_t *spec = &state->dts_speculations[i];
+
+		ASSERT(!spec->dtsp_cleaning);
+
+		if (spec->dtsp_state != DTRACESPEC_DISCARDING &&
+		    spec->dtsp_state != DTRACESPEC_COMMITTINGMANY)
+			continue;
+
+		work++;
+		spec->dtsp_cleaning = 1;
+	}
+
+	if (!work)
+		return;
+
+#ifndef VBOX
+	dtrace_xcall(DTRACE_CPUALL,
+	    (dtrace_xcall_t)dtrace_speculation_clean_here, state);
+#else
+	RTMpOnAll(dtrace_speculation_clean_here_wrapper, state, NULL);
+#endif
+
+	/*
+	 * We now know that all CPUs have committed or discarded their
+	 * speculation buffers, as appropriate.  We can now set the state
+	 * to inactive.
+	 */
+	for (i = 0; i < VBDTCAST(unsigned)state->dts_nspeculations; i++) {
+		dtrace_speculation_t *spec = &state->dts_speculations[i];
+		dtrace_speculation_state_t current, new;
+
+		if (!spec->dtsp_cleaning)
+			continue;
+
+		current = spec->dtsp_state;
+		ASSERT(current == DTRACESPEC_DISCARDING ||
+		    current == DTRACESPEC_COMMITTINGMANY);
+
+		new = DTRACESPEC_INACTIVE;
+
+		rv = dtrace_cas32((uint32_t *)&spec->dtsp_state, current, new);
+		ASSERT(VBDTCAST(dtrace_speculation_state_t)rv == current);
+		spec->dtsp_cleaning = 0;
+	}
+}
+
+/*
+ * Called as part of a speculate() to get the speculative buffer associated
+ * with a given speculation.  Returns NULL if the specified speculation is not
+ * in an ACTIVE state.  If the speculation is in the ACTIVEONE state -- and
+ * the active CPU is not the specified CPU -- the speculation will be
+ * atomically transitioned into the ACTIVEMANY state.
+ */
+static dtrace_buffer_t *
+dtrace_speculation_buffer(dtrace_state_t *state, processorid_t cpuid,
+    dtrace_specid_t which)
+{
+	dtrace_speculation_t *spec;
+	dtrace_speculation_state_t current, new VBDTUNASS(-1);
+	dtrace_buffer_t *buf;
+
+	if (which == 0)
+		return (NULL);
+
+	if (which > VBDTCAST(unsigned)state->dts_nspeculations) {
+		cpu_core[cpuid].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (NULL);
+	}
+
+	spec = &state->dts_speculations[which - 1];
+	buf = &spec->dtsp_buffer[cpuid];
+
+	do {
+		current = spec->dtsp_state;
+
+		switch (current) {
+		case DTRACESPEC_INACTIVE:
+		case DTRACESPEC_COMMITTINGMANY:
+		case DTRACESPEC_DISCARDING:
+			return (NULL);
+
+		case DTRACESPEC_COMMITTING:
+			ASSERT(buf->dtb_offset == 0);
+			return (NULL);
+
+		case DTRACESPEC_ACTIVEONE:
+			/*
+			 * This speculation is currently active on one CPU.
+			 * Check the offset in the buffer; if it's non-zero,
+			 * that CPU must be us (and we leave the state alone).
+			 * If it's zero, assume that we're starting on a new
+			 * CPU -- and change the state to indicate that the
+			 * speculation is active on more than one CPU.
+			 */
+			if (buf->dtb_offset != 0)
+				return (buf);
+
+			new = DTRACESPEC_ACTIVEMANY;
+			break;
+
+		case DTRACESPEC_ACTIVEMANY:
+			return (buf);
+
+		case DTRACESPEC_ACTIVE:
+			new = DTRACESPEC_ACTIVEONE;
+			break;
+
+		default:
+#ifndef VBOX
+			ASSERT(0);
+#else
+			AssertFatalMsgFailed(("%d\n", current));
+#endif
+		}
+	} while (dtrace_cas32((uint32_t *)&spec->dtsp_state,
+	    current, new) != current);
+
+	ASSERT(new == DTRACESPEC_ACTIVEONE || new == DTRACESPEC_ACTIVEMANY);
+	return (buf);
+}
+
+/*
+ * Return a string.  In the event that the user lacks the privilege to access
+ * arbitrary kernel memory, we copy the string out to scratch memory so that we
+ * don't fail access checking.
+ *
+ * dtrace_dif_variable() uses this routine as a helper for various
+ * builtin values such as 'execname' and 'probefunc.'
+ */
+VBDTSTATIC uintptr_t
+dtrace_dif_varstr(uintptr_t addr, dtrace_state_t *state,
+    dtrace_mstate_t *mstate)
+{
+	uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+	uintptr_t ret;
+	size_t strsz;
+
+	/*
+	 * The easy case: this probe is allowed to read all of memory, so
+	 * we can just return this as a vanilla pointer.
+	 */
+	if ((mstate->dtms_access & DTRACE_ACCESS_KERNEL) != 0)
+		return (addr);
+
+	/*
+	 * This is the tougher case: we copy the string in question from
+	 * kernel memory into scratch memory and return it that way: this
+	 * ensures that we won't trip up when access checking tests the
+	 * BYREF return value.
+	 */
+	strsz = dtrace_strlen((char *)addr, size) + 1;
+
+	if (mstate->dtms_scratch_ptr + strsz >
+	    mstate->dtms_scratch_base + mstate->dtms_scratch_size) {
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+		return (NULL);
+	}
+
+	dtrace_strcpy((const void *)addr, (void *)mstate->dtms_scratch_ptr,
+	    strsz);
+	ret = mstate->dtms_scratch_ptr;
+	mstate->dtms_scratch_ptr += strsz;
+	return (ret);
+}
+
+/*
+ * This function implements the DIF emulator's variable lookups.  The emulator
+ * passes a reserved variable identifier and optional built-in array index.
+ */
+static uint64_t
+dtrace_dif_variable(dtrace_mstate_t *mstate, dtrace_state_t *state, uint64_t v,
+    uint64_t ndx)
+{
+	/*
+	 * If we're accessing one of the uncached arguments, we'll turn this
+	 * into a reference in the args array.
+	 */
+	if (v >= DIF_VAR_ARG0 && v <= DIF_VAR_ARG9) {
+		ndx = v - DIF_VAR_ARG0;
+		v = DIF_VAR_ARGS;
+	}
+
+	switch (v) {
+	case DIF_VAR_ARGS:
+		ASSERT(mstate->dtms_present & DTRACE_MSTATE_ARGS);
+		if (ndx >= sizeof (mstate->dtms_arg) /
+		    sizeof (mstate->dtms_arg[0])) {
+			int aframes = mstate->dtms_probe->dtpr_aframes + 2;
+			dtrace_provider_t *pv;
+			uint64_t val;
+
+			pv = mstate->dtms_probe->dtpr_provider;
+			if (pv->dtpv_pops.dtps_getargval != NULL)
+				val = pv->dtpv_pops.dtps_getargval(pv->dtpv_arg,
+				    mstate->dtms_probe->dtpr_id,
+				    mstate->dtms_probe->dtpr_arg, ndx, aframes);
+			else
+				val = dtrace_getarg(ndx, aframes);
+
+			/*
+			 * This is regrettably required to keep the compiler
+			 * from tail-optimizing the call to dtrace_getarg().
+			 * The condition always evaluates to true, but the
+			 * compiler has no way of figuring that out a priori.
+			 * (None of this would be necessary if the compiler
+			 * could be relied upon to _always_ tail-optimize
+			 * the call to dtrace_getarg() -- but it can't.)
+			 */
+			if (mstate->dtms_probe != NULL)
+				return (val);
+
+#ifndef VBOX
+			ASSERT(0);
+#else
+			AssertFatalFailed();
+#endif
+		}
+
+		return (mstate->dtms_arg[ndx]);
+
+	case DIF_VAR_UREGS: {
+#ifndef VBOX
+		klwp_t *lwp;
+
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+		if ((lwp = curthread->t_lwp) == NULL) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
+			cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval = NULL;
+			return (0);
+		}
+
+		return (dtrace_getreg(lwp->lwp_regs, ndx));
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
+	}
+
+	case DIF_VAR_CURTHREAD:
+		if (!dtrace_priv_kernel(state))
+			return (0);
+#ifndef VBOX
+		return ((uint64_t)(uintptr_t)curthread);
+#else
+		return ((uintptr_t)RTThreadNativeSelf());
+#endif
+
+	case DIF_VAR_TIMESTAMP:
+		if (!(mstate->dtms_present & DTRACE_MSTATE_TIMESTAMP)) {
+			mstate->dtms_timestamp = dtrace_gethrtime();
+			mstate->dtms_present |= DTRACE_MSTATE_TIMESTAMP;
+		}
+		return (mstate->dtms_timestamp);
+
+	case DIF_VAR_VTIMESTAMP:
+#ifndef VBOX
+		ASSERT(dtrace_vtime_references != 0);
+		return (curthread->t_dtrace_vtime);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
+
+	case DIF_VAR_WALLTIMESTAMP:
+		if (!(mstate->dtms_present & DTRACE_MSTATE_WALLTIMESTAMP)) {
+			mstate->dtms_walltimestamp = dtrace_gethrestime();
+			mstate->dtms_present |= DTRACE_MSTATE_WALLTIMESTAMP;
+		}
+		return (mstate->dtms_walltimestamp);
+
+	case DIF_VAR_IPL:
+		if (!dtrace_priv_kernel(state))
+			return (0);
+		if (!(mstate->dtms_present & DTRACE_MSTATE_IPL)) {
+			mstate->dtms_ipl = dtrace_getipl();
+			mstate->dtms_present |= DTRACE_MSTATE_IPL;
+		}
+		return (mstate->dtms_ipl);
+
+	case DIF_VAR_EPID:
+		ASSERT(mstate->dtms_present & DTRACE_MSTATE_EPID);
+		return (mstate->dtms_epid);
+
+	case DIF_VAR_ID:
+		ASSERT(mstate->dtms_present & DTRACE_MSTATE_PROBE);
+		return (mstate->dtms_probe->dtpr_id);
+
+	case DIF_VAR_STACKDEPTH:
+		if (!dtrace_priv_kernel(state))
+			return (0);
+		if (!(mstate->dtms_present & DTRACE_MSTATE_STACKDEPTH)) {
+			int aframes = mstate->dtms_probe->dtpr_aframes + 2;
+
+			mstate->dtms_stackdepth = dtrace_getstackdepth(aframes);
+			mstate->dtms_present |= DTRACE_MSTATE_STACKDEPTH;
+		}
+		return (mstate->dtms_stackdepth);
+
+	case DIF_VAR_USTACKDEPTH:
+		if (!dtrace_priv_proc(state))
+			return (0);
+		if (!(mstate->dtms_present & DTRACE_MSTATE_USTACKDEPTH)) {
+			/*
+			 * See comment in DIF_VAR_PID.
+			 */
+			if (DTRACE_ANCHORED(mstate->dtms_probe) &&
+			    CPU_ON_INTR(CPU)) {
+				mstate->dtms_ustackdepth = 0;
+			} else {
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+				mstate->dtms_ustackdepth =
+				    dtrace_getustackdepth();
+				DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+			}
+			mstate->dtms_present |= DTRACE_MSTATE_USTACKDEPTH;
+		}
+		return (mstate->dtms_ustackdepth);
+
+	case DIF_VAR_CALLER:
+		if (!dtrace_priv_kernel(state))
+			return (0);
+		if (!(mstate->dtms_present & DTRACE_MSTATE_CALLER)) {
+			int aframes = mstate->dtms_probe->dtpr_aframes + 2;
+
+			if (!DTRACE_ANCHORED(mstate->dtms_probe)) {
+				/*
+				 * If this is an unanchored probe, we are
+				 * required to go through the slow path:
+				 * dtrace_caller() only guarantees correct
+				 * results for anchored probes.
+				 */
+				pc_t caller[2];
+
+				dtrace_getpcstack(caller, 2, aframes,
+				    (uint32_t *)(uintptr_t)mstate->dtms_arg[0]);
+				mstate->dtms_caller = caller[1];
+			} else if ((mstate->dtms_caller =
+			    dtrace_caller(aframes)) == VBDTCAST(uintptr_t)-1) {
+				/*
+				 * We have failed to do this the quick way;
+				 * we must resort to the slower approach of
+				 * calling dtrace_getpcstack().
+				 */
+				pc_t caller;
+
+				dtrace_getpcstack(&caller, 1, aframes, NULL);
+				mstate->dtms_caller = caller;
+			}
+
+			mstate->dtms_present |= DTRACE_MSTATE_CALLER;
+		}
+		return (mstate->dtms_caller);
+
+	case DIF_VAR_UCALLER:
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+		if (!(mstate->dtms_present & DTRACE_MSTATE_UCALLER)) {
+			uint64_t ustack[3];
+
+			/*
+			 * dtrace_getupcstack() fills in the first uint64_t
+			 * with the current PID.  The second uint64_t will
+			 * be the program counter at user-level.  The third
+			 * uint64_t will contain the caller, which is what
+			 * we're after.
+			 */
+			ustack[2] = NULL;
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+			dtrace_getupcstack(ustack, 3);
+			DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+			mstate->dtms_ucaller = ustack[2];
+			mstate->dtms_present |= DTRACE_MSTATE_UCALLER;
+		}
+
+		return (mstate->dtms_ucaller);
+
+	case DIF_VAR_PROBEPROV:
+		ASSERT(mstate->dtms_present & DTRACE_MSTATE_PROBE);
+		return (dtrace_dif_varstr(
+		    (uintptr_t)mstate->dtms_probe->dtpr_provider->dtpv_name,
+		    state, mstate));
+
+	case DIF_VAR_PROBEMOD:
+		ASSERT(mstate->dtms_present & DTRACE_MSTATE_PROBE);
+		return (dtrace_dif_varstr(
+		    (uintptr_t)mstate->dtms_probe->dtpr_mod,
+		    state, mstate));
+
+	case DIF_VAR_PROBEFUNC:
+		ASSERT(mstate->dtms_present & DTRACE_MSTATE_PROBE);
+		return (dtrace_dif_varstr(
+		    (uintptr_t)mstate->dtms_probe->dtpr_func,
+		    state, mstate));
+
+	case DIF_VAR_PROBENAME:
+		ASSERT(mstate->dtms_present & DTRACE_MSTATE_PROBE);
+		return (dtrace_dif_varstr(
+		    (uintptr_t)mstate->dtms_probe->dtpr_name,
+		    state, mstate));
+
+	case DIF_VAR_PID:
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+#ifndef VBOX
+		/*
+		 * Note that we are assuming that an unanchored probe is
+		 * always due to a high-level interrupt.  (And we're assuming
+		 * that there is only a single high level interrupt.)
+		 */
+		if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
+			return (pid0.pid_id);
+
+		/*
+		 * It is always safe to dereference one's own t_procp pointer:
+		 * it always points to a valid, allocated proc structure.
+		 * Further, it is always safe to dereference the p_pidp member
+		 * of one's own proc structure.  (These are truisms becuase
+		 * threads and processes don't clean up their own state --
+		 * they leave that task to whomever reaps them.)
+		 */
+		return ((uint64_t)curthread->t_procp->p_pidp->pid_id);
+#else
+		return (RTProcSelf());
+#endif
+
+	case DIF_VAR_PPID:
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+#ifndef VBOX
+		/*
+		 * See comment in DIF_VAR_PID.
+		 */
+		if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
+			return (pid0.pid_id);
+
+		/*
+		 * It is always safe to dereference one's own t_procp pointer:
+		 * it always points to a valid, allocated proc structure.
+		 * (This is true because threads don't clean up their own
+		 * state -- they leave that task to whomever reaps them.)
+		 */
+		return ((uint64_t)curthread->t_procp->p_ppid);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0); /** @todo parent pid? */
+#endif
+
+	case DIF_VAR_TID:
+#ifndef VBOX
+		/*
+		 * See comment in DIF_VAR_PID.
+		 */
+		if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
+			return (0);
+
+		return ((uint64_t)curthread->t_tid);
+#else
+		return (RTThreadNativeSelf()); /** @todo proper tid? */
+#endif
+
+	case DIF_VAR_EXECNAME:
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+#ifndef VBOX
+		/*
+		 * See comment in DIF_VAR_PID.
+		 */
+		if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
+			return ((uint64_t)(uintptr_t)p0.p_user.u_comm);
+
+		/*
+		 * It is always safe to dereference one's own t_procp pointer:
+		 * it always points to a valid, allocated proc structure.
+		 * (This is true because threads don't clean up their own
+		 * state -- they leave that task to whomever reaps them.)
+		 */
+		return (dtrace_dif_varstr(
+		    (uintptr_t)curthread->t_procp->p_user.u_comm,
+		    state, mstate));
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0); /** @todo execname */
+#endif
+
+	case DIF_VAR_ZONENAME:
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+#ifndef VBOX
+		/*
+		 * See comment in DIF_VAR_PID.
+		 */
+		if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
+			return ((uint64_t)(uintptr_t)p0.p_zone->zone_name);
+
+		/*
+		 * It is always safe to dereference one's own t_procp pointer:
+		 * it always points to a valid, allocated proc structure.
+		 * (This is true because threads don't clean up their own
+		 * state -- they leave that task to whomever reaps them.)
+		 */
+		return (dtrace_dif_varstr(
+		    (uintptr_t)curthread->t_procp->p_zone->zone_name,
+		    state, mstate));
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
+
+	case DIF_VAR_UID:
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+#ifndef VBOX
+		/*
+		 * See comment in DIF_VAR_PID.
+		 */
+		if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
+			return ((uint64_t)p0.p_cred->cr_uid);
+
+		/*
+		 * It is always safe to dereference one's own t_procp pointer:
+		 * it always points to a valid, allocated proc structure.
+		 * (This is true because threads don't clean up their own
+		 * state -- they leave that task to whomever reaps them.)
+		 *
+		 * Additionally, it is safe to dereference one's own process
+		 * credential, since this is never NULL after process birth.
+		 */
+		return ((uint64_t)curthread->t_procp->p_cred->cr_uid);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
+
+	case DIF_VAR_GID:
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+#ifndef VBOX
+		/*
+		 * See comment in DIF_VAR_PID.
+		 */
+		if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
+			return ((uint64_t)p0.p_cred->cr_gid);
+
+		/*
+		 * It is always safe to dereference one's own t_procp pointer:
+		 * it always points to a valid, allocated proc structure.
+		 * (This is true because threads don't clean up their own
+		 * state -- they leave that task to whomever reaps them.)
+		 *
+		 * Additionally, it is safe to dereference one's own process
+		 * credential, since this is never NULL after process birth.
+		 */
+		return ((uint64_t)curthread->t_procp->p_cred->cr_gid);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
+
+	case DIF_VAR_ERRNO: {
+#ifndef VBOX
+		klwp_t *lwp;
+#endif
+		if (!dtrace_priv_proc(state))
+			return (0);
+
+#ifndef VBOX
+		/*
+		 * See comment in DIF_VAR_PID.
+		 */
+		if (DTRACE_ANCHORED(mstate->dtms_probe) && CPU_ON_INTR(CPU))
+			return (0);
+
+		/*
+		 * It is always safe to dereference one's own t_lwp pointer in
+		 * the event that this pointer is non-NULL.  (This is true
+		 * because threads and lwps don't clean up their own state --
+		 * they leave that task to whomever reaps them.)
+		 */
+		if ((lwp = curthread->t_lwp) == NULL)
+			return (0);
+
+		return ((uint64_t)lwp->lwp_errno);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
+	}
+	default:
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+		return (0);
+	}
+}
+
+/*
+ * Emulate the execution of DTrace ID subroutines invoked by the call opcode.
+ * Notice that we don't bother validating the proper number of arguments or
+ * their types in the tuple stack.  This isn't needed because all argument
+ * interpretation is safe because of our load safety -- the worst that can
+ * happen is that a bogus program can obtain bogus results.
+ */
+static void
+dtrace_dif_subr(uint_t subr, uint_t rd, uint64_t *regs,
+    dtrace_key_t *tupregs, int nargs,
+    dtrace_mstate_t *mstate, dtrace_state_t *state)
+{
+	volatile uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+	volatile uintptr_t *illval = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval;
+	dtrace_vstate_t *vstate = &state->dts_vstate;
+
+#ifndef VBOX
+	union {
+		mutex_impl_t mi;
+		uint64_t mx;
+	} m;
+
+	union {
+		krwlock_t ri;
+		uintptr_t rw;
+	} r;
+#endif
+
+	switch (subr) {
+	case DIF_SUBR_RAND:
+		regs[rd] = (dtrace_gethrtime() * 2416 + 374441) % 1771875;
+		break;
+
+	case DIF_SUBR_MUTEX_OWNED:
+#ifndef VBOX
+		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t),
+		    mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		m.mx = dtrace_load64(tupregs[0].dttk_value);
+		if (MUTEX_TYPE_ADAPTIVE(&m.mi))
+			regs[rd] = MUTEX_OWNER(&m.mi) != MUTEX_NO_OWNER;
+		else
+			regs[rd] = LOCK_HELD(&m.mi.m_spin.m_spinlock);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+
+	case DIF_SUBR_MUTEX_OWNER:
+#ifndef VBOX
+		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t),
+		    mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		m.mx = dtrace_load64(tupregs[0].dttk_value);
+		if (MUTEX_TYPE_ADAPTIVE(&m.mi) &&
+		    MUTEX_OWNER(&m.mi) != MUTEX_NO_OWNER)
+			regs[rd] = (uintptr_t)MUTEX_OWNER(&m.mi);
+		else
+			regs[rd] = 0;
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+
+	case DIF_SUBR_MUTEX_TYPE_ADAPTIVE:
+#ifndef VBOX
+		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t),
+		    mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		m.mx = dtrace_load64(tupregs[0].dttk_value);
+		regs[rd] = MUTEX_TYPE_ADAPTIVE(&m.mi);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+
+	case DIF_SUBR_MUTEX_TYPE_SPIN:
+#ifndef VBOX
+		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t),
+		    mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		m.mx = dtrace_load64(tupregs[0].dttk_value);
+		regs[rd] = MUTEX_TYPE_SPIN(&m.mi);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+
+	case DIF_SUBR_RW_READ_HELD: {
+#ifndef VBOX
+		uintptr_t tmp;
+
+		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (uintptr_t),
+		    mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		r.rw = dtrace_loadptr(tupregs[0].dttk_value);
+		regs[rd] = _RW_READ_HELD(&r.ri, tmp);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+	}
+
+	case DIF_SUBR_RW_WRITE_HELD:
+#ifndef VBOX
+		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (krwlock_t),
+		    mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		r.rw = dtrace_loadptr(tupregs[0].dttk_value);
+		regs[rd] = _RW_WRITE_HELD(&r.ri);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+
+	case DIF_SUBR_RW_ISWRITER:
+#ifndef VBOX
+		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (krwlock_t),
+		    mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		r.rw = dtrace_loadptr(tupregs[0].dttk_value);
+		regs[rd] = _RW_ISWRITER(&r.ri);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+
+	case DIF_SUBR_BCOPY: {
+		/*
+		 * We need to be sure that the destination is in the scratch
+		 * region -- no other region is allowed.
+		 */
+		uintptr_t src = tupregs[0].dttk_value;
+		uintptr_t dest = tupregs[1].dttk_value;
+		size_t size = tupregs[2].dttk_value;
+
+		if (!dtrace_inscratch(dest, size, mstate)) {
+			*flags |= CPU_DTRACE_BADADDR;
+			*illval = regs[rd];
+			break;
+		}
+
+		if (!dtrace_canload(src, size, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		dtrace_bcopy((void *)src, (void *)dest, size);
+		break;
+	}
+
+	case DIF_SUBR_ALLOCA:
+	case DIF_SUBR_COPYIN: {
+		uintptr_t dest = P2ROUNDUP(mstate->dtms_scratch_ptr, 8);
+		uint64_t size =
+		    tupregs[subr == DIF_SUBR_ALLOCA ? 0 : 1].dttk_value;
+		size_t scratch_size = (dest - mstate->dtms_scratch_ptr) + size;
+
+		/*
+		 * This action doesn't require any credential checks since
+		 * probes will not activate in user contexts to which the
+		 * enabling user does not have permissions.
+		 */
+
+		/*
+		 * Rounding up the user allocation size could have overflowed
+		 * a large, bogus allocation (like -1ULL) to 0.
+		 */
+		if (scratch_size < size ||
+		    !DTRACE_INSCRATCH(mstate, scratch_size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (subr == DIF_SUBR_COPYIN) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+			dtrace_copyin(tupregs[0].dttk_value, dest, size, flags);
+			DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+		}
+
+		mstate->dtms_scratch_ptr += scratch_size;
+		regs[rd] = dest;
+		break;
+	}
+
+	case DIF_SUBR_COPYINTO: {
+		uint64_t size = tupregs[1].dttk_value;
+		uintptr_t dest = tupregs[2].dttk_value;
+
+		/*
+		 * This action doesn't require any credential checks since
+		 * probes will not activate in user contexts to which the
+		 * enabling user does not have permissions.
+		 */
+		if (!dtrace_inscratch(dest, size, mstate)) {
+			*flags |= CPU_DTRACE_BADADDR;
+			*illval = regs[rd];
+			break;
+		}
+
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+		dtrace_copyin(tupregs[0].dttk_value, dest, size, flags);
+		DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+		break;
+	}
+
+	case DIF_SUBR_COPYINSTR: {
+		uintptr_t dest = mstate->dtms_scratch_ptr;
+		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+
+		if (nargs > 1 && tupregs[1].dttk_value < size)
+			size = tupregs[1].dttk_value + 1;
+
+		/*
+		 * This action doesn't require any credential checks since
+		 * probes will not activate in user contexts to which the
+		 * enabling user does not have permissions.
+		 */
+		if (!DTRACE_INSCRATCH(mstate, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+		dtrace_copyinstr(tupregs[0].dttk_value, dest, size, flags);
+		DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+
+		((char *)dest)[size - 1] = '\0';
+		mstate->dtms_scratch_ptr += size;
+		regs[rd] = dest;
+		break;
+	}
+
+	case DIF_SUBR_MSGSIZE:
+	case DIF_SUBR_MSGDSIZE: {
+#ifndef VBOX
+		uintptr_t baddr = tupregs[0].dttk_value, daddr;
+		uintptr_t wptr, rptr;
+		size_t count = 0;
+		int cont = 0;
+
+		while (baddr != NULL && !(*flags & CPU_DTRACE_FAULT)) {
+
+			if (!dtrace_canload(baddr, sizeof (mblk_t), mstate,
+			    vstate)) {
+				regs[rd] = NULL;
+				break;
+			}
+
+			wptr = dtrace_loadptr(baddr +
+			    offsetof(mblk_t, b_wptr));
+
+			rptr = dtrace_loadptr(baddr +
+			    offsetof(mblk_t, b_rptr));
+
+			if (wptr < rptr) {
+				*flags |= CPU_DTRACE_BADADDR;
+				*illval = tupregs[0].dttk_value;
+				break;
+			}
+
+			daddr = dtrace_loadptr(baddr +
+			    offsetof(mblk_t, b_datap));
+
+			baddr = dtrace_loadptr(baddr +
+			    offsetof(mblk_t, b_cont));
+
+			/*
+			 * We want to prevent against denial-of-service here,
+			 * so we're only going to search the list for
+			 * dtrace_msgdsize_max mblks.
+			 */
+			if (cont++ > dtrace_msgdsize_max) {
+				*flags |= CPU_DTRACE_ILLOP;
+				break;
+			}
+
+			if (subr == DIF_SUBR_MSGDSIZE) {
+				if (dtrace_load8(daddr +
+				    offsetof(dblk_t, db_type)) != M_DATA)
+					continue;
+			}
+
+			count += wptr - rptr;
+		}
+
+		if (!(*flags & CPU_DTRACE_FAULT))
+			regs[rd] = count;
+
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+	}
+
+	case DIF_SUBR_PROGENYOF: {
+#ifndef VBOX
+		pid_t pid = tupregs[0].dttk_value;
+		proc_t *p;
+		int rval = 0;
+
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+
+		for (p = curthread->t_procp; p != NULL; p = p->p_parent) {
+			if (p->p_pidp->pid_id == pid) {
+				rval = 1;
+				break;
+			}
+		}
+
+		DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+
+		regs[rd] = rval;
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+	}
+
+	case DIF_SUBR_SPECULATION:
+		regs[rd] = dtrace_speculation(state);
+		break;
+
+	case DIF_SUBR_COPYOUT: {
+		uintptr_t kaddr = tupregs[0].dttk_value;
+		uintptr_t uaddr = tupregs[1].dttk_value;
+		uint64_t size = tupregs[2].dttk_value;
+
+		if (!dtrace_destructive_disallow &&
+		    dtrace_priv_proc_control(state) &&
+		    !dtrace_istoxic(kaddr, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+			dtrace_copyout(kaddr, uaddr, size, flags);
+			DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+		}
+		break;
+	}
+
+	case DIF_SUBR_COPYOUTSTR: {
+		uintptr_t kaddr = tupregs[0].dttk_value;
+		uintptr_t uaddr = tupregs[1].dttk_value;
+		uint64_t size = tupregs[2].dttk_value;
+
+		if (!dtrace_destructive_disallow &&
+		    dtrace_priv_proc_control(state) &&
+		    !dtrace_istoxic(kaddr, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+			dtrace_copyoutstr(kaddr, uaddr, size, flags);
+			DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+		}
+		break;
+	}
+
+	case DIF_SUBR_STRLEN: {
+		size_t sz;
+		uintptr_t addr = (uintptr_t)tupregs[0].dttk_value;
+		sz = dtrace_strlen((char *)addr,
+		    state->dts_options[DTRACEOPT_STRSIZE]);
+
+		if (!dtrace_canload(addr, sz + 1, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		regs[rd] = sz;
+
+		break;
+	}
+
+	case DIF_SUBR_STRCHR:
+	case DIF_SUBR_STRRCHR: {
+		/*
+		 * We're going to iterate over the string looking for the
+		 * specified character.  We will iterate until we have reached
+		 * the string length or we have found the character.  If this
+		 * is DIF_SUBR_STRRCHR, we will look for the last occurrence
+		 * of the specified character instead of the first.
+		 */
+		uintptr_t saddr = tupregs[0].dttk_value;
+		uintptr_t addr = tupregs[0].dttk_value;
+		uintptr_t limit = addr + state->dts_options[DTRACEOPT_STRSIZE];
+		char c, target = (char)tupregs[1].dttk_value;
+
+		for (regs[rd] = NULL; addr < limit; addr++) {
+			if ((c = dtrace_load8(addr)) == target) {
+				regs[rd] = addr;
+
+				if (subr == DIF_SUBR_STRCHR)
+					break;
+			}
+
+			if (c == '\0')
+				break;
+		}
+
+		if (!dtrace_canload(saddr, addr - saddr, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		break;
+	}
+
+	case DIF_SUBR_STRSTR:
+	case DIF_SUBR_INDEX:
+	case DIF_SUBR_RINDEX: {
+		/*
+		 * We're going to iterate over the string looking for the
+		 * specified string.  We will iterate until we have reached
+		 * the string length or we have found the string.  (Yes, this
+		 * is done in the most naive way possible -- but considering
+		 * that the string we're searching for is likely to be
+		 * relatively short, the complexity of Rabin-Karp or similar
+		 * hardly seems merited.)
+		 */
+		char *addr = (char *)(uintptr_t)tupregs[0].dttk_value;
+		char *substr = (char *)(uintptr_t)tupregs[1].dttk_value;
+		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+		size_t len = dtrace_strlen(addr, size);
+		size_t sublen = dtrace_strlen(substr, size);
+		char *limit = addr + len, *orig = addr;
+		int notfound = subr == DIF_SUBR_STRSTR ? 0 : -1;
+		int inc = 1;
+
+		regs[rd] = notfound;
+
+		if (!dtrace_canload((uintptr_t)addr, len + 1, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (!dtrace_canload((uintptr_t)substr, sublen + 1, mstate,
+		    vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		/*
+		 * strstr() and index()/rindex() have similar semantics if
+		 * both strings are the empty string: strstr() returns a
+		 * pointer to the (empty) string, and index() and rindex()
+		 * both return index 0 (regardless of any position argument).
+		 */
+		if (sublen == 0 && len == 0) {
+			if (subr == DIF_SUBR_STRSTR)
+				regs[rd] = (uintptr_t)addr;
+			else
+				regs[rd] = 0;
+			break;
+		}
+
+		if (subr != DIF_SUBR_STRSTR) {
+			if (subr == DIF_SUBR_RINDEX) {
+				limit = orig - 1;
+				addr += len;
+				inc = -1;
+			}
+
+			/*
+			 * Both index() and rindex() take an optional position
+			 * argument that denotes the starting position.
+			 */
+			if (nargs == 3) {
+				int64_t pos = (int64_t)tupregs[2].dttk_value;
+
+				/*
+				 * If the position argument to index() is
+				 * negative, Perl implicitly clamps it at
+				 * zero.  This semantic is a little surprising
+				 * given the special meaning of negative
+				 * positions to similar Perl functions like
+				 * substr(), but it appears to reflect a
+				 * notion that index() can start from a
+				 * negative index and increment its way up to
+				 * the string.  Given this notion, Perl's
+				 * rindex() is at least self-consistent in
+				 * that it implicitly clamps positions greater
+				 * than the string length to be the string
+				 * length.  Where Perl completely loses
+				 * coherence, however, is when the specified
+				 * substring is the empty string ("").  In
+				 * this case, even if the position is
+				 * negative, rindex() returns 0 -- and even if
+				 * the position is greater than the length,
+				 * index() returns the string length.  These
+				 * semantics violate the notion that index()
+				 * should never return a value less than the
+				 * specified position and that rindex() should
+				 * never return a value greater than the
+				 * specified position.  (One assumes that
+				 * these semantics are artifacts of Perl's
+				 * implementation and not the results of
+				 * deliberate design -- it beggars belief that
+				 * even Larry Wall could desire such oddness.)
+				 * While in the abstract one would wish for
+				 * consistent position semantics across
+				 * substr(), index() and rindex() -- or at the
+				 * very least self-consistent position
+				 * semantics for index() and rindex() -- we
+				 * instead opt to keep with the extant Perl
+				 * semantics, in all their broken glory.  (Do
+				 * we have more desire to maintain Perl's
+				 * semantics than Perl does?  Probably.)
+				 */
+				if (subr == DIF_SUBR_RINDEX) {
+					if (pos < 0) {
+						if (sublen == 0)
+							regs[rd] = 0;
+						break;
+					}
+
+					if (VBDTCAST(uint64_t)pos > len)
+						pos = len;
+				} else {
+					if (pos < 0)
+						pos = 0;
+
+					if (VBDTCAST(uint64_t)pos >= len) {
+						if (sublen == 0)
+							regs[rd] = len;
+						break;
+					}
+				}
+
+				addr = orig + pos;
+			}
+		}
+
+		for (regs[rd] = notfound; addr != limit; addr += inc) {
+			if (dtrace_strncmp(addr, substr, sublen) == 0) {
+				if (subr != DIF_SUBR_STRSTR) {
+					/*
+					 * As D index() and rindex() are
+					 * modeled on Perl (and not on awk),
+					 * we return a zero-based (and not a
+					 * one-based) index.  (For you Perl
+					 * weenies: no, we're not going to add
+					 * $[ -- and shouldn't you be at a con
+					 * or something?)
+					 */
+					regs[rd] = (uintptr_t)(addr - orig);
+					break;
+				}
+
+				ASSERT(subr == DIF_SUBR_STRSTR);
+				regs[rd] = (uintptr_t)addr;
+				break;
+			}
+		}
+
+		break;
+	}
+
+	case DIF_SUBR_STRTOK: {
+		uintptr_t addr = tupregs[0].dttk_value;
+		uintptr_t tokaddr = tupregs[1].dttk_value;
+		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+		uintptr_t limit, toklimit = tokaddr + size;
+		uint8_t c VBDTUNASS(0), tokmap[32];	 /* 256 / 8 */
+		char *dest = (char *)mstate->dtms_scratch_ptr;
+		VBDTTYPE(unsigned,int) i;
+
+		/*
+		 * Check both the token buffer and (later) the input buffer,
+		 * since both could be non-scratch addresses.
+		 */
+		if (!dtrace_strcanload(tokaddr, size, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (!DTRACE_INSCRATCH(mstate, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (addr == NULL) {
+			/*
+			 * If the address specified is NULL, we use our saved
+			 * strtok pointer from the mstate.  Note that this
+			 * means that the saved strtok pointer is _only_
+			 * valid within multiple enablings of the same probe --
+			 * it behaves like an implicit clause-local variable.
+			 */
+			addr = mstate->dtms_strtok;
+		} else {
+			/*
+			 * If the user-specified address is non-NULL we must
+			 * access check it.  This is the only time we have
+			 * a chance to do so, since this address may reside
+			 * in the string table of this clause-- future calls
+			 * (when we fetch addr from mstate->dtms_strtok)
+			 * would fail this access check.
+			 */
+			if (!dtrace_strcanload(addr, size, mstate, vstate)) {
+				regs[rd] = NULL;
+				break;
+			}
+		}
+
+		/*
+		 * First, zero the token map, and then process the token
+		 * string -- setting a bit in the map for every character
+		 * found in the token string.
+		 */
+		for (i = 0; i < sizeof (tokmap); i++)
+			tokmap[i] = 0;
+
+		for (; tokaddr < toklimit; tokaddr++) {
+			if ((c = dtrace_load8(tokaddr)) == '\0')
+				break;
+
+			ASSERT((c >> 3) < sizeof (tokmap));
+			tokmap[c >> 3] |= (1 << (c & 0x7));
+		}
+
+		for (limit = addr + size; addr < limit; addr++) {
+			/*
+			 * We're looking for a character that is _not_ contained
+			 * in the token string.
+			 */
+			if ((c = dtrace_load8(addr)) == '\0')
+				break;
+
+			if (!(tokmap[c >> 3] & (1 << (c & 0x7))))
+				break;
+		}
+
+		if (c == '\0') {
+			/*
+			 * We reached the end of the string without finding
+			 * any character that was not in the token string.
+			 * We return NULL in this case, and we set the saved
+			 * address to NULL as well.
+			 */
+			regs[rd] = NULL;
+			mstate->dtms_strtok = NULL;
+			break;
+		}
+
+		/*
+		 * From here on, we're copying into the destination string.
+		 */
+		for (i = 0; addr < limit && i < size - 1; addr++) {
+			if ((c = dtrace_load8(addr)) == '\0')
+				break;
+
+			if (tokmap[c >> 3] & (1 << (c & 0x7)))
+				break;
+
+			ASSERT(i < size);
+			dest[i++] = c;
+		}
+
+		ASSERT(i < size);
+		dest[i] = '\0';
+		regs[rd] = (uintptr_t)dest;
+		mstate->dtms_scratch_ptr += size;
+		mstate->dtms_strtok = addr;
+		break;
+	}
+
+	case DIF_SUBR_SUBSTR: {
+		uintptr_t s = tupregs[0].dttk_value;
+		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+		char *d = (char *)mstate->dtms_scratch_ptr;
+		int64_t index = (int64_t)tupregs[1].dttk_value;
+		int64_t remaining = (int64_t)tupregs[2].dttk_value;
+		size_t len = dtrace_strlen((char *)s, size);
+		int64_t i;
+
+		if (!dtrace_canload(s, len + 1, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (!DTRACE_INSCRATCH(mstate, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (nargs <= 2)
+			remaining = (int64_t)size;
+
+		if (index < 0) {
+			index += len;
+
+			if (index < 0 && index + remaining > 0) {
+				remaining += index;
+				index = 0;
+			}
+		}
+
+		if (VBDTCAST(uint64_t)index >= len || index < 0) {
+			remaining = 0;
+		} else if (remaining < 0) {
+			remaining += len - index;
+		} else if (VBDTCAST(uint64_t)index + remaining > size) {
+			remaining = size - index;
+		}
+
+		for (i = 0; i < remaining; i++) {
+			if ((d[i] = dtrace_load8(s + index + i)) == '\0')
+				break;
+		}
+
+		d[i] = '\0';
+
+		mstate->dtms_scratch_ptr += size;
+		regs[rd] = (uintptr_t)d;
+		break;
+	}
+
+	case DIF_SUBR_GETMAJOR:
+#ifndef VBOX
+#ifdef _LP64
+		regs[rd] = (tupregs[0].dttk_value >> NBITSMINOR64) & MAXMAJ64;
+#else
+		regs[rd] = (tupregs[0].dttk_value >> NBITSMINOR) & MAXMAJ;
+#endif
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+
+	case DIF_SUBR_GETMINOR:
+#ifndef VBOX
+#ifdef _LP64
+		regs[rd] = tupregs[0].dttk_value & MAXMIN64;
+#else
+		regs[rd] = tupregs[0].dttk_value & MAXMIN;
+#endif
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+
+	case DIF_SUBR_DDI_PATHNAME: {
+#ifndef VBOX
+		/*
+		 * This one is a galactic mess.  We are going to roughly
+		 * emulate ddi_pathname(), but it's made more complicated
+		 * by the fact that we (a) want to include the minor name and
+		 * (b) must proceed iteratively instead of recursively.
+		 */
+		uintptr_t dest = mstate->dtms_scratch_ptr;
+		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+		char *start = (char *)dest, *end = start + size - 1;
+		uintptr_t daddr = tupregs[0].dttk_value;
+		int64_t minor = (int64_t)tupregs[1].dttk_value;
+		char *s;
+		int i, len, depth = 0;
+
+		/*
+		 * Due to all the pointer jumping we do and context we must
+		 * rely upon, we just mandate that the user must have kernel
+		 * read privileges to use this routine.
+		 */
+		if ((mstate->dtms_access & DTRACE_ACCESS_KERNEL) == 0) {
+			*flags |= CPU_DTRACE_KPRIV;
+			*illval = daddr;
+			regs[rd] = NULL;
+		}
+
+		if (!DTRACE_INSCRATCH(mstate, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		*end = '\0';
+
+		/*
+		 * We want to have a name for the minor.  In order to do this,
+		 * we need to walk the minor list from the devinfo.  We want
+		 * to be sure that we don't infinitely walk a circular list,
+		 * so we check for circularity by sending a scout pointer
+		 * ahead two elements for every element that we iterate over;
+		 * if the list is circular, these will ultimately point to the
+		 * same element.  You may recognize this little trick as the
+		 * answer to a stupid interview question -- one that always
+		 * seems to be asked by those who had to have it laboriously
+		 * explained to them, and who can't even concisely describe
+		 * the conditions under which one would be forced to resort to
+		 * this technique.  Needless to say, those conditions are
+		 * found here -- and probably only here.  Is this the only use
+		 * of this infamous trick in shipping, production code?  If it
+		 * isn't, it probably should be...
+		 */
+		if (minor != -1) {
+			uintptr_t maddr = dtrace_loadptr(daddr +
+			    offsetof(struct dev_info, devi_minor));
+
+			uintptr_t next = offsetof(struct ddi_minor_data, next);
+			uintptr_t name = offsetof(struct ddi_minor_data,
+			    d_minor) + offsetof(struct ddi_minor, name);
+			uintptr_t dev = offsetof(struct ddi_minor_data,
+			    d_minor) + offsetof(struct ddi_minor, dev);
+			uintptr_t scout;
+
+			if (maddr != NULL)
+				scout = dtrace_loadptr(maddr + next);
+
+			while (maddr != NULL && !(*flags & CPU_DTRACE_FAULT)) {
+				uint64_t m;
+#ifdef _LP64
+				m = dtrace_load64(maddr + dev) & MAXMIN64;
+#else
+				m = dtrace_load32(maddr + dev) & MAXMIN;
+#endif
+				if (m != minor) {
+					maddr = dtrace_loadptr(maddr + next);
+
+					if (scout == NULL)
+						continue;
+
+					scout = dtrace_loadptr(scout + next);
+
+					if (scout == NULL)
+						continue;
+
+					scout = dtrace_loadptr(scout + next);
+
+					if (scout == NULL)
+						continue;
+
+					if (scout == maddr) {
+						*flags |= CPU_DTRACE_ILLOP;
+						break;
+					}
+
+					continue;
+				}
+
+				/*
+				 * We have the minor data.  Now we need to
+				 * copy the minor's name into the end of the
+				 * pathname.
+				 */
+				s = (char *)dtrace_loadptr(maddr + name);
+				len = dtrace_strlen(s, size);
+
+				if (*flags & CPU_DTRACE_FAULT)
+					break;
+
+				if (len != 0) {
+					if ((end -= (len + 1)) < start)
+						break;
+
+					*end = ':';
+				}
+
+				for (i = 1; i <= len; i++)
+					end[i] = dtrace_load8((uintptr_t)s++);
+				break;
+			}
+		}
+
+		while (daddr != NULL && !(*flags & CPU_DTRACE_FAULT)) {
+			ddi_node_state_t devi_state;
+
+			devi_state = dtrace_load32(daddr +
+			    offsetof(struct dev_info, devi_node_state));
+
+			if (*flags & CPU_DTRACE_FAULT)
+				break;
+
+			if (devi_state >= DS_INITIALIZED) {
+				s = (char *)dtrace_loadptr(daddr +
+				    offsetof(struct dev_info, devi_addr));
+				len = dtrace_strlen(s, size);
+
+				if (*flags & CPU_DTRACE_FAULT)
+					break;
+
+				if (len != 0) {
+					if ((end -= (len + 1)) < start)
+						break;
+
+					*end = '@';
+				}
+
+				for (i = 1; i <= len; i++)
+					end[i] = dtrace_load8((uintptr_t)s++);
+			}
+
+			/*
+			 * Now for the node name...
+			 */
+			s = (char *)dtrace_loadptr(daddr +
+			    offsetof(struct dev_info, devi_node_name));
+
+			daddr = dtrace_loadptr(daddr +
+			    offsetof(struct dev_info, devi_parent));
+
+			/*
+			 * If our parent is NULL (that is, if we're the root
+			 * node), we're going to use the special path
+			 * "devices".
+			 */
+			if (daddr == NULL)
+				s = "devices";
+
+			len = dtrace_strlen(s, size);
+			if (*flags & CPU_DTRACE_FAULT)
+				break;
+
+			if ((end -= (len + 1)) < start)
+				break;
+
+			for (i = 1; i <= len; i++)
+				end[i] = dtrace_load8((uintptr_t)s++);
+			*end = '/';
+
+			if (depth++ > dtrace_devdepth_max) {
+				*flags |= CPU_DTRACE_ILLOP;
+				break;
+			}
+		}
+
+		if (end < start)
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+
+		if (daddr == NULL) {
+			regs[rd] = (uintptr_t)end;
+			mstate->dtms_scratch_ptr += size;
+		}
+
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+		break;
+	}
+
+	case DIF_SUBR_STRJOIN: {
+		char *d = (char *)mstate->dtms_scratch_ptr;
+		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+		uintptr_t s1 = tupregs[0].dttk_value;
+		uintptr_t s2 = tupregs[1].dttk_value;
+		VBDTTYPE(unsigned,int) i = 0;
+
+		if (!dtrace_strcanload(s1, size, mstate, vstate) ||
+		    !dtrace_strcanload(s2, size, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (!DTRACE_INSCRATCH(mstate, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		for (;;) {
+			if (i >= size) {
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+				regs[rd] = NULL;
+				break;
+			}
+
+			if ((d[i++] = dtrace_load8(s1++)) == '\0') {
+				i--;
+				break;
+			}
+		}
+
+		for (;;) {
+			if (i >= size) {
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+				regs[rd] = NULL;
+				break;
+			}
+
+			if ((d[i++] = dtrace_load8(s2++)) == '\0')
+				break;
+		}
+
+		if (i < size) {
+			mstate->dtms_scratch_ptr += i;
+			regs[rd] = (uintptr_t)d;
+		}
+
+		break;
+	}
+
+	case DIF_SUBR_LLTOSTR: {
+		int64_t i = (int64_t)tupregs[0].dttk_value;
+		int64_t val = i < 0 ? i * -1 : i;
+		uint64_t size = 22;	/* enough room for 2^64 in decimal */
+		char *end = (char *)mstate->dtms_scratch_ptr + size - 1;
+
+		if (!DTRACE_INSCRATCH(mstate, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		for (*end-- = '\0'; val; val /= 10)
+			*end-- = '0' + (val % 10);
+
+		if (i == 0)
+			*end-- = '0';
+
+		if (i < 0)
+			*end-- = '-';
+
+		regs[rd] = (uintptr_t)end + 1;
+		mstate->dtms_scratch_ptr += size;
+		break;
+	}
+
+	case DIF_SUBR_HTONS:
+	case DIF_SUBR_NTOHS:
+#ifdef _BIG_ENDIAN
+		regs[rd] = (uint16_t)tupregs[0].dttk_value;
+#else
+		regs[rd] = DT_BSWAP_16((uint16_t)tupregs[0].dttk_value);
+#endif
+		break;
+
+
+	case DIF_SUBR_HTONL:
+	case DIF_SUBR_NTOHL:
+#ifdef _BIG_ENDIAN
+		regs[rd] = (uint32_t)tupregs[0].dttk_value;
+#else
+		regs[rd] = DT_BSWAP_32((uint32_t)tupregs[0].dttk_value);
+#endif
+		break;
+
+
+	case DIF_SUBR_HTONLL:
+	case DIF_SUBR_NTOHLL:
+#ifdef _BIG_ENDIAN
+		regs[rd] = (uint64_t)tupregs[0].dttk_value;
+#else
+		regs[rd] = DT_BSWAP_64((uint64_t)tupregs[0].dttk_value);
+#endif
+		break;
+
+
+	case DIF_SUBR_DIRNAME:
+	case DIF_SUBR_BASENAME: {
+		char *dest = (char *)mstate->dtms_scratch_ptr;
+		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+		uintptr_t src = tupregs[0].dttk_value;
+		int i, j, len = VBDTCAST(int)dtrace_strlen((char *)src, size);
+		int lastbase = -1, firstbase = -1, lastdir = -1;
+		int start, end;
+
+		if (!dtrace_canload(src, len + 1, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (!DTRACE_INSCRATCH(mstate, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		/*
+		 * The basename and dirname for a zero-length string is
+		 * defined to be "."
+		 */
+		if (len == 0) {
+			len = 1;
+			src = (uintptr_t)".";
+		}
+
+		/*
+		 * Start from the back of the string, moving back toward the
+		 * front until we see a character that isn't a slash.  That
+		 * character is the last character in the basename.
+		 */
+		for (i = len - 1; i >= 0; i--) {
+			if (dtrace_load8(src + i) != '/')
+				break;
+		}
+
+		if (i >= 0)
+			lastbase = i;
+
+		/*
+		 * Starting from the last character in the basename, move
+		 * towards the front until we find a slash.  The character
+		 * that we processed immediately before that is the first
+		 * character in the basename.
+		 */
+		for (; i >= 0; i--) {
+			if (dtrace_load8(src + i) == '/')
+				break;
+		}
+
+		if (i >= 0)
+			firstbase = i + 1;
+
+		/*
+		 * Now keep going until we find a non-slash character.  That
+		 * character is the last character in the dirname.
+		 */
+		for (; i >= 0; i--) {
+			if (dtrace_load8(src + i) != '/')
+				break;
+		}
+
+		if (i >= 0)
+			lastdir = i;
+
+		ASSERT(!(lastbase == -1 && firstbase != -1));
+		ASSERT(!(firstbase == -1 && lastdir != -1));
+
+		if (lastbase == -1) {
+			/*
+			 * We didn't find a non-slash character.  We know that
+			 * the length is non-zero, so the whole string must be
+			 * slashes.  In either the dirname or the basename
+			 * case, we return '/'.
+			 */
+			ASSERT(firstbase == -1);
+			firstbase = lastbase = lastdir = 0;
+		}
+
+		if (firstbase == -1) {
+			/*
+			 * The entire string consists only of a basename
+			 * component.  If we're looking for dirname, we need
+			 * to change our string to be just "."; if we're
+			 * looking for a basename, we'll just set the first
+			 * character of the basename to be 0.
+			 */
+			if (subr == DIF_SUBR_DIRNAME) {
+				ASSERT(lastdir == -1);
+				src = (uintptr_t)".";
+				lastdir = 0;
+			} else {
+				firstbase = 0;
+			}
+		}
+
+		if (subr == DIF_SUBR_DIRNAME) {
+			if (lastdir == -1) {
+				/*
+				 * We know that we have a slash in the name --
+				 * or lastdir would be set to 0, above.  And
+				 * because lastdir is -1, we know that this
+				 * slash must be the first character.  (That
+				 * is, the full string must be of the form
+				 * "/basename".)  In this case, the last
+				 * character of the directory name is 0.
+				 */
+				lastdir = 0;
+			}
+
+			start = 0;
+			end = lastdir;
+		} else {
+			ASSERT(subr == DIF_SUBR_BASENAME);
+			ASSERT(firstbase != -1 && lastbase != -1);
+			start = firstbase;
+			end = lastbase;
+		}
+
+		for (i = start, j = 0; i <= end && VBDTCAST(unsigned)j < size - 1; i++, j++)
+			dest[j] = dtrace_load8(src + i);
+
+		dest[j] = '\0';
+		regs[rd] = (uintptr_t)dest;
+		mstate->dtms_scratch_ptr += size;
+		break;
+	}
+
+	case DIF_SUBR_CLEANPATH: {
+		char *dest = (char *)mstate->dtms_scratch_ptr, c;
+		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
+		uintptr_t src = tupregs[0].dttk_value;
+		int i = 0, j = 0;
+
+		if (!dtrace_strcanload(src, size, mstate, vstate)) {
+			regs[rd] = NULL;
+			break;
+		}
+
+		if (!DTRACE_INSCRATCH(mstate, size)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+			regs[rd] = NULL;
+			break;
+		}
+
+		/*
+		 * Move forward, loading each character.
+		 */
+		do {
+			c = dtrace_load8(src + i++);
+next:
+			if (j + 5 >= VBDTCAST(int64_t)size)	/* 5 = strlen("/..c\0") */
+				break;
+
+			if (c != '/') {
+				dest[j++] = c;
+				continue;
+			}
+
+			c = dtrace_load8(src + i++);
+
+			if (c == '/') {
+				/*
+				 * We have two slashes -- we can just advance
+				 * to the next character.
+				 */
+				goto next;
+			}
+
+			if (c != '.') {
+				/*
+				 * This is not "." and it's not ".." -- we can
+				 * just store the "/" and this character and
+				 * drive on.
+				 */
+				dest[j++] = '/';
+				dest[j++] = c;
+				continue;
+			}
+
+			c = dtrace_load8(src + i++);
+
+			if (c == '/') {
+				/*
+				 * This is a "/./" component.  We're not going
+				 * to store anything in the destination buffer;
+				 * we're just going to go to the next component.
+				 */
+				goto next;
+			}
+
+			if (c != '.') {
+				/*
+				 * This is not ".." -- we can just store the
+				 * "/." and this character and continue
+				 * processing.
+				 */
+				dest[j++] = '/';
+				dest[j++] = '.';
+				dest[j++] = c;
+				continue;
+			}
+
+			c = dtrace_load8(src + i++);
+
+			if (c != '/' && c != '\0') {
+				/*
+				 * This is not ".." -- it's "..[mumble]".
+				 * We'll store the "/.." and this character
+				 * and continue processing.
+				 */
+				dest[j++] = '/';
+				dest[j++] = '.';
+				dest[j++] = '.';
+				dest[j++] = c;
+				continue;
+			}
+
+			/*
+			 * This is "/../" or "/..\0".  We need to back up
+			 * our destination pointer until we find a "/".
+			 */
+			i--;
+			while (j != 0 && dest[--j] != '/')
+				continue;
+
+			if (c == '\0')
+				dest[++j] = '/';
+		} while (c != '\0');
+
+		dest[j] = '\0';
+		regs[rd] = (uintptr_t)dest;
+		mstate->dtms_scratch_ptr += size;
+		break;
+	}
+
+	case DIF_SUBR_INET_NTOA:
+	case DIF_SUBR_INET_NTOA6:
+	case DIF_SUBR_INET_NTOP: {
+#ifndef VBOX
+		size_t size;
+		int af, argi, i;
+		char *base, *end;
+
+		if (subr == DIF_SUBR_INET_NTOP) {
+			af = (int)tupregs[0].dttk_value;
+			argi = 1;
+		} else {
+			af = subr == DIF_SUBR_INET_NTOA ? AF_INET: AF_INET6;
+			argi = 0;
+		}
+
+		if (af == AF_INET) {
+			ipaddr_t ip4;
+			uint8_t *ptr8, val;
+
+			/*
+			 * Safely load the IPv4 address.
+			 */
+			ip4 = dtrace_load32(tupregs[argi].dttk_value);
+
+			/*
+			 * Check an IPv4 string will fit in scratch.
+			 */
+			size = INET_ADDRSTRLEN;
+			if (!DTRACE_INSCRATCH(mstate, size)) {
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+				regs[rd] = NULL;
+				break;
+			}
+			base = (char *)mstate->dtms_scratch_ptr;
+			end = (char *)mstate->dtms_scratch_ptr + size - 1;
+
+			/*
+			 * Stringify as a dotted decimal quad.
+			 */
+			*end-- = '\0';
+			ptr8 = (uint8_t *)&ip4;
+			for (i = 3; i >= 0; i--) {
+				val = ptr8[i];
+
+				if (val == 0) {
+					*end-- = '0';
+				} else {
+					for (; val; val /= 10) {
+						*end-- = '0' + (val % 10);
+					}
+				}
+
+				if (i > 0)
+					*end-- = '.';
+			}
+			ASSERT(end + 1 >= base);
+
+		} else if (af == AF_INET6) {
+			struct in6_addr ip6;
+			int firstzero, tryzero, numzero, v6end;
+			uint16_t val;
+			const char digits[] = "0123456789abcdef";
+
+			/*
+			 * Stringify using RFC 1884 convention 2 - 16 bit
+			 * hexadecimal values with a zero-run compression.
+			 * Lower case hexadecimal digits are used.
+			 * 	eg, fe80::214:4fff:fe0b:76c8.
+			 * The IPv4 embedded form is returned for inet_ntop,
+			 * just the IPv4 string is returned for inet_ntoa6.
+			 */
+
+			/*
+			 * Safely load the IPv6 address.
+			 */
+			dtrace_bcopy(
+			    (void *)(uintptr_t)tupregs[argi].dttk_value,
+			    (void *)(uintptr_t)&ip6, sizeof (struct in6_addr));
+
+			/*
+			 * Check an IPv6 string will fit in scratch.
+			 */
+			size = INET6_ADDRSTRLEN;
+			if (!DTRACE_INSCRATCH(mstate, size)) {
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+				regs[rd] = NULL;
+				break;
+			}
+			base = (char *)mstate->dtms_scratch_ptr;
+			end = (char *)mstate->dtms_scratch_ptr + size - 1;
+			*end-- = '\0';
+
+			/*
+			 * Find the longest run of 16 bit zero values
+			 * for the single allowed zero compression - "::".
+			 */
+			firstzero = -1;
+			tryzero = -1;
+			numzero = 1;
+			for (i = 0; i < sizeof (struct in6_addr); i++) {
+				if (ip6._S6_un._S6_u8[i] == 0 &&
+				    tryzero == -1 && i % 2 == 0) {
+					tryzero = i;
+					continue;
+				}
+
+				if (tryzero != -1 &&
+				    (ip6._S6_un._S6_u8[i] != 0 ||
+				    i == sizeof (struct in6_addr) - 1)) {
+
+					if (i - tryzero <= numzero) {
+						tryzero = -1;
+						continue;
+					}
+
+					firstzero = tryzero;
+					numzero = i - i % 2 - tryzero;
+					tryzero = -1;
+
+					if (ip6._S6_un._S6_u8[i] == 0 &&
+					    i == sizeof (struct in6_addr) - 1)
+						numzero += 2;
+				}
+			}
+			ASSERT(firstzero + numzero <= sizeof (struct in6_addr));
+
+			/*
+			 * Check for an IPv4 embedded address.
+			 */
+			v6end = sizeof (struct in6_addr) - 2;
+			if (IN6_IS_ADDR_V4MAPPED(&ip6) ||
+			    IN6_IS_ADDR_V4COMPAT(&ip6)) {
+				for (i = sizeof (struct in6_addr) - 1;
+				    i >= DTRACE_V4MAPPED_OFFSET; i--) {
+					ASSERT(end >= base);
+
+					val = ip6._S6_un._S6_u8[i];
+
+					if (val == 0) {
+						*end-- = '0';
+					} else {
+						for (; val; val /= 10) {
+							*end-- = '0' + val % 10;
+						}
+					}
+
+					if (i > DTRACE_V4MAPPED_OFFSET)
+						*end-- = '.';
+				}
+
+				if (subr == DIF_SUBR_INET_NTOA6)
+					goto inetout;
+
+				/*
+				 * Set v6end to skip the IPv4 address that
+				 * we have already stringified.
+				 */
+				v6end = 10;
+			}
+
+			/*
+			 * Build the IPv6 string by working through the
+			 * address in reverse.
+			 */
+			for (i = v6end; i >= 0; i -= 2) {
+				ASSERT(end >= base);
+
+				if (i == firstzero + numzero - 2) {
+					*end-- = ':';
+					*end-- = ':';
+					i -= numzero - 2;
+					continue;
+				}
+
+				if (i < 14 && i != firstzero - 2)
+					*end-- = ':';
+
+				val = (ip6._S6_un._S6_u8[i] << 8) +
+				    ip6._S6_un._S6_u8[i + 1];
+
+				if (val == 0) {
+					*end-- = '0';
+				} else {
+					for (; val; val /= 16) {
+						*end-- = digits[val % 16];
+					}
+				}
+			}
+			ASSERT(end + 1 >= base);
+
+		} else {
+			/*
+			 * The user didn't use AH_INET or AH_INET6.
+			 */
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+			regs[rd] = NULL;
+			break;
+		}
+
+inetout:	regs[rd] = (uintptr_t)end + 1;
+		mstate->dtms_scratch_ptr += size;
+#else  /* VBOX */
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif /* VBOX */
+		break;
+	}
+
+	}
+}
+
+/*
+ * Emulate the execution of DTrace IR instructions specified by the given
+ * DIF object.  This function is deliberately void of assertions as all of
+ * the necessary checks are handled by a call to dtrace_difo_validate().
+ */
+static uint64_t
+dtrace_dif_emulate(dtrace_difo_t *difo, dtrace_mstate_t *mstate,
+    dtrace_vstate_t *vstate, dtrace_state_t *state)
+{
+	const dif_instr_t *text = difo->dtdo_buf;
+	const uint_t textlen = difo->dtdo_len;
+	const char *strtab = difo->dtdo_strtab;
+	const uint64_t *inttab = difo->dtdo_inttab;
+
+	uint64_t rval = 0;
+	dtrace_statvar_t *svar;
+	dtrace_dstate_t *dstate = &vstate->dtvs_dynvars;
+	dtrace_difv_t *v;
+	volatile uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+	volatile uintptr_t *illval = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval;
+
+	dtrace_key_t tupregs[DIF_DTR_NREGS + 2]; /* +2 for thread and id */
+	uint64_t regs[DIF_DIR_NREGS];
+	uint64_t *tmp;
+
+	uint8_t cc_n = 0, cc_z = 0, cc_v = 0, cc_c = 0;
+	int64_t cc_r;
+	uint_t pc = 0, id, opc VBDTUNASS(0);
+	uint8_t ttop = 0;
+	dif_instr_t instr;
+	uint_t r1, r2, rd;
+
+	/*
+	 * We stash the current DIF object into the machine state: we need it
+	 * for subsequent access checking.
+	 */
+	mstate->dtms_difo = difo;
+
+	regs[DIF_REG_R0] = 0; 		/* %r0 is fixed at zero */
+
+	while (pc < textlen && !(*flags & CPU_DTRACE_FAULT)) {
+		opc = pc;
+
+		instr = text[pc++];
+		r1 = DIF_INSTR_R1(instr);
+		r2 = DIF_INSTR_R2(instr);
+		rd = DIF_INSTR_RD(instr);
+
+		switch (DIF_INSTR_OP(instr)) {
+		case DIF_OP_OR:
+			regs[rd] = regs[r1] | regs[r2];
+			break;
+		case DIF_OP_XOR:
+			regs[rd] = regs[r1] ^ regs[r2];
+			break;
+		case DIF_OP_AND:
+			regs[rd] = regs[r1] & regs[r2];
+			break;
+		case DIF_OP_SLL:
+			regs[rd] = regs[r1] << regs[r2];
+			break;
+		case DIF_OP_SRL:
+			regs[rd] = regs[r1] >> regs[r2];
+			break;
+		case DIF_OP_SUB:
+			regs[rd] = regs[r1] - regs[r2];
+			break;
+		case DIF_OP_ADD:
+			regs[rd] = regs[r1] + regs[r2];
+			break;
+		case DIF_OP_MUL:
+			regs[rd] = regs[r1] * regs[r2];
+			break;
+		case DIF_OP_SDIV:
+			if (regs[r2] == 0) {
+				regs[rd] = 0;
+				*flags |= CPU_DTRACE_DIVZERO;
+			} else {
+				regs[rd] = (int64_t)regs[r1] /
+				    (int64_t)regs[r2];
+			}
+			break;
+
+		case DIF_OP_UDIV:
+			if (regs[r2] == 0) {
+				regs[rd] = 0;
+				*flags |= CPU_DTRACE_DIVZERO;
+			} else {
+				regs[rd] = regs[r1] / regs[r2];
+			}
+			break;
+
+		case DIF_OP_SREM:
+			if (regs[r2] == 0) {
+				regs[rd] = 0;
+				*flags |= CPU_DTRACE_DIVZERO;
+			} else {
+				regs[rd] = (int64_t)regs[r1] %
+				    (int64_t)regs[r2];
+			}
+			break;
+
+		case DIF_OP_UREM:
+			if (regs[r2] == 0) {
+				regs[rd] = 0;
+				*flags |= CPU_DTRACE_DIVZERO;
+			} else {
+				regs[rd] = regs[r1] % regs[r2];
+			}
+			break;
+
+		case DIF_OP_NOT:
+			regs[rd] = ~regs[r1];
+			break;
+		case DIF_OP_MOV:
+			regs[rd] = regs[r1];
+			break;
+		case DIF_OP_CMP:
+			cc_r = regs[r1] - regs[r2];
+			cc_n = cc_r < 0;
+			cc_z = cc_r == 0;
+			cc_v = 0;
+			cc_c = regs[r1] < regs[r2];
+			break;
+		case DIF_OP_TST:
+			cc_n = cc_v = cc_c = 0;
+			cc_z = regs[r1] == 0;
+			break;
+		case DIF_OP_BA:
+			pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BE:
+			if (cc_z)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BNE:
+			if (cc_z == 0)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BG:
+			if ((cc_z | (cc_n ^ cc_v)) == 0)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BGU:
+			if ((cc_c | cc_z) == 0)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BGE:
+			if ((cc_n ^ cc_v) == 0)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BGEU:
+			if (cc_c == 0)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BL:
+			if (cc_n ^ cc_v)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BLU:
+			if (cc_c)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BLE:
+			if (cc_z | (cc_n ^ cc_v))
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_BLEU:
+			if (cc_c | cc_z)
+				pc = DIF_INSTR_LABEL(instr);
+			break;
+		case DIF_OP_RLDSB:
+			if (!dtrace_canstore(regs[r1], 1, mstate, vstate)) {
+				*flags |= CPU_DTRACE_KPRIV;
+				*illval = regs[r1];
+				break;
+			}
+			/*FALLTHROUGH*/
+		case DIF_OP_LDSB:
+			regs[rd] = (int8_t)dtrace_load8(regs[r1]);
+			break;
+		case DIF_OP_RLDSH:
+			if (!dtrace_canstore(regs[r1], 2, mstate, vstate)) {
+				*flags |= CPU_DTRACE_KPRIV;
+				*illval = regs[r1];
+				break;
+			}
+			/*FALLTHROUGH*/
+		case DIF_OP_LDSH:
+			regs[rd] = (int16_t)dtrace_load16(regs[r1]);
+			break;
+		case DIF_OP_RLDSW:
+			if (!dtrace_canstore(regs[r1], 4, mstate, vstate)) {
+				*flags |= CPU_DTRACE_KPRIV;
+				*illval = regs[r1];
+				break;
+			}
+			/*FALLTHROUGH*/
+		case DIF_OP_LDSW:
+			regs[rd] = (int32_t)dtrace_load32(regs[r1]);
+			break;
+		case DIF_OP_RLDUB:
+			if (!dtrace_canstore(regs[r1], 1, mstate, vstate)) {
+				*flags |= CPU_DTRACE_KPRIV;
+				*illval = regs[r1];
+				break;
+			}
+			/*FALLTHROUGH*/
+		case DIF_OP_LDUB:
+			regs[rd] = dtrace_load8(regs[r1]);
+			break;
+		case DIF_OP_RLDUH:
+			if (!dtrace_canstore(regs[r1], 2, mstate, vstate)) {
+				*flags |= CPU_DTRACE_KPRIV;
+				*illval = regs[r1];
+				break;
+			}
+			/*FALLTHROUGH*/
+		case DIF_OP_LDUH:
+			regs[rd] = dtrace_load16(regs[r1]);
+			break;
+		case DIF_OP_RLDUW:
+			if (!dtrace_canstore(regs[r1], 4, mstate, vstate)) {
+				*flags |= CPU_DTRACE_KPRIV;
+				*illval = regs[r1];
+				break;
+			}
+			/*FALLTHROUGH*/
+		case DIF_OP_LDUW:
+			regs[rd] = dtrace_load32(regs[r1]);
+			break;
+		case DIF_OP_RLDX:
+			if (!dtrace_canstore(regs[r1], 8, mstate, vstate)) {
+				*flags |= CPU_DTRACE_KPRIV;
+				*illval = regs[r1];
+				break;
+			}
+			/*FALLTHROUGH*/
+		case DIF_OP_LDX:
+			regs[rd] = dtrace_load64(regs[r1]);
+			break;
+		case DIF_OP_ULDSB:
+			regs[rd] = (int8_t)
+			    dtrace_fuword8((void *)(uintptr_t)regs[r1]);
+			break;
+		case DIF_OP_ULDSH:
+			regs[rd] = (int16_t)
+			    dtrace_fuword16((void *)(uintptr_t)regs[r1]);
+			break;
+		case DIF_OP_ULDSW:
+			regs[rd] = (int32_t)
+			    dtrace_fuword32((void *)(uintptr_t)regs[r1]);
+			break;
+		case DIF_OP_ULDUB:
+			regs[rd] =
+			    dtrace_fuword8((void *)(uintptr_t)regs[r1]);
+			break;
+		case DIF_OP_ULDUH:
+			regs[rd] =
+			    dtrace_fuword16((void *)(uintptr_t)regs[r1]);
+			break;
+		case DIF_OP_ULDUW:
+			regs[rd] =
+			    dtrace_fuword32((void *)(uintptr_t)regs[r1]);
+			break;
+		case DIF_OP_ULDX:
+			regs[rd] =
+			    dtrace_fuword64((void *)(uintptr_t)regs[r1]);
+			break;
+		case DIF_OP_RET:
+			rval = regs[rd];
+			pc = textlen;
+			break;
+		case DIF_OP_NOP:
+			break;
+		case DIF_OP_SETX:
+			regs[rd] = inttab[DIF_INSTR_INTEGER(instr)];
+			break;
+		case DIF_OP_SETS:
+			regs[rd] = (uint64_t)(uintptr_t)
+			    (strtab + DIF_INSTR_STRING(instr));
+			break;
+		case DIF_OP_SCMP: {
+			size_t sz = state->dts_options[DTRACEOPT_STRSIZE];
+			uintptr_t s1 = regs[r1];
+			uintptr_t s2 = regs[r2];
+
+			if (s1 != NULL &&
+			    !dtrace_strcanload(s1, sz, mstate, vstate))
+				break;
+			if (s2 != NULL &&
+			    !dtrace_strcanload(s2, sz, mstate, vstate))
+				break;
+
+			cc_r = dtrace_strncmp((char *)s1, (char *)s2, sz);
+
+			cc_n = cc_r < 0;
+			cc_z = cc_r == 0;
+			cc_v = cc_c = 0;
+			break;
+		}
+		case DIF_OP_LDGA:
+			regs[rd] = dtrace_dif_variable(mstate, state,
+			    r1, regs[r2]);
+			break;
+		case DIF_OP_LDGS:
+			id = DIF_INSTR_VAR(instr);
+
+			if (id >= DIF_VAR_OTHER_UBASE) {
+				uintptr_t a;
+
+				id -= DIF_VAR_OTHER_UBASE;
+				svar = vstate->dtvs_globals[id];
+				ASSERT(svar != NULL);
+				v = &svar->dtsv_var;
+
+				if (!(v->dtdv_type.dtdt_flags & DIF_TF_BYREF)) {
+					regs[rd] = svar->dtsv_data;
+					break;
+				}
+
+				a = (uintptr_t)svar->dtsv_data;
+
+				if (*(uint8_t *)a == UINT8_MAX) {
+					/*
+					 * If the 0th byte is set to UINT8_MAX
+					 * then this is to be treated as a
+					 * reference to a NULL variable.
+					 */
+					regs[rd] = NULL;
+				} else {
+					regs[rd] = a + sizeof (uint64_t);
+				}
+
+				break;
+			}
+
+			regs[rd] = dtrace_dif_variable(mstate, state, id, 0);
+			break;
+
+		case DIF_OP_STGS:
+			id = DIF_INSTR_VAR(instr);
+
+			ASSERT(id >= DIF_VAR_OTHER_UBASE);
+			id -= DIF_VAR_OTHER_UBASE;
+
+			svar = vstate->dtvs_globals[id];
+			ASSERT(svar != NULL);
+			v = &svar->dtsv_var;
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF) {
+				uintptr_t a = (uintptr_t)svar->dtsv_data;
+
+				ASSERT(a != NULL);
+				ASSERT(svar->dtsv_size != 0);
+
+				if (regs[rd] == NULL) {
+					*(uint8_t *)a = UINT8_MAX;
+					break;
+				} else {
+					*(uint8_t *)a = 0;
+					a += sizeof (uint64_t);
+				}
+				if (!dtrace_vcanload(
+				    (void *)(uintptr_t)regs[rd], &v->dtdv_type,
+				    mstate, vstate))
+					break;
+
+				dtrace_vcopy((void *)(uintptr_t)regs[rd],
+				    (void *)a, &v->dtdv_type);
+				break;
+			}
+
+			svar->dtsv_data = regs[rd];
+			break;
+
+		case DIF_OP_LDTA:
+			/*
+			 * There are no DTrace built-in thread-local arrays at
+			 * present.  This opcode is saved for future work.
+			 */
+			*flags |= CPU_DTRACE_ILLOP;
+			regs[rd] = 0;
+			break;
+
+		case DIF_OP_LDLS:
+			id = DIF_INSTR_VAR(instr);
+
+			if (id < DIF_VAR_OTHER_UBASE) {
+				/*
+				 * For now, this has no meaning.
+				 */
+				regs[rd] = 0;
+				break;
+			}
+
+			id -= DIF_VAR_OTHER_UBASE;
+
+			ASSERT(VBDTCAST(int64_t)id < vstate->dtvs_nlocals);
+			ASSERT(vstate->dtvs_locals != NULL);
+
+			svar = vstate->dtvs_locals[id];
+			ASSERT(svar != NULL);
+			v = &svar->dtsv_var;
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF) {
+				uintptr_t a = (uintptr_t)svar->dtsv_data;
+				size_t sz = v->dtdv_type.dtdt_size;
+
+				sz += sizeof (uint64_t);
+				ASSERT(svar->dtsv_size == NCPU * sz);
+				a += VBDT_GET_CPUID() * sz;
+
+				if (*(uint8_t *)a == UINT8_MAX) {
+					/*
+					 * If the 0th byte is set to UINT8_MAX
+					 * then this is to be treated as a
+					 * reference to a NULL variable.
+					 */
+					regs[rd] = NULL;
+				} else {
+					regs[rd] = a + sizeof (uint64_t);
+				}
+
+				break;
+			}
+
+			ASSERT(svar->dtsv_size == NCPU * sizeof (uint64_t));
+			tmp = (uint64_t *)(uintptr_t)svar->dtsv_data;
+			regs[rd] = tmp[VBDT_GET_CPUID()];
+			break;
+
+		case DIF_OP_STLS:
+			id = DIF_INSTR_VAR(instr);
+
+			ASSERT(id >= DIF_VAR_OTHER_UBASE);
+			id -= DIF_VAR_OTHER_UBASE;
+			ASSERT(VBDTCAST(int64_t)id < vstate->dtvs_nlocals);
+
+			ASSERT(vstate->dtvs_locals != NULL);
+			svar = vstate->dtvs_locals[id];
+			ASSERT(svar != NULL);
+			v = &svar->dtsv_var;
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF) {
+				uintptr_t a = (uintptr_t)svar->dtsv_data;
+				size_t sz = v->dtdv_type.dtdt_size;
+
+				sz += sizeof (uint64_t);
+				ASSERT(svar->dtsv_size == NCPU * sz);
+				a += VBDT_GET_CPUID() * sz;
+
+				if (regs[rd] == NULL) {
+					*(uint8_t *)a = UINT8_MAX;
+					break;
+				} else {
+					*(uint8_t *)a = 0;
+					a += sizeof (uint64_t);
+				}
+
+				if (!dtrace_vcanload(
+				    (void *)(uintptr_t)regs[rd], &v->dtdv_type,
+				    mstate, vstate))
+					break;
+
+				dtrace_vcopy((void *)(uintptr_t)regs[rd],
+				    (void *)a, &v->dtdv_type);
+				break;
+			}
+
+			ASSERT(svar->dtsv_size == NCPU * sizeof (uint64_t));
+			tmp = (uint64_t *)(uintptr_t)svar->dtsv_data;
+			tmp[VBDT_GET_CPUID()] = regs[rd];
+			break;
+
+		case DIF_OP_LDTS: {
+			dtrace_dynvar_t *dvar;
+			dtrace_key_t *key;
+
+			id = DIF_INSTR_VAR(instr);
+			ASSERT(id >= DIF_VAR_OTHER_UBASE);
+			id -= DIF_VAR_OTHER_UBASE;
+			v = &vstate->dtvs_tlocals[id];
+
+			key = &tupregs[DIF_DTR_NREGS];
+			key[0].dttk_value = (uint64_t)id;
+			key[0].dttk_size = 0;
+			DTRACE_TLS_THRKEY(key[1].dttk_value);
+			key[1].dttk_size = 0;
+
+			dvar = dtrace_dynvar(dstate, 2, key,
+			    sizeof (uint64_t), DTRACE_DYNVAR_NOALLOC,
+			    mstate, vstate);
+
+			if (dvar == NULL) {
+				regs[rd] = 0;
+				break;
+			}
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF) {
+				regs[rd] = (uint64_t)(uintptr_t)dvar->dtdv_data;
+			} else {
+				regs[rd] = *((uint64_t *)dvar->dtdv_data);
+			}
+
+			break;
+		}
+
+		case DIF_OP_STTS: {
+			dtrace_dynvar_t *dvar;
+			dtrace_key_t *key;
+
+			id = DIF_INSTR_VAR(instr);
+			ASSERT(id >= DIF_VAR_OTHER_UBASE);
+			id -= DIF_VAR_OTHER_UBASE;
+
+			key = &tupregs[DIF_DTR_NREGS];
+			key[0].dttk_value = (uint64_t)id;
+			key[0].dttk_size = 0;
+			DTRACE_TLS_THRKEY(key[1].dttk_value);
+			key[1].dttk_size = 0;
+			v = &vstate->dtvs_tlocals[id];
+
+			dvar = dtrace_dynvar(dstate, 2, key,
+			    v->dtdv_type.dtdt_size > sizeof (uint64_t) ?
+			    v->dtdv_type.dtdt_size : sizeof (uint64_t),
+			    regs[rd] ? DTRACE_DYNVAR_ALLOC :
+			    DTRACE_DYNVAR_DEALLOC, mstate, vstate);
+
+			/*
+			 * Given that we're storing to thread-local data,
+			 * we need to flush our predicate cache.
+			 */
+			curthread->t_predcache = NULL;
+
+			if (dvar == NULL)
+				break;
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF) {
+				if (!dtrace_vcanload(
+				    (void *)(uintptr_t)regs[rd],
+				    &v->dtdv_type, mstate, vstate))
+					break;
+
+				dtrace_vcopy((void *)(uintptr_t)regs[rd],
+				    dvar->dtdv_data, &v->dtdv_type);
+			} else {
+				*((uint64_t *)dvar->dtdv_data) = regs[rd];
+			}
+
+			break;
+		}
+
+		case DIF_OP_SRA:
+			regs[rd] = (int64_t)regs[r1] >> regs[r2];
+			break;
+
+		case DIF_OP_CALL:
+			dtrace_dif_subr(DIF_INSTR_SUBR(instr), rd,
+			    regs, tupregs, ttop, mstate, state);
+			break;
+
+		case DIF_OP_PUSHTR:
+			if (ttop == DIF_DTR_NREGS) {
+				*flags |= CPU_DTRACE_TUPOFLOW;
+				break;
+			}
+
+			if (r1 == DIF_TYPE_STRING) {
+				/*
+				 * If this is a string type and the size is 0,
+				 * we'll use the system-wide default string
+				 * size.  Note that we are _not_ looking at
+				 * the value of the DTRACEOPT_STRSIZE option;
+				 * had this been set, we would expect to have
+				 * a non-zero size value in the "pushtr".
+				 */
+				tupregs[ttop].dttk_size =
+				    dtrace_strlen((char *)(uintptr_t)regs[rd],
+				    regs[r2] ? regs[r2] :
+				    dtrace_strsize_default) + 1;
+			} else {
+				tupregs[ttop].dttk_size = regs[r2];
+			}
+
+			tupregs[ttop++].dttk_value = regs[rd];
+			break;
+
+		case DIF_OP_PUSHTV:
+			if (ttop == DIF_DTR_NREGS) {
+				*flags |= CPU_DTRACE_TUPOFLOW;
+				break;
+			}
+
+			tupregs[ttop].dttk_value = regs[rd];
+			tupregs[ttop++].dttk_size = 0;
+			break;
+
+		case DIF_OP_POPTS:
+			if (ttop != 0)
+				ttop--;
+			break;
+
+		case DIF_OP_FLUSHTS:
+			ttop = 0;
+			break;
+
+		case DIF_OP_LDGAA:
+		case DIF_OP_LDTAA: {
+			dtrace_dynvar_t *dvar;
+			dtrace_key_t *key = tupregs;
+			uint_t nkeys = ttop;
+
+			id = DIF_INSTR_VAR(instr);
+			ASSERT(id >= DIF_VAR_OTHER_UBASE);
+			id -= DIF_VAR_OTHER_UBASE;
+
+			key[nkeys].dttk_value = (uint64_t)id;
+			key[nkeys++].dttk_size = 0;
+
+			if (DIF_INSTR_OP(instr) == DIF_OP_LDTAA) {
+				DTRACE_TLS_THRKEY(key[nkeys].dttk_value);
+				key[nkeys++].dttk_size = 0;
+				v = &vstate->dtvs_tlocals[id];
+			} else {
+				v = &vstate->dtvs_globals[id]->dtsv_var;
+			}
+
+			dvar = dtrace_dynvar(dstate, nkeys, key,
+			    v->dtdv_type.dtdt_size > sizeof (uint64_t) ?
+			    v->dtdv_type.dtdt_size : sizeof (uint64_t),
+			    DTRACE_DYNVAR_NOALLOC, mstate, vstate);
+
+			if (dvar == NULL) {
+				regs[rd] = 0;
+				break;
+			}
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF) {
+				regs[rd] = (uint64_t)(uintptr_t)dvar->dtdv_data;
+			} else {
+				regs[rd] = *((uint64_t *)dvar->dtdv_data);
+			}
+
+			break;
+		}
+
+		case DIF_OP_STGAA:
+		case DIF_OP_STTAA: {
+			dtrace_dynvar_t *dvar;
+			dtrace_key_t *key = tupregs;
+			uint_t nkeys = ttop;
+
+			id = DIF_INSTR_VAR(instr);
+			ASSERT(id >= DIF_VAR_OTHER_UBASE);
+			id -= DIF_VAR_OTHER_UBASE;
+
+			key[nkeys].dttk_value = (uint64_t)id;
+			key[nkeys++].dttk_size = 0;
+
+			if (DIF_INSTR_OP(instr) == DIF_OP_STTAA) {
+				DTRACE_TLS_THRKEY(key[nkeys].dttk_value);
+				key[nkeys++].dttk_size = 0;
+				v = &vstate->dtvs_tlocals[id];
+			} else {
+				v = &vstate->dtvs_globals[id]->dtsv_var;
+			}
+
+			dvar = dtrace_dynvar(dstate, nkeys, key,
+			    v->dtdv_type.dtdt_size > sizeof (uint64_t) ?
+			    v->dtdv_type.dtdt_size : sizeof (uint64_t),
+			    regs[rd] ? DTRACE_DYNVAR_ALLOC :
+			    DTRACE_DYNVAR_DEALLOC, mstate, vstate);
+
+			if (dvar == NULL)
+				break;
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF) {
+				if (!dtrace_vcanload(
+				    (void *)(uintptr_t)regs[rd], &v->dtdv_type,
+				    mstate, vstate))
+					break;
+
+				dtrace_vcopy((void *)(uintptr_t)regs[rd],
+				    dvar->dtdv_data, &v->dtdv_type);
+			} else {
+				*((uint64_t *)dvar->dtdv_data) = regs[rd];
+			}
+
+			break;
+		}
+
+		case DIF_OP_ALLOCS: {
+			uintptr_t ptr = P2ROUNDUP(mstate->dtms_scratch_ptr, 8);
+			size_t size = ptr - mstate->dtms_scratch_ptr + regs[r1];
+
+			/*
+			 * Rounding up the user allocation size could have
+			 * overflowed large, bogus allocations (like -1ULL) to
+			 * 0.
+			 */
+			if (size < regs[r1] ||
+			    !DTRACE_INSCRATCH(mstate, size)) {
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+				regs[rd] = NULL;
+				break;
+			}
+
+			dtrace_bzero((void *) mstate->dtms_scratch_ptr, size);
+			mstate->dtms_scratch_ptr += size;
+			regs[rd] = ptr;
+			break;
+		}
+
+		case DIF_OP_COPYS:
+			if (!dtrace_canstore(regs[rd], regs[r2],
+			    mstate, vstate)) {
+				*flags |= CPU_DTRACE_BADADDR;
+				*illval = regs[rd];
+				break;
+			}
+
+			if (!dtrace_canload(regs[r1], regs[r2], mstate, vstate))
+				break;
+
+			dtrace_bcopy((void *)(uintptr_t)regs[r1],
+			    (void *)(uintptr_t)regs[rd], (size_t)regs[r2]);
+			break;
+
+		case DIF_OP_STB:
+			if (!dtrace_canstore(regs[rd], 1, mstate, vstate)) {
+				*flags |= CPU_DTRACE_BADADDR;
+				*illval = regs[rd];
+				break;
+			}
+			*((uint8_t *)(uintptr_t)regs[rd]) = (uint8_t)regs[r1];
+			break;
+
+		case DIF_OP_STH:
+			if (!dtrace_canstore(regs[rd], 2, mstate, vstate)) {
+				*flags |= CPU_DTRACE_BADADDR;
+				*illval = regs[rd];
+				break;
+			}
+			if (regs[rd] & 1) {
+				*flags |= CPU_DTRACE_BADALIGN;
+				*illval = regs[rd];
+				break;
+			}
+			*((uint16_t *)(uintptr_t)regs[rd]) = (uint16_t)regs[r1];
+			break;
+
+		case DIF_OP_STW:
+			if (!dtrace_canstore(regs[rd], 4, mstate, vstate)) {
+				*flags |= CPU_DTRACE_BADADDR;
+				*illval = regs[rd];
+				break;
+			}
+			if (regs[rd] & 3) {
+				*flags |= CPU_DTRACE_BADALIGN;
+				*illval = regs[rd];
+				break;
+			}
+			*((uint32_t *)(uintptr_t)regs[rd]) = (uint32_t)regs[r1];
+			break;
+
+		case DIF_OP_STX:
+			if (!dtrace_canstore(regs[rd], 8, mstate, vstate)) {
+				*flags |= CPU_DTRACE_BADADDR;
+				*illval = regs[rd];
+				break;
+			}
+			if (regs[rd] & 7) {
+				*flags |= CPU_DTRACE_BADALIGN;
+				*illval = regs[rd];
+				break;
+			}
+			*((uint64_t *)(uintptr_t)regs[rd]) = regs[r1];
+			break;
+		}
+	}
+
+	if (!(*flags & CPU_DTRACE_FAULT))
+		return (rval);
+
+	mstate->dtms_fltoffs = opc * sizeof (dif_instr_t);
+	mstate->dtms_present |= DTRACE_MSTATE_FLTOFFS;
+
+	return (0);
+}
+
+#ifndef VBOX /* no destructive stuff */
+
+static void
+dtrace_action_breakpoint(dtrace_ecb_t *ecb)
+{
+	dtrace_probe_t *probe = ecb->dte_probe;
+	dtrace_provider_t *prov = probe->dtpr_provider;
+	char c[DTRACE_FULLNAMELEN + 80], *str;
+	char *msg = "dtrace: breakpoint action at probe ";
+	char *ecbmsg = " (ecb ";
+	uintptr_t mask = (0xf << (sizeof (uintptr_t) * NBBY / 4));
+	uintptr_t val = (uintptr_t)ecb;
+	int shift = (sizeof (uintptr_t) * NBBY) - 4, i = 0;
+
+	if (dtrace_destructive_disallow)
+		return;
+
+	/*
+	 * It's impossible to be taking action on the NULL probe.
+	 */
+	ASSERT(probe != NULL);
+
+	/*
+	 * This is a poor man's (destitute man's?) sprintf():  we want to
+	 * print the provider name, module name, function name and name of
+	 * the probe, along with the hex address of the ECB with the breakpoint
+	 * action -- all of which we must place in the character buffer by
+	 * hand.
+	 */
+	while (*msg != '\0')
+		c[i++] = *msg++;
+
+	for (str = prov->dtpv_name; *str != '\0'; str++)
+		c[i++] = *str;
+	c[i++] = ':';
+
+	for (str = probe->dtpr_mod; *str != '\0'; str++)
+		c[i++] = *str;
+	c[i++] = ':';
+
+	for (str = probe->dtpr_func; *str != '\0'; str++)
+		c[i++] = *str;
+	c[i++] = ':';
+
+	for (str = probe->dtpr_name; *str != '\0'; str++)
+		c[i++] = *str;
+
+	while (*ecbmsg != '\0')
+		c[i++] = *ecbmsg++;
+
+	while (shift >= 0) {
+		mask = (uintptr_t)0xf << shift;
+
+		if (val >= ((uintptr_t)1 << shift))
+			c[i++] = "0123456789abcdef"[(val & mask) >> shift];
+		shift -= 4;
+	}
+
+	c[i++] = ')';
+	c[i] = '\0';
+
+	debug_enter(c);
+}
+
+static void
+dtrace_action_panic(dtrace_ecb_t *ecb)
+{
+	dtrace_probe_t *probe = ecb->dte_probe;
+
+	/*
+	 * It's impossible to be taking action on the NULL probe.
+	 */
+	ASSERT(probe != NULL);
+
+	if (dtrace_destructive_disallow)
+		return;
+
+	if (dtrace_panicked != NULL)
+		return;
+
+	if (dtrace_casptr(&dtrace_panicked, NULL, curthread) != NULL)
+		return;
+
+	/*
+	 * We won the right to panic.  (We want to be sure that only one
+	 * thread calls panic() from dtrace_probe(), and that panic() is
+	 * called exactly once.)
+	 */
+	dtrace_panic("dtrace: panic action at probe %s:%s:%s:%s (ecb %p)",
+	    probe->dtpr_provider->dtpv_name, probe->dtpr_mod,
+	    probe->dtpr_func, probe->dtpr_name, (void *)ecb);
+}
+
+static void
+dtrace_action_raise(uint64_t sig)
+{
+	if (dtrace_destructive_disallow)
+		return;
+
+	if (sig >= NSIG) {
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+		return;
+	}
+
+	/*
+	 * raise() has a queue depth of 1 -- we ignore all subsequent
+	 * invocations of the raise() action.
+	 */
+	if (curthread->t_dtrace_sig == 0)
+		curthread->t_dtrace_sig = (uint8_t)sig;
+
+	curthread->t_sig_check = 1;
+	aston(curthread);
+}
+
+static void
+dtrace_action_stop(void)
+{
+	if (dtrace_destructive_disallow)
+		return;
+
+	if (!curthread->t_dtrace_stop) {
+		curthread->t_dtrace_stop = 1;
+		curthread->t_sig_check = 1;
+		aston(curthread);
+	}
+}
+
+static void
+dtrace_action_chill(dtrace_mstate_t *mstate, hrtime_t val)
+{
+	hrtime_t now;
+	volatile uint16_t *flags;
+	cpu_t *cpu = CPU;
+
+	if (dtrace_destructive_disallow)
+		return;
+
+	flags = (volatile uint16_t *)&cpu_core[cpu->cpu_id].cpuc_dtrace_flags;
+
+	now = dtrace_gethrtime();
+
+	if (now - cpu->cpu_dtrace_chillmark > dtrace_chill_interval) {
+		/*
+		 * We need to advance the mark to the current time.
+		 */
+		cpu->cpu_dtrace_chillmark = now;
+		cpu->cpu_dtrace_chilled = 0;
+	}
+
+	/*
+	 * Now check to see if the requested chill time would take us over
+	 * the maximum amount of time allowed in the chill interval.  (Or
+	 * worse, if the calculation itself induces overflow.)
+	 */
+	if (cpu->cpu_dtrace_chilled + val > dtrace_chill_max ||
+	    cpu->cpu_dtrace_chilled + val < cpu->cpu_dtrace_chilled) {
+		*flags |= CPU_DTRACE_ILLOP;
+		return;
+	}
+
+	while (dtrace_gethrtime() - now < val)
+		continue;
+
+	/*
+	 * Normally, we assure that the value of the variable "timestamp" does
+	 * not change within an ECB.  The presence of chill() represents an
+	 * exception to this rule, however.
+	 */
+	mstate->dtms_present &= ~DTRACE_MSTATE_TIMESTAMP;
+	cpu->cpu_dtrace_chilled += val;
+}
+
+#endif /* !VBOX */
+
+static void
+dtrace_action_ustack(dtrace_mstate_t *mstate, dtrace_state_t *state,
+    uint64_t *buf, uint64_t arg)
+{
+	int nframes = DTRACE_USTACK_NFRAMES(arg);
+	int strsize = DTRACE_USTACK_STRSIZE(arg);
+	uint64_t *pcs = &buf[1], *fps;
+	char *str = (char *)&pcs[nframes];
+	int size, offs = 0, i, j;
+	uintptr_t old = mstate->dtms_scratch_ptr, saved;
+#ifndef VBOX
+	uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+#else
+	uint16_t volatile *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+#endif
+	char *sym;
+
+	/*
+	 * Should be taking a faster path if string space has not been
+	 * allocated.
+	 */
+	ASSERT(strsize != 0);
+
+	/*
+	 * We will first allocate some temporary space for the frame pointers.
+	 */
+	fps = (uint64_t *)P2ROUNDUP(mstate->dtms_scratch_ptr, 8);
+	size = (uintptr_t)fps - mstate->dtms_scratch_ptr +
+	    (nframes * sizeof (uint64_t));
+
+	if (!DTRACE_INSCRATCH(mstate, VBDTCAST(unsigned)size)) {
+		/*
+		 * Not enough room for our frame pointers -- need to indicate
+		 * that we ran out of scratch space.
+		 */
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOSCRATCH);
+		return;
+	}
+
+	mstate->dtms_scratch_ptr += size;
+	saved = mstate->dtms_scratch_ptr;
+
+	/*
+	 * Now get a stack with both program counters and frame pointers.
+	 */
+	DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+	dtrace_getufpstack(buf, fps, nframes + 1);
+	DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+
+	/*
+	 * If that faulted, we're cooked.
+	 */
+	if (*flags & CPU_DTRACE_FAULT)
+		goto out;
+
+	/*
+	 * Now we want to walk up the stack, calling the USTACK helper.  For
+	 * each iteration, we restore the scratch pointer.
+	 */
+	for (i = 0; i < nframes; i++) {
+		mstate->dtms_scratch_ptr = saved;
+
+		if (offs >= strsize)
+			break;
+
+#ifndef VBOX
+		sym = (char *)(uintptr_t)dtrace_helper(
+		    DTRACE_HELPER_ACTION_USTACK,
+		    mstate, state, pcs[i], fps[i]);
+#else
+		sym = NULL;
+#endif
+
+		/*
+		 * If we faulted while running the helper, we're going to
+		 * clear the fault and null out the corresponding string.
+		 */
+		if (*flags & CPU_DTRACE_FAULT) {
+			*flags &= ~CPU_DTRACE_FAULT;
+			str[offs++] = '\0';
+			continue;
+		}
+
+		if (sym == NULL) {
+			str[offs++] = '\0';
+			continue;
+		}
+
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+
+		/*
+		 * Now copy in the string that the helper returned to us.
+		 */
+		for (j = 0; offs + j < strsize; j++) {
+			if ((str[offs + j] = sym[j]) == '\0')
+				break;
+		}
+
+		DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+
+		offs += j + 1;
+	}
+
+	if (offs >= strsize) {
+		/*
+		 * If we didn't have room for all of the strings, we don't
+		 * abort processing -- this needn't be a fatal error -- but we
+		 * still want to increment a counter (dts_stkstroverflows) to
+		 * allow this condition to be warned about.  (If this is from
+		 * a jstack() action, it is easily tuned via jstackstrsize.)
+		 */
+		dtrace_error(&state->dts_stkstroverflows);
+	}
+
+	while (offs < strsize)
+		str[offs++] = '\0';
+
+out:
+	mstate->dtms_scratch_ptr = old;
+}
+
+#ifdef VBOX
+extern void dtrace_probe6(dtrace_id_t, uintptr_t arg0, uintptr_t arg1,
+						  uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5);
+# define dtrace_probe_error(a1, a2, a3, a4, a5, a6) \
+	dtrace_probe6(dtrace_probeid_error, (uintptr_t)a1, a2, a3, a4, a5, a6)
+#endif
+
+/*
+ * If you're looking for the epicenter of DTrace, you just found it.  This
+ * is the function called by the provider to fire a probe -- from which all
+ * subsequent probe-context DTrace activity emanates.
+ */
+void
+dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1,
+    uintptr_t arg2, uintptr_t arg3, uintptr_t arg4)
+{
+	processorid_t cpuid;
+	dtrace_icookie_t cookie;
+	dtrace_probe_t *probe;
+	dtrace_mstate_t mstate;
+	dtrace_ecb_t *ecb;
+	dtrace_action_t *act;
+	intptr_t offs;
+	size_t size;
+	int vtime, onintr;
+	volatile uint16_t *flags;
+	hrtime_t now;
+
+#ifndef VBOX
+	/*
+	 * Kick out immediately if this CPU is still being born (in which case
+	 * curthread will be set to -1) or the current thread can't allow
+	 * probes in its current context.
+	 */
+	if (((uintptr_t)curthread & 1) || (curthread->t_flag & T_DONTDTRACE))
+		return;
+#endif
+
+	cookie = dtrace_interrupt_disable();
+	probe = dtrace_probes[id - 1];
+	cpuid = VBDT_GET_CPUID();
+	onintr = CPU_ON_INTR(CPU);
+
+	if (!onintr && probe->dtpr_predcache != DTRACE_CACHEIDNONE &&
+	    probe->dtpr_predcache == curthread->t_predcache) {
+		/*
+		 * We have hit in the predicate cache; we know that
+		 * this predicate would evaluate to be false.
+		 */
+		dtrace_interrupt_enable(cookie);
+		return;
+	}
+
+#ifndef VBOX
+	if (panic_quiesce) {
+		/*
+		 * We don't trace anything if we're panicking.
+		 */
+		dtrace_interrupt_enable(cookie);
+		return;
+	}
+#endif
+
+	now = dtrace_gethrtime();
+	vtime = dtrace_vtime_references != 0;
+
+	if (vtime && curthread->t_dtrace_start)
+		curthread->t_dtrace_vtime += now - curthread->t_dtrace_start;
+
+	mstate.dtms_difo = NULL;
+	mstate.dtms_probe = probe;
+	mstate.dtms_strtok = NULL;
+	mstate.dtms_arg[0] = arg0;
+	mstate.dtms_arg[1] = arg1;
+	mstate.dtms_arg[2] = arg2;
+	mstate.dtms_arg[3] = arg3;
+	mstate.dtms_arg[4] = arg4;
+
+	flags = (volatile uint16_t *)&cpu_core[cpuid].cpuc_dtrace_flags;
+
+	for (ecb = probe->dtpr_ecb; ecb != NULL; ecb = ecb->dte_next) {
+		dtrace_predicate_t *pred = ecb->dte_predicate;
+		dtrace_state_t *state = ecb->dte_state;
+		dtrace_buffer_t *buf = &state->dts_buffer[cpuid];
+		dtrace_buffer_t *aggbuf = &state->dts_aggbuffer[cpuid];
+		dtrace_vstate_t *vstate = &state->dts_vstate;
+		dtrace_provider_t *prov = probe->dtpr_provider;
+		int committed = 0;
+		caddr_t tomax;
+
+		/*
+		 * A little subtlety with the following (seemingly innocuous)
+		 * declaration of the automatic 'val':  by looking at the
+		 * code, you might think that it could be declared in the
+		 * action processing loop, below.  (That is, it's only used in
+		 * the action processing loop.)  However, it must be declared
+		 * out of that scope because in the case of DIF expression
+		 * arguments to aggregating actions, one iteration of the
+		 * action loop will use the last iteration's value.
+		 */
+#ifdef lint
+		uint64_t val = 0;
+#else
+		uint64_t val VBDTUNASS(0);
+#endif
+
+		mstate.dtms_present = DTRACE_MSTATE_ARGS | DTRACE_MSTATE_PROBE;
+		*flags &= ~CPU_DTRACE_ERROR;
+
+		if (prov == dtrace_provider) {
+			/*
+			 * If dtrace itself is the provider of this probe,
+			 * we're only going to continue processing the ECB if
+			 * arg0 (the dtrace_state_t) is equal to the ECB's
+			 * creating state.  (This prevents disjoint consumers
+			 * from seeing one another's metaprobes.)
+			 */
+			if (arg0 != (uint64_t)(uintptr_t)state)
+				continue;
+		}
+
+		if (state->dts_activity != DTRACE_ACTIVITY_ACTIVE) {
+			/*
+			 * We're not currently active.  If our provider isn't
+			 * the dtrace pseudo provider, we're not interested.
+			 */
+			if (prov != dtrace_provider)
+				continue;
+
+			/*
+			 * Now we must further check if we are in the BEGIN
+			 * probe.  If we are, we will only continue processing
+			 * if we're still in WARMUP -- if one BEGIN enabling
+			 * has invoked the exit() action, we don't want to
+			 * evaluate subsequent BEGIN enablings.
+			 */
+			if (probe->dtpr_id == dtrace_probeid_begin &&
+			    state->dts_activity != DTRACE_ACTIVITY_WARMUP) {
+				ASSERT(state->dts_activity ==
+				    DTRACE_ACTIVITY_DRAINING);
+				continue;
+			}
+		}
+
+		if (ecb->dte_cond) {
+			/*
+			 * If the dte_cond bits indicate that this
+			 * consumer is only allowed to see user-mode firings
+			 * of this probe, call the provider's dtps_usermode()
+			 * entry point to check that the probe was fired
+			 * while in a user context. Skip this ECB if that's
+			 * not the case.
+			 */
+			if ((ecb->dte_cond & DTRACE_COND_USERMODE) &&
+			    prov->dtpv_pops.dtps_usermode(prov->dtpv_arg,
+			    probe->dtpr_id, probe->dtpr_arg) == 0)
+				continue;
+
+			/*
+			 * This is more subtle than it looks. We have to be
+			 * absolutely certain that CRED() isn't going to
+			 * change out from under us so it's only legit to
+			 * examine that structure if we're in constrained
+			 * situations. Currently, the only times we'll this
+			 * check is if a non-super-user has enabled the
+			 * profile or syscall providers -- providers that
+			 * allow visibility of all processes. For the
+			 * profile case, the check above will ensure that
+			 * we're examining a user context.
+			 */
+			if (ecb->dte_cond & DTRACE_COND_OWNER) {
+				cred_t *cr;
+				cred_t *s_cr =
+				    ecb->dte_state->dts_cred.dcr_cred;
+#ifndef VBOX
+				proc_t *proc;
+#endif
+
+				ASSERT(s_cr != NULL);
+
+				if ((cr = CRED()) == NULL ||
+				    s_cr->cr_uid != cr->cr_uid ||
+				    s_cr->cr_uid != cr->cr_ruid ||
+				    s_cr->cr_uid != cr->cr_suid ||
+				    s_cr->cr_gid != cr->cr_gid ||
+				    s_cr->cr_gid != cr->cr_rgid ||
+				    s_cr->cr_gid != cr->cr_sgid ||
+#ifndef VBOX
+				    (proc = VBDT_GET_PROC()) == NULL ||
+				    (proc->p_flag & SNOCD))
+#else
+				    0)
+
+#endif
+					continue;
+			}
+
+#ifndef VBOX
+			if (ecb->dte_cond & DTRACE_COND_ZONEOWNER) {
+				cred_t *cr;
+				cred_t *s_cr =
+				    ecb->dte_state->dts_cred.dcr_cred;
+
+				ASSERT(s_cr != NULL);
+
+				if ((cr = CRED()) == NULL ||
+				    s_cr->cr_zone->zone_id !=
+				    cr->cr_zone->zone_id)
+					continue;
+			}
+#endif
+		}
+
+		if (now - state->dts_alive > dtrace_deadman_timeout) {
+			/*
+			 * We seem to be dead.  Unless we (a) have kernel
+			 * destructive permissions (b) have expicitly enabled
+			 * destructive actions and (c) destructive actions have
+			 * not been disabled, we're going to transition into
+			 * the KILLED state, from which no further processing
+			 * on this state will be performed.
+			 */
+			if (!dtrace_priv_kernel_destructive(state) ||
+			    !state->dts_cred.dcr_destructive ||
+			    dtrace_destructive_disallow) {
+				void *activity = &state->dts_activity;
+				dtrace_activity_t current;
+
+				do {
+					current = state->dts_activity;
+				} while (dtrace_cas32(activity, current,
+				    DTRACE_ACTIVITY_KILLED) != current);
+
+				continue;
+			}
+		}
+
+		if ((offs = dtrace_buffer_reserve(buf, ecb->dte_needed,
+		    ecb->dte_alignment, state, &mstate)) < 0)
+			continue;
+
+		tomax = buf->dtb_tomax;
+		ASSERT(tomax != NULL);
+
+		if (ecb->dte_size != 0)
+			DTRACE_STORE(uint32_t, tomax, offs, ecb->dte_epid);
+
+		mstate.dtms_epid = ecb->dte_epid;
+		mstate.dtms_present |= DTRACE_MSTATE_EPID;
+
+		if (state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL)
+			mstate.dtms_access = DTRACE_ACCESS_KERNEL;
+		else
+			mstate.dtms_access = 0;
+
+		if (pred != NULL) {
+			dtrace_difo_t *dp = pred->dtp_difo;
+			int rval;
+
+			rval = dtrace_dif_emulate(dp, &mstate, vstate, state);
+
+			if (!(*flags & CPU_DTRACE_ERROR) && !rval) {
+				dtrace_cacheid_t cid = probe->dtpr_predcache;
+
+				if (cid != DTRACE_CACHEIDNONE && !onintr) {
+					/*
+					 * Update the predicate cache...
+					 */
+					ASSERT(cid == pred->dtp_cacheid);
+					curthread->t_predcache = cid;
+				}
+
+				continue;
+			}
+		}
+
+		for (act = ecb->dte_action; !(*flags & CPU_DTRACE_ERROR) &&
+		    act != NULL; act = act->dta_next) {
+			size_t valoffs;
+			dtrace_difo_t *dp;
+			dtrace_recdesc_t *rec = &act->dta_rec;
+
+			size = rec->dtrd_size;
+			valoffs = offs + rec->dtrd_offset;
+
+			if (DTRACEACT_ISAGG(act->dta_kind)) {
+				uint64_t v = 0xbad;
+				dtrace_aggregation_t *agg;
+
+				agg = (dtrace_aggregation_t *)act;
+
+				if ((dp = act->dta_difo) != NULL)
+					v = dtrace_dif_emulate(dp,
+					    &mstate, vstate, state);
+
+				if (*flags & CPU_DTRACE_ERROR)
+					continue;
+
+				/*
+				 * Note that we always pass the expression
+				 * value from the previous iteration of the
+				 * action loop.  This value will only be used
+				 * if there is an expression argument to the
+				 * aggregating action, denoted by the
+				 * dtag_hasarg field.
+				 */
+				dtrace_aggregate(agg, buf,
+				    offs, aggbuf, v, val);
+				continue;
+			}
+
+			switch (act->dta_kind) {
+			case DTRACEACT_STOP:
+#ifndef VBOX
+				if (dtrace_priv_proc_destructive(state))
+					dtrace_action_stop();
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+				continue;
+
+			case DTRACEACT_BREAKPOINT:
+#ifndef VBOX
+				if (dtrace_priv_kernel_destructive(state))
+					dtrace_action_breakpoint(ecb);
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+				continue;
+
+			case DTRACEACT_PANIC:
+#ifndef VBOX
+				if (dtrace_priv_kernel_destructive(state))
+					dtrace_action_panic(ecb);
+#endif
+				continue;
+
+			case DTRACEACT_STACK:
+				if (!dtrace_priv_kernel(state))
+					continue;
+
+				dtrace_getpcstack((pc_t *)(tomax + valoffs),
+				    VBDTCAST(int)(size / sizeof (pc_t)), probe->dtpr_aframes,
+				    DTRACE_ANCHORED(probe) ? NULL :
+				    (uint32_t *)arg0);
+
+				continue;
+
+			case DTRACEACT_JSTACK:
+			case DTRACEACT_USTACK:
+				if (!dtrace_priv_proc(state))
+					continue;
+
+				/*
+				 * See comment in DIF_VAR_PID.
+				 */
+				if (DTRACE_ANCHORED(mstate.dtms_probe) &&
+				    CPU_ON_INTR(CPU)) {
+					int depth = DTRACE_USTACK_NFRAMES(
+					    rec->dtrd_arg) + 1;
+
+					dtrace_bzero((void *)(tomax + valoffs),
+					    DTRACE_USTACK_STRSIZE(rec->dtrd_arg)
+					    + depth * sizeof (uint64_t));
+
+					continue;
+				}
+
+#ifndef VBOX /* no helpers */
+				if (DTRACE_USTACK_STRSIZE(rec->dtrd_arg) != 0 &&
+				    curproc->p_dtrace_helpers != NULL) {
+					/*
+					 * This is the slow path -- we have
+					 * allocated string space, and we're
+					 * getting the stack of a process that
+					 * has helpers.  Call into a separate
+					 * routine to perform this processing.
+					 */
+					dtrace_action_ustack(&mstate, state,
+					    (uint64_t *)(tomax + valoffs),
+					    rec->dtrd_arg);
+					continue;
+				}
+#endif
+
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+				dtrace_getupcstack((uint64_t *)
+				    (tomax + valoffs),
+				    DTRACE_USTACK_NFRAMES(rec->dtrd_arg) + 1);
+				DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+				continue;
+
+			default:
+				break;
+			}
+
+			dp = act->dta_difo;
+			ASSERT(dp != NULL);
+
+			val = dtrace_dif_emulate(dp, &mstate, vstate, state);
+
+			if (*flags & CPU_DTRACE_ERROR)
+				continue;
+
+			switch (act->dta_kind) {
+			case DTRACEACT_SPECULATE:
+				ASSERT(buf == &state->dts_buffer[cpuid]);
+				buf = dtrace_speculation_buffer(state,
+				    cpuid, val);
+
+				if (buf == NULL) {
+					*flags |= CPU_DTRACE_DROP;
+					continue;
+				}
+
+				offs = dtrace_buffer_reserve(buf,
+				    ecb->dte_needed, ecb->dte_alignment,
+				    state, NULL);
+
+				if (offs < 0) {
+					*flags |= CPU_DTRACE_DROP;
+					continue;
+				}
+
+				tomax = buf->dtb_tomax;
+				ASSERT(tomax != NULL);
+
+				if (ecb->dte_size != 0)
+					DTRACE_STORE(uint32_t, tomax, offs,
+					    ecb->dte_epid);
+				continue;
+
+			case DTRACEACT_CHILL:
+#ifndef VBOX
+				if (dtrace_priv_kernel_destructive(state))
+					dtrace_action_chill(&mstate, val);
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+				continue;
+
+			case DTRACEACT_RAISE:
+#ifndef VBOX
+				if (dtrace_priv_proc_destructive(state))
+					dtrace_action_raise(val);
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
+				continue;
+
+			case DTRACEACT_COMMIT:
+				ASSERT(!committed);
+
+				/*
+				 * We need to commit our buffer state.
+				 */
+				if (ecb->dte_size)
+					buf->dtb_offset = offs + ecb->dte_size;
+				buf = &state->dts_buffer[cpuid];
+				dtrace_speculation_commit(state, cpuid, val);
+				committed = 1;
+				continue;
+
+			case DTRACEACT_DISCARD:
+				dtrace_speculation_discard(state, cpuid, val);
+				continue;
+
+			case DTRACEACT_DIFEXPR:
+			case DTRACEACT_LIBACT:
+			case DTRACEACT_PRINTF:
+			case DTRACEACT_PRINTA:
+			case DTRACEACT_SYSTEM:
+			case DTRACEACT_FREOPEN:
+				break;
+
+			case DTRACEACT_SYM:
+			case DTRACEACT_MOD:
+				if (!dtrace_priv_kernel(state))
+					continue;
+				break;
+
+			case DTRACEACT_USYM:
+			case DTRACEACT_UMOD:
+			case DTRACEACT_UADDR: {
+#ifndef VBOX
+				struct pid *pid = curthread->t_procp->p_pidp;
+
+				if (!dtrace_priv_proc(state))
+					continue;
+
+				DTRACE_STORE(uint64_t, tomax,
+				    valoffs, (uint64_t)pid->pid_id);
+				DTRACE_STORE(uint64_t, tomax,
+				    valoffs + sizeof (uint64_t), val);
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_UPRIV);
+#endif
+				continue;
+			}
+
+			case DTRACEACT_EXIT: {
+				/*
+				 * For the exit action, we are going to attempt
+				 * to atomically set our activity to be
+				 * draining.  If this fails (either because
+				 * another CPU has beat us to the exit action,
+				 * or because our current activity is something
+				 * other than ACTIVE or WARMUP), we will
+				 * continue.  This assures that the exit action
+				 * can be successfully recorded at most once
+				 * when we're in the ACTIVE state.  If we're
+				 * encountering the exit() action while in
+				 * COOLDOWN, however, we want to honor the new
+				 * status code.  (We know that we're the only
+				 * thread in COOLDOWN, so there is no race.)
+				 */
+				void *activity = &state->dts_activity;
+				dtrace_activity_t current = state->dts_activity;
+
+				if (current == DTRACE_ACTIVITY_COOLDOWN)
+					break;
+
+				if (current != DTRACE_ACTIVITY_WARMUP)
+					current = DTRACE_ACTIVITY_ACTIVE;
+
+				if (dtrace_cas32(activity, current,
+				    DTRACE_ACTIVITY_DRAINING) != current) {
+					*flags |= CPU_DTRACE_DROP;
+					continue;
+				}
+
+				break;
+			}
+
+			default:
+#ifndef VBOX
+				ASSERT(0);
+#else
+				AssertFatalMsgFailed(("%d\n", act->dta_kind));
+#endif
+			}
+
+			if (dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF) {
+				uintptr_t end = valoffs + size;
+
+				if (!dtrace_vcanload((void *)(uintptr_t)val,
+				    &dp->dtdo_rtype, &mstate, vstate))
+					continue;
+
+				/*
+				 * If this is a string, we're going to only
+				 * load until we find the zero byte -- after
+				 * which we'll store zero bytes.
+				 */
+				if (dp->dtdo_rtype.dtdt_kind ==
+				    DIF_TYPE_STRING) {
+					char c = '\0' + 1;
+					int intuple = act->dta_intuple;
+					size_t s;
+
+					for (s = 0; s < size; s++) {
+						if (c != '\0')
+							c = dtrace_load8(val++);
+
+						DTRACE_STORE(uint8_t, tomax,
+						    valoffs++, c);
+
+						if (c == '\0' && intuple)
+							break;
+					}
+
+					continue;
+				}
+
+				while (valoffs < end) {
+					DTRACE_STORE(uint8_t, tomax, valoffs++,
+					    dtrace_load8(val++));
+				}
+
+				continue;
+			}
+
+			switch (size) {
+			case 0:
+				break;
+
+			case sizeof (uint8_t):
+				DTRACE_STORE(uint8_t, tomax, valoffs, val);
+				break;
+			case sizeof (uint16_t):
+				DTRACE_STORE(uint16_t, tomax, valoffs, val);
+				break;
+			case sizeof (uint32_t):
+				DTRACE_STORE(uint32_t, tomax, valoffs, val);
+				break;
+			case sizeof (uint64_t):
+				DTRACE_STORE(uint64_t, tomax, valoffs, val);
+				break;
+			default:
+				/*
+				 * Any other size should have been returned by
+				 * reference, not by value.
+				 */
+#ifndef VBOX
+				ASSERT(0);
+#else
+				AssertFatalMsgFailed(("%zu\n", size));
+#endif
+				break;
+			}
+		}
+
+		if (*flags & CPU_DTRACE_DROP)
+			continue;
+
+		if (*flags & CPU_DTRACE_FAULT) {
+			int ndx;
+			dtrace_action_t *err;
+
+			buf->dtb_errors++;
+
+			if (probe->dtpr_id == dtrace_probeid_error) {
+				/*
+				 * There's nothing we can do -- we had an
+				 * error on the error probe.  We bump an
+				 * error counter to at least indicate that
+				 * this condition happened.
+				 */
+				dtrace_error(&state->dts_dblerrors);
+				continue;
+			}
+
+			if (vtime) {
+				/*
+				 * Before recursing on dtrace_probe(), we
+				 * need to explicitly clear out our start
+				 * time to prevent it from being accumulated
+				 * into t_dtrace_vtime.
+				 */
+				curthread->t_dtrace_start = 0;
+			}
+
+			/*
+			 * Iterate over the actions to figure out which action
+			 * we were processing when we experienced the error.
+			 * Note that act points _past_ the faulting action; if
+			 * act is ecb->dte_action, the fault was in the
+			 * predicate, if it's ecb->dte_action->dta_next it's
+			 * in action #1, and so on.
+			 */
+			for (err = ecb->dte_action, ndx = 0;
+			    err != act; err = err->dta_next, ndx++)
+				continue;
+
+			dtrace_probe_error(state, ecb->dte_epid, ndx,
+			    (mstate.dtms_present & DTRACE_MSTATE_FLTOFFS) ?
+			    mstate.dtms_fltoffs : -1, DTRACE_FLAGS2FLT(*flags),
+			    cpu_core[cpuid].cpuc_dtrace_illval);
+
+			continue;
+		}
+
+		if (!committed)
+			buf->dtb_offset = offs + ecb->dte_size;
+	}
+
+	if (vtime)
+		curthread->t_dtrace_start = dtrace_gethrtime();
+
+	dtrace_interrupt_enable(cookie);
+}
+
+/*
+ * DTrace Probe Hashing Functions
+ *
+ * The functions in this section (and indeed, the functions in remaining
+ * sections) are not _called_ from probe context.  (Any exceptions to this are
+ * marked with a "Note:".)  Rather, they are called from elsewhere in the
+ * DTrace framework to look-up probes in, add probes to and remove probes from
+ * the DTrace probe hashes.  (Each probe is hashed by each element of the
+ * probe tuple -- allowing for fast lookups, regardless of what was
+ * specified.)
+ */
+static uint_t
+dtrace_hash_str(char *p)
+{
+	unsigned int g;
+	uint_t hval = 0;
+
+	while (*p) {
+		hval = (hval << 4) + *p++;
+		if ((g = (hval & 0xf0000000)) != 0)
+			hval ^= g >> 24;
+		hval &= ~g;
+	}
+	return (hval);
+}
+
+static dtrace_hash_t *
+dtrace_hash_create(uintptr_t stroffs, uintptr_t nextoffs, uintptr_t prevoffs)
+{
+	dtrace_hash_t *hash = kmem_zalloc(sizeof (dtrace_hash_t), KM_SLEEP);
+
+	hash->dth_stroffs = stroffs;
+	hash->dth_nextoffs = nextoffs;
+	hash->dth_prevoffs = prevoffs;
+
+	hash->dth_size = 1;
+	hash->dth_mask = hash->dth_size - 1;
+
+	hash->dth_tab = kmem_zalloc(hash->dth_size *
+	    sizeof (dtrace_hashbucket_t *), KM_SLEEP);
+
+	return (hash);
+}
+
+static void
+dtrace_hash_destroy(dtrace_hash_t *hash)
+{
+#ifdef DEBUG
+	int i;
+
+	for (i = 0; i < hash->dth_size; i++)
+		ASSERT(hash->dth_tab[i] == NULL);
+#endif
+
+	kmem_free(hash->dth_tab,
+	    hash->dth_size * sizeof (dtrace_hashbucket_t *));
+	kmem_free(hash, sizeof (dtrace_hash_t));
+}
+
+static void
+dtrace_hash_resize(dtrace_hash_t *hash)
+{
+	int size = hash->dth_size, i, ndx;
+	int new_size = hash->dth_size << 1;
+	int new_mask = new_size - 1;
+	dtrace_hashbucket_t **new_tab, *bucket, *next;
+
+	ASSERT((new_size & new_mask) == 0);
+
+	new_tab = kmem_zalloc(new_size * sizeof (void *), KM_SLEEP);
+
+	for (i = 0; i < size; i++) {
+		for (bucket = hash->dth_tab[i]; bucket != NULL; bucket = next) {
+			dtrace_probe_t *probe = bucket->dthb_chain;
+
+			ASSERT(probe != NULL);
+			ndx = DTRACE_HASHSTR(hash, probe) & new_mask;
+
+			next = bucket->dthb_next;
+			bucket->dthb_next = new_tab[ndx];
+			new_tab[ndx] = bucket;
+		}
+	}
+
+	kmem_free(hash->dth_tab, hash->dth_size * sizeof (void *));
+	hash->dth_tab = new_tab;
+	hash->dth_size = new_size;
+	hash->dth_mask = new_mask;
+}
+
+static void
+dtrace_hash_add(dtrace_hash_t *hash, dtrace_probe_t *new)
+{
+	int hashval = DTRACE_HASHSTR(hash, new);
+	int ndx = hashval & hash->dth_mask;
+	dtrace_hashbucket_t *bucket = hash->dth_tab[ndx];
+	dtrace_probe_t **nextp, **prevp;
+
+	for (; bucket != NULL; bucket = bucket->dthb_next) {
+		if (DTRACE_HASHEQ(hash, bucket->dthb_chain, new))
+			goto add;
+	}
+
+	if ((hash->dth_nbuckets >> 1) > hash->dth_size) {
+		dtrace_hash_resize(hash);
+		dtrace_hash_add(hash, new);
+		return;
+	}
+
+	bucket = kmem_zalloc(sizeof (dtrace_hashbucket_t), KM_SLEEP);
+	bucket->dthb_next = hash->dth_tab[ndx];
+	hash->dth_tab[ndx] = bucket;
+	hash->dth_nbuckets++;
+
+add:
+	nextp = DTRACE_HASHNEXT(hash, new);
+	ASSERT(*nextp == NULL && *(DTRACE_HASHPREV(hash, new)) == NULL);
+	*nextp = bucket->dthb_chain;
+
+	if (bucket->dthb_chain != NULL) {
+		prevp = DTRACE_HASHPREV(hash, bucket->dthb_chain);
+		ASSERT(*prevp == NULL);
+		*prevp = new;
+	}
+
+	bucket->dthb_chain = new;
+	bucket->dthb_len++;
+}
+
+static dtrace_probe_t *
+dtrace_hash_lookup(dtrace_hash_t *hash, dtrace_probe_t *template)
+{
+	int hashval = DTRACE_HASHSTR(hash, template);
+	int ndx = hashval & hash->dth_mask;
+	dtrace_hashbucket_t *bucket = hash->dth_tab[ndx];
+
+	for (; bucket != NULL; bucket = bucket->dthb_next) {
+		if (DTRACE_HASHEQ(hash, bucket->dthb_chain, template))
+			return (bucket->dthb_chain);
+	}
+
+	return (NULL);
+}
+
+static int
+dtrace_hash_collisions(dtrace_hash_t *hash, dtrace_probe_t *template)
+{
+	int hashval = DTRACE_HASHSTR(hash, template);
+	int ndx = hashval & hash->dth_mask;
+	dtrace_hashbucket_t *bucket = hash->dth_tab[ndx];
+
+	for (; bucket != NULL; bucket = bucket->dthb_next) {
+		if (DTRACE_HASHEQ(hash, bucket->dthb_chain, template))
+			return (bucket->dthb_len);
+	}
+
+	return (NULL);
+}
+
+static void
+dtrace_hash_remove(dtrace_hash_t *hash, dtrace_probe_t *probe)
+{
+	int ndx = DTRACE_HASHSTR(hash, probe) & hash->dth_mask;
+	dtrace_hashbucket_t *bucket = hash->dth_tab[ndx];
+
+	dtrace_probe_t **prevp = DTRACE_HASHPREV(hash, probe);
+	dtrace_probe_t **nextp = DTRACE_HASHNEXT(hash, probe);
+
+	/*
+	 * Find the bucket that we're removing this probe from.
+	 */
+	for (; bucket != NULL; bucket = bucket->dthb_next) {
+		if (DTRACE_HASHEQ(hash, bucket->dthb_chain, probe))
+			break;
+	}
+
+	ASSERT(bucket != NULL);
+
+	if (*prevp == NULL) {
+		if (*nextp == NULL) {
+			/*
+			 * The removed probe was the only probe on this
+			 * bucket; we need to remove the bucket.
+			 */
+			dtrace_hashbucket_t *b = hash->dth_tab[ndx];
+
+			ASSERT(bucket->dthb_chain == probe);
+			ASSERT(b != NULL);
+
+			if (b == bucket) {
+				hash->dth_tab[ndx] = bucket->dthb_next;
+			} else {
+				while (b->dthb_next != bucket)
+					b = b->dthb_next;
+				b->dthb_next = bucket->dthb_next;
+			}
+
+			ASSERT(hash->dth_nbuckets > 0);
+			hash->dth_nbuckets--;
+			kmem_free(bucket, sizeof (dtrace_hashbucket_t));
+			return;
+		}
+
+		bucket->dthb_chain = *nextp;
+	} else {
+		*(DTRACE_HASHNEXT(hash, *prevp)) = *nextp;
+	}
+
+	if (*nextp != NULL)
+		*(DTRACE_HASHPREV(hash, *nextp)) = *prevp;
+}
+
+/*
+ * DTrace Utility Functions
+ *
+ * These are random utility functions that are _not_ called from probe context.
+ */
+static int
+dtrace_badattr(const dtrace_attribute_t *a)
+{
+	return (a->dtat_name > DTRACE_STABILITY_MAX ||
+	    a->dtat_data > DTRACE_STABILITY_MAX ||
+	    a->dtat_class > DTRACE_CLASS_MAX);
+}
+
+/*
+ * Return a duplicate copy of a string.  If the specified string is NULL,
+ * this function returns a zero-length string.
+ */
+static char *
+dtrace_strdup(const char *str)
+{
+	char *new = kmem_zalloc((str != NULL ? strlen(str) : 0) + 1, KM_SLEEP);
+
+	if (str != NULL)
+		(void) strcpy(new, str);
+
+	return (new);
+}
+
+#define	DTRACE_ISALPHA(c)	\
+	(((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z'))
+
+static int
+dtrace_badname(const char *s)
+{
+	char c;
+
+	if (s == NULL || (c = *s++) == '\0')
+		return (0);
+
+	if (!DTRACE_ISALPHA(c) && c != '-' && c != '_' && c != '.')
+		return (1);
+
+	while ((c = *s++) != '\0') {
+		if (!DTRACE_ISALPHA(c) && (c < '0' || c > '9') &&
+		    c != '-' && c != '_' && c != '.' && c != '`')
+			return (1);
+	}
+
+	return (0);
+}
+
+static void
+dtrace_cred2priv(cred_t *cr, uint32_t *privp, uid_t *uidp, zoneid_t *zoneidp)
+{
+	uint32_t priv;
+
+	if (cr == NULL || PRIV_POLICY_ONLY(cr, PRIV_ALL, B_FALSE)) {
+		/*
+		 * For DTRACE_PRIV_ALL, the uid and zoneid don't matter.
+		 */
+		priv = DTRACE_PRIV_ALL;
+#ifdef VBOX
+		*uidp = ~0;
+		*zoneidp = 0;
+#endif
+	} else {
+		*uidp = crgetuid(cr);
+		*zoneidp = crgetzoneid(cr);
+
+		priv = 0;
+		if (PRIV_POLICY_ONLY(cr, PRIV_DTRACE_KERNEL, B_FALSE))
+			priv |= DTRACE_PRIV_KERNEL | DTRACE_PRIV_USER;
+		else if (PRIV_POLICY_ONLY(cr, PRIV_DTRACE_USER, B_FALSE))
+			priv |= DTRACE_PRIV_USER;
+		if (PRIV_POLICY_ONLY(cr, PRIV_DTRACE_PROC, B_FALSE))
+			priv |= DTRACE_PRIV_PROC;
+		if (PRIV_POLICY_ONLY(cr, PRIV_PROC_OWNER, B_FALSE))
+			priv |= DTRACE_PRIV_OWNER;
+		if (PRIV_POLICY_ONLY(cr, PRIV_PROC_ZONE, B_FALSE))
+			priv |= DTRACE_PRIV_ZONEOWNER;
+	}
+
+	*privp = priv;
+}
+
+#ifdef DTRACE_ERRDEBUG
+static void
+dtrace_errdebug(const char *str)
+{
+	int hval = dtrace_hash_str((char *)str) % DTRACE_ERRHASHSZ;
+	int occupied = 0;
+
+	mutex_enter(&dtrace_errlock);
+	dtrace_errlast = str;
+	dtrace_errthread = curthread;
+
+	while (occupied++ < DTRACE_ERRHASHSZ) {
+		if (dtrace_errhash[hval].dter_msg == str) {
+			dtrace_errhash[hval].dter_count++;
+			goto out;
+		}
+
+		if (dtrace_errhash[hval].dter_msg != NULL) {
+			hval = (hval + 1) % DTRACE_ERRHASHSZ;
+			continue;
+		}
+
+		dtrace_errhash[hval].dter_msg = str;
+		dtrace_errhash[hval].dter_count = 1;
+		goto out;
+	}
+
+	panic("dtrace: undersized error hash");
+out:
+	mutex_exit(&dtrace_errlock);
+}
+#endif
+
+/*
+ * DTrace Matching Functions
+ *
+ * These functions are used to match groups of probes, given some elements of
+ * a probe tuple, or some globbed expressions for elements of a probe tuple.
+ */
+static int
+dtrace_match_priv(const dtrace_probe_t *prp, uint32_t priv, uid_t uid,
+    zoneid_t zoneid)
+{
+	if (priv != DTRACE_PRIV_ALL) {
+		uint32_t ppriv = prp->dtpr_provider->dtpv_priv.dtpp_flags;
+		uint32_t match = priv & ppriv;
+
+		/*
+		 * No PRIV_DTRACE_* privileges...
+		 */
+		if ((priv & (DTRACE_PRIV_PROC | DTRACE_PRIV_USER |
+		    DTRACE_PRIV_KERNEL)) == 0)
+			return (0);
+
+		/*
+		 * No matching bits, but there were bits to match...
+		 */
+		if (match == 0 && ppriv != 0)
+			return (0);
+
+		/*
+		 * Need to have permissions to the process, but don't...
+		 */
+		if (((ppriv & ~match) & DTRACE_PRIV_OWNER) != 0 &&
+		    uid != prp->dtpr_provider->dtpv_priv.dtpp_uid) {
+			return (0);
+		}
+
+		/*
+		 * Need to be in the same zone unless we possess the
+		 * privilege to examine all zones.
+		 */
+		if (((ppriv & ~match) & DTRACE_PRIV_ZONEOWNER) != 0 &&
+		    zoneid != prp->dtpr_provider->dtpv_priv.dtpp_zoneid) {
+			return (0);
+		}
+	}
+
+	return (1);
+}
+
+/*
+ * dtrace_match_probe compares a dtrace_probe_t to a pre-compiled key, which
+ * consists of input pattern strings and an ops-vector to evaluate them.
+ * This function returns >0 for match, 0 for no match, and <0 for error.
+ */
+static int
+dtrace_match_probe(const dtrace_probe_t *prp, const dtrace_probekey_t *pkp,
+    uint32_t priv, uid_t uid, zoneid_t zoneid)
+{
+	dtrace_provider_t *pvp = prp->dtpr_provider;
+	int rv;
+
+	if (pvp->dtpv_defunct)
+		return (0);
+
+	if ((rv = pkp->dtpk_pmatch(pvp->dtpv_name, pkp->dtpk_prov, 0)) <= 0)
+		return (rv);
+
+	if ((rv = pkp->dtpk_mmatch(prp->dtpr_mod, pkp->dtpk_mod, 0)) <= 0)
+		return (rv);
+
+	if ((rv = pkp->dtpk_fmatch(prp->dtpr_func, pkp->dtpk_func, 0)) <= 0)
+		return (rv);
+
+	if ((rv = pkp->dtpk_nmatch(prp->dtpr_name, pkp->dtpk_name, 0)) <= 0)
+		return (rv);
+
+	if (dtrace_match_priv(prp, priv, uid, zoneid) == 0)
+		return (0);
+
+	return (rv);
+}
+
+/*
+ * dtrace_match_glob() is a safe kernel implementation of the gmatch(3GEN)
+ * interface for matching a glob pattern 'p' to an input string 's'.  Unlike
+ * libc's version, the kernel version only applies to 8-bit ASCII strings.
+ * In addition, all of the recursion cases except for '*' matching have been
+ * unwound.  For '*', we still implement recursive evaluation, but a depth
+ * counter is maintained and matching is aborted if we recurse too deep.
+ * The function returns 0 if no match, >0 if match, and <0 if recursion error.
+ */
+static int
+dtrace_match_glob(const char *s, const char *p, int depth)
+{
+	const char *olds;
+	char s1, c;
+	int gs;
+
+	if (depth > DTRACE_PROBEKEY_MAXDEPTH)
+		return (-1);
+
+	if (s == NULL)
+		s = ""; /* treat NULL as empty string */
+
+top:
+	olds = s;
+	s1 = *s++;
+
+	if (p == NULL)
+		return (0);
+
+	if ((c = *p++) == '\0')
+		return (s1 == '\0');
+
+	switch (c) {
+	case '[': {
+		int ok = 0, notflag = 0;
+		char lc = '\0';
+
+		if (s1 == '\0')
+			return (0);
+
+		if (*p == '!') {
+			notflag = 1;
+			p++;
+		}
+
+		if ((c = *p++) == '\0')
+			return (0);
+
+		do {
+			if (c == '-' && lc != '\0' && *p != ']') {
+				if ((c = *p++) == '\0')
+					return (0);
+				if (c == '\\' && (c = *p++) == '\0')
+					return (0);
+
+				if (notflag) {
+					if (s1 < lc || s1 > c)
+						ok++;
+					else
+						return (0);
+				} else if (lc <= s1 && s1 <= c)
+					ok++;
+
+			} else if (c == '\\' && (c = *p++) == '\0')
+				return (0);
+
+			lc = c; /* save left-hand 'c' for next iteration */
+
+			if (notflag) {
+				if (s1 != c)
+					ok++;
+				else
+					return (0);
+			} else if (s1 == c)
+				ok++;
+
+			if ((c = *p++) == '\0')
+				return (0);
+
+		} while (c != ']');
+
+		if (ok)
+			goto top;
+
+		return (0);
+	}
+
+	case '\\':
+		if ((c = *p++) == '\0')
+			return (0);
+		/*FALLTHRU*/
+
+	default:
+		if (c != s1)
+			return (0);
+		/*FALLTHRU*/
+
+	case '?':
+		if (s1 != '\0')
+			goto top;
+		return (0);
+
+	case '*':
+		while (*p == '*')
+			p++; /* consecutive *'s are identical to a single one */
+
+		if (*p == '\0')
+			return (1);
+
+		for (s = olds; *s != '\0'; s++) {
+			if ((gs = dtrace_match_glob(s, p, depth + 1)) != 0)
+				return (gs);
+		}
+
+		return (0);
+	}
+}
+
+/*ARGSUSED*/
+static int
+dtrace_match_string(const char *s, const char *p, int depth)
+{
+	return (s != NULL && strcmp(s, p) == 0);
+}
+
+/*ARGSUSED*/
+static int
+dtrace_match_nul(const char *s, const char *p, int depth)
+{
+	return (1); /* always match the empty pattern */
+}
+
+/*ARGSUSED*/
+static int
+dtrace_match_nonzero(const char *s, const char *p, int depth)
+{
+	return (s != NULL && s[0] != '\0');
+}
+
+static int
+dtrace_match(const dtrace_probekey_t *pkp, uint32_t priv, uid_t uid,
+    zoneid_t zoneid, int (*matched)(dtrace_probe_t *, void *), void *arg)
+{
+	dtrace_probe_t template, *probe;
+	dtrace_hash_t *hash = NULL;
+	int len, rc, best = INT_MAX, nmatched = 0;
+	dtrace_id_t i;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	/*
+	 * If the probe ID is specified in the key, just lookup by ID and
+	 * invoke the match callback once if a matching probe is found.
+	 */
+	if (pkp->dtpk_id != DTRACE_IDNONE) {
+		if ((probe = dtrace_probe_lookup_id(pkp->dtpk_id)) != NULL &&
+		    dtrace_match_probe(probe, pkp, priv, uid, zoneid) > 0) {
+			if ((*matched)(probe, arg) == DTRACE_MATCH_FAIL)
+				return (DTRACE_MATCH_FAIL);
+			nmatched++;
+		}
+		return (nmatched);
+	}
+
+	template.dtpr_mod = (char *)pkp->dtpk_mod;
+	template.dtpr_func = (char *)pkp->dtpk_func;
+	template.dtpr_name = (char *)pkp->dtpk_name;
+
+	/*
+	 * We want to find the most distinct of the module name, function
+	 * name, and name.  So for each one that is not a glob pattern or
+	 * empty string, we perform a lookup in the corresponding hash and
+	 * use the hash table with the fewest collisions to do our search.
+	 */
+	if (pkp->dtpk_mmatch == &dtrace_match_string &&
+	    (len = dtrace_hash_collisions(dtrace_bymod, &template)) < best) {
+		best = len;
+		hash = dtrace_bymod;
+	}
+
+	if (pkp->dtpk_fmatch == &dtrace_match_string &&
+	    (len = dtrace_hash_collisions(dtrace_byfunc, &template)) < best) {
+		best = len;
+		hash = dtrace_byfunc;
+	}
+
+	if (pkp->dtpk_nmatch == &dtrace_match_string &&
+	    (len = dtrace_hash_collisions(dtrace_byname, &template)) < best) {
+		best = len;
+		hash = dtrace_byname;
+	}
+
+	/*
+	 * If we did not select a hash table, iterate over every probe and
+	 * invoke our callback for each one that matches our input probe key.
+	 */
+	if (hash == NULL) {
+		for (i = 0; i < VBDTCAST(dtrace_id_t)dtrace_nprobes; i++) {
+			if ((probe = dtrace_probes[i]) == NULL ||
+			    dtrace_match_probe(probe, pkp, priv, uid,
+			    zoneid) <= 0)
+				continue;
+
+			nmatched++;
+
+			if ((rc = (*matched)(probe, arg)) !=
+			    DTRACE_MATCH_NEXT) {
+				if (rc == DTRACE_MATCH_FAIL)
+					return (DTRACE_MATCH_FAIL);
+				break;
+			}
+		}
+
+		return (nmatched);
+	}
+
+	/*
+	 * If we selected a hash table, iterate over each probe of the same key
+	 * name and invoke the callback for every probe that matches the other
+	 * attributes of our input probe key.
+	 */
+	for (probe = dtrace_hash_lookup(hash, &template); probe != NULL;
+	    probe = *(DTRACE_HASHNEXT(hash, probe))) {
+
+		if (dtrace_match_probe(probe, pkp, priv, uid, zoneid) <= 0)
+			continue;
+
+		nmatched++;
+
+		if ((rc = (*matched)(probe, arg)) != DTRACE_MATCH_NEXT) {
+			if (rc == DTRACE_MATCH_FAIL)
+				return (DTRACE_MATCH_FAIL);
+			break;
+		}
+	}
+
+	return (nmatched);
+}
+
+/*
+ * Return the function pointer dtrace_probecmp() should use to compare the
+ * specified pattern with a string.  For NULL or empty patterns, we select
+ * dtrace_match_nul().  For glob pattern strings, we use dtrace_match_glob().
+ * For non-empty non-glob strings, we use dtrace_match_string().
+ */
+static dtrace_probekey_f *
+dtrace_probekey_func(const char *p)
+{
+	char c;
+
+	if (p == NULL || *p == '\0')
+		return (&dtrace_match_nul);
+
+	while ((c = *p++) != '\0') {
+		if (c == '[' || c == '?' || c == '*' || c == '\\')
+			return (&dtrace_match_glob);
+	}
+
+	return (&dtrace_match_string);
+}
+
+/*
+ * Build a probe comparison key for use with dtrace_match_probe() from the
+ * given probe description.  By convention, a null key only matches anchored
+ * probes: if each field is the empty string, reset dtpk_fmatch to
+ * dtrace_match_nonzero().
+ */
+static void
+dtrace_probekey(const dtrace_probedesc_t *pdp, dtrace_probekey_t *pkp)
+{
+	pkp->dtpk_prov = pdp->dtpd_provider;
+	pkp->dtpk_pmatch = dtrace_probekey_func(pdp->dtpd_provider);
+
+	pkp->dtpk_mod = pdp->dtpd_mod;
+	pkp->dtpk_mmatch = dtrace_probekey_func(pdp->dtpd_mod);
+
+	pkp->dtpk_func = pdp->dtpd_func;
+	pkp->dtpk_fmatch = dtrace_probekey_func(pdp->dtpd_func);
+
+	pkp->dtpk_name = pdp->dtpd_name;
+	pkp->dtpk_nmatch = dtrace_probekey_func(pdp->dtpd_name);
+
+	pkp->dtpk_id = pdp->dtpd_id;
+
+	if (pkp->dtpk_id == DTRACE_IDNONE &&
+	    pkp->dtpk_pmatch == &dtrace_match_nul &&
+	    pkp->dtpk_mmatch == &dtrace_match_nul &&
+	    pkp->dtpk_fmatch == &dtrace_match_nul &&
+	    pkp->dtpk_nmatch == &dtrace_match_nul)
+		pkp->dtpk_fmatch = &dtrace_match_nonzero;
+}
+
+/*
+ * DTrace Provider-to-Framework API Functions
+ *
+ * These functions implement much of the Provider-to-Framework API, as
+ * described in <sys/dtrace.h>.  The parts of the API not in this section are
+ * the functions in the API for probe management (found below), and
+ * dtrace_probe() itself (found above).
+ */
+
+/*
+ * Register the calling provider with the DTrace framework.  This should
+ * generally be called by DTrace providers in their attach(9E) entry point.
+ */
+int
+dtrace_register(const char *name, const dtrace_pattr_t *pap, uint32_t priv,
+    cred_t *cr, const dtrace_pops_t *pops, void *arg, dtrace_provider_id_t *idp)
+{
+	dtrace_provider_t *provider;
+
+	if (name == NULL || pap == NULL || pops == NULL || idp == NULL) {
+		cmn_err(CE_WARN, "failed to register provider '%s': invalid "
+		    "arguments", name ? name : "<NULL>");
+		return (EINVAL);
+	}
+
+	if (name[0] == '\0' || dtrace_badname(name)) {
+		cmn_err(CE_WARN, "failed to register provider '%s': invalid "
+		    "provider name", name);
+		return (EINVAL);
+	}
+
+	if ((pops->dtps_provide == NULL && pops->dtps_provide_module == NULL) ||
+	    pops->dtps_enable == NULL || pops->dtps_disable == NULL ||
+	    pops->dtps_destroy == NULL ||
+	    ((pops->dtps_resume == NULL) != (pops->dtps_suspend == NULL))) {
+		cmn_err(CE_WARN, "failed to register provider '%s': invalid "
+		    "provider ops", name);
+		return (EINVAL);
+	}
+
+	if (dtrace_badattr(&pap->dtpa_provider) ||
+	    dtrace_badattr(&pap->dtpa_mod) ||
+	    dtrace_badattr(&pap->dtpa_func) ||
+	    dtrace_badattr(&pap->dtpa_name) ||
+	    dtrace_badattr(&pap->dtpa_args)) {
+		cmn_err(CE_WARN, "failed to register provider '%s': invalid "
+		    "provider attributes", name);
+		return (EINVAL);
+	}
+
+	if (priv & ~DTRACE_PRIV_ALL) {
+		cmn_err(CE_WARN, "failed to register provider '%s': invalid "
+		    "privilege attributes", name);
+		return (EINVAL);
+	}
+
+	if ((priv & DTRACE_PRIV_KERNEL) &&
+	    (priv & (DTRACE_PRIV_USER | DTRACE_PRIV_OWNER)) &&
+	    pops->dtps_usermode == NULL) {
+		cmn_err(CE_WARN, "failed to register provider '%s': need "
+		    "dtps_usermode() op for given privilege attributes", name);
+		return (EINVAL);
+	}
+
+	provider = kmem_zalloc(sizeof (dtrace_provider_t), KM_SLEEP);
+	provider->dtpv_name = kmem_alloc(strlen(name) + 1, KM_SLEEP);
+	(void) strcpy(provider->dtpv_name, name);
+
+	provider->dtpv_attr = *pap;
+	provider->dtpv_priv.dtpp_flags = priv;
+	if (cr != NULL) {
+		provider->dtpv_priv.dtpp_uid = crgetuid(cr);
+		provider->dtpv_priv.dtpp_zoneid = crgetzoneid(cr);
+	}
+	provider->dtpv_pops = *pops;
+
+	if (pops->dtps_provide == NULL) {
+		ASSERT(pops->dtps_provide_module != NULL);
+		provider->dtpv_pops.dtps_provide =
+		    (void (*)(void *, const dtrace_probedesc_t *))dtrace_nullop;
+	}
+
+	if (pops->dtps_provide_module == NULL) {
+		ASSERT(pops->dtps_provide != NULL);
+		provider->dtpv_pops.dtps_provide_module =
+		    (void (*)(void *, struct modctl *))dtrace_nullop;
+	}
+
+	if (pops->dtps_suspend == NULL) {
+		ASSERT(pops->dtps_resume == NULL);
+		provider->dtpv_pops.dtps_suspend =
+		    (void (*)(void *, dtrace_id_t, void *))dtrace_nullop;
+		provider->dtpv_pops.dtps_resume =
+		    (void (*)(void *, dtrace_id_t, void *))dtrace_nullop;
+	}
+
+	provider->dtpv_arg = arg;
+	*idp = (dtrace_provider_id_t)provider;
+
+	if (pops == &dtrace_provider_ops) {
+		ASSERT(MUTEX_HELD(&dtrace_provider_lock));
+		ASSERT(MUTEX_HELD(&dtrace_lock));
+		ASSERT(dtrace_anon.dta_enabling == NULL);
+
+		/*
+		 * We make sure that the DTrace provider is at the head of
+		 * the provider chain.
+		 */
+		provider->dtpv_next = dtrace_provider;
+		dtrace_provider = provider;
+		return (0);
+	}
+
+	mutex_enter(&dtrace_provider_lock);
+	mutex_enter(&dtrace_lock);
+
+	/*
+	 * If there is at least one provider registered, we'll add this
+	 * provider after the first provider.
+	 */
+	if (dtrace_provider != NULL) {
+		provider->dtpv_next = dtrace_provider->dtpv_next;
+		dtrace_provider->dtpv_next = provider;
+	} else {
+		dtrace_provider = provider;
+	}
+
+	if (dtrace_retained != NULL) {
+		dtrace_enabling_provide(provider);
+
+		/*
+		 * Now we need to call dtrace_enabling_matchall() -- which
+		 * will acquire cpu_lock and dtrace_lock.  We therefore need
+		 * to drop all of our locks before calling into it...
+		 */
+		mutex_exit(&dtrace_lock);
+		mutex_exit(&dtrace_provider_lock);
+		dtrace_enabling_matchall();
+
+		return (0);
+	}
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&dtrace_provider_lock);
+
+	return (0);
+}
+
+/*
+ * Unregister the specified provider from the DTrace framework.  This should
+ * generally be called by DTrace providers in their detach(9E) entry point.
+ */
+int
+dtrace_unregister(dtrace_provider_id_t id)
+{
+	dtrace_provider_t *old = (dtrace_provider_t *)id;
+	dtrace_provider_t *prev = NULL;
+	VBDTTYPE(uint32_t,int) i, self = 0;
+	dtrace_probe_t *probe, *first = NULL;
+
+	if (old->dtpv_pops.dtps_enable ==
+	    (int (*)(void *, dtrace_id_t, void *))dtrace_enable_nullop) {
+		/*
+		 * If DTrace itself is the provider, we're called with locks
+		 * already held.
+		 */
+		ASSERT(old == dtrace_provider);
+#ifndef VBOX
+		ASSERT(dtrace_devi != NULL);
+#endif
+		ASSERT(MUTEX_HELD(&dtrace_provider_lock));
+		ASSERT(MUTEX_HELD(&dtrace_lock));
+		self = 1;
+
+		if (dtrace_provider->dtpv_next != NULL) {
+			/*
+			 * There's another provider here; return failure.
+			 */
+			return (EBUSY);
+		}
+	} else {
+		mutex_enter(&dtrace_provider_lock);
+		mutex_enter(&mod_lock);
+		mutex_enter(&dtrace_lock);
+	}
+
+	/*
+	 * If anyone has /dev/dtrace open, or if there are anonymous enabled
+	 * probes, we refuse to let providers slither away, unless this
+	 * provider has already been explicitly invalidated.
+	 */
+	if (!old->dtpv_defunct &&
+	    (dtrace_opens || (dtrace_anon.dta_state != NULL &&
+	    dtrace_anon.dta_state->dts_necbs > 0))) {
+		if (!self) {
+			mutex_exit(&dtrace_lock);
+			mutex_exit(&mod_lock);
+			mutex_exit(&dtrace_provider_lock);
+		}
+		return (EBUSY);
+	}
+
+	/*
+	 * Attempt to destroy the probes associated with this provider.
+	 */
+	for (i = 0; i < dtrace_nprobes; i++) {
+		if ((probe = dtrace_probes[i]) == NULL)
+			continue;
+
+		if (probe->dtpr_provider != old)
+			continue;
+
+		if (probe->dtpr_ecb == NULL)
+			continue;
+
+		/*
+		 * We have at least one ECB; we can't remove this provider.
+		 */
+		if (!self) {
+			mutex_exit(&dtrace_lock);
+			mutex_exit(&mod_lock);
+			mutex_exit(&dtrace_provider_lock);
+		}
+		return (EBUSY);
+	}
+
+	/*
+	 * All of the probes for this provider are disabled; we can safely
+	 * remove all of them from their hash chains and from the probe array.
+	 */
+	for (i = 0; i < dtrace_nprobes; i++) {
+		if ((probe = dtrace_probes[i]) == NULL)
+			continue;
+
+		if (probe->dtpr_provider != old)
+			continue;
+
+		dtrace_probes[i] = NULL;
+
+		dtrace_hash_remove(dtrace_bymod, probe);
+		dtrace_hash_remove(dtrace_byfunc, probe);
+		dtrace_hash_remove(dtrace_byname, probe);
+
+		if (first == NULL) {
+			first = probe;
+			probe->dtpr_nextmod = NULL;
+		} else {
+			probe->dtpr_nextmod = first;
+			first = probe;
+		}
+	}
+
+	/*
+	 * The provider's probes have been removed from the hash chains and
+	 * from the probe array.  Now issue a dtrace_sync() to be sure that
+	 * everyone has cleared out from any probe array processing.
+	 */
+	dtrace_sync();
+
+	for (probe = first; probe != NULL; probe = first) {
+		first = probe->dtpr_nextmod;
+
+		old->dtpv_pops.dtps_destroy(old->dtpv_arg, probe->dtpr_id,
+		    probe->dtpr_arg);
+		kmem_free(probe->dtpr_mod, strlen(probe->dtpr_mod) + 1);
+		kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1);
+		kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1);
+		vmem_free(dtrace_arena, (void *)(uintptr_t)(probe->dtpr_id), 1);
+		kmem_free(probe, sizeof (dtrace_probe_t));
+	}
+
+	if ((prev = dtrace_provider) == old) {
+#ifndef VBOX
+		ASSERT(self || dtrace_devi == NULL);
+		ASSERT(old->dtpv_next == NULL || dtrace_devi == NULL);
+#endif
+		dtrace_provider = old->dtpv_next;
+	} else {
+		while (prev != NULL && prev->dtpv_next != old)
+			prev = prev->dtpv_next;
+
+		if (prev == NULL) {
+			panic("attempt to unregister non-existent "
+			    "dtrace provider %p\n", (void *)id);
+		}
+
+		prev->dtpv_next = old->dtpv_next;
+	}
+
+	if (!self) {
+		mutex_exit(&dtrace_lock);
+		mutex_exit(&mod_lock);
+		mutex_exit(&dtrace_provider_lock);
+	}
+
+	kmem_free(old->dtpv_name, strlen(old->dtpv_name) + 1);
+	kmem_free(old, sizeof (dtrace_provider_t));
+
+	return (0);
+}
+
+/*
+ * Invalidate the specified provider.  All subsequent probe lookups for the
+ * specified provider will fail, but its probes will not be removed.
+ */
+void
+dtrace_invalidate(dtrace_provider_id_t id)
+{
+	dtrace_provider_t *pvp = (dtrace_provider_t *)id;
+
+	ASSERT(pvp->dtpv_pops.dtps_enable !=
+	    (int (*)(void *, dtrace_id_t, void *))dtrace_enable_nullop);
+
+	mutex_enter(&dtrace_provider_lock);
+	mutex_enter(&dtrace_lock);
+
+	pvp->dtpv_defunct = 1;
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&dtrace_provider_lock);
+}
+
+/*
+ * Indicate whether or not DTrace has attached.
+ */
+int
+dtrace_attached(void)
+{
+	/*
+	 * dtrace_provider will be non-NULL iff the DTrace driver has
+	 * attached.  (It's non-NULL because DTrace is always itself a
+	 * provider.)
+	 */
+	return (dtrace_provider != NULL);
+}
+
+/*
+ * Remove all the unenabled probes for the given provider.  This function is
+ * not unlike dtrace_unregister(), except that it doesn't remove the provider
+ * -- just as many of its associated probes as it can.
+ */
+int
+dtrace_condense(dtrace_provider_id_t id)
+{
+	dtrace_provider_t *prov = (dtrace_provider_t *)id;
+	VBDTTYPE(uint32_t,int) i;
+	dtrace_probe_t *probe;
+
+	/*
+	 * Make sure this isn't the dtrace provider itself.
+	 */
+	ASSERT(prov->dtpv_pops.dtps_enable !=
+	    (int (*)(void *, dtrace_id_t, void *))dtrace_enable_nullop);
+
+	mutex_enter(&dtrace_provider_lock);
+	mutex_enter(&dtrace_lock);
+
+	/*
+	 * Attempt to destroy the probes associated with this provider.
+	 */
+	for (i = 0; i < dtrace_nprobes; i++) {
+		if ((probe = dtrace_probes[i]) == NULL)
+			continue;
+
+		if (probe->dtpr_provider != prov)
+			continue;
+
+		if (probe->dtpr_ecb != NULL)
+			continue;
+
+		dtrace_probes[i] = NULL;
+
+		dtrace_hash_remove(dtrace_bymod, probe);
+		dtrace_hash_remove(dtrace_byfunc, probe);
+		dtrace_hash_remove(dtrace_byname, probe);
+
+		prov->dtpv_pops.dtps_destroy(prov->dtpv_arg, i + 1,
+		    probe->dtpr_arg);
+		kmem_free(probe->dtpr_mod, strlen(probe->dtpr_mod) + 1);
+		kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1);
+		kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1);
+		kmem_free(probe, sizeof (dtrace_probe_t));
+		vmem_free(dtrace_arena, (void *)((uintptr_t)i + 1), 1);
+	}
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&dtrace_provider_lock);
+
+	return (0);
+}
+
+/*
+ * DTrace Probe Management Functions
+ *
+ * The functions in this section perform the DTrace probe management,
+ * including functions to create probes, look-up probes, and call into the
+ * providers to request that probes be provided.  Some of these functions are
+ * in the Provider-to-Framework API; these functions can be identified by the
+ * fact that they are not declared "static".
+ */
+
+/*
+ * Create a probe with the specified module name, function name, and name.
+ */
+dtrace_id_t
+dtrace_probe_create(dtrace_provider_id_t prov, const char *mod,
+    const char *func, const char *name, int aframes, void *arg)
+{
+	dtrace_probe_t *probe, **probes;
+	dtrace_provider_t *provider = (dtrace_provider_t *)prov;
+	dtrace_id_t id;
+
+	if (provider == dtrace_provider) {
+		ASSERT(MUTEX_HELD(&dtrace_lock));
+	} else {
+		mutex_enter(&dtrace_lock);
+	}
+
+	id = (dtrace_id_t)(uintptr_t)vmem_alloc(dtrace_arena, 1,
+	    VM_BESTFIT | VM_SLEEP);
+	probe = kmem_zalloc(sizeof (dtrace_probe_t), KM_SLEEP);
+
+	probe->dtpr_id = id;
+	probe->dtpr_gen = dtrace_probegen++;
+	probe->dtpr_mod = dtrace_strdup(mod);
+	probe->dtpr_func = dtrace_strdup(func);
+	probe->dtpr_name = dtrace_strdup(name);
+	probe->dtpr_arg = arg;
+	probe->dtpr_aframes = aframes;
+	probe->dtpr_provider = provider;
+
+	dtrace_hash_add(dtrace_bymod, probe);
+	dtrace_hash_add(dtrace_byfunc, probe);
+	dtrace_hash_add(dtrace_byname, probe);
+
+	if (id - 1 >= dtrace_nprobes) {
+		size_t osize = dtrace_nprobes * sizeof (dtrace_probe_t *);
+		size_t nsize = osize << 1;
+
+		if (nsize == 0) {
+			ASSERT(osize == 0);
+			ASSERT(dtrace_probes == NULL);
+			nsize = sizeof (dtrace_probe_t *);
+		}
+
+		probes = kmem_zalloc(nsize, KM_SLEEP);
+
+		if (dtrace_probes == NULL) {
+			ASSERT(osize == 0);
+			dtrace_probes = probes;
+			dtrace_nprobes = 1;
+		} else {
+			dtrace_probe_t **oprobes = dtrace_probes;
+
+			bcopy(oprobes, probes, osize);
+			dtrace_membar_producer();
+			dtrace_probes = probes;
+
+			dtrace_sync();
+
+			/*
+			 * All CPUs are now seeing the new probes array; we can
+			 * safely free the old array.
+			 */
+			kmem_free(oprobes, osize);
+			dtrace_nprobes <<= 1;
+		}
+
+		ASSERT(id - 1 < dtrace_nprobes);
+	}
+
+	ASSERT(dtrace_probes[id - 1] == NULL);
+	dtrace_probes[id - 1] = probe;
+
+	if (provider != dtrace_provider)
+		mutex_exit(&dtrace_lock);
+
+	return (id);
+}
+
+static dtrace_probe_t *
+dtrace_probe_lookup_id(dtrace_id_t id)
+{
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (id == 0 || id > dtrace_nprobes)
+		return (NULL);
+
+	return (dtrace_probes[id - 1]);
+}
+
+static int
+dtrace_probe_lookup_match(dtrace_probe_t *probe, void *arg)
+{
+	*((dtrace_id_t *)arg) = probe->dtpr_id;
+
+	return (DTRACE_MATCH_DONE);
+}
+
+/*
+ * Look up a probe based on provider and one or more of module name, function
+ * name and probe name.
+ */
+dtrace_id_t
+dtrace_probe_lookup(dtrace_provider_id_t prid, const char *mod,
+    const char *func, const char *name)
+{
+	dtrace_probekey_t pkey;
+	dtrace_id_t id;
+	int match;
+
+	pkey.dtpk_prov = ((dtrace_provider_t *)prid)->dtpv_name;
+	pkey.dtpk_pmatch = &dtrace_match_string;
+	pkey.dtpk_mod = mod;
+	pkey.dtpk_mmatch = mod ? &dtrace_match_string : &dtrace_match_nul;
+	pkey.dtpk_func = func;
+	pkey.dtpk_fmatch = func ? &dtrace_match_string : &dtrace_match_nul;
+	pkey.dtpk_name = name;
+	pkey.dtpk_nmatch = name ? &dtrace_match_string : &dtrace_match_nul;
+	pkey.dtpk_id = DTRACE_IDNONE;
+
+	mutex_enter(&dtrace_lock);
+	match = dtrace_match(&pkey, DTRACE_PRIV_ALL, 0, 0,
+	    dtrace_probe_lookup_match, &id);
+	mutex_exit(&dtrace_lock);
+
+	ASSERT(match == 1 || match == 0);
+	return (match ? id : 0);
+}
+
+/*
+ * Returns the probe argument associated with the specified probe.
+ */
+void *
+dtrace_probe_arg(dtrace_provider_id_t id, dtrace_id_t pid)
+{
+	dtrace_probe_t *probe;
+	void *rval = NULL;
+
+	mutex_enter(&dtrace_lock);
+
+	if ((probe = dtrace_probe_lookup_id(pid)) != NULL &&
+	    probe->dtpr_provider == (dtrace_provider_t *)id)
+		rval = probe->dtpr_arg;
+
+	mutex_exit(&dtrace_lock);
+
+	return (rval);
+}
+
+/*
+ * Copy a probe into a probe description.
+ */
+static void
+dtrace_probe_description(const dtrace_probe_t *prp, dtrace_probedesc_t *pdp)
+{
+	bzero(pdp, sizeof (dtrace_probedesc_t));
+	pdp->dtpd_id = prp->dtpr_id;
+
+	(void) strncpy(pdp->dtpd_provider,
+	    prp->dtpr_provider->dtpv_name, DTRACE_PROVNAMELEN - 1);
+
+	(void) strncpy(pdp->dtpd_mod, prp->dtpr_mod, DTRACE_MODNAMELEN - 1);
+	(void) strncpy(pdp->dtpd_func, prp->dtpr_func, DTRACE_FUNCNAMELEN - 1);
+	(void) strncpy(pdp->dtpd_name, prp->dtpr_name, DTRACE_NAMELEN - 1);
+}
+
+/*
+ * Called to indicate that a probe -- or probes -- should be provided by a
+ * specfied provider.  If the specified description is NULL, the provider will
+ * be told to provide all of its probes.  (This is done whenever a new
+ * consumer comes along, or whenever a retained enabling is to be matched.) If
+ * the specified description is non-NULL, the provider is given the
+ * opportunity to dynamically provide the specified probe, allowing providers
+ * to support the creation of probes on-the-fly.  (So-called _autocreated_
+ * probes.)  If the provider is NULL, the operations will be applied to all
+ * providers; if the provider is non-NULL the operations will only be applied
+ * to the specified provider.  The dtrace_provider_lock must be held, and the
+ * dtrace_lock must _not_ be held -- the provider's dtps_provide() operation
+ * will need to grab the dtrace_lock when it reenters the framework through
+ * dtrace_probe_lookup(), dtrace_probe_create(), etc.
+ */
+static void
+dtrace_probe_provide(dtrace_probedesc_t *desc, dtrace_provider_t *prv)
+{
+#ifndef VBOX
+	struct modctl *ctl;
+#endif
+	int all = 0;
+
+	ASSERT(MUTEX_HELD(&dtrace_provider_lock));
+
+	if (prv == NULL) {
+		all = 1;
+		prv = dtrace_provider;
+	}
+
+	do {
+		/*
+		 * First, call the blanket provide operation.
+		 */
+		prv->dtpv_pops.dtps_provide(prv->dtpv_arg, desc);
+
+#ifndef VBOX
+		/*
+		 * Now call the per-module provide operation.  We will grab
+		 * mod_lock to prevent the list from being modified.  Note
+		 * that this also prevents the mod_busy bits from changing.
+		 * (mod_busy can only be changed with mod_lock held.)
+		 */
+		mutex_enter(&mod_lock);
+
+		ctl = &modules;
+		do {
+			if (ctl->mod_busy || ctl->mod_mp == NULL)
+				continue;
+
+			prv->dtpv_pops.dtps_provide_module(prv->dtpv_arg, ctl);
+
+		} while ((ctl = ctl->mod_next) != &modules);
+
+		mutex_exit(&mod_lock);
+#endif
+	} while (all && (prv = prv->dtpv_next) != NULL);
+}
+
+/*
+ * Iterate over each probe, and call the Framework-to-Provider API function
+ * denoted by offs.
+ */
+static void
+dtrace_probe_foreach(uintptr_t offs)
+{
+	dtrace_provider_t *prov;
+	void (*func)(void *, dtrace_id_t, void *);
+	dtrace_probe_t *probe;
+	dtrace_icookie_t cookie;
+	VBDTTYPE(uint32_t,int) i;
+
+	/*
+	 * We disable interrupts to walk through the probe array.  This is
+	 * safe -- the dtrace_sync() in dtrace_unregister() assures that we
+	 * won't see stale data.
+	 */
+	cookie = dtrace_interrupt_disable();
+
+	for (i = 0; i < dtrace_nprobes; i++) {
+		if ((probe = dtrace_probes[i]) == NULL)
+			continue;
+
+		if (probe->dtpr_ecb == NULL) {
+			/*
+			 * This probe isn't enabled -- don't call the function.
+			 */
+			continue;
+		}
+
+		prov = probe->dtpr_provider;
+		func = *((void(**)(void *, dtrace_id_t, void *))
+		    ((uintptr_t)&prov->dtpv_pops + offs));
+
+		func(prov->dtpv_arg, i + 1, probe->dtpr_arg);
+	}
+
+	dtrace_interrupt_enable(cookie);
+}
+
+static int
+dtrace_probe_enable(const dtrace_probedesc_t *desc, dtrace_enabling_t *enab)
+{
+	dtrace_probekey_t pkey;
+	uint32_t priv;
+	uid_t uid;
+	zoneid_t zoneid;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	dtrace_ecb_create_cache = NULL;
+
+	if (desc == NULL) {
+		/*
+		 * If we're passed a NULL description, we're being asked to
+		 * create an ECB with a NULL probe.
+		 */
+		(void) dtrace_ecb_create_enable(NULL, enab);
+		return (0);
+	}
+
+	dtrace_probekey(desc, &pkey);
+	dtrace_cred2priv(enab->dten_vstate->dtvs_state->dts_cred.dcr_cred,
+	    &priv, &uid, &zoneid);
+
+	return (dtrace_match(&pkey, priv, uid, zoneid, dtrace_ecb_create_enable,
+	    enab));
+}
+
+/*
+ * DTrace Helper Provider Functions
+ */
+static void
+dtrace_dofattr2attr(dtrace_attribute_t *attr, const dof_attr_t dofattr)
+{
+	attr->dtat_name = DOF_ATTR_NAME(dofattr);
+	attr->dtat_data = DOF_ATTR_DATA(dofattr);
+	attr->dtat_class = DOF_ATTR_CLASS(dofattr);
+}
+
+static void
+dtrace_dofprov2hprov(dtrace_helper_provdesc_t *hprov,
+    const dof_provider_t *dofprov, char *strtab)
+{
+	hprov->dthpv_provname = strtab + dofprov->dofpv_name;
+	dtrace_dofattr2attr(&hprov->dthpv_pattr.dtpa_provider,
+	    dofprov->dofpv_provattr);
+	dtrace_dofattr2attr(&hprov->dthpv_pattr.dtpa_mod,
+	    dofprov->dofpv_modattr);
+	dtrace_dofattr2attr(&hprov->dthpv_pattr.dtpa_func,
+	    dofprov->dofpv_funcattr);
+	dtrace_dofattr2attr(&hprov->dthpv_pattr.dtpa_name,
+	    dofprov->dofpv_nameattr);
+	dtrace_dofattr2attr(&hprov->dthpv_pattr.dtpa_args,
+	    dofprov->dofpv_argsattr);
+}
+
+static void
+dtrace_helper_provide_one(dof_helper_t *dhp, dof_sec_t *sec, pid_t pid)
+{
+	uintptr_t daddr = (uintptr_t)dhp->dofhp_dof;
+	dof_hdr_t *dof = (dof_hdr_t *)daddr;
+	dof_sec_t *str_sec, *prb_sec, *arg_sec, *off_sec, *enoff_sec;
+	dof_provider_t *provider;
+	dof_probe_t *probe;
+	uint32_t *off, *enoff;
+	uint8_t *arg;
+	char *strtab;
+	uint_t i, nprobes;
+	dtrace_helper_provdesc_t dhpv;
+	dtrace_helper_probedesc_t dhpb;
+	dtrace_meta_t *meta = dtrace_meta_pid;
+	dtrace_mops_t *mops = &meta->dtm_mops;
+	void *parg;
+
+	provider = (dof_provider_t *)(uintptr_t)(daddr + sec->dofs_offset);
+	str_sec = (dof_sec_t *)(uintptr_t)(daddr + dof->dofh_secoff +
+	    provider->dofpv_strtab * dof->dofh_secsize);
+	prb_sec = (dof_sec_t *)(uintptr_t)(daddr + dof->dofh_secoff +
+	    provider->dofpv_probes * dof->dofh_secsize);
+	arg_sec = (dof_sec_t *)(uintptr_t)(daddr + dof->dofh_secoff +
+	    provider->dofpv_prargs * dof->dofh_secsize);
+	off_sec = (dof_sec_t *)(uintptr_t)(daddr + dof->dofh_secoff +
+	    provider->dofpv_proffs * dof->dofh_secsize);
+
+	strtab = (char *)(uintptr_t)(daddr + str_sec->dofs_offset);
+	off = (uint32_t *)(uintptr_t)(daddr + off_sec->dofs_offset);
+	arg = (uint8_t *)(uintptr_t)(daddr + arg_sec->dofs_offset);
+	enoff = NULL;
+
+	/*
+	 * See dtrace_helper_provider_validate().
+	 */
+	if (dof->dofh_ident[DOF_ID_VERSION] != DOF_VERSION_1 &&
+	    provider->dofpv_prenoffs != DOF_SECT_NONE) {
+		enoff_sec = (dof_sec_t *)(uintptr_t)(daddr + dof->dofh_secoff +
+		    provider->dofpv_prenoffs * dof->dofh_secsize);
+		enoff = (uint32_t *)(uintptr_t)(daddr + enoff_sec->dofs_offset);
+	}
+
+	nprobes = prb_sec->dofs_size / prb_sec->dofs_entsize;
+
+	/*
+	 * Create the provider.
+	 */
+	dtrace_dofprov2hprov(&dhpv, provider, strtab);
+
+	if ((parg = mops->dtms_provide_pid(meta->dtm_arg, &dhpv, pid)) == NULL)
+		return;
+
+	meta->dtm_count++;
+
+	/*
+	 * Create the probes.
+	 */
+	for (i = 0; i < nprobes; i++) {
+		probe = (dof_probe_t *)(uintptr_t)(daddr +
+		    prb_sec->dofs_offset + i * prb_sec->dofs_entsize);
+
+		dhpb.dthpb_mod = dhp->dofhp_mod;
+		dhpb.dthpb_func = strtab + probe->dofpr_func;
+		dhpb.dthpb_name = strtab + probe->dofpr_name;
+		dhpb.dthpb_base = probe->dofpr_addr;
+		dhpb.dthpb_offs = off + probe->dofpr_offidx;
+		dhpb.dthpb_noffs = probe->dofpr_noffs;
+		if (enoff != NULL) {
+			dhpb.dthpb_enoffs = enoff + probe->dofpr_enoffidx;
+			dhpb.dthpb_nenoffs = probe->dofpr_nenoffs;
+		} else {
+			dhpb.dthpb_enoffs = NULL;
+			dhpb.dthpb_nenoffs = 0;
+		}
+		dhpb.dthpb_args = arg + probe->dofpr_argidx;
+		dhpb.dthpb_nargc = probe->dofpr_nargc;
+		dhpb.dthpb_xargc = probe->dofpr_xargc;
+		dhpb.dthpb_ntypes = strtab + probe->dofpr_nargv;
+		dhpb.dthpb_xtypes = strtab + probe->dofpr_xargv;
+
+		mops->dtms_create_probe(meta->dtm_arg, parg, &dhpb);
+	}
+}
+
+static void
+dtrace_helper_provide(dof_helper_t *dhp, pid_t pid)
+{
+	uintptr_t daddr = (uintptr_t)dhp->dofhp_dof;
+	dof_hdr_t *dof = (dof_hdr_t *)daddr;
+	VBDTTYPE(uint32_t,int) i;
+
+	ASSERT(MUTEX_HELD(&dtrace_meta_lock));
+
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		dof_sec_t *sec = (dof_sec_t *)(uintptr_t)(daddr +
+		    dof->dofh_secoff + i * dof->dofh_secsize);
+
+		if (sec->dofs_type != DOF_SECT_PROVIDER)
+			continue;
+
+		dtrace_helper_provide_one(dhp, sec, pid);
+	}
+
+	/*
+	 * We may have just created probes, so we must now rematch against
+	 * any retained enablings.  Note that this call will acquire both
+	 * cpu_lock and dtrace_lock; the fact that we are holding
+	 * dtrace_meta_lock now is what defines the ordering with respect to
+	 * these three locks.
+	 */
+	dtrace_enabling_matchall();
+}
+
+static void
+dtrace_helper_provider_remove_one(dof_helper_t *dhp, dof_sec_t *sec, pid_t pid)
+{
+	uintptr_t daddr = (uintptr_t)dhp->dofhp_dof;
+	dof_hdr_t *dof = (dof_hdr_t *)daddr;
+	dof_sec_t *str_sec;
+	dof_provider_t *provider;
+	char *strtab;
+	dtrace_helper_provdesc_t dhpv;
+	dtrace_meta_t *meta = dtrace_meta_pid;
+	dtrace_mops_t *mops = &meta->dtm_mops;
+
+	provider = (dof_provider_t *)(uintptr_t)(daddr + sec->dofs_offset);
+	str_sec = (dof_sec_t *)(uintptr_t)(daddr + dof->dofh_secoff +
+	    provider->dofpv_strtab * dof->dofh_secsize);
+
+	strtab = (char *)(uintptr_t)(daddr + str_sec->dofs_offset);
+
+	/*
+	 * Create the provider.
+	 */
+	dtrace_dofprov2hprov(&dhpv, provider, strtab);
+
+	mops->dtms_remove_pid(meta->dtm_arg, &dhpv, pid);
+
+	meta->dtm_count--;
+}
+
+static void
+dtrace_helper_provider_remove(dof_helper_t *dhp, pid_t pid)
+{
+	uintptr_t daddr = (uintptr_t)dhp->dofhp_dof;
+	dof_hdr_t *dof = (dof_hdr_t *)daddr;
+	VBDTTYPE(uint32_t,int) i;
+
+	ASSERT(MUTEX_HELD(&dtrace_meta_lock));
+
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		dof_sec_t *sec = (dof_sec_t *)(uintptr_t)(daddr +
+		    dof->dofh_secoff + i * dof->dofh_secsize);
+
+		if (sec->dofs_type != DOF_SECT_PROVIDER)
+			continue;
+
+		dtrace_helper_provider_remove_one(dhp, sec, pid);
+	}
+}
+
+/*
+ * DTrace Meta Provider-to-Framework API Functions
+ *
+ * These functions implement the Meta Provider-to-Framework API, as described
+ * in <sys/dtrace.h>.
+ */
+int
+dtrace_meta_register(const char *name, const dtrace_mops_t *mops, void *arg,
+    dtrace_meta_provider_id_t *idp)
+{
+	dtrace_meta_t *meta;
+	dtrace_helpers_t *help, *next;
+	VBDTTYPE(uint32_t,int) i;
+
+	*idp = DTRACE_METAPROVNONE;
+
+	/*
+	 * We strictly don't need the name, but we hold onto it for
+	 * debuggability. All hail error queues!
+	 */
+	if (name == NULL) {
+		cmn_err(CE_WARN, "failed to register meta-provider: "
+		    "invalid name");
+		return (EINVAL);
+	}
+
+	if (mops == NULL ||
+	    mops->dtms_create_probe == NULL ||
+	    mops->dtms_provide_pid == NULL ||
+	    mops->dtms_remove_pid == NULL) {
+		cmn_err(CE_WARN, "failed to register meta-register %s: "
+		    "invalid ops", name);
+		return (EINVAL);
+	}
+
+	meta = kmem_zalloc(sizeof (dtrace_meta_t), KM_SLEEP);
+	meta->dtm_mops = *mops;
+	meta->dtm_name = kmem_alloc(strlen(name) + 1, KM_SLEEP);
+	(void) strcpy(meta->dtm_name, name);
+	meta->dtm_arg = arg;
+
+	mutex_enter(&dtrace_meta_lock);
+	mutex_enter(&dtrace_lock);
+
+	if (dtrace_meta_pid != NULL) {
+		mutex_exit(&dtrace_lock);
+		mutex_exit(&dtrace_meta_lock);
+		cmn_err(CE_WARN, "failed to register meta-register %s: "
+		    "user-land meta-provider exists", name);
+		kmem_free(meta->dtm_name, strlen(meta->dtm_name) + 1);
+		kmem_free(meta, sizeof (dtrace_meta_t));
+		return (EINVAL);
+	}
+
+	dtrace_meta_pid = meta;
+	*idp = (dtrace_meta_provider_id_t)meta;
+
+	/*
+	 * If there are providers and probes ready to go, pass them
+	 * off to the new meta provider now.
+	 */
+
+	help = dtrace_deferred_pid;
+	dtrace_deferred_pid = NULL;
+
+	mutex_exit(&dtrace_lock);
+
+	while (help != NULL) {
+		for (i = 0; i < help->dthps_nprovs; i++) {
+			dtrace_helper_provide(&help->dthps_provs[i]->dthp_prov,
+			    help->dthps_pid);
+		}
+
+		next = help->dthps_next;
+		help->dthps_next = NULL;
+		help->dthps_prev = NULL;
+		help->dthps_deferred = 0;
+		help = next;
+	}
+
+	mutex_exit(&dtrace_meta_lock);
+
+	return (0);
+}
+
+int
+dtrace_meta_unregister(dtrace_meta_provider_id_t id)
+{
+	dtrace_meta_t **pp, *old = (dtrace_meta_t *)id;
+
+	mutex_enter(&dtrace_meta_lock);
+	mutex_enter(&dtrace_lock);
+
+	if (old == dtrace_meta_pid) {
+		pp = &dtrace_meta_pid;
+	} else {
+		panic("attempt to unregister non-existent "
+		    "dtrace meta-provider %p\n", (void *)old);
+#ifdef VBOX
+		return EINVAL;
+#endif
+	}
+
+	if (old->dtm_count != 0) {
+		mutex_exit(&dtrace_lock);
+		mutex_exit(&dtrace_meta_lock);
+		return (EBUSY);
+	}
+
+	*pp = NULL;
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&dtrace_meta_lock);
+
+	kmem_free(old->dtm_name, strlen(old->dtm_name) + 1);
+	kmem_free(old, sizeof (dtrace_meta_t));
+
+	return (0);
+}
+
+
+/*
+ * DTrace DIF Object Functions
+ */
+static int
+dtrace_difo_err(uint_t pc, const char *format, ...)
+{
+	if (dtrace_err_verbose) {
+		va_list alist;
+
+		(void) uprintf("dtrace DIF object error: [%u]: ", pc);
+		va_start(alist, format);
+		(void) vuprintf(format, alist);
+		va_end(alist);
+	}
+
+#ifdef DTRACE_ERRDEBUG
+	dtrace_errdebug(format);
+#endif
+	return (1);
+}
+
+/*
+ * Validate a DTrace DIF object by checking the IR instructions.  The following
+ * rules are currently enforced by dtrace_difo_validate():
+ *
+ * 1. Each instruction must have a valid opcode
+ * 2. Each register, string, variable, or subroutine reference must be valid
+ * 3. No instruction can modify register %r0 (must be zero)
+ * 4. All instruction reserved bits must be set to zero
+ * 5. The last instruction must be a "ret" instruction
+ * 6. All branch targets must reference a valid instruction _after_ the branch
+ */
+static int
+dtrace_difo_validate(dtrace_difo_t *dp, dtrace_vstate_t *vstate, uint_t nregs,
+    cred_t *cr)
+{
+#ifndef VBOX
+	int err = 0, i;
+#else
+	int err = 0;
+	uint_t i;
+#endif
+	int (*efunc)(uint_t pc, const char *, ...) = dtrace_difo_err;
+	int kcheckload;
+	uint_t pc;
+
+	kcheckload = cr == NULL ||
+	    (vstate->dtvs_state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL) == 0;
+
+	dp->dtdo_destructive = 0;
+
+	for (pc = 0; pc < dp->dtdo_len && err == 0; pc++) {
+		dif_instr_t instr = dp->dtdo_buf[pc];
+
+		uint_t r1 = DIF_INSTR_R1(instr);
+		uint_t r2 = DIF_INSTR_R2(instr);
+		uint_t rd = DIF_INSTR_RD(instr);
+		uint_t rs = DIF_INSTR_RS(instr);
+		uint_t label = DIF_INSTR_LABEL(instr);
+		uint_t v = DIF_INSTR_VAR(instr);
+		uint_t subr = DIF_INSTR_SUBR(instr);
+		uint_t type = DIF_INSTR_TYPE(instr);
+		uint_t op = DIF_INSTR_OP(instr);
+
+		switch (op) {
+		case DIF_OP_OR:
+		case DIF_OP_XOR:
+		case DIF_OP_AND:
+		case DIF_OP_SLL:
+		case DIF_OP_SRL:
+		case DIF_OP_SRA:
+		case DIF_OP_SUB:
+		case DIF_OP_ADD:
+		case DIF_OP_MUL:
+		case DIF_OP_SDIV:
+		case DIF_OP_UDIV:
+		case DIF_OP_SREM:
+		case DIF_OP_UREM:
+		case DIF_OP_COPYS:
+			if (r1 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r1);
+			if (r2 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r2);
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			break;
+		case DIF_OP_NOT:
+		case DIF_OP_MOV:
+		case DIF_OP_ALLOCS:
+			if (r1 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r1);
+			if (r2 != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			break;
+		case DIF_OP_LDSB:
+		case DIF_OP_LDSH:
+		case DIF_OP_LDSW:
+		case DIF_OP_LDUB:
+		case DIF_OP_LDUH:
+		case DIF_OP_LDUW:
+		case DIF_OP_LDX:
+			if (r1 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r1);
+			if (r2 != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			if (kcheckload)
+				dp->dtdo_buf[pc] = DIF_INSTR_LOAD(op +
+				    DIF_OP_RLDSB - DIF_OP_LDSB, r1, rd);
+			break;
+		case DIF_OP_RLDSB:
+		case DIF_OP_RLDSH:
+		case DIF_OP_RLDSW:
+		case DIF_OP_RLDUB:
+		case DIF_OP_RLDUH:
+		case DIF_OP_RLDUW:
+		case DIF_OP_RLDX:
+			if (r1 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r1);
+			if (r2 != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			break;
+		case DIF_OP_ULDSB:
+		case DIF_OP_ULDSH:
+		case DIF_OP_ULDSW:
+		case DIF_OP_ULDUB:
+		case DIF_OP_ULDUH:
+		case DIF_OP_ULDUW:
+		case DIF_OP_ULDX:
+			if (r1 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r1);
+			if (r2 != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			break;
+		case DIF_OP_STB:
+		case DIF_OP_STH:
+		case DIF_OP_STW:
+		case DIF_OP_STX:
+			if (r1 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r1);
+			if (r2 != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to 0 address\n");
+			break;
+		case DIF_OP_CMP:
+		case DIF_OP_SCMP:
+			if (r1 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r1);
+			if (r2 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r2);
+			if (rd != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			break;
+		case DIF_OP_TST:
+			if (r1 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r1);
+			if (r2 != 0 || rd != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			break;
+		case DIF_OP_BA:
+		case DIF_OP_BE:
+		case DIF_OP_BNE:
+		case DIF_OP_BG:
+		case DIF_OP_BGU:
+		case DIF_OP_BGE:
+		case DIF_OP_BGEU:
+		case DIF_OP_BL:
+		case DIF_OP_BLU:
+		case DIF_OP_BLE:
+		case DIF_OP_BLEU:
+			if (label >= dp->dtdo_len) {
+				err += efunc(pc, "invalid branch target %u\n",
+				    label);
+			}
+			if (label <= pc) {
+				err += efunc(pc, "backward branch to %u\n",
+				    label);
+			}
+			break;
+		case DIF_OP_RET:
+			if (r1 != 0 || r2 != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			break;
+		case DIF_OP_NOP:
+		case DIF_OP_POPTS:
+		case DIF_OP_FLUSHTS:
+			if (r1 != 0 || r2 != 0 || rd != 0)
+				err += efunc(pc, "non-zero reserved bits\n");
+			break;
+		case DIF_OP_SETX:
+			if (DIF_INSTR_INTEGER(instr) >= dp->dtdo_intlen) {
+				err += efunc(pc, "invalid integer ref %u\n",
+				    DIF_INSTR_INTEGER(instr));
+			}
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			break;
+		case DIF_OP_SETS:
+			if (DIF_INSTR_STRING(instr) >= dp->dtdo_strlen) {
+				err += efunc(pc, "invalid string ref %u\n",
+				    DIF_INSTR_STRING(instr));
+			}
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			break;
+		case DIF_OP_LDGA:
+		case DIF_OP_LDTA:
+			if (r1 > DIF_VAR_ARRAY_MAX)
+				err += efunc(pc, "invalid array %u\n", r1);
+			if (r2 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r2);
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			break;
+		case DIF_OP_LDGS:
+		case DIF_OP_LDTS:
+		case DIF_OP_LDLS:
+		case DIF_OP_LDGAA:
+		case DIF_OP_LDTAA:
+			if (v < DIF_VAR_OTHER_MIN || v > DIF_VAR_OTHER_MAX)
+				err += efunc(pc, "invalid variable %u\n", v);
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+			break;
+		case DIF_OP_STGS:
+		case DIF_OP_STTS:
+		case DIF_OP_STLS:
+		case DIF_OP_STGAA:
+		case DIF_OP_STTAA:
+			if (v < DIF_VAR_OTHER_UBASE || v > DIF_VAR_OTHER_MAX)
+				err += efunc(pc, "invalid variable %u\n", v);
+			if (rs >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			break;
+		case DIF_OP_CALL:
+			if (subr > DIF_SUBR_MAX)
+				err += efunc(pc, "invalid subr %u\n", subr);
+			if (rd >= nregs)
+				err += efunc(pc, "invalid register %u\n", rd);
+			if (rd == 0)
+				err += efunc(pc, "cannot write to %r0\n");
+
+			if (subr == DIF_SUBR_COPYOUT ||
+			    subr == DIF_SUBR_COPYOUTSTR) {
+				dp->dtdo_destructive = 1;
+			}
+			break;
+		case DIF_OP_PUSHTR:
+			if (type != DIF_TYPE_STRING && type != DIF_TYPE_CTF)
+				err += efunc(pc, "invalid ref type %u\n", type);
+			if (r2 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r2);
+			if (rs >= nregs)
+				err += efunc(pc, "invalid register %u\n", rs);
+			break;
+		case DIF_OP_PUSHTV:
+			if (type != DIF_TYPE_CTF)
+				err += efunc(pc, "invalid val type %u\n", type);
+			if (r2 >= nregs)
+				err += efunc(pc, "invalid register %u\n", r2);
+			if (rs >= nregs)
+				err += efunc(pc, "invalid register %u\n", rs);
+			break;
+		default:
+			err += efunc(pc, "invalid opcode %u\n",
+			    DIF_INSTR_OP(instr));
+		}
+	}
+
+	if (dp->dtdo_len != 0 &&
+	    DIF_INSTR_OP(dp->dtdo_buf[dp->dtdo_len - 1]) != DIF_OP_RET) {
+		err += efunc(dp->dtdo_len - 1,
+		    "expected 'ret' as last DIF instruction\n");
+	}
+
+	if (!(dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF)) {
+		/*
+		 * If we're not returning by reference, the size must be either
+		 * 0 or the size of one of the base types.
+		 */
+		switch (dp->dtdo_rtype.dtdt_size) {
+		case 0:
+		case sizeof (uint8_t):
+		case sizeof (uint16_t):
+		case sizeof (uint32_t):
+		case sizeof (uint64_t):
+			break;
+
+		default:
+			err += efunc(dp->dtdo_len - 1, "bad return size\n");
+		}
+	}
+
+	for (i = 0; i < dp->dtdo_varlen && err == 0; i++) {
+		dtrace_difv_t *v = &dp->dtdo_vartab[i], *existing = NULL;
+		dtrace_diftype_t *vt, *et;
+		uint_t id, ndx;
+
+		if (v->dtdv_scope != DIFV_SCOPE_GLOBAL &&
+		    v->dtdv_scope != DIFV_SCOPE_THREAD &&
+		    v->dtdv_scope != DIFV_SCOPE_LOCAL) {
+			err += efunc(i, "unrecognized variable scope %d\n",
+			    v->dtdv_scope);
+			break;
+		}
+
+		if (v->dtdv_kind != DIFV_KIND_ARRAY &&
+		    v->dtdv_kind != DIFV_KIND_SCALAR) {
+			err += efunc(i, "unrecognized variable type %d\n",
+			    v->dtdv_kind);
+			break;
+		}
+
+		if ((id = v->dtdv_id) > DIF_VARIABLE_MAX) {
+			err += efunc(i, "%d exceeds variable id limit\n", id);
+			break;
+		}
+
+		if (id < DIF_VAR_OTHER_UBASE)
+			continue;
+
+		/*
+		 * For user-defined variables, we need to check that this
+		 * definition is identical to any previous definition that we
+		 * encountered.
+		 */
+		ndx = id - DIF_VAR_OTHER_UBASE;
+
+		switch (v->dtdv_scope) {
+		case DIFV_SCOPE_GLOBAL:
+			if (VBDTCAST(int64_t)ndx < vstate->dtvs_nglobals) {
+				dtrace_statvar_t *svar;
+
+				if ((svar = vstate->dtvs_globals[ndx]) != NULL)
+					existing = &svar->dtsv_var;
+			}
+
+			break;
+
+		case DIFV_SCOPE_THREAD:
+			if (VBDTCAST(int64_t)ndx < vstate->dtvs_ntlocals)
+				existing = &vstate->dtvs_tlocals[ndx];
+			break;
+
+		case DIFV_SCOPE_LOCAL:
+			if (VBDTCAST(int64_t)ndx < vstate->dtvs_nlocals) {
+				dtrace_statvar_t *svar;
+
+				if ((svar = vstate->dtvs_locals[ndx]) != NULL)
+					existing = &svar->dtsv_var;
+			}
+
+			break;
+		}
+
+		vt = &v->dtdv_type;
+
+		if (vt->dtdt_flags & DIF_TF_BYREF) {
+			if (vt->dtdt_size == 0) {
+				err += efunc(i, "zero-sized variable\n");
+				break;
+			}
+
+			if (v->dtdv_scope == DIFV_SCOPE_GLOBAL &&
+			    vt->dtdt_size > dtrace_global_maxsize) {
+				err += efunc(i, "oversized by-ref global\n");
+				break;
+			}
+		}
+
+		if (existing == NULL || existing->dtdv_id == 0)
+			continue;
+
+		ASSERT(existing->dtdv_id == v->dtdv_id);
+		ASSERT(existing->dtdv_scope == v->dtdv_scope);
+
+		if (existing->dtdv_kind != v->dtdv_kind)
+			err += efunc(i, "%d changed variable kind\n", id);
+
+		et = &existing->dtdv_type;
+
+		if (vt->dtdt_flags != et->dtdt_flags) {
+			err += efunc(i, "%d changed variable type flags\n", id);
+			break;
+		}
+
+		if (vt->dtdt_size != 0 && vt->dtdt_size != et->dtdt_size) {
+			err += efunc(i, "%d changed variable type size\n", id);
+			break;
+		}
+	}
+
+	return (err);
+}
+
+/*
+ * Validate a DTrace DIF object that it is to be used as a helper.  Helpers
+ * are much more constrained than normal DIFOs.  Specifically, they may
+ * not:
+ *
+ * 1. Make calls to subroutines other than copyin(), copyinstr() or
+ *    miscellaneous string routines
+ * 2. Access DTrace variables other than the args[] array, and the
+ *    curthread, pid, ppid, tid, execname, zonename, uid and gid variables.
+ * 3. Have thread-local variables.
+ * 4. Have dynamic variables.
+ */
+static int
+dtrace_difo_validate_helper(dtrace_difo_t *dp)
+{
+	int (*efunc)(uint_t pc, const char *, ...) = dtrace_difo_err;
+	int err = 0;
+	uint_t pc;
+
+	for (pc = 0; pc < dp->dtdo_len; pc++) {
+		dif_instr_t instr = dp->dtdo_buf[pc];
+
+		uint_t v = DIF_INSTR_VAR(instr);
+		uint_t subr = DIF_INSTR_SUBR(instr);
+		uint_t op = DIF_INSTR_OP(instr);
+
+		switch (op) {
+		case DIF_OP_OR:
+		case DIF_OP_XOR:
+		case DIF_OP_AND:
+		case DIF_OP_SLL:
+		case DIF_OP_SRL:
+		case DIF_OP_SRA:
+		case DIF_OP_SUB:
+		case DIF_OP_ADD:
+		case DIF_OP_MUL:
+		case DIF_OP_SDIV:
+		case DIF_OP_UDIV:
+		case DIF_OP_SREM:
+		case DIF_OP_UREM:
+		case DIF_OP_COPYS:
+		case DIF_OP_NOT:
+		case DIF_OP_MOV:
+		case DIF_OP_RLDSB:
+		case DIF_OP_RLDSH:
+		case DIF_OP_RLDSW:
+		case DIF_OP_RLDUB:
+		case DIF_OP_RLDUH:
+		case DIF_OP_RLDUW:
+		case DIF_OP_RLDX:
+		case DIF_OP_ULDSB:
+		case DIF_OP_ULDSH:
+		case DIF_OP_ULDSW:
+		case DIF_OP_ULDUB:
+		case DIF_OP_ULDUH:
+		case DIF_OP_ULDUW:
+		case DIF_OP_ULDX:
+		case DIF_OP_STB:
+		case DIF_OP_STH:
+		case DIF_OP_STW:
+		case DIF_OP_STX:
+		case DIF_OP_ALLOCS:
+		case DIF_OP_CMP:
+		case DIF_OP_SCMP:
+		case DIF_OP_TST:
+		case DIF_OP_BA:
+		case DIF_OP_BE:
+		case DIF_OP_BNE:
+		case DIF_OP_BG:
+		case DIF_OP_BGU:
+		case DIF_OP_BGE:
+		case DIF_OP_BGEU:
+		case DIF_OP_BL:
+		case DIF_OP_BLU:
+		case DIF_OP_BLE:
+		case DIF_OP_BLEU:
+		case DIF_OP_RET:
+		case DIF_OP_NOP:
+		case DIF_OP_POPTS:
+		case DIF_OP_FLUSHTS:
+		case DIF_OP_SETX:
+		case DIF_OP_SETS:
+		case DIF_OP_LDGA:
+		case DIF_OP_LDLS:
+		case DIF_OP_STGS:
+		case DIF_OP_STLS:
+		case DIF_OP_PUSHTR:
+		case DIF_OP_PUSHTV:
+			break;
+
+		case DIF_OP_LDGS:
+			if (v >= DIF_VAR_OTHER_UBASE)
+				break;
+
+			if (v >= DIF_VAR_ARG0 && v <= DIF_VAR_ARG9)
+				break;
+
+			if (v == DIF_VAR_CURTHREAD || v == DIF_VAR_PID ||
+			    v == DIF_VAR_PPID || v == DIF_VAR_TID ||
+			    v == DIF_VAR_EXECNAME || v == DIF_VAR_ZONENAME ||
+			    v == DIF_VAR_UID || v == DIF_VAR_GID)
+				break;
+
+			err += efunc(pc, "illegal variable %u\n", v);
+			break;
+
+		case DIF_OP_LDTA:
+		case DIF_OP_LDTS:
+		case DIF_OP_LDGAA:
+		case DIF_OP_LDTAA:
+			err += efunc(pc, "illegal dynamic variable load\n");
+			break;
+
+		case DIF_OP_STTS:
+		case DIF_OP_STGAA:
+		case DIF_OP_STTAA:
+			err += efunc(pc, "illegal dynamic variable store\n");
+			break;
+
+		case DIF_OP_CALL:
+			if (subr == DIF_SUBR_ALLOCA ||
+			    subr == DIF_SUBR_BCOPY ||
+			    subr == DIF_SUBR_COPYIN ||
+			    subr == DIF_SUBR_COPYINTO ||
+			    subr == DIF_SUBR_COPYINSTR ||
+			    subr == DIF_SUBR_INDEX ||
+			    subr == DIF_SUBR_INET_NTOA ||
+			    subr == DIF_SUBR_INET_NTOA6 ||
+			    subr == DIF_SUBR_INET_NTOP ||
+			    subr == DIF_SUBR_LLTOSTR ||
+			    subr == DIF_SUBR_RINDEX ||
+			    subr == DIF_SUBR_STRCHR ||
+			    subr == DIF_SUBR_STRJOIN ||
+			    subr == DIF_SUBR_STRRCHR ||
+			    subr == DIF_SUBR_STRSTR ||
+			    subr == DIF_SUBR_HTONS ||
+			    subr == DIF_SUBR_HTONL ||
+			    subr == DIF_SUBR_HTONLL ||
+			    subr == DIF_SUBR_NTOHS ||
+			    subr == DIF_SUBR_NTOHL ||
+			    subr == DIF_SUBR_NTOHLL)
+				break;
+
+			err += efunc(pc, "invalid subr %u\n", subr);
+			break;
+
+		default:
+			err += efunc(pc, "invalid opcode %u\n",
+			    DIF_INSTR_OP(instr));
+		}
+	}
+
+	return (err);
+}
+
+/*
+ * Returns 1 if the expression in the DIF object can be cached on a per-thread
+ * basis; 0 if not.
+ */
+static int
+dtrace_difo_cacheable(dtrace_difo_t *dp)
+{
+	VBDTTYPE(uint_t,int) i;
+
+	if (dp == NULL)
+		return (0);
+
+	for (i = 0; i < dp->dtdo_varlen; i++) {
+		dtrace_difv_t *v = &dp->dtdo_vartab[i];
+
+		if (v->dtdv_scope != DIFV_SCOPE_GLOBAL)
+			continue;
+
+		switch (v->dtdv_id) {
+		case DIF_VAR_CURTHREAD:
+		case DIF_VAR_PID:
+		case DIF_VAR_TID:
+		case DIF_VAR_EXECNAME:
+		case DIF_VAR_ZONENAME:
+			break;
+
+		default:
+			return (0);
+		}
+	}
+
+	/*
+	 * This DIF object may be cacheable.  Now we need to look for any
+	 * array loading instructions, any memory loading instructions, or
+	 * any stores to thread-local variables.
+	 */
+	for (i = 0; i < dp->dtdo_len; i++) {
+		uint_t op = DIF_INSTR_OP(dp->dtdo_buf[i]);
+
+		if ((op >= DIF_OP_LDSB && op <= DIF_OP_LDX) ||
+		    (op >= DIF_OP_ULDSB && op <= DIF_OP_ULDX) ||
+		    (op >= DIF_OP_RLDSB && op <= DIF_OP_RLDX) ||
+		    op == DIF_OP_LDGA || op == DIF_OP_STTS)
+			return (0);
+	}
+
+	return (1);
+}
+
+static void
+dtrace_difo_hold(dtrace_difo_t *dp)
+{
+#ifndef VBOX
+	VBDTTYPE(uint_t,int) i;
+#endif
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	dp->dtdo_refcnt++;
+	ASSERT(dp->dtdo_refcnt != 0);
+
+#ifndef VBOX
+	/*
+	 * We need to check this DIF object for references to the variable
+	 * DIF_VAR_VTIMESTAMP.
+	 */
+	for (i = 0; i < dp->dtdo_varlen; i++) {
+		dtrace_difv_t *v = &dp->dtdo_vartab[i];
+
+		if (v->dtdv_id != DIF_VAR_VTIMESTAMP)
+			continue;
+
+		if (dtrace_vtime_references++ == 0)
+			dtrace_vtime_enable();
+	}
+#endif
+}
+
+/*
+ * This routine calculates the dynamic variable chunksize for a given DIF
+ * object.  The calculation is not fool-proof, and can probably be tricked by
+ * malicious DIF -- but it works for all compiler-generated DIF.  Because this
+ * calculation is likely imperfect, dtrace_dynvar() is able to gracefully fail
+ * if a dynamic variable size exceeds the chunksize.
+ */
+static void
+dtrace_difo_chunksize(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
+{
+	uint64_t sval VBDTGCC(0);
+	dtrace_key_t tupregs[DIF_DTR_NREGS + 2]; /* +2 for thread and id */
+	const dif_instr_t *text = dp->dtdo_buf;
+	uint_t pc, srd = 0;
+	uint_t ttop = 0;
+	size_t size, ksize;
+	uint_t id, i;
+
+	for (pc = 0; pc < dp->dtdo_len; pc++) {
+		dif_instr_t instr = text[pc];
+		uint_t op = DIF_INSTR_OP(instr);
+		uint_t rd = DIF_INSTR_RD(instr);
+		uint_t r1 = DIF_INSTR_R1(instr);
+		uint_t nkeys = 0;
+		uchar_t scope VBDTGCC(0);
+
+		dtrace_key_t *key = tupregs;
+
+		switch (op) {
+		case DIF_OP_SETX:
+			sval = dp->dtdo_inttab[DIF_INSTR_INTEGER(instr)];
+			srd = rd;
+			continue;
+
+		case DIF_OP_STTS:
+			key = &tupregs[DIF_DTR_NREGS];
+			key[0].dttk_size = 0;
+			key[1].dttk_size = 0;
+			nkeys = 2;
+			scope = DIFV_SCOPE_THREAD;
+			break;
+
+		case DIF_OP_STGAA:
+		case DIF_OP_STTAA:
+			nkeys = ttop;
+
+			if (DIF_INSTR_OP(instr) == DIF_OP_STTAA)
+				key[nkeys++].dttk_size = 0;
+
+			key[nkeys++].dttk_size = 0;
+
+			if (op == DIF_OP_STTAA) {
+				scope = DIFV_SCOPE_THREAD;
+			} else {
+				scope = DIFV_SCOPE_GLOBAL;
+			}
+
+			break;
+
+		case DIF_OP_PUSHTR:
+			if (ttop == DIF_DTR_NREGS)
+				return;
+
+			if ((srd == 0 || sval == 0) && r1 == DIF_TYPE_STRING) {
+				/*
+				 * If the register for the size of the "pushtr"
+				 * is %r0 (or the value is 0) and the type is
+				 * a string, we'll use the system-wide default
+				 * string size.
+				 */
+				tupregs[ttop++].dttk_size =
+				    dtrace_strsize_default;
+			} else {
+				if (srd == 0)
+					return;
+
+				tupregs[ttop++].dttk_size = sval;
+			}
+
+			break;
+
+		case DIF_OP_PUSHTV:
+			if (ttop == DIF_DTR_NREGS)
+				return;
+
+			tupregs[ttop++].dttk_size = 0;
+			break;
+
+		case DIF_OP_FLUSHTS:
+			ttop = 0;
+			break;
+
+		case DIF_OP_POPTS:
+			if (ttop != 0)
+				ttop--;
+			break;
+		}
+
+		sval = 0;
+		srd = 0;
+
+		if (nkeys == 0)
+			continue;
+
+		/*
+		 * We have a dynamic variable allocation; calculate its size.
+		 */
+		for (ksize = 0, i = 0; i < nkeys; i++)
+			ksize += P2ROUNDUP(key[i].dttk_size, sizeof (uint64_t));
+
+		size = sizeof (dtrace_dynvar_t);
+		size += sizeof (dtrace_key_t) * (nkeys - 1);
+		size += ksize;
+
+		/*
+		 * Now we need to determine the size of the stored data.
+		 */
+		id = DIF_INSTR_VAR(instr);
+
+		for (i = 0; i < dp->dtdo_varlen; i++) {
+			dtrace_difv_t *v = &dp->dtdo_vartab[i];
+
+			if (v->dtdv_id == id && v->dtdv_scope == scope) {
+				size += v->dtdv_type.dtdt_size;
+				break;
+			}
+		}
+
+		if (i == dp->dtdo_varlen)
+			return;
+
+		/*
+		 * We have the size.  If this is larger than the chunk size
+		 * for our dynamic variable state, reset the chunk size.
+		 */
+		size = P2ROUNDUP(size, sizeof (uint64_t));
+
+		if (size > vstate->dtvs_dynvars.dtds_chunksize)
+			vstate->dtvs_dynvars.dtds_chunksize = size;
+	}
+}
+
+static void
+dtrace_difo_init(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
+{
+#ifndef VBOX
+	int i, oldsvars, osz, nsz, otlocals, ntlocals;
+#else
+	int oldsvars, osz, nsz, otlocals, ntlocals;
+	uint_t i;
+#endif
+	uint_t id;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(dp->dtdo_buf != NULL && dp->dtdo_len != 0);
+
+	for (i = 0; i < dp->dtdo_varlen; i++) {
+		dtrace_difv_t *v = &dp->dtdo_vartab[i];
+		dtrace_statvar_t *svar, ***svarp;
+		size_t dsize = 0;
+		uint8_t scope = v->dtdv_scope;
+		int *np;
+
+		if ((id = v->dtdv_id) < DIF_VAR_OTHER_UBASE)
+			continue;
+
+		id -= DIF_VAR_OTHER_UBASE;
+
+		switch (scope) {
+		case DIFV_SCOPE_THREAD:
+			while (VBDTCAST(int64_t)id >= (otlocals = vstate->dtvs_ntlocals)) {
+				dtrace_difv_t *tlocals;
+
+				if ((ntlocals = (otlocals << 1)) == 0)
+					ntlocals = 1;
+
+				osz = otlocals * sizeof (dtrace_difv_t);
+				nsz = ntlocals * sizeof (dtrace_difv_t);
+
+				tlocals = kmem_zalloc(nsz, KM_SLEEP);
+
+				if (osz != 0) {
+					bcopy(vstate->dtvs_tlocals,
+					    tlocals, osz);
+					kmem_free(vstate->dtvs_tlocals, osz);
+				}
+
+				vstate->dtvs_tlocals = tlocals;
+				vstate->dtvs_ntlocals = ntlocals;
+			}
+
+			vstate->dtvs_tlocals[id] = *v;
+			continue;
+
+		case DIFV_SCOPE_LOCAL:
+			np = &vstate->dtvs_nlocals;
+			svarp = &vstate->dtvs_locals;
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF)
+				dsize = NCPU * (v->dtdv_type.dtdt_size +
+				    sizeof (uint64_t));
+			else
+				dsize = NCPU * sizeof (uint64_t);
+
+			break;
+
+		case DIFV_SCOPE_GLOBAL:
+			np = &vstate->dtvs_nglobals;
+			svarp = &vstate->dtvs_globals;
+
+			if (v->dtdv_type.dtdt_flags & DIF_TF_BYREF)
+				dsize = v->dtdv_type.dtdt_size +
+				    sizeof (uint64_t);
+
+			break;
+
+		default:
+#ifndef VBOX
+			ASSERT(0);
+#else
+			AssertFatalMsgFailed(("%d\n", scope));
+#endif
+		}
+
+		while (VBDTCAST(int64_t)id >= (oldsvars = *np)) {
+			dtrace_statvar_t **statics;
+			int newsvars, oldsize, newsize;
+
+			if ((newsvars = (oldsvars << 1)) == 0)
+				newsvars = 1;
+
+			oldsize = oldsvars * sizeof (dtrace_statvar_t *);
+			newsize = newsvars * sizeof (dtrace_statvar_t *);
+
+			statics = kmem_zalloc(newsize, KM_SLEEP);
+
+			if (oldsize != 0) {
+				bcopy(*svarp, statics, oldsize);
+				kmem_free(*svarp, oldsize);
+			}
+
+			*svarp = statics;
+			*np = newsvars;
+		}
+
+		if ((svar = (*svarp)[id]) == NULL) {
+			svar = kmem_zalloc(sizeof (dtrace_statvar_t), KM_SLEEP);
+			svar->dtsv_var = *v;
+
+			if ((svar->dtsv_size = dsize) != 0) {
+				svar->dtsv_data = (uint64_t)(uintptr_t)
+				    kmem_zalloc(dsize, KM_SLEEP);
+			}
+
+			(*svarp)[id] = svar;
+		}
+
+		svar->dtsv_refcnt++;
+	}
+
+	dtrace_difo_chunksize(dp, vstate);
+	dtrace_difo_hold(dp);
+}
+
+static dtrace_difo_t *
+dtrace_difo_duplicate(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
+{
+	dtrace_difo_t *new;
+	size_t sz;
+
+	ASSERT(dp->dtdo_buf != NULL);
+	ASSERT(dp->dtdo_refcnt != 0);
+
+	new = kmem_zalloc(sizeof (dtrace_difo_t), KM_SLEEP);
+
+	ASSERT(dp->dtdo_buf != NULL);
+	sz = dp->dtdo_len * sizeof (dif_instr_t);
+	new->dtdo_buf = kmem_alloc(sz, KM_SLEEP);
+	bcopy(dp->dtdo_buf, new->dtdo_buf, sz);
+	new->dtdo_len = dp->dtdo_len;
+
+	if (dp->dtdo_strtab != NULL) {
+		ASSERT(dp->dtdo_strlen != 0);
+		new->dtdo_strtab = kmem_alloc(dp->dtdo_strlen, KM_SLEEP);
+		bcopy(dp->dtdo_strtab, new->dtdo_strtab, dp->dtdo_strlen);
+		new->dtdo_strlen = dp->dtdo_strlen;
+	}
+
+	if (dp->dtdo_inttab != NULL) {
+		ASSERT(dp->dtdo_intlen != 0);
+		sz = dp->dtdo_intlen * sizeof (uint64_t);
+		new->dtdo_inttab = kmem_alloc(sz, KM_SLEEP);
+		bcopy(dp->dtdo_inttab, new->dtdo_inttab, sz);
+		new->dtdo_intlen = dp->dtdo_intlen;
+	}
+
+	if (dp->dtdo_vartab != NULL) {
+		ASSERT(dp->dtdo_varlen != 0);
+		sz = dp->dtdo_varlen * sizeof (dtrace_difv_t);
+		new->dtdo_vartab = kmem_alloc(sz, KM_SLEEP);
+		bcopy(dp->dtdo_vartab, new->dtdo_vartab, sz);
+		new->dtdo_varlen = dp->dtdo_varlen;
+	}
+
+	dtrace_difo_init(new, vstate);
+	return (new);
+}
+
+static void
+dtrace_difo_destroy(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
+{
+	VBDTTYPE(uint_t,int)  i;
+
+	ASSERT(dp->dtdo_refcnt == 0);
+
+	for (i = 0; i < dp->dtdo_varlen; i++) {
+		dtrace_difv_t *v = &dp->dtdo_vartab[i];
+		dtrace_statvar_t *svar, **svarp;
+		uint_t id;
+		uint8_t scope = v->dtdv_scope;
+		int *np;
+
+		switch (scope) {
+		case DIFV_SCOPE_THREAD:
+			continue;
+
+		case DIFV_SCOPE_LOCAL:
+			np = &vstate->dtvs_nlocals;
+			svarp = vstate->dtvs_locals;
+			break;
+
+		case DIFV_SCOPE_GLOBAL:
+			np = &vstate->dtvs_nglobals;
+			svarp = vstate->dtvs_globals;
+			break;
+
+		default:
+#ifndef VBOX
+			ASSERT(0);
+#else
+			AssertFatalMsgFailed(("%d\n", scope));
+#endif
+		}
+
+		if ((id = v->dtdv_id) < DIF_VAR_OTHER_UBASE)
+			continue;
+
+		id -= DIF_VAR_OTHER_UBASE;
+		ASSERT(VBDTCAST(int64_t)id < *np);
+
+		svar = svarp[id];
+		ASSERT(svar != NULL);
+		ASSERT(svar->dtsv_refcnt > 0);
+
+		if (--svar->dtsv_refcnt > 0)
+			continue;
+
+		if (svar->dtsv_size != 0) {
+			ASSERT(svar->dtsv_data != NULL);
+			kmem_free((void *)(uintptr_t)svar->dtsv_data,
+			    svar->dtsv_size);
+		}
+
+		kmem_free(svar, sizeof (dtrace_statvar_t));
+		svarp[id] = NULL;
+	}
+
+	kmem_free(dp->dtdo_buf, dp->dtdo_len * sizeof (dif_instr_t));
+	kmem_free(dp->dtdo_inttab, dp->dtdo_intlen * sizeof (uint64_t));
+	kmem_free(dp->dtdo_strtab, dp->dtdo_strlen);
+	kmem_free(dp->dtdo_vartab, dp->dtdo_varlen * sizeof (dtrace_difv_t));
+
+	kmem_free(dp, sizeof (dtrace_difo_t));
+}
+
+static void
+dtrace_difo_release(dtrace_difo_t *dp, dtrace_vstate_t *vstate)
+{
+#ifndef VBOX
+	VBDTTYPE(uint_t,int)  i;
+#endif
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(dp->dtdo_refcnt != 0);
+
+#ifndef VBOX
+	for (i = 0; i < dp->dtdo_varlen; i++) {
+		dtrace_difv_t *v = &dp->dtdo_vartab[i];
+
+		if (v->dtdv_id != DIF_VAR_VTIMESTAMP)
+			continue;
+
+		ASSERT(dtrace_vtime_references > 0);
+		if (--dtrace_vtime_references == 0)
+			dtrace_vtime_disable();
+	}
+#endif
+
+	if (--dp->dtdo_refcnt == 0)
+		dtrace_difo_destroy(dp, vstate);
+}
+
+/*
+ * DTrace Format Functions
+ */
+static uint16_t
+dtrace_format_add(dtrace_state_t *state, char *str)
+{
+	char *fmt, **new;
+	uint16_t ndx, len = VBDTCAST(uint16_t)strlen(str) + 1;
+
+	fmt = kmem_zalloc(len, KM_SLEEP);
+	bcopy(str, fmt, len);
+
+	for (ndx = 0; ndx < state->dts_nformats; ndx++) {
+		if (state->dts_formats[ndx] == NULL) {
+			state->dts_formats[ndx] = fmt;
+			return (ndx + 1);
+		}
+	}
+
+	if (state->dts_nformats == USHRT_MAX) {
+		/*
+		 * This is only likely if a denial-of-service attack is being
+		 * attempted.  As such, it's okay to fail silently here.
+		 */
+		kmem_free(fmt, len);
+		return (0);
+	}
+
+	/*
+	 * For simplicity, we always resize the formats array to be exactly the
+	 * number of formats.
+	 */
+	ndx = state->dts_nformats++;
+	new = kmem_alloc((ndx + 1) * sizeof (char *), KM_SLEEP);
+
+	if (state->dts_formats != NULL) {
+		ASSERT(ndx != 0);
+		bcopy(state->dts_formats, new, ndx * sizeof (char *));
+		kmem_free(state->dts_formats, ndx * sizeof (char *));
+	}
+
+	state->dts_formats = new;
+	state->dts_formats[ndx] = fmt;
+
+	return (ndx + 1);
+}
+
+static void
+dtrace_format_remove(dtrace_state_t *state, uint16_t format)
+{
+	char *fmt;
+
+	ASSERT(state->dts_formats != NULL);
+	ASSERT(format <= state->dts_nformats);
+	ASSERT(state->dts_formats[format - 1] != NULL);
+
+	fmt = state->dts_formats[format - 1];
+	kmem_free(fmt, strlen(fmt) + 1);
+	state->dts_formats[format - 1] = NULL;
+}
+
+static void
+dtrace_format_destroy(dtrace_state_t *state)
+{
+	int i;
+
+	if (state->dts_nformats == 0) {
+		ASSERT(state->dts_formats == NULL);
+		return;
+	}
+
+	ASSERT(state->dts_formats != NULL);
+
+	for (i = 0; i < state->dts_nformats; i++) {
+		char *fmt = state->dts_formats[i];
+
+		if (fmt == NULL)
+			continue;
+
+		kmem_free(fmt, strlen(fmt) + 1);
+	}
+
+	kmem_free(state->dts_formats, state->dts_nformats * sizeof (char *));
+	state->dts_nformats = 0;
+	state->dts_formats = NULL;
+}
+
+/*
+ * DTrace Predicate Functions
+ */
+static dtrace_predicate_t *
+dtrace_predicate_create(dtrace_difo_t *dp)
+{
+	dtrace_predicate_t *pred;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(dp->dtdo_refcnt != 0);
+
+	pred = kmem_zalloc(sizeof (dtrace_predicate_t), KM_SLEEP);
+	pred->dtp_difo = dp;
+	pred->dtp_refcnt = 1;
+
+	if (!dtrace_difo_cacheable(dp))
+		return (pred);
+
+	if (dtrace_predcache_id == DTRACE_CACHEIDNONE) {
+		/*
+		 * This is only theoretically possible -- we have had 2^32
+		 * cacheable predicates on this machine.  We cannot allow any
+		 * more predicates to become cacheable:  as unlikely as it is,
+		 * there may be a thread caching a (now stale) predicate cache
+		 * ID. (N.B.: the temptation is being successfully resisted to
+		 * have this cmn_err() "Holy shit -- we executed this code!")
+		 */
+		return (pred);
+	}
+
+	pred->dtp_cacheid = dtrace_predcache_id++;
+
+	return (pred);
+}
+
+static void
+dtrace_predicate_hold(dtrace_predicate_t *pred)
+{
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(pred->dtp_difo != NULL && pred->dtp_difo->dtdo_refcnt != 0);
+	ASSERT(pred->dtp_refcnt > 0);
+
+	pred->dtp_refcnt++;
+}
+
+static void
+dtrace_predicate_release(dtrace_predicate_t *pred, dtrace_vstate_t *vstate)
+{
+	dtrace_difo_t *dp = pred->dtp_difo;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(dp != NULL && dp->dtdo_refcnt != 0);
+	ASSERT(pred->dtp_refcnt > 0);
+
+	if (--pred->dtp_refcnt == 0) {
+		dtrace_difo_release(pred->dtp_difo, vstate);
+		kmem_free(pred, sizeof (dtrace_predicate_t));
+	}
+}
+
+/*
+ * DTrace Action Description Functions
+ */
+static dtrace_actdesc_t *
+dtrace_actdesc_create(dtrace_actkind_t kind, uint32_t ntuple,
+    uint64_t uarg, uint64_t arg)
+{
+	dtrace_actdesc_t *act;
+
+	ASSERT(!DTRACEACT_ISPRINTFLIKE(kind) || (arg != NULL &&
+	    VBDT_IS_VALID_KRNL_ADDR(arg)) || (arg == NULL && kind == DTRACEACT_PRINTA));
+
+	act = kmem_zalloc(sizeof (dtrace_actdesc_t), KM_SLEEP);
+	act->dtad_kind = kind;
+	act->dtad_ntuple = ntuple;
+	act->dtad_uarg = uarg;
+	act->dtad_arg = arg;
+	act->dtad_refcnt = 1;
+
+	return (act);
+}
+
+static void
+dtrace_actdesc_hold(dtrace_actdesc_t *act)
+{
+	ASSERT(act->dtad_refcnt >= 1);
+	act->dtad_refcnt++;
+}
+
+static void
+dtrace_actdesc_release(dtrace_actdesc_t *act, dtrace_vstate_t *vstate)
+{
+	dtrace_actkind_t kind = act->dtad_kind;
+	dtrace_difo_t *dp;
+
+	ASSERT(act->dtad_refcnt >= 1);
+
+	if (--act->dtad_refcnt != 0)
+		return;
+
+	if ((dp = act->dtad_difo) != NULL)
+		dtrace_difo_release(dp, vstate);
+
+	if (DTRACEACT_ISPRINTFLIKE(kind)) {
+		char *str = (char *)(uintptr_t)act->dtad_arg;
+
+		ASSERT((str != NULL && VBDT_IS_VALID_KRNL_ADDR((uintptr_t)str)) ||
+		    (str == NULL && act->dtad_kind == DTRACEACT_PRINTA));
+
+		if (str != NULL)
+			kmem_free(str, strlen(str) + 1);
+	}
+
+	kmem_free(act, sizeof (dtrace_actdesc_t));
+}
+
+/*
+ * DTrace ECB Functions
+ */
+static dtrace_ecb_t *
+dtrace_ecb_add(dtrace_state_t *state, dtrace_probe_t *probe)
+{
+	dtrace_ecb_t *ecb;
+	dtrace_epid_t epid;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	ecb = kmem_zalloc(sizeof (dtrace_ecb_t), KM_SLEEP);
+	ecb->dte_predicate = NULL;
+	ecb->dte_probe = probe;
+
+	/*
+	 * The default size is the size of the default action: recording
+	 * the epid.
+	 */
+	ecb->dte_size = ecb->dte_needed = sizeof (dtrace_epid_t);
+	ecb->dte_alignment = sizeof (dtrace_epid_t);
+
+	epid = state->dts_epid++;
+
+	if (VBDTCAST(int64_t)epid - 1 >= state->dts_necbs) {
+		dtrace_ecb_t **oecbs = state->dts_ecbs, **ecbs;
+		int necbs = state->dts_necbs << 1;
+
+		ASSERT(epid == VBDTCAST(dtrace_epid_t)state->dts_necbs + 1);
+
+		if (necbs == 0) {
+			ASSERT(oecbs == NULL);
+			necbs = 1;
+		}
+
+		ecbs = kmem_zalloc(necbs * sizeof (*ecbs), KM_SLEEP);
+
+		if (oecbs != NULL)
+			bcopy(oecbs, ecbs, state->dts_necbs * sizeof (*ecbs));
+
+		dtrace_membar_producer();
+		state->dts_ecbs = ecbs;
+
+		if (oecbs != NULL) {
+			/*
+			 * If this state is active, we must dtrace_sync()
+			 * before we can free the old dts_ecbs array:  we're
+			 * coming in hot, and there may be active ring
+			 * buffer processing (which indexes into the dts_ecbs
+			 * array) on another CPU.
+			 */
+			if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE)
+				dtrace_sync();
+
+			kmem_free(oecbs, state->dts_necbs * sizeof (*ecbs));
+		}
+
+		dtrace_membar_producer();
+		state->dts_necbs = necbs;
+	}
+
+	ecb->dte_state = state;
+
+	ASSERT(state->dts_ecbs[epid - 1] == NULL);
+	dtrace_membar_producer();
+	state->dts_ecbs[(ecb->dte_epid = epid) - 1] = ecb;
+
+	return (ecb);
+}
+
+static int
+dtrace_ecb_enable(dtrace_ecb_t *ecb)
+{
+	dtrace_probe_t *probe = ecb->dte_probe;
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(ecb->dte_next == NULL);
+
+	if (probe == NULL) {
+		/*
+		 * This is the NULL probe -- there's nothing to do.
+		 */
+		return (0);
+	}
+
+	if (probe->dtpr_ecb == NULL) {
+		dtrace_provider_t *prov = probe->dtpr_provider;
+
+		/*
+		 * We're the first ECB on this probe.
+		 */
+		probe->dtpr_ecb = probe->dtpr_ecb_last = ecb;
+
+		if (ecb->dte_predicate != NULL)
+			probe->dtpr_predcache = ecb->dte_predicate->dtp_cacheid;
+
+		return (prov->dtpv_pops.dtps_enable(prov->dtpv_arg,
+		    probe->dtpr_id, probe->dtpr_arg));
+	} else {
+		/*
+		 * This probe is already active.  Swing the last pointer to
+		 * point to the new ECB, and issue a dtrace_sync() to assure
+		 * that all CPUs have seen the change.
+		 */
+		ASSERT(probe->dtpr_ecb_last != NULL);
+		probe->dtpr_ecb_last->dte_next = ecb;
+		probe->dtpr_ecb_last = ecb;
+		probe->dtpr_predcache = 0;
+
+		dtrace_sync();
+		return (0);
+	}
+}
+
+static void
+dtrace_ecb_resize(dtrace_ecb_t *ecb)
+{
+	uint32_t maxalign = sizeof (dtrace_epid_t);
+	uint32_t align = sizeof (uint8_t), offs, diff;
+	dtrace_action_t *act;
+	int wastuple = 0;
+	uint32_t aggbase = UINT32_MAX;
+	dtrace_state_t *state = ecb->dte_state;
+
+	/*
+	 * If we record anything, we always record the epid.  (And we always
+	 * record it first.)
+	 */
+	offs = sizeof (dtrace_epid_t);
+	ecb->dte_size = ecb->dte_needed = sizeof (dtrace_epid_t);
+
+	for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
+		dtrace_recdesc_t *rec = &act->dta_rec;
+
+		if ((align = rec->dtrd_alignment) > maxalign)
+			maxalign = align;
+
+		if (!wastuple && act->dta_intuple) {
+			/*
+			 * This is the first record in a tuple.  Align the
+			 * offset to be at offset 4 in an 8-byte aligned
+			 * block.
+			 */
+			diff = offs + sizeof (dtrace_aggid_t);
+
+			if ((diff = (diff & (sizeof (uint64_t) - 1))))
+				offs += sizeof (uint64_t) - diff;
+
+			aggbase = offs - sizeof (dtrace_aggid_t);
+			ASSERT(!(aggbase & (sizeof (uint64_t) - 1)));
+		}
+
+		/*LINTED*/
+		if (rec->dtrd_size != 0 && (diff = (offs & (align - 1)))) {
+			/*
+			 * The current offset is not properly aligned; align it.
+			 */
+			offs += align - diff;
+		}
+
+		rec->dtrd_offset = offs;
+
+		if (offs + rec->dtrd_size > ecb->dte_needed) {
+			ecb->dte_needed = offs + rec->dtrd_size;
+
+			if (ecb->dte_needed > state->dts_needed)
+				state->dts_needed = ecb->dte_needed;
+		}
+
+		if (DTRACEACT_ISAGG(act->dta_kind)) {
+			dtrace_aggregation_t *agg = (dtrace_aggregation_t *)act;
+			dtrace_action_t *first = agg->dtag_first, *prev;
+
+			ASSERT(rec->dtrd_size != 0 && first != NULL);
+			ASSERT(wastuple);
+			ASSERT(aggbase != UINT32_MAX);
+
+			agg->dtag_base = aggbase;
+
+			while ((prev = first->dta_prev) != NULL &&
+			    DTRACEACT_ISAGG(prev->dta_kind)) {
+				agg = (dtrace_aggregation_t *)prev;
+				first = agg->dtag_first;
+			}
+
+			if (prev != NULL) {
+				offs = prev->dta_rec.dtrd_offset +
+				    prev->dta_rec.dtrd_size;
+			} else {
+				offs = sizeof (dtrace_epid_t);
+			}
+			wastuple = 0;
+		} else {
+			if (!act->dta_intuple)
+				ecb->dte_size = offs + rec->dtrd_size;
+
+			offs += rec->dtrd_size;
+		}
+
+		wastuple = act->dta_intuple;
+	}
+
+	if ((act = ecb->dte_action) != NULL &&
+	    !(act->dta_kind == DTRACEACT_SPECULATE && act->dta_next == NULL) &&
+	    ecb->dte_size == sizeof (dtrace_epid_t)) {
+		/*
+		 * If the size is still sizeof (dtrace_epid_t), then all
+		 * actions store no data; set the size to 0.
+		 */
+		ecb->dte_alignment = maxalign;
+		ecb->dte_size = 0;
+
+		/*
+		 * If the needed space is still sizeof (dtrace_epid_t), then
+		 * all actions need no additional space; set the needed
+		 * size to 0.
+		 */
+		if (ecb->dte_needed == sizeof (dtrace_epid_t))
+			ecb->dte_needed = 0;
+
+		return;
+	}
+
+	/*
+	 * Set our alignment, and make sure that the dte_size and dte_needed
+	 * are aligned to the size of an EPID.
+	 */
+	ecb->dte_alignment = maxalign;
+	ecb->dte_size = (ecb->dte_size + (sizeof (dtrace_epid_t) - 1)) &
+	    ~(sizeof (dtrace_epid_t) - 1);
+	ecb->dte_needed = (ecb->dte_needed + (sizeof (dtrace_epid_t) - 1)) &
+	    ~(sizeof (dtrace_epid_t) - 1);
+	ASSERT(ecb->dte_size <= ecb->dte_needed);
+}
+
+static dtrace_action_t *
+dtrace_ecb_aggregation_create(dtrace_ecb_t *ecb, dtrace_actdesc_t *desc)
+{
+	dtrace_aggregation_t *agg;
+	size_t size = sizeof (uint64_t);
+	int ntuple = desc->dtad_ntuple;
+	dtrace_action_t *act;
+	dtrace_recdesc_t *frec;
+	dtrace_aggid_t aggid;
+	dtrace_state_t *state = ecb->dte_state;
+
+	agg = kmem_zalloc(sizeof (dtrace_aggregation_t), KM_SLEEP);
+	agg->dtag_ecb = ecb;
+
+	ASSERT(DTRACEACT_ISAGG(desc->dtad_kind));
+
+	switch (desc->dtad_kind) {
+	case DTRACEAGG_MIN:
+		agg->dtag_initial = INT64_MAX;
+		agg->dtag_aggregate = dtrace_aggregate_min;
+		break;
+
+	case DTRACEAGG_MAX:
+		agg->dtag_initial = INT64_MIN;
+		agg->dtag_aggregate = dtrace_aggregate_max;
+		break;
+
+	case DTRACEAGG_COUNT:
+		agg->dtag_aggregate = dtrace_aggregate_count;
+		break;
+
+	case DTRACEAGG_QUANTIZE:
+		agg->dtag_aggregate = dtrace_aggregate_quantize;
+		size = (((sizeof (uint64_t) * NBBY) - 1) * 2 + 1) *
+		    sizeof (uint64_t);
+		break;
+
+	case DTRACEAGG_LQUANTIZE: {
+		uint16_t step = DTRACE_LQUANTIZE_STEP(desc->dtad_arg);
+		uint16_t levels = DTRACE_LQUANTIZE_LEVELS(desc->dtad_arg);
+
+		agg->dtag_initial = desc->dtad_arg;
+		agg->dtag_aggregate = dtrace_aggregate_lquantize;
+
+		if (step == 0 || levels == 0)
+			goto err;
+
+		size = levels * sizeof (uint64_t) + 3 * sizeof (uint64_t);
+		break;
+	}
+
+	case DTRACEAGG_AVG:
+		agg->dtag_aggregate = dtrace_aggregate_avg;
+		size = sizeof (uint64_t) * 2;
+		break;
+
+	case DTRACEAGG_STDDEV:
+		agg->dtag_aggregate = dtrace_aggregate_stddev;
+		size = sizeof (uint64_t) * 4;
+		break;
+
+	case DTRACEAGG_SUM:
+		agg->dtag_aggregate = dtrace_aggregate_sum;
+		break;
+
+	default:
+		goto err;
+	}
+
+	agg->dtag_action.dta_rec.dtrd_size = VBDTCAST(uint32_t)size;
+
+	if (ntuple == 0)
+		goto err;
+
+	/*
+	 * We must make sure that we have enough actions for the n-tuple.
+	 */
+	for (act = ecb->dte_action_last; act != NULL; act = act->dta_prev) {
+		if (DTRACEACT_ISAGG(act->dta_kind))
+			break;
+
+		if (--ntuple == 0) {
+			/*
+			 * This is the action with which our n-tuple begins.
+			 */
+			agg->dtag_first = act;
+			goto success;
+		}
+	}
+
+	/*
+	 * This n-tuple is short by ntuple elements.  Return failure.
+	 */
+	ASSERT(ntuple != 0);
+err:
+	kmem_free(agg, sizeof (dtrace_aggregation_t));
+	return (NULL);
+
+success:
+	/*
+	 * If the last action in the tuple has a size of zero, it's actually
+	 * an expression argument for the aggregating action.
+	 */
+	ASSERT(ecb->dte_action_last != NULL);
+	act = ecb->dte_action_last;
+
+	if (act->dta_kind == DTRACEACT_DIFEXPR) {
+		ASSERT(act->dta_difo != NULL);
+
+		if (act->dta_difo->dtdo_rtype.dtdt_size == 0)
+			agg->dtag_hasarg = 1;
+	}
+
+	/*
+	 * We need to allocate an id for this aggregation.
+	 */
+	aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1,
+	    VM_BESTFIT | VM_SLEEP);
+
+	if (VBDTCAST(int64_t)aggid - 1 >= state->dts_naggregations) {
+		dtrace_aggregation_t **oaggs = state->dts_aggregations;
+		dtrace_aggregation_t **aggs;
+		int naggs = state->dts_naggregations << 1;
+		int onaggs = state->dts_naggregations;
+
+		ASSERT(aggid == VBDTCAST(dtrace_aggid_t)state->dts_naggregations + 1);
+
+		if (naggs == 0) {
+			ASSERT(oaggs == NULL);
+			naggs = 1;
+		}
+
+		aggs = kmem_zalloc(naggs * sizeof (*aggs), KM_SLEEP);
+
+		if (oaggs != NULL) {
+			bcopy(oaggs, aggs, onaggs * sizeof (*aggs));
+			kmem_free(oaggs, onaggs * sizeof (*aggs));
+		}
+
+		state->dts_aggregations = aggs;
+		state->dts_naggregations = naggs;
+	}
+
+	ASSERT(state->dts_aggregations[aggid - 1] == NULL);
+	state->dts_aggregations[(agg->dtag_id = aggid) - 1] = agg;
+
+	frec = &agg->dtag_first->dta_rec;
+	if (frec->dtrd_alignment < sizeof (dtrace_aggid_t))
+		frec->dtrd_alignment = sizeof (dtrace_aggid_t);
+
+	for (act = agg->dtag_first; act != NULL; act = act->dta_next) {
+		ASSERT(!act->dta_intuple);
+		act->dta_intuple = 1;
+	}
+
+	return (&agg->dtag_action);
+}
+
+static void
+dtrace_ecb_aggregation_destroy(dtrace_ecb_t *ecb, dtrace_action_t *act)
+{
+	dtrace_aggregation_t *agg = (dtrace_aggregation_t *)act;
+	dtrace_state_t *state = ecb->dte_state;
+	dtrace_aggid_t aggid = agg->dtag_id;
+
+	ASSERT(DTRACEACT_ISAGG(act->dta_kind));
+	vmem_free(state->dts_aggid_arena, (void *)(uintptr_t)aggid, 1);
+
+	ASSERT(state->dts_aggregations[aggid - 1] == agg);
+	state->dts_aggregations[aggid - 1] = NULL;
+
+	kmem_free(agg, sizeof (dtrace_aggregation_t));
+}
+
+static int
+dtrace_ecb_action_add(dtrace_ecb_t *ecb, dtrace_actdesc_t *desc)
+{
+	dtrace_action_t *action, *last;
+	dtrace_difo_t *dp = desc->dtad_difo;
+	uint32_t size = 0, align = sizeof (uint8_t), mask;
+	uint16_t format = 0;
+	dtrace_recdesc_t *rec;
+	dtrace_state_t *state = ecb->dte_state;
+	dtrace_optval_t *opt = state->dts_options, nframes VBDTUNASS(0), strsize;
+	uint64_t arg = desc->dtad_arg;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(ecb->dte_action == NULL || ecb->dte_action->dta_refcnt == 1);
+
+	if (DTRACEACT_ISAGG(desc->dtad_kind)) {
+		/*
+		 * If this is an aggregating action, there must be neither
+		 * a speculate nor a commit on the action chain.
+		 */
+		dtrace_action_t *act;
+
+		for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
+			if (act->dta_kind == DTRACEACT_COMMIT)
+				return (EINVAL);
+
+			if (act->dta_kind == DTRACEACT_SPECULATE)
+				return (EINVAL);
+		}
+
+		action = dtrace_ecb_aggregation_create(ecb, desc);
+
+		if (action == NULL)
+			return (EINVAL);
+	} else {
+		if (DTRACEACT_ISDESTRUCTIVE(desc->dtad_kind) ||
+		    (desc->dtad_kind == DTRACEACT_DIFEXPR &&
+		    dp != NULL && dp->dtdo_destructive)) {
+			state->dts_destructive = 1;
+		}
+
+		switch (desc->dtad_kind) {
+		case DTRACEACT_PRINTF:
+		case DTRACEACT_PRINTA:
+		case DTRACEACT_SYSTEM:
+		case DTRACEACT_FREOPEN:
+			/*
+			 * We know that our arg is a string -- turn it into a
+			 * format.
+			 */
+			if (arg == NULL) {
+				ASSERT(desc->dtad_kind == DTRACEACT_PRINTA);
+				format = 0;
+			} else {
+				ASSERT(arg != NULL);
+				ASSERT(VBDT_IS_VALID_KRNL_ADDR(arg));
+				format = dtrace_format_add(state,
+				    (char *)(uintptr_t)arg);
+			}
+
+			/*FALLTHROUGH*/
+		case DTRACEACT_LIBACT:
+		case DTRACEACT_DIFEXPR:
+			if (dp == NULL)
+				return (EINVAL);
+
+			if ((size = dp->dtdo_rtype.dtdt_size) != 0)
+				break;
+
+			if (dp->dtdo_rtype.dtdt_kind == DIF_TYPE_STRING) {
+				if (!(dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF))
+					return (EINVAL);
+
+				size = opt[DTRACEOPT_STRSIZE];
+			}
+
+			break;
+
+		case DTRACEACT_STACK:
+			if ((nframes = arg) == 0) {
+				nframes = opt[DTRACEOPT_STACKFRAMES];
+				ASSERT(nframes > 0);
+				arg = nframes;
+			}
+
+			size = VBDTCAST(uint32_t)(nframes * sizeof (pc_t));
+			break;
+
+		case DTRACEACT_JSTACK:
+			if ((strsize = DTRACE_USTACK_STRSIZE(arg)) == 0)
+				strsize = opt[DTRACEOPT_JSTACKSTRSIZE];
+
+			if ((nframes = DTRACE_USTACK_NFRAMES(arg)) == 0)
+				nframes = opt[DTRACEOPT_JSTACKFRAMES];
+
+			arg = DTRACE_USTACK_ARG(nframes, strsize);
+
+			/*FALLTHROUGH*/
+		case DTRACEACT_USTACK:
+			if (desc->dtad_kind != DTRACEACT_JSTACK &&
+			    (nframes = DTRACE_USTACK_NFRAMES(arg)) == 0) {
+				strsize = DTRACE_USTACK_STRSIZE(arg);
+				nframes = opt[DTRACEOPT_USTACKFRAMES];
+				ASSERT(nframes > 0);
+				arg = DTRACE_USTACK_ARG(nframes, strsize);
+			}
+
+			/*
+			 * Save a slot for the pid.
+			 */
+			size = VBDTCAST(uint32_t)((nframes + 1) * sizeof (uint64_t));
+			size += DTRACE_USTACK_STRSIZE(arg);
+			size = P2ROUNDUP(size, (uint32_t)(sizeof (uintptr_t)));
+
+			break;
+
+		case DTRACEACT_SYM:
+		case DTRACEACT_MOD:
+			if (dp == NULL || ((size = dp->dtdo_rtype.dtdt_size) !=
+			    sizeof (uint64_t)) ||
+			    (dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF))
+				return (EINVAL);
+			break;
+
+		case DTRACEACT_USYM:
+		case DTRACEACT_UMOD:
+		case DTRACEACT_UADDR:
+			if (dp == NULL ||
+			    (dp->dtdo_rtype.dtdt_size != sizeof (uint64_t)) ||
+			    (dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF))
+				return (EINVAL);
+
+			/*
+			 * We have a slot for the pid, plus a slot for the
+			 * argument.  To keep things simple (aligned with
+			 * bitness-neutral sizing), we store each as a 64-bit
+			 * quantity.
+			 */
+			size = 2 * sizeof (uint64_t);
+			break;
+
+		case DTRACEACT_STOP:
+		case DTRACEACT_BREAKPOINT:
+		case DTRACEACT_PANIC:
+			break;
+
+		case DTRACEACT_CHILL:
+		case DTRACEACT_DISCARD:
+		case DTRACEACT_RAISE:
+			if (dp == NULL)
+				return (EINVAL);
+			break;
+
+		case DTRACEACT_EXIT:
+			if (dp == NULL ||
+			    (size = dp->dtdo_rtype.dtdt_size) != sizeof (int) ||
+			    (dp->dtdo_rtype.dtdt_flags & DIF_TF_BYREF))
+				return (EINVAL);
+			break;
+
+		case DTRACEACT_SPECULATE:
+			if (ecb->dte_size > sizeof (dtrace_epid_t))
+				return (EINVAL);
+
+			if (dp == NULL)
+				return (EINVAL);
+
+			state->dts_speculates = 1;
+			break;
+
+		case DTRACEACT_COMMIT: {
+			dtrace_action_t *act = ecb->dte_action;
+
+			for (; act != NULL; act = act->dta_next) {
+				if (act->dta_kind == DTRACEACT_COMMIT)
+					return (EINVAL);
+			}
+
+			if (dp == NULL)
+				return (EINVAL);
+			break;
+		}
+
+		default:
+			return (EINVAL);
+		}
+
+		if (size != 0 || desc->dtad_kind == DTRACEACT_SPECULATE) {
+			/*
+			 * If this is a data-storing action or a speculate,
+			 * we must be sure that there isn't a commit on the
+			 * action chain.
+			 */
+			dtrace_action_t *act = ecb->dte_action;
+
+			for (; act != NULL; act = act->dta_next) {
+				if (act->dta_kind == DTRACEACT_COMMIT)
+					return (EINVAL);
+			}
+		}
+
+		action = kmem_zalloc(sizeof (dtrace_action_t), KM_SLEEP);
+		action->dta_rec.dtrd_size = size;
+	}
+
+	action->dta_refcnt = 1;
+	rec = &action->dta_rec;
+	size = rec->dtrd_size;
+
+	for (mask = sizeof (uint64_t) - 1; size != 0 && mask > 0; mask >>= 1) {
+		if (!(size & mask)) {
+			align = mask + 1;
+			break;
+		}
+	}
+
+	action->dta_kind = desc->dtad_kind;
+
+	if ((action->dta_difo = dp) != NULL)
+		dtrace_difo_hold(dp);
+
+	rec->dtrd_action = action->dta_kind;
+	rec->dtrd_arg = arg;
+	rec->dtrd_uarg = desc->dtad_uarg;
+	rec->dtrd_alignment = (uint16_t)align;
+	rec->dtrd_format = format;
+
+	if ((last = ecb->dte_action_last) != NULL) {
+		ASSERT(ecb->dte_action != NULL);
+		action->dta_prev = last;
+		last->dta_next = action;
+	} else {
+		ASSERT(ecb->dte_action == NULL);
+		ecb->dte_action = action;
+	}
+
+	ecb->dte_action_last = action;
+
+	return (0);
+}
+
+static void
+dtrace_ecb_action_remove(dtrace_ecb_t *ecb)
+{
+	dtrace_action_t *act = ecb->dte_action, *next;
+	dtrace_vstate_t *vstate = &ecb->dte_state->dts_vstate;
+	dtrace_difo_t *dp;
+	uint16_t format;
+
+	if (act != NULL && act->dta_refcnt > 1) {
+		ASSERT(act->dta_next == NULL || act->dta_next->dta_refcnt == 1);
+		act->dta_refcnt--;
+	} else {
+		for (; act != NULL; act = next) {
+			next = act->dta_next;
+			ASSERT(next != NULL || act == ecb->dte_action_last);
+			ASSERT(act->dta_refcnt == 1);
+
+			if ((format = act->dta_rec.dtrd_format) != 0)
+				dtrace_format_remove(ecb->dte_state, format);
+
+			if ((dp = act->dta_difo) != NULL)
+				dtrace_difo_release(dp, vstate);
+
+			if (DTRACEACT_ISAGG(act->dta_kind)) {
+				dtrace_ecb_aggregation_destroy(ecb, act);
+			} else {
+				kmem_free(act, sizeof (dtrace_action_t));
+			}
+		}
+	}
+
+	ecb->dte_action = NULL;
+	ecb->dte_action_last = NULL;
+	ecb->dte_size = sizeof (dtrace_epid_t);
+}
+
+static void
+dtrace_ecb_disable(dtrace_ecb_t *ecb)
+{
+	/*
+	 * We disable the ECB by removing it from its probe.
+	 */
+	dtrace_ecb_t *pecb, *prev = NULL;
+	dtrace_probe_t *probe = ecb->dte_probe;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (probe == NULL) {
+		/*
+		 * This is the NULL probe; there is nothing to disable.
+		 */
+		return;
+	}
+
+	for (pecb = probe->dtpr_ecb; pecb != NULL; pecb = pecb->dte_next) {
+		if (pecb == ecb)
+			break;
+		prev = pecb;
+	}
+
+	ASSERT(pecb != NULL);
+
+	if (prev == NULL) {
+		probe->dtpr_ecb = ecb->dte_next;
+	} else {
+		prev->dte_next = ecb->dte_next;
+	}
+
+	if (ecb == probe->dtpr_ecb_last) {
+		ASSERT(ecb->dte_next == NULL);
+		probe->dtpr_ecb_last = prev;
+	}
+
+	/*
+	 * The ECB has been disconnected from the probe; now sync to assure
+	 * that all CPUs have seen the change before returning.
+	 */
+	dtrace_sync();
+
+	if (probe->dtpr_ecb == NULL) {
+		/*
+		 * That was the last ECB on the probe; clear the predicate
+		 * cache ID for the probe, disable it and sync one more time
+		 * to assure that we'll never hit it again.
+		 */
+		dtrace_provider_t *prov = probe->dtpr_provider;
+
+		ASSERT(ecb->dte_next == NULL);
+		ASSERT(probe->dtpr_ecb_last == NULL);
+		probe->dtpr_predcache = DTRACE_CACHEIDNONE;
+		prov->dtpv_pops.dtps_disable(prov->dtpv_arg,
+		    probe->dtpr_id, probe->dtpr_arg);
+		dtrace_sync();
+	} else {
+		/*
+		 * There is at least one ECB remaining on the probe.  If there
+		 * is _exactly_ one, set the probe's predicate cache ID to be
+		 * the predicate cache ID of the remaining ECB.
+		 */
+		ASSERT(probe->dtpr_ecb_last != NULL);
+		ASSERT(probe->dtpr_predcache == DTRACE_CACHEIDNONE);
+
+		if (probe->dtpr_ecb == probe->dtpr_ecb_last) {
+			dtrace_predicate_t *p = probe->dtpr_ecb->dte_predicate;
+
+			ASSERT(probe->dtpr_ecb->dte_next == NULL);
+
+			if (p != NULL)
+				probe->dtpr_predcache = p->dtp_cacheid;
+		}
+
+		ecb->dte_next = NULL;
+	}
+}
+
+static void
+dtrace_ecb_destroy(dtrace_ecb_t *ecb)
+{
+	dtrace_state_t *state = ecb->dte_state;
+	dtrace_vstate_t *vstate = &state->dts_vstate;
+	dtrace_predicate_t *pred;
+	dtrace_epid_t epid = ecb->dte_epid;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(ecb->dte_next == NULL);
+	ASSERT(ecb->dte_probe == NULL || ecb->dte_probe->dtpr_ecb != ecb);
+
+	if ((pred = ecb->dte_predicate) != NULL)
+		dtrace_predicate_release(pred, vstate);
+
+	dtrace_ecb_action_remove(ecb);
+
+	ASSERT(state->dts_ecbs[epid - 1] == ecb);
+	state->dts_ecbs[epid - 1] = NULL;
+
+	kmem_free(ecb, sizeof (dtrace_ecb_t));
+}
+
+static dtrace_ecb_t *
+dtrace_ecb_create(dtrace_state_t *state, dtrace_probe_t *probe,
+    dtrace_enabling_t *enab)
+{
+	dtrace_ecb_t *ecb;
+	dtrace_predicate_t *pred;
+	dtrace_actdesc_t *act;
+	dtrace_provider_t *prov;
+	dtrace_ecbdesc_t *desc = enab->dten_current;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(state != NULL);
+
+	ecb = dtrace_ecb_add(state, probe);
+	ecb->dte_uarg = desc->dted_uarg;
+
+	if ((pred = desc->dted_pred.dtpdd_predicate) != NULL) {
+		dtrace_predicate_hold(pred);
+		ecb->dte_predicate = pred;
+	}
+
+	if (probe != NULL) {
+		/*
+		 * If the provider shows more leg than the consumer is old
+		 * enough to see, we need to enable the appropriate implicit
+		 * predicate bits to prevent the ecb from activating at
+		 * revealing times.
+		 *
+		 * Providers specifying DTRACE_PRIV_USER at register time
+		 * are stating that they need the /proc-style privilege
+		 * model to be enforced, and this is what DTRACE_COND_OWNER
+		 * and DTRACE_COND_ZONEOWNER will then do at probe time.
+		 */
+		prov = probe->dtpr_provider;
+		if (!(state->dts_cred.dcr_visible & DTRACE_CRV_ALLPROC) &&
+		    (prov->dtpv_priv.dtpp_flags & DTRACE_PRIV_USER))
+			ecb->dte_cond |= DTRACE_COND_OWNER;
+
+		if (!(state->dts_cred.dcr_visible & DTRACE_CRV_ALLZONE) &&
+		    (prov->dtpv_priv.dtpp_flags & DTRACE_PRIV_USER))
+			ecb->dte_cond |= DTRACE_COND_ZONEOWNER;
+
+		/*
+		 * If the provider shows us kernel innards and the user
+		 * is lacking sufficient privilege, enable the
+		 * DTRACE_COND_USERMODE implicit predicate.
+		 */
+		if (!(state->dts_cred.dcr_visible & DTRACE_CRV_KERNEL) &&
+		    (prov->dtpv_priv.dtpp_flags & DTRACE_PRIV_KERNEL))
+			ecb->dte_cond |= DTRACE_COND_USERMODE;
+	}
+
+	if (dtrace_ecb_create_cache != NULL) {
+		/*
+		 * If we have a cached ecb, we'll use its action list instead
+		 * of creating our own (saving both time and space).
+		 */
+		dtrace_ecb_t *cached = dtrace_ecb_create_cache;
+		dtrace_action_t *act2 = cached->dte_action;
+
+		if (act2 != NULL) {
+			ASSERT(act2->dta_refcnt > 0);
+			act2->dta_refcnt++;
+			ecb->dte_action = act2;
+			ecb->dte_action_last = cached->dte_action_last;
+			ecb->dte_needed = cached->dte_needed;
+			ecb->dte_size = cached->dte_size;
+			ecb->dte_alignment = cached->dte_alignment;
+		}
+
+		return (ecb);
+	}
+
+	for (act = desc->dted_action; act != NULL; act = act->dtad_next) {
+		if ((enab->dten_error = dtrace_ecb_action_add(ecb, act)) != 0) {
+			dtrace_ecb_destroy(ecb);
+			return (NULL);
+		}
+	}
+
+	dtrace_ecb_resize(ecb);
+
+	return (dtrace_ecb_create_cache = ecb);
+}
+
+static int
+dtrace_ecb_create_enable(dtrace_probe_t *probe, void *arg)
+{
+	dtrace_ecb_t *ecb;
+	dtrace_enabling_t *enab = arg;
+	dtrace_state_t *state = enab->dten_vstate->dtvs_state;
+
+	ASSERT(state != NULL);
+
+	if (probe != NULL && probe->dtpr_gen < enab->dten_probegen) {
+		/*
+		 * This probe was created in a generation for which this
+		 * enabling has previously created ECBs; we don't want to
+		 * enable it again, so just kick out.
+		 */
+		return (DTRACE_MATCH_NEXT);
+	}
+
+	if ((ecb = dtrace_ecb_create(state, probe, enab)) == NULL)
+		return (DTRACE_MATCH_DONE);
+
+	if (dtrace_ecb_enable(ecb) < 0)
+		return (DTRACE_MATCH_FAIL);
+
+	return (DTRACE_MATCH_NEXT);
+}
+
+static dtrace_ecb_t *
+dtrace_epid2ecb(dtrace_state_t *state, dtrace_epid_t id)
+{
+	dtrace_ecb_t *ecb; NOREF(ecb);
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (id == 0 || VBDTCAST(int64_t)id > state->dts_necbs)
+		return (NULL);
+
+	ASSERT(state->dts_necbs > 0 && state->dts_ecbs != NULL);
+	ASSERT((ecb = state->dts_ecbs[id - 1]) == NULL || ecb->dte_epid == id);
+
+	return (state->dts_ecbs[id - 1]);
+}
+
+static dtrace_aggregation_t *
+dtrace_aggid2agg(dtrace_state_t *state, dtrace_aggid_t id)
+{
+	dtrace_aggregation_t *agg; NOREF(agg);
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (id == 0 || VBDTCAST(int64_t)id > state->dts_naggregations)
+		return (NULL);
+
+	ASSERT(state->dts_naggregations > 0 && state->dts_aggregations != NULL);
+	ASSERT((agg = state->dts_aggregations[id - 1]) == NULL ||
+	    agg->dtag_id == id);
+
+	return (state->dts_aggregations[id - 1]);
+}
+
+/*
+ * DTrace Buffer Functions
+ *
+ * The following functions manipulate DTrace buffers.  Most of these functions
+ * are called in the context of establishing or processing consumer state;
+ * exceptions are explicitly noted.
+ */
+
+/*
+ * Note:  called from cross call context.  This function switches the two
+ * buffers on a given CPU.  The atomicity of this operation is assured by
+ * disabling interrupts while the actual switch takes place; the disabling of
+ * interrupts serializes the execution with any execution of dtrace_probe() on
+ * the same CPU.
+ */
+static void
+dtrace_buffer_switch(dtrace_buffer_t *buf)
+{
+	caddr_t tomax = buf->dtb_tomax;
+	caddr_t xamot = buf->dtb_xamot;
+	dtrace_icookie_t cookie;
+
+	ASSERT(!(buf->dtb_flags & DTRACEBUF_NOSWITCH));
+	ASSERT(!(buf->dtb_flags & DTRACEBUF_RING));
+
+	cookie = dtrace_interrupt_disable();
+	buf->dtb_tomax = xamot;
+	buf->dtb_xamot = tomax;
+	buf->dtb_xamot_drops = buf->dtb_drops;
+	buf->dtb_xamot_offset = buf->dtb_offset;
+	buf->dtb_xamot_errors = buf->dtb_errors;
+	buf->dtb_xamot_flags = buf->dtb_flags;
+	buf->dtb_offset = 0;
+	buf->dtb_drops = 0;
+	buf->dtb_errors = 0;
+	buf->dtb_flags &= ~(DTRACEBUF_ERROR | DTRACEBUF_DROPPED);
+	dtrace_interrupt_enable(cookie);
+}
+
+#ifdef VBOX
+static DECLCALLBACK(void) dtrace_buffer_switch_wrapper(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    dtrace_buffer_switch((dtrace_buffer_t *)pvUser1);
+    NOREF(pvUser2); NOREF(idCpu);
+}
+#endif
+
+/*
+ * Note:  called from cross call context.  This function activates a buffer
+ * on a CPU.  As with dtrace_buffer_switch(), the atomicity of the operation
+ * is guaranteed by the disabling of interrupts.
+ */
+static void
+dtrace_buffer_activate(dtrace_state_t *state)
+{
+	dtrace_buffer_t *buf;
+	dtrace_icookie_t cookie = dtrace_interrupt_disable();
+
+	buf = &state->dts_buffer[VBDT_GET_CPUID()];
+
+	if (buf->dtb_tomax != NULL) {
+		/*
+		 * We might like to assert that the buffer is marked inactive,
+		 * but this isn't necessarily true:  the buffer for the CPU
+		 * that processes the BEGIN probe has its buffer activated
+		 * manually.  In this case, we take the (harmless) action
+		 * re-clearing the bit INACTIVE bit.
+		 */
+		buf->dtb_flags &= ~DTRACEBUF_INACTIVE;
+	}
+
+	dtrace_interrupt_enable(cookie);
+}
+
+#ifdef VBOX
+static DECLCALLBACK(void) dtrace_buffer_activate_wrapper(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    dtrace_buffer_activate((dtrace_state_t *)pvUser1);
+    NOREF(pvUser2); NOREF(idCpu);
+}
+#endif
+
+static int
+dtrace_buffer_alloc(dtrace_buffer_t *bufs, size_t size, int flags,
+    processorid_t cpu)
+{
+#ifndef VBOX
+	cpu_t *cp;
+#else
+	RTCPUSET CpuSet;
+	unsigned iCpu;
+#endif
+	dtrace_buffer_t *buf;
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (VBDTCAST(int64_t)size > dtrace_nonroot_maxsize
+#ifndef VBOX
+	    && !PRIV_POLICY_CHOICE(CRED(), PRIV_ALL, B_FALSE)
+#endif
+	    )
+		return (EFBIG);
+
+#ifndef VBOX
+	cp = cpu_list;
+#else
+	RTMpGetSet(&CpuSet);
+#endif
+
+#ifndef VBOX
+	do {
+		if (cpu != DTRACE_CPUALL && cpu != cp->cpu_id)
+			continue;
+
+		buf = &bufs[cp->cpu_id];
+#else
+	for (iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++) {
+		if (   !RTCpuSetIsMember(&CpuSet, iCpu)
+		    || (cpu != (processorid_t)DTRACE_CPUALL && cpu != iCpu))
+			continue;
+
+		buf = &bufs[iCpu];
+#endif
+
+		/*
+		 * If there is already a buffer allocated for this CPU, it
+		 * is only possible that this is a DR event.  In this case,
+		 * the buffer size must match our specified size.
+		 */
+		if (buf->dtb_tomax != NULL) {
+			ASSERT(buf->dtb_size == size);
+			continue;
+		}
+
+		ASSERT(buf->dtb_xamot == NULL);
+
+		if ((buf->dtb_tomax = kmem_zalloc(size, KM_NOSLEEP)) == NULL)
+			goto err;
+
+		buf->dtb_size = size;
+		buf->dtb_flags = flags;
+		buf->dtb_offset = 0;
+		buf->dtb_drops = 0;
+
+		if (flags & DTRACEBUF_NOSWITCH)
+			continue;
+
+		if ((buf->dtb_xamot = kmem_zalloc(size, KM_NOSLEEP)) == NULL)
+			goto err;
+#ifndef VBOX
+	} while ((cp = cp->cpu_next) != cpu_list);
+#else
+	}
+#endif
+
+	return (0);
+
+err:
+#ifndef VBOX
+	cp = cpu_list;
+
+	do {
+		if (cpu != DTRACE_CPUALL && cpu != cp->cpu_id)
+			continue;
+
+		buf = &bufs[cp->cpu_id];
+#else
+		for (iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++) {
+			if (   !RTCpuSetIsMember(&CpuSet, iCpu)
+				|| (cpu != (processorid_t)DTRACE_CPUALL && cpu != iCpu))
+				continue;
+
+			buf = &bufs[iCpu];
+#endif
+
+		if (buf->dtb_xamot != NULL) {
+			ASSERT(buf->dtb_tomax != NULL);
+			ASSERT(buf->dtb_size == size);
+			kmem_free(buf->dtb_xamot, size);
+		}
+
+		if (buf->dtb_tomax != NULL) {
+			ASSERT(buf->dtb_size == size);
+			kmem_free(buf->dtb_tomax, size);
+		}
+
+		buf->dtb_tomax = NULL;
+		buf->dtb_xamot = NULL;
+		buf->dtb_size = 0;
+#ifndef VBOX
+	} while ((cp = cp->cpu_next) != cpu_list);
+#else
+	}
+#endif
+
+	return (ENOMEM);
+}
+
+/*
+ * Note:  called from probe context.  This function just increments the drop
+ * count on a buffer.  It has been made a function to allow for the
+ * possibility of understanding the source of mysterious drop counts.  (A
+ * problem for which one may be particularly disappointed that DTrace cannot
+ * be used to understand DTrace.)
+ */
+static void
+dtrace_buffer_drop(dtrace_buffer_t *buf)
+{
+	buf->dtb_drops++;
+}
+
+/*
+ * Note:  called from probe context.  This function is called to reserve space
+ * in a buffer.  If mstate is non-NULL, sets the scratch base and size in the
+ * mstate.  Returns the new offset in the buffer, or a negative value if an
+ * error has occurred.
+ */
+static intptr_t
+dtrace_buffer_reserve(dtrace_buffer_t *buf, size_t needed, size_t align,
+    dtrace_state_t *state, dtrace_mstate_t *mstate)
+{
+	intptr_t offs = buf->dtb_offset, soffs;
+	intptr_t woffs;
+	caddr_t tomax;
+	size_t total;
+
+	if (buf->dtb_flags & DTRACEBUF_INACTIVE)
+		return (-1);
+
+	if ((tomax = buf->dtb_tomax) == NULL) {
+		dtrace_buffer_drop(buf);
+		return (-1);
+	}
+
+	if (!(buf->dtb_flags & (DTRACEBUF_RING | DTRACEBUF_FILL))) {
+		while (offs & (align - 1)) {
+			/*
+			 * Assert that our alignment is off by a number which
+			 * is itself sizeof (uint32_t) aligned.
+			 */
+			ASSERT(!((align - (offs & (align - 1))) &
+			    (sizeof (uint32_t) - 1)));
+			DTRACE_STORE(uint32_t, tomax, offs, DTRACE_EPIDNONE);
+			offs += sizeof (uint32_t);
+		}
+
+		if (VBDTCAST(uintptr_t)(soffs = offs + needed) > buf->dtb_size) {
+			dtrace_buffer_drop(buf);
+			return (-1);
+		}
+
+		if (mstate == NULL)
+			return (offs);
+
+		mstate->dtms_scratch_base = (uintptr_t)tomax + soffs;
+		mstate->dtms_scratch_size = buf->dtb_size - soffs;
+		mstate->dtms_scratch_ptr = mstate->dtms_scratch_base;
+
+		return (offs);
+	}
+
+	if (buf->dtb_flags & DTRACEBUF_FILL) {
+		if (state->dts_activity != DTRACE_ACTIVITY_COOLDOWN &&
+		    (buf->dtb_flags & DTRACEBUF_FULL))
+			return (-1);
+		goto out;
+	}
+
+	total = needed + (offs & (align - 1));
+
+	/*
+	 * For a ring buffer, life is quite a bit more complicated.  Before
+	 * we can store any padding, we need to adjust our wrapping offset.
+	 * (If we've never before wrapped or we're not about to, no adjustment
+	 * is required.)
+	 */
+	if ((buf->dtb_flags & DTRACEBUF_WRAPPED) ||
+	    offs + total > buf->dtb_size) {
+		woffs = buf->dtb_xamot_offset;
+
+		if (offs + total > buf->dtb_size) {
+			/*
+			 * We can't fit in the end of the buffer.  First, a
+			 * sanity check that we can fit in the buffer at all.
+			 */
+			if (total > buf->dtb_size) {
+				dtrace_buffer_drop(buf);
+				return (-1);
+			}
+
+			/*
+			 * We're going to be storing at the top of the buffer,
+			 * so now we need to deal with the wrapped offset.  We
+			 * only reset our wrapped offset to 0 if it is
+			 * currently greater than the current offset.  If it
+			 * is less than the current offset, it is because a
+			 * previous allocation induced a wrap -- but the
+			 * allocation didn't subsequently take the space due
+			 * to an error or false predicate evaluation.  In this
+			 * case, we'll just leave the wrapped offset alone: if
+			 * the wrapped offset hasn't been advanced far enough
+			 * for this allocation, it will be adjusted in the
+			 * lower loop.
+			 */
+			if (buf->dtb_flags & DTRACEBUF_WRAPPED) {
+				if (woffs >= offs)
+					woffs = 0;
+			} else {
+				woffs = 0;
+			}
+
+			/*
+			 * Now we know that we're going to be storing to the
+			 * top of the buffer and that there is room for us
+			 * there.  We need to clear the buffer from the current
+			 * offset to the end (there may be old gunk there).
+			 */
+			while (VBDTCAST(uintptr_t)offs < buf->dtb_size)
+				tomax[offs++] = 0;
+
+			/*
+			 * We need to set our offset to zero.  And because we
+			 * are wrapping, we need to set the bit indicating as
+			 * much.  We can also adjust our needed space back
+			 * down to the space required by the ECB -- we know
+			 * that the top of the buffer is aligned.
+			 */
+			offs = 0;
+			total = needed;
+			buf->dtb_flags |= DTRACEBUF_WRAPPED;
+		} else {
+			/*
+			 * There is room for us in the buffer, so we simply
+			 * need to check the wrapped offset.
+			 */
+			if (woffs < offs) {
+				/*
+				 * The wrapped offset is less than the offset.
+				 * This can happen if we allocated buffer space
+				 * that induced a wrap, but then we didn't
+				 * subsequently take the space due to an error
+				 * or false predicate evaluation.  This is
+				 * okay; we know that _this_ allocation isn't
+				 * going to induce a wrap.  We still can't
+				 * reset the wrapped offset to be zero,
+				 * however: the space may have been trashed in
+				 * the previous failed probe attempt.  But at
+				 * least the wrapped offset doesn't need to
+				 * be adjusted at all...
+				 */
+				goto out;
+			}
+		}
+
+		while (VBDTCAST(uintptr_t)offs + total > VBDTCAST(uintptr_t)woffs) {
+			dtrace_epid_t epid = *(uint32_t *)(tomax + woffs);
+			size_t size;
+
+			if (epid == DTRACE_EPIDNONE) {
+				size = sizeof (uint32_t);
+			} else {
+				ASSERT(VBDTCAST(int64_t)epid <= state->dts_necbs);
+				ASSERT(state->dts_ecbs[epid - 1] != NULL);
+
+				size = state->dts_ecbs[epid - 1]->dte_size;
+			}
+
+			ASSERT(woffs + size <= buf->dtb_size);
+			ASSERT(size != 0);
+
+			if (woffs + size == buf->dtb_size) {
+				/*
+				 * We've reached the end of the buffer; we want
+				 * to set the wrapped offset to 0 and break
+				 * out.  However, if the offs is 0, then we're
+				 * in a strange edge-condition:  the amount of
+				 * space that we want to reserve plus the size
+				 * of the record that we're overwriting is
+				 * greater than the size of the buffer.  This
+				 * is problematic because if we reserve the
+				 * space but subsequently don't consume it (due
+				 * to a failed predicate or error) the wrapped
+				 * offset will be 0 -- yet the EPID at offset 0
+				 * will not be committed.  This situation is
+				 * relatively easy to deal with:  if we're in
+				 * this case, the buffer is indistinguishable
+				 * from one that hasn't wrapped; we need only
+				 * finish the job by clearing the wrapped bit,
+				 * explicitly setting the offset to be 0, and
+				 * zero'ing out the old data in the buffer.
+				 */
+				if (offs == 0) {
+					buf->dtb_flags &= ~DTRACEBUF_WRAPPED;
+					buf->dtb_offset = 0;
+					woffs = total;
+
+					while (VBDTCAST(uintptr_t)woffs < buf->dtb_size)
+						tomax[woffs++] = 0;
+				}
+
+				woffs = 0;
+				break;
+			}
+
+			woffs += size;
+		}
+
+		/*
+		 * We have a wrapped offset.  It may be that the wrapped offset
+		 * has become zero -- that's okay.
+		 */
+		buf->dtb_xamot_offset = woffs;
+	}
+
+out:
+	/*
+	 * Now we can plow the buffer with any necessary padding.
+	 */
+	while (offs & (align - 1)) {
+		/*
+		 * Assert that our alignment is off by a number which
+		 * is itself sizeof (uint32_t) aligned.
+		 */
+		ASSERT(!((align - (offs & (align - 1))) &
+		    (sizeof (uint32_t) - 1)));
+		DTRACE_STORE(uint32_t, tomax, offs, DTRACE_EPIDNONE);
+		offs += sizeof (uint32_t);
+	}
+
+	if (buf->dtb_flags & DTRACEBUF_FILL) {
+		if (offs + needed > buf->dtb_size - state->dts_reserve) {
+			buf->dtb_flags |= DTRACEBUF_FULL;
+			return (-1);
+		}
+	}
+
+	if (mstate == NULL)
+		return (offs);
+
+	/*
+	 * For ring buffers and fill buffers, the scratch space is always
+	 * the inactive buffer.
+	 */
+	mstate->dtms_scratch_base = (uintptr_t)buf->dtb_xamot;
+	mstate->dtms_scratch_size = buf->dtb_size;
+	mstate->dtms_scratch_ptr = mstate->dtms_scratch_base;
+
+	return (offs);
+}
+
+static void
+dtrace_buffer_polish(dtrace_buffer_t *buf)
+{
+	ASSERT(buf->dtb_flags & DTRACEBUF_RING);
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (!(buf->dtb_flags & DTRACEBUF_WRAPPED))
+		return;
+
+	/*
+	 * We need to polish the ring buffer.  There are three cases:
+	 *
+	 * - The first (and presumably most common) is that there is no gap
+	 *   between the buffer offset and the wrapped offset.  In this case,
+	 *   there is nothing in the buffer that isn't valid data; we can
+	 *   mark the buffer as polished and return.
+	 *
+	 * - The second (less common than the first but still more common
+	 *   than the third) is that there is a gap between the buffer offset
+	 *   and the wrapped offset, and the wrapped offset is larger than the
+	 *   buffer offset.  This can happen because of an alignment issue, or
+	 *   can happen because of a call to dtrace_buffer_reserve() that
+	 *   didn't subsequently consume the buffer space.  In this case,
+	 *   we need to zero the data from the buffer offset to the wrapped
+	 *   offset.
+	 *
+	 * - The third (and least common) is that there is a gap between the
+	 *   buffer offset and the wrapped offset, but the wrapped offset is
+	 *   _less_ than the buffer offset.  This can only happen because a
+	 *   call to dtrace_buffer_reserve() induced a wrap, but the space
+	 *   was not subsequently consumed.  In this case, we need to zero the
+	 *   space from the offset to the end of the buffer _and_ from the
+	 *   top of the buffer to the wrapped offset.
+	 */
+	if (buf->dtb_offset < buf->dtb_xamot_offset) {
+		bzero(buf->dtb_tomax + buf->dtb_offset,
+		    buf->dtb_xamot_offset - buf->dtb_offset);
+	}
+
+	if (buf->dtb_offset > buf->dtb_xamot_offset) {
+		bzero(buf->dtb_tomax + buf->dtb_offset,
+		    buf->dtb_size - buf->dtb_offset);
+		bzero(buf->dtb_tomax, buf->dtb_xamot_offset);
+	}
+}
+
+static void
+dtrace_buffer_free(dtrace_buffer_t *bufs)
+{
+	int i;
+
+	for (i = 0; i < NCPU; i++) {
+		dtrace_buffer_t *buf = &bufs[i];
+
+		if (buf->dtb_tomax == NULL) {
+			ASSERT(buf->dtb_xamot == NULL);
+			ASSERT(buf->dtb_size == 0);
+			continue;
+		}
+
+		if (buf->dtb_xamot != NULL) {
+			ASSERT(!(buf->dtb_flags & DTRACEBUF_NOSWITCH));
+			kmem_free(buf->dtb_xamot, buf->dtb_size);
+		}
+
+		kmem_free(buf->dtb_tomax, buf->dtb_size);
+		buf->dtb_size = 0;
+		buf->dtb_tomax = NULL;
+		buf->dtb_xamot = NULL;
+	}
+}
+
+/*
+ * DTrace Enabling Functions
+ */
+static dtrace_enabling_t *
+dtrace_enabling_create(dtrace_vstate_t *vstate)
+{
+	dtrace_enabling_t *enab;
+
+	enab = kmem_zalloc(sizeof (dtrace_enabling_t), KM_SLEEP);
+	enab->dten_vstate = vstate;
+
+	return (enab);
+}
+
+static void
+dtrace_enabling_add(dtrace_enabling_t *enab, dtrace_ecbdesc_t *ecb)
+{
+	dtrace_ecbdesc_t **ndesc;
+	size_t osize, nsize;
+
+	/*
+	 * We can't add to enablings after we've enabled them, or after we've
+	 * retained them.
+	 */
+	ASSERT(enab->dten_probegen == 0);
+	ASSERT(enab->dten_next == NULL && enab->dten_prev == NULL);
+
+	if (enab->dten_ndesc < enab->dten_maxdesc) {
+		enab->dten_desc[enab->dten_ndesc++] = ecb;
+		return;
+	}
+
+	osize = enab->dten_maxdesc * sizeof (dtrace_enabling_t *);
+
+	if (enab->dten_maxdesc == 0) {
+		enab->dten_maxdesc = 1;
+	} else {
+		enab->dten_maxdesc <<= 1;
+	}
+
+	ASSERT(enab->dten_ndesc < enab->dten_maxdesc);
+
+	nsize = enab->dten_maxdesc * sizeof (dtrace_enabling_t *);
+	ndesc = kmem_zalloc(nsize, KM_SLEEP);
+	bcopy(enab->dten_desc, ndesc, osize);
+	kmem_free(enab->dten_desc, osize);
+
+	enab->dten_desc = ndesc;
+	enab->dten_desc[enab->dten_ndesc++] = ecb;
+}
+
+static void
+dtrace_enabling_addlike(dtrace_enabling_t *enab, dtrace_ecbdesc_t *ecb,
+    dtrace_probedesc_t *pd)
+{
+	dtrace_ecbdesc_t *new;
+	dtrace_predicate_t *pred;
+	dtrace_actdesc_t *act;
+
+	/*
+	 * We're going to create a new ECB description that matches the
+	 * specified ECB in every way, but has the specified probe description.
+	 */
+	new = kmem_zalloc(sizeof (dtrace_ecbdesc_t), KM_SLEEP);
+
+	if ((pred = ecb->dted_pred.dtpdd_predicate) != NULL)
+		dtrace_predicate_hold(pred);
+
+	for (act = ecb->dted_action; act != NULL; act = act->dtad_next)
+		dtrace_actdesc_hold(act);
+
+	new->dted_action = ecb->dted_action;
+	new->dted_pred = ecb->dted_pred;
+	new->dted_probe = *pd;
+	new->dted_uarg = ecb->dted_uarg;
+
+	dtrace_enabling_add(enab, new);
+}
+
+static void
+dtrace_enabling_dump(dtrace_enabling_t *enab)
+{
+	int i;
+
+	for (i = 0; i < enab->dten_ndesc; i++) {
+		dtrace_probedesc_t *desc = &enab->dten_desc[i]->dted_probe;
+
+		cmn_err(CE_NOTE, "enabling probe %d (%s:%s:%s:%s)", i,
+		    desc->dtpd_provider, desc->dtpd_mod,
+		    desc->dtpd_func, desc->dtpd_name);
+	}
+}
+
+static void
+dtrace_enabling_destroy(dtrace_enabling_t *enab)
+{
+	int i;
+	dtrace_ecbdesc_t *ep;
+	dtrace_vstate_t *vstate = enab->dten_vstate;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	for (i = 0; i < enab->dten_ndesc; i++) {
+		dtrace_actdesc_t *act, *next;
+		dtrace_predicate_t *pred;
+
+		ep = enab->dten_desc[i];
+
+		if ((pred = ep->dted_pred.dtpdd_predicate) != NULL)
+			dtrace_predicate_release(pred, vstate);
+
+		for (act = ep->dted_action; act != NULL; act = next) {
+			next = act->dtad_next;
+			dtrace_actdesc_release(act, vstate);
+		}
+
+		kmem_free(ep, sizeof (dtrace_ecbdesc_t));
+	}
+
+	kmem_free(enab->dten_desc,
+	    enab->dten_maxdesc * sizeof (dtrace_enabling_t *));
+
+	/*
+	 * If this was a retained enabling, decrement the dts_nretained count
+	 * and take it off of the dtrace_retained list.
+	 */
+	if (enab->dten_prev != NULL || enab->dten_next != NULL ||
+	    dtrace_retained == enab) {
+		ASSERT(enab->dten_vstate->dtvs_state != NULL);
+		ASSERT(enab->dten_vstate->dtvs_state->dts_nretained > 0);
+		enab->dten_vstate->dtvs_state->dts_nretained--;
+		dtrace_retained_gen++;
+	}
+
+	if (enab->dten_prev == NULL) {
+		if (dtrace_retained == enab) {
+			dtrace_retained = enab->dten_next;
+
+			if (dtrace_retained != NULL)
+				dtrace_retained->dten_prev = NULL;
+		}
+	} else {
+		ASSERT(enab != dtrace_retained);
+		ASSERT(dtrace_retained != NULL);
+		enab->dten_prev->dten_next = enab->dten_next;
+	}
+
+	if (enab->dten_next != NULL) {
+		ASSERT(dtrace_retained != NULL);
+		enab->dten_next->dten_prev = enab->dten_prev;
+	}
+
+	kmem_free(enab, sizeof (dtrace_enabling_t));
+}
+
+static int
+dtrace_enabling_retain(dtrace_enabling_t *enab)
+{
+	dtrace_state_t *state;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(enab->dten_next == NULL && enab->dten_prev == NULL);
+	ASSERT(enab->dten_vstate != NULL);
+
+	state = enab->dten_vstate->dtvs_state;
+	ASSERT(state != NULL);
+
+	/*
+	 * We only allow each state to retain dtrace_retain_max enablings.
+	 */
+	if (state->dts_nretained >= dtrace_retain_max)
+		return (ENOSPC);
+
+	state->dts_nretained++;
+	dtrace_retained_gen++;
+
+	if (dtrace_retained == NULL) {
+		dtrace_retained = enab;
+		return (0);
+	}
+
+	enab->dten_next = dtrace_retained;
+	dtrace_retained->dten_prev = enab;
+	dtrace_retained = enab;
+
+	return (0);
+}
+
+static int
+dtrace_enabling_replicate(dtrace_state_t *state, dtrace_probedesc_t *match,
+    dtrace_probedesc_t *create)
+{
+	dtrace_enabling_t *new, *enab;
+	int found = 0, err = ENOENT;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(strlen(match->dtpd_provider) < DTRACE_PROVNAMELEN);
+	ASSERT(strlen(match->dtpd_mod) < DTRACE_MODNAMELEN);
+	ASSERT(strlen(match->dtpd_func) < DTRACE_FUNCNAMELEN);
+	ASSERT(strlen(match->dtpd_name) < DTRACE_NAMELEN);
+
+	new = dtrace_enabling_create(&state->dts_vstate);
+
+	/*
+	 * Iterate over all retained enablings, looking for enablings that
+	 * match the specified state.
+	 */
+	for (enab = dtrace_retained; enab != NULL; enab = enab->dten_next) {
+		int i;
+
+		/*
+		 * dtvs_state can only be NULL for helper enablings -- and
+		 * helper enablings can't be retained.
+		 */
+		ASSERT(enab->dten_vstate->dtvs_state != NULL);
+
+		if (enab->dten_vstate->dtvs_state != state)
+			continue;
+
+		/*
+		 * Now iterate over each probe description; we're looking for
+		 * an exact match to the specified probe description.
+		 */
+		for (i = 0; i < enab->dten_ndesc; i++) {
+			dtrace_ecbdesc_t *ep = enab->dten_desc[i];
+			dtrace_probedesc_t *pd = &ep->dted_probe;
+
+			if (strcmp(pd->dtpd_provider, match->dtpd_provider))
+				continue;
+
+			if (strcmp(pd->dtpd_mod, match->dtpd_mod))
+				continue;
+
+			if (strcmp(pd->dtpd_func, match->dtpd_func))
+				continue;
+
+			if (strcmp(pd->dtpd_name, match->dtpd_name))
+				continue;
+
+			/*
+			 * We have a winning probe!  Add it to our growing
+			 * enabling.
+			 */
+			found = 1;
+			dtrace_enabling_addlike(new, ep, create);
+		}
+	}
+
+	if (!found || (err = dtrace_enabling_retain(new)) != 0) {
+		dtrace_enabling_destroy(new);
+		return (err);
+	}
+
+	return (0);
+}
+
+static void
+dtrace_enabling_retract(dtrace_state_t *state)
+{
+	dtrace_enabling_t *enab, *next;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	/*
+	 * Iterate over all retained enablings, destroy the enablings retained
+	 * for the specified state.
+	 */
+	for (enab = dtrace_retained; enab != NULL; enab = next) {
+		next = enab->dten_next;
+
+		/*
+		 * dtvs_state can only be NULL for helper enablings -- and
+		 * helper enablings can't be retained.
+		 */
+		ASSERT(enab->dten_vstate->dtvs_state != NULL);
+
+		if (enab->dten_vstate->dtvs_state == state) {
+			ASSERT(state->dts_nretained > 0);
+			dtrace_enabling_destroy(enab);
+		}
+	}
+
+	ASSERT(state->dts_nretained == 0);
+}
+
+static int
+dtrace_enabling_match(dtrace_enabling_t *enab, int *nmatched)
+{
+	int i = 0;
+	int total_matched = 0, matched = 0;
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	for (i = 0; i < enab->dten_ndesc; i++) {
+		dtrace_ecbdesc_t *ep = enab->dten_desc[i];
+
+		enab->dten_current = ep;
+		enab->dten_error = 0;
+
+		/*
+		 * If a provider failed to enable a probe then get out and
+		 * let the consumer know we failed.
+		 */
+		if ((matched = dtrace_probe_enable(&ep->dted_probe, enab)) < 0)
+			return (EBUSY);
+
+		total_matched += matched;
+
+		if (enab->dten_error != 0) {
+			/*
+			 * If we get an error half-way through enabling the
+			 * probes, we kick out -- perhaps with some number of
+			 * them enabled.  Leaving enabled probes enabled may
+			 * be slightly confusing for user-level, but we expect
+			 * that no one will attempt to actually drive on in
+			 * the face of such errors.  If this is an anonymous
+			 * enabling (indicated with a NULL nmatched pointer),
+			 * we cmn_err() a message.  We aren't expecting to
+			 * get such an error -- such as it can exist at all,
+			 * it would be a result of corrupted DOF in the driver
+			 * properties.
+			 */
+			if (nmatched == NULL) {
+				cmn_err(CE_WARN, "dtrace_enabling_match() "
+				    "error on %p: %d", (void *)ep,
+				    enab->dten_error);
+			}
+
+			return (enab->dten_error);
+		}
+	}
+
+	enab->dten_probegen = dtrace_probegen;
+	if (nmatched != NULL)
+		*nmatched = total_matched;
+
+	return (0);
+}
+
+static void
+dtrace_enabling_matchall(void)
+{
+	dtrace_enabling_t *enab;
+
+	mutex_enter(&cpu_lock);
+	mutex_enter(&dtrace_lock);
+
+	/*
+	 * Iterate over all retained enablings to see if any probes match
+	 * against them.  We only perform this operation on enablings for which
+	 * we have sufficient permissions by virtue of being in the global zone
+	 * or in the same zone as the DTrace client.  Because we can be called
+	 * after dtrace_detach() has been called, we cannot assert that there
+	 * are retained enablings.  We can safely load from dtrace_retained,
+	 * however:  the taskq_destroy() at the end of dtrace_detach() will
+	 * block pending our completion.
+	 */
+	for (enab = dtrace_retained; enab != NULL; enab = enab->dten_next) {
+		cred_t *cr = enab->dten_vstate->dtvs_state->dts_cred.dcr_cred;
+
+#ifndef VBOX
+		if (INGLOBALZONE(curproc) ||
+		    cr != NULL && getzoneid() == crgetzoneid(cr))
+#endif
+			(void) dtrace_enabling_match(enab, NULL);
+	}
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&cpu_lock);
+}
+
+/*
+ * If an enabling is to be enabled without having matched probes (that is, if
+ * dtrace_state_go() is to be called on the underlying dtrace_state_t), the
+ * enabling must be _primed_ by creating an ECB for every ECB description.
+ * This must be done to assure that we know the number of speculations, the
+ * number of aggregations, the minimum buffer size needed, etc. before we
+ * transition out of DTRACE_ACTIVITY_INACTIVE.  To do this without actually
+ * enabling any probes, we create ECBs for every ECB decription, but with a
+ * NULL probe -- which is exactly what this function does.
+ */
+static void
+dtrace_enabling_prime(dtrace_state_t *state)
+{
+	dtrace_enabling_t *enab;
+	int i;
+
+	for (enab = dtrace_retained; enab != NULL; enab = enab->dten_next) {
+		ASSERT(enab->dten_vstate->dtvs_state != NULL);
+
+		if (enab->dten_vstate->dtvs_state != state)
+			continue;
+
+		/*
+		 * We don't want to prime an enabling more than once, lest
+		 * we allow a malicious user to induce resource exhaustion.
+		 * (The ECBs that result from priming an enabling aren't
+		 * leaked -- but they also aren't deallocated until the
+		 * consumer state is destroyed.)
+		 */
+		if (enab->dten_primed)
+			continue;
+
+		for (i = 0; i < enab->dten_ndesc; i++) {
+			enab->dten_current = enab->dten_desc[i];
+			(void) dtrace_probe_enable(NULL, enab);
+		}
+
+		enab->dten_primed = 1;
+	}
+}
+
+/*
+ * Called to indicate that probes should be provided due to retained
+ * enablings.  This is implemented in terms of dtrace_probe_provide(), but it
+ * must take an initial lap through the enabling calling the dtps_provide()
+ * entry point explicitly to allow for autocreated probes.
+ */
+static void
+dtrace_enabling_provide(dtrace_provider_t *prv)
+{
+	int i, all = 0;
+	dtrace_probedesc_t desc;
+	dtrace_genid_t gen;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(MUTEX_HELD(&dtrace_provider_lock));
+
+	if (prv == NULL) {
+		all = 1;
+		prv = dtrace_provider;
+	}
+
+	do {
+		dtrace_enabling_t *enab;
+		void *parg = prv->dtpv_arg;
+
+retry:
+		gen = dtrace_retained_gen;
+		for (enab = dtrace_retained; enab != NULL;
+		    enab = enab->dten_next) {
+			for (i = 0; i < enab->dten_ndesc; i++) {
+				desc = enab->dten_desc[i]->dted_probe;
+				mutex_exit(&dtrace_lock);
+				prv->dtpv_pops.dtps_provide(parg, &desc);
+				mutex_enter(&dtrace_lock);
+				/*
+				 * Process the retained enablings again if
+				 * they have changed while we weren't holding
+				 * dtrace_lock.
+				 */
+				if (gen != dtrace_retained_gen)
+					goto retry;
+			}
+		}
+	} while (all && (prv = prv->dtpv_next) != NULL);
+
+	mutex_exit(&dtrace_lock);
+	dtrace_probe_provide(NULL, all ? NULL : prv);
+	mutex_enter(&dtrace_lock);
+}
+
+/*
+ * DTrace DOF Functions
+ */
+/*ARGSUSED*/
+static void
+dtrace_dof_error(dof_hdr_t *dof, const char *str)
+{
+	if (dtrace_err_verbose)
+		cmn_err(CE_WARN, "failed to process DOF: %s", str);
+
+#ifdef DTRACE_ERRDEBUG
+	dtrace_errdebug(str);
+#endif
+}
+
+/*
+ * Create DOF out of a currently enabled state.  Right now, we only create
+ * DOF containing the run-time options -- but this could be expanded to create
+ * complete DOF representing the enabled state.
+ */
+static dof_hdr_t *
+dtrace_dof_create(dtrace_state_t *state)
+{
+	dof_hdr_t *dof;
+	dof_sec_t *sec;
+	dof_optdesc_t *opt;
+	int i, len = sizeof (dof_hdr_t) +
+	    roundup(sizeof (dof_sec_t), sizeof (uint64_t)) +
+	    sizeof (dof_optdesc_t) * DTRACEOPT_MAX;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	dof = kmem_zalloc(len, KM_SLEEP);
+	dof->dofh_ident[DOF_ID_MAG0] = DOF_MAG_MAG0;
+	dof->dofh_ident[DOF_ID_MAG1] = DOF_MAG_MAG1;
+	dof->dofh_ident[DOF_ID_MAG2] = DOF_MAG_MAG2;
+	dof->dofh_ident[DOF_ID_MAG3] = DOF_MAG_MAG3;
+
+	dof->dofh_ident[DOF_ID_MODEL] = DOF_MODEL_NATIVE;
+	dof->dofh_ident[DOF_ID_ENCODING] = DOF_ENCODE_NATIVE;
+	dof->dofh_ident[DOF_ID_VERSION] = DOF_VERSION;
+	dof->dofh_ident[DOF_ID_DIFVERS] = DIF_VERSION;
+	dof->dofh_ident[DOF_ID_DIFIREG] = DIF_DIR_NREGS;
+	dof->dofh_ident[DOF_ID_DIFTREG] = DIF_DTR_NREGS;
+
+	dof->dofh_flags = 0;
+	dof->dofh_hdrsize = sizeof (dof_hdr_t);
+	dof->dofh_secsize = sizeof (dof_sec_t);
+	dof->dofh_secnum = 1;	/* only DOF_SECT_OPTDESC */
+	dof->dofh_secoff = sizeof (dof_hdr_t);
+	dof->dofh_loadsz = len;
+	dof->dofh_filesz = len;
+	dof->dofh_pad = 0;
+
+	/*
+	 * Fill in the option section header...
+	 */
+	sec = (dof_sec_t *)((uintptr_t)dof + sizeof (dof_hdr_t));
+	sec->dofs_type = DOF_SECT_OPTDESC;
+	sec->dofs_align = sizeof (uint64_t);
+	sec->dofs_flags = DOF_SECF_LOAD;
+	sec->dofs_entsize = sizeof (dof_optdesc_t);
+
+	opt = (dof_optdesc_t *)((uintptr_t)sec +
+	    roundup(sizeof (dof_sec_t), sizeof (uint64_t)));
+
+	sec->dofs_offset = (uintptr_t)opt - (uintptr_t)dof;
+	sec->dofs_size = sizeof (dof_optdesc_t) * DTRACEOPT_MAX;
+
+	for (i = 0; i < DTRACEOPT_MAX; i++) {
+		opt[i].dofo_option = i;
+		opt[i].dofo_strtab = DOF_SECIDX_NONE;
+		opt[i].dofo_value = state->dts_options[i];
+	}
+
+	return (dof);
+}
+
+static dof_hdr_t *
+dtrace_dof_copyin(uintptr_t uarg, int *errp)
+{
+	dof_hdr_t hdr, *dof;
+
+	ASSERT(!MUTEX_HELD(&dtrace_lock));
+
+	/*
+	 * First, we're going to copyin() the sizeof (dof_hdr_t).
+	 */
+	if (copyin((void *)uarg, &hdr, sizeof (hdr)) != 0) {
+		dtrace_dof_error(NULL, "failed to copyin DOF header");
+		*errp = EFAULT;
+		return (NULL);
+	}
+
+	/*
+	 * Now we'll allocate the entire DOF and copy it in -- provided
+	 * that the length isn't outrageous.
+	 */
+	if (hdr.dofh_loadsz >= VBDTCAST(uint64_t)dtrace_dof_maxsize) {
+		dtrace_dof_error(&hdr, "load size exceeds maximum");
+		*errp = E2BIG;
+		return (NULL);
+	}
+
+	if (hdr.dofh_loadsz < sizeof (hdr)) {
+		dtrace_dof_error(&hdr, "invalid load size");
+		*errp = EINVAL;
+		return (NULL);
+	}
+
+	dof = kmem_alloc(hdr.dofh_loadsz, KM_SLEEP);
+
+	if (copyin((void *)uarg, dof, hdr.dofh_loadsz) != 0 ||
+	    dof->dofh_loadsz != hdr.dofh_loadsz) {
+		kmem_free(dof, hdr.dofh_loadsz);
+		*errp = EFAULT;
+		return (NULL);
+	}
+
+	return (dof);
+}
+
+static dof_hdr_t *
+dtrace_dof_property(const char *name)
+{
+#ifndef VBOX
+	uchar_t *buf;
+	uint64_t loadsz;
+	unsigned int len, i;
+	dof_hdr_t *dof;
+
+	/*
+	 * Unfortunately, array of values in .conf files are always (and
+	 * only) interpreted to be integer arrays.  We must read our DOF
+	 * as an integer array, and then squeeze it into a byte array.
+	 */
+	if (ddi_prop_lookup_int_array(DDI_DEV_T_ANY, dtrace_devi, 0,
+	    (char *)name, (int **)&buf, &len) != DDI_PROP_SUCCESS)
+		return (NULL);
+
+	for (i = 0; i < len; i++)
+		buf[i] = (uchar_t)(((int *)buf)[i]);
+
+	if (len < sizeof (dof_hdr_t)) {
+		ddi_prop_free(buf);
+		dtrace_dof_error(NULL, "truncated header");
+		return (NULL);
+	}
+
+	if (len < (loadsz = ((dof_hdr_t *)buf)->dofh_loadsz)) {
+		ddi_prop_free(buf);
+		dtrace_dof_error(NULL, "truncated DOF");
+		return (NULL);
+	}
+
+	if (loadsz >= dtrace_dof_maxsize) {
+		ddi_prop_free(buf);
+		dtrace_dof_error(NULL, "oversized DOF");
+		return (NULL);
+	}
+
+	dof = kmem_alloc(loadsz, KM_SLEEP);
+	bcopy(buf, dof, loadsz);
+	ddi_prop_free(buf);
+
+	return (dof);
+#else  /* VBOX */
+	return (NULL);
+#endif /* VBOX */
+}
+
+static void
+dtrace_dof_destroy(dof_hdr_t *dof)
+{
+	kmem_free(dof, dof->dofh_loadsz);
+}
+
+/*
+ * Return the dof_sec_t pointer corresponding to a given section index.  If the
+ * index is not valid, dtrace_dof_error() is called and NULL is returned.  If
+ * a type other than DOF_SECT_NONE is specified, the header is checked against
+ * this type and NULL is returned if the types do not match.
+ */
+static dof_sec_t *
+dtrace_dof_sect(dof_hdr_t *dof, uint32_t type, dof_secidx_t i)
+{
+	dof_sec_t *sec = (dof_sec_t *)(uintptr_t)
+	    ((uintptr_t)dof + dof->dofh_secoff + i * dof->dofh_secsize);
+
+	if (i >= dof->dofh_secnum) {
+		dtrace_dof_error(dof, "referenced section index is invalid");
+		return (NULL);
+	}
+
+	if (!(sec->dofs_flags & DOF_SECF_LOAD)) {
+		dtrace_dof_error(dof, "referenced section is not loadable");
+		return (NULL);
+	}
+
+	if (type != DOF_SECT_NONE && type != sec->dofs_type) {
+		dtrace_dof_error(dof, "referenced section is the wrong type");
+		return (NULL);
+	}
+
+	return (sec);
+}
+
+static dtrace_probedesc_t *
+dtrace_dof_probedesc(dof_hdr_t *dof, dof_sec_t *sec, dtrace_probedesc_t *desc)
+{
+	dof_probedesc_t *probe;
+	dof_sec_t *strtab;
+	uintptr_t daddr = (uintptr_t)dof;
+	uintptr_t str;
+	size_t size;
+
+	if (sec->dofs_type != DOF_SECT_PROBEDESC) {
+		dtrace_dof_error(dof, "invalid probe section");
+		return (NULL);
+	}
+
+	if (sec->dofs_align != sizeof (dof_secidx_t)) {
+		dtrace_dof_error(dof, "bad alignment in probe description");
+		return (NULL);
+	}
+
+	if (sec->dofs_offset + sizeof (dof_probedesc_t) > dof->dofh_loadsz) {
+		dtrace_dof_error(dof, "truncated probe description");
+		return (NULL);
+	}
+
+	probe = (dof_probedesc_t *)(uintptr_t)(daddr + sec->dofs_offset);
+	strtab = dtrace_dof_sect(dof, DOF_SECT_STRTAB, probe->dofp_strtab);
+
+	if (strtab == NULL)
+		return (NULL);
+
+	str = daddr + strtab->dofs_offset;
+	size = strtab->dofs_size;
+
+	if (probe->dofp_provider >= strtab->dofs_size) {
+		dtrace_dof_error(dof, "corrupt probe provider");
+		return (NULL);
+	}
+
+	(void) strncpy(desc->dtpd_provider,
+	    (char *)(str + probe->dofp_provider),
+	    MIN(DTRACE_PROVNAMELEN - 1, size - probe->dofp_provider));
+
+	if (probe->dofp_mod >= strtab->dofs_size) {
+		dtrace_dof_error(dof, "corrupt probe module");
+		return (NULL);
+	}
+
+	(void) strncpy(desc->dtpd_mod, (char *)(str + probe->dofp_mod),
+	    MIN(DTRACE_MODNAMELEN - 1, size - probe->dofp_mod));
+
+	if (probe->dofp_func >= strtab->dofs_size) {
+		dtrace_dof_error(dof, "corrupt probe function");
+		return (NULL);
+	}
+
+	(void) strncpy(desc->dtpd_func, (char *)(str + probe->dofp_func),
+	    MIN(DTRACE_FUNCNAMELEN - 1, size - probe->dofp_func));
+
+	if (probe->dofp_name >= strtab->dofs_size) {
+		dtrace_dof_error(dof, "corrupt probe name");
+		return (NULL);
+	}
+
+	(void) strncpy(desc->dtpd_name, (char *)(str + probe->dofp_name),
+	    MIN(DTRACE_NAMELEN - 1, size - probe->dofp_name));
+
+	return (desc);
+}
+
+static dtrace_difo_t *
+dtrace_dof_difo(dof_hdr_t *dof, dof_sec_t *sec, dtrace_vstate_t *vstate,
+    cred_t *cr)
+{
+	dtrace_difo_t *dp;
+	size_t ttl = 0;
+	dof_difohdr_t *dofd;
+	uintptr_t daddr = (uintptr_t)dof;
+	size_t max = dtrace_difo_maxsize;
+	int i, l, n;
+
+	static const struct {
+		int section;
+		int bufoffs;
+		int lenoffs;
+		int entsize;
+		int align;
+		const char *msg;
+	} difo[] = {
+		{ DOF_SECT_DIF, offsetof(dtrace_difo_t, dtdo_buf),
+		offsetof(dtrace_difo_t, dtdo_len), sizeof (dif_instr_t),
+		sizeof (dif_instr_t), "multiple DIF sections" },
+
+		{ DOF_SECT_INTTAB, offsetof(dtrace_difo_t, dtdo_inttab),
+		offsetof(dtrace_difo_t, dtdo_intlen), sizeof (uint64_t),
+		sizeof (uint64_t), "multiple integer tables" },
+
+		{ DOF_SECT_STRTAB, offsetof(dtrace_difo_t, dtdo_strtab),
+		offsetof(dtrace_difo_t, dtdo_strlen), 0,
+		sizeof (char), "multiple string tables" },
+
+		{ DOF_SECT_VARTAB, offsetof(dtrace_difo_t, dtdo_vartab),
+		offsetof(dtrace_difo_t, dtdo_varlen), sizeof (dtrace_difv_t),
+		sizeof (uint_t), "multiple variable tables" },
+
+		{ DOF_SECT_NONE, 0, 0, 0, NULL }
+	};
+
+	if (sec->dofs_type != DOF_SECT_DIFOHDR) {
+		dtrace_dof_error(dof, "invalid DIFO header section");
+		return (NULL);
+	}
+
+	if (sec->dofs_align != sizeof (dof_secidx_t)) {
+		dtrace_dof_error(dof, "bad alignment in DIFO header");
+		return (NULL);
+	}
+
+	if (sec->dofs_size < sizeof (dof_difohdr_t) ||
+	    sec->dofs_size % sizeof (dof_secidx_t)) {
+		dtrace_dof_error(dof, "bad size in DIFO header");
+		return (NULL);
+	}
+
+	dofd = (dof_difohdr_t *)(uintptr_t)(daddr + sec->dofs_offset);
+	n = (sec->dofs_size - sizeof (*dofd)) / sizeof (dof_secidx_t) + 1;
+
+	dp = kmem_zalloc(sizeof (dtrace_difo_t), KM_SLEEP);
+	dp->dtdo_rtype = dofd->dofd_rtype;
+
+	for (l = 0; l < n; l++) {
+		dof_sec_t *subsec;
+		void **bufp;
+		uint32_t *lenp;
+
+		if ((subsec = dtrace_dof_sect(dof, DOF_SECT_NONE,
+		    dofd->dofd_links[l])) == NULL)
+			goto err; /* invalid section link */
+
+		if (ttl + subsec->dofs_size > max) {
+			dtrace_dof_error(dof, "exceeds maximum size");
+			goto err;
+		}
+
+		ttl += subsec->dofs_size;
+
+		for (i = 0; difo[i].section != DOF_SECT_NONE; i++) {
+			if (subsec->dofs_type != VBDTCAST(uint32_t)difo[i].section)
+				continue;
+
+			if (!(subsec->dofs_flags & DOF_SECF_LOAD)) {
+				dtrace_dof_error(dof, "section not loaded");
+				goto err;
+			}
+
+			if (subsec->dofs_align != VBDTCAST(uint32_t)difo[i].align) {
+				dtrace_dof_error(dof, "bad alignment");
+				goto err;
+			}
+
+			bufp = (void **)((uintptr_t)dp + difo[i].bufoffs);
+			lenp = (uint32_t *)((uintptr_t)dp + difo[i].lenoffs);
+
+			if (*bufp != NULL) {
+				dtrace_dof_error(dof, difo[i].msg);
+				goto err;
+			}
+
+			if (VBDTCAST(uint32_t)difo[i].entsize != subsec->dofs_entsize) {
+				dtrace_dof_error(dof, "entry size mismatch");
+				goto err;
+			}
+
+			if (subsec->dofs_entsize != 0 &&
+			    (subsec->dofs_size % subsec->dofs_entsize) != 0) {
+				dtrace_dof_error(dof, "corrupt entry size");
+				goto err;
+			}
+
+			*lenp = subsec->dofs_size;
+			*bufp = kmem_alloc(subsec->dofs_size, KM_SLEEP);
+			bcopy((char *)(uintptr_t)(daddr + subsec->dofs_offset),
+			    *bufp, subsec->dofs_size);
+
+			if (subsec->dofs_entsize != 0)
+				*lenp /= subsec->dofs_entsize;
+
+			break;
+		}
+
+		/*
+		 * If we encounter a loadable DIFO sub-section that is not
+		 * known to us, assume this is a broken program and fail.
+		 */
+		if (difo[i].section == DOF_SECT_NONE &&
+		    (subsec->dofs_flags & DOF_SECF_LOAD)) {
+			dtrace_dof_error(dof, "unrecognized DIFO subsection");
+			goto err;
+		}
+	}
+
+	if (dp->dtdo_buf == NULL) {
+		/*
+		 * We can't have a DIF object without DIF text.
+		 */
+		dtrace_dof_error(dof, "missing DIF text");
+		goto err;
+	}
+
+	/*
+	 * Before we validate the DIF object, run through the variable table
+	 * looking for the strings -- if any of their size are under, we'll set
+	 * their size to be the system-wide default string size.  Note that
+	 * this should _not_ happen if the "strsize" option has been set --
+	 * in this case, the compiler should have set the size to reflect the
+	 * setting of the option.
+	 */
+	for (i = 0; VBDTCAST(unsigned)i < dp->dtdo_varlen; i++) {
+		dtrace_difv_t *v = &dp->dtdo_vartab[i];
+		dtrace_diftype_t *t = &v->dtdv_type;
+
+		if (v->dtdv_id < DIF_VAR_OTHER_UBASE)
+			continue;
+
+		if (t->dtdt_kind == DIF_TYPE_STRING && t->dtdt_size == 0)
+			t->dtdt_size = VBDTCAST(uint32_t)dtrace_strsize_default;
+	}
+
+	if (dtrace_difo_validate(dp, vstate, DIF_DIR_NREGS, cr) != 0)
+		goto err;
+
+	dtrace_difo_init(dp, vstate);
+	return (dp);
+
+err:
+	kmem_free(dp->dtdo_buf, dp->dtdo_len * sizeof (dif_instr_t));
+	kmem_free(dp->dtdo_inttab, dp->dtdo_intlen * sizeof (uint64_t));
+	kmem_free(dp->dtdo_strtab, dp->dtdo_strlen);
+	kmem_free(dp->dtdo_vartab, dp->dtdo_varlen * sizeof (dtrace_difv_t));
+
+	kmem_free(dp, sizeof (dtrace_difo_t));
+	return (NULL);
+}
+
+static dtrace_predicate_t *
+dtrace_dof_predicate(dof_hdr_t *dof, dof_sec_t *sec, dtrace_vstate_t *vstate,
+    cred_t *cr)
+{
+	dtrace_difo_t *dp;
+
+	if ((dp = dtrace_dof_difo(dof, sec, vstate, cr)) == NULL)
+		return (NULL);
+
+	return (dtrace_predicate_create(dp));
+}
+
+static dtrace_actdesc_t *
+dtrace_dof_actdesc(dof_hdr_t *dof, dof_sec_t *sec, dtrace_vstate_t *vstate,
+    cred_t *cr)
+{
+	dtrace_actdesc_t *act, *first = NULL, *last = NULL, *next;
+	dof_actdesc_t *desc;
+	dof_sec_t *difosec;
+	size_t offs;
+	uintptr_t daddr = (uintptr_t)dof;
+	uint64_t arg;
+	dtrace_actkind_t kind;
+
+	if (sec->dofs_type != DOF_SECT_ACTDESC) {
+		dtrace_dof_error(dof, "invalid action section");
+		return (NULL);
+	}
+
+	if (sec->dofs_offset + sizeof (dof_actdesc_t) > dof->dofh_loadsz) {
+		dtrace_dof_error(dof, "truncated action description");
+		return (NULL);
+	}
+
+	if (sec->dofs_align != sizeof (uint64_t)) {
+		dtrace_dof_error(dof, "bad alignment in action description");
+		return (NULL);
+	}
+
+	if (sec->dofs_size < sec->dofs_entsize) {
+		dtrace_dof_error(dof, "section entry size exceeds total size");
+		return (NULL);
+	}
+
+	if (sec->dofs_entsize != sizeof (dof_actdesc_t)) {
+		dtrace_dof_error(dof, "bad entry size in action description");
+		return (NULL);
+	}
+
+	if (sec->dofs_size / sec->dofs_entsize > dtrace_actions_max) {
+		dtrace_dof_error(dof, "actions exceed dtrace_actions_max");
+		return (NULL);
+	}
+
+	for (offs = 0; offs < sec->dofs_size; offs += sec->dofs_entsize) {
+		desc = (dof_actdesc_t *)(daddr +
+		    (uintptr_t)sec->dofs_offset + offs);
+		kind = (dtrace_actkind_t)desc->dofa_kind;
+
+		if (DTRACEACT_ISPRINTFLIKE(kind) &&
+		    (kind != DTRACEACT_PRINTA ||
+		    desc->dofa_strtab != DOF_SECIDX_NONE)) {
+			dof_sec_t *strtab;
+			char *str, *fmt;
+			uint64_t i;
+
+			/*
+			 * printf()-like actions must have a format string.
+			 */
+			if ((strtab = dtrace_dof_sect(dof,
+			    DOF_SECT_STRTAB, desc->dofa_strtab)) == NULL)
+				goto err;
+
+			str = (char *)((uintptr_t)dof +
+			    (uintptr_t)strtab->dofs_offset);
+
+			for (i = desc->dofa_arg; i < strtab->dofs_size; i++) {
+				if (str[i] == '\0')
+					break;
+			}
+
+			if (i >= strtab->dofs_size) {
+				dtrace_dof_error(dof, "bogus format string");
+				goto err;
+			}
+
+			if (i == desc->dofa_arg) {
+				dtrace_dof_error(dof, "empty format string");
+				goto err;
+			}
+
+			i -= desc->dofa_arg;
+			fmt = kmem_alloc(i + 1, KM_SLEEP);
+			bcopy(&str[desc->dofa_arg], fmt, i + 1);
+			arg = (uint64_t)(uintptr_t)fmt;
+		} else {
+			if (kind == DTRACEACT_PRINTA) {
+				ASSERT(desc->dofa_strtab == DOF_SECIDX_NONE);
+				arg = 0;
+			} else {
+				arg = desc->dofa_arg;
+			}
+		}
+
+		act = dtrace_actdesc_create(kind, desc->dofa_ntuple,
+		    desc->dofa_uarg, arg);
+
+		if (last != NULL) {
+			last->dtad_next = act;
+		} else {
+			first = act;
+		}
+
+		last = act;
+
+		if (desc->dofa_difo == DOF_SECIDX_NONE)
+			continue;
+
+		if ((difosec = dtrace_dof_sect(dof,
+		    DOF_SECT_DIFOHDR, desc->dofa_difo)) == NULL)
+			goto err;
+
+		act->dtad_difo = dtrace_dof_difo(dof, difosec, vstate, cr);
+
+		if (act->dtad_difo == NULL)
+			goto err;
+	}
+
+	ASSERT(first != NULL);
+	return (first);
+
+err:
+	for (act = first; act != NULL; act = next) {
+		next = act->dtad_next;
+		dtrace_actdesc_release(act, vstate);
+	}
+
+	return (NULL);
+}
+
+static dtrace_ecbdesc_t *
+dtrace_dof_ecbdesc(dof_hdr_t *dof, dof_sec_t *sec, dtrace_vstate_t *vstate,
+    cred_t *cr)
+{
+	dtrace_ecbdesc_t *ep;
+	dof_ecbdesc_t *ecb;
+	dtrace_probedesc_t *desc;
+	dtrace_predicate_t *pred = NULL;
+
+	if (sec->dofs_size < sizeof (dof_ecbdesc_t)) {
+		dtrace_dof_error(dof, "truncated ECB description");
+		return (NULL);
+	}
+
+	if (sec->dofs_align != sizeof (uint64_t)) {
+		dtrace_dof_error(dof, "bad alignment in ECB description");
+		return (NULL);
+	}
+
+	ecb = (dof_ecbdesc_t *)((uintptr_t)dof + (uintptr_t)sec->dofs_offset);
+	sec = dtrace_dof_sect(dof, DOF_SECT_PROBEDESC, ecb->dofe_probes);
+
+	if (sec == NULL)
+		return (NULL);
+
+	ep = kmem_zalloc(sizeof (dtrace_ecbdesc_t), KM_SLEEP);
+	ep->dted_uarg = ecb->dofe_uarg;
+	desc = &ep->dted_probe;
+
+	if (dtrace_dof_probedesc(dof, sec, desc) == NULL)
+		goto err;
+
+	if (ecb->dofe_pred != DOF_SECIDX_NONE) {
+		if ((sec = dtrace_dof_sect(dof,
+		    DOF_SECT_DIFOHDR, ecb->dofe_pred)) == NULL)
+			goto err;
+
+		if ((pred = dtrace_dof_predicate(dof, sec, vstate, cr)) == NULL)
+			goto err;
+
+		ep->dted_pred.dtpdd_predicate = pred;
+	}
+
+	if (ecb->dofe_actions != DOF_SECIDX_NONE) {
+		if ((sec = dtrace_dof_sect(dof,
+		    DOF_SECT_ACTDESC, ecb->dofe_actions)) == NULL)
+			goto err;
+
+		ep->dted_action = dtrace_dof_actdesc(dof, sec, vstate, cr);
+
+		if (ep->dted_action == NULL)
+			goto err;
+	}
+
+	return (ep);
+
+err:
+	if (pred != NULL)
+		dtrace_predicate_release(pred, vstate);
+	kmem_free(ep, sizeof (dtrace_ecbdesc_t));
+	return (NULL);
+}
+
+/*
+ * Apply the relocations from the specified 'sec' (a DOF_SECT_URELHDR) to the
+ * specified DOF.  At present, this amounts to simply adding 'ubase' to the
+ * site of any user SETX relocations to account for load object base address.
+ * In the future, if we need other relocations, this function can be extended.
+ */
+static int
+dtrace_dof_relocate(dof_hdr_t *dof, dof_sec_t *sec, uint64_t ubase)
+{
+	uintptr_t daddr = (uintptr_t)dof;
+	dof_relohdr_t *dofr =
+	    (dof_relohdr_t *)(uintptr_t)(daddr + sec->dofs_offset);
+	dof_sec_t *ss, *rs, *ts;
+	dof_relodesc_t *r;
+	uint_t i, n;
+
+	if (sec->dofs_size < sizeof (dof_relohdr_t) ||
+	    sec->dofs_align != sizeof (dof_secidx_t)) {
+		dtrace_dof_error(dof, "invalid relocation header");
+		return (-1);
+	}
+
+	ss = dtrace_dof_sect(dof, DOF_SECT_STRTAB, dofr->dofr_strtab);
+	rs = dtrace_dof_sect(dof, DOF_SECT_RELTAB, dofr->dofr_relsec);
+	ts = dtrace_dof_sect(dof, DOF_SECT_NONE, dofr->dofr_tgtsec);
+
+	if (ss == NULL || rs == NULL || ts == NULL)
+		return (-1); /* dtrace_dof_error() has been called already */
+
+	if (rs->dofs_entsize < sizeof (dof_relodesc_t) ||
+	    rs->dofs_align != sizeof (uint64_t)) {
+		dtrace_dof_error(dof, "invalid relocation section");
+		return (-1);
+	}
+
+	r = (dof_relodesc_t *)(uintptr_t)(daddr + rs->dofs_offset);
+	n = rs->dofs_size / rs->dofs_entsize;
+
+	for (i = 0; i < n; i++) {
+		uintptr_t taddr = daddr + ts->dofs_offset + r->dofr_offset;
+
+		switch (r->dofr_type) {
+		case DOF_RELO_NONE:
+			break;
+		case DOF_RELO_SETX:
+			if (r->dofr_offset >= ts->dofs_size || r->dofr_offset +
+			    sizeof (uint64_t) > ts->dofs_size) {
+				dtrace_dof_error(dof, "bad relocation offset");
+				return (-1);
+			}
+
+			if (!IS_P2ALIGNED(taddr, sizeof (uint64_t))) {
+				dtrace_dof_error(dof, "misaligned setx relo");
+				return (-1);
+			}
+
+			*(uint64_t *)taddr += ubase;
+			break;
+		default:
+			dtrace_dof_error(dof, "invalid relocation type");
+			return (-1);
+		}
+
+		r = (dof_relodesc_t *)((uintptr_t)r + rs->dofs_entsize);
+	}
+
+	return (0);
+}
+
+/*
+ * The dof_hdr_t passed to dtrace_dof_slurp() should be a partially validated
+ * header:  it should be at the front of a memory region that is at least
+ * sizeof (dof_hdr_t) in size -- and then at least dof_hdr.dofh_loadsz in
+ * size.  It need not be validated in any other way.
+ */
+static int
+dtrace_dof_slurp(dof_hdr_t *dof, dtrace_vstate_t *vstate, cred_t *cr,
+    dtrace_enabling_t **enabp, uint64_t ubase, int noprobes)
+{
+	uint64_t len = dof->dofh_loadsz, seclen;
+	uintptr_t daddr = (uintptr_t)dof;
+	dtrace_ecbdesc_t *ep;
+	dtrace_enabling_t *enab;
+	uint_t i;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(dof->dofh_loadsz >= sizeof (dof_hdr_t));
+
+	/*
+	 * Check the DOF header identification bytes.  In addition to checking
+	 * valid settings, we also verify that unused bits/bytes are zeroed so
+	 * we can use them later without fear of regressing existing binaries.
+	 */
+	if (bcmp(&dof->dofh_ident[DOF_ID_MAG0],
+	    DOF_MAG_STRING, DOF_MAG_STRLEN) != 0) {
+		dtrace_dof_error(dof, "DOF magic string mismatch");
+		return (-1);
+	}
+
+	if (dof->dofh_ident[DOF_ID_MODEL] != DOF_MODEL_ILP32 &&
+	    dof->dofh_ident[DOF_ID_MODEL] != DOF_MODEL_LP64) {
+		dtrace_dof_error(dof, "DOF has invalid data model");
+		return (-1);
+	}
+
+	if (dof->dofh_ident[DOF_ID_ENCODING] != DOF_ENCODE_NATIVE) {
+		dtrace_dof_error(dof, "DOF encoding mismatch");
+		return (-1);
+	}
+
+	if (dof->dofh_ident[DOF_ID_VERSION] != DOF_VERSION_1 &&
+	    dof->dofh_ident[DOF_ID_VERSION] != DOF_VERSION_2) {
+		dtrace_dof_error(dof, "DOF version mismatch");
+		return (-1);
+	}
+
+	if (dof->dofh_ident[DOF_ID_DIFVERS] != DIF_VERSION_2) {
+		dtrace_dof_error(dof, "DOF uses unsupported instruction set");
+		return (-1);
+	}
+
+	if (dof->dofh_ident[DOF_ID_DIFIREG] > DIF_DIR_NREGS) {
+		dtrace_dof_error(dof, "DOF uses too many integer registers");
+		return (-1);
+	}
+
+	if (dof->dofh_ident[DOF_ID_DIFTREG] > DIF_DTR_NREGS) {
+		dtrace_dof_error(dof, "DOF uses too many tuple registers");
+		return (-1);
+	}
+
+	for (i = DOF_ID_PAD; i < DOF_ID_SIZE; i++) {
+		if (dof->dofh_ident[i] != 0) {
+			dtrace_dof_error(dof, "DOF has invalid ident byte set");
+			return (-1);
+		}
+	}
+
+	if (dof->dofh_flags & ~DOF_FL_VALID) {
+		dtrace_dof_error(dof, "DOF has invalid flag bits set");
+		return (-1);
+	}
+
+	if (dof->dofh_secsize == 0) {
+		dtrace_dof_error(dof, "zero section header size");
+		return (-1);
+	}
+
+	/*
+	 * Check that the section headers don't exceed the amount of DOF
+	 * data.  Note that we cast the section size and number of sections
+	 * to uint64_t's to prevent possible overflow in the multiplication.
+	 */
+	seclen = (uint64_t)dof->dofh_secnum * (uint64_t)dof->dofh_secsize;
+
+	if (dof->dofh_secoff > len || seclen > len ||
+	    dof->dofh_secoff + seclen > len) {
+		dtrace_dof_error(dof, "truncated section headers");
+		return (-1);
+	}
+
+	if (!IS_P2ALIGNED(dof->dofh_secoff, sizeof (uint64_t))) {
+		dtrace_dof_error(dof, "misaligned section headers");
+		return (-1);
+	}
+
+	if (!IS_P2ALIGNED(dof->dofh_secsize, sizeof (uint64_t))) {
+		dtrace_dof_error(dof, "misaligned section size");
+		return (-1);
+	}
+
+	/*
+	 * Take an initial pass through the section headers to be sure that
+	 * the headers don't have stray offsets.  If the 'noprobes' flag is
+	 * set, do not permit sections relating to providers, probes, or args.
+	 */
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		dof_sec_t *sec = (dof_sec_t *)(daddr +
+		    (uintptr_t)dof->dofh_secoff + i * dof->dofh_secsize);
+
+		if (noprobes) {
+			switch (sec->dofs_type) {
+			case DOF_SECT_PROVIDER:
+			case DOF_SECT_PROBES:
+			case DOF_SECT_PRARGS:
+			case DOF_SECT_PROFFS:
+				dtrace_dof_error(dof, "illegal sections "
+				    "for enabling");
+				return (-1);
+			}
+		}
+
+		if (DOF_SEC_ISLOADABLE(sec->dofs_type) &&
+		    !(sec->dofs_flags & DOF_SECF_LOAD)) {
+			dtrace_dof_error(dof, "loadable section with load "
+			    "flag unset");
+			return (-1);
+		}
+
+		if (!(sec->dofs_flags & DOF_SECF_LOAD))
+			continue; /* just ignore non-loadable sections */
+
+		if (sec->dofs_align & (sec->dofs_align - 1)) {
+			dtrace_dof_error(dof, "bad section alignment");
+			return (-1);
+		}
+
+		if (sec->dofs_offset & (sec->dofs_align - 1)) {
+			dtrace_dof_error(dof, "misaligned section");
+			return (-1);
+		}
+
+		if (sec->dofs_offset > len || sec->dofs_size > len ||
+		    sec->dofs_offset + sec->dofs_size > len) {
+			dtrace_dof_error(dof, "corrupt section header");
+			return (-1);
+		}
+
+		if (sec->dofs_type == DOF_SECT_STRTAB && *((char *)daddr +
+		    sec->dofs_offset + sec->dofs_size - 1) != '\0') {
+			dtrace_dof_error(dof, "non-terminating string table");
+			return (-1);
+		}
+	}
+
+	/*
+	 * Take a second pass through the sections and locate and perform any
+	 * relocations that are present.  We do this after the first pass to
+	 * be sure that all sections have had their headers validated.
+	 */
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		dof_sec_t *sec = (dof_sec_t *)(daddr +
+		    (uintptr_t)dof->dofh_secoff + i * dof->dofh_secsize);
+
+		if (!(sec->dofs_flags & DOF_SECF_LOAD))
+			continue; /* skip sections that are not loadable */
+
+		switch (sec->dofs_type) {
+		case DOF_SECT_URELHDR:
+			if (dtrace_dof_relocate(dof, sec, ubase) != 0)
+				return (-1);
+			break;
+		}
+	}
+
+	if ((enab = *enabp) == NULL)
+		enab = *enabp = dtrace_enabling_create(vstate);
+
+	for (i = 0; i < dof->dofh_secnum; i++) {
+		dof_sec_t *sec = (dof_sec_t *)(daddr +
+		    (uintptr_t)dof->dofh_secoff + i * dof->dofh_secsize);
+
+		if (sec->dofs_type != DOF_SECT_ECBDESC)
+			continue;
+
+		if ((ep = dtrace_dof_ecbdesc(dof, sec, vstate, cr)) == NULL) {
+			dtrace_enabling_destroy(enab);
+			*enabp = NULL;
+			return (-1);
+		}
+
+		dtrace_enabling_add(enab, ep);
+	}
+
+	return (0);
+}
+
+/*
+ * Process DOF for any options.  This routine assumes that the DOF has been
+ * at least processed by dtrace_dof_slurp().
+ */
+static int
+dtrace_dof_options(dof_hdr_t *dof, dtrace_state_t *state)
+{
+	int i, rval;
+	uint32_t entsize;
+	size_t offs;
+	dof_optdesc_t *desc;
+
+	for (i = 0; VBDTCAST(unsigned)i < dof->dofh_secnum; i++) {
+		dof_sec_t *sec = (dof_sec_t *)((uintptr_t)dof +
+		    (uintptr_t)dof->dofh_secoff + i * dof->dofh_secsize);
+
+		if (sec->dofs_type != DOF_SECT_OPTDESC)
+			continue;
+
+		if (sec->dofs_align != sizeof (uint64_t)) {
+			dtrace_dof_error(dof, "bad alignment in "
+			    "option description");
+			return (EINVAL);
+		}
+
+		if ((entsize = sec->dofs_entsize) == 0) {
+			dtrace_dof_error(dof, "zeroed option entry size");
+			return (EINVAL);
+		}
+
+		if (entsize < sizeof (dof_optdesc_t)) {
+			dtrace_dof_error(dof, "bad option entry size");
+			return (EINVAL);
+		}
+
+		for (offs = 0; offs < sec->dofs_size; offs += entsize) {
+			desc = (dof_optdesc_t *)((uintptr_t)dof +
+			    (uintptr_t)sec->dofs_offset + offs);
+
+			if (desc->dofo_strtab != DOF_SECIDX_NONE) {
+				dtrace_dof_error(dof, "non-zero option string");
+				return (EINVAL);
+			}
+
+			if (desc->dofo_value == VBDTCAST(uint64_t)DTRACEOPT_UNSET) {
+				dtrace_dof_error(dof, "unset option");
+				return (EINVAL);
+			}
+
+			if ((rval = dtrace_state_option(state,
+			    desc->dofo_option, desc->dofo_value)) != 0) {
+				dtrace_dof_error(dof, "rejected option");
+				return (rval);
+			}
+		}
+	}
+
+	return (0);
+}
+
+/*
+ * DTrace Consumer State Functions
+ */
+VBDTSTATIC int
+dtrace_dstate_init(dtrace_dstate_t *dstate, size_t size)
+{
+	size_t hashsize, maxper, min, chunksize = dstate->dtds_chunksize;
+	void *base;
+	uintptr_t limit;
+	dtrace_dynvar_t *dvar, *next, *start;
+	VBDTTYPE(size_t,int) i;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(dstate->dtds_base == NULL && dstate->dtds_percpu == NULL);
+
+	bzero(dstate, sizeof (dtrace_dstate_t));
+
+	if ((dstate->dtds_chunksize = chunksize) == 0)
+		dstate->dtds_chunksize = DTRACE_DYNVAR_CHUNKSIZE;
+
+	if (size < (min = dstate->dtds_chunksize + sizeof (dtrace_dynhash_t)))
+		size = min;
+
+	if ((base = kmem_zalloc(size, KM_NOSLEEP)) == NULL)
+		return (ENOMEM);
+
+	dstate->dtds_size = size;
+	dstate->dtds_base = base;
+	dstate->dtds_percpu = kmem_cache_alloc(dtrace_state_cache, KM_SLEEP);
+	bzero(dstate->dtds_percpu, NCPU * sizeof (dtrace_dstate_percpu_t));
+
+	hashsize = size / (dstate->dtds_chunksize + sizeof (dtrace_dynhash_t));
+
+	if (hashsize != 1 && (hashsize & 1))
+		hashsize--;
+
+	dstate->dtds_hashsize = hashsize;
+	dstate->dtds_hash = dstate->dtds_base;
+
+	/*
+	 * Set all of our hash buckets to point to the single sink, and (if
+	 * it hasn't already been set), set the sink's hash value to be the
+	 * sink sentinel value.  The sink is needed for dynamic variable
+	 * lookups to know that they have iterated over an entire, valid hash
+	 * chain.
+	 */
+	for (i = 0; i < hashsize; i++)
+		dstate->dtds_hash[i].dtdh_chain = &dtrace_dynhash_sink;
+
+	if (dtrace_dynhash_sink.dtdv_hashval != DTRACE_DYNHASH_SINK)
+		dtrace_dynhash_sink.dtdv_hashval = DTRACE_DYNHASH_SINK;
+
+	/*
+	 * Determine number of active CPUs.  Divide free list evenly among
+	 * active CPUs.
+	 */
+	start = (dtrace_dynvar_t *)
+	    ((uintptr_t)base + hashsize * sizeof (dtrace_dynhash_t));
+	limit = (uintptr_t)base + size;
+
+	maxper = (limit - (uintptr_t)start) / NCPU;
+	maxper = (maxper / dstate->dtds_chunksize) * dstate->dtds_chunksize;
+
+	for (i = 0; i < NCPU; i++) {
+		dstate->dtds_percpu[i].dtdsc_free = dvar = start;
+
+		/*
+		 * If we don't even have enough chunks to make it once through
+		 * NCPUs, we're just going to allocate everything to the first
+		 * CPU.  And if we're on the last CPU, we're going to allocate
+		 * whatever is left over.  In either case, we set the limit to
+		 * be the limit of the dynamic variable space.
+		 */
+		if (maxper == 0 || i == NCPU - 1) {
+			limit = (uintptr_t)base + size;
+			start = NULL;
+		} else {
+			limit = (uintptr_t)start + maxper;
+			start = (dtrace_dynvar_t *)limit;
+		}
+
+		ASSERT(limit <= (uintptr_t)base + size);
+
+		for (;;) {
+			next = (dtrace_dynvar_t *)((uintptr_t)dvar +
+			    dstate->dtds_chunksize);
+
+			if ((uintptr_t)next + dstate->dtds_chunksize >= limit)
+				break;
+
+			dvar->dtdv_next = next;
+			dvar = next;
+		}
+
+		if (maxper == 0)
+			break;
+	}
+
+	return (0);
+}
+
+VBDTSTATIC void
+dtrace_dstate_fini(dtrace_dstate_t *dstate)
+{
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	if (dstate->dtds_base == NULL)
+		return;
+
+	kmem_free(dstate->dtds_base, dstate->dtds_size);
+	kmem_cache_free(dtrace_state_cache, dstate->dtds_percpu);
+}
+
+static void
+dtrace_vstate_fini(dtrace_vstate_t *vstate)
+{
+	/*
+	 * Logical XOR, where are you?
+	 */
+	ASSERT((vstate->dtvs_nglobals == 0) ^ (vstate->dtvs_globals != NULL));
+
+	if (vstate->dtvs_nglobals > 0) {
+		kmem_free(vstate->dtvs_globals, vstate->dtvs_nglobals *
+		    sizeof (dtrace_statvar_t *));
+	}
+
+	if (vstate->dtvs_ntlocals > 0) {
+		kmem_free(vstate->dtvs_tlocals, vstate->dtvs_ntlocals *
+		    sizeof (dtrace_difv_t));
+	}
+
+	ASSERT((vstate->dtvs_nlocals == 0) ^ (vstate->dtvs_locals != NULL));
+
+	if (vstate->dtvs_nlocals > 0) {
+		kmem_free(vstate->dtvs_locals, vstate->dtvs_nlocals *
+		    sizeof (dtrace_statvar_t *));
+	}
+}
+
+static void
+dtrace_state_clean(dtrace_state_t *state)
+{
+	if (state->dts_activity == DTRACE_ACTIVITY_INACTIVE)
+		return;
+
+	dtrace_dynvar_clean(&state->dts_vstate.dtvs_dynvars);
+	dtrace_speculation_clean(state);
+}
+#ifdef VBOX
+static DECLCALLBACK(void) dtrace_state_clean_timer(PRTTIMER pTimer, void *pvUser, uint64_t iTick)
+{
+    dtrace_state_clean((dtrace_state_t *)pvUser);
+    NOREF(pTimer); NOREF(iTick);
+}
+#endif
+
+static void
+dtrace_state_deadman(dtrace_state_t *state)
+{
+	hrtime_t now;
+
+	dtrace_sync();
+
+	now = dtrace_gethrtime();
+
+	if (state != dtrace_anon.dta_state &&
+	    now - state->dts_laststatus >= dtrace_deadman_user)
+		return;
+
+	/*
+	 * We must be sure that dts_alive never appears to be less than the
+	 * value upon entry to dtrace_state_deadman(), and because we lack a
+	 * dtrace_cas64(), we cannot store to it atomically.  We thus instead
+	 * store INT64_MAX to it, followed by a memory barrier, followed by
+	 * the new value.  This assures that dts_alive never appears to be
+	 * less than its true value, regardless of the order in which the
+	 * stores to the underlying storage are issued.
+	 */
+	state->dts_alive = INT64_MAX;
+	dtrace_membar_producer();
+	state->dts_alive = now;
+}
+
+#ifdef VBOX
+static DECLCALLBACK(void) dtrace_state_deadman_timer(PRTTIMER pTimer, void *pvUser, uint64_t iTick)
+{
+    dtrace_state_deadman((dtrace_state_t *)pvUser);
+    NOREF(pTimer); NOREF(iTick);
+}
+#endif
+
+VBDTSTATIC dtrace_state_t *
+#ifdef VBOX
+dtrace_state_create(cred_t *cr)
+#else
+dtrace_state_create(dev_t *devp, cred_t *cr)
+#endif
+{
+#ifndef VBOX
+	minor_t minor;
+	major_t major;
+#endif
+	char c[30];
+	dtrace_state_t *state;
+	dtrace_optval_t *opt;
+	int bufsize = NCPU * sizeof (dtrace_buffer_t), i;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+#ifndef VBOX
+	minor = (minor_t)(uintptr_t)vmem_alloc(dtrace_minor, 1,
+	    VM_BESTFIT | VM_SLEEP);
+
+	if (ddi_soft_state_zalloc(dtrace_softstate, minor) != DDI_SUCCESS) {
+		vmem_free(dtrace_minor, (void *)(uintptr_t)minor, 1);
+		return (NULL);
+	}
+
+	state = ddi_get_soft_state(dtrace_softstate, minor);
+#else
+	state = kmem_zalloc(sizeof (*state), KM_SLEEP);
+	if (!state) {
+	    return (NULL);
+	}
+#endif
+	state->dts_epid = DTRACE_EPIDNONE + 1;
+
+#ifndef VBOX
+	(void) snprintf(c, sizeof (c), "dtrace_aggid_%d", minor);
+#else
+	(void) snprintf(c, sizeof (c), "dtrace_aggid_%p", state);
+#endif
+#ifndef VBOX /* Avoid idProbe = UINT32_MAX as it is used as invalid value by VTG. */
+	state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1,
+	    NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
+#else
+        state->dts_aggid_arena = vmem_create(c, (void *)1, _1G, 1,
+            NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
+#endif
+
+#ifndef VBOX
+	if (devp != NULL) {
+		major = getemajor(*devp);
+	} else {
+		major = ddi_driver_major(dtrace_devi);
+	}
+
+	state->dts_dev = makedevice(major, minor);
+
+	if (devp != NULL)
+		*devp = state->dts_dev;
+#endif
+
+	/*
+	 * We allocate NCPU buffers.  On the one hand, this can be quite
+	 * a bit of memory per instance (nearly 36K on a Starcat).  On the
+	 * other hand, it saves an additional memory reference in the probe
+	 * path.
+	 */
+	state->dts_buffer = kmem_zalloc(bufsize, KM_SLEEP);
+	state->dts_aggbuffer = kmem_zalloc(bufsize, KM_SLEEP);
+	state->dts_cleaner = CYCLIC_NONE;
+	state->dts_deadman = CYCLIC_NONE;
+	state->dts_vstate.dtvs_state = state;
+
+	for (i = 0; i < DTRACEOPT_MAX; i++)
+		state->dts_options[i] = DTRACEOPT_UNSET;
+
+	/*
+	 * Set the default options.
+	 */
+	opt = state->dts_options;
+	opt[DTRACEOPT_BUFPOLICY] = DTRACEOPT_BUFPOLICY_SWITCH;
+	opt[DTRACEOPT_BUFRESIZE] = DTRACEOPT_BUFRESIZE_AUTO;
+	opt[DTRACEOPT_NSPEC] = dtrace_nspec_default;
+	opt[DTRACEOPT_SPECSIZE] = dtrace_specsize_default;
+	opt[DTRACEOPT_CPU] = (dtrace_optval_t)DTRACE_CPUALL;
+	opt[DTRACEOPT_STRSIZE] = dtrace_strsize_default;
+	opt[DTRACEOPT_STACKFRAMES] = dtrace_stackframes_default;
+	opt[DTRACEOPT_USTACKFRAMES] = dtrace_ustackframes_default;
+	opt[DTRACEOPT_CLEANRATE] = dtrace_cleanrate_default;
+	opt[DTRACEOPT_AGGRATE] = dtrace_aggrate_default;
+	opt[DTRACEOPT_SWITCHRATE] = dtrace_switchrate_default;
+	opt[DTRACEOPT_STATUSRATE] = dtrace_statusrate_default;
+	opt[DTRACEOPT_JSTACKFRAMES] = dtrace_jstackframes_default;
+	opt[DTRACEOPT_JSTACKSTRSIZE] = dtrace_jstackstrsize_default;
+
+	state->dts_activity = DTRACE_ACTIVITY_INACTIVE;
+
+	/*
+	 * Depending on the user credentials, we set flag bits which alter probe
+	 * visibility or the amount of destructiveness allowed.  In the case of
+	 * actual anonymous tracing, or the possession of all privileges, all of
+	 * the normal checks are bypassed.
+	 */
+	if (cr == NULL || PRIV_POLICY_ONLY(cr, PRIV_ALL, B_FALSE)) {
+		state->dts_cred.dcr_visible = DTRACE_CRV_ALL;
+		state->dts_cred.dcr_action = DTRACE_CRA_ALL;
+	} else {
+		/*
+		 * Set up the credentials for this instantiation.  We take a
+		 * hold on the credential to prevent it from disappearing on
+		 * us; this in turn prevents the zone_t referenced by this
+		 * credential from disappearing.  This means that we can
+		 * examine the credential and the zone from probe context.
+		 */
+		crhold(cr);
+		state->dts_cred.dcr_cred = cr;
+
+		/*
+		 * CRA_PROC means "we have *some* privilege for dtrace" and
+		 * unlocks the use of variables like pid, zonename, etc.
+		 */
+		if (PRIV_POLICY_ONLY(cr, PRIV_DTRACE_USER, B_FALSE) ||
+		    PRIV_POLICY_ONLY(cr, PRIV_DTRACE_PROC, B_FALSE)) {
+			state->dts_cred.dcr_action |= DTRACE_CRA_PROC;
+		}
+
+		/*
+		 * dtrace_user allows use of syscall and profile providers.
+		 * If the user also has proc_owner and/or proc_zone, we
+		 * extend the scope to include additional visibility and
+		 * destructive power.
+		 */
+		if (PRIV_POLICY_ONLY(cr, PRIV_DTRACE_USER, B_FALSE)) {
+			if (PRIV_POLICY_ONLY(cr, PRIV_PROC_OWNER, B_FALSE)) {
+				state->dts_cred.dcr_visible |=
+				    DTRACE_CRV_ALLPROC;
+
+				state->dts_cred.dcr_action |=
+				    DTRACE_CRA_PROC_DESTRUCTIVE_ALLUSER;
+			}
+
+			if (PRIV_POLICY_ONLY(cr, PRIV_PROC_ZONE, B_FALSE)) {
+				state->dts_cred.dcr_visible |=
+				    DTRACE_CRV_ALLZONE;
+
+				state->dts_cred.dcr_action |=
+				    DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE;
+			}
+
+			/*
+			 * If we have all privs in whatever zone this is,
+			 * we can do destructive things to processes which
+			 * have altered credentials.
+			 */
+			if (priv_isequalset(priv_getset(cr, PRIV_EFFECTIVE),
+			    cr->cr_zone->zone_privset)) {
+				state->dts_cred.dcr_action |=
+				    DTRACE_CRA_PROC_DESTRUCTIVE_CREDCHG;
+			}
+		}
+
+		/*
+		 * Holding the dtrace_kernel privilege also implies that
+		 * the user has the dtrace_user privilege from a visibility
+		 * perspective.  But without further privileges, some
+		 * destructive actions are not available.
+		 */
+		if (PRIV_POLICY_ONLY(cr, PRIV_DTRACE_KERNEL, B_FALSE)) {
+			/*
+			 * Make all probes in all zones visible.  However,
+			 * this doesn't mean that all actions become available
+			 * to all zones.
+			 */
+			state->dts_cred.dcr_visible |= DTRACE_CRV_KERNEL |
+			    DTRACE_CRV_ALLPROC | DTRACE_CRV_ALLZONE;
+
+			state->dts_cred.dcr_action |= DTRACE_CRA_KERNEL |
+			    DTRACE_CRA_PROC;
+			/*
+			 * Holding proc_owner means that destructive actions
+			 * for *this* zone are allowed.
+			 */
+			if (PRIV_POLICY_ONLY(cr, PRIV_PROC_OWNER, B_FALSE))
+				state->dts_cred.dcr_action |=
+				    DTRACE_CRA_PROC_DESTRUCTIVE_ALLUSER;
+
+			/*
+			 * Holding proc_zone means that destructive actions
+			 * for this user/group ID in all zones is allowed.
+			 */
+			if (PRIV_POLICY_ONLY(cr, PRIV_PROC_ZONE, B_FALSE))
+				state->dts_cred.dcr_action |=
+				    DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE;
+
+			/*
+			 * If we have all privs in whatever zone this is,
+			 * we can do destructive things to processes which
+			 * have altered credentials.
+			 */
+			if (priv_isequalset(priv_getset(cr, PRIV_EFFECTIVE),
+			    cr->cr_zone->zone_privset)) {
+				state->dts_cred.dcr_action |=
+				    DTRACE_CRA_PROC_DESTRUCTIVE_CREDCHG;
+			}
+		}
+
+		/*
+		 * Holding the dtrace_proc privilege gives control over fasttrap
+		 * and pid providers.  We need to grant wider destructive
+		 * privileges in the event that the user has proc_owner and/or
+		 * proc_zone.
+		 */
+		if (PRIV_POLICY_ONLY(cr, PRIV_DTRACE_PROC, B_FALSE)) {
+			if (PRIV_POLICY_ONLY(cr, PRIV_PROC_OWNER, B_FALSE))
+				state->dts_cred.dcr_action |=
+				    DTRACE_CRA_PROC_DESTRUCTIVE_ALLUSER;
+
+			if (PRIV_POLICY_ONLY(cr, PRIV_PROC_ZONE, B_FALSE))
+				state->dts_cred.dcr_action |=
+				    DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE;
+		}
+	}
+
+	return (state);
+}
+
+static int
+dtrace_state_buffer(dtrace_state_t *state, dtrace_buffer_t *buf, int which)
+{
+	dtrace_optval_t *opt = state->dts_options, size;
+	processorid_t cpu VBDTUNASS(DTRACE_CPUALL);
+	int flags = 0, rval;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(MUTEX_HELD(&cpu_lock));
+	ASSERT(which < DTRACEOPT_MAX);
+	ASSERT(state->dts_activity == DTRACE_ACTIVITY_INACTIVE ||
+	    (state == dtrace_anon.dta_state &&
+	    state->dts_activity == DTRACE_ACTIVITY_ACTIVE));
+
+	if (opt[which] == DTRACEOPT_UNSET || opt[which] == 0)
+		return (0);
+
+	if (opt[DTRACEOPT_CPU] != DTRACEOPT_UNSET)
+		cpu = opt[DTRACEOPT_CPU];
+
+	if (which == DTRACEOPT_SPECSIZE)
+		flags |= DTRACEBUF_NOSWITCH;
+
+	if (which == DTRACEOPT_BUFSIZE) {
+		if (opt[DTRACEOPT_BUFPOLICY] == DTRACEOPT_BUFPOLICY_RING)
+			flags |= DTRACEBUF_RING;
+
+		if (opt[DTRACEOPT_BUFPOLICY] == DTRACEOPT_BUFPOLICY_FILL)
+			flags |= DTRACEBUF_FILL;
+
+		if (state != dtrace_anon.dta_state ||
+		    state->dts_activity != DTRACE_ACTIVITY_ACTIVE)
+			flags |= DTRACEBUF_INACTIVE;
+	}
+
+	for (size = opt[which]; size >= VBDTCAST(dtrace_optval_t)sizeof (uint64_t); size >>= 1) {
+		/*
+		 * The size must be 8-byte aligned.  If the size is not 8-byte
+		 * aligned, drop it down by the difference.
+		 */
+		if (size & (sizeof (uint64_t) - 1))
+			size -= size & (sizeof (uint64_t) - 1);
+
+		if (size < state->dts_reserve) {
+			/*
+			 * Buffers always must be large enough to accommodate
+			 * their prereserved space.  We return E2BIG instead
+			 * of ENOMEM in this case to allow for user-level
+			 * software to differentiate the cases.
+			 */
+			return (E2BIG);
+		}
+
+		rval = dtrace_buffer_alloc(buf, size, flags, cpu);
+
+		if (rval != ENOMEM) {
+			opt[which] = size;
+			return (rval);
+		}
+
+		if (opt[DTRACEOPT_BUFRESIZE] == DTRACEOPT_BUFRESIZE_MANUAL)
+			return (rval);
+	}
+
+	return (ENOMEM);
+}
+
+static int
+dtrace_state_buffers(dtrace_state_t *state)
+{
+	dtrace_speculation_t *spec = state->dts_speculations;
+	int rval, i;
+
+	if ((rval = dtrace_state_buffer(state, state->dts_buffer,
+	    DTRACEOPT_BUFSIZE)) != 0)
+		return (rval);
+
+	if ((rval = dtrace_state_buffer(state, state->dts_aggbuffer,
+	    DTRACEOPT_AGGSIZE)) != 0)
+		return (rval);
+
+	for (i = 0; i < state->dts_nspeculations; i++) {
+		if ((rval = dtrace_state_buffer(state,
+		    spec[i].dtsp_buffer, DTRACEOPT_SPECSIZE)) != 0)
+			return (rval);
+	}
+
+	return (0);
+}
+
+static void
+dtrace_state_prereserve(dtrace_state_t *state)
+{
+	dtrace_ecb_t *ecb;
+	dtrace_probe_t *probe;
+
+	state->dts_reserve = 0;
+
+	if (state->dts_options[DTRACEOPT_BUFPOLICY] != DTRACEOPT_BUFPOLICY_FILL)
+		return;
+
+	/*
+	 * If our buffer policy is a "fill" buffer policy, we need to set the
+	 * prereserved space to be the space required by the END probes.
+	 */
+	probe = dtrace_probes[dtrace_probeid_end - 1];
+	ASSERT(probe != NULL);
+
+	for (ecb = probe->dtpr_ecb; ecb != NULL; ecb = ecb->dte_next) {
+		if (ecb->dte_state != state)
+			continue;
+
+		state->dts_reserve += VBDTCAST(uint32_t)ecb->dte_needed + ecb->dte_alignment;
+	}
+}
+
+static int
+dtrace_state_go(dtrace_state_t *state, processorid_t *cpu)
+{
+	dtrace_optval_t *opt = state->dts_options, sz, nspec;
+	dtrace_speculation_t *spec;
+	dtrace_buffer_t *buf;
+#ifndef VBOX
+	cyc_handler_t hdlr;
+	cyc_time_t when;
+#endif
+	int rval = 0, i, bufsize = NCPU * sizeof (dtrace_buffer_t);
+	dtrace_icookie_t cookie;
+
+	mutex_enter(&cpu_lock);
+	mutex_enter(&dtrace_lock);
+
+	if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE) {
+		rval = EBUSY;
+		goto out;
+	}
+
+	/*
+	 * Before we can perform any checks, we must prime all of the
+	 * retained enablings that correspond to this state.
+	 */
+	dtrace_enabling_prime(state);
+
+	if (state->dts_destructive && !state->dts_cred.dcr_destructive) {
+		rval = EACCES;
+		goto out;
+	}
+
+	dtrace_state_prereserve(state);
+
+	/*
+	 * Now we want to do is try to allocate our speculations.
+	 * We do not automatically resize the number of speculations; if
+	 * this fails, we will fail the operation.
+	 */
+	nspec = opt[DTRACEOPT_NSPEC];
+	ASSERT(nspec != DTRACEOPT_UNSET);
+
+	if (nspec > INT_MAX) {
+		rval = ENOMEM;
+		goto out;
+	}
+
+	spec = kmem_zalloc(nspec * sizeof (dtrace_speculation_t), KM_NOSLEEP);
+
+	if (spec == NULL) {
+		rval = ENOMEM;
+		goto out;
+	}
+
+	state->dts_speculations = spec;
+	state->dts_nspeculations = (int)nspec;
+
+	for (i = 0; i < nspec; i++) {
+		if ((buf = kmem_zalloc(bufsize, KM_NOSLEEP)) == NULL) {
+			rval = ENOMEM;
+			goto err;
+		}
+
+		spec[i].dtsp_buffer = buf;
+	}
+
+	if (opt[DTRACEOPT_GRABANON] != DTRACEOPT_UNSET) {
+		if (dtrace_anon.dta_state == NULL) {
+			rval = ENOENT;
+			goto out;
+		}
+
+		if (state->dts_necbs != 0) {
+			rval = EALREADY;
+			goto out;
+		}
+
+		state->dts_anon = dtrace_anon_grab();
+		ASSERT(state->dts_anon != NULL);
+		state = state->dts_anon;
+
+		/*
+		 * We want "grabanon" to be set in the grabbed state, so we'll
+		 * copy that option value from the grabbing state into the
+		 * grabbed state.
+		 */
+		state->dts_options[DTRACEOPT_GRABANON] =
+		    opt[DTRACEOPT_GRABANON];
+
+		*cpu = dtrace_anon.dta_beganon;
+
+		/*
+		 * If the anonymous state is active (as it almost certainly
+		 * is if the anonymous enabling ultimately matched anything),
+		 * we don't allow any further option processing -- but we
+		 * don't return failure.
+		 */
+		if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE)
+			goto out;
+	}
+
+	if (opt[DTRACEOPT_AGGSIZE] != DTRACEOPT_UNSET &&
+	    opt[DTRACEOPT_AGGSIZE] != 0) {
+		if (state->dts_aggregations == NULL) {
+			/*
+			 * We're not going to create an aggregation buffer
+			 * because we don't have any ECBs that contain
+			 * aggregations -- set this option to 0.
+			 */
+			opt[DTRACEOPT_AGGSIZE] = 0;
+		} else {
+			/*
+			 * If we have an aggregation buffer, we must also have
+			 * a buffer to use as scratch.
+			 */
+			if (opt[DTRACEOPT_BUFSIZE] == DTRACEOPT_UNSET ||
+			    opt[DTRACEOPT_BUFSIZE] < VBDTCAST(dtrace_optval_t)state->dts_needed) {
+				opt[DTRACEOPT_BUFSIZE] = state->dts_needed;
+			}
+		}
+	}
+
+	if (opt[DTRACEOPT_SPECSIZE] != DTRACEOPT_UNSET &&
+	    opt[DTRACEOPT_SPECSIZE] != 0) {
+		if (!state->dts_speculates) {
+			/*
+			 * We're not going to create speculation buffers
+			 * because we don't have any ECBs that actually
+			 * speculate -- set the speculation size to 0.
+			 */
+			opt[DTRACEOPT_SPECSIZE] = 0;
+		}
+	}
+
+	/*
+	 * The bare minimum size for any buffer that we're actually going to
+	 * do anything to is sizeof (uint64_t).
+	 */
+	sz = sizeof (uint64_t);
+
+	if ((state->dts_needed != 0 && opt[DTRACEOPT_BUFSIZE] < sz) ||
+	    (state->dts_speculates && opt[DTRACEOPT_SPECSIZE] < sz) ||
+	    (state->dts_aggregations != NULL && opt[DTRACEOPT_AGGSIZE] < sz)) {
+		/*
+		 * A buffer size has been explicitly set to 0 (or to a size
+		 * that will be adjusted to 0) and we need the space -- we
+		 * need to return failure.  We return ENOSPC to differentiate
+		 * it from failing to allocate a buffer due to failure to meet
+		 * the reserve (for which we return E2BIG).
+		 */
+		rval = ENOSPC;
+		goto out;
+	}
+
+	if ((rval = dtrace_state_buffers(state)) != 0)
+		goto err;
+
+	if ((sz = opt[DTRACEOPT_DYNVARSIZE]) == DTRACEOPT_UNSET)
+		sz = dtrace_dstate_defsize;
+
+	do {
+		rval = dtrace_dstate_init(&state->dts_vstate.dtvs_dynvars, sz);
+
+		if (rval == 0)
+			break;
+
+		if (opt[DTRACEOPT_BUFRESIZE] == DTRACEOPT_BUFRESIZE_MANUAL)
+			goto err;
+	} while (sz >>= 1);
+
+	opt[DTRACEOPT_DYNVARSIZE] = sz;
+
+	if (rval != 0)
+		goto err;
+
+	if (opt[DTRACEOPT_STATUSRATE] > dtrace_statusrate_max)
+		opt[DTRACEOPT_STATUSRATE] = dtrace_statusrate_max;
+
+	if (opt[DTRACEOPT_CLEANRATE] == 0)
+		opt[DTRACEOPT_CLEANRATE] = dtrace_cleanrate_max;
+
+	if (opt[DTRACEOPT_CLEANRATE] < dtrace_cleanrate_min)
+		opt[DTRACEOPT_CLEANRATE] = dtrace_cleanrate_min;
+
+	if (opt[DTRACEOPT_CLEANRATE] > dtrace_cleanrate_max)
+		opt[DTRACEOPT_CLEANRATE] = dtrace_cleanrate_max;
+
+#ifndef VBOX
+	hdlr.cyh_func = (cyc_func_t)dtrace_state_clean;
+	hdlr.cyh_arg = state;
+	hdlr.cyh_level = CY_LOW_LEVEL;
+
+	when.cyt_when = 0;
+	when.cyt_interval = opt[DTRACEOPT_CLEANRATE];
+
+	state->dts_cleaner = cyclic_add(&hdlr, &when);
+
+	hdlr.cyh_func = (cyc_func_t)dtrace_state_deadman;
+	hdlr.cyh_arg = state;
+	hdlr.cyh_level = CY_LOW_LEVEL;
+
+	when.cyt_when = 0;
+	when.cyt_interval = dtrace_deadman_interval;
+
+	state->dts_alive = state->dts_laststatus = dtrace_gethrtime();
+	state->dts_deadman = cyclic_add(&hdlr, &when);
+#else  /* VBOX */
+
+	rval = RTTimerCreateEx(&state->dts_cleaner, opt[DTRACEOPT_CLEANRATE],
+			       RTTIMER_FLAGS_CPU_ANY, dtrace_state_clean_timer, state);
+	if (RT_FAILURE(rval)) {
+	    rval = RTErrConvertToErrno(rval);
+	    goto err;
+	}
+
+	state->dts_alive = state->dts_laststatus = dtrace_gethrtime();
+	rval = RTTimerCreateEx(&state->dts_deadman, dtrace_deadman_interval,
+			       RTTIMER_FLAGS_CPU_ANY, dtrace_state_deadman_timer, state);
+	if (RT_FAILURE(rval)) {
+	    RTTimerDestroy(state->dts_cleaner);
+	    state->dts_cleaner = CYCLIC_NONE;
+	    state->dts_deadman = CYCLIC_NONE;
+	    rval = RTErrConvertToErrno(rval);
+	    goto err;
+	}
+
+	rval = RTTimerStart(state->dts_cleaner, 0);
+	if (RT_SUCCESS(rval))
+	    rval = RTTimerStart(state->dts_deadman, 0);
+	if (RT_FAILURE(rval)) {
+	    rval = RTErrConvertToErrno(rval);
+	    goto err;
+	}
+#endif /* VBOX */
+
+	state->dts_activity = DTRACE_ACTIVITY_WARMUP;
+
+	/*
+	 * Now it's time to actually fire the BEGIN probe.  We need to disable
+	 * interrupts here both to record the CPU on which we fired the BEGIN
+	 * probe (the data from this CPU will be processed first at user
+	 * level) and to manually activate the buffer for this CPU.
+	 */
+	cookie = dtrace_interrupt_disable();
+	*cpu = VBDT_GET_CPUID();
+	ASSERT(state->dts_buffer[*cpu].dtb_flags & DTRACEBUF_INACTIVE);
+	state->dts_buffer[*cpu].dtb_flags &= ~DTRACEBUF_INACTIVE;
+
+	dtrace_probe(dtrace_probeid_begin,
+	    (uint64_t)(uintptr_t)state, 0, 0, 0, 0);
+	dtrace_interrupt_enable(cookie);
+	/*
+	 * We may have had an exit action from a BEGIN probe; only change our
+	 * state to ACTIVE if we're still in WARMUP.
+	 */
+	ASSERT(state->dts_activity == DTRACE_ACTIVITY_WARMUP ||
+	    state->dts_activity == DTRACE_ACTIVITY_DRAINING);
+
+	if (state->dts_activity == DTRACE_ACTIVITY_WARMUP)
+		state->dts_activity = DTRACE_ACTIVITY_ACTIVE;
+
+	/*
+	 * Regardless of whether or not now we're in ACTIVE or DRAINING, we
+	 * want each CPU to transition its principal buffer out of the
+	 * INACTIVE state.  Doing this assures that no CPU will suddenly begin
+	 * processing an ECB halfway down a probe's ECB chain; all CPUs will
+	 * atomically transition from processing none of a state's ECBs to
+	 * processing all of them.
+	 */
+#ifndef VBOX
+	dtrace_xcall(DTRACE_CPUALL,
+	    (dtrace_xcall_t)dtrace_buffer_activate, state);
+#else
+	RTMpOnAll(dtrace_buffer_activate_wrapper, state, NULL);
+#endif
+	goto out;
+
+err:
+	dtrace_buffer_free(state->dts_buffer);
+	dtrace_buffer_free(state->dts_aggbuffer);
+
+	if ((nspec = state->dts_nspeculations) == 0) {
+		ASSERT(state->dts_speculations == NULL);
+		goto out;
+	}
+
+	spec = state->dts_speculations;
+	ASSERT(spec != NULL);
+
+	for (i = 0; i < state->dts_nspeculations; i++) {
+		if ((buf = spec[i].dtsp_buffer) == NULL)
+			break;
+
+		dtrace_buffer_free(buf);
+		kmem_free(buf, bufsize);
+	}
+
+	kmem_free(spec, nspec * sizeof (dtrace_speculation_t));
+	state->dts_nspeculations = 0;
+	state->dts_speculations = NULL;
+
+out:
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&cpu_lock);
+
+	return (rval);
+}
+
+static int
+dtrace_state_stop(dtrace_state_t *state, processorid_t *cpu)
+{
+	dtrace_icookie_t cookie;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (state->dts_activity != DTRACE_ACTIVITY_ACTIVE &&
+	    state->dts_activity != DTRACE_ACTIVITY_DRAINING)
+		return (EINVAL);
+
+	/*
+	 * We'll set the activity to DTRACE_ACTIVITY_DRAINING, and issue a sync
+	 * to be sure that every CPU has seen it.  See below for the details
+	 * on why this is done.
+	 */
+	state->dts_activity = DTRACE_ACTIVITY_DRAINING;
+	dtrace_sync();
+
+	/*
+	 * By this point, it is impossible for any CPU to be still processing
+	 * with DTRACE_ACTIVITY_ACTIVE.  We can thus set our activity to
+	 * DTRACE_ACTIVITY_COOLDOWN and know that we're not racing with any
+	 * other CPU in dtrace_buffer_reserve().  This allows dtrace_probe()
+	 * and callees to know that the activity is DTRACE_ACTIVITY_COOLDOWN
+	 * iff we're in the END probe.
+	 */
+	state->dts_activity = DTRACE_ACTIVITY_COOLDOWN;
+	dtrace_sync();
+	ASSERT(state->dts_activity == DTRACE_ACTIVITY_COOLDOWN);
+
+	/*
+	 * Finally, we can release the reserve and call the END probe.  We
+	 * disable interrupts across calling the END probe to allow us to
+	 * return the CPU on which we actually called the END probe.  This
+	 * allows user-land to be sure that this CPU's principal buffer is
+	 * processed last.
+	 */
+	state->dts_reserve = 0;
+
+	cookie = dtrace_interrupt_disable();
+	*cpu = VBDT_GET_CPUID();
+	dtrace_probe(dtrace_probeid_end,
+	    (uint64_t)(uintptr_t)state, 0, 0, 0, 0);
+	dtrace_interrupt_enable(cookie);
+
+	state->dts_activity = DTRACE_ACTIVITY_STOPPED;
+	dtrace_sync();
+
+	return (0);
+}
+
+static int
+dtrace_state_option(dtrace_state_t *state, dtrace_optid_t option,
+    dtrace_optval_t val)
+{
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE)
+		return (EBUSY);
+
+	if (option >= DTRACEOPT_MAX)
+		return (EINVAL);
+
+	if (option != DTRACEOPT_CPU && val < 0)
+		return (EINVAL);
+
+	switch (option) {
+	case DTRACEOPT_DESTRUCTIVE:
+		if (dtrace_destructive_disallow)
+			return (EACCES);
+
+		state->dts_cred.dcr_destructive = 1;
+		break;
+
+	case DTRACEOPT_BUFSIZE:
+	case DTRACEOPT_DYNVARSIZE:
+	case DTRACEOPT_AGGSIZE:
+	case DTRACEOPT_SPECSIZE:
+	case DTRACEOPT_STRSIZE:
+		if (val < 0)
+			return (EINVAL);
+
+		if (val >= LONG_MAX) {
+			/*
+			 * If this is an otherwise negative value, set it to
+			 * the highest multiple of 128m less than LONG_MAX.
+			 * Technically, we're adjusting the size without
+			 * regard to the buffer resizing policy, but in fact,
+			 * this has no effect -- if we set the buffer size to
+			 * ~LONG_MAX and the buffer policy is ultimately set to
+			 * be "manual", the buffer allocation is guaranteed to
+			 * fail, if only because the allocation requires two
+			 * buffers.  (We set the the size to the highest
+			 * multiple of 128m because it ensures that the size
+			 * will remain a multiple of a megabyte when
+			 * repeatedly halved -- all the way down to 15m.)
+			 */
+			val = LONG_MAX - (1 << 27) + 1;
+		}
+	}
+
+	state->dts_options[option] = val;
+
+	return (0);
+}
+
+static void
+dtrace_state_destroy(dtrace_state_t *state)
+{
+	dtrace_ecb_t *ecb;
+	dtrace_vstate_t *vstate = &state->dts_vstate;
+#ifndef VBOX
+	minor_t minor = getminor(state->dts_dev);
+#endif
+	int i, bufsize = NCPU * sizeof (dtrace_buffer_t);
+	dtrace_speculation_t *spec = state->dts_speculations;
+	int nspec = state->dts_nspeculations;
+	uint32_t match;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	/*
+	 * First, retract any retained enablings for this state.
+	 */
+	dtrace_enabling_retract(state);
+	ASSERT(state->dts_nretained == 0);
+
+	if (state->dts_activity == DTRACE_ACTIVITY_ACTIVE ||
+	    state->dts_activity == DTRACE_ACTIVITY_DRAINING) {
+		/*
+		 * We have managed to come into dtrace_state_destroy() on a
+		 * hot enabling -- almost certainly because of a disorderly
+		 * shutdown of a consumer.  (That is, a consumer that is
+		 * exiting without having called dtrace_stop().) In this case,
+		 * we're going to set our activity to be KILLED, and then
+		 * issue a sync to be sure that everyone is out of probe
+		 * context before we start blowing away ECBs.
+		 */
+		state->dts_activity = DTRACE_ACTIVITY_KILLED;
+		dtrace_sync();
+	}
+
+	/*
+	 * Release the credential hold we took in dtrace_state_create().
+	 */
+	if (state->dts_cred.dcr_cred != NULL)
+		crfree(state->dts_cred.dcr_cred);
+
+	/*
+	 * Now we can safely disable and destroy any enabled probes.  Because
+	 * any DTRACE_PRIV_KERNEL probes may actually be slowing our progress
+	 * (especially if they're all enabled), we take two passes through the
+	 * ECBs:  in the first, we disable just DTRACE_PRIV_KERNEL probes, and
+	 * in the second we disable whatever is left over.
+	 */
+	for (match = DTRACE_PRIV_KERNEL; ; match = 0) {
+		for (i = 0; i < state->dts_necbs; i++) {
+			if ((ecb = state->dts_ecbs[i]) == NULL)
+				continue;
+
+			if (match && ecb->dte_probe != NULL) {
+				dtrace_probe_t *probe = ecb->dte_probe;
+				dtrace_provider_t *prov = probe->dtpr_provider;
+
+				if (!(prov->dtpv_priv.dtpp_flags & match))
+					continue;
+			}
+
+			dtrace_ecb_disable(ecb);
+			dtrace_ecb_destroy(ecb);
+		}
+
+		if (!match)
+			break;
+	}
+
+	/*
+	 * Before we free the buffers, perform one more sync to assure that
+	 * every CPU is out of probe context.
+	 */
+	dtrace_sync();
+
+	dtrace_buffer_free(state->dts_buffer);
+	dtrace_buffer_free(state->dts_aggbuffer);
+
+	for (i = 0; i < nspec; i++)
+		dtrace_buffer_free(spec[i].dtsp_buffer);
+
+	if (state->dts_cleaner != CYCLIC_NONE)
+		cyclic_remove(state->dts_cleaner);
+
+	if (state->dts_deadman != CYCLIC_NONE)
+		cyclic_remove(state->dts_deadman);
+
+	dtrace_dstate_fini(&vstate->dtvs_dynvars);
+	dtrace_vstate_fini(vstate);
+	kmem_free(state->dts_ecbs, state->dts_necbs * sizeof (dtrace_ecb_t *));
+
+	if (state->dts_aggregations != NULL) {
+#ifdef DEBUG
+		for (i = 0; i < state->dts_naggregations; i++)
+			ASSERT(state->dts_aggregations[i] == NULL);
+#endif
+		ASSERT(state->dts_naggregations > 0);
+		kmem_free(state->dts_aggregations,
+		    state->dts_naggregations * sizeof (dtrace_aggregation_t *));
+	}
+
+	kmem_free(state->dts_buffer, bufsize);
+	kmem_free(state->dts_aggbuffer, bufsize);
+
+	for (i = 0; i < nspec; i++)
+		kmem_free(spec[i].dtsp_buffer, bufsize);
+
+	kmem_free(spec, nspec * sizeof (dtrace_speculation_t));
+
+	dtrace_format_destroy(state);
+
+	vmem_destroy(state->dts_aggid_arena);
+#ifndef VBOX
+	ddi_soft_state_free(dtrace_softstate, minor);
+	vmem_free(dtrace_minor, (void *)(uintptr_t)minor, 1);
+#else
+	kmem_free(state, sizeof (*state));
+#endif
+}
+
+/*
+ * DTrace Anonymous Enabling Functions
+ */
+static dtrace_state_t *
+dtrace_anon_grab(void)
+{
+	dtrace_state_t *state;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if ((state = dtrace_anon.dta_state) == NULL) {
+		ASSERT(dtrace_anon.dta_enabling == NULL);
+		return (NULL);
+	}
+
+	ASSERT(dtrace_anon.dta_enabling != NULL);
+	ASSERT(dtrace_retained != NULL);
+
+	dtrace_enabling_destroy(dtrace_anon.dta_enabling);
+	dtrace_anon.dta_enabling = NULL;
+	dtrace_anon.dta_state = NULL;
+
+	return (state);
+}
+
+#ifndef VBOX
+static void
+dtrace_anon_property(void)
+{
+	int i, rv;
+	dtrace_state_t *state;
+	dof_hdr_t *dof;
+	char c[32];		/* enough for "dof-data-" + digits */
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	for (i = 0; ; i++) {
+		(void) snprintf(c, sizeof (c), "dof-data-%d", i);
+
+		dtrace_err_verbose = 1;
+
+		if ((dof = dtrace_dof_property(c)) == NULL) {
+			dtrace_err_verbose = 0;
+			break;
+		}
+
+#ifndef VBOX
+		/*
+		 * We want to create anonymous state, so we need to transition
+		 * the kernel debugger to indicate that DTrace is active.  If
+		 * this fails (e.g. because the debugger has modified text in
+		 * some way), we won't continue with the processing.
+		 */
+		if (kdi_dtrace_set(KDI_DTSET_DTRACE_ACTIVATE) != 0) {
+			cmn_err(CE_NOTE, "kernel debugger active; anonymous "
+			    "enabling ignored.");
+			dtrace_dof_destroy(dof);
+			break;
+		}
+#endif
+
+		/*
+		 * If we haven't allocated an anonymous state, we'll do so now.
+		 */
+		if ((state = dtrace_anon.dta_state) == NULL) {
+			state = dtrace_state_create(NULL, NULL);
+			dtrace_anon.dta_state = state;
+
+			if (state == NULL) {
+				/*
+				 * This basically shouldn't happen:  the only
+				 * failure mode from dtrace_state_create() is a
+				 * failure of ddi_soft_state_zalloc() that
+				 * itself should never happen.  Still, the
+				 * interface allows for a failure mode, and
+				 * we want to fail as gracefully as possible:
+				 * we'll emit an error message and cease
+				 * processing anonymous state in this case.
+				 */
+				cmn_err(CE_WARN, "failed to create "
+				    "anonymous state");
+				dtrace_dof_destroy(dof);
+				break;
+			}
+		}
+
+		rv = dtrace_dof_slurp(dof, &state->dts_vstate, CRED(),
+		    &dtrace_anon.dta_enabling, 0, B_TRUE);
+
+		if (rv == 0)
+			rv = dtrace_dof_options(dof, state);
+
+		dtrace_err_verbose = 0;
+		dtrace_dof_destroy(dof);
+
+		if (rv != 0) {
+			/*
+			 * This is malformed DOF; chuck any anonymous state
+			 * that we created.
+			 */
+			ASSERT(dtrace_anon.dta_enabling == NULL);
+			dtrace_state_destroy(state);
+			dtrace_anon.dta_state = NULL;
+			break;
+		}
+
+		ASSERT(dtrace_anon.dta_enabling != NULL);
+	}
+
+	if (dtrace_anon.dta_enabling != NULL) {
+		int rval;
+
+		/*
+		 * dtrace_enabling_retain() can only fail because we are
+		 * trying to retain more enablings than are allowed -- but
+		 * we only have one anonymous enabling, and we are guaranteed
+		 * to be allowed at least one retained enabling; we assert
+		 * that dtrace_enabling_retain() returns success.
+		 */
+		rval = dtrace_enabling_retain(dtrace_anon.dta_enabling);
+		ASSERT(rval == 0);
+
+		dtrace_enabling_dump(dtrace_anon.dta_enabling);
+	}
+}
+#endif /* !VBOX */
+
+/*
+ * DTrace Helper Functions
+ */
+#ifndef VBOX /* No helper stuff */
+static void
+dtrace_helper_trace(dtrace_helper_action_t *helper,
+    dtrace_mstate_t *mstate, dtrace_vstate_t *vstate, int where)
+{
+	uint32_t size, next, nnext, i;
+	dtrace_helptrace_t *ent;
+	uint16_t flags = cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+
+	if (!dtrace_helptrace_enabled)
+		return;
+
+	ASSERT(vstate->dtvs_nlocals <= VBDTCAST(int32_t)dtrace_helptrace_nlocals);
+
+	/*
+	 * What would a tracing framework be without its own tracing
+	 * framework?  (Well, a hell of a lot simpler, for starters...)
+	 */
+	size = sizeof (dtrace_helptrace_t) + dtrace_helptrace_nlocals *
+	    sizeof (uint64_t) - sizeof (uint64_t);
+
+	/*
+	 * Iterate until we can allocate a slot in the trace buffer.
+	 */
+	do {
+		next = dtrace_helptrace_next;
+
+		if (next + size < VBDTCAST(unsigned)dtrace_helptrace_bufsize) {
+			nnext = next + size;
+		} else {
+			nnext = size;
+		}
+	} while (dtrace_cas32(&dtrace_helptrace_next, next, nnext) != next);
+
+	/*
+	 * We have our slot; fill it in.
+	 */
+	if (nnext == size)
+		next = 0;
+
+	ent = (dtrace_helptrace_t *)&dtrace_helptrace_buffer[next];
+	ent->dtht_helper = helper;
+	ent->dtht_where = where;
+	ent->dtht_nlocals = vstate->dtvs_nlocals;
+
+	ent->dtht_fltoffs = (mstate->dtms_present & DTRACE_MSTATE_FLTOFFS) ?
+	    mstate->dtms_fltoffs : -1;
+	ent->dtht_fault = DTRACE_FLAGS2FLT(flags);
+	ent->dtht_illval = cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_illval;
+
+	for (i = 0; VBDTCAST(int32_t)i < vstate->dtvs_nlocals; i++) {
+		dtrace_statvar_t *svar;
+
+		if ((svar = vstate->dtvs_locals[i]) == NULL)
+			continue;
+
+		ASSERT(svar->dtsv_size >= NCPU * sizeof (uint64_t));
+		ent->dtht_locals[i] =
+		    ((uint64_t *)(uintptr_t)svar->dtsv_data)[VBDT_GET_CPUID()];
+	}
+}
+
+static uint64_t
+dtrace_helper(int which, dtrace_mstate_t *mstate,
+    dtrace_state_t *state, uint64_t arg0, uint64_t arg1)
+{
+	VBDTTYPE(uint16_t volatile *, uint16_t *)flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+	uint64_t sarg0 = mstate->dtms_arg[0];
+	uint64_t sarg1 = mstate->dtms_arg[1];
+	uint64_t rval VBDTUNASS(666);
+	dtrace_helpers_t *helpers = curproc->p_dtrace_helpers;
+	dtrace_helper_action_t *helper;
+	dtrace_vstate_t *vstate;
+	dtrace_difo_t *pred;
+	int i, trace = dtrace_helptrace_enabled;
+
+	ASSERT(which >= 0 && which < DTRACE_NHELPER_ACTIONS);
+
+	if (helpers == NULL)
+		return (0);
+
+	if ((helper = helpers->dthps_actions[which]) == NULL)
+		return (0);
+
+	vstate = &helpers->dthps_vstate;
+	mstate->dtms_arg[0] = arg0;
+	mstate->dtms_arg[1] = arg1;
+
+	/*
+	 * Now iterate over each helper.  If its predicate evaluates to 'true',
+	 * we'll call the corresponding actions.  Note that the below calls
+	 * to dtrace_dif_emulate() may set faults in machine state.  This is
+	 * okay:  our caller (the outer dtrace_dif_emulate()) will simply plow
+	 * the stored DIF offset with its own (which is the desired behavior).
+	 * Also, note the calls to dtrace_dif_emulate() may allocate scratch
+	 * from machine state; this is okay, too.
+	 */
+	for (; helper != NULL; helper = helper->dtha_next) {
+		if ((pred = helper->dtha_predicate) != NULL) {
+			if (trace)
+				dtrace_helper_trace(helper, mstate, vstate, 0);
+
+			if (!dtrace_dif_emulate(pred, mstate, vstate, state))
+				goto next;
+
+			if (*flags & CPU_DTRACE_FAULT)
+				goto err;
+		}
+
+		for (i = 0; i < helper->dtha_nactions; i++) {
+			if (trace)
+				dtrace_helper_trace(helper,
+				    mstate, vstate, i + 1);
+
+			rval = dtrace_dif_emulate(helper->dtha_actions[i],
+			    mstate, vstate, state);
+
+			if (*flags & CPU_DTRACE_FAULT)
+				goto err;
+		}
+
+next:
+		if (trace)
+			dtrace_helper_trace(helper, mstate, vstate,
+			    DTRACE_HELPTRACE_NEXT);
+	}
+
+	if (trace)
+		dtrace_helper_trace(helper, mstate, vstate,
+		    DTRACE_HELPTRACE_DONE);
+
+	/*
+	 * Restore the arg0 that we saved upon entry.
+	 */
+	mstate->dtms_arg[0] = sarg0;
+	mstate->dtms_arg[1] = sarg1;
+
+	return (rval);
+
+err:
+	if (trace)
+		dtrace_helper_trace(helper, mstate, vstate,
+		    DTRACE_HELPTRACE_ERR);
+
+	/*
+	 * Restore the arg0 that we saved upon entry.
+	 */
+	mstate->dtms_arg[0] = sarg0;
+	mstate->dtms_arg[1] = sarg1;
+
+	return (NULL);
+}
+
+static void
+dtrace_helper_action_destroy(dtrace_helper_action_t *helper,
+    dtrace_vstate_t *vstate)
+{
+	int i;
+
+	if (helper->dtha_predicate != NULL)
+		dtrace_difo_release(helper->dtha_predicate, vstate);
+
+	for (i = 0; i < helper->dtha_nactions; i++) {
+		ASSERT(helper->dtha_actions[i] != NULL);
+		dtrace_difo_release(helper->dtha_actions[i], vstate);
+	}
+
+	kmem_free(helper->dtha_actions,
+	    helper->dtha_nactions * sizeof (dtrace_difo_t *));
+	kmem_free(helper, sizeof (dtrace_helper_action_t));
+}
+
+static int
+dtrace_helper_destroygen(int gen)
+{
+	proc_t *p = curproc;
+	dtrace_helpers_t *help = p->p_dtrace_helpers;
+	dtrace_vstate_t *vstate;
+	VBDTTYPE(uint_t,int) i;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if (help == NULL || gen > help->dthps_generation)
+		return (EINVAL);
+
+	vstate = &help->dthps_vstate;
+
+	for (i = 0; i < DTRACE_NHELPER_ACTIONS; i++) {
+		dtrace_helper_action_t *last = NULL, *h, *next;
+
+		for (h = help->dthps_actions[i]; h != NULL; h = next) {
+			next = h->dtha_next;
+
+			if (h->dtha_generation == gen) {
+				if (last != NULL) {
+					last->dtha_next = next;
+				} else {
+					help->dthps_actions[i] = next;
+				}
+
+				dtrace_helper_action_destroy(h, vstate);
+			} else {
+				last = h;
+			}
+		}
+	}
+
+	/*
+	 * Interate until we've cleared out all helper providers with the
+	 * given generation number.
+	 */
+	for (;;) {
+		dtrace_helper_provider_t *prov VBDTGCC(NULL);
+
+		/*
+		 * Look for a helper provider with the right generation. We
+		 * have to start back at the beginning of the list each time
+		 * because we drop dtrace_lock. It's unlikely that we'll make
+		 * more than two passes.
+		 */
+		for (i = 0; i < help->dthps_nprovs; i++) {
+			prov = help->dthps_provs[i];
+
+			if (prov->dthp_generation == gen)
+				break;
+		}
+
+		/*
+		 * If there were no matches, we're done.
+		 */
+		if (i == help->dthps_nprovs)
+			break;
+
+		/*
+		 * Move the last helper provider into this slot.
+		 */
+		help->dthps_nprovs--;
+		help->dthps_provs[i] = help->dthps_provs[help->dthps_nprovs];
+		help->dthps_provs[help->dthps_nprovs] = NULL;
+
+		mutex_exit(&dtrace_lock);
+
+		/*
+		 * If we have a meta provider, remove this helper provider.
+		 */
+		mutex_enter(&dtrace_meta_lock);
+		if (dtrace_meta_pid != NULL) {
+			ASSERT(dtrace_deferred_pid == NULL);
+			dtrace_helper_provider_remove(&prov->dthp_prov,
+			    p->p_pid);
+		}
+		mutex_exit(&dtrace_meta_lock);
+
+		dtrace_helper_provider_destroy(prov);
+
+		mutex_enter(&dtrace_lock);
+	}
+
+	return (0);
+}
+
+static int
+dtrace_helper_validate(dtrace_helper_action_t *helper)
+{
+	int err = 0, i;
+	dtrace_difo_t *dp;
+
+	if ((dp = helper->dtha_predicate) != NULL)
+		err += dtrace_difo_validate_helper(dp);
+
+	for (i = 0; i < helper->dtha_nactions; i++)
+		err += dtrace_difo_validate_helper(helper->dtha_actions[i]);
+
+	return (err == 0);
+}
+
+static int
+dtrace_helper_action_add(int which, dtrace_ecbdesc_t *ep)
+{
+	dtrace_helpers_t *help;
+	dtrace_helper_action_t *helper, *last;
+	dtrace_actdesc_t *act;
+	dtrace_vstate_t *vstate;
+	dtrace_predicate_t *pred;
+	int count = 0, nactions = 0, i;
+
+	if (which < 0 || which >= DTRACE_NHELPER_ACTIONS)
+		return (EINVAL);
+
+	help = curproc->p_dtrace_helpers;
+	last = help->dthps_actions[which];
+	vstate = &help->dthps_vstate;
+
+	for (count = 0; last != NULL; last = last->dtha_next) {
+		count++;
+		if (last->dtha_next == NULL)
+			break;
+	}
+
+	/*
+	 * If we already have dtrace_helper_actions_max helper actions for this
+	 * helper action type, we'll refuse to add a new one.
+	 */
+	if (count >= dtrace_helper_actions_max)
+		return (ENOSPC);
+
+	helper = kmem_zalloc(sizeof (dtrace_helper_action_t), KM_SLEEP);
+	helper->dtha_generation = help->dthps_generation;
+
+	if ((pred = ep->dted_pred.dtpdd_predicate) != NULL) {
+		ASSERT(pred->dtp_difo != NULL);
+		dtrace_difo_hold(pred->dtp_difo);
+		helper->dtha_predicate = pred->dtp_difo;
+	}
+
+	for (act = ep->dted_action; act != NULL; act = act->dtad_next) {
+		if (act->dtad_kind != DTRACEACT_DIFEXPR)
+			goto err;
+
+		if (act->dtad_difo == NULL)
+			goto err;
+
+		nactions++;
+	}
+
+	helper->dtha_actions = kmem_zalloc(sizeof (dtrace_difo_t *) *
+	    (helper->dtha_nactions = nactions), KM_SLEEP);
+
+	for (act = ep->dted_action, i = 0; act != NULL; act = act->dtad_next) {
+		dtrace_difo_hold(act->dtad_difo);
+		helper->dtha_actions[i++] = act->dtad_difo;
+	}
+
+	if (!dtrace_helper_validate(helper))
+		goto err;
+
+	if (last == NULL) {
+		help->dthps_actions[which] = helper;
+	} else {
+		last->dtha_next = helper;
+	}
+
+	if (vstate->dtvs_nlocals > VBDTCAST(int32_t)dtrace_helptrace_nlocals) {
+		dtrace_helptrace_nlocals = vstate->dtvs_nlocals;
+		dtrace_helptrace_next = 0;
+	}
+
+	return (0);
+err:
+	dtrace_helper_action_destroy(helper, vstate);
+	return (EINVAL);
+}
+
+static void
+dtrace_helper_provider_register(proc_t *p, dtrace_helpers_t *help,
+    dof_helper_t *dofhp)
+{
+	ASSERT(MUTEX_NOT_HELD(&dtrace_lock));
+
+	mutex_enter(&dtrace_meta_lock);
+	mutex_enter(&dtrace_lock);
+
+	if (!dtrace_attached() || dtrace_meta_pid == NULL) {
+		/*
+		 * If the dtrace module is loaded but not attached, or if
+		 * there aren't isn't a meta provider registered to deal with
+		 * these provider descriptions, we need to postpone creating
+		 * the actual providers until later.
+		 */
+
+		if (help->dthps_next == NULL && help->dthps_prev == NULL &&
+		    dtrace_deferred_pid != help) {
+			help->dthps_deferred = 1;
+			help->dthps_pid = p->p_pid;
+			help->dthps_next = dtrace_deferred_pid;
+			help->dthps_prev = NULL;
+			if (dtrace_deferred_pid != NULL)
+				dtrace_deferred_pid->dthps_prev = help;
+			dtrace_deferred_pid = help;
+		}
+
+		mutex_exit(&dtrace_lock);
+
+	} else if (dofhp != NULL) {
+		/*
+		 * If the dtrace module is loaded and we have a particular
+		 * helper provider description, pass that off to the
+		 * meta provider.
+		 */
+
+		mutex_exit(&dtrace_lock);
+
+		dtrace_helper_provide(dofhp, p->p_pid);
+
+	} else {
+		/*
+		 * Otherwise, just pass all the helper provider descriptions
+		 * off to the meta provider.
+		 */
+
+		VBDTTYPE(uint_t,int) i;
+		mutex_exit(&dtrace_lock);
+
+		for (i = 0; i < help->dthps_nprovs; i++) {
+			dtrace_helper_provide(&help->dthps_provs[i]->dthp_prov,
+			    p->p_pid);
+		}
+	}
+
+	mutex_exit(&dtrace_meta_lock);
+}
+
+static int
+dtrace_helper_provider_add(dof_helper_t *dofhp, int gen)
+{
+	dtrace_helpers_t *help;
+	dtrace_helper_provider_t *hprov, **tmp_provs;
+	uint_t tmp_maxprovs, i;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	help = curproc->p_dtrace_helpers;
+	ASSERT(help != NULL);
+
+	/*
+	 * If we already have dtrace_helper_providers_max helper providers,
+	 * we're refuse to add a new one.
+	 */
+	if (help->dthps_nprovs >= dtrace_helper_providers_max)
+		return (ENOSPC);
+
+	/*
+	 * Check to make sure this isn't a duplicate.
+	 */
+	for (i = 0; i < help->dthps_nprovs; i++) {
+		if (dofhp->dofhp_addr ==
+		    help->dthps_provs[i]->dthp_prov.dofhp_addr)
+			return (EALREADY);
+	}
+
+	hprov = kmem_zalloc(sizeof (dtrace_helper_provider_t), KM_SLEEP);
+	hprov->dthp_prov = *dofhp;
+	hprov->dthp_ref = 1;
+	hprov->dthp_generation = gen;
+
+	/*
+	 * Allocate a bigger table for helper providers if it's already full.
+	 */
+	if (help->dthps_maxprovs == help->dthps_nprovs) {
+		tmp_maxprovs = help->dthps_maxprovs;
+		tmp_provs = help->dthps_provs;
+
+		if (help->dthps_maxprovs == 0)
+			help->dthps_maxprovs = 2;
+		else
+			help->dthps_maxprovs *= 2;
+		if (help->dthps_maxprovs > dtrace_helper_providers_max)
+			help->dthps_maxprovs = dtrace_helper_providers_max;
+
+		ASSERT(tmp_maxprovs < help->dthps_maxprovs);
+
+		help->dthps_provs = kmem_zalloc(help->dthps_maxprovs *
+		    sizeof (dtrace_helper_provider_t *), KM_SLEEP);
+
+		if (tmp_provs != NULL) {
+			bcopy(tmp_provs, help->dthps_provs, tmp_maxprovs *
+			    sizeof (dtrace_helper_provider_t *));
+			kmem_free(tmp_provs, tmp_maxprovs *
+			    sizeof (dtrace_helper_provider_t *));
+		}
+	}
+
+	help->dthps_provs[help->dthps_nprovs] = hprov;
+	help->dthps_nprovs++;
+
+	return (0);
+}
+
+static void
+dtrace_helper_provider_destroy(dtrace_helper_provider_t *hprov)
+{
+	mutex_enter(&dtrace_lock);
+
+	if (--hprov->dthp_ref == 0) {
+		dof_hdr_t *dof;
+		mutex_exit(&dtrace_lock);
+		dof = (dof_hdr_t *)(uintptr_t)hprov->dthp_prov.dofhp_dof;
+		dtrace_dof_destroy(dof);
+		kmem_free(hprov, sizeof (dtrace_helper_provider_t));
+	} else {
+		mutex_exit(&dtrace_lock);
+	}
+}
+
+static int
+dtrace_helper_provider_validate(dof_hdr_t *dof, dof_sec_t *sec)
+{
+	uintptr_t daddr = (uintptr_t)dof;
+	dof_sec_t *str_sec, *prb_sec, *arg_sec, *off_sec, *enoff_sec;
+	dof_provider_t *provider;
+	dof_probe_t *probe;
+	uint8_t *arg;
+	char *strtab, *typestr;
+	dof_stridx_t typeidx;
+	size_t typesz;
+	uint_t nprobes, j, k;
+
+	ASSERT(sec->dofs_type == DOF_SECT_PROVIDER);
+
+	if (sec->dofs_offset & (sizeof (uint_t) - 1)) {
+		dtrace_dof_error(dof, "misaligned section offset");
+		return (-1);
+	}
+
+	/*
+	 * The section needs to be large enough to contain the DOF provider
+	 * structure appropriate for the given version.
+	 */
+	if (sec->dofs_size <
+	    ((dof->dofh_ident[DOF_ID_VERSION] == DOF_VERSION_1) ?
+	    offsetof(dof_provider_t, dofpv_prenoffs) :
+	    sizeof (dof_provider_t))) {
+		dtrace_dof_error(dof, "provider section too small");
+		return (-1);
+	}
+
+	provider = (dof_provider_t *)(uintptr_t)(daddr + sec->dofs_offset);
+	str_sec = dtrace_dof_sect(dof, DOF_SECT_STRTAB, provider->dofpv_strtab);
+	prb_sec = dtrace_dof_sect(dof, DOF_SECT_PROBES, provider->dofpv_probes);
+	arg_sec = dtrace_dof_sect(dof, DOF_SECT_PRARGS, provider->dofpv_prargs);
+	off_sec = dtrace_dof_sect(dof, DOF_SECT_PROFFS, provider->dofpv_proffs);
+
+	if (str_sec == NULL || prb_sec == NULL ||
+	    arg_sec == NULL || off_sec == NULL)
+		return (-1);
+
+	enoff_sec = NULL;
+
+	if (dof->dofh_ident[DOF_ID_VERSION] != DOF_VERSION_1 &&
+	    provider->dofpv_prenoffs != DOF_SECT_NONE &&
+	    (enoff_sec = dtrace_dof_sect(dof, DOF_SECT_PRENOFFS,
+	    provider->dofpv_prenoffs)) == NULL)
+		return (-1);
+
+	strtab = (char *)(uintptr_t)(daddr + str_sec->dofs_offset);
+
+	if (provider->dofpv_name >= str_sec->dofs_size ||
+	    strlen(strtab + provider->dofpv_name) >= DTRACE_PROVNAMELEN) {
+		dtrace_dof_error(dof, "invalid provider name");
+		return (-1);
+	}
+
+	if (prb_sec->dofs_entsize == 0 ||
+	    prb_sec->dofs_entsize > prb_sec->dofs_size) {
+		dtrace_dof_error(dof, "invalid entry size");
+		return (-1);
+	}
+
+	if (prb_sec->dofs_entsize & (sizeof (uintptr_t) - 1)) {
+		dtrace_dof_error(dof, "misaligned entry size");
+		return (-1);
+	}
+
+	if (off_sec->dofs_entsize != sizeof (uint32_t)) {
+		dtrace_dof_error(dof, "invalid entry size");
+		return (-1);
+	}
+
+	if (off_sec->dofs_offset & (sizeof (uint32_t) - 1)) {
+		dtrace_dof_error(dof, "misaligned section offset");
+		return (-1);
+	}
+
+	if (arg_sec->dofs_entsize != sizeof (uint8_t)) {
+		dtrace_dof_error(dof, "invalid entry size");
+		return (-1);
+	}
+
+	arg = (uint8_t *)(uintptr_t)(daddr + arg_sec->dofs_offset);
+
+	nprobes = prb_sec->dofs_size / prb_sec->dofs_entsize;
+
+	/*
+	 * Take a pass through the probes to check for errors.
+	 */
+	for (j = 0; j < nprobes; j++) {
+		probe = (dof_probe_t *)(uintptr_t)(daddr +
+		    prb_sec->dofs_offset + j * prb_sec->dofs_entsize);
+
+		if (probe->dofpr_func >= str_sec->dofs_size) {
+			dtrace_dof_error(dof, "invalid function name");
+			return (-1);
+		}
+
+		if (strlen(strtab + probe->dofpr_func) >= DTRACE_FUNCNAMELEN) {
+			dtrace_dof_error(dof, "function name too long");
+			return (-1);
+		}
+
+		if (probe->dofpr_name >= str_sec->dofs_size ||
+		    strlen(strtab + probe->dofpr_name) >= DTRACE_NAMELEN) {
+			dtrace_dof_error(dof, "invalid probe name");
+			return (-1);
+		}
+
+		/*
+		 * The offset count must not wrap the index, and the offsets
+		 * must also not overflow the section's data.
+		 */
+		if (probe->dofpr_offidx + probe->dofpr_noffs <
+		    probe->dofpr_offidx ||
+		    (probe->dofpr_offidx + probe->dofpr_noffs) *
+		    off_sec->dofs_entsize > off_sec->dofs_size) {
+			dtrace_dof_error(dof, "invalid probe offset");
+			return (-1);
+		}
+
+		if (dof->dofh_ident[DOF_ID_VERSION] != DOF_VERSION_1) {
+			/*
+			 * If there's no is-enabled offset section, make sure
+			 * there aren't any is-enabled offsets. Otherwise
+			 * perform the same checks as for probe offsets
+			 * (immediately above).
+			 */
+			if (enoff_sec == NULL) {
+				if (probe->dofpr_enoffidx != 0 ||
+				    probe->dofpr_nenoffs != 0) {
+					dtrace_dof_error(dof, "is-enabled "
+					    "offsets with null section");
+					return (-1);
+				}
+			} else if (probe->dofpr_enoffidx +
+			    probe->dofpr_nenoffs < probe->dofpr_enoffidx ||
+			    (probe->dofpr_enoffidx + probe->dofpr_nenoffs) *
+			    enoff_sec->dofs_entsize > enoff_sec->dofs_size) {
+				dtrace_dof_error(dof, "invalid is-enabled "
+				    "offset");
+				return (-1);
+			}
+
+			if (probe->dofpr_noffs + probe->dofpr_nenoffs == 0) {
+				dtrace_dof_error(dof, "zero probe and "
+				    "is-enabled offsets");
+				return (-1);
+			}
+		} else if (probe->dofpr_noffs == 0) {
+			dtrace_dof_error(dof, "zero probe offsets");
+			return (-1);
+		}
+
+		if (probe->dofpr_argidx + probe->dofpr_xargc <
+		    probe->dofpr_argidx ||
+		    (probe->dofpr_argidx + probe->dofpr_xargc) *
+		    arg_sec->dofs_entsize > arg_sec->dofs_size) {
+			dtrace_dof_error(dof, "invalid args");
+			return (-1);
+		}
+
+		typeidx = probe->dofpr_nargv;
+		typestr = strtab + probe->dofpr_nargv;
+		for (k = 0; k < probe->dofpr_nargc; k++) {
+			if (typeidx >= str_sec->dofs_size) {
+				dtrace_dof_error(dof, "bad "
+				    "native argument type");
+				return (-1);
+			}
+
+			typesz = strlen(typestr) + 1;
+			if (typesz > DTRACE_ARGTYPELEN) {
+				dtrace_dof_error(dof, "native "
+				    "argument type too long");
+				return (-1);
+			}
+			typeidx += VBDTCAST(dof_stridx_t)typesz;
+			typestr += typesz;
+		}
+
+		typeidx = probe->dofpr_xargv;
+		typestr = strtab + probe->dofpr_xargv;
+		for (k = 0; k < probe->dofpr_xargc; k++) {
+			if (arg[probe->dofpr_argidx + k] > probe->dofpr_nargc) {
+				dtrace_dof_error(dof, "bad "
+				    "native argument index");
+				return (-1);
+			}
+
+			if (typeidx >= str_sec->dofs_size) {
+				dtrace_dof_error(dof, "bad "
+				    "translated argument type");
+				return (-1);
+			}
+
+			typesz = strlen(typestr) + 1;
+			if (typesz > DTRACE_ARGTYPELEN) {
+				dtrace_dof_error(dof, "translated argument "
+				    "type too long");
+				return (-1);
+			}
+
+			typeidx += VBDTCAST(dof_stridx_t)typesz;
+			typestr += typesz;
+		}
+	}
+
+	return (0);
+}
+
+static int
+dtrace_helper_slurp(dof_hdr_t *dof, dof_helper_t *dhp)
+{
+	dtrace_helpers_t *help;
+	dtrace_vstate_t *vstate;
+	dtrace_enabling_t *enab = NULL;
+	int i, gen, rv, nhelpers = 0, nprovs = 0, destroy = 1;
+	uintptr_t daddr = (uintptr_t)dof;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+
+	if ((help = curproc->p_dtrace_helpers) == NULL)
+		help = dtrace_helpers_create(curproc);
+
+	vstate = &help->dthps_vstate;
+
+	if ((rv = dtrace_dof_slurp(dof, vstate, NULL, &enab,
+	    dhp != NULL ? dhp->dofhp_addr : 0, B_FALSE)) != 0) {
+		dtrace_dof_destroy(dof);
+		return (rv);
+	}
+
+	/*
+	 * Look for helper providers and validate their descriptions.
+	 */
+	if (dhp != NULL) {
+		for (i = 0; i < VBDTCAST(int)dof->dofh_secnum; i++) {
+			dof_sec_t *sec = (dof_sec_t *)(uintptr_t)(daddr +
+			    dof->dofh_secoff + i * dof->dofh_secsize);
+
+			if (sec->dofs_type != DOF_SECT_PROVIDER)
+				continue;
+
+			if (dtrace_helper_provider_validate(dof, sec) != 0) {
+				dtrace_enabling_destroy(enab);
+				dtrace_dof_destroy(dof);
+				return (-1);
+			}
+
+			nprovs++;
+		}
+	}
+
+	/*
+	 * Now we need to walk through the ECB descriptions in the enabling.
+	 */
+	for (i = 0; i < enab->dten_ndesc; i++) {
+		dtrace_ecbdesc_t *ep = enab->dten_desc[i];
+		dtrace_probedesc_t *desc = &ep->dted_probe;
+
+		if (strcmp(desc->dtpd_provider, "dtrace") != 0)
+			continue;
+
+		if (strcmp(desc->dtpd_mod, "helper") != 0)
+			continue;
+
+		if (strcmp(desc->dtpd_func, "ustack") != 0)
+			continue;
+
+		if ((rv = dtrace_helper_action_add(DTRACE_HELPER_ACTION_USTACK,
+		    ep)) != 0) {
+			/*
+			 * Adding this helper action failed -- we are now going
+			 * to rip out the entire generation and return failure.
+			 */
+			(void) dtrace_helper_destroygen(help->dthps_generation);
+			dtrace_enabling_destroy(enab);
+			dtrace_dof_destroy(dof);
+			return (-1);
+		}
+
+		nhelpers++;
+	}
+
+	if (nhelpers < enab->dten_ndesc)
+		dtrace_dof_error(dof, "unmatched helpers");
+
+	gen = help->dthps_generation++;
+	dtrace_enabling_destroy(enab);
+
+	if (dhp != NULL && nprovs > 0) {
+		dhp->dofhp_dof = (uint64_t)(uintptr_t)dof;
+		if (dtrace_helper_provider_add(dhp, gen) == 0) {
+			mutex_exit(&dtrace_lock);
+			dtrace_helper_provider_register(curproc, help, dhp);
+			mutex_enter(&dtrace_lock);
+
+			destroy = 0;
+		}
+	}
+
+	if (destroy)
+		dtrace_dof_destroy(dof);
+
+	return (gen);
+}
+
+static dtrace_helpers_t *
+dtrace_helpers_create(proc_t *p)
+{
+	dtrace_helpers_t *help;
+
+	ASSERT(MUTEX_HELD(&dtrace_lock));
+	ASSERT(p->p_dtrace_helpers == NULL);
+
+	help = kmem_zalloc(sizeof (dtrace_helpers_t), KM_SLEEP);
+	help->dthps_actions = kmem_zalloc(sizeof (dtrace_helper_action_t *) *
+	    DTRACE_NHELPER_ACTIONS, KM_SLEEP);
+
+	p->p_dtrace_helpers = help;
+	dtrace_helpers++;
+
+	return (help);
+}
+
+static void
+dtrace_helpers_destroy(void)
+{
+	dtrace_helpers_t *help;
+	dtrace_vstate_t *vstate;
+	proc_t *p = curproc;
+	VBDTTYPE(uint_t, int) i;
+
+	mutex_enter(&dtrace_lock);
+
+	ASSERT(p->p_dtrace_helpers != NULL);
+	ASSERT(dtrace_helpers > 0);
+
+	help = p->p_dtrace_helpers;
+	vstate = &help->dthps_vstate;
+
+	/*
+	 * We're now going to lose the help from this process.
+	 */
+	p->p_dtrace_helpers = NULL;
+	dtrace_sync();
+
+	/*
+	 * Destory the helper actions.
+	 */
+	for (i = 0; i < DTRACE_NHELPER_ACTIONS; i++) {
+		dtrace_helper_action_t *h, *next;
+
+		for (h = help->dthps_actions[i]; h != NULL; h = next) {
+			next = h->dtha_next;
+			dtrace_helper_action_destroy(h, vstate);
+			h = next;
+		}
+	}
+
+	mutex_exit(&dtrace_lock);
+
+	/*
+	 * Destroy the helper providers.
+	 */
+	if (help->dthps_maxprovs > 0) {
+		mutex_enter(&dtrace_meta_lock);
+		if (dtrace_meta_pid != NULL) {
+			ASSERT(dtrace_deferred_pid == NULL);
+
+			for (i = 0; i < help->dthps_nprovs; i++) {
+				dtrace_helper_provider_remove(
+				    &help->dthps_provs[i]->dthp_prov, p->p_pid);
+			}
+		} else {
+			mutex_enter(&dtrace_lock);
+			ASSERT(help->dthps_deferred == 0 ||
+			    help->dthps_next != NULL ||
+			    help->dthps_prev != NULL ||
+			    help == dtrace_deferred_pid);
+
+			/*
+			 * Remove the helper from the deferred list.
+			 */
+			if (help->dthps_next != NULL)
+				help->dthps_next->dthps_prev = help->dthps_prev;
+			if (help->dthps_prev != NULL)
+				help->dthps_prev->dthps_next = help->dthps_next;
+			if (dtrace_deferred_pid == help) {
+				dtrace_deferred_pid = help->dthps_next;
+				ASSERT(help->dthps_prev == NULL);
+			}
+
+			mutex_exit(&dtrace_lock);
+		}
+
+		mutex_exit(&dtrace_meta_lock);
+
+		for (i = 0; i < help->dthps_nprovs; i++) {
+			dtrace_helper_provider_destroy(help->dthps_provs[i]);
+		}
+
+		kmem_free(help->dthps_provs, help->dthps_maxprovs *
+		    sizeof (dtrace_helper_provider_t *));
+	}
+
+	mutex_enter(&dtrace_lock);
+
+	dtrace_vstate_fini(&help->dthps_vstate);
+	kmem_free(help->dthps_actions,
+	    sizeof (dtrace_helper_action_t *) * DTRACE_NHELPER_ACTIONS);
+	kmem_free(help, sizeof (dtrace_helpers_t));
+
+	--dtrace_helpers;
+	mutex_exit(&dtrace_lock);
+}
+
+static void
+dtrace_helpers_duplicate(proc_t *from, proc_t *to)
+{
+	dtrace_helpers_t *help, *newhelp;
+	dtrace_helper_action_t *helper, *new, *last;
+	dtrace_difo_t *dp;
+	dtrace_vstate_t *vstate;
+	int i, j, sz, hasprovs = 0;
+
+	mutex_enter(&dtrace_lock);
+	ASSERT(from->p_dtrace_helpers != NULL);
+	ASSERT(dtrace_helpers > 0);
+
+	help = from->p_dtrace_helpers;
+	newhelp = dtrace_helpers_create(to);
+	ASSERT(to->p_dtrace_helpers != NULL);
+
+	newhelp->dthps_generation = help->dthps_generation;
+	vstate = &newhelp->dthps_vstate;
+
+	/*
+	 * Duplicate the helper actions.
+	 */
+	for (i = 0; i < DTRACE_NHELPER_ACTIONS; i++) {
+		if ((helper = help->dthps_actions[i]) == NULL)
+			continue;
+
+		for (last = NULL; helper != NULL; helper = helper->dtha_next) {
+			new = kmem_zalloc(sizeof (dtrace_helper_action_t),
+			    KM_SLEEP);
+			new->dtha_generation = helper->dtha_generation;
+
+			if ((dp = helper->dtha_predicate) != NULL) {
+				dp = dtrace_difo_duplicate(dp, vstate);
+				new->dtha_predicate = dp;
+			}
+
+			new->dtha_nactions = helper->dtha_nactions;
+			sz = sizeof (dtrace_difo_t *) * new->dtha_nactions;
+			new->dtha_actions = kmem_alloc(sz, KM_SLEEP);
+
+			for (j = 0; j < new->dtha_nactions; j++) {
+				dtrace_difo_t *dp2 = helper->dtha_actions[j];
+
+				ASSERT(dp2 != NULL);
+				dp2 = dtrace_difo_duplicate(dp2, vstate);
+				new->dtha_actions[j] = dp2;
+			}
+
+			if (last != NULL) {
+				last->dtha_next = new;
+			} else {
+				newhelp->dthps_actions[i] = new;
+			}
+
+			last = new;
+		}
+	}
+
+	/*
+	 * Duplicate the helper providers and register them with the
+	 * DTrace framework.
+	 */
+	if (help->dthps_nprovs > 0) {
+		newhelp->dthps_nprovs = help->dthps_nprovs;
+		newhelp->dthps_maxprovs = help->dthps_nprovs;
+		newhelp->dthps_provs = kmem_alloc(newhelp->dthps_nprovs *
+		    sizeof (dtrace_helper_provider_t *), KM_SLEEP);
+		for (i = 0; i < VBDTCAST(int)newhelp->dthps_nprovs; i++) {
+			newhelp->dthps_provs[i] = help->dthps_provs[i];
+			newhelp->dthps_provs[i]->dthp_ref++;
+		}
+
+		hasprovs = 1;
+	}
+
+	mutex_exit(&dtrace_lock);
+
+	if (hasprovs)
+		dtrace_helper_provider_register(to, newhelp, NULL);
+}
+
+/*
+ * DTrace Hook Functions
+ */
+static void
+dtrace_module_loaded(struct modctl *ctl)
+{
+	dtrace_provider_t *prv;
+
+	mutex_enter(&dtrace_provider_lock);
+	mutex_enter(&mod_lock);
+
+	ASSERT(ctl->mod_busy);
+
+	/*
+	 * We're going to call each providers per-module provide operation
+	 * specifying only this module.
+	 */
+	for (prv = dtrace_provider; prv != NULL; prv = prv->dtpv_next)
+		prv->dtpv_pops.dtps_provide_module(prv->dtpv_arg, ctl);
+
+	mutex_exit(&mod_lock);
+	mutex_exit(&dtrace_provider_lock);
+
+	/*
+	 * If we have any retained enablings, we need to match against them.
+	 * Enabling probes requires that cpu_lock be held, and we cannot hold
+	 * cpu_lock here -- it is legal for cpu_lock to be held when loading a
+	 * module.  (In particular, this happens when loading scheduling
+	 * classes.)  So if we have any retained enablings, we need to dispatch
+	 * our task queue to do the match for us.
+	 */
+	mutex_enter(&dtrace_lock);
+
+	if (dtrace_retained == NULL) {
+		mutex_exit(&dtrace_lock);
+		return;
+	}
+
+	(void) taskq_dispatch(dtrace_taskq,
+	    (task_func_t *)dtrace_enabling_matchall, NULL, TQ_SLEEP);
+
+	mutex_exit(&dtrace_lock);
+
+	/*
+	 * And now, for a little heuristic sleaze:  in general, we want to
+	 * match modules as soon as they load.  However, we cannot guarantee
+	 * this, because it would lead us to the lock ordering violation
+	 * outlined above.  The common case, of course, is that cpu_lock is
+	 * _not_ held -- so we delay here for a clock tick, hoping that that's
+	 * long enough for the task queue to do its work.  If it's not, it's
+	 * not a serious problem -- it just means that the module that we
+	 * just loaded may not be immediately instrumentable.
+	 */
+	delay(1);
+}
+
+static void
+dtrace_module_unloaded(struct modctl *ctl)
+{
+	dtrace_probe_t template, *probe, *first, *next;
+	dtrace_provider_t *prov;
+
+	template.dtpr_mod = ctl->mod_modname;
+
+	mutex_enter(&dtrace_provider_lock);
+	mutex_enter(&mod_lock);
+	mutex_enter(&dtrace_lock);
+
+	if (dtrace_bymod == NULL) {
+		/*
+		 * The DTrace module is loaded (obviously) but not attached;
+		 * we don't have any work to do.
+		 */
+		mutex_exit(&dtrace_provider_lock);
+		mutex_exit(&mod_lock);
+		mutex_exit(&dtrace_lock);
+		return;
+	}
+
+	for (probe = first = dtrace_hash_lookup(dtrace_bymod, &template);
+	    probe != NULL; probe = probe->dtpr_nextmod) {
+		if (probe->dtpr_ecb != NULL) {
+			mutex_exit(&dtrace_provider_lock);
+			mutex_exit(&mod_lock);
+			mutex_exit(&dtrace_lock);
+
+			/*
+			 * This shouldn't _actually_ be possible -- we're
+			 * unloading a module that has an enabled probe in it.
+			 * (It's normally up to the provider to make sure that
+			 * this can't happen.)  However, because dtps_enable()
+			 * doesn't have a failure mode, there can be an
+			 * enable/unload race.  Upshot:  we don't want to
+			 * assert, but we're not going to disable the
+			 * probe, either.
+			 */
+			if (dtrace_err_verbose) {
+				cmn_err(CE_WARN, "unloaded module '%s' had "
+				    "enabled probes", ctl->mod_modname);
+			}
+
+			return;
+		}
+	}
+
+	probe = first;
+
+	for (first = NULL; probe != NULL; probe = next) {
+		ASSERT(dtrace_probes[probe->dtpr_id - 1] == probe);
+
+		dtrace_probes[probe->dtpr_id - 1] = NULL;
+
+		next = probe->dtpr_nextmod;
+		dtrace_hash_remove(dtrace_bymod, probe);
+		dtrace_hash_remove(dtrace_byfunc, probe);
+		dtrace_hash_remove(dtrace_byname, probe);
+
+		if (first == NULL) {
+			first = probe;
+			probe->dtpr_nextmod = NULL;
+		} else {
+			probe->dtpr_nextmod = first;
+			first = probe;
+		}
+	}
+
+	/*
+	 * We've removed all of the module's probes from the hash chains and
+	 * from the probe array.  Now issue a dtrace_sync() to be sure that
+	 * everyone has cleared out from any probe array processing.
+	 */
+	dtrace_sync();
+
+	for (probe = first; probe != NULL; probe = first) {
+		first = probe->dtpr_nextmod;
+		prov = probe->dtpr_provider;
+		prov->dtpv_pops.dtps_destroy(prov->dtpv_arg, probe->dtpr_id,
+		    probe->dtpr_arg);
+		kmem_free(probe->dtpr_mod, strlen(probe->dtpr_mod) + 1);
+		kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1);
+		kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1);
+		vmem_free(dtrace_arena, (void *)(uintptr_t)probe->dtpr_id, 1);
+		kmem_free(probe, sizeof (dtrace_probe_t));
+	}
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&mod_lock);
+	mutex_exit(&dtrace_provider_lock);
+}
+
+#endif /* !VBOX */
+
+VBDTSTATIC void
+dtrace_suspend(void)
+{
+	dtrace_probe_foreach(offsetof(dtrace_pops_t, dtps_suspend));
+}
+
+VBDTSTATIC void
+dtrace_resume(void)
+{
+	dtrace_probe_foreach(offsetof(dtrace_pops_t, dtps_resume));
+}
+
+#ifdef VBOX
+typedef enum {
+    CPU_INVALID,
+    CPU_CONFIG,
+    CPU_UNCONFIG
+} cpu_setup_t;
+#endif
+
+
+static int
+dtrace_cpu_setup(cpu_setup_t what, processorid_t cpu)
+{
+	ASSERT(MUTEX_HELD(&cpu_lock));
+	mutex_enter(&dtrace_lock);
+
+	switch (what) {
+	case CPU_CONFIG: {
+		dtrace_state_t *state;
+		dtrace_optval_t *opt, rs, c;
+
+		/*
+		 * For now, we only allocate a new buffer for anonymous state.
+		 */
+		if ((state = dtrace_anon.dta_state) == NULL)
+			break;
+
+		if (state->dts_activity != DTRACE_ACTIVITY_ACTIVE)
+			break;
+
+		opt = state->dts_options;
+		c = opt[DTRACEOPT_CPU];
+
+		if (c != DTRACE_CPUALL && c != DTRACEOPT_UNSET && c != cpu)
+			break;
+
+		/*
+		 * Regardless of what the actual policy is, we're going to
+		 * temporarily set our resize policy to be manual.  We're
+		 * also going to temporarily set our CPU option to denote
+		 * the newly configured CPU.
+		 */
+		rs = opt[DTRACEOPT_BUFRESIZE];
+		opt[DTRACEOPT_BUFRESIZE] = DTRACEOPT_BUFRESIZE_MANUAL;
+		opt[DTRACEOPT_CPU] = (dtrace_optval_t)cpu;
+
+		(void) dtrace_state_buffers(state);
+
+		opt[DTRACEOPT_BUFRESIZE] = rs;
+		opt[DTRACEOPT_CPU] = c;
+
+		break;
+	}
+
+	case CPU_UNCONFIG:
+		/*
+		 * We don't free the buffer in the CPU_UNCONFIG case.  (The
+		 * buffer will be freed when the consumer exits.)
+		 */
+		break;
+
+	default:
+		break;
+	}
+
+	mutex_exit(&dtrace_lock);
+	return (0);
+}
+
+#ifndef VBOX
+static void
+dtrace_cpu_setup_initial(processorid_t cpu)
+{
+	(void) dtrace_cpu_setup(CPU_CONFIG, cpu);
+}
+#endif /* !VBOX */
+
+static void
+dtrace_toxrange_add(uintptr_t base, uintptr_t limit)
+{
+	if (dtrace_toxranges >= dtrace_toxranges_max) {
+		int osize, nsize;
+		dtrace_toxrange_t *range;
+
+		osize = dtrace_toxranges_max * sizeof (dtrace_toxrange_t);
+
+		if (osize == 0) {
+			ASSERT(dtrace_toxrange == NULL);
+			ASSERT(dtrace_toxranges_max == 0);
+			dtrace_toxranges_max = 1;
+		} else {
+			dtrace_toxranges_max <<= 1;
+		}
+
+		nsize = dtrace_toxranges_max * sizeof (dtrace_toxrange_t);
+		range = kmem_zalloc(nsize, KM_SLEEP);
+
+		if (dtrace_toxrange != NULL) {
+			ASSERT(osize != 0);
+			bcopy(dtrace_toxrange, range, osize);
+			kmem_free(dtrace_toxrange, osize);
+		}
+
+		dtrace_toxrange = range;
+	}
+
+	ASSERT(dtrace_toxrange[dtrace_toxranges].dtt_base == NULL);
+	ASSERT(dtrace_toxrange[dtrace_toxranges].dtt_limit == NULL);
+
+	dtrace_toxrange[dtrace_toxranges].dtt_base = base;
+	dtrace_toxrange[dtrace_toxranges].dtt_limit = limit;
+	dtrace_toxranges++;
+}
+
+/*
+ * DTrace Driver Cookbook Functions
+ */
+#ifdef VBOX
+int dtrace_attach(void)
+#else
+/*ARGSUSED*/
+static int
+dtrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
+#endif
+{
+	dtrace_provider_id_t id;
+	dtrace_state_t *state = NULL;
+	dtrace_enabling_t *enab;
+
+#ifdef VBOX
+        if (   VBoxDtMutexInit(&dtrace_lock)
+            || VBoxDtMutexInit(&dtrace_provider_lock)
+            || VBoxDtMutexInit(&dtrace_meta_lock)
+# ifdef DEBUG
+            || VBoxDtMutexInit(&dtrace_errlock)
+# endif
+            )
+            return (DDI_FAILURE);
+#endif
+
+	mutex_enter(&cpu_lock);
+	mutex_enter(&dtrace_provider_lock);
+	mutex_enter(&dtrace_lock);
+
+#ifndef VBOX
+	if (ddi_soft_state_init(&dtrace_softstate,
+	    sizeof (dtrace_state_t), 0) != 0) {
+		cmn_err(CE_NOTE, "/dev/dtrace failed to initialize soft state");
+		mutex_exit(&cpu_lock);
+		mutex_exit(&dtrace_provider_lock);
+		mutex_exit(&dtrace_lock);
+		return (DDI_FAILURE);
+	}
+
+	if (ddi_create_minor_node(devi, DTRACEMNR_DTRACE, S_IFCHR,
+	    DTRACEMNRN_DTRACE, DDI_PSEUDO, NULL) == DDI_FAILURE ||
+	    ddi_create_minor_node(devi, DTRACEMNR_HELPER, S_IFCHR,
+	    DTRACEMNRN_HELPER, DDI_PSEUDO, NULL) == DDI_FAILURE) {
+		cmn_err(CE_NOTE, "/dev/dtrace couldn't create minor nodes");
+		ddi_remove_minor_node(devi, NULL);
+		ddi_soft_state_fini(&dtrace_softstate);
+		mutex_exit(&cpu_lock);
+		mutex_exit(&dtrace_provider_lock);
+		mutex_exit(&dtrace_lock);
+		return (DDI_FAILURE);
+	}
+
+	ddi_report_dev(devi);
+	dtrace_devi = devi;
+
+	dtrace_modload = dtrace_module_loaded;
+	dtrace_modunload = dtrace_module_unloaded;
+	dtrace_cpu_init = dtrace_cpu_setup_initial;
+	dtrace_helpers_cleanup = dtrace_helpers_destroy;
+	dtrace_helpers_fork = dtrace_helpers_duplicate;
+	dtrace_cpustart_init = dtrace_suspend;
+	dtrace_cpustart_fini = dtrace_resume;
+	dtrace_debugger_init = dtrace_suspend;
+	dtrace_debugger_fini = dtrace_resume;
+
+	register_cpu_setup_func((cpu_setup_func_t *)dtrace_cpu_setup, NULL);
+#else
+	/** @todo some of these hooks needs checking out! */
+#endif
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+#ifndef VBOX /* Reduce the area a bit just to be sure our vmem fake doesn't blow up. */
+	dtrace_arena = vmem_create("dtrace", (void *)1, UINT32_MAX, 1,
+	    NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
+#else
+        dtrace_arena = vmem_create("dtrace", (void *)1, UINT32_MAX - 16, 1,
+            NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER);
+#endif
+#ifndef VBOX
+	dtrace_minor = vmem_create("dtrace_minor", (void *)DTRACEMNRN_CLONE,
+	    UINT32_MAX - DTRACEMNRN_CLONE, 1, NULL, NULL, NULL, 0,
+	    VM_SLEEP | VMC_IDENTIFIER);
+	dtrace_taskq = taskq_create("dtrace_taskq", 1, maxclsyspri,
+	    1, INT_MAX, 0);
+#endif
+
+	dtrace_state_cache = kmem_cache_create("dtrace_state_cache",
+	    sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN,
+	    NULL, NULL, NULL, NULL, NULL, 0);
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+	dtrace_bymod = dtrace_hash_create(offsetof(dtrace_probe_t, dtpr_mod),
+	    offsetof(dtrace_probe_t, dtpr_nextmod),
+	    offsetof(dtrace_probe_t, dtpr_prevmod));
+
+	dtrace_byfunc = dtrace_hash_create(offsetof(dtrace_probe_t, dtpr_func),
+	    offsetof(dtrace_probe_t, dtpr_nextfunc),
+	    offsetof(dtrace_probe_t, dtpr_prevfunc));
+
+	dtrace_byname = dtrace_hash_create(offsetof(dtrace_probe_t, dtpr_name),
+	    offsetof(dtrace_probe_t, dtpr_nextname),
+	    offsetof(dtrace_probe_t, dtpr_prevname));
+
+	if (dtrace_retain_max < 1) {
+		cmn_err(CE_WARN, "illegal value (%lu) for dtrace_retain_max; "
+		    "setting to 1", dtrace_retain_max);
+		dtrace_retain_max = 1;
+	}
+
+	/*
+	 * Now discover our toxic ranges.
+	 */
+	dtrace_toxic_ranges(dtrace_toxrange_add);
+
+	/*
+	 * Before we register ourselves as a provider to our own framework,
+	 * we would like to assert that dtrace_provider is NULL -- but that's
+	 * not true if we were loaded as a dependency of a DTrace provider.
+	 * Once we've registered, we can assert that dtrace_provider is our
+	 * pseudo provider.
+	 */
+	(void) dtrace_register("dtrace", &dtrace_provider_attr,
+	    DTRACE_PRIV_NONE, 0, &dtrace_provider_ops, NULL, &id);
+
+	ASSERT(dtrace_provider != NULL);
+	ASSERT((dtrace_provider_id_t)dtrace_provider == id);
+
+	dtrace_probeid_begin = dtrace_probe_create((dtrace_provider_id_t)
+	    dtrace_provider, NULL, NULL, "BEGIN", 0, NULL);
+	dtrace_probeid_end = dtrace_probe_create((dtrace_provider_id_t)
+	    dtrace_provider, NULL, NULL, "END", 0, NULL);
+	dtrace_probeid_error = dtrace_probe_create((dtrace_provider_id_t)
+	    dtrace_provider, NULL, NULL, "ERROR", 1, NULL);
+
+#ifndef VBOX
+	dtrace_anon_property();
+#endif
+	mutex_exit(&cpu_lock);
+
+	/*
+	 * If DTrace helper tracing is enabled, we need to allocate the
+	 * trace buffer and initialize the values.
+	 */
+	if (dtrace_helptrace_enabled) {
+		ASSERT(dtrace_helptrace_buffer == NULL);
+		dtrace_helptrace_buffer =
+		    kmem_zalloc(dtrace_helptrace_bufsize, KM_SLEEP);
+		dtrace_helptrace_next = 0;
+	}
+
+	/*
+	 * If there are already providers, we must ask them to provide their
+	 * probes, and then match any anonymous enabling against them.  Note
+	 * that there should be no other retained enablings at this time:
+	 * the only retained enablings at this time should be the anonymous
+	 * enabling.
+	 */
+	if (dtrace_anon.dta_enabling != NULL) {
+		ASSERT(dtrace_retained == dtrace_anon.dta_enabling);
+
+		dtrace_enabling_provide(NULL);
+		state = dtrace_anon.dta_state;
+
+		/*
+		 * We couldn't hold cpu_lock across the above call to
+		 * dtrace_enabling_provide(), but we must hold it to actually
+		 * enable the probes.  We have to drop all of our locks, pick
+		 * up cpu_lock, and regain our locks before matching the
+		 * retained anonymous enabling.
+		 */
+		mutex_exit(&dtrace_lock);
+		mutex_exit(&dtrace_provider_lock);
+
+		mutex_enter(&cpu_lock);
+		mutex_enter(&dtrace_provider_lock);
+		mutex_enter(&dtrace_lock);
+
+		if ((enab = dtrace_anon.dta_enabling) != NULL)
+			(void) dtrace_enabling_match(enab, NULL);
+
+		mutex_exit(&cpu_lock);
+	}
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&dtrace_provider_lock);
+
+	if (state != NULL) {
+		/*
+		 * If we created any anonymous state, set it going now.
+		 */
+		(void) dtrace_state_go(state, &dtrace_anon.dta_beganon);
+	}
+
+	return (DDI_SUCCESS);
+}
+
+#ifdef VBOX
+int dtrace_open(dtrace_state_t **ppState, cred_t *cred_p)
+#else
+/*ARGSUSED*/
+static int
+dtrace_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
+#endif
+{
+	dtrace_state_t *state;
+	uint32_t priv;
+	uid_t uid;
+	zoneid_t zoneid;
+
+#ifndef VBOX
+	if (getminor(*devp) == DTRACEMNRN_HELPER)
+		return (0);
+
+	/*
+	 * If this wasn't an open with the "helper" minor, then it must be
+	 * the "dtrace" minor.
+	 */
+	if (getminor(*devp) != DTRACEMNRN_DTRACE)
+		return (ENXIO);
+#endif /* !VBOX */
+
+	/*
+	 * If no DTRACE_PRIV_* bits are set in the credential, then the
+	 * caller lacks sufficient permission to do anything with DTrace.
+	 */
+	dtrace_cred2priv(cred_p, &priv, &uid, &zoneid);
+	if (priv == DTRACE_PRIV_NONE)
+		return (EACCES);
+
+	/*
+	 * Ask all providers to provide all their probes.
+	 */
+	mutex_enter(&dtrace_provider_lock);
+	dtrace_probe_provide(NULL, NULL);
+	mutex_exit(&dtrace_provider_lock);
+
+	mutex_enter(&cpu_lock);
+	mutex_enter(&dtrace_lock);
+	dtrace_opens++;
+	dtrace_membar_producer();
+
+#ifndef VBOX
+	/*
+	 * If the kernel debugger is active (that is, if the kernel debugger
+	 * modified text in some way), we won't allow the open.
+	 */
+	if (kdi_dtrace_set(KDI_DTSET_DTRACE_ACTIVATE) != 0) {
+		dtrace_opens--;
+		mutex_exit(&cpu_lock);
+		mutex_exit(&dtrace_lock);
+		return (EBUSY);
+	}
+#endif
+
+#ifndef VBOX
+	state = dtrace_state_create(devp, cred_p);
+#else
+	state = dtrace_state_create(cred_p);
+#endif
+	mutex_exit(&cpu_lock);
+
+	if (state == NULL) {
+#ifndef VBOX
+		if (--dtrace_opens == 0 && dtrace_anon.dta_enabling == NULL)
+			(void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE);
+#else
+		dtrace_opens--;
+#endif
+		mutex_exit(&dtrace_lock);
+		return (EAGAIN);
+	}
+
+	mutex_exit(&dtrace_lock);
+
+#ifdef VBOX
+	*ppState = state;
+#endif
+	return (0);
+}
+
+#ifdef VBOX
+int dtrace_close(dtrace_state_t *state)
+#else
+/*ARGSUSED*/
+static int
+dtrace_close(dev_t dev, int flag, int otyp, cred_t *cred_p)
+#endif
+{
+#ifndef VBOX
+	minor_t minor = getminor(dev);
+	dtrace_state_t *state;
+
+	if (minor == DTRACEMNRN_HELPER)
+		return (0);
+
+	state = ddi_get_soft_state(dtrace_softstate, minor);
+#endif
+
+	mutex_enter(&cpu_lock);
+	mutex_enter(&dtrace_lock);
+
+	if (state->dts_anon) {
+		/*
+		 * There is anonymous state. Destroy that first.
+		 */
+		ASSERT(dtrace_anon.dta_state == NULL);
+		dtrace_state_destroy(state->dts_anon);
+	}
+
+	dtrace_state_destroy(state);
+	ASSERT(dtrace_opens > 0);
+
+#ifndef VBOX
+	/*
+	 * Only relinquish control of the kernel debugger interface when there
+	 * are no consumers and no anonymous enablings.
+	 */
+	if (--dtrace_opens == 0 && dtrace_anon.dta_enabling == NULL)
+		(void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE);
+#else
+	dtrace_opens--;
+#endif
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&cpu_lock);
+
+	return (0);
+}
+
+#ifndef VBOX
+/*ARGSUSED*/
+static int
+dtrace_ioctl_helper(int cmd, intptr_t arg, int *rv)
+{
+	int rval;
+	dof_helper_t help, *dhp = NULL;
+
+	switch (cmd) {
+	case DTRACEHIOC_ADDDOF:
+		if (copyin((void *)arg, &help, sizeof (help)) != 0) {
+			dtrace_dof_error(NULL, "failed to copyin DOF helper");
+			return (EFAULT);
+		}
+
+		dhp = &help;
+		arg = (intptr_t)help.dofhp_dof;
+		/*FALLTHROUGH*/
+
+	case DTRACEHIOC_ADD: {
+		dof_hdr_t *dof = dtrace_dof_copyin(arg, &rval);
+
+		if (dof == NULL)
+			return (rval);
+
+		mutex_enter(&dtrace_lock);
+
+		/*
+		 * dtrace_helper_slurp() takes responsibility for the dof --
+		 * it may free it now or it may save it and free it later.
+		 */
+		if ((rval = dtrace_helper_slurp(dof, dhp)) != -1) {
+			*rv = rval;
+			rval = 0;
+		} else {
+			rval = EINVAL;
+		}
+
+		mutex_exit(&dtrace_lock);
+		return (rval);
+	}
+
+	case DTRACEHIOC_REMOVE: {
+		mutex_enter(&dtrace_lock);
+		rval = dtrace_helper_destroygen(arg);
+		mutex_exit(&dtrace_lock);
+
+		return (rval);
+	}
+
+	default:
+		break;
+	}
+
+	return (ENOTTY);
+}
+#endif /* !VBOX */
+
+#ifdef VBOX
+int dtrace_ioctl(dtrace_state_t *state, int cmd, intptr_t arg, int32_t *rv)
+#else
+/*ARGSUSED*/
+static int
+dtrace_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv)
+#endif
+{
+#ifndef VBOX
+	minor_t minor = getminor(dev);
+	dtrace_state_t *state;
+#endif
+	int rval;
+
+#ifndef VBOX
+	if (minor == DTRACEMNRN_HELPER)
+		return (dtrace_ioctl_helper(cmd, arg, rv));
+
+	state = ddi_get_soft_state(dtrace_softstate, minor);
+#endif
+
+	if (state->dts_anon) {
+		ASSERT(dtrace_anon.dta_state == NULL);
+		state = state->dts_anon;
+	}
+
+	switch (cmd) {
+	case DTRACEIOC_PROVIDER: {
+		dtrace_providerdesc_t pvd;
+		dtrace_provider_t *pvp;
+
+		if (copyin((void *)arg, &pvd, sizeof (pvd)) != 0)
+			return (EFAULT);
+
+		pvd.dtvd_name[DTRACE_PROVNAMELEN - 1] = '\0';
+		mutex_enter(&dtrace_provider_lock);
+
+		for (pvp = dtrace_provider; pvp != NULL; pvp = pvp->dtpv_next) {
+			if (strcmp(pvp->dtpv_name, pvd.dtvd_name) == 0)
+				break;
+		}
+
+		mutex_exit(&dtrace_provider_lock);
+
+		if (pvp == NULL)
+			return (ESRCH);
+
+		bcopy(&pvp->dtpv_priv, &pvd.dtvd_priv, sizeof (dtrace_ppriv_t));
+		bcopy(&pvp->dtpv_attr, &pvd.dtvd_attr, sizeof (dtrace_pattr_t));
+		if (copyout(&pvd, (void *)arg, sizeof (pvd)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	case DTRACEIOC_EPROBE: {
+		dtrace_eprobedesc_t epdesc;
+		dtrace_ecb_t *ecb;
+		dtrace_action_t *act;
+		void *buf;
+		size_t size;
+		uintptr_t dest;
+		int nrecs;
+
+		if (copyin((void *)arg, &epdesc, sizeof (epdesc)) != 0)
+			return (EFAULT);
+
+		mutex_enter(&dtrace_lock);
+
+		if ((ecb = dtrace_epid2ecb(state, epdesc.dtepd_epid)) == NULL) {
+			mutex_exit(&dtrace_lock);
+			return (EINVAL);
+		}
+
+		if (ecb->dte_probe == NULL) {
+			mutex_exit(&dtrace_lock);
+			return (EINVAL);
+		}
+
+		epdesc.dtepd_probeid = ecb->dte_probe->dtpr_id;
+		epdesc.dtepd_uarg = ecb->dte_uarg;
+		epdesc.dtepd_size = VBDTCAST(uint32_t)ecb->dte_size;
+
+		nrecs = epdesc.dtepd_nrecs;
+		epdesc.dtepd_nrecs = 0;
+		for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
+			if (DTRACEACT_ISAGG(act->dta_kind) || act->dta_intuple)
+				continue;
+
+			epdesc.dtepd_nrecs++;
+		}
+
+		/*
+		 * Now that we have the size, we need to allocate a temporary
+		 * buffer in which to store the complete description.  We need
+		 * the temporary buffer to be able to drop dtrace_lock()
+		 * across the copyout(), below.
+		 */
+		size = sizeof (dtrace_eprobedesc_t) +
+		    (epdesc.dtepd_nrecs * sizeof (dtrace_recdesc_t));
+
+		buf = kmem_alloc(size, KM_SLEEP);
+		dest = (uintptr_t)buf;
+
+		bcopy(&epdesc, (void *)dest, sizeof (epdesc));
+		dest += offsetof(dtrace_eprobedesc_t, dtepd_rec[0]);
+
+		for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
+			if (DTRACEACT_ISAGG(act->dta_kind) || act->dta_intuple)
+				continue;
+
+			if (nrecs-- == 0)
+				break;
+
+			bcopy(&act->dta_rec, (void *)dest,
+			    sizeof (dtrace_recdesc_t));
+			dest += sizeof (dtrace_recdesc_t);
+		}
+
+		mutex_exit(&dtrace_lock);
+
+		if (copyout(buf, (void *)arg, dest - (uintptr_t)buf) != 0) {
+			kmem_free(buf, size);
+			return (EFAULT);
+		}
+
+		kmem_free(buf, size);
+		return (0);
+	}
+
+	case DTRACEIOC_AGGDESC: {
+		dtrace_aggdesc_t aggdesc;
+		dtrace_action_t *act;
+		dtrace_aggregation_t *agg;
+		int nrecs;
+		uint32_t offs;
+		dtrace_recdesc_t *lrec;
+		void *buf;
+		size_t size;
+		uintptr_t dest;
+
+		if (copyin((void *)arg, &aggdesc, sizeof (aggdesc)) != 0)
+			return (EFAULT);
+
+		mutex_enter(&dtrace_lock);
+
+		if ((agg = dtrace_aggid2agg(state, aggdesc.dtagd_id)) == NULL) {
+			mutex_exit(&dtrace_lock);
+			return (EINVAL);
+		}
+
+		aggdesc.dtagd_epid = agg->dtag_ecb->dte_epid;
+
+		nrecs = aggdesc.dtagd_nrecs;
+		aggdesc.dtagd_nrecs = 0;
+
+		offs = agg->dtag_base;
+		lrec = &agg->dtag_action.dta_rec;
+		aggdesc.dtagd_size = lrec->dtrd_offset + lrec->dtrd_size - offs;
+
+		for (act = agg->dtag_first; ; act = act->dta_next) {
+			ASSERT(act->dta_intuple ||
+			    DTRACEACT_ISAGG(act->dta_kind));
+
+			/*
+			 * If this action has a record size of zero, it
+			 * denotes an argument to the aggregating action.
+			 * Because the presence of this record doesn't (or
+			 * shouldn't) affect the way the data is interpreted,
+			 * we don't copy it out to save user-level the
+			 * confusion of dealing with a zero-length record.
+			 */
+			if (act->dta_rec.dtrd_size == 0) {
+				ASSERT(agg->dtag_hasarg);
+				continue;
+			}
+
+			aggdesc.dtagd_nrecs++;
+
+			if (act == &agg->dtag_action)
+				break;
+		}
+
+		/*
+		 * Now that we have the size, we need to allocate a temporary
+		 * buffer in which to store the complete description.  We need
+		 * the temporary buffer to be able to drop dtrace_lock()
+		 * across the copyout(), below.
+		 */
+		size = sizeof (dtrace_aggdesc_t) +
+		    (aggdesc.dtagd_nrecs * sizeof (dtrace_recdesc_t));
+
+		buf = kmem_alloc(size, KM_SLEEP);
+		dest = (uintptr_t)buf;
+
+		bcopy(&aggdesc, (void *)dest, sizeof (aggdesc));
+		dest += offsetof(dtrace_aggdesc_t, dtagd_rec[0]);
+
+		for (act = agg->dtag_first; ; act = act->dta_next) {
+			dtrace_recdesc_t rec = act->dta_rec;
+
+			/*
+			 * See the comment in the above loop for why we pass
+			 * over zero-length records.
+			 */
+			if (rec.dtrd_size == 0) {
+				ASSERT(agg->dtag_hasarg);
+				continue;
+			}
+
+			if (nrecs-- == 0)
+				break;
+
+			rec.dtrd_offset -= offs;
+			bcopy(&rec, (void *)dest, sizeof (rec));
+			dest += sizeof (dtrace_recdesc_t);
+
+			if (act == &agg->dtag_action)
+				break;
+		}
+
+		mutex_exit(&dtrace_lock);
+
+		if (copyout(buf, (void *)arg, dest - (uintptr_t)buf) != 0) {
+			kmem_free(buf, size);
+			return (EFAULT);
+		}
+
+		kmem_free(buf, size);
+		return (0);
+	}
+
+	case DTRACEIOC_ENABLE: {
+		dof_hdr_t *dof;
+		dtrace_enabling_t *enab = NULL;
+		dtrace_vstate_t *vstate;
+		int err = 0;
+#ifdef VBOX
+		cred_t *cr = CRED();
+#endif
+
+		*rv = 0;
+
+		/*
+		 * If a NULL argument has been passed, we take this as our
+		 * cue to reevaluate our enablings.
+		 */
+		if (arg == NULL) {
+			dtrace_enabling_matchall();
+
+			return (0);
+		}
+
+		if ((dof = dtrace_dof_copyin(arg, &rval)) == NULL)
+			return (rval);
+
+		mutex_enter(&cpu_lock);
+		mutex_enter(&dtrace_lock);
+		vstate = &state->dts_vstate;
+
+		if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE) {
+			mutex_exit(&dtrace_lock);
+			mutex_exit(&cpu_lock);
+			dtrace_dof_destroy(dof);
+			return (EBUSY);
+		}
+
+		if (dtrace_dof_slurp(dof, vstate, cr, &enab, 0, B_TRUE) != 0) {
+			mutex_exit(&dtrace_lock);
+			mutex_exit(&cpu_lock);
+			dtrace_dof_destroy(dof);
+			return (EINVAL);
+		}
+
+		if ((rval = dtrace_dof_options(dof, state)) != 0) {
+			dtrace_enabling_destroy(enab);
+			mutex_exit(&dtrace_lock);
+			mutex_exit(&cpu_lock);
+			dtrace_dof_destroy(dof);
+			return (rval);
+		}
+
+		if ((err = dtrace_enabling_match(enab, rv)) == 0) {
+			err = dtrace_enabling_retain(enab);
+		} else {
+			dtrace_enabling_destroy(enab);
+		}
+
+		mutex_exit(&cpu_lock);
+		mutex_exit(&dtrace_lock);
+		dtrace_dof_destroy(dof);
+
+		return (err);
+	}
+
+	case DTRACEIOC_REPLICATE: {
+		dtrace_repldesc_t desc;
+		dtrace_probedesc_t *match = &desc.dtrpd_match;
+		dtrace_probedesc_t *create = &desc.dtrpd_create;
+		int err;
+
+		if (copyin((void *)arg, &desc, sizeof (desc)) != 0)
+			return (EFAULT);
+
+		match->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
+		match->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
+		match->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
+		match->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
+
+		create->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
+		create->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
+		create->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
+		create->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
+
+		mutex_enter(&dtrace_lock);
+		err = dtrace_enabling_replicate(state, match, create);
+		mutex_exit(&dtrace_lock);
+
+		return (err);
+	}
+
+	case DTRACEIOC_PROBEMATCH:
+	case DTRACEIOC_PROBES: {
+		dtrace_probe_t *probe = NULL;
+		dtrace_probedesc_t desc;
+		dtrace_probekey_t pkey;
+		dtrace_id_t i;
+		int m = 0;
+		uint32_t priv;
+		uid_t uid;
+		zoneid_t zoneid;
+#ifdef VBOX
+		cred_t *cr = CRED();
+#endif
+
+		if (copyin((void *)arg, &desc, sizeof (desc)) != 0)
+			return (EFAULT);
+
+		desc.dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
+		desc.dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
+		desc.dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
+		desc.dtpd_name[DTRACE_NAMELEN - 1] = '\0';
+
+		/*
+		 * Before we attempt to match this probe, we want to give
+		 * all providers the opportunity to provide it.
+		 */
+		if (desc.dtpd_id == DTRACE_IDNONE) {
+			mutex_enter(&dtrace_provider_lock);
+			dtrace_probe_provide(&desc, NULL);
+			mutex_exit(&dtrace_provider_lock);
+			desc.dtpd_id++;
+		}
+
+		if (cmd == DTRACEIOC_PROBEMATCH)  {
+			dtrace_probekey(&desc, &pkey);
+			pkey.dtpk_id = DTRACE_IDNONE;
+		}
+
+		dtrace_cred2priv(cr, &priv, &uid, &zoneid);
+
+		mutex_enter(&dtrace_lock);
+
+		if (cmd == DTRACEIOC_PROBEMATCH) {
+			for (i = desc.dtpd_id; i <= dtrace_nprobes; i++) {
+				if ((probe = dtrace_probes[i - 1]) != NULL &&
+				    (m = dtrace_match_probe(probe, &pkey,
+				    priv, uid, zoneid)) != 0)
+					break;
+			}
+
+			if (m < 0) {
+				mutex_exit(&dtrace_lock);
+				return (EINVAL);
+			}
+
+		} else {
+			for (i = desc.dtpd_id; i <= dtrace_nprobes; i++) {
+				if ((probe = dtrace_probes[i - 1]) != NULL &&
+				    dtrace_match_priv(probe, priv, uid, zoneid))
+					break;
+			}
+		}
+
+		if (probe == NULL) {
+			mutex_exit(&dtrace_lock);
+			return (ESRCH);
+		}
+
+		dtrace_probe_description(probe, &desc);
+		mutex_exit(&dtrace_lock);
+
+		if (copyout(&desc, (void *)arg, sizeof (desc)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	case DTRACEIOC_PROBEARG: {
+		dtrace_argdesc_t desc;
+		dtrace_probe_t *probe;
+		dtrace_provider_t *prov;
+
+		if (copyin((void *)arg, &desc, sizeof (desc)) != 0)
+			return (EFAULT);
+
+		if (desc.dtargd_id == DTRACE_IDNONE)
+			return (EINVAL);
+
+		if (desc.dtargd_ndx == DTRACE_ARGNONE)
+			return (EINVAL);
+
+		mutex_enter(&dtrace_provider_lock);
+		mutex_enter(&mod_lock);
+		mutex_enter(&dtrace_lock);
+
+		if (desc.dtargd_id > dtrace_nprobes) {
+			mutex_exit(&dtrace_lock);
+			mutex_exit(&mod_lock);
+			mutex_exit(&dtrace_provider_lock);
+			return (EINVAL);
+		}
+
+		if ((probe = dtrace_probes[desc.dtargd_id - 1]) == NULL) {
+			mutex_exit(&dtrace_lock);
+			mutex_exit(&mod_lock);
+			mutex_exit(&dtrace_provider_lock);
+			return (EINVAL);
+		}
+
+		mutex_exit(&dtrace_lock);
+
+		prov = probe->dtpr_provider;
+
+		if (prov->dtpv_pops.dtps_getargdesc == NULL) {
+			/*
+			 * There isn't any typed information for this probe.
+			 * Set the argument number to DTRACE_ARGNONE.
+			 */
+			desc.dtargd_ndx = DTRACE_ARGNONE;
+		} else {
+			desc.dtargd_native[0] = '\0';
+			desc.dtargd_xlate[0] = '\0';
+			desc.dtargd_mapping = desc.dtargd_ndx;
+
+			prov->dtpv_pops.dtps_getargdesc(prov->dtpv_arg,
+			    probe->dtpr_id, probe->dtpr_arg, &desc);
+		}
+
+		mutex_exit(&mod_lock);
+		mutex_exit(&dtrace_provider_lock);
+
+		if (copyout(&desc, (void *)arg, sizeof (desc)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	case DTRACEIOC_GO: {
+		processorid_t cpuid;
+		rval = dtrace_state_go(state, &cpuid);
+
+		if (rval != 0)
+			return (rval);
+
+		if (copyout(&cpuid, (void *)arg, sizeof (cpuid)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	case DTRACEIOC_STOP: {
+		processorid_t cpuid;
+
+		mutex_enter(&dtrace_lock);
+		rval = dtrace_state_stop(state, &cpuid);
+		mutex_exit(&dtrace_lock);
+
+		if (rval != 0)
+			return (rval);
+
+		if (copyout(&cpuid, (void *)arg, sizeof (cpuid)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	case DTRACEIOC_DOFGET: {
+		dof_hdr_t hdr, *dof;
+		uint64_t len;
+
+		if (copyin((void *)arg, &hdr, sizeof (hdr)) != 0)
+			return (EFAULT);
+
+		mutex_enter(&dtrace_lock);
+		dof = dtrace_dof_create(state);
+		mutex_exit(&dtrace_lock);
+
+		len = MIN(hdr.dofh_loadsz, dof->dofh_loadsz);
+		rval = copyout(dof, (void *)arg, len);
+		dtrace_dof_destroy(dof);
+
+		return (rval == 0 ? 0 : EFAULT);
+	}
+
+	case DTRACEIOC_AGGSNAP:
+	case DTRACEIOC_BUFSNAP: {
+		dtrace_bufdesc_t desc;
+		caddr_t cached;
+		dtrace_buffer_t *buf;
+
+		if (copyin((void *)arg, &desc, sizeof (desc)) != 0)
+			return (EFAULT);
+
+		if (/*VBox value is is unsigned: desc.dtbd_cpu < 0 ||*/ desc.dtbd_cpu >= NCPU)
+			return (EINVAL);
+
+		mutex_enter(&dtrace_lock);
+
+		if (cmd == DTRACEIOC_BUFSNAP) {
+			buf = &state->dts_buffer[desc.dtbd_cpu];
+		} else {
+			buf = &state->dts_aggbuffer[desc.dtbd_cpu];
+		}
+
+		if (buf->dtb_flags & (DTRACEBUF_RING | DTRACEBUF_FILL)) {
+			size_t sz = buf->dtb_offset;
+
+			if (state->dts_activity != DTRACE_ACTIVITY_STOPPED) {
+				mutex_exit(&dtrace_lock);
+				return (EBUSY);
+			}
+
+			/*
+			 * If this buffer has already been consumed, we're
+			 * going to indicate that there's nothing left here
+			 * to consume.
+			 */
+			if (buf->dtb_flags & DTRACEBUF_CONSUMED) {
+				mutex_exit(&dtrace_lock);
+
+				desc.dtbd_size = 0;
+				desc.dtbd_drops = 0;
+				desc.dtbd_errors = 0;
+				desc.dtbd_oldest = 0;
+				sz = sizeof (desc);
+
+				if (copyout(&desc, (void *)arg, sz) != 0)
+					return (EFAULT);
+
+				return (0);
+			}
+
+			/*
+			 * If this is a ring buffer that has wrapped, we want
+			 * to copy the whole thing out.
+			 */
+			if (buf->dtb_flags & DTRACEBUF_WRAPPED) {
+				dtrace_buffer_polish(buf);
+				sz = buf->dtb_size;
+			}
+
+			if (copyout(buf->dtb_tomax, desc.dtbd_data, sz) != 0) {
+				mutex_exit(&dtrace_lock);
+				return (EFAULT);
+			}
+
+			desc.dtbd_size = sz;
+			desc.dtbd_drops = buf->dtb_drops;
+			desc.dtbd_errors = buf->dtb_errors;
+			desc.dtbd_oldest = buf->dtb_xamot_offset;
+
+			mutex_exit(&dtrace_lock);
+
+			if (copyout(&desc, (void *)arg, sizeof (desc)) != 0)
+				return (EFAULT);
+
+			buf->dtb_flags |= DTRACEBUF_CONSUMED;
+
+			return (0);
+		}
+
+		if (buf->dtb_tomax == NULL) {
+			ASSERT(buf->dtb_xamot == NULL);
+			mutex_exit(&dtrace_lock);
+			return (ENOENT);
+		}
+
+		cached = buf->dtb_tomax;
+		ASSERT(!(buf->dtb_flags & DTRACEBUF_NOSWITCH));
+
+#ifndef VBOX
+		dtrace_xcall(desc.dtbd_cpu,
+		    (dtrace_xcall_t)dtrace_buffer_switch, buf);
+#else
+		if ((int32_t)desc.dtbd_cpu == DTRACE_CPUALL)
+		    RTMpOnAll(dtrace_buffer_switch_wrapper, buf, NULL);
+		else
+		    RTMpOnSpecific(desc.dtbd_cpu, dtrace_buffer_switch_wrapper, buf, NULL);
+#endif
+
+		state->dts_errors += buf->dtb_xamot_errors;
+
+		/*
+		 * If the buffers did not actually switch, then the cross call
+		 * did not take place -- presumably because the given CPU is
+		 * not in the ready set.  If this is the case, we'll return
+		 * ENOENT.
+		 */
+		if (buf->dtb_tomax == cached) {
+			ASSERT(buf->dtb_xamot != cached);
+			mutex_exit(&dtrace_lock);
+			return (ENOENT);
+		}
+
+		ASSERT(cached == buf->dtb_xamot);
+
+		/*
+		 * We have our snapshot; now copy it out.
+		 */
+		if (copyout(buf->dtb_xamot, desc.dtbd_data,
+		    buf->dtb_xamot_offset) != 0) {
+			mutex_exit(&dtrace_lock);
+			return (EFAULT);
+		}
+
+		desc.dtbd_size = buf->dtb_xamot_offset;
+		desc.dtbd_drops = buf->dtb_xamot_drops;
+		desc.dtbd_errors = buf->dtb_xamot_errors;
+		desc.dtbd_oldest = 0;
+
+		mutex_exit(&dtrace_lock);
+
+		/*
+		 * Finally, copy out the buffer description.
+		 */
+		if (copyout(&desc, (void *)arg, sizeof (desc)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	case DTRACEIOC_CONF: {
+		dtrace_conf_t conf;
+
+		bzero(&conf, sizeof (conf));
+		conf.dtc_difversion = DIF_VERSION;
+		conf.dtc_difintregs = DIF_DIR_NREGS;
+		conf.dtc_diftupregs = DIF_DTR_NREGS;
+		conf.dtc_ctfmodel = CTF_MODEL_NATIVE;
+
+		if (copyout(&conf, (void *)arg, sizeof (conf)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	case DTRACEIOC_STATUS: {
+		dtrace_status_t stat;
+		dtrace_dstate_t *dstate;
+		int i, j;
+		uint64_t nerrs;
+
+		/*
+		 * See the comment in dtrace_state_deadman() for the reason
+		 * for setting dts_laststatus to INT64_MAX before setting
+		 * it to the correct value.
+		 */
+		state->dts_laststatus = INT64_MAX;
+		dtrace_membar_producer();
+		state->dts_laststatus = dtrace_gethrtime();
+
+		bzero(&stat, sizeof (stat));
+
+		mutex_enter(&dtrace_lock);
+
+		if (state->dts_activity == DTRACE_ACTIVITY_INACTIVE) {
+			mutex_exit(&dtrace_lock);
+			return (ENOENT);
+		}
+
+		if (state->dts_activity == DTRACE_ACTIVITY_DRAINING)
+			stat.dtst_exiting = 1;
+
+		nerrs = state->dts_errors;
+		dstate = &state->dts_vstate.dtvs_dynvars;
+
+		for (i = 0; i < NCPU; i++) {
+			dtrace_dstate_percpu_t *dcpu = &dstate->dtds_percpu[i];
+
+			stat.dtst_dyndrops += dcpu->dtdsc_drops;
+			stat.dtst_dyndrops_dirty += dcpu->dtdsc_dirty_drops;
+			stat.dtst_dyndrops_rinsing += dcpu->dtdsc_rinsing_drops;
+
+			if (state->dts_buffer[i].dtb_flags & DTRACEBUF_FULL)
+				stat.dtst_filled++;
+
+			nerrs += state->dts_buffer[i].dtb_errors;
+
+			for (j = 0; j < state->dts_nspeculations; j++) {
+				dtrace_speculation_t *spec;
+				dtrace_buffer_t *buf;
+
+				spec = &state->dts_speculations[j];
+				buf = &spec->dtsp_buffer[i];
+				stat.dtst_specdrops += buf->dtb_xamot_drops;
+			}
+		}
+
+		stat.dtst_specdrops_busy = state->dts_speculations_busy;
+		stat.dtst_specdrops_unavail = state->dts_speculations_unavail;
+		stat.dtst_stkstroverflows = state->dts_stkstroverflows;
+		stat.dtst_dblerrors = state->dts_dblerrors;
+		stat.dtst_killed =
+		    (state->dts_activity == DTRACE_ACTIVITY_KILLED);
+		stat.dtst_errors = nerrs;
+
+		mutex_exit(&dtrace_lock);
+
+		if (copyout(&stat, (void *)arg, sizeof (stat)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	case DTRACEIOC_FORMAT: {
+		dtrace_fmtdesc_t fmt;
+		char *str;
+		int len;
+
+		if (copyin((void *)arg, &fmt, sizeof (fmt)) != 0)
+			return (EFAULT);
+
+		mutex_enter(&dtrace_lock);
+
+		if (fmt.dtfd_format == 0 ||
+		    fmt.dtfd_format > state->dts_nformats) {
+			mutex_exit(&dtrace_lock);
+			return (EINVAL);
+		}
+
+		/*
+		 * Format strings are allocated contiguously and they are
+		 * never freed; if a format index is less than the number
+		 * of formats, we can assert that the format map is non-NULL
+		 * and that the format for the specified index is non-NULL.
+		 */
+		ASSERT(state->dts_formats != NULL);
+		str = state->dts_formats[fmt.dtfd_format - 1];
+		ASSERT(str != NULL);
+
+		len = VBDTCAST(int)strlen(str) + 1;
+
+		if (len > fmt.dtfd_length) {
+			fmt.dtfd_length = len;
+
+			if (copyout(&fmt, (void *)arg, sizeof (fmt)) != 0) {
+				mutex_exit(&dtrace_lock);
+				return (EINVAL);
+			}
+		} else {
+			if (copyout(str, fmt.dtfd_string, len) != 0) {
+				mutex_exit(&dtrace_lock);
+				return (EINVAL);
+			}
+		}
+
+		mutex_exit(&dtrace_lock);
+		return (0);
+	}
+
+	default:
+		break;
+	}
+
+	return (ENOTTY);
+}
+
+#ifdef VBOX
+int dtrace_detach(void)
+#else
+/*ARGSUSED*/
+static int
+dtrace_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
+#endif
+{
+	dtrace_state_t *state;
+
+#ifndef VBOX
+	switch (cmd) {
+	case DDI_DETACH:
+		break;
+
+	case DDI_SUSPEND:
+		return (DDI_SUCCESS);
+
+	default:
+		return (DDI_FAILURE);
+	}
+#endif
+
+	mutex_enter(&cpu_lock);
+	mutex_enter(&dtrace_provider_lock);
+	mutex_enter(&dtrace_lock);
+
+	ASSERT(dtrace_opens == 0);
+
+	if (dtrace_helpers > 0) {
+		mutex_exit(&dtrace_provider_lock);
+		mutex_exit(&dtrace_lock);
+		mutex_exit(&cpu_lock);
+		return (DDI_FAILURE);
+	}
+
+	if (dtrace_unregister((dtrace_provider_id_t)dtrace_provider) != 0) {
+		mutex_exit(&dtrace_provider_lock);
+		mutex_exit(&dtrace_lock);
+		mutex_exit(&cpu_lock);
+		return (DDI_FAILURE);
+	}
+
+	dtrace_provider = NULL;
+
+	if ((state = dtrace_anon_grab()) != NULL) {
+		/*
+		 * If there were ECBs on this state, the provider should
+		 * have not been allowed to detach; assert that there is
+		 * none.
+		 */
+		ASSERT(state->dts_necbs == 0);
+		dtrace_state_destroy(state);
+
+#ifndef VBOX
+		/*
+		 * If we're being detached with anonymous state, we need to
+		 * indicate to the kernel debugger that DTrace is now inactive.
+		 */
+		(void) kdi_dtrace_set(KDI_DTSET_DTRACE_DEACTIVATE);
+#endif
+	}
+
+	bzero(&dtrace_anon, sizeof (dtrace_anon_t));
+#ifndef VBOX /** @todo CPU hooks */
+	unregister_cpu_setup_func((cpu_setup_func_t *)dtrace_cpu_setup, NULL);
+	dtrace_cpu_init = NULL;
+	dtrace_helpers_cleanup = NULL;
+	dtrace_helpers_fork = NULL;
+	dtrace_cpustart_init = NULL;
+	dtrace_cpustart_fini = NULL;
+	dtrace_debugger_init = NULL;
+	dtrace_debugger_fini = NULL;
+	dtrace_modload = NULL;
+	dtrace_modunload = NULL;
+#endif
+
+	mutex_exit(&cpu_lock);
+
+	if (dtrace_helptrace_enabled) {
+		kmem_free(dtrace_helptrace_buffer, dtrace_helptrace_bufsize);
+		dtrace_helptrace_buffer = NULL;
+	}
+
+	kmem_free(dtrace_probes, dtrace_nprobes * sizeof (dtrace_probe_t *));
+	dtrace_probes = NULL;
+	dtrace_nprobes = 0;
+
+	dtrace_hash_destroy(dtrace_bymod);
+	dtrace_hash_destroy(dtrace_byfunc);
+	dtrace_hash_destroy(dtrace_byname);
+	dtrace_bymod = NULL;
+	dtrace_byfunc = NULL;
+	dtrace_byname = NULL;
+
+	kmem_cache_destroy(dtrace_state_cache);
+#ifndef VBOX
+	vmem_destroy(dtrace_minor);
+#endif
+	vmem_destroy(dtrace_arena);
+
+	if (dtrace_toxrange != NULL) {
+		kmem_free(dtrace_toxrange,
+		    dtrace_toxranges_max * sizeof (dtrace_toxrange_t));
+		dtrace_toxrange = NULL;
+		dtrace_toxranges = 0;
+		dtrace_toxranges_max = 0;
+	}
+
+#ifndef VBOX
+	ddi_remove_minor_node(dtrace_devi, NULL);
+	dtrace_devi = NULL;
+
+	ddi_soft_state_fini(&dtrace_softstate);
+#endif
+
+	ASSERT(dtrace_vtime_references == 0);
+	ASSERT(dtrace_opens == 0);
+	ASSERT(dtrace_retained == NULL);
+
+	mutex_exit(&dtrace_lock);
+	mutex_exit(&dtrace_provider_lock);
+#ifdef VBOX
+    VBoxDtMutexDelete(&dtrace_lock);
+    VBoxDtMutexDelete(&dtrace_provider_lock);
+    VBoxDtMutexDelete(&dtrace_meta_lock);
+# ifdef DEBUG
+    VBoxDtMutexDelete(&dtrace_errlock);
+# endif
+#endif
+
+	/*
+	 * We don't destroy the task queue until after we have dropped our
+	 * locks (taskq_destroy() may block on running tasks).  To prevent
+	 * attempting to do work after we have effectively detached but before
+	 * the task queue has been destroyed, all tasks dispatched via the
+	 * task queue must check that DTrace is still attached before
+	 * performing any operation.
+	 */
+#ifndef VBOX
+	taskq_destroy(dtrace_taskq);
+	dtrace_taskq = NULL;
+#endif
+
+	return (DDI_SUCCESS);
+}
+
+#ifndef VBOX
+/*ARGSUSED*/
+static int
+dtrace_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+	int error;
+
+	switch (infocmd) {
+	case DDI_INFO_DEVT2DEVINFO:
+		*result = (void *)dtrace_devi;
+		error = DDI_SUCCESS;
+		break;
+	case DDI_INFO_DEVT2INSTANCE:
+		*result = (void *)0;
+		error = DDI_SUCCESS;
+		break;
+	default:
+		error = DDI_FAILURE;
+	}
+	return (error);
+}
+
+static struct cb_ops dtrace_cb_ops = {
+	dtrace_open,		/* open */
+	dtrace_close,		/* close */
+	nulldev,		/* strategy */
+	nulldev,		/* print */
+	nodev,			/* dump */
+	nodev,			/* read */
+	nodev,			/* write */
+	dtrace_ioctl,		/* ioctl */
+	nodev,			/* devmap */
+	nodev,			/* mmap */
+	nodev,			/* segmap */
+	nochpoll,		/* poll */
+	ddi_prop_op,		/* cb_prop_op */
+	0,			/* streamtab  */
+	D_NEW | D_MP		/* Driver compatibility flag */
+};
+
+static struct dev_ops dtrace_ops = {
+	DEVO_REV,		/* devo_rev */
+	0,			/* refcnt */
+	dtrace_info,		/* get_dev_info */
+	nulldev,		/* identify */
+	nulldev,		/* probe */
+	dtrace_attach,		/* attach */
+	dtrace_detach,		/* detach */
+	nodev,			/* reset */
+	&dtrace_cb_ops,		/* driver operations */
+	NULL,			/* bus operations */
+	nodev,			/* dev power */
+	ddi_quiesce_not_needed,		/* quiesce */
+};
+
+static struct modldrv modldrv = {
+	&mod_driverops,		/* module type (this is a pseudo driver) */
+	"Dynamic Tracing",	/* name of module */
+	&dtrace_ops,		/* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+	MODREV_1,
+	(void *)&modldrv,
+	NULL
+};
+
+int
+_init(void)
+{
+	return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+	return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+	return (mod_remove(&modlinkage));
+}
+
+#endif /* !VBOX */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.conf b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.conf
new file mode 100644
index 0000000..6c4ec26
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.conf
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+name="dtrace" parent="pseudo" instance=0;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/fasttrap.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/fasttrap.c
new file mode 100644
index 0000000..42263e4
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/fasttrap.c
@@ -0,0 +1,2378 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#include <sys/atomic.h>
+#include <sys/errno.h>
+#include <sys/stat.h>
+#include <sys/modctl.h>
+#include <sys/conf.h>
+#include <sys/systm.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/cpuvar.h>
+#include <sys/kmem.h>
+#include <sys/strsubr.h>
+#include <sys/fasttrap.h>
+#include <sys/fasttrap_impl.h>
+#include <sys/fasttrap_isa.h>
+#include <sys/dtrace.h>
+#include <sys/dtrace_impl.h>
+#include <sys/sysmacros.h>
+#include <sys/proc.h>
+#include <sys/priv.h>
+#include <sys/policy.h>
+#include <util/qsort.h>
+
+/*
+ * User-Land Trap-Based Tracing
+ * ----------------------------
+ *
+ * The fasttrap provider allows DTrace consumers to instrument any user-level
+ * instruction to gather data; this includes probes with semantic
+ * signifigance like entry and return as well as simple offsets into the
+ * function. While the specific techniques used are very ISA specific, the
+ * methodology is generalizable to any architecture.
+ *
+ *
+ * The General Methodology
+ * -----------------------
+ *
+ * With the primary goal of tracing every user-land instruction and the
+ * limitation that we can't trust user space so don't want to rely on much
+ * information there, we begin by replacing the instructions we want to trace
+ * with trap instructions. Each instruction we overwrite is saved into a hash
+ * table keyed by process ID and pc address. When we enter the kernel due to
+ * this trap instruction, we need the effects of the replaced instruction to
+ * appear to have occurred before we proceed with the user thread's
+ * execution.
+ *
+ * Each user level thread is represented by a ulwp_t structure which is
+ * always easily accessible through a register. The most basic way to produce
+ * the effects of the instruction we replaced is to copy that instruction out
+ * to a bit of scratch space reserved in the user thread's ulwp_t structure
+ * (a sort of kernel-private thread local storage), set the PC to that
+ * scratch space and single step. When we reenter the kernel after single
+ * stepping the instruction we must then adjust the PC to point to what would
+ * normally be the next instruction. Of course, special care must be taken
+ * for branches and jumps, but these represent such a small fraction of any
+ * instruction set that writing the code to emulate these in the kernel is
+ * not too difficult.
+ *
+ * Return probes may require several tracepoints to trace every return site,
+ * and, conversely, each tracepoint may activate several probes (the entry
+ * and offset 0 probes, for example). To solve this muliplexing problem,
+ * tracepoints contain lists of probes to activate and probes contain lists
+ * of tracepoints to enable. If a probe is activated, it adds its ID to
+ * existing tracepoints or creates new ones as necessary.
+ *
+ * Most probes are activated _before_ the instruction is executed, but return
+ * probes are activated _after_ the effects of the last instruction of the
+ * function are visible. Return probes must be fired _after_ we have
+ * single-stepped the instruction whereas all other probes are fired
+ * beforehand.
+ *
+ *
+ * Lock Ordering
+ * -------------
+ *
+ * The lock ordering below -- both internally and with respect to the DTrace
+ * framework -- is a little tricky and bears some explanation. Each provider
+ * has a lock (ftp_mtx) that protects its members including reference counts
+ * for enabled probes (ftp_rcount), consumers actively creating probes
+ * (ftp_ccount) and USDT consumers (ftp_mcount); all three prevent a provider
+ * from being freed. A provider is looked up by taking the bucket lock for the
+ * provider hash table, and is returned with its lock held. The provider lock
+ * may be taken in functions invoked by the DTrace framework, but may not be
+ * held while calling functions in the DTrace framework.
+ *
+ * To ensure consistency over multiple calls to the DTrace framework, the
+ * creation lock (ftp_cmtx) should be held. Naturally, the creation lock may
+ * not be taken when holding the provider lock as that would create a cyclic
+ * lock ordering. In situations where one would naturally take the provider
+ * lock and then the creation lock, we instead up a reference count to prevent
+ * the provider from disappearing, drop the provider lock, and acquire the
+ * creation lock.
+ *
+ * Briefly:
+ * 	bucket lock before provider lock
+ *	DTrace before provider lock
+ *	creation lock before DTrace
+ *	never hold the provider lock and creation lock simultaneously
+ */
+
+static dev_info_t *fasttrap_devi;
+static dtrace_meta_provider_id_t fasttrap_meta_id;
+
+static timeout_id_t fasttrap_timeout;
+static kmutex_t fasttrap_cleanup_mtx;
+static uint_t fasttrap_cleanup_work;
+
+/*
+ * Generation count on modifications to the global tracepoint lookup table.
+ */
+static volatile uint64_t fasttrap_mod_gen;
+
+/*
+ * When the fasttrap provider is loaded, fasttrap_max is set to either
+ * FASTTRAP_MAX_DEFAULT or the value for fasttrap-max-probes in the
+ * fasttrap.conf file. Each time a probe is created, fasttrap_total is
+ * incremented by the number of tracepoints that may be associated with that
+ * probe; fasttrap_total is capped at fasttrap_max.
+ */
+#define	FASTTRAP_MAX_DEFAULT		250000
+static uint32_t fasttrap_max;
+static uint32_t fasttrap_total;
+
+
+#define	FASTTRAP_TPOINTS_DEFAULT_SIZE	0x4000
+#define	FASTTRAP_PROVIDERS_DEFAULT_SIZE	0x100
+#define	FASTTRAP_PROCS_DEFAULT_SIZE	0x100
+
+#define	FASTTRAP_PID_NAME		"pid"
+
+fasttrap_hash_t			fasttrap_tpoints;
+static fasttrap_hash_t		fasttrap_provs;
+static fasttrap_hash_t		fasttrap_procs;
+
+static uint64_t			fasttrap_pid_count;	/* pid ref count */
+static kmutex_t			fasttrap_count_mtx;	/* lock on ref count */
+
+#define	FASTTRAP_ENABLE_FAIL	1
+#define	FASTTRAP_ENABLE_PARTIAL	2
+
+static int fasttrap_tracepoint_enable(proc_t *, fasttrap_probe_t *, uint_t);
+static void fasttrap_tracepoint_disable(proc_t *, fasttrap_probe_t *, uint_t);
+
+static fasttrap_provider_t *fasttrap_provider_lookup(pid_t, const char *,
+    const dtrace_pattr_t *);
+static void fasttrap_provider_retire(pid_t, const char *, int);
+static void fasttrap_provider_free(fasttrap_provider_t *);
+
+static fasttrap_proc_t *fasttrap_proc_lookup(pid_t);
+static void fasttrap_proc_release(fasttrap_proc_t *);
+
+#define	FASTTRAP_PROVS_INDEX(pid, name) \
+	((fasttrap_hash_str(name) + (pid)) & fasttrap_provs.fth_mask)
+
+#define	FASTTRAP_PROCS_INDEX(pid) ((pid) & fasttrap_procs.fth_mask)
+
+static int
+fasttrap_highbit(ulong_t i)
+{
+	int h = 1;
+
+	if (i == 0)
+		return (0);
+#ifdef _LP64
+	if (i & 0xffffffff00000000ul) {
+		h += 32; i >>= 32;
+	}
+#endif
+	if (i & 0xffff0000) {
+		h += 16; i >>= 16;
+	}
+	if (i & 0xff00) {
+		h += 8; i >>= 8;
+	}
+	if (i & 0xf0) {
+		h += 4; i >>= 4;
+	}
+	if (i & 0xc) {
+		h += 2; i >>= 2;
+	}
+	if (i & 0x2) {
+		h += 1;
+	}
+	return (h);
+}
+
+static uint_t
+fasttrap_hash_str(const char *p)
+{
+	unsigned int g;
+	uint_t hval = 0;
+
+	while (*p) {
+		hval = (hval << 4) + *p++;
+		if ((g = (hval & 0xf0000000)) != 0)
+			hval ^= g >> 24;
+		hval &= ~g;
+	}
+	return (hval);
+}
+
+void
+fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc)
+{
+	sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP);
+
+	sqp->sq_info.si_signo = SIGTRAP;
+	sqp->sq_info.si_code = TRAP_DTRACE;
+	sqp->sq_info.si_addr = (caddr_t)pc;
+
+	mutex_enter(&p->p_lock);
+	sigaddqa(p, t, sqp);
+	mutex_exit(&p->p_lock);
+
+	if (t != NULL)
+		aston(t);
+}
+
+/*
+ * This function ensures that no threads are actively using the memory
+ * associated with probes that were formerly live.
+ */
+static void
+fasttrap_mod_barrier(uint64_t gen)
+{
+	int i;
+
+	if (gen < fasttrap_mod_gen)
+		return;
+
+	fasttrap_mod_gen++;
+
+	for (i = 0; i < NCPU; i++) {
+		mutex_enter(&cpu_core[i].cpuc_pid_lock);
+		mutex_exit(&cpu_core[i].cpuc_pid_lock);
+	}
+}
+
+/*
+ * This is the timeout's callback for cleaning up the providers and their
+ * probes.
+ */
+/*ARGSUSED*/
+static void
+fasttrap_pid_cleanup_cb(void *data)
+{
+	fasttrap_provider_t **fpp, *fp;
+	fasttrap_bucket_t *bucket;
+	dtrace_provider_id_t provid;
+	int i, later;
+
+	static volatile int in = 0;
+	ASSERT(in == 0);
+	in = 1;
+
+	mutex_enter(&fasttrap_cleanup_mtx);
+	while (fasttrap_cleanup_work) {
+		fasttrap_cleanup_work = 0;
+		mutex_exit(&fasttrap_cleanup_mtx);
+
+		later = 0;
+
+		/*
+		 * Iterate over all the providers trying to remove the marked
+		 * ones. If a provider is marked but not retired, we just
+		 * have to take a crack at removing it -- it's no big deal if
+		 * we can't.
+		 */
+		for (i = 0; i < fasttrap_provs.fth_nent; i++) {
+			bucket = &fasttrap_provs.fth_table[i];
+			mutex_enter(&bucket->ftb_mtx);
+			fpp = (fasttrap_provider_t **)&bucket->ftb_data;
+
+			while ((fp = *fpp) != NULL) {
+				if (!fp->ftp_marked) {
+					fpp = &fp->ftp_next;
+					continue;
+				}
+
+				mutex_enter(&fp->ftp_mtx);
+
+				/*
+				 * If this provider has consumers actively
+				 * creating probes (ftp_ccount) or is a USDT
+				 * provider (ftp_mcount), we can't unregister
+				 * or even condense.
+				 */
+				if (fp->ftp_ccount != 0 ||
+				    fp->ftp_mcount != 0) {
+					mutex_exit(&fp->ftp_mtx);
+					fp->ftp_marked = 0;
+					continue;
+				}
+
+				if (!fp->ftp_retired || fp->ftp_rcount != 0)
+					fp->ftp_marked = 0;
+
+				mutex_exit(&fp->ftp_mtx);
+
+				/*
+				 * If we successfully unregister this
+				 * provider we can remove it from the hash
+				 * chain and free the memory. If our attempt
+				 * to unregister fails and this is a retired
+				 * provider, increment our flag to try again
+				 * pretty soon. If we've consumed more than
+				 * half of our total permitted number of
+				 * probes call dtrace_condense() to try to
+				 * clean out the unenabled probes.
+				 */
+				provid = fp->ftp_provid;
+				if (dtrace_unregister(provid) != 0) {
+					if (fasttrap_total > fasttrap_max / 2)
+						(void) dtrace_condense(provid);
+					later += fp->ftp_marked;
+					fpp = &fp->ftp_next;
+				} else {
+					*fpp = fp->ftp_next;
+					fasttrap_provider_free(fp);
+				}
+			}
+			mutex_exit(&bucket->ftb_mtx);
+		}
+
+		mutex_enter(&fasttrap_cleanup_mtx);
+	}
+
+	ASSERT(fasttrap_timeout != 0);
+
+	/*
+	 * If we were unable to remove a retired provider, try again after
+	 * a second. This situation can occur in certain circumstances where
+	 * providers cannot be unregistered even though they have no probes
+	 * enabled because of an execution of dtrace -l or something similar.
+	 * If the timeout has been disabled (set to 1 because we're trying
+	 * to detach), we set fasttrap_cleanup_work to ensure that we'll
+	 * get a chance to do that work if and when the timeout is reenabled
+	 * (if detach fails).
+	 */
+	if (later > 0 && fasttrap_timeout != (timeout_id_t)1)
+		fasttrap_timeout = timeout(&fasttrap_pid_cleanup_cb, NULL, hz);
+	else if (later > 0)
+		fasttrap_cleanup_work = 1;
+	else
+		fasttrap_timeout = 0;
+
+	mutex_exit(&fasttrap_cleanup_mtx);
+	in = 0;
+}
+
+/*
+ * Activates the asynchronous cleanup mechanism.
+ */
+static void
+fasttrap_pid_cleanup(void)
+{
+	mutex_enter(&fasttrap_cleanup_mtx);
+	fasttrap_cleanup_work = 1;
+	if (fasttrap_timeout == 0)
+		fasttrap_timeout = timeout(&fasttrap_pid_cleanup_cb, NULL, 1);
+	mutex_exit(&fasttrap_cleanup_mtx);
+}
+
+/*
+ * This is called from cfork() via dtrace_fasttrap_fork(). The child
+ * process's address space is (roughly) a copy of the parent process's so
+ * we have to remove all the instrumentation we had previously enabled in the
+ * parent.
+ */
+static void
+fasttrap_fork(proc_t *p, proc_t *cp)
+{
+	pid_t ppid = p->p_pid;
+	int i;
+
+	ASSERT(curproc == p);
+	ASSERT(p->p_proc_flag & P_PR_LOCK);
+	ASSERT(p->p_dtrace_count > 0);
+	ASSERT(cp->p_dtrace_count == 0);
+
+	/*
+	 * This would be simpler and faster if we maintained per-process
+	 * hash tables of enabled tracepoints. It could, however, potentially
+	 * slow down execution of a tracepoint since we'd need to go
+	 * through two levels of indirection. In the future, we should
+	 * consider either maintaining per-process ancillary lists of
+	 * enabled tracepoints or hanging a pointer to a per-process hash
+	 * table of enabled tracepoints off the proc structure.
+	 */
+
+	/*
+	 * We don't have to worry about the child process disappearing
+	 * because we're in fork().
+	 */
+	mutex_enter(&cp->p_lock);
+	sprlock_proc(cp);
+	mutex_exit(&cp->p_lock);
+
+	/*
+	 * Iterate over every tracepoint looking for ones that belong to the
+	 * parent process, and remove each from the child process.
+	 */
+	for (i = 0; i < fasttrap_tpoints.fth_nent; i++) {
+		fasttrap_tracepoint_t *tp;
+		fasttrap_bucket_t *bucket = &fasttrap_tpoints.fth_table[i];
+
+		mutex_enter(&bucket->ftb_mtx);
+		for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) {
+			if (tp->ftt_pid == ppid &&
+			    tp->ftt_proc->ftpc_acount != 0) {
+				int ret = fasttrap_tracepoint_remove(cp, tp);
+				ASSERT(ret == 0);
+
+				/*
+				 * The count of active providers can only be
+				 * decremented (i.e. to zero) during exec,
+				 * exit, and removal of a meta provider so it
+				 * should be impossible to drop the count
+				 * mid-fork.
+				 */
+				ASSERT(tp->ftt_proc->ftpc_acount != 0);
+			}
+		}
+		mutex_exit(&bucket->ftb_mtx);
+	}
+
+	mutex_enter(&cp->p_lock);
+	sprunlock(cp);
+}
+
+/*
+ * This is called from proc_exit() or from exec_common() if p_dtrace_probes
+ * is set on the proc structure to indicate that there is a pid provider
+ * associated with this process.
+ */
+static void
+fasttrap_exec_exit(proc_t *p)
+{
+	ASSERT(p == curproc);
+	ASSERT(MUTEX_HELD(&p->p_lock));
+
+	mutex_exit(&p->p_lock);
+
+	/*
+	 * We clean up the pid provider for this process here; user-land
+	 * static probes are handled by the meta-provider remove entry point.
+	 */
+	fasttrap_provider_retire(p->p_pid, FASTTRAP_PID_NAME, 0);
+
+	mutex_enter(&p->p_lock);
+}
+
+
+/*ARGSUSED*/
+static void
+fasttrap_pid_provide(void *arg, const dtrace_probedesc_t *desc)
+{
+	/*
+	 * There are no "default" pid probes.
+	 */
+}
+
+static int
+fasttrap_tracepoint_enable(proc_t *p, fasttrap_probe_t *probe, uint_t index)
+{
+	fasttrap_tracepoint_t *tp, *new_tp = NULL;
+	fasttrap_bucket_t *bucket;
+	fasttrap_id_t *id;
+	pid_t pid;
+	uintptr_t pc;
+
+	ASSERT(index < probe->ftp_ntps);
+
+	pid = probe->ftp_pid;
+	pc = probe->ftp_tps[index].fit_tp->ftt_pc;
+	id = &probe->ftp_tps[index].fit_id;
+
+	ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid);
+
+	ASSERT(!(p->p_flag & SVFORK));
+
+	/*
+	 * Before we make any modifications, make sure we've imposed a barrier
+	 * on the generation in which this probe was last modified.
+	 */
+	fasttrap_mod_barrier(probe->ftp_gen);
+
+	bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)];
+
+	/*
+	 * If the tracepoint has already been enabled, just add our id to the
+	 * list of interested probes. This may be our second time through
+	 * this path in which case we'll have constructed the tracepoint we'd
+	 * like to install. If we can't find a match, and have an allocated
+	 * tracepoint ready to go, enable that one now.
+	 *
+	 * A tracepoint whose process is defunct is also considered defunct.
+	 */
+again:
+	mutex_enter(&bucket->ftb_mtx);
+	for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) {
+		/*
+		 * Note that it's safe to access the active count on the
+		 * associated proc structure because we know that at least one
+		 * provider (this one) will still be around throughout this
+		 * operation.
+		 */
+		if (tp->ftt_pid != pid || tp->ftt_pc != pc ||
+		    tp->ftt_proc->ftpc_acount == 0)
+			continue;
+
+		/*
+		 * Now that we've found a matching tracepoint, it would be
+		 * a decent idea to confirm that the tracepoint is still
+		 * enabled and the trap instruction hasn't been overwritten.
+		 * Since this is a little hairy, we'll punt for now.
+		 */
+
+		/*
+		 * This can't be the first interested probe. We don't have
+		 * to worry about another thread being in the midst of
+		 * deleting this tracepoint (which would be the only valid
+		 * reason for a tracepoint to have no interested probes)
+		 * since we're holding P_PR_LOCK for this process.
+		 */
+		ASSERT(tp->ftt_ids != NULL || tp->ftt_retids != NULL);
+
+		switch (id->fti_ptype) {
+		case DTFTP_ENTRY:
+		case DTFTP_OFFSETS:
+		case DTFTP_IS_ENABLED:
+			id->fti_next = tp->ftt_ids;
+			membar_producer();
+			tp->ftt_ids = id;
+			membar_producer();
+			break;
+
+		case DTFTP_RETURN:
+		case DTFTP_POST_OFFSETS:
+			id->fti_next = tp->ftt_retids;
+			membar_producer();
+			tp->ftt_retids = id;
+			membar_producer();
+			break;
+
+		default:
+			ASSERT(0);
+		}
+
+		mutex_exit(&bucket->ftb_mtx);
+
+		if (new_tp != NULL) {
+			new_tp->ftt_ids = NULL;
+			new_tp->ftt_retids = NULL;
+		}
+
+		return (0);
+	}
+
+	/*
+	 * If we have a good tracepoint ready to go, install it now while
+	 * we have the lock held and no one can screw with us.
+	 */
+	if (new_tp != NULL) {
+		int rc = 0;
+
+		new_tp->ftt_next = bucket->ftb_data;
+		membar_producer();
+		bucket->ftb_data = new_tp;
+		membar_producer();
+		mutex_exit(&bucket->ftb_mtx);
+
+		/*
+		 * Activate the tracepoint in the ISA-specific manner.
+		 * If this fails, we need to report the failure, but
+		 * indicate that this tracepoint must still be disabled
+		 * by calling fasttrap_tracepoint_disable().
+		 */
+		if (fasttrap_tracepoint_install(p, new_tp) != 0)
+			rc = FASTTRAP_ENABLE_PARTIAL;
+
+		/*
+		 * Increment the count of the number of tracepoints active in
+		 * the victim process.
+		 */
+		ASSERT(p->p_proc_flag & P_PR_LOCK);
+		p->p_dtrace_count++;
+
+		return (rc);
+	}
+
+	mutex_exit(&bucket->ftb_mtx);
+
+	/*
+	 * Initialize the tracepoint that's been preallocated with the probe.
+	 */
+	new_tp = probe->ftp_tps[index].fit_tp;
+
+	ASSERT(new_tp->ftt_pid == pid);
+	ASSERT(new_tp->ftt_pc == pc);
+	ASSERT(new_tp->ftt_proc == probe->ftp_prov->ftp_proc);
+	ASSERT(new_tp->ftt_ids == NULL);
+	ASSERT(new_tp->ftt_retids == NULL);
+
+	switch (id->fti_ptype) {
+	case DTFTP_ENTRY:
+	case DTFTP_OFFSETS:
+	case DTFTP_IS_ENABLED:
+		id->fti_next = NULL;
+		new_tp->ftt_ids = id;
+		break;
+
+	case DTFTP_RETURN:
+	case DTFTP_POST_OFFSETS:
+		id->fti_next = NULL;
+		new_tp->ftt_retids = id;
+		break;
+
+	default:
+		ASSERT(0);
+	}
+
+	/*
+	 * If the ISA-dependent initialization goes to plan, go back to the
+	 * beginning and try to install this freshly made tracepoint.
+	 */
+	if (fasttrap_tracepoint_init(p, new_tp, pc, id->fti_ptype) == 0)
+		goto again;
+
+	new_tp->ftt_ids = NULL;
+	new_tp->ftt_retids = NULL;
+
+	return (FASTTRAP_ENABLE_FAIL);
+}
+
+static void
+fasttrap_tracepoint_disable(proc_t *p, fasttrap_probe_t *probe, uint_t index)
+{
+	fasttrap_bucket_t *bucket;
+	fasttrap_provider_t *provider = probe->ftp_prov;
+	fasttrap_tracepoint_t **pp, *tp;
+	fasttrap_id_t *id, **idp;
+	pid_t pid;
+	uintptr_t pc;
+
+	ASSERT(index < probe->ftp_ntps);
+
+	pid = probe->ftp_pid;
+	pc = probe->ftp_tps[index].fit_tp->ftt_pc;
+	id = &probe->ftp_tps[index].fit_id;
+
+	ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid);
+
+	/*
+	 * Find the tracepoint and make sure that our id is one of the
+	 * ones registered with it.
+	 */
+	bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)];
+	mutex_enter(&bucket->ftb_mtx);
+	for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) {
+		if (tp->ftt_pid == pid && tp->ftt_pc == pc &&
+		    tp->ftt_proc == provider->ftp_proc)
+			break;
+	}
+
+	/*
+	 * If we somehow lost this tracepoint, we're in a world of hurt.
+	 */
+	ASSERT(tp != NULL);
+
+	switch (id->fti_ptype) {
+	case DTFTP_ENTRY:
+	case DTFTP_OFFSETS:
+	case DTFTP_IS_ENABLED:
+		ASSERT(tp->ftt_ids != NULL);
+		idp = &tp->ftt_ids;
+		break;
+
+	case DTFTP_RETURN:
+	case DTFTP_POST_OFFSETS:
+		ASSERT(tp->ftt_retids != NULL);
+		idp = &tp->ftt_retids;
+		break;
+
+	default:
+		ASSERT(0);
+	}
+
+	while ((*idp)->fti_probe != probe) {
+		idp = &(*idp)->fti_next;
+		ASSERT(*idp != NULL);
+	}
+
+	id = *idp;
+	*idp = id->fti_next;
+	membar_producer();
+
+	ASSERT(id->fti_probe == probe);
+
+	/*
+	 * If there are other registered enablings of this tracepoint, we're
+	 * all done, but if this was the last probe assocated with this
+	 * this tracepoint, we need to remove and free it.
+	 */
+	if (tp->ftt_ids != NULL || tp->ftt_retids != NULL) {
+
+		/*
+		 * If the current probe's tracepoint is in use, swap it
+		 * for an unused tracepoint.
+		 */
+		if (tp == probe->ftp_tps[index].fit_tp) {
+			fasttrap_probe_t *tmp_probe;
+			fasttrap_tracepoint_t **tmp_tp;
+			uint_t tmp_index;
+
+			if (tp->ftt_ids != NULL) {
+				tmp_probe = tp->ftt_ids->fti_probe;
+				/* LINTED - alignment */
+				tmp_index = FASTTRAP_ID_INDEX(tp->ftt_ids);
+				tmp_tp = &tmp_probe->ftp_tps[tmp_index].fit_tp;
+			} else {
+				tmp_probe = tp->ftt_retids->fti_probe;
+				/* LINTED - alignment */
+				tmp_index = FASTTRAP_ID_INDEX(tp->ftt_retids);
+				tmp_tp = &tmp_probe->ftp_tps[tmp_index].fit_tp;
+			}
+
+			ASSERT(*tmp_tp != NULL);
+			ASSERT(*tmp_tp != probe->ftp_tps[index].fit_tp);
+			ASSERT((*tmp_tp)->ftt_ids == NULL);
+			ASSERT((*tmp_tp)->ftt_retids == NULL);
+
+			probe->ftp_tps[index].fit_tp = *tmp_tp;
+			*tmp_tp = tp;
+		}
+
+		mutex_exit(&bucket->ftb_mtx);
+
+		/*
+		 * Tag the modified probe with the generation in which it was
+		 * changed.
+		 */
+		probe->ftp_gen = fasttrap_mod_gen;
+		return;
+	}
+
+	mutex_exit(&bucket->ftb_mtx);
+
+	/*
+	 * We can't safely remove the tracepoint from the set of active
+	 * tracepoints until we've actually removed the fasttrap instruction
+	 * from the process's text. We can, however, operate on this
+	 * tracepoint secure in the knowledge that no other thread is going to
+	 * be looking at it since we hold P_PR_LOCK on the process if it's
+	 * live or we hold the provider lock on the process if it's dead and
+	 * gone.
+	 */
+
+	/*
+	 * We only need to remove the actual instruction if we're looking
+	 * at an existing process
+	 */
+	if (p != NULL) {
+		/*
+		 * If we fail to restore the instruction we need to kill
+		 * this process since it's in a completely unrecoverable
+		 * state.
+		 */
+		if (fasttrap_tracepoint_remove(p, tp) != 0)
+			fasttrap_sigtrap(p, NULL, pc);
+
+		/*
+		 * Decrement the count of the number of tracepoints active
+		 * in the victim process.
+		 */
+		ASSERT(p->p_proc_flag & P_PR_LOCK);
+		p->p_dtrace_count--;
+	}
+
+	/*
+	 * Remove the probe from the hash table of active tracepoints.
+	 */
+	mutex_enter(&bucket->ftb_mtx);
+	pp = (fasttrap_tracepoint_t **)&bucket->ftb_data;
+	ASSERT(*pp != NULL);
+	while (*pp != tp) {
+		pp = &(*pp)->ftt_next;
+		ASSERT(*pp != NULL);
+	}
+
+	*pp = tp->ftt_next;
+	membar_producer();
+
+	mutex_exit(&bucket->ftb_mtx);
+
+	/*
+	 * Tag the modified probe with the generation in which it was changed.
+	 */
+	probe->ftp_gen = fasttrap_mod_gen;
+}
+
+static void
+fasttrap_enable_callbacks(void)
+{
+	/*
+	 * We don't have to play the rw lock game here because we're
+	 * providing something rather than taking something away --
+	 * we can be sure that no threads have tried to follow this
+	 * function pointer yet.
+	 */
+	mutex_enter(&fasttrap_count_mtx);
+	if (fasttrap_pid_count == 0) {
+		ASSERT(dtrace_pid_probe_ptr == NULL);
+		ASSERT(dtrace_return_probe_ptr == NULL);
+		dtrace_pid_probe_ptr = &fasttrap_pid_probe;
+		dtrace_return_probe_ptr = &fasttrap_return_probe;
+	}
+	ASSERT(dtrace_pid_probe_ptr == &fasttrap_pid_probe);
+	ASSERT(dtrace_return_probe_ptr == &fasttrap_return_probe);
+	fasttrap_pid_count++;
+	mutex_exit(&fasttrap_count_mtx);
+}
+
+static void
+fasttrap_disable_callbacks(void)
+{
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	mutex_enter(&fasttrap_count_mtx);
+	ASSERT(fasttrap_pid_count > 0);
+	fasttrap_pid_count--;
+	if (fasttrap_pid_count == 0) {
+		cpu_t *cur, *cpu = CPU;
+
+		for (cur = cpu->cpu_next_onln; cur != cpu;
+		    cur = cur->cpu_next_onln) {
+			rw_enter(&cur->cpu_ft_lock, RW_WRITER);
+		}
+
+		dtrace_pid_probe_ptr = NULL;
+		dtrace_return_probe_ptr = NULL;
+
+		for (cur = cpu->cpu_next_onln; cur != cpu;
+		    cur = cur->cpu_next_onln) {
+			rw_exit(&cur->cpu_ft_lock);
+		}
+	}
+	mutex_exit(&fasttrap_count_mtx);
+}
+
+/*ARGSUSED*/
+static int
+fasttrap_pid_enable(void *arg, dtrace_id_t id, void *parg)
+{
+	fasttrap_probe_t *probe = parg;
+	proc_t *p;
+	int i, rc;
+
+	ASSERT(probe != NULL);
+	ASSERT(!probe->ftp_enabled);
+	ASSERT(id == probe->ftp_id);
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	/*
+	 * Increment the count of enabled probes on this probe's provider;
+	 * the provider can't go away while the probe still exists. We
+	 * must increment this even if we aren't able to properly enable
+	 * this probe.
+	 */
+	mutex_enter(&probe->ftp_prov->ftp_mtx);
+	probe->ftp_prov->ftp_rcount++;
+	mutex_exit(&probe->ftp_prov->ftp_mtx);
+
+	/*
+	 * If this probe's provider is retired (meaning it was valid in a
+	 * previously exec'ed incarnation of this address space), bail out. The
+	 * provider can't go away while we're in this code path.
+	 */
+	if (probe->ftp_prov->ftp_retired)
+		return (0);
+
+	/*
+	 * If we can't find the process, it may be that we're in the context of
+	 * a fork in which the traced process is being born and we're copying
+	 * USDT probes. Otherwise, the process is gone so bail.
+	 */
+	if ((p = sprlock(probe->ftp_pid)) == NULL) {
+		if ((curproc->p_flag & SFORKING) == 0)
+			return (0);
+
+		mutex_enter(&pidlock);
+		p = prfind(probe->ftp_pid);
+
+		/*
+		 * Confirm that curproc is indeed forking the process in which
+		 * we're trying to enable probes.
+		 */
+		ASSERT(p != NULL);
+		ASSERT(p->p_parent == curproc);
+		ASSERT(p->p_stat == SIDL);
+
+		mutex_enter(&p->p_lock);
+		mutex_exit(&pidlock);
+
+		sprlock_proc(p);
+	}
+
+	ASSERT(!(p->p_flag & SVFORK));
+	mutex_exit(&p->p_lock);
+
+	/*
+	 * We have to enable the trap entry point before any user threads have
+	 * the chance to execute the trap instruction we're about to place
+	 * in their process's text.
+	 */
+	fasttrap_enable_callbacks();
+
+	/*
+	 * Enable all the tracepoints and add this probe's id to each
+	 * tracepoint's list of active probes.
+	 */
+	for (i = 0; i < probe->ftp_ntps; i++) {
+		if ((rc = fasttrap_tracepoint_enable(p, probe, i)) != 0) {
+			/*
+			 * If enabling the tracepoint failed completely,
+			 * we don't have to disable it; if the failure
+			 * was only partial we must disable it.
+			 */
+			if (rc == FASTTRAP_ENABLE_FAIL)
+				i--;
+			else
+				ASSERT(rc == FASTTRAP_ENABLE_PARTIAL);
+
+			/*
+			 * Back up and pull out all the tracepoints we've
+			 * created so far for this probe.
+			 */
+			while (i >= 0) {
+				fasttrap_tracepoint_disable(p, probe, i);
+				i--;
+			}
+
+			mutex_enter(&p->p_lock);
+			sprunlock(p);
+
+			/*
+			 * Since we're not actually enabling this probe,
+			 * drop our reference on the trap table entry.
+			 */
+			fasttrap_disable_callbacks();
+			return (0);
+		}
+	}
+
+	mutex_enter(&p->p_lock);
+	sprunlock(p);
+
+	probe->ftp_enabled = 1;
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+fasttrap_pid_disable(void *arg, dtrace_id_t id, void *parg)
+{
+	fasttrap_probe_t *probe = parg;
+	fasttrap_provider_t *provider = probe->ftp_prov;
+	proc_t *p;
+	int i, whack = 0;
+
+	ASSERT(id == probe->ftp_id);
+
+	/*
+	 * We won't be able to acquire a /proc-esque lock on the process
+	 * iff the process is dead and gone. In this case, we rely on the
+	 * provider lock as a point of mutual exclusion to prevent other
+	 * DTrace consumers from disabling this probe.
+	 */
+	if ((p = sprlock(probe->ftp_pid)) != NULL) {
+		ASSERT(!(p->p_flag & SVFORK));
+		mutex_exit(&p->p_lock);
+	}
+
+	mutex_enter(&provider->ftp_mtx);
+
+	/*
+	 * Disable all the associated tracepoints (for fully enabled probes).
+	 */
+	if (probe->ftp_enabled) {
+		for (i = 0; i < probe->ftp_ntps; i++) {
+			fasttrap_tracepoint_disable(p, probe, i);
+		}
+	}
+
+	ASSERT(provider->ftp_rcount > 0);
+	provider->ftp_rcount--;
+
+	if (p != NULL) {
+		/*
+		 * Even though we may not be able to remove it entirely, we
+		 * mark this retired provider to get a chance to remove some
+		 * of the associated probes.
+		 */
+		if (provider->ftp_retired && !provider->ftp_marked)
+			whack = provider->ftp_marked = 1;
+		mutex_exit(&provider->ftp_mtx);
+
+		mutex_enter(&p->p_lock);
+		sprunlock(p);
+	} else {
+		/*
+		 * If the process is dead, we're just waiting for the
+		 * last probe to be disabled to be able to free it.
+		 */
+		if (provider->ftp_rcount == 0 && !provider->ftp_marked)
+			whack = provider->ftp_marked = 1;
+		mutex_exit(&provider->ftp_mtx);
+	}
+
+	if (whack)
+		fasttrap_pid_cleanup();
+
+	if (!probe->ftp_enabled)
+		return;
+
+	probe->ftp_enabled = 0;
+
+	ASSERT(MUTEX_HELD(&cpu_lock));
+	fasttrap_disable_callbacks();
+}
+
+/*ARGSUSED*/
+static void
+fasttrap_pid_getargdesc(void *arg, dtrace_id_t id, void *parg,
+    dtrace_argdesc_t *desc)
+{
+	fasttrap_probe_t *probe = parg;
+	char *str;
+	int i, ndx;
+
+	desc->dtargd_native[0] = '\0';
+	desc->dtargd_xlate[0] = '\0';
+
+	if (probe->ftp_prov->ftp_retired != 0 ||
+	    desc->dtargd_ndx >= probe->ftp_nargs) {
+		desc->dtargd_ndx = DTRACE_ARGNONE;
+		return;
+	}
+
+	ndx = (probe->ftp_argmap != NULL) ?
+	    probe->ftp_argmap[desc->dtargd_ndx] : desc->dtargd_ndx;
+
+	str = probe->ftp_ntypes;
+	for (i = 0; i < ndx; i++) {
+		str += strlen(str) + 1;
+	}
+
+	ASSERT(strlen(str + 1) < sizeof (desc->dtargd_native));
+	(void) strcpy(desc->dtargd_native, str);
+
+	if (probe->ftp_xtypes == NULL)
+		return;
+
+	str = probe->ftp_xtypes;
+	for (i = 0; i < desc->dtargd_ndx; i++) {
+		str += strlen(str) + 1;
+	}
+
+	ASSERT(strlen(str + 1) < sizeof (desc->dtargd_xlate));
+	(void) strcpy(desc->dtargd_xlate, str);
+}
+
+/*ARGSUSED*/
+static void
+fasttrap_pid_destroy(void *arg, dtrace_id_t id, void *parg)
+{
+	fasttrap_probe_t *probe = parg;
+	int i;
+	size_t size;
+
+	ASSERT(probe != NULL);
+	ASSERT(!probe->ftp_enabled);
+	ASSERT(fasttrap_total >= probe->ftp_ntps);
+
+	atomic_add_32(&fasttrap_total, -probe->ftp_ntps);
+	size = offsetof(fasttrap_probe_t, ftp_tps[probe->ftp_ntps]);
+
+	if (probe->ftp_gen + 1 >= fasttrap_mod_gen)
+		fasttrap_mod_barrier(probe->ftp_gen);
+
+	for (i = 0; i < probe->ftp_ntps; i++) {
+		kmem_free(probe->ftp_tps[i].fit_tp,
+		    sizeof (fasttrap_tracepoint_t));
+	}
+
+	kmem_free(probe, size);
+}
+
+
+static const dtrace_pattr_t pid_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+};
+
+static dtrace_pops_t pid_pops = {
+	fasttrap_pid_provide,
+	NULL,
+	fasttrap_pid_enable,
+	fasttrap_pid_disable,
+	NULL,
+	NULL,
+	fasttrap_pid_getargdesc,
+	fasttrap_pid_getarg,
+	NULL,
+	fasttrap_pid_destroy
+};
+
+static dtrace_pops_t usdt_pops = {
+	fasttrap_pid_provide,
+	NULL,
+	fasttrap_pid_enable,
+	fasttrap_pid_disable,
+	NULL,
+	NULL,
+	fasttrap_pid_getargdesc,
+	fasttrap_usdt_getarg,
+	NULL,
+	fasttrap_pid_destroy
+};
+
+static fasttrap_proc_t *
+fasttrap_proc_lookup(pid_t pid)
+{
+	fasttrap_bucket_t *bucket;
+	fasttrap_proc_t *fprc, *new_fprc;
+
+	bucket = &fasttrap_procs.fth_table[FASTTRAP_PROCS_INDEX(pid)];
+	mutex_enter(&bucket->ftb_mtx);
+
+	for (fprc = bucket->ftb_data; fprc != NULL; fprc = fprc->ftpc_next) {
+		if (fprc->ftpc_pid == pid && fprc->ftpc_acount != 0) {
+			mutex_enter(&fprc->ftpc_mtx);
+			mutex_exit(&bucket->ftb_mtx);
+			fprc->ftpc_rcount++;
+			atomic_add_64(&fprc->ftpc_acount, 1);
+			ASSERT(fprc->ftpc_acount <= fprc->ftpc_rcount);
+			mutex_exit(&fprc->ftpc_mtx);
+
+			return (fprc);
+		}
+	}
+
+	/*
+	 * Drop the bucket lock so we don't try to perform a sleeping
+	 * allocation under it.
+	 */
+	mutex_exit(&bucket->ftb_mtx);
+
+	new_fprc = kmem_zalloc(sizeof (fasttrap_proc_t), KM_SLEEP);
+	new_fprc->ftpc_pid = pid;
+	new_fprc->ftpc_rcount = 1;
+	new_fprc->ftpc_acount = 1;
+
+	mutex_enter(&bucket->ftb_mtx);
+
+	/*
+	 * Take another lap through the list to make sure a proc hasn't
+	 * been created for this pid while we weren't under the bucket lock.
+	 */
+	for (fprc = bucket->ftb_data; fprc != NULL; fprc = fprc->ftpc_next) {
+		if (fprc->ftpc_pid == pid && fprc->ftpc_acount != 0) {
+			mutex_enter(&fprc->ftpc_mtx);
+			mutex_exit(&bucket->ftb_mtx);
+			fprc->ftpc_rcount++;
+			atomic_add_64(&fprc->ftpc_acount, 1);
+			ASSERT(fprc->ftpc_acount <= fprc->ftpc_rcount);
+			mutex_exit(&fprc->ftpc_mtx);
+
+			kmem_free(new_fprc, sizeof (fasttrap_proc_t));
+
+			return (fprc);
+		}
+	}
+
+	new_fprc->ftpc_next = bucket->ftb_data;
+	bucket->ftb_data = new_fprc;
+
+	mutex_exit(&bucket->ftb_mtx);
+
+	return (new_fprc);
+}
+
+static void
+fasttrap_proc_release(fasttrap_proc_t *proc)
+{
+	fasttrap_bucket_t *bucket;
+	fasttrap_proc_t *fprc, **fprcp;
+	pid_t pid = proc->ftpc_pid;
+
+	mutex_enter(&proc->ftpc_mtx);
+
+	ASSERT(proc->ftpc_rcount != 0);
+	ASSERT(proc->ftpc_acount <= proc->ftpc_rcount);
+
+	if (--proc->ftpc_rcount != 0) {
+		mutex_exit(&proc->ftpc_mtx);
+		return;
+	}
+
+	mutex_exit(&proc->ftpc_mtx);
+
+	/*
+	 * There should definitely be no live providers associated with this
+	 * process at this point.
+	 */
+	ASSERT(proc->ftpc_acount == 0);
+
+	bucket = &fasttrap_procs.fth_table[FASTTRAP_PROCS_INDEX(pid)];
+	mutex_enter(&bucket->ftb_mtx);
+
+	fprcp = (fasttrap_proc_t **)&bucket->ftb_data;
+	while ((fprc = *fprcp) != NULL) {
+		if (fprc == proc)
+			break;
+
+		fprcp = &fprc->ftpc_next;
+	}
+
+	/*
+	 * Something strange has happened if we can't find the proc.
+	 */
+	ASSERT(fprc != NULL);
+
+	*fprcp = fprc->ftpc_next;
+
+	mutex_exit(&bucket->ftb_mtx);
+
+	kmem_free(fprc, sizeof (fasttrap_proc_t));
+}
+
+/*
+ * Lookup a fasttrap-managed provider based on its name and associated pid.
+ * If the pattr argument is non-NULL, this function instantiates the provider
+ * if it doesn't exist otherwise it returns NULL. The provider is returned
+ * with its lock held.
+ */
+static fasttrap_provider_t *
+fasttrap_provider_lookup(pid_t pid, const char *name,
+    const dtrace_pattr_t *pattr)
+{
+	fasttrap_provider_t *fp, *new_fp = NULL;
+	fasttrap_bucket_t *bucket;
+	char provname[DTRACE_PROVNAMELEN];
+	proc_t *p;
+	cred_t *cred;
+
+	ASSERT(strlen(name) < sizeof (fp->ftp_name));
+	ASSERT(pattr != NULL);
+
+	bucket = &fasttrap_provs.fth_table[FASTTRAP_PROVS_INDEX(pid, name)];
+	mutex_enter(&bucket->ftb_mtx);
+
+	/*
+	 * Take a lap through the list and return the match if we find it.
+	 */
+	for (fp = bucket->ftb_data; fp != NULL; fp = fp->ftp_next) {
+		if (fp->ftp_pid == pid && strcmp(fp->ftp_name, name) == 0 &&
+		    !fp->ftp_retired) {
+			mutex_enter(&fp->ftp_mtx);
+			mutex_exit(&bucket->ftb_mtx);
+			return (fp);
+		}
+	}
+
+	/*
+	 * Drop the bucket lock so we don't try to perform a sleeping
+	 * allocation under it.
+	 */
+	mutex_exit(&bucket->ftb_mtx);
+
+	/*
+	 * Make sure the process exists, isn't a child created as the result
+	 * of a vfork(2), and isn't a zombie (but may be in fork).
+	 */
+	mutex_enter(&pidlock);
+	if ((p = prfind(pid)) == NULL) {
+		mutex_exit(&pidlock);
+		return (NULL);
+	}
+	mutex_enter(&p->p_lock);
+	mutex_exit(&pidlock);
+	if (p->p_flag & (SVFORK | SEXITING)) {
+		mutex_exit(&p->p_lock);
+		return (NULL);
+	}
+
+	/*
+	 * Increment p_dtrace_probes so that the process knows to inform us
+	 * when it exits or execs. fasttrap_provider_free() decrements this
+	 * when we're done with this provider.
+	 */
+	p->p_dtrace_probes++;
+
+	/*
+	 * Grab the credentials for this process so we have
+	 * something to pass to dtrace_register().
+	 */
+	mutex_enter(&p->p_crlock);
+	crhold(p->p_cred);
+	cred = p->p_cred;
+	mutex_exit(&p->p_crlock);
+	mutex_exit(&p->p_lock);
+
+	new_fp = kmem_zalloc(sizeof (fasttrap_provider_t), KM_SLEEP);
+	new_fp->ftp_pid = pid;
+	new_fp->ftp_proc = fasttrap_proc_lookup(pid);
+
+	ASSERT(new_fp->ftp_proc != NULL);
+
+	mutex_enter(&bucket->ftb_mtx);
+
+	/*
+	 * Take another lap through the list to make sure a provider hasn't
+	 * been created for this pid while we weren't under the bucket lock.
+	 */
+	for (fp = bucket->ftb_data; fp != NULL; fp = fp->ftp_next) {
+		if (fp->ftp_pid == pid && strcmp(fp->ftp_name, name) == 0 &&
+		    !fp->ftp_retired) {
+			mutex_enter(&fp->ftp_mtx);
+			mutex_exit(&bucket->ftb_mtx);
+			fasttrap_provider_free(new_fp);
+			crfree(cred);
+			return (fp);
+		}
+	}
+
+	(void) strcpy(new_fp->ftp_name, name);
+
+	/*
+	 * Fail and return NULL if either the provider name is too long
+	 * or we fail to register this new provider with the DTrace
+	 * framework. Note that this is the only place we ever construct
+	 * the full provider name -- we keep it in pieces in the provider
+	 * structure.
+	 */
+	if (snprintf(provname, sizeof (provname), "%s%u", name, (uint_t)pid) >=
+	    sizeof (provname) ||
+	    dtrace_register(provname, pattr,
+	    DTRACE_PRIV_PROC | DTRACE_PRIV_OWNER | DTRACE_PRIV_ZONEOWNER, cred,
+	    pattr == &pid_attr ? &pid_pops : &usdt_pops, new_fp,
+	    &new_fp->ftp_provid) != 0) {
+		mutex_exit(&bucket->ftb_mtx);
+		fasttrap_provider_free(new_fp);
+		crfree(cred);
+		return (NULL);
+	}
+
+	new_fp->ftp_next = bucket->ftb_data;
+	bucket->ftb_data = new_fp;
+
+	mutex_enter(&new_fp->ftp_mtx);
+	mutex_exit(&bucket->ftb_mtx);
+
+	crfree(cred);
+	return (new_fp);
+}
+
+static void
+fasttrap_provider_free(fasttrap_provider_t *provider)
+{
+	pid_t pid = provider->ftp_pid;
+	proc_t *p;
+
+	/*
+	 * There need to be no associated enabled probes, no consumers
+	 * creating probes, and no meta providers referencing this provider.
+	 */
+	ASSERT(provider->ftp_rcount == 0);
+	ASSERT(provider->ftp_ccount == 0);
+	ASSERT(provider->ftp_mcount == 0);
+
+	/*
+	 * If this provider hasn't been retired, we need to explicitly drop the
+	 * count of active providers on the associated process structure.
+	 */
+	if (!provider->ftp_retired) {
+		atomic_add_64(&provider->ftp_proc->ftpc_acount, -1);
+		ASSERT(provider->ftp_proc->ftpc_acount <
+		    provider->ftp_proc->ftpc_rcount);
+	}
+
+	fasttrap_proc_release(provider->ftp_proc);
+
+	kmem_free(provider, sizeof (fasttrap_provider_t));
+
+	/*
+	 * Decrement p_dtrace_probes on the process whose provider we're
+	 * freeing. We don't have to worry about clobbering somone else's
+	 * modifications to it because we have locked the bucket that
+	 * corresponds to this process's hash chain in the provider hash
+	 * table. Don't sweat it if we can't find the process.
+	 */
+	mutex_enter(&pidlock);
+	if ((p = prfind(pid)) == NULL) {
+		mutex_exit(&pidlock);
+		return;
+	}
+
+	mutex_enter(&p->p_lock);
+	mutex_exit(&pidlock);
+
+	p->p_dtrace_probes--;
+	mutex_exit(&p->p_lock);
+}
+
+static void
+fasttrap_provider_retire(pid_t pid, const char *name, int mprov)
+{
+	fasttrap_provider_t *fp;
+	fasttrap_bucket_t *bucket;
+	dtrace_provider_id_t provid;
+
+	ASSERT(strlen(name) < sizeof (fp->ftp_name));
+
+	bucket = &fasttrap_provs.fth_table[FASTTRAP_PROVS_INDEX(pid, name)];
+	mutex_enter(&bucket->ftb_mtx);
+
+	for (fp = bucket->ftb_data; fp != NULL; fp = fp->ftp_next) {
+		if (fp->ftp_pid == pid && strcmp(fp->ftp_name, name) == 0 &&
+		    !fp->ftp_retired)
+			break;
+	}
+
+	if (fp == NULL) {
+		mutex_exit(&bucket->ftb_mtx);
+		return;
+	}
+
+	mutex_enter(&fp->ftp_mtx);
+	ASSERT(!mprov || fp->ftp_mcount > 0);
+	if (mprov && --fp->ftp_mcount != 0)  {
+		mutex_exit(&fp->ftp_mtx);
+		mutex_exit(&bucket->ftb_mtx);
+		return;
+	}
+
+	/*
+	 * Mark the provider to be removed in our post-processing step, mark it
+	 * retired, and drop the active count on its proc. Marking it indicates
+	 * that we should try to remove it; setting the retired flag indicates
+	 * that we're done with this provider; dropping the active the proc
+	 * releases our hold, and when this reaches zero (as it will during
+	 * exit or exec) the proc and associated providers become defunct.
+	 *
+	 * We obviously need to take the bucket lock before the provider lock
+	 * to perform the lookup, but we need to drop the provider lock
+	 * before calling into the DTrace framework since we acquire the
+	 * provider lock in callbacks invoked from the DTrace framework. The
+	 * bucket lock therefore protects the integrity of the provider hash
+	 * table.
+	 */
+	atomic_add_64(&fp->ftp_proc->ftpc_acount, -1);
+	ASSERT(fp->ftp_proc->ftpc_acount < fp->ftp_proc->ftpc_rcount);
+
+	fp->ftp_retired = 1;
+	fp->ftp_marked = 1;
+	provid = fp->ftp_provid;
+	mutex_exit(&fp->ftp_mtx);
+
+	/*
+	 * We don't have to worry about invalidating the same provider twice
+	 * since fasttrap_provider_lookup() will ignore provider that have
+	 * been marked as retired.
+	 */
+	dtrace_invalidate(provid);
+
+	mutex_exit(&bucket->ftb_mtx);
+
+	fasttrap_pid_cleanup();
+}
+
+static int
+fasttrap_uint32_cmp(const void *ap, const void *bp)
+{
+	return (*(const uint32_t *)ap - *(const uint32_t *)bp);
+}
+
+static int
+fasttrap_uint64_cmp(const void *ap, const void *bp)
+{
+	return (*(const uint64_t *)ap - *(const uint64_t *)bp);
+}
+
+static int
+fasttrap_add_probe(fasttrap_probe_spec_t *pdata)
+{
+	fasttrap_provider_t *provider;
+	fasttrap_probe_t *pp;
+	fasttrap_tracepoint_t *tp;
+	char *name;
+	int i, aframes, whack;
+
+	/*
+	 * There needs to be at least one desired trace point.
+	 */
+	if (pdata->ftps_noffs == 0)
+		return (EINVAL);
+
+	switch (pdata->ftps_type) {
+	case DTFTP_ENTRY:
+		name = "entry";
+		aframes = FASTTRAP_ENTRY_AFRAMES;
+		break;
+	case DTFTP_RETURN:
+		name = "return";
+		aframes = FASTTRAP_RETURN_AFRAMES;
+		break;
+	case DTFTP_OFFSETS:
+		name = NULL;
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	if ((provider = fasttrap_provider_lookup(pdata->ftps_pid,
+	    FASTTRAP_PID_NAME, &pid_attr)) == NULL)
+		return (ESRCH);
+
+	/*
+	 * Increment this reference count to indicate that a consumer is
+	 * actively adding a new probe associated with this provider. This
+	 * prevents the provider from being deleted -- we'll need to check
+	 * for pending deletions when we drop this reference count.
+	 */
+	provider->ftp_ccount++;
+	mutex_exit(&provider->ftp_mtx);
+
+	/*
+	 * Grab the creation lock to ensure consistency between calls to
+	 * dtrace_probe_lookup() and dtrace_probe_create() in the face of
+	 * other threads creating probes. We must drop the provider lock
+	 * before taking this lock to avoid a three-way deadlock with the
+	 * DTrace framework.
+	 */
+	mutex_enter(&provider->ftp_cmtx);
+
+	if (name == NULL) {
+		for (i = 0; i < pdata->ftps_noffs; i++) {
+			char name_str[17];
+
+			(void) sprintf(name_str, "%llx",
+			    (unsigned long long)pdata->ftps_offs[i]);
+
+			if (dtrace_probe_lookup(provider->ftp_provid,
+			    pdata->ftps_mod, pdata->ftps_func, name_str) != 0)
+				continue;
+
+			atomic_add_32(&fasttrap_total, 1);
+
+			if (fasttrap_total > fasttrap_max) {
+				atomic_add_32(&fasttrap_total, -1);
+				goto no_mem;
+			}
+
+			pp = kmem_zalloc(sizeof (fasttrap_probe_t), KM_SLEEP);
+
+			pp->ftp_prov = provider;
+			pp->ftp_faddr = pdata->ftps_pc;
+			pp->ftp_fsize = pdata->ftps_size;
+			pp->ftp_pid = pdata->ftps_pid;
+			pp->ftp_ntps = 1;
+
+			tp = kmem_zalloc(sizeof (fasttrap_tracepoint_t),
+			    KM_SLEEP);
+
+			tp->ftt_proc = provider->ftp_proc;
+			tp->ftt_pc = pdata->ftps_offs[i] + pdata->ftps_pc;
+			tp->ftt_pid = pdata->ftps_pid;
+
+			pp->ftp_tps[0].fit_tp = tp;
+			pp->ftp_tps[0].fit_id.fti_probe = pp;
+			pp->ftp_tps[0].fit_id.fti_ptype = pdata->ftps_type;
+
+			pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
+			    pdata->ftps_mod, pdata->ftps_func, name_str,
+			    FASTTRAP_OFFSET_AFRAMES, pp);
+		}
+
+	} else if (dtrace_probe_lookup(provider->ftp_provid, pdata->ftps_mod,
+	    pdata->ftps_func, name) == 0) {
+		atomic_add_32(&fasttrap_total, pdata->ftps_noffs);
+
+		if (fasttrap_total > fasttrap_max) {
+			atomic_add_32(&fasttrap_total, -pdata->ftps_noffs);
+			goto no_mem;
+		}
+
+		/*
+		 * Make sure all tracepoint program counter values are unique.
+		 * We later assume that each probe has exactly one tracepoint
+		 * for a given pc.
+		 */
+		qsort(pdata->ftps_offs, pdata->ftps_noffs,
+		    sizeof (uint64_t), fasttrap_uint64_cmp);
+		for (i = 1; i < pdata->ftps_noffs; i++) {
+			if (pdata->ftps_offs[i] > pdata->ftps_offs[i - 1])
+				continue;
+
+			atomic_add_32(&fasttrap_total, -pdata->ftps_noffs);
+			goto no_mem;
+		}
+
+		ASSERT(pdata->ftps_noffs > 0);
+		pp = kmem_zalloc(offsetof(fasttrap_probe_t,
+		    ftp_tps[pdata->ftps_noffs]), KM_SLEEP);
+
+		pp->ftp_prov = provider;
+		pp->ftp_faddr = pdata->ftps_pc;
+		pp->ftp_fsize = pdata->ftps_size;
+		pp->ftp_pid = pdata->ftps_pid;
+		pp->ftp_ntps = pdata->ftps_noffs;
+
+		for (i = 0; i < pdata->ftps_noffs; i++) {
+			tp = kmem_zalloc(sizeof (fasttrap_tracepoint_t),
+			    KM_SLEEP);
+
+			tp->ftt_proc = provider->ftp_proc;
+			tp->ftt_pc = pdata->ftps_offs[i] + pdata->ftps_pc;
+			tp->ftt_pid = pdata->ftps_pid;
+
+			pp->ftp_tps[i].fit_tp = tp;
+			pp->ftp_tps[i].fit_id.fti_probe = pp;
+			pp->ftp_tps[i].fit_id.fti_ptype = pdata->ftps_type;
+		}
+
+		pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
+		    pdata->ftps_mod, pdata->ftps_func, name, aframes, pp);
+	}
+
+	mutex_exit(&provider->ftp_cmtx);
+
+	/*
+	 * We know that the provider is still valid since we incremented the
+	 * creation reference count. If someone tried to clean up this provider
+	 * while we were using it (e.g. because the process called exec(2) or
+	 * exit(2)), take note of that and try to clean it up now.
+	 */
+	mutex_enter(&provider->ftp_mtx);
+	provider->ftp_ccount--;
+	whack = provider->ftp_retired;
+	mutex_exit(&provider->ftp_mtx);
+
+	if (whack)
+		fasttrap_pid_cleanup();
+
+	return (0);
+
+no_mem:
+	/*
+	 * If we've exhausted the allowable resources, we'll try to remove
+	 * this provider to free some up. This is to cover the case where
+	 * the user has accidentally created many more probes than was
+	 * intended (e.g. pid123:::).
+	 */
+	mutex_exit(&provider->ftp_cmtx);
+	mutex_enter(&provider->ftp_mtx);
+	provider->ftp_ccount--;
+	provider->ftp_marked = 1;
+	mutex_exit(&provider->ftp_mtx);
+
+	fasttrap_pid_cleanup();
+
+	return (ENOMEM);
+}
+
+/*ARGSUSED*/
+static void *
+fasttrap_meta_provide(void *arg, dtrace_helper_provdesc_t *dhpv, pid_t pid)
+{
+	fasttrap_provider_t *provider;
+
+	/*
+	 * A 32-bit unsigned integer (like a pid for example) can be
+	 * expressed in 10 or fewer decimal digits. Make sure that we'll
+	 * have enough space for the provider name.
+	 */
+	if (strlen(dhpv->dthpv_provname) + 10 >=
+	    sizeof (provider->ftp_name)) {
+		cmn_err(CE_WARN, "failed to instantiate provider %s: "
+		    "name too long to accomodate pid", dhpv->dthpv_provname);
+		return (NULL);
+	}
+
+	/*
+	 * Don't let folks spoof the true pid provider.
+	 */
+	if (strcmp(dhpv->dthpv_provname, FASTTRAP_PID_NAME) == 0) {
+		cmn_err(CE_WARN, "failed to instantiate provider %s: "
+		    "%s is an invalid name", dhpv->dthpv_provname,
+		    FASTTRAP_PID_NAME);
+		return (NULL);
+	}
+
+	/*
+	 * The highest stability class that fasttrap supports is ISA; cap
+	 * the stability of the new provider accordingly.
+	 */
+	if (dhpv->dthpv_pattr.dtpa_provider.dtat_class > DTRACE_CLASS_ISA)
+		dhpv->dthpv_pattr.dtpa_provider.dtat_class = DTRACE_CLASS_ISA;
+	if (dhpv->dthpv_pattr.dtpa_mod.dtat_class > DTRACE_CLASS_ISA)
+		dhpv->dthpv_pattr.dtpa_mod.dtat_class = DTRACE_CLASS_ISA;
+	if (dhpv->dthpv_pattr.dtpa_func.dtat_class > DTRACE_CLASS_ISA)
+		dhpv->dthpv_pattr.dtpa_func.dtat_class = DTRACE_CLASS_ISA;
+	if (dhpv->dthpv_pattr.dtpa_name.dtat_class > DTRACE_CLASS_ISA)
+		dhpv->dthpv_pattr.dtpa_name.dtat_class = DTRACE_CLASS_ISA;
+	if (dhpv->dthpv_pattr.dtpa_args.dtat_class > DTRACE_CLASS_ISA)
+		dhpv->dthpv_pattr.dtpa_args.dtat_class = DTRACE_CLASS_ISA;
+
+	if ((provider = fasttrap_provider_lookup(pid, dhpv->dthpv_provname,
+	    &dhpv->dthpv_pattr)) == NULL) {
+		cmn_err(CE_WARN, "failed to instantiate provider %s for "
+		    "process %u",  dhpv->dthpv_provname, (uint_t)pid);
+		return (NULL);
+	}
+
+	/*
+	 * Up the meta provider count so this provider isn't removed until
+	 * the meta provider has been told to remove it.
+	 */
+	provider->ftp_mcount++;
+
+	mutex_exit(&provider->ftp_mtx);
+
+	return (provider);
+}
+
+/*ARGSUSED*/
+static void
+fasttrap_meta_create_probe(void *arg, void *parg,
+    dtrace_helper_probedesc_t *dhpb)
+{
+	fasttrap_provider_t *provider = parg;
+	fasttrap_probe_t *pp;
+	fasttrap_tracepoint_t *tp;
+	int i, j;
+	uint32_t ntps;
+
+	/*
+	 * Since the meta provider count is non-zero we don't have to worry
+	 * about this provider disappearing.
+	 */
+	ASSERT(provider->ftp_mcount > 0);
+
+	/*
+	 * The offsets must be unique.
+	 */
+	qsort(dhpb->dthpb_offs, dhpb->dthpb_noffs, sizeof (uint32_t),
+	    fasttrap_uint32_cmp);
+	for (i = 1; i < dhpb->dthpb_noffs; i++) {
+		if (dhpb->dthpb_base + dhpb->dthpb_offs[i] <=
+		    dhpb->dthpb_base + dhpb->dthpb_offs[i - 1])
+			return;
+	}
+
+	qsort(dhpb->dthpb_enoffs, dhpb->dthpb_nenoffs, sizeof (uint32_t),
+	    fasttrap_uint32_cmp);
+	for (i = 1; i < dhpb->dthpb_nenoffs; i++) {
+		if (dhpb->dthpb_base + dhpb->dthpb_enoffs[i] <=
+		    dhpb->dthpb_base + dhpb->dthpb_enoffs[i - 1])
+			return;
+	}
+
+	/*
+	 * Grab the creation lock to ensure consistency between calls to
+	 * dtrace_probe_lookup() and dtrace_probe_create() in the face of
+	 * other threads creating probes.
+	 */
+	mutex_enter(&provider->ftp_cmtx);
+
+	if (dtrace_probe_lookup(provider->ftp_provid, dhpb->dthpb_mod,
+	    dhpb->dthpb_func, dhpb->dthpb_name) != 0) {
+		mutex_exit(&provider->ftp_cmtx);
+		return;
+	}
+
+	ntps = dhpb->dthpb_noffs + dhpb->dthpb_nenoffs;
+	ASSERT(ntps > 0);
+
+	atomic_add_32(&fasttrap_total, ntps);
+
+	if (fasttrap_total > fasttrap_max) {
+		atomic_add_32(&fasttrap_total, -ntps);
+		mutex_exit(&provider->ftp_cmtx);
+		return;
+	}
+
+	pp = kmem_zalloc(offsetof(fasttrap_probe_t, ftp_tps[ntps]), KM_SLEEP);
+
+	pp->ftp_prov = provider;
+	pp->ftp_pid = provider->ftp_pid;
+	pp->ftp_ntps = ntps;
+	pp->ftp_nargs = dhpb->dthpb_xargc;
+	pp->ftp_xtypes = dhpb->dthpb_xtypes;
+	pp->ftp_ntypes = dhpb->dthpb_ntypes;
+
+	/*
+	 * First create a tracepoint for each actual point of interest.
+	 */
+	for (i = 0; i < dhpb->dthpb_noffs; i++) {
+		tp = kmem_zalloc(sizeof (fasttrap_tracepoint_t), KM_SLEEP);
+
+		tp->ftt_proc = provider->ftp_proc;
+		tp->ftt_pc = dhpb->dthpb_base + dhpb->dthpb_offs[i];
+		tp->ftt_pid = provider->ftp_pid;
+
+		pp->ftp_tps[i].fit_tp = tp;
+		pp->ftp_tps[i].fit_id.fti_probe = pp;
+#ifdef __sparc
+		pp->ftp_tps[i].fit_id.fti_ptype = DTFTP_POST_OFFSETS;
+#else
+		pp->ftp_tps[i].fit_id.fti_ptype = DTFTP_OFFSETS;
+#endif
+	}
+
+	/*
+	 * Then create a tracepoint for each is-enabled point.
+	 */
+	for (j = 0; i < ntps; i++, j++) {
+		tp = kmem_zalloc(sizeof (fasttrap_tracepoint_t), KM_SLEEP);
+
+		tp->ftt_proc = provider->ftp_proc;
+		tp->ftt_pc = dhpb->dthpb_base + dhpb->dthpb_enoffs[j];
+		tp->ftt_pid = provider->ftp_pid;
+
+		pp->ftp_tps[i].fit_tp = tp;
+		pp->ftp_tps[i].fit_id.fti_probe = pp;
+		pp->ftp_tps[i].fit_id.fti_ptype = DTFTP_IS_ENABLED;
+	}
+
+	/*
+	 * If the arguments are shuffled around we set the argument remapping
+	 * table. Later, when the probe fires, we only remap the arguments
+	 * if the table is non-NULL.
+	 */
+	for (i = 0; i < dhpb->dthpb_xargc; i++) {
+		if (dhpb->dthpb_args[i] != i) {
+			pp->ftp_argmap = dhpb->dthpb_args;
+			break;
+		}
+	}
+
+	/*
+	 * The probe is fully constructed -- register it with DTrace.
+	 */
+	pp->ftp_id = dtrace_probe_create(provider->ftp_provid, dhpb->dthpb_mod,
+	    dhpb->dthpb_func, dhpb->dthpb_name, FASTTRAP_OFFSET_AFRAMES, pp);
+
+	mutex_exit(&provider->ftp_cmtx);
+}
+
+/*ARGSUSED*/
+static void
+fasttrap_meta_remove(void *arg, dtrace_helper_provdesc_t *dhpv, pid_t pid)
+{
+	/*
+	 * Clean up the USDT provider. There may be active consumers of the
+	 * provider busy adding probes, no damage will actually befall the
+	 * provider until that count has dropped to zero. This just puts
+	 * the provider on death row.
+	 */
+	fasttrap_provider_retire(pid, dhpv->dthpv_provname, 1);
+}
+
+static dtrace_mops_t fasttrap_mops = {
+	fasttrap_meta_create_probe,
+	fasttrap_meta_provide,
+	fasttrap_meta_remove
+};
+
+/*ARGSUSED*/
+static int
+fasttrap_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
+{
+	return (0);
+}
+
+/*ARGSUSED*/
+static int
+fasttrap_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv)
+{
+	if (!dtrace_attached())
+		return (EAGAIN);
+
+	if (cmd == FASTTRAPIOC_MAKEPROBE) {
+		fasttrap_probe_spec_t *uprobe = (void *)arg;
+		fasttrap_probe_spec_t *probe;
+		uint64_t noffs;
+		size_t size;
+		int ret;
+		char *c;
+
+		if (copyin(&uprobe->ftps_noffs, &noffs,
+		    sizeof (uprobe->ftps_noffs)))
+			return (EFAULT);
+
+		/*
+		 * Probes must have at least one tracepoint.
+		 */
+		if (noffs == 0)
+			return (EINVAL);
+
+		size = sizeof (fasttrap_probe_spec_t) +
+		    sizeof (probe->ftps_offs[0]) * (noffs - 1);
+
+		if (size > 1024 * 1024)
+			return (ENOMEM);
+
+		probe = kmem_alloc(size, KM_SLEEP);
+
+		if (copyin(uprobe, probe, size) != 0 ||
+		    probe->ftps_noffs != noffs) {
+			kmem_free(probe, size);
+			return (EFAULT);
+		}
+
+		/*
+		 * Verify that the function and module strings contain no
+		 * funny characters.
+		 */
+		for (c = &probe->ftps_func[0]; *c != '\0'; c++) {
+			if (*c < 0x20 || 0x7f <= *c) {
+				ret = EINVAL;
+				goto err;
+			}
+		}
+
+		for (c = &probe->ftps_mod[0]; *c != '\0'; c++) {
+			if (*c < 0x20 || 0x7f <= *c) {
+				ret = EINVAL;
+				goto err;
+			}
+		}
+
+		if (!PRIV_POLICY_CHOICE(cr, PRIV_ALL, B_FALSE)) {
+			proc_t *p;
+			pid_t pid = probe->ftps_pid;
+
+			mutex_enter(&pidlock);
+			/*
+			 * Report an error if the process doesn't exist
+			 * or is actively being birthed.
+			 */
+			if ((p = prfind(pid)) == NULL || p->p_stat == SIDL) {
+				mutex_exit(&pidlock);
+				return (ESRCH);
+			}
+			mutex_enter(&p->p_lock);
+			mutex_exit(&pidlock);
+
+			if ((ret = priv_proc_cred_perm(cr, p, NULL,
+			    VREAD | VWRITE)) != 0) {
+				mutex_exit(&p->p_lock);
+				return (ret);
+			}
+
+			mutex_exit(&p->p_lock);
+		}
+
+		ret = fasttrap_add_probe(probe);
+err:
+		kmem_free(probe, size);
+
+		return (ret);
+
+	} else if (cmd == FASTTRAPIOC_GETINSTR) {
+		fasttrap_instr_query_t instr;
+		fasttrap_tracepoint_t *tp;
+		uint_t index;
+		int ret;
+
+		if (copyin((void *)arg, &instr, sizeof (instr)) != 0)
+			return (EFAULT);
+
+		if (!PRIV_POLICY_CHOICE(cr, PRIV_ALL, B_FALSE)) {
+			proc_t *p;
+			pid_t pid = instr.ftiq_pid;
+
+			mutex_enter(&pidlock);
+			/*
+			 * Report an error if the process doesn't exist
+			 * or is actively being birthed.
+			 */
+			if ((p = prfind(pid)) == NULL || p->p_stat == SIDL) {
+				mutex_exit(&pidlock);
+				return (ESRCH);
+			}
+			mutex_enter(&p->p_lock);
+			mutex_exit(&pidlock);
+
+			if ((ret = priv_proc_cred_perm(cr, p, NULL,
+			    VREAD)) != 0) {
+				mutex_exit(&p->p_lock);
+				return (ret);
+			}
+
+			mutex_exit(&p->p_lock);
+		}
+
+		index = FASTTRAP_TPOINTS_INDEX(instr.ftiq_pid, instr.ftiq_pc);
+
+		mutex_enter(&fasttrap_tpoints.fth_table[index].ftb_mtx);
+		tp = fasttrap_tpoints.fth_table[index].ftb_data;
+		while (tp != NULL) {
+			if (instr.ftiq_pid == tp->ftt_pid &&
+			    instr.ftiq_pc == tp->ftt_pc &&
+			    tp->ftt_proc->ftpc_acount != 0)
+				break;
+
+			tp = tp->ftt_next;
+		}
+
+		if (tp == NULL) {
+			mutex_exit(&fasttrap_tpoints.fth_table[index].ftb_mtx);
+			return (ENOENT);
+		}
+
+		bcopy(&tp->ftt_instr, &instr.ftiq_instr,
+		    sizeof (instr.ftiq_instr));
+		mutex_exit(&fasttrap_tpoints.fth_table[index].ftb_mtx);
+
+		if (copyout(&instr, (void *)arg, sizeof (instr)) != 0)
+			return (EFAULT);
+
+		return (0);
+	}
+
+	return (EINVAL);
+}
+
+static struct cb_ops fasttrap_cb_ops = {
+	fasttrap_open,		/* open */
+	nodev,			/* close */
+	nulldev,		/* strategy */
+	nulldev,		/* print */
+	nodev,			/* dump */
+	nodev,			/* read */
+	nodev,			/* write */
+	fasttrap_ioctl,		/* ioctl */
+	nodev,			/* devmap */
+	nodev,			/* mmap */
+	nodev,			/* segmap */
+	nochpoll,		/* poll */
+	ddi_prop_op,		/* cb_prop_op */
+	0,			/* streamtab  */
+	D_NEW | D_MP		/* Driver compatibility flag */
+};
+
+/*ARGSUSED*/
+static int
+fasttrap_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+	int error;
+
+	switch (infocmd) {
+	case DDI_INFO_DEVT2DEVINFO:
+		*result = (void *)fasttrap_devi;
+		error = DDI_SUCCESS;
+		break;
+	case DDI_INFO_DEVT2INSTANCE:
+		*result = (void *)0;
+		error = DDI_SUCCESS;
+		break;
+	default:
+		error = DDI_FAILURE;
+	}
+	return (error);
+}
+
+static int
+fasttrap_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
+{
+	ulong_t nent;
+
+	switch (cmd) {
+	case DDI_ATTACH:
+		break;
+	case DDI_RESUME:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (ddi_create_minor_node(devi, "fasttrap", S_IFCHR, 0,
+	    DDI_PSEUDO, NULL) == DDI_FAILURE) {
+		ddi_remove_minor_node(devi, NULL);
+		return (DDI_FAILURE);
+	}
+
+	ddi_report_dev(devi);
+	fasttrap_devi = devi;
+
+	/*
+	 * Install our hooks into fork(2), exec(2), and exit(2).
+	 */
+	dtrace_fasttrap_fork_ptr = &fasttrap_fork;
+	dtrace_fasttrap_exit_ptr = &fasttrap_exec_exit;
+	dtrace_fasttrap_exec_ptr = &fasttrap_exec_exit;
+
+	fasttrap_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
+	    "fasttrap-max-probes", FASTTRAP_MAX_DEFAULT);
+	fasttrap_total = 0;
+
+	/*
+	 * Conjure up the tracepoints hashtable...
+	 */
+	nent = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
+	    "fasttrap-hash-size", FASTTRAP_TPOINTS_DEFAULT_SIZE);
+
+	if (nent == 0 || nent > 0x1000000)
+		nent = FASTTRAP_TPOINTS_DEFAULT_SIZE;
+
+	if ((nent & (nent - 1)) == 0)
+		fasttrap_tpoints.fth_nent = nent;
+	else
+		fasttrap_tpoints.fth_nent = 1 << fasttrap_highbit(nent);
+	ASSERT(fasttrap_tpoints.fth_nent > 0);
+	fasttrap_tpoints.fth_mask = fasttrap_tpoints.fth_nent - 1;
+	fasttrap_tpoints.fth_table = kmem_zalloc(fasttrap_tpoints.fth_nent *
+	    sizeof (fasttrap_bucket_t), KM_SLEEP);
+
+	/*
+	 * ... and the providers hash table...
+	 */
+	nent = FASTTRAP_PROVIDERS_DEFAULT_SIZE;
+	if ((nent & (nent - 1)) == 0)
+		fasttrap_provs.fth_nent = nent;
+	else
+		fasttrap_provs.fth_nent = 1 << fasttrap_highbit(nent);
+	ASSERT(fasttrap_provs.fth_nent > 0);
+	fasttrap_provs.fth_mask = fasttrap_provs.fth_nent - 1;
+	fasttrap_provs.fth_table = kmem_zalloc(fasttrap_provs.fth_nent *
+	    sizeof (fasttrap_bucket_t), KM_SLEEP);
+
+	/*
+	 * ... and the procs hash table.
+	 */
+	nent = FASTTRAP_PROCS_DEFAULT_SIZE;
+	if ((nent & (nent - 1)) == 0)
+		fasttrap_procs.fth_nent = nent;
+	else
+		fasttrap_procs.fth_nent = 1 << fasttrap_highbit(nent);
+	ASSERT(fasttrap_procs.fth_nent > 0);
+	fasttrap_procs.fth_mask = fasttrap_procs.fth_nent - 1;
+	fasttrap_procs.fth_table = kmem_zalloc(fasttrap_procs.fth_nent *
+	    sizeof (fasttrap_bucket_t), KM_SLEEP);
+
+	(void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL,
+	    &fasttrap_meta_id);
+
+	return (DDI_SUCCESS);
+}
+
+static int
+fasttrap_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
+{
+	int i, fail = 0;
+	timeout_id_t tmp;
+
+	switch (cmd) {
+	case DDI_DETACH:
+		break;
+	case DDI_SUSPEND:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	/*
+	 * Unregister the meta-provider to make sure no new fasttrap-
+	 * managed providers come along while we're trying to close up
+	 * shop. If we fail to detach, we'll need to re-register as a
+	 * meta-provider. We can fail to unregister as a meta-provider
+	 * if providers we manage still exist.
+	 */
+	if (fasttrap_meta_id != DTRACE_METAPROVNONE &&
+	    dtrace_meta_unregister(fasttrap_meta_id) != 0)
+		return (DDI_FAILURE);
+
+	/*
+	 * Prevent any new timeouts from running by setting fasttrap_timeout
+	 * to a non-zero value, and wait for the current timeout to complete.
+	 */
+	mutex_enter(&fasttrap_cleanup_mtx);
+	fasttrap_cleanup_work = 0;
+
+	while (fasttrap_timeout != (timeout_id_t)1) {
+		tmp = fasttrap_timeout;
+		fasttrap_timeout = (timeout_id_t)1;
+
+		if (tmp != 0) {
+			mutex_exit(&fasttrap_cleanup_mtx);
+			(void) untimeout(tmp);
+			mutex_enter(&fasttrap_cleanup_mtx);
+		}
+	}
+
+	fasttrap_cleanup_work = 0;
+	mutex_exit(&fasttrap_cleanup_mtx);
+
+	/*
+	 * Iterate over all of our providers. If there's still a process
+	 * that corresponds to that pid, fail to detach.
+	 */
+	for (i = 0; i < fasttrap_provs.fth_nent; i++) {
+		fasttrap_provider_t **fpp, *fp;
+		fasttrap_bucket_t *bucket = &fasttrap_provs.fth_table[i];
+
+		mutex_enter(&bucket->ftb_mtx);
+		fpp = (fasttrap_provider_t **)&bucket->ftb_data;
+		while ((fp = *fpp) != NULL) {
+			/*
+			 * Acquire and release the lock as a simple way of
+			 * waiting for any other consumer to finish with
+			 * this provider. A thread must first acquire the
+			 * bucket lock so there's no chance of another thread
+			 * blocking on the provider's lock.
+			 */
+			mutex_enter(&fp->ftp_mtx);
+			mutex_exit(&fp->ftp_mtx);
+
+			if (dtrace_unregister(fp->ftp_provid) != 0) {
+				fail = 1;
+				fpp = &fp->ftp_next;
+			} else {
+				*fpp = fp->ftp_next;
+				fasttrap_provider_free(fp);
+			}
+		}
+
+		mutex_exit(&bucket->ftb_mtx);
+	}
+
+	if (fail) {
+		uint_t work;
+		/*
+		 * If we're failing to detach, we need to unblock timeouts
+		 * and start a new timeout if any work has accumulated while
+		 * we've been unsuccessfully trying to detach.
+		 */
+		mutex_enter(&fasttrap_cleanup_mtx);
+		fasttrap_timeout = 0;
+		work = fasttrap_cleanup_work;
+		mutex_exit(&fasttrap_cleanup_mtx);
+
+		if (work)
+			fasttrap_pid_cleanup();
+
+		(void) dtrace_meta_register("fasttrap", &fasttrap_mops, NULL,
+		    &fasttrap_meta_id);
+
+		return (DDI_FAILURE);
+	}
+
+#ifdef DEBUG
+	mutex_enter(&fasttrap_count_mtx);
+	ASSERT(fasttrap_pid_count == 0);
+	mutex_exit(&fasttrap_count_mtx);
+#endif
+
+	kmem_free(fasttrap_tpoints.fth_table,
+	    fasttrap_tpoints.fth_nent * sizeof (fasttrap_bucket_t));
+	fasttrap_tpoints.fth_nent = 0;
+
+	kmem_free(fasttrap_provs.fth_table,
+	    fasttrap_provs.fth_nent * sizeof (fasttrap_bucket_t));
+	fasttrap_provs.fth_nent = 0;
+
+	kmem_free(fasttrap_procs.fth_table,
+	    fasttrap_procs.fth_nent * sizeof (fasttrap_bucket_t));
+	fasttrap_procs.fth_nent = 0;
+
+	/*
+	 * We know there are no tracepoints in any process anywhere in
+	 * the system so there is no process which has its p_dtrace_count
+	 * greater than zero, therefore we know that no thread can actively
+	 * be executing code in fasttrap_fork(). Similarly for p_dtrace_probes
+	 * and fasttrap_exec() and fasttrap_exit().
+	 */
+	ASSERT(dtrace_fasttrap_fork_ptr == &fasttrap_fork);
+	dtrace_fasttrap_fork_ptr = NULL;
+
+	ASSERT(dtrace_fasttrap_exec_ptr == &fasttrap_exec_exit);
+	dtrace_fasttrap_exec_ptr = NULL;
+
+	ASSERT(dtrace_fasttrap_exit_ptr == &fasttrap_exec_exit);
+	dtrace_fasttrap_exit_ptr = NULL;
+
+	ddi_remove_minor_node(devi, NULL);
+
+	return (DDI_SUCCESS);
+}
+
+static struct dev_ops fasttrap_ops = {
+	DEVO_REV,		/* devo_rev */
+	0,			/* refcnt */
+	fasttrap_info,		/* get_dev_info */
+	nulldev,		/* identify */
+	nulldev,		/* probe */
+	fasttrap_attach,	/* attach */
+	fasttrap_detach,	/* detach */
+	nodev,			/* reset */
+	&fasttrap_cb_ops,	/* driver operations */
+	NULL,			/* bus operations */
+	nodev,			/* dev power */
+	ddi_quiesce_not_needed,		/* quiesce */
+};
+
+/*
+ * Module linkage information for the kernel.
+ */
+static struct modldrv modldrv = {
+	&mod_driverops,		/* module type (this is a pseudo driver) */
+	"Fasttrap Tracing",	/* name of module */
+	&fasttrap_ops,		/* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+	MODREV_1,
+	(void *)&modldrv,
+	NULL
+};
+
+int
+_init(void)
+{
+	return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+	return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+	return (mod_remove(&modlinkage));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/lockstat.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/lockstat.c
new file mode 100644
index 0000000..69c8b72
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/lockstat.c
@@ -0,0 +1,343 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/open.h>
+#include <sys/file.h>
+#include <sys/conf.h>
+#include <sys/modctl.h>
+#include <sys/cmn_err.h>
+#include <sys/bitmap.h>
+#include <sys/debug.h>
+#include <sys/kmem.h>
+#include <sys/errno.h>
+#include <sys/sysmacros.h>
+#include <sys/lockstat.h>
+#include <sys/atomic.h>
+#include <sys/dtrace.h>
+
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+
+typedef struct lockstat_probe {
+	const char	*lsp_func;
+	const char	*lsp_name;
+	int		lsp_probe;
+	dtrace_id_t	lsp_id;
+} lockstat_probe_t;
+
+lockstat_probe_t lockstat_probes[] =
+{
+	{ LS_MUTEX_ENTER,	LSA_ACQUIRE,	LS_MUTEX_ENTER_ACQUIRE },
+	{ LS_MUTEX_ENTER,	LSA_BLOCK,	LS_MUTEX_ENTER_BLOCK },
+	{ LS_MUTEX_ENTER,	LSA_SPIN,	LS_MUTEX_ENTER_SPIN },
+	{ LS_MUTEX_EXIT,	LSA_RELEASE,	LS_MUTEX_EXIT_RELEASE },
+	{ LS_MUTEX_DESTROY,	LSA_RELEASE,	LS_MUTEX_DESTROY_RELEASE },
+	{ LS_MUTEX_TRYENTER,	LSA_ACQUIRE,	LS_MUTEX_TRYENTER_ACQUIRE },
+	{ LS_LOCK_SET,		LSS_ACQUIRE,	LS_LOCK_SET_ACQUIRE },
+	{ LS_LOCK_SET,		LSS_SPIN,	LS_LOCK_SET_SPIN },
+	{ LS_LOCK_SET_SPL,	LSS_ACQUIRE,	LS_LOCK_SET_SPL_ACQUIRE },
+	{ LS_LOCK_SET_SPL,	LSS_SPIN,	LS_LOCK_SET_SPL_SPIN },
+	{ LS_LOCK_TRY,		LSS_ACQUIRE,	LS_LOCK_TRY_ACQUIRE },
+	{ LS_LOCK_CLEAR,	LSS_RELEASE,	LS_LOCK_CLEAR_RELEASE },
+	{ LS_LOCK_CLEAR_SPLX,	LSS_RELEASE,	LS_LOCK_CLEAR_SPLX_RELEASE },
+	{ LS_CLOCK_UNLOCK,	LSS_RELEASE,	LS_CLOCK_UNLOCK_RELEASE },
+	{ LS_RW_ENTER,		LSR_ACQUIRE,	LS_RW_ENTER_ACQUIRE },
+	{ LS_RW_ENTER,		LSR_BLOCK,	LS_RW_ENTER_BLOCK },
+	{ LS_RW_EXIT,		LSR_RELEASE,	LS_RW_EXIT_RELEASE },
+	{ LS_RW_TRYENTER,	LSR_ACQUIRE,	LS_RW_TRYENTER_ACQUIRE },
+	{ LS_RW_TRYUPGRADE,	LSR_UPGRADE,	LS_RW_TRYUPGRADE_UPGRADE },
+	{ LS_RW_DOWNGRADE,	LSR_DOWNGRADE,	LS_RW_DOWNGRADE_DOWNGRADE },
+	{ LS_THREAD_LOCK,	LST_SPIN,	LS_THREAD_LOCK_SPIN },
+	{ LS_THREAD_LOCK_HIGH,	LST_SPIN,	LS_THREAD_LOCK_HIGH_SPIN },
+	{ NULL }
+};
+
+static dev_info_t	*lockstat_devi;	/* saved in xxattach() for xxinfo() */
+static kmutex_t		lockstat_test;	/* for testing purposes only */
+static dtrace_provider_id_t lockstat_id;
+
+/*ARGSUSED*/
+static int
+lockstat_enable(void *arg, dtrace_id_t id, void *parg)
+{
+	lockstat_probe_t *probe = parg;
+
+	ASSERT(!lockstat_probemap[probe->lsp_probe]);
+
+	lockstat_probemap[probe->lsp_probe] = id;
+	membar_producer();
+
+	lockstat_hot_patch();
+	membar_producer();
+
+	/*
+	 * Immediately generate a record for the lockstat_test mutex
+	 * to verify that the mutex hot-patch code worked as expected.
+	 */
+	mutex_enter(&lockstat_test);
+	mutex_exit(&lockstat_test);
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+lockstat_disable(void *arg, dtrace_id_t id, void *parg)
+{
+	lockstat_probe_t *probe = parg;
+	int i;
+
+	ASSERT(lockstat_probemap[probe->lsp_probe]);
+
+	lockstat_probemap[probe->lsp_probe] = 0;
+	lockstat_hot_patch();
+	membar_producer();
+
+	/*
+	 * See if we have any probes left enabled.
+	 */
+	for (i = 0; i < LS_NPROBES; i++) {
+		if (lockstat_probemap[i]) {
+			/*
+			 * This probe is still enabled.  We don't need to deal
+			 * with waiting for all threads to be out of the
+			 * lockstat critical sections; just return.
+			 */
+			return;
+		}
+	}
+
+	/*
+	 * The delay() here isn't as cheesy as you might think.  We don't
+	 * want to busy-loop in the kernel, so we have to give up the
+	 * CPU between calls to lockstat_active_threads(); that much is
+	 * obvious.  But the reason it's a do..while loop rather than a
+	 * while loop is subtle.  The memory barrier above guarantees that
+	 * no threads will enter the lockstat code from this point forward.
+	 * However, another thread could already be executing lockstat code
+	 * without our knowledge if the update to its t_lockstat field hasn't
+	 * cleared its CPU's store buffer.  Delaying for one clock tick
+	 * guarantees that either (1) the thread will have *ample* time to
+	 * complete its work, or (2) the thread will be preempted, in which
+	 * case it will have to grab and release a dispatcher lock, which
+	 * will flush that CPU's store buffer.  Either way we're covered.
+	 */
+	do {
+		delay(1);
+	} while (lockstat_active_threads());
+}
+
+/*ARGSUSED*/
+static int
+lockstat_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
+{
+	return (0);
+}
+
+/* ARGSUSED */
+static int
+lockstat_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+	int error;
+
+	switch (infocmd) {
+	case DDI_INFO_DEVT2DEVINFO:
+		*result = (void *) lockstat_devi;
+		error = DDI_SUCCESS;
+		break;
+	case DDI_INFO_DEVT2INSTANCE:
+		*result = (void *)0;
+		error = DDI_SUCCESS;
+		break;
+	default:
+		error = DDI_FAILURE;
+	}
+	return (error);
+}
+
+/*ARGSUSED*/
+static void
+lockstat_provide(void *arg, const dtrace_probedesc_t *desc)
+{
+	int i = 0;
+
+	for (i = 0; lockstat_probes[i].lsp_func != NULL; i++) {
+		lockstat_probe_t *probe = &lockstat_probes[i];
+
+		if (dtrace_probe_lookup(lockstat_id, "genunix",
+		    probe->lsp_func, probe->lsp_name) != 0)
+			continue;
+
+		ASSERT(!probe->lsp_id);
+		probe->lsp_id = dtrace_probe_create(lockstat_id,
+		    "genunix", probe->lsp_func, probe->lsp_name,
+		    1, probe);
+	}
+}
+
+/*ARGSUSED*/
+static void
+lockstat_destroy(void *arg, dtrace_id_t id, void *parg)
+{
+	lockstat_probe_t *probe = parg;
+
+	ASSERT(!lockstat_probemap[probe->lsp_probe]);
+	probe->lsp_id = 0;
+}
+
+static dtrace_pattr_t lockstat_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+};
+
+static dtrace_pops_t lockstat_pops = {
+	lockstat_provide,
+	NULL,
+	lockstat_enable,
+	lockstat_disable,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	lockstat_destroy
+};
+
+static int
+lockstat_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_ATTACH:
+		break;
+	case DDI_RESUME:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (ddi_create_minor_node(devi, "lockstat", S_IFCHR, 0,
+	    DDI_PSEUDO, 0) == DDI_FAILURE ||
+	    dtrace_register("lockstat", &lockstat_attr, DTRACE_PRIV_KERNEL,
+	    NULL, &lockstat_pops, NULL, &lockstat_id) != 0) {
+		ddi_remove_minor_node(devi, NULL);
+		return (DDI_FAILURE);
+	}
+
+	lockstat_probe = dtrace_probe;
+	membar_producer();
+
+	ddi_report_dev(devi);
+	lockstat_devi = devi;
+	return (DDI_SUCCESS);
+}
+
+static int
+lockstat_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_DETACH:
+		break;
+	case DDI_SUSPEND:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (dtrace_unregister(lockstat_id) != 0)
+		return (DDI_FAILURE);
+
+	ddi_remove_minor_node(devi, NULL);
+	return (DDI_SUCCESS);
+}
+
+/*
+ * Configuration data structures
+ */
+static struct cb_ops lockstat_cb_ops = {
+	lockstat_open,		/* open */
+	nodev,			/* close */
+	nulldev,		/* strategy */
+	nulldev,		/* print */
+	nodev,			/* dump */
+	nodev,			/* read */
+	nodev,			/* write */
+	nodev,			/* ioctl */
+	nodev,			/* devmap */
+	nodev,			/* mmap */
+	nodev,			/* segmap */
+	nochpoll,		/* poll */
+	ddi_prop_op,		/* cb_prop_op */
+	0,			/* streamtab */
+	D_MP | D_NEW		/* Driver compatibility flag */
+};
+
+static struct dev_ops lockstat_ops = {
+	DEVO_REV,		/* devo_rev, */
+	0,			/* refcnt */
+	lockstat_info,		/* getinfo */
+	nulldev,		/* identify */
+	nulldev,		/* probe */
+	lockstat_attach,	/* attach */
+	lockstat_detach,	/* detach */
+	nulldev,		/* reset */
+	&lockstat_cb_ops,	/* cb_ops */
+	NULL,			/* bus_ops */
+	NULL,			/* power */
+	ddi_quiesce_not_needed,		/* quiesce */
+};
+
+static struct modldrv modldrv = {
+	&mod_driverops,		/* Type of module.  This one is a driver */
+	"Lock Statistics",	/* name of module */
+	&lockstat_ops,		/* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+	MODREV_1, (void *)&modldrv, NULL
+};
+
+int
+_init(void)
+{
+	return (mod_install(&modlinkage));
+}
+
+int
+_fini(void)
+{
+	return (mod_remove(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+	return (mod_info(&modlinkage, modinfop));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/lockstat.conf b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/lockstat.conf
new file mode 100644
index 0000000..6d29b6a
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/lockstat.conf
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 1997-2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+name="lockstat" parent="pseudo" instance=0;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/profile.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/profile.c
new file mode 100644
index 0000000..c1a2d1f
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/profile.c
@@ -0,0 +1,577 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#include <sys/errno.h>
+#include <sys/stat.h>
+#include <sys/modctl.h>
+#include <sys/conf.h>
+#include <sys/systm.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/cpuvar.h>
+#include <sys/kmem.h>
+#include <sys/strsubr.h>
+#include <sys/dtrace.h>
+#include <sys/cyclic.h>
+#include <sys/atomic.h>
+
+static dev_info_t *profile_devi;
+static dtrace_provider_id_t profile_id;
+
+/*
+ * Regardless of platform, the stack frames look like this in the case of the
+ * profile provider:
+ *
+ *	profile_fire
+ *	cyclic_expire
+ *	cyclic_fire
+ *	[ cbe ]
+ *	[ interrupt code ]
+ *
+ * On x86, there are five frames from the generic interrupt code; further, the
+ * interrupted instruction appears as its own stack frame, giving us a total of
+ * 10.
+ *
+ * On SPARC, the picture is further complicated because the compiler
+ * optimizes away tail-calls -- so the following frames are optimized away:
+ *
+ * 	profile_fire
+ *	cyclic_expire
+ *
+ * This gives three frames.  However, on DEBUG kernels, the cyclic_expire
+ * frame cannot be tail-call eliminated, yielding four frames in this case.
+ *
+ * All of the above constraints lead to the mess below.  Yes, the profile
+ * provider should ideally figure this out on-the-fly by hitting one of its own
+ * probes and then walking its own stack trace.  This is complicated, however,
+ * and the static definition doesn't seem to be overly brittle.  Still, we
+ * allow for a manual override in case we get it completely wrong.
+ */
+#ifdef __x86
+#define	PROF_ARTIFICIAL_FRAMES	10
+#else
+#ifdef __sparc
+#ifdef DEBUG
+#define	PROF_ARTIFICIAL_FRAMES	4
+#else
+#define	PROF_ARTIFICIAL_FRAMES	3
+#endif
+#endif
+#endif
+
+#define	PROF_NAMELEN		15
+
+#define	PROF_PROFILE		0
+#define	PROF_TICK		1
+#define	PROF_PREFIX_PROFILE	"profile-"
+#define	PROF_PREFIX_TICK	"tick-"
+
+typedef struct profile_probe {
+	char		prof_name[PROF_NAMELEN];
+	dtrace_id_t	prof_id;
+	int		prof_kind;
+	hrtime_t	prof_interval;
+	cyclic_id_t	prof_cyclic;
+} profile_probe_t;
+
+typedef struct profile_probe_percpu {
+	hrtime_t	profc_expected;
+	hrtime_t	profc_interval;
+	profile_probe_t	*profc_probe;
+} profile_probe_percpu_t;
+
+hrtime_t	profile_interval_min = NANOSEC / 5000;		/* 5000 hz */
+int		profile_aframes = 0;				/* override */
+
+static int profile_rates[] = {
+    97, 199, 499, 997, 1999,
+    4001, 4999, 0, 0, 0,
+    0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0
+};
+
+static int profile_ticks[] = {
+    1, 10, 100, 500, 1000,
+    5000, 0, 0, 0, 0,
+    0, 0, 0, 0, 0
+};
+
+/*
+ * profile_max defines the upper bound on the number of profile probes that
+ * can exist (this is to prevent malicious or clumsy users from exhausing
+ * system resources by creating a slew of profile probes). At mod load time,
+ * this gets its value from PROFILE_MAX_DEFAULT or profile-max-probes if it's
+ * present in the profile.conf file.
+ */
+#define	PROFILE_MAX_DEFAULT	1000	/* default max. number of probes */
+static uint32_t profile_max;		/* maximum number of profile probes */
+static uint32_t profile_total;	/* current number of profile probes */
+
+static void
+profile_fire(void *arg)
+{
+	profile_probe_percpu_t *pcpu = arg;
+	profile_probe_t *prof = pcpu->profc_probe;
+	hrtime_t late;
+
+	late = dtrace_gethrtime() - pcpu->profc_expected;
+	pcpu->profc_expected += pcpu->profc_interval;
+
+	dtrace_probe(prof->prof_id, CPU->cpu_profile_pc,
+	    CPU->cpu_profile_upc, late, 0, 0);
+}
+
+static void
+profile_tick(void *arg)
+{
+	profile_probe_t *prof = arg;
+
+	dtrace_probe(prof->prof_id, CPU->cpu_profile_pc,
+	    CPU->cpu_profile_upc, 0, 0, 0);
+}
+
+static void
+profile_create(hrtime_t interval, const char *name, int kind)
+{
+	profile_probe_t *prof;
+	int nr_frames = PROF_ARTIFICIAL_FRAMES + dtrace_mach_aframes();
+
+	if (profile_aframes)
+		nr_frames = profile_aframes;
+
+	if (interval < profile_interval_min)
+		return;
+
+	if (dtrace_probe_lookup(profile_id, NULL, NULL, name) != 0)
+		return;
+
+	atomic_add_32(&profile_total, 1);
+	if (profile_total > profile_max) {
+		atomic_add_32(&profile_total, -1);
+		return;
+	}
+
+	prof = kmem_zalloc(sizeof (profile_probe_t), KM_SLEEP);
+	(void) strcpy(prof->prof_name, name);
+	prof->prof_interval = interval;
+	prof->prof_cyclic = CYCLIC_NONE;
+	prof->prof_kind = kind;
+	prof->prof_id = dtrace_probe_create(profile_id,
+	    NULL, NULL, name, nr_frames, prof);
+}
+
+/*ARGSUSED*/
+static void
+profile_provide(void *arg, const dtrace_probedesc_t *desc)
+{
+	int i, j, rate, kind;
+	hrtime_t val = 0, mult = 1, len;
+	const char *name, *suffix = NULL;
+
+	const struct {
+		char *prefix;
+		int kind;
+	} types[] = {
+		{ PROF_PREFIX_PROFILE, PROF_PROFILE },
+		{ PROF_PREFIX_TICK, PROF_TICK },
+		{ NULL, NULL }
+	};
+
+	const struct {
+		char *name;
+		hrtime_t mult;
+	} suffixes[] = {
+		{ "ns", 	NANOSEC / NANOSEC },
+		{ "nsec",	NANOSEC / NANOSEC },
+		{ "us",		NANOSEC / MICROSEC },
+		{ "usec",	NANOSEC / MICROSEC },
+		{ "ms",		NANOSEC / MILLISEC },
+		{ "msec",	NANOSEC / MILLISEC },
+		{ "s",		NANOSEC / SEC },
+		{ "sec",	NANOSEC / SEC },
+		{ "m",		NANOSEC * (hrtime_t)60 },
+		{ "min",	NANOSEC * (hrtime_t)60 },
+		{ "h",		NANOSEC * (hrtime_t)(60 * 60) },
+		{ "hour",	NANOSEC * (hrtime_t)(60 * 60) },
+		{ "d",		NANOSEC * (hrtime_t)(24 * 60 * 60) },
+		{ "day",	NANOSEC * (hrtime_t)(24 * 60 * 60) },
+		{ "hz",		0 },
+		{ NULL }
+	};
+
+	if (desc == NULL) {
+		char n[PROF_NAMELEN];
+
+		/*
+		 * If no description was provided, provide all of our probes.
+		 */
+		for (i = 0; i < sizeof (profile_rates) / sizeof (int); i++) {
+			if ((rate = profile_rates[i]) == 0)
+				continue;
+
+			(void) snprintf(n, PROF_NAMELEN, "%s%d",
+			    PROF_PREFIX_PROFILE, rate);
+			profile_create(NANOSEC / rate, n, PROF_PROFILE);
+		}
+
+		for (i = 0; i < sizeof (profile_ticks) / sizeof (int); i++) {
+			if ((rate = profile_ticks[i]) == 0)
+				continue;
+
+			(void) snprintf(n, PROF_NAMELEN, "%s%d",
+			    PROF_PREFIX_TICK, rate);
+			profile_create(NANOSEC / rate, n, PROF_TICK);
+		}
+
+		return;
+	}
+
+	name = desc->dtpd_name;
+
+	for (i = 0; types[i].prefix != NULL; i++) {
+		len = strlen(types[i].prefix);
+
+		if (strncmp(name, types[i].prefix, len) != 0)
+			continue;
+		break;
+	}
+
+	if (types[i].prefix == NULL)
+		return;
+
+	kind = types[i].kind;
+	j = strlen(name) - len;
+
+	/*
+	 * We need to start before any time suffix.
+	 */
+	for (j = strlen(name); j >= len; j--) {
+		if (name[j] >= '0' && name[j] <= '9')
+			break;
+		suffix = &name[j];
+	}
+
+	ASSERT(suffix != NULL);
+
+	/*
+	 * Now determine the numerical value present in the probe name.
+	 */
+	for (; j >= len; j--) {
+		if (name[j] < '0' || name[j] > '9')
+			return;
+
+		val += (name[j] - '0') * mult;
+		mult *= (hrtime_t)10;
+	}
+
+	if (val == 0)
+		return;
+
+	/*
+	 * Look-up the suffix to determine the multiplier.
+	 */
+	for (i = 0, mult = 0; suffixes[i].name != NULL; i++) {
+		if (strcasecmp(suffixes[i].name, suffix) == 0) {
+			mult = suffixes[i].mult;
+			break;
+		}
+	}
+
+	if (suffixes[i].name == NULL && *suffix != '\0')
+		return;
+
+	if (mult == 0) {
+		/*
+		 * The default is frequency-per-second.
+		 */
+		val = NANOSEC / val;
+	} else {
+		val *= mult;
+	}
+
+	profile_create(val, name, kind);
+}
+
+/*ARGSUSED*/
+static void
+profile_destroy(void *arg, dtrace_id_t id, void *parg)
+{
+	profile_probe_t *prof = parg;
+
+	ASSERT(prof->prof_cyclic == CYCLIC_NONE);
+	kmem_free(prof, sizeof (profile_probe_t));
+
+	ASSERT(profile_total >= 1);
+	atomic_add_32(&profile_total, -1);
+}
+
+/*ARGSUSED*/
+static void
+profile_online(void *arg, cpu_t *cpu, cyc_handler_t *hdlr, cyc_time_t *when)
+{
+	profile_probe_t *prof = arg;
+	profile_probe_percpu_t *pcpu;
+
+	pcpu = kmem_zalloc(sizeof (profile_probe_percpu_t), KM_SLEEP);
+	pcpu->profc_probe = prof;
+
+	hdlr->cyh_func = profile_fire;
+	hdlr->cyh_arg = pcpu;
+	hdlr->cyh_level = CY_HIGH_LEVEL;
+
+	when->cyt_interval = prof->prof_interval;
+	when->cyt_when = dtrace_gethrtime() + when->cyt_interval;
+
+	pcpu->profc_expected = when->cyt_when;
+	pcpu->profc_interval = when->cyt_interval;
+}
+
+/*ARGSUSED*/
+static void
+profile_offline(void *arg, cpu_t *cpu, void *oarg)
+{
+	profile_probe_percpu_t *pcpu = oarg;
+
+	ASSERT(pcpu->profc_probe == arg);
+	kmem_free(pcpu, sizeof (profile_probe_percpu_t));
+}
+
+/*ARGSUSED*/
+static int
+profile_enable(void *arg, dtrace_id_t id, void *parg)
+{
+	profile_probe_t *prof = parg;
+	cyc_omni_handler_t omni;
+	cyc_handler_t hdlr;
+	cyc_time_t when;
+
+	ASSERT(prof->prof_interval != 0);
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	if (prof->prof_kind == PROF_TICK) {
+		hdlr.cyh_func = profile_tick;
+		hdlr.cyh_arg = prof;
+		hdlr.cyh_level = CY_HIGH_LEVEL;
+
+		when.cyt_interval = prof->prof_interval;
+		when.cyt_when = dtrace_gethrtime() + when.cyt_interval;
+	} else {
+		ASSERT(prof->prof_kind == PROF_PROFILE);
+		omni.cyo_online = profile_online;
+		omni.cyo_offline = profile_offline;
+		omni.cyo_arg = prof;
+	}
+
+	if (prof->prof_kind == PROF_TICK) {
+		prof->prof_cyclic = cyclic_add(&hdlr, &when);
+	} else {
+		prof->prof_cyclic = cyclic_add_omni(&omni);
+	}
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+profile_disable(void *arg, dtrace_id_t id, void *parg)
+{
+	profile_probe_t *prof = parg;
+
+	ASSERT(prof->prof_cyclic != CYCLIC_NONE);
+	ASSERT(MUTEX_HELD(&cpu_lock));
+
+	cyclic_remove(prof->prof_cyclic);
+	prof->prof_cyclic = CYCLIC_NONE;
+}
+
+/*ARGSUSED*/
+static int
+profile_usermode(void *arg, dtrace_id_t id, void *parg)
+{
+	return (CPU->cpu_profile_pc == 0);
+}
+
+static dtrace_pattr_t profile_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+};
+
+static dtrace_pops_t profile_pops = {
+	profile_provide,
+	NULL,
+	profile_enable,
+	profile_disable,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	profile_usermode,
+	profile_destroy
+};
+
+static int
+profile_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_ATTACH:
+		break;
+	case DDI_RESUME:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (ddi_create_minor_node(devi, "profile", S_IFCHR, 0,
+	    DDI_PSEUDO, NULL) == DDI_FAILURE ||
+	    dtrace_register("profile", &profile_attr,
+	    DTRACE_PRIV_KERNEL | DTRACE_PRIV_USER, NULL,
+	    &profile_pops, NULL, &profile_id) != 0) {
+		ddi_remove_minor_node(devi, NULL);
+		return (DDI_FAILURE);
+	}
+
+	profile_max = ddi_getprop(DDI_DEV_T_ANY, devi, DDI_PROP_DONTPASS,
+	    "profile-max-probes", PROFILE_MAX_DEFAULT);
+
+	ddi_report_dev(devi);
+	profile_devi = devi;
+	return (DDI_SUCCESS);
+}
+
+static int
+profile_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_DETACH:
+		break;
+	case DDI_SUSPEND:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (dtrace_unregister(profile_id) != 0)
+		return (DDI_FAILURE);
+
+	ddi_remove_minor_node(devi, NULL);
+	return (DDI_SUCCESS);
+}
+
+/*ARGSUSED*/
+static int
+profile_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+	int error;
+
+	switch (infocmd) {
+	case DDI_INFO_DEVT2DEVINFO:
+		*result = (void *)profile_devi;
+		error = DDI_SUCCESS;
+		break;
+	case DDI_INFO_DEVT2INSTANCE:
+		*result = (void *)0;
+		error = DDI_SUCCESS;
+		break;
+	default:
+		error = DDI_FAILURE;
+	}
+	return (error);
+}
+
+/*ARGSUSED*/
+static int
+profile_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
+{
+	return (0);
+}
+
+static struct cb_ops profile_cb_ops = {
+	profile_open,		/* open */
+	nodev,			/* close */
+	nulldev,		/* strategy */
+	nulldev,		/* print */
+	nodev,			/* dump */
+	nodev,			/* read */
+	nodev,			/* write */
+	nodev,			/* ioctl */
+	nodev,			/* devmap */
+	nodev,			/* mmap */
+	nodev,			/* segmap */
+	nochpoll,		/* poll */
+	ddi_prop_op,		/* cb_prop_op */
+	0,			/* streamtab  */
+	D_NEW | D_MP		/* Driver compatibility flag */
+};
+
+static struct dev_ops profile_ops = {
+	DEVO_REV,		/* devo_rev, */
+	0,			/* refcnt  */
+	profile_info,		/* get_dev_info */
+	nulldev,		/* identify */
+	nulldev,		/* probe */
+	profile_attach,		/* attach */
+	profile_detach,		/* detach */
+	nodev,			/* reset */
+	&profile_cb_ops,	/* driver operations */
+	NULL,			/* bus operations */
+	nodev,			/* dev power */
+	ddi_quiesce_not_needed,		/* quiesce */
+};
+
+/*
+ * Module linkage information for the kernel.
+ */
+static struct modldrv modldrv = {
+	&mod_driverops,		/* module type (this is a pseudo driver) */
+	"Profile Interrupt Tracing",	/* name of module */
+	&profile_ops,		/* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+	MODREV_1,
+	(void *)&modldrv,
+	NULL
+};
+
+int
+_init(void)
+{
+	return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+	return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+	return (mod_remove(&modlinkage));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/profile.conf b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/profile.conf
new file mode 100644
index 0000000..618ff60
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/profile.conf
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+name="profile" parent="pseudo" instance=0;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/sdt_subr.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/sdt_subr.c
new file mode 100644
index 0000000..2421850
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/sdt_subr.c
@@ -0,0 +1,1191 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#include <sys/sdt_impl.h>
+
+static dtrace_pattr_t vtrace_attr = {
+{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pattr_t info_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pattr_t fc_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pattr_t fpu_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_CPU },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pattr_t fsinfo_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pattr_t stab_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pattr_t sdt_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pattr_t xpv_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_PLATFORM },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_PLATFORM },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_PLATFORM },
+};
+
+static dtrace_pattr_t iscsi_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+};
+
+sdt_provider_t sdt_providers[] = {
+	{ "vtrace", "__vtrace_", &vtrace_attr, 0 },
+	{ "sysinfo", "__cpu_sysinfo_", &info_attr, 0 },
+	{ "vminfo", "__cpu_vminfo_", &info_attr, 0 },
+	{ "fpuinfo", "__fpuinfo_", &fpu_attr, 0 },
+	{ "sched", "__sched_", &stab_attr, 0 },
+	{ "proc", "__proc_", &stab_attr, 0 },
+	{ "io", "__io_", &stab_attr, 0 },
+	{ "ip", "__ip_", &stab_attr, 0 },
+	{ "tcp", "__tcp_", &stab_attr, 0 },
+	{ "udp", "__udp_", &stab_attr, 0 },
+	{ "mib", "__mib_", &stab_attr, 0 },
+	{ "fsinfo", "__fsinfo_", &fsinfo_attr, 0 },
+	{ "iscsi", "__iscsi_", &iscsi_attr, 0 },
+	{ "nfsv3", "__nfsv3_", &stab_attr, 0 },
+	{ "nfsv4", "__nfsv4_", &stab_attr, 0 },
+	{ "xpv", "__xpv_", &xpv_attr, 0 },
+	{ "fc", "__fc_", &fc_attr, 0 },
+	{ "srp", "__srp_", &fc_attr, 0 },
+	{ "sysevent", "__sysevent_", &stab_attr, 0 },
+	{ "sdt", NULL, &sdt_attr, 0 },
+	{ NULL }
+};
+
+sdt_argdesc_t sdt_args[] = {
+	{ "sched", "wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "wakeup", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "dequeue", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "dequeue", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "dequeue", 2, 1, "disp_t *", "cpuinfo_t *" },
+	{ "sched", "enqueue", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "enqueue", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "enqueue", 2, 1, "disp_t *", "cpuinfo_t *" },
+	{ "sched", "enqueue", 3, 2, "int" },
+	{ "sched", "off-cpu", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "off-cpu", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "tick", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "tick", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "change-pri", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "change-pri", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "change-pri", 2, 1, "pri_t" },
+	{ "sched", "schedctl-nopreempt", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "schedctl-nopreempt", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "schedctl-nopreempt", 2, 1, "int" },
+	{ "sched", "schedctl-preempt", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "schedctl-preempt", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "schedctl-yield", 0, 0, "int" },
+	{ "sched", "surrender", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "surrender", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "cpucaps-sleep", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "cpucaps-sleep", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "sched", "cpucaps-wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "sched", "cpucaps-wakeup", 1, 0, "kthread_t *", "psinfo_t *" },
+
+	{ "proc", "create", 0, 0, "proc_t *", "psinfo_t *" },
+	{ "proc", "exec", 0, 0, "string" },
+	{ "proc", "exec-failure", 0, 0, "int" },
+	{ "proc", "exit", 0, 0, "int" },
+	{ "proc", "fault", 0, 0, "int" },
+	{ "proc", "fault", 1, 1, "siginfo_t *" },
+	{ "proc", "lwp-create", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "proc", "lwp-create", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "proc", "signal-clear", 0, 0, "int" },
+	{ "proc", "signal-clear", 1, 1, "siginfo_t *" },
+	{ "proc", "signal-discard", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "proc", "signal-discard", 1, 1, "proc_t *", "psinfo_t *" },
+	{ "proc", "signal-discard", 2, 2, "int" },
+	{ "proc", "signal-handle", 0, 0, "int" },
+	{ "proc", "signal-handle", 1, 1, "siginfo_t *" },
+	{ "proc", "signal-handle", 2, 2, "void (*)(void)" },
+	{ "proc", "signal-send", 0, 0, "kthread_t *", "lwpsinfo_t *" },
+	{ "proc", "signal-send", 1, 0, "kthread_t *", "psinfo_t *" },
+	{ "proc", "signal-send", 2, 1, "int" },
+
+	{ "io", "start", 0, 0, "buf_t *", "bufinfo_t *" },
+	{ "io", "start", 1, 0, "buf_t *", "devinfo_t *" },
+	{ "io", "start", 2, 0, "buf_t *", "fileinfo_t *" },
+	{ "io", "done", 0, 0, "buf_t *", "bufinfo_t *" },
+	{ "io", "done", 1, 0, "buf_t *", "devinfo_t *" },
+	{ "io", "done", 2, 0, "buf_t *", "fileinfo_t *" },
+	{ "io", "wait-start", 0, 0, "buf_t *", "bufinfo_t *" },
+	{ "io", "wait-start", 1, 0, "buf_t *", "devinfo_t *" },
+	{ "io", "wait-start", 2, 0, "buf_t *", "fileinfo_t *" },
+	{ "io", "wait-done", 0, 0, "buf_t *", "bufinfo_t *" },
+	{ "io", "wait-done", 1, 0, "buf_t *", "devinfo_t *" },
+	{ "io", "wait-done", 2, 0, "buf_t *", "fileinfo_t *" },
+
+	{ "mib", NULL, 0, 0, "int" },
+
+	{ "fsinfo", NULL, 0, 0, "vnode_t *", "fileinfo_t *" },
+	{ "fsinfo", NULL, 1, 1, "int", "int" },
+
+	{ "iscsi", "async-send", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "async-send", 1, 1, "iscsi_async_evt_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "login-command", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "login-command", 1, 1, "iscsi_login_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "login-response", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "login-response", 1, 1, "iscsi_login_rsp_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "logout-command", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "logout-command", 1, 1, "iscsi_logout_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "logout-response", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "logout-response", 1, 1, "iscsi_logout_rsp_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "data-request", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "data-request", 1, 1, "iscsi_rtt_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "data-send", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "data-send", 1, 1, "iscsi_data_rsp_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "data-receive", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "data-receive", 1, 1, "iscsi_data_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "nop-send", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "nop-send", 1, 1, "iscsi_nop_in_hdr_t *", "iscsiinfo_t *" },
+	{ "iscsi", "nop-receive", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "nop-receive", 1, 1, "iscsi_nop_out_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "scsi-command", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "scsi-command", 1, 1, "iscsi_scsi_cmd_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "scsi-command", 2, 2, "scsi_task_t *", "scsicmd_t *" },
+	{ "iscsi", "scsi-response", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "scsi-response", 1, 1, "iscsi_scsi_rsp_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "task-command", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "task-command", 1, 1, "iscsi_scsi_task_mgt_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "task-response", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "task-response", 1, 1, "iscsi_scsi_task_mgt_rsp_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "text-command", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "text-command", 1, 1, "iscsi_text_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "text-response", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "text-response", 1, 1, "iscsi_text_rsp_hdr_t *",
+	    "iscsiinfo_t *" },
+	{ "iscsi", "xfer-start", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "xfer-start", 1, 0, "idm_conn_t *", "iscsiinfo_t *" },
+	{ "iscsi", "xfer-start", 2, 1, "uintptr_t", "xferinfo_t *" },
+	{ "iscsi", "xfer-start", 3, 2, "uint32_t"},
+	{ "iscsi", "xfer-start", 4, 3, "uintptr_t"},
+	{ "iscsi", "xfer-start", 5, 4, "uint32_t"},
+	{ "iscsi", "xfer-start", 6, 5, "uint32_t"},
+	{ "iscsi", "xfer-start", 7, 6, "uint32_t"},
+	{ "iscsi", "xfer-start", 8, 7, "int"},
+	{ "iscsi", "xfer-done", 0, 0, "idm_conn_t *", "conninfo_t *" },
+	{ "iscsi", "xfer-done", 1, 0, "idm_conn_t *", "iscsiinfo_t *" },
+	{ "iscsi", "xfer-done", 2, 1, "uintptr_t", "xferinfo_t *" },
+	{ "iscsi", "xfer-done", 3, 2, "uint32_t"},
+	{ "iscsi", "xfer-done", 4, 3, "uintptr_t"},
+	{ "iscsi", "xfer-done", 5, 4, "uint32_t"},
+	{ "iscsi", "xfer-done", 6, 5, "uint32_t"},
+	{ "iscsi", "xfer-done", 7, 6, "uint32_t"},
+	{ "iscsi", "xfer-done", 8, 7, "int"},
+
+	{ "nfsv3", "op-getattr-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-getattr-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-getattr-start", 2, 3, "GETATTR3args *" },
+	{ "nfsv3", "op-getattr-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-getattr-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-getattr-done", 2, 3, "GETATTR3res *" },
+	{ "nfsv3", "op-setattr-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-setattr-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-setattr-start", 2, 3, "SETATTR3args *" },
+	{ "nfsv3", "op-setattr-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-setattr-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-setattr-done", 2, 3, "SETATTR3res *" },
+	{ "nfsv3", "op-lookup-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-lookup-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-lookup-start", 2, 3, "LOOKUP3args *" },
+	{ "nfsv3", "op-lookup-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-lookup-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-lookup-done", 2, 3, "LOOKUP3res *" },
+	{ "nfsv3", "op-access-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-access-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-access-start", 2, 3, "ACCESS3args *" },
+	{ "nfsv3", "op-access-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-access-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-access-done", 2, 3, "ACCESS3res *" },
+	{ "nfsv3", "op-commit-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-commit-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-commit-start", 2, 3, "COMMIT3args *" },
+	{ "nfsv3", "op-commit-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-commit-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-commit-done", 2, 3, "COMMIT3res *" },
+	{ "nfsv3", "op-create-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-create-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-create-start", 2, 3, "CREATE3args *" },
+	{ "nfsv3", "op-create-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-create-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-create-done", 2, 3, "CREATE3res *" },
+	{ "nfsv3", "op-fsinfo-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-fsinfo-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-fsinfo-start", 2, 3, "FSINFO3args *" },
+	{ "nfsv3", "op-fsinfo-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-fsinfo-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-fsinfo-done", 2, 3, "FSINFO3res *" },
+	{ "nfsv3", "op-fsstat-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-fsstat-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-fsstat-start", 2, 3, "FSSTAT3args *" },
+	{ "nfsv3", "op-fsstat-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-fsstat-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-fsstat-done", 2, 3, "FSSTAT3res *" },
+	{ "nfsv3", "op-link-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-link-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-link-start", 2, 3, "LINK3args *" },
+	{ "nfsv3", "op-link-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-link-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-link-done", 2, 3, "LINK3res *" },
+	{ "nfsv3", "op-mkdir-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-mkdir-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-mkdir-start", 2, 3, "MKDIR3args *" },
+	{ "nfsv3", "op-mkdir-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-mkdir-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-mkdir-done", 2, 3, "MKDIR3res *" },
+	{ "nfsv3", "op-mknod-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-mknod-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-mknod-start", 2, 3, "MKNOD3args *" },
+	{ "nfsv3", "op-mknod-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-mknod-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-mknod-done", 2, 3, "MKNOD3res *" },
+	{ "nfsv3", "op-null-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-null-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-null-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-null-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-pathconf-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-pathconf-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-pathconf-start", 2, 3, "PATHCONF3args *" },
+	{ "nfsv3", "op-pathconf-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-pathconf-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-pathconf-done", 2, 3, "PATHCONF3res *" },
+	{ "nfsv3", "op-read-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-read-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-read-start", 2, 3, "READ3args *" },
+	{ "nfsv3", "op-read-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-read-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-read-done", 2, 3, "READ3res *" },
+	{ "nfsv3", "op-readdir-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-readdir-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-readdir-start", 2, 3, "READDIR3args *" },
+	{ "nfsv3", "op-readdir-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-readdir-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-readdir-done", 2, 3, "READDIR3res *" },
+	{ "nfsv3", "op-readdirplus-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-readdirplus-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-readdirplus-start", 2, 3, "READDIRPLUS3args *" },
+	{ "nfsv3", "op-readdirplus-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-readdirplus-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-readdirplus-done", 2, 3, "READDIRPLUS3res *" },
+	{ "nfsv3", "op-readlink-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-readlink-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-readlink-start", 2, 3, "READLINK3args *" },
+	{ "nfsv3", "op-readlink-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-readlink-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-readlink-done", 2, 3, "READLINK3res *" },
+	{ "nfsv3", "op-remove-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-remove-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-remove-start", 2, 3, "REMOVE3args *" },
+	{ "nfsv3", "op-remove-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-remove-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-remove-done", 2, 3, "REMOVE3res *" },
+	{ "nfsv3", "op-rename-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-rename-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-rename-start", 2, 3, "RENAME3args *" },
+	{ "nfsv3", "op-rename-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-rename-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-rename-done", 2, 3, "RENAME3res *" },
+	{ "nfsv3", "op-rmdir-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-rmdir-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-rmdir-start", 2, 3, "RMDIR3args *" },
+	{ "nfsv3", "op-rmdir-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-rmdir-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-rmdir-done", 2, 3, "RMDIR3res *" },
+	{ "nfsv3", "op-setattr-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-setattr-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-setattr-start", 2, 3, "SETATTR3args *" },
+	{ "nfsv3", "op-setattr-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-setattr-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-setattr-done", 2, 3, "SETATTR3res *" },
+	{ "nfsv3", "op-symlink-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-symlink-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-symlink-start", 2, 3, "SYMLINK3args *" },
+	{ "nfsv3", "op-symlink-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-symlink-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-symlink-done", 2, 3, "SYMLINK3res *" },
+	{ "nfsv3", "op-write-start", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-write-start", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-write-start", 2, 3, "WRITE3args *" },
+	{ "nfsv3", "op-write-done", 0, 0, "struct svc_req *",
+	    "conninfo_t *" },
+	{ "nfsv3", "op-write-done", 1, 1, "nfsv3oparg_t *",
+	    "nfsv3opinfo_t *" },
+	{ "nfsv3", "op-write-done", 2, 3, "WRITE3res *" },
+
+	{ "nfsv4", "null-start", 0, 0, "struct svc_req *", "conninfo_t *" },
+	{ "nfsv4", "null-done", 0, 0, "struct svc_req *", "conninfo_t *" },
+	{ "nfsv4", "compound-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "compound-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "compound-start", 2, 1, "COMPOUND4args *" },
+	{ "nfsv4", "compound-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "compound-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "compound-done", 2, 1, "COMPOUND4res *" },
+	{ "nfsv4", "op-access-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *"},
+	{ "nfsv4", "op-access-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-access-start", 2, 1, "ACCESS4args *" },
+	{ "nfsv4", "op-access-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-access-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-access-done", 2, 1, "ACCESS4res *" },
+	{ "nfsv4", "op-close-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-close-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-close-start", 2, 1, "CLOSE4args *" },
+	{ "nfsv4", "op-close-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-close-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-close-done", 2, 1, "CLOSE4res *" },
+	{ "nfsv4", "op-commit-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-commit-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-commit-start", 2, 1, "COMMIT4args *" },
+	{ "nfsv4", "op-commit-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-commit-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-commit-done", 2, 1, "COMMIT4res *" },
+	{ "nfsv4", "op-create-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-create-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-create-start", 2, 1, "CREATE4args *" },
+	{ "nfsv4", "op-create-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-create-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-create-done", 2, 1, "CREATE4res *" },
+	{ "nfsv4", "op-delegpurge-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-delegpurge-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-delegpurge-start", 2, 1, "DELEGPURGE4args *" },
+	{ "nfsv4", "op-delegpurge-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-delegpurge-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-delegpurge-done", 2, 1, "DELEGPURGE4res *" },
+	{ "nfsv4", "op-delegreturn-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-delegreturn-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-delegreturn-start", 2, 1, "DELEGRETURN4args *" },
+	{ "nfsv4", "op-delegreturn-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-delegreturn-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-delegreturn-done", 2, 1, "DELEGRETURN4res *" },
+	{ "nfsv4", "op-getattr-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-getattr-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-getattr-start", 2, 1, "GETATTR4args *" },
+	{ "nfsv4", "op-getattr-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-getattr-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-getattr-done", 2, 1, "GETATTR4res *" },
+	{ "nfsv4", "op-getfh-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-getfh-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-getfh-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-getfh-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-getfh-done", 2, 1, "GETFH4res *" },
+	{ "nfsv4", "op-link-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-link-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-link-start", 2, 1, "LINK4args *" },
+	{ "nfsv4", "op-link-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-link-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-link-done", 2, 1, "LINK4res *" },
+	{ "nfsv4", "op-lock-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-lock-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-lock-start", 2, 1, "LOCK4args *" },
+	{ "nfsv4", "op-lock-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-lock-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-lock-done", 2, 1, "LOCK4res *" },
+	{ "nfsv4", "op-lockt-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-lockt-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-lockt-start", 2, 1, "LOCKT4args *" },
+	{ "nfsv4", "op-lockt-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-lockt-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-lockt-done", 2, 1, "LOCKT4res *" },
+	{ "nfsv4", "op-locku-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-locku-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-locku-start", 2, 1, "LOCKU4args *" },
+	{ "nfsv4", "op-locku-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-locku-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-locku-done", 2, 1, "LOCKU4res *" },
+	{ "nfsv4", "op-lookup-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-lookup-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-lookup-start", 2, 1, "LOOKUP4args *" },
+	{ "nfsv4", "op-lookup-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-lookup-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-lookup-done", 2, 1, "LOOKUP4res *" },
+	{ "nfsv4", "op-lookupp-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-lookupp-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-lookupp-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-lookupp-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-lookupp-done", 2, 1, "LOOKUPP4res *" },
+	{ "nfsv4", "op-nverify-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-nverify-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-nverify-start", 2, 1, "NVERIFY4args *" },
+	{ "nfsv4", "op-nverify-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-nverify-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-nverify-done", 2, 1, "NVERIFY4res *" },
+	{ "nfsv4", "op-open-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-open-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-open-start", 2, 1, "OPEN4args *" },
+	{ "nfsv4", "op-open-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-open-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-open-done", 2, 1, "OPEN4res *" },
+	{ "nfsv4", "op-open-confirm-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-open-confirm-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-open-confirm-start", 2, 1, "OPEN_CONFIRM4args *" },
+	{ "nfsv4", "op-open-confirm-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-open-confirm-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-open-confirm-done", 2, 1, "OPEN_CONFIRM4res *" },
+	{ "nfsv4", "op-open-downgrade-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-open-downgrade-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-open-downgrade-start", 2, 1, "OPEN_DOWNGRADE4args *" },
+	{ "nfsv4", "op-open-downgrade-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-open-downgrade-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-open-downgrade-done", 2, 1, "OPEN_DOWNGRADE4res *" },
+	{ "nfsv4", "op-openattr-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-openattr-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-openattr-start", 2, 1, "OPENATTR4args *" },
+	{ "nfsv4", "op-openattr-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-openattr-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-openattr-done", 2, 1, "OPENATTR4res *" },
+	{ "nfsv4", "op-putfh-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-putfh-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-putfh-start", 2, 1, "PUTFH4args *" },
+	{ "nfsv4", "op-putfh-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-putfh-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-putfh-done", 2, 1, "PUTFH4res *" },
+	{ "nfsv4", "op-putpubfh-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-putpubfh-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-putpubfh-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-putpubfh-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-putpubfh-done", 2, 1, "PUTPUBFH4res *" },
+	{ "nfsv4", "op-putrootfh-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-putrootfh-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-putrootfh-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-putrootfh-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-putrootfh-done", 2, 1, "PUTROOTFH4res *" },
+	{ "nfsv4", "op-read-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-read-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-read-start", 2, 1, "READ4args *" },
+	{ "nfsv4", "op-read-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-read-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-read-done", 2, 1, "READ4res *" },
+	{ "nfsv4", "op-readdir-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-readdir-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-readdir-start", 2, 1, "READDIR4args *" },
+	{ "nfsv4", "op-readdir-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-readdir-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-readdir-done", 2, 1, "READDIR4res *" },
+	{ "nfsv4", "op-readlink-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-readlink-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-readlink-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-readlink-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-readlink-done", 2, 1, "READLINK4res *" },
+	{ "nfsv4", "op-release-lockowner-start", 0, 0,
+	    "struct compound_state *", "conninfo_t *" },
+	{ "nfsv4", "op-release-lockowner-start", 1, 0,
+	    "struct compound_state *", "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-release-lockowner-start", 2, 1,
+	    "RELEASE_LOCKOWNER4args *" },
+	{ "nfsv4", "op-release-lockowner-done", 0, 0,
+	    "struct compound_state *", "conninfo_t *" },
+	{ "nfsv4", "op-release-lockowner-done", 1, 0,
+	    "struct compound_state *", "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-release-lockowner-done", 2, 1,
+	    "RELEASE_LOCKOWNER4res *" },
+	{ "nfsv4", "op-remove-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-remove-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-remove-start", 2, 1, "REMOVE4args *" },
+	{ "nfsv4", "op-remove-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-remove-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-remove-done", 2, 1, "REMOVE4res *" },
+	{ "nfsv4", "op-rename-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-rename-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-rename-start", 2, 1, "RENAME4args *" },
+	{ "nfsv4", "op-rename-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-rename-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-rename-done", 2, 1, "RENAME4res *" },
+	{ "nfsv4", "op-renew-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-renew-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-renew-start", 2, 1, "RENEW4args *" },
+	{ "nfsv4", "op-renew-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-renew-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-renew-done", 2, 1, "RENEW4res *" },
+	{ "nfsv4", "op-restorefh-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-restorefh-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-restorefh-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-restorefh-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-restorefh-done", 2, 1, "RESTOREFH4res *" },
+	{ "nfsv4", "op-savefh-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-savefh-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-savefh-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-savefh-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-savefh-done", 2, 1, "SAVEFH4res *" },
+	{ "nfsv4", "op-secinfo-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-secinfo-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-secinfo-start", 2, 1, "SECINFO4args *" },
+	{ "nfsv4", "op-secinfo-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-secinfo-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-secinfo-done", 2, 1, "SECINFO4res *" },
+	{ "nfsv4", "op-setattr-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-setattr-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-setattr-start", 2, 1, "SETATTR4args *" },
+	{ "nfsv4", "op-setattr-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-setattr-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-setattr-done", 2, 1, "SETATTR4res *" },
+	{ "nfsv4", "op-setclientid-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-setclientid-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-setclientid-start", 2, 1, "SETCLIENTID4args *" },
+	{ "nfsv4", "op-setclientid-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-setclientid-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-setclientid-done", 2, 1, "SETCLIENTID4res *" },
+	{ "nfsv4", "op-setclientid-confirm-start", 0, 0,
+	    "struct compound_state *", "conninfo_t *" },
+	{ "nfsv4", "op-setclientid-confirm-start", 1, 0,
+	    "struct compound_state *", "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-setclientid-confirm-start", 2, 1,
+	    "SETCLIENTID_CONFIRM4args *" },
+	{ "nfsv4", "op-setclientid-confirm-done", 0, 0,
+	    "struct compound_state *", "conninfo_t *" },
+	{ "nfsv4", "op-setclientid-confirm-done", 1, 0,
+	    "struct compound_state *", "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-setclientid-confirm-done", 2, 1,
+	    "SETCLIENTID_CONFIRM4res *" },
+	{ "nfsv4", "op-verify-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-verify-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-verify-start", 2, 1, "VERIFY4args *" },
+	{ "nfsv4", "op-verify-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-verify-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-verify-done", 2, 1, "VERIFY4res *" },
+	{ "nfsv4", "op-write-start", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-write-start", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-write-start", 2, 1, "WRITE4args *" },
+	{ "nfsv4", "op-write-done", 0, 0, "struct compound_state *",
+	    "conninfo_t *" },
+	{ "nfsv4", "op-write-done", 1, 0, "struct compound_state *",
+	    "nfsv4opinfo_t *" },
+	{ "nfsv4", "op-write-done", 2, 1, "WRITE4res *" },
+	{ "nfsv4", "cb-recall-start", 0, 0, "rfs4_client_t *",
+	    "conninfo_t *" },
+	{ "nfsv4", "cb-recall-start", 1, 1, "rfs4_deleg_state_t *",
+	    "nfsv4cbinfo_t *" },
+	{ "nfsv4", "cb-recall-start", 2, 2, "CB_RECALL4args *" },
+	{ "nfsv4", "cb-recall-done", 0, 0, "rfs4_client_t *",
+	    "conninfo_t *" },
+	{ "nfsv4", "cb-recall-done", 1, 1, "rfs4_deleg_state_t *",
+	    "nfsv4cbinfo_t *" },
+	{ "nfsv4", "cb-recall-done", 2, 2, "CB_RECALL4res *" },
+
+	{ "ip", "send", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "ip", "send", 1, 1, "conn_t *", "csinfo_t *" },
+	{ "ip", "send", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "ip", "send", 3, 3, "__dtrace_ipsr_ill_t *", "ifinfo_t *" },
+	{ "ip", "send", 4, 4, "ipha_t *", "ipv4info_t *" },
+	{ "ip", "send", 5, 5, "ip6_t *", "ipv6info_t *" },
+	{ "ip", "send", 6, 6, "int" }, /* used by __dtrace_ipsr_ill_t */
+	{ "ip", "receive", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "ip", "receive", 1, 1, "conn_t *", "csinfo_t *" },
+	{ "ip", "receive", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "ip", "receive", 3, 3, "__dtrace_ipsr_ill_t *", "ifinfo_t *" },
+	{ "ip", "receive", 4, 4, "ipha_t *", "ipv4info_t *" },
+	{ "ip", "receive", 5, 5, "ip6_t *", "ipv6info_t *" },
+	{ "ip", "receive", 6, 6, "int" }, /* used by __dtrace_ipsr_ill_t */
+
+	{ "tcp", "connect-established", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "tcp", "connect-established", 1, 1, "ip_xmit_attr_t *",
+	    "csinfo_t *" },
+	{ "tcp", "connect-established", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "tcp", "connect-established", 3, 3, "tcp_t *", "tcpsinfo_t *" },
+	{ "tcp", "connect-established", 4, 4, "tcph_t *", "tcpinfo_t *" },
+	{ "tcp", "connect-refused", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "tcp", "connect-refused", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "tcp", "connect-refused", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "tcp", "connect-refused", 3, 3, "tcp_t *", "tcpsinfo_t *" },
+	{ "tcp", "connect-refused", 4, 4, "tcph_t *", "tcpinfo_t *" },
+	{ "tcp", "connect-request", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "tcp", "connect-request", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "tcp", "connect-request", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "tcp", "connect-request", 3, 3, "tcp_t *", "tcpsinfo_t *" },
+	{ "tcp", "connect-request", 4, 4, "tcph_t *", "tcpinfo_t *" },
+	{ "tcp", "accept-established", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "tcp", "accept-established", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "tcp", "accept-established", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "tcp", "accept-established", 3, 3, "tcp_t *", "tcpsinfo_t *" },
+	{ "tcp", "accept-established", 4, 4, "tcph_t *", "tcpinfo_t *" },
+	{ "tcp", "accept-refused", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "tcp", "accept-refused", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "tcp", "accept-refused", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "tcp", "accept-refused", 3, 3, "tcp_t *", "tcpsinfo_t *" },
+	{ "tcp", "accept-refused", 4, 4, "tcph_t *", "tcpinfo_t *" },
+	{ "tcp", "state-change", 0, 0, "void", "void" },
+	{ "tcp", "state-change", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "tcp", "state-change", 2, 2, "void", "void" },
+	{ "tcp", "state-change", 3, 3, "tcp_t *", "tcpsinfo_t *" },
+	{ "tcp", "state-change", 4, 4, "void", "void" },
+	{ "tcp", "state-change", 5, 5, "int32_t", "tcplsinfo_t *" },
+	{ "tcp", "send", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "tcp", "send", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "tcp", "send", 2, 2, "__dtrace_tcp_void_ip_t *", "ipinfo_t *" },
+	{ "tcp", "send", 3, 3, "tcp_t *", "tcpsinfo_t *" },
+	{ "tcp", "send", 4, 4, "__dtrace_tcp_tcph_t *", "tcpinfo_t *" },
+	{ "tcp", "receive", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "tcp", "receive", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "tcp", "receive", 2, 2, "__dtrace_tcp_void_ip_t *", "ipinfo_t *" },
+	{ "tcp", "receive", 3, 3, "tcp_t *", "tcpsinfo_t *" },
+	{ "tcp", "receive", 4, 4, "__dtrace_tcp_tcph_t *", "tcpinfo_t *" },
+
+	{ "udp", "send", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "udp", "send", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "udp", "send", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "udp", "send", 3, 3, "udp_t *", "udpsinfo_t *" },
+	{ "udp", "send", 4, 4, "udpha_t *", "udpinfo_t *" },
+	{ "udp", "receive", 0, 0, "mblk_t *", "pktinfo_t *" },
+	{ "udp", "receive", 1, 1, "ip_xmit_attr_t *", "csinfo_t *" },
+	{ "udp", "receive", 2, 2, "void_ip_t *", "ipinfo_t *" },
+	{ "udp", "receive", 3, 3, "udp_t *", "udpsinfo_t *" },
+	{ "udp", "receive", 4, 4, "udpha_t *", "udpinfo_t *" },
+
+	{ "sysevent", "post", 0, 0, "evch_bind_t *", "syseventchaninfo_t *" },
+	{ "sysevent", "post", 1, 1, "sysevent_impl_t *", "syseventinfo_t *" },
+
+	{ "xpv", "add-to-physmap-end", 0, 0, "int" },
+	{ "xpv", "add-to-physmap-start", 0, 0, "domid_t" },
+	{ "xpv", "add-to-physmap-start", 1, 1, "uint_t" },
+	{ "xpv", "add-to-physmap-start", 2, 2, "ulong_t" },
+	{ "xpv", "add-to-physmap-start", 3, 3, "ulong_t" },
+	{ "xpv", "decrease-reservation-end", 0, 0, "int" },
+	{ "xpv", "decrease-reservation-start", 0, 0, "domid_t" },
+	{ "xpv", "decrease-reservation-start", 1, 1, "ulong_t" },
+	{ "xpv", "decrease-reservation-start", 2, 2, "uint_t" },
+	{ "xpv", "decrease-reservation-start", 3, 3, "ulong_t *" },
+	{ "xpv", "dom-create-start", 0, 0, "xen_domctl_t *" },
+	{ "xpv", "dom-destroy-start", 0, 0, "domid_t" },
+	{ "xpv", "dom-pause-start", 0, 0, "domid_t" },
+	{ "xpv", "dom-unpause-start", 0, 0, "domid_t" },
+	{ "xpv", "dom-create-end", 0, 0, "int" },
+	{ "xpv", "dom-destroy-end", 0, 0, "int" },
+	{ "xpv", "dom-pause-end", 0, 0, "int" },
+	{ "xpv", "dom-unpause-end", 0, 0, "int" },
+	{ "xpv", "evtchn-op-end", 0, 0, "int" },
+	{ "xpv", "evtchn-op-start", 0, 0, "int" },
+	{ "xpv", "evtchn-op-start", 1, 1, "void *" },
+	{ "xpv", "increase-reservation-end", 0, 0, "int" },
+	{ "xpv", "increase-reservation-start", 0, 0, "domid_t" },
+	{ "xpv", "increase-reservation-start", 1, 1, "ulong_t" },
+	{ "xpv", "increase-reservation-start", 2, 2, "uint_t" },
+	{ "xpv", "increase-reservation-start", 3, 3, "ulong_t *" },
+	{ "xpv", "mmap-end", 0, 0, "int" },
+	{ "xpv", "mmap-entry", 0, 0, "ulong_t" },
+	{ "xpv", "mmap-entry", 1, 1, "ulong_t" },
+	{ "xpv", "mmap-entry", 2, 2, "ulong_t" },
+	{ "xpv", "mmap-start", 0, 0, "domid_t" },
+	{ "xpv", "mmap-start", 1, 1, "int" },
+	{ "xpv", "mmap-start", 2, 2, "privcmd_mmap_entry_t *" },
+	{ "xpv", "mmapbatch-end", 0, 0, "int" },
+	{ "xpv", "mmapbatch-end", 1, 1, "struct seg *" },
+	{ "xpv", "mmapbatch-end", 2, 2, "caddr_t" },
+	{ "xpv", "mmapbatch-start", 0, 0, "domid_t" },
+	{ "xpv", "mmapbatch-start", 1, 1, "int" },
+	{ "xpv", "mmapbatch-start", 2, 2, "caddr_t" },
+	{ "xpv", "mmu-ext-op-end", 0, 0, "int" },
+	{ "xpv", "mmu-ext-op-start", 0, 0, "int" },
+	{ "xpv", "mmu-ext-op-start", 1, 1, "struct mmuext_op *" },
+	{ "xpv", "mmu-update-start", 0, 0, "int" },
+	{ "xpv", "mmu-update-start", 1, 1, "int" },
+	{ "xpv", "mmu-update-start", 2, 2, "mmu_update_t *" },
+	{ "xpv", "mmu-update-end", 0, 0, "int" },
+	{ "xpv", "populate-physmap-end", 0, 0, "int" },
+	{ "xpv", "populate-physmap-start", 0, 0, "domid_t" },
+	{ "xpv", "populate-physmap-start", 1, 1, "ulong_t" },
+	{ "xpv", "populate-physmap-start", 2, 2, "ulong_t *" },
+	{ "xpv", "set-memory-map-end", 0, 0, "int" },
+	{ "xpv", "set-memory-map-start", 0, 0, "domid_t" },
+	{ "xpv", "set-memory-map-start", 1, 1, "int" },
+	{ "xpv", "set-memory-map-start", 2, 2, "struct xen_memory_map *" },
+	{ "xpv", "setvcpucontext-end", 0, 0, "int" },
+	{ "xpv", "setvcpucontext-start", 0, 0, "domid_t" },
+	{ "xpv", "setvcpucontext-start", 1, 1, "vcpu_guest_context_t *" },
+
+	{ "srp", "service-up", 0, 0, "srpt_session_t *", "conninfo_t *" },
+	{ "srp", "service-up", 1, 0, "srpt_session_t *", "srp_portinfo_t *" },
+	{ "srp", "service-down", 0, 0, "srpt_session_t *", "conninfo_t *" },
+	{ "srp", "service-down", 1, 0, "srpt_session_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "login-command", 0, 0, "srpt_session_t *", "conninfo_t *" },
+	{ "srp", "login-command", 1, 0, "srpt_session_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "login-command", 2, 1, "srp_login_req_t *",
+	    "srp_logininfo_t *" },
+	{ "srp", "login-response", 0, 0, "srpt_session_t *", "conninfo_t *" },
+	{ "srp", "login-response", 1, 0, "srpt_session_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "login-response", 2, 1, "srp_login_rsp_t *",
+	    "srp_logininfo_t *" },
+	{ "srp", "login-response", 3, 2, "srp_login_rej_t *" },
+	{ "srp", "logout-command", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "logout-command", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "task-command", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "task-command", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "task-command", 2, 1, "srp_cmd_req_t *", "srp_taskinfo_t *" },
+	{ "srp", "task-response", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "task-response", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "task-response", 2, 1, "srp_rsp_t *", "srp_taskinfo_t *" },
+	{ "srp", "task-response", 3, 2, "scsi_task_t *" },
+	{ "srp", "task-response", 4, 3, "int8_t" },
+	{ "srp", "scsi-command", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "scsi-command", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "scsi-command", 2, 1, "scsi_task_t *", "scsicmd_t *" },
+	{ "srp", "scsi-command", 3, 2, "srp_cmd_req_t *", "srp_taskinfo_t *" },
+	{ "srp", "scsi-response", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "scsi-response", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "scsi-response", 2, 1, "srp_rsp_t *", "srp_taskinfo_t *" },
+	{ "srp", "scsi-response", 3, 2, "scsi_task_t *" },
+	{ "srp", "scsi-response", 4, 3, "int8_t" },
+	{ "srp", "xfer-start", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "xfer-start", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "xfer-start", 2, 1, "ibt_wr_ds_t *", "xferinfo_t *" },
+	{ "srp", "xfer-start", 3, 2, "srpt_iu_t *", "srp_taskinfo_t *" },
+	{ "srp", "xfer-start", 4, 3, "ibt_send_wr_t *"},
+	{ "srp", "xfer-start", 5, 4, "uint32_t" },
+	{ "srp", "xfer-start", 6, 5, "uint32_t" },
+	{ "srp", "xfer-start", 7, 6, "uint32_t" },
+	{ "srp", "xfer-start", 8, 7, "uint32_t" },
+	{ "srp", "xfer-done", 0, 0, "srpt_channel_t *", "conninfo_t *" },
+	{ "srp", "xfer-done", 1, 0, "srpt_channel_t *",
+	    "srp_portinfo_t *" },
+	{ "srp", "xfer-done", 2, 1, "ibt_wr_ds_t *", "xferinfo_t *" },
+	{ "srp", "xfer-done", 3, 2, "srpt_iu_t *", "srp_taskinfo_t *" },
+	{ "srp", "xfer-done", 4, 3, "ibt_send_wr_t *"},
+	{ "srp", "xfer-done", 5, 4, "uint32_t" },
+	{ "srp", "xfer-done", 6, 5, "uint32_t" },
+	{ "srp", "xfer-done", 7, 6, "uint32_t" },
+	{ "srp", "xfer-done", 8, 7, "uint32_t" },
+
+	{ "fc", "link-up",   0, 0, "fct_i_local_port_t *", "conninfo_t *" },
+	{ "fc", "link-down", 0, 0, "fct_i_local_port_t *", "conninfo_t *" },
+	{ "fc", "fabric-login-start", 0, 0, "fct_i_local_port_t *",
+	    "conninfo_t *" },
+	{ "fc", "fabric-login-start", 1, 0, "fct_i_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "fabric-login-end", 0, 0, "fct_i_local_port_t *",
+	    "conninfo_t *" },
+	{ "fc", "fabric-login-end", 1, 0, "fct_i_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-login-start", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "rport-login-start", 1, 1, "fct_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-login-start", 2, 2, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-login-start", 3, 3, "int", "int" },
+	{ "fc", "rport-login-end", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "rport-login-end", 1, 1, "fct_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-login-end", 2, 2, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-login-end", 3, 3, "int", "int" },
+	{ "fc", "rport-login-end", 4, 4, "int", "int" },
+	{ "fc", "rport-logout-start", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "rport-logout-start", 1, 1, "fct_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-logout-start", 2, 2, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-logout-start", 3, 3, "int", "int" },
+	{ "fc", "rport-logout-end", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "rport-logout-end", 1, 1, "fct_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-logout-end", 2, 2, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "rport-logout-end", 3, 3, "int", "int" },
+	{ "fc", "scsi-command", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "scsi-command", 1, 1, "fct_i_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "scsi-command", 2, 2, "scsi_task_t *",
+	    "scsicmd_t *" },
+	{ "fc", "scsi-command", 3, 3, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "scsi-response", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "scsi-response", 1, 1, "fct_i_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "scsi-response", 2, 2, "scsi_task_t *",
+	    "scsicmd_t *" },
+	{ "fc", "scsi-response", 3, 3, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "xfer-start", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "xfer-start", 1, 1, "fct_i_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "xfer-start", 2, 2, "scsi_task_t *",
+	    "scsicmd_t *" },
+	{ "fc", "xfer-start", 3, 3, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "xfer-start", 4, 4, "stmf_data_buf_t *",
+	    "fc_xferinfo_t *" },
+	{ "fc", "xfer-done", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "xfer-done", 1, 1, "fct_i_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "xfer-done", 2, 2, "scsi_task_t *",
+	    "scsicmd_t *" },
+	{ "fc", "xfer-done", 3, 3, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "xfer-done", 4, 4, "stmf_data_buf_t *",
+	    "fc_xferinfo_t *" },
+	{ "fc", "rscn-receive", 0, 0, "fct_i_local_port_t *",
+	    "conninfo_t *" },
+	{ "fc", "rscn-receive", 1, 1, "int", "int"},
+	{ "fc", "abts-receive", 0, 0, "fct_cmd_t *",
+	    "conninfo_t *" },
+	{ "fc", "abts-receive", 1, 1, "fct_i_local_port_t *",
+	    "fc_port_info_t *" },
+	{ "fc", "abts-receive", 2, 2, "fct_i_remote_port_t *",
+	    "fc_port_info_t *" },
+
+
+	{ NULL }
+};
+
+/*ARGSUSED*/
+void
+sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc)
+{
+	sdt_probe_t *sdp = parg;
+	int i;
+
+	desc->dtargd_native[0] = '\0';
+	desc->dtargd_xlate[0] = '\0';
+
+	for (i = 0; sdt_args[i].sda_provider != NULL; i++) {
+		sdt_argdesc_t *a = &sdt_args[i];
+
+		if (strcmp(sdp->sdp_provider->sdtp_name, a->sda_provider) != 0)
+			continue;
+
+		if (a->sda_name != NULL &&
+		    strcmp(sdp->sdp_name, a->sda_name) != 0)
+			continue;
+
+		if (desc->dtargd_ndx != a->sda_ndx)
+			continue;
+
+		if (a->sda_native != NULL)
+			(void) strcpy(desc->dtargd_native, a->sda_native);
+
+		if (a->sda_xlate != NULL)
+			(void) strcpy(desc->dtargd_xlate, a->sda_xlate);
+
+		desc->dtargd_mapping = a->sda_mapping;
+		return;
+	}
+
+	desc->dtargd_ndx = DTRACE_ARGNONE;
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/systrace.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/systrace.c
new file mode 100644
index 0000000..b864041
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/systrace.c
@@ -0,0 +1,374 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#include <sys/dtrace.h>
+#include <sys/systrace.h>
+#include <sys/stat.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/atomic.h>
+
+#define	SYSTRACE_ARTIFICIAL_FRAMES	1
+
+#define	SYSTRACE_SHIFT			16
+#define	SYSTRACE_ISENTRY(x)		((int)(x) >> SYSTRACE_SHIFT)
+#define	SYSTRACE_SYSNUM(x)		((int)(x) & ((1 << SYSTRACE_SHIFT) - 1))
+#define	SYSTRACE_ENTRY(id)		((1 << SYSTRACE_SHIFT) | (id))
+#define	SYSTRACE_RETURN(id)		(id)
+
+#if ((1 << SYSTRACE_SHIFT) <= NSYSCALL)
+#error 1 << SYSTRACE_SHIFT must exceed number of system calls
+#endif
+
+static dev_info_t *systrace_devi;
+static dtrace_provider_id_t systrace_id;
+
+static void
+systrace_init(struct sysent *actual, systrace_sysent_t **interposed)
+{
+	systrace_sysent_t *sysent = *interposed;
+	int i;
+
+	if (sysent == NULL) {
+		*interposed = sysent = kmem_zalloc(sizeof (systrace_sysent_t) *
+		    NSYSCALL, KM_SLEEP);
+	}
+
+	for (i = 0; i < NSYSCALL; i++) {
+		struct sysent *a = &actual[i];
+		systrace_sysent_t *s = &sysent[i];
+
+		if (LOADABLE_SYSCALL(a) && !LOADED_SYSCALL(a))
+			continue;
+
+		if (a->sy_callc == dtrace_systrace_syscall)
+			continue;
+
+#ifdef _SYSCALL32_IMPL
+		if (a->sy_callc == dtrace_systrace_syscall32)
+			continue;
+#endif
+
+		s->stsy_underlying = a->sy_callc;
+	}
+}
+
+/*ARGSUSED*/
+static void
+systrace_provide(void *arg, const dtrace_probedesc_t *desc)
+{
+	int i;
+
+	if (desc != NULL)
+		return;
+
+	systrace_init(sysent, &systrace_sysent);
+#ifdef _SYSCALL32_IMPL
+	systrace_init(sysent32, &systrace_sysent32);
+#endif
+
+	for (i = 0; i < NSYSCALL; i++) {
+		if (systrace_sysent[i].stsy_underlying == NULL)
+			continue;
+
+		if (dtrace_probe_lookup(systrace_id, NULL,
+		    syscallnames[i], "entry") != 0)
+			continue;
+
+		(void) dtrace_probe_create(systrace_id, NULL, syscallnames[i],
+		    "entry", SYSTRACE_ARTIFICIAL_FRAMES,
+		    (void *)((uintptr_t)SYSTRACE_ENTRY(i)));
+		(void) dtrace_probe_create(systrace_id, NULL, syscallnames[i],
+		    "return", SYSTRACE_ARTIFICIAL_FRAMES,
+		    (void *)((uintptr_t)SYSTRACE_RETURN(i)));
+
+		systrace_sysent[i].stsy_entry = DTRACE_IDNONE;
+		systrace_sysent[i].stsy_return = DTRACE_IDNONE;
+#ifdef _SYSCALL32_IMPL
+		systrace_sysent32[i].stsy_entry = DTRACE_IDNONE;
+		systrace_sysent32[i].stsy_return = DTRACE_IDNONE;
+#endif
+	}
+}
+
+/*ARGSUSED*/
+static void
+systrace_destroy(void *arg, dtrace_id_t id, void *parg)
+{
+	int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg);
+
+	/*
+	 * There's nothing to do here but assert that we have actually been
+	 * disabled.
+	 */
+	if (SYSTRACE_ISENTRY((uintptr_t)parg)) {
+		ASSERT(systrace_sysent[sysnum].stsy_entry == DTRACE_IDNONE);
+#ifdef _SYSCALL32_IMPL
+		ASSERT(systrace_sysent32[sysnum].stsy_entry == DTRACE_IDNONE);
+#endif
+	} else {
+		ASSERT(systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE);
+#ifdef _SYSCALL32_IMPL
+		ASSERT(systrace_sysent32[sysnum].stsy_return == DTRACE_IDNONE);
+#endif
+	}
+}
+
+/*ARGSUSED*/
+static int
+systrace_enable(void *arg, dtrace_id_t id, void *parg)
+{
+	int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg);
+	int enabled = (systrace_sysent[sysnum].stsy_entry != DTRACE_IDNONE ||
+	    systrace_sysent[sysnum].stsy_return != DTRACE_IDNONE);
+
+	if (SYSTRACE_ISENTRY((uintptr_t)parg)) {
+		systrace_sysent[sysnum].stsy_entry = id;
+#ifdef _SYSCALL32_IMPL
+		systrace_sysent32[sysnum].stsy_entry = id;
+#endif
+	} else {
+		systrace_sysent[sysnum].stsy_return = id;
+#ifdef _SYSCALL32_IMPL
+		systrace_sysent32[sysnum].stsy_return = id;
+#endif
+	}
+
+	if (enabled) {
+		ASSERT(sysent[sysnum].sy_callc == dtrace_systrace_syscall);
+		return (0);
+	}
+
+	(void) casptr(&sysent[sysnum].sy_callc,
+	    (void *)systrace_sysent[sysnum].stsy_underlying,
+	    (void *)dtrace_systrace_syscall);
+#ifdef _SYSCALL32_IMPL
+	(void) casptr(&sysent32[sysnum].sy_callc,
+	    (void *)systrace_sysent32[sysnum].stsy_underlying,
+	    (void *)dtrace_systrace_syscall32);
+#endif
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+systrace_disable(void *arg, dtrace_id_t id, void *parg)
+{
+	int sysnum = SYSTRACE_SYSNUM((uintptr_t)parg);
+	int disable = (systrace_sysent[sysnum].stsy_entry == DTRACE_IDNONE ||
+	    systrace_sysent[sysnum].stsy_return == DTRACE_IDNONE);
+
+	if (disable) {
+		(void) casptr(&sysent[sysnum].sy_callc,
+		    (void *)dtrace_systrace_syscall,
+		    (void *)systrace_sysent[sysnum].stsy_underlying);
+
+#ifdef _SYSCALL32_IMPL
+		(void) casptr(&sysent32[sysnum].sy_callc,
+		    (void *)dtrace_systrace_syscall32,
+		    (void *)systrace_sysent32[sysnum].stsy_underlying);
+#endif
+	}
+
+	if (SYSTRACE_ISENTRY((uintptr_t)parg)) {
+		systrace_sysent[sysnum].stsy_entry = DTRACE_IDNONE;
+#ifdef _SYSCALL32_IMPL
+		systrace_sysent32[sysnum].stsy_entry = DTRACE_IDNONE;
+#endif
+	} else {
+		systrace_sysent[sysnum].stsy_return = DTRACE_IDNONE;
+#ifdef _SYSCALL32_IMPL
+		systrace_sysent32[sysnum].stsy_return = DTRACE_IDNONE;
+#endif
+	}
+}
+
+static dtrace_pattr_t systrace_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pops_t systrace_pops = {
+	systrace_provide,
+	NULL,
+	systrace_enable,
+	systrace_disable,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	NULL,
+	systrace_destroy
+};
+
+static int
+systrace_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_ATTACH:
+		break;
+	case DDI_RESUME:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	systrace_probe = (void (*)())dtrace_probe;
+	membar_enter();
+
+	if (ddi_create_minor_node(devi, "systrace", S_IFCHR, 0,
+	    DDI_PSEUDO, NULL) == DDI_FAILURE ||
+	    dtrace_register("syscall", &systrace_attr, DTRACE_PRIV_USER, NULL,
+	    &systrace_pops, NULL, &systrace_id) != 0) {
+		systrace_probe = systrace_stub;
+		ddi_remove_minor_node(devi, NULL);
+		return (DDI_FAILURE);
+	}
+
+	ddi_report_dev(devi);
+	systrace_devi = devi;
+
+	return (DDI_SUCCESS);
+}
+
+static int
+systrace_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_DETACH:
+		break;
+	case DDI_SUSPEND:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (dtrace_unregister(systrace_id) != 0)
+		return (DDI_FAILURE);
+
+	ddi_remove_minor_node(devi, NULL);
+	systrace_probe = systrace_stub;
+	return (DDI_SUCCESS);
+}
+
+/*ARGSUSED*/
+static int
+systrace_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+	int error;
+
+	switch (infocmd) {
+	case DDI_INFO_DEVT2DEVINFO:
+		*result = (void *)systrace_devi;
+		error = DDI_SUCCESS;
+		break;
+	case DDI_INFO_DEVT2INSTANCE:
+		*result = (void *)0;
+		error = DDI_SUCCESS;
+		break;
+	default:
+		error = DDI_FAILURE;
+	}
+	return (error);
+}
+
+/*ARGSUSED*/
+static int
+systrace_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
+{
+	return (0);
+}
+
+static struct cb_ops systrace_cb_ops = {
+	systrace_open,		/* open */
+	nodev,			/* close */
+	nulldev,		/* strategy */
+	nulldev,		/* print */
+	nodev,			/* dump */
+	nodev,			/* read */
+	nodev,			/* write */
+	nodev,			/* ioctl */
+	nodev,			/* devmap */
+	nodev,			/* mmap */
+	nodev,			/* segmap */
+	nochpoll,		/* poll */
+	ddi_prop_op,		/* cb_prop_op */
+	0,			/* streamtab  */
+	D_NEW | D_MP		/* Driver compatibility flag */
+};
+
+static struct dev_ops systrace_ops = {
+	DEVO_REV,		/* devo_rev, */
+	0,			/* refcnt  */
+	systrace_info,		/* get_dev_info */
+	nulldev,		/* identify */
+	nulldev,		/* probe */
+	systrace_attach,	/* attach */
+	systrace_detach,	/* detach */
+	nodev,			/* reset */
+	&systrace_cb_ops,	/* driver operations */
+	NULL,			/* bus operations */
+	nodev,			/* dev power */
+	ddi_quiesce_not_needed,		/* quiesce */
+};
+
+/*
+ * Module linkage information for the kernel.
+ */
+static struct modldrv modldrv = {
+	&mod_driverops,		/* module type (this is a pseudo driver) */
+	"System Call Tracing",	/* name of module */
+	&systrace_ops,		/* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+	MODREV_1,
+	(void *)&modldrv,
+	NULL
+};
+
+int
+_init(void)
+{
+	return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+	return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+	return (mod_remove(&modlinkage));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/systrace.conf b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/systrace.conf
new file mode 100644
index 0000000..02b0dac
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/systrace.conf
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+name="systrace" parent="pseudo" instance=0;
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/os/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/os/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/os/dtrace_subr.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/os/dtrace_subr.c
new file mode 100644
index 0000000..f2a9ac1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/os/dtrace_subr.c
@@ -0,0 +1,337 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/dtrace.h>
+#include <sys/cmn_err.h>
+#include <sys/tnf.h>
+#include <sys/atomic.h>
+#include <sys/prsystm.h>
+#include <sys/modctl.h>
+#include <sys/aio_impl.h>
+
+#ifdef __sparc
+#include <sys/privregs.h>
+#endif
+
+void (*dtrace_cpu_init)(processorid_t);
+void (*dtrace_modload)(struct modctl *);
+void (*dtrace_modunload)(struct modctl *);
+void (*dtrace_helpers_cleanup)(void);
+void (*dtrace_helpers_fork)(proc_t *, proc_t *);
+void (*dtrace_cpustart_init)(void);
+void (*dtrace_cpustart_fini)(void);
+void (*dtrace_cpc_fire)(uint64_t);
+
+void (*dtrace_debugger_init)(void);
+void (*dtrace_debugger_fini)(void);
+
+dtrace_vtime_state_t dtrace_vtime_active = 0;
+dtrace_cacheid_t dtrace_predcache_id = DTRACE_CACHEIDNONE + 1;
+
+/*
+ * dtrace_cpc_in_use usage statement: this global variable is used by the cpc
+ * hardware overflow interrupt handler and the kernel cpc framework to check
+ * whether or not the DTrace cpc provider is currently in use. The variable is
+ * set before counters are enabled with the first enabling and cleared when
+ * the last enabling is disabled. Its value at any given time indicates the
+ * number of active dcpc based enablings. The global 'kcpc_cpuctx_lock' rwlock
+ * is held during initial setting to protect races between kcpc_open() and the
+ * first enabling. The locking provided by the DTrace subsystem, the kernel
+ * cpc framework and the cpu management framework protect consumers from race
+ * conditions on enabling and disabling probes.
+ */
+uint32_t dtrace_cpc_in_use = 0;
+
+typedef struct dtrace_hrestime {
+	lock_t		dthr_lock;		/* lock for this element */
+	timestruc_t	dthr_hrestime;		/* hrestime value */
+	int64_t		dthr_adj;		/* hrestime_adj value */
+	hrtime_t	dthr_hrtime;		/* hrtime value */
+} dtrace_hrestime_t;
+
+static dtrace_hrestime_t dtrace_hrestime[2];
+
+/*
+ * Making available adjustable high-resolution time in DTrace is regrettably
+ * more complicated than one might think it should be.  The problem is that
+ * the variables related to adjusted high-resolution time (hrestime,
+ * hrestime_adj and friends) are adjusted under hres_lock -- and this lock may
+ * be held when we enter probe context.  One might think that we could address
+ * this by having a single snapshot copy that is stored under a different lock
+ * from hres_tick(), using the snapshot iff hres_lock is locked in probe
+ * context.  Unfortunately, this too won't work:  because hres_lock is grabbed
+ * in more than just hres_tick() context, we could enter probe context
+ * concurrently on two different CPUs with both locks (hres_lock and the
+ * snapshot lock) held.  As this implies, the fundamental problem is that we
+ * need to have access to a snapshot of these variables that we _know_ will
+ * not be locked in probe context.  To effect this, we have two snapshots
+ * protected by two different locks, and we mandate that these snapshots are
+ * recorded in succession by a single thread calling dtrace_hres_tick().  (We
+ * assure this by calling it out of the same CY_HIGH_LEVEL cyclic that calls
+ * hres_tick().)  A single thread can't be in two places at once:  one of the
+ * snapshot locks is guaranteed to be unheld at all times.  The
+ * dtrace_gethrestime() algorithm is thus to check first one snapshot and then
+ * the other to find the unlocked snapshot.
+ */
+void
+dtrace_hres_tick(void)
+{
+	int i;
+	ushort_t spl;
+
+	for (i = 0; i < 2; i++) {
+		dtrace_hrestime_t tmp;
+
+		spl = hr_clock_lock();
+		tmp.dthr_hrestime = hrestime;
+		tmp.dthr_adj = hrestime_adj;
+		tmp.dthr_hrtime = dtrace_gethrtime();
+		hr_clock_unlock(spl);
+
+		lock_set(&dtrace_hrestime[i].dthr_lock);
+		dtrace_hrestime[i].dthr_hrestime = tmp.dthr_hrestime;
+		dtrace_hrestime[i].dthr_adj = tmp.dthr_adj;
+		dtrace_hrestime[i].dthr_hrtime = tmp.dthr_hrtime;
+		dtrace_membar_producer();
+
+		/*
+		 * To allow for lock-free examination of this lock, we use
+		 * the same trick that is used hres_lock; for more details,
+		 * see the description of this technique in sun4u/sys/clock.h.
+		 */
+		dtrace_hrestime[i].dthr_lock++;
+	}
+}
+
+hrtime_t
+dtrace_gethrestime(void)
+{
+	dtrace_hrestime_t snap;
+	hrtime_t now;
+	int i = 0, adj, nslt;
+
+	for (;;) {
+		snap.dthr_lock = dtrace_hrestime[i].dthr_lock;
+		dtrace_membar_consumer();
+		snap.dthr_hrestime = dtrace_hrestime[i].dthr_hrestime;
+		snap.dthr_hrtime = dtrace_hrestime[i].dthr_hrtime;
+		snap.dthr_adj = dtrace_hrestime[i].dthr_adj;
+		dtrace_membar_consumer();
+
+		if ((snap.dthr_lock & ~1) == dtrace_hrestime[i].dthr_lock)
+			break;
+
+		/*
+		 * If we're here, the lock was either locked, or it
+		 * transitioned while we were taking the snapshot.  Either
+		 * way, we're going to try the other dtrace_hrestime element;
+		 * we know that it isn't possible for both to be locked
+		 * simultaneously, so we will ultimately get a good snapshot.
+		 */
+		i ^= 1;
+	}
+
+	/*
+	 * We have a good snapshot.  Now perform any necessary adjustments.
+	 */
+	nslt = dtrace_gethrtime() - snap.dthr_hrtime;
+	ASSERT(nslt >= 0);
+
+	now = ((hrtime_t)snap.dthr_hrestime.tv_sec * (hrtime_t)NANOSEC) +
+	    snap.dthr_hrestime.tv_nsec;
+
+	if (snap.dthr_adj != 0) {
+		if (snap.dthr_adj > 0) {
+			adj = (nslt >> adj_shift);
+			if (adj > snap.dthr_adj)
+				adj = (int)snap.dthr_adj;
+		} else {
+			adj = -(nslt >> adj_shift);
+			if (adj < snap.dthr_adj)
+				adj = (int)snap.dthr_adj;
+		}
+		now += adj;
+	}
+
+	return (now);
+}
+
+void
+dtrace_vtime_enable(void)
+{
+	dtrace_vtime_state_t state, nstate;
+
+	do {
+		state = dtrace_vtime_active;
+
+		switch (state) {
+		case DTRACE_VTIME_INACTIVE:
+			nstate = DTRACE_VTIME_ACTIVE;
+			break;
+
+		case DTRACE_VTIME_INACTIVE_TNF:
+			nstate = DTRACE_VTIME_ACTIVE_TNF;
+			break;
+
+		case DTRACE_VTIME_ACTIVE:
+		case DTRACE_VTIME_ACTIVE_TNF:
+			panic("DTrace virtual time already enabled");
+			/*NOTREACHED*/
+		}
+
+	} while	(cas32((uint32_t *)&dtrace_vtime_active,
+	    state, nstate) != state);
+}
+
+void
+dtrace_vtime_disable(void)
+{
+	dtrace_vtime_state_t state, nstate;
+
+	do {
+		state = dtrace_vtime_active;
+
+		switch (state) {
+		case DTRACE_VTIME_ACTIVE:
+			nstate = DTRACE_VTIME_INACTIVE;
+			break;
+
+		case DTRACE_VTIME_ACTIVE_TNF:
+			nstate = DTRACE_VTIME_INACTIVE_TNF;
+			break;
+
+		case DTRACE_VTIME_INACTIVE:
+		case DTRACE_VTIME_INACTIVE_TNF:
+			panic("DTrace virtual time already disabled");
+			/*NOTREACHED*/
+		}
+
+	} while	(cas32((uint32_t *)&dtrace_vtime_active,
+	    state, nstate) != state);
+}
+
+void
+dtrace_vtime_enable_tnf(void)
+{
+	dtrace_vtime_state_t state, nstate;
+
+	do {
+		state = dtrace_vtime_active;
+
+		switch (state) {
+		case DTRACE_VTIME_ACTIVE:
+			nstate = DTRACE_VTIME_ACTIVE_TNF;
+			break;
+
+		case DTRACE_VTIME_INACTIVE:
+			nstate = DTRACE_VTIME_INACTIVE_TNF;
+			break;
+
+		case DTRACE_VTIME_ACTIVE_TNF:
+		case DTRACE_VTIME_INACTIVE_TNF:
+			panic("TNF already active");
+			/*NOTREACHED*/
+		}
+
+	} while	(cas32((uint32_t *)&dtrace_vtime_active,
+	    state, nstate) != state);
+}
+
+void
+dtrace_vtime_disable_tnf(void)
+{
+	dtrace_vtime_state_t state, nstate;
+
+	do {
+		state = dtrace_vtime_active;
+
+		switch (state) {
+		case DTRACE_VTIME_ACTIVE_TNF:
+			nstate = DTRACE_VTIME_ACTIVE;
+			break;
+
+		case DTRACE_VTIME_INACTIVE_TNF:
+			nstate = DTRACE_VTIME_INACTIVE;
+			break;
+
+		case DTRACE_VTIME_ACTIVE:
+		case DTRACE_VTIME_INACTIVE:
+			panic("TNF already inactive");
+			/*NOTREACHED*/
+		}
+
+	} while	(cas32((uint32_t *)&dtrace_vtime_active,
+	    state, nstate) != state);
+}
+
+void
+dtrace_vtime_switch(kthread_t *next)
+{
+	dtrace_icookie_t cookie;
+	hrtime_t ts;
+
+	if (tnf_tracing_active) {
+		tnf_thread_switch(next);
+
+		if (dtrace_vtime_active == DTRACE_VTIME_INACTIVE_TNF)
+			return;
+	}
+
+	cookie = dtrace_interrupt_disable();
+	ts = dtrace_gethrtime();
+
+	if (curthread->t_dtrace_start != 0) {
+		curthread->t_dtrace_vtime += ts - curthread->t_dtrace_start;
+		curthread->t_dtrace_start = 0;
+	}
+
+	next->t_dtrace_start = ts;
+
+	dtrace_interrupt_enable(cookie);
+}
+
+void (*dtrace_fasttrap_fork_ptr)(proc_t *, proc_t *);
+void (*dtrace_fasttrap_exec_ptr)(proc_t *);
+void (*dtrace_fasttrap_exit_ptr)(proc_t *);
+
+/*
+ * This function is called by cfork() in the event that it appears that
+ * there may be dtrace tracepoints active in the parent process's address
+ * space. This first confirms the existence of dtrace tracepoints in the
+ * parent process and calls into the fasttrap module to remove the
+ * corresponding tracepoints from the child. By knowing that there are
+ * existing tracepoints, and ensuring they can't be removed, we can rely
+ * on the fasttrap module remaining loaded.
+ */
+void
+dtrace_fasttrap_fork(proc_t *p, proc_t *cp)
+{
+	ASSERT(p->p_proc_flag & P_PR_LOCK);
+	ASSERT(p->p_dtrace_count > 0);
+	ASSERT(dtrace_fasttrap_fork_ptr != NULL);
+
+	dtrace_fasttrap_fork_ptr(p, cp);
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf.h
new file mode 100644
index 0000000..c23d597
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf.h
@@ -0,0 +1,364 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_CTF_H
+#define	_CTF_H
+
+#ifndef VBOX
+# pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#ifndef VBOX
+# include <sys/types.h>
+#else
+# include "VBoxDTraceTypes.h"
+#endif
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/*
+ * CTF - Compact ANSI-C Type Format
+ *
+ * This file format can be used to compactly represent the information needed
+ * by a debugger to interpret the ANSI-C types used by a given program.
+ * Traditionally, this kind of information is generated by the compiler when
+ * invoked with the -g flag and is stored in "stabs" strings or in the more
+ * modern DWARF format.  CTF provides a representation of only the information
+ * that is relevant to debugging a complex, optimized C program such as the
+ * operating system kernel in a form that is significantly more compact than
+ * the equivalent stabs or DWARF representation.  The format is data-model
+ * independent, so consumers do not need different code depending on whether
+ * they are 32-bit or 64-bit programs.  CTF assumes that a standard ELF symbol
+ * table is available for use in the debugger, and uses the structure and data
+ * of the symbol table to avoid storing redundant information.  The CTF data
+ * may be compressed on disk or in memory, indicated by a bit in the header.
+ * CTF may be interpreted in a raw disk file, or it may be stored in an ELF
+ * section, typically named .SUNW_ctf.  Data structures are aligned so that
+ * a raw CTF file or CTF ELF section may be manipulated using mmap(2).
+ *
+ * The CTF file or section itself has the following structure:
+ *
+ * +--------+--------+---------+----------+-------+--------+
+ * |  file  |  type  |  data   | function | data  | string |
+ * | header | labels | objects |   info   | types | table  |
+ * +--------+--------+---------+----------+-------+--------+
+ *
+ * The file header stores a magic number and version information, encoding
+ * flags, and the byte offset of each of the sections relative to the end of the
+ * header itself.  If the CTF data has been uniquified against another set of
+ * CTF data, a reference to that data also appears in the the header.  This
+ * reference is the name of the label corresponding to the types uniquified
+ * against.
+ *
+ * Following the header is a list of labels, used to group the types included in
+ * the data types section.  Each label is accompanied by a type ID i.  A given
+ * label refers to the group of types whose IDs are in the range [0, i].
+ *
+ * Data object and function records are stored in the same order as they appear
+ * in the corresponding symbol table, except that symbols marked SHN_UNDEF are
+ * not stored and symbols that have no type data are padded out with zeroes.
+ * For each data object, the type ID (a small integer) is recorded.  For each
+ * function, the type ID of the return type and argument types is recorded.
+ *
+ * The data types section is a list of variable size records that represent each
+ * type, in order by their ID.  The types themselves form a directed graph,
+ * where each node may contain one or more outgoing edges to other type nodes,
+ * denoted by their ID.
+ *
+ * Strings are recorded as a string table ID (0 or 1) and a byte offset into the
+ * string table.  String table 0 is the internal CTF string table.  String table
+ * 1 is the external string table, which is the string table associated with the
+ * ELF symbol table for this object.  CTF does not record any strings that are
+ * already in the symbol table, and the CTF string table does not contain any
+ * duplicated strings.
+ *
+ * If the CTF data has been merged with another parent CTF object, some outgoing
+ * edges may refer to type nodes that exist in another CTF object.  The debugger
+ * and libctf library are responsible for connecting the appropriate objects
+ * together so that the full set of types can be explored and manipulated.
+ */
+
+#define	CTF_MAX_TYPE	0xffff	/* max type identifier value */
+#define	CTF_MAX_NAME 0x7fffffff	/* max offset into a string table */
+#define	CTF_MAX_VLEN	0x3ff	/* max struct, union, enum members or args */
+#define	CTF_MAX_INTOFF	0xff	/* max offset of intrinsic value in bits */
+#define	CTF_MAX_INTBITS	0xffff	/* max size of an intrinsic in bits */
+
+/* See ctf_type_t */
+#define	CTF_MAX_SIZE	0xfffe	/* max size of a type in bytes */
+#define	CTF_LSIZE_SENT	0xffff	/* sentinel for ctt_size */
+#define	CTF_MAX_LSIZE	UINT64_MAX
+
+typedef struct ctf_preamble {
+	ushort_t ctp_magic;	/* magic number (CTF_MAGIC) */
+	uchar_t ctp_version;	/* data format version number (CTF_VERSION) */
+	uchar_t ctp_flags;	/* flags (see below) */
+} ctf_preamble_t;
+
+typedef struct ctf_header {
+	ctf_preamble_t cth_preamble;
+	uint_t cth_parlabel;	/* ref to name of parent lbl uniq'd against */
+	uint_t cth_parname;	/* ref to basename of parent */
+	uint_t cth_lbloff;	/* offset of label section */
+	uint_t cth_objtoff;	/* offset of object section */
+	uint_t cth_funcoff;	/* offset of function section */
+	uint_t cth_typeoff;	/* offset of type section */
+	uint_t cth_stroff;	/* offset of string section */
+	uint_t cth_strlen;	/* length of string section in bytes */
+} ctf_header_t;
+
+#define	cth_magic   cth_preamble.ctp_magic
+#define	cth_version cth_preamble.ctp_version
+#define	cth_flags   cth_preamble.ctp_flags
+
+#ifdef CTF_OLD_VERSIONS
+
+typedef struct ctf_header_v1 {
+	ctf_preamble_t cth_preamble;
+	uint_t cth_objtoff;
+	uint_t cth_funcoff;
+	uint_t cth_typeoff;
+	uint_t cth_stroff;
+	uint_t cth_strlen;
+} ctf_header_v1_t;
+
+#endif /* CTF_OLD_VERSIONS */
+
+#define	CTF_MAGIC	0xcff1	/* magic number identifying header */
+
+/* data format version number */
+#define	CTF_VERSION_1	1
+#define	CTF_VERSION_2	2
+#define	CTF_VERSION	CTF_VERSION_2	/* current version */
+
+#define	CTF_F_COMPRESS	0x1	/* data buffer is compressed */
+
+typedef struct ctf_lblent {
+	uint_t ctl_label;	/* ref to name of label */
+	uint_t ctl_typeidx;	/* last type associated with this label */
+} ctf_lblent_t;
+
+typedef struct ctf_stype {
+	uint_t ctt_name;	/* reference to name in string table */
+	ushort_t ctt_info;	/* encoded kind, variant length (see below) */
+	union {
+		ushort_t _size;	/* size of entire type in bytes */
+		ushort_t _type;	/* reference to another type */
+	} _u;
+} ctf_stype_t;
+
+/*
+ * type sizes, measured in bytes, come in two flavors.  99% of them fit within
+ * (USHRT_MAX - 1), and thus can be stored in the ctt_size member of a
+ * ctf_stype_t.  The maximum value for these sizes is CTF_MAX_SIZE.  The sizes
+ * larger than CTF_MAX_SIZE must be stored in the ctt_lsize member of a
+ * ctf_type_t.  Use of this member is indicated by the presence of
+ * CTF_LSIZE_SENT in ctt_size.
+ */
+typedef struct ctf_type {
+	uint_t ctt_name;	/* reference to name in string table */
+	ushort_t ctt_info;	/* encoded kind, variant length (see below) */
+	union {
+		ushort_t _size;	/* always CTF_LSIZE_SENT */
+		ushort_t _type; /* do not use */
+	} _u;
+	uint_t ctt_lsizehi;	/* high 32 bits of type size in bytes */
+	uint_t ctt_lsizelo;	/* low 32 bits of type size in bytes */
+} ctf_type_t;
+
+#define	ctt_size _u._size	/* for fundamental types that have a size */
+#define	ctt_type _u._type	/* for types that reference another type */
+
+/*
+ * The following macros compose and decompose values for ctt_info and
+ * ctt_name, as well as other structures that contain name references.
+ *
+ *             ------------------------
+ * ctt_info:   | kind | isroot | vlen |
+ *             ------------------------
+ *             15   11    10    9     0
+ *
+ * kind = CTF_INFO_KIND(c.ctt_info);     <-- CTF_K_* value (see below)
+ * vlen = CTF_INFO_VLEN(c.ctt_info);     <-- length of variable data list
+ *
+ * stid = CTF_NAME_STID(c.ctt_name);     <-- string table id number (0 or 1)
+ * offset = CTF_NAME_OFFSET(c.ctt_name); <-- string table byte offset
+ *
+ * c.ctt_info = CTF_TYPE_INFO(kind, vlen);
+ * c.ctt_name = CTF_TYPE_NAME(stid, offset);
+ */
+
+#define	CTF_INFO_KIND(info)	(((info) & 0xf800) >> 11)
+#define	CTF_INFO_ISROOT(info)	(((info) & 0x0400) >> 10)
+#define	CTF_INFO_VLEN(info)	(((info) & CTF_MAX_VLEN))
+
+#define	CTF_NAME_STID(name)	((name) >> 31)
+#define	CTF_NAME_OFFSET(name)	((name) & 0x7fffffff)
+
+#define	CTF_TYPE_INFO(kind, isroot, vlen) \
+	(((kind) << 11) | (((isroot) ? 1 : 0) << 10) | ((vlen) & CTF_MAX_VLEN))
+
+#define	CTF_TYPE_NAME(stid, offset) \
+	(((stid) << 31) | ((offset) & 0x7fffffff))
+
+#define	CTF_TYPE_ISPARENT(id)	((id) < 0x8000)
+#define	CTF_TYPE_ISCHILD(id)	((id) > 0x7fff)
+
+#define	CTF_TYPE_TO_INDEX(id)		((id) & 0x7fff)
+#define	CTF_INDEX_TO_TYPE(id, child)	((child) ? ((id) | 0x8000) : (id))
+#define	CTF_PARENT_SHIFT	15
+
+#define	CTF_STRTAB_0	0	/* symbolic define for string table id 0 */
+#define	CTF_STRTAB_1	1	/* symbolic define for string table id 1 */
+
+#define	CTF_TYPE_LSIZE(cttp) \
+	(((uint64_t)(cttp)->ctt_lsizehi) << 32 | (cttp)->ctt_lsizelo)
+#define	CTF_SIZE_TO_LSIZE_HI(size)	((uint32_t)((uint64_t)(size) >> 32))
+#define	CTF_SIZE_TO_LSIZE_LO(size)	((uint32_t)(size))
+
+#ifdef CTF_OLD_VERSIONS
+
+#define	CTF_INFO_KIND_V1(info)		(((info) & 0xf000) >> 12)
+#define	CTF_INFO_ISROOT_V1(info)	(((info) & 0x0800) >> 11)
+#define	CTF_INFO_VLEN_V1(info)		(((info) & 0x07ff))
+
+#define	CTF_TYPE_INFO_V1(kind, isroot, vlen) \
+	(((kind) << 12) | (((isroot) ? 1 : 0) << 11) | ((vlen) & 0x07ff))
+
+#endif /* CTF_OLD_VERSIONS */
+
+/*
+ * Values for CTF_TYPE_KIND().  If the kind has an associated data list,
+ * CTF_INFO_VLEN() will extract the number of elements in the list, and
+ * the type of each element is shown in the comments below.
+ */
+#define	CTF_K_UNKNOWN	0	/* unknown type (used for padding) */
+#define	CTF_K_INTEGER	1	/* variant data is CTF_INT_DATA() (see below) */
+#define	CTF_K_FLOAT	2	/* variant data is CTF_FP_DATA() (see below) */
+#define	CTF_K_POINTER	3	/* ctt_type is referenced type */
+#define	CTF_K_ARRAY	4	/* variant data is single ctf_array_t */
+#define	CTF_K_FUNCTION	5	/* ctt_type is return type, variant data is */
+				/* list of argument types (ushort_t's) */
+#define	CTF_K_STRUCT	6	/* variant data is list of ctf_member_t's */
+#define	CTF_K_UNION	7	/* variant data is list of ctf_member_t's */
+#define	CTF_K_ENUM	8	/* variant data is list of ctf_enum_t's */
+#define	CTF_K_FORWARD	9	/* no additional data; ctt_name is tag */
+#define	CTF_K_TYPEDEF	10	/* ctt_type is referenced type */
+#define	CTF_K_VOLATILE	11	/* ctt_type is base type */
+#define	CTF_K_CONST	12	/* ctt_type is base type */
+#define	CTF_K_RESTRICT	13	/* ctt_type is base type */
+
+#define	CTF_K_MAX	31	/* Maximum possible CTF_K_* value */
+
+/*
+ * Values for ctt_type when kind is CTF_K_INTEGER.  The flags, offset in bits,
+ * and size in bits are encoded as a single word using the following macros.
+ */
+#define	CTF_INT_ENCODING(data)	(((data) & 0xff000000) >> 24)
+#define	CTF_INT_OFFSET(data)	(((data) & 0x00ff0000) >> 16)
+#define	CTF_INT_BITS(data)	(((data) & 0x0000ffff))
+
+#define	CTF_INT_DATA(encoding, offset, bits) \
+	(((encoding) << 24) | ((offset) << 16) | (bits))
+
+#define	CTF_INT_SIGNED	0x01	/* integer is signed (otherwise unsigned) */
+#define	CTF_INT_CHAR	0x02	/* character display format */
+#define	CTF_INT_BOOL	0x04	/* boolean display format */
+#define	CTF_INT_VARARGS	0x08	/* varargs display format */
+
+/*
+ * Values for ctt_type when kind is CTF_K_FLOAT.  The encoding, offset in bits,
+ * and size in bits are encoded as a single word using the following macros.
+ */
+#define	CTF_FP_ENCODING(data)	(((data) & 0xff000000) >> 24)
+#define	CTF_FP_OFFSET(data)	(((data) & 0x00ff0000) >> 16)
+#define	CTF_FP_BITS(data)	(((data) & 0x0000ffff))
+
+#define	CTF_FP_DATA(encoding, offset, bits) \
+	(((encoding) << 24) | ((offset) << 16) | (bits))
+
+#define	CTF_FP_SINGLE	1	/* IEEE 32-bit float encoding */
+#define	CTF_FP_DOUBLE	2	/* IEEE 64-bit float encoding */
+#define	CTF_FP_CPLX	3	/* Complex encoding */
+#define	CTF_FP_DCPLX	4	/* Double complex encoding */
+#define	CTF_FP_LDCPLX	5	/* Long double complex encoding */
+#define	CTF_FP_LDOUBLE	6	/* Long double encoding */
+#define	CTF_FP_INTRVL	7	/* Interval (2x32-bit) encoding */
+#define	CTF_FP_DINTRVL	8	/* Double interval (2x64-bit) encoding */
+#define	CTF_FP_LDINTRVL	9	/* Long double interval (2x128-bit) encoding */
+#define	CTF_FP_IMAGRY	10	/* Imaginary (32-bit) encoding */
+#define	CTF_FP_DIMAGRY	11	/* Long imaginary (64-bit) encoding */
+#define	CTF_FP_LDIMAGRY	12	/* Long double imaginary (128-bit) encoding */
+
+#define	CTF_FP_MAX	12	/* Maximum possible CTF_FP_* value */
+
+typedef struct ctf_array {
+	ushort_t cta_contents;	/* reference to type of array contents */
+	ushort_t cta_index;	/* reference to type of array index */
+	uint_t cta_nelems;	/* number of elements */
+} ctf_array_t;
+
+/*
+ * Most structure members have bit offsets that can be expressed using a
+ * short.  Some don't.  ctf_member_t is used for structs which cannot
+ * contain any of these large offsets, whereas ctf_lmember_t is used in the
+ * latter case.  If ctt_size for a given struct is >= 8192 bytes, all members
+ * will be stored as type ctf_lmember_t.
+ */
+
+#define	CTF_LSTRUCT_THRESH	8192
+
+typedef struct ctf_member {
+	uint_t ctm_name;	/* reference to name in string table */
+	ushort_t ctm_type;	/* reference to type of member */
+	ushort_t ctm_offset;	/* offset of this member in bits */
+} ctf_member_t;
+
+typedef struct ctf_lmember {
+	uint_t ctlm_name;	/* reference to name in string table */
+	ushort_t ctlm_type;	/* reference to type of member */
+	ushort_t ctlm_pad;	/* padding */
+	uint_t ctlm_offsethi;	/* high 32 bits of member offset in bits */
+	uint_t ctlm_offsetlo;	/* low 32 bits of member offset in bits */
+} ctf_lmember_t;
+
+#define	CTF_LMEM_OFFSET(ctlmp) \
+	(((uint64_t)(ctlmp)->ctlm_offsethi) << 32 | (ctlmp)->ctlm_offsetlo)
+#define	CTF_OFFSET_TO_LMEMHI(offset)	((uint32_t)((uint64_t)(offset) >> 32))
+#define	CTF_OFFSET_TO_LMEMLO(offset)	((uint32_t)(offset))
+
+typedef struct ctf_enum {
+	uint_t cte_name;	/* reference to name in string table */
+	int cte_value;		/* value associated with this name */
+} ctf_enum_t;
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _CTF_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf_api.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf_api.h
new file mode 100644
index 0000000..7baa37e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/ctf_api.h
@@ -0,0 +1,251 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * This header file defines the interfaces available from the CTF debugger
+ * library, libctf, and an equivalent kernel module.  This API can be used by
+ * a debugger to operate on data in the Compact ANSI-C Type Format (CTF).
+ * This is NOT a public interface, although it may eventually become one in
+ * the fullness of time after we gain more experience with the interfaces.
+ *
+ * In the meantime, be aware that any program linked with this API in this
+ * release of Solaris is almost guaranteed to break in the next release.
+ *
+ * In short, do not user this header file or the CTF routines for any purpose.
+ */
+
+#ifndef	_CTF_API_H
+#define	_CTF_API_H
+
+#ifndef VBOX
+# pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#ifndef VBOX
+# include <sys/types.h>
+# include <sys/param.h>
+# include <sys/elf.h>
+#else
+# include "VBoxDTraceTypes.h"
+#endif
+#include <sys/ctf.h>
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/*
+ * Clients can open one or more CTF containers and obtain a pointer to an
+ * opaque ctf_file_t.  Types are identified by an opaque ctf_id_t token.
+ * These opaque definitions allow libctf to evolve without breaking clients.
+ */
+typedef struct ctf_file ctf_file_t;
+typedef long ctf_id_t;
+
+/*
+ * If the debugger needs to provide the CTF library with a set of raw buffers
+ * for use as the CTF data, symbol table, and string table, it can do so by
+ * filling in ctf_sect_t structures and passing them to ctf_bufopen():
+ */
+typedef struct ctf_sect {
+	const char *cts_name;	/* section name (if any) */
+	ulong_t cts_type;	/* section type (ELF SHT_... value) */
+	ulong_t cts_flags;	/* section flags (ELF SHF_... value) */
+	const void *cts_data;	/* pointer to section data */
+	size_t cts_size;	/* size of data in bytes */
+	size_t cts_entsize;	/* size of each section entry (symtab only) */
+#ifndef VBOX
+	off64_t cts_offset;	/* file offset of this section (if any) */
+#else
+	RTFOFF cts_offset;	/* file offset of this section (if any) */
+#endif
+} ctf_sect_t;
+
+/*
+ * Encoding information for integers, floating-point values, and certain other
+ * intrinsics can be obtained by calling ctf_type_encoding(), below.  The flags
+ * field will contain values appropriate for the type defined in <sys/ctf.h>.
+ */
+typedef struct ctf_encoding {
+	uint_t cte_format;	/* data format (CTF_INT_* or CTF_FP_* flags) */
+	uint_t cte_offset;	/* offset of value in bits */
+	uint_t cte_bits;	/* size of storage in bits */
+} ctf_encoding_t;
+
+typedef struct ctf_membinfo {
+	ctf_id_t ctm_type;	/* type of struct or union member */
+	ulong_t ctm_offset;	/* offset of member in bits */
+} ctf_membinfo_t;
+
+typedef struct ctf_arinfo {
+	ctf_id_t ctr_contents;	/* type of array contents */
+	ctf_id_t ctr_index;	/* type of array index */
+	uint_t ctr_nelems;	/* number of elements */
+} ctf_arinfo_t;
+
+typedef struct ctf_funcinfo {
+	ctf_id_t ctc_return;	/* function return type */
+	uint_t ctc_argc;	/* number of typed arguments to function */
+	uint_t ctc_flags;	/* function attributes (see below) */
+} ctf_funcinfo_t;
+
+typedef struct ctf_lblinfo {
+	ctf_id_t ctb_typeidx;	/* last type associated with the label */
+} ctf_lblinfo_t;
+
+#define	CTF_FUNC_VARARG	0x1	/* function arguments end with varargs */
+
+/*
+ * Functions that return integer status or a ctf_id_t use the following value
+ * to indicate failure.  ctf_errno() can be used to obtain an error code.
+ */
+#define	CTF_ERR	(-1L)
+
+/*
+ * The CTF data model is inferred to be the caller's data model or the data
+ * model of the given object, unless ctf_setmodel() is explicitly called.
+ */
+#define	CTF_MODEL_ILP32	1	/* object data model is ILP32 */
+#define	CTF_MODEL_LP64	2	/* object data model is LP64 */
+#ifdef _LP64
+#define	CTF_MODEL_NATIVE	CTF_MODEL_LP64
+#else
+#define	CTF_MODEL_NATIVE	CTF_MODEL_ILP32
+#endif
+
+/*
+ * Dynamic CTF containers can be created using ctf_create().  The ctf_add_*
+ * routines can be used to add new definitions to the dynamic container.
+ * New types are labeled as root or non-root to determine whether they are
+ * visible at the top-level program scope when subsequently doing a lookup.
+ */
+#define	CTF_ADD_NONROOT	0	/* type only visible in nested scope */
+#define	CTF_ADD_ROOT	1	/* type visible at top-level scope */
+
+/*
+ * These typedefs are used to define the signature for callback functions
+ * that can be used with the iteration and visit functions below:
+ */
+typedef int ctf_visit_f(const char *, ctf_id_t, ulong_t, int, void *);
+typedef int ctf_member_f(const char *, ctf_id_t, ulong_t, void *);
+typedef int ctf_enum_f(const char *, int, void *);
+typedef int ctf_type_f(ctf_id_t, void *);
+typedef int ctf_label_f(const char *, const ctf_lblinfo_t *, void *);
+
+extern ctf_file_t *ctf_bufopen(const ctf_sect_t *, const ctf_sect_t *,
+    const ctf_sect_t *, int *);
+extern ctf_file_t *ctf_fdopen(int, int *);
+extern ctf_file_t *ctf_open(const char *, int *);
+extern ctf_file_t *ctf_create(int *);
+extern void ctf_close(ctf_file_t *);
+
+extern ctf_file_t *ctf_parent_file(ctf_file_t *);
+extern const char *ctf_parent_name(ctf_file_t *);
+
+extern int ctf_import(ctf_file_t *, ctf_file_t *);
+extern int ctf_setmodel(ctf_file_t *, int);
+extern int ctf_getmodel(ctf_file_t *);
+
+extern void ctf_setspecific(ctf_file_t *, void *);
+extern void *ctf_getspecific(ctf_file_t *);
+
+extern int ctf_errno(ctf_file_t *);
+extern const char *ctf_errmsg(int);
+extern int ctf_version(int);
+
+extern int ctf_func_info(ctf_file_t *, ulong_t, ctf_funcinfo_t *);
+extern int ctf_func_args(ctf_file_t *, ulong_t, uint_t, ctf_id_t *);
+
+extern ctf_id_t ctf_lookup_by_name(ctf_file_t *, const char *);
+extern ctf_id_t ctf_lookup_by_symbol(ctf_file_t *, ulong_t);
+
+extern ctf_id_t ctf_type_resolve(ctf_file_t *, ctf_id_t);
+extern ssize_t ctf_type_lname(ctf_file_t *, ctf_id_t, char *, size_t);
+extern char *ctf_type_name(ctf_file_t *, ctf_id_t, char *, size_t);
+extern ssize_t ctf_type_size(ctf_file_t *, ctf_id_t);
+extern ssize_t ctf_type_align(ctf_file_t *, ctf_id_t);
+extern int ctf_type_kind(ctf_file_t *, ctf_id_t);
+extern ctf_id_t ctf_type_reference(ctf_file_t *, ctf_id_t);
+extern ctf_id_t ctf_type_pointer(ctf_file_t *, ctf_id_t);
+extern int ctf_type_encoding(ctf_file_t *, ctf_id_t, ctf_encoding_t *);
+extern int ctf_type_visit(ctf_file_t *, ctf_id_t, ctf_visit_f *, void *);
+extern int ctf_type_cmp(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
+extern int ctf_type_compat(ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
+
+extern int ctf_member_info(ctf_file_t *, ctf_id_t, const char *,
+    ctf_membinfo_t *);
+extern int ctf_array_info(ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
+
+extern const char *ctf_enum_name(ctf_file_t *, ctf_id_t, int);
+extern int ctf_enum_value(ctf_file_t *, ctf_id_t, const char *, int *);
+
+extern const char *ctf_label_topmost(ctf_file_t *);
+extern int ctf_label_info(ctf_file_t *, const char *, ctf_lblinfo_t *);
+
+extern int ctf_member_iter(ctf_file_t *, ctf_id_t, ctf_member_f *, void *);
+extern int ctf_enum_iter(ctf_file_t *, ctf_id_t, ctf_enum_f *, void *);
+extern int ctf_type_iter(ctf_file_t *, ctf_type_f *, void *);
+extern int ctf_label_iter(ctf_file_t *, ctf_label_f *, void *);
+
+extern ctf_id_t ctf_add_array(ctf_file_t *, uint_t, const ctf_arinfo_t *);
+extern ctf_id_t ctf_add_const(ctf_file_t *, uint_t, ctf_id_t);
+extern ctf_id_t ctf_add_enum(ctf_file_t *, uint_t, const char *);
+extern ctf_id_t ctf_add_float(ctf_file_t *, uint_t,
+    const char *, const ctf_encoding_t *);
+extern ctf_id_t ctf_add_forward(ctf_file_t *, uint_t, const char *, uint_t);
+extern ctf_id_t ctf_add_function(ctf_file_t *, uint_t,
+    const ctf_funcinfo_t *, const ctf_id_t *);
+extern ctf_id_t ctf_add_integer(ctf_file_t *, uint_t,
+    const char *, const ctf_encoding_t *);
+extern ctf_id_t ctf_add_pointer(ctf_file_t *, uint_t, ctf_id_t);
+extern ctf_id_t ctf_add_type(ctf_file_t *, ctf_file_t *, ctf_id_t);
+extern ctf_id_t ctf_add_typedef(ctf_file_t *, uint_t, const char *, ctf_id_t);
+extern ctf_id_t ctf_add_restrict(ctf_file_t *, uint_t, ctf_id_t);
+extern ctf_id_t ctf_add_struct(ctf_file_t *, uint_t, const char *);
+extern ctf_id_t ctf_add_union(ctf_file_t *, uint_t, const char *);
+extern ctf_id_t ctf_add_volatile(ctf_file_t *, uint_t, ctf_id_t);
+
+extern int ctf_add_enumerator(ctf_file_t *, ctf_id_t, const char *, int);
+extern int ctf_add_member(ctf_file_t *, ctf_id_t, const char *, ctf_id_t);
+
+extern int ctf_set_array(ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
+
+extern int ctf_update(ctf_file_t *);
+extern int ctf_discard(ctf_file_t *);
+extern int ctf_write(ctf_file_t *, int);
+
+#ifdef _KERNEL
+
+struct module;
+extern ctf_file_t *ctf_modopen(struct module *, int *);
+
+#endif
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _CTF_API_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h
new file mode 100644
index 0000000..9da7051
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h
@@ -0,0 +1,2272 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_DTRACE_H
+#define	_SYS_DTRACE_H
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/*
+ * DTrace Dynamic Tracing Software: Kernel Interfaces
+ *
+ * Note: The contents of this file are private to the implementation of the
+ * Solaris system and DTrace subsystem and are subject to change at any time
+ * without notice.  Applications and drivers using these interfaces will fail
+ * to run on future releases.  These interfaces should not be used for any
+ * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB).
+ * Please refer to the "Solaris Dynamic Tracing Guide" for more information.
+ */
+
+#ifndef _ASM
+
+#ifndef VBOX
+#include <sys/types.h>
+#include <sys/modctl.h>
+#include <sys/processor.h>
+#include <sys/systm.h>
+#include <sys/cyclic.h>
+#include <sys/int_limits.h>
+#else
+# include <VBoxDTraceTypes.h>
+# include <sys/ctf_api.h>
+#endif
+
+/*
+ * DTrace Universal Constants and Typedefs
+ */
+#define	DTRACE_CPUALL		-1	/* all CPUs */
+#define	DTRACE_IDNONE		0	/* invalid probe identifier */
+#define	DTRACE_EPIDNONE		0	/* invalid enabled probe identifier */
+#define	DTRACE_AGGIDNONE	0	/* invalid aggregation identifier */
+#define	DTRACE_AGGVARIDNONE	0	/* invalid aggregation variable ID */
+#define	DTRACE_CACHEIDNONE	0	/* invalid predicate cache */
+#define	DTRACE_PROVNONE		0	/* invalid provider identifier */
+#define	DTRACE_METAPROVNONE	0	/* invalid meta-provider identifier */
+#define	DTRACE_ARGNONE		-1	/* invalid argument index */
+
+#define	DTRACE_PROVNAMELEN	64
+#define	DTRACE_MODNAMELEN	64
+#define	DTRACE_FUNCNAMELEN	128
+#define	DTRACE_NAMELEN		64
+#define	DTRACE_FULLNAMELEN	(DTRACE_PROVNAMELEN + DTRACE_MODNAMELEN + \
+				DTRACE_FUNCNAMELEN + DTRACE_NAMELEN + 4)
+#define	DTRACE_ARGTYPELEN	128
+
+typedef uint32_t dtrace_id_t;		/* probe identifier */
+typedef uint32_t dtrace_epid_t;		/* enabled probe identifier */
+typedef uint32_t dtrace_aggid_t;	/* aggregation identifier */
+typedef int64_t dtrace_aggvarid_t;	/* aggregation variable identifier */
+typedef uint16_t dtrace_actkind_t;	/* action kind */
+typedef int64_t dtrace_optval_t;	/* option value */
+typedef uint32_t dtrace_cacheid_t;	/* predicate cache identifier */
+
+typedef enum dtrace_probespec {
+	DTRACE_PROBESPEC_NONE = -1,
+	DTRACE_PROBESPEC_PROVIDER = 0,
+	DTRACE_PROBESPEC_MOD,
+	DTRACE_PROBESPEC_FUNC,
+	DTRACE_PROBESPEC_NAME
+} dtrace_probespec_t;
+
+/*
+ * DTrace Intermediate Format (DIF)
+ *
+ * The following definitions describe the DTrace Intermediate Format (DIF), a
+ * a RISC-like instruction set and program encoding used to represent
+ * predicates and actions that can be bound to DTrace probes.  The constants
+ * below defining the number of available registers are suggested minimums; the
+ * compiler should use DTRACEIOC_CONF to dynamically obtain the number of
+ * registers provided by the current DTrace implementation.
+ */
+#define	DIF_VERSION_1	1		/* DIF version 1: Solaris 10 Beta */
+#define	DIF_VERSION_2	2		/* DIF version 2: Solaris 10 FCS */
+#define	DIF_VERSION	DIF_VERSION_2	/* latest DIF instruction set version */
+#define	DIF_DIR_NREGS	8		/* number of DIF integer registers */
+#define	DIF_DTR_NREGS	8		/* number of DIF tuple registers */
+
+#define	DIF_OP_OR	1		/* or	r1, r2, rd */
+#define	DIF_OP_XOR	2		/* xor	r1, r2, rd */
+#define	DIF_OP_AND	3		/* and	r1, r2, rd */
+#define	DIF_OP_SLL	4		/* sll	r1, r2, rd */
+#define	DIF_OP_SRL	5		/* srl	r1, r2, rd */
+#define	DIF_OP_SUB	6		/* sub	r1, r2, rd */
+#define	DIF_OP_ADD	7		/* add	r1, r2, rd */
+#define	DIF_OP_MUL	8		/* mul	r1, r2, rd */
+#define	DIF_OP_SDIV	9		/* sdiv	r1, r2, rd */
+#define	DIF_OP_UDIV	10		/* udiv r1, r2, rd */
+#define	DIF_OP_SREM	11		/* srem r1, r2, rd */
+#define	DIF_OP_UREM	12		/* urem r1, r2, rd */
+#define	DIF_OP_NOT	13		/* not	r1, rd */
+#define	DIF_OP_MOV	14		/* mov	r1, rd */
+#define	DIF_OP_CMP	15		/* cmp	r1, r2 */
+#define	DIF_OP_TST	16		/* tst  r1 */
+#define	DIF_OP_BA	17		/* ba	label */
+#define	DIF_OP_BE	18		/* be	label */
+#define	DIF_OP_BNE	19		/* bne	label */
+#define	DIF_OP_BG	20		/* bg	label */
+#define	DIF_OP_BGU	21		/* bgu	label */
+#define	DIF_OP_BGE	22		/* bge	label */
+#define	DIF_OP_BGEU	23		/* bgeu	label */
+#define	DIF_OP_BL	24		/* bl	label */
+#define	DIF_OP_BLU	25		/* blu	label */
+#define	DIF_OP_BLE	26		/* ble	label */
+#define	DIF_OP_BLEU	27		/* bleu	label */
+#define	DIF_OP_LDSB	28		/* ldsb	[r1], rd */
+#define	DIF_OP_LDSH	29		/* ldsh	[r1], rd */
+#define	DIF_OP_LDSW	30		/* ldsw [r1], rd */
+#define	DIF_OP_LDUB	31		/* ldub	[r1], rd */
+#define	DIF_OP_LDUH	32		/* lduh	[r1], rd */
+#define	DIF_OP_LDUW	33		/* lduw	[r1], rd */
+#define	DIF_OP_LDX	34		/* ldx	[r1], rd */
+#define	DIF_OP_RET	35		/* ret	rd */
+#define	DIF_OP_NOP	36		/* nop */
+#define	DIF_OP_SETX	37		/* setx	intindex, rd */
+#define	DIF_OP_SETS	38		/* sets strindex, rd */
+#define	DIF_OP_SCMP	39		/* scmp	r1, r2 */
+#define	DIF_OP_LDGA	40		/* ldga	var, ri, rd */
+#define	DIF_OP_LDGS	41		/* ldgs var, rd */
+#define	DIF_OP_STGS	42		/* stgs var, rs */
+#define	DIF_OP_LDTA	43		/* ldta var, ri, rd */
+#define	DIF_OP_LDTS	44		/* ldts var, rd */
+#define	DIF_OP_STTS	45		/* stts var, rs */
+#define	DIF_OP_SRA	46		/* sra	r1, r2, rd */
+#define	DIF_OP_CALL	47		/* call	subr, rd */
+#define	DIF_OP_PUSHTR	48		/* pushtr type, rs, rr */
+#define	DIF_OP_PUSHTV	49		/* pushtv type, rs, rv */
+#define	DIF_OP_POPTS	50		/* popts */
+#define	DIF_OP_FLUSHTS	51		/* flushts */
+#define	DIF_OP_LDGAA	52		/* ldgaa var, rd */
+#define	DIF_OP_LDTAA	53		/* ldtaa var, rd */
+#define	DIF_OP_STGAA	54		/* stgaa var, rs */
+#define	DIF_OP_STTAA	55		/* sttaa var, rs */
+#define	DIF_OP_LDLS	56		/* ldls	var, rd */
+#define	DIF_OP_STLS	57		/* stls	var, rs */
+#define	DIF_OP_ALLOCS	58		/* allocs r1, rd */
+#define	DIF_OP_COPYS	59		/* copys  r1, r2, rd */
+#define	DIF_OP_STB	60		/* stb	r1, [rd] */
+#define	DIF_OP_STH	61		/* sth	r1, [rd] */
+#define	DIF_OP_STW	62		/* stw	r1, [rd] */
+#define	DIF_OP_STX	63		/* stx	r1, [rd] */
+#define	DIF_OP_ULDSB	64		/* uldsb [r1], rd */
+#define	DIF_OP_ULDSH	65		/* uldsh [r1], rd */
+#define	DIF_OP_ULDSW	66		/* uldsw [r1], rd */
+#define	DIF_OP_ULDUB	67		/* uldub [r1], rd */
+#define	DIF_OP_ULDUH	68		/* ulduh [r1], rd */
+#define	DIF_OP_ULDUW	69		/* ulduw [r1], rd */
+#define	DIF_OP_ULDX	70		/* uldx  [r1], rd */
+#define	DIF_OP_RLDSB	71		/* rldsb [r1], rd */
+#define	DIF_OP_RLDSH	72		/* rldsh [r1], rd */
+#define	DIF_OP_RLDSW	73		/* rldsw [r1], rd */
+#define	DIF_OP_RLDUB	74		/* rldub [r1], rd */
+#define	DIF_OP_RLDUH	75		/* rlduh [r1], rd */
+#define	DIF_OP_RLDUW	76		/* rlduw [r1], rd */
+#define	DIF_OP_RLDX	77		/* rldx  [r1], rd */
+#define	DIF_OP_XLATE	78		/* xlate xlrindex, rd */
+#define	DIF_OP_XLARG	79		/* xlarg xlrindex, rd */
+
+#define	DIF_INTOFF_MAX		0xffff	/* highest integer table offset */
+#define	DIF_STROFF_MAX		0xffff	/* highest string table offset */
+#define	DIF_REGISTER_MAX	0xff	/* highest register number */
+#define	DIF_VARIABLE_MAX	0xffff	/* highest variable identifier */
+#define	DIF_SUBROUTINE_MAX	0xffff	/* highest subroutine code */
+
+#define	DIF_VAR_ARRAY_MIN	0x0000	/* lowest numbered array variable */
+#define	DIF_VAR_ARRAY_UBASE	0x0080	/* lowest user-defined array */
+#define	DIF_VAR_ARRAY_MAX	0x00ff	/* highest numbered array variable */
+
+#define	DIF_VAR_OTHER_MIN	0x0100	/* lowest numbered scalar or assc */
+#define	DIF_VAR_OTHER_UBASE	0x0500	/* lowest user-defined scalar or assc */
+#define	DIF_VAR_OTHER_MAX	0xffff	/* highest numbered scalar or assc */
+
+#define	DIF_VAR_ARGS		0x0000	/* arguments array */
+#define	DIF_VAR_REGS		0x0001	/* registers array */
+#define	DIF_VAR_UREGS		0x0002	/* user registers array */
+#define	DIF_VAR_CURTHREAD	0x0100	/* thread pointer */
+#define	DIF_VAR_TIMESTAMP	0x0101	/* timestamp */
+#define	DIF_VAR_VTIMESTAMP	0x0102	/* virtual timestamp */
+#define	DIF_VAR_IPL		0x0103	/* interrupt priority level */
+#define	DIF_VAR_EPID		0x0104	/* enabled probe ID */
+#define	DIF_VAR_ID		0x0105	/* probe ID */
+#define	DIF_VAR_ARG0		0x0106	/* first argument */
+#define	DIF_VAR_ARG1		0x0107	/* second argument */
+#define	DIF_VAR_ARG2		0x0108	/* third argument */
+#define	DIF_VAR_ARG3		0x0109	/* fourth argument */
+#define	DIF_VAR_ARG4		0x010a	/* fifth argument */
+#define	DIF_VAR_ARG5		0x010b	/* sixth argument */
+#define	DIF_VAR_ARG6		0x010c	/* seventh argument */
+#define	DIF_VAR_ARG7		0x010d	/* eighth argument */
+#define	DIF_VAR_ARG8		0x010e	/* ninth argument */
+#define	DIF_VAR_ARG9		0x010f	/* tenth argument */
+#define	DIF_VAR_STACKDEPTH	0x0110	/* stack depth */
+#define	DIF_VAR_CALLER		0x0111	/* caller */
+#define	DIF_VAR_PROBEPROV	0x0112	/* probe provider */
+#define	DIF_VAR_PROBEMOD	0x0113	/* probe module */
+#define	DIF_VAR_PROBEFUNC	0x0114	/* probe function */
+#define	DIF_VAR_PROBENAME	0x0115	/* probe name */
+#define	DIF_VAR_PID		0x0116	/* process ID */
+#define	DIF_VAR_TID		0x0117	/* (per-process) thread ID */
+#define	DIF_VAR_EXECNAME	0x0118	/* name of executable */
+#define	DIF_VAR_ZONENAME	0x0119	/* zone name associated with process */
+#define	DIF_VAR_WALLTIMESTAMP	0x011a	/* wall-clock timestamp */
+#define	DIF_VAR_USTACKDEPTH	0x011b	/* user-land stack depth */
+#define	DIF_VAR_UCALLER		0x011c	/* user-level caller */
+#define	DIF_VAR_PPID		0x011d	/* parent process ID */
+#define	DIF_VAR_UID		0x011e	/* process user ID */
+#define	DIF_VAR_GID		0x011f	/* process group ID */
+#define	DIF_VAR_ERRNO		0x0120	/* thread errno */
+
+#define	DIF_SUBR_RAND			0
+#define	DIF_SUBR_MUTEX_OWNED		1
+#define	DIF_SUBR_MUTEX_OWNER		2
+#define	DIF_SUBR_MUTEX_TYPE_ADAPTIVE	3
+#define	DIF_SUBR_MUTEX_TYPE_SPIN	4
+#define	DIF_SUBR_RW_READ_HELD		5
+#define	DIF_SUBR_RW_WRITE_HELD		6
+#define	DIF_SUBR_RW_ISWRITER		7
+#define	DIF_SUBR_COPYIN			8
+#define	DIF_SUBR_COPYINSTR		9
+#define	DIF_SUBR_SPECULATION		10
+#define	DIF_SUBR_PROGENYOF		11
+#define	DIF_SUBR_STRLEN			12
+#define	DIF_SUBR_COPYOUT		13
+#define	DIF_SUBR_COPYOUTSTR		14
+#define	DIF_SUBR_ALLOCA			15
+#define	DIF_SUBR_BCOPY			16
+#define	DIF_SUBR_COPYINTO		17
+#define	DIF_SUBR_MSGDSIZE		18
+#define	DIF_SUBR_MSGSIZE		19
+#define	DIF_SUBR_GETMAJOR		20
+#define	DIF_SUBR_GETMINOR		21
+#define	DIF_SUBR_DDI_PATHNAME		22
+#define	DIF_SUBR_STRJOIN		23
+#define	DIF_SUBR_LLTOSTR		24
+#define	DIF_SUBR_BASENAME		25
+#define	DIF_SUBR_DIRNAME		26
+#define	DIF_SUBR_CLEANPATH		27
+#define	DIF_SUBR_STRCHR			28
+#define	DIF_SUBR_STRRCHR		29
+#define	DIF_SUBR_STRSTR			30
+#define	DIF_SUBR_STRTOK			31
+#define	DIF_SUBR_SUBSTR			32
+#define	DIF_SUBR_INDEX			33
+#define	DIF_SUBR_RINDEX			34
+#define	DIF_SUBR_HTONS			35
+#define	DIF_SUBR_HTONL			36
+#define	DIF_SUBR_HTONLL			37
+#define	DIF_SUBR_NTOHS			38
+#define	DIF_SUBR_NTOHL			39
+#define	DIF_SUBR_NTOHLL			40
+#define	DIF_SUBR_INET_NTOP		41
+#define	DIF_SUBR_INET_NTOA		42
+#define	DIF_SUBR_INET_NTOA6		43
+
+#define	DIF_SUBR_MAX			43	/* max subroutine value */
+
+typedef uint32_t dif_instr_t;
+
+#define	DIF_INSTR_OP(i)			(((i) >> 24) & 0xff)
+#define	DIF_INSTR_R1(i)			(((i) >> 16) & 0xff)
+#define	DIF_INSTR_R2(i)			(((i) >>  8) & 0xff)
+#define	DIF_INSTR_RD(i)			((i) & 0xff)
+#define	DIF_INSTR_RS(i)			((i) & 0xff)
+#define	DIF_INSTR_LABEL(i)		((i) & 0xffffff)
+#define	DIF_INSTR_VAR(i)		(((i) >>  8) & 0xffff)
+#define	DIF_INSTR_INTEGER(i)		(((i) >>  8) & 0xffff)
+#define	DIF_INSTR_STRING(i)		(((i) >>  8) & 0xffff)
+#define	DIF_INSTR_SUBR(i)		(((i) >>  8) & 0xffff)
+#define	DIF_INSTR_TYPE(i)		(((i) >> 16) & 0xff)
+#define	DIF_INSTR_XLREF(i)		(((i) >>  8) & 0xffff)
+
+#define	DIF_INSTR_FMT(op, r1, r2, d) \
+	(((op) << 24) | ((r1) << 16) | ((r2) << 8) | (d))
+
+#define	DIF_INSTR_NOT(r1, d)		(DIF_INSTR_FMT(DIF_OP_NOT, r1, 0, d))
+#define	DIF_INSTR_MOV(r1, d)		(DIF_INSTR_FMT(DIF_OP_MOV, r1, 0, d))
+#define	DIF_INSTR_CMP(op, r1, r2)	(DIF_INSTR_FMT(op, r1, r2, 0))
+#define	DIF_INSTR_TST(r1)		(DIF_INSTR_FMT(DIF_OP_TST, r1, 0, 0))
+#define	DIF_INSTR_BRANCH(op, label)	(((op) << 24) | (label))
+#define	DIF_INSTR_LOAD(op, r1, d)	(DIF_INSTR_FMT(op, r1, 0, d))
+#define	DIF_INSTR_STORE(op, r1, d)	(DIF_INSTR_FMT(op, r1, 0, d))
+#define	DIF_INSTR_SETX(i, d)		((DIF_OP_SETX << 24) | ((i) << 8) | (d))
+#define	DIF_INSTR_SETS(s, d)		((DIF_OP_SETS << 24) | ((s) << 8) | (d))
+#define	DIF_INSTR_RET(d)		(DIF_INSTR_FMT(DIF_OP_RET, 0, 0, d))
+#define	DIF_INSTR_NOP			(DIF_OP_NOP << 24)
+#define	DIF_INSTR_LDA(op, v, r, d)	(DIF_INSTR_FMT(op, v, r, d))
+#define	DIF_INSTR_LDV(op, v, d)		(((op) << 24) | ((v) << 8) | (d))
+#define	DIF_INSTR_STV(op, v, rs)	(((op) << 24) | ((v) << 8) | (rs))
+#define	DIF_INSTR_CALL(s, d)		((DIF_OP_CALL << 24) | ((s) << 8) | (d))
+#define	DIF_INSTR_PUSHTS(op, t, r2, rs)	(DIF_INSTR_FMT(op, t, r2, rs))
+#define	DIF_INSTR_POPTS			(DIF_OP_POPTS << 24)
+#define	DIF_INSTR_FLUSHTS		(DIF_OP_FLUSHTS << 24)
+#define	DIF_INSTR_ALLOCS(r1, d)		(DIF_INSTR_FMT(DIF_OP_ALLOCS, r1, 0, d))
+#define	DIF_INSTR_COPYS(r1, r2, d)	(DIF_INSTR_FMT(DIF_OP_COPYS, r1, r2, d))
+#define	DIF_INSTR_XLATE(op, r, d)	(((op) << 24) | ((r) << 8) | (d))
+
+#define	DIF_REG_R0	0		/* %r0 is always set to zero */
+
+/*
+ * A DTrace Intermediate Format Type (DIF Type) is used to represent the types
+ * of variables, function and associative array arguments, and the return type
+ * for each DIF object (shown below).  It contains a description of the type,
+ * its size in bytes, and a module identifier.
+ */
+typedef struct dtrace_diftype {
+	uint8_t dtdt_kind;		/* type kind (see below) */
+	uint8_t dtdt_ckind;		/* type kind in CTF */
+	uint8_t dtdt_flags;		/* type flags (see below) */
+	uint8_t dtdt_pad;		/* reserved for future use */
+	uint32_t dtdt_size;		/* type size in bytes (unless string) */
+} dtrace_diftype_t;
+
+#define	DIF_TYPE_CTF		0	/* type is a CTF type */
+#define	DIF_TYPE_STRING		1	/* type is a D string */
+
+#define	DIF_TF_BYREF		0x1	/* type is passed by reference */
+
+/*
+ * A DTrace Intermediate Format variable record is used to describe each of the
+ * variables referenced by a given DIF object.  It contains an integer variable
+ * identifier along with variable scope and properties, as shown below.  The
+ * size of this structure must be sizeof (int) aligned.
+ */
+typedef struct dtrace_difv {
+	uint32_t dtdv_name;		/* variable name index in dtdo_strtab */
+	uint32_t dtdv_id;		/* variable reference identifier */
+	uint8_t dtdv_kind;		/* variable kind (see below) */
+	uint8_t dtdv_scope;		/* variable scope (see below) */
+	uint16_t dtdv_flags;		/* variable flags (see below) */
+	dtrace_diftype_t dtdv_type;	/* variable type (see above) */
+} dtrace_difv_t;
+
+#define	DIFV_KIND_ARRAY		0	/* variable is an array of quantities */
+#define	DIFV_KIND_SCALAR	1	/* variable is a scalar quantity */
+
+#define	DIFV_SCOPE_GLOBAL	0	/* variable has global scope */
+#define	DIFV_SCOPE_THREAD	1	/* variable has thread scope */
+#define	DIFV_SCOPE_LOCAL	2	/* variable has local scope */
+
+#define	DIFV_F_REF		0x1	/* variable is referenced by DIFO */
+#define	DIFV_F_MOD		0x2	/* variable is written by DIFO */
+
+/*
+ * DTrace Actions
+ *
+ * The upper byte determines the class of the action; the low bytes determines
+ * the specific action within that class.  The classes of actions are as
+ * follows:
+ *
+ *   [ no class ]                  <= May record process- or kernel-related data
+ *   DTRACEACT_PROC                <= Only records process-related data
+ *   DTRACEACT_PROC_DESTRUCTIVE    <= Potentially destructive to processes
+ *   DTRACEACT_KERNEL              <= Only records kernel-related data
+ *   DTRACEACT_KERNEL_DESTRUCTIVE  <= Potentially destructive to the kernel
+ *   DTRACEACT_SPECULATIVE         <= Speculation-related action
+ *   DTRACEACT_AGGREGATION         <= Aggregating action
+ */
+#define	DTRACEACT_NONE			0	/* no action */
+#define	DTRACEACT_DIFEXPR		1	/* action is DIF expression */
+#define	DTRACEACT_EXIT			2	/* exit() action */
+#define	DTRACEACT_PRINTF		3	/* printf() action */
+#define	DTRACEACT_PRINTA		4	/* printa() action */
+#define	DTRACEACT_LIBACT		5	/* library-controlled action */
+
+#define	DTRACEACT_PROC			0x0100
+#define	DTRACEACT_USTACK		(DTRACEACT_PROC + 1)
+#define	DTRACEACT_JSTACK		(DTRACEACT_PROC + 2)
+#define	DTRACEACT_USYM			(DTRACEACT_PROC + 3)
+#define	DTRACEACT_UMOD			(DTRACEACT_PROC + 4)
+#define	DTRACEACT_UADDR			(DTRACEACT_PROC + 5)
+
+#define	DTRACEACT_PROC_DESTRUCTIVE	0x0200
+#define	DTRACEACT_STOP			(DTRACEACT_PROC_DESTRUCTIVE + 1)
+#define	DTRACEACT_RAISE			(DTRACEACT_PROC_DESTRUCTIVE + 2)
+#define	DTRACEACT_SYSTEM		(DTRACEACT_PROC_DESTRUCTIVE + 3)
+#define	DTRACEACT_FREOPEN		(DTRACEACT_PROC_DESTRUCTIVE + 4)
+
+#define	DTRACEACT_PROC_CONTROL		0x0300
+
+#define	DTRACEACT_KERNEL		0x0400
+#define	DTRACEACT_STACK			(DTRACEACT_KERNEL + 1)
+#define	DTRACEACT_SYM			(DTRACEACT_KERNEL + 2)
+#define	DTRACEACT_MOD			(DTRACEACT_KERNEL + 3)
+
+#define	DTRACEACT_KERNEL_DESTRUCTIVE	0x0500
+#define	DTRACEACT_BREAKPOINT		(DTRACEACT_KERNEL_DESTRUCTIVE + 1)
+#define	DTRACEACT_PANIC			(DTRACEACT_KERNEL_DESTRUCTIVE + 2)
+#define	DTRACEACT_CHILL			(DTRACEACT_KERNEL_DESTRUCTIVE + 3)
+
+#define	DTRACEACT_SPECULATIVE		0x0600
+#define	DTRACEACT_SPECULATE		(DTRACEACT_SPECULATIVE + 1)
+#define	DTRACEACT_COMMIT		(DTRACEACT_SPECULATIVE + 2)
+#define	DTRACEACT_DISCARD		(DTRACEACT_SPECULATIVE + 3)
+
+#define	DTRACEACT_CLASS(x)		((x) & 0xff00)
+
+#define	DTRACEACT_ISDESTRUCTIVE(x)	\
+	(DTRACEACT_CLASS(x) == DTRACEACT_PROC_DESTRUCTIVE || \
+	DTRACEACT_CLASS(x) == DTRACEACT_KERNEL_DESTRUCTIVE)
+
+#define	DTRACEACT_ISSPECULATIVE(x)	\
+	(DTRACEACT_CLASS(x) == DTRACEACT_SPECULATIVE)
+
+#define	DTRACEACT_ISPRINTFLIKE(x)	\
+	((x) == DTRACEACT_PRINTF || (x) == DTRACEACT_PRINTA || \
+	(x) == DTRACEACT_SYSTEM || (x) == DTRACEACT_FREOPEN)
+
+/*
+ * DTrace Aggregating Actions
+ *
+ * These are functions f(x) for which the following is true:
+ *
+ *    f(f(x_0) U f(x_1) U ... U f(x_n)) = f(x_0 U x_1 U ... U x_n)
+ *
+ * where x_n is a set of arbitrary data.  Aggregating actions are in their own
+ * DTrace action class, DTTRACEACT_AGGREGATION.  The macros provided here allow
+ * for easier processing of the aggregation argument and data payload for a few
+ * aggregating actions (notably:  quantize(), lquantize(), and ustack()).
+ */
+#define	DTRACEACT_AGGREGATION		0x0700
+#define	DTRACEAGG_COUNT			(DTRACEACT_AGGREGATION + 1)
+#define	DTRACEAGG_MIN			(DTRACEACT_AGGREGATION + 2)
+#define	DTRACEAGG_MAX			(DTRACEACT_AGGREGATION + 3)
+#define	DTRACEAGG_AVG			(DTRACEACT_AGGREGATION + 4)
+#define	DTRACEAGG_SUM			(DTRACEACT_AGGREGATION + 5)
+#define	DTRACEAGG_STDDEV		(DTRACEACT_AGGREGATION + 6)
+#define	DTRACEAGG_QUANTIZE		(DTRACEACT_AGGREGATION + 7)
+#define	DTRACEAGG_LQUANTIZE		(DTRACEACT_AGGREGATION + 8)
+
+#define	DTRACEACT_ISAGG(x)		\
+	(DTRACEACT_CLASS(x) == DTRACEACT_AGGREGATION)
+
+#define	DTRACE_QUANTIZE_NBUCKETS	\
+	(((sizeof (uint64_t) * NBBY) - 1) * 2 + 1)
+
+#define	DTRACE_QUANTIZE_ZEROBUCKET	(VBDTCAST(int)(sizeof (uint64_t) * NBBY) - 1)
+
+#define	DTRACE_QUANTIZE_BUCKETVAL(buck)					\
+	(int64_t)((buck) < DTRACE_QUANTIZE_ZEROBUCKET ?			\
+	-(1LL << (DTRACE_QUANTIZE_ZEROBUCKET - 1 - (buck))) :		\
+	(buck) == DTRACE_QUANTIZE_ZEROBUCKET ? 0 :			\
+	1LL << ((buck) - DTRACE_QUANTIZE_ZEROBUCKET - 1))
+
+#define	DTRACE_LQUANTIZE_STEPSHIFT		48
+#define	DTRACE_LQUANTIZE_STEPMASK		((uint64_t)UINT16_MAX << 48)
+#define	DTRACE_LQUANTIZE_LEVELSHIFT		32
+#define	DTRACE_LQUANTIZE_LEVELMASK		((uint64_t)UINT16_MAX << 32)
+#define	DTRACE_LQUANTIZE_BASESHIFT		0
+#define	DTRACE_LQUANTIZE_BASEMASK		UINT32_MAX
+
+#define	DTRACE_LQUANTIZE_STEP(x)		\
+	(uint16_t)(((x) & DTRACE_LQUANTIZE_STEPMASK) >> \
+	DTRACE_LQUANTIZE_STEPSHIFT)
+
+#define	DTRACE_LQUANTIZE_LEVELS(x)		\
+	(uint16_t)(((x) & DTRACE_LQUANTIZE_LEVELMASK) >> \
+	DTRACE_LQUANTIZE_LEVELSHIFT)
+
+#define	DTRACE_LQUANTIZE_BASE(x)		\
+	(int32_t)(((x) & DTRACE_LQUANTIZE_BASEMASK) >> \
+	DTRACE_LQUANTIZE_BASESHIFT)
+
+#define	DTRACE_USTACK_NFRAMES(x)	(uint32_t)((x) & UINT32_MAX)
+#define	DTRACE_USTACK_STRSIZE(x)	(uint32_t)((x) >> 32)
+#define	DTRACE_USTACK_ARG(x, y)		\
+	((((uint64_t)(y)) << 32) | ((x) & UINT32_MAX))
+
+#ifndef _LP64
+#ifndef _LITTLE_ENDIAN
+#define	DTRACE_PTR(type, name)	uint32_t name##pad; type *name
+#else
+#define	DTRACE_PTR(type, name)	type *name; uint32_t name##pad
+#endif
+#else
+#define	DTRACE_PTR(type, name)	type *name
+#endif
+
+/*
+ * DTrace Object Format (DOF)
+ *
+ * DTrace programs can be persistently encoded in the DOF format so that they
+ * may be embedded in other programs (for example, in an ELF file) or in the
+ * dtrace driver configuration file for use in anonymous tracing.  The DOF
+ * format is versioned and extensible so that it can be revised and so that
+ * internal data structures can be modified or extended compatibly.  All DOF
+ * structures use fixed-size types, so the 32-bit and 64-bit representations
+ * are identical and consumers can use either data model transparently.
+ *
+ * The file layout is structured as follows:
+ *
+ * +---------------+-------------------+----- ... ----+---- ... ------+
+ * |   dof_hdr_t   |  dof_sec_t[ ... ] |   loadable   | non-loadable  |
+ * | (file header) | (section headers) | section data | section data  |
+ * +---------------+-------------------+----- ... ----+---- ... ------+
+ * |<------------ dof_hdr.dofh_loadsz --------------->|               |
+ * |<------------ dof_hdr.dofh_filesz ------------------------------->|
+ *
+ * The file header stores meta-data including a magic number, data model for
+ * the instrumentation, data encoding, and properties of the DIF code within.
+ * The header describes its own size and the size of the section headers.  By
+ * convention, an array of section headers follows the file header, and then
+ * the data for all loadable sections and unloadable sections.  This permits
+ * consumer code to easily download the headers and all loadable data into the
+ * DTrace driver in one contiguous chunk, omitting other extraneous sections.
+ *
+ * The section headers describe the size, offset, alignment, and section type
+ * for each section.  Sections are described using a set of #defines that tell
+ * the consumer what kind of data is expected.  Sections can contain links to
+ * other sections by storing a dof_secidx_t, an index into the section header
+ * array, inside of the section data structures.  The section header includes
+ * an entry size so that sections with data arrays can grow their structures.
+ *
+ * The DOF data itself can contain many snippets of DIF (i.e. >1 DIFOs), which
+ * are represented themselves as a collection of related DOF sections.  This
+ * permits us to change the set of sections associated with a DIFO over time,
+ * and also permits us to encode DIFOs that contain different sets of sections.
+ * When a DOF section wants to refer to a DIFO, it stores the dof_secidx_t of a
+ * section of type DOF_SECT_DIFOHDR.  This section's data is then an array of
+ * dof_secidx_t's which in turn denote the sections associated with this DIFO.
+ *
+ * This loose coupling of the file structure (header and sections) to the
+ * structure of the DTrace program itself (ECB descriptions, action
+ * descriptions, and DIFOs) permits activities such as relocation processing
+ * to occur in a single pass without having to understand D program structure.
+ *
+ * Finally, strings are always stored in ELF-style string tables along with a
+ * string table section index and string table offset.  Therefore strings in
+ * DOF are always arbitrary-length and not bound to the current implementation.
+ */
+
+#define	DOF_ID_SIZE	16	/* total size of dofh_ident[] in bytes */
+
+typedef struct dof_hdr {
+	uint8_t dofh_ident[DOF_ID_SIZE]; /* identification bytes (see below) */
+	uint32_t dofh_flags;		/* file attribute flags (if any) */
+	uint32_t dofh_hdrsize;		/* size of file header in bytes */
+	uint32_t dofh_secsize;		/* size of section header in bytes */
+	uint32_t dofh_secnum;		/* number of section headers */
+	uint64_t dofh_secoff;		/* file offset of section headers */
+	uint64_t dofh_loadsz;		/* file size of loadable portion */
+	uint64_t dofh_filesz;		/* file size of entire DOF file */
+	uint64_t dofh_pad;		/* reserved for future use */
+} dof_hdr_t;
+
+#define	DOF_ID_MAG0	0	/* first byte of magic number */
+#define	DOF_ID_MAG1	1	/* second byte of magic number */
+#define	DOF_ID_MAG2	2	/* third byte of magic number */
+#define	DOF_ID_MAG3	3	/* fourth byte of magic number */
+#define	DOF_ID_MODEL	4	/* DOF data model (see below) */
+#define	DOF_ID_ENCODING	5	/* DOF data encoding (see below) */
+#define	DOF_ID_VERSION	6	/* DOF file format major version (see below) */
+#define	DOF_ID_DIFVERS	7	/* DIF instruction set version */
+#define	DOF_ID_DIFIREG	8	/* DIF integer registers used by compiler */
+#define	DOF_ID_DIFTREG	9	/* DIF tuple registers used by compiler */
+#define	DOF_ID_PAD	10	/* start of padding bytes (all zeroes) */
+
+#define	DOF_MAG_MAG0	0x7F	/* DOF_ID_MAG[0-3] */
+#define	DOF_MAG_MAG1	'D'
+#define	DOF_MAG_MAG2	'O'
+#define	DOF_MAG_MAG3	'F'
+
+#define	DOF_MAG_STRING	"\177DOF"
+#define	DOF_MAG_STRLEN	4
+
+#define	DOF_MODEL_NONE	0	/* DOF_ID_MODEL */
+#define	DOF_MODEL_ILP32	1
+#define	DOF_MODEL_LP64	2
+
+#ifdef _LP64
+#define	DOF_MODEL_NATIVE	DOF_MODEL_LP64
+#else
+#define	DOF_MODEL_NATIVE	DOF_MODEL_ILP32
+#endif
+
+#define	DOF_ENCODE_NONE	0	/* DOF_ID_ENCODING */
+#define	DOF_ENCODE_LSB	1
+#define	DOF_ENCODE_MSB	2
+
+#ifdef _BIG_ENDIAN
+#define	DOF_ENCODE_NATIVE	DOF_ENCODE_MSB
+#else
+#define	DOF_ENCODE_NATIVE	DOF_ENCODE_LSB
+#endif
+
+#define	DOF_VERSION_1	1	/* DOF version 1: Solaris 10 FCS */
+#define	DOF_VERSION_2	2	/* DOF version 2: Solaris Express 6/06 */
+#define	DOF_VERSION	DOF_VERSION_2	/* Latest DOF version */
+
+#define	DOF_FL_VALID	0	/* mask of all valid dofh_flags bits */
+
+typedef uint32_t dof_secidx_t;	/* section header table index type */
+typedef uint32_t dof_stridx_t;	/* string table index type */
+
+#define	DOF_SECIDX_NONE	(~1U)	/* null value for section indices */
+#define	DOF_STRIDX_NONE	(~1U)	/* null value for string indices */
+
+typedef struct dof_sec {
+	uint32_t dofs_type;	/* section type (see below) */
+	uint32_t dofs_align;	/* section data memory alignment */
+	uint32_t dofs_flags;	/* section flags (if any) */
+	uint32_t dofs_entsize;	/* size of section entry (if table) */
+	uint64_t dofs_offset;	/* offset of section data within file */
+	uint64_t dofs_size;	/* size of section data in bytes */
+} dof_sec_t;
+
+#define	DOF_SECT_NONE		0	/* null section */
+#define	DOF_SECT_COMMENTS	1	/* compiler comments */
+#define	DOF_SECT_SOURCE		2	/* D program source code */
+#define	DOF_SECT_ECBDESC	3	/* dof_ecbdesc_t */
+#define	DOF_SECT_PROBEDESC	4	/* dof_probedesc_t */
+#define	DOF_SECT_ACTDESC	5	/* dof_actdesc_t array */
+#define	DOF_SECT_DIFOHDR	6	/* dof_difohdr_t (variable length) */
+#define	DOF_SECT_DIF		7	/* uint32_t array of byte code */
+#define	DOF_SECT_STRTAB		8	/* string table */
+#define	DOF_SECT_VARTAB		9	/* dtrace_difv_t array */
+#define	DOF_SECT_RELTAB		10	/* dof_relodesc_t array */
+#define	DOF_SECT_TYPTAB		11	/* dtrace_diftype_t array */
+#define	DOF_SECT_URELHDR	12	/* dof_relohdr_t (user relocations) */
+#define	DOF_SECT_KRELHDR	13	/* dof_relohdr_t (kernel relocations) */
+#define	DOF_SECT_OPTDESC	14	/* dof_optdesc_t array */
+#define	DOF_SECT_PROVIDER	15	/* dof_provider_t */
+#define	DOF_SECT_PROBES		16	/* dof_probe_t array */
+#define	DOF_SECT_PRARGS		17	/* uint8_t array (probe arg mappings) */
+#define	DOF_SECT_PROFFS		18	/* uint32_t array (probe arg offsets) */
+#define	DOF_SECT_INTTAB		19	/* uint64_t array */
+#define	DOF_SECT_UTSNAME	20	/* struct utsname */
+#define	DOF_SECT_XLTAB		21	/* dof_xlref_t array */
+#define	DOF_SECT_XLMEMBERS	22	/* dof_xlmember_t array */
+#define	DOF_SECT_XLIMPORT	23	/* dof_xlator_t */
+#define	DOF_SECT_XLEXPORT	24	/* dof_xlator_t */
+#define	DOF_SECT_PREXPORT	25	/* dof_secidx_t array (exported objs) */
+#define	DOF_SECT_PRENOFFS	26	/* uint32_t array (enabled offsets) */
+
+#define	DOF_SECF_LOAD		1	/* section should be loaded */
+
+#define	DOF_SEC_ISLOADABLE(x)						\
+	(((x) == DOF_SECT_ECBDESC) || ((x) == DOF_SECT_PROBEDESC) ||	\
+	((x) == DOF_SECT_ACTDESC) || ((x) == DOF_SECT_DIFOHDR) ||	\
+	((x) == DOF_SECT_DIF) || ((x) == DOF_SECT_STRTAB) ||		\
+	((x) == DOF_SECT_VARTAB) || ((x) == DOF_SECT_RELTAB) ||		\
+	((x) == DOF_SECT_TYPTAB) || ((x) == DOF_SECT_URELHDR) ||	\
+	((x) == DOF_SECT_KRELHDR) || ((x) == DOF_SECT_OPTDESC) ||	\
+	((x) == DOF_SECT_PROVIDER) || ((x) == DOF_SECT_PROBES) ||	\
+	((x) == DOF_SECT_PRARGS) || ((x) == DOF_SECT_PROFFS) ||		\
+	((x) == DOF_SECT_INTTAB) || ((x) == DOF_SECT_XLTAB) ||		\
+	((x) == DOF_SECT_XLMEMBERS) || ((x) == DOF_SECT_XLIMPORT) ||	\
+	((x) == DOF_SECT_XLIMPORT) || ((x) == DOF_SECT_XLEXPORT) ||	\
+	((x) == DOF_SECT_PREXPORT) || ((x) == DOF_SECT_PRENOFFS))
+
+typedef struct dof_ecbdesc {
+	dof_secidx_t dofe_probes;	/* link to DOF_SECT_PROBEDESC */
+	dof_secidx_t dofe_pred;		/* link to DOF_SECT_DIFOHDR */
+	dof_secidx_t dofe_actions;	/* link to DOF_SECT_ACTDESC */
+	uint32_t dofe_pad;		/* reserved for future use */
+	uint64_t dofe_uarg;		/* user-supplied library argument */
+} dof_ecbdesc_t;
+
+typedef struct dof_probedesc {
+	dof_secidx_t dofp_strtab;	/* link to DOF_SECT_STRTAB section */
+	dof_stridx_t dofp_provider;	/* provider string */
+	dof_stridx_t dofp_mod;		/* module string */
+	dof_stridx_t dofp_func;		/* function string */
+	dof_stridx_t dofp_name;		/* name string */
+	uint32_t dofp_id;		/* probe identifier (or zero) */
+} dof_probedesc_t;
+
+typedef struct dof_actdesc {
+	dof_secidx_t dofa_difo;		/* link to DOF_SECT_DIFOHDR */
+	dof_secidx_t dofa_strtab;	/* link to DOF_SECT_STRTAB section */
+	uint32_t dofa_kind;		/* action kind (DTRACEACT_* constant) */
+	uint32_t dofa_ntuple;		/* number of subsequent tuple actions */
+	uint64_t dofa_arg;		/* kind-specific argument */
+	uint64_t dofa_uarg;		/* user-supplied argument */
+} dof_actdesc_t;
+
+typedef struct dof_difohdr {
+	dtrace_diftype_t dofd_rtype;	/* return type for this fragment */
+	dof_secidx_t dofd_links[1];	/* variable length array of indices */
+} dof_difohdr_t;
+
+typedef struct dof_relohdr {
+	dof_secidx_t dofr_strtab;	/* link to DOF_SECT_STRTAB for names */
+	dof_secidx_t dofr_relsec;	/* link to DOF_SECT_RELTAB for relos */
+	dof_secidx_t dofr_tgtsec;	/* link to section we are relocating */
+} dof_relohdr_t;
+
+typedef struct dof_relodesc {
+	dof_stridx_t dofr_name;		/* string name of relocation symbol */
+	uint32_t dofr_type;		/* relo type (DOF_RELO_* constant) */
+	uint64_t dofr_offset;		/* byte offset for relocation */
+	uint64_t dofr_data;		/* additional type-specific data */
+} dof_relodesc_t;
+
+#define	DOF_RELO_NONE	0		/* empty relocation entry */
+#define	DOF_RELO_SETX	1		/* relocate setx value */
+
+typedef struct dof_optdesc {
+	uint32_t dofo_option;		/* option identifier */
+	dof_secidx_t dofo_strtab;	/* string table, if string option */
+	uint64_t dofo_value;		/* option value or string index */
+} dof_optdesc_t;
+
+typedef uint32_t dof_attr_t;		/* encoded stability attributes */
+
+#define	DOF_ATTR(n, d, c)	(((n) << 24) | ((d) << 16) | ((c) << 8))
+#define	DOF_ATTR_NAME(a)	(((a) >> 24) & 0xff)
+#define	DOF_ATTR_DATA(a)	(((a) >> 16) & 0xff)
+#define	DOF_ATTR_CLASS(a)	(((a) >>  8) & 0xff)
+
+typedef struct dof_provider {
+	dof_secidx_t dofpv_strtab;	/* link to DOF_SECT_STRTAB section */
+	dof_secidx_t dofpv_probes;	/* link to DOF_SECT_PROBES section */
+	dof_secidx_t dofpv_prargs;	/* link to DOF_SECT_PRARGS section */
+	dof_secidx_t dofpv_proffs;	/* link to DOF_SECT_PROFFS section */
+	dof_stridx_t dofpv_name;	/* provider name string */
+	dof_attr_t dofpv_provattr;	/* provider attributes */
+	dof_attr_t dofpv_modattr;	/* module attributes */
+	dof_attr_t dofpv_funcattr;	/* function attributes */
+	dof_attr_t dofpv_nameattr;	/* name attributes */
+	dof_attr_t dofpv_argsattr;	/* args attributes */
+	dof_secidx_t dofpv_prenoffs;	/* link to DOF_SECT_PRENOFFS section */
+} dof_provider_t;
+
+typedef struct dof_probe {
+	uint64_t dofpr_addr;		/* probe base address or offset */
+	dof_stridx_t dofpr_func;	/* probe function string */
+	dof_stridx_t dofpr_name;	/* probe name string */
+	dof_stridx_t dofpr_nargv;	/* native argument type strings */
+	dof_stridx_t dofpr_xargv;	/* translated argument type strings */
+	uint32_t dofpr_argidx;		/* index of first argument mapping */
+	uint32_t dofpr_offidx;		/* index of first offset entry */
+	uint8_t dofpr_nargc;		/* native argument count */
+	uint8_t dofpr_xargc;		/* translated argument count */
+	uint16_t dofpr_noffs;		/* number of offset entries for probe */
+	uint32_t dofpr_enoffidx;	/* index of first is-enabled offset */
+	uint16_t dofpr_nenoffs;		/* number of is-enabled offsets */
+	uint16_t dofpr_pad1;		/* reserved for future use */
+	uint32_t dofpr_pad2;		/* reserved for future use */
+} dof_probe_t;
+
+typedef struct dof_xlator {
+	dof_secidx_t dofxl_members;	/* link to DOF_SECT_XLMEMBERS section */
+	dof_secidx_t dofxl_strtab;	/* link to DOF_SECT_STRTAB section */
+	dof_stridx_t dofxl_argv;	/* input parameter type strings */
+	uint32_t dofxl_argc;		/* input parameter list length */
+	dof_stridx_t dofxl_type;	/* output type string name */
+	dof_attr_t dofxl_attr;		/* output stability attributes */
+} dof_xlator_t;
+
+typedef struct dof_xlmember {
+	dof_secidx_t dofxm_difo;	/* member link to DOF_SECT_DIFOHDR */
+	dof_stridx_t dofxm_name;	/* member name */
+	dtrace_diftype_t dofxm_type;	/* member type */
+} dof_xlmember_t;
+
+typedef struct dof_xlref {
+	dof_secidx_t dofxr_xlator;	/* link to DOF_SECT_XLATORS section */
+	uint32_t dofxr_member;		/* index of referenced dof_xlmember */
+	uint32_t dofxr_argn;		/* index of argument for DIF_OP_XLARG */
+} dof_xlref_t;
+
+/*
+ * DTrace Intermediate Format Object (DIFO)
+ *
+ * A DIFO is used to store the compiled DIF for a D expression, its return
+ * type, and its string and variable tables.  The string table is a single
+ * buffer of character data into which sets instructions and variable
+ * references can reference strings using a byte offset.  The variable table
+ * is an array of dtrace_difv_t structures that describe the name and type of
+ * each variable and the id used in the DIF code.  This structure is described
+ * above in the DIF section of this header file.  The DIFO is used at both
+ * user-level (in the library) and in the kernel, but the structure is never
+ * passed between the two: the DOF structures form the only interface.  As a
+ * result, the definition can change depending on the presence of _KERNEL.
+ */
+typedef struct dtrace_difo {
+	dif_instr_t *dtdo_buf;		/* instruction buffer */
+	uint64_t *dtdo_inttab;		/* integer table (optional) */
+	char *dtdo_strtab;		/* string table (optional) */
+	dtrace_difv_t *dtdo_vartab;	/* variable table (optional) */
+	uint_t dtdo_len;		/* length of instruction buffer */
+	uint_t dtdo_intlen;		/* length of integer table */
+	uint_t dtdo_strlen;		/* length of string table */
+	uint_t dtdo_varlen;		/* length of variable table */
+	dtrace_diftype_t dtdo_rtype;	/* return type */
+	uint_t dtdo_refcnt;		/* owner reference count */
+	uint_t dtdo_destructive;	/* invokes destructive subroutines */
+#if !defined(_KERNEL) || defined(IN_RING3)
+	dof_relodesc_t *dtdo_kreltab;	/* kernel relocations */
+	dof_relodesc_t *dtdo_ureltab;	/* user relocations */
+	struct dt_node **dtdo_xlmtab;	/* translator references */
+	uint_t dtdo_krelen;		/* length of krelo table */
+	uint_t dtdo_urelen;		/* length of urelo table */
+	uint_t dtdo_xlmlen;		/* length of translator table */
+#endif
+} dtrace_difo_t;
+
+/*
+ * DTrace Enabling Description Structures
+ *
+ * When DTrace is tracking the description of a DTrace enabling entity (probe,
+ * predicate, action, ECB, record, etc.), it does so in a description
+ * structure.  These structures all end in "desc", and are used at both
+ * user-level and in the kernel -- but (with the exception of
+ * dtrace_probedesc_t) they are never passed between them.  Typically,
+ * user-level will use the description structures when assembling an enabling.
+ * It will then distill those description structures into a DOF object (see
+ * above), and send it into the kernel.  The kernel will again use the
+ * description structures to create a description of the enabling as it reads
+ * the DOF.  When the description is complete, the enabling will be actually
+ * created -- turning it into the structures that represent the enabling
+ * instead of merely describing it.  Not surprisingly, the description
+ * structures bear a strong resemblance to the DOF structures that act as their
+ * conduit.
+ */
+struct dtrace_predicate;
+
+typedef struct dtrace_probedesc {
+	dtrace_id_t dtpd_id;			/* probe identifier */
+	char dtpd_provider[DTRACE_PROVNAMELEN]; /* probe provider name */
+	char dtpd_mod[DTRACE_MODNAMELEN];	/* probe module name */
+	char dtpd_func[DTRACE_FUNCNAMELEN];	/* probe function name */
+	char dtpd_name[DTRACE_NAMELEN];		/* probe name */
+} dtrace_probedesc_t;
+
+typedef struct dtrace_repldesc {
+	dtrace_probedesc_t dtrpd_match;		/* probe descr. to match */
+	dtrace_probedesc_t dtrpd_create;	/* probe descr. to create */
+} dtrace_repldesc_t;
+
+typedef struct dtrace_preddesc {
+	dtrace_difo_t *dtpdd_difo;		/* pointer to DIF object */
+	struct dtrace_predicate *dtpdd_predicate; /* pointer to predicate */
+} dtrace_preddesc_t;
+
+typedef struct dtrace_actdesc {
+	dtrace_difo_t *dtad_difo;		/* pointer to DIF object */
+	struct dtrace_actdesc *dtad_next;	/* next action */
+	dtrace_actkind_t dtad_kind;		/* kind of action */
+	uint32_t dtad_ntuple;			/* number in tuple */
+	uint64_t dtad_arg;			/* action argument */
+	uint64_t dtad_uarg;			/* user argument */
+	int dtad_refcnt;			/* reference count */
+} dtrace_actdesc_t;
+
+typedef struct dtrace_ecbdesc {
+	dtrace_actdesc_t *dted_action;		/* action description(s) */
+	dtrace_preddesc_t dted_pred;		/* predicate description */
+	dtrace_probedesc_t dted_probe;		/* probe description */
+	uint64_t dted_uarg;			/* library argument */
+	int dted_refcnt;			/* reference count */
+} dtrace_ecbdesc_t;
+
+/*
+ * DTrace Metadata Description Structures
+ *
+ * DTrace separates the trace data stream from the metadata stream.  The only
+ * metadata tokens placed in the data stream are enabled probe identifiers
+ * (EPIDs) or (in the case of aggregations) aggregation identifiers.  In order
+ * to determine the structure of the data, DTrace consumers pass the token to
+ * the kernel, and receive in return a corresponding description of the enabled
+ * probe (via the dtrace_eprobedesc structure) or the aggregation (via the
+ * dtrace_aggdesc structure).  Both of these structures are expressed in terms
+ * of record descriptions (via the dtrace_recdesc structure) that describe the
+ * exact structure of the data.  Some record descriptions may also contain a
+ * format identifier; this additional bit of metadata can be retrieved from the
+ * kernel, for which a format description is returned via the dtrace_fmtdesc
+ * structure.  Note that all four of these structures must be bitness-neutral
+ * to allow for a 32-bit DTrace consumer on a 64-bit kernel.
+ */
+typedef struct dtrace_recdesc {
+	dtrace_actkind_t dtrd_action;		/* kind of action */
+	uint32_t dtrd_size;			/* size of record */
+	uint32_t dtrd_offset;			/* offset in ECB's data */
+	uint16_t dtrd_alignment;		/* required alignment */
+	uint16_t dtrd_format;			/* format, if any */
+	uint64_t dtrd_arg;			/* action argument */
+	uint64_t dtrd_uarg;			/* user argument */
+} dtrace_recdesc_t;
+
+typedef struct dtrace_eprobedesc {
+	dtrace_epid_t dtepd_epid;		/* enabled probe ID */
+	dtrace_id_t dtepd_probeid;		/* probe ID */
+	uint64_t dtepd_uarg;			/* library argument */
+	uint32_t dtepd_size;			/* total size */
+	int dtepd_nrecs;			/* number of records */
+	dtrace_recdesc_t dtepd_rec[1];		/* records themselves */
+} dtrace_eprobedesc_t;
+
+typedef struct dtrace_aggdesc {
+	DTRACE_PTR(char, dtagd_name);		/* not filled in by kernel */
+	dtrace_aggvarid_t dtagd_varid;		/* not filled in by kernel */
+	int dtagd_flags;			/* not filled in by kernel */
+	dtrace_aggid_t dtagd_id;		/* aggregation ID */
+	dtrace_epid_t dtagd_epid;		/* enabled probe ID */
+	uint32_t dtagd_size;			/* size in bytes */
+	int dtagd_nrecs;			/* number of records */
+	uint32_t dtagd_pad;			/* explicit padding */
+	dtrace_recdesc_t dtagd_rec[1];		/* record descriptions */
+} dtrace_aggdesc_t;
+
+typedef struct dtrace_fmtdesc {
+	DTRACE_PTR(char, dtfd_string);		/* format string */
+	int dtfd_length;			/* length of format string */
+	uint16_t dtfd_format;			/* format identifier */
+} dtrace_fmtdesc_t;
+
+#define	DTRACE_SIZEOF_EPROBEDESC(desc)				\
+	(sizeof (dtrace_eprobedesc_t) + ((desc)->dtepd_nrecs ?	\
+	(((desc)->dtepd_nrecs - 1) * sizeof (dtrace_recdesc_t)) : 0))
+
+#define	DTRACE_SIZEOF_AGGDESC(desc)				\
+	(sizeof (dtrace_aggdesc_t) + ((desc)->dtagd_nrecs ?	\
+	(((desc)->dtagd_nrecs - 1) * sizeof (dtrace_recdesc_t)) : 0))
+
+/*
+ * DTrace Option Interface
+ *
+ * Run-time DTrace options are set and retrieved via DOF_SECT_OPTDESC sections
+ * in a DOF image.  The dof_optdesc structure contains an option identifier and
+ * an option value.  The valid option identifiers are found below; the mapping
+ * between option identifiers and option identifying strings is maintained at
+ * user-level.  Note that the value of DTRACEOPT_UNSET is such that all of the
+ * following are potentially valid option values:  all positive integers, zero
+ * and negative one.  Some options (notably "bufpolicy" and "bufresize") take
+ * predefined tokens as their values; these are defined with
+ * DTRACEOPT_{option}_{token}.
+ */
+#define	DTRACEOPT_BUFSIZE	0	/* buffer size */
+#define	DTRACEOPT_BUFPOLICY	1	/* buffer policy */
+#define	DTRACEOPT_DYNVARSIZE	2	/* dynamic variable size */
+#define	DTRACEOPT_AGGSIZE	3	/* aggregation size */
+#define	DTRACEOPT_SPECSIZE	4	/* speculation size */
+#define	DTRACEOPT_NSPEC		5	/* number of speculations */
+#define	DTRACEOPT_STRSIZE	6	/* string size */
+#define	DTRACEOPT_CLEANRATE	7	/* dynvar cleaning rate */
+#define	DTRACEOPT_CPU		8	/* CPU to trace */
+#define	DTRACEOPT_BUFRESIZE	9	/* buffer resizing policy */
+#define	DTRACEOPT_GRABANON	10	/* grab anonymous state, if any */
+#define	DTRACEOPT_FLOWINDENT	11	/* indent function entry/return */
+#define	DTRACEOPT_QUIET		12	/* only output explicitly traced data */
+#define	DTRACEOPT_STACKFRAMES	13	/* number of stack frames */
+#define	DTRACEOPT_USTACKFRAMES	14	/* number of user stack frames */
+#define	DTRACEOPT_AGGRATE	15	/* aggregation snapshot rate */
+#define	DTRACEOPT_SWITCHRATE	16	/* buffer switching rate */
+#define	DTRACEOPT_STATUSRATE	17	/* status rate */
+#define	DTRACEOPT_DESTRUCTIVE	18	/* destructive actions allowed */
+#define	DTRACEOPT_STACKINDENT	19	/* output indent for stack traces */
+#define	DTRACEOPT_RAWBYTES	20	/* always print bytes in raw form */
+#define	DTRACEOPT_JSTACKFRAMES	21	/* number of jstack() frames */
+#define	DTRACEOPT_JSTACKSTRSIZE	22	/* size of jstack() string table */
+#define	DTRACEOPT_AGGSORTKEY	23	/* sort aggregations by key */
+#define	DTRACEOPT_AGGSORTREV	24	/* reverse-sort aggregations */
+#define	DTRACEOPT_AGGSORTPOS	25	/* agg. position to sort on */
+#define	DTRACEOPT_AGGSORTKEYPOS	26	/* agg. key position to sort on */
+#define	DTRACEOPT_MAX		27	/* number of options */
+
+#define	DTRACEOPT_UNSET		(dtrace_optval_t)-2	/* unset option */
+
+#define	DTRACEOPT_BUFPOLICY_RING	0	/* ring buffer */
+#define	DTRACEOPT_BUFPOLICY_FILL	1	/* fill buffer, then stop */
+#define	DTRACEOPT_BUFPOLICY_SWITCH	2	/* switch buffers */
+
+#define	DTRACEOPT_BUFRESIZE_AUTO	0	/* automatic resizing */
+#define	DTRACEOPT_BUFRESIZE_MANUAL	1	/* manual resizing */
+
+/*
+ * DTrace Buffer Interface
+ *
+ * In order to get a snapshot of the principal or aggregation buffer,
+ * user-level passes a buffer description to the kernel with the dtrace_bufdesc
+ * structure.  This describes which CPU user-level is interested in, and
+ * where user-level wishes the kernel to snapshot the buffer to (the
+ * dtbd_data field).  The kernel uses the same structure to pass back some
+ * information regarding the buffer:  the size of data actually copied out, the
+ * number of drops, the number of errors, and the offset of the oldest record.
+ * If the buffer policy is a "switch" policy, taking a snapshot of the
+ * principal buffer has the additional effect of switching the active and
+ * inactive buffers.  Taking a snapshot of the aggregation buffer _always_ has
+ * the additional effect of switching the active and inactive buffers.
+ */
+typedef struct dtrace_bufdesc {
+	uint64_t dtbd_size;			/* size of buffer */
+	uint32_t dtbd_cpu;			/* CPU or DTRACE_CPUALL */
+	uint32_t dtbd_errors;			/* number of errors */
+	uint64_t dtbd_drops;			/* number of drops */
+	DTRACE_PTR(char, dtbd_data);		/* data */
+	uint64_t dtbd_oldest;			/* offset of oldest record */
+} dtrace_bufdesc_t;
+
+/*
+ * DTrace Status
+ *
+ * The status of DTrace is relayed via the dtrace_status structure.  This
+ * structure contains members to count drops other than the capacity drops
+ * available via the buffer interface (see above).  This consists of dynamic
+ * drops (including capacity dynamic drops, rinsing drops and dirty drops), and
+ * speculative drops (including capacity speculative drops, drops due to busy
+ * speculative buffers and drops due to unavailable speculative buffers).
+ * Additionally, the status structure contains a field to indicate the number
+ * of "fill"-policy buffers have been filled and a boolean field to indicate
+ * that exit() has been called.  If the dtst_exiting field is non-zero, no
+ * further data will be generated until tracing is stopped (at which time any
+ * enablings of the END action will be processed); if user-level sees that
+ * this field is non-zero, tracing should be stopped as soon as possible.
+ */
+typedef struct dtrace_status {
+	uint64_t dtst_dyndrops;			/* dynamic drops */
+	uint64_t dtst_dyndrops_rinsing;		/* dyn drops due to rinsing */
+	uint64_t dtst_dyndrops_dirty;		/* dyn drops due to dirty */
+	uint64_t dtst_specdrops;		/* speculative drops */
+	uint64_t dtst_specdrops_busy;		/* spec drops due to busy */
+	uint64_t dtst_specdrops_unavail;	/* spec drops due to unavail */
+	uint64_t dtst_errors;			/* total errors */
+	uint64_t dtst_filled;			/* number of filled bufs */
+	uint64_t dtst_stkstroverflows;		/* stack string tab overflows */
+	uint64_t dtst_dblerrors;		/* errors in ERROR probes */
+	char dtst_killed;			/* non-zero if killed */
+	char dtst_exiting;			/* non-zero if exit() called */
+	char dtst_pad[6];			/* pad out to 64-bit align */
+} dtrace_status_t;
+
+/*
+ * DTrace Configuration
+ *
+ * User-level may need to understand some elements of the kernel DTrace
+ * configuration in order to generate correct DIF.  This information is
+ * conveyed via the dtrace_conf structure.
+ */
+typedef struct dtrace_conf {
+	uint_t dtc_difversion;			/* supported DIF version */
+	uint_t dtc_difintregs;			/* # of DIF integer registers */
+	uint_t dtc_diftupregs;			/* # of DIF tuple registers */
+	uint_t dtc_ctfmodel;			/* CTF data model */
+	uint_t dtc_pad[8];			/* reserved for future use */
+} dtrace_conf_t;
+
+/*
+ * DTrace Faults
+ *
+ * The constants below DTRACEFLT_LIBRARY indicate probe processing faults;
+ * constants at or above DTRACEFLT_LIBRARY indicate faults in probe
+ * postprocessing at user-level.  Probe processing faults induce an ERROR
+ * probe and are replicated in unistd.d to allow users' ERROR probes to decode
+ * the error condition using thse symbolic labels.
+ */
+#define	DTRACEFLT_UNKNOWN		0	/* Unknown fault */
+#define	DTRACEFLT_BADADDR		1	/* Bad address */
+#define	DTRACEFLT_BADALIGN		2	/* Bad alignment */
+#define	DTRACEFLT_ILLOP			3	/* Illegal operation */
+#define	DTRACEFLT_DIVZERO		4	/* Divide-by-zero */
+#define	DTRACEFLT_NOSCRATCH		5	/* Out of scratch space */
+#define	DTRACEFLT_KPRIV			6	/* Illegal kernel access */
+#define	DTRACEFLT_UPRIV			7	/* Illegal user access */
+#define	DTRACEFLT_TUPOFLOW		8	/* Tuple stack overflow */
+#define	DTRACEFLT_BADSTACK		9	/* Bad stack */
+
+#define	DTRACEFLT_LIBRARY		1000	/* Library-level fault */
+
+/*
+ * DTrace Argument Types
+ *
+ * Because it would waste both space and time, argument types do not reside
+ * with the probe.  In order to determine argument types for args[X]
+ * variables, the D compiler queries for argument types on a probe-by-probe
+ * basis.  (This optimizes for the common case that arguments are either not
+ * used or used in an untyped fashion.)  Typed arguments are specified with a
+ * string of the type name in the dtragd_native member of the argument
+ * description structure.  Typed arguments may be further translated to types
+ * of greater stability; the provider indicates such a translated argument by
+ * filling in the dtargd_xlate member with the string of the translated type.
+ * Finally, the provider may indicate which argument value a given argument
+ * maps to by setting the dtargd_mapping member -- allowing a single argument
+ * to map to multiple args[X] variables.
+ */
+typedef struct dtrace_argdesc {
+	dtrace_id_t dtargd_id;			/* probe identifier */
+	int dtargd_ndx;				/* arg number (-1 iff none) */
+	int dtargd_mapping;			/* value mapping */
+	char dtargd_native[DTRACE_ARGTYPELEN];	/* native type name */
+	char dtargd_xlate[DTRACE_ARGTYPELEN];	/* translated type name */
+} dtrace_argdesc_t;
+
+/*
+ * DTrace Stability Attributes
+ *
+ * Each DTrace provider advertises the name and data stability of each of its
+ * probe description components, as well as its architectural dependencies.
+ * The D compiler can query the provider attributes (dtrace_pattr_t below) in
+ * order to compute the properties of an input program and report them.
+ */
+typedef uint8_t dtrace_stability_t;	/* stability code (see attributes(5)) */
+typedef uint8_t dtrace_class_t;		/* architectural dependency class */
+
+#define	DTRACE_STABILITY_INTERNAL	0	/* private to DTrace itself */
+#define	DTRACE_STABILITY_PRIVATE	1	/* private to Sun (see docs) */
+#define	DTRACE_STABILITY_OBSOLETE	2	/* scheduled for removal */
+#define	DTRACE_STABILITY_EXTERNAL	3	/* not controlled by Sun */
+#define	DTRACE_STABILITY_UNSTABLE	4	/* new or rapidly changing */
+#define	DTRACE_STABILITY_EVOLVING	5	/* less rapidly changing */
+#define	DTRACE_STABILITY_STABLE		6	/* mature interface from Sun */
+#define	DTRACE_STABILITY_STANDARD	7	/* industry standard */
+#define	DTRACE_STABILITY_MAX		7	/* maximum valid stability */
+
+#define	DTRACE_CLASS_UNKNOWN	0	/* unknown architectural dependency */
+#define	DTRACE_CLASS_CPU	1	/* CPU-module-specific */
+#define	DTRACE_CLASS_PLATFORM	2	/* platform-specific (uname -i) */
+#define	DTRACE_CLASS_GROUP	3	/* hardware-group-specific (uname -m) */
+#define	DTRACE_CLASS_ISA	4	/* ISA-specific (uname -p) */
+#define	DTRACE_CLASS_COMMON	5	/* common to all systems */
+#define	DTRACE_CLASS_MAX	5	/* maximum valid class */
+
+#define	DTRACE_PRIV_NONE	0x0000
+#define	DTRACE_PRIV_KERNEL	0x0001
+#define	DTRACE_PRIV_USER	0x0002
+#define	DTRACE_PRIV_PROC	0x0004
+#define	DTRACE_PRIV_OWNER	0x0008
+#define	DTRACE_PRIV_ZONEOWNER	0x0010
+
+#define	DTRACE_PRIV_ALL	\
+	(DTRACE_PRIV_KERNEL | DTRACE_PRIV_USER | \
+	DTRACE_PRIV_PROC | DTRACE_PRIV_OWNER | DTRACE_PRIV_ZONEOWNER)
+
+typedef struct dtrace_ppriv {
+	uint32_t dtpp_flags;			/* privilege flags */
+	uid_t dtpp_uid;				/* user ID */
+	zoneid_t dtpp_zoneid;			/* zone ID */
+} dtrace_ppriv_t;
+
+typedef struct dtrace_attribute {
+	dtrace_stability_t dtat_name;		/* entity name stability */
+	dtrace_stability_t dtat_data;		/* entity data stability */
+	dtrace_class_t dtat_class;		/* entity data dependency */
+} dtrace_attribute_t;
+
+typedef struct dtrace_pattr {
+	dtrace_attribute_t dtpa_provider;	/* provider attributes */
+	dtrace_attribute_t dtpa_mod;		/* module attributes */
+	dtrace_attribute_t dtpa_func;		/* function attributes */
+	dtrace_attribute_t dtpa_name;		/* name attributes */
+	dtrace_attribute_t dtpa_args;		/* args[] attributes */
+} dtrace_pattr_t;
+
+typedef struct dtrace_providerdesc {
+	char dtvd_name[DTRACE_PROVNAMELEN];	/* provider name */
+	dtrace_pattr_t dtvd_attr;		/* stability attributes */
+	dtrace_ppriv_t dtvd_priv;		/* privileges required */
+} dtrace_providerdesc_t;
+
+/*
+ * DTrace Pseudodevice Interface
+ *
+ * DTrace is controlled through ioctl(2)'s to the in-kernel dtrace:dtrace
+ * pseudodevice driver.  These ioctls comprise the user-kernel interface to
+ * DTrace.
+ */
+#define	DTRACEIOC		(('d' << 24) | ('t' << 16) | ('r' << 8))
+#define	DTRACEIOC_PROVIDER	(DTRACEIOC | 1)		/* provider query */
+#define	DTRACEIOC_PROBES	(DTRACEIOC | 2)		/* probe query */
+#define	DTRACEIOC_BUFSNAP	(DTRACEIOC | 4)		/* snapshot buffer */
+#define	DTRACEIOC_PROBEMATCH	(DTRACEIOC | 5)		/* match probes */
+#define	DTRACEIOC_ENABLE	(DTRACEIOC | 6)		/* enable probes */
+#define	DTRACEIOC_AGGSNAP	(DTRACEIOC | 7)		/* snapshot agg. */
+#define	DTRACEIOC_EPROBE	(DTRACEIOC | 8)		/* get eprobe desc. */
+#define	DTRACEIOC_PROBEARG	(DTRACEIOC | 9)		/* get probe arg */
+#define	DTRACEIOC_CONF		(DTRACEIOC | 10)	/* get config. */
+#define	DTRACEIOC_STATUS	(DTRACEIOC | 11)	/* get status */
+#define	DTRACEIOC_GO		(DTRACEIOC | 12)	/* start tracing */
+#define	DTRACEIOC_STOP		(DTRACEIOC | 13)	/* stop tracing */
+#define	DTRACEIOC_AGGDESC	(DTRACEIOC | 15)	/* get agg. desc. */
+#define	DTRACEIOC_FORMAT	(DTRACEIOC | 16)	/* get format str */
+#define	DTRACEIOC_DOFGET	(DTRACEIOC | 17)	/* get DOF */
+#define	DTRACEIOC_REPLICATE	(DTRACEIOC | 18)	/* replicate enab */
+
+/*
+ * DTrace Helpers
+ *
+ * In general, DTrace establishes probes in processes and takes actions on
+ * processes without knowing their specific user-level structures.  Instead of
+ * existing in the framework, process-specific knowledge is contained by the
+ * enabling D program -- which can apply process-specific knowledge by making
+ * appropriate use of DTrace primitives like copyin() and copyinstr() to
+ * operate on user-level data.  However, there may exist some specific probes
+ * of particular semantic relevance that the application developer may wish to
+ * explicitly export.  For example, an application may wish to export a probe
+ * at the point that it begins and ends certain well-defined transactions.  In
+ * addition to providing probes, programs may wish to offer assistance for
+ * certain actions.  For example, in highly dynamic environments (e.g., Java),
+ * it may be difficult to obtain a stack trace in terms of meaningful symbol
+ * names (the translation from instruction addresses to corresponding symbol
+ * names may only be possible in situ); these environments may wish to define
+ * a series of actions to be applied in situ to obtain a meaningful stack
+ * trace.
+ *
+ * These two mechanisms -- user-level statically defined tracing and assisting
+ * DTrace actions -- are provided via DTrace _helpers_.  Helpers are specified
+ * via DOF, but unlike enabling DOF, helper DOF may contain definitions of
+ * providers, probes and their arguments.  If a helper wishes to provide
+ * action assistance, probe descriptions and corresponding DIF actions may be
+ * specified in the helper DOF.  For such helper actions, however, the probe
+ * description describes the specific helper:  all DTrace helpers have the
+ * provider name "dtrace" and the module name "helper", and the name of the
+ * helper is contained in the function name (for example, the ustack() helper
+ * is named "ustack").  Any helper-specific name may be contained in the name
+ * (for example, if a helper were to have a constructor, it might be named
+ * "dtrace:helper:<helper>:init").  Helper actions are only called when the
+ * action that they are helping is taken.  Helper actions may only return DIF
+ * expressions, and may only call the following subroutines:
+ *
+ *    alloca()      <= Allocates memory out of the consumer's scratch space
+ *    bcopy()       <= Copies memory to scratch space
+ *    copyin()      <= Copies memory from user-level into consumer's scratch
+ *    copyinto()    <= Copies memory into a specific location in scratch
+ *    copyinstr()   <= Copies a string into a specific location in scratch
+ *
+ * Helper actions may only access the following built-in variables:
+ *
+ *    curthread     <= Current kthread_t pointer
+ *    tid           <= Current thread identifier
+ *    pid           <= Current process identifier
+ *    ppid          <= Parent process identifier
+ *    uid           <= Current user ID
+ *    gid           <= Current group ID
+ *    execname      <= Current executable name
+ *    zonename      <= Current zone name
+ *
+ * Helper actions may not manipulate or allocate dynamic variables, but they
+ * may have clause-local and statically-allocated global variables.  The
+ * helper action variable state is specific to the helper action -- variables
+ * used by the helper action may not be accessed outside of the helper
+ * action, and the helper action may not access variables that like outside
+ * of it.  Helper actions may not load from kernel memory at-large; they are
+ * restricting to loading current user state (via copyin() and variants) and
+ * scratch space.  As with probe enablings, helper actions are executed in
+ * program order.  The result of the helper action is the result of the last
+ * executing helper expression.
+ *
+ * Helpers -- composed of either providers/probes or probes/actions (or both)
+ * -- are added by opening the "helper" minor node, and issuing an ioctl(2)
+ * (DTRACEHIOC_ADDDOF) that specifies the dof_helper_t structure. This
+ * encapsulates the name and base address of the user-level library or
+ * executable publishing the helpers and probes as well as the DOF that
+ * contains the definitions of those helpers and probes.
+ *
+ * The DTRACEHIOC_ADD and DTRACEHIOC_REMOVE are left in place for legacy
+ * helpers and should no longer be used.  No other ioctls are valid on the
+ * helper minor node.
+ */
+#define	DTRACEHIOC		(('d' << 24) | ('t' << 16) | ('h' << 8))
+#define	DTRACEHIOC_ADD		(DTRACEHIOC | 1)	/* add helper */
+#define	DTRACEHIOC_REMOVE	(DTRACEHIOC | 2)	/* remove helper */
+#define	DTRACEHIOC_ADDDOF	(DTRACEHIOC | 3)	/* add helper DOF */
+
+typedef struct dof_helper {
+	char dofhp_mod[DTRACE_MODNAMELEN];	/* executable or library name */
+	uint64_t dofhp_addr;			/* base address of object */
+	uint64_t dofhp_dof;			/* address of helper DOF */
+} dof_helper_t;
+
+#define	DTRACEMNR_DTRACE	"dtrace"	/* node for DTrace ops */
+#define	DTRACEMNR_HELPER	"helper"	/* node for helpers */
+#define	DTRACEMNRN_DTRACE	0		/* minor for DTrace ops */
+#define	DTRACEMNRN_HELPER	1		/* minor for helpers */
+#define	DTRACEMNRN_CLONE	2		/* first clone minor */
+
+#if defined(_KERNEL) || defined(IN_RING0)
+
+/*
+ * DTrace Provider API
+ *
+ * The following functions are implemented by the DTrace framework and are
+ * used to implement separate in-kernel DTrace providers.  Common functions
+ * are provided in uts/common/os/dtrace.c.  ISA-dependent subroutines are
+ * defined in uts/<isa>/dtrace/dtrace_asm.s or uts/<isa>/dtrace/dtrace_isa.c.
+ *
+ * The provider API has two halves:  the API that the providers consume from
+ * DTrace, and the API that providers make available to DTrace.
+ *
+ * 1 Framework-to-Provider API
+ *
+ * 1.1  Overview
+ *
+ * The Framework-to-Provider API is represented by the dtrace_pops structure
+ * that the provider passes to the framework when registering itself.  This
+ * structure consists of the following members:
+ *
+ *   dtps_provide()          <-- Provide all probes, all modules
+ *   dtps_provide_module()   <-- Provide all probes in specified module
+ *   dtps_enable()           <-- Enable specified probe
+ *   dtps_disable()          <-- Disable specified probe
+ *   dtps_suspend()          <-- Suspend specified probe
+ *   dtps_resume()           <-- Resume specified probe
+ *   dtps_getargdesc()       <-- Get the argument description for args[X]
+ *   dtps_getargval()        <-- Get the value for an argX or args[X] variable
+ *   dtps_usermode()         <-- Find out if the probe was fired in user mode
+ *   dtps_destroy()          <-- Destroy all state associated with this probe
+ *
+ * 1.2  void dtps_provide(void *arg, const dtrace_probedesc_t *spec)
+ *
+ * 1.2.1  Overview
+ *
+ *   Called to indicate that the provider should provide all probes.  If the
+ *   specified description is non-NULL, dtps_provide() is being called because
+ *   no probe matched a specified probe -- if the provider has the ability to
+ *   create custom probes, it may wish to create a probe that matches the
+ *   specified description.
+ *
+ * 1.2.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register().  The
+ *   second argument is a pointer to a probe description that the provider may
+ *   wish to consider when creating custom probes.  The provider is expected to
+ *   call back into the DTrace framework via dtrace_probe_create() to create
+ *   any necessary probes.  dtps_provide() may be called even if the provider
+ *   has made available all probes; the provider should check the return value
+ *   of dtrace_probe_create() to handle this case.  Note that the provider need
+ *   not implement both dtps_provide() and dtps_provide_module(); see
+ *   "Arguments and Notes" for dtrace_register(), below.
+ *
+ * 1.2.3  Return value
+ *
+ *   None.
+ *
+ * 1.2.4  Caller's context
+ *
+ *   dtps_provide() is typically called from open() or ioctl() context, but may
+ *   be called from other contexts as well.  The DTrace framework is locked in
+ *   such a way that providers may not register or unregister.  This means that
+ *   the provider may not call any DTrace API that affects its registration with
+ *   the framework, including dtrace_register(), dtrace_unregister(),
+ *   dtrace_invalidate(), and dtrace_condense().  However, the context is such
+ *   that the provider may (and indeed, is expected to) call probe-related
+ *   DTrace routines, including dtrace_probe_create(), dtrace_probe_lookup(),
+ *   and dtrace_probe_arg().
+ *
+ * 1.3  void dtps_provide_module(void *arg, struct modctl *mp)
+ *
+ * 1.3.1  Overview
+ *
+ *   Called to indicate that the provider should provide all probes in the
+ *   specified module.
+ *
+ * 1.3.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register().  The
+ *   second argument is a pointer to a modctl structure that indicates the
+ *   module for which probes should be created.
+ *
+ * 1.3.3  Return value
+ *
+ *   None.
+ *
+ * 1.3.4  Caller's context
+ *
+ *   dtps_provide_module() may be called from open() or ioctl() context, but
+ *   may also be called from a module loading context.  mod_lock is held, and
+ *   the DTrace framework is locked in such a way that providers may not
+ *   register or unregister.  This means that the provider may not call any
+ *   DTrace API that affects its registration with the framework, including
+ *   dtrace_register(), dtrace_unregister(), dtrace_invalidate(), and
+ *   dtrace_condense().  However, the context is such that the provider may (and
+ *   indeed, is expected to) call probe-related DTrace routines, including
+ *   dtrace_probe_create(), dtrace_probe_lookup(), and dtrace_probe_arg().  Note
+ *   that the provider need not implement both dtps_provide() and
+ *   dtps_provide_module(); see "Arguments and Notes" for dtrace_register(),
+ *   below.
+ *
+ * 1.4  int dtps_enable(void *arg, dtrace_id_t id, void *parg)
+ *
+ * 1.4.1  Overview
+ *
+ *   Called to enable the specified probe.
+ *
+ * 1.4.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register().  The
+ *   second argument is the identifier of the probe to be enabled.  The third
+ *   argument is the probe argument as passed to dtrace_probe_create().
+ *   dtps_enable() will be called when a probe transitions from not being
+ *   enabled at all to having one or more ECB.  The number of ECBs associated
+ *   with the probe may change without subsequent calls into the provider.
+ *   When the number of ECBs drops to zero, the provider will be explicitly
+ *   told to disable the probe via dtps_disable().  dtrace_probe() should never
+ *   be called for a probe identifier that hasn't been explicitly enabled via
+ *   dtps_enable().
+ *
+ * 1.4.3  Return value
+ *
+ *   On success, dtps_enable() should return 0. On failure, -1 should be
+ *   returned.
+ *
+ * 1.4.4  Caller's context
+ *
+ *   The DTrace framework is locked in such a way that it may not be called
+ *   back into at all.  cpu_lock is held.  mod_lock is not held and may not
+ *   be acquired.
+ *
+ * 1.5  void dtps_disable(void *arg, dtrace_id_t id, void *parg)
+ *
+ * 1.5.1  Overview
+ *
+ *   Called to disable the specified probe.
+ *
+ * 1.5.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register().  The
+ *   second argument is the identifier of the probe to be disabled.  The third
+ *   argument is the probe argument as passed to dtrace_probe_create().
+ *   dtps_disable() will be called when a probe transitions from being enabled
+ *   to having zero ECBs.  dtrace_probe() should never be called for a probe
+ *   identifier that has been explicitly enabled via dtps_disable().
+ *
+ * 1.5.3  Return value
+ *
+ *   None.
+ *
+ * 1.5.4  Caller's context
+ *
+ *   The DTrace framework is locked in such a way that it may not be called
+ *   back into at all.  cpu_lock is held.  mod_lock is not held and may not
+ *   be acquired.
+ *
+ * 1.6  void dtps_suspend(void *arg, dtrace_id_t id, void *parg)
+ *
+ * 1.6.1  Overview
+ *
+ *   Called to suspend the specified enabled probe.  This entry point is for
+ *   providers that may need to suspend some or all of their probes when CPUs
+ *   are being powered on or when the boot monitor is being entered for a
+ *   prolonged period of time.
+ *
+ * 1.6.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register().  The
+ *   second argument is the identifier of the probe to be suspended.  The
+ *   third argument is the probe argument as passed to dtrace_probe_create().
+ *   dtps_suspend will only be called on an enabled probe.  Providers that
+ *   provide a dtps_suspend entry point will want to take roughly the action
+ *   that it takes for dtps_disable.
+ *
+ * 1.6.3  Return value
+ *
+ *   None.
+ *
+ * 1.6.4  Caller's context
+ *
+ *   Interrupts are disabled.  The DTrace framework is in a state such that the
+ *   specified probe cannot be disabled or destroyed for the duration of
+ *   dtps_suspend().  As interrupts are disabled, the provider is afforded
+ *   little latitude; the provider is expected to do no more than a store to
+ *   memory.
+ *
+ * 1.7  void dtps_resume(void *arg, dtrace_id_t id, void *parg)
+ *
+ * 1.7.1  Overview
+ *
+ *   Called to resume the specified enabled probe.  This entry point is for
+ *   providers that may need to resume some or all of their probes after the
+ *   completion of an event that induced a call to dtps_suspend().
+ *
+ * 1.7.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register().  The
+ *   second argument is the identifier of the probe to be resumed.  The
+ *   third argument is the probe argument as passed to dtrace_probe_create().
+ *   dtps_resume will only be called on an enabled probe.  Providers that
+ *   provide a dtps_resume entry point will want to take roughly the action
+ *   that it takes for dtps_enable.
+ *
+ * 1.7.3  Return value
+ *
+ *   None.
+ *
+ * 1.7.4  Caller's context
+ *
+ *   Interrupts are disabled.  The DTrace framework is in a state such that the
+ *   specified probe cannot be disabled or destroyed for the duration of
+ *   dtps_resume().  As interrupts are disabled, the provider is afforded
+ *   little latitude; the provider is expected to do no more than a store to
+ *   memory.
+ *
+ * 1.8  void dtps_getargdesc(void *arg, dtrace_id_t id, void *parg,
+ *           dtrace_argdesc_t *desc)
+ *
+ * 1.8.1  Overview
+ *
+ *   Called to retrieve the argument description for an args[X] variable.
+ *
+ * 1.8.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register(). The
+ *   second argument is the identifier of the current probe. The third
+ *   argument is the probe argument as passed to dtrace_probe_create(). The
+ *   fourth argument is a pointer to the argument description.  This
+ *   description is both an input and output parameter:  it contains the
+ *   index of the desired argument in the dtargd_ndx field, and expects
+ *   the other fields to be filled in upon return.  If there is no argument
+ *   corresponding to the specified index, the dtargd_ndx field should be set
+ *   to DTRACE_ARGNONE.
+ *
+ * 1.8.3  Return value
+ *
+ *   None.  The dtargd_ndx, dtargd_native, dtargd_xlate and dtargd_mapping
+ *   members of the dtrace_argdesc_t structure are all output values.
+ *
+ * 1.8.4  Caller's context
+ *
+ *   dtps_getargdesc() is called from ioctl() context. mod_lock is held, and
+ *   the DTrace framework is locked in such a way that providers may not
+ *   register or unregister.  This means that the provider may not call any
+ *   DTrace API that affects its registration with the framework, including
+ *   dtrace_register(), dtrace_unregister(), dtrace_invalidate(), and
+ *   dtrace_condense().
+ *
+ * 1.9  uint64_t dtps_getargval(void *arg, dtrace_id_t id, void *parg,
+ *               int argno, int aframes)
+ *
+ * 1.9.1  Overview
+ *
+ *   Called to retrieve a value for an argX or args[X] variable.
+ *
+ * 1.9.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register(). The
+ *   second argument is the identifier of the current probe. The third
+ *   argument is the probe argument as passed to dtrace_probe_create(). The
+ *   fourth argument is the number of the argument (the X in the example in
+ *   1.9.1). The fifth argument is the number of stack frames that were used
+ *   to get from the actual place in the code that fired the probe to
+ *   dtrace_probe() itself, the so-called artificial frames. This argument may
+ *   be used to descend an appropriate number of frames to find the correct
+ *   values. If this entry point is left NULL, the dtrace_getarg() built-in
+ *   function is used.
+ *
+ * 1.9.3  Return value
+ *
+ *   The value of the argument.
+ *
+ * 1.9.4  Caller's context
+ *
+ *   This is called from within dtrace_probe() meaning that interrupts
+ *   are disabled. No locks should be taken within this entry point.
+ *
+ * 1.10  int dtps_usermode(void *arg, dtrace_id_t id, void *parg)
+ *
+ * 1.10.1  Overview
+ *
+ *   Called to determine if the probe was fired in a user context.
+ *
+ * 1.10.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register(). The
+ *   second argument is the identifier of the current probe. The third
+ *   argument is the probe argument as passed to dtrace_probe_create().  This
+ *   entry point must not be left NULL for providers whose probes allow for
+ *   mixed mode tracing, that is to say those probes that can fire during
+ *   kernel- _or_ user-mode execution
+ *
+ * 1.10.3  Return value
+ *
+ *   A boolean value.
+ *
+ * 1.10.4  Caller's context
+ *
+ *   This is called from within dtrace_probe() meaning that interrupts
+ *   are disabled. No locks should be taken within this entry point.
+ *
+ * 1.11 void dtps_destroy(void *arg, dtrace_id_t id, void *parg)
+ *
+ * 1.11.1 Overview
+ *
+ *   Called to destroy the specified probe.
+ *
+ * 1.11.2 Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_register().  The
+ *   second argument is the identifier of the probe to be destroyed.  The third
+ *   argument is the probe argument as passed to dtrace_probe_create().  The
+ *   provider should free all state associated with the probe.  The framework
+ *   guarantees that dtps_destroy() is only called for probes that have either
+ *   been disabled via dtps_disable() or were never enabled via dtps_enable().
+ *   Once dtps_disable() has been called for a probe, no further call will be
+ *   made specifying the probe.
+ *
+ * 1.11.3 Return value
+ *
+ *   None.
+ *
+ * 1.11.4 Caller's context
+ *
+ *   The DTrace framework is locked in such a way that it may not be called
+ *   back into at all.  mod_lock is held.  cpu_lock is not held, and may not be
+ *   acquired.
+ *
+ *
+ * 2 Provider-to-Framework API
+ *
+ * 2.1  Overview
+ *
+ * The Provider-to-Framework API provides the mechanism for the provider to
+ * register itself with the DTrace framework, to create probes, to lookup
+ * probes and (most importantly) to fire probes.  The Provider-to-Framework
+ * consists of:
+ *
+ *   dtrace_register()       <-- Register a provider with the DTrace framework
+ *   dtrace_unregister()     <-- Remove a provider's DTrace registration
+ *   dtrace_invalidate()     <-- Invalidate the specified provider
+ *   dtrace_condense()       <-- Remove a provider's unenabled probes
+ *   dtrace_attached()       <-- Indicates whether or not DTrace has attached
+ *   dtrace_probe_create()   <-- Create a DTrace probe
+ *   dtrace_probe_lookup()   <-- Lookup a DTrace probe based on its name
+ *   dtrace_probe_arg()      <-- Return the probe argument for a specific probe
+ *   dtrace_probe()          <-- Fire the specified probe
+ *
+ * 2.2  int dtrace_register(const char *name, const dtrace_pattr_t *pap,
+ *          uint32_t priv, cred_t *cr, const dtrace_pops_t *pops, void *arg,
+ *          dtrace_provider_id_t *idp)
+ *
+ * 2.2.1  Overview
+ *
+ *   dtrace_register() registers the calling provider with the DTrace
+ *   framework.  It should generally be called by DTrace providers in their
+ *   attach(9E) entry point.
+ *
+ * 2.2.2  Arguments and Notes
+ *
+ *   The first argument is the name of the provider.  The second argument is a
+ *   pointer to the stability attributes for the provider.  The third argument
+ *   is the privilege flags for the provider, and must be some combination of:
+ *
+ *     DTRACE_PRIV_NONE     <= All users may enable probes from this provider
+ *
+ *     DTRACE_PRIV_PROC     <= Any user with privilege of PRIV_DTRACE_PROC may
+ *                             enable probes from this provider
+ *
+ *     DTRACE_PRIV_USER     <= Any user with privilege of PRIV_DTRACE_USER may
+ *                             enable probes from this provider
+ *
+ *     DTRACE_PRIV_KERNEL   <= Any user with privilege of PRIV_DTRACE_KERNEL
+ *                             may enable probes from this provider
+ *
+ *     DTRACE_PRIV_OWNER    <= This flag places an additional constraint on
+ *                             the privilege requirements above. These probes
+ *                             require either (a) a user ID matching the user
+ *                             ID of the cred passed in the fourth argument
+ *                             or (b) the PRIV_PROC_OWNER privilege.
+ *
+ *     DTRACE_PRIV_ZONEOWNER<= This flag places an additional constraint on
+ *                             the privilege requirements above. These probes
+ *                             require either (a) a zone ID matching the zone
+ *                             ID of the cred passed in the fourth argument
+ *                             or (b) the PRIV_PROC_ZONE privilege.
+ *
+ *   Note that these flags designate the _visibility_ of the probes, not
+ *   the conditions under which they may or may not fire.
+ *
+ *   The fourth argument is the credential that is associated with the
+ *   provider.  This argument should be NULL if the privilege flags don't
+ *   include DTRACE_PRIV_OWNER or DTRACE_PRIV_ZONEOWNER.  If non-NULL, the
+ *   framework stashes the uid and zoneid represented by this credential
+ *   for use at probe-time, in implicit predicates.  These limit visibility
+ *   of the probes to users and/or zones which have sufficient privilege to
+ *   access them.
+ *
+ *   The fifth argument is a DTrace provider operations vector, which provides
+ *   the implementation for the Framework-to-Provider API.  (See Section 1,
+ *   above.)  This must be non-NULL, and each member must be non-NULL.  The
+ *   exceptions to this are (1) the dtps_provide() and dtps_provide_module()
+ *   members (if the provider so desires, _one_ of these members may be left
+ *   NULL -- denoting that the provider only implements the other) and (2)
+ *   the dtps_suspend() and dtps_resume() members, which must either both be
+ *   NULL or both be non-NULL.
+ *
+ *   The sixth argument is a cookie to be specified as the first argument for
+ *   each function in the Framework-to-Provider API.  This argument may have
+ *   any value.
+ *
+ *   The final argument is a pointer to dtrace_provider_id_t.  If
+ *   dtrace_register() successfully completes, the provider identifier will be
+ *   stored in the memory pointed to be this argument.  This argument must be
+ *   non-NULL.
+ *
+ * 2.2.3  Return value
+ *
+ *   On success, dtrace_register() returns 0 and stores the new provider's
+ *   identifier into the memory pointed to by the idp argument.  On failure,
+ *   dtrace_register() returns an errno:
+ *
+ *     EINVAL   The arguments passed to dtrace_register() were somehow invalid.
+ *              This may because a parameter that must be non-NULL was NULL,
+ *              because the name was invalid (either empty or an illegal
+ *              provider name) or because the attributes were invalid.
+ *
+ *   No other failure code is returned.
+ *
+ * 2.2.4  Caller's context
+ *
+ *   dtrace_register() may induce calls to dtrace_provide(); the provider must
+ *   hold no locks across dtrace_register() that may also be acquired by
+ *   dtrace_provide().  cpu_lock and mod_lock must not be held.
+ *
+ * 2.3  int dtrace_unregister(dtrace_provider_t id)
+ *
+ * 2.3.1  Overview
+ *
+ *   Unregisters the specified provider from the DTrace framework.  It should
+ *   generally be called by DTrace providers in their detach(9E) entry point.
+ *
+ * 2.3.2  Arguments and Notes
+ *
+ *   The only argument is the provider identifier, as returned from a
+ *   successful call to dtrace_register().  As a result of calling
+ *   dtrace_unregister(), the DTrace framework will call back into the provider
+ *   via the dtps_destroy() entry point.  Once dtrace_unregister() successfully
+ *   completes, however, the DTrace framework will no longer make calls through
+ *   the Framework-to-Provider API.
+ *
+ * 2.3.3  Return value
+ *
+ *   On success, dtrace_unregister returns 0.  On failure, dtrace_unregister()
+ *   returns an errno:
+ *
+ *     EBUSY    There are currently processes that have the DTrace pseudodevice
+ *              open, or there exists an anonymous enabling that hasn't yet
+ *              been claimed.
+ *
+ *   No other failure code is returned.
+ *
+ * 2.3.4  Caller's context
+ *
+ *   Because a call to dtrace_unregister() may induce calls through the
+ *   Framework-to-Provider API, the caller may not hold any lock across
+ *   dtrace_register() that is also acquired in any of the Framework-to-
+ *   Provider API functions.  Additionally, mod_lock may not be held.
+ *
+ * 2.4  void dtrace_invalidate(dtrace_provider_id_t id)
+ *
+ * 2.4.1  Overview
+ *
+ *   Invalidates the specified provider.  All subsequent probe lookups for the
+ *   specified provider will fail, but its probes will not be removed.
+ *
+ * 2.4.2  Arguments and note
+ *
+ *   The only argument is the provider identifier, as returned from a
+ *   successful call to dtrace_register().  In general, a provider's probes
+ *   always remain valid; dtrace_invalidate() is a mechanism for invalidating
+ *   an entire provider, regardless of whether or not probes are enabled or
+ *   not.  Note that dtrace_invalidate() will _not_ prevent already enabled
+ *   probes from firing -- it will merely prevent any new enablings of the
+ *   provider's probes.
+ *
+ * 2.5 int dtrace_condense(dtrace_provider_id_t id)
+ *
+ * 2.5.1  Overview
+ *
+ *   Removes all the unenabled probes for the given provider. This function is
+ *   not unlike dtrace_unregister(), except that it doesn't remove the
+ *   provider just as many of its associated probes as it can.
+ *
+ * 2.5.2  Arguments and Notes
+ *
+ *   As with dtrace_unregister(), the sole argument is the provider identifier
+ *   as returned from a successful call to dtrace_register().  As a result of
+ *   calling dtrace_condense(), the DTrace framework will call back into the
+ *   given provider's dtps_destroy() entry point for each of the provider's
+ *   unenabled probes.
+ *
+ * 2.5.3  Return value
+ *
+ *   Currently, dtrace_condense() always returns 0.  However, consumers of this
+ *   function should check the return value as appropriate; its behavior may
+ *   change in the future.
+ *
+ * 2.5.4  Caller's context
+ *
+ *   As with dtrace_unregister(), the caller may not hold any lock across
+ *   dtrace_condense() that is also acquired in the provider's entry points.
+ *   Also, mod_lock may not be held.
+ *
+ * 2.6 int dtrace_attached()
+ *
+ * 2.6.1  Overview
+ *
+ *   Indicates whether or not DTrace has attached.
+ *
+ * 2.6.2  Arguments and Notes
+ *
+ *   For most providers, DTrace makes initial contact beyond registration.
+ *   That is, once a provider has registered with DTrace, it waits to hear
+ *   from DTrace to create probes.  However, some providers may wish to
+ *   proactively create probes without first being told by DTrace to do so.
+ *   If providers wish to do this, they must first call dtrace_attached() to
+ *   determine if DTrace itself has attached.  If dtrace_attached() returns 0,
+ *   the provider must not make any other Provider-to-Framework API call.
+ *
+ * 2.6.3  Return value
+ *
+ *   dtrace_attached() returns 1 if DTrace has attached, 0 otherwise.
+ *
+ * 2.7  int dtrace_probe_create(dtrace_provider_t id, const char *mod,
+ *	    const char *func, const char *name, int aframes, void *arg)
+ *
+ * 2.7.1  Overview
+ *
+ *   Creates a probe with specified module name, function name, and name.
+ *
+ * 2.7.2  Arguments and Notes
+ *
+ *   The first argument is the provider identifier, as returned from a
+ *   successful call to dtrace_register().  The second, third, and fourth
+ *   arguments are the module name, function name, and probe name,
+ *   respectively.  Of these, module name and function name may both be NULL
+ *   (in which case the probe is considered to be unanchored), or they may both
+ *   be non-NULL.  The name must be non-NULL, and must point to a non-empty
+ *   string.
+ *
+ *   The fifth argument is the number of artificial stack frames that will be
+ *   found on the stack when dtrace_probe() is called for the new probe.  These
+ *   artificial frames will be automatically be pruned should the stack() or
+ *   stackdepth() functions be called as part of one of the probe's ECBs.  If
+ *   the parameter doesn't add an artificial frame, this parameter should be
+ *   zero.
+ *
+ *   The final argument is a probe argument that will be passed back to the
+ *   provider when a probe-specific operation is called.  (e.g., via
+ *   dtps_enable(), dtps_disable(), etc.)
+ *
+ *   Note that it is up to the provider to be sure that the probe that it
+ *   creates does not already exist -- if the provider is unsure of the probe's
+ *   existence, it should assure its absence with dtrace_probe_lookup() before
+ *   calling dtrace_probe_create().
+ *
+ * 2.7.3  Return value
+ *
+ *   dtrace_probe_create() always succeeds, and always returns the identifier
+ *   of the newly-created probe.
+ *
+ * 2.7.4  Caller's context
+ *
+ *   While dtrace_probe_create() is generally expected to be called from
+ *   dtps_provide() and/or dtps_provide_module(), it may be called from other
+ *   non-DTrace contexts.  Neither cpu_lock nor mod_lock may be held.
+ *
+ * 2.8  dtrace_id_t dtrace_probe_lookup(dtrace_provider_t id, const char *mod,
+ *	    const char *func, const char *name)
+ *
+ * 2.8.1  Overview
+ *
+ *   Looks up a probe based on provdider and one or more of module name,
+ *   function name and probe name.
+ *
+ * 2.8.2  Arguments and Notes
+ *
+ *   The first argument is the provider identifier, as returned from a
+ *   successful call to dtrace_register().  The second, third, and fourth
+ *   arguments are the module name, function name, and probe name,
+ *   respectively.  Any of these may be NULL; dtrace_probe_lookup() will return
+ *   the identifier of the first probe that is provided by the specified
+ *   provider and matches all of the non-NULL matching criteria.
+ *   dtrace_probe_lookup() is generally used by a provider to be check the
+ *   existence of a probe before creating it with dtrace_probe_create().
+ *
+ * 2.8.3  Return value
+ *
+ *   If the probe exists, returns its identifier.  If the probe does not exist,
+ *   return DTRACE_IDNONE.
+ *
+ * 2.8.4  Caller's context
+ *
+ *   While dtrace_probe_lookup() is generally expected to be called from
+ *   dtps_provide() and/or dtps_provide_module(), it may also be called from
+ *   other non-DTrace contexts.  Neither cpu_lock nor mod_lock may be held.
+ *
+ * 2.9  void *dtrace_probe_arg(dtrace_provider_t id, dtrace_id_t probe)
+ *
+ * 2.9.1  Overview
+ *
+ *   Returns the probe argument associated with the specified probe.
+ *
+ * 2.9.2  Arguments and Notes
+ *
+ *   The first argument is the provider identifier, as returned from a
+ *   successful call to dtrace_register().  The second argument is a probe
+ *   identifier, as returned from dtrace_probe_lookup() or
+ *   dtrace_probe_create().  This is useful if a probe has multiple
+ *   provider-specific components to it:  the provider can create the probe
+ *   once with provider-specific state, and then add to the state by looking
+ *   up the probe based on probe identifier.
+ *
+ * 2.9.3  Return value
+ *
+ *   Returns the argument associated with the specified probe.  If the
+ *   specified probe does not exist, or if the specified probe is not provided
+ *   by the specified provider, NULL is returned.
+ *
+ * 2.9.4  Caller's context
+ *
+ *   While dtrace_probe_arg() is generally expected to be called from
+ *   dtps_provide() and/or dtps_provide_module(), it may also be called from
+ *   other non-DTrace contexts.  Neither cpu_lock nor mod_lock may be held.
+ *
+ * 2.10  void dtrace_probe(dtrace_id_t probe, uintptr_t arg0, uintptr_t arg1,
+ *		uintptr_t arg2, uintptr_t arg3, uintptr_t arg4)
+ *
+ * 2.10.1  Overview
+ *
+ *   The epicenter of DTrace:  fires the specified probes with the specified
+ *   arguments.
+ *
+ * 2.10.2  Arguments and Notes
+ *
+ *   The first argument is a probe identifier as returned by
+ *   dtrace_probe_create() or dtrace_probe_lookup().  The second through sixth
+ *   arguments are the values to which the D variables "arg0" through "arg4"
+ *   will be mapped.
+ *
+ *   dtrace_probe() should be called whenever the specified probe has fired --
+ *   however the provider defines it.
+ *
+ * 2.10.3  Return value
+ *
+ *   None.
+ *
+ * 2.10.4  Caller's context
+ *
+ *   dtrace_probe() may be called in virtually any context:  kernel, user,
+ *   interrupt, high-level interrupt, with arbitrary adaptive locks held, with
+ *   dispatcher locks held, with interrupts disabled, etc.  The only latitude
+ *   that must be afforded to DTrace is the ability to make calls within
+ *   itself (and to its in-kernel subroutines) and the ability to access
+ *   arbitrary (but mapped) memory.  On some platforms, this constrains
+ *   context.  For example, on UltraSPARC, dtrace_probe() cannot be called
+ *   from any context in which TL is greater than zero.  dtrace_probe() may
+ *   also not be called from any routine which may be called by dtrace_probe()
+ *   -- which includes functions in the DTrace framework and some in-kernel
+ *   DTrace subroutines.  All such functions "dtrace_"; providers that
+ *   instrument the kernel arbitrarily should be sure to not instrument these
+ *   routines.
+ */
+typedef struct dtrace_pops {
+	void (*dtps_provide)(void *arg, const dtrace_probedesc_t *spec);
+	void (*dtps_provide_module)(void *arg, struct modctl *mp);
+	int (*dtps_enable)(void *arg, dtrace_id_t id, void *parg);
+	void (*dtps_disable)(void *arg, dtrace_id_t id, void *parg);
+	void (*dtps_suspend)(void *arg, dtrace_id_t id, void *parg);
+	void (*dtps_resume)(void *arg, dtrace_id_t id, void *parg);
+	void (*dtps_getargdesc)(void *arg, dtrace_id_t id, void *parg,
+	    dtrace_argdesc_t *desc);
+	uint64_t (*dtps_getargval)(void *arg, dtrace_id_t id, void *parg,
+	    int argno, int aframes);
+	int (*dtps_usermode)(void *arg, dtrace_id_t id, void *parg);
+	void (*dtps_destroy)(void *arg, dtrace_id_t id, void *parg);
+} dtrace_pops_t;
+
+typedef uintptr_t	dtrace_provider_id_t;
+
+extern int dtrace_register(const char *, const dtrace_pattr_t *, uint32_t,
+    cred_t *, const dtrace_pops_t *, void *, dtrace_provider_id_t *);
+extern int dtrace_unregister(dtrace_provider_id_t);
+extern int dtrace_condense(dtrace_provider_id_t);
+extern void dtrace_invalidate(dtrace_provider_id_t);
+extern dtrace_id_t dtrace_probe_lookup(dtrace_provider_id_t, const char *,
+    const char *, const char *);
+extern dtrace_id_t dtrace_probe_create(dtrace_provider_id_t, const char *,
+    const char *, const char *, int, void *);
+extern void *dtrace_probe_arg(dtrace_provider_id_t, dtrace_id_t);
+extern void dtrace_probe(dtrace_id_t, uintptr_t arg0, uintptr_t arg1,
+    uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);
+
+/*
+ * DTrace Meta Provider API
+ *
+ * The following functions are implemented by the DTrace framework and are
+ * used to implement meta providers. Meta providers plug into the DTrace
+ * framework and are used to instantiate new providers on the fly. At
+ * present, there is only one type of meta provider and only one meta
+ * provider may be registered with the DTrace framework at a time. The
+ * sole meta provider type provides user-land static tracing facilities
+ * by taking meta probe descriptions and adding a corresponding provider
+ * into the DTrace framework.
+ *
+ * 1 Framework-to-Provider
+ *
+ * 1.1 Overview
+ *
+ * The Framework-to-Provider API is represented by the dtrace_mops structure
+ * that the meta provider passes to the framework when registering itself as
+ * a meta provider. This structure consists of the following members:
+ *
+ *   dtms_create_probe()	<-- Add a new probe to a created provider
+ *   dtms_provide_pid()		<-- Create a new provider for a given process
+ *   dtms_remove_pid()		<-- Remove a previously created provider
+ *
+ * 1.2  void dtms_create_probe(void *arg, void *parg,
+ *           dtrace_helper_probedesc_t *probedesc);
+ *
+ * 1.2.1  Overview
+ *
+ *   Called by the DTrace framework to create a new probe in a provider
+ *   created by this meta provider.
+ *
+ * 1.2.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_meta_register().
+ *   The second argument is the provider cookie for the associated provider;
+ *   this is obtained from the return value of dtms_provide_pid(). The third
+ *   argument is the helper probe description.
+ *
+ * 1.2.3  Return value
+ *
+ *   None
+ *
+ * 1.2.4  Caller's context
+ *
+ *   dtms_create_probe() is called from either ioctl() or module load context.
+ *   The DTrace framework is locked in such a way that meta providers may not
+ *   register or unregister. This means that the meta provider cannot call
+ *   dtrace_meta_register() or dtrace_meta_unregister(). However, the context is
+ *   such that the provider may (and is expected to) call provider-related
+ *   DTrace provider APIs including dtrace_probe_create().
+ *
+ * 1.3  void *dtms_provide_pid(void *arg, dtrace_meta_provider_t *mprov,
+ *	      pid_t pid)
+ *
+ * 1.3.1  Overview
+ *
+ *   Called by the DTrace framework to instantiate a new provider given the
+ *   description of the provider and probes in the mprov argument. The
+ *   meta provider should call dtrace_register() to insert the new provider
+ *   into the DTrace framework.
+ *
+ * 1.3.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_meta_register().
+ *   The second argument is a pointer to a structure describing the new
+ *   helper provider. The third argument is the process identifier for
+ *   process associated with this new provider. Note that the name of the
+ *   provider as passed to dtrace_register() should be the contatenation of
+ *   the dtmpb_provname member of the mprov argument and the processs
+ *   identifier as a string.
+ *
+ * 1.3.3  Return value
+ *
+ *   The cookie for the provider that the meta provider creates. This is
+ *   the same value that it passed to dtrace_register().
+ *
+ * 1.3.4  Caller's context
+ *
+ *   dtms_provide_pid() is called from either ioctl() or module load context.
+ *   The DTrace framework is locked in such a way that meta providers may not
+ *   register or unregister. This means that the meta provider cannot call
+ *   dtrace_meta_register() or dtrace_meta_unregister(). However, the context
+ *   is such that the provider may -- and is expected to --  call
+ *   provider-related DTrace provider APIs including dtrace_register().
+ *
+ * 1.4  void dtms_remove_pid(void *arg, dtrace_meta_provider_t *mprov,
+ *	     pid_t pid)
+ *
+ * 1.4.1  Overview
+ *
+ *   Called by the DTrace framework to remove a provider that had previously
+ *   been instantiated via the dtms_provide_pid() entry point. The meta
+ *   provider need not remove the provider immediately, but this entry
+ *   point indicates that the provider should be removed as soon as possible
+ *   using the dtrace_unregister() API.
+ *
+ * 1.4.2  Arguments and notes
+ *
+ *   The first argument is the cookie as passed to dtrace_meta_register().
+ *   The second argument is a pointer to a structure describing the helper
+ *   provider. The third argument is the process identifier for process
+ *   associated with this new provider.
+ *
+ * 1.4.3  Return value
+ *
+ *   None
+ *
+ * 1.4.4  Caller's context
+ *
+ *   dtms_remove_pid() is called from either ioctl() or exit() context.
+ *   The DTrace framework is locked in such a way that meta providers may not
+ *   register or unregister. This means that the meta provider cannot call
+ *   dtrace_meta_register() or dtrace_meta_unregister(). However, the context
+ *   is such that the provider may -- and is expected to -- call
+ *   provider-related DTrace provider APIs including dtrace_unregister().
+ */
+typedef struct dtrace_helper_probedesc {
+	char *dthpb_mod;			/* probe module */
+	char *dthpb_func; 			/* probe function */
+	char *dthpb_name; 			/* probe name */
+	uint64_t dthpb_base;			/* base address */
+	uint32_t *dthpb_offs;			/* offsets array */
+	uint32_t *dthpb_enoffs;			/* is-enabled offsets array */
+	uint32_t dthpb_noffs;			/* offsets count */
+	uint32_t dthpb_nenoffs;			/* is-enabled offsets count */
+	uint8_t *dthpb_args;			/* argument mapping array */
+	uint8_t dthpb_xargc;			/* translated argument count */
+	uint8_t dthpb_nargc;			/* native argument count */
+	char *dthpb_xtypes;			/* translated types strings */
+	char *dthpb_ntypes;			/* native types strings */
+} dtrace_helper_probedesc_t;
+
+typedef struct dtrace_helper_provdesc {
+	char *dthpv_provname;			/* provider name */
+	dtrace_pattr_t dthpv_pattr;		/* stability attributes */
+} dtrace_helper_provdesc_t;
+
+typedef struct dtrace_mops {
+	void (*dtms_create_probe)(void *, void *, dtrace_helper_probedesc_t *);
+	void *(*dtms_provide_pid)(void *, dtrace_helper_provdesc_t *, pid_t);
+	void (*dtms_remove_pid)(void *, dtrace_helper_provdesc_t *, pid_t);
+} dtrace_mops_t;
+
+typedef uintptr_t	dtrace_meta_provider_id_t;
+
+extern int dtrace_meta_register(const char *, const dtrace_mops_t *, void *,
+    dtrace_meta_provider_id_t *);
+extern int dtrace_meta_unregister(dtrace_meta_provider_id_t);
+
+/*
+ * DTrace Kernel Hooks
+ *
+ * The following functions are implemented by the base kernel and form a set of
+ * hooks used by the DTrace framework.  DTrace hooks are implemented in either
+ * uts/common/os/dtrace_subr.c, an ISA-specific assembly file, or in a
+ * uts/<platform>/os/dtrace_subr.c corresponding to each hardware platform.
+ */
+
+typedef enum dtrace_vtime_state {
+	DTRACE_VTIME_INACTIVE = 0,	/* No DTrace, no TNF */
+	DTRACE_VTIME_ACTIVE,		/* DTrace virtual time, no TNF */
+	DTRACE_VTIME_INACTIVE_TNF,	/* No DTrace, TNF active */
+	DTRACE_VTIME_ACTIVE_TNF		/* DTrace virtual time _and_ TNF */
+} dtrace_vtime_state_t;
+
+extern dtrace_vtime_state_t dtrace_vtime_active;
+extern void dtrace_vtime_switch(kthread_t *next);
+extern void dtrace_vtime_enable_tnf(void);
+extern void dtrace_vtime_disable_tnf(void);
+extern void dtrace_vtime_enable(void);
+extern void dtrace_vtime_disable(void);
+
+struct regs;
+
+extern int (*dtrace_pid_probe_ptr)(struct regs *);
+extern int (*dtrace_return_probe_ptr)(struct regs *);
+extern void (*dtrace_fasttrap_fork_ptr)(proc_t *, proc_t *);
+extern void (*dtrace_fasttrap_exec_ptr)(proc_t *);
+extern void (*dtrace_fasttrap_exit_ptr)(proc_t *);
+extern void dtrace_fasttrap_fork(proc_t *, proc_t *);
+
+typedef uintptr_t dtrace_icookie_t;
+typedef void (*dtrace_xcall_t)(void *);
+
+extern dtrace_icookie_t dtrace_interrupt_disable(void);
+extern void dtrace_interrupt_enable(dtrace_icookie_t);
+
+extern void dtrace_membar_producer(void);
+extern void dtrace_membar_consumer(void);
+
+extern void (*dtrace_cpu_init)(processorid_t);
+extern void (*dtrace_modload)(struct modctl *);
+extern void (*dtrace_modunload)(struct modctl *);
+extern void (*dtrace_helpers_cleanup)(VBDTVOID);
+extern void (*dtrace_helpers_fork)(proc_t *parent, proc_t *child);
+extern void (*dtrace_cpustart_init)(VBDTVOID);
+extern void (*dtrace_cpustart_fini)(VBDTVOID);
+
+extern void (*dtrace_debugger_init)(VBDTVOID);
+extern void (*dtrace_debugger_fini)(VBDTVOID);
+extern dtrace_cacheid_t dtrace_predcache_id;
+
+extern hrtime_t dtrace_gethrtime(void);
+extern void dtrace_sync(void);
+extern void dtrace_toxic_ranges(void (*)(uintptr_t, uintptr_t));
+extern void dtrace_xcall(processorid_t, dtrace_xcall_t, void *);
+#ifdef VBOX
+extern void dtrace_vpanic(const char *, va_list);
+#else
+extern void dtrace_vpanic(const char *, __va_list);
+#endif
+extern void dtrace_panic(const char *, ...);
+
+extern int dtrace_safe_defer_signal(void);
+extern void dtrace_safe_synchronous_signal(void);
+
+extern int dtrace_mach_aframes(void);
+
+#if defined(__i386) || defined(__amd64)
+extern int dtrace_instr_size(uchar_t *instr);
+extern int dtrace_instr_size_isa(uchar_t *, model_t, int *);
+extern void dtrace_invop_add(int (*)(uintptr_t, uintptr_t *, uintptr_t));
+extern void dtrace_invop_remove(int (*)(uintptr_t, uintptr_t *, uintptr_t));
+extern void dtrace_invop_callsite(void);
+#endif
+
+#ifdef __sparc
+extern int dtrace_blksuword32(uintptr_t, uint32_t *, int);
+extern void dtrace_getfsr(uint64_t *);
+#endif
+
+#ifndef VBOX
+# define VBDT_GET_CPUID()		(CPU->cpu_id)
+# define VBDT_GET_PROC()		(ttoproc(curthread))
+#else
+# define VBDT_GET_CPUID()		(RTMpCpuId())
+# define VBDT_GET_PROC()		(VBoxDtGetCurrentProc())
+proc_t *VBoxDtGetCurrentProc(void);
+#endif
+
+#define	DTRACE_CPUFLAG_ISSET(flag) \
+	(cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags & (flag))
+
+#define	DTRACE_CPUFLAG_SET(flag) \
+	(cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= (flag))
+
+#define	DTRACE_CPUFLAG_CLEAR(flag) \
+	(cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags &= ~(flag))
+
+#endif /* _KERNEL || IN_RING0 */
+
+#endif	/* _ASM */
+
+#if defined(__i386) || defined(__amd64)
+
+#define	DTRACE_INVOP_PUSHL_EBP		1
+#define	DTRACE_INVOP_POPL_EBP		2
+#define	DTRACE_INVOP_LEAVE		3
+#define	DTRACE_INVOP_NOP		4
+#define	DTRACE_INVOP_RET		5
+
+#endif
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif	/* _SYS_DTRACE_H */
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace_impl.h b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace_impl.h
new file mode 100644
index 0000000..a0e53d5
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace_impl.h
@@ -0,0 +1,1304 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _SYS_DTRACE_IMPL_H
+#define	_SYS_DTRACE_IMPL_H
+
+#ifndef VBOX
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/*
+ * DTrace Dynamic Tracing Software: Kernel Implementation Interfaces
+ *
+ * Note: The contents of this file are private to the implementation of the
+ * Solaris system and DTrace subsystem and are subject to change at any time
+ * without notice.  Applications and drivers using these interfaces will fail
+ * to run on future releases.  These interfaces should not be used for any
+ * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB).
+ * Please refer to the "Solaris Dynamic Tracing Guide" for more information.
+ */
+
+#include <sys/dtrace.h>
+
+/*
+ * DTrace Implementation Constants and Typedefs
+ */
+#define	DTRACE_MAXPROPLEN		128
+#define	DTRACE_DYNVAR_CHUNKSIZE		256
+
+struct dtrace_probe;
+struct dtrace_ecb;
+struct dtrace_predicate;
+struct dtrace_action;
+struct dtrace_provider;
+struct dtrace_state;
+
+typedef struct dtrace_probe dtrace_probe_t;
+typedef struct dtrace_ecb dtrace_ecb_t;
+typedef struct dtrace_predicate dtrace_predicate_t;
+typedef struct dtrace_action dtrace_action_t;
+typedef struct dtrace_provider dtrace_provider_t;
+typedef struct dtrace_meta dtrace_meta_t;
+typedef struct dtrace_state dtrace_state_t;
+typedef uint32_t dtrace_optid_t;
+typedef uint32_t dtrace_specid_t;
+typedef uint64_t dtrace_genid_t;
+
+/*
+ * DTrace Probes
+ *
+ * The probe is the fundamental unit of the DTrace architecture.  Probes are
+ * created by DTrace providers, and managed by the DTrace framework.  A probe
+ * is identified by a unique <provider, module, function, name> tuple, and has
+ * a unique probe identifier assigned to it.  (Some probes are not associated
+ * with a specific point in text; these are called _unanchored probes_ and have
+ * no module or function associated with them.)  Probes are represented as a
+ * dtrace_probe structure.  To allow quick lookups based on each element of the
+ * probe tuple, probes are hashed by each of provider, module, function and
+ * name.  (If a lookup is performed based on a regular expression, a
+ * dtrace_probekey is prepared, and a linear search is performed.) Each probe
+ * is additionally pointed to by a linear array indexed by its identifier.  The
+ * identifier is the provider's mechanism for indicating to the DTrace
+ * framework that a probe has fired:  the identifier is passed as the first
+ * argument to dtrace_probe(), where it is then mapped into the corresponding
+ * dtrace_probe structure.  From the dtrace_probe structure, dtrace_probe() can
+ * iterate over the probe's list of enabling control blocks; see "DTrace
+ * Enabling Control Blocks", below.)
+ */
+struct dtrace_probe {
+	dtrace_id_t dtpr_id;			/* probe identifier */
+	dtrace_ecb_t *dtpr_ecb;			/* ECB list; see below */
+	dtrace_ecb_t *dtpr_ecb_last;		/* last ECB in list */
+	void *dtpr_arg;				/* provider argument */
+	dtrace_cacheid_t dtpr_predcache;	/* predicate cache ID */
+	int dtpr_aframes;			/* artificial frames */
+	dtrace_provider_t *dtpr_provider;	/* pointer to provider */
+	char *dtpr_mod;				/* probe's module name */
+	char *dtpr_func;			/* probe's function name */
+	char *dtpr_name;			/* probe's name */
+	dtrace_probe_t *dtpr_nextmod;		/* next in module hash */
+	dtrace_probe_t *dtpr_prevmod;		/* previous in module hash */
+	dtrace_probe_t *dtpr_nextfunc;		/* next in function hash */
+	dtrace_probe_t *dtpr_prevfunc;		/* previous in function hash */
+	dtrace_probe_t *dtpr_nextname;		/* next in name hash */
+	dtrace_probe_t *dtpr_prevname;		/* previous in name hash */
+	dtrace_genid_t dtpr_gen;		/* probe generation ID */
+};
+
+typedef int dtrace_probekey_f(const char *, const char *, int);
+
+typedef struct dtrace_probekey {
+	const char *dtpk_prov;			/* provider name to match */
+	dtrace_probekey_f *dtpk_pmatch;		/* provider matching function */
+	const char *dtpk_mod;			/* module name to match */
+	dtrace_probekey_f *dtpk_mmatch;		/* module matching function */
+	const char *dtpk_func;			/* func name to match */
+	dtrace_probekey_f *dtpk_fmatch;		/* func matching function */
+	const char *dtpk_name;			/* name to match */
+	dtrace_probekey_f *dtpk_nmatch;		/* name matching function */
+	dtrace_id_t dtpk_id;			/* identifier to match */
+} dtrace_probekey_t;
+
+typedef struct dtrace_hashbucket {
+	struct dtrace_hashbucket *dthb_next;	/* next on hash chain */
+	dtrace_probe_t *dthb_chain;		/* chain of probes */
+	int dthb_len;				/* number of probes here */
+} dtrace_hashbucket_t;
+
+typedef struct dtrace_hash {
+	dtrace_hashbucket_t **dth_tab;		/* hash table */
+	int dth_size;				/* size of hash table */
+	int dth_mask;				/* mask to index into table */
+	int dth_nbuckets;			/* total number of buckets */
+	uintptr_t dth_nextoffs;			/* offset of next in probe */
+	uintptr_t dth_prevoffs;			/* offset of prev in probe */
+	uintptr_t dth_stroffs;			/* offset of str in probe */
+} dtrace_hash_t;
+
+/*
+ * DTrace Enabling Control Blocks
+ *
+ * When a provider wishes to fire a probe, it calls into dtrace_probe(),
+ * passing the probe identifier as the first argument.  As described above,
+ * dtrace_probe() maps the identifier into a pointer to a dtrace_probe_t
+ * structure.  This structure contains information about the probe, and a
+ * pointer to the list of Enabling Control Blocks (ECBs).  Each ECB points to
+ * DTrace consumer state, and contains an optional predicate, and a list of
+ * actions.  (Shown schematically below.)  The ECB abstraction allows a single
+ * probe to be multiplexed across disjoint consumers, or across disjoint
+ * enablings of a single probe within one consumer.
+ *
+ *   Enabling Control Block
+ *        dtrace_ecb_t
+ * +------------------------+
+ * | dtrace_epid_t ---------+--------------> Enabled Probe ID (EPID)
+ * | dtrace_state_t * ------+--------------> State associated with this ECB
+ * | dtrace_predicate_t * --+---------+
+ * | dtrace_action_t * -----+----+    |
+ * | dtrace_ecb_t * ---+    |    |    |       Predicate (if any)
+ * +-------------------+----+    |    |       dtrace_predicate_t
+ *                     |         |    +---> +--------------------+
+ *                     |         |          | dtrace_difo_t * ---+----> DIFO
+ *                     |         |          +--------------------+
+ *                     |         |
+ *            Next ECB |         |           Action
+ *            (if any) |         |       dtrace_action_t
+ *                     :         +--> +-------------------+
+ *                     :              | dtrace_actkind_t -+------> kind
+ *                     v              | dtrace_difo_t * --+------> DIFO (if any)
+ *                                    | dtrace_recdesc_t -+------> record descr.
+ *                                    | dtrace_action_t * +------+
+ *                                    +-------------------+      |
+ *                                                               | Next action
+ *                               +-------------------------------+  (if any)
+ *                               |
+ *                               |           Action
+ *                               |       dtrace_action_t
+ *                               +--> +-------------------+
+ *                                    | dtrace_actkind_t -+------> kind
+ *                                    | dtrace_difo_t * --+------> DIFO (if any)
+ *                                    | dtrace_action_t * +------+
+ *                                    +-------------------+      |
+ *                                                               | Next action
+ *                               +-------------------------------+  (if any)
+ *                               |
+ *                               :
+ *                               v
+ *
+ *
+ * dtrace_probe() iterates over the ECB list.  If the ECB needs less space
+ * than is available in the principal buffer, the ECB is processed:  if the
+ * predicate is non-NULL, the DIF object is executed.  If the result is
+ * non-zero, the action list is processed, with each action being executed
+ * accordingly.  When the action list has been completely executed, processing
+ * advances to the next ECB.  processing advances to the next ECB.  If the
+ * result is non-zero; For each ECB, it first determines the The ECB
+ * abstraction allows disjoint consumers to multiplex on single probes.
+ */
+struct dtrace_ecb {
+	dtrace_epid_t dte_epid;			/* enabled probe ID */
+	uint32_t dte_alignment;			/* required alignment */
+	size_t dte_needed;			/* bytes needed */
+	size_t dte_size;			/* total size of payload */
+	dtrace_predicate_t *dte_predicate;	/* predicate, if any */
+	dtrace_action_t *dte_action;		/* actions, if any */
+	dtrace_ecb_t *dte_next;			/* next ECB on probe */
+	dtrace_state_t *dte_state;		/* pointer to state */
+	uint32_t dte_cond;			/* security condition */
+	dtrace_probe_t *dte_probe;		/* pointer to probe */
+	dtrace_action_t *dte_action_last;	/* last action on ECB */
+	uint64_t dte_uarg;			/* library argument */
+};
+
+struct dtrace_predicate {
+	dtrace_difo_t *dtp_difo;		/* DIF object */
+	dtrace_cacheid_t dtp_cacheid;		/* cache identifier */
+	int dtp_refcnt;				/* reference count */
+};
+
+struct dtrace_action {
+	dtrace_actkind_t dta_kind;		/* kind of action */
+	uint16_t dta_intuple;			/* boolean:  in aggregation */
+	uint32_t dta_refcnt;			/* reference count */
+	dtrace_difo_t *dta_difo;		/* pointer to DIFO */
+	dtrace_recdesc_t dta_rec;		/* record description */
+	dtrace_action_t *dta_prev;		/* previous action */
+	dtrace_action_t *dta_next;		/* next action */
+};
+
+typedef struct dtrace_aggregation {
+	dtrace_action_t dtag_action;		/* action; must be first */
+	dtrace_aggid_t dtag_id;			/* identifier */
+	dtrace_ecb_t *dtag_ecb;			/* corresponding ECB */
+	dtrace_action_t *dtag_first;		/* first action in tuple */
+	uint32_t dtag_base;			/* base of aggregation */
+	uint8_t dtag_hasarg;			/* boolean:  has argument */
+	uint64_t dtag_initial;			/* initial value */
+	void (*dtag_aggregate)(uint64_t *, uint64_t, uint64_t);
+} dtrace_aggregation_t;
+
+/*
+ * DTrace Buffers
+ *
+ * Principal buffers, aggregation buffers, and speculative buffers are all
+ * managed with the dtrace_buffer structure.  By default, this structure
+ * includes twin data buffers -- dtb_tomax and dtb_xamot -- that serve as the
+ * active and passive buffers, respectively.  For speculative buffers,
+ * dtb_xamot will be NULL; for "ring" and "fill" buffers, dtb_xamot will point
+ * to a scratch buffer.  For all buffer types, the dtrace_buffer structure is
+ * always allocated on a per-CPU basis; a single dtrace_buffer structure is
+ * never shared among CPUs.  (That is, there is never true sharing of the
+ * dtrace_buffer structure; to prevent false sharing of the structure, it must
+ * always be aligned to the coherence granularity -- generally 64 bytes.)
+ *
+ * One of the critical design decisions of DTrace is that a given ECB always
+ * stores the same quantity and type of data.  This is done to assure that the
+ * only metadata required for an ECB's traced data is the EPID.  That is, from
+ * the EPID, the consumer can determine the data layout.  (The data buffer
+ * layout is shown schematically below.)  By assuring that one can determine
+ * data layout from the EPID, the metadata stream can be separated from the
+ * data stream -- simplifying the data stream enormously.
+ *
+ *      base of data buffer --->  +------+--------------------+------+
+ *                                | EPID | data               | EPID |
+ *                                +------+--------+------+----+------+
+ *                                | data          | EPID | data      |
+ *                                +---------------+------+-----------+
+ *                                | data, cont.                      |
+ *                                +------+--------------------+------+
+ *                                | EPID | data               |      |
+ *                                +------+--------------------+      |
+ *                                |                ||                |
+ *                                |                ||                |
+ *                                |                \/                |
+ *                                :                                  :
+ *                                .                                  .
+ *                                .                                  .
+ *                                .                                  .
+ *                                :                                  :
+ *                                |                                  |
+ *     limit of data buffer --->  +----------------------------------+
+ *
+ * When evaluating an ECB, dtrace_probe() determines if the ECB's needs of the
+ * principal buffer (both scratch and payload) exceed the available space.  If
+ * the ECB's needs exceed available space (and if the principal buffer policy
+ * is the default "switch" policy), the ECB is dropped, the buffer's drop count
+ * is incremented, and processing advances to the next ECB.  If the ECB's needs
+ * can be met with the available space, the ECB is processed, but the offset in
+ * the principal buffer is only advanced if the ECB completes processing
+ * without error.
+ *
+ * When a buffer is to be switched (either because the buffer is the principal
+ * buffer with a "switch" policy or because it is an aggregation buffer), a
+ * cross call is issued to the CPU associated with the buffer.  In the cross
+ * call context, interrupts are disabled, and the active and the inactive
+ * buffers are atomically switched.  This involves switching the data pointers,
+ * copying the various state fields (offset, drops, errors, etc.) into their
+ * inactive equivalents, and clearing the state fields.  Because interrupts are
+ * disabled during this procedure, the switch is guaranteed to appear atomic to
+ * dtrace_probe().
+ *
+ * DTrace Ring Buffering
+ *
+ * To process a ring buffer correctly, one must know the oldest valid record.
+ * Processing starts at the oldest record in the buffer and continues until
+ * the end of the buffer is reached.  Processing then resumes starting with
+ * the record stored at offset 0 in the buffer, and continues until the
+ * youngest record is processed.  If trace records are of a fixed-length,
+ * determining the oldest record is trivial:
+ *
+ *   - If the ring buffer has not wrapped, the oldest record is the record
+ *     stored at offset 0.
+ *
+ *   - If the ring buffer has wrapped, the oldest record is the record stored
+ *     at the current offset.
+ *
+ * With variable length records, however, just knowing the current offset
+ * doesn't suffice for determining the oldest valid record:  assuming that one
+ * allows for arbitrary data, one has no way of searching forward from the
+ * current offset to find the oldest valid record.  (That is, one has no way
+ * of separating data from metadata.) It would be possible to simply refuse to
+ * process any data in the ring buffer between the current offset and the
+ * limit, but this leaves (potentially) an enormous amount of otherwise valid
+ * data unprocessed.
+ *
+ * To effect ring buffering, we track two offsets in the buffer:  the current
+ * offset and the _wrapped_ offset.  If a request is made to reserve some
+ * amount of data, and the buffer has wrapped, the wrapped offset is
+ * incremented until the wrapped offset minus the current offset is greater
+ * than or equal to the reserve request.  This is done by repeatedly looking
+ * up the ECB corresponding to the EPID at the current wrapped offset, and
+ * incrementing the wrapped offset by the size of the data payload
+ * corresponding to that ECB.  If this offset is greater than or equal to the
+ * limit of the data buffer, the wrapped offset is set to 0.  Thus, the
+ * current offset effectively "chases" the wrapped offset around the buffer.
+ * Schematically:
+ *
+ *      base of data buffer --->  +------+--------------------+------+
+ *                                | EPID | data               | EPID |
+ *                                +------+--------+------+----+------+
+ *                                | data          | EPID | data      |
+ *                                +---------------+------+-----------+
+ *                                | data, cont.                      |
+ *                                +------+---------------------------+
+ *                                | EPID | data                      |
+ *           current offset --->  +------+---------------------------+
+ *                                | invalid data                     |
+ *           wrapped offset --->  +------+--------------------+------+
+ *                                | EPID | data               | EPID |
+ *                                +------+--------+------+----+------+
+ *                                | data          | EPID | data      |
+ *                                +---------------+------+-----------+
+ *                                :                                  :
+ *                                .                                  .
+ *                                .        ... valid data ...        .
+ *                                .                                  .
+ *                                :                                  :
+ *                                +------+-------------+------+------+
+ *                                | EPID | data        | EPID | data |
+ *                                +------+------------++------+------+
+ *                                | data, cont.       | leftover     |
+ *     limit of data buffer --->  +-------------------+--------------+
+ *
+ * If the amount of requested buffer space exceeds the amount of space
+ * available between the current offset and the end of the buffer:
+ *
+ *  (1)  all words in the data buffer between the current offset and the limit
+ *       of the data buffer (marked "leftover", above) are set to
+ *       DTRACE_EPIDNONE
+ *
+ *  (2)  the wrapped offset is set to zero
+ *
+ *  (3)  the iteration process described above occurs until the wrapped offset
+ *       is greater than the amount of desired space.
+ *
+ * The wrapped offset is implemented by (re-)using the inactive offset.
+ * In a "switch" buffer policy, the inactive offset stores the offset in
+ * the inactive buffer; in a "ring" buffer policy, it stores the wrapped
+ * offset.
+ *
+ * DTrace Scratch Buffering
+ *
+ * Some ECBs may wish to allocate dynamically-sized temporary scratch memory.
+ * To accommodate such requests easily, scratch memory may be allocated in
+ * the buffer beyond the current offset plus the needed memory of the current
+ * ECB.  If there isn't sufficient room in the buffer for the requested amount
+ * of scratch space, the allocation fails and an error is generated.  Scratch
+ * memory is tracked in the dtrace_mstate_t and is automatically freed when
+ * the ECB ceases processing.  Note that ring buffers cannot allocate their
+ * scratch from the principal buffer -- lest they needlessly overwrite older,
+ * valid data.  Ring buffers therefore have their own dedicated scratch buffer
+ * from which scratch is allocated.
+ */
+#define	DTRACEBUF_RING		0x0001		/* bufpolicy set to "ring" */
+#define	DTRACEBUF_FILL		0x0002		/* bufpolicy set to "fill" */
+#define	DTRACEBUF_NOSWITCH	0x0004		/* do not switch buffer */
+#define	DTRACEBUF_WRAPPED	0x0008		/* ring buffer has wrapped */
+#define	DTRACEBUF_DROPPED	0x0010		/* drops occurred */
+#define	DTRACEBUF_ERROR		0x0020		/* errors occurred */
+#define	DTRACEBUF_FULL		0x0040		/* "fill" buffer is full */
+#define	DTRACEBUF_CONSUMED	0x0080		/* buffer has been consumed */
+#define	DTRACEBUF_INACTIVE	0x0100		/* buffer is not yet active */
+
+typedef struct dtrace_buffer {
+	uint64_t dtb_offset;			/* current offset in buffer */
+	uint64_t dtb_size;			/* size of buffer */
+	uint32_t dtb_flags;			/* flags */
+	uint32_t dtb_drops;			/* number of drops */
+	caddr_t dtb_tomax;			/* active buffer */
+	caddr_t dtb_xamot;			/* inactive buffer */
+	uint32_t dtb_xamot_flags;		/* inactive flags */
+	uint32_t dtb_xamot_drops;		/* drops in inactive buffer */
+	uint64_t dtb_xamot_offset;		/* offset in inactive buffer */
+	uint32_t dtb_errors;			/* number of errors */
+	uint32_t dtb_xamot_errors;		/* errors in inactive buffer */
+#ifndef _LP64
+	uint64_t dtb_pad1;
+#endif
+} dtrace_buffer_t;
+
+/*
+ * DTrace Aggregation Buffers
+ *
+ * Aggregation buffers use much of the same mechanism as described above
+ * ("DTrace Buffers").  However, because an aggregation is fundamentally a
+ * hash, there exists dynamic metadata associated with an aggregation buffer
+ * that is not associated with other kinds of buffers.  This aggregation
+ * metadata is _only_ relevant for the in-kernel implementation of
+ * aggregations; it is not actually relevant to user-level consumers.  To do
+ * this, we allocate dynamic aggregation data (hash keys and hash buckets)
+ * starting below the _limit_ of the buffer, and we allocate data from the
+ * _base_ of the buffer.  When the aggregation buffer is copied out, _only_ the
+ * data is copied out; the metadata is simply discarded.  Schematically,
+ * aggregation buffers look like:
+ *
+ *      base of data buffer --->  +-------+------+-----------+-------+
+ *                                | aggid | key  | value     | aggid |
+ *                                +-------+------+-----------+-------+
+ *                                | key                              |
+ *                                +-------+-------+-----+------------+
+ *                                | value | aggid | key | value      |
+ *                                +-------+------++-----+------+-----+
+ *                                | aggid | key  | value       |     |
+ *                                +-------+------+-------------+     |
+ *                                |                ||                |
+ *                                |                ||                |
+ *                                |                \/                |
+ *                                :                                  :
+ *                                .                                  .
+ *                                .                                  .
+ *                                .                                  .
+ *                                :                                  :
+ *                                |                /\                |
+ *                                |                ||   +------------+
+ *                                |                ||   |            |
+ *                                +---------------------+            |
+ *                                | hash keys                        |
+ *                                | (dtrace_aggkey structures)       |
+ *                                |                                  |
+ *                                +----------------------------------+
+ *                                | hash buckets                     |
+ *                                | (dtrace_aggbuffer structure)     |
+ *                                |                                  |
+ *     limit of data buffer --->  +----------------------------------+
+ *
+ *
+ * As implied above, just as we assure that ECBs always store a constant
+ * amount of data, we assure that a given aggregation -- identified by its
+ * aggregation ID -- always stores data of a constant quantity and type.
+ * As with EPIDs, this allows the aggregation ID to serve as the metadata for a
+ * given record.
+ *
+ * Note that the size of the dtrace_aggkey structure must be sizeof (uintptr_t)
+ * aligned.  (If this the structure changes such that this becomes false, an
+ * assertion will fail in dtrace_aggregate().)
+ */
+typedef struct dtrace_aggkey {
+	uint32_t dtak_hashval;			/* hash value */
+	uint32_t dtak_action:4;			/* action -- 4 bits */
+	uint32_t dtak_size:28;			/* size -- 28 bits */
+	caddr_t dtak_data;			/* data pointer */
+	struct dtrace_aggkey *dtak_next;	/* next in hash chain */
+} dtrace_aggkey_t;
+
+typedef struct dtrace_aggbuffer {
+	uintptr_t dtagb_hashsize;		/* number of buckets */
+	uintptr_t dtagb_free;			/* free list of keys */
+	dtrace_aggkey_t **dtagb_hash;		/* hash table */
+} dtrace_aggbuffer_t;
+
+/*
+ * DTrace Speculations
+ *
+ * Speculations have a per-CPU buffer and a global state.  Once a speculation
+ * buffer has been comitted or discarded, it cannot be reused until all CPUs
+ * have taken the same action (commit or discard) on their respective
+ * speculative buffer.  However, because DTrace probes may execute in arbitrary
+ * context, other CPUs cannot simply be cross-called at probe firing time to
+ * perform the necessary commit or discard.  The speculation states thus
+ * optimize for the case that a speculative buffer is only active on one CPU at
+ * the time of a commit() or discard() -- for if this is the case, other CPUs
+ * need not take action, and the speculation is immediately available for
+ * reuse.  If the speculation is active on multiple CPUs, it must be
+ * asynchronously cleaned -- potentially leading to a higher rate of dirty
+ * speculative drops.  The speculation states are as follows:
+ *
+ *  DTRACESPEC_INACTIVE       <= Initial state; inactive speculation
+ *  DTRACESPEC_ACTIVE         <= Allocated, but not yet speculatively traced to
+ *  DTRACESPEC_ACTIVEONE      <= Speculatively traced to on one CPU
+ *  DTRACESPEC_ACTIVEMANY     <= Speculatively traced to on more than one CPU
+ *  DTRACESPEC_COMMITTING     <= Currently being commited on one CPU
+ *  DTRACESPEC_COMMITTINGMANY <= Currently being commited on many CPUs
+ *  DTRACESPEC_DISCARDING     <= Currently being discarded on many CPUs
+ *
+ * The state transition diagram is as follows:
+ *
+ *     +----------------------------------------------------------+
+ *     |                                                          |
+ *     |                      +------------+                      |
+ *     |  +-------------------| COMMITTING |<-----------------+   |
+ *     |  |                   +------------+                  |   |
+ *     |  | copied spec.            ^             commit() on |   | discard() on
+ *     |  | into principal          |              active CPU |   | active CPU
+ *     |  |                         | commit()                |   |
+ *     V  V                         |                         |   |
+ * +----------+                 +--------+                +-----------+
+ * | INACTIVE |---------------->| ACTIVE |--------------->| ACTIVEONE |
+ * +----------+  speculation()  +--------+  speculate()   +-----------+
+ *     ^  ^                         |                         |   |
+ *     |  |                         | discard()               |   |
+ *     |  | asynchronously          |            discard() on |   | speculate()
+ *     |  | cleaned                 V            inactive CPU |   | on inactive
+ *     |  |                   +------------+                  |   | CPU
+ *     |  +-------------------| DISCARDING |<-----------------+   |
+ *     |                      +------------+                      |
+ *     | asynchronously             ^                             |
+ *     | copied spec.               |       discard()             |
+ *     | into principal             +------------------------+    |
+ *     |                                                     |    V
+ *  +----------------+             commit()              +------------+
+ *  | COMMITTINGMANY |<----------------------------------| ACTIVEMANY |
+ *  +----------------+                                   +------------+
+ */
+typedef enum dtrace_speculation_state {
+	DTRACESPEC_INACTIVE = 0,
+	DTRACESPEC_ACTIVE,
+	DTRACESPEC_ACTIVEONE,
+	DTRACESPEC_ACTIVEMANY,
+	DTRACESPEC_COMMITTING,
+	DTRACESPEC_COMMITTINGMANY,
+	DTRACESPEC_DISCARDING
+} dtrace_speculation_state_t;
+
+typedef struct dtrace_speculation {
+	dtrace_speculation_state_t dtsp_state;	/* current speculation state */
+	int dtsp_cleaning;			/* non-zero if being cleaned */
+	dtrace_buffer_t *dtsp_buffer;		/* speculative buffer */
+} dtrace_speculation_t;
+
+/*
+ * DTrace Dynamic Variables
+ *
+ * The dynamic variable problem is obviously decomposed into two subproblems:
+ * allocating new dynamic storage, and freeing old dynamic storage.  The
+ * presence of the second problem makes the first much more complicated -- or
+ * rather, the absence of the second renders the first trivial.  This is the
+ * case with aggregations, for which there is effectively no deallocation of
+ * dynamic storage.  (Or more accurately, all dynamic storage is deallocated
+ * when a snapshot is taken of the aggregation.)  As DTrace dynamic variables
+ * allow for both dynamic allocation and dynamic deallocation, the
+ * implementation of dynamic variables is quite a bit more complicated than
+ * that of their aggregation kin.
+ *
+ * We observe that allocating new dynamic storage is tricky only because the
+ * size can vary -- the allocation problem is much easier if allocation sizes
+ * are uniform.  We further observe that in D, the size of dynamic variables is
+ * actually _not_ dynamic -- dynamic variable sizes may be determined by static
+ * analysis of DIF text.  (This is true even of putatively dynamically-sized
+ * objects like strings and stacks, the sizes of which are dictated by the
+ * "stringsize" and "stackframes" variables, respectively.)  We exploit this by
+ * performing this analysis on all DIF before enabling any probes.  For each
+ * dynamic load or store, we calculate the dynamically-allocated size plus the
+ * size of the dtrace_dynvar structure plus the storage required to key the
+ * data.  For all DIF, we take the largest value and dub it the _chunksize_.
+ * We then divide dynamic memory into two parts:  a hash table that is wide
+ * enough to have every chunk in its own bucket, and a larger region of equal
+ * chunksize units.  Whenever we wish to dynamically allocate a variable, we
+ * always allocate a single chunk of memory.  Depending on the uniformity of
+ * allocation, this will waste some amount of memory -- but it eliminates the
+ * non-determinism inherent in traditional heap fragmentation.
+ *
+ * Dynamic objects are allocated by storing a non-zero value to them; they are
+ * deallocated by storing a zero value to them.  Dynamic variables are
+ * complicated enormously by being shared between CPUs.  In particular,
+ * consider the following scenario:
+ *
+ *                 CPU A                                 CPU B
+ *  +---------------------------------+   +---------------------------------+
+ *  |                                 |   |                                 |
+ *  | allocates dynamic object a[123] |   |                                 |
+ *  | by storing the value 345 to it  |   |                                 |
+ *  |                               --------->                              |
+ *  |                                 |   | wishing to load from object     |
+ *  |                                 |   | a[123], performs lookup in      |
+ *  |                                 |   | dynamic variable space          |
+ *  |                               <---------                              |
+ *  | deallocates object a[123] by    |   |                                 |
+ *  | storing 0 to it                 |   |                                 |
+ *  |                                 |   |                                 |
+ *  | allocates dynamic object b[567] |   | performs load from a[123]       |
+ *  | by storing the value 789 to it  |   |                                 |
+ *  :                                 :   :                                 :
+ *  .                                 .   .                                 .
+ *
+ * This is obviously a race in the D program, but there are nonetheless only
+ * two valid values for CPU B's load from a[123]:  345 or 0.  Most importantly,
+ * CPU B may _not_ see the value 789 for a[123].
+ *
+ * There are essentially two ways to deal with this:
+ *
+ *  (1)  Explicitly spin-lock variables.  That is, if CPU B wishes to load
+ *       from a[123], it needs to lock a[123] and hold the lock for the
+ *       duration that it wishes to manipulate it.
+ *
+ *  (2)  Avoid reusing freed chunks until it is known that no CPU is referring
+ *       to them.
+ *
+ * The implementation of (1) is rife with complexity, because it requires the
+ * user of a dynamic variable to explicitly decree when they are done using it.
+ * Were all variables by value, this perhaps wouldn't be debilitating -- but
+ * dynamic variables of non-scalar types are tracked by reference.  That is, if
+ * a dynamic variable is, say, a string, and that variable is to be traced to,
+ * say, the principal buffer, the DIF emulation code returns to the main
+ * dtrace_probe() loop a pointer to the underlying storage, not the contents of
+ * the storage.  Further, code calling on DIF emulation would have to be aware
+ * that the DIF emulation has returned a reference to a dynamic variable that
+ * has been potentially locked.  The variable would have to be unlocked after
+ * the main dtrace_probe() loop is finished with the variable, and the main
+ * dtrace_probe() loop would have to be careful to not call any further DIF
+ * emulation while the variable is locked to avoid deadlock.  More generally,
+ * if one were to implement (1), DIF emulation code dealing with dynamic
+ * variables could only deal with one dynamic variable at a time (lest deadlock
+ * result).  To sum, (1) exports too much subtlety to the users of dynamic
+ * variables -- increasing maintenance burden and imposing serious constraints
+ * on future DTrace development.
+ *
+ * The implementation of (2) is also complex, but the complexity is more
+ * manageable.  We need to be sure that when a variable is deallocated, it is
+ * not placed on a traditional free list, but rather on a _dirty_ list.  Once a
+ * variable is on a dirty list, it cannot be found by CPUs performing a
+ * subsequent lookup of the variable -- but it may still be in use by other
+ * CPUs.  To assure that all CPUs that may be seeing the old variable have
+ * cleared out of probe context, a dtrace_sync() can be issued.  Once the
+ * dtrace_sync() has completed, it can be known that all CPUs are done
+ * manipulating the dynamic variable -- the dirty list can be atomically
+ * appended to the free list.  Unfortunately, there's a slight hiccup in this
+ * mechanism:  dtrace_sync() may not be issued from probe context.  The
+ * dtrace_sync() must be therefore issued asynchronously from non-probe
+ * context.  For this we rely on the DTrace cleaner, a cyclic that runs at the
+ * "cleanrate" frequency.  To ease this implementation, we define several chunk
+ * lists:
+ *
+ *   - Dirty.  Deallocated chunks, not yet cleaned.  Not available.
+ *
+ *   - Rinsing.  Formerly dirty chunks that are currently being asynchronously
+ *     cleaned.  Not available, but will be shortly.  Dynamic variable
+ *     allocation may not spin or block for availability, however.
+ *
+ *   - Clean.  Clean chunks, ready for allocation -- but not on the free list.
+ *
+ *   - Free.  Available for allocation.
+ *
+ * Moreover, to avoid absurd contention, _each_ of these lists is implemented
+ * on a per-CPU basis.  This is only for performance, not correctness; chunks
+ * may be allocated from another CPU's free list.  The algorithm for allocation
+ * then is this:
+ *
+ *   (1)  Attempt to atomically allocate from current CPU's free list.  If list
+ *        is non-empty and allocation is successful, allocation is complete.
+ *
+ *   (2)  If the clean list is non-empty, atomically move it to the free list,
+ *        and reattempt (1).
+ *
+ *   (3)  If the dynamic variable space is in the CLEAN state, look for free
+ *        and clean lists on other CPUs by setting the current CPU to the next
+ *        CPU, and reattempting (1).  If the next CPU is the current CPU (that
+ *        is, if all CPUs have been checked), atomically switch the state of
+ *        the dynamic variable space based on the following:
+ *
+ *        - If no free chunks were found and no dirty chunks were found,
+ *          atomically set the state to EMPTY.
+ *
+ *        - If dirty chunks were found, atomically set the state to DIRTY.
+ *
+ *        - If rinsing chunks were found, atomically set the state to RINSING.
+ *
+ *   (4)  Based on state of dynamic variable space state, increment appropriate
+ *        counter to indicate dynamic drops (if in EMPTY state) vs. dynamic
+ *        dirty drops (if in DIRTY state) vs. dynamic rinsing drops (if in
+ *        RINSING state).  Fail the allocation.
+ *
+ * The cleaning cyclic operates with the following algorithm:  for all CPUs
+ * with a non-empty dirty list, atomically move the dirty list to the rinsing
+ * list.  Perform a dtrace_sync().  For all CPUs with a non-empty rinsing list,
+ * atomically move the rinsing list to the clean list.  Perform another
+ * dtrace_sync().  By this point, all CPUs have seen the new clean list; the
+ * state of the dynamic variable space can be restored to CLEAN.
+ *
+ * There exist two final races that merit explanation.  The first is a simple
+ * allocation race:
+ *
+ *                 CPU A                                 CPU B
+ *  +---------------------------------+   +---------------------------------+
+ *  |                                 |   |                                 |
+ *  | allocates dynamic object a[123] |   | allocates dynamic object a[123] |
+ *  | by storing the value 345 to it  |   | by storing the value 567 to it  |
+ *  |                                 |   |                                 |
+ *  :                                 :   :                                 :
+ *  .                                 .   .                                 .
+ *
+ * Again, this is a race in the D program.  It can be resolved by having a[123]
+ * hold the value 345 or a[123] hold the value 567 -- but it must be true that
+ * a[123] have only _one_ of these values.  (That is, the racing CPUs may not
+ * put the same element twice on the same hash chain.)  This is resolved
+ * simply:  before the allocation is undertaken, the start of the new chunk's
+ * hash chain is noted.  Later, after the allocation is complete, the hash
+ * chain is atomically switched to point to the new element.  If this fails
+ * (because of either concurrent allocations or an allocation concurrent with a
+ * deletion), the newly allocated chunk is deallocated to the dirty list, and
+ * the whole process of looking up (and potentially allocating) the dynamic
+ * variable is reattempted.
+ *
+ * The final race is a simple deallocation race:
+ *
+ *                 CPU A                                 CPU B
+ *  +---------------------------------+   +---------------------------------+
+ *  |                                 |   |                                 |
+ *  | deallocates dynamic object      |   | deallocates dynamic object      |
+ *  | a[123] by storing the value 0   |   | a[123] by storing the value 0   |
+ *  | to it                           |   | to it                           |
+ *  |                                 |   |                                 |
+ *  :                                 :   :                                 :
+ *  .                                 .   .                                 .
+ *
+ * Once again, this is a race in the D program, but it is one that we must
+ * handle without corrupting the underlying data structures.  Because
+ * deallocations require the deletion of a chunk from the middle of a hash
+ * chain, we cannot use a single-word atomic operation to remove it.  For this,
+ * we add a spin lock to the hash buckets that is _only_ used for deallocations
+ * (allocation races are handled as above).  Further, this spin lock is _only_
+ * held for the duration of the delete; before control is returned to the DIF
+ * emulation code, the hash bucket is unlocked.
+ */
+typedef struct dtrace_key {
+	uint64_t dttk_value;			/* data value or data pointer */
+	uint64_t dttk_size;			/* 0 if by-val, >0 if by-ref */
+} dtrace_key_t;
+
+typedef struct dtrace_tuple {
+	uint32_t dtt_nkeys;			/* number of keys in tuple */
+	uint32_t dtt_pad;			/* padding */
+	dtrace_key_t dtt_key[1];		/* array of tuple keys */
+} dtrace_tuple_t;
+
+typedef struct dtrace_dynvar {
+	uint64_t dtdv_hashval;			/* hash value -- 0 if free */
+	struct dtrace_dynvar *dtdv_next;	/* next on list or hash chain */
+	void *dtdv_data;			/* pointer to data */
+	dtrace_tuple_t dtdv_tuple;		/* tuple key */
+} dtrace_dynvar_t;
+
+typedef enum dtrace_dynvar_op {
+	DTRACE_DYNVAR_ALLOC,
+	DTRACE_DYNVAR_NOALLOC,
+	DTRACE_DYNVAR_DEALLOC
+} dtrace_dynvar_op_t;
+
+typedef struct dtrace_dynhash {
+	dtrace_dynvar_t *dtdh_chain;		/* hash chain for this bucket */
+	uintptr_t dtdh_lock;			/* deallocation lock */
+#ifdef _LP64
+	uintptr_t dtdh_pad[6];			/* pad to avoid false sharing */
+#else
+	uintptr_t dtdh_pad[14];			/* pad to avoid false sharing */
+#endif
+} dtrace_dynhash_t;
+
+typedef struct dtrace_dstate_percpu {
+	dtrace_dynvar_t *dtdsc_free;		/* free list for this CPU */
+	dtrace_dynvar_t *dtdsc_dirty;		/* dirty list for this CPU */
+	dtrace_dynvar_t *dtdsc_rinsing;		/* rinsing list for this CPU */
+	dtrace_dynvar_t *dtdsc_clean;		/* clean list for this CPU */
+	uint64_t dtdsc_drops;			/* number of capacity drops */
+	uint64_t dtdsc_dirty_drops;		/* number of dirty drops */
+	uint64_t dtdsc_rinsing_drops;		/* number of rinsing drops */
+#ifdef _LP64
+	uint64_t dtdsc_pad;			/* pad to avoid false sharing */
+#else
+	uint64_t dtdsc_pad[2];			/* pad to avoid false sharing */
+#endif
+} dtrace_dstate_percpu_t;
+
+typedef enum dtrace_dstate_state {
+	DTRACE_DSTATE_CLEAN = 0,
+	DTRACE_DSTATE_EMPTY,
+	DTRACE_DSTATE_DIRTY,
+	DTRACE_DSTATE_RINSING
+} dtrace_dstate_state_t;
+
+typedef struct dtrace_dstate {
+	void *dtds_base;			/* base of dynamic var. space */
+	size_t dtds_size;			/* size of dynamic var. space */
+	size_t dtds_hashsize;			/* number of buckets in hash */
+	size_t dtds_chunksize;			/* size of each chunk */
+	dtrace_dynhash_t *dtds_hash;		/* pointer to hash table */
+	dtrace_dstate_state_t dtds_state;	/* current dynamic var. state */
+	dtrace_dstate_percpu_t *dtds_percpu;	/* per-CPU dyn. var. state */
+} dtrace_dstate_t;
+
+/*
+ * DTrace Variable State
+ *
+ * The DTrace variable state tracks user-defined variables in its dtrace_vstate
+ * structure.  Each DTrace consumer has exactly one dtrace_vstate structure,
+ * but some dtrace_vstate structures may exist without a corresponding DTrace
+ * consumer (see "DTrace Helpers", below).  As described in <sys/dtrace.h>,
+ * user-defined variables can have one of three scopes:
+ *
+ *  DIFV_SCOPE_GLOBAL  =>  global scope
+ *  DIFV_SCOPE_THREAD  =>  thread-local scope (i.e. "self->" variables)
+ *  DIFV_SCOPE_LOCAL   =>  clause-local scope (i.e. "this->" variables)
+ *
+ * The variable state tracks variables by both their scope and their allocation
+ * type:
+ *
+ *  - The dtvs_globals and dtvs_locals members each point to an array of
+ *    dtrace_statvar structures.  These structures contain both the variable
+ *    metadata (dtrace_difv structures) and the underlying storage for all
+ *    statically allocated variables, including statically allocated
+ *    DIFV_SCOPE_GLOBAL variables and all DIFV_SCOPE_LOCAL variables.
+ *
+ *  - The dtvs_tlocals member points to an array of dtrace_difv structures for
+ *    DIFV_SCOPE_THREAD variables.  As such, this array tracks _only_ the
+ *    variable metadata for DIFV_SCOPE_THREAD variables; the underlying storage
+ *    is allocated out of the dynamic variable space.
+ *
+ *  - The dtvs_dynvars member is the dynamic variable state associated with the
+ *    variable state.  The dynamic variable state (described in "DTrace Dynamic
+ *    Variables", above) tracks all DIFV_SCOPE_THREAD variables and all
+ *    dynamically-allocated DIFV_SCOPE_GLOBAL variables.
+ */
+typedef struct dtrace_statvar {
+	uint64_t dtsv_data;			/* data or pointer to it */
+	size_t dtsv_size;			/* size of pointed-to data */
+	int dtsv_refcnt;			/* reference count */
+	dtrace_difv_t dtsv_var;			/* variable metadata */
+} dtrace_statvar_t;
+
+typedef struct dtrace_vstate {
+	dtrace_state_t *dtvs_state;		/* back pointer to state */
+	dtrace_statvar_t **dtvs_globals;	/* statically-allocated glbls */
+	int dtvs_nglobals;			/* number of globals */
+	dtrace_difv_t *dtvs_tlocals;		/* thread-local metadata */
+	int dtvs_ntlocals;			/* number of thread-locals */
+	dtrace_statvar_t **dtvs_locals;		/* clause-local data */
+	int dtvs_nlocals;			/* number of clause-locals */
+	dtrace_dstate_t dtvs_dynvars;		/* dynamic variable state */
+} dtrace_vstate_t;
+
+/*
+ * DTrace Machine State
+ *
+ * In the process of processing a fired probe, DTrace needs to track and/or
+ * cache some per-CPU state associated with that particular firing.  This is
+ * state that is always discarded after the probe firing has completed, and
+ * much of it is not specific to any DTrace consumer, remaining valid across
+ * all ECBs.  This state is tracked in the dtrace_mstate structure.
+ */
+#define	DTRACE_MSTATE_ARGS		0x00000001
+#define	DTRACE_MSTATE_PROBE		0x00000002
+#define	DTRACE_MSTATE_EPID		0x00000004
+#define	DTRACE_MSTATE_TIMESTAMP		0x00000008
+#define	DTRACE_MSTATE_STACKDEPTH	0x00000010
+#define	DTRACE_MSTATE_CALLER		0x00000020
+#define	DTRACE_MSTATE_IPL		0x00000040
+#define	DTRACE_MSTATE_FLTOFFS		0x00000080
+#define	DTRACE_MSTATE_WALLTIMESTAMP	0x00000100
+#define	DTRACE_MSTATE_USTACKDEPTH	0x00000200
+#define	DTRACE_MSTATE_UCALLER		0x00000400
+
+typedef struct dtrace_mstate {
+	uintptr_t dtms_scratch_base;		/* base of scratch space */
+	uintptr_t dtms_scratch_ptr;		/* current scratch pointer */
+	size_t dtms_scratch_size;		/* scratch size */
+	uint32_t dtms_present;			/* variables that are present */
+	uint64_t dtms_arg[5];			/* cached arguments */
+	dtrace_epid_t dtms_epid;		/* current EPID */
+	uint64_t dtms_timestamp;		/* cached timestamp */
+	hrtime_t dtms_walltimestamp;		/* cached wall timestamp */
+	int dtms_stackdepth;			/* cached stackdepth */
+	int dtms_ustackdepth;			/* cached ustackdepth */
+	struct dtrace_probe *dtms_probe;	/* current probe */
+	uintptr_t dtms_caller;			/* cached caller */
+	uint64_t dtms_ucaller;			/* cached user-level caller */
+	int dtms_ipl;				/* cached interrupt pri lev */
+	int dtms_fltoffs;			/* faulting DIFO offset */
+	uintptr_t dtms_strtok;			/* saved strtok() pointer */
+	uint32_t dtms_access;			/* memory access rights */
+	dtrace_difo_t *dtms_difo;		/* current dif object */
+} dtrace_mstate_t;
+
+#define	DTRACE_COND_OWNER	0x1
+#define	DTRACE_COND_USERMODE	0x2
+#define	DTRACE_COND_ZONEOWNER	0x4
+
+#define	DTRACE_PROBEKEY_MAXDEPTH	8	/* max glob recursion depth */
+
+/*
+ * Access flag used by dtrace_mstate.dtms_access.
+ */
+#define	DTRACE_ACCESS_KERNEL	0x1		/* the priv to read kmem */
+
+
+/*
+ * DTrace Activity
+ *
+ * Each DTrace consumer is in one of several states, which (for purposes of
+ * avoiding yet-another overloading of the noun "state") we call the current
+ * _activity_.  The activity transitions on dtrace_go() (from DTRACIOCGO), on
+ * dtrace_stop() (from DTRACIOCSTOP) and on the exit() action.  Activities may
+ * only transition in one direction; the activity transition diagram is a
+ * directed acyclic graph.  The activity transition diagram is as follows:
+ *
+ *
+ * +----------+                   +--------+                   +--------+
+ * | INACTIVE |------------------>| WARMUP |------------------>| ACTIVE |
+ * +----------+   dtrace_go(),    +--------+   dtrace_go(),    +--------+
+ *                before BEGIN        |        after BEGIN       |  |  |
+ *                                    |                          |  |  |
+ *                      exit() action |                          |  |  |
+ *                     from BEGIN ECB |                          |  |  |
+ *                                    |                          |  |  |
+ *                                    v                          |  |  |
+ *                               +----------+     exit() action  |  |  |
+ * +-----------------------------| DRAINING |<-------------------+  |  |
+ * |                             +----------+                       |  |
+ * |                                  |                             |  |
+ * |                   dtrace_stop(), |                             |  |
+ * |                     before END   |                             |  |
+ * |                                  |                             |  |
+ * |                                  v                             |  |
+ * | +---------+                 +----------+                       |  |
+ * | | STOPPED |<----------------| COOLDOWN |<----------------------+  |
+ * | +---------+  dtrace_stop(), +----------+     dtrace_stop(),       |
+ * |                after END                       before END         |
+ * |                                                                   |
+ * |                              +--------+                           |
+ * +----------------------------->| KILLED |<--------------------------+
+ *       deadman timeout or       +--------+     deadman timeout or
+ *        killed consumer                         killed consumer
+ *
+ * Note that once a DTrace consumer has stopped tracing, there is no way to
+ * restart it; if a DTrace consumer wishes to restart tracing, it must reopen
+ * the DTrace pseudodevice.
+ */
+typedef enum dtrace_activity {
+	DTRACE_ACTIVITY_INACTIVE = 0,		/* not yet running */
+	DTRACE_ACTIVITY_WARMUP,			/* while starting */
+	DTRACE_ACTIVITY_ACTIVE,			/* running */
+	DTRACE_ACTIVITY_DRAINING,		/* before stopping */
+	DTRACE_ACTIVITY_COOLDOWN,		/* while stopping */
+	DTRACE_ACTIVITY_STOPPED,		/* after stopping */
+	DTRACE_ACTIVITY_KILLED			/* killed */
+} dtrace_activity_t;
+
+/*
+ * DTrace Helper Implementation
+ *
+ * A description of the helper architecture may be found in <sys/dtrace.h>.
+ * Each process contains a pointer to its helpers in its p_dtrace_helpers
+ * member.  This is a pointer to a dtrace_helpers structure, which contains an
+ * array of pointers to dtrace_helper structures, helper variable state (shared
+ * among a process's helpers) and a generation count.  (The generation count is
+ * used to provide an identifier when a helper is added so that it may be
+ * subsequently removed.)  The dtrace_helper structure is self-explanatory,
+ * containing pointers to the objects needed to execute the helper.  Note that
+ * helpers are _duplicated_ across fork(2), and destroyed on exec(2).  No more
+ * than dtrace_helpers_max are allowed per-process.
+ */
+#define	DTRACE_HELPER_ACTION_USTACK	0
+#define	DTRACE_NHELPER_ACTIONS		1
+
+typedef struct dtrace_helper_action {
+	int dtha_generation;			/* helper action generation */
+	int dtha_nactions;			/* number of actions */
+	dtrace_difo_t *dtha_predicate;		/* helper action predicate */
+	dtrace_difo_t **dtha_actions;		/* array of actions */
+	struct dtrace_helper_action *dtha_next;	/* next helper action */
+} dtrace_helper_action_t;
+
+typedef struct dtrace_helper_provider {
+	int dthp_generation;			/* helper provider generation */
+	uint32_t dthp_ref;			/* reference count */
+	dof_helper_t dthp_prov;			/* DOF w/ provider and probes */
+} dtrace_helper_provider_t;
+
+typedef struct dtrace_helpers {
+	dtrace_helper_action_t **dthps_actions;	/* array of helper actions */
+	dtrace_vstate_t dthps_vstate;		/* helper action var. state */
+	dtrace_helper_provider_t **dthps_provs;	/* array of providers */
+	uint_t dthps_nprovs;			/* count of providers */
+	uint_t dthps_maxprovs;			/* provider array size */
+	int dthps_generation;			/* current generation */
+	pid_t dthps_pid;			/* pid of associated proc */
+	int dthps_deferred;			/* helper in deferred list */
+	struct dtrace_helpers *dthps_next;	/* next pointer */
+	struct dtrace_helpers *dthps_prev;	/* prev pointer */
+} dtrace_helpers_t;
+
+/*
+ * DTrace Helper Action Tracing
+ *
+ * Debugging helper actions can be arduous.  To ease the development and
+ * debugging of helpers, DTrace contains a tracing-framework-within-a-tracing-
+ * framework: helper tracing.  If dtrace_helptrace_enabled is non-zero (which
+ * it is by default on DEBUG kernels), all helper activity will be traced to a
+ * global, in-kernel ring buffer.  Each entry includes a pointer to the specific
+ * helper, the location within the helper, and a trace of all local variables.
+ * The ring buffer may be displayed in a human-readable format with the
+ * ::dtrace_helptrace mdb(1) dcmd.
+ */
+#define	DTRACE_HELPTRACE_NEXT	(-1)
+#define	DTRACE_HELPTRACE_DONE	(-2)
+#define	DTRACE_HELPTRACE_ERR	(-3)
+
+typedef struct dtrace_helptrace {
+	dtrace_helper_action_t	*dtht_helper;	/* helper action */
+	int dtht_where;				/* where in helper action */
+	int dtht_nlocals;			/* number of locals */
+	int dtht_fault;				/* type of fault (if any) */
+	int dtht_fltoffs;			/* DIF offset */
+	uint64_t dtht_illval;			/* faulting value */
+	uint64_t dtht_locals[1];		/* local variables */
+} dtrace_helptrace_t;
+
+/*
+ * DTrace Credentials
+ *
+ * In probe context, we have limited flexibility to examine the credentials
+ * of the DTrace consumer that created a particular enabling.  We use
+ * the Least Privilege interfaces to cache the consumer's cred pointer and
+ * some facts about that credential in a dtrace_cred_t structure. These
+ * can limit the consumer's breadth of visibility and what actions the
+ * consumer may take.
+ */
+#define	DTRACE_CRV_ALLPROC		0x01
+#define	DTRACE_CRV_KERNEL		0x02
+#define	DTRACE_CRV_ALLZONE		0x04
+
+#define	DTRACE_CRV_ALL		(DTRACE_CRV_ALLPROC | DTRACE_CRV_KERNEL | \
+	DTRACE_CRV_ALLZONE)
+
+#define	DTRACE_CRA_PROC				0x0001
+#define	DTRACE_CRA_PROC_CONTROL			0x0002
+#define	DTRACE_CRA_PROC_DESTRUCTIVE_ALLUSER	0x0004
+#define	DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE	0x0008
+#define	DTRACE_CRA_PROC_DESTRUCTIVE_CREDCHG	0x0010
+#define	DTRACE_CRA_KERNEL			0x0020
+#define	DTRACE_CRA_KERNEL_DESTRUCTIVE		0x0040
+
+#define	DTRACE_CRA_ALL		(DTRACE_CRA_PROC | \
+	DTRACE_CRA_PROC_CONTROL | \
+	DTRACE_CRA_PROC_DESTRUCTIVE_ALLUSER | \
+	DTRACE_CRA_PROC_DESTRUCTIVE_ALLZONE | \
+	DTRACE_CRA_PROC_DESTRUCTIVE_CREDCHG | \
+	DTRACE_CRA_KERNEL | \
+	DTRACE_CRA_KERNEL_DESTRUCTIVE)
+
+typedef struct dtrace_cred {
+	cred_t			*dcr_cred;
+	uint8_t			dcr_destructive;
+	uint8_t			dcr_visible;
+	uint16_t		dcr_action;
+} dtrace_cred_t;
+
+/*
+ * DTrace Consumer State
+ *
+ * Each DTrace consumer has an associated dtrace_state structure that contains
+ * its in-kernel DTrace state -- including options, credentials, statistics and
+ * pointers to ECBs, buffers, speculations and formats.  A dtrace_state
+ * structure is also allocated for anonymous enablings.  When anonymous state
+ * is grabbed, the grabbing consumers dts_anon pointer is set to the grabbed
+ * dtrace_state structure.
+ */
+struct dtrace_state {
+#ifndef VBOX
+	dev_t dts_dev;				/* device */
+#endif
+	int dts_necbs;				/* total number of ECBs */
+	dtrace_ecb_t **dts_ecbs;		/* array of ECBs */
+	dtrace_epid_t dts_epid;			/* next EPID to allocate */
+	size_t dts_needed;			/* greatest needed space */
+	struct dtrace_state *dts_anon;		/* anon. state, if grabbed */
+	dtrace_activity_t dts_activity;		/* current activity */
+	dtrace_vstate_t dts_vstate;		/* variable state */
+	dtrace_buffer_t *dts_buffer;		/* principal buffer */
+	dtrace_buffer_t *dts_aggbuffer;		/* aggregation buffer */
+	dtrace_speculation_t *dts_speculations;	/* speculation array */
+	int dts_nspeculations;			/* number of speculations */
+	int dts_naggregations;			/* number of aggregations */
+	dtrace_aggregation_t **dts_aggregations; /* aggregation array */
+	vmem_t *dts_aggid_arena;		/* arena for aggregation IDs */
+	uint64_t dts_errors;			/* total number of errors */
+	uint32_t dts_speculations_busy;		/* number of spec. busy */
+	uint32_t dts_speculations_unavail;	/* number of spec unavail */
+	uint32_t dts_stkstroverflows;		/* stack string tab overflows */
+	uint32_t dts_dblerrors;			/* errors in ERROR probes */
+	uint32_t dts_reserve;			/* space reserved for END */
+	hrtime_t dts_laststatus;		/* time of last status */
+	cyclic_id_t dts_cleaner;		/* cleaning cyclic */
+	cyclic_id_t dts_deadman;		/* deadman cyclic */
+	hrtime_t dts_alive;			/* time last alive */
+	char dts_speculates;			/* boolean: has speculations */
+	char dts_destructive;			/* boolean: has dest. actions */
+	int dts_nformats;			/* number of formats */
+	char **dts_formats;			/* format string array */
+	dtrace_optval_t dts_options[DTRACEOPT_MAX]; /* options */
+	dtrace_cred_t dts_cred;			/* credentials */
+	size_t dts_nretained;			/* number of retained enabs */
+};
+
+struct dtrace_provider {
+	dtrace_pattr_t dtpv_attr;		/* provider attributes */
+	dtrace_ppriv_t dtpv_priv;		/* provider privileges */
+	dtrace_pops_t dtpv_pops;		/* provider operations */
+	char *dtpv_name;			/* provider name */
+	void *dtpv_arg;				/* provider argument */
+	uint_t dtpv_defunct;			/* boolean: defunct provider */
+	struct dtrace_provider *dtpv_next;	/* next provider */
+};
+
+struct dtrace_meta {
+	dtrace_mops_t dtm_mops;			/* meta provider operations */
+	char *dtm_name;				/* meta provider name */
+	void *dtm_arg;				/* meta provider user arg */
+	uint64_t dtm_count;			/* no. of associated provs. */
+};
+
+/*
+ * DTrace Enablings
+ *
+ * A dtrace_enabling structure is used to track a collection of ECB
+ * descriptions -- before they have been turned into actual ECBs.  This is
+ * created as a result of DOF processing, and is generally used to generate
+ * ECBs immediately thereafter.  However, enablings are also generally
+ * retained should the probes they describe be created at a later time; as
+ * each new module or provider registers with the framework, the retained
+ * enablings are reevaluated, with any new match resulting in new ECBs.  To
+ * prevent probes from being matched more than once, the enabling tracks the
+ * last probe generation matched, and only matches probes from subsequent
+ * generations.
+ */
+typedef struct dtrace_enabling {
+	dtrace_ecbdesc_t **dten_desc;		/* all ECB descriptions */
+	int dten_ndesc;				/* number of ECB descriptions */
+	int dten_maxdesc;			/* size of ECB array */
+	dtrace_vstate_t *dten_vstate;		/* associated variable state */
+	dtrace_genid_t dten_probegen;		/* matched probe generation */
+	dtrace_ecbdesc_t *dten_current;		/* current ECB description */
+	int dten_error;				/* current error value */
+	int dten_primed;			/* boolean: set if primed */
+	struct dtrace_enabling *dten_prev;	/* previous enabling */
+	struct dtrace_enabling *dten_next;	/* next enabling */
+} dtrace_enabling_t;
+
+/*
+ * DTrace Anonymous Enablings
+ *
+ * Anonymous enablings are DTrace enablings that are not associated with a
+ * controlling process, but rather derive their enabling from DOF stored as
+ * properties in the dtrace.conf file.  If there is an anonymous enabling, a
+ * DTrace consumer state and enabling are created on attach.  The state may be
+ * subsequently grabbed by the first consumer specifying the "grabanon"
+ * option.  As long as an anonymous DTrace enabling exists, dtrace(7D) will
+ * refuse to unload.
+ */
+typedef struct dtrace_anon {
+	dtrace_state_t *dta_state;		/* DTrace consumer state */
+	dtrace_enabling_t *dta_enabling;	/* pointer to enabling */
+	processorid_t dta_beganon;		/* which CPU BEGIN ran on */
+} dtrace_anon_t;
+
+/*
+ * DTrace Error Debugging
+ */
+#ifdef DEBUG
+#define	DTRACE_ERRDEBUG
+#endif
+
+#ifdef DTRACE_ERRDEBUG
+
+typedef struct dtrace_errhash {
+	const char	*dter_msg;	/* error message */
+	int		dter_count;	/* number of times seen */
+} dtrace_errhash_t;
+
+#define	DTRACE_ERRHASHSZ	256	/* must be > number of err msgs */
+
+#endif	/* DTRACE_ERRDEBUG */
+
+/*
+ * DTrace Toxic Ranges
+ *
+ * DTrace supports safe loads from probe context; if the address turns out to
+ * be invalid, a bit will be set by the kernel indicating that DTrace
+ * encountered a memory error, and DTrace will propagate the error to the user
+ * accordingly.  However, there may exist some regions of memory in which an
+ * arbitrary load can change system state, and from which it is impossible to
+ * recover from such a load after it has been attempted.  Examples of this may
+ * include memory in which programmable I/O registers are mapped (for which a
+ * read may have some implications for the device) or (in the specific case of
+ * UltraSPARC-I and -II) the virtual address hole.  The platform is required
+ * to make DTrace aware of these toxic ranges; DTrace will then check that
+ * target addresses are not in a toxic range before attempting to issue a
+ * safe load.
+ */
+typedef struct dtrace_toxrange {
+	uintptr_t	dtt_base;		/* base of toxic range */
+	uintptr_t	dtt_limit;		/* limit of toxic range */
+} dtrace_toxrange_t;
+
+extern uint64_t dtrace_getarg(int, int);
+extern greg_t dtrace_getfp(void);
+extern int dtrace_getipl(void);
+extern uintptr_t dtrace_caller(int);
+extern uint32_t dtrace_cas32(uint32_t *, uint32_t, uint32_t);
+extern void *dtrace_casptr(void *, void *, void *);
+extern void dtrace_copyin(uintptr_t, uintptr_t, size_t, volatile uint16_t *);
+extern void dtrace_copyinstr(uintptr_t, uintptr_t, size_t, volatile uint16_t *);
+extern void dtrace_copyout(uintptr_t, uintptr_t, size_t, volatile uint16_t *);
+extern void dtrace_copyoutstr(uintptr_t, uintptr_t, size_t,
+    volatile uint16_t *);
+extern void dtrace_getpcstack(pc_t *, int, int, uint32_t *);
+extern ulong_t dtrace_getreg(struct regs *, uint_t);
+extern int dtrace_getstackdepth(int);
+extern void dtrace_getupcstack(uint64_t *, int);
+extern void dtrace_getufpstack(uint64_t *, uint64_t *, int);
+extern int dtrace_getustackdepth(void);
+extern uintptr_t dtrace_fulword(void *);
+extern uint8_t dtrace_fuword8(void *);
+extern uint16_t dtrace_fuword16(void *);
+extern uint32_t dtrace_fuword32(void *);
+extern uint64_t dtrace_fuword64(void *);
+extern void dtrace_probe_error(dtrace_state_t *, dtrace_epid_t, int, int,
+    int, uintptr_t);
+extern int dtrace_assfail(const char *, const char *, int);
+extern int dtrace_attached(void);
+extern hrtime_t dtrace_gethrestime(void);
+
+#ifdef __sparc
+extern void dtrace_flush_windows(void);
+extern void dtrace_flush_user_windows(void);
+extern uint_t dtrace_getotherwin(void);
+extern uint_t dtrace_getfprs(void);
+#else
+extern void dtrace_copy(uintptr_t, uintptr_t, size_t);
+extern void dtrace_copystr(uintptr_t, uintptr_t, size_t, volatile uint16_t *);
+#endif
+
+#ifndef VBOX  /* got our own assert thing */
+/*
+ * DTrace Assertions
+ *
+ * DTrace calls ASSERT from probe context.  To assure that a failed ASSERT
+ * does not induce a markedly more catastrophic failure (e.g., one from which
+ * a dump cannot be gleaned), DTrace must define its own ASSERT to be one that
+ * may safely be called from probe context.  This header file must thus be
+ * included by any DTrace component that calls ASSERT from probe context, and
+ * _only_ by those components.  (The only exception to this is kernel
+ * debugging infrastructure at user-level that doesn't depend on calling
+ * ASSERT.)
+ */
+#undef ASSERT
+#ifdef DEBUG
+#define	ASSERT(EX)	((void)((EX) || \
+			dtrace_assfail(#EX, __FILE__, __LINE__)))
+#else
+#define	ASSERT(X)	((void)0)
+#endif
+#endif /* !VBOX */
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif /* _SYS_DTRACE_IMPL_H */
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/i86pc/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/i86pc/Makefile.kup
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/i86pc/os/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/i86pc/os/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/i86pc/os/dtrace_subr.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/i86pc/os/dtrace_subr.c
new file mode 100644
index 0000000..baf7919
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/i86pc/os/dtrace_subr.c
@@ -0,0 +1,400 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <sys/dtrace.h>
+#include <sys/fasttrap.h>
+#include <sys/x_call.h>
+#include <sys/cmn_err.h>
+#include <sys/trap.h>
+#include <sys/psw.h>
+#include <sys/privregs.h>
+#include <sys/machsystm.h>
+#include <vm/seg_kmem.h>
+
+typedef struct dtrace_invop_hdlr {
+	int (*dtih_func)(uintptr_t, uintptr_t *, uintptr_t);
+	struct dtrace_invop_hdlr *dtih_next;
+} dtrace_invop_hdlr_t;
+
+dtrace_invop_hdlr_t *dtrace_invop_hdlr;
+
+int
+dtrace_invop(uintptr_t addr, uintptr_t *stack, uintptr_t eax)
+{
+	dtrace_invop_hdlr_t *hdlr;
+	int rval;
+
+	for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next) {
+		if ((rval = hdlr->dtih_func(addr, stack, eax)) != 0)
+			return (rval);
+	}
+
+	return (0);
+}
+
+void
+dtrace_invop_add(int (*func)(uintptr_t, uintptr_t *, uintptr_t))
+{
+	dtrace_invop_hdlr_t *hdlr;
+
+	hdlr = kmem_alloc(sizeof (dtrace_invop_hdlr_t), KM_SLEEP);
+	hdlr->dtih_func = func;
+	hdlr->dtih_next = dtrace_invop_hdlr;
+	dtrace_invop_hdlr = hdlr;
+}
+
+void
+dtrace_invop_remove(int (*func)(uintptr_t, uintptr_t *, uintptr_t))
+{
+	dtrace_invop_hdlr_t *hdlr = dtrace_invop_hdlr, *prev = NULL;
+
+	for (;;) {
+		if (hdlr == NULL)
+			panic("attempt to remove non-existent invop handler");
+
+		if (hdlr->dtih_func == func)
+			break;
+
+		prev = hdlr;
+		hdlr = hdlr->dtih_next;
+	}
+
+	if (prev == NULL) {
+		ASSERT(dtrace_invop_hdlr == hdlr);
+		dtrace_invop_hdlr = hdlr->dtih_next;
+	} else {
+		ASSERT(dtrace_invop_hdlr != hdlr);
+		prev->dtih_next = hdlr->dtih_next;
+	}
+
+	kmem_free(hdlr, sizeof (dtrace_invop_hdlr_t));
+}
+
+int
+dtrace_getipl(void)
+{
+	return (CPU->cpu_pri);
+}
+
+/*ARGSUSED*/
+void
+dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit))
+{
+#ifdef __amd64
+	extern uintptr_t toxic_addr;
+	extern size_t toxic_size;
+
+	(*func)(0, _userlimit);
+
+	if (hole_end > hole_start)
+		(*func)(hole_start, hole_end);
+	(*func)(toxic_addr, toxic_addr + toxic_size);
+#else
+	extern void *device_arena_contains(void *, size_t, size_t *);
+	caddr_t	vaddr;
+	size_t	len;
+
+	for (vaddr = (caddr_t)kernelbase; vaddr < (caddr_t)KERNEL_TEXT;
+	    vaddr += len) {
+		len = (caddr_t)KERNEL_TEXT - vaddr;
+		vaddr = device_arena_contains(vaddr, len, &len);
+		if (vaddr == NULL)
+			break;
+		(*func)((uintptr_t)vaddr, (uintptr_t)vaddr + len);
+	}
+#endif
+	(*func)(0, _userlimit);
+}
+
+static int
+dtrace_xcall_func(dtrace_xcall_t func, void *arg)
+{
+	(*func)(arg);
+
+	return (0);
+}
+
+/*ARGSUSED*/
+void
+dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, void *arg)
+{
+	cpuset_t set;
+
+	CPUSET_ZERO(set);
+
+	if (cpu == DTRACE_CPUALL) {
+		CPUSET_ALL(set);
+	} else {
+		CPUSET_ADD(set, cpu);
+	}
+
+	kpreempt_disable();
+	xc_sync((xc_arg_t)func, (xc_arg_t)arg, 0, CPUSET2BV(set),
+	    (xc_func_t)dtrace_xcall_func);
+	kpreempt_enable();
+}
+
+void
+dtrace_sync_func(void)
+{}
+
+void
+dtrace_sync(void)
+{
+	dtrace_xcall(DTRACE_CPUALL, (dtrace_xcall_t)dtrace_sync_func, NULL);
+}
+
+int (*dtrace_pid_probe_ptr)(struct regs *);
+int (*dtrace_return_probe_ptr)(struct regs *);
+
+void
+dtrace_user_probe(struct regs *rp, caddr_t addr, processorid_t cpuid)
+{
+	krwlock_t *rwp;
+	proc_t *p = curproc;
+	extern void trap(struct regs *, caddr_t, processorid_t);
+
+	if (USERMODE(rp->r_cs) || (rp->r_ps & PS_VM)) {
+		if (curthread->t_cred != p->p_cred) {
+			cred_t *oldcred = curthread->t_cred;
+			/*
+			 * DTrace accesses t_cred in probe context.  t_cred
+			 * must always be either NULL, or point to a valid,
+			 * allocated cred structure.
+			 */
+			curthread->t_cred = crgetcred();
+			crfree(oldcred);
+		}
+	}
+
+	if (rp->r_trapno == T_DTRACE_RET) {
+		uint8_t step = curthread->t_dtrace_step;
+		uint8_t ret = curthread->t_dtrace_ret;
+		uintptr_t npc = curthread->t_dtrace_npc;
+
+		if (curthread->t_dtrace_ast) {
+			aston(curthread);
+			curthread->t_sig_check = 1;
+		}
+
+		/*
+		 * Clear all user tracing flags.
+		 */
+		curthread->t_dtrace_ft = 0;
+
+		/*
+		 * If we weren't expecting to take a return probe trap, kill
+		 * the process as though it had just executed an unassigned
+		 * trap instruction.
+		 */
+		if (step == 0) {
+			tsignal(curthread, SIGILL);
+			return;
+		}
+
+		/*
+		 * If we hit this trap unrelated to a return probe, we're
+		 * just here to reset the AST flag since we deferred a signal
+		 * until after we logically single-stepped the instruction we
+		 * copied out.
+		 */
+		if (ret == 0) {
+			rp->r_pc = npc;
+			return;
+		}
+
+		/*
+		 * We need to wait until after we've called the
+		 * dtrace_return_probe_ptr function pointer to set %pc.
+		 */
+		rwp = &CPU->cpu_ft_lock;
+		rw_enter(rwp, RW_READER);
+		if (dtrace_return_probe_ptr != NULL)
+			(void) (*dtrace_return_probe_ptr)(rp);
+		rw_exit(rwp);
+		rp->r_pc = npc;
+
+	} else if (rp->r_trapno == T_BPTFLT) {
+		uint8_t instr, instr2;
+		caddr_t linearpc;
+		rwp = &CPU->cpu_ft_lock;
+
+		/*
+		 * The DTrace fasttrap provider uses the breakpoint trap
+		 * (int 3). We let DTrace take the first crack at handling
+		 * this trap; if it's not a probe that DTrace knowns about,
+		 * we call into the trap() routine to handle it like a
+		 * breakpoint placed by a conventional debugger.
+		 */
+		rw_enter(rwp, RW_READER);
+		if (dtrace_pid_probe_ptr != NULL &&
+		    (*dtrace_pid_probe_ptr)(rp) == 0) {
+			rw_exit(rwp);
+			return;
+		}
+		rw_exit(rwp);
+
+		if (dtrace_linear_pc(rp, p, &linearpc) != 0) {
+			trap(rp, addr, cpuid);
+			return;
+		}
+
+		/*
+		 * If the instruction that caused the breakpoint trap doesn't
+		 * look like an int 3 anymore, it may be that this tracepoint
+		 * was removed just after the user thread executed it. In
+		 * that case, return to user land to retry the instuction.
+		 * Note that we assume the length of the instruction to retry
+		 * is 1 byte because that's the length of FASTTRAP_INSTR.
+		 * We check for r_pc > 0 and > 2 so that we don't have to
+		 * deal with segment wraparound.
+		 */
+		if (rp->r_pc > 0 && fuword8(linearpc - 1, &instr) == 0 &&
+		    instr != FASTTRAP_INSTR &&
+		    (instr != 3 || (rp->r_pc >= 2 &&
+		    (fuword8(linearpc - 2, &instr2) != 0 || instr2 != 0xCD)))) {
+			rp->r_pc--;
+			return;
+		}
+
+		trap(rp, addr, cpuid);
+
+	} else {
+		trap(rp, addr, cpuid);
+	}
+}
+
+void
+dtrace_safe_synchronous_signal(void)
+{
+	kthread_t *t = curthread;
+	struct regs *rp = lwptoregs(ttolwp(t));
+	size_t isz = t->t_dtrace_npc - t->t_dtrace_pc;
+
+	ASSERT(t->t_dtrace_on);
+
+	/*
+	 * If we're not in the range of scratch addresses, we're not actually
+	 * tracing user instructions so turn off the flags. If the instruction
+	 * we copied out caused a synchonous trap, reset the pc back to its
+	 * original value and turn off the flags.
+	 */
+	if (rp->r_pc < t->t_dtrace_scrpc ||
+	    rp->r_pc > t->t_dtrace_astpc + isz) {
+		t->t_dtrace_ft = 0;
+	} else if (rp->r_pc == t->t_dtrace_scrpc ||
+	    rp->r_pc == t->t_dtrace_astpc) {
+		rp->r_pc = t->t_dtrace_pc;
+		t->t_dtrace_ft = 0;
+	}
+}
+
+int
+dtrace_safe_defer_signal(void)
+{
+	kthread_t *t = curthread;
+	struct regs *rp = lwptoregs(ttolwp(t));
+	size_t isz = t->t_dtrace_npc - t->t_dtrace_pc;
+
+	ASSERT(t->t_dtrace_on);
+
+	/*
+	 * If we're not in the range of scratch addresses, we're not actually
+	 * tracing user instructions so turn off the flags.
+	 */
+	if (rp->r_pc < t->t_dtrace_scrpc ||
+	    rp->r_pc > t->t_dtrace_astpc + isz) {
+		t->t_dtrace_ft = 0;
+		return (0);
+	}
+
+	/*
+	 * If we've executed the original instruction, but haven't performed
+	 * the jmp back to t->t_dtrace_npc or the clean up of any registers
+	 * used to emulate %rip-relative instructions in 64-bit mode, do that
+	 * here and take the signal right away. We detect this condition by
+	 * seeing if the program counter is the range [scrpc + isz, astpc).
+	 */
+	if (t->t_dtrace_astpc - rp->r_pc <
+	    t->t_dtrace_astpc - t->t_dtrace_scrpc - isz) {
+#ifdef __amd64
+		/*
+		 * If there is a scratch register and we're on the
+		 * instruction immediately after the modified instruction,
+		 * restore the value of that scratch register.
+		 */
+		if (t->t_dtrace_reg != 0 &&
+		    rp->r_pc == t->t_dtrace_scrpc + isz) {
+			switch (t->t_dtrace_reg) {
+			case REG_RAX:
+				rp->r_rax = t->t_dtrace_regv;
+				break;
+			case REG_RCX:
+				rp->r_rcx = t->t_dtrace_regv;
+				break;
+			case REG_R8:
+				rp->r_r8 = t->t_dtrace_regv;
+				break;
+			case REG_R9:
+				rp->r_r9 = t->t_dtrace_regv;
+				break;
+			}
+		}
+#endif
+		rp->r_pc = t->t_dtrace_npc;
+		t->t_dtrace_ft = 0;
+		return (0);
+	}
+
+	/*
+	 * Otherwise, make sure we'll return to the kernel after executing
+	 * the copied out instruction and defer the signal.
+	 */
+	if (!t->t_dtrace_step) {
+		ASSERT(rp->r_pc < t->t_dtrace_astpc);
+		rp->r_pc += t->t_dtrace_astpc - t->t_dtrace_scrpc;
+		t->t_dtrace_step = 1;
+	}
+
+	t->t_dtrace_ast = 1;
+
+	return (1);
+}
+
+/*
+ * Additional artificial frames for the machine type. For i86pc, we're already
+ * accounted for, so return 0. On the hypervisor, we have an additional frame
+ * (xen_callback_handler).
+ */
+int
+dtrace_mach_aframes(void)
+{
+#ifdef __xpv
+	return (1);
+#else
+	return (0);
+#endif
+}
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/Makefile b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/Makefile
new file mode 100644
index 0000000..5cd153e
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/Makefile
@@ -0,0 +1,76 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+UTSBASE	= ../..
+
+MODULE		= dtrace
+OBJECTS		= $(DTRACE_OBJS:%=$(OBJS_DIR)/%)
+LINTS		= $(DTRACE_OBJS:%.o=$(LINTS_DIR)/%.ln)
+ROOTMODULE	= $(ROOT_DRV_DIR)/$(MODULE)
+CONF_SRCDIR	= $(UTSBASE)/common/dtrace
+
+include $(UTSBASE)/intel/Makefile.intel
+
+#
+# For now, disable these lint checks; maintainers should endeavor
+# to investigate and remove these for maximum lint coverage.
+# Please do not carry these forward to new Makefiles.
+#
+LINTTAGS	+= -erroff=E_SUSPICIOUS_COMPARISON
+LINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
+LINTTAGS	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
+LINTTAGS	+= -erroff=E_STATIC_UNUSED
+LINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
+LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
+
+ALL_TARGET	= $(BINARY) $(SRC_CONFILE)
+LINT_TARGET	= $(MODULE).lint
+INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
+AS_INC_PATH	+= -I$(DSF_DIR)/$(OBJS_DIR)
+
+ASSYM_H		= $(DSF_DIR)/$(OBJS_DIR)/assym.h
+
+.KEEP_STATE:
+
+def:		$(DEF_DEPS)
+
+all:		$(ALL_DEPS)
+
+clean:		$(CLEAN_DEPS)
+
+clobber:	$(CLOBBER_DEPS)
+
+lint:		$(LINT_DEPS)
+
+modlintlib:	$(MODLINTLIB_DEPS)
+
+clean.lint:	$(CLEAN_LINT_DEPS)
+
+install:	$(INSTALL_DEPS)
+
+$(BINARY):	$(ASSYM_H)
+
+include $(UTSBASE)/intel/Makefile.targ
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/Makefile.kup
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/dtrace_asm.s b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/dtrace_asm.s
new file mode 100644
index 0000000..47b981d
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/dtrace_asm.s
@@ -0,0 +1,457 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/asm_linkage.h>
+#include <sys/regset.h>
+
+#if defined(lint)
+#include <sys/dtrace_impl.h>
+#else
+#include "assym.h"
+#endif
+
+#if defined(lint) || defined(__lint)
+
+greg_t
+dtrace_getfp(void)
+{ return (0); }
+
+#else	/* lint */
+
+#if defined(__amd64)
+
+	ENTRY_NP(dtrace_getfp)
+	movq	%rbp, %rax
+	ret
+	SET_SIZE(dtrace_getfp)
+
+#elif defined(__i386)
+
+	ENTRY_NP(dtrace_getfp)
+	movl	%ebp, %eax
+	ret
+	SET_SIZE(dtrace_getfp)
+
+#endif	/* __i386 */
+#endif	/* lint */
+
+
+#if defined(lint) || defined(__lint)
+
+uint32_t
+dtrace_cas32(uint32_t *target, uint32_t cmp, uint32_t new)
+{
+	uint32_t old;
+
+	if ((old = *target) == cmp)
+		*target = new;
+	return (old);
+}
+
+void *
+dtrace_casptr(void *target, void *cmp, void *new)
+{
+	void *old;
+
+	if ((old = *(void **)target) == cmp)
+		*(void **)target = new;
+	return (old);
+}
+
+#else	/* lint */
+
+#if defined(__amd64)
+
+	ENTRY(dtrace_cas32)
+	movl	%esi, %eax
+	lock
+	cmpxchgl %edx, (%rdi)
+	ret
+	SET_SIZE(dtrace_cas32)
+
+	ENTRY(dtrace_casptr)
+	movq	%rsi, %rax
+	lock
+	cmpxchgq %rdx, (%rdi)
+	ret
+	SET_SIZE(dtrace_casptr)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_cas32)
+	ALTENTRY(dtrace_casptr)
+	movl	4(%esp), %edx
+	movl	8(%esp), %eax
+	movl	12(%esp), %ecx
+	lock
+	cmpxchgl %ecx, (%edx)
+	ret
+	SET_SIZE(dtrace_casptr)
+	SET_SIZE(dtrace_cas32)
+
+#endif	/* __i386 */
+#endif	/* lint */
+
+#if defined(lint)
+
+/*ARGSUSED*/
+uintptr_t
+dtrace_caller(int aframes)
+{
+	return (0);
+}
+
+#else	/* lint */
+
+#if defined(__amd64)
+	ENTRY(dtrace_caller)
+	movq	$-1, %rax
+	ret
+	SET_SIZE(dtrace_caller)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_caller)
+	movl	$-1, %eax
+	ret
+	SET_SIZE(dtrace_caller)
+
+#endif	/* __i386 */
+#endif	/* lint */
+
+#if defined(lint)
+
+/*ARGSUSED*/
+void
+dtrace_copy(uintptr_t src, uintptr_t dest, size_t size)
+{}
+
+#else
+
+#if defined(__amd64)
+
+	ENTRY(dtrace_copy)
+	pushq	%rbp
+	movq	%rsp, %rbp
+
+	xchgq	%rdi, %rsi		/* make %rsi source, %rdi dest */
+	movq	%rdx, %rcx		/* load count */
+	repz				/* repeat for count ... */
+	smovb				/*   move from %ds:rsi to %ed:rdi */
+	leave
+	ret
+	SET_SIZE(dtrace_copy)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_copy)
+	pushl	%ebp
+	movl	%esp, %ebp
+	pushl	%esi
+	pushl	%edi
+
+	movl	8(%ebp), %esi		/ Load source address
+	movl	12(%ebp), %edi		/ Load destination address
+	movl	16(%ebp), %ecx		/ Load count
+	repz				/ Repeat for count...
+	smovb				/   move from %ds:si to %es:di
+
+	popl	%edi
+	popl	%esi
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+	SET_SIZE(dtrace_copy)
+
+#endif	/* __i386 */
+#endif
+
+#if defined(lint)
+
+/*ARGSUSED*/
+void
+dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_t size,
+    volatile uint16_t *flags)
+{}
+
+#else
+
+#if defined(__amd64)
+
+	ENTRY(dtrace_copystr)
+	pushq	%rbp
+	movq	%rsp, %rbp
+
+0:
+	movb	(%rdi), %al		/* load from source */
+	movb	%al, (%rsi)		/* store to destination */
+	addq	$1, %rdi		/* increment source pointer */
+	addq	$1, %rsi		/* increment destination pointer */
+	subq	$1, %rdx		/* decrement remaining count */
+	cmpb	$0, %al
+	je	2f
+	testq	$0xfff, %rdx		/* test if count is 4k-aligned */
+	jnz	1f			/* if not, continue with copying */
+	testq	$CPU_DTRACE_BADADDR, (%rcx) /* load and test dtrace flags */
+	jnz	2f
+1:
+	cmpq	$0, %rdx
+	jne	0b
+2:
+	leave
+	ret
+
+	SET_SIZE(dtrace_copystr)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_copystr)
+
+	pushl	%ebp			/ Setup stack frame
+	movl	%esp, %ebp
+	pushl	%ebx			/ Save registers
+
+	movl	8(%ebp), %ebx		/ Load source address
+	movl	12(%ebp), %edx		/ Load destination address
+	movl	16(%ebp), %ecx		/ Load count
+
+0:
+	movb	(%ebx), %al		/ Load from source
+	movb	%al, (%edx)		/ Store to destination
+	incl	%ebx			/ Increment source pointer
+	incl	%edx			/ Increment destination pointer
+	decl	%ecx			/ Decrement remaining count
+	cmpb	$0, %al
+	je	2f
+	testl	$0xfff, %ecx		/ Check if count is 4k-aligned
+	jnz	1f
+	movl	20(%ebp), %eax		/ load flags pointer
+	testl	$CPU_DTRACE_BADADDR, (%eax) / load and test dtrace flags
+	jnz	2f
+1:
+	cmpl	$0, %ecx
+	jne	0b
+
+2:
+	popl	%ebx
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+
+	SET_SIZE(dtrace_copystr)
+
+#endif	/* __i386 */
+#endif
+
+#if defined(lint)
+
+/*ARGSUSED*/
+uintptr_t
+dtrace_fulword(void *addr)
+{ return (0); }
+
+#else
+#if defined(__amd64)
+
+	ENTRY(dtrace_fulword)
+	movq	(%rdi), %rax
+	ret
+	SET_SIZE(dtrace_fulword)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_fulword)
+	movl	4(%esp), %ecx
+	xorl	%eax, %eax
+	movl	(%ecx), %eax
+	ret
+	SET_SIZE(dtrace_fulword)
+
+#endif	/* __i386 */
+#endif
+
+#if defined(lint)
+
+/*ARGSUSED*/
+uint8_t
+dtrace_fuword8_nocheck(void *addr)
+{ return (0); }
+
+#else
+#if defined(__amd64)
+
+	ENTRY(dtrace_fuword8_nocheck)
+	xorq	%rax, %rax
+	movb	(%rdi), %al
+	ret
+	SET_SIZE(dtrace_fuword8_nocheck)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_fuword8_nocheck)
+	movl	4(%esp), %ecx
+	xorl	%eax, %eax
+	movzbl	(%ecx), %eax
+	ret
+	SET_SIZE(dtrace_fuword8_nocheck)
+
+#endif	/* __i386 */
+#endif
+
+#if defined(lint)
+
+/*ARGSUSED*/
+uint16_t
+dtrace_fuword16_nocheck(void *addr)
+{ return (0); }
+
+#else
+#if defined(__amd64)
+
+	ENTRY(dtrace_fuword16_nocheck)
+	xorq	%rax, %rax
+	movw	(%rdi), %ax
+	ret
+	SET_SIZE(dtrace_fuword16_nocheck)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_fuword16_nocheck)
+	movl	4(%esp), %ecx
+	xorl	%eax, %eax
+	movzwl	(%ecx), %eax
+	ret
+	SET_SIZE(dtrace_fuword16_nocheck)
+
+#endif	/* __i386 */
+#endif
+
+#if defined(lint)
+
+/*ARGSUSED*/
+uint32_t
+dtrace_fuword32_nocheck(void *addr)
+{ return (0); }
+
+#else
+#if defined(__amd64)
+
+	ENTRY(dtrace_fuword32_nocheck)
+	xorq	%rax, %rax
+	movl	(%rdi), %eax
+	ret
+	SET_SIZE(dtrace_fuword32_nocheck)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_fuword32_nocheck)
+	movl	4(%esp), %ecx
+	xorl	%eax, %eax
+	movl	(%ecx), %eax
+	ret
+	SET_SIZE(dtrace_fuword32_nocheck)
+
+#endif	/* __i386 */
+#endif
+
+#if defined(lint)
+
+/*ARGSUSED*/
+uint64_t
+dtrace_fuword64_nocheck(void *addr)
+{ return (0); }
+
+#else
+#if defined(__amd64)
+
+	ENTRY(dtrace_fuword64_nocheck)
+	movq	(%rdi), %rax
+	ret
+	SET_SIZE(dtrace_fuword64_nocheck)
+
+#elif defined(__i386)
+
+	ENTRY(dtrace_fuword64_nocheck)
+	movl	4(%esp), %ecx
+	xorl	%eax, %eax
+	xorl	%edx, %edx
+	movl	(%ecx), %eax
+	movl	4(%ecx), %edx
+	ret
+	SET_SIZE(dtrace_fuword64_nocheck)
+
+#endif	/* __i386 */
+#endif
+
+#if defined(lint) || defined(__lint)
+
+/*ARGSUSED*/
+void
+dtrace_probe_error(dtrace_state_t *state, dtrace_epid_t epid, int which,
+    int fault, int fltoffs, uintptr_t illval)
+{}
+
+#else	/* lint */
+#if defined(__amd64)
+
+	ENTRY(dtrace_probe_error)
+	pushq	%rbp
+	movq	%rsp, %rbp
+	subq	$0x8, %rsp
+	movq	%r9, (%rsp)
+	movq	%r8, %r9
+	movq	%rcx, %r8
+	movq	%rdx, %rcx
+	movq	%rsi, %rdx
+	movq	%rdi, %rsi
+	movl	dtrace_probeid_error(%rip), %edi
+	call	dtrace_probe
+	addq	$0x8, %rsp
+	leave
+	ret
+	SET_SIZE(dtrace_probe_error)
+	
+#elif defined(__i386)
+
+	ENTRY(dtrace_probe_error)
+	pushl	%ebp
+	movl	%esp, %ebp
+	pushl	0x1c(%ebp)
+	pushl	0x18(%ebp)
+	pushl	0x14(%ebp)
+	pushl	0x10(%ebp)
+	pushl	0xc(%ebp)
+	pushl	0x8(%ebp)
+	pushl	dtrace_probeid_error
+	call	dtrace_probe
+	movl	%ebp, %esp
+	popl	%ebp
+	ret
+	SET_SIZE(dtrace_probe_error)
+
+#endif	/* __i386 */
+#endif
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/dtrace_isa.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/dtrace_isa.c
new file mode 100644
index 0000000..6b5a4e1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/dtrace_isa.c
@@ -0,0 +1,746 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/dtrace_impl.h>
+#include <sys/stack.h>
+#include <sys/frame.h>
+#include <sys/cmn_err.h>
+#include <sys/privregs.h>
+#include <sys/sysmacros.h>
+
+extern uintptr_t kernelbase;
+
+int	dtrace_ustackdepth_max = 2048;
+
+void
+dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
+    uint32_t *intrpc)
+{
+	struct frame *fp = (struct frame *)dtrace_getfp();
+	struct frame *nextfp, *minfp, *stacktop;
+	int depth = 0;
+	int on_intr, last = 0;
+	uintptr_t pc;
+	uintptr_t caller = CPU->cpu_dtrace_caller;
+
+	if ((on_intr = CPU_ON_INTR(CPU)) != 0)
+		stacktop = (struct frame *)(CPU->cpu_intr_stack + SA(MINFRAME));
+	else
+		stacktop = (struct frame *)curthread->t_stk;
+	minfp = fp;
+
+	aframes++;
+
+	if (intrpc != NULL && depth < pcstack_limit)
+		pcstack[depth++] = (pc_t)intrpc;
+
+	while (depth < pcstack_limit) {
+		nextfp = (struct frame *)fp->fr_savfp;
+		pc = fp->fr_savpc;
+
+		if (nextfp <= minfp || nextfp >= stacktop) {
+			if (on_intr) {
+				/*
+				 * Hop from interrupt stack to thread stack.
+				 */
+				stacktop = (struct frame *)curthread->t_stk;
+				minfp = (struct frame *)curthread->t_stkbase;
+				on_intr = 0;
+				continue;
+			}
+
+			/*
+			 * This is the last frame we can process; indicate
+			 * that we should return after processing this frame.
+			 */
+			last = 1;
+		}
+
+		if (aframes > 0) {
+			if (--aframes == 0 && caller != NULL) {
+				/*
+				 * We've just run out of artificial frames,
+				 * and we have a valid caller -- fill it in
+				 * now.
+				 */
+				ASSERT(depth < pcstack_limit);
+				pcstack[depth++] = (pc_t)caller;
+				caller = NULL;
+			}
+		} else {
+			if (depth < pcstack_limit)
+				pcstack[depth++] = (pc_t)pc;
+		}
+
+		if (last) {
+			while (depth < pcstack_limit)
+				pcstack[depth++] = NULL;
+			return;
+		}
+
+		fp = nextfp;
+		minfp = fp;
+	}
+}
+
+static int
+dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc,
+    uintptr_t sp)
+{
+	klwp_t *lwp = ttolwp(curthread);
+	proc_t *p = curproc;
+	uintptr_t oldcontext = lwp->lwp_oldcontext;
+	uintptr_t oldsp;
+	volatile uint16_t *flags =
+	    (volatile uint16_t *)&cpu_core[CPU->cpu_id].cpuc_dtrace_flags;
+	size_t s1, s2;
+	int ret = 0;
+
+	ASSERT(pcstack == NULL || pcstack_limit > 0);
+	ASSERT(dtrace_ustackdepth_max > 0);
+
+	if (p->p_model == DATAMODEL_NATIVE) {
+		s1 = sizeof (struct frame) + 2 * sizeof (long);
+		s2 = s1 + sizeof (siginfo_t);
+	} else {
+		s1 = sizeof (struct frame32) + 3 * sizeof (int);
+		s2 = s1 + sizeof (siginfo32_t);
+	}
+
+	while (pc != 0) {
+		/*
+		 * We limit the number of times we can go around this
+		 * loop to account for a circular stack.
+		 */
+		if (ret++ >= dtrace_ustackdepth_max) {
+			*flags |= CPU_DTRACE_BADSTACK;
+			cpu_core[CPU->cpu_id].cpuc_dtrace_illval = sp;
+			break;
+		}
+
+		if (pcstack != NULL) {
+			*pcstack++ = (uint64_t)pc;
+			pcstack_limit--;
+			if (pcstack_limit <= 0)
+				break;
+		}
+
+		if (sp == 0)
+			break;
+
+		oldsp = sp;
+
+		if (oldcontext == sp + s1 || oldcontext == sp + s2) {
+			if (p->p_model == DATAMODEL_NATIVE) {
+				ucontext_t *ucp = (ucontext_t *)oldcontext;
+				greg_t *gregs = ucp->uc_mcontext.gregs;
+
+				sp = dtrace_fulword(&gregs[REG_FP]);
+				pc = dtrace_fulword(&gregs[REG_PC]);
+
+				oldcontext = dtrace_fulword(&ucp->uc_link);
+			} else {
+				ucontext32_t *ucp = (ucontext32_t *)oldcontext;
+				greg32_t *gregs = ucp->uc_mcontext.gregs;
+
+				sp = dtrace_fuword32(&gregs[EBP]);
+				pc = dtrace_fuword32(&gregs[EIP]);
+
+				oldcontext = dtrace_fuword32(&ucp->uc_link);
+			}
+		} else {
+			if (p->p_model == DATAMODEL_NATIVE) {
+				struct frame *fr = (struct frame *)sp;
+
+				pc = dtrace_fulword(&fr->fr_savpc);
+				sp = dtrace_fulword(&fr->fr_savfp);
+			} else {
+				struct frame32 *fr = (struct frame32 *)sp;
+
+				pc = dtrace_fuword32(&fr->fr_savpc);
+				sp = dtrace_fuword32(&fr->fr_savfp);
+			}
+		}
+
+		if (sp == oldsp) {
+			*flags |= CPU_DTRACE_BADSTACK;
+			cpu_core[CPU->cpu_id].cpuc_dtrace_illval = sp;
+			break;
+		}
+
+		/*
+		 * This is totally bogus:  if we faulted, we're going to clear
+		 * the fault and break.  This is to deal with the apparently
+		 * broken Java stacks on x86.
+		 */
+		if (*flags & CPU_DTRACE_FAULT) {
+			*flags &= ~CPU_DTRACE_FAULT;
+			break;
+		}
+	}
+
+	return (ret);
+}
+
+void
+dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit)
+{
+	klwp_t *lwp = ttolwp(curthread);
+	proc_t *p = curproc;
+	struct regs *rp;
+	uintptr_t pc, sp;
+	int n;
+
+	ASSERT(DTRACE_CPUFLAG_ISSET(CPU_DTRACE_NOFAULT));
+
+	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT))
+		return;
+
+	if (pcstack_limit <= 0)
+		return;
+
+	/*
+	 * If there's no user context we still need to zero the stack.
+	 */
+	if (lwp == NULL || p == NULL || (rp = lwp->lwp_regs) == NULL)
+		goto zero;
+
+	*pcstack++ = (uint64_t)p->p_pid;
+	pcstack_limit--;
+
+	if (pcstack_limit <= 0)
+		return;
+
+	pc = rp->r_pc;
+	sp = rp->r_fp;
+
+	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) {
+		*pcstack++ = (uint64_t)pc;
+		pcstack_limit--;
+		if (pcstack_limit <= 0)
+			return;
+
+		if (p->p_model == DATAMODEL_NATIVE)
+			pc = dtrace_fulword((void *)rp->r_sp);
+		else
+			pc = dtrace_fuword32((void *)rp->r_sp);
+	}
+
+	n = dtrace_getustack_common(pcstack, pcstack_limit, pc, sp);
+	ASSERT(n >= 0);
+	ASSERT(n <= pcstack_limit);
+
+	pcstack += n;
+	pcstack_limit -= n;
+
+zero:
+	while (pcstack_limit-- > 0)
+		*pcstack++ = NULL;
+}
+
+int
+dtrace_getustackdepth(void)
+{
+	klwp_t *lwp = ttolwp(curthread);
+	proc_t *p = curproc;
+	struct regs *rp;
+	uintptr_t pc, sp;
+	int n = 0;
+
+	if (lwp == NULL || p == NULL || (rp = lwp->lwp_regs) == NULL)
+		return (0);
+
+	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT))
+		return (-1);
+
+	pc = rp->r_pc;
+	sp = rp->r_fp;
+
+	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) {
+		n++;
+
+		if (p->p_model == DATAMODEL_NATIVE)
+			pc = dtrace_fulword((void *)rp->r_sp);
+		else
+			pc = dtrace_fuword32((void *)rp->r_sp);
+	}
+
+	n += dtrace_getustack_common(NULL, 0, pc, sp);
+
+	return (n);
+}
+
+void
+dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, int pcstack_limit)
+{
+	klwp_t *lwp = ttolwp(curthread);
+	proc_t *p = curproc;
+	struct regs *rp;
+	uintptr_t pc, sp, oldcontext;
+	volatile uint16_t *flags =
+	    (volatile uint16_t *)&cpu_core[CPU->cpu_id].cpuc_dtrace_flags;
+	size_t s1, s2;
+
+	if (*flags & CPU_DTRACE_FAULT)
+		return;
+
+	if (pcstack_limit <= 0)
+		return;
+
+	/*
+	 * If there's no user context we still need to zero the stack.
+	 */
+	if (lwp == NULL || p == NULL || (rp = lwp->lwp_regs) == NULL)
+		goto zero;
+
+	*pcstack++ = (uint64_t)p->p_pid;
+	pcstack_limit--;
+
+	if (pcstack_limit <= 0)
+		return;
+
+	pc = rp->r_pc;
+	sp = rp->r_fp;
+	oldcontext = lwp->lwp_oldcontext;
+
+	if (p->p_model == DATAMODEL_NATIVE) {
+		s1 = sizeof (struct frame) + 2 * sizeof (long);
+		s2 = s1 + sizeof (siginfo_t);
+	} else {
+		s1 = sizeof (struct frame32) + 3 * sizeof (int);
+		s2 = s1 + sizeof (siginfo32_t);
+	}
+
+	if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) {
+		*pcstack++ = (uint64_t)pc;
+		*fpstack++ = 0;
+		pcstack_limit--;
+		if (pcstack_limit <= 0)
+			return;
+
+		if (p->p_model == DATAMODEL_NATIVE)
+			pc = dtrace_fulword((void *)rp->r_sp);
+		else
+			pc = dtrace_fuword32((void *)rp->r_sp);
+	}
+
+	while (pc != 0) {
+		*pcstack++ = (uint64_t)pc;
+		*fpstack++ = sp;
+		pcstack_limit--;
+		if (pcstack_limit <= 0)
+			break;
+
+		if (sp == 0)
+			break;
+
+		if (oldcontext == sp + s1 || oldcontext == sp + s2) {
+			if (p->p_model == DATAMODEL_NATIVE) {
+				ucontext_t *ucp = (ucontext_t *)oldcontext;
+				greg_t *gregs = ucp->uc_mcontext.gregs;
+
+				sp = dtrace_fulword(&gregs[REG_FP]);
+				pc = dtrace_fulword(&gregs[REG_PC]);
+
+				oldcontext = dtrace_fulword(&ucp->uc_link);
+			} else {
+				ucontext_t *ucp = (ucontext_t *)oldcontext;
+				greg_t *gregs = ucp->uc_mcontext.gregs;
+
+				sp = dtrace_fuword32(&gregs[EBP]);
+				pc = dtrace_fuword32(&gregs[EIP]);
+
+				oldcontext = dtrace_fuword32(&ucp->uc_link);
+			}
+		} else {
+			if (p->p_model == DATAMODEL_NATIVE) {
+				struct frame *fr = (struct frame *)sp;
+
+				pc = dtrace_fulword(&fr->fr_savpc);
+				sp = dtrace_fulword(&fr->fr_savfp);
+			} else {
+				struct frame32 *fr = (struct frame32 *)sp;
+
+				pc = dtrace_fuword32(&fr->fr_savpc);
+				sp = dtrace_fuword32(&fr->fr_savfp);
+			}
+		}
+
+		/*
+		 * This is totally bogus:  if we faulted, we're going to clear
+		 * the fault and break.  This is to deal with the apparently
+		 * broken Java stacks on x86.
+		 */
+		if (*flags & CPU_DTRACE_FAULT) {
+			*flags &= ~CPU_DTRACE_FAULT;
+			break;
+		}
+	}
+
+zero:
+	while (pcstack_limit-- > 0)
+		*pcstack++ = NULL;
+}
+
+/*ARGSUSED*/
+uint64_t
+dtrace_getarg(int arg, int aframes)
+{
+	uintptr_t val;
+	struct frame *fp = (struct frame *)dtrace_getfp();
+	uintptr_t *stack;
+	int i;
+#if defined(__amd64)
+	/*
+	 * A total of 6 arguments are passed via registers; any argument with
+	 * index of 5 or lower is therefore in a register.
+	 */
+	int inreg = 5;
+#endif
+
+	for (i = 1; i <= aframes; i++) {
+		fp = (struct frame *)(fp->fr_savfp);
+
+		if (fp->fr_savpc == (pc_t)dtrace_invop_callsite) {
+#if !defined(__amd64)
+			/*
+			 * If we pass through the invalid op handler, we will
+			 * use the pointer that it passed to the stack as the
+			 * second argument to dtrace_invop() as the pointer to
+			 * the stack.  When using this stack, we must step
+			 * beyond the EIP/RIP that was pushed when the trap was
+			 * taken -- hence the "+ 1" below.
+			 */
+			stack = ((uintptr_t **)&fp[1])[1] + 1;
+#else
+			/*
+			 * In the case of amd64, we will use the pointer to the
+			 * regs structure that was pushed when we took the
+			 * trap.  To get this structure, we must increment
+			 * beyond the frame structure, and then again beyond
+			 * the calling RIP stored in dtrace_invop().  If the
+			 * argument that we're seeking is passed on the stack,
+			 * we'll pull the true stack pointer out of the saved
+			 * registers and decrement our argument by the number
+			 * of arguments passed in registers; if the argument
+			 * we're seeking is passed in regsiters, we can just
+			 * load it directly.
+			 */
+			struct regs *rp = (struct regs *)((uintptr_t)&fp[1] +
+			    sizeof (uintptr_t));
+
+			if (arg <= inreg) {
+				stack = (uintptr_t *)&rp->r_rdi;
+			} else {
+				stack = (uintptr_t *)(rp->r_rsp);
+				arg -= inreg;
+			}
+#endif
+			goto load;
+		}
+
+	}
+
+	/*
+	 * We know that we did not come through a trap to get into
+	 * dtrace_probe() -- the provider simply called dtrace_probe()
+	 * directly.  As this is the case, we need to shift the argument
+	 * that we're looking for:  the probe ID is the first argument to
+	 * dtrace_probe(), so the argument n will actually be found where
+	 * one would expect to find argument (n + 1).
+	 */
+	arg++;
+
+#if defined(__amd64)
+	if (arg <= inreg) {
+		/*
+		 * This shouldn't happen.  If the argument is passed in a
+		 * register then it should have been, well, passed in a
+		 * register...
+		 */
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+		return (0);
+	}
+
+	arg -= (inreg + 1);
+#endif
+	stack = (uintptr_t *)&fp[1];
+
+load:
+	DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+	val = stack[arg];
+	DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+
+	return (val);
+}
+
+/*ARGSUSED*/
+int
+dtrace_getstackdepth(int aframes)
+{
+	struct frame *fp = (struct frame *)dtrace_getfp();
+	struct frame *nextfp, *minfp, *stacktop;
+	int depth = 0;
+	int on_intr;
+
+	if ((on_intr = CPU_ON_INTR(CPU)) != 0)
+		stacktop = (struct frame *)(CPU->cpu_intr_stack + SA(MINFRAME));
+	else
+		stacktop = (struct frame *)curthread->t_stk;
+	minfp = fp;
+
+	aframes++;
+
+	for (;;) {
+		depth++;
+
+		nextfp = (struct frame *)fp->fr_savfp;
+
+		if (nextfp <= minfp || nextfp >= stacktop) {
+			if (on_intr) {
+				/*
+				 * Hop from interrupt stack to thread stack.
+				 */
+				stacktop = (struct frame *)curthread->t_stk;
+				minfp = (struct frame *)curthread->t_stkbase;
+				on_intr = 0;
+				continue;
+			}
+			break;
+		}
+
+		fp = nextfp;
+		minfp = fp;
+	}
+
+	if (depth <= aframes)
+		return (0);
+
+	return (depth - aframes);
+}
+
+ulong_t
+dtrace_getreg(struct regs *rp, uint_t reg)
+{
+#if defined(__amd64)
+	int regmap[] = {
+		REG_GS,		/* GS */
+		REG_FS,		/* FS */
+		REG_ES,		/* ES */
+		REG_DS,		/* DS */
+		REG_RDI,	/* EDI */
+		REG_RSI,	/* ESI */
+		REG_RBP,	/* EBP */
+		REG_RSP,	/* ESP */
+		REG_RBX,	/* EBX */
+		REG_RDX,	/* EDX */
+		REG_RCX,	/* ECX */
+		REG_RAX,	/* EAX */
+		REG_TRAPNO,	/* TRAPNO */
+		REG_ERR,	/* ERR */
+		REG_RIP,	/* EIP */
+		REG_CS,		/* CS */
+		REG_RFL,	/* EFL */
+		REG_RSP,	/* UESP */
+		REG_SS		/* SS */
+	};
+
+	if (reg <= SS) {
+		if (reg >= sizeof (regmap) / sizeof (int)) {
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+			return (0);
+		}
+
+		reg = regmap[reg];
+	} else {
+		reg -= SS + 1;
+	}
+
+	switch (reg) {
+	case REG_RDI:
+		return (rp->r_rdi);
+	case REG_RSI:
+		return (rp->r_rsi);
+	case REG_RDX:
+		return (rp->r_rdx);
+	case REG_RCX:
+		return (rp->r_rcx);
+	case REG_R8:
+		return (rp->r_r8);
+	case REG_R9:
+		return (rp->r_r9);
+	case REG_RAX:
+		return (rp->r_rax);
+	case REG_RBX:
+		return (rp->r_rbx);
+	case REG_RBP:
+		return (rp->r_rbp);
+	case REG_R10:
+		return (rp->r_r10);
+	case REG_R11:
+		return (rp->r_r11);
+	case REG_R12:
+		return (rp->r_r12);
+	case REG_R13:
+		return (rp->r_r13);
+	case REG_R14:
+		return (rp->r_r14);
+	case REG_R15:
+		return (rp->r_r15);
+	case REG_DS:
+		return (rp->r_ds);
+	case REG_ES:
+		return (rp->r_es);
+	case REG_FS:
+		return (rp->r_fs);
+	case REG_GS:
+		return (rp->r_gs);
+	case REG_TRAPNO:
+		return (rp->r_trapno);
+	case REG_ERR:
+		return (rp->r_err);
+	case REG_RIP:
+		return (rp->r_rip);
+	case REG_CS:
+		return (rp->r_cs);
+	case REG_SS:
+		return (rp->r_ss);
+	case REG_RFL:
+		return (rp->r_rfl);
+	case REG_RSP:
+		return (rp->r_rsp);
+	default:
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+		return (0);
+	}
+
+#else
+	if (reg > SS) {
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+		return (0);
+	}
+
+	return ((&rp->r_gs)[reg]);
+#endif
+}
+
+static int
+dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size)
+{
+	ASSERT(kaddr >= kernelbase && kaddr + size >= kaddr);
+
+	if (uaddr + size >= kernelbase || uaddr + size < uaddr) {
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
+		cpu_core[CPU->cpu_id].cpuc_dtrace_illval = uaddr;
+		return (0);
+	}
+
+	return (1);
+}
+
+/*ARGSUSED*/
+void
+dtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size,
+    volatile uint16_t *flags)
+{
+	if (dtrace_copycheck(uaddr, kaddr, size))
+		dtrace_copy(uaddr, kaddr, size);
+}
+
+/*ARGSUSED*/
+void
+dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size,
+    volatile uint16_t *flags)
+{
+	if (dtrace_copycheck(uaddr, kaddr, size))
+		dtrace_copy(kaddr, uaddr, size);
+}
+
+void
+dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size,
+    volatile uint16_t *flags)
+{
+	if (dtrace_copycheck(uaddr, kaddr, size))
+		dtrace_copystr(uaddr, kaddr, size, flags);
+}
+
+void
+dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size,
+    volatile uint16_t *flags)
+{
+	if (dtrace_copycheck(uaddr, kaddr, size))
+		dtrace_copystr(kaddr, uaddr, size, flags);
+}
+
+uint8_t
+dtrace_fuword8(void *uaddr)
+{
+	extern uint8_t dtrace_fuword8_nocheck(void *);
+	if ((uintptr_t)uaddr >= _userlimit) {
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
+		cpu_core[CPU->cpu_id].cpuc_dtrace_illval = (uintptr_t)uaddr;
+		return (0);
+	}
+	return (dtrace_fuword8_nocheck(uaddr));
+}
+
+uint16_t
+dtrace_fuword16(void *uaddr)
+{
+	extern uint16_t dtrace_fuword16_nocheck(void *);
+	if ((uintptr_t)uaddr >= _userlimit) {
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
+		cpu_core[CPU->cpu_id].cpuc_dtrace_illval = (uintptr_t)uaddr;
+		return (0);
+	}
+	return (dtrace_fuword16_nocheck(uaddr));
+}
+
+uint32_t
+dtrace_fuword32(void *uaddr)
+{
+	extern uint32_t dtrace_fuword32_nocheck(void *);
+	if ((uintptr_t)uaddr >= _userlimit) {
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
+		cpu_core[CPU->cpu_id].cpuc_dtrace_illval = (uintptr_t)uaddr;
+		return (0);
+	}
+	return (dtrace_fuword32_nocheck(uaddr));
+}
+
+uint64_t
+dtrace_fuword64(void *uaddr)
+{
+	extern uint64_t dtrace_fuword64_nocheck(void *);
+	if ((uintptr_t)uaddr >= _userlimit) {
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
+		cpu_core[CPU->cpu_id].cpuc_dtrace_illval = (uintptr_t)uaddr;
+		return (0);
+	}
+	return (dtrace_fuword64_nocheck(uaddr));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fasttrap.conf b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fasttrap.conf
new file mode 100644
index 0000000..a25f883
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fasttrap.conf
@@ -0,0 +1,39 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+name="fasttrap" parent="pseudo" instance=0;
+
+# fasttrap-max-probes is the limit on the number of tracepoints created
+# by DTrace's pid provider. This value should be increased if DTrace is
+# unable to create the desired probes because the limit has been hit.
+#fasttrap-max-probes=250000;
+
+# fasttrap-hash-size determines the size of the hash table used to store
+# enabled DTrace pid provider tracepoints. If there are many enabled
+# tracepoints or many tracepoints hash to the same value, increasing this
+# variable can improve the performance of executing a traced instruction.
+#fasttrap-hash-size=16384;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fasttrap_isa.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fasttrap_isa.c
new file mode 100644
index 0000000..1b93869
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fasttrap_isa.c
@@ -0,0 +1,1745 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#include <sys/fasttrap_isa.h>
+#include <sys/fasttrap_impl.h>
+#include <sys/dtrace.h>
+#include <sys/dtrace_impl.h>
+#include <sys/cmn_err.h>
+#include <sys/regset.h>
+#include <sys/privregs.h>
+#include <sys/segments.h>
+#include <sys/x86_archext.h>
+#include <sys/sysmacros.h>
+#include <sys/trap.h>
+#include <sys/archsystm.h>
+
+/*
+ * Lossless User-Land Tracing on x86
+ * ---------------------------------
+ *
+ * The execution of most instructions is not dependent on the address; for
+ * these instructions it is sufficient to copy them into the user process's
+ * address space and execute them. To effectively single-step an instruction
+ * in user-land, we copy out the following sequence of instructions to scratch
+ * space in the user thread's ulwp_t structure.
+ *
+ * We then set the program counter (%eip or %rip) to point to this scratch
+ * space. Once execution resumes, the original instruction is executed and
+ * then control flow is redirected to what was originally the subsequent
+ * instruction. If the kernel attemps to deliver a signal while single-
+ * stepping, the signal is deferred and the program counter is moved into the
+ * second sequence of instructions. The second sequence ends in a trap into
+ * the kernel where the deferred signal is then properly handled and delivered.
+ *
+ * For instructions whose execute is position dependent, we perform simple
+ * emulation. These instructions are limited to control transfer
+ * instructions in 32-bit mode, but in 64-bit mode there's the added wrinkle
+ * of %rip-relative addressing that means that almost any instruction can be
+ * position dependent. For all the details on how we emulate generic
+ * instructions included %rip-relative instructions, see the code in
+ * fasttrap_pid_probe() below where we handle instructions of type
+ * FASTTRAP_T_COMMON (under the header: Generic Instruction Tracing).
+ */
+
+#define	FASTTRAP_MODRM_MOD(modrm)	(((modrm) >> 6) & 0x3)
+#define	FASTTRAP_MODRM_REG(modrm)	(((modrm) >> 3) & 0x7)
+#define	FASTTRAP_MODRM_RM(modrm)	((modrm) & 0x7)
+#define	FASTTRAP_MODRM(mod, reg, rm)	(((mod) << 6) | ((reg) << 3) | (rm))
+
+#define	FASTTRAP_SIB_SCALE(sib)		(((sib) >> 6) & 0x3)
+#define	FASTTRAP_SIB_INDEX(sib)		(((sib) >> 3) & 0x7)
+#define	FASTTRAP_SIB_BASE(sib)		((sib) & 0x7)
+
+#define	FASTTRAP_REX_W(rex)		(((rex) >> 3) & 1)
+#define	FASTTRAP_REX_R(rex)		(((rex) >> 2) & 1)
+#define	FASTTRAP_REX_X(rex)		(((rex) >> 1) & 1)
+#define	FASTTRAP_REX_B(rex)		((rex) & 1)
+#define	FASTTRAP_REX(w, r, x, b)	\
+	(0x40 | ((w) << 3) | ((r) << 2) | ((x) << 1) | (b))
+
+/*
+ * Single-byte op-codes.
+ */
+#define	FASTTRAP_PUSHL_EBP	0x55
+
+#define	FASTTRAP_JO		0x70
+#define	FASTTRAP_JNO		0x71
+#define	FASTTRAP_JB		0x72
+#define	FASTTRAP_JAE		0x73
+#define	FASTTRAP_JE		0x74
+#define	FASTTRAP_JNE		0x75
+#define	FASTTRAP_JBE		0x76
+#define	FASTTRAP_JA		0x77
+#define	FASTTRAP_JS		0x78
+#define	FASTTRAP_JNS		0x79
+#define	FASTTRAP_JP		0x7a
+#define	FASTTRAP_JNP		0x7b
+#define	FASTTRAP_JL		0x7c
+#define	FASTTRAP_JGE		0x7d
+#define	FASTTRAP_JLE		0x7e
+#define	FASTTRAP_JG		0x7f
+
+#define	FASTTRAP_NOP		0x90
+
+#define	FASTTRAP_MOV_EAX	0xb8
+#define	FASTTRAP_MOV_ECX	0xb9
+
+#define	FASTTRAP_RET16		0xc2
+#define	FASTTRAP_RET		0xc3
+
+#define	FASTTRAP_LOOPNZ		0xe0
+#define	FASTTRAP_LOOPZ		0xe1
+#define	FASTTRAP_LOOP		0xe2
+#define	FASTTRAP_JCXZ		0xe3
+
+#define	FASTTRAP_CALL		0xe8
+#define	FASTTRAP_JMP32		0xe9
+#define	FASTTRAP_JMP8		0xeb
+
+#define	FASTTRAP_INT3		0xcc
+#define	FASTTRAP_INT		0xcd
+
+#define	FASTTRAP_2_BYTE_OP	0x0f
+#define	FASTTRAP_GROUP5_OP	0xff
+
+/*
+ * Two-byte op-codes (second byte only).
+ */
+#define	FASTTRAP_0F_JO		0x80
+#define	FASTTRAP_0F_JNO		0x81
+#define	FASTTRAP_0F_JB		0x82
+#define	FASTTRAP_0F_JAE		0x83
+#define	FASTTRAP_0F_JE		0x84
+#define	FASTTRAP_0F_JNE		0x85
+#define	FASTTRAP_0F_JBE		0x86
+#define	FASTTRAP_0F_JA		0x87
+#define	FASTTRAP_0F_JS		0x88
+#define	FASTTRAP_0F_JNS		0x89
+#define	FASTTRAP_0F_JP		0x8a
+#define	FASTTRAP_0F_JNP		0x8b
+#define	FASTTRAP_0F_JL		0x8c
+#define	FASTTRAP_0F_JGE		0x8d
+#define	FASTTRAP_0F_JLE		0x8e
+#define	FASTTRAP_0F_JG		0x8f
+
+#define	FASTTRAP_EFLAGS_OF	0x800
+#define	FASTTRAP_EFLAGS_DF	0x400
+#define	FASTTRAP_EFLAGS_SF	0x080
+#define	FASTTRAP_EFLAGS_ZF	0x040
+#define	FASTTRAP_EFLAGS_AF	0x010
+#define	FASTTRAP_EFLAGS_PF	0x004
+#define	FASTTRAP_EFLAGS_CF	0x001
+
+/*
+ * Instruction prefixes.
+ */
+#define	FASTTRAP_PREFIX_OPERAND	0x66
+#define	FASTTRAP_PREFIX_ADDRESS	0x67
+#define	FASTTRAP_PREFIX_CS	0x2E
+#define	FASTTRAP_PREFIX_DS	0x3E
+#define	FASTTRAP_PREFIX_ES	0x26
+#define	FASTTRAP_PREFIX_FS	0x64
+#define	FASTTRAP_PREFIX_GS	0x65
+#define	FASTTRAP_PREFIX_SS	0x36
+#define	FASTTRAP_PREFIX_LOCK	0xF0
+#define	FASTTRAP_PREFIX_REP	0xF3
+#define	FASTTRAP_PREFIX_REPNE	0xF2
+
+#define	FASTTRAP_NOREG	0xff
+
+/*
+ * Map between instruction register encodings and the kernel constants which
+ * correspond to indicies into struct regs.
+ */
+#ifdef __amd64
+static const uint8_t regmap[16] = {
+	REG_RAX, REG_RCX, REG_RDX, REG_RBX, REG_RSP, REG_RBP, REG_RSI, REG_RDI,
+	REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15,
+};
+#else
+static const uint8_t regmap[8] = {
+	EAX, ECX, EDX, EBX, UESP, EBP, ESI, EDI
+};
+#endif
+
+static ulong_t fasttrap_getreg(struct regs *, uint_t);
+
+static uint64_t
+fasttrap_anarg(struct regs *rp, int function_entry, int argno)
+{
+	uint64_t value;
+	int shift = function_entry ? 1 : 0;
+
+#ifdef __amd64
+	if (curproc->p_model == DATAMODEL_LP64) {
+		uintptr_t *stack;
+
+		/*
+		 * In 64-bit mode, the first six arguments are stored in
+		 * registers.
+		 */
+		if (argno < 6)
+			return ((&rp->r_rdi)[argno]);
+
+		stack = (uintptr_t *)rp->r_sp;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+		value = dtrace_fulword(&stack[argno - 6 + shift]);
+		DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR);
+	} else {
+#endif
+		uint32_t *stack = (uint32_t *)rp->r_sp;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+		value = dtrace_fuword32(&stack[argno + shift]);
+		DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT | CPU_DTRACE_BADADDR);
+#ifdef __amd64
+	}
+#endif
+
+	return (value);
+}
+
+/*ARGSUSED*/
+int
+fasttrap_tracepoint_init(proc_t *p, fasttrap_tracepoint_t *tp, uintptr_t pc,
+    fasttrap_probe_type_t type)
+{
+	uint8_t instr[FASTTRAP_MAX_INSTR_SIZE + 10];
+	size_t len = FASTTRAP_MAX_INSTR_SIZE;
+	size_t first = MIN(len, PAGESIZE - (pc & PAGEOFFSET));
+	uint_t start = 0;
+	int rmindex, size;
+	uint8_t seg, rex = 0;
+
+	/*
+	 * Read the instruction at the given address out of the process's
+	 * address space. We don't have to worry about a debugger
+	 * changing this instruction before we overwrite it with our trap
+	 * instruction since P_PR_LOCK is set. Since instructions can span
+	 * pages, we potentially read the instruction in two parts. If the
+	 * second part fails, we just zero out that part of the instruction.
+	 */
+	if (uread(p, &instr[0], first, pc) != 0)
+		return (-1);
+	if (len > first &&
+	    uread(p, &instr[first], len - first, pc + first) != 0) {
+		bzero(&instr[first], len - first);
+		len = first;
+	}
+
+	/*
+	 * If the disassembly fails, then we have a malformed instruction.
+	 */
+	if ((size = dtrace_instr_size_isa(instr, p->p_model, &rmindex)) <= 0)
+		return (-1);
+
+	/*
+	 * Make sure the disassembler isn't completely broken.
+	 */
+	ASSERT(-1 <= rmindex && rmindex < size);
+
+	/*
+	 * If the computed size is greater than the number of bytes read,
+	 * then it was a malformed instruction possibly because it fell on a
+	 * page boundary and the subsequent page was missing or because of
+	 * some malicious user.
+	 */
+	if (size > len)
+		return (-1);
+
+	tp->ftt_size = (uint8_t)size;
+	tp->ftt_segment = FASTTRAP_SEG_NONE;
+
+	/*
+	 * Find the start of the instruction's opcode by processing any
+	 * legacy prefixes.
+	 */
+	for (;;) {
+		seg = 0;
+		switch (instr[start]) {
+		case FASTTRAP_PREFIX_SS:
+			seg++;
+			/*FALLTHRU*/
+		case FASTTRAP_PREFIX_GS:
+			seg++;
+			/*FALLTHRU*/
+		case FASTTRAP_PREFIX_FS:
+			seg++;
+			/*FALLTHRU*/
+		case FASTTRAP_PREFIX_ES:
+			seg++;
+			/*FALLTHRU*/
+		case FASTTRAP_PREFIX_DS:
+			seg++;
+			/*FALLTHRU*/
+		case FASTTRAP_PREFIX_CS:
+			seg++;
+			/*FALLTHRU*/
+		case FASTTRAP_PREFIX_OPERAND:
+		case FASTTRAP_PREFIX_ADDRESS:
+		case FASTTRAP_PREFIX_LOCK:
+		case FASTTRAP_PREFIX_REP:
+		case FASTTRAP_PREFIX_REPNE:
+			if (seg != 0) {
+				/*
+				 * It's illegal for an instruction to specify
+				 * two segment prefixes -- give up on this
+				 * illegal instruction.
+				 */
+				if (tp->ftt_segment != FASTTRAP_SEG_NONE)
+					return (-1);
+
+				tp->ftt_segment = seg;
+			}
+			start++;
+			continue;
+		}
+		break;
+	}
+
+#ifdef __amd64
+	/*
+	 * Identify the REX prefix on 64-bit processes.
+	 */
+	if (p->p_model == DATAMODEL_LP64 && (instr[start] & 0xf0) == 0x40)
+		rex = instr[start++];
+#endif
+
+	/*
+	 * Now that we're pretty sure that the instruction is okay, copy the
+	 * valid part to the tracepoint.
+	 */
+	bcopy(instr, tp->ftt_instr, FASTTRAP_MAX_INSTR_SIZE);
+
+	tp->ftt_type = FASTTRAP_T_COMMON;
+	if (instr[start] == FASTTRAP_2_BYTE_OP) {
+		switch (instr[start + 1]) {
+		case FASTTRAP_0F_JO:
+		case FASTTRAP_0F_JNO:
+		case FASTTRAP_0F_JB:
+		case FASTTRAP_0F_JAE:
+		case FASTTRAP_0F_JE:
+		case FASTTRAP_0F_JNE:
+		case FASTTRAP_0F_JBE:
+		case FASTTRAP_0F_JA:
+		case FASTTRAP_0F_JS:
+		case FASTTRAP_0F_JNS:
+		case FASTTRAP_0F_JP:
+		case FASTTRAP_0F_JNP:
+		case FASTTRAP_0F_JL:
+		case FASTTRAP_0F_JGE:
+		case FASTTRAP_0F_JLE:
+		case FASTTRAP_0F_JG:
+			tp->ftt_type = FASTTRAP_T_JCC;
+			tp->ftt_code = (instr[start + 1] & 0x0f) | FASTTRAP_JO;
+			tp->ftt_dest = pc + tp->ftt_size +
+			    /* LINTED - alignment */
+			    *(int32_t *)&instr[start + 2];
+			break;
+		}
+	} else if (instr[start] == FASTTRAP_GROUP5_OP) {
+		uint_t mod = FASTTRAP_MODRM_MOD(instr[start + 1]);
+		uint_t reg = FASTTRAP_MODRM_REG(instr[start + 1]);
+		uint_t rm = FASTTRAP_MODRM_RM(instr[start + 1]);
+
+		if (reg == 2 || reg == 4) {
+			uint_t i, sz;
+
+			if (reg == 2)
+				tp->ftt_type = FASTTRAP_T_CALL;
+			else
+				tp->ftt_type = FASTTRAP_T_JMP;
+
+			if (mod == 3)
+				tp->ftt_code = 2;
+			else
+				tp->ftt_code = 1;
+
+			ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0);
+
+			/*
+			 * See AMD x86-64 Architecture Programmer's Manual
+			 * Volume 3, Section 1.2.7, Table 1-12, and
+			 * Appendix A.3.1, Table A-15.
+			 */
+			if (mod != 3 && rm == 4) {
+				uint8_t sib = instr[start + 2];
+				uint_t index = FASTTRAP_SIB_INDEX(sib);
+				uint_t base = FASTTRAP_SIB_BASE(sib);
+
+				tp->ftt_scale = FASTTRAP_SIB_SCALE(sib);
+
+				tp->ftt_index = (index == 4) ?
+				    FASTTRAP_NOREG :
+				    regmap[index | (FASTTRAP_REX_X(rex) << 3)];
+				tp->ftt_base = (mod == 0 && base == 5) ?
+				    FASTTRAP_NOREG :
+				    regmap[base | (FASTTRAP_REX_B(rex) << 3)];
+
+				i = 3;
+				sz = mod == 1 ? 1 : 4;
+			} else {
+				/*
+				 * In 64-bit mode, mod == 0 and r/m == 5
+				 * denotes %rip-relative addressing; in 32-bit
+				 * mode, the base register isn't used. In both
+				 * modes, there is a 32-bit operand.
+				 */
+				if (mod == 0 && rm == 5) {
+#ifdef __amd64
+					if (p->p_model == DATAMODEL_LP64)
+						tp->ftt_base = REG_RIP;
+					else
+#endif
+						tp->ftt_base = FASTTRAP_NOREG;
+					sz = 4;
+				} else  {
+					uint8_t base = rm |
+					    (FASTTRAP_REX_B(rex) << 3);
+
+					tp->ftt_base = regmap[base];
+					sz = mod == 1 ? 1 : mod == 2 ? 4 : 0;
+				}
+				tp->ftt_index = FASTTRAP_NOREG;
+				i = 2;
+			}
+
+			if (sz == 1) {
+				tp->ftt_dest = *(int8_t *)&instr[start + i];
+			} else if (sz == 4) {
+				/* LINTED - alignment */
+				tp->ftt_dest = *(int32_t *)&instr[start + i];
+			} else {
+				tp->ftt_dest = 0;
+			}
+		}
+	} else {
+		switch (instr[start]) {
+		case FASTTRAP_RET:
+			tp->ftt_type = FASTTRAP_T_RET;
+			break;
+
+		case FASTTRAP_RET16:
+			tp->ftt_type = FASTTRAP_T_RET16;
+			/* LINTED - alignment */
+			tp->ftt_dest = *(uint16_t *)&instr[start + 1];
+			break;
+
+		case FASTTRAP_JO:
+		case FASTTRAP_JNO:
+		case FASTTRAP_JB:
+		case FASTTRAP_JAE:
+		case FASTTRAP_JE:
+		case FASTTRAP_JNE:
+		case FASTTRAP_JBE:
+		case FASTTRAP_JA:
+		case FASTTRAP_JS:
+		case FASTTRAP_JNS:
+		case FASTTRAP_JP:
+		case FASTTRAP_JNP:
+		case FASTTRAP_JL:
+		case FASTTRAP_JGE:
+		case FASTTRAP_JLE:
+		case FASTTRAP_JG:
+			tp->ftt_type = FASTTRAP_T_JCC;
+			tp->ftt_code = instr[start];
+			tp->ftt_dest = pc + tp->ftt_size +
+			    (int8_t)instr[start + 1];
+			break;
+
+		case FASTTRAP_LOOPNZ:
+		case FASTTRAP_LOOPZ:
+		case FASTTRAP_LOOP:
+			tp->ftt_type = FASTTRAP_T_LOOP;
+			tp->ftt_code = instr[start];
+			tp->ftt_dest = pc + tp->ftt_size +
+			    (int8_t)instr[start + 1];
+			break;
+
+		case FASTTRAP_JCXZ:
+			tp->ftt_type = FASTTRAP_T_JCXZ;
+			tp->ftt_dest = pc + tp->ftt_size +
+			    (int8_t)instr[start + 1];
+			break;
+
+		case FASTTRAP_CALL:
+			tp->ftt_type = FASTTRAP_T_CALL;
+			tp->ftt_dest = pc + tp->ftt_size +
+			    /* LINTED - alignment */
+			    *(int32_t *)&instr[start + 1];
+			tp->ftt_code = 0;
+			break;
+
+		case FASTTRAP_JMP32:
+			tp->ftt_type = FASTTRAP_T_JMP;
+			tp->ftt_dest = pc + tp->ftt_size +
+			    /* LINTED - alignment */
+			    *(int32_t *)&instr[start + 1];
+			break;
+		case FASTTRAP_JMP8:
+			tp->ftt_type = FASTTRAP_T_JMP;
+			tp->ftt_dest = pc + tp->ftt_size +
+			    (int8_t)instr[start + 1];
+			break;
+
+		case FASTTRAP_PUSHL_EBP:
+			if (start == 0)
+				tp->ftt_type = FASTTRAP_T_PUSHL_EBP;
+			break;
+
+		case FASTTRAP_NOP:
+#ifdef __amd64
+			ASSERT(p->p_model == DATAMODEL_LP64 || rex == 0);
+
+			/*
+			 * On amd64 we have to be careful not to confuse a nop
+			 * (actually xchgl %eax, %eax) with an instruction using
+			 * the same opcode, but that does something different
+			 * (e.g. xchgl %r8d, %eax or xcghq %r8, %rax).
+			 */
+			if (FASTTRAP_REX_B(rex) == 0)
+#endif
+				tp->ftt_type = FASTTRAP_T_NOP;
+			break;
+
+		case FASTTRAP_INT3:
+			/*
+			 * The pid provider shares the int3 trap with debugger
+			 * breakpoints so we can't instrument them.
+			 */
+			ASSERT(instr[start] == FASTTRAP_INSTR);
+			return (-1);
+
+		case FASTTRAP_INT:
+			/*
+			 * Interrupts seem like they could be traced with
+			 * no negative implications, but it's possible that
+			 * a thread could be redirected by the trap handling
+			 * code which would eventually return to the
+			 * instruction after the interrupt. If the interrupt
+			 * were in our scratch space, the subsequent
+			 * instruction might be overwritten before we return.
+			 * Accordingly we refuse to instrument any interrupt.
+			 */
+			return (-1);
+		}
+	}
+
+#ifdef __amd64
+	if (p->p_model == DATAMODEL_LP64 && tp->ftt_type == FASTTRAP_T_COMMON) {
+		/*
+		 * If the process is 64-bit and the instruction type is still
+		 * FASTTRAP_T_COMMON -- meaning we're going to copy it out an
+		 * execute it -- we need to watch for %rip-relative
+		 * addressing mode. See the portion of fasttrap_pid_probe()
+		 * below where we handle tracepoints with type
+		 * FASTTRAP_T_COMMON for how we emulate instructions that
+		 * employ %rip-relative addressing.
+		 */
+		if (rmindex != -1) {
+			uint_t mod = FASTTRAP_MODRM_MOD(instr[rmindex]);
+			uint_t reg = FASTTRAP_MODRM_REG(instr[rmindex]);
+			uint_t rm = FASTTRAP_MODRM_RM(instr[rmindex]);
+
+			ASSERT(rmindex > start);
+
+			if (mod == 0 && rm == 5) {
+				/*
+				 * We need to be sure to avoid other
+				 * registers used by this instruction. While
+				 * the reg field may determine the op code
+				 * rather than denoting a register, assuming
+				 * that it denotes a register is always safe.
+				 * We leave the REX field intact and use
+				 * whatever value's there for simplicity.
+				 */
+				if (reg != 0) {
+					tp->ftt_ripmode = FASTTRAP_RIP_1 |
+					    (FASTTRAP_RIP_X *
+					    FASTTRAP_REX_B(rex));
+					rm = 0;
+				} else {
+					tp->ftt_ripmode = FASTTRAP_RIP_2 |
+					    (FASTTRAP_RIP_X *
+					    FASTTRAP_REX_B(rex));
+					rm = 1;
+				}
+
+				tp->ftt_modrm = tp->ftt_instr[rmindex];
+				tp->ftt_instr[rmindex] =
+				    FASTTRAP_MODRM(2, reg, rm);
+			}
+		}
+	}
+#endif
+
+	return (0);
+}
+
+int
+fasttrap_tracepoint_install(proc_t *p, fasttrap_tracepoint_t *tp)
+{
+	fasttrap_instr_t instr = FASTTRAP_INSTR;
+
+	if (uwrite(p, &instr, 1, tp->ftt_pc) != 0)
+		return (-1);
+
+	return (0);
+}
+
+int
+fasttrap_tracepoint_remove(proc_t *p, fasttrap_tracepoint_t *tp)
+{
+	uint8_t instr;
+
+	/*
+	 * Distinguish between read or write failures and a changed
+	 * instruction.
+	 */
+	if (uread(p, &instr, 1, tp->ftt_pc) != 0)
+		return (0);
+	if (instr != FASTTRAP_INSTR)
+		return (0);
+	if (uwrite(p, &tp->ftt_instr[0], 1, tp->ftt_pc) != 0)
+		return (-1);
+
+	return (0);
+}
+
+#ifdef __amd64
+static uintptr_t
+fasttrap_fulword_noerr(const void *uaddr)
+{
+	uintptr_t ret;
+
+	if (fasttrap_fulword(uaddr, &ret) == 0)
+		return (ret);
+
+	return (0);
+}
+#endif
+
+static uint32_t
+fasttrap_fuword32_noerr(const void *uaddr)
+{
+	uint32_t ret;
+
+	if (fasttrap_fuword32(uaddr, &ret) == 0)
+		return (ret);
+
+	return (0);
+}
+
+static void
+fasttrap_return_common(struct regs *rp, uintptr_t pc, pid_t pid,
+    uintptr_t new_pc)
+{
+	fasttrap_tracepoint_t *tp;
+	fasttrap_bucket_t *bucket;
+	fasttrap_id_t *id;
+	kmutex_t *pid_mtx;
+
+	pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock;
+	mutex_enter(pid_mtx);
+	bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)];
+
+	for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) {
+		if (pid == tp->ftt_pid && pc == tp->ftt_pc &&
+		    tp->ftt_proc->ftpc_acount != 0)
+			break;
+	}
+
+	/*
+	 * Don't sweat it if we can't find the tracepoint again; unlike
+	 * when we're in fasttrap_pid_probe(), finding the tracepoint here
+	 * is not essential to the correct execution of the process.
+	 */
+	if (tp == NULL) {
+		mutex_exit(pid_mtx);
+		return;
+	}
+
+	for (id = tp->ftt_retids; id != NULL; id = id->fti_next) {
+		/*
+		 * If there's a branch that could act as a return site, we
+		 * need to trace it, and check here if the program counter is
+		 * external to the function.
+		 */
+		if (tp->ftt_type != FASTTRAP_T_RET &&
+		    tp->ftt_type != FASTTRAP_T_RET16 &&
+		    new_pc - id->fti_probe->ftp_faddr <
+		    id->fti_probe->ftp_fsize)
+			continue;
+
+		dtrace_probe(id->fti_probe->ftp_id,
+		    pc - id->fti_probe->ftp_faddr,
+		    rp->r_r0, rp->r_r1, 0, 0);
+	}
+
+	mutex_exit(pid_mtx);
+}
+
+static void
+fasttrap_sigsegv(proc_t *p, kthread_t *t, uintptr_t addr)
+{
+	sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP);
+
+	sqp->sq_info.si_signo = SIGSEGV;
+	sqp->sq_info.si_code = SEGV_MAPERR;
+	sqp->sq_info.si_addr = (caddr_t)addr;
+
+	mutex_enter(&p->p_lock);
+	sigaddqa(p, t, sqp);
+	mutex_exit(&p->p_lock);
+
+	if (t != NULL)
+		aston(t);
+}
+
+#ifdef __amd64
+static void
+fasttrap_usdt_args64(fasttrap_probe_t *probe, struct regs *rp, int argc,
+    uintptr_t *argv)
+{
+	int i, x, cap = MIN(argc, probe->ftp_nargs);
+	uintptr_t *stack = (uintptr_t *)rp->r_sp;
+
+	for (i = 0; i < cap; i++) {
+		x = probe->ftp_argmap[i];
+
+		if (x < 6)
+			argv[i] = (&rp->r_rdi)[x];
+		else
+			argv[i] = fasttrap_fulword_noerr(&stack[x]);
+	}
+
+	for (; i < argc; i++) {
+		argv[i] = 0;
+	}
+}
+#endif
+
+static void
+fasttrap_usdt_args32(fasttrap_probe_t *probe, struct regs *rp, int argc,
+    uint32_t *argv)
+{
+	int i, x, cap = MIN(argc, probe->ftp_nargs);
+	uint32_t *stack = (uint32_t *)rp->r_sp;
+
+	for (i = 0; i < cap; i++) {
+		x = probe->ftp_argmap[i];
+
+		argv[i] = fasttrap_fuword32_noerr(&stack[x]);
+	}
+
+	for (; i < argc; i++) {
+		argv[i] = 0;
+	}
+}
+
+static int
+fasttrap_do_seg(fasttrap_tracepoint_t *tp, struct regs *rp, uintptr_t *addr)
+{
+	proc_t *p = curproc;
+	user_desc_t *desc;
+	uint16_t sel, ndx, type;
+	uintptr_t limit;
+
+	switch (tp->ftt_segment) {
+	case FASTTRAP_SEG_CS:
+		sel = rp->r_cs;
+		break;
+	case FASTTRAP_SEG_DS:
+		sel = rp->r_ds;
+		break;
+	case FASTTRAP_SEG_ES:
+		sel = rp->r_es;
+		break;
+	case FASTTRAP_SEG_FS:
+		sel = rp->r_fs;
+		break;
+	case FASTTRAP_SEG_GS:
+		sel = rp->r_gs;
+		break;
+	case FASTTRAP_SEG_SS:
+		sel = rp->r_ss;
+		break;
+	}
+
+	/*
+	 * Make sure the given segment register specifies a user priority
+	 * selector rather than a kernel selector.
+	 */
+	if (!SELISUPL(sel))
+		return (-1);
+
+	ndx = SELTOIDX(sel);
+
+	/*
+	 * Check the bounds and grab the descriptor out of the specified
+	 * descriptor table.
+	 */
+	if (SELISLDT(sel)) {
+		if (ndx > p->p_ldtlimit)
+			return (-1);
+
+		desc = p->p_ldt + ndx;
+
+	} else {
+		if (ndx >= NGDT)
+			return (-1);
+
+		desc = cpu_get_gdt() + ndx;
+	}
+
+	/*
+	 * The descriptor must have user privilege level and it must be
+	 * present in memory.
+	 */
+	if (desc->usd_dpl != SEL_UPL || desc->usd_p != 1)
+		return (-1);
+
+	type = desc->usd_type;
+
+	/*
+	 * If the S bit in the type field is not set, this descriptor can
+	 * only be used in system context.
+	 */
+	if ((type & 0x10) != 0x10)
+		return (-1);
+
+	limit = USEGD_GETLIMIT(desc) * (desc->usd_gran ? PAGESIZE : 1);
+
+	if (tp->ftt_segment == FASTTRAP_SEG_CS) {
+		/*
+		 * The code/data bit and readable bit must both be set.
+		 */
+		if ((type & 0xa) != 0xa)
+			return (-1);
+
+		if (*addr > limit)
+			return (-1);
+	} else {
+		/*
+		 * The code/data bit must be clear.
+		 */
+		if ((type & 0x8) != 0)
+			return (-1);
+
+		/*
+		 * If the expand-down bit is clear, we just check the limit as
+		 * it would naturally be applied. Otherwise, we need to check
+		 * that the address is the range [limit + 1 .. 0xffff] or
+		 * [limit + 1 ... 0xffffffff] depending on if the default
+		 * operand size bit is set.
+		 */
+		if ((type & 0x4) == 0) {
+			if (*addr > limit)
+				return (-1);
+		} else if (desc->usd_def32) {
+			if (*addr < limit + 1 || 0xffff < *addr)
+				return (-1);
+		} else {
+			if (*addr < limit + 1 || 0xffffffff < *addr)
+				return (-1);
+		}
+	}
+
+	*addr += USEGD_GETBASE(desc);
+
+	return (0);
+}
+
+int
+fasttrap_pid_probe(struct regs *rp)
+{
+	proc_t *p = curproc;
+	uintptr_t pc = rp->r_pc - 1, new_pc = 0;
+	fasttrap_bucket_t *bucket;
+	kmutex_t *pid_mtx;
+	fasttrap_tracepoint_t *tp, tp_local;
+	pid_t pid;
+	dtrace_icookie_t cookie;
+	uint_t is_enabled = 0;
+
+	/*
+	 * It's possible that a user (in a veritable orgy of bad planning)
+	 * could redirect this thread's flow of control before it reached the
+	 * return probe fasttrap. In this case we need to kill the process
+	 * since it's in a unrecoverable state.
+	 */
+	if (curthread->t_dtrace_step) {
+		ASSERT(curthread->t_dtrace_on);
+		fasttrap_sigtrap(p, curthread, pc);
+		return (0);
+	}
+
+	/*
+	 * Clear all user tracing flags.
+	 */
+	curthread->t_dtrace_ft = 0;
+	curthread->t_dtrace_pc = 0;
+	curthread->t_dtrace_npc = 0;
+	curthread->t_dtrace_scrpc = 0;
+	curthread->t_dtrace_astpc = 0;
+#ifdef __amd64
+	curthread->t_dtrace_regv = 0;
+#endif
+
+	/*
+	 * Treat a child created by a call to vfork(2) as if it were its
+	 * parent. We know that there's only one thread of control in such a
+	 * process: this one.
+	 */
+	while (p->p_flag & SVFORK) {
+		p = p->p_parent;
+	}
+
+	pid = p->p_pid;
+	pid_mtx = &cpu_core[CPU->cpu_id].cpuc_pid_lock;
+	mutex_enter(pid_mtx);
+	bucket = &fasttrap_tpoints.fth_table[FASTTRAP_TPOINTS_INDEX(pid, pc)];
+
+	/*
+	 * Lookup the tracepoint that the process just hit.
+	 */
+	for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) {
+		if (pid == tp->ftt_pid && pc == tp->ftt_pc &&
+		    tp->ftt_proc->ftpc_acount != 0)
+			break;
+	}
+
+	/*
+	 * If we couldn't find a matching tracepoint, either a tracepoint has
+	 * been inserted without using the pid<pid> ioctl interface (see
+	 * fasttrap_ioctl), or somehow we have mislaid this tracepoint.
+	 */
+	if (tp == NULL) {
+		mutex_exit(pid_mtx);
+		return (-1);
+	}
+
+	/*
+	 * Set the program counter to the address of the traced instruction
+	 * so that it looks right in ustack() output.
+	 */
+	rp->r_pc = pc;
+
+	if (tp->ftt_ids != NULL) {
+		fasttrap_id_t *id;
+
+#ifdef __amd64
+		if (p->p_model == DATAMODEL_LP64) {
+			for (id = tp->ftt_ids; id != NULL; id = id->fti_next) {
+				fasttrap_probe_t *probe = id->fti_probe;
+
+				if (id->fti_ptype == DTFTP_ENTRY) {
+					/*
+					 * We note that this was an entry
+					 * probe to help ustack() find the
+					 * first caller.
+					 */
+					cookie = dtrace_interrupt_disable();
+					DTRACE_CPUFLAG_SET(CPU_DTRACE_ENTRY);
+					dtrace_probe(probe->ftp_id, rp->r_rdi,
+					    rp->r_rsi, rp->r_rdx, rp->r_rcx,
+					    rp->r_r8);
+					DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_ENTRY);
+					dtrace_interrupt_enable(cookie);
+				} else if (id->fti_ptype == DTFTP_IS_ENABLED) {
+					/*
+					 * Note that in this case, we don't
+					 * call dtrace_probe() since it's only
+					 * an artificial probe meant to change
+					 * the flow of control so that it
+					 * encounters the true probe.
+					 */
+					is_enabled = 1;
+				} else if (probe->ftp_argmap == NULL) {
+					dtrace_probe(probe->ftp_id, rp->r_rdi,
+					    rp->r_rsi, rp->r_rdx, rp->r_rcx,
+					    rp->r_r8);
+				} else {
+					uintptr_t t[5];
+
+					fasttrap_usdt_args64(probe, rp,
+					    sizeof (t) / sizeof (t[0]), t);
+
+					dtrace_probe(probe->ftp_id, t[0], t[1],
+					    t[2], t[3], t[4]);
+				}
+			}
+		} else {
+#endif
+			uintptr_t s0, s1, s2, s3, s4, s5;
+			uint32_t *stack = (uint32_t *)rp->r_sp;
+
+			/*
+			 * In 32-bit mode, all arguments are passed on the
+			 * stack. If this is a function entry probe, we need
+			 * to skip the first entry on the stack as it
+			 * represents the return address rather than a
+			 * parameter to the function.
+			 */
+			s0 = fasttrap_fuword32_noerr(&stack[0]);
+			s1 = fasttrap_fuword32_noerr(&stack[1]);
+			s2 = fasttrap_fuword32_noerr(&stack[2]);
+			s3 = fasttrap_fuword32_noerr(&stack[3]);
+			s4 = fasttrap_fuword32_noerr(&stack[4]);
+			s5 = fasttrap_fuword32_noerr(&stack[5]);
+
+			for (id = tp->ftt_ids; id != NULL; id = id->fti_next) {
+				fasttrap_probe_t *probe = id->fti_probe;
+
+				if (id->fti_ptype == DTFTP_ENTRY) {
+					/*
+					 * We note that this was an entry
+					 * probe to help ustack() find the
+					 * first caller.
+					 */
+					cookie = dtrace_interrupt_disable();
+					DTRACE_CPUFLAG_SET(CPU_DTRACE_ENTRY);
+					dtrace_probe(probe->ftp_id, s1, s2,
+					    s3, s4, s5);
+					DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_ENTRY);
+					dtrace_interrupt_enable(cookie);
+				} else if (id->fti_ptype == DTFTP_IS_ENABLED) {
+					/*
+					 * Note that in this case, we don't
+					 * call dtrace_probe() since it's only
+					 * an artificial probe meant to change
+					 * the flow of control so that it
+					 * encounters the true probe.
+					 */
+					is_enabled = 1;
+				} else if (probe->ftp_argmap == NULL) {
+					dtrace_probe(probe->ftp_id, s0, s1,
+					    s2, s3, s4);
+				} else {
+					uint32_t t[5];
+
+					fasttrap_usdt_args32(probe, rp,
+					    sizeof (t) / sizeof (t[0]), t);
+
+					dtrace_probe(probe->ftp_id, t[0], t[1],
+					    t[2], t[3], t[4]);
+				}
+			}
+#ifdef __amd64
+		}
+#endif
+	}
+
+	/*
+	 * We're about to do a bunch of work so we cache a local copy of
+	 * the tracepoint to emulate the instruction, and then find the
+	 * tracepoint again later if we need to light up any return probes.
+	 */
+	tp_local = *tp;
+	mutex_exit(pid_mtx);
+	tp = &tp_local;
+
+	/*
+	 * Set the program counter to appear as though the traced instruction
+	 * had completely executed. This ensures that fasttrap_getreg() will
+	 * report the expected value for REG_RIP.
+	 */
+	rp->r_pc = pc + tp->ftt_size;
+
+	/*
+	 * If there's an is-enabled probe connected to this tracepoint it
+	 * means that there was a 'xorl %eax, %eax' or 'xorq %rax, %rax'
+	 * instruction that was placed there by DTrace when the binary was
+	 * linked. As this probe is, in fact, enabled, we need to stuff 1
+	 * into %eax or %rax. Accordingly, we can bypass all the instruction
+	 * emulation logic since we know the inevitable result. It's possible
+	 * that a user could construct a scenario where the 'is-enabled'
+	 * probe was on some other instruction, but that would be a rather
+	 * exotic way to shoot oneself in the foot.
+	 */
+	if (is_enabled) {
+		rp->r_r0 = 1;
+		new_pc = rp->r_pc;
+		goto done;
+	}
+
+	/*
+	 * We emulate certain types of instructions to ensure correctness
+	 * (in the case of position dependent instructions) or optimize
+	 * common cases. The rest we have the thread execute back in user-
+	 * land.
+	 */
+	switch (tp->ftt_type) {
+	case FASTTRAP_T_RET:
+	case FASTTRAP_T_RET16:
+	{
+		uintptr_t dst;
+		uintptr_t addr;
+		int ret;
+
+		/*
+		 * We have to emulate _every_ facet of the behavior of a ret
+		 * instruction including what happens if the load from %esp
+		 * fails; in that case, we send a SIGSEGV.
+		 */
+#ifdef __amd64
+		if (p->p_model == DATAMODEL_NATIVE) {
+#endif
+			ret = fasttrap_fulword((void *)rp->r_sp, &dst);
+			addr = rp->r_sp + sizeof (uintptr_t);
+#ifdef __amd64
+		} else {
+			uint32_t dst32;
+			ret = fasttrap_fuword32((void *)rp->r_sp, &dst32);
+			dst = dst32;
+			addr = rp->r_sp + sizeof (uint32_t);
+		}
+#endif
+
+		if (ret == -1) {
+			fasttrap_sigsegv(p, curthread, rp->r_sp);
+			new_pc = pc;
+			break;
+		}
+
+		if (tp->ftt_type == FASTTRAP_T_RET16)
+			addr += tp->ftt_dest;
+
+		rp->r_sp = addr;
+		new_pc = dst;
+		break;
+	}
+
+	case FASTTRAP_T_JCC:
+	{
+		uint_t taken;
+
+		switch (tp->ftt_code) {
+		case FASTTRAP_JO:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_OF) != 0;
+			break;
+		case FASTTRAP_JNO:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_OF) == 0;
+			break;
+		case FASTTRAP_JB:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_CF) != 0;
+			break;
+		case FASTTRAP_JAE:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_CF) == 0;
+			break;
+		case FASTTRAP_JE:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_ZF) != 0;
+			break;
+		case FASTTRAP_JNE:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_ZF) == 0;
+			break;
+		case FASTTRAP_JBE:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_CF) != 0 ||
+			    (rp->r_ps & FASTTRAP_EFLAGS_ZF) != 0;
+			break;
+		case FASTTRAP_JA:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_CF) == 0 &&
+			    (rp->r_ps & FASTTRAP_EFLAGS_ZF) == 0;
+			break;
+		case FASTTRAP_JS:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_SF) != 0;
+			break;
+		case FASTTRAP_JNS:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_SF) == 0;
+			break;
+		case FASTTRAP_JP:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_PF) != 0;
+			break;
+		case FASTTRAP_JNP:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_PF) == 0;
+			break;
+		case FASTTRAP_JL:
+			taken = ((rp->r_ps & FASTTRAP_EFLAGS_SF) == 0) !=
+			    ((rp->r_ps & FASTTRAP_EFLAGS_OF) == 0);
+			break;
+		case FASTTRAP_JGE:
+			taken = ((rp->r_ps & FASTTRAP_EFLAGS_SF) == 0) ==
+			    ((rp->r_ps & FASTTRAP_EFLAGS_OF) == 0);
+			break;
+		case FASTTRAP_JLE:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_ZF) != 0 ||
+			    ((rp->r_ps & FASTTRAP_EFLAGS_SF) == 0) !=
+			    ((rp->r_ps & FASTTRAP_EFLAGS_OF) == 0);
+			break;
+		case FASTTRAP_JG:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_ZF) == 0 &&
+			    ((rp->r_ps & FASTTRAP_EFLAGS_SF) == 0) ==
+			    ((rp->r_ps & FASTTRAP_EFLAGS_OF) == 0);
+			break;
+
+		}
+
+		if (taken)
+			new_pc = tp->ftt_dest;
+		else
+			new_pc = pc + tp->ftt_size;
+		break;
+	}
+
+	case FASTTRAP_T_LOOP:
+	{
+		uint_t taken;
+#ifdef __amd64
+		greg_t cx = rp->r_rcx--;
+#else
+		greg_t cx = rp->r_ecx--;
+#endif
+
+		switch (tp->ftt_code) {
+		case FASTTRAP_LOOPNZ:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_ZF) == 0 &&
+			    cx != 0;
+			break;
+		case FASTTRAP_LOOPZ:
+			taken = (rp->r_ps & FASTTRAP_EFLAGS_ZF) != 0 &&
+			    cx != 0;
+			break;
+		case FASTTRAP_LOOP:
+			taken = (cx != 0);
+			break;
+		}
+
+		if (taken)
+			new_pc = tp->ftt_dest;
+		else
+			new_pc = pc + tp->ftt_size;
+		break;
+	}
+
+	case FASTTRAP_T_JCXZ:
+	{
+#ifdef __amd64
+		greg_t cx = rp->r_rcx;
+#else
+		greg_t cx = rp->r_ecx;
+#endif
+
+		if (cx == 0)
+			new_pc = tp->ftt_dest;
+		else
+			new_pc = pc + tp->ftt_size;
+		break;
+	}
+
+	case FASTTRAP_T_PUSHL_EBP:
+	{
+		int ret;
+		uintptr_t addr;
+#ifdef __amd64
+		if (p->p_model == DATAMODEL_NATIVE) {
+#endif
+			addr = rp->r_sp - sizeof (uintptr_t);
+			ret = fasttrap_sulword((void *)addr, rp->r_fp);
+#ifdef __amd64
+		} else {
+			addr = rp->r_sp - sizeof (uint32_t);
+			ret = fasttrap_suword32((void *)addr,
+			    (uint32_t)rp->r_fp);
+		}
+#endif
+
+		if (ret == -1) {
+			fasttrap_sigsegv(p, curthread, addr);
+			new_pc = pc;
+			break;
+		}
+
+		rp->r_sp = addr;
+		new_pc = pc + tp->ftt_size;
+		break;
+	}
+
+	case FASTTRAP_T_NOP:
+		new_pc = pc + tp->ftt_size;
+		break;
+
+	case FASTTRAP_T_JMP:
+	case FASTTRAP_T_CALL:
+		if (tp->ftt_code == 0) {
+			new_pc = tp->ftt_dest;
+		} else {
+			uintptr_t value, addr = tp->ftt_dest;
+
+			if (tp->ftt_base != FASTTRAP_NOREG)
+				addr += fasttrap_getreg(rp, tp->ftt_base);
+			if (tp->ftt_index != FASTTRAP_NOREG)
+				addr += fasttrap_getreg(rp, tp->ftt_index) <<
+				    tp->ftt_scale;
+
+			if (tp->ftt_code == 1) {
+				/*
+				 * If there's a segment prefix for this
+				 * instruction, we'll need to check permissions
+				 * and bounds on the given selector, and adjust
+				 * the address accordingly.
+				 */
+				if (tp->ftt_segment != FASTTRAP_SEG_NONE &&
+				    fasttrap_do_seg(tp, rp, &addr) != 0) {
+					fasttrap_sigsegv(p, curthread, addr);
+					new_pc = pc;
+					break;
+				}
+
+#ifdef __amd64
+				if (p->p_model == DATAMODEL_NATIVE) {
+#endif
+					if (fasttrap_fulword((void *)addr,
+					    &value) == -1) {
+						fasttrap_sigsegv(p, curthread,
+						    addr);
+						new_pc = pc;
+						break;
+					}
+					new_pc = value;
+#ifdef __amd64
+				} else {
+					uint32_t value32;
+					addr = (uintptr_t)(uint32_t)addr;
+					if (fasttrap_fuword32((void *)addr,
+					    &value32) == -1) {
+						fasttrap_sigsegv(p, curthread,
+						    addr);
+						new_pc = pc;
+						break;
+					}
+					new_pc = value32;
+				}
+#endif
+			} else {
+				new_pc = addr;
+			}
+		}
+
+		/*
+		 * If this is a call instruction, we need to push the return
+		 * address onto the stack. If this fails, we send the process
+		 * a SIGSEGV and reset the pc to emulate what would happen if
+		 * this instruction weren't traced.
+		 */
+		if (tp->ftt_type == FASTTRAP_T_CALL) {
+			int ret;
+			uintptr_t addr;
+#ifdef __amd64
+			if (p->p_model == DATAMODEL_NATIVE) {
+				addr = rp->r_sp - sizeof (uintptr_t);
+				ret = fasttrap_sulword((void *)addr,
+				    pc + tp->ftt_size);
+			} else {
+#endif
+				addr = rp->r_sp - sizeof (uint32_t);
+				ret = fasttrap_suword32((void *)addr,
+				    (uint32_t)(pc + tp->ftt_size));
+#ifdef __amd64
+			}
+#endif
+
+			if (ret == -1) {
+				fasttrap_sigsegv(p, curthread, addr);
+				new_pc = pc;
+				break;
+			}
+
+			rp->r_sp = addr;
+		}
+
+		break;
+
+	case FASTTRAP_T_COMMON:
+	{
+		uintptr_t addr;
+#if defined(__amd64)
+		uint8_t scratch[2 * FASTTRAP_MAX_INSTR_SIZE + 22];
+#else
+		uint8_t scratch[2 * FASTTRAP_MAX_INSTR_SIZE + 7];
+#endif
+		uint_t i = 0;
+		klwp_t *lwp = ttolwp(curthread);
+
+		/*
+		 * Compute the address of the ulwp_t and step over the
+		 * ul_self pointer. The method used to store the user-land
+		 * thread pointer is very different on 32- and 64-bit
+		 * kernels.
+		 */
+#if defined(__amd64)
+		if (p->p_model == DATAMODEL_LP64) {
+			addr = lwp->lwp_pcb.pcb_fsbase;
+			addr += sizeof (void *);
+		} else {
+			addr = lwp->lwp_pcb.pcb_gsbase;
+			addr += sizeof (caddr32_t);
+		}
+#else
+		addr = USEGD_GETBASE(&lwp->lwp_pcb.pcb_gsdesc);
+		addr += sizeof (void *);
+#endif
+
+		/*
+		 * Generic Instruction Tracing
+		 * ---------------------------
+		 *
+		 * This is the layout of the scratch space in the user-land
+		 * thread structure for our generated instructions.
+		 *
+		 *	32-bit mode			bytes
+		 *	------------------------	-----
+		 * a:	<original instruction>		<= 15
+		 *	jmp	<pc + tp->ftt_size>	    5
+		 * b:	<original instrction>		<= 15
+		 *	int	T_DTRACE_RET		    2
+		 *					-----
+		 *					<= 37
+		 *
+		 *	64-bit mode			bytes
+		 *	------------------------	-----
+		 * a:	<original instruction>		<= 15
+		 *	jmp	0(%rip)			    6
+		 *	<pc + tp->ftt_size>		    8
+		 * b:	<original instruction>		<= 15
+		 * 	int	T_DTRACE_RET		    2
+		 * 					-----
+		 * 					<= 46
+		 *
+		 * The %pc is set to a, and curthread->t_dtrace_astpc is set
+		 * to b. If we encounter a signal on the way out of the
+		 * kernel, trap() will set %pc to curthread->t_dtrace_astpc
+		 * so that we execute the original instruction and re-enter
+		 * the kernel rather than redirecting to the next instruction.
+		 *
+		 * If there are return probes (so we know that we're going to
+		 * need to reenter the kernel after executing the original
+		 * instruction), the scratch space will just contain the
+		 * original instruction followed by an interrupt -- the same
+		 * data as at b.
+		 *
+		 * %rip-relative Addressing
+		 * ------------------------
+		 *
+		 * There's a further complication in 64-bit mode due to %rip-
+		 * relative addressing. While this is clearly a beneficial
+		 * architectural decision for position independent code, it's
+		 * hard not to see it as a personal attack against the pid
+		 * provider since before there was a relatively small set of
+		 * instructions to emulate; with %rip-relative addressing,
+		 * almost every instruction can potentially depend on the
+		 * address at which it's executed. Rather than emulating
+		 * the broad spectrum of instructions that can now be
+		 * position dependent, we emulate jumps and others as in
+		 * 32-bit mode, and take a different tack for instructions
+		 * using %rip-relative addressing.
+		 *
+		 * For every instruction that uses the ModRM byte, the
+		 * in-kernel disassembler reports its location. We use the
+		 * ModRM byte to identify that an instruction uses
+		 * %rip-relative addressing and to see what other registers
+		 * the instruction uses. To emulate those instructions,
+		 * we modify the instruction to be %rax-relative rather than
+		 * %rip-relative (or %rcx-relative if the instruction uses
+		 * %rax; or %r8- or %r9-relative if the REX.B is present so
+		 * we don't have to rewrite the REX prefix). We then load
+		 * the value that %rip would have been into the scratch
+		 * register and generate an instruction to reset the scratch
+		 * register back to its original value. The instruction
+		 * sequence looks like this:
+		 *
+		 *	64-mode %rip-relative		bytes
+		 *	------------------------	-----
+		 * a:	<modified instruction>		<= 15
+		 *	movq	$<value>, %<scratch>	    6
+		 *	jmp	0(%rip)			    6
+		 *	<pc + tp->ftt_size>		    8
+		 * b:	<modified instruction>  	<= 15
+		 * 	int	T_DTRACE_RET		    2
+		 * 					-----
+		 *					   52
+		 *
+		 * We set curthread->t_dtrace_regv so that upon receiving
+		 * a signal we can reset the value of the scratch register.
+		 */
+
+		ASSERT(tp->ftt_size < FASTTRAP_MAX_INSTR_SIZE);
+
+		curthread->t_dtrace_scrpc = addr;
+		bcopy(tp->ftt_instr, &scratch[i], tp->ftt_size);
+		i += tp->ftt_size;
+
+#ifdef __amd64
+		if (tp->ftt_ripmode != 0) {
+			greg_t *reg;
+
+			ASSERT(p->p_model == DATAMODEL_LP64);
+			ASSERT(tp->ftt_ripmode &
+			    (FASTTRAP_RIP_1 | FASTTRAP_RIP_2));
+
+			/*
+			 * If this was a %rip-relative instruction, we change
+			 * it to be either a %rax- or %rcx-relative
+			 * instruction (depending on whether those registers
+			 * are used as another operand; or %r8- or %r9-
+			 * relative depending on the value of REX.B). We then
+			 * set that register and generate a movq instruction
+			 * to reset the value.
+			 */
+			if (tp->ftt_ripmode & FASTTRAP_RIP_X)
+				scratch[i++] = FASTTRAP_REX(1, 0, 0, 1);
+			else
+				scratch[i++] = FASTTRAP_REX(1, 0, 0, 0);
+
+			if (tp->ftt_ripmode & FASTTRAP_RIP_1)
+				scratch[i++] = FASTTRAP_MOV_EAX;
+			else
+				scratch[i++] = FASTTRAP_MOV_ECX;
+
+			switch (tp->ftt_ripmode) {
+			case FASTTRAP_RIP_1:
+				reg = &rp->r_rax;
+				curthread->t_dtrace_reg = REG_RAX;
+				break;
+			case FASTTRAP_RIP_2:
+				reg = &rp->r_rcx;
+				curthread->t_dtrace_reg = REG_RCX;
+				break;
+			case FASTTRAP_RIP_1 | FASTTRAP_RIP_X:
+				reg = &rp->r_r8;
+				curthread->t_dtrace_reg = REG_R8;
+				break;
+			case FASTTRAP_RIP_2 | FASTTRAP_RIP_X:
+				reg = &rp->r_r9;
+				curthread->t_dtrace_reg = REG_R9;
+				break;
+			}
+
+			/* LINTED - alignment */
+			*(uint64_t *)&scratch[i] = *reg;
+			curthread->t_dtrace_regv = *reg;
+			*reg = pc + tp->ftt_size;
+			i += sizeof (uint64_t);
+		}
+#endif
+
+		/*
+		 * Generate the branch instruction to what would have
+		 * normally been the subsequent instruction. In 32-bit mode,
+		 * this is just a relative branch; in 64-bit mode this is a
+		 * %rip-relative branch that loads the 64-bit pc value
+		 * immediately after the jmp instruction.
+		 */
+#ifdef __amd64
+		if (p->p_model == DATAMODEL_LP64) {
+			scratch[i++] = FASTTRAP_GROUP5_OP;
+			scratch[i++] = FASTTRAP_MODRM(0, 4, 5);
+			/* LINTED - alignment */
+			*(uint32_t *)&scratch[i] = 0;
+			i += sizeof (uint32_t);
+			/* LINTED - alignment */
+			*(uint64_t *)&scratch[i] = pc + tp->ftt_size;
+			i += sizeof (uint64_t);
+		} else {
+#endif
+			/*
+			 * Set up the jmp to the next instruction; note that
+			 * the size of the traced instruction cancels out.
+			 */
+			scratch[i++] = FASTTRAP_JMP32;
+			/* LINTED - alignment */
+			*(uint32_t *)&scratch[i] = pc - addr - 5;
+			i += sizeof (uint32_t);
+#ifdef __amd64
+		}
+#endif
+
+		curthread->t_dtrace_astpc = addr + i;
+		bcopy(tp->ftt_instr, &scratch[i], tp->ftt_size);
+		i += tp->ftt_size;
+		scratch[i++] = FASTTRAP_INT;
+		scratch[i++] = T_DTRACE_RET;
+
+		ASSERT(i <= sizeof (scratch));
+
+		if (fasttrap_copyout(scratch, (char *)addr, i)) {
+			fasttrap_sigtrap(p, curthread, pc);
+			new_pc = pc;
+			break;
+		}
+
+		if (tp->ftt_retids != NULL) {
+			curthread->t_dtrace_step = 1;
+			curthread->t_dtrace_ret = 1;
+			new_pc = curthread->t_dtrace_astpc;
+		} else {
+			new_pc = curthread->t_dtrace_scrpc;
+		}
+
+		curthread->t_dtrace_pc = pc;
+		curthread->t_dtrace_npc = pc + tp->ftt_size;
+		curthread->t_dtrace_on = 1;
+		break;
+	}
+
+	default:
+		panic("fasttrap: mishandled an instruction");
+	}
+
+done:
+	/*
+	 * If there were no return probes when we first found the tracepoint,
+	 * we should feel no obligation to honor any return probes that were
+	 * subsequently enabled -- they'll just have to wait until the next
+	 * time around.
+	 */
+	if (tp->ftt_retids != NULL) {
+		/*
+		 * We need to wait until the results of the instruction are
+		 * apparent before invoking any return probes. If this
+		 * instruction was emulated we can just call
+		 * fasttrap_return_common(); if it needs to be executed, we
+		 * need to wait until the user thread returns to the kernel.
+		 */
+		if (tp->ftt_type != FASTTRAP_T_COMMON) {
+			/*
+			 * Set the program counter to the address of the traced
+			 * instruction so that it looks right in ustack()
+			 * output. We had previously set it to the end of the
+			 * instruction to simplify %rip-relative addressing.
+			 */
+			rp->r_pc = pc;
+
+			fasttrap_return_common(rp, pc, pid, new_pc);
+		} else {
+			ASSERT(curthread->t_dtrace_ret != 0);
+			ASSERT(curthread->t_dtrace_pc == pc);
+			ASSERT(curthread->t_dtrace_scrpc != 0);
+			ASSERT(new_pc == curthread->t_dtrace_astpc);
+		}
+	}
+
+	rp->r_pc = new_pc;
+
+	return (0);
+}
+
+int
+fasttrap_return_probe(struct regs *rp)
+{
+	proc_t *p = curproc;
+	uintptr_t pc = curthread->t_dtrace_pc;
+	uintptr_t npc = curthread->t_dtrace_npc;
+
+	curthread->t_dtrace_pc = 0;
+	curthread->t_dtrace_npc = 0;
+	curthread->t_dtrace_scrpc = 0;
+	curthread->t_dtrace_astpc = 0;
+
+	/*
+	 * Treat a child created by a call to vfork(2) as if it were its
+	 * parent. We know that there's only one thread of control in such a
+	 * process: this one.
+	 */
+	while (p->p_flag & SVFORK) {
+		p = p->p_parent;
+	}
+
+	/*
+	 * We set rp->r_pc to the address of the traced instruction so
+	 * that it appears to dtrace_probe() that we're on the original
+	 * instruction, and so that the user can't easily detect our
+	 * complex web of lies. dtrace_return_probe() (our caller)
+	 * will correctly set %pc after we return.
+	 */
+	rp->r_pc = pc;
+
+	fasttrap_return_common(rp, pc, p->p_pid, npc);
+
+	return (0);
+}
+
+/*ARGSUSED*/
+uint64_t
+fasttrap_pid_getarg(void *arg, dtrace_id_t id, void *parg, int argno,
+    int aframes)
+{
+	return (fasttrap_anarg(ttolwp(curthread)->lwp_regs, 1, argno));
+}
+
+/*ARGSUSED*/
+uint64_t
+fasttrap_usdt_getarg(void *arg, dtrace_id_t id, void *parg, int argno,
+    int aframes)
+{
+	return (fasttrap_anarg(ttolwp(curthread)->lwp_regs, 0, argno));
+}
+
+static ulong_t
+fasttrap_getreg(struct regs *rp, uint_t reg)
+{
+#ifdef __amd64
+	switch (reg) {
+	case REG_R15:		return (rp->r_r15);
+	case REG_R14:		return (rp->r_r14);
+	case REG_R13:		return (rp->r_r13);
+	case REG_R12:		return (rp->r_r12);
+	case REG_R11:		return (rp->r_r11);
+	case REG_R10:		return (rp->r_r10);
+	case REG_R9:		return (rp->r_r9);
+	case REG_R8:		return (rp->r_r8);
+	case REG_RDI:		return (rp->r_rdi);
+	case REG_RSI:		return (rp->r_rsi);
+	case REG_RBP:		return (rp->r_rbp);
+	case REG_RBX:		return (rp->r_rbx);
+	case REG_RDX:		return (rp->r_rdx);
+	case REG_RCX:		return (rp->r_rcx);
+	case REG_RAX:		return (rp->r_rax);
+	case REG_TRAPNO:	return (rp->r_trapno);
+	case REG_ERR:		return (rp->r_err);
+	case REG_RIP:		return (rp->r_rip);
+	case REG_CS:		return (rp->r_cs);
+	case REG_RFL:		return (rp->r_rfl);
+	case REG_RSP:		return (rp->r_rsp);
+	case REG_SS:		return (rp->r_ss);
+	case REG_FS:		return (rp->r_fs);
+	case REG_GS:		return (rp->r_gs);
+	case REG_DS:		return (rp->r_ds);
+	case REG_ES:		return (rp->r_es);
+	case REG_FSBASE:	return (rdmsr(MSR_AMD_FSBASE));
+	case REG_GSBASE:	return (rdmsr(MSR_AMD_GSBASE));
+	}
+
+	panic("dtrace: illegal register constant");
+	/*NOTREACHED*/
+#else
+	if (reg >= _NGREG)
+		panic("dtrace: illegal register constant");
+
+	return (((greg_t *)&rp->r_gs)[reg]);
+#endif
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fbt.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fbt.c
new file mode 100644
index 0000000..b9353bd
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fbt.c
@@ -0,0 +1,849 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#include <sys/modctl.h>
+#include <sys/dtrace.h>
+#include <sys/kobj.h>
+#include <sys/stat.h>
+#include <sys/ddi.h>
+#include <sys/sunddi.h>
+#include <sys/conf.h>
+
+#define	FBT_PUSHL_EBP		0x55
+#define	FBT_MOVL_ESP_EBP0_V0	0x8b
+#define	FBT_MOVL_ESP_EBP1_V0	0xec
+#define	FBT_MOVL_ESP_EBP0_V1	0x89
+#define	FBT_MOVL_ESP_EBP1_V1	0xe5
+#define	FBT_REX_RSP_RBP		0x48
+
+#define	FBT_POPL_EBP		0x5d
+#define	FBT_RET			0xc3
+#define	FBT_RET_IMM16		0xc2
+#define	FBT_LEAVE		0xc9
+
+#ifdef __amd64
+#define	FBT_PATCHVAL		0xcc
+#else
+#define	FBT_PATCHVAL		0xf0
+#endif
+
+#define	FBT_ENTRY	"entry"
+#define	FBT_RETURN	"return"
+#define	FBT_ADDR2NDX(addr)	((((uintptr_t)(addr)) >> 4) & fbt_probetab_mask)
+#define	FBT_PROBETAB_SIZE	0x8000		/* 32k entries -- 128K total */
+
+typedef struct fbt_probe {
+	struct fbt_probe *fbtp_hashnext;
+	uint8_t		*fbtp_patchpoint;
+	int8_t		fbtp_rval;
+	uint8_t		fbtp_patchval;
+	uint8_t		fbtp_savedval;
+	uintptr_t	fbtp_roffset;
+	dtrace_id_t	fbtp_id;
+	char		*fbtp_name;
+	struct modctl	*fbtp_ctl;
+	int		fbtp_loadcnt;
+	int		fbtp_symndx;
+	int		fbtp_primary;
+	struct fbt_probe *fbtp_next;
+} fbt_probe_t;
+
+static dev_info_t		*fbt_devi;
+static dtrace_provider_id_t	fbt_id;
+static fbt_probe_t		**fbt_probetab;
+static int			fbt_probetab_size;
+static int			fbt_probetab_mask;
+static int			fbt_verbose = 0;
+
+static int
+fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval)
+{
+	uintptr_t stack0, stack1, stack2, stack3, stack4;
+	fbt_probe_t *fbt = fbt_probetab[FBT_ADDR2NDX(addr)];
+
+	for (; fbt != NULL; fbt = fbt->fbtp_hashnext) {
+		if ((uintptr_t)fbt->fbtp_patchpoint == addr) {
+			if (fbt->fbtp_roffset == 0) {
+				int i = 0;
+				/*
+				 * When accessing the arguments on the stack,
+				 * we must protect against accessing beyond
+				 * the stack.  We can safely set NOFAULT here
+				 * -- we know that interrupts are already
+				 * disabled.
+				 */
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+				CPU->cpu_dtrace_caller = stack[i++];
+#ifdef __amd64
+				/*
+				 * On amd64, stack[0] contains the dereferenced
+				 * stack pointer, stack[1] contains savfp,
+				 * stack[2] contains savpc.  We want to step
+				 * over these entries.
+				 */
+				i += 2;
+#endif
+				stack0 = stack[i++];
+				stack1 = stack[i++];
+				stack2 = stack[i++];
+				stack3 = stack[i++];
+				stack4 = stack[i++];
+				DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT |
+				    CPU_DTRACE_BADADDR);
+
+				dtrace_probe(fbt->fbtp_id, stack0, stack1,
+				    stack2, stack3, stack4);
+
+				CPU->cpu_dtrace_caller = NULL;
+			} else {
+#ifdef __amd64
+				/*
+				 * On amd64, we instrument the ret, not the
+				 * leave.  We therefore need to set the caller
+				 * to assure that the top frame of a stack()
+				 * action is correct.
+				 */
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+				CPU->cpu_dtrace_caller = stack[0];
+				DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT |
+				    CPU_DTRACE_BADADDR);
+#endif
+
+				dtrace_probe(fbt->fbtp_id, fbt->fbtp_roffset,
+				    rval, 0, 0, 0);
+				CPU->cpu_dtrace_caller = NULL;
+			}
+
+			return (fbt->fbtp_rval);
+		}
+	}
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+fbt_provide_module(void *arg, struct modctl *ctl)
+{
+	struct module *mp = ctl->mod_mp;
+	char *str = mp->strings;
+	int nsyms = mp->nsyms;
+	Shdr *symhdr = mp->symhdr;
+	char *modname = ctl->mod_modname;
+	char *name;
+	fbt_probe_t *fbt, *retfbt;
+	size_t symsize;
+	int i, size;
+
+	/*
+	 * Employees of dtrace and their families are ineligible.  Void
+	 * where prohibited.
+	 */
+	if (strcmp(modname, "dtrace") == 0)
+		return;
+
+	if (ctl->mod_requisites != NULL) {
+		struct modctl_list *list;
+
+		list = (struct modctl_list *)ctl->mod_requisites;
+
+		for (; list != NULL; list = list->modl_next) {
+			if (strcmp(list->modl_modp->mod_modname, "dtrace") == 0)
+				return;
+		}
+	}
+
+	/*
+	 * KMDB is ineligible for instrumentation -- it may execute in
+	 * any context, including probe context.
+	 */
+	if (strcmp(modname, "kmdbmod") == 0)
+		return;
+
+	if (str == NULL || symhdr == NULL || symhdr->sh_addr == NULL) {
+		/*
+		 * If this module doesn't (yet) have its string or symbol
+		 * table allocated, clear out.
+		 */
+		return;
+	}
+
+	symsize = symhdr->sh_entsize;
+
+	if (mp->fbt_nentries) {
+		/*
+		 * This module has some FBT entries allocated; we're afraid
+		 * to screw with it.
+		 */
+		return;
+	}
+
+	for (i = 1; i < nsyms; i++) {
+		uint8_t *instr, *limit;
+		Sym *sym = (Sym *)(symhdr->sh_addr + i * symsize);
+		int j;
+
+		if (ELF_ST_TYPE(sym->st_info) != STT_FUNC)
+			continue;
+
+		/*
+		 * Weak symbols are not candidates.  This could be made to
+		 * work (where weak functions and their underlying function
+		 * appear as two disjoint probes), but it's not simple.
+		 */
+		if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
+			continue;
+
+		name = str + sym->st_name;
+
+		if (strstr(name, "dtrace_") == name &&
+		    strstr(name, "dtrace_safe_") != name) {
+			/*
+			 * Anything beginning with "dtrace_" may be called
+			 * from probe context unless it explitly indicates
+			 * that it won't be called from probe context by
+			 * using the prefix "dtrace_safe_".
+			 */
+			continue;
+		}
+
+		if (strstr(name, "kdi_") == name ||
+		    strstr(name, "_kdi_") != NULL) {
+			/*
+			 * Any function name beginning with "kdi_" or
+			 * containing the string "_kdi_" is a part of the
+			 * kernel debugger interface and may be called in
+			 * arbitrary context -- including probe context.
+			 */
+			continue;
+		}
+
+		/*
+		 * Due to 4524008, _init and _fini may have a bloated st_size.
+		 * While this bug was fixed quite some time ago, old drivers
+		 * may be lurking.  We need to develop a better solution to
+		 * this problem, such that correct _init and _fini functions
+		 * (the vast majority) may be correctly traced.  One solution
+		 * may be to scan through the entire symbol table to see if
+		 * any symbol overlaps with _init.  If none does, set a bit in
+		 * the module structure that this module has correct _init and
+		 * _fini sizes.  This will cause some pain the first time a
+		 * module is scanned, but at least it would be O(N) instead of
+		 * O(N log N)...
+		 */
+		if (strcmp(name, "_init") == 0)
+			continue;
+
+		if (strcmp(name, "_fini") == 0)
+			continue;
+
+		/*
+		 * In order to be eligible, the function must begin with the
+		 * following sequence:
+		 *
+		 * 	pushl	%esp
+		 *	movl	%esp, %ebp
+		 *
+		 * Note that there are two variants of encodings that generate
+		 * the movl; we must check for both.  For 64-bit, we would
+		 * normally insist that a function begin with the following
+		 * sequence:
+		 *
+		 *	pushq	%rbp
+		 *	movq	%rsp, %rbp
+		 *
+		 * However, the compiler for 64-bit often splits these two
+		 * instructions -- and the first instruction in the function
+		 * is often not the pushq.  As a result, on 64-bit we look
+		 * for any "pushq %rbp" in the function and we instrument
+		 * this with a breakpoint instruction.
+		 */
+		instr = (uint8_t *)sym->st_value;
+		limit = (uint8_t *)(sym->st_value + sym->st_size);
+
+#ifdef __amd64
+		while (instr < limit) {
+			if (*instr == FBT_PUSHL_EBP)
+				break;
+
+			if ((size = dtrace_instr_size(instr)) <= 0)
+				break;
+
+			instr += size;
+		}
+
+		if (instr >= limit || *instr != FBT_PUSHL_EBP) {
+			/*
+			 * We either don't save the frame pointer in this
+			 * function, or we ran into some disassembly
+			 * screw-up.  Either way, we bail.
+			 */
+			continue;
+		}
+#else
+		if (instr[0] != FBT_PUSHL_EBP)
+			continue;
+
+		if (!(instr[1] == FBT_MOVL_ESP_EBP0_V0 &&
+		    instr[2] == FBT_MOVL_ESP_EBP1_V0) &&
+		    !(instr[1] == FBT_MOVL_ESP_EBP0_V1 &&
+		    instr[2] == FBT_MOVL_ESP_EBP1_V1))
+			continue;
+#endif
+
+		fbt = kmem_zalloc(sizeof (fbt_probe_t), KM_SLEEP);
+		fbt->fbtp_name = name;
+		fbt->fbtp_id = dtrace_probe_create(fbt_id, modname,
+		    name, FBT_ENTRY, 3, fbt);
+		fbt->fbtp_patchpoint = instr;
+		fbt->fbtp_ctl = ctl;
+		fbt->fbtp_loadcnt = ctl->mod_loadcnt;
+		fbt->fbtp_rval = DTRACE_INVOP_PUSHL_EBP;
+		fbt->fbtp_savedval = *instr;
+		fbt->fbtp_patchval = FBT_PATCHVAL;
+
+		fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)];
+		fbt->fbtp_symndx = i;
+		fbt_probetab[FBT_ADDR2NDX(instr)] = fbt;
+
+		mp->fbt_nentries++;
+
+		retfbt = NULL;
+again:
+		if (instr >= limit)
+			continue;
+
+		/*
+		 * If this disassembly fails, then we've likely walked off into
+		 * a jump table or some other unsuitable area.  Bail out of the
+		 * disassembly now.
+		 */
+		if ((size = dtrace_instr_size(instr)) <= 0)
+			continue;
+
+#ifdef __amd64
+		/*
+		 * We only instrument "ret" on amd64 -- we don't yet instrument
+		 * ret imm16, largely because the compiler doesn't seem to
+		 * (yet) emit them in the kernel...
+		 */
+		if (*instr != FBT_RET) {
+			instr += size;
+			goto again;
+		}
+#else
+		if (!(size == 1 &&
+		    (*instr == FBT_POPL_EBP || *instr == FBT_LEAVE) &&
+		    (*(instr + 1) == FBT_RET ||
+		    *(instr + 1) == FBT_RET_IMM16))) {
+			instr += size;
+			goto again;
+		}
+#endif
+
+		/*
+		 * We (desperately) want to avoid erroneously instrumenting a
+		 * jump table, especially given that our markers are pretty
+		 * short:  two bytes on x86, and just one byte on amd64.  To
+		 * determine if we're looking at a true instruction sequence
+		 * or an inline jump table that happens to contain the same
+		 * byte sequences, we resort to some heuristic sleeze:  we
+		 * treat this instruction as being contained within a pointer,
+		 * and see if that pointer points to within the body of the
+		 * function.  If it does, we refuse to instrument it.
+		 */
+		for (j = 0; j < sizeof (uintptr_t); j++) {
+			uintptr_t check = (uintptr_t)instr - j;
+			uint8_t *ptr;
+
+			if (check < sym->st_value)
+				break;
+
+			if (check + sizeof (uintptr_t) > (uintptr_t)limit)
+				continue;
+
+			ptr = *(uint8_t **)check;
+
+			if (ptr >= (uint8_t *)sym->st_value && ptr < limit) {
+				instr += size;
+				goto again;
+			}
+		}
+
+		/*
+		 * We have a winner!
+		 */
+		fbt = kmem_zalloc(sizeof (fbt_probe_t), KM_SLEEP);
+		fbt->fbtp_name = name;
+
+		if (retfbt == NULL) {
+			fbt->fbtp_id = dtrace_probe_create(fbt_id, modname,
+			    name, FBT_RETURN, 3, fbt);
+		} else {
+			retfbt->fbtp_next = fbt;
+			fbt->fbtp_id = retfbt->fbtp_id;
+		}
+
+		retfbt = fbt;
+		fbt->fbtp_patchpoint = instr;
+		fbt->fbtp_ctl = ctl;
+		fbt->fbtp_loadcnt = ctl->mod_loadcnt;
+
+#ifndef __amd64
+		if (*instr == FBT_POPL_EBP) {
+			fbt->fbtp_rval = DTRACE_INVOP_POPL_EBP;
+		} else {
+			ASSERT(*instr == FBT_LEAVE);
+			fbt->fbtp_rval = DTRACE_INVOP_LEAVE;
+		}
+		fbt->fbtp_roffset =
+		    (uintptr_t)(instr - (uint8_t *)sym->st_value) + 1;
+
+#else
+		ASSERT(*instr == FBT_RET);
+		fbt->fbtp_rval = DTRACE_INVOP_RET;
+		fbt->fbtp_roffset =
+		    (uintptr_t)(instr - (uint8_t *)sym->st_value);
+#endif
+
+		fbt->fbtp_savedval = *instr;
+		fbt->fbtp_patchval = FBT_PATCHVAL;
+		fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)];
+		fbt->fbtp_symndx = i;
+		fbt_probetab[FBT_ADDR2NDX(instr)] = fbt;
+
+		mp->fbt_nentries++;
+
+		instr += size;
+		goto again;
+	}
+}
+
+/*ARGSUSED*/
+static void
+fbt_destroy(void *arg, dtrace_id_t id, void *parg)
+{
+	fbt_probe_t *fbt = parg, *next, *hash, *last;
+	struct modctl *ctl = fbt->fbtp_ctl;
+	int ndx;
+
+	do {
+		if (ctl != NULL && ctl->mod_loadcnt == fbt->fbtp_loadcnt) {
+			if ((ctl->mod_loadcnt == fbt->fbtp_loadcnt &&
+			    ctl->mod_loaded)) {
+				((struct module *)
+				    (ctl->mod_mp))->fbt_nentries--;
+			}
+		}
+
+		/*
+		 * Now we need to remove this probe from the fbt_probetab.
+		 */
+		ndx = FBT_ADDR2NDX(fbt->fbtp_patchpoint);
+		last = NULL;
+		hash = fbt_probetab[ndx];
+
+		while (hash != fbt) {
+			ASSERT(hash != NULL);
+			last = hash;
+			hash = hash->fbtp_hashnext;
+		}
+
+		if (last != NULL) {
+			last->fbtp_hashnext = fbt->fbtp_hashnext;
+		} else {
+			fbt_probetab[ndx] = fbt->fbtp_hashnext;
+		}
+
+		next = fbt->fbtp_next;
+		kmem_free(fbt, sizeof (fbt_probe_t));
+
+		fbt = next;
+	} while (fbt != NULL);
+}
+
+/*ARGSUSED*/
+static int
+fbt_enable(void *arg, dtrace_id_t id, void *parg)
+{
+	fbt_probe_t *fbt = parg;
+	struct modctl *ctl = fbt->fbtp_ctl;
+
+	ctl->mod_nenabled++;
+
+	if (!ctl->mod_loaded) {
+		if (fbt_verbose) {
+			cmn_err(CE_NOTE, "fbt is failing for probe %s "
+			    "(module %s unloaded)",
+			    fbt->fbtp_name, ctl->mod_modname);
+		}
+
+		return (0);
+	}
+
+	/*
+	 * Now check that our modctl has the expected load count.  If it
+	 * doesn't, this module must have been unloaded and reloaded -- and
+	 * we're not going to touch it.
+	 */
+	if (ctl->mod_loadcnt != fbt->fbtp_loadcnt) {
+		if (fbt_verbose) {
+			cmn_err(CE_NOTE, "fbt is failing for probe %s "
+			    "(module %s reloaded)",
+			    fbt->fbtp_name, ctl->mod_modname);
+		}
+
+		return (0);
+	}
+
+	for (; fbt != NULL; fbt = fbt->fbtp_next)
+		*fbt->fbtp_patchpoint = fbt->fbtp_patchval;
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+fbt_disable(void *arg, dtrace_id_t id, void *parg)
+{
+	fbt_probe_t *fbt = parg;
+	struct modctl *ctl = fbt->fbtp_ctl;
+
+	ASSERT(ctl->mod_nenabled > 0);
+	ctl->mod_nenabled--;
+
+	if (!ctl->mod_loaded || (ctl->mod_loadcnt != fbt->fbtp_loadcnt))
+		return;
+
+	for (; fbt != NULL; fbt = fbt->fbtp_next)
+		*fbt->fbtp_patchpoint = fbt->fbtp_savedval;
+}
+
+/*ARGSUSED*/
+static void
+fbt_suspend(void *arg, dtrace_id_t id, void *parg)
+{
+	fbt_probe_t *fbt = parg;
+	struct modctl *ctl = fbt->fbtp_ctl;
+
+	ASSERT(ctl->mod_nenabled > 0);
+
+	if (!ctl->mod_loaded || (ctl->mod_loadcnt != fbt->fbtp_loadcnt))
+		return;
+
+	for (; fbt != NULL; fbt = fbt->fbtp_next)
+		*fbt->fbtp_patchpoint = fbt->fbtp_savedval;
+}
+
+/*ARGSUSED*/
+static void
+fbt_resume(void *arg, dtrace_id_t id, void *parg)
+{
+	fbt_probe_t *fbt = parg;
+	struct modctl *ctl = fbt->fbtp_ctl;
+
+	ASSERT(ctl->mod_nenabled > 0);
+
+	if (!ctl->mod_loaded || (ctl->mod_loadcnt != fbt->fbtp_loadcnt))
+		return;
+
+	for (; fbt != NULL; fbt = fbt->fbtp_next)
+		*fbt->fbtp_patchpoint = fbt->fbtp_patchval;
+}
+
+/*ARGSUSED*/
+static void
+fbt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc)
+{
+	fbt_probe_t *fbt = parg;
+	struct modctl *ctl = fbt->fbtp_ctl;
+	struct module *mp = ctl->mod_mp;
+	ctf_file_t *fp = NULL, *pfp;
+	ctf_funcinfo_t f;
+	int error;
+	ctf_id_t argv[32], type;
+	int argc = sizeof (argv) / sizeof (ctf_id_t);
+	const char *parent;
+
+	if (!ctl->mod_loaded || (ctl->mod_loadcnt != fbt->fbtp_loadcnt))
+		goto err;
+
+	if (fbt->fbtp_roffset != 0 && desc->dtargd_ndx == 0) {
+		(void) strcpy(desc->dtargd_native, "int");
+		return;
+	}
+
+	if ((fp = ctf_modopen(mp, &error)) == NULL) {
+		/*
+		 * We have no CTF information for this module -- and therefore
+		 * no args[] information.
+		 */
+		goto err;
+	}
+
+	/*
+	 * If we have a parent container, we must manually import it.
+	 */
+	if ((parent = ctf_parent_name(fp)) != NULL) {
+		struct modctl *mp = &modules;
+		struct modctl *mod = NULL;
+
+		/*
+		 * We must iterate over all modules to find the module that
+		 * is our parent.
+		 */
+		do {
+			if (strcmp(mp->mod_modname, parent) == 0) {
+				mod = mp;
+				break;
+			}
+		} while ((mp = mp->mod_next) != &modules);
+
+		if (mod == NULL)
+			goto err;
+
+		if ((pfp = ctf_modopen(mod->mod_mp, &error)) == NULL) {
+			goto err;
+		}
+
+		if (ctf_import(fp, pfp) != 0) {
+			ctf_close(pfp);
+			goto err;
+		}
+
+		ctf_close(pfp);
+	}
+
+	if (ctf_func_info(fp, fbt->fbtp_symndx, &f) == CTF_ERR)
+		goto err;
+
+	if (fbt->fbtp_roffset != 0) {
+		if (desc->dtargd_ndx > 1)
+			goto err;
+
+		ASSERT(desc->dtargd_ndx == 1);
+		type = f.ctc_return;
+	} else {
+		if (desc->dtargd_ndx + 1 > f.ctc_argc)
+			goto err;
+
+		if (ctf_func_args(fp, fbt->fbtp_symndx, argc, argv) == CTF_ERR)
+			goto err;
+
+		type = argv[desc->dtargd_ndx];
+	}
+
+	if (ctf_type_name(fp, type, desc->dtargd_native,
+	    DTRACE_ARGTYPELEN) != NULL) {
+		ctf_close(fp);
+		return;
+	}
+err:
+	if (fp != NULL)
+		ctf_close(fp);
+
+	desc->dtargd_ndx = DTRACE_ARGNONE;
+}
+
+static dtrace_pattr_t fbt_attr = {
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
+{ DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA },
+{ DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
+};
+
+static dtrace_pops_t fbt_pops = {
+	NULL,
+	fbt_provide_module,
+	fbt_enable,
+	fbt_disable,
+	fbt_suspend,
+	fbt_resume,
+	fbt_getargdesc,
+	NULL,
+	NULL,
+	fbt_destroy
+};
+
+static void
+fbt_cleanup(dev_info_t *devi)
+{
+	dtrace_invop_remove(fbt_invop);
+	ddi_remove_minor_node(devi, NULL);
+	kmem_free(fbt_probetab, fbt_probetab_size * sizeof (fbt_probe_t *));
+	fbt_probetab = NULL;
+	fbt_probetab_mask = 0;
+}
+
+static int
+fbt_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_ATTACH:
+		break;
+	case DDI_RESUME:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (fbt_probetab_size == 0)
+		fbt_probetab_size = FBT_PROBETAB_SIZE;
+
+	fbt_probetab_mask = fbt_probetab_size - 1;
+	fbt_probetab =
+	    kmem_zalloc(fbt_probetab_size * sizeof (fbt_probe_t *), KM_SLEEP);
+
+	dtrace_invop_add(fbt_invop);
+
+	if (ddi_create_minor_node(devi, "fbt", S_IFCHR, 0,
+	    DDI_PSEUDO, NULL) == DDI_FAILURE ||
+	    dtrace_register("fbt", &fbt_attr, DTRACE_PRIV_KERNEL, NULL,
+	    &fbt_pops, NULL, &fbt_id) != 0) {
+		fbt_cleanup(devi);
+		return (DDI_FAILURE);
+	}
+
+	ddi_report_dev(devi);
+	fbt_devi = devi;
+
+	return (DDI_SUCCESS);
+}
+
+static int
+fbt_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
+{
+	switch (cmd) {
+	case DDI_DETACH:
+		break;
+	case DDI_SUSPEND:
+		return (DDI_SUCCESS);
+	default:
+		return (DDI_FAILURE);
+	}
+
+	if (dtrace_unregister(fbt_id) != 0)
+		return (DDI_FAILURE);
+
+	fbt_cleanup(devi);
+
+	return (DDI_SUCCESS);
+}
+
+/*ARGSUSED*/
+static int
+fbt_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+	int error;
+
+	switch (infocmd) {
+	case DDI_INFO_DEVT2DEVINFO:
+		*result = (void *)fbt_devi;
+		error = DDI_SUCCESS;
+		break;
+	case DDI_INFO_DEVT2INSTANCE:
+		*result = (void *)0;
+		error = DDI_SUCCESS;
+		break;
+	default:
+		error = DDI_FAILURE;
+	}
+	return (error);
+}
+
+/*ARGSUSED*/
+static int
+fbt_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
+{
+	return (0);
+}
+
+static struct cb_ops fbt_cb_ops = {
+	fbt_open,		/* open */
+	nodev,			/* close */
+	nulldev,		/* strategy */
+	nulldev,		/* print */
+	nodev,			/* dump */
+	nodev,			/* read */
+	nodev,			/* write */
+	nodev,			/* ioctl */
+	nodev,			/* devmap */
+	nodev,			/* mmap */
+	nodev,			/* segmap */
+	nochpoll,		/* poll */
+	ddi_prop_op,		/* cb_prop_op */
+	0,			/* streamtab  */
+	D_NEW | D_MP		/* Driver compatibility flag */
+};
+
+static struct dev_ops fbt_ops = {
+	DEVO_REV,		/* devo_rev */
+	0,			/* refcnt */
+	fbt_info,		/* get_dev_info */
+	nulldev,		/* identify */
+	nulldev,		/* probe */
+	fbt_attach,		/* attach */
+	fbt_detach,		/* detach */
+	nodev,			/* reset */
+	&fbt_cb_ops,		/* driver operations */
+	NULL,			/* bus operations */
+	nodev,			/* dev power */
+	ddi_quiesce_not_needed,		/* quiesce */
+};
+
+/*
+ * Module linkage information for the kernel.
+ */
+static struct modldrv modldrv = {
+	&mod_driverops,		/* module type (this is a pseudo driver) */
+	"Function Boundary Tracing",	/* name of module */
+	&fbt_ops,		/* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+	MODREV_1,
+	(void *)&modldrv,
+	NULL
+};
+
+int
+_init(void)
+{
+	return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+	return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+	return (mod_remove(&modlinkage));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fbt.conf b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fbt.conf
new file mode 100644
index 0000000..8e7cbe1
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/fbt.conf
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#ident	"%Z%%M%	%I%	%E% SMI"
+
+name="fbt" parent="pseudo" instance=0;
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/sdt.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/sdt.c
new file mode 100644
index 0000000..38be223
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/sdt.c
@@ -0,0 +1,557 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+
+#include <sys/modctl.h>
+#include <sys/sunddi.h>
+#include <sys/dtrace.h>
+#include <sys/kobj.h>
+#include <sys/stat.h>
+#include <sys/conf.h>
+#include <vm/seg_kmem.h>
+#include <sys/stack.h>
+#include <sys/frame.h>
+#include <sys/dtrace_impl.h>
+#include <sys/cmn_err.h>
+#include <sys/sysmacros.h>
+#include <sys/privregs.h>
+#include <sys/sdt_impl.h>
+
+#define	SDT_PATCHVAL	0xf0
+#define	SDT_ADDR2NDX(addr)	((((uintptr_t)(addr)) >> 4) & sdt_probetab_mask)
+#define	SDT_PROBETAB_SIZE	0x1000		/* 4k entries -- 16K total */
+
+static dev_info_t		*sdt_devi;
+static int			sdt_verbose = 0;
+static sdt_probe_t		**sdt_probetab;
+static int			sdt_probetab_size;
+static int			sdt_probetab_mask;
+
+/*ARGSUSED*/
+static int
+sdt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t eax)
+{
+	uintptr_t stack0, stack1, stack2, stack3, stack4;
+	int i = 0;
+	sdt_probe_t *sdt = sdt_probetab[SDT_ADDR2NDX(addr)];
+
+#ifdef __amd64
+	/*
+	 * On amd64, stack[0] contains the dereferenced stack pointer,
+	 * stack[1] contains savfp, stack[2] contains savpc.  We want
+	 * to step over these entries.
+	 */
+	i += 3;
+#endif
+
+	for (; sdt != NULL; sdt = sdt->sdp_hashnext) {
+		if ((uintptr_t)sdt->sdp_patchpoint == addr) {
+			/*
+			 * When accessing the arguments on the stack, we must
+			 * protect against accessing beyond the stack.  We can
+			 * safely set NOFAULT here -- we know that interrupts
+			 * are already disabled.
+			 */
+			DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+			stack0 = stack[i++];
+			stack1 = stack[i++];
+			stack2 = stack[i++];
+			stack3 = stack[i++];
+			stack4 = stack[i++];
+			DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT |
+			    CPU_DTRACE_BADADDR);
+
+			dtrace_probe(sdt->sdp_id, stack0, stack1,
+			    stack2, stack3, stack4);
+
+			return (DTRACE_INVOP_NOP);
+		}
+	}
+
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+sdt_provide_module(void *arg, struct modctl *ctl)
+{
+	struct module *mp = ctl->mod_mp;
+	char *modname = ctl->mod_modname;
+	sdt_probedesc_t *sdpd;
+	sdt_probe_t *sdp, *old;
+	sdt_provider_t *prov;
+	int len;
+
+	/*
+	 * One for all, and all for one:  if we haven't yet registered all of
+	 * our providers, we'll refuse to provide anything.
+	 */
+	for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) {
+		if (prov->sdtp_id == DTRACE_PROVNONE)
+			return;
+	}
+
+	if (mp->sdt_nprobes != 0 || (sdpd = mp->sdt_probes) == NULL)
+		return;
+
+	for (sdpd = mp->sdt_probes; sdpd != NULL; sdpd = sdpd->sdpd_next) {
+		char *name = sdpd->sdpd_name, *func, *nname;
+		int i, j;
+		sdt_provider_t *prov;
+		ulong_t offs;
+		dtrace_id_t id;
+
+		for (prov = sdt_providers; prov->sdtp_prefix != NULL; prov++) {
+			char *prefix = prov->sdtp_prefix;
+
+			if (strncmp(name, prefix, strlen(prefix)) == 0) {
+				name += strlen(prefix);
+				break;
+			}
+		}
+
+		nname = kmem_alloc(len = strlen(name) + 1, KM_SLEEP);
+
+		for (i = 0, j = 0; name[j] != '\0'; i++) {
+			if (name[j] == '_' && name[j + 1] == '_') {
+				nname[i] = '-';
+				j += 2;
+			} else {
+				nname[i] = name[j++];
+			}
+		}
+
+		nname[i] = '\0';
+
+		sdp = kmem_zalloc(sizeof (sdt_probe_t), KM_SLEEP);
+		sdp->sdp_loadcnt = ctl->mod_loadcnt;
+		sdp->sdp_ctl = ctl;
+		sdp->sdp_name = nname;
+		sdp->sdp_namelen = len;
+		sdp->sdp_provider = prov;
+
+		func = kobj_searchsym(mp, sdpd->sdpd_offset, &offs);
+
+		if (func == NULL)
+			func = "<unknown>";
+
+		/*
+		 * We have our provider.  Now create the probe.
+		 */
+		if ((id = dtrace_probe_lookup(prov->sdtp_id, modname,
+		    func, nname)) != DTRACE_IDNONE) {
+			old = dtrace_probe_arg(prov->sdtp_id, id);
+			ASSERT(old != NULL);
+
+			sdp->sdp_next = old->sdp_next;
+			sdp->sdp_id = id;
+			old->sdp_next = sdp;
+		} else {
+			sdp->sdp_id = dtrace_probe_create(prov->sdtp_id,
+			    modname, func, nname, 3, sdp);
+
+			mp->sdt_nprobes++;
+		}
+
+		sdp->sdp_hashnext =
+		    sdt_probetab[SDT_ADDR2NDX(sdpd->sdpd_offset)];
+		sdt_probetab[SDT_ADDR2NDX(sdpd->sdpd_offset)] = sdp;
+
+		sdp->sdp_patchval = SDT_PATCHVAL;
+		sdp->sdp_patchpoint = (uint8_t *)sdpd->sdpd_offset;
+		sdp->sdp_savedval = *sdp->sdp_patchpoint;
+	}
+}
+
+/*ARGSUSED*/
+static void
+sdt_destroy(void *arg, dtrace_id_t id, void *parg)
+{
+	sdt_probe_t *sdp = parg, *old, *last, *hash;
+	struct modctl *ctl = sdp->sdp_ctl;
+	int ndx;
+
+	if (ctl != NULL && ctl->mod_loadcnt == sdp->sdp_loadcnt) {
+		if ((ctl->mod_loadcnt == sdp->sdp_loadcnt &&
+		    ctl->mod_loaded)) {
+			((struct module *)(ctl->mod_mp))->sdt_nprobes--;
+		}
+	}
+
+	while (sdp != NULL) {
+		old = sdp;
+
+		/*
+		 * Now we need to remove this probe from the sdt_probetab.
+		 */
+		ndx = SDT_ADDR2NDX(sdp->sdp_patchpoint);
+		last = NULL;
+		hash = sdt_probetab[ndx];
+
+		while (hash != sdp) {
+			ASSERT(hash != NULL);
+			last = hash;
+			hash = hash->sdp_hashnext;
+		}
+
+		if (last != NULL) {
+			last->sdp_hashnext = sdp->sdp_hashnext;
+		} else {
+			sdt_probetab[ndx] = sdp->sdp_hashnext;
+		}
+
+		kmem_free(sdp->sdp_name, sdp->sdp_namelen);
+		sdp = sdp->sdp_next;
+		kmem_free(old, sizeof (sdt_probe_t));
+	}
+}
+
+/*ARGSUSED*/
+static int
+sdt_enable(void *arg, dtrace_id_t id, void *parg)
+{
+	sdt_probe_t *sdp = parg;
+	struct modctl *ctl = sdp->sdp_ctl;
+
+	ctl->mod_nenabled++;
+
+	/*
+	 * If this module has disappeared since we discovered its probes,
+	 * refuse to enable it.
+	 */
+	if (!ctl->mod_loaded) {
+		if (sdt_verbose) {
+			cmn_err(CE_NOTE, "sdt is failing for probe %s "
+			    "(module %s unloaded)",
+			    sdp->sdp_name, ctl->mod_modname);
+		}
+		goto err;
+	}
+
+	/*
+	 * Now check that our modctl has the expected load count.  If it
+	 * doesn't, this module must have been unloaded and reloaded -- and
+	 * we're not going to touch it.
+	 */
+	if (ctl->mod_loadcnt != sdp->sdp_loadcnt) {
+		if (sdt_verbose) {
+			cmn_err(CE_NOTE, "sdt is failing for probe %s "
+			    "(module %s reloaded)",
+			    sdp->sdp_name, ctl->mod_modname);
+		}
+		goto err;
+	}
+
+	while (sdp != NULL) {
+		*sdp->sdp_patchpoint = sdp->sdp_patchval;
+		sdp = sdp->sdp_next;
+	}
+err:
+	return (0);
+}
+
+/*ARGSUSED*/
+static void
+sdt_disable(void *arg, dtrace_id_t id, void *parg)
+{
+	sdt_probe_t *sdp = parg;
+	struct modctl *ctl = sdp->sdp_ctl;
+
+	ctl->mod_nenabled--;
+
+	if (!ctl->mod_loaded || ctl->mod_loadcnt != sdp->sdp_loadcnt)
+		goto err;
+
+	while (sdp != NULL) {
+		*sdp->sdp_patchpoint = sdp->sdp_savedval;
+		sdp = sdp->sdp_next;
+	}
+
+err:
+	;
+}
+
+/*ARGSUSED*/
+uint64_t
+sdt_getarg(void *arg, dtrace_id_t id, void *parg, int argno, int aframes)
+{
+	uintptr_t val;
+	struct frame *fp = (struct frame *)dtrace_getfp();
+	uintptr_t *stack;
+	int i;
+#if defined(__amd64)
+	/*
+	 * A total of 6 arguments are passed via registers; any argument with
+	 * index of 5 or lower is therefore in a register.
+	 */
+	int inreg = 5;
+#endif
+
+	for (i = 1; i <= aframes; i++) {
+		fp = (struct frame *)(fp->fr_savfp);
+
+		if (fp->fr_savpc == (pc_t)dtrace_invop_callsite) {
+#if !defined(__amd64)
+			/*
+			 * If we pass through the invalid op handler, we will
+			 * use the pointer that it passed to the stack as the
+			 * second argument to dtrace_invop() as the pointer to
+			 * the stack.
+			 */
+			stack = ((uintptr_t **)&fp[1])[1];
+#else
+			/*
+			 * In the case of amd64, we will use the pointer to the
+			 * regs structure that was pushed when we took the
+			 * trap.  To get this structure, we must increment
+			 * beyond the frame structure.  If the argument that
+			 * we're seeking is passed on the stack, we'll pull
+			 * the true stack pointer out of the saved registers
+			 * and decrement our argument by the number of
+			 * arguments passed in registers; if the argument
+			 * we're seeking is passed in regsiters, we can just
+			 * load it directly.
+			 */
+			struct regs *rp = (struct regs *)((uintptr_t)&fp[1] +
+			    sizeof (uintptr_t));
+
+			if (argno <= inreg) {
+				stack = (uintptr_t *)&rp->r_rdi;
+			} else {
+				stack = (uintptr_t *)(rp->r_rsp);
+				argno -= (inreg + 1);
+			}
+#endif
+			goto load;
+		}
+	}
+
+	/*
+	 * We know that we did not come through a trap to get into
+	 * dtrace_probe() -- the provider simply called dtrace_probe()
+	 * directly.  As this is the case, we need to shift the argument
+	 * that we're looking for:  the probe ID is the first argument to
+	 * dtrace_probe(), so the argument n will actually be found where
+	 * one would expect to find argument (n + 1).
+	 */
+	argno++;
+
+#if defined(__amd64)
+	if (argno <= inreg) {
+		/*
+		 * This shouldn't happen.  If the argument is passed in a
+		 * register then it should have been, well, passed in a
+		 * register...
+		 */
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+		return (0);
+	}
+
+	argno -= (inreg + 1);
+#endif
+	stack = (uintptr_t *)&fp[1];
+
+load:
+	DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
+	val = stack[argno];
+	DTRACE_CPUFLAG_CLEAR(CPU_DTRACE_NOFAULT);
+
+	return (val);
+}
+
+static dtrace_pops_t sdt_pops = {
+	NULL,
+	sdt_provide_module,
+	sdt_enable,
+	sdt_disable,
+	NULL,
+	NULL,
+	sdt_getargdesc,
+	sdt_getarg,
+	NULL,
+	sdt_destroy
+};
+
+/*ARGSUSED*/
+static int
+sdt_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
+{
+	sdt_provider_t *prov;
+
+	if (ddi_create_minor_node(devi, "sdt", S_IFCHR,
+	    0, DDI_PSEUDO, NULL) == DDI_FAILURE) {
+		cmn_err(CE_NOTE, "/dev/sdt couldn't create minor node");
+		ddi_remove_minor_node(devi, NULL);
+		return (DDI_FAILURE);
+	}
+
+	ddi_report_dev(devi);
+	sdt_devi = devi;
+
+	if (sdt_probetab_size == 0)
+		sdt_probetab_size = SDT_PROBETAB_SIZE;
+
+	sdt_probetab_mask = sdt_probetab_size - 1;
+	sdt_probetab =
+	    kmem_zalloc(sdt_probetab_size * sizeof (sdt_probe_t *), KM_SLEEP);
+	dtrace_invop_add(sdt_invop);
+
+	for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) {
+		if (dtrace_register(prov->sdtp_name, prov->sdtp_attr,
+		    DTRACE_PRIV_KERNEL, NULL,
+		    &sdt_pops, prov, &prov->sdtp_id) != 0) {
+			cmn_err(CE_WARN, "failed to register sdt provider %s",
+			    prov->sdtp_name);
+		}
+	}
+
+	return (DDI_SUCCESS);
+}
+
+/*ARGSUSED*/
+static int
+sdt_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
+{
+	sdt_provider_t *prov;
+
+	switch (cmd) {
+	case DDI_DETACH:
+		break;
+
+	case DDI_SUSPEND:
+		return (DDI_SUCCESS);
+
+	default:
+		return (DDI_FAILURE);
+	}
+
+	for (prov = sdt_providers; prov->sdtp_name != NULL; prov++) {
+		if (prov->sdtp_id != DTRACE_PROVNONE) {
+			if (dtrace_unregister(prov->sdtp_id) != 0)
+				return (DDI_FAILURE);
+
+			prov->sdtp_id = DTRACE_PROVNONE;
+		}
+	}
+
+	dtrace_invop_remove(sdt_invop);
+	kmem_free(sdt_probetab, sdt_probetab_size * sizeof (sdt_probe_t *));
+
+	return (DDI_SUCCESS);
+}
+
+/*ARGSUSED*/
+static int
+sdt_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
+{
+	int error;
+
+	switch (infocmd) {
+	case DDI_INFO_DEVT2DEVINFO:
+		*result = (void *)sdt_devi;
+		error = DDI_SUCCESS;
+		break;
+	case DDI_INFO_DEVT2INSTANCE:
+		*result = (void *)0;
+		error = DDI_SUCCESS;
+		break;
+	default:
+		error = DDI_FAILURE;
+	}
+	return (error);
+}
+
+/*ARGSUSED*/
+static int
+sdt_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
+{
+	return (0);
+}
+
+static struct cb_ops sdt_cb_ops = {
+	sdt_open,		/* open */
+	nodev,			/* close */
+	nulldev,		/* strategy */
+	nulldev,		/* print */
+	nodev,			/* dump */
+	nodev,			/* read */
+	nodev,			/* write */
+	nodev,			/* ioctl */
+	nodev,			/* devmap */
+	nodev,			/* mmap */
+	nodev,			/* segmap */
+	nochpoll,		/* poll */
+	ddi_prop_op,		/* cb_prop_op */
+	0,			/* streamtab  */
+	D_NEW | D_MP		/* Driver compatibility flag */
+};
+
+static struct dev_ops sdt_ops = {
+	DEVO_REV,		/* devo_rev, */
+	0,			/* refcnt  */
+	sdt_info,		/* get_dev_info */
+	nulldev,		/* identify */
+	nulldev,		/* probe */
+	sdt_attach,		/* attach */
+	sdt_detach,		/* detach */
+	nodev,			/* reset */
+	&sdt_cb_ops,		/* driver operations */
+	NULL,			/* bus operations */
+	nodev,			/* dev power */
+	ddi_quiesce_not_needed,		/* quiesce */
+};
+
+/*
+ * Module linkage information for the kernel.
+ */
+static struct modldrv modldrv = {
+	&mod_driverops,		/* module type (this is a pseudo driver) */
+	"Statically Defined Tracing",	/* name of module */
+	&sdt_ops,		/* driver ops */
+};
+
+static struct modlinkage modlinkage = {
+	MODREV_1,
+	(void *)&modldrv,
+	NULL
+};
+
+int
+_init(void)
+{
+	return (mod_install(&modlinkage));
+}
+
+int
+_info(struct modinfo *modinfop)
+{
+	return (mod_info(&modlinkage, modinfop));
+}
+
+int
+_fini(void)
+{
+	return (mod_remove(&modlinkage));
+}
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/sdt.conf b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/sdt.conf
new file mode 100644
index 0000000..bde2149
--- /dev/null
+++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/intel/dtrace/sdt.conf
@@ -0,0 +1,28 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License").  You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+name="sdt" parent="pseudo" instance=0;
diff --git a/src/VBox/ExtPacks/VNC/VBoxVNC.cpp b/src/VBox/ExtPacks/VNC/VBoxVNC.cpp
index 04aa5e1..d9ab448 100644
--- a/src/VBox/ExtPacks/VNC/VBoxVNC.cpp
+++ b/src/VBox/ExtPacks/VNC/VBoxVNC.cpp
@@ -66,6 +66,7 @@ class VNCServerImpl
 public:
     VNCServerImpl()
     {
+        mVNCServer = NULL;
         mFrameBuffer = NULL;
         mScreenBuffer = NULL;
         mCursor = NULL;
@@ -79,6 +80,8 @@ public:
         if (mCursor)
             rfbFreeCursor(mCursor);
         RT_ZERO(szVNCPassword);
+        if (mVNCServer)
+            rfbScreenCleanup(mVNCServer);
     }
 
     int Init(const VRDEINTERFACEHDR *pCallbacks, void *pvCallback);
diff --git a/src/VBox/Frontends/VBoxAutostart/VBoxAutostartStop.cpp b/src/VBox/Frontends/VBoxAutostart/VBoxAutostartStop.cpp
index 19d814a..bf41726 100644
--- a/src/VBox/Frontends/VBoxAutostart/VBoxAutostartStop.cpp
+++ b/src/VBox/Frontends/VBoxAutostart/VBoxAutostartStop.cpp
@@ -50,6 +50,7 @@ typedef struct AUTOSTOPVM
 static HRESULT autostartSaveVMState(ComPtr<IConsole> &console)
 {
     HRESULT rc = S_OK;
+    ComPtr<IMachine> machine;
     ComPtr<IProgress> progress;
 
     do
@@ -82,7 +83,8 @@ static HRESULT autostartSaveVMState(ComPtr<IConsole> &console)
                 break;
         }
 
-        CHECK_ERROR(console, SaveState(progress.asOutParam()));
+        CHECK_ERROR(console, COMGETTER(Machine)(machine.asOutParam()));
+        CHECK_ERROR(machine, SaveState(progress.asOutParam()));
         if (FAILED(rc))
         {
             if (!fPaused)
diff --git a/src/VBox/Frontends/VBoxAutostart/VBoxAutostartUtils.cpp b/src/VBox/Frontends/VBoxAutostart/VBoxAutostartUtils.cpp
index 9033aee..01f73e5 100644
--- a/src/VBox/Frontends/VBoxAutostart/VBoxAutostartUtils.cpp
+++ b/src/VBox/Frontends/VBoxAutostart/VBoxAutostartUtils.cpp
@@ -47,20 +47,20 @@ DECLHIDDEN(const char *) machineStateToName(MachineState_T machineState, bool fS
             return fShort ? "poweroff"             : "powered off";
         case MachineState_Saved:
             return "saved";
-        case MachineState_Aborted:
-            return "aborted";
         case MachineState_Teleported:
             return "teleported";
+        case MachineState_Aborted:
+            return "aborted";
         case MachineState_Running:
             return "running";
         case MachineState_Paused:
             return "paused";
         case MachineState_Stuck:
             return fShort ? "gurumeditation"       : "guru meditation";
-        case MachineState_LiveSnapshotting:
-            return fShort ? "livesnapshotting"     : "live snapshotting";
         case MachineState_Teleporting:
             return "teleporting";
+        case MachineState_LiveSnapshotting:
+            return fShort ? "livesnapshotting"     : "live snapshotting";
         case MachineState_Starting:
             return "starting";
         case MachineState_Stopping:
@@ -73,16 +73,20 @@ DECLHIDDEN(const char *) machineStateToName(MachineState_T machineState, bool fS
             return fShort ? "teleportingpausedvm"  : "teleporting paused vm";
         case MachineState_TeleportingIn:
             return fShort ? "teleportingin"        : "teleporting (incoming)";
-        case MachineState_RestoringSnapshot:
-            return fShort ? "restoringsnapshot"    : "restoring snapshot";
-        case MachineState_DeletingSnapshot:
-            return fShort ? "deletingsnapshot"     : "deleting snapshot";
         case MachineState_DeletingSnapshotOnline:
             return fShort ? "deletingsnapshotlive" : "deleting snapshot live";
         case MachineState_DeletingSnapshotPaused:
             return fShort ? "deletingsnapshotlivepaused" : "deleting snapshot live paused";
+        case MachineState_OnlineSnapshotting:
+            return fShort ? "onlinesnapshotting"   : "online snapshotting";
+        case MachineState_RestoringSnapshot:
+            return fShort ? "restoringsnapshot"    : "restoring snapshot";
+        case MachineState_DeletingSnapshot:
+            return fShort ? "deletingsnapshot"     : "deleting snapshot";
         case MachineState_SettingUp:
             return fShort ? "settingup"           : "setting up";
+        case MachineState_Snapshotting:
+            return "snapshotting";
         default:
             break;
     }
diff --git a/src/VBox/Frontends/VBoxBalloonCtrl/VBoxBalloonCtrl.rc b/src/VBox/Frontends/VBoxBalloonCtrl/VBoxBalloonCtrl.rc
index 5a8e233..ea308a2 100644
--- a/src/VBox/Frontends/VBoxBalloonCtrl/VBoxBalloonCtrl.rc
+++ b/src/VBox/Frontends/VBoxBalloonCtrl/VBoxBalloonCtrl.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_APP
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_APP
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Balloon Control Tool\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxBalloonCtrl\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxBalloonCtrl.exe\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp b/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp
index f32290a..dc6a7b4 100644
--- a/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp
+++ b/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp
@@ -1,11 +1,10 @@
-
 /* $Id: VBoxModAPIMonitor.cpp $ */
 /** @file
  * VBoxModAPIMonitor - API monitor module for detecting host isolation.
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -213,6 +212,9 @@ static int apimonMachineControl(const Bstr &strUuid, PVBOXWATCHDOG_MACHINE pMach
                 /* Get the associated console. */
                 ComPtr<IConsole> console;
                 CHECK_ERROR_BREAK(g_pSession, COMGETTER(Console)(console.asOutParam()));
+                /* Get the associated session machine. */
+                ComPtr<IMachine> sessionMachine;
+                CHECK_ERROR_BREAK(g_pSession, COMGETTER(Machine)(sessionMachine.asOutParam()));
 
                 ComPtr<IProgress> progress;
 
@@ -268,7 +270,7 @@ static int apimonMachineControl(const Bstr &strUuid, PVBOXWATCHDOG_MACHINE pMach
                                 break;
                         }
 
-                        CHECK_ERROR(console, SaveState(progress.asOutParam()));
+                        CHECK_ERROR(sessionMachine, SaveState(progress.asOutParam()));
                         if (SUCCEEDED(rc))
                         {
                             progress->WaitForCompletion(ulTimeout);
diff --git a/src/VBox/Frontends/VBoxFB/VBoxFB.cpp b/src/VBox/Frontends/VBoxFB/VBoxFB.cpp
index d9af54d..cfb30b1 100644
--- a/src/VBox/Frontends/VBoxFB/VBoxFB.cpp
+++ b/src/VBox/Frontends/VBoxFB/VBoxFB.cpp
@@ -163,7 +163,7 @@ int main(int argc, char *argv[])
          * operations so it doesn't run the event loop.
          */
         nsCOMPtr<nsIEventQueue> eventQ;
-        rc = NS_GetMainEventQ(getter_AddRefs (eventQ));
+        rc = NS_GetMainEventQ(getter_AddRefs(eventQ));
         if (NS_FAILED(rc))
         {
             printf("Error: could not get main event queue! rc=%08X\n", rc);
@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
          * counting and freeing.
          */
         nsCOMPtr<nsIComponentManager> manager;
-        rc = NS_GetComponentManager (getter_AddRefs (manager));
+        rc = NS_GetComponentManager(getter_AddRefs(manager));
         if (NS_FAILED(rc))
         {
             printf("Error: could not get component manager! rc=%08X\n", rc);
diff --git a/src/VBox/Frontends/VBoxHeadless/Framebuffer.cpp b/src/VBox/Frontends/VBoxHeadless/Framebuffer.cpp
deleted file mode 100644
index c30e61f..0000000
--- a/src/VBox/Frontends/VBoxHeadless/Framebuffer.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/** @file
- *
- * VBox Remote Desktop Framebuffer
- */
-
-/*
- * Copyright (C) 2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include "Framebuffer.h"
-
-#include <iprt/alloc.h>
-
-#define LOG_GROUP LOG_GROUP_GUI
-#include <VBox/log.h>
-
-/*
- * VRDP server frame buffer
- */
-
-#ifdef VBOX_WITH_XPCOM
-#include <nsMemory.h>
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDPFramebuffer, IFramebuffer)
-NS_DECL_CLASSINFO(VRDPFramebuffer)
-#endif
-
-VRDPFramebuffer::VRDPFramebuffer()
-{
-#if defined (RT_OS_WINDOWS)
-    refcnt = 0;
-#endif /* RT_OS_WINDOWS */
-
-    mBuffer = NULL;
-
-    RTCritSectInit (&m_CritSect);
-
-    // start with a standard size
-    RequestResize(0, FramebufferPixelFormat_Opaque,
-                  (ULONG) NULL, 0, 0, 640, 480, NULL);
-}
-
-VRDPFramebuffer::~VRDPFramebuffer()
-{
-    if (mBuffer)
-    {
-        RTMemFree (mBuffer);
-    }
-
-    RTCritSectDelete (&m_CritSect);
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(Width)(ULONG *width)
-{
-    if (!width)
-        return E_INVALIDARG;
-    *width = mWidth;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(Height)(ULONG *height)
-{
-    if (!height)
-        return E_INVALIDARG;
-    *height = mHeight;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::Lock()
-{
-    RTCritSectEnter (&m_CritSect);
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::Unlock()
-{
-    RTCritSectLeave (&m_CritSect);
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(Address)(BYTE **address)
-{
-    if (!address)
-        return E_INVALIDARG;
-    *address = mScreen;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(BitsPerPixel)(ULONG *bitsPerPixel)
-{
-    if (!bitsPerPixel)
-        return E_INVALIDARG;
-    *bitsPerPixel = mBitsPerPixel;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(BytesPerLine)(ULONG *bytesPerLine)
-{
-    if (!bytesPerLine)
-        return E_INVALIDARG;
-    *bytesPerLine = mBytesPerLine;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(PixelFormat) (ULONG *pixelFormat)
-{
-    if (!pixelFormat)
-        return E_POINTER;
-    *pixelFormat = mPixelFormat;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM)
-{
-    if (!usesGuestVRAM)
-        return E_POINTER;
-    *usesGuestVRAM = mUsesGuestVRAM;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(HeightReduction) (ULONG *heightReduction)
-{
-    if (!heightReduction)
-        return E_POINTER;
-    /* no reduction at all */
-    *heightReduction = 0;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(Overlay) (IFramebufferOverlay **aOverlay)
-{
-    if (!aOverlay)
-        return E_POINTER;
-    /* overlays are not yet supported */
-    *aOverlay = 0;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::COMGETTER(WinId) (LONG64 *winId)
-{
-    if (!winId)
-        return E_POINTER;
-    *winId = 0;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::NotifyUpdate(ULONG x, ULONG y,
-                                           ULONG w, ULONG h)
-{
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::RequestResize(ULONG aScreenId, ULONG pixelFormat, BYTE *vram,
-                                            ULONG bitsPerPixel, ULONG bytesPerLine,
-                                            ULONG w, ULONG h,
-                                            BOOL *finished)
-{
-    /* Agree to requested format for LFB modes and use guest VRAM directly, thus avoiding
-     * unnecessary memcpy in VGA device.
-     */
-
-    Log(("pixelFormat = %08X, vram = %p, bpp = %d, bpl = 0x%08X, %dx%d\n",
-         pixelFormat, vram, bitsPerPixel, bytesPerLine, w, h));
-
-    /* Free internal buffer. */
-    if (mBuffer)
-    {
-        RTMemFree (mBuffer);
-        mBuffer = NULL;
-    }
-
-    mUsesGuestVRAM = FALSE;
-
-    mWidth = w;
-    mHeight = h;
-
-    if (pixelFormat == FramebufferPixelFormat_FOURCC_RGB)
-    {
-        switch (bitsPerPixel)
-        {
-            case 32:
-            case 24:
-            case 16:
-                mUsesGuestVRAM = TRUE;
-                break;
-
-            default:
-                break;
-        }
-    }
-
-    if (mUsesGuestVRAM)
-    {
-        mScreen = vram;
-        mBitsPerPixel = bitsPerPixel;
-        mBytesPerLine = bytesPerLine;
-        mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
-
-        Log (("Using guest VRAM directly, %d BPP\n", mBitsPerPixel));
-    }
-    else
-    {
-        mBitsPerPixel = 32;
-        mBytesPerLine = w * 4; /* Here we have 32 BPP */
-
-        if (mBytesPerLine > 0 && h > 0) /* Check for nul dimensions. */
-        {
-            mBuffer = RTMemAllocZ(mBytesPerLine * h);
-        }
-
-        mScreen = (uint8_t *)mBuffer;
-
-        Log(("Using internal buffer, %d BPP\n", mBitsPerPixel));
-    }
-
-    if (!mScreen)
-    {
-        Log(("No screen. BPP = %d, w = %d, h = %d!!!\n", mBitsPerPixel, w, h));
-
-        /* Just reset everything. */
-        mPixelFormat = FramebufferPixelFormat_Opaque;
-
-        mWidth = 0;
-        mHeight = 0;
-        mBitsPerPixel = 0;
-        mBytesPerLine = 0;
-        mUsesGuestVRAM = FALSE;
-    }
-
-    /* Inform the caller that the operation was successful. */
-
-    if (finished)
-        *finished = TRUE;
-
-    return S_OK;
-}
-
-/**
- * Returns whether we like the given video mode.
- *
- * @returns COM status code
- * @param   width     video mode width in pixels
- * @param   height    video mode height in pixels
- * @param   bpp       video mode bit depth in bits per pixel
- * @param   supported pointer to result variable
- */
-STDMETHODIMP VRDPFramebuffer::VideoModeSupported(ULONG width, ULONG height, ULONG bpp, BOOL *supported)
-{
-    if (!supported)
-        return E_POINTER;
-    *supported = TRUE;
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::GetVisibleRegion(BYTE *aRectangles, ULONG aCount,
-                                               ULONG *aCountCopied)
-{
-    PRTRECT rects = (PRTRECT)aRectangles;
-
-    if (!rects)
-        return E_POINTER;
-
-    /// @todo
-
-    NOREF(aCount);
-    NOREF(aCountCopied);
-
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::SetVisibleRegion(BYTE *aRectangles, ULONG aCount)
-{
-    PRTRECT rects = (PRTRECT)aRectangles;
-
-    if (!rects)
-        return E_POINTER;
-
-    /// @todo
-
-    NOREF(aCount);
-
-    return S_OK;
-}
-
-STDMETHODIMP VRDPFramebuffer::ProcessVHWACommand(BYTE *pCommand)
-{
-    return E_NOTIMPL;
-}
-
-STDMETHODIMP VRDPFramebuffer::Notify3DEvent(ULONG uType, BYTE *pReserved)
-{
-    return E_NOTIMPL;
-}
diff --git a/src/VBox/Frontends/VBoxHeadless/Framebuffer.h b/src/VBox/Frontends/VBoxHeadless/Framebuffer.h
deleted file mode 100644
index 58384ac..0000000
--- a/src/VBox/Frontends/VBoxHeadless/Framebuffer.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/** @file
- *
- * VBox Remote Desktop Framebuffer.
- */
-
-/*
- * Copyright (C) 2010-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef __VRDP__FRAMEBUFFER__H
-#define __VRDP__FRAMEBUFFER__H
-
-#include <VBox/com/VirtualBox.h>
-
-#include <iprt/critsect.h>
-
-class VRDPFramebuffer :
-    VBOX_SCRIPTABLE_IMPL(IFramebuffer)
-{
-public:
-    VRDPFramebuffer();
-    virtual ~VRDPFramebuffer();
-
-#ifndef VBOX_WITH_XPCOM
-    STDMETHOD_(ULONG, AddRef)() {
-        return ::InterlockedIncrement (&refcnt);
-    }
-    STDMETHOD_(ULONG, Release)()
-    {
-        long cnt = ::InterlockedDecrement (&refcnt);
-        if (cnt == 0)
-            delete this;
-        return cnt;
-    }
-#endif
-    VBOX_SCRIPTABLE_DISPATCH_IMPL(IFramebuffer)
-
-    NS_DECL_ISUPPORTS
-
-    STDMETHOD(COMGETTER(Width))(ULONG *width);
-    STDMETHOD(COMGETTER(Height))(ULONG *height);
-    STDMETHOD(Lock)();
-    STDMETHOD(Unlock)();
-    STDMETHOD(COMGETTER(Address))(BYTE **address);
-    STDMETHOD(COMGETTER(BitsPerPixel))(ULONG *bitsPerPixel);
-    STDMETHOD(COMGETTER(BytesPerLine))(ULONG *bytesPerLine);
-    STDMETHOD(COMGETTER(PixelFormat)) (ULONG *pixelFormat);
-    STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *usesGuestVRAM);
-    STDMETHOD(COMGETTER(HeightReduction)) (ULONG *heightReduction);
-    STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay);
-    STDMETHOD(COMGETTER(WinId)) (LONG64 *winId);
-
-    STDMETHOD(NotifyUpdate)(ULONG x, ULONG y, ULONG w, ULONG h);
-    STDMETHOD(RequestResize)(ULONG aScreenId, ULONG pixelFormat, BYTE *vram,
-                             ULONG bitsPerPixel, ULONG bytesPerLine, ULONG w, ULONG h,
-                             BOOL *finished);
-    STDMETHOD(VideoModeSupported)(ULONG width, ULONG height, ULONG bpp, BOOL *supported);
-
-    STDMETHOD(GetVisibleRegion)(BYTE *aRectangles, ULONG aCount, ULONG *aCountCopied);
-    STDMETHOD(SetVisibleRegion)(BYTE *aRectangles, ULONG aCount);
-
-    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
-
-    STDMETHOD(Notify3DEvent)(ULONG uType, BYTE *pReserved);
-private:
-    /* If the format is Opaque, then internal memory buffer is used.
-     * Otherwise guest VRAM is used directly.
-     */
-    ULONG mPixelFormat;
-
-    void *mBuffer;
-
-    uint8_t *mScreen;
-    ULONG mWidth;
-    ULONG mHeight;
-    ULONG mBitsPerPixel;
-    ULONG mBytesPerLine;
-
-    BOOL mUsesGuestVRAM;
-
-    RTCRITSECT m_CritSect;
-
-#ifndef VBOX_WITH_XPCOM
-    long refcnt;
-#endif
-};
-
-
-#endif /* __VRDP__FRAMEBUFFER__H */
diff --git a/src/VBox/Frontends/VBoxHeadless/Makefile.kmk b/src/VBox/Frontends/VBoxHeadless/Makefile.kmk
index 7b8e188..7929476 100644
--- a/src/VBox/Frontends/VBoxHeadless/Makefile.kmk
+++ b/src/VBox/Frontends/VBoxHeadless/Makefile.kmk
@@ -46,7 +46,6 @@ VBoxHeadlessHardened_NAME = VBoxHeadless
 VBoxHeadless_TEMPLATE  := $(if $(VBOX_WITH_HARDENING),VBOXMAINCLIENTDLL,VBOXMAINCLIENTEXE)
 VBoxHeadless_DEFS      += $(if $(VBOX_WITH_VPX),VBOX_WITH_VPX,)
 VBoxHeadless_SOURCES    = VBoxHeadless.cpp
-VBoxHeadless_SOURCES  += Framebuffer.cpp
 ifdef VBOX_WITH_GUEST_PROPS
  VBoxHeadless_DEFS     += VBOX_WITH_GUEST_PROPS
 endif
diff --git a/src/VBox/Frontends/VBoxHeadless/NullFramebuffer.h b/src/VBox/Frontends/VBoxHeadless/NullFramebuffer.h
deleted file mode 100644
index 346add4..0000000
--- a/src/VBox/Frontends/VBoxHeadless/NullFramebuffer.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (C) 2010-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef __NULL_FRAMEBUFFER_H
-#define __NULL_FRAMEBUFFER_H
-
-#include <VBox/com/VirtualBox.h>
-#include <iprt/alloc.h>
-
-class NullFB : VBOX_SCRIPTABLE_IMPL(IFramebuffer)
-{
-public:
-    NullFB()
-    :
-    mScreen(NULL), mBuffer(NULL),
-    mUsesGuestVRAM(false),
-    mWidth(0), mHeight(0)
-#ifndef VBOX_WITH_XPCOM
-    , refcnt(0)
-#endif
-    {}
-    virtual ~NullFB()
-    {
-        if (mBuffer)
-            RTMemFree(mBuffer);
-    }
-
-#ifndef VBOX_WITH_XPCOM
-    STDMETHOD_(ULONG, AddRef)() {
-        return ::InterlockedIncrement (&refcnt);
-    }
-    STDMETHOD_(ULONG, Release)() {
-        long cnt = ::InterlockedDecrement (&refcnt);
-        if (cnt == 0)
-            delete this;
-        return cnt;
-    }
-#endif
-    VBOX_SCRIPTABLE_DISPATCH_IMPL(IFramebuffer)
-
-    NS_DECL_ISUPPORTS
-
-    // public methods only for internal purposes
-    HRESULT init ()
-    {
-
-        RequestResize(0, FramebufferPixelFormat_Opaque, 0, 0, 0, 640, 480, 0);
-        return S_OK;
-    }
-
-    STDMETHOD(COMGETTER(Width))(ULONG *width)
-    {
-        if (!width)
-            return E_POINTER;
-        *width = mWidth;
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(Height))(ULONG *height)
-    {
-        if (!height)
-            return E_POINTER;
-        *height = mHeight;
-        return S_OK;
-    }
-    STDMETHOD(Lock)()
-    {
-        return S_OK;
-    }
-    STDMETHOD(Unlock)()
-    {
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(Address))(BYTE **address)
-    {
-        if (!address)
-            return E_POINTER;
-        *address = mScreen;
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(BitsPerPixel))(ULONG *bitsPerPixel)
-    {
-        if (!bitsPerPixel)
-            return E_POINTER;
-        *bitsPerPixel = mBitsPerPixel;
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(BytesPerLine))(ULONG *bytesPerLine)
-    {
-        if (!bytesPerLine)
-            return E_POINTER;
-        *bytesPerLine = mBytesPerLine;
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(PixelFormat)) (ULONG *pixelFormat)
-    {
-        if (!pixelFormat)
-            return E_POINTER;
-        *pixelFormat = mPixelFormat;
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *usesGuestVRAM)
-    {
-        if (!usesGuestVRAM)
-            return E_POINTER;
-        *usesGuestVRAM = mUsesGuestVRAM;
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(HeightReduction)) (ULONG *heightReduction)
-    {
-        if (!heightReduction)
-            return E_POINTER;
-        /* no reduction */
-        *heightReduction = 0;
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay)
-    {
-        if (!aOverlay)
-            return E_POINTER;
-        *aOverlay = 0;
-        return S_OK;
-    }
-    STDMETHOD(COMGETTER(WinId)) (LONG64 *winId)
-    {
-        if (!winId)
-            return E_POINTER;
-        *winId = 0;
-        return S_OK;
-    }
-
-    STDMETHOD(NotifyUpdate)(ULONG x, ULONG y, ULONG w, ULONG h)
-    {
-        return S_OK;
-    }
-    STDMETHOD(RequestResize)(ULONG aScreenId,
-                             ULONG pixelFormat,
-                             BYTE *vram,
-                             ULONG bitsPerPixel,
-                             ULONG bytesPerLine,
-                             ULONG w,
-                             ULONG h,
-                             BOOL *finished)
-    {
-        if (mBuffer)
-        {
-            RTMemFree(mBuffer);
-            mBuffer = NULL;
-        }
-
-        mWidth = w;
-        mHeight = h;
-        mPixelFormat = pixelFormat;
-        if (mPixelFormat == FramebufferPixelFormat_Opaque)
-        {
-            mBitsPerPixel = 32;
-            mBytesPerLine = w * 4;
-            mBuffer = (uint8_t*)RTMemAllocZ(mBytesPerLine * h);
-            mScreen = mBuffer;
-            mUsesGuestVRAM = false;
-        }
-        else
-        {
-            mBytesPerLine = bytesPerLine;
-            mBitsPerPixel = bitsPerPixel;
-            mScreen       = (uint8_t*)vram;
-            mUsesGuestVRAM = true;
-        }
-
-        if (finished)
-            *finished = true;
-        return S_OK;
-    }
-    STDMETHOD(VideoModeSupported)(ULONG width, ULONG height, ULONG bpp, BOOL *supported)
-    {
-        if (!supported)
-            return E_POINTER;
-        *supported = true;
-        return S_OK;
-    }
-    STDMETHOD(GetVisibleRegion)(BYTE *rectangles, ULONG count, ULONG *countCopied)
-    {
-        if (!rectangles)
-            return E_POINTER;
-        *rectangles = 0;
-        return S_OK;
-    }
-    STDMETHOD(SetVisibleRegion)(BYTE *rectangles, ULONG count)
-    {
-        if (!rectangles)
-            return E_POINTER;
-        return S_OK;
-    }
-
-    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
-    {
-        return E_NOTIMPL;
-    }
-
-    STDMETHOD(Notify3DEvent)(ULONG uType, BYTE *pReserved)
-    {
-        return E_NOTIMPL;
-    }
-
-private:
-    /** Guest framebuffer pixel format */
-    ULONG mPixelFormat;
-    /** Guest framebuffer color depth */
-    ULONG mBitsPerPixel;
-    /** Guest framebuffer line length */
-    ULONG mBytesPerLine;
-    /* VRAM pointer */
-    uint8_t *mScreen;
-    /* VRAM buffer */
-    uint8_t *mBuffer;
-    bool     mUsesGuestVRAM;
-
-    ULONG mWidth, mHeight;
-
-#ifndef VBOX_WITH_XPCOM
-    long refcnt;
-#endif
-};
-
-#endif // __NULL_FRAMEBUFFER_H
diff --git a/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp b/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
index 4e18afe..92a0239 100644
--- a/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
+++ b/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -53,10 +53,6 @@ using namespace com;
 #include <signal.h>
 #endif
 
-#include "Framebuffer.h"
-
-#include "NullFramebuffer.h"
-
 ////////////////////////////////////////////////////////////////////////////////
 
 #define LogError(m,rc) \
@@ -131,17 +127,19 @@ private:
 };
 
 /**
- *  Handler for global events.
+ *  Handler for machine events.
  */
-class VirtualBoxEventListener
+class ConsoleEventListener
 {
 public:
-    VirtualBoxEventListener()
+    ConsoleEventListener() :
+        mLastVRDEPort(-1),
+        m_fIgnorePowerOffEvents(false),
+        m_fNoLoggedInUsers(true)
     {
-        mfNoLoggedInUsers = true;
     }
 
-    virtual ~VirtualBoxEventListener()
+    virtual ~ConsoleEventListener()
     {
     }
 
@@ -158,6 +156,88 @@ public:
     {
         switch (aType)
         {
+            case VBoxEventType_OnMouseCapabilityChanged:
+            {
+
+                ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent;
+                Assert(!mccev.isNull());
+
+                BOOL fSupportsAbsolute = false;
+                mccev->COMGETTER(SupportsAbsolute)(&fSupportsAbsolute);
+
+                /* Emit absolute mouse event to actually enable the host mouse cursor. */
+                if (fSupportsAbsolute && gConsole)
+                {
+                    ComPtr<IMouse> mouse;
+                    gConsole->COMGETTER(Mouse)(mouse.asOutParam());
+                    if (mouse)
+                    {
+                        mouse->PutMouseEventAbsolute(-1, -1, 0, 0 /* Horizontal wheel */, 0);
+                    }
+                }
+                break;
+            }
+            case VBoxEventType_OnStateChanged:
+            {
+                ComPtr<IStateChangedEvent> scev = aEvent;
+                Assert(scev);
+
+                MachineState_T machineState;
+                scev->COMGETTER(State)(&machineState);
+
+                /* Terminate any event wait operation if the machine has been
+                 * PoweredDown/Saved/Aborted. */
+                if (machineState < MachineState_Running && !m_fIgnorePowerOffEvents)
+                {
+                    g_fTerminateFE = true;
+                    gEventQ->interruptEventQueueProcessing();
+                }
+
+                break;
+            }
+            case VBoxEventType_OnVRDEServerInfoChanged:
+            {
+                ComPtr<IVRDEServerInfoChangedEvent> rdicev = aEvent;
+                Assert(rdicev);
+
+                if (gConsole)
+                {
+                    ComPtr<IVRDEServerInfo> info;
+                    gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam());
+                    if (info)
+                    {
+                        LONG port;
+                        info->COMGETTER(Port)(&port);
+                        if (port != mLastVRDEPort)
+                        {
+                            if (port == -1)
+                                RTPrintf("VRDE server is inactive.\n");
+                            else if (port == 0)
+                                RTPrintf("VRDE server failed to start.\n");
+                            else
+                                RTPrintf("VRDE server is listening on port %d.\n", port);
+
+                            mLastVRDEPort = port;
+                        }
+                    }
+                }
+                break;
+            }
+            case VBoxEventType_OnCanShowWindow:
+            {
+                ComPtr<ICanShowWindowEvent> cswev = aEvent;
+                Assert(cswev);
+                cswev->AddVeto(NULL);
+                break;
+            }
+            case VBoxEventType_OnShowWindow:
+            {
+                ComPtr<IShowWindowEvent> swev = aEvent;
+                Assert(swev);
+                /* Ignore the event, WinId is either still zero or some other listener assigned it. */
+                NOREF(swev); /* swev->COMSETTER(WinId)(0); */
+                break;
+            }
             case VBoxEventType_OnGuestPropertyChanged:
             {
                 ComPtr<IGuestPropertyChangedEvent> pChangedEvent = aEvent;
@@ -169,16 +249,8 @@ public:
                 if (gConsole)
                 {
                     hrc = gConsole->COMGETTER(Machine)(pMachine.asOutParam());
-                    if (SUCCEEDED(hrc) && pMachine)
-                    {
-                        Bstr gpMachineId, machineId;
-                        hrc = pMachine->COMGETTER(Id)(gpMachineId.asOutParam());
-                        AssertComRC(hrc);
-                        hrc = pChangedEvent->COMGETTER(MachineId)(machineId.asOutParam());
-                        AssertComRC(hrc);
-                        if (gpMachineId != machineId)
-                            hrc = VBOX_E_OBJECT_NOT_FOUND;
-                    }
+                    if (FAILED(hrc) || !pMachine)
+                        hrc = VBOX_E_OBJECT_NOT_FOUND;
                 }
                 else
                     hrc = VBOX_E_INVALID_VM_STATE;
@@ -219,32 +291,32 @@ public:
 
                         LogRelFlow(("VRDE: hrc=%Rhrc: Host %s disconnecting clients (current host state known: %s)\n",
                                     hrc, fProcessDisconnectOnGuestLogout ? "will handle" : "does not handle",
-                                    mfNoLoggedInUsers ? "No users logged in" : "Users logged in"));
+                                    m_fNoLoggedInUsers ? "No users logged in" : "Users logged in"));
 
                         if (fProcessDisconnectOnGuestLogout)
                         {
                             bool fDropConnection = false;
-                            if (!mfNoLoggedInUsers) /* Only if the property really changes. */
+                            if (!m_fNoLoggedInUsers) /* Only if the property really changes. */
                             {
                                 if (   utf8Value == "true"
                                     /* Guest property got deleted due to reset,
                                      * so it has no value anymore. */
                                     || utf8Value.isEmpty())
                                 {
-                                    mfNoLoggedInUsers = true;
+                                    m_fNoLoggedInUsers = true;
                                     fDropConnection = true;
                                 }
                             }
                             else if (utf8Value == "false")
-                                mfNoLoggedInUsers = false;
+                                m_fNoLoggedInUsers = false;
                             /* Guest property got deleted due to reset,
-                             * take the shortcut without touching the mfNoLoggedInUsers
+                             * take the shortcut without touching the m_fNoLoggedInUsers
                              * state. */
                             else if (utf8Value.isEmpty())
                                 fDropConnection = true;
 
-                            LogRelFlow(("VRDE: szNoLoggedInUsers=%s, mfNoLoggedInUsers=%RTbool, fDropConnection=%RTbool\n",
-                                        utf8Value.c_str(), mfNoLoggedInUsers, fDropConnection));
+                            LogRelFlow(("VRDE: szNoLoggedInUsers=%s, m_fNoLoggedInUsers=%RTbool, fDropConnection=%RTbool\n",
+                                        utf8Value.c_str(), m_fNoLoggedInUsers, fDropConnection));
 
                             if (fDropConnection)
                             {
@@ -286,128 +358,6 @@ public:
             default:
                 AssertFailed();
         }
-
-        return S_OK;
-    }
-
-private:
-
-    bool mfNoLoggedInUsers;
-};
-
-/**
- *  Handler for machine events.
- */
-class ConsoleEventListener
-{
-public:
-    ConsoleEventListener() :
-        mLastVRDEPort(-1),
-        m_fIgnorePowerOffEvents(false)
-    {
-    }
-
-    virtual ~ConsoleEventListener()
-    {
-    }
-
-    HRESULT init()
-    {
-        return S_OK;
-    }
-
-    void uninit()
-    {
-    }
-
-    STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent)
-    {
-        switch (aType)
-        {
-            case VBoxEventType_OnMouseCapabilityChanged:
-            {
-
-                ComPtr<IMouseCapabilityChangedEvent> mccev = aEvent;
-                Assert(!mccev.isNull());
-
-                BOOL fSupportsAbsolute = false;
-                mccev->COMGETTER(SupportsAbsolute)(&fSupportsAbsolute);
-
-                /* Emit absolute mouse event to actually enable the host mouse cursor. */
-                if (fSupportsAbsolute && gConsole)
-                {
-                    ComPtr<IMouse> mouse;
-                    gConsole->COMGETTER(Mouse)(mouse.asOutParam());
-                    if (mouse)
-                    {
-                        mouse->PutMouseEventAbsolute(-1, -1, 0, 0 /* Horizontal wheel */, 0);
-                    }
-                }
-                break;
-            }
-            case VBoxEventType_OnStateChanged:
-            {
-                ComPtr<IStateChangedEvent> scev = aEvent;
-                Assert(scev);
-
-                MachineState_T machineState;
-                scev->COMGETTER(State)(&machineState);
-
-                /* Terminate any event wait operation if the machine has been
-                 * PoweredDown/Saved/Aborted. */
-                if (machineState < MachineState_Running && !m_fIgnorePowerOffEvents)
-                {
-                    g_fTerminateFE = true;
-                    gEventQ->interruptEventQueueProcessing();
-                }
-
-                break;
-            }
-            case VBoxEventType_OnVRDEServerInfoChanged:
-            {
-                ComPtr<IVRDEServerInfoChangedEvent> rdicev = aEvent;
-                Assert(rdicev);
-
-                if (gConsole)
-                {
-                    ComPtr<IVRDEServerInfo> info;
-                    gConsole->COMGETTER(VRDEServerInfo)(info.asOutParam());
-                    if (info)
-                    {
-                        LONG port;
-                        info->COMGETTER(Port)(&port);
-                        if (port != mLastVRDEPort)
-                        {
-                            if (port == -1)
-                                RTPrintf("VRDE server is inactive.\n");
-                            else if (port == 0)
-                                RTPrintf("VRDE server failed to start.\n");
-                            else
-                                RTPrintf("VRDE server is listening on port %d.\n", port);
-
-                            mLastVRDEPort = port;
-                        }
-                    }
-                }
-                break;
-            }
-            case VBoxEventType_OnCanShowWindow:
-            {
-                ComPtr<ICanShowWindowEvent> cswev = aEvent;
-                Assert(cswev);
-                cswev->AddVeto(NULL);
-                break;
-            }
-            case VBoxEventType_OnShowWindow:
-            {
-                ComPtr<IShowWindowEvent> swev = aEvent;
-                Assert(swev);
-                swev->COMSETTER(WinId)(0);
-                break;
-            }
-            default:
-                AssertFailed();
-        }
         return S_OK;
     }
 
@@ -420,14 +370,13 @@ private:
 
     long mLastVRDEPort;
     bool m_fIgnorePowerOffEvents;
+    bool m_fNoLoggedInUsers;
 };
 
 typedef ListenerImpl<VirtualBoxClientEventListener> VirtualBoxClientEventListenerImpl;
-typedef ListenerImpl<VirtualBoxEventListener> VirtualBoxEventListenerImpl;
 typedef ListenerImpl<ConsoleEventListener> ConsoleEventListenerImpl;
 
 VBOX_LISTENER_DECLARE(VirtualBoxClientEventListenerImpl)
-VBOX_LISTENER_DECLARE(VirtualBoxEventListenerImpl)
 VBOX_LISTENER_DECLARE(ConsoleEventListenerImpl)
 
 #ifdef VBOX_WITH_SAVESTATE_ON_SIGNAL
@@ -495,23 +444,25 @@ static void show_usage()
 {
     RTPrintf("Usage:\n"
              "   -s, -startvm, --startvm <name|uuid>   Start given VM (required argument)\n"
-             "   -v, -vrde, --vrde on|off|config       Enable (default) or disable the VRDE\n"
-             "                                         server or don't change the setting\n"
+             "   -v, -vrde, --vrde on|off|config       Enable or disable the VRDE server\n"
+             "                                           or don't change the setting (default)\n"
              "   -e, -vrdeproperty, --vrdeproperty <name=[value]> Set a VRDE property:\n"
-             "                                         \"TCP/Ports\" - comma-separated list of ports\n"
-             "                                         the VRDE server can bind to. Use a dash between\n"
-             "                                         two port numbers to specify a range\n"
-             "                                         \"TCP/Address\" - interface IP the VRDE server\n"
-             "                                         will bind to\n"
-             "   --settingspw <pw>                     Specify the settings password\n"
-             "   --settingspwfile <file>               Specify a file containing the settings password\n"
+             "                                     \"TCP/Ports\" - comma-separated list of\n"
+             "                                       ports the VRDE server can bind to; dash\n"
+             "                                       between two port numbers specifies range\n"
+             "                                     \"TCP/Address\" - interface IP the VRDE\n"
+             "                                       server will bind to\n"
+             "   --settingspw <pw>                 Specify the settings password\n"
+             "   --settingspwfile <file>           Specify a file containing the\n"
+             "                                       settings password\n"
+             "   -start-paused, --start-paused     Start the VM in paused state\n"
 #ifdef VBOX_WITH_VPX
-             "   -c, -capture, --capture               Record the VM screen output to a file\n"
-             "   -w, --width                           Frame width when recording\n"
-             "   -h, --height                          Frame height when recording\n"
-             "   -r, --bitrate                         Recording bit rate when recording\n"
-             "   -f, --filename                        File name when recording. The codec used\n"
-             "                                         will be chosen based on the file extension\n"
+             "   -c, -capture, --capture           Record the VM screen output to a file\n"
+             "   -w, --width                       Frame width when recording\n"
+             "   -h, --height                      Frame height when recording\n"
+             "   -r, --bitrate                     Recording bit rate when recording\n"
+             "   -f, --filename                    File name when recording. The codec used\n"
+             "                                       will be chosen based on file extension\n"
 #endif
              "\n");
 }
@@ -649,6 +600,7 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
     unsigned fRawR3 = ~0U;
     unsigned fPATM  = ~0U;
     unsigned fCSAM  = ~0U;
+    unsigned fPaused = 0;
 #ifdef VBOX_WITH_VPX
     bool fVideoRec = 0;
     unsigned long ulFrameWidth = 800;
@@ -680,7 +632,8 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
         OPT_NO_CSAM,
         OPT_SETTINGSPW,
         OPT_SETTINGSPW_FILE,
-        OPT_COMMENT
+        OPT_COMMENT,
+        OPT_PAUSED
     };
 
     static const RTGETOPTDEF s_aOptions[] =
@@ -724,7 +677,9 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
         { "--filename", 'f', RTGETOPT_REQ_STRING },
 #endif /* VBOX_WITH_VPX defined */
         { "-comment", OPT_COMMENT, RTGETOPT_REQ_STRING },
-        { "--comment", OPT_COMMENT, RTGETOPT_REQ_STRING }
+        { "--comment", OPT_COMMENT, RTGETOPT_REQ_STRING },
+        { "-start-paused", OPT_PAUSED, 0 },
+        { "--start-paused", OPT_PAUSED, 0 }
     };
 
     const char *pcszNameOrUUID = NULL;
@@ -790,6 +745,9 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
             case OPT_SETTINGSPW_FILE:
                 pcszSettingsPwFile = ValueUnion.psz;
                 break;
+            case OPT_PAUSED:
+                fPaused = true;
+                break;
 #ifdef VBOX_WITH_VPX
             case 'c':
                 fVideoRec = true;
@@ -952,6 +910,8 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
         Log(("VBoxHeadless: Opening a session with machine (id={%s})...\n",
               Utf8Str(id).c_str()));
 
+        // set session name
+        CHECK_ERROR_BREAK(session, COMSETTER(Name)(Bstr("headless").raw()));
         // open a session
         CHECK_ERROR_BREAK(m, LockMachine(session, LockType_VM));
         fSessionOpened = true;
@@ -976,42 +936,6 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
             CHECK_ERROR_BREAK(machine, COMSETTER(VideoCaptureEnabled)(TRUE));
         }
 #endif /* defined(VBOX_WITH_VPX) */
-        ULONG cMonitors = 1;
-        machine->COMGETTER(MonitorCount)(&cMonitors);
-
-        unsigned uScreenId;
-        for (uScreenId = 0; uScreenId < cMonitors; uScreenId++)
-        {
-            VRDPFramebuffer *pVRDPFramebuffer = new VRDPFramebuffer();
-            if (!pVRDPFramebuffer)
-            {
-                RTPrintf("Error: could not create framebuffer object %d\n", uScreenId);
-                break;
-            }
-            pVRDPFramebuffer->AddRef();
-            display->SetFramebuffer(uScreenId, pVRDPFramebuffer);
-        }
-        if (uScreenId < cMonitors)
-        {
-            break;
-        }
-
-        // fill in remaining slots with null framebuffers
-        for (uScreenId = 0; uScreenId < cMonitors; uScreenId++)
-        {
-            ComPtr<IFramebuffer> fb;
-            LONG xOrigin, yOrigin;
-            HRESULT hrc2 = display->GetFramebuffer(uScreenId,
-                                                   fb.asOutParam(),
-                                                   &xOrigin, &yOrigin);
-            if (hrc2 == S_OK && fb.isNull())
-            {
-                NullFB *pNullFB =  new NullFB();
-                pNullFB->AddRef();
-                pNullFB->init();
-                display->SetFramebuffer(uScreenId, pNullFB);
-            }
-        }
 
         /* get the machine debugger (isn't necessarily available) */
         ComPtr <IMachineDebugger> machineDebugger;
@@ -1087,11 +1011,18 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
             eventTypes.push_back(VBoxEventType_OnVRDEServerInfoChanged);
             eventTypes.push_back(VBoxEventType_OnCanShowWindow);
             eventTypes.push_back(VBoxEventType_OnShowWindow);
+            eventTypes.push_back(VBoxEventType_OnGuestPropertyChanged);
             CHECK_ERROR(es, RegisterListener(consoleListener, ComSafeArrayAsInParam(eventTypes), true));
         }
 
-        /* default is to enable the remote desktop server (backward compatibility) */
-        BOOL fVRDEEnable = true;
+        /* Default is to use the VM setting for the VRDE server. */
+        enum VRDEOption
+        {
+            VRDEOption_Config,
+            VRDEOption_Off,
+            VRDEOption_On
+        };
+        VRDEOption enmVRDEOption = VRDEOption_Config;
         BOOL fVRDEEnabled;
         ComPtr <IVRDEServer> vrdeServer;
         CHECK_ERROR_BREAK(machine, COMGETTER(VRDEServer)(vrdeServer.asOutParam()));
@@ -1099,24 +1030,23 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
 
         if (vrdeEnabled != NULL)
         {
-            /* -vrdeServer on|off|config */
+            /* -vrde on|off|config */
             if (!strcmp(vrdeEnabled, "off") || !strcmp(vrdeEnabled, "disable"))
-                fVRDEEnable = false;
-            else if (!strcmp(vrdeEnabled, "config"))
+                enmVRDEOption = VRDEOption_Off;
+            else if (!strcmp(vrdeEnabled, "on") || !strcmp(vrdeEnabled, "enable"))
+                enmVRDEOption = VRDEOption_On;
+            else if (strcmp(vrdeEnabled, "config"))
             {
-                if (!fVRDEEnabled)
-                    fVRDEEnable = false;
-            }
-            else if (strcmp(vrdeEnabled, "on") && strcmp(vrdeEnabled, "enable"))
-            {
-                RTPrintf("-vrdeServer requires an argument (on|off|config)\n");
+                RTPrintf("-vrde requires an argument (on|off|config)\n");
                 break;
             }
         }
 
-        if (fVRDEEnable)
+        Log(("VBoxHeadless: enmVRDE %d, fVRDEEnabled %d\n", enmVRDEOption, fVRDEEnabled));
+
+        if (enmVRDEOption != VRDEOption_Off)
         {
-            Log(("VBoxHeadless: Enabling VRDE server...\n"));
+            /* Set other specified options. */
 
             /* set VRDE port if requested by the user */
             if (vrdePort != NULL)
@@ -1168,13 +1098,17 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
                     break;
             }
 
+        }
+
+        if (enmVRDEOption == VRDEOption_On)
+        {
             /* enable VRDE server (only if currently disabled) */
             if (!fVRDEEnabled)
             {
                 CHECK_ERROR_BREAK(vrdeServer, COMSETTER(Enabled)(TRUE));
             }
         }
-        else
+        else if (enmVRDEOption == VRDEOption_Off)
         {
             /* disable VRDE server (only if currently enabled */
             if (fVRDEEnabled)
@@ -1189,7 +1123,10 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
         Log(("VBoxHeadless: Powering up the machine...\n"));
 
         ComPtr <IProgress> progress;
-        CHECK_ERROR_BREAK(console, PowerUp(progress.asOutParam()));
+        if (!fPaused)
+            CHECK_ERROR_BREAK(console, PowerUp(progress.asOutParam()));
+        else
+            CHECK_ERROR_BREAK(console, PowerUpPaused(progress.asOutParam()));
 
         /*
          * Wait for the result because there can be errors.
@@ -1234,26 +1171,6 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
             }
         }
 
-        /* VirtualBox events registration. */
-        {
-            ComPtr<IEventSource> es;
-            CHECK_ERROR(virtualBox, COMGETTER(EventSource)(es.asOutParam()));
-            ComObjPtr<VirtualBoxEventListenerImpl> listener;
-            listener.createObject();
-            listener->init(new VirtualBoxEventListener());
-            vboxListener = listener;
-            com::SafeArray<VBoxEventType_T> eventTypes;
-            eventTypes.push_back(VBoxEventType_OnGuestPropertyChanged);
-
-            /**
-             * @todo Set the notification pattern to "/VirtualBox/GuestInfo/OS/ *Logged*"
-             *       to not cause too much load. The current API is broken as
-             *       IMachine::GuestPropertyNotificationPatterns() would change the
-             *       filter for _all_ clients. This is not what we want!
-             */
-            CHECK_ERROR(es, RegisterListener(vboxListener, ComSafeArrayAsInParam(eventTypes), true));
-        }
-
 #ifdef VBOX_WITH_SAVESTATE_ON_SIGNAL
         signal(SIGINT, SaveState);
         signal(SIGTERM, SaveState);
@@ -1403,8 +1320,3 @@ int main(int argc, char **argv, char **envp)
     return TrustedMain(argc, argv, envp);
 }
 #endif /* !VBOX_WITH_HARDENING */
-
-#ifdef VBOX_WITH_XPCOM
-NS_DECL_CLASSINFO(NullFB)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NullFB, IFramebuffer)
-#endif
diff --git a/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.h b/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.h
deleted file mode 100644
index c9c419f..0000000
--- a/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/** @file
- *
- * VBox frontends: VRDE (headless Remote Desktop server):
- */
-
-/*
- * Copyright (C) 2006-2014 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef __H_VBOXHEADLESS
-#define __H_VBOXHEADLESS
-
-#include <VBox/com/VirtualBox.h>
-
-#include <iprt/uuid.h>
-
-#include <VBox/com/com.h>
-#include <VBox/com/string.h>
-
-#include <iprt/initterm.h>
-#include <iprt/critsect.h>
-
-#endif // __H_VBOXHEADLESS
diff --git a/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.rc b/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.rc
index e8169ae..e11eb9c 100644
--- a/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.rc
+++ b/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.rc
@@ -19,42 +19,39 @@
 #include <VBox/version.h>
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
-  FILEFLAGS        VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
-#else
-  FILEFLAGS        0 // final version
-#endif
-  FILEOS           VOS_NT_WINDOWS32
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
 #ifdef VBOXR3_HARDENED_DLL
-  FILETYPE         VFT_APP
+  FILETYPE         VBOX_RC_TYPE_APP
 #else
-  FILETYPE         VFT_DLL
+  FILETYPE         VBOX_RC_TYPE_DLL
 #endif
-  FILESUBTYPE      0   // not used
+  FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Headless Frontend\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
 #ifdef VBOXR3_HARDENED_DLL
       VALUE "InternalName",     "VBoxHeadless\0"
 #else
       VALUE "InternalName",     "VBoxHeadless\0"
 #endif
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOXR3_HARDENED_DLL
       VALUE "OriginalFilename", "VBoxHeadless.dll\0"
 #else
       VALUE "OriginalFilename", "VBoxHeadless.exe\0"
 #endif
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp b/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
index f4033f7..d0154e9 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
@@ -760,7 +760,6 @@ static int partRead(RTFILE File, PHOSTPARTITIONS pPart)
     memset(pPart->aPartitions, '\0', sizeof(pPart->aPartitions));
 
     rc = RTFileReadAt(File, 0, &aBuffer, sizeof(aBuffer), NULL);
-
     if (RT_FAILURE(rc))
         return rc;
 
@@ -776,8 +775,7 @@ static int partRead(RTFILE File, PHOSTPARTITIONS pPart)
         if (RT_SUCCESS(rc))
         {
             const char* l_ppth = (char*)partitionTableHeader;
-            rc = strncmp(l_ppth, "EFI PART", 8);
-            if (RT_FAILURE(rc))
+            if (strncmp(l_ppth, "EFI PART", 8))
                 return VERR_INVALID_PARAMETER;
 
             /** @todo check GPT Version */
@@ -812,31 +810,38 @@ static int partRead(RTFILE File, PHOSTPARTITIONS pPart)
                                                           );
 
             uint32_t currentEntry = 0;
-            while(currentEntry<partitionsNumber)
+
+            if (partitionEntrySize * partitionsNumber > 4 * _1M)
             {
-                uint8_t partitionEntry[128];
-
-                /*partition entries begin from LBA2*/
-                rc = RTFileReadAt(File, 1024 + currentEntry*partitionEntrySize, &partitionEntry, partitionEntrySize, NULL);
-
-                uint64_t start = RT_MAKE_U64_FROM_U8( partitionEntry[32],
-                                                          partitionEntry[33],
-                                                          partitionEntry[34],
-                                                          partitionEntry[35],
-                                                          partitionEntry[36],
-                                                          partitionEntry[37],
-                                                          partitionEntry[38],
-                                                          partitionEntry[39]
-                                                          );
-                uint64_t end = RT_MAKE_U64_FROM_U8( partitionEntry[40],
-                                                          partitionEntry[41],
-                                                          partitionEntry[42],
-                                                          partitionEntry[43],
-                                                          partitionEntry[44],
-                                                          partitionEntry[45],
-                                                          partitionEntry[46],
-                                                          partitionEntry[47]
-                                                          );
+                RTMsgError("The GPT header seems corrupt because it contains too many entries");
+                return VERR_INVALID_PARAMETER;
+            }
+
+            uint8_t *pbPartTable = (uint8_t *)RTMemAllocZ(RT_ALIGN_Z(partitionEntrySize * partitionsNumber, 512));
+            if (!pbPartTable)
+            {
+                RTMsgError("Allocating memory for the GPT partitions entries failed");
+                return VERR_NO_MEMORY;
+            }
+
+            /* partition entries begin from LBA2 */
+            /** @todo r=aeichner: Reading from LBA 2 is not always correct, the header will contain the starting LBA. */
+            rc = RTFileReadAt(File, 1024, pbPartTable, RT_ALIGN_Z(partitionEntrySize * partitionsNumber, 512), NULL);
+            if (RT_FAILURE(rc))
+            {
+                RTMsgError("Reading the partition table failed");
+                RTMemFree(pbPartTable);
+                return rc;
+            }
+
+            while (currentEntry < partitionsNumber)
+            {
+                uint8_t *partitionEntry = pbPartTable + currentEntry * partitionEntrySize;
+
+                uint64_t start = RT_MAKE_U64_FROM_U8(partitionEntry[32], partitionEntry[33], partitionEntry[34], partitionEntry[35],
+                                                     partitionEntry[36], partitionEntry[37], partitionEntry[38], partitionEntry[39]);
+                uint64_t end = RT_MAKE_U64_FROM_U8(partitionEntry[40], partitionEntry[41], partitionEntry[42], partitionEntry[43],
+                                                   partitionEntry[44], partitionEntry[45], partitionEntry[46], partitionEntry[47]);
 
                 PHOSTPARTITION pCP = &pPart->aPartitions[pPart->cPartitions++];
                 pCP->uIndex = currentEntry + 1;
@@ -863,6 +868,8 @@ static int partRead(RTFILE File, PHOSTPARTITIONS pPart)
 
                 ++currentEntry;
             }
+
+            RTMemFree(pbPartTable);
         }
     }
     else
@@ -2016,6 +2023,7 @@ static int CmdConvertToRaw(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBo
                 break;
             offFile += cb;
         }
+        RTMemFree(pvBuf);
         if (RT_FAILURE(vrc))
         {
             VDCloseAll(pDisk);
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManage.cpp b/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
index 533b30f..11817c2 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -300,6 +300,48 @@ static RTEXITCODE settingsPasswordFile(ComPtr<IVirtualBox> virtualBox, const cha
 
     return rcExit;
 }
+
+RTEXITCODE readPasswordFromConsole(com::Utf8Str *pPassword, const char *pszPrompt, ...)
+{
+    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
+    char aszPwdInput[_1K] = { 0 };
+    va_list vaArgs;
+
+    va_start(vaArgs, pszPrompt);
+    int vrc = RTStrmPrintfV(g_pStdOut, pszPrompt, vaArgs);
+    if (RT_SUCCESS(vrc))
+    {
+        bool fEchoOld = false;
+        vrc = RTStrmInputGetEchoChars(g_pStdIn, &fEchoOld);
+        if (RT_SUCCESS(vrc))
+        {
+            vrc = RTStrmInputSetEchoChars(g_pStdIn, false);
+            if (RT_SUCCESS(vrc))
+            {
+                vrc = RTStrmGetLine(g_pStdIn, &aszPwdInput[0], sizeof(aszPwdInput));
+                if (RT_SUCCESS(vrc))
+                    *pPassword = aszPwdInput;
+                else
+                    rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed read password from command line (%Rrc)", vrc);
+
+                int vrc2 = RTStrmInputSetEchoChars(g_pStdIn, fEchoOld);
+                AssertRC(vrc2);
+            }
+            else
+                rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to disable echoing typed characters (%Rrc)", vrc);
+        }
+        else
+            rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to retrieve echo setting (%Rrc)", vrc);
+
+        RTStrmPutStr(g_pStdOut, "\n");
+    }
+    else
+        rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to print prompt (%Rrc)", vrc);
+    va_end(vaArgs);
+
+    return rcExit;
+}
+
 #endif
 
 int main(int argc, char *argv[])
@@ -479,12 +521,19 @@ int main(int argc, char *argv[])
             { "registervm",       USAGE_REGISTERVM,        handleRegisterVM },
             { "unregistervm",     USAGE_UNREGISTERVM,      handleUnregisterVM },
             { "clonevm",          USAGE_CLONEVM,           handleCloneVM },
-            { "createhd",         USAGE_CREATEHD,          handleCreateHardDisk },
-            { "createvdi",        USAGE_CREATEHD,          handleCreateHardDisk }, /* backward compatibility */
-            { "modifyhd",         USAGE_MODIFYHD,          handleModifyHardDisk },
-            { "modifyvdi",        USAGE_MODIFYHD,          handleModifyHardDisk }, /* backward compatibility */
-            { "clonehd",          USAGE_CLONEHD,           handleCloneHardDisk },
-            { "clonevdi",         USAGE_CLONEHD,           handleCloneHardDisk }, /* backward compatibility */
+            { "mediumproperty",   USAGE_MEDIUMPROPERTY,    handleMediumProperty },
+            { "hdproperty",       USAGE_MEDIUMPROPERTY,    handleMediumProperty }, /* backward compatibility */
+            { "createmedium",     USAGE_CREATEMEDIUM,      handleCreateMedium },
+            { "createhd",         USAGE_CREATEMEDIUM,      handleCreateMedium }, /* backward compatibility */
+            { "createvdi",        USAGE_CREATEMEDIUM,      handleCreateMedium }, /* backward compatibility */
+            { "modifymedium",     USAGE_MODIFYMEDIUM,      handleModifyMedium },
+            { "modifyhd",         USAGE_MODIFYMEDIUM,      handleModifyMedium }, /* backward compatibility */
+            { "modifyvdi",        USAGE_MODIFYMEDIUM,      handleModifyMedium }, /* backward compatibility */
+            { "clonemedium",      USAGE_CLONEMEDIUM,       handleCloneMedium },
+            { "clonehd",          USAGE_CLONEMEDIUM,       handleCloneMedium }, /* backward compatibility */
+            { "clonevdi",         USAGE_CLONEMEDIUM,       handleCloneMedium }, /* backward compatibility */
+            { "encryptmedium",    USAGE_ENCRYPTMEDIUM,     handleEncryptMedium},
+            { "checkmediumpwd",   USAGE_MEDIUMENCCHKPWD,   handleCheckMediumPassword},
             { "createvm",         USAGE_CREATEVM,          handleCreateVM },
             { "modifyvm",         USAGE_MODIFYVM,          handleModifyVM },
             { "startvm",          USAGE_STARTVM,           handleStartVM },
@@ -495,8 +544,9 @@ int main(int argc, char *argv[])
             { "closemedium",      USAGE_CLOSEMEDIUM,       handleCloseMedium },
             { "storageattach",    USAGE_STORAGEATTACH,     handleStorageAttach },
             { "storagectl",       USAGE_STORAGECONTROLLER, handleStorageController },
-            { "showhdinfo",       USAGE_SHOWHDINFO,        handleShowHardDiskInfo },
-            { "showvdiinfo",      USAGE_SHOWHDINFO,        handleShowHardDiskInfo }, /* backward compatibility */
+            { "showmediuminfo",   USAGE_SHOWMEDIUMINFO,    handleShowMediumInfo },
+            { "showhdinfo",       USAGE_SHOWMEDIUMINFO,    handleShowMediumInfo }, /* backward compatibility */
+            { "showvdiinfo",      USAGE_SHOWMEDIUMINFO,    handleShowMediumInfo }, /* backward compatibility */
             { "getextradata",     USAGE_GETEXTRADATA,      handleGetExtraData },
             { "setextradata",     USAGE_SETEXTRADATA,      handleSetExtraData },
             { "setproperty",      USAGE_SETPROPERTY,       handleSetProperty },
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManage.h b/src/VBox/Frontends/VBoxManage/VBoxManage.h
index f2c23ee..4d13493 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManage.h
+++ b/src/VBox/Frontends/VBoxManage/VBoxManage.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -52,10 +52,10 @@
 #define USAGE_DISCARDSTATE          RT_BIT_64(9)
 #define USAGE_SNAPSHOT              RT_BIT_64(10)
 #define USAGE_CLOSEMEDIUM           RT_BIT_64(11)
-#define USAGE_SHOWHDINFO            RT_BIT_64(12)
-#define USAGE_CREATEHD              RT_BIT_64(13)
-#define USAGE_MODIFYHD              RT_BIT_64(14)
-#define USAGE_CLONEHD               RT_BIT_64(15)
+#define USAGE_SHOWMEDIUMINFO        RT_BIT_64(12)
+#define USAGE_CREATEMEDIUM          RT_BIT_64(13)
+#define USAGE_MODIFYMEDIUM          RT_BIT_64(14)
+#define USAGE_CLONEMEDIUM           RT_BIT_64(15)
 #define USAGE_CREATEHOSTIF          RT_BIT_64(17)
 #define USAGE_REMOVEHOSTIF          RT_BIT_64(18)
 #define USAGE_GETEXTRADATA          RT_BIT_64(19)
@@ -103,24 +103,27 @@
 #define USAGE_GUESTSTATS            RT_BIT_64(57)
 #define USAGE_REPAIRHD              RT_BIT_64(58)
 #define USAGE_NATNETWORK            RT_BIT_64(59)
+#define USAGE_MEDIUMPROPERTY        RT_BIT_64(60)
+#define USAGE_ENCRYPTMEDIUM         RT_BIT_64(61)
+#define USAGE_MEDIUMENCCHKPWD       RT_BIT_64(62)
 #define USAGE_ALL                   (~(uint64_t)0)
 /** @} */
 
 #ifdef VBOX_WITH_GUEST_CONTROL
-# define USAGE_GSTCTRL_EXEC         RT_BIT(0)
-# define USAGE_GSTCTRL_COPYFROM     RT_BIT(1)
-# define USAGE_GSTCTRL_COPYTO       RT_BIT(2)
-# define USAGE_GSTCTRL_CREATEDIR    RT_BIT(3)
-# define USAGE_GSTCTRL_REMOVEDIR    RT_BIT(4)
-# define USAGE_GSTCTRL_REMOVEFILE   RT_BIT(5)
-# define USAGE_GSTCTRL_RENAME       RT_BIT(6)
-# define USAGE_GSTCTRL_CREATETEMP   RT_BIT(7)
-# define USAGE_GSTCTRL_LIST         RT_BIT(8)
-# define USAGE_GSTCTRL_PROCESS      RT_BIT(9)
-# define USAGE_GSTCTRL_KILL         RT_BIT(10)
-# define USAGE_GSTCTRL_SESSION      RT_BIT(11)
+# define USAGE_GSTCTRL_RUN          RT_BIT(0)
+# define USAGE_GSTCTRL_START        RT_BIT(1)
+# define USAGE_GSTCTRL_COPYFROM     RT_BIT(2)
+# define USAGE_GSTCTRL_COPYTO       RT_BIT(3)
+# define USAGE_GSTCTRL_MKDIR        RT_BIT(4)
+# define USAGE_GSTCTRL_RMDIR        RT_BIT(5)
+# define USAGE_GSTCTRL_RM           RT_BIT(6)
+# define USAGE_GSTCTRL_MV           RT_BIT(7)
+# define USAGE_GSTCTRL_MKTEMP       RT_BIT(8)
+# define USAGE_GSTCTRL_LIST         RT_BIT(9)
+# define USAGE_GSTCTRL_CLOSEPROCESS RT_BIT(10)
+# define USAGE_GSTCTRL_CLOSESESSION RT_BIT(11)
 # define USAGE_GSTCTRL_STAT         RT_BIT(12)
-# define USAGE_GSTCTRL_UPDATEADDS   RT_BIT(13)
+# define USAGE_GSTCTRL_UPDATEGA     RT_BIT(13)
 # define USAGE_GSTCTRL_WATCH        RT_BIT(14)
 #endif
 
@@ -184,6 +187,7 @@ void showLogo(PRTSTREAM pStrm);
 
 #ifndef VBOX_ONLY_DOCS
 RTEXITCODE readPasswordFile(const char *pszFilename, com::Utf8Str *pPasswd);
+RTEXITCODE readPasswordFromConsole(com::Utf8Str *pPassword, const char *pszPrompt, ...);
 
 int handleInternalCommands(HandlerArg *a);
 #endif /* !VBOX_ONLY_DOCS */
@@ -223,10 +227,10 @@ HRESULT showSnapshots(ComPtr<ISnapshot> &rootSnapshot,
                       const com::Utf8Str &prefix = "",
                       int level = 0);
 int handleShowVMInfo(HandlerArg *a);
-HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
-                   ComPtr<IMachine> machine,
-                   VMINFO_DETAILS details = VMINFO_NONE,
-                   ComPtr<IConsole> console = ComPtr<IConsole>());
+HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox,
+                   ComPtr<IMachine> pMachine,
+                   ComPtr<ISession> pSession,
+                   VMINFO_DETAILS details = VMINFO_NONE);
 const char *machineStateToName(MachineState_T machineState, bool fShort);
 HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl,
                             VMINFO_DETAILS details);
@@ -256,17 +260,20 @@ HRESULT openMedium(HandlerArg *a, const char *pszFilenameOrUuid,
                    DeviceType_T enmDevType, AccessMode_T enmAccessMode,
                    ComPtr<IMedium> &pMedium, bool fForceNewUuidOnOpen,
                    bool fSilent);
-int handleCreateHardDisk(HandlerArg *a);
-int handleModifyHardDisk(HandlerArg *a);
-int handleCloneHardDisk(HandlerArg *a);
+int handleCreateMedium(HandlerArg *a);
+int handleModifyMedium(HandlerArg *a);
+int handleCloneMedium(HandlerArg *a);
+int handleMediumProperty(HandlerArg *a);
+int handleEncryptMedium(HandlerArg *a);
+int handleCheckMediumPassword(HandlerArg *a);
 RTEXITCODE handleConvertFromRaw(int argc, char *argv[]);
 HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox,
                        const ComPtr<IMedium> &pMedium,
                        const char *pszParentUUID,
                        bool fOptLong);
-int handleShowHardDiskInfo(HandlerArg *a);
+int handleShowMediumInfo(HandlerArg *a);
 int handleCloseMedium(HandlerArg *a);
-int parseDiskType(const char *psz, MediumType_T *pDiskType);
+int parseMediumType(const char *psz, MediumType_T *penmMediumType);
 int parseBool(const char *psz, bool *pb);
 
 /* VBoxManageStorageController.cpp */
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManage.rc b/src/VBox/Frontends/VBoxManage/VBoxManage.rc
index bd11cd1..910473a 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManage.rc
+++ b/src/VBox/Frontends/VBoxManage/VBoxManage.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_APP
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_APP
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Command Line Tool\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxManage\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxManage.exe\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
index 279bd44..20084c9 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
@@ -91,6 +91,8 @@ static int parseImportOptions(const char *psz, com::SafeArray<ImportOptions_T> *
                 options->push_back(ImportOptions_KeepAllMACs);
             else if (!RTStrNICmp(psz, "KeepNATMACs", len))
                 options->push_back(ImportOptions_KeepNATMACs);
+            else if (!RTStrNICmp(psz, "ImportToVDI", len))
+                options->push_back(ImportOptions_ImportToVDI);
             else
                 rc = VERR_PARSE_ERROR;
         }
@@ -337,9 +339,9 @@ int handleImportAppliance(HandlerArg *arg)
                           COMGETTER(Disks)(ComSafeArrayAsOutParam(retDisks)));
         if (retDisks.size() > 0)
         {
-            RTPrintf("Disks:");
+            RTPrintf("Disks:\n");
             for (unsigned i = 0; i < retDisks.size(); i++)
-                RTPrintf("  %ls", retDisks[i]);
+                RTPrintf("  %ls\n", retDisks[i]);
             RTPrintf("\n");
         }
 
@@ -633,23 +635,39 @@ int handleImportAppliance(HandlerArg *arg)
                             else
                             {
                                 Utf8StrFmt strTypeArg("disk%u", a);
+                                RTCList<ImportOptions_T> optionsList = options.toList();
+
+                                bstrFinalValue = aVBoxValues[a];
+
                                 if (findArgValue(strOverride, pmapArgs, strTypeArg))
                                 {
-                                    RTUUID uuid;
-                                    /* Check if this is a uuid. If so, don't touch. */
-                                    int vrc = RTUuidFromStr(&uuid, strOverride.c_str());
-                                    if (vrc != VINF_SUCCESS)
+                                    if (!optionsList.contains(ImportOptions_ImportToVDI))
                                     {
-                                        /* Make the path absolute. */
-                                        if (!RTPathStartsWithRoot(strOverride.c_str()))
+                                        RTUUID uuid;
+                                        /* Check if this is a uuid. If so, don't touch. */
+                                        int vrc = RTUuidFromStr(&uuid, strOverride.c_str());
+                                        if (vrc != VINF_SUCCESS)
                                         {
-                                            char pszPwd[RTPATH_MAX];
-                                            vrc = RTPathGetCurrent(pszPwd, RTPATH_MAX);
-                                            if (RT_SUCCESS(vrc))
-                                                strOverride = Utf8Str(pszPwd).append(RTPATH_SLASH).append(strOverride);
+                                            /* Make the path absolute. */
+                                            if (!RTPathStartsWithRoot(strOverride.c_str()))
+                                            {
+                                                char pszPwd[RTPATH_MAX];
+                                                vrc = RTPathGetCurrent(pszPwd, RTPATH_MAX);
+                                                if (RT_SUCCESS(vrc))
+                                                    strOverride = Utf8Str(pszPwd).append(RTPATH_SLASH).append(strOverride);
+                                            }
                                         }
+                                        bstrFinalValue = strOverride;
                                     }
-                                    bstrFinalValue = strOverride;
+                                    else
+                                    {
+                                        //print some error about incompatible command-line arguments
+                                        return errorSyntax(USAGE_IMPORTAPPLIANCE,
+                                                           "Option --ImportToVDI shall not be used together with "
+                                                           "manually set target path.");
+
+                                    }
+
                                     RTPrintf("%2u: Hard disk image: source image=%ls, target path=%ls, %ls\n",
                                             a,
                                             aOvfValues[a],
@@ -676,14 +694,93 @@ int handleImportAppliance(HandlerArg *arg)
                                 }
 #endif
                                 else
+                                {
+                                    strOverride = aVBoxValues[a];
+
+                                    /*
+                                     * Current solution isn't optimal.
+                                     * Better way is to provide API call for function
+                                     * Appliance::i_findMediumFormatFromDiskImage()
+                                     * and creating one new function which returns
+                                     * struct ovf::DiskImage for currently processed disk.
+                                    */
+
+                                    /*
+                                     * if user wants to convert all imported disks to VDI format
+                                     * we need to replace files extensions to "vdi"
+                                     * except CD/DVD disks
+                                     */
+                                    if (optionsList.contains(ImportOptions_ImportToVDI))
+                                    {
+                                        ComPtr<IVirtualBox> pVirtualBox = arg->virtualBox;
+                                        ComPtr<ISystemProperties> systemProperties;
+                                        com::SafeIfaceArray<IMediumFormat> mediumFormats;
+                                        Bstr bstrFormatName;
+
+                                        CHECK_ERROR(pVirtualBox,
+                                                     COMGETTER(SystemProperties)(systemProperties.asOutParam()));
+
+                                        CHECK_ERROR(systemProperties,
+                                             COMGETTER(MediumFormats)(ComSafeArrayAsOutParam(mediumFormats)));
+
+                                        /* go through all supported media formats and store files extensions only for RAW */
+                                        com::SafeArray<BSTR> extensions;
+
+                                        for (unsigned j = 0; j < mediumFormats.size(); ++j)
+                                        {
+                                            com::SafeArray<DeviceType_T> deviceType;
+                                            ComPtr<IMediumFormat> mediumFormat = mediumFormats[j];
+                                            CHECK_ERROR(mediumFormat, COMGETTER(Name)(bstrFormatName.asOutParam()));
+                                            Utf8Str strFormatName = Utf8Str(bstrFormatName);
+
+                                            if (strFormatName.compare("RAW", Utf8Str::CaseInsensitive) == 0)
+                                            {
+                                                /* getting files extensions for "RAW" format */
+                                                CHECK_ERROR(mediumFormat,
+                                                            DescribeFileExtensions(ComSafeArrayAsOutParam(extensions),
+                                                                                   ComSafeArrayAsOutParam(deviceType)));
+                                                break;
+                                            }
+                                        }
+
+                                        /* go through files extensions for RAW format and compare them with
+                                         * extension of current file
+                                         */
+                                        bool fReplace = true;
+
+                                        const char *pszExtension = RTPathSuffix(strOverride.c_str());
+                                        if (pszExtension)
+                                            pszExtension++;
+
+                                        for (unsigned j = 0; j < extensions.size(); ++j)
+                                        {
+                                            Bstr bstrExt(extensions[j]);
+                                            Utf8Str strExtension(bstrExt);
+                                            if(strExtension.compare(pszExtension, Utf8Str::CaseInsensitive) == 0)
+                                            {
+                                                fReplace = false;
+                                                break;
+                                            }
+                                        }
+
+                                        if (fReplace)
+                                        {
+                                            strOverride = strOverride.stripSuffix();
+                                            strOverride = strOverride.append(".").append("vdi");
+                                        }
+                                    }
+
+                                    bstrFinalValue = strOverride;
+
                                     RTPrintf("%2u: Hard disk image: source image=%ls, target path=%ls, %ls"
                                             "\n    (change target path with \"--vsys %u --unit %u --disk path\";"
                                             "\n    disable with \"--vsys %u --unit %u --ignore\")\n",
                                             a,
                                             aOvfValues[a],
-                                            aVBoxValues[a],
+                                            bstrFinalValue.raw(),
                                             aExtraConfigValues[a],
                                             i, a, i, a);
+                                }
                             }
                         break;
 
@@ -1104,6 +1201,36 @@ int handleExportAppliance(HandlerArg *a)
         if (FAILED(rc))
             break;
 
+        /* Query required passwords and supply them to the appliance. */
+        com::SafeArray<BSTR> aIdentifiers;
+
+        CHECK_ERROR_BREAK(pAppliance, GetPasswordIds(ComSafeArrayAsOutParam(aIdentifiers)));
+
+        if (aIdentifiers.size() > 0)
+        {
+            com::SafeArray<BSTR> aPasswords(aIdentifiers.size());
+            RTPrintf("Enter the passwords for the following identifiers to export the apppliance:\n");
+            for (unsigned idxId = 0; idxId < aIdentifiers.size(); idxId++)
+            {
+                com::Utf8Str strPassword;
+                Bstr bstrPassword;
+                Bstr bstrId = aIdentifiers[idxId];
+
+                RTEXITCODE rcExit = readPasswordFromConsole(&strPassword, "Password ID %s:", Utf8Str(bstrId).c_str());
+                if (rcExit == RTEXITCODE_FAILURE)
+                {
+                    RTStrFree(pszAbsFilePath);
+                    return rcExit;
+                }
+
+                bstrPassword = strPassword;
+                bstrPassword.detachTo(&aPasswords[idxId]);
+            }
+
+            CHECK_ERROR_BREAK(pAppliance, AddPasswords(ComSafeArrayAsInParam(aIdentifiers),
+                                                       ComSafeArrayAsInParam(aPasswords)));
+        }
+
         if (fManifest)
             options.push_back(ExportOptions_CreateManifest);
 
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
index 2765372..80ab0fa 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageBandwidthControl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -288,7 +288,6 @@ static RTEXITCODE handleBandwidthControlList(HandlerArg *pArgs, ComPtr<IBandwidt
         }
     }
 
-    /* See showVMInfo. */
     if (FAILED(showBandwidthGroups(rptrBWControl, enmDetails)))
         return RTEXITCODE_FAILURE;
 
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
index eb7e4b8..5833729 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -196,20 +196,20 @@ int handleControlVM(HandlerArg *a)
         {
             if (a->argc <= 1 + 1)
             {
-                errorArgument("Missing argument to '%s'. Expected drag'n'drop mode.", a->argv[1]);
+                errorArgument("Missing argument to '%s'. Expected drag and drop mode.", a->argv[1]);
                 rc = E_FAIL;
                 break;
             }
 
-            DragAndDropMode_T mode;
+            DnDMode_T mode;
             if (!strcmp(a->argv[2], "disabled"))
-                mode = DragAndDropMode_Disabled;
+                mode = DnDMode_Disabled;
             else if (!strcmp(a->argv[2], "hosttoguest"))
-                mode = DragAndDropMode_HostToGuest;
+                mode = DnDMode_HostToGuest;
             else if (!strcmp(a->argv[2], "guesttohost"))
-                mode = DragAndDropMode_GuestToHost;
+                mode = DnDMode_GuestToHost;
             else if (!strcmp(a->argv[2], "bidirectional"))
-                mode = DragAndDropMode_Bidirectional;
+                mode = DnDMode_Bidirectional;
             else
             {
                 errorArgument("Invalid '%s' argument '%s'.", a->argv[1], a->argv[2]);
@@ -217,7 +217,7 @@ int handleControlVM(HandlerArg *a)
             }
             if (SUCCEEDED(rc))
             {
-                CHECK_ERROR_BREAK(sessionMachine, COMSETTER(DragAndDropMode)(mode));
+                CHECK_ERROR_BREAK(sessionMachine, COMSETTER(DnDMode)(mode));
                 if (SUCCEEDED(rc))
                     fNeedsSaving = true;
             }
@@ -261,7 +261,7 @@ int handleControlVM(HandlerArg *a)
             }
 
             ComPtr<IProgress> progress;
-            CHECK_ERROR(console, SaveState(progress.asOutParam()));
+            CHECK_ERROR(sessionMachine, SaveState(progress.asOutParam()));
             if (FAILED(rc))
             {
                 if (!fPaused)
@@ -351,7 +351,6 @@ int handleControlVM(HandlerArg *a)
         {
             /* Get the number of network adapters */
             ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
-
             unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC");
             if (!n)
             {
@@ -439,7 +438,6 @@ int handleControlVM(HandlerArg *a)
         {
             /* Get the number of network adapters */
             ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
-
             unsigned n = parseNum(&a->argv[1][8], NetworkAdapterCount, "NIC");
             if (!n)
             {
@@ -488,7 +486,6 @@ int handleControlVM(HandlerArg *a)
         {
             /* Get the number of network adapters */
             ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
-            ComPtr<INATEngine> engine;
             unsigned n = parseNum(&a->argv[1][5], NetworkAdapterCount, "NIC");
             if (!n)
             {
@@ -510,6 +507,7 @@ int handleControlVM(HandlerArg *a)
                 rc = E_FAIL;
                 break;
             }
+            ComPtr<INATEngine> engine;
             CHECK_ERROR(adapter, COMGETTER(NATEngine)(engine.asOutParam()));
             if (!engine)
             {
@@ -580,7 +578,7 @@ int handleControlVM(HandlerArg *a)
         else if (!strncmp(a->argv[1], "nicproperty", 11))
         {
             /* Get the number of network adapters */
-            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox,sessionMachine) ;
+            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
             unsigned n = parseNum(&a->argv[1][11], NetworkAdapterCount, "NIC");
             if (!n)
             {
@@ -640,7 +638,7 @@ int handleControlVM(HandlerArg *a)
         else if (!strncmp(a->argv[1], "nicpromisc", 10))
         {
             /* Get the number of network adapters */
-            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox,sessionMachine) ;
+            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
             unsigned n = parseNum(&a->argv[1][10], NetworkAdapterCount, "NIC");
             if (!n)
             {
@@ -689,7 +687,7 @@ int handleControlVM(HandlerArg *a)
         else if (!strncmp(a->argv[1], "nic", 3))
         {
             /* Get the number of network adapters */
-            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox,sessionMachine) ;
+            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
             unsigned n = parseNum(&a->argv[1][3], NetworkAdapterCount, "NIC");
             if (!n)
             {
@@ -957,10 +955,29 @@ int handleControlVM(HandlerArg *a)
                 rc = E_FAIL;
                 break;
             }
+            else if (a->argc == 4 || a->argc > 5)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Wrong number of arguments");
+                rc = E_FAIL;
+                break;
+            }
 
             bool attach = !strcmp(a->argv[1], "usbattach");
 
             Bstr usbId = a->argv[2];
+            Bstr captureFilename;
+
+            if (a->argc == 5)
+            {
+                if (!strcmp(a->argv[3], "--capturefile"))
+                    captureFilename = a->argv[4];
+                else
+                {
+                    errorArgument("Invalid parameter '%s'", a->argv[3]);
+                    rc = E_FAIL;
+                    break;
+                }
+            }
 
             Guid guid(usbId);
             if (!guid.isValid())
@@ -995,7 +1012,7 @@ int handleControlVM(HandlerArg *a)
             }
 
             if (attach)
-                CHECK_ERROR_BREAK(console, AttachUSBDevice(usbId.raw()));
+                CHECK_ERROR_BREAK(console, AttachUSBDevice(usbId.raw(), captureFilename.raw()));
             else
             {
                 ComPtr<IUSBDevice> dev;
@@ -1356,30 +1373,37 @@ int handleControlVM(HandlerArg *a)
             }
             ULONG width, height, bpp;
             LONG xOrigin, yOrigin;
-            CHECK_ERROR_BREAK(pDisplay, GetScreenResolution(iScreen, &width, &height, &bpp, &xOrigin, &yOrigin));
+            GuestMonitorStatus_T monitorStatus;
+            CHECK_ERROR_BREAK(pDisplay, GetScreenResolution(iScreen, &width, &height, &bpp, &xOrigin, &yOrigin, &monitorStatus));
             com::SafeArray<BYTE> saScreenshot;
-            CHECK_ERROR_BREAK(pDisplay, TakeScreenShotPNGToArray(iScreen, width, height, ComSafeArrayAsOutParam(saScreenshot)));
+            CHECK_ERROR_BREAK(pDisplay, TakeScreenShotToArray(iScreen, width, height, BitmapFormat_PNG, ComSafeArrayAsOutParam(saScreenshot)));
             RTFILE pngFile = NIL_RTFILE;
             vrc = RTFileOpen(&pngFile, a->argv[2], RTFILE_O_OPEN_CREATE | RTFILE_O_WRITE | RTFILE_O_TRUNCATE | RTFILE_O_DENY_ALL);
             if (RT_FAILURE(vrc))
             {
-                RTMsgError("Failed to create file '%s'. rc=%Rrc", a->argv[2], vrc);
+                RTMsgError("Failed to create file '%s' (%Rrc)", a->argv[2], vrc);
                 rc = E_FAIL;
                 break;
             }
             vrc = RTFileWrite(pngFile, saScreenshot.raw(), saScreenshot.size(), NULL);
             if (RT_FAILURE(vrc))
             {
-                RTMsgError("Failed to write screenshot to file '%s'. rc=%Rrc", a->argv[2], vrc);
+                RTMsgError("Failed to write screenshot to file '%s' (%Rrc)", a->argv[2], vrc);
                 rc = E_FAIL;
             }
             RTFileClose(pngFile);
         }
-        else if (   !strcmp(a->argv[1], "vcpenabled"))
+#ifdef VBOX_WITH_VPX
+        /* 
+         * Note: Commands starting with "vcp" are the deprecated versions and are 
+         *       kept to ensure backwards compatibility. 
+         */
+        else if (   !strcmp(a->argv[1], "videocap")
+                 || !strcmp(a->argv[1], "vcpenabled"))
         {
             if (a->argc != 3)
             {
-                errorArgument("Missing argument to '%s'", a->argv[1]);
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
                 rc = E_FAIL;
                 break;
             }
@@ -1398,7 +1422,8 @@ int handleControlVM(HandlerArg *a)
                 break;
             }
         }
-        else if (   !strcmp(a->argv[1], "videocapturescreens"))
+        else if (   !strcmp(a->argv[1], "videocapscreens")
+                 || !strcmp(a->argv[1], "vcpscreens"))
         {
             ULONG cMonitors = 64;
             CHECK_ERROR_BREAK(machine, COMGETTER(MonitorCount)(&cMonitors));
@@ -1416,6 +1441,8 @@ int handleControlVM(HandlerArg *a)
                 /* disable all screens */
                 for (unsigned i = 0; i < cMonitors; i++)
                     saScreens[i] = false;
+
+                /** @todo r=andy What if this is specified? */
             }
             else
             {
@@ -1444,6 +1471,163 @@ int handleControlVM(HandlerArg *a)
 
             CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureScreens)(ComSafeArrayAsInParam(saScreens)));
         }
+        else if (   !strcmp(a->argv[1], "videocapfile")
+                 || !strcmp(a->argv[1], "vcpfile"))
+        {
+            if (a->argc != 3)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                rc = E_FAIL;
+                break;
+            }
+
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureFile)(Bstr(a->argv[3]).raw()));
+        }
+        else if (!strcmp(a->argv[1], "videocapres"))
+        {
+            if (a->argc != 4)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                rc = E_FAIL;
+                break;
+            }
+
+            uint32_t uVal;
+            int vrc = RTStrToUInt32Ex(a->argv[2], NULL, 0, &uVal);
+            if (RT_FAILURE(vrc))
+            {
+                errorArgument("Error parsing width '%s'", a->argv[2]);
+                rc = E_FAIL;
+                break;
+            }
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureWidth)(uVal));
+
+            vrc = RTStrToUInt32Ex(a->argv[3], NULL, 0, &uVal);
+            if (RT_FAILURE(vrc))
+            {
+                errorArgument("Error parsing height '%s'", a->argv[3]);
+                rc = E_FAIL;
+                break;
+            }
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureHeight)(uVal));
+        }
+        else if (!strcmp(a->argv[1], "vcpwidth")) /* Deprecated; keeping for compatibility. */
+        {
+            uint32_t uVal;
+            int vrc = RTStrToUInt32Ex(a->argv[2], NULL, 0, &uVal);
+            if (RT_FAILURE(vrc))
+            {
+                errorArgument("Error parsing width '%s'", a->argv[2]);
+                rc = E_FAIL;
+                break;
+            }
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureWidth)(uVal));
+        }
+        else if (!strcmp(a->argv[1], "vcpheight")) /* Deprecated; keeping for compatibility. */
+        {
+            uint32_t uVal;
+            int vrc = RTStrToUInt32Ex(a->argv[2], NULL, 0, &uVal);
+            if (RT_FAILURE(vrc))
+            {
+                errorArgument("Error parsing height '%s'", a->argv[2]);
+                rc = E_FAIL;
+                break;
+            }
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureHeight)(uVal));
+        }
+        else if (   !strcmp(a->argv[1], "videocaprate")
+                 || !strcmp(a->argv[1], "vcprate"))
+        {
+            if (a->argc != 3)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                rc = E_FAIL;
+                break;
+            }
+
+            uint32_t uVal;
+            int vrc = RTStrToUInt32Ex(a->argv[2], NULL, 0, &uVal);
+            if (RT_FAILURE(vrc))
+            {
+                errorArgument("Error parsing rate '%s'", a->argv[2]);
+                rc = E_FAIL;
+                break;
+            }
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureRate)(uVal));
+        }
+        else if (   !strcmp(a->argv[1], "videocapfps")
+                 || !strcmp(a->argv[1], "vcpfps"))
+        {
+            if (a->argc != 3)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                rc = E_FAIL;
+                break;
+            }   
+
+            uint32_t uVal;
+            int vrc = RTStrToUInt32Ex(a->argv[2], NULL, 0, &uVal);
+            if (RT_FAILURE(vrc))
+            {
+                errorArgument("Error parsing FPS '%s'", a->argv[2]);
+                rc = E_FAIL;
+                break;
+            }
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureFPS)(uVal));
+        }
+        else if (   !strcmp(a->argv[1], "videocapmaxtime")
+                 || !strcmp(a->argv[1], "vcpmaxtime"))
+        {
+            if (a->argc != 3)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                rc = E_FAIL;
+                break;
+            } 
+
+            uint32_t uVal;
+            int vrc = RTStrToUInt32Ex(a->argv[2], NULL, 0, &uVal);
+            if (RT_FAILURE(vrc))
+            {
+                errorArgument("Error parsing maximum time '%s'", a->argv[2]);
+                rc = E_FAIL;
+                break;
+            }
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureMaxTime)(uVal));
+        }
+        else if (   !strcmp(a->argv[1], "videocapmaxsize")
+                 || !strcmp(a->argv[1], "vcpmaxsize"))
+        {
+            if (a->argc != 3)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                rc = E_FAIL;
+                break;
+            }   
+
+            uint32_t uVal;
+            int vrc = RTStrToUInt32Ex(a->argv[2], NULL, 0, &uVal);
+            if (RT_FAILURE(vrc))
+            {
+                errorArgument("Error parsing maximum file size '%s'", a->argv[2]);
+                rc = E_FAIL;
+                break;
+            }
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureMaxFileSize)(uVal));
+        }
+        else if (   !strcmp(a->argv[1], "videocapopts")
+                 || !strcmp(a->argv[1], "vcpoptions"))
+        {
+            if (a->argc != 3)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                rc = E_FAIL;
+                break;
+            }   
+
+            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureOptions)(Bstr(a->argv[3]).raw()));
+        }
+#endif /* VBOX_WITH_VPX */
         else if (!strcmp(a->argv[1], "webcam"))
         {
             if (a->argc < 3)
@@ -1494,7 +1678,46 @@ int handleControlVM(HandlerArg *a)
                 rc = E_FAIL;
                 break;
             }
+        }
+        else if (!strcmp(a->argv[1], "addencpassword"))
+        {
+            if (   a->argc != 4
+                && a->argc != 6)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                break;
+            }
+
+            if (   strcmp(a->argv[4], "--removeonsuspend")
+                || (   strcmp(a->argv[5], "yes")
+                    && strcmp(a->argv[5], "no")))
+            {
+                errorSyntax(USAGE_CONTROLVM, "Invalid parameters");
+                break;
+            }
+
+            BOOL fRemoveOnSuspend = FALSE;
+            Bstr bstrPwId(a->argv[2]);
+            Bstr bstrPw(a->argv[3]);
+            if (   a->argc == 6
+                && !strcmp(a->argv[5], "yes"))
+                fRemoveOnSuspend = TRUE;
 
+            CHECK_ERROR_BREAK(console, AddDiskEncryptionPassword(bstrPwId.raw(), bstrPw.raw(), fRemoveOnSuspend));
+        }
+        else if (!strcmp(a->argv[1], "removeencpassword"))
+        {
+            if (a->argc != 3)
+            {
+                errorSyntax(USAGE_CONTROLVM, "Incorrect number of parameters");
+                break;
+            }
+            Bstr bstrPwId(a->argv[2]);
+            CHECK_ERROR_BREAK(console, RemoveDiskEncryptionPassword(bstrPwId.raw()));
+        }
+        else if (!strcmp(a->argv[1], "removeallencpasswords"))
+        {
+            CHECK_ERROR_BREAK(console, ClearAllDiskEncryptionPasswords());
         }
         else
         {
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
index 86cffce..c74db1e 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
@@ -167,11 +167,17 @@ static RTEXITCODE handleDebugVM_LogXXXX(HandlerArg *pArgs, IMachineDebugger *pDe
     RTGETOPTSTATE               GetState;
     RTGETOPTUNION               ValueUnion;
 
-    /** @todo Put short options into enum / defines! */
+    /*
+     * NB: don't use short options to prevent log specifications like
+     * "-drv_foo" from being interpreted as options.
+     */
+#   define DEBUGVM_LOG_DEBUG       (VINF_GETOPT_NOT_OPTION + 'd')
+#   define DEBUGVM_LOG_RELEASE     (VINF_GETOPT_NOT_OPTION + 'r')
+
     static const RTGETOPTDEF    s_aOptions[] =
     {
-        { "--debug",        'd', RTGETOPT_REQ_NOTHING },
-        { "--release",      'r', RTGETOPT_REQ_NOTHING }
+        { "--debug",        DEBUGVM_LOG_DEBUG,   RTGETOPT_REQ_NOTHING },
+        { "--release",      DEBUGVM_LOG_RELEASE, RTGETOPT_REQ_NOTHING }
     };
     int rc = RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 2, RTGETOPTINIT_FLAGS_OPTS_FIRST);
     AssertRCReturn(rc, RTEXITCODE_FAILURE);
@@ -180,11 +186,11 @@ static RTEXITCODE handleDebugVM_LogXXXX(HandlerArg *pArgs, IMachineDebugger *pDe
     {
         switch (rc)
         {
-            case 'r':
+            case DEBUGVM_LOG_RELEASE:
                 fRelease = true;
                 break;
 
-            case 'd':
+            case DEBUGVM_LOG_DEBUG:
                 fRelease = false;
                 break;
 
@@ -297,6 +303,10 @@ static RTEXITCODE handleDebugVM_OSDetect(HandlerArg *a, IMachineDebugger *pDebug
     if (a->argc != 2)
         return errorSyntax(USAGE_DEBUGVM, "The osdetect sub-command does not take any arguments");
 
+    com::Bstr bstrIgnore;
+    com::Bstr bstrAll("all");
+    CHECK_ERROR2_RET(pDebugger, LoadPlugIn(bstrAll.raw(), bstrIgnore.asOutParam()), RTEXITCODE_FAILURE);
+
     com::Bstr bstrName;
     CHECK_ERROR2_RET(pDebugger, DetectOS(bstrName.asOutParam()), RTEXITCODE_FAILURE);
     RTPrintf("Detected: %ls\n", bstrName.raw());
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
index d6b1f20..d189857 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp
@@ -1,10 +1,10 @@
 /* $Id: VBoxManageDisk.cpp $ */
 /** @file
- * VBoxManage - The disk related commands.
+ * VBoxManage - The disk/medium related commands.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -51,11 +51,10 @@ static DECLCALLBACK(void) handleVDError(void *pvUser, int rc, RT_SRC_POS_DECL, c
     RTMsgError("Error code %Rrc at %s(%u) in function %s", rc, RT_SRC_POS_ARGS);
 }
 
-
-static int parseDiskVariant(const char *psz, MediumVariant_T *pDiskVariant)
+static int parseMediumVariant(const char *psz, MediumVariant_T *pMediumVariant)
 {
     int rc = VINF_SUCCESS;
-    unsigned DiskVariant = (unsigned)(*pDiskVariant);
+    unsigned uMediumVariant = (unsigned)(*pMediumVariant);
     while (psz && *psz && RT_SUCCESS(rc))
     {
         size_t len;
@@ -69,19 +68,19 @@ static int parseDiskVariant(const char *psz, MediumVariant_T *pDiskVariant)
             // Parsing is intentionally inconsistent: "standard" resets the
             // variant, whereas the other flags are cumulative.
             if (!RTStrNICmp(psz, "standard", len))
-                DiskVariant = MediumVariant_Standard;
+                uMediumVariant = MediumVariant_Standard;
             else if (   !RTStrNICmp(psz, "fixed", len)
                      || !RTStrNICmp(psz, "static", len))
-                DiskVariant |= MediumVariant_Fixed;
+                uMediumVariant |= MediumVariant_Fixed;
             else if (!RTStrNICmp(psz, "Diff", len))
-                DiskVariant |= MediumVariant_Diff;
+                uMediumVariant |= MediumVariant_Diff;
             else if (!RTStrNICmp(psz, "split2g", len))
-                DiskVariant |= MediumVariant_VmdkSplit2G;
+                uMediumVariant |= MediumVariant_VmdkSplit2G;
             else if (   !RTStrNICmp(psz, "stream", len)
                      || !RTStrNICmp(psz, "streamoptimized", len))
-                DiskVariant |= MediumVariant_VmdkStreamOptimized;
+                uMediumVariant |= MediumVariant_VmdkStreamOptimized;
             else if (!RTStrNICmp(psz, "esx", len))
-                DiskVariant |= MediumVariant_VmdkESX;
+                uMediumVariant |= MediumVariant_VmdkESX;
             else
                 rc = VERR_PARSE_ERROR;
         }
@@ -92,31 +91,31 @@ static int parseDiskVariant(const char *psz, MediumVariant_T *pDiskVariant)
     }
 
     if (RT_SUCCESS(rc))
-        *pDiskVariant = (MediumVariant_T)DiskVariant;
+        *pMediumVariant = (MediumVariant_T)uMediumVariant;
     return rc;
 }
 
-int parseDiskType(const char *psz, MediumType_T *pDiskType)
+int parseMediumType(const char *psz, MediumType_T *penmMediumType)
 {
     int rc = VINF_SUCCESS;
-    MediumType_T DiskType = MediumType_Normal;
+    MediumType_T enmMediumType = MediumType_Normal;
     if (!RTStrICmp(psz, "normal"))
-        DiskType = MediumType_Normal;
+        enmMediumType = MediumType_Normal;
     else if (!RTStrICmp(psz, "immutable"))
-        DiskType = MediumType_Immutable;
+        enmMediumType = MediumType_Immutable;
     else if (!RTStrICmp(psz, "writethrough"))
-        DiskType = MediumType_Writethrough;
+        enmMediumType = MediumType_Writethrough;
     else if (!RTStrICmp(psz, "shareable"))
-        DiskType = MediumType_Shareable;
+        enmMediumType = MediumType_Shareable;
     else if (!RTStrICmp(psz, "readonly"))
-        DiskType = MediumType_Readonly;
+        enmMediumType = MediumType_Readonly;
     else if (!RTStrICmp(psz, "multiattach"))
-        DiskType = MediumType_MultiAttach;
+        enmMediumType = MediumType_MultiAttach;
     else
         rc = VERR_PARSE_ERROR;
 
     if (RT_SUCCESS(rc))
-        *pDiskType = DiskType;
+        *penmMediumType = enmMediumType;
     return rc;
 }
 
@@ -186,8 +185,9 @@ HRESULT openMedium(HandlerArg *a, const char *pszFilenameOrUuid,
     return rc;
 }
 
-static HRESULT createHardDisk(HandlerArg *a, const char *pszFormat,
-                              const char *pszFilename, ComPtr<IMedium> &pMedium)
+static HRESULT createMedium(HandlerArg *a, const char *pszFormat,
+                            const char *pszFilename, DeviceType_T enmDevType,
+                            AccessMode_T enmAccessMode, ComPtr<IMedium> &pMedium)
 {
     HRESULT rc;
     char szFilenameAbs[RTPATH_MAX] = "";
@@ -204,14 +204,19 @@ static HRESULT createHardDisk(HandlerArg *a, const char *pszFormat,
         pszFilename = szFilenameAbs;
     }
 
-    CHECK_ERROR(a->virtualBox, CreateHardDisk(Bstr(pszFormat).raw(),
-                                              Bstr(pszFilename).raw(),
-                                              pMedium.asOutParam()));
+    CHECK_ERROR(a->virtualBox, CreateMedium(Bstr(pszFormat).raw(),
+                                            Bstr(pszFilename).raw(),
+                                            enmAccessMode,
+                                            enmDevType,
+                                            pMedium.asOutParam()));
     return rc;
 }
 
-static const RTGETOPTDEF g_aCreateHardDiskOptions[] =
+static const RTGETOPTDEF g_aCreateMediumOptions[] =
 {
+    { "disk",           'H', RTGETOPT_REQ_NOTHING },
+    { "dvd",            'D', RTGETOPT_REQ_NOTHING },
+    { "floppy",         'L', RTGETOPT_REQ_NOTHING },
     { "--filename",     'f', RTGETOPT_REQ_STRING },
     { "-filename",      'f', RTGETOPT_REQ_STRING },     // deprecated
     { "--diffparent",   'd', RTGETOPT_REQ_STRING },
@@ -226,27 +231,51 @@ static const RTGETOPTDEF g_aCreateHardDiskOptions[] =
     { "-variant",       'm', RTGETOPT_REQ_STRING },     // deprecated
 };
 
-int handleCreateHardDisk(HandlerArg *a)
+int handleCreateMedium(HandlerArg *a)
 {
     HRESULT rc;
     int vrc;
     const char *filename = NULL;
     const char *diffparent = NULL;
     uint64_t size = 0;
+    enum {
+        CMD_NONE,
+        CMD_DISK,
+        CMD_DVD,
+        CMD_FLOPPY
+    } cmd = CMD_NONE;
     const char *format = NULL;
     bool fBase = true;
-    MediumVariant_T DiskVariant = MediumVariant_Standard;
+    MediumVariant_T enmMediumVariant = MediumVariant_Standard;
 
     int c;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
     // start at 0 because main() has hacked both the argc and argv given to us
-    RTGetOptInit(&GetState, a->argc, a->argv, g_aCreateHardDiskOptions, RT_ELEMENTS(g_aCreateHardDiskOptions),
+    RTGetOptInit(&GetState, a->argc, a->argv, g_aCreateMediumOptions, RT_ELEMENTS(g_aCreateMediumOptions),
                  0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
     while ((c = RTGetOpt(&GetState, &ValueUnion)))
     {
         switch (c)
         {
+            case 'H':   // disk
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_CREATEMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_DISK;
+                break;
+
+            case 'D':   // DVD
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_CREATEMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_DVD;
+                break;
+
+            case 'L':   // floppy
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_CREATEMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_FLOPPY;
+                break;
+
             case 'f':   // --filename
                 filename = ValueUnion.psz;
                 break;
@@ -270,59 +299,73 @@ int handleCreateHardDisk(HandlerArg *a)
 
             case 'F':   // --static ("fixed"/"flat")
             {
-                unsigned uDiskVariant = (unsigned)DiskVariant;
-                uDiskVariant |= MediumVariant_Fixed;
-                DiskVariant = (MediumVariant_T)uDiskVariant;
+                unsigned uMediumVariant = (unsigned)enmMediumVariant;
+                uMediumVariant |= MediumVariant_Fixed;
+                enmMediumVariant = (MediumVariant_T)uMediumVariant;
                 break;
             }
 
             case 'm':   // --variant
-                vrc = parseDiskVariant(ValueUnion.psz, &DiskVariant);
+                vrc = parseMediumVariant(ValueUnion.psz, &enmMediumVariant);
                 if (RT_FAILURE(vrc))
-                    return errorArgument("Invalid hard disk variant '%s'", ValueUnion.psz);
+                    return errorArgument("Invalid medium variant '%s'", ValueUnion.psz);
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
-                return errorSyntax(USAGE_CREATEHD, "Invalid parameter '%s'", ValueUnion.psz);
+                return errorSyntax(USAGE_CREATEMEDIUM, "Invalid parameter '%s'", ValueUnion.psz);
 
             default:
                 if (c > 0)
                 {
                     if (RT_C_IS_PRINT(c))
-                        return errorSyntax(USAGE_CREATEHD, "Invalid option -%c", c);
+                        return errorSyntax(USAGE_CREATEMEDIUM, "Invalid option -%c", c);
                     else
-                        return errorSyntax(USAGE_CREATEHD, "Invalid option case %i", c);
+                        return errorSyntax(USAGE_CREATEMEDIUM, "Invalid option case %i", c);
                 }
                 else if (c == VERR_GETOPT_UNKNOWN_OPTION)
-                    return errorSyntax(USAGE_CREATEHD, "unknown option: %s\n", ValueUnion.psz);
+                    return errorSyntax(USAGE_CREATEMEDIUM, "unknown option: %s\n", ValueUnion.psz);
                 else if (ValueUnion.pDef)
-                    return errorSyntax(USAGE_CREATEHD, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
+                    return errorSyntax(USAGE_CREATEMEDIUM, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
                 else
-                    return errorSyntax(USAGE_CREATEHD, "error: %Rrs", c);
+                    return errorSyntax(USAGE_CREATEMEDIUM, "error: %Rrs", c);
         }
     }
 
     /* check the outcome */
-    ComPtr<IMedium> parentHardDisk;
+    if (cmd == CMD_NONE)
+        cmd = CMD_DISK;
+    ComPtr<IMedium> pParentMedium;
     if (fBase)
     {
         if (   !filename
             || !*filename
             || size == 0)
-            return errorSyntax(USAGE_CREATEHD, "Parameters --filename and --size are required");
+            return errorSyntax(USAGE_CREATEMEDIUM, "Parameters --filename and --size are required");
         if (!format || !*format)
-            format = "VDI";
+        {
+            if (cmd == CMD_DISK)
+                format = "VDI";
+            else if (cmd == CMD_DVD || cmd == CMD_FLOPPY)
+            {
+                format = "RAW";
+                unsigned uMediumVariant = (unsigned)enmMediumVariant;
+                uMediumVariant |= MediumVariant_Fixed;
+                enmMediumVariant = (MediumVariant_T)uMediumVariant;
+            }
+        }
     }
     else
     {
         if (   !filename
             || !*filename)
-            return errorSyntax(USAGE_CREATEHD, "Parameters --filename is required");
+            return errorSyntax(USAGE_CREATEMEDIUM, "Parameters --filename is required");
         size = 0;
-        DiskVariant = MediumVariant_Diff;
+        if (cmd != CMD_DISK)
+            return errorSyntax(USAGE_CREATEMEDIUM, "Creating a differencing medium is only supported for hard disks");
+        enmMediumVariant = MediumVariant_Diff;
         if (!format || !*format)
         {
-            const char *pszExt = RTPathExt(filename);
+            const char *pszExt = RTPathSuffix(filename);
             /* Skip over . if there is an extension. */
             if (pszExt)
                 pszExt++;
@@ -332,22 +375,22 @@ int handleCreateHardDisk(HandlerArg *a)
                 format = pszExt;
         }
         rc = openMedium(a, diffparent, DeviceType_HardDisk,
-                        AccessMode_ReadWrite, parentHardDisk,
+                        AccessMode_ReadWrite, pParentMedium,
                         false /* fForceNewUuidOnOpen */, false /* fSilent */);
         if (FAILED(rc))
             return 1;
-        if (parentHardDisk.isNull())
+        if (pParentMedium.isNull())
         {
             RTMsgError("Invalid parent hard disk reference, avoiding crash");
             return 1;
         }
         MediumState_T state;
-        CHECK_ERROR(parentHardDisk, COMGETTER(State)(&state));
+        CHECK_ERROR(pParentMedium, COMGETTER(State)(&state));
         if (FAILED(rc))
             return 1;
         if (state == MediumState_Inaccessible)
         {
-            CHECK_ERROR(parentHardDisk, RefreshState(&state));
+            CHECK_ERROR(pParentMedium, RefreshState(&state));
             if (FAILED(rc))
                 return 1;
         }
@@ -355,55 +398,76 @@ int handleCreateHardDisk(HandlerArg *a)
     /* check for filename extension */
     /** @todo use IMediumFormat to cover all extensions generically */
     Utf8Str strName(filename);
-    if (!RTPathHaveExt(strName.c_str()))
+    if (!RTPathHasSuffix(strName.c_str()))
     {
         Utf8Str strFormat(format);
-        if (strFormat.compare("vmdk", RTCString::CaseInsensitive) == 0)
-            strName.append(".vmdk");
-        else if (strFormat.compare("vhd", RTCString::CaseInsensitive) == 0)
-            strName.append(".vhd");
-        else
-            strName.append(".vdi");
+        if (cmd == CMD_DISK)
+        {
+            if (strFormat.compare("vmdk", RTCString::CaseInsensitive) == 0)
+                strName.append(".vmdk");
+            else if (strFormat.compare("vhd", RTCString::CaseInsensitive) == 0)
+                strName.append(".vhd");
+            else
+                strName.append(".vdi");
+        } else if (cmd == CMD_DVD)
+            strName.append(".iso");
+        else if (cmd == CMD_FLOPPY)
+            strName.append(".img");
         filename = strName.c_str();
     }
 
-    ComPtr<IMedium> hardDisk;
-    rc = createHardDisk(a, format, filename, hardDisk);
-    if (SUCCEEDED(rc) && hardDisk)
+    ComPtr<IMedium> pMedium;
+    if (cmd == CMD_DISK)
+        rc = createMedium(a, format, filename, DeviceType_HardDisk,
+                          AccessMode_ReadWrite, pMedium);
+    else if (cmd == CMD_DVD)
+        rc = createMedium(a, format, filename, DeviceType_DVD,
+                          AccessMode_ReadOnly, pMedium);
+    else if (cmd == CMD_FLOPPY)
+        rc = createMedium(a, format, filename, DeviceType_Floppy,
+                        AccessMode_ReadWrite, pMedium);
+    else
+        rc = E_INVALIDARG; /* cannot happen but make gcc happy */
+
+    if (SUCCEEDED(rc) && pMedium)
     {
-        ComPtr<IProgress> progress;
+        ComPtr<IProgress> pProgress;
         com::SafeArray<MediumVariant_T> l_variants(sizeof(MediumVariant_T)*8);
 
         for (ULONG i = 0; i < l_variants.size(); ++i)
         {
-            ULONG temp = DiskVariant;
+            ULONG temp = enmMediumVariant;
             temp &= 1<<i;
             l_variants [i] = (MediumVariant_T)temp;
         }
 
         if (fBase)
-            CHECK_ERROR(hardDisk, CreateBaseStorage(size, ComSafeArrayAsInParam(l_variants), progress.asOutParam()));
+            CHECK_ERROR(pMedium, CreateBaseStorage(size, ComSafeArrayAsInParam(l_variants), pProgress.asOutParam()));
         else
-            CHECK_ERROR(parentHardDisk, CreateDiffStorage(hardDisk, ComSafeArrayAsInParam(l_variants), progress.asOutParam()));
-        if (SUCCEEDED(rc) && progress)
+            CHECK_ERROR(pParentMedium, CreateDiffStorage(pMedium, ComSafeArrayAsInParam(l_variants), pProgress.asOutParam()));
+        if (SUCCEEDED(rc) && pProgress)
         {
-            rc = showProgress(progress);
-            CHECK_PROGRESS_ERROR(progress, ("Failed to create hard disk"));
-            if (SUCCEEDED(rc))
-            {
-                Bstr uuid;
-                CHECK_ERROR(hardDisk, COMGETTER(Id)(uuid.asOutParam()));
-                RTPrintf("Disk image created. UUID: %s\n", Utf8Str(uuid).c_str());
-            }
+            rc = showProgress(pProgress);
+            CHECK_PROGRESS_ERROR(pProgress, ("Failed to create medium"));
         }
+    }
+
+    if (SUCCEEDED(rc) && pMedium)
+    {
+        Bstr uuid;
+        CHECK_ERROR(pMedium, COMGETTER(Id)(uuid.asOutParam()));
+        RTPrintf("Medium created. UUID: %s\n", Utf8Str(uuid).c_str());
 
-        CHECK_ERROR(hardDisk, Close());
+        //CHECK_ERROR(pMedium, Close());
     }
     return SUCCEEDED(rc) ? 0 : 1;
 }
 
-static const RTGETOPTDEF g_aModifyHardDiskOptions[] =
+static const RTGETOPTDEF g_aModifyMediumOptions[] =
 {
+    { "disk",           'H', RTGETOPT_REQ_NOTHING },
+    { "dvd",            'D', RTGETOPT_REQ_NOTHING },
+    { "floppy",         'L', RTGETOPT_REQ_NOTHING },
     { "--type",         't', RTGETOPT_REQ_STRING },
     { "-type",          't', RTGETOPT_REQ_STRING },     // deprecated
     { "settype",        't', RTGETOPT_REQ_STRING },     // deprecated
@@ -418,38 +482,62 @@ static const RTGETOPTDEF g_aModifyHardDiskOptions[] =
     { "--resizebyte",   'R', RTGETOPT_REQ_UINT64 }
 };
 
-int handleModifyHardDisk(HandlerArg *a)
+int handleModifyMedium(HandlerArg *a)
 {
     HRESULT rc;
     int vrc;
-    ComPtr<IMedium> hardDisk;
-    MediumType_T DiskType;
+    enum {
+        CMD_NONE,
+        CMD_DISK,
+        CMD_DVD,
+        CMD_FLOPPY
+    } cmd = CMD_NONE;
+    ComPtr<IMedium> pMedium;
+    MediumType_T enmMediumType;
     bool AutoReset = false;
     SafeArray<BSTR> mediumPropNames;
     SafeArray<BSTR> mediumPropValues;
-    bool fModifyDiskType = false;
+    bool fModifyMediumType = false;
     bool fModifyAutoReset = false;
     bool fModifyProperties = false;
     bool fModifyCompact = false;
     bool fModifyResize = false;
     uint64_t cbResize = 0;
-    const char *FilenameOrUuid = NULL;
+    const char *pszFilenameOrUuid = NULL;
 
     int c;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
     // start at 0 because main() has hacked both the argc and argv given to us
-    RTGetOptInit(&GetState, a->argc, a->argv, g_aModifyHardDiskOptions, RT_ELEMENTS(g_aModifyHardDiskOptions),
+    RTGetOptInit(&GetState, a->argc, a->argv, g_aModifyMediumOptions, RT_ELEMENTS(g_aModifyMediumOptions),
                  0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
     while ((c = RTGetOpt(&GetState, &ValueUnion)))
     {
         switch (c)
         {
+            case 'H':   // disk
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_MODIFYMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_DISK;
+                break;
+
+            case 'D':   // DVD
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_MODIFYMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_DVD;
+                break;
+
+            case 'L':   // floppy
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_MODIFYMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_FLOPPY;
+                break;
+
             case 't':   // --type
-                vrc = parseDiskType(ValueUnion.psz, &DiskType);
+                vrc = parseMediumType(ValueUnion.psz, &enmMediumType);
                 if (RT_FAILURE(vrc))
-                    return errorArgument("Invalid hard disk type '%s'", ValueUnion.psz);
-                fModifyDiskType = true;
+                    return errorArgument("Invalid medium type '%s'", ValueUnion.psz);
+                fModifyMediumType = true;
                 break;
 
             case 'z':   // --autoreset
@@ -506,107 +594,124 @@ int handleModifyHardDisk(HandlerArg *a)
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
-                if (!FilenameOrUuid)
-                    FilenameOrUuid = ValueUnion.psz;
+                if (!pszFilenameOrUuid)
+                    pszFilenameOrUuid = ValueUnion.psz;
                 else
-                    return errorSyntax(USAGE_MODIFYHD, "Invalid parameter '%s'", ValueUnion.psz);
+                    return errorSyntax(USAGE_MODIFYMEDIUM, "Invalid parameter '%s'", ValueUnion.psz);
                 break;
 
             default:
                 if (c > 0)
                 {
                     if (RT_C_IS_PRINT(c))
-                        return errorSyntax(USAGE_MODIFYHD, "Invalid option -%c", c);
+                        return errorSyntax(USAGE_MODIFYMEDIUM, "Invalid option -%c", c);
                     else
-                        return errorSyntax(USAGE_MODIFYHD, "Invalid option case %i", c);
+                        return errorSyntax(USAGE_MODIFYMEDIUM, "Invalid option case %i", c);
                 }
                 else if (c == VERR_GETOPT_UNKNOWN_OPTION)
-                    return errorSyntax(USAGE_MODIFYHD, "unknown option: %s\n", ValueUnion.psz);
+                    return errorSyntax(USAGE_MODIFYMEDIUM, "unknown option: %s\n", ValueUnion.psz);
                 else if (ValueUnion.pDef)
-                    return errorSyntax(USAGE_MODIFYHD, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
+                    return errorSyntax(USAGE_MODIFYMEDIUM, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
                 else
-                    return errorSyntax(USAGE_MODIFYHD, "error: %Rrs", c);
+                    return errorSyntax(USAGE_MODIFYMEDIUM, "error: %Rrs", c);
         }
     }
 
-    if (!FilenameOrUuid)
-        return errorSyntax(USAGE_MODIFYHD, "Disk name or UUID required");
+    if (cmd == CMD_NONE)
+        cmd = CMD_DISK;
+
+    if (!pszFilenameOrUuid)
+        return errorSyntax(USAGE_MODIFYMEDIUM, "Medium name or UUID required");
 
-    if (!fModifyDiskType && !fModifyAutoReset && !fModifyProperties && !fModifyCompact && !fModifyResize)
-        return errorSyntax(USAGE_MODIFYHD, "No operation specified");
+    if (!fModifyMediumType && !fModifyAutoReset && !fModifyProperties && !fModifyCompact && !fModifyResize)
+        return errorSyntax(USAGE_MODIFYMEDIUM, "No operation specified");
 
     /* Always open the medium if necessary, there is no other way. */
-    rc = openMedium(a, FilenameOrUuid, DeviceType_HardDisk,
-                    AccessMode_ReadWrite, hardDisk,
-                    false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    if (cmd == CMD_DISK)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_HardDisk,
+                        AccessMode_ReadWrite, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else if (cmd == CMD_DVD)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_DVD,
+                        AccessMode_ReadOnly, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else if (cmd == CMD_FLOPPY)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_Floppy,
+                        AccessMode_ReadWrite, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else
+        rc = E_INVALIDARG; /* cannot happen but make gcc happy */
     if (FAILED(rc))
         return 1;
-    if (hardDisk.isNull())
+    if (pMedium.isNull())
     {
-        RTMsgError("Invalid hard disk reference, avoiding crash");
+        RTMsgError("Invalid medium reference, avoiding crash");
         return 1;
     }
 
-    if (fModifyDiskType)
+    if (fModifyMediumType)
     {
-        MediumType_T hddType;
-        CHECK_ERROR(hardDisk, COMGETTER(Type)(&hddType));
+        MediumType_T enmCurrMediumType;
+        CHECK_ERROR(pMedium, COMGETTER(Type)(&enmCurrMediumType));
 
-        if (hddType != DiskType)
-            CHECK_ERROR(hardDisk, COMSETTER(Type)(DiskType));
+        if (enmCurrMediumType != enmMediumType)
+            CHECK_ERROR(pMedium, COMSETTER(Type)(enmMediumType));
     }
 
     if (fModifyAutoReset)
     {
-        CHECK_ERROR(hardDisk, COMSETTER(AutoReset)(AutoReset));
+        CHECK_ERROR(pMedium, COMSETTER(AutoReset)(AutoReset));
     }
 
     if (fModifyProperties)
     {
-        CHECK_ERROR(hardDisk, SetProperties(ComSafeArrayAsInParam(mediumPropNames), ComSafeArrayAsInParam(mediumPropValues)));
+        CHECK_ERROR(pMedium, SetProperties(ComSafeArrayAsInParam(mediumPropNames), ComSafeArrayAsInParam(mediumPropValues)));
     }
 
     if (fModifyCompact)
     {
-        ComPtr<IProgress> progress;
-        CHECK_ERROR(hardDisk, Compact(progress.asOutParam()));
+        ComPtr<IProgress> pProgress;
+        CHECK_ERROR(pMedium, Compact(pProgress.asOutParam()));
         if (SUCCEEDED(rc))
-            rc = showProgress(progress);
+            rc = showProgress(pProgress);
         if (FAILED(rc))
         {
             if (rc == E_NOTIMPL)
-                RTMsgError("Compact hard disk operation is not implemented!");
+                RTMsgError("Compact medium operation is not implemented!");
             else if (rc == VBOX_E_NOT_SUPPORTED)
-                RTMsgError("Compact hard disk operation for this format is not implemented yet!");
-            else if (!progress.isNull())
-                CHECK_PROGRESS_ERROR(progress, ("Failed to compact hard disk"));
+                RTMsgError("Compact medium operation for this format is not implemented yet!");
+            else if (!pProgress.isNull())
+                CHECK_PROGRESS_ERROR(pProgress, ("Failed to compact medium"));
             else
-                RTMsgError("Failed to compact hard disk!");
+                RTMsgError("Failed to compact medium!");
         }
     }
 
     if (fModifyResize)
     {
-        ComPtr<IProgress> progress;
-        CHECK_ERROR(hardDisk, Resize(cbResize, progress.asOutParam()));
+        ComPtr<IProgress> pProgress;
+        CHECK_ERROR(pMedium, Resize(cbResize, pProgress.asOutParam()));
         if (SUCCEEDED(rc))
-            rc = showProgress(progress);
+            rc = showProgress(pProgress);
         if (FAILED(rc))
         {
             if (rc == E_NOTIMPL)
-                RTMsgError("Resize hard disk operation is not implemented!");
+                RTMsgError("Resize medium operation is not implemented!");
             else if (rc == VBOX_E_NOT_SUPPORTED)
-                RTMsgError("Resize hard disk operation for this format is not implemented yet!");
+                RTMsgError("Resize medium operation for this format is not implemented yet!");
             else
-                CHECK_PROGRESS_ERROR(progress, ("Failed to resize hard disk"));
+                CHECK_PROGRESS_ERROR(pProgress, ("Failed to resize medium"));
         }
     }
 
     return SUCCEEDED(rc) ? 0 : 1;
 }
 
-static const RTGETOPTDEF g_aCloneHardDiskOptions[] =
+static const RTGETOPTDEF g_aCloneMediumOptions[] =
 {
+    { "disk",           'd', RTGETOPT_REQ_NOTHING },
+    { "dvd",            'D', RTGETOPT_REQ_NOTHING },
+    { "floppy",         'f', RTGETOPT_REQ_NOTHING },
     { "--format",       'o', RTGETOPT_REQ_STRING },
     { "-format",        'o', RTGETOPT_REQ_STRING },
     { "--static",       'F', RTGETOPT_REQ_NOTHING },
@@ -616,35 +721,59 @@ static const RTGETOPTDEF g_aCloneHardDiskOptions[] =
     { "-variant",       'm', RTGETOPT_REQ_STRING },
 };
 
-int handleCloneHardDisk(HandlerArg *a)
+int handleCloneMedium(HandlerArg *a)
 {
     HRESULT rc;
     int vrc;
+    enum {
+        CMD_NONE,
+        CMD_DISK,
+        CMD_DVD,
+        CMD_FLOPPY
+    } cmd = CMD_NONE;
     const char *pszSrc = NULL;
     const char *pszDst = NULL;
     Bstr format;
-    MediumVariant_T DiskVariant = MediumVariant_Standard;
+    MediumVariant_T enmMediumVariant = MediumVariant_Standard;
     bool fExisting = false;
 
     int c;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
     // start at 0 because main() has hacked both the argc and argv given to us
-    RTGetOptInit(&GetState, a->argc, a->argv, g_aCloneHardDiskOptions, RT_ELEMENTS(g_aCloneHardDiskOptions),
+    RTGetOptInit(&GetState, a->argc, a->argv, g_aCloneMediumOptions, RT_ELEMENTS(g_aCloneMediumOptions),
                  0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
     while ((c = RTGetOpt(&GetState, &ValueUnion)))
     {
         switch (c)
         {
+            case 'd':   // disk
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_CLONEMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_DISK;
+                break;
+
+            case 'D':   // DVD
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_CLONEMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_DVD;
+                break;
+
+            case 'f':   // floppy
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_CLONEMEDIUM, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_FLOPPY;
+                break;
+
             case 'o':   // --format
                 format = ValueUnion.psz;
                 break;
 
             case 'F':   // --static
             {
-                unsigned uDiskVariant = (unsigned)DiskVariant;
-                uDiskVariant |= MediumVariant_Fixed;
-                DiskVariant = (MediumVariant_T)uDiskVariant;
+                unsigned uMediumVariant = (unsigned)enmMediumVariant;
+                uMediumVariant |= MediumVariant_Fixed;
+                enmMediumVariant = (MediumVariant_T)uMediumVariant;
                 break;
             }
 
@@ -653,9 +782,9 @@ int handleCloneHardDisk(HandlerArg *a)
                 break;
 
             case 'm':   // --variant
-                vrc = parseDiskVariant(ValueUnion.psz, &DiskVariant);
+                vrc = parseMediumVariant(ValueUnion.psz, &enmMediumVariant);
                 if (RT_FAILURE(vrc))
-                    return errorArgument("Invalid hard disk variant '%s'", ValueUnion.psz);
+                    return errorArgument("Invalid medium variant '%s'", ValueUnion.psz);
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
@@ -664,88 +793,112 @@ int handleCloneHardDisk(HandlerArg *a)
                 else if (!pszDst)
                     pszDst = ValueUnion.psz;
                 else
-                    return errorSyntax(USAGE_CLONEHD, "Invalid parameter '%s'", ValueUnion.psz);
+                    return errorSyntax(USAGE_CLONEMEDIUM, "Invalid parameter '%s'", ValueUnion.psz);
                 break;
 
             default:
                 if (c > 0)
                 {
                     if (RT_C_IS_GRAPH(c))
-                        return errorSyntax(USAGE_CLONEHD, "unhandled option: -%c", c);
+                        return errorSyntax(USAGE_CLONEMEDIUM, "unhandled option: -%c", c);
                     else
-                        return errorSyntax(USAGE_CLONEHD, "unhandled option: %i", c);
+                        return errorSyntax(USAGE_CLONEMEDIUM, "unhandled option: %i", c);
                 }
                 else if (c == VERR_GETOPT_UNKNOWN_OPTION)
-                    return errorSyntax(USAGE_CLONEHD, "unknown option: %s", ValueUnion.psz);
+                    return errorSyntax(USAGE_CLONEMEDIUM, "unknown option: %s", ValueUnion.psz);
                 else if (ValueUnion.pDef)
-                    return errorSyntax(USAGE_CLONEHD, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
+                    return errorSyntax(USAGE_CLONEMEDIUM, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
                 else
-                    return errorSyntax(USAGE_CLONEHD, "error: %Rrs", c);
+                    return errorSyntax(USAGE_CLONEMEDIUM, "error: %Rrs", c);
         }
     }
 
+    if (cmd == CMD_NONE)
+        cmd = CMD_DISK;
     if (!pszSrc)
-        return errorSyntax(USAGE_CLONEHD, "Mandatory UUID or input file parameter missing");
+        return errorSyntax(USAGE_CLONEMEDIUM, "Mandatory UUID or input file parameter missing");
     if (!pszDst)
-        return errorSyntax(USAGE_CLONEHD, "Mandatory output file parameter missing");
-    if (fExisting && (!format.isEmpty() || DiskVariant != MediumType_Normal))
-        return errorSyntax(USAGE_CLONEHD, "Specified options which cannot be used with --existing");
+        return errorSyntax(USAGE_CLONEMEDIUM, "Mandatory output file parameter missing");
+    if (fExisting && (!format.isEmpty() || enmMediumVariant != MediumType_Normal))
+        return errorSyntax(USAGE_CLONEMEDIUM, "Specified options which cannot be used with --existing");
 
-    ComPtr<IMedium> srcDisk;
-    ComPtr<IMedium> dstDisk;
+    ComPtr<IMedium> pSrcMedium;
+    ComPtr<IMedium> pDstMedium;
 
-    rc = openMedium(a, pszSrc, DeviceType_HardDisk, AccessMode_ReadOnly,
-                    srcDisk, false /* fForceNewUuidOnOpen */,
-                    false /* fSilent */);
+    if (cmd == CMD_DISK)
+        rc = openMedium(a, pszSrc, DeviceType_HardDisk, AccessMode_ReadOnly, pSrcMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else if (cmd == CMD_DVD)
+        rc = openMedium(a, pszSrc, DeviceType_DVD, AccessMode_ReadOnly, pSrcMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else if (cmd == CMD_FLOPPY)
+        rc = openMedium(a, pszSrc, DeviceType_Floppy, AccessMode_ReadOnly, pSrcMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else
+        rc = E_INVALIDARG; /* cannot happen but make gcc happy */
     if (FAILED(rc))
         return 1;
 
     do
     {
-        /* open/create destination hard disk */
+        /* open/create destination medium */
         if (fExisting)
         {
-            rc = openMedium(a, pszDst, DeviceType_HardDisk,
-                            AccessMode_ReadWrite, dstDisk,
-                            false /* fForceNewUuidOnOpen */,
-                            false /* fSilent */);
+            if (cmd == CMD_DISK)
+                rc = openMedium(a, pszDst, DeviceType_HardDisk, AccessMode_ReadWrite, pDstMedium,
+                                false /* fForceNewUuidOnOpen */, false /* fSilent */);
+            else if (cmd == CMD_DVD)
+                rc = openMedium(a, pszDst, DeviceType_DVD, AccessMode_ReadOnly, pDstMedium,
+                                false /* fForceNewUuidOnOpen */, false /* fSilent */);
+            else if (cmd == CMD_FLOPPY)
+                rc = openMedium(a, pszDst, DeviceType_Floppy, AccessMode_ReadWrite, pDstMedium,
+                                false /* fForceNewUuidOnOpen */, false /* fSilent */);
             if (FAILED(rc))
                 break;
 
             /* Perform accessibility check now. */
             MediumState_T state;
-            CHECK_ERROR_BREAK(dstDisk, RefreshState(&state));
-            CHECK_ERROR_BREAK(dstDisk, COMGETTER(Format)(format.asOutParam()));
+            CHECK_ERROR_BREAK(pDstMedium, RefreshState(&state));
+            CHECK_ERROR_BREAK(pDstMedium, COMGETTER(Format)(format.asOutParam()));
         }
         else
         {
-            /* use the format of the source hard disk if unspecified */
+            /* use the format of the source medium if unspecified */
             if (format.isEmpty())
-                CHECK_ERROR_BREAK(srcDisk, COMGETTER(Format)(format.asOutParam()));
-            rc = createHardDisk(a, Utf8Str(format).c_str(), pszDst, dstDisk);
+                CHECK_ERROR_BREAK(pSrcMedium, COMGETTER(Format)(format.asOutParam()));
+            Utf8Str strFormat(format);
+            if (cmd == CMD_DISK)
+                rc = createMedium(a, strFormat.c_str(), pszDst, DeviceType_HardDisk,
+                                  AccessMode_ReadWrite, pDstMedium);
+            else if (cmd == CMD_DVD)
+                rc = createMedium(a, strFormat.c_str(), pszDst, DeviceType_DVD,
+                                  AccessMode_ReadOnly, pDstMedium);
+            else if (cmd == CMD_FLOPPY)
+                rc = createMedium(a, strFormat.c_str(), pszDst, DeviceType_Floppy,
+                                  AccessMode_ReadWrite, pDstMedium);
             if (FAILED(rc))
                 break;
         }
 
-        ComPtr<IProgress> progress;
+        ComPtr<IProgress> pProgress;
         com::SafeArray<MediumVariant_T> l_variants(sizeof(MediumVariant_T)*8);
 
         for (ULONG i = 0; i < l_variants.size(); ++i)
         {
-            ULONG temp = DiskVariant;
+            ULONG temp = enmMediumVariant;
             temp &= 1<<i;
             l_variants [i] = (MediumVariant_T)temp;
         }
 
-        CHECK_ERROR_BREAK(srcDisk, CloneTo(dstDisk, ComSafeArrayAsInParam(l_variants), NULL, progress.asOutParam()));
+        CHECK_ERROR_BREAK(pSrcMedium, CloneTo(pDstMedium, ComSafeArrayAsInParam(l_variants), NULL, pProgress.asOutParam()));
 
-        rc = showProgress(progress);
-        CHECK_PROGRESS_ERROR_BREAK(progress, ("Failed to clone hard disk"));
+        rc = showProgress(pProgress);
+        CHECK_PROGRESS_ERROR_BREAK(pProgress, ("Failed to clone medium"));
 
         Bstr uuid;
-        CHECK_ERROR_BREAK(dstDisk, COMGETTER(Id)(uuid.asOutParam()));
+        CHECK_ERROR_BREAK(pDstMedium, COMGETTER(Id)(uuid.asOutParam()));
 
-        RTPrintf("Clone hard disk created in format '%ls'. UUID: %s\n",
+        RTPrintf("Clone medium created in format '%ls'. UUID: %s\n",
                  format.raw(), Utf8Str(uuid).c_str());
     }
     while (0);
@@ -798,12 +951,12 @@ RTEXITCODE handleConvertFromRaw(int argc, char *argv[])
 
             case 'm':   // --variant
             {
-                MediumVariant_T DiskVariant = MediumVariant_Standard;
-                rc = parseDiskVariant(ValueUnion.psz, &DiskVariant);
+                MediumVariant_T enmMediumVariant = MediumVariant_Standard;
+                rc = parseMediumVariant(ValueUnion.psz, &enmMediumVariant);
                 if (RT_FAILURE(rc))
-                    return errorArgument("Invalid hard disk variant '%s'", ValueUnion.psz);
+                    return errorArgument("Invalid medium variant '%s'", ValueUnion.psz);
                 /// @todo cleaner solution than assuming 1:1 mapping?
-                uImageFlags = (unsigned)DiskVariant;
+                uImageFlags = (unsigned)enmMediumVariant;
                 break;
             }
             case VINF_GETOPT_NOT_OPTION:
@@ -1025,7 +1178,7 @@ HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox,
         }
         RTPrintf("Type:           %s\n", typeStr);
 
-        /* print out information specific for differencing hard disks */
+        /* print out information specific for differencing media */
         if (fOptLong && pszParentUUID && Guid(pszParentUUID).isValid())
         {
             BOOL autoReset = FALSE;
@@ -1084,6 +1237,21 @@ HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox,
             RTPrintf("Size on disk:   %lld MBytes\n", actualSize >> 20);
         }
 
+        Bstr strCipher;
+        Bstr strPasswordId;
+        HRESULT rc2 = pMedium->GetEncryptionSettings(strCipher.asOutParam(), strPasswordId.asOutParam());
+        if (SUCCEEDED(rc2))
+        {
+            RTPrintf("Encryption:     enabled\n");
+            if (fOptLong)
+            {
+                RTPrintf("Cipher:         %ls\n", strCipher.raw());
+                RTPrintf("Password ID:    %ls\n", strPasswordId.raw());
+            }
+        }
+        else
+            RTPrintf("Encryption:     disabled\n");
+
         if (fOptLong)
         {
             com::SafeArray<BSTR> names;
@@ -1110,13 +1278,13 @@ HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox,
             pMedium->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(machineIds));
             for (size_t i = 0; i < machineIds.size(); i++)
             {
-                ComPtr<IMachine> machine;
-                CHECK_ERROR(pVirtualBox, FindMachine(machineIds[i], machine.asOutParam()));
-                if (machine)
+                ComPtr<IMachine> pMachine;
+                CHECK_ERROR(pVirtualBox, FindMachine(machineIds[i], pMachine.asOutParam()));
+                if (pMachine)
                 {
                     Bstr name;
-                    machine->COMGETTER(Name)(name.asOutParam());
-                    machine->COMGETTER(Id)(uuid.asOutParam());
+                    pMachine->COMGETTER(Name)(name.asOutParam());
+                    pMachine->COMGETTER(Id)(uuid.asOutParam());
                     RTPrintf("%s%ls (UUID: %ls)",
                              fFirst ? "In use by VMs:  " : "                ",
                              name.raw(), machineIds[i]);
@@ -1126,12 +1294,12 @@ HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox,
                                             ComSafeArrayAsOutParam(snapshotIds));
                     for (size_t j = 0; j < snapshotIds.size(); j++)
                     {
-                        ComPtr<ISnapshot> snapshot;
-                        machine->FindSnapshot(snapshotIds[j], snapshot.asOutParam());
-                        if (snapshot)
+                        ComPtr<ISnapshot> pSnapshot;
+                        pMachine->FindSnapshot(snapshotIds[j], pSnapshot.asOutParam());
+                        if (pSnapshot)
                         {
                             Bstr snapshotName;
-                            snapshot->COMGETTER(Name)(snapshotName.asOutParam());
+                            pSnapshot->COMGETTER(Name)(snapshotName.asOutParam());
                             RTPrintf(" [%ls (UUID: %ls)]", snapshotName.raw(), snapshotIds[j]);
                         }
                     }
@@ -1165,72 +1333,110 @@ HRESULT showMediumInfo(const ComPtr<IVirtualBox> &pVirtualBox,
     return rc;
 }
 
-static const RTGETOPTDEF g_aShowHardDiskInfoOptions[] =
+static const RTGETOPTDEF g_aShowMediumInfoOptions[] =
 {
-    { "--dummy",    256, RTGETOPT_REQ_NOTHING },   // placeholder for C++
+    { "disk",           'd', RTGETOPT_REQ_NOTHING },
+    { "dvd",            'D', RTGETOPT_REQ_NOTHING },
+    { "floppy",         'f', RTGETOPT_REQ_NOTHING },
 };
 
-int handleShowHardDiskInfo(HandlerArg *a)
+int handleShowMediumInfo(HandlerArg *a)
 {
     HRESULT rc;
-    const char *FilenameOrUuid = NULL;
+    enum {
+        CMD_NONE,
+        CMD_DISK,
+        CMD_DVD,
+        CMD_FLOPPY
+    } cmd = CMD_NONE;
+    const char *pszFilenameOrUuid = NULL;
 
     int c;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
     // start at 0 because main() has hacked both the argc and argv given to us
-    RTGetOptInit(&GetState, a->argc, a->argv, g_aShowHardDiskInfoOptions, RT_ELEMENTS(g_aShowHardDiskInfoOptions),
+    RTGetOptInit(&GetState, a->argc, a->argv, g_aShowMediumInfoOptions, RT_ELEMENTS(g_aShowMediumInfoOptions),
                  0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
     while ((c = RTGetOpt(&GetState, &ValueUnion)))
     {
         switch (c)
         {
+            case 'd':   // disk
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_SHOWMEDIUMINFO, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_DISK;
+                break;
+
+            case 'D':   // DVD
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_SHOWMEDIUMINFO, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_DVD;
+                break;
+
+            case 'f':   // floppy
+                if (cmd != CMD_NONE)
+                    return errorSyntax(USAGE_SHOWMEDIUMINFO, "Only one command can be specified: '%s'", ValueUnion.psz);
+                cmd = CMD_FLOPPY;
+                break;
+
             case VINF_GETOPT_NOT_OPTION:
-                if (!FilenameOrUuid)
-                    FilenameOrUuid = ValueUnion.psz;
+                if (!pszFilenameOrUuid)
+                    pszFilenameOrUuid = ValueUnion.psz;
                 else
-                    return errorSyntax(USAGE_SHOWHDINFO, "Invalid parameter '%s'", ValueUnion.psz);
+                    return errorSyntax(USAGE_SHOWMEDIUMINFO, "Invalid parameter '%s'", ValueUnion.psz);
                 break;
 
             default:
                 if (c > 0)
                 {
                     if (RT_C_IS_PRINT(c))
-                        return errorSyntax(USAGE_SHOWHDINFO, "Invalid option -%c", c);
+                        return errorSyntax(USAGE_SHOWMEDIUMINFO, "Invalid option -%c", c);
                     else
-                        return errorSyntax(USAGE_SHOWHDINFO, "Invalid option case %i", c);
+                        return errorSyntax(USAGE_SHOWMEDIUMINFO, "Invalid option case %i", c);
                 }
                 else if (c == VERR_GETOPT_UNKNOWN_OPTION)
-                    return errorSyntax(USAGE_SHOWHDINFO, "unknown option: %s\n", ValueUnion.psz);
+                    return errorSyntax(USAGE_SHOWMEDIUMINFO, "unknown option: %s\n", ValueUnion.psz);
                 else if (ValueUnion.pDef)
-                    return errorSyntax(USAGE_SHOWHDINFO, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
+                    return errorSyntax(USAGE_SHOWMEDIUMINFO, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
                 else
-                    return errorSyntax(USAGE_SHOWHDINFO, "error: %Rrs", c);
+                    return errorSyntax(USAGE_SHOWMEDIUMINFO, "error: %Rrs", c);
         }
     }
 
+    if (cmd == CMD_NONE)
+        cmd = CMD_DISK;
+
     /* check for required options */
-    if (!FilenameOrUuid)
-        return errorSyntax(USAGE_SHOWHDINFO, "Disk name or UUID required");
+    if (!pszFilenameOrUuid)
+        return errorSyntax(USAGE_SHOWMEDIUMINFO, "Medium name or UUID required");
 
-    ComPtr<IMedium> hardDisk;
-    rc = openMedium(a, FilenameOrUuid, DeviceType_HardDisk,
-                    AccessMode_ReadOnly, hardDisk,
-                    false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    ComPtr<IMedium> pMedium;
+    if (cmd == CMD_DISK)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_HardDisk,
+                        AccessMode_ReadOnly, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else if (cmd == CMD_DVD)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_DVD,
+                        AccessMode_ReadOnly, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else if (cmd == CMD_FLOPPY)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_Floppy,
+                        AccessMode_ReadOnly, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
     if (FAILED(rc))
         return 1;
 
     Utf8Str strParentUUID("base");
-    ComPtr<IMedium> parent;
-    hardDisk->COMGETTER(Parent)(parent.asOutParam());
-    if (!parent.isNull())
+    ComPtr<IMedium> pParent;
+    pMedium->COMGETTER(Parent)(pParent.asOutParam());
+    if (!pParent.isNull())
     {
         Bstr bstrParentUUID;
-        parent->COMGETTER(Id)(bstrParentUUID.asOutParam());
+        pParent->COMGETTER(Id)(bstrParentUUID.asOutParam());
         strParentUUID = bstrParentUUID;
     }
 
-    rc = showMediumInfo(a->virtualBox, hardDisk, strParentUUID.c_str(), true);
+    rc = showMediumInfo(a->virtualBox, pMedium, strParentUUID.c_str(), true);
 
     return SUCCEEDED(rc) ? 0 : 1;
 }
@@ -1252,7 +1458,7 @@ int handleCloseMedium(HandlerArg *a)
         CMD_DVD,
         CMD_FLOPPY
     } cmd = CMD_NONE;
-    const char *FilenameOrUuid = NULL;
+    const char *pszFilenameOrUuid = NULL;
     bool fDelete = false;
 
     int c;
@@ -1288,8 +1494,8 @@ int handleCloseMedium(HandlerArg *a)
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
-                if (!FilenameOrUuid)
-                    FilenameOrUuid = ValueUnion.psz;
+                if (!pszFilenameOrUuid)
+                    pszFilenameOrUuid = ValueUnion.psz;
                 else
                     return errorSyntax(USAGE_CLOSEMEDIUM, "Invalid parameter '%s'", ValueUnion.psz);
                 break;
@@ -1313,42 +1519,337 @@ int handleCloseMedium(HandlerArg *a)
 
     /* check for required options */
     if (cmd == CMD_NONE)
-        return errorSyntax(USAGE_CLOSEMEDIUM, "Command variant disk/dvd/floppy required");
-    if (!FilenameOrUuid)
-        return errorSyntax(USAGE_CLOSEMEDIUM, "Disk name or UUID required");
-
-    ComPtr<IMedium> medium;
+        cmd = CMD_DISK;
+    if (!pszFilenameOrUuid)
+        return errorSyntax(USAGE_CLOSEMEDIUM, "Medium name or UUID required");
 
+    ComPtr<IMedium> pMedium;
     if (cmd == CMD_DISK)
-        rc = openMedium(a, FilenameOrUuid, DeviceType_HardDisk,
-                        AccessMode_ReadWrite, medium,
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_HardDisk,
+                        AccessMode_ReadWrite, pMedium,
                         false /* fForceNewUuidOnOpen */, false /* fSilent */);
     else if (cmd == CMD_DVD)
-        rc = openMedium(a, FilenameOrUuid, DeviceType_DVD,
-                        AccessMode_ReadOnly, medium,
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_DVD,
+                        AccessMode_ReadOnly, pMedium,
                         false /* fForceNewUuidOnOpen */, false /* fSilent */);
     else if (cmd == CMD_FLOPPY)
-        rc = openMedium(a, FilenameOrUuid, DeviceType_Floppy,
-                        AccessMode_ReadWrite, medium,
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_Floppy,
+                        AccessMode_ReadWrite, pMedium,
                         false /* fForceNewUuidOnOpen */, false /* fSilent */);
 
-    if (SUCCEEDED(rc) && medium)
+    if (SUCCEEDED(rc) && pMedium)
     {
         if (fDelete)
         {
-            ComPtr<IProgress> progress;
-            CHECK_ERROR(medium, DeleteStorage(progress.asOutParam()));
+            ComPtr<IProgress> pProgress;
+            CHECK_ERROR(pMedium, DeleteStorage(pProgress.asOutParam()));
             if (SUCCEEDED(rc))
             {
-                rc = showProgress(progress);
-                CHECK_PROGRESS_ERROR(progress, ("Failed to delete medium"));
+                rc = showProgress(pProgress);
+                CHECK_PROGRESS_ERROR(pProgress, ("Failed to delete medium"));
             }
             else
                 RTMsgError("Failed to delete medium. Error code %Rrc", rc);
         }
-        CHECK_ERROR(medium, Close());
+        CHECK_ERROR(pMedium, Close());
     }
 
     return SUCCEEDED(rc) ? 0 : 1;
 }
+
+int handleMediumProperty(HandlerArg *a)
+{
+    HRESULT rc = S_OK;
+    const char *pszCmd = NULL;
+    enum {
+        CMD_NONE,
+        CMD_DISK,
+        CMD_DVD,
+        CMD_FLOPPY
+    } cmd = CMD_NONE;
+    const char *pszAction = NULL;
+    const char *pszFilenameOrUuid = NULL;
+    const char *pszProperty = NULL;
+    ComPtr<IMedium> pMedium;
+
+    pszCmd = (a->argc > 0) ? a->argv[0] : "";
+    if (   !RTStrICmp(pszCmd, "disk")
+        || !RTStrICmp(pszCmd, "dvd")
+        || !RTStrICmp(pszCmd, "floppy"))
+    {
+        if (!RTStrICmp(pszCmd, "disk"))
+            cmd = CMD_DISK;
+        else if (!RTStrICmp(pszCmd, "dvd"))
+            cmd = CMD_DVD;
+        else if (!RTStrICmp(pszCmd, "floppy"))
+            cmd = CMD_FLOPPY;
+        else
+        {
+            AssertMsgFailed(("unexpected parameter %s\n", pszCmd));
+            cmd = CMD_DISK;
+        }
+        a->argv++;
+        a->argc--;
+    }
+    else
+    {
+        pszCmd = NULL;
+        cmd = CMD_DISK;
+    }
+
+    if (a->argc == 0)
+        return errorSyntax(USAGE_MEDIUMPROPERTY, "Missing action");
+
+    pszAction = a->argv[0];
+    if (   RTStrICmp(pszAction, "set")
+        && RTStrICmp(pszAction, "get")
+        && RTStrICmp(pszAction, "delete"))
+        return errorSyntax(USAGE_MEDIUMPROPERTY, "Invalid action given: %s", pszAction);
+
+    if (   (   !RTStrICmp(pszAction, "set")
+            && a->argc != 4)
+        || (   RTStrICmp(pszAction, "set")
+            && a->argc != 3))
+        return errorSyntax(USAGE_MEDIUMPROPERTY, "Invalid number of arguments given for action: %s", pszAction);
+
+    pszFilenameOrUuid = a->argv[1];
+    pszProperty       = a->argv[2];
+
+    if (cmd == CMD_DISK)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_HardDisk,
+                        AccessMode_ReadWrite, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else if (cmd == CMD_DVD)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_DVD,
+                        AccessMode_ReadOnly, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    else if (cmd == CMD_FLOPPY)
+        rc = openMedium(a, pszFilenameOrUuid, DeviceType_Floppy,
+                        AccessMode_ReadWrite, pMedium,
+                        false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    if (SUCCEEDED(rc) && !pMedium.isNull())
+    {
+        if (!RTStrICmp(pszAction, "set"))
+        {
+            const char *pszValue = a->argv[3];
+            CHECK_ERROR(pMedium, SetProperty(Bstr(pszProperty).raw(), Bstr(pszValue).raw()));
+        }
+        else if (!RTStrICmp(pszAction, "get"))
+        {
+            Bstr strVal;
+            CHECK_ERROR(pMedium, GetProperty(Bstr(pszProperty).raw(), strVal.asOutParam()));
+            if (SUCCEEDED(rc))
+                RTPrintf("%s=%ls\n", pszProperty, strVal.raw());
+        }
+        else if (!RTStrICmp(pszAction, "delete"))
+        {
+            const char *pszValue = a->argv[3];
+            CHECK_ERROR(pMedium, SetProperty(Bstr(pszProperty).raw(), Bstr().raw()));
+            /** @todo */
+        }
+    }
+
+    return SUCCEEDED(rc) ? 0 : 1;
+}
+
+static const RTGETOPTDEF g_aEncryptMediumOptions[] =
+{
+    { "--newpassword",   'n', RTGETOPT_REQ_STRING },
+    { "--oldpassword",   'o', RTGETOPT_REQ_STRING },
+    { "--cipher",        'c', RTGETOPT_REQ_STRING },
+    { "--newpasswordid", 'i', RTGETOPT_REQ_STRING }
+};
+
+int handleEncryptMedium(HandlerArg *a)
+{
+    HRESULT rc;
+    ComPtr<IMedium> hardDisk;
+    const char *pszPasswordNew = NULL;
+    const char *pszPasswordOld = NULL;
+    const char *pszCipher = NULL;
+    const char *pszFilenameOrUuid = NULL;
+    const char *pszNewPasswordId = NULL;
+    Utf8Str strPasswordNew;
+    Utf8Str strPasswordOld;
+
+    int c;
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    // start at 0 because main() has hacked both the argc and argv given to us
+    RTGetOptInit(&GetState, a->argc, a->argv, g_aEncryptMediumOptions, RT_ELEMENTS(g_aEncryptMediumOptions),
+                 0, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
+    while ((c = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (c)
+        {
+            case 'n':   // --newpassword
+                pszPasswordNew = ValueUnion.psz;
+                break;
+
+            case 'o':   // --oldpassword
+                pszPasswordOld = ValueUnion.psz;
+                break;
+
+            case 'c':   // --cipher
+                pszCipher = ValueUnion.psz;
+                break;
+
+            case 'i':   // --newpasswordid
+                pszNewPasswordId = ValueUnion.psz;
+                break;
+
+            case VINF_GETOPT_NOT_OPTION:
+                if (!pszFilenameOrUuid)
+                    pszFilenameOrUuid = ValueUnion.psz;
+                else
+                    return errorSyntax(USAGE_ENCRYPTMEDIUM, "Invalid parameter '%s'", ValueUnion.psz);
+                break;
+
+            default:
+                if (c > 0)
+                {
+                    if (RT_C_IS_PRINT(c))
+                        return errorSyntax(USAGE_ENCRYPTMEDIUM, "Invalid option -%c", c);
+                    else
+                        return errorSyntax(USAGE_ENCRYPTMEDIUM, "Invalid option case %i", c);
+                }
+                else if (c == VERR_GETOPT_UNKNOWN_OPTION)
+                    return errorSyntax(USAGE_ENCRYPTMEDIUM, "unknown option: %s\n", ValueUnion.psz);
+                else if (ValueUnion.pDef)
+                    return errorSyntax(USAGE_ENCRYPTMEDIUM, "%s: %Rrs", ValueUnion.pDef->pszLong, c);
+                else
+                    return errorSyntax(USAGE_ENCRYPTMEDIUM, "error: %Rrs", c);
+        }
+    }
+
+    if (!pszFilenameOrUuid)
+        return errorSyntax(USAGE_ENCRYPTMEDIUM, "Disk name or UUID required");
+
+    if (!pszPasswordNew && !pszPasswordOld)
+        return errorSyntax(USAGE_ENCRYPTMEDIUM, "No password specified");
+
+    if (   (pszPasswordNew && !pszNewPasswordId)
+        || (!pszPasswordNew && pszNewPasswordId))
+        return errorSyntax(USAGE_ENCRYPTMEDIUM, "A new password must always have a valid identifier set at the same time");
+
+    if (pszPasswordNew)
+    {
+        if (!RTStrCmp(pszPasswordNew, "-"))
+        {
+            /* Get password from console. */
+            RTEXITCODE rcExit = readPasswordFromConsole(&strPasswordNew, "Enter new password:");
+            if (rcExit == RTEXITCODE_FAILURE)
+                return rcExit;
+        }
+        else
+        {
+            RTEXITCODE rcExit = readPasswordFile(pszPasswordNew, &strPasswordNew);
+            if (rcExit == RTEXITCODE_FAILURE)
+            {
+                RTMsgError("Failed to read new password from file");
+                return rcExit;
+            }
+        }
+    }
+
+    if (pszPasswordOld)
+    {
+        if (!RTStrCmp(pszPasswordOld, "-"))
+        {
+            /* Get password from console. */
+            RTEXITCODE rcExit = readPasswordFromConsole(&strPasswordOld, "Enter old password:");
+            if (rcExit == RTEXITCODE_FAILURE)
+                return rcExit;
+        }
+        else
+        {
+            RTEXITCODE rcExit = readPasswordFile(pszPasswordOld, &strPasswordOld);
+            if (rcExit == RTEXITCODE_FAILURE)
+            {
+                RTMsgError("Failed to read old password from file");
+                return rcExit;
+            }
+        }
+    }
+
+    /* Always open the medium if necessary, there is no other way. */
+    rc = openMedium(a, pszFilenameOrUuid, DeviceType_HardDisk,
+                    AccessMode_ReadWrite, hardDisk,
+                    false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    if (FAILED(rc))
+        return 1;
+    if (hardDisk.isNull())
+    {
+        RTMsgError("Invalid hard disk reference, avoiding crash");
+        return 1;
+    }
+
+    ComPtr<IProgress> progress;
+    CHECK_ERROR(hardDisk, ChangeEncryption(Bstr(strPasswordOld).raw(), Bstr(pszCipher).raw(),
+                                           Bstr(strPasswordNew).raw(), Bstr(pszNewPasswordId).raw(),
+                                           progress.asOutParam()));
+    if (SUCCEEDED(rc))
+        rc = showProgress(progress);
+    if (FAILED(rc))
+    {
+        if (rc == E_NOTIMPL)
+            RTMsgError("Encrypt hard disk operation is not implemented!");
+        else if (rc == VBOX_E_NOT_SUPPORTED)
+            RTMsgError("Encrypt hard disk operation for this cipher is not implemented yet!");
+        else if (!progress.isNull())
+            CHECK_PROGRESS_ERROR(progress, ("Failed to encrypt hard disk"));
+        else
+            RTMsgError("Failed to encrypt hard disk!");
+    }
+
+    return SUCCEEDED(rc) ? 0 : 1;
+}
+
+int handleCheckMediumPassword(HandlerArg *a)
+{
+    HRESULT rc;
+    ComPtr<IMedium> hardDisk;
+    const char *pszFilenameOrUuid = NULL;
+    Utf8Str strPassword;
+
+    if (a->argc != 2)
+        return errorSyntax(USAGE_MEDIUMENCCHKPWD, "Invalid number of arguments: %d", a->argc);
+
+    pszFilenameOrUuid = a->argv[0];
+
+    if (!RTStrCmp(a->argv[1], "-"))
+    {
+        /* Get password from console. */
+        RTEXITCODE rcExit = readPasswordFromConsole(&strPassword, "Enter password:");
+        if (rcExit == RTEXITCODE_FAILURE)
+            return rcExit;
+    }
+    else
+    {
+        RTEXITCODE rcExit = readPasswordFile(a->argv[1], &strPassword);
+        if (rcExit == RTEXITCODE_FAILURE)
+        {
+            RTMsgError("Failed to read password from file");
+            return rcExit;
+        }
+    }
+
+    /* Always open the medium if necessary, there is no other way. */
+    rc = openMedium(a, pszFilenameOrUuid, DeviceType_HardDisk,
+                    AccessMode_ReadWrite, hardDisk,
+                    false /* fForceNewUuidOnOpen */, false /* fSilent */);
+    if (FAILED(rc))
+        return 1;
+    if (hardDisk.isNull())
+    {
+        RTMsgError("Invalid hard disk reference, avoiding crash");
+        return 1;
+    }
+
+    CHECK_ERROR(hardDisk, CheckEncryptionPassword(Bstr(strPassword).raw()));
+    if (SUCCEEDED(rc))
+        RTPrintf("The given password is correct\n");
+    return SUCCEEDED(rc) ? 0 : 1;
+}
+
 #endif /* !VBOX_ONLY_DOCS */
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
index ab9bbad..ce2fd5b 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -45,6 +45,7 @@
 #include <iprt/path.h>
 #include <iprt/process.h> /* For RTProcSelf(). */
 #include <iprt/thread.h>
+#include <iprt/vfs.h>
 
 #include <map>
 #include <vector>
@@ -62,10 +63,48 @@
 
 using namespace com;
 
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define GCTLCMD_COMMON_OPT_USER             999 /**< The --username option number. */
+#define GCTLCMD_COMMON_OPT_PASSWORD         998 /**< The --password option number. */
+#define GCTLCMD_COMMON_OPT_PASSWORD_FILE    997 /**< The --password-file option number. */
+#define GCTLCMD_COMMON_OPT_DOMAIN           996 /**< The --domain option number. */
+/** Common option definitions. */
+#define GCTLCMD_COMMON_OPTION_DEFS() \
+        { "--username",             GCTLCMD_COMMON_OPT_USER,            RTGETOPT_REQ_STRING  }, \
+        { "--passwordfile",         GCTLCMD_COMMON_OPT_PASSWORD_FILE,   RTGETOPT_REQ_STRING  }, \
+        { "--password",             GCTLCMD_COMMON_OPT_PASSWORD,        RTGETOPT_REQ_STRING  }, \
+        { "--domain",               GCTLCMD_COMMON_OPT_DOMAIN,          RTGETOPT_REQ_STRING  }, \
+        { "--quiet",                'q',                                RTGETOPT_REQ_NOTHING }, \
+        { "--verbose",              'v',                                RTGETOPT_REQ_NOTHING },
+
+/** Handles common options in the typical option parsing switch. */
+#define GCTLCMD_COMMON_OPTION_CASES(a_pCtx, a_ch, a_pValueUnion) \
+        case 'v': \
+        case 'q': \
+        case GCTLCMD_COMMON_OPT_USER: \
+        case GCTLCMD_COMMON_OPT_DOMAIN: \
+        case GCTLCMD_COMMON_OPT_PASSWORD: \
+        case GCTLCMD_COMMON_OPT_PASSWORD_FILE: \
+        { \
+            RTEXITCODE rcExitCommon = gctlCtxSetOption(a_pCtx, a_ch, a_pValueUnion); \
+            if (RT_UNLIKELY(rcExitCommon != RTEXITCODE_SUCCESS)) \
+                return rcExitCommon; \
+        } break
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
 /** Set by the signal handler when current guest control
  *  action shall be aborted. */
 static volatile bool g_fGuestCtrlCanceled = false;
 
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
 /**
  * Listener declarations.
  */
@@ -74,35 +113,63 @@ VBOX_LISTENER_DECLARE(GuestProcessEventListenerImpl)
 VBOX_LISTENER_DECLARE(GuestSessionEventListenerImpl)
 VBOX_LISTENER_DECLARE(GuestEventListenerImpl)
 
+
 /**
- * Command context flags.
+ * Definition of a guestcontrol command, with handler and various flags.
+ */
+typedef struct GCTLCMDDEF
+{
+    /** The command name. */
+    const char *pszName;
+
+    /**
+     * Actual command handler callback.
+     *
+     * @param   pCtx            Pointer to command context to use.
+     */
+    DECLR3CALLBACKMEMBER(RTEXITCODE, pfnHandler, (struct GCTLCMDCTX *pCtx, int argc, char **argv));
+
+    /** The command usage flags. */
+    uint32_t    fCmdUsage;
+    /** Command context flags (GCTLCMDCTX_F_XXX). */
+    uint32_t    fCmdCtx;
+} GCTLCMD;
+/** Pointer to a const guest control command definition. */
+typedef GCTLCMDDEF const *PCGCTLCMDDEF;
+
+/** @name GCTLCMDCTX_F_XXX - Command context flags.
+ * @{
  */
 /** No flags set. */
-#define CTLCMDCTX_FLAGS_NONE                0
+#define GCTLCMDCTX_F_NONE               0
 /** Don't install a signal handler (CTRL+C trap). */
-#define CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER   RT_BIT(0)
+#define GCTLCMDCTX_F_NO_SIGNAL_HANDLER  RT_BIT(0)
 /** No guest session needed. */
-#define CTLCMDCTX_FLAGS_SESSION_ANONYMOUS   RT_BIT(1)
-/** Detach the guest session. That is, don't close the
- *  guest session automatically on exit. */
-#define CTLCMDCTX_FLAGS_SESSION_DETACH      RT_BIT(2)
+#define GCTLCMDCTX_F_SESSION_ANONYMOUS  RT_BIT(1)
+/** @} */
 
 /**
  * Context for handling a specific command.
  */
 typedef struct GCTLCMDCTX
 {
-    HandlerArg handlerArg;
-    /** Command-specific argument count. */
-    int iArgc;
-    /** Command-specific argument vector. */
-    char **ppaArgv;
-    /** First argv to start parsing with. */
-    int iFirstArgc;
-    /** Command context flags. */
-    uint32_t uFlags;
-    /** Verbose flag. */
-    bool fVerbose;
+    HandlerArg *pArg;
+
+    /** Pointer to the command definition. */
+    PCGCTLCMDDEF pCmdDef;
+    /** The VM name or UUID. */
+    const char *pszVmNameOrUuid;
+
+    /** Whether we've done the post option parsing init already. */
+    bool fPostOptionParsingInited;
+    /** Whether we've locked the VM session. */
+    bool fLockedVmSession;
+    /** Whether to detach (@c true) or close the session. */
+    bool fDetachGuestSession;
+    /** Set if we've installed the signal handler.   */
+    bool fInstalledSignalHandler;
+    /** The verbosity level. */
+    uint32_t cVerbose;
     /** User name. */
     Utf8Str strUsername;
     /** Password. */
@@ -118,16 +185,6 @@ typedef struct GCTLCMDCTX
 
 } GCTLCMDCTX, *PGCTLCMDCTX;
 
-typedef struct GCTLCMD
-{
-    /**
-     * Actual command handler callback.
-     *
-     * @param   pCtx            Pointer to command context to use.
-     */
-    DECLR3CALLBACKMEMBER(RTEXITCODE, pfnHandler, (PGCTLCMDCTX pCtx));
-
-} GCTLCMD, *PGCTLCMD;
 
 typedef struct COPYCONTEXT
 {
@@ -217,34 +274,6 @@ typedef struct DESTFILEENTRY
 typedef std::map< Utf8Str, std::vector<DESTFILEENTRY> > DESTDIRMAP, *PDESTDIRMAP;
 typedef std::map< Utf8Str, std::vector<DESTFILEENTRY> >::iterator DESTDIRMAPITER, *PDESTDIRMAPITER;
 
-/**
- * Special exit codes for returning errors/information of a
- * started guest process to the command line VBoxManage was started from.
- * Useful for e.g. scripting.
- *
- * @note    These are frozen as of 4.1.0.
- */
-enum EXITCODEEXEC
-{
-    EXITCODEEXEC_SUCCESS        = RTEXITCODE_SUCCESS,
-    /* Process exited normally but with an exit code <> 0. */
-    EXITCODEEXEC_CODE           = 16,
-    EXITCODEEXEC_FAILED         = 17,
-    EXITCODEEXEC_TERM_SIGNAL    = 18,
-    EXITCODEEXEC_TERM_ABEND     = 19,
-    EXITCODEEXEC_TIMEOUT        = 20,
-    EXITCODEEXEC_DOWN           = 21,
-    EXITCODEEXEC_CANCELED       = 22
-};
-
-/*
- * Common getopt definitions, starting at 1000.
- * Specific command definitions will start all at 2000.
- */
-enum GETOPTDEF_COMMON
-{
-    GETOPTDEF_COMMON_PASSWORD = 1000
-};
 
 /**
  * RTGetOpt-IDs for the guest execution control command line.
@@ -261,166 +290,161 @@ enum GETOPTDEF_EXEC
     GETOPTDEF_EXEC_WAITFORSTDERR
 };
 
-enum GETOPTDEF_COPY
+enum kStreamTransform
 {
-    GETOPTDEF_COPY_DRYRUN = 1000,
-    GETOPTDEF_COPY_FOLLOW,
-    GETOPTDEF_COPY_TARGETDIR
+    kStreamTransform_None = 0,
+    kStreamTransform_Dos2Unix,
+    kStreamTransform_Unix2Dos
 };
 
-enum GETOPTDEF_MKDIR
-{
-};
-
-enum GETOPTDEF_RM
-{
-};
 
-enum GETOPTDEF_RMDIR
-{
-};
-
-enum GETOPTDEF_SESSIONCLOSE
-{
-    GETOPTDEF_SESSIONCLOSE_ALL = 2000
-};
-
-enum GETOPTDEF_STAT
-{
-};
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static int gctlCopyDirExists(PCOPYCONTEXT pContext, bool bGuest, const char *pszDir, bool *fExists);
 
-enum OUTPUTTYPE
-{
-    OUTPUTTYPE_UNDEFINED = 0,
-    OUTPUTTYPE_DOS2UNIX  = 10,
-    OUTPUTTYPE_UNIX2DOS  = 20
-};
+#endif /* VBOX_ONLY_DOCS */
 
-static int ctrlCopyDirExists(PCOPYCONTEXT pContext, bool bGuest, const char *pszDir, bool *fExists);
 
-#endif /* VBOX_ONLY_DOCS */
 
 void usageGuestControl(PRTSTREAM pStrm, const char *pcszSep1, const char *pcszSep2, uint32_t uSubCmd)
 {
-    RTStrmPrintf(pStrm,
-                       "%s guestcontrol %s    <uuid|vmname>\n%s",
-                 pcszSep1, pcszSep2,
-                 uSubCmd == ~0U ? "\n" : "");
-    if (uSubCmd & USAGE_GSTCTRL_EXEC)
-        RTStrmPrintf(pStrm,
-                 "                              exec[ute]\n"
-                 "                              --image <path to program> --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--domain <domain>] [--verbose] [--timeout <msec>]\n"
-                 "                              [--environment \"<NAME>=<VALUE> [<NAME>=<VALUE>]\"]\n"
-                 "                              [--wait-exit] [--wait-stdout] [--wait-stderr]\n"
-                 "                              [--dos2unix] [--unquoted-args] [--unix2dos]\n"
-                 "                              [-- [<argument1>] ... [<argumentN>]]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_COPYFROM)
+    const uint32_t fAnonSubCmds = USAGE_GSTCTRL_CLOSESESSION
+                                | USAGE_GSTCTRL_LIST
+                                | USAGE_GSTCTRL_CLOSEPROCESS
+                                | USAGE_GSTCTRL_CLOSESESSION
+                                | USAGE_GSTCTRL_UPDATEGA
+                                | USAGE_GSTCTRL_WATCH;
+
+    /*                0         1         2         3         4         5         6         7         8XXXXXXXXXX */
+    /*                0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 */
+    if (~fAnonSubCmds & uSubCmd)
         RTStrmPrintf(pStrm,
-                 "                              copyfrom\n"
-                 "                              <guest source> <host dest> --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--domain <domain>] [--verbose]\n"
-                 "                              [--dryrun] [--follow] [--recursive]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_COPYTO)
+                     "%s guestcontrol %s    <uuid|vmname> [--verbose|-v] [--quiet|-q]\n"
+                     "                              [--username <name>] [--domain <domain>]\n"
+                     "                              [--passwordfile <file> | --password <password>]\n%s",
+                     pcszSep1, pcszSep2, uSubCmd == ~0U ? "\n" : "");
+    if (uSubCmd & USAGE_GSTCTRL_RUN)
         RTStrmPrintf(pStrm,
-                 "                              copyto|cp\n"
-                 "                              <host source> <guest dest> --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--domain <domain>] [--verbose]\n"
-                 "                              [--dryrun] [--follow] [--recursive]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_CREATEDIR)
+                     "                              run [common-options]\n"
+                     "                              [--exe <path to executable>] [--timeout <msec>]\n"
+                     "                              [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]\n"
+                     "                              [--ignore-operhaned-processes] [--no-profile]\n"
+                     "                              [--no-wait-stdout|--wait-stdout]\n"
+                     "                              [--no-wait-stderr|--wait-stderr]\n"
+                     "                              [--dos2unix] [--unix2dos]\n"
+                     "                              -- <program/arg0> [argument1] ... [argumentN]]\n"
+                     "\n");
+    if (uSubCmd & USAGE_GSTCTRL_START)
         RTStrmPrintf(pStrm,
-                 "                              createdir[ectory]|mkdir|md\n"
-                 "                              <guest directory>... --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--domain <domain>] [--verbose]\n"
-                 "                              [--parents] [--mode <mode>]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_REMOVEDIR)
+                     "                              start [common-options]\n"
+                     "                              [--exe <path to executable>] [--timeout <msec>]\n"
+                     "                              [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]\n"
+                     "                              [--ignore-operhaned-processes] [--no-profile]\n"
+                     "                              -- <program/arg0> [argument1] ... [argumentN]]\n"
+                     "\n");
+    if (uSubCmd & USAGE_GSTCTRL_COPYFROM)
         RTStrmPrintf(pStrm,
-                 "                              removedir[ectory]|rmdir\n"
-                 "                              <guest directory>... --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--domain <domain>] [--verbose]\n"
-                 "                              [--recursive|-R|-r]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_REMOVEFILE)
+                     "                              copyfrom [common-options]\n"
+                     "                              [--dryrun] [--follow] [-R|--recursive]\n"
+                     "                              <guest-src0> [guest-src1 [...]] <host-dst>\n"
+                     "\n"
+                     "                              copyfrom [common-options]\n"
+                     "                              [--dryrun] [--follow] [-R|--recursive]\n"
+                     "                              [--target-directory <host-dst-dir>]\n"
+                     "                              <guest-src0> [guest-src1 [...]]\n"
+                     "\n");
+    if (uSubCmd & USAGE_GSTCTRL_COPYTO)
         RTStrmPrintf(pStrm,
-                 "                              removefile|rm\n"
-                 "                              <guest file>... --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--domain <domain>] [--verbose]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_RENAME)
+                     "                              copyto [common-options]\n"
+                     "                              [--dryrun] [--follow] [-R|--recursive]\n"
+                     "                              <host-src0> [host-src1 [...]] <guest-dst>\n"
+                     "\n"
+                     "                              copyto [common-options]\n"
+                     "                              [--dryrun] [--follow] [-R|--recursive]\n"
+                     "                              [--target-directory <guest-dst>]\n"
+                     "                              <host-src0> [host-src1 [...]]\n"
+                     "\n");
+    if (uSubCmd & USAGE_GSTCTRL_MKDIR)
         RTStrmPrintf(pStrm,
-                 "                              ren[ame]|mv\n"
-                 "                              <source>... <dest> --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--domain <domain>] [--verbose]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_CREATETEMP)
+                     "                              mkdir|createdir[ectory] [common-options]\n"
+                     "                              [--parents] [--mode <mode>]\n"
+                     "                              <guest directory> [...]\n"
+                     "\n");
+    if (uSubCmd & USAGE_GSTCTRL_RMDIR)
         RTStrmPrintf(pStrm,
-                 "                              createtemp[orary]|mktemp\n"
-                 "                              <template> --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--directory] [--secure] [--tmpdir <directory>]\n"
-                 "                              [--domain <domain>] [--mode <mode>] [--verbose]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_LIST)
+                     "                              rmdir|removedir[ectory] [common-options]\n"
+                     "                              [-R|--recursive]\n"
+                     "                              <guest directory> [...]\n"
+                     "\n");
+    if (uSubCmd & USAGE_GSTCTRL_RM)
         RTStrmPrintf(pStrm,
-                 "                              list <all|sessions|processes|files> [--verbose]\n"
-                 "\n");
-    /** @todo Add an own help group for "session" and "process" sub commands. */
-    if (uSubCmd & USAGE_GSTCTRL_PROCESS)
-         RTStrmPrintf(pStrm,
-                 "                              process kill --session-id <ID>\n"
-                 "                                           | --session-name <name or pattern>\n"
-                 "                                           [--verbose]\n"
-                 "                                           <PID> ... <PID n>\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_KILL)
+                     "                              removefile|rm [common-options] [-f|--force]\n"
+                     "                              <guest file> [...]\n"
+                     "\n");
+    if (uSubCmd & USAGE_GSTCTRL_MV)
         RTStrmPrintf(pStrm,
-                 "                              [p[s]]kill --session-id <ID>\n"
-                 "                                         | --session-name <name or pattern>\n"
-                 "                                         [--verbose]\n"
-                 "                                         <PID> ... <PID n>\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_SESSION)
+                     "                              mv|move|ren[ame] [common-options]\n"
+                     "                              <source> [source1 [...]] <dest>\n"
+                     "\n");
+    if (uSubCmd & USAGE_GSTCTRL_MKTEMP)
         RTStrmPrintf(pStrm,
-                 "                              session close  --session-id <ID>\n"
-                 "                                           | --session-name <name or pattern>\n"
-                 "                                           | --all\n"
-                 "                                           [--verbose]\n"
-                 "\n");
+                     "                              mktemp|createtemp[orary] [common-options]\n"
+                     "                              [--secure] [--mode <mode>] [--tmpdir <directory>]\n"
+                     "                              <template>\n"
+                     "\n");
     if (uSubCmd & USAGE_GSTCTRL_STAT)
         RTStrmPrintf(pStrm,
-                 "                              stat\n"
-                 "                              <file>... --username <name>\n"
-                 "                              [--passwordfile <file> | --password <password>]\n"
-                 "                              [--domain <domain>] [--verbose]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_UPDATEADDS)
-        RTStrmPrintf(pStrm,
-                 "                              updateadditions\n"
-                 "                              [--source <guest additions .ISO>] [--verbose]\n"
-                 "                              [--wait-start]\n"
-                 "                              [-- [<argument1>] ... [<argumentN>]]\n"
-                 "\n");
-    if (uSubCmd & USAGE_GSTCTRL_WATCH)
+                     "                              stat [common-options]\n"
+                     "                              <file> [...]\n"
+                     "\n");
+
+    /*
+     * Command not requiring authentication.
+     */
+    if (fAnonSubCmds & uSubCmd)
+    {
+        /*                0         1         2         3         4         5         6         7         8XXXXXXXXXX */
+        /*                0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 */
         RTStrmPrintf(pStrm,
-                 "                              watch [--verbose]\n"
-                 "\n");
+                     "%s guestcontrol %s    <uuid|vmname> [--verbose|-v] [--quiet|-q]\n%s",
+                     pcszSep1, pcszSep2, uSubCmd == ~0U ? "\n" : "");
+        if (uSubCmd & USAGE_GSTCTRL_LIST)
+            RTStrmPrintf(pStrm,
+                     "                              list <all|sessions|processes|files> [common-opts]\n"
+                     "\n");
+        if (uSubCmd & USAGE_GSTCTRL_CLOSEPROCESS)
+            RTStrmPrintf(pStrm,
+                     "                              closeprocess [common-options]\n"
+                     "                              <   --session-id <ID>\n"
+                     "                                | --session-name <name or pattern>\n"
+                     "                              <PID1> [PID1 [...]]\n"
+                     "\n");
+        if (uSubCmd & USAGE_GSTCTRL_CLOSESESSION)
+            RTStrmPrintf(pStrm,
+                     "                              closesession [common-options]\n"
+                     "                              <  --all | --session-id <ID>\n"
+                     "                                | --session-name <name or pattern> >\n"
+                     "\n");
+        if (uSubCmd & USAGE_GSTCTRL_UPDATEGA)
+            RTStrmPrintf(pStrm,
+                     "                              updatega|updateguestadditions|updateadditions\n"
+                     "                              [--source <guest additions .ISO>]\n"
+                     "                              [--wait-start] [common-options]\n"
+                     "                              [-- [<argument1>] ... [<argumentN>]]\n"
+                     "\n");
+        if (uSubCmd & USAGE_GSTCTRL_WATCH)
+            RTStrmPrintf(pStrm,
+                     "                              watch [common-options]\n"
+                     "\n");
+    }
 }
 
 #ifndef VBOX_ONLY_DOCS
 
+
 #ifdef RT_OS_WINDOWS
-static BOOL WINAPI guestCtrlSignalHandler(DWORD dwCtrlType)
+static BOOL WINAPI gctlSignalHandler(DWORD dwCtrlType)
 {
     bool fEventHandled = FALSE;
     switch (dwCtrlType)
@@ -448,41 +472,45 @@ static BOOL WINAPI guestCtrlSignalHandler(DWORD dwCtrlType)
  * a thread dedicated to delivering this signal.  Don't do anything
  * unnecessary here.
  */
-static void guestCtrlSignalHandler(int iSignal)
+static void gctlSignalHandler(int iSignal)
 {
     NOREF(iSignal);
     ASMAtomicWriteBool(&g_fGuestCtrlCanceled, true);
 }
 #endif
 
+
 /**
  * Installs a custom signal handler to get notified
  * whenever the user wants to intercept the program.
  *
- ** @todo Make this handler available for all VBoxManage modules?
+ * @todo Make this handler available for all VBoxManage modules?
  */
-static int ctrlSignalHandlerInstall(void)
+static int gctlSignalHandlerInstall(void)
 {
+    g_fGuestCtrlCanceled = false;
+
     int rc = VINF_SUCCESS;
 #ifdef RT_OS_WINDOWS
-    if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)guestCtrlSignalHandler, TRUE /* Add handler */))
+    if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE)gctlSignalHandler, TRUE /* Add handler */))
     {
         rc = RTErrConvertFromWin32(GetLastError());
         RTMsgError("Unable to install console control handler, rc=%Rrc\n", rc);
     }
 #else
-    signal(SIGINT,   guestCtrlSignalHandler);
+    signal(SIGINT,   gctlSignalHandler);
 # ifdef SIGBREAK
-    signal(SIGBREAK, guestCtrlSignalHandler);
+    signal(SIGBREAK, gctlSignalHandler);
 # endif
 #endif
     return rc;
 }
 
+
 /**
  * Uninstalls a previously installed signal handler.
  */
-static int ctrlSignalHandlerUninstall(void)
+static int gctlSignalHandlerUninstall(void)
 {
     int rc = VINF_SUCCESS;
 #ifdef RT_OS_WINDOWS
@@ -500,11 +528,11 @@ static int ctrlSignalHandlerUninstall(void)
     return rc;
 }
 
+
 /**
- * Translates a process status to a human readable
- * string.
+ * Translates a process status to a human readable string.
  */
-const char *ctrlProcessStatusToText(ProcessStatus_T enmStatus)
+const char *gctlProcessStatusToText(ProcessStatus_T enmStatus)
 {
     switch (enmStatus)
     {
@@ -536,54 +564,10 @@ const char *ctrlProcessStatusToText(ProcessStatus_T enmStatus)
     return "unknown";
 }
 
-static int ctrlExecProcessStatusToExitCode(ProcessStatus_T enmStatus, ULONG uExitCode)
-{
-    int vrc = EXITCODEEXEC_SUCCESS;
-    switch (enmStatus)
-    {
-        case ProcessStatus_Starting:
-            vrc = EXITCODEEXEC_SUCCESS;
-            break;
-        case ProcessStatus_Started:
-            vrc = EXITCODEEXEC_SUCCESS;
-            break;
-        case ProcessStatus_Paused:
-            vrc = EXITCODEEXEC_SUCCESS;
-            break;
-        case ProcessStatus_Terminating:
-            vrc = EXITCODEEXEC_SUCCESS;
-            break;
-        case ProcessStatus_TerminatedNormally:
-            vrc = !uExitCode ? EXITCODEEXEC_SUCCESS : EXITCODEEXEC_CODE;
-            break;
-        case ProcessStatus_TerminatedSignal:
-            vrc = EXITCODEEXEC_TERM_SIGNAL;
-            break;
-        case ProcessStatus_TerminatedAbnormally:
-            vrc = EXITCODEEXEC_TERM_ABEND;
-            break;
-        case ProcessStatus_TimedOutKilled:
-            vrc = EXITCODEEXEC_TIMEOUT;
-            break;
-        case ProcessStatus_TimedOutAbnormally:
-            vrc = EXITCODEEXEC_TIMEOUT;
-            break;
-        case ProcessStatus_Down:
-            /* Service/OS is stopping, process was killed, so
-             * not exactly an error of the started process ... */
-            vrc = EXITCODEEXEC_DOWN;
-            break;
-        case ProcessStatus_Error:
-            vrc = EXITCODEEXEC_FAILED;
-            break;
-        default:
-            AssertMsgFailed(("Unknown exit code (%u) from guest process returned!\n", enmStatus));
-            break;
-    }
-    return vrc;
-}
-
-const char *ctrlProcessWaitResultToText(ProcessWaitResult_T enmWaitResult)
+/**
+ * Translates a guest process wait result to a human readable string.
+ */
+const char *gctlProcessWaitResultToText(ProcessWaitResult_T enmWaitResult)
 {
     switch (enmWaitResult)
     {
@@ -612,10 +596,9 @@ const char *ctrlProcessWaitResultToText(ProcessWaitResult_T enmWaitResult)
 }
 
 /**
- * Translates a guest session status to a human readable
- * string.
+ * Translates a guest session status to a human readable string.
  */
-const char *ctrlSessionStatusToText(GuestSessionStatus_T enmStatus)
+const char *gctlGuestSessionStatusToText(GuestSessionStatus_T enmStatus)
 {
     switch (enmStatus)
     {
@@ -642,10 +625,9 @@ const char *ctrlSessionStatusToText(GuestSessionStatus_T enmStatus)
 }
 
 /**
- * Translates a guest file status to a human readable
- * string.
+ * Translates a guest file status to a human readable string.
  */
-const char *ctrlFileStatusToText(FileStatus_T enmStatus)
+const char *gctlFileStatusToText(FileStatus_T enmStatus)
 {
     switch (enmStatus)
     {
@@ -667,7 +649,7 @@ const char *ctrlFileStatusToText(FileStatus_T enmStatus)
     return "unknown";
 }
 
-static int ctrlPrintError(com::ErrorInfo &errorInfo)
+static int gctlPrintError(com::ErrorInfo &errorInfo)
 {
     if (   errorInfo.isFullAvailable()
         || errorInfo.isBasicAvailable())
@@ -687,13 +669,13 @@ static int ctrlPrintError(com::ErrorInfo &errorInfo)
                           VERR_INVALID_PARAMETER);
 }
 
-static int ctrlPrintError(IUnknown *pObj, const GUID &aIID)
+static int gctlPrintError(IUnknown *pObj, const GUID &aIID)
 {
     com::ErrorInfo ErrInfo(pObj, aIID);
-    return ctrlPrintError(ErrInfo);
+    return gctlPrintError(ErrInfo);
 }
 
-static int ctrlPrintProgressError(ComPtr<IProgress> pProgress)
+static int gctlPrintProgressError(ComPtr<IProgress> pProgress)
 {
     int vrc = VINF_SUCCESS;
     HRESULT rc;
@@ -709,7 +691,7 @@ static int ctrlPrintProgressError(ComPtr<IProgress> pProgress)
             if (FAILED(rcProc))
             {
                 com::ProgressErrorInfo ErrInfo(pProgress);
-                vrc = ctrlPrintError(ErrInfo);
+                vrc = gctlPrintError(ErrInfo);
             }
         }
 
@@ -720,402 +702,568 @@ static int ctrlPrintProgressError(ComPtr<IProgress> pProgress)
     return vrc;
 }
 
+
+
+/*
+ *
+ *
+ * Guest Control Command Context
+ * Guest Control Command Context
+ * Guest Control Command Context
+ * Guest Control Command Context
+ *
+ *
+ *
+ */
+
+
 /**
- * Un-initializes the VM after guest control usage.
- * @param   pCmdCtx                 Pointer to command context.
- * @param   uFlags                  Command context flags.
+ * Initializes a guest control command context structure.
+ *
+ * @returns RTEXITCODE_SUCCESS on success, RTEXITCODE_FAILURE on failure (after
+ *           informing the user of course).
+ * @param   pCtx                The command context to init.
+ * @param   pArg                The handle argument package.
  */
-static void ctrlUninitVM(PGCTLCMDCTX pCtx, uint32_t uFlags)
+static RTEXITCODE gctrCmdCtxInit(PGCTLCMDCTX pCtx, HandlerArg *pArg)
 {
-    AssertPtrReturnVoid(pCtx);
+    RT_ZERO(*pCtx);
+    pCtx->pArg = pArg;
 
-    if (!(pCtx->uFlags & CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER))
-        ctrlSignalHandlerUninstall();
+    /*
+     * The user name defaults to the host one, if we can get at it.
+     */
+    char szUser[1024];
+    int rc = RTProcQueryUsername(RTProcSelf(), szUser, sizeof(szUser), NULL);
+    if (   RT_SUCCESS(rc)
+        && RTStrIsValidEncoding(szUser)) /* paranoia required on posix */
+    {
+        try
+        {
+            pCtx->strUsername = szUser;
+        }
+        catch (std::bad_alloc &)
+        {
+            return RTMsgErrorExit(RTEXITCODE_FAILURE, "Out of memory");
+        }
+    }
+    /* else: ignore this failure. */
 
-    HRESULT rc;
+    return RTEXITCODE_SUCCESS;
+}
 
-    do
+
+/**
+ * Worker for GCTLCMD_COMMON_OPTION_CASES.
+ *
+ * @returns RTEXITCODE_SUCCESS if the option was handled successfully.  If not,
+ *          an error message is printed and an appropriate failure exit code is
+ *          returned.
+ * @param   pCtx                The guest control command context.
+ * @param   ch                  The option char or ordinal.
+ * @param   pValueUnion         The option value union.
+ */
+static RTEXITCODE gctlCtxSetOption(PGCTLCMDCTX pCtx, int ch, PRTGETOPTUNION pValueUnion)
+{
+    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
+    switch (ch)
     {
-        if (!pCtx->pGuestSession.isNull())
-        {
-            if (   !(pCtx->uFlags & CTLCMDCTX_FLAGS_SESSION_ANONYMOUS)
-                && !(pCtx->uFlags & CTLCMDCTX_FLAGS_SESSION_DETACH))
-            {
-                if (pCtx->fVerbose)
-                    RTPrintf("Closing guest session ...\n");
+        case GCTLCMD_COMMON_OPT_USER: /* User name */
+            if (!pCtx->pCmdDef || !(pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_SESSION_ANONYMOUS))
+                pCtx->strUsername = pValueUnion->psz;
+            else
+                RTMsgWarning("The --username|-u option is ignored by '%s'", pCtx->pCmdDef->pszName);
+            break;
 
-                CHECK_ERROR(pCtx->pGuestSession, Close());
-                /* Keep going - don't break here. Try to unlock the
-                 * machine down below. */
+        case GCTLCMD_COMMON_OPT_PASSWORD: /* Password */
+            if (!pCtx->pCmdDef || !(pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_SESSION_ANONYMOUS))
+            {
+                if (pCtx->strPassword.isNotEmpty())
+                    RTMsgWarning("Password is given more than once.");
+                pCtx->strPassword = pValueUnion->psz;
             }
-            else if (   (pCtx->uFlags & CTLCMDCTX_FLAGS_SESSION_DETACH)
-                     && pCtx->fVerbose)
-                RTPrintf("Guest session detached\n");
+            else
+                RTMsgWarning("The --password option is ignored by '%s'", pCtx->pCmdDef->pszName);
+            break;
 
-            pCtx->pGuestSession.setNull();
-        }
+        case GCTLCMD_COMMON_OPT_PASSWORD_FILE: /* Password file */
+            if (!pCtx->pCmdDef || !(pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_SESSION_ANONYMOUS))
+                rcExit = readPasswordFile(pValueUnion->psz, &pCtx->strPassword);
+            else
+                RTMsgWarning("The --password-file|-p option is ignored by '%s'", pCtx->pCmdDef->pszName);
+            break;
 
-        if (pCtx->handlerArg.session)
-            CHECK_ERROR(pCtx->handlerArg.session, UnlockMachine());
+        case GCTLCMD_COMMON_OPT_DOMAIN: /* domain */
+            if (!pCtx->pCmdDef || !(pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_SESSION_ANONYMOUS))
+                pCtx->strDomain = pValueUnion->psz;
+            else
+                RTMsgWarning("The --domain option is ignored by '%s'", pCtx->pCmdDef->pszName);
+            break;
 
-    } while (0);
+        case 'v': /* --verbose */
+            pCtx->cVerbose++;
+            break;
 
-    for (int i = 0; i < pCtx->iArgc; i++)
-        RTStrFree(pCtx->ppaArgv[i]);
-    RTMemFree(pCtx->ppaArgv);
-    pCtx->iArgc = 0;
+        case 'q': /* --quiet */
+            if (pCtx->cVerbose)
+                pCtx->cVerbose--;
+            break;
+
+        default:
+            AssertFatalMsgFailed(("ch=%d (%c)\n", ch, ch));
+    }
+    return rcExit;
 }
 
+
 /**
- * Initializes the VM for IGuest operations.
+ * Initializes the VM for IGuest operation.
  *
- * That is, checks whether it's up and running, if it can be locked (shared
- * only) and returns a valid IGuest pointer on success. Also, it does some
- * basic command line processing and opens a guest session, if required.
+ * This opens a shared session to a running VM and gets hold of IGuest.
  *
- * @return  RTEXITCODE status code.
- * @param   pArg                    Pointer to command line argument structure.
- * @param   pCmdCtx                 Pointer to command context.
- * @param   uFlags                  Command context flags.
+ * @returns RTEXITCODE_SUCCESS on success.  RTEXITCODE_FAILURE and user message
+ *          on failure.
+ * @param   pCtx            The guest control command context.
+ *                          GCTLCMDCTX::pGuest will be set on success.
  */
-static RTEXITCODE ctrlInitVM(HandlerArg *pArg,
-                             PGCTLCMDCTX pCtx, uint32_t uFlags, uint32_t uUsage)
+static RTEXITCODE gctlCtxInitVmSession(PGCTLCMDCTX pCtx)
 {
-    AssertPtrReturn(pArg, RTEXITCODE_FAILURE);
-    AssertReturn(pArg->argc > 1, RTEXITCODE_FAILURE);
-    AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
-
-#ifdef DEBUG_andy
-    RTPrintf("Original argv:\n");
-    for (int i=0; i<pArg->argc;i++)
-        RTPrintf("\targv[%d]=%s\n", i, pArg->argv[i]);
-#endif
-
-    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
-
-    const char *pszNameOrId = pArg->argv[0];
-    const char *pszCmd = pArg->argv[1];
+    HRESULT rc;
+    AssertPtr(pCtx);
+    AssertPtr(pCtx->pArg);
 
-    /* Lookup VM. */
+    /*
+     * Find the VM and check if it's running.
+     */
     ComPtr<IMachine> machine;
-    /* Assume it's an UUID. */
-    HRESULT rc;
-    CHECK_ERROR(pArg->virtualBox, FindMachine(Bstr(pszNameOrId).raw(),
-                                              machine.asOutParam()));
+    CHECK_ERROR(pCtx->pArg->virtualBox, FindMachine(Bstr(pCtx->pszVmNameOrUuid).raw(), machine.asOutParam()));
     if (SUCCEEDED(rc))
     {
-        /* Machine is running? */
-        MachineState_T machineState;
-        CHECK_ERROR(machine, COMGETTER(State)(&machineState));
+        MachineState_T enmMachineState;
+        CHECK_ERROR(machine, COMGETTER(State)(&enmMachineState));
         if (   SUCCEEDED(rc)
-            && (machineState != MachineState_Running))
-            rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Machine \"%s\" is not running (currently %s)!\n",
-                                    pszNameOrId, machineStateToName(machineState, false));
+            && enmMachineState == MachineState_Running)
+        {
+            /*
+             * It's running. So, open a session to it and get the IGuest interface.
+             */
+            CHECK_ERROR(machine, LockMachine(pCtx->pArg->session, LockType_Shared));
+            if (SUCCEEDED(rc))
+            {
+                pCtx->fLockedVmSession = true;
+                ComPtr<IConsole> ptrConsole;
+                CHECK_ERROR(pCtx->pArg->session, COMGETTER(Console)(ptrConsole.asOutParam()));
+                if (SUCCEEDED(rc))
+                {
+                    CHECK_ERROR(ptrConsole, COMGETTER(Guest)(pCtx->pGuest.asOutParam()));
+                    if (SUCCEEDED(rc))
+                        return RTEXITCODE_SUCCESS;
+                }
+            }
+        }
+        else if(SUCCEEDED(rc))
+            RTMsgError("Machine \"%s\" is not running (currently %s)!\n",
+                       pCtx->pszVmNameOrUuid, machineStateToName(enmMachineState, false));
     }
-    else
-        rcExit = RTEXITCODE_FAILURE;
+    return RTEXITCODE_FAILURE;
+}
 
-    if (rcExit == RTEXITCODE_SUCCESS)
+
+/**
+ * Creates a guest session with the VM.
+ *
+ * @retval  RTEXITCODE_SUCCESS on success.
+ * @retval  RTEXITCODE_FAILURE and user message on failure.
+ * @param   pCtx            The guest control command context.
+ *                          GCTCMDCTX::pGuestSession and GCTLCMDCTX::uSessionID
+ *                          will be set.
+ */
+static RTEXITCODE gctlCtxInitGuestSession(PGCTLCMDCTX pCtx)
+{
+    HRESULT rc;
+    AssertPtr(pCtx);
+    Assert(!(pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_SESSION_ANONYMOUS));
+    Assert(pCtx->pGuest.isNotNull());
+
+    /*
+     * Build up a reasonable guest session name. Useful for identifying
+     * a specific session when listing / searching for them.
+     */
+    char *pszSessionName;
+    if (RTStrAPrintf(&pszSessionName,
+                     "[%RU32] VBoxManage Guest Control [%s] - %s",
+                     RTProcSelf(), pCtx->pszVmNameOrUuid, pCtx->pCmdDef->pszName) < 0)
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "No enough memory for session name");
+
+    /*
+     * Create a guest session.
+     */
+    if (pCtx->cVerbose > 1)
+        RTPrintf("Creating guest session as user '%s'...\n", pCtx->strUsername.c_str());
+    try
+    {
+        CHECK_ERROR(pCtx->pGuest, CreateSession(Bstr(pCtx->strUsername).raw(),
+                                                Bstr(pCtx->strPassword).raw(),
+                                                Bstr(pCtx->strDomain).raw(),
+                                                Bstr(pszSessionName).raw(),
+                                                pCtx->pGuestSession.asOutParam()));
+    }
+    catch (std::bad_alloc &)
+    {
+        RTMsgError("Out of memory setting up IGuest::CreateSession call");
+        rc = E_OUTOFMEMORY;
+    }
+    if (SUCCEEDED(rc))
     {
         /*
-         * Process standard options which are served by all commands.
+         * Wait for guest session to start.
          */
-        static const RTGETOPTDEF s_aOptions[] =
+        if (pCtx->cVerbose > 1)
+            RTPrintf("Waiting for guest session to start...\n");
+        GuestSessionWaitResult_T enmWaitResult;
+        try
         {
-            { "--username",            'u',                             RTGETOPT_REQ_STRING  },
-            { "--passwordfile",        'p',                             RTGETOPT_REQ_STRING  },
-            { "--password",            GETOPTDEF_COMMON_PASSWORD,       RTGETOPT_REQ_STRING  },
-            { "--domain",              'd',                             RTGETOPT_REQ_STRING  },
-            { "--verbose",             'v',                             RTGETOPT_REQ_NOTHING }
-        };
-
-        /*
-         * Allocate per-command argv. This then only contains the specific arguments
-         * the command needs.
-         */
-        pCtx->ppaArgv = (char**)RTMemAlloc(pArg->argc * sizeof(char*) + 1);
-        if (!pCtx->ppaArgv)
+            com::SafeArray<GuestSessionWaitForFlag_T> aSessionWaitFlags;
+            aSessionWaitFlags.push_back(GuestSessionWaitForFlag_Start);
+            CHECK_ERROR(pCtx->pGuestSession, WaitForArray(ComSafeArrayAsInParam(aSessionWaitFlags),
+                                                          /** @todo Make session handling timeouts configurable. */
+                                                          30 * 1000, &enmWaitResult));
+        }
+        catch (std::bad_alloc &)
         {
-            rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Not enough memory for per-command argv\n");
+            RTMsgError("Out of memory setting up IGuestSession::WaitForArray call");
+            rc = E_OUTOFMEMORY;
         }
-        else
+        if (SUCCEEDED(rc))
         {
-            pCtx->iArgc = 0;
-
-            int iArgIdx = 2; /* Skip VM name and guest control command */
-            int ch;
-            RTGETOPTUNION ValueUnion;
-            RTGETOPTSTATE GetState;
-            RTGetOptInit(&GetState, pArg->argc, pArg->argv,
-                         s_aOptions, RT_ELEMENTS(s_aOptions),
-                         iArgIdx, 0);
-
-            while (   (ch = RTGetOpt(&GetState, &ValueUnion))
-                   && (rcExit == RTEXITCODE_SUCCESS))
+            /* The WaitFlagNotSupported result may happen with GAs older than 4.3. */
+            if (   enmWaitResult == GuestSessionWaitResult_Start
+                || enmWaitResult == GuestSessionWaitResult_WaitFlagNotSupported)
             {
-                /* For options that require an argument, ValueUnion has received the value. */
-                switch (ch)
+                /*
+                 * Get the session ID and we're ready to rumble.
+                 */
+                CHECK_ERROR(pCtx->pGuestSession, COMGETTER(Id)(&pCtx->uSessionID));
+                if (SUCCEEDED(rc))
                 {
-                    case 'u': /* User name */
-                        if (!(uFlags & CTLCMDCTX_FLAGS_SESSION_ANONYMOUS))
-                            pCtx->strUsername = ValueUnion.psz;
-                        iArgIdx = GetState.iNext;
-                        break;
-
-                    case GETOPTDEF_COMMON_PASSWORD: /* Password */
-                        if (!(uFlags & CTLCMDCTX_FLAGS_SESSION_ANONYMOUS))
-                        {
-                            if (pCtx->strPassword.isEmpty())
-                                pCtx->strPassword = ValueUnion.psz;
-                        }
-                        iArgIdx = GetState.iNext;
-                        break;
-
-                    case 'p': /* Password file */
-                    {
-                        if (!(uFlags & CTLCMDCTX_FLAGS_SESSION_ANONYMOUS))
-                            rcExit = readPasswordFile(ValueUnion.psz, &pCtx->strPassword);
-                        iArgIdx = GetState.iNext;
-                        break;
-                    }
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Successfully started guest session (ID %RU32)\n", pCtx->uSessionID);
+                    RTStrFree(pszSessionName);
+                    return RTEXITCODE_SUCCESS;
+                }
+            }
+            else
+            {
+                GuestSessionStatus_T enmSessionStatus;
+                CHECK_ERROR(pCtx->pGuestSession, COMGETTER(Status)(&enmSessionStatus));
+                RTMsgError("Error starting guest session (current status is: %s)\n",
+                           SUCCEEDED(rc) ? gctlGuestSessionStatusToText(enmSessionStatus) : "<unknown>");
+            }
+        }
+    }
 
-                    case 'd': /* domain */
-                        if (!(uFlags & CTLCMDCTX_FLAGS_SESSION_ANONYMOUS))
-                            pCtx->strDomain = ValueUnion.psz;
-                        iArgIdx = GetState.iNext;
-                        break;
+    RTStrFree(pszSessionName);
+    return RTEXITCODE_FAILURE;
+}
 
-                    case 'v': /* Verbose */
-                        pCtx->fVerbose = true;
-                        iArgIdx = GetState.iNext;
-                        break;
 
-                    case 'h': /* Help */
-                        errorGetOptEx(USAGE_GUESTCONTROL, uUsage, ch, &ValueUnion);
-                        return RTEXITCODE_SYNTAX;
+/**
+ * Completes the guest control context initialization after parsing arguments.
+ *
+ * Will validate common arguments, open a VM session, and if requested open a
+ * guest session and install the CTRL-C signal handler.
+ *
+ * It is good to validate all the options and arguments you can before making
+ * this call.  However, the VM session, IGuest and IGuestSession interfaces are
+ * not availabe till after this call, so take care.
+ *
+ * @retval  RTEXITCODE_SUCCESS on success.
+ * @retval  RTEXITCODE_FAILURE and user message on failure.
+ * @param   pCtx            The guest control command context.
+ *                          GCTCMDCTX::pGuestSession and GCTLCMDCTX::uSessionID
+ *                          will be set.
+ * @remarks Can safely be called multiple times, will only do work once.
+ */
+static RTEXITCODE gctlCtxPostOptionParsingInit(PGCTLCMDCTX pCtx)
+{
+    if (pCtx->fPostOptionParsingInited)
+        return RTEXITCODE_SUCCESS;
 
-                    default:
-                        /* Simply skip; might be handled in a specific command
-                         * handler later. */
-                        break;
+    /*
+     * Check that the user name isn't empty when we need it.
+     */
+    RTEXITCODE rcExit;
+    if (  (pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_SESSION_ANONYMOUS)
+        || pCtx->strUsername.isNotEmpty())
+    {
+        /*
+         * Open the VM session and if required, a guest session.
+         */
+        rcExit = gctlCtxInitVmSession(pCtx);
+        if (   rcExit == RTEXITCODE_SUCCESS
+            && !(pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_SESSION_ANONYMOUS))
+            rcExit = gctlCtxInitGuestSession(pCtx);
+        if (rcExit == RTEXITCODE_SUCCESS)
+        {
+            /*
+             * Install signal handler if requested (errors are ignored).
+             */
+            if (!(pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_NO_SIGNAL_HANDLER))
+            {
+                int rc = gctlSignalHandlerInstall();
+                pCtx->fInstalledSignalHandler = RT_SUCCESS(rc);
+            }
+        }
+    }
+    else
+        rcExit = errorSyntaxEx(USAGE_GUESTCONTROL, pCtx->pCmdDef->fCmdUsage, "No user name specified!");
 
-                } /* switch */
+    pCtx->fPostOptionParsingInited = rcExit == RTEXITCODE_SUCCESS;
+    return rcExit;
+}
 
-                int iArgDiff = GetState.iNext - iArgIdx;
-                if (iArgDiff)
-                {
-#ifdef DEBUG_andy
-                    RTPrintf("Not handled (iNext=%d, iArgsCur=%d):\n", GetState.iNext, iArgIdx);
-#endif
-                    for (int i = iArgIdx; i < GetState.iNext; i++)
-                    {
-                        char *pszArg = RTStrDup(pArg->argv[i]);
-                        if (!pszArg)
-                        {
-                            rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE,
-                                                    "Not enough memory for command line handling\n");
-                            break;
-                        }
-                        pCtx->ppaArgv[pCtx->iArgc] = pszArg;
-                        pCtx->iArgc++;
-#ifdef DEBUG_andy
-                        RTPrintf("\targv[%d]=%s\n", i, pArg->argv[i]);
-#endif
-                    }
 
-                    iArgIdx = GetState.iNext;
-                }
+/**
+ * Cleans up the context when the command returns.
+ *
+ * This will close any open guest session, unless the DETACH flag is set.
+ * It will also close any VM session that may be been established.  Any signal
+ * handlers we've installed will also be removed.
+ *
+ * Un-initializes the VM after guest control usage.
+ * @param   pCmdCtx                 Pointer to command context.
+ */
+static void gctlCtxTerm(PGCTLCMDCTX pCtx)
+{
+    HRESULT rc;
+    AssertPtr(pCtx);
 
-            } /* while RTGetOpt */
-        }
+    /*
+     * Uninstall signal handler.
+     */
+    if (pCtx->fInstalledSignalHandler)
+    {
+        gctlSignalHandlerUninstall();
+        pCtx->fInstalledSignalHandler = false;
     }
 
     /*
-     * Check for mandatory stuff.
+     * Close, or at least release, the guest session.
      */
-    if (rcExit == RTEXITCODE_SUCCESS)
+    if (pCtx->pGuestSession.isNotNull())
     {
-#if 0
-        RTPrintf("argc=%d\n", pCtx->iArgc);
-        for (int i = 0; i < pCtx->iArgc; i++)
-            RTPrintf("argv[%d]=%s\n", i, pCtx->ppaArgv[i]);
-#endif
-        if (!(uFlags & CTLCMDCTX_FLAGS_SESSION_ANONYMOUS))
+        if (   !(pCtx->pCmdDef->fCmdCtx & GCTLCMDCTX_F_SESSION_ANONYMOUS)
+            && !pCtx->fDetachGuestSession)
         {
-            if (pCtx->strUsername.isEmpty())
-                rcExit = errorSyntaxEx(USAGE_GUESTCONTROL, uUsage, "No user name specified!");
+            if (pCtx->cVerbose > 1)
+                RTPrintf("Closing guest session ...\n");
+
+            CHECK_ERROR(pCtx->pGuestSession, Close());
         }
+        else if (   pCtx->fDetachGuestSession
+                 && pCtx->cVerbose > 1)
+            RTPrintf("Guest session detached\n");
+
+        pCtx->pGuestSession.setNull();
     }
 
-    if (rcExit == RTEXITCODE_SUCCESS)
+    /*
+     * Close the VM session.
+     */
+    if (pCtx->fLockedVmSession)
     {
-        /*
-         * Build up a reasonable guest session name. Useful for identifying
-         * a specific session when listing / searching for them.
-         */
-        char *pszSessionName;
-        if (0 >= RTStrAPrintf(&pszSessionName,
-                              "[%RU32] VBoxManage Guest Control [%s] - %s",
-                              RTProcSelf(), pszNameOrId, pszCmd))
-            return RTMsgErrorExit(RTEXITCODE_FAILURE, "No enough memory for session name\n");
+        Assert(pCtx->pArg->session.isNotNull());
+        CHECK_ERROR(pCtx->pArg->session, UnlockMachine());
+        pCtx->fLockedVmSession = false;
+    }
+}
 
-        do
-        {
-            /* Open a session for the VM. */
-            CHECK_ERROR_BREAK(machine, LockMachine(pArg->session, LockType_Shared));
-            /* Get the associated console. */
-            ComPtr<IConsole> console;
-            CHECK_ERROR_BREAK(pArg->session, COMGETTER(Console)(console.asOutParam()));
-            /* ... and session machine. */
-            ComPtr<IMachine> sessionMachine;
-            CHECK_ERROR_BREAK(pArg->session, COMGETTER(Machine)(sessionMachine.asOutParam()));
-            /* Get IGuest interface. */
-            CHECK_ERROR_BREAK(console, COMGETTER(Guest)(pCtx->pGuest.asOutParam()));
-            if (!(uFlags & CTLCMDCTX_FLAGS_SESSION_ANONYMOUS))
-            {
-                if (pCtx->fVerbose)
-                    RTPrintf("Opening guest session as user '%s' ...\n", pCtx->strUsername.c_str());
 
-                /* Open a guest session. */
-                Assert(!pCtx->pGuest.isNull());
-                CHECK_ERROR_BREAK(pCtx->pGuest, CreateSession(Bstr(pCtx->strUsername).raw(),
-                                                              Bstr(pCtx->strPassword).raw(),
-                                                              Bstr(pCtx->strDomain).raw(),
-                                                              Bstr(pszSessionName).raw(),
-                                                              pCtx->pGuestSession.asOutParam()));
 
-                /*
-                 * Wait for guest session to start.
-                 */
-                if (pCtx->fVerbose)
-                    RTPrintf("Waiting for guest session to start ...\n");
-
-                com::SafeArray<GuestSessionWaitForFlag_T> aSessionWaitFlags;
-                aSessionWaitFlags.push_back(GuestSessionWaitForFlag_Start);
-                GuestSessionWaitResult_T sessionWaitResult;
-                CHECK_ERROR_BREAK(pCtx->pGuestSession, WaitForArray(ComSafeArrayAsInParam(aSessionWaitFlags),
-                                                                    /** @todo Make session handling timeouts configurable. */
-                                                                    30 * 1000, &sessionWaitResult));
-
-                if (   sessionWaitResult == GuestSessionWaitResult_Start
-                    /* Note: This might happen when Guest Additions < 4.3 are installed which don't
-                     *       support dedicated guest sessions. */
-                    || sessionWaitResult == GuestSessionWaitResult_WaitFlagNotSupported)
-                {
-                    CHECK_ERROR_BREAK(pCtx->pGuestSession, COMGETTER(Id)(&pCtx->uSessionID));
-                    if (pCtx->fVerbose)
-                        RTPrintf("Guest session (ID %RU32) has been started\n", pCtx->uSessionID);
-                }
-                else
-                {
-                    GuestSessionStatus_T sessionStatus;
-                    CHECK_ERROR_BREAK(pCtx->pGuestSession, COMGETTER(Status)(&sessionStatus));
-                    rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Error starting guest session (current status is: %s)\n",
-                                            ctrlSessionStatusToText(sessionStatus));
-                    break;
-                }
-            }
 
-            if (   SUCCEEDED(rc)
-                && !(uFlags & CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER))
-            {
-                ctrlSignalHandlerInstall();
-            }
 
-        } while (0);
+/*
+ *
+ *
+ * Guest Control Command Handling.
+ * Guest Control Command Handling.
+ * Guest Control Command Handling.
+ * Guest Control Command Handling.
+ * Guest Control Command Handling.
+ *
+ *
+ */
+
+
+/** @name EXITCODEEXEC_XXX - Special run exit codes.
+ *
+ * Special exit codes for returning errors/information of a started guest
+ * process to the command line VBoxManage was started from.  Useful for e.g.
+ * scripting.
+ *
+ * ASSUMING that all platforms have at least 7-bits for the exit code we can do
+ * the following mapping:
+ *  - Guest exit code 0 is mapped to 0 on the host.
+ *  - Guest exit codes 1 thru 93 (0x5d) are displaced by 32, so that 1
+ *    becomes 33 (0x21) on the host and 93 becomes 125 (0x7d) on the host.
+ *  - Guest exit codes 94 (0x5e) and above are mapped to 126 (0x5e).
+ *
+ * We ASSUME that all VBoxManage status codes are in the range 0 thru 32.
+ *
+ * @note    These are frozen as of 4.1.0.
+ * @note    The guest exit code mappings was introduced with 5.0 and the 'run'
+ *          command, they are/was not supported by 'exec'.
+ * @sa      gctlRunCalculateExitCode
+ */
+/** Process exited normally but with an exit code <> 0. */
+#define EXITCODEEXEC_CODE           ((RTEXITCODE)16)
+#define EXITCODEEXEC_FAILED         ((RTEXITCODE)17)
+#define EXITCODEEXEC_TERM_SIGNAL    ((RTEXITCODE)18)
+#define EXITCODEEXEC_TERM_ABEND     ((RTEXITCODE)19)
+#define EXITCODEEXEC_TIMEOUT        ((RTEXITCODE)20)
+#define EXITCODEEXEC_DOWN           ((RTEXITCODE)21)
+/** Execution was interrupt by user (ctrl-c). */
+#define EXITCODEEXEC_CANCELED       ((RTEXITCODE)22)
+/** The first mapped guest (non-zero) exit code. */
+#define EXITCODEEXEC_MAPPED_FIRST           33
+/** The last mapped guest (non-zero) exit code value (inclusive). */
+#define EXITCODEEXEC_MAPPED_LAST            125
+/** The number of exit codes from EXITCODEEXEC_MAPPED_FIRST to
+ * EXITCODEEXEC_MAPPED_LAST.  This is also the highest guest exit code number
+ * we're able to map. */
+#define EXITCODEEXEC_MAPPED_RANGE           (93)
+/** The guest exit code displacement value. */
+#define EXITCODEEXEC_MAPPED_DISPLACEMENT    32
+/** The guest exit code was too big to be mapped. */
+#define EXITCODEEXEC_MAPPED_BIG             ((RTEXITCODE)126)
+/** @} */
+
+/**
+ * Calculates the exit code of VBoxManage.
+ *
+ * @returns The exit code to return.
+ * @param   enmStatus           The guest process status.
+ * @param   uExitCode           The associated guest process exit code (where
+ *                              applicable).
+ * @param   fReturnExitCodes    Set if we're to use the 32-126 range for guest
+ *                              exit codes.
+ */
+static RTEXITCODE gctlRunCalculateExitCode(ProcessStatus_T enmStatus, ULONG uExitCode, bool fReturnExitCodes)
+{
+    int vrc = RTEXITCODE_SUCCESS;
+    switch (enmStatus)
+    {
+        case ProcessStatus_TerminatedNormally:
+            if (uExitCode == 0)
+                return RTEXITCODE_SUCCESS;
+            if (!fReturnExitCodes)
+                return EXITCODEEXEC_CODE;
+            if (uExitCode <= EXITCODEEXEC_MAPPED_RANGE)
+                return (RTEXITCODE) (uExitCode + EXITCODEEXEC_MAPPED_DISPLACEMENT);
+            return EXITCODEEXEC_MAPPED_BIG;
+
+        case ProcessStatus_TerminatedAbnormally:
+            return EXITCODEEXEC_TERM_ABEND;
+        case ProcessStatus_TerminatedSignal:
+            return EXITCODEEXEC_TERM_SIGNAL;
 
-        if (FAILED(rc))
-            rcExit = RTEXITCODE_FAILURE;
+#if 0  /* see caller! */
+        case ProcessStatus_TimedOutKilled:
+            return EXITCODEEXEC_TIMEOUT;
+        case ProcessStatus_Down:
+            return EXITCODEEXEC_DOWN;   /* Service/OS is stopping, process was killed. */
+        case ProcessStatus_Error:
+            return EXITCODEEXEC_FAILED;
 
-        RTStrFree(pszSessionName);
-    }
+        /* The following is probably for detached? */
+        case ProcessStatus_Starting:
+            return RTEXITCODE_SUCCESS;
+        case ProcessStatus_Started:
+            return RTEXITCODE_SUCCESS;
+        case ProcessStatus_Paused:
+            return RTEXITCODE_SUCCESS;
+        case ProcessStatus_Terminating:
+            return RTEXITCODE_SUCCESS; /** @todo ???? */
+#endif
 
-    if (rcExit == RTEXITCODE_SUCCESS)
-    {
-        pCtx->handlerArg = *pArg;
-        pCtx->uFlags = uFlags;
+        default:
+            AssertMsgFailed(("Unknown exit status (%u/%u) from guest process returned!\n", enmStatus, uExitCode));
+            return RTEXITCODE_FAILURE;
     }
-    else /* Clean up on failure. */
-        ctrlUninitVM(pCtx, uFlags);
-
-    return rcExit;
 }
 
+
 /**
- * Prints the desired guest output to a stream.
+ * Pumps guest output to the host.
  *
  * @return  IPRT status code.
  * @param   pProcess        Pointer to appropriate process object.
- * @param   pStrmOutput     Where to write the data.
+ * @param   hVfsIosDst      Where to write the data.
  * @param   uHandle         Handle where to read the data from.
- * @param   uTimeoutMS      Timeout (in ms) to wait for the operation to complete.
+ * @param   cMsTimeout      Timeout (in ms) to wait for the operation to
+ *                          complete.
  */
-static int ctrlExecPrintOutput(IProcess *pProcess, PRTSTREAM pStrmOutput,
-                               ULONG uHandle, ULONG uTimeoutMS)
+static int gctlRunPumpOutput(IProcess *pProcess, RTVFSIOSTREAM hVfsIosDst, ULONG uHandle, RTMSINTERVAL cMsTimeout)
 {
     AssertPtrReturn(pProcess, VERR_INVALID_POINTER);
-    AssertPtrReturn(pStrmOutput, VERR_INVALID_POINTER);
+    Assert(hVfsIosDst != NIL_RTVFSIOSTREAM);
 
-    int vrc = VINF_SUCCESS;
+    int vrc;
 
     SafeArray<BYTE> aOutputData;
-    HRESULT rc = pProcess->Read(uHandle, _64K, uTimeoutMS,
-                                ComSafeArrayAsOutParam(aOutputData));
-    if (FAILED(rc))
-        vrc = ctrlPrintError(pProcess, COM_IIDOF(IProcess));
-    else
+    HRESULT hrc = pProcess->Read(uHandle, _64K, RT_MAX(cMsTimeout, 1), ComSafeArrayAsOutParam(aOutputData));
+    if (SUCCEEDED(hrc))
     {
         size_t cbOutputData = aOutputData.size();
-        if (cbOutputData > 0)
+        if (cbOutputData == 0)
+            vrc = VINF_SUCCESS;
+        else
         {
-            BYTE *pBuf = aOutputData.raw();
-            AssertPtr(pBuf);
-            pBuf[cbOutputData - 1] = 0; /* Properly terminate buffer. */
+            BYTE const *pbBuf = aOutputData.raw();
+            AssertPtr(pbBuf);
 
-            /** @todo implement the dos2unix/unix2dos conversions */
+            vrc = RTVfsIoStrmWrite(hVfsIosDst, pbBuf, cbOutputData, true /*fBlocking*/,  NULL);
+            if (RT_FAILURE(vrc))
+                RTMsgError("Unable to write output, rc=%Rrc\n", vrc);
+        }
+    }
+    else
+        vrc = gctlPrintError(pProcess, COM_IIDOF(IProcess));
+    return vrc;
+}
 
-            /*
-             * If aOutputData is text data from the guest process' stdout or stderr,
-             * it has a platform dependent line ending. So standardize on
-             * Unix style, as RTStrmWrite does the LF -> CR/LF replacement on
-             * Windows. Otherwise we end up with CR/CR/LF on Windows.
-             */
 
-            char *pszBufUTF8;
-            vrc = RTStrCurrentCPToUtf8(&pszBufUTF8, (const char*)aOutputData.raw());
-            if (RT_SUCCESS(vrc))
+/**
+ * Configures a host handle for pumping guest bits.
+ *
+ * @returns true if enabled and we successfully configured it.
+ * @param   fEnabled            Whether pumping this pipe is configured.
+ * @param   enmHandle           The IPRT standard handle designation.
+ * @param   pszName             The name for user messages.
+ * @param   enmTransformation   The transformation to apply.
+ * @param   phVfsIos            Where to return the resulting I/O stream handle.
+ */
+static bool gctlRunSetupHandle(bool fEnabled, RTHANDLESTD enmHandle, const char *pszName,
+                               kStreamTransform enmTransformation, PRTVFSIOSTREAM phVfsIos)
+{
+    if (fEnabled)
+    {
+        int vrc = RTVfsIoStrmFromStdHandle(enmHandle, 0, true /*fLeaveOpen*/, phVfsIos);
+        if (RT_SUCCESS(vrc))
+        {
+            if (enmTransformation != kStreamTransform_None)
             {
-                cbOutputData = strlen(pszBufUTF8);
-
-                ULONG cbOutputDataPrint = cbOutputData;
-                for (char *s = pszBufUTF8, *d = s;
-                     s - pszBufUTF8 < (ssize_t)cbOutputData;
-                     s++, d++)
-                {
-                    if (*s == '\r')
-                    {
-                        /* skip over CR, adjust destination */
-                        d--;
-                        cbOutputDataPrint--;
-                    }
-                    else if (s != d)
-                        *d = *s;
-                }
-
-                vrc = RTStrmWrite(pStrmOutput, pszBufUTF8, cbOutputDataPrint);
-                if (RT_FAILURE(vrc))
-                    RTMsgError("Unable to write output, rc=%Rrc\n", vrc);
-
-                RTStrFree(pszBufUTF8);
+                RTMsgWarning("Unsupported %s line ending conversion", pszName);
+                /** @todo Implement dos2unix and unix2dos stream filters. */
             }
-            else
-                RTMsgError("Unable to convert output, rc=%Rrc\n", vrc);
+            return true;
         }
+        RTMsgWarning("Error getting %s handle: %Rrc", pszName, vrc);
     }
-
-    return vrc;
+    return false;
 }
 
+
 /**
  * Returns the remaining time (in ms) based on the start time and a set
  * timeout value. Returns RT_INDEFINITE_WAIT if no timeout was specified.
@@ -1124,7 +1272,7 @@ static int ctrlExecPrintOutput(IProcess *pProcess, PRTSTREAM pStrmOutput,
  * @param   u64StartMs      Start time (in ms).
  * @param   cMsTimeout      Timeout value (in ms).
  */
-inline RTMSINTERVAL ctrlExecGetRemainingTime(uint64_t u64StartMs, RTMSINTERVAL cMsTimeout)
+static RTMSINTERVAL gctlRunGetRemainingTime(uint64_t u64StartMs, RTMSINTERVAL cMsTimeout)
 {
     if (!cMsTimeout || cMsTimeout == RT_INDEFINITE_WAIT) /* If no timeout specified, wait forever. */
         return RT_INDEFINITE_WAIT;
@@ -1136,50 +1284,73 @@ inline RTMSINTERVAL ctrlExecGetRemainingTime(uint64_t u64StartMs, RTMSINTERVAL c
     return cMsTimeout - (RTMSINTERVAL)u64ElapsedMs;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlProcessExec(PGCTLCMDCTX pCtx)
+/**
+ * Common handler for the 'run' and 'start' commands.
+ *
+ * @returns Command exit code.
+ * @param   pCtx        Guest session context.
+ * @param   argc        The argument count.
+ * @param   argv        The argument vector for this command.
+ * @param   fRunCmd     Set if it's 'run' clear if 'start'.
+ * @param   fHelp       The help flag for the command.
+ */
+static RTEXITCODE gctlHandleRunCommon(PGCTLCMDCTX pCtx, int argc, char **argv, bool fRunCmd, uint32_t fHelp)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
     /*
      * Parse arguments.
      */
+    enum kGstCtrlRunOpt
+    {
+        kGstCtrlRunOpt_IgnoreOrphanedProcesses = 1000,
+        kGstCtrlRunOpt_NoProfile,
+        kGstCtrlRunOpt_Dos2Unix,
+        kGstCtrlRunOpt_Unix2Dos,
+        kGstCtrlRunOpt_WaitForStdOut,
+        kGstCtrlRunOpt_NoWaitForStdOut,
+        kGstCtrlRunOpt_WaitForStdErr,
+        kGstCtrlRunOpt_NoWaitForStdErr
+    };
     static const RTGETOPTDEF s_aOptions[] =
     {
-        { "--dos2unix",                     GETOPTDEF_EXEC_DOS2UNIX,                  RTGETOPT_REQ_NOTHING },
-        { "--environment",                  'e',                                      RTGETOPT_REQ_STRING  },
-        { "--flags",                        'f',                                      RTGETOPT_REQ_STRING  },
-        { "--ignore-operhaned-processes",   GETOPTDEF_EXEC_IGNOREORPHANEDPROCESSES,   RTGETOPT_REQ_NOTHING },
-        { "--image",                        'i',                                      RTGETOPT_REQ_STRING  },
-        { "--no-profile",                   GETOPTDEF_EXEC_NO_PROFILE,                RTGETOPT_REQ_NOTHING },
+        GCTLCMD_COMMON_OPTION_DEFS()
+        { "--putenv",                       'E',                                      RTGETOPT_REQ_STRING  },
+        { "--exe",                          'e',                                      RTGETOPT_REQ_STRING  },
         { "--timeout",                      't',                                      RTGETOPT_REQ_UINT32  },
-        { "--unix2dos",                     GETOPTDEF_EXEC_UNIX2DOS,                  RTGETOPT_REQ_NOTHING },
         { "--unquoted-args",                'u',                                      RTGETOPT_REQ_NOTHING },
-        { "--wait-exit",                    GETOPTDEF_EXEC_WAITFOREXIT,               RTGETOPT_REQ_NOTHING },
-        { "--wait-stdout",                  GETOPTDEF_EXEC_WAITFORSTDOUT,             RTGETOPT_REQ_NOTHING },
-        { "--wait-stderr",                  GETOPTDEF_EXEC_WAITFORSTDERR,             RTGETOPT_REQ_NOTHING }
+        { "--ignore-operhaned-processes",   kGstCtrlRunOpt_IgnoreOrphanedProcesses,   RTGETOPT_REQ_NOTHING },
+        { "--no-profile",                   kGstCtrlRunOpt_NoProfile,                 RTGETOPT_REQ_NOTHING },
+        /* run only: 6 - options */
+        { "--dos2unix",                     kGstCtrlRunOpt_Dos2Unix,                  RTGETOPT_REQ_NOTHING },
+        { "--unix2dos",                     kGstCtrlRunOpt_Unix2Dos,                  RTGETOPT_REQ_NOTHING },
+        { "--no-wait-stdout",               kGstCtrlRunOpt_NoWaitForStdOut,           RTGETOPT_REQ_NOTHING },
+        { "--wait-stdout",                  kGstCtrlRunOpt_WaitForStdOut,             RTGETOPT_REQ_NOTHING },
+        { "--no-wait-stderr",               kGstCtrlRunOpt_NoWaitForStdErr,           RTGETOPT_REQ_NOTHING },
+        { "--wait-stderr",                  kGstCtrlRunOpt_WaitForStdErr,             RTGETOPT_REQ_NOTHING },
     };
 
-#ifdef DEBUG_andy
-    RTPrintf("first=%d\n", pCtx->iFirstArgc);
-    for (int i=0; i<pCtx->iArgc;i++)
-        RTPrintf("\targv[%d]=%s\n", i, pCtx->ppaArgv[i]);
-#endif
+    /** @todo stdin handling.   */
 
     int                     ch;
     RTGETOPTUNION           ValueUnion;
     RTGETOPTSTATE           GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv, s_aOptions, RT_ELEMENTS(s_aOptions),
-                 pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
-
-    Utf8Str                              strCmd;
-    com::SafeArray<ProcessCreateFlag_T>  aCreateFlags;
-    com::SafeArray<ProcessWaitForFlag_T> aWaitFlags;
-    com::SafeArray<IN_BSTR>              aArgs;
-    com::SafeArray<IN_BSTR>              aEnv;
-    RTMSINTERVAL                         cMsTimeout      = 0;
-    OUTPUTTYPE                           eOutputType     = OUTPUTTYPE_UNDEFINED;
-    bool                                 fDetached       = true;
-    int                                  vrc             = VINF_SUCCESS;
+    size_t                  cOptions =
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions) - (fRunCmd ? 0 : 6),
+                 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+
+    com::SafeArray<ProcessCreateFlag_T>     aCreateFlags;
+    com::SafeArray<ProcessWaitForFlag_T>    aWaitFlags;
+    com::SafeArray<IN_BSTR>                 aArgs;
+    com::SafeArray<IN_BSTR>                 aEnv;
+    const char *                            pszImage            = NULL;
+    bool                                    fWaitForStdOut      = fRunCmd;
+    bool                                    fWaitForStdErr      = fRunCmd;
+    RTVFSIOSTREAM                           hVfsStdOut          = NIL_RTVFSIOSTREAM;
+    RTVFSIOSTREAM                           hVfsStdErr          = NIL_RTVFSIOSTREAM;
+    enum kStreamTransform                   enmStdOutTransform  = kStreamTransform_None;
+    enum kStreamTransform                   enmStdErrTransform  = kStreamTransform_None;
+    RTMSINTERVAL                            cMsTimeout          = 0;
 
     try
     {
@@ -1187,45 +1358,31 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessExec(PGCTLCMDCTX pCtx)
          * when relying on its overall exit code. */
         aWaitFlags.push_back(ProcessWaitForFlag_Start);
 
-        while (   (ch = RTGetOpt(&GetState, &ValueUnion))
-               && RT_SUCCESS(vrc))
+        while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
         {
             /* For options that require an argument, ValueUnion has received the value. */
             switch (ch)
             {
-                case GETOPTDEF_EXEC_DOS2UNIX:
-                    if (eOutputType != OUTPUTTYPE_UNDEFINED)
-                        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_EXEC,
-                                             "More than one output type (dos2unix/unix2dos) specified!");
-                    eOutputType = OUTPUTTYPE_DOS2UNIX;
-                    break;
-
-                case 'e': /* Environment */
-                {
-                    char **papszArg;
-                    int cArgs;
-
-                    vrc = RTGetOptArgvFromString(&papszArg, &cArgs, ValueUnion.psz, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, NULL);
-                    if (RT_FAILURE(vrc))
-                        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_EXEC,
-                                             "Failed to parse environment value, rc=%Rrc", vrc);
-                    for (int j = 0; j < cArgs; j++)
-                        aEnv.push_back(Bstr(papszArg[j]).raw());
-
-                    RTGetOptArgvFree(papszArg);
+                GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
+                case 'E':
+                    if (   ValueUnion.psz[0] == '\0'
+                        || ValueUnion.psz[0] == '=')
+                        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RUN,
+                                             "Invalid argument variable[=value]: '%s'", ValueUnion.psz);
+                    aEnv.push_back(Bstr(ValueUnion.psz).raw());
                     break;
-                }
 
-                case GETOPTDEF_EXEC_IGNOREORPHANEDPROCESSES:
+                case kGstCtrlRunOpt_IgnoreOrphanedProcesses:
                     aCreateFlags.push_back(ProcessCreateFlag_IgnoreOrphanedProcesses);
                     break;
 
-                case GETOPTDEF_EXEC_NO_PROFILE:
+                case kGstCtrlRunOpt_NoProfile:
                     aCreateFlags.push_back(ProcessCreateFlag_NoProfile);
                     break;
 
-                case 'i':
-                    strCmd = ValueUnion.psz;
+                case 'e':
+                    pszImage = ValueUnion.psz;
                     break;
 
                 case 'u':
@@ -1238,153 +1395,157 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessExec(PGCTLCMDCTX pCtx)
                     cMsTimeout = ValueUnion.u32;
                     break;
 
-                case GETOPTDEF_EXEC_UNIX2DOS:
-                    if (eOutputType != OUTPUTTYPE_UNDEFINED)
-                        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_EXEC,
-                                             "More than one output type (dos2unix/unix2dos) specified!");
-                    eOutputType = OUTPUTTYPE_UNIX2DOS;
+                /* run only options: */
+                case kGstCtrlRunOpt_Dos2Unix:
+                    Assert(fRunCmd);
+                    enmStdErrTransform = enmStdOutTransform = kStreamTransform_Dos2Unix;
                     break;
-
-                case GETOPTDEF_EXEC_WAITFOREXIT:
-                    aWaitFlags.push_back(ProcessWaitForFlag_Terminate);
-                    fDetached = false;
+                case kGstCtrlRunOpt_Unix2Dos:
+                    Assert(fRunCmd);
+                    enmStdErrTransform = enmStdOutTransform = kStreamTransform_Unix2Dos;
                     break;
 
-                case GETOPTDEF_EXEC_WAITFORSTDOUT:
-                    aCreateFlags.push_back(ProcessCreateFlag_WaitForStdOut);
-                    aWaitFlags.push_back(ProcessWaitForFlag_StdOut);
-                    fDetached = false;
+                case kGstCtrlRunOpt_WaitForStdOut:
+                    Assert(fRunCmd);
+                    fWaitForStdOut = true;
+                    break;
+                case kGstCtrlRunOpt_NoWaitForStdOut:
+                    Assert(fRunCmd);
+                    fWaitForStdOut = false;
                     break;
 
-                case GETOPTDEF_EXEC_WAITFORSTDERR:
-                    aCreateFlags.push_back(ProcessCreateFlag_WaitForStdErr);
-                    aWaitFlags.push_back(ProcessWaitForFlag_StdErr);
-                    fDetached = false;
+                case kGstCtrlRunOpt_WaitForStdErr:
+                    Assert(fRunCmd);
+                    fWaitForStdErr = true;
+                    break;
+                case kGstCtrlRunOpt_NoWaitForStdErr:
+                    Assert(fRunCmd);
+                    fWaitForStdErr = false;
                     break;
 
                 case VINF_GETOPT_NOT_OPTION:
-                    if (aArgs.size() == 0 && strCmd.isEmpty())
-                        strCmd = ValueUnion.psz;
-                    else
-                        aArgs.push_back(Bstr(ValueUnion.psz).raw());
+                    aArgs.push_back(Bstr(ValueUnion.psz).raw());
+                    if (!pszImage)
+                    {
+                        Assert(aArgs.size() == 1);
+                        pszImage = ValueUnion.psz;
+                    }
                     break;
 
                 default:
-                    /* Note: Necessary for handling non-options (after --) which
-                     *       contain a single dash, e.g. "-- foo.exe -s". */
-                    if (GetState.argc == GetState.iNext)
-                        aArgs.push_back(Bstr(ValueUnion.psz).raw());
-                    else
-                        return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_EXEC, ch, &ValueUnion);
-                    break;
+                    return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RUN, ch, &ValueUnion);
 
             } /* switch */
         } /* while RTGetOpt */
+
+        /* Must have something to execute. */
+        if (!pszImage || !*pszImage)
+            return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RUN, "No executable specified!");
+
+        /*
+         * Finalize process creation and wait flags and input/output streams.
+         */
+        if (!fRunCmd)
+        {
+            aCreateFlags.push_back(ProcessCreateFlag_WaitForProcessStartOnly);
+            Assert(!fWaitForStdOut);
+            Assert(!fWaitForStdErr);
+        }
+        else
+        {
+            aWaitFlags.push_back(ProcessWaitForFlag_Terminate);
+            fWaitForStdOut = gctlRunSetupHandle(fWaitForStdOut, RTHANDLESTD_OUTPUT, "stdout", enmStdOutTransform, &hVfsStdOut);
+            if (fWaitForStdOut)
+            {
+                aCreateFlags.push_back(ProcessCreateFlag_WaitForStdOut);
+                aWaitFlags.push_back(ProcessWaitForFlag_StdOut);
+            }
+            fWaitForStdErr = gctlRunSetupHandle(fWaitForStdErr, RTHANDLESTD_ERROR, "stderr", enmStdErrTransform, &hVfsStdErr);
+            if (fWaitForStdErr)
+            {
+                aCreateFlags.push_back(ProcessCreateFlag_WaitForStdErr);
+                aWaitFlags.push_back(ProcessWaitForFlag_StdErr);
+            }
+        }
     }
     catch (std::bad_alloc &)
     {
-        vrc = VERR_NO_MEMORY;
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "VERR_NO_MEMORY\n");
     }
 
-    if (RT_FAILURE(vrc))
-        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize, rc=%Rrc\n", vrc);
-
-    if (strCmd.isEmpty())
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_EXEC,
-                             "No command to execute specified!");
-
-    /** @todo Any output conversion not supported yet! */
-    if (eOutputType != OUTPUTTYPE_UNDEFINED)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_EXEC,
-                             "Output conversion not implemented yet!");
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
 
-    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
     HRESULT rc;
 
     try
     {
         do
         {
-            /* Adjust process creation flags if we don't want to wait for process termination. */
-            if (fDetached)
-                aCreateFlags.push_back(ProcessCreateFlag_WaitForProcessStartOnly);
-
             /* Get current time stamp to later calculate rest of timeout left. */
-            uint64_t u64StartMS = RTTimeMilliTS();
+            uint64_t msStart = RTTimeMilliTS();
 
-            if (pCtx->fVerbose)
+            /*
+             * Create the process.
+             */
+            if (pCtx->cVerbose > 1)
             {
                 if (cMsTimeout == 0)
                     RTPrintf("Starting guest process ...\n");
                 else
                     RTPrintf("Starting guest process (within %ums)\n", cMsTimeout);
             }
-
-            /*
-             * Execute the process.
-             */
             ComPtr<IGuestProcess> pProcess;
-            CHECK_ERROR_BREAK(pCtx->pGuestSession, ProcessCreate(Bstr(strCmd).raw(),
+            CHECK_ERROR_BREAK(pCtx->pGuestSession, ProcessCreate(Bstr(pszImage).raw(),
                                                                  ComSafeArrayAsInParam(aArgs),
                                                                  ComSafeArrayAsInParam(aEnv),
                                                                  ComSafeArrayAsInParam(aCreateFlags),
-                                                                 ctrlExecGetRemainingTime(u64StartMS, cMsTimeout),
+                                                                 gctlRunGetRemainingTime(msStart, cMsTimeout),
                                                                  pProcess.asOutParam()));
 
             /*
-             * Explicitly wait for the guest process to be in a started
-             * state.
+             * Explicitly wait for the guest process to be in a started state.
              */
             com::SafeArray<ProcessWaitForFlag_T> aWaitStartFlags;
             aWaitStartFlags.push_back(ProcessWaitForFlag_Start);
             ProcessWaitResult_T waitResult;
             CHECK_ERROR_BREAK(pProcess, WaitForArray(ComSafeArrayAsInParam(aWaitStartFlags),
-                                                     ctrlExecGetRemainingTime(u64StartMS, cMsTimeout), &waitResult));
-            bool fCompleted = false;
+                                                     gctlRunGetRemainingTime(msStart, cMsTimeout), &waitResult));
 
             ULONG uPID = 0;
             CHECK_ERROR_BREAK(pProcess, COMGETTER(PID)(&uPID));
-            if (!fDetached && pCtx->fVerbose)
-            {
-                RTPrintf("Process '%s' (PID %RU32) started\n",
-                         strCmd.c_str(), uPID);
-            }
-            else if (fDetached) /** @todo Introduce a --quiet option for not printing this. */
+            if (fRunCmd && pCtx->cVerbose > 1)
+                RTPrintf("Process '%s' (PID %RU32) started\n", pszImage, uPID);
+            else if (!fRunCmd && pCtx->cVerbose)
             {
                 /* Just print plain PID to make it easier for scripts
                  * invoking VBoxManage. */
                 RTPrintf("[%RU32 - Session %RU32]\n", uPID, pCtx->uSessionID);
             }
 
-            vrc = RTStrmSetMode(g_pStdOut, 1 /* Binary mode */, -1 /* Code set, unchanged */);
-            if (RT_FAILURE(vrc))
-                RTMsgError("Unable to set stdout's binary mode, rc=%Rrc\n", vrc);
-            vrc = RTStrmSetMode(g_pStdErr, 1 /* Binary mode */, -1 /* Code set, unchanged */);
-            if (RT_FAILURE(vrc))
-                RTMsgError("Unable to set stderr's binary mode, rc=%Rrc\n", vrc);
-
-            /* Wait for process to exit ... */
-            RTMSINTERVAL cMsTimeLeft = 1; /* Will be calculated. */
-            bool fReadStdOut, fReadStdErr;
-            fReadStdOut = fReadStdErr = false;
+            /*
+             * Wait for process to exit/start...
+             */
+            RTMSINTERVAL    cMsTimeLeft = 1; /* Will be calculated. */
+            bool            fReadStdOut = false;
+            bool            fReadStdErr = false;
+            bool            fCompleted  = false;
+            bool            fCompletedStartCmd = false;
+            int             vrc         = VINF_SUCCESS;
 
             while (   !fCompleted
-                   && !fDetached
-                   && cMsTimeLeft != 0)
+                   && cMsTimeLeft > 0)
             {
-                cMsTimeLeft = ctrlExecGetRemainingTime(u64StartMS, cMsTimeout);
+                cMsTimeLeft = gctlRunGetRemainingTime(msStart, cMsTimeout);
                 CHECK_ERROR_BREAK(pProcess, WaitForArray(ComSafeArrayAsInParam(aWaitFlags),
-                                                         500 /* ms */, &waitResult));
+                                                         RT_MIN(500 /*ms*/, RT_MAX(cMsTimeLeft, 1 /*ms*/)),
+                                                         &waitResult));
                 switch (waitResult)
                 {
                     case ProcessWaitResult_Start:
-                    {
-                        /* We're done here if we don't want to wait for termination. */
-                        if (fDetached)
-                            fCompleted = true;
-
+                        fCompletedStartCmd = fCompleted = !fRunCmd; /* Only wait for startup if the 'start' command. */
                         break;
-                    }
                     case ProcessWaitResult_StdOut:
                         fReadStdOut = true;
                         break;
@@ -1392,94 +1553,135 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessExec(PGCTLCMDCTX pCtx)
                         fReadStdErr = true;
                         break;
                     case ProcessWaitResult_Terminate:
-                        if (pCtx->fVerbose)
+                        if (pCtx->cVerbose > 1)
                             RTPrintf("Process terminated\n");
                         /* Process terminated, we're done. */
                         fCompleted = true;
                         break;
                     case ProcessWaitResult_WaitFlagNotSupported:
-                    {
                         /* The guest does not support waiting for stdout/err, so
                          * yield to reduce the CPU load due to busy waiting. */
-                        RTThreadYield(); /* Optional, don't check rc. */
-
-                        /* Try both, stdout + stderr. */
+                        RTThreadYield();
                         fReadStdOut = fReadStdErr = true;
                         break;
-                    }
                     case ProcessWaitResult_Timeout:
-                        /* Fall through is intentional. */
-                    default:
-                        /* Ignore all other results, let the timeout expire */
+                    {
+                        /** @todo It is really unclear whether we will get stuck with the timeout
+                         *        result here if the guest side times out the process and fails to
+                         *        kill the process...  To be on the save side, double the IPC and
+                         *        check the process status every time we time out.  */
+                        ProcessStatus_T enmProcStatus;
+                        CHECK_ERROR_BREAK(pProcess, COMGETTER(Status)(&enmProcStatus));
+                        if (   enmProcStatus == ProcessStatus_TimedOutKilled
+                            || enmProcStatus == ProcessStatus_TimedOutAbnormally)
+                            fCompleted = true;
+                        fReadStdOut = fReadStdErr = true;
+                        break;
+                    }
+                    case ProcessWaitResult_Status:
+                        /* ignore. */
+                        break;
+                    case ProcessWaitResult_Error:
+                        /* waitFor is dead in the water, I think, so better leave the loop. */
+                        vrc = VERR_CALLBACK_RETURN;
                         break;
+
+                    case ProcessWaitResult_StdIn:   AssertFailed(); /* did ask for this! */ break;
+                    case ProcessWaitResult_None:    AssertFailed(); /* used. */ break;
+                    default:                        AssertFailed(); /* huh? */ break;
                 }
 
                 if (g_fGuestCtrlCanceled)
                     break;
 
-                if (fReadStdOut) /* Do we need to fetch stdout data? */
+                /*
+                 * Pump output as needed.
+                 */
+                if (fReadStdOut)
                 {
-                    cMsTimeLeft = ctrlExecGetRemainingTime(u64StartMS, cMsTimeout);
-                    vrc = ctrlExecPrintOutput(pProcess, g_pStdOut,
-                                              1 /* StdOut */, cMsTimeLeft);
+                    cMsTimeLeft = gctlRunGetRemainingTime(msStart, cMsTimeout);
+                    int vrc2 = gctlRunPumpOutput(pProcess, hVfsStdOut, 1 /* StdOut */, cMsTimeLeft);
+                    if (RT_FAILURE(vrc2) && RT_SUCCESS(vrc))
+                        vrc = vrc2;
                     fReadStdOut = false;
                 }
-
-                if (fReadStdErr) /* Do we need to fetch stdout data? */
+                if (fReadStdErr)
                 {
-                    cMsTimeLeft = ctrlExecGetRemainingTime(u64StartMS, cMsTimeout);
-                    vrc = ctrlExecPrintOutput(pProcess, g_pStdErr,
-                                              2 /* StdErr */, cMsTimeLeft);
+                    cMsTimeLeft = gctlRunGetRemainingTime(msStart, cMsTimeout);
+                    int vrc2 = gctlRunPumpOutput(pProcess, hVfsStdErr, 2 /* StdErr */, cMsTimeLeft);
+                    if (RT_FAILURE(vrc2) && RT_SUCCESS(vrc))
+                        vrc = vrc2;
                     fReadStdErr = false;
                 }
-
                 if (   RT_FAILURE(vrc)
                     || g_fGuestCtrlCanceled)
                     break;
 
-                /* Did we run out of time? */
-                if (   cMsTimeout
-                    && RTTimeMilliTS() - u64StartMS > cMsTimeout)
-                    break;
-
+                /*
+                 * Process events before looping.
+                 */
                 NativeEventQueue::getMainEventQueue()->processEventQueue(0);
-
             } /* while */
 
-            if (!fDetached)
+            /*
+             * Report status back to the user.
+             */
+            if (g_fGuestCtrlCanceled)
             {
-                /* Report status back to the user. */
-                if (   fCompleted
-                    && !g_fGuestCtrlCanceled)
+                if (pCtx->cVerbose > 1)
+                    RTPrintf("Process execution aborted!\n");
+                rcExit = EXITCODEEXEC_CANCELED;
+            }
+            else if (fCompletedStartCmd)
+            {
+                if (pCtx->cVerbose > 1)
+                    RTPrintf("Process successfully started!\n");
+                rcExit = RTEXITCODE_SUCCESS;
+            }
+            else if (fCompleted)
+            {
+                ProcessStatus_T procStatus;
+                CHECK_ERROR_BREAK(pProcess, COMGETTER(Status)(&procStatus));
+                if (   procStatus == ProcessStatus_TerminatedNormally
+                    || procStatus == ProcessStatus_TerminatedAbnormally
+                    || procStatus == ProcessStatus_TerminatedSignal)
                 {
+                    LONG lExitCode;
+                    CHECK_ERROR_BREAK(pProcess, COMGETTER(ExitCode)(&lExitCode));
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Exit code=%u (Status=%u [%s])\n",
+                                 lExitCode, procStatus, gctlProcessStatusToText(procStatus));
 
-                    {
-                        ProcessStatus_T procStatus;
-                        CHECK_ERROR_BREAK(pProcess, COMGETTER(Status)(&procStatus));
-                        if (   procStatus == ProcessStatus_TerminatedNormally
-                            || procStatus == ProcessStatus_TerminatedAbnormally
-                            || procStatus == ProcessStatus_TerminatedSignal)
-                        {
-                            LONG exitCode;
-                            CHECK_ERROR_BREAK(pProcess, COMGETTER(ExitCode)(&exitCode));
-                            if (pCtx->fVerbose)
-                                RTPrintf("Exit code=%u (Status=%u [%s])\n",
-                                         exitCode, procStatus, ctrlProcessStatusToText(procStatus));
-
-                            rcExit = (RTEXITCODE)ctrlExecProcessStatusToExitCode(procStatus, exitCode);
-                        }
-                        else if (pCtx->fVerbose)
-                            RTPrintf("Process now is in status [%s]\n", ctrlProcessStatusToText(procStatus));
-                    }
+                    rcExit = gctlRunCalculateExitCode(procStatus, lExitCode, true /*fReturnExitCodes*/);
+                }
+                else if (   procStatus == ProcessStatus_TimedOutKilled
+                         || procStatus == ProcessStatus_TimedOutAbnormally)
+                {
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Process timed out (guest side) and\n",
+                                 procStatus == ProcessStatus_TimedOutAbnormally
+                                 ? " failed to terminate so far" : " was terminated");
+                    rcExit = EXITCODEEXEC_TIMEOUT;
                 }
                 else
                 {
-                    if (pCtx->fVerbose)
-                        RTPrintf("Process execution aborted!\n");
-
-                    rcExit = (RTEXITCODE)EXITCODEEXEC_TERM_ABEND;
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Process now is in status [%s] (unexpected)\n", gctlProcessStatusToText(procStatus));
+                    rcExit = RTEXITCODE_FAILURE;
                 }
             }
+            else if (RT_FAILURE_NP(vrc))
+            {
+                if (pCtx->cVerbose > 1)
+                    RTPrintf("Process monitor loop quit with vrc=%Rrc\n", vrc);
+                rcExit = RTEXITCODE_FAILURE;
+            }
+            else
+            {
+                if (pCtx->cVerbose > 1)
+                    RTPrintf("Process monitor loop timed out\n");
+                rcExit = EXITCODEEXEC_TIMEOUT;
+            }
 
         } while (0);
     }
@@ -1489,46 +1691,51 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessExec(PGCTLCMDCTX pCtx)
     }
 
     /*
-     * Decide what to do with the guest session. If we started a
-     * detached guest process (that is, without waiting for it to exit),
-     * don't close the guest session it is part of.
+     * Decide what to do with the guest session.
+     *
+     * If it's the 'start' command where detach the guest process after
+     * starting, don't close the guest session it is part of, except on
+     * failure or ctrl-c.
+     *
+     * For the 'run' command the guest process quits with us.
      */
-    bool fCloseSession = false;
-    if (SUCCEEDED(rc))
-    {
-        /*
-         * Only close the guest session if we waited for the guest
-         * process to exit. Otherwise we wouldn't have any chance to
-         * access and/or kill detached guest process lateron.
-         */
-        fCloseSession = !fDetached;
+    if (!fRunCmd && SUCCEEDED(rc) && !g_fGuestCtrlCanceled)
+        pCtx->fDetachGuestSession = true;
 
-        /*
-         * If execution was aborted from the host side (signal handler),
-         * close the guest session in any case.
-         */
-        if (g_fGuestCtrlCanceled)
-            fCloseSession = true;
-    }
-    else /* Close session on error. */
-        fCloseSession = true;
+    /* Make sure we return failure on failure. */
+    if (FAILED(rc) && rcExit == RTEXITCODE_SUCCESS)
+        rcExit = RTEXITCODE_FAILURE;
+    return rcExit;
+}
 
-    if (!fCloseSession)
-        pCtx->uFlags |= CTLCMDCTX_FLAGS_SESSION_DETACH;
 
-    if (   rcExit == RTEXITCODE_SUCCESS
-        && FAILED(rc))
-    {
-        /* Make sure an appropriate exit code is set on error. */
-        rcExit = RTEXITCODE_FAILURE;
-    }
+static DECLCALLBACK(RTEXITCODE) gctlHandleRun(PGCTLCMDCTX pCtx, int argc, char **argv)
+{
+    return gctlHandleRunCommon(pCtx, argc, argv, true /*fRunCmd*/, USAGE_GSTCTRL_RUN);
+}
 
-    return rcExit;
+
+static DECLCALLBACK(RTEXITCODE) gctlHandleStart(PGCTLCMDCTX pCtx, int argc, char **argv)
+{
+    return gctlHandleRunCommon(pCtx, argc, argv, false /*fRunCmd*/, USAGE_GSTCTRL_START);
 }
 
+
+/** bird: This is just a code conversion tool, flags are better defined by
+ *        the preprocessor, in general.  But the code was using obsoleted
+ *        main flags for internal purposes (in a uint32_t) without passing them
+ *        along, or it seemed that way.  Enum means compiler checks types. */
+enum gctlCopyFlags
+{
+    kGctlCopyFlags_None         = 0,
+    kGctlCopyFlags_Recursive    = RT_BIT(1),
+    kGctlCopyFlags_FollowLinks  = RT_BIT(2)
+};
+
+
 /**
  * Creates a copy context structure which then can be used with various
- * guest control copy functions. Needs to be free'd with ctrlCopyContextFree().
+ * guest control copy functions. Needs to be free'd with gctlCopyContextFree().
  *
  * @return  IPRT status code.
  * @param   pCtx                    Pointer to command context.
@@ -1538,7 +1745,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessExec(PGCTLCMDCTX pCtx)
  * @param   strSessionName          Session name (only for identification purposes).
  * @param   ppContext               Pointer which receives the allocated copy context.
  */
-static int ctrlCopyContextCreate(PGCTLCMDCTX pCtx, bool fDryRun, bool fHostToGuest,
+static int gctlCopyContextCreate(PGCTLCMDCTX pCtx, bool fDryRun, bool fHostToGuest,
                                  const Utf8Str &strSessionName,
                                  PCOPYCONTEXT *ppContext)
 {
@@ -1568,7 +1775,7 @@ static int ctrlCopyContextCreate(PGCTLCMDCTX pCtx, bool fDryRun, bool fHostToGue
  *
  * @param   pContext                Pointer to copy context to free.
  */
-static void ctrlCopyContextFree(PCOPYCONTEXT pContext)
+static void gctlCopyContextFree(PCOPYCONTEXT pContext)
 {
     if (pContext)
         delete pContext;
@@ -1588,7 +1795,7 @@ static void ctrlCopyContextFree(PCOPYCONTEXT pContext)
  * @param   ppszTranslated          Pointer to the allocated, translated destination
  *                                  path. Must be free'd with RTStrFree().
  */
-static int ctrlCopyTranslatePath(const char *pszSourceRoot, const char *pszSource,
+static int gctlCopyTranslatePath(const char *pszSourceRoot, const char *pszSource,
                                  const char *pszDest, char **ppszTranslated)
 {
     AssertPtrReturn(pszSourceRoot, VERR_INVALID_POINTER);
@@ -1682,7 +1889,7 @@ static int tstTranslatePath()
                  aTests[iTest].pszSourceRoot, aTests[iTest].pszSource, aTests[iTest].pszDest);
 
         char *pszTranslated = NULL;
-        int iResult =  ctrlCopyTranslatePath(aTests[iTest].pszSourceRoot, aTests[iTest].pszSource,
+        int iResult =  gctlCopyTranslatePath(aTests[iTest].pszSourceRoot, aTests[iTest].pszSource,
                                              aTests[iTest].pszDest, &pszTranslated);
         if (iResult != aTests[iTest].iResult)
         {
@@ -1715,17 +1922,17 @@ static int tstTranslatePath()
  * @param   pContext                Pointer to current copy control context.
  * @param   pszDir                  Directory to create.
  */
-static int ctrlCopyDirCreate(PCOPYCONTEXT pContext, const char *pszDir)
+static int gctlCopyDirCreate(PCOPYCONTEXT pContext, const char *pszDir)
 {
     AssertPtrReturn(pContext, VERR_INVALID_POINTER);
     AssertPtrReturn(pszDir, VERR_INVALID_POINTER);
 
     bool fDirExists;
-    int vrc = ctrlCopyDirExists(pContext, pContext->fHostToGuest, pszDir, &fDirExists);
+    int vrc = gctlCopyDirExists(pContext, pContext->fHostToGuest, pszDir, &fDirExists);
     if (   RT_SUCCESS(vrc)
         && fDirExists)
     {
-        if (pContext->pCmdCtx->fVerbose)
+        if (pContext->pCmdCtx->cVerbose > 1)
             RTPrintf("Directory \"%s\" already exists\n", pszDir);
         return VINF_SUCCESS;
     }
@@ -1735,7 +1942,7 @@ static int ctrlCopyDirCreate(PCOPYCONTEXT pContext, const char *pszDir)
     if (RT_FAILURE(vrc))
         return vrc;
 
-    if (pContext->pCmdCtx->fVerbose)
+    if (pContext->pCmdCtx->cVerbose > 1)
         RTPrintf("Creating directory \"%s\" ...\n", pszDir);
 
     if (pContext->fDryRun)
@@ -1748,7 +1955,7 @@ static int ctrlCopyDirCreate(PCOPYCONTEXT pContext, const char *pszDir)
         HRESULT rc = pContext->pCmdCtx->pGuestSession->DirectoryCreate(Bstr(pszDir).raw(),
                                                                        0700, ComSafeArrayAsInParam(dirCreateFlags));
         if (FAILED(rc))
-            vrc = ctrlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
+            vrc = gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
     }
     else /* ... or on the host. */
     {
@@ -1770,7 +1977,7 @@ static int ctrlCopyDirCreate(PCOPYCONTEXT pContext, const char *pszDir)
  * @param   fExists                 Pointer which receives the result if the
  *                                  given directory exists or not.
  */
-static int ctrlCopyDirExists(PCOPYCONTEXT pContext, bool fOnGuest,
+static int gctlCopyDirExists(PCOPYCONTEXT pContext, bool fOnGuest,
                              const char *pszDir, bool *fExists)
 {
     AssertPtrReturn(pContext, false);
@@ -1781,11 +1988,11 @@ static int ctrlCopyDirExists(PCOPYCONTEXT pContext, bool fOnGuest,
     if (fOnGuest)
     {
         BOOL fDirExists = FALSE;
-        HRESULT rc = pContext->pCmdCtx->pGuestSession->DirectoryExists(Bstr(pszDir).raw(), &fDirExists);
-        if (FAILED(rc))
-            vrc = ctrlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
+        HRESULT rc = pContext->pCmdCtx->pGuestSession->DirectoryExists(Bstr(pszDir).raw(), FALSE /*followSymlinks*/, &fDirExists);
+        if (SUCCEEDED(rc))
+            *fExists = fDirExists != FALSE;
         else
-            *fExists = fDirExists ? true : false;
+            vrc = gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
     }
     else
         *fExists = RTDirExists(pszDir);
@@ -1802,10 +2009,10 @@ static int ctrlCopyDirExists(PCOPYCONTEXT pContext, bool fOnGuest,
  * @param   fExists                 Pointer which receives the result if the
  *                                  given directory exists or not.
  */
-static int ctrlCopyDirExistsOnDest(PCOPYCONTEXT pContext, const char *pszDir,
+static int gctlCopyDirExistsOnDest(PCOPYCONTEXT pContext, const char *pszDir,
                                    bool *fExists)
 {
-    return ctrlCopyDirExists(pContext, pContext->fHostToGuest,
+    return gctlCopyDirExists(pContext, pContext->fHostToGuest,
                              pszDir, fExists);
 }
 
@@ -1819,10 +2026,10 @@ static int ctrlCopyDirExistsOnDest(PCOPYCONTEXT pContext, const char *pszDir,
  * @param   fExists                 Pointer which receives the result if the
  *                                  given directory exists or not.
  */
-static int ctrlCopyDirExistsOnSource(PCOPYCONTEXT pContext, const char *pszDir,
+static int gctlCopyDirExistsOnSource(PCOPYCONTEXT pContext, const char *pszDir,
                                      bool *fExists)
 {
-    return ctrlCopyDirExists(pContext, !pContext->fHostToGuest,
+    return gctlCopyDirExists(pContext, !pContext->fHostToGuest,
                              pszDir, fExists);
 }
 
@@ -1837,7 +2044,7 @@ static int ctrlCopyDirExistsOnSource(PCOPYCONTEXT pContext, const char *pszDir,
  * @param   fExists                 Pointer which receives the result if the
  *                                  given file exists or not.
  */
-static int ctrlCopyFileExists(PCOPYCONTEXT pContext, bool bOnGuest,
+static int gctlCopyFileExists(PCOPYCONTEXT pContext, bool bOnGuest,
                               const char *pszFile, bool *fExists)
 {
     AssertPtrReturn(pContext, false);
@@ -1848,11 +2055,11 @@ static int ctrlCopyFileExists(PCOPYCONTEXT pContext, bool bOnGuest,
     if (bOnGuest)
     {
         BOOL fFileExists = FALSE;
-        HRESULT rc = pContext->pCmdCtx->pGuestSession->FileExists(Bstr(pszFile).raw(), &fFileExists);
-        if (FAILED(rc))
-            vrc = ctrlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
+        HRESULT rc = pContext->pCmdCtx->pGuestSession->FileExists(Bstr(pszFile).raw(), FALSE /*followSymlinks*/, &fFileExists);
+        if (SUCCEEDED(rc))
+            *fExists = fFileExists != FALSE;
         else
-            *fExists = fFileExists ? true : false;
+            vrc = gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
     }
     else
         *fExists = RTFileExists(pszFile);
@@ -1869,10 +2076,10 @@ static int ctrlCopyFileExists(PCOPYCONTEXT pContext, bool bOnGuest,
  * @param   fExists                 Pointer which receives the result if the
  *                                  given file exists or not.
  */
-static int ctrlCopyFileExistsOnDest(PCOPYCONTEXT pContext, const char *pszFile,
+static int gctlCopyFileExistsOnDest(PCOPYCONTEXT pContext, const char *pszFile,
                                     bool *fExists)
 {
-    return ctrlCopyFileExists(pContext, pContext->fHostToGuest,
+    return gctlCopyFileExists(pContext, pContext->fHostToGuest,
                               pszFile, fExists);
 }
 
@@ -1886,10 +2093,10 @@ static int ctrlCopyFileExistsOnDest(PCOPYCONTEXT pContext, const char *pszFile,
  * @param   fExists                 Pointer which receives the result if the
  *                                  given file exists or not.
  */
-static int ctrlCopyFileExistsOnSource(PCOPYCONTEXT pContext, const char *pszFile,
+static int gctlCopyFileExistsOnSource(PCOPYCONTEXT pContext, const char *pszFile,
                                       bool *fExists)
 {
-    return ctrlCopyFileExists(pContext, !pContext->fHostToGuest,
+    return gctlCopyFileExists(pContext, !pContext->fHostToGuest,
                               pszFile, fExists);
 }
 
@@ -1900,18 +2107,18 @@ static int ctrlCopyFileExistsOnSource(PCOPYCONTEXT pContext, const char *pszFile
  * @param   pContext                Pointer to current copy control context.
  * @param   pszFileSource           Source file to copy to the destination.
  * @param   pszFileDest             Name of copied file on the destination.
- * @param   fFlags                  Copy flags. No supported at the moment and needs
- *                                  to be set to 0.
+ * @param   enmFlags                Copy flags. No supported at the moment and
+ *                                  needs to be set to 0.
  */
-static int ctrlCopyFileToDest(PCOPYCONTEXT pContext, const char *pszFileSource,
-                              const char *pszFileDest, uint32_t fFlags)
+static int gctlCopyFileToDest(PCOPYCONTEXT pContext, const char *pszFileSource,
+                              const char *pszFileDest, gctlCopyFlags enmFlags)
 {
     AssertPtrReturn(pContext, VERR_INVALID_POINTER);
     AssertPtrReturn(pszFileSource, VERR_INVALID_POINTER);
     AssertPtrReturn(pszFileDest, VERR_INVALID_POINTER);
-    AssertReturn(!fFlags, VERR_INVALID_POINTER); /* No flags supported yet. */
+    AssertReturn(enmFlags == kGctlCopyFlags_None, VERR_INVALID_PARAMETER); /* No flags supported yet. */
 
-    if (pContext->pCmdCtx->fVerbose)
+    if (pContext->pCmdCtx->cVerbose > 1)
         RTPrintf("Copying \"%s\" to \"%s\" ...\n",
                  pszFileSource, pszFileDest);
 
@@ -1923,32 +2130,32 @@ static int ctrlCopyFileToDest(PCOPYCONTEXT pContext, const char *pszFileSource,
     HRESULT rc;
     if (pContext->fHostToGuest)
     {
-        SafeArray<CopyFileFlag_T> copyFlags;
-        rc = pContext->pCmdCtx->pGuestSession->CopyTo(Bstr(pszFileSource).raw(), Bstr(pszFileDest).raw(),
-                                               ComSafeArrayAsInParam(copyFlags),
-                                               pProgress.asOutParam());
+        SafeArray<FileCopyFlag_T> copyFlags;
+        rc = pContext->pCmdCtx->pGuestSession->FileCopyToGuest(Bstr(pszFileSource).raw(), Bstr(pszFileDest).raw(),
+                                                               ComSafeArrayAsInParam(copyFlags),
+                                                               pProgress.asOutParam());
     }
     else
     {
-        SafeArray<CopyFileFlag_T> copyFlags;
-        rc = pContext->pCmdCtx->pGuestSession->CopyFrom(Bstr(pszFileSource).raw(), Bstr(pszFileDest).raw(),
-                                               ComSafeArrayAsInParam(copyFlags),
-                                               pProgress.asOutParam());
+        SafeArray<FileCopyFlag_T> copyFlags;
+        rc = pContext->pCmdCtx->pGuestSession->FileCopyFromGuest(Bstr(pszFileSource).raw(), Bstr(pszFileDest).raw(),
+                                                                 ComSafeArrayAsInParam(copyFlags),
+                                                                 pProgress.asOutParam());
     }
 
     if (FAILED(rc))
     {
-        vrc = ctrlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
+        vrc = gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
     }
     else
     {
-        if (pContext->pCmdCtx->fVerbose)
+        if (pContext->pCmdCtx->cVerbose > 1)
             rc = showProgress(pProgress);
         else
             rc = pProgress->WaitForCompletion(-1 /* No timeout */);
         if (SUCCEEDED(rc))
             CHECK_PROGRESS_ERROR(pProgress, ("File copy failed"));
-        vrc = ctrlPrintProgressError(pProgress);
+        vrc = gctlPrintProgressError(pProgress);
     }
 
     return vrc;
@@ -1962,13 +2169,13 @@ static int ctrlCopyFileToDest(PCOPYCONTEXT pContext, const char *pszFileSource,
  * @param   pszSource               Source directory on the host to copy to the guest.
  * @param   pszFilter               DOS-style wildcard filter (?, *).  Optional.
  * @param   pszDest                 Destination directory on the guest.
- * @param   fFlags                  Copy flags, such as recursive copying.
+ * @param   enmFlags                Copy flags, such as recursive copying.
  * @param   pszSubDir               Current sub directory to handle. Needs to NULL and only
  *                                  is needed for recursion.
  */
-static int ctrlCopyDirToGuest(PCOPYCONTEXT pContext,
+static int gctlCopyDirToGuest(PCOPYCONTEXT pContext,
                               const char *pszSource, const char *pszFilter,
-                              const char *pszDest, uint32_t fFlags,
+                              const char *pszDest, enum gctlCopyFlags enmFlags,
                               const char *pszSubDir /* For recursion. */)
 {
     AssertPtrReturn(pContext, VERR_INVALID_POINTER);
@@ -1985,7 +2192,7 @@ static int ctrlCopyDirToGuest(PCOPYCONTEXT pContext,
     if (RT_SUCCESS(vrc) && pszSubDir)
         vrc = RTPathAppend(szCurDir, sizeof(szCurDir), pszSubDir);
 
-    if (pContext->pCmdCtx->fVerbose)
+    if (pContext->pCmdCtx->cVerbose > 1)
         RTPrintf("Processing host directory: %s\n", szCurDir);
 
     /* Flag indicating whether the current directory was created on the
@@ -2030,10 +2237,10 @@ static int ctrlCopyDirToGuest(PCOPYCONTEXT pContext,
                         || !strcmp(DirEntry.szName, ".."))
                         break;
 
-                    if (pContext->pCmdCtx->fVerbose)
+                    if (pContext->pCmdCtx->cVerbose > 1)
                         RTPrintf("Directory: %s\n", DirEntry.szName);
 
-                    if (fFlags & CopyFileFlag_Recursive)
+                    if (enmFlags & kGctlCopyFlags_Recursive)
                     {
                         char *pszNewSub = NULL;
                         if (pszSubDir)
@@ -2046,9 +2253,9 @@ static int ctrlCopyDirToGuest(PCOPYCONTEXT pContext,
 
                         if (pszNewSub)
                         {
-                            vrc = ctrlCopyDirToGuest(pContext,
+                            vrc = gctlCopyDirToGuest(pContext,
                                                      pszSource, pszFilter,
-                                                     pszDest, fFlags, pszNewSub);
+                                                     pszDest, enmFlags, pszNewSub);
                             RTStrFree(pszNewSub);
                         }
                         else
@@ -2058,8 +2265,8 @@ static int ctrlCopyDirToGuest(PCOPYCONTEXT pContext,
                 }
 
                 case RTDIRENTRYTYPE_SYMLINK:
-                    if (   (fFlags & CopyFileFlag_Recursive)
-                        && (fFlags & CopyFileFlag_FollowLinks))
+                    if (   (enmFlags & kGctlCopyFlags_Recursive)
+                        && (enmFlags & kGctlCopyFlags_FollowLinks))
                     {
                         /* Fall through to next case is intentional. */
                     }
@@ -2074,17 +2281,17 @@ static int ctrlCopyDirToGuest(PCOPYCONTEXT pContext,
                         break; /* Filter does not match. */
                     }
 
-                    if (pContext->pCmdCtx->fVerbose)
+                    if (pContext->pCmdCtx->cVerbose > 1)
                         RTPrintf("File: %s\n", DirEntry.szName);
 
                     if (!fDirCreated)
                     {
                         char *pszDestDir;
-                        vrc = ctrlCopyTranslatePath(pszSource, szCurDir,
+                        vrc = gctlCopyTranslatePath(pszSource, szCurDir,
                                                     pszDest, &pszDestDir);
                         if (RT_SUCCESS(vrc))
                         {
-                            vrc = ctrlCopyDirCreate(pContext, pszDestDir);
+                            vrc = gctlCopyDirCreate(pContext, pszDestDir);
                             RTStrFree(pszDestDir);
 
                             fDirCreated = true;
@@ -2097,12 +2304,12 @@ static int ctrlCopyDirToGuest(PCOPYCONTEXT pContext,
                         if (pszFileSource)
                         {
                             char *pszFileDest;
-                            vrc = ctrlCopyTranslatePath(pszSource, pszFileSource,
+                            vrc = gctlCopyTranslatePath(pszSource, pszFileSource,
                                                        pszDest, &pszFileDest);
                             if (RT_SUCCESS(vrc))
                             {
-                                vrc = ctrlCopyFileToDest(pContext, pszFileSource,
-                                                        pszFileDest, 0 /* Flags */);
+                                vrc = gctlCopyFileToDest(pContext, pszFileSource,
+                                                         pszFileDest, kGctlCopyFlags_None);
                                 RTStrFree(pszFileDest);
                             }
                             RTStrFree(pszFileSource);
@@ -2131,13 +2338,13 @@ static int ctrlCopyDirToGuest(PCOPYCONTEXT pContext,
  * @param   pszSource               Source directory on the guest to copy to the host.
  * @param   pszFilter               DOS-style wildcard filter (?, *).  Optional.
  * @param   pszDest                 Destination directory on the host.
- * @param   fFlags                  Copy flags, such as recursive copying.
+ * @param   enmFlags                Copy flags, such as recursive copying.
  * @param   pszSubDir               Current sub directory to handle. Needs to NULL and only
  *                                  is needed for recursion.
  */
-static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
+static int gctlCopyDirToHost(PCOPYCONTEXT pContext,
                              const char *pszSource, const char *pszFilter,
-                             const char *pszDest, uint32_t fFlags,
+                             const char *pszDest, gctlCopyFlags enmFlags,
                              const char *pszSubDir /* For recursion. */)
 {
     AssertPtrReturn(pContext, VERR_INVALID_POINTER);
@@ -2157,7 +2364,7 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
     if (RT_FAILURE(vrc))
         return vrc;
 
-    if (pContext->pCmdCtx->fVerbose)
+    if (pContext->pCmdCtx->cVerbose > 1)
         RTPrintf("Processing guest directory: %s\n", szCurDir);
 
     /* Flag indicating whether the current directory was created on the
@@ -2169,7 +2376,7 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
                                                         ComSafeArrayAsInParam(dirOpenFlags),
                                                         pDirectory.asOutParam());
     if (FAILED(rc))
-        return ctrlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
+        return gctlPrintError(pContext->pCmdCtx->pGuestSession, COM_IIDOF(IGuestSession));
     ComPtr<IFsObjInfo> dirEntry;
     while (true)
     {
@@ -2194,13 +2401,13 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
                     || !strName.compare(Bstr("..")))
                     break;
 
-                if (pContext->pCmdCtx->fVerbose)
+                if (pContext->pCmdCtx->cVerbose > 1)
                 {
                     Utf8Str strDir(strName);
                     RTPrintf("Directory: %s\n", strDir.c_str());
                 }
 
-                if (fFlags & CopyFileFlag_Recursive)
+                if (enmFlags & kGctlCopyFlags_Recursive)
                 {
                     Utf8Str strDir(strName);
                     char *pszNewSub = NULL;
@@ -2213,9 +2420,9 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
                     }
                     if (pszNewSub)
                     {
-                        vrc = ctrlCopyDirToHost(pContext,
+                        vrc = gctlCopyDirToHost(pContext,
                                                 pszSource, pszFilter,
-                                                pszDest, fFlags, pszNewSub);
+                                                pszDest, enmFlags, pszNewSub);
                         RTStrFree(pszNewSub);
                     }
                     else
@@ -2225,8 +2432,8 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
             }
 
             case FsObjType_Symlink:
-                if (   (fFlags & CopyFileFlag_Recursive)
-                    && (fFlags & CopyFileFlag_FollowLinks))
+                if (   (enmFlags & kGctlCopyFlags_Recursive)
+                    && (enmFlags & kGctlCopyFlags_FollowLinks))
                 {
                     /* Fall through to next case is intentional. */
                 }
@@ -2244,17 +2451,17 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
                     break; /* Filter does not match. */
                 }
 
-                if (pContext->pCmdCtx->fVerbose)
+                if (pContext->pCmdCtx->cVerbose > 1)
                     RTPrintf("File: %s\n", strFile.c_str());
 
                 if (!fDirCreated)
                 {
                     char *pszDestDir;
-                    vrc = ctrlCopyTranslatePath(pszSource, szCurDir,
+                    vrc = gctlCopyTranslatePath(pszSource, szCurDir,
                                                 pszDest, &pszDestDir);
                     if (RT_SUCCESS(vrc))
                     {
-                        vrc = ctrlCopyDirCreate(pContext, pszDestDir);
+                        vrc = gctlCopyDirCreate(pContext, pszDestDir);
                         RTStrFree(pszDestDir);
 
                         fDirCreated = true;
@@ -2267,12 +2474,12 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
                     if (pszFileSource)
                     {
                         char *pszFileDest;
-                        vrc = ctrlCopyTranslatePath(pszSource, pszFileSource,
+                        vrc = gctlCopyTranslatePath(pszSource, pszFileSource,
                                                    pszDest, &pszFileDest);
                         if (RT_SUCCESS(vrc))
                         {
-                            vrc = ctrlCopyFileToDest(pContext, pszFileSource,
-                                                    pszFileDest, 0 /* Flags */);
+                            vrc = gctlCopyFileToDest(pContext, pszFileSource,
+                                                     pszFileDest, kGctlCopyFlags_None);
                             RTStrFree(pszFileDest);
                         }
                         RTStrFree(pszFileSource);
@@ -2309,7 +2516,7 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
             }
 
             default:
-                vrc = ctrlPrintError(pDirectory, COM_IIDOF(IGuestDirectory));
+                vrc = gctlPrintError(pDirectory, COM_IIDOF(IGuestDirectory));
                 break;
         }
     }
@@ -2317,7 +2524,7 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
     HRESULT rc2 = pDirectory->Close();
     if (FAILED(rc2))
     {
-        int vrc2 = ctrlPrintError(pDirectory, COM_IIDOF(IGuestDirectory));
+        int vrc2 = gctlPrintError(pDirectory, COM_IIDOF(IGuestDirectory));
         if (RT_SUCCESS(vrc))
             vrc = vrc2;
     }
@@ -2337,17 +2544,17 @@ static int ctrlCopyDirToHost(PCOPYCONTEXT pContext,
  * @param   pszFilter               DOS-style wildcard filter (?, *).  Optional.
  * @param   pszDest                 Destination directory where to copy in the source
  *                                  source directory.
- * @param   fFlags                  Copy flags, such as recursive copying.
+ * @param   enmFlags                Copy flags, such as recursive copying.
  */
-static int ctrlCopyDirToDest(PCOPYCONTEXT pContext,
+static int gctlCopyDirToDest(PCOPYCONTEXT pContext,
                              const char *pszSource, const char *pszFilter,
-                             const char *pszDest, uint32_t fFlags)
+                             const char *pszDest, enum gctlCopyFlags enmFlags)
 {
     if (pContext->fHostToGuest)
-        return ctrlCopyDirToGuest(pContext, pszSource, pszFilter,
-                                  pszDest, fFlags, NULL /* Sub directory, only for recursion. */);
-    return ctrlCopyDirToHost(pContext, pszSource, pszFilter,
-                             pszDest, fFlags, NULL /* Sub directory, only for recursion. */);
+        return gctlCopyDirToGuest(pContext, pszSource, pszFilter,
+                                  pszDest, enmFlags, NULL /* Sub directory, only for recursion. */);
+    return gctlCopyDirToHost(pContext, pszSource, pszFilter,
+                             pszDest, enmFlags, NULL /* Sub directory, only for recursion. */);
 }
 
 /**
@@ -2356,9 +2563,9 @@ static int ctrlCopyDirToDest(PCOPYCONTEXT pContext,
  * @return  IPRT status code.
  * @param   pszSource               Source to create source root for.
  * @param   ppszSourceRoot          Pointer that receives the allocated source root. Needs
- *                                  to be free'd with ctrlCopyFreeSourceRoot().
+ *                                  to be free'd with gctlCopyFreeSourceRoot().
  */
-static int ctrlCopyCreateSourceRoot(const char *pszSource, char **ppszSourceRoot)
+static int gctlCopyCreateSourceRoot(const char *pszSource, char **ppszSourceRoot)
 {
     AssertPtrReturn(pszSource, VERR_INVALID_POINTER);
     AssertPtrReturn(ppszSourceRoot, VERR_INVALID_POINTER);
@@ -2402,12 +2609,12 @@ static int ctrlCopyCreateSourceRoot(const char *pszSource, char **ppszSourceRoot
  * @return  IPRT status code.
  * @param   pszSourceRoot           Source root to free.
  */
-static void ctrlCopyFreeSourceRoot(char *pszSourceRoot)
+static void gctlCopyFreeSourceRoot(char *pszSourceRoot)
 {
     RTStrFree(pszSourceRoot);
 }
 
-static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
+static RTEXITCODE gctlHandleCopy(PGCTLCMDCTX pCtx, int argc, char **argv, bool fHostToGuest)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
@@ -2425,8 +2632,15 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
      * what and how to implement the file enumeration/recursive lookup, like VBoxManage
      * does in here.
      */
+    enum GETOPTDEF_COPY
+    {
+        GETOPTDEF_COPY_DRYRUN = 1000,
+        GETOPTDEF_COPY_FOLLOW,
+        GETOPTDEF_COPY_TARGETDIR
+    };
     static const RTGETOPTDEF s_aOptions[] =
     {
+        GCTLCMD_COMMON_OPTION_DEFS()
         { "--dryrun",              GETOPTDEF_COPY_DRYRUN,           RTGETOPT_REQ_NOTHING },
         { "--follow",              GETOPTDEF_COPY_FOLLOW,           RTGETOPT_REQ_NOTHING },
         { "--recursive",           'R',                             RTGETOPT_REQ_NOTHING },
@@ -2436,12 +2650,11 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 s_aOptions, RT_ELEMENTS(s_aOptions), pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
     Utf8Str strSource;
-    Utf8Str strDest;
-    uint32_t fFlags = CopyFileFlag_None;
+    const char *pszDst = NULL;
+    enum gctlCopyFlags enmFlags = kGctlCopyFlags_None;
     bool fCopyRecursive = false;
     bool fDryRun = false;
     uint32_t uUsage = fHostToGuest ? USAGE_GSTCTRL_COPYTO : USAGE_GSTCTRL_COPYFROM;
@@ -2449,44 +2662,48 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
     SOURCEVEC vecSources;
 
     int vrc = VINF_SUCCESS;
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case GETOPTDEF_COPY_DRYRUN:
                 fDryRun = true;
                 break;
 
             case GETOPTDEF_COPY_FOLLOW:
-                fFlags |= CopyFileFlag_FollowLinks;
+                enmFlags = (enum gctlCopyFlags)((uint32_t)enmFlags | kGctlCopyFlags_FollowLinks);
                 break;
 
             case 'R': /* Recursive processing */
-                fFlags |= CopyFileFlag_Recursive;
+                enmFlags = (enum gctlCopyFlags)((uint32_t)enmFlags | kGctlCopyFlags_Recursive);
                 break;
 
             case GETOPTDEF_COPY_TARGETDIR:
-                strDest = ValueUnion.psz;
+                pszDst = ValueUnion.psz;
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
-            {
                 /* Last argument and no destination specified with
                  * --target-directory yet? Then use the current
                  * (= last) argument as destination. */
-                if (  pCtx->iArgc == GetState.iNext
-                    && strDest.isEmpty())
-                {
-                    strDest = ValueUnion.psz;
-                }
+                if (   pCtx->pArg->argc == GetState.iNext
+                    && pszDst == NULL)
+                    pszDst = ValueUnion.psz;
                 else
                 {
-                    /* Save the source directory. */
-                    vecSources.push_back(SOURCEFILEENTRY(ValueUnion.psz));
+                    try
+                    {   /* Save the source directory. */
+                        vecSources.push_back(SOURCEFILEENTRY(ValueUnion.psz));
+                    }
+                    catch (std::bad_alloc &)
+                    {
+                        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Out of memory");
+                    }
                 }
                 break;
-            }
 
             default:
                 return errorGetOptEx(USAGE_GUESTCONTROL, uUsage, ch, &ValueUnion);
@@ -2494,17 +2711,19 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
     }
 
     if (!vecSources.size())
-        return errorSyntaxEx(USAGE_GUESTCONTROL, uUsage,
-                             "No source(s) specified!");
+        return errorSyntaxEx(USAGE_GUESTCONTROL, uUsage, "No source(s) specified!");
 
-    if (strDest.isEmpty())
-        return errorSyntaxEx(USAGE_GUESTCONTROL, uUsage,
-                             "No destination specified!");
+    if (pszDst == NULL)
+        return errorSyntaxEx(USAGE_GUESTCONTROL, uUsage, "No destination specified!");
+
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
 
     /*
      * Done parsing arguments, do some more preparations.
      */
-    if (pCtx->fVerbose)
+    if (pCtx->cVerbose > 1)
     {
         if (fHostToGuest)
             RTPrintf("Copying from host to guest ...\n");
@@ -2517,7 +2736,7 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
     /* Create the copy context -- it contains all information
      * the routines need to know when handling the actual copying. */
     PCOPYCONTEXT pContext = NULL;
-    vrc = ctrlCopyContextCreate(pCtx, fDryRun, fHostToGuest,
+    vrc = gctlCopyContextCreate(pCtx, fDryRun, fHostToGuest,
                                   fHostToGuest
                                 ? "VBoxManage Guest Control - Copy to guest"
                                 : "VBoxManage Guest Control - Copy from guest", &pContext);
@@ -2527,8 +2746,6 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
         return RTEXITCODE_FAILURE;
     }
 
-    /* If the destination is a path, (try to) create it. */
-    const char *pszDest = strDest.c_str();
 /** @todo r=bird: RTPathFilename and RTPathStripFilename won't work
  * correctly on non-windows hosts when the guest is from the DOS world (Windows,
  * OS/2, DOS).  The host doesn't know about DOS slashes, only UNIX slashes and
@@ -2540,20 +2757,20 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
  *
  * @bugref{6344}
  */
-    if (!RTPathFilename(pszDest))
+    if (!RTPathFilename(pszDst))
     {
-        vrc = ctrlCopyDirCreate(pContext, pszDest);
+        vrc = gctlCopyDirCreate(pContext, pszDst);
     }
     else
     {
         /* We assume we got a file name as destination -- so strip
          * the actual file name and make sure the appropriate
          * directories get created. */
-        char *pszDestDir = RTStrDup(pszDest);
-        AssertPtr(pszDestDir);
-        RTPathStripFilename(pszDestDir);
-        vrc = ctrlCopyDirCreate(pContext, pszDestDir);
-        RTStrFree(pszDestDir);
+        char *pszDstDir = RTStrDup(pszDst);
+        AssertPtr(pszDstDir);
+        RTPathStripFilename(pszDstDir);
+        vrc = gctlCopyDirCreate(pContext, pszDstDir);
+        RTStrFree(pszDstDir);
     }
 
     if (RT_SUCCESS(vrc))
@@ -2571,14 +2788,14 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
                 pszFilter = NULL; /* If empty filter then there's no filter :-) */
 
             char *pszSourceRoot;
-            vrc = ctrlCopyCreateSourceRoot(pszSource, &pszSourceRoot);
+            vrc = gctlCopyCreateSourceRoot(pszSource, &pszSourceRoot);
             if (RT_FAILURE(vrc))
             {
                 RTMsgError("Unable to create source root, rc=%Rrc\n", vrc);
                 break;
             }
 
-            if (pCtx->fVerbose)
+            if (pCtx->cVerbose > 1)
                 RTPrintf("Source: %s\n", pszSource);
 
             /** @todo Files with filter?? */
@@ -2590,9 +2807,9 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
                 && RTPATH_IS_SLASH(pszSource[cchSource - 1]))
             {
                 if (pszFilter) /* Directory with filter (so use source root w/o the actual filter). */
-                    vrc = ctrlCopyDirExistsOnSource(pContext, pszSourceRoot, &fSourceExists);
+                    vrc = gctlCopyDirExistsOnSource(pContext, pszSourceRoot, &fSourceExists);
                 else /* Regular directory without filter. */
-                    vrc = ctrlCopyDirExistsOnSource(pContext, pszSource, &fSourceExists);
+                    vrc = gctlCopyDirExistsOnSource(pContext, pszSource, &fSourceExists);
 
                 if (fSourceExists)
                 {
@@ -2603,7 +2820,7 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
             }
             else
             {
-                vrc = ctrlCopyFileExistsOnSource(pContext, pszSource, &fSourceExists);
+                vrc = gctlCopyFileExistsOnSource(pContext, pszSource, &fSourceExists);
                 if (   RT_SUCCESS(vrc)
                     && fSourceExists)
                 {
@@ -2617,28 +2834,24 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
                 if (fSourceIsFile)
                 {
                     /* Single file. */
-                    char *pszDestFile;
-                    vrc = ctrlCopyTranslatePath(pszSourceRoot, pszSource,
-                                                strDest.c_str(), &pszDestFile);
+                    char *pszDstFile;
+                    vrc = gctlCopyTranslatePath(pszSourceRoot, pszSource, pszDst, &pszDstFile);
                     if (RT_SUCCESS(vrc))
                     {
-                        vrc = ctrlCopyFileToDest(pContext, pszSource,
-                                                 pszDestFile, 0 /* Flags */);
-                        RTStrFree(pszDestFile);
+                        vrc = gctlCopyFileToDest(pContext, pszSource, pszDstFile, kGctlCopyFlags_None);
+                        RTStrFree(pszDstFile);
                     }
                     else
-                        RTMsgError("Unable to translate path for \"%s\", rc=%Rrc\n",
-                                   pszSource, vrc);
+                        RTMsgError("Unable to translate path for \"%s\", rc=%Rrc\n", pszSource, vrc);
                 }
                 else
                 {
                     /* Directory (with filter?). */
-                    vrc = ctrlCopyDirToDest(pContext, pszSource, pszFilter,
-                                            strDest.c_str(), fFlags);
+                    vrc = gctlCopyDirToDest(pContext, pszSource, pszFilter, pszDst, enmFlags);
                 }
             }
 
-            ctrlCopyFreeSourceRoot(pszSourceRoot);
+            gctlCopyFreeSourceRoot(pszSourceRoot);
 
             if (   RT_SUCCESS(vrc)
                 && !fSourceExists)
@@ -2660,27 +2873,28 @@ static RTEXITCODE handleCtrlCopy(PGCTLCMDCTX pCtx, bool fHostToGuest)
         }
     }
 
-    ctrlCopyContextFree(pContext);
+    gctlCopyContextFree(pContext);
 
     return RT_SUCCESS(vrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlCopyFrom(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleCopyFrom(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
-    return handleCtrlCopy(pCtx, false /* Guest to host */);
+    return gctlHandleCopy(pCtx, argc, argv, false /* Guest to host */);
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlCopyTo(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleCopyTo(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
-    return handleCtrlCopy(pCtx, true /* Host to guest */);
+    return gctlHandleCopy(pCtx, argc, argv, true /* Host to guest */);
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlCreateDirectory(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) handleCtrtMkDir(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
     static const RTGETOPTDEF s_aOptions[] =
     {
+        GCTLCMD_COMMON_OPTION_DEFS()
         { "--mode",                'm',                             RTGETOPT_REQ_UINT32  },
         { "--parents",             'P',                             RTGETOPT_REQ_NOTHING }
     };
@@ -2688,18 +2902,20 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlCreateDirectory(PGCTLCMDCTX pCtx)
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 s_aOptions, RT_ELEMENTS(s_aOptions), pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 2, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
     SafeArray<DirectoryCreateFlag_T> dirCreateFlags;
-    uint32_t fDirMode = 0; /* Default mode. */
-    DESTDIRMAP mapDirs;
+    uint32_t    fDirMode     = 0; /* Default mode. */
+    uint32_t    cDirsCreated = 0;
+    RTEXITCODE  rcExit       = RTEXITCODE_SUCCESS;
 
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case 'm': /* Mode */
                 fDirMode = ValueUnion.u32;
                 break;
@@ -2709,210 +2925,278 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlCreateDirectory(PGCTLCMDCTX pCtx)
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
-                mapDirs[ValueUnion.psz]; /* Add destination directory to map. */
+                if (cDirsCreated == 0)
+                {
+                    /*
+                     * First non-option - no more options now.
+                     */
+                    rcExit = gctlCtxPostOptionParsingInit(pCtx);
+                    if (rcExit != RTEXITCODE_SUCCESS)
+                        return rcExit;
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Creating %RU32 directories...\n", argc - GetState.iNext + 1);
+                }
+                if (g_fGuestCtrlCanceled)
+                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "mkdir was interrupted by Ctrl-C (%u left)\n",
+                                          argc - GetState.iNext + 1);
+
+                /*
+                 * Create the specified directory.
+                 *
+                 * On failure we'll change the exit status to failure and
+                 * continue with the next directory that needs creating. We do
+                 * this because we only create new things, and because this is
+                 * how /bin/mkdir works on unix.
+                 */
+                cDirsCreated++;
+                if (pCtx->cVerbose > 1)
+                    RTPrintf("Creating directory \"%s\" ...\n", ValueUnion.psz);
+                try
+                {
+                    HRESULT rc;
+                    CHECK_ERROR(pCtx->pGuestSession, DirectoryCreate(Bstr(ValueUnion.psz).raw(),
+                                                                     fDirMode, ComSafeArrayAsInParam(dirCreateFlags)));
+                    if (FAILED(rc))
+                        rcExit = RTEXITCODE_FAILURE;
+                }
+                catch (std::bad_alloc &)
+                {
+                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "Out of memory\n");
+                }
                 break;
 
             default:
-                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CREATEDIR, ch, &ValueUnion);
+                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MKDIR, ch, &ValueUnion);
         }
     }
 
-    uint32_t cDirs = mapDirs.size();
-    if (!cDirs)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CREATEDIR,
-                             "No directory to create specified!");
-
-    /*
-     * Create the directories.
-     */
-    HRESULT rc = S_OK;
-    if (pCtx->fVerbose && cDirs)
-        RTPrintf("Creating %RU32 directories ...\n", cDirs);
-
-    DESTDIRMAPITER it = mapDirs.begin();
-    while (   (it != mapDirs.end())
-           && !g_fGuestCtrlCanceled)
-    {
-        if (pCtx->fVerbose)
-            RTPrintf("Creating directory \"%s\" ...\n", it->first.c_str());
-
-        CHECK_ERROR_BREAK(pCtx->pGuestSession, DirectoryCreate(Bstr(it->first).raw(),
-                                               fDirMode, ComSafeArrayAsInParam(dirCreateFlags)));
-        it++;
-    }
-
-    return FAILED(rc) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS;
+    if (!cDirsCreated)
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MKDIR, "No directory to create specified!");
+    return rcExit;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlRemoveDirectory(PGCTLCMDCTX pCtx)
+
+static DECLCALLBACK(RTEXITCODE) gctlHandleRmDir(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
     static const RTGETOPTDEF s_aOptions[] =
     {
-        { "--recursive",           'R',                             RTGETOPT_REQ_NOTHING }
+        GCTLCMD_COMMON_OPTION_DEFS()
+        { "--recursive",           'R',                             RTGETOPT_REQ_NOTHING },
     };
 
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 s_aOptions, RT_ELEMENTS(s_aOptions), pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
-    bool fRecursive = false;
-    DESTDIRMAP mapDirs;
+    bool        fRecursive  = false;
+    uint32_t    cDirRemoved = 0;
+    RTEXITCODE  rcExit      = RTEXITCODE_SUCCESS;
 
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case 'R':
                 fRecursive = true;
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
-                mapDirs[ValueUnion.psz]; /* Add destination directory to map. */
-                break;
-
-            default:
-                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_REMOVEDIR, ch, &ValueUnion);
-        }
-    }
-
-    uint32_t cDirs = mapDirs.size();
-    if (!cDirs)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_REMOVEDIR,
-                             "No directory to remove specified!");
-
-    /*
-     * Remove the directories.
-     */
-    HRESULT rc = S_OK;
-    if (pCtx->fVerbose && cDirs)
-        RTPrintf("Removing %RU32 directories ...\n", cDirs);
-
-    DESTDIRMAPITER it = mapDirs.begin();
-    while (   (it != mapDirs.end())
-           && !g_fGuestCtrlCanceled)
-    {
-        if (pCtx->fVerbose)
-            RTPrintf("%s directory \"%s\" ...\n",
-                     fRecursive ? "Recursively removing" : "Removing",
-                     it->first.c_str());
-        try
-        {
-            if (fRecursive)
             {
-                com::SafeArray<DirectoryRemoveRecFlag_T> aRemRecFlags;
-                /** @todo Make flags configurable. */
-                aRemRecFlags.push_back(DirectoryRemoveRecFlag_ContentAndDir);
-
-                ComPtr<IProgress> pProgress;
-                CHECK_ERROR_BREAK(pCtx->pGuestSession, DirectoryRemoveRecursive(Bstr(it->first).raw(),
-                                                                                ComSafeArrayAsInParam(aRemRecFlags),
-                                                                                pProgress.asOutParam()));
-                if (pCtx->fVerbose)
-                    rc = showProgress(pProgress);
+                if (cDirRemoved == 0)
+                {
+                    /*
+                     * First non-option - no more options now.
+                     */
+                    rcExit = gctlCtxPostOptionParsingInit(pCtx);
+                    if (rcExit != RTEXITCODE_SUCCESS)
+                        return rcExit;
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Removing %RU32 directorie%ss...\n", argc - GetState.iNext + 1, fRecursive ? "trees" : "");
+                }
+                if (g_fGuestCtrlCanceled)
+                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "rmdir was interrupted by Ctrl-C (%u left)\n",
+                                          argc - GetState.iNext + 1);
+
+                cDirRemoved++;
+                HRESULT rc;
+                if (!fRecursive)
+                {
+                    /*
+                     * Remove exactly one directory.
+                     */
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Removing directory \"%s\" ...\n", ValueUnion.psz);
+                    try
+                    {
+                        CHECK_ERROR(pCtx->pGuestSession, DirectoryRemove(Bstr(ValueUnion.psz).raw()));
+                    }
+                    catch (std::bad_alloc &)
+                    {
+                        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Out of memory\n");
+                    }
+                }
                 else
-                    rc = pProgress->WaitForCompletion(-1 /* No timeout */);
-                if (SUCCEEDED(rc))
-                    CHECK_PROGRESS_ERROR(pProgress, ("Directory deletion failed"));
+                {
+                    /*
+                     * Remove the directory and anything under it, that means files
+                     * and everything.  This is in the tradition of the Windows NT
+                     * CMD.EXE "rmdir /s" operation, a tradition which jpsoft's TCC
+                     * strongly warns against (and half-ways questions the sense of).
+                     */
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Recursively removing directory \"%s\" ...\n", ValueUnion.psz);
+                    try
+                    {
+                        /** @todo Make flags configurable. */
+                        com::SafeArray<DirectoryRemoveRecFlag_T> aRemRecFlags;
+                        aRemRecFlags.push_back(DirectoryRemoveRecFlag_ContentAndDir);
+
+                        ComPtr<IProgress> ptrProgress;
+                        CHECK_ERROR(pCtx->pGuestSession, DirectoryRemoveRecursive(Bstr(ValueUnion.psz).raw(),
+                                                                                  ComSafeArrayAsInParam(aRemRecFlags),
+                                                                                  ptrProgress.asOutParam()));
+                        if (SUCCEEDED(rc))
+                        {
+                            if (pCtx->cVerbose > 1)
+                                rc = showProgress(ptrProgress);
+                            else
+                                rc = ptrProgress->WaitForCompletion(-1 /* indefinitely */);
+                            if (SUCCEEDED(rc))
+                                CHECK_PROGRESS_ERROR(ptrProgress, ("Directory deletion failed"));
+                            ptrProgress.setNull();
+                        }
+                    }
+                    catch (std::bad_alloc &)
+                    {
+                        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Out of memory during recursive rmdir\n");
+                    }
+                }
 
-                pProgress.setNull();
+                /*
+                 * This command returns immediately on failure since it's destructive in nature.
+                 */
+                if (FAILED(rc))
+                    return RTEXITCODE_FAILURE;
+                break;
             }
-            else
-                CHECK_ERROR_BREAK(pCtx->pGuestSession, DirectoryRemove(Bstr(it->first).raw()));
-        }
-        catch (std::bad_alloc)
-        {
-            rc = E_OUTOFMEMORY;
-            break;
-        }
 
-        it++;
+            default:
+                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RMDIR, ch, &ValueUnion);
+        }
     }
 
-    return FAILED(rc) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS;
+    if (!cDirRemoved)
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RMDIR, "No directory to remove specified!");
+    return rcExit;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlRemoveFile(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleRm(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        GCTLCMD_COMMON_OPTION_DEFS()
+        { "--force",                         'f',                                       RTGETOPT_REQ_NOTHING, },
+    };
+
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 NULL /* s_aOptions */, 0 /* RT_ELEMENTS(s_aOptions) */,
-                 pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
-    DESTDIRMAP mapDirs;
+    uint32_t    cFilesDeleted   = 0;
+    RTEXITCODE  rcExit          = RTEXITCODE_SUCCESS;
+    bool        fForce         = true;
 
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case VINF_GETOPT_NOT_OPTION:
-                mapDirs[ValueUnion.psz]; /* Add destination directory to map. */
+                if (cFilesDeleted == 0)
+                {
+                    /*
+                     * First non-option - no more options now.
+                     */
+                    rcExit = gctlCtxPostOptionParsingInit(pCtx);
+                    if (rcExit != RTEXITCODE_SUCCESS)
+                        return rcExit;
+                    if (pCtx->cVerbose > 1)
+                        RTPrintf("Removing %RU32 file(s)...\n", argc - GetState.iNext + 1);
+                }
+                if (g_fGuestCtrlCanceled)
+                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "rm was interrupted by Ctrl-C (%u left)\n",
+                                          argc - GetState.iNext + 1);
+
+                /*
+                 * Remove the specified file.
+                 *
+                 * On failure we will by default stop, however, the force option will
+                 * by unix traditions force us to ignore errors and continue.
+                 */
+                cFilesDeleted++;
+                if (pCtx->cVerbose > 1)
+                    RTPrintf("Removing file \"%s\" ...\n", ValueUnion.psz);
+                try
+                {
+                    /** @todo How does IGuestSession::FsObjRemove work with read-only files? Do we
+                     *        need to do some chmod or whatever to better emulate the --force flag? */
+                    HRESULT rc;
+                    CHECK_ERROR(pCtx->pGuestSession, FsObjRemove(Bstr(ValueUnion.psz).raw()));
+                    if (FAILED(rc) && !fForce)
+                        return RTEXITCODE_FAILURE;
+                }
+                catch (std::bad_alloc &)
+                {
+                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "Out of memory\n");
+                }
                 break;
 
             default:
-                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_REMOVEFILE, ch, &ValueUnion);
+                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RM, ch, &ValueUnion);
         }
     }
 
-    uint32_t cFiles = mapDirs.size();
-    if (!cFiles)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_REMOVEFILE,
-                             "No file to remove specified!");
-
-    /*
-     * Create the directories.
-     */
-    HRESULT rc = S_OK;
-    if (pCtx->fVerbose && cFiles)
-        RTPrintf("Removing %RU32 file(s) ...\n", cFiles);
-
-    DESTDIRMAPITER it = mapDirs.begin();
-    while (   (it != mapDirs.end())
-           && !g_fGuestCtrlCanceled)
-    {
-        if (pCtx->fVerbose)
-            RTPrintf("Removing file \"%s\" ...\n", it->first.c_str());
-
-        CHECK_ERROR_BREAK(pCtx->pGuestSession, FileRemove(Bstr(it->first).raw()));
-
-        it++;
-    }
-
-    return FAILED(rc) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS;
+    if (!cFilesDeleted && !fForce)
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RM, "No file to remove specified!");
+    return rcExit;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlRename(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleMv(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
-    static const RTGETOPTDEF s_aOptions[] = { 0 };
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        GCTLCMD_COMMON_OPTION_DEFS()
+    };
 
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 NULL /*s_aOptions*/, 0 /*RT_ELEMENTS(s_aOptions)*/, pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
     int vrc = VINF_SUCCESS;
 
     bool fDryrun = false;
     std::vector< Utf8Str > vecSources;
-    Utf8Str strDest;
-    com::SafeArray<PathRenameFlag_T> aRenameFlags;
+    const char *pszDst = NULL;
+    com::SafeArray<FsObjRenameFlag_T> aRenameFlags;
 
     try
     {
         /** @todo Make flags configurable. */
-        aRenameFlags.push_back(PathRenameFlag_NoReplace);
+        aRenameFlags.push_back(FsObjRenameFlag_NoReplace);
 
         while (   (ch = RTGetOpt(&GetState, &ValueUnion))
                && RT_SUCCESS(vrc))
@@ -2920,16 +3204,18 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlRename(PGCTLCMDCTX pCtx)
             /* For options that require an argument, ValueUnion has received the value. */
             switch (ch)
             {
+                GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
                 /** @todo Implement a --dryrun command. */
                 /** @todo Implement rename flags. */
 
                 case VINF_GETOPT_NOT_OPTION:
                     vecSources.push_back(Utf8Str(ValueUnion.psz));
-                    strDest = ValueUnion.psz;
+                    pszDst = ValueUnion.psz;
                     break;
 
                 default:
-                    return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RENAME, ch, &ValueUnion);
+                    return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MV, ch, &ValueUnion);
             }
         }
     }
@@ -2941,14 +3227,18 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlRename(PGCTLCMDCTX pCtx)
     if (RT_FAILURE(vrc))
         return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize, rc=%Rrc\n", vrc);
 
-    uint32_t cSources = vecSources.size();
+    size_t cSources = vecSources.size();
     if (!cSources)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RENAME,
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MV,
                              "No source(s) to move specified!");
     if (cSources < 2)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_RENAME,
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MV,
                              "No destination specified!");
 
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
     /* Delete last element, which now is the destination. */
     vecSources.pop_back();
     cSources = vecSources.size();
@@ -2957,74 +3247,72 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlRename(PGCTLCMDCTX pCtx)
 
     if (cSources > 1)
     {
-        ComPtr<IGuestFsObjInfo> pFsObjInfo;
-        rc = pCtx->pGuestSession->DirectoryQueryInfo(Bstr(strDest).raw(), pFsObjInfo.asOutParam());
-        if (FAILED(rc))
+        BOOL fExists = FALSE;
+        rc = pCtx->pGuestSession->DirectoryExists(Bstr(pszDst).raw(), FALSE /*followSymlinks*/, &fExists);
+        if (FAILED(rc) || !fExists)
             return RTMsgErrorExit(RTEXITCODE_FAILURE, "Destination must be a directory when specifying multiple sources\n");
     }
 
     /*
      * Rename (move) the entries.
      */
-    if (pCtx->fVerbose && cSources)
-        RTPrintf("Renaming %RU32 %s ...\n", cSources,
-                   cSources > 1
-                 ? "entries" : "entry");
+    if (pCtx->cVerbose > 1)
+        RTPrintf("Renaming %RU32 %s ...\n", cSources, cSources > 1 ? "entries" : "entry");
 
     std::vector< Utf8Str >::iterator it = vecSources.begin();
     while (   (it != vecSources.end())
            && !g_fGuestCtrlCanceled)
     {
-        bool fSourceIsDirectory = false;
         Utf8Str strCurSource = (*it);
-        Utf8Str strCurDest = strDest;
 
-        /** @todo Slooooow, but works for now. */
         ComPtr<IGuestFsObjInfo> pFsObjInfo;
-        rc = pCtx->pGuestSession->FileQueryInfo(Bstr(strCurSource).raw(), pFsObjInfo.asOutParam());
-        if (FAILED(rc))
-        {
-            rc = pCtx->pGuestSession->DirectoryQueryInfo(Bstr(strCurSource).raw(), pFsObjInfo.asOutParam());
-            fSourceIsDirectory = SUCCEEDED(rc);
-        }
+        FsObjType_T enmObjType;
+        rc = pCtx->pGuestSession->FsObjQueryInfo(Bstr(strCurSource).raw(), FALSE /*followSymlinks*/, pFsObjInfo.asOutParam());
+        if (SUCCEEDED(rc))
+            rc = pFsObjInfo->COMGETTER(Type)(&enmObjType);
         if (FAILED(rc))
         {
-            if (pCtx->fVerbose)
+            if (pCtx->cVerbose > 1)
                 RTPrintf("Warning: Cannot stat for element \"%s\": No such element\n",
                          strCurSource.c_str());
             it++;
             continue; /* Skip. */
         }
 
-        if (pCtx->fVerbose)
+        if (pCtx->cVerbose > 1)
             RTPrintf("Renaming %s \"%s\" to \"%s\" ...\n",
-                     fSourceIsDirectory ? "directory" : "file",
-                     strCurSource.c_str(), strCurDest.c_str());
+                     enmObjType == FsObjType_Directory ? "directory" : "file",
+                     strCurSource.c_str(), pszDst);
 
         if (!fDryrun)
         {
-            if (fSourceIsDirectory)
+            if (enmObjType == FsObjType_Directory)
             {
-                CHECK_ERROR_BREAK(pCtx->pGuestSession, DirectoryRename(Bstr(strCurSource).raw(),
-                                                                       Bstr(strCurDest).raw(),
-                                                                       ComSafeArrayAsInParam(aRenameFlags)));
+                CHECK_ERROR_BREAK(pCtx->pGuestSession, FsObjRename(Bstr(strCurSource).raw(),
+                                                                   Bstr(pszDst).raw(),
+                                                                   ComSafeArrayAsInParam(aRenameFlags)));
 
                 /* Break here, since it makes no sense to rename mroe than one source to
                  * the same directory. */
+/** @todo r=bird: You are being kind of windowsy (or just DOSish) about the 'sense' part here,
+ * while being totaly buggy about the behavior. 'VBoxGuest guestcontrol ren dir1 dir2 dstdir' will
+ * stop after 'dir1' and SILENTLY ignore dir2.  If you tried this on Windows, you'd see an error
+ * being displayed.  If you 'man mv' on a nearby unixy system, you'd see that they've made perfect
+ * sense out of any situation with more than one source. */
                 it = vecSources.end();
                 break;
             }
             else
-                CHECK_ERROR_BREAK(pCtx->pGuestSession, FileRename(Bstr(strCurSource).raw(),
-                                                                  Bstr(strCurDest).raw(),
-                                                                  ComSafeArrayAsInParam(aRenameFlags)));
+                CHECK_ERROR_BREAK(pCtx->pGuestSession, FsObjRename(Bstr(strCurSource).raw(),
+                                                                   Bstr(pszDst).raw(),
+                                                                   ComSafeArrayAsInParam(aRenameFlags)));
         }
 
         it++;
     }
 
     if (   (it != vecSources.end())
-        && pCtx->fVerbose)
+        && pCtx->cVerbose > 1)
     {
         RTPrintf("Warning: Not all sources were renamed\n");
     }
@@ -3032,12 +3320,13 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlRename(PGCTLCMDCTX pCtx)
     return FAILED(rc) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlCreateTemp(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleMkTemp(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
     static const RTGETOPTDEF s_aOptions[] =
     {
+        GCTLCMD_COMMON_OPTION_DEFS()
         { "--mode",                'm',                             RTGETOPT_REQ_UINT32  },
         { "--directory",           'D',                             RTGETOPT_REQ_NOTHING },
         { "--secure",              's',                             RTGETOPT_REQ_NOTHING },
@@ -3047,8 +3336,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlCreateTemp(PGCTLCMDCTX pCtx)
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 s_aOptions, RT_ELEMENTS(s_aOptions), pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
     Utf8Str strTemplate;
     uint32_t fMode = 0; /* Default mode. */
@@ -3058,11 +3346,13 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlCreateTemp(PGCTLCMDCTX pCtx)
 
     DESTDIRMAP mapDirs;
 
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case 'm': /* Mode */
                 fMode = ValueUnion.u32;
                 break;
@@ -3084,28 +3374,32 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlCreateTemp(PGCTLCMDCTX pCtx)
                 if (strTemplate.isEmpty())
                     strTemplate = ValueUnion.psz;
                 else
-                    return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CREATETEMP,
+                    return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MKTEMP,
                                          "More than one template specified!\n");
                 break;
             }
 
             default:
-                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CREATETEMP, ch, &ValueUnion);
+                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MKTEMP, ch, &ValueUnion);
         }
     }
 
     if (strTemplate.isEmpty())
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CREATETEMP,
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MKTEMP,
                              "No template specified!");
 
     if (!fDirectory)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CREATETEMP,
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_MKTEMP,
                              "Creating temporary files is currently not supported!");
 
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
     /*
      * Create the directories.
      */
-    if (pCtx->fVerbose)
+    if (pCtx->cVerbose > 1)
     {
         if (fDirectory && !strTempDir.isEmpty())
             RTPrintf("Creating temporary directory from template '%s' in directory '%s' ...\n",
@@ -3132,17 +3426,24 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlCreateTemp(PGCTLCMDCTX pCtx)
         if (SUCCEEDED(rc))
             RTPrintf("Directory name: %ls\n", directory.raw());
     }
-    // else - temporary file not yet implemented
+    else
+    {
+        // else - temporary file not yet implemented
+        /** @todo implement temporary file creation (we fend it off above, no
+         *        worries). */
+        rc = E_FAIL;
+    }
 
     return FAILED(rc) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlStat(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleStat(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
     static const RTGETOPTDEF s_aOptions[] =
     {
+        GCTLCMD_COMMON_OPTION_DEFS()
         { "--dereference",         'L',                             RTGETOPT_REQ_NOTHING },
         { "--file-system",         'f',                             RTGETOPT_REQ_NOTHING },
         { "--format",              'c',                             RTGETOPT_REQ_STRING },
@@ -3152,16 +3453,17 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlStat(PGCTLCMDCTX pCtx)
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 s_aOptions, RT_ELEMENTS(s_aOptions), pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
     DESTDIRMAP mapObjs;
 
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case 'L': /* Dereference */
             case 'f': /* File-system */
             case 'c': /* Format */
@@ -3178,33 +3480,33 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlStat(PGCTLCMDCTX pCtx)
         }
     }
 
-    uint32_t cObjs = mapObjs.size();
+    size_t cObjs = mapObjs.size();
     if (!cObjs)
         return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_STAT,
                              "No element(s) to check specified!");
 
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
     HRESULT rc;
 
     /*
      * Doing the checks.
      */
-    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
     DESTDIRMAPITER it = mapObjs.begin();
     while (it != mapObjs.end())
     {
-        if (pCtx->fVerbose)
+        if (pCtx->cVerbose > 1)
             RTPrintf("Checking for element \"%s\" ...\n", it->first.c_str());
 
         ComPtr<IGuestFsObjInfo> pFsObjInfo;
-        rc = pCtx->pGuestSession->FileQueryInfo(Bstr(it->first).raw(), pFsObjInfo.asOutParam());
-        if (FAILED(rc))
-            rc = pCtx->pGuestSession->DirectoryQueryInfo(Bstr(it->first).raw(), pFsObjInfo.asOutParam());
-
+        rc = pCtx->pGuestSession->FsObjQueryInfo(Bstr(it->first).raw(), FALSE /*followSymlinks*/, pFsObjInfo.asOutParam());
         if (FAILED(rc))
         {
             /* If there's at least one element which does not exist on the guest,
              * drop out with exitcode 1. */
-            if (pCtx->fVerbose)
+            if (pCtx->cVerbose > 1)
                 RTPrintf("Cannot stat for element \"%s\": No such element\n",
                          it->first.c_str());
             rcExit = RTEXITCODE_FAILURE;
@@ -3212,7 +3514,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlStat(PGCTLCMDCTX pCtx)
         else
         {
             FsObjType_T objType;
-            pFsObjInfo->COMGETTER(Type)(&objType);
+            pFsObjInfo->COMGETTER(Type)(&objType); /** @todo What about error checking? */
             switch (objType)
             {
                 case FsObjType_File:
@@ -3241,7 +3543,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlStat(PGCTLCMDCTX pCtx)
     return rcExit;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlUpdateAdditions(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleUpdateAdditions(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
@@ -3255,6 +3557,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlUpdateAdditions(PGCTLCMDCTX pCtx)
 
     static const RTGETOPTDEF s_aOptions[] =
     {
+        GCTLCMD_COMMON_OPTION_DEFS()
         { "--source",              's',         RTGETOPT_REQ_STRING  },
         { "--wait-start",          'w',         RTGETOPT_REQ_NOTHING }
     };
@@ -3262,7 +3565,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlUpdateAdditions(PGCTLCMDCTX pCtx)
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv, s_aOptions, RT_ELEMENTS(s_aOptions), pCtx->iFirstArgc, 0);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
     int vrc = VINF_SUCCESS;
     while (   (ch = RTGetOpt(&GetState, &ValueUnion))
@@ -3270,6 +3573,8 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlUpdateAdditions(PGCTLCMDCTX pCtx)
     {
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case 's':
                 strSource = ValueUnion.psz;
                 break;
@@ -3286,18 +3591,18 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlUpdateAdditions(PGCTLCMDCTX pCtx)
                 break;
 
             default:
-                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_UPDATEADDS, ch, &ValueUnion);
+                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_UPDATEGA, ch, &ValueUnion);
         }
     }
 
-    if (pCtx->fVerbose)
+    if (pCtx->cVerbose > 1)
         RTPrintf("Updating Guest Additions ...\n");
 
     HRESULT rc = S_OK;
     while (strSource.isEmpty())
     {
         ComPtr<ISystemProperties> pProperties;
-        CHECK_ERROR_BREAK(pCtx->handlerArg.virtualBox, COMGETTER(SystemProperties)(pProperties.asOutParam()));
+        CHECK_ERROR_BREAK(pCtx->pArg->virtualBox, COMGETTER(SystemProperties)(pProperties.asOutParam()));
         Bstr strISO;
         CHECK_ERROR_BREAK(pProperties, COMGETTER(DefaultAdditionsISO)(strISO.asOutParam()));
         strSource = strISO;
@@ -3318,14 +3623,20 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlUpdateAdditions(PGCTLCMDCTX pCtx)
 
     if (RT_SUCCESS(vrc))
     {
-        if (pCtx->fVerbose)
+        if (pCtx->cVerbose > 1)
             RTPrintf("Using source: %s\n", strSource.c_str());
 
+
+        RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+        if (rcExit != RTEXITCODE_SUCCESS)
+            return rcExit;
+
+
         com::SafeArray<AdditionsUpdateFlag_T> aUpdateFlags;
         if (fWaitStartOnly)
         {
             aUpdateFlags.push_back(AdditionsUpdateFlag_WaitForUpdateStartOnly);
-            if (pCtx->fVerbose)
+            if (pCtx->cVerbose > 1)
                 RTPrintf("Preparing and waiting for Guest Additions installer to start ...\n");
         }
 
@@ -3336,19 +3647,19 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlUpdateAdditions(PGCTLCMDCTX pCtx)
                                                 ComSafeArrayAsInParam(aUpdateFlags),
                                                 pProgress.asOutParam()));
         if (FAILED(rc))
-            vrc = ctrlPrintError(pCtx->pGuest, COM_IIDOF(IGuest));
+            vrc = gctlPrintError(pCtx->pGuest, COM_IIDOF(IGuest));
         else
         {
-            if (pCtx->fVerbose)
+            if (pCtx->cVerbose > 1)
                 rc = showProgress(pProgress);
             else
                 rc = pProgress->WaitForCompletion(-1 /* No timeout */);
 
             if (SUCCEEDED(rc))
                 CHECK_PROGRESS_ERROR(pProgress, ("Guest additions update failed"));
-            vrc = ctrlPrintProgressError(pProgress);
+            vrc = gctlPrintProgressError(pProgress);
             if (   RT_SUCCESS(vrc)
-                && pCtx->fVerbose)
+                && pCtx->cVerbose > 1)
             {
                 RTPrintf("Guest Additions update successful\n");
             }
@@ -3358,59 +3669,88 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlUpdateAdditions(PGCTLCMDCTX pCtx)
     return RT_SUCCESS(vrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlList(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleList(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
-    if (pCtx->iArgc < 1)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_LIST,
-                             "Must specify a listing category");
-
-    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        GCTLCMD_COMMON_OPTION_DEFS()
+    };
 
-    /** Use RTGetOpt here when handling command line args gets more complex. */
+    int ch;
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
-    bool fListAll = false;
-    bool fListSessions = false;
+    bool fSeenListArg   = false;
+    bool fListAll       = false;
+    bool fListSessions  = false;
     bool fListProcesses = false;
-    bool fListFiles = false;
-    if (   !RTStrICmp(pCtx->ppaArgv[0], "sessions")
-        || !RTStrICmp(pCtx->ppaArgv[0], "sess"))
-        fListSessions = true;
-    else if (   !RTStrICmp(pCtx->ppaArgv[0], "processes")
-             || !RTStrICmp(pCtx->ppaArgv[0], "procs"))
-        fListSessions = fListProcesses = true; /* Showing processes implies showing sessions. */
-    else if (   !RTStrICmp(pCtx->ppaArgv[0], "files"))
-        fListSessions = fListFiles = true;     /* Showing files implies showing sessions. */
-    else if (!RTStrICmp(pCtx->ppaArgv[0], "all"))
-        fListAll = true;
-
-    /** @todo Handle "--verbose" using RTGetOpt. */
-    /** @todo Do we need a machine-readable output here as well? */
+    bool fListFiles     = false;
 
-    if (   fListAll
-        || fListSessions)
+    int vrc = VINF_SUCCESS;
+    while (   (ch = RTGetOpt(&GetState, &ValueUnion))
+           && RT_SUCCESS(vrc))
     {
-        HRESULT rc;
-        do
+        switch (ch)
         {
-            size_t cTotalProcs = 0;
-            size_t cTotalFiles = 0;
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
+            case VINF_GETOPT_NOT_OPTION:
+                if (   !RTStrICmp(ValueUnion.psz, "sessions")
+                    || !RTStrICmp(ValueUnion.psz, "sess"))
+                    fListSessions = true;
+                else if (   !RTStrICmp(ValueUnion.psz, "processes")
+                         || !RTStrICmp(ValueUnion.psz, "procs"))
+                    fListSessions = fListProcesses = true; /* Showing processes implies showing sessions. */
+                else if (!RTStrICmp(ValueUnion.psz, "files"))
+                    fListSessions = fListFiles = true;     /* Showing files implies showing sessions. */
+                else if (!RTStrICmp(ValueUnion.psz, "all"))
+                    fListAll = true;
+                else
+                    return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_LIST,
+                                         "Unknown list: '%s'", ValueUnion.psz);
+                fSeenListArg = true;
+                break;
+
+            default:
+                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_UPDATEGA, ch, &ValueUnion);
+        }
+    }
 
-            SafeIfaceArray <IGuestSession> collSessions;
-            CHECK_ERROR_BREAK(pCtx->pGuest, COMGETTER(Sessions)(ComSafeArrayAsOutParam(collSessions)));
-            size_t cSessions = collSessions.size();
+    if (fSeenListArg)
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_LIST, "Missing list name");
+    Assert(fListAll || fListSessions);
+
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
 
-            if (cSessions)
-            {
-                RTPrintf("Active guest sessions:\n");
 
-                /** @todo Make this output a bit prettier. No time now. */
+    /** @todo Do we need a machine-readable output here as well? */
+
+    HRESULT rc;
+    size_t cTotalProcs = 0;
+    size_t cTotalFiles = 0;
+
+    SafeIfaceArray <IGuestSession> collSessions;
+    CHECK_ERROR(pCtx->pGuest, COMGETTER(Sessions)(ComSafeArrayAsOutParam(collSessions)));
+    if (SUCCEEDED(rc))
+    {
+        size_t const cSessions = collSessions.size();
+        if (cSessions)
+        {
+            RTPrintf("Active guest sessions:\n");
+
+            /** @todo Make this output a bit prettier. No time now. */
 
-                for (size_t i = 0; i < cSessions; i++)
+            for (size_t i = 0; i < cSessions; i++)
+            {
+                ComPtr<IGuestSession> pCurSession = collSessions[i];
+                if (!pCurSession.isNull())
                 {
-                    ComPtr<IGuestSession> pCurSession = collSessions[i];
-                    if (!pCurSession.isNull())
+                    do
                     {
                         ULONG uID;
                         CHECK_ERROR_BREAK(pCurSession, COMGETTER(Id)(&uID));
@@ -3421,17 +3761,20 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlList(PGCTLCMDCTX pCtx)
                         GuestSessionStatus_T sessionStatus;
                         CHECK_ERROR_BREAK(pCurSession, COMGETTER(Status)(&sessionStatus));
                         RTPrintf("\n\tSession #%-3zu ID=%-3RU32 User=%-16ls Status=[%s] Name=%ls",
-                                 i, uID, strUser.raw(), ctrlSessionStatusToText(sessionStatus), strName.raw());
+                                 i, uID, strUser.raw(), gctlGuestSessionStatusToText(sessionStatus), strName.raw());
+                    } while (0);
 
-                        if (   fListAll
-                            || fListProcesses)
+                    if (   fListAll
+                        || fListProcesses)
+                    {
+                        SafeIfaceArray <IGuestProcess> collProcesses;
+                        CHECK_ERROR_BREAK(pCurSession, COMGETTER(Processes)(ComSafeArrayAsOutParam(collProcesses)));
+                        for (size_t a = 0; a < collProcesses.size(); a++)
                         {
-                            SafeIfaceArray <IGuestProcess> collProcesses;
-                            CHECK_ERROR_BREAK(pCurSession, COMGETTER(Processes)(ComSafeArrayAsOutParam(collProcesses)));
-                            for (size_t a = 0; a < collProcesses.size(); a++)
+                            ComPtr<IGuestProcess> pCurProcess = collProcesses[a];
+                            if (!pCurProcess.isNull())
                             {
-                                ComPtr<IGuestProcess> pCurProcess = collProcesses[a];
-                                if (!pCurProcess.isNull())
+                                do
                                 {
                                     ULONG uPID;
                                     CHECK_ERROR_BREAK(pCurProcess, COMGETTER(PID)(&uPID));
@@ -3441,69 +3784,67 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlList(PGCTLCMDCTX pCtx)
                                     CHECK_ERROR_BREAK(pCurProcess, COMGETTER(Status)(&procStatus));
 
                                     RTPrintf("\n\t\tProcess #%-03zu PID=%-6RU32 Status=[%s] Command=%ls",
-                                             a, uPID, ctrlProcessStatusToText(procStatus), strExecPath.raw());
-                                }
+                                             a, uPID, gctlProcessStatusToText(procStatus), strExecPath.raw());
+                                } while (0);
                             }
-
-                            cTotalProcs += collProcesses.size();
                         }
 
-                        if (   fListAll
-                            || fListFiles)
+                        cTotalProcs += collProcesses.size();
+                    }
+
+                    if (   fListAll
+                        || fListFiles)
+                    {
+                        SafeIfaceArray <IGuestFile> collFiles;
+                        CHECK_ERROR_BREAK(pCurSession, COMGETTER(Files)(ComSafeArrayAsOutParam(collFiles)));
+                        for (size_t a = 0; a < collFiles.size(); a++)
                         {
-                            SafeIfaceArray <IGuestFile> collFiles;
-                            CHECK_ERROR_BREAK(pCurSession, COMGETTER(Files)(ComSafeArrayAsOutParam(collFiles)));
-                            for (size_t a = 0; a < collFiles.size(); a++)
+                            ComPtr<IGuestFile> pCurFile = collFiles[a];
+                            if (!pCurFile.isNull())
                             {
-                                ComPtr<IGuestFile> pCurFile = collFiles[a];
-                                if (!pCurFile.isNull())
+                                do
                                 {
-                                    CHECK_ERROR_BREAK(pCurFile, COMGETTER(Id)(&uID));
+                                    ULONG idFile;
+                                    CHECK_ERROR_BREAK(pCurFile, COMGETTER(Id)(&idFile));
+                                    Bstr strName;
                                     CHECK_ERROR_BREAK(pCurFile, COMGETTER(FileName)(strName.asOutParam()));
                                     FileStatus_T fileStatus;
                                     CHECK_ERROR_BREAK(pCurFile, COMGETTER(Status)(&fileStatus));
 
                                     RTPrintf("\n\t\tFile #%-03zu ID=%-6RU32 Status=[%s] Name=%ls",
-                                             a, uID, ctrlFileStatusToText(fileStatus), strName.raw());
-                                }
+                                             a, idFile, gctlFileStatusToText(fileStatus), strName.raw());
+                                } while (0);
                             }
-
-                            cTotalFiles += collFiles.size();
                         }
+
+                        cTotalFiles += collFiles.size();
                     }
                 }
-
-                RTPrintf("\n\nTotal guest sessions: %zu\n", collSessions.size());
-                if (fListAll || fListProcesses)
-                    RTPrintf("Total guest processes: %zu\n", cTotalProcs);
-                if (fListAll || fListFiles)
-                    RTPrintf("Total guest files: %zu\n", cTotalFiles);
             }
-            else
-                RTPrintf("No active guest sessions found\n");
-
-        } while (0);
 
-        if (FAILED(rc))
-            rcExit = RTEXITCODE_FAILURE;
+            RTPrintf("\n\nTotal guest sessions: %zu\n", collSessions.size());
+            if (fListAll || fListProcesses)
+                RTPrintf("Total guest processes: %zu\n", cTotalProcs);
+            if (fListAll || fListFiles)
+                RTPrintf("Total guest files: %zu\n", cTotalFiles);
+        }
+        else
+            RTPrintf("No active guest sessions found\n");
     }
-    else
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_LIST,
-                             "Invalid listing category '%s", pCtx->ppaArgv[0]);
+
+    if (FAILED(rc))
+        rcExit = RTEXITCODE_FAILURE;
 
     return rcExit;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlProcessClose(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleCloseProcess(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
-    if (pCtx->iArgc < 1)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_PROCESS,
-                             "Must specify at least a PID to close");
-
     static const RTGETOPTDEF s_aOptions[] =
     {
+        GCTLCMD_COMMON_OPTION_DEFS()
         { "--session-id",          'i',                             RTGETOPT_REQ_UINT32  },
         { "--session-name",        'n',                             RTGETOPT_REQ_STRING  }
     };
@@ -3511,21 +3852,19 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessClose(PGCTLCMDCTX pCtx)
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 s_aOptions, RT_ELEMENTS(s_aOptions), pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
     std::vector < uint32_t > vecPID;
     ULONG ulSessionID = UINT32_MAX;
     Utf8Str strSessionName;
 
-    int vrc = VINF_SUCCESS;
-
-    while (   (ch = RTGetOpt(&GetState, &ValueUnion))
-           && RT_SUCCESS(vrc))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case 'n': /* Session name (or pattern) */
                 strSessionName = ValueUnion.psz;
                 break;
@@ -3535,47 +3874,56 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessClose(PGCTLCMDCTX pCtx)
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
-                if (pCtx->iArgc == GetState.iNext)
+            {
+                /* Treat every else specified as a PID to kill. */
+                uint32_t uPid;
+                int rc = RTStrToUInt32Ex(ValueUnion.psz, NULL, 0, &uPid);
+                if (   RT_SUCCESS(rc)
+                    && rc != VWRN_TRAILING_CHARS
+                    && rc != VWRN_NUMBER_TOO_BIG
+                    && rc != VWRN_NEGATIVE_UNSIGNED)
                 {
-                    /* Treat every else specified as a PID to kill. */
-                    try
+                    if (uPid != 0)
                     {
-                        uint32_t uPID = RTStrToUInt32(ValueUnion.psz);
-                        if (uPID) /** @todo Is this what we want? If specifying PID 0
-                                            this is not going to work on most systems anyway. */
-                            vecPID.push_back(uPID);
-                        else
-                            vrc = VERR_INVALID_PARAMETER;
-                    }
-                    catch(std::bad_alloc &)
-                    {
-                        vrc = VERR_NO_MEMORY;
+                        try
+                        {
+                            vecPID.push_back(uPid);
+                        }
+                        catch (std::bad_alloc &)
+                        {
+                            return RTMsgErrorExit(RTEXITCODE_FAILURE, "Out of memory");
+                        }
                     }
+                    else
+                        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSEPROCESS, "Invalid PID value: 0");
                 }
+                else
+                    return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSEPROCESS,
+                                         "Error parsing PID value: %Rrc", rc);
                 break;
+            }
 
             default:
-                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_PROCESS, ch, &ValueUnion);
+                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSEPROCESS, ch, &ValueUnion);
         }
     }
 
     if (vecPID.empty())
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_PROCESS,
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSEPROCESS,
                              "At least one PID must be specified to kill!");
 
     if (   strSessionName.isEmpty()
         && ulSessionID == UINT32_MAX)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_PROCESS,
-                             "No session ID specified!");
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSEPROCESS, "No session ID specified!");
 
-    if (   !strSessionName.isEmpty()
+    if (   strSessionName.isNotEmpty()
         && ulSessionID != UINT32_MAX)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_PROCESS,
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSEPROCESS,
                              "Either session ID or name (pattern) must be specified");
 
-    if (RT_FAILURE(vrc))
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_PROCESS,
-                             "Invalid parameters specified");
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
 
     HRESULT rc = S_OK;
 
@@ -3638,7 +3986,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessClose(PGCTLCMDCTX pCtx)
 
                     if (fProcFound)
                     {
-                        if (pCtx->fVerbose)
+                        if (pCtx->cVerbose > 1)
                             RTPrintf("Terminating process (PID %RU32) (session ID %RU32) ...\n",
                                      uPID, uID);
                         CHECK_ERROR_BREAK(pProcess, Terminate());
@@ -3673,38 +4021,18 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlProcessClose(PGCTLCMDCTX pCtx)
     return SUCCEEDED(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlProcess(PGCTLCMDCTX pCtx)
-{
-    AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
-
-    if (pCtx->iArgc < 1)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_PROCESS,
-                             "Must specify an action");
-
-    /** Use RTGetOpt here when handling command line args gets more complex. */
-
-    if (   !RTStrICmp(pCtx->ppaArgv[0], "close")
-        || !RTStrICmp(pCtx->ppaArgv[0], "kill")
-        || !RTStrICmp(pCtx->ppaArgv[0], "terminate"))
-    {
-        pCtx->iFirstArgc++; /* Skip process action. */
-        return handleCtrlProcessClose(pCtx);
-    }
-
-    return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_PROCESS,
-                         "Invalid process action '%s'", pCtx->ppaArgv[0]);
-}
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlSessionClose(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleCloseSession(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
-    if (pCtx->iArgc < 1)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_SESSION,
-                             "Must specify at least a session to close");
-
+    enum GETOPTDEF_SESSIONCLOSE
+    {
+        GETOPTDEF_SESSIONCLOSE_ALL = 2000
+    };
     static const RTGETOPTDEF s_aOptions[] =
     {
+        GCTLCMD_COMMON_OPTION_DEFS()
         { "--all",                 GETOPTDEF_SESSIONCLOSE_ALL,      RTGETOPT_REQ_NOTHING  },
         { "--session-id",          'i',                             RTGETOPT_REQ_UINT32  },
         { "--session-name",        'n',                             RTGETOPT_REQ_STRING  }
@@ -3713,17 +4041,18 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlSessionClose(PGCTLCMDCTX pCtx)
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 s_aOptions, RT_ELEMENTS(s_aOptions), pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
     ULONG ulSessionID = UINT32_MAX;
     Utf8Str strSessionName;
 
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
+
             case 'n': /* Session name pattern */
                 strSessionName = ValueUnion.psz;
                 break;
@@ -3737,24 +4066,27 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlSessionClose(PGCTLCMDCTX pCtx)
                 break;
 
             case VINF_GETOPT_NOT_OPTION:
-                /** @todo Supply a CSV list of IDs or patterns to close? */
-                break;
-
+                /** @todo Supply a CSV list of IDs or patterns to close?
+                 *  break; */
             default:
-                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_SESSION, ch, &ValueUnion);
+                return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSESESSION, ch, &ValueUnion);
         }
     }
 
     if (   strSessionName.isEmpty()
         && ulSessionID == UINT32_MAX)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_SESSION,
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSESESSION,
                              "No session ID specified!");
 
     if (   !strSessionName.isEmpty()
         && ulSessionID != UINT32_MAX)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_SESSION,
+        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_CLOSESESSION,
                              "Either session ID or name (pattern) must be specified");
 
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
     HRESULT rc = S_OK;
 
     do
@@ -3792,11 +4124,11 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlSessionClose(PGCTLCMDCTX pCtx)
                 cSessionsHandled++;
 
                 Assert(!pSession.isNull());
-                if (pCtx->fVerbose)
+                if (pCtx->cVerbose > 1)
                     RTPrintf("Closing guest session ID=#%RU32 \"%s\" ...\n",
                              uID, strNameUtf8.c_str());
                 CHECK_ERROR_BREAK(pSession, Close());
-                if (pCtx->fVerbose)
+                if (pCtx->cVerbose > 1)
                     RTPrintf("Guest session successfully closed\n");
 
                 pSession.setNull();
@@ -3814,51 +4146,32 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlSessionClose(PGCTLCMDCTX pCtx)
     return SUCCEEDED(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
 }
 
-static DECLCALLBACK(RTEXITCODE) handleCtrlSession(PGCTLCMDCTX pCtx)
-{
-    AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
-
-    if (pCtx->iArgc < 1)
-        return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_SESSION,
-                             "Must specify an action");
-
-    /** Use RTGetOpt here when handling command line args gets more complex. */
 
-    if (   !RTStrICmp(pCtx->ppaArgv[0], "close")
-        || !RTStrICmp(pCtx->ppaArgv[0], "kill")
-        || !RTStrICmp(pCtx->ppaArgv[0], "terminate"))
-    {
-        pCtx->iFirstArgc++; /* Skip session action. */
-        return handleCtrlSessionClose(pCtx);
-    }
-
-    return errorSyntaxEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_SESSION,
-                         "Invalid session action '%s'", pCtx->ppaArgv[0]);
-}
-
-static DECLCALLBACK(RTEXITCODE) handleCtrlWatch(PGCTLCMDCTX pCtx)
+static DECLCALLBACK(RTEXITCODE) gctlHandleWatch(PGCTLCMDCTX pCtx, int argc, char **argv)
 {
     AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
 
     /*
      * Parse arguments.
      */
-    static const RTGETOPTDEF s_aOptions[] = { 0 };
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        GCTLCMD_COMMON_OPTION_DEFS()
+    };
 
     int ch;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
-    RTGetOptInit(&GetState, pCtx->iArgc, pCtx->ppaArgv,
-                 NULL /*s_aOptions*/, 0 /*RT_ELEMENTS(s_aOptions)*/, pCtx->iFirstArgc, RTGETOPTINIT_FLAGS_OPTS_FIRST);
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
 
-    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     {
         /* For options that require an argument, ValueUnion has received the value. */
         switch (ch)
         {
-            case VINF_GETOPT_NOT_OPTION:
-                break;
+            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
 
+            case VINF_GETOPT_NOT_OPTION:
             default:
                 return errorGetOptEx(USAGE_GUESTCONTROL, USAGE_GSTCTRL_WATCH, ch, &ValueUnion);
         }
@@ -3867,6 +4180,10 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlWatch(PGCTLCMDCTX pCtx)
     /** @todo Specify categories to watch for. */
     /** @todo Specify a --timeout for waiting only for a certain amount of time? */
 
+    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
     HRESULT rc;
 
     try
@@ -3891,7 +4208,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlWatch(PGCTLCMDCTX pCtx)
 
         } while (0);
 
-        if (pCtx->fVerbose)
+        if (pCtx->cVerbose > 1)
             RTPrintf("Waiting for events ...\n");
 
         while (!g_fGuestCtrlCanceled)
@@ -3900,7 +4217,7 @@ static DECLCALLBACK(RTEXITCODE) handleCtrlWatch(PGCTLCMDCTX pCtx)
             RTThreadSleep(10);
         }
 
-        if (pCtx->fVerbose)
+        if (pCtx->cVerbose > 1)
             RTPrintf("Signal caught, exiting ...\n");
 
         if (!pGuestListener.isNull())
@@ -3936,134 +4253,115 @@ int handleGuestControl(HandlerArg *pArg)
         return RTEXITCODE_FAILURE;
 #endif
 
-    /* pArg->argv[0] contains the VM name. */
-    /* pArg->argv[1] contains the guest control command. */
-    if (pArg->argc < 2)
-        return errorSyntax(USAGE_GUESTCONTROL, "No sub command specified!");
-
-    uint32_t uCmdCtxFlags = 0;
-    uint32_t uUsage;
-    GCTLCMD gctlCmd;
-    if (   !RTStrICmp(pArg->argv[1], "exec")
-        || !RTStrICmp(pArg->argv[1], "execute"))
-    {
-        gctlCmd.pfnHandler = handleCtrlProcessExec;
-        uUsage = USAGE_GSTCTRL_EXEC;
-    }
-    else if (!RTStrICmp(pArg->argv[1], "copyfrom"))
-    {
-        gctlCmd.pfnHandler = handleCtrlCopyFrom;
-        uUsage = USAGE_GSTCTRL_COPYFROM;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "copyto")
-             || !RTStrICmp(pArg->argv[1], "cp"))
-    {
-        gctlCmd.pfnHandler = handleCtrlCopyTo;
-        uUsage = USAGE_GSTCTRL_COPYTO;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "createdirectory")
-             || !RTStrICmp(pArg->argv[1], "createdir")
-             || !RTStrICmp(pArg->argv[1], "mkdir")
-             || !RTStrICmp(pArg->argv[1], "md"))
-    {
-        gctlCmd.pfnHandler = handleCtrlCreateDirectory;
-        uUsage = USAGE_GSTCTRL_CREATEDIR;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "removedirectory")
-             || !RTStrICmp(pArg->argv[1], "removedir")
-             || !RTStrICmp(pArg->argv[1], "rmdir"))
-    {
-        gctlCmd.pfnHandler = handleCtrlRemoveDirectory;
-        uUsage = USAGE_GSTCTRL_REMOVEDIR;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "rm")
-             || !RTStrICmp(pArg->argv[1], "removefile"))
-    {
-        gctlCmd.pfnHandler = handleCtrlRemoveFile;
-        uUsage = USAGE_GSTCTRL_REMOVEFILE;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "ren")
-             || !RTStrICmp(pArg->argv[1], "rename")
-             || !RTStrICmp(pArg->argv[1], "mv"))
-    {
-        gctlCmd.pfnHandler = handleCtrlRename;
-        uUsage = USAGE_GSTCTRL_RENAME;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "createtemporary")
-             || !RTStrICmp(pArg->argv[1], "createtemp")
-             || !RTStrICmp(pArg->argv[1], "mktemp"))
-    {
-        gctlCmd.pfnHandler = handleCtrlCreateTemp;
-        uUsage = USAGE_GSTCTRL_CREATETEMP;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "kill")    /* Linux. */
-             || !RTStrICmp(pArg->argv[1], "pkill")   /* Solaris / *BSD. */
-             || !RTStrICmp(pArg->argv[1], "pskill")) /* SysInternals version. */
-    {
-        /** @todo What about "taskkill" on Windows? */
-        uCmdCtxFlags = CTLCMDCTX_FLAGS_SESSION_ANONYMOUS
-                     | CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER;
-        gctlCmd.pfnHandler = handleCtrlProcessClose;
-        uUsage = USAGE_GSTCTRL_KILL;
-    }
-    /** @todo Implement "killall"? */
-    else if (   !RTStrICmp(pArg->argv[1], "stat"))
-    {
-        gctlCmd.pfnHandler = handleCtrlStat;
-        uUsage = USAGE_GSTCTRL_STAT;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "updateadditions")
-             || !RTStrICmp(pArg->argv[1], "updateadds"))
-    {
-        uCmdCtxFlags = CTLCMDCTX_FLAGS_SESSION_ANONYMOUS
-                     | CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER;
-        gctlCmd.pfnHandler = handleCtrlUpdateAdditions;
-        uUsage = USAGE_GSTCTRL_UPDATEADDS;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "list"))
-    {
-        uCmdCtxFlags = CTLCMDCTX_FLAGS_SESSION_ANONYMOUS
-                     | CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER;
-        gctlCmd.pfnHandler = handleCtrlList;
-        uUsage = USAGE_GSTCTRL_LIST;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "session"))
-    {
-        uCmdCtxFlags = CTLCMDCTX_FLAGS_SESSION_ANONYMOUS
-                     | CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER;
-        gctlCmd.pfnHandler = handleCtrlSession;
-        uUsage = USAGE_GSTCTRL_SESSION;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "process"))
-    {
-        uCmdCtxFlags = CTLCMDCTX_FLAGS_SESSION_ANONYMOUS
-                     | CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER;
-        gctlCmd.pfnHandler = handleCtrlProcess;
-        uUsage = USAGE_GSTCTRL_PROCESS;
-    }
-    else if (   !RTStrICmp(pArg->argv[1], "watch"))
+    /*
+     * Command definitions.
+     */
+    static const GCTLCMDDEF s_aCmdDefs[] =
     {
-        uCmdCtxFlags = CTLCMDCTX_FLAGS_SESSION_ANONYMOUS
-                     | CTLCMDCTX_FLAGS_NO_SIGNAL_HANDLER;
-        gctlCmd.pfnHandler = handleCtrlWatch;
-        uUsage = USAGE_GSTCTRL_WATCH;
-    }
-    else
-        return errorSyntax(USAGE_GUESTCONTROL, "Unknown sub command '%s' specified!", pArg->argv[1]);
-
-    GCTLCMDCTX cmdCtx;
-    RT_ZERO(cmdCtx);
+        { "run",                gctlHandleRun,              USAGE_GSTCTRL_RUN,       0, },
+        { "start",              gctlHandleStart,            USAGE_GSTCTRL_START,     0, },
+        { "copyfrom",           gctlHandleCopyFrom,         USAGE_GSTCTRL_COPYFROM,  0, },
+        { "copyto",             gctlHandleCopyTo,           USAGE_GSTCTRL_COPYTO,    0, },
+
+        { "mkdir",              handleCtrtMkDir,            USAGE_GSTCTRL_MKDIR,     0, },
+        { "md",                 handleCtrtMkDir,            USAGE_GSTCTRL_MKDIR,     0, },
+        { "createdirectory",    handleCtrtMkDir,            USAGE_GSTCTRL_MKDIR,     0, },
+        { "createdir",          handleCtrtMkDir,            USAGE_GSTCTRL_MKDIR,     0, },
+
+        { "rmdir",              gctlHandleRmDir,            USAGE_GSTCTRL_RMDIR,     0, },
+        { "removedir",          gctlHandleRmDir,            USAGE_GSTCTRL_RMDIR,     0, },
+        { "removedirectory",    gctlHandleRmDir,            USAGE_GSTCTRL_RMDIR,     0, },
+
+        { "rm",                 gctlHandleRm,               USAGE_GSTCTRL_RM,        0, },
+        { "removefile",         gctlHandleRm,               USAGE_GSTCTRL_RM,        0, },
+        { "erase",              gctlHandleRm,               USAGE_GSTCTRL_RM,        0, },
+        { "del",                gctlHandleRm,               USAGE_GSTCTRL_RM,        0, },
+        { "delete",             gctlHandleRm,               USAGE_GSTCTRL_RM,        0, },
+
+        { "mv",                 gctlHandleMv,               USAGE_GSTCTRL_MV,        0, },
+        { "move",               gctlHandleMv,               USAGE_GSTCTRL_MV,        0, },
+        { "ren",                gctlHandleMv,               USAGE_GSTCTRL_MV,        0, },
+        { "rename",             gctlHandleMv,               USAGE_GSTCTRL_MV,        0, },
+
+        { "mktemp",             gctlHandleMkTemp,           USAGE_GSTCTRL_MKTEMP,    0, },
+        { "createtemp",         gctlHandleMkTemp,           USAGE_GSTCTRL_MKTEMP,    0, },
+        { "createtemporary",    gctlHandleMkTemp,           USAGE_GSTCTRL_MKTEMP,    0, },
+
+        { "stat",               gctlHandleStat,             USAGE_GSTCTRL_STAT,      0, },
+
+        { "closeprocess",       gctlHandleCloseProcess,     USAGE_GSTCTRL_CLOSEPROCESS, GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER, },
+        { "closesession",       gctlHandleCloseSession,     USAGE_GSTCTRL_CLOSESESSION, GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER, },
+        { "list",               gctlHandleList,             USAGE_GSTCTRL_LIST,         GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER, },
+        { "watch",              gctlHandleWatch,            USAGE_GSTCTRL_WATCH,        GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER, },
+
+        {"updateguestadditions",gctlHandleUpdateAdditions,  USAGE_GSTCTRL_UPDATEGA,     GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER, },
+        { "updateadditions",    gctlHandleUpdateAdditions,  USAGE_GSTCTRL_UPDATEGA,     GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER, },
+        { "updatega",           gctlHandleUpdateAdditions,  USAGE_GSTCTRL_UPDATEGA,     GCTLCMDCTX_F_SESSION_ANONYMOUS | GCTLCMDCTX_F_NO_SIGNAL_HANDLER, },
+    };
 
-    RTEXITCODE rcExit = ctrlInitVM(pArg, &cmdCtx, uCmdCtxFlags, uUsage);
+    /*
+     * VBoxManage guestcontrol [common-options] <VM> [common-options] <sub-command> ...
+     *
+     * Parse common options and VM name until we find a sub-command.  Allowing
+     * the user  to put the user and password related options before the
+     * sub-command makes it easier to edit the command line when doing several
+     * operations with the same guest user account.  (Accidentally, it also
+     * makes the syntax diagram shorter and easier to read.)
+     */
+    GCTLCMDCTX CmdCtx;
+    RTEXITCODE rcExit = gctrCmdCtxInit(&CmdCtx, pArg);
     if (rcExit == RTEXITCODE_SUCCESS)
     {
-        /* Kick off the actual command handler. */
-        rcExit = gctlCmd.pfnHandler(&cmdCtx);
+        static const RTGETOPTDEF s_CommonOptions[] = { GCTLCMD_COMMON_OPTION_DEFS() };
 
-        ctrlUninitVM(&cmdCtx, cmdCtx.uFlags);
-        return rcExit;
-    }
+        int ch;
+        RTGETOPTUNION ValueUnion;
+        RTGETOPTSTATE GetState;
+        RTGetOptInit(&GetState, pArg->argc, pArg->argv, s_CommonOptions, RT_ELEMENTS(s_CommonOptions), 0, 0 /* No sorting! */);
+
+        while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
+        {
+            switch (ch)
+            {
+                GCTLCMD_COMMON_OPTION_CASES(&CmdCtx, ch, &ValueUnion);
+
+                case VINF_GETOPT_NOT_OPTION:
+                    /* First comes the VM name or UUID. */
+                    if (!CmdCtx.pszVmNameOrUuid)
+                        CmdCtx.pszVmNameOrUuid = ValueUnion.psz;
+                    /*
+                     * The sub-command is next.  Look it up and invoke it.
+                     * Note! Currently no warnings about user/password options (like we'll do later on)
+                     *       for GCTLCMDCTX_F_SESSION_ANONYMOUS commands. No reason to be too pedantic.
+                     */
+                    else
+                    {
+                        const char *pszCmd = ValueUnion.psz;
+                        uint32_t    iCmd;
+                        for (iCmd = 0; iCmd < RT_ELEMENTS(s_aCmdDefs); iCmd++)
+                            if (strcmp(s_aCmdDefs[iCmd].pszName, pszCmd) == 0)
+                            {
+                                CmdCtx.pCmdDef = &s_aCmdDefs[iCmd];
+
+                                rcExit = s_aCmdDefs[iCmd].pfnHandler(&CmdCtx, pArg->argc - GetState.iNext + 1,
+                                                                     &pArg->argv[GetState.iNext - 1]);
+
+                                gctlCtxTerm(&CmdCtx);
+                                return rcExit;
+                            }
+                        return errorSyntax(USAGE_GUESTCONTROL, "Unknown sub-command: '%s'", pszCmd);
+                    }
+                    break;
 
+                default:
+                    return errorGetOpt(USAGE_GUESTCONTROL, ch, &ValueUnion);
+            }
+        }
+        if (CmdCtx.pszVmNameOrUuid)
+            rcExit = errorSyntax(USAGE_GUESTCONTROL, "Missing sub-command");
+        else
+            rcExit = errorSyntax(USAGE_GUESTCONTROL, "Missing VM name and sub-command");
+    }
     return rcExit;
 }
 #endif /* !VBOX_ONLY_DOCS */
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.h b/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.h
index e172f38..e40722a 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.h
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -28,9 +28,9 @@
 
 #include <map>
 
-const char *ctrlFileStatusToText(FileStatus_T enmStatus);
-const char *ctrlProcessStatusToText(ProcessStatus_T enmStatus);
-const char *ctrlSessionStatusToText(GuestSessionStatus_T enmStatus);
+const char *gctlFileStatusToText(FileStatus_T enmStatus);
+const char *gctlProcessStatusToText(ProcessStatus_T enmStatus);
+const char *gctlGuestSessionStatusToText(GuestSessionStatus_T enmStatus);
 
 using namespace com;
 
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrlListener.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrlListener.cpp
index 04c5c57..91e0a70 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrlListener.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrlListener.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -33,6 +33,14 @@
 #include <map>
 #include <vector>
 
+
+
+/*
+ * GuestListenerBase
+ * GuestListenerBase
+ * GuestListenerBase
+ */
+
 GuestListenerBase::GuestListenerBase(void)
     : mfVerbose(false)
 {
@@ -49,6 +57,13 @@ HRESULT GuestListenerBase::init(bool fVerbose)
 }
 
 
+
+/*
+ * GuestFileEventListener
+ * GuestFileEventListener
+ * GuestFileEventListener
+ */
+
 GuestFileEventListener::GuestFileEventListener(void)
 {
 }
@@ -85,8 +100,7 @@ STDMETHODIMP GuestFileEventListener::HandleEvent(VBoxEventType_T aType, IEvent *
                 CHECK_ERROR_BREAK(pProcess, COMGETTER(Id)(&uID));
 
                 RTPrintf("File ID=%RU32 \"%s\" changed status to [%s]\n",
-                         uID, Utf8Str(strPath).c_str(),
-                         ctrlFileStatusToText(fileSts));
+                         uID, Utf8Str(strPath).c_str(), gctlFileStatusToText(fileSts));
 
             } while (0);
             break;
@@ -99,6 +113,13 @@ STDMETHODIMP GuestFileEventListener::HandleEvent(VBoxEventType_T aType, IEvent *
     return S_OK;
 }
 
+
+/*
+ * GuestProcessEventListener
+ * GuestProcessEventListener
+ * GuestProcessEventListener
+ */
+
 GuestProcessEventListener::GuestProcessEventListener(void)
 {
 }
@@ -135,8 +156,7 @@ STDMETHODIMP GuestProcessEventListener::HandleEvent(VBoxEventType_T aType, IEven
                 CHECK_ERROR_BREAK(pProcess, COMGETTER(PID)(&uPID));
 
                 RTPrintf("Process PID=%RU32 \"%s\" changed status to [%s]\n",
-                         uPID, Utf8Str(strPath).c_str(),
-                         ctrlProcessStatusToText(procSts));
+                         uPID, Utf8Str(strPath).c_str(), gctlProcessStatusToText(procSts));
 
             } while (0);
             break;
@@ -149,6 +169,13 @@ STDMETHODIMP GuestProcessEventListener::HandleEvent(VBoxEventType_T aType, IEven
     return S_OK;
 }
 
+
+/*
+ * GuestSessionEventListener
+ * GuestSessionEventListener
+ * GuestSessionEventListener
+ */
+
 GuestSessionEventListener::GuestSessionEventListener(void)
 {
 }
@@ -355,8 +382,7 @@ STDMETHODIMP GuestSessionEventListener::HandleEvent(VBoxEventType_T aType, IEven
                 CHECK_ERROR_BREAK(pSession, COMGETTER(Name)(strName.asOutParam()));
 
                 RTPrintf("Session ID=%RU32 \"%s\" changed status to [%s]\n",
-                         uID, Utf8Str(strName).c_str(),
-                         ctrlSessionStatusToText(sessSts));
+                         uID, Utf8Str(strName).c_str(), gctlGuestSessionStatusToText(sessSts));
 
             } while (0);
             break;
@@ -369,6 +395,13 @@ STDMETHODIMP GuestSessionEventListener::HandleEvent(VBoxEventType_T aType, IEven
     return S_OK;
 }
 
+
+/*
+ * GuestEventListener
+ * GuestEventListener
+ * GuestEventListener
+ */
+
 GuestEventListener::GuestEventListener(void)
 {
 }
@@ -480,5 +513,6 @@ STDMETHODIMP GuestEventListener::HandleEvent(VBoxEventType_T aType, IEvent *aEve
 
     return S_OK;
 }
+
 #endif /* !VBOX_ONLY_DOCS */
 
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
index b4f9c0c..7f9cae4 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -128,7 +128,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
 #endif
                      "                            hostinfo|hostcpuids|hddbackends|hdds|dvds|floppies|\n"
                      "                            usbhost|usbfilters|systemproperties|extpacks|\n"
-                     "                            groups|webcams\n"
+                     "                            groups|webcams|screenshotformats\n"
                      "\n", SEP);
 
     if (fCategory & USAGE_SHOWVMINFO)
@@ -179,6 +179,8 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            [--ioapic on|off]\n"
                      "                            [--hpet on|off]\n"
                      "                            [--triplefaultreset on|off]\n"
+                     "                            [--paravirtprovider none|default|legacy|minimal|\n"
+                     "                                                hyperv|kvm]\n"
                      "                            [--hwvirtex on|off]\n"
                      "                            [--nestedpaging on|off]\n"
                      "                            [--largepages on|off]\n"
@@ -186,7 +188,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            [--vtxux on|off]\n"
                      "                            [--pae on|off]\n"
                      "                            [--longmode on|off]\n"
-                     "                            [--synthcpu on|off]\n"
+                     "                            [--cpuid-portability-level <0..3>\n"
                      "                            [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]\n"
                      "                            [--cpuidremove <leaf>]\n"
                      "                            [--cpuidremoveall]\n"
@@ -270,6 +272,8 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            [--uartmode<1-N> disconnected|\n"
                      "                                             server <pipe>|\n"
                      "                                             client <pipe>|\n"
+                     "                                             tcpserver <port>|\n"
+                     "                                             tcpclient <hostname:port>|\n"
                      "                                             file <file>|\n"
                      "                                             <devicename>]\n"
 #if defined(RT_OS_LINUX) || defined(RT_OS_WINDOWS)
@@ -328,7 +332,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            [--audiocontroller ac97|hda|sb16]\n"
                      "                            [--clipboard disabled|hosttoguest|guesttohost|\n"
                      "                                         bidirectional]\n"
-                     "                            [--draganddrop disabled|hosttoguest\n");
+                     "                            [--draganddrop disabled|hosttoguest]\n");
         RTStrmPrintf(pStrm,
                      "                            [--vrde on|off]\n"
                      "                            [--vrdeextpack default|<name>\n"
@@ -344,6 +348,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
         RTStrmPrintf(pStrm,
                      "                            [--usb on|off]\n"
                      "                            [--usbehci on|off]\n"
+                     "                            [--usbxhci on|off]\n"
                      "                            [--snapshotfolder default|<path>]\n"
                      "                            [--teleporter on|off]\n"
                      "                            [--teleporterport <port>]\n"
@@ -369,18 +374,20 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
 #endif
                      "                            [--autostart-enabled on|off]\n"
                      "                            [--autostart-delay <seconds>]\n"
-#if 0 /* Disabled until the feature is implemented. */
+#if 0
                      "                            [--autostop-type disabled|savestate|poweroff|\n"
                      "                                             acpishutdown]\n"
 #endif
 #ifdef VBOX_WITH_VPX
-                     "                            [--vcpenabled on|off]\n"
-                     "                            [--vcpscreens [<display>],...\n"
-                     "                            [--vcpfile <filename>]\n"
-                     "                            [--vcpwidth <width>]\n"
-                     "                            [--vcpheight <height>]\n"
-                     "                            [--vcprate <rate>]\n"
-                     "                            [--vcpfps <fps>]\n"
+                     "                            [--videocap on|off]\n"
+                     "                            [--videocapscreens all|<screen ID> [<screen ID> ...]]\n"
+                     "                            [--videocapfile <filename>]\n"
+                     "                            [--videocapres <width> <height>]\n"
+                     "                            [--videocaprate <rate>]\n"
+                     "                            [--videocapfps <fps>]\n"
+                     "                            [--videocapmaxtime <time>]\n"
+                     "                            [--videocapmaxsize <MB>]\n"
+                     "                            [--videocapopts <key=value> [<key=value> ...]]\n"
 #endif
                      "                            [--defaultfrontend default|<name>]\n"
                      "\n");
@@ -404,7 +411,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
         RTStrmPrintf(pStrm,
                            "%s import %s          <ovfname/ovaname>\n"
                      "                            [--dry-run|-n]\n"
-                     "                            [--options keepallmacs|keepnatmacs]\n"
+                     "                            [--options keepallmacs|keepnatmacs|importtovdi]\n"
                      "                            [more options]\n"
                      "                            (run with -n to have options displayed\n"
                      "                             for a particular OVF)\n\n", SEP);
@@ -434,7 +441,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            [--type gui", SEP);
         if (fVBoxSDL)
             RTStrmPrintf(pStrm, "|sdl");
-        RTStrmPrintf(pStrm, "|headless]\n");
+        RTStrmPrintf(pStrm, "|headless|separate]\n");
         RTStrmPrintf(pStrm,
                      "\n");
     }
@@ -462,7 +469,8 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                                        <hostport>,[<guestip>],<guestport> |\n"
                      "                            natpf<1-N> delete <rulename> |\n"
                      "                            guestmemoryballoon <balloonsize in MB> |\n"
-                     "                            usbattach <uuid>|<address> |\n"
+                     "                            usbattach <uuid>|<address>\n"
+                     "                                      [--capturefile <filename>] |\n"
                      "                            usbdetach <uuid>|<address> |\n"
                      "                            clipboard disabled|hosttoguest|guesttohost|\n"
                      "                                      bidirectional |\n"
@@ -489,6 +497,11 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            unplugcpu <id> |\n"
                      "                            cpuexecutioncap <1-100>\n"
                      "                            webcam <attach [path [settings]]> | <detach [path]> | <list>\n"
+                     "                            addencpassword <id>\n"
+                     "                                           <password>\n"
+                     "                                           [--removeonsuspend <yes|no>]\n"
+                     "                            removeencpassword <id>\n"
+                     "                            removeallencpasswords\n"
                      "\n", SEP);
     }
 
@@ -518,7 +531,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
 
     if (fCategory & USAGE_CLOSEMEDIUM)
         RTStrmPrintf(pStrm,
-                           "%s closemedium %s     disk|dvd|floppy <uuid|filename>\n"
+                           "%s closemedium %s     [disk|dvd|floppy] <uuid|filename>\n"
                      "                            [--delete]\n"
                      "\n", SEP);
 
@@ -540,6 +553,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            [--tempeject on|off]\n"
                      "                            [--nonrotational on|off]\n"
                      "                            [--discard on|off]\n"
+                     "                            [--hotpluggable on|off]\n"
                      "                            [--bandwidthgroup <name>]\n"
                      "                            [--forceunmount]\n"
                      "                            [--server <name>|<ip>]\n"
@@ -560,7 +574,7 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            [--add ide|sata|scsi|floppy|sas]\n"
                      "                            [--controller LSILogic|LSILogicSAS|BusLogic|\n"
                      "                                          IntelAHCI|PIIX3|PIIX4|ICH6|I82078]\n"
-                     "                            [--portcount <1-30>]\n"
+                     "                            [--portcount <1-n>]\n"
                      "                            [--hostiocache on|off]\n"
                      "                            [--bootable on|off]\n"
                      "                            [--remove]\n"
@@ -579,23 +593,23 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                                          K=kilobyte, M=megabyte, G=gigabyte)\n"
                      "\n", SEP);
 
-    if (fCategory & USAGE_SHOWHDINFO)
+    if (fCategory & USAGE_SHOWMEDIUMINFO)
         RTStrmPrintf(pStrm,
-                           "%s showhdinfo %s      <uuid|filename>\n"
+                           "%s showmediuminfo %s  [disk|dvd|floppy] <uuid|filename>\n"
                      "\n", SEP);
 
-    if (fCategory & USAGE_CREATEHD)
+    if (fCategory & USAGE_CREATEMEDIUM)
         RTStrmPrintf(pStrm,
-                           "%s createhd %s        --filename <filename>\n"
+                           "%s createmedium %s    [disk|dvd|floppy] --filename <filename>\n"
                      "                            [--size <megabytes>|--sizebyte <bytes>]\n"
                      "                            [--diffparent <uuid>|<filename>\n"
                      "                            [--format VDI|VMDK|VHD] (default: VDI)\n"
                      "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
                      "\n", SEP);
 
-    if (fCategory & USAGE_MODIFYHD)
+    if (fCategory & USAGE_MODIFYMEDIUM)
         RTStrmPrintf(pStrm,
-                           "%s modifyhd %s        <uuid|filename>\n"
+                           "%s modifymedium %s    [disk|dvd|floppy] <uuid|filename>\n"
                      "                            [--type normal|writethrough|immutable|shareable|\n"
                      "                                    readonly|multiattach]\n"
                      "                            [--autoreset on|off]\n"
@@ -604,14 +618,41 @@ void printUsage(USAGECATEGORY fCategory, uint32_t fSubCategory, PRTSTREAM pStrm)
                      "                            [--resize <megabytes>|--resizebyte <bytes>]\n"
                      "\n", SEP);
 
-    if (fCategory & USAGE_CLONEHD)
+    if (fCategory & USAGE_CLONEMEDIUM)
         RTStrmPrintf(pStrm,
-                           "%s clonehd %s         <uuid|inputfile> <uuid|outputfile>\n"
+                           "%s clonemedium %s     [disk|dvd|floppy] <uuid|inputfile> <uuid|outputfile>\n"
                      "                            [--format VDI|VMDK|VHD|RAW|<other>]\n"
                      "                            [--variant Standard,Fixed,Split2G,Stream,ESX]\n"
                      "                            [--existing]\n"
                      "\n", SEP);
 
+    if (fCategory & USAGE_MEDIUMPROPERTY)
+        RTStrmPrintf(pStrm,
+                           "%s mediumproperty %s  [disk|dvd|floppy] set <uuid|filename>\n"
+                     "                            <property> <value>\n"
+                     "\n"
+                     "                            [disk|dvd|floppy] get <uuid|filename>\n"
+                     "                            <property>\n"
+                     "\n"
+                     "                            [disk|dvd|floppy] delete <uuid|filename>\n"
+                     "                            <property>\n"
+                     "\n", SEP);
+
+    if (fCategory & USAGE_ENCRYPTMEDIUM)
+        RTStrmPrintf(pStrm,
+                           "%s encryptmedium %s   <uuid|filename>\n"
+                     "                            [--newpassword <file>|-]\n"
+                     "                            [--oldpassword <file>|-]\n"
+                     "                            [--cipher <cipher identifier>]\n"
+                     "                            [--newpasswordid <password identifier>]\n"
+                     "\n", SEP);
+
+    if (fCategory & USAGE_MEDIUMENCCHKPWD)
+        RTStrmPrintf(pStrm,
+                           "%s checkmediumpwd %s  <uuid|filename>\n"
+                     "                            <pwd file>|-\n"
+                     "\n", SEP);
+
     if (fCategory & USAGE_CONVERTFROMRAW)
         RTStrmPrintf(pStrm,
                            "%s convertfromraw %s  <filename> <outputfile>\n"
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
index 4ab4e91..2693d89 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -138,20 +138,20 @@ const char *machineStateToName(MachineState_T machineState, bool fShort)
             return fShort ? "poweroff"             : "powered off";
         case MachineState_Saved:
             return "saved";
-        case MachineState_Aborted:
-            return "aborted";
         case MachineState_Teleported:
             return "teleported";
+        case MachineState_Aborted:
+            return "aborted";
         case MachineState_Running:
             return "running";
         case MachineState_Paused:
             return "paused";
         case MachineState_Stuck:
             return fShort ? "gurumeditation"       : "guru meditation";
-        case MachineState_LiveSnapshotting:
-            return fShort ? "livesnapshotting"     : "live snapshotting";
         case MachineState_Teleporting:
             return "teleporting";
+        case MachineState_LiveSnapshotting:
+            return fShort ? "livesnapshotting"     : "live snapshotting";
         case MachineState_Starting:
             return "starting";
         case MachineState_Stopping:
@@ -164,16 +164,22 @@ const char *machineStateToName(MachineState_T machineState, bool fShort)
             return fShort ? "teleportingpausedvm"  : "teleporting paused vm";
         case MachineState_TeleportingIn:
             return fShort ? "teleportingin"        : "teleporting (incoming)";
-        case MachineState_RestoringSnapshot:
-            return fShort ? "restoringsnapshot"    : "restoring snapshot";
-        case MachineState_DeletingSnapshot:
-            return fShort ? "deletingsnapshot"     : "deleting snapshot";
+        case MachineState_FaultTolerantSyncing:
+            return fShort ? "faulttolerantsyncing" : "fault tolerant syncing";
         case MachineState_DeletingSnapshotOnline:
             return fShort ? "deletingsnapshotlive" : "deleting snapshot live";
         case MachineState_DeletingSnapshotPaused:
             return fShort ? "deletingsnapshotlivepaused" : "deleting snapshot live paused";
+        case MachineState_OnlineSnapshotting:
+            return fShort ? "onlinesnapshotting"   : "online snapshotting";
+        case MachineState_RestoringSnapshot:
+            return fShort ? "restoringsnapshot"    : "restoring snapshot";
+        case MachineState_DeletingSnapshot:
+            return fShort ? "deletingsnapshot"     : "deleting snapshot";
         case MachineState_SettingUp:
-            return fShort ? "settingup"           : "setting up";
+            return fShort ? "settingup"            : "setting up";
+        case MachineState_Snapshotting:
+            return fShort ? "snapshotting"         : "offline snapshotting";
         default:
             break;
     }
@@ -350,12 +356,15 @@ HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl,
 # pragma optimize("g", off)
 #endif
 
-HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
+HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox,
                    ComPtr<IMachine> machine,
-                   VMINFO_DETAILS details /*= VMINFO_NONE*/,
-                   ComPtr<IConsole> console /*= ComPtr<IConsole> ()*/)
+                   ComPtr<ISession> pSession,
+                   VMINFO_DETAILS details /*= VMINFO_NONE*/)
 {
     HRESULT rc;
+    ComPtr<IConsole> pConsole;
+    if (pSession)
+        pSession->COMGETTER(Console)(pConsole.asOutParam());
 
 #define SHOW_BOOLEAN_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
     SHOW_BOOLEAN_PROP_EX(a_pObj, a_Prop, a_szMachine, a_szHuman, "on", "off")
@@ -499,7 +508,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
     Bstr osTypeId;
     CHECK_ERROR2_RET(machine, COMGETTER(OSTypeId)(osTypeId.asOutParam()), hrcCheck);
     ComPtr<IGuestOSType> osType;
-    CHECK_ERROR2_RET(virtualBox, GetGuestOSType(osTypeId.raw(), osType.asOutParam()), hrcCheck);
+    CHECK_ERROR2_RET(pVirtualBox, GetGuestOSType(osTypeId.raw(), osType.asOutParam()), hrcCheck);
     SHOW_STRINGARRAY_PROP( machine, Groups,                     "groups",               "Groups");
     SHOW_STRING_PROP(       osType, Description,                "ostype",               "Guest OS");
     SHOW_UUID_PROP(        machine, Id,                         "UUID",                 "UUID");
@@ -548,7 +557,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
     SHOW_ULONG_PROP(       machine, CPUCount,                   "cpus",                 "Number of CPUs", "");
     SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_PAE, &f), "pae", "PAE");
     SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_LongMode, &f), "longmode", "Long Mode");
-    SHOW_BOOLEAN_METHOD(   machine, GetCPUProperty(CPUPropertyType_Synthetic, &f), "synthcpu", "Synthetic CPU");
+    SHOW_ULONG_PROP(       machine, CPUIDPortabilityLevel, "cpuid-portability-level",   "CPUID Portability Level", "");
 
     if (details != VMINFO_MACHINEREADABLE)
         RTPrintf("CPUID overrides: ");
@@ -608,7 +617,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
         RTPrintf("Boot menu mode:  %s\n", pszBootMenu);
 
     ComPtr<ISystemProperties> systemProperties;
-    CHECK_ERROR2_RET(virtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck);
+    CHECK_ERROR2_RET(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck);
     ULONG maxBootPosition = 0;
     CHECK_ERROR2_RET(systemProperties, COMGETTER(MaxBootPosition)(&maxBootPosition), hrcCheck);
     for (ULONG i = 1; i <= maxBootPosition; i++)
@@ -676,6 +685,65 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
     SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_VPID, &f),        "vtxvpid",      "VT-x VPID");
     SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, &f), "vtxux", "VT-x unr. exec.");
 
+    ParavirtProvider_T paravirtProvider;
+    CHECK_ERROR2_RET(machine, COMGETTER(ParavirtProvider)(&paravirtProvider), hrcCheck);
+    const char *pszParavirtProvider;
+    switch (paravirtProvider)
+    {
+        case ParavirtProvider_None:
+            if (details == VMINFO_MACHINEREADABLE)
+                pszParavirtProvider = "none";
+            else
+                pszParavirtProvider = "None";
+            break;
+
+        case ParavirtProvider_Default:
+            if (details == VMINFO_MACHINEREADABLE)
+                pszParavirtProvider = "default";
+            else
+                pszParavirtProvider = "Default";
+            break;
+
+        case ParavirtProvider_Legacy:
+            if (details == VMINFO_MACHINEREADABLE)
+                pszParavirtProvider = "legacy";
+            else
+                pszParavirtProvider = "Legacy";
+            break;
+
+        case ParavirtProvider_Minimal:
+            if (details == VMINFO_MACHINEREADABLE)
+                pszParavirtProvider = "minimal";
+            else
+                pszParavirtProvider = "Minimal";
+            break;
+
+        case ParavirtProvider_HyperV:
+            if (details == VMINFO_MACHINEREADABLE)
+                pszParavirtProvider = "hyperv";
+            else
+                pszParavirtProvider = "HyperV";
+            break;
+
+        case ParavirtProvider_KVM:
+            if (details == VMINFO_MACHINEREADABLE)
+                pszParavirtProvider = "kvm";
+            else
+                pszParavirtProvider = "KVM";
+            break;
+
+        default:
+            if (details == VMINFO_MACHINEREADABLE)
+                pszParavirtProvider = "unknown";
+            else
+                pszParavirtProvider = "Unknown";
+    }
+    if (details == VMINFO_MACHINEREADABLE)
+        RTPrintf("paravirtprovider=\"%s\"\n", pszParavirtProvider);
+    else
+        RTPrintf("Paravirt. Provider: %s\n", pszParavirtProvider);
+
+
     MachineState_T machineState;
     CHECK_ERROR2_RET(machine, COMGETTER(State)(&machineState), hrcCheck);
     const char *pszState = machineStateToName(machineState, details == VMINFO_MACHINEREADABLE /*=fShort*/);
@@ -743,6 +811,9 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
             case StorageControllerType_LsiLogic:
                 pszCtl = "LsiLogic";
                 break;
+            case StorageControllerType_LsiLogicSas:
+                pszCtl = "LsiLogicSas";
+                break;
             case StorageControllerType_BusLogic:
                 pszCtl = "BusLogic";
                 break;
@@ -761,6 +832,9 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
             case StorageControllerType_I82078:
                 pszCtl = "I82078";
                 break;
+            case StorageControllerType_USB:
+                pszCtl = "USB";
+                break;
 
             default:
                 pszCtl = "unknown";
@@ -898,7 +972,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
     }
 
     /* get the maximum amount of NICS */
-    ULONG maxNICs = getMaxNics(virtualBox, machine);
+    ULONG maxNICs = getMaxNics(pVirtualBox, machine);
 
     for (ULONG currentNIC = 0; currentNIC < maxNICs; currentNIC++)
     {
@@ -1278,7 +1352,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
         RTPrintf("Keyboard Device: %s\n", pszHID);
 
     ComPtr<ISystemProperties> sysProps;
-    virtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam());
+    pVirtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam());
 
     /* get the maximum amount of UARTs */
     ULONG maxUARTs = 0;
@@ -1328,12 +1402,20 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
                         break;
                     case PortMode_RawFile:
                         if (details == VMINFO_MACHINEREADABLE)
-                            RTPrintf("uartmode%d=\"%ls\"\n", currentUART + 1,
+                            RTPrintf("uartmode%d=\"file,%ls\"\n", currentUART + 1,
                                      path.raw());
                         else
                             RTPrintf(", attached to raw file '%ls'\n",
                                      path.raw());
                         break;
+                    case PortMode_TCP:
+                        if (details == VMINFO_MACHINEREADABLE)
+                            RTPrintf("uartmode%d=\"%s,%ls\"\n", currentUART + 1,
+                                     fServer ? "tcpserver" : "tcpclient", path.raw());
+                        else
+                            RTPrintf(", attached to tcp (%s) '%ls'\n",
+                                     fServer ? "server" : "client", path.raw());
+                        break;
                     case PortMode_HostPipe:
                         if (details == VMINFO_MACHINEREADABLE)
                             RTPrintf("uartmode%d=\"%s,%ls\"\n", currentUART + 1,
@@ -1549,32 +1631,32 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
             RTPrintf("Clipboard Mode:  %s\n", psz);
     }
 
-    /* Drag'n'drop */
+    /* Drag and drop */
     {
         const char *psz = "Unknown";
-        DragAndDropMode_T enmMode;
-        rc = machine->COMGETTER(DragAndDropMode)(&enmMode);
+        DnDMode_T enmMode;
+        rc = machine->COMGETTER(DnDMode)(&enmMode);
         switch (enmMode)
         {
-            case DragAndDropMode_Disabled:
+            case DnDMode_Disabled:
                 if (details == VMINFO_MACHINEREADABLE)
                     psz = "disabled";
                 else
                     psz = "disabled";
                 break;
-            case DragAndDropMode_HostToGuest:
+            case DnDMode_HostToGuest:
                 if (details == VMINFO_MACHINEREADABLE)
                     psz = "hosttoguest";
                 else
                     psz = "HostToGuest";
                 break;
-            case DragAndDropMode_GuestToHost:
+            case DnDMode_GuestToHost:
                 if (details == VMINFO_MACHINEREADABLE)
                     psz = "guesttohost";
                 else
                     psz = "GuestToHost";
                 break;
-            case DragAndDropMode_Bidirectional:
+            case DnDMode_Bidirectional:
                 if (details == VMINFO_MACHINEREADABLE)
                     psz = "bidirectional";
                 else
@@ -1588,7 +1670,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
         if (details == VMINFO_MACHINEREADABLE)
             RTPrintf("draganddrop=\"%s\"\n", psz);
         else
-            RTPrintf("Drag'n'drop Mode: %s\n", psz);
+            RTPrintf("Drag and drop Mode: %s\n", psz);
     }
 
     {
@@ -1596,34 +1678,35 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
         rc = machine->COMGETTER(SessionState)(&sessState);
         if (SUCCEEDED(rc) && sessState != SessionState_Unlocked)
         {
-            Bstr sessType;
-            rc = machine->COMGETTER(SessionType)(sessType.asOutParam());
-            if (SUCCEEDED(rc) && !sessType.isEmpty())
+            Bstr sessName;
+            rc = machine->COMGETTER(SessionName)(sessName.asOutParam());
+            if (SUCCEEDED(rc) && !sessName.isEmpty())
             {
                 if (details == VMINFO_MACHINEREADABLE)
-                    RTPrintf("SessionType=\"%ls\"\n", sessType.raw());
+                    RTPrintf("SessionName=\"%ls\"\n", sessName.raw());
                 else
-                    RTPrintf("Session type:    %ls\n", sessType.raw());
+                    RTPrintf("Session name:    %ls\n", sessName.raw());
             }
         }
     }
 
-    if (console)
+    if (pConsole)
     {
         do
         {
             ComPtr<IDisplay> display;
-            rc = console->COMGETTER(Display)(display.asOutParam());
+            rc = pConsole->COMGETTER(Display)(display.asOutParam());
             if (rc == E_ACCESSDENIED || display.isNull())
                 break; /* VM not powered up */
             if (FAILED(rc))
             {
-                com::GlueHandleComError(console, "COMGETTER(Display)(display.asOutParam())", rc, __FILE__, __LINE__);
+                com::GlueHandleComError(pConsole, "COMGETTER(Display)(display.asOutParam())", rc, __FILE__, __LINE__);
                 return rc;
             }
             ULONG xRes, yRes, bpp;
             LONG xOrigin, yOrigin;
-            rc = display->GetScreenResolution(0, &xRes, &yRes, &bpp, &xOrigin, &yOrigin);
+            GuestMonitorStatus_T monitorStatus;
+            rc = display->GetScreenResolution(0, &xRes, &yRes, &bpp, &xOrigin, &yOrigin, &monitorStatus);
             if (rc == E_ACCESSDENIED)
                 break; /* VM not powered up */
             if (FAILED(rc))
@@ -1633,9 +1716,18 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
                 return rc;
             }
             if (details == VMINFO_MACHINEREADABLE)
-                RTPrintf("VideoMode=\"%d,%d,%d\"@%d,%d\n", xRes, yRes, bpp, xOrigin, yOrigin);
+                RTPrintf("VideoMode=\"%d,%d,%d\"@%d,%d %d\n", xRes, yRes, bpp, xOrigin, yOrigin, monitorStatus);
             else
-                RTPrintf("Video mode:      %dx%dx%d at %d,%d\n", xRes, yRes, bpp, xOrigin, yOrigin);
+            {
+                const char *pszMonitorStatus = "unknown status";
+                switch (monitorStatus)
+                {
+                    case GuestMonitorStatus_Enabled:  pszMonitorStatus = "enabled"; break;
+                    case GuestMonitorStatus_Disabled: pszMonitorStatus = "disabled"; break;
+                    default: break;
+                }
+                RTPrintf("Video mode:      %dx%dx%d at %d,%d %s\n", xRes, yRes, bpp, xOrigin, yOrigin, pszMonitorStatus);
+            }
         }
         while (0);
     }
@@ -1684,10 +1776,10 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
                     strAuthType = "unknown";
                     break;
             }
-            if (console)
+            if (pConsole)
             {
                 ComPtr<IVRDEServerInfo> vrdeServerInfo;
-                CHECK_ERROR_RET(console, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);
+                CHECK_ERROR_RET(pConsole, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);
                 if (!vrdeServerInfo.isNull())
                 {
                     rc = vrdeServerInfo->COMGETTER(Port)(&currentPort);
@@ -1721,7 +1813,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
                 if (address.isEmpty())
                     address = "0.0.0.0";
                 RTPrintf("VRDE:            enabled (Address %ls, Ports %ls, MultiConn: %s, ReuseSingleConn: %s, Authentication type: %s)\n", address.raw(), ports.raw(), fMultiCon ? "on" : "off", fReuseCon ? "on" : "off", strAuthType);
-                if (console && currentPort != -1 && currentPort != 0)
+                if (pConsole && currentPort != -1 && currentPort != 0)
                    RTPrintf("VRDE port:       %d\n", currentPort);
                 if (fVideoChannel)
                     RTPrintf("Video redirection: enabled (Quality %ls)\n", videoChannelQuality.raw());
@@ -1771,6 +1863,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
     {
         bool fOhciEnabled = false;
         bool fEhciEnabled = false;
+        bool fXhciEnabled = false;
 
         for (unsigned i = 0; i < USBCtlColl.size(); i++)
         {
@@ -1787,6 +1880,9 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
                     case USBControllerType_EHCI:
                         fEhciEnabled = true;
                         break;
+                    case USBControllerType_XHCI:
+                        fXhciEnabled = true;
+                        break;
                     default:
                         break;
                 }
@@ -1802,6 +1898,11 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
             RTPrintf("ehci=\"%s\"\n", fEhciEnabled ? "on" : "off");
         else
             RTPrintf("EHCI:            %s\n", fEhciEnabled ? "enabled" : "disabled");
+
+        if (details == VMINFO_MACHINEREADABLE)
+            RTPrintf("xhci=\"%s\"\n", fXhciEnabled ? "on" : "off");
+        else
+            RTPrintf("XHCI:            %s\n", fXhciEnabled ? "enabled" : "disabled");
     }
 
     ComPtr<IUSBDeviceFilters> USBFlts;
@@ -1891,7 +1992,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
             }
         }
 
-        if (console)
+        if (pConsole)
         {
             /* scope */
             {
@@ -1899,7 +2000,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
                     RTPrintf("Available remote USB devices:\n\n");
 
                 SafeIfaceArray <IHostUSBDevice> coll;
-                CHECK_ERROR_RET(console, COMGETTER(RemoteUSBDevices)(ComSafeArrayAsOutParam(coll)), rc);
+                CHECK_ERROR_RET(pConsole, COMGETTER(RemoteUSBDevices)(ComSafeArrayAsOutParam(coll)), rc);
 
                 if (coll.size() == 0)
                 {
@@ -1988,7 +2089,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
                     RTPrintf("Currently Attached USB Devices:\n\n");
 
                 SafeIfaceArray <IUSBDevice> coll;
-                CHECK_ERROR_RET(console, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)), rc);
+                CHECK_ERROR_RET(pConsole, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(coll)), rc);
 
                 if (coll.size() == 0)
                 {
@@ -2136,7 +2237,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
     /* globally shared folders first */
     {
         SafeIfaceArray <ISharedFolder> sfColl;
-        CHECK_ERROR_RET(virtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(sfColl)), rc);
+        CHECK_ERROR_RET(pVirtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(sfColl)), rc);
         for (size_t i = 0; i < sfColl.size(); ++i)
         {
             ComPtr<ISharedFolder> sf = sfColl[i];
@@ -2179,11 +2280,11 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
         }
     }
     /* transient mappings */
-    if (console)
+    if (pConsole)
     {
         com::SafeIfaceArray <ISharedFolder> folders;
 
-        CHECK_ERROR_RET(console, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);
+        CHECK_ERROR_RET(pConsole, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(folders)), rc);
 
         for (size_t i = 0; i < folders.size(); ++i)
         {
@@ -2211,13 +2312,13 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
     if (details != VMINFO_MACHINEREADABLE)
         RTPrintf("\n");
 
-    if (console)
+    if (pConsole)
     {
         /*
          * Live VRDE info.
          */
         ComPtr<IVRDEServerInfo> vrdeServerInfo;
-        CHECK_ERROR_RET(console, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);
+        CHECK_ERROR_RET(pConsole, COMGETTER(VRDEServerInfo)(vrdeServerInfo.asOutParam()), rc);
         BOOL    Active = FALSE;
         ULONG   NumberOfClients = 0;
         LONG64  BeginTime = 0;
@@ -2425,10 +2526,10 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> virtualBox,
             RTPrintf("Configured memory balloon size:      %d MB\n", guestVal);
     }
 
-    if (console)
+    if (pConsole)
     {
         ComPtr<IGuest> guest;
-        rc = console->COMGETTER(Guest)(guest.asOutParam());
+        rc = pConsole->COMGETTER(Guest)(guest.asOutParam());
         if (SUCCEEDED(rc) && !guest.isNull())
         {
             Bstr guestString;
@@ -2620,7 +2721,7 @@ int handleShowVMInfo(HandlerArg *a)
     {
         ULONG64 uOffset = 0;
         SafeArray<BYTE> aLogData;
-        ULONG cbLogData;
+        size_t cbLogData;
         while (true)
         {
             /* Reset the array */
@@ -2634,7 +2735,7 @@ int handleShowVMInfo(HandlerArg *a)
             /* aLogData has a platform dependent line ending, standardize on
              * Unix style, as RTStrmWrite does the LF -> CR/LF replacement on
              * Windows. Otherwise we end up with CR/CR/LF on Windows. */
-            ULONG cbLogDataPrint = cbLogData;
+            size_t cbLogDataPrint = cbLogData;
             for (BYTE *s = aLogData.raw(), *d = s;
                  s - aLogData.raw() < (ssize_t)cbLogData;
                  s++, d++)
@@ -2663,21 +2764,15 @@ int handleShowVMInfo(HandlerArg *a)
         else
             details = VMINFO_STANDARD;
 
-        ComPtr<IConsole> console;
-
         /* open an existing session for the VM */
         rc = machine->LockMachine(a->session, LockType_Shared);
         if (SUCCEEDED(rc))
             /* get the session machine */
             rc = a->session->COMGETTER(Machine)(machine.asOutParam());
-        if (SUCCEEDED(rc))
-            /* get the session console */
-            rc = a->session->COMGETTER(Console)(console.asOutParam());
 
-        rc = showVMInfo(a->virtualBox, machine, details, console);
+        rc = showVMInfo(a->virtualBox, machine, a->session, details);
 
-        if (console)
-            a->session->UnlockMachine();
+        a->session->UnlockMachine();
     }
 
     return SUCCEEDED(rc) ? 0 : 1;
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
index e81bd72..7a49a36 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
@@ -401,18 +401,44 @@ static HRESULT listUsbHost(const ComPtr<IVirtualBox> &pVirtualBox)
             CHECK_ERROR_RET(dev, COMGETTER(Version)(&usVersion), 1);
             USHORT usPortVersion;
             CHECK_ERROR_RET(dev, COMGETTER(PortVersion)(&usPortVersion), 1);
+            USBConnectionSpeed_T enmSpeed;
+            CHECK_ERROR_RET(dev, COMGETTER(Speed)(&enmSpeed), 1);
 
             RTPrintf("UUID:               %s\n"
                      "VendorId:           %#06x (%04X)\n"
                      "ProductId:          %#06x (%04X)\n"
                      "Revision:           %u.%u (%02u%02u)\n"
-                     "Port:               %u\n"
-                     "USB version/speed:  %u/%u\n",
+                     "Port:               %u\n",
                      Utf8Str(id).c_str(),
                      usVendorId, usVendorId, usProductId, usProductId,
                      bcdRevision >> 8, bcdRevision & 0xff,
                      bcdRevision >> 8, bcdRevision & 0xff,
-                     usPort, usVersion, usPortVersion);
+                     usPort);
+
+            const char *pszSpeed = "?";
+            switch (enmSpeed)
+            {
+                case USBConnectionSpeed_Low:
+                    pszSpeed = "Low";
+                    break;
+                case USBConnectionSpeed_Full:
+                    pszSpeed = "Full";
+                    break;
+                case USBConnectionSpeed_High:
+                    pszSpeed = "High";
+                    break;
+                case USBConnectionSpeed_Super:
+                    pszSpeed = "Super";
+                    break;
+                case USBConnectionSpeed_SuperPlus:
+                    pszSpeed = "SuperPlus";
+                    break;
+                default:
+                    ASSERT(false);
+                    break;
+            }
+
+            RTPrintf("USB version/speed:  %u/%s\n", usVersion, pszSpeed);
 
             /* optional stuff. */
             Bstr bstr;
@@ -767,6 +793,35 @@ static HRESULT listVideoInputDevices(const ComPtr<IVirtualBox> pVirtualBox)
     return rc;
 }
 
+/**
+ * List supported screen shot formats.
+ *
+ * @returns See produceList.
+ * @param   pVirtualBox         Reference to the IVirtualBox pointer.
+ */
+static HRESULT listScreenShotFormats(const ComPtr<IVirtualBox> pVirtualBox)
+{
+    HRESULT rc = S_OK;
+    ComPtr<ISystemProperties> systemProperties;
+    CHECK_ERROR(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()));
+    com::SafeArray<BitmapFormat_T> formats;
+    CHECK_ERROR(systemProperties, COMGETTER(ScreenShotFormats)(ComSafeArrayAsOutParam(formats)));
+
+    RTPrintf("Supported %d screen shot formats:\n", formats.size());
+    for (size_t i = 0; i < formats.size(); ++i)
+    {
+        uint32_t u32Format = (uint32_t)formats[i];
+        char szFormat[5];
+        szFormat[0] = RT_BYTE1(u32Format);
+        szFormat[1] = RT_BYTE2(u32Format);
+        szFormat[2] = RT_BYTE3(u32Format);
+        szFormat[3] = RT_BYTE4(u32Format);
+        szFormat[4] = 0;
+        RTPrintf("    BitmapFormat_%s (0x%08X)\n", szFormat, u32Format);
+    }
+    return rc;
+}
+
 
 /**
  * The type of lists we can produce.
@@ -797,7 +852,8 @@ enum enmListType
     kListExtPacks,
     kListGroups,
     kListNatNetworks,
-    kListVideoInputDevices
+    kListVideoInputDevices,
+    kListScreenShotFormats
 };
 
 
@@ -833,7 +889,7 @@ static HRESULT produceList(enum enmListType enmCommand, bool fOptLong, const Com
                 for (size_t i = 0; i < machines.size(); ++i)
                 {
                     if (machines[i])
-                        rc = showVMInfo(pVirtualBox, machines[i], fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
+                        rc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
                 }
             }
             break;
@@ -866,7 +922,7 @@ static HRESULT produceList(enum enmListType enmCommand, bool fOptLong, const Com
                             case MachineState_LiveSnapshotting:
                             case MachineState_Paused:
                             case MachineState_TeleportingPausedVM:
-                                rc = showVMInfo(pVirtualBox, machines[i], fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
+                                rc = showVMInfo(pVirtualBox, machines[i], NULL, fOptLong ? VMINFO_STANDARD : VMINFO_COMPACT);
                                 break;
                         }
                     }
@@ -1135,6 +1191,10 @@ static HRESULT produceList(enum enmListType enmCommand, bool fOptLong, const Com
             rc = listVideoInputDevices(pVirtualBox);
             break;
 
+        case kListScreenShotFormats:
+            rc = listScreenShotFormats(pVirtualBox);
+            break;
+
         /* No default here, want gcc warnings. */
 
     } /* end switch */
@@ -1184,6 +1244,7 @@ int handleList(HandlerArg *a)
         { "extpacks",           kListExtPacks,           RTGETOPT_REQ_NOTHING },
         { "groups",             kListGroups,             RTGETOPT_REQ_NOTHING },
         { "webcams",            kListVideoInputDevices,  RTGETOPT_REQ_NOTHING },
+        { "screenshotformats",  kListScreenShotFormats,  RTGETOPT_REQ_NOTHING },
     };
 
     int                 ch;
@@ -1230,6 +1291,7 @@ int handleList(HandlerArg *a)
             case kListGroups:
             case kListNatNetworks:
             case kListVideoInputDevices:
+            case kListScreenShotFormats:
                 enmOptCommand = (enum enmListType)ch;
                 if (fOptMultiple)
                 {
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
index 8c4885c..7a95814 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -649,9 +649,9 @@ int handleDiscardState(HandlerArg *a)
             CHECK_ERROR_BREAK(machine, LockMachine(a->session, LockType_Write));
             do
             {
-                ComPtr<IConsole> console;
-                CHECK_ERROR_BREAK(a->session, COMGETTER(Console)(console.asOutParam()));
-                CHECK_ERROR_BREAK(console, DiscardSavedState(true /* fDeleteFile */));
+                ComPtr<IMachine> sessionMachine;
+                CHECK_ERROR_BREAK(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, DiscardSavedState(true /* fDeleteFile */));
             } while (0);
             CHECK_ERROR_BREAK(a->session, UnlockMachine());
         } while (0);
@@ -686,9 +686,9 @@ int handleAdoptState(HandlerArg *a)
             CHECK_ERROR_BREAK(machine, LockMachine(a->session, LockType_Write));
             do
             {
-                ComPtr<IConsole> console;
-                CHECK_ERROR_BREAK(a->session, COMGETTER(Console)(console.asOutParam()));
-                CHECK_ERROR_BREAK(console, AdoptSavedState(Bstr(szStateFileAbs).raw()));
+                ComPtr<IMachine> sessionMachine;
+                CHECK_ERROR_BREAK(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, AdoptSavedState(Bstr(szStateFileAbs).raw()));
             } while (0);
             CHECK_ERROR_BREAK(a->session, UnlockMachine());
         } while (0);
@@ -803,13 +803,18 @@ int handleSetExtraData(HandlerArg *a)
                                                machine.asOutParam()));
         if (machine)
         {
+            /* open an existing session for the VM */
+            CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Shared), 1);
+            /* get the session machine */
+            ComPtr<IMachine> sessionMachine;
+            CHECK_ERROR_RET(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()), 1);
             /** @todo passing NULL is deprecated */
             if (a->argc < 3)
-                CHECK_ERROR(machine, SetExtraData(Bstr(a->argv[1]).raw(),
-                                                  NULL));
+                CHECK_ERROR(sessionMachine, SetExtraData(Bstr(a->argv[1]).raw(),
+                                                         NULL));
             else if (a->argc == 3)
-                CHECK_ERROR(machine, SetExtraData(Bstr(a->argv[1]).raw(),
-                                                  Bstr(a->argv[2]).raw()));
+                CHECK_ERROR(sessionMachine, SetExtraData(Bstr(a->argv[1]).raw(),
+                                                         Bstr(a->argv[2]).raw()));
             else
                 return errorSyntax(USAGE_SETEXTRADATA, "Too many parameters");
         }
@@ -991,8 +996,11 @@ int handleSharedFolder(HandlerArg *a)
 
             /* open an existing session for the VM */
             CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Shared), 1);
+
             /* get the session machine */
-            CHECK_ERROR_RET(a->session, COMGETTER(Machine)(machine.asOutParam()), 1);
+            ComPtr<IMachine> sessionMachine;
+            CHECK_ERROR_RET(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()), 1);
+
             /* get the session console */
             CHECK_ERROR_RET(a->session, COMGETTER(Console)(console.asOutParam()), 1);
 
@@ -1008,13 +1016,14 @@ int handleSharedFolder(HandlerArg *a)
             CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), 1);
 
             /* get the mutable session machine */
-            a->session->COMGETTER(Machine)(machine.asOutParam());
+            ComPtr<IMachine> sessionMachine;
+            a->session->COMGETTER(Machine)(sessionMachine.asOutParam());
 
-            CHECK_ERROR(machine, CreateSharedFolder(Bstr(name).raw(),
-                                                    Bstr(hostpath).raw(),
-                                                    fWritable, fAutoMount));
+            CHECK_ERROR(sessionMachine, CreateSharedFolder(Bstr(name).raw(),
+                                                           Bstr(hostpath).raw(),
+                                                           fWritable, fAutoMount));
             if (SUCCEEDED(rc))
-                CHECK_ERROR(machine, SaveSettings());
+                CHECK_ERROR(sessionMachine, SaveSettings());
 
             a->session->UnlockMachine();
         }
@@ -1058,7 +1067,8 @@ int handleSharedFolder(HandlerArg *a)
             /* open an existing session for the VM */
             CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Shared), 1);
             /* get the session machine */
-            CHECK_ERROR_RET(a->session, COMGETTER(Machine)(machine.asOutParam()), 1);
+            ComPtr<IMachine> sessionMachine;
+            CHECK_ERROR_RET(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()), 1);
             /* get the session console */
             CHECK_ERROR_RET(a->session, COMGETTER(Console)(console.asOutParam()), 1);
 
@@ -1073,12 +1083,13 @@ int handleSharedFolder(HandlerArg *a)
             CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), 1);
 
             /* get the mutable session machine */
-            a->session->COMGETTER(Machine)(machine.asOutParam());
+            ComPtr<IMachine> sessionMachine;
+            a->session->COMGETTER(Machine)(sessionMachine.asOutParam());
 
-            CHECK_ERROR(machine, RemoveSharedFolder(Bstr(name).raw()));
+            CHECK_ERROR(sessionMachine, RemoveSharedFolder(Bstr(name).raw()));
 
             /* commit and close the session */
-            CHECK_ERROR(machine, SaveSettings());
+            CHECK_ERROR(sessionMachine, SaveSettings());
             a->session->UnlockMachine();
         }
     }
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
index 5366aeb..5fb0f31 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -59,8 +59,9 @@ enum
     MODIFYVM_IOAPIC,
     MODIFYVM_PAE,
     MODIFYVM_LONGMODE,
-    MODIFYVM_SYNTHCPU,
+    MODIFYVM_CPUID_PORTABILITY,
     MODIFYVM_TFRESET,
+    MODIFYVM_PARAVIRTPROVIDER,
     MODIFYVM_HWVIRTEX,
     MODIFYVM_NESTEDPAGING,
     MODIFYVM_LARGEPAGES,
@@ -160,6 +161,7 @@ enum
     MODIFYVM_VRDE_EXTPACK,
     MODIFYVM_VRDE,
     MODIFYVM_RTCUSEUTC,
+    MODIFYVM_USBXHCI,
     MODIFYVM_USBEHCI,
     MODIFYVM_USB,
     MODIFYVM_SNAPSHOTFOLDER,
@@ -199,6 +201,9 @@ enum
     MODIFYVM_VCP_HEIGHT,
     MODIFYVM_VCP_RATE,
     MODIFYVM_VCP_FPS,
+    MODIFYVM_VCP_MAXTIME,
+    MODIFYVM_VCP_MAXSIZE,
+    MODIFYVM_VCP_OPTIONS,
 #endif
     MODIFYVM_CHIPSET,
     MODIFYVM_DEFAULTFRONTEND
@@ -219,8 +224,9 @@ static const RTGETOPTDEF g_aModifyVMOptions[] =
     { "--ioapic",                   MODIFYVM_IOAPIC,                    RTGETOPT_REQ_BOOL_ONOFF },
     { "--pae",                      MODIFYVM_PAE,                       RTGETOPT_REQ_BOOL_ONOFF },
     { "--longmode",                 MODIFYVM_LONGMODE,                  RTGETOPT_REQ_BOOL_ONOFF },
-    { "--synthcpu",                 MODIFYVM_SYNTHCPU,                  RTGETOPT_REQ_BOOL_ONOFF },
-    { "--triplefaultreset",         MODIFYVM_TFRESET,                  RTGETOPT_REQ_BOOL_ONOFF },
+    { "--cpuid-portability-level",  MODIFYVM_CPUID_PORTABILITY,         RTGETOPT_REQ_UINT32 },
+    { "--triplefaultreset",         MODIFYVM_TFRESET,                   RTGETOPT_REQ_BOOL_ONOFF },
+    { "--paravirtprovider",         MODIFYVM_PARAVIRTPROVIDER,          RTGETOPT_REQ_STRING },
     { "--hwvirtex",                 MODIFYVM_HWVIRTEX,                  RTGETOPT_REQ_BOOL_ONOFF },
     { "--nestedpaging",             MODIFYVM_NESTEDPAGING,              RTGETOPT_REQ_BOOL_ONOFF },
     { "--largepages",               MODIFYVM_LARGEPAGES,                RTGETOPT_REQ_BOOL_ONOFF },
@@ -322,6 +328,7 @@ static const RTGETOPTDEF g_aModifyVMOptions[] =
     { "--vrdevideochannelquality",  MODIFYVM_VRDEVIDEOCHANNELQUALITY,   RTGETOPT_REQ_STRING },
     { "--vrdeextpack",              MODIFYVM_VRDE_EXTPACK,              RTGETOPT_REQ_STRING },
     { "--vrde",                     MODIFYVM_VRDE,                      RTGETOPT_REQ_BOOL_ONOFF },
+    { "--usbxhci",                  MODIFYVM_USBXHCI,                   RTGETOPT_REQ_BOOL_ONOFF },
     { "--usbehci",                  MODIFYVM_USBEHCI,                   RTGETOPT_REQ_BOOL_ONOFF },
     { "--usb",                      MODIFYVM_USB,                       RTGETOPT_REQ_BOOL_ONOFF },
     { "--snapshotfolder",           MODIFYVM_SNAPSHOTFOLDER,            RTGETOPT_REQ_STRING },
@@ -352,6 +359,9 @@ static const RTGETOPTDEF g_aModifyVMOptions[] =
     { "--vcpheight",                MODIFYVM_VCP_HEIGHT,                RTGETOPT_REQ_UINT32 },
     { "--vcprate",                  MODIFYVM_VCP_RATE,                  RTGETOPT_REQ_UINT32 },
     { "--vcpfps",                   MODIFYVM_VCP_FPS,                   RTGETOPT_REQ_UINT32 },
+    { "--vcpmaxtime",               MODIFYVM_VCP_MAXTIME,               RTGETOPT_REQ_INT32  },
+    { "--vcpmaxsize",               MODIFYVM_VCP_MAXSIZE,               RTGETOPT_REQ_INT32  },
+    { "--vcpoptions",               MODIFYVM_VCP_OPTIONS,               RTGETOPT_REQ_STRING },
 #endif
     { "--autostart-enabled",        MODIFYVM_AUTOSTART_ENABLED,         RTGETOPT_REQ_BOOL_ONOFF },
     { "--autostart-delay",          MODIFYVM_AUTOSTART_DELAY,           RTGETOPT_REQ_UINT32 },
@@ -449,17 +459,14 @@ int handleModifyVM(HandlerArg *a)
     int c;
     HRESULT rc;
     Bstr name;
-    RTGETOPTUNION ValueUnion;
-    RTGETOPTSTATE GetOptState;
-    ComPtr<IMachine> machine;
-    ComPtr<IBIOSSettings> biosSettings;
 
     /* VM ID + at least one parameter. Parameter arguments are checked
      * individually. */
     if (a->argc < 2)
         return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
 
-    /* try to find the given machine */
+    /* try to find the given sessionMachine */
+    ComPtr<IMachine> machine;
     CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
                                                machine.asOutParam()), 1);
 
@@ -470,13 +477,18 @@ int handleModifyVM(HandlerArg *a)
     /* open a session for the VM */
     CHECK_ERROR_RET(machine, LockMachine(a->session, LockType_Write), 1);
 
-    /* get the mutable session machine */
-    CHECK_ERROR_RET(a->session, COMGETTER(Machine)(machine.asOutParam()), 1);
-    machine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
+    /* get the mutable session sessionMachine */
+    ComPtr<IMachine> sessionMachine;
+    CHECK_ERROR_RET(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()), 1);
+
+    ComPtr<IBIOSSettings> biosSettings;
+    sessionMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
 
+    RTGETOPTSTATE GetOptState;
     RTGetOptInit(&GetOptState, a->argc, a->argv, g_aModifyVMOptions,
                  RT_ELEMENTS(g_aModifyVMOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
 
+    RTGETOPTUNION ValueUnion;
     while (   SUCCEEDED (rc)
            && (c = RTGetOpt(&GetOptState, &ValueUnion)))
     {
@@ -484,19 +496,19 @@ int handleModifyVM(HandlerArg *a)
         {
             case MODIFYVM_NAME:
             {
-                CHECK_ERROR(machine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(Name)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
             case MODIFYVM_GROUPS:
             {
                 com::SafeArray<BSTR> groups;
                 parseGroups(ValueUnion.psz, &groups);
-                CHECK_ERROR(machine, COMSETTER(Groups)(ComSafeArrayAsInParam(groups)));
+                CHECK_ERROR(sessionMachine, COMSETTER(Groups)(ComSafeArrayAsInParam(groups)));
                 break;
             }
             case MODIFYVM_DESCRIPTION:
             {
-                CHECK_ERROR(machine, COMSETTER(Description)(Bstr(ValueUnion.psz).raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(Description)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
             case MODIFYVM_OSTYPE:
@@ -506,7 +518,7 @@ int handleModifyVM(HandlerArg *a)
                                                           guestOSType.asOutParam()));
                 if (SUCCEEDED(rc) && guestOSType)
                 {
-                    CHECK_ERROR(machine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw()));
+                    CHECK_ERROR(sessionMachine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw()));
                 }
                 else
                 {
@@ -549,25 +561,25 @@ int handleModifyVM(HandlerArg *a)
                     break;
                 }
                 RTFileClose(iconFile);
-                CHECK_ERROR(machine, COMSETTER(Icon)(ComSafeArrayAsInParam(icon)));
+                CHECK_ERROR(sessionMachine, COMSETTER(Icon)(ComSafeArrayAsInParam(icon)));
                 break;
             }
 
             case MODIFYVM_MEMORY:
             {
-                CHECK_ERROR(machine, COMSETTER(MemorySize)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(MemorySize)(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_PAGEFUSION:
             {
-                CHECK_ERROR(machine, COMSETTER(PageFusionEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(PageFusionEnabled)(ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_VRAM:
             {
-                CHECK_ERROR(machine, COMSETTER(VRAMSize)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(VRAMSize)(ValueUnion.u32));
                 break;
             }
 
@@ -575,23 +587,23 @@ int handleModifyVM(HandlerArg *a)
             {
                 if (!RTStrICmp(ValueUnion.psz, "efi"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI));
+                    CHECK_ERROR(sessionMachine, COMSETTER(FirmwareType)(FirmwareType_EFI));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "efi32"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
+                    CHECK_ERROR(sessionMachine, COMSETTER(FirmwareType)(FirmwareType_EFI32));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "efi64"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
+                    CHECK_ERROR(sessionMachine, COMSETTER(FirmwareType)(FirmwareType_EFI64));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "efidual"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
+                    CHECK_ERROR(sessionMachine, COMSETTER(FirmwareType)(FirmwareType_EFIDUAL));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "bios"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
+                    CHECK_ERROR(sessionMachine, COMSETTER(FirmwareType)(FirmwareType_BIOS));
                 }
                 else
                 {
@@ -615,31 +627,54 @@ int handleModifyVM(HandlerArg *a)
 
             case MODIFYVM_PAE:
             {
-                CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, SetCPUProperty(CPUPropertyType_PAE, ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_LONGMODE:
             {
-                CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_LongMode, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, SetCPUProperty(CPUPropertyType_LongMode, ValueUnion.f));
                 break;
             }
 
-            case MODIFYVM_SYNTHCPU:
+            case MODIFYVM_CPUID_PORTABILITY:
             {
-                CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_Synthetic, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(CPUIDPortabilityLevel)(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_TFRESET:
             {
-                CHECK_ERROR(machine, SetCPUProperty(CPUPropertyType_TripleFaultReset, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, SetCPUProperty(CPUPropertyType_TripleFaultReset, ValueUnion.f));
+                break;
+            }
+
+            case MODIFYVM_PARAVIRTPROVIDER:
+            {
+                if (   !RTStrICmp(ValueUnion.psz, "none")
+                    || !RTStrICmp(ValueUnion.psz, "disabled"))
+                    CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_None));
+                else if (!RTStrICmp(ValueUnion.psz, "default"))
+                    CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_Default));
+                else if (!RTStrICmp(ValueUnion.psz, "legacy"))
+                    CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_Legacy));
+                else if (!RTStrICmp(ValueUnion.psz, "minimal"))
+                    CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_Minimal));
+                else if (!RTStrICmp(ValueUnion.psz, "hyperv"))
+                    CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_HyperV));
+                else if (!RTStrICmp(ValueUnion.psz, "kvm"))
+                    CHECK_ERROR(sessionMachine, COMSETTER(ParavirtProvider)(ParavirtProvider_KVM));
+                else
+                {
+                    errorArgument("Invalid --paravirtprovider argument '%s'", ValueUnion.psz);
+                    rc = E_FAIL;
+                }
                 break;
             }
 
             case MODIFYVM_HWVIRTEX:
             {
-                CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, SetHWVirtExProperty(HWVirtExPropertyType_Enabled, ValueUnion.f));
                 break;
             }
 
@@ -648,7 +683,7 @@ int handleModifyVM(HandlerArg *a)
                 uint32_t id = ValueUnion.u32;
                 uint32_t aValue[4];
 
-                for (unsigned i = 0 ; i < 4 ; i++)
+                for (unsigned i = 0; i < 4; i++)
                 {
                     int vrc = RTGetOptFetchValue(&GetOptState, &ValueUnion, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_HEX);
                     if (RT_FAILURE(vrc))
@@ -657,79 +692,79 @@ int handleModifyVM(HandlerArg *a)
                                            GetOptState.pDef->pszLong);
                     aValue[i] = ValueUnion.u32;
                 }
-                CHECK_ERROR(machine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
+                CHECK_ERROR(sessionMachine, SetCPUIDLeaf(id, aValue[0], aValue[1], aValue[2], aValue[3]));
                 break;
             }
 
             case MODIFYVM_DELCPUID:
             {
-                CHECK_ERROR(machine, RemoveCPUIDLeaf(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, RemoveCPUIDLeaf(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_DELALLCPUID:
             {
-                CHECK_ERROR(machine, RemoveAllCPUIDLeaves());
+                CHECK_ERROR(sessionMachine, RemoveAllCPUIDLeaves());
                 break;
             }
 
             case MODIFYVM_NESTEDPAGING:
             {
-                CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, SetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_LARGEPAGES:
             {
-                CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, SetHWVirtExProperty(HWVirtExPropertyType_LargePages, ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_VTXVPID:
             {
-                CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, SetHWVirtExProperty(HWVirtExPropertyType_VPID, ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_VTXUX:
             {
-                CHECK_ERROR(machine, SetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, ValueUnion.f));
+                CHECK_ERROR(sessionMachine, SetHWVirtExProperty(HWVirtExPropertyType_UnrestrictedExecution, ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_CPUS:
             {
-                CHECK_ERROR(machine, COMSETTER(CPUCount)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(CPUCount)(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_RTCUSEUTC:
             {
-                CHECK_ERROR(machine, COMSETTER(RTCUseUTC)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(RTCUseUTC)(ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_CPUHOTPLUG:
             {
-                CHECK_ERROR(machine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(CPUHotPlugEnabled)(ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_PLUGCPU:
             {
-                CHECK_ERROR(machine, HotPlugCPU(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, HotPlugCPU(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_UNPLUGCPU:
             {
-                CHECK_ERROR(machine, HotUnplugCPU(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, HotUnplugCPU(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_CPU_EXECTUION_CAP:
             {
-                CHECK_ERROR(machine, COMSETTER(CPUExecutionCap)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(CPUExecutionCap)(ValueUnion.u32));
                 break;
             }
 
@@ -737,16 +772,16 @@ int handleModifyVM(HandlerArg *a)
             {
                 if (   !RTStrICmp(ValueUnion.psz, "none")
                     || !RTStrICmp(ValueUnion.psz, "disabled"))
-                    CHECK_ERROR(machine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_Null));
+                    CHECK_ERROR(sessionMachine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_Null));
                 else if (   !RTStrICmp(ValueUnion.psz, "vboxvga")
                          || !RTStrICmp(ValueUnion.psz, "vbox")
                          || !RTStrICmp(ValueUnion.psz, "vga")
                          || !RTStrICmp(ValueUnion.psz, "vesa"))
-                    CHECK_ERROR(machine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VBoxVGA));
+                    CHECK_ERROR(sessionMachine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VBoxVGA));
 #ifdef VBOX_WITH_VMSVGA
                 else if (   !RTStrICmp(ValueUnion.psz, "vmsvga")
                          || !RTStrICmp(ValueUnion.psz, "vmware"))
-                    CHECK_ERROR(machine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VMSVGA));
+                    CHECK_ERROR(sessionMachine, COMSETTER(GraphicsControllerType)(GraphicsControllerType_VMSVGA));
 #endif
                 else
                 {
@@ -758,20 +793,20 @@ int handleModifyVM(HandlerArg *a)
 
             case MODIFYVM_MONITORCOUNT:
             {
-                CHECK_ERROR(machine, COMSETTER(MonitorCount)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(MonitorCount)(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_ACCELERATE3D:
             {
-                CHECK_ERROR(machine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(Accelerate3DEnabled)(ValueUnion.f));
                 break;
             }
 
 #ifdef VBOX_WITH_VIDEOHWACCEL
             case MODIFYVM_ACCELERATE2DVIDEO:
             {
-                CHECK_ERROR(machine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(Accelerate2DVideoEnabled)(ValueUnion.f));
                 break;
             }
 #endif
@@ -838,23 +873,23 @@ int handleModifyVM(HandlerArg *a)
             {
                 if (!RTStrICmp(ValueUnion.psz, "none"))
                 {
-                    CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
+                    CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_Null));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "floppy"))
                 {
-                    CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
+                    CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_Floppy));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "dvd"))
                 {
-                    CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
+                    CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_DVD));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "disk"))
                 {
-                    CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
+                    CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_HardDisk));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "net"))
                 {
-                    CHECK_ERROR(machine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
+                    CHECK_ERROR(sessionMachine, SetBootOrder(GetOptState.uIndex, DeviceType_Network));
                 }
                 else
                     return errorArgument("Invalid boot device '%s'", ValueUnion.psz);
@@ -893,7 +928,7 @@ int handleModifyVM(HandlerArg *a)
 
                 if (!RTStrICmp(ValueUnion.psz, "none"))
                 {
-                    machine->DetachDevice(bstrController.raw(), u1, u2);
+                    sessionMachine->DetachDevice(bstrController.raw(), u1, u2);
                 }
                 else
                 {
@@ -906,7 +941,7 @@ int handleModifyVM(HandlerArg *a)
                         break;
                     if (hardDisk)
                     {
-                        CHECK_ERROR(machine, AttachDevice(bstrController.raw(),
+                        CHECK_ERROR(sessionMachine, AttachDevice(bstrController.raw(),
                                                           u1, u2,
                                                           DeviceType_HardDisk,
                                                           hardDisk));
@@ -920,7 +955,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_IDECONTROLLER: // deprecated
             {
                 ComPtr<IStorageController> storageController;
-                CHECK_ERROR(machine, GetStorageControllerByName(Bstr("IDE Controller").raw(),
+                CHECK_ERROR(sessionMachine, GetStorageControllerByName(Bstr("IDE Controller").raw(),
                                                                  storageController.asOutParam()));
 
                 if (!RTStrICmp(ValueUnion.psz, "PIIX3"))
@@ -946,7 +981,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_SATAPORTCOUNT: // deprecated
             {
                 ComPtr<IStorageController> SataCtl;
-                CHECK_ERROR(machine, GetStorageControllerByName(Bstr("SATA").raw(),
+                CHECK_ERROR(sessionMachine, GetStorageControllerByName(Bstr("SATA").raw(),
                                                                 SataCtl.asOutParam()));
 
                 if (SUCCEEDED(rc) && ValueUnion.u32 > 0)
@@ -959,13 +994,13 @@ int handleModifyVM(HandlerArg *a)
                 if (!RTStrICmp(ValueUnion.psz, "on") || !RTStrICmp(ValueUnion.psz, "enable"))
                 {
                     ComPtr<IStorageController> ctl;
-                    CHECK_ERROR(machine, AddStorageController(Bstr("SATA").raw(),
+                    CHECK_ERROR(sessionMachine, AddStorageController(Bstr("SATA").raw(),
                                                               StorageBus_SATA,
                                                               ctl.asOutParam()));
                     CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_IntelAhci));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
-                    CHECK_ERROR(machine, RemoveStorageController(Bstr("SATA").raw()));
+                    CHECK_ERROR(sessionMachine, RemoveStorageController(Bstr("SATA").raw()));
                 else
                     return errorArgument("Invalid --usb argument '%s'", ValueUnion.psz);
                 break;
@@ -975,10 +1010,10 @@ int handleModifyVM(HandlerArg *a)
             {
                 if (!RTStrICmp(ValueUnion.psz, "none"))
                 {
-                    rc = machine->DetachDevice(Bstr("LsiLogic").raw(),
+                    rc = sessionMachine->DetachDevice(Bstr("LsiLogic").raw(),
                                                GetOptState.uIndex, 0);
                     if (FAILED(rc))
-                        CHECK_ERROR(machine, DetachDevice(Bstr("BusLogic").raw(),
+                        CHECK_ERROR(sessionMachine, DetachDevice(Bstr("BusLogic").raw(),
                                                           GetOptState.uIndex, 0));
                 }
                 else
@@ -992,12 +1027,12 @@ int handleModifyVM(HandlerArg *a)
                         break;
                     if (hardDisk)
                     {
-                        rc = machine->AttachDevice(Bstr("LsiLogic").raw(),
+                        rc = sessionMachine->AttachDevice(Bstr("LsiLogic").raw(),
                                                    GetOptState.uIndex, 0,
                                                    DeviceType_HardDisk,
                                                    hardDisk);
                         if (FAILED(rc))
-                            CHECK_ERROR(machine,
+                            CHECK_ERROR(sessionMachine,
                                         AttachDevice(Bstr("BusLogic").raw(),
                                                      GetOptState.uIndex, 0,
                                                      DeviceType_HardDisk,
@@ -1015,11 +1050,11 @@ int handleModifyVM(HandlerArg *a)
 
                 if (!RTStrICmp(ValueUnion.psz, "LsiLogic"))
                 {
-                    rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
+                    rc = sessionMachine->RemoveStorageController(Bstr("BusLogic").raw());
                     if (FAILED(rc))
-                        CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
+                        CHECK_ERROR(sessionMachine, RemoveStorageController(Bstr("LsiLogic").raw()));
 
-                    CHECK_ERROR(machine,
+                    CHECK_ERROR(sessionMachine,
                                  AddStorageController(Bstr("LsiLogic").raw(),
                                                       StorageBus_SCSI,
                                                       ctl.asOutParam()));
@@ -1029,11 +1064,11 @@ int handleModifyVM(HandlerArg *a)
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "BusLogic"))
                 {
-                    rc = machine->RemoveStorageController(Bstr("LsiLogic").raw());
+                    rc = sessionMachine->RemoveStorageController(Bstr("LsiLogic").raw());
                     if (FAILED(rc))
-                        CHECK_ERROR(machine, RemoveStorageController(Bstr("BusLogic").raw()));
+                        CHECK_ERROR(sessionMachine, RemoveStorageController(Bstr("BusLogic").raw()));
 
-                    CHECK_ERROR(machine,
+                    CHECK_ERROR(sessionMachine,
                                  AddStorageController(Bstr("BusLogic").raw(),
                                                       StorageBus_SCSI,
                                                       ctl.asOutParam()));
@@ -1052,7 +1087,7 @@ int handleModifyVM(HandlerArg *a)
                 {
                     ComPtr<IStorageController> ctl;
 
-                    CHECK_ERROR(machine, AddStorageController(Bstr("BusLogic").raw(),
+                    CHECK_ERROR(sessionMachine, AddStorageController(Bstr("BusLogic").raw(),
                                                               StorageBus_SCSI,
                                                               ctl.asOutParam()));
                     if (SUCCEEDED(rc))
@@ -1060,16 +1095,16 @@ int handleModifyVM(HandlerArg *a)
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
                 {
-                    rc = machine->RemoveStorageController(Bstr("BusLogic").raw());
+                    rc = sessionMachine->RemoveStorageController(Bstr("BusLogic").raw());
                     if (FAILED(rc))
-                        CHECK_ERROR(machine, RemoveStorageController(Bstr("LsiLogic").raw()));
+                        CHECK_ERROR(sessionMachine, RemoveStorageController(Bstr("LsiLogic").raw()));
                 }
                 break;
             }
 
             case MODIFYVM_DVDPASSTHROUGH: // deprecated
             {
-                CHECK_ERROR(machine, PassthroughDevice(Bstr("IDE Controller").raw(),
+                CHECK_ERROR(sessionMachine, PassthroughDevice(Bstr("IDE Controller").raw(),
                                                        1, 0,
                                                        !RTStrICmp(ValueUnion.psz, "on")));
                 break;
@@ -1085,7 +1120,7 @@ int handleModifyVM(HandlerArg *a)
                     /* nothing to do, NULL object will cause unmount */
                 }
                 /* host drive? */
-                else if (!RTStrNICmp(ValueUnion.psz, "host:", 5))
+                else if (!RTStrNICmp(ValueUnion.psz, RT_STR_TUPLE("host:")))
                 {
                     ComPtr<IHost> host;
                     CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
@@ -1126,7 +1161,7 @@ int handleModifyVM(HandlerArg *a)
                     }
                 }
 
-                CHECK_ERROR(machine, MountMedium(Bstr("IDE Controller").raw(),
+                CHECK_ERROR(sessionMachine, MountMedium(Bstr("IDE Controller").raw(),
                                                  1, 0,
                                                  dvdMedium,
                                                  FALSE /* aForce */));
@@ -1137,7 +1172,7 @@ int handleModifyVM(HandlerArg *a)
             {
                 ComPtr<IMedium> floppyMedium;
                 ComPtr<IMediumAttachment> floppyAttachment;
-                machine->GetMediumAttachment(Bstr("Floppy Controller").raw(),
+                sessionMachine->GetMediumAttachment(Bstr("Floppy Controller").raw(),
                                              0, 0, floppyAttachment.asOutParam());
 
                 /* disable? */
@@ -1145,14 +1180,14 @@ int handleModifyVM(HandlerArg *a)
                 {
                     /* disable the controller */
                     if (floppyAttachment)
-                        CHECK_ERROR(machine, DetachDevice(Bstr("Floppy Controller").raw(),
+                        CHECK_ERROR(sessionMachine, DetachDevice(Bstr("Floppy Controller").raw(),
                                                           0, 0));
                 }
                 else
                 {
                     /* enable the controller */
                     if (!floppyAttachment)
-                        CHECK_ERROR(machine, AttachDeviceWithoutMedium(Bstr("Floppy Controller").raw(),
+                        CHECK_ERROR(sessionMachine, AttachDeviceWithoutMedium(Bstr("Floppy Controller").raw(),
                                                                             0, 0,
                                                                             DeviceType_Floppy));
 
@@ -1163,7 +1198,7 @@ int handleModifyVM(HandlerArg *a)
                         /* nothing to do, NULL object will cause unmount */
                     }
                     /* host drive? */
-                    else if (!RTStrNICmp(ValueUnion.psz, "host:", 5))
+                    else if (!RTStrNICmp(ValueUnion.psz, RT_STR_TUPLE("host:")))
                     {
                         ComPtr<IHost> host;
                         CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
@@ -1190,7 +1225,7 @@ int handleModifyVM(HandlerArg *a)
                             break;
                         }
                     }
-                    CHECK_ERROR(machine, MountMedium(Bstr("Floppy Controller").raw(),
+                    CHECK_ERROR(sessionMachine, MountMedium(Bstr("Floppy Controller").raw(),
                                                      0, 0,
                                                      floppyMedium,
                                                      FALSE /* aForce */));
@@ -1205,7 +1240,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 CHECK_ERROR(nic, COMSETTER(TraceFile)(Bstr(ValueUnion.psz).raw()));
@@ -1218,7 +1253,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 CHECK_ERROR(nic, COMSETTER(TraceEnabled)(ValueUnion.f));
@@ -1231,7 +1266,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 if (nic)
@@ -1270,7 +1305,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 if (!RTStrICmp(ValueUnion.psz, "Am79C970A"))
@@ -1315,7 +1350,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 CHECK_ERROR(nic, COMSETTER(LineSpeed)(ValueUnion.u32));
@@ -1328,7 +1363,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 /* Somewhat arbitrary limitation - we can pass a list of up to 4 PCI devices
@@ -1368,7 +1403,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 CHECK_ERROR(nic, COMSETTER(PromiscModePolicy)(enmPromiscModePolicy));
@@ -1381,7 +1416,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 if (!RTStrICmp(ValueUnion.psz, "none"))
@@ -1394,7 +1429,7 @@ int handleModifyVM(HandlerArg *a)
                     ComPtr<IBandwidthControl> bwCtrl;
                     ComPtr<IBandwidthGroup> bwGroup;
 
-                    CHECK_ERROR(machine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()));
+                    CHECK_ERROR(sessionMachine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam()));
 
                     if (SUCCEEDED(rc))
                     {
@@ -1414,7 +1449,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 if (!RTStrICmp(ValueUnion.psz, "none"))
@@ -1474,7 +1509,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 CHECK_ERROR(nic, COMSETTER(CableConnected)(ValueUnion.f));
@@ -1487,7 +1522,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 /* remove it? */
@@ -1508,7 +1543,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 /* remove it? */
@@ -1529,7 +1564,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 /* remove it? */
@@ -1550,7 +1585,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 CHECK_ERROR(nic, COMSETTER(GenericDriver)(Bstr(ValueUnion.psz).raw()));
@@ -1563,7 +1598,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 CHECK_ERROR(nic, COMSETTER(NATNetwork)(Bstr(ValueUnion.psz).raw()));
@@ -1576,7 +1611,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1596,7 +1631,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1646,7 +1681,7 @@ int handleModifyVM(HandlerArg *a)
                 if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
                     break;
 
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
@@ -1662,7 +1697,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1721,28 +1756,27 @@ int handleModifyVM(HandlerArg *a)
             #undef ITERATE_TO_NEXT_TERM
             case MODIFYVM_NATALIASMODE:
             {
-                if (!parseNum(GetOptState.uIndex, NetworkAdapterCount, "NIC"))
-                    break;
-
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                ComPtr<INATEngine> engine;
+                uint32_t aliasMode = 0;
+
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
-                ComPtr<INATEngine> engine;
                 CHECK_ERROR(nic, COMGETTER(NATEngine)(engine.asOutParam()));
-
-                uint32_t aliasMode = 0;
-                if (!RTStrCmp(ValueUnion.psz, "default") == 0)
+                if (RTStrCmp(ValueUnion.psz, "default") == 0)
+                    aliasMode = 0;
+                else
                 {
                     char *token = (char *)ValueUnion.psz;
-                    while(token)
+                    while (token)
                     {
-                        if (RTStrNCmp(token, "log", 3) == 0)
-                            aliasMode |= 0x1;
-                        else if (RTStrNCmp(token, "proxyonly", 9) == 0)
-                            aliasMode |= 0x2;
-                        else if (RTStrNCmp(token, "sameports", 9) == 0)
-                            aliasMode |= 0x4;
+                        if (RTStrNCmp(token, RT_STR_TUPLE("log")) == 0)
+                            aliasMode |= NATAliasMode_AliasLog;
+                        else if (RTStrNCmp(token, RT_STR_TUPLE("proxyonly")) == 0)
+                            aliasMode |= NATAliasMode_AliasProxyOnly;
+                        else if (RTStrNCmp(token, RT_STR_TUPLE("sameports")) == 0)
+                            aliasMode |= NATAliasMode_AliasUseSamePorts;
                         token = RTStrStr(token, ",");
                         if (token == NULL)
                             break;
@@ -1759,7 +1793,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1775,7 +1809,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1791,7 +1825,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1806,7 +1840,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1822,7 +1856,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1838,7 +1872,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 ComPtr<INATEngine> engine;
@@ -1853,7 +1887,7 @@ int handleModifyVM(HandlerArg *a)
                     break;
 
                 ComPtr<INetworkAdapter> nic;
-                CHECK_ERROR_BREAK(machine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetNetworkAdapter(GetOptState.uIndex - 1, nic.asOutParam()));
                 ASSERT(nic);
 
                 /* generate one? */
@@ -1873,23 +1907,23 @@ int handleModifyVM(HandlerArg *a)
                 bool fEnableUsb = false;
                 if (!RTStrICmp(ValueUnion.psz, "ps2"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_PS2Mouse));
+                    CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_PS2Mouse));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "usb"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_USBMouse));
+                    CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_USBMouse));
                     if (SUCCEEDED(rc))
                         fEnableUsb = true;
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "usbtablet"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_USBTablet));
+                    CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_USBTablet));
                     if (SUCCEEDED(rc))
                         fEnableUsb = true;
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "usbmultitouch"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(PointingHIDType)(PointingHIDType_USBMultiTouch));
+                    CHECK_ERROR(sessionMachine, COMSETTER(PointingHIDType)(PointingHIDType_USBMultiTouch));
                     if (SUCCEEDED(rc))
                         fEnableUsb = true;
                 }
@@ -1902,12 +1936,12 @@ int handleModifyVM(HandlerArg *a)
                 {
                     /* Make sure the OHCI controller is enabled. */
                     ULONG cOhciCtrls = 0;
-                    rc = machine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
+                    rc = sessionMachine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
                     if (   SUCCEEDED(rc)
                         && !cOhciCtrls)
                     {
                         ComPtr<IUSBController> UsbCtl;
-                        CHECK_ERROR(machine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
+                        CHECK_ERROR(sessionMachine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
                                                               UsbCtl.asOutParam()));
                     }
                 }
@@ -1919,11 +1953,11 @@ int handleModifyVM(HandlerArg *a)
                 bool fEnableUsb = false;
                 if (!RTStrICmp(ValueUnion.psz, "ps2"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_PS2Keyboard));
+                    CHECK_ERROR(sessionMachine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_PS2Keyboard));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "usb"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_USBKeyboard));
+                    CHECK_ERROR(sessionMachine, COMSETTER(KeyboardHIDType)(KeyboardHIDType_USBKeyboard));
                     if (SUCCEEDED(rc))
                         fEnableUsb = true;
                 }
@@ -1936,12 +1970,12 @@ int handleModifyVM(HandlerArg *a)
                 {
                     /* Make sure the OHCI controller is enabled. */
                     ULONG cOhciCtrls = 0;
-                    rc = machine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
+                    rc = sessionMachine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
                     if (   SUCCEEDED(rc)
                         && !cOhciCtrls)
                     {
                         ComPtr<IUSBController> UsbCtl;
-                        CHECK_ERROR(machine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
+                        CHECK_ERROR(sessionMachine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
                                                               UsbCtl.asOutParam()));
                     }
                 }
@@ -1953,7 +1987,7 @@ int handleModifyVM(HandlerArg *a)
                 ComPtr<ISerialPort> uart;
                 char *pszIRQ = NULL;
 
-                CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
                 ASSERT(uart);
 
                 if (!RTStrICmp(ValueUnion.psz, "disconnected"))
@@ -1962,6 +1996,8 @@ int handleModifyVM(HandlerArg *a)
                 }
                 else if (   !RTStrICmp(ValueUnion.psz, "server")
                          || !RTStrICmp(ValueUnion.psz, "client")
+                         || !RTStrICmp(ValueUnion.psz, "tcpserver")
+                         || !RTStrICmp(ValueUnion.psz, "tcpclient")
                          || !RTStrICmp(ValueUnion.psz, "file"))
                 {
                     const char *pszMode = ValueUnion.psz;
@@ -1984,6 +2020,16 @@ int handleModifyVM(HandlerArg *a)
                         CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_HostPipe));
                         CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
                     }
+                    else if (!RTStrICmp(pszMode, "tcpserver"))
+                    {
+                        CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_TCP));
+                        CHECK_ERROR(uart, COMSETTER(Server)(TRUE));
+                    }
+                    else if (!RTStrICmp(pszMode, "tcpclient"))
+                    {
+                        CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_TCP));
+                        CHECK_ERROR(uart, COMSETTER(Server)(FALSE));
+                    }
                     else if (!RTStrICmp(pszMode, "file"))
                     {
                         CHECK_ERROR(uart, COMSETTER(HostMode)(PortMode_RawFile));
@@ -2001,7 +2047,7 @@ int handleModifyVM(HandlerArg *a)
             {
                 ComPtr<ISerialPort> uart;
 
-                CHECK_ERROR_BREAK(machine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetSerialPort(GetOptState.uIndex - 1, uart.asOutParam()));
                 ASSERT(uart);
 
                 if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
@@ -2035,7 +2081,7 @@ int handleModifyVM(HandlerArg *a)
                 ComPtr<IParallelPort> lpt;
                 char *pszIRQ = NULL;
 
-                CHECK_ERROR_BREAK(machine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
                 ASSERT(lpt);
 
                 CHECK_ERROR(lpt, COMSETTER(Path)(Bstr(ValueUnion.psz).raw()));
@@ -2046,7 +2092,7 @@ int handleModifyVM(HandlerArg *a)
             {
                 ComPtr<IParallelPort> lpt;
 
-                CHECK_ERROR_BREAK(machine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, GetParallelPort(GetOptState.uIndex - 1, lpt.asOutParam()));
                 ASSERT(lpt);
 
                 if (!RTStrICmp(ValueUnion.psz, "off") || !RTStrICmp(ValueUnion.psz, "disable"))
@@ -2077,14 +2123,14 @@ int handleModifyVM(HandlerArg *a)
 
             case MODIFYVM_GUESTMEMORYBALLOON:
             {
-                CHECK_ERROR(machine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(MemoryBalloonSize)(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_AUDIOCONTROLLER:
             {
                 ComPtr<IAudioAdapter> audioAdapter;
-                machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
+                sessionMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
                 ASSERT(audioAdapter);
 
                 if (!RTStrICmp(ValueUnion.psz, "sb16"))
@@ -2104,7 +2150,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_AUDIO:
             {
                 ComPtr<IAudioAdapter> audioAdapter;
-                machine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
+                sessionMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam());
                 ASSERT(audioAdapter);
 
                 /* disable? */
@@ -2209,22 +2255,22 @@ int handleModifyVM(HandlerArg *a)
                 }
                 if (SUCCEEDED(rc))
                 {
-                    CHECK_ERROR(machine, COMSETTER(ClipboardMode)(mode));
+                    CHECK_ERROR(sessionMachine, COMSETTER(ClipboardMode)(mode));
                 }
                 break;
             }
 
             case MODIFYVM_DRAGANDDROP:
             {
-                DragAndDropMode_T mode;
+                DnDMode_T mode;
                 if (!RTStrICmp(ValueUnion.psz, "disabled"))
-                    mode = DragAndDropMode_Disabled;
+                    mode = DnDMode_Disabled;
                 else if (!RTStrICmp(ValueUnion.psz, "hosttoguest"))
-                    mode = DragAndDropMode_HostToGuest;
+                    mode = DnDMode_HostToGuest;
                 else if (!RTStrICmp(ValueUnion.psz, "guesttohost"))
-                    mode = DragAndDropMode_GuestToHost;
+                    mode = DnDMode_GuestToHost;
                 else if (!RTStrICmp(ValueUnion.psz, "bidirectional"))
-                    mode = DragAndDropMode_Bidirectional;
+                    mode = DnDMode_Bidirectional;
                 else
                 {
                     errorArgument("Invalid --draganddrop argument '%s'", ValueUnion.psz);
@@ -2232,7 +2278,7 @@ int handleModifyVM(HandlerArg *a)
                 }
                 if (SUCCEEDED(rc))
                 {
-                    CHECK_ERROR(machine, COMSETTER(DragAndDropMode)(mode));
+                    CHECK_ERROR(sessionMachine, COMSETTER(DnDMode)(mode));
                 }
                 break;
             }
@@ -2240,7 +2286,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDE_EXTPACK:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 if (vrdeServer)
@@ -2259,7 +2305,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEPROPERTY:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 if (vrdeServer)
@@ -2302,7 +2348,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEPORT:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 if (!RTStrICmp(ValueUnion.psz, "default"))
@@ -2318,7 +2364,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEADDRESS:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("TCP/Address").raw(), Bstr(ValueUnion.psz).raw()));
@@ -2330,7 +2376,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEAUTHTYPE:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 if (!RTStrICmp(ValueUnion.psz, "null"))
@@ -2356,7 +2402,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEAUTHLIBRARY:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 if (vrdeServer)
@@ -2377,7 +2423,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEMULTICON:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 CHECK_ERROR(vrdeServer, COMSETTER(AllowMultiConnection)(ValueUnion.f));
@@ -2389,7 +2435,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEREUSECON:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 CHECK_ERROR(vrdeServer, COMSETTER(ReuseSingleConnection)(ValueUnion.f));
@@ -2401,7 +2447,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEVIDEOCHANNEL:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Enabled").raw(),
@@ -2414,7 +2460,7 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDEVIDEOCHANNELQUALITY:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 CHECK_ERROR(vrdeServer, SetVRDEProperty(Bstr("VideoChannel/Quality").raw(),
@@ -2427,27 +2473,45 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_VRDE:
             {
                 ComPtr<IVRDEServer> vrdeServer;
-                machine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
+                sessionMachine->COMGETTER(VRDEServer)(vrdeServer.asOutParam());
                 ASSERT(vrdeServer);
 
                 CHECK_ERROR(vrdeServer, COMSETTER(Enabled)(ValueUnion.f));
                 break;
             }
 
+            case MODIFYVM_USBXHCI:
+            {
+                ULONG cXhciCtrls = 0;
+                rc = sessionMachine->GetUSBControllerCountByType(USBControllerType_XHCI, &cXhciCtrls);
+                if (SUCCEEDED(rc))
+                {
+                    if (!cXhciCtrls && ValueUnion.f)
+                    {
+                        ComPtr<IUSBController> UsbCtl;
+                        CHECK_ERROR(sessionMachine, AddUSBController(Bstr("XHCI").raw(), USBControllerType_XHCI,
+                                                              UsbCtl.asOutParam()));
+                    }
+                    else if (cXhciCtrls && !ValueUnion.f)
+                        CHECK_ERROR(sessionMachine, RemoveUSBController(Bstr("XHCI").raw()));
+                }
+                break;
+            }
+
             case MODIFYVM_USBEHCI:
             {
                 ULONG cEhciCtrls = 0;
-                rc = machine->GetUSBControllerCountByType(USBControllerType_EHCI, &cEhciCtrls);
+                rc = sessionMachine->GetUSBControllerCountByType(USBControllerType_EHCI, &cEhciCtrls);
                 if (SUCCEEDED(rc))
                 {
                     if (!cEhciCtrls && ValueUnion.f)
                     {
                         ComPtr<IUSBController> UsbCtl;
-                        CHECK_ERROR(machine, AddUSBController(Bstr("EHCI").raw(), USBControllerType_EHCI,
+                        CHECK_ERROR(sessionMachine, AddUSBController(Bstr("EHCI").raw(), USBControllerType_EHCI,
                                                               UsbCtl.asOutParam()));
                     }
                     else if (cEhciCtrls && !ValueUnion.f)
-                        CHECK_ERROR(machine, RemoveUSBController(Bstr("EHCI").raw()));
+                        CHECK_ERROR(sessionMachine, RemoveUSBController(Bstr("EHCI").raw()));
                 }
                 break;
             }
@@ -2455,17 +2519,17 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_USB:
             {
                 ULONG cOhciCtrls = 0;
-                rc = machine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
+                rc = sessionMachine->GetUSBControllerCountByType(USBControllerType_OHCI, &cOhciCtrls);
                 if (SUCCEEDED(rc))
                 {
                     if (!cOhciCtrls && ValueUnion.f)
                     {
                         ComPtr<IUSBController> UsbCtl;
-                        CHECK_ERROR(machine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
+                        CHECK_ERROR(sessionMachine, AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI,
                                                               UsbCtl.asOutParam()));
                     }
                     else if (cOhciCtrls && !ValueUnion.f)
-                        CHECK_ERROR(machine, RemoveUSBController(Bstr("OHCI").raw()));
+                        CHECK_ERROR(sessionMachine, RemoveUSBController(Bstr("OHCI").raw()));
                 }
                 break;
             }
@@ -2473,33 +2537,33 @@ int handleModifyVM(HandlerArg *a)
             case MODIFYVM_SNAPSHOTFOLDER:
             {
                 if (!RTStrICmp(ValueUnion.psz, "default"))
-                    CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr().raw()));
+                    CHECK_ERROR(sessionMachine, COMSETTER(SnapshotFolder)(Bstr().raw()));
                 else
-                    CHECK_ERROR(machine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz).raw()));
+                    CHECK_ERROR(sessionMachine, COMSETTER(SnapshotFolder)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
 
             case MODIFYVM_TELEPORTER_ENABLED:
             {
-                CHECK_ERROR(machine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(TeleporterEnabled)(ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_TELEPORTER_PORT:
             {
-                CHECK_ERROR(machine, COMSETTER(TeleporterPort)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(TeleporterPort)(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_TELEPORTER_ADDRESS:
             {
-                CHECK_ERROR(machine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz).raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(TeleporterAddress)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
 
             case MODIFYVM_TELEPORTER_PASSWORD:
             {
-                CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz).raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(TeleporterPassword)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
 
@@ -2510,25 +2574,25 @@ int handleModifyVM(HandlerArg *a)
                 if (rcExit != RTEXITCODE_SUCCESS)
                     rc = E_FAIL;
                 else
-                    CHECK_ERROR(machine, COMSETTER(TeleporterPassword)(Bstr(password).raw()));
+                    CHECK_ERROR(sessionMachine, COMSETTER(TeleporterPassword)(Bstr(password).raw()));
                 break;
             }
 
             case MODIFYVM_TRACING_ENABLED:
             {
-                CHECK_ERROR(machine, COMSETTER(TracingEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(TracingEnabled)(ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_TRACING_CONFIG:
             {
-                CHECK_ERROR(machine, COMSETTER(TracingConfig)(Bstr(ValueUnion.psz).raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(TracingConfig)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
 
             case MODIFYVM_TRACING_ALLOW_VM_ACCESS:
             {
-                CHECK_ERROR(machine, COMSETTER(AllowTracingToAccessVM)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(AllowTracingToAccessVM)(ValueUnion.f));
                 break;
             }
 
@@ -2536,12 +2600,12 @@ int handleModifyVM(HandlerArg *a)
             {
                 if (!RTStrICmp(ValueUnion.psz, "master"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Master)));
+                    CHECK_ERROR(sessionMachine, COMSETTER(FaultToleranceState(FaultToleranceState_Master)));
                 }
                 else
                 if (!RTStrICmp(ValueUnion.psz, "standby"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(FaultToleranceState(FaultToleranceState_Standby)));
+                    CHECK_ERROR(sessionMachine, COMSETTER(FaultToleranceState(FaultToleranceState_Standby)));
                 }
                 else
                 {
@@ -2553,49 +2617,49 @@ int handleModifyVM(HandlerArg *a)
 
             case MODIFYVM_FAULT_TOLERANCE_ADDRESS:
             {
-                CHECK_ERROR(machine, COMSETTER(FaultToleranceAddress)(Bstr(ValueUnion.psz).raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(FaultToleranceAddress)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
 
             case MODIFYVM_FAULT_TOLERANCE_PORT:
             {
-                CHECK_ERROR(machine, COMSETTER(FaultTolerancePort)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(FaultTolerancePort)(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_FAULT_TOLERANCE_PASSWORD:
             {
-                CHECK_ERROR(machine, COMSETTER(FaultTolerancePassword)(Bstr(ValueUnion.psz).raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(FaultTolerancePassword)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
 
             case MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL:
             {
-                CHECK_ERROR(machine, COMSETTER(FaultToleranceSyncInterval)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(FaultToleranceSyncInterval)(ValueUnion.u32));
                 break;
             }
 
             case MODIFYVM_HARDWARE_UUID:
             {
-                CHECK_ERROR(machine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz).raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(HardwareUUID)(Bstr(ValueUnion.psz).raw()));
                 break;
             }
 
             case MODIFYVM_HPET:
             {
-                CHECK_ERROR(machine, COMSETTER(HPETEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(HPETEnabled)(ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_IOCACHE:
             {
-                CHECK_ERROR(machine, COMSETTER(IOCacheEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(IOCacheEnabled)(ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_IOCACHESIZE:
             {
-                CHECK_ERROR(machine, COMSETTER(IOCacheSize)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(IOCacheSize)(ValueUnion.u32));
                 break;
             }
 
@@ -2603,11 +2667,11 @@ int handleModifyVM(HandlerArg *a)
             {
                 if (!RTStrICmp(ValueUnion.psz, "piix3"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_PIIX3));
+                    CHECK_ERROR(sessionMachine, COMSETTER(ChipsetType)(ChipsetType_PIIX3));
                 }
                 else if (!RTStrICmp(ValueUnion.psz, "ich9"))
                 {
-                    CHECK_ERROR(machine, COMSETTER(ChipsetType)(ChipsetType_ICH9));
+                    CHECK_ERROR(sessionMachine, COMSETTER(ChipsetType)(ChipsetType_ICH9));
                     BOOL fIoApic = FALSE;
                     CHECK_ERROR(biosSettings, COMGETTER(IOAPICEnabled)(&fIoApic));
                     if (!fIoApic)
@@ -2626,13 +2690,13 @@ int handleModifyVM(HandlerArg *a)
 #ifdef VBOX_WITH_VPX
             case MODIFYVM_VCP:
             {
-                CHECK_ERROR(machine, COMSETTER(VideoCaptureEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureEnabled)(ValueUnion.f));
                 break;
             }
             case MODIFYVM_VCP_SCREENS:
             {
                 ULONG cMonitors = 64;
-                CHECK_ERROR(machine, COMGETTER(MonitorCount)(&cMonitors));
+                CHECK_ERROR(sessionMachine, COMGETTER(MonitorCount)(&cMonitors));
                 com::SafeArray<BOOL> screens(cMonitors);
                 if (parseScreens(ValueUnion.psz, &screens))
                 {
@@ -2640,7 +2704,7 @@ int handleModifyVM(HandlerArg *a)
                     rc = E_FAIL;
                     break;
                 }
-                CHECK_ERROR(machine, COMSETTER(VideoCaptureScreens)(ComSafeArrayAsInParam(screens)));
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureScreens)(ComSafeArrayAsInParam(screens)));
                 break;
             }
             case MODIFYVM_VCP_FILENAME:
@@ -2659,39 +2723,55 @@ int handleModifyVM(HandlerArg *a)
                     }
                     bstr = szVCFileAbs;
                 }
-                CHECK_ERROR(machine, COMSETTER(VideoCaptureFile)(bstr.raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureFile)(bstr.raw()));
                 break;
             }
             case MODIFYVM_VCP_WIDTH:
             {
-                CHECK_ERROR(machine, COMSETTER(VideoCaptureWidth)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureWidth)(ValueUnion.u32));
                 break;
             }
             case MODIFYVM_VCP_HEIGHT:
             {
-                CHECK_ERROR(machine, COMSETTER(VideoCaptureHeight)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureHeight)(ValueUnion.u32));
                 break;
             }
             case MODIFYVM_VCP_RATE:
             {
-                CHECK_ERROR(machine, COMSETTER(VideoCaptureRate)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureRate)(ValueUnion.u32));
                 break;
             }
             case MODIFYVM_VCP_FPS:
             {
-                CHECK_ERROR(machine, COMSETTER(VideoCaptureFPS)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureFPS)(ValueUnion.u32));
+                break;
+            }
+            case MODIFYVM_VCP_MAXTIME:
+            {
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureMaxTime)(ValueUnion.u32));
+                break;
+            }
+            case MODIFYVM_VCP_MAXSIZE:
+            {
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureMaxFileSize)(ValueUnion.u32));
+                break;
+            }
+            case MODIFYVM_VCP_OPTIONS:
+            {
+                Bstr bstr(ValueUnion.psz);
+                CHECK_ERROR(sessionMachine, COMSETTER(VideoCaptureOptions)(bstr.raw()));
                 break;
             }
 #endif
             case MODIFYVM_AUTOSTART_ENABLED:
             {
-                CHECK_ERROR(machine, COMSETTER(AutostartEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(AutostartEnabled)(ValueUnion.f));
                 break;
             }
 
             case MODIFYVM_AUTOSTART_DELAY:
             {
-                CHECK_ERROR(machine, COMSETTER(AutostartDelay)(ValueUnion.u32));
+                CHECK_ERROR(sessionMachine, COMSETTER(AutostartDelay)(ValueUnion.u32));
                 break;
             }
 
@@ -2714,7 +2794,7 @@ int handleModifyVM(HandlerArg *a)
                 }
 
                 if (SUCCEEDED(rc))
-                    CHECK_ERROR(machine, COMSETTER(AutostopType)(enmAutostopType));
+                    CHECK_ERROR(sessionMachine, COMSETTER(AutostopType)(enmAutostopType));
                 break;
             }
 #ifdef VBOX_WITH_PCI_PASSTHROUGH
@@ -2733,7 +2813,7 @@ int handleModifyVM(HandlerArg *a)
                 }
                 else
                 {
-                    CHECK_ERROR(machine, AttachHostPCIDevice(iHostAddr, iGuestAddr, TRUE));
+                    CHECK_ERROR(sessionMachine, AttachHostPCIDevice(iHostAddr, iGuestAddr, TRUE));
                 }
 
                 break;
@@ -2750,7 +2830,7 @@ int handleModifyVM(HandlerArg *a)
                 }
                 else
                 {
-                    CHECK_ERROR(machine, DetachHostPCIDevice(iHostAddr));
+                    CHECK_ERROR(sessionMachine, DetachHostPCIDevice(iHostAddr));
                 }
 
                 break;
@@ -2760,7 +2840,7 @@ int handleModifyVM(HandlerArg *a)
 #ifdef VBOX_WITH_USB_CARDREADER
             case MODIFYVM_USBCARDREADER:
             {
-                CHECK_ERROR(machine, COMSETTER(EmulatedUSBCardReaderEnabled)(ValueUnion.f));
+                CHECK_ERROR(sessionMachine, COMSETTER(EmulatedUSBCardReaderEnabled)(ValueUnion.f));
                 break;
             }
 #endif /* VBOX_WITH_USB_CARDREADER */
@@ -2770,7 +2850,7 @@ int handleModifyVM(HandlerArg *a)
                 Bstr bstr(ValueUnion.psz);
                 if (bstr == "default")
                     bstr = Bstr::Empty;
-                CHECK_ERROR(machine, COMSETTER(DefaultFrontend)(bstr.raw()));
+                CHECK_ERROR(sessionMachine, COMSETTER(DefaultFrontend)(bstr.raw()));
                 break;
             }
 
@@ -2785,7 +2865,7 @@ int handleModifyVM(HandlerArg *a)
 
     /* commit changes */
     if (SUCCEEDED(rc))
-        CHECK_ERROR(machine, SaveSettings());
+        CHECK_ERROR(sessionMachine, SaveSettings());
 
     /* it's important to always close sessions */
     a->session->UnlockMachine();
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageNATNetwork.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageNATNetwork.cpp
index ef4f916..17ef137 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageNATNetwork.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageNATNetwork.cpp
@@ -396,11 +396,11 @@ static int handleOp(HandlerArg *a, OPCODE enmCode, int iStart, int *pcProcessed)
                      ++it)
                 {
                     std::string address, strOffset;
-                    int pos = it->find('=');
+                    size_t pos = it->find('=');
                     LONG lOffset = 0;
                     Bstr bstrAddress;
 
-                    AssertReturn(pos != -1, errorArgument("invalid loopback string"));
+                    AssertReturn(pos != std::string::npos, errorArgument("invalid loopback string"));
 
                     address = it->substr(0, pos);
                     strOffset = it->substr(pos + 1);
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
index 1ac7ddd..aed3be3 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageSnapshot.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -161,9 +161,9 @@ void DumpMediumWithChildren(ComPtr<IMedium> &pCurrentStateMedium,
  * Handles the 'snapshot myvm list' sub-command.
  * @returns Exit code.
  * @param   pArgs           The handler argument package.
- * @param   rptrMachine     Reference to the VM (locked) we're operating on.
+ * @param   pMachine        Reference to the VM (locked) we're operating on.
  */
-static RTEXITCODE handleSnapshotList(HandlerArg *pArgs, ComPtr<IMachine> &rptrMachine)
+static RTEXITCODE handleSnapshotList(HandlerArg *pArgs, ComPtr<IMachine> &pMachine)
 {
     static const RTGETOPTDEF g_aOptions[] =
     {
@@ -187,19 +187,18 @@ static RTEXITCODE handleSnapshotList(HandlerArg *pArgs, ComPtr<IMachine> &rptrMa
         }
     }
 
-    /* See showVMInfo. */
-    ComPtr<ISnapshot> ptrSnapshot;
-    HRESULT hrc = rptrMachine->FindSnapshot(Bstr().raw(), ptrSnapshot.asOutParam());
+    ComPtr<ISnapshot> pSnapshot;
+    HRESULT hrc = pMachine->FindSnapshot(Bstr().raw(), pSnapshot.asOutParam());
     if (FAILED(hrc))
     {
         RTPrintf("This machine does not have any snapshots\n");
         return RTEXITCODE_FAILURE;
     }
-    if (ptrSnapshot)
+    if (pSnapshot)
     {
-        ComPtr<ISnapshot> ptrCurrentSnapshot;
-        CHECK_ERROR2_RET(rptrMachine,COMGETTER(CurrentSnapshot)(ptrCurrentSnapshot.asOutParam()), RTEXITCODE_FAILURE);
-        hrc = showSnapshots(ptrSnapshot, ptrCurrentSnapshot, enmDetails);
+        ComPtr<ISnapshot> pCurrentSnapshot;
+        CHECK_ERROR2_RET(pMachine, COMGETTER(CurrentSnapshot)(pCurrentSnapshot.asOutParam()), RTEXITCODE_FAILURE);
+        hrc = showSnapshots(pSnapshot, pCurrentSnapshot, enmDetails);
         if (FAILED(hrc))
             return RTEXITCODE_FAILURE;
     }
@@ -275,18 +274,19 @@ int handleSnapshot(HandlerArg *a)
 
     /* the first argument must be the VM */
     Bstr bstrMachine(a->argv[0]);
-    ComPtr<IMachine> ptrMachine;
+    ComPtr<IMachine> pMachine;
     CHECK_ERROR(a->virtualBox, FindMachine(bstrMachine.raw(),
-                                           ptrMachine.asOutParam()));
-    if (!ptrMachine)
+                                           pMachine.asOutParam()));
+    if (!pMachine)
         return 1;
 
+    /* we have to open a session for this task (new or shared) */
+    CHECK_ERROR_RET(pMachine, LockMachine(a->session, LockType_Shared), 1);
     do
     {
-        /* we have to open a session for this task (new or shared) */
-        rc = ptrMachine->LockMachine(a->session, LockType_Shared);
-        ComPtr<IConsole> console;
-        CHECK_ERROR_BREAK(a->session, COMGETTER(Console)(console.asOutParam()));
+        /* replace the (read-only) IMachine object by a writable one */
+        ComPtr<IMachine> sessionMachine;
+        CHECK_ERROR_BREAK(a->session, COMGETTER(Machine)(sessionMachine.asOutParam()));
 
         /* switch based on the command */
         bool fDelete = false,
@@ -346,35 +346,13 @@ int handleSnapshot(HandlerArg *a)
             if (FAILED(rc))
                 break;
 
-            if (fPause)
-            {
-                MachineState_T machineState;
-                CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState));
-                if (machineState == MachineState_Running)
-                    CHECK_ERROR_BREAK(console, Pause());
-                else
-                    fPause = false;
-            }
-
             ComPtr<IProgress> progress;
-            CHECK_ERROR_BREAK(console, TakeSnapshot(name.raw(), desc.raw(),
-                                                    progress.asOutParam()));
+            CHECK_ERROR_BREAK(sessionMachine, TakeSnapshot(name.raw(), desc.raw(),
+                                                           fPause,
+                                                           progress.asOutParam()));
 
             rc = showProgress(progress);
             CHECK_PROGRESS_ERROR(progress, ("Failed to take snapshot"));
-
-            if (fPause)
-            {
-                MachineState_T machineState;
-                CHECK_ERROR_BREAK(console, COMGETTER(State)(&machineState));
-                if (machineState == MachineState_Paused)
-                {
-                    if (SUCCEEDED(rc))
-                        CHECK_ERROR_BREAK(console, Resume());
-                    else
-                        console->Resume();
-                }
-            }
         }
         else if (    (fDelete = !strcmp(a->argv[1], "delete"))
                   || (fRestore = !strcmp(a->argv[1], "restore"))
@@ -404,12 +382,12 @@ int handleSnapshot(HandlerArg *a)
 
             if (fRestoreCurrent)
             {
-                CHECK_ERROR_BREAK(ptrMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam()));
             }
             else
             {
                 // restore or delete snapshot: then resolve cmd line argument to snapshot instance
-                CHECK_ERROR_BREAK(ptrMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
+                CHECK_ERROR_BREAK(sessionMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
                                                          pSnapshot.asOutParam()));
             }
 
@@ -417,14 +395,14 @@ int handleSnapshot(HandlerArg *a)
 
             if (fDelete)
             {
-                CHECK_ERROR_BREAK(console, DeleteSnapshot(bstrSnapGuid.raw(),
-                                                          pProgress.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, DeleteSnapshot(bstrSnapGuid.raw(),
+                                                           pProgress.asOutParam()));
             }
             else
             {
                 // restore or restore current
                 RTPrintf("Restoring snapshot %ls\n", bstrSnapGuid.raw());
-                CHECK_ERROR_BREAK(console, RestoreSnapshot(pSnapshot, pProgress.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, RestoreSnapshot(pSnapshot, pProgress.asOutParam()));
             }
 
             rc = showProgress(pProgress);
@@ -439,17 +417,17 @@ int handleSnapshot(HandlerArg *a)
                 break;
             }
 
-            ComPtr<ISnapshot> snapshot;
+            ComPtr<ISnapshot> pSnapshot;
 
             if (   !strcmp(a->argv[2], "--current")
                 || !strcmp(a->argv[2], "-current"))
             {
-                CHECK_ERROR_BREAK(ptrMachine, COMGETTER(CurrentSnapshot)(snapshot.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam()));
             }
             else
             {
-                CHECK_ERROR_BREAK(ptrMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
-                                                           snapshot.asOutParam()));
+                CHECK_ERROR_BREAK(sessionMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
+                                                         pSnapshot.asOutParam()));
             }
 
             /* parse options */
@@ -466,7 +444,7 @@ int handleSnapshot(HandlerArg *a)
                         break;
                     }
                     i++;
-                    snapshot->COMSETTER(Name)(Bstr(a->argv[i]).raw());
+                    pSnapshot->COMSETTER(Name)(Bstr(a->argv[i]).raw());
                 }
                 else if (   !strcmp(a->argv[i], "--description")
                          || !strcmp(a->argv[i], "-description")
@@ -479,7 +457,7 @@ int handleSnapshot(HandlerArg *a)
                         break;
                     }
                     i++;
-                    snapshot->COMSETTER(Description)(Bstr(a->argv[i]).raw());
+                    pSnapshot->COMSETTER(Description)(Bstr(a->argv[i]).raw());
                 }
                 else
                 {
@@ -500,20 +478,20 @@ int handleSnapshot(HandlerArg *a)
                 break;
             }
 
-            ComPtr<ISnapshot> snapshot;
+            ComPtr<ISnapshot> pSnapshot;
 
-            CHECK_ERROR_BREAK(ptrMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
-                                                       snapshot.asOutParam()));
+            CHECK_ERROR_BREAK(sessionMachine, FindSnapshot(Bstr(a->argv[2]).raw(),
+                                                           pSnapshot.asOutParam()));
 
             /* get the machine of the given snapshot */
-            ComPtr<IMachine> ptrMachine2;
-            snapshot->COMGETTER(Machine)(ptrMachine2.asOutParam());
-            showVMInfo(a->virtualBox, ptrMachine2, VMINFO_NONE, console);
+            ComPtr<IMachine> pMachine2;
+            pSnapshot->COMGETTER(Machine)(pMachine2.asOutParam());
+            showVMInfo(a->virtualBox, pMachine2, NULL, VMINFO_NONE);
         }
         else if (!strcmp(a->argv[1], "list"))
-            rc = handleSnapshotList(a, ptrMachine) == RTEXITCODE_SUCCESS ? S_OK : E_FAIL;
+            rc = handleSnapshotList(a, sessionMachine) == RTEXITCODE_SUCCESS ? S_OK : E_FAIL;
         else if (!strcmp(a->argv[1], "dump"))          // undocumented parameter to debug snapshot info
-            DumpSnapshot(ptrMachine);
+            DumpSnapshot(sessionMachine);
         else
         {
             errorSyntax(USAGE_SNAPSHOT, "Invalid parameter '%s'", Utf8Str(a->argv[1]).c_str());
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
index 2de0bef..f285191 100644
--- a/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
+++ b/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -54,6 +54,7 @@ static const RTGETOPTDEF g_aStorageAttachOptions[] =
     { "--tempeject",        'e', RTGETOPT_REQ_STRING },
     { "--nonrotational",    'n', RTGETOPT_REQ_STRING },
     { "--discard",          'u', RTGETOPT_REQ_STRING },
+    { "--hotpluggable",     'o', RTGETOPT_REQ_STRING },
     { "--bandwidthgroup",   'b', RTGETOPT_REQ_STRING },
     { "--forceunmount",     'f', RTGETOPT_REQ_NOTHING },
     { "--comment",          'C', RTGETOPT_REQ_STRING },
@@ -81,7 +82,7 @@ int handleStorageAttach(HandlerArg *a)
     bool fSetMediumType = false;
     bool fSetNewUuid = false;
     bool fSetNewParentUuid = false;
-    MediumType_T mediumType = MediumType_Normal;
+    MediumType_T enmMediumType = MediumType_Normal;
     Bstr bstrComment;
     const char *pszCtl  = NULL;
     DeviceType_T devTypeRequested = DeviceType_Null;
@@ -90,6 +91,7 @@ int handleStorageAttach(HandlerArg *a)
     const char *pszTempEject = NULL;
     const char *pszNonRotational = NULL;
     const char *pszDiscard = NULL;
+    const char *pszHotPluggable = NULL;
     const char *pszBandwidthGroup = NULL;
     Bstr bstrNewUuid;
     Bstr bstrNewParentUuid;
@@ -203,6 +205,15 @@ int handleStorageAttach(HandlerArg *a)
                 break;
             }
 
+            case 'o':   // hotpluggable <on|off>
+            {
+                if (ValueUnion.psz)
+                    pszHotPluggable = ValueUnion.psz;
+                else
+                    rc = E_FAIL;
+                break;
+            }
+
             case 'b':   // bandwidthgroup <name>
             {
                 if (ValueUnion.psz)
@@ -279,9 +290,9 @@ int handleStorageAttach(HandlerArg *a)
 
             case 'M':   // --type
             {
-                int vrc = parseDiskType(ValueUnion.psz, &mediumType);
+                int vrc = parseMediumType(ValueUnion.psz, &enmMediumType);
                 if (RT_FAILURE(vrc))
-                    return errorArgument("Invalid hard disk type '%s'", ValueUnion.psz);
+                    return errorArgument("Invalid medium type '%s'", ValueUnion.psz);
                 fSetMediumType = true;
                 break;
             }
@@ -540,7 +551,7 @@ int handleStorageAttach(HandlerArg *a)
 
             // find the medium given
             /* host drive? */
-            if (!RTStrNICmp(pszMedium, "host:", 5))
+            if (!RTStrNICmp(pszMedium, RT_STR_TUPLE("host:")))
             {
                 ComPtr<IHost> host;
                 CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
@@ -589,9 +600,11 @@ int handleStorageAttach(HandlerArg *a)
                 else
                     bstrISCSIMedium = BstrFmt("%ls|%ls|%ls", bstrServer.raw(), bstrTarget.raw(), bstrLun.raw());
 
-                CHECK_ERROR(a->virtualBox, CreateHardDisk(Bstr("iSCSI").raw(),
-                                                          bstrISCSIMedium.raw(),
-                                                          pMedium2Mount.asOutParam()));
+                CHECK_ERROR(a->virtualBox, CreateMedium(Bstr("iSCSI").raw(),
+                                                        bstrISCSIMedium.raw(),
+                                                        AccessMode_ReadWrite,
+                                                        DeviceType_HardDisk,
+                                                        pMedium2Mount.asOutParam()));
                 if (FAILED(rc)) goto leave;
                 if (!bstrPort.isEmpty())
                     bstrServer = BstrFmt("%ls:%ls", bstrServer.raw(), bstrPort.raw());
@@ -675,7 +688,7 @@ int handleStorageAttach(HandlerArg *a)
             // set medium type, if so desired
             if (pMedium2Mount && fSetMediumType)
             {
-                CHECK_ERROR(pMedium2Mount, COMSETTER(Type)(mediumType));
+                CHECK_ERROR(pMedium2Mount, COMSETTER(Type)(enmMediumType));
                 if (FAILED(rc))
                     throw  Utf8Str("Failed to set the medium type");
             }
@@ -852,6 +865,31 @@ int handleStorageAttach(HandlerArg *a)
                 throw Utf8StrFmt("Couldn't find the controller attachment for the controller '%s'\n", pszCtl);
         }
 
+        if (   pszHotPluggable
+            && (SUCCEEDED(rc)))
+        {
+            ComPtr<IMediumAttachment> mattach;
+            CHECK_ERROR(machine, GetMediumAttachment(Bstr(pszCtl).raw(), port,
+                                                     device, mattach.asOutParam()));
+
+            if (SUCCEEDED(rc))
+            {
+                if (!RTStrICmp(pszHotPluggable, "on"))
+                {
+                    CHECK_ERROR(machine, SetHotPluggableForDevice(Bstr(pszCtl).raw(),
+                                                                  port, device, TRUE));
+                }
+                else if (!RTStrICmp(pszHotPluggable, "off"))
+                {
+                    CHECK_ERROR(machine, SetHotPluggableForDevice(Bstr(pszCtl).raw(),
+                                                                  port, device, FALSE));
+                }
+                else
+                    throw Utf8StrFmt("Invalid --hotpluggable argument '%s'", pszHotPluggable);
+            }
+            else
+                throw Utf8StrFmt("Couldn't find the controller attachment for the controller '%s'\n", pszCtl);
+        }
 
         if (   pszBandwidthGroup
             && !fRunTime
@@ -1061,6 +1099,12 @@ int handleStorageController(HandlerArg *a)
                                                           StorageBus_SAS,
                                                           ctl.asOutParam()));
             }
+            else if (!RTStrICmp(pszBusType, "usb"))
+            {
+                CHECK_ERROR(machine, AddStorageController(Bstr(pszCtl).raw(),
+                                                          StorageBus_USB,
+                                                          ctl.asOutParam()));
+            }
             else
             {
                 errorArgument("Invalid --add argument '%s'", pszBusType);
@@ -1110,6 +1154,10 @@ int handleStorageController(HandlerArg *a)
                 {
                     CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_LsiLogicSas));
                 }
+                else if (!RTStrICmp(pszCtlType, "usb"))
+                {
+                    CHECK_ERROR(ctl, COMSETTER(ControllerType)(StorageControllerType_USB));
+                }
                 else
                 {
                     errorArgument("Invalid --type argument '%s'", pszCtlType);
diff --git a/src/VBox/Frontends/VBoxSDL/Framebuffer-darwin.m b/src/VBox/Frontends/VBoxSDL/Framebuffer-darwin.m
new file mode 100644
index 0000000..283b6c6
--- /dev/null
+++ b/src/VBox/Frontends/VBoxSDL/Framebuffer-darwin.m
@@ -0,0 +1,24 @@
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define NO_SDL_H
+#import "VBoxSDL.h"
+#import <Cocoa/Cocoa.h>
+
+void *VBoxSDLGetDarwinWindowId(void)
+{
+    NSView            *pView = nil;
+    NSAutoreleasePool *pPool = [[NSAutoreleasePool alloc] init];
+    {
+        NSApplication *pApp = NSApp;
+        NSWindow *pMainWnd;
+        pMainWnd = [pApp mainWindow];
+        if (!pMainWnd)
+            pMainWnd = pApp->_mainWindow; /* UGLY!! but mApp->_AppFlags._active = 0, so mainWindow() fails. */
+        pView = [pMainWnd contentView]; 
+    }
+    [pPool release];
+    return pView;
+}
+
diff --git a/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp b/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
index 00b80ab..d0a6ee7 100644
--- a/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
+++ b/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
@@ -1,3 +1,4 @@
+/* $Id: Framebuffer.cpp $ */
 /** @file
  *
  * VBox frontends: VBoxSDL (simple frontend based on SDL):
@@ -17,6 +18,7 @@
  */
 
 #include <VBox/com/com.h>
+#include <VBox/com/array.h>
 #include <VBox/com/string.h>
 #include <VBox/com/Guid.h>
 #include <VBox/com/ErrorInfo.h>
@@ -73,6 +75,20 @@ static RTNATIVETHREAD gSdlNativeThread = NIL_RTNATIVETHREAD; /**< the SDL thread
 // Constructor / destructor
 //
 
+VBoxSDLFB::VBoxSDLFB()
+{
+}
+
+HRESULT VBoxSDLFB::FinalConstruct()
+{
+    return 0;
+}
+
+void VBoxSDLFB::FinalRelease()
+{
+    return;
+}
+
 /**
  * SDL framebuffer constructor. It is called from the main
  * (i.e. SDL) thread. Therefore it is safe to use SDL calls
@@ -85,19 +101,17 @@ static RTNATIVETHREAD gSdlNativeThread = NIL_RTNATIVETHREAD; /**< the SDL thread
  * @param iFixedWidth    fixed SDL width (-1 means not set)
  * @param iFixedHeight   fixed SDL height (-1 means not set)
  */
-VBoxSDLFB::VBoxSDLFB(uint32_t uScreenId,
+HRESULT VBoxSDLFB::init(uint32_t uScreenId,
                      bool fFullscreen, bool fResizable, bool fShowSDLConfig,
                      bool fKeepHostRes, uint32_t u32FixedWidth,
-                     uint32_t u32FixedHeight, uint32_t u32FixedBPP)
+                     uint32_t u32FixedHeight, uint32_t u32FixedBPP,
+                     bool fUpdateImage)
 {
     int rc;
     LogFlow(("VBoxSDLFB::VBoxSDLFB\n"));
 
-#if defined (RT_OS_WINDOWS)
-    refcnt = 0;
-#endif
-
     mScreenId       = uScreenId;
+    mfUpdateImage   = fUpdateImage;
     mScreen         = NULL;
 #ifdef VBOX_WITH_SDL13
     mWindow         = 0;
@@ -118,8 +132,6 @@ VBoxSDLFB::VBoxSDLFB(uint32_t uScreenId,
     /* Start with standard screen dimensions. */
     mGuestXRes      = 640;
     mGuestYRes      = 480;
-    mPixelFormat    = FramebufferPixelFormat_Opaque;
-    mUsesGuestVRAM  = FALSE;
     mPtrVRAM        = NULL;
     mBitsPerPixel   = 0;
     mBytesPerLine   = 0;
@@ -130,12 +142,21 @@ VBoxSDLFB::VBoxSDLFB(uint32_t uScreenId,
     mLabelOffs      = 0;
 #endif
 
+    mfUpdates = false;
+
     rc = RTCritSectInit(&mUpdateLock);
     AssertMsg(rc == VINF_SUCCESS, ("Error from RTCritSectInit!\n"));
 
     resizeGuest();
     Assert(mScreen);
     mfInitialized = true;
+#ifdef RT_OS_WINDOWS
+    HRESULT hr = CoCreateFreeThreadedMarshaler(this, //GetControllingUnknown(),
+                                             &m_pUnkMarshaler.p);
+    Log(("CoCreateFreeThreadedMarshaler hr %08X\n", hr));
+#endif
+
+    return 0;
 }
 
 VBoxSDLFB::~VBoxSDLFB()
@@ -283,54 +304,6 @@ STDMETHODIMP VBoxSDLFB::COMGETTER(Height)(ULONG *height)
 }
 
 /**
- * Lock the framebuffer (make its address immutable).
- *
- * @returns COM status code
- */
-STDMETHODIMP VBoxSDLFB::Lock()
-{
-    LogFlow(("VBoxSDLFB::Lock\n"));
-    RTCritSectEnter(&mUpdateLock);
-    return S_OK;
-}
-
-/**
- * Unlock the framebuffer.
- *
- * @returns COM status code
- */
-STDMETHODIMP VBoxSDLFB::Unlock()
-{
-    LogFlow(("VBoxSDLFB::Unlock\n"));
-    RTCritSectLeave(&mUpdateLock);
-    return S_OK;
-}
-
-/**
- * Return the framebuffer start address.
- *
- * @returns COM status code.
- * @param   address Pointer to result variable.
- */
-STDMETHODIMP VBoxSDLFB::COMGETTER(Address)(BYTE **address)
-{
-    LogFlow(("VBoxSDLFB::GetAddress\n"));
-    if (!address)
-        return E_INVALIDARG;
-
-    if (!mSurfVRAM)
-    {
-        /* That's actually rather bad. */
-        AssertMsgFailed(("mSurfVRAM is NULL!\n"));
-        return E_FAIL;
-    }
-
-    *address = (BYTE *) mSurfVRAM->pixels;
-    LogFlow(("VBoxSDL::GetAddress returning %p\n", *address));
-    return S_OK;
-}
-
-/**
  * Return the current framebuffer color depth.
  *
  * @returns COM status code
@@ -364,19 +337,11 @@ STDMETHODIMP VBoxSDLFB::COMGETTER(BytesPerLine)(ULONG *bytesPerLine)
     return S_OK;
 }
 
-STDMETHODIMP VBoxSDLFB::COMGETTER(PixelFormat) (ULONG *pixelFormat)
+STDMETHODIMP VBoxSDLFB::COMGETTER(PixelFormat) (BitmapFormat_T *pixelFormat)
 {
     if (!pixelFormat)
         return E_POINTER;
-    *pixelFormat = mPixelFormat;
-    return S_OK;
-}
-
-STDMETHODIMP VBoxSDLFB::COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM)
-{
-    if (!usesGuestVRAM)
-        return E_POINTER;
-    *usesGuestVRAM = mUsesGuestVRAM;
+    *pixelFormat = BitmapFormat_BGR;
     return S_OK;
 }
 
@@ -421,14 +386,39 @@ STDMETHODIMP VBoxSDLFB::COMGETTER(Overlay)(IFramebufferOverlay **aOverlay)
  * @returns COM status code.
  * @param   winId Handle of associated window.
  */
-STDMETHODIMP VBoxSDLFB::COMGETTER(WinId)(int64_t *winId)
+STDMETHODIMP VBoxSDLFB::COMGETTER(WinId)(LONG64 *winId)
 {
     if (!winId)
         return E_POINTER;
+#ifdef RT_OS_DARWIN
+    if (mWinId == NULL) /* (In case it failed the first time.) */
+        mWinId = (intptr_t)VBoxSDLGetDarwinWindowId();
+#endif
     *winId = mWinId;
     return S_OK;
 }
 
+STDMETHODIMP VBoxSDLFB::COMGETTER(Capabilities)(ComSafeArrayOut(FramebufferCapabilities_T, aCapabilities))
+{
+    if (ComSafeArrayOutIsNull(aCapabilities))
+        return E_POINTER;
+
+    com::SafeArray<FramebufferCapabilities_T> caps;
+
+    if (mfUpdateImage)
+    {
+        caps.resize(1);
+        caps[0] = FramebufferCapabilities_UpdateImage;
+    }
+    else
+    {
+        /* No caps to return. */
+    }
+
+    caps.detachTo(ComSafeArrayOutArg(aCapabilities));
+    return S_OK;
+}
+
 /**
  * Notify framebuffer of an update.
  *
@@ -474,81 +464,89 @@ STDMETHODIMP VBoxSDLFB::NotifyUpdate(ULONG x, ULONG y,
     return S_OK;
 }
 
-/**
- * Request a display resize from the framebuffer.
- *
- * @returns COM status code.
- * @param   pixelFormat The requested pixel format.
- * @param   vram        Pointer to the guest VRAM buffer (can be NULL).
- * @param   bitsPerPixel Color depth in bits.
- * @param   bytesPerLine Size of a scanline in bytes.
- * @param   w           New display width in pixels.
- * @param   h           New display height in pixels.
- * @param   finished    Address of output flag whether the update
- *                      could be fully processed in this call (which
- *                      has to return immediately) or VBox should wait
- *                      for all call to the resize complete API before
- *                      continuing with display updates.
- */
-STDMETHODIMP VBoxSDLFB::RequestResize(ULONG aScreenId, ULONG pixelFormat, BYTE *vram,
-                                      ULONG bitsPerPixel, ULONG bytesPerLine,
-                                      ULONG w, ULONG h, BOOL *finished)
+STDMETHODIMP VBoxSDLFB::NotifyUpdateImage(ULONG aX,
+                                          ULONG aY,
+                                          ULONG aWidth,
+                                          ULONG aHeight,
+                                          ComSafeArrayIn(BYTE, aImage))
 {
-    LogFlowFunc (("w=%d, h=%d, pixelFormat=0x%08lX, vram=%p, "
-                  "bpp=%d, bpl=%d\n",
-                  w, h, pixelFormat, vram, bitsPerPixel, bytesPerLine));
+    LogFlow(("NotifyUpdateImage: %d,%d %dx%d\n", aX, aY, aWidth, aHeight));
 
-    /*
-     * SDL does not allow us to make this call from any other thread than
-     * the main thread (the one which initialized the video mode). So we
-     * have to send an event to the main SDL thread and tell VBox to wait.
-     */
-    if (!finished)
+    com::SafeArray<BYTE> image(ComSafeArrayInArg(aImage));
+
+    /* Copy to mSurfVRAM. */
+    SDL_Rect srcRect;
+    SDL_Rect dstRect;
+    srcRect.x = 0;
+    srcRect.y = 0;
+    srcRect.w = (uint16_t)aWidth;
+    srcRect.h = (uint16_t)aHeight;
+    dstRect.x = (int16_t)aX;
+    dstRect.y = (int16_t)aY;
+    dstRect.w = (uint16_t)aWidth;
+    dstRect.h = (uint16_t)aHeight;
+
+    const uint32_t Rmask = 0x00FF0000, Gmask = 0x0000FF00, Bmask = 0x000000FF, Amask = 0;
+    SDL_Surface *surfSrc = SDL_CreateRGBSurfaceFrom(image.raw(), aWidth, aHeight, 32, aWidth * 4,
+                                                    Rmask, Gmask, Bmask, Amask);
+    if (surfSrc)
     {
-        AssertMsgFailed(("RequestResize requires the finished flag!\n"));
-        return E_FAIL;
+        RTCritSectEnter(&mUpdateLock);
+        if (mfUpdates)
+            SDL_BlitSurface(surfSrc, &srcRect, mSurfVRAM, &dstRect);
+        RTCritSectLeave(&mUpdateLock);
+
+        SDL_FreeSurface(surfSrc);
     }
 
-    /*
-     * Optimize the case when the guest has changed only the VRAM ptr
-     * and the framebuffer uses the guest VRAM as the source bitmap.
-     */
-    if (   mGuestXRes    == w
-        && mGuestYRes    == h
-        && mPixelFormat  == pixelFormat
-        && mBitsPerPixel == bitsPerPixel
-        && mBytesPerLine == bytesPerLine
-        && mUsesGuestVRAM
-       )
+    return NotifyUpdate(aX, aY, aWidth, aHeight);
+}
+
+extern ComPtr<IDisplay> gpDisplay;
+
+STDMETHODIMP VBoxSDLFB::NotifyChange(ULONG aScreenId,
+                                     ULONG aXOrigin,
+                                     ULONG aYOrigin,
+                                     ULONG aWidth,
+                                     ULONG aHeight)
+{
+    LogRel(("NotifyChange: %d %d,%d %dx%d\n",
+            aScreenId, aXOrigin, aYOrigin, aWidth, aHeight));
+
+    ComPtr<IDisplaySourceBitmap> pSourceBitmap;
+    if (!mfUpdateImage)
+        gpDisplay->QuerySourceBitmap(aScreenId, pSourceBitmap.asOutParam());
+
+    RTCritSectEnter(&mUpdateLock);
+
+    /* Disable screen updates. */
+    mfUpdates = false;
+
+    if (mfUpdateImage)
     {
-        mfSameSizeRequested = true;
+        mGuestXRes   = aWidth;
+        mGuestYRes   = aHeight;
+        mPtrVRAM     = NULL;
+        mBitsPerPixel = 0;
+        mBytesPerLine = 0;
     }
     else
     {
-        mfSameSizeRequested = false;
+        /* Save the new bitmap. */
+        mpPendingSourceBitmap = pSourceBitmap;
     }
 
-    mGuestXRes   = w;
-    mGuestYRes   = h;
-    mPixelFormat = pixelFormat;
-    mPtrVRAM     = vram;
-    mBitsPerPixel = bitsPerPixel;
-    mBytesPerLine = bytesPerLine;
-    mUsesGuestVRAM = FALSE; /* yet */
+    RTCritSectLeave(&mUpdateLock);
 
     SDL_Event event;
     event.type       = SDL_USEREVENT;
-    event.user.type  = SDL_USER_EVENT_RESIZE;
+    event.user.type  = SDL_USER_EVENT_NOTIFYCHANGE;
     event.user.code  = mScreenId;
 
-    /* Try multiple times if necessary */
     PushSDLEventForSure(&event);
 
-    /* we want this request to be processed quickly, so yield the CPU */
     RTThreadYield();
 
-    *finished = false;
-
     return S_OK;
 }
 
@@ -621,7 +619,7 @@ STDMETHODIMP VBoxSDLFB::ProcessVHWACommand(BYTE *pCommand)
     return E_NOTIMPL;
 }
 
-STDMETHODIMP VBoxSDLFB::Notify3DEvent(ULONG uType, BYTE *pReserved)
+STDMETHODIMP VBoxSDLFB::Notify3DEvent(ULONG uType, ComSafeArrayIn(BYTE, aData))
 {
     return E_NOTIMPL;
 }
@@ -630,6 +628,73 @@ STDMETHODIMP VBoxSDLFB::Notify3DEvent(ULONG uType, BYTE *pReserved)
 // Internal public methods
 //
 
+/* This method runs on the main SDL thread. */
+void VBoxSDLFB::notifyChange(ULONG aScreenId)
+{
+    /* Disable screen updates. */
+    RTCritSectEnter(&mUpdateLock);
+
+    if (!mfUpdateImage && mpPendingSourceBitmap.isNull())
+    {
+        /* Do nothing. Change event already processed. */
+        RTCritSectLeave(&mUpdateLock);
+        return;
+    }
+
+    /* Release the current bitmap and keep the pending one. */
+    mpSourceBitmap = mpPendingSourceBitmap;
+    mpPendingSourceBitmap.setNull();
+
+    RTCritSectLeave(&mUpdateLock);
+
+    if (mpSourceBitmap.isNull())
+    {
+        mPtrVRAM      = NULL;
+        mBitsPerPixel = 32;
+        mBytesPerLine = mGuestXRes * 4;
+    }
+    else
+    {
+        BYTE *pAddress = NULL;
+        ULONG ulWidth = 0;
+        ULONG ulHeight = 0;
+        ULONG ulBitsPerPixel = 0;
+        ULONG ulBytesPerLine = 0;
+        BitmapFormat_T bitmapFormat = BitmapFormat_Opaque;
+
+        mpSourceBitmap->QueryBitmapInfo(&pAddress,
+                                        &ulWidth,
+                                        &ulHeight,
+                                        &ulBitsPerPixel,
+                                        &ulBytesPerLine,
+                                        &bitmapFormat);
+
+        if (   mGuestXRes    == ulWidth
+            && mGuestYRes    == ulHeight
+            && mBitsPerPixel == ulBitsPerPixel
+            && mBytesPerLine == ulBytesPerLine
+            && mPtrVRAM == pAddress
+           )
+        {
+            mfSameSizeRequested = true;
+        }
+        else
+        {
+            mfSameSizeRequested = false;
+        }
+
+        mGuestXRes   = ulWidth;
+        mGuestYRes   = ulHeight;
+        mPtrVRAM     = pAddress;
+        mBitsPerPixel = ulBitsPerPixel;
+        mBytesPerLine = ulBytesPerLine;
+    }
+
+    resizeGuest();
+
+    gpDisplay->InvalidateAndUpdateScreen(aScreenId);
+}
+
 /**
  * Method that does the actual resize of the guest framebuffer and
  * then changes the SDL framebuffer setup.
@@ -640,42 +705,9 @@ void VBoxSDLFB::resizeGuest()
     AssertMsg(gSdlNativeThread == RTThreadNativeSelf(),
               ("Wrong thread! SDL is not threadsafe!\n"));
 
-    uint32_t Rmask, Gmask, Bmask, Amask = 0;
-
-    mUsesGuestVRAM = FALSE;
-
-    /* pixel characteristics. if we don't support the format directly, we will
-     * fallback to the indirect 32bpp buffer (mUsesGuestVRAM will remain
-     * FALSE) */
-    if (mPixelFormat == FramebufferPixelFormat_FOURCC_RGB)
-    {
-        switch (mBitsPerPixel)
-        {
-            case 16:
-            case 24:
-            case 32:
-                mUsesGuestVRAM = TRUE;
-                break;
-            default:
-                /* the fallback buffer is always 32bpp */
-                mBitsPerPixel = 32;
-                mBytesPerLine = mGuestXRes * 4;
-                break;
-        }
-    }
-    else
-    {
-        /* the fallback buffer is always RGB, 32bpp */
-        mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
-        mBitsPerPixel = 32;
-        mBytesPerLine = mGuestXRes * 4;
-    }
+    RTCritSectEnter(&mUpdateLock);
 
-    switch (mBitsPerPixel)
-    {
-        case 16: Rmask = 0x0000F800; Gmask = 0x000007E0; Bmask = 0x0000001F; break;
-        default: Rmask = 0x00FF0000; Gmask = 0x0000FF00; Bmask = 0x000000FF; break;
-    }
+    const uint32_t Rmask = 0x00FF0000, Gmask = 0x0000FF00, Bmask = 0x000000FF, Amask = 0;
 
     /* first free the current surface */
     if (mSurfVRAM)
@@ -684,36 +716,38 @@ void VBoxSDLFB::resizeGuest()
         mSurfVRAM = NULL;
     }
 
-    /* is the guest in a linear framebuffer mode we support? */
-    if (mUsesGuestVRAM)
+    if (mPtrVRAM)
     {
-        /* Create a source surface from guest VRAM. */
+        /* Create a source surface from the source bitmap. */
         mSurfVRAM = SDL_CreateRGBSurfaceFrom(mPtrVRAM, mGuestXRes, mGuestYRes, mBitsPerPixel,
                                              mBytesPerLine, Rmask, Gmask, Bmask, Amask);
-        LogRel(("mSurfVRAM from guest %d x %d\n", mGuestXRes,  mGuestYRes));
+        LogFlow(("VBoxSDL:: using the source bitmap\n"));
     }
     else
     {
-        /* Create a software surface for which SDL allocates the RAM */
         mSurfVRAM = SDL_CreateRGBSurface(SDL_SWSURFACE, mGuestXRes, mGuestYRes, mBitsPerPixel,
                                          Rmask, Gmask, Bmask, Amask);
-        LogRel(("mSurfVRAM from SDL %d x %d\n", mGuestXRes,  mGuestYRes));
+        LogFlow(("VBoxSDL:: using SDL_SWSURFACE\n"));
     }
     LogFlow(("VBoxSDL:: created VRAM surface %p\n", mSurfVRAM));
 
-    if (mfSameSizeRequested && mUsesGuestVRAM)
+    if (mfSameSizeRequested)
     {
-        /*
-         * Same size has been requested and the framebuffer still uses the guest VRAM.
-         * Reset the condition and return.
-         */
         mfSameSizeRequested = false;
         LogFlow(("VBoxSDL:: the same resolution requested, skipping the resize.\n"));
-        return;
+    }
+    else
+    {
+        /* now adjust the SDL resolution */
+        resizeSDL();
     }
 
-    /* now adjust the SDL resolution */
-    resizeSDL();
+    /* Enable screen updates. */
+    mfUpdates = true;
+
+    RTCritSectLeave(&mUpdateLock);
+
+    repaint();
 }
 
 /**
@@ -889,6 +923,8 @@ void VBoxSDLFB::resizeSDL(void)
     SDL_VERSION(&info.version);
     if (SDL_GetWMInfo(&info))
         mWinId = (LONG64) info.info.x11.wmwindow;
+# elif defined(RT_OS_DARWIN)
+    mWinId = (intptr_t)VBoxSDLGetDarwinWindowId();
 # else
     /* XXX ignore this for other architectures */
 # endif
@@ -936,7 +972,6 @@ void VBoxSDLFB::resizeSDL(void)
             RTPrintf("Resized to %dx%d, screen surface type: %s\n", mScreen->w, mScreen->h,
                      ((mScreen->flags & SDL_HWSURFACE) == 0) ? "software" : "hardware");
     }
-    repaint();
 }
 
 /**
@@ -955,10 +990,21 @@ void VBoxSDLFB::update(int x, int y, int w, int h, bool fGuestRelative)
 #ifdef VBOXSDL_WITH_X11
     AssertMsg(gSdlNativeThread == RTThreadNativeSelf(), ("Wrong thread! SDL is not threadsafe!\n"));
 #endif
+    RTCritSectEnter(&mUpdateLock);
+    Log(("Updates %d, %d,%d %dx%d\n", mfUpdates, x, y, w, h));
+    if (!mfUpdates)
+    {
+        RTCritSectLeave(&mUpdateLock);
+        return;
+    }
+
     Assert(mScreen);
     Assert(mSurfVRAM);
     if (!mScreen || !mSurfVRAM)
+    {
+        RTCritSectLeave(&mUpdateLock);
         return;
+    }
 
     /* the source and destination rectangles */
     SDL_Rect srcRect;
@@ -1038,6 +1084,7 @@ void VBoxSDLFB::update(int x, int y, int w, int h, bool fGuestRelative)
     if (fPaintLabel)
         paintSecureLabel(0, 0, 0, 0, false);
 #endif
+    RTCritSectLeave(&mUpdateLock);
 }
 
 /**
@@ -1064,6 +1111,7 @@ void VBoxSDLFB::setFullscreen(bool fFullscreen)
     mfFullscreen = fFullscreen;
     /* only change the SDL resolution, do not touch the guest framebuffer */
     resizeSDL();
+    repaint();
 }
 
 /**
@@ -1420,7 +1468,7 @@ STDMETHODIMP VBoxSDLFBOverlay::COMGETTER(PixelFormat)(ULONG *pixelFormat)
     LogFlow(("VBoxSDLFBOverlay::GetPixelFormat\n"));
     if (!pixelFormat)
         return E_INVALIDARG;
-    *pixelFormat = FramebufferPixelFormat_FOURCC_RGB;
+    *pixelFormat = BitmapFormat_BGR;
     return S_OK;
 }
 
@@ -1550,7 +1598,7 @@ STDMETHODIMP VBoxSDLFBOverlay::NotifyUpdate(ULONG x, ULONG y,
  * Change the dimensions of the overlay.
  *
  * @returns COM status code
- * @param   pixelFormat Must be FramebufferPixelFormat_PixelFormatRGB32.
+ * @param   pixelFormat Must be BitmapFormat_BGR.
  * @param   vram        Must be NULL.
  * @param   lineSize    Ignored.
  * @param   w           New overlay width.
@@ -1561,7 +1609,7 @@ STDMETHODIMP VBoxSDLFBOverlay::RequestResize(ULONG aScreenId, ULONG pixelFormat,
                                              ULONG bitsPerPixel, ULONG bytesPerLine,
                                              ULONG w, ULONG h, BOOL *finished)
 {
-    AssertReturn(pixelFormat == FramebufferPixelFormat_FOURCC_RGB, E_INVALIDARG);
+    AssertReturn(pixelFormat == BitmapFormat_BGR, E_INVALIDARG);
     AssertReturn(vram == 0, E_INVALIDARG);
     AssertReturn(bitsPerPixel == 32, E_INVALIDARG);
     mOverlayWidth = w;
diff --git a/src/VBox/Frontends/VBoxSDL/Framebuffer.h b/src/VBox/Frontends/VBoxSDL/Framebuffer.h
index 0e3c433..29d0bc0 100644
--- a/src/VBox/Frontends/VBoxSDL/Framebuffer.h
+++ b/src/VBox/Frontends/VBoxSDL/Framebuffer.h
@@ -1,3 +1,4 @@
+/* $Id: Framebuffer.h $ */
 /** @file
  *
  * VBox frontends: VBoxSDL (simple frontend based on SDL):
@@ -41,53 +42,53 @@ extern DECLSPEC void (SDLCALL *pTTF_Quit)(void);
 
 class VBoxSDLFBOverlay;
 
-class VBoxSDLFB :
+class ATL_NO_VTABLE VBoxSDLFB :
+    public CComObjectRootEx<CComMultiThreadModel>,
     VBOX_SCRIPTABLE_IMPL(IFramebuffer)
 {
 public:
-    VBoxSDLFB(uint32_t uScreenId,
-              bool fFullscreen = false, bool fResizable = true, bool fShowSDLConfig = false,
-              bool fKeepHostRes = false, uint32_t u32FixedWidth = ~(uint32_t)0,
-              uint32_t u32FixedHeight = ~(uint32_t)0, uint32_t u32FixedBPP = ~(uint32_t)0);
-    virtual ~VBoxSDLFB();
+    VBoxSDLFB();
+    ~VBoxSDLFB();
+
+    HRESULT init(uint32_t uScreenId,
+                 bool fFullscreen, bool fResizable, bool fShowSDLConfig,
+                 bool fKeepHostRes, uint32_t u32FixedWidth,
+                 uint32_t u32FixedHeight, uint32_t u32FixedBPP,
+                 bool fUpdateImage);
 
     static bool init(bool fShowSDLConfig);
     static void uninit();
 
-#ifdef RT_OS_WINDOWS
-    STDMETHOD_(ULONG, AddRef)()
-    {
-        return ::InterlockedIncrement (&refcnt);
-    }
-    STDMETHOD_(ULONG, Release)()
-    {
-        long cnt = ::InterlockedDecrement (&refcnt);
-        if (cnt == 0)
-            delete this;
-        return cnt;
-    }
-#endif
-    VBOX_SCRIPTABLE_DISPATCH_IMPL(IFramebuffer)
+    DECLARE_NOT_AGGREGATABLE(VBoxSDLFB)
 
-    NS_DECL_ISUPPORTS
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    BEGIN_COM_MAP(VBoxSDLFB)
+        COM_INTERFACE_ENTRY(IFramebuffer)
+        COM_INTERFACE_ENTRY2(IDispatch,IFramebuffer)
+        COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
+    END_COM_MAP()
+
+    HRESULT FinalConstruct();
+    void FinalRelease();
 
     STDMETHOD(COMGETTER(Width))(ULONG *width);
     STDMETHOD(COMGETTER(Height))(ULONG *height);
-    STDMETHOD(Lock)();
-    STDMETHOD(Unlock)();
-    STDMETHOD(COMGETTER(Address))(BYTE **address);
     STDMETHOD(COMGETTER(BitsPerPixel))(ULONG *bitsPerPixel);
     STDMETHOD(COMGETTER(BytesPerLine))(ULONG *bytesPerLine);
-    STDMETHOD(COMGETTER(PixelFormat)) (ULONG *pixelFormat);
-    STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *usesGuestVRAM);
+    STDMETHOD(COMGETTER(PixelFormat)) (BitmapFormat_T *pixelFormat);
     STDMETHOD(COMGETTER(HeightReduction)) (ULONG *heightReduction);
     STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay);
-    STDMETHOD(COMGETTER(WinId)) (int64_t *winId);
+    STDMETHOD(COMGETTER(WinId)) (LONG64 *winId);
+    STDMETHOD(COMGETTER(Capabilities))(ComSafeArrayOut(FramebufferCapabilities_T, aCapabilities));
 
     STDMETHOD(NotifyUpdate)(ULONG x, ULONG y, ULONG w, ULONG h);
-    STDMETHOD(RequestResize)(ULONG aScreenId, ULONG pixelFormat, BYTE *vram,
-                             ULONG bitsPerPixel, ULONG bytesPerLine,
-                             ULONG w, ULONG h, BOOL *finished);
+    STDMETHOD(NotifyUpdateImage)(ULONG x, ULONG y, ULONG w, ULONG h, ComSafeArrayIn(BYTE, aImage));
+    STDMETHOD(NotifyChange)(ULONG aScreenId,
+                            ULONG aXOrigin,
+                            ULONG aYOrigin,
+                            ULONG aWidth,
+                            ULONG aHeight);
     STDMETHOD(VideoModeSupported)(ULONG width, ULONG height, ULONG bpp, BOOL *supported);
 
     STDMETHOD(GetVisibleRegion)(BYTE *aRectangles, ULONG aCount, ULONG *aCountCopied);
@@ -95,10 +96,11 @@ public:
 
     STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
 
-    STDMETHOD(Notify3DEvent)(ULONG uType, BYTE *pReserved);
+    STDMETHOD(Notify3DEvent)(ULONG uType, ComSafeArrayIn(BYTE, aData));
 
     // internal public methods
     bool initialized() { return mfInitialized; }
+    void notifyChange(ULONG aScreenId);
     void resizeGuest();
     void resizeSDL();
     void update(int x, int y, int w, int h, bool fGuestRelative);
@@ -140,6 +142,8 @@ private:
     bool mfInitialized;
     /** the screen number of this framebuffer */
     uint32_t mScreenId;
+    /** use NotifyUpdateImage */
+    bool mfUpdateImage;
     /** maximum possible screen width in pixels (~0 = no restriction) */
     uint32_t mMaxScreenWidth;
     /** maximum possible screen height in pixels (~0 = no restriction) */
@@ -190,17 +194,21 @@ private:
     uint32_t mLabelOffs;
 
 #endif
-#ifdef RT_OS_WINDOWS
-    long refcnt;
-#endif
+
     SDL_Surface *mSurfVRAM;
 
     BYTE *mPtrVRAM;
     ULONG mBitsPerPixel;
     ULONG mBytesPerLine;
-    ULONG mPixelFormat;
-    BOOL mUsesGuestVRAM;
     BOOL mfSameSizeRequested;
+
+    ComPtr<IDisplaySourceBitmap> mpSourceBitmap;
+    ComPtr<IDisplaySourceBitmap> mpPendingSourceBitmap;
+    bool mfUpdates;
+
+#ifdef RT_OS_WINDOWS
+     CComPtr <IUnknown>   m_pUnkMarshaler;
+#endif
 };
 
 class VBoxSDLFBOverlay :
diff --git a/src/VBox/Frontends/VBoxSDL/Helper.cpp b/src/VBox/Frontends/VBoxSDL/Helper.cpp
index 5750d0f..9500129 100644
--- a/src/VBox/Frontends/VBoxSDL/Helper.cpp
+++ b/src/VBox/Frontends/VBoxSDL/Helper.cpp
@@ -1,3 +1,4 @@
+/* $Id: Helper.cpp $ */
 /** @file
  *
  * VBox frontends: VBoxSDL (simple frontend based on SDL):
diff --git a/src/VBox/Frontends/VBoxSDL/Helper.h b/src/VBox/Frontends/VBoxSDL/Helper.h
index 6b72520..94475ae 100644
--- a/src/VBox/Frontends/VBoxSDL/Helper.h
+++ b/src/VBox/Frontends/VBoxSDL/Helper.h
@@ -1,3 +1,4 @@
+/* $Id: Helper.h $ */
 /** @file
  *
  * VBox frontends: VBoxSDL (simple frontend based on SDL):
diff --git a/src/VBox/Frontends/VBoxSDL/Makefile.kmk b/src/VBox/Frontends/VBoxSDL/Makefile.kmk
index a3be1c0..cd083e9 100644
--- a/src/VBox/Frontends/VBoxSDL/Makefile.kmk
+++ b/src/VBox/Frontends/VBoxSDL/Makefile.kmk
@@ -19,30 +19,27 @@ SUB_DEPTH = ../../../..
 include $(KBUILD_PATH)/subheader.kmk
 if !defined(VBOX_WITH_HARDENING) || "$(KBUILD_TARGET)" != "darwin" # No hardened VBoxSDL on darwin.
 
-#
-# Targets.
-#
+
 ifdef VBOX_WITH_HARDENING
+ #
+ # Hardened VBoxSDL
+ #
  PROGRAMS += VBoxSDLHardened
- DLLS += VBoxSDL
-else
- PROGRAMS += VBoxSDL
+ VBoxSDLHardened_TEMPLATE = VBOXR3HARDENEDEXE
+ VBoxSDLHardened_SOURCES = VBoxSDLHardened.cpp
+ VBoxSDLHardened_NAME = VBoxSDL
+ $(call VBOX_SET_VER_INFO_EXE,VBoxSDLHardened,VirtualBox Pure SDL Frontend,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
 endif
-PROGRAMS += tstSDL
-
-
-#
-# Hardened VBoxSDL
-#
-VBoxSDLHardened_TEMPLATE = VBOXR3HARDENEDEXE
-VBoxSDLHardened_SOURCES = VBoxSDLHardened.cpp
-VBoxSDLHardened_SOURCES.win = $(VBoxSDL_0_OUTDIR)/VBoxSDL-icon.rc
-VBoxSDLHardened_NAME = VBoxSDL
 
 
 #
 # VBoxSDL
 #
+ifdef VBOX_WITH_HARDENING
+ DLLS += VBoxSDL
+else
+ PROGRAMS += VBoxSDL
+endif
 VBoxSDL_TEMPLATE  := $(if $(VBOX_WITH_HARDENING),VBOXMAINCLIENTDLL,VBOXMAINCLIENTEXE)
 VBoxSDL_SDKS       = LIBSDL
 VBoxSDL_SOURCES    = \
@@ -50,7 +47,8 @@ VBoxSDL_SOURCES    = \
 	Framebuffer.cpp \
 	Helper.cpp
 VBoxSDL_SOURCES.darwin = \
-	VBoxSDLMain-darwin.m
+	VBoxSDLMain-darwin.m \
+       Framebuffer-darwin.m
 
 VBoxSDL_DEFS       =
 ifdef VBOX_WITH_SDL13
@@ -104,22 +102,17 @@ $$(VBoxSDL_0_OUTDIR)/Ico64x01.h: $(PATH_ROOT)/src/VBox/Frontends/VBoxSDL/ico64x0
 	$(call MSG_TOOL,bin2c,VBoxSDL,$<,$@)
 	$(QUIET)$(VBOX_BIN2C) Ico64x01 $< $@
 
-ifeq ($(KBUILD_TARGET),win)
-VBoxSDL_SOURCES   += VBoxSDL.rc
-VBoxSDL.rc_INCS    = $(VBoxSDL_0_OUTDIR)
-VBoxSDL.rc_DEPS    = $(VBoxSDL_0_OUTDIR)/VBoxSDL-icon.rc
-VBoxSDL.rc_CLEAN   = $(VBoxSDL_0_OUTDIR)/VBoxSDL-icon.rc
-# Icon include file.
-$$(VBoxSDL_0_OUTDIR)/VBoxSDL-icon.rc: $(VBOX_WINDOWS_ICON_FILE) $$(VBoxSDL_DEFPATH)/Makefile.kmk | $$(dir $$@)
-	$(RM) -f $@
-	$(APPEND) $@ 'IDI_VIRTUALBOX ICON DISCARDABLE "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"'
+ifdef VBOX_WITH_HARDENING
+$(call VBOX_SET_VER_INFO_DLL,VBoxSDL,VirtualBox Pure SDL Frontend,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
+else
+$(call VBOX_SET_VER_INFO_EXE,VBoxSDL,VirtualBox Pure SDL Frontend,$(VBOX_WINDOWS_ICON_FILE)) # Version info / description.
 endif
 
 
-
 #
 # tstSDL
 #
+PROGRAMS += tstSDL
 tstSDL_TEMPLATE = VBOXR3NPEXE
 tstSDL_SDKS = LIBSDL
 tstSDL_INST = $(INST_TESTCASE)
diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp b/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
index 277d248..72d0c07 100644
--- a/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
+++ b/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
@@ -1,10 +1,11 @@
+/* $Id: VBoxSDL.cpp $ */
 /** @file
  * VBox frontends: VBoxSDL (simple frontend based on SDL):
  * Main code
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -201,12 +202,13 @@ static ComPtr<IConsole> gpConsole;
 static ComPtr<IMachineDebugger> gpMachineDebugger;
 static ComPtr<IKeyboard> gpKeyboard;
 static ComPtr<IMouse> gpMouse;
-static ComPtr<IDisplay> gpDisplay;
+ComPtr<IDisplay> gpDisplay;
 static ComPtr<IVRDEServer> gpVRDEServer;
 static ComPtr<IProgress> gpProgress;
 
 static ULONG       gcMonitors = 1;
-static VBoxSDLFB  *gpFramebuffer[64];
+static ComObjPtr<VBoxSDLFB> gpFramebuffer[64];
+static Bstr gaFramebufferId[64];
 static SDL_Cursor *gpDefaultCursor = NULL;
 #ifdef VBOXSDL_WITH_X11
 static Cursor      gpDefaultOrigX11Cursor;
@@ -526,6 +528,8 @@ public:
                 SDL_VERSION(&info.version);
                 if (!SDL_GetWMInfo(&info))
                     pCSWEv->AddVeto(NULL);
+                else
+                    pCSWEv->AddApproval(NULL);
 #endif
                 break;
             }
@@ -534,6 +538,10 @@ public:
             {
                 ComPtr<IShowWindowEvent> pSWEv = aEvent;
                 Assert(pSWEv);
+                LONG64 winId = 0;
+                pSWEv->COMGETTER(WinId)(&winId);
+                if (winId != 0)
+                    break; /* WinId already set by some other listener. */
 #ifndef RT_OS_DARWIN
                 SDL_SysWMinfo info;
                 SDL_VERSION(&info.version);
@@ -601,6 +609,7 @@ static void show_usage()
 {
     RTPrintf("Usage:\n"
              "  --startvm <uuid|name>    Virtual machine to start, either UUID or name\n"
+             "  --separate               Run a separate VM process or attach to a running VM\n"
              "  --hda <file>             Set temporary first hard disk to file\n"
              "  --fda <file>             Set temporary first floppy disk to file\n"
              "  --cdrom <file>           Set temporary CDROM/DVD to file/device ('none' to unmount)\n"
@@ -822,6 +831,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
     int vrc;
     Guid uuidVM;
     char *vmName = NULL;
+    bool fSeparate = false;
     DeviceType_T bootDevice = DeviceType_Null;
     uint32_t memorySize = 0;
     uint32_t vramSize = 0;
@@ -975,6 +985,11 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
                 return 1;
             }
         }
+        else if (   !strcmp(argv[curArg], "--separate")
+                 || !strcmp(argv[curArg], "-separate"))
+        {
+            fSeparate = true;
+        }
         else if (   !strcmp(argv[curArg], "--comment")
                  || !strcmp(argv[curArg], "-comment"))
         {
@@ -1481,7 +1496,70 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
         goto leave;
     }
 
-    rc = pMachine->LockMachine(pSession, LockType_VM);
+    if (fSeparate)
+    {
+        MachineState_T machineState = MachineState_Null;
+        pMachine->COMGETTER(State)(&machineState);
+        if (   machineState == MachineState_Running
+            || machineState == MachineState_Teleporting
+            || machineState == MachineState_LiveSnapshotting
+            || machineState == MachineState_Paused
+            || machineState == MachineState_TeleportingPausedVM
+           )
+        {
+            RTPrintf("VM is already running.\n");
+        }
+        else
+        {
+            ComPtr<IProgress> progress;
+            rc = pMachine->LaunchVMProcess(pSession, Bstr("headless").raw(), NULL, progress.asOutParam());
+            if (SUCCEEDED(rc) && !progress.isNull())
+            {
+                RTPrintf("Waiting for VM to power on...\n");
+                rc = progress->WaitForCompletion(-1);
+                if (SUCCEEDED(rc))
+                {
+                    BOOL completed = true;
+                    rc = progress->COMGETTER(Completed)(&completed);
+                    if (SUCCEEDED(rc))
+                    {
+                        LONG iRc;
+                        rc = progress->COMGETTER(ResultCode)(&iRc);
+                        if (SUCCEEDED(rc))
+                        {
+                            if (FAILED(iRc))
+                            {
+                                ProgressErrorInfo info(progress);
+                                com::GluePrintErrorInfo(info);
+                            }
+                            else
+                            {
+                                RTPrintf("VM has been successfully started.\n");
+                                /* LaunchVMProcess obtains a shared lock on the machine.
+                                 * Unlock it here, because the lock will be obtained below
+                                 * in the common code path as for already running VM.
+                                 */
+                                pSession->UnlockMachine();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        if (FAILED(rc))
+        {
+            RTPrintf("Error: failed to power up VM! No error text available.\n");
+            goto leave;
+        }
+
+        rc = pMachine->LockMachine(pSession, LockType_Shared);
+    }
+    else
+    {
+        pSession->COMSETTER(Name)(Bstr("GUI/SDL").raw());
+        rc = pMachine->LockMachine(pSession, LockType_VM);
+    }
+
     if (FAILED(rc))
     {
         com::ErrorInfo info;
@@ -1508,6 +1586,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
             RTPrintf("Error: given machine not found!\n");
         goto leave;
     }
+
     // get the VM console
     pSession->COMGETTER(Console)(gpConsole.asOutParam());
     if (!gpConsole)
@@ -1766,7 +1845,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
         gpMachine->COMGETTER(State)(&machineState);
         if (machineState == MachineState_Saved)
         {
-            CHECK_ERROR(gpConsole, DiscardSavedState(true /* fDeleteFile */));
+            CHECK_ERROR(gpMachine, DiscardSavedState(true /* fDeleteFile */));
         }
         /*
          * If there are snapshots, discard the current state,
@@ -1783,7 +1862,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
             if (FAILED(rc))
                 goto leave;
 
-            CHECK_ERROR(gpConsole, RestoreSnapshot(pCurrentSnapshot, gpProgress.asOutParam()));
+            CHECK_ERROR(gpMachine, RestoreSnapshot(pCurrentSnapshot, gpProgress.asOutParam()));
             rc = gpProgress->WaitForCompletion(-1);
         }
     }
@@ -1856,10 +1935,10 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
     for (unsigned i = 0; i < gcMonitors; i++)
     {
         // create our SDL framebuffer instance
-        gpFramebuffer[i] = new VBoxSDLFB(i, fFullscreen, fResizable, fShowSDLConfig, false,
-                                         fixedWidth, fixedHeight, fixedBPP);
-
-        if (!gpFramebuffer[i])
+        gpFramebuffer[i].createObject();
+        rc = gpFramebuffer[i]->init(i, fFullscreen, fResizable, fShowSDLConfig, false,
+                                    fixedWidth, fixedHeight, fixedBPP, fSeparate);
+        if (FAILED(rc))
         {
             RTPrintf("Error: could not create framebuffer object!\n");
             goto leave;
@@ -1888,7 +1967,7 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
             goto leave;
         }
         /* load the SDL_ttf library and get the required imports */
-        vrc = RTLdrLoad(LIBSDL_TTF_NAME, &gLibrarySDL_ttf);
+        vrc = RTLdrLoadSystem(LIBSDL_TTF_NAME, true /*fNoUnload*/, &gLibrarySDL_ttf);
         if (RT_SUCCESS(vrc))
             vrc = RTLdrGetSymbol(gLibrarySDL_ttf, "TTF_Init", (void**)&pTTF_Init);
         if (RT_SUCCESS(vrc))
@@ -1937,15 +2016,16 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
     for (ULONG i = 0; i < gcMonitors; i++)
     {
         // register our framebuffer
-        rc = gpDisplay->SetFramebuffer(i, gpFramebuffer[i]);
+        rc = gpDisplay->AttachFramebuffer(i, gpFramebuffer[i], gaFramebufferId[i].asOutParam());
         if (FAILED(rc))
         {
             RTPrintf("Error: could not register framebuffer object!\n");
             goto leave;
         }
-        IFramebuffer *dummyFb;
+        ULONG dummy;
         LONG xOrigin, yOrigin;
-        rc = gpDisplay->GetFramebuffer(i, &dummyFb, &xOrigin, &yOrigin);
+        GuestMonitorStatus_T monitorStatus;
+        rc = gpDisplay->GetScreenResolution(i, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
         gpFramebuffer[i]->setOrigin(xOrigin, yOrigin);
     }
 
@@ -2130,16 +2210,19 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
      */
     SDL_Event event;
 
-    LogFlow(("Powering up the VM...\n"));
-    rc = gpConsole->PowerUp(gpProgress.asOutParam());
-    if (rc != S_OK)
+    if (!fSeparate)
     {
-        com::ErrorInfo info(gpConsole, COM_IIDOF(IConsole));
-        if (info.isBasicAvailable())
-            PrintError("Failed to power up VM", info.getText().raw());
-        else
-            RTPrintf("Error: failed to power up VM! No error text available.\n");
-        goto leave;
+        LogFlow(("Powering up the VM...\n"));
+        rc = gpConsole->PowerUp(gpProgress.asOutParam());
+        if (rc != S_OK)
+        {
+            com::ErrorInfo info(gpConsole, COM_IIDOF(IConsole));
+            if (info.isBasicAvailable())
+                PrintError("Failed to power up VM", info.getText().raw());
+            else
+                RTPrintf("Error: failed to power up VM! No error text available.\n");
+            goto leave;
+        }
     }
 
 #ifdef USE_XPCOM_QUEUE_THREAD
@@ -2212,19 +2295,18 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
                     }
 
                     /*
-                     * User specific resize event.
+                     * User specific framebuffer change event.
                      */
-                    case SDL_USER_EVENT_RESIZE:
+                    case SDL_USER_EVENT_NOTIFYCHANGE:
                     {
-                        LogFlow(("SDL_USER_EVENT_RESIZE\n"));
-                        IFramebuffer *dummyFb;
+                        LogFlow(("SDL_USER_EVENT_NOTIFYCHANGE\n"));
                         LONG xOrigin, yOrigin;
-                        gpFramebuffer[event.user.code]->resizeGuest();
+                        gpFramebuffer[event.user.code]->notifyChange(event.user.code);
                         /* update xOrigin, yOrigin -> mouse */
-                        rc = gpDisplay->GetFramebuffer(event.user.code, &dummyFb, &xOrigin, &yOrigin);
+                        ULONG dummy;
+                        GuestMonitorStatus_T monitorStatus;
+                        rc = gpDisplay->GetScreenResolution(event.user.code, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
                         gpFramebuffer[event.user.code]->setOrigin(xOrigin, yOrigin);
-                        /* notify the display that the resize has been completed */
-                        gpDisplay->ResizeCompleted(event.user.code);
                         break;
                     }
 
@@ -2311,6 +2393,42 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
         goto leave;
     }
 
+    if (fSeparate && gpMouse)
+    {
+        LogFlow(("Fetching mouse caps\n"));
+
+        /* Fetch current mouse status, etc */
+        gpMouse->COMGETTER(AbsoluteSupported)(&gfAbsoluteMouseGuest);
+        gpMouse->COMGETTER(RelativeSupported)(&gfRelativeMouseGuest);
+        gpMouse->COMGETTER(NeedsHostCursor)(&gfGuestNeedsHostCursor);
+
+        HandleGuestCapsChanged();
+
+        ComPtr<IMousePointerShape> mps;
+        gpMouse->COMGETTER(PointerShape)(mps.asOutParam());
+        if (!mps.isNull())
+        {
+            BOOL  visible,  alpha;
+            ULONG hotX, hotY, width, height;
+            com::SafeArray <BYTE> shape;
+
+            mps->COMGETTER(Visible)(&visible);
+            mps->COMGETTER(Alpha)(&alpha);
+            mps->COMGETTER(HotX)(&hotX);
+            mps->COMGETTER(HotY)(&hotY);
+            mps->COMGETTER(Width)(&width);
+            mps->COMGETTER(Height)(&height);
+            mps->COMGETTER(Shape)(ComSafeArrayAsOutParam(shape));
+
+            if (shape.size() > 0)
+            {
+                PointerShapeChangeData data(visible, alpha, hotX, hotY, width, height,
+                                            ComSafeArrayAsInParam(shape));
+                SetPointerShape(&data);
+            }
+        }
+    }
+
     UpdateTitlebar(TITLEBAR_NORMAL);
 
     /*
@@ -2697,19 +2815,18 @@ DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
             }
 
             /*
-             * User specific resize event.
+             * User specific framebuffer change event.
              */
-            case SDL_USER_EVENT_RESIZE:
+            case SDL_USER_EVENT_NOTIFYCHANGE:
             {
-                LogFlow(("SDL_USER_EVENT_RESIZE\n"));
-                IFramebuffer *dummyFb;
+                LogFlow(("SDL_USER_EVENT_NOTIFYCHANGE\n"));
                 LONG xOrigin, yOrigin;
-                gpFramebuffer[event.user.code]->resizeGuest();
+                gpFramebuffer[event.user.code]->notifyChange(event.user.code);
                 /* update xOrigin, yOrigin -> mouse */
-                rc = gpDisplay->GetFramebuffer(event.user.code, &dummyFb, &xOrigin, &yOrigin);
+                ULONG dummy;
+                GuestMonitorStatus_T monitorStatus;
+                rc = gpDisplay->GetScreenResolution(event.user.code, &dummy, &dummy, &dummy, &xOrigin, &yOrigin, &monitorStatus);
                 gpFramebuffer[event.user.code]->setOrigin(xOrigin, yOrigin);
-                /* notify the display that the resize has been completed */
-                gpDisplay->ResizeCompleted(event.user.code);
                 break;
             }
 
@@ -2814,38 +2931,41 @@ leave:
     else
         machineState = MachineState_Aborted;
 
-    /*
-     * Turn off the VM if it's running
-     */
-    if (   gpConsole
-        && (   machineState == MachineState_Running
-            || machineState == MachineState_Teleporting
-            || machineState == MachineState_LiveSnapshotting
-            /** @todo power off paused VMs too? */
-           )
-       )
-    do
+    if (!fSeparate)
     {
-        pConsoleListener->getWrapped()->ignorePowerOffEvents(true);
-        ComPtr<IProgress> pProgress;
-        CHECK_ERROR_BREAK(gpConsole, PowerDown(pProgress.asOutParam()));
-        CHECK_ERROR_BREAK(pProgress, WaitForCompletion(-1));
-        BOOL completed;
-        CHECK_ERROR_BREAK(pProgress, COMGETTER(Completed)(&completed));
-        ASSERT(completed);
-        LONG hrc;
-        CHECK_ERROR_BREAK(pProgress, COMGETTER(ResultCode)(&hrc));
-        if (FAILED(hrc))
+        /*
+         * Turn off the VM if it's running
+         */
+        if (   gpConsole
+            && (   machineState == MachineState_Running
+                || machineState == MachineState_Teleporting
+                || machineState == MachineState_LiveSnapshotting
+                /** @todo power off paused VMs too? */
+               )
+           )
+        do
         {
-            com::ErrorInfo info;
-            if (info.isFullAvailable())
-                PrintError("Failed to power down VM",
-                           info.getText().raw(), info.getComponent().raw());
-            else
-                RTPrintf("Failed to power down virtual machine! No error information available (rc = 0x%x).\n", hrc);
-            break;
-        }
-    } while (0);
+            pConsoleListener->getWrapped()->ignorePowerOffEvents(true);
+            ComPtr<IProgress> pProgress;
+            CHECK_ERROR_BREAK(gpConsole, PowerDown(pProgress.asOutParam()));
+            CHECK_ERROR_BREAK(pProgress, WaitForCompletion(-1));
+            BOOL completed;
+            CHECK_ERROR_BREAK(pProgress, COMGETTER(Completed)(&completed));
+            ASSERT(completed);
+            LONG hrc;
+            CHECK_ERROR_BREAK(pProgress, COMGETTER(ResultCode)(&hrc));
+            if (FAILED(hrc))
+            {
+                com::ErrorInfo info;
+                if (info.isFullAvailable())
+                    PrintError("Failed to power down VM",
+                               info.getText().raw(), info.getComponent().raw());
+                else
+                    RTPrintf("Failed to power down virtual machine! No error information available (rc = 0x%x).\n", hrc);
+                break;
+            }
+        } while (0);
+    }
 
     /* unregister Console listener */
     if (pConsoleListener)
@@ -2865,7 +2985,7 @@ leave:
         && machineState != MachineState_Saved)
     {
         rc = gpMachine->DiscardSettings();
-        AssertComRC(rc);
+        AssertMsg(SUCCEEDED(rc), ("DiscardSettings %Rhrc, machineState %d\n", rc, machineState));
     }
 
     /* close the session */
@@ -2916,7 +3036,7 @@ leave:
     if (gpDisplay)
     {
         for (unsigned i = 0; i < gcMonitors; i++)
-            gpDisplay->SetFramebuffer(i, NULL);
+            gpDisplay->DetachFramebuffer(i, gaFramebufferId[i].raw());
     }
 
     gpMouse = NULL;
@@ -4087,7 +4207,7 @@ void SaveState(void)
     RTThreadYield();
     UpdateTitlebar(TITLEBAR_SAVE);
     gpProgress = NULL;
-    HRESULT rc = gpConsole->SaveState(gpProgress.asOutParam());
+    HRESULT rc = gpMachine->SaveState(gpProgress.asOutParam());
     if (FAILED(rc))
     {
         RTPrintf("Error saving state! rc = 0x%x\n", rc);
@@ -4182,7 +4302,7 @@ void SaveState(void)
                 /*
                  * Ignore all other events.
                  */
-                case SDL_USER_EVENT_RESIZE:
+                case SDL_USER_EVENT_NOTIFYCHANGE:
                 case SDL_USER_EVENT_TERMINATE:
                 default:
                     break;
@@ -4837,8 +4957,9 @@ static int HandleHostKey(const SDL_KeyboardEvent *pEv)
             RTStrPrintf(pszSnapshotName, sizeof(pszSnapshotName), "Snapshot %d", cSnapshots + 1);
             gpProgress = NULL;
             HRESULT rc;
-            CHECK_ERROR(gpConsole, TakeSnapshot(Bstr(pszSnapshotName).raw(),
+            CHECK_ERROR(gpMachine, TakeSnapshot(Bstr(pszSnapshotName).raw(),
                                                 Bstr("Taken by VBoxSDL").raw(),
+						TRUE,
                                                 gpProgress.asOutParam()));
             if (FAILED(rc))
             {
diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDL.h b/src/VBox/Frontends/VBoxSDL/VBoxSDL.h
index 038ab10..8b1ad01 100644
--- a/src/VBox/Frontends/VBoxSDL/VBoxSDL.h
+++ b/src/VBox/Frontends/VBoxSDL/VBoxSDL.h
@@ -1,3 +1,4 @@
+/* $Id: VBoxSDL.h $ */
 /** @file
  *
  * VBox frontends: VBoxSDL (simple frontend based on SDL):
@@ -19,6 +20,7 @@
 #ifndef __H_VBOXSDL
 #define __H_VBOXSDL
 
+#include <iprt/cdefs.h>
 #ifdef RT_OS_WINDOWS /** @todo check why we need to do this on windows. */
 /* convince SDL to not overload main() */
 #define _SDL_main_h
@@ -28,8 +30,8 @@
 
 /** custom SDL event for display update handling */
 #define SDL_USER_EVENT_UPDATERECT         (SDL_USEREVENT + 4)
-/** custom SDL event for resize handling */
-#define SDL_USER_EVENT_RESIZE             (SDL_USEREVENT + 5)
+/** custom SDL event for changing the guest resolution */
+#define SDL_USER_EVENT_NOTIFYCHANGE       (SDL_USEREVENT + 5)
 /** custom SDL for XPCOM event queue processing */
 #define SDL_USER_EVENT_XPCOM_EVENTQUEUE   (SDL_USEREVENT + 6)
 /** custom SDL event for updating the titlebar */
@@ -72,4 +74,10 @@ void PushNotifyUpdateEvent(SDL_Event *event);
 #endif
 int  PushSDLEventForSure(SDL_Event *event);
 
-#endif // __H_VBOXSDL
+#ifdef RT_OS_DARWIN
+RT_C_DECLS_BEGIN
+void *VBoxSDLGetDarwinWindowId(void);
+RT_C_DECLS_END
+#endif
+
+#endif
diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDL.rc b/src/VBox/Frontends/VBoxSDL/VBoxSDL.rc
deleted file mode 100644
index 3f20457..0000000
--- a/src/VBox/Frontends/VBoxSDL/VBoxSDL.rc
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $Id: VBoxSDL.rc $ */
-/** @file
- * VBox purge SDL frontent - Windows resource file.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
-  FILEFLAGS        VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
-#else
-  FILEFLAGS        0 // final version
-#endif
-  FILEOS           VOS_NT_WINDOWS32
-#ifdef VBOXR3_HARDENED_DLL
-  FILETYPE         VFT_APP
-#else
-  FILETYPE         VFT_DLL
-#endif
-  FILESUBTYPE      0   // not used
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox Pure SDL Frontend\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-#ifdef VBOXR3_HARDENED_DLL
-      VALUE "InternalName",     "VBoxSDL\0"
-#else
-      VALUE "InternalName",     "VBoxSDL\0"
-#endif
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-#ifdef VBOXR3_HARDENED_DLL
-      VALUE "OriginalFilename", "VBoxSDL.dll\0"
-#else
-      VALUE "OriginalFilename", "VBoxSDL.exe\0"
-#endif
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1252
-  END
-END
-
-/* Creates the application icon. */
-#include "VBoxSDL-icon.rc"
-
diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.h b/src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.h
index 4683df5..ef9c104 100644
--- a/src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.h
+++ b/src/VBox/Frontends/VBoxSDL/VBoxSDLMain-darwin.h
@@ -1,3 +1,4 @@
+/* $Id:  $ */
 /*   SDLMain.m - main entry point for our Cocoa-ized SDL app
        Initial Version: Darrell Walisser <dwaliss1 at purdue.edu>
        Non-NIB-Code & other changes: Max Horn <max at quendi.de>
diff --git a/src/VBox/Frontends/VBoxSDL/VBoxSDLTest.cpp b/src/VBox/Frontends/VBoxSDL/VBoxSDLTest.cpp
index 159266a..1cb0b5a 100644
--- a/src/VBox/Frontends/VBoxSDL/VBoxSDLTest.cpp
+++ b/src/VBox/Frontends/VBoxSDL/VBoxSDLTest.cpp
@@ -1,3 +1,4 @@
+/* $Id: VBoxSDLTest.cpp $ */
 /** @file
  *
  * VBox frontends: VBoxSDL (simple frontend based on SDL):
diff --git a/src/VBox/Frontends/VBoxShell/vboxshell.py b/src/VBox/Frontends/VBoxShell/vboxshell.py
index 92a0354..f7a3cfd 100755
--- a/src/VBox/Frontends/VBoxShell/vboxshell.py
+++ b/src/VBox/Frontends/VBoxShell/vboxshell.py
@@ -20,7 +20,7 @@ P.S. Our apologies for the code quality.
 
 __copyright__ = \
 """
-Copyright (C) 2009-2013 Oracle Corporation
+Copyright (C) 2009-2015 Oracle Corporation
 
 This file is part of VirtualBox Open Source Edition (OSE), as
 available from http://www.virtualbox.org. This file is free software;
@@ -30,7 +30,7 @@ Foundation, in version 2 as it comes in the "COPYING" file of the
 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 """
-__version__ = "$Revision: 92173 $"
+__version__ = "$Revision: 99520 $"
 
 
 import os, sys
@@ -249,9 +249,13 @@ def removeVm(ctx, mach):
     uuid = mach.id
     print "removing machine ", mach.name, "with UUID", uuid
     cmdClosedVm(ctx, mach, detachVmDevice, ["ALL"])
-    mach = mach.unregister(ctx['global'].constants.CleanupMode_Full)
+    disks = mach.unregister(ctx['global'].constants.CleanupMode_Full)
     if mach:
-        mach.deleteSettings()
+        progress = mach.deleteConfig(disks)
+        if progressBar(ctx, progress, 100) and int(progress.resultCode) == 0:
+            print "Success!"
+        else:
+            reportError(ctx, progress)
     # update cache
     getMachines(ctx, True)
 
@@ -314,7 +318,7 @@ def asFlag(var):
 def getFacilityStatus(ctx, guest, facilityType):
     (status, _timestamp) = guest.getFacilityStatus(facilityType)
     return asEnumElem(ctx, 'AdditionsFacilityStatus', status)
-        
+
 def perfStats(ctx, mach):
     if not ctx['perf']:
         return
@@ -377,7 +381,7 @@ def monitorSource(ctx, eventSource, active, dur):
             if mtev:
                 printMultiTouchEvent(ctx, mtev)
 
-    class EventListener:
+    class EventListener(object):
         def __init__(self, arg):
             pass
 
@@ -544,7 +548,7 @@ def takeScreenshotOld(_ctx, console, args):
         screen = int(args[3])
     else:
         screen = 0
-    (fbw, fbh, _fbbpp, fbx, fby) = display.getScreenResolution(screen)
+    (fbw, fbh, _fbbpp, fbx, fby, _) = display.getScreenResolution(screen)
     if len(args) > 1:
         w = int(args[1])
     else:
@@ -555,7 +559,7 @@ def takeScreenshotOld(_ctx, console, args):
         h = fbh
 
     print "Saving screenshot (%d x %d) screen %d in %s..." % (w, h, screen, f)
-    data = display.takeScreenShotToArray(screen, w, h)
+    data = display.takeScreenShotToArray(screen, w, h, ctx['const'].BitmapFormat_RGBA)
     size = (w, h)
     mode = "RGBA"
     im = Image.frombuffer(mode, size, str(data), "raw", mode, 0, 1)
@@ -571,7 +575,7 @@ def takeScreenshot(_ctx, console, args):
         screen = int(args[3])
     else:
         screen = 0
-    (fbw, fbh, _fbbpp, fbx, fby) = display.getScreenResolution(screen)
+    (fbw, fbh, _fbbpp, fbx, fby, _) = display.getScreenResolution(screen)
     if len(args) > 1:
         w = int(args[1])
     else:
@@ -582,7 +586,7 @@ def takeScreenshot(_ctx, console, args):
         h = fbh
 
     print "Saving screenshot (%d x %d) screen %d in %s..." % (w, h, screen, f)
-    data = display.takeScreenShotPNGToArray(screen, w, h)
+    data = display.takeScreenShotToArray(screen, w, h, ctx['const'].BitmapFormat_PNG)
     pngfile = open(f, 'wb')
     pngfile.write(data)
     pngfile.close()
@@ -717,7 +721,7 @@ def cmdExistingVm(ctx, mach, cmd, args):
            'guest':           lambda: guestExec(ctx, mach, console, args),
            'ginfo':           lambda: ginfo(ctx, console, args),
            'guestlambda':     lambda: args[0](ctx, mach, console, args[1:]),
-           'save':            lambda: progressBar(ctx, console.saveState()),
+           'save':            lambda: progressBar(ctx, session.machine.saveState()),
            'screenshot':      lambda: takeScreenshot(ctx, console, args),
            'teleport':        lambda: teleport(ctx, session, console, args),
            'gueststats':      lambda: guestStats(ctx, console, args),
@@ -2208,7 +2212,7 @@ def createHddCmd(ctx, args):
     else:
         fmt = "vdi"
 
-    hdd = ctx['vb'].createHardDisk(format, loc)
+    hdd = ctx['vb'].createMedium(format, loc, ctx['global'].constants.AccessMode_ReadWrite, ctx['global'].constants.DeviceType_HardDisk)
     progress = hdd.createBaseStorage(size, (ctx['global'].constants.MediumVariant_Standard, ))
     if progressBar(ctx,progress) and hdd.id:
         print "created HDD at %s as %s" % (colPath(ctx,hdd.location), hdd.id)
@@ -2630,7 +2634,7 @@ def snapshotCmd(ctx, args):
             desc = args[4]
         else:
             desc = ""
-        cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, console.takeSnapshot(name, desc)))
+        cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, mach.takeSnapshot(name, desc, true)))
         return 0
 
     if cmd == 'restore':
@@ -2639,7 +2643,7 @@ def snapshotCmd(ctx, args):
             return 0
         name = args[3]
         snap = mach.findSnapshot(name)
-        cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, console.restoreSnapshot(snap)))
+        cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, mach.restoreSnapshot(snap)))
         return 0
 
     if cmd == 'restorecurrent':
@@ -2647,7 +2651,7 @@ def snapshotCmd(ctx, args):
             print "usage: snapshot vm restorecurrent"
             return 0
         snap = mach.currentSnapshot()
-        cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, console.restoreSnapshot(snap)))
+        cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, mach.restoreSnapshot(snap)))
         return 0
 
     if cmd == 'delete':
@@ -2656,7 +2660,7 @@ def snapshotCmd(ctx, args):
             return 0
         name = args[3]
         snap = mach.findSnapshot(name)
-        cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, console.deleteSnapshot(snap.id)))
+        cmdAnyVm(ctx, mach, lambda ctx, mach, console, args: progressBar(ctx, mach.deleteSnapshot(snap.id)))
         return 0
 
     print "Command '%s' is unknown" % (cmd)
@@ -3556,6 +3560,7 @@ def main(argv):
         if sPath is None:
             for sCurLoc in asLocations:
                 if os.path.isfile(os.path.join(sCurLoc, "sdk", "bindings", "VirtualBox.xidl")):
+                    sCurLoc = os.path.join(sCurLoc, "sdk");
                     print "Autodetected VBOX_SDK_PATH as", sCurLoc
                     os.environ["VBOX_SDK_PATH"] = sCurLoc
                     sPath = sCurLoc;
diff --git a/src/VBox/Frontends/VirtualBox/Doxyfile b/src/VBox/Frontends/VirtualBox/Doxyfile
new file mode 100644
index 0000000..afd1ebe
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/Doxyfile
@@ -0,0 +1,1509 @@
+# Doxyfile 1.5.6
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = VirtualBox Qt GUI
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+#OUTPUT_DIRECTORY       =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
+# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
+# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish,
+# and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = \
+    "note=@remark"
+
+# Interface method implementation macros.
+ALIASES                += \
+    interface_method_impl{2}="Implements \1 method \link \1::\2 \2 \endlink @copydoc \1::\2 "
+ALIASES                += \
+    interface_method_impl{3}="\3. \
+\
+Implements \1 method \link \1::\2 \2 \endlink @copydoc \1::\2 "
+
+# Callback method implementation macros.
+ALIASES                += \
+    callback_method_impl{1}="Implements the callback \link \1 \1  \endlink @copydoc \1 "
+ALIASES                += \
+    callback_method_impl{2}="\2. \
+\
+Implements the callback \link \1 \1 "
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.  This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+#WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+#INPUT                  =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+#FILE_PATTERNS          =
+
+
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.  Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.  The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.  Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to FRAME, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature. Other possible values
+# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list;
+# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
+# disables this behavior completely. For backwards compatibility with previous
+# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
+# respectively.
+
+GENERATE_TREEVIEW      = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.  This is useful
+# if you want to understand what is going on.  On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+#INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+#INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             = \
+    DOXYGEN_RUNNING \
+    RT_C_DECLS_END=  \
+    RT_C_DECLS_BEGIN=  \
+    VBOX=1 \
+    RT_STRICT=1 \
+    __cplusplus=1 \
+    RTCALL= \
+    ARCH_BITS=HC_ARCH_BITS \
+    R3_ARCH_BITS=HC_ARCH_BITS \
+    R0_ARCH_BITS=HC_ARCH_BITS \
+    RTDECL(type)=type \
+    RT_EXPORT_SYMBOL(name)= \
+    \
+    "DECLINLINE(type)=inline type" \
+    DECL_FORCE_INLINE(type)=DECLINLINE(type) \
+    \
+    AssertCompile(expr) \
+    AssertCompileSize(a,b) \
+    AssertCompileSizeAlignment(a,b) \
+    AssertCompileMemberSizeAlignment(a,b,c) \
+    AssertCompileMemberAlignment(a,b,c) \
+    AssertCompileMemberOffset(a,b,c) \
+    AssertCompile2MemberOffsets(a,b,c) \
+    \
+    RT_OS_DARWIN \
+    Q_WS_MAC \
+    Q_WS_X11 \
+    Q_WS_WIN
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = \
+    ARCH_BITS \
+    GC_ARCH_BITS \
+    HC_ARCH_BITS \
+    R3_ARCH_BITS \
+    R0_ARCH_BITS \
+    \
+    GCTYPE \
+    GCPTRTYPE \
+    HCPTRTYPE \
+    R0PTRTYPE \
+    R3PTRTYPE \
+    R3R0PTRTYPE \
+    \
+    DECLEXPORT \
+    DECLIMPORT \
+    DECLHIDDEN \
+    DECLASM \
+    DECLASMTYPE \
+    DECLCALLBACK \
+    DECLCALLBACKMEMBER \
+    DECLHCCALLBACKMEMBER \
+    DECLRCCALLBACKMEMBER \
+    DECLR3CALLBACKMEMBER \
+    DECLR0CALLBACKMEMBER \
+    RTR3DECL \
+    RTR0DECL \
+    RTRCDECL \
+    RTDECL \
+    RTDATADECL \
+    KAVL_FN \
+    \
+    CTXSUFF \
+    OTHERCTXSUFF \
+    CTXMID \
+    OTHERCTXMID \
+    \
+    RT_SRC_POS \
+    RT_SRC_POS_ARGS \
+    RT_SRC_POS_DECL
+
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+#SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#   TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#   TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME           = FreeSans
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = YES
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is enabled by default, which results in a transparent
+# background. Warning: Depending on the platform used, enabling this option
+# may lead to badly anti-aliased labels on the edges of a graph (i.e. they
+# become hard to read).
+
+DOT_TRANSPARENT        = YES
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE           = YES
+
+#
+# The next bit is generated by the Makefile.
+#
+
diff --git a/src/VBox/Frontends/VirtualBox/Makefile.kmk b/src/VBox/Frontends/VirtualBox/Makefile.kmk
index b0828d3..327431a 100644
--- a/src/VBox/Frontends/VirtualBox/Makefile.kmk
+++ b/src/VBox/Frontends/VirtualBox/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2006-2013 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -83,13 +83,12 @@ VirtualBox_SDKS.win = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK)
 
 VirtualBox_DEFS           =
 VirtualBox_DEFS.debug     = VBOX_CHECK_STATE # QT_FATAL_ASSERT
-VirtualBox_DEFS.darwin    = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_QUARTZ2D VBOX_WITH_TRANSLUCENT_SEAMLESS
-VirtualBox_DEFS.freebsd   = VBOX_GUI_USE_QIMAGE
-VirtualBox_DEFS.linux     = VBOX_GUI_USE_QIMAGE
-VirtualBox_DEFS.netbsd    = VBOX_GUI_USE_QIMAGE
-VirtualBox_DEFS.openbsd   = VBOX_GUI_USE_QIMAGE
-VirtualBox_DEFS.solaris   = VBOX_GUI_USE_QIMAGE
-VirtualBox_DEFS.win       = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
+VirtualBox_DEFS.linux     = VBOX_WITH_MASKED_SEAMLESS VBOX_WITH_TRANSLUCENT_SEAMLESS
+VirtualBox_DEFS.solaris   = VBOX_WITH_MASKED_SEAMLESS VBOX_WITH_TRANSLUCENT_SEAMLESS
+VirtualBox_DEFS.freebsd   = VBOX_WITH_MASKED_SEAMLESS VBOX_WITH_TRANSLUCENT_SEAMLESS
+VirtualBox_DEFS.darwin    = VBOX_WITH_TRANSLUCENT_SEAMLESS # VBOX_WITH_MASKED_SEAMLESS
+VirtualBox_DEFS.win       = VBOX_WITH_MASKED_SEAMLESS # VBOX_WITH_TRANSLUCENT_SEAMLESS
+VirtualBox_DEFS.win       += UNICODE QT_DLL
 ifdef VBOX_WITH_ICHAT_THEATER
  VirtualBox_DEFS.darwin += VBOX_WITH_ICHAT_THEATER
 endif
@@ -150,8 +149,10 @@ VBOX_GUI_INC_DIRS = \
 	./src/converter \
 	./src/extensions \
 	./src/extensions/graphics \
+	./src/extradata \
 	./src/globals \
 	./src/medium \
+	./src/objects \
 	./src/platform \
 	./src/platform/darwin \
 	./src/platform/win \
@@ -182,7 +183,7 @@ ifdef VBOX_GUI_WITH_NETWORK_MANAGER
 VBOX_GUI_INC_DIRS += \
 	./src/net
 endif
-	
+
 VirtualBox_INCS = \
 	$(VBOX_GUI_INC_DIRS) \
 	$(VirtualBox_0_OUTDIR)/include
@@ -190,7 +191,7 @@ VirtualBox_INCS = \
 # Necessary for the hdd backend enumeration
 VirtualBox_LIBS = $(LIB_DDU)
 
-if1of ($(KBUILD_TARGET), linux freebsd netbsd openbsd)
+if1of ($(KBUILD_TARGET), linux netbsd openbsd)
  VirtualBox_LIBS += dl
 endif
 
@@ -254,7 +255,7 @@ VirtualBox_QT_MOCHDRS = \
 	src/VBoxLicenseViewer.h \
 	src/VBoxSnapshotDetailsDlg.h \
 	src/VBoxTakeSnapshotDlg.h \
-	src/VBoxVMInformationDlg.h \
+	src/UIVMInfoDialog.h \
 	src/UIVMLogViewer.h \
 	src/extensions/QIAdvancedSlider.h \
 	src/extensions/QIArrowButtonPress.h \
@@ -266,25 +267,27 @@ VirtualBox_QT_MOCHDRS = \
 	src/extensions/QILabelSeparator.h \
 	src/extensions/QIListView.h \
 	src/extensions/QIMainDialog.h \
+	src/extensions/QIMenu.h \
 	src/extensions/QIMessageBox.h \
 	src/extensions/QIProcess.h \
 	src/extensions/QIRichTextLabel.h \
 	src/extensions/QIRichToolButton.h \
 	src/extensions/QISplitter.h \
-	src/extensions/QIStateIndicator.h \
 	src/extensions/QIStatusBar.h \
+	src/extensions/QIStatusBarIndicator.h \
+	src/extensions/QIStyledItemDelegate.h \
 	src/extensions/QITabWidget.h \
 	src/extensions/QITableView.h \
 	src/extensions/QIToolButton.h \
-	src/extensions/QITextEdit.h \
 	src/extensions/QITreeView.h \
 	src/extensions/QITreeWidget.h \
 	src/extensions/QIWidgetValidator.h \
 	src/extensions/QIAdvancedToolBar.h \
 	src/extensions/graphics/QIGraphicsWidget.h \
+	src/extradata/UIExtraDataDefs.h \
+	src/extradata/UIExtraDataManager.h \
 	src/globals/UIActionPool.h \
 	src/globals/UIAnimationFramework.h \
-	src/globals/UIExtraDataEventHandler.h \
 	src/globals/UIMainEventListener.h \
 	src/globals/UIMessageCenter.h \
 	src/globals/UIModalWindowManager.h \
@@ -296,6 +299,7 @@ VirtualBox_QT_MOCHDRS = \
 	src/medium/UIMediumEnumerator.h \
 	src/medium/UIMediumManager.h \
 	src/runtime/UIActionPoolRuntime.h \
+	src/runtime/UIAddDiskEncryptionPasswordDialog.h \
 	src/runtime/UIConsoleEventHandler.h \
 	src/runtime/UIFrameBuffer.h \
 	src/runtime/UIIndicatorsPool.h \
@@ -304,9 +308,12 @@ VirtualBox_QT_MOCHDRS = \
 	src/runtime/UIMachineLogic.h \
 	src/runtime/UIMachineWindow.h \
 	src/runtime/UIMachineView.h \
+	src/runtime/UIMenuBarEditorWindow.h \
 	src/runtime/UIMouseHandler.h \
 	src/runtime/UIMultiScreenLayout.h \
 	src/runtime/UISession.h \
+	src/runtime/UISlidingToolBar.h \
+	src/runtime/UIStatusBarEditorWindow.h \
 	src/runtime/UIVMCloseDialog.h \
 	src/runtime/fullscreen/UIKeyboardHandlerFullscreen.h \
 	src/runtime/fullscreen/UIMachineLogicFullscreen.h \
@@ -350,6 +357,7 @@ VirtualBox_QT_MOCHDRS = \
 	src/settings/UISettingsDialog.h \
 	src/settings/UISettingsDialogSpecific.h \
 	src/settings/UISettingsPage.h \
+	src/settings/UISettingsSerializer.h \
 	src/settings/VBoxSettingsSelector.h \
 	src/settings/global/UIGlobalSettingsExtension.h \
 	src/settings/global/UIGlobalSettingsGeneral.h \
@@ -363,6 +371,7 @@ VirtualBox_QT_MOCHDRS = \
 	src/settings/machine/UIMachineSettingsAudio.h \
 	src/settings/machine/UIMachineSettingsDisplay.h \
 	src/settings/machine/UIMachineSettingsGeneral.h \
+	src/settings/machine/UIMachineSettingsInterface.h \
 	src/settings/machine/UIMachineSettingsNetwork.h \
 	src/settings/machine/UIMachineSettingsParallel.h \
 	src/settings/machine/UIMachineSettingsPortForwardingDlg.h \
@@ -381,6 +390,7 @@ VirtualBox_QT_MOCHDRS = \
 	src/widgets/UIHostComboEditor.h \
 	src/widgets/UIHotKeyEditor.h \
 	src/widgets/UILineTextEdit.h \
+	src/widgets/UIMenuBar.h \
 	src/widgets/UIPopupBox.h \
 	src/widgets/UIPopupPane.h \
 	src/widgets/UIPopupPaneTextPane.h \
@@ -391,17 +401,19 @@ VirtualBox_QT_MOCHDRS = \
 	src/widgets/UIProgressDialog.h \
 	src/widgets/UISpacerWidgets.h \
 	src/widgets/UISpecialControls.h \
+	src/widgets/UIToolBar.h \
 	src/widgets/VBoxFilePathSelectorWidget.h \
 	src/widgets/VBoxMediaComboBox.h \
 	src/widgets/UIMiniToolBar.h \
 	src/widgets/VBoxOSTypeSelectorButton.h \
 	src/widgets/UINameAndSystemEditor.h \
-    src/widgets/UIWarningPane.h \
+	src/widgets/UIWarningPane.h \
 	src/widgets/UIFilmContainer.h \
 	src/widgets/graphics/UIGraphicsButton.h \
 	src/widgets/graphics/UIGraphicsRotatorButton.h \
 	src/widgets/graphics/UIGraphicsZoomButton.h \
 	src/widgets/graphics/UIGraphicsToolBar.h \
+	src/widgets/graphics/UIGraphicsTextPane.h \
 	src/wizards/UIWizard.h \
 	src/wizards/UIWizardPage.h \
 	src/wizards/newvm/UIWizardNewVM.h \
@@ -439,7 +451,7 @@ VirtualBox_QT_MOCHDRS = \
 	src/wizards/firstrun/UIWizardFirstRunPageBasic.h
 
 ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-VirtualBox_QT_MOCHDRS += \
+ VirtualBox_QT_MOCHDRS += \
 	src/net/UINetworkManager.h \
 	src/net/UINetworkManagerDialog.h \
 	src/net/UINetworkManagerIndicator.h \
@@ -456,27 +468,36 @@ VirtualBox_QT_MOCHDRS += \
 	src/settings/global/UIGlobalSettingsUpdate.h
 endif
 
+ifdef VBOX_WITH_DRAG_AND_DROP
+ VirtualBox_QT_MOCHDRS += \
+	src/runtime/UIDnDHandler.h
+ ifdef VBOX_WITH_DRAG_AND_DROP_GH
+  VirtualBox_QT_MOCHDRS += \
+	src/runtime/UIDnDMIMEData.h
+ endif
+endif
+
 VirtualBox_QT_MOCHDRS.darwin += \
     src/platform/darwin/UIWindowMenuManager.h
 
 # Sources containing local definitions of classes that use the Q_OBJECT macro.
 VirtualBox_QT_MOCSRCS = \
 	src/UIVMLogViewer.cpp \
+	src/extensions/QIArrowSplitter.cpp \
 	src/extensions/QISplitter.cpp \
 	src/extensions/QIAdvancedToolBar.cpp \
+	src/extradata/UIExtraDataManager.cpp \
 	src/globals/UIActionPool.cpp \
-	src/globals/UIExtraDataEventHandler.cpp \
 	src/globals/UIThreadPool.cpp \
 	src/medium/UIMediumEnumerator.cpp \
 	src/medium/UIMediumManager.cpp \
 	src/runtime/UIActionPoolRuntime.cpp \
+	src/runtime/UIAddDiskEncryptionPasswordDialog.cpp \
+	src/runtime/UIFrameBuffer.cpp \
 	src/runtime/UIIndicatorsPool.cpp \
-	src/runtime/UIMachine.cpp \
-	src/runtime/UIMachineMenuBar.cpp \
+	src/runtime/UIStatusBarEditorWindow.cpp \
 	src/selector/UIActionPoolSelector.cpp \
 	src/selector/UIVMDesktop.cpp \
-	src/settings/UISettingsDialogSpecific.cpp \
-	src/settings/global/UIGlobalSettingsInput.cpp \
 	src/settings/machine/UIMachineSettingsStorage.cpp \
 	src/settings/machine/UIMachineSettingsUSB.cpp \
 	src/widgets/UIHotKeyEditor.cpp \
@@ -484,7 +505,7 @@ VirtualBox_QT_MOCSRCS = \
 	src/wizards/importappliance/UIWizardImportApp.cpp
 
 ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-VirtualBox_QT_MOCSRCS += \
+ VirtualBox_QT_MOCSRCS += \
 	src/net/UINetworkReply.cpp \
 	src/net/UIUpdateManager.cpp
 endif
@@ -507,7 +528,7 @@ VirtualBox_SOURCES = \
 	src/VBoxLicenseViewer.cpp \
 	src/VBoxSnapshotDetailsDlg.cpp \
 	src/VBoxTakeSnapshotDlg.cpp \
-	src/VBoxVMInformationDlg.cpp \
+	src/UIVMInfoDialog.cpp \
 	src/UIVMLogViewer.cpp \
 	src/converter/UIConverter.cpp \
 	src/converter/UIConverterBackendCOM.cpp \
@@ -524,25 +545,26 @@ VirtualBox_SOURCES = \
 	src/extensions/QILineEdit.cpp \
 	src/extensions/QIListView.cpp \
 	src/extensions/QIMainDialog.cpp \
+	src/extensions/QIMenu.cpp \
 	src/extensions/QIMessageBox.cpp \
 	src/extensions/QIProcess.cpp \
 	src/extensions/QIRichTextLabel.cpp \
 	src/extensions/QIRichToolButton.cpp \
 	src/extensions/QISplitter.cpp \
-	src/extensions/QIStateIndicator.cpp \
 	src/extensions/QIStatusBar.cpp \
+	src/extensions/QIStatusBarIndicator.cpp \
 	src/extensions/QITableView.cpp \
-	src/extensions/QITextEdit.cpp \
 	src/extensions/QITreeView.cpp \
 	src/extensions/QITreeWidget.cpp \
 	src/extensions/QIWidgetValidator.cpp \
 	src/extensions/QIAdvancedToolBar.cpp \
 	src/extensions/graphics/QIGraphicsWidget.cpp \
+	src/extradata/UIExtraDataDefs.cpp \
+	src/extradata/UIExtraDataManager.cpp \
 	src/globals/UIDefs.cpp \
 	src/globals/COMDefs.cpp \
 	src/globals/UIActionPool.cpp \
 	src/globals/UIAnimationFramework.cpp \
-	src/globals/UIExtraDataEventHandler.cpp \
 	src/globals/UIIconPool.cpp \
 	src/globals/UIImageTools.cpp \
 	src/globals/UIMainEventListener.cpp \
@@ -556,20 +578,23 @@ VirtualBox_SOURCES = \
 	src/medium/UIMedium.cpp \
 	src/medium/UIMediumEnumerator.cpp \
 	src/medium/UIMediumManager.cpp \
+	src/objects/UIRichTextString.cpp \
 	src/runtime/UIActionPoolRuntime.cpp \
+	src/runtime/UIAddDiskEncryptionPasswordDialog.cpp \
 	src/runtime/UIConsoleEventHandler.cpp \
 	src/runtime/UIFrameBuffer.cpp \
-	src/runtime/UIFrameBufferQImage.cpp \
 	src/runtime/UIIndicatorsPool.cpp \
 	src/runtime/UIKeyboardHandler.cpp \
 	src/runtime/UIMachine.cpp \
 	src/runtime/UIMachineLogic.cpp \
-	src/runtime/UIMachineMenuBar.cpp \
 	src/runtime/UIMachineView.cpp \
 	src/runtime/UIMachineWindow.cpp \
+	src/runtime/UIMenuBarEditorWindow.cpp \
 	src/runtime/UIMouseHandler.cpp \
 	src/runtime/UIMultiScreenLayout.cpp \
 	src/runtime/UISession.cpp \
+	src/runtime/UISlidingToolBar.cpp \
+	src/runtime/UIStatusBarEditorWindow.cpp \
 	src/runtime/UIVMCloseDialog.cpp \
 	src/runtime/fullscreen/UIKeyboardHandlerFullscreen.cpp \
 	src/runtime/fullscreen/UIMachineLogicFullscreen.cpp \
@@ -614,6 +639,7 @@ VirtualBox_SOURCES = \
 	src/settings/UISettingsDialog.cpp \
 	src/settings/UISettingsDialogSpecific.cpp \
 	src/settings/UISettingsPage.cpp \
+	src/settings/UISettingsSerializer.cpp \
 	src/settings/VBoxSettingsSelector.cpp \
 	src/settings/global/UIGlobalSettingsExtension.cpp \
 	src/settings/global/UIGlobalSettingsGeneral.cpp \
@@ -627,6 +653,7 @@ VirtualBox_SOURCES = \
 	src/settings/machine/UIMachineSettingsAudio.cpp \
 	src/settings/machine/UIMachineSettingsDisplay.cpp \
 	src/settings/machine/UIMachineSettingsGeneral.cpp \
+	src/settings/machine/UIMachineSettingsInterface.cpp \
 	src/settings/machine/UIMachineSettingsNetwork.cpp \
 	src/settings/machine/UIMachineSettingsParallel.cpp \
 	src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp \
@@ -645,6 +672,7 @@ VirtualBox_SOURCES = \
 	src/widgets/UIHostComboEditor.cpp \
 	src/widgets/UIHotKeyEditor.cpp \
 	src/widgets/UILineTextEdit.cpp \
+	src/widgets/UIMenuBar.cpp \
 	src/widgets/UIPopupBox.cpp \
 	src/widgets/UIPopupPane.cpp \
 	src/widgets/UIPopupPaneTextPane.cpp \
@@ -661,12 +689,13 @@ VirtualBox_SOURCES = \
 	src/widgets/UIMiniToolBar.cpp \
 	src/widgets/VBoxOSTypeSelectorButton.cpp \
 	src/widgets/UINameAndSystemEditor.cpp \
-    src/widgets/UIWarningPane.cpp \
+	src/widgets/UIWarningPane.cpp \
 	src/widgets/UIFilmContainer.cpp \
 	src/widgets/graphics/UIGraphicsButton.cpp \
 	src/widgets/graphics/UIGraphicsRotatorButton.cpp \
 	src/widgets/graphics/UIGraphicsZoomButton.cpp \
 	src/widgets/graphics/UIGraphicsToolBar.cpp \
+	src/widgets/graphics/UIGraphicsTextPane.cpp \
 	src/wizards/UIWizard.cpp \
 	src/wizards/UIWizardPage.cpp \
 	src/wizards/newvm/UIWizardNewVM.cpp \
@@ -726,7 +755,6 @@ VirtualBox_SOURCES.darwin += \
 	src/platform/darwin/UIAbstractDockIconPreview.cpp \
 	src/platform/darwin/UICocoaDockIconPreview.mm \
 	src/platform/darwin/UIWindowMenuManager.cpp \
-	src/runtime/UIFrameBufferQuartz2D.cpp
 
 if1of ($(KBUILD_TARGET), freebsd linux netbsd openbsd solaris) # X11
  VirtualBox_SOURCES += \
@@ -768,8 +796,14 @@ endif
 ifdef VBOX_WITH_DRAG_AND_DROP
  VirtualBox_SOURCES += \
 	src/runtime/UIDnDHandler.cpp
- VirtualBox_QT_MOCSRCS += \
-	src/runtime/UIDnDHandler.cpp
+ ifdef VBOX_WITH_DRAG_AND_DROP_GH
+  VirtualBox_SOURCES += \
+	src/runtime/UIDnDMIMEData.cpp
+  VirtualBox_SOURCES.win += \
+	src/runtime/UIDnDDropSource_win.cpp \
+	src/runtime/UIDnDDataObject_win.cpp \
+	src/runtime/UIDnDEnumFormat_win.cpp
+ endif
 endif
 
 # The Qt modules we're using.
@@ -787,6 +821,10 @@ VirtualBox_SOURCES            += VirtualBox1.qrc
 VirtualBox1.qrc_RCCFLAGS       = -name BASIC1
 VirtualBox_SOURCES            += VirtualBox2.qrc
 VirtualBox2.qrc_RCCFLAGS       = -name BASIC2
+VirtualBox_SOURCES             += VirtualBox1_hidpi.qrc
+VirtualBox1_hidpi.qrc_RCCFLAGS  = -name BASIC1_HIDPI
+VirtualBox_SOURCES             += VirtualBox2_hidpi.qrc
+VirtualBox2_hidpi.qrc_RCCFLAGS  = -name BASIC2_HIDPI
 ifeq ($(KBUILD_TARGET),darwin)
  VirtualBox_SOURCES           += VirtualBoxMac.qrc
  VirtualBoxMac.qrc_RCCFLAGS    = -name MAC
@@ -863,7 +901,9 @@ $(VBOX_VIRTUALBOX4_OUT_DIR)/VirtualBoxBrand.qrc: \
 	$(call MSG_GENERATE,VirtualBox,$<,$@)
 	$(QUIET)$(SED) \
 		-e 's;@VBOX_ABOUT_PNG@;$(VBOX_BRAND_GUI_ABOUT_PNG);g' \
+		-e 's;@VBOX_ABOUT_HIDPI_PNG@;$(VBOX_BRAND_GUI_ABOUT_HIDPI_PNG);g' \
 		-e 's;@VBOX_ABOUT_16PX_PNG@;$(VBOX_BRAND_GUI_ABOUT_16PX_PNG);g' \
+		-e 's;@VBOX_ABOUT_16PX_HIDPI_PNG@;$(VBOX_BRAND_GUI_ABOUT_16PX_HIDPI_PNG);g' \
 		-e 's;@VBOX_VBOX_16PX_PNG@;$(VBOX_BRAND_GUI_VBOX_16PX_PNG);g' \
 		-e 's;@VBOX_VBOX_20PX_PNG@;$(VBOX_BRAND_GUI_VBOX_20PX_PNG);g' \
 		-e 's;@VBOX_VBOX_32PX_PNG@;$(VBOX_BRAND_GUI_VBOX_32PX_PNG);g' \
@@ -880,88 +920,49 @@ $(VBOX_VIRTUALBOX4_OUT_DIR)/VirtualBoxBrand.qrc: \
 # Precompiled header - non-functional atm.
 #
 ifdef VBOX_WITH_PRECOMPILED_HEADERS
-VirtualBox_INCS          <= $(VirtualBox_0_OUTDIR)/include
-VirtualBox_DEFS          += VBOX_WITH_PRECOMPILED_HEADERS
-VirtualBox_CXXFLAGS      += -Winvalid-pch -fpch-preprocess
-VirtualBox_INTERMEDIATES += $(VirtualBox_0_OUTDIR)/include/precomp.h.gch
-
-tstx: $$(VirtualBox_0_OUTDIR)/include/precomp.h.gch
-
-$$(VirtualBox_0_OUTDIR)/include/precomp.h.gch: \
-		$(PATH_SUB_CURRENT)/src/precomp.h \
-		$$(VirtualBox_0_OUTDIR)/include/COMWrappers.h \
-		$$(filter %.gen.h, $$(VirtualBox_INTERMEDIATES) ) \
-		$(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h \
-		| $$(dir $$@)
-	time 'g++-4.0' \
-		'-c' \
-		'-g' \
-		$(if-expr "$(KBUILD_TYPE)" == "debug", , -O2 ) \
-		'-pipe' \
-		'-Wall' \
-		'-Wextra' \
-		'-Wno-missing-field-initializers' \
-		'-Wno-trigraphs' \
-		'-frtti' \
-		'-fno-exceptions' \
-		'-Wno-non-virtual-dtor' \
-		'-Wno-long-long' \
-		\
-		'-fshort-wchar' \
-		'-fno-strict-aliasing' \
-		'-fvisibility=hidden' \
-		'-DVBOX_HAVE_VISIBILITY_HIDDEN' \
-		'-DRT_USE_VISIBILITY_DEFAULT' \
-		'-fvisibility-inlines-hidden' \
-		'-Winvalid-pch' \
-		'-fpch-preprocess' \
-		\
-		'-F$(PATH_SDK_QT4)/Frameworks' \
-		'-mmacosx-version-min=10.5' \
-		'-isysroot' \
-		'/Developer/SDKs/MacOSX10.5.sdk' \
-		'-m32' \
-		\
-		$(foreach inc,$(VirtualBox_INCS),\$(NL)$(TAB)-I$(inc)) \
-		'-I$(PATH_ROOT)/include' \
-		'-I$(PATH_OUT)' \
-		'-DVBOX' \
-		'-DVBOX_WITH_DEBUGGER' \
-		'-DVBOX_WITH_64_BITS_GUESTS' \
-		$(if-expr "$(KBUILD_TYPE)" == "debug", '-DDEBUG' '-DDEBUG_bird' '-DDEBUG_USERNAME=bird' '-DVBOX_CHECK_STATE' ,) \
-		'-DRT_OS_DARWIN' \
-		'-D__DARWIN__' \
-		'-DRT_ARCH_X86' \
-		'-D__X86__' \
-		'-DIN_RING3' \
-		'-DQT_NO_DEBUG' \
-		'-DQT_THREAD_SUPPORT' \
-		'-DQT_SHARED' \
-		'-DHAVE_CONFIG_H' \
-		'-DHC_ARCH_BITS=32' \
-		'-DGC_ARCH_BITS=64' \
-		'-DVBOX_WITH_XPCOM' \
-		'-DVBOX_WITH_UPDATE_REQUEST' \
-		'-DVBOX_WITH_ALSA' \
-		'-DVBOX_WITH_PULSE' \
-		'-DVBOX_WITH_E1000' \
-		'-DVBOX_WITH_NETFLT' \
-		'-DVBOX_WITH_DEBUGGER_GUI' \
-		$(if-expr "$(KBUILD_TYPE)" != "release", '-DVBOX_WITH_DEBUGGER_GUI_MENU', ) \
-		'-DVBOX_WITH_VIDEOHWACCEL' \
-		'-DVBOX_GUI_USE_QGL' \
-		'-DVBOX_WITH_VIRTIO' \
-		'-DVBOX_WITH_PRECOMPILED_HEADERS' \
-		'-DVBOX_DARWIN_USE_NATIVE_CONTROLS' \
-		'-DQT_CORE_LIB' \
-		'-DQT_GUI_LIB' \
-		'-DQT_NETWORK_LIB' \
-		'-DQT_OPENGL_LIB' \
-		'-DMAC_OS_X_VERSION_MIN_REQUIRED=1050' \
-		'-DMAC_OS_X_VERSION_MAX_ALLOWED=1050' \
-		'-DVBOX_GUI_USE_QUARTZ2D' \
-		'-DVBOX_GUI_USE_QIMAGE' \
-		'-o' $@ $<
+ VirtualBox_DEFS          += VBOX_WITH_PRECOMPILED_HEADERS
+ if1of ($(KBUILD_TARGET),win)
+ # VirtualBox_CXXFLAGS      += -Winvalid-pch -fpch-preprocess
+ # VirtualBox_INCS          <= $(VirtualBoxPch_0_OUTDIR)/src
+ # VirtualBox_INTERMEDIATES += $(VirtualBox_0_OUTDIR)/include/precomp.h.gch
+ else
+  VirtualBox_CXXFLAGS      += -Winvalid-pch -fpch-preprocess
+  VirtualBox_INCS          <= $(VirtualBoxPch_0_OUTDIR)/src
+  $(foreach x,$(filter-out include/COMWrappers.cpp, $(filter %.cpp, \
+  	$(VirtualBox_SOURCES) \
+	$(VirtualBox_SOURCES.$(KBUILD_TARGET)) \
+	$(VirtualBox_SOURCES.$(KBUILD_TYPE)) \
+   )),$(eval $(abspath $(PATH_OBJ)/VirtualBox/$(basename $(x)).o): $$$$(VirtualBoxPch_0_OUTDIR)/src/precomp.h.gch))
+endif
+
+ TOOL_VirtualBoxPchLinker = Linker for VirtualBoxPch
+ define TOOL_VirtualBoxPchLinker_LINK_MISCBIN_CMDS
+	$(APPEND) -t $(out)
+ endef
+
+ MISCBINS += VirtualBoxPch
+ VirtualBoxPch_EXTENDS = VirtualBox
+ VirtualBoxPch_LDTOOL   = VirtualBoxPchLinker
+ VirtualBoxPch_INSTTYPE = none
+ VirtualBoxPch_INTERMEDIATES   = $(filter-out %.h.gch, $(VirtualBox_INTERMEDIATES))
+ VirtualBoxPch_NAME            = VirtualBoxPch
+ if1of ($(KBUILD_TARGET),win)
+  VirtualBoxPch_SOURCES        = src/precomp.cpp
+  VirtualBoxPch_CXXFLAGS       = $(filter-out -Winvalid-pch -fpch-preprocess, $(VirtualBox_CXXFLAGS))
+ else
+  VirtualBoxPch_SOURCES        = src/precomp.h
+  VirtualBoxPch_CXXFLAGS       = $(filter-out -Winvalid-pch -fpch-preprocess, $(VirtualBox_CXXFLAGS)) -x c++-header
+  VirtualBoxPch_CXXOBJSUFF     = .h.gch
+  VirtualBoxPch_SRC_HANDLERS   = .h:def_src_handler_cxx
+ endif
+ VirtualBoxPch_SOURCES.darwin  = $(NO_SUCH_VARIABLE)
+ VirtualBoxPch_SOURCES.solaris = $(NO_SUCH_VARIABLE)
+ VirtualBoxPch_SOURCES.freebsd = $(NO_SUCH_VARIABLE)
+ VirtualBoxPch_SOURCES.linux   = $(NO_SUCH_VARIABLE)
+ VirtualBoxPch_SOURCES.win     = $(NO_SUCH_VARIABLE)
+ VirtualBoxPch_QT_MODULES      = $(VirtualBox_QT_MODULES) # "bug" - not inherited.
+ VirtualBoxPch_INCS            = $(VirtualBox_INCS)       # "bug" - missing qtuic and qtmoc
+
 endif
 
 ifeq ($(KBUILD_TARGET),win)
@@ -1120,6 +1121,46 @@ TRANSLATIONS :=
 IMAGES :=
 
 
+#
+# Doxygen documentation.
+#
+QTGUI_DOXYFILE_OUTPUT = $(PATH_OUT)/docs/qtgui
+BLDDIRS += $(QTGUI_DOXYFILE_OUTPUT)
+OTHER_CLEAN += \
+	$(QTGUI_DOXYFILE_OUTPUT)/Doxyfile.qtgui \
+	$(QTGUI_DOXYFILE_OUTPUT)/docs.qtgui
+
+# Generate the Doxyfile
+$(QTGUI_DOXYFILE_OUTPUT)/Doxyfile.qtgui: \
+		$(PATH_SUB_CURRENT)/Doxyfile \
+		$(PATH_SUB_CURRENT)/Makefile.kmk \
+		| $$(dir $$@)
+	$(RM) -f $@ $@.tmp $@.dep
+	$(CP) -f $< $@.tmp
+	$(APPEND) $@.tmp
+	$(APPEND) $@.tmp "OUTPUT_DIRECTORY = $(QTGUI_DOXYFILE_OUTPUT)"
+	$(APPEND) $@.tmp "WARN_LOGFILE = $(QTGUI_DOXYFILE_OUTPUT)/errors"
+	$(APPEND) $@.tmp "INCLUDE_PATH = $(PATH_ROOT)/include ."
+	$(APPEND) $@.tmp "PREDEFINED += $(ARCH_BITS_DEFS)"
+	$(APPEND) $@.tmp
+	$(APPEND) $@.tmp "INPUT = $(dir $<)"
+	$(APPEND) $@.tmp
+	$(MV) -f $@.tmp $@
+
+# Do the actual job.
+$(QTGUI_DOXYFILE_OUTPUT)/docs.qtgui: $(QTGUI_DOXYFILE_OUTPUT)/Doxyfile.qtgui $$(QTGUI_DOXYFILE_INPUT) | $(QTGUI_DOXYFILE_OUTPUT)/
+	$(RM) -Rf -- $(QTGUI_DOXYFILE_OUTPUT)/html/
+	doxygen $(QTGUI_DOXYFILE_OUTPUT)/Doxyfile.qtgui
+	$(APPEND) $(QTGUI_DOXYFILE_OUTPUT)/docs.qtgui
+
+# aliases
+docs.qtgui: $(QTGUI_DOXYFILE_OUTPUT)/docs.qtgui
+if !defined(VBOX_ONLY_DOCS) && defined(VBOX_WITH_ALL_DOXYGEN_TARGETS)
+docs:      $(QTGUI_DOXYFILE_OUTPUT)/docs.qtgui
+endif
+
+
+
 # Commit the magic.
 # (note: before custom rules that make usage of generated variables!).
 include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/Frontends/VirtualBox/VBoxUI.pro b/src/VBox/Frontends/VirtualBox/VBoxUI.pro
index 07a69fb..1f18f0d 100644
--- a/src/VBox/Frontends/VirtualBox/VBoxUI.pro
+++ b/src/VBox/Frontends/VirtualBox/VBoxUI.pro
@@ -21,11 +21,9 @@ TEMPLATE	= app
 LANGUAGE	= C++
 
 FORMS = \
-    src/VBoxVMInformationDlg.ui \
     src/VBoxSnapshotDetailsDlg.ui \
     src/VBoxTakeSnapshotDlg.ui \
     src/UIVMLogViewer.ui \
-    src/medium/UIMediumManager.ui \
     src/settings/UISettingsDialog.ui \
     src/settings/global/UIGlobalSettingsGeneral.ui \
     src/settings/global/UIGlobalSettingsInput.ui \
@@ -49,6 +47,7 @@ FORMS = \
     src/settings/machine/UIMachineSettingsUSBFilterDetails.ui \
     src/settings/machine/UIMachineSettingsSF.ui \
     src/settings/machine/UIMachineSettingsSFDetails.ui \
+    src/settings/machine/UIMachineSettingsInterface.ui \
     src/widgets/UIApplianceEditorWidget.ui \
     src/selector/VBoxSnapshotsWgt.ui
 
diff --git a/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc b/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc
index de5e27d..a232ac6 100644
--- a/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc
+++ b/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc
@@ -1,278 +1,284 @@
 <RCC>
     <qresource prefix="/">
-        <file alias="tpixel.png">images/tpixel.png</file>
-        <file alias="transparent_16px.png">images/transparent_16px.png</file>
-        <file alias="vm_delete_32px.png">images/vm_delete_32px.png</file>
-        <file alias="vm_delete_disabled_32px.png">images/vm_delete_disabled_32px.png</file>
-        <file alias="vm_discard_32px.png">images/vm_discard_32px.png</file>
-        <file alias="vm_discard_disabled_32px.png">images/vm_discard_disabled_32px.png</file>
-        <file alias="vm_add_16px.png">images/vm_add_16px.png</file>
-        <file alias="vm_new_32px.png">images/vm_new_32px.png</file>
-        <file alias="vm_new_disabled_32px.png">images/vm_new_disabled_32px.png</file>
-        <file alias="vm_pause_32px.png">images/vm_pause_32px.png</file>
-        <file alias="vm_pause_disabled_32px.png">images/vm_pause_disabled_32px.png</file>
-        <file alias="vm_settings_32px.png">images/vm_settings_32px.png</file>
-        <file alias="vm_settings_disabled_32px.png">images/vm_settings_disabled_32px.png</file>
-        <file alias="vm_clone_16px.png">images/vm_clone_16px.png</file>
-        <file alias="vm_clone_disabled_16px.png">images/vm_clone_disabled_16px.png</file>
-        <file alias="vm_clone_22px.png">images/vm_clone_22px.png</file>
-        <file alias="vm_clone_disabled_22px.png">images/vm_clone_disabled_22px.png</file>
-        <file alias="vm_show_logs_32px.png">images/vm_show_logs_32px.png</file>
-        <file alias="vm_show_logs_disabled_32px.png">images/vm_show_logs_disabled_32px.png</file>
-        <file alias="vm_start_32px.png">images/vm_start_32px.png</file>
-        <file alias="vm_start_disabled_32px.png">images/vm_start_disabled_32px.png</file>
-        <file alias="vm_open_filemanager_16px.png">images/vm_open_filemanager_16px.png</file>
-        <file alias="vm_open_filemanager_disabled_16px.png">images/vm_open_filemanager_disabled_16px.png</file>
-        <file alias="vm_create_shortcut_16px.png">images/vm_create_shortcut_16px.png</file>
-        <file alias="vm_create_shortcut_disabled_16px.png">images/vm_create_shortcut_disabled_16px.png</file>
-        <file alias="vm_group_create_16px.png">images/vm_group_create_16px.png</file>
-        <file alias="vm_group_create_disabled_16px.png">images/vm_group_create_disabled_16px.png</file>
-        <file alias="vm_group_name_16px.png">images/vm_group_name_16px.png</file>
-        <file alias="vm_group_name_disabled_16px.png">images/vm_group_name_disabled_16px.png</file>
-        <file alias="vm_group_remove_16px.png">images/vm_group_remove_16px.png</file>
-        <file alias="vm_group_remove_disabled_16px.png">images/vm_group_remove_disabled_16px.png</file>
-        <file alias="state_aborted_16px.png">images/state_aborted_16px.png</file>
-        <file alias="state_discarding_16px.png">images/state_discarding_16px.png</file>
-        <file alias="state_paused_16px.png">images/state_paused_16px.png</file>
-        <file alias="state_running_16px.png">images/state_running_16px.png</file>
-        <file alias="state_saved_16px.png">images/state_saved_16px.png</file>
-        <file alias="state_saving_16px.png">images/state_saving_16px.png</file>
-        <file alias="state_powered_off_16px.png">images/state_powered_off_16px.png</file>
-        <file alias="state_restoring_16px.png">images/state_restoring_16px.png</file>
-        <file alias="state_stuck_16px.png">images/state_stuck_16px.png</file>
-        <file alias="snapshot_offline_16px.png">images/snapshot_offline_16px.png</file>
-        <file alias="snapshot_online_16px.png">images/snapshot_online_16px.png</file>
-        <file alias="machine_16px.png">images/machine_16px.png</file>
-        <file alias="machine_32px.png">images/machine_32px.png</file>
-        <file alias="machine_disabled_16px.png">images/machine_disabled_16px.png</file>
-        <file alias="machine_disabled_32px.png">images/machine_disabled_32px.png</file>
-        <file alias="help_16px.png">images/help_16px.png</file>
-        <file alias="help_button_normal_mac_22px.png">images/help_button_normal_mac_22px.png</file>
-        <file alias="help_button_pressed_mac_22px.png">images/help_button_pressed_mac_22px.png</file>
-        <file alias="site_16px.png">images/site_16px.png</file>
-        <file alias="site_32px.png">images/site_32px.png</file>
-        <file alias="site_disabled_16px.png">images/site_disabled_16px.png</file>
-        <file alias="site_disabled_32px.png">images/site_disabled_32px.png</file>
-        <file alias="register_16px.png">images/register_16px.png</file>
-        <file alias="register_32px.png">images/register_32px.png</file>
-        <file alias="register_disabled_16px.png">images/register_disabled_16px.png</file>
-        <file alias="vm_reset_16px.png">images/vm_reset_16px.png</file>
-        <file alias="vm_reset_disabled_16px.png">images/vm_reset_disabled_16px.png</file>
-        <file alias="vm_pause_16px.png">images/vm_pause_16px.png</file>
-        <file alias="vm_pause_on_16px.png">images/vm_pause_on_16px.png</file>
-        <file alias="vm_pause_disabled_16px.png">images/vm_pause_disabled_16px.png</file>
-        <file alias="vm_pause_on_disabled_16px.png">images/vm_pause_on_disabled_16px.png</file>
-        <file alias="vm_shutdown_16px.png">images/vm_shutdown_16px.png</file>
-        <file alias="vm_shutdown_disabled_16px.png">images/vm_shutdown_disabled_16px.png</file>
+        <file alias="add_host_iface_16px.png">images/add_host_iface_16px.png</file>
+        <file alias="add_host_iface_disabled_16px.png">images/add_host_iface_disabled_16px.png</file>
         <file alias="adjust_win_size_16px.png">images/adjust_win_size_16px.png</file>
         <file alias="adjust_win_size_disabled_16px.png">images/adjust_win_size_disabled_16px.png</file>
+        <file alias="arrow_down_10px.png">images/arrow_down_10px.png</file>
+        <file alias="arrow_left_10px.png">images/arrow_left_10px.png</file>
+        <file alias="arrow_right_10px.png">images/arrow_right_10px.png</file>
+        <file alias="arrow_up_10px.png">images/arrow_up_10px.png</file>
+        <file alias="attachment_add_16px.png">images/attachment_add_16px.png</file>
+        <file alias="attachment_add_disabled_16px.png">images/attachment_add_disabled_16px.png</file>
+        <file alias="attachment_remove_16px.png">images/attachment_remove_16px.png</file>
+        <file alias="attachment_remove_disabled_16px.png">images/attachment_remove_disabled_16px.png</file>
         <file alias="auto_resize_on_16px.png">images/auto_resize_on_16px.png</file>
-        <file alias="auto_resize_on_on_16px.png">images/auto_resize_on_on_16px.png</file>
         <file alias="auto_resize_on_disabled_16px.png">images/auto_resize_on_disabled_16px.png</file>
+        <file alias="auto_resize_on_on_16px.png">images/auto_resize_on_on_16px.png</file>
         <file alias="auto_resize_on_on_disabled_16px.png">images/auto_resize_on_on_disabled_16px.png</file>
-        <file alias="auto_resize_off_16px.png">images/auto_resize_off_16px.png</file>
-        <file alias="auto_resize_off_disabled_16px.png">images/auto_resize_off_disabled_16px.png</file>
-        <file alias="exit_16px.png">images/exit_16px.png</file>
-        <file alias="vm_poweroff_16px.png">images/vm_poweroff_16px.png</file>
-        <file alias="vm_poweroff_disabled_16px.png">images/vm_poweroff_disabled_16px.png</file>
-        <file alias="guesttools_16px.png">images/guesttools_16px.png</file>
-        <file alias="guesttools_disabled_16px.png">images/guesttools_disabled_16px.png</file>
+        <file alias="cancel_16px.png">images/cancel_16px.png</file>
+        <file alias="cd_16px.png">images/cd_16px.png</file>
+        <file alias="cd_add_16px.png">images/cd_add_16px.png</file>
+        <file alias="cd_add_disabled_16px.png">images/cd_add_disabled_16px.png</file>
+        <file alias="cd_copy_16px.png">images/cd_copy_16px.png</file>
+        <file alias="cd_copy_22px.png">images/cd_copy_22px.png</file>
+        <file alias="cd_copy_disabled_16px.png">images/cd_copy_disabled_16px.png</file>
+        <file alias="cd_copy_disabled_22px.png">images/cd_copy_disabled_22px.png</file>
+        <file alias="cd_disabled_16px.png">images/cd_disabled_16px.png</file>
+        <file alias="cd_modify_16px.png">images/cd_modify_16px.png</file>
+        <file alias="cd_modify_22px.png">images/cd_modify_22px.png</file>
+        <file alias="cd_modify_disabled_16px.png">images/cd_modify_disabled_16px.png</file>
+        <file alias="cd_modify_disabled_22px.png">images/cd_modify_disabled_22px.png</file>
+        <file alias="cd_read_16px.png">images/cd_read_16px.png</file>
+        <file alias="cd_release_16px.png">images/cd_release_16px.png</file>
+        <file alias="cd_release_22px.png">images/cd_release_22px.png</file>
+        <file alias="cd_release_disabled_16px.png">images/cd_release_disabled_16px.png</file>
+        <file alias="cd_release_disabled_22px.png">images/cd_release_disabled_22px.png</file>
+        <file alias="cd_remove_16px.png">images/cd_remove_16px.png</file>
+        <file alias="cd_remove_22px.png">images/cd_remove_22px.png</file>
+        <file alias="cd_remove_disabled_16px.png">images/cd_remove_disabled_16px.png</file>
+        <file alias="cd_remove_disabled_22px.png">images/cd_remove_disabled_22px.png</file>
+        <file alias="cd_unmount_16px.png">images/cd_unmount_16px.png</file>
+        <file alias="cd_unmount_disabled_16px.png">images/cd_unmount_disabled_16px.png</file>
+        <file alias="cd_write_16px.png">images/cd_write_16px.png</file>
+        <file alias="chipset_16px.png">images/chipset_16px.png</file>
+        <file alias="chipset_24px.png">images/chipset_24px.png</file>
+        <file alias="chipset_32px.png">images/chipset_32px.png</file>
+        <file alias="chipset_warning_16px.png">images/chipset_warning_16px.png</file>
+        <file alias="close_16px.png">images/close_16px.png</file>
+        <file alias="close_popup_16px.png">images/close_popup_16px.png</file>
+        <file alias="connect_16px.png">images/connect_16px.png</file>
+        <file alias="controller_add_16px.png">images/controller_add_16px.png</file>
+        <file alias="controller_add_disabled_16px.png">images/controller_add_disabled_16px.png</file>
+        <file alias="controller_remove_16px.png">images/controller_remove_16px.png</file>
+        <file alias="controller_remove_disabled_16px.png">images/controller_remove_disabled_16px.png</file>
+        <file alias="cpu_16px.png">images/cpu_16px.png</file>
+        <file alias="description_16px.png">images/description_16px.png</file>
+        <file alias="disconnect_16px.png">images/disconnect_16px.png</file>
         <file alias="diskimage_16px.png">images/diskimage_16px.png</file>
         <file alias="diskimage_32px.png">images/diskimage_32px.png</file>
-        <file alias="diskimage_disabled_32px.png">images/diskimage_disabled_32px.png</file>
-        <file alias="vm_settings_16px.png">images/vm_settings_16px.png</file>
-        <file alias="vm_settings_disabled_16px.png">images/vm_settings_disabled_16px.png</file>
-        <file alias="vm_delete_16px.png">images/vm_delete_16px.png</file>
-        <file alias="vm_delete_disabled_16px.png">images/vm_delete_disabled_16px.png</file>
-        <file alias="vm_new_16px.png">images/vm_new_16px.png</file>
-        <file alias="vm_start_16px.png">images/vm_start_16px.png</file>
-        <file alias="vm_start_disabled_16px.png">images/vm_start_disabled_16px.png</file>
-        <file alias="vm_discard_16px.png">images/vm_discard_16px.png</file>
-        <file alias="vm_discard_disabled_16px.png">images/vm_discard_disabled_16px.png</file>
-        <file alias="sound_16px.png">images/sound_16px.png</file>
-        <file alias="sound_32px.png">images/sound_32px.png</file>
-        <file alias="sound_disabled_32px.png">images/sound_disabled_32px.png</file>
-        <file alias="nw_16px.png">images/nw_16px.png</file>
-        <file alias="nw_disabled_16px.png">images/nw_disabled_16px.png</file>
-        <file alias="nw_32px.png">images/nw_32px.png</file>
-        <file alias="nw_disabled_32px.png">images/nw_disabled_32px.png</file>
-        <file alias="nw_read_16px.png">images/nw_read_16px.png</file>
-        <file alias="nw_write_16px.png">images/nw_write_16px.png</file>
-        <file alias="usb_16px.png">images/usb_16px.png</file>
-        <file alias="usb_disabled_16px.png">images/usb_disabled_16px.png</file>
-        <file alias="usb_32px.png">images/usb_32px.png</file>
-        <file alias="usb_disabled_32px.png">images/usb_disabled_32px.png</file>
-        <file alias="usb_new_16px.png">images/usb_new_16px.png</file>
-        <file alias="usb_new_disabled_16px.png">images/usb_new_disabled_16px.png</file>
-        <file alias="usb_read_16px.png">images/usb_read_16px.png</file>
-        <file alias="usb_write_16px.png">images/usb_write_16px.png</file>
-        <file alias="usb_add_16px.png">images/usb_add_16px.png</file>
-        <file alias="usb_add_disabled_16px.png">images/usb_add_disabled_16px.png</file>
-        <file alias="usb_filter_edit_16px.png">images/usb_filter_edit_16px.png</file>
-        <file alias="usb_filter_edit_disabled_16px.png">images/usb_filter_edit_disabled_16px.png</file>
-        <file alias="usb_movedown_16px.png">images/usb_movedown_16px.png</file>
-        <file alias="usb_movedown_disabled_16px.png">images/usb_movedown_disabled_16px.png</file>
-        <file alias="usb_moveup_16px.png">images/usb_moveup_16px.png</file>
-        <file alias="usb_moveup_disabled_16px.png">images/usb_moveup_disabled_16px.png</file>
-        <file alias="usb_remove_16px.png">images/usb_remove_16px.png</file>
-        <file alias="usb_remove_disabled_16px.png">images/usb_remove_disabled_16px.png</file>
-        <file alias="usb_unavailable_16px.png">images/usb_unavailable_16px.png</file>
-        <file alias="usb_unavailable_disabled_16px.png">images/usb_unavailable_disabled_16px.png</file>
-        <file alias="parallel_port_16px.png">images/parallel_port_16px.png</file>
-        <file alias="parallel_port_disabled_16px.png">images/parallel_port_disabled_16px.png</file>
-        <file alias="parallel_port_32px.png">images/parallel_port_32px.png</file>
-        <file alias="parallel_port_disabled_32px.png">images/parallel_port_disabled_32px.png</file>
-        <file alias="parallel_port_read_16px.png">images/parallel_port_read_16px.png</file>
-        <file alias="parallel_port_write_16px.png">images/parallel_port_write_16px.png</file>
-        <file alias="serial_port_16px.png">images/serial_port_16px.png</file>
-        <file alias="serial_port_disabled_16px.png">images/serial_port_disabled_16px.png</file>
-        <file alias="serial_port_32px.png">images/serial_port_32px.png</file>
-        <file alias="serial_port_disabled_32px.png">images/serial_port_disabled_32px.png</file>
-        <file alias="serial_port_read_16px.png">images/serial_port_read_16px.png</file>
-        <file alias="serial_port_write_16px.png">images/serial_port_write_16px.png</file>
-        <file alias="select_file_16px.png">images/select_file_16px.png</file>
-        <file alias="select_file_disabled_16px.png">images/select_file_disabled_16px.png</file>
-        <file alias="list_moveup_16px.png">images/list_moveup_16px.png</file>
-        <file alias="list_moveup_22px.png">images/list_moveup_22px.png</file>
-        <file alias="list_moveup_disabled_16px.png">images/list_moveup_disabled_16px.png</file>
-        <file alias="list_moveup_disabled_22px.png">images/list_moveup_disabled_22px.png</file>
-        <file alias="list_movedown_16px.png">images/list_movedown_16px.png</file>
-        <file alias="list_movedown_22px.png">images/list_movedown_22px.png</file>
-        <file alias="list_movedown_disabled_16px.png">images/list_movedown_disabled_16px.png</file>
-        <file alias="list_movedown_disabled_22px.png">images/list_movedown_disabled_22px.png</file>
-        <file alias="discard_cur_state_16px.png">images/discard_cur_state_16px.png</file>
-        <file alias="discard_cur_state_22px.png">images/discard_cur_state_22px.png</file>
-        <file alias="discard_cur_state_dis_16px.png">images/discard_cur_state_dis_16px.png</file>
-        <file alias="discard_cur_state_dis_22px.png">images/discard_cur_state_dis_22px.png</file>
-        <file alias="discard_cur_state_snapshot_16px.png">images/discard_cur_state_snapshot_16px.png</file>
-        <file alias="discard_cur_state_snapshot_22px.png">images/discard_cur_state_snapshot_22px.png</file>
-        <file alias="discard_cur_state_snapshot_dis_16px.png">images/discard_cur_state_snapshot_dis_16px.png</file>
-        <file alias="discard_cur_state_snapshot_dis_22px.png">images/discard_cur_state_snapshot_dis_22px.png</file>
-        <file alias="snapshot_take_16px.png">images/snapshot_take_16px.png</file>
-        <file alias="snapshot_take_22px.png">images/snapshot_take_22px.png</file>
-        <file alias="snapshot_take_disabled_16px.png">images/snapshot_take_disabled_16px.png</file>
-        <file alias="snapshot_take_disabled_22px.png">images/snapshot_take_disabled_22px.png</file>
-        <file alias="snapshot_restore_16px.png">images/snapshot_restore_16px.png</file>
-        <file alias="snapshot_restore_22px.png">images/snapshot_restore_22px.png</file>
-        <file alias="snapshot_restore_disabled_16px.png">images/snapshot_restore_disabled_16px.png</file>
-        <file alias="snapshot_restore_disabled_22px.png">images/snapshot_restore_disabled_22px.png</file>
-        <file alias="snapshot_delete_16px.png">images/snapshot_delete_16px.png</file>
-        <file alias="snapshot_delete_22px.png">images/snapshot_delete_22px.png</file>
-        <file alias="snapshot_delete_disabled_16px.png">images/snapshot_delete_disabled_16px.png</file>
-        <file alias="snapshot_delete_disabled_22px.png">images/snapshot_delete_disabled_22px.png</file>
-        <file alias="screenshot_take_16px.png">images/screenshot_take_16px.png</file>
-        <file alias="screenshot_take_disabled_16px.png">images/screenshot_take_disabled_16px.png</file>
-        <file alias="snapshot_show_details_16px.png">images/snapshot_show_details_16px.png</file>
-        <file alias="snapshot_show_details_22px.png">images/snapshot_show_details_22px.png</file>
-        <file alias="snapshot_show_details_disabled_16px.png">images/snapshot_show_details_disabled_16px.png</file>
-        <file alias="snapshot_show_details_disabled_22px.png">images/snapshot_show_details_disabled_22px.png</file>
-        <file alias="sf_add_16px.png">images/sf_add_16px.png</file>
-        <file alias="sf_add_disabled_16px.png">images/sf_add_disabled_16px.png</file>
-        <file alias="sf_edit_16px.png">images/sf_edit_16px.png</file>
-        <file alias="sf_edit_disabled_16px.png">images/sf_edit_disabled_16px.png</file>
-        <file alias="sf_remove_16px.png">images/sf_remove_16px.png</file>
-        <file alias="sf_remove_disabled_16px.png">images/sf_remove_disabled_16px.png</file>
-        <file alias="sf_16px.png">images/sf_16px.png</file>
-        <file alias="sf_disabled_16px.png">images/sf_disabled_16px.png</file>
-        <file alias="sf_32px.png">images/sf_32px.png</file>
-        <file alias="sf_disabled_32px.png">images/sf_disabled_32px.png</file>
-        <file alias="sf_read_16px.png">images/sf_read_16px.png</file>
-        <file alias="sf_write_16px.png">images/sf_write_16px.png</file>
-        <file alias="vtx_amdv_16px.png">images/vtx_amdv_16px.png</file>
-        <file alias="vtx_amdv_disabled_16px.png">images/vtx_amdv_disabled_16px.png</file>
-        <file alias="add_host_iface_16px.png">images/add_host_iface_16px.png</file>
-        <file alias="add_host_iface_disabled_16px.png">images/add_host_iface_disabled_16px.png</file>
-        <file alias="remove_host_iface_16px.png">images/remove_host_iface_16px.png</file>
-        <file alias="remove_host_iface_disabled_16px.png">images/remove_host_iface_disabled_16px.png</file>
+        <file alias="display_hardware_16px.png">images/display_hardware_16px.png</file>
+        <file alias="display_hardware_write_16px.png">images/display_hardware_write_16px.png</file>
+        <file alias="display_software_16px.png">images/display_software_16px.png</file>
+        <file alias="drag_drop_16px.png">images/drag_drop_16px.png</file>
+        <file alias="drag_drop_disabled_16px.png">images/drag_drop_disabled_16px.png</file>
+        <file alias="edata_add_16px.png">images/edata_add_16px.png</file>
+        <file alias="edata_add_22px.png">images/edata_add_22px.png</file>
+        <file alias="edata_add_disabled_16px.png">images/edata_add_disabled_16px.png</file>
+        <file alias="edata_add_disabled_22px.png">images/edata_add_disabled_22px.png</file>
+        <file alias="edata_load_16px.png">images/edata_load_16px.png</file>
+        <file alias="edata_load_22px.png">images/edata_load_22px.png</file>
+        <file alias="edata_load_disabled_16px.png">images/edata_load_disabled_16px.png</file>
+        <file alias="edata_load_disabled_22px.png">images/edata_load_disabled_22px.png</file>
+        <file alias="edata_remove_16px.png">images/edata_remove_16px.png</file>
+        <file alias="edata_remove_22px.png">images/edata_remove_22px.png</file>
+        <file alias="edata_remove_disabled_16px.png">images/edata_remove_disabled_16px.png</file>
+        <file alias="edata_remove_disabled_22px.png">images/edata_remove_disabled_22px.png</file>
+        <file alias="edata_save_16px.png">images/edata_save_16px.png</file>
+        <file alias="edata_save_22px.png">images/edata_save_22px.png</file>
+        <file alias="edata_save_disabled_16px.png">images/edata_save_disabled_16px.png</file>
+        <file alias="edata_save_disabled_22px.png">images/edata_save_disabled_22px.png</file>
+        <file alias="edataglobal_32px.png">images/edataglobal_32px.png</file>
+        <file alias="edataman_16px.png">images/edataman_16px.png</file>
+        <file alias="edataman_32px.png">images/edataman_32px.png</file>
         <file alias="eraser_16px.png">images/eraser_16px.png</file>
-        <file alias="eraser_disabled_16px.png">images/eraser_disabled_16px.png</file>
-        <file alias="refresh_16px.png">images/refresh_16px.png</file>
-        <file alias="refresh_disabled_16px.png">images/refresh_disabled_16px.png</file>
-        <file alias="refresh_22px.png">images/refresh_22px.png</file>
-        <file alias="refresh_disabled_22px.png">images/refresh_disabled_22px.png</file>
-        <file alias="refresh_32px.png">images/refresh_32px.png</file>
-        <file alias="refresh_disabled_32px.png">images/refresh_disabled_32px.png</file>
-        <file alias="vm_show_logs_16px.png">images/vm_show_logs_16px.png</file>
-        <file alias="vm_show_logs_disabled_16px.png">images/vm_show_logs_disabled_16px.png</file>
-        <file alias="vm_show_logs_22px.png">images/vm_show_logs_22px.png</file>
-        <file alias="vm_show_logs_disabled_22px.png">images/vm_show_logs_disabled_22px.png</file>
-        <file alias="description_16px.png">images/description_16px.png</file>
-        <file alias="description_disabled_16px.png">images/description_disabled_16px.png</file>
-        <file alias="description_edit_16px.png">images/description_edit_16px.png</file>
-        <file alias="description_edit_disabled_16px.png">images/description_edit_disabled_16px.png</file>
-        <file alias="session_info_16px.png">images/session_info_16px.png</file>
-        <file alias="session_info_disabled_16px.png">images/session_info_disabled_16px.png</file>
-        <file alias="session_info_32px.png">images/session_info_32px.png</file>
-        <file alias="session_info_disabled_32px.png">images/session_info_disabled_32px.png</file>
-        <file alias="session_info_details_16px.png">images/session_info_details_16px.png</file>
-        <file alias="session_info_runtime_16px.png">images/session_info_runtime_16px.png</file>
+        <file alias="exit_16px.png">images/exit_16px.png</file>
+        <file alias="expanding_collapsing_16px.png">images/expanding_collapsing_16px.png</file>
+        <file alias="export_16px.png">images/export_16px.png</file>
+        <file alias="extension_pack_16px.png">images/extension_pack_16px.png</file>
+        <file alias="extension_pack_24px.png">images/extension_pack_24px.png</file>
+        <file alias="extension_pack_32px.png">images/extension_pack_32px.png</file>
+        <file alias="extension_pack_install_16px.png">images/extension_pack_install_16px.png</file>
+        <file alias="extension_pack_install_disabled_16px.png">images/extension_pack_install_disabled_16px.png</file>
+        <file alias="extension_pack_uninstall_16px.png">images/extension_pack_uninstall_16px.png</file>
+        <file alias="extension_pack_uninstall_disabled_16px.png">images/extension_pack_uninstall_disabled_16px.png</file>
+        <file alias="extension_pack_warning_16px.png">images/extension_pack_warning_16px.png</file>
+        <file alias="fd_16px.png">images/fd_16px.png</file>
+        <file alias="fd_add_16px.png">images/fd_add_16px.png</file>
+        <file alias="fd_add_disabled_16px.png">images/fd_add_disabled_16px.png</file>
+        <file alias="fd_copy_16px.png">images/fd_copy_16px.png</file>
+        <file alias="fd_copy_22px.png">images/fd_copy_22px.png</file>
+        <file alias="fd_copy_disabled_16px.png">images/fd_copy_disabled_16px.png</file>
+        <file alias="fd_copy_disabled_22px.png">images/fd_copy_disabled_22px.png</file>
+        <file alias="fd_disabled_16px.png">images/fd_disabled_16px.png</file>
+        <file alias="fd_modify_16px.png">images/fd_modify_16px.png</file>
+        <file alias="fd_modify_22px.png">images/fd_modify_22px.png</file>
+        <file alias="fd_modify_disabled_16px.png">images/fd_modify_disabled_16px.png</file>
+        <file alias="fd_modify_disabled_22px.png">images/fd_modify_disabled_22px.png</file>
+        <file alias="fd_read_16px.png">images/fd_read_16px.png</file>
+        <file alias="fd_release_16px.png">images/fd_release_16px.png</file>
+        <file alias="fd_release_22px.png">images/fd_release_22px.png</file>
+        <file alias="fd_release_disabled_16px.png">images/fd_release_disabled_16px.png</file>
+        <file alias="fd_release_disabled_22px.png">images/fd_release_disabled_22px.png</file>
+        <file alias="fd_remove_16px.png">images/fd_remove_16px.png</file>
+        <file alias="fd_remove_22px.png">images/fd_remove_22px.png</file>
+        <file alias="fd_remove_disabled_16px.png">images/fd_remove_disabled_16px.png</file>
+        <file alias="fd_remove_disabled_22px.png">images/fd_remove_disabled_22px.png</file>
+        <file alias="fd_unmount_16px.png">images/fd_unmount_16px.png</file>
+        <file alias="fd_unmount_disabled_16px.png">images/fd_unmount_disabled_16px.png</file>
+        <file alias="fd_write_16px.png">images/fd_write_16px.png</file>
+        <file alias="floppy_16px.png">images/floppy_16px.png</file>
+        <file alias="floppy_add_16px.png">images/floppy_add_16px.png</file>
+        <file alias="floppy_add_disabled_16px.png">images/floppy_add_disabled_16px.png</file>
+        <file alias="floppy_collapse_16px.png">images/floppy_collapse_16px.png</file>
+        <file alias="floppy_expand_16px.png">images/floppy_expand_16px.png</file>
+        <file alias="fullscreen_16px.png">images/fullscreen_16px.png</file>
+        <file alias="fullscreen_disabled_16px.png">images/fullscreen_disabled_16px.png</file>
+        <file alias="fullscreen_on_16px.png">images/fullscreen_on_16px.png</file>
+        <file alias="fullscreen_on_disabled_16px.png">images/fullscreen_on_disabled_16px.png</file>
         <file alias="global_settings_16px.png">images/global_settings_16px.png</file>
-        <file alias="global_settings_disabled_16px.png">images/global_settings_disabled_16px.png</file>
-        <file alias="vrdp_16px.png">images/vrdp_16px.png</file>
-        <file alias="vrdp_on_16px.png">images/vrdp_on_16px.png</file>
-        <file alias="vrdp_disabled_16px.png">images/vrdp_disabled_16px.png</file>
-        <file alias="vrdp_on_disabled_16px.png">images/vrdp_on_disabled_16px.png</file>
-        <file alias="vrdp_32px.png">images/vrdp_32px.png</file>
-        <file alias="vrdp_disabled_32px.png">images/vrdp_disabled_32px.png</file>
-        <file alias="meditation_32px.png">images/meditation_32px.png</file>
-        <file alias="welcome.png">images/welcome.png</file>
-        <file alias="arrow_right_10px.png">images/arrow_right_10px.png</file>
-        <file alias="arrow_left_10px.png">images/arrow_left_10px.png</file>
-        <file alias="arrow_up_10px.png">images/arrow_up_10px.png</file>
-        <file alias="arrow_down_10px.png">images/arrow_down_10px.png</file>
-        <file alias="name_16px.png">images/name_16px.png</file>
-        <file alias="os_type_16px.png">images/os_type_16px.png</file>
-        <file alias="cpu_16px.png">images/cpu_16px.png</file>
-        <file alias="ram_16px.png">images/ram_16px.png</file>
+        <file alias="group_abstract_16px.png">images/group_abstract_16px.png</file>
+        <file alias="guesttools_16px.png">images/guesttools_16px.png</file>
+        <file alias="guesttools_disabled_16px.png">images/guesttools_disabled_16px.png</file>
+        <file alias="hd_16px.png">images/hd_16px.png</file>
+        <file alias="hd_24px.png">images/hd_24px.png</file>
+        <file alias="hd_32px.png">images/hd_32px.png</file>
+        <file alias="hd_add_16px.png">images/hd_add_16px.png</file>
+        <file alias="hd_add_disabled_16px.png">images/hd_add_disabled_16px.png</file>
+        <file alias="hd_copy_16px.png">images/hd_copy_16px.png</file>
+        <file alias="hd_copy_22px.png">images/hd_copy_22px.png</file>
+        <file alias="hd_copy_disabled_16px.png">images/hd_copy_disabled_16px.png</file>
+        <file alias="hd_copy_disabled_22px.png">images/hd_copy_disabled_22px.png</file>
+        <file alias="hd_disabled_16px.png">images/hd_disabled_16px.png</file>
+        <file alias="hd_modify_16px.png">images/hd_modify_16px.png</file>
+        <file alias="hd_modify_22px.png">images/hd_modify_22px.png</file>
+        <file alias="hd_modify_disabled_16px.png">images/hd_modify_disabled_16px.png</file>
+        <file alias="hd_modify_disabled_22px.png">images/hd_modify_disabled_22px.png</file>
+        <file alias="hd_new_16px.png">images/hd_new_16px.png</file>
+        <file alias="hd_new_disabled_16px.png">images/hd_new_disabled_16px.png</file>
+        <file alias="hd_read_16px.png">images/hd_read_16px.png</file>
+        <file alias="hd_release_16px.png">images/hd_release_16px.png</file>
+        <file alias="hd_release_22px.png">images/hd_release_22px.png</file>
+        <file alias="hd_release_disabled_16px.png">images/hd_release_disabled_16px.png</file>
+        <file alias="hd_release_disabled_22px.png">images/hd_release_disabled_22px.png</file>
+        <file alias="hd_remove_16px.png">images/hd_remove_16px.png</file>
+        <file alias="hd_remove_22px.png">images/hd_remove_22px.png</file>
+        <file alias="hd_remove_disabled_16px.png">images/hd_remove_disabled_16px.png</file>
+        <file alias="hd_remove_disabled_22px.png">images/hd_remove_disabled_22px.png</file>
+        <file alias="hd_settings_16px.png">images/hd_settings_16px.png</file>
+        <file alias="hd_settings_disabled_16px.png">images/hd_settings_disabled_16px.png</file>
+        <file alias="hd_warning_16px.png">images/hd_warning_16px.png</file>
+        <file alias="hd_write_16px.png">images/hd_write_16px.png</file>
+        <file alias="help_16px.png">images/help_16px.png</file>
+        <file alias="help_button_normal_mac_22px.png">images/help_button_normal_mac_22px.png</file>
+        <file alias="help_button_pressed_mac_22px.png">images/help_button_pressed_mac_22px.png</file>
+        <file alias="hostkey_16px.png">images/hostkey_16px.png</file>
+        <file alias="hostkey_24px.png">images/hostkey_24px.png</file>
+        <file alias="hostkey_32px.png">images/hostkey_32px.png</file>
+        <file alias="hostkey_captured_16px.png">images/hostkey_captured_16px.png</file>
+        <file alias="hostkey_captured_pressed_16px.png">images/hostkey_captured_pressed_16px.png</file>
+        <file alias="hostkey_disabled_16px.png">images/hostkey_disabled_16px.png</file>
+        <file alias="hostkey_pressed_16px.png">images/hostkey_pressed_16px.png</file>
+        <file alias="hostkey_warning_16px.png">images/hostkey_warning_16px.png</file>
         <file alias="ide_16px.png">images/ide_16px.png</file>
-        <file alias="ide_expand_16px.png">images/ide_expand_16px.png</file>
-        <file alias="ide_collapse_16px.png">images/ide_collapse_16px.png</file>
         <file alias="ide_add_16px.png">images/ide_add_16px.png</file>
         <file alias="ide_add_disabled_16px.png">images/ide_add_disabled_16px.png</file>
-        <file alias="sata_16px.png">images/sata_16px.png</file>
-        <file alias="sata_expand_16px.png">images/sata_expand_16px.png</file>
-        <file alias="sata_collapse_16px.png">images/sata_collapse_16px.png</file>
-        <file alias="sata_add_16px.png">images/sata_add_16px.png</file>
-        <file alias="sata_add_disabled_16px.png">images/sata_add_disabled_16px.png</file>
-        <file alias="scsi_16px.png">images/scsi_16px.png</file>
-        <file alias="scsi_expand_16px.png">images/scsi_expand_16px.png</file>
-        <file alias="scsi_collapse_16px.png">images/scsi_collapse_16px.png</file>
-        <file alias="scsi_add_16px.png">images/scsi_add_16px.png</file>
-        <file alias="scsi_add_disabled_16px.png">images/scsi_add_disabled_16px.png</file>
-        <file alias="floppy_16px.png">images/floppy_16px.png</file>
-        <file alias="floppy_expand_16px.png">images/floppy_expand_16px.png</file>
-        <file alias="floppy_collapse_16px.png">images/floppy_collapse_16px.png</file>
-        <file alias="floppy_add_16px.png">images/floppy_add_16px.png</file>
-        <file alias="floppy_add_disabled_16px.png">images/floppy_add_disabled_16px.png</file>
+        <file alias="ide_collapse_16px.png">images/ide_collapse_16px.png</file>
+        <file alias="ide_expand_16px.png">images/ide_expand_16px.png</file>
         <file alias="import_16px.png">images/import_16px.png</file>
-        <file alias="export_16px.png">images/export_16px.png</file>
-        <file alias="connect_16px.png">images/connect_16px.png</file>
-        <file alias="disconnect_16px.png">images/disconnect_16px.png</file>
-        <file alias="chipset_16px.png">images/chipset_16px.png</file>
-        <file alias="chipset_32px.png">images/chipset_32px.png</file>
-        <file alias="chipset_disabled_16px.png">images/chipset_disabled_16px.png</file>
-        <file alias="chipset_disabled_32px.png">images/chipset_disabled_32px.png</file>
-        <file alias="pin_16px.png">images/pin_16px.png</file>
+        <file alias="interface_16px.png">images/interface_16px.png</file>
+        <file alias="interface_24px.png">images/interface_24px.png</file>
+        <file alias="interface_32px.png">images/interface_32px.png</file>
+        <file alias="interface_warning_16px.png">images/interface_warning_16px.png</file>
+        <file alias="keyboard_16px.png">images/keyboard_16px.png</file>
+        <file alias="keyboard_24px.png">images/keyboard_24px.png</file>
+        <file alias="keyboard_32px.png">images/keyboard_32px.png</file>
+        <file alias="keyboard_settings_16px.png">images/keyboard_settings_16px.png</file>
+        <file alias="keyboard_settings_disabled_16px.png">images/keyboard_settings_disabled_16px.png</file>
+        <file alias="list_movedown_16px.png">images/list_movedown_16px.png</file>
+        <file alias="list_movedown_disabled_16px.png">images/list_movedown_disabled_16px.png</file>
+        <file alias="list_moveup_16px.png">images/list_moveup_16px.png</file>
+        <file alias="list_moveup_disabled_16px.png">images/list_moveup_disabled_16px.png</file>
+        <file alias="machine_16px.png">images/machine_16px.png</file>
+        <file alias="machine_24px.png">images/machine_24px.png</file>
+        <file alias="machine_32px.png">images/machine_32px.png</file>
+        <file alias="machine_abstract_16px.png">images/machine_abstract_16px.png</file>
+        <file alias="machine_warning_16px.png">images/machine_warning_16px.png</file>
+        <file alias="meditation_32px.png">images/meditation_32px.png</file>
+        <file alias="menubar_16px.png">images/menubar_16px.png</file>
+        <file alias="menubar_disabled_16px.png">images/menubar_disabled_16px.png</file>
+        <file alias="menubar_on_16px.png">images/menubar_on_16px.png</file>
+        <file alias="menubar_on_disabled_16px.png">images/menubar_on_disabled_16px.png</file>
+        <file alias="menubar_settings_16px.png">images/menubar_settings_16px.png</file>
+        <file alias="menubar_settings_disabled_16px.png">images/menubar_settings_disabled_16px.png</file>
         <file alias="minimize_16px.png">images/minimize_16px.png</file>
-        <file alias="restore_16px.png">images/restore_16px.png</file>
-        <file alias="close_16px.png">images/close_16px.png</file>
-        <file alias="close_popup_16px.png">images/close_popup_16px.png</file>
-        <file alias="ok_16px.png">images/ok_16px.png</file>
-        <file alias="cancel_16px.png">images/cancel_16px.png</file>
-        <file alias="vm_save_state_16px.png">images/vm_save_state_16px.png</file>
-        <file alias="vm_save_state_disabled_16px.png">images/vm_save_state_disabled_16px.png</file>
-        <file alias="video_capture_16px.png">images/video_capture_16px.png</file>
-        <file alias="video_capture_disabled_16px.png">images/video_capture_disabled_16px.png</file>
-        <file alias="video_capture_on_16px.png">images/video_capture_on_16px.png</file>
-        <file alias="video_capture_on_disabled_16px.png">images/video_capture_on_disabled_16px.png</file>
-        <file alias="video_capture_settings_16px.png">images/video_capture_settings_16px.png</file>
-        <file alias="video_capture_write_16px.png">images/video_capture_write_16px.png</file>
-        <file alias="drag_drop_16px.png">images/drag_drop_16px.png</file>
-        <file alias="drag_drop_disabled_16px.png">images/drag_drop_disabled_16px.png</file>
-        <file alias="shared_clipboard_16px.png">images/shared_clipboard_16px.png</file>
-        <file alias="shared_clipboard_disabled_16px.png">images/shared_clipboard_disabled_16px.png</file>
+        <file alias="monitor.png">images/monitor.png</file>
+        <file alias="monitor_glossy.png">images/monitor_glossy.png</file>
+        <file alias="mouse_16px.png">images/mouse_16px.png</file>
+        <file alias="mouse_can_seamless_16px.png">images/mouse_can_seamless_16px.png</file>
+        <file alias="mouse_can_seamless_disabled_16px.png">images/mouse_can_seamless_disabled_16px.png</file>
+        <file alias="mouse_can_seamless_on_16px.png">images/mouse_can_seamless_on_16px.png</file>
+        <file alias="mouse_can_seamless_on_disabled_16px.png">images/mouse_can_seamless_on_disabled_16px.png</file>
+        <file alias="mouse_can_seamless_uncaptured_16px.png">images/mouse_can_seamless_uncaptured_16px.png</file>
+        <file alias="mouse_disabled_16px.png">images/mouse_disabled_16px.png</file>
+        <file alias="mouse_seamless_16px.png">images/mouse_seamless_16px.png</file>
         <file alias="movie_reel_16px.png">images/movie_reel_16px.png</file>
-        <file alias="sort_16px.png">images/sort_16px.png</file>
-        <file alias="sort_disabled_16px.png">images/sort_disabled_16px.png</file>
+        <file alias="name_16px.png">images/name_16px.png</file>
+        <file alias="next_16px.png">images/next_16px.png</file>
+        <file alias="nw_16px.png">images/nw_16px.png</file>
+        <file alias="nw_24px.png">images/nw_24px.png</file>
+        <file alias="nw_32px.png">images/nw_32px.png</file>
+        <file alias="nw_disabled_16px.png">images/nw_disabled_16px.png</file>
+        <file alias="nw_disconnected_16px.png">images/nw_disconnected_16px.png</file>
+        <file alias="nw_error_16px.png">images/nw_error_16px.png</file>
+        <file alias="nw_loading_16px.png">images/nw_loading_16px.png</file>
+        <file alias="nw_read_16px.png">images/nw_read_16px.png</file>
+        <file alias="nw_settings_16px.png">images/nw_settings_16px.png</file>
+        <file alias="nw_settings_disabled_16px.png">images/nw_settings_disabled_16px.png</file>
+        <file alias="nw_warning_16px.png">images/nw_warning_16px.png</file>
+        <file alias="nw_write_16px.png">images/nw_write_16px.png</file>
+        <file alias="ok_16px.png">images/ok_16px.png</file>
+        <file alias="os_archlinux.png">images/os_archlinux.png</file>
+        <file alias="os_archlinux_64.png">images/os_archlinux_64.png</file>
+        <file alias="os_debian.png">images/os_debian.png</file>
+        <file alias="os_debian_64.png">images/os_debian_64.png</file>
+        <file alias="os_dos.png">images/os_dos.png</file>
+        <file alias="os_fedora.png">images/os_fedora.png</file>
+        <file alias="os_fedora_64.png">images/os_fedora_64.png</file>
+        <file alias="os_freebsd.png">images/os_freebsd.png</file>
+        <file alias="os_freebsd_64.png">images/os_freebsd_64.png</file>
+        <file alias="os_gentoo.png">images/os_gentoo.png</file>
+        <file alias="os_gentoo_64.png">images/os_gentoo_64.png</file>
+        <file alias="os_jrockitve.png">images/os_jrockitve.png</file>
+        <file alias="os_l4.png">images/os_l4.png</file>
+        <file alias="os_linux.png">images/os_linux.png</file>
+        <file alias="os_linux22.png">images/os_linux22.png</file>
+        <file alias="os_linux24.png">images/os_linux24.png</file>
+        <file alias="os_linux24_64.png">images/os_linux24_64.png</file>
+        <file alias="os_linux26.png">images/os_linux26.png</file>
+        <file alias="os_linux26_64.png">images/os_linux26_64.png</file>
+        <file alias="os_linux_other.png">images/os_linux_other.png</file>
+        <file alias="os_macosx.png">images/os_macosx.png</file>
+        <file alias="os_macosx_64.png">images/os_macosx_64.png</file>
+        <file alias="os_mandriva.png">images/os_mandriva.png</file>
+        <file alias="os_mandriva_64.png">images/os_mandriva_64.png</file>
+        <file alias="os_netbsd.png">images/os_netbsd.png</file>
+        <file alias="os_netbsd_64.png">images/os_netbsd_64.png</file>
+        <file alias="os_netware.png">images/os_netware.png</file>
+        <file alias="os_openbsd.png">images/os_openbsd.png</file>
+        <file alias="os_openbsd_64.png">images/os_openbsd_64.png</file>
+        <file alias="os_opensuse.png">images/os_opensuse.png</file>
+        <file alias="os_opensuse_64.png">images/os_opensuse_64.png</file>
+        <file alias="os_oracle.png">images/os_oracle.png</file>
+        <file alias="os_oracle_64.png">images/os_oracle_64.png</file>
+        <file alias="os_oraclesolaris.png">images/os_oraclesolaris.png</file>
+        <file alias="os_oraclesolaris_64.png">images/os_oraclesolaris_64.png</file>
+        <file alias="os_os2_other.png">images/os_os2_other.png</file>
+        <file alias="os_os2ecs.png">images/os_os2ecs.png</file>
+        <file alias="os_os2warp3.png">images/os_os2warp3.png</file>
+        <file alias="os_os2warp4.png">images/os_os2warp4.png</file>
+        <file alias="os_os2warp45.png">images/os_os2warp45.png</file>
+        <file alias="os_other.png">images/os_other.png</file>
+        <file alias="os_other_64.png">images/os_other_64.png</file>
+        <file alias="os_qnx.png">images/os_qnx.png</file>
+        <file alias="os_redhat.png">images/os_redhat.png</file>
+        <file alias="os_redhat_64.png">images/os_redhat_64.png</file>
+        <file alias="os_solaris.png">images/os_solaris.png</file>
+        <file alias="os_solaris_64.png">images/os_solaris_64.png</file>
+        <file alias="os_turbolinux.png">images/os_turbolinux.png</file>
+        <file alias="os_turbolinux_64.png">images/os_turbolinux_64.png</file>
+        <file alias="os_type_16px.png">images/os_type_16px.png</file>
+        <file alias="os_ubuntu.png">images/os_ubuntu.png</file>
+        <file alias="os_ubuntu_64.png">images/os_ubuntu_64.png</file>
     </qresource>
 </RCC>
diff --git a/src/VBox/Frontends/VirtualBox/VirtualBox1_hidpi.qrc b/src/VBox/Frontends/VirtualBox/VirtualBox1_hidpi.qrc
new file mode 100644
index 0000000..715cdce
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/VirtualBox1_hidpi.qrc
@@ -0,0 +1,273 @@
+<RCC>
+    <qresource prefix="/">
+        <file alias="add_host_iface_16px_hidpi.png">images/hidpi/add_host_iface_16px_hidpi.png</file>
+        <file alias="add_host_iface_disabled_16px_hidpi.png">images/hidpi/add_host_iface_disabled_16px_hidpi.png</file>
+        <file alias="adjust_win_size_16px_hidpi.png">images/hidpi/adjust_win_size_16px_hidpi.png</file>
+        <file alias="adjust_win_size_disabled_16px_hidpi.png">images/hidpi/adjust_win_size_disabled_16px_hidpi.png</file>
+        <file alias="arrow_down_10px_hidpi.png">images/hidpi/arrow_down_10px_hidpi.png</file>
+        <file alias="arrow_left_10px_hidpi.png">images/hidpi/arrow_left_10px_hidpi.png</file>
+        <file alias="arrow_right_10px_hidpi.png">images/hidpi/arrow_right_10px_hidpi.png</file>
+        <file alias="arrow_up_10px_hidpi.png">images/hidpi/arrow_up_10px_hidpi.png</file>
+        <file alias="attachment_add_16px_hidpi.png">images/hidpi/attachment_add_16px_hidpi.png</file>
+        <file alias="attachment_add_disabled_16px_hidpi.png">images/hidpi/attachment_add_disabled_16px_hidpi.png</file>
+        <file alias="attachment_remove_16px_hidpi.png">images/hidpi/attachment_remove_16px_hidpi.png</file>
+        <file alias="attachment_remove_disabled_16px_hidpi.png">images/hidpi/attachment_remove_disabled_16px_hidpi.png</file>
+        <file alias="auto_resize_on_16px_hidpi.png">images/hidpi/auto_resize_on_16px_hidpi.png</file>
+        <file alias="auto_resize_on_disabled_16px_hidpi.png">images/hidpi/auto_resize_on_disabled_16px_hidpi.png</file>
+        <file alias="auto_resize_on_on_16px_hidpi.png">images/hidpi/auto_resize_on_on_16px_hidpi.png</file>
+        <file alias="auto_resize_on_on_disabled_16px_hidpi.png">images/hidpi/auto_resize_on_on_disabled_16px_hidpi.png</file>
+        <file alias="cancel_16px_hidpi.png">images/hidpi/cancel_16px_hidpi.png</file>
+        <file alias="cd_16px_hidpi.png">images/hidpi/cd_16px_hidpi.png</file>
+        <file alias="cd_add_16px_hidpi.png">images/hidpi/cd_add_16px_hidpi.png</file>
+        <file alias="cd_add_disabled_16px_hidpi.png">images/hidpi/cd_add_disabled_16px_hidpi.png</file>
+        <file alias="cd_copy_16px_hidpi.png">images/hidpi/cd_copy_16px_hidpi.png</file>
+        <file alias="cd_copy_22px_hidpi.png">images/hidpi/cd_copy_22px_hidpi.png</file>
+        <file alias="cd_copy_disabled_16px_hidpi.png">images/hidpi/cd_copy_disabled_16px_hidpi.png</file>
+        <file alias="cd_copy_disabled_22px_hidpi.png">images/hidpi/cd_copy_disabled_22px_hidpi.png</file>
+        <file alias="cd_disabled_16px_hidpi.png">images/hidpi/cd_disabled_16px_hidpi.png</file>
+        <file alias="cd_modify_16px_hidpi.png">images/hidpi/cd_modify_16px_hidpi.png</file>
+        <file alias="cd_modify_22px_hidpi.png">images/hidpi/cd_modify_22px_hidpi.png</file>
+        <file alias="cd_modify_disabled_16px_hidpi.png">images/hidpi/cd_modify_disabled_16px_hidpi.png</file>
+        <file alias="cd_modify_disabled_22px_hidpi.png">images/hidpi/cd_modify_disabled_22px_hidpi.png</file>
+        <file alias="cd_read_16px_hidpi.png">images/hidpi/cd_read_16px_hidpi.png</file>
+        <file alias="cd_release_16px_hidpi.png">images/hidpi/cd_release_16px_hidpi.png</file>
+        <file alias="cd_release_22px_hidpi.png">images/hidpi/cd_release_22px_hidpi.png</file>
+        <file alias="cd_release_disabled_16px_hidpi.png">images/hidpi/cd_release_disabled_16px_hidpi.png</file>
+        <file alias="cd_release_disabled_22px_hidpi.png">images/hidpi/cd_release_disabled_22px_hidpi.png</file>
+        <file alias="cd_remove_16px_hidpi.png">images/hidpi/cd_remove_16px_hidpi.png</file>
+        <file alias="cd_remove_22px_hidpi.png">images/hidpi/cd_remove_22px_hidpi.png</file>
+        <file alias="cd_remove_disabled_16px_hidpi.png">images/hidpi/cd_remove_disabled_16px_hidpi.png</file>
+        <file alias="cd_remove_disabled_22px_hidpi.png">images/hidpi/cd_remove_disabled_22px_hidpi.png</file>
+        <file alias="cd_unmount_16px_hidpi.png">images/hidpi/cd_unmount_16px_hidpi.png</file>
+        <file alias="cd_unmount_disabled_16px_hidpi.png">images/hidpi/cd_unmount_disabled_16px_hidpi.png</file>
+        <file alias="cd_write_16px_hidpi.png">images/hidpi/cd_write_16px_hidpi.png</file>
+        <file alias="chipset_16px_hidpi.png">images/hidpi/chipset_16px_hidpi.png</file>
+        <file alias="chipset_24px_hidpi.png">images/hidpi/chipset_24px_hidpi.png</file>
+        <file alias="chipset_32px_hidpi.png">images/hidpi/chipset_32px_hidpi.png</file>
+        <file alias="chipset_warning_16px_hidpi.png">images/hidpi/chipset_warning_16px_hidpi.png</file>
+        <file alias="close_16px_hidpi.png">images/hidpi/close_16px_hidpi.png</file>
+        <file alias="close_popup_16px_hidpi.png">images/hidpi/close_popup_16px_hidpi.png</file>
+        <file alias="connect_16px_hidpi.png">images/hidpi/connect_16px_hidpi.png</file>
+        <file alias="controller_add_16px_hidpi.png">images/hidpi/controller_add_16px_hidpi.png</file>
+        <file alias="controller_add_disabled_16px_hidpi.png">images/hidpi/controller_add_disabled_16px_hidpi.png</file>
+        <file alias="controller_remove_16px_hidpi.png">images/hidpi/controller_remove_16px_hidpi.png</file>
+        <file alias="controller_remove_disabled_16px_hidpi.png">images/hidpi/controller_remove_disabled_16px_hidpi.png</file>
+        <file alias="cpu_16px_hidpi.png">images/hidpi/cpu_16px_hidpi.png</file>
+        <file alias="description_16px_hidpi.png">images/hidpi/description_16px_hidpi.png</file>
+        <file alias="disconnect_16px_hidpi.png">images/hidpi/disconnect_16px_hidpi.png</file>
+        <file alias="diskimage_16px_hidpi.png">images/hidpi/diskimage_16px_hidpi.png</file>
+        <file alias="diskimage_32px_hidpi.png">images/hidpi/diskimage_32px_hidpi.png</file>
+        <file alias="display_hardware_16px_hidpi.png">images/hidpi/display_hardware_16px_hidpi.png</file>
+        <file alias="display_hardware_write_16px_hidpi.png">images/hidpi/display_hardware_write_16px_hidpi.png</file>
+        <file alias="display_software_16px_hidpi.png">images/hidpi/display_software_16px_hidpi.png</file>
+        <file alias="drag_drop_16px_hidpi.png">images/hidpi/drag_drop_16px_hidpi.png</file>
+        <file alias="drag_drop_disabled_16px_hidpi.png">images/hidpi/drag_drop_disabled_16px_hidpi.png</file>
+        <file alias="edata_add_16px_hidpi.png">images/hidpi/edata_add_16px_hidpi.png</file>
+        <file alias="edata_add_22px_hidpi.png">images/hidpi/edata_add_22px_hidpi.png</file>
+        <file alias="edata_add_disabled_16px_hidpi.png">images/hidpi/edata_add_disabled_16px_hidpi.png</file>
+        <file alias="edata_add_disabled_22px_hidpi.png">images/hidpi/edata_add_disabled_22px_hidpi.png</file>
+        <file alias="edata_load_16px_hidpi.png">images/hidpi/edata_load_16px_hidpi.png</file>
+        <file alias="edata_load_22px_hidpi.png">images/hidpi/edata_load_22px_hidpi.png</file>
+        <file alias="edata_load_disabled_16px_hidpi.png">images/hidpi/edata_load_disabled_16px_hidpi.png</file>
+        <file alias="edata_load_disabled_22px_hidpi.png">images/hidpi/edata_load_disabled_22px_hidpi.png</file>
+        <file alias="edata_remove_16px_hidpi.png">images/hidpi/edata_remove_16px_hidpi.png</file>
+        <file alias="edata_remove_22px_hidpi.png">images/hidpi/edata_remove_22px_hidpi.png</file>
+        <file alias="edata_remove_disabled_16px_hidpi.png">images/hidpi/edata_remove_disabled_16px_hidpi.png</file>
+        <file alias="edata_remove_disabled_22px_hidpi.png">images/hidpi/edata_remove_disabled_22px_hidpi.png</file>
+        <file alias="edata_save_16px_hidpi.png">images/hidpi/edata_save_16px_hidpi.png</file>
+        <file alias="edata_save_22px_hidpi.png">images/hidpi/edata_save_22px_hidpi.png</file>
+        <file alias="edata_save_disabled_16px_hidpi.png">images/hidpi/edata_save_disabled_16px_hidpi.png</file>
+        <file alias="edata_save_disabled_22px_hidpi.png">images/hidpi/edata_save_disabled_22px_hidpi.png</file>
+        <file alias="edataglobal_32px_hidpi.png">images/hidpi/edataglobal_32px_hidpi.png</file>
+        <file alias="edataman_16px_hidpi.png">images/hidpi/edataman_16px_hidpi.png</file>
+        <file alias="edataman_32px_hidpi.png">images/hidpi/edataman_32px_hidpi.png</file>
+        <file alias="eraser_16px_hidpi.png">images/hidpi/eraser_16px_hidpi.png</file>
+        <file alias="exit_16px_hidpi.png">images/hidpi/exit_16px_hidpi.png</file>
+        <file alias="expanding_collapsing_16px_hidpi.png">images/hidpi/expanding_collapsing_16px_hidpi.png</file>
+        <file alias="export_16px_hidpi.png">images/hidpi/export_16px_hidpi.png</file>
+        <file alias="extension_pack_16px_hidpi.png">images/hidpi/extension_pack_16px_hidpi.png</file>
+        <file alias="extension_pack_24px_hidpi.png">images/hidpi/extension_pack_24px_hidpi.png</file>
+        <file alias="extension_pack_32px_hidpi.png">images/hidpi/extension_pack_32px_hidpi.png</file>
+        <file alias="extension_pack_install_16px_hidpi.png">images/hidpi/extension_pack_install_16px_hidpi.png</file>
+        <file alias="extension_pack_install_disabled_16px_hidpi.png">images/hidpi/extension_pack_install_disabled_16px_hidpi.png</file>
+        <file alias="extension_pack_uninstall_16px_hidpi.png">images/hidpi/extension_pack_uninstall_16px_hidpi.png</file>
+        <file alias="extension_pack_uninstall_disabled_16px_hidpi.png">images/hidpi/extension_pack_uninstall_disabled_16px_hidpi.png</file>
+        <file alias="extension_pack_warning_16px_hidpi.png">images/hidpi/extension_pack_warning_16px_hidpi.png</file>
+        <file alias="fd_16px_hidpi.png">images/hidpi/fd_16px_hidpi.png</file>
+        <file alias="fd_add_16px_hidpi.png">images/hidpi/fd_add_16px_hidpi.png</file>
+        <file alias="fd_add_disabled_16px_hidpi.png">images/hidpi/fd_add_disabled_16px_hidpi.png</file>
+        <file alias="fd_copy_16px_hidpi.png">images/hidpi/fd_copy_16px_hidpi.png</file>
+        <file alias="fd_copy_22px_hidpi.png">images/hidpi/fd_copy_22px_hidpi.png</file>
+        <file alias="fd_copy_disabled_16px_hidpi.png">images/hidpi/fd_copy_disabled_16px_hidpi.png</file>
+        <file alias="fd_copy_disabled_22px_hidpi.png">images/hidpi/fd_copy_disabled_22px_hidpi.png</file>
+        <file alias="fd_disabled_16px_hidpi.png">images/hidpi/fd_disabled_16px_hidpi.png</file>
+        <file alias="fd_modify_16px_hidpi.png">images/hidpi/fd_modify_16px_hidpi.png</file>
+        <file alias="fd_modify_22px_hidpi.png">images/hidpi/fd_modify_22px_hidpi.png</file>
+        <file alias="fd_modify_disabled_16px_hidpi.png">images/hidpi/fd_modify_disabled_16px_hidpi.png</file>
+        <file alias="fd_modify_disabled_22px_hidpi.png">images/hidpi/fd_modify_disabled_22px_hidpi.png</file>
+        <file alias="fd_read_16px_hidpi.png">images/hidpi/fd_read_16px_hidpi.png</file>
+        <file alias="fd_release_16px_hidpi.png">images/hidpi/fd_release_16px_hidpi.png</file>
+        <file alias="fd_release_22px_hidpi.png">images/hidpi/fd_release_22px_hidpi.png</file>
+        <file alias="fd_release_disabled_16px_hidpi.png">images/hidpi/fd_release_disabled_16px_hidpi.png</file>
+        <file alias="fd_release_disabled_22px_hidpi.png">images/hidpi/fd_release_disabled_22px_hidpi.png</file>
+        <file alias="fd_remove_16px_hidpi.png">images/hidpi/fd_remove_16px_hidpi.png</file>
+        <file alias="fd_remove_22px_hidpi.png">images/hidpi/fd_remove_22px_hidpi.png</file>
+        <file alias="fd_remove_disabled_16px_hidpi.png">images/hidpi/fd_remove_disabled_16px_hidpi.png</file>
+        <file alias="fd_remove_disabled_22px_hidpi.png">images/hidpi/fd_remove_disabled_22px_hidpi.png</file>
+        <file alias="fd_unmount_16px_hidpi.png">images/hidpi/fd_unmount_16px_hidpi.png</file>
+        <file alias="fd_unmount_disabled_16px_hidpi.png">images/hidpi/fd_unmount_disabled_16px_hidpi.png</file>
+        <file alias="fd_write_16px_hidpi.png">images/hidpi/fd_write_16px_hidpi.png</file>
+        <file alias="floppy_16px_hidpi.png">images/hidpi/floppy_16px_hidpi.png</file>
+        <file alias="floppy_add_16px_hidpi.png">images/hidpi/floppy_add_16px_hidpi.png</file>
+        <file alias="floppy_add_disabled_16px_hidpi.png">images/hidpi/floppy_add_disabled_16px_hidpi.png</file>
+        <file alias="floppy_collapse_16px_hidpi.png">images/hidpi/floppy_collapse_16px_hidpi.png</file>
+        <file alias="floppy_expand_16px_hidpi.png">images/hidpi/floppy_expand_16px_hidpi.png</file>
+        <file alias="fullscreen_16px_hidpi.png">images/hidpi/fullscreen_16px_hidpi.png</file>
+        <file alias="fullscreen_disabled_16px_hidpi.png">images/hidpi/fullscreen_disabled_16px_hidpi.png</file>
+        <file alias="fullscreen_on_16px_hidpi.png">images/hidpi/fullscreen_on_16px_hidpi.png</file>
+        <file alias="fullscreen_on_disabled_16px_hidpi.png">images/hidpi/fullscreen_on_disabled_16px_hidpi.png</file>
+        <file alias="global_settings_16px_hidpi.png">images/hidpi/global_settings_16px_hidpi.png</file>
+        <file alias="group_abstract_16px_hidpi.png">images/hidpi/group_abstract_16px_hidpi.png</file>
+        <file alias="guesttools_16px_hidpi.png">images/hidpi/guesttools_16px_hidpi.png</file>
+        <file alias="guesttools_disabled_16px_hidpi.png">images/hidpi/guesttools_disabled_16px_hidpi.png</file>
+        <file alias="hd_16px_hidpi.png">images/hidpi/hd_16px_hidpi.png</file>
+        <file alias="hd_24px_hidpi.png">images/hidpi/hd_24px_hidpi.png</file>
+        <file alias="hd_32px_hidpi.png">images/hidpi/hd_32px_hidpi.png</file>
+        <file alias="hd_add_16px_hidpi.png">images/hidpi/hd_add_16px_hidpi.png</file>
+        <file alias="hd_add_disabled_16px_hidpi.png">images/hidpi/hd_add_disabled_16px_hidpi.png</file>
+        <file alias="hd_copy_16px_hidpi.png">images/hidpi/hd_copy_16px_hidpi.png</file>
+        <file alias="hd_copy_22px_hidpi.png">images/hidpi/hd_copy_22px_hidpi.png</file>
+        <file alias="hd_copy_disabled_16px_hidpi.png">images/hidpi/hd_copy_disabled_16px_hidpi.png</file>
+        <file alias="hd_copy_disabled_22px_hidpi.png">images/hidpi/hd_copy_disabled_22px_hidpi.png</file>
+        <file alias="hd_disabled_16px_hidpi.png">images/hidpi/hd_disabled_16px_hidpi.png</file>
+        <file alias="hd_modify_16px_hidpi.png">images/hidpi/hd_modify_16px_hidpi.png</file>
+        <file alias="hd_modify_22px_hidpi.png">images/hidpi/hd_modify_22px_hidpi.png</file>
+        <file alias="hd_modify_disabled_16px_hidpi.png">images/hidpi/hd_modify_disabled_16px_hidpi.png</file>
+        <file alias="hd_modify_disabled_22px_hidpi.png">images/hidpi/hd_modify_disabled_22px_hidpi.png</file>
+        <file alias="hd_new_16px_hidpi.png">images/hidpi/hd_new_16px_hidpi.png</file>
+        <file alias="hd_new_disabled_16px_hidpi.png">images/hidpi/hd_new_disabled_16px_hidpi.png</file>
+        <file alias="hd_read_16px_hidpi.png">images/hidpi/hd_read_16px_hidpi.png</file>
+        <file alias="hd_release_16px_hidpi.png">images/hidpi/hd_release_16px_hidpi.png</file>
+        <file alias="hd_release_22px_hidpi.png">images/hidpi/hd_release_22px_hidpi.png</file>
+        <file alias="hd_release_disabled_16px_hidpi.png">images/hidpi/hd_release_disabled_16px_hidpi.png</file>
+        <file alias="hd_release_disabled_22px_hidpi.png">images/hidpi/hd_release_disabled_22px_hidpi.png</file>
+        <file alias="hd_remove_16px_hidpi.png">images/hidpi/hd_remove_16px_hidpi.png</file>
+        <file alias="hd_remove_22px_hidpi.png">images/hidpi/hd_remove_22px_hidpi.png</file>
+        <file alias="hd_remove_disabled_16px_hidpi.png">images/hidpi/hd_remove_disabled_16px_hidpi.png</file>
+        <file alias="hd_remove_disabled_22px_hidpi.png">images/hidpi/hd_remove_disabled_22px_hidpi.png</file>
+        <file alias="hd_settings_16px_hidpi.png">images/hidpi/hd_settings_16px_hidpi.png</file>
+        <file alias="hd_settings_disabled_16px_hidpi.png">images/hidpi/hd_settings_disabled_16px_hidpi.png</file>
+        <file alias="hd_warning_16px_hidpi.png">images/hidpi/hd_warning_16px_hidpi.png</file>
+        <file alias="hd_write_16px_hidpi.png">images/hidpi/hd_write_16px_hidpi.png</file>
+        <file alias="help_16px_hidpi.png">images/hidpi/help_16px_hidpi.png</file>
+        <file alias="help_button_normal_mac_22px_hidpi.png">images/hidpi/help_button_normal_mac_22px_hidpi.png</file>
+        <file alias="help_button_pressed_mac_22px_hidpi.png">images/hidpi/help_button_pressed_mac_22px_hidpi.png</file>
+        <file alias="hostkey_16px_hidpi.png">images/hidpi/hostkey_16px_hidpi.png</file>
+        <file alias="hostkey_24px_hidpi.png">images/hidpi/hostkey_24px_hidpi.png</file>
+        <file alias="hostkey_32px_hidpi.png">images/hidpi/hostkey_32px_hidpi.png</file>
+        <file alias="hostkey_captured_16px_hidpi.png">images/hidpi/hostkey_captured_16px_hidpi.png</file>
+        <file alias="hostkey_captured_pressed_16px_hidpi.png">images/hidpi/hostkey_captured_pressed_16px_hidpi.png</file>
+        <file alias="hostkey_disabled_16px_hidpi.png">images/hidpi/hostkey_disabled_16px_hidpi.png</file>
+        <file alias="hostkey_pressed_16px_hidpi.png">images/hidpi/hostkey_pressed_16px_hidpi.png</file>
+        <file alias="hostkey_warning_16px_hidpi.png">images/hidpi/hostkey_warning_16px_hidpi.png</file>
+        <file alias="ide_16px_hidpi.png">images/hidpi/ide_16px_hidpi.png</file>
+        <file alias="ide_add_16px_hidpi.png">images/hidpi/ide_add_16px_hidpi.png</file>
+        <file alias="ide_add_disabled_16px_hidpi.png">images/hidpi/ide_add_disabled_16px_hidpi.png</file>
+        <file alias="ide_collapse_16px_hidpi.png">images/hidpi/ide_collapse_16px_hidpi.png</file>
+        <file alias="ide_expand_16px_hidpi.png">images/hidpi/ide_expand_16px_hidpi.png</file>
+        <file alias="import_16px_hidpi.png">images/hidpi/import_16px_hidpi.png</file>
+        <file alias="interface_16px_hidpi.png">images/hidpi/interface_16px_hidpi.png</file>
+        <file alias="interface_24px_hidpi.png">images/hidpi/interface_24px_hidpi.png</file>
+        <file alias="interface_32px_hidpi.png">images/hidpi/interface_32px_hidpi.png</file>
+        <file alias="interface_warning_16px_hidpi.png">images/hidpi/interface_warning_16px_hidpi.png</file>
+        <file alias="keyboard_16px_hidpi.png">images/hidpi/keyboard_16px_hidpi.png</file>
+        <file alias="keyboard_24px_hidpi.png">images/hidpi/keyboard_24px_hidpi.png</file>
+        <file alias="keyboard_32px_hidpi.png">images/hidpi/keyboard_32px_hidpi.png</file>
+        <file alias="keyboard_settings_16px_hidpi.png">images/hidpi/keyboard_settings_16px_hidpi.png</file>
+        <file alias="keyboard_settings_disabled_16px_hidpi.png">images/hidpi/keyboard_settings_disabled_16px_hidpi.png</file>
+        <file alias="list_movedown_16px_hidpi.png">images/hidpi/list_movedown_16px_hidpi.png</file>
+        <file alias="list_movedown_disabled_16px_hidpi.png">images/hidpi/list_movedown_disabled_16px_hidpi.png</file>
+        <file alias="list_moveup_16px_hidpi.png">images/hidpi/list_moveup_16px_hidpi.png</file>
+        <file alias="list_moveup_disabled_16px_hidpi.png">images/hidpi/list_moveup_disabled_16px_hidpi.png</file>
+        <file alias="machine_16px_hidpi.png">images/hidpi/machine_16px_hidpi.png</file>
+        <file alias="machine_24px_hidpi.png">images/hidpi/machine_24px_hidpi.png</file>
+        <file alias="machine_32px_hidpi.png">images/hidpi/machine_32px_hidpi.png</file>
+        <file alias="machine_abstract_16px_hidpi.png">images/hidpi/machine_abstract_16px_hidpi.png</file>
+        <file alias="machine_warning_16px_hidpi.png">images/hidpi/machine_warning_16px_hidpi.png</file>
+        <file alias="meditation_32px_hidpi.png">images/hidpi/meditation_32px_hidpi.png</file>
+        <file alias="menubar_on_16px_hidpi.png">images/hidpi/menubar_on_16px_hidpi.png</file>
+        <file alias="menubar_on_disabled_16px_hidpi.png">images/hidpi/menubar_on_disabled_16px_hidpi.png</file>
+        <file alias="minimize_16px_hidpi.png">images/hidpi/minimize_16px_hidpi.png</file>
+        <file alias="mouse_16px_hidpi.png">images/hidpi/mouse_16px_hidpi.png</file>
+        <file alias="mouse_can_seamless_16px_hidpi.png">images/hidpi/mouse_can_seamless_16px_hidpi.png</file>
+        <file alias="mouse_can_seamless_disabled_16px_hidpi.png">images/hidpi/mouse_can_seamless_disabled_16px_hidpi.png</file>
+        <file alias="mouse_can_seamless_on_16px_hidpi.png">images/hidpi/mouse_can_seamless_on_16px_hidpi.png</file>
+        <file alias="mouse_can_seamless_on_disabled_16px_hidpi.png">images/hidpi/mouse_can_seamless_on_disabled_16px_hidpi.png</file>
+        <file alias="mouse_can_seamless_uncaptured_16px_hidpi.png">images/hidpi/mouse_can_seamless_uncaptured_16px_hidpi.png</file>
+        <file alias="mouse_disabled_16px_hidpi.png">images/hidpi/mouse_disabled_16px_hidpi.png</file>
+        <file alias="mouse_seamless_16px_hidpi.png">images/hidpi/mouse_seamless_16px_hidpi.png</file>
+        <file alias="movie_reel_16px_hidpi.png">images/hidpi/movie_reel_16px_hidpi.png</file>
+        <file alias="name_16px_hidpi.png">images/hidpi/name_16px_hidpi.png</file>
+        <file alias="next_16px_hidpi.png">images/hidpi/next_16px_hidpi.png</file>
+        <file alias="nw_16px_hidpi.png">images/hidpi/nw_16px_hidpi.png</file>
+        <file alias="nw_24px_hidpi.png">images/hidpi/nw_24px_hidpi.png</file>
+        <file alias="nw_32px_hidpi.png">images/hidpi/nw_32px_hidpi.png</file>
+        <file alias="nw_disabled_16px_hidpi.png">images/hidpi/nw_disabled_16px_hidpi.png</file>
+        <file alias="nw_disconnected_16px_hidpi.png">images/hidpi/nw_disconnected_16px_hidpi.png</file>
+        <file alias="nw_error_16px_hidpi.png">images/hidpi/nw_error_16px_hidpi.png</file>
+        <file alias="nw_loading_16px_hidpi.png">images/hidpi/nw_loading_16px_hidpi.png</file>
+        <file alias="nw_read_16px_hidpi.png">images/hidpi/nw_read_16px_hidpi.png</file>
+        <file alias="nw_settings_16px_hidpi.png">images/hidpi/nw_settings_16px_hidpi.png</file>
+        <file alias="nw_settings_disabled_16px_hidpi.png">images/hidpi/nw_settings_disabled_16px_hidpi.png</file>
+        <file alias="nw_warning_16px_hidpi.png">images/hidpi/nw_warning_16px_hidpi.png</file>
+        <file alias="nw_write_16px_hidpi.png">images/hidpi/nw_write_16px_hidpi.png</file>
+        <file alias="ok_16px_hidpi.png">images/hidpi/ok_16px_hidpi.png</file>
+        <file alias="os_archlinux_64_hidpi.png">images/hidpi/os_archlinux_64_hidpi.png</file>
+        <file alias="os_archlinux_hidpi.png">images/hidpi/os_archlinux_hidpi.png</file>
+        <file alias="os_debian_64_hidpi.png">images/hidpi/os_debian_64_hidpi.png</file>
+        <file alias="os_debian_hidpi.png">images/hidpi/os_debian_hidpi.png</file>
+        <file alias="os_dos_hidpi.png">images/hidpi/os_dos_hidpi.png</file>
+        <file alias="os_fedora_64_hidpi.png">images/hidpi/os_fedora_64_hidpi.png</file>
+        <file alias="os_fedora_hidpi.png">images/hidpi/os_fedora_hidpi.png</file>
+        <file alias="os_freebsd_64_hidpi.png">images/hidpi/os_freebsd_64_hidpi.png</file>
+        <file alias="os_freebsd_hidpi.png">images/hidpi/os_freebsd_hidpi.png</file>
+        <file alias="os_freedos_hidpi.png">images/hidpi/os_freedos_hidpi.png</file>
+        <file alias="os_gentoo_64_hidpi.png">images/hidpi/os_gentoo_64_hidpi.png</file>
+        <file alias="os_gentoo_hidpi.png">images/hidpi/os_gentoo_hidpi.png</file>
+        <file alias="os_jrockitve_hidpi.png">images/hidpi/os_jrockitve_hidpi.png</file>
+        <file alias="os_l4_hidpi.png">images/hidpi/os_l4_hidpi.png</file>
+        <file alias="os_linux22_hidpi.png">images/hidpi/os_linux22_hidpi.png</file>
+        <file alias="os_linux24_64_hidpi.png">images/hidpi/os_linux24_64_hidpi.png</file>
+        <file alias="os_linux24_hidpi.png">images/hidpi/os_linux24_hidpi.png</file>
+        <file alias="os_linux26_64_hidpi.png">images/hidpi/os_linux26_64_hidpi.png</file>
+        <file alias="os_linux26_hidpi.png">images/hidpi/os_linux26_hidpi.png</file>
+        <file alias="os_linux_hidpi.png">images/hidpi/os_linux_hidpi.png</file>
+        <file alias="os_linux_other_hidpi.png">images/hidpi/os_linux_other_hidpi.png</file>
+        <file alias="os_macosx_64_hidpi.png">images/hidpi/os_macosx_64_hidpi.png</file>
+        <file alias="os_macosx_hidpi.png">images/hidpi/os_macosx_hidpi.png</file>
+        <file alias="os_mandriva_64_hidpi.png">images/hidpi/os_mandriva_64_hidpi.png</file>
+        <file alias="os_mandriva_hidpi.png">images/hidpi/os_mandriva_hidpi.png</file>
+        <file alias="os_mint_64_hidpi.png">images/hidpi/os_mint_64_hidpi.png</file>
+        <file alias="os_mint_hidpi.png">images/hidpi/os_mint_hidpi.png</file>
+        <file alias="os_netbsd_64_hidpi.png">images/hidpi/os_netbsd_64_hidpi.png</file>
+        <file alias="os_netbsd_hidpi.png">images/hidpi/os_netbsd_hidpi.png</file>
+        <file alias="os_netware_hidpi.png">images/hidpi/os_netware_hidpi.png</file>
+        <file alias="os_openbsd_64_hidpi.png">images/hidpi/os_openbsd_64_hidpi.png</file>
+        <file alias="os_openbsd_hidpi.png">images/hidpi/os_openbsd_hidpi.png</file>
+        <file alias="os_opensuse_64_hidpi.png">images/hidpi/os_opensuse_64_hidpi.png</file>
+        <file alias="os_opensuse_hidpi.png">images/hidpi/os_opensuse_hidpi.png</file>
+        <file alias="os_oracle_64_hidpi.png">images/hidpi/os_oracle_64_hidpi.png</file>
+        <file alias="os_oracle_hidpi.png">images/hidpi/os_oracle_hidpi.png</file>
+        <file alias="os_oraclesolaris_64_hidpi.png">images/hidpi/os_oraclesolaris_64_hidpi.png</file>
+        <file alias="os_oraclesolaris_hidpi.png">images/hidpi/os_oraclesolaris_hidpi.png</file>
+        <file alias="os_os2_other_hidpi.png">images/hidpi/os_os2_other_hidpi.png</file>
+        <file alias="os_os2ecs_hidpi.png">images/hidpi/os_os2ecs_hidpi.png</file>
+        <file alias="os_os2warp3_hidpi.png">images/hidpi/os_os2warp3_hidpi.png</file>
+        <file alias="os_os2warp45_hidpi.png">images/hidpi/os_os2warp45_hidpi.png</file>
+        <file alias="os_os2warp4_hidpi.png">images/hidpi/os_os2warp4_hidpi.png</file>
+        <file alias="os_other_64_hidpi.png">images/hidpi/os_other_64_hidpi.png</file>
+        <file alias="os_other_hidpi.png">images/hidpi/os_other_hidpi.png</file>
+        <file alias="os_qnx_hidpi.png">images/hidpi/os_qnx_hidpi.png</file>
+        <file alias="os_redhat_64_hidpi.png">images/hidpi/os_redhat_64_hidpi.png</file>
+    </qresource>
+</RCC>
diff --git a/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc b/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc
index 3282db8..bd47d16 100644
--- a/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc
+++ b/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc
@@ -1,69 +1,23 @@
 <RCC>
     <qresource prefix="/">
-        <file alias="os_archlinux.png">images/os_archlinux.png</file>
-        <file alias="os_archlinux_64.png">images/os_archlinux_64.png</file>
-        <file alias="os_debian.png">images/os_debian.png</file>
-        <file alias="os_debian_64.png">images/os_debian_64.png</file>
-        <file alias="os_dos.png">images/os_dos.png</file>
-        <file alias="os_fedora.png">images/os_fedora.png</file>
-        <file alias="os_fedora_64.png">images/os_fedora_64.png</file>
-        <file alias="os_freebsd.png">images/os_freebsd.png</file>
-        <file alias="os_freebsd_64.png">images/os_freebsd_64.png</file>
-        <file alias="os_gentoo.png">images/os_gentoo.png</file>
-        <file alias="os_gentoo_64.png">images/os_gentoo_64.png</file>
-        <file alias="os_jrockitve.png">images/os_jrockitve.png</file>
-        <file alias="os_l4.png">images/os_l4.png</file>
-        <file alias="os_linux_other.png">images/os_linux_other.png</file>
-        <file alias="os_linux22.png">images/os_linux22.png</file>
-        <file alias="os_linux24.png">images/os_linux24.png</file>
-        <file alias="os_linux24_64.png">images/os_linux24_64.png</file>
-        <file alias="os_linux26.png">images/os_linux26.png</file>
-        <file alias="os_linux26_64.png">images/os_linux26_64.png</file>
-        <file alias="os_mandriva.png">images/os_mandriva.png</file>
-        <file alias="os_mandriva_64.png">images/os_mandriva_64.png</file>
-        <file alias="os_netbsd.png">images/os_netbsd.png</file>
-        <file alias="os_netbsd_64.png">images/os_netbsd_64.png</file>
-        <file alias="os_netware.png">images/os_netware.png</file>
-        <file alias="os_openbsd.png">images/os_openbsd.png</file>
-        <file alias="os_openbsd_64.png">images/os_openbsd_64.png</file>
-        <file alias="os_oraclesolaris.png">images/os_oraclesolaris.png</file>
-        <file alias="os_oraclesolaris_64.png">images/os_oraclesolaris_64.png</file>
-        <file alias="os_opensuse.png">images/os_opensuse.png</file>
-        <file alias="os_opensuse_64.png">images/os_opensuse_64.png</file>
-        <file alias="os_os2_other.png">images/os_os2_other.png</file>
-        <file alias="os_os2ecs.png">images/os_os2ecs.png</file>
-        <file alias="os_os2warp3.png">images/os_os2warp3.png</file>
-        <file alias="os_os2warp4.png">images/os_os2warp4.png</file>
-        <file alias="os_os2warp45.png">images/os_os2warp45.png</file>
-        <file alias="os_other.png">images/os_other.png</file>
-        <file alias="os_other_64.png">images/os_other_64.png</file>
-        <file alias="os_qnx.png">images/os_qnx.png</file>
-        <file alias="os_redhat.png">images/os_redhat.png</file>
-        <file alias="os_redhat_64.png">images/os_redhat_64.png</file>
-        <file alias="os_turbolinux.png">images/os_turbolinux.png</file>
-        <file alias="os_turbolinux_64.png">images/os_turbolinux_64.png</file>
-        <file alias="os_solaris.png">images/os_solaris.png</file>
-        <file alias="os_solaris_64.png">images/os_solaris_64.png</file>
-        <file alias="os_ubuntu.png">images/os_ubuntu.png</file>
-        <file alias="os_ubuntu_64.png">images/os_ubuntu_64.png</file>
-        <file alias="os_win_other.png">images/os_win_other.png</file>
+        <file alias="os_win10.png">images/os_win10.png</file>
+        <file alias="os_win10_64.png">images/os_win10_64.png</file>
         <file alias="os_win2k.png">images/os_win2k.png</file>
+        <file alias="os_win2k12_64.png">images/os_win2k12_64.png</file>
         <file alias="os_win2k3.png">images/os_win2k3.png</file>
         <file alias="os_win2k3_64.png">images/os_win2k3_64.png</file>
         <file alias="os_win2k8.png">images/os_win2k8.png</file>
         <file alias="os_win2k8_64.png">images/os_win2k8_64.png</file>
-        <file alias="os_win2k12_64.png">images/os_win2k12_64.png</file>
         <file alias="os_win31.png">images/os_win31.png</file>
         <file alias="os_win7.png">images/os_win7.png</file>
         <file alias="os_win7_64.png">images/os_win7_64.png</file>
         <file alias="os_win8.png">images/os_win8.png</file>
-        <file alias="os_win8_64.png">images/os_win8_64.png</file>
         <file alias="os_win81.png">images/os_win81.png</file>
         <file alias="os_win81_64.png">images/os_win81_64.png</file>
-        <file alias="os_win10.png">images/os_win10.png</file>
-        <file alias="os_win10_64.png">images/os_win10_64.png</file>
+        <file alias="os_win8_64.png">images/os_win8_64.png</file>
         <file alias="os_win95.png">images/os_win95.png</file>
         <file alias="os_win98.png">images/os_win98.png</file>
+        <file alias="os_win_other.png">images/os_win_other.png</file>
         <file alias="os_winme.png">images/os_winme.png</file>
         <file alias="os_winnt4.png">images/os_winnt4.png</file>
         <file alias="os_winvista.png">images/os_winvista.png</file>
@@ -72,155 +26,261 @@
         <file alias="os_winxp_64.png">images/os_winxp_64.png</file>
         <file alias="os_xandros.png">images/os_xandros.png</file>
         <file alias="os_xandros_64.png">images/os_xandros_64.png</file>
-        <file alias="os_oracle.png">images/os_oracle.png</file>
-        <file alias="os_oracle_64.png">images/os_oracle_64.png</file>
-        <file alias="os_macosx.png">images/os_macosx.png</file>
-        <file alias="os_macosx_64.png">images/os_macosx_64.png</file>
-        <file alias="hd_16px.png">images/hd_16px.png</file>
-        <file alias="hd_disabled_16px.png">images/hd_disabled_16px.png</file>
-        <file alias="hd_32px.png">images/hd_32px.png</file>
-        <file alias="hd_disabled_32px.png">images/hd_disabled_32px.png</file>
-        <file alias="hd_read_16px.png">images/hd_read_16px.png</file>
-        <file alias="hd_write_16px.png">images/hd_write_16px.png</file>
-        <file alias="hd_add_16px.png">images/hd_add_16px.png</file>
-        <file alias="hd_add_disabled_16px.png">images/hd_add_disabled_16px.png</file>
-        <file alias="hd_add_22px.png">images/hd_add_22px.png</file>
-        <file alias="hd_add_disabled_22px.png">images/hd_add_disabled_22px.png</file>
-        <file alias="hd_new_16px.png">images/hd_new_16px.png</file>
-        <file alias="hd_new_disabled_16px.png">images/hd_new_disabled_16px.png</file>
-        <file alias="hd_new_22px.png">images/hd_new_22px.png</file>
-        <file alias="hd_new_disabled_22px.png">images/hd_new_disabled_22px.png</file>
-        <file alias="hd_release_16px.png">images/hd_release_16px.png</file>
-        <file alias="hd_release_disabled_16px.png">images/hd_release_disabled_16px.png</file>
-        <file alias="hd_release_22px.png">images/hd_release_22px.png</file>
-        <file alias="hd_release_disabled_22px.png">images/hd_release_disabled_22px.png</file>
-        <file alias="hd_remove_16px.png">images/hd_remove_16px.png</file>
-        <file alias="hd_remove_disabled_16px.png">images/hd_remove_disabled_16px.png</file>
-        <file alias="hd_remove_22px.png">images/hd_remove_22px.png</file>
-        <file alias="hd_remove_disabled_22px.png">images/hd_remove_disabled_22px.png</file>
-        <file alias="cd_16px.png">images/cd_16px.png</file>
-        <file alias="cd_disabled_16px.png">images/cd_disabled_16px.png</file>
-        <file alias="cd_32px.png">images/cd_32px.png</file>
-        <file alias="cd_disabled_32px.png">images/cd_disabled_32px.png</file>
-        <file alias="cd_read_16px.png">images/cd_read_16px.png</file>
-        <file alias="cd_write_16px.png">images/cd_write_16px.png</file>
-        <file alias="cd_unmount_16px.png">images/cd_unmount_16px.png</file>
-        <file alias="cd_unmount_dis_16px.png">images/cd_unmount_dis_16px.png</file>
-        <file alias="cd_add_16px.png">images/cd_add_16px.png</file>
-        <file alias="cd_add_disabled_16px.png">images/cd_add_disabled_16px.png</file>
-        <file alias="fd_16px.png">images/fd_16px.png</file>
-        <file alias="fd_disabled_16px.png">images/fd_disabled_16px.png</file>
-        <file alias="fd_32px.png">images/fd_32px.png</file>
-        <file alias="fd_disabled_32px.png">images/fd_disabled_32px.png</file>
-        <file alias="fd_read_16px.png">images/fd_read_16px.png</file>
-        <file alias="fd_write_16px.png">images/fd_write_16px.png</file>
-        <file alias="fd_unmount_16px.png">images/fd_unmount_16px.png</file>
-        <file alias="fd_unmount_dis_16px.png">images/fd_unmount_dis_16px.png</file>
-        <file alias="fd_add_16px.png">images/fd_add_16px.png</file>
-        <file alias="fd_add_disabled_16px.png">images/fd_add_disabled_16px.png</file>
-        <file alias="mouse_16px.png">images/mouse_16px.png</file>
-        <file alias="mouse_disabled_16px.png">images/mouse_disabled_16px.png</file>
-        <file alias="mouse_seamless_16px.png">images/mouse_seamless_16px.png</file>
-        <file alias="mouse_can_seamless_16px.png">images/mouse_can_seamless_16px.png</file>
-        <file alias="mouse_can_seamless_on_16px.png">images/mouse_can_seamless_on_16px.png</file>
-        <file alias="mouse_can_seamless_disabled_16px.png">images/mouse_can_seamless_disabled_16px.png</file>
-        <file alias="mouse_can_seamless_on_disabled_16px.png">images/mouse_can_seamless_on_disabled_16px.png</file>
-        <file alias="mouse_can_seamless_uncaptured_16px.png">images/mouse_can_seamless_uncaptured_16px.png</file>
-        <file alias="hostkey_16px.png">images/hostkey_16px.png</file>
-        <file alias="hostkey_disabled_16px.png">images/hostkey_disabled_16px.png</file>
-        <file alias="hostkey_32px.png">images/hostkey_32px.png</file>
-        <file alias="hostkey_disabled_32px.png">images/hostkey_disabled_32px.png</file>
-        <file alias="hostkey_pressed_16px.png">images/hostkey_pressed_16px.png</file>
-        <file alias="hostkey_captured_16px.png">images/hostkey_captured_16px.png</file>
-        <file alias="hostkey_captured_pressed_16px.png">images/hostkey_captured_pressed_16px.png</file>
-        <file alias="fullscreen_16px.png">images/fullscreen_16px.png</file>
-        <file alias="fullscreen_on_16px.png">images/fullscreen_on_16px.png</file>
-        <file alias="fullscreen_disabled_16px.png">images/fullscreen_disabled_16px.png</file>
-        <file alias="fullscreen_on_disabled_16px.png">images/fullscreen_on_disabled_16px.png</file>
-        <file alias="seamless_16px.png">images/seamless_16px.png</file>
-        <file alias="seamless_on_16px.png">images/seamless_on_16px.png</file>
-        <file alias="seamless_disabled_16px.png">images/seamless_disabled_16px.png</file>
-        <file alias="seamless_on_disabled_16px.png">images/seamless_on_disabled_16px.png</file>
-        <file alias="scale_16px.png">images/scale_16px.png</file>
-        <file alias="scale_on_16px.png">images/scale_on_16px.png</file>
-        <file alias="scale_disabled_16px.png">images/scale_disabled_16px.png</file>
-        <file alias="scale_on_disabled_16px.png">images/scale_on_disabled_16px.png</file>
-        <file alias="controller_add_16px.png">images/controller_add_16px.png</file>
-        <file alias="controller_add_disabled_16px.png">images/controller_add_disabled_16px.png</file>
-        <file alias="controller_remove_16px.png">images/controller_remove_16px.png</file>
-        <file alias="controller_remove_disabled_16px.png">images/controller_remove_disabled_16px.png</file>
-        <file alias="attachment_16px.png">images/attachment_16px.png</file>
-        <file alias="attachment_disabled_16px.png">images/attachment_disabled_16px.png</file>
-        <file alias="attachment_add_16px.png">images/attachment_add_16px.png</file>
-        <file alias="attachment_add_disabled_16px.png">images/attachment_add_disabled_16px.png</file>
-        <file alias="attachment_remove_16px.png">images/attachment_remove_16px.png</file>
-        <file alias="attachment_remove_disabled_16px.png">images/attachment_remove_disabled_16px.png</file>
-        <file alias="progress_state_save_90px.png">images/progress_state_save_90px.png</file>
-        <file alias="progress_state_restore_90px.png">images/progress_state_restore_90px.png</file>
-        <file alias="progress_import_90px.png">images/progress_import_90px.png</file>
+        <file alias="parallel_port_16px.png">images/parallel_port_16px.png</file>
+        <file alias="parallel_port_24px.png">images/parallel_port_24px.png</file>
+        <file alias="parallel_port_32px.png">images/parallel_port_32px.png</file>
+        <file alias="parallel_port_warning_16px.png">images/parallel_port_warning_16px.png</file>
+        <file alias="pin_16px.png">images/pin_16px.png</file>
+        <file alias="preview_empty_16to10_242x167px.png">images/preview_empty_16to10_242x167px.png</file>
+        <file alias="preview_empty_16to9_242x155px.png">images/preview_empty_16to9_242x155px.png</file>
+        <file alias="preview_empty_4to3_242x192px.png">images/preview_empty_4to3_242x192px.png</file>
+        <file alias="preview_full_16to10_242x167px.png">images/preview_full_16to10_242x167px.png</file>
+        <file alias="preview_full_16to9_242x155px.png">images/preview_full_16to9_242x155px.png</file>
+        <file alias="preview_full_4to3_242x192px.png">images/preview_full_4to3_242x192px.png</file>
+        <file alias="previous_16px.png">images/previous_16px.png</file>
+        <file alias="progress_clone_90px.png">images/progress_clone_90px.png</file>
+        <file alias="progress_delete_90px.png">images/progress_delete_90px.png</file>
+        <file alias="progress_dnd_gh_90px.png">images/progress_dnd_gh_90px.png</file>
+        <file alias="progress_dnd_hg_90px.png">images/progress_dnd_hg_90px.png</file>
         <file alias="progress_export_90px.png">images/progress_export_90px.png</file>
+        <file alias="progress_import_90px.png">images/progress_import_90px.png</file>
         <file alias="progress_install_guest_additions_90px.png">images/progress_install_guest_additions_90px.png</file>
-        <file alias="progress_start_90px.png">images/progress_start_90px.png</file>
-        <file alias="progress_poweroff_90px.png">images/progress_poweroff_90px.png</file>
-        <file alias="progress_delete_90px.png">images/progress_delete_90px.png</file>
         <file alias="progress_media_create_90px.png">images/progress_media_create_90px.png</file>
         <file alias="progress_media_delete_90px.png">images/progress_media_delete_90px.png</file>
+        <file alias="progress_network_interface_90px.png">images/progress_network_interface_90px.png</file>
+        <file alias="progress_poweroff_90px.png">images/progress_poweroff_90px.png</file>
+        <file alias="progress_reading_appliance_90px.png">images/progress_reading_appliance_90px.png</file>
+        <file alias="progress_refresh_90px.png">images/progress_refresh_90px.png</file>
+        <file alias="progress_settings_90px.png">images/progress_settings_90px.png</file>
         <file alias="progress_snapshot_create_90px.png">images/progress_snapshot_create_90px.png</file>
-        <file alias="progress_snapshot_restore_90px.png">images/progress_snapshot_restore_90px.png</file>
         <file alias="progress_snapshot_discard_90px.png">images/progress_snapshot_discard_90px.png</file>
-        <file alias="progress_clone_90px.png">images/progress_clone_90px.png</file>
-        <file alias="progress_dnd_gh_90px.png">images/progress_dnd_gh_90px.png</file>
-        <file alias="progress_dnd_hg_90px.png">images/progress_dnd_hg_90px.png</file>
-        <file alias="status_check_16px.png">images/status_check_16px.png</file>
-        <file alias="status_check_32px.png">images/status_check_32px.png</file>
-        <file alias="status_error_16px.png">images/status_error_16px.png</file>
-        <file alias="status_error_32px.png">images/status_error_32px.png</file>
-        <file alias="extension_pack_16px.png">images/extension_pack_16px.png</file>
-        <file alias="extension_pack_disabled_16px.png">images/extension_pack_disabled_16px.png</file>
-        <file alias="extension_pack_32px.png">images/extension_pack_32px.png</file>
-        <file alias="extension_pack_disabled_32px.png">images/extension_pack_disabled_32px.png</file>
-        <file alias="extension_pack_install_16px.png">images/extension_pack_install_16px.png</file>
-        <file alias="extension_pack_install_disabled_16px.png">images/extension_pack_install_disabled_16px.png</file>
-        <file alias="extension_pack_install_32px.png">images/extension_pack_install_32px.png</file>
-        <file alias="extension_pack_install_disabled_32px.png">images/extension_pack_install_disabled_32px.png</file>
-        <file alias="extension_pack_uninstall_16px.png">images/extension_pack_uninstall_16px.png</file>
-        <file alias="extension_pack_uninstall_disabled_16px.png">images/extension_pack_uninstall_disabled_16px.png</file>
-        <file alias="extension_pack_uninstall_32px.png">images/extension_pack_uninstall_32px.png</file>
-        <file alias="extension_pack_uninstall_disabled_32px.png">images/extension_pack_uninstall_disabled_32px.png</file>
+        <file alias="progress_snapshot_restore_90px.png">images/progress_snapshot_restore_90px.png</file>
+        <file alias="progress_start_90px.png">images/progress_start_90px.png</file>
+        <file alias="progress_state_restore_90px.png">images/progress_state_restore_90px.png</file>
+        <file alias="progress_state_save_90px.png">images/progress_state_save_90px.png</file>
         <file alias="proxy_16px.png">images/proxy_16px.png</file>
-        <file alias="proxy_disabled_16px.png">images/proxy_disabled_16px.png</file>
+        <file alias="proxy_24px.png">images/proxy_24px.png</file>
         <file alias="proxy_32px.png">images/proxy_32px.png</file>
-        <file alias="proxy_disabled_32px.png">images/proxy_disabled_32px.png</file>
-        <file alias="nw_error_16px.png">images/nw_error_16px.png</file>
-        <file alias="nw_loading_16px.png">images/nw_loading_16px.png</file>
-        <file alias="next_16px.png">images/next_16px.png</file>
-        <file alias="previous_16px.png">images/previous_16px.png</file>
-        <file alias="expanding_collapsing_16px.png">images/expanding_collapsing_16px.png</file>
-        <file alias="preview_empty_228x168px.png">images/preview_empty_228x168px.png</file>
-        <file alias="preview_full_228x168px.png">images/preview_full_228x168px.png</file>
-        <file alias="group_abstract_16px.png">images/group_abstract_16px.png</file>
-        <file alias="machine_abstract_16px.png">images/machine_abstract_16px.png</file>
-        <file alias="nw_settings_16px.png">images/nw_settings_16px.png</file>
-        <file alias="nw_settings_disabled_16px.png">images/nw_settings_disabled_16px.png</file>
-        <file alias="sf_settings_16px.png">images/sf_settings_16px.png</file>
-        <file alias="sf_settings_disabled_16px.png">images/sf_settings_disabled_16px.png</file>
-        <file alias="chipset_warning_16px.png">images/chipset_warning_16px.png</file>
-        <file alias="extension_pack_warning_16px.png">images/extension_pack_warning_16px.png</file>
-        <file alias="hd_warning_16px.png">images/hd_warning_16px.png</file>
-        <file alias="hostkey_warning_16px.png">images/hostkey_warning_16px.png</file>
-        <file alias="machine_warning_16px.png">images/machine_warning_16px.png</file>
-        <file alias="nw_warning_16px.png">images/nw_warning_16px.png</file>
-        <file alias="parallel_port_warning_16px.png">images/parallel_port_warning_16px.png</file>
         <file alias="proxy_warning_16px.png">images/proxy_warning_16px.png</file>
+        <file alias="ram_16px.png">images/ram_16px.png</file>
+        <file alias="refresh_16px.png">images/refresh_16px.png</file>
+        <file alias="refresh_22px.png">images/refresh_22px.png</file>
+        <file alias="refresh_24px.png">images/refresh_24px.png</file>
+        <file alias="refresh_32px.png">images/refresh_32px.png</file>
+        <file alias="refresh_disabled_16px.png">images/refresh_disabled_16px.png</file>
+        <file alias="refresh_disabled_22px.png">images/refresh_disabled_22px.png</file>
+        <file alias="refresh_disabled_32px.png">images/refresh_disabled_32px.png</file>
         <file alias="refresh_warning_16px.png">images/refresh_warning_16px.png</file>
+        <file alias="remove_host_iface_16px.png">images/remove_host_iface_16px.png</file>
+        <file alias="remove_host_iface_disabled_16px.png">images/remove_host_iface_disabled_16px.png</file>
+        <file alias="reset_warnings_16px.png">images/reset_warnings_16px.png</file>
+        <file alias="restore_16px.png">images/restore_16px.png</file>
+        <file alias="sata_16px.png">images/sata_16px.png</file>
+        <file alias="sata_add_16px.png">images/sata_add_16px.png</file>
+        <file alias="sata_add_disabled_16px.png">images/sata_add_disabled_16px.png</file>
+        <file alias="sata_collapse_16px.png">images/sata_collapse_16px.png</file>
+        <file alias="sata_expand_16px.png">images/sata_expand_16px.png</file>
+        <file alias="scale_16px.png">images/scale_16px.png</file>
+        <file alias="scale_disabled_16px.png">images/scale_disabled_16px.png</file>
+        <file alias="scale_factor_16px.png">images/scale_factor_16px.png</file>
+        <file alias="scale_factor_disabled_16px.png">images/scale_factor_disabled_16px.png</file>
+        <file alias="scale_on_16px.png">images/scale_on_16px.png</file>
+        <file alias="scale_on_disabled_16px.png">images/scale_on_disabled_16px.png</file>
+        <file alias="screenshot_take_16px.png">images/screenshot_take_16px.png</file>
+        <file alias="screenshot_take_disabled_16px.png">images/screenshot_take_disabled_16px.png</file>
+        <file alias="scsi_16px.png">images/scsi_16px.png</file>
+        <file alias="scsi_add_16px.png">images/scsi_add_16px.png</file>
+        <file alias="scsi_add_disabled_16px.png">images/scsi_add_disabled_16px.png</file>
+        <file alias="scsi_collapse_16px.png">images/scsi_collapse_16px.png</file>
+        <file alias="scsi_expand_16px.png">images/scsi_expand_16px.png</file>
+        <file alias="seamless_16px.png">images/seamless_16px.png</file>
+        <file alias="seamless_disabled_16px.png">images/seamless_disabled_16px.png</file>
+        <file alias="seamless_on_16px.png">images/seamless_on_16px.png</file>
+        <file alias="seamless_on_disabled_16px.png">images/seamless_on_disabled_16px.png</file>
+        <file alias="select_file_16px.png">images/select_file_16px.png</file>
+        <file alias="select_file_disabled_16px.png">images/select_file_disabled_16px.png</file>
+        <file alias="serial_port_16px.png">images/serial_port_16px.png</file>
+        <file alias="serial_port_24px.png">images/serial_port_24px.png</file>
+        <file alias="serial_port_32px.png">images/serial_port_32px.png</file>
         <file alias="serial_port_warning_16px.png">images/serial_port_warning_16px.png</file>
+        <file alias="session_info_16px.png">images/session_info_16px.png</file>
+        <file alias="session_info_32px.png">images/session_info_32px.png</file>
+        <file alias="session_info_details_16px.png">images/session_info_details_16px.png</file>
+        <file alias="session_info_disabled_16px.png">images/session_info_disabled_16px.png</file>
+        <file alias="session_info_runtime_16px.png">images/session_info_runtime_16px.png</file>
+        <file alias="sf_16px.png">images/sf_16px.png</file>
+        <file alias="sf_24px.png">images/sf_24px.png</file>
+        <file alias="sf_32px.png">images/sf_32px.png</file>
+        <file alias="sf_add_16px.png">images/sf_add_16px.png</file>
+        <file alias="sf_add_disabled_16px.png">images/sf_add_disabled_16px.png</file>
+        <file alias="sf_disabled_16px.png">images/sf_disabled_16px.png</file>
+        <file alias="sf_edit_16px.png">images/sf_edit_16px.png</file>
+        <file alias="sf_edit_disabled_16px.png">images/sf_edit_disabled_16px.png</file>
+        <file alias="sf_read_16px.png">images/sf_read_16px.png</file>
+        <file alias="sf_remove_16px.png">images/sf_remove_16px.png</file>
+        <file alias="sf_remove_disabled_16px.png">images/sf_remove_disabled_16px.png</file>
+        <file alias="sf_settings_16px.png">images/sf_settings_16px.png</file>
+        <file alias="sf_settings_disabled_16px.png">images/sf_settings_disabled_16px.png</file>
         <file alias="sf_warning_16px.png">images/sf_warning_16px.png</file>
+        <file alias="sf_write_16px.png">images/sf_write_16px.png</file>
+        <file alias="shared_clipboard_16px.png">images/shared_clipboard_16px.png</file>
+        <file alias="shared_clipboard_disabled_16px.png">images/shared_clipboard_disabled_16px.png</file>
+        <file alias="site_16px.png">images/site_16px.png</file>
+        <file alias="site_24px.png">images/site_24px.png</file>
+        <file alias="site_32px.png">images/site_32px.png</file>
         <file alias="site_warning_16px.png">images/site_warning_16px.png</file>
+        <file alias="snapshot_delete_16px.png">images/snapshot_delete_16px.png</file>
+        <file alias="snapshot_delete_22px.png">images/snapshot_delete_22px.png</file>
+        <file alias="snapshot_delete_disabled_16px.png">images/snapshot_delete_disabled_16px.png</file>
+        <file alias="snapshot_delete_disabled_22px.png">images/snapshot_delete_disabled_22px.png</file>
+        <file alias="snapshot_offline_16px.png">images/snapshot_offline_16px.png</file>
+        <file alias="snapshot_online_16px.png">images/snapshot_online_16px.png</file>
+        <file alias="snapshot_restore_16px.png">images/snapshot_restore_16px.png</file>
+        <file alias="snapshot_restore_22px.png">images/snapshot_restore_22px.png</file>
+        <file alias="snapshot_restore_disabled_16px.png">images/snapshot_restore_disabled_16px.png</file>
+        <file alias="snapshot_restore_disabled_22px.png">images/snapshot_restore_disabled_22px.png</file>
+        <file alias="snapshot_show_details_16px.png">images/snapshot_show_details_16px.png</file>
+        <file alias="snapshot_show_details_22px.png">images/snapshot_show_details_22px.png</file>
+        <file alias="snapshot_show_details_disabled_16px.png">images/snapshot_show_details_disabled_16px.png</file>
+        <file alias="snapshot_show_details_disabled_22px.png">images/snapshot_show_details_disabled_22px.png</file>
+        <file alias="snapshot_take_16px.png">images/snapshot_take_16px.png</file>
+        <file alias="snapshot_take_22px.png">images/snapshot_take_22px.png</file>
+        <file alias="snapshot_take_disabled_16px.png">images/snapshot_take_disabled_16px.png</file>
+        <file alias="snapshot_take_disabled_22px.png">images/snapshot_take_disabled_22px.png</file>
+        <file alias="sort_16px.png">images/sort_16px.png</file>
+        <file alias="sort_disabled_16px.png">images/sort_disabled_16px.png</file>
+        <file alias="sound_16px.png">images/sound_16px.png</file>
+        <file alias="sound_24px.png">images/sound_24px.png</file>
+        <file alias="sound_32px.png">images/sound_32px.png</file>
         <file alias="sound_warning_16px.png">images/sound_warning_16px.png</file>
+        <file alias="state_aborted_16px.png">images/state_aborted_16px.png</file>
+        <file alias="state_discarding_16px.png">images/state_discarding_16px.png</file>
+        <file alias="state_paused_16px.png">images/state_paused_16px.png</file>
+        <file alias="state_powered_off_16px.png">images/state_powered_off_16px.png</file>
+        <file alias="state_restoring_16px.png">images/state_restoring_16px.png</file>
+        <file alias="state_running_16px.png">images/state_running_16px.png</file>
+        <file alias="state_saved_16px.png">images/state_saved_16px.png</file>
+        <file alias="state_saving_16px.png">images/state_saving_16px.png</file>
+        <file alias="state_stuck_16px.png">images/state_stuck_16px.png</file>
+        <file alias="status_check_16px.png">images/status_check_16px.png</file>
+        <file alias="status_error_16px.png">images/status_error_16px.png</file>
+        <file alias="statusbar_16px.png">images/statusbar_16px.png</file>
+        <file alias="statusbar_disabled_16px.png">images/statusbar_disabled_16px.png</file>
+        <file alias="statusbar_on_16px.png">images/statusbar_on_16px.png</file>
+        <file alias="statusbar_on_disabled_16px.png">images/statusbar_on_disabled_16px.png</file>
+        <file alias="statusbar_settings_16px.png">images/statusbar_settings_16px.png</file>
+        <file alias="statusbar_settings_disabled_16px.png">images/statusbar_settings_disabled_16px.png</file>
+        <file alias="tpixel.png">images/tpixel.png</file>
+        <file alias="usb_16px.png">images/usb_16px.png</file>
+        <file alias="usb_24px.png">images/usb_24px.png</file>
+        <file alias="usb_32px.png">images/usb_32px.png</file>
+        <file alias="usb_add_16px.png">images/usb_add_16px.png</file>
+        <file alias="usb_add_disabled_16px.png">images/usb_add_disabled_16px.png</file>
+        <file alias="usb_collapse_16px.png">images/usb_collapse_16px.png</file>
+        <file alias="usb_disabled_16px.png">images/usb_disabled_16px.png</file>
+        <file alias="usb_expand_16px.png">images/usb_expand_16px.png</file>
+        <file alias="usb_filter_edit_16px.png">images/usb_filter_edit_16px.png</file>
+        <file alias="usb_filter_edit_disabled_16px.png">images/usb_filter_edit_disabled_16px.png</file>
+        <file alias="usb_movedown_16px.png">images/usb_movedown_16px.png</file>
+        <file alias="usb_movedown_disabled_16px.png">images/usb_movedown_disabled_16px.png</file>
+        <file alias="usb_moveup_16px.png">images/usb_moveup_16px.png</file>
+        <file alias="usb_moveup_disabled_16px.png">images/usb_moveup_disabled_16px.png</file>
+        <file alias="usb_new_16px.png">images/usb_new_16px.png</file>
+        <file alias="usb_new_disabled_16px.png">images/usb_new_disabled_16px.png</file>
+        <file alias="usb_read_16px.png">images/usb_read_16px.png</file>
+        <file alias="usb_remove_16px.png">images/usb_remove_16px.png</file>
+        <file alias="usb_remove_disabled_16px.png">images/usb_remove_disabled_16px.png</file>
+        <file alias="usb_settings_16px.png">images/usb_settings_16px.png</file>
+        <file alias="usb_settings_disabled_16px.png">images/usb_settings_disabled_16px.png</file>
+        <file alias="usb_unavailable_16px.png">images/usb_unavailable_16px.png</file>
+        <file alias="usb_unavailable_disabled_16px.png">images/usb_unavailable_disabled_16px.png</file>
         <file alias="usb_warning_16px.png">images/usb_warning_16px.png</file>
+        <file alias="usb_write_16px.png">images/usb_write_16px.png</file>
+        <file alias="video_capture_16px.png">images/video_capture_16px.png</file>
+        <file alias="video_capture_disabled_16px.png">images/video_capture_disabled_16px.png</file>
+        <file alias="video_capture_on_16px.png">images/video_capture_on_16px.png</file>
+        <file alias="video_capture_on_disabled_16px.png">images/video_capture_on_disabled_16px.png</file>
+        <file alias="video_capture_settings_16px.png">images/video_capture_settings_16px.png</file>
+        <file alias="virtual_screen_16px.png">images/virtual_screen_16px.png</file>
+        <file alias="virtual_screen_disabled_16px.png">images/virtual_screen_disabled_16px.png</file>
+        <file alias="vm_add_16px.png">images/vm_add_16px.png</file>
+        <file alias="vm_clone_16px.png">images/vm_clone_16px.png</file>
+        <file alias="vm_clone_22px.png">images/vm_clone_22px.png</file>
+        <file alias="vm_clone_disabled_16px.png">images/vm_clone_disabled_16px.png</file>
+        <file alias="vm_clone_disabled_22px.png">images/vm_clone_disabled_22px.png</file>
+        <file alias="vm_create_shortcut_16px.png">images/vm_create_shortcut_16px.png</file>
+        <file alias="vm_create_shortcut_disabled_16px.png">images/vm_create_shortcut_disabled_16px.png</file>
+        <file alias="vm_delete_16px.png">images/vm_delete_16px.png</file>
+        <file alias="vm_delete_32px.png">images/vm_delete_32px.png</file>
+        <file alias="vm_delete_disabled_16px.png">images/vm_delete_disabled_16px.png</file>
+        <file alias="vm_delete_disabled_32px.png">images/vm_delete_disabled_32px.png</file>
+        <file alias="vm_discard_16px.png">images/vm_discard_16px.png</file>
+        <file alias="vm_discard_32px.png">images/vm_discard_32px.png</file>
+        <file alias="vm_discard_disabled_16px.png">images/vm_discard_disabled_16px.png</file>
+        <file alias="vm_discard_disabled_32px.png">images/vm_discard_disabled_32px.png</file>
+        <file alias="vm_group_create_16px.png">images/vm_group_create_16px.png</file>
+        <file alias="vm_group_create_disabled_16px.png">images/vm_group_create_disabled_16px.png</file>
+        <file alias="vm_group_name_16px.png">images/vm_group_name_16px.png</file>
+        <file alias="vm_group_name_disabled_16px.png">images/vm_group_name_disabled_16px.png</file>
+        <file alias="vm_group_remove_16px.png">images/vm_group_remove_16px.png</file>
+        <file alias="vm_group_remove_disabled_16px.png">images/vm_group_remove_disabled_16px.png</file>
+        <file alias="vm_new_16px.png">images/vm_new_16px.png</file>
+        <file alias="vm_new_32px.png">images/vm_new_32px.png</file>
+        <file alias="vm_open_filemanager_16px.png">images/vm_open_filemanager_16px.png</file>
+        <file alias="vm_open_filemanager_disabled_16px.png">images/vm_open_filemanager_disabled_16px.png</file>
+        <file alias="vm_pause_16px.png">images/vm_pause_16px.png</file>
+        <file alias="vm_pause_32px.png">images/vm_pause_32px.png</file>
+        <file alias="vm_pause_disabled_16px.png">images/vm_pause_disabled_16px.png</file>
+        <file alias="vm_pause_disabled_32px.png">images/vm_pause_disabled_32px.png</file>
+        <file alias="vm_pause_on_16px.png">images/vm_pause_on_16px.png</file>
+        <file alias="vm_pause_on_disabled_16px.png">images/vm_pause_on_disabled_16px.png</file>
+        <file alias="vm_poweroff_16px.png">images/vm_poweroff_16px.png</file>
+        <file alias="vm_poweroff_disabled_16px.png">images/vm_poweroff_disabled_16px.png</file>
+        <file alias="vm_reset_16px.png">images/vm_reset_16px.png</file>
+        <file alias="vm_reset_disabled_16px.png">images/vm_reset_disabled_16px.png</file>
+        <file alias="vm_save_state_16px.png">images/vm_save_state_16px.png</file>
+        <file alias="vm_save_state_disabled_16px.png">images/vm_save_state_disabled_16px.png</file>
+        <file alias="vm_settings_16px.png">images/vm_settings_16px.png</file>
+        <file alias="vm_settings_32px.png">images/vm_settings_32px.png</file>
+        <file alias="vm_settings_disabled_16px.png">images/vm_settings_disabled_16px.png</file>
+        <file alias="vm_settings_disabled_32px.png">images/vm_settings_disabled_32px.png</file>
+        <file alias="vm_show_logs_16px.png">images/vm_show_logs_16px.png</file>
+        <file alias="vm_show_logs_32px.png">images/vm_show_logs_32px.png</file>
+        <file alias="vm_show_logs_disabled_16px.png">images/vm_show_logs_disabled_16px.png</file>
+        <file alias="vm_show_logs_disabled_32px.png">images/vm_show_logs_disabled_32px.png</file>
+        <file alias="vm_shutdown_16px.png">images/vm_shutdown_16px.png</file>
+        <file alias="vm_shutdown_disabled_16px.png">images/vm_shutdown_disabled_16px.png</file>
+        <file alias="vm_start_16px.png">images/vm_start_16px.png</file>
+        <file alias="vm_start_32px.png">images/vm_start_32px.png</file>
+        <file alias="vm_start_disabled_16px.png">images/vm_start_disabled_16px.png</file>
+        <file alias="vm_start_disabled_32px.png">images/vm_start_disabled_32px.png</file>
+        <file alias="vmw_clone.png">images/vmw_clone.png</file>
+        <file alias="vmw_clone_bg.png">images/vmw_clone_bg.png</file>
+        <file alias="vmw_first_run.png">images/vmw_first_run.png</file>
+        <file alias="vmw_first_run_bg.png">images/vmw_first_run_bg.png</file>
+        <file alias="vmw_new_harddisk.png">images/vmw_new_harddisk.png</file>
+        <file alias="vmw_new_harddisk_bg.png">images/vmw_new_harddisk_bg.png</file>
+        <file alias="vmw_new_user.png">images/vmw_new_user.png</file>
+        <file alias="vmw_new_user_bg.png">images/vmw_new_user_bg.png</file>
+        <file alias="vmw_new_welcome.png">images/vmw_new_welcome.png</file>
+        <file alias="vmw_new_welcome_bg.png">images/vmw_new_welcome_bg.png</file>
+        <file alias="vmw_ovf_export.png">images/vmw_ovf_export.png</file>
+        <file alias="vmw_ovf_export_bg.png">images/vmw_ovf_export_bg.png</file>
+        <file alias="vmw_ovf_import.png">images/vmw_ovf_import.png</file>
+        <file alias="vmw_ovf_import_bg.png">images/vmw_ovf_import_bg.png</file>
+        <file alias="vrdp_16px.png">images/vrdp_16px.png</file>
+        <file alias="vrdp_24px.png">images/vrdp_24px.png</file>
+        <file alias="vrdp_32px.png">images/vrdp_32px.png</file>
+        <file alias="vrdp_disabled_16px.png">images/vrdp_disabled_16px.png</file>
+        <file alias="vrdp_on_16px.png">images/vrdp_on_16px.png</file>
+        <file alias="vrdp_on_disabled_16px.png">images/vrdp_on_disabled_16px.png</file>
         <file alias="vrdp_warning_16px.png">images/vrdp_warning_16px.png</file>
-        <file alias="reset_warnings_16px.png">images/reset_warnings_16px.png</file>
+        <file alias="vtx_amdv_16px.png">images/vtx_amdv_16px.png</file>
+        <file alias="vtx_amdv_disabled_16px.png">images/vtx_amdv_disabled_16px.png</file>
         <file alias="web_camera_16px.png">images/web_camera_16px.png</file>
         <file alias="web_camera_disabled_16px.png">images/web_camera_disabled_16px.png</file>
+        <file alias="web_camera_unavailable_16px.png">images/web_camera_unavailable_16px.png</file>
+        <file alias="web_camera_unavailable_disabled_16px.png">images/web_camera_unavailable_disabled_16px.png</file>
+        <file alias="welcome.png">images/welcome.png</file>
     </qresource>
 </RCC>
diff --git a/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc b/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc
new file mode 100644
index 0000000..d330d48
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc
@@ -0,0 +1,275 @@
+<RCC>
+    <qresource prefix="/">
+        <file alias="os_redhat_hidpi.png">images/hidpi/os_redhat_hidpi.png</file>
+        <file alias="os_solaris_64_hidpi.png">images/hidpi/os_solaris_64_hidpi.png</file>
+        <file alias="os_solaris_hidpi.png">images/hidpi/os_solaris_hidpi.png</file>
+        <file alias="os_turbolinux_64_hidpi.png">images/hidpi/os_turbolinux_64_hidpi.png</file>
+        <file alias="os_turbolinux_hidpi.png">images/hidpi/os_turbolinux_hidpi.png</file>
+        <file alias="os_ubuntu_64_hidpi.png">images/hidpi/os_ubuntu_64_hidpi.png</file>
+        <file alias="os_ubuntu_hidpi.png">images/hidpi/os_ubuntu_hidpi.png</file>
+        <file alias="os_win10_64_hidpi.png">images/hidpi/os_win10_64_hidpi.png</file>
+        <file alias="os_win10_hidpi.png">images/hidpi/os_win10_hidpi.png</file>
+        <file alias="os_win2k12_64_hidpi.png">images/hidpi/os_win2k12_64_hidpi.png</file>
+        <file alias="os_win2k3_64_hidpi.png">images/hidpi/os_win2k3_64_hidpi.png</file>
+        <file alias="os_win2k3_hidpi.png">images/hidpi/os_win2k3_hidpi.png</file>
+        <file alias="os_win2k8_64_hidpi.png">images/hidpi/os_win2k8_64_hidpi.png</file>
+        <file alias="os_win2k8_hidpi.png">images/hidpi/os_win2k8_hidpi.png</file>
+        <file alias="os_win2k_hidpi.png">images/hidpi/os_win2k_hidpi.png</file>
+        <file alias="os_win31_hidpi.png">images/hidpi/os_win31_hidpi.png</file>
+        <file alias="os_win7_64_hidpi.png">images/hidpi/os_win7_64_hidpi.png</file>
+        <file alias="os_win7_hidpi.png">images/hidpi/os_win7_hidpi.png</file>
+        <file alias="os_win81_64_hidpi.png">images/hidpi/os_win81_64_hidpi.png</file>
+        <file alias="os_win81_hidpi.png">images/hidpi/os_win81_hidpi.png</file>
+        <file alias="os_win8_64_hidpi.png">images/hidpi/os_win8_64_hidpi.png</file>
+        <file alias="os_win8_hidpi.png">images/hidpi/os_win8_hidpi.png</file>
+        <file alias="os_win95_hidpi.png">images/hidpi/os_win95_hidpi.png</file>
+        <file alias="os_win98_hidpi.png">images/hidpi/os_win98_hidpi.png</file>
+        <file alias="os_win_other_hidpi.png">images/hidpi/os_win_other_hidpi.png</file>
+        <file alias="os_winme_hidpi.png">images/hidpi/os_winme_hidpi.png</file>
+        <file alias="os_winnt4_hidpi.png">images/hidpi/os_winnt4_hidpi.png</file>
+        <file alias="os_winvista_64_hidpi.png">images/hidpi/os_winvista_64_hidpi.png</file>
+        <file alias="os_winvista_hidpi.png">images/hidpi/os_winvista_hidpi.png</file>
+        <file alias="os_winxp_64_hidpi.png">images/hidpi/os_winxp_64_hidpi.png</file>
+        <file alias="os_winxp_hidpi.png">images/hidpi/os_winxp_hidpi.png</file>
+        <file alias="os_xandros_64_hidpi.png">images/hidpi/os_xandros_64_hidpi.png</file>
+        <file alias="os_xandros_hidpi.png">images/hidpi/os_xandros_hidpi.png</file>
+        <file alias="parallel_port_16px_hidpi.png">images/hidpi/parallel_port_16px_hidpi.png</file>
+        <file alias="parallel_port_24px_hidpi.png">images/hidpi/parallel_port_24px_hidpi.png</file>
+        <file alias="parallel_port_32px_hidpi.png">images/hidpi/parallel_port_32px_hidpi.png</file>
+        <file alias="parallel_port_warning_16px_hidpi.png">images/hidpi/parallel_port_warning_16px_hidpi.png</file>
+        <file alias="pin_16px_hidpi.png">images/hidpi/pin_16px_hidpi.png</file>
+        <file alias="preview_empty_16to10_242x167px_hidpi.png">images/hidpi/preview_empty_16to10_242x167px_hidpi.png</file>
+        <file alias="preview_empty_16to9_242x155px_hidpi.png">images/hidpi/preview_empty_16to9_242x155px_hidpi.png</file>
+        <file alias="preview_empty_4to3_242x192px_hidpi.png">images/hidpi/preview_empty_4to3_242x192px_hidpi.png</file>
+        <file alias="preview_full_16to10_242x167px_hidpi.png">images/hidpi/preview_full_16to10_242x167px_hidpi.png</file>
+        <file alias="preview_full_16to9_242x155px_hidpi.png">images/hidpi/preview_full_16to9_242x155px_hidpi.png</file>
+        <file alias="preview_full_4to3_242x192px_hidpi.png">images/hidpi/preview_full_4to3_242x192px_hidpi.png</file>
+        <file alias="previous_16px_hidpi.png">images/hidpi/previous_16px_hidpi.png</file>
+        <file alias="progress_clone_90px_hidpi.png">images/hidpi/progress_clone_90px_hidpi.png</file>
+        <file alias="progress_delete_90px_hidpi.png">images/hidpi/progress_delete_90px_hidpi.png</file>
+        <file alias="progress_dnd_gh_90px_hidpi.png">images/hidpi/progress_dnd_gh_90px_hidpi.png</file>
+        <file alias="progress_dnd_hg_90px_hidpi.png">images/hidpi/progress_dnd_hg_90px_hidpi.png</file>
+        <file alias="progress_export_90px_hidpi.png">images/hidpi/progress_export_90px_hidpi.png</file>
+        <file alias="progress_import_90px_hidpi.png">images/hidpi/progress_import_90px_hidpi.png</file>
+        <file alias="progress_install_guest_additions_90px_hidpi.png">images/hidpi/progress_install_guest_additions_90px_hidpi.png</file>
+        <file alias="progress_media_create_90px_hidpi.png">images/hidpi/progress_media_create_90px_hidpi.png</file>
+        <file alias="progress_media_delete_90px_hidpi.png">images/hidpi/progress_media_delete_90px_hidpi.png</file>
+        <file alias="progress_network_interface_90px_hidpi.png">images/hidpi/progress_network_interface_90px_hidpi.png</file>
+        <file alias="progress_poweroff_90px_hidpi.png">images/hidpi/progress_poweroff_90px_hidpi.png</file>
+        <file alias="progress_reading_appliance_90px_hidpi.png">images/hidpi/progress_reading_appliance_90px_hidpi.png</file>
+        <file alias="progress_refresh_90px_hidpi.png">images/hidpi/progress_refresh_90px_hidpi.png</file>
+        <file alias="progress_settings_90px_hidpi.png">images/hidpi/progress_settings_90px_hidpi.png</file>
+        <file alias="progress_snapshot_create_90px_hidpi.png">images/hidpi/progress_snapshot_create_90px_hidpi.png</file>
+        <file alias="progress_snapshot_discard_90px_hidpi.png">images/hidpi/progress_snapshot_discard_90px_hidpi.png</file>
+        <file alias="progress_snapshot_restore_90px_hidpi.png">images/hidpi/progress_snapshot_restore_90px_hidpi.png</file>
+        <file alias="progress_start_90px_hidpi.png">images/hidpi/progress_start_90px_hidpi.png</file>
+        <file alias="progress_state_restore_90px_hidpi.png">images/hidpi/progress_state_restore_90px_hidpi.png</file>
+        <file alias="progress_state_save_90px_hidpi.png">images/hidpi/progress_state_save_90px_hidpi.png</file>
+        <file alias="proxy_16px_hidpi.png">images/hidpi/proxy_16px_hidpi.png</file>
+        <file alias="proxy_24px_hidpi.png">images/hidpi/proxy_24px_hidpi.png</file>
+        <file alias="proxy_32px_hidpi.png">images/hidpi/proxy_32px_hidpi.png</file>
+        <file alias="proxy_warning_16px_hidpi.png">images/hidpi/proxy_warning_16px_hidpi.png</file>
+        <file alias="ram_16px_hidpi.png">images/hidpi/ram_16px_hidpi.png</file>
+        <file alias="refresh_16px_hidpi.png">images/hidpi/refresh_16px_hidpi.png</file>
+        <file alias="refresh_22px_hidpi.png">images/hidpi/refresh_22px_hidpi.png</file>
+        <file alias="refresh_24px_hidpi.png">images/hidpi/refresh_24px_hidpi.png</file>
+        <file alias="refresh_32px_hidpi.png">images/hidpi/refresh_32px_hidpi.png</file>
+        <file alias="refresh_disabled_16px_hidpi.png">images/hidpi/refresh_disabled_16px_hidpi.png</file>
+        <file alias="refresh_disabled_22px_hidpi.png">images/hidpi/refresh_disabled_22px_hidpi.png</file>
+        <file alias="refresh_disabled_32px_hidpi.png">images/hidpi/refresh_disabled_32px_hidpi.png</file>
+        <file alias="refresh_warning_16px_hidpi.png">images/hidpi/refresh_warning_16px_hidpi.png</file>
+        <file alias="remove_host_iface_16px_hidpi.png">images/hidpi/remove_host_iface_16px_hidpi.png</file>
+        <file alias="remove_host_iface_disabled_16px_hidpi.png">images/hidpi/remove_host_iface_disabled_16px_hidpi.png</file>
+        <file alias="reset_warnings_16px_hidpi.png">images/hidpi/reset_warnings_16px_hidpi.png</file>
+        <file alias="restore_16px_hidpi.png">images/hidpi/restore_16px_hidpi.png</file>
+        <file alias="sata_16px_hidpi.png">images/hidpi/sata_16px_hidpi.png</file>
+        <file alias="sata_add_16px_hidpi.png">images/hidpi/sata_add_16px_hidpi.png</file>
+        <file alias="sata_add_disabled_16px_hidpi.png">images/hidpi/sata_add_disabled_16px_hidpi.png</file>
+        <file alias="sata_collapse_16px_hidpi.png">images/hidpi/sata_collapse_16px_hidpi.png</file>
+        <file alias="sata_expand_16px_hidpi.png">images/hidpi/sata_expand_16px_hidpi.png</file>
+        <file alias="scale_16px_hidpi.png">images/hidpi/scale_16px_hidpi.png</file>
+        <file alias="scale_disabled_16px_hidpi.png">images/hidpi/scale_disabled_16px_hidpi.png</file>
+        <file alias="scale_factor_16px_hidpi.png">images/hidpi/scale_factor_16px_hidpi.png</file>
+        <file alias="scale_factor_disabled_16px_hidpi.png">images/hidpi/scale_factor_disabled_16px_hidpi.png</file>
+        <file alias="scale_on_16px_hidpi.png">images/hidpi/scale_on_16px_hidpi.png</file>
+        <file alias="scale_on_disabled_16px_hidpi.png">images/hidpi/scale_on_disabled_16px_hidpi.png</file>
+        <file alias="screenshot_take_16px_hidpi.png">images/hidpi/screenshot_take_16px_hidpi.png</file>
+        <file alias="screenshot_take_disabled_16px_hidpi.png">images/hidpi/screenshot_take_disabled_16px_hidpi.png</file>
+        <file alias="scsi_16px_hidpi.png">images/hidpi/scsi_16px_hidpi.png</file>
+        <file alias="scsi_add_16px_hidpi.png">images/hidpi/scsi_add_16px_hidpi.png</file>
+        <file alias="scsi_add_disabled_16px_hidpi.png">images/hidpi/scsi_add_disabled_16px_hidpi.png</file>
+        <file alias="scsi_collapse_16px_hidpi.png">images/hidpi/scsi_collapse_16px_hidpi.png</file>
+        <file alias="scsi_expand_16px_hidpi.png">images/hidpi/scsi_expand_16px_hidpi.png</file>
+        <file alias="seamless_16px_hidpi.png">images/hidpi/seamless_16px_hidpi.png</file>
+        <file alias="seamless_disabled_16px_hidpi.png">images/hidpi/seamless_disabled_16px_hidpi.png</file>
+        <file alias="seamless_on_16px_hidpi.png">images/hidpi/seamless_on_16px_hidpi.png</file>
+        <file alias="seamless_on_disabled_16px_hidpi.png">images/hidpi/seamless_on_disabled_16px_hidpi.png</file>
+        <file alias="select_file_16px_hidpi.png">images/hidpi/select_file_16px_hidpi.png</file>
+        <file alias="select_file_disabled_16px_hidpi.png">images/hidpi/select_file_disabled_16px_hidpi.png</file>
+        <file alias="serial_port_16px_hidpi.png">images/hidpi/serial_port_16px_hidpi.png</file>
+        <file alias="serial_port_24px_hidpi.png">images/hidpi/serial_port_24px_hidpi.png</file>
+        <file alias="serial_port_32px_hidpi.png">images/hidpi/serial_port_32px_hidpi.png</file>
+        <file alias="serial_port_warning_16px_hidpi.png">images/hidpi/serial_port_warning_16px_hidpi.png</file>
+        <file alias="session_info_16px_hidpi.png">images/hidpi/session_info_16px_hidpi.png</file>
+        <file alias="session_info_32px_hidpi.png">images/hidpi/session_info_32px_hidpi.png</file>
+        <file alias="session_info_details_16px_hidpi.png">images/hidpi/session_info_details_16px_hidpi.png</file>
+        <file alias="session_info_disabled_16px_hidpi.png">images/hidpi/session_info_disabled_16px_hidpi.png</file>
+        <file alias="session_info_runtime_16px_hidpi.png">images/hidpi/session_info_runtime_16px_hidpi.png</file>
+        <file alias="sf_16px_hidpi.png">images/hidpi/sf_16px_hidpi.png</file>
+        <file alias="sf_24px_hidpi.png">images/hidpi/sf_24px_hidpi.png</file>
+        <file alias="sf_32px_hidpi.png">images/hidpi/sf_32px_hidpi.png</file>
+        <file alias="sf_add_16px_hidpi.png">images/hidpi/sf_add_16px_hidpi.png</file>
+        <file alias="sf_add_disabled_16px_hidpi.png">images/hidpi/sf_add_disabled_16px_hidpi.png</file>
+        <file alias="sf_disabled_16px_hidpi.png">images/hidpi/sf_disabled_16px_hidpi.png</file>
+        <file alias="sf_edit_16px_hidpi.png">images/hidpi/sf_edit_16px_hidpi.png</file>
+        <file alias="sf_edit_disabled_16px_hidpi.png">images/hidpi/sf_edit_disabled_16px_hidpi.png</file>
+        <file alias="sf_read_16px_hidpi.png">images/hidpi/sf_read_16px_hidpi.png</file>
+        <file alias="sf_remove_16px_hidpi.png">images/hidpi/sf_remove_16px_hidpi.png</file>
+        <file alias="sf_remove_disabled_16px_hidpi.png">images/hidpi/sf_remove_disabled_16px_hidpi.png</file>
+        <file alias="sf_settings_16px_hidpi.png">images/hidpi/sf_settings_16px_hidpi.png</file>
+        <file alias="sf_settings_disabled_16px_hidpi.png">images/hidpi/sf_settings_disabled_16px_hidpi.png</file>
+        <file alias="sf_warning_16px_hidpi.png">images/hidpi/sf_warning_16px_hidpi.png</file>
+        <file alias="sf_write_16px_hidpi.png">images/hidpi/sf_write_16px_hidpi.png</file>
+        <file alias="shared_clipboard_16px_hidpi.png">images/hidpi/shared_clipboard_16px_hidpi.png</file>
+        <file alias="shared_clipboard_disabled_16px_hidpi.png">images/hidpi/shared_clipboard_disabled_16px_hidpi.png</file>
+        <file alias="site_16px_hidpi.png">images/hidpi/site_16px_hidpi.png</file>
+        <file alias="site_24px_hidpi.png">images/hidpi/site_24px_hidpi.png</file>
+        <file alias="site_32px_hidpi.png">images/hidpi/site_32px_hidpi.png</file>
+        <file alias="site_warning_16px_hidpi.png">images/hidpi/site_warning_16px_hidpi.png</file>
+        <file alias="snapshot_delete_16px_hidpi.png">images/hidpi/snapshot_delete_16px_hidpi.png</file>
+        <file alias="snapshot_delete_22px_hidpi.png">images/hidpi/snapshot_delete_22px_hidpi.png</file>
+        <file alias="snapshot_delete_disabled_16px_hidpi.png">images/hidpi/snapshot_delete_disabled_16px_hidpi.png</file>
+        <file alias="snapshot_delete_disabled_22px_hidpi.png">images/hidpi/snapshot_delete_disabled_22px_hidpi.png</file>
+        <file alias="snapshot_offline_16px_hidpi.png">images/hidpi/snapshot_offline_16px_hidpi.png</file>
+        <file alias="snapshot_online_16px_hidpi.png">images/hidpi/snapshot_online_16px_hidpi.png</file>
+        <file alias="snapshot_restore_16px_hidpi.png">images/hidpi/snapshot_restore_16px_hidpi.png</file>
+        <file alias="snapshot_restore_22px_hidpi.png">images/hidpi/snapshot_restore_22px_hidpi.png</file>
+        <file alias="snapshot_restore_disabled_16px_hidpi.png">images/hidpi/snapshot_restore_disabled_16px_hidpi.png</file>
+        <file alias="snapshot_restore_disabled_22px_hidpi.png">images/hidpi/snapshot_restore_disabled_22px_hidpi.png</file>
+        <file alias="snapshot_show_details_16px_hidpi.png">images/hidpi/snapshot_show_details_16px_hidpi.png</file>
+        <file alias="snapshot_show_details_22px_hidpi.png">images/hidpi/snapshot_show_details_22px_hidpi.png</file>
+        <file alias="snapshot_show_details_disabled_16px_hidpi.png">images/hidpi/snapshot_show_details_disabled_16px_hidpi.png</file>
+        <file alias="snapshot_show_details_disabled_22px_hidpi.png">images/hidpi/snapshot_show_details_disabled_22px_hidpi.png</file>
+        <file alias="snapshot_take_16px_hidpi.png">images/hidpi/snapshot_take_16px_hidpi.png</file>
+        <file alias="snapshot_take_22px_hidpi.png">images/hidpi/snapshot_take_22px_hidpi.png</file>
+        <file alias="snapshot_take_disabled_16px_hidpi.png">images/hidpi/snapshot_take_disabled_16px_hidpi.png</file>
+        <file alias="snapshot_take_disabled_22px_hidpi.png">images/hidpi/snapshot_take_disabled_22px_hidpi.png</file>
+        <file alias="sort_16px_hidpi.png">images/hidpi/sort_16px_hidpi.png</file>
+        <file alias="sort_disabled_16px_hidpi.png">images/hidpi/sort_disabled_16px_hidpi.png</file>
+        <file alias="sound_16px_hidpi.png">images/hidpi/sound_16px_hidpi.png</file>
+        <file alias="sound_24px_hidpi.png">images/hidpi/sound_24px_hidpi.png</file>
+        <file alias="sound_32px_hidpi.png">images/hidpi/sound_32px_hidpi.png</file>
+        <file alias="sound_warning_16px_hidpi.png">images/hidpi/sound_warning_16px_hidpi.png</file>
+        <file alias="state_aborted_16px_hidpi.png">images/hidpi/state_aborted_16px_hidpi.png</file>
+        <file alias="state_discarding_16px_hidpi.png">images/hidpi/state_discarding_16px_hidpi.png</file>
+        <file alias="state_paused_16px_hidpi.png">images/hidpi/state_paused_16px_hidpi.png</file>
+        <file alias="state_powered_off_16px_hidpi.png">images/hidpi/state_powered_off_16px_hidpi.png</file>
+        <file alias="state_restoring_16px_hidpi.png">images/hidpi/state_restoring_16px_hidpi.png</file>
+        <file alias="state_running_16px_hidpi.png">images/hidpi/state_running_16px_hidpi.png</file>
+        <file alias="state_saved_16px_hidpi.png">images/hidpi/state_saved_16px_hidpi.png</file>
+        <file alias="state_saving_16px_hidpi.png">images/hidpi/state_saving_16px_hidpi.png</file>
+        <file alias="state_stuck_16px_hidpi.png">images/hidpi/state_stuck_16px_hidpi.png</file>
+        <file alias="status_check_16px_hidpi.png">images/hidpi/status_check_16px_hidpi.png</file>
+        <file alias="status_error_16px_hidpi.png">images/hidpi/status_error_16px_hidpi.png</file>
+        <file alias="statusbar_16px_hidpi.png">images/hidpi/statusbar_16px_hidpi.png</file>
+        <file alias="statusbar_disabled_16px_hidpi.png">images/hidpi/statusbar_disabled_16px_hidpi.png</file>
+        <file alias="statusbar_on_16px_hidpi.png">images/hidpi/statusbar_on_16px_hidpi.png</file>
+        <file alias="statusbar_on_disabled_16px_hidpi.png">images/hidpi/statusbar_on_disabled_16px_hidpi.png</file>
+        <file alias="statusbar_settings_16px_hidpi.png">images/hidpi/statusbar_settings_16px_hidpi.png</file>
+        <file alias="statusbar_settings_disabled_16px_hidpi.png">images/hidpi/statusbar_settings_disabled_16px_hidpi.png</file>
+        <file alias="usb_16px_hidpi.png">images/hidpi/usb_16px_hidpi.png</file>
+        <file alias="usb_24px_hidpi.png">images/hidpi/usb_24px_hidpi.png</file>
+        <file alias="usb_32px_hidpi.png">images/hidpi/usb_32px_hidpi.png</file>
+        <file alias="usb_add_16px_hidpi.png">images/hidpi/usb_add_16px_hidpi.png</file>
+        <file alias="usb_add_disabled_16px_hidpi.png">images/hidpi/usb_add_disabled_16px_hidpi.png</file>
+        <file alias="usb_collapse_16px_hidpi.png">images/hidpi/usb_collapse_16px_hidpi.png</file>
+        <file alias="usb_disabled_16px_hidpi.png">images/hidpi/usb_disabled_16px_hidpi.png</file>
+        <file alias="usb_expand_16px_hidpi.png">images/hidpi/usb_expand_16px_hidpi.png</file>
+        <file alias="usb_filter_edit_16px_hidpi.png">images/hidpi/usb_filter_edit_16px_hidpi.png</file>
+        <file alias="usb_filter_edit_disabled_16px_hidpi.png">images/hidpi/usb_filter_edit_disabled_16px_hidpi.png</file>
+        <file alias="usb_movedown_16px_hidpi.png">images/hidpi/usb_movedown_16px_hidpi.png</file>
+        <file alias="usb_movedown_disabled_16px_hidpi.png">images/hidpi/usb_movedown_disabled_16px_hidpi.png</file>
+        <file alias="usb_moveup_16px_hidpi.png">images/hidpi/usb_moveup_16px_hidpi.png</file>
+        <file alias="usb_moveup_disabled_16px_hidpi.png">images/hidpi/usb_moveup_disabled_16px_hidpi.png</file>
+        <file alias="usb_new_16px_hidpi.png">images/hidpi/usb_new_16px_hidpi.png</file>
+        <file alias="usb_new_disabled_16px_hidpi.png">images/hidpi/usb_new_disabled_16px_hidpi.png</file>
+        <file alias="usb_read_16px_hidpi.png">images/hidpi/usb_read_16px_hidpi.png</file>
+        <file alias="usb_remove_16px_hidpi.png">images/hidpi/usb_remove_16px_hidpi.png</file>
+        <file alias="usb_remove_disabled_16px_hidpi.png">images/hidpi/usb_remove_disabled_16px_hidpi.png</file>
+        <file alias="usb_settings_16px_hidpi.png">images/hidpi/usb_settings_16px_hidpi.png</file>
+        <file alias="usb_settings_disabled_16px_hidpi.png">images/hidpi/usb_settings_disabled_16px_hidpi.png</file>
+        <file alias="usb_unavailable_16px_hidpi.png">images/hidpi/usb_unavailable_16px_hidpi.png</file>
+        <file alias="usb_unavailable_disabled_16px_hidpi.png">images/hidpi/usb_unavailable_disabled_16px_hidpi.png</file>
+        <file alias="usb_warning_16px_hidpi.png">images/hidpi/usb_warning_16px_hidpi.png</file>
+        <file alias="usb_write_16px_hidpi.png">images/hidpi/usb_write_16px_hidpi.png</file>
+        <file alias="video_capture_16px_hidpi.png">images/hidpi/video_capture_16px_hidpi.png</file>
+        <file alias="video_capture_disabled_16px_hidpi.png">images/hidpi/video_capture_disabled_16px_hidpi.png</file>
+        <file alias="video_capture_on_16px_hidpi.png">images/hidpi/video_capture_on_16px_hidpi.png</file>
+        <file alias="video_capture_on_disabled_16px_hidpi.png">images/hidpi/video_capture_on_disabled_16px_hidpi.png</file>
+        <file alias="video_capture_settings_16px_hidpi.png">images/hidpi/video_capture_settings_16px_hidpi.png</file>
+        <file alias="virtual_screen_16px_hidpi.png">images/hidpi/virtual_screen_16px_hidpi.png</file>
+        <file alias="virtual_screen_disabled_16px_hidpi.png">images/hidpi/virtual_screen_disabled_16px_hidpi.png</file>
+        <file alias="vm_add_16px_hidpi.png">images/hidpi/vm_add_16px_hidpi.png</file>
+        <file alias="vm_clone_16px_hidpi.png">images/hidpi/vm_clone_16px_hidpi.png</file>
+        <file alias="vm_clone_22px_hidpi.png">images/hidpi/vm_clone_22px_hidpi.png</file>
+        <file alias="vm_clone_disabled_16px_hidpi.png">images/hidpi/vm_clone_disabled_16px_hidpi.png</file>
+        <file alias="vm_clone_disabled_22px_hidpi.png">images/hidpi/vm_clone_disabled_22px_hidpi.png</file>
+        <file alias="vm_create_shortcut_16px_hidpi.png">images/hidpi/vm_create_shortcut_16px_hidpi.png</file>
+        <file alias="vm_create_shortcut_disabled_16px_hidpi.png">images/hidpi/vm_create_shortcut_disabled_16px_hidpi.png</file>
+        <file alias="vm_delete_16px_hidpi.png">images/hidpi/vm_delete_16px_hidpi.png</file>
+        <file alias="vm_delete_32px_hidpi.png">images/hidpi/vm_delete_32px_hidpi.png</file>
+        <file alias="vm_delete_disabled_16px_hidpi.png">images/hidpi/vm_delete_disabled_16px_hidpi.png</file>
+        <file alias="vm_delete_disabled_32px_hidpi.png">images/hidpi/vm_delete_disabled_32px_hidpi.png</file>
+        <file alias="vm_discard_16px_hidpi.png">images/hidpi/vm_discard_16px_hidpi.png</file>
+        <file alias="vm_discard_32px_hidpi.png">images/hidpi/vm_discard_32px_hidpi.png</file>
+        <file alias="vm_discard_disabled_16px_hidpi.png">images/hidpi/vm_discard_disabled_16px_hidpi.png</file>
+        <file alias="vm_discard_disabled_32px_hidpi.png">images/hidpi/vm_discard_disabled_32px_hidpi.png</file>
+        <file alias="vm_group_create_16px_hidpi.png">images/hidpi/vm_group_create_16px_hidpi.png</file>
+        <file alias="vm_group_create_disabled_16px_hidpi.png">images/hidpi/vm_group_create_disabled_16px_hidpi.png</file>
+        <file alias="vm_group_name_16px_hidpi.png">images/hidpi/vm_group_name_16px_hidpi.png</file>
+        <file alias="vm_group_name_disabled_16px_hidpi.png">images/hidpi/vm_group_name_disabled_16px_hidpi.png</file>
+        <file alias="vm_group_remove_16px_hidpi.png">images/hidpi/vm_group_remove_16px_hidpi.png</file>
+        <file alias="vm_group_remove_disabled_16px_hidpi.png">images/hidpi/vm_group_remove_disabled_16px_hidpi.png</file>
+        <file alias="vm_new_16px_hidpi.png">images/hidpi/vm_new_16px_hidpi.png</file>
+        <file alias="vm_new_32px_hidpi.png">images/hidpi/vm_new_32px_hidpi.png</file>
+        <file alias="vm_open_filemanager_16px_hidpi.png">images/hidpi/vm_open_filemanager_16px_hidpi.png</file>
+        <file alias="vm_open_filemanager_disabled_16px_hidpi.png">images/hidpi/vm_open_filemanager_disabled_16px_hidpi.png</file>
+        <file alias="vm_pause_16px_hidpi.png">images/hidpi/vm_pause_16px_hidpi.png</file>
+        <file alias="vm_pause_32px_hidpi.png">images/hidpi/vm_pause_32px_hidpi.png</file>
+        <file alias="vm_pause_disabled_16px_hidpi.png">images/hidpi/vm_pause_disabled_16px_hidpi.png</file>
+        <file alias="vm_pause_disabled_32px_hidpi.png">images/hidpi/vm_pause_disabled_32px_hidpi.png</file>
+        <file alias="vm_pause_on_16px_hidpi.png">images/hidpi/vm_pause_on_16px_hidpi.png</file>
+        <file alias="vm_pause_on_disabled_16px_hidpi.png">images/hidpi/vm_pause_on_disabled_16px_hidpi.png</file>
+        <file alias="vm_poweroff_16px_hidpi.png">images/hidpi/vm_poweroff_16px_hidpi.png</file>
+        <file alias="vm_poweroff_disabled_16px_hidpi.png">images/hidpi/vm_poweroff_disabled_16px_hidpi.png</file>
+        <file alias="vm_reset_16px_hidpi.png">images/hidpi/vm_reset_16px_hidpi.png</file>
+        <file alias="vm_reset_disabled_16px_hidpi.png">images/hidpi/vm_reset_disabled_16px_hidpi.png</file>
+        <file alias="vm_save_state_16px_hidpi.png">images/hidpi/vm_save_state_16px_hidpi.png</file>
+        <file alias="vm_save_state_disabled_16px_hidpi.png">images/hidpi/vm_save_state_disabled_16px_hidpi.png</file>
+        <file alias="vm_settings_16px_hidpi.png">images/hidpi/vm_settings_16px_hidpi.png</file>
+        <file alias="vm_settings_32px_hidpi.png">images/hidpi/vm_settings_32px_hidpi.png</file>
+        <file alias="vm_settings_disabled_16px_hidpi.png">images/hidpi/vm_settings_disabled_16px_hidpi.png</file>
+        <file alias="vm_settings_disabled_32px_hidpi.png">images/hidpi/vm_settings_disabled_32px_hidpi.png</file>
+        <file alias="vm_show_logs_16px_hidpi.png">images/hidpi/vm_show_logs_16px_hidpi.png</file>
+        <file alias="vm_show_logs_32px_hidpi.png">images/hidpi/vm_show_logs_32px_hidpi.png</file>
+        <file alias="vm_show_logs_disabled_16px_hidpi.png">images/hidpi/vm_show_logs_disabled_16px_hidpi.png</file>
+        <file alias="vm_show_logs_disabled_32px_hidpi.png">images/hidpi/vm_show_logs_disabled_32px_hidpi.png</file>
+        <file alias="vm_shutdown_16px_hidpi.png">images/hidpi/vm_shutdown_16px_hidpi.png</file>
+        <file alias="vm_shutdown_disabled_16px_hidpi.png">images/hidpi/vm_shutdown_disabled_16px_hidpi.png</file>
+        <file alias="vm_start_16px_hidpi.png">images/hidpi/vm_start_16px_hidpi.png</file>
+        <file alias="vm_start_32px_hidpi.png">images/hidpi/vm_start_32px_hidpi.png</file>
+        <file alias="vm_start_disabled_16px_hidpi.png">images/hidpi/vm_start_disabled_16px_hidpi.png</file>
+        <file alias="vm_start_disabled_32px_hidpi.png">images/hidpi/vm_start_disabled_32px_hidpi.png</file>
+        <file alias="vrdp_16px_hidpi.png">images/hidpi/vrdp_16px_hidpi.png</file>
+        <file alias="vrdp_24px_hidpi.png">images/hidpi/vrdp_24px_hidpi.png</file>
+        <file alias="vrdp_32px_hidpi.png">images/hidpi/vrdp_32px_hidpi.png</file>
+        <file alias="vrdp_disabled_16px_hidpi.png">images/hidpi/vrdp_disabled_16px_hidpi.png</file>
+        <file alias="vrdp_on_16px_hidpi.png">images/hidpi/vrdp_on_16px_hidpi.png</file>
+        <file alias="vrdp_on_disabled_16px_hidpi.png">images/hidpi/vrdp_on_disabled_16px_hidpi.png</file>
+        <file alias="vrdp_warning_16px_hidpi.png">images/hidpi/vrdp_warning_16px_hidpi.png</file>
+        <file alias="vtx_amdv_16px_hidpi.png">images/hidpi/vtx_amdv_16px_hidpi.png</file>
+        <file alias="vtx_amdv_disabled_16px_hidpi.png">images/hidpi/vtx_amdv_disabled_16px_hidpi.png</file>
+        <file alias="web_camera_16px_hidpi.png">images/hidpi/web_camera_16px_hidpi.png</file>
+        <file alias="web_camera_disabled_16px_hidpi.png">images/hidpi/web_camera_disabled_16px_hidpi.png</file>
+    </qresource>
+</RCC>
diff --git a/src/VBox/Frontends/VirtualBox/VirtualBoxBrand.qrc b/src/VBox/Frontends/VirtualBox/VirtualBoxBrand.qrc
index 37e2c58..015db17 100644
--- a/src/VBox/Frontends/VirtualBox/VirtualBoxBrand.qrc
+++ b/src/VBox/Frontends/VirtualBox/VirtualBoxBrand.qrc
@@ -1,7 +1,9 @@
 <!DOCTYPE RCC><RCC version="1.0">
  <qresource prefix="/">
     <file alias="about.png">@VBOX_ABOUT_PNG@</file>
+    <file alias="about_hidpi.png">@VBOX_ABOUT_HIDPI_PNG@</file>
     <file alias="about_16px.png">@VBOX_ABOUT_16PX_PNG@</file>
+    <file alias="about_16px_hidpi.png">@VBOX_ABOUT_16PX_HIDPI_PNG@</file>
     <file alias="VirtualBox_16px.png">@VBOX_VBOX_16PX_PNG@</file>
     <file alias="VirtualBox_20px.png">@VBOX_VBOX_20PX_PNG@</file>
     <file alias="VirtualBox_32px.png">@VBOX_VBOX_32PX_PNG@</file>
diff --git a/src/VBox/Frontends/VirtualBox/images/add_host_iface_16px.png b/src/VBox/Frontends/VirtualBox/images/add_host_iface_16px.png
index ac40c8a..78cac47 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/add_host_iface_16px.png and b/src/VBox/Frontends/VirtualBox/images/add_host_iface_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/add_host_iface_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/add_host_iface_disabled_16px.png
index 81ce21d..d93c501 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/add_host_iface_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/add_host_iface_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/adjust_win_size_16px.png b/src/VBox/Frontends/VirtualBox/images/adjust_win_size_16px.png
index 6116798..c225d3c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/adjust_win_size_16px.png and b/src/VBox/Frontends/VirtualBox/images/adjust_win_size_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/adjust_win_size_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/adjust_win_size_disabled_16px.png
index 4777c19..f19f00f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/adjust_win_size_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/adjust_win_size_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/arrow_down_10px.png b/src/VBox/Frontends/VirtualBox/images/arrow_down_10px.png
index 94e991f..5fe1a3b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/arrow_down_10px.png and b/src/VBox/Frontends/VirtualBox/images/arrow_down_10px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/arrow_left_10px.png b/src/VBox/Frontends/VirtualBox/images/arrow_left_10px.png
index e4b0847..f031ec8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/arrow_left_10px.png and b/src/VBox/Frontends/VirtualBox/images/arrow_left_10px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/arrow_right_10px.png b/src/VBox/Frontends/VirtualBox/images/arrow_right_10px.png
index 5f3f0c1..6136917 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/arrow_right_10px.png and b/src/VBox/Frontends/VirtualBox/images/arrow_right_10px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/arrow_up_10px.png b/src/VBox/Frontends/VirtualBox/images/arrow_up_10px.png
index d12f029..f91f6f9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/arrow_up_10px.png and b/src/VBox/Frontends/VirtualBox/images/arrow_up_10px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/attachment_16px.png b/src/VBox/Frontends/VirtualBox/images/attachment_16px.png
deleted file mode 100644
index 8fc44de..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/attachment_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/attachment_add_16px.png b/src/VBox/Frontends/VirtualBox/images/attachment_add_16px.png
index 56d84ff..5b1fdff 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/attachment_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/attachment_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/attachment_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/attachment_add_disabled_16px.png
index a4b9f3c..94dd3db 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/attachment_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/attachment_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/attachment_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/attachment_disabled_16px.png
deleted file mode 100644
index 8ec8582..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/attachment_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/attachment_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/attachment_remove_16px.png
index d349c73..0229739 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/attachment_remove_16px.png and b/src/VBox/Frontends/VirtualBox/images/attachment_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/attachment_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/attachment_remove_disabled_16px.png
index a28b2df..593ec06 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/attachment_remove_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/attachment_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/auto_resize_off_16px.png b/src/VBox/Frontends/VirtualBox/images/auto_resize_off_16px.png
deleted file mode 100644
index 21597bd..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/auto_resize_off_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/auto_resize_off_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/auto_resize_off_disabled_16px.png
deleted file mode 100644
index 46daaf6..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/auto_resize_off_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/auto_resize_on_16px.png b/src/VBox/Frontends/VirtualBox/images/auto_resize_on_16px.png
index feeb8cf..6c4c80d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/auto_resize_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/auto_resize_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/auto_resize_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/auto_resize_on_disabled_16px.png
index 46daaf6..5f9aa3c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/auto_resize_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/auto_resize_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/auto_resize_on_on_16px.png b/src/VBox/Frontends/VirtualBox/images/auto_resize_on_on_16px.png
index 983ed23..dde00c1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/auto_resize_on_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/auto_resize_on_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/auto_resize_on_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/auto_resize_on_on_disabled_16px.png
index 1922da5..71a4517 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/auto_resize_on_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/auto_resize_on_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cancel_16px.png b/src/VBox/Frontends/VirtualBox/images/cancel_16px.png
index a05d215..706bcda 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cancel_16px.png and b/src/VBox/Frontends/VirtualBox/images/cancel_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_16px.png
index 2652279..d0ff5f4 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_16px.png and b/src/VBox/Frontends/VirtualBox/images/cd_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_32px.png b/src/VBox/Frontends/VirtualBox/images/cd_32px.png
deleted file mode 100644
index f6170ec..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_add_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_add_16px.png
index 6ed10e4..e8451c3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/cd_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_add_disabled_16px.png
index 54bbd00..8ad56ef 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/cd_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_copy_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_copy_16px.png
new file mode 100644
index 0000000..3656d11
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_copy_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_copy_22px.png b/src/VBox/Frontends/VirtualBox/images/cd_copy_22px.png
new file mode 100644
index 0000000..af3dbba
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_copy_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_copy_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_copy_disabled_16px.png
new file mode 100644
index 0000000..b1a7750
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_copy_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_copy_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/cd_copy_disabled_22px.png
new file mode 100644
index 0000000..89583c6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_copy_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_disabled_16px.png
index f28a41b..5d7fafb 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/cd_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/cd_disabled_32px.png
deleted file mode 100644
index 6e8b4cf..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_modify_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_modify_16px.png
new file mode 100644
index 0000000..5af964c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_modify_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_modify_22px.png b/src/VBox/Frontends/VirtualBox/images/cd_modify_22px.png
new file mode 100644
index 0000000..81b5f7e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_modify_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_modify_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_modify_disabled_16px.png
new file mode 100644
index 0000000..3a8541b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_modify_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_modify_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/cd_modify_disabled_22px.png
new file mode 100644
index 0000000..32a290c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_modify_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_read_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_read_16px.png
index 31b4a65..6bd5b9c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_read_16px.png and b/src/VBox/Frontends/VirtualBox/images/cd_read_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_release_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_release_16px.png
new file mode 100644
index 0000000..6654232
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_release_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_release_22px.png b/src/VBox/Frontends/VirtualBox/images/cd_release_22px.png
new file mode 100644
index 0000000..83c71a7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_release_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_release_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_release_disabled_16px.png
new file mode 100644
index 0000000..194c87d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_release_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_release_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/cd_release_disabled_22px.png
new file mode 100644
index 0000000..67b3270
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_release_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_remove_16px.png
new file mode 100644
index 0000000..55c61fe
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_remove_22px.png b/src/VBox/Frontends/VirtualBox/images/cd_remove_22px.png
new file mode 100644
index 0000000..28ab62a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_remove_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_remove_disabled_16px.png
new file mode 100644
index 0000000..3c3edb0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_remove_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/cd_remove_disabled_22px.png
new file mode 100644
index 0000000..2c56ac6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_remove_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_unmount_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_unmount_16px.png
index 96b4030..d87b684 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_unmount_16px.png and b/src/VBox/Frontends/VirtualBox/images/cd_unmount_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_unmount_dis_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_unmount_dis_16px.png
deleted file mode 100644
index 6bb92ac..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_unmount_dis_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_unmount_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_unmount_disabled_16px.png
new file mode 100644
index 0000000..3bad4b4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/cd_unmount_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cd_write_16px.png b/src/VBox/Frontends/VirtualBox/images/cd_write_16px.png
index d803142..edeeada 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cd_write_16px.png and b/src/VBox/Frontends/VirtualBox/images/cd_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/chipset_16px.png b/src/VBox/Frontends/VirtualBox/images/chipset_16px.png
index 7909fbb..a7a8d93 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/chipset_16px.png and b/src/VBox/Frontends/VirtualBox/images/chipset_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/chipset_24px.png b/src/VBox/Frontends/VirtualBox/images/chipset_24px.png
new file mode 100644
index 0000000..b194998
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/chipset_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/chipset_32px.png b/src/VBox/Frontends/VirtualBox/images/chipset_32px.png
index 3bf7295..e173349 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/chipset_32px.png and b/src/VBox/Frontends/VirtualBox/images/chipset_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/chipset_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/chipset_disabled_16px.png
deleted file mode 100644
index ecbe57b..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/chipset_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/chipset_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/chipset_disabled_32px.png
deleted file mode 100644
index 0bcec3e..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/chipset_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/chipset_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/chipset_warning_16px.png
index ee9068b..7d00e88 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/chipset_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/chipset_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/close_16px.png b/src/VBox/Frontends/VirtualBox/images/close_16px.png
index f9c17c9..cfa9910 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/close_16px.png and b/src/VBox/Frontends/VirtualBox/images/close_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/close_popup_16px.png b/src/VBox/Frontends/VirtualBox/images/close_popup_16px.png
index b48491d..f0c99c0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/close_popup_16px.png and b/src/VBox/Frontends/VirtualBox/images/close_popup_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/connect_16px.png b/src/VBox/Frontends/VirtualBox/images/connect_16px.png
index 93f5fac..9907eb7 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/connect_16px.png and b/src/VBox/Frontends/VirtualBox/images/connect_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/controller_add_16px.png b/src/VBox/Frontends/VirtualBox/images/controller_add_16px.png
index 9682351..b001879 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/controller_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/controller_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/controller_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/controller_add_disabled_16px.png
index f39f0d6..9429e05 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/controller_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/controller_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/controller_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/controller_remove_16px.png
index a91688e..2955ad6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/controller_remove_16px.png and b/src/VBox/Frontends/VirtualBox/images/controller_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/controller_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/controller_remove_disabled_16px.png
index fd83b80..693c614 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/controller_remove_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/controller_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/cpu_16px.png b/src/VBox/Frontends/VirtualBox/images/cpu_16px.png
index ab8684c..7e814c2 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/cpu_16px.png and b/src/VBox/Frontends/VirtualBox/images/cpu_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/description_16px.png b/src/VBox/Frontends/VirtualBox/images/description_16px.png
index 489af2c..f6f1a45 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/description_16px.png and b/src/VBox/Frontends/VirtualBox/images/description_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/description_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/description_disabled_16px.png
deleted file mode 100644
index 98b7456..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/description_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/description_edit_16px.png b/src/VBox/Frontends/VirtualBox/images/description_edit_16px.png
deleted file mode 100644
index 728edfd..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/description_edit_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/description_edit_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/description_edit_disabled_16px.png
deleted file mode 100644
index 772973d..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/description_edit_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_16px.png b/src/VBox/Frontends/VirtualBox/images/discard_cur_state_16px.png
deleted file mode 100644
index 0dc2159..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_22px.png b/src/VBox/Frontends/VirtualBox/images/discard_cur_state_22px.png
deleted file mode 100644
index cfc64a8..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_dis_16px.png b/src/VBox/Frontends/VirtualBox/images/discard_cur_state_dis_16px.png
deleted file mode 100644
index ec1e7de..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_dis_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_dis_22px.png b/src/VBox/Frontends/VirtualBox/images/discard_cur_state_dis_22px.png
deleted file mode 100644
index 78e9678..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_dis_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_16px.png b/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_16px.png
deleted file mode 100644
index 9b8f9d8..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_22px.png b/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_22px.png
deleted file mode 100644
index ff17d4c..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_dis_16px.png b/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_dis_16px.png
deleted file mode 100644
index 5881843..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_dis_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_dis_22px.png b/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_dis_22px.png
deleted file mode 100644
index 41f2295..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/discard_cur_state_snapshot_dis_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/disconnect_16px.png b/src/VBox/Frontends/VirtualBox/images/disconnect_16px.png
index 59d2af3..731aa80 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/disconnect_16px.png and b/src/VBox/Frontends/VirtualBox/images/disconnect_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/diskimage_16px.png b/src/VBox/Frontends/VirtualBox/images/diskimage_16px.png
index 0291e88..08a85df 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/diskimage_16px.png and b/src/VBox/Frontends/VirtualBox/images/diskimage_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/diskimage_32px.png b/src/VBox/Frontends/VirtualBox/images/diskimage_32px.png
index cd4c730..466a137 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/diskimage_32px.png and b/src/VBox/Frontends/VirtualBox/images/diskimage_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/diskimage_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/diskimage_disabled_32px.png
deleted file mode 100644
index 45bc0fe..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/diskimage_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/display_hardware_16px.png b/src/VBox/Frontends/VirtualBox/images/display_hardware_16px.png
new file mode 100644
index 0000000..de9bbf5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/display_hardware_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/display_hardware_write_16px.png b/src/VBox/Frontends/VirtualBox/images/display_hardware_write_16px.png
new file mode 100644
index 0000000..39c343a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/display_hardware_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/display_software_16px.png b/src/VBox/Frontends/VirtualBox/images/display_software_16px.png
new file mode 100644
index 0000000..6dad80f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/display_software_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/drag_drop_16px.png b/src/VBox/Frontends/VirtualBox/images/drag_drop_16px.png
index 83c9428..042f73a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/drag_drop_16px.png and b/src/VBox/Frontends/VirtualBox/images/drag_drop_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/drag_drop_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/drag_drop_disabled_16px.png
index 27aa5ef..4decc5e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/drag_drop_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/drag_drop_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_add_16px.png b/src/VBox/Frontends/VirtualBox/images/edata_add_16px.png
new file mode 100644
index 0000000..589abf8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_add_22px.png b/src/VBox/Frontends/VirtualBox/images/edata_add_22px.png
new file mode 100644
index 0000000..ec119dc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_add_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/edata_add_disabled_16px.png
new file mode 100644
index 0000000..b2146b3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_add_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/edata_add_disabled_22px.png
new file mode 100644
index 0000000..4a75258
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_add_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_load_16px.png b/src/VBox/Frontends/VirtualBox/images/edata_load_16px.png
new file mode 100644
index 0000000..49a41bc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_load_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_load_22px.png b/src/VBox/Frontends/VirtualBox/images/edata_load_22px.png
new file mode 100644
index 0000000..28e9b7e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_load_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_load_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/edata_load_disabled_16px.png
new file mode 100644
index 0000000..dedee8e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_load_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_load_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/edata_load_disabled_22px.png
new file mode 100644
index 0000000..ece8db9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_load_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/edata_remove_16px.png
new file mode 100644
index 0000000..2150998
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_remove_22px.png b/src/VBox/Frontends/VirtualBox/images/edata_remove_22px.png
new file mode 100644
index 0000000..fae9b7e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_remove_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/edata_remove_disabled_16px.png
new file mode 100644
index 0000000..5083e28
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_remove_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/edata_remove_disabled_22px.png
new file mode 100644
index 0000000..b8c028d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_remove_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_save_16px.png b/src/VBox/Frontends/VirtualBox/images/edata_save_16px.png
new file mode 100644
index 0000000..4c51072
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_save_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_save_22px.png b/src/VBox/Frontends/VirtualBox/images/edata_save_22px.png
new file mode 100644
index 0000000..b4f14f9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_save_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_save_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/edata_save_disabled_16px.png
new file mode 100644
index 0000000..badbff0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_save_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edata_save_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/edata_save_disabled_22px.png
new file mode 100644
index 0000000..ec201ca
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edata_save_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edataglobal_32px.png b/src/VBox/Frontends/VirtualBox/images/edataglobal_32px.png
new file mode 100644
index 0000000..1ee837b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edataglobal_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edataman_16px.png b/src/VBox/Frontends/VirtualBox/images/edataman_16px.png
new file mode 100644
index 0000000..25a1c72
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edataman_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/edataman_32px.png b/src/VBox/Frontends/VirtualBox/images/edataman_32px.png
new file mode 100644
index 0000000..94cb1e1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/edataman_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/eraser_16px.png b/src/VBox/Frontends/VirtualBox/images/eraser_16px.png
index 300e7a5..ab5455a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/eraser_16px.png and b/src/VBox/Frontends/VirtualBox/images/eraser_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/eraser_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/eraser_disabled_16px.png
deleted file mode 100644
index fc4e641..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/eraser_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/exit_16px.png b/src/VBox/Frontends/VirtualBox/images/exit_16px.png
index 9d2dd7d..2921278 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/exit_16px.png and b/src/VBox/Frontends/VirtualBox/images/exit_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/expanding_collapsing_16px.png b/src/VBox/Frontends/VirtualBox/images/expanding_collapsing_16px.png
index f67b8e3..8e9be30 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/expanding_collapsing_16px.png and b/src/VBox/Frontends/VirtualBox/images/expanding_collapsing_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/export_16px.png b/src/VBox/Frontends/VirtualBox/images/export_16px.png
index e50b6fe..673ab05 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/export_16px.png and b/src/VBox/Frontends/VirtualBox/images/export_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_16px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_16px.png
index 053695a..fba4c7c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_16px.png and b/src/VBox/Frontends/VirtualBox/images/extension_pack_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_24px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_24px.png
new file mode 100644
index 0000000..9588dc6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/extension_pack_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_32px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_32px.png
index 9127b1a..75a9a42 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_32px.png and b/src/VBox/Frontends/VirtualBox/images/extension_pack_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_disabled_16px.png
deleted file mode 100644
index 95f6dd5..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_disabled_32px.png
deleted file mode 100644
index 776a7b2..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_install_16px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_install_16px.png
index 2b425fe..cfe36f6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_install_16px.png and b/src/VBox/Frontends/VirtualBox/images/extension_pack_install_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_install_32px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_install_32px.png
deleted file mode 100644
index a83a964..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_install_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_install_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_install_disabled_16px.png
index eb9d8e1..3aabe63 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_install_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/extension_pack_install_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_install_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_install_disabled_32px.png
deleted file mode 100644
index 7de3074..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_install_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_16px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_16px.png
index a7414c4..15d4c73 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_16px.png and b/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_32px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_32px.png
deleted file mode 100644
index 2679184..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_disabled_16px.png
index 6cc88d2..1e71807 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_disabled_32px.png
deleted file mode 100644
index 12ba796..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_uninstall_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/extension_pack_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/extension_pack_warning_16px.png
index 164e773..cb7eb21 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/extension_pack_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/extension_pack_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_16px.png
index b9f4bb0..b07870b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_16px.png and b/src/VBox/Frontends/VirtualBox/images/fd_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_32px.png b/src/VBox/Frontends/VirtualBox/images/fd_32px.png
deleted file mode 100644
index cf422ba..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_add_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_add_16px.png
index 8d56f78..f421317 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/fd_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_add_disabled_16px.png
index dfc4e99..2535c59 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/fd_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_copy_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_copy_16px.png
new file mode 100644
index 0000000..10bfee6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_copy_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_copy_22px.png b/src/VBox/Frontends/VirtualBox/images/fd_copy_22px.png
new file mode 100644
index 0000000..51084bd
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_copy_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_copy_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_copy_disabled_16px.png
new file mode 100644
index 0000000..1d8cd6f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_copy_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_copy_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/fd_copy_disabled_22px.png
new file mode 100644
index 0000000..132ce79
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_copy_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_disabled_16px.png
index 3527e35..12df6c8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/fd_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/fd_disabled_32px.png
deleted file mode 100644
index 2447132..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_modify_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_modify_16px.png
new file mode 100644
index 0000000..f230ec7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_modify_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_modify_22px.png b/src/VBox/Frontends/VirtualBox/images/fd_modify_22px.png
new file mode 100644
index 0000000..890e10f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_modify_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_modify_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_modify_disabled_16px.png
new file mode 100644
index 0000000..af60523
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_modify_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_modify_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/fd_modify_disabled_22px.png
new file mode 100644
index 0000000..10fa745
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_modify_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_read_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_read_16px.png
index a9a7bcc..96a52c3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_read_16px.png and b/src/VBox/Frontends/VirtualBox/images/fd_read_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_release_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_release_16px.png
new file mode 100644
index 0000000..519f146
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_release_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_release_22px.png b/src/VBox/Frontends/VirtualBox/images/fd_release_22px.png
new file mode 100644
index 0000000..e045b97
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_release_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_release_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_release_disabled_16px.png
new file mode 100644
index 0000000..add369c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_release_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_release_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/fd_release_disabled_22px.png
new file mode 100644
index 0000000..b7cbacd
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_release_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_remove_16px.png
new file mode 100644
index 0000000..49931ab
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_remove_22px.png b/src/VBox/Frontends/VirtualBox/images/fd_remove_22px.png
new file mode 100644
index 0000000..4a2b737
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_remove_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_remove_disabled_16px.png
new file mode 100644
index 0000000..a7ff29f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_remove_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/fd_remove_disabled_22px.png
new file mode 100644
index 0000000..51623d8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_remove_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_unmount_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_unmount_16px.png
index 6e77f4d..a563306 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_unmount_16px.png and b/src/VBox/Frontends/VirtualBox/images/fd_unmount_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_unmount_dis_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_unmount_dis_16px.png
deleted file mode 100644
index 93d97ca..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_unmount_dis_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_unmount_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_unmount_disabled_16px.png
new file mode 100644
index 0000000..3556092
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/fd_unmount_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fd_write_16px.png b/src/VBox/Frontends/VirtualBox/images/fd_write_16px.png
index 1e2d7e6..0c21ceb 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fd_write_16px.png and b/src/VBox/Frontends/VirtualBox/images/fd_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/floppy_16px.png b/src/VBox/Frontends/VirtualBox/images/floppy_16px.png
index fad1759..471a99c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/floppy_16px.png and b/src/VBox/Frontends/VirtualBox/images/floppy_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/floppy_add_16px.png b/src/VBox/Frontends/VirtualBox/images/floppy_add_16px.png
index 2059344..4e43c29 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/floppy_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/floppy_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/floppy_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/floppy_add_disabled_16px.png
index 47b048e..1d7f801 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/floppy_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/floppy_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/floppy_collapse_16px.png b/src/VBox/Frontends/VirtualBox/images/floppy_collapse_16px.png
index e33a437..15da44b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/floppy_collapse_16px.png and b/src/VBox/Frontends/VirtualBox/images/floppy_collapse_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/floppy_expand_16px.png b/src/VBox/Frontends/VirtualBox/images/floppy_expand_16px.png
index 875f937..c61ace1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/floppy_expand_16px.png and b/src/VBox/Frontends/VirtualBox/images/floppy_expand_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fullscreen_16px.png b/src/VBox/Frontends/VirtualBox/images/fullscreen_16px.png
index a7ea01c..cc60ca6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fullscreen_16px.png and b/src/VBox/Frontends/VirtualBox/images/fullscreen_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fullscreen_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fullscreen_disabled_16px.png
index e7486a9..ba68b42 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fullscreen_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/fullscreen_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fullscreen_on_16px.png b/src/VBox/Frontends/VirtualBox/images/fullscreen_on_16px.png
index c248598..1dd5ff9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fullscreen_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/fullscreen_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/fullscreen_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/fullscreen_on_disabled_16px.png
index 72c71e0..3d7dfb4 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/fullscreen_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/fullscreen_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/global_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/global_settings_16px.png
index 0187513..98ada3b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/global_settings_16px.png and b/src/VBox/Frontends/VirtualBox/images/global_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/global_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/global_settings_disabled_16px.png
deleted file mode 100644
index 82f7553..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/global_settings_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/group_abstract_16px.png b/src/VBox/Frontends/VirtualBox/images/group_abstract_16px.png
index 8bc7b38..aa9ffa9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/group_abstract_16px.png and b/src/VBox/Frontends/VirtualBox/images/group_abstract_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/guesttools_16px.png b/src/VBox/Frontends/VirtualBox/images/guesttools_16px.png
index 1409d04..10244c8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/guesttools_16px.png and b/src/VBox/Frontends/VirtualBox/images/guesttools_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/guesttools_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/guesttools_disabled_16px.png
index 99a2dfd..a60c73b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/guesttools_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/guesttools_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_16px.png
index 8e6906e..ff96d57 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_24px.png b/src/VBox/Frontends/VirtualBox/images/hd_24px.png
new file mode 100644
index 0000000..95f9191
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_32px.png b/src/VBox/Frontends/VirtualBox/images/hd_32px.png
index 115b8dd..4c35df7 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_32px.png and b/src/VBox/Frontends/VirtualBox/images/hd_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_add_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_add_16px.png
index c5804e9..96e15f6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_add_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_add_22px.png
deleted file mode 100644
index 1f1614f..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_add_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_add_disabled_16px.png
index d7f3d78..f0f0a60 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_add_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_add_disabled_22px.png
deleted file mode 100644
index a8ef7a3..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_add_disabled_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_copy_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_copy_16px.png
new file mode 100644
index 0000000..e90380b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_copy_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_copy_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_copy_22px.png
new file mode 100644
index 0000000..d720f7e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_copy_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_copy_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_copy_disabled_16px.png
new file mode 100644
index 0000000..fbda98b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_copy_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_copy_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_copy_disabled_22px.png
new file mode 100644
index 0000000..9fd56fe
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_copy_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_disabled_16px.png
index 2284b5b..c540dd2 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/hd_disabled_32px.png
deleted file mode 100644
index 340dbd4..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_modify_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_modify_16px.png
new file mode 100644
index 0000000..9fc6674
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_modify_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_modify_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_modify_22px.png
new file mode 100644
index 0000000..23b57bd
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_modify_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_modify_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_modify_disabled_16px.png
new file mode 100644
index 0000000..8204f18
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_modify_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_modify_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_modify_disabled_22px.png
new file mode 100644
index 0000000..e9630be
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_modify_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_new_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_new_16px.png
index 354f05e..c787964 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_new_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_new_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_new_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_new_22px.png
deleted file mode 100644
index e81cd9f..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_new_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_new_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_new_disabled_16px.png
index a41e6ac..ce0ef93 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_new_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_new_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_new_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_new_disabled_22px.png
deleted file mode 100644
index 218c207..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_new_disabled_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_read_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_read_16px.png
index 2cbfcef..87b8141 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_read_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_read_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_release_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_release_16px.png
index 8763e4c..53ce196 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_release_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_release_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_release_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_release_22px.png
index 8d9d713..ffe8f66 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_release_22px.png and b/src/VBox/Frontends/VirtualBox/images/hd_release_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_release_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_release_disabled_16px.png
index 0af863e..c02a08c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_release_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_release_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_release_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_release_disabled_22px.png
index 4f30a29..f73f010 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_release_disabled_22px.png and b/src/VBox/Frontends/VirtualBox/images/hd_release_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_remove_16px.png
index 272015f..f800261 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_remove_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_remove_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_remove_22px.png
index d84cdf1..0f9fca1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_remove_22px.png and b/src/VBox/Frontends/VirtualBox/images/hd_remove_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_remove_disabled_16px.png
index 481aa64..1cba17c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_remove_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_remove_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/hd_remove_disabled_22px.png
index 00649ba..e1abb08 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_remove_disabled_22px.png and b/src/VBox/Frontends/VirtualBox/images/hd_remove_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_settings_16px.png
new file mode 100644
index 0000000..f560816
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_settings_disabled_16px.png
new file mode 100644
index 0000000..b9d224f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hd_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_warning_16px.png
index bafde3b..532523b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hd_write_16px.png b/src/VBox/Frontends/VirtualBox/images/hd_write_16px.png
index 5873a97..63eaec9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hd_write_16px.png and b/src/VBox/Frontends/VirtualBox/images/hd_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/help_16px.png b/src/VBox/Frontends/VirtualBox/images/help_16px.png
index c89bbea..7e274e9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/help_16px.png and b/src/VBox/Frontends/VirtualBox/images/help_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/help_button_normal_mac_22px.png b/src/VBox/Frontends/VirtualBox/images/help_button_normal_mac_22px.png
index 123c3ae..24e22df 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/help_button_normal_mac_22px.png and b/src/VBox/Frontends/VirtualBox/images/help_button_normal_mac_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/help_button_pressed_mac_22px.png b/src/VBox/Frontends/VirtualBox/images/help_button_pressed_mac_22px.png
index ae94e88..2c297ad 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/help_button_pressed_mac_22px.png and b/src/VBox/Frontends/VirtualBox/images/help_button_pressed_mac_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/add_host_iface_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/add_host_iface_16px_hidpi.png
new file mode 100644
index 0000000..e286e74
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/add_host_iface_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/add_host_iface_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/add_host_iface_disabled_16px_hidpi.png
new file mode 100644
index 0000000..1affc4a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/add_host_iface_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/adjust_win_size_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/adjust_win_size_16px_hidpi.png
new file mode 100644
index 0000000..2224fb9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/adjust_win_size_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/adjust_win_size_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/adjust_win_size_disabled_16px_hidpi.png
new file mode 100644
index 0000000..ba971e4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/adjust_win_size_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_down_10px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_down_10px_hidpi.png
new file mode 100644
index 0000000..7837161
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_down_10px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_left_10px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_left_10px_hidpi.png
new file mode 100644
index 0000000..87e8570
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_left_10px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_right_10px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_right_10px_hidpi.png
new file mode 100644
index 0000000..2dc6ce1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_right_10px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_up_10px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_up_10px_hidpi.png
new file mode 100644
index 0000000..b2eb90b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/arrow_up_10px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_add_16px_hidpi.png
new file mode 100644
index 0000000..ea98f6f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..33c32d9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_remove_16px_hidpi.png
new file mode 100644
index 0000000..459e1c7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..5e9f01e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/attachment_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_16px_hidpi.png
new file mode 100644
index 0000000..061ea3d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..207ecb0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_on_16px_hidpi.png
new file mode 100644
index 0000000..a9486dc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..fa15deb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/auto_resize_on_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cancel_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cancel_16px_hidpi.png
new file mode 100644
index 0000000..dff3647
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cancel_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_16px_hidpi.png
new file mode 100644
index 0000000..99c29de
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_add_16px_hidpi.png
new file mode 100644
index 0000000..ad2ec1f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f30146b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_16px_hidpi.png
new file mode 100644
index 0000000..6c40b58
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_22px_hidpi.png
new file mode 100644
index 0000000..47e10ae
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_disabled_16px_hidpi.png
new file mode 100644
index 0000000..ca499ba
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_disabled_22px_hidpi.png
new file mode 100644
index 0000000..f5a0cb9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_copy_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_disabled_16px_hidpi.png
new file mode 100644
index 0000000..fb3fc30
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_16px_hidpi.png
new file mode 100644
index 0000000..2d4f595
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_22px_hidpi.png
new file mode 100644
index 0000000..1239d84
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_disabled_16px_hidpi.png
new file mode 100644
index 0000000..9b9ae7f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_disabled_22px_hidpi.png
new file mode 100644
index 0000000..4ae220e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_modify_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_read_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_read_16px_hidpi.png
new file mode 100644
index 0000000..59d1194
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_read_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_16px_hidpi.png
new file mode 100644
index 0000000..8c92545
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_22px_hidpi.png
new file mode 100644
index 0000000..298c44a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_disabled_16px_hidpi.png
new file mode 100644
index 0000000..c706dc6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_disabled_22px_hidpi.png
new file mode 100644
index 0000000..0ddeac9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_release_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_16px_hidpi.png
new file mode 100644
index 0000000..c5b228d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_22px_hidpi.png
new file mode 100644
index 0000000..4d742af
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..90f3158
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_disabled_22px_hidpi.png
new file mode 100644
index 0000000..56b04c2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_remove_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_unmount_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_unmount_16px_hidpi.png
new file mode 100644
index 0000000..8d42848
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_unmount_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_unmount_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_unmount_disabled_16px_hidpi.png
new file mode 100644
index 0000000..ed08f71
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_unmount_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cd_write_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_write_16px_hidpi.png
new file mode 100644
index 0000000..bf31e72
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cd_write_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_16px_hidpi.png
new file mode 100644
index 0000000..2ed18dd
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_24px_hidpi.png
new file mode 100644
index 0000000..f8f28c7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_32px_hidpi.png
new file mode 100644
index 0000000..5771a9a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_warning_16px_hidpi.png
new file mode 100644
index 0000000..ee4ad46
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/chipset_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/close_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/close_16px_hidpi.png
new file mode 100644
index 0000000..3b68563
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/close_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/close_popup_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/close_popup_16px_hidpi.png
new file mode 100644
index 0000000..1957528
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/close_popup_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/connect_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/connect_16px_hidpi.png
new file mode 100644
index 0000000..241e704
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/connect_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/controller_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/controller_add_16px_hidpi.png
new file mode 100644
index 0000000..bfa2759
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/controller_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/controller_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/controller_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..5050eb1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/controller_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/controller_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/controller_remove_16px_hidpi.png
new file mode 100644
index 0000000..34f10e9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/controller_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/controller_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/controller_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..5cdd310
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/controller_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/cpu_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/cpu_16px_hidpi.png
new file mode 100644
index 0000000..7d130a2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/cpu_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/description_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/description_16px_hidpi.png
new file mode 100644
index 0000000..22f2e3d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/description_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/disconnect_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/disconnect_16px_hidpi.png
new file mode 100644
index 0000000..5b37a09
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/disconnect_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/diskimage_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/diskimage_16px_hidpi.png
new file mode 100644
index 0000000..0aeba53
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/diskimage_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/diskimage_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/diskimage_32px_hidpi.png
new file mode 100644
index 0000000..4610bb0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/diskimage_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/display_hardware_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/display_hardware_16px_hidpi.png
new file mode 100644
index 0000000..9d394f8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/display_hardware_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/display_hardware_write_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/display_hardware_write_16px_hidpi.png
new file mode 100644
index 0000000..5cadd01
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/display_hardware_write_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/display_software_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/display_software_16px_hidpi.png
new file mode 100644
index 0000000..2b3951a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/display_software_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/drag_drop_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/drag_drop_16px_hidpi.png
new file mode 100644
index 0000000..50f3af5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/drag_drop_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/drag_drop_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/drag_drop_disabled_16px_hidpi.png
new file mode 100644
index 0000000..0c210c8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/drag_drop_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_16px_hidpi.png
new file mode 100644
index 0000000..414c75d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_22px_hidpi.png
new file mode 100644
index 0000000..7606e44
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..4f01143
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_disabled_22px_hidpi.png
new file mode 100644
index 0000000..bf31fe4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_add_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_16px_hidpi.png
new file mode 100644
index 0000000..3e52cb8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_22px_hidpi.png
new file mode 100644
index 0000000..d388e8c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_disabled_16px_hidpi.png
new file mode 100644
index 0000000..bcc9802
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_disabled_22px_hidpi.png
new file mode 100644
index 0000000..03ba4da
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_load_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_16px_hidpi.png
new file mode 100644
index 0000000..f62a9a3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_22px_hidpi.png
new file mode 100644
index 0000000..668982e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..0820b08
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_disabled_22px_hidpi.png
new file mode 100644
index 0000000..3a37c7f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_remove_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_16px_hidpi.png
new file mode 100644
index 0000000..9e3a281
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_22px_hidpi.png
new file mode 100644
index 0000000..da4ae65
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_disabled_16px_hidpi.png
new file mode 100644
index 0000000..644f4ac
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_disabled_22px_hidpi.png
new file mode 100644
index 0000000..e832a25
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edata_save_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edataglobal_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edataglobal_32px_hidpi.png
new file mode 100644
index 0000000..216a718
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edataglobal_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edataman_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edataman_16px_hidpi.png
new file mode 100644
index 0000000..9fb6d2c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edataman_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/edataman_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/edataman_32px_hidpi.png
new file mode 100644
index 0000000..a6bf4e0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/edataman_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/eraser_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/eraser_16px_hidpi.png
new file mode 100644
index 0000000..e3eb13b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/eraser_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/exit_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/exit_16px_hidpi.png
new file mode 100644
index 0000000..3329134
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/exit_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/expanding_collapsing_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/expanding_collapsing_16px_hidpi.png
new file mode 100644
index 0000000..f606be8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/expanding_collapsing_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/export_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/export_16px_hidpi.png
new file mode 100644
index 0000000..5f7c924
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/export_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_16px_hidpi.png
new file mode 100644
index 0000000..a30177d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_24px_hidpi.png
new file mode 100644
index 0000000..33072ca
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_32px_hidpi.png
new file mode 100644
index 0000000..44d796d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_install_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_install_16px_hidpi.png
new file mode 100644
index 0000000..41d8785
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_install_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_install_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_install_disabled_16px_hidpi.png
new file mode 100644
index 0000000..fdde6ba
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_install_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_uninstall_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_uninstall_16px_hidpi.png
new file mode 100644
index 0000000..6b9fc97
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_uninstall_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_uninstall_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_uninstall_disabled_16px_hidpi.png
new file mode 100644
index 0000000..35845d3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_uninstall_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_warning_16px_hidpi.png
new file mode 100644
index 0000000..dbd5a9e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/extension_pack_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_16px_hidpi.png
new file mode 100644
index 0000000..cb4a5b3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_add_16px_hidpi.png
new file mode 100644
index 0000000..78c5cb6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..3b785bb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_16px_hidpi.png
new file mode 100644
index 0000000..102f4cb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_22px_hidpi.png
new file mode 100644
index 0000000..022f952
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_disabled_16px_hidpi.png
new file mode 100644
index 0000000..68c3a9b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_disabled_22px_hidpi.png
new file mode 100644
index 0000000..424b8c0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_copy_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_disabled_16px_hidpi.png
new file mode 100644
index 0000000..b6d6fcc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_16px_hidpi.png
new file mode 100644
index 0000000..370f732
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_22px_hidpi.png
new file mode 100644
index 0000000..d5853b0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f413576
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_disabled_22px_hidpi.png
new file mode 100644
index 0000000..2440940
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_modify_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_read_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_read_16px_hidpi.png
new file mode 100644
index 0000000..1eae924
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_read_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_16px_hidpi.png
new file mode 100644
index 0000000..e21fa45
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_22px_hidpi.png
new file mode 100644
index 0000000..aa4719d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_disabled_16px_hidpi.png
new file mode 100644
index 0000000..1d4b05f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_disabled_22px_hidpi.png
new file mode 100644
index 0000000..8df20a0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_release_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_16px_hidpi.png
new file mode 100644
index 0000000..b116a85
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_22px_hidpi.png
new file mode 100644
index 0000000..134f97c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..a4251ae
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_disabled_22px_hidpi.png
new file mode 100644
index 0000000..c1533bb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_remove_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_unmount_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_unmount_16px_hidpi.png
new file mode 100644
index 0000000..789f015
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_unmount_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_unmount_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_unmount_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f2ba64b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_unmount_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fd_write_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_write_16px_hidpi.png
new file mode 100644
index 0000000..364545c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fd_write_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_16px_hidpi.png
new file mode 100644
index 0000000..4c33b6c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_add_16px_hidpi.png
new file mode 100644
index 0000000..45ee551
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..9c5eaea
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_collapse_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_collapse_16px_hidpi.png
new file mode 100644
index 0000000..81d9a0e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_collapse_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_expand_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_expand_16px_hidpi.png
new file mode 100644
index 0000000..0f6f7fe
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/floppy_expand_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_16px_hidpi.png
new file mode 100644
index 0000000..fc64ac2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_disabled_16px_hidpi.png
new file mode 100644
index 0000000..d597311
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_on_16px_hidpi.png
new file mode 100644
index 0000000..bc77ad7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..cf49b52
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/fullscreen_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/global_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/global_settings_16px_hidpi.png
new file mode 100644
index 0000000..9e296b9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/global_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/group_abstract_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/group_abstract_16px_hidpi.png
new file mode 100644
index 0000000..207dfbb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/group_abstract_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/guesttools_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/guesttools_16px_hidpi.png
new file mode 100644
index 0000000..768ee0b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/guesttools_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/guesttools_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/guesttools_disabled_16px_hidpi.png
new file mode 100644
index 0000000..162832b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/guesttools_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_16px_hidpi.png
new file mode 100644
index 0000000..f0ef762
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_24px_hidpi.png
new file mode 100644
index 0000000..8203b0b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_32px_hidpi.png
new file mode 100644
index 0000000..3a4ff7e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_add_16px_hidpi.png
new file mode 100644
index 0000000..f3a9707
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..8e889fa
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_16px_hidpi.png
new file mode 100644
index 0000000..7e7358f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_22px_hidpi.png
new file mode 100644
index 0000000..944834e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_disabled_16px_hidpi.png
new file mode 100644
index 0000000..35b6247
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_disabled_22px_hidpi.png
new file mode 100644
index 0000000..b6403e5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_copy_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f5a1300
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_16px_hidpi.png
new file mode 100644
index 0000000..3b5c7f8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_22px_hidpi.png
new file mode 100644
index 0000000..f453ee4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_disabled_16px_hidpi.png
new file mode 100644
index 0000000..b7a79f6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_disabled_22px_hidpi.png
new file mode 100644
index 0000000..6821fbf
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_modify_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_new_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_new_16px_hidpi.png
new file mode 100644
index 0000000..af6f8cc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_new_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_new_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_new_disabled_16px_hidpi.png
new file mode 100644
index 0000000..8013c4b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_new_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_read_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_read_16px_hidpi.png
new file mode 100644
index 0000000..b36afe0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_read_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_16px_hidpi.png
new file mode 100644
index 0000000..d372a75
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_22px_hidpi.png
new file mode 100644
index 0000000..9ea7b22
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_disabled_16px_hidpi.png
new file mode 100644
index 0000000..69c1e53
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_disabled_22px_hidpi.png
new file mode 100644
index 0000000..888d663
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_release_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_16px_hidpi.png
new file mode 100644
index 0000000..e559e7b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_22px_hidpi.png
new file mode 100644
index 0000000..c154ebf
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..1d47fa9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_disabled_22px_hidpi.png
new file mode 100644
index 0000000..5915b25
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_remove_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_settings_16px_hidpi.png
new file mode 100644
index 0000000..56ba580
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_settings_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_settings_disabled_16px_hidpi.png
new file mode 100644
index 0000000..02da8d5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_settings_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_warning_16px_hidpi.png
new file mode 100644
index 0000000..a59dd99
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hd_write_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_write_16px_hidpi.png
new file mode 100644
index 0000000..67e9149
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hd_write_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/help_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/help_16px_hidpi.png
new file mode 100644
index 0000000..1cfcffc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/help_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/help_button_normal_mac_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/help_button_normal_mac_22px_hidpi.png
new file mode 100644
index 0000000..a1baf81
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/help_button_normal_mac_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/help_button_pressed_mac_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/help_button_pressed_mac_22px_hidpi.png
new file mode 100644
index 0000000..2740d85
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/help_button_pressed_mac_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_16px_hidpi.png
new file mode 100644
index 0000000..7a0dc2d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_24px_hidpi.png
new file mode 100644
index 0000000..a74a88d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_32px_hidpi.png
new file mode 100644
index 0000000..63b0f4c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_captured_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_captured_16px_hidpi.png
new file mode 100644
index 0000000..04311bd
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_captured_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_captured_pressed_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_captured_pressed_16px_hidpi.png
new file mode 100644
index 0000000..5bb57db
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_captured_pressed_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_disabled_16px_hidpi.png
new file mode 100644
index 0000000..a469af6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_pressed_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_pressed_16px_hidpi.png
new file mode 100644
index 0000000..7c30d75
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_pressed_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_warning_16px_hidpi.png
new file mode 100644
index 0000000..ec688db
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/hostkey_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/ide_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_16px_hidpi.png
new file mode 100644
index 0000000..f2c110d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/ide_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_add_16px_hidpi.png
new file mode 100644
index 0000000..9feeb7e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/ide_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..08942b7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/ide_collapse_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_collapse_16px_hidpi.png
new file mode 100644
index 0000000..2e9b512
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_collapse_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/ide_expand_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_expand_16px_hidpi.png
new file mode 100644
index 0000000..c184d6f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/ide_expand_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/import_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/import_16px_hidpi.png
new file mode 100644
index 0000000..58c2929
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/import_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/interface_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/interface_16px_hidpi.png
new file mode 100644
index 0000000..8ffd697
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/interface_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/interface_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/interface_24px_hidpi.png
new file mode 100644
index 0000000..1a465e4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/interface_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/interface_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/interface_32px_hidpi.png
new file mode 100644
index 0000000..f94e4b6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/interface_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/interface_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/interface_warning_16px_hidpi.png
new file mode 100644
index 0000000..b19122f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/interface_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_16px_hidpi.png
new file mode 100644
index 0000000..c015ae9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_24px_hidpi.png
new file mode 100644
index 0000000..a95e26f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_32px_hidpi.png
new file mode 100644
index 0000000..fa14992
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_settings_16px_hidpi.png
new file mode 100644
index 0000000..bed81ee
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_settings_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_settings_disabled_16px_hidpi.png
new file mode 100644
index 0000000..797c26d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/keyboard_settings_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/list_movedown_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/list_movedown_16px_hidpi.png
new file mode 100644
index 0000000..5e5a715
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/list_movedown_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/list_movedown_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/list_movedown_disabled_16px_hidpi.png
new file mode 100644
index 0000000..145d4fe
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/list_movedown_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/list_moveup_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/list_moveup_16px_hidpi.png
new file mode 100644
index 0000000..7baee8d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/list_moveup_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/list_moveup_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/list_moveup_disabled_16px_hidpi.png
new file mode 100644
index 0000000..8a8becc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/list_moveup_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/machine_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_16px_hidpi.png
new file mode 100644
index 0000000..9a4f2ff
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/machine_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_24px_hidpi.png
new file mode 100644
index 0000000..49147bb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/machine_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_32px_hidpi.png
new file mode 100644
index 0000000..5b09c19
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/machine_abstract_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_abstract_16px_hidpi.png
new file mode 100644
index 0000000..0aa7859
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_abstract_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/machine_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_warning_16px_hidpi.png
new file mode 100644
index 0000000..7003f94
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/machine_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/meditation_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/meditation_32px_hidpi.png
new file mode 100644
index 0000000..37a85b1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/meditation_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/menubar_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/menubar_on_16px_hidpi.png
new file mode 100644
index 0000000..cd9a6ad
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/menubar_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/menubar_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/menubar_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..00c11a6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/menubar_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/minimize_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/minimize_16px_hidpi.png
new file mode 100644
index 0000000..064aa45
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/minimize_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_16px_hidpi.png
new file mode 100644
index 0000000..7bcaec7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_16px_hidpi.png
new file mode 100644
index 0000000..ba2510c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_disabled_16px_hidpi.png
new file mode 100644
index 0000000..441495f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_on_16px_hidpi.png
new file mode 100644
index 0000000..4ff8b24
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..ac62ede
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_uncaptured_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_uncaptured_16px_hidpi.png
new file mode 100644
index 0000000..dd0183c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_can_seamless_uncaptured_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_disabled_16px_hidpi.png
new file mode 100644
index 0000000..70bb29f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_seamless_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_seamless_16px_hidpi.png
new file mode 100644
index 0000000..2449fb4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/mouse_seamless_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/movie_reel_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/movie_reel_16px_hidpi.png
new file mode 100644
index 0000000..2dd1223
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/movie_reel_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/name_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/name_16px_hidpi.png
new file mode 100644
index 0000000..bb9f889
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/name_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/next_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/next_16px_hidpi.png
new file mode 100644
index 0000000..bf630f9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/next_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_16px_hidpi.png
new file mode 100644
index 0000000..2dc48ae
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_24px_hidpi.png
new file mode 100644
index 0000000..0ce6930
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_32px_hidpi.png
new file mode 100644
index 0000000..67d7540
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_disabled_16px_hidpi.png
new file mode 100644
index 0000000..5de1d1d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_disconnected_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_disconnected_16px_hidpi.png
new file mode 100644
index 0000000..036c284
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_disconnected_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_error_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_error_16px_hidpi.png
new file mode 100644
index 0000000..04eef65
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_error_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_loading_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_loading_16px_hidpi.png
new file mode 100644
index 0000000..53c461a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_loading_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_read_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_read_16px_hidpi.png
new file mode 100644
index 0000000..1f6c02d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_read_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_settings_16px_hidpi.png
new file mode 100644
index 0000000..3c1480c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_settings_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_settings_disabled_16px_hidpi.png
new file mode 100644
index 0000000..7d752b9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_settings_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_warning_16px_hidpi.png
new file mode 100644
index 0000000..2a1a57e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/nw_write_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_write_16px_hidpi.png
new file mode 100644
index 0000000..414db21
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/nw_write_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/ok_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/ok_16px_hidpi.png
new file mode 100644
index 0000000..e41323d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/ok_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_archlinux_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_archlinux_64_hidpi.png
new file mode 100644
index 0000000..837eb9f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_archlinux_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_archlinux_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_archlinux_hidpi.png
new file mode 100644
index 0000000..184aece
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_archlinux_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_debian_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_debian_64_hidpi.png
new file mode 100644
index 0000000..25bb210
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_debian_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_debian_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_debian_hidpi.png
new file mode 100644
index 0000000..689442a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_debian_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_dos_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_dos_hidpi.png
new file mode 100644
index 0000000..a5ea503
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_dos_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_fedora_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_fedora_64_hidpi.png
new file mode 100644
index 0000000..c6e73b2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_fedora_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_fedora_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_fedora_hidpi.png
new file mode 100644
index 0000000..8a0d810
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_fedora_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_freebsd_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_freebsd_64_hidpi.png
new file mode 100644
index 0000000..8c1cced
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_freebsd_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_freebsd_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_freebsd_hidpi.png
new file mode 100644
index 0000000..0d8648f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_freebsd_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_freedos_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_freedos_hidpi.png
new file mode 100644
index 0000000..4006b4f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_freedos_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_gentoo_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_gentoo_64_hidpi.png
new file mode 100644
index 0000000..d2c714a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_gentoo_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_gentoo_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_gentoo_hidpi.png
new file mode 100644
index 0000000..6f6881d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_gentoo_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_jrockitve_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_jrockitve_hidpi.png
new file mode 100644
index 0000000..87b5d76
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_jrockitve_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_l4_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_l4_hidpi.png
new file mode 100644
index 0000000..288cde6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_l4_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux22_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux22_hidpi.png
new file mode 100644
index 0000000..858e4dc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux22_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux24_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux24_64_hidpi.png
new file mode 100644
index 0000000..64e9ce1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux24_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux24_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux24_hidpi.png
new file mode 100644
index 0000000..0114852
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux24_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux26_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux26_64_hidpi.png
new file mode 100644
index 0000000..ca95001
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux26_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux26_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux26_hidpi.png
new file mode 100644
index 0000000..59151ae
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux26_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux_hidpi.png
new file mode 100644
index 0000000..f5b95d7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux_other_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux_other_hidpi.png
new file mode 100644
index 0000000..d236836
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_linux_other_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_macosx_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_macosx_64_hidpi.png
new file mode 100644
index 0000000..f0873bb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_macosx_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_macosx_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_macosx_hidpi.png
new file mode 100644
index 0000000..7bfc650
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_macosx_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_mandriva_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_mandriva_64_hidpi.png
new file mode 100644
index 0000000..19c5520
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_mandriva_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_mandriva_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_mandriva_hidpi.png
new file mode 100644
index 0000000..c37949d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_mandriva_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_mint_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_mint_64_hidpi.png
new file mode 100644
index 0000000..7930a92
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_mint_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_mint_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_mint_hidpi.png
new file mode 100644
index 0000000..1013ce5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_mint_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_netbsd_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_netbsd_64_hidpi.png
new file mode 100644
index 0000000..3097059
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_netbsd_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_netbsd_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_netbsd_hidpi.png
new file mode 100644
index 0000000..1ce33c7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_netbsd_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_netware_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_netware_hidpi.png
new file mode 100644
index 0000000..9387c67
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_netware_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_openbsd_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_openbsd_64_hidpi.png
new file mode 100644
index 0000000..0fb6084
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_openbsd_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_openbsd_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_openbsd_hidpi.png
new file mode 100644
index 0000000..68dac68
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_openbsd_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_opensuse_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_opensuse_64_hidpi.png
new file mode 100644
index 0000000..1fe6ab7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_opensuse_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_opensuse_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_opensuse_hidpi.png
new file mode 100644
index 0000000..ab4bb5c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_opensuse_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_oracle_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_oracle_64_hidpi.png
new file mode 100644
index 0000000..9d3a0f8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_oracle_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_oracle_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_oracle_hidpi.png
new file mode 100644
index 0000000..c43db5e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_oracle_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_oraclesolaris_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_oraclesolaris_64_hidpi.png
new file mode 100644
index 0000000..a512c08
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_oraclesolaris_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_oraclesolaris_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_oraclesolaris_hidpi.png
new file mode 100644
index 0000000..a3e83ea
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_oraclesolaris_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2_other_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2_other_hidpi.png
new file mode 100644
index 0000000..9f97a6e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2_other_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2ecs_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2ecs_hidpi.png
new file mode 100644
index 0000000..9a1023e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2ecs_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp3_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp3_hidpi.png
new file mode 100644
index 0000000..a960293
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp3_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp45_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp45_hidpi.png
new file mode 100644
index 0000000..688fed0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp45_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp4_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp4_hidpi.png
new file mode 100644
index 0000000..5cea863
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_os2warp4_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_other_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_other_64_hidpi.png
new file mode 100644
index 0000000..d865ea7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_other_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_other_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_other_hidpi.png
new file mode 100644
index 0000000..dd03c18
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_other_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_qnx_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_qnx_hidpi.png
new file mode 100644
index 0000000..b7c99e9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_qnx_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_redhat_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_redhat_64_hidpi.png
new file mode 100644
index 0000000..63d9dbf
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_redhat_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_redhat_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_redhat_hidpi.png
new file mode 100644
index 0000000..0b2681f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_redhat_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_solaris_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_solaris_64_hidpi.png
new file mode 100644
index 0000000..e4a84c0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_solaris_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_solaris_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_solaris_hidpi.png
new file mode 100644
index 0000000..d89a2fa
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_solaris_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_turbolinux_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_turbolinux_64_hidpi.png
new file mode 100644
index 0000000..88deb09
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_turbolinux_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_turbolinux_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_turbolinux_hidpi.png
new file mode 100644
index 0000000..2aa103e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_turbolinux_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_ubuntu_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_ubuntu_64_hidpi.png
new file mode 100644
index 0000000..aef91a2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_ubuntu_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_ubuntu_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_ubuntu_hidpi.png
new file mode 100644
index 0000000..ab01a24
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_ubuntu_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win10_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win10_64_hidpi.png
new file mode 100644
index 0000000..6f7f6a8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win10_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win10_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win10_hidpi.png
new file mode 100644
index 0000000..9b57691
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win10_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k12_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k12_64_hidpi.png
new file mode 100644
index 0000000..8c40917
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k12_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k3_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k3_64_hidpi.png
new file mode 100644
index 0000000..882a7fa
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k3_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k3_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k3_hidpi.png
new file mode 100644
index 0000000..eaac0fc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k3_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k8_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k8_64_hidpi.png
new file mode 100644
index 0000000..f5d0945
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k8_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k8_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k8_hidpi.png
new file mode 100644
index 0000000..8418ef6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k8_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k_hidpi.png
new file mode 100644
index 0000000..cae22f5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win2k_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win31_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win31_hidpi.png
new file mode 100644
index 0000000..6ef0a80
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win31_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win7_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win7_64_hidpi.png
new file mode 100644
index 0000000..488b080
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win7_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win7_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win7_hidpi.png
new file mode 100644
index 0000000..e7c6648
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win7_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win81_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win81_64_hidpi.png
new file mode 100644
index 0000000..33c3c6b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win81_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win81_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win81_hidpi.png
new file mode 100644
index 0000000..4d1c35d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win81_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win8_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win8_64_hidpi.png
new file mode 100644
index 0000000..ff5c2b2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win8_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win8_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win8_hidpi.png
new file mode 100644
index 0000000..909a9ec
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win8_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win95_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win95_hidpi.png
new file mode 100644
index 0000000..2118c67
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win95_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win98_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win98_hidpi.png
new file mode 100644
index 0000000..fa07047
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win98_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_win_other_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win_other_hidpi.png
new file mode 100644
index 0000000..11c6ea2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_win_other_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_winme_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winme_hidpi.png
new file mode 100644
index 0000000..2186f7f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winme_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_winnt4_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winnt4_hidpi.png
new file mode 100644
index 0000000..9ca78be
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winnt4_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_winvista_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winvista_64_hidpi.png
new file mode 100644
index 0000000..b3f68d4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winvista_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_winvista_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winvista_hidpi.png
new file mode 100644
index 0000000..268d90a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winvista_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_winxp_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winxp_64_hidpi.png
new file mode 100644
index 0000000..54f6340
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winxp_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_winxp_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winxp_hidpi.png
new file mode 100644
index 0000000..100735d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_winxp_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_xandros_64_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_xandros_64_hidpi.png
new file mode 100644
index 0000000..b3c89f0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_xandros_64_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/os_xandros_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/os_xandros_hidpi.png
new file mode 100644
index 0000000..5ba9605
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/os_xandros_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_16px_hidpi.png
new file mode 100644
index 0000000..94f0563
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_24px_hidpi.png
new file mode 100644
index 0000000..dc9cd76
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_32px_hidpi.png
new file mode 100644
index 0000000..fa6767f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_warning_16px_hidpi.png
new file mode 100644
index 0000000..f4af63f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/parallel_port_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/pin_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/pin_16px_hidpi.png
new file mode 100644
index 0000000..6d4e4b8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/pin_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_16to10_242x167px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_16to10_242x167px_hidpi.png
new file mode 100644
index 0000000..e47bb9e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_16to10_242x167px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_16to9_242x155px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_16to9_242x155px_hidpi.png
new file mode 100644
index 0000000..bcb2d03
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_16to9_242x155px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_4to3_242x192px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_4to3_242x192px_hidpi.png
new file mode 100644
index 0000000..c08e513
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_empty_4to3_242x192px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_16to10_242x167px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_16to10_242x167px_hidpi.png
new file mode 100644
index 0000000..13f87fd
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_16to10_242x167px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_16to9_242x155px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_16to9_242x155px_hidpi.png
new file mode 100644
index 0000000..1edfb95
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_16to9_242x155px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_4to3_242x192px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_4to3_242x192px_hidpi.png
new file mode 100644
index 0000000..da705d9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/preview_full_4to3_242x192px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/previous_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/previous_16px_hidpi.png
new file mode 100644
index 0000000..6d58594
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/previous_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_clone_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_clone_90px_hidpi.png
new file mode 100644
index 0000000..d3bb825
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_clone_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_delete_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_delete_90px_hidpi.png
new file mode 100644
index 0000000..b968268
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_delete_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_dnd_gh_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_dnd_gh_90px_hidpi.png
new file mode 100644
index 0000000..d15f1c0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_dnd_gh_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_dnd_hg_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_dnd_hg_90px_hidpi.png
new file mode 100644
index 0000000..383e51d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_dnd_hg_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_export_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_export_90px_hidpi.png
new file mode 100644
index 0000000..20c4ad3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_export_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_import_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_import_90px_hidpi.png
new file mode 100644
index 0000000..8d68808
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_import_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_install_guest_additions_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_install_guest_additions_90px_hidpi.png
new file mode 100644
index 0000000..1d7a4e7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_install_guest_additions_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_media_create_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_media_create_90px_hidpi.png
new file mode 100644
index 0000000..ec7171b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_media_create_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_media_delete_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_media_delete_90px_hidpi.png
new file mode 100644
index 0000000..092c324
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_media_delete_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_network_interface_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_network_interface_90px_hidpi.png
new file mode 100644
index 0000000..a7f2ece
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_network_interface_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_poweroff_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_poweroff_90px_hidpi.png
new file mode 100644
index 0000000..798b33a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_poweroff_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_reading_appliance_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_reading_appliance_90px_hidpi.png
new file mode 100644
index 0000000..f80b8b9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_reading_appliance_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_refresh_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_refresh_90px_hidpi.png
new file mode 100644
index 0000000..2499fb2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_refresh_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_settings_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_settings_90px_hidpi.png
new file mode 100644
index 0000000..0e6a36d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_settings_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_create_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_create_90px_hidpi.png
new file mode 100644
index 0000000..2c6a59a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_create_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_discard_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_discard_90px_hidpi.png
new file mode 100644
index 0000000..52bf30e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_discard_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_restore_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_restore_90px_hidpi.png
new file mode 100644
index 0000000..3bfd687
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_snapshot_restore_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_start_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_start_90px_hidpi.png
new file mode 100644
index 0000000..8d06b45
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_start_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_state_restore_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_state_restore_90px_hidpi.png
new file mode 100644
index 0000000..6787a7f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_state_restore_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/progress_state_save_90px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_state_save_90px_hidpi.png
new file mode 100644
index 0000000..fcdacb2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/progress_state_save_90px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_16px_hidpi.png
new file mode 100644
index 0000000..09a7f11
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_24px_hidpi.png
new file mode 100644
index 0000000..64deadb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_32px_hidpi.png
new file mode 100644
index 0000000..d41542d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_warning_16px_hidpi.png
new file mode 100644
index 0000000..5775d94
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/proxy_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/ram_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/ram_16px_hidpi.png
new file mode 100644
index 0000000..0e4e20d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/ram_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_16px_hidpi.png
new file mode 100644
index 0000000..25f9933
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_22px_hidpi.png
new file mode 100644
index 0000000..7ef7c01
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_24px_hidpi.png
new file mode 100644
index 0000000..84916a3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_32px_hidpi.png
new file mode 100644
index 0000000..857b63d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_16px_hidpi.png
new file mode 100644
index 0000000..0597f24
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_22px_hidpi.png
new file mode 100644
index 0000000..9959949
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_32px_hidpi.png
new file mode 100644
index 0000000..bcfa5fc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_disabled_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_warning_16px_hidpi.png
new file mode 100644
index 0000000..1075701
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/refresh_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/remove_host_iface_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/remove_host_iface_16px_hidpi.png
new file mode 100644
index 0000000..55b602c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/remove_host_iface_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/remove_host_iface_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/remove_host_iface_disabled_16px_hidpi.png
new file mode 100644
index 0000000..bcea174
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/remove_host_iface_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/reset_warnings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/reset_warnings_16px_hidpi.png
new file mode 100644
index 0000000..acd3f1c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/reset_warnings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/restore_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/restore_16px_hidpi.png
new file mode 100644
index 0000000..8e078d5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/restore_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sata_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_16px_hidpi.png
new file mode 100644
index 0000000..e04af85
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sata_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_add_16px_hidpi.png
new file mode 100644
index 0000000..7f90528
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sata_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..19c85db
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sata_collapse_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_collapse_16px_hidpi.png
new file mode 100644
index 0000000..ae8bab6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_collapse_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sata_expand_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_expand_16px_hidpi.png
new file mode 100644
index 0000000..bea450d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sata_expand_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scale_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_16px_hidpi.png
new file mode 100644
index 0000000..ebcbdaa
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scale_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f049bd2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scale_factor_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_factor_16px_hidpi.png
new file mode 100644
index 0000000..6ae2a27
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_factor_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scale_factor_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_factor_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f160c55
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_factor_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scale_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_on_16px_hidpi.png
new file mode 100644
index 0000000..0b5b1ca
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scale_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f74b15e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scale_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/screenshot_take_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/screenshot_take_16px_hidpi.png
new file mode 100644
index 0000000..f3438bb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/screenshot_take_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/screenshot_take_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/screenshot_take_disabled_16px_hidpi.png
new file mode 100644
index 0000000..b08a1d7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/screenshot_take_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_16px_hidpi.png
new file mode 100644
index 0000000..9abba05
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_add_16px_hidpi.png
new file mode 100644
index 0000000..b079aa8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..67f9745
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_collapse_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_collapse_16px_hidpi.png
new file mode 100644
index 0000000..1a9e492
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_collapse_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_expand_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_expand_16px_hidpi.png
new file mode 100644
index 0000000..efb9502
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/scsi_expand_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_16px_hidpi.png
new file mode 100644
index 0000000..b98a04a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_disabled_16px_hidpi.png
new file mode 100644
index 0000000..0347568
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_on_16px_hidpi.png
new file mode 100644
index 0000000..4339a40
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..6904d6f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/seamless_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/select_file_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/select_file_16px_hidpi.png
new file mode 100644
index 0000000..adcc943
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/select_file_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/select_file_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/select_file_disabled_16px_hidpi.png
new file mode 100644
index 0000000..1ff5350
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/select_file_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_16px_hidpi.png
new file mode 100644
index 0000000..42390c6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_24px_hidpi.png
new file mode 100644
index 0000000..27fe0d2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_32px_hidpi.png
new file mode 100644
index 0000000..05d1553
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_warning_16px_hidpi.png
new file mode 100644
index 0000000..4aceedd
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/serial_port_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_16px_hidpi.png
new file mode 100644
index 0000000..749ac0d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_32px_hidpi.png
new file mode 100644
index 0000000..ac02fd7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_details_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_details_16px_hidpi.png
new file mode 100644
index 0000000..9e8fa5a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_details_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_disabled_16px_hidpi.png
new file mode 100644
index 0000000..add044a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_runtime_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_runtime_16px_hidpi.png
new file mode 100644
index 0000000..a75ab2b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/session_info_runtime_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_16px_hidpi.png
new file mode 100644
index 0000000..b3713b6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_24px_hidpi.png
new file mode 100644
index 0000000..6c3792b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_32px_hidpi.png
new file mode 100644
index 0000000..503ed81
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_add_16px_hidpi.png
new file mode 100644
index 0000000..c62183e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..2f13afc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f6f9826
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_edit_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_edit_16px_hidpi.png
new file mode 100644
index 0000000..cdeaebb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_edit_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_edit_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_edit_disabled_16px_hidpi.png
new file mode 100644
index 0000000..ff3e257
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_edit_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_read_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_read_16px_hidpi.png
new file mode 100644
index 0000000..a897d90
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_read_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_remove_16px_hidpi.png
new file mode 100644
index 0000000..6c0cd8f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..070ccba
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_settings_16px_hidpi.png
new file mode 100644
index 0000000..49fc8c3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_settings_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_settings_disabled_16px_hidpi.png
new file mode 100644
index 0000000..545cd78
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_settings_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_warning_16px_hidpi.png
new file mode 100644
index 0000000..d586245
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sf_write_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_write_16px_hidpi.png
new file mode 100644
index 0000000..bcbdd69
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sf_write_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/shared_clipboard_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/shared_clipboard_16px_hidpi.png
new file mode 100644
index 0000000..0cacf53
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/shared_clipboard_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/shared_clipboard_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/shared_clipboard_disabled_16px_hidpi.png
new file mode 100644
index 0000000..a0dd867
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/shared_clipboard_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/site_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/site_16px_hidpi.png
new file mode 100644
index 0000000..12cfd8c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/site_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/site_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/site_24px_hidpi.png
new file mode 100644
index 0000000..5fce193
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/site_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/site_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/site_32px_hidpi.png
new file mode 100644
index 0000000..3d5bdb2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/site_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/site_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/site_warning_16px_hidpi.png
new file mode 100644
index 0000000..420240c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/site_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_16px_hidpi.png
new file mode 100644
index 0000000..33c5e99
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_22px_hidpi.png
new file mode 100644
index 0000000..33e9e4f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_disabled_16px_hidpi.png
new file mode 100644
index 0000000..ddc39cf
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_disabled_22px_hidpi.png
new file mode 100644
index 0000000..95188c0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_delete_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_offline_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_offline_16px_hidpi.png
new file mode 100644
index 0000000..80dd89e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_offline_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_online_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_online_16px_hidpi.png
new file mode 100644
index 0000000..b177fa9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_online_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_16px_hidpi.png
new file mode 100644
index 0000000..f447a73
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_22px_hidpi.png
new file mode 100644
index 0000000..276c0fb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_disabled_16px_hidpi.png
new file mode 100644
index 0000000..54272ca
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_disabled_22px_hidpi.png
new file mode 100644
index 0000000..13681ac
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_restore_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_16px_hidpi.png
new file mode 100644
index 0000000..3b0f0c5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_22px_hidpi.png
new file mode 100644
index 0000000..355086c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_disabled_16px_hidpi.png
new file mode 100644
index 0000000..98606d3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_disabled_22px_hidpi.png
new file mode 100644
index 0000000..227b332
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_show_details_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_16px_hidpi.png
new file mode 100644
index 0000000..f25214d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_22px_hidpi.png
new file mode 100644
index 0000000..2d3b3d3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_disabled_16px_hidpi.png
new file mode 100644
index 0000000..be40961
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_disabled_22px_hidpi.png
new file mode 100644
index 0000000..beace10
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/snapshot_take_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sort_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sort_16px_hidpi.png
new file mode 100644
index 0000000..b821384
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sort_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sort_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sort_disabled_16px_hidpi.png
new file mode 100644
index 0000000..689a897
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sort_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sound_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sound_16px_hidpi.png
new file mode 100644
index 0000000..24d6879
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sound_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sound_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sound_24px_hidpi.png
new file mode 100644
index 0000000..ecfa334
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sound_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sound_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sound_32px_hidpi.png
new file mode 100644
index 0000000..7c05ab1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sound_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/sound_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/sound_warning_16px_hidpi.png
new file mode 100644
index 0000000..d4dafe4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/sound_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_aborted_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_aborted_16px_hidpi.png
new file mode 100644
index 0000000..3a24664
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_aborted_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_discarding_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_discarding_16px_hidpi.png
new file mode 100644
index 0000000..036b5f8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_discarding_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_paused_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_paused_16px_hidpi.png
new file mode 100644
index 0000000..0e26ce9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_paused_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_powered_off_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_powered_off_16px_hidpi.png
new file mode 100644
index 0000000..fa3d404
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_powered_off_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_restoring_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_restoring_16px_hidpi.png
new file mode 100644
index 0000000..4030185
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_restoring_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_running_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_running_16px_hidpi.png
new file mode 100644
index 0000000..f9582c6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_running_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_saved_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_saved_16px_hidpi.png
new file mode 100644
index 0000000..3817835
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_saved_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_saving_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_saving_16px_hidpi.png
new file mode 100644
index 0000000..2048676
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_saving_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/state_stuck_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/state_stuck_16px_hidpi.png
new file mode 100644
index 0000000..f95c73c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/state_stuck_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/status_check_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/status_check_16px_hidpi.png
new file mode 100644
index 0000000..347a470
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/status_check_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/status_error_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/status_error_16px_hidpi.png
new file mode 100644
index 0000000..9b95d4c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/status_error_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_16px_hidpi.png
new file mode 100644
index 0000000..c5a5915
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_disabled_16px_hidpi.png
new file mode 100644
index 0000000..35882e6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_on_16px_hidpi.png
new file mode 100644
index 0000000..2a948a9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..8cdee8a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_settings_16px_hidpi.png
new file mode 100644
index 0000000..0bf0ab0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_settings_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_settings_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f352b4c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/statusbar_settings_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_16px_hidpi.png
new file mode 100644
index 0000000..95ad37d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_24px_hidpi.png
new file mode 100644
index 0000000..95a968c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_32px_hidpi.png
new file mode 100644
index 0000000..31ea36a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_add_16px_hidpi.png
new file mode 100644
index 0000000..7148580
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_add_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_add_disabled_16px_hidpi.png
new file mode 100644
index 0000000..f46cb41
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_add_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_collapse_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_collapse_16px_hidpi.png
new file mode 100644
index 0000000..b09bfbe
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_collapse_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_disabled_16px_hidpi.png
new file mode 100644
index 0000000..3abe54f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_expand_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_expand_16px_hidpi.png
new file mode 100644
index 0000000..b1ed763
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_expand_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_filter_edit_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_filter_edit_16px_hidpi.png
new file mode 100644
index 0000000..07d7b82
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_filter_edit_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_filter_edit_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_filter_edit_disabled_16px_hidpi.png
new file mode 100644
index 0000000..b209015
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_filter_edit_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_movedown_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_movedown_16px_hidpi.png
new file mode 100644
index 0000000..4c95956
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_movedown_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_movedown_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_movedown_disabled_16px_hidpi.png
new file mode 100644
index 0000000..8814bed
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_movedown_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_moveup_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_moveup_16px_hidpi.png
new file mode 100644
index 0000000..0c7fc77
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_moveup_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_moveup_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_moveup_disabled_16px_hidpi.png
new file mode 100644
index 0000000..a5f9208
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_moveup_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_new_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_new_16px_hidpi.png
new file mode 100644
index 0000000..5a06a57
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_new_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_new_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_new_disabled_16px_hidpi.png
new file mode 100644
index 0000000..e3285a6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_new_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_read_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_read_16px_hidpi.png
new file mode 100644
index 0000000..0845538
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_read_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_remove_16px_hidpi.png
new file mode 100644
index 0000000..806fb26
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..3d4c948
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_settings_16px_hidpi.png
new file mode 100644
index 0000000..5c232c6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_settings_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_settings_disabled_16px_hidpi.png
new file mode 100644
index 0000000..67c917a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_settings_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_unavailable_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_unavailable_16px_hidpi.png
new file mode 100644
index 0000000..82e30c5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_unavailable_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_unavailable_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_unavailable_disabled_16px_hidpi.png
new file mode 100644
index 0000000..e5bc4e7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_unavailable_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_warning_16px_hidpi.png
new file mode 100644
index 0000000..441e80f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/usb_write_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_write_16px_hidpi.png
new file mode 100644
index 0000000..959fc2c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/usb_write_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_16px_hidpi.png
new file mode 100644
index 0000000..9898338
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_disabled_16px_hidpi.png
new file mode 100644
index 0000000..af8715e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_on_16px_hidpi.png
new file mode 100644
index 0000000..9ccc1b5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..153829d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_settings_16px_hidpi.png
new file mode 100644
index 0000000..9bb4fc0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/video_capture_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/virtual_screen_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/virtual_screen_16px_hidpi.png
new file mode 100644
index 0000000..cefa68d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/virtual_screen_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/virtual_screen_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/virtual_screen_disabled_16px_hidpi.png
new file mode 100644
index 0000000..a72a480
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/virtual_screen_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_add_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_add_16px_hidpi.png
new file mode 100644
index 0000000..4042436
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_add_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_16px_hidpi.png
new file mode 100644
index 0000000..942e4b9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_22px_hidpi.png
new file mode 100644
index 0000000..4b06be2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_disabled_16px_hidpi.png
new file mode 100644
index 0000000..888cf30
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_disabled_22px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_disabled_22px_hidpi.png
new file mode 100644
index 0000000..1e821e9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_clone_disabled_22px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_create_shortcut_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_create_shortcut_16px_hidpi.png
new file mode 100644
index 0000000..28ff1c3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_create_shortcut_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_create_shortcut_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_create_shortcut_disabled_16px_hidpi.png
new file mode 100644
index 0000000..75b221e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_create_shortcut_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_16px_hidpi.png
new file mode 100644
index 0000000..60c570a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_32px_hidpi.png
new file mode 100644
index 0000000..7e87a99
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_disabled_16px_hidpi.png
new file mode 100644
index 0000000..faa6d5d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_disabled_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_disabled_32px_hidpi.png
new file mode 100644
index 0000000..b409063
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_delete_disabled_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_16px_hidpi.png
new file mode 100644
index 0000000..f635740
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_32px_hidpi.png
new file mode 100644
index 0000000..769b2f1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_disabled_16px_hidpi.png
new file mode 100644
index 0000000..b213016
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_disabled_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_disabled_32px_hidpi.png
new file mode 100644
index 0000000..a900c2a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_discard_disabled_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_create_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_create_16px_hidpi.png
new file mode 100644
index 0000000..3c58b90
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_create_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_create_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_create_disabled_16px_hidpi.png
new file mode 100644
index 0000000..8d403de
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_create_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_name_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_name_16px_hidpi.png
new file mode 100644
index 0000000..8c07520
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_name_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_name_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_name_disabled_16px_hidpi.png
new file mode 100644
index 0000000..0378870
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_name_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_remove_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_remove_16px_hidpi.png
new file mode 100644
index 0000000..8e008f3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_remove_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_remove_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_remove_disabled_16px_hidpi.png
new file mode 100644
index 0000000..8daafb7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_group_remove_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_new_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_new_16px_hidpi.png
new file mode 100644
index 0000000..faf1290
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_new_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_new_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_new_32px_hidpi.png
new file mode 100644
index 0000000..05bb35f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_new_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_open_filemanager_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_open_filemanager_16px_hidpi.png
new file mode 100644
index 0000000..bf31775
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_open_filemanager_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_open_filemanager_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_open_filemanager_disabled_16px_hidpi.png
new file mode 100644
index 0000000..9002cc2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_open_filemanager_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_16px_hidpi.png
new file mode 100644
index 0000000..179959a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_32px_hidpi.png
new file mode 100644
index 0000000..ea64576
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_disabled_16px_hidpi.png
new file mode 100644
index 0000000..c5f3f7e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_disabled_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_disabled_32px_hidpi.png
new file mode 100644
index 0000000..6c9f39f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_disabled_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_on_16px_hidpi.png
new file mode 100644
index 0000000..79c734d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..c57cefb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_pause_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_poweroff_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_poweroff_16px_hidpi.png
new file mode 100644
index 0000000..272ba41
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_poweroff_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_poweroff_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_poweroff_disabled_16px_hidpi.png
new file mode 100644
index 0000000..4736ccc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_poweroff_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_reset_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_reset_16px_hidpi.png
new file mode 100644
index 0000000..b04dba2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_reset_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_reset_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_reset_disabled_16px_hidpi.png
new file mode 100644
index 0000000..5144cf0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_reset_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_save_state_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_save_state_16px_hidpi.png
new file mode 100644
index 0000000..cda0326
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_save_state_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_save_state_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_save_state_disabled_16px_hidpi.png
new file mode 100644
index 0000000..e29384b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_save_state_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_16px_hidpi.png
new file mode 100644
index 0000000..fa76db9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_32px_hidpi.png
new file mode 100644
index 0000000..9942b0f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_disabled_16px_hidpi.png
new file mode 100644
index 0000000..cfb45c0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_disabled_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_disabled_32px_hidpi.png
new file mode 100644
index 0000000..0ef9ecb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_settings_disabled_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_16px_hidpi.png
new file mode 100644
index 0000000..b78aa3a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_32px_hidpi.png
new file mode 100644
index 0000000..192763e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_disabled_16px_hidpi.png
new file mode 100644
index 0000000..03370fe
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_disabled_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_disabled_32px_hidpi.png
new file mode 100644
index 0000000..c080ef4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_show_logs_disabled_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_shutdown_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_shutdown_16px_hidpi.png
new file mode 100644
index 0000000..0534e03
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_shutdown_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_shutdown_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_shutdown_disabled_16px_hidpi.png
new file mode 100644
index 0000000..68a7fb3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_shutdown_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_16px_hidpi.png
new file mode 100644
index 0000000..8fb6efc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_32px_hidpi.png
new file mode 100644
index 0000000..b650d42
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_disabled_16px_hidpi.png
new file mode 100644
index 0000000..43ec16d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_disabled_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_disabled_32px_hidpi.png
new file mode 100644
index 0000000..c1d0aa4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vm_start_disabled_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_16px_hidpi.png
new file mode 100644
index 0000000..3639aa7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_24px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_24px_hidpi.png
new file mode 100644
index 0000000..2f15d4e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_24px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_32px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_32px_hidpi.png
new file mode 100644
index 0000000..affdeac
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_32px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_disabled_16px_hidpi.png
new file mode 100644
index 0000000..cb7652c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_on_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_on_16px_hidpi.png
new file mode 100644
index 0000000..fe3223a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_on_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_on_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_on_disabled_16px_hidpi.png
new file mode 100644
index 0000000..76a7e82
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_on_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_warning_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_warning_16px_hidpi.png
new file mode 100644
index 0000000..c8360a8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vrdp_warning_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vtx_amdv_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vtx_amdv_16px_hidpi.png
new file mode 100644
index 0000000..9bb2fba
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vtx_amdv_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/vtx_amdv_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/vtx_amdv_disabled_16px_hidpi.png
new file mode 100644
index 0000000..d55290d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/vtx_amdv_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/web_camera_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/web_camera_16px_hidpi.png
new file mode 100644
index 0000000..4d4db5d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/web_camera_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hidpi/web_camera_disabled_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/hidpi/web_camera_disabled_16px_hidpi.png
new file mode 100644
index 0000000..82b0928
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hidpi/web_camera_disabled_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_16px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_16px.png
index 0a036e0..92bb038 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hostkey_16px.png and b/src/VBox/Frontends/VirtualBox/images/hostkey_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_24px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_24px.png
new file mode 100644
index 0000000..3a261b1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/hostkey_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_32px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_32px.png
index 12c42b7..1b0c5ca 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hostkey_32px.png and b/src/VBox/Frontends/VirtualBox/images/hostkey_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_captured_16px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_captured_16px.png
index a49ca9a..bc9f978 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hostkey_captured_16px.png and b/src/VBox/Frontends/VirtualBox/images/hostkey_captured_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_captured_pressed_16px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_captured_pressed_16px.png
index f26a8f2..711b8ce 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hostkey_captured_pressed_16px.png and b/src/VBox/Frontends/VirtualBox/images/hostkey_captured_pressed_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_disabled_16px.png
index 21d8e4f..d86c309 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hostkey_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/hostkey_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_disabled_32px.png
deleted file mode 100644
index 9f4afee..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/hostkey_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_pressed_16px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_pressed_16px.png
index 592ce14..2eae833 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hostkey_pressed_16px.png and b/src/VBox/Frontends/VirtualBox/images/hostkey_pressed_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/hostkey_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/hostkey_warning_16px.png
index 1a866dd..7e5ec19 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/hostkey_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/hostkey_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/ide_16px.png b/src/VBox/Frontends/VirtualBox/images/ide_16px.png
index 993fa4a..4bbbb09 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/ide_16px.png and b/src/VBox/Frontends/VirtualBox/images/ide_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/ide_add_16px.png b/src/VBox/Frontends/VirtualBox/images/ide_add_16px.png
index 04130dd..ca5165c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/ide_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/ide_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/ide_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/ide_add_disabled_16px.png
index f39f0d6..e633c95 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/ide_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/ide_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/ide_collapse_16px.png b/src/VBox/Frontends/VirtualBox/images/ide_collapse_16px.png
index b1f10d6..440353b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/ide_collapse_16px.png and b/src/VBox/Frontends/VirtualBox/images/ide_collapse_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/ide_expand_16px.png b/src/VBox/Frontends/VirtualBox/images/ide_expand_16px.png
index 52cae8f..c02ebac 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/ide_expand_16px.png and b/src/VBox/Frontends/VirtualBox/images/ide_expand_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/import_16px.png b/src/VBox/Frontends/VirtualBox/images/import_16px.png
index 2f035fd..d24f2dd 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/import_16px.png and b/src/VBox/Frontends/VirtualBox/images/import_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/interface_16px.png b/src/VBox/Frontends/VirtualBox/images/interface_16px.png
new file mode 100644
index 0000000..970dcd9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/interface_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/interface_24px.png b/src/VBox/Frontends/VirtualBox/images/interface_24px.png
new file mode 100644
index 0000000..156e470
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/interface_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/interface_32px.png b/src/VBox/Frontends/VirtualBox/images/interface_32px.png
new file mode 100644
index 0000000..93b5103
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/interface_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/interface_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/interface_warning_16px.png
new file mode 100644
index 0000000..0795c30
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/interface_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/keyboard_16px.png b/src/VBox/Frontends/VirtualBox/images/keyboard_16px.png
new file mode 100644
index 0000000..4778056
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/keyboard_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/keyboard_24px.png b/src/VBox/Frontends/VirtualBox/images/keyboard_24px.png
new file mode 100644
index 0000000..a1ae107
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/keyboard_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/keyboard_32px.png b/src/VBox/Frontends/VirtualBox/images/keyboard_32px.png
new file mode 100644
index 0000000..854c168
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/keyboard_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/keyboard_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/keyboard_settings_16px.png
new file mode 100644
index 0000000..c3f0592
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/keyboard_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/keyboard_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/keyboard_settings_disabled_16px.png
new file mode 100644
index 0000000..630165f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/keyboard_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/list_movedown_16px.png b/src/VBox/Frontends/VirtualBox/images/list_movedown_16px.png
index 2e8f6b5..8fc58fc 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/list_movedown_16px.png and b/src/VBox/Frontends/VirtualBox/images/list_movedown_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/list_movedown_22px.png b/src/VBox/Frontends/VirtualBox/images/list_movedown_22px.png
deleted file mode 100644
index fc97f18..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/list_movedown_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/list_movedown_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/list_movedown_disabled_16px.png
index c0588f2..3c70308 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/list_movedown_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/list_movedown_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/list_movedown_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/list_movedown_disabled_22px.png
deleted file mode 100644
index a05ea48..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/list_movedown_disabled_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/list_moveup_16px.png b/src/VBox/Frontends/VirtualBox/images/list_moveup_16px.png
index 29b9e9e..99f78f3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/list_moveup_16px.png and b/src/VBox/Frontends/VirtualBox/images/list_moveup_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/list_moveup_22px.png b/src/VBox/Frontends/VirtualBox/images/list_moveup_22px.png
deleted file mode 100644
index 77b6ccd..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/list_moveup_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/list_moveup_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/list_moveup_disabled_16px.png
index 9bc19d5..69939f0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/list_moveup_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/list_moveup_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/list_moveup_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/list_moveup_disabled_22px.png
deleted file mode 100644
index a1d0eb1..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/list_moveup_disabled_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/machine_16px.png b/src/VBox/Frontends/VirtualBox/images/machine_16px.png
index d149e43..cfbf0a8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/machine_16px.png and b/src/VBox/Frontends/VirtualBox/images/machine_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/machine_24px.png b/src/VBox/Frontends/VirtualBox/images/machine_24px.png
new file mode 100644
index 0000000..954efde
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/machine_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/machine_32px.png b/src/VBox/Frontends/VirtualBox/images/machine_32px.png
index 49603cf..9f57418 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/machine_32px.png and b/src/VBox/Frontends/VirtualBox/images/machine_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/machine_abstract_16px.png b/src/VBox/Frontends/VirtualBox/images/machine_abstract_16px.png
index 1489ac9..e541831 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/machine_abstract_16px.png and b/src/VBox/Frontends/VirtualBox/images/machine_abstract_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/machine_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/machine_disabled_16px.png
deleted file mode 100644
index 81fab40..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/machine_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/machine_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/machine_disabled_32px.png
deleted file mode 100644
index 7db7d03..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/machine_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/machine_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/machine_warning_16px.png
index d6316d7..f55064c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/machine_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/machine_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/meditation_32px.png b/src/VBox/Frontends/VirtualBox/images/meditation_32px.png
index 996752f..5a0b1b9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/meditation_32px.png and b/src/VBox/Frontends/VirtualBox/images/meditation_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/menubar_16px.png b/src/VBox/Frontends/VirtualBox/images/menubar_16px.png
new file mode 100644
index 0000000..f3b3868
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/menubar_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/menubar_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/menubar_disabled_16px.png
new file mode 100644
index 0000000..a937cd2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/menubar_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/menubar_on_16px.png b/src/VBox/Frontends/VirtualBox/images/menubar_on_16px.png
new file mode 100644
index 0000000..cdc1022
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/menubar_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/menubar_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/menubar_on_disabled_16px.png
new file mode 100644
index 0000000..c6cabd5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/menubar_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/menubar_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/menubar_settings_16px.png
new file mode 100644
index 0000000..f8742e6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/menubar_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/menubar_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/menubar_settings_disabled_16px.png
new file mode 100644
index 0000000..82c6626
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/menubar_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/minimize_16px.png b/src/VBox/Frontends/VirtualBox/images/minimize_16px.png
index c906725..d9c268e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/minimize_16px.png and b/src/VBox/Frontends/VirtualBox/images/minimize_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/monitor.png b/src/VBox/Frontends/VirtualBox/images/monitor.png
index a52e97f..5343c2c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/monitor.png and b/src/VBox/Frontends/VirtualBox/images/monitor.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/monitor_glossy.png b/src/VBox/Frontends/VirtualBox/images/monitor_glossy.png
index d8798ff..7691479 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/monitor_glossy.png and b/src/VBox/Frontends/VirtualBox/images/monitor_glossy.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/mouse_16px.png b/src/VBox/Frontends/VirtualBox/images/mouse_16px.png
index f7a6939..5f1378d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/mouse_16px.png and b/src/VBox/Frontends/VirtualBox/images/mouse_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_16px.png b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_16px.png
index 47967c5..672de3f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_16px.png and b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_disabled_16px.png
index 167a96d..139daec 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_on_16px.png b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_on_16px.png
index 84486c2..0972ab0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_on_disabled_16px.png
index 3a2873d..23227b4 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_uncaptured_16px.png b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_uncaptured_16px.png
index e39c79c..4adf663 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_uncaptured_16px.png and b/src/VBox/Frontends/VirtualBox/images/mouse_can_seamless_uncaptured_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/mouse_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/mouse_disabled_16px.png
index 5649570..125c0aa 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/mouse_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/mouse_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/mouse_seamless_16px.png b/src/VBox/Frontends/VirtualBox/images/mouse_seamless_16px.png
index 93ebbb8..4ecf412 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/mouse_seamless_16px.png and b/src/VBox/Frontends/VirtualBox/images/mouse_seamless_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/movie_reel_16px.png b/src/VBox/Frontends/VirtualBox/images/movie_reel_16px.png
index 301f314..75bef3b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/movie_reel_16px.png and b/src/VBox/Frontends/VirtualBox/images/movie_reel_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/name_16px.png b/src/VBox/Frontends/VirtualBox/images/name_16px.png
index 352e854..b0f0309 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/name_16px.png and b/src/VBox/Frontends/VirtualBox/images/name_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/next_16px.png b/src/VBox/Frontends/VirtualBox/images/next_16px.png
index e2b2727..1e024a6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/next_16px.png and b/src/VBox/Frontends/VirtualBox/images/next_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_16px.png
index 3087cee..92f3109 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_24px.png b/src/VBox/Frontends/VirtualBox/images/nw_24px.png
new file mode 100644
index 0000000..8f0a889
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/nw_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_32px.png b/src/VBox/Frontends/VirtualBox/images/nw_32px.png
index fab10cc..1d63c30 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_32px.png and b/src/VBox/Frontends/VirtualBox/images/nw_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_disabled_16px.png
index aec68be..dd9b2ea 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/nw_disabled_32px.png
deleted file mode 100644
index 0188f2b..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_disconnected_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_disconnected_16px.png
new file mode 100644
index 0000000..fb9f070
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/nw_disconnected_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_error_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_error_16px.png
index 0fe84b6..0183a89 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_error_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_error_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_loading_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_loading_16px.png
index 61e654b..6f0390a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_loading_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_loading_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_read_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_read_16px.png
index c2108d8..49285c2 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_read_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_read_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_settings_16px.png
index b1522bb..b25dd84 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_settings_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_settings_disabled_16px.png
index 993bad4..cad079e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_settings_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_warning_16px.png
index 856aba4..e12982d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/nw_write_16px.png b/src/VBox/Frontends/VirtualBox/images/nw_write_16px.png
index e64bea5..7b6bd74 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/nw_write_16px.png and b/src/VBox/Frontends/VirtualBox/images/nw_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/ok_16px.png b/src/VBox/Frontends/VirtualBox/images/ok_16px.png
index c18c287..da5ed7e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/ok_16px.png and b/src/VBox/Frontends/VirtualBox/images/ok_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_archlinux.png b/src/VBox/Frontends/VirtualBox/images/os_archlinux.png
index b6b7322..0df78b7 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_archlinux.png and b/src/VBox/Frontends/VirtualBox/images/os_archlinux.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_archlinux_64.png b/src/VBox/Frontends/VirtualBox/images/os_archlinux_64.png
index 4eb0ffe..b3e3329 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_archlinux_64.png and b/src/VBox/Frontends/VirtualBox/images/os_archlinux_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_debian.png b/src/VBox/Frontends/VirtualBox/images/os_debian.png
index edec373..95febc0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_debian.png and b/src/VBox/Frontends/VirtualBox/images/os_debian.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_debian_64.png b/src/VBox/Frontends/VirtualBox/images/os_debian_64.png
index bc8fc4a..0fda426 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_debian_64.png and b/src/VBox/Frontends/VirtualBox/images/os_debian_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_dos.png b/src/VBox/Frontends/VirtualBox/images/os_dos.png
index 6e44d5c..391b9a3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_dos.png and b/src/VBox/Frontends/VirtualBox/images/os_dos.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_fedora.png b/src/VBox/Frontends/VirtualBox/images/os_fedora.png
index 066c271..bdff881 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_fedora.png and b/src/VBox/Frontends/VirtualBox/images/os_fedora.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_fedora_64.png b/src/VBox/Frontends/VirtualBox/images/os_fedora_64.png
index 301c83d..fad0043 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_fedora_64.png and b/src/VBox/Frontends/VirtualBox/images/os_fedora_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_freebsd.png b/src/VBox/Frontends/VirtualBox/images/os_freebsd.png
index 416795f..8f251bf 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_freebsd.png and b/src/VBox/Frontends/VirtualBox/images/os_freebsd.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_freebsd_64.png b/src/VBox/Frontends/VirtualBox/images/os_freebsd_64.png
index de71632..e090250 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_freebsd_64.png and b/src/VBox/Frontends/VirtualBox/images/os_freebsd_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_gentoo.png b/src/VBox/Frontends/VirtualBox/images/os_gentoo.png
index 1d07099..abd620e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_gentoo.png and b/src/VBox/Frontends/VirtualBox/images/os_gentoo.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_gentoo_64.png b/src/VBox/Frontends/VirtualBox/images/os_gentoo_64.png
index 7e720ae..8ea30f8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_gentoo_64.png and b/src/VBox/Frontends/VirtualBox/images/os_gentoo_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_jrockitve.png b/src/VBox/Frontends/VirtualBox/images/os_jrockitve.png
index 03a4f8e..15bc663 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_jrockitve.png and b/src/VBox/Frontends/VirtualBox/images/os_jrockitve.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_l4.png b/src/VBox/Frontends/VirtualBox/images/os_l4.png
index ddcd312..9ae841b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_l4.png and b/src/VBox/Frontends/VirtualBox/images/os_l4.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_linux.png b/src/VBox/Frontends/VirtualBox/images/os_linux.png
index 6f470f2..38e4f83 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_linux.png and b/src/VBox/Frontends/VirtualBox/images/os_linux.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_linux22.png b/src/VBox/Frontends/VirtualBox/images/os_linux22.png
index 70ee886..7d06c26 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_linux22.png and b/src/VBox/Frontends/VirtualBox/images/os_linux22.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_linux24.png b/src/VBox/Frontends/VirtualBox/images/os_linux24.png
index 70e1470..1e2bafb 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_linux24.png and b/src/VBox/Frontends/VirtualBox/images/os_linux24.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_linux24_64.png b/src/VBox/Frontends/VirtualBox/images/os_linux24_64.png
index 4e074d7..2996194 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_linux24_64.png and b/src/VBox/Frontends/VirtualBox/images/os_linux24_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_linux26.png b/src/VBox/Frontends/VirtualBox/images/os_linux26.png
index 0b8d526..996140e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_linux26.png and b/src/VBox/Frontends/VirtualBox/images/os_linux26.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_linux26_64.png b/src/VBox/Frontends/VirtualBox/images/os_linux26_64.png
index 9c35df6..f9fed16 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_linux26_64.png and b/src/VBox/Frontends/VirtualBox/images/os_linux26_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_linux_other.png b/src/VBox/Frontends/VirtualBox/images/os_linux_other.png
index 6b0104c..9b34609 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_linux_other.png and b/src/VBox/Frontends/VirtualBox/images/os_linux_other.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_macosx.png b/src/VBox/Frontends/VirtualBox/images/os_macosx.png
index ddcdc10..c2d58e7 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_macosx.png and b/src/VBox/Frontends/VirtualBox/images/os_macosx.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_macosx_64.png b/src/VBox/Frontends/VirtualBox/images/os_macosx_64.png
index 452610c..153a290 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_macosx_64.png and b/src/VBox/Frontends/VirtualBox/images/os_macosx_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_mandriva.png b/src/VBox/Frontends/VirtualBox/images/os_mandriva.png
index d707756..ba2b9b3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_mandriva.png and b/src/VBox/Frontends/VirtualBox/images/os_mandriva.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_mandriva_64.png b/src/VBox/Frontends/VirtualBox/images/os_mandriva_64.png
index 39d9da0..70f7a0e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_mandriva_64.png and b/src/VBox/Frontends/VirtualBox/images/os_mandriva_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_netbsd.png b/src/VBox/Frontends/VirtualBox/images/os_netbsd.png
index 4e77287..89a4fe3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_netbsd.png and b/src/VBox/Frontends/VirtualBox/images/os_netbsd.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_netbsd_64.png b/src/VBox/Frontends/VirtualBox/images/os_netbsd_64.png
index 0aecfa7..9be2a7e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_netbsd_64.png and b/src/VBox/Frontends/VirtualBox/images/os_netbsd_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_netware.png b/src/VBox/Frontends/VirtualBox/images/os_netware.png
index e5d1932..e1d5ff9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_netware.png and b/src/VBox/Frontends/VirtualBox/images/os_netware.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_openbsd.png b/src/VBox/Frontends/VirtualBox/images/os_openbsd.png
index 4f2d911..8849636 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_openbsd.png and b/src/VBox/Frontends/VirtualBox/images/os_openbsd.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_openbsd_64.png b/src/VBox/Frontends/VirtualBox/images/os_openbsd_64.png
index 782daf0..faa3c01 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_openbsd_64.png and b/src/VBox/Frontends/VirtualBox/images/os_openbsd_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_opensuse.png b/src/VBox/Frontends/VirtualBox/images/os_opensuse.png
index 08f2688..5d25590 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_opensuse.png and b/src/VBox/Frontends/VirtualBox/images/os_opensuse.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_opensuse_64.png b/src/VBox/Frontends/VirtualBox/images/os_opensuse_64.png
index 595edc7..e4d7bbd 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_opensuse_64.png and b/src/VBox/Frontends/VirtualBox/images/os_opensuse_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_oracle.png b/src/VBox/Frontends/VirtualBox/images/os_oracle.png
index 35804b7..80b8301 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_oracle.png and b/src/VBox/Frontends/VirtualBox/images/os_oracle.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_oracle_64.png b/src/VBox/Frontends/VirtualBox/images/os_oracle_64.png
index d4a1539..9f4f3db 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_oracle_64.png and b/src/VBox/Frontends/VirtualBox/images/os_oracle_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_oraclesolaris.png b/src/VBox/Frontends/VirtualBox/images/os_oraclesolaris.png
index 10d8bb9..dcf65f9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_oraclesolaris.png and b/src/VBox/Frontends/VirtualBox/images/os_oraclesolaris.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_oraclesolaris_64.png b/src/VBox/Frontends/VirtualBox/images/os_oraclesolaris_64.png
index 3c6a27e..2aedc0e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_oraclesolaris_64.png and b/src/VBox/Frontends/VirtualBox/images/os_oraclesolaris_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_os2_other.png b/src/VBox/Frontends/VirtualBox/images/os_os2_other.png
index 3ec106c..dd1f756 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_os2_other.png and b/src/VBox/Frontends/VirtualBox/images/os_os2_other.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_os2ecs.png b/src/VBox/Frontends/VirtualBox/images/os_os2ecs.png
index f19f36e..aed9aa0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_os2ecs.png and b/src/VBox/Frontends/VirtualBox/images/os_os2ecs.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_os2warp3.png b/src/VBox/Frontends/VirtualBox/images/os_os2warp3.png
index 5e22449..401f70f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_os2warp3.png and b/src/VBox/Frontends/VirtualBox/images/os_os2warp3.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_os2warp4.png b/src/VBox/Frontends/VirtualBox/images/os_os2warp4.png
index 0707b1a..4a9af06 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_os2warp4.png and b/src/VBox/Frontends/VirtualBox/images/os_os2warp4.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_os2warp45.png b/src/VBox/Frontends/VirtualBox/images/os_os2warp45.png
index 6e3fa06..287c09e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_os2warp45.png and b/src/VBox/Frontends/VirtualBox/images/os_os2warp45.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_other.png b/src/VBox/Frontends/VirtualBox/images/os_other.png
index 299e428..d258b00 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_other.png and b/src/VBox/Frontends/VirtualBox/images/os_other.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_other_64.png b/src/VBox/Frontends/VirtualBox/images/os_other_64.png
index 3ed3172..21a7d00 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_other_64.png and b/src/VBox/Frontends/VirtualBox/images/os_other_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_qnx.png b/src/VBox/Frontends/VirtualBox/images/os_qnx.png
index 3bcff05..1141e75 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_qnx.png and b/src/VBox/Frontends/VirtualBox/images/os_qnx.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_redhat.png b/src/VBox/Frontends/VirtualBox/images/os_redhat.png
index 9d07f26..590119c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_redhat.png and b/src/VBox/Frontends/VirtualBox/images/os_redhat.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_redhat_64.png b/src/VBox/Frontends/VirtualBox/images/os_redhat_64.png
index 93cbfe8..4179d75 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_redhat_64.png and b/src/VBox/Frontends/VirtualBox/images/os_redhat_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_solaris.png b/src/VBox/Frontends/VirtualBox/images/os_solaris.png
index 1b1efcf..e1bf9df 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_solaris.png and b/src/VBox/Frontends/VirtualBox/images/os_solaris.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_solaris_64.png b/src/VBox/Frontends/VirtualBox/images/os_solaris_64.png
index 930d040..cffa062 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_solaris_64.png and b/src/VBox/Frontends/VirtualBox/images/os_solaris_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_turbolinux.png b/src/VBox/Frontends/VirtualBox/images/os_turbolinux.png
index c38c440..fec16b2 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_turbolinux.png and b/src/VBox/Frontends/VirtualBox/images/os_turbolinux.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_turbolinux_64.png b/src/VBox/Frontends/VirtualBox/images/os_turbolinux_64.png
index af55fbb..ec9715e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_turbolinux_64.png and b/src/VBox/Frontends/VirtualBox/images/os_turbolinux_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_type_16px.png b/src/VBox/Frontends/VirtualBox/images/os_type_16px.png
index b8191fc..d067b72 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_type_16px.png and b/src/VBox/Frontends/VirtualBox/images/os_type_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_ubuntu.png b/src/VBox/Frontends/VirtualBox/images/os_ubuntu.png
index 3c009f3..b2b867f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_ubuntu.png and b/src/VBox/Frontends/VirtualBox/images/os_ubuntu.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_ubuntu_64.png b/src/VBox/Frontends/VirtualBox/images/os_ubuntu_64.png
index 44b2efe..a314b42 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_ubuntu_64.png and b/src/VBox/Frontends/VirtualBox/images/os_ubuntu_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win2k.png b/src/VBox/Frontends/VirtualBox/images/os_win2k.png
index c0409b2..8b0c0b9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win2k.png and b/src/VBox/Frontends/VirtualBox/images/os_win2k.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win2k12_64.png b/src/VBox/Frontends/VirtualBox/images/os_win2k12_64.png
index 3ef95a8..da23ba6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win2k12_64.png and b/src/VBox/Frontends/VirtualBox/images/os_win2k12_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win2k3.png b/src/VBox/Frontends/VirtualBox/images/os_win2k3.png
index 5ac8a84..aa81da3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win2k3.png and b/src/VBox/Frontends/VirtualBox/images/os_win2k3.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win2k3_64.png b/src/VBox/Frontends/VirtualBox/images/os_win2k3_64.png
index 7732461..707faea 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win2k3_64.png and b/src/VBox/Frontends/VirtualBox/images/os_win2k3_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win2k8.png b/src/VBox/Frontends/VirtualBox/images/os_win2k8.png
index 9d2412c..6aec170 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win2k8.png and b/src/VBox/Frontends/VirtualBox/images/os_win2k8.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win2k8_64.png b/src/VBox/Frontends/VirtualBox/images/os_win2k8_64.png
index b80e7dc..25235e0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win2k8_64.png and b/src/VBox/Frontends/VirtualBox/images/os_win2k8_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win31.png b/src/VBox/Frontends/VirtualBox/images/os_win31.png
index 4a0eacf..1786c2b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win31.png and b/src/VBox/Frontends/VirtualBox/images/os_win31.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win7.png b/src/VBox/Frontends/VirtualBox/images/os_win7.png
index f5ed002..81a4054 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win7.png and b/src/VBox/Frontends/VirtualBox/images/os_win7.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win7_64.png b/src/VBox/Frontends/VirtualBox/images/os_win7_64.png
index e908870..5dde5d8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win7_64.png and b/src/VBox/Frontends/VirtualBox/images/os_win7_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win8.png b/src/VBox/Frontends/VirtualBox/images/os_win8.png
index 0777906..b0ff05d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win8.png and b/src/VBox/Frontends/VirtualBox/images/os_win8.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win8_64.png b/src/VBox/Frontends/VirtualBox/images/os_win8_64.png
index 2379458..f65d262 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win8_64.png and b/src/VBox/Frontends/VirtualBox/images/os_win8_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win95.png b/src/VBox/Frontends/VirtualBox/images/os_win95.png
index a5b4dd2..6ef424a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win95.png and b/src/VBox/Frontends/VirtualBox/images/os_win95.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win98.png b/src/VBox/Frontends/VirtualBox/images/os_win98.png
index 3276e89..601c995 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win98.png and b/src/VBox/Frontends/VirtualBox/images/os_win98.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_win_other.png b/src/VBox/Frontends/VirtualBox/images/os_win_other.png
index 8d260f7..dc9804b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_win_other.png and b/src/VBox/Frontends/VirtualBox/images/os_win_other.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_winme.png b/src/VBox/Frontends/VirtualBox/images/os_winme.png
index b3d2165..2a803f7 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_winme.png and b/src/VBox/Frontends/VirtualBox/images/os_winme.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_winnt4.png b/src/VBox/Frontends/VirtualBox/images/os_winnt4.png
index f19b8c0..604bd6c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_winnt4.png and b/src/VBox/Frontends/VirtualBox/images/os_winnt4.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_winvista.png b/src/VBox/Frontends/VirtualBox/images/os_winvista.png
index 94aed38..d93a92a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_winvista.png and b/src/VBox/Frontends/VirtualBox/images/os_winvista.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_winvista_64.png b/src/VBox/Frontends/VirtualBox/images/os_winvista_64.png
index b2e303d..0d19d0b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_winvista_64.png and b/src/VBox/Frontends/VirtualBox/images/os_winvista_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_winxp.png b/src/VBox/Frontends/VirtualBox/images/os_winxp.png
index fda2148..2cc01b8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_winxp.png and b/src/VBox/Frontends/VirtualBox/images/os_winxp.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_winxp_64.png b/src/VBox/Frontends/VirtualBox/images/os_winxp_64.png
index 6c15e17..436b548 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_winxp_64.png and b/src/VBox/Frontends/VirtualBox/images/os_winxp_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_xandros.png b/src/VBox/Frontends/VirtualBox/images/os_xandros.png
index 0c4173f..3f8bfee 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_xandros.png and b/src/VBox/Frontends/VirtualBox/images/os_xandros.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/os_xandros_64.png b/src/VBox/Frontends/VirtualBox/images/os_xandros_64.png
index ed2f870..928260d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/os_xandros_64.png and b/src/VBox/Frontends/VirtualBox/images/os_xandros_64.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/parallel_port_16px.png b/src/VBox/Frontends/VirtualBox/images/parallel_port_16px.png
index c7589a6..4ec8fe3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/parallel_port_16px.png and b/src/VBox/Frontends/VirtualBox/images/parallel_port_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/parallel_port_24px.png b/src/VBox/Frontends/VirtualBox/images/parallel_port_24px.png
new file mode 100644
index 0000000..573355d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/parallel_port_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/parallel_port_32px.png b/src/VBox/Frontends/VirtualBox/images/parallel_port_32px.png
index 0b376c3..50dfd05 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/parallel_port_32px.png and b/src/VBox/Frontends/VirtualBox/images/parallel_port_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/parallel_port_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/parallel_port_disabled_16px.png
deleted file mode 100644
index b206b9a..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/parallel_port_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/parallel_port_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/parallel_port_disabled_32px.png
deleted file mode 100644
index 6790f77..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/parallel_port_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/parallel_port_read_16px.png b/src/VBox/Frontends/VirtualBox/images/parallel_port_read_16px.png
deleted file mode 100644
index cda6b96..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/parallel_port_read_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/parallel_port_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/parallel_port_warning_16px.png
index ae2bc93..63e8b4a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/parallel_port_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/parallel_port_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/parallel_port_write_16px.png b/src/VBox/Frontends/VirtualBox/images/parallel_port_write_16px.png
deleted file mode 100644
index e699523..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/parallel_port_write_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/pin_16px.png b/src/VBox/Frontends/VirtualBox/images/pin_16px.png
index 3502182..e962db3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/pin_16px.png and b/src/VBox/Frontends/VirtualBox/images/pin_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/preview_empty_16to10_242x167px.png b/src/VBox/Frontends/VirtualBox/images/preview_empty_16to10_242x167px.png
new file mode 100644
index 0000000..807aa27
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/preview_empty_16to10_242x167px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/preview_empty_16to9_242x155px.png b/src/VBox/Frontends/VirtualBox/images/preview_empty_16to9_242x155px.png
new file mode 100644
index 0000000..5cd17a5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/preview_empty_16to9_242x155px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/preview_empty_228x168px.png b/src/VBox/Frontends/VirtualBox/images/preview_empty_228x168px.png
deleted file mode 100644
index 86b4671..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/preview_empty_228x168px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/preview_empty_4to3_242x192px.png b/src/VBox/Frontends/VirtualBox/images/preview_empty_4to3_242x192px.png
new file mode 100644
index 0000000..9791e7f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/preview_empty_4to3_242x192px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/preview_full_16to10_242x167px.png b/src/VBox/Frontends/VirtualBox/images/preview_full_16to10_242x167px.png
new file mode 100644
index 0000000..0deab5d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/preview_full_16to10_242x167px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/preview_full_16to9_242x155px.png b/src/VBox/Frontends/VirtualBox/images/preview_full_16to9_242x155px.png
new file mode 100644
index 0000000..0a2034e
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/preview_full_16to9_242x155px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/preview_full_228x168px.png b/src/VBox/Frontends/VirtualBox/images/preview_full_228x168px.png
deleted file mode 100644
index 08d283e..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/preview_full_228x168px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/preview_full_4to3_242x192px.png b/src/VBox/Frontends/VirtualBox/images/preview_full_4to3_242x192px.png
new file mode 100644
index 0000000..c66ba39
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/preview_full_4to3_242x192px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/previous_16px.png b/src/VBox/Frontends/VirtualBox/images/previous_16px.png
index 6eef23b..80d2a03 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/previous_16px.png and b/src/VBox/Frontends/VirtualBox/images/previous_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_clone_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_clone_90px.png
index 190f3c9..e76647a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_clone_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_clone_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_delete_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_delete_90px.png
index 795d853..d6c01fb 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_delete_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_delete_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_dnd_gh_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_dnd_gh_90px.png
index ff29a0c..c69dc7e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_dnd_gh_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_dnd_gh_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_dnd_hg_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_dnd_hg_90px.png
index 066be2c..18b3981 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_dnd_hg_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_dnd_hg_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_export_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_export_90px.png
index 9b5356d..9afacdc 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_export_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_export_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_import_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_import_90px.png
index 3c76403..75c279d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_import_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_import_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_install_guest_additions_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_install_guest_additions_90px.png
index 207c0a8..5d75a80 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_install_guest_additions_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_install_guest_additions_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_media_create_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_media_create_90px.png
index eea9510..10b1b48 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_media_create_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_media_create_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_media_delete_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_media_delete_90px.png
index 36d9ce1..dd8b53c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_media_delete_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_media_delete_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_network_interface_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_network_interface_90px.png
new file mode 100644
index 0000000..d4028c2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/progress_network_interface_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_poweroff_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_poweroff_90px.png
index 6e42e35..647a686 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_poweroff_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_poweroff_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_reading_appliance_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_reading_appliance_90px.png
new file mode 100644
index 0000000..4c78465
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/progress_reading_appliance_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_refresh_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_refresh_90px.png
new file mode 100644
index 0000000..a9c6144
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/progress_refresh_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_settings_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_settings_90px.png
new file mode 100644
index 0000000..4853738
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/progress_settings_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_snapshot_create_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_snapshot_create_90px.png
index 8025eae..173f96b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_snapshot_create_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_snapshot_create_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_snapshot_discard_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_snapshot_discard_90px.png
index f819cea..a9893d8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_snapshot_discard_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_snapshot_discard_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_snapshot_restore_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_snapshot_restore_90px.png
index a90c3fc..82a3612 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_snapshot_restore_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_snapshot_restore_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_start_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_start_90px.png
index dca1003..04dae8c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_start_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_start_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_state_restore_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_state_restore_90px.png
index 51c2565..a0e2a84 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_state_restore_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_state_restore_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/progress_state_save_90px.png b/src/VBox/Frontends/VirtualBox/images/progress_state_save_90px.png
index d89886f..1c77040 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/progress_state_save_90px.png and b/src/VBox/Frontends/VirtualBox/images/progress_state_save_90px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/proxy_16px.png b/src/VBox/Frontends/VirtualBox/images/proxy_16px.png
index 3cfa8ca..cb05406 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/proxy_16px.png and b/src/VBox/Frontends/VirtualBox/images/proxy_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/proxy_24px.png b/src/VBox/Frontends/VirtualBox/images/proxy_24px.png
new file mode 100644
index 0000000..e0740cb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/proxy_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/proxy_32px.png b/src/VBox/Frontends/VirtualBox/images/proxy_32px.png
index 2a38528..42cfeef 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/proxy_32px.png and b/src/VBox/Frontends/VirtualBox/images/proxy_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/proxy_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/proxy_disabled_16px.png
deleted file mode 100644
index c3edf45..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/proxy_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/proxy_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/proxy_disabled_32px.png
deleted file mode 100644
index 7702dc0..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/proxy_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/proxy_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/proxy_warning_16px.png
index c1f4247..c24a969 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/proxy_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/proxy_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/ram_16px.png b/src/VBox/Frontends/VirtualBox/images/ram_16px.png
index cb3a6d8..4aa2bdf 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/ram_16px.png and b/src/VBox/Frontends/VirtualBox/images/ram_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/refresh_16px.png b/src/VBox/Frontends/VirtualBox/images/refresh_16px.png
index 42d0d66b..2f33f81 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/refresh_16px.png and b/src/VBox/Frontends/VirtualBox/images/refresh_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/refresh_22px.png b/src/VBox/Frontends/VirtualBox/images/refresh_22px.png
index 2c2a8b9..68361b4 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/refresh_22px.png and b/src/VBox/Frontends/VirtualBox/images/refresh_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/refresh_24px.png b/src/VBox/Frontends/VirtualBox/images/refresh_24px.png
new file mode 100644
index 0000000..12b767f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/refresh_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/refresh_32px.png b/src/VBox/Frontends/VirtualBox/images/refresh_32px.png
index bc4dbb5..1140e01 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/refresh_32px.png and b/src/VBox/Frontends/VirtualBox/images/refresh_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/refresh_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/refresh_disabled_16px.png
index 45f79c3..4cbb805 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/refresh_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/refresh_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/refresh_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/refresh_disabled_22px.png
index a035a02..cb6f826 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/refresh_disabled_22px.png and b/src/VBox/Frontends/VirtualBox/images/refresh_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/refresh_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/refresh_disabled_32px.png
index 23bcd94..eed0a8d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/refresh_disabled_32px.png and b/src/VBox/Frontends/VirtualBox/images/refresh_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/refresh_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/refresh_warning_16px.png
index 865613e..54a6b5c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/refresh_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/refresh_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/register_16px.png b/src/VBox/Frontends/VirtualBox/images/register_16px.png
deleted file mode 100644
index b754474..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/register_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/register_32px.png b/src/VBox/Frontends/VirtualBox/images/register_32px.png
deleted file mode 100644
index 8ff490c..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/register_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/register_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/register_disabled_16px.png
deleted file mode 100644
index dca00ff..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/register_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/remove_host_iface_16px.png b/src/VBox/Frontends/VirtualBox/images/remove_host_iface_16px.png
index 97102c6..5e033b3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/remove_host_iface_16px.png and b/src/VBox/Frontends/VirtualBox/images/remove_host_iface_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/remove_host_iface_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/remove_host_iface_disabled_16px.png
index 5a2297a..95fb9a2 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/remove_host_iface_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/remove_host_iface_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/reset_warnings_16px.png b/src/VBox/Frontends/VirtualBox/images/reset_warnings_16px.png
index daa7c27..e09ad87 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/reset_warnings_16px.png and b/src/VBox/Frontends/VirtualBox/images/reset_warnings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/restore_16px.png b/src/VBox/Frontends/VirtualBox/images/restore_16px.png
index 37a0eb2..6df3db5 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/restore_16px.png and b/src/VBox/Frontends/VirtualBox/images/restore_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sata_16px.png b/src/VBox/Frontends/VirtualBox/images/sata_16px.png
index b98fa1c..d3b5a30 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sata_16px.png and b/src/VBox/Frontends/VirtualBox/images/sata_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sata_add_16px.png b/src/VBox/Frontends/VirtualBox/images/sata_add_16px.png
index 5c27328..6286f01 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sata_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/sata_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sata_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/sata_add_disabled_16px.png
index 86e436e..dff1534 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sata_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/sata_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sata_collapse_16px.png b/src/VBox/Frontends/VirtualBox/images/sata_collapse_16px.png
index 3ef0041..8e42d77 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sata_collapse_16px.png and b/src/VBox/Frontends/VirtualBox/images/sata_collapse_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sata_expand_16px.png b/src/VBox/Frontends/VirtualBox/images/sata_expand_16px.png
index e16cb53..677cf03 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sata_expand_16px.png and b/src/VBox/Frontends/VirtualBox/images/sata_expand_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scale_16px.png b/src/VBox/Frontends/VirtualBox/images/scale_16px.png
index 6772307..de8c893 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scale_16px.png and b/src/VBox/Frontends/VirtualBox/images/scale_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scale_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/scale_disabled_16px.png
index b70fb55..d84dc45 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scale_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/scale_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scale_factor_16px.png b/src/VBox/Frontends/VirtualBox/images/scale_factor_16px.png
new file mode 100644
index 0000000..828692a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/scale_factor_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scale_factor_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/scale_factor_disabled_16px.png
new file mode 100644
index 0000000..7643305
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/scale_factor_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scale_on_16px.png b/src/VBox/Frontends/VirtualBox/images/scale_on_16px.png
index 013a1ac..ce5c13c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scale_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/scale_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scale_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/scale_on_disabled_16px.png
index 2aede76..ff257a3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scale_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/scale_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/screenshot_take_16px.png b/src/VBox/Frontends/VirtualBox/images/screenshot_take_16px.png
index 294cc21..8d752ee 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/screenshot_take_16px.png and b/src/VBox/Frontends/VirtualBox/images/screenshot_take_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/screenshot_take_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/screenshot_take_disabled_16px.png
index 9c2553e..1f98709 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/screenshot_take_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/screenshot_take_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scsi_16px.png b/src/VBox/Frontends/VirtualBox/images/scsi_16px.png
index 1ab697e..8763bc3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scsi_16px.png and b/src/VBox/Frontends/VirtualBox/images/scsi_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scsi_add_16px.png b/src/VBox/Frontends/VirtualBox/images/scsi_add_16px.png
index 1f478de..9d834d0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scsi_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/scsi_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scsi_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/scsi_add_disabled_16px.png
index f39f0d6..8e47b0b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scsi_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/scsi_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scsi_collapse_16px.png b/src/VBox/Frontends/VirtualBox/images/scsi_collapse_16px.png
index f7d1359..48f6c8d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scsi_collapse_16px.png and b/src/VBox/Frontends/VirtualBox/images/scsi_collapse_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/scsi_expand_16px.png b/src/VBox/Frontends/VirtualBox/images/scsi_expand_16px.png
index a8fe856..44ba1eb 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/scsi_expand_16px.png and b/src/VBox/Frontends/VirtualBox/images/scsi_expand_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/seamless_16px.png b/src/VBox/Frontends/VirtualBox/images/seamless_16px.png
index a224d2b..7fa11b1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/seamless_16px.png and b/src/VBox/Frontends/VirtualBox/images/seamless_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/seamless_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/seamless_disabled_16px.png
index cb927b5..2483266 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/seamless_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/seamless_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/seamless_on_16px.png b/src/VBox/Frontends/VirtualBox/images/seamless_on_16px.png
index f9a5776..3e9b03c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/seamless_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/seamless_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/seamless_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/seamless_on_disabled_16px.png
index b77c704..89b72f0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/seamless_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/seamless_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/select_file_16px.png b/src/VBox/Frontends/VirtualBox/images/select_file_16px.png
index c8a5193..a6e7ce2 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/select_file_16px.png and b/src/VBox/Frontends/VirtualBox/images/select_file_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/select_file_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/select_file_disabled_16px.png
index bc13339..3d9fb3d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/select_file_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/select_file_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/serial_port_16px.png b/src/VBox/Frontends/VirtualBox/images/serial_port_16px.png
index 2278187..5050867 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/serial_port_16px.png and b/src/VBox/Frontends/VirtualBox/images/serial_port_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/serial_port_24px.png b/src/VBox/Frontends/VirtualBox/images/serial_port_24px.png
new file mode 100644
index 0000000..ad31b8a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/serial_port_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/serial_port_32px.png b/src/VBox/Frontends/VirtualBox/images/serial_port_32px.png
index 09918d5..71a8a45 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/serial_port_32px.png and b/src/VBox/Frontends/VirtualBox/images/serial_port_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/serial_port_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/serial_port_disabled_16px.png
deleted file mode 100644
index 369b78c..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/serial_port_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/serial_port_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/serial_port_disabled_32px.png
deleted file mode 100644
index 02a2d56..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/serial_port_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/serial_port_read_16px.png b/src/VBox/Frontends/VirtualBox/images/serial_port_read_16px.png
deleted file mode 100644
index 6331540..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/serial_port_read_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/serial_port_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/serial_port_warning_16px.png
index c640a15..3e6038d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/serial_port_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/serial_port_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/serial_port_write_16px.png b/src/VBox/Frontends/VirtualBox/images/serial_port_write_16px.png
deleted file mode 100644
index e71a0e6..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/serial_port_write_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/session_info_16px.png b/src/VBox/Frontends/VirtualBox/images/session_info_16px.png
index 862819f..7d33cb1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/session_info_16px.png and b/src/VBox/Frontends/VirtualBox/images/session_info_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/session_info_32px.png b/src/VBox/Frontends/VirtualBox/images/session_info_32px.png
index c6e0c0e..9cd056a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/session_info_32px.png and b/src/VBox/Frontends/VirtualBox/images/session_info_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/session_info_details_16px.png b/src/VBox/Frontends/VirtualBox/images/session_info_details_16px.png
index 8c7160b..09bcf20 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/session_info_details_16px.png and b/src/VBox/Frontends/VirtualBox/images/session_info_details_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/session_info_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/session_info_disabled_16px.png
index 150414f..aeafe89 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/session_info_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/session_info_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/session_info_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/session_info_disabled_32px.png
deleted file mode 100644
index 25d9a19..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/session_info_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/session_info_runtime_16px.png b/src/VBox/Frontends/VirtualBox/images/session_info_runtime_16px.png
index 2d08d70..989b385 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/session_info_runtime_16px.png and b/src/VBox/Frontends/VirtualBox/images/session_info_runtime_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_16px.png
index 7baa6ef..6ad6a8e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_24px.png b/src/VBox/Frontends/VirtualBox/images/sf_24px.png
new file mode 100644
index 0000000..36a943c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/sf_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_32px.png b/src/VBox/Frontends/VirtualBox/images/sf_32px.png
index 1760f93..283e36a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_32px.png and b/src/VBox/Frontends/VirtualBox/images/sf_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_add_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_add_16px.png
index 464ab18..6804b75 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_add_disabled_16px.png
index fba7c4b..1fc004e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_disabled_16px.png
index 7d4efa8..f97fc11 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/sf_disabled_32px.png
deleted file mode 100644
index ea33472..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_edit_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_edit_16px.png
index 425a2ce..cd30f1f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_edit_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_edit_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_edit_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_edit_disabled_16px.png
index ffd7110..81509cf 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_edit_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_edit_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_read_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_read_16px.png
index f28a6f8..2b2ac5f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_read_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_read_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_remove_16px.png
index 7f6f17c..002431f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_remove_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_remove_disabled_16px.png
index a49bb88..c4f6312 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_remove_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_settings_16px.png
index a09ae00..0622a1c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_settings_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_settings_disabled_16px.png
index 331e8af..dc17fbb 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_settings_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_warning_16px.png
index 82077c0..79290f5 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sf_write_16px.png b/src/VBox/Frontends/VirtualBox/images/sf_write_16px.png
index 4b1b095..54453fc 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sf_write_16px.png and b/src/VBox/Frontends/VirtualBox/images/sf_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/shared_clipboard_16px.png b/src/VBox/Frontends/VirtualBox/images/shared_clipboard_16px.png
index 6e9272a..cc36294 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/shared_clipboard_16px.png and b/src/VBox/Frontends/VirtualBox/images/shared_clipboard_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/shared_clipboard_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/shared_clipboard_disabled_16px.png
index 7a7ca2a..dcfb409 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/shared_clipboard_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/shared_clipboard_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/site_16px.png b/src/VBox/Frontends/VirtualBox/images/site_16px.png
index 727a410..c184e59 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/site_16px.png and b/src/VBox/Frontends/VirtualBox/images/site_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/site_24px.png b/src/VBox/Frontends/VirtualBox/images/site_24px.png
new file mode 100644
index 0000000..2d28c90
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/site_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/site_32px.png b/src/VBox/Frontends/VirtualBox/images/site_32px.png
index b61e1bd..f5fb04c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/site_32px.png and b/src/VBox/Frontends/VirtualBox/images/site_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/site_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/site_disabled_16px.png
deleted file mode 100644
index 1d5101c..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/site_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/site_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/site_disabled_32px.png
deleted file mode 100644
index dfb47cd..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/site_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/site_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/site_warning_16px.png
index 15fee79..b0bd9fc 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/site_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/site_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_delete_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_delete_16px.png
index a0740cd..33fa0cd 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_delete_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_delete_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_delete_22px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_delete_22px.png
index 2be2413..0900875 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_delete_22px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_delete_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_delete_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_delete_disabled_16px.png
index 1e16dfe..68b6882 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_delete_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_delete_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_delete_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_delete_disabled_22px.png
index 5f7a63d..714028e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_delete_disabled_22px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_delete_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_offline_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_offline_16px.png
index c28a6ba..8d2d146 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_offline_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_offline_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_online_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_online_16px.png
index 6a82b59..9a139d4 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_online_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_online_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_restore_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_restore_16px.png
index 06b752f..866d5a1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_restore_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_restore_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_restore_22px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_restore_22px.png
index 3957d48..9f86137 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_restore_22px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_restore_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_restore_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_restore_disabled_16px.png
index db2723e..828eb54 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_restore_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_restore_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_restore_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_restore_disabled_22px.png
index 1f3f8ce..e7d55ef 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_restore_disabled_22px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_restore_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_16px.png
index cd46644..f025437 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_22px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_22px.png
index 3dc7552..076ad93 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_22px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_disabled_16px.png
index fdd89c9..d609cde 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_disabled_22px.png
index 5439933..0964c19 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_disabled_22px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_show_details_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_take_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_take_16px.png
index 2af6fe9..b94b9ba 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_take_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_take_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_take_22px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_take_22px.png
index df1249e..b287380 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_take_22px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_take_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_take_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_take_disabled_16px.png
index 6ec0091..6b58041 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_take_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_take_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/snapshot_take_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/snapshot_take_disabled_22px.png
index d1ffeb7..0cc1caf 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/snapshot_take_disabled_22px.png and b/src/VBox/Frontends/VirtualBox/images/snapshot_take_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sort_16px.png b/src/VBox/Frontends/VirtualBox/images/sort_16px.png
index 4a6d230..4a4afba 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sort_16px.png and b/src/VBox/Frontends/VirtualBox/images/sort_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sort_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/sort_disabled_16px.png
index 26f1e3e..03b5df3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sort_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/sort_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sound_16px.png b/src/VBox/Frontends/VirtualBox/images/sound_16px.png
index 576fbe4..72137b0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sound_16px.png and b/src/VBox/Frontends/VirtualBox/images/sound_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sound_24px.png b/src/VBox/Frontends/VirtualBox/images/sound_24px.png
new file mode 100644
index 0000000..4c5c4fb
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/sound_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sound_32px.png b/src/VBox/Frontends/VirtualBox/images/sound_32px.png
index b742c14..0bfa5e6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sound_32px.png and b/src/VBox/Frontends/VirtualBox/images/sound_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sound_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/sound_disabled_16px.png
deleted file mode 100644
index 1275e9d..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/sound_disabled_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sound_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/sound_disabled_32px.png
deleted file mode 100644
index 523ee7e..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/sound_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/sound_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/sound_warning_16px.png
index 274bae9..cc8ce9c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/sound_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/sound_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_aborted_16px.png b/src/VBox/Frontends/VirtualBox/images/state_aborted_16px.png
index 05f2d96..c6a35c1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_aborted_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_aborted_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_discarding_16px.png b/src/VBox/Frontends/VirtualBox/images/state_discarding_16px.png
index 4185dba..f51732c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_discarding_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_discarding_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_paused_16px.png b/src/VBox/Frontends/VirtualBox/images/state_paused_16px.png
index 2bac8b5..8664e44 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_paused_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_paused_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_powered_off_16px.png b/src/VBox/Frontends/VirtualBox/images/state_powered_off_16px.png
index dec00f8..4af2e22 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_powered_off_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_powered_off_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_restoring_16px.png b/src/VBox/Frontends/VirtualBox/images/state_restoring_16px.png
index 0be1b35..7d85384 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_restoring_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_restoring_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_running_16px.png b/src/VBox/Frontends/VirtualBox/images/state_running_16px.png
index ff03218..27cfcd5 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_running_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_running_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_saved_16px.png b/src/VBox/Frontends/VirtualBox/images/state_saved_16px.png
index 1afb5ac..ea22039 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_saved_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_saved_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_saving_16px.png b/src/VBox/Frontends/VirtualBox/images/state_saving_16px.png
index 7b3b2ae..6d23ed2 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_saving_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_saving_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/state_stuck_16px.png b/src/VBox/Frontends/VirtualBox/images/state_stuck_16px.png
index 24b7c1b..6157e49 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/state_stuck_16px.png and b/src/VBox/Frontends/VirtualBox/images/state_stuck_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/status_check_16px.png b/src/VBox/Frontends/VirtualBox/images/status_check_16px.png
index c53eac3..e05acde 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/status_check_16px.png and b/src/VBox/Frontends/VirtualBox/images/status_check_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/status_check_32px.png b/src/VBox/Frontends/VirtualBox/images/status_check_32px.png
deleted file mode 100644
index 88f38df..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/status_check_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/status_error_16px.png b/src/VBox/Frontends/VirtualBox/images/status_error_16px.png
index 4028519..734ddbf 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/status_error_16px.png and b/src/VBox/Frontends/VirtualBox/images/status_error_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/status_error_32px.png b/src/VBox/Frontends/VirtualBox/images/status_error_32px.png
deleted file mode 100644
index 24f307f..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/status_error_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/statusbar_16px.png b/src/VBox/Frontends/VirtualBox/images/statusbar_16px.png
new file mode 100644
index 0000000..9737463
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/statusbar_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/statusbar_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/statusbar_disabled_16px.png
new file mode 100644
index 0000000..3613887
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/statusbar_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/statusbar_on_16px.png b/src/VBox/Frontends/VirtualBox/images/statusbar_on_16px.png
new file mode 100644
index 0000000..67c7169
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/statusbar_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/statusbar_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/statusbar_on_disabled_16px.png
new file mode 100644
index 0000000..a8fe476
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/statusbar_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/statusbar_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/statusbar_settings_16px.png
new file mode 100644
index 0000000..bd3934a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/statusbar_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/statusbar_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/statusbar_settings_disabled_16px.png
new file mode 100644
index 0000000..d138771
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/statusbar_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/tpixel.png b/src/VBox/Frontends/VirtualBox/images/tpixel.png
index d137f16..b12c368 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/tpixel.png and b/src/VBox/Frontends/VirtualBox/images/tpixel.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/transparent_16px.png b/src/VBox/Frontends/VirtualBox/images/transparent_16px.png
deleted file mode 100644
index 36fb4cd..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/transparent_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/attachment_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/attachment_16px.png
new file mode 100644
index 0000000..1e442b6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/attachment_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/attachment_24px.png b/src/VBox/Frontends/VirtualBox/images/unused/attachment_24px.png
new file mode 100644
index 0000000..e31b113
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/attachment_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/attachment_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/attachment_disabled_16px.png
new file mode 100644
index 0000000..84c1d2d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/attachment_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_16px.png
new file mode 100644
index 0000000..d6b16d5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_16px_hidpi.png b/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_16px_hidpi.png
new file mode 100644
index 0000000..25d84e9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_16px_hidpi.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_disabled_16px.png
new file mode 100644
index 0000000..9c31015
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/auto_resize_off_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_22px.png
new file mode 100644
index 0000000..8b0a6e3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_24px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_24px.png
new file mode 100644
index 0000000..80cc799
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_32px.png
new file mode 100644
index 0000000..5d1e9bf
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_add_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_add_22px.png
new file mode 100644
index 0000000..2dedf47
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_add_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_add_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_add_disabled_22px.png
new file mode 100644
index 0000000..b01ef99
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_add_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_disabled_32px.png
new file mode 100644
index 0000000..9af77fe
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_new_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_new_16px.png
new file mode 100644
index 0000000..ec60a13
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_new_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_new_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_new_22px.png
new file mode 100644
index 0000000..bfe2df3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_new_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_new_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_new_disabled_16px.png
new file mode 100644
index 0000000..3ef0ac2
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_new_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/cd_new_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/cd_new_disabled_22px.png
new file mode 100644
index 0000000..cd2d905
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/cd_new_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/chipset_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/chipset_disabled_16px.png
new file mode 100644
index 0000000..50b4157
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/chipset_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/chipset_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/chipset_disabled_32px.png
new file mode 100644
index 0000000..06d14dc
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/chipset_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/close_red_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/close_red_16px.png
new file mode 100644
index 0000000..009a4da
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/close_red_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/description_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/description_disabled_16px.png
new file mode 100644
index 0000000..11a325d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/description_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/description_edit_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/description_edit_16px.png
new file mode 100644
index 0000000..07fb926
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/description_edit_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/description_edit_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/description_edit_disabled_16px.png
new file mode 100644
index 0000000..3421997
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/description_edit_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_16px.png
new file mode 100644
index 0000000..4a912a3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_22px.png
new file mode 100644
index 0000000..bbfc570
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_dis_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_dis_16px.png
new file mode 100644
index 0000000..88ac71a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_dis_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_dis_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_dis_22px.png
new file mode 100644
index 0000000..9fce20d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_dis_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_16px.png
new file mode 100644
index 0000000..62ffa69
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_22px.png
new file mode 100644
index 0000000..ccad47c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_dis_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_dis_16px.png
new file mode 100644
index 0000000..381ba69
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_dis_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_dis_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_dis_22px.png
new file mode 100644
index 0000000..3c4d75c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/discard_cur_state_snapshot_dis_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/diskimage_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/diskimage_disabled_32px.png
new file mode 100644
index 0000000..b5d8a2f
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/diskimage_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/eraser_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/eraser_disabled_16px.png
new file mode 100644
index 0000000..2f1f898
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/eraser_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_disabled_16px.png
new file mode 100644
index 0000000..fb36a14
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_disabled_32px.png
new file mode 100644
index 0000000..29309f1
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_install_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_install_32px.png
new file mode 100644
index 0000000..7d09a68
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_install_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_install_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_install_disabled_32px.png
new file mode 100644
index 0000000..094b8f5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_install_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_uninstall_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_uninstall_32px.png
new file mode 100644
index 0000000..9be2bb4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_uninstall_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_uninstall_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_uninstall_disabled_32px.png
new file mode 100644
index 0000000..436c522
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/extension_pack_uninstall_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_22px.png
new file mode 100644
index 0000000..1b93028
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_24px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_24px.png
new file mode 100644
index 0000000..e8a7bfe
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_32px.png
new file mode 100644
index 0000000..7586728
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_add_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_add_22px.png
new file mode 100644
index 0000000..b57bdee
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_add_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_add_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_add_disabled_22px.png
new file mode 100644
index 0000000..84bec06
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_add_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_disabled_32px.png
new file mode 100644
index 0000000..e8d8eb5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_new_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_new_16px.png
new file mode 100644
index 0000000..6fba009
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_new_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_new_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_new_22px.png
new file mode 100644
index 0000000..cc7043c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_new_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_new_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_new_disabled_16px.png
new file mode 100644
index 0000000..c03272a
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_new_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/fd_new_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/fd_new_disabled_22px.png
new file mode 100644
index 0000000..3e80e08
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/fd_new_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/global_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/global_settings_disabled_16px.png
new file mode 100644
index 0000000..4fda94c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/global_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/go_to_error_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/go_to_error_16px.png
new file mode 100644
index 0000000..f5d5008
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/go_to_error_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/go_to_error_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/go_to_error_disabled_16px.png
new file mode 100644
index 0000000..23da823
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/go_to_error_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/hd_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/hd_22px.png
new file mode 100644
index 0000000..893f4df
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/hd_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/hd_add_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/hd_add_22px.png
new file mode 100644
index 0000000..52ca063
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/hd_add_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/hd_add_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/hd_add_disabled_22px.png
new file mode 100644
index 0000000..ce7ac03
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/hd_add_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/hd_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/hd_disabled_32px.png
new file mode 100644
index 0000000..ae90929
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/hd_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/hd_new_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/hd_new_22px.png
new file mode 100644
index 0000000..f02972d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/hd_new_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/hd_new_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/hd_new_disabled_22px.png
new file mode 100644
index 0000000..c5c3252
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/hd_new_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/hostkey_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/hostkey_disabled_32px.png
new file mode 100644
index 0000000..eb5002d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/hostkey_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/list_movedown_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/list_movedown_22px.png
new file mode 100644
index 0000000..9e836ea
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/list_movedown_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/list_movedown_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/list_movedown_disabled_22px.png
new file mode 100644
index 0000000..e606dd9
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/list_movedown_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/list_moveup_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/list_moveup_22px.png
new file mode 100644
index 0000000..95af991
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/list_moveup_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/list_moveup_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/list_moveup_disabled_22px.png
new file mode 100644
index 0000000..e7db649
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/list_moveup_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/machine_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/machine_disabled_16px.png
new file mode 100644
index 0000000..f893334
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/machine_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/machine_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/machine_disabled_32px.png
new file mode 100644
index 0000000..7492318
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/machine_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/nw_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/nw_disabled_32px.png
new file mode 100644
index 0000000..8ec73d7
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/nw_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_disabled_16px.png
new file mode 100644
index 0000000..828b52d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_disabled_32px.png
new file mode 100644
index 0000000..277b37b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_read_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_read_16px.png
new file mode 100644
index 0000000..4dc2d51
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_read_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_write_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_write_16px.png
new file mode 100644
index 0000000..914dab8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/parallel_port_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/proxy_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/proxy_disabled_16px.png
new file mode 100644
index 0000000..3138b7b
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/proxy_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/proxy_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/proxy_disabled_32px.png
new file mode 100644
index 0000000..51fd352
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/proxy_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/register_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/register_16px.png
new file mode 100644
index 0000000..1423a90
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/register_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/register_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/register_32px.png
new file mode 100644
index 0000000..0473764
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/register_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/register_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/register_disabled_16px.png
new file mode 100644
index 0000000..b01de58
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/register_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/serial_port_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/serial_port_disabled_16px.png
new file mode 100644
index 0000000..3b3ddf5
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/serial_port_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/serial_port_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/serial_port_disabled_32px.png
new file mode 100644
index 0000000..4e90a0d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/serial_port_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/serial_port_read_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/serial_port_read_16px.png
new file mode 100644
index 0000000..ad76b78
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/serial_port_read_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/serial_port_write_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/serial_port_write_16px.png
new file mode 100644
index 0000000..dbd9223
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/serial_port_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/session_info_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/session_info_disabled_32px.png
new file mode 100644
index 0000000..f368db6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/session_info_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/sf_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/sf_disabled_32px.png
new file mode 100644
index 0000000..5209e50
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/sf_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/site_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/site_disabled_16px.png
new file mode 100644
index 0000000..cff660c
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/site_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/site_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/site_disabled_32px.png
new file mode 100644
index 0000000..d2648ef
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/site_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/sound_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/sound_disabled_16px.png
new file mode 100644
index 0000000..f8cb46d
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/sound_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/sound_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/sound_disabled_32px.png
new file mode 100644
index 0000000..03fb551
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/sound_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/status_check_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/status_check_32px.png
new file mode 100644
index 0000000..fdf56f6
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/status_check_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/status_error_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/status_error_32px.png
new file mode 100644
index 0000000..f9e1015
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/status_error_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/transparent_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/transparent_16px.png
new file mode 100644
index 0000000..9db8987
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/transparent_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/usb_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/usb_disabled_32px.png
new file mode 100644
index 0000000..eadb420
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/usb_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/video_capture_write_16px.png b/src/VBox/Frontends/VirtualBox/images/unused/video_capture_write_16px.png
new file mode 100644
index 0000000..7a73afa
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/video_capture_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/vm_add_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/vm_add_32px.png
new file mode 100644
index 0000000..9f4de92
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/vm_add_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/vm_new_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/vm_new_disabled_32px.png
new file mode 100644
index 0000000..38c7ab3
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/vm_new_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/vm_show_logs_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/vm_show_logs_22px.png
new file mode 100644
index 0000000..b9bfd67
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/vm_show_logs_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/vm_show_logs_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/unused/vm_show_logs_disabled_22px.png
new file mode 100644
index 0000000..6f4a953
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/vm_show_logs_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/unused/vrdp_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/unused/vrdp_disabled_32px.png
new file mode 100644
index 0000000..97be3b8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/unused/vrdp_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_16px.png
index d7a2608..74a8103 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_24px.png b/src/VBox/Frontends/VirtualBox/images/usb_24px.png
new file mode 100644
index 0000000..5e479b0
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/usb_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_32px.png b/src/VBox/Frontends/VirtualBox/images/usb_32px.png
index c5d2cca..76b63e3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_32px.png and b/src/VBox/Frontends/VirtualBox/images/usb_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_add_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_add_16px.png
index 0d0a3d8..7fabb6c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_add_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_add_disabled_16px.png
index 5687724..9220121 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_add_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_add_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_collapse_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_collapse_16px.png
new file mode 100644
index 0000000..c340736
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/usb_collapse_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_disabled_16px.png
index fb75546..7c82734 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/usb_disabled_32px.png
deleted file mode 100644
index 4092535..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_expand_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_expand_16px.png
new file mode 100644
index 0000000..805df96
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/usb_expand_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_filter_edit_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_filter_edit_16px.png
index c1d4851..d2a96b1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_filter_edit_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_filter_edit_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_filter_edit_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_filter_edit_disabled_16px.png
index 331e93b..a4ce19f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_filter_edit_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_filter_edit_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_movedown_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_movedown_16px.png
index b19730b..112052d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_movedown_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_movedown_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_movedown_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_movedown_disabled_16px.png
index 0821d10..1d41bf3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_movedown_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_movedown_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_moveup_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_moveup_16px.png
index 0236405..2c51d5e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_moveup_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_moveup_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_moveup_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_moveup_disabled_16px.png
index d405fdf..2fa8830 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_moveup_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_moveup_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_new_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_new_16px.png
index 0e4eaa4..3ecd22a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_new_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_new_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_new_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_new_disabled_16px.png
index 331e93b..c15af63 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_new_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_new_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_read_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_read_16px.png
index 508d8be..a2bbd02 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_read_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_read_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_remove_16px.png
index 76fd512..05ebd84 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_remove_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_remove_disabled_16px.png
index 9da5e4e..13f9603 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_remove_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_settings_16px.png
new file mode 100644
index 0000000..fa648aa
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/usb_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_settings_disabled_16px.png
new file mode 100644
index 0000000..2c69e46
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/usb_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_unavailable_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_unavailable_16px.png
index cde5f8c..3465424 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_unavailable_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_unavailable_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_unavailable_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_unavailable_disabled_16px.png
index f51e007..8cf3192 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_unavailable_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_unavailable_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_warning_16px.png
index a952151..abea4c6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/usb_write_16px.png b/src/VBox/Frontends/VirtualBox/images/usb_write_16px.png
index d0bdf6f..e9545b9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/usb_write_16px.png and b/src/VBox/Frontends/VirtualBox/images/usb_write_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/video_capture_16px.png b/src/VBox/Frontends/VirtualBox/images/video_capture_16px.png
index ac83b06..44fd230 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/video_capture_16px.png and b/src/VBox/Frontends/VirtualBox/images/video_capture_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/video_capture_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/video_capture_disabled_16px.png
index 87e4a86..cb57d4a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/video_capture_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/video_capture_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/video_capture_on_16px.png b/src/VBox/Frontends/VirtualBox/images/video_capture_on_16px.png
index 850a0a2..602a127 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/video_capture_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/video_capture_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/video_capture_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/video_capture_on_disabled_16px.png
index 1f3d99f..252db03 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/video_capture_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/video_capture_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/video_capture_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/video_capture_settings_16px.png
index 2051aa9..aa4012f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/video_capture_settings_16px.png and b/src/VBox/Frontends/VirtualBox/images/video_capture_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/video_capture_write_16px.png b/src/VBox/Frontends/VirtualBox/images/video_capture_write_16px.png
deleted file mode 100644
index 8b2201d..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/video_capture_write_16px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/virtual_screen_16px.png b/src/VBox/Frontends/VirtualBox/images/virtual_screen_16px.png
new file mode 100644
index 0000000..eb78553
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/virtual_screen_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/virtual_screen_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/virtual_screen_disabled_16px.png
new file mode 100644
index 0000000..edfafc4
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/virtual_screen_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_add_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_add_16px.png
index 9d27658..1d02134 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_add_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_add_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_add_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_add_32px.png
deleted file mode 100644
index f2f1f9a..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_add_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_clone_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_clone_16px.png
index eefb58e..868e4c3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_clone_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_clone_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_clone_22px.png b/src/VBox/Frontends/VirtualBox/images/vm_clone_22px.png
index 8d6f380..79b5fe9 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_clone_22px.png and b/src/VBox/Frontends/VirtualBox/images/vm_clone_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_clone_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_clone_disabled_16px.png
index a35a60f..65e562a 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_clone_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_clone_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_clone_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/vm_clone_disabled_22px.png
index e7119b5..4a7ae0c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_clone_disabled_22px.png and b/src/VBox/Frontends/VirtualBox/images/vm_clone_disabled_22px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_create_shortcut_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_create_shortcut_16px.png
index 87a5b71..2bcfe58 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_create_shortcut_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_create_shortcut_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_create_shortcut_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_create_shortcut_disabled_16px.png
index c39e733..341e76b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_create_shortcut_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_create_shortcut_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_delete_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_delete_16px.png
index f4c661b..e06cb52 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_delete_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_delete_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_delete_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_delete_32px.png
index 1d04f22..cb6ffa5 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_delete_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_delete_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_delete_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_delete_disabled_16px.png
index 858a835..7005418 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_delete_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_delete_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_delete_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_delete_disabled_32px.png
index ec04541..dd26d9d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_delete_disabled_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_delete_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_discard_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_discard_16px.png
index 6553b27..b19c599 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_discard_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_discard_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_discard_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_discard_32px.png
index 61d0c06..43a6cc2 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_discard_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_discard_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_discard_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_discard_disabled_16px.png
index 1ddbbb0..b642f80 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_discard_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_discard_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_discard_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_discard_disabled_32px.png
index 24ece6d..a771e27 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_discard_disabled_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_discard_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_group_create_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_group_create_16px.png
index 783a8a7..4df53da 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_group_create_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_group_create_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_group_create_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_group_create_disabled_16px.png
index e5648a2..f6ae1d1 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_group_create_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_group_create_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_group_name_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_group_name_16px.png
index df12483..4be73fd 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_group_name_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_group_name_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_group_name_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_group_name_disabled_16px.png
index e5648a2..45d21c6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_group_name_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_group_name_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_group_remove_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_group_remove_16px.png
index 6a2c1a0..f126fc8 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_group_remove_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_group_remove_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_group_remove_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_group_remove_disabled_16px.png
index 525e982..52fc771 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_group_remove_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_group_remove_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_new_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_new_16px.png
index 3d3d53f..900e6a3 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_new_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_new_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_new_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_new_32px.png
index 7deadd4..8d66df4 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_new_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_new_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_new_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_new_disabled_32px.png
deleted file mode 100644
index 8c72617..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_new_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_open_filemanager_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_open_filemanager_16px.png
index bdb5aef..43ecf01 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_open_filemanager_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_open_filemanager_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_open_filemanager_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_open_filemanager_disabled_16px.png
index c0c91e1..d9e3e98 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_open_filemanager_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_open_filemanager_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_pause_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_pause_16px.png
index b69b1d8..eea3a06 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_pause_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_pause_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_pause_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_pause_32px.png
index d005e17..9a76940 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_pause_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_pause_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_pause_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_pause_disabled_16px.png
index 84f3f6d..bae3518 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_pause_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_pause_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_pause_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_pause_disabled_32px.png
index e5c1272..d26e239 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_pause_disabled_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_pause_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_pause_on_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_pause_on_16px.png
index 95e2b7d..dc4148b 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_pause_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_pause_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_pause_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_pause_on_disabled_16px.png
index 181b6ab..2a8e033 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_pause_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_pause_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_poweroff_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_poweroff_16px.png
index 3794269..92bab41 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_poweroff_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_poweroff_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_poweroff_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_poweroff_disabled_16px.png
index 1429381..14395ff 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_poweroff_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_poweroff_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_reset_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_reset_16px.png
index f605317..66f9d68 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_reset_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_reset_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_reset_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_reset_disabled_16px.png
index 17cfa4f..0fe1c89 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_reset_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_reset_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_save_state_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_save_state_16px.png
index 3b1c06f..cbfcc6d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_save_state_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_save_state_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_save_state_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_save_state_disabled_16px.png
index 246ebf8..296adc5 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_save_state_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_save_state_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_settings_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_settings_16px.png
index c70deeb..69d5cfa 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_settings_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_settings_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_settings_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_settings_32px.png
index d6c6f64..a99bd59 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_settings_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_settings_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_settings_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_settings_disabled_16px.png
index 052bb4b..cfc1032 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_settings_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_settings_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_settings_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_settings_disabled_32px.png
index 9cd13bc..e1c2fc6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_settings_disabled_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_settings_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_16px.png
index 6af70fc..4f51698 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_22px.png b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_22px.png
deleted file mode 100644
index da85acd..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_32px.png
index 631ab83..47ec974 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_16px.png
index 5c55d2a..6ed71b6 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_22px.png b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_22px.png
deleted file mode 100644
index d0ba707..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_22px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_32px.png
index be4c977..81cc3c5 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_show_logs_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_shutdown_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_shutdown_16px.png
index dec00f8..64e0793 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_shutdown_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_shutdown_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_shutdown_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_shutdown_disabled_16px.png
index da2dd9f..b66fc57 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_shutdown_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_shutdown_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_start_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_start_16px.png
index ff03218..ae5e2eb 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_start_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_start_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_start_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_start_32px.png
index 9916b8c..e7a8426 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_start_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_start_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_start_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vm_start_disabled_16px.png
index 31ccd27..0a2f2ae 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_start_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vm_start_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vm_start_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/vm_start_disabled_32px.png
index 6c72051..1a58afd 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vm_start_disabled_32px.png and b/src/VBox/Frontends/VirtualBox/images/vm_start_disabled_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_clone.png b/src/VBox/Frontends/VirtualBox/images/vmw_clone.png
index 79dcf61..dd7488d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_clone.png and b/src/VBox/Frontends/VirtualBox/images/vmw_clone.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_clone_bg.png b/src/VBox/Frontends/VirtualBox/images/vmw_clone_bg.png
index 2872b1c..69ce138 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_clone_bg.png and b/src/VBox/Frontends/VirtualBox/images/vmw_clone_bg.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_first_run.png b/src/VBox/Frontends/VirtualBox/images/vmw_first_run.png
index 3639e48..56fea1c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_first_run.png and b/src/VBox/Frontends/VirtualBox/images/vmw_first_run.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_first_run_bg.png b/src/VBox/Frontends/VirtualBox/images/vmw_first_run_bg.png
index 9ad040a..580685c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_first_run_bg.png and b/src/VBox/Frontends/VirtualBox/images/vmw_first_run_bg.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_new_harddisk.png b/src/VBox/Frontends/VirtualBox/images/vmw_new_harddisk.png
index 9406264..5b7300c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_new_harddisk.png and b/src/VBox/Frontends/VirtualBox/images/vmw_new_harddisk.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_new_harddisk_bg.png b/src/VBox/Frontends/VirtualBox/images/vmw_new_harddisk_bg.png
index 3d639bd..cd18c79 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_new_harddisk_bg.png and b/src/VBox/Frontends/VirtualBox/images/vmw_new_harddisk_bg.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_new_user.png b/src/VBox/Frontends/VirtualBox/images/vmw_new_user.png
index bcea626..0256c29 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_new_user.png and b/src/VBox/Frontends/VirtualBox/images/vmw_new_user.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_new_user_bg.png b/src/VBox/Frontends/VirtualBox/images/vmw_new_user_bg.png
index b8169cf..ddc4915 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_new_user_bg.png and b/src/VBox/Frontends/VirtualBox/images/vmw_new_user_bg.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_new_welcome.png b/src/VBox/Frontends/VirtualBox/images/vmw_new_welcome.png
index 31cef39..24ebba0 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_new_welcome.png and b/src/VBox/Frontends/VirtualBox/images/vmw_new_welcome.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_new_welcome_bg.png b/src/VBox/Frontends/VirtualBox/images/vmw_new_welcome_bg.png
index 4d1fc60..e90c04c 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_new_welcome_bg.png and b/src/VBox/Frontends/VirtualBox/images/vmw_new_welcome_bg.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_ovf_export.png b/src/VBox/Frontends/VirtualBox/images/vmw_ovf_export.png
index 6dc23ec..8171fac 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_ovf_export.png and b/src/VBox/Frontends/VirtualBox/images/vmw_ovf_export.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_ovf_export_bg.png b/src/VBox/Frontends/VirtualBox/images/vmw_ovf_export_bg.png
index 52ce84d..00ac48f 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_ovf_export_bg.png and b/src/VBox/Frontends/VirtualBox/images/vmw_ovf_export_bg.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_ovf_import.png b/src/VBox/Frontends/VirtualBox/images/vmw_ovf_import.png
index 0f22de1..35a7b73 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_ovf_import.png and b/src/VBox/Frontends/VirtualBox/images/vmw_ovf_import.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vmw_ovf_import_bg.png b/src/VBox/Frontends/VirtualBox/images/vmw_ovf_import_bg.png
index 873f262..4fade37 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vmw_ovf_import_bg.png and b/src/VBox/Frontends/VirtualBox/images/vmw_ovf_import_bg.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vrdp_16px.png b/src/VBox/Frontends/VirtualBox/images/vrdp_16px.png
index 2125720..cabf5f4 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vrdp_16px.png and b/src/VBox/Frontends/VirtualBox/images/vrdp_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vrdp_24px.png b/src/VBox/Frontends/VirtualBox/images/vrdp_24px.png
new file mode 100644
index 0000000..4247292
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/vrdp_24px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vrdp_32px.png b/src/VBox/Frontends/VirtualBox/images/vrdp_32px.png
index 63b0404..f8ac2cd 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vrdp_32px.png and b/src/VBox/Frontends/VirtualBox/images/vrdp_32px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vrdp_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vrdp_disabled_16px.png
index 6ea7df2..a4156c7 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vrdp_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vrdp_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vrdp_disabled_32px.png b/src/VBox/Frontends/VirtualBox/images/vrdp_disabled_32px.png
deleted file mode 100644
index 42a02f5..0000000
Binary files a/src/VBox/Frontends/VirtualBox/images/vrdp_disabled_32px.png and /dev/null differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vrdp_on_16px.png b/src/VBox/Frontends/VirtualBox/images/vrdp_on_16px.png
index cc467d1..03d1236 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vrdp_on_16px.png and b/src/VBox/Frontends/VirtualBox/images/vrdp_on_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vrdp_on_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vrdp_on_disabled_16px.png
index 5210ed7..bd7fbc5 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vrdp_on_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vrdp_on_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vrdp_warning_16px.png b/src/VBox/Frontends/VirtualBox/images/vrdp_warning_16px.png
index 64c4226..c203026 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vrdp_warning_16px.png and b/src/VBox/Frontends/VirtualBox/images/vrdp_warning_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vtx_amdv_16px.png b/src/VBox/Frontends/VirtualBox/images/vtx_amdv_16px.png
index a17da88..1a41b85 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vtx_amdv_16px.png and b/src/VBox/Frontends/VirtualBox/images/vtx_amdv_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/vtx_amdv_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/vtx_amdv_disabled_16px.png
index 9391b07..e19764e 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/vtx_amdv_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/vtx_amdv_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/web_camera_16px.png b/src/VBox/Frontends/VirtualBox/images/web_camera_16px.png
index f59ab31..b1f8cee 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/web_camera_16px.png and b/src/VBox/Frontends/VirtualBox/images/web_camera_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/web_camera_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/web_camera_disabled_16px.png
index 530e084..fa7337d 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/web_camera_disabled_16px.png and b/src/VBox/Frontends/VirtualBox/images/web_camera_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/web_camera_unavailable_16px.png b/src/VBox/Frontends/VirtualBox/images/web_camera_unavailable_16px.png
new file mode 100644
index 0000000..2316b85
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/web_camera_unavailable_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/web_camera_unavailable_disabled_16px.png b/src/VBox/Frontends/VirtualBox/images/web_camera_unavailable_disabled_16px.png
new file mode 100644
index 0000000..af68fd8
Binary files /dev/null and b/src/VBox/Frontends/VirtualBox/images/web_camera_unavailable_disabled_16px.png differ
diff --git a/src/VBox/Frontends/VirtualBox/images/welcome.png b/src/VBox/Frontends/VirtualBox/images/welcome.png
index 3c85db5..bca54a5 100644
Binary files a/src/VBox/Frontends/VirtualBox/images/welcome.png and b/src/VBox/Frontends/VirtualBox/images/welcome.png differ
diff --git a/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk b/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk
index d0bc9c0..9c43eaf 100644
--- a/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk
+++ b/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk
@@ -25,7 +25,6 @@ VBOX_APPROVED_GUI_LANGUAGES := \
 	de    \
 	en    \
 	es    \
-	eu    \
 	fa_IR \
 	fr    \
 	hu    \
@@ -36,7 +35,6 @@ VBOX_APPROVED_GUI_LANGUAGES := \
 	nl    \
 	pt_BR \
 	ru    \
-	sv    \
 	tr    \
 	uk    \
 	zh_CN \
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_bg.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_bg.ts
index 8b11db2..14e4952 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_bg.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_bg.ts
@@ -162,7 +162,7 @@
     <name>QILabelPrivate</name>
     <message>
         <source>&Copy</source>
-        <translation type="obsolete">&Копирай</translation>
+        <translation type="obsolete">&Копиране</translation>
     </message>
 </context>
 <context>
@@ -185,7 +185,7 @@
     </message>
     <message>
         <source>Ignore</source>
-        <translation type="obsolete">Игнорирай</translation>
+        <translation type="obsolete">Игнориране</translation>
     </message>
     <message>
         <source>&Details</source>
@@ -248,7 +248,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Без&рамков режим</translation>
+        <translation>Без&рамков режим</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -272,11 +272,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Забрана &интеграцията на мишката</translation>
+        <translation type="obsolete">Забрана &интеграцията на мишката</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Временно забранява интеграцията на показалеца на мишката от реалната машина</translation>
+        <translation type="obsolete">Временно забранява интеграцията на показалеца на мишката от реалната машина</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -288,11 +288,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Изпълнение на Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&Изпълнение на Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Изпраща комбинацията Ctrl-Alt-Del към виртуалната машина</translation>
+        <translation type="obsolete">Изпраща комбинацията Ctrl-Alt-Del към виртуалната машина</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -300,7 +300,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Изпраща комбинацията Ctrl-Alt-Backspace към виртуалната машина</translation>
+        <translation type="obsolete">Изпраща комбинацията Ctrl-Alt-Backspace към виртуалната машина</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -315,8 +315,8 @@
         <translation type="obsolete">Информационен д&иалог на сесията</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Показване информационния диалог на сесията</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Показване информационния диалог на сесията</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -364,15 +364,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD устройства</translation>
+        <translation type="obsolete">&CD/DVD устройства</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Флопи устройства</translation>
+        <translation type="obsolete">&Флопи устройства</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB устройства</translation>
+        <translation type="obsolete">&USB устройства</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -399,12 +399,12 @@
         <translation type="obsolete">Позволява или забранява връзки за отдалечен работен плот (RDP) към тази машина</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">&Инсталиране на Виртуални Добавки...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Инсталиране на Виртуални Добавки...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Монтиране на инсталационното изображение Виртуални Добавки</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Монтиране на инсталационното изображение Виртуални Добавки</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -423,7 +423,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">&Водене на записки...</translation>
+        <translation type="obsolete">&Водене на записки...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -501,15 +501,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Превключване в режим на &цял екран</translation>
+        <translation type="obsolete">Превключване в режим на &цял екран</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Превключване между нормален режим и на цял екран</translation>
+        <translation type="obsolete">Превключване между нормален режим и на цял екран</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Превключване в &безрамков режим</translation>
+        <translation type="obsolete">Превключване в &безрамков режим</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -517,7 +517,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Превключване в режим на &наместване</translation>
+        <translation type="obsolete">Превключване в режим на &наместване</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -597,7 +597,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Вм&ъкване на Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">Вм&ъкване на Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>&File</source>
@@ -892,69 +892,294 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Влачене и пускане</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation type="unfinished"></translation>
+        <translation>Запазване състоянието на виртуалната машина</translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation type="unfinished"></translation>
+        <translation>Изключване на виртуалната машина</translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation type="unfinished"></translation>
+        <translation>&Мрежови настройки...</translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation type="unfinished"></translation>
+        <translation>Настройки на &споделени папки...</translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation type="unfinished"></translation>
+        <translation>Отдалечен работен п&лот</translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation type="unfinished"></translation>
+        <translation>Позволява връзки за отдалечен работен плот (RDP) към тази машина</translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation type="unfinished"></translation>
+        <translation>&Видео заснемане</translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation type="unfinished"></translation>
+        <translation>Превключване на видео заснемане</translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation type="unfinished"></translation>
+        <translation>Настройки за &видео заснемане...</translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation type="unfinished"></translation>
+        <translation>Настройване на видео заснемане</translation>
     </message>
     <message>
         <source>Popup Menu</source>
-        <translation type="unfinished"></translation>
+        <translation>Изскачащо меню</translation>
+    </message>
+    <message>
+        <source>Show Session Information Window</source>
+        <translation>Показване информационния диалог на сесията</translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation>&Уеб камери</translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Инсталиране на Виртуални Добавки...</translation>
+        <translation>&Инсталиране на Виртуални Добавки...</translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Монтиране на инсталационното изображение Виртуални Добавки</translation>
+        <translation>Вкарване на диска Виртуални Добавки във виртуалното устройство</translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation type="unfinished"></translation>
+        <source>&VirtualBox</source>
+        <translation>&VirtualBox</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>&Меню лента</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>Настройки на &меню лента...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>Отваря диалог за настройка на меню лентата</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>Показване на меню &лентата</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>Превключва видимостта на меню лентата за тази машина</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>&Статус лента</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>Настройки на &статус лента...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>Отваря диалог за настройка на статус лентата</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>Показване на статус &лентата</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>Превключва видимостта на статус лентата за тази машина</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>&Въвеждане</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>&Клавиатура</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>Настройки на &клавиатура...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>Показване на прозореца с глобални настройки за настройка на клавишните комбинации</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>&Мишка</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>&Твърди дискове</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>Настройки на &твърди дискове...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>Промяна настройките на твърдите дискове</translation>
     </message>
     <message>
         <source>Network</source>
-        <translation type="unfinished">Мрежа</translation>
+        <translation>Мрежа</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>&USB настройки...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>Промяна настройките на USB устройствата</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>&Споделени папки</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>Показване на &записки...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation>Е&кстра Данни Управление...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>Показва прозореца на Екстра Данни Управление</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>&Файл</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation>&Прозорец</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>&Минимизиране</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>Минимизиране на активния прозорец на машината</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>&Режим на цял екран</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>Превключване между нормален режим и на цял екран</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>Ма&щабиран режим</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>Фактор на ма&щаба</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>&Вмъкване на %1</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>Изпращане на комбинацията %1 към виртуалната машина</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>Интеграция на &мишка</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>Позволяване интеграция на показалеца на мишката от реалната машина</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>&Оптични устройства</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>&Флопи устройства</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation>&USB</translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>Влачене и пускане</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>&Водене на записки</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation>&Нормално стартиране</translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation>Стартиране &без изглед</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation>Стартира избраната виртуална машина във фон</translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation>Стартиране с &подвижност</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation>Стартира избраната виртуална машина с опция на по-късен етап да се премести във фон</translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>Включване</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>Преоразмеряване към %1x%2</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation>%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - Криптиране на диск</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>Тази виртуална машина е защитена с парола. Моля, въведете %n парола на криптирането по-долу.</numerusform>
+            <numerusform>Тази виртуална машина е защитена с парола. Моля, въведете %n пароли на криптирането по-долу.</numerusform>
+        </translation>
     </message>
 </context>
 <context>
@@ -1116,7 +1341,7 @@
     <name>UICloneVMWizardPage1</name>
     <message>
         <source><p>This wizard will help you to create a clone of your virtual machine.</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви помогне да създадете клонинг на вашата виртуална машина.</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви помогне да създадете клонинг на вашата виртуална машина.</p></translation>
     </message>
     <message>
         <source><p>Please choose a name for the new virtual machine:</p></source>
@@ -1187,7 +1412,7 @@
     </message>
     <message>
         <source><p>Please select the type of the clone.</p><p>If you choose <b>Full Clone</b> an exact copy (including all virtual disk images) of the original VM will be created. If you select <b>Linked Clone</b>, a new VM will be created, but the virtual disk images will point to the virtual disk images of original VM.</p></source>
-        <translation type="obsolete"><p>Моля, изберете типа на клонирането.</p><p>Ако изберете <b>Пълно клониране</b>, ще бъде създадено точно копие (включващо всички изображения на виртуални дискове) на оригиналната ВМ, а ако изберете <b>Свързано клониране</b>, ще бъде създадена нова ВМ, но изображенията на виртуалните дискове ще сочат към изображенията на виртуалните дискове на оригиналната ВМ.</p></translation>
+        <translation type="obsolete"><p>Моля, изберете типа на клонирането!</p><p>Ако изберете <b>Пълно клониране</b>, ще бъде създадено точно копие (включващо всички изображения на виртуални дискове) на оригиналната ВМ, а ако изберете <b>Свързано клониране</b>, ще бъде създадена нова ВМ, но изображенията на виртуалните дискове ще сочат към изображенията на виртуалните дискове на оригиналната ВМ.</p></translation>
     </message>
     <message>
         <source><p>Note that a new snapshot within the source VM is created in case you select <b>Linked Clone</b>.</p></source>
@@ -1773,6 +1998,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation>Извличане на данни ...</translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1783,7 +2015,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Отпадане на данни...</translation>
+        <translation type="obsolete">Отпадане на данни...</translation>
     </message>
 </context>
 <context>
@@ -1855,6 +2087,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation>Статус</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation>ID</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>Парола</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>Използва се от следния %n твърд диск:</nobr><br>%1</numerusform>
+            <numerusform><nobr>Използва се от следните %n твърди дискове:</nobr><br>%1</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -1888,7 +2146,7 @@ p, li { white-space: pre-wrap; }
 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This wizard will guide you through the process of exporting an appliance. </p>
 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Use the <span style=" font-weight:600;">Next</span> button to go the next page of the wizard and the <span style=" font-weight:600;">Back</span> button to return to the previous page.</p>
 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please select the virtual machines that you wish to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.</p></body></html></source>
-        <translation type="obsolete"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body><p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Т [...]
+        <translation type="obsolete"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body><p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Т [...]
     </message>
     <message>
         <source>< &Back</source>
@@ -1999,7 +2257,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>This wizard will guide you through the process of exporting an appliance.</p><p>%1</p><p>Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви води през процеса на изнасяне на приспособление.</p><p>%1</p><p>Моля, изберете виртуалните машини, които ще бъдат добавени към приспособлението. Можете да изберете повече от една. Имайте предвид, че тези машини трябва да бъдат изключени преди да бъде възможно изнасянето им.</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви води през процеса на изнасяне на приспособление.</p><p>%1</p><p>Моля, изберете виртуалните машини, които ще бъдат добавени към приспособлението. Можете да изберете повече от една. Имайте предвид, че тези машини трябва да бъдат изключени преди да бъде възможно изнасянето им.</p></translation>
     </message>
 </context>
 <context>
@@ -2033,7 +2291,7 @@ p, li { white-space: pre-wrap; }
     <name>UIExportApplianceWzdPage3</name>
     <message>
         <source>Please specify the target for the OVF export. You can choose between a local file system export, uploading the OVF to the Sun Cloud service or an S3 storage server.</source>
-        <translation type="obsolete">Моля, укажете местоположение за изнасяне към OVF. Имате избор между изнасяне към локалната файлова система, качване на OVF към услугата Sun Cloud или S3 сървър за съхранение.</translation>
+        <translation type="obsolete">Моля, укажете местоположение за изнасяне към OVF! Имате избор между изнасяне към локалната файлова система, качване на OVF към услугата Sun Cloud или S3 сървър за съхранение.</translation>
     </message>
     <message>
         <source>&Local Filesystem </source>
@@ -2199,7 +2457,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You have started a newly created virtual machine for the first time. This wizard will help you to perform the steps necessary for installing an operating system of your choice onto this virtual machine.</p><p>Use the <b>Next</b> button to go to the next page of the wizard and the <b>Back</b> button to return to the previous page. You can also press <b>Cancel</b> if you want to cancel the execution of this wizard.&lt [...]
-        <translation type="obsolete"><p>Стартирали сте новосъздадена виртуална машина за пръв път. Този помощник ще ви помогне да завършите стъпките, необходими за инсталирането на операционна система според вашия избор на тази виртуална машина.</p><p>Използвайте бутона <b>Напред</b>, за да отидете към следващата страница на помощника, и бутона <b>Назад</b>, за да се върнете към предишната страница. Също така, можете да натиснете бутона <b> [...]
+        <translation type="obsolete"><p>Стартирали сте новосъздадена виртуална машина за пръв път. Този помощник ще Ви помогне да завършите стъпките, необходими за инсталирането на операционна система според вашия избор на тази виртуална машина.</p><p>Използвайте бутона <b>Напред</b>, за да отидете към следващата страница на помощника, и бутона <b>Назад</b>, за да се върнете към предишната страница. Също така, можете да натиснете бутона <b> [...]
     </message>
     <message>
         <source>Welcome to the First Run Wizard!</source>
@@ -2263,7 +2521,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You have started a newly created virtual machine for the first time. This wizard will help you to perform the steps necessary for booting an operating system of your choice on the virtual machine.</p><p>Note that you will not be able to install an operating system into this virtual machine right now because you did not attach any hard disk to it. If this is not what you want, you can cancel the execution of this wizard, select <b>Settings</b& [...]
-        <translation type="obsolete"><p>Стартирали сте новосъздадена виртуална машина за пръв път. Този помощник ще ви помогне да завършите стъпките, необходими за зареждането на операционна система според вашия избор на виртуалната машина.</p><p>Имайте предвид, че няма да можете да инсталирате операционна система на тази виртуална машина в момента, тъй като не сте закачили твърд диск към нея. Ако това не е, което искате, можете да откажете изпълнението на този помощник [...]
+        <translation type="obsolete"><p>Стартирали сте новосъздадена виртуална машина за пръв път. Този помощник ще Ви помогне да завършите стъпките, необходими за зареждането на операционна система според вашия избор на виртуалната машина.</p><p>Имайте предвид, че няма да можете да инсталирате операционна система на тази виртуална машина в момента, тъй като не сте закачили твърд диск към нея. Ако това не е, което искате, можете да откажете изпълнението на този помощник [...]
     </message>
     <message>
         <source><p>Select the type of media you would like to use for booting an operating system.</p></source>
@@ -2297,7 +2555,7 @@ p, li { white-space: pre-wrap; }
 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.</p>
 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Depending on the type of the setup program, you may need to manually unmount (eject) the media after the setup program reboots the virtual machine, to prevent the installation process from starting again. You can do this by selecting the corresponding <span style=" font-weight:600;">Unmount...</span> action in the <span style=&q [...]
         <translation type="obsolete"><html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; </style></head><body style=" font-family:'Arial'; font-size:9pt; font-weight:400; font-style:normal;"><p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ако информацията по-горе е вярна, натиснете бутона <span style=" font-weight:600;">Край</span> . След като го натиснете, избраният диск ще бъде временно монтиран  [...]
+p, li { white-space: pre-wrap; </style></head><body style=" font-family:'Arial'; font-size:9pt; font-weight:400; font-style:normal;"><p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ако информацията по-горе е вярна, натиснете бутона <span style=" font-weight:600;">Край</span> . След като го натиснете, избраният диск ще бъде временно монтиран  [...]
     </message>
     <message>
         <source>&Finish</source>
@@ -2319,7 +2577,7 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.</p><p>Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.</p><p>Depending on the type of the setup program, you may need to manually  [...]
-        <translation type="obsolete"><p>Ако по-горното е вярно, натиснете бутона <b>Край</b>. След като го натиснете, избраният диск ще бъде временно монтиран във виртуалната машина и машината ще се включи.</p><p>Моля, имайте предвид, че когато затворите виртуалната машина, избраният диск ще бъде демонтиран автоматично и зареждащото устройство ще бъде зададено отново към първия твърд диск.</p><p>В зависимост от вида на инсталиращата програма, мож [...]
+        <translation type="obsolete"><p>Ако по-горното е вярно, натиснете бутона <b>Край</b>. След като го натиснете, избраният диск ще бъде временно монтиран във виртуалната машина и машината ще се включи.</p><p>Моля имайте предвид, че когато затворите виртуалната машина, избраният диск ще бъде демонтиран автоматично и зареждащото устройство ще бъде зададено отново към първия твърд диск.</p><p>В зависимост от вида на инсталиращата програма, може [...]
     </message>
     <message>
         <source>Start</source>
@@ -2334,11 +2592,11 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source><p>You have started a newly created virtual machine for the first time. This wizard will help you to perform the steps necessary for installing an operating system of your choice onto this virtual machine.</p><p>%1</p></source>
-        <translation type="obsolete"><p>Включили сте новосъздадена виртуална машина за първи път. Този помощник ще ви помогне да изпълните стъпките по инсталиране на операционна система по ваш избор в тази виртуална машина.</p><p>%1</p></translation>
+        <translation type="obsolete"><p>Включили сте новосъздадена виртуална машина за първи път. Този помощник ще Ви помогне да изпълните стъпките по инсталиране на операционна система по ваш избор в тази виртуална машина.</p><p>%1</p></translation>
     </message>
     <message>
         <source><p>You have started a newly created virtual machine for the first time. This wizard will help you to perform the steps necessary for booting an operating system of your choice on the virtual machine.</p><p>Note that you will not be able to install an operating system into this virtual machine right now because you did not attach any hard disk to it. If this is not what you want, you can cancel the execution of this wizard, select <b>Settings</b& [...]
-        <translation type="obsolete"><p>Включили сте новосъздадена виртуална машина за първи път. Този помощник ще ви помогне да изпълните стъпките, необходими за зареждането на операционна система по ваш избор във виртуалната машина.</p><p>Забележете, че няма да можете да инсталирате операционна система в тази виртуална машина в този момент, тъй като не сте закачили твърд диск към нея. Ако това не е вашето желание, можете да прекъснете изпълнението на помощника, да изб [...]
+        <translation type="obsolete"><p>Включили сте новосъздадена виртуална машина за първи път. Този помощник ще Ви помогне да изпълните стъпките, необходими за зареждането на операционна система по ваш избор във виртуалната машина.</p><p>Забележете, че няма да можете да инсталирате операционна система в тази виртуална машина в този момент, тъй като не сте закачили твърд диск към нея. Ако това не е вашето желание, можете да прекъснете изпълнението на помощника, да изб [...]
     </message>
 </context>
 <context>
@@ -2372,7 +2630,7 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.</p><p>Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.</p><p>Depending on the type of the setup program, you may need to manually  [...]
-        <translation type="obsolete"><p>Ако по-горното е вярно, натиснете бутона <b>Край</b>. След като го натиснете, избраният диск ще бъде временно монтиран във виртуалната машина и машината ще се включи.</p><p>Моля, имайте предвид, че когато затворите виртуалната машина, избраният диск ще бъде демонтиран автоматично и зареждащото устройство ще бъде зададено отново към първия твърд диск.</p><p>В зависимост от вида на инсталиращата програма, мож [...]
+        <translation type="obsolete"><p>Ако по-горното е вярно, натиснете бутона <b>Край</b>. След като го натиснете, избраният диск ще бъде временно монтиран във виртуалната машина и машината ще се включи.</p><p>Моля имайте предвид, че когато затворите виртуалната машина, избраният диск ще бъде демонтиран автоматично и зареждащото устройство ще бъде зададено отново към първия твърд диск.</p><p>В зависимост от вида на инсталиращата програма, може [...]
     </message>
     <message>
         <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be mounted on the virtual machine and the machine will start execution.</p></source>
@@ -2402,62 +2660,62 @@ p, li { white-space: pre-wrap; </style></head><body style="
     <message>
         <source><b>%1</b></source>
         <comment>Group item tool-tip / Group name</comment>
-        <translation type="unfinished"></translation>
+        <translation><b>%1</b></translation>
     </message>
     <message numerus="yes">
         <source>%n group(s)</source>
         <comment>Group item tool-tip / Group info</comment>
-        <translation type="unfinished">
-            <numerusform></numerusform>
-            <numerusform></numerusform>
+        <translation>
+            <numerusform>%n група</numerusform>
+            <numerusform>%n групи</numerusform>
         </translation>
     </message>
     <message>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Group info wrapper</comment>
-        <translation type="unfinished"><nobr>%1</nobr></translation>
+        <translation><nobr>%1</nobr></translation>
     </message>
     <message numerus="yes">
         <source>%n machine(s)</source>
         <comment>Group item tool-tip / Machine info</comment>
-        <translation type="unfinished">
-            <numerusform></numerusform>
-            <numerusform></numerusform>
+        <translation>
+            <numerusform>%n машина</numerusform>
+            <numerusform>%n машини</numerusform>
         </translation>
     </message>
     <message numerus="yes">
         <source>(%n running)</source>
         <comment>Group item tool-tip / Running machine info</comment>
-        <translation type="unfinished">
-            <numerusform></numerusform>
-            <numerusform></numerusform>
+        <translation>
+            <numerusform>(%n включена)</numerusform>
+            <numerusform>(%n включени)</numerusform>
         </translation>
     </message>
     <message>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper</comment>
-        <translation type="unfinished"><nobr>%1</nobr></translation>
+        <translation><nobr>%1</nobr></translation>
     </message>
     <message>
         <source><nobr>%1 %2</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper, including running</comment>
-        <translation type="unfinished"><nobr>%1</nobr> {1 %2<?}</translation>
+        <translation><nobr>%1 %2</nobr></translation>
     </message>
     <message>
         <source>Collapse group</source>
-        <translation type="unfinished"></translation>
+        <translation>Сгъване на група</translation>
     </message>
     <message>
         <source>Expand group</source>
-        <translation type="unfinished"></translation>
+        <translation>Разгъване на група</translation>
     </message>
     <message>
         <source>Enter group</source>
-        <translation type="unfinished"></translation>
+        <translation>Влизане в група</translation>
     </message>
     <message>
         <source>Exit group</source>
-        <translation type="unfinished"></translation>
+        <translation>Излизане от група</translation>
     </message>
 </context>
 <context>
@@ -2532,7 +2790,7 @@ p, li { white-space: pre-wrap; </style></head><body style="
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2727,107 +2985,217 @@ p, li { white-space: pre-wrap; </style></head><body style="
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation type="unfinished"></translation>
+        <translation>Файл за видео заснемане</translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation type="unfinished"></translation>
+        <translation>Атрибути за видео заснемане</translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation type="unfinished"></translation>
+        <translation>Видео заснемане</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation type="unfinished"></translation>
+        <translation>Забранено</translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation type="unfinished"></translation>
+        <translation>NAT мрежа, '%1'</translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation type="unfinished"></translation>
+        <translation>Размер на кадър: %1x%2, Скорост на кадри: %3fps, Скорост на битове: %4kbps</translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Контролер</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Минимална паравиртуализация</translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Видео памет</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Hyper-V паравиртуализация</translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Екрани</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>KVM паравиртуализация</translation>
     </message>
     <message>
-        <source>2D Video</source>
-        <comment>details report</comment>
-        <translation type="obsolete">2D видео</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[Оптично устройство]</translation>
     </message>
     <message>
-        <source>3D</source>
-        <comment>details report</comment>
-        <translation type="obsolete">3D</translation>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>USB контролер</translation>
     </message>
     <message>
-        <source>Acceleration</source>
-        <comment>details</comment>
-        <translation type="obsolete">Ускорение</translation>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Фактор на мащаба</translation>
     </message>
     <message>
-        <source>Remote Desktop Server</source>
-        <comment>details</comment>
-        <translation type="obsolete">Отдалечен работен плот</translation>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Немащабиран HiDPI видео изход</translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadGeneral</name>
     <message>
-        <source>Name</source>
-        <comment>details</comment>
-        <translation type="obsolete">Име</translation>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Позволен</translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadNetwork</name>
     <message>
-        <source>Bridged adapter, %1</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Мостов адаптер, %1</translation>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>Позиция на малката лента с инструменти</translation>
     </message>
     <message>
-        <source>Internal network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Вътрешна мрежа, '%1'</translation>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>Горе</translation>
     </message>
     <message>
-        <source>Host-only adapter, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Адаптер само-хост, '%1'</translation>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>Долу</translation>
     </message>
     <message>
-        <source>Generic driver, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Основен драйвер, '%1'</translation>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>Малка лента с инструменти</translation>
     </message>
     <message>
-        <source>Generic driver, '%1' {&nbsp;%2&nbsp;}</source>
-        <comment>details report (network)</comment>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>Забранена</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">Фактор на мащаба</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">Немащабиран HiDPI видео изход</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Контролер</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Видео памет</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Екрани</translation>
+    </message>
+    <message>
+        <source>2D Video</source>
+        <comment>details report</comment>
+        <translation type="obsolete">2D видео</translation>
+    </message>
+    <message>
+        <source>3D</source>
+        <comment>details report</comment>
+        <translation type="obsolete">3D</translation>
+    </message>
+    <message>
+        <source>Acceleration</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ускорение</translation>
+    </message>
+    <message>
+        <source>Remote Desktop Server</source>
+        <comment>details</comment>
+        <translation type="obsolete">Отдалечен работен плот</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadGeneral</name>
+    <message>
+        <source>Name</source>
+        <comment>details</comment>
+        <translation type="obsolete">Име</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadNetwork</name>
+    <message>
+        <source>Bridged adapter, %1</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Мостов адаптер, %1</translation>
+    </message>
+    <message>
+        <source>Internal network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Вътрешна мрежа, '%1'</translation>
+    </message>
+    <message>
+        <source>Host-only adapter, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Адаптер само-хост, '%1'</translation>
+    </message>
+    <message>
+        <source>Generic driver, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Основен драйвер, '%1'</translation>
+    </message>
+    <message>
+        <source>Generic driver, '%1' {&nbsp;%2&nbsp;}</source>
+        <comment>details report (network)</comment>
         <translation type="obsolete">Основен драйвер, '%1' {&nbsp;%2&nbsp;}</translation>
     </message>
     <message>
@@ -2954,7 +3322,7 @@ p, li { white-space: pre-wrap; </style></head><body style="
     <name>UIGlobalSettingsDisplay</name>
     <message>
         <source>Maximum Guest Screen &Size:</source>
-        <translation>Максимален ра&змер на виртуалния екран</translation>
+        <translation>Максимален ра&змер на виртуалния екран:</translation>
     </message>
     <message>
         <source>&Width:</source>
@@ -3001,15 +3369,15 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source>Machine Windows:</source>
-        <translation type="unfinished"></translation>
+        <translation>Прозорци на машината:</translation>
     </message>
     <message>
         <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation type="unfinished"></translation>
+        <translation>Когато е избрано, прозорците на машината ще се активират, когато мишката застане върху тях.</translation>
     </message>
     <message>
         <source>&Raise Window Under Mouse</source>
-        <translation type="unfinished"></translation>
+        <translation>&Активиране на прозорец под мишката</translation>
     </message>
 </context>
 <context>
@@ -3056,7 +3424,7 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation type="unfinished"></translation>
+        <translation>&Пакети с разширения</translation>
     </message>
 </context>
 <context>
@@ -3115,27 +3483,27 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">&Панел и меню лента:</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Авто показване при Цял екран</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Когато е избрано, панелът и меню лентата ще се показват, когато виртуалната машина е на цял екран.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
-        <translation type="unfinished"></translation>
+        <translation>&Екранен предпазител:</translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation type="unfinished"></translation>
+        <translation>Когато е избрано, екранният предпазител на реалната машина ще бъде забранен, докато виртуалната машина е включена.</translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation type="unfinished"></translation>
+        <translation>Забраняване, когато виртуалната машина е включена</translation>
     </message>
 </context>
 <context>
@@ -3174,27 +3542,27 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation type="unfinished"></translation>
+        <translation>Основен клавиш за комбинации</translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation type="unfinished"></translation>
+        <translation>Някои елементи имат зададени едни и същи клавиши.</translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation type="unfinished"></translation>
+        <translation>&VirtialBox Управление</translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation type="unfinished"></translation>
+        <translation>Виртуална &машина</translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation type="unfinished"></translation>
+        <translation>Извежда всички клавишни комбинации, които могат да бъдат зададени.</translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation type="unfinished"></translation>
+        <translation>Въведете израз, за да филтрирате списъка с клавиши.</translation>
     </message>
 </context>
 <context>
@@ -3253,7 +3621,7 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation type="unfinished"></translation>
+        <translation>&Езици за екрана</translation>
     </message>
 </context>
 <context>
@@ -3410,128 +3778,128 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation type="unfinished"></translation>
+        <translation>&NAT мрежи</translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation type="unfinished"></translation>
+        <translation>Извежда наличните NAT мрежи.</translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translation type="unfinished"></translation>
+        <translation>&Мрежи само-хост</translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е зададено ново име за NAT мрежата с предишно име <b>%1</b>.</translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е указан CIDR за NAT мрежата <b>%1</b>.</translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е указан CIDR за NAT мрежата с предишно име <b>%1</b>.</translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалидно указан CIDR (<i>%1</i>) за NAT мрежата <b>%2</b>.</translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалидно указан CIDR (<i>%1</i>) за NAT мрежата с предишно име <b>%2</b>.</translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translation type="unfinished"></translation>
+        <translation>Име на мрежа</translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation type="unfinished"></translation>
+        <translation>[празно]</translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 (преименувана от %2)</translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation type="unfinished"></translation>
+        <translation>Старо име на мрежа</translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation type="unfinished"></translation>
+        <translation>Ново име на мрежа</translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation type="unfinished"></translation>
+        <translation>CIDR на мрежата</translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation type="unfinished"></translation>
+        <translation>Поддържа DHCP</translation>
     </message>
     <message>
         <source>yes</source>
-        <translation type="unfinished"></translation>
+        <translation>да</translation>
     </message>
     <message>
         <source>no</source>
-        <translation type="unfinished"></translation>
+        <translation>не</translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation type="unfinished"></translation>
+        <translation>Поддържа IPv6</translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation type="unfinished"></translation>
+        <translation>Подразбиращо IPv6 рутиране</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation type="unfinished"></translation>
+        <translation>Реалният интерфейс <b>%1</b> текущо няма валиден IPv4 адрес.</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation type="unfinished"></translation>
+        <translation>Реалният интерфейс <b>%1</b> текущо няма валидна IPv4 мрежова маска.</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation type="unfinished"></translation>
+        <translation>Реалният интерфейс <b>%1</b> текущо няма валиден IPv6 адрес.</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation type="unfinished"></translation>
+        <translation>Реалният интерфейс <b>%1</b> текущо няма валиден адрес за DHCP сървър.</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation type="unfinished"></translation>
+        <translation>Реалният интерфейс <b>%1</b> текущо няма валидна маска за DHCP сървър.</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation type="unfinished"></translation>
+        <translation>Реалният интерфейс <b>%1</b> текущо няма валидна долна адресна граница за DHCP сървъра.</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation type="unfinished"></translation>
+        <translation>Реалният интерфейс <b>%1</b> текущо няма валидна горна адресна граница за DHCP сървъра.</translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation type="unfinished"></translation>
+        <translation>Името <b>%1</b> се използва от няколко NAT мрежи.</translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation type="unfinished">Активен</translation>
+        <translation>Активна</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation type="unfinished"></translation>
+        <translation>&Добавяне на NAT мрежа</translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation type="unfinished"></translation>
+        <translation>&Премахване на NAT мрежа</translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation type="unfinished"></translation>
+        <translation>&Редактиране на NAT мрежа</translation>
     </message>
 </context>
 <context>
@@ -3633,177 +4001,177 @@ p, li { white-space: pre-wrap; </style></head><body style="
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation type="unfinished">Детайли на мрежа само-хост</translation>
+        <translation>Детайли на мрежа само-хост</translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation type="unfinished">&Адаптер</translation>
+        <translation>&Адаптер</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation type="unfinished">Ръчна &конфигурация</translation>
+        <translation>Ръчна &конфигурация</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation type="unfinished">Използване на ръчна конфигурация за този само-хост мрежов адаптер.</translation>
+        <translation>Използване на ръчна конфигурация за този само-хост мрежов адаптер.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation type="unfinished">&IPv4 адрес:</translation>
+        <translation>&IPv4 адрес:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation type="unfinished">Показва IPv4 адреса на хоста за този адаптер.</translation>
+        <translation>Задава IPv4 адреса на хоста за този адаптер.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation type="unfinished">IPv4 мрежова &маска:</translation>
+        <translation>IPv4 мрежова &маска:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation type="unfinished">Показва IPv4 мрежовата маска на хоста за този адаптер.</translation>
+        <translation>Задава IPv4 мрежовата маска на хоста за този адаптер.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation type="unfinished">I&Pv6 адрес:</translation>
+        <translation>I&Pv6 адрес:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation type="unfinished">Показва IPv6 адреса на хоста за този адаптер, ако се поддържа IPv6.</translation>
+        <translation>Задава IPv6 адреса на хоста за този адаптер, ако се поддържа IPv6.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation type="unfinished">&Дължина на IPv6 мрежовата маска:</translation>
+        <translation>&Дължина на IPv6 мрежовата маска:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation type="unfinished">Показва префиксната дължина на IPv6 мрежовата маска на хоста за този адаптер, ако се поддържа IPv6.</translation>
+        <translation>Задава префиксната дължина на IPv6 мрежовата маска на хоста за този адаптер, ако се поддържа IPv6.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation type="unfinished">&DHCP сървър</translation>
+        <translation>&DHCP сървър</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation type="unfinished">&Позволяване на сървъра</translation>
+        <translation>&Позволяване на сървъра</translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation type="unfinished">Показва дали DHCP сървърът да бъде активиран при стартирането на машината или не.</translation>
+        <translation>Показва дали DHCP сървърът да бъде активиран при стартирането на машината, или не.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation type="unfinished">Ад&рес на сървъра:</translation>
+        <translation>Ад&рес на сървъра:</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished">Показва адреса на DHCP сървъра, който обслужва мрежата, асоциирана с този само-хост адаптер.</translation>
+        <translation>Задава адреса на DHCP сървъра, който обслужва мрежата, асоциирана с този само-хост адаптер.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation type="unfinished">&Маска на сървъра:</translation>
+        <translation>&Маска на сървъра:</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished">Показва мрежовата маска на DHCP сървъра, който обслужва мрежата, асоциирана с този само-хост адаптер.</translation>
+        <translation>Задава мрежовата маска на DHCP сървъра, който обслужва мрежата, асоциирана с този само-хост адаптер.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation type="unfinished">&Долна адресна граница:</translation>
+        <translation>&Долна адресна граница:</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished">Показва долната адресна граница, предлагана от DHCP сървъра, който обслужва мрежата, асоциирана с този само-хост адаптер.</translation>
+        <translation>Задава долната адресна граница, предлагана от DHCP сървъра, който обслужва мрежата, асоциирана с този само-хост адаптер.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation type="unfinished">&Горна адресна граница:</translation>
+        <translation>&Горна адресна граница:</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished">Показва горната адресна граница, предлагана от DHCP сървъра, който обслужва мрежата, асоциирана с този само-хост адаптер.</translation>
+        <translation>Задава горната адресна граница, предлагана от DHCP сървъра, който обслужва мрежата, асоциирана с този само-хост адаптер.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation type="unfinished"></translation>
+        <translation>Детайли на NAT мрежа</translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation type="unfinished"></translation>
+        <translation>&Позволяване на мрежа</translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation type="unfinished"></translation>
+        <translation>Позволяване на тази NAT мрежа.</translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation type="unfinished"></translation>
+        <translation>&Име на мрежа:</translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation type="unfinished"></translation>
+        <translation>Задава името на тази мрежа.</translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation type="unfinished"></translation>
+        <translation>&CIDR на мрежата:</translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation type="unfinished"></translation>
+        <translation>Задава CIDR за тази мрежа.</translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation type="unfinished"></translation>
+        <translation>Опции на мрежата:</translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation type="unfinished"></translation>
+        <translation>Поддръжка на &DHCP</translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation type="unfinished"></translation>
+        <translation>Указва дали тази мрежа поддържа DHCP.</translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation type="unfinished"></translation>
+        <translation>Поддръжка на &IPv6</translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation type="unfinished"></translation>
+        <translation>Указва дали тази мрежа поддържа IPv6.</translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation type="unfinished"></translation>
+        <translation>IPv6 &рутиране по подразбиране</translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation type="unfinished"></translation>
+        <translation>Указва дали тази мрежа ще се обявява като IPv6 рутиране по подразбиране.</translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation type="unfinished">Отваря диалог за управление на правилата за пренасочване на портове.</translation>
+        <translation>Отваря диалог за управление на правилата за пренасочване на портове.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation type="unfinished">&Пренасочване на портове</translation>
+        <translation>&Пренасочване на портове</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation type="unfinished">Правила за пренасочване на портове</translation>
+        <translation>Правила за пренасочване на портове</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation type="unfinished"></translation>
+        <translation>IPv4</translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation type="unfinished"></translation>
+        <translation>IPv6</translation>
     </message>
 </context>
 <context>
@@ -3858,11 +4226,11 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо няма указан прокси адрес.</translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо няма указан прокси порт.</translation>
     </message>
 </context>
 <context>
@@ -3927,71 +4295,71 @@ p, li { white-space: pre-wrap; </style></head><body style="
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation type="unfinished"><key_%1></translation>
+        <translation><key_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation type="unfinished">Лява стрелка</translation>
+        <translation>Лява стрелка</translation>
     </message>
     <message>
         <source>Right </source>
-        <translation type="unfinished">Дясна стрелка</translation>
+        <translation>Дясна стрелка</translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation type="unfinished">Ляв Shift</translation>
+        <translation>Ляв Shift</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation type="unfinished">Десен Shift</translation>
+        <translation>Десен Shift</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation type="unfinished">Ляв Ctrl</translation>
+        <translation>Ляв Ctrl</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation type="unfinished">Десен Ctrl</translation>
+        <translation>Десен Ctrl</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation type="unfinished">Ляв Alt</translation>
+        <translation>Ляв Alt</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation type="unfinished">Десен Alt</translation>
+        <translation>Десен Alt</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation type="unfinished">Ляв Win клавиш</translation>
+        <translation>Ляв Win клавиш</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation type="unfinished">Десен Win клавиш</translation>
+        <translation>Десен Win клавиш</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation type="unfinished">Клавиш Меню</translation>
+        <translation>Клавиш Меню</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation type="unfinished">Alt Gr</translation>
+        <translation>Alt Gr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation type="unfinished">Caps Lock</translation>
+        <translation>Caps Lock</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation type="unfinished">Scroll Lock</translation>
+        <translation>Scroll Lock</translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation type="unfinished"></translation>
+        <translation>Основен+</translation>
     </message>
     <message>
         <source>None</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма</translation>
     </message>
 </context>
 <context>
@@ -4178,22 +4546,22 @@ p, li { white-space: pre-wrap; </style></head><body style="
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation type="unfinished"></translation>
+        <translation>Връщане на комбинацията по подразбиране</translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation type="unfinished"></translation>
+        <translation>Изчистване на комбинацията</translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation type="unfinished">Име</translation>
+        <translation>Име</translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translation type="unfinished"></translation>
+        <translation>Клавишна комбинация</translation>
     </message>
 </context>
 <context>
@@ -4222,7 +4590,7 @@ p, li { white-space: pre-wrap; }
 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This wizard will guide you through importing an appliance. </p>
 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Use the <span style=" font-weight:600;">Next</span> button to go the next page of the wizard and the <span style=" font-weight:600;">Back</span> button to return to the previous page.</p>
 <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below:</p></body></html></source>
-        <translation type="obsolete"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body><p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Т [...]
+        <translation type="obsolete"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body><p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Т [...]
     </message>
     <message>
         <source>< &Back</source>
@@ -4273,7 +4641,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>This wizard will guide you through importing an appliance.</p><p>%1</p><p>VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below:</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви води през внасянето на приспособление.<p><p>%1</p><p>VirtualBox текущо поддържа внасяне на приспособления, запазени в Отворения Виртуализационен Формат (OVF). За да продължите, изберете файл за внасяне по-долу:</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви води през внасянето на приспособление.<p><p>%1</p><p>VirtualBox текущо поддържа внасяне на приспособления, запазени в Отворения Виртуализационен Формат (OVF). За да продължите, изберете файл за внасяне по-долу:</p></translation>
     </message>
 </context>
 <context>
@@ -4332,12 +4700,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Показва активността на CD/DVD устройствата:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Показва активността на CD/DVD устройствата:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Показва активността на Флопи устройствата:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Показва активността на Флопи устройствата:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4377,7 +4745,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB контролерът е забранен</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB контролерът е забранен</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4430,20 +4798,34 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation type="unfinished"></translation>
+        <translation><nobr>Активност на видео запис:</nobr><br>%1</translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation type="unfinished"></translation>
+        <translation><nobr><b>Видео записът е забранен</b></nobr></translation>
     </message>
     <message>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation type="unfinished"></translation>
+        <translation><nobr><b>Файл за видео запис:</b> %1</nobr></translation>
     </message>
     <message>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation type="unfinished"></translation>
+        <translation>Статус на допълнителни функции:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>Показва активността на екрана:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Показва активността на оптичните устройства:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Показва активността на флопи устройствата:</nobr>%1</p></translation>
     </message>
 </context>
 <context>
@@ -4517,19 +4899,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма свързани уеб камери</translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма поддържани уеб камери, свързани към реалния ПК</translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation type="unfinished"></translation>
+        <translation>Свързване на мрежов адаптер</translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Свързване на мрежов адаптер %1</translation>
     </message>
 </context>
 <context>
@@ -4571,7 +4953,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Видео</translation>
+        <translation type="obsolete">&Видео</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4687,161 +5069,245 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation type="unfinished"></translation>
+        <translation>Видео &заснемане</translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation type="unfinished"></translation>
+        <translation>Когато е избрано, VirtualBox ще запише сесията във виртуалната машина във видео файл.</translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation type="unfinished"></translation>
+        <translation>&Позволяване на видео заснемане</translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation type="unfinished"></translation>
+        <translation>Път на &файла:</translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тази настройка указва името на файла, което VirtualBox използва за записаното съдържание.</translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation type="unfinished"></translation>
+        <translation>Размер на &кадър:</translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тази настройка указва разделителната способност (размер на кадъра) на записаното видео.</translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тази настройка указва <b>хоризонталната</b> разделителната способност (ширина на кадъра) на записаното видео.</translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тази настройка указва <b>вертикалната</b> разделителната способност (височина на кадъра) на записаното видео.</translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation type="unfinished"></translation>
+        <translation>&Скорост на кадри:</translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тази настройка указва максималният брой <b>кадри в секунда</b>. Допълнителните кадри ще бъдат пропускани. Намаляването на стойността ще увеличи броя пропуснати кадри и ще намали размера на файла.</translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation type="unfinished"></translation>
+        <translation>&Качество:</translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тази настройка указва <b>качеството</b>. Увеличаването ѝ ще направи видеото да изглежда по-добре, но за сметка на увеличен размер на файла.</translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тази настройка указва скоростта на битовете в <b>килобити в секунда</b>. Увеличаването ѝ ще направи видеото да изглежда по-добре, но за сметка на увеличен размер на файла.</translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation type="unfinished"></translation>
+        <translation>&Екрани:</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тази виртуална машина е настроена да използва хардуерно графично ускорение. Но реалната машина текущо не поддържа това, така че няма да можете да стартирате машината.</translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation type="unfinished"></translation>
+        <translation>Задали сте по-малко от <b>%1</b> за видео памет на виртуалната машина, което е минималното количество, нужно за превключването на виртуалната машина на цял екран или в безрамков режим.</translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation type="unfinished"></translation>
+        <translation>Задали сте по-малко от <b>%1</b> за видео памет на виртуалната машина, което е минималното количество, нужно за ефикасното изпълнение на HD видео.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Задали сте да се използва хардуерно графично ускорение за виртуалната машина и за тип на системата сте задали Windows Vista или по-нов. За най-добра производителност трябва да зададете за видео памет на машината поне <b>%1</b>.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation type="unfinished"></translation>
+        <translation>Задали сте използване на Ускорение на видео поток. Тъй като тази функция работи само с Windows виртуални системи, тя ще бъде забранена.</translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Стойността на VRDE сървърен порт текущо не е указана.</translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Стойността за просрочено време на VRDE автентикация текущо не е зададена.</translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation type="unfinished"></translation>
+        <translation>Зададено от потребителя</translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 fps</translation>
     </message>
     <message>
         <source>fps</source>
-        <translation type="unfinished"></translation>
+        <translation>fps</translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation type="unfinished"></translation>
+        <translation>ниско</translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation type="unfinished"></translation>
+        <translation>средно</translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation type="unfinished"></translation>
+        <translation>високо</translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation type="unfinished"></translation>
+        <translation>kbps</translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Екран %1</translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Позволяване на видео заснемане на екран %1.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation type="unfinished"></translation>
+        <source>Machine &Window</source>
+        <translation type="obsolete">&Прозорец на машината</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source><qt>%1&nbsp;MB</qt></source>
-        <translation type="obsolete"><qt>%1&nbsp;МБ</qt></translation>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="obsolete">Позволява промяна на съдържанието на меню лентата на ВМ.</translation>
     </message>
     <message>
-        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>Показва пътя, където да се пазят снимките на тази виртуална машина. Имайте предвид, че снимките могат да заемат много дисково пространство.</translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Малка лента с инструменти:</translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>&Начални</translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Ако е избрано, ще се показва малка лента с инструменти при цял екран и безрамков режим.</translation>
     </message>
     <message>
-        <source>Identification</source>
-        <translation type="obsolete">Идентификация</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Показване при &Цял екран/Безрамков режим</translation>
     </message>
     <message>
-        <source>&Name:</source>
-        <translation type="obsolete">&Име:</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Ако е избрано, малката лента с инструменти ще се показва в горния край на екрана, вместо на стандартната ѝ позиция в долния край на екрана.</translation>
     </message>
     <message>
-        <source>Holds the name of the virtual machine.</source>
-        <translation type="obsolete">Показва името на виртуалната машина.</translation>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Показване &отгоре на екрана</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="obsolete">Позволява промяна на съдържанието на статус лентата на ВМ.</translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="obsolete">Отдалеченият работен плот текущо е позволен за тази виртуална машина. Но това изисква да бъде инсталиран <b>%1</b>. Моля, инсталирайте пакета с разширения от сайта на VirtualBox, иначе виртуалната машина ще бъде стратирана с изключен Отдалечен работен плот.</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>Около %1МБ за 5 минути видео</i></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation>Отдалеченият работен плот текущо е позволен за тази виртуална машина. Но това изисква да бъде инсталиран <b>%1</b>. Моля, инсталирайте пакета с разширения от сайта на VirtualBox, иначе виртуалната машина ще бъде стратирана с изключен Отдалечен работен плот.</translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation>Задали сте да се използва хардуерно графично ускорение за виртуалната машина и за тип на системата сте задали Windows Vista или по-нов. За най-добра производителност трябва да зададете за видео памет на машината поне <b>%1</b>.</translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished">HiDPI:</translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished">Използване на &немащабиран HiDPI изход</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;МБ</qt></translation>
+    </message>
+    <message>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation>Показва пътя, където да се пазят снимките на тази виртуална машина. Имайте предвид, че снимките могат да заемат много дисково пространство.</translation>
+    </message>
+    <message>
+        <source>Basi&c</source>
+        <translation>&Начални</translation>
+    </message>
+    <message>
+        <source>Identification</source>
+        <translation type="obsolete">Идентификация</translation>
+    </message>
+    <message>
+        <source>&Name:</source>
+        <translation type="obsolete">&Име:</translation>
+    </message>
+    <message>
+        <source>Holds the name of the virtual machine.</source>
+        <translation type="obsolete">Показва името на виртуалната машина.</translation>
     </message>
     <message>
         <source>Base &Memory Size</source>
@@ -4872,7 +5338,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Контролира количеството видео памет, предоставено на тази виртуална машина.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Разширени</translation>
     </message>
     <message>
@@ -4960,7 +5426,7 @@ p, li { white-space: pre-wrap; }
         <translation>Папка за &снимки:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Описание</translation>
     </message>
     <message>
@@ -4973,7 +5439,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Ако е избрано, всяка промяна в монтираните CD/DVD или флопи дискове, извършена по време изпълнението на машината, ще бъде запазено във файла с настройки, с цел да се запази конфигурацията на монтираните дискове между включванията.</translation>
+        <translation type="obsolete">Ако е избрано, всяка промяна в монтираните CD/DVD или флопи дискове, извършена по време изпълнението на машината, ще бъде запазено във файла с настройки, с цел да се запази конфигурацията на монтираните дискове между включванията.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5017,38 +5483,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Сменяеми носители:</translation>
+        <translation type="obsolete">Сменяеми носители:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Запомняне на текущите промените</translation>
+        <translation type="obsolete">&Запомняне на текущите промените</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Малка лента с инструменти:</translation>
+        <translation type="obsolete">Малка лента с инструменти:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Ако е избрано, ще се показва малка лента с инструменти при цял екран и безрамков режим.</translation>
+        <translation type="obsolete">Ако е избрано, ще се показва малка лента с инструменти при цял екран и безрамков режим.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Показване при &Цял екран/Безрамков режим</translation>
+        <translation type="obsolete">Показване при &Цял екран/Безрамков режим</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Ако е избрано, малката лента с инструменти ще се показва в горния край на екрана, вместо на стандартната ѝ позиция в долния край на екрана.</translation>
+        <translation type="obsolete">Ако е избрано, малката лента с инструменти ще се показва в горния край на екрана, вместо на стандартната ѝ позиция в долния край на екрана.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Показване &отгоре на екрана</translation>
+        <translation type="obsolete">Показване &отгоре на екрана</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">Избрали сте 64-битова виртуална ОС за тази ВМ. Тъй като виртуалната машина изисква хардуерно ускорение (VT-x/AMD-V), тази функция ще бъде включена автоматично.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>Вла&чене и пускане:</translation>
     </message>
     <message>
@@ -5057,11 +5523,131 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е указано име за виртуалната машина.</translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation type="unfinished"></translation>
+        <translation>Зададен е 64-битов тип на операционната система на виртуалната машина. 64-битовите системи изискват хардуерна виртуализация, така че тя ще бъде включена автоматично, ако се съгласите с промените.</translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation>&Криптиране</translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>Когато е избрано, позволява криптиране за тази виртуална машина.</translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation>По&зволяване на криптиране</translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation>Криптиращ &шифър:</translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>Задава шифъра, който да се използва за криптиране на дисковете на виртуалната машина.</translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation>В&ъведете нова парола:</translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>Задава паролата, която да се зададе към виртуалната машина.</translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation>П&отвърждаване на нова парола:</translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>Потвърждение на паролата, която да се зададе към виртуалната машина.</translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>Опитвате се да криптирате тази виртуална машина. Но това изисква <i>%1</i> да бъде инсталиран. Моля, инсталирайте пакета с разширения от сайта на VirtualBox.</translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation>Не е указан тип на криптиращия шифър.</translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation>Криптиращата парола е празна.</translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation>Криптиращите пароли не съвпадат.</translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>Оставяне непроменено</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>Позволява промяна на съдържанието на меню лентата на ВМ.</translation>
+    </message>
+    <message>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">Фактор на мащаба на екрана:</translation>
+    </message>
+    <message>
+        <source>This setting determines the guest screen scale factor.</source>
+        <translation type="obsolete">Тази настройка определя фактора на мащаба за виртуалния екран.</translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="obsolete">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="obsolete">HiDPI:</translation>
+    </message>
+    <message>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">Когато е избрано, съдържанието на виртуалния екран няма да бъде мащабирано в съответствие с високата разделителна способност на реалния екран.</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">Използване на &немащабиран HiDPI изход</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation>Малка лента с инструменти:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation>Ако е избрано, ще се показва малка лента с инструменти при цял екран и безрамков режим.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation>Показване при &Цял екран/Безрамков режим</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation>Ако е избрано, малката лента с инструменти ще се показва в горния край на екрана, вместо на стандартната ѝ позиция в долния край на екрана.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation>Показване &отгоре на екрана</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>Позволява промяна на съдържанието на статус лентата на ВМ.</translation>
     </message>
 </context>
 <context>
@@ -5169,7 +5755,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enter any configuration settings here for the network attachment driver you will be using. The settings should be of the form <b>name=value</b> and will depend on the driver. Use <b>shift-enter</b> to add a new entry.</source>
-        <translation>Въведете всички конфигурационни настройки за закачащя към мрежата драйвер, които ще използвате. Настройките трябва да са във формат <b>име=стойност</b> и ще зависят от драйвера. Използвайте <b>Shift+Enter</b>, за да добавите нова категория.</translation>
+        <translation>Въведете всички конфигурационни настройки за закачащия към мрежата драйвер, които ще използвате. Настройките трябва да са във формат <b>име=стойност</b> и ще зависят от драйвера. Използвайте <b>Shift+Enter</b>, за да добавите нова категория.</translation>
     </message>
     <message>
         <source>no generic driver is selected</source>
@@ -5205,35 +5791,35 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е избран мостов мрежов адаптер.</translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е избрано име на вътрешна мрежа.</translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е избран мрежов адаптер само-хост.</translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е избран първичен драйвер.</translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation type="unfinished"></translation>
+        <translation>MAC адресът трябва да е 12 шестнадесетични цифри.</translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation type="unfinished"></translation>
+        <translation>Втората цифра в MAC адреса не може да е нечетна, тъй като са позволени само unicast адреси.</translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е указано име на NAT мрежа.</translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation type="unfinished"></translation>
+        <translation>Задава името на NAT мрежата, към която тази мрежова карта ще се свърже. Можете да създавате и премахвате мрежи, като използвате глобалните мрежови настройки в прозореца за управление на виртуалните машини.</translation>
     </message>
 </context>
 <context>
@@ -5335,23 +5921,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е указан IRQ.</translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е указан I/O порт.</translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation type="unfinished"></translation>
+        <translation>Два или повече порта имат еднакви настройки.</translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е указан път на порт.</translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо има указани дублиращи се пътища на портове.</translation>
     </message>
 </context>
 <context>
@@ -5512,7 +6098,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>When checked, the guest OS will try to automatically mount the shared folder on startup.</source>
-        <translation>Когато е избрано, виртуалната OS ще опита да монтира автоматично споделената папка при стартиране.</translation>
+        <translation>Когато е избрано, виртуалната ОС ще опита да монтира автоматично споделената папка при стартиране.</translation>
     </message>
     <message>
         <source>&Auto-mount</source>
@@ -5522,10 +6108,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Ако е избрано, тази споделена папка ще бъде постоянна.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5576,11 +6158,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Ако е избрано, проводът, който е указан в полето <b>Път до порта</b>, ще бъде създаден от виртуалната машина, когато бъде стартирана. В противен случай, виртуалната машина ще опита да използва съществуващия провод.</translation>
+        <translation type="obsolete">Ако е избрано, проводът, който е указан в полето <b>Път до порта</b>, ще бъде създаден от виртуалната машина, когато бъде стартирана. В противен случай, виртуалната машина ще опита да използва съществуващия провод.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Създаване на провод</translation>
+        <translation type="obsolete">&Създаване на провод</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5588,11 +6170,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Показва пътя до провода на този сериен порт на реалната машина, когато портът работи в режим <b>Реален провод</b>, или името на реалното серийно устройство, когато портът работи в режим <b>Реално устройство</b>.</translation>
+        <translation type="obsolete">Показва пътя до провода на този сериен порт на реалната машина, когато портът работи в режим <b>Реален провод</b>, или името на реалното серийно устройство, когато портът работи в режим <b>Реално устройство</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Път на порта/файла:</translation>
+        <translation type="obsolete">&Път на порта/файла:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5602,6 +6184,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Показва основния I/O портов адрес за този сериен порт. Валидни стойности са целочислени номера в диапазона от <tt>0</tt> до <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation>Ако е избрано, виртуалната машина ще предполага, че проводът или сокетът, указан в полето <b>Път/Адрес</b>, съществува и ще пробва да го използва. В противен случай проводът или сокетът ще бъде създаден от виртуалната машина, когато бъде стартирана.</translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>&Свързване към съществуващ провод/сокет</translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation>&Път/Адрес:</translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation><p>В режим <b>Реален провод</b>: Указва пътя до провода на серийния порт на реалната машина. Примери: "\\.\pipe\myvbox" или "/tmp/myvbox", съответно за Windows и UNIX-подобни системи.</p><p>В режим <b>Реално устройство</b>: Указва името на реалното серийно устройство. Примери: "COM1" или "/dev/ttyS0".</p><p>В режим <b>Първичен файл</b>: Указва файловия път на реа [...]
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5619,23 +6217,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е указан IRQ.</translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е указан I/O порт.</translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation type="unfinished"></translation>
+        <translation>Два или повече порта имат еднакви настройки.</translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е указан път на порт.</translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо има указани дублиращи се пътища на портове.</translation>
     </message>
 </context>
 <context>
@@ -5718,15 +6316,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Добавяне&nbsp;на&nbsp;CD/DVD&nbsp;устройство</nobr></translation>
+        <translation type="obsolete"><nobr>Добавяне&nbsp;на&nbsp;CD/DVD&nbsp;устройство</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Добавяне&nbsp;на&nbsp;Флопи&nbsp;устройство</nobr></translation>
+        <translation type="obsolete"><nobr>Добавяне&nbsp;на&nbsp;Флопи&nbsp;устройство</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation type="unfinished">Няма избран твърд диск за <i>%1</i>.</translation>
+        <translation>Няма избран твърд диск за <i>%1</i>.</translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -5750,7 +6348,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add Floppy Controller</source>
-        <translation>Добавяне на Флопи контролер</translation>
+        <translation>Добавяне на флопи контролер</translation>
     </message>
     <message>
         <source>Remove Controller</source>
@@ -5766,11 +6364,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Добавяне на CD/DVD устройство</translation>
+        <translation type="obsolete">Добавяне на CD/DVD устройство</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Добавяне на Флопи устройство</translation>
+        <translation type="obsolete">Добавяне на флопи устройство</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5958,15 +6556,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD &устройство:</translation>
+        <translation type="obsolete">CD/DVD &устройство:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Изберете виртуален CD/DVD диск или физическо устройство, което да се използва във виртуалното устройство. Виртуалната машина ще вижда диск, вкаран в устройството, със съдържание данните от файла или от диска във физическото устройство.</translation>
+        <translation type="obsolete">Изберете виртуален CD/DVD диск или физическо устройство, което да се използва във виртуалното устройство. Виртуалната машина ще вижда диск, вкаран в устройството, със съдържание данните от файла или от диска във физическото устройство.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Настройване на виртуалното CD/DVD устройство</translation>
+        <translation type="obsolete">Настройване на виртуалното CD/DVD устройство</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5990,7 +6588,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Изберете файл с виртуален CD/DVD диск...</translation>
+        <translation type="obsolete">Изберете файл с виртуален CD/DVD диск...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6056,22 +6654,70 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Controller: %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Контролер: %1</translation>
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Текущо не е зададено име за контролера на позиция <b>%1</b>.</translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Контролерът на позиция <b>%1</b> има същото име, като контролера на позиция <b>%2</b>.</translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation type="unfinished"></translation>
+        <translation><i>%1</i> използва диск, който вече е закачен към <i>%2</i>.</translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
+        <translation>Текущо машината има добавени повече контролери за съхранение, отколкото чипсет %1 поддържа. Моля, променете типа на чипсета в страницата Системна или намалете броя на следните контролери за съхранение в страницата Съхранение: %2</translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation>Добавяне на USB контролер</translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation>Когато е избрано, виртуалната система ще вижда виртуалния диск като горещо сменяемо устройство.</translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>&Горещо сменяемо</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>Избор на файл с виртуален оптичен диск...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>Добавяне&nbsp;на&nbsp;оптично&nbsp;устройство</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>Добавяне&nbsp;на&nbsp;флопи&nbsp;устройство</nobr></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>Добавяне на оптично устройство</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>Добавяне на флопи устройство</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>Оптично &устройство:</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>Изберете виртуален оптичен диск или физическо устройство за използване от виртуалното устройство. Виртуалната машина ще вижда диск, вкаран в устройството, със съдържание данните във файла или на диска във физическото устройство.</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>Настройване на виртуалното оптично устройство</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6300,47 +6946,55 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation type="unfinished"></translation>
+        <translation>Посочващо &устройство:</translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation type="unfinished"></translation>
+        <translation>Указва дали емулираното посочващо устройство е стандартна PS/2 мишка, USB таблет или USB мултитъч таблет.</translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation type="unfinished"></translation>
+        <translation>Повече от <b>%1%</b> от реалната компютърна памет (<b>%2</b>) е зададена към виртуалната машина. Не остава достатъчно памет за реалната операционна система. Моля, изберете по-ниска стойност.</translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation type="unfinished"></translation>
+        <translation>Повече от <b>%1%</b> от реалната компютърна памет (<b>%2</b>) е зададена към виртуалната машина. Може да не остане достатъчно памет за реалната операционна система. Моля, обмислете избирането на по-ниска стойност.</translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation type="unfinished"></translation>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation>С оглед на производителността броят на виртуалните процесори, закачени към виртуалната машина, не може да бъде повече от двойно броят на физическите процесори (<b>%1</b>). Моля, намалете броя на виртуалните процесори.</translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation type="unfinished"></translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation>Задали сте повече виртуални процесори във виртуалната машина от броя на физическите процесори в реалната система (<b>%1</b>). Това ще намали производителността на виртуалната машина. Моля, обмислете намаляване броя на виртуалните процесори.</translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation type="unfinished"></translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation>Лимитът за изпълнение на процесора е зададен твърде нисък. Това може да направи машината бавна на реакция.</translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation type="unfinished"></translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation>&Паравиртуализационен интерфейс:</translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation type="unfinished"></translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>Задава използване на възможността за паравиртуализационен интерфейс от тази виртуална машина.</translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation type="unfinished"></translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Функцията I/O APIC текущо не е позволена в секцията Дънна платка на страницата Система. Тя е нужна за поддръжката на чипсет ICH9, какъвто сте задали за тази ВМ. Ще бъде позволена автоматично, ако потвърдите Вашите промени.</translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation type="unfinished"></translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Текущо не е позволена емулация на USB контролер в страницата USB. Тя е нужна за поддръжката на емулирано USB входящо устройство, каквото сте позволили за тази ВМ. Ще бъде позволена автоматично, ако потвърдите Вашите промени.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Функцията I/O APIC текущо не е позволена в секцията Дънна платка на страницата Система. Тя е нужна за поддръжката на повече от един виртуален процесор, колкото сте избрали за тази ВМ. Ще бъде позволена автоматично, ако потвърдите Вашите промени.</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Хардуерната виртуализация текущо не е позволена в секцията Ускорение на страницата Система. Тя е нужна за поддръжката на повече от един виртуален процесор, колкото сте избрани за тази ВМ. Ще бъде позволена автоматично, ако потвърдите Вашите промени.</translation>
     </message>
 </context>
 <context>
@@ -6412,7 +7066,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Позволяване на USB 2.0 (E&HCI) контролер</translation>
+        <translation type="obsolete">Позволяване на USB 2.0 (E&HCI) контролер</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6476,7 +7130,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">USB 2.0 текущо е позволен за тази виртуална машина. Но това изисква <b>%1</b> да бъде инсталиран. Моля, инсталирайте пакета с разширения от сайта на VirtualBox или забранете USB 2.0, за да можете да стартирате машината.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation>Когато е избрано, позволява виртуалния USB OHCI контролер за тази машина. USB OHCI контролерът предоставя поддръжка на USB 1.0.</translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>USB &1.1 (OHCI) контролер</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>USB &2.0 (EHCI) контролер</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>Когато е избрано, позволява виртуалния USB xHCI контролер за тази машина. USB xHCI контролерът предоставя поддръжка на USB 3.0.</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>USB &3.0 (xHCI) контролер</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>USB 2.0/3.0 текущо е позволен за тази виртуална машина. Но това изисква <b>%1</b> да бъде инсталиран. Моля, инсталирайте пакета с разширения от сайта на VirtualBox или забранете USB 2.0/3.0, за да можете да стартирате машината.</translation>
     </message>
 </context>
 <context>
@@ -6615,7 +7293,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Затваряне</translation>
+        <translation type="obsolete">&Затваряне</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation>Премахване на медия...</translation>
     </message>
 </context>
 <context>
@@ -6634,6 +7316,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>Преоразмеряване на виртуалния екран</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>Позициониране на виртуалния екран</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>Затваряне</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>Превключване</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>Позволяване на меню лентата</translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6671,75 +7376,75 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to initialize COM or to find the VirtualBox COM server. Most likely, the VirtualBox server is not running or failed to start.</p><p>The application will now terminate.</p></source>
-        <translation><p>Проблем при инициализирането на COM или при намирането на VirtualBox COM сървър. Най-вероятно, VurtualBox сървърът не е включен или не може да стартира.</p><p>Програмата ще бъде изключена.</p></translation>
+        <translation><p>Неуспешно инициализиране на COM или намиране на VirtualBox COM сървър. Най-вероятно, VurtualBox сървърът не е включен или не може да стартира.</p><p>Програмата ще бъде изключена.</p></translation>
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>проблем при създаването на VirtualBox COM обект.</p><p>Програмата ще бъде изключена.</p></translation>
+        <translation type="obsolete"><p>Неуспешно създаване на VirtualBox COM обект.</p><p>Програмата ще бъде изключена.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
-        <translation>Проблем при задаването на основните настройки на VirtualBox.</translation>
+        <translation>Неуспешно задаване на основните настройки на VirtualBox.</translation>
     </message>
     <message>
         <source>Failed to access the USB subsystem.</source>
-        <translation>Проблем с достъпа до USB подсистемата.</translation>
+        <translation>Неуспешен достъп до USB подсистемата.</translation>
     </message>
     <message>
         <source>Failed to create a new virtual machine.</source>
-        <translation>Проблем при създаването на нова виртуална машина.</translation>
+        <translation>Неуспешно създаване на нова виртуална машина.</translation>
     </message>
     <message>
         <source>Failed to create a new virtual machine <b>%1</b>.</source>
-        <translation type="obsolete">Проблем при създаването на нова виртуална машина <b>%1</b>.</translation>
+        <translation type="obsolete">Неуспешно създаване на нова виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to apply the settings to the virtual machine <b>%1</b>.</source>
-        <translation type="obsolete">Проблем при прилагането на настройките за виртуална машина <b>%1</b>.</translation>
+        <translation type="obsolete">Неуспешно прилагане на настройките за виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to start the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при стартирането на виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно стартиране на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to pause the execution of the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при задържането на изпълнението на виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно задържане на изпълнението на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to resume the execution of the virtual machine <b>%1</b>.</source>
-        <translation>проблем при продължаването на изпълнението на виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно продължаване на изпълнението на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to save the state of the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при запазването на състоянието на виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно запазване на състоянието на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to create a snapshot of the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при създаването на снимка на виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно създаване на снимка на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to stop the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при спирането на виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно спиране на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to remove the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при премахването на виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно премахване на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to discard the saved state of the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при изчистването на запазеното състояние на виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно изчистване на запазеното състояние на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to discard the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
-        <translation type="obsolete">Проблем при изчистването на снимка <b>%1</b> на виртуална машина <b>%2</b>.</translation>
+        <translation type="obsolete">Неуспешно изчистване на снимка <b>%1</b> на виртуална машина <b>%2</b>.</translation>
     </message>
     <message>
         <source>Failed to discard the current state of the virtual machine <b>%1</b>.</source>
-        <translation type="obsolete">Проблем при изчистването на текущото състояние на виртуална машина <b>%1</b>.</translation>
+        <translation type="obsolete">Неуспешно изчистване на текущото състояние на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to discard the current snapshot and the current state of the virtual machine <b>%1</b>.</source>
-        <translation type="obsolete">Проблем при изчистването на настоящата снимка и на текущото състояние на виртуална машина <b>%1</b>.</translation>
+        <translation type="obsolete">Неуспешно изчистване на настоящата снимка и на текущото състояние на виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>There is no virtual machine named <b>%1</b>.</source>
@@ -6759,31 +7464,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to create a new session.</source>
-        <translation>Проблем при създаването на нова сесия.</translation>
+        <translation>Неуспешно създаване на нова сесия.</translation>
     </message>
     <message>
         <source>Failed to open a session for the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при отварянето на сесия за виртуална машина <b>%1</b>.</translation>
+        <translation>Неуспешно отваряне на сесия за виртуална машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to remove the host network interface <b>%1</b>.</source>
-        <translation>Проблем при премахването на реален мрежов интерфейс <b>%1</b>.</translation>
+        <translation>Неуспешно премахване на реален мрежов интерфейс <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Проблем при закачането на USB устройство <b>%1</b> към виртуална машина <b>%2</b>.</translation>
+        <translation>Неуспешно закачване на USB устройство <b>%1</b> към виртуална машина <b>%2</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>проблем при изваждането на USB устройство <b>%1</b> от виртуална машина <b>%2</b>.</translation>
+        <translation>Неуспешно изваждане на USB устройство <b>%1</b> от виртуална машина <b>%2</b>.</translation>
     </message>
     <message>
         <source>Failed to create the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.</source>
-        <translation>Проблем при създаването на споделена папка <b>%1</b> (сочеща към <nobr><b>%2</b></nobr>) за виртуална машина <b>%3</b>.</translation>
+        <translation>Неуспешно създаване на споделена папка <b>%1</b> (сочеща към <nobr><b>%2</b></nobr>) за виртуална машина <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</source>
-        <translation type="obsolete">Проблем при премахването на споделена папка <b>%1</b> (сочеща към <nobr><b>%2</b></nobr>) от виртуална машина <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно премахване на споделена папка <b>%1</b> (сочеща към <nobr><b>%2</b></nobr>) от виртуална машина <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> in the current video mode. You need to capture the mouse (by clicking over the VM display or pressing the host key) in order to use the mouse inside the guest OS.</p></source>
@@ -6868,24 +7573,24 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Не може да се зареди езиковият файл <b><nobr>%1</nobr></b>. <p>Езикът временно ще бъде върнат до Английски (вграден). Моля, отидете в диалога <b>Предпочитания</b>, който може да бъде отворен от менюто <b>Файл</b> на основния прозорец на VirtualBox, и изберете един от съществуващите езици в страницата  <b>Език</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>VirtualBox Виртуални Добавки, които са инсталирани във виртуалната ОС, са твърде стари: инсталираната версия е %1, очакваната версия е %2. Някои функции, които изискват Виртуални Добавки (интеграция на мишката, авто-преоразмеряване на виртуалния прозорец) вероятно няма да работят правилно.</p><p>Моля, обновете Виртуалните Добавки до настоящата версия като изберете <b>Инсталиране на Виртуални Добавки</b> от менюто <b [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>VirtualBox Виртуални Добавки, които са инсталирани във виртуалната ОС, не са съвременни: инсталираната версия е %1, очакваната версия е %2. Някои функции, които изискват Виртуални Добавки (интеграция на мишката, авто-преоразмеряване на виртуалния прозорец) вероятно няма да работят правилно.</p><p>Моля, обновете Виртуалните Добавки до настоящата версия като изберете <b>Инсталиране на Виртуални Добавки</b> от менюто < [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>VirtualBox Виртуални Добавки, които са инсталирани във виртуалната ОС, са твърде нови за тази версия на VirtualBox: инсталираната версия е %1, очакваната версия е %2.</p><p>Използването на по-нова версия на добавките с по-стара версия на VirtualBox не се поддържа. Моля, инсталирайте необходимата версия на Виртуални Добавки, като изберете <b>Инсталиране на Виртуални Добавки от менюто <b>Устройства</b>.</p></ [...]
     </message>
     <message>
         <source>Failed to change the snapshot folder path of the virtual machine <b>%1<b> to <nobr><b>%2</b></nobr>.</source>
-        <translation type="obsolete">Проблем при смяната пътя до папката със снимки на виртуалната машина <b>%1<b> към <nobr><b>%2</b></nobr>.</translation>
+        <translation type="obsolete">Неуспешна смяна на пътя до папката със снимки на виртуалната машина <b>%1<b> към <nobr><b>%2</b></nobr>.</translation>
     </message>
     <message>
         <source><p>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</p><p>Please close all programs in the guest OS that may be using this shared folder and try again.</p></source>
-        <translation><p>проблем при премахването на споделената папка <b>%1</b> (сочеща към <nobr><b>%2</b></nobr>) от виртуалната машина <b>%3</b>.</p><p>Моля, затворете всички програми във виртуалната ОС, които може би използват тази споделена папка, и опитайте отново.</p></translation>
+        <translation><p>Неуспешно премахване на споделената папка <b>%1</b> (сочеща към <nobr><b>%2</b></nobr>) от виртуалната машина <b>%3</b>.</p><p>Моля, затворете всички програми във виртуалната ОС, които може би използват тази споделена папка, и опитайте отново.</p></translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file <nobr><b>%1</b></nobr> or <nobr><b>%2</b>.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -6893,7 +7598,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to download the VirtualBox Guest Additions disk image file from <nobr><a href="%1">%2</a>.</nobr></p><p>%3</p></source>
-        <translation type="obsolete"><p>проблем при свалянето на CD изображението VirtualBox Виртуални Добавки от <nobr><a href="%1">%2</a>.</nobr></p><p>%3</p></translation>
+        <translation type="obsolete"><p>Неуспешно сваляне на CD изображението VirtualBox Виртуални Добавки от <nobr><a href="%1">%2</a>.</nobr></p><p>%3</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the VirtualBox Guest Additions disk image file from <nobr><a href="%1">%2</a></nobr> (size %3 bytes)?</p></source>
@@ -6913,43 +7618,43 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to find license files in <nobr><b>%1</b></nobr>.</source>
-        <translation type="obsolete">Проблем при намирането на лицензни файлове в <nobr><b>%1</b></nobr>.</translation>
+        <translation type="obsolete">Неуспешно намиране на лицензни файлове в <nobr><b>%1</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.</source>
-        <translation>Проблем при отварянето на лицензния файл <nobr><b>%1</b></nobr>. Проверете правата на файла.</translation>
+        <translation>Неуспешно отваряне на лицензния файл <nobr><b>%1</b></nobr>. Проверете правата на файла.</translation>
     </message>
     <message>
         <source>Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при изпращането на събитие натиснат ACPI бутон за включване към виртуалната машина <b>%1</b>.</translation>
+        <translation>Неуспешно изпращане на събитие натиснат ACPI бутон за включване към виртуалната машина <b>%1</b>.</translation>
     </message>
     <message>
         <source><p>Congratulations! You have been successfully registered as a user of VirtualBox.</p><p>Thank you for finding time to fill out the registration form!</p></source>
-        <translation type="obsolete"><p>Поздравления! Бяхте успешно регистриран като потребител на VirtualBox.</p><p>Благодарим ви за отделеното време за попълването на регистрационната форма!</p></translation>
+        <translation type="obsolete"><p>Поздравления! Бяхте успешно регистриран като потребител на VirtualBox.</p><p>Благодарим Ви за отделеното време за попълването на регистрационната форма!</p></translation>
     </message>
     <message>
         <source><p>Failed to register the VirtualBox product</p><p>%1</p></source>
-        <translation type="obsolete"><p>Проблем при регистрирането на VirtualBox</p><p>%1</p></translation>
+        <translation type="obsolete"><p>Неуспешно регистриране на VirtualBox</p><p>%1</p></translation>
     </message>
     <message>
         <source><p>Failed to save the global VirtualBox settings to <b><nobr>%1</nobr></b>.</p></source>
-        <translation type="obsolete"><p>Проблем при запазването на общите настройки на VirtualBox в <b><nobr>%1</nobr></b>.</p></translation>
+        <translation type="obsolete"><p>Неуспешно запазване на общите настройки на VirtualBox в <b><nobr>%1</nobr></b>.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
-        <translation><p>Проблем при зареждането на основната GUI конфигурация от <b><nobr>%1</nobr></b>.</p><p>Програмата ще бъде изключена.</p></translation>
+        <translation><p>Неуспешно зареждане на основната GUI конфигурация от <b><nobr>%1</nobr></b>.</p><p>Програмата ще бъде изключена.</p></translation>
     </message>
     <message>
         <source><p>Failed to save the global GUI configuration to <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
-        <translation><p>Проблем при запазването на основната GUI конфигурация в <b><nobr>%1</nobr></b>.</p><p>Програмата ще бъде изключена.</p></translation>
+        <translation><p>Неуспешно запазване на основната GUI конфигурация в <b><nobr>%1</nobr></b>.</p><p>Програмата ще бъде изключена.</p></translation>
     </message>
     <message>
         <source>Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.</source>
-        <translation>Проблем при запазването на настройките на виртуалната машина <b>%1</b> в <b><nobr>%2</nobr></b>.</translation>
+        <translation>Неуспешно запазване на настройките на виртуалната машина <b>%1</b> в <b><nobr>%2</nobr></b>.</translation>
     </message>
     <message>
         <source>Failed to load the settings of the virtual machine <b>%1</b> from <b><nobr>%2</nobr></b>.</source>
-        <translation type="obsolete">Проблем при зареждането на настройките на виртуалната машина <b>%1</b> от <b><nobr>%2</nobr></b>.</translation>
+        <translation type="obsolete">Неуспешно зареждане на настройките на виртуалната машина <b>%1</b> от <b><nobr>%2</nobr></b>.</translation>
     </message>
     <message>
         <source>Delete</source>
@@ -6977,9 +7682,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Изтегляне</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Монтиране</translation>
+        <translation type="obsolete">Монтиране</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7032,7 +7737,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to copy file <b><nobr>%1</nobr></b> to <b><nobr>%2</nobr></b> (%3).</source>
-        <translation type="obsolete">Проблем при копиране на файл <b><nobr>%1</nobr></b> в <b><nobr>%2</nobr></b> (%3).</translation>
+        <translation type="obsolete">Неуспешно копиране на файл <b><nobr>%1</nobr></b> в <b><nobr>%2</nobr></b> (%3).</translation>
     </message>
     <message>
         <source>&Create</source>
@@ -7066,7 +7771,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>The Virtual Machine reports that the guest OS supports <b>mouse pointer integration</b>. This means that you do not need to <i>capture</i> the mouse pointer to be able to use it in your guest OS -- all mouse actions you perform when the mouse pointer is over the Virtual Machine's display are directly sent to the guest OS. If the mouse is currently captured, it will be automatically uncaptured.</p><p>The mouse icon on the s [...]
-        <translation><p>Виртуалната машина съобщава, че виртуалната ОС поддържа <b>интеграция показалеца на мишката</b>. Това означава, че не е нужно да <i>прихващате</i> показалеца на мишката, за да можете да го използвате във виртуалната ОС - всички действия на мишката, които извършите, когато показалецът на мишката е върху екрана на виртуалната машина,  ще бъдат изпращани директно към виртуалната ОС. Ако мишката е прихваната в момента, тя ще бъде освобожд [...]
+        <translation><p>Виртуалната машина съобщава, че виртуалната ОС поддържа <b>интеграция показалеца на мишката</b>. Това означава, че не е нужно да <i>прихващате</i> показалеца на мишката, за да можете да го използвате във виртуалната ОС - всички действия на мишката, които извършите, когато показалецът на мишката е върху екрана на виртуалната машина,  ще бъдат изпращани директно към виртуалната ОС. Ако мишката е прихваната в момента, тя ще бъде освобожд [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>. Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -7125,8 +7830,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Показва диалога с информацията за продукта</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Излязла е нова версия на VirtualBox! Версия <b>%1</b> е достъпна на <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>. Можете да изтеглите тази версия от тази директна връзка:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Излязла е нова версия на VirtualBox! Версия <b>%1</b> е достъпна на <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>. Можете да изтеглите тази версия от тази директна връзка:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7147,7 +7852,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The next dialog will let you choose whether you also want to delete the storage unit of this hard disk or keep it for later usage.</source>
-        <translation type="obsolete">Следващият диалог ще ви даде избор дали наистина искате да изтриете файла на този твърд диск или искате да го запазите за последващо използване.</translation>
+        <translation type="obsolete">Следващият диалог ще Ви даде избор дали наистина искате да изтриете файла на този твърд диск или искате да го запазите за последващо използване.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to add it to the list later again.</p></source>
@@ -7164,7 +7869,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Do you want to delete the storage unit of the hard disk <nobr><b>%1</b></nobr>?</p><p>If you select <b>Delete</b> then the specified storage unit will be permanently deleted. This operation <b>cannot be undone</b>.</p><p>If you select <b>Keep</b> then the hard disk will be only removed from the list of known hard disks, but the storage unit will be left untouched which makes it po [...]
-        <translation><p>Искате ли да изтриете файла на твърдия диск <nobr><b>%1</b></nobr>?</p><p>Ако изберете <b>Изтриване</b>, избраният файл ще бъде безвъзвратно изтрит. Тази операция <b>не може да бъде върната</b>.</p><p>Ако изберете <b>Запазване</b>, тогава само твърдият диск ще бъде премахнат от списъка с познати твърди дискове, но файлът му няма да бъде докосван, което ви дава възможност да д [...]
+        <translation><p>Искате ли да изтриете файла на твърдия диск <nobr><b>%1</b></nobr>?</p><p>Ако изберете <b>Изтриване</b>, избраният файл ще бъде безвъзвратно изтрит. Тази операция <b>не може да бъде върната</b>.</p><p>Ако изберете <b>Запазване</b>, тогава само твърдият диск ще бъде премахнат от списъка с познати твърди дискове, но файлът му няма да бъде докосван, което Ви дава възможност да д [...]
     </message>
     <message>
         <source>Delete</source>
@@ -7178,7 +7883,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to delete the storage unit of the hard disk <b>%1</b>.</source>
-        <translation>Проблем при изтриването файла на твърдия диск <b>%1</b>.</translation>
+        <translation>Неуспешно изтриване на файла на твърдия диск <b>%1</b>.</translation>
     </message>
     <message>
         <source><p>There are no unused hard disks available for the newly created attachment.</p><p>Press the <b>Create</b> button to start the <i>New Virtual Disk</i> wizard and create a new hard disk, or press the <b>Select</b> if you wish to open the <i>Virtual Media Manager</i>.</p></source>
@@ -7186,39 +7891,39 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to create the hard disk storage <nobr><b>%1</b>.</nobr></source>
-        <translation>Проблем при създаването файла на твърдия диск <nobr><b>%1</b>.</nobr></translation>
+        <translation>Неуспешно създаване на файла на твърдия диск <nobr><b>%1</b>.</nobr></translation>
     </message>
     <message>
         <source>Failed to attach the hard disk <nobr><b>%1</b></nobr> to slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="obsolete">Проблем при закачането на твърдия диск <nobr><b>%1</b></nobr> към слота <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно закачване на твърдия диск <nobr><b>%1</b></nobr> към слота <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the hard disk <nobr><b>%1</b></nobr> from slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="obsolete">Проблем при разкачането на твърдия диск <nobr><b>%1</b></nobr> от слота <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно разкачване на твърдия диск <nobr><b>%1</b></nobr> от слота <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to mount the %1 <nobr><b>%2</b></nobr> on the machine <b>%3</b>.</source>
-        <translation type="obsolete">Проблем при монтирането на %1 <nobr><b>%2</b></nobr> в машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно монтиране на %1 <nobr><b>%2</b></nobr> в машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to unmount the %1 <nobr><b>%2</b></nobr> from the machine <b>%3</b>.</source>
-        <translation type="obsolete">Проблем при демонтирането на %1 <nobr><b>%2</b></nobr> от машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно демонтиране на %1 <nobr><b>%2</b></nobr> от машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to open the %1 <nobr><b>%2</b></nobr>.</source>
-        <translation type="obsolete">Проблем при отварянето на %1 <nobr><b>%2</b></nobr>.</translation>
+        <translation type="obsolete">Неуспешно отваряне на %1 <nobr><b>%2</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to close the %1 <nobr><b>%2</b></nobr>.</source>
-        <translation type="obsolete">Проблем при затварянето на %1 <nobr><b>%2</b></nobr>.</translation>
+        <translation type="obsolete">Неуспешно затваряне на %1 <nobr><b>%2</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to access the disk image file <nobr><b>%1</b></nobr>.</source>
-        <translation>Проблем при установяването достъпността на диска <nobr><b>%1</b></nobr>.</translation>
+        <translation>Неуспешно установяване достъпността на диска <nobr><b>%1</b></nobr>.</translation>
     </message>
     <message>
         <source><p>Failed to connect to the VirtualBox online registration service due to the following error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>Проблем при свързването към услугата за онлайн регистрация на VirtualBox, поради следната грешка:</p><p><b>%1</b></p></translation>
+        <translation type="obsolete"><p>Неуспешно свързване към услугата за онлайн регистрация на VirtualBox, поради следната грешка:</p><p><b>%1</b></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following error:</p><p><b>%1</b></p></source>
@@ -7226,11 +7931,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Един или повече виртуални твърди дискове, CD/DVD или флопи дискове не са достъпни в момента. В резултат на това, няма да можете да работите с тях във виртуалните машини, които ги използват, докато не станат достъпни по-късно.</p><p>Натиснете <b>Проверка</b>, за да отворите прозореца на Управлението на виртуални дискове и да видите кои дискове са недостъпни, или натиснете <b>Игнориране</b>, за да игнорирате това съобщение.& [...]
+        <translation type="obsolete"><p>Един или повече виртуални твърди дискове, CD/DVD или флопи дискове не са достъпни в момента. В резултат на това, няма да можете да работите с тях във виртуалните машини, които ги използват, докато не станат достъпни по-късно.</p><p>Натиснете <b>Проверка</b>, за да отворите прозореца на Управлението на виртуални дискове и да видите кои дискове са недостъпни, или натиснете <b>Игнориране</b>, за да игнорирате  [...]
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
-        <translation type="obsolete"><p>Съществуващите ви файлове с настройки за VirtualBox са преобразувани автоматично от стария формат към новия формат, необходим за новата версия на VirtualBox.</p><p>Натиснете <b>Добре</b>, за да стартирате VirtualBox сега, или натиснете <b>Повече</b>, ако искате да получите повече информация относно това кои файлове са били преобразувани и за да достъпите допълнителни действия.</p><p>Натиснете &l [...]
+        <translation type="obsolete"><p>Съществуващите Ви файлове с настройки за VirtualBox са преобразувани автоматично от стария формат към новия формат, необходим за новата версия на VirtualBox.</p><p>Натиснете <b>Добре</b>, за да стартирате VirtualBox сега, или натиснете <b>Повече</b>, ако искате да получите повече информация относно това кои файлове са били преобразувани и за да достъпите допълнителни действия.</p><p>Натиснете &l [...]
     </message>
     <message>
         <source>&More</source>
@@ -7256,8 +7961,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Замяна</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Възникна критична грешка по време изпълнението на виртуалната машина и изпълнението на машината е спряно.</p><p>За помощ, моля, погледнете секцията Общност на адрес <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> или договора ви за поддръжка. Моля, представете съдържанието на файла със записки <tt>VBox.log</tt> и картинката <tt>VBox.png</tt>, които можете да намерите в папка <nobr><b& [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Възникна критична грешка по време изпълнението на виртуалната машина и изпълнението на машината е спряно.</p><p>За помощ, моля, погледнете секцията Общност на адрес <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> или договора Ви за поддръжка. Моля, представете съдържанието на файла със записки <tt>VBox.log</tt> и картинката <tt>VBox.png</tt>, които можете да намерите в папка < [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7284,7 +7989,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to remove the file <b>%1</b>.<br /><br />Please try to remove the file yourself and try again.</source>
-        <translation type="obsolete">Проблем при премахването на файла <b>%1</b>.<br /><br />Моля, опитайте да премахнете файла ръчно и опитайте отново.</translation>
+        <translation type="obsolete">Неуспешно премахване на файла <b>%1</b>.<br /><br />Моля, опитайте да премахнете файла ръчно и опитайте отново.</translation>
     </message>
     <message>
         <source>You are running a prerelease version of VirtualBox. This version is not suitable for production use.</source>
@@ -7337,39 +8042,39 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to create the host-only network interface.</source>
-        <translation type="obsolete">Проблем при създаването на мрежов интерфейс само-хост.</translation>
+        <translation type="obsolete">Неуспешно създаване на мрежов интерфейс само-хост.</translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files will be automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if you want to terminate the VirtualBox application without any further actions.</p></source>
-        <translation type="obsolete"><p>Съществуващите ви файлове с настройки за VirtualBox ще бъдат автоматично преобразувани от стария формат към новия формат, необходим за новата версия на VirtualBox.</p><p>Натиснете <b>Добре</b>, за да стартирате VirtualBox сега, или натиснете <b>Изход</b>, ако искате да изключите програмата VirtualBox без каквито и да е други действия.</p></translation>
+        <translation type="obsolete"><p>Съществуващите Ви файлове с настройки за VirtualBox ще бъдат автоматично преобразувани от стария формат към новия формат, необходим за новата версия на VirtualBox.</p><p>Натиснете <b>Добре</b>, за да стартирате VirtualBox сега, или натиснете <b>Изход</b>, ако искате да изключите програмата VirtualBox без каквито и да е други действия.</p></translation>
     </message>
     <message>
         <source>Failed to open appliance.</source>
-        <translation type="obsolete">Проблем при отварянето на приспособление.</translation>
+        <translation type="obsolete">Неуспешно отваряне на приспособление.</translation>
     </message>
     <message>
         <source>Failed to open/interpret appliance <b>%1</b>.</source>
-        <translation>Проблем при отварянето/разпознаването на приспособление <b>%1</b>.</translation>
+        <translation>Неуспешно отваряне/разпознаване на приспособление <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to import appliance <b>%1</b>.</source>
-        <translation>Проблем при внасянето на приспособление <b>%1</b>.</translation>
+        <translation>Неуспешно внасяне на приспособление <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to create appliance.</source>
-        <translation type="obsolete">Проблем при създаването на приспособление.</translation>
+        <translation type="obsolete">Неуспешно създаване на приспособление.</translation>
     </message>
     <message>
         <source>Failed to prepare the export of the appliance <b>%1</b>.</source>
-        <translation>Проблем при подготовката за изнасяне на приспособлението <b>%1</b>.</translation>
+        <translation>Неуспешна подготовка за изнасяне на приспособлението <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to create an appliance.</source>
-        <translation type="obsolete">Проблем при създаването на приспособление.</translation>
+        <translation type="obsolete">Неуспешно създаване на приспособление.</translation>
     </message>
     <message>
         <source>Failed to export appliance <b>%1</b>.</source>
-        <translation>Проблем при изнасянето на приспособление <b>%1</b>.</translation>
+        <translation>Неуспешно изнасяне на приспособление <b>%1</b>.</translation>
     </message>
     <message>
         <source><p>Deleting this host-only network will remove the host-only interface this network is based on. Do you want to remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p><p><b>Note:</b> this interface may be in use by one or more virtual network adapters belonging to one of your VMs. After it is removed, these adapters will no longer be usable until you correct their settings by either choosing a different in [...]
@@ -7401,7 +8106,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. We strongly recommend that you change this, as it is a severe mis-configuration of your system which could cause USB devices to fail in unexpected ways.</source>
-        <translation>Изглежда, че имате USBFS файлова система, монтирана в /sys/bus/usb/drivers. Силно ви препоръчваме да промените това, тъй като това е тежък пропуск в конфигурацията на системата ви, което може да доведе до грешки в USB устройството по неподозирани начини.</translation>
+        <translation>Изглежда, че имате USBFS файлова система, монтирана в /sys/bus/usb/drivers. Силно Ви препоръчваме да промените това, тъй като това е тежък пропуск в конфигурацията на системата Ви, което може да доведе до грешки в USB устройството по неподозирани начини.</translation>
     </message>
     <message>
         <source>You are running an EXPERIMENTAL build of VirtualBox. This version is not suitable for production use.</source>
@@ -7425,11 +8130,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
-        <translation>Проблем при възстановяването на снимката <b>%1</b> на виртуалната машина <b>%2</b>.</translation>
+        <translation>Неуспешно възстановяване на снимката <b>%1</b> на виртуалната машина <b>%2</b>.</translation>
     </message>
     <message>
         <source>Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
-        <translation>Проблем при изтриването на снимката <b>%1</b> на виртуалната машина <b>%2</b>.</translation>
+        <translation>Неуспешно изтриване на снимката <b>%1</b> на виртуалната машина <b>%2</b>.</translation>
     </message>
     <message>
         <source><p>There are no unused media available for the newly created attachment.</p><p>Press the <b>Create</b> button to start the <i>New Virtual Disk</i> wizard and create a new medium, or press the <b>Select</b> if you wish to open the <i>Virtual Media Manager</i>.</p></source>
@@ -7451,11 +8156,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the %1 to slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="obsolete">Проблем при свързването на %1 към слот <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно свързване на %1 към слот <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the %1 from slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="obsolete">Проблем при разкачането на %1 от слот <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно разкачване на %1 от слот <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Unable to insert the %1 <nobr><b>%2</b></nobr> into the machine <b>%3</b>.</source>
@@ -7479,7 +8184,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to eject the disk from the virtual drive. The drive may be locked by the guest operating system. Please check this and try again.</source>
-        <translation type="obsolete">Проблем при изваждането на диска от виртуалното устройство. Устройството може да е заключено от виртуалната ОС. Моля, проверете това и опитайте отново.</translation>
+        <translation type="obsolete">Неуспешно изваждане на диска от виртуалното устройство. Устройството може да е заключено от виртуалната ОС. Моля, проверете това и опитайте отново.</translation>
     </message>
     <message>
         <source><p>Could not insert the VirtualBox Guest Additions installer disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
@@ -7536,7 +8241,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Сигурни ли сте, че искате да изтриете CD/DVD устройството?</p><p>Няма да имате възможност да монтирате CD или ISO изображения, или да инсталирате Виртуални Добавки без него!</p></translation>
+        <translation type="obsolete"><p>Сигурни ли сте, че искате да изтриете CD/DVD устройството?</p><p>Няма да имате възможност да монтирате CD или ISO изображения, или да инсталирате Виртуални Добавки без него!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7593,7 +8298,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to open virtual machine located in %1.</source>
-        <translation>Проблем с отварянето на виртуална машина, разположена в %1.</translation>
+        <translation>Неуспешно отваряне на виртуална машина, разположена в %1.</translation>
     </message>
     <message>
         <source>Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.</source>
@@ -7639,7 +8344,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Предстои да добавите ново CD/DVD устройство към контролера <b>%1</b>.</p><p>Искате ли да изберете виртуален CD/DVD диск, който да се вкара в устройството, или ще го оставите празно засега?</p></translation>
+        <translation type="obsolete"><p>Предстои да добавите ново CD/DVD устройство към контролера <b>%1</b>.</p><p>Искате ли да изберете виртуален CD/DVD диск, който да се вкара в устройството, или ще го оставите празно засега?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7657,18 +8362,18 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Проблем при разкачането на твърдия диск (<nobr><b>%1</b></nobr>) от слота <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation>Неуспешно разкачване на твърдия диск (<nobr><b>%1</b></nobr>) от слота <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Проблем при разкачането на CD/DVD устройството (<nobr><b>%1</b></nobr>) от слота <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно разкачване на CD/DVD устройството (<nobr><b>%1</b></nobr>) от слота <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Проблем при разкачането на флопи устройството (<nobr><b>%1</b></nobr>) от слота <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно разкачване на флопи устройството (<nobr><b>%1</b></nobr>) от слота <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>Виртуалните Добавки на VirtualBox за тази виртуална машина изглежда не са достъпни, а споделените папки не могат да се използват без тях. За да използвате споделени папки във виртуалната машина, моля, инсталирайте Виртуалните Добавки, ако не са инсталирани, или ги преинсталирайте, ако не работят правилно, като изберете <b>Инсталиране на Виртуални Добавки</b> от менюто <b>Машина</b>. Ако те са инсталирани, но машината в [...]
     </message>
     <message numerus="yes">
@@ -7680,15 +8385,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
-        <translation>Проблем при обновяването на Виртуални Добавки. Инсталационното изображение на Виртуалните Добавки ще бъде монтирано, за да се осигури ръчна инсталация.</translation>
+        <translation>Неуспешно обновяване на Виртуални Добавки. Инсталационното изображение на Виртуалните Добавки ще бъде монтирано, за да се осигури ръчна инсталация.</translation>
     </message>
     <message>
         <source>Failed to install the Extension Pack <b>%1</b>.</source>
-        <translation>Проблем при инсталирането на пакета с разширения <b>%1</b>.</translation>
+        <translation>Неуспешно инсталиране на пакета с разширения <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to uninstall the Extension Pack <b>%1</b>.</source>
-        <translation>Проблем при деинсталирането на пакета с разширения <b>%1</b>.</translation>
+        <translation>Неуспешно деинсталиране на пакета с разширения <b>%1</b>.</translation>
     </message>
     <message>
         <source>You are about to remove the Extension Pack <b>%1</b>. Are you sure you want to do that?</source>
@@ -7712,23 +8417,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Проблем при закачането на твърдия диск (<nobr><b>%1</b></nobr>) към слота <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation>Неуспешно закачване на твърдия диск (<nobr><b>%1</b></nobr>) към слота <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Проблем при закачането на CD/DVD устройството (<nobr><b>%1</b></nobr>) към слота <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно закачване на CD/DVD устройството (<nobr><b>%1</b></nobr>) към слота <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Проблем при закачането на флопи устройството (<nobr><b>%1</b></nobr>) към слота <i>%2</i> на машината <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешно закачване на флопи устройството (<nobr><b>%1</b></nobr>) към слота <i>%2</i> на машината <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Имайте предвид, че запаметяващото устройство на тази медия няма да бъде изтрито, така че ще е възможно да се използва отново по-късно.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation type="unfinished"><p>Виртуалните Добавки на VirtualBox за тази виртуална машина изглежда не са достъпни, а споделените папки не могат да се използват без тях. За да използвате споделени папки във виртуалната машина, моля, инсталирайте Виртуалните Добавки, ако не са инсталирани, или ги преинсталирайте, ако не работят правилно, като изберете <b>Инсталиране на Виртуални Добавки</b> от менюто <b>Устройства</b>. Ако те са инсталирани, но маши [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Виртуалните Добавки на VirtualBox за тази виртуална машина изглежда не са достъпни, а споделените папки не могат да се използват без тях. За да използвате споделени папки във виртуалната машина, моля, инсталирайте Виртуалните Добавки, ако не са инсталирани, или ги преинсталирайте, ако не работят правилно, като изберете <b>Инсталиране на Виртуални Добавки</b> от менюто <b>Устройства</b>. Ако те са инсталирани, но машина [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -7749,7 +8454,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to open the Extension Pack <b>%1</b>.</source>
-        <translation>Проблем при отварянето на пакета с разширения <b>%1</b>.</translation>
+        <translation>Неуспешно отваряне на пакета с разширения <b>%1</b>.</translation>
     </message>
     <message>
         <source><p>You are about to install a VirtualBox extension pack. Extension packs complement the functionality of VirtualBox and can contain system level software that could be potentially harmful to your system. Please review the description below and only proceed if you have obtained the extension pack from a trusted source.</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%1< [...]
@@ -7809,7 +8514,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to register the virtual machine <b>%1</b>.</source>
-        <translation>Проблем пр регистрирането на виртуалната машина <b>%1</b>.</translation>
+        <translation>Неуспешно регистриране на виртуалната машина <b>%1</b>.</translation>
     </message>
     <message>
         <source><p>The machine settings were changed while you were editing them. You currently have unsaved setting changes.</p><p>Would you like to reload the changed settings or to keep your own changes?</p></source>
@@ -7829,7 +8534,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to clone the virtual machine <b>%1</b>.</source>
-        <translation>Проблем при клонирането на виртуалната машина <b>%1</b>.</translation>
+        <translation>Неуспешно клониране на виртуалната машина <b>%1</b>.</translation>
     </message>
     <message>
         <source><p>You are about to restore snapshot <b>%1</b>.</p><p>You can create a snapshot of the current state of the virtual machine first by checking the box below; if you do not do this the current state will be permanently lost. Do you wish to proceed?</p></source>
@@ -7845,7 +8550,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p></source>
-        <translation><p>Проблем при промяната типа на медията от <b>%1</b> на <b>%2</b>.</p></translation>
+        <translation><p>Неуспешна промяна типа на медията от <b>%1</b> на <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b><nobr>%1</nobr></b> to be installed.</p><p>Please install the Extension Pack from the VirtualBox download site. After this you will be able to re-enable USB 2.0. It will be disabled in the meantime unless you cancel the current settings changes.</p></source>
@@ -7974,7 +8679,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Неуспех при пропускането на данни.</translation>
+        <translation type="obsolete">Неуспех при пропускането на данни.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -8022,7 +8727,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Could not start the machine <b>%1</b> because the following physical network interfaces were not found:</p><p><b>%2</b></p><p>You can either change the machine's network settings or stop the machine.</p></source>
-        <translation><p>Не може да се включи машината <b>%1</b>, защото следният физически мрежови интерфейс не е намерен:</p><p><b>%2</b></p><p>Можете или да промените мрежовите настройки на машината, или да я спрете.</p></translation>
+        <translation><p>Не може да се включи машината <b>%1</b>, защото следният физически мрежов интерфейс не е намерен:</p><p><b>%2</b></p><p>Можете или да промените мрежовите настройки на машината, или да я спрете.</p></translation>
     </message>
     <message>
         <source>Change Network Settings</source>
@@ -8034,240 +8739,363 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>VirtualBox Управление не може да се включи, заради локални ограничения.</p><p>Приложението сега ще се изключи.</p></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Не може да се намери езиков файл за езика <b>%1</b> в папката <b><nobr>%2</nobr></b>.</p><p>Езикът временно ще бъде върнат към стандартния за системата. Моля, отидете в диалога <b>Предпочитания</b>, който може да бъде отворен от менюто <b>Файл</b> на основния прозорец на VirtualBox, и изберете един от съществуващите езици в страницата  <b>Език</b>.</p></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Не може да се зареди езиковият файл <b><nobr>%1</nobr></b>. <p>Езикът временно ще бъде върнат до Английски (вграден). Моля, отидете в диалога <b>Предпочитания</b>, който може да бъде отворен от менюто <b>Файл</b> на основния прозорец на VirtualBox, и изберете един от съществуващите езици в страницата  <b>Език</b>.</p></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма виртуална машина с индикатора <b>%1</b>.</translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation type="unfinished"></translation>
+        <translation>Игнориране</translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно създаване на NAT мрежа.</translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно премахване на NAT мрежа <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно създаване на DHCP сървър.</translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно премахване на DHCP сървър от мрежов интерфейс <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно създаване на реален мрежов интерфейс.</translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation type="unfinished">Създаване на &нов диск</translation>
+        <translation>Създаване на &нов диск</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation type="unfinished">&Избор на съществуващ диск</translation>
+        <translation>&Избор на съществуващ диск</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation type="unfinished">&Оставяне празно</translation>
+        <translation>&Оставяне празно</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation type="unfinished">&Избор на диск</translation>
+        <translation>&Избор на диск</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Сигурни ли сте, че искате да освободите виртуалния твърд диск <nobr><b>%1</b></nobr>?</p><p>Това ще го разкачи от следните виртуални машини: <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Сигурни ли сте, че искате да освободите виртуалния оптичен диск <nobr><b>%1</b></nobr>?</p><p>Това ще го разкачи от следните виртуални машини: <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Сигурни ли сте, че искате да освободите виртуалния флопи диск <nobr><b>%1</b></nobr>?</p><p>Това ще го разкачи от следните виртуални машини: <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Сигурни ли сте, че искате да премахнете виртуалния твърд диск <nobr><b>%1</b></nobr> от списъка с познатите дискове?</p></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Тъй като този твърд диск е недостъпен, неговият файл не може да бъде изтрит.</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Сигурни ли сте, че искате да премахнете виртуалния оптичен диск <nobr><b>%1</b></nobr> от списъка с познатите дискове?</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Сигурни ли сте, че искате да премахнете виртуалния флопи диск <nobr><b>%1</b></nobr> от списъка с познатите дискове?</p></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Не може да се вкара виртуалният оптичен диск <nobr><b>%1</b></nobr> във виртуалната машина <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Искате ли да пробвате насилствено вкарване на този диск?</p></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Не може да се извади виртуалният оптичен диск <nobr><b>%1</b></nobr> от машината <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Искате ли да пробвате насилствено изваждане на този диск?</p></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Не може да се вкара виртуалният флопи диск <nobr><b>%1</b></nobr> във виртуалната машина <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Не може да се извади виртуалният флопи диск <nobr><b>%1</b></nobr> от машината <b>%2</b>.</p></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно отваряне на файла с твърд диск <nobr><b>%1</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно отваряне на файла с оптичен диск <nobr><b>%1</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно отваряне на файла с флопи диск <nobr><b>%1</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно затваряне на файла с твърд диск <nobr><b>%2</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно затваряне на файла с оптичен диск <nobr><b>%2</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно затваряне на файла с флопи диск <nobr><b>%2</b></nobr>.</translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation type="unfinished">
-            <numerusform></numerusform>
-            <numerusform></numerusform>
+        <translation>
+            <numerusform><p>Следната %n виртуална машина е в запазено състояние: <b>%1</b></p><p>Ако продължите, включеното състояние на изнесената машина ще бъде отменено. Други машини няма да бъдат променяни.</p></numerusform>
+            <numerusform><p>Следните %n виртуални машини са в запазено състояние: <b>%1</b></p><p>Ако продължите, включеното състояние на изнесените машини ще бъде отменено. Други машини няма да бъдат променяни.</p></numerusform>
         </translation>
     </message>
     <message>
         <source>Switch</source>
-        <translation type="unfinished">Превключване</translation>
+        <translation>Превключване</translation>
     </message>
     <message>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно позволяване на сървъра за отдалечен работен плот за виртуалната машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно забраняване на сървъра за отдалечен работен плот за виртуалната машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно позволяване на видео заснемането за виртуалната машина <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно забраняване на видео заснемането за виртуалната машина <b>%1</b>.</translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Неуспешно намиране на файла с дисковото изображение <b>VirtualBox Виртуални Добавки</b>.</p><p>Искате ли да го свалите от Интернет?</p></translation>
     </message>
     <message>
         <source>Download</source>
-        <translation type="unfinished">Изтегляне</translation>
+        <translation>Изтегляне</translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Сигурни ли сте, че искате да изтеглите дисковото изображение <b>VirtualBox Виртуални Добавки</b> от <nobr><a href="%1">%1</a></nobr> (размер %2 байта)?</p></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Дисковото изображение <b>VirtualBox Виртуални Добавки</b> е свалено успешно от <nobr><a href="%1">%1</a></nobr> но не може да се запази локално в <nobr><b>%2</b>.</nobr></p><p>Моля, изберете друго местоположение за този файл!</p></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete"><p>Дисковото изображение <b>VirtualBox Виртуални Добавки</b> е свалено успешно от <nobr><a href="%1">%1</a></nobr> и запазено локално в <nobr><b>%2</b>.</nobr></p><p>Искате ли да регистрирате това дисково изображение и да го вкарате във виртуалното CD/DVD устройство?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete"><p>Не може да се вкара дисковото изображение <b>VirtualBox Виртуални Добавки</b> във виртуалната машина <b>%1</b>, тъй като машината няма CD/DVD устройства. Моля, добавете устройство, като използвате страницата Съхранение от прозореца с настройки на виртуалната машина!</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Не може да се намери <b>VirtualBox Потребителско ръководство</b> <nobr><b>%1</b>.</nobr></p><p>Искате ли да изтеглите този файл от Интернет?</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Сигурни ли сте, че искате да изтеглите <b>VirtualBox Потребителско ръководство</b> от <nobr><a href="%1">%1</a></nobr> (размер %2 байта)?</p></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation type="unfinished"><p>VirtualBox Потребителско ръководство е изтеглено успешно от <nobr><a href="%1">%2</a></nobr>, но не може да бъде запазено локално в <nobr><b>%3</b>.</nobr></p><p>Моля, изберете друго местоположение за този файл.</p> {1"?} {1<?} {2<?}</translation>
+        <translation><p>VirtualBox Потребителско ръководство е изтеглено успешно от <nobr><a href="%1">%1</a></nobr>, но не може да бъде запазено локално в <nobr><b>%2</b>.</nobr></p><p>Моля, изберете друго местоположение за този файл.</p></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation type="unfinished"><p>VirtualBox Потребителско ръководство е изтеглено успешно от <nobr><a href="%1">%2</a></nobr> и запазено локално в <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
+        <translation><p>VirtualBox Потребителско ръководство е изтеглено успешно от <nobr><a href="%1">%1</a></nobr> и запазено локално в <nobr><b>%2</b>.</nobr></p></translation>
     </message>
     <message>
         <source>Close</source>
-        <translation type="unfinished">Затваряне</translation>
+        <translation>Затваряне</translation>
     </message>
     <message>
         <source>Ok</source>
-        <translation type="unfinished">Добре</translation>
+        <translation>Добре</translation>
     </message>
     <message>
         <source>Do not show this message again</source>
-        <translation type="unfinished">Да не се показва това съобщение отново</translation>
+        <translation>Да не се показва това съобщение отново</translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation type="unfinished"></translation>
+        <translation><p>Искате ли да премахнете NAT мрежата <nobr><b>%1</b>?</nobr></p><p>Ако тази мрежа се използва от един или повече мрежови адаптери на виртуални машини, тези адаптери няма да са използваеми, докато не поправите настройките им, като изберете друга мрежа или друг тип на закачване на адаптера.</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation>Неуспешно закачване на уеб камерата <b>%1</b> към виртуалната машина <b>%2</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation>Неуспешно разкачване на уеб камерата <b>%1</b> от виртуалната машина <b>%2</b>.</translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>Виртуалните Добавки на VirtualBox за тази виртуална машина изглежда не са достъпни, а споделените папки не могат да се използват без тях. За да използвате споделени папки във виртуалната машина, моля, инсталирайте Виртуалните Добавки, ако не са инсталирани, или ги преинсталирайте, ако не работят правилно, като изберете <b>Инсталиране на Виртуални Добавки</b> от менюто <b>Устройства</b>. Ако те са инсталирани, но машина [...]
+        <translation><p>Виртуалните Добавки на VirtualBox за тази виртуална машина изглежда не са достъпни, а споделените папки не могат да се използват без тях. За да използвате споделени папки във виртуалната машина, моля, инсталирайте Виртуалните Добавки, ако не са инсталирани, или ги преинсталирайте, ако не работят правилно, като изберете <b>Инсталиране на Виртуални Добавки</b> от менюто <b>Устройства</b>. Ако те са инсталирани, но машината все още не е  [...]
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Монтиране</translation>
+        <comment>additions</comment>
+        <translation>Вкарване</translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation><p>Виртуалният екран текущо е зададен на <b>%1&nbsp;бита</b> цветови режим. За по-добра производителност, моля, променете това към <b>%2&nbsp;бита</b>. Това обикновено може да се направи от секцията <b>Екран</b> на контролния панел на виртуалната машина или системните настройки.</p></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation>Текущите правила за пренасочване на портове са невалидни. Имената на правилата трябва да са уникални.</translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation>Текущите правила за пренасочване на портове са невалидни. Няколко правила имат едни и същи портове и конфликтиращи IP адреси.</translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>Неуспешно създаване на VirtualBoxClient COM обект.</p><p>Програмата ще бъде изключена.</p></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation>Неуспешно задаване на глобалните VirtualBox допълнителни данни за ключ <i>%1</i> към стойност <i>{%2}</i>.</translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation>Неуспешно задаване на допълнителните данни за ключ <i>%1</i> на машина <i>%2</i> към стойност <i>{%3}</i>.</translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>Един или повече виртуални твърди дискове, оптични или флопи дискове не са достъпни в момента. В резултат на това, няма да можете да работите с виртуалните машини, които ги използват, докато не станат достъпни по-късно.</p><p>Натиснете <b>Проверка</b>, за да отворите прозореца на Управлението на виртуални дискове и да видите кои дискове са недостъпни, или натиснете <b>Игнориране</b>, за да игнорирате това съобщение.</p&g [...]
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation>Неуспешно запазване на настройките.</translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p>Предстои да добавите ново оптично устройство към контролера <b>%1</b>.</p><p>Искате ли да изберете виртуален оптичен диск, който да се вкара в устройството, или ще го оставите празно засега?</p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>Сигурни ли сте, че искате да изтриете оптичното устройство?</p><p>Няма да можете да вкарвате оптични дискове или ISO изображения, или да инсталирате Виртуални Добавки без него!</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Неуспешно закачване на оптичното устройство (<nobr><b>%1</b></nobr>) към слота <i>%2</i> на машината <b>%3</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Неуспешно закачване на флопи устройството (<nobr><b>%1</b></nobr>) към слота <i>%2</i> на машината <b>%3</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Неуспешно разкачване на оптичното устройство (<nobr><b>%1</b></nobr>) от слота <i>%2</i> на машината <b>%3</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Неуспешно разкачване на флопи устройството (<nobr><b>%1</b></nobr>) от слота <i>%2</i> на машината <b>%3</b>.</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this er [...]
+        <translation type="obsolete"><p>Възникна критична грешка по време на изпълнението на виртуалната машина и тя ще бъде спряна.</p><p>За помощ, моля, погледнете секцията Community на <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> или Вашия контакт за поддръжка. Моля, представете съдържанието на файла със записки <tt>VBox.log</tt>, който можете да намерите в папката на виртуалната машина, както и описание на това какво правех [...]
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Неуспешно свързване на кабела на мрежовия адаптер на виртуалната машина <b>%1</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Неуспешно откачване на кабела на мрежовия адаптер на виртуалната машина <b>%1</b>.</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation><p>Не може да се вкара дисковото изображение <b>VirtualBox Виртуални Добавки</b> във виртуалната машина <b>%1</b>, тъй като машината няма оптични устройства. Моля, добавете устройство, като използвате страницата Съхранение от прозореца с настройки на виртуалната машина!</p></translation>
+    </message>
+    <message>
+        <source>Unable to enter password!</source>
+        <translation type="obsolete">Не може да се въведе парола!</translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p>Дисковото изображение <b>VirtualBox Виртуални Добавки</b> е свалено успешно от <nobr><a href="%1">%1</a></nobr> и запазено локално в <nobr><b>%2</b>.</nobr></p><p>Искате ли да регистрирате това дисково изображение и да го вкарате във виртуалното оптично устройство?</p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation failed.</source>
+        <translation type="obsolete">Неуспешна операция по влачене и пускане.</translation>
+    </message>
+    <message>
+        <source>Failed while dropping data.</source>
+        <translation type="obsolete">Неуспешно пускане на данни.</translation>
+    </message>
+    <message>
+        <source>Unable to cancel drag and drop operation.</source>
+        <translation type="obsolete">Неуспешно прекъсване на операцията по влачене и пускане.</translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation>Грешна парола или провалена автентикация.</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation><p>Възникна критична грешка по време изпълнението на виртуалната машина и изпълнението на машината е спряно.</p><p>За помощ, моля, погледнете секцията Общност на адрес <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> или договора Ви за поддръжка. Моля, представете съдържанието на файла със записки <tt>VBox.log</tt> и картинката <tt>VBox.png</tt>, които можете да намерите в папка <nobr><b& [...]
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation><p>Възникна критична грешка по време на изпълнението на виртуалната машина и тя ще бъде спряна.</p><p>За помощ, моля, погледнете секцията Community на <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> или Вашия контакт за поддръжка. Моля, представете съдържанието на файла със записки <tt>VBox.log</tt>, който можете да намерите в папката със записки на виртуалната машина, както и описание на това какво правехте [...]
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation><p>Излязла е нова версия на VirtualBox! Версия <b>%1</b> е достъпна на <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>. Можете да изтеглите тази версия от тази директна връзка:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -8331,19 +9159,19 @@ p, li { white-space: pre-wrap; }
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation type="unfinished">Показване винаги на лентата с инструменти</translation>
+        <translation>Показване винаги на лентата с инструменти</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation type="unfinished">Скриване на прозореца</translation>
+        <translation>Скриване на прозореца</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation type="unfinished">Изход от цял екран или безрамков режим</translation>
+        <translation>Изход от цял екран или безрамков режим</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation type="unfinished">Затваряне на ВМ</translation>
+        <translation>Затваряне на ВМ</translation>
     </message>
 </context>
 <context>
@@ -8360,7 +9188,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Име:</translation>
     </message>
     <message>
@@ -8420,7 +9248,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Мрежовата операция се провали със следната грешка: %1.</translation>
     </message>
 </context>
 <context>
@@ -8447,27 +9275,27 @@ p, li { white-space: pre-wrap; }
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation type="unfinished"></translation>
+        <translation>Хостът не е намерен</translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation type="unfinished"></translation>
+        <translation>Отказан достъп до съдържание</translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation type="unfinished"></translation>
+        <translation>Грешка в протокола</translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation type="unfinished"></translation>
+        <translation>Грешен формат на SSL сертификат</translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation type="unfinished"></translation>
+        <translation>Провалена SSL автентикация</translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation type="unfinished"></translation>
+        <translation>Непозната причина</translation>
     </message>
 </context>
 <context>
@@ -8538,7 +9366,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>This wizard will help you to create a new virtual hard disk for your virtual machine.</p><p>Use the <b>Next</b> button to go to the next page of the wizard and the <b>Back</b> button to return to the previous page.</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви помогне да създадете нов виртуален твърд диск за вашата виртуална машина.</p><p>Използвайте бутона <b>Напред</b>, за да отидете към следващата страница на помощника, и бутона <b>Назад</b>, за да се върнете към предишната страница.</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви помогне да създадете нов виртуален твърд диск за вашата виртуална машина.</p><p>Използвайте бутона <b>Напред</b>, за да отидете към следващата страница на помощника, и бутона <b>Назад</b>, за да се върнете към предишната страница.</p></translation>
     </message>
     <message>
         <source>Hard Disk Storage Type</source>
@@ -8607,7 +9435,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>This wizard will help you to copy a virtual disk.</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви помогне да копирате виртуален диск.</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви помогне да копирате виртуален диск.</p></translation>
     </message>
     <message>
         <source>Please select the virtual disk which you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select a virtual disk file.</source>
@@ -8631,7 +9459,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>This wizard will help you to create a new virtual disk for your virtual machine.</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви помогне да създадете нов виртуален диск за вашата виртуална машина.</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви помогне да създадете нов виртуален диск за вашата виртуална машина.</p></translation>
     </message>
     <message>
         <source><p>Please choose the type of file that you would like to use for the new virtual disk. If you do not need to use it with other virtualization software you can leave this setting unchanged.</p></source>
@@ -8769,7 +9597,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>This wizard will help you to create a new virtual hard disk for your virtual machine.</p><p>%1</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви помогне да създадете нов виртуален твърд диск за вашата виртуална машина.</p><p>%1</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви помогне да създадете нов виртуален твърд диск за вашата виртуална машина.</p><p>%1</p></translation>
     </message>
     <message>
         <source>Virtual disk to copy</source>
@@ -8928,7 +9756,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>This wizard will guide you through the steps that are necessary to create a new virtual machine for VirtualBox.</p><p>Use the <b>Next</b> button to go the next page of the wizard and the <b>Back</b> button to return to the previous page.</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви води през стъпките, които са нужни за създаването на нова виртуална машина за VirtualBox.</p><p>Използвайте бутона <b>Напред</b>, за да отидете към следващата страница на помощника, и бутона <b>Назад</b>, за да се върнете към предишната страница.</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви води през стъпките, които са нужни за създаването на нова виртуална машина за VirtualBox.</p><p>Използвайте бутона <b>Напред</b>, за да отидете към следващата страница на помощника, и бутона <b>Назад</b>, за да се върнете към предишната страница.</p></translation>
     </message>
     <message>
         <source>< &Back</source>
@@ -9012,7 +9840,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>This wizard will guide you through the steps that are necessary to create a new virtual machine for VirtualBox.</p><p>%1</p></source>
-        <translation type="obsolete"><p>Този помощник ще ви води през стъпките, необходими за създаването на нова виртуална машина във VirtualBox.</p><p>%1</p></translation>
+        <translation type="obsolete"><p>Този помощник ще Ви води през стъпките, необходими за създаването на нова виртуална машина във VirtualBox.</p><p>%1</p></translation>
     </message>
 </context>
 <context>
@@ -9149,7 +9977,7 @@ p, li { white-space: pre-wrap; }
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation type="unfinished"></translation>
+        <translation>Клик за пълни детайли</translation>
     </message>
 </context>
 <context>
@@ -9283,14 +10111,18 @@ p, li { white-space: pre-wrap; }
         <translation>Файлове с виртуални машини (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Добре дошли във VirtualBox!</h3><p>Лявата част на този прозорец е предназначена за показване на списък с всички виртуални машини на вашия компютър. Списъкът в момента е празен, защото все още не сте създали виртуални машини.<img src=:/welcome.png align=right/></p><p>Като начало, за да създадете нова виртуална машина, натиснете бутона <b>Нова</b> в основната лента с инструменти, разположена в горната част на прозорец [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Добре дошли във VirtualBox!</h3><p>Лявата част на този прозорец е предназначена за показване на списък с всички виртуални машини на вашия компютър. Списъкът в момента е празен, защото все още не сте създали виртуални машини.<img src=:/welcome.png align=right/></p><p>Като начало, за да създадете нова виртуална машина, натиснете бутона <b>Нова</b> в основната лента с инструменти, разположена в горната  [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Управление</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation><h3>Добре дошли във VirtualBox!</h3><p>Лявата част на този прозорец е списък с всички виртуални машини на вашия компютър. Списъкът в момента е празен, защото все още не сте създали виртуални машини.<img src=:/welcome.png align=right/></p><p>За да създадете нова виртуална машина, натиснете бутона <b>Нова</b> в основната лента с инструменти, разположена в горната част на прозореца.</p><p>Можете да натиснете кл [...]
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9323,15 +10155,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Settings</source>
-        <translation>Настройки</translation>
+        <translation type="obsolete">Настройки</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation type="unfinished"></translation>
+        <translation><b>%1</b> страница:</translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation type="unfinished"></translation>
+        <translation><b>%1: %2</b> страница:</translation>
     </message>
 </context>
 <context>
@@ -9376,6 +10208,10 @@ p, li { white-space: pre-wrap; }
         <source>Display</source>
         <translation>Екран</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation>Предпочитания</translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -9451,6 +10287,43 @@ p, li { white-space: pre-wrap; }
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">текущо използвате повече контролери за съхранение, отколкото чипсетът %1 поддържа. Моля, променете типа на чипсета от страницата с настройки Система или намалете броя на следните контролери за съхранение от страницата с настройки Съхранение: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation>Потребителски интерфейс</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation>Настройки</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>Презареждане на настройките...</translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation>Запазване на настройките...</translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation><nobr><b>Клик</b> за превключване показването на индикатора.</nobr><br><nobr><b>Влачене и пускане</b> за промяна позицията на индикатора.</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation>Затваряне</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation>Позволяване на меню лентата</translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -9546,8 +10419,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Обобщение</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Излязла е нова версия на VirtualBox! Версия <b>%1</b> е достъпна на <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>. Можете да изтеглите тази версия от тази директна връзка:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Излязла е нова версия на VirtualBox! Версия <b>%1</b> е достъпна на <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>. Можете да изтеглите тази версия от тази директна връзка:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -9605,7 +10478,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Restore the machine state stored in the current snapshot</source>
-        <translation>Възстановяване сътоянието на машината до състоянието, запазено в настоящата снимка</translation>
+        <translation>Възстановяване състоянието на машината до състоянието, запазено в настоящата снимка</translation>
     </message>
     <message>
         <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
@@ -9615,6 +10488,14 @@ p, li { white-space: pre-wrap; }
         <source>&Restore current snapshot '%1'</source>
         <translation>&Възстановяване на настоящата снимка '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>Продължаване на изпълнение във &фон</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><p>Затваряне прозорците на виртуалната машина, но продължаване на изпълнението ѝ.</p><p>Можете да се върнете към прозореца на включена виртуална машина от VirtualBox Управление.</p></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -9628,84 +10509,243 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>Недостъпна</translation>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Информация за сесията</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 от %3</nobr><br><nobr>Сесия %4</nobr></translation>
+        <source>&Details</source>
+        <translation type="obsolete">&Детайли</translation>
     </message>
     <message>
-        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
-        <comment>Inaccessible VM tooltip (name, last state change)</comment>
-        <translation><nobr><b>%1</b><br></nobr><nobr>Недостъпна от %2</nobr></translation>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Изпълнение</translation>
     </message>
     <message>
-        <source>S&how</source>
-        <translation type="obsolete">&Показване</translation>
+        <source>DMA Transfers</source>
+        <translation>DMA трансфери</translation>
     </message>
     <message>
-        <source>Switch to the window of the selected virtual machine</source>
-        <translation type="obsolete">Превключване към прозореца с избраната виртуална машина</translation>
+        <source>PIO Transfers</source>
+        <translation>PIO трансфери</translation>
     </message>
     <message>
-        <source>S&tart</source>
-        <translation type="obsolete">&Старт</translation>
+        <source>Data Read</source>
+        <translation>Прочетени данни</translation>
     </message>
     <message>
-        <source>Start the selected virtual machine</source>
-        <translation type="obsolete">Стартиране на избраната виртуална машина</translation>
+        <source>Data Written</source>
+        <translation>Записани данни</translation>
     </message>
     <message>
-        <source>R&esume</source>
-        <translation type="obsolete">Пр&одължаване</translation>
+        <source>Data Transmitted</source>
+        <translation>Предадени данни</translation>
     </message>
     <message>
-        <source>Resume the execution of the virtual machine</source>
-        <translation type="obsolete">Задържане изпълнението на виртуалната машина</translation>
+        <source>Data Received</source>
+        <translation>Получени данни</translation>
     </message>
     <message>
-        <source>&Pause</source>
-        <translation type="obsolete">&Пауза</translation>
+        <source>Runtime Attributes</source>
+        <translation>Атрибути на изпълнението</translation>
     </message>
     <message>
-        <source>Suspend the execution of the virtual machine</source>
-        <translation type="obsolete">Задържане изпълнението на виртуалната машина</translation>
+        <source>Screen Resolution</source>
+        <translation>Разделителна способност на екрана</translation>
     </message>
-</context>
-<context>
-    <name>UIVMLogViewer</name>
     <message>
-        <source>Close the search panel</source>
-        <translation>Затваряне на панела за търсене</translation>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">CD/DVD статистики</translation>
     </message>
     <message>
-        <source>&Find</source>
-        <translation>&Търсене</translation>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Статистики на мрежовите адаптери</translation>
     </message>
     <message>
-        <source>Enter a search string here</source>
-        <translation>Въведете текст за търсене тук</translation>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Версия %1.%2</translation>
     </message>
     <message>
-        <source>&Previous</source>
-        <translation>&Предишно</translation>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Не са засечени</translation>
     </message>
     <message>
-        <source>Search for the previous occurrence of the string</source>
-        <translation>Търсене на предходно съвпадение на текста</translation>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Не е засечен</translation>
     </message>
     <message>
-        <source>&Next</source>
-        <translation>&Следващо</translation>
+        <source>Guest Additions</source>
+        <translation>Виртуални Добавки</translation>
     </message>
     <message>
-        <source>Search for the next occurrence of the string</source>
-        <translation>Търсене на следващо съвпадение на текста</translation>
-    </message>
+        <source>Guest OS Type</source>
+        <translation>Вид виртуална ОС</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Статистики на твърдия диск</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Няма твърди дискове</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Няма мрежови адаптери</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Позволено</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Забранено</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Вместено страниране</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Не е достъпен</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Статистики на съхранението</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Няма съхраняващи устройства</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Мрежови статистики</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Вместено страниране</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Не е достъпен</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Режим клипборд</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Режим влачене и пускане</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>&Детайли на конфигурацията</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>Ин&формация за сесията</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation>Включена от</translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation>Режим влачене и пускане</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>Недостъпна</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation><nobr>%1<br></nobr><nobr>%2 от %3</nobr><br><nobr>Сесия %4</nobr></translation>
+    </message>
+    <message>
+        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
+        <comment>Inaccessible VM tooltip (name, last state change)</comment>
+        <translation><nobr><b>%1</b><br></nobr><nobr>Недостъпна от %2</nobr></translation>
+    </message>
+    <message>
+        <source>S&how</source>
+        <translation type="obsolete">&Показване</translation>
+    </message>
+    <message>
+        <source>Switch to the window of the selected virtual machine</source>
+        <translation type="obsolete">Превключване към прозореца с избраната виртуална машина</translation>
+    </message>
+    <message>
+        <source>S&tart</source>
+        <translation type="obsolete">&Старт</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machine</source>
+        <translation type="obsolete">Стартиране на избраната виртуална машина</translation>
+    </message>
+    <message>
+        <source>R&esume</source>
+        <translation type="obsolete">Пр&одължаване</translation>
+    </message>
+    <message>
+        <source>Resume the execution of the virtual machine</source>
+        <translation type="obsolete">Задържане изпълнението на виртуалната машина</translation>
+    </message>
+    <message>
+        <source>&Pause</source>
+        <translation type="obsolete">&Пауза</translation>
+    </message>
+    <message>
+        <source>Suspend the execution of the virtual machine</source>
+        <translation type="obsolete">Задържане изпълнението на виртуалната машина</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMLogViewer</name>
+    <message>
+        <source>Close the search panel</source>
+        <translation>Затваряне на панела за търсене</translation>
+    </message>
+    <message>
+        <source>&Find</source>
+        <translation>&Търсене</translation>
+    </message>
+    <message>
+        <source>Enter a search string here</source>
+        <translation>Въведете текст за търсене тук</translation>
+    </message>
+    <message>
+        <source>&Previous</source>
+        <translation>&Предишно</translation>
+    </message>
+    <message>
+        <source>Search for the previous occurrence of the string</source>
+        <translation>Търсене на предходно съвпадение на текста</translation>
+    </message>
+    <message>
+        <source>&Next</source>
+        <translation>&Следващо</translation>
+    </message>
+    <message>
+        <source>Search for the next occurrence of the string</source>
+        <translation>Търсене на следващо съвпадение на текста</translation>
+    </message>
     <message>
         <source>C&ase Sensitive</source>
         <translation>&Чувствително към регистъра</translation>
@@ -9778,11 +10818,27 @@ p, li { white-space: pre-wrap; }
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Скриване на описание</translation>
+        <translation type="obsolete">Скриване на описание</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Показване на описание</translation>
+        <translation type="obsolete">Показване на описание</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation>&Експертен режим</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation>Превключване към <nobr><b>Експертен режим</b></nobr>, едностраничен диалог за опитни потребители.</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>&Ръководен режим</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation>Превключване към <nobr><b>Ръководен режим</b></nobr>, диалог с подробни обяснения стъпка по стъпка.</translation>
     </message>
 </context>
 <context>
@@ -9813,7 +10869,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Моля, изберете типа на файла, който искате да използвате за новия виртуален диск. Ако нямате нужда да използвате този файл с друг виртуализационен софтуер, можете да оставите тази настройка непроменена.</translation>
+        <translation>Моля, изберете типа на файла, който искате да използвате за новия виртуален диск! Ако нямате нужда да използвате този файл с друг виртуализационен софтуер, можете да оставите тази настройка непроменена.</translation>
     </message>
     <message>
         <source>Storage on physical hard drive</source>
@@ -10012,7 +11068,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.</p></source>
-        <translation><p>Моля, изберете виртуалните машини, които да се добавят към приспособлението. Можете да изберете повече от една. Моля, имате предвид, че тези машини трябва да са изключени преди да могат да бъдат изнесени.</p></translation>
+        <translation><p>Моля, изберете виртуалните машини, които да се добавят към приспособлението. Можете да изберете повече от една. Моля имате предвид, че тези машини трябва да са изключени преди да могат да бъдат изнесени.</p></translation>
     </message>
     <message>
         <source>Appliance settings</source>
@@ -10112,39 +11168,39 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Storage settings</source>
-        <translation type="unfinished"></translation>
+        <translation>Настройки на съхранение</translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation type="unfinished"></translation>
+        <translation>Моля, изберете файл за изнасяне на виртуално приспособление</translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation type="unfinished"></translation>
+        <translation>Ф&ормат:</translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation type="unfinished"></translation>
+        <translation>OVF 0.9</translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation type="unfinished"></translation>
+        <translation>OVF 1.0</translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation type="unfinished"></translation>
+        <translation>OVF 2.0</translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation type="unfinished"></translation>
+        <translation>Запис в стандартен OVF 1.0 формат.</translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation type="unfinished"></translation>
+        <translation>Запис в новия експериментален OVF 2.0 формат.</translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation type="unfinished"></translation>
+        <translation>Настройки на с&ъхранение</translation>
     </message>
 </context>
 <context>
@@ -10163,14 +11219,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation type="unfinished"></translation>
+        <translation>Изберете файл за изнасяне на виртуално приспособление...</translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation type="unfinished"></translation>
+        <translation>Изберете файл за изнасяне на виртуално приспособление...</translation>
     </message>
 </context>
 <context>
@@ -10240,15 +11296,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation type="unfinished"></translation>
+        <translation>Внасяне на виртуално приспособление</translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation type="unfinished"></translation>
+        <translation>Изберете файл за внасяне на виртуално приспособление...</translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation type="unfinished"></translation>
+        <translation>Моля, изберете файл за внасяне на виртуално приспособление</translation>
     </message>
 </context>
 <context>
@@ -10271,7 +11327,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Storage on physical hard drive</source>
-        <translation>Съхранение на визически твърд диск</translation>
+        <translation>Съхранение на физически твърд диск</translation>
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
@@ -10616,11 +11672,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Отваряне на диалог за опериране със споделени папки</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Инсталиране на Виртуални Добавки...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Монтиране на инсталационното изображение Виртуални Добавки</translation>
     </message>
     <message>
@@ -10835,7 +11891,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Информационен д&иалог на сесията</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Показване информационния диалог на сесията</translation>
     </message>
     <message>
@@ -11038,7 +12094,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose...</source>
-        <translation type="unfinished"></translation>
+        <translation>Избор...</translation>
     </message>
 </context>
 <context>
@@ -11048,8 +12104,8 @@ p, li { white-space: pre-wrap; }
         <translation><по подразбиране></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Настоящо избраният път по подразбиране ще бъде показан след като приемете промените и отворите този диалог отново.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Настоящо избраният път по подразбиране ще бъде показан след като приемете промените и отворите този диалог отново.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -11097,8 +12153,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Настоящо избраният път по подразбиране ще бъде показан след като приемете промените и отворите този диалог отново.</translation>
+        <translation>Настоящо избраният път по подразбиране ще бъде показан, след като приемете промените и отворите този диалог отново.</translation>
     </message>
 </context>
 <context>
@@ -11439,7 +12494,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -11881,7 +12936,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><hr>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
-        <translation type="obsolete"><hr>Някой от дисковете в тази верига от твърди дискове е недостъпен. Моля, използвайте Управлението на виртуални дискове в режим <b>Показване на различаващите твърди дискове</b>, за да проверите тези дискове.</translation>
+        <translation type="obsolete"><hr>Някои от файловете в тази верига от твърди дискове са недостъпни. Моля, използвайте Управлението на виртуални дискове в режим <b>Показване на различаващите твърди дискове</b>, за да проверите тези файлове.</translation>
     </message>
     <message>
         <source>%1<hr>This base hard disk is indirectly attached using the following differencing hard disk:<br>%2%3</source>
@@ -12213,17 +13268,17 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Свързването на този твърд диск ще бъде извършено индиректно, като се използва новосъздаден различаващ твърд диск.</translation>
+        <translation type="obsolete">Свързването на този твърд диск ще бъде извършено индиректно, като се използва новосъздаден различаващ твърд диск.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation><hr>Някой от дисковете в тази верига от твърди дискове е недостъпен. Моля, използвайте Управлението на виртуални дискове в режим <b>Показване на различаващите твърди дискове</b>, за да проверите тези дискове.</translation>
+        <translation type="obsolete"><hr>Някои от файловете в тази верига от твърди дискове са недостъпни. Моля, използвайте Управлението на виртуални дискове в режим <b>Показване на различаващите твърди дискове</b>, за да проверите тези файлове.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Този основен твърд диск е свързан индиректно като се използва следният различаващ твърд диск:</translation>
+        <translation type="obsolete">Този основен твърд диск е свързан индиректно като се използва следният различаващ твърд диск:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -12269,7 +13324,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -12484,7 +13539,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Multi-attach</source>
         <comment>DiskType</comment>
-        <translation type="obsolete">Мулти закачане</translation>
+        <translation type="obsolete">Мулти закачване</translation>
     </message>
     <message>
         <source>Dynamically allocated storage</source>
@@ -12589,7 +13644,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Multi-attach</source>
         <comment>MediumType</comment>
-        <translation>Мулти закачане</translation>
+        <translation>Мулти закачване</translation>
     </message>
     <message>
         <source>Dynamically allocated storage</source>
@@ -12604,7 +13659,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Fixed size storage</source>
         <comment>MediumVariant</comment>
-        <translation>Фксиран размер памет</translation>
+        <translation>Фиксиран размер памет</translation>
     </message>
     <message>
         <source>Dynamically allocated storage split into files of less than 2GB</source>
@@ -12831,65 +13886,209 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Позволено</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Забранено</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
-        <translation type="unfinished"></translation>
+        <translation>Неограничено изпълнение</translation>
     </message>
     <message>
         <source>PS/2 Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation type="unfinished"></translation>
+        <translation>PS/2 мишка</translation>
     </message>
     <message>
         <source>USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation type="unfinished"></translation>
+        <translation>USB мишка</translation>
     </message>
     <message>
         <source>PS/2 and USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation type="unfinished"></translation>
+        <translation>PS/2 и USB мишка</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
-        <translation type="unfinished"></translation>
+        <translation>Неограничено изпълнение</translation>
     </message>
     <message>
         <source>USB Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation type="unfinished"></translation>
+        <translation>USB таблет</translation>
     </message>
     <message>
         <source>USB Multi-Touch Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation type="unfinished"></translation>
+        <translation>USB мултитъч таблет</translation>
     </message>
     <message>
         <source>NAT Network</source>
         <comment>NetworkAttachmentType</comment>
-        <translation type="unfinished"></translation>
+        <translation>NAT мрежа</translation>
     </message>
     <message>
         <source>NAT network, '%1'</source>
         <comment>details report (network)</comment>
-        <translation type="unfinished"></translation>
+        <translation>NAT мрежа, '%1'</translation>
     </message>
     <message>
         <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation type="unfinished"></translation>
+        <translation>Можете да създавате или добавяте дискови изображения в настройките на виртуалната машина.</translation>
     </message>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>USB порт %1</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>изключен</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation>Паравиртуализационен интерфейс</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Няма</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>По подразбиране</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Остарял</translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Минимален</translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation>Ново динамично зададено съхранение</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>Активно</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>Неактивно</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>Активно</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>Неактивно</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>Активно</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>Неактивно</translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Създаване на снимка</translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Създаване на жива снимка</translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation>KVM</translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation>Оптично</translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>OHCI</translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>EHCI</translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>xHCI</translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation>Потребителски интерфейс</translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation>(Оптично устройство)</translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>Свързването на този твърд диск ще бъде извършено индиректно, като се използва новосъздаден различаващ твърд диск.</translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation><hr>Някои от файловете в тази верига от твърди дискове са недостъпни. Моля, използвайте Управлението на виртуални дискове, за да проверите тези файлове.</translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>Този основен твърд диск е свързан индиректно, като се използва следният различаващ твърд диск:</translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -13027,7 +14226,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Release the selected disk image file by detaching it from the machines</source>
-        <translation>Освобождаване на избрания диск чрез разкачането му от машините</translation>
+        <translation>Освобождаване на избрания диск чрез разкачването му от машините</translation>
     </message>
     <message>
         <source>Refresh the list of disk image files</source>
@@ -13197,6 +14396,18 @@ p, li { white-space: pre-wrap; }
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Създаване на нов виртуален твърд диск</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation>UUID:</translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13282,8 +14493,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Не може да се осъществи връзка.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Моля, попълнете тази регистрационна форма, за да ни информирате, че използвате VirtualBox и, евентуално, за да бъдете информирани за новини и обновления на VirtualBox.</p><p>Въведете цялото си име, като използвате латински букви, и вашият e-mail адрес в полетата по-долу. Моля, имайте предвид, че Sun Microsystems ще използва тази информация само за изготвяне на статистика за използваемостта на продукта и за изпращане на новинарски  [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Моля, попълнете тази регистрационна форма, за да ни информирате, че използвате VirtualBox и, евентуално, за да бъдете информирани за новини и обновления на VirtualBox.</p><p>Въведете цялото си име, като използвате латински букви, и вашият e-mail адрес в полетата по-долу. Моля имайте предвид, че Sun Microsystems ще използва тази информация само за изготвяне на статистика за използваемостта на продукта и за изпращане на новинарски б [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -13302,8 +14513,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Изберете страна/територия</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Моля, попълнете тази регистрационна форма, за да ни информирате, че използвате VirtualBox и, евентуално, за да бъдете информирани за новини и обновления на VirtualBox.</p><p>Моля, използвайте само латински букви в полетата по-долу. Моля, имайте предвид, че Sun Microsystems ще използва тази информация само за изготвяне на статистика за използваемостта на продукта и за изпращане на новинарски бюлетини за VirtualBox. Освен за тези це [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Моля, попълнете тази регистрационна форма, за да ни информирате, че използвате VirtualBox и, евентуално, за да бъдете информирани за новини и обновления на VirtualBox.</p><p>Моля, използвайте само латински букви в полетата по-долу. Моля имайте предвид, че Sun Microsystems ще използва тази информация само за изготвяне на статистика за използваемостта на продукта и за изпращане на новинарски бюлетини за VirtualBox. Освен за тези цел [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -13504,8 +14715,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Задържане изпълнението на виртуалната машина</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Добре дошли във VirtualBox!</h3><p>Лявата част на този прозорец е предназначена за показване на списък с всички виртуални машини на вашия компютър. Списъкът в момента е празен, защото все още не сте създали виртуални машини.<img src=:/welcome.png align=right/></p><p>Като начало, за да създадете нова виртуална машина, натиснете бутона <b>Нова</b> в основната лента с инструменти, разположена в горната  [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Добре дошли във VirtualBox!</h3><p>Лявата част на този прозорец е предназначена за показване на списък с всички виртуални машини на вашия компютър. Списъкът в момента е празен, защото все още не сте създали виртуални машини.<img src=:/welcome.png align=right/></p><p>Като начало, за да създадете нова виртуална машина, натиснете бутона <b>Нова</b> в основната лента с инструменти, разположена в горната  [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -13810,7 +15021,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Restore the virtual machine state from the state stored in the current snapshot</source>
-        <translation type="obsolete">Възстановяване сътоянието на виртуалната машина до състоянието, запазено в настоящата снимка</translation>
+        <translation type="obsolete">Възстановяване състоянието на виртуалната машина до състоянието, запазено в настоящата снимка</translation>
     </message>
     <message>
         <source>Discard the current snapshot and revert the machine to the state it had before the snapshot was taken</source>
@@ -13974,157 +15185,6 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Информация за сесията</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Детайли</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Изпълнение</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA трансфери</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO трансфери</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Прочетени данни</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Записани данни</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Предадени данни</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Получени данни</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Атрибути на изпълнението</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Разделителна способност на екрана</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">CD/DVD статистики</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Статистики на мрежовите адаптери</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Версия %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Не са засечени</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Не е засечен</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Виртуални Добавки</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Вид виртуална ОС</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Статистики на твърдия диск</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Няма твърди дискове</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Няма мрежови адаптери</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Позволено</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Забранено</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Вместено страниране</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Не е достъпен</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Статистики на съхранението</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Няма съхраняващи устройства</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Мрежови статистики</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Вместено страниране</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Не е достъпен</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Режим клипборд</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Режим влачене и пускане</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca.ts
index 362dcad..64788f1 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca.ts
@@ -296,7 +296,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Mode f&luid</translation>
+        <translation type="unfinished">Mode f&luid</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -320,11 +320,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Desactiva la integració del &punter</translation>
+        <translation type="obsolete">Desactiva la integració del &punter</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Desactiva temporalment la integració del punter de l'amfitrió</translation>
+        <translation type="obsolete">Desactiva temporalment la integració del punter de l'amfitrió</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -336,11 +336,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Insereix Ctrl+Alt+Supr</translation>
+        <translation type="obsolete">&Insereix Ctrl+Alt+Supr</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Envia la seqüència Ctrl+Alt+Supr a la màquina virtual</translation>
+        <translation type="obsolete">Envia la seqüència Ctrl+Alt+Supr a la màquina virtual</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -348,7 +348,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Envia la seqüència Ctrl+Alt+Retrocés a la màquina virtua</translation>
+        <translation type="obsolete">Envia la seqüència Ctrl+Alt+Retrocés a la màquina virtua</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -363,8 +363,8 @@
         <translation type="obsolete">D&iàleg informatiu de la sessió</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Mostra el diàleg d'informació de la sessió</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Mostra el diàleg informatiu de la sessió</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -420,15 +420,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Dispositius &CD/DVD</translation>
+        <translation type="obsolete">Dispositius &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Dis&queteres</translation>
+        <translation type="obsolete">Dis&queteres</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Dispositius &USB</translation>
+        <translation type="obsolete">Dispositius &USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -455,12 +455,12 @@
         <translation type="obsolete">Habilita o inhabilita les connexions d'escriptori remot (RDP) a aquesta màquina</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>&Insereix la imatge de CD de les Guest Additions...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Instal·la les Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Insereix el fitxer de disc de les Guest Additions al dispositiu virtual</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Munta la imatge d'instal·lació de les Guest Additions</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -479,7 +479,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&S'està afegint al registre...</translation>
+        <translation type="obsolete">&S'està connectant...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -557,15 +557,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Canvia al mode de pantalla com&pleta</translation>
+        <translation type="obsolete">Canvia al mode de pantalla com&pleta</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Canvia entre el mode normal i a pantalla completa</translation>
+        <translation type="obsolete">Canvia entre el mode normal i a pantalla completa</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Canvia al mode f&luid</translation>
+        <translation type="obsolete">Canvia al mode f&luid</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -573,7 +573,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Canvia al mode e&scalat</translation>
+        <translation type="obsolete">Canvia al mode e&scalat</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -653,7 +653,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Ins&ereix Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">Ins&ereix Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>&File</source>
@@ -948,70 +948,296 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Arrosega i deixa anar</translation>
+        <translation type="obsolete">Arrosega i deixa anar</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>Desa l'estat de la màquina virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>Apaga la màquina virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>&Paràmetres de xarxa...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation>Paràmetre&s de carpeta compartida...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>&Pantalla remota</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>Intercanvia les connexions d'escriptori remotes (RDP) a aquesta màquina</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>Captura de &vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation>Intercanvia la captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation>Paràmetres de la captura de &vídeo...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>Configureu els paràmetres de la captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Popup Menu</source>
-        <translation>Menú emergent</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Instal·la les Guest Additions...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Munta la imatge d'instal·lació de les Guest Additions</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>Càmeres &web</translation>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Teclat</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Xarxa</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Mostra el &registre...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Fitxer</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Habilita</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1792,6 +2018,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1802,7 +2035,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>S'estan deixant anar les dades...</translation>
+        <translation type="obsolete">S'estan deixant anar les dades...</translation>
     </message>
 </context>
 <context>
@@ -1902,6 +2135,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2595,7 +2855,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Controller</source>
@@ -2785,60 +3045,155 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation>Fitxer de captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation>Atributs de captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation>Captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation>Desactivat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Xarxa NAT, «%1»</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>Mida del marc: %1x%2, Marcs per segon: %3fps, Bits per segon: %4kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Controlador</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>None</source>
-        <comment>details</comment>
-        <translation type="obsolete">Cap</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Memòria de vídeo</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Pantalles</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Controlador USB</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Controlador</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Cap</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Memòria de vídeo</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Pantalles</translation>
     </message>
     <message>
         <source>2D Video</source>
@@ -3123,7 +3478,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation>Paquets d'&extensió</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3185,28 +3540,16 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Inhabilita el protector de pantalla de l'a&mfitrió</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>&Acoblador i barra de menú:</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>Mostra automàticament en pantalla completa</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Quan estigui actiu, l'acoblador de l'amfitrió i la barra de menú es mostraran quan la màquina virtual es trobi en mode de pantalla completa.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>Estalvi de pantalla de l'&amfitrió:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>Quan estigui actiu, l'estalvi de pantalla de l'amfitrió es desactivarà quan la màquina virtual s'estigui executant.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>Desactiva quan s'estiguin executant màquines virtuals</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3245,27 +3588,27 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>Combinació de tecla d'amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>Alguns elements tenen les mateixes dreceres assignades.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation>Gestor del &VirtualBox</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>&Màquina virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Mostra totes les dreceres disponibles que poden configurar-se.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Introduïu una seqüència per filtrar el llistat de dreceres.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3324,7 +3667,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>Llengües de la &interfície</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3481,128 +3824,128 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation>Xarxes &NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation>Mostra totes les xarxes NAT disponibles.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translation>Xarxes de &només amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>No s'ha proveït un nom nou per a la xarxa NAT que abans s'anomenava <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation>No s'ha proveït un CIDR per a la xarxa NAT <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>No s'ha proveït un CIDR per a la xarxa NAT que abans s'anomenava <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation>S'ha proveït un CIDR no vàlid (<i>%1</i>) per a la xarxa NAT <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation>S'ha proveït un CIDR no vàlid (<i>%1</i>) per a la xarxa NAT abans anomenada <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translation>Nom de la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation>[buit]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (reanomenat des de %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation>Nom antic de la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation>Nom nou de la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation>CIDR de la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation>Compatible amb DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>yes</source>
-        <translation>sí</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>no</source>
-        <translation>no</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation>Compatible amb IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation>Ruta IPv6 per defecte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una adreça IPv4 vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una màscara de xarxa IPv4 vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una adreça IPv6 vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment un servidor d'adreça DHCP vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una màscara de xarxa DHCP vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una límit d'adreça inferior vàlida del servidor DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una límit d'adreça superior vàlida del servidor DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>Ja s'està utilitzant el nom <b>%1</b> per a algunes xarxes NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>Activa</translation>
+        <translation type="unfinished">Actiu</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>&Afegeix una xarxa NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation>&Suprimeix una xarxa NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation>&Edita una xarxa NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3704,177 +4047,177 @@ p, li { white-space: pre-wrap; }
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation>Detalls de xarxa de només l'amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation>&Adaptador</translation>
+        <translation type="unfinished">&Adaptador</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation>&Configuració manual</translation>
+        <translation type="unfinished">&Configuració manual</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>Fes servir la configuració manual només per a l'adaptador de xarxa de l'amfitrió.</translation>
+        <translation type="unfinished">Fes servir la configuració manual només per a l'adaptador de xarxa de l'amfitrió.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation>Adreça &IPv4:</translation>
+        <translation type="unfinished">Adreça &IPv4:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>Gestiona l'adreça IPv4 de l'amfitrió d'aquest adaptador.</translation>
+        <translation type="unfinished">Mostra l'adreça IPv4 de l'amfitrió d'aquest adaptador.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation>&Màscara de xarxa IPv4:</translation>
+        <translation type="unfinished">&Màscara de xarxa IPv4:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>Mostra la màscara de xarxa IPv4 de l'amfitrió d'aquest adaptador.</translation>
+        <translation type="unfinished">Mostra la màscara de xarxa IPv4 de l'amfitrió d'aquest adaptador.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation>Adreça I&Pv6:</translation>
+        <translation type="unfinished">Adreça I&Pv6:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>Gestiona l'adreça IPv6 de l'amfitrió d'aquest adaptador si IPv6 està suportat.</translation>
+        <translation type="unfinished">Mostra l'adreça IPv6 de l'amfitrió d'aquest adaptador si IPv6 està suportat.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation>&Longitud de la màscara de xarxa IPv6:</translation>
+        <translation type="unfinished">&Longitud de la màscara de xarxa IPv6:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>Gestiona la longitud de l'adreça de la màscara de xarxa IPv6 de l'amfitrió per a aquest adaptador si IPv6 està suportat.</translation>
+        <translation type="unfinished">Mostra la longitud de l'adreça de la màscara de xarxa IPv6 de l'amfitrió per a aquest adaptador si IPv6 està suportat.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation>Servidor &DHCP</translation>
+        <translation type="unfinished">Servidor &DHCP</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>&Habilita el servidor</translation>
+        <translation type="unfinished">&Habilita el servidor</translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation>Indica si el servidor DHCP està habilitat en iniciar de la màquina o no.</translation>
+        <translation type="unfinished">Indica si el servidor DHCP està habilitat en iniciar de la màquina o no.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation>Ad&reça del servidor:</translation>
+        <translation type="unfinished">Ad&reça del servidor:</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Gestiona l'adreça del servidor DHCP de la xarxa associada a aquest adaptador de només l'amfitrió.</translation>
+        <translation type="unfinished">Mostra l'adreça del servidor DHCP de la xarxa associada a aquest adaptador de només l'amfitrió.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation>&Màscara del servidor:</translation>
+        <translation type="unfinished">&Màscara del servidor:</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Gestiona la màscara de xarxa del servidor DHCP de la xarxa associada a aquest adaptador de només l'amfitrió.</translation>
+        <translation type="unfinished">Mostra la màscara de xarxa del servidor DHCP de la xarxa associada a aquest adaptador de només l'amfitrió.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation>Adreça límit &inferior:</translation>
+        <translation type="unfinished">Adreça límit &inferior:</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Gestiona l'adreça límit inferior oferida pel servidor DHCP de la xarxa associada aquet adaptador de només l'amfitrió.</translation>
+        <translation type="unfinished">Mostra l'adreça límit inferior oferida pel servidor DHCP de la xarxa associada aquet adaptador de només l'amfitrió.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation>Adreça límit &superior:</translation>
+        <translation type="unfinished">Adreça límit &superior:</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Gestiona l'adreça límit superior oferida pel servidor DHCP de la xarxa associada a aquest adaptador de només l'amfitrió.</translation>
+        <translation type="unfinished">Mostra l'adreça límit superior oferida pel servidor DHCP de la xarxa associada a aquest adaptador de només l'amfitrió.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation>Detalls de la xarxa NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation>&Activa la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation>Activa aquesta xarxa NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation>&Nom de la Xarxa:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>Gestiona el nom per aquesta xarxa.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation>Xarxa &CIDR:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>Gestiona el CIDR per aquesta xarxa.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation>Opcions de xarxa:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation>Compatible amb &DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation>Determina si la xarxa és compatible amb DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation>Compatible amb &IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>Determina si la xarxa és compatible amb IPv6.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>Publicita com a &camí IPv6 per defecte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation>Determina si aquesta xarxa s'hauria de publicitar com a un camí IPv6 per defecte.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Obre el diàleg per gestionar les regles de reenviament de ports.</translation>
+        <translation type="unfinished">Obre el diàleg per gestionar les regles de reenviament de ports.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation>Reenviament de &ports</translation>
+        <translation type="unfinished">Reenviament de &ports</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>Regles de redireccionament de ports</translation>
+        <translation type="unfinished">Regles de redireccionament de ports</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation>IPv4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation>IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3929,11 +4272,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>No s'ha proveït cap servidor intermediari d'amfitrió.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>No s'ha proveït cap port de servidor intermediari.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3998,71 +4341,71 @@ p, li { white-space: pre-wrap; }
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation><key_%1></translation>
+        <translation type="unfinished"><key_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation>Esquerra</translation>
+        <translation type="unfinished">Esquerra</translation>
     </message>
     <message>
         <source>Right </source>
-        <translation>Dreta</translation>
+        <translation type="unfinished">Dreta</translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation>Tecla de majúscules esquerra</translation>
+        <translation type="unfinished">Tecla de majúscules esquerra</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation>Tecla de majúscules dreta</translation>
+        <translation type="unfinished">Tecla de majúscules dreta</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation>Control esquerra</translation>
+        <translation type="unfinished">Control esquerra</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation>Control dreta</translation>
+        <translation type="unfinished">Control dreta</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation>Alt esquerra</translation>
+        <translation type="unfinished">Alt esquerra</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation>Alt dreta</translation>
+        <translation type="unfinished">Alt dreta</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation>Tecla de Windows esquerra</translation>
+        <translation type="unfinished">Tecla de Windows esquerra</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation>Tecla de Windows dreta</translation>
+        <translation type="unfinished">Tecla de Windows dreta</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation>Tecla de menú</translation>
+        <translation type="unfinished">Tecla de menú</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation>Alt Gr</translation>
+        <translation type="unfinished">Alt Gr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>Bloq Majús</translation>
+        <translation type="unfinished">Bloq Majús</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation>Bloq Despl</translation>
+        <translation type="unfinished">Bloq Despl</translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation>Tecla amfitrió+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
-        <translation>Cap</translation>
+        <translation type="unfinished">Cap</translation>
     </message>
 </context>
 <context>
@@ -4249,22 +4592,22 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation>Reinicia la drecera al valor per defecte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation>Desconfigura la drecera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation>Nom</translation>
+        <translation type="unfinished">Nom</translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translation>Drecera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4409,12 +4752,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica l'activitat dels dispositius de CD/DVD:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica l'activitat dels dispositius de CD/DVD:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica l'activitat dels dispositius de disquetera:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica l'activitat dels dispositius de disquetera:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4454,7 +4797,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>El controlador USB està desactivat</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>El controlador USB està desactivat</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4503,20 +4846,34 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Indica l'activitat de captura de vídeo:</nobr><br>%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>S'ha desactivat la captura de vídeo</b></nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>Fitxer de captura de vídeo:</b> %1</nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation>Estat de característica addicional:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4590,11 +4947,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>No s'ha connectat cap càmera web</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>No hi ha cap càmera web compatible connecatada a l'ordinador amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
@@ -4644,7 +5001,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Vídeo</translation>
+        <translation type="obsolete">&Vídeo</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4760,193 +5117,257 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>Captura de &vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>Quan estigui marcat, el VirtualBox enregistrarà la sessió a la màquina virtual en un fitxer de vídeo.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation>&Activa la captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>&Camí al fitxer:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Aquest paràmetre determina el nom de fitxer que el VirtualBox utilitza per desar el contingut enregistrat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>Mida del &marc:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>Aquest paràmetre determina la resolució (mida del marc) del vídeo enregistrat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>Aquest paràmetre determina la resolució <b>horitzontal</b> (amplada del marc) del vídeo enregistrat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>Aquest paràmetre determina la resolució <b>vertical</b> (alçada del marc) del vídeo enregistrat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>&Marcs per segon:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>Aquest paràmetre determina el nombre màxim de <b>marcs per segon</b>. Els marcs addicionals s'ignoraran. En reduir aquest valor s'incrementarà el nombre de marcs que s'ignoraran i reduirà la mida del fitxer.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation>&Qualitat:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Aquest paràmetre determina la <b>qualitat</b>. En incrementar-lo farà que el vídeo es vegi millor però amb una mida de fitxer més gran.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Aquest paràmetre determina la taxa de bits en <b>kilobits per segon</b>. En incrementar-lo farà que el vídeo es vegi millor però amb una mida de fitxer més gran.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation>Pantalle&s:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>La màquina virtual està configurada per utilitzar l'acceleració gràfica per maquinari. Tot i així, el sistema amfitrió no proveeix això i no podreu iniciar la màquina.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>La màquina virtual té actualment assignada una memòria de vídeo inferior a <b>%1</b>, que és la quantitat mínima requerida per canviar al mode de pantalla completa o mode fluid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>La màquina virtual té actualment assignada una memòria de vídeo inferior a <b>%1</b>, que és la quantitat mínima requerida per poder reproduir eficientment el vídeo d'alta resolució.</translation>
-    </message>
-    <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>La màquina virtual està configurada per utilitzar l'acceleració gràfica i el sistema operatiu suggerit és Windows Vista o posterior. Per a un millor rendiment hauríeu d'establir la memòria de vídeo almenys a <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>La màquina virtual està configurada per utilitzar l'acceleració de flux de vídeo. Atès que aquesta característica només funciona amb Windows, el sistema client es desactivarà.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>No s'ha especificat el valor del port del servidor VRDE.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>No s'ha especificat el valor de temps d'espera d'autenticació VRDE.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation>Definit per l'usuari</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation>%1 fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>fps</source>
-        <translation>fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation>baixa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation>mitjana</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation>alta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation>kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation>Pantalla %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation>Activa l'enregistrament de vídeo per a la pantalla %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation type="unfinished"></translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Barra d'eines mini:</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">heu assignat més d'un <b>%1%</b> de la memòria del vostre ordinador (<b>%2</b>) a la màquina virtual. No heu deixat suficient memòria al sistema amfitrió. Seleccineu un percentatge menor.</translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Si està marcat, mostra la barra d'eines mini als modes fluid i de pantalla completa.</translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">heu assignat més d'un <b>%1%</b> de la memòria del vostre ordinador (<b>%2</b>) a la màquina virtual. No heu deixat suficient memòria al sistema amfitrió. Contineu pel vostre compte (no recomanable).</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Mostra en pantalla completa/&fluid</translation>
     </message>
     <message>
-        <source>there is a 64 bits guest OS type assigned for this VM, which requires virtualization feature (VT-x/AMD-V) to be enabled too, else your guest will fail to detect a 64 bits CPU and will not be able to boot, so this feature will be enabled automatically when you'll accept VM Settings by pressing OK button.</source>
-        <translation type="obsolete">existeix un sistema client de 64 bits assignat a aquesta màquina virtual que requereix tenir habilitada la característica de virtualització (VT-x/AMD-V). El vostre sistema client fallarà al detectar una CPU de 64 bits i no podrà iniciar-se, per la qual cosa aquesta característica s'habilitarà per defecte quan accepteu els paràmetres de la màquina virtual prement el botó D'acord.</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Si està marcat, mostra una barra d'eines petita a la part de dalt de la pantalla en lloc de a la posició per defecte a la part de sota.</translation>
     </message>
     <message>
-        <source><qt>%1&nbsp;MB</qt></source>
-        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Mostra a la par&t de dalt de la pantalla</translation>
     </message>
     <message>
-        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>Mostra el camí on les captures d'aquesta màquina virtual es desaran. Tingueu en compte que les captures poden ocupar prou quantitat d'espai al disc dur.</translation>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>&Bàsic</translation>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Identification</source>
-        <translation type="obsolete">Identificació</translation>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Name:</source>
-        <translation type="obsolete">&Nom:</translation>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the name of the virtual machine.</source>
-        <translation type="obsolete">Mostra el nom de la màquina virtual.</translation>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>OS &Type:</source>
-        <translation type="obsolete">&Tipus de SO:</translation>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation type="obsolete">Mostra el tipus de sistema operatiu que voleu instal·lar a dins d'aquesta màquina virtual (anomenat sistema operatiu client).</translation>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
     </message>
     <message>
-        <source>Base &Memory Size</source>
-        <translation type="obsolete">Mida de la &memòria base</translation>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
     </message>
     <message>
-        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
-        <translation type="obsolete">Controla la quantitat de memòria amb què es proveeix a la màquina virtual. Si n'assigneu massa, pot ser que la màquina no s'iniciï.</translation>
+        <source>%</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><</source>
-        <translation type="obsolete"><</translation>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
+        <translation type="obsolete">heu assignat més d'un <b>%1%</b> de la memòria del vostre ordinador (<b>%2</b>) a la màquina virtual. No heu deixat suficient memòria al sistema amfitrió. Seleccineu un percentatge menor.</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
+        <translation type="obsolete">heu assignat més d'un <b>%1%</b> de la memòria del vostre ordinador (<b>%2</b>) a la màquina virtual. No heu deixat suficient memòria al sistema amfitrió. Contineu pel vostre compte (no recomanable).</translation>
+    </message>
+    <message>
+        <source>there is a 64 bits guest OS type assigned for this VM, which requires virtualization feature (VT-x/AMD-V) to be enabled too, else your guest will fail to detect a 64 bits CPU and will not be able to boot, so this feature will be enabled automatically when you'll accept VM Settings by pressing OK button.</source>
+        <translation type="obsolete">existeix un sistema client de 64 bits assignat a aquesta màquina virtual que requereix tenir habilitada la característica de virtualització (VT-x/AMD-V). El vostre sistema client fallarà al detectar una CPU de 64 bits i no podrà iniciar-se, per la qual cosa aquesta característica s'habilitarà per defecte quan accepteu els paràmetres de la màquina virtual prement el botó D'acord.</translation>
+    </message>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+    </message>
+    <message>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation>Mostra el camí on les captures d'aquesta màquina virtual es desaran. Tingueu en compte que les captures poden ocupar prou quantitat d'espai al disc dur.</translation>
+    </message>
+    <message>
+        <source>Basi&c</source>
+        <translation>&Bàsic</translation>
+    </message>
+    <message>
+        <source>Identification</source>
+        <translation type="obsolete">Identificació</translation>
+    </message>
+    <message>
+        <source>&Name:</source>
+        <translation type="obsolete">&Nom:</translation>
+    </message>
+    <message>
+        <source>Holds the name of the virtual machine.</source>
+        <translation type="obsolete">Mostra el nom de la màquina virtual.</translation>
+    </message>
+    <message>
+        <source>OS &Type:</source>
+        <translation type="obsolete">&Tipus de SO:</translation>
+    </message>
+    <message>
+        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
+        <translation type="obsolete">Mostra el tipus de sistema operatiu que voleu instal·lar a dins d'aquesta màquina virtual (anomenat sistema operatiu client).</translation>
+    </message>
+    <message>
+        <source>Base &Memory Size</source>
+        <translation type="obsolete">Mida de la &memòria base</translation>
+    </message>
+    <message>
+        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
+        <translation type="obsolete">Controla la quantitat de memòria amb què es proveeix a la màquina virtual. Si n'assigneu massa, pot ser que la màquina no s'iniciï.</translation>
+    </message>
+    <message>
+        <source><</source>
+        <translation type="obsolete"><</translation>
     </message>
     <message>
         <source>></source>
@@ -4965,7 +5386,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Controla la quantitat de memòria de vídeo amb què es proveeix a la màquina virtual.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avançat</translation>
     </message>
     <message>
@@ -5061,7 +5482,7 @@ p, li { white-space: pre-wrap; }
         <translation>Carpeta de capture&s:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Descripció</translation>
     </message>
     <message>
@@ -5074,7 +5495,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Si està marcat, qualsevol canvi al CD/DVD o disquet muntat es desarà al fitxer de configuració per tal de preservar la configuració dels suports muntats entre cada execució de la màquina virtual.</translation>
+        <translation type="obsolete">Si està marcat, qualsevol canvi al CD/DVD o disquet muntat es desarà al fitxer de configuració per tal de preservar la configuració dels suports muntats entre cada execució de la màquina virtual.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5106,38 +5527,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Suports extraïbles:</translation>
+        <translation type="obsolete">Suports extraïbles:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Recorda els canvis en execució</translation>
+        <translation type="obsolete">&Recorda els canvis en execució</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Barra d'eines mini:</translation>
+        <translation type="obsolete">Barra d'eines mini:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Si està marcat, mostra la barra d'eines mini als modes fluid i de pantalla completa.</translation>
+        <translation type="obsolete">Si està marcat, mostra la barra d'eines mini als modes fluid i de pantalla completa.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Mostra en pantalla completa/&fluid</translation>
+        <translation type="obsolete">Mostra en pantalla completa/&fluid</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Si està marcat, mostra una barra d'eines petita a la part de dalt de la pantalla en lloc de a la posició per defecte a la part de sota.</translation>
+        <translation type="obsolete">Si està marcat, mostra una barra d'eines petita a la part de dalt de la pantalla en lloc de a la posició per defecte a la part de sota.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Mostra a la par&t de dalt de la pantalla</translation>
+        <translation type="obsolete">Mostra a la par&t de dalt de la pantalla</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">heu seleccionat un tipus de sistema client de 64 bits per a aquesta màquina virtual. Amb aquests tipus de clients es requereix maquinari de virtualització (VT-x/AMD-V), aquesta característica s'activarà automàticament.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>Arrosega i &deixa anar:</translation>
     </message>
     <message>
@@ -5146,11 +5567,107 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation>No s'ha especificat cap màquina virtual.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>La recomanació del sistema operatiu de la màquina virtual és de tipus 64-bit. Els sistemes client de 64-bit requereixen la virtualització per maquinari i per tant això s'activarà automàticament si confirmeu els canvis.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Barra d'eines mini:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Si està marcat, mostra la barra d'eines mini als modes fluid i de pantalla completa.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Mostra en pantalla completa/&fluid</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Si està marcat, mostra una barra d'eines petita a la part de dalt de la pantalla en lloc de a la posició per defecte a la part de sota.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Mostra a la par&t de dalt de la pantalla</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5305,7 +5822,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the TAP interface name.</source>
-        <translation type="obsolete">Mostra el nom de la interfície TAP.</translation>
+        <translation type="obsolete">Mostra el nom de la intefície TAP.</translation>
     </message>
     <message>
         <source>&Setup Application:</source>
@@ -5405,35 +5922,35 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation>Actualment no s'ha seleccionat cap adaptador de xarxa pont.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>Actualment no s'ha especificat cap nom de xarxa interna.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>Actualment no s'ha seleccionat cap adaptador de xarxa de només amfitrió.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation>Actualment no s'ha seleccionat cap controlador genèric.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>L'adreça MAC ha de tenir 12 dígits hexadecimals.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation>El segon dígit a l'adreça MAC no pot ser senar ja que només es permeten adreces unicast.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>Actualment no s'ha especificat cap nom de xarxa NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>Gestiona el nom de la xarxa NAT que és on es connectarà la targeta de xarxa. Podeu crear o eliminar xarxes fent servir els paràmetres globals de xarxa a la finestra de gestió de màquines virtuals.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5610,23 +6127,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>No s'ha proveït cap IRQ.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>No s'ha proveït cap port d'E/S.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Dos o més ports tenen els mateixos paràmetres.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>No s'ha proveït cap camí de port.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>S'han proveït dos camins de ports duplicats.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5797,10 +6314,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Si està marcat, aquesta carpeta compartida serà permanent.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Finestra</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5851,11 +6364,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Si està marcat, el conducte especificat al camp <b>Camí del port</b> es crearà per la màquina virtual quan s'iniciï. En altre cas, la màquina virtual provarà de fer servir el conducte existent.</translation>
+        <translation type="obsolete">Si està marcat, el conducte especificat al camp <b>Camí del port</b> es crearà per la màquina virtual quan s'iniciï. En altre cas, la màquina virtual provarà de fer servir el conducte existent.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Crea un conducte</translation>
+        <translation type="obsolete">&Crea un conducte</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5863,11 +6376,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Mostra el camí al conducte del port en sèrie a l'amfitrió quan el port treballa en el mode <b>Conducte amfitrió</b>, o al dispositiu sèrie de l'amfitrió quan el port treballa en el mode <b>Dispositiu Amfitrió</b>.</translation>
+        <translation type="obsolete">Mostra el camí al conducte del port en sèrie a l'amfitrió quan el port treballa en el mode <b>Conducte amfitrió</b>, o al dispositiu sèrie de l'amfitrió quan el port treballa en el mode <b>Dispositiu Amfitrió</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Camí al &port/fitxer:</translation>
+        <translation type="obsolete">Camí al &port/fitxer:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5877,6 +6390,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Mostra l'adreça base d'E/S d'aquest port en sèrie. Valors vàlids són nombres enter amb un rang entre <tt>0</tt> i <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5894,23 +6423,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>No s'ha proveït cap IRQ.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>No s'ha proveït cap port d'E/S.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Dos o més ports tenen els mateixos paràmetres.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>No s'ha proveït cap camí de port.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>S'han proveït dos camins de ports duplicats.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6005,15 +6534,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Afegeix&nbsp;dispositiu&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Afegeix&nbsp;dispositiu&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Afegeix&nbsp;disquetera</nobr></translation>
+        <translation type="obsolete"><nobr>Afegeix&nbsp;disquetera</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>No hi ha cap disc dur seleccionat per a <i>%1</i>.</translation>
+        <translation type="unfinished">No hi ha cap disc dur seleccionat per a <i>%1</i>.</translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -6053,11 +6582,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Afegeix dispositiu CD/DVD</translation>
+        <translation type="obsolete">Afegeix dispositiu CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Afegeix disquetera</translation>
+        <translation type="obsolete">Afegeix disquetera</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6245,15 +6774,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&Dispositiu CD/DVD:</translation>
+        <translation type="obsolete">&Dispositiu CD/DVD:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Seleccioneu un disc CD/DVD virtual o una unitat física que s'utilitzarà al dispositiu virtual. La màquina virtual veurà el disc inserit a la unitat amb les dades al fitxer o al disc a la unitat física i els seus continguts.</translation>
+        <translation type="obsolete">Seleccioneu un disc CD/DVD virtual o una unitat física que s'utilitzarà al dispositiu virtual. La màquina virtual veurà el disc inserit a la unitat amb les dades al fitxer o al disc a la unitat física i els seus continguts.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Configura la unitat de CD/DVD virtual</translation>
+        <translation type="obsolete">Configura la unitat de CD/DVD virtual</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6277,7 +6806,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Selecciona un fitxer de CD/DVD virtual...</translation>
+        <translation type="obsolete">Selecciona un fitxer de CD/DVD virtual...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6347,19 +6876,67 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>No s'ha especificat cap nom per al controlador de la posició <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>El controlador de la posició <b>%1</b> fa servir el nom que ja fa servir el controlador de la posició <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> fa servir el disc dur que es troba connectat a <i>%2</i>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>La màquina té assignats més controladors d'emmagatzematge del que els xips %1 són compatibles. Canvieu el tipus de xip a la pàgina de paràmetres del sistema o reduïu el nombre dels controladors següents d'emmagatzematge a la pàgina de paràmetres d'emmagatzematge: %2</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Seleccioneu un fitxer de disc òptic virtual...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6583,47 +7160,55 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>Dispositiu del &punter:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Determina si el dispositiu del cursor és un ratolí PS/2 estàndard, una tauleta USB o una tauleta multitàctil USB.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>Més de <b>%1%</b> de la memòria (<b>%2</b>) de l'ordinador amfitrió està assignada a la màquina virtual. No s'ha deixat suficient memòria per al sistema operatiu amfitrió. Seleccioneu una quantitat inferior.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>Més de <b>%1%</b> de la memòria (<b>%2</b>) de l'ordinador amfitrió està assignada a la màquina virtual. Això podria no deixar suficient memòria per al sistema operatiu amfitrió. Considereu seleccionar una quantitat inferior.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>La característica E/S APIC no està habilitada a la secció placa mare de la pàgina Sistema. Això és necessari per la compatibilitat amb un xip del tipus ICH9. Es farà automàticament si confirmeu els canvis.</translation>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>L'emulació del controlador USB no s'ha habilitat al a pàgina USB. Això és necessari per la compatibilitat amb un dispositiu d'entrada USB. Es farà automàticament si confirmeu els canvis.</translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>Per raons de rendiment, el nombre dels processadors virtuals connectats a la màquina virtual no pot ser més del doble del nombre de processadors físics de l'amfitrió (<b>%1</b>). Reduïu el nombre de processadors virtuals.</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>Hi ha més processadors virtuals connectats a la màquina virtual que el nombre de processadors físics de l'amfitrió (<b>%1</b>). Això pot afectar al rendiment de la màquina virtual. Considereu reduir-ne el nombre de processadors virtuals.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La característica E/S APIC no està habilitada a la secció placa mare de la pàgina Sistema. Això és necessari per la compatibilitat amb un processador virtual. Es farà automàticament si confirmeu els canvis.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La virtualització de maquinari no està habilitada a la secció Acceleració de la pàgina Sistema. Això és necessari per la compatibilitat amb més d'un processador virtual. Es farà automàticament si confirmeu els canvis.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>El cap d'execució del processador està establer a un valor baix. Això pot fer semblar que la màquina va lenta. </translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6695,7 +7280,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Habilita el controlador USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">Habilita el controlador USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6758,8 +7343,28 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">L'USB 2.0 es troba activat per a aquesta màquina virtual. Tot i així, això requereix la instal·lació de <b>%1</b>. Instal·leu el paquet d'extensions des del lloc web de baixades del VirtualBox. Una vegada fet això, haureu de tornar a activar l'USB 2.0. Mentrestant es desactivarà a no ser que cancel·leu els canvis dels paràmetres actuals.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>L'USB 2.0 es troba activat per a aquesta màquina virtual. Tot i així, això requereix la instal·lació de <b>%1</b>. Instal·leu el paquet d'extensions des del lloc web de baixades del VirtualBox o desactiveu la compabilitat USB 2.0 per iniciar la màquina.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6898,9 +7503,13 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Tanca</translation>
+        <translation type="obsolete">&Tanca</translation>
     </message>
-</context>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
 <context>
     <name>UIMediumTypeChangeDialog</name>
     <message>
@@ -6917,6 +7526,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Tanca</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Canvia</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>Callee: </source>
@@ -7128,8 +7760,8 @@ p, li { white-space: pre-wrap; }
         <translation><nobr>Avís</nobr></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>S'ha produït un error crític mentre s'executava la màquina virtual, que s'ha aturat.</p><p>Per obtenir ajuda, visiteu la secció Community a  <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o al vostre contracte de suport. Afegiu el contingut del fitxer de registre <tt>VBox.log</tt> i el fitxer d'imatge <tt>VBox.png</tt>,que podreu trobar al directori <nob [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>S'ha produït un error crític mentre s'executava la màquina virtual, que s'ha aturat.</p><p>Per obtenir ajuda, visiteu la secció Community a  <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> o al vostre contracte de suport. Afegiu el contingut del fitxer de registre <tt>VBox.log</tt> i el fitxer d'imatge <tt>VBox.png</tt>,que podreu trobar al directori <nobr& [...]
     </message>
     <message>
         <source><p>A fatal error has occurred during virtual machine execution! The virtual machine will be powered off. Please copy the following error message using the clipboard to help diagnose the problem:</p></source>
@@ -7193,7 +7825,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>No s'ha pogut crear l'objecte VirtualBox COM.</p><p>Ara es tancarà l'aplicació.</p></translation>
+        <translation type="obsolete"><p>No s'ha pogut crear l'objecte VirtualBox COM.</p><p>Ara es tancarà l'aplicació.</p></translation>
     </message>
     <message>
         <source><p>Failed to download the VirtualBox Guest Additions disk image file from <nobr><a href="%1">%2</a>.</nobr></p><p>%3</p></source>
@@ -7260,15 +7892,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>La màquina virtual passarà ara al mode <b>fluid</b>. Podeu tornar enrere al mode finestra prement <b>%1</b>. Tingueu en compte que la <i>tecla d'amfitrió</i> està definida actualment com <b>%2</b>.</p><p>La barra de menú estarà amagada al mode fluid. Podreu accedir a ella prement <b>tecla d'amfitrió+Home</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>El programa VirtualBox Guest Additions instal·lat al sistema client no és a la darrera versió: la versió instal·lada és %1 i la més nova és la %2. Algunes característiques que requereixen les Guest Additions (integració del punter, la funció de mida automàtica de l'escriptori) poden no treballar correctament.</p><p>Es recomana actualitzar la versió de Guest Additions a la versió actual triant <b>Instal·la les Guest Addi [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>El programa VirtualBox Guest Additions instal·lat al sistema client està antiquat: la versió instal·lada és %1 i la més nova és la %2. Algunes característiques que requereixen les Guest Additions (integració del punter, la funció de mida automàtica de l'escriptori) poden no treballar correctament.</p><p>Es recomana actualitzar la versió de Guest Additions a la versió actual triant <b>Instal·la les Guest Additions</b& [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><b>El programa VirtualBox Guest Additions instal·lat al sistema client és més recent que la versió suportada: la versió instal·lada és %1 i la més nova és la %2. No es pot fer servir una versió més nova de les Guest Additions amb una versió més antiga del VirtualBox.</p><p>Es recomana instal·lar la versió de Guest Additions a la versió actual triant <b>Instal·lar Guest Additions</b> des del menú <b>Dispositius</b [...]
     </message>
     <message>
@@ -7391,9 +8023,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Baixa</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Munta</translation>
+        <translation type="obsolete">Munta</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7565,8 +8197,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Mostra un diàleg amb la informació del producte</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><b>S'ha publicat una nova versió del VirtualBox! La versió <b>%1</b> és disponible a <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Podeu baixar-la directament des d'aquest enllaç: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><b>S'ha publicat una nova versió del VirtualBox! La versió <b>%1</b> és disponible a <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Podeu baixar-la directament des d'aquest enllaç: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7736,7 +8368,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>No es pot accedir a un o més dels discos, CD/DVD o disquet virtuals. Com a resultat, no podreu operar amb les màquines virtuals que els facin servir fins que estiguin accessibles.</p><p>Premeu <b>Comprova</b> per obrir el gestor de discos virtuals i veure a quins suports no s'hi pot accedir, o premeu <b>Ignora</b> per ignorar aquest missatge.</p></translation>
+        <translation type="obsolete"><p>No es pot accedir a un o més dels discos, CD/DVD o disquet virtuals. Com a resultat, no podreu operar amb les màquines virtuals que els facin servir fins que estiguin accessibles.</p><p>Premeu <b>Comprova</b> per obrir el gestor de discos virtuals i veure a quins suports no s'hi pot accedir, o premeu <b>Ignora</b> per ignorar aquest missatge.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files will be automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if you want to terminate the VirtualBox application without any further actions.</p></source>
@@ -7774,8 +8406,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Sob&reescriu</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>S'ha produït un error crític mentre s'executava la màquina virtual, que s'ha aturat.</p><p>Per obtenir ajuda, visiteu la secció Community a  <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o al vostre contracte de suport. Afegiu el contingut del fitxer de registre <tt>VBox.log</tt> i el fitxer d'imatge <tt>VBox.png</tt>,que podreu trobar al directori <nobr><b>%1 [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>S'ha produït un error crític mentre s'executava la màquina virtual, que s'ha aturat.</p><p>Per obtenir ajuda, visiteu la secció Community a  <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> o al vostre contracte de suport. Afegiu el contingut del fitxer de registre <tt>VBox.log</tt> i el fitxer d'imatge <tt>VBox.png</tt>,que podreu trobar al directori <nobr& [...]
     </message>
     <message>
         <source>Failed to open appliance.</source>
@@ -7981,7 +8613,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Segur que voleu eliminar el dispositiu de CD/DVD?</p><p>No podreu muntar cap CD o imatges iso ni tampoc instal·lar les Guest Additions sense ell.</p></translation>
+        <translation type="obsolete"><p>Segur que voleu eliminar el dispositiu de CD/DVD?</p><p>No podreu muntar cap CD o imatges iso ni tampoc instal·lar les Guest Additions sense ell.</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -8084,7 +8716,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Ara afegireu un CD/DVD al controlador <b>%1</b>.</p><p>Voleu seleccionar un disc CD/DVD virtual per posar-lo a la unitat o voleu deixar-lo buit per ara?</p></translation>
+        <translation type="obsolete"><p>Ara afegireu un CD/DVD al controlador <b>%1</b>.</p><p>Voleu seleccionar un disc CD/DVD virtual per posar-lo a la unitat o voleu deixar-lo buit per ara?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -8106,14 +8738,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>No s'ha pogut desconnectar el dispositiu CD/DVD (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
+        <translation type="obsolete">No s'ha pogut desconnectar el dispositiu CD/DVD (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>No s'ha pogut desconnectar el disquet (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
+        <translation type="obsolete">No s'ha pogut desconnectar el disquet (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>Sembla que les Guest Additions del VirtualBox no estan disponibles en aquesta màquina i les carpetes compartides no es poden fer servir sense elles. Per fer servir carpetes compartides a la màquina virtual, instal·leu les Guest Additions si no es troben instal·lades o torneu a instal·lar-les si no estan funcionant correctament seleccionant <b>Instal·la les Guest Additions</b> al menú <b>Màquina</b>. Si es troben instal [...]
     </message>
     <message numerus="yes">
@@ -8162,19 +8794,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>No s'ha pogut connectar el dispositiu CD/DVD (<nobr><b>%1</b></nobr>) a la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
+        <translation type="obsolete">No s'ha pogut connectar el dispositiu CD/DVD (<nobr><b>%1</b></nobr>) a la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>No s'ha pogut connectar el disquet (<nobr><b>%1</b></nobr>) a la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
+        <translation type="obsolete">No s'ha pogut connectar el disquet (<nobr><b>%1</b></nobr>) a la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Tingueu en compte que la unitat d'emmagatzematge d'aquest suport no s'eliminarà i, a més serà possible fer-la servir de nou més tard.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>Sembla que les Guest Additions del VirtualBox no estan disponibles en aquesta màquina i les carpetes compartides no es poden fer servir sense elles. Per fer servir carpetes compartides a la màquina virtual, instal·leu les Guest Additions si no es troben instal·lades o torneu a instal·lar-les si no estan funcionant correctament seleccionant <b>Instal·la les Guest Additions</b> al menú <b>Màquina</b>. Si es troben instal·lades però la m [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Sembla que les Guest Additions del VirtualBox no estan disponibles en aquesta màquina i les carpetes compartides no es poden fer servir sense elles. Per fer servir carpetes compartides a la màquina virtual, instal·leu les Guest Additions si no es troben instal·lades o torneu a instal·lar-les si no estan funcionant correctament seleccionant <b>Instal·la les Guest Additions</b> al menú <b>Màquina</b>. Si es troben instal [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -8417,7 +9049,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>No s'han pogut eliminar les dades.</translation>
+        <translation type="obsolete">No s'han pogut eliminar les dades.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -8477,242 +9109,329 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>No s'ha pogut iniciar el gestor del VirtualBox degut a restriccions locals.</p><p>Es tancarà l'aplicació.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>No s'ha pogut trobar el fitxer de llengua per a la llengua <b>%1</b> al directori <b><nobr>%2</nobr></b>.</p><p>La llengua es reiniciarà temporalment a la llengua per defecte del sistema. Aneu a la finestra de <b>Preferències</b> que podeu obrir des del menú <b>Fitxer</b> de la finestra del gestor del VirtualBox i seleccioneu una de les llengües existents a la pàgina <b>Llengü [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>No s'ha pogut trobar el fitxer de llengua per a la llengua <b><nobr>%1</nobr></b>.</p><p>La llengua es reiniciarà temporalment l'anglès (per defecte). Aneu a la finestra de <b>Preferències</b> que podeu obrir des del menú <b>Fitxer</b> de la finestra del gestor del VirtualBox i seleccioneu una de les llengües existents a la pàgina <b>Llengües</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation>No existeix cap màquina virtual amb aquest identificador <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation>Ignora</translation>
+        <translation type="unfinished">Ignora</translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation>No s'ha pogut crear la xarxa NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>No s'ha pogut eliminar la xarxa NAT <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation>No s'ha pogut crear el servidor DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>No s'ha pogut crear el servidor DHCP per a la interfície <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>No s'ha pogut crear la interfície de xarxa de l'amfitrió.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>Crea un disc &nou</translation>
+        <translation type="unfinished">Crea un disc &nou</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>&Tria un disc existent</translation>
+        <translation type="unfinished">&Tria un disc existent</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation>Deixa-ho &buit</translation>
+        <translation type="unfinished">Deixa-ho &buit</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>Tria un dis&c</translation>
+        <translation type="unfinished">Tria un dis&c</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Esteu segur que voleu alliberar el disc dur virtual <nobr><b>%1</b></nobr>?</p><p>Això el separarà de les màquines virtuals següents: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Esteu segur que voleu alliberar el disc òptic virtual <nobr><b>%1</b></nobr>?</p><p>Això el separarà de les màquines virtuals següents: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Esteu segur que voleu alliberar el disc floppy virtual <nobr><b>%1</b></nobr>?</p><p>Això el separarà de les màquines virtuals següents: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Segur que voleu eliminar el disc dur virtual <nobr><b>%1</b></nobr> de la llista d'imatges de discos durs coneguts?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation><p>Atès que no es pot accedir a aquest disc dur, no es pot eliminar el fitxer d'imatge.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Segur que voleu eliminar el disc òptic virtual <nobr><b>%1</b></nobr> de la llista d'imatges de discos coneguts?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Segur que voleu eliminar el disc floppy virtual <nobr><b>%1</b></nobr> de la llista d'imatges de discos coneguts?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>No s'ha pogut inserir el disc òptic virtual <nobr><b>%1</b></nobr> a la màquina <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation><p>Voleu provar a forçar la inserció d'aquest disc?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>No s'ha pogut expulsar el disc òptic virtual <nobr><b>%1</b></nobr> a la màquina <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation><p>Voleu provar a forçar l'expulsió d'aquest disc?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>No s'ha pogut inserir el disc floppy virtual <nobr><b>%1</b></nobr> a la màquina <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>No s'ha pogut expulsar el disc floppy virtual <nobr><b>%1</b></nobr> a la màquina <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>No s'ha pogut obrir el fitxer de disc dur <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>No s'ha pogut obrir el fitxer de disc òptic <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>No s'ha pogut obrir el fitxer de disc floppy <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>No s'ha pogut tancar el fitxer de disc dur <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>No s'ha pogut tancar el fitxer de disc òptic <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>No s'ha pogut tancar el fitxer de disc floppy <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation>
-            <numerusform><p>La màquina virtual %n es troba en un estat desat <b>%1</b></p><p>Si continueu, es descartarà l'estat en temps d'execució de la màquina virtual exportada. Tingueu en compte que la màquina existent no canviarà.</p></numerusform>
-            <numerusform><p>Les %n màquines virtuals es troben en un estat desat <b>%1</b></p><p>Si continueu, es descartarà l'estat en temps d'execució de les màquines virtuals exportades. Tingueu en compte que les màquines existent no canviaran.</p></numerusform>
-            <numerusform><p>Les %n màquines virtuals es troben en un estat desat <b>%1</b></p><p>Si continueu, es descartarà l'estat en temps d'execució de les màquines virtuals exportades. Tingueu en compte que les màquines existent no canviaran.</p></numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source>Switch</source>
-        <translation>Canvia</translation>
+        <translation type="unfinished">Canvia</translation>
     </message>
     <message>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>No s'ha pogut activar el servidor d'escriptori remot per a aquesta màquina virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>No s'ha pogut desactivar el servidor d'escriptori remot per a aquesta màquina virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>No s'ha pogut activar la captura de vídeo per a aquesta màquina virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>No s'ha pogut desactivar la captura de vídeo per a aquesta màquina virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>No s'ha pogut trobar el fitxer d'imatge de les VirtualBox Guest Additions.</nobr></p><p>Voleu baixar la imatge de cd des de la xarxa?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Download</source>
-        <translation>Baixa</translation>
+        <translation type="unfinished">Baixa</translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Segur que voleu baixar la imatge del VirtualBox Guest Additions des de  <nobr><a href="%1">%1</a></nobr> (mida %2 bytes)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%1</a></nobr> però no s'ha pogut desar localment com a <nobr><b>%2</b>.</nobr></p><p>Trieu una altra ubicació per al fitxer.</p> {1"?} {1<?} {2<?}</translation>
-    </message>
-    <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>S'ha baixat la imatge del VirtualBox Guest Additions des de <nobr><a href="%1">%1</a></nobr> i s'ha desat localment com a <nobr><b>%2</b>.</nobr></p><p>Voleu registrar aquesta imatge de CD i montar-la a la unitat virtual de CD/DVD?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>No es pot inserir la imatge del cd instal·lador de les Guest Additions a la màquina virtual <b>%1</b> si la màquina no té dispositius CD/DVD. Afegiu un dispositiu fent servir la pestanya de discos durs als paràmetres de la màquina.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation><p>No s'ha pogut trobar el manual d'usuari del VirtualBox <nobr><b>%1</b>.</nobr></p><p>Voleu baixar aquest fitxer des d'Internet?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Segur que voleu baixar el manual d'usuari del VirtualBox des de <nobr><a href="%1">%1</a></nobr> (mida %2 bytes)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%1</a></nobr> però no s'ha pogut desar localment com a <nobr><b>%2</b>.</nobr></p><p>Trieu una altra ubicació per al fitxer.</p> {1"?} {1<?} {2<?}</translation>
+        <translation type="unfinished"><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%2</a></nobr> però no s'ha pogut desar localment com a <nobr><b>%3</b>.</nobr></p><p>Trieu una altra ubicació per al fitxer.</p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%1</a></nobr> i s'ha desat localment com a <nobr><b>%2</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
+        <translation type="unfinished"><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%2</a></nobr> i s'ha desat localment com a <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source>Close</source>
-        <translation>Tanca</translation>
+        <translation type="unfinished">Tanca</translation>
     </message>
     <message>
         <source>Ok</source>
-        <translation>D'acord</translation>
+        <translation type="unfinished">D'acord</translation>
     </message>
     <message>
         <source>Do not show this message again</source>
-        <translation>No tornis a mostrar aquest missatge</translation>
+        <translation type="unfinished">No tornis a mostrar aquest missatge</translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>Voleu eliminar la xarxa NAT <nobr><b>%1</b>?</nobr></p><p>Si aquesta xarxa està en ús per un o més adaptadors de màquines virtuals, aquests adaptadors ja no es podran utilitzar fins que corregiu els paràmetres triant un nom de xarxa diferent o un tipus d'adaptador diferent.</p></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>Sembla que les Guest Additions del VirtualBox no estan disponibles en aquesta màquina i les carpetes compartides no es poden fer servir sense elles. Per fer servir carpetes compartides a la màquina virtual, instal·leu les Guest Additions si no es troben instal·lades o torneu a instal·lar-les si no estan funcionant correctament seleccionant <b>Instal·la les Guest Additions</b> al menú <b>Màquina</b>. Si es troben instal [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Munta</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>No s'ha pogut afegir la càmera web <b>%1</b> a la màquina virtual <b>%2</b>.</translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>No s'ha pogut desconnectar la càmera web <b>%1</b> a la màquina virtual <b>%2</b>.</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>La pantalla virtual utilitza actualment el mode de color <b>%1&nbsp;bit</b>. Per obtenir un millor rendiment, canvieu això a <b>%2&nbsp;bit</b>. Això es pot fer des de la secció <b>Pantalla</b> del tauler de control del sistema operatiu client o des dels paràmetres del sistema.</p></translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8764,19 +9483,19 @@ p, li { white-space: pre-wrap; }
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation>Mostra sempre la barra d'eines</translation>
+        <translation type="unfinished">Mostra sempre la barra d'eines</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation>Minimitza la finestra</translation>
+        <translation type="unfinished">Minimitza la finestra</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Surt del mode de pantalla completa o del mode fluid</translation>
+        <translation type="unfinished">Surt del mode de pantalla completa o del mode fluid</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation>Tanca la màquina virtual</translation>
+        <translation type="unfinished">Tanca la màquina virtual</translation>
     </message>
 </context>
 <context>
@@ -8793,7 +9512,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Nom:</translation>
     </message>
     <message>
@@ -8853,7 +9572,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation>Ha fallat la operació de xarxa i s'ha proveït l'error següent: %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8880,27 +9599,27 @@ p, li { white-space: pre-wrap; }
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation>No s'ha trobat l'amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation>S'ha denegat l'accés al contingut</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation>S'ha produït un error de protocol</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>El format del certificat SSL és erroni</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>Ha fallat l'autenticació SSL</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>Es desconeix la raó</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9799,7 +10518,7 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>Feu clic per mostrar els detalls complets</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9933,14 +10652,18 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
         <translation>Fitxers de màquina virtual (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Benvingut a VirtualBox!</h3><p>A la part esquerra d'aquesta finestra es mostra un llistat de totes les màquines virtuals a l'ordinador. Aquest llistat és buit actualment perquè encara no heu creat cap màquina virtual.<img src=:/welcome.png align=right/></p><p>Per crear una nova màquina virtual, premeu sobre el botó <b>Nova</b> a la barra principal que es troba a la part de dalt d'aquesta finestra.< [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Benvingut a VirtualBox!</h3><p>A la part esquerra d'aquesta finestra es mostra un llistat de totes les màquines virtuals a l'ordinador. Aquest llistat és buit actualment perquè encara no heu creat cap màquina virtual.<img src=:/welcome.png align=right/></p><p>Per crear una nova màquina virtual, premeu sobre el botó <b>Nova</b> a la barra principal que es troba a la part de dalt d'aques [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Gestor</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9973,15 +10696,15 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
     </message>
     <message>
         <source>Settings</source>
-        <translation>Paràmetres</translation>
+        <translation type="obsolete">Paràmetres</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation><b>%1</b> pàgina:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation><b>%1: %2</b> pàgina:</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10026,6 +10749,10 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
         <source>Display</source>
         <translation>Pantalla</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -10101,6 +10828,43 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">actualment esteu fent servir més controlador d'emmagatzematge que els xips %1 suporten. Canvieu el tipus de xip a la pàgina de paràmetres del sistema o reduïu el nombre dels següents controladors d'emmagatzematge a la pàgina de paràmetres d'emmagatzematge: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Paràmetres</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Tanca</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -10188,109 +10952,336 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
         <translation type="obsolete">Tan&ca</translation>
     </message>
     <message>
-        <source>VirtualBox Update Wizard</source>
-        <translation type="obsolete">Auxiliar d'acutliatzació del VirtualBox</translation>
+        <source>VirtualBox Update Wizard</source>
+        <translation type="obsolete">Auxiliar d'acutliatzació del VirtualBox</translation>
+    </message>
+    <message>
+        <source>Check for Updates</source>
+        <translation type="obsolete">Comprova si hi ha actualitzacions</translation>
+    </message>
+    <message>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p>
+<p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p>
+<p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Aquest assistent connectarà amb el lloc web del VirtualBox i comprovarà si hi ha una versió més nova de VirtualBox.</p>
+<p>Feu servir el botó <b>Comprova</b> per comprovar ara si hi ha noves versions o <b>Cancel·la</b> si no voleu comprovar ara si hi ha noves versions.</p>
+<p>Podeu iniciar aquest assistent en qualsevol moment seleccionant <b>Comprova si hi ha actualitzacions...</b> al menú d'<b>Ajuda</b>.</p></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Cancel·la</translation>
+    </message>
+    <message>
+        <source>Summary</source>
+        <translation type="obsolete">Resum</translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><b>S'ha publicat una nova versió del VirtualBox! La versió <b>%1</b> és disponible a <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Podeu baixar-la directament des d'aquest enllaç: </p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
+        <translation type="obsolete"><p>No es pot obtenir informació de noves versions degut a un problema amb la xarxa:</p><p><b>%1</b></p></translation>
+    </message>
+    <message>
+        <source>You are already running the most recent version of VirtualBox.</source>
+        <translation type="obsolete">Ja teniu instal·lada la darrera versió del VirtualBox. Proveu novament més tard.</translation>
+    </message>
+    <message>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Aquest auxiliar connectarà amb el lloc web del VirtualBox i comprovarà si hi ha una versió més nova del VirtualBox.<p></p>Feu servir el botó <b>Comprova</b> per comprovar ara si hi ha noves versions o <b>Cancel·la</b> si no voleu comprovar ara si hi ha noves versions. Podeu iniciar aquest auxiliar en qualsevol moment seleccionant <b>Comprova si hi ha actualitzacions...</b> al menú d'<b&g [...]
+    </message>
+</context>
+<context>
+    <name>UIUpdateStepVirtualBox</name>
+    <message>
+        <source>Checking for a new VirtualBox version...</source>
+        <translation>S'està comprovant si hi ha una versió nova del VirtualBox...</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMCloseDialog</name>
+    <message>
+        <source>Close Virtual Machine</source>
+        <translation>Tanca la màquina virtual</translation>
+    </message>
+    <message>
+        <source>You want to:</source>
+        <translation>Voleu:</translation>
+    </message>
+    <message>
+        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
+        <translation><p>Desa l'estat d'execució actual de la màquina virtual al disc dur físic de l'ordinador amfitrió.</p><p>La propera vegada que s'iniciÏ aquesta màquina, es restaurarà des de l'estat desat i continuarà l'execució des del mateix lloc en què l'heu desat, cosa que permetrà continuar immediatament amb el vostre treball.</p><p>Tingueu en compte que l'operació de desar l'estat de la màquina pot prend [...]
+    </message>
+    <message>
+        <source>&Save the machine state</source>
+        <translation>&Desa l'estat de la màquina</translation>
+    </message>
+    <message>
+        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
+        <translation><p>Envia a la màquina virtual l'esdeveniment de prémer el botó ACPI Power.</p><p>Normalment, el sistema operatiu client que s'està executant a dins de la màquina virtual detectarà aquest esdeveniment i realitzarà un procediment de tancament net. Aquesta és una manera recomanada de tancar la màquina virtual perquè totes les aplicacions que s'estan executant en ella tindran la possibilitat de desar les seves dades i estat.</p>< [...]
+    </message>
+    <message>
+        <source>S&end the shutdown signal</source>
+        <translation>&Envia el senyal d'aturada</translation>
+    </message>
+    <message>
+        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
+        <translation><p>Atura la màquina virtual.</p><p>Tingueu en compte que aquesta acció aturarà immediatament l'execució de la màquina de manera que el sistema operatiu client que s'hi està executant no podrà realitzar un procediment de tancament net, cosa que podria ocasionar una <i>pèrdua de dades</i> a la màquina virtual. Només es recomana seleccionar aquesta acció si la màquina virtual no respon a l'acció <b>Envia el senyal d&apo [...]
+    </message>
+    <message>
+        <source>&Power off the machine</source>
+        <translation>&Atura la màquina</translation>
+    </message>
+    <message>
+        <source>Restore the machine state stored in the current snapshot</source>
+        <translation>Restaura l'estat de la màquina emmagatzemat a la captura actual</translation>
+    </message>
+    <message>
+        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
+        <translation><p>Quan estigui marcat, es restaurarà l'estat de la màquina des de l'estat emmagatzemat a la captura actual quan es va aturar. Això és útil si esteu segur que voleu descartar els resultats de les últimes sessions i tornar a la captura actual.</p></translation>
+    </message>
+    <message>
+        <source>&Restore current snapshot '%1'</source>
+        <translation>&Restaura la captura actual '%1'</translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
+    <message>
+        <source>&Details</source>
+        <translation>&Detalls</translation>
+    </message>
+    <message>
+        <source>&Snapshots</source>
+        <translation>&Captures</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Diàleg Informatiu de la Sessió</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">Tan&ca</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informació de la sessió</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Detalls</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Temps d'execució</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transferències DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transferències PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Lectura de dades</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Escriptura de dades</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Transmissió de dades</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Recepció de dades</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Activat</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Desactivat</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Atributs del temps d'execució</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Resolució de pantalla</translation>
+    </message>
+    <message>
+        <source>Hardware Virtualization</source>
+        <translation type="obsolete">Virtualització per Maquinari</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Estadístiques CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Estadístiques de l'adaptador de xarxa</translation>
+    </message>
+    <message>
+        <source>Adapter 1</source>
+        <translation type="obsolete">Adaptador 1</translation>
+    </message>
+    <message>
+        <source>Adapter 2</source>
+        <translation type="obsolete">Adaptador 2</translation>
+    </message>
+    <message>
+        <source>Adapter 3</source>
+        <translation type="obsolete">Adaptador 3</translation>
+    </message>
+    <message>
+        <source>Adapter 4</source>
+        <translation type="obsolete">Adaptador 4</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">No connectat</translation>
+    </message>
+    <message>
+        <source>Hard Disks Statistics</source>
+        <translation type="obsolete">Estadístiques dels discos durs</translation>
+    </message>
+    <message>
+        <source>Primary Master</source>
+        <translation type="obsolete">Primari Mestre</translation>
+    </message>
+    <message>
+        <source>Primary Slave</source>
+        <translation type="obsolete">Primari Esclau</translation>
+    </message>
+    <message>
+        <source>Secondary Master</source>
+        <translation type="obsolete">Secundari Mestre</translation>
+    </message>
+    <message>
+        <source>Secondary Slave</source>
+        <translation type="obsolete">Secundari Esclau</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Versió %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>No detectat</translation>
     </message>
     <message>
-        <source>Check for Updates</source>
-        <translation type="obsolete">Comprova si hi ha actualitzacions</translation>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>No detectat</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p>
-<p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p>
-<p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Aquest assistent connectarà amb el lloc web del VirtualBox i comprovarà si hi ha una versió més nova de VirtualBox.</p>
-<p>Feu servir el botó <b>Comprova</b> per comprovar ara si hi ha noves versions o <b>Cancel·la</b> si no voleu comprovar ara si hi ha noves versions.</p>
-<p>Podeu iniciar aquest assistent en qualsevol moment seleccionant <b>Comprova si hi ha actualitzacions...</b> al menú d'<b>Ajuda</b>.</p></translation>
+        <source>Guest Additions</source>
+        <translation>Guest Additions</translation>
     </message>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">Cancel·la</translation>
+        <source>Guest OS Type</source>
+        <translation>Tipus de sistema client</translation>
     </message>
     <message>
-        <source>Summary</source>
-        <translation type="obsolete">Resum</translation>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Estadístiques de discos durs</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><b>S'ha publicat una nova versió del VirtualBox! La versió <b>%1</b> és disponible a <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Podeu baixar-la directament des d'aquest enllaç: </p><p><a href=%2>%3</a></p></translation>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">No hi ha cap disc dur</translation>
     </message>
     <message>
-        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>No es pot obtenir informació de noves versions degut a un problema amb la xarxa:</p><p><b>%1</b></p></translation>
+        <source>No Network Adapters</source>
+        <translation>No hi ha cap adaptador de xarxa</translation>
     </message>
     <message>
-        <source>You are already running the most recent version of VirtualBox.</source>
-        <translation type="obsolete">Ja teniu instal·lada la darrera versió del VirtualBox. Proveu novament més tard.</translation>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Activat</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Aquest auxiliar connectarà amb el lloc web del VirtualBox i comprovarà si hi ha una versió més nova del VirtualBox.<p></p>Feu servir el botó <b>Comprova</b> per comprovar ara si hi ha noves versions o <b>Cancel·la</b> si no voleu comprovar ara si hi ha noves versions. Podeu iniciar aquest auxiliar en qualsevol moment seleccionant <b>Comprova si hi ha actualitzacions...</b> al menú d'<b&g [...]
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Desactivat</translation>
     </message>
-</context>
-<context>
-    <name>UIUpdateStepVirtualBox</name>
     <message>
-        <source>Checking for a new VirtualBox version...</source>
-        <translation>S'està comprovant si hi ha una versió nova del VirtualBox...</translation>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Paginació imbricada</translation>
     </message>
-</context>
-<context>
-    <name>UIVMCloseDialog</name>
     <message>
-        <source>Close Virtual Machine</source>
-        <translation>Tanca la màquina virtual</translation>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
     </message>
     <message>
-        <source>You want to:</source>
-        <translation>Voleu:</translation>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">No disponible</translation>
     </message>
     <message>
-        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation><p>Desa l'estat d'execució actual de la màquina virtual al disc dur físic de l'ordinador amfitrió.</p><p>La propera vegada que s'iniciÏ aquesta màquina, es restaurarà des de l'estat desat i continuarà l'execució des del mateix lloc en què l'heu desat, cosa que permetrà continuar immediatament amb el vostre treball.</p><p>Tingueu en compte que l'operació de desar l'estat de la màquina pot prend [...]
+        <source>Storage Statistics</source>
+        <translation>Estadístiques d'emmagatzematge</translation>
     </message>
     <message>
-        <source>&Save the machine state</source>
-        <translation>&Desa l'estat de la màquina</translation>
+        <source>No Storage Devices</source>
+        <translation>No hi ha cap dispositiu d'emmagatzematge</translation>
     </message>
     <message>
-        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation><p>Envia a la màquina virtual l'esdeveniment de prémer el botó ACPI Power.</p><p>Normalment, el sistema operatiu client que s'està executant a dins de la màquina virtual detectarà aquest esdeveniment i realitzarà un procediment de tancament net. Aquesta és una manera recomanada de tancar la màquina virtual perquè totes les aplicacions que s'estan executant en ella tindran la possibilitat de desar les seves dades i estat.</p>< [...]
+        <source>Network Statistics</source>
+        <translation>Estadístiques de xarxa</translation>
     </message>
     <message>
-        <source>S&end the shutdown signal</source>
-        <translation>&Envia el senyal d'aturada</translation>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Paginació imbricada</translation>
     </message>
     <message>
-        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation><p>Atura la màquina virtual.</p><p>Tingueu en compte que aquesta acció aturarà immediatament l'execució de la màquina de manera que el sistema operatiu client que s'hi està executant no podrà realitzar un procediment de tancament net, cosa que podria ocasionar una <i>pèrdua de dades</i> a la màquina virtual. Només es recomana seleccionar aquesta acció si la màquina virtual no respon a l'acció <b>Envia el senyal d&apo [...]
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>No disponible</translation>
     </message>
     <message>
-        <source>&Power off the machine</source>
-        <translation>&Atura la màquina</translation>
+        <source>Clipboard Mode</source>
+        <translation>Mode de porta-retalls</translation>
     </message>
     <message>
-        <source>Restore the machine state stored in the current snapshot</source>
-        <translation>Restaura l'estat de la màquina emmagatzemat a la captura actual</translation>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Mode d'arrossega i deixa d'anar</translation>
     </message>
     <message>
-        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation><p>Quan estigui marcat, es restaurarà l'estat de la màquina des de l'estat emmagatzemat a la captura actual quan es va aturar. Això és útil si esteu segur que voleu descartar els resultats de les últimes sessions i tornar a la captura actual.</p></translation>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Restore current snapshot '%1'</source>
-        <translation>&Restaura la captura actual '%1'</translation>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <source>&Details</source>
-        <translation>&Detalls</translation>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Snapshots</source>
-        <translation>&Captures</translation>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10444,11 +11435,27 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Amaga la descripció</translation>
+        <translation type="obsolete">Amaga la descripció</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Mostra la descripció</translation>
+        <translation type="obsolete">Mostra la descripció</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10778,39 +11785,39 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
     </message>
     <message>
         <source>Storage settings</source>
-        <translation>Paràmetres d'emmagatzematge</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>Trieu un fitxer on exportar l'aplicació virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>F&ormat:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>Escriu en format estàndard OVF 1.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>Escriu en format experimental OVF 2.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation>&Paràmetres d'emmagatzematge</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10829,14 +11836,14 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Trieu un fitxer on s'ha d'exportar l'aplicació virtual...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Trieu un fitxer on exportar l'aplicació virtual...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10906,15 +11913,15 @@ pas i connectar discos durs més endavant, fent servir el diàleg de configuraci
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation>Importa l'aplicació virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>Trieu l'aplicació virtual que s'ha d'importar...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>Trieu l'aplicació virtual que s'ha d'importar</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11430,11 +12437,11 @@ Versió %1</translation>
         <translation type="obsolete">Obre el diàleg per operar amb les carpetes compartides</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Instal·la les Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Munta la imatge d'instal·lació de les Guest Additions</translation>
     </message>
     <message>
@@ -11717,7 +12724,7 @@ Versió %1</translation>
         <translation type="obsolete">D&iàleg informatiu de la sessió</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Mostra el diàleg informatiu de la sessió</translation>
     </message>
     <message>
@@ -12193,7 +13200,7 @@ Versió %1</translation>
     </message>
     <message>
         <source>Choose...</source>
-        <translation>Trieu...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12203,8 +13210,8 @@ Versió %1</translation>
         <translation><reinicialitza als valors predeterminats></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>El camí actual per defecte es mostrarà després d'acceptar els canvis i obrir aquest diàleg novament. </translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">El camí actual per defecte es mostrarà després d'acceptar els canvis i obrir aquest diàleg novament. </translation>
     </message>
     <message>
         <source><not selected></source>
@@ -12252,8 +13259,7 @@ Versió %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">El camí actual per defecte es mostrarà després d'acceptar els canvis i obrir aquest diàleg novament. </translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12643,7 +13649,7 @@ Versió %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -13497,17 +14503,17 @@ Versió %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Si connecteu aquest disc dur es millorarà de forma indirecta fent servir un nou disc dur diferenciat.</translation>
+        <translation type="obsolete">Si connecteu aquest disc dur es millorarà de forma indirecta fent servir un nou disc dur diferenciat.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Alguns dels suports d'aquest disc dur no són accessibles. Feu servir el Gestor virtual de suports en el mode <b>Mostra els discos durs diferenciats</b> per inspeccionar aquests suports.</translation>
+        <translation type="obsolete">Alguns dels suports d'aquest disc dur no són accessibles. Feu servir el Gestor virtual de suports en el mode <b>Mostra els discos durs diferenciats</b> per inspeccionar aquests suports.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Aquest disc dur base es connecta indirectament fent servir el disc dur diferenciat següent:</translation>
+        <translation type="obsolete">Aquest disc dur base es connecta indirectament fent servir el disc dur diferenciat següent:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -13559,7 +14565,7 @@ Versió %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -14119,67 +15125,201 @@ Versió %1</translation>
         <translation>Trieu una ubicació per al fitxer de disc virtual nou</translation>
     </message>
     <message>
-        <source>Enabled</source>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Cap</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Predeterminat</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Actiu</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Actiu</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Activat</translation>
+        <translation type="unfinished">Actiu</translation>
     </message>
     <message>
-        <source>Disabled</source>
+        <source>Inactive</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Desactivat</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <comment>details report</comment>
-        <translation>Execució no restringida</translation>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Ratolí PS/2</translation>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
     </message>
     <message>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Ratolí USB</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Ratolí PS/2 i USB</translation>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <translation>Execució no restringida</translation>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tablet USB</translation>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tablet USB multitàctil</translation>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Xarxa NAT</translation>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>Xarxa NAT, «%1»</translation>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Podeu crear o afegir fitxers d'imatge de disc als paràmetres de la màquina virtual.</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -14445,11 +15585,11 @@ a l'idioma predeterminat del sistema.</qt>
         <translation type="obsolete">Mostra la ruta cap a la carpeta de fitxers VDI predeterminada. S'usa aquesta carpeta, si no se n'especifica explícitament una altra, quan s'afegeix o es crea un disc virtual.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicia el camí a la carpeta de màquines virtuals al seu valor predeterminat. Després d'acceptar els canvis i tornar a obrir aquest diàleg, s'hi mostrarà aquest camí.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicia el camí a la carpeta de fitxers VDI al seu valor predeterminat. Després d'acceptar els canvis i tornar a obrir aquest diàleg, s'hi mostrarà aquest camí.</translation>
     </message>
     <message>
@@ -14493,7 +15633,7 @@ a l'idioma predeterminat del sistema.</qt>
         <translation type="obsolete">Obre un diàleg per seleccionar el fitxer de la biblioteca d'autenticació VRDP .</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicia el fitxer de la biblioteca d'autenticació al seu valor predeterminat. Després d'acceptar els canvis i tornar a obrir aquest diàleg, s'hi mostrarà aquest fitxer.</translation>
     </message>
     <message>
@@ -15027,6 +16167,18 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Crea un disc virtual nou</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -15151,8 +16303,8 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <translation type="obsolete">&No feu servir aquesta informació per contactar amb mi</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Ompliu aquest formulari de registre per fer-nos saber que fas servir el VirtualBox i, opcionalment, per mantenir't informat sobre noves versions i actualitzacions.</p><p>Introduïu als camps següents el vostre nom complet fent servir caràcters llatins i la vostra adreça de correu. Teniu en compte que innotek farà servir aquesta informació només per recopilar estadístiques d'ús del producte i per informar-vos de novetats.  [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Ompliu aquest formulari de registre per fer-nos saber que fas servir el VirtualBox i, opcionalment, per mantenir't informat sobre noves versions i actualitzacions.</p><p>Introduïu als camps següents el vostre nom complet fent servir caràcters llatins i la vostra adreça de correu. Teniu en compte que innotek farà servir aquesta informació només per recopilar estadístiques d'ús del producte i per informar-vos de novetats.  [...]
     </message>
     <message>
         <source>VirtualBox Registration Dialog</source>
@@ -15167,8 +16319,8 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <translation type="obsolete">No s'ha pogut dur a terme la conformitat de connexió.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Ompliu aquest formulari de registre per deixar-nos conèixer que feu servir el VirtualBox i, opcionalment, per mantenir-vos informat sobre novetats i actualitzacions.</p><p>Introduïu el vostre nom complet fent servir caràcters llatins i la vostra adreça de correu electrònica als camps següents. Tingueu en compte que Sun Microsystems farà servir aquesta informació només per estadístiques del producte i per enviar-vos notícies sobre  [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Ompliu aquest formulari de registre per deixar-nos conèixer que feu servir el VirtualBox i, opcionalment, per mantenir-vos informat sobre novetats i actualitzacions.</p><p>Introduïu el vostre nom complet fent servir caràcters llatins i la vostra adreça de correu electrònica als camps següents. Tingueu en compte que Sun Microsystems farà servir aquesta informació només per estadístiques del producte i per enviar-vos notícies sobre  [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -15187,8 +16339,8 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <translation type="obsolete">Seleccioneu un país/territori</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Ompliu aquest formulari de registre per permetre'ns conèixer que feu servir el VirtualBox i, opcionalment, mantenir-vos informat sobre novetats i actualitzacions del VirtualBox.</p><p>Feu servir caràcters llatins per omplir els camps següents. Tingueu en compte que Sun Microsystems farà servir aquesta informació només per a usos estadístics i per enviar-vos notícies sobre el VirtualBox. Sun Microsystems mai compartirà les vos [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Ompliu aquest formulari de registre per permetre'ns conèixer que feu servir el VirtualBox i, opcionalment, mantenir-vos informat sobre novetats i actualitzacions del VirtualBox.</p><p>Feu servir caràcters llatins per omplir els camps següents. Tingueu en compte que Sun Microsystems farà servir aquesta informació només per a usos estadístics i per enviar-vos notícies sobre el VirtualBox. Sun Microsystems mai compartirà les vos [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -15533,8 +16685,8 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <translation type="obsolete">Suspèn l'execució de la màquina virtual</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Benvingut a VirtualBox!</h3><p>A la part esquerra d'aquesta finestra es mostra un llistat de totes les màquines virtuals a l'ordinador. Aquest llistat és buit actualment perquè encara no heu creat cap màquina virtual.<img src=:/welcome.png align=right/></p><p>Per crear una nova màquina virtual, premeu sobre el botó <b>Nova</b> a la barra principal que es troba a la part de dalt d'aques [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Benvingut a VirtualBox!</h3><p>A la part esquerra d'aquesta finestra es mostra un llistat de totes les màquines virtuals a l'ordinador. Aquest llistat és buit actualment perquè encara no heu creat cap màquina virtual.<img src=:/welcome.png align=right/></p><p>Per crear una nova màquina virtual, premeu sobre el botó <b>Nova</b> a la barra principal que es troba a la part de dalt d'aques [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -16351,217 +17503,6 @@ o a ambdòs (<i>Qualsevol</i>).</qt></translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Diàleg Informatiu de la Sessió</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">Tan&ca</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Informació de la sessió</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detalls</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Temps d'execució</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transferències DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transferències PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Lectura de dades</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Escriptura de dades</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Transmissió de dades</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Recepció de dades</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Activat</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Desactivat</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Atributs del temps d'execució</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Resolució de pantalla</translation>
-    </message>
-    <message>
-        <source>Hardware Virtualization</source>
-        <translation type="obsolete">Virtualització per Maquinari</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Estadístiques CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Estadístiques de l'adaptador de xarxa</translation>
-    </message>
-    <message>
-        <source>Adapter 1</source>
-        <translation type="obsolete">Adaptador 1</translation>
-    </message>
-    <message>
-        <source>Adapter 2</source>
-        <translation type="obsolete">Adaptador 2</translation>
-    </message>
-    <message>
-        <source>Adapter 3</source>
-        <translation type="obsolete">Adaptador 3</translation>
-    </message>
-    <message>
-        <source>Adapter 4</source>
-        <translation type="obsolete">Adaptador 4</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">No connectat</translation>
-    </message>
-    <message>
-        <source>Hard Disks Statistics</source>
-        <translation type="obsolete">Estadístiques dels discos durs</translation>
-    </message>
-    <message>
-        <source>Primary Master</source>
-        <translation type="obsolete">Primari Mestre</translation>
-    </message>
-    <message>
-        <source>Primary Slave</source>
-        <translation type="obsolete">Primari Esclau</translation>
-    </message>
-    <message>
-        <source>Secondary Master</source>
-        <translation type="obsolete">Secundari Mestre</translation>
-    </message>
-    <message>
-        <source>Secondary Slave</source>
-        <translation type="obsolete">Secundari Esclau</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Versió %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>No detectat</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>No detectat</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Guest Additions</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Tipus de sistema client</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Estadístiques de discos durs</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">No hi ha cap disc dur</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>No hi ha cap adaptador de xarxa</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Activat</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Desactivat</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Paginació imbricada</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">No disponible</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Estadístiques d'emmagatzematge</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>No hi ha cap dispositiu d'emmagatzematge</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Estadístiques de xarxa</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Paginació imbricada</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>No disponible</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Mode de porta-retalls</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Mode d'arrossega i deixa d'anar</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>&Detalls de configuració</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Informació del &temps d'execució</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source>Inaccessible</source>
@@ -16653,7 +17594,7 @@ o a ambdòs (<i>Qualsevol</i>).</qt></translation>
     </message>
     <message>
         <source>Holds the TAP interface name.</source>
-        <translation type="obsolete">Mostra el nom de la interfície TAP.</translation>
+        <translation type="obsolete">Mostra el nom de la intefície TAP.</translation>
     </message>
     <message>
         <source>&Enable Network Adapter</source>
@@ -17444,7 +18385,7 @@ aquesta característica després d'haver instal·lat un Windows al sistema
         <translation type="obsolete">Reinicialitza</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicia la ruta de la carpeta de captures al valor per defecte. La ruta actual per defecte es mostrarà acceptant els canvis i obrint novament aquest diàleg.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca_VA.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca_VA.ts
index 7e90d00..4e8a071 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca_VA.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ca_VA.ts
@@ -15,8 +15,8 @@
     </message>
     <message>
         <source>English</source>
-        <comment>Catalan (Valencian)</comment>
-        <translation type="obsolete">Catalan</translation>
+        <comment>Language name, in English</comment>
+        <translation>Catalan (Valencian)</translation>
     </message>
     <message>
         <source>--</source>
@@ -28,11 +28,6 @@
         <comment>Comma-separated list of translators</comment>
         <translation>Vicent Fornés, Pau Iranzo <pau.iranzo at softcatala.org></translation>
     </message>
-    <message>
-        <source>English</source>
-        <comment>Language name, in English</comment>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>AttachmentsModel</name>
@@ -301,7 +296,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Mode f&luid</translation>
+        <translation type="unfinished">Mode f&luid</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -325,11 +320,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Desactiva la integració del &punter</translation>
+        <translation type="obsolete">Desactiva la integració del &punter</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Desactiva temporalment la integració del punter de l'amfitrió</translation>
+        <translation type="obsolete">Desactiva temporalment la integració del punter de l'amfitrió</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -341,11 +336,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Insereix Ctrl+Alt+Supr</translation>
+        <translation type="obsolete">&Insereix Ctrl+Alt+Supr</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Envia la seqüència Ctrl+Alt+Supr a la màquina virtual</translation>
+        <translation type="obsolete">Envia la seqüència Ctrl+Alt+Supr a la màquina virtual</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -353,7 +348,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Envia la seqüència Ctrl+Alt+Retrocés a la màquina virtua</translation>
+        <translation type="obsolete">Envia la seqüència Ctrl+Alt+Retrocés a la màquina virtua</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -368,8 +363,8 @@
         <translation type="obsolete">D&iàleg informatiu de la sessió</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Mostra el diàleg d'informació de la sessió</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Mostra el diàleg informatiu de la sessió</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -425,15 +420,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Dispositius &CD/DVD</translation>
+        <translation type="obsolete">Dispositius &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Dis&queteres</translation>
+        <translation type="obsolete">Dis&queteres</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Dispositius &USB</translation>
+        <translation type="obsolete">Dispositius &USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -460,12 +455,12 @@
         <translation type="obsolete">Habilita o inhabilita les connexions d'escriptori remot (RDP) a esta màquina</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>&Insereix la imatge de CD de les Guest Additions...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Instal·la les Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Insereix el fitxer de disc de les Guest Additions al dispositiu virtual</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Munta la imatge d'instal·lació de les Guest Additions</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -484,7 +479,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&S'està afegint al registre...</translation>
+        <translation type="obsolete">&S'està connectant...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -562,15 +557,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Canvia al mode de pantalla com&pleta</translation>
+        <translation type="obsolete">Canvia al mode de pantalla com&pleta</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Canvia entre el mode normal i a pantalla completa</translation>
+        <translation type="obsolete">Canvia entre el mode normal i a pantalla completa</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Canvia al mode f&luid</translation>
+        <translation type="obsolete">Canvia al mode f&luid</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -578,7 +573,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Canvia al mode e&scalat</translation>
+        <translation type="obsolete">Canvia al mode e&scalat</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -658,7 +653,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Ins&ereix Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">Ins&ereix Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>&File</source>
@@ -953,70 +948,296 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Arrosega i deixa anar</translation>
+        <translation type="obsolete">Arrosega i deixa anar</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>Alça l'estat de la màquina virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>Apaga la màquina virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>&Paràmetres de xarxa...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation>Paràmetre&s de carpeta compartida...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>&Pantalla remota</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>Intercanvia les connexions d'escriptori remotes (RDP) a esta màquina</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>Captura de &vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation>Intercanvia la captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation>Paràmetres de la captura de &vídeo...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>Configureu els paràmetres de la captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Popup Menu</source>
-        <translation>Menú emergent</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Instal·la les Guest Additions...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Munta la imatge d'instal·lació de les Guest Additions</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>Càmeres &web</translation>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Teclat</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Xarxa</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Mostra el &registre...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Fitxer</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Habilita</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1797,6 +2018,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1807,7 +2035,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>S'estan deixant anar les dades...</translation>
+        <translation type="obsolete">S'estan deixant anar les dades...</translation>
     </message>
 </context>
 <context>
@@ -1907,6 +2135,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2600,7 +2855,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Controller</source>
@@ -2790,56 +3045,151 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation>Fitxer de captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation>Atributs de captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation>Captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation>Desactivat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Xarxa NAT, «%1»</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>Mida del marc: %1x%2, Marcs per segon: %3fps, Bits per segon: %4kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Controlador</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>None</source>
-        <comment>details</comment>
-        <translation type="obsolete">Cap</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Memòria de vídeo</translation>
-    </message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Controlador USB</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Controlador</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Cap</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Memòria de vídeo</translation>
+    </message>
     <message>
         <source>Screens</source>
         <comment>details</comment>
@@ -3128,7 +3478,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation>Paquets d'&extensió</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3190,28 +3540,16 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Inhabilita el protector de pantalla de l'a&mfitrió</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>&Acoblador i barra de menú:</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>Mostra automàticament en pantalla completa</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Quan estiga actiu, l'acoblador de l'amfitrió i la barra de menú es mostraran quan la màquina virtual es trobe en mode de pantalla completa.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>Estalvi de pantalla de l'&amfitrió:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>Quan estiga actiu, l'estalvi de pantalla de l'amfitrió es desactivarà quan la màquina virtual s'estiga executant.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>Desactiva quan s'estiguen executant màquines virtuals</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3250,27 +3588,27 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>Combinació de tecla d'amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>Alguns elements tenen les mateixes dreceres assignades.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation>Gestor del &VirtualBox</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>&Màquina virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Mostra totes les dreceres disponibles que poden configurar-se.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Introduïu una seqüència per filtrar el llistat de dreceres.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3329,7 +3667,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>Llengües de la &interfície</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3486,128 +3824,128 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation>Xarxes &NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation>Mostra totes les xarxes NAT disponibles.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translation>Xarxes de &només amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>No s'ha proveït un nom nou per a la xarxa NAT que abans s'anomenava <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation>No s'ha proveït un CIDR per a la xarxa NAT <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>No s'ha proveït un CIDR per a la xarxa NAT que abans s'anomenava <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation>S'ha proveït un CIDR no vàlid (<i>%1</i>) per a la xarxa NAT <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation>S'ha proveït un CIDR no vàlid (<i>%1</i>) per a la xarxa NAT abans anomenada <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translation>Nom de la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation>[buit]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (reanomenat des de %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation>Nom antic de la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation>Nom nou de la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation>CIDR de la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation>Compatible amb DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>yes</source>
-        <translation>sí</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>no</source>
-        <translation>no</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation>Compatible amb IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation>Ruta IPv6 per defecte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una adreça IPv4 vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una màscara de xarxa IPv4 vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una adreça IPv6 vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment un servidor d'adreça DHCP vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una màscara de xarxa DHCP vàlida.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una límit d'adreça inferior vàlida del servidor DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>La interfície <b>%1</b> de l'amfitrió no té actualment una límit d'adreça superior vàlida del servidor DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>Ja s'està utilitzant el nom <b>%1</b> per a algunes xarxes NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>Activa</translation>
+        <translation type="unfinished">Actiu</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>&Afig una xarxa NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation>&Suprimeix una xarxa NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation>&Edita una xarxa NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3709,177 +4047,177 @@ p, li { white-space: pre-wrap; }
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation>Detalls de xarxa de només l'amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation>&Adaptador</translation>
+        <translation type="unfinished">&Adaptador</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation>&Configuració manual</translation>
+        <translation type="unfinished">&Configuració manual</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>Fes servir la configuració manual només per a l'adaptador de xarxa de l'amfitrió.</translation>
+        <translation type="unfinished">Fes servir la configuració manual només per a l'adaptador de xarxa de l'amfitrió.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation>Adreça &IPv4:</translation>
+        <translation type="unfinished">Adreça &IPv4:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>Gestiona l'adreça IPv4 de l'amfitrió d'este adaptador.</translation>
+        <translation type="unfinished">Mostra l'adreça IPv4 de l'amfitrió d'este adaptador.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation>&Màscara de xarxa IPv4:</translation>
+        <translation type="unfinished">&Màscara de xarxa IPv4:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>Mostra la màscara de xarxa IPv4 de l'amfitrió d'este adaptador.</translation>
+        <translation type="unfinished">Mostra la màscara de xarxa IPv4 de l'amfitrió d'este adaptador.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation>Adreça I&Pv6:</translation>
+        <translation type="unfinished">Adreça I&Pv6:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>Gestiona l'adreça IPv6 de l'amfitrió d'este adaptador si IPv6 està suportat.</translation>
+        <translation type="unfinished">Mostra l'adreça IPv6 de l'amfitrió d'este adaptador si IPv6 està suportat.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation>&Longitud de la màscara de xarxa IPv6:</translation>
+        <translation type="unfinished">&Longitud de la màscara de xarxa IPv6:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>Gestiona la longitud de l'adreça de la màscara de xarxa IPv6 de l'amfitrió per a este adaptador si IPv6 està suportat.</translation>
+        <translation type="unfinished">Mostra la longitud de l'adreça de la màscara de xarxa IPv6 de l'amfitrió per a este adaptador si IPv6 està suportat.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation>Servidor &DHCP</translation>
+        <translation type="unfinished">Servidor &DHCP</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>&Habilita el servidor</translation>
+        <translation type="unfinished">&Habilita el servidor</translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation>Indica si el servidor DHCP està habilitat en iniciar de la màquina o no.</translation>
+        <translation type="unfinished">Indica si el servidor DHCP està habilitat en iniciar de la màquina o no.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation>Ad&reça del servidor:</translation>
+        <translation type="unfinished">Ad&reça del servidor:</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Gestiona l'adreça del servidor DHCP de la xarxa associada a este adaptador de només l'amfitrió.</translation>
+        <translation type="unfinished">Mostra l'adreça del servidor DHCP de la xarxa associada a este adaptador de només l'amfitrió.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation>&Màscara del servidor:</translation>
+        <translation type="unfinished">&Màscara del servidor:</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Gestiona la màscara de xarxa del servidor DHCP de la xarxa associada a este adaptador de només l'amfitrió.</translation>
+        <translation type="unfinished">Mostra la màscara de xarxa del servidor DHCP de la xarxa associada a este adaptador de només l'amfitrió.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation>Adreça límit &inferior:</translation>
+        <translation type="unfinished">Adreça límit &inferior:</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Gestiona l'adreça límit inferior oferida pel servidor DHCP de la xarxa associada aquet adaptador de només l'amfitrió.</translation>
+        <translation type="unfinished">Mostra l'adreça límit inferior oferida pel servidor DHCP de la xarxa associada aquet adaptador de només l'amfitrió.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation>Adreça límit &superior:</translation>
+        <translation type="unfinished">Adreça límit &superior:</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Gestiona l'adreça límit superior oferida pel servidor DHCP de la xarxa associada a este adaptador de només l'amfitrió.</translation>
+        <translation type="unfinished">Mostra l'adreça límit superior oferida pel servidor DHCP de la xarxa associada a este adaptador de només l'amfitrió.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation>Detalls de la xarxa NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation>&Activa la xarxa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation>Activa esta xarxa NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation>&Nom de la Xarxa:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>Gestiona el nom per esta xarxa.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation>Xarxa &CIDR:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>Gestiona el CIDR per esta xarxa.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation>Opcions de xarxa:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation>Compatible amb &DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation>Determina si la xarxa és compatible amb DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation>Compatible amb &IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>Determina si la xarxa és compatible amb IPv6.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>Publicita com a &camí IPv6 per defecte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation>Determina si esta xarxa s'hauria de publicitar com a un camí IPv6 per defecte.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Obri el diàleg per gestionar les regles de reenviament de ports.</translation>
+        <translation type="unfinished">Obri el diàleg per gestionar les regles de reenviament de ports.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation>Reenviament de &ports</translation>
+        <translation type="unfinished">Reenviament de &ports</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>Regles de redireccionament de ports</translation>
+        <translation type="unfinished">Regles de redireccionament de ports</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation>IPv4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation>IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3934,11 +4272,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>No s'ha proveït cap servidor intermediari d'amfitrió.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>No s'ha proveït cap port de servidor intermediari.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4003,71 +4341,71 @@ p, li { white-space: pre-wrap; }
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation><key_%1></translation>
+        <translation type="unfinished"><key_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation>Esquerra</translation>
+        <translation type="unfinished">Esquerra</translation>
     </message>
     <message>
         <source>Right </source>
-        <translation>Dreta</translation>
+        <translation type="unfinished">Dreta</translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation>Tecla de majúscules esquerra</translation>
+        <translation type="unfinished">Tecla de majúscules esquerra</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation>Tecla de majúscules dreta</translation>
+        <translation type="unfinished">Tecla de majúscules dreta</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation>Control esquerra</translation>
+        <translation type="unfinished">Control esquerra</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation>Control dreta</translation>
+        <translation type="unfinished">Control dreta</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation>Alt esquerra</translation>
+        <translation type="unfinished">Alt esquerra</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation>Alt dreta</translation>
+        <translation type="unfinished">Alt dreta</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation>Tecla de Windows esquerra</translation>
+        <translation type="unfinished">Tecla de Windows esquerra</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation>Tecla de Windows dreta</translation>
+        <translation type="unfinished">Tecla de Windows dreta</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation>Tecla de menú</translation>
+        <translation type="unfinished">Tecla de menú</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation>Alt Gr</translation>
+        <translation type="unfinished">Alt Gr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>Bloq Majús</translation>
+        <translation type="unfinished">Bloq Majús</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation>Bloq Despl</translation>
+        <translation type="unfinished">Bloq Despl</translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation>Tecla amfitrió+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
-        <translation>Cap</translation>
+        <translation type="unfinished">Cap</translation>
     </message>
 </context>
 <context>
@@ -4254,22 +4592,22 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation>Reinicia la drecera al valor per defecte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation>Desconfigura la drecera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation>Nom</translation>
+        <translation type="unfinished">Nom</translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translation>Drecera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4414,12 +4752,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica l'activitat dels dispositius de CD/DVD:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica l'activitat dels dispositius de CD/DVD:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica l'activitat dels dispositius de disquetera:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica l'activitat dels dispositius de disquetera:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4459,7 +4797,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>El controlador USB està desactivat</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>El controlador USB està desactivat</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4508,20 +4846,34 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Indica l'activitat de captura de vídeo:</nobr><br>%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>S'ha desactivat la captura de vídeo</b></nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>Fitxer de captura de vídeo:</b> %1</nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation>Estat de característica addicional:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4595,11 +4947,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>No s'ha connectat cap càmera web</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>No hi ha cap càmera web compatible connecatada a l'ordinador amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
@@ -4649,7 +5001,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Vídeo</translation>
+        <translation type="obsolete">&Vídeo</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4765,192 +5117,256 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>Captura de &vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>Quan estiga marcat, el VirtualBox enregistrarà la sessió a la màquina virtual en un fitxer de vídeo.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation>&Activa la captura de vídeo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>&Camí al fitxer:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Este paràmetre determina el nom de fitxer que el VirtualBox utilitza per alçar el contingut enregistrat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>Mida del &marc:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>Este paràmetre determina la resolució (mida del marc) del vídeo enregistrat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>Este paràmetre determina la resolució <b>horitzontal</b> (amplada del marc) del vídeo enregistrat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>Este paràmetre determina la resolució <b>vertical</b> (alçada del marc) del vídeo enregistrat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>&Marcs per segon:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>Este paràmetre determina el nombre màxim de <b>marcs per segon</b>. Els marcs addicionals s'ignoraran. En reduir este valor s'incrementarà el nombre de marcs que s'ignoraran i reduirà la mida del fitxer.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation>&Qualitat:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Este paràmetre determina la <b>qualitat</b>. En incrementar-lo farà que el vídeo es veja millor però amb una mida de fitxer més gran.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Este paràmetre determina la taxa de bits en <b>kilobits per segon</b>. En incrementar-lo farà que el vídeo es veja millor però amb una mida de fitxer més gran.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation>Pantalle&s:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>La màquina virtual està configurada per utilitzar l'acceleració gràfica per maquinari. Tot i així, el sistema amfitrió no proveeix això i no podreu iniciar la màquina.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>La màquina virtual té actualment assignada una memòria de vídeo inferior a <b>%1</b>, que és la quantitat mínima requerida per canviar al mode de pantalla completa o mode fluid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>La màquina virtual té actualment assignada una memòria de vídeo inferior a <b>%1</b>, que és la quantitat mínima requerida per poder reproduir eficientment el vídeo d'alta resolució.</translation>
-    </message>
-    <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>La màquina virtual està configurada per utilitzar l'acceleració gràfica i el sistema operatiu suggerit és Windows Vista o posterior. Per a un millor rendiment hauríeu d'establir la memòria de vídeo almenys a <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>La màquina virtual està configurada per utilitzar l'acceleració de flux de vídeo. Atès que esta característica només funciona amb Windows, el sistema client es desactivarà.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>No s'ha especificat el valor del port del servidor VRDE.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>No s'ha especificat el valor de temps d'espera d'autenticació VRDE.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation>Definit per l'usuari</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation>%1 fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>fps</source>
-        <translation>fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation>baixa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation>mitjana</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation>alta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation>kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation>Pantalla %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation>Activa l'enregistrament de vídeo per a la pantalla %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation type="unfinished"></translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Barra d'eines mini:</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">heu assignat més d'un <b>%1%</b> de la memòria del vostre ordinador (<b>%2</b>) a la màquina virtual. No heu deixat suficient memòria al sistema amfitrió. Seleccineu un percentatge menor.</translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Si està marcat, mostra la barra d'eines mini als modes fluid i de pantalla completa.</translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">heu assignat més d'un <b>%1%</b> de la memòria del vostre ordinador (<b>%2</b>) a la màquina virtual. No heu deixat suficient memòria al sistema amfitrió. Contineu pel vostre compte (no recomanable).</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Mostra en pantalla completa/&fluid</translation>
     </message>
     <message>
-        <source>there is a 64 bits guest OS type assigned for this VM, which requires virtualization feature (VT-x/AMD-V) to be enabled too, else your guest will fail to detect a 64 bits CPU and will not be able to boot, so this feature will be enabled automatically when you'll accept VM Settings by pressing OK button.</source>
-        <translation type="obsolete">existeix un sistema client de 64 bits assignat a esta màquina virtual que requereix tindre habilitada la característica de virtualització (VT-x/AMD-V). El vostre sistema client fallarà al detectar una CPU de 64 bits i no podrà iniciar-se, per la qual cosa esta característica s'habilitarà per defecte quan accepteu els paràmetres de la màquina virtual prement el botó D'acord.</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Si està marcat, mostra una barra d'eines petita a la part de dalt de la pantalla en lloc d'a la posició per defecte a la part de sota.</translation>
     </message>
     <message>
-        <source><qt>%1&nbsp;MB</qt></source>
-        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Mostra a la par&t de dalt de la pantalla</translation>
     </message>
     <message>
-        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>Mostra el camí on les captures d'esta màquina virtual s'alçaran. Tingueu en compte que les captures poden ocupar prou quantitat d'espai al disc dur.</translation>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>&Bàsic</translation>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Identification</source>
-        <translation type="obsolete">Identificació</translation>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Name:</source>
-        <translation type="obsolete">&Nom:</translation>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the name of the virtual machine.</source>
-        <translation type="obsolete">Mostra el nom de la màquina virtual.</translation>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>OS &Type:</source>
-        <translation type="obsolete">&Tipus de SO:</translation>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation type="obsolete">Mostra el tipus de sistema operatiu que voleu instal·lar a dins d'esta màquina virtual (anomenat sistema operatiu client).</translation>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
     </message>
     <message>
-        <source>Base &Memory Size</source>
-        <translation type="obsolete">Mida de la &memòria base</translation>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
     </message>
     <message>
-        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
-        <translation type="obsolete">Controla la quantitat de memòria amb què es proveeix a la màquina virtual. Si n'assigneu massa, pot ser que la màquina no s'inicie.</translation>
+        <source>%</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><</source>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
+        <translation type="obsolete">heu assignat més d'un <b>%1%</b> de la memòria del vostre ordinador (<b>%2</b>) a la màquina virtual. No heu deixat suficient memòria al sistema amfitrió. Seleccineu un percentatge menor.</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
+        <translation type="obsolete">heu assignat més d'un <b>%1%</b> de la memòria del vostre ordinador (<b>%2</b>) a la màquina virtual. No heu deixat suficient memòria al sistema amfitrió. Contineu pel vostre compte (no recomanable).</translation>
+    </message>
+    <message>
+        <source>there is a 64 bits guest OS type assigned for this VM, which requires virtualization feature (VT-x/AMD-V) to be enabled too, else your guest will fail to detect a 64 bits CPU and will not be able to boot, so this feature will be enabled automatically when you'll accept VM Settings by pressing OK button.</source>
+        <translation type="obsolete">existeix un sistema client de 64 bits assignat a esta màquina virtual que requereix tindre habilitada la característica de virtualització (VT-x/AMD-V). El vostre sistema client fallarà al detectar una CPU de 64 bits i no podrà iniciar-se, per la qual cosa esta característica s'habilitarà per defecte quan accepteu els paràmetres de la màquina virtual prement el botó D'acord.</translation>
+    </message>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+    </message>
+    <message>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation>Mostra el camí on les captures d'esta màquina virtual s'alçaran. Tingueu en compte que les captures poden ocupar prou quantitat d'espai al disc dur.</translation>
+    </message>
+    <message>
+        <source>Basi&c</source>
+        <translation>&Bàsic</translation>
+    </message>
+    <message>
+        <source>Identification</source>
+        <translation type="obsolete">Identificació</translation>
+    </message>
+    <message>
+        <source>&Name:</source>
+        <translation type="obsolete">&Nom:</translation>
+    </message>
+    <message>
+        <source>Holds the name of the virtual machine.</source>
+        <translation type="obsolete">Mostra el nom de la màquina virtual.</translation>
+    </message>
+    <message>
+        <source>OS &Type:</source>
+        <translation type="obsolete">&Tipus de SO:</translation>
+    </message>
+    <message>
+        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
+        <translation type="obsolete">Mostra el tipus de sistema operatiu que voleu instal·lar a dins d'esta màquina virtual (anomenat sistema operatiu client).</translation>
+    </message>
+    <message>
+        <source>Base &Memory Size</source>
+        <translation type="obsolete">Mida de la &memòria base</translation>
+    </message>
+    <message>
+        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
+        <translation type="obsolete">Controla la quantitat de memòria amb què es proveeix a la màquina virtual. Si n'assigneu massa, pot ser que la màquina no s'inicie.</translation>
+    </message>
+    <message>
+        <source><</source>
         <translation type="obsolete"><</translation>
     </message>
     <message>
@@ -4970,7 +5386,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Controla la quantitat de memòria de vídeo amb què es proveeix a la màquina virtual.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avançat</translation>
     </message>
     <message>
@@ -5066,7 +5482,7 @@ p, li { white-space: pre-wrap; }
         <translation>Carpeta de capture&s:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Descripció</translation>
     </message>
     <message>
@@ -5079,7 +5495,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Si està marcat, qualsevol canvi al CD/DVD o disquet muntat s'alçarà al fitxer de configuració per tal de preservar la configuració dels suports muntats entre cada execució de la màquina virtual.</translation>
+        <translation type="obsolete">Si està marcat, qualsevol canvi al CD/DVD o disquet muntat s'alçarà al fitxer de configuració per tal de preservar la configuració dels suports muntats entre cada execució de la màquina virtual.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5111,38 +5527,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Suports extraïbles:</translation>
+        <translation type="obsolete">Suports extraïbles:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Recorda els canvis en execució</translation>
+        <translation type="obsolete">&Recorda els canvis en execució</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Barra d'eines mini:</translation>
+        <translation type="obsolete">Barra d'eines mini:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Si està marcat, mostra la barra d'eines mini als modes fluid i de pantalla completa.</translation>
+        <translation type="obsolete">Si està marcat, mostra la barra d'eines mini als modes fluid i de pantalla completa.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Mostra en pantalla completa/&fluid</translation>
+        <translation type="obsolete">Mostra en pantalla completa/&fluid</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Si està marcat, mostra una barra d'eines petita a la part de dalt de la pantalla en lloc d'a la posició per defecte a la part de sota.</translation>
+        <translation type="obsolete">Si està marcat, mostra una barra d'eines petita a la part de dalt de la pantalla en lloc d'a la posició per defecte a la part de sota.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Mostra a la par&t de dalt de la pantalla</translation>
+        <translation type="obsolete">Mostra a la par&t de dalt de la pantalla</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">heu seleccionat un tipus de sistema client de 64 bits per a esta màquina virtual. Amb estos tipus de clients es requereix maquinari de virtualització (VT-x/AMD-V), esta característica s'activarà automàticament.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>Arrosega i &deixa anar:</translation>
     </message>
     <message>
@@ -5151,11 +5567,107 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation>No s'ha especificat cap màquina virtual.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>La recomanació del sistema operatiu de la màquina virtual és de tipus 64-bit. Els sistemes client de 64-bit requereixen la virtualització per maquinari i per tant això s'activarà automàticament si confirmeu els canvis.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Barra d'eines mini:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Si està marcat, mostra la barra d'eines mini als modes fluid i de pantalla completa.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Mostra en pantalla completa/&fluid</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Si està marcat, mostra una barra d'eines petita a la part de dalt de la pantalla en lloc d'a la posició per defecte a la part de sota.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Mostra a la par&t de dalt de la pantalla</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5310,7 +5822,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the TAP interface name.</source>
-        <translation type="obsolete">Mostra el nom de la interfície TAP.</translation>
+        <translation type="obsolete">Mostra el nom de la intefície TAP.</translation>
     </message>
     <message>
         <source>&Setup Application:</source>
@@ -5410,35 +5922,35 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation>Actualment no s'ha seleccionat cap adaptador de xarxa pont.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>Actualment no s'ha especificat cap nom de xarxa interna.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>Actualment no s'ha seleccionat cap adaptador de xarxa de només amfitrió.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation>Actualment no s'ha seleccionat cap controlador genèric.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>L'adreça MAC ha de tindre 12 dígits hexadecimals.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation>El segon dígit a l'adreça MAC no pot ser senar ja que només es permeten adreces unicast.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>Actualment no s'ha especificat cap nom de xarxa NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>Gestiona el nom de la xarxa NAT que és on es connectarà la targeta de xarxa. Podeu crear o eliminar xarxes fent servir els paràmetres globals de xarxa a la finestra de gestió de màquines virtuals.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5615,23 +6127,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>No s'ha proveït cap IRQ.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>No s'ha proveït cap port d'E/S.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Dos o més ports tenen els mateixos paràmetres.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>No s'ha proveït cap camí de port.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>S'han proveït dos camins de ports duplicats.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5802,10 +6314,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Si està marcat, esta carpeta compartida serà permanent.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Finestra</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5856,11 +6364,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Si està marcat, el conducte especificat al camp <b>Camí del port</b> es crearà per la màquina virtual quan s'inicie. En altre cas, la màquina virtual provarà de fer servir el conducte existent.</translation>
+        <translation type="obsolete">Si està marcat, el conducte especificat al camp <b>Camí del port</b> es crearà per la màquina virtual quan s'inicie. En altre cas, la màquina virtual provarà de fer servir el conducte existent.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Crea un conducte</translation>
+        <translation type="obsolete">&Crea un conducte</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5868,11 +6376,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Mostra el camí al conducte del port en sèrie a l'amfitrió quan el port treballa en el mode <b>Conducte amfitrió</b>, o al dispositiu sèrie de l'amfitrió quan el port treballa en el mode <b>Dispositiu Amfitrió</b>.</translation>
+        <translation type="obsolete">Mostra el camí al conducte del port en sèrie a l'amfitrió quan el port treballa en el mode <b>Conducte amfitrió</b>, o al dispositiu sèrie de l'amfitrió quan el port treballa en el mode <b>Dispositiu Amfitrió</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Camí al &port/fitxer:</translation>
+        <translation type="obsolete">Camí al &port/fitxer:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5882,6 +6390,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Mostra l'adreça base d'E/S d'este port en sèrie. Valors vàlids són nombres enter amb un rang entre <tt>0</tt> i <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5899,23 +6423,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>No s'ha proveït cap IRQ.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>No s'ha proveït cap port d'E/S.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Dos o més ports tenen els mateixos paràmetres.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>No s'ha proveït cap camí de port.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>S'han proveït dos camins de ports duplicats.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6010,15 +6534,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Afig&nbsp;dispositiu&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Afig&nbsp;dispositiu&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Afig&nbsp;disquetera</nobr></translation>
+        <translation type="obsolete"><nobr>Afig&nbsp;disquetera</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>No hi ha cap disc dur seleccionat per a <i>%1</i>.</translation>
+        <translation type="unfinished">No hi ha cap disc dur seleccionat per a <i>%1</i>.</translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -6058,11 +6582,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Afig dispositiu CD/DVD</translation>
+        <translation type="obsolete">Afig dispositiu CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Afig disquetera</translation>
+        <translation type="obsolete">Afig disquetera</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6250,15 +6774,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&Dispositiu CD/DVD:</translation>
+        <translation type="obsolete">&Dispositiu CD/DVD:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Seleccioneu un disc CD/DVD virtual o una unitat física que s'utilitzarà al dispositiu virtual. La màquina virtual veurà el disc inserit a la unitat amb les dades al fitxer o al disc a la unitat física i els seus continguts.</translation>
+        <translation type="obsolete">Seleccioneu un disc CD/DVD virtual o una unitat física que s'utilitzarà al dispositiu virtual. La màquina virtual veurà el disc inserit a la unitat amb les dades al fitxer o al disc a la unitat física i els seus continguts.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Configura la unitat de CD/DVD virtual</translation>
+        <translation type="obsolete">Configura la unitat de CD/DVD virtual</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6282,7 +6806,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Selecciona un fitxer de CD/DVD virtual...</translation>
+        <translation type="obsolete">Selecciona un fitxer de CD/DVD virtual...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6352,19 +6876,67 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>No s'ha especificat cap nom per al controlador de la posició <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>El controlador de la posició <b>%1</b> fa servir el nom que ja fa servir el controlador de la posició <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> fa servir el disc dur que es troba connectat a <i>%2</i>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>La màquina té assignats més controladors d'emmagatzematge del que els xips %1 són compatibles. Canvieu el tipus de xip a la pàgina de paràmetres del sistema o reduïu el nombre dels controladors següents d'emmagatzematge a la pàgina de paràmetres d'emmagatzematge: %2</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Seleccioneu un fitxer de disc òptic virtual...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6588,47 +7160,55 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>Dispositiu del &punter:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Determina si el dispositiu del cursor és un ratolí PS/2 estàndard, una tauleta USB o una tauleta multitàctil USB.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>Més de <b>%1%</b> de la memòria (<b>%2</b>) de l'ordinador amfitrió està assignada a la màquina virtual. No s'ha deixat suficient memòria per al sistema operatiu amfitrió. Seleccioneu una quantitat inferior.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>Més de <b>%1%</b> de la memòria (<b>%2</b>) de l'ordinador amfitrió està assignada a la màquina virtual. Això podria no deixar suficient memòria per al sistema operatiu amfitrió. Considereu seleccionar una quantitat inferior.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>La característica E/S APIC no està habilitada a la secció placa mare de la pàgina Sistema. Això és necessari per la compatibilitat amb un xip del tipus ICH9. Es farà automàticament si confirmeu els canvis.</translation>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>L'emulació del controlador USB no s'ha habilitat al a pàgina USB. Això és necessari per la compatibilitat amb un dispositiu d'entrada USB. Es farà automàticament si confirmeu els canvis.</translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>Per raons de rendiment, el nombre dels processadors virtuals connectats a la màquina virtual no pot ser més del doble del nombre de processadors físics de l'amfitrió (<b>%1</b>). Reduïu el nombre de processadors virtuals.</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>Hi ha més processadors virtuals connectats a la màquina virtual que el nombre de processadors físics de l'amfitrió (<b>%1</b>). Això pot afectar al rendiment de la màquina virtual. Considereu reduir-ne el nombre de processadors virtuals.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La característica E/S APIC no està habilitada a la secció placa mare de la pàgina Sistema. Això és necessari per la compatibilitat amb un processador virtual. Es farà automàticament si confirmeu els canvis.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La virtualització de maquinari no està habilitada a la secció Acceleració de la pàgina Sistema. Això és necessari per la compatibilitat amb més d'un processador virtual. Es farà automàticament si confirmeu els canvis.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>El cap d'execució del processador està establer a un valor baix. Això pot fer paréixer que la màquina va lenta. </translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6700,7 +7280,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Habilita el controlador USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">Habilita el controlador USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6763,8 +7343,28 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">L'USB 2.0 es troba activat per a esta màquina virtual. Tot i així, això requereix la instal·lació de <b>%1</b>. Instal·leu el paquet d'extensions des del lloc web de baixades del VirtualBox. Una vegada fet això, haureu de tornar a activar l'USB 2.0. Mentrestant es desactivarà a no ser que cancel·leu els canvis dels paràmetres actuals.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>L'USB 2.0 es troba activat per a esta màquina virtual. Tot i així, això requereix la instal·lació de <b>%1</b>. Instal·leu el paquet d'extensions des del lloc web de baixades del VirtualBox o desactiveu la compabilitat USB 2.0 per iniciar la màquina.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6903,9 +7503,13 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Tanca</translation>
+        <translation type="obsolete">&Tanca</translation>
     </message>
-</context>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
 <context>
     <name>UIMediumTypeChangeDialog</name>
     <message>
@@ -6922,6 +7526,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Tanca</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Canvia</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>Callee: </source>
@@ -7133,8 +7760,8 @@ p, li { white-space: pre-wrap; }
         <translation><nobr>Avís</nobr></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>S'ha produït un error crític mentre s'executava la màquina virtual, que s'ha aturat.</p><p>Per obtindre ajuda, visiteu la secció Community a  <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o al vostre contracte de suport. Afegiu el contingut del fitxer de registre <tt>VBox.log</tt> i el fitxer d'imatge <tt>VBox.png</tt>,que podreu trobar al directori <no [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>S'ha produït un error crític mentre s'executava la màquina virtual, que s'ha aturat.</p><p>Per obtindre ajuda, visiteu la secció Community a  <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> o al vostre contracte de suport. Afegiu el contingut del fitxer de registre <tt>VBox.log</tt> i el fitxer d'imatge <tt>VBox.png</tt>,que podreu trobar al directori <nobr [...]
     </message>
     <message>
         <source><p>A fatal error has occurred during virtual machine execution! The virtual machine will be powered off. Please copy the following error message using the clipboard to help diagnose the problem:</p></source>
@@ -7198,7 +7825,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>No s'ha pogut crear l'objecte VirtualBox COM.</p><p>Ara es tancarà l'aplicació.</p></translation>
+        <translation type="obsolete"><p>No s'ha pogut crear l'objecte VirtualBox COM.</p><p>Ara es tancarà l'aplicació.</p></translation>
     </message>
     <message>
         <source><p>Failed to download the VirtualBox Guest Additions disk image file from <nobr><a href="%1">%2</a>.</nobr></p><p>%3</p></source>
@@ -7265,15 +7892,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>La màquina virtual passarà ara al mode <b>fluid</b>. Podeu tornar arrere al mode finestra prement <b>%1</b>. Tingueu en compte que la <i>tecla d'amfitrió</i> està definida actualment com <b>%2</b>.</p><p>La barra de menú estarà amagada al mode fluid. Podreu accedir a ella prement <b>tecla d'amfitrió+Home</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>El programa VirtualBox Guest Additions instal·lat al sistema client no és a la darrera versió: la versió instal·lada és %1 i la més nova és la %2. Algunes característiques que requereixen les Guest Additions (integració del punter, la funció de mida automàtica de l'escriptori) poden no treballar correctament.</p><p>Es recomana actualitzar la versió de Guest Additions a la versió actual triant <b>Instal·la les Guest Addi [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>El programa VirtualBox Guest Additions instal·lat al sistema client està antiquat: la versió instal·lada és %1 i la més nova és la %2. Algunes característiques que requereixen les Guest Additions (integració del punter, la funció de mida automàtica de l'escriptori) poden no treballar correctament.</p><p>Es recomana actualitzar la versió de Guest Additions a la versió actual triant <b>Instal·la les Guest Additions</b& [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><b>El programa VirtualBox Guest Additions instal·lat al sistema client és més recent que la versió suportada: la versió instal·lada és %1 i la més nova és la %2. No es pot fer servir una versió més nova de les Guest Additions amb una versió més antiga del VirtualBox.</p><p>Es recomana instal·lar la versió de Guest Additions a la versió actual triant <b>Instal·lar Guest Additions</b> des del menú <b>Dispositius</b [...]
     </message>
     <message>
@@ -7396,9 +8023,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Baixa</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Munta</translation>
+        <translation type="obsolete">Munta</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7570,8 +8197,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Mostra un diàleg amb la informació del producte</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><b>S'ha publicat una nova versió del VirtualBox! La versió <b>%1</b> és disponible a <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Podeu baixar-la directament des d'este enllaç: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><b>S'ha publicat una nova versió del VirtualBox! La versió <b>%1</b> és disponible a <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Podeu baixar-la directament des d'este enllaç: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7741,7 +8368,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>No es pot accedir a un o més dels discos, CD/DVD o disquet virtuals. Com a resultat, no podreu operar amb les màquines virtuals que els facen servir fins que estiguen accessibles.</p><p>Premeu <b>Comprova</b> per obrir el gestor de discos virtuals i veure a quins suports no s'hi pot accedir, o premeu <b>Ignora</b> per ignorar este missatge.</p></translation>
+        <translation type="obsolete"><p>No es pot accedir a un o més dels discos, CD/DVD o disquet virtuals. Com a resultat, no podreu operar amb les màquines virtuals que els facen servir fins que estiguen accessibles.</p><p>Premeu <b>Comprova</b> per obrir el gestor de discos virtuals i veure a quins suports no s'hi pot accedir, o premeu <b>Ignora</b> per ignorar este missatge.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files will be automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if you want to terminate the VirtualBox application without any further actions.</p></source>
@@ -7779,8 +8406,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Sob&reescriu</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>S'ha produït un error crític mentre s'executava la màquina virtual, que s'ha aturat.</p><p>Per obtindre ajuda, visiteu la secció Community a  <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o al vostre contracte de suport. Afegiu el contingut del fitxer de registre <tt>VBox.log</tt> i el fitxer d'imatge <tt>VBox.png</tt>,que podreu trobar al directori <nobr><b>% [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>S'ha produït un error crític mentre s'executava la màquina virtual, que s'ha aturat.</p><p>Per obtindre ajuda, visiteu la secció Community a  <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> o al vostre contracte de suport. Afegiu el contingut del fitxer de registre <tt>VBox.log</tt> i el fitxer d'imatge <tt>VBox.png</tt>,que podreu trobar al directori <nobr [...]
     </message>
     <message>
         <source>Failed to open appliance.</source>
@@ -7986,7 +8613,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Segur que voleu eliminar el dispositiu de CD/DVD?</p><p>No podreu muntar cap CD o imatges iso ni tampoc instal·lar les Guest Additions sense ell.</p></translation>
+        <translation type="obsolete"><p>Segur que voleu eliminar el dispositiu de CD/DVD?</p><p>No podreu muntar cap CD o imatges iso ni tampoc instal·lar les Guest Additions sense ell.</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -8089,7 +8716,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Ara afegireu un CD/DVD al controlador <b>%1</b>.</p><p>Voleu seleccionar un disc CD/DVD virtual per posar-lo a la unitat o voleu deixar-lo buit per ara?</p></translation>
+        <translation type="obsolete"><p>Ara afegireu un CD/DVD al controlador <b>%1</b>.</p><p>Voleu seleccionar un disc CD/DVD virtual per posar-lo a la unitat o voleu deixar-lo buit per ara?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -8111,14 +8738,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>No s'ha pogut desconnectar el dispositiu CD/DVD (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
+        <translation type="obsolete">No s'ha pogut desconnectar el dispositiu CD/DVD (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>No s'ha pogut desconnectar el disquet (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
+        <translation type="obsolete">No s'ha pogut desconnectar el disquet (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>Pareix que les Guest Additions del VirtualBox no estan disponibles en esta màquina i les carpetes compartides no es poden fer servir sense elles. Per fer servir carpetes compartides a la màquina virtual, instal·leu les Guest Additions si no es troben instal·lades o torneu a instal·lar-les si no estan funcionant correctament seleccionant <b>Instal·la les Guest Additions</b> al menú <b>Màquina</b>. Si es troben instal·la [...]
     </message>
     <message numerus="yes">
@@ -8167,19 +8794,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>No s'ha pogut connectar el dispositiu CD/DVD (<nobr><b>%1</b></nobr>) a la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
+        <translation type="obsolete">No s'ha pogut connectar el dispositiu CD/DVD (<nobr><b>%1</b></nobr>) a la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>No s'ha pogut connectar el disquet (<nobr><b>%1</b></nobr>) a la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
+        <translation type="obsolete">No s'ha pogut connectar el disquet (<nobr><b>%1</b></nobr>) a la ranura <i>%2</i> de la màquina <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Tingueu en compte que la unitat d'emmagatzematge d'este suport no s'eliminarà i, a més serà possible fer-la servir de nou més tard.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>Pareix que les Guest Additions del VirtualBox no estan disponibles en esta màquina i les carpetes compartides no es poden fer servir sense elles. Per fer servir carpetes compartides a la màquina virtual, instal·leu les Guest Additions si no es troben instal·lades o torneu a instal·lar-les si no estan funcionant correctament seleccionant <b>Instal·la les Guest Additions</b> al menú <b>Màquina</b>. Si es troben instal·lades però la màqu [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Pareix que les Guest Additions del VirtualBox no estan disponibles en esta màquina i les carpetes compartides no es poden fer servir sense elles. Per fer servir carpetes compartides a la màquina virtual, instal·leu les Guest Additions si no es troben instal·lades o torneu a instal·lar-les si no estan funcionant correctament seleccionant <b>Instal·la les Guest Additions</b> al menú <b>Màquina</b>. Si es troben instal·la [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -8422,7 +9049,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>No s'han pogut eliminar les dades.</translation>
+        <translation type="obsolete">No s'han pogut eliminar les dades.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -8482,242 +9109,329 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>No s'ha pogut iniciar el gestor del VirtualBox degut a restriccions locals.</p><p>Es tancarà l'aplicació.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>No s'ha pogut trobar el fitxer de llengua per a la llengua <b>%1</b> al directori <b><nobr>%2</nobr></b>.</p><p>La llengua es reiniciarà temporalment a la llengua per defecte del sistema. Aneu a la finestra de <b>Preferències</b> que podeu obrir des del menú <b>Fitxer</b> de la finestra del gestor del VirtualBox i seleccioneu una de les llengües existents a la pàgina <b>Llengü [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>No s'ha pogut trobar el fitxer de llengua per a la llengua <b><nobr>%1</nobr></b>.</p><p>La llengua es reiniciarà temporalment l'anglés (per defecte). Aneu a la finestra de <b>Preferències</b> que podeu obrir des del menú <b>Fitxer</b> de la finestra del gestor del VirtualBox i seleccioneu una de les llengües existents a la pàgina <b>Llengües</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation>No existeix cap màquina virtual amb este identificador <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation>Ignora</translation>
+        <translation type="unfinished">Ignora</translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation>No s'ha pogut crear la xarxa NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>No s'ha pogut eliminar la xarxa NAT <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation>No s'ha pogut crear el servidor DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>No s'ha pogut crear el servidor DHCP per a la interfície <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>No s'ha pogut crear la interfície de xarxa de l'amfitrió.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>Crea un disc &nou</translation>
+        <translation type="unfinished">Crea un disc &nou</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>&Tria un disc existent</translation>
+        <translation type="unfinished">&Tria un disc existent</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation>Deixa-ho &buit</translation>
+        <translation type="unfinished">Deixa-ho &buit</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>Tria un dis&c</translation>
+        <translation type="unfinished">Tria un dis&c</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Esteu segur que voleu alliberar el disc dur virtual <nobr><b>%1</b></nobr>?</p><p>Això el separarà de les màquines virtuals següents: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Esteu segur que voleu alliberar el disc òptic virtual <nobr><b>%1</b></nobr>?</p><p>Això el separarà de les màquines virtuals següents: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Esteu segur que voleu alliberar el disc floppy virtual <nobr><b>%1</b></nobr>?</p><p>Això el separarà de les màquines virtuals següents: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Segur que voleu eliminar el disc dur virtual <nobr><b>%1</b></nobr> de la llista d'imatges de discos durs coneguts?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation><p>Atès que no es pot accedir a este disc dur, no es pot eliminar el fitxer d'imatge.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Segur que voleu eliminar el disc òptic virtual <nobr><b>%1</b></nobr> de la llista d'imatges de discos coneguts?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Segur que voleu eliminar el disc floppy virtual <nobr><b>%1</b></nobr> de la llista d'imatges de discos coneguts?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>No s'ha pogut inserir el disc òptic virtual <nobr><b>%1</b></nobr> a la màquina <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation><p>Voleu provar a forçar la inserció d'este disc?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>No s'ha pogut expulsar el disc òptic virtual <nobr><b>%1</b></nobr> a la màquina <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation><p>Voleu provar a forçar l'expulsió d'este disc?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>No s'ha pogut inserir el disc floppy virtual <nobr><b>%1</b></nobr> a la màquina <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>No s'ha pogut expulsar el disc floppy virtual <nobr><b>%1</b></nobr> a la màquina <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>No s'ha pogut obrir el fitxer de disc dur <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>No s'ha pogut obrir el fitxer de disc òptic <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>No s'ha pogut obrir el fitxer de disc floppy <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>No s'ha pogut tancar el fitxer de disc dur <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>No s'ha pogut tancar el fitxer de disc òptic <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>No s'ha pogut tancar el fitxer de disc floppy <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation>
-            <numerusform><p>La màquina virtual %n es troba en un estat alçat <b>%1</b></p><p>Si continueu, es descartarà l'estat en temps d'execució de la màquina virtual exportada. Tingueu en compte que la màquina existent no canviarà.</p></numerusform>
-            <numerusform><p>Les %n màquines virtuals es troben en un estat alçat <b>%1</b></p><p>Si continueu, es descartarà l'estat en temps d'execució de les màquines virtuals exportades. Tingueu en compte que les màquines existent no canviaran.</p></numerusform>
-            <numerusform><p>Les %n màquines virtuals es troben en un estat alçat <b>%1</b></p><p>Si continueu, es descartarà l'estat en temps d'execució de les màquines virtuals exportades. Tingueu en compte que les màquines existent no canviaran.</p></numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source>Switch</source>
-        <translation>Canvia</translation>
+        <translation type="unfinished">Canvia</translation>
     </message>
     <message>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>No s'ha pogut activar el servidor d'escriptori remot per a esta màquina virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>No s'ha pogut desactivar el servidor d'escriptori remot per a esta màquina virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>No s'ha pogut activar la captura de vídeo per a esta màquina virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>No s'ha pogut desactivar la captura de vídeo per a esta màquina virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>No s'ha pogut trobar el fitxer d'imatge de les VirtualBox Guest Additions.</nobr></p><p>Voleu baixar la imatge de cd des de la xarxa?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Download</source>
-        <translation>Baixa</translation>
+        <translation type="unfinished">Baixa</translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Segur que voleu baixar la imatge del VirtualBox Guest Additions des de  <nobr><a href="%1">%1</a></nobr> (mida %2 bytes)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%1</a></nobr> però no s'ha pogut alçar localment com a <nobr><b>%2</b>.</nobr></p><p>Trieu una altra ubicació per al fitxer.</p> {1"?} {1<?} {2<?}</translation>
-    </message>
-    <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>S'ha baixat la imatge del VirtualBox Guest Additions des de <nobr><a href="%1">%1</a></nobr> i s'ha alçat localment com a <nobr><b>%2</b>.</nobr></p><p>Voleu registrar esta imatge de CD i montar-la a la unitat virtual de CD/DVD?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>No es pot inserir la imatge del cd instal·lador de les Guest Additions a la màquina virtual <b>%1</b> si la màquina no té dispositius CD/DVD. Afegiu un dispositiu fent servir la pestanya de discos durs als paràmetres de la màquina.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation><p>No s'ha pogut trobar el manual d'usuari del VirtualBox <nobr><b>%1</b>.</nobr></p><p>Voleu baixar este fitxer des d'Internet?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Segur que voleu baixar el manual d'usuari del VirtualBox des de <nobr><a href="%1">%1</a></nobr> (mida %2 bytes)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%1</a></nobr> però no s'ha pogut alçar localment com a <nobr><b>%2</b>.</nobr></p><p>Trieu una altra ubicació per al fitxer.</p> {1"?} {1<?} {2<?}</translation>
+        <translation type="unfinished"><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%2</a></nobr> però no s'ha pogut alçar localment com a <nobr><b>%3</b>.</nobr></p><p>Trieu una altra ubicació per al fitxer.</p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%1</a></nobr> i s'ha alçat localment com a <nobr><b>%2</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
+        <translation type="unfinished"><p>S'ha baixat el manual d'usuari del VirtualBox des de <nobr><a href="%1">%2</a></nobr> i s'ha alçat localment com a <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source>Close</source>
-        <translation>Tanca</translation>
+        <translation type="unfinished">Tanca</translation>
     </message>
     <message>
         <source>Ok</source>
-        <translation>D'acord</translation>
+        <translation type="unfinished">D'acord</translation>
     </message>
     <message>
         <source>Do not show this message again</source>
-        <translation>No tornes a mostrar este missatge</translation>
+        <translation type="unfinished">No tornes a mostrar este missatge</translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>Voleu eliminar la xarxa NAT <nobr><b>%1</b>?</nobr></p><p>Si esta xarxa està en ús per un o més adaptadors de màquines virtuals, estos adaptadors ja no es podran utilitzar fins que corregiu els paràmetres triant un nom de xarxa diferent o un tipus d'adaptador diferent.</p></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>Pareix que les Guest Additions del VirtualBox no estan disponibles en esta màquina i les carpetes compartides no es poden fer servir sense elles. Per fer servir carpetes compartides a la màquina virtual, instal·leu les Guest Additions si no es troben instal·lades o torneu a instal·lar-les si no estan funcionant correctament seleccionant <b>Instal·la les Guest Additions</b> al menú <b>Màquina</b>. Si es troben instal·la [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Munta</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>No s'ha pogut afegir la càmera web <b>%1</b> a la màquina virtual <b>%2</b>.</translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>No s'ha pogut desconnectar la càmera web <b>%1</b> a la màquina virtual <b>%2</b>.</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>La pantalla virtual utilitza actualment el mode de color <b>%1&nbsp;bit</b>. Per obtindre un millor rendiment, canvieu això a <b>%2&nbsp;bit</b>. Això es pot fer des de la secció <b>Pantalla</b> del tauler de control del sistema operatiu client o des dels paràmetres del sistema.</p></translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8769,19 +9483,19 @@ p, li { white-space: pre-wrap; }
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation>Mostra sempre la barra d'eines</translation>
+        <translation type="unfinished">Mostra sempre la barra d'eines</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation>Minimitza la finestra</translation>
+        <translation type="unfinished">Minimitza la finestra</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Ix del mode de pantalla completa o del mode fluid</translation>
+        <translation type="unfinished">Ix del mode de pantalla completa o del mode fluid</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation>Tanca la màquina virtual</translation>
+        <translation type="unfinished">Tanca la màquina virtual</translation>
     </message>
 </context>
 <context>
@@ -8798,7 +9512,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Nom:</translation>
     </message>
     <message>
@@ -8858,7 +9572,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation>Ha fallat la operació de xarxa i s'ha proveït l'error següent: %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8885,27 +9599,27 @@ p, li { white-space: pre-wrap; }
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation>No s'ha trobat l'amfitrió</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation>S'ha denegat l'accés al contingut</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation>S'ha produït un error de protocol</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>El format del certificat SSL és erroni</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>Ha fallat l'autenticació SSL</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>Es desconeix la raó</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9804,7 +10518,7 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>Feu clic per mostrar els detalls complets</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9938,14 +10652,18 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
         <translation>Fitxers de màquina virtual (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Benvingut a VirtualBox!</h3><p>A la part esquerra d'esta finestra es mostra un llistat de totes les màquines virtuals a l'ordinador. Este llistat és buit actualment perquè encara no heu creat cap màquina virtual.<img src=:/welcome.png align=right/></p><p>Per crear una nova màquina virtual, premeu sobre el botó <b>Nova</b> a la barra principal que es troba a la part de dalt d'esta finestra.</p>&l [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Benvingut a VirtualBox!</h3><p>A la part esquerra d'esta finestra es mostra un llistat de totes les màquines virtuals a l'ordinador. Este llistat és buit actualment perquè encara no heu creat cap màquina virtual.<img src=:/welcome.png align=right/></p><p>Per crear una nova màquina virtual, premeu sobre el botó <b>Nova</b> a la barra principal que es troba a la part de dalt d'esta fines [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Gestor</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9978,15 +10696,15 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
     </message>
     <message>
         <source>Settings</source>
-        <translation>Paràmetres</translation>
+        <translation type="obsolete">Paràmetres</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation><b>%1</b> pàgina:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation><b>%1: %2</b> pàgina:</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10031,6 +10749,10 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
         <source>Display</source>
         <translation>Pantalla</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -10106,6 +10828,43 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">actualment esteu fent servir més controlador d'emmagatzematge que els xips %1 suporten. Canvieu el tipus de xip a la pàgina de paràmetres del sistema o reduïu el nombre dels següents controladors d'emmagatzematge a la pàgina de paràmetres d'emmagatzematge: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Paràmetres</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Tanca</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -10193,109 +10952,336 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
         <translation type="obsolete">Tan&ca</translation>
     </message>
     <message>
-        <source>VirtualBox Update Wizard</source>
-        <translation type="obsolete">Auxiliar d'acutliatzació del VirtualBox</translation>
+        <source>VirtualBox Update Wizard</source>
+        <translation type="obsolete">Auxiliar d'acutliatzació del VirtualBox</translation>
+    </message>
+    <message>
+        <source>Check for Updates</source>
+        <translation type="obsolete">Comprova si hi ha actualitzacions</translation>
+    </message>
+    <message>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p>
+<p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p>
+<p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Este assistent connectarà amb el lloc web del VirtualBox i comprovarà si hi ha una versió més nova de VirtualBox.</p>
+<p>Feu servir el botó <b>Comprova</b> per comprovar ara si hi ha noves versions o <b>Cancel·la</b> si no voleu comprovar ara si hi ha noves versions.</p>
+<p>Podeu iniciar este assistent en qualsevol moment seleccionant <b>Comprova si hi ha actualitzacions...</b> al menú d'<b>Ajuda</b>.</p></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Cancel·la</translation>
+    </message>
+    <message>
+        <source>Summary</source>
+        <translation type="obsolete">Resum</translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><b>S'ha publicat una nova versió del VirtualBox! La versió <b>%1</b> és disponible a <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Podeu baixar-la directament des d'este enllaç: </p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
+        <translation type="obsolete"><p>No es pot obtindre informació de noves versions degut a un problema amb la xarxa:</p><p><b>%1</b></p></translation>
+    </message>
+    <message>
+        <source>You are already running the most recent version of VirtualBox.</source>
+        <translation type="obsolete">Ja teniu instal·lada la darrera versió del VirtualBox. Proveu novament més tard.</translation>
+    </message>
+    <message>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Este auxiliar connectarà amb el lloc web del VirtualBox i comprovarà si hi ha una versió més nova del VirtualBox.<p></p>Feu servir el botó <b>Comprova</b> per comprovar ara si hi ha noves versions o <b>Cancel·la</b> si no voleu comprovar ara si hi ha noves versions. Podeu iniciar este auxiliar en qualsevol moment seleccionant <b>Comprova si hi ha actualitzacions...</b> al menú d'<b>Aj [...]
+    </message>
+</context>
+<context>
+    <name>UIUpdateStepVirtualBox</name>
+    <message>
+        <source>Checking for a new VirtualBox version...</source>
+        <translation>S'està comprovant si hi ha una versió nova del VirtualBox...</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMCloseDialog</name>
+    <message>
+        <source>Close Virtual Machine</source>
+        <translation>Tanca la màquina virtual</translation>
+    </message>
+    <message>
+        <source>You want to:</source>
+        <translation>Voleu:</translation>
+    </message>
+    <message>
+        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
+        <translation><p>Alça l'estat d'execució actual de la màquina virtual al disc dur físic de l'ordinador amfitrió.</p><p>La propera vegada que s'iniciÏ esta màquina, es restaurarà des de l'estat alçat i continuarà l'execució des del mateix lloc en què l'heu alçat, cosa que permetrà continuar immediatament amb el vostre treball.</p><p>Tingueu en compte que l'operació d'alçar l'estat de la màquina pot pren [...]
+    </message>
+    <message>
+        <source>&Save the machine state</source>
+        <translation>&Alça l'estat de la màquina</translation>
+    </message>
+    <message>
+        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
+        <translation><p>Envia a la màquina virtual l'esdeveniment de prémer el botó ACPI Power.</p><p>Normalment, el sistema operatiu client que s'està executant a dins de la màquina virtual detectarà este esdeveniment i realitzarà un procediment de tancament net. Esta és una manera recomanada de tancar la màquina virtual perquè totes les aplicacions que s'estan executant en ella tindran la possibilitat d'alçar les seues dades i estat.</p><p [...]
+    </message>
+    <message>
+        <source>S&end the shutdown signal</source>
+        <translation>&Envia el senyal d'aturada</translation>
+    </message>
+    <message>
+        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
+        <translation><p>Atura la màquina virtual.</p><p>Tingueu en compte que esta acció aturarà immediatament l'execució de la màquina de manera que el sistema operatiu client que s'hi està executant no podrà realitzar un procediment de tancament net, cosa que podria ocasionar una <i>pèrdua de dades</i> a la màquina virtual. Només es recomana seleccionar esta acció si la màquina virtual no respon a l'acció <b>Envia el senyal d'atur [...]
+    </message>
+    <message>
+        <source>&Power off the machine</source>
+        <translation>&Atura la màquina</translation>
+    </message>
+    <message>
+        <source>Restore the machine state stored in the current snapshot</source>
+        <translation>Restaura l'estat de la màquina emmagatzemat a la captura actual</translation>
+    </message>
+    <message>
+        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
+        <translation><p>Quan estiga marcat, es restaurarà l'estat de la màquina des de l'estat emmagatzemat a la captura actual quan es va aturar. Això és útil si esteu segur que voleu descartar els resultats de les últimes sessions i tornar a la captura actual.</p></translation>
+    </message>
+    <message>
+        <source>&Restore current snapshot '%1'</source>
+        <translation>&Restaura la captura actual '%1'</translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
+    <message>
+        <source>&Details</source>
+        <translation>&Detalls</translation>
+    </message>
+    <message>
+        <source>&Snapshots</source>
+        <translation>&Captures</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Diàleg Informatiu de la Sessió</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">Tan&ca</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informació de la sessió</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Detalls</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Temps d'execució</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transferències DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transferències PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Lectura de dades</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Escriptura de dades</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Transmissió de dades</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Recepció de dades</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Activat</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Desactivat</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Atributs del temps d'execució</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Resolució de pantalla</translation>
+    </message>
+    <message>
+        <source>Hardware Virtualization</source>
+        <translation type="obsolete">Virtualització per Maquinari</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Estadístiques CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Estadístiques de l'adaptador de xarxa</translation>
+    </message>
+    <message>
+        <source>Adapter 1</source>
+        <translation type="obsolete">Adaptador 1</translation>
+    </message>
+    <message>
+        <source>Adapter 2</source>
+        <translation type="obsolete">Adaptador 2</translation>
+    </message>
+    <message>
+        <source>Adapter 3</source>
+        <translation type="obsolete">Adaptador 3</translation>
+    </message>
+    <message>
+        <source>Adapter 4</source>
+        <translation type="obsolete">Adaptador 4</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">No connectat</translation>
+    </message>
+    <message>
+        <source>Hard Disks Statistics</source>
+        <translation type="obsolete">Estadístiques dels discos durs</translation>
+    </message>
+    <message>
+        <source>Primary Master</source>
+        <translation type="obsolete">Primari Mestre</translation>
+    </message>
+    <message>
+        <source>Primary Slave</source>
+        <translation type="obsolete">Primari Esclau</translation>
+    </message>
+    <message>
+        <source>Secondary Master</source>
+        <translation type="obsolete">Secundari Mestre</translation>
+    </message>
+    <message>
+        <source>Secondary Slave</source>
+        <translation type="obsolete">Secundari Esclau</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Versió %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>No detectat</translation>
     </message>
     <message>
-        <source>Check for Updates</source>
-        <translation type="obsolete">Comprova si hi ha actualitzacions</translation>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>No detectat</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p>
-<p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p>
-<p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Este assistent connectarà amb el lloc web del VirtualBox i comprovarà si hi ha una versió més nova de VirtualBox.</p>
-<p>Feu servir el botó <b>Comprova</b> per comprovar ara si hi ha noves versions o <b>Cancel·la</b> si no voleu comprovar ara si hi ha noves versions.</p>
-<p>Podeu iniciar este assistent en qualsevol moment seleccionant <b>Comprova si hi ha actualitzacions...</b> al menú d'<b>Ajuda</b>.</p></translation>
+        <source>Guest Additions</source>
+        <translation>Guest Additions</translation>
     </message>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">Cancel·la</translation>
+        <source>Guest OS Type</source>
+        <translation>Tipus de sistema client</translation>
     </message>
     <message>
-        <source>Summary</source>
-        <translation type="obsolete">Resum</translation>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Estadístiques de discos durs</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><b>S'ha publicat una nova versió del VirtualBox! La versió <b>%1</b> és disponible a <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Podeu baixar-la directament des d'este enllaç: </p><p><a href=%2>%3</a></p></translation>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">No hi ha cap disc dur</translation>
     </message>
     <message>
-        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>No es pot obtindre informació de noves versions degut a un problema amb la xarxa:</p><p><b>%1</b></p></translation>
+        <source>No Network Adapters</source>
+        <translation>No hi ha cap adaptador de xarxa</translation>
     </message>
     <message>
-        <source>You are already running the most recent version of VirtualBox.</source>
-        <translation type="obsolete">Ja teniu instal·lada la darrera versió del VirtualBox. Proveu novament més tard.</translation>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Activat</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Este auxiliar connectarà amb el lloc web del VirtualBox i comprovarà si hi ha una versió més nova del VirtualBox.<p></p>Feu servir el botó <b>Comprova</b> per comprovar ara si hi ha noves versions o <b>Cancel·la</b> si no voleu comprovar ara si hi ha noves versions. Podeu iniciar este auxiliar en qualsevol moment seleccionant <b>Comprova si hi ha actualitzacions...</b> al menú d'<b>Aj [...]
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Desactivat</translation>
     </message>
-</context>
-<context>
-    <name>UIUpdateStepVirtualBox</name>
     <message>
-        <source>Checking for a new VirtualBox version...</source>
-        <translation>S'està comprovant si hi ha una versió nova del VirtualBox...</translation>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Paginació imbricada</translation>
     </message>
-</context>
-<context>
-    <name>UIVMCloseDialog</name>
     <message>
-        <source>Close Virtual Machine</source>
-        <translation>Tanca la màquina virtual</translation>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
     </message>
     <message>
-        <source>You want to:</source>
-        <translation>Voleu:</translation>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">No disponible</translation>
     </message>
     <message>
-        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation><p>Alça l'estat d'execució actual de la màquina virtual al disc dur físic de l'ordinador amfitrió.</p><p>La propera vegada que s'iniciÏ esta màquina, es restaurarà des de l'estat alçat i continuarà l'execució des del mateix lloc en què l'heu alçat, cosa que permetrà continuar immediatament amb el vostre treball.</p><p>Tingueu en compte que l'operació d'alçar l'estat de la màquina pot pren [...]
+        <source>Storage Statistics</source>
+        <translation>Estadístiques d'emmagatzematge</translation>
     </message>
     <message>
-        <source>&Save the machine state</source>
-        <translation>&Alça l'estat de la màquina</translation>
+        <source>No Storage Devices</source>
+        <translation>No hi ha cap dispositiu d'emmagatzematge</translation>
     </message>
     <message>
-        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation><p>Envia a la màquina virtual l'esdeveniment de prémer el botó ACPI Power.</p><p>Normalment, el sistema operatiu client que s'està executant a dins de la màquina virtual detectarà este esdeveniment i realitzarà un procediment de tancament net. Esta és una manera recomanada de tancar la màquina virtual perquè totes les aplicacions que s'estan executant en ella tindran la possibilitat d'alçar les seues dades i estat.</p><p [...]
+        <source>Network Statistics</source>
+        <translation>Estadístiques de xarxa</translation>
     </message>
     <message>
-        <source>S&end the shutdown signal</source>
-        <translation>&Envia el senyal d'aturada</translation>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Paginació imbricada</translation>
     </message>
     <message>
-        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation><p>Atura la màquina virtual.</p><p>Tingueu en compte que esta acció aturarà immediatament l'execució de la màquina de manera que el sistema operatiu client que s'hi està executant no podrà realitzar un procediment de tancament net, cosa que podria ocasionar una <i>pèrdua de dades</i> a la màquina virtual. Només es recomana seleccionar esta acció si la màquina virtual no respon a l'acció <b>Envia el senyal d'atur [...]
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>No disponible</translation>
     </message>
     <message>
-        <source>&Power off the machine</source>
-        <translation>&Atura la màquina</translation>
+        <source>Clipboard Mode</source>
+        <translation>Mode de porta-retalls</translation>
     </message>
     <message>
-        <source>Restore the machine state stored in the current snapshot</source>
-        <translation>Restaura l'estat de la màquina emmagatzemat a la captura actual</translation>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Mode d'arrossega i deixa d'anar</translation>
     </message>
     <message>
-        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation><p>Quan estiga marcat, es restaurarà l'estat de la màquina des de l'estat emmagatzemat a la captura actual quan es va aturar. Això és útil si esteu segur que voleu descartar els resultats de les últimes sessions i tornar a la captura actual.</p></translation>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Restore current snapshot '%1'</source>
-        <translation>&Restaura la captura actual '%1'</translation>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <source>&Details</source>
-        <translation>&Detalls</translation>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Snapshots</source>
-        <translation>&Captures</translation>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10449,11 +11435,27 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Amaga la descripció</translation>
+        <translation type="obsolete">Amaga la descripció</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Mostra la descripció</translation>
+        <translation type="obsolete">Mostra la descripció</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10783,39 +11785,39 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
     </message>
     <message>
         <source>Storage settings</source>
-        <translation>Paràmetres d'emmagatzematge</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>Trieu un fitxer on exportar l'aplicació virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>F&ormat:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>Escriu en format estàndard OVF 1.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>Escriu en format experimental OVF 2.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation>&Paràmetres d'emmagatzematge</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10834,14 +11836,14 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Trieu un fitxer on s'ha d'exportar l'aplicació virtual...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Trieu un fitxer on exportar l'aplicació virtual...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10911,15 +11913,15 @@ pas i connectar discos durs més avant, fent servir el diàleg de configuració
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation>Importa l'aplicació virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>Trieu l'aplicació virtual que s'ha d'importar...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>Trieu l'aplicació virtual que s'ha d'importar</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11435,11 +12437,11 @@ Versió %1</translation>
         <translation type="obsolete">Obri el diàleg per operar amb les carpetes compartides</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Instal·la les Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Munta la imatge d'instal·lació de les Guest Additions</translation>
     </message>
     <message>
@@ -11722,7 +12724,7 @@ Versió %1</translation>
         <translation type="obsolete">D&iàleg informatiu de la sessió</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Mostra el diàleg informatiu de la sessió</translation>
     </message>
     <message>
@@ -12198,7 +13200,7 @@ Versió %1</translation>
     </message>
     <message>
         <source>Choose...</source>
-        <translation>Trieu...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12208,8 +13210,8 @@ Versió %1</translation>
         <translation><reinicialitza als valors predeterminats></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>El camí actual per defecte es mostrarà després d'acceptar els canvis i obrir este diàleg novament. </translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">El camí actual per defecte es mostrarà després d'acceptar els canvis i obrir este diàleg novament. </translation>
     </message>
     <message>
         <source><not selected></source>
@@ -12257,8 +13259,7 @@ Versió %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">El camí actual per defecte es mostrarà després d'acceptar els canvis i obrir este diàleg novament. </translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12648,7 +13649,7 @@ Versió %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -13502,17 +14503,17 @@ Versió %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Si connecteu este disc dur es millorarà de forma indirecta fent servir un nou disc dur diferenciat.</translation>
+        <translation type="obsolete">Si connecteu este disc dur es millorarà de forma indirecta fent servir un nou disc dur diferenciat.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Alguns dels suports d'este disc dur no són accessibles. Feu servir el Gestor virtual de suports en el mode <b>Mostra els discos durs diferenciats</b> per inspeccionar estos suports.</translation>
+        <translation type="obsolete">Alguns dels suports d'este disc dur no són accessibles. Feu servir el Gestor virtual de suports en el mode <b>Mostra els discos durs diferenciats</b> per inspeccionar estos suports.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Este disc dur base es connecta indirectament fent servir el disc dur diferenciat següent:</translation>
+        <translation type="obsolete">Este disc dur base es connecta indirectament fent servir el disc dur diferenciat següent:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -13564,7 +14565,7 @@ Versió %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -14124,67 +15125,201 @@ Versió %1</translation>
         <translation>Trieu una ubicació per al fitxer de disc virtual nou</translation>
     </message>
     <message>
-        <source>Enabled</source>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Cap</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Predeterminat</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Actiu</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Actiu</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Activat</translation>
+        <translation type="unfinished">Actiu</translation>
     </message>
     <message>
-        <source>Disabled</source>
+        <source>Inactive</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Desactivat</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <comment>details report</comment>
-        <translation>Execució no restringida</translation>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Ratolí PS/2</translation>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
     </message>
     <message>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Ratolí USB</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Ratolí PS/2 i USB</translation>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <translation>Execució no restringida</translation>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tablet USB</translation>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tablet USB multitàctil</translation>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Xarxa NAT</translation>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>Xarxa NAT, «%1»</translation>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Podeu crear o afegir fitxers d'imatge de disc als paràmetres de la màquina virtual.</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -14450,11 +15585,11 @@ a l'idioma predeterminat del sistema.</qt>
         <translation type="obsolete">Mostra la ruta cap a la carpeta de fitxers VDI predeterminada. S'usa esta carpeta, si no se n'especifica explícitament una altra, quan s'afig o es crea un disc virtual.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicia el camí a la carpeta de màquines virtuals al seu valor predeterminat. Després d'acceptar els canvis i tornar a obrir este diàleg, s'hi mostrarà este camí.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicia el camí a la carpeta de fitxers VDI al seu valor predeterminat. Després d'acceptar els canvis i tornar a obrir este diàleg, s'hi mostrarà este camí.</translation>
     </message>
     <message>
@@ -14498,7 +15633,7 @@ a l'idioma predeterminat del sistema.</qt>
         <translation type="obsolete">Obri un diàleg per seleccionar el fitxer de la biblioteca d'autenticació VRDP .</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicia el fitxer de la biblioteca d'autenticació al seu valor predeterminat. Després d'acceptar els canvis i tornar a obrir este diàleg, s'hi mostrarà este fitxer.</translation>
     </message>
     <message>
@@ -15032,6 +16167,18 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Crea un disc virtual nou</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -15156,8 +16303,8 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <translation type="obsolete">&No feu servir esta informació per contactar amb mi</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let vos know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Ompliu este formulari de registre per fer-nos saber que fas servir el VirtualBox i, opcionalment, per mantindre't informat sobre noves versions i actualitzacions.</p><p>Introduïu als camps següents el vostre nom complet fent servir caràcters llatins i la vostra adreça de correu. Teniu en compte que innotek farà servir esta informació només per recopilar estadístiques d'ús del producte i per informar-vos de novetats. Inno [...]
+        <source><p>Please fill out this registration form to let vos know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Ompliu este formulari de registre per fer-nos saber que fas servir el VirtualBox i, opcionalment, per mantindre't informat sobre noves versions i actualitzacions.</p><p>Introduïu als camps següents el vostre nom complet fent servir caràcters llatins i la vostra adreça de correu. Teniu en compte que innotek farà servir esta informació només per recopilar estadístiques d'ús del producte i per informar-vos de novetats. Inno [...]
     </message>
     <message>
         <source>VirtualBox Registration Dialog</source>
@@ -15172,8 +16319,8 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <translation type="obsolete">No s'ha pogut dur a terme la conformitat de connexió.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let vos know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed  [...]
-        <translation type="obsolete"><p>Ompliu este formulari de registre per deixar-nos conèixer que feu servir el VirtualBox i, opcionalment, per mantindre-vos informat sobre novetats i actualitzacions.</p><p>Introduïu el vostre nom complet fent servir caràcters llatins i la vostra adreça de correu electrònica als camps següents. Tingueu en compte que Sun Microsystems farà servir esta informació només per estadístiques del producte i per enviar-vos notícies sobre el V [...]
+        <source><p>Please fill out this registration form to let vos know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed  [...]
+        <translation type="obsolete"><p>Ompliu este formulari de registre per deixar-nos conèixer que feu servir el VirtualBox i, opcionalment, per mantindre-vos informat sobre novetats i actualitzacions.</p><p>Introduïu el vostre nom complet fent servir caràcters llatins i la vostra adreça de correu electrònica als camps següents. Tingueu en compte que Sun Microsystems farà servir esta informació només per estadístiques del producte i per enviar-vos notícies sobre el V [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -15192,8 +16339,8 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <translation type="obsolete">Seleccioneu un país/territori</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let vos know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we u [...]
-        <translation type="obsolete"><p>Ompliu este formulari de registre per permetre'ns conèixer que feu servir el VirtualBox i, opcionalment, mantindre-vos informat sobre novetats i actualitzacions del VirtualBox.</p><p>Feu servir caràcters llatins per omplir els camps següents. Tingueu en compte que Sun Microsystems farà servir esta informació només per a usos estadístics i per enviar-vos notícies sobre el VirtualBox. Sun Microsystems mai compartirà les vostres [...]
+        <source><p>Please fill out this registration form to let vos know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we u [...]
+        <translation type="obsolete"><p>Ompliu este formulari de registre per permetre'ns conèixer que feu servir el VirtualBox i, opcionalment, mantindre-vos informat sobre novetats i actualitzacions del VirtualBox.</p><p>Feu servir caràcters llatins per omplir els camps següents. Tingueu en compte que Sun Microsystems farà servir esta informació només per a usos estadístics i per enviar-vos notícies sobre el VirtualBox. Sun Microsystems mai compartirà les vostres [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -15538,8 +16685,8 @@ un disc dur per connectar a la ranura remarcada actualment.</a></translati
         <translation type="obsolete">Suspèn l'execució de la màquina virtual</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Benvingut a VirtualBox!</h3><p>A la part esquerra d'esta finestra es mostra un llistat de totes les màquines virtuals a l'ordinador. Este llistat és buit actualment perquè encara no heu creat cap màquina virtual.<img src=:/welcome.png align=right/></p><p>Per crear una nova màquina virtual, premeu sobre el botó <b>Nova</b> a la barra principal que es troba a la part de dalt d'esta fines [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Benvingut a VirtualBox!</h3><p>A la part esquerra d'esta finestra es mostra un llistat de totes les màquines virtuals a l'ordinador. Este llistat és buit actualment perquè encara no heu creat cap màquina virtual.<img src=:/welcome.png align=right/></p><p>Per crear una nova màquina virtual, premeu sobre el botó <b>Nova</b> a la barra principal que es troba a la part de dalt d'esta fines [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -16356,217 +17503,6 @@ o a ambdòs (<i>Qualsevol</i>).</qt></translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Diàleg Informatiu de la Sessió</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">Tan&ca</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Informació de la sessió</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detalls</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Temps d'execució</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transferències DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transferències PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Lectura de dades</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Escriptura de dades</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Transmissió de dades</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Recepció de dades</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Activat</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Desactivat</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Atributs del temps d'execució</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Resolució de pantalla</translation>
-    </message>
-    <message>
-        <source>Hardware Virtualization</source>
-        <translation type="obsolete">Virtualització per Maquinari</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Estadístiques CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Estadístiques de l'adaptador de xarxa</translation>
-    </message>
-    <message>
-        <source>Adapter 1</source>
-        <translation type="obsolete">Adaptador 1</translation>
-    </message>
-    <message>
-        <source>Adapter 2</source>
-        <translation type="obsolete">Adaptador 2</translation>
-    </message>
-    <message>
-        <source>Adapter 3</source>
-        <translation type="obsolete">Adaptador 3</translation>
-    </message>
-    <message>
-        <source>Adapter 4</source>
-        <translation type="obsolete">Adaptador 4</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">No connectat</translation>
-    </message>
-    <message>
-        <source>Hard Disks Statistics</source>
-        <translation type="obsolete">Estadístiques dels discos durs</translation>
-    </message>
-    <message>
-        <source>Primary Master</source>
-        <translation type="obsolete">Primari Mestre</translation>
-    </message>
-    <message>
-        <source>Primary Slave</source>
-        <translation type="obsolete">Primari Esclau</translation>
-    </message>
-    <message>
-        <source>Secondary Master</source>
-        <translation type="obsolete">Secundari Mestre</translation>
-    </message>
-    <message>
-        <source>Secondary Slave</source>
-        <translation type="obsolete">Secundari Esclau</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Versió %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>No detectat</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>No detectat</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Guest Additions</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Tipus de sistema client</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Estadístiques de discos durs</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">No hi ha cap disc dur</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>No hi ha cap adaptador de xarxa</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Activat</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Desactivat</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Paginació imbricada</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">No disponible</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Estadístiques d'emmagatzematge</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>No hi ha cap dispositiu d'emmagatzematge</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Estadístiques de xarxa</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Paginació imbricada</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>No disponible</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Mode de porta-retalls</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Mode d'arrossega i deixa d'anar</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>&Detalls de configuració</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Informació del &temps d'execució</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source>Inaccessible</source>
@@ -16658,7 +17594,7 @@ o a ambdòs (<i>Qualsevol</i>).</qt></translation>
     </message>
     <message>
         <source>Holds the TAP interface name.</source>
-        <translation type="obsolete">Mostra el nom de la interfície TAP.</translation>
+        <translation type="obsolete">Mostra el nom de la intefície TAP.</translation>
     </message>
     <message>
         <source>&Enable Network Adapter</source>
@@ -17449,7 +18385,7 @@ esta característica després d'haver instal·lat un Windows al sistema ope
         <translation type="obsolete">Reinicialitza</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicia la ruta de la carpeta de captures al valor per defecte. La ruta actual per defecte es mostrarà acceptant els canvis i obrint novament este diàleg.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts
index 8465c52..659f44f 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_cs.ts
@@ -300,7 +300,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">&Bezešvý režim</translation>
+        <translation type="unfinished">&Bezešvý režim</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -324,11 +324,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Zákazat integraci &myši</translation>
+        <translation type="obsolete">Zákazat integraci &myši</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Dočasně zakáže integraci hostitelské myši</translation>
+        <translation type="obsolete">Dočasně zakáže integraci hostitelské myši</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -340,11 +340,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Vložit Ctrl-Alt-&Del</translation>
+        <translation type="obsolete">Vložit Ctrl-Alt-&Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Pošle sekvenci Ctrl-Alt-Del virtuálnímu počítači</translation>
+        <translation type="obsolete">Pošle sekvenci Ctrl-Alt-Del virtuálnímu počítači</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -352,7 +352,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Pošle sekvenci Ctrl-Alt-Backspace virtuálnímu počítači</translation>
+        <translation type="obsolete">Pošle sekvenci Ctrl-Alt-Backspace virtuálnímu počítači</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -367,8 +367,8 @@
         <translation type="obsolete">I&nformace o sezení</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Zobrazí dialog s informacemi o sezení</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Zobrazí dialog s informacemi o sezení</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -424,15 +424,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD zařízení</translation>
+        <translation type="obsolete">&CD/DVD zařízení</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Disketové mechaniky</translation>
+        <translation type="obsolete">&Disketové mechaniky</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB zařízení</translation>
+        <translation type="obsolete">&USB zařízení</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -459,12 +459,12 @@
         <translation type="obsolete">Povolí či zakáže připojení vzdálené plochy (RDP) na tento počítač</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">&Instalovat Přídavky pro hosta...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Instalovat Přídavky pro hosta...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Připojí obraz s instalací Přídavků pro hosta</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Připojí obraz s instalací Přídavků pro hosta</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -483,7 +483,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&Logování...</translation>
+        <translation type="obsolete">&Logování...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -512,15 +512,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Přepnout do režimu &celé obrazovky</translation>
+        <translation type="obsolete">Přepnout do režimu &celé obrazovky</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Přepíná mezi klasickým režimem a režimem celé obrazovky</translation>
+        <translation type="obsolete">Přepíná mezi klasickým režimem a režimem celé obrazovky</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Přepnout do &bezešvého režimu</translation>
+        <translation type="obsolete">Přepnout do &bezešvého režimu</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -528,7 +528,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Přepnout do &přizpůsobivého režimu</translation>
+        <translation type="obsolete">Přepnout do &přizpůsobivého režimu</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -739,7 +739,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Vlož&it Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">Vlož&it Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>Sort List</source>
@@ -959,7 +959,7 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Táhni a pusť</translation>
+        <translation type="obsolete">Táhni a pusť</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
@@ -1002,23 +1002,233 @@
         <translation>Vyskakovací nabídka</translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Instalovat Přídavky pro hosta...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Připojí obraz s instalací Přídavků pro hosta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Klávesnice</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Síť</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Zobrazit &záznam...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Soubor</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Zapnout</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
 </context>
 <context>
     <name>UIActonPool</name>
@@ -1028,6 +1238,22 @@
     </message>
 </context>
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIApplianceEditorWidget</name>
     <message>
         <source>Virtual System %1</source>
@@ -1807,6 +2033,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1817,7 +2050,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Zahazuji data...</translation>
+        <translation type="obsolete">Zahazuji data...</translation>
     </message>
 </context>
 <context>
@@ -1929,6 +2162,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2610,7 +2870,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2831,54 +3091,149 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>Rozlišení snímku: %1x%2, počet snímků: %3fps,rychlost snímků: %4kbps</translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Řadič</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Information inaccessible</source>
-        <comment>details</comment>
-        <translation type="obsolete">Informace je nedostupná</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>Information inaccessible</source>
-        <comment>details</comment>
-        <translation type="obsolete">Informace je nedostupná</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Video paměť</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Obrazovky</translation>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>2D Video</source>
-        <comment>details report</comment>
-        <translation type="obsolete">2D Video</translation>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>3D</source>
-        <comment>details report</comment>
-        <translation type="obsolete">3D</translation>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Acceleration</source>
-        <comment>details</comment>
-        <translation type="obsolete">Akcelerace</translation>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Řadič</translation>
+    </message>
+    <message>
+        <source>Information inaccessible</source>
+        <comment>details</comment>
+        <translation type="obsolete">Informace je nedostupná</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>Information inaccessible</source>
+        <comment>details</comment>
+        <translation type="obsolete">Informace je nedostupná</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Video paměť</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Obrazovky</translation>
+    </message>
+    <message>
+        <source>2D Video</source>
+        <comment>details report</comment>
+        <translation type="obsolete">2D Video</translation>
+    </message>
+    <message>
+        <source>3D</source>
+        <comment>details report</comment>
+        <translation type="obsolete">3D</translation>
+    </message>
+    <message>
+        <source>Acceleration</source>
+        <comment>details</comment>
+        <translation type="obsolete">Akcelerace</translation>
     </message>
     <message>
         <source>Remote Desktop Server Port</source>
@@ -3207,7 +3562,7 @@ p, li { white-space: pre-wrap; }
     <name>UIGlobalSettingsGeneral</name>
     <message>
         <source>Holds the path to the default VDI folder. This folder is used, if not explicitly specified otherwise, when adding existing or creating new virtual hard disks.</source>
-        <translation type="obsolete">Zobrazuje cestu k výchozí složce pro VDI. Pokud se neurčí jinak, je tato složka použita v případě přidání existujícího nebo vytvoření nového virtuálního pevného disku.</translation>
+        <translation type="obsolete">Zobrazuje cestu k výchozí složce pro VDI. Pokud se neurčí jinak, je tato složka použita v případě přidání existujícího nebo vytvoření nového virtuálního pevného disku.</translation>
     </message>
     <message>
         <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
@@ -3239,7 +3594,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the default hard disk folder. This folder is used, if not explicitly specified otherwise, when adding existing or creating new virtual hard disks.</source>
-        <translation type="obsolete">Zobrazuje cestu k výchozí složce pro obrazy pevných disků. Pokud se neurčí jinak, je tato složka použita v případě přidání existujícího nebo vytvoření nového virtuálního pevného disku.</translation>
+        <translation type="obsolete">Zobrazuje cestu k výchozí složce pro obrazy pevných disků. Pokud se neurčí jinak, je tato složka použita v případě přidání existujícího nebo vytvoření nového virtuálního pevného disku.</translation>
     </message>
     <message>
         <source>When checked, the application will provide an icon with the context menu in the system tray.</source>
@@ -3263,15 +3618,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation>&Dokování a nástrojová lišta:</translation>
+        <translation type="obsolete">&Dokování a nástrojová lišta:</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation>Automaticky zobrazit v celoobrazovkovém režimu</translation>
+        <translation type="obsolete">Automaticky zobrazit v celoobrazovkovém režimu</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Je-li zatrženo, ikona dokování a nabídka bude automaticky zobrazena v celoobrazovkovém režimu.</translation>
+        <translation type="obsolete">Je-li zatrženo, ikona dokování a nabídka bude automaticky zobrazena v celoobrazovkovém režimu.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
@@ -4362,12 +4717,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indikuje aktivitu CD/DVD zařízení:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indikuje aktivitu CD/DVD zařízení:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indikuje aktivitu disketových mechanik:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indikuje aktivitu disketových mechanik:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4407,7 +4762,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Ovladač USB je zakázán</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Ovladač USB je zakázán</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4475,6 +4830,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation>Status dalších vlastností:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4601,7 +4970,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Video</translation>
+        <translation type="obsolete">&Video</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4789,7 +5158,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>Virtuální počítač je nastaven aby používal grafickou akceleraci je nainstalován operační systém Vindows Vista nebo pozdější. Pro lepší výkon je potřeba virtuálnímu počítači přiřadit minimálně <b>%1</b> video paměti.</translation>
+        <translation type="obsolete">Virtuální počítač je nastaven aby používal grafickou akceleraci je nainstalován operační systém Vindows Vista nebo pozdější. Pro lepší výkon je potřeba virtuálnímu počítači přiřadit minimálně <b>%1</b> video paměti.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -4843,7 +5212,75 @@ p, li { white-space: pre-wrap; }
         <translation>Povolí nahrávání videa pro obrazovku %1.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Mini nástrojová lišta:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Je-li zatrženo, bude se v celoobrazovkovém a bezešvém režimu zobrazovat malá nástrojová lišta.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Zobrazit v &celoobrazovkovém/bezešvém režimu</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Je-li zatrženo, bude se mini nabídková lišta zobrazovat nahoře na obrazovce místo na výchozí pozici dole na obrazovce.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Zobrazit na&hoře na obrazovce</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4870,7 +5307,7 @@ p, li { white-space: pre-wrap; }
         <translation>Zobrazuje cestu, kam jsou ukládány snímky virtuálního počítače. Snímky můžou zabrat velké množství diskového prostoru.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Základ</translation>
     </message>
     <message>
@@ -4922,7 +5359,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Ovládá množství videopaměti poskytnuté virtuálnímu počítači.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Pokročilé</translation>
     </message>
     <message>
@@ -5018,7 +5455,7 @@ p, li { white-space: pre-wrap; }
         <translation>S&ložka pro snímky:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>Pop&is</translation>
     </message>
     <message>
@@ -5031,7 +5468,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Je-li zatrženo, bude jakákoliv změna připojených CD/DVD nebo disket provedená za běhu počítače uložena v souboru nastavení za účelem zachování konfigurace připojených médií mezi starty.</translation>
+        <translation type="obsolete">Je-li zatrženo, bude jakákoliv změna připojených CD/DVD nebo disket provedená za běhu počítače uložena v souboru nastavení za účelem zachování konfigurace připojených médií mezi starty.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5063,38 +5500,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Výjímatelná média:</translation>
+        <translation type="obsolete">Výjímatelná média:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Pamatovat si &změny provedené za běhu</translation>
+        <translation type="obsolete">Pamatovat si &změny provedené za běhu</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Mini nástrojová lišta:</translation>
+        <translation type="obsolete">Mini nástrojová lišta:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Je-li zatrženo, bude se v celoobrazovkovém a bezešvém režimu zobrazovat malá nástrojová lišta.</translation>
+        <translation type="obsolete">Je-li zatrženo, bude se v celoobrazovkovém a bezešvém režimu zobrazovat malá nástrojová lišta.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Zobrazit v &celoobrazovkovém/bezešvém režimu</translation>
+        <translation type="obsolete">Zobrazit v &celoobrazovkovém/bezešvém režimu</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Je-li zatrženo, bude se mini nabídková lišta zobrazovat nahoře na obrazovce místo na výchozí pozici dole na obrazovce.</translation>
+        <translation type="obsolete">Je-li zatrženo, bude se mini nabídková lišta zobrazovat nahoře na obrazovce místo na výchozí pozici dole na obrazovce.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Zobrazit na&hoře na obrazovce</translation>
+        <translation type="obsolete">Zobrazit na&hoře na obrazovce</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">zvolili jste 64bitový OS pro tento virtuální počítač. Protože je nutná podpora hardwarové virtualizace (VT-x/AMD-V), byla tato volba automaticky nastavena.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>&Táhni a pusť:</translation>
     </message>
     <message>
@@ -5109,6 +5546,102 @@ p, li { white-space: pre-wrap; }
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation>Operační systém virtuálního počítače byl nastaven do 64bitového režimu. Ten vyžaduje pro svůj běh podporu hradwarové virtualizace, po odsouhlasení bude atuomaticky povolena.</translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Mini nástrojová lišta:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Je-li zatrženo, bude se v celoobrazovkovém a bezešvém režimu zobrazovat malá nástrojová lišta.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Zobrazit v &celoobrazovkovém/bezešvém režimu</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Je-li zatrženo, bude se mini nabídková lišta zobrazovat nahoře na obrazovce místo na výchozí pozici dole na obrazovce.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Zobrazit na&hoře na obrazovce</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5754,10 +6287,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Je-li zatrženo, sdílená složka bude připojena stále.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5808,11 +6337,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Je-li zatrženo, roura uvedená v políčku <b>Cesta portu</b> bude vytvořena virtuálním počítačem po spuštění. Jinak se virtuální počítač pokusí použít existující rouru.</translation>
+        <translation type="obsolete">Je-li zatrženo, roura uvedená v políčku <b>Cesta portu</b> bude vytvořena virtuálním počítačem po spuštění. Jinak se virtuální počítač pokusí použít existující rouru.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>Vytvořit r&ouru</translation>
+        <translation type="obsolete">Vytvořit r&ouru</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5820,11 +6349,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Zobrazuje cestu k rouře sériového portu na hostitelovi, když port pracuje v režimu <b>Roura hostitele</b>, nebo název sériového zařízení, když port pracuje v režimnu <b>Hostitelovo zařízení</b>.</translation>
+        <translation type="obsolete">Zobrazuje cestu k rouře sériového portu na hostitelovi, když port pracuje v režimu <b>Roura hostitele</b>, nebo název sériového zařízení, když port pracuje v režimnu <b>Hostitelovo zařízení</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Port/Cesta k sou&boru:</translation>
+        <translation type="obsolete">Port/Cesta k sou&boru:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5834,6 +6363,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Zobrazuje základní adresu I/O portu tohoto sériového portu. Platné hodnoty jsou celá čísla v rozsahu od <tt>0</tt> do <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5962,11 +6507,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Přidat&nbsp;CD/DVD&nbsp;zařízení</nobr></translation>
+        <translation type="obsolete"><nobr>Přidat&nbsp;CD/DVD&nbsp;zařízení</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Přidat&nbsp;disketovou&nbsp;mechaniku</nobr></translation>
+        <translation type="obsolete"><nobr>Přidat&nbsp;disketovou&nbsp;mechaniku</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -6010,11 +6555,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Přidat CD/DVD mechaniku</translation>
+        <translation type="obsolete">Přidat CD/DVD mechaniku</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Přidat disketovou mechaniku</translation>
+        <translation type="obsolete">Přidat disketovou mechaniku</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6202,15 +6747,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&CD/DVD zařízení:</translation>
+        <translation type="obsolete">&CD/DVD zařízení:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Výběr virtuálního CD/DVD disku nebo fyzického zařízení pro virtuální počítač. Virtuální počítač uvidí obsah disku vloženého do této fyzické jednotky nebo v tomto souboru jako data a soubory.</translation>
+        <translation type="obsolete">Výběr virtuálního CD/DVD disku nebo fyzického zařízení pro virtuální počítač. Virtuální počítač uvidí obsah disku vloženého do této fyzické jednotky nebo v tomto souboru jako data a soubory.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Nastaví virtuální CD/DVD mechaniku</translation>
+        <translation type="obsolete">Nastaví virtuální CD/DVD mechaniku</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6234,7 +6779,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Vybrat soubor s obrazem virtuálního CD/DVD...</translation>
+        <translation type="obsolete">Vybrat soubor s obrazem virtuálního CD/DVD...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6318,20 +6863,68 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>Používáte nyní více řadičů než čipová sada %1 podporuje. Změňte prosím typ čipové sady na záložce Systém nebo zmenšete následující počet %2 řadičů na záložce Úložiště</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSystem</name>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">přiřadili jste více jak <b>%1%</b> fyzické paměti (<b>%2%</b>) počítače pro virtuální počítač. Pro běh hostujícího operačního systému nezbývá potřebné množství. Zadejte prosím menší hodnotu.</translation>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">přiřadili jste více jak <b>%1%</b> fyzické paměti (<b>%2%</b>) počítače pro virtuální počítač. Pro běh hostujícího operačního systému nemusí zbýt potřebné množství paměti. Pokračujte na vlastní riziko.</translation>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation type="obsolete">z důvodu rychlosti nemůže být počet virtuálních CPU přiřazených virtuálnímu počítači vyšší než dvojnásobek počtu fyzických CPU hostitelského počítače (<b>%1</b>).Zmenšete prosím počet virtuálních CPU.</translation>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Vybrat soubor s virtuálním diskem...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSystem</name>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
+        <translation type="obsolete">přiřadili jste více jak <b>%1%</b> fyzické paměti (<b>%2%</b>) počítače pro virtuální počítač. Pro běh hostujícího operačního systému nezbývá potřebné množství. Zadejte prosím menší hodnotu.</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
+        <translation type="obsolete">přiřadili jste více jak <b>%1%</b> fyzické paměti (<b>%2%</b>) počítače pro virtuální počítač. Pro běh hostujícího operačního systému nemusí zbýt potřebné množství paměti. Pokračujte na vlastní riziko.</translation>
+    </message>
+    <message>
+        <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="obsolete">z důvodu rychlosti nemůže být počet virtuálních CPU přiřazených virtuálnímu počítači vyšší než dvojnásobek počtu fyzických CPU hostitelského počítače (<b>%1</b>).Zmenšete prosím počet virtuálních CPU.</translation>
     </message>
     <message>
         <source>you have assigned more virtual CPUs to the virtual machine than the number of physical CPUs on your host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
@@ -6556,11 +7149,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>Aktuálně není povolena vlastnost I/O APIC na záložce Systém v sekci Základní deska. Ta je nutná pro podporu čipové sady tupy ICH9. Podpora bude po potvrzení změn automaticky povolena.</translation>
+        <translation type="obsolete">Aktuálně není povolena vlastnost I/O APIC na záložce Systém v sekci Základní deska. Ta je nutná pro podporu čipové sady tupy ICH9. Podpora bude po potvrzení změn automaticky povolena.</translation>
     </message>
     <message>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>Aktuálně není povolena emulace USB řadiče. Ta je nutná pro podporu emulovaných USB vstupních zařízení. Podpora bude po potvrzení změn automaticky povolena.</translation>
+        <translation type="obsolete">Aktuálně není povolena emulace USB řadiče. Ta je nutná pro podporu emulovaných USB vstupních zařízení. Podpora bude po potvrzení změn automaticky povolena.</translation>
     </message>
     <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
@@ -6572,16 +7165,40 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Aktuálně není povolena vlastnost I/O APIC na záložce Systém v sekci Základní deska. Ta je nutná pro podporu více virtuálních procesorů. Podpora bude po potvrzení změn automaticky povolena.</translation>
+        <translation type="obsolete">Aktuálně není povolena vlastnost I/O APIC na záložce Systém v sekci Základní deska. Ta je nutná pro podporu více virtuálních procesorů. Podpora bude po potvrzení změn automaticky povolena.</translation>
     </message>
     <message>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Aktuálně není povolena hardwarová virtualizace na záložce Systém v sekci Akcelerace. Ta je nutná pro podporu více virtuálních procesorů. Podpora bude po potvrzení změn automaticky povolena.</translation>
+        <translation type="obsolete">Aktuálně není povolena hardwarová virtualizace na záložce Systém v sekci Akcelerace. Ta je nutná pro podporu více virtuálních procesorů. Podpora bude po potvrzení změn automaticky povolena.</translation>
     </message>
     <message>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation>Nastavili jste omezení procesoru na nízkou hodnotu. To může snížit odezvu virtuálního počítače.</translation>
     </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSB</name>
@@ -6652,7 +7269,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Povolit USB 2.0 (E&HCI) řadič</translation>
+        <translation type="obsolete">Povolit USB 2.0 (E&HCI) řadič</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6712,7 +7329,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>Pro tento virtuální počítač je povolena podpora USB 2.0. Je ale potřeba doinstalovat <b>%1</b>. Prosíme doinstalujte rozšíření z webových stránek aplikace VirtualBox. Po instalaci bude možno použít USB 2.0, která je nyní do změny nastavení zakázána.</translation>
+        <translation type="obsolete">Pro tento virtuální počítač je povolena podpora USB 2.0. Je ale potřeba doinstalovat <b>%1</b>. Prosíme doinstalujte rozšíření z webových stránek aplikace VirtualBox. Po instalaci bude možno použít USB 2.0, která je nyní do změny nastavení zakázána.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6851,7 +7492,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>Za&vřít</translation>
+        <translation type="obsolete">Za&vřít</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6870,6 +7515,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Zavřít</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Přepnout</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6911,7 +7579,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Nepodařilo se vytvořit COM objekt VirtualBoxu.</p><p>Aplikace bude ukončena</p></translation>
+        <translation type="obsolete"><p>Nepodařilo se vytvořit COM objekt VirtualBoxu.</p><p>Aplikace bude ukončena</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -7220,15 +7888,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Nelze načíst jazykový soubor<b><nobr>%1</nobr></b>. <p>Jazyk bude dočasně nastaven na angličtinu (vestavěnou). Přejděte, prosím, do <b>Nastavení</b>, které najdete v menu <b>Soubor</b> hlavního okna VirtualBoxu, a vyberte existující jazyk na stránce <b>Jazyk</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Přídavky pro hosta nainstalované v hostovaném OS jsou příliš staré: nainstalovaná verze je %1, očekávaná verze je %2. Některé funkce vyžadující Přídavky pro hosta (integrace myši, automatickou změnu velikosti hostované obrazovky) pravděpodobně nebudou správně fungovat.</p><p>Prosím aktualizujte Přídavky pro hosta na aktuální verzi výběrem <b>Instalovat Přídavky pro hosta</b> z nabídky <b>Zařízení</b>.</p [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Přídavky pro hosta nainstalované v hostovaném OS jsou zastaralé: nainstalovaná verze je %1, očekávaná verze je %2. Některé funkce vyžadující Přídavky pro hosta (integrace myši, automatická změna velikosti hostované obrazovky) nemusí fungovat jak byste čekali.</p><p>Je doporučována aktualizace Přídavků pro hosta na aktuální verzi  výběrem <b>Instalovat Přídavky pro hosta</b> z nabídky <b>Zařízení</b>.</p& [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Přídavky pro hosta nainstalované v hostovaném OS jsou příliš aktuální: nainstalovaná verze je %1, očekávaná verze je %2. Některé funkce které vyžadují Přídavky pro hosta (integrace myši, automatická změna velikosti hostované obrazovky) pravděpodobně nebudou správně fungovat.</p><p>Prosím aktualizujte Přídavky pro hosta na aktuální verzi výběrem <b>Instalovat Přídavky pro hosta</b> z nabídky <b>Zařízení</b>. [...]
     </message>
     <message>
@@ -7272,8 +7940,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Okno virtuálního počítače je optimalizováno pro použití v <b>%1&nbsp;bitové</b> barevné hloubce, ale barevná kvalita virtuální obrazovky je právě nastavena na <b>%2&nbsp;bitů</b>.</p><p>Prosím otevřete dialog vlastností obrazovky hostovaného OS a vyberte <b>%3&nbsp;bitový</b> barevný režim, pokud je dostupný, pro nejlepší možný výkon virtuálního video subsytému.</p><p>&lt [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>Při běhu virtuálního počítače se vyskytla kritická chyba a provádění počítače bylo zastaveno.</p><p>Pro pomoc se prosím podívejte do sekce Community na <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> nebo na smlouvu o podpoře. Prosím poskytněte obsah log souboru <tt>VBox.log</tt> a obrázek <tt>VBox.png</tt>, který najdete v adresáři <nobr><b>%1</b></nobr&gt [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Při běhu virtuálního počítače se vyskytla kritická chyba a provádění počítače bylo zastaveno.</p><p>Pro pomoc se prosím podívejte do sekce Community na <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> nebo na smlouvu o podpoře. Prosím poskytněte obsah log souboru <tt>VBox.log</tt> a obrázek <tt>VBox.png</tt>, který najdete v adresáři <nobr><b>%1</b></nobr>, [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
@@ -7380,9 +8048,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Stáhnout</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Připojit</translation>
+        <translation type="obsolete">Připojit</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7554,8 +8222,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Zobrazí dialog s informacemi pro produktu</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Byla vydána nová verze aplikace VirtualBox! Na stránce <a href="https://www.virtualbox.org/">virtualbox.org</a> je verze <b>%1</b>.</p><p>Tuto verzi si můžete stáhnout přímo zde: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Byla vydána nová verze aplikace VirtualBox! Na stránce <a href="http://www.virtualbox.org/">virtualbox.org</a> je verze <b>%1</b>.</p><p>Tuto verzi si můžete stáhnout přímo zde: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7724,7 +8392,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Jeden nebo více virtuálních pevných disků, CD/DVD mechanik nebo disket jsou momentálně nedostupné. Nebudete tak moci použít virtuální počítače, které je používají, dokud nebudou opět dostupné.</p><p>Stiskněte <b>Zkontrolovat</b> pro otevření okna Správce virtuálních médií a podívejte se, která média jsou nedostupná, nebo stiskněte <b>Ignorovat</b> a ignorujte tuto zprávu.</p></translation>
+        <translation type="obsolete"><p>Jeden nebo více virtuálních pevných disků, CD/DVD mechanik nebo disket jsou momentálně nedostupné. Nebudete tak moci použít virtuální počítače, které je používají, dokud nebudou opět dostupné.</p><p>Stiskněte <b>Zkontrolovat</b> pro otevření okna Správce virtuálních médií a podívejte se, která média jsou nedostupná, nebo stiskněte <b>Ignorovat</b> a ignorujte tuto zprávu.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files will be automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if you want to terminate the VirtualBox application without any further actions.</p></source>
@@ -7762,8 +8430,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Přepsat</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Při běhu virtuálního počítače se vyskytla kritická chyba a provádění počítače bylo zastaveno.</p><p>Pro pomoc se prosím podívejte do sekce Community na <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> nebo na smlouvu o podpoře. Prosím poskytněte obsah log souboru <tt>VBox.log</tt> a obrázek <tt>VBox.png</tt>, který najdete v adresáři <nobr><b>%1</b></nobr>, společně s po [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Při běhu virtuálního počítače se vyskytla kritická chyba a provádění počítače bylo zastaveno.</p><p>Pro pomoc se prosím podívejte do sekce Community na <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> nebo na smlouvu o podpoře. Prosím poskytněte obsah log souboru <tt>VBox.log</tt> a obrázek <tt>VBox.png</tt>, který najdete v adresáři <nobr><b>%1</b></nobr>, [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7936,7 +8604,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Opravdu chcete smazat CD/DVD zařízení?</p><p>Bez něj nebudete moci připojit žádný CD nebo DVD obraz ani nainstalovat přídavky pro hosta!</p></translation>
+        <translation type="obsolete"><p>Opravdu chcete smazat CD/DVD zařízení?</p><p>Bez něj nebudete moci připojit žádný CD nebo DVD obraz ani nainstalovat přídavky pro hosta!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -8039,7 +8707,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Chystáte se přidat CD/DVD mechaniku k řadiči <b>%1</b>. </p><p>Chcete vybrat virtuální CD/DVD disk a vložit ho do mechaniky nebo nechat mechaniku prázdnou?</p></translation>
+        <translation type="obsolete"><p>Chystáte se přidat CD/DVD mechaniku k řadiči <b>%1</b>. </p><p>Chcete vybrat virtuální CD/DVD disk a vložit ho do mechaniky nebo nechat mechaniku prázdnou?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -8061,11 +8729,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nepodařilo se odpojit CD/DVD zařízení (<nobr><b>%1</b></nobr>) ze slotu zařízení <i>%2</i> počítače <b>%3</b>.</translation>
+        <translation type="obsolete">Nepodařilo se odpojit CD/DVD zařízení (<nobr><b>%1</b></nobr>) ze slotu zařízení <i>%2</i> počítače <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nepodařilo se odpojit disketovou mechaniku (<nobr><b>%1</b></nobr>) ze slotu zařízení <i>%2</i> počítače <b>%3</b>.</translation>
+        <translation type="obsolete">Nepodařilo se odpojit disketovou mechaniku (<nobr><b>%1</b></nobr>) ze slotu zařízení <i>%2</i> počítače <b>%3</b>.</translation>
     </message>
     <message numerus="yes">
         <source><p>The virtual machine(s) <b>%1</b> are currently in a saved state.</p><p>If you continue the runtime state of the exported machine(s) will be discarded. Note that the existing machine(s) are not changed.</p></source>
@@ -8109,19 +8777,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nepodařilo se připojit CD/DVD zařízení (<nobr><b>%1</b></nobr>) ke slotu zařízení <i>%2</i> počítače <b>%3</b>.</translation>
+        <translation type="obsolete">Nepodařilo se připojit CD/DVD zařízení (<nobr><b>%1</b></nobr>) ke slotu zařízení <i>%2</i> počítače <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nepodařilo se připojit disketovou mechaniku (<nobr><b>%1</b></nobr>) ke slotu zařízení <i>%2</i> počítače <b>%3</b>.</translation>
+        <translation type="obsolete">Nepodařilo se připojit disketovou mechaniku (<nobr><b>%1</b></nobr>) ke slotu zařízení <i>%2</i> počítače <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Poznámka: Médium nebude smazáno a proto bude možné jej později opět přidat do seznamu.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation type="unfinished"><p>Pro tento virtuální počítač nejsou dostupné přídavky pro hosta a sdílené složky nelze bez tohoto přídavku použít. Pokud chcete používat sdílené složky, nainstalujte přídavky pro hosta, případně je reinstalujte pokud nepracují správně zvolením položky <b>Instalovat přídavky pro hosta</b> z nabídky <b>Zařízení</b>. Sdílené složky budou přístupné až bude virtuální počítač plně spuštěn.</p></translation>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Pro tento virtuální počítač nejsou dostupné přídavky pro hosta a sdílené složky nelze bez tohoto přídavku použít. Pokud chcete používat sdílené složky, nainstalujte přídavky pro hosta, případně je reinstalujte pokud nepracují správně zvolením položky <b>Instalovat přídavky pro hosta</b> z nabídky <b>Zařízení</b>. Sdílené složky budou přístupné až bude virtuální počítač plně spuštěn.</p></translation>
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -8359,7 +9027,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Selhalo uložení dat.</translation>
+        <translation type="obsolete">Selhalo uložení dat.</translation>
     </message>
     <message>
         <source><p>Failed to initialize COM because the VirtualBox global configuration directory <b><nobr>%1</nobr></b> is not accessible. Please check the permissions of this directory and of its parent directory.</p><p>The application will now terminate.</p></source>
@@ -8625,11 +9293,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>Obraz s <b>Přídavky pro hosta</b> byl úspěšně stažen z <nobr><a href="%1">%1</a></nobr> a uložen lokálně jako <nobr><b>%2</b>.</nobr></p><p>Chcete zaregistrovat tento soubor s obrazem a připojit ho do virtuální CD/DVD mechaniky?</p></translation>
+        <translation type="obsolete"><p>Obraz s <b>Přídavky pro hosta</b> byl úspěšně stažen z <nobr><a href="%1">%1</a></nobr> a uložen lokálně jako <nobr><b>%2</b>.</nobr></p><p>Chcete zaregistrovat tento soubor s obrazem a připojit ho do virtuální CD/DVD mechaniky?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Nepodařilo se připojit soubor s obrazem <b>Přídavků pro hosta</b>aplikace VirtualBox do virtuálního počítače <b>%1</b> protože nemá CD/DVD zařízení. Přidejte prosím zařízení na záložce uložiště ve vlastnostech virtuálního počítače.</p></translation>
+        <translation type="obsolete"><p>Nepodařilo se připojit soubor s obrazem <b>Přídavků pro hosta</b>aplikace VirtualBox do virtuálního počítače <b>%1</b> protože nemá CD/DVD zařízení. Přidejte prosím zařízení na záložce uložiště ve vlastnostech virtuálního počítače.</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
@@ -8664,25 +9332,120 @@ p, li { white-space: pre-wrap; }
         <translation><p>Chce odebrat NAT síť <nobr><b>%1</b>?</nobr></p><p>Pokud je tato síť použita jednou nebo více kartami ve virtuálním počítači, pak nelze tyto karty dále použít a musíte nastavení změnit buď na jiný název sítě nebo na jiný typ síťové karty.</p></translation>
     </message>
     <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>Pro tento virtuální počítač nejsou dostupné přídavky pro hosta a sdílené složky nelze bez tohoto přídavku použít. Pokud chcete používat sdílené složky, nainstalujte přídavky pro hosta, případně je reinstalujte pokud nepracují správně zvolením položky <b>Instalovat přídavky pro hosta</b> z nabídky <b>Zařízení</b>. Sdílené složky budou přístupné až bude virtuální počítač plně spuštěn.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Připojit</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -8775,7 +9538,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Název:</translation>
     </message>
     <message>
@@ -9916,14 +10679,18 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g
         <translation>Soubory virtuálního počítače (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Vítejte ve VirtualBoxu!</h3><p>Levá část tohoto okna je určena pro zobrazení seznamu všech virtuálních počítačů na vašem počítači. Seznam je teď prázdný, protože jste ještě žádný nevytvořili.<img src=:/welcome.png align=right/></p><p>Pro vytvoření nového virtuálního počítače stiskněte tlačítko <b>Nový</b> v horní části hlavního okna.</p><p>Pro okamžitou nápovědu stiskněte klávesu <b>%1</b> ne [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Vítejte ve VirtualBoxu!</h3><p>Levá část tohoto okna je určena pro zobrazení seznamu všech virtuálních počítačů na vašem počítači. Seznam je teď prázdný, protože jste ještě žádný nevytvořili.<img src=:/welcome.png align=right/></p><p>Pro vytvoření nového virtuálního počítače stiskněte tlačítko <b>Nový</b> v horní části hlavního okna.</p><p>Pro okamžitou nápovědu stiskněte klávesu <b&gt [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Správce</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9956,7 +10723,7 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g
     </message>
     <message>
         <source>Settings</source>
-        <translation>Nastavení</translation>
+        <translation type="obsolete">Nastavení</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -10009,6 +10776,10 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g
         <source>Display</source>
         <translation>Obrazovka</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -10084,6 +10855,43 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">používáte nyní více řadičů než čipová sada %1 podporuje. Změňte prosím typ čipové sady na záložce Nastavení systému nebo zmenšete následující počet řadičů na záložce Nastavení řadiče: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Nastavení</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Zavřít</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -10195,8 +11003,8 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g
         <translation type="obsolete">Shrnutí</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Byla vydána nová verze aplikace VirtualBox! Na stránce <a href="https://www.virtualbox.org/">virtualbox.org</a> je verze <b>%1</b>.</p><p>Tuto verzi si můžete stáhnout přímo zde: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Byla vydána nová verze aplikace VirtualBox! Na stránce <a href="http://www.virtualbox.org/">virtualbox.org</a> je verze <b>%1</b>.</p><p>Tuto verzi si můžete stáhnout přímo zde: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -10264,6 +11072,14 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g
         <source>&Restore current snapshot '%1'</source>
         <translation>V&rátit se k aktuálnímu snímku "%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -10277,28 +11093,191 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>Nedostupný</translation>
+        <source>&Close</source>
+        <translation type="obsolete">&Zavřít</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 od %3</nobr><br><nobr>Sezení %4</nobr></translation>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informace o sezení</translation>
     </message>
     <message>
-        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
-        <comment>Inaccessible VM tooltip (name, last state change)</comment>
-        <translation><nobr><b>%1</b><br></nobr><nobr>Nedostupné od %2</nobr></translation>
+        <source>&Details</source>
+        <translation type="obsolete">&Detaily</translation>
     </message>
     <message>
-        <source>S&how</source>
-        <translation type="obsolete">&Zobrazit</translation>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Runtime</translation>
     </message>
     <message>
-        <source>Switch to the window of the selected virtual machine</source>
-        <translation type="obsolete">Přepne do okna vybraného virtuálního počítače</translation>
+        <source>DMA Transfers</source>
+        <translation>DMA přenosy</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO přenosy</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Přečteno dat</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Zapsáno dat</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Přeneseno dat</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Přijato dat</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Povoleno</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Parametry při spuštění</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Rozlišení obrazovky</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Statistika CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Statistiky síťového rozhraní</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Nepřipojeno</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Verze %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Nedetekováno</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Nedetekováno</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Přídavky pro hosta</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>OS hosta</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Statistika pevného disku</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Bez pevných disků</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Bez síťových adaptérů</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Povoleno</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Zakázáno</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Nedostupný</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Statistiky o úložištích</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Bez zařízení pro úložiště</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Statistiky síťových rozhraní</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Přímý přístup k hardware</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Nedostupný</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Režim se schránkou</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Režim Táhni a pusť</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>Detaily &nastavení</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>&Informace o běhu</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>Nedostupný</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation><nobr>%1<br></nobr><nobr>%2 od %3</nobr><br><nobr>Sezení %4</nobr></translation>
+    </message>
+    <message>
+        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
+        <comment>Inaccessible VM tooltip (name, last state change)</comment>
+        <translation><nobr><b>%1</b><br></nobr><nobr>Nedostupné od %2</nobr></translation>
+    </message>
+    <message>
+        <source>S&how</source>
+        <translation type="obsolete">&Zobrazit</translation>
+    </message>
+    <message>
+        <source>Switch to the window of the selected virtual machine</source>
+        <translation type="obsolete">Přepne do okna vybraného virtuálního počítače</translation>
     </message>
     <message>
         <source>S&tart</source>
@@ -10439,11 +11418,27 @@ krok a připojit pevné disky později použitím dialogu Nastavení VM.</p&g
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Skrýt popis</translation>
+        <translation type="obsolete">Skrýt popis</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Zobrazit popis</translation>
+        <translation type="obsolete">Zobrazit popis</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11424,11 +12419,11 @@ Verze %1</translation>
         <translation type="obsolete">Otevře dialog pro správu sdílených složek</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Instalovat Přídavky pro hosta...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Připojí obraz s instalací Přídavků pro hosta</translation>
     </message>
     <message>
@@ -11773,7 +12768,7 @@ Verze %1</translation>
         <translation type="obsolete">I&nformace o sezení</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Zobrazí dialog s informacemi o sezení</translation>
     </message>
     <message>
@@ -12200,8 +13195,8 @@ Verze %1</translation>
         <translation><nastavit výchozí></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Aktuální výchozí cesta bude zobrazena pro akceptování změn a novém otevření tohoto dialogu.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Aktuální výchozí cesta bude zobrazena pro akceptování změn a novém otevření tohoto dialogu.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -12249,8 +13244,7 @@ Verze %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Aktuální výchozí cesta bude zobrazena pro akceptování změn a novém otevření tohoto dialogu.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12636,7 +13630,7 @@ Verze %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -13450,19 +14444,9 @@ Verze %1</translation>
         <translation type="obsolete">Obrazy můžete vytvořit pomocí správce virtuální medií.</translation>
     </message>
     <message>
-        <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Některé části souboru s diskem jsou nedostupné. Použijte prosím Správce virtuálních medií v režimu <b>Zobrazení rozdílových disků</b> pro zjištění souvislostí.</translation>
-    </message>
-    <message>
-        <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Některé části souboru s diskem jsou nedostupné. Použijte prosím Správce virtuálních medií v režimu <b>Zobrazení rozdílových disků</b> pro zjištění souvislostí.</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -13514,7 +14498,7 @@ Verze %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -14071,12 +15055,12 @@ Verze %1</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Povoleno</translation>
+        <translation type="obsolete">Povoleno</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Zakázáno</translation>
+        <translation type="obsolete">Zakázáno</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -14139,7 +15123,151 @@ Verze %1</translation>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Výchozí</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Aktivní</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Aktivní</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Aktivní</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -14341,11 +15469,11 @@ na výchozí jazyk systému.</qt>
         <translation type="obsolete">Ukazuje cestu k výchozímu VDI adresáři. Tento adresář je použit, pokud se neurčí jinak, když se přidává existující nebo vytváří nový virtuální pevný disk.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Přenastaví cestu k adresáři virtuálního počítače na výchozí hodnotu. Skutečná výchozí cesta bude zobrazena po potvrzení změn a znovuotevření toho dialogu.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restartuje cestu k VDI adresáři na výchozí hodnotu. Skutečná výchozí cesta bude zobrazena po potvrzení změn a znovuotevření toho dialogu.</translation>
     </message>
     <message>
@@ -14389,7 +15517,7 @@ na výchozí jazyk systému.</qt>
         <translation type="obsolete">Otevře dialog pro výběr souboru autentizační knihovny VRDP.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Přenastaví soubor autentizační knihovny na výchozí hodnotu. Skutečná výchozí knihovna bude zobrazena až po potvrzení změn a otevření tohoto dialogu.</translation>
     </message>
     <message>
@@ -14710,6 +15838,18 @@ na výchozí jazyk systému.</qt>
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Vytvoří nový virtuální pevný disk</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -14802,8 +15942,8 @@ na výchozí jazyk systému.</qt>
         <translation type="obsolete">Registrační dialog VirtualBoxu</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>prosíme vyplňte registrační formulář a dejte nám vědět že používáte VirtualBox a, volitelně, budete informováni o novinkách a aktualizacích VirtualBoxu.</p><p>Vložte vaše celé jméno pomocí latisnké abecedy a váš e-mail do políčka níže. Vězte že innotek použije tyto informace pouze získávání statistik o používání produktu a pro odesílání novinek o Virtualboxu. Innotek nikdy nepředá vaše data třetím stranám. Detailní informace o tom [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>prosíme vyplňte registrační formulář a dejte nám vědět že používáte VirtualBox a, volitelně, budete informováni o novinkách a aktualizacích VirtualBoxu.</p><p>Vložte vaše celé jméno pomocí latisnké abecedy a váš e-mail do políčka níže. Vězte že innotek použije tyto informace pouze získávání statistik o používání produktu a pro odesílání novinek o Virtualboxu. Innotek nikdy nepředá vaše data třetím stranám. Detailní informace o tom [...]
     </message>
     <message>
         <source>&Name</source>
@@ -14846,8 +15986,8 @@ na výchozí jazyk systému.</qt>
         <translation type="obsolete">Nelze provést prvotní spojení.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Prosíme vyplňte registrační formulář a dejte nám vědět, že používáte VirtualBox a, volitelně, budete informováni o novinkách a aktualizacích VirtualBoxu.</p><p>Vložte vaše celé jméno pomocí latinské abecedy a váš e-mail do políčka níže. Vězte že Sun Microsystems použije tyto informace pouze získávání statistik o používání produktu a pro odesílání novinek o Virtualboxu. Sun Microsystems nikdy nepředá vaše data třetím stranám. Detai [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Prosíme vyplňte registrační formulář a dejte nám vědět, že používáte VirtualBox a, volitelně, budete informováni o novinkách a aktualizacích VirtualBoxu.</p><p>Vložte vaše celé jméno pomocí latinské abecedy a váš e-mail do políčka níže. Vězte že Sun Microsystems použije tyto informace pouze získávání statistik o používání produktu a pro odesílání novinek o Virtualboxu. Sun Microsystems nikdy nepředá vaše data třetím stranám. Detai [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -14866,8 +16006,8 @@ na výchozí jazyk systému.</qt>
         <translation type="obsolete">Vyberte zemi/teritorium</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Prosíme vyplňte registrační formulář a dejte nám vědět že používáte VirtualBox a, volitelně, budete informováni o novinkách a aktualizacích VirtualBoxu.</p><p>Vložte vaše celé jméno pomocí latinské abecedy a váš e-mail do políčka níže. Vězte že Sun Microsystems použije tyto informace pouze získávání statistik o používání produktu a pro odesílání novinek o Virtualboxu. Sun Microsystems nikdy nepředá vaše data třetím stranám. Detail [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Prosíme vyplňte registrační formulář a dejte nám vědět že používáte VirtualBox a, volitelně, budete informováni o novinkách a aktualizacích VirtualBoxu.</p><p>Vložte vaše celé jméno pomocí latinské abecedy a váš e-mail do políčka níže. Vězte že Sun Microsystems použije tyto informace pouze získávání statistik o používání produktu a pro odesílání novinek o Virtualboxu. Sun Microsystems nikdy nepředá vaše data třetím stranám. Detail [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -15095,8 +16235,8 @@ na výchozí jazyk systému.</qt>
         <translation type="obsolete">Pozastaví chod virtuálního počítače</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Vítejte ve VirtualBoxu!</h3><p>Levá část tohoto okna je určena pro zobrazení seznamu všech virtuálních počítačů na vašem počítači. Seznam je teď prázdný, protože jste ještě žádný nevytvořili.<img src=:/welcome.png align=right/></p><p>Pro vytvoření nového virtuálního počítače stiskněte tlačítko <b>Nový</b> v horní části hlavního okna.</p><p>Pro okamžitou nápovědu stiskněte klávesu <b&gt [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Vítejte ve VirtualBoxu!</h3><p>Levá část tohoto okna je určena pro zobrazení seznamu všech virtuálních počítačů na vašem počítači. Seznam je teď prázdný, protože jste ještě žádný nevytvořili.<img src=:/welcome.png align=right/></p><p>Pro vytvoření nového virtuálního počítače stiskněte tlačítko <b>Nový</b> v horní části hlavního okna.</p><p>Pro okamžitou nápovědu stiskněte klávesu <b&gt [...]
     </message>
     <message>
         <source>Log</source>
@@ -15894,165 +17034,6 @@ hodnotu.</qt></translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">&Zavřít</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Informace o sezení</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detaily</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Runtime</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA přenosy</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO přenosy</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Přečteno dat</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Zapsáno dat</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Přeneseno dat</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Přijato dat</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Povoleno</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Parametry při spuštění</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Rozlišení obrazovky</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Statistika CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Statistiky síťového rozhraní</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Nepřipojeno</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Verze %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Nedetekováno</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Nedetekováno</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Přídavky pro hosta</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>OS hosta</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Statistika pevného disku</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Bez pevných disků</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Bez síťových adaptérů</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Povoleno</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Zakázáno</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation></translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Nedostupný</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Statistiky o úložištích</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Bez zařízení pro úložiště</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Statistiky síťových rozhraní</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Přímý přístup k hardware</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Nedostupný</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Režim se schránkou</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Režim Táhni a pusť</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>Detaily &nastavení</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>&Informace o běhu</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -16729,7 +17710,7 @@ tuto možnost po nainstalování hostovaného operačního systému Windows!<
         <translation type="obsolete">Ukazuje cestu, kam jsou ukládány snímky virtuálního počítače. Snímky můžou zabrat velké množství diskového prostor.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Přenastaví cestu k adresáři snímků na výchozí hodnotu. Skutečná výchozí cesta bude zobrazena po potvrzení změn a znovuotevření toho dialogu.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_da.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_da.ts
index 8d83f23..aed6291 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_da.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_da.ts
@@ -251,7 +251,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Ingen vinduesramme</translation>
+        <translation type="unfinished">Ingen vinduesramme</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -275,11 +275,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Slå integration af &mus fra</translation>
+        <translation type="obsolete">Slå integration af &mus fra</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Slå integration af mus fra midlertidigt</translation>
+        <translation type="obsolete">Slå integration af mus fra midlertidigt</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -291,11 +291,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Send Ctrl-Alt-Del</translation>
+        <translation type="obsolete">Send Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Send Ctrl-Alt-Del til den virtuelle maskine</translation>
+        <translation type="obsolete">Send Ctrl-Alt-Del til den virtuelle maskine</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -303,7 +303,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Send Ctrl-Alt-Backspace til den virtuelle maskine</translation>
+        <translation type="obsolete">Send Ctrl-Alt-Backspace til den virtuelle maskine</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -318,8 +318,8 @@
         <translation type="obsolete">I&nformation om session</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Vis sessionsinformation</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Vis sessionsinformation</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -375,15 +375,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD drev</translation>
+        <translation type="obsolete">&CD/DVD drev</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Diskettedrev</translation>
+        <translation type="obsolete">Diskettedrev</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB enheder</translation>
+        <translation type="obsolete">&USB enheder</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -410,12 +410,12 @@
         <translation type="obsolete">Tillad eller afvis fjernskærmsforbindelser (RDP) til denne maskine</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>&Indsæt Gæstetilføjelser CD-aftryk...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Installér Gæstetilføjelser...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Indsæt CD-aftrykket med Gæstetilføjelser i det virtuelle drev</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Monterer CD'en med Gæstetilføjelser</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -434,7 +434,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&Logger...</translation>
+        <translation type="obsolete">&Logger...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -512,15 +512,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Skift til &fuldskærm</translation>
+        <translation type="obsolete">Skift til &fuldskærm</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Skift mellem normalt vindue og fuldskærm</translation>
+        <translation type="obsolete">Skift mellem normalt vindue og fuldskærm</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Skift ti&l rammefri tilstand</translation>
+        <translation type="obsolete">Skift ti&l rammefri tilstand</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -528,7 +528,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Skift til &skaleret tilstand</translation>
+        <translation type="obsolete">Skift til &skaleret tilstand</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -608,7 +608,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>S&end Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">S&end Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>&File</source>
@@ -902,71 +902,292 @@
         <translation>Delt udklipsholder</translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation>Træk og slip</translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>Gem tilstanden af den virtuelle maskine</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>Sluk den virtuelle maskine</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>&Netværksindstillinger...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation>Ind&stillinger for Delte mapper...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>Fj&ernskærm</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>Slå fjernskærmsforbindelser (RDP) til denne maskine til/fra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>&Videooptagelse</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation>Videooptagelse til/fra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation>Indstillinger for &Videooptagelse...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>Konfigurer videooptagelse</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Popup Menu</source>
-        <translation>Pop op menu</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Installér Gæstetilføjelser...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Monterer CD'en med Gæstetilføjelser</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>&Webcams</translation>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Vis &log...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Fil</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Aktivér</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1752,6 +1973,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1762,7 +1990,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Kasserer data ...</translation>
+        <translation type="obsolete">Kasserer data ...</translation>
     </message>
 </context>
 <context>
@@ -1834,6 +2062,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2389,62 +2643,62 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><b>%1</b></source>
         <comment>Group item tool-tip / Group name</comment>
-        <translation><b>%1</b></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source>%n group(s)</source>
         <comment>Group item tool-tip / Group info</comment>
-        <translation>
-            <numerusform>%n gruppe</numerusform>
-            <numerusform>%n grupper</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Group info wrapper</comment>
-        <translation><nobr>%1</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr></translation>
     </message>
     <message numerus="yes">
         <source>%n machine(s)</source>
         <comment>Group item tool-tip / Machine info</comment>
-        <translation>
-            <numerusform>%n maskine</numerusform>
-            <numerusform>%n maskiner</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message numerus="yes">
         <source>(%n running)</source>
         <comment>Group item tool-tip / Running machine info</comment>
-        <translation>
-            <numerusform>(%n kører)</numerusform>
-            <numerusform>(%n kører)</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper</comment>
-        <translation><nobr>%1</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr></translation>
     </message>
     <message>
         <source><nobr>%1 %2</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper, including running</comment>
-        <translation><nobr>%1 %2</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr> {1 %2<?}</translation>
     </message>
     <message>
         <source>Collapse group</source>
-        <translation>Sammenfold gruppe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Expand group</source>
-        <translation>Udvid gruppe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter group</source>
-        <translation>Gå til gruppe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Exit group</source>
-        <translation>Forlad gruppe</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2519,7 +2773,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2714,37 +2968,132 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation>Videooptagelsesfil</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation>Egenskaber for videooptagelse</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation>Videooptagelse</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation>Slået fra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>NAT-netværk, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>Opløsning: %1x%2, billeder/sek: %3fps, Bitrate: %4kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">USB-styreenhed</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
         <comment>details</comment>
         <translation type="obsolete">Lydenhed</translation>
     </message>
@@ -3059,7 +3408,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation>Udvid&elsespakker</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3117,28 +3466,16 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Slå værtens pauseskærm fra</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>&Dok og Menulinje:</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>Vis på fuldskærm</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Hvis markeret, vil værtens Dok og Menulinje blive vist, når den virtuelle maskine er i fuldskærmstilstand.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>Værtens pauseskærm:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>Hvis markeret, vil værtens pauseskærm blive slået fra når mindst én virtual maskine kører.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>Slå fra, når der kører virtuelle maskiner</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3177,27 +3514,27 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>Værtstast-kombination</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>Flere elementer tildelt samme genvej.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation>&VirtualBox Manager</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>Virtuel &maskine</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Viser alle tilgængelige genveje, der kan konfigureres.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Tast en sekvens for at filtrere genvejslisten.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3256,7 +3593,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>Brugerflade-sprog</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3413,128 +3750,128 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation>&NAT-netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation>Viser tilgængelige NAT-netværk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translation>Interne netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Intet nyt navn angivet for NAT-netværket <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation>Subnet ikke angivet for NAT-netværket <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Subnet ikke angivet for NAT-netværk tidligere navngivet <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation>Ugyldigt subnet angivet (<i>%1</i>) for NAT-netværk <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation>Ugyldigt subnet (<i>%1</i>) angivet for NAT-netværk tidligere navngivet <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translation>Netværksnavn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation>[tom]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (omdøbt fra %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation>Gammelt netværksnavn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation>Nyt netværksnavn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation>Subnet-maske</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation>Understøtter DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>yes</source>
-        <translation>ja</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>no</source>
-        <translation>nej</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation>Understøtter IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation>Standard IPv6 rute</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation>Værts-netværkskort (<i>%1</i>) har ikke en gyldig IPv4-adresse.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation>Værts-netværkskort (<i>%1</i>) har ikke en gyldig IPv4-netværksmaske.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation>Værts-netværkskort (<i>%1</i>) har ikke en gyldig IPv6-adresse.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation>Værts-netværkskort (<i>%1</i>) har ikke en gyldig DHCP-serveradresse.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>Værts-netværkskort (<i>%1</i>) har ikke en gyldig DHCP-server maske.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>Værts-netværkskort (<i>%1</i>) har ikke en gyldig nedre grænse for DHCP-adresser.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>Værts-netværkskort (<i>%1</i>) har ikke en gyldig øvre grænse for DHCP-adresser.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>Navnet <b>%1</b> bruges af flere forskellige NAT-netværk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>Aktivt</translation>
+        <translation type="unfinished">Aktiv</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>Tilføj N&AT-netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation>Fje&rn NAT-netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation>Tilr&et NAT-netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3636,177 +3973,177 @@ p, li { white-space: pre-wrap; }
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation>Detaljer for værtsbegrænset netværk</translation>
+        <translation type="unfinished">Detaljer for værtsbegrænset netværk</translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation>Netværkskort</translation>
+        <translation type="unfinished">Netværkskort</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation>Manuel konfiguration</translation>
+        <translation type="unfinished">Manuel konfiguration</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>Brug manuel konfiguration for værtsbegrænset netværkskort.</translation>
+        <translation type="unfinished">Konfigurér værtsbegrænset netværkskort manuelt.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation>&IPv4-adresse:</translation>
+        <translation type="unfinished">&IPv4-adresse:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>Viser værtens IPv4-adresse for dette netværkskort.</translation>
+        <translation type="unfinished">Viser værtens IPv4-adresse for dette netværkskort.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation>IPv4-netværks&maske:</translation>
+        <translation type="unfinished">IPv4-netværks&maske:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>Viser værtens IPv4-netværksmaske for dette netværkskort.</translation>
+        <translation type="unfinished">Viser værtens IPv4-netværksmaske for dette netværkskort.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation>I&Pv6-adresse:</translation>
+        <translation type="unfinished">I&Pv6-adresse:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>Viser værtens IPv6-adresse for dette netværkskort, hvis IPv6 er understøttet.</translation>
+        <translation type="unfinished">Viser værtens IPv6-adresse for dette netværkskort.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation>&Længde på IPv6-netværksmaske:</translation>
+        <translation type="unfinished">&Længde på IPv6-netværksmaske:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>Viser præfix-længden af værtens IPv6-netværksmaske for dette netværkskort, hvis IPv6 er understøttet.</translation>
+        <translation type="unfinished">Viser præfix-længden af værtens IPv6-netværksmaske for dette netværkskort, hvis IPv6 understøttes.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation>&DHCP-server</translation>
+        <translation type="unfinished">&DHCP-server</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>Aktiv&er server</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation>Viser om DHCP-serveren aktiveres ved opstart.</translation>
+        <translation type="unfinished">Viser om DHCP-serveren aktiveres ved opstart.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation>Serverad&resse:</translation>
+        <translation type="unfinished">Serverad&resse:</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Viser adressen på DHCP-serveren, der servicerer netværket for det værtsbegrænsede netværkskort.</translation>
+        <translation type="unfinished">Viser DHCP-serverens adresse på netværket tilknyttet det værtsbegrænsede netværkskort.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation>Server-&maske:</translation>
+        <translation type="unfinished">Server-&maske:</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Viser DHCP-serverens netværksmaske på netværket tilknyttet det værtsbegrænsede netværkskort.</translation>
+        <translation type="unfinished">Viser DHCP-serverens netværksmaske på netværket tilknyttet det værtsbegrænsede netværkskort.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation>Nedre grænse for adresser:</translation>
+        <translation type="unfinished">Nedre grænse for adresser:</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Viser DHCP-serverens nedre grænse for adresser på netværket tilknyttet det værtsbegrænsede netværkskort.</translation>
+        <translation type="unfinished">Viser DHCP-serverens nedre grænse for adresser på netværket tilknyttet det værtsbegrænsede netværkskort.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation>Øvre grænse for adresser:</translation>
+        <translation type="unfinished">Øvre grænse for adresser:</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Viser DHCP-serverens øvre grænse for adresser på netværket tilknyttet det værtsbegrænsede netværkskort.</translation>
+        <translation type="unfinished">Viser DHCP-serverens øvre grænse for adresser på netværket tilknyttet det værtsbegrænsede netværkskort.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation>Detaljer for NAT-netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation>Aktivér n&etværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation>Aktiverer dette NAT-netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation>&Netværksnavn:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>Viser netværkets navn.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation>Subnet-maske:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>Viser subnet-masken for dette netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation>Netværksindstillinger:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation>Understøtter &DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation>Styrer om netværket understøtter DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation>Understøtter &IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>Styrer om netværket understøtter IPv6.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>Indstil som standard IPv6-&rute</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation>Styrer om dette netværk skal være standard IPv6-rute.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Opsæt regler for viderestilling af porte.</translation>
+        <translation type="unfinished">Opsæt regler for viderestilling af porte.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation>&Port-viderestilling</translation>
+        <translation type="unfinished">&Port-viderestilling</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>Regler for port-viderestilling</translation>
+        <translation type="unfinished">Regler for port-viderestilling</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation>IPv4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation>IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3817,7 +4154,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Enable Proxy</source>
-        <translation>Anv&end proxy</translation>
+        <translation>Brug proxy</translation>
     </message>
     <message>
         <source>Ho&st:</source>
@@ -3861,11 +4198,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>Proxy-adresse ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>Proxy-port ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3930,71 +4267,71 @@ p, li { white-space: pre-wrap; }
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation><tast_%1></translation>
+        <translation type="unfinished"><tast_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation>Venstre </translation>
+        <translation type="unfinished">Venstre</translation>
     </message>
     <message>
         <source>Right </source>
-        <translation>Højre </translation>
+        <translation type="unfinished">Højre</translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation>Venstre Shift</translation>
+        <translation type="unfinished">Venstre Shift</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation>Højre Shift</translation>
+        <translation type="unfinished">Højre Shift</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation>Venstre Ctrl</translation>
+        <translation type="unfinished">Venstre Ctrl</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation>Højre Ctrl</translation>
+        <translation type="unfinished">Højre Ctrl</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation>Venstre Alt</translation>
+        <translation type="unfinished">Venstre Alt</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation>Højre Alt</translation>
+        <translation type="unfinished">Højre Alt</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation>Venstre Windows-tast</translation>
+        <translation type="unfinished">Venstre Windows-tast</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation>Højre Windows-tast</translation>
+        <translation type="unfinished">Højre Windows-tast</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation>Menu tast</translation>
+        <translation type="unfinished">Menu tast</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation>AltGr</translation>
+        <translation type="unfinished">Alt Gr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>Caps Lock</translation>
+        <translation type="unfinished">Caps Lock</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation>Scroll Lock</translation>
+        <translation type="unfinished">Scroll Lock</translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation>Vært+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
-        <translation>Ingen</translation>
+        <translation type="unfinished">Ingen</translation>
     </message>
 </context>
 <context>
@@ -4183,22 +4520,22 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation>Nulstil genvej til standard</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation>Fjern genvej</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation>Navn</translation>
+        <translation type="unfinished">Navn</translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translation>Genvej</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4343,12 +4680,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Viser aktiviteten på CD/DVD-drev:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Viser aktiviteten på CD/DVD-drev:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Viser aktiviteten på diskettedrev:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Viser aktiviteten på diskettedrev:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4388,7 +4725,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB-enhedsstyring er deaktiveret</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB-enhedsstyring er deaktiveret</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4441,20 +4778,34 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Indikerer aktiv videooptagelse:</nobr><br>%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>Videooptagelse deaktiveret</b></nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>Videooptagelsesfil:</b> %1</nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation>Status for udvidelser:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4528,11 +4879,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>Ingen webcams tilsluttede</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Ingen understøttede webcams forbundet til værtsmaskinen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
@@ -4582,7 +4933,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Video</translation>
+        <translation type="obsolete">&Video</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4698,133 +5049,197 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>Videooptagelse</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>Hvis markeret, vil VirtualBox optage sessionen i den virtuelle maskine i en videofil.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation>Slå vid&eooptagelse til</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>Filsti:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Styrer navnet på filen som Virtualbox gemmer det optagede indhold i.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>Oplø&sning:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>Styrer opløsningen (billedstørrelsen) for optagelsen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>Styrer den <b>vandrette</b> opløsning (punkter pr.linje) for optagelsen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>Styrer den <b>lodrette</b> opløsning (antal linjer) for optagelsen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>Billed&frekvens:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>Sætter den øvre grænse for <b>billeder pr.sekund</b>. Yderligere billeder droppes. Jo lavere værdi, jo flere billeder droppes, hvilket reducerer størrelsen på filen, der optages til.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation>Kvalitet:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Styrer <b>kvaliteten</b>. Jo højere værdi, jo bedre vil optagelsen se ud, men filen, der optages til, vil også fylde mere.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Styrer bithastigheden i <b>kilobits pr.sekund</b>. Jo højere værdi, jo bedre vil optagelsen se ud, men filen, der optages til, vil også fylde mere.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation>&Skærme:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>Den virtuelle maskine er konfigureret til at bruge hardwareacceleration, men da værtsmaskinen ikke tilbyder dette for øjeblikket, vil du ikke kunne starte maskinen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>Du har tildelt mindre end <b>%1</b> til grafikhukommelse, som ellers er den mindste mængde, der tillader den virtuelle maskine at skifte til fuldskærm eller rammefri tilstand.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>Du har tildelt mindre end <b>%1</b> til grafikhukommelse, som ellers er den mindste mængde, der kræves for effektiv afspilning af HD video.</translation>
-    </message>
-    <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>Den virtuelle maskine er konfigureret til at bruge grafikacceleration og operativsystem-typen er sat til Windows Vista eller nyere. For den bedste ydeevne bør du sætte maskinens grafikhukommelse til mindst <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>Den virtuelle maskine er konfigureret til at bruge Video Stream Acceleration. Da dette kræver Windows som gæsteoperativsystem, deaktiveres VSA.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>Værdien for VRDE-serverporten er ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>Tidsgrænsen for VRDE-autentifikation er ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation>Brugerdefineret</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation>%1 fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>fps</source>
-        <translation>fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation>Lav</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation>Mellem</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation>Høj</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation>kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation>Skærm %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation>Slå videooptagelse til for skærm %1. </translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Miniværktøjslinje:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Hvis markeret, vises mini-værktøjslinjen i Fuldskærm og Rammefri tilstand.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Vis i &Fuldskærm/Rammefri tilstand</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Hvis markeret, vises mini-værktøjslinjen i toppen af skærmen fremfor som standard i bunden af skærmen.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Vis i &toppen af skærm</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4835,7 +5250,7 @@ p, li { white-space: pre-wrap; }
         <translation>Viser stien, hvor øjebliksbilleder af den virtuelle maskine bliver gemt. Bemærk at øjebliksbilleder kan bruge en hel del lagerplads.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Basal</translation>
     </message>
     <message>
@@ -4847,7 +5262,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Viser navnet på den virtuelle maskine.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avanceret</translation>
     </message>
     <message>
@@ -4863,7 +5278,7 @@ p, li { white-space: pre-wrap; }
         <translation>Øjebliksbilleder:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>Beskrivelse</translation>
     </message>
     <message>
@@ -4872,43 +5287,43 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Hvis markeret, vil alle ændringer i monterede CD/DVD- eller diskettedrev blive gemt som en del af den permanente konfiguration og dermed være tilgængelige næste gang også.</translation>
+        <translation type="obsolete">Hvis markeret, vil alle ændringer i monterede CD/DVD- eller diskettedrev blive gemt som en del af den permanente konfiguration og dermed være tilgængelige næste gang også.</translation>
     </message>
     <message>
         <source>Removable Media:</source>
         <translatorcomment>Ental eller flertal?</translatorcomment>
-        <translation>Flytbare medier:</translation>
+        <translation type="obsolete">Flytbare medier:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Gem ænd&ringer</translation>
+        <translation type="obsolete">Gem ænd&ringer</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Miniværktøjslinje:</translation>
+        <translation type="obsolete">Miniværktøjslinje:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Hvis markeret, vises mini-værktøjslinjen i Fuldskærm og Rammefri tilstand.</translation>
+        <translation type="obsolete">Hvis markeret, vises mini-værktøjslinjen i Fuldskærm og Rammefri tilstand.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Vis i &Fuldskærm/Rammefri tilstand</translation>
+        <translation type="obsolete">Vis i &Fuldskærm/Rammefri tilstand</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Hvis markeret, vises mini-værktøjslinjen i toppen af skærmen fremfor som standard i bunden af skærmen.</translation>
+        <translation type="obsolete">Hvis markeret, vises mini-værktøjslinjen i toppen af skærmen fremfor som standard i bunden af skærmen.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Vis i &toppen af skærm</translation>
+        <translation type="obsolete">Vis i &toppen af skærm</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">Du har valgt et 64-bit gæsteoperativsystem til denne VM. Da denne type gæst kræver hardware-virtualisering (VT-x/AMD-V) er dette automatisk blevet slået til.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>Træk og slip:</translation>
     </message>
     <message>
@@ -4917,11 +5332,107 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation>Navn for virtuel maskine ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>Den virtuelle maskines operativsystem-type er sat til 64-bit. 64-bit gæsteoperativsystemer kræver hardware-virtualisering, så dette aktiveres automatiskt hvis du bekræfter ændringerne.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Miniværktøjslinje:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Hvis markeret, vises mini-værktøjslinjen i Fuldskærm og Rammefri tilstand.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Vis i &Fuldskærm/Rammefri tilstand</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Hvis markeret, vises mini-værktøjslinjen i toppen af skærmen fremfor som standard i bunden af skærmen.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Vis i &toppen af skærm</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5066,35 +5577,35 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation>Du skal vælge en netværksbro.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>Du skal angive et navn til det interne netværk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>Du skal vælge et værtsbegrænset netværkskort.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation>Generisk driver ikke valgt.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>MAC-adressen skal bestå af 12 hexadecimale tegn.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation>Det andet tegn i MAC-adressen må ikke være ulige, da kun unicast-adresser er tilladt.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>Du skal angive et navn til NAT-netværket.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>Indtast navnet på NAT-netværket som dette netværkskort skal forbindes til. Du kan oprette og fjerne netværk via globale indstillinger for netværk i Virtuel Maskine Håndtering.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5196,23 +5707,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>IRQ ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>I/O port ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>To eller flere porte har samme værdier.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Portsti ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Den samme portsti er angivet flere gange.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5383,10 +5894,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Hvis markeret, vil mappe-delingen blive permanent.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Vindue</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5437,19 +5944,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Hvis markeret, vil røret angivet i feltet<b>Sti til port</b> blive oprettet, når den virtuelle maskine starter. Ellers vil den virtuelle maskine forsøge at bruge et eksisterende rør.</translation>
+        <translation type="obsolete">Hvis markeret, vil røret angivet i feltet<b>Sti til port</b> blive oprettet, når den virtuelle maskine starter. Ellers vil den virtuelle maskine forsøge at bruge et eksisterende rør.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>Opret rør</translation>
+        <translation type="obsolete">Opret rør</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Viser stien til serielportens rør på værten, hvis porten er i <b>Rør</b>-tilstand eller stien til serielportens enhedsfil, når porten er i <b>Enhed</b>-tilstand.</translation>
+        <translation type="obsolete">Viser stien til serielportens rør på værten, hvis porten er i <b>Rør</b>-tilstand eller stien til serielportens enhedsfil, når porten er i <b>Enhed</b>-tilstand.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Port/Filsti:</translation>
+        <translation type="obsolete">&Port/Filsti:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5459,6 +5966,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Viser serielportens I/O-adresse. Gyldige værdier er heltal fra <tt>0</tt> til <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5476,23 +5999,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>IRQ ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>I/O port ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>To eller flere porte har samme værdier.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Portsti ikke angivet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Den samme portsti er angivet flere gange.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5575,15 +6098,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Tilføj&nbsp;CD/DVD-drev</nobr></translation>
+        <translation type="obsolete"><nobr>Tilføj&nbsp;CD/DVD-drev</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Tilføj&nbsp;diskettedrev</nobr></translation>
+        <translation type="obsolete"><nobr>Tilføj&nbsp;diskettedrev</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>Ingen harddisk er valgt for <i>%1</i>.</translation>
+        <translation type="unfinished">Ingen harddisk er valgt for <i>%1</i>.</translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -5623,11 +6146,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Tilføj CD/DVD-drev</translation>
+        <translation type="obsolete">Tilføj CD/DVD-drev</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Tilføj diskettedrev</translation>
+        <translation type="obsolete">Tilføj diskettedrev</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5815,16 +6338,16 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD &drev:</translation>
+        <translation type="obsolete">CD/DVD &drev:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
         <translatorcomment>Dårligt engelsk...</translatorcomment>
-        <translation>Vælg den virtuelle CD/DVD eller fysiske drev, der skal sættes i det virtuelle drev. Den virtuelle maskine vil se en disk isat indeholdende data fra filen eller det fysiske drev.</translation>
+        <translation type="obsolete">Vælg den virtuelle CD/DVD eller fysiske drev, der skal sættes i det virtuelle drev. Den virtuelle maskine vil se en disk isat indeholdende data fra filen eller det fysiske drev.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Tilpas det virtuelle CD/DVD drev</translation>
+        <translation type="obsolete">Tilpas det virtuelle CD/DVD drev</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5848,7 +6371,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Vælg en virtuel CD/DVD-fil...</translation>
+        <translation type="obsolete">Vælg en virtuel CD/DVD-fil...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5914,23 +6437,71 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Controller: %1</source>
-        <translation>Styreenhed: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>Navn ikke angivet for styreenheden på position <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>Styreenheden på position <b>%1</b> har samme navn som styreenheden på position <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> bruger en disk, der allerede er tilsluttet til <i>%2</i></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>Maskinen har flere lager-styreenheder tildelt end et %1 chipset understøtter. Tilpas chipset-typen under System-indstillinger eller formindsk antallet af de følgende lager-styreenheder under Lager-indstillinger: %2</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Vælg en virtuel optisk disk-fil...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6154,47 +6725,55 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>&Pegeredskab:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Styrer om pegeredskabet emulerer en standard PS/2 mus, en USB-tablet eller en USB-tablet med multi-touch.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>Mere end <b>%1%</b> af værtens hukommelse (<b>%2</b>) er tildelt den virtuelle maskine. Dermed er der ikke hukommelse nok til værtens eget operativsystem. Vælg en lavere værdi.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>Mere end <b>%1%</b> af værtens hukommelse (<b>%2</b>) er tildelt den virtuelle maskine. Der er muligvis ikke hukommelse nok tilbage til værtens eget operativsystem. Overvej en lavere tildeling.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>I/O APIC-funktionen er ikke aktiveret under System->Bundkort. Dette kræves for at understøtte et ICH9-chipsæt. Aktivering sker automatisk, hvis du gemmer dine ændringer.</translation>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>Emulering af en USB-styreenhed er ikke aktiveret under System->USB. Dette kræves for at emulere en USB inputenhed. Aktivering sker automatisk, hvis du gemmer dine ændringer.</translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>Af ydelsesmæssige grunde, kan antallet af virtuelle CPU'er tildelt en virtuel maskine ikke overstige 2 gange antallet af fysiske CPU'er i værten (<b>%1</b>). Nedsæt antallet af virtuelle CPU'er.</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>Antallet af virtuelle CPU'er tildelt den virtuelle maskine overstiger antallet af fysiske CPU'er i værten (<b>%1</b>). Dette vil sandsynligvis påvirke den virtuelle maskines ydelse negativt. Overvej derfor at nedsætte antallet af virtuelle CPU'er.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>I/O APIC-funktionen er ikke aktiveret under System->Bundkort. Dette kræves for at understøtte flere virtuelle CPU'er. Aktivering sker automatisk, hvis du gemmer dine ændringer.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Hardware-virtualisering er ikke aktiveret under System->Acceleration. Dette kræves for at understøtte flere virtuelle CPU'er. Aktivering sker automatisk, hvis du gemmer dine ændringer.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>Du har sat ydelsesbegrænsningen til en lav værdi. Maskinen kan føles langsom.</translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6266,7 +6845,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Aktivér USB 2.0 (E&HCI)-styreenhed</translation>
+        <translation type="obsolete">Aktivér USB 2.0 (E&HCI)-styreenhed</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6329,8 +6908,28 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">USB 2.0 er pt aktiveret i denne virtuelle maskine. Dette kræver at <b>%1</b> installeres - denne udvidelsespakke kan hentes fra VirtualBox' hjemmeside. Derefter kan du reaktivere USB 2.0. USB 2.0 vil blive deaktiveret nu, medmindre du annullerer de nuværende ændringer.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 er aktiveret for denne virtuelle maskine, men dette kræver at <b>%1</b> installeres. Installér udvidelsespakken fra VirtualBox' hjemmeside eller deaktivér USB 2.0 for at kunne starte maskinen.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6470,7 +7069,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Luk</translation>
+        <translation type="obsolete">&Luk</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6489,6 +7092,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Luk</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Skift</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6530,7 +7156,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Kunne ikke oprette VirtualBox' COM-objekt.</p><p>Applikationen afsluttes.</p></translation>
+        <translation type="obsolete"><p>Kunne ikke oprette VirtualBox' COM-objekt.</p><p>Applikationen afsluttes.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -6724,15 +7350,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Kunne ikke åbne sprogfilen <b><nobr>%1</nobr></b>. <p>VirtualBox vil derfor midlertidigt bruge engelsk. Du kan vælge det rigtige sprog i afsnittet <b>Sprog</b> tilgængelig via menupunktet <b>Indstillinger</b> i menuen <b>Fil</b></p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Den installerede version %1 af VirtualBox' Gæstetilføjelser er forældet. Den forventede version er %2. De funktioner, der kræver Gæstetilføjelser (integration med mus, dynamisk ændring af gæstens skærmopløsning) vil sandsynligvis ikke fungere.</p><p>Vælg <b>Installér Gæstetilføjelser</b> i menuen <b>Enheder<b> for at opdatere til seneste version.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Den installerede version %1 af VirtualBox' Gæstetilføjelser er forældet. Den forventede version er %2. De funktioner, der kræver Gæstetilføjelser (integration med mus, dynamisk ændring af gæstens skærmopløsning) vil sandsynligvis ikke fungere.</p><p>Vælg <b>Installér Gæstetilføjelser</b> i menuen <b>Enheder<b> for at opdatere til seneste version.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Den installerede version %1 af VirtualBox' Gæstetilføjelser er for høj. Den forventede version er %2.</p><p>Brugen af en nyere version af Gæstetilføjelser med en ældre version af VirtualBox understøttes ikke. Vælg <b>Installér Gæstetilføjelser</b> i menuen <b>Enheder<b> for at installere den korrekte version.</p></translation>
     </message>
     <message>
@@ -6829,9 +7455,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Hent</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Montér</translation>
+        <translation type="obsolete">Montér</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6977,8 +7603,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Vis vindue med produktinformation</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>En ny version af VirtualBox er på gaden! Version <b>%1</b> er tilgængelig fra <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Du kan hente denne version her: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>En ny version af VirtualBox er på gaden! Version <b>%1</b> er tilgængelig fra <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Du kan hente denne version her: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7078,7 +7704,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>En eller flere virtuelle harddiske, CD/DVD- eller diskette-drev er ikke tilgængelige for øjeblikket. Du vil ikke kunne starte virtuelle maskiner, som benytter disse enheder indtil de bliver gjort tilgængelige</p><p>Tryk <b>Undersøg</b> for at åbne Virtuel diskhåndtering og se hvilke enheder der er utilgængelige eller tryk <b>Ignorer</b> for at ignorere denne meddelelse.</p></translation>
+        <translation type="obsolete"><p>En eller flere virtuelle harddiske, CD/DVD- eller diskette-drev er ikke tilgængelige for øjeblikket. Du vil ikke kunne starte virtuelle maskiner, som benytter disse enheder indtil de bliver gjort tilgængelige</p><p>Tryk <b>Undersøg</b> for at åbne Virtuel diskhåndtering og se hvilke enheder der er utilgængelige eller tryk <b>Ignorer</b> for at ignorere denne meddelelse.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -7108,8 +7734,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">O&verskriv</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Der opstod en alvorlig fejl under afviklingen af den virtuelle maskine og afviklingen er stoppet.</p><p>For hjælp med dette, se under <i>Community</i>-sektionen på <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> eller din support-kontrakt. Hav en kopi af logfilen <tt>VBox.log</tt> og billedfilen <tt>VBox.png</tt>, som du finder i kataloget <nobr><b>%1</b></nobr [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Der opstod en alvorlig fejl under afviklingen af den virtuelle maskine og afviklingen er stoppet.</p><p>For hjælp med dette, se under <i>Community</i>-sektionen på <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> eller din support-kontrakt. Hav en kopi af logfilen <tt>VBox.log</tt> og billedfilen <tt>VBox.png</tt>, som du finder i kataloget <nobr><b>%1</ [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7385,7 +8011,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Er du sikker på at du vil fjerne CD/DVD-drevet?</p><p>Du vil ikke kunne montere CD/ISO-aftryk eller installere Gæstetilføjelserne uden det!</p></translation>
+        <translation type="obsolete"><p>Er du sikker på at du vil fjerne CD/DVD-drevet?</p><p>Du vil ikke kunne montere CD/ISO-aftryk eller installere Gæstetilføjelserne uden det!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7488,7 +8114,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Du er ved at tilføje et nyt CD/DVD-drev til styreenheden <b>%1</b>.</p><p>Vil du vælge en virtuel CD/DVD-disk til at sætte i drevet eller lade det være tomt?</p></translation>
+        <translation type="obsolete"><p>Du er ved at tilføje et nyt CD/DVD-drev til styreenheden <b>%1</b>.</p><p>Vil du vælge en virtuel CD/DVD-disk til at sætte i drevet eller lade det være tomt?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7510,14 +8136,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Kunne ikke afmontere CD/DVD-enheden <nobr><b>%1</b></nobr> fra udvidelsespladsen <i>%2</i> i maskinen <b>%3</b>.</translation>
+        <translation type="obsolete">Kunne ikke afmontere CD/DVD-enheden <nobr><b>%1</b></nobr> fra udvidelsespladsen <i>%2</i> i maskinen <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Kunne ikke afmontere disketten <nobr><b>%1</b></nobr> fra udvidelsespladsen <i>%2</i> i maskinen <b>%3</b>.</translation>
+        <translation type="obsolete">Kunne ikke afmontere disketten <nobr><b>%1</b></nobr> fra udvidelsespladsen <i>%2</i> i maskinen <b>%3</b>.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>VirtualBox Gæstetilføjelser er vist ikke tilgængelige på denne virtuelle maskine og delte mapper fungerer ikke uden. For at kunne anvende delte mapper i den virtuelle maskine, skal du installere gæstetilføjelserne, hvis de ikke er installeret eller geninstallere, hvis de ikke fungerer korrekt ved at vælge <b>Installér gæstetilføjelser</b> fra menuen <b>Enheder</b>. Delte mapper vil først være tilgængelige, når maskinen [...]
     </message>
     <message numerus="yes">
@@ -7566,19 +8192,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Kunne ikke montere CD/DVD-enheden <nobr><b>%1</b></nobr> på udvidelsespladsen <i>%2</i> i maskinen <b>%3</b>.</translation>
+        <translation type="obsolete">Kunne ikke montere CD/DVD-enheden <nobr><b>%1</b></nobr> på udvidelsespladsen <i>%2</i> i maskinen <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Kunne ikke montere disketten <nobr><b>%1</b></nobr> på udvidelsespladsen <i>%2</i> i maskinen <b>%3</b>.</translation>
+        <translation type="obsolete">Kunne ikke montere disketten <nobr><b>%1</b></nobr> på udvidelsespladsen <i>%2</i> i maskinen <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Bemærk at mediets lagerenhed ikke vil blive slettet og derfor kan den bruges igen på et senere tidspunkt.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>VirtualBox Gæstetilføjelser er tilsyneladende ikke tilgængelige på denne virtuelle maskine og delte mapper fungerer ikke uden. For at kunne anvende delte mapper i den virtuelle maskine, skal du installere gæstetilføjelserne, hvis de ikke er installeret eller geninstallere, hvis de ikke fungerer korrekt ved at vælge <b>Installér gæstetilføjelser</b> fra menuen <b>Enheder</b>. Delte mapper er først tilgængelige, når maskinen er startet  [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>VirtualBox Gæstetilføjelser er tilsyneladende ikke tilgængelige på denne virtuelle maskine og delte mapper fungerer ikke uden. For at kunne anvende delte mapper i den virtuelle maskine, skal du installere gæstetilføjelserne, hvis de ikke er installeret eller geninstallere, hvis de ikke fungerer korrekt ved at vælge <b>Installér gæstetilføjelser</b> fra menuen <b>Enheder</b>. Delte mapper vil først være tilgængelige, nå [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -7824,7 +8450,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Kunne ikke kassere data.</translation>
+        <translation type="obsolete">Kunne ikke kassere data.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -7884,241 +8510,328 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>Kan ikke starte VirtualBox Håndtering grundet lokale begrænsninger.</p><p>Applikationen afsluttes.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>Kunne ikke finde en fil indeholdende sproget <b>%1</b> i kataloget <b><nobr>%2</nobr></b>.</p><p>Applikationen vil midlertidigt bruge systemets standardsprog. Vælg et installeret sprog i sektionen <b>Sprog</b> tilgængelig via menupunktet <b>Indstillinger</b> i menuen <b>Fil</b> i VirtualBox Håndtering.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>Kunne ikke åbne sprogfilen <b><nobr>%1</nobr></b>. <p>VirtualBox vil derfor midlertidigt bruge engelsk. Du kan vælge det rigtige sprog i afsnittet <b>Sprog</b> tilgængelig via menupunktet <b>Indstillinger</b> i menuen <b>Fil</b>i VirtualBox Håndtering.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation>Der er ingen virtuel maskine ved navn <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation>Ignorer</translation>
+        <translation type="unfinished">Ignorer</translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation>Kunne ikke oprette NAT-netværk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>Kunne ikke nedlægge NAT-netværk <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation>Kunne ikke oprette DHCP-server.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>Kunne ikke nedlægge DHCP-server for netværkskort <b>%1</b>. </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>Kunne ikke oprette værtsbegrænset netværkskort.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>Opret &ny disk</translation>
+        <translation type="unfinished">Opret &ny disk</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>Vælg eksisterende disk</translation>
+        <translation type="unfinished">Vælg eksisterende disk</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation>Ing&en disk</translation>
+        <translation type="unfinished">Ing&en disk</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>Vælg disk</translation>
+        <translation type="unfinished">Vælg disk</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Er du sikker på at du vil frigive den virtuelle disk <nobr><b>%1</b></nobr>?</p><p>Det vil fjerne den fra disse virtuelle maskiner: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Er du sikker på at du vil frigive den virtuelle optiske disk <nobr><b>%1</b></nobr>?</p><p>Det vil fjerne den fra disse virtuelle maskiner: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Er du sikker på at du vil frigive den virtuelle diskette <nobr><b>%1</b></nobr>?</p><p>Det vil fjerne den fra disse virtuelle maskiner: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Er du sikker på at du vil fjerne den virtuelle disk <nobr><b>%1</b></nobr> fra listen over kendte aftryk?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation><p>Da denne disk er utilgængelig, kan diskaftrykket ikke slettes.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Er du sikker på at du vil fjerne den virtuelle optiske disk <nobr><b>%1</b></nobr> fra listen over kendte aftryk?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Er du sikker på at du vil fjerne den virtuelle diskette <nobr><b>%1</b></nobr> fra listen over kendte aftryk?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Kunne ikke indsætte den virtuelle optiske disk <nobr><b>%1</b></nobr> i maskinen <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation><p>Vil du forsøge at gennemtvinge tilslutning af dette medie?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Kunne ikke skubbe den virtuelle optiske disk <nobr><b>%1</b></nobr> ud i maskinen <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation><p>Vil du forsøge at gennemtvinge udskubning af dette medie?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Kunne ikke indsætte den virtuelle diskette <nobr><b>%1</b></nobr> i maskinen <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Kunne ikke skubbe den virtuelle diskette <nobr><b>%1</b></nobr> ud i maskinen <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Kunne ikke åbne harddisk-aftrykket <nobr><b>%1</b></nobr>. </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Kunne ikke åbne optisk-disk-aftrykket <nobr><b>%1</b></nobr>. </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Kunne ikke åbne diskette-aftrykket <nobr><b>%1</b></nobr>. </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Kunne ikke lukke harddisk-aftrykket <nobr><b>%2</b></nobr>. </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Kunne ikke lukke optisk-disk-aftrykket <nobr><b>%2</b></nobr>. </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Kunne ikke lukke diskette-aftrykket <nobr><b>%2</b></nobr>. </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation>
-            <numerusform><p>De virtuelle maskiner <b>%1</b> har gemte tilstande.</p><p>Hvis du fortsætter vil kørselstilstanden af de eksporterede maskiner blive kasseret. De øvrige maskiner ændres ikke.</p></numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
             <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source>Switch</source>
-        <translation>Skift</translation>
+        <translation type="unfinished">Skift</translation>
     </message>
     <message>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>Kunne ikke starte fjernskrivebord-servicen for den virtuelle maskine <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>Kunne ikke stoppe fjernskrivebord-servicen for den virtuelle maskine <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>Kunne ikke starte videooptagelse for den virtuelle maskine <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>Kunne ikke stoppe videooptagelse for den virtuelle maskine <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>Kunne ikke finde  <b>VirtualBox Gæstetilføjelser</b> diskaftrykket </p><p>Vil du hente det fra internettet?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Download</source>
-        <translation>Hent</translation>
+        <translation type="unfinished">Hent</translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Er du sikker på at du vil hente <b>VirtualBox Gæstetilføjelser</b> diskaftrykket fra <nobr><a href="%1">%1</a></nobr> (%2 bytes)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p><b>VirtualBox Gæstetilføjelser</b> diskaftrykket er blevet hentet fra <nobr><a href="%1">%1</a></nobr> men kan ikke gemmes lokalt som <nobr><b>%2</b>.</nobr></p><p>Vælg en anden placering til filen.</p></translation>
-    </message>
-    <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p><b>VirtualBox Gæstetilføjelser</b> diskaftrykket er blevet hentet fra <nobr><a href="%1">%1</a></nobr> og gemt lokalt som <nobr><b>%2</b>.</nobr></p><p>Vil du montere dette diskaftryk som et virtuelt CD/DVD-drev?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Kunne ikke indsætte <b>VirtualBox Gæstetilføjelser</b> diskaftrykket i den virtuelle maskine <b>%1</b>, da maskinen ikke har et CD/DVD-drev. Tilføj et drev på siden Lagringsmedier i indstillingerne for den virtuelle maskine.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation><p>Kunne ikke finde <b>VirtualBox brugermanual</b> <nobr><b>%1</b>.</nobr></p><p>Ønsker du at hente denne fil fra internettet?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Er du sikker på at du vil hente <b>VirtualBox brugermanual</b> fra <nobr><a href="%1">%1</a></nobr> (%2 bytes)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>VirtualBox brugermanualen blev hentet fra <nobr><a href="%1">%1</a></nobr> men kunne ikke gemmes lokalt som <nobr><b>%2</b>.</nobr></p><p>Vælg venligst en anden placering til filen.</p></translation>
+        <translation type="unfinished"><p>VirtualBox' brugermanual blev hentet fra <nobr><a href="%1">%2</a></nobr> men kunne ikke gemmes lokalt som <nobr><b>%3</b>.</nobr></p><p>Vælg venligtst en anden placering til filen.</p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>VirtualBox brugermanualen blev hentet fra <nobr><a href="%1">%1</a></nobr> og gemt lokalt som <nobr><b>%2</b>.</nobr></p></translation>
+        <translation type="unfinished"><p>VirtualBox' brugermanual blev hentet fra <nobr><a href="%1">%2</a></nobr> og gemt lokalt som <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source>Close</source>
-        <translation>Luk</translation>
+        <translation type="unfinished">Luk</translation>
     </message>
     <message>
         <source>Ok</source>
-        <translation>OK</translation>
+        <translation type="unfinished">OK</translation>
     </message>
     <message>
         <source>Do not show this message again</source>
-        <translation>Vis ikke denne besked igen</translation>
+        <translation type="unfinished">Vis ikke denne besked igen</translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>Vil du fjerne NAT-netværket <nobr><b>%1</b>?</nobr></p><p>Hvis dette netværk bruges af en eller flere virtuelle maskiners netværkskort, vil disse netværkskort ikke fungere indtil du retter deres indstillinger enten ved at vælge et andet netværksnavn eller en anden forbindelsestype.</p></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>VirtualBox Gæstetilføjelser er tilsyneladende ikke tilgængelige på denne virtuelle maskine og delte mapper fungerer ikke uden. For at kunne anvende delte mapper i den virtuelle maskine, skal du installere gæstetilføjelserne, hvis de ikke er installeret eller geninstallere, hvis de ikke fungerer korrekt ved at vælge <b>Installér gæstetilføjelser</b> fra menuen <b>Enheder</b>. Delte mapper vil først være tilgængelige, nå [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Montér</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Kunne ikke tilslutte webkameraet <b>%1</b> til den virtuelle maskine <b>%2</b>.</translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Kunne ikke fjerne webkameraet <b>%1</b> fra den virtuelle maskine <b>%2</b>.</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>Den virtuelle skærm er sat til <b>%1&nbsp;bit</b> farver. Brug i stedet <b>%2&nbsp;bit</b> for bedre ydelse. Dette kan normalt ændres via <b>Skærm</b>-indstillingerne i gæsteoperativsystemets kontrolpanel eller systemindstillinger.</p></translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8181,19 +8894,19 @@ p, li { white-space: pre-wrap; }
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation>Vis altid værktøjslinjen</translation>
+        <translation type="unfinished">Vis altid værktøjslinjen</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation>Minimér vindue</translation>
+        <translation type="unfinished">Minimér vindue</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Forlad fuldskærm/rammefri tilstand</translation>
+        <translation type="unfinished">Forlad fuldskærm/rammefri tilstand</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation>Luk virtuel maskine</translation>
+        <translation type="unfinished">Luk virtuel maskine</translation>
     </message>
 </context>
 <context>
@@ -8210,7 +8923,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Navn:</translation>
     </message>
     <message>
@@ -8270,7 +8983,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation>Netværkshandlingen fejlede med følgende besked: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8297,27 +9010,27 @@ p, li { white-space: pre-wrap; }
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation>Vært ikke fundet</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation>Adgang til indhold nægtet</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation>Protokolfejl</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>Forkert format af SSL-certifikat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>SSL-godkendelse fejlede</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>Ukendt årsag</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8999,7 +9712,7 @@ p, li { white-space: pre-wrap; }
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>Klik for alle detaljer</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9133,14 +9846,18 @@ p, li { white-space: pre-wrap; }
         <translation>Virtuel maskine-filer (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Velkommen til VirtualBox!</h3><p>Den venstre side af dette vindue viser alle virtuelle maskiner på din computer. Lige nu er listen tom, fordi du ikke har oprettet nogle virtuelle maskiner endnu.<img src=:/welcome.png align=right/></p><p>For at oprette en virtuel maskine, klik på knappen <b>Ny</b> i værktøjslinjen øverst i vinduet.</p><p>Du kan også trykke <b>%1</b> for at få hjælp eller besøg [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Velkommen til VirtualBox!</h3><p>Den venstre side af dette vindue viser alle virtuelle maskiner på din computer. Lige nu er listen tom, fordi du ikke har oprettet nogle virtuelle maskiner endnu.<img src=:/welcome.png align=right/></p><p>For at oprette en virtuel maskine, klik på knappen <b>Ny</b> i værktøjslinjen øverst i vinduet.</p><p>Du kan også trykke <b>%1</b> for at få h [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Håndtering</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9173,15 +9890,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Settings</source>
-        <translation>Indstillinger</translation>
+        <translation type="obsolete">Indstillinger</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation><b>%1</b> side:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation><b>%1: %2</b> side:</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9227,6 +9944,10 @@ p, li { white-space: pre-wrap; }
         <source>Display</source>
         <translation>Skærm</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -9303,6 +10024,43 @@ p, li { white-space: pre-wrap; }
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">du bruger netop nu flere lager-styreenheder end et %1 chipset understøtter. Tilpas chipset-typen under System-indstillinger eller formindsk antallet af de følgende lager-styreenheder under Lager-indstillinger: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Indstillinger</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Luk</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -9398,8 +10156,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Oversigt</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Der er frigivet en ny version af VirtualBox! Version <b>%1</b> er tilgængelig fra <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Du kan hente den nye version her:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Der er frigivet en ny version af VirtualBox! Version <b>%1</b> er tilgængelig fra <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Du kan hente den nye version her:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -9467,6 +10225,14 @@ p, li { white-space: pre-wrap; }
         <source>&Restore current snapshot '%1'</source>
         <translation>Genindlæs øjebliksbillede '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -9480,115 +10246,275 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>Utilgængelig</translation>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Sessionsinformation</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 siden %3</nobr><br><nobr>Session %4</nobr></translation>
+        <source>&Details</source>
+        <translation type="obsolete">&Detaljer</translation>
     </message>
     <message>
-        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
-        <comment>Inaccessible VM tooltip (name, last state change)</comment>
-        <translation><nobr><b>%1</b><br></nobr><nobr>Utilgængelig siden %2</nobr></translation>
+        <source>&Runtime</source>
+        <translation type="obsolete">Afvikling</translation>
     </message>
     <message>
-        <source>S&how</source>
-        <translation type="obsolete">Vis</translation>
+        <source>DMA Transfers</source>
+        <translation>DMA-overførsler</translation>
     </message>
     <message>
-        <source>Switch to the window of the selected virtual machine</source>
-        <translation type="obsolete">Skift til den valgte virtuelle maskines vindue</translation>
+        <source>PIO Transfers</source>
+        <translation>PIO-overførsler</translation>
     </message>
     <message>
-        <source>S&tart</source>
-        <translation type="obsolete">S&tart</translation>
+        <source>Data Read</source>
+        <translation>Data læst</translation>
     </message>
     <message>
-        <source>Start the selected virtual machine</source>
-        <translation type="obsolete">Start den valgte virtuelle maskine</translation>
+        <source>Data Written</source>
+        <translation>Data skrevet</translation>
     </message>
     <message>
-        <source>R&esume</source>
-        <translation type="obsolete">G&enoptag</translation>
+        <source>Data Transmitted</source>
+        <translation>Data sendt</translation>
     </message>
     <message>
-        <source>Resume the execution of the virtual machine</source>
-        <translation type="obsolete">Genoptag afviklingen af den virtuelle maskine</translation>
+        <source>Data Received</source>
+        <translation>Data modtaget</translation>
     </message>
     <message>
-        <source>&Pause</source>
-        <translation type="obsolete">&Pause</translation>
+        <source>Runtime Attributes</source>
+        <translation>Afviklingsindstillinger</translation>
     </message>
     <message>
-        <source>Suspend the execution of the virtual machine</source>
-        <translation type="obsolete">Suspendér afviklingen af den virtuelle maskine</translation>
+        <source>Screen Resolution</source>
+        <translation>Skærmopløsning</translation>
     </message>
-</context>
-<context>
-    <name>UIVMLogViewer</name>
     <message>
-        <source>Close the search panel</source>
-        <translation>Luk søgevinduet</translation>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">CD/DVD-statistik</translation>
     </message>
     <message>
-        <source>&Find</source>
-        <translation>&Find</translation>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Netværkskort-statistik</translation>
     </message>
     <message>
-        <source>Enter a search string here</source>
-        <translation>Indtast dit søgekriterie her</translation>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Version %1.%2</translation>
     </message>
     <message>
-        <source>&Previous</source>
-        <translation>Forrige</translation>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Ikke fundet</translation>
     </message>
     <message>
-        <source>Search for the previous occurrence of the string</source>
-        <translation>Find forrige forekomst af strengen</translation>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Ikke fundet</translation>
     </message>
     <message>
-        <source>&Next</source>
-        <translation>&Næste</translation>
+        <source>Guest Additions</source>
+        <translation>Gæstetilføjelser</translation>
     </message>
     <message>
-        <source>Search for the next occurrence of the string</source>
-        <translation>Find næste forekomst af strengen</translation>
+        <source>Guest OS Type</source>
+        <translation>Gæsteoperativsystemtype</translation>
     </message>
     <message>
-        <source>C&ase Sensitive</source>
-        <translation>Forskel på store/små bogst&aver</translation>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Harddisk-statistik</translation>
     </message>
     <message>
-        <source>Perform case sensitive search (when checked)</source>
-        <translation>Søgning skelner mellem store og små bogstaver</translation>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Ingen harddiske</translation>
     </message>
     <message>
-        <source>String not found</source>
-        <translation>Strengen blev ikke fundet</translation>
+        <source>No Network Adapters</source>
+        <translation>Ingen netværkskort</translation>
     </message>
     <message>
-        <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
-        <translation><p>Ingen logfiler fundet. Tryk <b>Opdatér</b> for at skanne mappen med logfiler igen <nobr><b>%1</b></nobr>.</p></translation>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Slået til</translation>
     </message>
     <message>
-        <source>Save VirtualBox Log As</source>
-        <translation>Gem VirtualBox-log som</translation>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Slået fra</translation>
     </message>
     <message>
-        <source>%1 - VirtualBox Log Viewer</source>
-        <translation>%1 - VirtualBox logfilsfremviser</translation>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Nested Paging</translation>
     </message>
     <message>
-        <source>&Refresh</source>
-        <translation>Opdaté&r</translation>
+        <source>UIVMInfoDialog</source>
+        <translatorcomment>Probably should not be translated</translatorcomment>
+        <translation type="obsolete">UIVMInfoDialog</translation>
     </message>
     <message>
-        <source>&Save</source>
-        <translation>Gem</translation>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Ikke tilgængelig</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Lagermediestatistik</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Ingen lagerenheder</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Netværksstatistik</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Nested Paging</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Ikke tilgængelig</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Udklipsholdertilstand</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Træk og slip-tilstand</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>Utilgængelig</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation><nobr>%1<br></nobr><nobr>%2 siden %3</nobr><br><nobr>Session %4</nobr></translation>
+    </message>
+    <message>
+        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
+        <comment>Inaccessible VM tooltip (name, last state change)</comment>
+        <translation><nobr><b>%1</b><br></nobr><nobr>Utilgængelig siden %2</nobr></translation>
+    </message>
+    <message>
+        <source>S&how</source>
+        <translation type="obsolete">Vis</translation>
+    </message>
+    <message>
+        <source>Switch to the window of the selected virtual machine</source>
+        <translation type="obsolete">Skift til den valgte virtuelle maskines vindue</translation>
+    </message>
+    <message>
+        <source>S&tart</source>
+        <translation type="obsolete">S&tart</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machine</source>
+        <translation type="obsolete">Start den valgte virtuelle maskine</translation>
+    </message>
+    <message>
+        <source>R&esume</source>
+        <translation type="obsolete">G&enoptag</translation>
+    </message>
+    <message>
+        <source>Resume the execution of the virtual machine</source>
+        <translation type="obsolete">Genoptag afviklingen af den virtuelle maskine</translation>
+    </message>
+    <message>
+        <source>&Pause</source>
+        <translation type="obsolete">&Pause</translation>
+    </message>
+    <message>
+        <source>Suspend the execution of the virtual machine</source>
+        <translation type="obsolete">Suspendér afviklingen af den virtuelle maskine</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMLogViewer</name>
+    <message>
+        <source>Close the search panel</source>
+        <translation>Luk søgevinduet</translation>
+    </message>
+    <message>
+        <source>&Find</source>
+        <translation>&Find</translation>
+    </message>
+    <message>
+        <source>Enter a search string here</source>
+        <translation>Indtast dit søgekriterie her</translation>
+    </message>
+    <message>
+        <source>&Previous</source>
+        <translation>Forrige</translation>
+    </message>
+    <message>
+        <source>Search for the previous occurrence of the string</source>
+        <translation>Find forrige forekomst af strengen</translation>
+    </message>
+    <message>
+        <source>&Next</source>
+        <translation>&Næste</translation>
+    </message>
+    <message>
+        <source>Search for the next occurrence of the string</source>
+        <translation>Find næste forekomst af strengen</translation>
+    </message>
+    <message>
+        <source>C&ase Sensitive</source>
+        <translation>Forskel på store/små bogst&aver</translation>
+    </message>
+    <message>
+        <source>Perform case sensitive search (when checked)</source>
+        <translation>Søgning skelner mellem store og små bogstaver</translation>
+    </message>
+    <message>
+        <source>String not found</source>
+        <translation>Strengen blev ikke fundet</translation>
+    </message>
+    <message>
+        <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
+        <translation><p>Ingen logfiler fundet. Tryk <b>Opdatér</b> for at skanne mappen med logfiler igen <nobr><b>%1</b></nobr>.</p></translation>
+    </message>
+    <message>
+        <source>Save VirtualBox Log As</source>
+        <translation>Gem VirtualBox-log som</translation>
+    </message>
+    <message>
+        <source>%1 - VirtualBox Log Viewer</source>
+        <translation>%1 - VirtualBox logfilsfremviser</translation>
+    </message>
+    <message>
+        <source>&Refresh</source>
+        <translation>Opdaté&r</translation>
+    </message>
+    <message>
+        <source>&Save</source>
+        <translation>Gem</translation>
     </message>
     <message>
         <source>Close</source>
@@ -9630,11 +10556,27 @@ p, li { white-space: pre-wrap; }
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Skjul beskrivelse</translation>
+        <translation type="obsolete">Skjul beskrivelse</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Vis beskrivelse</translation>
+        <translation type="obsolete">Vis beskrivelse</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9965,39 +10907,39 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Storage settings</source>
-        <translation>Lagerindstillinger</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>Angiv filnavnet, det prækonfigurerede system skal gemmes under</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>F&ormat:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>Skriv i standard OVF 1.0-format.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>Skriv i nyt eksperimentelt OVF 2.0-format.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation>Lagerind&stillinger</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10016,14 +10958,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Angiv filnavnet, det prækonfigurerede system skal gemmes under...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Angiv filnavnet, det prækonfigurerede system skal gemmes under...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10093,15 +11035,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation>Importer virtuelt Prækonfigureret system</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>Vælg en prækonfigureret system-fil til import...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>Vælg en prækonfigureret system-fil til import</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10470,11 +11412,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Konfigurér deling af mapper</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Installér Gæstetilføjelser...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Monterer CD'en med Gæstetilføjelser</translation>
     </message>
     <message>
@@ -10685,7 +11627,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">I&nformation om session</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Vis sessionsinformation</translation>
     </message>
     <message>
@@ -10889,7 +11831,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose...</source>
-        <translation>Vælg...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10899,8 +11841,8 @@ p, li { white-space: pre-wrap; }
         <translation><nulstil til standard></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>Den korrekte standardsti vil blive vist når du accepterer ændringerne og åbner dette vindue igen.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Den korrekte standardsti vil blive vist når du accepterer ændringerne og åbner dette vindue igen.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -10948,8 +11890,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Den korrekte standardsti vil blive vist når du accepterer ændringerne og åbner dette vindue igen.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11269,7 +12210,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -12036,17 +12977,17 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Tilslutning af denne harddisk vil blive gjort indirekte via en nyoprettet Ændrings-harddisk.</translation>
+        <translation type="obsolete">Tilslutning af denne harddisk vil blive gjort indirekte via en nyoprettet Ændrings-harddisk.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Nogle af enhederne i harddisk-kæden er utilgængelige. Brug funktionen <b>Vis ændrings-harddiske</b> i Virtuel diskhåndtering for at undersøge problemet nærmere.</translation>
+        <translation type="obsolete">Nogle af enhederne i harddisk-kæden er utilgængelige. Brug funktionen <b>Vis ændrings-harddiske</b> i Virtuel diskhåndtering for at undersøge problemet nærmere.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Denne harddisk er indirekte tilsluttet gennem ændrings-harddisken:</translation>
+        <translation type="obsolete">Denne harddisk er indirekte tilsluttet gennem ændrings-harddisken:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -12092,7 +13033,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -12648,67 +13589,201 @@ p, li { white-space: pre-wrap; }
         <translation>Angiv placeringen af den nye virtuelle disk-fil</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Aktiveret</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Deaktiveret</translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
-        <translation>Ubegrænset afvikling</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>PS/2 Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>PS/2-mus</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>USB-mus</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>PS/2 and USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>PS/2 og USB-mus</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
-        <translation>Ubegrænset afvikling</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation>USB-tablet</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Multi-Touch Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation>USB-tablet med multitouch</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network</source>
         <comment>NetworkAttachmentType</comment>
-        <translation>NAT-netværk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT network, '%1'</source>
         <comment>details report (network)</comment>
-        <translation>NAT-netværk, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Du kan oprette og tilføje diskaftryk i Virtuel diskhåndtering.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Ingen</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Standard</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -13016,6 +14091,18 @@ p, li { white-space: pre-wrap; }
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Opret en ny virtuel harddisk</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13093,8 +14180,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Vælg land/område</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Udfyld venligst denne registreringsformular for at lade os vide at du bruger VirtualBox og, hvis du ønsker det, så vi kan holde dig underrettet om VirtualBox-nyheder og opdateringer.</p><p>Brug latinske bogstaver i nedenstående felter. Vær opmærksom på at Sun Microsystems kun bruger denne information til at indsamle brugsstatistik og til at sende dig nyhedsbreve om VirtualBox. Sun Microsystems vil aldrig overgive dine data til tre [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Udfyld venligst denne registreringsformular for at lade os vide at du bruger VirtualBox og, hvis du ønsker det, så vi kan holde dig underrettet om VirtualBox-nyheder og opdateringer.</p><p>Brug latinske bogstaver i nedenstående felter. Vær opmærksom på at Sun Microsystems kun bruger denne information til at indsamle brugsstatistik og til at sende dig nyhedsbreve om VirtualBox. Sun Microsystems vil aldrig overgive dine data til tre [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -13295,8 +14382,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Suspendér afviklingen af den virtuelle maskine</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Velkommen til VirtualBox!</h3><p>Den venstre side af dette vindue viser alle virtuelle maskiner på din computer. Lige nu er listen tom, fordi du ikke har oprettet nogle virtuelle maskiner endnu.<img src=:/welcome.png align=right/></p><p>For at oprette en virtuel maskine, klik på knappen <b>Ny</b> i værktøjslinjen.</p><p>Du kan også trykke <b>%1</b> for at få hjælp eller besøge [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Velkommen til VirtualBox!</h3><p>Den venstre side af dette vindue viser alle virtuelle maskiner på din computer. Lige nu er listen tom, fordi du ikke har oprettet nogle virtuelle maskiner endnu.<img src=:/welcome.png align=right/></p><p>For at oprette en virtuel maskine, klik på knappen <b>Ny</b> i værktøjslinjen.</p><p>Du kan også trykke <b>%1</b> for at få hjælp eller besøge [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -13767,158 +14854,6 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Sessionsinformation</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detaljer</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">Afvikling</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA-overførsler</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO-overførsler</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Data læst</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Data skrevet</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Data sendt</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Data modtaget</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Afviklingsindstillinger</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Skærmopløsning</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">CD/DVD-statistik</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Netværkskort-statistik</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Version %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Ikke fundet</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Ikke fundet</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Gæstetilføjelser</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Gæsteoperativsystemtype</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Harddisk-statistik</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Ingen harddiske</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Ingen netværkskort</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Slået til</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Slået fra</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Nested Paging</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translatorcomment>Probably should not be translated</translatorcomment>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Ikke tilgængelig</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Lagermediestatistik</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Ingen lagerenheder</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Netværksstatistik</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Nested Paging</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Ikke tilgængelig</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Udklipsholdertilstand</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Træk og slip-tilstand</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>Konfigurations&detaljer</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Kø&retidsinformation</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_de.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_de.ts
index 42d51ef..34162b4 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_de.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_de.ts
@@ -172,31 +172,31 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>&Mauszeiger-Integration deaktivieren</translation>
+        <translation type="obsolete">&Mauszeiger-Integration deaktivieren</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Integration des Mauszeigers vorübergehend deaktivieren</translation>
+        <translation type="obsolete">Integration des Mauszeigers vorübergehend deaktivieren</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Sende Strg-Alt-Entf</translation>
+        <translation type="obsolete">&Sende Strg-Alt-Entf</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Sendet die Sequenz Strg-Alt-Entf (Affengriff) an die virtuelle Maschine</translation>
+        <translation type="obsolete">Sendet die Sequenz Strg-Alt-Entf (Affengriff) an die virtuelle Maschine</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Sendet die Sequenz Strg-Alt-Rücktaste an die virtuelle Maschine</translation>
+        <translation type="obsolete">Sendet die Sequenz Strg-Alt-Rücktaste an die virtuelle Maschine</translation>
     </message>
     <message>
         <source>Take a snapshot of the virtual machine</source>
         <translation>Erstellt einen Sicherungspunkt der virtuellen Maschine</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Zeigt einen Dialog mit Sitzungsinformationen</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Zeigt einen Dialog mit Sitzungsinformationen</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -240,15 +240,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD-Laufwerke</translation>
+        <translation type="obsolete">&CD/DVD-Laufwerke</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Diskettenlaufwerke</translation>
+        <translation type="obsolete">&Diskettenlaufwerke</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB-Geräte</translation>
+        <translation type="obsolete">&USB-Geräte</translation>
     </message>
     <message>
         <source>Change the settings of network adapters</source>
@@ -259,12 +259,12 @@
         <translation>Öffnet den Dialog für gemeinsame Ordner</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>Medium mit &Gasterweiterungen einlegen...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Gasterweiterungen installieren...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Medium mit den VirtualBox-Gasterweiterungen einbinden</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Medium mit den VirtualBox-Gasterweiterungen einbinden</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -298,15 +298,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>&Vollbildmodus einschalten</translation>
+        <translation type="obsolete">&Vollbildmodus einschalten</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Schaltet in den Vollbildmodus bzw zurück</translation>
+        <translation type="obsolete">Schaltet in den Vollbildmodus bzw zurück</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>&Nahtlosen Modus einschalten</translation>
+        <translation type="obsolete">&Nahtlosen Modus einschalten</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -314,7 +314,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>&Skalierten Modus einschalten</translation>
+        <translation type="obsolete">&Skalierten Modus einschalten</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -390,7 +390,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Sende Strg-Alt-&Rücktaste</translation>
+        <translation type="obsolete">Sende Strg-Alt-&Rücktaste</translation>
     </message>
     <message>
         <source>&File</source>
@@ -541,7 +541,7 @@
     </message>
     <message>
         <source>&VirtualBox Web Site...</source>
-        <translation>Webseite von &VirtualBox...</translation>
+        <translation>&VirtualBox-Webseite...</translation>
     </message>
     <message>
         <source>&Reset All Warnings</source>
@@ -653,7 +653,7 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Drag'n'Drop</translation>
+        <translation type="obsolete">Drag'n'Drop</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
@@ -665,7 +665,7 @@
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>&Netzwerkeinstellungen...</translation>
+        <translation>&Einstellungen für Netzwerk...</translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
@@ -698,20 +698,271 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&Logging...</translation>
+        <translation type="obsolete">&Logging...</translation>
     </message>
     <message>
         <source>Popup Menu</source>
         <translation>Menü in Fullscreen/Seamless</translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation>Zeigt einen Dialog mit Sitzungsinformationen</translation>
+    </message>
+    <message>
         <source>&Webcams</source>
         <translation>&Webcams</translation>
     </message>
     <message>
+        <source>&Insert Guest Additions CD image...</source>
+        <translation>&Gasterweiterungen einlegen...</translation>
+    </message>
+    <message>
+        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <translation>Legt das Medium mit den Gasterweiterungen in das virtuelle CD/DVD-Laufwerk</translation>
+    </message>
+    <message>
+        <source>&VirtualBox</source>
+        <translation>&VirtualBox</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>&Menüleiste</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>&Einstelungen...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>Öffnet einen Dialog für die Konfiguration der Menüzeile</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>Zeigt die &Menüleiste</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>Menüzeile für diese virtuelle Maschine ein-/ausschalten</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>&Statusleiste</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>&Einstellungen für Statusleiste...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>Öffnet ein Fenster zum Konfigurieren der Statuszeile</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>Zeige &Statuszeile</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>Statuszeile für diese virtuelle Maschine ein-/ausschalten</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>&Eingabe</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>&Tastatur</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>&Einstellungen für Tastatur...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>Öffnet das Fenster zum Konfigurieren der Tastenkombinationen</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>&Maus</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>&Festplatten</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>&Einstellungen für Festplatten...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>Einstellungen für Festplatten ändern</translation>
+    </message>
+    <message>
         <source>Network</source>
         <translation>Netzwerk</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>&Einstellungen für USB...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>Einstellungen für USB-Geräte ändern</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>&Gemeinsame Ordner</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>Zeige &Log...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation>Manager für &Extradata...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>Zeigt den Manager für Extradata an</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>&Datei</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation>&Fenster</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>&Minimieren</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>Minimiert das aktive Fenster</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>&Vollbildmodus</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>Wechselt zwischen normalem Modus und Vollbildmodus</translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation>&Nahtloser Modus</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>&Skalierter Modus</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>Skalierungs&faktor</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>&Einfügen %1</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>Sendet %1 an die virtuelle Maschine</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>&Mauszeiger-Integration</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>Aktiviert die Mauszeiger-Integration</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>&Optische Laufwerke</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>&Diskettenlaufwerke</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>Drag und Drop</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>&Logging</translation>
+    </message>
+    <message>
+        <source>&Default Start</source>
+        <translation type="obsolete">&Normaler Start</translation>
+    </message>
+    <message>
+        <source>S&eparate Start</source>
+        <translation type="obsolete">&Abgekoppelter Start</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with detachable GUI</source>
+        <translation type="obsolete">Startet die virtuelle Maschine und erlaubt das Abkoppeln der GUI</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation>&Normal starten</translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation>&Ohne GUI starten</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation>Startet die ausgewählten virtuellen Maschinen im Hintergrund</translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation>&Abkoppelbarer Start</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation>Startet die ausgewählten virtuellen Maschinen mit der Möglichkeit, diese im Hintergrund laufen zu lassen</translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>Aktivieren</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>Ändern nach %1x%2</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation></translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - Festplattenverschlüsselung</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>Diese virtuelle Maschine ist passwortgeschützt. Bitte geben Sie das Passwort zum Entsperren ein.</numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -847,6 +1098,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation>Empfange Daten ...</translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -857,7 +1115,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Kopiere Daten ...</translation>
+        <translation type="obsolete">Kopiere Daten ...</translation>
     </message>
 </context>
 <context>
@@ -905,6 +1163,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>Passwort</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>Von der folgenden Festplatte benutzt:</nobr><br>%1</numerusform>
+            <numerusform><nobr>Von den folgenden % Festplatten benutzt:</nobr><br>%1</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIGChooserItemGroup</name>
     <message>
         <source><b>%1</b></source>
@@ -1037,11 +1321,6 @@
         <translation>deaktiviert</translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation></translation>
-    </message>
-    <message>
         <source>Controller</source>
         <comment>details (audio)</comment>
         <translation>Controller</translation>
@@ -1230,6 +1509,116 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>Bildgröße: %1x%2, Bildrate: %3fps, Bitrate: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>minimale Virtualisierung</translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Hyper-V-Virtualisierung</translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>KVM-Paravirtualisierung</translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[DVD]</translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>USB-Controller</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Skalierungsfaktor</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Nicht skalierte HiDPI-Auflösung</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">aktiviert</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>Position der Mini-Toolbar</translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>oben</translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>unten</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>Mini-Toolbar</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>deaktiviert</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">Skalierungsfaktor</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">Nicht skalierte HiDPI-Auflösung</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">aktiviert</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">aktiviert</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">deaktiviert</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">aktiviert</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">deaktiviert</translation>
+    </message>
 </context>
 <context>
     <name>UIGMachinePreview</name>
@@ -1317,11 +1706,11 @@
     </message>
     <message>
         <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation>Wird die Maus von einem Fenster eines Gastes auf ein anderes Fenster desselben Gastes bewegt, dann wird das neue Fenster automatisch aktiviert.</translation>
+        <translation>Holt das Fenster der virtuellen Maschine unter der Maus hervor, wenn der Mauszeiger über das Fenster fährt.</translation>
     </message>
     <message>
         <source>&Raise Window Under Mouse</source>
-        <translation>Fenster unter Maus &aktivieren</translation>
+        <translation>&Fenster unter Mauszeiger hervorholen</translation>
     </message>
 </context>
 <context>
@@ -1387,15 +1776,15 @@
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation>&Dock und Menübar:</translation>
+        <translation type="obsolete">&Dock und Menübar:</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation>Automatisch im Vollbildmodus</translation>
+        <translation type="obsolete">Automatisch im Vollbildmodus</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Das Host-Dock und die Menüleiste wird gezeigt, wenn sich die VM im Vollbildmodus befindet.</translation>
+        <translation type="obsolete">Das Host-Dock und die Menüleiste wird gezeigt, wenn sich die VM im Vollbildmodus befindet.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
@@ -1648,7 +2037,7 @@
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (umbenannt von %2)</translation>
+        <translation>%1 (umbenannt zu %2)</translation>
     </message>
     <message>
         <source>Old Network Name</source>
@@ -2140,12 +2529,12 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Zeigt die Aktivität der CD/DVD-Laufwerke:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Zeigt die Aktivität der CD/DVD-Laufwerke:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Zeigt die Aktivität der Diskettenlaufwerke:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Zeigt die Aktivität der Diskettenlaufwerke:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -2185,7 +2574,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB-Controller ist deaktiviert</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB-Controller ist deaktiviert</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -2227,6 +2616,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation>Status zusätzlicher Features:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>Zeigt die Aktivität der Gastanzeige:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Zeigt die optischen Laufwerke:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Zeigt die Aktivität der Diskettenlaufwerke:</nobr>%1</p></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -2259,11 +2662,11 @@
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>Keine Webcams verbunden</translation>
+        <translation>Keine Webcam angeschlossen</translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Keine unterstützten Webcams mit dem PC verbunden</translation>
+        <translation>Keine unterstützen Webcams am PC angeschlossen</translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
@@ -2309,7 +2712,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Anzeige</translation>
+        <translation type="obsolete">&Anzeige</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -2473,7 +2876,7 @@
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>In den Video-Einstellungen wurde hardwarebeschleunigtes 3D aktiviert, und der Typ des Gastes wurde als Windows Vista oder später eingestellt. Für beste Performance sollte der Grafikspeicher auf mindestens <b>%1</b> eingestellt werden.</translation>
+        <translation type="obsolete">In den Video-Einstellungen wurde hardwarebeschleunigtes 3D aktiviert, und der Typ des Gastes wurde als Windows Vista oder später eingestellt. Für beste Performance sollte der Grafikspeicher auf mindestens <b>%1</b> eingestellt werden.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -2527,39 +2930,106 @@
         <translation>Videoaufzeichnung für Bildschirm %1 aktivieren.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translatorcomment>Die Fernsteu</translatorcomment>
-        <translation>Die Fernsteuerung per Remote Desktop Protocol wurde für diese virtuelle Maschine aktiviert. Dafür ist allerdings die Installation des <b>%1</b> notwendig. Bitte installieren Sie dieses Zusatzpaket von der VirtualBox-Webseite, sonst wird die virtuelle Maschine mit deaktivierter Fernsteuerung gestartet.</translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Mini-Toolbar:</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>Zeigt den Pfad an, wo Sicherungspunkte für diese virtuelle Maschine gespeichert werden. Beachten Sie, dass Sicherungspunkte viel Platz beanspruchen können.</translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Falls aktiviert wird die Mini-Toolbar im Vollbildmodus und im nahtlosen Modus gezeigt.</translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>&Basis</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">im &Vollbild-/Seamless-Modus zeigen</translation>
     </message>
     <message>
-        <source>&Advanced</source>
-        <translation>&Erweitert</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Zeigt die Mini-Toolbar am oberen Rand des Bildschirms wenn ausgewählt, sonst am unteren Rand.</translation>
     </message>
     <message>
-        <source>&Shared Clipboard:</source>
-        <translation>&Gemeinsame Zwischenablage:</translation>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">am &oberen Bildschirmrand zeigen</translation>
     </message>
     <message>
-        <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>Legt den Modus der gemeinsamen Zwischenablage zwischen Host und Gast fest. Dieses Feature benötigt installierte Gasterweiterungen im Gast-Betriebssystem.</translation>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>Ungefährt %1 MB pro Videominute</i></translation>
     </message>
     <message>
-        <source>S&napshot Folder:</source>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation>Die Fernsteuerung wurde für diese virtuelle Maschine aktiviert. Dafür ist allerdings die Installation des <i>%1</i> notwendig. Bitte installieren Sie dieses Zusatzpaket von der VirtualBox-Webseite oder ihre VM wird ohne Fernsteuerung gestartet.</translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation>In den Video-Einstellungen wurde hardwarebeschleunigtes 3D aktiviert, und der Typ des Gastes wurde als Windows Vista oder später eingestellt. Für beste Performance sollte der Grafikspeicher auf mindestens <b>%1</b> eingestellt werden.</translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished">&Nicht-skalierte HiDPI-Ausgabe</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
+    <message>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation>Zeigt den Pfad an, wo Sicherungspunkte für diese virtuelle Maschine gespeichert werden. Beachten Sie, dass Sicherungspunkte viel Platz beanspruchen können.</translation>
+    </message>
+    <message>
+        <source>Basi&c</source>
+        <translation>&Basis</translation>
+    </message>
+    <message>
+        <source>A&dvanced</source>
+        <translation>&Erweitert</translation>
+    </message>
+    <message>
+        <source>&Shared Clipboard:</source>
+        <translation>&Gemeinsame Zwischenablage:</translation>
+    </message>
+    <message>
+        <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <translation>Legt den Modus der gemeinsamen Zwischenablage zwischen Host und Gast fest. Dieses Feature benötigt installierte Gasterweiterungen im Gast-Betriebssystem.</translation>
+    </message>
+    <message>
+        <source>S&napshot Folder:</source>
         <translation>Ordner &Sicherungspunkte:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Beschreibung</translation>
     </message>
     <message>
@@ -2568,38 +3038,38 @@
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Falls ausgewählt, werden zur Laufzeit zugewiesene CD/DVD- oder Diskettenmedien in den Einstellungen gespeichert, um die Zuweisung über die Laufzeit der VM hinaus beizubehalten.</translation>
+        <translation type="obsolete">Falls ausgewählt, werden zur Laufzeit zugewiesene CD/DVD- oder Diskettenmedien in den Einstellungen gespeichert, um die Zuweisung über die Laufzeit der VM hinaus beizubehalten.</translation>
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Entfernbare Medien:</translation>
+        <translation type="obsolete">Entfernbare Medien:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&gebundene Medien merken</translation>
+        <translation type="obsolete">&gebundene Medien merken</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Mini-Toolbar:</translation>
+        <translation type="obsolete">Mini-Toolbar:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Falls aktiviert wird die Mini-Toolbar im Vollbildmodus und im nahtlosen Modus gezeigt.</translation>
+        <translation type="obsolete">Falls aktiviert wird die Mini-Toolbar im Vollbildmodus und im nahtlosen Modus gezeigt.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>am &oberen Bildschirmrand zeigen</translation>
+        <translation type="obsolete">am &oberen Bildschirmrand zeigen</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>im &Vollbild-/Seamless-Modus zeigen</translation>
+        <translation type="obsolete">im &Vollbild-/Seamless-Modus zeigen</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Zeigt die Mini-Toolbar am oberen Rand des Bildschirms wenn ausgewählt, sonst am unteren Rand.</translation>
+        <translation type="obsolete">Zeigt die Mini-Toolbar am oberen Rand des Bildschirms wenn ausgewählt, sonst am unteren Rand.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>&Drag'n'Drop:</translation>
     </message>
     <message>
@@ -2614,6 +3084,106 @@
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation>Der Typ des Gastsystems erlaubt 64-Bit-Gäste. Dafür wird Hardware-Virtualisierung benötigt. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation>&Verschlüsselung</translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>Aktiviert Verschlüsselung für diese virtuelle Maschine.</translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation>&Verschlüsselung aktivieren</translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation>Verschlüsselungs-C&hiffre:</translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>Chiffre, die zur Verschlüsselung der virtuellen Festplatten benutzt wird.</translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation>Neues Passwort &eingeben:</translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>Passwort für diese virtuelle Maschine.</translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation>Neues Passwort &bestätigen:</translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>Bestätigt das Passwort für diese virtuelle Maschine.</translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>Sie möchten diese virtuelle Maschine verschlüsseln. Diese Funktion benötigt die Installation des <i>%1</i>. Bitte installieren Sie dieses Zusatzpaket von der VirtualBox-Webseite.</translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation>Verschlüsselungs-Chiffre nicht ausgewählt.</translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation>Verschlüsselungspasswort nicht gesetzt.</translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation>Verschlüsselungspasswörter stimmen nicht überein.</translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>nicht verändern</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>Ändern der Menüzeile des VM-Fensters.</translation>
+    </message>
+    <message>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">Skalierungsfaktor:</translation>
+    </message>
+    <message>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">Verhindert die Skalierung des Gast-Bildschirminhaltes, die normalerweise für die Anpassung an hohe Auflösung des Host-Bildschirmes vorgenommen wird.</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">&Nicht-skalierte HiDPI-Ausgabe</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation>Mini-Toolbar:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation>Falls aktiviert wird die Mini-Toolbar im Vollbildmodus und im nahtlosen Modus gezeigt.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation>im &Vollbild-/Seamless-Modus zeigen</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation>Zeigt die Mini-Toolbar am oberen Rand des Bildschirms wenn ausgewählt, sonst am unteren Rand.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation>am &oberen Bildschirmrand zeigen</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>Ändern der Statuszeile des VM-Fensters.</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -2935,6 +3505,10 @@
         <translation>Ordner ändern</translation>
     </message>
     <message>
+        <source>Dialog</source>
+        <translation type="obsolete">Dialog</translation>
+    </message>
+    <message>
         <source>Folder Path:</source>
         <translation>Ordner-Pfad:</translation>
     </message>
@@ -2970,10 +3544,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Falls aktiviert wird die Änderung permanent.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Fenster</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -3016,19 +3586,19 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Wenn diese Box ausgewählt wurde, dann wird die Pipe im <b>Portpfad</b> von der virtuellen Maschine erzeugt, wenn diese startet. Anderenfalls versucht die virtuelle Maschine, sich an eine vorhandene Pipe zu anzuschließen.</translation>
+        <translation type="obsolete">Wenn diese Box ausgewählt wurde, dann wird die Pipe im <b>Portpfad</b> von der virtuellen Maschine erzeugt, wenn diese startet. Anderenfalls versucht die virtuelle Maschine, sich an eine vorhandene Pipe zu anzuschließen.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>Erzeuge &Pipe</translation>
+        <translation type="obsolete">Erzeuge &Pipe</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Zeigt den Pfad zur seriellen Port-Pipe des Hostes wenn der Port im Modus <b>Host-Pipe</b> arbeitet oder den Namen der seriellen Schnittstelle des Hostes im Modus <b>Host-Schnittstelle</b>.</translation>
+        <translation type="obsolete">Zeigt den Pfad zur seriellen Port-Pipe des Hostes wenn der Port im Modus <b>Host-Pipe</b> arbeitet oder den Namen der seriellen Schnittstelle des Hostes im Modus <b>Host-Schnittstelle</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Port/Datei-&Pfad:</translation>
+        <translation type="obsolete">Port/Datei-&Pfad:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -3038,6 +3608,22 @@
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Zeigt die Basis-Portadresse dieser seriellen Schnittstelle. Zulässige Werte sind ganze Zahlen im Bereich von <tt>0</tt> bis <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>Mit Pipe/Socket &verbinden</translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation>&Pfad/Adresse:</translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -3078,11 +3664,11 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>CD/DVD-Laufwerk hinzufügen</nobr></translation>
+        <translation type="obsolete"><nobr>CD/DVD-Laufwerk hinzufügen</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Diskettenlaufwerk hinzufügen</nobr></translation>
+        <translation type="obsolete"><nobr>Diskettenlaufwerk hinzufügen</nobr></translation>
     </message>
     <message>
         <source>Add Controller</source>
@@ -3118,11 +3704,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>CD/DVD-Laufwerk hinzufügen</translation>
+        <translation type="obsolete">CD/DVD-Laufwerk hinzufügen</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Diskettenlaufwerk hinzufügen</translation>
+        <translation type="obsolete">Diskettenlaufwerk hinzufügen</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -3254,15 +3840,15 @@
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD-&Laufwerk:</translation>
+        <translation type="obsolete">CD/DVD-&Laufwerk:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Wählen Sie ein virtuelles CD/DVD-Abbild oder ein physisches Laufwerk am Host aus. Der Gast kann auf diese Daten als Medium im virtuellen Laufwerk zugreifen.</translation>
+        <translation type="obsolete">Wählen Sie ein virtuelles CD/DVD-Abbild oder ein physisches Laufwerk am Host aus. Der Gast kann auf diese Daten als Medium im virtuellen Laufwerk zugreifen.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Virtuelles CD/DVD-Laufwerk aufsetzen</translation>
+        <translation type="obsolete">Virtuelles CD/DVD-Laufwerk aufsetzen</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -3286,7 +3872,7 @@
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Datei für virtuelles CD/DVD-Medium auswählen...</translation>
+        <translation type="obsolete">Datei für virtuelles CD/DVD-Medium auswählen...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -3358,6 +3944,54 @@
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>Die Maschon besitzt mehr Controller für Massenspeicher als der Chipsatz %1 unterstützt. Bitte ändern Sie den Chipsatz-Typ auf der Seite der Systemeinstellungen oder löschen Sie Controller auf der folgenden Seite: %2</translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation>USB-Controller hinzufügen</translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>&Hotplug-fähig</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>Wählen Sie ein virtuelles optisches Medium...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>Optisches&nbsp;Laufwerk&nbsp;hinzufügen</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>Floppy-Laufwerk hinzufügen</nobr></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>Optisches Laufwerk hinzufügen</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>Diskettenlaufwerk hinzufügen</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>&Optisches Laufwerk:</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>Wählen Sie ein virtuelles Abbild eines optischen Mediums oder ein physisches Laufwerk am Host aus. Der Gast kann auf diese Daten als Medium im virtuellen Laufwerk zugreifen.</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>Virtuelles optisches Laufwerk aufsetzen</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -3531,11 +4165,11 @@
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>Der I/O-APIC wurde in den System-Einstellungen nicht aktiviert. Der ICH9-Chipsatz erfordert die Emulation von I/O-APICs. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
+        <translation type="obsolete">Der I/O-APIC wurde in den System-Einstellungen nicht aktiviert. Der ICH9-Chipsatz erfordert die Emulation von I/O-APICs. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
     </message>
     <message>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>Die USB-Controller-Emulation wurde nicht aktiviert. Ein USB-Controller wird für das USB-Zeigergerät benötigt. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
+        <translation type="obsolete">Die USB-Controller-Emulation wurde nicht aktiviert. Ein USB-Controller wird für das USB-Zeigergerät benötigt. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
     </message>
     <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
@@ -3547,16 +4181,40 @@
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Der I/O-APIC ist in den Systemeinstellungen deaktiviert. Für Multi-CPU-Gäste ist ein I/O-APIC erforderlich. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
+        <translation type="obsolete">Der I/O-APIC ist in den Systemeinstellungen deaktiviert. Für Multi-CPU-Gäste ist ein I/O-APIC erforderlich. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
     </message>
     <message>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Hardware-Virtualisierung ist in den Systemeinstellungen deaktiviert. Für Multi-CPU-Gäste muss diese Einstellung aber aktiviert sein. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
+        <translation type="obsolete">Hardware-Virtualisierung ist in den Systemeinstellungen deaktiviert. Für Multi-CPU-Gäste muss diese Einstellung aber aktiviert sein. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
     </message>
     <message>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation>Die CPU-Ausführungsbegrenzung wurde auf einen sehr niedrigen Wert gesetzt. Dadurch wird die virtuelle Maschine wahrscheinlich spürbar schlechter reagieren.</translation>
     </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation>&Paravirtualisierung:</translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>Wählt die Art der Paravirtualisierung für diese virtuelle Maschine aus.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Der I/O-APIC wurde in den System-Einstellungen nicht aktiviert. Der ICH9-Chipsatz erfordert die Emulation von I/O-APICs. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Die USB-Controller-Emulation wurde nicht aktiviert. Ein USB-Controller wird für das USB-Zeigergerät benötigt. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Der I/O-APIC ist in den Systemeinstellungen deaktiviert. Für Multi-CPU-Gäste ist ein I/O-APIC erforderlich. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Hardware-Virtualisierung ist in den Systemeinstellungen deaktiviert. Für Multi-CPU-Gäste muss diese Einstellung aber aktiviert sein. Diese Einstellung wird daher beim Bestätigen automatisch aktiviert.</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSB</name>
@@ -3627,7 +4285,7 @@
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>USB-&2.0-Controller aktivieren</translation>
+        <translation type="obsolete">USB-&2.0-Controller aktivieren</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -3683,7 +4341,31 @@
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB-2.0-Unterstützung wurde für diese virtuelle Maschine aktiviert. Dafür ist allerdings die Installation des <b>%1</b> notwendig. Bitte installieren Sie dieses Zusatzpaket von der VirtualBox-Webseite oder deaktivieren Sie die USB-2.0-Unterstützung zum Starten der Maschine.</translation>
+        <translation type="obsolete">USB-2.0-Unterstützung wurde für diese virtuelle Maschine aktiviert. Dafür ist allerdings die Installation des <b>%1</b> notwendig. Bitte installieren Sie dieses Zusatzpaket von der VirtualBox-Webseite oder deaktivieren Sie die USB-2.0-Unterstützung zum Starten der Maschine.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>USB-&1.1-Controller (OHCI)</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>USB-&2.0-Controller (EHCI)</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>Aktiviert den virtuellen xHCI-USB-Controller. Dieser implementiert Unterstützung für USB-3.0-Geräte.</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>USB-&3.0-Controller (xHCI)</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>USB-2.0/3.0-Unterstützung wurde für diese virtuelle Maschine aktiviert. Dafür ist allerdings die Installation des <i>%1</i> notwendig. Bitte installieren Sie dieses Zusatzpaket von der VirtualBox-Webseite oder deaktivieren Sie die USB-2.0/3.0-Unterstützung zum Starten der Maschine.</translation>
     </message>
 </context>
 <context>
@@ -3810,7 +4492,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Schließen</translation>
+        <translation type="obsolete">&Schließen</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation>Entferne Medium...</translation>
     </message>
 </context>
 <context>
@@ -3829,6 +4515,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>Größe virtueller Bildschirme</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>Zuordnungen virtueller Bildschirme</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>Schließen</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>Einschalten</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>Menüzeile anzeigen</translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -3878,7 +4587,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Das COM-Objekt für VirtualBox konnte nicht erzeugt werden.</p><p>Die Anwendung wird nun beendet.</p></translation>
+        <translation type="obsolete"><p>Das COM-Objekt für VirtualBox konnte nicht erzeugt werden.</p><p>Die Anwendung wird nun beendet.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -4031,6 +4740,10 @@
         <translation>Callee&nbsp;RC:</translation>
     </message>
     <message>
+        <source><p>The virtual machine window is optimized to work in <b>%1&nbsp;bit</b> color mode but the virtual display is currently set to <b>%2&nbsp;bit</b>.</p><p>Please open the display properties dialog of the guest OS and select a <b>%3&nbsp;bit</b> color mode, if it is available, for best possible performance of the virtual video subsystem.</p><p><b>Note</b>. Some operating systems, like  [...]
+        <translation type="obsolete"><p>Das Fenster der virtuellen Maschine ist optimiert für eine Anzeige im <b>%1-Bit</b>-Farbmodus, der aktuelle Modus des virtuellen Bildschirms ist aber auf <b>%2-&nbsp;Bit</b> gesetzt.</p><p>Bitte öffnen Sie die Einstellungen für die Anzeige im Gast und wählen Sie den <b>%3-Bit</b>-Farbmodus, falls verfügbar, um die beste Performance der Anzeige zu erreichen.</p><p><b>Beachte [...]
+    </message>
+    <message>
         <source>Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.</source>
         <translation>Die Lizenzdatei <nobr><b>%1</b></nobr> konnte nicht geöffnet werden. Bitte überprüfen Sie die Zugriffsrechte.</translation>
     </message>
@@ -4044,9 +4757,9 @@
         <translation>Verwerfen</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Einbinden</translation>
+        <translation type="obsolete">Einbinden</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -4115,8 +4828,8 @@
         <translation><p>Die virtuelle Maschine meldet Unterstützung der <b>Mauszeiger-Integration</b> durch das Gastsystem. Dies bedeutet, dass die Maus nicht gefangen werden muss, um es im Gastsystem zu benutzen, sondern alle Mausaktionen über der VM-Anzeigebereich werden direkt an den Gast weitergeleitet. Der Fangmodus wird automatisch aufgehoben, falls die Maus momentan gefangen ist.</p><p>Das Mausicon in der Statuszeile wird so &nbsp;<img src=:/mo [...]
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Eine neue Version von VirtualBox ist verfügbar! Version <b>%1</b> ist auf <a href="https://www.virtualbox.org/">virtualbox.org</a> verfügbar.</p><p>Sie können diese Version von der folgenden Adresse herunterladen:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Eine neue Version von VirtualBox ist verfügbar! Version <b>%1</b> ist auf <a href="http://www.virtualbox.org/">virtualbox.org</a> verfügbar.</p><p>Sie können diese Version von der folgenden Adresse herunterladen:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source>Release</source>
@@ -4160,11 +4873,11 @@
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Eine oder mehrere virtuelle Festplatten, CD/DVDs oder Diskettenmedien sind momentan nicht zugreifbar. Virtuelle Maschinen, die diese Medien benutzen, können so lange nicht benutzt werden, bis die Medien wieder zugreifbar werden.</p><p>Wählen Sie <b>Überprüfen</b> um den Manager für virtuelle Medien zu öffnen oder wählen Sie <b>Ignorieren</b>, um dieses Problem zu ignorieren.</p></translation>
+        <translation type="obsolete"><p>Eine oder mehrere virtuelle Festplatten, CD/DVDs oder Diskettenmedien sind momentan nicht zugreifbar. Virtuelle Maschinen, die diese Medien benutzen, können so lange nicht benutzt werden, bis die Medien wieder zugreifbar werden.</p><p>Wählen Sie <b>Überprüfen</b> um den Manager für virtuelle Medien zu öffnen oder wählen Sie <b>Ignorieren</b>, um dieses Problem zu ignorieren.</p></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Ein schwerwiegender Fehler ist aufgetreten, und die Ausführung der virtuellen Maschine wurde unterbrochen.</p><p>Zusätzliche Informationen zu diesem Fehler suchen Sie bitte in der Community-Sektion auf <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> bzw. handeln Sie gemäß Ihres Supportvertrages. Bitte geben Sie die Logdatei <tt>VBox.log</tt>, den Screenshot <tt>VBox.png</tt>, den Sie im Verzei [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Ein schwerwiegender Fehler ist aufgetreten, und die Ausführung der virtuellen Maschine wurde unterbrochen.</p><p>Zusätzliche Informationen zu diesem Fehler suchen Sie bitte in der Community-Sektion auf <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> bzw. handeln Sie gemäß Ihres Supportvertrages. Bitte geben Sie die Logdatei <tt>VBox.log</tt>, den Screenshot <tt>VBox.png</tt>, den [...]
     </message>
     <message>
         <source>You are trying to shut down the guest with the ACPI power button. This is currently not possible because the guest does not support software shutdown.</source>
@@ -4248,7 +4961,7 @@
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Möchten Sie wirklich das CD/DVD-Laufwerk löschen?</p><p>Ohne CD/DVD-Laufwerk können Sie keine CDs oder CD-Abbilder einbinden und die Gast-Erweiterungen nicht installieren!</p></translation>
+        <translation type="obsolete"><p>Möchten Sie wirklich das CD/DVD-Laufwerk löschen?</p><p>Ohne CD/DVD-Laufwerk können Sie keine CDs oder CD-Abbilder einbinden und die Gast-Erweiterungen nicht installieren!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -4309,7 +5022,7 @@
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Sie sind dabei, ein neues CD/DVD-Gerät an den Controller <b>%1</b> anzuschließen.</p><p>Möchten Sie ein Medium an das Laufwerk binden oder soll das Laufwerk jetzt kein Medium enthalten?</p></translation>
+        <translation type="obsolete"><p>Sie sind dabei, ein neues CD/DVD-Gerät an den Controller <b>%1</b> anzuschließen.</p><p>Möchten Sie ein Medium an das Laufwerk binden oder soll das Laufwerk jetzt kein Medium enthalten?</p></translation>
     </message>
     <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
@@ -4337,11 +5050,11 @@
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Das CD/DVD-Laufwerk <nobr><b>%1</b></nobr> konnte nicht vom Slot <i>%2</i> der VM <b>%3</b> entfernt werden.</translation>
+        <translation type="obsolete">Das CD/DVD-Laufwerk <nobr><b>%1</b></nobr> konnte nicht vom Slot <i>%2</i> der VM <b>%3</b> entfernt werden.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Das Diskettenlaufwerk <nobr><b>%1</b></nobr> konnte nicht vom Slot <i>%2</i> der VM <b>%3</b> entfernt werden.</translation>
+        <translation type="obsolete">Das Diskettenlaufwerk <nobr><b>%1</b></nobr> konnte nicht vom Slot <i>%2</i> der VM <b>%3</b> entfernt werden.</translation>
     </message>
     <message>
         <source>Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
@@ -4349,11 +5062,11 @@
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Das CD/DVD-Laufwerk <nobr><b>%1</b></nobr> konnte nicht an den Slot <i>%2</i> der VM <b>%3</b> gebunden werden.</translation>
+        <translation type="obsolete">Das CD/DVD-Laufwerk <nobr><b>%1</b></nobr> konnte nicht an den Slot <i>%2</i> der VM <b>%3</b> gebunden werden.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Das Diskettenlaufwerk <nobr><b>%1</b></nobr> konnte nicht an den Slot <i>%2</i> der VM <b>%3</b> gebunden werden.</translation>
+        <translation type="obsolete">Das Diskettenlaufwerk <nobr><b>%1</b></nobr> konnte nicht an den Slot <i>%2</i> der VM <b>%3</b> gebunden werden.</translation>
     </message>
     <message>
         <source>Failed to open the Extension Pack <b>%1</b>.</source>
@@ -4372,8 +5085,8 @@
         <translation><p>Beachten Sie, dass der Datencontainer dieses Mediums nicht gelöscht wird und Sie daher das Medium später wieder verwenden können.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>Die VirtualBox-Gasterweiterungen sind anscheinend für diese VM nicht verfügbar, sind aber Vorrausetzung für Gemeinsame Ordner. Um diesen Dienst zu benutzen müssen Sie daher die Gasterweiterungen installieren oder diese, falls sie nicht richtig funktionieren, neu installieren. Dies können Sie durch Auswahl von <b>Gasterweiterungen installieren...</b> im Menü <b>Geräte</b> erreichen. Beachten Sie, dass Gemeinsame Ordner erst benutzt wer [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Die VirtualBox-Gasterweiterungen sind anscheinend für diese VM nicht verfügbar, sind aber Vorrausetzung für Gemeinsame Ordner. Um diesen Dienst zu benutzen müssen Sie daher die Gasterweiterungen installieren oder diese, falls sie nicht richtig funktionieren, neu installieren. Dies können Sie durch Auswahl von <b>Gasterweiterungen installieren...</b> im Menü <b>Geräte</b> erreichen. Beachten Sie, dass Gemeinsame Ordner  [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -4552,7 +5265,7 @@
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Daten konnten nicht kopiert werden.</translation>
+        <translation type="obsolete">Daten konnten nicht kopiert werden.</translation>
     </message>
     <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
@@ -4776,15 +5489,15 @@
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>Das CD-Abbild mit den <b>VirtualBox-Gasterweiterungen</b> wurde erfolgreich von <nobr><a href="%1">%1</a></nobr> heruntergeladen, konnte aber nicht unter <nobr><b>%2</b></nobr> gespeichert werden.</p><p>Bitte wählen Sie einen anderen Ordner für diese Datei.</p></translation>
+        <translation><p>Das CD-Abbild mit den <b>VirtualBox-Gasterweiterungen</b> wurde erfolgreich von <nobr><a href="%1">%1</a></nobr> heruntergeladen, konnte aber nicht unter <nobr><b>%2</b></nobr>gespeichert werden.</p><p>Bitte wählen Sie einen anderen Ordner für diese Datei.</p></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>Das CD-Abbild mit den <b>VirtualBox-Gasterweiterungen</b> wurde erfolgreich von <nobr><a href="%1">%1</a></nobr> heruntergeladen und auf der lokalen Festplatte unter <nobr><b>%2</b></nobr> gespeichert.</p><p>Möchten Sie dieses Abbild in VirtualBox registrieren und in das virtuelle CD/DVD-Laufwerk einlegen?</p></translation>
+        <translation type="obsolete"><p>Das CD-Abbild mit den <b>VirtualBox-Gasterweiterungen</b> wurde erfolgreich von <nobr><a href="%1">%1</a></nobr> heruntergeladen und auf der lokalen Festplatte unter <nobr><b>%2</b></nobr>gespeichert.</p><p>Möchten Sie dieses Abbild in VirtualBox registrieren und in das virtuelle CD/DVD-Laufwerk einlegen?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Das virtuelle Medium mit den <b>VirtualBox-Gasterweiterungen</b> konnte in kein Laufwerk der virtuellen Machine <b>%1</b> eingelegt werden, da diese keine CD/DVD-Laufwerke besitzt. Bitte fügen Sie ein solches Laufwerk in den Einstellungen zu Massenspeichern ein.</p></translation>
+        <translation type="obsolete"><p>Das virtuelle Medium mit den <b>VirtualBox-Gasterweiterungen</b> konnte in kein Laufwerk der virtuellen Machine <b>%1</b> eingelegt werden, da diese keine CD/DVD-Laufwerke besitzt. Bitte fügen Sie ein solches Laufwerk in den Einstellungen zu Massenspeichern ein.</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
@@ -4824,15 +5537,132 @@
     </message>
     <message>
         <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Die Webcam <b>%1</b> konnte der virtuellen Maschine <b>%2</b> nicht zugewiesen werden.</translation>
+        <translation>Die Webcam <b>%1</b> konnte nicht an die virtuelle Maschine <b>%2</b> angeschlossen werden.</translation>
     </message>
     <message>
         <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Die Zuordnung der Webcam <b>%1</b> an die virtuelle Maschine <b>%2</b> konnte nicht aufgehoben werden.</translation>
+        <translation>Die Webcam <b>%1</b> konnte nicht von der virtuellen Maschine <b>%2</b> getrennt werden.</translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation><p>Die VirtualBox-Gasterweiterungen sind anscheinend für diese VM nicht verfügbar, sind aber Vorrausetzung für Gemeinsame Ordner. Um diesen Dienst zu nutzen müssen Sie daher die Gasterweiterungen installieren oder diese, falls sie nicht richtig funktionieren, neu installieren. Dies können Sie durch Auswahl von <b>Gasterweiterungen einlegen...</b> im Menü <b>Geräte</b> erreichen. Beachten Sie, dass Gemeinsame Ordner erst benutzt werden kö [...]
+    </message>
+    <message>
+        <source>Insert</source>
+        <comment>additions</comment>
+        <translation>Einlegen</translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>Der virtuelle Bildschirm ist momentan auf eine Farbtiefe von <b>%1&nbsp;Bit</b> eingestellt. Für eine bestmögliche Performance sollten Sie die Farbtiefe auf <b>%2&nbsp;Bit</b> ändern. Benutzen Sie dafür die Anzeigeeinstellungen des Gast-Betriebssystems.</p></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>Das COM-Objekt für VirtualBox konnte nicht erzeugt werden.</p><p>Die Anwendung wird nun beendet.</p></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation>Der Extradata-Schlüssel <i>%1</i> der Maschine <i>%2</i> konnte nicht auf den Wert <i>{%3}</i> gesetzt werden.</translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>Eine oder mehrere virtuelle Festplatten, optische Medien oder Diskettenmedien sind momentan nicht zugreifbar. Virtuelle Maschinen, die diese Medien benutzen, können so lange nicht benutzt werden, bis die Medien wieder zugreifbar werden.</p><p>Wählen Sie <b>Überprüfen</b> um den Manager für virtuelle Medien zu öffnen oder wählen Sie <b>Ignorieren</b>, um dieses Problem zu ignorieren.</p></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation>Die Einstellungen konnten nicht gesichert werden.</translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p>Sie sind dabei, ein neues optisches Laufwerk an den Controller <b>%1</b> anzuschließen.</p><p>Möchten Sie ein virtuelle Medium in das Laufwerk einlegen oder soll das Laufwerk jetzt kein Medium enthalten?</p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>Möchten Sie wirklich das optische Laufwerk löschen?</p><p>Ohne optisches Laufwerk können Sie keine CDs oder CD-Abbilder einbinden und die Gast-Erweiterungen nicht installieren!</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Das optische Laufwerk <nobr><b>%1</b></nobr> konnte nicht an den Slot <i>%2</i> der VM <b>%3</b> angeschlossen werden.</translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Das Diskettenlaufwerk (<nobr><b>%1</b></nobr>) konnte nicht an den Slot <i>%2</i> der VM <b>%3</b> angeschlossen werden.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Das optische Laufwerk <nobr><b>%1</b></nobr> konnte nicht vom Slot <i>%2</i> der VM <b>%3</b> entfernt werden.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Das Diskettenlaufwerk (<nobr><b>%1</b></nobr>) konnte nicht vom Slot <i>%2</i> der VM <b>%3</b> entfernt werden.</translation>
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Die virtuelle Maschine <b>%1</b> konnte nicht an das virtuelle Netzwerkkabel angeschlossen werden.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Die virtuelle Maschine <b>%1</b> konnte nicht vom virtuellen Netzwerkkabel getrennt werden.</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to enter password!</source>
+        <translation type="obsolete">Das Passwort konnte nicht eingegeben werden!</translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p>Das CD-Abbild mit den <b>VirtualBox-Gasterweiterungen</b> wurde erfolgreich von <nobr><a href="%1">%1</a></nobr> heruntergeladen und auf der lokalen Festplatte unter <nobr><b>%2</b></nobr>gespeichert.</p><p>Möchten Sie dieses Abbild in VirtualBox registrieren und in das virtuelle optische Laufwerk einlegen?</p></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation>Falsches Passwort und/oder Anmeldung nicht möglich.</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation><p>Ein schwerwiegender Fehler ist aufgetreten, und die Ausführung der virtuellen Maschine wurde unterbrochen.</p><p>Zusätzliche Informationen zu diesem Fehler suchen Sie bitte in der Community-Sektion auf <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> bzw. handeln Sie gemäß Ihres Supportvertrages. Bitte geben Sie die Logdatei <tt>VBox.log</tt>, den Screenshot <tt>VBox.png</tt>, den Sie im Verzei [...]
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation><p>Ein schwerwiegender Fehler ist aufgetreten, und die Ausführung der virtuellen Maschine wurde unterbrochen.</p><p>Zusätzliche Informationen zu diesem Fehler suchen Sie bitte in der Community-Sektion auf <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> bzw. handeln Sie gemäß Ihres Supportvertrages. Bitte geben Sie die Logdatei <tt>VBox.log</tt> sowie eine Beschreibung der Maßnahmen, die zu diesem Fehler führ [...]
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation><p>Eine neue Version von VirtualBox ist verfügbar! Version <b>%1</b> ist auf <a href="https://www.virtualbox.org/">virtualbox.org</a> verfügbar.</p><p>Sie können diese Version von der folgenden Adresse herunterladen:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation>Die Drag-und-Drop-Operation vom Host zum Gast ist fehlgeschlagen.</translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation>Die Drag-und-Drop-Operation kann nicht abgebrochen werden.</translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation>Die Drag-und-Drop-Operation vom Gast zum Host ist fehlgeschlagen.</translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4868,7 +5698,7 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Name:</translation>
     </message>
     <message>
@@ -5056,14 +5886,18 @@
         <translation>Virtuelle-Maschinen-Dateien (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Willkommen zu VirtualBox!</h3><p>Der linke Teil dieses Fensters zeigt eine Liste aller virtuellen Maschinen auf Ihrem Computer. Diese Liste ist momentan leer, da Sie noch keine virtuelle Maschine erstellt haben.<img src=:/welcome.png align=right/></p><p>Um eine virtuelle Maschine anzulegen, wählen Sie <b>Neu</b> in der Symbolleiste am oberen Rand des Fensters.</p><p>Die Taste <b>%1</b> öffnet [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Willkommen zu VirtualBox!</h3><p>Der linke Teil dieses Fensters zeigt eine Liste aller virtuellen Maschinen auf Ihrem Computer. Diese Liste ist momentan leer, da Sie noch keine virtuelle Maschine erstellt haben.<img src=:/welcome.png align=right/></p><p>Um eine virtuelle Maschine anzulegen, wählen Sie <b>Neu</b> in der Symbolleiste am oberen Rand des Fensters.</p><p>Die Taste <b>%1& [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Manager</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation><h3>Willkommen zu VirtualBox!</h3><p>Der linke Teil dieses Fensters zeigt eine Liste aller virtuellen Maschinen auf Ihrem Computer. Diese Liste ist momentan leer, da Sie noch keine virtuelle Maschine erstellt haben.<img src=:/welcome.png align=right/></p><p>Um eine virtuelle Maschine anzulegen, wählen Sie <b>Neu</b> in der Symbolleiste am oberen Rand des Fensters.</p><p>Die Taste <b>%1</b> öffnet [...]
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -5080,7 +5914,7 @@
     </message>
     <message>
         <source>Settings</source>
-        <translation>Ändern</translation>
+        <translation type="obsolete">Ändern</translation>
     </message>
     <message>
         <source><i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information.</i></source>
@@ -5133,6 +5967,10 @@
         <source>Display</source>
         <translation>Anzeige</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation>Einstellungen</translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -5184,6 +6022,43 @@
         <source>%1 - %2</source>
         <translation></translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation>Benutzerschnittstelle</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation>Einstellungen</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>Einstellungen laden...</translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation>Einstellungen sichern...</translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation>Schließen</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation>Statusleiste anzeigen</translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -5277,47 +6152,157 @@
         <translation><p>Sichert den aktuellen Ausführungszustand der virtuellen Maschine auf die physische Festplatte des Host-PCs.</p><p>Beim nächsten Start wird sie aus diesem Zustand wieder hergestellt und an der selben Stelle fortgesetzt, an der Sie den Zustand gesichert haben.</p><p>Bitte beachten Sie, dass das Sichern des Zustandes eine längere Zeit in Anspruch nehmen kann. Die benötigte Zeit ist abhängig vom Gastsystem und von der Größe dem Gastsystem [...]
     </message>
     <message>
-        <source>&Save the machine state</source>
-        <translation>den Zustand der virtuellen Maschine &speichern</translation>
+        <source>&Save the machine state</source>
+        <translation>den Zustand der virtuellen Maschine &speichern</translation>
+    </message>
+    <message>
+        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
+        <translation><p>Sendet das ACPI-Ereignis 'Ausschaltknopf gedrückt' an die virtuelle Maschine.</p><p>Übliche Gastsysteme werden dieses Ereignis empfangen und die Maschine in Folge dessen sauber herunterfahren. Dies ist das empfohlene Vorgehen, um die Maschine auszuschalten, weil alle Anwendungen innerhalb der Maschine Gelegenheit zum Sichern Ihrer Daten bekommen.</p><p>Falls der Gast nicht auf dieses Ereignis reagiert, ist dieser entweder fa [...]
+    </message>
+    <message>
+        <source>S&end the shutdown signal</source>
+        <translation>die virtuelle Maschine mittels ACPI-Event &herunterfahren</translation>
+    </message>
+    <message>
+        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
+        <translation><p>Schaltet die virtuelle Maschine aus.</p><p>Bitte beachten Sie, dass dadurch die Ausführung der Maschine sofort unterbrochen wird und das Gastsystem somit keine Gelegenheit hat, sich sauber zu beenden. Dadurch kann es zu <i>Datenverlust</i> innerhalb der virtuellen Maschine kommen. Diese Aktion sollte nur dann durchgeführt werden, wenn die virtuelle Maschine nicht auf <b>Sende Signal zum Herunterfahren</b> reagiert.</p&g [...]
+    </message>
+    <message>
+        <source>&Power off the machine</source>
+        <translation>die virtuelle Maschine &ausschalten</translation>
+    </message>
+    <message>
+        <source>Restore the machine state stored in the current snapshot</source>
+        <translation>Der Ausführungszustand wird auf den aktuellen Sicherungspunkt zurückgesetzt</translation>
+    </message>
+    <message>
+        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
+        <translation><p>Ist dieses Kästchen aktiviert, dann wird sofort nach dem Ausschalten der Maschinenzustand aus dem aktuellen Sicherungspunkt wieder hergestellt. Dies ist dann empfehlenswert, wenn Sie die Arbeit der letzten Sitzung verwerfen und zum aktuellen Sicherungspunkt zurückkehren wollen.</p></translation>
+    </message>
+    <message>
+        <source>&Restore current snapshot '%1'</source>
+        <translation>&Zurückkehren auf Sicherungspunkt '%1'</translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>die virtuelle Maschine im Hintergrund &weiterlaufen lassen</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><p>Schließt das Fenster der virtuellen Maschine, beendet aber die virtuelle Maschine nicht.</p><p>Sie können sich mit Hilfe des VirtualBox-Managers wieder mit der virtuellen Maschine verbinden.</p></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
+    <message>
+        <source>&Details</source>
+        <translation>&Details</translation>
+    </message>
+    <message>
+        <source>&Snapshots</source>
+        <translation>&Sicherungspunkte</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Sitzungsinformationen</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA-Übertragungen</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO-Übertragungen</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Daten gelesen</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Daten geschrieben</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Daten gesendet</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Daten empfangen</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Laufzeit-Attribute</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Auflösung</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>nicht erkannt</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>nicht erkannt</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Gasterweiterungen</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Gast-Betriebssystem</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Keine Netzwerkadapter</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Massenspeicher</translation>
     </message>
     <message>
-        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation><p>Sendet das ACPI-Ereignis 'Ausschaltknopf gedrückt' an die virtuelle Maschine.</p><p>Übliche Gastsysteme werden dieses Ereignis empfangen und die Maschine in Folge dessen sauber herunterfahren. Dies ist das empfohlene Vorgehen, um die Maschine auszuschalten, weil alle Anwendungen innerhalb der Maschine Gelegenheit zum Sichern Ihrer Daten bekommen.</p><p>Falls der Gast nicht auf dieses Ereignis reagiert, ist dieser entweder fa [...]
+        <source>No Storage Devices</source>
+        <translation>Keine Massenspeicher</translation>
     </message>
     <message>
-        <source>S&end the shutdown signal</source>
-        <translation>die virtuelle Maschine mittels ACPI-Event &herunterfahren</translation>
+        <source>Network Statistics</source>
+        <translation>Netzwerkadapter</translation>
     </message>
     <message>
-        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation><p>Schaltet die virtuelle Maschine aus.</p><p>Bitte beachten Sie, dass dadurch die Ausführung der Maschine sofort unterbrochen wird und das Gastsystem somit keine Gelegenheit hat, sich sauber zu beenden. Dadurch kann es zu <i>Datenverlust</i> innerhalb der virtuellen Maschine kommen. Diese Aktion sollte nur dann durchgeführt werden, wenn die virtuelle Maschine nicht auf <b>Sende Signal zum Herunterfahren</b> reagiert.</p&g [...]
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>nicht verfügbar</translation>
     </message>
     <message>
-        <source>&Power off the machine</source>
-        <translation>die virtuelle Maschine &ausschalten</translation>
+        <source>Clipboard Mode</source>
+        <translation>Gemeinsame Zwischenablage</translation>
     </message>
     <message>
-        <source>Restore the machine state stored in the current snapshot</source>
-        <translation>Der Ausführungszustand wird auf den aktuellen Sicherungspunkt zurückgesetzt</translation>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Drag'n'Drop</translation>
     </message>
     <message>
-        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation><p>Ist dieses Kästchen aktiviert, dann wird sofort nach dem Ausschalten der Maschinenzustand aus dem aktuellen Sicherungspunkt wieder hergestellt. Dies ist dann empfehlenswert, wenn Sie die Arbeit der letzten Sitzung verwerfen und zum aktuellen Sicherungspunkt zurückkehren wollen.</p></translation>
+        <source>Configuration &Details</source>
+        <translation>&Konfiguration</translation>
     </message>
     <message>
-        <source>&Restore current snapshot '%1'</source>
-        <translation>&Zurückkehren auf Sicherungspunkt '%1'</translation>
+        <source>&Runtime Information</source>
+        <translation>&Laufzeit</translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <source>&Details</source>
-        <translation>&Details</translation>
+        <source>VM Uptime</source>
+        <translation>VM-Laufzeit</translation>
     </message>
     <message>
-        <source>&Snapshots</source>
-        <translation>&Sicherungspunkte</translation>
+        <source>Drag and Drop Mode</source>
+        <translation>Drag-und-Drop-Modus</translation>
     </message>
 </context>
 <context>
@@ -5408,11 +6393,27 @@
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Beschreibung verdecken</translation>
+        <translation type="obsolete">Beschreibung verdecken</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Beschreibung zeigen</translation>
+        <translation type="obsolete">Beschreibung zeigen</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation>&Expert-Modus</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation>Schaltet in den <nobr><b>Experten-Modus</b></nobr>, ein übersichtlicher Dialog für erfahrene Benutzer.</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>&Geführter Modus</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation>Schaltet in den <nobr><b>geführten Modus</b></nobr> mit Schritt-für-Schritt-Dialogen mit ausführlichen Erklärungen.</translation>
     </message>
 </context>
 <context>
@@ -6028,8 +7029,8 @@
         <translation><Voreinstellung></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>Der Standardpfad wird nach Bestätigen der Änderungen und erneutes Öffnen dieses Dialogs angezeigt.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Der Standardpfad wird nach Bestätigen der Änderungen und erneutes Öffnen dieses Dialogs angezeigt.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -6075,6 +7076,10 @@
         <source>Please type the file path here.</source>
         <translation>Bitte geben Sie hier den gewünschten Pfad ein.</translation>
     </message>
+    <message>
+        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
+        <translation>Der Standardpfad wird nach Bestätigen der Änderungen und erneutes Öffnen dieses Dialogs angezeigt.</translation>
+    </message>
 </context>
 <context>
     <name>VBoxGlobal</name>
@@ -6276,7 +7281,7 @@
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -6850,17 +7855,17 @@
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Diese Festplatte wird indirekt mittels einer neu erzeugten Differenzdatei angeschlossen.</translation>
+        <translation type="obsolete">Diese Festplatte wird indirekt mittels einer neu erzeugten Differenzdatei angeschlossen.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Einige der zu dieser virtuellen Festplatte gehörigen Dateien sind nicht zugreifbar. Bitte verwenden Sie den Manager für virtuelle Medien im Modus <b>Zeige Differenz-Abbilder</b> um diese Dateien anzuzeigen.</translation>
+        <translation type="obsolete">Einige der zu dieser virtuellen Festplatte gehörigen Dateien sind nicht zugreifbar. Bitte verwenden Sie den Manager für virtuelle Medien im Modus <b>Zeige Differenz-Abbilder</b> um diese Dateien anzuzeigen.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Diese Basisfestplatte ist indirekt über die folgenden Differenzfestplatten eingebunden:</translation>
+        <translation type="obsolete">Diese Basisfestplatte ist indirekt über die folgenden Differenzfestplatten eingebunden:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -6906,7 +7911,7 @@
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -7350,12 +8355,12 @@
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>aktiviert</translation>
+        <translation type="obsolete">aktiviert</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>deaktiviert</translation>
+        <translation type="obsolete">deaktiviert</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -7405,6 +8410,155 @@
         <source>You can create or add disk image files in the virtual machine settings.</source>
         <translation>Sie können Medienabbilder in den VM-Einstellungen erzeugen oder hinzufügen.</translation>
     </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>USB Port %1</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>aus</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation>Paravirtualisierung</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>kein</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>voreingestellt</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>legacy</translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>minimal</translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>inaktiv</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>inaktiv</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>inaktiv</translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Erstelle Sicherungspunkt</translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Erstelle Online-Sicherungspunkt</translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation>DVD</translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation>Benutzerschnittstelle</translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation>(opt. Laufwerk)</translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>Diese Festplatte wird indirekt mittels einer neu erzeugten Differenzdatei angeschlossen.</translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation>Einige der zu dieser virtuellen Festplatte gehörigen Dateien sind nicht zugreifbar. Bitte verwenden Sie den Manager für virtuelle Medien um diese Dateien anzuzeigen.</translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>Diese Basisfestplatte ist indirekt über die folgenden Differenzfestplatten eingebunden:</translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation>verschlüsselt</translation>
+    </message>
 </context>
 <context>
     <name>VBoxGlobalSettings</name>
@@ -7535,6 +8689,18 @@
         <source>Modify the attributes of the selected disk image file</source>
         <translation>Ändert die Attribute des ausgewählten Mediums</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxScreenshotViewer</name>
@@ -7720,102 +8886,4 @@
         <translation>Keine unterstützten Geräte mit dem PC verbunden</translation>
     </message>
 </context>
-<context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Sitzungsinformationen</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA-Übertragungen</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO-Übertragungen</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Daten gelesen</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Daten geschrieben</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Daten gesendet</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Daten empfangen</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Laufzeit-Attribute</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Auflösung</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>nicht erkannt</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>nicht erkannt</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Gast-Erweiterungen</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Gast-Betriebssystem</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Keine Netzwerkadapter</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation></translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Massenspeicher</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Keine Massenspeicher</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Netzwerkadapter</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>nicht verfügbar</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Gemeinsame Zwischenablage</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Drag'n'Drop</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>&Konfiguration</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>&Laufzeit</translation>
-    </message>
-</context>
 </TS>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_en.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_en.ts
index 38b4ede..95cdafb 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_en.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_en.ts
@@ -2,9 +2,38 @@
 <!DOCTYPE TS>
 <TS version="2.0" language="en">
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>This virtual machine is password protected. Please enter the encryption password below.</numerusform>
+            <numerusform>This virtual machine is password protected. Please enter the encryption passwords below.</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
+    <name>UIEncryptionDataModel</name>
+    <message numerus="yes">
+        <source>Used by the following %n hard drive(s):<br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="obsolete">
+            <numerusform>Used by the following hard drive:<br>%1</numerusform>
+            <numerusform>Used by the following hard drives:<br>%1</numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIGChooserItemGroup</name>
     <message numerus="yes">
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="663"/>
         <source>%n group(s)</source>
         <comment>Group item tool-tip / Group info</comment>
         <translation>
@@ -13,7 +42,6 @@
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="679"/>
         <source>%n machine(s)</source>
         <comment>Group item tool-tip / Machine info</comment>
         <translation>
@@ -22,7 +50,6 @@
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="680"/>
         <source>(%n running)</source>
         <comment>Group item tool-tip / Running machine info</comment>
         <translation>
@@ -49,7 +76,6 @@
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1576"/>
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
         <translation>
@@ -61,7 +87,6 @@
 <context>
     <name>VBoxGlobal</name>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="169"/>
         <source>%n year(s)</source>
         <translation>
             <numerusform>%n year</numerusform>
@@ -69,7 +94,6 @@
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="174"/>
         <source>%n month(s)</source>
         <translation>
             <numerusform>%n month</numerusform>
@@ -77,7 +101,6 @@
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="179"/>
         <source>%n day(s)</source>
         <translation>
             <numerusform>%n day</numerusform>
@@ -85,7 +108,6 @@
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="184"/>
         <source>%n hour(s)</source>
         <translation>
             <numerusform>%n hour</numerusform>
@@ -93,7 +115,6 @@
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="194"/>
         <source>%n second(s)</source>
         <translation>
             <numerusform>%n second</numerusform>
@@ -101,7 +122,6 @@
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="189"/>
         <source>%n minute(s)</source>
         <translation>
             <numerusform>%n minute</numerusform>
@@ -112,7 +132,6 @@
 <context>
     <name>VBoxTakeSnapshotDlg</name>
     <message numerus="yes">
-        <location filename="../src/VBoxTakeSnapshotDlg.cpp" line="73"/>
         <source>Warning: You are taking a snapshot of a running machine which has %n immutable image(s) attached to it. As long as you are working from this snapshot the immutable image(s) will not be reset to avoid loss of data.</source>
         <translation>
             <numerusform>Warning: You are taking a snapshot of a running machine which has %n immutable image attached to it. As long as you are working from this snapshot the immutable image will not be reset to avoid loss of data.</numerusform>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts
index f5953a3..343a759 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts
@@ -315,7 +315,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Modo f&luído</translation>
+        <translation type="unfinished">Modo f&luído</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -339,11 +339,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Inhabilitar integración del &ratón</translation>
+        <translation type="obsolete">Inhabilitar integración del &ratón</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Inhabilita temporalmente la integración el ratón del sistema anfitrión</translation>
+        <translation type="obsolete">Inhabilita temporalmente la integración el ratón del sistema anfitrión</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -355,11 +355,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Insertar Ctrl-Alt-Supr</translation>
+        <translation type="obsolete">&Insertar Ctrl-Alt-Supr</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Enviar la secuencia Ctrl-Alt-Supr a la máquina virtual</translation>
+        <translation type="obsolete">Enviar la secuencia Ctrl-Alt-Supr a la máquina virtual</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -367,7 +367,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Enviar la secuencia Ctrl-Alt-Retroceso a la máquina virtual</translation>
+        <translation type="obsolete">Enviar la secuencia Ctrl-Alt-Retroceso a la máquina virtual</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -435,15 +435,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Dispositivos &CD/DVD</translation>
+        <translation type="obsolete">Dispositivos &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Dispositivos de &disquete</translation>
+        <translation type="obsolete">Dispositivos de &disquete</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Dispositivos &USB</translation>
+        <translation type="obsolete">Dispositivos &USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -494,7 +494,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&Trazas...</translation>
+        <translation type="obsolete">&Trazas...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -572,15 +572,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Cambiar a pantalla &completa</translation>
+        <translation type="obsolete">Cambiar a pantalla &completa</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Cambiar entre modo normal y pantalla completa</translation>
+        <translation type="obsolete">Cambiar entre modo normal y pantalla completa</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Cambiar a modo &fluído</translation>
+        <translation type="obsolete">Cambiar a modo &fluído</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -588,7 +588,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Cambiar a modo &ajustado</translation>
+        <translation type="obsolete">Cambiar a modo &ajustado</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -668,7 +668,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Ins&ertar Ctrl-Alt-Retroceso</translation>
+        <translation type="obsolete">Ins&ertar Ctrl-Alt-Retroceso </translation>
     </message>
     <message>
         <source>&File</source>
@@ -991,7 +991,7 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Arrastrar y soltar</translation>
+        <translation type="obsolete">Arrastrar y soltar</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
@@ -1039,23 +1039,231 @@
     </message>
     <message>
         <source>Show Session Information Window</source>
-        <translation>Mostar Ventana de información de sesión</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Webcams</source>
-        <translation>&Cámaras web</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <translation>&Insertar la imagen de CD de las «Guest Additions»...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Insertar el archivo de disco de las «Guest Additions» en la unidad virtual</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Teclado</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
-        <translation>Red</translation>
+        <translation type="unfinished">Red</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Mostrar &historial de eventos...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Archivo</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Habilitado</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
     </message>
 </context>
 <context>
@@ -1066,6 +1274,21 @@
     </message>
 </context>
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIApplianceEditorWidget</name>
     <message>
         <source>Virtual System %1</source>
@@ -1881,6 +2104,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1891,7 +2121,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Descartando datos...</translation>
+        <translation type="obsolete">Descartando datos...</translation>
     </message>
 </context>
 <context>
@@ -1991,6 +2221,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2698,7 +2954,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2909,6 +3165,106 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>Tamaño de fotograma: %1x%2, Tasa de fotogramas: %3fps, Tasa de bits: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Controlador USB</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Habilitado</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished">Inhabilitado</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">Habilitado</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Habilitado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Inhabilitado</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Habilitado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Inhabilitado</translation>
+    </message>
 </context>
 <context>
     <name>UIGDetailsUpdateThreadAudio</name>
@@ -3285,15 +3641,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation>&Dock y barra de menú:</translation>
+        <translation type="obsolete">&Dock y barra de menú:</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation>Automostrar en pantalla completa</translation>
+        <translation type="obsolete">Automostrar en pantalla completa</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Seleccionado, el dock anfitrión y la barra de menú serán mostrados cuando la máquina virtual esté en el modo a pantalla completa.</translation>
+        <translation type="obsolete">Seleccionado, el dock anfitrión y la barra de menú serán mostrados cuando la máquina virtual esté en el modo a pantalla completa.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
@@ -3918,7 +4274,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>Contiene el nombre para esta red.</translation>
+        <translation>Contiene el nombre de esta red.</translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
@@ -4520,12 +4876,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica la actividad de los dispositivos de CD/DVD:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica la actividad de los dispositivos de CD/DVD:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica la actividad de los dispositivos de disquete:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica la actividad de los dispositivos de disquete:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4565,7 +4921,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>El controlador USB se encuentra inhabilitado</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>El controlador USB se encuentra inhabilitado</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4638,6 +4994,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation>Estado de característica adicional:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4710,19 +5080,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>No hay cámaras web conectadas</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>No hay cámaras web conectadas al PC anfitrión</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation>Conectar adaptador de red</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation>Conectar adaptador de red %1</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4764,7 +5134,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Vídeo</translation>
+        <translation type="obsolete">&Vídeo</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -5027,15 +5397,83 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>La máquina virtual está configurada para usar el hardware de aceleración gráfica y el sistema operativo está establecido a Windows Vista o posterior. Para el mejor rendimiento debería establecer una memoria de vídeo de la máquina de al menos <b>%1</b>.</translation>
+        <translation type="obsolete">La máquina virtual está configurada para usar el hardware de aceleración gráfica y el sistema operativo está establecido a Windows Vista o posterior. Para el mejor rendimiento debería establecer una memoria de vídeo de la máquina de al menos <b>%1</b>.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation>La máquina virtual usará aceleración de transferencia de vídeo. Como esta característica solo funciona con sistemas invitados Windows será deshabilitada.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation>La pantalla remota está activada para esta máquina virtual. Sin embargo, esto requiere que <b>%1</b> esté instalado. Instale el «Extension Pack» desde el sitio de descarga de VirtualBox, de otra forma su MV se iniciará con la pantalla remota desactivada.</translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Mini barra herramientas:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Seleccionado, muestra la mini barra de herramientas en los modos pantalla completa y fuído.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Mostrar a pantalla &completa/fluído</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Seleccionado, muestra la mini barra de herramientas en la parte superior de la pantalla, en vez de en su posición predeterminada en la parte inferior de la pantalla.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Mostrar en la parte &superior de la pantalla</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5050,7 +5488,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Basi&c</source>
-        <translation type="obsolete">&Básico</translation>
+        <translation>&Básico</translation>
     </message>
     <message>
         <source>&Name:</source>
@@ -5094,7 +5532,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>A&dvanced</source>
-        <translation type="obsolete">&Avanzado</translation>
+        <translation>&Avanzado</translation>
     </message>
     <message>
         <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
@@ -5150,7 +5588,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>D&escription</source>
-        <translation type="obsolete">&Descripción</translation>
+        <translation>&Descripción</translation>
     </message>
     <message>
         <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
@@ -5162,19 +5600,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Medios extraíbles:</translation>
+        <translation type="obsolete">Medios extraíbles:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Recordar cambios en ejecución</translation>
+        <translation type="obsolete">&Recordar cambios en ejecución</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Mini barra herramientas:</translation>
+        <translation type="obsolete">Mini barra herramientas:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Seleccionado, muestra la mini barra de herramientas en los modos pantalla completa y fuído.</translation>
+        <translation type="obsolete">Seleccionado, muestra la mini barra de herramientas en los modos pantalla completa y fuído.</translation>
     </message>
     <message>
         <source>Show In &Fullscreen/Seamless</source>
@@ -5182,7 +5620,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Seleccionado, muestra la mini barra de herramientas en la parte superior de la pantalla, en vez de en su posición predeterminada en la parte inferior de la pantalla.</translation>
+        <translation type="obsolete">Seleccionado, muestra la mini barra de herramientas en la parte superior de la pantalla, en vez de en su posición predeterminada en la parte inferior de la pantalla.</translation>
     </message>
     <message>
         <source>Show At &Top Of Screen</source>
@@ -5194,7 +5632,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>D&rag'n'Drop:</source>
-        <translation type="obsolete">&Arrastrar y soltar:</translation>
+        <translation>&Arrastrar y soltar:</translation>
     </message>
     <message>
         <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
@@ -5205,36 +5643,116 @@ p, li { white-space: pre-wrap; }
         <translation>No se ha especificado nombre para esta máquina virtual.</translation>
     </message>
     <message>
-        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>El sistema operativo de esta máquina virutal está establecido a un tipo de 64 bits. Los sistemas invitados de 64-bits requiren hardware de virtualización, de modo que será habilitado automáticamente si confirma los cambios.</translation>
+        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <translation>El sistema operativo de esta máquina virutal está establecido a un tipo de 64 bits. Los sistemas invitados de 64-bits requiren hardware de virtualización, de modo que será habilitado automáticamente si confirma los cambios.</translation>
+    </message>
+    <message>
+        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
+        <translation type="obsolete">Seleccionado, cualquier CD/DVD o disquete insertado o extraído de los dispositivos virtuales mientras la máquina está corriendo será recordado.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Mostrar a pantalla &completa/fluído</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Mostrar en la parte &superior de la pantalla</translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
     </message>
     <message>
-        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Seleccionado, cualquier CD/DVD o disquete insertado o extraído de los dispositivos virtuales mientras la máquina está corriendo será recordado.</translation>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
     </message>
     <message>
-        <source>Show in &Fullscreen/Seamless</source>
-        <translation>Mostrar a pantalla &completa/fluído</translation>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Mini barra herramientas:</translation>
     </message>
     <message>
-        <source>Show at &Top of Screen</source>
-        <translation>Mostrar en la parte &superior de la pantalla</translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Seleccionado, muestra la mini barra de herramientas en los modos pantalla completa y fuído.</translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>&Básico</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Mostrar a pantalla &completa/fluído</translation>
     </message>
     <message>
-        <source>&Advanced</source>
-        <translation>&Avanzado</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Seleccionado, muestra la mini barra de herramientas en la parte superior de la pantalla, en vez de en su posición predeterminada en la parte inferior de la pantalla.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
-        <translation>&Arrastrar y soltar:</translation>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Mostrar en la parte &superior de la pantalla</translation>
     </message>
     <message>
-        <source>&Description</source>
-        <translation>&Descripción</translation>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5776,10 +6294,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Seleccionado, esta carpeta compartida será permanente.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Ventana</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5830,19 +6344,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Seleccionado, la tubería especificada en el campo <b>Ruta de puerto</b> será creada por la máquina virtual cuando se inicie. Sino, la máquina virtual tratará de usar la tubería existente.</translation>
+        <translation type="obsolete">Seleccionado, la tubería especificada en el campo <b>Ruta de puerto</b> será creada por la máquina virtual cuando se inicie. Sino, la máquina virtual tratará de usar la tubería existente.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Crear tubería</translation>
+        <translation type="obsolete">&Crear tubería</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Contiene la ruta de la tubería del puerto serie en la máquina anfitrión cuando el puerto trabaja en modo <b>Tubería anfitrión</b> o muestra el nombre del dispositivo serie cuando trabaja en modo <b>Dispositivo anfitrión</b>.</translation>
+        <translation type="obsolete">Contiene la ruta de la tubería del puerto serie en la máquina anfitrión cuando el puerto trabaja en modo <b>Tubería anfitrión</b> o muestra el nombre del dispositivo serie cuando trabaja en modo <b>Dispositivo anfitrión</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Ruta de puerto/archivo:</translation>
+        <translation type="obsolete">&Ruta de puerto/archivo:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>IO APIC</b> setting is enabled for this virtual machine.</source>
@@ -5860,6 +6374,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
         <translation>Contiene el número IRQ de este puerto serie. Este debería ser un número entero entre <tt>0</tt> y <tt>255</tt>. Valores más grandes que <tt>15</tt> solo deberían ser usardos si la preferencia <b>I/O APIC</b> está habilitada para esta máquina virtual.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5980,11 +6510,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Agregar&nbsp;dispositivo&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Agregar&nbsp;dispositivo&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Agregar&nbsp;unidad&nbsp;de&nbsp;disquete</nobr></translation>
+        <translation type="obsolete"><nobr>Agregar&nbsp;unidad&nbsp;de&nbsp;disquete</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -6028,11 +6558,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Agregar dispositivo CD/DVD</translation>
+        <translation type="obsolete">Agregar dispositivo CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Agregar unidad de disquete</translation>
+        <translation type="obsolete">Agregar unidad de disquete</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6220,15 +6750,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&Unidad CD/DVD:</translation>
+        <translation type="obsolete">&Unidad CD/DVD:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Seleccione un disco virtual de CD/DVD o una unidad física a usar con la unidad virtual. La máquina virtual verá un disco insertado en la unidad con los datos en el archivo o en el disco de la unidad física virtual como sus contenidos.</translation>
+        <translation type="obsolete">Seleccione un disco virtual de CD/DVD o una unidad física a usar con la unidad virtual. La máquina virtual verá un disco insertado en la unidad con los datos en el archivo o en el disco de la unidad física virtual como sus contenidos.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Configurar la unidad virtual de CD/DVD</translation>
+        <translation type="obsolete">Configurar la unidad virtual de CD/DVD</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6252,7 +6782,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Seleccionar un archivo de disco virtual de CD/DVD...</translation>
+        <translation type="obsolete">Seleccionar un archivo de disco virtual de CD/DVD...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6346,7 +6876,51 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add USB Controller</source>
-        <translation type="obsolete">Agregar controlador USB</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Seleccionar un archivo de disco óptico virtual...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6586,11 +7160,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>La característica I/O APIC no está actualmente habilitada en la sección Placa base de la página del Sistema. Esto es necesario para soportar un chip del tipo ICH9. Se hará automáticamente si confirma sus cambios.</translation>
+        <translation type="obsolete">La característica I/O APIC no está actualmente habilitada en la sección Placa base de la página del Sistema. Esto es necesario para soportar un chip del tipo ICH9. Se hará automáticamente si confirma sus cambios.</translation>
     </message>
     <message>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>La emulación del controlador USB no está actualmente habilitada en la página USB. Esto es necesario para soportar un dispositivo de entrada emulada USB. Se hará automáticamente si confirma sus cambios.</translation>
+        <translation type="obsolete">La emulación del controlador USB no está actualmente habilitada en la página USB. Esto es necesario para soportar un dispositivo de entrada emulada USB. Se hará automáticamente si confirma sus cambios.</translation>
     </message>
     <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
@@ -6606,7 +7180,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>El hardware de virtualización no está actualmente habilitado en la sección Aceleración de la página del Sistema. Esto es necesario para soportar más de un procesador virtual. Se hará automáticamente si confirma sus cambios.</translation>
+        <translation type="obsolete">El hardware de virtualización no está actualmente habilitado en la sección Aceleración de la página del Sistema. Esto es necesario para soportar más de un procesador virtual. Se hará automáticamente si confirma sus cambios.</translation>
     </message>
     <message>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
@@ -6630,7 +7204,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La característica I/O APIC no está habilitada actualmente en la sección placa base de la página del Sistema. Esto es necesario para soportar más de un procesador virtual. Se hará automáticamente si confirma sus cambios.</translation>
+        <translation type="obsolete">La característica I/O APIC no está habilitada actualmente en la sección placa base de la página del Sistema. Esto es necesario para soportar más de un procesador virtual. Se hará automáticamente si confirma sus cambios.</translation>
+    </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6702,7 +7300,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Habilitar controlador USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">Habilitar controlador USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6766,7 +7364,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 está habilitado actualmente para esta máquina virtual. Sin embargo, esto require que <b>%1</b> esté instalado. Instale el paquete de extensiones desde el sitio de descargas de VirtualBox o deshabilite USB 2.0 para iniciar la máquina.</translation>
+        <translation type="obsolete">USB 2.0 está habilitado actualmente para esta máquina virtual. Sin embargo, esto require que <b>%1</b> esté instalado. Instale el paquete de extensiones desde el sitio de descargas de VirtualBox o deshabilite USB 2.0 para iniciar la máquina.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6905,7 +7527,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Cerrar</translation>
+        <translation type="obsolete">&Cerrar</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6932,6 +7558,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Cerrar</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Cambiar</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6973,7 +7622,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Fallo al crear el objeto COM de VirtualBox.</p><p>La aplicación se cerrará.</p></translation>
+        <translation type="obsolete"><p>Fallo al crear el objeto COM de VirtualBox.</p><p>La aplicación se cerrará.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -7330,8 +7979,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>La pantalla de la máquina virtual está optimizada para trabajar en modo de color <b>%1&nbsp;bit</b>. Sin embargo, el modo del pantalla de la máquina virtual está configurada como <b>%2&nbsp;bit</b>.</p><p>Abra el diálogo de las propiedades de pantalla en el SO invitado y seleccione un modo de color de <b>%3&nbsp;bit</b>, si esta disponible, para obtener el mejor rendimiento posible e [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>Un error crítico ha ocurrido mientras corría la máquina virtual y la ejecución de la máquina virtual se terminará.</p><p>Para obtener ayuda dirígase a la sección "Community" en <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o al soporte que haya contratado con VirtualBox de tenerlo. Por favor envíe el contenido del archivo de eventos <tt>VBox.log</tt> que Ud. puede encontrar en  [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Un error crítico ha ocurrido mientras corría la máquina virtual y la ejecución de la máquina virtual se terminará.</p><p>Para obtener ayuda dirígase a la sección "Community" en <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> o al soporte que haya contratado con VirtualBox de tenerlo. Por favor envíe el contenido del archivo de eventos <tt>VBox.log</tt> que Ud. puede encontrar en la [...]
 <p><b>a del traductor:</b> Tenga en cuenta que el soporte que pueda recibir por la comunidad de VirtualBox en el idioma español es limitado por ahora. Por lo que se sugiere que emplee el idioma inglés hasta que la comunidad de VirtualBox hispana crezca.</p></translation>
     </message>
     <message>
@@ -7593,8 +8242,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Mostrar un diálogo con la información del producto</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>¡Hay una nueva versión de VirtualBox! La versión <b>%1</b> se encuentra disponible en <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puede descargar dicha versión directamente desde el siguiente enlace:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>¡Hay una nueva versión de VirtualBox! La versión <b>%1</b> se encuentra disponible en <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puede descargar dicha versión directamente desde el siguiente enlace:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7793,8 +8442,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Sobre&escribir</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Ha ocurrido un error crítico durante la ejecución de la máquina virtual y ha sido parada.</p><p>Para obtener ayuda, vaya a la sección «Community» en <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o su contrato de soporte. Proporcione los contenidos de los archivos de log <tt>VBox.log</tt> y el archivo de imagen <tt>VBox.png</tt>, que puede encontrar en el directorio <nobr><b>%1&lt [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Ha ocurrido un error crítico durante la ejecución de la máquina virtual y ha sido parada.</p><p>Para obtener ayuda, vaya a la sección «Community» en <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> o su contrato de soporte. Proporcione los contenidos de los archivos de log <tt>VBox.log</tt> y el archivo de imagen <tt>VBox.png</tt>, que puede encontrar en el directorio <nobr> [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -8075,7 +8724,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Está a punto de agregar una nueva unidad de CD/DVD al controlador <b>%1</b>.</p><p>¿Desea seleccionar un disco virtual de CD/DVD a poner en la unidad o desea dejarla vacía por ahora?</p></translation>
+        <translation type="obsolete"><p>Está a punto de agregar una nueva unidad de CD/DVD al controlador <b>%1</b>.</p><p>¿Desea seleccionar un disco virtual de CD/DVD a poner en la unidad o desea dejarla vacía por ahora?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -8097,11 +8746,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Fallo al desconectar el dispositivo CD /DVD (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la máquina <b>%3</b>.</translation>
+        <translation type="obsolete">Fallo al desconectar el dispositivo CD /DVD (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la máquina <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Fallo al desconectar el dispositivo de disquete (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la máquina <b>%3</b>.</translation>
+        <translation type="obsolete">Fallo al desconectar el dispositivo de disquete (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la máquina <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
@@ -8152,11 +8801,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Fallo al conectar el dispositivo CD/DVD (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la máquina <b>%3</b>.</translation>
+        <translation type="obsolete">Fallo al conectar el dispositivo CD/DVD (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la máquina <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Fallo al conectar el dispositivo de disquete (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la máquina <b>%3</b>.</translation>
+        <translation type="obsolete">Fallo al conectar el dispositivo de disquete (<nobr><b>%1</b></nobr>) de la ranura <i>%2</i> de la máquina <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
@@ -8411,7 +9060,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Fallo al descartar datos.</translation>
+        <translation type="obsolete">Fallo al descartar datos.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions CD image file.</nobr></p><p>Do you wish to download this CD image from the Internet?</p></source>
@@ -8699,7 +9348,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Uno o más discos duros virtuales, CD/DVD o archivo de imagen de disquete no está accesible. Como resultado, no se pueden operar las máquinas virtuales que usen estos archivos hasta que estén accesibles.</p><p>Presione <b>Comprobar</b> para abrir la ventana del Administrador de medios virtuales y ver que medios están inaccesibles o presione <b>Ignorar</b> para ignorar este mensaje.</p></translation>
+        <translation type="obsolete"><p>Uno o más discos duros virtuales, CD/DVD o archivo de imagen de disquete no está accesible. Como resultado, no se pueden operar las máquinas virtuales que usen estos archivos hasta que estén accesibles.</p><p>Presione <b>Comprobar</b> para abrir la ventana del Administrador de medios virtuales y ver que medios están inaccesibles o presione <b>Ignorar</b> para ignorar este mensaje.</p></translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
@@ -8707,7 +9356,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>¿Está seguro de que quiere eliminar el dispositivo CD/DVD?</p><p>No podrá insertar ningún CD o imagen ISO ni instalar las «Guest Additions» sin él.</p></translation>
+        <translation type="obsolete"><p>¿Está seguro de que quiere eliminar el dispositivo CD/DVD?</p><p>No podrá insertar ningún CD o imagen ISO ni instalar las «Guest Additions» sin él.</p></translation>
     </message>
     <message>
         <source><p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p></source>
@@ -8780,11 +9429,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>El archivo de imagen de las <b>«Guest Additions» de VirtualBox</b> ha sido descargado correctamente de <nobr><a href="%1">%1</a></nobr> y guardado localmente como <nobr><b>%2</b>.</nobr></p><p>¿Desea registrar este archivo de imagen de disco e insertarlo en la unidad virtual de CD/DVD?</p></translation>
+        <translation type="obsolete"><p>El archivo de imagen de las <b>«Guest Additions» de VirtualBox</b> ha sido descargado correctamente de <nobr><a href="%1">%1</a></nobr> y guardado localmente como <nobr><b>%2</b>.</nobr></p><p>¿Desea registrar este archivo de imagen de disco e insertarlo en la unidad virtual de CD/DVD?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>No se puede insertar el archivo de imagen de las <b>«Guest Additions» de VirtualBox</b> en la máquina virtual <b>%1</b> dado que la máquina no tiene unidades CD/DVD. Agregue una unidad usando la página de almacenamiento de la ventana de preferencias de la máquina virtual.</p></translation>
+        <translation type="obsolete"><p>No se puede insertar el archivo de imagen de las <b>«Guest Additions» de VirtualBox</b> en la máquina virtual <b>%1</b> dado que la máquina no tiene unidades CD/DVD. Agregue una unidad usando la página de almacenamiento de la ventana de preferencias de la máquina virtual.</p></translation>
     </message>
     <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
@@ -8796,24 +9445,120 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Fallo al conectar la cámara web <b>%1</b> a la máquina virtual <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Fallo al desconectar la cámara web <b>%1</b> de la máquina virtual <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>Las «Guest Additions» de VirtualBox no parecen estar disponibles en esta máquina virtual y las carpetas compartidas no pueden ser usadas. Para usar las carpetas compartidas en la máquina virtual instale las «Guest Additions» si no están instaladas o reinstalelas si no están funcionando correctamente seleccionando <b>Insertar la imagen de CD de las «Guest Additions»</b> desde el menú <b>Dispositivos</b>. Si están instaladas las carpeta [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
         <comment>additions</comment>
-        <translation>Insertar</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>La pantalla virtual tiene establecido un modo de color de <b>%1&nbsp;bit</b>. Para un mejor rendimiento cámbielo a <b>%2&nbsp;bit</b>. Esto puede hacerse desde la sección <b>Pantalla</b> del Panel de control del sistema operativo invitado o desde las Preferencias del sistema.</p></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8906,7 +9651,7 @@ p, li { white-space: pre-wrap; }
     <name>UINameAndSystemEditor</name>
     <message>
         <source>N&ame:</source>
-        <translation type="obsolete">&Nombre:</translation>
+        <translation>&Nombre:</translation>
     </message>
     <message>
         <source>Holds the name of the virtual machine.</source>
@@ -8936,10 +9681,6 @@ p, li { white-space: pre-wrap; }
         <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
         <translation>Selecciona el tipo del sistema operativo que planea instalar en esta máquina virtual (llamado sistema operativo invitado).</translation>
     </message>
-    <message>
-        <source>&Name:</source>
-        <translation>&Nombre:</translation>
-    </message>
 </context>
 <context>
     <name>UINetworkManagerDialog</name>
@@ -10072,14 +10813,18 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
         <translation>Archivos de máquina virtual (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>¡Bienvenido a VirtualBox!</h3><p>La parte izquierda de esta ventana está destinada a mostrar la lista de máquinas virtuales de su computadora. En este momento esta lista está vacía porque todavía no se ha creado ninguna máquina virtual.<img src=:/welcome.png align=right/></p><p>Para crear una nueva máquina virtual presione el botón <b>Nueva</b> en la barra de herramientas principal localizada en la parte superior de [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>¡Bienvenido a VirtualBox!</h3><p>La parte izquierda de esta ventana está destinada a mostrar la lista de máquinas virtuales de su computadora. En este momento esta lista está vacía porque todavía no se ha creado ninguna máquina virtual.<img src=:/welcome.png align=right/></p><p>Para crear una nueva máquina virtual presione el botón <b>Nueva</b> en la barra de herramientas principal localizada en la p [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Administrador</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -10112,7 +10857,7 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     </message>
     <message>
         <source>Settings</source>
-        <translation>Configuración</translation>
+        <translation type="obsolete">Configuración</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -10165,6 +10910,10 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
         <source>Display</source>
         <translation>Pantalla</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -10240,6 +10989,43 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">está usando más controladores de almacenamiento de los que un chipset %1 soporta. Cambie el tipo de chipset en la página de la configuración del sistema o reduzca el número de los siguientes controladores de almacenamiento en la página de la configuración de almacenamiento: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Configuración</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Cerrar</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -10335,8 +11121,8 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
         <translation type="obsolete">Resumen</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>¡Hay una nueva versión de VirtualBox! La versión <b>%1</b> se ecuentra disponible en <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puede descargar dicha versión directamente desde el siguiente enlace:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>¡Hay una nueva versión de VirtualBox! La versión <b>%1</b> se ecuentra disponible en <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puede descargar dicha versión directamente desde el siguiente enlace:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -10404,6 +11190,14 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
         <source>&Restore current snapshot '%1'</source>
         <translation>&Restaurar instantánea actual «%1»</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -10428,7 +11222,7 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     </message>
     <message>
         <source>%1 - Session Information</source>
-        <translation type="obsolete">%1 - Información de sesión</translation>
+        <translation>%1 - Información de sesión</translation>
     </message>
     <message>
         <source>&Details</source>
@@ -10440,27 +11234,27 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     </message>
     <message>
         <source>DMA Transfers</source>
-        <translation type="obsolete">Transferencias DMA</translation>
+        <translation>Transferencias DMA</translation>
     </message>
     <message>
         <source>PIO Transfers</source>
-        <translation type="obsolete">Transferencias PIO</translation>
+        <translation>Transferencias PIO</translation>
     </message>
     <message>
         <source>Data Read</source>
-        <translation type="obsolete">Datos leídos</translation>
+        <translation>Datos leídos</translation>
     </message>
     <message>
         <source>Data Written</source>
-        <translation type="obsolete">Datos escritos</translation>
+        <translation>Datos escritos</translation>
     </message>
     <message>
         <source>Data Transmitted</source>
-        <translation type="obsolete">Datos transmitidos</translation>
+        <translation>Datos transmitidos</translation>
     </message>
     <message>
         <source>Data Received</source>
-        <translation type="obsolete">Datos recibidos</translation>
+        <translation>Datos recibidos</translation>
     </message>
     <message>
         <source>Enabled</source>
@@ -10472,11 +11266,11 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     </message>
     <message>
         <source>Runtime Attributes</source>
-        <translation type="obsolete">Atributos de tiempo de ejecución</translation>
+        <translation>Atributos de tiempo de ejecución</translation>
     </message>
     <message>
         <source>Screen Resolution</source>
-        <translation type="obsolete">Resolución de pantalla</translation>
+        <translation>Resolución de pantalla</translation>
     </message>
     <message>
         <source>CD/DVD-ROM Statistics</source>
@@ -10498,20 +11292,20 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     <message>
         <source>Not Detected</source>
         <comment>guest additions</comment>
-        <translation type="obsolete">No detectado</translation>
+        <translation>No detectado</translation>
     </message>
     <message>
         <source>Not Detected</source>
         <comment>guest os type</comment>
-        <translation type="obsolete">No detectado</translation>
+        <translation>No detectado</translation>
     </message>
     <message>
         <source>Guest Additions</source>
-        <translation type="obsolete">«Guest Additions»</translation>
+        <translation>«Guest Additions»</translation>
     </message>
     <message>
         <source>Guest OS Type</source>
-        <translation type="obsolete">Tipo de SO invitado</translation>
+        <translation>Tipo de SO invitado</translation>
     </message>
     <message>
         <source>Hard Disk Statistics</source>
@@ -10523,7 +11317,7 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     </message>
     <message>
         <source>No Network Adapters</source>
-        <translation type="obsolete">No hay adaptadores de red</translation>
+        <translation>No hay adaptadores de red</translation>
     </message>
     <message>
         <source>Enabled</source>
@@ -10550,15 +11344,15 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     </message>
     <message>
         <source>Storage Statistics</source>
-        <translation type="obsolete">Estadísticas de almacenamiento</translation>
+        <translation>Estadísticas de almacenamiento</translation>
     </message>
     <message>
         <source>No Storage Devices</source>
-        <translation type="obsolete">No hay dispositivos de almacenamiento</translation>
+        <translation>No hay dispositivos de almacenamiento</translation>
     </message>
     <message>
         <source>Network Statistics</source>
-        <translation type="obsolete">Estadísticas de red</translation>
+        <translation>Estadísticas de red</translation>
     </message>
     <message>
         <source>Nested Paging</source>
@@ -10568,11 +11362,11 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     <message>
         <source>Not Available</source>
         <comment>details report (VRDE server port)</comment>
-        <translation type="obsolete">No disponible</translation>
+        <translation>No disponible</translation>
     </message>
     <message>
         <source>Clipboard Mode</source>
-        <translation type="obsolete">Modo portapapeles</translation>
+        <translation>Modo portapapeles</translation>
     </message>
     <message>
         <source>Drag'n'Drop Mode</source>
@@ -10580,11 +11374,19 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     </message>
     <message>
         <source>Configuration &Details</source>
-        <translation type="obsolete">Detalles de &configuración</translation>
+        <translation>Detalles de &configuración</translation>
     </message>
     <message>
         <source>&Runtime Information</source>
-        <translation type="obsolete">Información de &ejecución</translation>
+        <translation>Información de &ejecución</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10738,11 +11540,27 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Ocultar descripción</translation>
+        <translation type="obsolete">Ocultar descripción</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Mostrar descripción</translation>
+        <translation type="obsolete">Mostrar descripción</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11117,7 +11935,7 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     <name>UIWizardExportAppPageBasic3</name>
     <message>
         <source><p>Please choose a filename to export the OVF/OVA to.</p><p>If you use an <i>ova</i> extension, then all the files will be combined into one Open Virtualization Format Archive.</p><p>If you use an <i>ovf</i> extension, several files will be written separately.</p><p>Other extensions are not allowed.</p></source>
-        <translation><p>Seleccione un nombre de archivo para exportar el OVF/OVA.</p><p>Si usa una extensión <i>ova</i>, entonces todos los archivos se combinarán en un único Open Virtualization Format Archive.</p><p>Si usa una extesión <i>ovf</i>, varios archivos se escribirán separadamente.</p><p>No se permiten otras extensiones.</p>   </translation>
+        <translation><p>Seleccione un nombre de archivo para exportar el OVF/OVA.</p><p>Si usa una extensión <i>ova</i>, entonces todos los archivos se combinarán en un único Open Virtualization Format Archive.</p><p>Su usa una extesión <i>ovf</i>, varios archivos se escribirán separadamente.</p><p>No se permiten otras extensiones.</p>    </translation>
     </message>
     <message>
         <source>Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.</source>
@@ -11344,7 +12162,7 @@ este paso y luego conectar los Discos Duros desde el diálogo de Configuración
     </message>
     <message>
         <source>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</source>
-        <translation>Seleccione un nombre descriptivo para la nueva máquina virtual y el tipo de sistema operativo que tiene intención de instalar en ella. El nombre que seleccione será usado por VirtualBox para identificar esta máquina.</translation>
+        <translation>Seleccione un nombre descriptivo para la nueva máquina virtual y seleccione el tipo de sistema operativo que tiene intención de instalar en ella. El nombre que seleccione será usado por VirtualBox para identificar esta máquina.</translation>
     </message>
     <message>
         <source>Memory size</source>
@@ -12678,7 +13496,7 @@ Versión %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>El valor de la ruta predeterminada será mostrada después de aceptar los cambios y abrir nuevamente este diálogo.</translation>
+        <translation type="unfinished">El valor de la ruta predeterminada será mostrada después de aceptar los cambios y abrir nuevamente este diálogo.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -13955,7 +14773,7 @@ Versión %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>La conexión de este disco duro será realizada indirectamente usando un nuevo disco duro diferenciado.</translation>
+        <translation type="obsolete">La conexión de este disco duro será realizada indirectamente usando un nuevo disco duro diferenciado.</translation>
     </message>
     <message>
         <source>Some of the media in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these media.</source>
@@ -13965,7 +14783,7 @@ Versión %1</translation>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Este disco duro base está indirectamente conectado usando el siguiente disco duro diferenciado:</translation>
+        <translation type="obsolete">Este disco duro base está indirectamente conectado usando el siguiente disco duro diferenciado:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -14011,7 +14829,7 @@ Versión %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -14575,12 +15393,12 @@ Versión %1</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Habilitado</translation>
+        <translation type="obsolete">Habilitado</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Inhabilitado</translation>
+        <translation type="obsolete">Inhabilitado</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -14629,7 +15447,7 @@ Versión %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>USB Tablet</source>
@@ -14688,17 +15506,156 @@ Versión %1</translation>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Algunos de los archivos en esta cadena de discos duros son inaccesibles. Use el Administrador de medios virtuales en el modo <b>Mostrar discos duros diferenciados</b> para inspeccionar estos archivos.</translation>
+        <translation type="obsolete">Algunos de los archivos en esta cadena de discos duros son inaccesibles. Use el Administrador de medios virtuales en el modo <b>Mostrar discos duros diferenciados</b> para inspeccionar estos archivos.</translation>
     </message>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
     </message>
     <message>
         <source>USB Port %1</source>
         <comment>StorageSlot</comment>
-        <translation type="obsolete">Puerto USB %1</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Activo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Activo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Activo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -15585,6 +16542,18 @@ volver al idioma por omisión del sistema.</qt>
         <source>Refresh the list of disk image files</source>
         <translation>Actualizar la lista de archivos de imagen de disco</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -15677,8 +16646,8 @@ volver al idioma por omisión del sistema.</qt>
         <translation type="obsolete">Diálogo de Registro de VirtualBox</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Por favor llene este formulario para informarnos que usa VirtualBox. Opcionalmente puede elegir recibir noticias y actualizaciones.</p><p> Ingrese su nombre completo utilizando caracteres Latinos y su dirección de email en los campos siguientes. Innotek solo usará esta información para la recolectar estadísticas de uso de su producto y para enviarle boletines de noticias. En particular, innotek nunca entregará sus datos a terceros [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Por favor llene este formulario para informarnos que usa VirtualBox. Opcionalmente puede elegir recibir noticias y actualizaciones.</p><p> Ingrese su nombre completo utilizando caracteres Latinos y su dirección de email en los campos siguientes. Innotek solo usará esta información para la recolectar estadísticas de uso de su producto y para enviarle boletines de noticias. En particular, innotek nunca entregará sus datos a terceros [...]
     </message>
     <message>
         <source>&Name</source>
@@ -15737,8 +16706,8 @@ volver al idioma por omisión del sistema.</qt>
         <translation type="obsolete">Seleccionar país/territorio</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Por favor, rellene este formulario para informarnos que usa VirtualBox. Opcionalmente puede elegir recibir noticias y actualizaciones.</p><p> Use caracteres latinos para rellenar los siguientes campos. Sun Microsystems sólo usará esta información para recolectar estadísticas de uso y para enviarle boletines de noticias. En particular, Sun Microsystems nunca proporcionará sus datos a terceros. Puede leer información más detalla de  [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Por favor, rellene este formulario para informarnos que usa VirtualBox. Opcionalmente puede elegir recibir noticias y actualizaciones.</p><p> Use caracteres latinos para rellenar los siguientes campos. Sun Microsystems sólo usará esta información para recolectar estadísticas de uso y para enviarle boletines de noticias. En particular, Sun Microsystems nunca proporcionará sus datos a terceros. Puede leer información más detalla de  [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -16091,8 +17060,8 @@ volver al idioma por omisión del sistema.</qt>
         <translation type="obsolete">Suspender la ejecución de la máquina virtual</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>¡Bienvenido a VirtualBox!</h3><p>La parte izquierda de esta ventana está destinada a mostrar la lista de máquinas virtuales de su computadora. En este momento esta lista está vacía porque todavía no se ha creado ninguna máquina virtual.<img src=:/welcome.png align=right/></p><p>Para crear una nueva máquina virtual presione el botón <b>Nueva</b> en la barra de herramientas principal localizada en la p [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>¡Bienvenido a VirtualBox!</h3><p>La parte izquierda de esta ventana está destinada a mostrar la lista de máquinas virtuales de su computadora. En este momento esta lista está vacía porque todavía no se ha creado ninguna máquina virtual.<img src=:/welcome.png align=right/></p><p>Para crear una nueva máquina virtual presione el botón <b>Nueva</b> en la barra de herramientas principal localizada en la p [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -16961,104 +17930,6 @@ cualquier valor.</qt></translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>Detalles de &configuración</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Información de &ejecución</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Información de sesión</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transferencias DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transferencias PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Datos leídos</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Datos escritos</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Datos transmitidos</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Datos recibidos</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>No detectado</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>No detectado</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>No disponible</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Atributos de tiempo de ejecución</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Resolución de pantalla</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Modo portapapeles</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Modo de arrastrar y soltar</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>«Guest Additions»</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Tipo de SO invitado</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Estadísticas de almacenamiento</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>No hay dispositivos de almacenamiento</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Estadísticas de red</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>No hay adaptadores de red</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_eu.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_eu.ts
index a9f4b16..d8a1aab 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_eu.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_eu.ts
@@ -1,108 +1,129 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
-<TS version="2.0" language="eu">
+<TS version="2.0">
 <context>
     <name>@@@</name>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+1815"/>
         <source>English</source>
         <comment>Native language name</comment>
         <translation>Euskara</translation>
     </message>
     <message>
-        <location line="+11"/>
         <source>--</source>
         <comment>Native language country name (empty if this language is for all countries)</comment>
         <translation></translation>
     </message>
     <message>
-        <location line="+13"/>
         <source>English</source>
         <comment>Language name, in English</comment>
         <translation>Basque</translation>
     </message>
     <message>
-        <location line="+11"/>
         <source>--</source>
         <comment>Language country name, in English (empty if native country name is empty)</comment>
         <translation></translation>
     </message>
     <message>
-        <location line="+13"/>
         <source>Oracle Corporation</source>
         <comment>Comma-separated list of translators</comment>
-        <translation>Xabier Aramendi</translation>
+        <translation>Piarres Beobide</translation>
     </message>
 </context>
 <context>
-    <name>QApplication</name>
+    <name>AttachmentsModel</name>
     <message>
-        <location filename="../src/main.cpp" line="+465"/>
-        <source>Executable <b>%1</b> requires Qt %2.x, found Qt %3.</source>
-        <translation>Exekutagarria <b>%1</b> behar du Qt %2.x, aurkituta Qt %3.</translation>
+        <source>Hard Disk</source>
+        <translation type="obsolete">Disko gogorrak</translation>
     </message>
+</context>
+<context>
+    <name>BootItemsList</name>
     <message>
-        <location line="+4"/>
-        <source>Incompatible Qt Library Error</source>
-        <translation>Bateraezintasun Qt Liburutegi Akatsa</translation>
+        <source>Move Up (Ctrl-Up)</source>
+        <translation type="obsolete">Gora Mugitu (Ktrl-Gora)</translation>
     </message>
     <message>
-        <location line="+192"/>
-        <source>VirtualBox - Error In %1</source>
-        <translation>VirtualBox - Akatsa Hemen %1</translation>
+        <source>Move Down (Ctrl-Down)</source>
+        <translation type="obsolete">Behera Mugitu (Ktrl-Behera)</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><html><b>%1 (rc=%2)</b><br/><br/></source>
-        <translation><html><b>%1 (rc=%2)</b><br/><br/></translation>
+        <source>Moves the selected boot device up.</source>
+        <translation type="obsolete">Hautatutako abio gailua gora mugitzen du.</translation>
     </message>
     <message>
-        <location line="-558"/>
-        <source>Please try reinstalling VirtualBox.</source>
-        <translation>Mesedez ezarri berriro VirtualBox.</translation>
+        <source>Moves the selected boot device down.</source>
+        <translation type="obsolete">Hautatutako abio gailua behera mugitzen du.</translation>
+    </message>
+</context>
+<context>
+    <name>BootItemsTable</name>
+    <message>
+        <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
+        <translation type="obsolete">Abio gailu ordena ezartzen du. Aukerakutxak erabili abio gailuak gaitu edo ezgaitzeko. Elementuak gora eta behera mugitu gailu ordena aldatzeko.</translation>
+    </message>
+</context>
+<context>
+    <name>HDItemsModel</name>
+    <message>
+        <source>Hard Disk</source>
+        <translation type="obsolete">Disko gogorrak</translation>
     </message>
+</context>
+<context>
+    <name>QApplication</name>
     <message>
-        <location line="-5"/>
         <source>Make sure the kernel module has been loaded successfully.</source>
-        <translation>Zihurtu kernel moduloa ongi gertatu dela.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Executable <b>%1</b> requires Qt %2.x, found Qt %3.</source>
+        <translation><b>%1</b> abiarazgarriak Qt %2.x behar du, Qt %3 aurkitu da.</translation>
+    </message>
+    <message>
+        <source>Incompatible Qt Library Error</source>
+        <translation>Bateraezin Qt Liburutegi Errorea</translation>
     </message>
     <message>
-        <location line="+498"/>
         <source>VirtualBox - Runtime Error</source>
-        <translation>VirtualBox - Runtime Akatsa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
         <source><b>Cannot access the kernel driver!</b><br/><br/></source>
-        <translation><b>Ezin da kernel gidagailura sartu!</b><br/><br/></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Kernel driver not accessible</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+23"/>
         <source>Unknown error %2 during initialization of the Runtime</source>
-        <translation>%2 akats ezezaguna Runtime abiarazpenean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-10"/>
-        <source>Kernel driver not accessible</source>
-        <translation>Kernel gidagailua ez dago eskuragarri</translation>
+        <source>VirtualBox - Error In %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><html><b>%1 (rc=%2)</b><br/><br/></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please try reinstalling VirtualBox.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-533"/>
         <source>The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Please try completely uninstalling and reinstalling VirtualBox.</source>
-        <translation>VirtualBox kernel moduloak ez datoz bat VirtualBox-en bertsio honekin. VirtualBox-en ezarpenak dirudienez ez da ongi egin. Mesedez saiatu osorik kentzen eta VirtualBox berriro ezartzen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
         <source>The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.</source>
-        <translation>VirtualBox kernel moduloak ez datoz bat VirtualBox bertsio honekin. VirtualBox-en ezarpena dirudienez ez da ongi egin. <br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/> exekutatzeak hau zuzendu dezake. Zihurtatu ez dituzula VirtualBox-en OSE bertsioa eta PUEL bertsioa nahastu.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-22"/>
         <source>This error means that the kernel driver was either not able to allocate enough memory or that some mapping operation failed.</source>
-        <translation>Akats honek esanahi dut kernel gidatzailea ez dela gauza nahikoa oroimen esleitzeko edo mapaketa eragiketaren batek huts egin duela.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
         <source>The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necess [...]
         <translation type="unfinished"></translation>
     </message>
@@ -110,88 +131,83 @@
 <context>
     <name>QIArrowSplitter</name>
     <message>
-        <location filename="../src/extensions/QIArrowSplitter.cpp" line="+32"/>
         <source>&Back</source>
-        <translation>&Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>&Next</source>
-        <translation>&Hurrengoa</translation>
+        <translation type="unfinished">&Hurrengoa</translation>
     </message>
 </context>
 <context>
     <name>QIFileDialog</name>
     <message>
-        <location filename="../src/extensions/QIFileDialog.cpp" line="+270"/>
         <source>Select a directory</source>
-        <translation>Hautatu zuzenbidea</translation>
+        <translation type="unfinished">Hautatu direktorio bat</translation>
     </message>
     <message>
-        <location line="+198"/>
-        <location line="+249"/>
         <source>Select a file</source>
-        <translation>Hautatu agiri bat</translation>
+        <translation type="unfinished">Hautatu fitxategi bat</translation>
+    </message>
+</context>
+<context>
+    <name>QIHelpButton</name>
+    <message>
+        <source>&Help</source>
+        <translation type="obsolete">&Laguntza</translation>
     </message>
 </context>
 <context>
     <name>QILabel</name>
     <message>
-        <location filename="../src/extensions/QILabel.cpp" line="+197"/>
         <source>&Copy</source>
-        <translation>&Kopiatu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QIMessageBox</name>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="+310"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="+1733"/>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="+176"/>
         <source>OK</source>
-        <translation>Ongi</translation>
+        <translation>Ados</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="+10"/>
         <source>Yes</source>
         <translation>Bai</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="+1"/>
         <source>No</source>
         <translation>Ez</translation>
     </message>
     <message>
-        <location line="-2"/>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="-5"/>
         <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <translation>Utzi</translation>
     </message>
     <message>
         <source>Ignore</source>
         <translation type="obsolete">Ezikusi</translation>
     </message>
     <message>
-        <location line="+59"/>
         <source>&Details</source>
-        <translation>&Xehetasunak</translation>
+        <translation type="unfinished">&Xehetasunak</translation>
     </message>
     <message>
-        <location line="+24"/>
         <source>&Details (%1 of %2)</source>
-        <translation>&Xehetasunak (%1 -> %2-tik)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-102"/>
         <source>Copy all errors to the clipboard</source>
-        <translation>Kopiatu akats guztiak gakora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+22"/>
         <source>Copy</source>
-        <translation>Kopiatu</translation>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>QIRichLabel</name>
+    <message>
+        <source>Copy to clipboard</source>
+        <translation type="obsolete">Arbelara kopiatu</translation>
     </message>
 </context>
 <context>
@@ -199,7 +215,7 @@
     <message>
         <source>not complete</source>
         <comment>value state</comment>
-        <translation type="obsolete">osatu gabe</translation>
+        <translation type="obsolete">ez betea</translation>
     </message>
     <message>
         <source>invalid</source>
@@ -208,10884 +224,13886 @@
     </message>
     <message>
         <source><qt>The value of the <b>%1</b> field on the <b>%2</b> page is %3.</qt></source>
-        <translation type="obsolete"><qt><b>%1</b> eremuaren balioa <b>%2</b> orrialdean da %3.</qt></translation>
+        <translation type="obsolete"><qt><b>%2</b> orrialdeko <b>%1</b> eremuaren balioa %3 da.</qt></translation>
     </message>
     <message>
         <source><qt>One of the values on the <b>%1</b> page is %2.</qt></source>
-        <translation type="obsolete"><qt>Balioetako bat <b>%1</b> orrialdean da %2.</qt></translation>
+        <translation type="obsolete"><qt><b>%1</b> orrialdeko balio bat %2 da.</qt></translation>
     </message>
 </context>
 <context>
     <name>UIActionPool</name>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="+41"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+396"/>
         <source>&Machine</source>
         <translation>&Makina</translation>
     </message>
     <message>
-        <location line="+573"/>
+        <source>&Fullscreen Mode</source>
+        <translation type="obsolete">&Panataila Osoko Modua</translation>
+    </message>
+    <message>
+        <source>Switch to fullscreen mode</source>
+        <translation type="obsolete">Panataila oso modura aldatu</translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation type="unfinished">Gardenta&sun Modua</translation>
+    </message>
+    <message>
+        <source>Switch to seamless desktop integration mode</source>
+        <translation type="obsolete">Idazmahai integrazio garden modura aldatu</translation>
+    </message>
+    <message>
+        <source>Auto-resize &Guest Display</source>
+        <translation type="unfinished">Automatikoki Tamaina Aldatu &Bezero Pantaila</translation>
+    </message>
+    <message>
         <source>Automatically resize the guest display when the window is resized (requires Guest Additions)</source>
-        <translation>Berezgaitasunez birneurriratzen du gonbidatu erakuspena leihoa birneurriratzerakoan (Gonbidatu Gehigarriak behar ditu)</translation>
+        <translation>Automatikoki tamainaz aldatu bezero pantaila leihoa tamaina aldatzean (Bezero Gehigarriak behar du)</translation>
     </message>
     <message>
-        <location line="+30"/>
         <source>&Adjust Window Size</source>
-        <translation>&Zehaztu Leiho Neurria</translation>
+        <translation>Leiho Tamaina &Doitu</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Adjust window size and position to best fit the guest display</source>
-        <translation>Zehaztu leiho neurria eta kokapena gonbidatu erakuspen hoberenera finkatzeko</translation>
+        <translation>Leiho tamaina eta kokalekua doitu bezero pantaila hobe sartzeko</translation>
     </message>
     <message>
-        <location line="-431"/>
         <source>Disable &Mouse Integration</source>
-        <translation>Ezgaitu &Sagu Baterapena</translation>
+        <translation type="obsolete">&Sagu Integrazioa ezgaitu</translation>
     </message>
     <message>
-        <location line="-49"/>
-        <source>Show Session Information Window</source>
-        <translation>Erakutsi Saio Argibide Leihoa</translation>
+        <source>Temporarily disable host mouse pointer integration</source>
+        <translation type="obsolete">Aldirako ezgaitu sagu markatzaile integrazioa</translation>
     </message>
     <message>
-        <location line="+50"/>
-        <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Ezgaitu aldibaterako hostalari sagu buru baterapena</translation>
+        <source>Enable &Mouse Integration</source>
+        <translation type="obsolete">&Sagu integrazioa gaitu</translation>
+    </message>
+    <message>
+        <source>Enable temporarily disabled host mouse pointer integration</source>
+        <translation type="obsolete">Aldirako ezgaituriko sagu markatzaile integrazioa gaitu</translation>
     </message>
     <message>
-        <location line="+30"/>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Txertatu Ctrl-Alt-Ezab</translation>
+        <translation type="obsolete">B&idali Ktrl-Alt-Ezab</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Bidali Ktrl-Alt-Ezab sekuentzia makina birtualari</translation>
+        <translation type="obsolete">Ktrl+Alt+Ezab sekuentzia bidali makina birtualera</translation>
+    </message>
+    <message>
+        <source>&Insert Ctrl-Alt-Backspace</source>
+        <translation type="obsolete">B&idali Ktrl-Alt-Atzera-tekla</translation>
     </message>
     <message>
-        <location line="+32"/>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Bidali Ktrl-Alt-Atzera sekuentzia makina birtualari</translation>
+        <translation type="obsolete">Ktrl-Alt-Atzera-tekla sekuentzia bidali makina birtualera</translation>
     </message>
     <message>
-        <location line="-175"/>
-        <source>Take a snapshot of the virtual machine</source>
-        <translation>Hartu makina birtualaren argazki bat</translation>
+        <source>Take &Snapshot...</source>
+        <translation type="obsolete">&Egoera-argazkia egin...</translation>
     </message>
     <message>
-        <source>Show Session Information Dialog</source>
-        <translation type="obsolete">Erakutsi Saio Argibide Elkarrizketa</translation>
+        <source>Take a snapshot of the virtual machine</source>
+        <translation>Makina Birtualaren egoera-argazki bat egin</translation>
     </message>
     <message>
-        <location line="+208"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+274"/>
         <source>&Pause</source>
-        <translation>&Pausatu</translation>
+        <translation>&Gelditu</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Suspend the execution of the virtual machine</source>
-        <translation>Utzi makina birtualaren exekuzioa</translation>
+        <translation>Makina Birtualaren exekuzioa gelditu</translation>
+    </message>
+    <message>
+        <source>R&esume</source>
+        <translation type="obsolete">Ja&rraitu</translation>
+    </message>
+    <message>
+        <source>Resume the execution of the virtual machine</source>
+        <translation type="obsolete">Makina birtualaren exekuzioa jarraitu</translation>
     </message>
     <message>
-        <location line="+30"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+31"/>
         <source>&Reset</source>
         <translation>Be&rrezarri</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Reset the virtual machine</source>
-        <translation>Berrezarri makina birtuala</translation>
+        <translation>Makina Birtuala berrezarri</translation>
     </message>
     <message>
-        <location line="+26"/>
-        <source>Save the machine state of the virtual machine</source>
-        <translation>Gorde makina birtualaren makina egoera</translation>
+        <source>ACPI Sh&utdown</source>
+        <translation></translation>
     </message>
     <message>
-        <location line="+34"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+238"/>
-        <source>ACPI Sh&utdown</source>
-        <translation>ACPI &Itzali</translation>
+        <source>ACPI S&hutdown</source>
+        <translation type="obsolete">ACPI It&zalia</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Send the ACPI Power Button press event to the virtual machine</source>
-        <translation>Bidali ACPI Indar Botoi sakatze gertaera makina birtualera</translation>
+        <translation>ACPI Indar Botoia Gertaera bidali makina birtualera</translation>
     </message>
     <message>
-        <location line="+57"/>
         <source>&Close...</source>
         <translation>It&xi...</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Close the virtual machine</source>
-        <translation>Itxi makina birtuala</translation>
+        <translation>Makina Birtuala itxi</translation>
     </message>
     <message>
-        <location line="+20"/>
         <source>&View</source>
-        <translation>&Ikusi</translation>
-    </message>
-    <message>
-        <location line="+98"/>
-        <source>Switch to &Scaled Mode</source>
-        <translation>Aldatu &Modu Eskalatura</translation>
-    </message>
-    <message>
-        <location line="+1"/>
-        <source>Switch between normal and scaled mode</source>
-        <translation>Aldatu modu arrunt eta eskalatuaren artean</translation>
+        <translation></translation>
     </message>
     <message>
-        <location line="+84"/>
         <source>&Devices</source>
         <translation>&Gailuak</translation>
     </message>
     <message>
-        <location line="+21"/>
-        <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD Gailuak</translation>
-    </message>
-    <message>
-        <location line="+21"/>
-        <source>&Floppy Devices</source>
-        <translation>&Diskete Gailuak</translation>
-    </message>
-    <message>
-        <location line="+21"/>
         <source>&USB Devices</source>
-        <translation>&USB Gailuak</translation>
-    </message>
-    <message>
-        <location line="+21"/>
-        <source>&Webcams</source>
-        <translation>&Webkamerak</translation>
-    </message>
-    <message>
-        <location line="+60"/>
-        <source>Network</source>
-        <translation>Sarea</translation>
-    </message>
-    <message>
-        <location line="+25"/>
-        <source>&Network Settings...</source>
-        <translation>&Sare Ezarpenak...</translation>
-    </message>
-    <message>
-        <location line="+43"/>
-        <source>&Shared Folders Settings...</source>
-        <translation>&Elkarbanatutako Agiritegi Ezarpenak...</translation>
-    </message>
-    <message>
-        <location line="+28"/>
-        <source>R&emote Display</source>
-        <translation>&Hurruneko Erakuspena</translation>
-    </message>
-    <message>
-        <location line="+1"/>
-        <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>Aldatu hurruneko mahaigain (HMG) elkarketak makina honetara</translation>
-    </message>
-    <message>
-        <location line="+44"/>
-        <source>&Video Capture</source>
-        <translation>&Bideo Harpena</translation>
+        <translation type="obsolete">&USB Gailuak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Toggle video capture</source>
-        <translation>Aldatu bideo harpena</translation>
-    </message>
-    <message>
-        <location line="+25"/>
-        <source>&Video Capture Settings...</source>
-        <translation>*&Bideo Harpen Ezarpenak...</translation>
-    </message>
-    <message>
-        <location line="+1"/>
-        <source>Configure video capture settings</source>
-        <translation>Itxuratu bideo harpen ezarpenak</translation>
-    </message>
-    <message>
-        <location line="+30"/>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>&Txertatu Gonbidatu Gehigarrien CD irudia...</translation>
-    </message>
-    <message>
-        <location line="+1"/>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Txertatu Gonbidatu Gehigarri diska agiria gidagailu birtualean</translation>
-    </message>
-    <message>
-        <location line="+96"/>
-        <source>&Logging...</source>
-        <comment>debug action</comment>
-        <translation>&Oharreratzea...</translation>
-    </message>
-    <message>
-        <source>&Network Adapters...</source>
-        <translation type="obsolete">&Sare Egokigailuak...</translation>
-    </message>
-    <message>
-        <location line="-269"/>
         <source>Change the settings of network adapters</source>
-        <translation>Aldatu sare egokigailuen ezarpenak</translation>
+        <translation></translation>
     </message>
     <message>
         <source>&Shared Folders...</source>
-        <translation type="obsolete">&Elkarbanatutako Agiritegiak...</translation>
+        <translation type="obsolete">&Partekatutako Karpetak...</translation>
     </message>
     <message>
-        <location line="+43"/>
         <source>Create or modify shared folders</source>
-        <translation>Sortu edo aldatu elkarbanatutako agiritegiak</translation>
+        <translation>Partekatutako karpetekin aritzeko leihoa ireki</translation>
+    </message>
+    <message>
+        <source>Enable or disable remote desktop (RDP) connections to this machine</source>
+        <translation type="obsolete">Urruneko idazmahai (RDP) konexioak gaitu edo ezgaitu maina honetarako</translation>
     </message>
     <message>
         <source>&Install Guest Additions...</source>
-        <translation type="obsolete">&Ezarri Gonbidatu Gehigarriak...</translation>
+        <translation type="obsolete">Bezero Gehigarriak &Instalatu...</translation>
     </message>
     <message>
         <source>Mount the Guest Additions installation image</source>
-        <translation type="obsolete">Osatu Gonbidatu Gehigarri ezarpen irudia</translation>
+        <translation type="obsolete">Bezero Gehigarri instalazio irudia muntatu</translation>
     </message>
     <message>
-        <location line="+151"/>
         <source>De&bug</source>
-        <translation>&Garbitu</translation>
+        <translation>Ara&zpena</translation>
     </message>
     <message>
-        <location line="+25"/>
         <source>&Statistics...</source>
         <comment>debug action</comment>
-        <translation>&Estatistikak...</translation>
+        <translation>E&statistikak...</translation>
     </message>
     <message>
-        <location line="+25"/>
         <source>&Command Line...</source>
         <comment>debug action</comment>
-        <translation>&Komando Lerroa...</translation>
+        <translation></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="+347"/>
         <source>&Help</source>
         <translation>&Laguntza</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="+64"/>
         <source>Dock Icon</source>
-        <translation>Uztartu Ikurra</translation>
+        <translation></translation>
     </message>
     <message>
-        <location line="+25"/>
         <source>Show Monitor Preview</source>
-        <translation>Erakutsi Monitore Aurreikuspena</translation>
+        <translation></translation>
     </message>
     <message>
-        <location line="+25"/>
         <source>Show Application Icon</source>
-        <translation>Erakutsi Aplikazio Ikurra</translation>
-    </message>
-    <message>
-        <source>Enable remote desktop (RDP) connections to this machine</source>
-        <translation type="obsolete">Gaitu hurruneko mahaigain (RDP) elkarketak makina honetara</translation>
-    </message>
-    <message>
-        <source>Enable &Logging...</source>
-        <comment>debug action</comment>
-        <translation type="obsolete">Gaitu &Oharreratzea...</translation>
-    </message>
-    <message>
-        <location line="-679"/>
-        <source>Switch to &Fullscreen</source>
-        <translation>Aldatu &Ikusleiho-osora</translation>
-    </message>
-    <message>
-        <location line="+1"/>
-        <source>Switch between normal and fullscreen mode</source>
-        <translation>Aldatu modu arruntaren eta ikusleiho-osoko artean</translation>
-    </message>
-    <message>
-        <location line="+32"/>
-        <source>Switch to Seam&less Mode</source>
-        <translation>&Aldatu &Irudizko Modura</translation>
+        <translation></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Switch between normal and seamless desktop integration mode</source>
-        <translation>Aldatu modu arruntaren eta irudizko mahaigain baterapen moduaren artean</translation>
-    </message>
-    <message>
-        <source>Switch to &Scale Mode</source>
-        <translation type="obsolete">Aldatu &Neurriratu Modura</translation>
-    </message>
-    <message>
-        <source>Switch between normal and scale mode</source>
-        <translation type="obsolete">Aldatu modu arrunta eta neurriratu modu artean</translation>
-    </message>
-    <message>
-        <location line="+65"/>
-        <source>Auto-resize &Guest Display</source>
-        <translation>&Berez-neurriratu Gonbidatu Erakuspena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enable R&emote Display</source>
-        <translation type="obsolete">Gaitu &Hurruneko Erakuspena</translation>
+        <source>Switch between normal and scaled mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-542"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="-416"/>
         <source>&Settings...</source>
-        <translation>E&zarpenak...</translation>
+        <translation type="unfinished">&Ezarpenak...</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+1"/>
         <source>Manage the virtual machine settings</source>
-        <translation>Kudeatu makina birtualaren ezarpenak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+92"/>
         <source>Session I&nformation...</source>
-        <translation>Saio &Argibideak...</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show the log files of the selected virtual machine</source>
+        <translation type="unfinished">Hautatutako makina birtualaren erregistro fitxategiak ikusi</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="+35"/>
         <source>&Contents...</source>
-        <translation>&Edukiak...</translation>
+        <translation type="unfinished">&Edukiak...</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Show help contents</source>
-        <translation>Erakutsi laguntza edukiak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+26"/>
         <source>Open the browser and go to the VirtualBox product web site</source>
-        <translation>Ireki nabigatzailea eta joan VirtuaBox produktuaren web gunera</translation>
+        <translation type="unfinished">Nabigatzailea ireki eta VirtualBox produktuaren gunera joan</translation>
     </message>
     <message>
-        <location line="+26"/>
         <source>Go back to showing all suppressed warnings and messages</source>
-        <translation>Joan atzera ezabatutako ohar eta mezu guztiak erakusteko</translation>
+        <translation type="unfinished">Ezabatutako abisu eta mezu guztiak berriz agertzea eragien du</translation>
     </message>
     <message>
-        <location line="+26"/>
         <source>&Network Operations Manager...</source>
-        <translation>&Sare Eragiketa Kudeatzailea...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Show Network Operations Manager</source>
-        <translation>Erakutsi Sare Eragiketa Kudeatzailea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+27"/>
         <source>Check for a new VirtualBox version</source>
-        <translation>Egiaztatu VirtualBox bertsio berririk dagoen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+27"/>
         <source>&About VirtualBox...</source>
-        <translation>&VirtualBox-eri buruz...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Show a window with product information</source>
-        <translation>Erakutsi leiho bat produktuaren argibideekin</translation>
-    </message>
-    <message>
-        <source>Show a dialog with product information</source>
-        <translation type="obsolete">Erakutsi elkarrizketa bat produktuaren argibideekin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="-62"/>
         <source>Take Sn&apshot...</source>
-        <translation>Hartu &Argazki bat...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+31"/>
         <source>Take Screensh&ot...</source>
-        <translation>Hartu &Ikusleiho-argazki bat...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Take a screenshot of the virtual machine</source>
-        <translation>Hartu makina birtualaren ikusleiho-argazki bat</translation>
-    </message>
-    <message>
-        <location line="+143"/>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>T&xertatu Ctrl-Alt-Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="-482"/>
         <source>&File</source>
         <comment>Mac OS X version</comment>
-        <translation>&Agiria</translation>
+        <translation type="unfinished">&Fitxategia</translation>
     </message>
     <message>
-        <location line="+2"/>
         <source>&File</source>
         <comment>Non Mac OS X version</comment>
-        <translation>&Agiria</translation>
+        <translation type="unfinished">&Fitxategia</translation>
     </message>
     <message>
-        <location line="+31"/>
         <source>&Virtual Media Manager...</source>
-        <translation>&Multimedia Birtual Kudeatzailea...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Display the Virtual Media Manager dialog</source>
-        <translation type="obsolete">Erakutsi Multimedia Birtual Kudeatzaile elkarrizketa</translation>
+        <source>Display the Virtual Media Manager window</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+31"/>
         <source>&Import Appliance...</source>
-        <translation>&Inportatu Makina Birtuala...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Import an appliance into VirtualBox</source>
-        <translation>Inportatu makina birtual bat VirtualBox-era</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+30"/>
         <source>&Export Appliance...</source>
-        <translation>&Esportatu Makina Birtuala...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Export one or more VirtualBox virtual machines as an appliance</source>
-        <translation>Esportatu VirtualBox makina birtual bat edo gehiago appliance bezala</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+31"/>
         <source>&Preferences...</source>
         <comment>global settings</comment>
-        <translation>&Hobespenak...</translation>
+        <translation type="unfinished">Hobes&penak...</translation>
     </message>
     <message>
-        <source>Display the global settings dialog</source>
-        <translation type="obsolete">Erakutsi ezarpen orokor elkarrizketa</translation>
+        <source>Display the global settings window</source>
+        <translation type="unfinished">Ezarpen orokor leihoa bistarazi</translation>
     </message>
     <message>
-        <location line="+32"/>
         <source>E&xit</source>
-        <translation>I&rten</translation>
+        <translation type="unfinished">I&rten</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Close application</source>
-        <translation>Itxi aplikazioa</translation>
+        <translation type="unfinished">Aplikazioa Itxi</translation>
     </message>
     <message>
-        <location line="+21"/>
         <source>&Group</source>
-        <translation>&Taldea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+31"/>
-        <location line="+173"/>
         <source>Create a new virtual machine</source>
-        <translation>Sortu makina birtual berri bat</translation>
+        <translation type="unfinished">Makina Birtual Berria Sortu</translation>
     </message>
     <message>
-        <location line="-140"/>
-        <location line="+173"/>
         <source>Add an existing virtual machine</source>
-        <translation>Gehitu badagoen makina birtual bat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-142"/>
         <source>Rename the selected virtual machine group</source>
-        <translation>Berrizendatu hautaturiko makina birtual taldea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+304"/>
         <source>S&tart</source>
-        <translation>&Hasi</translation>
+        <translation type="unfinished">Abiara&zi</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtuala abiarazi</translation>
     </message>
     <message>
-        <location line="+8"/>
         <source>S&how</source>
-        <translation>&Erakutsi</translation>
+        <translation type="unfinished">I&kusi</translation>
+    </message>
+    <message>
+        <source>Switch to the window of the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtualaren leihora aldatu</translation>
     </message>
     <message>
-        <location line="+135"/>
         <source>Re&fresh...</source>
-        <translation>Berr&itu...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Refresh the accessibility state of the selected virtual machine</source>
-        <translation>Berritu hautaturiko makina birtualaren sarbidetasun egoera</translation>
+        <translation type="unfinished">Hautatutako makina birtualaren eskuragarritasun egoera freskatu</translation>
     </message>
     <message>
-        <location line="+26"/>
         <source>Show in Finder</source>
-        <translation>Erakutsi Bilatzailea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
         <source>Show in Explorer</source>
-        <translation>Erakutsi Nabigatzailean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
         <source>Show in File Manager</source>
-        <translation>Erakutsi Agiri Kudeatzailea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Show the VirtualBox Machine Definition file in the File Manager</source>
-        <translation>Erakutsi VirtualBox Makina Adiera agiria Agiri Kudeatzailean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-373"/>
         <source>&New...</source>
-        <translation>&Berria...</translation>
-    </message>
-    <message>
-        <location line="-350"/>
-        <source>Display the Virtual Media Manager window</source>
-        <translation>Erakutsi Multimedia Birtual Kudeatzaile leihoa</translation>
-    </message>
-    <message>
-        <location line="+94"/>
-        <source>Display the global settings window</source>
-        <translation>Erakutsi ezarpen orokorren leihoa</translation>
+        <translation type="unfinished">&Berria...</translation>
     </message>
     <message>
-        <location line="+289"/>
         <source>&Add...</source>
-        <translation>&Gehitu...</translation>
+        <translation type="unfinished">&Gehitu...</translation>
     </message>
     <message>
-        <location line="+32"/>
         <source>Add a new group based on the items selected</source>
-        <translation>Gehitu talde berri bat hautaturiko gaietan ohinarrituta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+65"/>
         <source>Cl&one...</source>
-        <translation>Kl&onatu...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Clone the selected virtual machine</source>
-        <translation>Klonatu hautaturiko makina birtuala</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+32"/>
         <source>&Remove...</source>
-        <translation>&Kendu...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+145"/>
         <source>Discard</source>
-        <translation>Baztertu</translation>
+        <translation type="unfinished">Baztertu</translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>D&iscard saved state...</source>
-        <translation>Baztert&u gordetako egoera...</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Discard the saved state of the selected virtual machine</source>
+        <translation type="obsolete">Baztertu hautatutako makina birtualaren gordetako egoera</translation>
     </message>
     <message>
-        <location line="+143"/>
         <source>&Close</source>
-        <translation>It&xi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="-191"/>
         <source>Show &Log...</source>
-        <translation>Erakutsi O&harra...</translation>
+        <translation type="unfinished">E&rregistroa Ikusi...</translation>
     </message>
     <message>
-        <location line="+82"/>
         <source>&VirtualBox Web Site...</source>
-        <translation>VirtualBox &Web Gunea...</translation>
+        <translation type="unfinished">&VirtualBox Web Gunea...</translation>
     </message>
     <message>
-        <location line="+26"/>
         <source>&Reset All Warnings</source>
-        <translation>&Berrezarri Ohartarazpen Guztiak</translation>
+        <translation type="unfinished">Abisu Guztiak Be&rrezarri</translation>
     </message>
     <message>
-        <location line="+54"/>
         <source>C&heck for Updates...</source>
-        <translation>&Egiaztatu Eguneraketarik dagoen...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="-561"/>
         <source>Rena&me Group...</source>
-        <translation>Berrizendatu &Taldea...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+58"/>
         <source>Sort the items of the selected virtual machine group alphabetically</source>
-        <translation>Antolatu hautaturiko makina birtual taldeko gaiak alfabetikoki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+215"/>
         <source>Remove the selected virtual machines</source>
-        <translation>Kendu hautaturiko makina birtualak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+33"/>
         <source>Start the selected virtual machines</source>
-        <translation>Abiarazi hautaturiko makina birtualak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
         <source>Switch to the windows of the selected virtual machines</source>
-        <translation>Aldatu hautaturiko makina birtualen leihoetara</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+40"/>
         <source>Suspend the execution of the selected virtual machines</source>
-        <translation>Eten hautaturiko makina birtualen exekuzioa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+31"/>
         <source>Reset the selected virtual machines</source>
-        <translation>Berrezarri hautaturiko makinabirtualak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+34"/>
         <source>Discard the saved state of the selected virtual machines</source>
-        <translation>Baztertu hautaturiko makina birtualen gordetako egoera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+57"/>
         <source>Show the VirtualBox Machine Definition file in Finder</source>
-        <translation>Erakutsi VirtualBox Makina Adiera agiria Bilatzailean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
         <source>Show the VirtualBox Machine Definition file in Explorer</source>
-        <translation>Erakutsi VirtualBox Makina Adiera agiria Exploratzailean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+30"/>
         <source>Create Alias on Desktop</source>
-        <translation>Sortu Ezinzena Mahaigainean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Creates an alias file to the VirtualBox Machine Definition file on your desktop</source>
-        <translation>VirtualBox Makina Adiera agiriaren ezizen agiri bat sortzen du zure mahaigainean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
         <source>Create Shortcut on Desktop</source>
-        <translation>Sortu Lasterbidea Mahaigainean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Creates an shortcut file to the VirtualBox Machine Definition file on your desktop</source>
-        <translation>VirtualBox Makina Adiera agiriaren lasterbide agiri bat sortzen du zure mahaigainean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="+91"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+78"/>
         <source>Save State</source>
-        <translation>Gorde Egoera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+1"/>
         <source>Save the machine state of the selected virtual machines</source>
-        <translation>Gorde hautaturiko makina birtualen makina egoera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+31"/>
         <source>Send the ACPI Power Button press event to the selected virtual machines</source>
-        <translation>Bidali ACPI Indar Botoi sakatze gertaera hautaturiko makina birtualetara</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="+61"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+30"/>
         <source>Po&wer Off</source>
-        <translation>&Itzali</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="+1"/>
         <source>Power off the selected virtual machines</source>
-        <translation>Itzali hautaturiko makina birtualak</translation>
-    </message>
-    <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="-161"/>
-        <source>Show the log files of the selected virtual machine</source>
-        <translation>Erakutsi hautaturiko makina birtualen ohar agiriak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="-718"/>
         <source>&New Machine...</source>
-        <translation>&Makina Berria...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+33"/>
         <source>&Add Machine...</source>
-        <translation>&Gehitu Makina...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+62"/>
         <source>&Ungroup...</source>
-        <translation>&Destaldekatu...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
         <source>Ungroup items of the selected virtual machine group</source>
-        <translation>Destaldekatu hautaturiko makina birtual taldeko gaiak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+25"/>
-        <location line="+482"/>
         <source>Sort</source>
-        <translation>Antolatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-366"/>
         <source>Gro&up</source>
-        <translation>&Taldea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+367"/>
         <source>Sort the group of the first selected machine alphabetically</source>
-        <translation>Antolatu hautaturiko lehen makinaren taldea alfabetikoki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="+340"/>
         <source>Shared &Clipboard</source>
-        <translation>&Elkarbanatutako Gakoa</translation>
-    </message>
-    <message>
-        <location line="+20"/>
-        <source>Drag'n'Drop</source>
-        <translation>Arrastatu-eta-Askatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Save the virtual machine state</source>
-        <translation type="obsolete">Gorde makina birtualaren egoera</translation>
+        <source>Save the machine state of the virtual machine</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-359"/>
         <source>Power off the virtual machine</source>
-        <translation>Itzali makina birtuala</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIShortcutPool.cpp" line="+234"/>
-        <location line="+7"/>
-        <source>Popup Menu</source>
-        <translation>Oharleiho Menua</translation>
+        <source>&Network Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIApplianceEditorWidget</name>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="+102"/>
-        <source>Virtual System %1</source>
-        <translation>Sistema Birtuala %1</translation>
+        <source>&Shared Folders Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+97"/>
-        <source>Name</source>
-        <translation>Izena</translation>
+        <source>R&emote Display</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Product</source>
-        <translation>Produktua</translation>
+        <source>Toggle remote desktop (RDP) connections to this machine</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Product-URL</source>
-        <translation>Produktuaren URL-a</translation>
+        <source>&Video Capture</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Vendor</source>
-        <translation>Saltzailea</translation>
+        <source>Toggle video capture</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Vendor-URL</source>
-        <translation>Saltzailearen URL-a</translation>
+        <source>&Video Capture Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Version</source>
-        <translation>Bertsioa</translation>
+        <source>Configure video capture settings</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location line="+675"/>
-        <source>Description</source>
-        <translation>Azalpena</translation>
+        <source>Popup Menu</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-674"/>
-        <source>License</source>
-        <translation>Baimena</translation>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Guest OS Type</source>
-        <translation>Gonbidatu SE Mota</translation>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>CPU</source>
-        <translation>CPU</translation>
+        <source>&Insert Guest Additions CD image...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>RAM</source>
-        <translation>RAM</translation>
+        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Hard Disk Controller (IDE)</source>
-        <translation>Diska Gogor Kontrolatzailea (IDE)</translation>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Hard Disk Controller (SATA)</source>
-        <translation>Diska Gogor Kontrolatzailea (SATA)</translation>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Hard Disk Controller (SCSI)</source>
-        <translation>Diska Gogor Kontrolatzailea (SCSI)</translation>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>DVD</source>
-        <translation>DVD</translation>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Floppy</source>
-        <translation>Disketea</translation>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Network Adapter</source>
-        <translation>Sare Egokitzailea</translation>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>USB Controller</source>
-        <translation>USB Kontrolatzailea</translation>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Sound Card</source>
-        <translation>Soinu Txartela</translation>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Virtual Disk Image</source>
-        <translation>Diska Birtual Irudia</translation>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Unknown Hardware Item</source>
-        <translation>Hardware Gai Ezezaguna</translation>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+34"/>
-        <source><b>Original Value:</b> %1</source>
-        <translation><b>Jatorrizko Balioa:</b> %1</translation>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+627"/>
-        <source>Configuration</source>
-        <translation>Itxurapena</translation>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.ui" line="+76"/>
-        <source>Warnings:</source>
-        <translation>Ohartarazpenak:</translation>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Teklatua</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="-668"/>
-        <source>Hard Disk Controller (SAS)</source>
-        <translation>Diska Gogor Kontrolatzailea (SAS)</translation>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.ui" line="-28"/>
-        <source>When checked a new unique MAC address will assigned to all configured network cards.</source>
-        <translation>Hautatutakoan MAC helbide bakarra esleituko zaie itxuratutako sare txartel guztieri.</translation>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Reinitialize the MAC address of all network cards</source>
-        <translation>&Berrabiarazi sare txartel guztien MAC helbidea</translation>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIApplianceImportEditorWidget</name>
     <message>
-        <location filename="../src/widgets/UIApplianceImportEditorWidget.cpp" line="+149"/>
-        <source>Importing Appliance ...</source>
-        <translation>Makina Birtuala Inportatzen...</translation>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-80"/>
-        <source>Reading Appliance ...</source>
-        <translation>Makina Birtuala Irakurtzen...</translation>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIDescriptionPagePrivate</name>
     <message>
-        <source>No description. Press the Edit button below to add it.</source>
-        <translation type="obsolete">Azalpen gabe. Sakatu Editatu botoia behean gehitzeko.</translation>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Edit</source>
-        <translation type="obsolete">Editatu</translation>
+        <source>Network</source>
+        <translation type="unfinished">Sarea</translation>
     </message>
     <message>
-        <source>Edit (Ctrl+E)</source>
-        <translation type="obsolete">Editatu (Ctrl+E)</translation>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIDetailsBlock</name>
     <message>
-        <source>Name</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Izena</translation>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>OS Type</source>
-        <comment>details report</comment>
-        <translation type="obsolete">SE Mota</translation>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Information inaccessible</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Argibideak eskuraezin</translation>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">E&rregistroa Ikusi...</translation>
     </message>
     <message>
-        <source>Base Memory</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Ohinarri Oroimena</translation>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr>%1 MB</nobr></source>
-        <comment>details report</comment>
-        <translation type="obsolete"><nobr>%1 MB</nobr></translation>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Processors</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Prozesagailuak</translation>
+        <source>&File</source>
+        <translation type="unfinished">&Fitxategia</translation>
     </message>
     <message>
-        <source><nobr>%1</nobr></source>
-        <comment>details report</comment>
-        <translation type="obsolete"><nobr>%1</nobr></translation>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr>%1%</nobr></source>
-        <comment>details report</comment>
-        <translation type="obsolete"><nobr>%1%</nobr></translation>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Boot Order</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Abiarazpen Hurrenkera</translation>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>ACPI</source>
-        <comment>details report</comment>
-        <translation type="obsolete">ACPI</translation>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>IO APIC</source>
-        <comment>details report</comment>
-        <translation type="obsolete">IO APIC</translation>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>BIOS</source>
-        <comment>details report</comment>
-        <translation type="obsolete">BIOS</translation>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>VT-x/AMD-V</source>
-        <comment>details report</comment>
-        <translation type="obsolete">VT-x/AMD-V</translation>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PAE/NX</source>
-        <comment>details report</comment>
-        <translation type="obsolete">PAE/NX</translation>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Acceleration</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Bizkorpena</translation>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Video Memory</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Bideo Oroimena</translation>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Ikusleihoak</translation>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>2D Video</source>
-        <comment>details report</comment>
-        <translation type="obsolete">2D Bideoa</translation>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>3D</source>
-        <comment>details report</comment>
-        <translation type="obsolete">3D</translation>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Desktop Server Port</source>
-        <comment>details report (VRDE Server)</comment>
-        <translation type="obsolete">Hurruneko Mahaigain Zerbitzari Ataka</translation>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Desktop Server</source>
-        <comment>details report (VRDE Server)</comment>
-        <translation type="obsolete">Hurruneko Mahaigain Zerbitzaria</translation>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (VRDE Server)</comment>
-        <translation type="obsolete">Ezgaituta</translation>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>(CD/DVD)</source>
-        <translation type="obsolete">(CD/DVD)</translation>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Not Attached</source>
-        <comment>details report (Storage)</comment>
-        <translation type="obsolete">Erantsi gabe</translation>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Host Driver</source>
-        <comment>details report (audio)</comment>
-        <translation type="obsolete">Hostalari Gidagailua</translation>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Controller</source>
-        <comment>details report (audio)</comment>
-        <translation type="obsolete">Kontrolatzailea</translation>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (audio)</comment>
-        <translation type="obsolete">Ezgaituta</translation>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
     <message>
-        <source>Bridged adapter, %1</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Zubi egokitzailea, %1</translation>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Gaitu</translation>
     </message>
     <message>
-        <source>Internal network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Barneko sarea, '%1'</translation>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Generic driver, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Gidagailu generikoa, '%1'</translation>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
     </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
     <message>
-        <source>Generic driver, '%1' {&nbsp;%2&nbsp;}</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Gidagailu generikoa, '%1' {&nbsp;%2&nbsp;}</translation>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Adapter %1</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Egokitzailea %1</translation>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
+</context>
+<context>
+    <name>UIApplianceEditorWidget</name>
     <message>
-        <source>Disabled</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Ezgaituta</translation>
+        <source>Virtual System %1</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Port %1</source>
-        <comment>details report (serial ports)</comment>
-        <translation type="obsolete">Ataka %1</translation>
+        <source>Name</source>
+        <translation type="unfinished">Izena</translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (serial ports)</comment>
-        <translation type="obsolete">Ezgaituta</translation>
+        <source>Product</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Port %1</source>
-        <comment>details report (parallel ports)</comment>
-        <translation type="obsolete">Ataka %1</translation>
+        <source>Product-URL</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (parallel ports)</comment>
-        <translation type="obsolete">Ezgaituta</translation>
+        <source>Vendor</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Device Filters</source>
-        <comment>details report (USB)</comment>
-        <translation type="obsolete">Gailu Iragazkiak</translation>
+        <source>Vendor-URL</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>%1 (%2 active)</source>
-        <comment>details report (USB)</comment>
-        <translation type="obsolete">%1 (%2 gaituta)</translation>
+        <source>Version</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (USB)</comment>
-        <translation type="obsolete">Ezgaituta</translation>
+        <source>Description</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Shared Folders</source>
-        <comment>details report (shared folders)</comment>
-        <translation type="obsolete">Elkarbanatutako Agiritegiak</translation>
+        <source>License</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>None</source>
-        <comment>details report (shared folders)</comment>
-        <translation type="obsolete">Ezer ez</translation>
+        <source>Guest OS Type</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>None</source>
-        <comment>details report (description)</comment>
-        <translation type="obsolete">Ezer ez</translation>
+        <source>CPU</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIDetailsPagePrivate</name>
     <message>
-        <location filename="../src/selector/UIVMDesktop.cpp" line="+134"/>
-        <source>The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:</source>
-        <translation>Hautaturiko makina birtuala <i>eskuraezina</i> da. Mesedez aztertu behean erakusten den akats mezua eta sakatu <b>Berritu</b> botoia sarbidetasun egiaztapena berregitea nahi baduzu:</translation>
+        <source>RAM</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>General</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Orokorra</translation>
+        <source>Hard Disk Controller (IDE)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>System</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Sistema</translation>
+        <source>Hard Disk Controller (SATA)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Preview</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Aurreikuspena</translation>
+        <source>Hard Disk Controller (SCSI)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Display</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Erakutsi</translation>
+        <source>DVD</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Storage</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Biltegia</translation>
+        <source>Floppy</source>
+        <translation type="unfinished">Disketea</translation>
     </message>
     <message>
-        <source>Audio</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Audioa</translation>
+        <source>Network Adapter</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Network</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Sarea</translation>
+        <source>USB Controller</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Serial Ports</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Serieko Atakak</translation>
+        <source>Sound Card</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Parallel Ports</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Ataka Kidetuak</translation>
+        <source>Virtual Disk Image</source>
+        <translation type="unfinished">Disko Birtual Irudia</translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>details report</comment>
-        <translation type="obsolete">USB</translation>
+        <source>Unknown Hardware Item</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Shared Folders</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Elkarbanatutako Agiritegiak</translation>
+        <source>MB</source>
+        <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <source>Description</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Azalpena</translation>
+        <source><b>Original Value:</b> %1</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIDnDHandler</name>
     <message>
-        <location filename="../src/runtime/UIDnDHandler.cpp" line="+98"/>
-        <source>Dropping data ...</source>
-        <translation>Datuak erortzen...</translation>
+        <source>Configuration</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIDnDMimeData</name>
     <message>
-        <location line="+90"/>
-        <source>Dropping data ...</source>
-        <translation>Datuak erortzen...</translation>
+        <source>Warnings:</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIDownloader</name>
     <message>
-        <location filename="../src/net/UIDownloader.cpp" line="+45"/>
-        <source>Looking for %1...</source>
-        <translation>Bilatzen %1...</translation>
+        <source>MB</source>
+        <comment>size suffix MBytes=1024 KBytes</comment>
+        <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Downloading %1...</source>
-        <translation>Jeisten %1...</translation>
+        <source>MB</source>
+        <comment>size suffix MBytes=1024KBytes</comment>
+        <translation type="obsolete">MB</translation>
     </message>
-</context>
-<context>
-    <name>UIDownloaderAdditions</name>
     <message>
-        <location filename="../src/net/UIDownloaderAdditions.cpp" line="+107"/>
-        <source>Select folder to save Guest Additions image to</source>
-        <translation>Hautatu Gonbidatu Gehigarri irudia gordetzeko agiritegia</translation>
+        <source>Hard Disk Controller (SAS)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-51"/>
-        <source>VirtualBox Guest Additions</source>
-        <translation>VirtualBox Gonbidatu Gehigarriak</translation>
+        <source>When checked a new unique MAC address will assigned to all configured network cards.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Reinitialize the MAC address of all network cards</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDownloaderExtensionPack</name>
+    <name>UIApplianceImportEditorWidget</name>
     <message>
-        <location filename="../src/net/UIDownloaderExtensionPack.cpp" line="+124"/>
-        <source>Select folder to save %1 to</source>
-        <translation>Hautatu %1 gordetzeko agiritegia</translation>
+        <source>Importing Appliance ...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-67"/>
-        <source>VirtualBox Extension Pack</source>
-        <translation>VirtualBox Hedapen Paketea</translation>
+        <source>Reading Appliance ...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDownloaderUserManual</name>
+    <name>UIDescriptionPagePrivate</name>
     <message>
-        <location filename="../src/net/UIDownloaderUserManual.cpp" line="+111"/>
-        <source>Select folder to save User Manual to</source>
-        <translation>Hautatu Erabiltzaile Eskuliburua gordetzeko agiritegia</translation>
+        <source>No description. Press the Edit button below to add it.</source>
+        <translation type="obsolete">Azalpenik ez. Editatu botoia sakatu berau gehitzeko.</translation>
     </message>
     <message>
-        <location line="-55"/>
-        <source>VirtualBox User Manual</source>
-        <translation>VirtualBox Erabiltzaile Eskuliburua</translation>
+        <source>Edit</source>
+        <translation type="obsolete">Editatu</translation>
+    </message>
+    <message>
+        <source>Edit (Ctrl+E)</source>
+        <translation type="obsolete">Editatu (Ktrl+E)</translation>
     </message>
 </context>
 <context>
-    <name>UIGChooserItemGroup</name>
+    <name>UIDetailsBlock</name>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="+653"/>
-        <source><b>%1</b></source>
-        <comment>Group item tool-tip / Group name</comment>
-        <translation><b>%1</b></translation>
+        <source>Name</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Izena</translation>
     </message>
-    <message numerus="yes">
-        <location line="+10"/>
-        <source>%n group(s)</source>
-        <comment>Group item tool-tip / Group info</comment>
-        <translation>
-            <numerusform>%n talde</numerusform>
-            <numerusform>%n talde</numerusform>
-        </translation>
+    <message>
+        <source>OS Type</source>
+        <comment>details report</comment>
+        <translation type="obsolete">SE mota</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><nobr>%1</nobr></source>
-        <comment>Group item tool-tip / Group info wrapper</comment>
-        <translation><nobr>%1</nobr></translation>
+        <source>Base Memory</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Oinarri Memoria</translation>
     </message>
-    <message numerus="yes">
-        <location line="+13"/>
-        <source>%n machine(s)</source>
-        <comment>Group item tool-tip / Machine info</comment>
-        <translation>
-            <numerusform>%n makina</numerusform>
-            <numerusform>%n makina</numerusform>
-        </translation>
+    <message>
+        <source><nobr>%1 MB</nobr></source>
+        <comment>details report</comment>
+        <translation type="obsolete"><nobr>%4 MB</nobr> {1 ?}</translation>
     </message>
-    <message numerus="yes">
-        <location line="+1"/>
-        <source>(%n running)</source>
-        <comment>Group item tool-tip / Running machine info</comment>
-        <translation>
-            <numerusform>(%n ekinean)</numerusform>
-            <numerusform>(%n ekinean)</numerusform>
-        </translation>
+    <message>
+        <source>Boot Order</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Abio Ordena</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><nobr>%1</nobr></source>
-        <comment>Group item tool-tip / Machine info wrapper</comment>
-        <translation><nobr>%1</nobr></translation>
+        <source>ACPI</source>
+        <comment>details report</comment>
+        <translation type="obsolete">ACPI</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source><nobr>%1 %2</nobr></source>
-        <comment>Group item tool-tip / Machine info wrapper, including running</comment>
-        <translation><nobr>%1 %2</nobr></translation>
+        <source>I/O APIC</source>
+        <comment>details report</comment>
+        <translation type="obsolete">I/O APIC</translation>
     </message>
     <message>
-        <location line="+15"/>
-        <source>Collapse group</source>
-        <translation>Bildu taldea</translation>
+        <source>Video Memory</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Bideo Memoria</translation>
     </message>
     <message>
-        <location line="+0"/>
-        <source>Expand group</source>
-        <translation>Hedatu taldea</translation>
+        <source>3D</source>
+        <comment>details report</comment>
+        <translation type="obsolete">3D</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Enter group</source>
-        <translation>Sartu taldera</translation>
+        <source>Disabled</source>
+        <comment>details report (VRDE Server)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Exit group</source>
-        <translation>Irten taldetik</translation>
+        <source>Not Attached</source>
+        <comment>details report (Storage)</comment>
+        <translation type="obsolete">Ez erantsia</translation>
     </message>
-</context>
-<context>
-    <name>UIGChooserModel</name>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserModel.cpp" line="+506"/>
-        <source>New group</source>
-        <translation>Talde berria</translation>
+        <source>Disabled</source>
+        <comment>details report (audio)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Adapter %1</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">%1 Moldagailua</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (serial ports)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (parallel ports)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Device Filters</source>
+        <comment>details report (USB)</comment>
+        <translation type="obsolete">Gailu Iragazkiak</translation>
+    </message>
+    <message>
+        <source>%1 (%2 active)</source>
+        <comment>details report (USB)</comment>
+        <translation type="obsolete">%1 (%2 aktibo)</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (USB)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Shared Folders</source>
+        <comment>details report (shared folders)</comment>
+        <translation type="obsolete">Partekatutako Karpetak</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>details report (shared folders)</comment>
+        <translation type="obsolete">Batez</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>details report (description)</comment>
+        <translation type="obsolete">Batez</translation>
     </message>
 </context>
 <context>
-    <name>UIGDetails</name>
+    <name>UIDetailsPagePrivate</name>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="+117"/>
         <source>Name</source>
-        <comment>details (general)</comment>
-        <translation>Izena</translation>
+        <comment>details report</comment>
+        <translation type="obsolete">Izena</translation>
     </message>
     <message>
-        <location line="+22"/>
-        <source>Groups</source>
-        <comment>details (general)</comment>
-        <translation>Taldeak</translation>
+        <source>OS Type</source>
+        <comment>details report</comment>
+        <translation type="obsolete">SE mota</translation>
     </message>
     <message>
-        <location line="+152"/>
-        <location line="+97"/>
-        <source>%1 MB</source>
-        <comment>details</comment>
-        <translation>%1 MB</translation>
+        <source>Base Memory</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Oinarri Memoria</translation>
     </message>
     <message>
-        <location line="-92"/>
-        <source>Processors</source>
-        <comment>details (system)</comment>
-        <translation>Prozesagailuak</translation>
+        <source><nobr>%1 MB</nobr></source>
+        <comment>details report</comment>
+        <translation type="obsolete"><nobr>%4 MB</nobr> {1 ?}</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>%1%</source>
-        <comment>details</comment>
-        <translation>%1%</translation>
+        <source>Boot Order</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Abio Ordena</translation>
     </message>
     <message>
-        <location line="+22"/>
-        <source>VT-x/AMD-V</source>
-        <comment>details (system)</comment>
-        <translation>VT-x/AMD-V</translation>
+        <source>ACPI</source>
+        <comment>details report</comment>
+        <translation type="obsolete">ACPI</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>PAE/NX</source>
-        <comment>details (system)</comment>
-        <translation>PAE/NX</translation>
+        <source>I/O APIC</source>
+        <comment>details report</comment>
+        <translation type="obsolete">I/O APIC</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Acceleration</source>
-        <comment>details (system)</comment>
-        <translation>Bizkorpena</translation>
+        <source>Video Memory</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Bideo Memoria</translation>
     </message>
     <message>
-        <location line="+59"/>
-        <source>Screens</source>
-        <comment>details (display)</comment>
-        <translation>Ikusleihoak</translation>
+        <source>3D</source>
+        <comment>details report</comment>
+        <translation type="obsolete">3D</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>3D</source>
-        <comment>details (display)</comment>
-        <translation>3D</translation>
+        <source>Disabled</source>
+        <comment>details report (VRDE Server)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Acceleration</source>
-        <comment>details (display)</comment>
-        <translation>Bizkorpena</translation>
+        <source>Not Attached</source>
+        <comment>details report (Storage)</comment>
+        <translation type="obsolete">Ez erantsia</translation>
     </message>
     <message>
-        <location line="+12"/>
         <source>Disabled</source>
-        <comment>details (display/vrde/VRDE server)</comment>
-        <translation>Ezgaituta</translation>
+        <comment>details report (audio)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Adapter %1</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">%1 Moldagailua</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (serial ports)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (parallel ports)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Device Filters</source>
+        <comment>details report (USB)</comment>
+        <translation type="obsolete">Gailu Iragazkiak</translation>
+    </message>
+    <message>
+        <source>%1 (%2 active)</source>
+        <comment>details report (USB)</comment>
+        <translation type="obsolete">%1 (%2 aktibo)</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (USB)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Shared Folders</source>
+        <comment>details report (shared folders)</comment>
+        <translation type="obsolete">Partekatutako Karpetak</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>details report (shared folders)</comment>
+        <translation type="obsolete">Batez</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>details report (description)</comment>
+        <translation type="obsolete">Batez</translation>
+    </message>
+    <message>
+        <source>The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:</source>
+        <translation type="unfinished">Hautaturiko makina birtuala <i>eskuraezina</i> dago. Mesedez arakatu beheko errore mezua eta <b>Freskatu</b> sakatu eskuragarritasun proba errepikatu nahi baduzu:</translation>
+    </message>
+    <message>
+        <source>General</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Orokorra</translation>
+    </message>
+    <message>
+        <source>Audio</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Audioa</translation>
+    </message>
+    <message>
+        <source>Network</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Sarea</translation>
+    </message>
+    <message>
+        <source>Serial Ports</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Serie Atakak</translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>details report</comment>
+        <translation type="obsolete">USB</translation>
+    </message>
+    <message>
+        <source>Shared Folders</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Partekatutako Karpetak</translation>
+    </message>
+</context>
+<context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIDnDHandler</name>
+    <message>
+        <source>Dropping data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIDownloader</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete">VirtualBox Bezero Gehigarri CD irudia <nobr><b>%1</b>-etik deskargatzen...</nobr></translation>
+    </message>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">Utzi VirtualBox Bezero Gehigarri CD irudi deskarga</translation>
+    </message>
+    <message>
+        <source>Could not locate the file on the server (response: %1).</source>
+        <translation type="obsolete">Ezin da fitxategia aurkitu zerbitzarian (erantzuna: %1).</translation>
+    </message>
+    <message>
+        <source>Could not determine the file size.</source>
+        <translation type="obsolete">Ezin da fitxategi tamaina atzeman.</translation>
+    </message>
+    <message>
+        <source>Could not connect to the server (%1).</source>
+        <translation type="obsolete">Ezin da zerbitzariarekin konektatu (%1).</translation>
+    </message>
+    <message>
+        <source>Could not download the file (%1).</source>
+        <translation type="obsolete">Ezin da fitxategia deskargatu (%1).</translation>
+    </message>
+    <message>
+        <source><p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p></source>
+        <translation type="obsolete"><p>Huts deskargatutako fitxategia <nobr><b>%1</b> bezala gordetzerakoan.</nobr></p></translation>
+    </message>
+    <message>
+        <source>Select folder to save Guest Additions image to</source>
+        <translation type="obsolete">Hautau Bezero Gehigarri CD irudia gordetzeko karpeta</translation>
+    </message>
+    <message>
+        <source>Connection timed out.</source>
+        <translation type="obsolete">Konexioa denboraz kanpo.</translation>
+    </message>
+    <message>
+        <source>The download process has been cancelled by the user.</source>
+        <translation type="obsolete">Deskarga prozesua erabiltzaileak eten du.</translation>
+    </message>
+    <message>
+        <source>Looking for %1...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Downloading %1...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIDownloaderAdditions</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete">VirtualBox Bezero Gehigarri CD irudia <nobr><b>%1</b>-etik deskargatzen...</nobr></translation>
+    </message>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">Utzi VirtualBox Bezero Gehigarri CD irudi deskarga</translation>
+    </message>
+    <message>
+        <source><p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p></source>
+        <translation type="obsolete"><p>Huts deskargatutako fitxategia <nobr><b>%1</b> bezala gordetzerakoan.</nobr></p></translation>
+    </message>
+    <message>
+        <source>Select folder to save Guest Additions image to</source>
+        <translation type="unfinished">Hautau Bezero Gehigarri CD irudia gordetzeko karpeta</translation>
+    </message>
+    <message>
+        <source>VirtualBox Guest Additions</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIDownloaderExtensionPack</name>
+    <message>
+        <source>Select folder to save %1 to</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VirtualBox Extension Pack</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIDownloaderUserManual</name>
+    <message>
+        <source>Select folder to save User Manual to</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VirtualBox User Manual</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
+    <name>UIExportApplianceWzd</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
+    </message>
+</context>
+<context>
+    <name>UIFirstRunWzd</name>
+    <message>
+        <source>First Run Wizard</source>
+        <translation type="obsolete">Lehen Abiarazte Morroia</translation>
+    </message>
+    <message>
+        <source><p>You have started a newly created virtual machine for the first time. This wizard will help you to perform the steps necessary for installing an operating system of your choice onto this virtual machine.</p><p>Use the <b>Next</b> button to go to the next page of the wizard and the <b>Back</b> button to return to the previous page. You can also press <b>Cancel</b> if you want to cancel the execution of this wizard.&lt [...]
+        <translation type="obsolete"><p>Sortu berri duzun makina birtuala lehen aldiz abiarazi duzu. Morroi honek zure aukerako sistema eragile makina birtual horretan instalatzeko egin beharreko urratsetan lagunduko zaitu.</p><p><b>Hurrengoa</b> botoia erabili morroiaren hurrengo orrialdera joateko eta <b>Atzera</b> botoia aurreko orrialdera joateko. Baita <b>Utzi</b> sakatu dezakezu morroiaren exekuzioa eteteko.</p></translation>
+    </message>
+    <message>
+        <source>Welcome to the First Run Wizard!</source>
+        <translation type="obsolete">Ongietorri Lehen Abiarazte Morroira!</translation>
+    </message>
+    <message>
+        <source><p>Select the type of media you would like to use for installation.</p></source>
+        <translation type="obsolete"><p>Hautatu behean instalatzeko erabili nahi duzun instalazio medioa.</p></translation>
+    </message>
+    <message>
+        <source>Media Type</source>
+        <translation type="obsolete">Euskarri Mota</translation>
+    </message>
+    <message>
+        <source>&CD/DVD Device</source>
+        <translation type="obsolete">&CD/DVD Gailua</translation>
+    </message>
+    <message>
+        <source>Alt+C</source>
+        <translation type="obsolete">Alt+C</translation>
+    </message>
+    <message>
+        <source>&Floppy Device</source>
+        <translation type="obsolete">&Diskete Gailua</translation>
+    </message>
+    <message>
+        <source>Alt+F</source>
+        <translation type="obsolete">Alt+D</translation>
+    </message>
+    <message>
+        <source><p>Select the media which contains the setup program of the operating system you want to install. This media must be bootable, otherwise the setup program will not be able to start.</p></source>
+        <translation type="obsolete"><p>Hautatu instalatu nahi duzun sistema eragilearen instalazio programa duen euskarria. Euskarria abiarazgarria izan behar da, beste instalazio programak ezin izango du abiarazi.</p></translation>
+    </message>
+    <message>
+        <source>Media Source</source>
+        <translation type="obsolete">Euskarri Jatorria</translation>
+    </message>
+    <message>
+        <source>&Host Drive</source>
+        <translation type="obsolete">&Ostalari Gailua</translation>
+    </message>
+    <message>
+        <source>Alt+H</source>
+        <translation type="obsolete">Alt+O</translation>
+    </message>
+    <message>
+        <source>&Image File</source>
+        <translation type="obsolete">&Irudi Fitxategia</translation>
+    </message>
+    <message>
+        <source>Alt+I</source>
+        <translation type="obsolete">Alt+I</translation>
+    </message>
+    <message>
+        <source>VDM</source>
+        <translation type="obsolete">VDM</translation>
+    </message>
+    <message>
+        <source>Select Installation Media</source>
+        <translation type="obsolete">Instalazio Euskarri Hautatu</translation>
+    </message>
+    <message>
+        <source><p>You have selected the following media to boot from:</p></source>
+        <translation type="obsolete"><p>Bertatik abiarazteko hurrengo euskarria hautatu duzu:</p></translation>
+    </message>
+    <message>
+        <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.</p><p>Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.</p><p>Depending on the type of the setup program, you may need to manually  [...]
+        <translation type="obsolete"><p>Aurrekoa zuzena bada, sakatu <b>Amaitu</b> botoia. Egiten duzunean hautatutako euskarria aldi batetarako makina birtualean muntatu eta makinak exekuzioa abiaraziko du.</p><p>Mesedez kontutan izan zuk makina birtuala ixtean, ezarritako euskarri automatikoki desmuntatuko dela eta abio gailu bezala lehenengo disko gogorra ipiniko dela.</p><p>Konfigurazio programa motaren arabera agian diskoa desmuntatu (atera) [...]
+    </message>
+    <message>
+        <source>Summary</source>
+        <translation type="obsolete">Laburpena</translation>
+    </message>
+    <message>
+        <source>CD/DVD Device</source>
+        <translation type="obsolete">CD/DVD Gailua</translation>
+    </message>
+    <message>
+        <source>Floppy Device</source>
+        <translation type="obsolete">Diskete Gailua</translation>
+    </message>
+    <message>
+        <source>Host Drive %1</source>
+        <translation type="obsolete">Ostalari Kontrolagailua %1</translation>
+    </message>
+    <message>
+        <source><table><tr><td>Type:</td><td>%1</td></tr><tr><td>Source:</td><td>%2</td></tr></table></source>
+        <translation type="obsolete"><table><tr><td>Mota:</td><td>%1</td></tr><tr><td>Jatorria:</td><td>%2</td></tr></table></translation>
+    </message>
+    <message>
+        <source><p>You have started a newly created virtual machine for the first time. This wizard will help you to perform the steps necessary for booting an operating system of your choice on the virtual machine.</p><p>Note that you will not be able to install an operating system into this virtual machine right now because you did not attach any hard disk to it. If this is not what you want, you can cancel the execution of this wizard, select <b>Settings</b& [...]
+        <translation type="obsolete"><p>Sortu  berri duzun makina birtuala lehen aldiz abiarazi duzu. Morroi honek hautatu duzun sistema eragile makina birtualean abiarazteko bete beharreko urratsak betetzen lagunduko zaitu.</p><p>Kontutan izan ezin duzula sistema eragile bat orain instalatu makina birtual honetan ez bait duzu disko gogorrik erantsi makina birtualari. Hau ez bada nahi duzuna, morroi honen exekuzioa utzi dezakezu, <b>Ezarpenak</b> hautatu Vir [...]
+    </message>
+    <message>
+        <source><p>Select the type of media you would like to use for booting an operating system.</p></source>
+        <translation type="obsolete"><p>Hautatu sistema eragile bat abiarazteko erabili nahi duzun medio mota.</p></translation>
+    </message>
+    <message>
+        <source><p>Select the media that contains the operating system you want to work with. This media must be bootable, otherwise the operating system will not be able to start.</p></source>
+        <translation type="obsolete"><p>Hautatu berarekin lan egin nahi duzun sistema eragile duen euskarria. Euskarri hau abiarazgarria izan behar da, bestela sistema eragilea ez da abiarazteko gai izango</p></translation>
+    </message>
+    <message>
+        <source><p>You have selected the following media to boot an operating system from:</p></source>
+        <translation type="obsolete"><p>Bertatik abiarazteko sistema eragilea duen hurrengo medioa hautatu duzu:</p></translation>
+    </message>
+    <message>
+        <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be mounted on the virtual machine and the machine will start execution.</p></source>
+        <translation type="obsolete"><p>Aurrekoa zuzena bada <b>Amaitu</b> botoia sakatu. Behin sakatu duzunean, hautatutako medioa makina birtualean kargatuko da eta makinak exekuzioa abiaraziko du.</p></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
+    </message>
+    <message>
+        <source>Start</source>
+        <translation type="obsolete">Abiarazi</translation>
+    </message>
+</context>
+<context>
+    <name>UIFirstRunWzdPage1</name>
+    <message>
+        <source>Welcome to the First Run Wizard!</source>
+        <translation type="obsolete">Ongietorri Lehen Abiarazte Morroira!</translation>
+    </message>
+</context>
+<context>
+    <name>UIFirstRunWzdPage2</name>
+    <message>
+        <source><p>Select the media which contains the setup program of the operating system you want to install. This media must be bootable, otherwise the setup program will not be able to start.</p></source>
+        <translation type="obsolete"><p>Hautatu instalatu nahi duzun sistema eragilearen instalazio programa duen euskarria. Euskarria abiarazgarria izan behar da, beste instalazio programak ezin izango du abiarazi.</p></translation>
+    </message>
+    <message>
+        <source><p>Select the media that contains the operating system you want to work with. This media must be bootable, otherwise the operating system will not be able to start.</p></source>
+        <translation type="obsolete"><p>Hautatu berarekin lan egin nahi duzun sistema eragile duen euskarria. Euskarri hau abiarazgarria izan behar da, bestela sistema eragilea ez da abiarazteko gai izango</p></translation>
+    </message>
+    <message>
+        <source>Media Source</source>
+        <translation type="obsolete">Euskarri Jatorria</translation>
+    </message>
+    <message>
+        <source>Select Installation Media</source>
+        <translation type="obsolete">Instalazio Euskarri Hautatu</translation>
+    </message>
+</context>
+<context>
+    <name>UIFirstRunWzdPage3</name>
+    <message>
+        <source><p>You have selected the following media to boot from:</p></source>
+        <translation type="obsolete"><p>Bertatik abiarazteko hurrengo euskarria hautatu duzu:</p></translation>
+    </message>
+    <message>
+        <source><p>You have selected the following media to boot an operating system from:</p></source>
+        <translation type="obsolete"><p>Bertatik abiarazteko sistema eragilea duen hurrengo medioa hautatu duzu:</p></translation>
+    </message>
+    <message>
+        <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.</p><p>Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.</p><p>Depending on the type of the setup program, you may need to manually  [...]
+        <translation type="obsolete"><p>Aurrekoa zuzena bada, sakatu <b>Amaitu</b> botoia. Egiten duzunean hautatutako euskarria aldi batetarako makina birtualean muntatu eta makinak exekuzioa abiaraziko du.</p><p>Mesedez kontutan izan zuk makina birtuala ixtean, ezarritako euskarri automatikoki desmuntatuko dela eta abio gailu bezala lehenengo disko gogorra ipiniko dela.</p><p>Konfigurazio programa motaren arabera agian diskoa desmuntatu (atera) [...]
+    </message>
+    <message>
+        <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be mounted on the virtual machine and the machine will start execution.</p></source>
+        <translation type="obsolete"><p>Aurrekoa zuzena bada <b>Amaitu</b> botoia sakatu. Behin sakatu duzunean, hautatutako medioa makina birtualean kargatuko da eta makinak exekuzioa abiaraziko du.</p></translation>
+    </message>
+    <message>
+        <source>Summary</source>
+        <translation type="obsolete">Laburpena</translation>
+    </message>
+    <message>
+        <source>CD/DVD Device</source>
+        <translation type="obsolete">CD/DVD Gailua</translation>
+    </message>
+</context>
+<context>
+    <name>UIGChooserItemGroup</name>
+    <message>
+        <source><b>%1</b></source>
+        <comment>Group item tool-tip / Group name</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>%n group(s)</source>
+        <comment>Group item tool-tip / Group info</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+    <message>
+        <source><nobr>%1</nobr></source>
+        <comment>Group item tool-tip / Group info wrapper</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>%n machine(s)</source>
+        <comment>Group item tool-tip / Machine info</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>(%n running)</source>
+        <comment>Group item tool-tip / Running machine info</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+    <message>
+        <source><nobr>%1</nobr></source>
+        <comment>Group item tool-tip / Machine info wrapper</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>%1 %2</nobr></source>
+        <comment>Group item tool-tip / Machine info wrapper, including running</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Collapse group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Expand group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enter group</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Exit group</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGChooserModel</name>
+    <message>
+        <source>New group</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetails</name>
+    <message>
+        <source>Name</source>
+        <comment>details (general)</comment>
+        <translation type="unfinished">Izena</translation>
+    </message>
+    <message>
+        <source>Groups</source>
+        <comment>details (general)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1 MB</source>
+        <comment>details</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Processors</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>details</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+    <message>
+        <source>VT-x/AMD-V</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PAE/NX</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>3D</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">3D</translation>
+    </message>
+    <message>
+        <source>Acceleration</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (display/vrde/VRDE server)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <comment>details (storage)</comment>
+        <translation type="obsolete">Ez erantsia</translation>
+    </message>
+    <message>
+        <source>Controller</source>
+        <comment>details (audio)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (audio)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Adapter %1</source>
+        <comment>details (network)</comment>
+        <translation type="unfinished">%1 Moldagailua</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (network/adapter)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Port %1</source>
+        <comment>details (serial)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (serial)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Port %1</source>
+        <comment>details (parallel)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (parallel)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>%1 (%2 active)</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">%1 (%2 aktibo)</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>details (shared folders)</comment>
+        <translation type="unfinished">Batez</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>details (description)</comment>
+        <translation type="unfinished">Batez</translation>
+    </message>
+    <message>
+        <source>Operating System</source>
+        <comment>details (general)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Information Inaccessible</source>
+        <comment>details</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Base Memory</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished">Oinarri Memoria</translation>
+    </message>
+    <message>
+        <source>Execution Cap</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Boot Order</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished">Abio Ordena</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Video Memory</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">Bideo Memoria</translation>
+    </message>
+    <message>
+        <source>2D Video</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Desktop Server Port</source>
+        <comment>details (display/vrde)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Desktop Server</source>
+        <comment>details (display/vrde)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Attached</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished">Ez erantsia</translation>
+    </message>
+    <message>
+        <source>Host Driver</source>
+        <comment>details (audio)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bridged Adapter, %1</source>
+        <comment>details (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Internal Network, '%1'</source>
+        <comment>details (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host-only Adapter, '%1'</source>
+        <comment>details (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Generic Driver, '%1'</source>
+        <comment>details (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Generic Driver, '%1' {&nbsp;%2&nbsp;}</source>
+        <comment>details (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Device Filters</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Gailu Iragazkiak</translation>
+    </message>
+    <message>
+        <source>USB Controller Inaccessible</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Shared Folders</source>
+        <comment>details (shared folders)</comment>
+        <translation type="unfinished">Partekatutako Karpetak</translation>
+    </message>
+    <message>
+        <source>Video Capture File</source>
+        <comment>details (display/video capture)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Video Capture Attributes</source>
+        <comment>details (display/video capture)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Video Capture</source>
+        <comment>details (display/video capture)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (display/video capture)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>NAT Network, '%1'</source>
+        <comment>details (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Gaiturik</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">Gaiturik</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Gaiturik</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Gaiturik</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Batez</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Bideo Memoria</translation>
+    </message>
+    <message>
+        <source>3D</source>
+        <comment>details report</comment>
+        <translation type="obsolete">3D</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (VRDE Server)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadGeneral</name>
+    <message>
+        <source>Name</source>
+        <comment>details</comment>
+        <translation type="obsolete">Izena</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadNetwork</name>
+    <message>
+        <source>Adapter %1</source>
+        <comment>details</comment>
+        <translation type="obsolete">%1 Moldagailua</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadParallel</name>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadSF</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Batez</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadSerial</name>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadStorage</name>
+    <message>
+        <source>Not attached</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ez erantsia</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadSystem</name>
+    <message>
+        <source>Base Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Oinarri Memoria</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>details</comment>
+        <translation type="obsolete">%1%</translation>
+    </message>
+    <message>
+        <source>Boot Order</source>
+        <comment>details</comment>
+        <translation type="obsolete">Abio Ordena</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadUSB</name>
+    <message>
+        <source>%1 (%2 active)</source>
+        <comment>details</comment>
+        <translation type="obsolete">%1 (%2 aktibo)</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
+    </message>
+</context>
+<context>
+    <name>UIGMachinePreview</name>
+    <message>
+        <source>Every 0.5 s</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Every 1 s</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Every 2 s</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Every 5 s</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Every 10 s</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Update disabled</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No preview</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsDisplay</name>
+    <message>
+        <source>Maximum Guest Screen &Size:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Width:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Specifies the maximum width which we would like the guest to use.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Height:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Specifies the maximum height which we would like the guest to use.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Automatic</source>
+        <comment>Maximum Guest Screen Size</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Suggest a reasonable maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>Maximum Guest Screen Size</comment>
+        <translation type="unfinished">Batez</translation>
+    </message>
+    <message>
+        <source>Do not attempt to limit the size of the guest screen.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hint</source>
+        <comment>Maximum Guest Screen Size</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Suggest a maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Machine Windows:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Raise Window Under Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsExtension</name>
+    <message>
+        <source>Lists all installed packages.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished">Izena</translation>
+    </message>
+    <message>
+        <source>Version</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add package</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remove package</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Select an extension package file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Extension package files (%1)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Extensions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Extension Packages</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsGeneral</name>
+    <message>
+        <source>Holds the path to the default VDI folder. This folder is used, if not explicitly specified otherwise, when adding existing or creating new virtual hard disks.</source>
+        <translation type="obsolete">Lehenetsiriko VDI karpetaren bidea bistaratzen du. Karpeta hau erabiliko, beste ezer zehazten ez den bitartean, disko gogor birtual sortu edo gehitzerakoan.</translation>
+    </message>
+    <message>
+        <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
+        <translation type="unfinished">Lehenetsiriko makina birtual karpetaren bidea bistaratzen du. Karpeta hau erabiliko, beste ezer zehazten ez den bitartean, makina birtualak sortzerakoan.</translation>
+    </message>
+    <message>
+        <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
+        <translation type="unfinished">Urruneko Pantaila (VRDP) bezeroentzat autentifikazioaz hornitzen duen liburutegiaren bidea erakusten du.</translation>
+    </message>
+    <message>
+        <source>Default &Machine Folder:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>V&RDP Authentication Library:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Host Screensaver:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disable When Running Virtual Machines</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsInput</name>
+    <message>
+        <source>Holds the key used as a Host Key in the VM window. Activate the entry field and press a new Host Key. Note that alphanumeric, cursor movement and editing keys cannot be used.</source>
+        <translation type="obsolete">MB leihoan Ostalari Tekla bezala erabilitakoa tekla erakusten du. Eremua gaitu eta Ostalari Tekla berria sakatu. Kontutan izan alfazenbakizkoak, kurtsore mugimenduak eta edizio teklak ezin direla Ostalari tekla bezala erabili.</translation>
+    </message>
+    <message>
+        <source>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</source>
+        <translation type="unfinished">Markaturik dagoenean, teklatua automatikoki kapturatuko da MB leiho aktibatzen den bakoitzean. Teklatua kapturatzen denean, tekla sakatze guztiak (Alt-TAb bezalako sistemakoak barne) makina birtualera bidaliko da.</translation>
+    </message>
+    <message>
+        <source>&Auto Capture Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host Key Combination</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some items have the same shortcuts assigned.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&VirtualBox Manager</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual &Machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lists all the available shortcuts which can be configured.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enter a sequence to filter the shortcut list.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsLanguage</name>
+    <message>
+        <source> (built-in)</source>
+        <comment>Language</comment>
+        <translation type="unfinished"> (barneratua)</translation>
+    </message>
+    <message>
+        <source><unavailable></source>
+        <comment>Language</comment>
+        <translation type="unfinished"><erabilezina></translation>
+    </message>
+    <message>
+        <source><unknown></source>
+        <comment>Author(s)</comment>
+        <translation type="unfinished"><ezezaguna></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>Language</comment>
+        <translation type="unfinished">Lehenetsia</translation>
+    </message>
+    <message>
+        <source>Language:</source>
+        <translation type="unfinished">Hizkuntza:</translation>
+    </message>
+    <message>
+        <source>Lists all available user interface languages. The effective language is written in <b>bold</b>. Select <i>Default</i> to reset to the system default language.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished">Izena</translation>
+    </message>
+    <message>
+        <source>Id</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Language</source>
+        <translation type="unfinished"> Hizkuntza </translation>
+    </message>
+    <message>
+        <source>Author</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Author(s):</source>
+        <translation type="unfinished">Egilea(k):</translation>
+    </message>
+    <message>
+        <source>&Interface Languages</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsNetwork</name>
+    <message>
+        <source>Adapter</source>
+        <translation type="unfinished">Moldagailua</translation>
+    </message>
+    <message>
+        <source>Automatically configured</source>
+        <comment>interface</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Manually configured</source>
+        <comment>interface</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>IPv4 Address</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not set</source>
+        <comment>address</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>IPv4 Network Mask</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not set</source>
+        <comment>mask</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>IPv6 Address</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>IPv6 Network Mask Length</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not set</source>
+        <comment>length</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>DHCP Server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>server</comment>
+        <translation type="unfinished">Gaiturik</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>server</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
+    </message>
+    <message>
+        <source>Address</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network Mask</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lower Bound</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not set</source>
+        <comment>bound</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Upper Bound</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Add host-only network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Remove host-only network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Edit host-only network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lists all available host-only networks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished">Izena</translation>
+    </message>
+    <message>
+        <source>Networking</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&NAT Networks</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lists all available NAT networks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Host-only Networks</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No CIDR specified for the NAT network <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[empty]</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1 (renamed from %2)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Old Network Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New Network Name</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network CIDR</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Supports DHCP</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>yes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>no</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Supports IPv6</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default IPv6 route</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The name <b>%1</b> is being used for several NAT networks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>NAT network</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Add NAT network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Remove NAT network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Edit NAT network</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsNetworkDetailsHost</name>
+    <message>
+        <source>Host-only Network Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Adapter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Manual &Configuration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use manual configuration for this host-only network adapter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&IPv4 Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the host IPv4 address for this adapter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>IPv4 Network &Mask:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the host IPv4 network mask for this adapter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>I&Pv6 Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>IPv6 Network Mask &Length:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&DHCP Server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Enable Server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Server Add&ress:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Server &Mask:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Lower Address Bound:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Upper Address Bound:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsNetworkDetailsNAT</name>
+    <message>
+        <source>NAT Network Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Enable Network</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable this NAT network.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network &Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the name for this network.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network &CIDR:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the CIDR for this network.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network Options:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Supports &DHCP</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Determines whether this network supports DHCP.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Supports &IPv6</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Determines whether this network supports IPv6.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Advertise Default IPv6 &Route</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Determines whether this network should be advertised as the default IPv6 route.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens a window to manage port forwarding rules.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Port Forwarding</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsPortForwardingDlg</name>
+    <message>
+        <source>Port Forwarding Rules</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>IPv4</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>IPv6</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsProxy</name>
+    <message>
+        <source>When checked, VirtualBox will use the proxy settings supplied for tasks like downloading Guest Additions from the network or checking for updates.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Enable Proxy</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Ho&st:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Changes the proxy host.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Port:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Changes the proxy port.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No proxy host is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No proxy port is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsUpdate</name>
+    <message>
+        <source>When checked, the application will periodically connect to the VirtualBox website and check whether a new VirtualBox version is available.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Check for Updates</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Once per:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Specifies how often the new version check should be performed. Note that if you want to completely disable this check, just clear the above check box.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Next Check:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Check for:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Choose this if you only wish to be notified about stable updates to VirtualBox.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Stable Release Versions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Choose this if you wish to be notified about all new VirtualBox releases.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&All New Releases</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Choose this to be notified about all new VirtualBox releases and pre-release versions of VirtualBox.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>All New Releases and &Pre-Releases</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIHelpButton</name>
+    <message>
+        <source>&Help</source>
+        <translation type="unfinished">&Laguntza</translation>
+    </message>
+</context>
+<context>
+    <name>UIHostComboEditor</name>
+    <message>
+        <source><key_%1></source>
+        <translation type="unfinished"><%1_tekla></translation>
+    </message>
+    <message>
+        <source>Left </source>
+        <translation type="unfinished">Ezker </translation>
+    </message>
+    <message>
+        <source>Right </source>
+        <translation type="unfinished">Eskuin </translation>
+    </message>
+    <message>
+        <source>Left Shift</source>
+        <translation type="unfinished">Esker Shift</translation>
+    </message>
+    <message>
+        <source>Right Shift</source>
+        <translation type="unfinished">Eskuin Shift</translation>
+    </message>
+    <message>
+        <source>Left Ctrl</source>
+        <translation type="unfinished">Ezker Ktrl</translation>
+    </message>
+    <message>
+        <source>Right Ctrl</source>
+        <translation type="unfinished">Eskuin Ktrl</translation>
+    </message>
+    <message>
+        <source>Left Alt</source>
+        <translation type="unfinished">Ezker Alt</translation>
+    </message>
+    <message>
+        <source>Right Alt</source>
+        <translation type="unfinished">Eskuin Alt</translation>
+    </message>
+    <message>
+        <source>Left WinKey</source>
+        <translation type="unfinished">Ezker WinTekla</translation>
+    </message>
+    <message>
+        <source>Right WinKey</source>
+        <translation type="unfinished">Eskuin WinTekla</translation>
+    </message>
+    <message>
+        <source>Menu key</source>
+        <translation type="unfinished">Menu tekla</translation>
+    </message>
+    <message>
+        <source>Alt Gr</source>
+        <translation type="unfinished">Alt Gr</translation>
+    </message>
+    <message>
+        <source>Caps Lock</source>
+        <translation type="unfinished">Caps Lock</translation>
+    </message>
+    <message>
+        <source>Scroll Lock</source>
+        <translation type="unfinished">Scroll Lock</translation>
+    </message>
+    <message>
+        <source>Host+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <translation type="unfinished">Batez</translation>
+    </message>
+</context>
+<context>
+    <name>UIHotKeyEditor</name>
+    <message>
+        <source>Left </source>
+        <translation type="obsolete">Ezker </translation>
+    </message>
+    <message>
+        <source>Right </source>
+        <translation type="obsolete">Eskuin </translation>
+    </message>
+    <message>
+        <source>Left Shift</source>
+        <translation type="obsolete">Esker Shift</translation>
+    </message>
+    <message>
+        <source>Right Shift</source>
+        <translation type="obsolete">Eskuin Shift</translation>
+    </message>
+    <message>
+        <source>Left Ctrl</source>
+        <translation type="obsolete">Ezker Ktrl</translation>
+    </message>
+    <message>
+        <source>Right Ctrl</source>
+        <translation type="obsolete">Eskuin Ktrl</translation>
+    </message>
+    <message>
+        <source>Left Alt</source>
+        <translation type="obsolete">Ezker Alt</translation>
+    </message>
+    <message>
+        <source>Right Alt</source>
+        <translation type="obsolete">Eskuin Alt</translation>
+    </message>
+    <message>
+        <source>Left WinKey</source>
+        <translation type="obsolete">Ezker WinTekla</translation>
+    </message>
+    <message>
+        <source>Right WinKey</source>
+        <translation type="obsolete">Eskuin WinTekla</translation>
+    </message>
+    <message>
+        <source>Menu key</source>
+        <translation type="obsolete">Menu tekla</translation>
+    </message>
+    <message>
+        <source>Alt Gr</source>
+        <translation type="obsolete">Alt Gr</translation>
+    </message>
+    <message>
+        <source>Caps Lock</source>
+        <translation type="obsolete">Caps Lock</translation>
+    </message>
+    <message>
+        <source>Scroll Lock</source>
+        <translation type="obsolete">Scroll Lock</translation>
+    </message>
+    <message>
+        <source><key_%1></source>
+        <translation type="obsolete"><%1_tekla></translation>
+    </message>
+    <message>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
+    </message>
+    <message>
+        <source>F2</source>
+        <translation type="obsolete">F2</translation>
+    </message>
+    <message>
+        <source>F3</source>
+        <translation type="obsolete">F3</translation>
+    </message>
+    <message>
+        <source>F4</source>
+        <translation type="obsolete">F4</translation>
+    </message>
+    <message>
+        <source>F5</source>
+        <translation type="obsolete">F5</translation>
+    </message>
+    <message>
+        <source>F6</source>
+        <translation type="obsolete">F6</translation>
+    </message>
+    <message>
+        <source>F7</source>
+        <translation type="obsolete">F7</translation>
+    </message>
+    <message>
+        <source>F8</source>
+        <translation type="obsolete">F8</translation>
+    </message>
+    <message>
+        <source>F9</source>
+        <translation type="obsolete">F9</translation>
+    </message>
+    <message>
+        <source>F10</source>
+        <translation type="obsolete">F10</translation>
+    </message>
+    <message>
+        <source>F11</source>
+        <translation type="obsolete">F11</translation>
+    </message>
+    <message>
+        <source>F12</source>
+        <translation type="obsolete">F12</translation>
+    </message>
+    <message>
+        <source>F13</source>
+        <translation type="obsolete">F13</translation>
+    </message>
+    <message>
+        <source>F14</source>
+        <translation type="obsolete">F14</translation>
+    </message>
+    <message>
+        <source>F15</source>
+        <translation type="obsolete">F15</translation>
+    </message>
+    <message>
+        <source>F16</source>
+        <translation type="obsolete">F16</translation>
+    </message>
+    <message>
+        <source>F17</source>
+        <translation type="obsolete">F17</translation>
+    </message>
+    <message>
+        <source>F18</source>
+        <translation type="obsolete">F18</translation>
+    </message>
+    <message>
+        <source>F19</source>
+        <translation type="obsolete">F19</translation>
+    </message>
+    <message>
+        <source>F20</source>
+        <translation type="obsolete">F20</translation>
+    </message>
+    <message>
+        <source>F21</source>
+        <translation type="obsolete">F21</translation>
+    </message>
+    <message>
+        <source>F22</source>
+        <translation type="obsolete">F22</translation>
+    </message>
+    <message>
+        <source>F23</source>
+        <translation type="obsolete">F23</translation>
+    </message>
+    <message>
+        <source>F24</source>
+        <translation type="obsolete">F24</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <translation type="obsolete">Batez</translation>
+    </message>
+    <message>
+        <source>Reset shortcut to default</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unset shortcut</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIHotKeyTableModel</name>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished">Izena</translation>
+    </message>
+    <message>
+        <source>Shortcut</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIImportApplianceWzd</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
+    </message>
+</context>
+<context>
+    <name>UIImportLicenseViewer</name>
+    <message>
+        <source><b>The virtual system "%1" requires that you agree to the terms and conditions of the software license agreement shown below.</b><br /><br />Click <b>Agree</b> to continue or click <b>Disagree</b> to cancel the import.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Software License Agreement</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Disagree</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Agree</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Print...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Save...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Text (*.txt)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Save license to file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIIndicatorsPool</name>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the virtual hard disks:</nobr>%1</p></source>
+        <comment>HDD tooltip</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
+        <comment>Network adapters tooltip</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source><br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr></source>
+        <comment>Network adapters tooltip</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source>connected</source>
+        <comment>Network adapters tooltip</comment>
+        <translation>konektatuta</translation>
+    </message>
+    <message>
+        <source>disconnected</source>
+        <comment>Network adapters tooltip</comment>
+        <translation>deskonektatuta</translation>
+    </message>
+    <message>
+        <source><br><nobr><b>All network adapters are disabled</b></nobr></source>
+        <comment>Network adapters tooltip</comment>
+        <translation><br><nobr><b>Sare moldagailu guztiak ezgaiturik daude</b></nobr></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the attached USB devices:</nobr>%1</p></source>
+        <comment>USB device tooltip</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source><br><nobr><b>No USB devices attached</b></nobr></source>
+        <comment>USB device tooltip</comment>
+        <translation><br><nobr><b>Ez dago USB gailurik erantsirik</b></nobr></translation>
+    </message>
+    <message>
+        <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
+        <comment>USB device tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>USB Kontrolatzailea ezgaiturik dago</b></nobr></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
+        <comment>Shared folders tooltip</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source><br><nobr><b>No shared folders</b></nobr></source>
+        <comment>Shared folders tooltip</comment>
+        <translation><br><nobr><b>Ez dago partekatutako karpetarik</b></nobr></translation>
+    </message>
+    <message>
+        <source><hr>The VRDP Server is listening on port %1</source>
+        <translation type="obsolete"><hr>VRDP Zerbitzaria %1 atakan entzuten ari da</translation>
+    </message>
+    <message>
+        <source><br><nobr><b>%1:</b>&nbsp;%2</nobr></source>
+        <comment>Virtualization Stuff LED</comment>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Indicates whether the host mouse pointer is captured by the guest OS:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer is captured</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;mouse integration (MI) is On</nobr><br><nobr><img src=:/mouse_can_seamless_ [...]
+        <translation></translation>
+    </message>
+    <message>
+        <source>Indicates whether the keyboard is captured by the guest OS (<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>).</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr><b>Video capture disabled</b></nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr><b>Video capture file:</b> %1</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
+        <comment>Virtualization Stuff LED</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UILineTextEdit</name>
+    <message>
+        <source>&Edit</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineLogic</name>
+    <message>
+        <source>VirtualBox OSE</source>
+        <translation type="obsolete">VirtualBox OSE</translation>
+    </message>
+    <message>
+        <source>Preview Monitor %1</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>Snapshot %1</source>
+        <translation>%1 egoera-argazkia</translation>
+    </message>
+    <message>
+        <source>No USB Devices Connected</source>
+        <translation></translation>
+    </message>
+    <message>
+        <source>No supported devices connected to the host PC</source>
+        <translation>Ez dago onartutako gailurik konektaturik ostalari PC-ra</translation>
+    </message>
+    <message>
+        <source>Select a filename for the screenshot ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No Webcams Connected</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No supported webcams connected to the host PC</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Connect Network Adapter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Connect Network Adapter %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsAudio</name>
+    <message>
+        <source>When checked, a virtual PCI audio card will be plugged into the virtual machine and will communicate with the host audio system using the specified driver.</source>
+        <translation type="unfinished">Markaturik dagoenean, PCI audio txartel birtuala makina birtualean erantsirik dago eta ezarritako kontrolatzailea erabiliko ostalariaren audio txartelarekin harremanetan jartzeko.</translation>
+    </message>
+    <message>
+        <source>Enable &Audio</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host Audio &Driver:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the audio output driver. The <b>Null Audio Driver</b> makes the guest see an audio card, however every access to it will be ignored.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Audio &Controller:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the type of the virtual sound card. Depending on this value, VirtualBox will provide different audio hardware to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsDisplay</name>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="unfinished"><qt>%1&nbsp;MB</qt></translation>
+    </message>
+    <message>
+        <source>Video &Memory:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the amount of video memory provided to the virtual machine.</source>
+        <translation type="unfinished">Makina birtualari ezarritako bideo memoria kontrolatzen du.</translation>
+    </message>
+    <message>
+        <source>MB</source>
+        <translation type="unfinished">MB</translation>
+    </message>
+    <message>
+        <source>Extended Features:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will be given access to the 3D graphics capabilities available on the host.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable &3D Acceleration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Remote Display</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source>
+        <translation type="unfinished">Markaturik dagoenean, makina birtuala Urruneko Idazmahai Protokolo (RDP) zerbitzari birtuala gaituko du, bezeroei makina birtualera (martxan dagoenean) RDP bezero estandar bat erabiliaz konektatzeko aukera emanez.</translation>
+    </message>
+    <message>
+        <source>&Enable Server</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Server &Port:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Authentication &Method:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the VRDP authentication method.</source>
+        <translation type="unfinished">VRDP autentifikazio metodoa ezartzen du.</translation>
+    </message>
+    <message>
+        <source>Authentication &Timeout:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Specifies the timeout for guest authentication, in milliseconds.</source>
+        <translation type="unfinished">Bezero autentifikazioen denbora-muga ezartzen du, milisegundotan.</translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will be given access to the Video Acceleration capabilities available on the host.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable &2D Video Acceleration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The VRDP Server port number. You may specify <tt>0</tt> (zero), to select port 3389, the standard port for RDP.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mo&nitor Count:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the amount of virtual monitors provided to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><qt>%1</qt></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Specifies whether multiple simultaneous connections to the VM are permitted.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Allow Multiple Connections</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Video &Capture</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Enable Video Capture</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>File &Path:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Frame &Size:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This setting determines the resolution (frame size) of the recorded video.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Frame Rate:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Quality:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screens:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The VRDE server port value is not currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The VRDE authentication timeout value is not currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User Defined</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1 fps</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>fps</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>low</source>
+        <comment>quality</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>medium</source>
+        <comment>quality</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>high</source>
+        <comment>quality</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>kbps</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Screen %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable video recording for screen %1.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+    </message>
+    <message>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation type="unfinished">Makina birtual honen egoera-argazkiak gordeko diren bidea erakusten du. Kontutan izan egoera-argazkiek disko leku asko erabili dezaketela.</translation>
+    </message>
+    <message>
+        <source>Basi&c</source>
+        <translation type="unfinished">&Basikoa</translation>
+    </message>
+    <message>
+        <source>Holds the name of the virtual machine.</source>
+        <translation type="obsolete">Makina birtualaren izena bistaratzen du.</translation>
+    </message>
+    <message>
+        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
+        <translation type="obsolete">Makina birtual honetan instalatzea pentsatzen duzun sistema eragilea erakusten du (sistema eragile bezeroa deiturikoa).</translation>
+    </message>
+    <message>
+        <source>Base &Memory Size</source>
+        <translation type="obsolete">Oinarri &Memoria Tamaina</translation>
+    </message>
+    <message>
+        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
+        <translation type="obsolete">Makina Birtualari ezarritako memoria kantitatea ezartzen du. Gehiegi ezarriaz gero, makina agian ez da abiaraziko.</translation>
+    </message>
+    <message>
+        <source><</source>
+        <translation type="obsolete"><</translation>
+    </message>
+    <message>
+        <source>></source>
+        <translation type="obsolete">></translation>
+    </message>
+    <message>
+        <source>MB</source>
+        <translation type="obsolete">MB</translation>
+    </message>
+    <message>
+        <source>&Video Memory Size</source>
+        <translation type="obsolete">&Bideo Memoria Tamaina</translation>
+    </message>
+    <message>
+        <source>Controls the amount of video memory provided to the virtual machine.</source>
+        <translation type="obsolete">Makina birtualari ezarritako bideo memoria kontrolatzen du.</translation>
+    </message>
+    <message>
+        <source>A&dvanced</source>
+        <translation type="unfinished">&Aurreratua</translation>
+    </message>
+    <message>
+        <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
+        <translation type="obsolete">Abio gailu ordena ezartzen du. Aukerakutxak erabili abio gailuak gaitu edo ezgaitzeko. Elementuak gora eta behera mugitu gailu ordena aldatzeko.</translation>
+    </message>
+    <message>
+        <source>Move Up (Ctrl-Up)</source>
+        <translation type="obsolete">Gora Mugitu (Ktrl-Gora)</translation>
+    </message>
+    <message>
+        <source>Moves the selected boot device up.</source>
+        <translation type="obsolete">Hautatutako abio gailua gora mugitzen du.</translation>
+    </message>
+    <message>
+        <source>Move Down (Ctrl-Down)</source>
+        <translation type="obsolete">Behera Mugitu (Ktrl-Behera)</translation>
+    </message>
+    <message>
+        <source>Moves the selected boot device down.</source>
+        <translation type="obsolete">Hautatutako abio gailua behera mugitzen du.</translation>
+    </message>
+    <message>
+        <source>Enable A&CPI</source>
+        <translation type="obsolete">A&CPI Gaitu</translation>
+    </message>
+    <message>
+        <source>Enable IO A&PIC</source>
+        <translation type="obsolete">IO A&PIC gaitu</translation>
+    </message>
+    <message>
+        <source>Enable &VT-x/AMD-V</source>
+        <translation type="obsolete">&VT-x/AMD-V gaitu</translation>
+    </message>
+    <message>
+        <source>&Shared Clipboard:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <translation type="unfinished">Bezero eta ostalariaren sistema eragileen arteko arbela partekatzeko modua ezartzen du. Kontutan izan honek Bezero Gehigarriak sistema eragile bezeroan instalaturik egotea behar duela.</translation>
+    </message>
+    <message>
+        <source>S&napshot Folder:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>D&escription</source>
+        <translation type="unfinished">A&zalpena</translation>
+    </message>
+    <message>
+        <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
+        <translation type="unfinished">Makina birtualaren azalpena erakusten du. Azalpenen eremua instalaturiko bezero sistemaren eragileari edo konfigurazioari buruz iruzkinak egiteko da erabilgarria.</translation>
+    </message>
+    <message>
+        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
+        <translation type="obsolete">Markaturik badago, Muntaturiko CD/DVD edo diskete euskarrietan eginiko edozein aldaketa gorde egingo da, abiarazteen artean muntaturiko medioen konfigurazioa mantentzeko.</translation>
+    </message>
+    <message>
+        <source>D&rag'n'Drop:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No name specified for the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsNetwork</name>
+    <message>
+        <source>Not selected</source>
+        <comment>network adapter name</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Adapter</source>
+        <comment>network</comment>
+        <translation type="obsolete">Moldagailua</translation>
+    </message>
+    <message>
+        <source>Network</source>
+        <comment>internal</comment>
+        <translation type="obsolete">Sarea</translation>
+    </message>
+    <message>
+        <source>Select TAP setup application</source>
+        <translation type="obsolete">Hautatu TAP konfigurazio aplikazioa</translation>
+    </message>
+    <message>
+        <source>Select TAP terminate application</source>
+        <translation type="obsolete">Hautatu TAP amaiera aplikazioa</translation>
+    </message>
+    <message>
+        <source>When checked, plugs this virtual network adapter into the virtual machine.</source>
+        <translation type="unfinished">Aukeratua dagoenean, sare moldagailu birtual hau eransten du makina birtualean.</translation>
+    </message>
+    <message>
+        <source>&Enable Network Adapter</source>
+        <translation type="unfinished">&Gaitu Sare Moldagailua</translation>
+    </message>
+    <message>
+        <source>Adapter &Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the type of the virtual network adapter. Depending on this value, VirtualBox will provide different network hardware to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Attached to:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls how this virtual adapter is attached to the real network of the Host OS.</source>
+        <translation type="unfinished">Ostalari SE-ren sare errealera konektatzeko moldagailu birtualak modua kontrolatzen du.</translation>
+    </message>
+    <message>
+        <source>&Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Generates a new random MAC address.</source>
+        <translation type="unfinished">Ausazko MAC berri bat sortzen du.</translation>
+    </message>
+    <message>
+        <source>&Generate</source>
+        <translation type="obsolete">&Sortu</translation>
+    </message>
+    <message>
+        <source>Indicates whether the virtual network cable is plugged in on machine startup or not.</source>
+        <translation type="unfinished">Abiaraztean sare kable birtuala konektaturik dagoen erakusten du.</translation>
+    </message>
+    <message>
+        <source>Ca&ble Connected</source>
+        <translation type="obsolete">Ka&blea Konektaturik</translation>
+    </message>
+    <message>
+        <source>Holds the TAP interface name.</source>
+        <translation type="obsolete">TAP interfaze izena bistaratzen du.</translation>
+    </message>
+    <message>
+        <source>Holds the command executed to set up the TAP interface.</source>
+        <translation type="obsolete">TAP interfazea konfiguratzeko exekutatutako komandoa bistaratzen du.</translation>
+    </message>
+    <message>
+        <source>Selects the setup application.</source>
+        <translation type="obsolete">Konfigurazio aplikazioa Hautatzen du.</translation>
+    </message>
+    <message>
+        <source>Holds the command executed to terminate the TAP interface.</source>
+        <translation type="obsolete">TAP interfazea amaitzeko exekutatutako komandoa bistaratzen du.</translation>
+    </message>
+    <message>
+        <source>Selects the terminate application.</source>
+        <translation type="obsolete">Hautatu amaiera aplikazioa.</translation>
+    </message>
+    <message>
+        <source>Host Interface Settings</source>
+        <translation type="obsolete">Ostalari Interfaze Ezarpenak</translation>
+    </message>
+    <message>
+        <source>A&dvanced</source>
+        <translation type="unfinished">&Aurreratua</translation>
+    </message>
+    <message>
+        <source>Shows or hides additional network adapter options.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Cable Connected</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens a window to manage port forwarding rules.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Port Forwarding</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Promiscuous Mode:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the promiscuous mode policy of the network adapter when attached to an internal network, host only network or a bridge.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Generic Properties:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enter any configuration settings here for the network attachment driver you will be using. The settings should be of the form <b>name=value</b> and will depend on the driver. Use <b>shift-enter</b> to add a new entry.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the network adapter on the host system that traffic to and from this network card will go through.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the name of the internal network that this network card will be connected to. You can create a new internal network by choosing a name which is not used by any other network cards in this virtual machine or others.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the virtual network adapter on the host system that traffic to and from this network card will go through. You can create and remove adapters using the global network settings in the virtual machine manager window.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the driver to be used with this network card.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&MAC Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No bridged network adapter is currently selected.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No internal network name is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No host-only network adapter is currently selected.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No generic driver is currently selected.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The MAC address must be 12 hexadecimal digits long.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No NAT network name is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsNetworkDetails</name>
+    <message>
+        <source>Generates a new random MAC address.</source>
+        <translation type="obsolete">Ausazko MAC berri bat sortzen du.</translation>
+    </message>
+    <message>
+        <source>Indicates whether the virtual network cable is plugged in on machine startup or not.</source>
+        <translation type="obsolete">Abiaraztean sare kable birtuala konektaturik dagoen erakusten du.</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsParallel</name>
+    <message>
+        <source>Port %1</source>
+        <comment>parallel ports</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the given parallel port of the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Enable Parallel Port</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Port &Number:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the parallel port number. You can choose one of the standard parallel ports or select <b>User-defined</b> and specify port parameters manually.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&IRQ:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>I/O Po&rt:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Port &Path:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the host parallel device name.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the IRQ number of this parallel port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the base I/O port address of this parallel port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsParallelPage</name>
+    <message>
+        <source>Duplicate port number selected </source>
+        <translation type="obsolete">Bikoizturiko ataka zenbakia hautatu da </translation>
+    </message>
+    <message>
+        <source>Duplicate port path entered </source>
+        <translation type="obsolete">Bikoizturiko ataka bidea idatzi da </translation>
+    </message>
+    <message>
+        <source>No IRQ is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No I/O port is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Two or more ports have the same settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No port path is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>There are currently duplicate port paths specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsPortForwardingDlg</name>
+    <message>
+        <source>Port Forwarding Rules</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This table contains a list of port forwarding rules.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Insert new rule</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Copy selected rule</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete selected rule</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This button adds new port forwarding rule.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This button deletes selected port forwarding rule.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSF</name>
+    <message>
+        <source>Adds a new shared folder definition.</source>
+        <translation type="unfinished">Partekatutako karpeta definizio berria gehitzen du.</translation>
+    </message>
+    <message>
+        <source>Edits the selected shared folder definition.</source>
+        <translation type="unfinished">Hautatutako karpeta definizioa editatzen du.</translation>
+    </message>
+    <message>
+        <source>Removes the selected shared folder definition.</source>
+        <translation type="unfinished">Hautatutako partekatutako karpeta definizioa ezabatzen du.</translation>
+    </message>
+    <message>
+        <source> Machine Folders</source>
+        <translation type="unfinished"> Makina Karpetak</translation>
+    </message>
+    <message>
+        <source> Transient Folders</source>
+        <translation type="unfinished"> Karpeta Mugikorrak</translation>
+    </message>
+    <message>
+        <source>Full</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Read-only</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Lists all shared folders accessible to this machine. Use 'net use x: \\vboxsvr\share' to access a shared folder named <i>share</i> from a DOS-like OS, or 'mount -t vboxsf share mount_point' to access it from a Linux OS. This feature requires Guest Additions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Name</source>
+        <translation type="unfinished">Izena</translation>
+    </message>
+    <message>
+        <source>Path</source>
+        <translation type="unfinished">Bidea</translation>
+    </message>
+    <message>
+        <source>Access</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Add Shared Folder</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Edit Shared Folder</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Remove Shared Folder</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Folders List</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Auto-mount</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Yes</source>
+        <translation type="unfinished">Bai</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSFDetails</name>
+    <message>
+        <source>Add Share</source>
+        <translation type="unfinished">Gehitu Partekatzea</translation>
+    </message>
+    <message>
+        <source>Edit Share</source>
+        <translation type="unfinished">Editatu Partekatzea</translation>
+    </message>
+    <message>
+        <source>Folder Path:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Folder Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the name of the shared folder (as it will be seen by the guest OS).</source>
+        <translation type="unfinished">Partekatutako karpetaren izen bistaratzen du (Ostalari PC-an ikusiko den bezala).</translation>
+    </message>
+    <message>
+        <source>When checked, the guest OS will not be able to write to the specified shared folder.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Read-only</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Make Permanent</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, the guest OS will try to automatically mount the shared folder on startup.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Auto-mount</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, this shared folder will be permanent.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSerial</name>
+    <message>
+        <source>Port %1</source>
+        <comment>serial ports</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the given serial port of the virtual machine.</source>
+        <translation type="unfinished">Hautaturik dagoenean, makina birtualaren emandako serie ataka gaitu.</translation>
+    </message>
+    <message>
+        <source>&Enable Serial Port</source>
+        <translation type="unfinished">&Gaitu Serie Ataka</translation>
+    </message>
+    <message>
+        <source>Port &Number:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the serial port number. You can choose one of the standard serial ports or select <b>User-defined</b> and specify port parameters manually.</source>
+        <translation type="unfinished">Serie ataka zenbakia bistarazi. Serie ataka estandarretako bat hautatu edo <b>Erabiltzaileak-definituriko</b> bat eta ataka parametroak eskuz ezarri.</translation>
+    </message>
+    <message>
+        <source>&IRQ:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the IRQ number of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> is enabled for this virtual machine.</source>
+        <translation type="obsolete">Serie ataka honen IRQ zenbakia bistarazi. Balio erabilgarriak zenbaki osoak <tt>0</tt> eta <tt>255</tt> artean. <tt>15</tt> baina balioa handiagoak erabiltzeko <b>I/O APIC</b> gaiturik egon behar da makina birtual honetan.</translation>
+    </message>
+    <message>
+        <source>I/O Po&rt:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the base I/O port address of this serial port. This should be a whole number between <tt>0</tt> and <tt>0xFFFF</tt>.</source>
+        <translation type="obsolete">Serie ataka honen oinarri S/I helbidea bistaratzen du. Balio erabilgarria zenbaki osoak <tt>0</tt> eta <tt>0xFFFF</tt> tartean.</translation>
+    </message>
+    <message>
+        <source>Port &Mode:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the working mode of this serial port. If you select <b>Disconnected</b>, the guest OS will detect the serial port but will not be able to operate it.</source>
+        <translation type="unfinished">Serie ataka honen funtzionamendu modua kontrolatzen du. <b>Deskonektaturik</b> hautatuaz gero, bezero SE-ak serie ataka ikusiko du baina ezingo du berarekin lan egin.</translation>
+    </message>
+    <message>
+        <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
+        <translation type="obsolete">Markaturik badago, <b>Ataka Bidean</b> ezarritako kanalizazioa sortuko da makina birtualean abiaraztean. Bestela makina birtuala dagoen kanalizazioa erabiltzen saiatuko da.</translation>
+    </message>
+    <message>
+        <source>&Create Pipe</source>
+        <translation type="obsolete">&Sortu Kanalizazioa</translation>
+    </message>
+    <message>
+        <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
+        <translation type="obsolete">Ostalarian Serial atakarako kanalizazioaren bidea erakusten du ataka <b>Ostalari Kanalizazio</b> moduan funtzionatzean, edo serie ataka izena atakak <b>Ostalari Gailua</b> moduan funtzinoatzean.</translation>
+    </message>
+    <message>
+        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSerialPage</name>
+    <message>
+        <source>Duplicate port number selected </source>
+        <translation type="obsolete">Bikoizturiko ataka zenbakia hautatu da </translation>
+    </message>
+    <message>
+        <source>Duplicate port path entered </source>
+        <translation type="obsolete">Bikoizturiko ataka bidea idatzi da </translation>
+    </message>
+    <message>
+        <source>No IRQ is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No I/O port is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Two or more ports have the same settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No port path is currently specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>There are currently duplicate port paths specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsStorage</name>
+    <message>
+        <source><nobr><b>%1</b></nobr><br><nobr>Bus:&nbsp;&nbsp;%2</nobr><br><nobr>Type:&nbsp;&nbsp;%3</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Expand/Collapse&nbsp;Item</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Hard&nbsp;Disk</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add IDE Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add SATA Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add SCSI Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remove Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Attachment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Hard Disk</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remove Attachment</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Adds a new controller to the end of the Storage Tree.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Removes the controller highlighted in the Storage Tree.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Adds a new attachment to the Storage Tree using currently selected controller as parent.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Removes the attachment highlighted in the Storage Tree.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hard &Disk:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Storage Tree</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Contains all storage controllers for this machine and the virtual images and host drives attached to them.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The Storage Tree can contain several controllers of different types. This machine currently has no controllers.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attributes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Changes the name of the storage controller currently selected in the Storage Tree.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the sub-type of the storage controller currently selected in the Storage Tree.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the slot on the storage controller used by this attachment. The available slots depend on the type of the controller and other attachments on it.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, allows the guest to send ATAPI commands directly to the host-drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Passthrough</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Size:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Actual Size:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Size:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Location:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type (Format):</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attached to:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Allows to use host I/O caching capabilities.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use Host I/O Cache</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add SAS Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Type:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Host Drive</source>
+        <translation type="unfinished">Ostalari Gailua</translation>
+    </message>
+    <message>
+        <source>Image</source>
+        <translation type="unfinished">Irudia</translation>
+    </message>
+    <message>
+        <source>Choose or create a virtual hard disk file. The virtual machine will see the data in the file as the contents of the virtual hard disk.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual hard disk</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Floppy &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual floppy disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual floppy drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Create a new hard disk...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual hard disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remove disk from virtual drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual floppy disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the virtual disk will not be removed when the guest system ejects it.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Live CD/DVD</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a solid state device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Solid-state Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Details:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>at most one supported</source>
+        <comment>controller</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>up to %1 supported</source>
+        <comment>controllers</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Port Count:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the port count of the SATA storage controller currently selected in the Storage Tree. This must be at least one more than the highest port number you need to use.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controller: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No name is currently specified for the controller at position <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No hard disk is selected for <i>%1</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSystem</name>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="unfinished"><qt>%1&nbsp;MB</qt></translation>
+    </message>
+    <message>
+        <source><qt>%1&nbsp;CPU</qt></source>
+        <comment>%1 is 1 for now</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Motherboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Base &Memory:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
+        <translation type="unfinished">Makina Birtualari ezarritako memoria kantitatea ezartzen du. Gehiegi ezarriaz gero, makina agian ez da abiaraziko.</translation>
+    </message>
+    <message>
+        <source>MB</source>
+        <translation type="unfinished">MB</translation>
+    </message>
+    <message>
+        <source>&Boot Order:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
+        <translation type="unfinished">Abio gailu ordena ezartzen du. Aukerakutxak erabili abio gailuak gaitu edo ezgaitzeko. Elementuak gora eta behera mugitu gailu ordena aldatzeko.</translation>
+    </message>
+    <message>
+        <source>Move Down (Ctrl-Down)</source>
+        <translation type="unfinished">Behera Mugitu (Ktrl-Behera)</translation>
+    </message>
+    <message>
+        <source>Moves the selected boot device down.</source>
+        <translation type="unfinished">Hautatutako abio gailua behera mugitzen du.</translation>
+    </message>
+    <message>
+        <source>Move Up (Ctrl-Up)</source>
+        <translation type="unfinished">Gora Mugitu (Ktrl-Gora)</translation>
+    </message>
+    <message>
+        <source>Moves the selected boot device up.</source>
+        <translation type="unfinished">Hautatutako abio gailua gora mugitzen du.</translation>
+    </message>
+    <message>
+        <source>Extended Features:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will support the Input Output APIC (I/O APIC), which may slightly decrease performance. <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable &I/O APIC</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Processor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Processor(s):</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable PA&E/NX</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acce&leration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware Virtualization:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable &VT-x/AMD-V</source>
+        <translation type="unfinished">&VT-x/AMD-V gaitu</translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable Nested Pa&ging</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><qt>%1&nbsp;CPUs</qt></source>
+        <comment>%1 is host cpu count * 2 for now</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, the guest will support the Extended Firmware Interface (EFI), which is required to boot certain guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable &EFI (special OSes only)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, the RTC device will report the time in UTC, otherwise in local (host) time. Unix usually expects the hardware clock to be set to UTC.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware Clock in &UTC Time</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the number of virtual CPUs in the virtual machine. You need hardware virtualization support on your host system to use more than one virtual CPU.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Chipset:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the chipset to be emulated in this virtual machine. Note that the ICH9 chipset emulation is experimental and not recommended except for guest systems (such as Mac OS X) which require it.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Execution Cap:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Limits the amount of time that each virtual CPU is allowed to run for. Each virtual CPU will be allowed to use up to this percentage of the processing time available on one physical CPU. The execution cap can be disabled by setting it to 100%. Setting the cap too low can make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><qt>%1%</qt></source>
+        <comment>Min CPU execution cap in %</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><qt>%1%</qt></source>
+        <comment>Max CPU execution cap in %</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Pointing Device:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsUSB</name>
+    <message>
+        <source>&Add Empty Filter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>A&dd Filter From Device</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Edit Filter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Remove Filter</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Move Filter Up</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>M&ove Filter Down</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Adds a new USB filter with all fields initially set to empty strings. Note that such a filter will match any attached USB device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Adds a new USB filter with all fields set to the values of the selected USB device attached to the host PC.</source>
+        <translation type="unfinished">Ostalari ordenagailuari erantsitako hautatutako USB gailuaren eremu balioekin USB iragazki berri bat sortu.</translation>
+    </message>
+    <message>
+        <source>Edits the selected USB filter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Removes the selected USB filter.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Moves the selected USB filter up.</source>
+        <translation type="unfinished">Haututako USB iragazkia gora mugitzen du.</translation>
+    </message>
+    <message>
+        <source>Moves the selected USB filter down.</source>
+        <translation type="unfinished">Haututako USB iragazkia behera mugitzen du.</translation>
+    </message>
+    <message>
+        <source>New Filter %1</source>
+        <comment>usb</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB controller of this machine.</source>
+        <translation type="unfinished">Markaturik dagoenean, makina honetako USB kontrolatzaile birtuala gaitzen du.</translation>
+    </message>
+    <message>
+        <source>Enable &USB Controller</source>
+        <translation type="unfinished">Gaitu &USB Kontrolatzailea</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Device &Filters</source>
+        <translation type="unfinished">USB Gailu &Iragazkiak</translation>
+    </message>
+    <message>
+        <source>Lists all USB filters of this machine. The checkbox to the left defines whether the particular filter is enabled or not. Use the context menu or buttons to the right to add or remove USB filters.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[filter]</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Vendor ID: %1</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Product ID: %2</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Revision: %3</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Product: %4</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Manufacturer: %5</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Serial No.: %1</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Port: %1</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>State: %1</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsUSBFilterDetails</name>
+    <message>
+        <source>Any</source>
+        <comment>remote</comment>
+        <translation type="unfinished">Edozein</translation>
+    </message>
+    <message>
+        <source>Yes</source>
+        <comment>remote</comment>
+        <translation type="unfinished">Bai</translation>
+    </message>
+    <message>
+        <source>No</source>
+        <comment>remote</comment>
+        <translation type="unfinished">Ez</translation>
+    </message>
+    <message>
+        <source>&Name:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the filter name.</source>
+        <translation type="unfinished">Iragazki izena bistarazten du.</translation>
+    </message>
+    <message>
+        <source>&Vendor ID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the vendor ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Product ID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the product ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Revision:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the revision number filter. The <i>exact match</i> string format is <tt>IIFF</tt> where <tt>I</tt> is a decimal digit of the integer part and <tt>F</tt> is a decimal digit of the fractional part. An empty string will match any value.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Manufacturer:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the manufacturer filter as an <i>exact match</i> string. An empty string will match any value.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Pro&duct:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the product name filter as an <i>exact match</i> string. An empty string will match any value.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Serial No.:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the serial number filter as an <i>exact match</i> string. An empty string will match any value.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Por&t:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines the host USB port filter as an <i>exact match</i> string. An empty string will match any value.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>R&emote:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Defines whether this filter applies to USB devices attached locally to the host computer (<i>No</i>), to a VRDP client's computer (<i>Yes</i>), or both (<i>Any</i>).</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Filter Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineWindow</name>
+    <message>
+        <source> EXPERIMENTAL build %1r%2 - %3</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineWindowNormal</name>
+    <message>
+        <source>Shows the currently assigned Host key.<br>This key, when pressed alone, toggles the keyboard and mouse capture state. It can also be used in combination with other keys to quickly perform actions from the main menu.</source>
+        <translation></translation>
+    </message>
+</context>
+<context>
+    <name>UIMediumManager</name>
+    <message>
+        <source>&Hard drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical disks</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy disks</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Select</source>
+        <translation type="obsolete">&Hautatu</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMediumTypeChangeDialog</name>
+    <message>
+        <source>Modify medium attributes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to change the settings of the disk image file <b>%1</b>.</p><p>Please choose one of the following modes and press <b>%2</b> to proceed or <b>%3</b> otherwise.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose mode:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Itxi</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMessageCenter</name>
+    <message>
+        <source>VirtualBox - Information</source>
+        <comment>msg box title</comment>
+        <translation>VirtualBox - Argibideak</translation>
+    </message>
+    <message>
+        <source>VirtualBox - Question</source>
+        <comment>msg box title</comment>
+        <translation>VirtualBox - Galdera</translation>
+    </message>
+    <message>
+        <source>VirtualBox - Warning</source>
+        <comment>msg box title</comment>
+        <translation>VirtualBox - Kontuz</translation>
+    </message>
+    <message>
+        <source>VirtualBox - Error</source>
+        <comment>msg box title</comment>
+        <translation>VirtualBox - Errorea</translation>
+    </message>
+    <message>
+        <source>VirtualBox - Critical Error</source>
+        <comment>msg box title</comment>
+        <translation>VirtualBox - Errore Kritikoa</translation>
+    </message>
+    <message>
+        <source>Do not show this message again</source>
+        <comment>msg box flag</comment>
+        <translation>Ez erakutsi mezu hau berriz</translation>
+    </message>
+    <message>
+        <source>Failed to open <tt>%1</tt>. Make sure your desktop environment can properly handle URLs of this type.</source>
+        <translation>Huts <tt>%1</tt> irekitzean. Ziurtatu zaitez zure idazmahai inguruneak mota honetako URL-ak kudea ditzakeela.</translation>
+    </message>
+    <message>
+        <source><p>Failed to initialize COM or to find the VirtualBox COM server. Most likely, the VirtualBox server is not running or failed to start.</p><p>The application will now terminate.</p></source>
+        <translation><p>Huts VirtualBox COM zerbitzaria bilatzeko COM abiaraztean. Seguruenik, VirtualBox zerbitzaria ez dago abiarazirik edo huts egin du abiaraztean.</p><p>Aplikazioa orain itxi egingo da.</p></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="obsolete"><p>Huts VirtualBox COM elementua sortzerakoan.</p><p>Aplikazioa itxi egingo da orain,</p></translation>
+    </message>
+    <message>
+        <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
+        <translation type="obsolete"><p>Huts GUI interfaze nagusiaren konfigurazioa kargatzerakoan.</p><p>Aplikazioa itxi egingo da orain,</p></translation>
+    </message>
+    <message>
+        <source><p>Failed to save the global GUI configuration.<p></source>
+        <translation type="obsolete"><p>Huts GUI interfaze nagusiaren konfigurazioa gordetzerakoan.<p></translation>
+    </message>
+    <message>
+        <source>Failed to set global VirtualBox properties.</source>
+        <translation>Huts VirtualBox propietate orokorrak ezartzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to access the USB subsystem.</source>
+        <translation>Huts USB azpisistema atzitzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to create a new virtual machine.</source>
+        <translation>Huts makina birtual berria sortzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to create a new virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Huts <b>%1</b> makina birtual berria sortzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to apply the settings to the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Huts hobespenak <b>%1</b> makina birtualean ezartzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to save the settings of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Huts <b>%1</b> makina birtualaren hobespenak gordetzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to load the settings of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Huts <b>%1</b> makina birtualaren hobespenak kargatzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to start the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtuala abiarazterakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to pause the execution of the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtualaren exekuzioa gelditzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to resume the execution of the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtualaren exekuzioa jarraitzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to save the state of the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtualaren egoera gordetzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to create a snapshot of the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtualaren egoera-argazkia egiterakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to stop the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtuala gelditzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to remove the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtuala ezabatzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to discard the saved state of the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtualaren gordetako egoera baztertzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to discard the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
+        <translation type="obsolete">Huts <b>%2</b> makina birtualaren <b>%1</b> egoera-argazkia baztertzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to discard the current state of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Huts <b>%1</b> makina birtualaren uneko egoera baztertzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to discard the current snapshot and the current state of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Huts <b>%1</b> makina birtualaren uneko egoera-argazkia eta uneko egoera baztertzerakoan.</translation>
+    </message>
+    <message>
+        <source>There is no virtual machine named <b>%1</b>.</source>
+        <translation>Ez dago <b>%1</b> izeneko makina birtualik.</translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to permanently delete the virtual machine <b>%1</b>?</p><p>This operation cannot be undone.</p></source>
+        <translation type="obsolete"><p>Ziur al zaude <b>%1</b> Maina Birtuala betirako ezabatu nahi duzula?</p><p>Ekintza hau ezin da desegin.</p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to unregister the inaccessible virtual machine <b>%1</b>?</p><p>You will not be able to register it again from GUI.</p></source>
+        <translation type="obsolete"><p>Ziur al zaude eskuratu ezin den <b>%1</b> makina birtualaren erregistroa kendu nahi duzula?</p><p>Ezingo duzu berau interfazearen bidez berriz erregistratu.</p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to discard the saved state of the virtual machine <b>%1</b>?</p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
+        <translation type="obsolete"><p>Ziur al zaude <b>%1</b> makina birtualaren gordetako uneko egoera baztertu nahi duzula?</p><p>Ekintza hau makinaren reset botoia jo edo behar bezala bezero sistema eragilea itzali gabe makina itzaltzearen berdina da</p></translation>
+    </message>
+    <message>
+        <source><p>Releasing this media image will detach it from the following virtual machine(s): <b>%1</b>.</p><p>Continue?</p></source>
+        <translation type="obsolete"><p>Euskarri hau ateratzeak berau hurrengo makina birtuale(ta)tik kentzea eragingo du: <b>%1</b>.</p><p>Jarraitu?</p></translation>
+    </message>
+    <message>
+        <source><p>The image file <b>%1</b> already exists. You cannot create a new virtual hard disk that uses this file, because it can be already used by another virtual hard disk.</p><p>Please specify a different image file name.</p></source>
+        <translation type="obsolete"><p>Badago dagoeneko <b>%1</b> irudi fitxategia. Ezin duzu fitxategi hau erabiltzen duen disko gogor birtual berri bat sortu, agian beste disko gogor birtual batek erabiltzen duelako</p><p>Mesedez ezarri beste irudi fitxategi izen bat.</p></translation>
+    </message>
+    <message>
+        <source><p>Do you want to delete this hard disk's image file <nobr><b>%1</b>?</nobr></p><p>If you select <b>No</b> then the virtual hard disk will be unregistered and removed from the collection, but the image file will be left on your physical disk.</p><p>If you select <b>Yes</b> then the image file will be permanently deleted after unregistering the hard disk. This operation cannot be undone.< [...]
+        <translation type="obsolete"><p><nobr><b>%1</b></nobr> disko gogor irudi fitxategia ezabatu nahi duzu?</p><p><b>Ez</b> hautatzen baduzu disko gogor birtualaren erregistroa kendu eta bildumatik kenduko da, baina irudi fitxategia disko fisioan utziko da.</p><p><b>Bai</b> hautatzen baduzu fitxategi hau guztiz ezabatua izango da erregistroa kendu ondoren. Ekintza hau ezin da desegin.</p></translation>
+    </message>
+    <message>
+        <source>Failed to delete the virtual hard disk image <b>%1</b>.</source>
+        <translation type="obsolete">Huts <b>%1</b> disko gogor irudi fitxategia ezabatzerakoan.</translation>
+    </message>
+    <message>
+        <source><p>Do you want to remove (unregister) the virtual hard disk <nobr><b>%1</b>?</nobr></p></source>
+        <translation type="obsolete"><p><nobr><b>%1</b></nobr> disko gogor birtuala ezabatu (erregistroa kendu) nahi duzu?</p></translation>
+    </message>
+    <message>
+        <source>Failed to create the virtual hard disk image <nobr><b>%1</b>.</nobr></source>
+        <translation type="obsolete">Huts disko gogor birtual irudia sortzerakoan:<nobr><b>%1</b>.</nobr></translation>
+    </message>
+    <message>
+        <source>Failed to attach a hard disk image with UUID %1 to the device slot %2 of the controller %3 of the machine <b>%4</b>.</source>
+        <translation type="obsolete">Huts UUID %1 duen disko gogor irudia <b>%4</b> makinaren %3 kontrolatzaileko %2 atakan eransterakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to detach a hard disk image from the device slot %1 of the controller %2 of the machine <b>%3</b>.</source>
+        <translation type="obsolete">Huts <b>%3</b> makinako %2 kontrolatzailearen %1 atakan dagoen irudi fitxategia kentzerakoan.</translation>
+    </message>
+    <message>
+        <source>hard disk</source>
+        <translation type="obsolete">disko gogorra</translation>
+    </message>
+    <message>
+        <source>CD/DVD image</source>
+        <translation type="obsolete">CD/DVD irudia</translation>
+    </message>
+    <message>
+        <source>floppy image</source>
+        <translation type="obsolete">Diskete irudia</translation>
+    </message>
+    <message>
+        <source>Failed to register the %1 <nobr><b>%2</b></nobr>.</source>
+        <translation type="obsolete">Huts %1 <nobr><b>%2</b></nobr> erregistratzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to unregister the %1 <nobr><b>%2</b></nobr>.</source>
+        <translation type="obsolete">Huts %1 <nobr><b>%2</b></nobr> erregistroa kentzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to create a new session.</source>
+        <translation>Huts saio berria sortzean.</translation>
+    </message>
+    <message>
+        <source>Failed to open a session for the virtual machine <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> makina birtualarentzat saio bat irekitzean.</translation>
+    </message>
+    <message>
+        <source>Failed to determine the accessibility state of the media <nobr><b>%1</b></nobr>. Some of the registered media may become inaccessible.</source>
+        <translation type="obsolete">Huts <nobr><b>%1</b></nobr> medioaren eskuragarritasun egoera egiaztatzerakoan. Erregistraturiko zenbait euskarri eskuraezin egon litezke.</translation>
+    </message>
+    <message>
+        <source>Failed to create the host network interface <b>%1</b>.</source>
+        <translation type="obsolete">Huts <b>%1</b> ostalari sare interfazea sortzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to remove the host network interface <b>%1</b>.</source>
+        <translation>Huts <b>%1</b> ostalari sare interfazea kentzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation>Huts <b>%1</b> USB gailua <b>%2</b> makina birtualean eransterakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation>Huts <b>%1</b> USB gailua <b>%2</b> makina birtualetik kentzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to create the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.</source>
+        <translation>Huts <b>%1</b> partekatutako karpeta (<nobr><b>%2</b></nobr>-ra lotua) <b>%3</b> makina birtualean sortzerakoan.</translation>
+    </message>
+    <message>
+        <source>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</source>
+        <translation type="obsolete">Huts <b>%1</b> partekatutako karpeta (<nobr><b>%2</b></nobr>-ra lotua) <b>%3</b> makina birtualetik kentzerakoan.</translation>
+    </message>
+    <message>
+        <source><p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> in the current video mode. You need to capture the mouse (by clicking over the VM display or pressing the host key) in order to use the mouse inside the guest OS.</p></source>
+        <translation><p>Makina Birtualak bezero SE-ak bideo modu honetan ez duela <b>sagu integrazioa</b> onartzen erreportatu du. Sagua kapturatu egin beharko duzu (MB leihoan klikatuaz edo ostalari tekla sakatuaz) sagua bezeroko sistema eragilean erabili ahal izateko.</p></translation>
+    </message>
+    <message>
+        <source><p>The Virtual Machine is currently in the <b>Paused</b> state and not able to see any keyboard or mouse input. If you want to continue to work inside the VM, you need to resume it by selecting the corresponding action from the menu bar.</p></source>
+        <translation><p>Makina Birtuala orain <b>Gelditurik</b> egoeran dago eta horregatik ez du sagu edo teklatu sarrerarik onartzen. MB barnean lanean jarraitu nahi izanez gero berau jarraitu behar duzu dagokion ekintza hautatuaz menu barratik.</p></translation>
+    </message>
+    <message>
+        <source><p>One or more of the registered virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>OK</b> to open the Virtual Disk Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="obsolete"><p>Erregistraturik dauden disko gogor, CD/DVD edo diskete euskarriren bat ez dago eskuragarri. Honegatik, euskarri hori erabiltzen duen makina birtualik ezingo duzu erabili, berriz eskuragarri egon arte.</p><p><b>Ados</b> sakatu Disko Gogor Kudeatzailea ireki eta zein euskarri eskuragarri dauden ikusteko, edo <b>Baztertu</b> sakatu mezu hau albo batetara uzteko.</p></translation>
+    </message>
+    <message>
+        <source><p>Cannot run VirtualBox in <i>VM Selector</i> mode due to local restrictions.</p><p>The application will now terminate.</p></source>
+        <translation type="obsolete"><p>Murrizpen lokalak direla eta ezin da VirtualBox <i>MB hautatzaile</i> moduan abiarazi.</p><p>Aplikazioa itxi egingo da.</p></translation>
+    </message>
+    <message>
+        <source>Failed to open/interpret appliance <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to import appliance <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to prepare the export of the appliance <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to export appliance <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Fatal Error</nobr></source>
+        <comment>runtime error info</comment>
+        <translation><nobr>Errore Konponezina</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Non-Fatal Error</nobr></source>
+        <comment>runtime error info</comment>
+        <translation><nobr>Errore Konpongarria</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Warning</nobr></source>
+        <comment>runtime error info</comment>
+        <translation><nobr>Abisua</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Error ID: </nobr></source>
+        <comment>runtime error info</comment>
+        <translation><nobr>Errore ID-a: </nobr></translation>
+    </message>
+    <message>
+        <source>Severity: </source>
+        <comment>runtime error info</comment>
+        <translation>Larritasuna: </translation>
+    </message>
+    <message>
+        <source><p>A fatal error has occurred during virtual machine execution! The virtual machine will be powered off. Please copy the following error message using the clipboard to help diagnose the problem:</p></source>
+        <translation><p>Errore konponezin bat gertatu da makina birtuala exekutatzean! Makina birtuala itzali egingo da. Hurrengo errore mezua beranduago begiratzeko kopiatzeko arbela erabiltzea gomendatzen da:</p></translation>
+    </message>
+    <message>
+        <source><p>An error has occurred during virtual machine execution! The error details are shown below. You may try to correct the error and resume the virtual machine execution.</p></source>
+        <translation><p>Errore bat gertatu da makina birtuala exekutatzean! Errore xehetasunak behean ikusten dira. Azaldutako errorea konpondu eta makina birtual exekuzioa jarraitzen saiatu zaitezke.</p></translation>
+    </message>
+    <message>
+        <source><p>The virtual machine execution may run into an error condition as described below. We suggest that you take an appropriate action to avert the error.</p></source>
+        <translation><p>Makina Birtual exekuzioak behean azaltzen den bezala errore egoera batetan jarraitu dezake. Mezu hau albo batetara utzi dezakezu, baina azaldutako errorea berriz ez gertatzeko egin beharrekoa egitea gomendatzen da.</p></translation>
+    </message>
+    <message>
+        <source>Result&nbsp;Code: </source>
+        <comment>error info</comment>
+        <translation>Emaitza&nbsp;Kodea: </translation>
+    </message>
+    <message>
+        <source>Component: </source>
+        <comment>error info</comment>
+        <translation>Osagaia: </translation>
+    </message>
+    <message>
+        <source>Interface: </source>
+        <comment>error info</comment>
+        <translation>Interfazea: </translation>
+    </message>
+    <message>
+        <source>Callee: </source>
+        <comment>error info</comment>
+        <translation>Deitura: </translation>
+    </message>
+    <message>
+        <source>Callee&nbsp;RC: </source>
+        <comment>error info</comment>
+        <translation>Deitura eta RC: </translation>
+    </message>
+    <message>
+        <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p></source>
+        <translation type="obsolete"><p>Ezin da <b><nobr>%1</nobr></b> hizkuntza fitxategia kargatu.<p>Hizkuntza aldiroko Ingelesera (barneratua) berrezarriko da. Mesedez joan VirtualBox leiho nagusiko <b>Fitxategia</b> menuan aurki dezakezun <b>Hobespenak</b> leihora eta hautatu erabilgarri daudenetako bat <b>Hizkuntza</b> orrialdean.</p></translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>Bezero sistema eragilea instalaturik dauden Virtualbox Bezero Gehigarriak zaharregiak dira: Instalaturiko bertsioa %1 da eta espero zena %2. Bezero gehigarriak behar dituzten zenbait funtziok (sagu integrazioa, bezero pantaila auto tamaina aldaketa) behar bezala funtzionatzeaz utziko dute ziurrenik.</p><p>Mesedez eguneratu Bezero Gehigarriak gaur egungo bertsiora <b>Gailuak</b> menuko <b>Bezero Gehigarriak</b& [...]
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>Bezero sistema eragilea instalaturik dauden Virtualbox Bezero Gehigarriak zaharkiturik daude: Instalaturiko bertsioa %1 da eta espero zena %2. Bezero gehigarriak behar dituzten zenbait funtziok (sagu integrazioa, bezero pantaila auto tamaina aldaketa) behar bezala funtzionatzeaz utziko dute ziurrenik.</p><p>Mesedez eguneratu Bezero Gehigarriak gaur egungo bertsiora <b>Gailuak</b> menuko <b>Bezero Gehigarriak Inst [...]
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>Bezero sistema eragilea instalaturik dauden Virtualbox Bezero Gehigarriak berriegiak dira: Instalaturik dagoen bertsioa %1 da eta espero zena %2</p><p>Gehigarrien Virtualbox baino bertsio berriago bat erabiltzea ez da onartzen. Mesedez instalatu egungo Bezero Gehigarriak <b>Gailuak</b> menuko <b>Bezero Gehigarriak Instalatu </b>hautatuaz.</p></translation>
+    </message>
+    <message>
+        <source>Failed to change the snapshot folder path of the virtual machine <b>%1<b> to <nobr><b>%2</b></nobr>.</source>
+        <translation type="obsolete">Huts <b>%1<b> makina birtualaren egoera-argazki bidea <nobr> <b>%2</b></nobr>-ra aldatzean.</translation>
+    </message>
+    <message>
+        <source><p>Could not enter seamless mode due to insufficient guest video memory.</p><p>You should configure the VM to have at least <b>%1</b> of video memory.</p></source>
+        <translation type="obsolete"><p>Ezin da integratu garden moduan sartu bezero bideo memoria askieza dela eta.</p><p>Makina birtuala behintzat <b>%1</b> bideo memoria edukitzeko konfiguratu beharko zenuke.</p></translation>
+    </message>
+    <message>
+        <source><p>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</p><p>Please close all programs in the guest OS that may be using this shared folder and try again.</p></source>
+        <translation><p>Huts <b>%1</b> partekatutako kapeta (<nobr><b>%2</b></nobr>-ra lotua dagoena) <b>%3</b> makina birtualetik ezabatzerakoan.</p> <p>Mesedez itxi partekatutako karpeta hori erabiltzen ari diren sistema eragileko aplikazioak eta berriz saiatu.</p></translation>
+    </message>
+    <message>
+        <source><p>Could not find the VirtualBox Guest Additions disk image file file <nobr><b>%1</b></nobr> or <nobr><b>%2</b>.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
+        <translation type="obsolete"><p>Ez da <nobr><b>%1</b></nobr> edo <nobr><b>%2</b></nobr> VirtualBox Bezero Gehigarri irudia aurkitu.</p><p>Irudi hau internetetik deskargatu nahi al duzu?</p></translation>
+    </message>
+    <message>
+        <source><p>Failed to download the VirtualBox Guest Additions disk image file from <nobr><a href="%1">%2</a>.</nobr></p><p>%3</p></source>
+        <translation type="obsolete"><p>Huts Virtualbox Bezero Gehigarri CD irudia <nobr><a href="%1">%2</a>-etik deskargatzean.</nobr></p><p>%3</p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to download the VirtualBox Guest Additions disk image file from <nobr><a href="%1">%2</a></nobr> (size %3 bytes)?</p></source>
+        <translation type="obsolete"><p>Ziur zaude VirtualBox Bezero Gehigarrien CD irudia <nobr><a href="%1">%2</a>-etik deskargatu nahi duzula </nobr> (tamaina %3 byte)?</p></translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions disk image file has been successfully downloaded from <nobr><a href="%1">%2</a></nobr> and saved locally as <nobr><b>%3</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
+        <translation type="obsolete"><p>VirtualBox Bezero Gehigarri CD irudia behar bezala deskargatu da <nobr><a href="%1">%2</a></nobr> -etik eta <nobr><b>%3</b>bezala gorde da.</nobr></p> <p>CD irudi hori erregistratu eta CD/DVD birtualean kargatu nahi al duzu?</p></translation>
+    </message>
+    <message>
+        <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>. Note that the <i>Host</i> key is currently defined as <b>%1</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <translation type="obsolete"><p>Makina Birtuala orain <b>pantaila oso</b> modura aldatuko da. Atzera leihoturiko modura itzuli zaitezke edozein momentutan <b>%1</b> sakatuaz. Kontutan izan <i>Ostalari</i> tekla une honetan <b>%2</b> bezala ezarririk dagoela.</p><p> Kontutan izan menu-barra ezkutaturik dagoela pantaila osoko moduan. Bera eskuratzeko aski da <b>Osta+Etxea</b>sakatzearekin.</p></tran [...]
+    </message>
+    <message>
+        <source><p>The virtual machine window will be now switched to <b>Seamless</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>. Note that the <i>Host</i> key is currently defined as <b>%1</b>.</p><p>Note that the main menu bar is hidden in seamless mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <translation type="obsolete"><p>Makina Birtuala orain <b>integrazio garden</b> modura aldatuko da. Atzera leihoturiko modura itzuli zaitezke edozein momentutan <b>%1</b> sakatuaz. Kontutan izan <i>Ostalari</i> tekla une honetan <b>%2</b> bezala ezarririk dagoela.</p><p> Kontutan izan menu-barra ezkutaturik dagoela pantaila osoko moduan. Bera eskuratzeko aski da <b>Osta+Etxea</b>sakatzearekin.</p>< [...]
+    </message>
+    <message>
+        <source><p>The virtual machine window is optimized to work in <b>%1&nbsp;bit</b> color mode but the virtual display is currently set to <b>%2&nbsp;bit</b>.</p><p>Please open the display properties dialog of the guest OS and select a <b>%3&nbsp;bit</b> color mode, if it is available, for best possible performance of the virtual video subsystem.</p><p><b>Note</b>. Some operating systems, like  [...]
+        <translation type="obsolete"><p>Makina birtualaren leihoa <b>%1&nbsp;bit</b> kolore moduan funtzionatzeko garatua izan da baina pantaila birtualaren kalitatea <b>%2&nbsp;bitera</b> ezarririk dago.</p><p>Mesedez ireki bezero sistema eragileko pantaila propietateak eta hautatu <b>%3&nbsp;bit</b> duen modu bat, erabilgarri badago, bideo birtual azpisistemak ahal den hobekien funtzionatzeko.</p><p><b> [...]
+    </message>
+    <message>
+        <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
+        <translation type="obsolete"><p>Ez duzu disko gogor birtualik erantsi makina birtual honetara. Makina ez da abiarazteko gai izango sistema eragile duen disko gogor bat edo beste euskarri abiarazgarri baten bat erantsi arte, berau beranduago egiteko ezarpen leiho edo Lehen Abiarazte Morroiaren bidez egin dezakezu.</p><p>Aurrera jarraitu nahi al duzu?</p></translation>
+    </message>
+    <message>
+        <source>Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to save the global GUI configuration to <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <comment>machine</comment>
+        <translation type="obsolete">Ezabatu</translation>
+    </message>
+    <message>
+        <source>Discard</source>
+        <comment>saved state</comment>
+        <translation type="unfinished">Baztertu</translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <comment>hard disk</comment>
+        <translation type="obsolete">Ezabatu</translation>
+    </message>
+    <message>
+        <source>Disable</source>
+        <comment>hard disk</comment>
+        <translation type="obsolete">Ezgaitu</translation>
+    </message>
+    <message>
+        <source><p>The host key is currently defined as <b>%1</b>.</p></source>
+        <comment>additional message box paragraph</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Capture</source>
+        <comment>do input capture</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Check</source>
+        <comment>inaccessible media message box</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Save</source>
+        <comment>warnAboutAutoConvertedSettings message box</comment>
+        <translation type="obsolete">&Gorde</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <comment>warnAboutAutoConvertedSettings message box</comment>
+        <translation type="obsolete">Utzi</translation>
+    </message>
+    <message>
+        <source>Reset</source>
+        <comment>machine</comment>
+        <translation type="unfinished">Berrezarri</translation>
+    </message>
+    <message>
+        <source>Continue</source>
+        <comment>no hard disk attached</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Go Back</source>
+        <comment>no hard disk attached</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Select</source>
+        <comment>hard disk</comment>
+        <translation type="obsolete">Hautatu</translation>
+    </message>
+    <message>
+        <source><p>Could not enter seamless mode due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not switch the guest display to fullscreen mode due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p><p>Press <b>Ignore</b> to switch to fullscreen mode anyway or press <b>Cancel</b> to cancel the operation.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Deleting this host-only network will remove the host-only interface this network is based on. Do you want to remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p><p><b>Note:</b> this interface may be in use by one or more virtual network adapters belonging to one of your VMs. After it is removed, these adapters will no longer be usable until you correct their settings by either choosing a different in [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are already running the most recent version of VirtualBox.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer integration is not currently supported by the guest OS) and the keyboard, which will make them unavailable to other applications running on your host machine.</p><p>You can press the <b>host key</b> at  [...]
+        <translation type="unfinished"><p>Zuk Makina Birtualaren pantailan <b>sagu botoia</b> edo <b>ostalari tekla</b> sakatu duzu. Honek makina birtualak ostalariaren sagu markatzailea (bakarrik sagu markatzaile integrazioa ez badu SE bezeroak onartzen) eta teklatua <b>kapturatzea</b> eragingo du, honekin agian ez dira erabilgarri izango ostalari makinan abiarazirik dauden aplikazio batzuekin .</p><p><b>Ostalari tekla</b&gt [...]
+    </message>
+    <message>
+        <source><p>You have the <b>Auto capture keyboard</b> option turned on. This will cause the Virtual Machine to automatically <b>capture</b> the keyboard every time the VM window is activated and make it unavailable to other applications running on your host machine: when the keyboard is captured, all keystrokes (including system ones like Alt-Tab) will be directed to the VM.</p><p>You can press the <b>host key</b> at any time t [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The Virtual Machine reports that the guest OS supports <b>mouse pointer integration</b>. This means that you do not need to <i>capture</i> the mouse pointer to be able to use it in your guest OS -- all mouse actions you perform when the mouse pointer is over the Virtual Machine's display are directly sent to the guest OS. If the mouse is currently captured, it will be automatically uncaptured.</p><p>The mouse icon on the s [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>. Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <translation type="obsolete"><p>Makina Birtuala orain <b>pantaila oso</b> modura aldatuko da. Atzera leihoturiko modura itzuli zaitezke edozein momentutan <b>%1</b> sakatuaz. Kontutan izan <i>Ostalari</i> tekla une honetan <b>%2</b> bezala ezarririk dagoela.</p><p> Kontutan izan menu-barra ezkutaturik dagoela pantaila osoko moduan. Bera eskuratzeko aski da <b>Osta+Etxea</b>sakatzearekin.</p> {1&lt [...]
+    </message>
+    <message>
+        <source><p>The virtual machine window will be now switched to <b>Seamless</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>. Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in seamless mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <translation type="obsolete"><p>Makina Birtuala orain <b>integrazio garden</b> modura aldatuko da. Atzera leihoturiko modura itzuli zaitezke edozein momentutan <b>%1</b> sakatuaz. Kontutan izan <i>Ostalari</i> tekla une honetan <b>%2</b> bezala ezarririk dagoela.</p><p> Kontutan izan menu-barra ezkutaturik dagoela pantaila osoko moduan. Bera eskuratzeko aski da <b>Osta+Etxea</b>sakatzearekin.</p>  [...]
+    </message>
+    <message>
+        <source>&Contents...</source>
+        <translation type="obsolete">&Edukiak...</translation>
+    </message>
+    <message>
+        <source>Show the online help contents</source>
+        <translation type="obsolete">Sare bidezko laguntza edukia bistarazi</translation>
+    </message>
+    <message>
+        <source>&VirtualBox Web Site...</source>
+        <translation type="obsolete">&VirtualBox Web Gunea...</translation>
+    </message>
+    <message>
+        <source>Open the browser and go to the VirtualBox product web site</source>
+        <translation type="obsolete">Nabigatzailea ireki eta VirtualBox produktuaren gunera joan</translation>
+    </message>
+    <message>
+        <source>&Reset All Warnings</source>
+        <translation type="obsolete">Abisu Guztiak Be&rrezarri</translation>
+    </message>
+    <message>
+        <source>Go back to showing all suppressed warnings and messages</source>
+        <translation type="obsolete">Ezabatutako abisu eta mezu guztiak berriz agertzea eragien du</translation>
+    </message>
+    <message>
+        <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are running a prerelease version of VirtualBox. This version is not suitable for production use.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to shut down the guest with the ACPI power button. This is currently not possible because the guest does not support software shutdown.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close VM</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Continue</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Discard</source>
+        <translation type="obsolete">Baztertu</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="unfinished">Utzi</translation>
+    </message>
+    <message>
+        <source>Release</source>
+        <comment>detach medium</comment>
+        <translation type="unfinished">Atera</translation>
+    </message>
+    <message>
+        <source>Remove</source>
+        <comment>medium</comment>
+        <translation type="unfinished">Kendu</translation>
+    </message>
+    <message>
+        <source><p>The hard disk storage unit at location <b>%1</b> already exists. You cannot create a new virtual hard disk that uses this location because it can be already used by another virtual hard disk.</p><p>Please specify a different location.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Do you want to delete the storage unit of the hard disk <nobr><b>%1</b></nobr>?</p><p>If you select <b>Delete</b> then the specified storage unit will be permanently deleted. This operation <b>cannot be undone</b>.</p><p>If you select <b>Keep</b> then the hard disk will be only removed from the list of known hard disks, but the storage unit will be left untouched which makes it po [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <comment>hard disk storage</comment>
+        <translation type="unfinished">Ezabatu</translation>
+    </message>
+    <message>
+        <source>Keep</source>
+        <comment>hard disk storage</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to delete the storage unit of the hard disk <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to create the hard disk storage <nobr><b>%1</b>.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to access the disk image file <nobr><b>%1</b></nobr>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Do you want to remove the selected host network interface <nobr><b>%1</b>?</nobr></p><p><b>Note:</b> This interface may be in use by one or more network adapters of this or another VM. After it is removed, these adapters will no longer work until you correct their settings by either choosing a different interface name or a different adapter attachment type.</p></source>
+        <translation type="obsolete"><p>Hautaturiko <nobr><b>%1</b></nobr> sare interfazea ezabatu nahi al duzu? </p><p><b>Oharra:</b> Interfaze hau erabilia egon daiteke sare moldagailu bat edo gehiagorengatik beste MB batetan. Ezabatu ondoren sare moldagailu horiek ez dute funtzionatuko ezarpen horiek aldatu arte  edo beste interfaze izen bat hautatuz o moldagailu eranste modu ezberdin bat hautatuaz.</p></translation>
+    </message>
+    <message>
+        <source>E&xit</source>
+        <comment>warnAboutAutoConvertedSettings message box</comment>
+        <translation type="obsolete">I&rten</translation>
+    </message>
+    <message>
+        <source>hard disk</source>
+        <comment>failed to close ...</comment>
+        <translation type="obsolete">disko gogorra</translation>
+    </message>
+    <message>
+        <source>CD/DVD image</source>
+        <comment>failed to close ...</comment>
+        <translation type="obsolete">CD/DVD irudia</translation>
+    </message>
+    <message>
+        <source>floppy image</source>
+        <comment>failed to close ...</comment>
+        <translation type="obsolete">Diskete irudia</translation>
+    </message>
+    <message>
+        <source>A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Certain guests (e.g. OS/2 and QNX) require this feature.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to check files.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to remove file.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. We strongly recommend that you change this, as it is a severe mis-configuration of your system which could cause USB devices to fail in unexpected ways.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are running an EXPERIMENTAL build of VirtualBox. This version is not suitable for production use.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Restore</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over several image files that VirtualBox has created together with the snapshot will be merged into one file. This can be a lengthy process, and the information in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete</source>
+        <translation type="unfinished">Ezabatu</translation>
+    </message>
+    <message>
+        <source>Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Select</source>
+        <comment>medium</comment>
+        <translation type="obsolete">&Hautatu</translation>
+    </message>
+    <message>
+        <source>Force Unmount</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&xit</source>
+        <comment>warnAboutSettingsAutoConversion message box</comment>
+        <translation type="obsolete">I&rten</translation>
+    </message>
+    <message>
+        <source>hard disk</source>
+        <comment>failed to mount ...</comment>
+        <translation type="obsolete">disko gogorra</translation>
+    </message>
+    <message>
+        <source>CD/DVD image</source>
+        <comment>failed to mount ...</comment>
+        <translation type="obsolete">CD/DVD irudia</translation>
+    </message>
+    <message>
+        <source>floppy image</source>
+        <comment>failed to mount ...</comment>
+        <translation type="obsolete">Diskete irudia</translation>
+    </message>
+    <message>
+        <source>hard disk</source>
+        <comment>failed to attach ...</comment>
+        <translation type="obsolete">disko gogorra</translation>
+    </message>
+    <message>
+        <source>&Remove</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>VT-x/AMD-V hardware acceleration is not available on your system. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>VT-x/AMD-V hardware acceleration is not available on your system. Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Deleting the snapshot %1 will temporarily need more disk space. In the worst case the size of image %2 will grow by %3, however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting the snapshot at your own risk.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p><p>Press <b>Ignore</b> to switch the screen anyway or press <b>Cancel</b> to cancel the operation.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to open virtual machine located in %1.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Delete all files</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remove only</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remove</source>
+        <translation type="unfinished">Kendu</translation>
+    </message>
+    <message>
+        <source><p>You are about to add a virtual hard disk to controller <b>%1</b>.</p><p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to install the Extension Pack <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to uninstall the Extension Pack <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Remove</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. None of the host or guest port values may be set to zero.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>There are unsaved changes in the port forwarding configuration.</p><p>If you proceed your changes will be discarded.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The virtual machine window will be now switched to <b>Seamless</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in seamless mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The virtual machine window will be now switched to <b>Scale</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in scaled mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to open the Extension Pack <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to install a VirtualBox extension pack. Extension packs complement the functionality of VirtualBox and can contain system level software that could be potentially harmful to your system. Please review the description below and only proceed if you have obtained the extension pack from a trusted source.</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%1< [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Extension packs complement the functionality of VirtualBox and can contain system level software that could be potentially harmful to your system. Please review the description below and only proceed if you have obtained the extension pack from a trusted source.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>An older version of the extension pack is already installed, would you like to upgrade? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>New Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Current Version:&nbsp;&nbsp;</b></td& [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Upgrade</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>An newer version of the extension pack is already installed, would you like to downgrade? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>New Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Current Version:&nbsp;&nbsp;</b></t [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Downgrade</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The extension pack is already installed with the same version, would you like reinstall it? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Description:&nbsp;&nbsp;</b></td>& [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Video Capture File</source>
-        <comment>details (display/video capture)</comment>
-        <translation>Bido Harpen Agiria</translation>
+        <source>&Reinstall</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Video Capture Attributes</source>
-        <comment>details (display/video capture)</comment>
-        <translation>Bideo Harpen Ezaugarriak</translation>
+        <source><p>You are about to remove the VirtualBox extension pack <b>%1</b>.</p><p>Are you sure you want to proceed?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>Frame Neurria: %1x%2, Frame Maila: %3fps-ko, Bit Maila: %4kbs-ko</translation>
+        <source>The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Video Capture</source>
-        <comment>details (display/video capture)</comment>
-        <translation>Bideo Harpena</translation>
+        <source><p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>Please check that the parent really exists and that you have permissions to create the machine folder.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Disabled</source>
-        <comment>details (display/video capture)</comment>
-        <translation>Ezgaituta</translation>
+        <source>Failed to register the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+75"/>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <source><p>The machine settings were changed while you were editing them. You currently have unsaved setting changes.</p><p>Would you like to reload the changed settings or to keep your own changes?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+72"/>
-        <source>Controller</source>
-        <comment>details (audio)</comment>
-        <translation>Kontrolatzailea</translation>
+        <source>Reload settings</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Disabled</source>
-        <comment>details (audio)</comment>
-        <translation>Ezgaituta</translation>
+        <source>Keep changes</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+94"/>
-        <source>NAT Network, '%1'</source>
-        <comment>details (network)</comment>
-        <translation>NAT Sarea, '%1'</translation>
+        <source>The virtual machine that you are changing has been started. Only certain settings can be changed while a machine is running. All other changes will be lost if you close this window now.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Adapter %1</source>
-        <comment>details (network)</comment>
-        <translation>Egokitzailea %1</translation>
+        <source>Failed to clone the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Disabled</source>
-        <comment>details (network/adapter)</comment>
-        <translation>Ezgaituta</translation>
+        <source>Create a snapshot of the current machine state</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+80"/>
-        <source>Port %1</source>
-        <comment>details (serial)</comment>
-        <translation>Ataka %1</translation>
+        <source><p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Disabled</source>
-        <comment>details (serial)</comment>
-        <translation>Ezgaituta</translation>
+        <source>Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might not be installed on the host computer</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+60"/>
-        <source>Port %1</source>
-        <comment>details (parallel)</comment>
-        <translation>Ataka %1</translation>
+        <source>VirtualBox is not currently allowed to access USB devices.  You can change this by adding your user to the 'vboxusers' group.  Please see the user manual for a more detailed explanation</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Disabled</source>
-        <comment>details (parallel)</comment>
-        <translation>Ezgaituta</translation>
+        <source>VirtualBox is not currently allowed to access USB devices.  You can change this by allowing your user to access the 'usbfs' folder and files.  Please see the user manual for a more detailed explanation</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+64"/>
-        <source>%1 (%2 active)</source>
-        <comment>details (usb)</comment>
-        <translation>%1 (%2 gaituta)</translation>
+        <source>The USB Proxy Service has not yet been ported to this host</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Disabled</source>
-        <comment>details (usb)</comment>
-        <translation>Ezgaituta</translation>
+        <source>Could not load the Host USB Proxy service</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+58"/>
-        <source>None</source>
-        <comment>details (shared folders)</comment>
-        <translation>Ezer ez</translation>
+        <source>Can't find snapshot named <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+55"/>
-        <source>None</source>
-        <comment>details (description)</comment>
-        <translation>Ezer ez</translation>
+        <source><p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p></source>
+        <translation type="obsolete"><p>Huts deskargatutako fitxategia <nobr><b>%1</b> bezala gordetzerakoan.</nobr></p></translation>
     </message>
     <message>
-        <location line="-904"/>
-        <source>Operating System</source>
-        <comment>details (general)</comment>
-        <translation>Sistema Eragilea</translation>
-    </message>
-    <message>
-        <location line="+23"/>
-        <location line="+195"/>
-        <location line="+100"/>
-        <location line="+88"/>
-        <location line="+63"/>
-        <location line="+108"/>
-        <location line="+85"/>
-        <location line="+65"/>
-        <location line="+70"/>
-        <location line="+55"/>
-        <location line="+55"/>
-        <source>Information Inaccessible</source>
-        <comment>details</comment>
-        <translation>Argibideak eskuraezin</translation>
+        <source><p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p><p>Do you wish to download latest one from the Internet?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-737"/>
-        <source>Base Memory</source>
-        <comment>details (system)</comment>
-        <translation>Ohinarri Oroimena</translation>
+        <source><p>Are you sure you want to download the <b><nobr>%1</nobr></b> from <nobr><a href="%2">%2</a></nobr> (size %3 bytes)?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source>Execution Cap</source>
-        <comment>details (system)</comment>
-        <translation>Exekuzio Muga</translation>
+        <source><p>The <b><nobr>%1</nobr></b> has been successfully downloaded from <nobr><a href="%2">%2</a></nobr> and saved locally as <nobr><b>%3</b>.</nobr></p><p>Do you wish to install this extension pack?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source>Boot Order</source>
-        <comment>details (system)</comment>
-        <translation>Abiarazpen Hurrenkera</translation>
+        <source>Install</source>
+        <comment>extension pack</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source>Nested Paging</source>
-        <comment>details (system)</comment>
-        <translation>Nested Orrialdeztapena</translation>
+        <source><p>The <b><nobr>%1</nobr></b> has been successfully downloaded from <nobr><a href="%2">%2</a></nobr> but can't be saved locally as <nobr><b>%3</b>.</nobr></p><p>Please choose another location for that file.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+59"/>
-        <source>Video Memory</source>
-        <comment>details (display)</comment>
-        <translation>Bideo Oroimena</translation>
+        <source><p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p><p>You should download and install version %3 of this extension pack from Oracle!</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>2D Video</source>
-        <comment>details (display)</comment>
-        <translation>2D Bideoa</translation>
+        <source><p>Failed to initialize COM because the VirtualBox global configuration directory <b><nobr>%1</nobr></b> is not accessible. Please check the permissions of this directory and of its parent directory.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source>Remote Desktop Server Port</source>
-        <comment>details (display/vrde)</comment>
-        <translation>Hurruneko Mahaigain Zerbitzari Ataka</translation>
+        <source><p>You are about to remove following virtual machine items from the machine list:</p><p><b>%1</b></p><p>Do you wish to proceed?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Remote Desktop Server</source>
-        <comment>details (display/vrde)</comment>
-        <translation>Hurruneko Mahaigain Zerbitzaria</translation>
+        <source><p>You are about to remove following inaccessible virtual machines from the machine list:</p><p>%1</p><p>Do you wish to proceed?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+106"/>
-        <source>Not Attached</source>
-        <comment>details (storage)</comment>
-        <translation>Erantsi gabe</translation>
+        <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well? Doing this will also remove the files containing the machine's virtual hard disks if they are not in use by another machine.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+54"/>
-        <source>Host Driver</source>
-        <comment>details (audio)</comment>
-        <translation>Hostalari Gidagailua</translation>
+        <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+75"/>
-        <source>Bridged Adapter, %1</source>
-        <comment>details (network)</comment>
-        <translation>Zubi egokitzailea, %1</translation>
+        <source>Do you wish to cancel all current network operations?</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Internal Network, '%1'</source>
-        <comment>details (network)</comment>
-        <translation>Barneko sarea, '%1'</translation>
+        <source>ACPI Shutdown</source>
+        <comment>machine</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Host-only Adapter, '%1'</source>
-        <comment>details (network)</comment>
-        <translation>Hostalaria-bakarrik Egokitzailea, '%1'</translation>
+        <source>Power Off</source>
+        <comment>machine</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Generic Driver, '%1'</source>
-        <comment>details (network)</comment>
-        <translation>Gidagailu generikoa, '%1'</translation>
+        <source><p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p><p>Please check that this folder really exists and that you have permissions to remove it.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Generic Driver, '%1' {&nbsp;%2&nbsp;}</source>
-        <comment>details (network)</comment>
-        <translation>Gidagailu generikoa, '%1' {&nbsp;%2&nbsp;}</translation>
+        <source><p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+234"/>
-        <source>Device Filters</source>
-        <comment>details (usb)</comment>
-        <translation>Gailu Iragakiak</translation>
+        <source>You are about to create a new virtual machine without a hard drive. You will not be able to install an operating system on the machine until you add one. In the mean time you will only be able to start the machine using a virtual optical disk or from the network.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>USB Controller Inaccessible</source>
-        <comment>details (usb)</comment>
-        <translation>USB Kontrolatzailea Eskuraezina</translation>
+        <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+53"/>
-        <source>Shared Folders</source>
-        <comment>details (shared folders)</comment>
-        <translation>Elkarbanatutako Agiritegiak</translation>
+        <source><p>Do you really want to reset the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGMachinePreview</name>
     <message>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="+276"/>
-        <source>Every 0.5 s</source>
-        <translation>0.5 seg-tik behin</translation>
+        <source><p>Do you really want to send an ACPI shutdown signal to the following virtual machines?</p><p><b>%1</b></p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Every 1 s</source>
-        <translation>1 seg-tik behin</translation>
+        <source><p>Do you really want to power off the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Every 2 s</source>
-        <translation>2 seg-tik behin</translation>
+        <source><p>You are trying to move machine <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p><p>Please resolve this name-conflict and try again.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Every 5 s</source>
-        <translation>5 seg-tik behin</translation>
+        <source><p>You are trying to move group <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p><p>Would you like to automatically rename it?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Every 10 s</source>
-        <translation>10 seg-tik behin</translation>
+        <source>Rename</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-5"/>
-        <source>Update disabled</source>
-        <translation>Eguneraketa ezgaituta</translation>
+        <source><p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p><p>You can create a snapshot of the current state of the virtual machine first by checking the box below; if you do not do this the current state will be permanently lost. Do you wish to proceed?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-154"/>
-        <source>No preview</source>
-        <translation>Ez dago aurreikuspenik</translation>
+        <source><p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p></source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsDisplay</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="+24"/>
-        <source>Maximum Guest Screen &Size:</source>
-        <translation>Geh. Gonbidatu Ikusleiho &Neurria:</translation>
+        <source>Failed to set groups of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+23"/>
-        <source>&Width:</source>
-        <translation>&Zabalera:</translation>
+        <source><p>Could not start the machine <b>%1</b> because the following physical network interfaces were not found:</p><p><b>%2</b></p><p>You can either change the machine's network settings or stop the machine.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Specifies the maximum width which we would like the guest to use.</source>
-        <translation>Gonbidatuak erabili dezan nahi dugun gehinezko zabalera adierazten du.</translation>
+        <source>Change Network Settings</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Height:</source>
-        <translation>&Garaiera:</translation>
+        <source>Close Virtual Machine</source>
+        <translation type="obsolete">Makina Birtuala Itxi</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Specifies the maximum height which we would like the guest to use.</source>
-        <translation>Gonbidatuak erabili dezan nahi dugun gehinezko garaiera adierazten du.</translation>
+        <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Machine Windows:</source>
+        <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+16"/>
-        <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
+        <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Raise Window Under Mouse</source>
+        <source>There is no virtual machine with the identifier <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.cpp" line="+182"/>
-        <source>Automatic</source>
-        <comment>Maximum Guest Screen Size</comment>
-        <translation>Berezgaitasunez</translation>
+        <source>Ignore</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Suggest a reasonable maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
-        <translation>Iradoki gonbidatuarentzako gehienezko ikusleiho neurri egoki bat. Gonbidatuak iradokizun hau gonbidatu gehigarriak ezarrita daudenean bakarrik ikusten du.</translation>
+        <source>Failed to create NAT network.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>None</source>
-        <comment>Maximum Guest Screen Size</comment>
-        <translation>Ezer ez</translation>
+        <source>Failed to remove NAT network <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Do not attempt to limit the size of the guest screen.</source>
-        <translation>Ez saiatu gonbidatu ikusleihoaren neurria mugatzen.</translation>
+        <source>Failed to create DHCP server.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Hint</source>
-        <comment>Maximum Guest Screen Size</comment>
+        <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Suggest a maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
-        <translation>Gonbidatuarentzako gehienezko ikusleiho neurria iradokitzendu. Gonbidatuak iradokizun hau gonbidatu gehigarriak ezarrita daudenean bakarrik ikusiko ditu.</translation>
+        <source>Failed to create the host network interface.</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsExtension</name>
     <message>
-        <source>&Extension Packages:</source>
-        <translation type="obsolete">&Hedapen Paketeak:</translation>
+        <source>Create &new disk</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.ui" line="+24"/>
-        <source>&Extension Packages</source>
-        <translation>&Hedapen Paketeak</translation>
+        <source>&Choose existing disk</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+31"/>
-        <source>Lists all installed packages.</source>
-        <translation>Ezarritako pakete guztiak zerrendatzen ditu.</translation>
+        <source>Leave &empty</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Active</source>
-        <translation>Gaituta</translation>
+        <source>&Choose disk</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Name</source>
-        <translation>Izena</translation>
+        <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Version</source>
-        <translation>Bertsioa</translation>
+        <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.cpp" line="+278"/>
-        <source>Add package</source>
-        <translation>Gehitu paketea</translation>
+        <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Remove package</source>
-        <translation>Kendu paketea</translation>
+        <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+40"/>
-        <source>Select an extension package file</source>
-        <translation>Hautatu hedapen pakete agiri bat</translation>
+        <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Extension package files (%1)</source>
-        <translation>Hedapen pakete agiriak (%1)</translation>
+        <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-124"/>
-        <location line="+211"/>
-        <source>Extensions</source>
-        <translation>Hedapenak</translation>
+        <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsGeneral</name>
     <message>
-        <source>Displays the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
-        <translation type="obsolete">Makina birtualaren berezko agiritegi helburua erakusten du. Agiritegi hau erabiltzen da, ez bada besterik adierazten, makina birtual berriak sortzerakoan.</translation>
+        <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
-        <translation type="obsolete">Hurruneko Erakuspen (VRDP) bezeroentzako egiaztapena hornitzen duen liburutegirako helburua erakusten du.</translation>
+        <source><p>Would you like to try to force insertion of this disk?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="+24"/>
-        <source>Default &Machine Folder:</source>
-        <translation>Berezko &Makina Agiritegia:</translation>
+        <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
+        <source><p>Would you like to try to force ejection of this disk?</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>V&RDP Authentication Library:</source>
-        <translation>V&RDP Egiaztapen Liburutegia:</translation>
+        <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
+        <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Dock and Menubar:</source>
-        <translation>&Uztarpena eta Menubarra:</translation>
+        <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>Berez-Erakutsi Ikusleiho-osoan</translation>
+        <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Hautatutakoan, hostalari uztarpena eta menu barra erakutsiko dira makina birtuala ikusleiho-osoko moduan dagoenean.</translation>
+        <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Host Screensaver:</source>
-        <translation>&Hostalari Ikusleiho-babeslea:</translation>
+        <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>Hautatutakoan, hostalari ikusleiho-babeslea ezgaitu egingo da makina birtuala ekinean dagoenean.</translation>
+        <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Disable When Running Virtual Machines</source>
-        <translation>Ezgaitu Makina Birtualak Ekinean daudenean</translation>
+        <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
     <message>
-        <source>When checked, the application will provide an icon with the context menu in the system tray.</source>
-        <translation type="obsolete">Hautatutakoan, aplikazioak ikur bat hornituko du hitzinguru menuarekin sistema erretiluan.</translation>
+        <source>Switch</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Show System Tray Icon</source>
-        <translation type="obsolete">&Erakutsi Sistema Erretilu Ikurra</translation>
+        <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Auto show Dock and Menubar in fullscreen</source>
-        <translation type="obsolete">&Berez erakutsi Uztarpen eta Menubarra ikusleiho-osoan</translation>
+        <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>When checked, the host screen saver will be disabled whenever a virtual machine is running.</source>
-        <translation type="obsolete">Hautatutakoan, hostalari ikusleiho babeslea ezgaitu egingo da makina birtual bat ekinean badago ere.</translation>
+        <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disable Host &ScreenSaver</source>
-        <translation type="obsolete">Ezgaitu Hostalari &Ikusleiho-Babeslea</translation>
+        <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsInput</name>
     <message>
-        <source>Host &Key:</source>
-        <translation type="obsolete">Hostalari &Tekla:</translation>
+        <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the key used as a Host Key in the VM window. Activate the entry field and press a new Host Key. Note that alphanumeric, cursor movement and editing keys cannot be used.</source>
-        <translation type="obsolete">Makina Birtualaren leihoan erabilitako Hostalari Tekla erakusten du. Gaitu sarrera eremua eta sakatu Hostalari Tekla berri bat. Ohartu ezin direla erabili hizkizenbakiak, kurtsore mugimenduak eta edizio teklak.</translation>
+        <source>Download</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.ui" line="+24"/>
-        <source>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</source>
-        <translation>Hautatutakoan, teklatua berezgaitasunez hartzen da Makina Birtualaren leihoa gaitzen den bakoitzean. Teklatua hartzen denan, tekla-sakatze guztiak (sistemaren Alt-Tab bezalakoak barne) MB-era zuzentzen dira.</translation>
+        <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Auto Capture Keyboard</source>
-        <translation>&Berez Hartu Teklatua</translation>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Reset host combination</source>
-        <translation type="obsolete">Berrezarri hostalari konbinazioa</translation>
+        <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Resets the key combination used as the host combination in the VM window.</source>
-        <translation type="obsolete">Makina Birtualeko leihoan hostalari konbinazio bezala erabiltako tekla konbinazioa berrezartzen du.</translation>
+        <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="+97"/>
-        <source>Host Key Combination</source>
-        <translation>Hostalari Tekla Konbinazioa</translation>
+        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+76"/>
-        <location line="+10"/>
-        <source>Some items have the same shortcuts assigned.</source>
-        <translation>Gai batzuek lartertekla berdinak dituzte esleituta.</translation>
+        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+23"/>
-        <source>&VirtualBox Manager</source>
-        <translation>&VirtualBox Kudeatzailea</translation>
+        <source>Close</source>
+        <translation type="unfinished">Itxi</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Virtual &Machine</source>
-        <translation>&Makina Birtuala</translation>
+        <source>Ok</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location line="+2"/>
-        <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Itxuratuak izan daitezkeen lastertekla guztiak zerrendatzen ditu.</translation>
+        <source>Do not show this message again</source>
+        <translation type="unfinished">Ez erakutsi mezu hau berriz</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location line="+1"/>
-        <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Sartu sekuentzia bat lastertekla zerrenda iragazteko.</translation>
+        <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsLanguage</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="+89"/>
-        <location line="+1"/>
-        <source> (built-in)</source>
-        <comment>Language</comment>
-        <translation> (barne-eraikita)</translation>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+26"/>
-        <source><unavailable></source>
-        <comment>Language</comment>
-        <translation><eskuraezina></translation>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source><unknown></source>
-        <comment>Author(s)</comment>
-        <translation><ezezaguna></translation>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Default</source>
-        <comment>Language</comment>
-        <translation>Berezkoa</translation>
+        <source>Insert</source>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+237"/>
-        <source>Language:</source>
-        <translation>Hizkuntza:</translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Interface Language:</source>
-        <translation type="obsolete">&Interfaze Hizkuntza:</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.ui" line="+24"/>
-        <source>&Interface Languages</source>
-        <translation>&Interfaze Hizkuntzak</translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Lists all available user interface languages. The effective language is written in <b>bold</b>. Select <i>Default</i> to reset to the system default language.</source>
-        <translation>Erabiltzaile interfaze hizkuntza eskuragarri guztien zerrenda. Gaitutako hizkuntza <b>lodiz</b> idatzita dago. Hautatu <i>Berezkoa</i> sistemaren berezko hizkuntzan berrezartzeko.</translation>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Name</source>
-        <translation>Izena</translation>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Id</source>
-        <translation>Id-a</translation>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Language</source>
-        <translation>Hizkuntza</translation>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Author</source>
-        <translation>Egilea</translation>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="+2"/>
-        <source>Author(s):</source>
-        <translation>Egilea(k):</translation>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsNetwork</name>
     <message>
-        <source>host IPv4 address of <b>%1</b> is wrong</source>
-        <translation type="obsolete"><b>%1</b>-ren hostalari IPv4 helbidea okerra da</translation>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>host IPv4 network mask of <b>%1</b> is wrong</source>
-        <translation type="obsolete"><b>%1</b>-ren hostalari IPv4 sare mozorroa okerra da</translation>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>host IPv6 address of <b>%1</b> is wrong</source>
-        <translation type="obsolete"><b>%1</b>-ren hostalari IPv6 helbidea okerra da</translation>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>DHCP server address of <b>%1</b> is wrong</source>
-        <translation type="obsolete"><b>%1</b>-ren DHCP zerbitzari helbidea okerra da</translation>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>DHCP server network mask of <b>%1</b> is wrong</source>
-        <translation type="obsolete"><b>%1</b>-ren DHCP zerbitzari sare mozorroa okerra da</translation>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>DHCP lower address bound of <b>%1</b> is wrong</source>
-        <translation type="obsolete"><b>%1</b>-ren DHCP behe helbide muga okerra da</translation>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>DHCP upper address bound of <b>%1</b> is wrong</source>
-        <translation type="obsolete"><b>%1</b>-ren DHCP goi helbide muga okerra da</translation>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="+130"/>
-        <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
+        <source>Bad password or authentication failure.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>No CIDR specified for the NAT network <b>%1</b>.</source>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
+        <source>Drag and drop operation from host to guest failed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+23"/>
-        <source>Network Name</source>
-        <translation>Sarearen Izena</translation>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>[empty]</source>
-        <translation>[hutsik]</translation>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>%1 (renamed from %2)</source>
-        <translation>%1 (%2-tik berrizendatua)</translation>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Old Network Name</source>
-        <translation>Sare Zaharraren Izena</translation>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIMiniProcessWidgetAdditions</name>
     <message>
-        <location line="+1"/>
-        <source>New Network Name</source>
-        <translation>Sare Berriaren Izena</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Network CIDR</source>
-        <translation>Sarearen CIDR</translation>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">Utzi VirtualBox Bezero Gehigarri CD irudi deskarga</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Supports DHCP</source>
-        <translation>DHCP sostengua du</translation>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete">VirtualBox Bezero Gehigarri CD irudia <nobr><b>%1</b>-etik deskargatzen...</nobr></translation>
     </message>
+</context>
+<context>
+    <name>UIMiniProcessWidgetUserManual</name>
     <message>
-        <location line="+1"/>
-        <location line="+2"/>
-        <location line="+2"/>
-        <source>yes</source>
-        <translation>bai</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
+</context>
+<context>
+    <name>UIMiniProgressWidgetAdditions</name>
     <message>
-        <location line="-4"/>
-        <location line="+2"/>
-        <source>no</source>
-        <translation>ez</translation>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">Utzi VirtualBox Bezero Gehigarri CD irudi deskarga</translation>
     </message>
     <message>
-        <location line="-1"/>
-        <source>Supports IPv6</source>
-        <translation>IPv6 sostengua du</translation>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete">VirtualBox Bezero Gehigarri CD irudia <nobr><b>%1</b>-etik deskargatzen...</nobr></translation>
     </message>
+</context>
+<context>
+    <name>UIMiniToolBar</name>
     <message>
-        <location line="+3"/>
-        <source>Default IPv6 route</source>
-        <translation>Berezko IPv6 biderapena</translation>
+        <source>Always show the toolbar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+45"/>
-        <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation><b>%1</b> hostalari interfazeak une honetan ez du IPv4 helbide baliozko bat.</translation>
+        <source>Minimize Window</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation><b>%1</b> hostalari interfazeak une honetan ez du IPv4 sare mozorro baliozko bat.</translation>
+        <source>Exit Full Screen or Seamless Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation><b>%1</b> hostalari interfazeak une honetan ez du IPv6 helbide baliozko bat.</translation>
+        <source>Close VM</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIMultiScreenLayout</name>
     <message>
-        <location line="+12"/>
-        <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation><b>%1</b> hostalari interfazeak une honetan ez du DHCP zerbitzari helbide baliozko bat.</translation>
+        <source>Virtual Screen %1</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation><b>%1</b> hostalari interfazeak une honetan ez du DHCP zerbitzari mozorro baliozko bat.</translation>
+        <source>Use Host Screen %1</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UINameAndSystemEditor</name>
     <message>
-        <location line="+6"/>
-        <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation><b>%1</b> hostalari interfazeak une honetan ez du DHCP zerbitzari barren helbide muga baliozko bat.</translation>
+        <source>N&ame:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation><b>%1</b> hostalari interfazeak une honetan ez du DHCP zerbitzari gain helbide muga baliozko bat.</translation>
+        <source>Holds the name of the virtual machine.</source>
+        <translation type="unfinished">Makina birtualaren izena bistaratzen du.</translation>
     </message>
     <message>
-        <location line="+18"/>
-        <source>Adapter</source>
-        <translation>Egokitzailea</translation>
+        <source>&Type:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Automatically configured</source>
-        <comment>interface</comment>
-        <translation>Berezgaitasunez itxuratuta</translation>
+        <source>Selects the operating system family that you plan to install into this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Manually configured</source>
-        <comment>interface</comment>
-        <translation>Eskuz itxuratuta</translation>
+        <source>&Version:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>IPv4 Address</source>
-        <translation>IPv4 Helbidea</translation>
+        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
+        <translation type="unfinished">Makina birtual honetan instalatzea pentsatzen duzun sistema eragilea erakusten du (sistema eragile bezeroa deiturikoa).</translation>
     </message>
+</context>
+<context>
+    <name>UINetworkManagerDialog</name>
     <message>
-        <location line="+2"/>
-        <location line="+10"/>
-        <location line="+18"/>
-        <source>Not set</source>
-        <comment>address</comment>
-        <translation>Ezarri gabe</translation>
+        <source>Network Operations Manager</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-26"/>
-        <source>IPv4 Network Mask</source>
-        <translation>IPv4 Sare Mozorroa</translation>
+        <source>There are no active network operations.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location line="+28"/>
-        <source>Not set</source>
-        <comment>mask</comment>
-        <translation>Ezarri gabe</translation>
+        <source>&Cancel All</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-24"/>
-        <source>IPv6 Address</source>
-        <translation>IPv6 Helbidea</translation>
+        <source>Cancel all active network operations</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>IPv6 Network Mask Length</source>
-        <translation>IPv6 Sare Mozorro Luzera</translation>
+        <source>Network Operation</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Not set</source>
-        <comment>length</comment>
-        <translation>Ezarri gabe</translation>
+        <source>Restart network operation</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>DHCP Server</source>
-        <translation>DHCP Zerbitzaria</translation>
+        <source>Cancel network operation</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Enabled</source>
-        <comment>server</comment>
-        <translation>Gaituta</translation>
+        <source>The network operation failed with the following error: %1.</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UINetworkManagerIndicator</name>
     <message>
-        <location line="+1"/>
-        <source>Disabled</source>
-        <comment>server</comment>
-        <translation>Ezgaituta</translation>
+        <source>Current network operations:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Address</source>
-        <translation>Helbidea</translation>
+        <source>failed</source>
+        <comment>network operation</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Network Mask</source>
-        <translation>Sare Mozorroa</translation>
+        <source>(%1 of %2)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Lower Bound</source>
-        <translation>Behe Muga</translation>
+        <source>Double-click for more information.</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UINetworkReplyPrivate</name>
     <message>
-        <location line="+2"/>
-        <location line="+4"/>
-        <source>Not set</source>
-        <comment>bound</comment>
-        <translation>Ezarri gabe</translation>
+        <source>Host not found</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-2"/>
-        <source>Upper Bound</source>
-        <translation>Goi Muga</translation>
+        <source>Content access denied</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+235"/>
-        <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation><b>%1</b> izena NAT sare ugarik erabiltzen dute.</translation>
+        <source>Protocol failure</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+50"/>
-        <source>Active</source>
-        <comment>NAT network</comment>
-        <translation>Gaituta</translation>
+        <source>Wrong SSL certificate format</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>&Add NAT network</source>
-        <translation>&Gehitu NAT sarea</translation>
+        <source>SSL authentication failed</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Remove NAT network</source>
-        <translation>&Kendu NAT sarea</translation>
+        <source>Unknown reason</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UINewHDWizard</name>
     <message>
-        <location line="+1"/>
-        <source>&Edit NAT network</source>
-        <translation>&Editatu NAT sarea</translation>
+        <source>Create New Virtual Disk</source>
+        <translation type="obsolete">Disko Birtual Berria Sortu</translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source>&Add host-only network</source>
-        <translation>&Gehitu hostalaria-bakarrik sarea</translation>
+        <source><p>This wizard will help you to create a new virtual hard disk image for your virtual machine.</p>
+<p>Use the <b>Next</b> button to go to the next page of the wizard
+and the <b>Back</b> button to return to the previous page.</p></source>
+        <translation type="obsolete"><p>Morroi honek zure makina birtualarentzat disko gogor birtual berriak sortzen lagunduko zaitu.</p>
+<p>Erabili <b>Hurrengoa</b> botoia morroiaren hurrengo orrialdera joateko
+eta <b>Atzera</b> botoia morroiaren aurreko orrialdera joateko.</p></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Remove host-only network</source>
-        <translation>&Kendu hostalaria-bakarrik sarea</translation>
+        <source>Welcome to the Create New Virtual Disk Wizard!</source>
+        <translation type="obsolete">Ongietorri Disko Gogor Birtual Berriak Sortzeko Morroira!</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Edit host-only network</source>
-        <translation>&Editatu hostalaria-bakarrik sarea</translation>
+        <source><p>Select the type of virtual hard disk image you want to create.</p>
+<p>A <b>dynamically expanding image</b> initially occupies a very small amount
+of space on your physical hard disk. It will grow dynamically (up to
+the size specified) as the Guest OS claims disk space.</p>
+<p>A <b>fixed-size image</b> does not grow. It is stored in a file of approximately
+the same size as the size of the virtual hard disk.</p></source>
+        <translation type="obsolete"><p>Hautatu sortu nahi duzun disko gogor birtual irudiaren mota.</p>
+<p>A <b>dinamikoki hedatzen</b> diren irudiek hasiera batetan disko
+gogorrean tamaina oso txikia artzen dute. Berau dinamikoki handituko
+da (ezarritako muga arte) bezero sistema eragileak lekua eskatzen
+duen eran.</p>
+<p><b>tamaina ezarritako irudiak</b> ez dira hazten, hauek disko
+gogor birtualaren antzeko tamaina batetako fitxategi batetan gordetzen dira.</p></translation>
     </message>
     <message>
-        <source>&Host-only Networks:</source>
-        <translation type="obsolete">&Hostalaria-bakarrik Sareak:</translation>
+        <source>Image Type</source>
+        <translation type="obsolete">Irudi Mota</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.ui" line="+22"/>
-        <source>&NAT Networks</source>
-        <translation>&NAT Sareak</translation>
+        <source>&Dynamically expanding image</source>
+        <translation type="obsolete">&Dinamikoki hedatzen den irudia</translation>
     </message>
     <message>
-        <location line="+24"/>
-        <source>Lists all available NAT networks.</source>
-        <translation>NAT sare eskuragarri guztiak zerrendatzen ditu.</translation>
+        <source>Alt+D</source>
+        <translation type="obsolete">Alt+D</translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source>&Host-only Networks</source>
-        <translation>&Hostalaria-bakarrik Sareak</translation>
+        <source>&Fixed-size image</source>
+        <translation type="obsolete">&Tamaina-ezarritako irudia</translation>
     </message>
     <message>
-        <location line="+24"/>
-        <source>Lists all available host-only networks.</source>
-        <translation>Eskuragarri dauden hostalaria-bakarrik sare guztiak zerrendatzen ditu.</translation>
+        <source>Alt+F</source>
+        <translation type="obsolete">Alt+T</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="-21"/>
-        <source>Name</source>
-        <translation>Izena</translation>
+        <source>Virtual Disk Image Type</source>
+        <translation type="obsolete">Disko Birtual Irudi Mota</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="+138"/>
-        <location line="+52"/>
-        <source>Networking</source>
-        <translation>Sareketa</translation>
+        <source><p>Press the <b>Select</b> button to select the location and name of the file
+to store the virtual hard disk image or type a file name in the entry field.</p></source>
+        <translation type="obsolete"><p>Sakatu <b>Hautatu</b> botoia disko gogor birtuala gordetzeko
+erabiliko den fitxategiaren kokaleku eta izena hautatu edo fitxategi izen bat idazteko sarrera eremuan.</p></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsNetworkDetails</name>
     <message>
-        <source>Host-only Network Details</source>
-        <translation type="obsolete">Hostalaria-bakarrik Sare Xehetasunak</translation>
+        <source>&Image File Name</source>
+        <translation type="obsolete">&Irudi Fitxategi Izena</translation>
     </message>
     <message>
-        <source>&Adapter</source>
-        <translation type="obsolete">&Egokitzailea</translation>
+        <source>Select</source>
+        <translation type="obsolete">Hautatu</translation>
     </message>
     <message>
-        <source>Manual &Configuration</source>
-        <translation type="obsolete">Eskuz &Itxurapena</translation>
+        <source><p>Select the size of the virtual hard disk image in megabytes. This size will be reported to the Guest OS
+as the size of the virtual hard disk.</p></source>
+        <translation type="obsolete"><p>Hautatu disko birtual irudi tamaina megabyte-tan. Tamaina hau SE ostalariari emango zaio
+disko gogor birtual tamaina bezala</p></translation>
     </message>
     <message>
-        <source>Use manual configuration for this host-only network adapter.</source>
-        <translation type="obsolete">Erabili eskuzko itxurapena hostalaria-bakarrik sare egokitzaile honentzat.</translation>
+        <source>Image &Size</source>
+        <translation type="obsolete">Irudi &Tamaina</translation>
     </message>
     <message>
-        <source>&IPv4 Address:</source>
-        <translation type="obsolete">&IPv4 Helbidea:</translation>
+        <source>Virtual Disk Location and Size</source>
+        <translation type="obsolete">Disko Birtual Kokapen eta Tamaina</translation>
     </message>
     <message>
-        <source>Displays the host IPv4 address for this adapter.</source>
-        <translation type="obsolete">Hostalariaren IPv4 helbidea erakusten du egokitzaile honentzat.</translation>
+        <source>You are going to create a new virtual hard disk image with the following parameters:</source>
+        <translation type="obsolete">Hurrengo parametroak erabiliaz disko gogor birtual bat sortzera zoaz:</translation>
     </message>
     <message>
-        <source>IPv4 Network &Mask:</source>
-        <translation type="obsolete">IPv4 Sare &Mozorroa:</translation>
+        <source>If the above settings are correct, press the <b>Finish</b> button.
+                            Once you press it, a new hard disk image will be created.
+                            </source>
+        <translation type="obsolete">Aurreko ezarpen guztiak zuzenak badira, sakatu <b>Amaitu</b> botoia.
+                            Behin sakatu duzunean, disko irudi berria sortuko da.
+                            </translation>
     </message>
     <message>
-        <source>Displays the host IPv4 network mask for this adapter.</source>
-        <translation type="obsolete">Hostalariaren IPv4 sare mozorroa erakusten du egokitzaile honentzat.</translation>
+        <source>Summary</source>
+        <translation type="obsolete">Laburpena</translation>
     </message>
     <message>
-        <source>I&Pv6 Address:</source>
-        <translation type="obsolete">I&Pv6 Helbidea:</translation>
+        <source><nobr>%1 Bytes</nobr></source>
+        <translation type="obsolete"><nobr>%1 Byte</nobr></translation>
     </message>
     <message>
-        <source>Displays the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation type="obsolete">Hostalariaren IPv6 helbidea erakusten du egokitzaile honentzat IPv6 sostengatzen bada.</translation>
+        <source><table><tr><td>Type:</td><td>%1</td></tr><tr><td>Location:</td><td>%2</td></tr><tr><td>Size:</td><td>%3&nbsp;(%4&nbsp;Bytes)</td></tr></table></source>
+        <translation type="obsolete"><table><tr><td>Mota:</td><td>%1</td></tr><tr><td>Kokapena:</td><td>%2</td></tr><tr><td>Tamaina:</td><td>%3&nbsp;(%4&nbsp;Byte)</td></tr></table></translation>
     </message>
     <message>
-        <source>IPv6 Network Mask &Length:</source>
-        <translation type="obsolete">IPv6 Sare Mozorro &Luzera:</translation>
+        <source>Hard disk images (*.vdi)</source>
+        <translation type="obsolete">Disko gogor irudiak (*.vdi)</translation>
     </message>
     <message>
-        <source>Displays the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation type="obsolete">Hostalariaren IPv6 sare mozorroa erakusten du egokitzaile honentzat IPv6 sostengatzen bada.</translation>
+        <source>Select a file for the new hard disk image file</source>
+        <translation type="obsolete">Hautatu fitxategi bat disko gogor berriaren irudi fitxategiarentzat</translation>
     </message>
     <message>
-        <source>&DHCP Server</source>
-        <translation type="obsolete">&DHCP Zerbitzaria</translation>
+        <source>Location</source>
+        <comment>summary</comment>
+        <translation type="obsolete">Kokalekuak</translation>
     </message>
     <message>
-        <source>&Enable Server</source>
-        <translation type="obsolete">&Gaitu Zerbitzaria</translation>
+        <source>Size</source>
+        <comment>summary</comment>
+        <translation type="obsolete">Tamaina</translation>
     </message>
     <message>
-        <source>Server Add&ress:</source>
-        <translation type="obsolete">Zerbitzari &Helbidea:</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
     <message>
-        <source>Server &Mask:</source>
-        <translation type="obsolete">Zerbitzari &Mozorroa:</translation>
+        <source>Storage Type</source>
+        <translation type="obsolete">Biltegiratze Mota</translation>
     </message>
+</context>
+<context>
+    <name>UINewHDWizardPageWelcome</name>
     <message>
-        <source>&Lower Address Bound:</source>
-        <translation type="obsolete">&Behe Helbide Muga:</translation>
+        <source>Welcome to the Create New Virtual Disk Wizard!</source>
+        <translation type="obsolete">Ongietorri Disko Gogor Birtual Berriak Sortzeko Morroira!</translation>
     </message>
+</context>
+<context>
+    <name>UINewHDWzdPage2</name>
     <message>
-        <source>&Upper Address Bound:</source>
-        <translation type="obsolete">&Goi Helbide Muga:</translation>
+        <source>Storage Type</source>
+        <translation type="obsolete">Biltegiratze Mota</translation>
     </message>
 </context>
 <context>
-    <name>UIGlobalSettingsNetworkDetailsHost</name>
+    <name>UINewHDWzdPage3</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="+26"/>
-        <source>Host-only Network Details</source>
-        <translation>Hostalaria-bakarrik Sare Xehetasunak</translation>
+        <source>Virtual Disk Location and Size</source>
+        <translation type="obsolete">Disko Birtual Kokapen eta Tamaina</translation>
     </message>
     <message>
-        <location line="+16"/>
-        <source>&Adapter</source>
-        <translation>&Egokitzailea</translation>
+        <source>Select a file for the new hard disk image file</source>
+        <translation type="obsolete">Hautatu fitxategi bat disko gogor berriaren irudi fitxategiarentzat</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Manual &Configuration</source>
-        <translation>Eskuzko &Itxurapena</translation>
+        <source>Hard disk images (*.vdi)</source>
+        <translation type="obsolete">Disko gogor irudiak (*.vdi)</translation>
     </message>
+</context>
+<context>
+    <name>UINewHDWzdPage4</name>
     <message>
-        <location line="+6"/>
-        <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>Erabili eskuzko itxurapena hostalaria-bakarrik sare egokitzaile honentzat.</translation>
+        <source>Summary</source>
+        <translation type="obsolete">Laburpena</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&IPv4 Address:</source>
-        <translation>&IPv4 Helbidea:</translation>
+        <source>Location</source>
+        <comment>summary</comment>
+        <translation type="obsolete">Kokalekuak</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the host IPv4 address for this adapter.</source>
-        <translation type="unfinished"></translation>
+        <source>Size</source>
+        <comment>summary</comment>
+        <translation type="obsolete">Tamaina</translation>
     </message>
+</context>
+<context>
+    <name>UINewVMWzd</name>
     <message>
-        <location line="+7"/>
-        <source>IPv4 Network &Mask:</source>
-        <translation>IPv4 Sare &Mozorroa:</translation>
+        <source>Create New Virtual Machine</source>
+        <translation type="obsolete">Makina Birtual Berria Sortu</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation type="unfinished"></translation>
+        <source><p>This wizard will guide you through the steps that are necessary to create
+a new virtual machine for VirtualBox.</p>
+<p>Use the <b>Next</b> button to go the next page of the wizard
+and the <b>Back</b> button to return to the previous page.</p></source>
+        <translation type="obsolete"><p>Morroi honek VirtualBox-rentzat makina birtual berriak sortzeko egin
+beharreko huratsetan algunduko zaitu.</p>
+<p>Erabili <b>Hurrengoa</b> botoia morroiaren hurrengo orrialdera joateko
+eta <b>Atzera</b> botoia morroiaren aurreko orrialdera joateko.</p></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>I&Pv6 Address:</source>
-        <translation>I&Pv6 Helbidea:</translation>
+        <source>Welcome to the New Virtual Machine Wizard!</source>
+        <translation type="obsolete">Ongietorri Makina Birtual Berriak Sortzeko Morroira!</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation type="unfinished"></translation>
+        <source><p>Enter a name for the new virtual machine and select the type of the guest operating
+system you plan to install onto the virtual machine.</p>
+<p>The name of the virtual machine usually indicates its software and hardware configuration.
+It will be used by all VirtualBox components to identify your virtual machine.</p></source>
+        <translation type="obsolete"><p>Idatzi makina birtual berriaren izena eta makina horretan instalatzea
+pentsatzen duzun sistema eragile mota hautatu</p>
+ <p>Makina birtualaren izenak normalean duen software eta hardware konfigurazioa erakusten du.
+Hau VirtualBox-ek zure makina birtuala identifikatzeko erabiliko du.</p></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>IPv6 Network Mask &Length:</source>
-        <translation>IPv6 Sare Mozorro &Luzera:</translation>
+        <source>N&ame</source>
+        <translation type="obsolete">Izen&a</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation type="unfinished"></translation>
+        <source>OS &Type</source>
+        <translation type="obsolete">SE mo&ta</translation>
     </message>
     <message>
-        <location line="+21"/>
-        <source>&DHCP Server</source>
-        <translation>&DHCP Zerbitzaria</translation>
+        <source>VM Name and OS Type</source>
+        <translation type="obsolete">MB Izena SE Mota</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>&Enable Server</source>
-        <translation>&Gaitu Zerbitzaria</translation>
+        <source><p>Select the amount of base memory (RAM) in megabytes to be allocated to the virtual machine.</p></source>
+        <translation type="obsolete"><p>Hautatu makina birtualak esleituko duen oinarri memoria (RAM) kopurua.</p></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation type="unfinished"></translation>
+        <source>Base &Memory Size</source>
+        <translation type="obsolete">Oinarri &Memoria Tamaina</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Server Add&ress:</source>
-        <translation>Zerbitzari &Helbidea:</translation>
+        <source><</source>
+        <translation type="obsolete"><</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished"></translation>
+        <source>=</source>
+        <translation type="obsolete">=</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Server &Mask:</source>
-        <translation>Zerbitzari &Mozorroa:</translation>
+        <source>></source>
+        <translation type="obsolete">></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished"></translation>
+        <source>MB</source>
+        <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Lower Address Bound:</source>
-        <translation>&Behe Helbide Muga:</translation>
+        <source>Memory</source>
+        <translation type="obsolete">Memoria</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished"></translation>
+        <source><p>Select a hard disk image to be used
+as the boot hard disk of the virtual machine. You can either create a new hard
+disk using the <b>New</b> button or select an existing hard disk
+image from the drop-down list or by pressing the <b>Existing</b>
+button (to invoke the Virtual Disk Manager window).</p>
+<p>If you need a more complicated hard disk setup, you can also skip this
+step and attach hard disks later using the VM Settings dialog.</p></source>
+        <translation type="obsolete"><p>Hautatu makina birtualak abio disko gogor bezala
+erabiliko duen disko gogor irudia. Edo <b>Berria</b> botoia sakatuaz
+disko gogor berri bat sortu edo hautapen zerrendatik irudi bat hautatu
+<b>Dagoena</b> botoia sakatuaz (Disko Gogor Kudeatzaile irekiaz).</p>
+<p>Disko gogor konfigurazio hedatuago bat behar izanez gero, urrats
+hau albo batetara utzi eta beranduago MB ezarpen leiho erabiliaz disko
+gogorrak erantsi ditzakezu.</p></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Upper Address Bound:</source>
-        <translation>&Goi Helbide Muga:</translation>
+        <source>B&oot Hard Disk (Primary Master)</source>
+        <translation type="obsolete">Abi&o Disko Gogorra (Lehen Mailako Maisua)</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished"></translation>
+        <source>N&ew...</source>
+        <translation type="obsolete">&Berria...</translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="+18"/>
-        <source>NAT Network Details</source>
-        <translation>NAT Sare Xehetasunak</translation>
+        <source>E&xisting...</source>
+        <translation type="obsolete">Da&goena...</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>&Enable Network</source>
-        <translation>&Gaitu Sarea</translation>
+        <source>Virtual Hard Disk</source>
+        <translation type="obsolete">Disko Gogor Birtuala</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable this NAT network.</source>
-        <translation>Gaitu NAT sare hau.</translation>
+        <source>
+                            <p>
+                            You are going to create a new virtual machine
+                            with the following parameters:
+                            </p>
+                            </source>
+        <translation type="obsolete">
+                            <p>
+                            Hurrengo ezarpenekin makina birtual berri bat
+                            sortzera zoaz:
+                            </p>
+                            </translation>
     </message>
     <message>
-        <location line="+26"/>
-        <source>Network &Name:</source>
-        <translation>Sare &Izena:</translation>
+        <source>
+                            <p>
+                            If the above is correct press the <b>Finish</b> button.
+                            Once you press it, a new virtual machine will be created.
+                            </p><p>
+                            Note that you can alter these and all other setting of the
+                            created virtual machine at any time using the
+                            <b>Settings</b> dialog accessible through
+                            the menu of the main window.
+                            </p>
+                            </source>
+        <translation type="obsolete">
+                            <p>
+                            Aurrekoa zuzena bada sakatu  <b>Amaitu</b> botoia.
+                            Bein botoia sakatu duzunean makina birtual berria sortuko da.
+                            </p><p>
+                            Kontutan izan ezarpen hauek eta beste batzuk edozein unetan
+                            menu nagusiko <b>Ezarpenak</b> aukeraren bidez aldatu ditzakezula
+                            </p>
+                            </translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Holds the name for this network.</source>
-        <translation type="unfinished"></translation>
+        <source>Summary</source>
+        <translation type="obsolete">Laburpena</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Network &CIDR:</source>
-        <translation>Sare &CIDR:</translation>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Holds the CIDR for this network.</source>
-        <translation type="unfinished"></translation>
+        <source><tr><td>Name:</td><td>%1</td></tr><tr><td>OS Type:</td><td>%2</td></tr><tr><td>Base Memory:</td><td>%3&nbsp;MB</td></tr></source>
+        <translation type="obsolete"><tr><td>Izena:</td><td>%1</td></tr><tr><td>SE Mota:</td><td>%2</td></tr><tr><td>Oinarri Memoria:</td><td>%3&nbsp;MB</td></tr></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Network Options:</source>
-        <translation>Sare Aukerak:</translation>
+        <source><tr><td>Start-up Disk:</td><td>%4</td></tr></source>
+        <translation type="obsolete"><tr><td>Abio Disko Gogorra:</td><td>%4</td></tr></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Supports &DHCP</source>
-        <translation>&DHCP sostengua du</translation>
+        <source>The recommended base memory size is <b>%1</b> MB.</source>
+        <translation type="obsolete">Gomendatutako oinarri memoria <b>%1</b> MB-eko da.</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Determines whether this network supports DHCP.</source>
-        <translation type="unfinished"></translation>
+        <source>The recommended size of the start-up disk is <b>%1</b> MB.</source>
+        <translation type="obsolete">Abio diskoaren gomendatutako tamaina <b>%1</b> MB da.</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Supports &IPv6</source>
-        <translation>&IPv6 sostengua du</translation>
+        <source>MB</source>
+        <comment>megabytes</comment>
+        <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Determines whether this network supports IPv6.</source>
-        <translation type="unfinished"></translation>
+        <source>Name</source>
+        <comment>summary</comment>
+        <translation type="obsolete">Izena</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Advertise Default IPv6 &Route</source>
-        <translation type="unfinished"></translation>
+        <source>OS Type</source>
+        <comment>summary</comment>
+        <translation type="obsolete">SE mota</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation type="unfinished"></translation>
+        <source>Base Memory</source>
+        <comment>summary</comment>
+        <translation type="obsolete">Oinarri Memoria</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Bidalketa ataka arauak kudeatzeko leiho bat irekitzen du.</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
+</context>
+<context>
+    <name>UINewVMWzdPage1</name>
     <message>
-        <location line="+3"/>
-        <source>&Port Forwarding</source>
-        <translation>&Bidalketa Ataka</translation>
+        <source>Welcome to the New Virtual Machine Wizard!</source>
+        <translation type="obsolete">Ongietorri Makina Birtual Berriak Sortzeko Morroira!</translation>
     </message>
 </context>
 <context>
-    <name>UIGlobalSettingsPortForwardingDlg</name>
+    <name>UINewVMWzdPage2</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp" line="+103"/>
-        <source>Port Forwarding Rules</source>
-        <translation>Bidalketa Ataka Arauak</translation>
+        <source>N&ame</source>
+        <translation type="obsolete">Izen&a</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>IPv4</source>
-        <translation>IPv4</translation>
+        <source>OS &Type</source>
+        <translation type="obsolete">SE mo&ta</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>IPv6</source>
-        <translation>IPv6</translation>
+        <source>VM Name and OS Type</source>
+        <translation type="obsolete">MB Izena SE Mota</translation>
     </message>
 </context>
 <context>
-    <name>UIGlobalSettingsProxy</name>
+    <name>UINewVMWzdPage3</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.ui" line="+24"/>
-        <source>When checked, VirtualBox will use the proxy settings supplied for tasks like downloading Guest Additions from the network or checking for updates.</source>
-        <translation type="unfinished"></translation>
+        <source><p>Select the amount of base memory (RAM) in megabytes to be allocated to the virtual machine.</p></source>
+        <translation type="obsolete"><p>Hautatu makina birtualak esleituko duen oinarri memoria (RAM) kopurua.</p></translation>
     </message>
     <message>
-        <source>&Enable proxy</source>
-        <translation type="obsolete">&Gaitu proxya</translation>
+        <source>Base &Memory Size</source>
+        <translation type="obsolete">Oinarri &Memoria Tamaina</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Enable Proxy</source>
-        <translation>&Gaitu Proxya</translation>
+        <source>MB</source>
+        <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location line="+35"/>
-        <source>Ho&st:</source>
-        <translation>&Hostalaria:</translation>
+        <source>Memory</source>
+        <translation type="obsolete">Memoria</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Changes the proxy host.</source>
-        <translation>Proxy hostalaria aldatzen du.</translation>
+        <source>The recommended base memory size is <b>%1</b> MB.</source>
+        <translation type="obsolete">Gomendatutako oinarri memoria <b>%1</b> MB-eko da.</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Port:</source>
-        <translation>&Ataka:</translation>
+        <source>MB</source>
+        <comment>size suffix MBytes=1024 KBytes</comment>
+        <translation type="obsolete">MB</translation>
     </message>
+</context>
+<context>
+    <name>UINewVMWzdPage4</name>
     <message>
-        <location line="+13"/>
-        <source>Changes the proxy port.</source>
-        <translation>Proxy ataka aldatzen du.</translation>
+        <source>Virtual Hard Disk</source>
+        <translation type="obsolete">Disko Gogor Birtuala</translation>
     </message>
     <message>
-        <source>&Use authentication</source>
-        <translation type="obsolete">&Erabili egiaztapena</translation>
+        <source>The recommended size of the start-up disk is <b>%1</b> MB.</source>
+        <translation type="obsolete">Abio diskoaren gomendatutako tamaina <b>%1</b> MB da.</translation>
     </message>
+</context>
+<context>
+    <name>UINewVMWzdPage5</name>
     <message>
-        <source>User &name:</source>
-        <translation type="obsolete">&Erabiltzaile izena:</translation>
+        <source>Summary</source>
+        <translation type="obsolete">Laburpena</translation>
     </message>
     <message>
-        <source>Changes the user name used for authentication.</source>
-        <translation type="obsolete">Egiaztapenerako erabilitako erabiltzaile izena aldatzen du.</translation>
+        <source>Name</source>
+        <comment>summary</comment>
+        <translation type="obsolete">Izena</translation>
     </message>
     <message>
-        <source>Pass&word:</source>
-        <translation type="obsolete">&Sarhitza:</translation>
+        <source>OS Type</source>
+        <comment>summary</comment>
+        <translation type="obsolete">SE mota</translation>
     </message>
     <message>
-        <source>Changes the password used for authentication.</source>
-        <translation type="obsolete">Egiaztapenerako erabilitako sarhitza aldatzen du.</translation>
+        <source>Base Memory</source>
+        <comment>summary</comment>
+        <translation type="obsolete">Oinarri Memoria</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.cpp" line="+121"/>
-        <source>No proxy host is currently specified.</source>
-        <translation>Ez dago proxy hostalaririk adierazita.</translation>
+        <source>MB</source>
+        <comment>size suffix MBytes=1024KBytes</comment>
+        <translation type="obsolete">MB</translation>
     </message>
+</context>
+<context>
+    <name>UIPopupCenter</name>
     <message>
-        <location line="+7"/>
-        <source>No proxy port is currently specified.</source>
-        <translation>Ez dago proxy atakarik adierazita.</translation>
+        <source>Click for full details</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIGlobalSettingsUpdate</name>
+    <name>UIPortForwardingModel</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="+24"/>
-        <source>When checked, the application will periodically connect to the VirtualBox website and check whether a new VirtualBox version is available.</source>
+        <source>Name</source>
+        <translation type="unfinished">Izena</translation>
+    </message>
+    <message>
+        <source>Protocol</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Check for updates</source>
-        <translation type="obsolete">&Egiaztatu eguneraketak</translation>
+        <source>Host IP</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Check for Updates</source>
-        <translation>&Egiaztatu Eguneraketarik dagoen</translation>
+        <source>Host Port</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+29"/>
-        <source>&Once per:</source>
-        <translation>&Behin:</translation>
+        <source>Guest IP</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+15"/>
-        <source>Specifies how often the new version check should be performed. Note that if you want to completely disable this check, just clear the above check box.</source>
+        <source>Guest Port</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIProgressDialog</name>
     <message>
-        <location line="+28"/>
-        <source>Next Check:</source>
-        <translation>Hurrengo Egiaztapena:</translation>
+        <source>A few seconds remaining</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Check for:</source>
-        <translation>Egiaztatu hau:</translation>
+        <source>Canceling...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>Choose this if you only wish to be notified about stable updates to VirtualBox.</p></source>
-        <translation><p>Hautatu hau VirtualBox eguneraketa egonkorren jakinarazpena jasotzea nahi baduzu.</p></translation>
+        <source>&Cancel</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Stable Release Versions</source>
-        <translation>&Argitalpen Egonkor Bertsioak</translation>
+        <source>Cancel the current operation</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>&All New Releases</source>
-        <translation>Argitalpen &Berri Guztiak</translation>
+        <source>%1, %2 remaining</source>
+        <comment>You may wish to translate this more like "Time remaining: %1, %2"</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>All New Releases and &Pre-Releases</source>
-        <translation>Argitalpen Berri eta &Aurre-Argitapen Guztiak</translation>
+        <source>%1 remaining</source>
+        <comment>You may wish to translate this more like "Time remaining: %1"</comment>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UISelectorWindow</name>
     <message>
-        <source>&Stable release versions</source>
-        <translation type="obsolete">&Bertsio egonkor agirtalpenak</translation>
+        <source>Show Toolbar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-13"/>
-        <source><p>Choose this if you wish to be notified about all new VirtualBox releases.</p></source>
-        <translation><p>Hautatu hau VirtualBox argitalpen berri guztien jakinarazpena jasotzea nahi baduzu.</p></translation>
+        <source>Show Statusbar</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&All new releases</source>
-        <translation type="obsolete">&Argitalpen berri guztiak</translation>
+        <source>Select a virtual machine file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>Choose this to be notified about all new VirtualBox releases and pre-release versions of VirtualBox.</p></source>
-        <translation><p>Hautatu hau VirtualBox argitalpen eta aurre-argitalpen berri guztien jakinarazpena jasotzea nahi baduzu.</p></translation>
+        <source>Virtual machine files (%1)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>All new releases and &pre-releases</source>
-        <translation type="obsolete">&Argitalpen berri eta aurre-argitalpen guztiak</translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Ongietorri VirtualBox-era!</h3><p>Leiho honen ezkerreko zatian ordenagailu honetako makina birtual guztiak daude. Zerrenda orain hutsik dago oraindik ez duzu makina birtualik sortu eta.<img src=:/welcome.png align=right/></p><p>Makina berri bat sortzeko sakatu <b>Berria</b> botoia leihoaren goialdeko tresna-barran nagusian.</p><p><b>%1</b> tekla sakatu dezakezu laguntza eskura [...]
     </message>
-</context>
-<context>
-    <name>UIHelpButton</name>
     <message>
-        <location filename="../src/widgets/UISpecialControls.cpp" line="+173"/>
-        <source>&Help</source>
-        <translation>&Laguntza</translation>
+        <source>Manager</source>
+        <comment>Note: main window title which is pretended by the product name.</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIHostComboEditor</name>
+    <name>UISession</name>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="+103"/>
-        <location line="+14"/>
-        <source><key_%1></source>
-        <translation><key_%1></translation>
+        <source>Updating Guest Additions</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UISettingsDialog</name>
     <message>
-        <location line="+12"/>
-        <source>Left </source>
-        <translation>Ezker </translation>
+        <source><i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information.</i></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Right </source>
-        <translation>Eskuin </translation>
+        <source>Invalid settings detected</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+115"/>
-        <source>Left Shift</source>
-        <translation>Ezkerreko Aldatu</translation>
+        <source>Settings</source>
+        <translation type="obsolete">Ezarpenak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Right Shift</source>
-        <translation>Eskuineko Aldatu</translation>
+        <source><b>%1</b> page:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Left Ctrl</source>
-        <translation>Ezkerreko Ktrl</translation>
+        <source><b>%1: %2</b> page:</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UISettingsDialogGlobal</name>
     <message>
-        <location line="+1"/>
-        <source>Right Ctrl</source>
-        <translation>Eskuineko Ktrl</translation>
+        <source>General</source>
+        <translation type="unfinished">Orokorra</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Left Alt</source>
-        <translation>Ezkerreko Alt</translation>
+        <source>Input</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Right Alt</source>
-        <translation>Eskuineko Alt</translation>
+        <source>Update</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Left WinKey</source>
-        <translation>Ezkerreko Win-Tekla</translation>
+        <source>Language</source>
+        <translation type="unfinished"> Hizkuntza </translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Right WinKey</source>
-        <translation>Eskuineko Win-Tekla</translation>
+        <source>USB</source>
+        <translation type="obsolete">USB</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Menu key</source>
-        <translation>Menu tekla</translation>
+        <source>Network</source>
+        <translation type="unfinished">Sarea</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Alt Gr</source>
-        <translation>Alt Gr</translation>
+        <source>Extensions</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Caps Lock</source>
-        <translation>Larri Blokeoa</translation>
+        <source>VirtualBox - %1</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Scroll Lock</source>
-        <translation>Irristari Blokeoa</translation>
+        <source>Proxy</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+17"/>
-        <source>Host+</source>
-        <translation>Host+</translation>
+        <source>Display</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+15"/>
-        <location line="+440"/>
-        <source>None</source>
-        <translation>Ezer ez</translation>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIHotKeyEditor</name>
-    <message>
-        <source>Left </source>
-        <translation type="obsolete">Ezker </translation>
-    </message>
+    <name>UISettingsDialogMachine</name>
     <message>
-        <source>Right </source>
-        <translation type="obsolete">Eskuin </translation>
+        <source>General</source>
+        <translation type="unfinished">Orokorra</translation>
     </message>
     <message>
-        <source>Right Alt</source>
-        <translation type="obsolete">Eskuineko Alt</translation>
+        <source>System</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Left WinKey</source>
-        <translation type="obsolete">Ezker Win-Tekla</translation>
+        <source>Display</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Right WinKey</source>
-        <translation type="obsolete">Eskuineko Win-Tekla</translation>
+        <source>Storage</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Menu key</source>
-        <translation type="obsolete">Menu tekla</translation>
+        <source>Audio</source>
+        <translation type="unfinished">Audioa</translation>
     </message>
     <message>
-        <source>Alt Gr</source>
-        <translation type="obsolete">Alt Gr</translation>
+        <source>Network</source>
+        <translation type="unfinished">Sarea</translation>
     </message>
     <message>
-        <source>Caps Lock</source>
-        <translation type="obsolete">Larri Blokeoa</translation>
+        <source>Ports</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Scroll Lock</source>
-        <translation type="obsolete">Irristari Blokeoa</translation>
+        <source>Serial Ports</source>
+        <translation type="unfinished">Serie Atakak</translation>
     </message>
     <message>
-        <source><key_%1></source>
-        <translation type="obsolete"><key_%1></translation>
+        <source>Parallel Ports</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>None</source>
-        <translation type="obsolete">Ezer ez</translation>
+        <source>USB</source>
+        <translation type="unfinished">USB</translation>
     </message>
     <message>
-        <source>Left Shift</source>
-        <translation type="obsolete">Ezker Aldatu</translation>
+        <source>Shared Folders</source>
+        <translation type="unfinished">Partekatutako Karpetak</translation>
     </message>
     <message>
-        <source>Right Shift</source>
-        <translation type="obsolete">Eskuineko Aldatu</translation>
+        <source>%1 - %2</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Left Ctrl</source>
-        <translation type="obsolete">Ezker Ktrl</translation>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Right Ctrl</source>
-        <translation type="obsolete">Eskuineko Ktrl</translation>
+        <source>Settings</source>
+        <translation type="unfinished">Ezarpenak</translation>
     </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
     <message>
-        <source>Left Alt</source>
-        <translation type="obsolete">Ezker Alt</translation>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-366"/>
-        <location filename="../src/widgets/UIHotKeyEditor.cpp" line="+173"/>
-        <source>Unset shortcut</source>
-        <translation>Desezarri lastertekla</translation>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
     <message>
-        <location filename="../src/widgets/UIHotKeyEditor.cpp" line="-1"/>
-        <source>Reset shortcut to default</source>
-        <translation>Berrezarri lastertekla berezkoan</translation>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIHotKeyTableModel</name>
+    <name>UIStatusBarEditorWidget</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="+118"/>
-        <source>Name</source>
-        <translation>Izena</translation>
+        <source>Close</source>
+        <translation type="unfinished">Itxi</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Shortcut</source>
-        <translation>Lastertekla</translation>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIImportLicenseViewer</name>
+    <name>UITextEditor</name>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="+117"/>
-        <source><b>The virtual system "%1" requires that you agree to the terms and conditions of the software license agreement shown below.</b><br /><br />Click <b>Agree</b> to continue or click <b>Disagree</b> to cancel the import.</source>
+        <source>Edit text</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-2"/>
-        <source>Software License Agreement</source>
-        <translation>Software Baimen Ituna</translation>
+        <source>&Replace...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>&Disagree</source>
-        <translation>&Ez Onartu</translation>
+        <source>Replaces the current text with the content of a file.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Agree</source>
-        <translation>&Onartu</translation>
+        <source>Text (*.txt);;All (*.*)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Print...</source>
-        <translation>Ir&arkitu...</translation>
+        <source>Select a file to open...</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIUpdateManager</name>
     <message>
-        <location line="+1"/>
-        <source>&Save...</source>
-        <translation>&Gorde...</translation>
+        <source>1 day</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-28"/>
-        <source>Text (*.txt)</source>
-        <translation>Idazkia (*.txt)</translation>
+        <source>2 days</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Save license to file...</source>
-        <translation>Gorde baimena agirian...</translation>
+        <source>3 days</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIIndicatorsPool</name>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="+76"/>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the virtual hard disks:</nobr>%1</p></source>
-        <comment>HDD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Diska gogor birutalen jarduera adierazten du:</nobr>%1</p></translation>
+        <source>4 days</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+66"/>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
-        <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>CD/DVD gailuen jarduera adierazten du:</nobr>%1</p></translation>
+        <source>5 days</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+70"/>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
-        <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Diskete gailuen jarduera adierazten du:</nobr>%1</p></translation>
+        <source>6 days</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+77"/>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
-        <comment>Network adapters tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Sare interfazeen jarduera adierazten du:</nobr>%1</p></translation>
+        <source>1 week</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+37"/>
-        <source><br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr></source>
-        <comment>Network adapters tooltip</comment>
-        <translation><br><nobr><b>Egokitzailea %1 (%2)</b>: %3 kablea %4</nobr></translation>
+        <source>2 weeks</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>connected</source>
-        <comment>Network adapters tooltip</comment>
-        <translation>elkartuta</translation>
+        <source>3 weeks</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>disconnected</source>
-        <comment>Network adapters tooltip</comment>
-        <translation>etenda</translation>
+        <source>1 month</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><br><nobr><b>All network adapters are disabled</b></nobr></source>
-        <comment>Network adapters tooltip</comment>
-        <translation><br><nobr><b>Sare egokitzaile guztiak ezgaituta daude</b></nobr></translation>
+        <source>Never</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+45"/>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the attached USB devices:</nobr>%1</p></source>
-        <comment>USB device tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Erantsitako USB gailuen jarduera adierazten du:</nobr>%1</p></translation>
+        <source>Connection timed out.</source>
+        <translation type="obsolete">Konexioa denboraz kanpo.</translation>
     </message>
     <message>
-        <location line="+25"/>
-        <source><br><nobr><b>No USB devices attached</b></nobr></source>
-        <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Ez dago USB gailurik erantsita</b></nobr></translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
-        <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB Kontrolatzailea ezgaituta dago</b></nobr></translation>
+        <source>Summary</source>
+        <translation type="obsolete">Laburpena</translation>
     </message>
+</context>
+<context>
+    <name>UIUpdateStepVirtualBox</name>
     <message>
-        <location line="+38"/>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
-        <comment>Shared folders tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Makinaren elkarbanatutako agiritegien jarduera adierazten du:</nobr>%1</p></translation>
+        <source>Checking for a new VirtualBox version...</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIVMCloseDialog</name>
     <message>
-        <location line="+36"/>
-        <source><br><nobr><b>No shared folders</b></nobr></source>
-        <comment>Shared folders tooltip</comment>
-        <translation><br><nobr><b>Ez dago elkarbanatutako agiritegirik</b></nobr></translation>
+        <source>Close Virtual Machine</source>
+        <translation type="unfinished">Makina Birtuala Itxi</translation>
     </message>
     <message>
-        <location line="+57"/>
-        <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Bideo harpen jarduera adierazten du:</nobr><br>%1</translation>
+        <source>You want to:</source>
+        <translation type="unfinished">Hau nahi duzu:</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>Bideo harpena ezgaituta</b></nobr></translation>
+        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>Bideo harpen agiria:</b> %1</nobr></translation>
+        <source>&Save the machine state</source>
+        <translation type="unfinished">Makina egoera &grabatu</translation>
     </message>
     <message>
-        <location line="+123"/>
-        <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
-        <comment>Virtualization Stuff LED</comment>
+        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source><br><nobr><b>%1:</b>&nbsp;%2</nobr></source>
-        <comment>Virtualization Stuff LED</comment>
-        <translation><br><nobr><b>%1:</b>&nbsp;%2</nobr></translation>
-    </message>
-    <message>
-        <location line="+33"/>
-        <source>Indicates whether the host mouse pointer is captured by the guest OS:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer is captured</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;mouse integration (MI) is On</nobr><br><nobr><img src=:/mouse_can_seamless_ [...]
+        <source>S&end the shutdown signal</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+50"/>
-        <source>Indicates whether the keyboard is captured by the guest OS (<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>).</source>
+        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><hr>The Remote Desktop Server is listening on port %1</source>
-        <translation type="obsolete"><hr>Hurruneko Mahaigain Zerbitzaria %1 atakan ari da aditzen</translation>
+        <source>&Power off the machine</source>
+        <translation type="unfinished">Makina &Itzali</translation>
     </message>
-</context>
-<context>
-    <name>UILineTextEdit</name>
     <message>
-        <location filename="../src/widgets/UILineTextEdit.cpp" line="+113"/>
-        <source>&Edit</source>
-        <translation>&Editatu</translation>
+        <source>Restore the machine state stored in the current snapshot</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineLogic</name>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="+764"/>
-        <source>Preview Monitor %1</source>
-        <translation>Aurreikuspen Monitorea %1</translation>
+        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+542"/>
-        <source>Snapshot %1</source>
-        <translation>Berehalakoa %1</translation>
+        <source>&Restore current snapshot '%1'</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+669"/>
-        <source>No Webcams Connected</source>
-        <translation>Ez dago Webkamerarik Elkarketaturik</translation>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>No supported webcams connected to the host PC</source>
-        <translation>Ez dago sostengaturiko webkamerarik hostalari PC-ra elkarketaturik</translation>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
     <message>
-        <location line="+225"/>
-        <source>Connect Network Adapter</source>
-        <translation>Elkarketatu Sare Egokitzailea</translation>
+        <source>&Details</source>
+        <translation type="unfinished">&Xehetasunak</translation>
     </message>
     <message>
-        <location line="+0"/>
-        <source>Connect Network Adapter %1</source>
-        <translation>Elkarketatu %1 Sare Egokitzailea</translation>
+        <source>&Snapshots</source>
+        <translation type="unfinished">&Egoera-argazkia</translation>
     </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>No CD/DVD Devices Attached</source>
-        <translation type="obsolete">Ez da CD/DVD Gailurik Erantsi</translation>
+        <source>%1 - Session Information</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>No CD/DVD devices attached to that VM</source>
-        <translation type="obsolete">Ez da CD/DVD Gailurik Erantsi MB horretara</translation>
+        <source>&Details</source>
+        <translation type="obsolete">&Xehetasunak</translation>
     </message>
     <message>
-        <source>No Floppy Devices Attached</source>
-        <translation type="obsolete">Ez da Diskete Gailurik Erantsi</translation>
+        <source>DMA Transfers</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>No floppy devices attached to that VM</source>
-        <translation type="obsolete">Ez da Diskete Gailurik Erantsi MB horretara</translation>
+        <source>PIO Transfers</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-292"/>
-        <source>No USB Devices Connected</source>
-        <translation>Ez da USB Gailurik Erantsi</translation>
+        <source>Data Read</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>No supported devices connected to the host PC</source>
-        <translation>Sostengu gabeko gailuak elkartuta hostalari PG-ra</translation>
+        <source>Data Written</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-509"/>
-        <source>Select a filename for the screenshot ...</source>
-        <translation>Hautatu ikusleiho-argazkiarentzako agirizen bat...</translation>
+        <source>Data Transmitted</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsAudio</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsAudio.ui" line="+24"/>
-        <source>When checked, a virtual PCI audio card will be plugged into the virtual machine and will communicate with the host audio system using the specified driver.</source>
+        <source>Data Received</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable &Audio</source>
-        <translation>&Gaitu Audioa</translation>
+        <source>Enabled</source>
+        <translation type="obsolete">Gaiturik</translation>
     </message>
     <message>
-        <location line="+29"/>
-        <source>Host Audio &Driver:</source>
-        <translation>Hostalariko Audio &Gidagailua:</translation>
+        <source>Disabled</source>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Controls the audio output driver. The <b>Null Audio Driver</b> makes the guest see an audio card, however every access to it will be ignored.</source>
+        <source>Runtime Attributes</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Audio &Controller:</source>
-        <translation>Audio &Kontrolatzailea:</translation>
+        <source>Screen Resolution</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Selects the type of the virtual sound card. Depending on this value, VirtualBox will provide different audio hardware to the virtual machine.</source>
-        <translation>Soinu txartel birutala hautatzen du. Balio honen arabera, VirtualBox-ek audio hardware ezberdina hornituko dio makina birtualari.</translation>
+        <source>Not attached</source>
+        <translation type="obsolete">Ez erantsia</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsDisplay</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="+322"/>
-        <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
+        <source>Guest Additions</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+17"/>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
+        <source>Guest OS Type</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
+        <source>No Network Adapters</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation type="unfinished"></translation>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Gaiturik</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>The VRDE server port value is not currently specified.</source>
-        <translation type="unfinished"></translation>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>The VRDE authentication timeout value is not currently specified.</source>
+        <source>Storage Statistics</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+54"/>
-        <location line="+1"/>
-        <location line="+426"/>
-        <source><qt>%1&nbsp;MB</qt></source>
-        <translation><qt>%1&nbsp;MB</qt></translation>
+        <source>No Storage Devices</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-416"/>
-        <source>User Defined</source>
-        <translation>Erabiltzaileak Zehaztuta</translation>
+        <source>Network Statistics</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location line="+1"/>
-        <source>%1 fps</source>
-        <translation>%1 fs-ko</translation>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>fps</source>
-        <translation>fs-ko</translation>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>low</source>
-        <comment>quality</comment>
-        <translation>apala</translation>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>medium</source>
-        <comment>quality</comment>
-        <translation>ertaina</translation>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>high</source>
-        <comment>quality</comment>
-        <translation>handia</translation>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>kbps</source>
-        <translation>kbs-ko</translation>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIVMListView</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="+30"/>
-        <source>&Video</source>
-        <translation>&Bideoa</translation>
+        <source>Inaccessible</source>
+        <translation type="unfinished">Eskuraezina</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Video &Memory:</source>
-        <translation>Bideo &Oroimena:</translation>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation type="unfinished"><nobr>%1<br></nobr><nobr>%2 %3-tik</nobr><br><nobr>%4 saioa</nobr></translation>
     </message>
     <message>
-        <location line="+18"/>
-        <location line="+31"/>
-        <source>Controls the amount of video memory provided to the virtual machine.</source>
-        <translation>Makina birtualari hornitutako bideo oroimen kopurua agintzen du.</translation>
+        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
+        <comment>Inaccessible VM tooltip (name, last state change)</comment>
+        <translation type="unfinished"><nobr><b>%1</b><br></nobr><nobr>Eskuraezina %2 -tik</nobr></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>MB</source>
-        <translation>MB</translation>
+        <source>S&how</source>
+        <translation type="obsolete">I&kusi</translation>
     </message>
     <message>
-        <location line="+63"/>
-        <location line="+160"/>
-        <source>Extended Features:</source>
-        <translation>Ezaugarri Hedatuak:</translation>
+        <source>Switch to the window of the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtualaren leihora aldatu</translation>
     </message>
     <message>
-        <location line="-144"/>
-        <source>When checked, the virtual machine will be given access to the 3D graphics capabilities available on the host.</source>
-        <translation>Hautatutakoan, makina birtualak sarbidea emango du hostalarian eskuragarri dauden 3D grafika gaitasunetara.</translation>
+        <source>S&tart</source>
+        <translation type="obsolete">Abiara&zi</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable &3D Acceleration</source>
-        <translation>Gaitu &3D Bideo Bizkorpena</translation>
+        <source>Start the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtuala abiarazi</translation>
     </message>
     <message>
-        <location line="+40"/>
-        <source>&Remote Display</source>
-        <translation>&Hurruneko Erakuspena</translation>
+        <source>R&esume</source>
+        <translation type="obsolete">Ja&rraitu</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source>
-        <translation type="unfinished"></translation>
+        <source>Resume the execution of the virtual machine</source>
+        <translation type="obsolete">Makina birtualaren exekuzioa jarraitu</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Enable Server</source>
-        <translation>&Gaitu Zerbitzaria</translation>
+        <source>&Pause</source>
+        <translation type="obsolete">&Gelditu</translation>
     </message>
     <message>
-        <location line="+29"/>
-        <source>Server &Port:</source>
-        <translation>Zerbitzari &Ataka:</translation>
+        <source>Suspend the execution of the virtual machine</source>
+        <translation type="obsolete">Makina Birtualaren exekuzioa gelditu</translation>
     </message>
+</context>
+<context>
+    <name>UIVMLogViewer</name>
     <message>
-        <location line="+20"/>
-        <source>Authentication &Method:</source>
-        <translation>Egiaztapen &Metodoa:</translation>
+        <source>Close the search panel</source>
+        <translation type="unfinished">Bilaketa panela itxi</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Defines the VRDP authentication method.</source>
-        <translation>VRDP egiaztapen metodoa zehazten du.</translation>
+        <source>&Find</source>
+        <translation type="unfinished">&Bilatu</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Authentication &Timeout:</source>
-        <translation>Egiaztapen &Epemuga:</translation>
+        <source>Enter a search string here</source>
+        <translation type="unfinished">Bilaketa katea idatzi hemen</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Specifies the timeout for guest authentication, in milliseconds.</source>
-        <translation>Gonbidatu egiaztapenerako epemuga adierazten du, segundumilaenetan.</translation>
+        <source>&Previous</source>
+        <translation type="unfinished">&Aurrekoa</translation>
     </message>
     <message>
-        <location line="+53"/>
-        <source>Video &Capture</source>
-        <translation>Bideo &Harpena</translation>
+        <source>Search for the previous occurrence of the string</source>
+        <translation type="unfinished">Katearen aurreko errepikatzea bilatu</translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>Hautatutakoan, VirtualBox-ek makina birtualaren saioa bideo agiri bezala grabatuko du.</translation>
+        <source>&Next</source>
+        <translation type="unfinished">&Hurrengoa</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Enable Video Capture</source>
-        <translation>&Gaitu Bideo Harpena</translation>
+        <source>Search for the next occurrence of the string</source>
+        <translation type="unfinished">Katearen hurrengo errepikatzea bilatu</translation>
     </message>
     <message>
-        <location line="+29"/>
-        <source>File &Path:</source>
-        <translation>Agiri &Helburua:</translation>
+        <source>C&ase Sensitive</source>
+        <translation type="unfinished">Min/M&aius Ezberdindu</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Ezarpen honek VirtualBox-ek grabatutako edukiak gordetzeko erabiltzen duen agirizena zehazten du.</translation>
+        <source>Perform case sensitive search (when checked)</source>
+        <translation type="unfinished">Maiuskula/minuskulak ezberdintzen egin bilaketa (hautaturik dagoenean)</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Frame &Size:</source>
-        <translation>Frame &Neurria:</translation>
+        <source>String not found</source>
+        <translation type="unfinished">Katea ez da aurkitu</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>Ezarpen honek grabatutako bideoaren bereizmena (frame neurria) zehazten du.</translation>
+        <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
+        <translation type="unfinished"><p>Ez da erregistro fitxategirik aurkitu. Sakatu <b>Freskatu</b> botoia erregistro karpeta berriz arakatzeko <nobr><b>%1</b></nobr>.</p></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>Ezarpen honek grabatutako bideoaren <b>etzaneko</b> bereizmena (frame zabalera) zehazten du.</translation>
+        <source>Save VirtualBox Log As</source>
+        <translation type="unfinished">VirtualBox Erregistroa Gorde Honela</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>Ezarpen honek grabatutako bideoaren <b>zutikako</b> bereizmena (frame garaiera) zehazten du.</translation>
+        <source>%1 - VirtualBox Log Viewer</source>
+        <translation type="unfinished">%1 - VirtualBox Erregistro ikustatzailea</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Frame Rate:</source>
-        <translation>&Frame Maila:</translation>
+        <source>&Refresh</source>
+        <translation type="unfinished">F&reskatu</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <location line="+32"/>
-        <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>Ezarpen honek gehinezko<b>frame segunduko</b> zenbatekoa zehazten du. Frame gehigarriak jauzi egingo dira. Balio hau gutxitzeak jauzitako frame zenbatekoa handitu eta agiriaren neurria txikiagotuko du.</translation>
+        <source>&Save</source>
+        <translation type="unfinished">&Gorde</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>&Quality:</source>
-        <translation>&Ontasuna:</translation>
+        <source>Close</source>
+        <translation type="unfinished">Itxi</translation>
     </message>
+</context>
+<context>
+    <name>UIWizard</name>
     <message>
-        <location line="+19"/>
-        <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Ezarpen honek <b>ontasuna</b> zehazten du. Balio hau handitzeak bideoak hobea ematea egingo du agiriaren neurria apur bat handituz.</translation>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+48"/>
-        <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Ezarpen honek bitneurria zehazten du<b>kilobit segunduko</b>-tan. Balio hau handitzeak bideoak hobea ematea egingo du agiriaren neurria apur bat handituz.</translation>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>&Screens:</source>
-        <translation>&Ikusleihoak:</translation>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-416"/>
-        <source>When checked, the virtual machine will be given access to the Video Acceleration capabilities available on the host.</source>
-        <translation>Hautatutakoan, makina birtualak hostalarian eskuragarri dauden Bideo Bizkorpen gaitasunetarako sarbidea emango du.</translation>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIWizardCloneVD</name>
     <message>
-        <location line="+3"/>
-        <source>Enable &2D Video Acceleration</source>
-        <translation>Gaitu &2D Bideo Bizkorpena</translation>
+        <source>Copy Virtual Hard Drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+78"/>
-        <source>The VRDP Server port number. You may specify <tt>0</tt> (zero), to select port 3389, the standard port for RDP.</source>
-        <translation>VRDP Zerbitzari ataka zenbakia. Adierazi dezakezu <tt>0</tt> (huts), 3389 ataka hautatzeko, RDP-rako ataka estandarra.</translation>
+        <source>Copy</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-169"/>
-        <source>Mo&nitor Count:</source>
-        <translation>&Monitore Zenbatekoa:</translation>
+        <source>Hard drive to copy</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+18"/>
-        <location line="+31"/>
-        <source>Controls the amount of virtual monitors provided to the virtual machine.</source>
-        <translation>Makina birtualari hornitutako monitore birtual kopurua agintzen du.</translation>
+        <source><p>Please select the virtual hard drive file that you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select one.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="-16"/>
-        <location line="+1"/>
-        <source><qt>%1</qt></source>
-        <translation><qt>%1</qt></translation>
+        <source>Choose a virtual hard drive file to copy...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="+183"/>
-        <source>Specifies whether multiple simultaneous connections to the VM are permitted.</source>
-        <translation>Makina Birtualera zenbat elkarketa aldiberean baimentzen diren adierazten du.</translation>
+        <source>Hard drive file type</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Allow Multiple Connections</source>
-        <translation>&Ahalbidetu Elkarketa Anitz</translation>
+        <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIFilmContainer.cpp" line="+142"/>
-        <source>Screen %1</source>
-        <translation>%1 Ikusleihoa</translation>
+        <source>Storage on physical hard drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Enable video recording for screen %1.</source>
-        <translation>Gaitu bideo grabaketa %1 ikusleihorako.</translation>
+        <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source>Displays the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation type="obsolete">Makina birtual honen berehalakoak gordetzen diren helburua erakusten du. Ohartarazten dugu argazkiek diskako tokia asko hartzen dutela.</translation>
+        <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="+33"/>
-        <source>&Basic</source>
-        <translation>&Ohinarrizkoa</translation>
+        <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+26"/>
-        <source>&Advanced</source>
-        <translation>A&urreratua</translation>
+        <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+38"/>
-        <source>&Shared Clipboard:</source>
-        <translation>&Elkarbanatutako Gakoa:</translation>
+        <source>&Dynamically allocated</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <source>&Fixed size</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-42"/>
-        <source>S&napshot Folder:</source>
-        <translation>&Argaki Agiritegia:</translation>
+        <source>&Split into files of less than 2GB</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+149"/>
-        <source>Show in &Fullscreen/Seamless</source>
-        <translation>Erakutsi &Ikusleiho-osoa/Irudizkoan</translation>
+        <source>Please choose a location for new virtual hard drive file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Show at &Top of Screen</source>
-        <translation>Erakutsi Ikusleihoaren &Gainean</translation>
+        <source>New hard drive to create</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+27"/>
-        <source>&Description</source>
-        <translation>&Azalpena</translation>
+        <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
-        <translation type="obsolete">Makina birtualaren azalpena erakusten du. Azalpen eramua erabilgarria da ezarritako SE gonbidatuaren itxurapen xehetasunak aipatzeko.</translation>
+        <source>Choose a location for new virtual hard drive file...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-94"/>
-        <source>Removable Media:</source>
-        <translation>Multimedia Kengarria:</translation>
+        <source>%1_copy</source>
+        <comment>copied virtual hard drive name</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+16"/>
-        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
+        <source>Hard drive to &copy</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Remember Runtime Changes</source>
-        <translation>&Gogoratu Runtime Aldaketak</translation>
+        <source>&New hard drive to create</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Mini ToolBar:</source>
-        <translation>TresnaBarra Txikia:</translation>
+        <source>Hard drive file &type</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIWizardCloneVM</name>
     <message>
-        <location line="+16"/>
-        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Hautatzen bada, Tresnabarra Txikia erakusten du Ikusleiho-osoko eta Irudizko moduetan.</translation>
+        <source>Linked Base for %1 and %2</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+58"/>
-        <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
+        <source>Clone Virtual Machine</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show In &Fullscreen/Seamless</source>
-        <translation type="obsolete">Erakutsi &Ikusleiho-osoan/Irudizkoan</translation>
+        <source>Clone</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-39"/>
-        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <source>%1 Clone</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show At &Top Of Screen</source>
-        <translation type="obsolete">&Erakutsi Ikusleihoaren Goialdean</translation>
+        <source>New machine name</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-103"/>
-        <source>&Drag'n'Drop:</source>
-        <translation>&Arrastatu-eta-Askatu:</translation>
+        <source><p>Please choose a name for the new virtual machine. The new machine will be a clone of the machine <b>%1</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>Gonbidatuaren eta hostalari SE-ren artean arrastatu-eta-askatuz zein datu kopiatuko diren hautatzen du. Ezaugarri honek Gonbidatu Gehigarriak ezarrita behar ditu gonbidatu SE-an.</translation>
+        <source>When checked a new unique MAC address will be assigned to all configured network cards.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.cpp" line="+238"/>
-        <source>No name specified for the virtual machine.</source>
-        <translation>Ez da izenik adierazi makina birtualarentzat.</translation>
+        <source>&Reinitialize the MAC address of all network cards</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <source>Clone type</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+37"/>
-        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <source><p>Please choose the type of clone you wish to create.</p><p>If you choose <b>Full clone</b>, an exact copy (including all virtual hard drive files) of the original virtual machine will be created.</p><p>If you choose <b>Linked clone</b>, a new machine will be created, but the virtual hard drive files will be tied to the virtual hard drive files of original machine and you will not be able to move the new virtual machi [...]
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsNetwork</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="+29"/>
-        <source>When checked, plugs this virtual network adapter into the virtual machine.</source>
-        <translation>Hautatutakoan, sare egokitzaile birtual hau makina birtualean elkartzen du.</translation>
+        <source><p>If you create a <b>Linked clone</b> then a new snapshot will be created in the original virtual machine as part of the cloning process.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Enable Network Adapter</source>
-        <translation>&Gaitu Sare Egokitzailea</translation>
+        <source>&Full clone</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+127"/>
-        <source>Selects the type of the virtual network adapter. Depending on this value, VirtualBox will provide different network hardware to the virtual machine.</source>
-        <translation>Sare egokitzaile birtualaren mota hautatzen du. Balio honen arabera, VirtualBox-ek sare hardware ezberdina hornituko dio makina birtualari.</translation>
+        <source>&Linked clone</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-98"/>
-        <source>&Attached to:</source>
-        <translation>&Hona erantsita:</translation>
+        <source>Snapshots</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Controls how this virtual adapter is attached to the real network of the Host OS.</source>
-        <translation>Egokitzaile birtual hau SE Hostalariaren egizko sarera nola eransten den agintzen du.</translation>
+        <source><p>Please choose which parts of the snapshot tree should be cloned with the machine.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+60"/>
-        <source>Adapter &Type:</source>
-        <translation>Egokitzaile &Mota:</translation>
+        <source><p>If you choose <b>Current machine state</b>, the new machine will reflect the current state of the original machine and will have no snapshots.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>no bridged network adapter is selected</source>
-        <translation type="obsolete">ez da zubitutako sare egokitzailerik hautatu</translation>
+        <source><p>If you choose <b>Current snapshot tree branch</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the tree branch starting at the current state in the original machine.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>no internal network name is specified</source>
-        <translation type="obsolete">ez da barneko sare izenik adierazi</translation>
+        <source><p>If you choose <b>Everything</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the original machine.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>no host-only network adapter is selected</source>
-        <translation type="obsolete">ez da hostalaria-bakarrik sare egokitzailerik hautatu</translation>
+        <source>Current &machine state</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="+718"/>
-        <location line="+2"/>
-        <source>Not selected</source>
-        <comment>network adapter name</comment>
-        <translation>Hautatu gabe</translation>
+        <source>Current &snapshot tree branch</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="-53"/>
-        <source>&Name:</source>
-        <translation>&Izena:</translation>
+        <source>&Everything</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <source>A&dvanced</source>
-        <translation>A&urreratua</translation>
+        <source>New machine &name</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Shows or hides additional network adapter options.</source>
-        <translation>Sare gehigarri egokitzaile aukerak erakutsi edo ezkutatzen ditu.</translation>
+        <source>&Full Clone</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
-        <translation type="obsolete">Egokitzaile honen MAC helbidea erakusten du. Zehatz-mehatz 12 hizki ditu {0-9,A-F}-tik hartuta. Ohartu bigarren hizkia zenbaki bikoiti bat izan behar dela.</translation>
+        <source>&Linked Clone</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIWizardExportApp</name>
     <message>
-        <location line="+87"/>
-        <source>Generates a new random MAC address.</source>
-        <translation>Zorizko MAC helbide berri bat sortzen du.</translation>
+        <source>Checking files ...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+31"/>
-        <source>Indicates whether the virtual network cable is plugged in on machine startup or not.</source>
-        <translation>Abiaraztean sare birtual kablea makinara elkartuta egongo den edo ez adierazten du.</translation>
+        <source>Removing files ...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Cable connected</source>
-        <translation type="obsolete">&Kablea elkartuta</translation>
+        <source>Exporting Appliance ...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Opens dialog to manage port forwarding rules.</source>
-        <translation type="obsolete">Bidalketa ataka arau kudeaketarako elkarrizketa irekitzen du.</translation>
+        <source>Export Virtual Appliance</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>&Port Forwarding</source>
-        <translation>&Bidalketa Ataka</translation>
+        <source>Restore Defaults</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-96"/>
-        <source>&Promiscuous Mode:</source>
+        <source>Export</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Selects the promiscuous mode policy of the network adapter when attached to an internal network, host only network or a bridge.</source>
+        <source>Virtual machines to export</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+26"/>
-        <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
+        <source><p>Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+21"/>
-        <source>Generic Properties:</source>
-        <translation>Ezaugarri Generikoak:</translation>
+        <source>Appliance settings</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Enter any configuration settings here for the network attachment driver you will be using. The settings should be of the form <b>name=value</b> and will depend on the driver. Use <b>shift-enter</b> to add a new entry.</source>
+        <source>Please choose where to create the virtual appliance. You can create it on your own computer, on the Sun Cloud service or on an S3 storage server.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>&Cable Connected</source>
-        <translation>&Kablez Elkarketaturik</translation>
+        <source>Create on</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Bidalketa ataka arauak kudeatzeko leiho bat irekitzen du.</translation>
+        <source>&This computer</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>no generic driver is selected</source>
-        <translation type="obsolete">ez da gidatzaile generikorik hautatu</translation>
+        <source>Sun &Cloud</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="-310"/>
-        <source>Selects the network adapter on the host system that traffic to and from this network card will go through.</source>
+        <source>&Simple Storage System (S3)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-220"/>
-        <source>No bridged network adapter is currently selected.</source>
-        <translation>Ez da zubitutako sare egokitzailerik hautatu.</translation>
+        <source>Appliance</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>No internal network name is currently specified.</source>
-        <translation>Ez da barneko sare izenik adierazi.</translation>
+        <source>&Username:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>No host-only network adapter is currently selected.</source>
-        <translation>Ez da hostalaria-bakarrik sare egokitzailerik hautatu.</translation>
+        <source>&Password:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>No generic driver is currently selected.</source>
-        <translation>Ez da gidagailu generikorik adierazi.</translation>
+        <source>&Hostname:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>No NAT network name is currently specified.</source>
-        <translation>Ez dago NAT sare izenik adierazita.</translation>
+        <source>&Bucket:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>MAC helbideak 12 digito hamaseitarreko luzera izan behar du.</translation>
+        <source>&File:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
+        <source>Open Virtualization Format Archive (%1)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+169"/>
-        <source>Holds the name of the internal network that this network card will be connected to. You can create a new internal network by choosing a name which is not used by any other network cards in this virtual machine or others.</source>
+        <source>Open Virtualization Format (%1)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Selects the virtual network adapter on the host system that traffic to and from this network card will go through. You can create and remove adapters using the global network settings in the virtual machine manager window.</source>
+        <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Selects the driver to be used with this network card.</source>
-        <translation>Sare txartel honekin erabiltzeko gidagailua hautatzen du.</translation>
+        <source>Create a Manifest file for automatic data integrity checks on import.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
+        <source>Write &Manifest file</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="-67"/>
-        <source>&MAC Address:</source>
-        <translation>&MAC Helbidea:</translation>
+        <source>This is the descriptive information which will be added to the virtual appliance.  You can change it by double clicking on individual lines.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>the MAC address must be 12 hexadecimal digits long.</source>
-        <translation type="obsolete">MAC helbideak 12 digito hexadezimaleko luzera izan behar du.</translation>
+        <source>Virtual &machines to export</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsParallel</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.cpp" line="+130"/>
-        <source>Port %1</source>
-        <comment>parallel ports</comment>
-        <translation>Ataka %1</translation>
+        <source>Appliance &settings</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="+29"/>
-        <source>When checked, enables the given parallel port of the virtual machine.</source>
-        <translation>Hautatutakoan, makina birtualaren emaniko ataka kideak gaitzen ditu.</translation>
+        <source>&Destination</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Enable Parallel Port</source>
-        <translation>&Gaitu Ataka Kidetuak</translation>
+        <source>&Local Filesystem </source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <source>Port &Number:</source>
-        <translation>&Ataka Zenbakia:</translation>
+        <source>Storage settings</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Holds the parallel port number. You can choose one of the standard parallel ports or select <b>User-defined</b> and specify port parameters manually.</source>
+        <source>Please choose a file to export the virtual appliance to</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&IRQ:</source>
-        <translation>&IRQ:</translation>
+        <source>F&ormat:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+16"/>
-        <source>Holds the IRQ number of this parallel port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
+        <source>OVF 0.9</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>I/O Po&rt:</source>
-        <translation>S/I &Ataka:</translation>
+        <source>OVF 1.0</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+16"/>
-        <source>Holds the base I/O port address of this parallel port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
+        <source>OVF 2.0</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Port &Path:</source>
-        <translation>Ataka &Helburua:</translation>
+        <source>Write in standard OVF 1.0 format.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Holds the host parallel device name.</source>
+        <source>Write in new experimental OVF 2.0 format.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the host parallel device name.</source>
-        <translation type="obsolete">Hostalari gailu kidetu izena erakusten du.</translation>
+        <source>&Storage settings</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIMachineSettingsParallelPage</name>
-    <message>
-        <source>Duplicate port number selected </source>
-        <translation type="obsolete">Bikoiztu hautaturiko ataka zenbakia </translation>
-    </message>
+    <name>UIWizardExportAppPageBasic3</name>
     <message>
-        <source>Port path not specified </source>
-        <translation type="obsolete">Ataka helburua ez da adierazi </translation>
+        <source><p>Please choose a filename to export the OVF/OVA to.</p><p>If you use an <i>ova</i> extension, then all the files will be combined into one Open Virtualization Format Archive.</p><p>If you use an <i>ovf</i> extension, several files will be written separately.</p><p>Other extensions are not allowed.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Duplicate port path entered </source>
-        <translation type="obsolete">Bikoiztu sartutako ataka helburua </translation>
+        <source>Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.cpp" line="+227"/>
-        <source>No IRQ is currently specified.</source>
-        <translation>Ez dago IRQ-rik adierazita.</translation>
+        <source>Please complete the additional fields like the username, password, hostname and the bucket, and provide a filename for the OVF target.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>No I/O port is currently specified.</source>
-        <translation>Ez dago S/I atakarik adierazita.</translation>
+        <source>Choose a file to export the virtual appliance to...</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIWizardExportAppPageExpert</name>
     <message>
-        <location line="+5"/>
-        <source>Two or more ports have the same settings.</source>
-        <translation>Bi ataka edo gehiagok ezarpen berdinak dituzte.</translation>
+        <source>Choose a file to export the virtual appliance to...</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIWizardFirstRun</name>
     <message>
-        <location line="+5"/>
-        <source>No port path is currently specified.</source>
-        <translation>Ez dago ataka helbururik adierazita.</translation>
+        <source>Select start-up disk</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>There are currently duplicate port paths specified.</source>
-        <translation>Ez dago bikoizturiko ataka helbururik adierazita.</translation>
+        <source>Start</source>
+        <translation type="unfinished">Abiarazi</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsPortForwardingDlg</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp" line="+87"/>
-        <source>Port Forwarding Rules</source>
-        <translation>Bidalketa Ataka Arauak</translation>
+        <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from and should contain the operating system you wish to install on the virtual machine if you want to do that now. The disk will be ejected from the virtual drive automatically next time you switch the virtual machine off, but you can also do this yourself if needed u [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="+741"/>
-        <source>This table contains a list of port forwarding rules.</source>
-        <translation>Taula honek bidalketa ataka arauak ditu.</translation>
+        <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from. As this virtual machine has no hard drive you will not be able to install an operating system on it at the moment.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Insert new rule</source>
-        <translation>Txertatu arau berria</translation>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIWizardImportApp</name>
     <message>
-        <location line="+1"/>
-        <source>Copy selected rule</source>
-        <translation>Kopiatu hautaturiko araua</translation>
+        <source>Restore Defaults</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Delete selected rule</source>
-        <translation>Ezabatu hautaturiko araua</translation>
+        <source>Import</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>This button adds new port forwarding rule.</source>
-        <translation>Botoi honek bidalketa ataka arau berria gehitzen du.</translation>
+        <source>Appliance to import</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>This button deletes selected port forwarding rule.</source>
-        <translation>Botoi honek hautaturiko bidalketa ataka araua ezabatzen du.</translation>
+        <source><p>VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below.</p></source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSF</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="+416"/>
-        <source>Adds a new shared folder definition.</source>
-        <translation>Agiritegi elkarbanatu adiera berri bat gehitzen du.</translation>
+        <source>Open Virtualization Format (%1)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Edits the selected shared folder definition.</source>
-        <translation>Hautaturiko agiritegi elkarbanatu adiera editatzen du.</translation>
+        <source>Appliance settings</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Removes the selected shared folder definition.</source>
-        <translation>Hautaturiko agiritegi elkarbanatu adiera kentzen du.</translation>
+        <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+272"/>
-        <source> Machine Folders</source>
-        <translation> Makina Agiritegiak</translation>
+        <source>Import Virtual Appliance</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source> Transient Folders</source>
+        <source>Choose a virtual appliance file to import...</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-273"/>
-        <source>Full</source>
-        <translation>Osoa</translation>
+        <source>Please choose a virtual appliance file to import</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIWizardNewVD</name>
     <message>
-        <location line="+1"/>
-        <source>Read-only</source>
-        <translation>Irakurri-bakarrik</translation>
+        <source>Create Virtual Hard Drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.ui" line="+69"/>
-        <source>Lists all shared folders accessible to this machine. Use 'net use x: \\vboxsvr\share' to access a shared folder named <i>share</i> from a DOS-like OS, or 'mount -t vboxsf share mount_point' to access it from a Linux OS. This feature requires Guest Additions.</source>
+        <source>Create</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Name</source>
-        <translation>Izena</translation>
+        <source>Hard drive file type</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Path</source>
-        <translation>Helburua</translation>
+        <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Auto-mount</source>
-        <translation>Berez-osatu</translation>
+        <source>Storage on physical hard drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Access</source>
-        <translation>Sarbidea</translation>
+        <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="-16"/>
-        <source>&Add Shared Folder</source>
-        <translation>&Gehitu Elkarbanatutako Agiritegia</translation>
+        <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Edit Shared Folder</source>
-        <translation>&Editatu Elkarbanatutako Agiritegia</translation>
+        <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Remove Shared Folder</source>
-        <translation>&Kendu Elkarbanatutako Agiritegia</translation>
+        <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.ui" line="-62"/>
-        <source>&Folders List</source>
-        <translation>&Agiritegia Zerrenda</translation>
+        <source>&Dynamically allocated</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Auto-Mount</source>
-        <translation type="obsolete">Berez-Osatu</translation>
+        <source>&Fixed size</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="+15"/>
-        <source>Yes</source>
-        <translation>Bai</translation>
+        <source>&Split into files of less than 2GB</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSFDetails</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.cpp" line="+125"/>
-        <source>Add Share</source>
-        <translation>Gehitu Elkarbanaketa</translation>
+        <source><nobr>%1 (%2 B)</nobr></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Edit Share</source>
-        <translation>Editatu Elkarbanaketa</translation>
+        <source>File location and size</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Dialog</source>
-        <translation type="obsolete">Elkarrizketa</translation>
+        <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="+32"/>
-        <source>Folder Path:</source>
-        <translation>Agiritegi Helburua:</translation>
+        <source>Choose a location for new virtual hard drive file...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Folder Name:</source>
-        <translation>Agiritegi Izena:</translation>
+        <source>Select the size of the virtual hard drive in megabytes. This size is the limit on the amount of file data that a virtual machine will be able to store on the hard drive.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the name of the shared folder (as it will be seen by the guest OS).</source>
-        <translation type="obsolete">Elkarbanatutako agiritegiaren izena erakusten du (Gonbidatu SE-n ikusiko den bezala).</translation>
+        <source>File &location</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+17"/>
-        <source>When checked, the guest OS will not be able to write to the specified shared folder.</source>
-        <translation>Hautatzen bada, gonbidatu SE-ak ezingo du adierazitako agiritegi elkarbanatuan idatzi.</translation>
+        <source>File &size</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Read-only</source>
-        <translation>&Irakurri-bakarrik</translation>
+        <source>Hard drive file &type</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIWizardNewVM</name>
     <message>
-        <location line="+20"/>
-        <source>&Make Permanent</source>
-        <translation>&Egin Iraunkorra</translation>
+        <source>Create Virtual Machine</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-13"/>
-        <source>When checked, the guest OS will try to automatically mount the shared folder on startup.</source>
-        <translation>Hautatzen bada, gonbidatu SE-a berezgaitasunez saiatuko da agiritegi elkarbanatua osatzen hasterakoan.</translation>
+        <source>Create</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-46"/>
-        <source>Window</source>
-        <translation>Leihoa</translation>
+        <source>Name and operating system</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+29"/>
-        <source>Holds the name of the shared folder (as it will be seen by the guest OS).</source>
+        <source>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>&Auto-mount</source>
-        <translation>&Berez-Osatu</translation>
+        <source>Memory size</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>If checked, this shared folder will be permanent.</source>
-        <translation>Hautatzen bada, agiritegi elkarbanatu hau egonkorra izango da.</translation>
+        <source><p>Select the amount of memory (RAM) in megabytes to be allocated to the virtual machine.</p><p>The recommended memory size is <b>%1</b> MB.</p></source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSerial</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.cpp" line="+148"/>
-        <source>Port %1</source>
-        <comment>serial ports</comment>
-        <translation>Ataka %1</translation>
+        <source>Hard drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="+29"/>
-        <source>When checked, enables the given serial port of the virtual machine.</source>
-        <translation>Hautatzen bada, emaniko makina birtualaren serie ataka gaitzen du.</translation>
+        <source><p>If you wish you can add a virtual hard drive to the new machine. You can either create a new hard drive file or select one from the list or from another location using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step and make the changes to the machine settings once the machine is created.</p><p>The recommended size of the hard drive is <b>%1</b>.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Enable Serial Port</source>
-        <translation>&Gaitu Serie Ataka</translation>
+        <source>Choose a virtual hard drive file...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+41"/>
-        <source>Port &Number:</source>
-        <translation>&Ataka Zenbakia:</translation>
+        <source>&Memory size</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the serial port number. You can choose one of the standard serial ports or select <b>User-defined</b> and specify port parameters manually.</source>
-        <translation type="obsolete">Serieko ataka zenbakia erakusten du. Serieko ataka estandar bat hautatu dezakezu edo hautatu <b>Erabiltzaileak-zehaztuta</b> eta adierazi ataka parametroak eskuz.</translation>
+        <source>&Do not add a virtual hard drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Selects the serial port number. You can choose one of the standard serial ports or select <b>User-defined</b> and specify port parameters manually.</source>
+        <source>&Create a virtual hard drive now</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&IRQ:</source>
-        <translation>&IRQ:</translation>
+        <source>&Use an existing virtual hard drive file</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxAboutDlg</name>
     <message>
-        <location line="+10"/>
-        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation type="unfinished"></translation>
+        <source>VirtualBox - About</source>
+        <translation>VirtualBox - Honi Buruz</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>I/O Po&rt:</source>
-        <translation>S/I &Ataka:</translation>
+        <source><qt>VirtualBox Graphical User Interface Version %1<br>
+%2</qt></source>
+        <translation type="obsolete"><qt>VirtualBox Erabiltzaile Interfaze Grafikoa %1 Bertsioa<br>
+%2</qt></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
+        <source>VirtualBox Graphical User Interface</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+26"/>
-        <source>Port &Mode:</source>
-        <translation>Ataka &Modua:</translation>
+        <source>Version %1</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxAboutNonOSEDlg</name>
     <message>
-        <location line="+13"/>
-        <source>Controls the working mode of this serial port. If you select <b>Disconnected</b>, the guest OS will detect the serial port but will not be able to operate it.</source>
-        <translation>Serie ataka honetako lan modua agintzen du. <b>Etenda</b> hautatzen baduzu, SE gonbidatuak serieko ataka atzemango du baina ez da eragiketak egiteko gai izango.</translation>
+        <source>VirtualBox - About</source>
+        <translation type="obsolete">VirtualBox - Honi Buruz</translation>
     </message>
+</context>
+<context>
+    <name>VBoxAddNIDialog</name>
     <message>
-        <location line="+20"/>
-        <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation type="unfinished"></translation>
+        <source>Add Host Interface</source>
+        <translation type="obsolete">Ostalari interfaze bat gehitu</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Create Pipe</source>
-        <translation>&Sortu Hodia</translation>
+        <source>Interface Name</source>
+        <translation type="obsolete">Interfaze Izena</translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation type="unfinished"></translation>
+        <source>Descriptive name of the new network interface</source>
+        <translation type="obsolete">Sare interfaze berriaren izen azalkorra</translation>
     </message>
     <message>
-        <location line="-13"/>
-        <source>Port/File &Path:</source>
-        <translation>Ataka/Agiria &Helburua:</translation>
+        <source>&OK</source>
+        <translation type="obsolete">Ad&os</translation>
     </message>
     <message>
-        <source>Displays the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation type="obsolete">Serieko ataka honen ohinarri S/I ataka helbidea erakusten du. Baliozko balioak dira <tt>0</tt> eta <tt>0xFFFF</tt> arteko zenbaki osoak.</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
 </context>
 <context>
-    <name>UIMachineSettingsSerialPage</name>
+    <name>VBoxAddSFDialog</name>
     <message>
-        <source>Duplicate port number selected </source>
-        <translation type="obsolete">Bikoiztu hautaturiko ataka zenbakia </translation>
+        <source>Add Share</source>
+        <translation type="obsolete">Gehitu Partekatzea</translation>
     </message>
     <message>
-        <source>Port path not specified </source>
-        <translation type="obsolete">Ataka helburua ez da adierazi </translation>
+        <source>Edit Share</source>
+        <translation type="obsolete">Editatu Partekatzea</translation>
     </message>
     <message>
-        <source>Duplicate port path entered </source>
-        <translation type="obsolete">Bikoiztu sartutako ataka helburua </translation>
+        <source>Select a folder to share</source>
+        <translation type="obsolete">Partekatzeko karpeta bat hautatu</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.cpp" line="+251"/>
-        <source>No IRQ is currently specified.</source>
-        <translation>Ez dago IRQ-rik adierazita.</translation>
+        <source>Folder Path</source>
+        <translation type="obsolete">Karpeta Bidea</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>No I/O port is currently specified.</source>
-        <translation>Ez dago S/I atakarik adierazita.</translation>
+        <source>Folder Name</source>
+        <translation type="obsolete">Karpeta Izena</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Two or more ports have the same settings.</source>
-        <translation>Bi ataka edo gehiagok ezarpen berdinak dituzte.</translation>
+        <source>Holds the path to an existing folder on the host PC.</source>
+        <translation type="obsolete">Ostalari PC-an dagoeneko dagoen karpeta baten bidea bistaratzen du.</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>No port path is currently specified.</source>
-        <translation>Ez dago ataka helbururik adierazita.</translation>
+        <source>Holds the name of the shared folder (as it will be seen by the guest OS).</source>
+        <translation type="obsolete">Partekatutako karpetaren izen bistaratzen du (Ostalari PC-an ikusiko den bezala).</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>There are currently duplicate port paths specified.</source>
-        <translation>Ez dago ataka helbururik adierazita.</translation>
+        <source>Opens the dialog to select a folder.</source>
+        <translation type="obsolete">Karpeta hauatzeko leihoa irekitzen du.</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
+    </message>
+    <message>
+        <source>&OK</source>
+        <translation type="obsolete">&Ados</translation>
     </message>
 </context>
 <context>
-    <name>UIMachineSettingsStorage</name>
+    <name>VBoxCloseVMDlg</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="+549"/>
-        <source><nobr><b>%1</b></nobr><br><nobr>Bus:&nbsp;&nbsp;%2</nobr><br><nobr>Type:&nbsp;&nbsp;%3</nobr></source>
-        <translation><nobr><b>%1</b></nobr><br><nobr>Busa:&nbsp;&nbsp;%2</nobr><br><nobr>Mota:&nbsp;&nbsp;%3</nobr></translation>
+        <source>Close Virtual Machine</source>
+        <translation type="obsolete">Makina Birtuala Itxi</translation>
     </message>
     <message>
-        <location line="+354"/>
-        <source><nobr>Expand/Collapse&nbsp;Item</nobr></source>
-        <translation><nobr>Hedatu/Bildu&nbsp;Gaia</nobr></translation>
+        <source>You want to:</source>
+        <translation type="obsolete">Hau nahi duzu:</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><nobr>Add&nbsp;Hard&nbsp;Disk</nobr></source>
-        <translation><nobr>Gehitu&nbsp;Diska&nbsp;Gogorra</nobr></translation>
+        <source>&Save the machine state</source>
+        <translation type="obsolete">Makina egoera &grabatu</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Gehitu&nbsp;CD/DVD&nbsp;Gailua</nobr></translation>
+        <source>Alt+S</source>
+        <translation type="obsolete">Alt+G</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Gehitu&nbsp;Diskete&nbsp;Gailua</nobr></translation>
+        <source>&Power off the machine</source>
+        <translation type="obsolete">Makina &Itzali</translation>
     </message>
     <message>
-        <location line="+1296"/>
-        <source>Add Controller</source>
-        <translation>Gehitu Kontrolatzailea</translation>
+        <source>Alt+P</source>
+        <translation type="obsolete">Alt+I</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Add IDE Controller</source>
-        <translation>Gehitu IDE Kontrolatzailea</translation>
+        <source>&Revert to the current snapshot</source>
+        <translation type="obsolete">Uneko Egoe&ra-argazkira Itzuli</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Add SATA Controller</source>
-        <translation>Gehitu SATA Kontrolatzailea</translation>
+        <source>Alt+R</source>
+        <translation type="obsolete">Alt+R</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Add SCSI Controller</source>
-        <translation>Gehitu SCSI Kontrolatzailea</translation>
+        <source>Revert the machine state to the state stored in the current snapshot</source>
+        <translation type="obsolete">Uneko egoera egoera-argazkian gordetako egoerara itzuli makina</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Add Floppy Controller</source>
-        <translation>Gehitu Diskete Kontrolatzailea</translation>
+        <source>Help</source>
+        <translation type="obsolete">Laguntza</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Remove Controller</source>
-        <translation>Kendu Kontrolatzailea</translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Add Attachment</source>
-        <translation>Gehitu Eranskina</translation>
+        <source>&OK</source>
+        <translation type="obsolete">Ad&os</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Add Hard Disk</source>
-        <translation>Gehitu Diska Gogorra</translation>
+        <source>Alt+O</source>
+        <translation type="obsolete">Alt+O</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Add CD/DVD Device</source>
-        <translation>Gehitu CD/DVD Gailua</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
+</context>
+<context>
+    <name>VBoxConsoleWnd</name>
     <message>
-        <location line="+1"/>
-        <source>Add Floppy Device</source>
-        <translation>Gehitu Diskete Gailua</translation>
+        <source>VirtualBox OSE</source>
+        <translation type="obsolete">VirtualBox OSE</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Remove Attachment</source>
-        <translation>Kendu Eranskina</translation>
+        <source>innotek VirtualBox</source>
+        <translation type="obsolete">innotek VirtualBox</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Adds a new controller to the end of the Storage Tree.</source>
-        <translation>Kontrolatzaile berri bat gehintzen du Biltegi Zuhaitz amaieran.</translation>
+        <source>&Fullscreen Mode</source>
+        <translation type="obsolete">&Panataila Osoko Modua</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Removes the controller highlighted in the Storage Tree.</source>
-        <translation>Biltegi Zuhaitzean nabarmenduriko kontrolatzailea kentzen du.</translation>
+        <source>Switch to fullscreen mode</source>
+        <translation type="obsolete">Panataila oso modura aldatu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Adds a new attachment to the Storage Tree using currently selected controller as parent.</source>
-        <translation>Eranskin berri bat gehitzen du Biltegi Zuhaitzean unean hautaturiko kontrolatzailea gaineko bezala erabiliz.</translation>
+        <source>Mouse Integration</source>
+        <comment>enable/disable...</comment>
+        <translation type="obsolete">Sagu integrazioa</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Removes the attachment highlighted in the Storage Tree.</source>
-        <translation>Biltegi Zuhaitzean nabarmenduriko eranskina kentzen du.</translation>
+        <source>Auto-resize Guest Display</source>
+        <comment>enable/disable...</comment>
+        <translation type="obsolete">Automatikoki Tamaina Aldatu Bezero Pantaila</translation>
     </message>
     <message>
-        <location line="+277"/>
-        <source>Hard &Disk:</source>
-        <translation>&Diska Gogorra:</translation>
+        <source>Auto-resize &Guest Display</source>
+        <translation type="obsolete">Automatikoki Tamaina Aldatu &Bezero Pantaila</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="+51"/>
-        <source>&Storage Tree</source>
-        <translation>&Biltegi Zuhaitza</translation>
+        <source>Automatically resize the guest display when the window is resized (requires Guest Additions)</source>
+        <translation type="obsolete">Automatikoki tamainaz aldatu bezero pantaila leihoa tamaina aldatzean (Bezero Gehigarriak behar du)</translation>
     </message>
     <message>
-        <location line="+18"/>
-        <source>Contains all storage controllers for this machine and the virtual images and host drives attached to them.</source>
-        <translation>Makina honentzako biltegiratutako kontrolatzaile guztiak eta berari erantsitako irudi birtual eta hostalari gidatzaileak ditu.</translation>
+        <source>&Adjust Window Size</source>
+        <translation type="obsolete">Leiho Tamaina &Doitu</translation>
     </message>
     <message>
-        <location line="+46"/>
-        <location line="+271"/>
-        <source>Information</source>
-        <translation>Argibideak</translation>
+        <source>Adjust window size and position to best fit the guest display</source>
+        <translation type="obsolete">Leiho tamaina eta kokalekua doitu bezero pantaila hobe sartzeko</translation>
     </message>
     <message>
-        <location line="-264"/>
-        <source>The Storage Tree can contain several controllers of different types. This machine currently has no controllers.</source>
-        <translation>Biltegi Zuhaitzak mota ezberdineko kontrolatzaile ugari eduki ditzake. Makina honek orain ez du kontrolatzailerik.</translation>
+        <source>&Insert Ctrl-Alt-Del</source>
+        <translation type="obsolete">B&idali Ktrl-Alt-Ezab</translation>
     </message>
     <message>
-        <location line="+39"/>
-        <location line="+118"/>
-        <source>Attributes</source>
-        <translation>Ezaugarriak</translation>
+        <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
+        <translation type="obsolete">Ktrl+Alt+Ezab sekuentzia bidali makina birtualera</translation>
     </message>
     <message>
-        <location line="-111"/>
-        <source>&Name:</source>
-        <translation>&Izena:</translation>
+        <source>&Insert Ctrl-Alt-Backspace</source>
+        <translation type="obsolete">B&idali Ktrl-Alt-Atzera-tekla</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Changes the name of the storage controller currently selected in the Storage Tree.</source>
-        <translation>Biltegi Zuhaitzean orain hautaturiko biltegi kontrolatzailearen izena aldatzen du.</translation>
+        <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
+        <translation type="obsolete">Ktrl-Alt-Atzera-tekla sekuentzia bidali makina birtualera</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Type:</source>
-        <translation>&Mota:</translation>
+        <source>&Reset</source>
+        <translation type="obsolete">Be&rrezarri</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Selects the sub-type of the storage controller currently selected in the Storage Tree.</source>
-        <translation>Biltegi Zuhaitzean orain hautaturiko biltegi kontrolatzailearen azpi-mota aldatzen du.</translation>
+        <source>Reset the virtual machine</source>
+        <translation type="obsolete">Makina Birtuala berrezarri</translation>
     </message>
     <message>
-        <location line="+42"/>
-        <source>Use Host I/O Cache</source>
-        <translation>Erabili Hostalari S/I Katxea</translation>
+        <source>ACPI S&hutdown</source>
+        <translation type="obsolete">ACPI It&zalia</translation>
     </message>
     <message>
-        <location line="+70"/>
-        <source>Selects the slot on the storage controller used by this attachment. The available slots depend on the type of the controller and other attachments on it.</source>
-        <translation type="unfinished"></translation>
+        <source>Send the ACPI Power Button press event to the virtual machine</source>
+        <translation type="obsolete">ACPI Indar Botoia Gertaera bidali makina birtualera</translation>
     </message>
     <message>
-        <location line="+31"/>
-        <source>When checked, allows the guest to send ATAPI commands directly to the host-drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</source>
-        <translation type="unfinished"></translation>
+        <source>&Close...</source>
+        <translation type="obsolete">It&xi...</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Passthrough</source>
-        <translation>&Igaropena</translation>
+        <source>Close the virtual machine</source>
+        <translation type="obsolete">Makina Birtuala itxi</translation>
     </message>
     <message>
-        <location line="+32"/>
-        <source>&Solid-state Drive</source>
-        <translation>&Egoera-solikodko Gidagailua</translation>
+        <source>Take &Snapshot...</source>
+        <translation type="obsolete">&Egoera-argazkia egin...</translation>
     </message>
     <message>
-        <location line="+54"/>
-        <source>Virtual Size:</source>
-        <translation>Neurri Birtuala:</translation>
+        <source>Take a snapshot of the virtual machine</source>
+        <translation type="obsolete">Makina Birtualaren egoera-argazki bat egin</translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>Actual Size:</source>
-        <translation>Oraingo Neurria:</translation>
+        <source>&Floppy Image...</source>
+        <translation type="obsolete">&Diskete irudia...</translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>Size:</source>
-        <translation>Neurria:</translation>
+        <source>Mount a floppy image file</source>
+        <translation type="obsolete">Diskete irudi bat muntatu</translation>
     </message>
     <message>
-        <location line="+40"/>
-        <source>Location:</source>
-        <translation>Kokalekua:</translation>
+        <source>Unmount F&loppy</source>
+        <translation type="obsolete">Dis&kete Desmuntatu</translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>Attached to:</source>
-        <translation type="unfinished">Hona Erantsita:</translation>
+        <source>Unmount the currently mounted floppy disk image files</source>
+        <translation type="obsolete">Muntaturik dagoen diskete medioa desmuntatu</translation>
     </message>
     <message>
-        <location line="-140"/>
-        <source>Type (Format):</source>
-        <translation>Mota (Heuskarria):</translation>
+        <source>&CD/DVD Image...</source>
+        <translation type="obsolete">&CD/DVD Irudia...</translation>
     </message>
     <message>
-        <source>Attached To:</source>
-        <translation type="obsolete">Hona Erantsita:</translation>
+        <source>Mount a CD/DVD image file</source>
+        <translation type="obsolete">CD/DVD irudi fitxategi bat muntatu</translation>
     </message>
     <message>
-        <location line="-153"/>
-        <source>Allows to use host I/O caching capabilities.</source>
-        <translation>Hostalari S/I katxe gaitasunak erabiltzea ahalbidetzen du.</translation>
+        <source>Unmount C&D/DVD-ROM</source>
+        <translation type="obsolete">C&D/DVD-ROM Desmuntatu</translation>
     </message>
     <message>
-        <source>Use host I/O cache</source>
-        <translation type="obsolete">Erabili hostalari S/I katxea</translation>
+        <source>Unmount the currently mounted CD/DVD media</source>
+        <translation type="obsolete">Muntaturik dagoen CD/DVD medioa desmuntatu</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="-290"/>
-        <source>Add SAS Controller</source>
-        <translation>Gehitu SAS Kontrolatzailea</translation>
+        <source>Remote Desktop (RDP) Server</source>
+        <comment>enable/disable...</comment>
+        <translation type="obsolete">Urruneko Idazmahai Zerbitzaria (RDP)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="+173"/>
-        <source>Type:</source>
-        <translation>Mota:</translation>
+        <source>Remote Dis&play</source>
+        <translation type="obsolete">Urruneko Pan&taila</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="-1476"/>
-        <source>Host Drive</source>
-        <translation>Hostalari Gidagailua</translation>
+        <source>Enable or disable remote desktop (RDP) connections to this machine</source>
+        <translation type="obsolete">Urruneko idazmahai (RDP) konexioak gaitu edo ezgaitu maina honetarako</translation>
     </message>
     <message>
-        <location line="+0"/>
-        <source>Image</source>
-        <translation>Irudia</translation>
+        <source>&Shared Folders...</source>
+        <translation type="obsolete">&Partekatutako Karpetak...</translation>
     </message>
     <message>
-        <location line="+1389"/>
-        <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Create or modify shared folders</source>
+        <translation type="obsolete">Partekatutako karpetekin aritzeko leihoa ireki</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">Bezero Gehigarriak &Instalatu...</translation>
     </message>
     <message>
-        <location line="+18"/>
-        <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>Ez da diska gogorrik hautatu <i>%1</i>-rako.</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Bezero Gehigarri instalazio irudia muntatu</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation type="unfinished"></translation>
+        <source>&Statistics...</source>
+        <translation type="obsolete">E&statistikak...</translation>
     </message>
     <message>
-        <location line="+27"/>
-        <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation type="unfinished"></translation>
+        <source>&Command line...</source>
+        <translation type="obsolete">&Komando lerroa...</translation>
     </message>
     <message>
-        <location line="+322"/>
-        <source>Choose or create a virtual hard disk file. The virtual machine will see the data in the file as the contents of the virtual hard disk.</source>
-        <translation>Hautatu edo sortu diska gogor birtual agiri bat. Makina birtualak agiriko datuak diska gogor birtualeko eduki bezala ikusiko ditu.</translation>
+        <source>&VirtualBox Web Site...</source>
+        <translation type="obsolete">&VirtualBox Web Gunea...</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Set up the virtual hard disk</source>
-        <translation>Ezarri diska gogor birtuala</translation>
+        <source>Open the browser and go to the VirtualBox product web site</source>
+        <translation type="obsolete">Nabigatzailea ireki eta VirtualBox produktuaren gunera joan</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD &Gidagailua:</translation>
+        <source>&About VirtualBox...</source>
+        <translation type="obsolete">VirtualBox - &Honi Buruz...</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Hautatu gidagailu birtualarekin erabiltzeko CD/DVD diska bat edo gidagailu fisiko bat. Makina birtualak gidagailuan txertaturiko diska bat ikusiko du agiriko datuekin edo gidagailu fisikoko diskan bere edukiak bezala.</translation>
+        <source>Show a window with product information</source>
+        <translation type="obsolete">Karpeta hauatzeko leiho bat irekitzen du</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation>Ezarri CD/DVD gidagailu birtuala</translation>
+        <source>&Reset All Warnings</source>
+        <translation type="obsolete">Abisu Guztiak Be&rrezarri</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Floppy &Drive:</source>
-        <translation>&Diskete Gidagailua:</translation>
+        <source>Go back to showing all suppressed warnings and messages</source>
+        <translation type="obsolete">Ezabatutako abisu eta mezu guztiak berriz agertzea eragien du</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Choose a virtual floppy disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation type="unfinished"></translation>
+        <source>Mount &Floppy</source>
+        <translation type="obsolete">Dis&ketea Muntatu</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Set up the virtual floppy drive</source>
-        <translation>Ezarri diskete birtual gidagailua</translation>
+        <source>Mount &CD/DVD</source>
+        <translation type="obsolete">C&D/DVD-ROM muntatu</translation>
     </message>
     <message>
-        <location line="+128"/>
-        <source>Create a new hard disk...</source>
-        <translation>Sortu diska gogor berri bat...</translation>
+        <source>&USB Devices</source>
+        <translation type="obsolete">&USB Gailuak</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Choose a virtual hard disk file...</source>
-        <translation>Hautatu diska gogor birtual agiri bat...</translation>
+        <source>&Devices</source>
+        <translation type="obsolete">&Gailuak</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="+317"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="+8"/>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Hautatu CD/DVD birtual diska agiri bat...</translation>
+        <source>De&bug</source>
+        <translation type="obsolete">Ara&zpena</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location line="+6"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="+7"/>
-        <location line="+17"/>
-        <source>Remove disk from virtual drive</source>
-        <translation>Kendu diska gidagailu birtualetik</translation>
+        <source>&Help</source>
+        <translation type="obsolete">&Laguntza</translation>
     </message>
     <message>
-        <location line="-1"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="-7"/>
-        <source>Choose a virtual floppy disk file...</source>
-        <translation>Hautatu diskete diska birtual agiri bat...</translation>
+        <source>Indicates whether the guest display auto-resize function is On (<img src=:/auto_resize_on_16px.png/>) or Off (<img src=:/auto_resize_off_16px.png/>). Note that this function requires Guest Additions to be installed in the guest OS.</source>
+        <translation type="obsolete">Bezero pantaila automatikoki tamainaz aldatzeko funtzioa gaiturik (<img src=:/auto_resize_on_16px.png/>) edo ezgaiturik (<img src=:/auto_resize_off_16px.png/>) dagoen erakusten du. Kontutan izan funtzio honek Bezero Gehigarriak sistema eragile bezeroan instalaturik egotea behar duela.</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="-53"/>
-        <source>When checked the virtual disk will not be removed when the guest system ejects it.</source>
-        <translation>Hautatutakoan diska birtuala ez da kenduko gonbidatu sistemak ateratzen  duenean.</translation>
+        <source>Indicates whether the host mouse pointer is captured by the guest OS:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer is captured</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;mouse integration (MI) is On</nobr><br><nobr><img src=:/mouse_can_seamless_ [...]
+        <translation type="obsolete">Bezeroaren sistema eragileak sagu markatzailea kapturatzen duen erakusten du:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;markatzailea ez da kapturatzen</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;markatzailea kapturatzen da</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;sagu integrazioa (MI) gaiturik dago</nobr>< [...]
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Live CD/DVD</source>
-        <translation>&Live CD/DVD</translation>
+        <source>Shows the currently assigned Host key.<br>This key, when pressed alone, toggles the the keyboard and mouse capture state. It can also be used in combination with other keys to quickly perform actions from the main menu.</source>
+        <translation type="obsolete">Ezarririk dagoen Ostalari tekla erakusten du.<br>Tekla honek, bakarrik sakatzean, sagu eta teklatu kapturatze egoera aldatzen . du. Menu nagusitik ekintzak azkar abiarazteko erabili daiteke beste tekla batzuekin batera sakatuaz.</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>When checked the guest system will see the virtual disk as a solid state device.</source>
-        <translation>Hautatutakoan gonbidatu sistemak diska birtuala egoera solidoko gailu bat bezala ikusiko du.</translation>
+        <source><hr>The VRDP Server is listening on port %1</source>
+        <translation type="obsolete"><hr>VRDP Zerbitzaria %1 atakan entzuten ari da</translation>
     </message>
     <message>
-        <source>&Solid-state drive</source>
-        <translation type="obsolete">&Egoera-solido gidagailua</translation>
+        <source>&Pause</source>
+        <translation type="obsolete">&Gelditu</translation>
     </message>
     <message>
-        <location line="+117"/>
-        <source>Details:</source>
-        <translation>Xehetasunak:</translation>
+        <source>Suspend the execution of the virtual machine</source>
+        <translation type="obsolete">Makina Birtualaren exekuzioa gelditu</translation>
     </message>
     <message>
-        <source>no name specified for controller at position <b>%1</b>.</source>
-        <translation type="obsolete">ez da izenik adierazi kontrolatzailearentzat <b>%1</b> kokapenean.</translation>
+        <source>R&esume</source>
+        <translation type="obsolete">Ja&rraitu</translation>
     </message>
     <message>
-        <source>controller at position <b>%1</b> uses the name that is already used by controller at position <b>%2</b>.</source>
-        <translation type="obsolete"><b>%1</b> kokapeneko kontrolatzaileak jadanik <b>%2</b> kokapeneko kontrolatzaileak erabiltzen duen izena erabiltzen du.</translation>
+        <source>Resume the execution of the virtual machine</source>
+        <translation type="obsolete">Makina birtualaren exekuzioa jarraitu</translation>
     </message>
     <message>
-        <source>no hard disk is selected for <i>%1</i>.</source>
-        <translation type="obsolete">ez da diska gogorrik hautatu <i>%1</i>-rako.</translation>
+        <source>Disable &Mouse Integration</source>
+        <translation type="obsolete">&Sagu Integrazioa ezgaitu</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="-505"/>
-        <source>at most one supported</source>
-        <comment>controller</comment>
-        <translation type="unfinished"></translation>
+        <source>Temporarily disable host mouse pointer integration</source>
+        <translation type="obsolete">Aldirako ezgaitu sagu markatzaile integrazioa</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>up to %1 supported</source>
-        <comment>controllers</comment>
-        <translation type="unfinished"></translation>
+        <source>Enable &Mouse Integration</source>
+        <translation type="obsolete">&Sagu integrazioa gaitu</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="-279"/>
-        <source>&Port Count:</source>
-        <translation>&Ataka Zenbatekoa:</translation>
+        <source>Enable temporarily disabled host mouse pointer integration</source>
+        <translation type="obsolete">Aldirako ezgaituriko sagu markatzaile integrazioa gaitu</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Selects the port count of the SATA storage controller currently selected in the Storage Tree. This must be at least one more than the highest port number you need to use.</source>
-        <translation type="unfinished"></translation>
+        <source>Snapshot %1</source>
+        <translation type="obsolete">%1 egoera-argazkia</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="+551"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-642"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="-477"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="-1632"/>
-        <source>Controller: %1</source>
-        <translation>Kontrolatzailea: %1</translation>
+        <source>Host Drive </source>
+        <translation type="obsolete">Ostalari Gailua </translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSystem</name>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">Zure ordenagailuaren (<b>%2</b>) <b>%1%</b> baino oroimen gehigo duzu esleituta makina birtualera. Ez da nahikoa oroimen gelditzen zure hostalari sistema eragilerako. Mesedez hautatu kopuru txikiago bat.</translation>
+        <source>&Machine</source>
+        <translation type="obsolete">&Makina</translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">Zure ordenagailuaren (<b>%2</b>) <b>%1%</b> baino oroimen gehigo duzu esleituta makina birtualera. Badaiteke nahikoa oroimen ez gelditzea zure hostalari sistema eragilerako. Jarraitu zeure arriskupean.</translation>
+        <source>&Network Adapters</source>
+        <translation type="obsolete">&Sare Moldagailuak</translation>
     </message>
     <message>
-        <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation type="obsolete">egintza zergaitiengaitik, makina birtualera erantsitako CPU birtual zenbatekoa ezin da hostalariko CPU fisikoak (<b>%1</b> baino bi aldiz gehiago izan. Mesedez murriztu CPU birtual zenbatekoa.</translation>
+        <source>Adapter %1</source>
+        <comment>network</comment>
+        <translation type="obsolete">%1 Moldagailua</translation>
     </message>
     <message>
-        <source>you have assigned more virtual CPUs to the virtual machine than the number of physical CPUs on your host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation type="obsolete">zure hostalari sistemak dituen CPU fisiko zenbatekoa (<b>%1</b>) baino CPU birtual gehiago esleitu dizkiozu makina birtualari. Honek zure makina birtualaren egintza itsusituko du. Mesedez kontuan hartu CPU birtual zenbatekoa gutxitzea.</translation>
+        <source>Mount the selected physical drive of the host PC</source>
+        <comment>Floppy tip</comment>
+        <translation type="obsolete">Ostalari PC-ko hautaturiko gailu fisikoa muntatu</translation>
     </message>
     <message>
-        <source>you have assigned more than one virtual CPU to this VM. This will not work unless the IO-APIC feature is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source>
-        <translation type="obsolete">CPU birtual bat baino gehiago esleitu dizkiozu MB honi. Honek ez du lan egingo IO-APIC ezaugarria ere gaituta ez badago. Hau berezgaitasunez egingo da MB Ezarpenak onartzen dituzunean Ongi botoia sakatuz.</translation>
+        <source>Disconnect the cable from the selected virtual network adapter</source>
+        <translation type="obsolete">Hautaturiko sare moldagailuaren kablea deskonektatu</translation>
     </message>
     <message>
-        <source>you have assigned more than one virtual CPU to this VM. This will not work unless hardware virtualization (VT-x/AMD-V) is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source>
-        <translation type="obsolete">CPU birtual bat baino gehiago esleitu dizkiozu MB honi. Honek ez du lan egingo hardware birtualizazioa (VT-x/AMD-V) ere gaituta ez badago. Hau berezgaitasunez egingo da MB Ezarpenak onartzen dituzunean Ongi botoia sakatuz.</translation>
+        <source>Connect the cable to the selected virtual network adapter</source>
+        <translation type="obsolete">Hautaturiko sare moldagailuaren kablea konektatu</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="+302"/>
-        <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation type="unfinished"></translation>
+        <source>Seam&less Mode</source>
+        <translation type="obsolete">Gardenta&sun Modua</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation type="unfinished"></translation>
+        <source>Switch to seamless desktop integration mode</source>
+        <comment>Garden?? Ez dut argi esannahai</comment>
+        <translation type="obsolete">Idazmahai integrazio garden modura aldatu</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation type="unfinished"></translation>
+        <source><qt><nobr>Indicates the activity of the floppy disk image files:</nobr>%1</qt></source>
+        <comment>Floppy tooltip</comment>
+        <translation type="obsolete"><qt><nobr>Diskete medioaren aktibitatea erakusten du:</nobr>%1</qt></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation type="unfinished"></translation>
+        <source><br><nobr><b>Host Drive</b>: %1</nobr></source>
+        <comment>Floppy tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Ostalari Gailua</b>: %1</nobr></translation>
     </message>
     <message>
-        <location line="+21"/>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation type="unfinished"></translation>
+        <source><br><nobr><b>Image</b>: %1</nobr></source>
+        <comment>Floppy tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Irudia</b>: %1</nobr></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation type="unfinished"></translation>
+        <source><br><nobr><b>No media mounted</b></nobr></source>
+        <comment>Floppy tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Ez dago medio muntaturik</b></nobr></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation type="unfinished"></translation>
+        <source><qt><nobr>Indicates the activity of the CD/DVD media:</nobr>%1</qt></source>
+        <comment>DVD-ROM tooltip</comment>
+        <translation type="obsolete"><qt><nobr>CD/DVD medioaren aktibitatea erakusten du:</nobr>%1</qt></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation type="unfinished"></translation>
+        <source><qt><nobr>Indicates activity on the the virtual hard disks:</nobr>%1</qt></source>
+        <comment>HDD tooltip</comment>
+        <translation type="obsolete"><qt><nobr>Disko gogor birtualen aktibitatea erakusten du:</nobr>%1</qt></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation type="unfinished"></translation>
+        <source><br><nobr><b>No hard disks attached</b></nobr></source>
+        <comment>HDD tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Ez dago disko gogorrik erantsirik</b></nobr></translation>
     </message>
     <message>
-        <location line="+49"/>
-        <location line="+1"/>
-        <source><qt>%1&nbsp;MB</qt></source>
-        <translation><qt>%1&nbsp;MB</qt></translation>
+        <source><qt><nobr>Indicates the activity of the network interfaces:</nobr>%1</qt></source>
+        <comment>Network adapters tooltip</comment>
+        <translation type="obsolete"><qt><nobr>Sare interfazeen aktibitatea erakusten du:</nobr>%1</qt></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><qt>%1&nbsp;CPU</qt></source>
-        <comment>%1 is 1 for now</comment>
-        <translation><qt>%1&nbsp;CPU</qt></translation>
+        <source><br><nobr><b>Adapter %1 (%2)</b>: cable %3</nobr></source>
+        <comment>Network adapters tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Moldagailua: %1 (%2)</b>: kablea %3</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="+22"/>
-        <source>&Motherboard</source>
-        <translation>&Ohinplaka</translation>
+        <source>connected</source>
+        <comment>Network adapters tooltip</comment>
+        <translation type="obsolete">konektatuta</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Base &Memory:</source>
-        <translation>&Ohinarri Oroimena:</translation>
+        <source>disconnected</source>
+        <comment>Network adapters tooltip</comment>
+        <translation type="obsolete">deskonektatuta</translation>
     </message>
     <message>
-        <location line="+25"/>
-        <location line="+41"/>
-        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
-        <translation>Makina birtutalari hornitutako oroimen kopurua kontrolatzen du. Gehiegi esleitzen baduzu, badaiteke makina ez abiatzea.</translation>
+        <source><br><nobr><b>All network adapters are disabled</b></nobr></source>
+        <comment>Network adapters tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Sare moldagailu guztiak ezgaiturik daude</b></nobr></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>MB</source>
-        <translation>MB</translation>
+        <source><qt><nobr>Indicates the activity of the attached USB devices:</nobr>%1</qt></source>
+        <comment>USB device tooltip</comment>
+        <translation type="obsolete"><qt><nobr>Erantsiriko USB gailuen aktibitatea erakusten du:</nobr>%1</qt></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>&Boot Order:</source>
-        <translation>&Abiarazpen Hurrenkera:</translation>
+        <source><br><nobr><b>No USB devices attached</b></nobr></source>
+        <comment>USB device tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Ez dago USB gailurik erantsirik</b></nobr></translation>
     </message>
     <message>
-        <location line="+24"/>
-        <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
-        <translation>Gailu abiarazte hurrenkera zehazten du. Erabili ezkerreko hautakutxak banakako abiarazpen gailuak gaitzeko edo ezgaitzeko. Mugitu gaiak gora edo behera gailu hurrenkera aldatzeko.</translation>
+        <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
+        <comment>USB device tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>USB Kontrolatzailea ezgaiturik dago</b></nobr></translation>
     </message>
     <message>
-        <location line="+52"/>
-        <source>Move Down (Ctrl-Down)</source>
-        <translation>Mugitu Behera (Ktrl-Behera)</translation>
+        <source>Indicates whether the Remote Display (VRDP Server) is enabled (<img src=:/vrdp_16px.png/>) or not (<img src=:/vrdp_disabled_16px.png/>).</source>
+        <translation type="obsolete">Urruneko Pantaila (VRDP Zerbitzaria) gaiturik dagoen (<img src=:/vrdp_16px.png/>) ala ez (<img src=:/vrdp_disabled_16px.png/>) erakusten du.</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Moves the selected boot device down.</source>
-        <translation>Abiarazpen gailua behera mugitzen du.</translation>
+        <source><qt><nobr>Indicates the activity of the machineof the machine'sapos;s shared folders: shared folders:</nobr>%1</qt></source>
+        <comment>Shared folders tooltip</comment>
+        <translation type="obsolete"><qt><nobr>Partekatutako karpeten aktibitatea ezartzen du:</nobr>%1</qt></translation>
     </message>
     <message>
-        <location line="-26"/>
-        <source>Move Up (Ctrl-Up)</source>
-        <translation>Mugitu Gora (Ktrl-Gora)</translation>
+        <source><br><nobr><b>No shared folders</b></nobr></source>
+        <comment>Shared folders tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Ez dago partekatutako karpetarik</b></nobr></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Moves the selected boot device up.</source>
-        <translation>Abiarazpen gailua gora mugitzen du.</translation>
+        <source>Switch to seamless desktop integration mode</source>
+        <translation type="obsolete">Idazmahai integrazio garden modura aldatu</translation>
     </message>
     <message>
-        <location line="+156"/>
-        <location line="+194"/>
-        <source>Extended Features:</source>
-        <translation>Ezaugarri Hedatuak:</translation>
+        <source>&Contents...</source>
+        <translation type="obsolete">&Edukiak...</translation>
     </message>
     <message>
-        <source>Enable &IO APIC</source>
-        <translation type="obsolete">Gaitu &IO APIC</translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location line="-140"/>
-        <source>&Processor</source>
-        <translation>&Prozesagailuak</translation>
+        <source>Show the online help contents</source>
+        <translation type="obsolete">Sare bidezko laguntza edukia bistarazi</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>&Processor(s):</source>
-        <translation>&Prozesagailua(k):</translation>
+        <source><br><nobr><b>Host Drive</b>: %1</nobr></source>
+        <comment>DVD-ROM tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Ostalari Gailua</b>: %1</nobr></translation>
     </message>
     <message>
-        <location line="+144"/>
-        <source>When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine.</source>
-        <translation type="unfinished"></translation>
+        <source><br><nobr><b>Image</b>: %1</nobr></source>
+        <comment>DVD-ROM tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Irudia</b>: %1</nobr></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable PA&E/NX</source>
-        <translation>Gaitu PA&E/NX</translation>
+        <source><br><nobr><b>No media mounted</b></nobr></source>
+        <comment>DVD-ROM tooltip</comment>
+        <translation type="obsolete"><br><nobr><b>Ez dago medio muntaturik</b></nobr></translation>
     </message>
     <message>
-        <location line="+21"/>
-        <source>Acce&leration</source>
-        <translation>&Bizkorpena</translation>
+        <source>Mount the selected physical drive of the host PC</source>
+        <comment>CD/DVD tip</comment>
+        <translation type="obsolete">Ostalari PC-ko hautaturiko gailu fisikoa muntatu</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Hardware Virtualization:</source>
-        <translation>Hardware Birtualizazioa:</translation>
+        <source>&Statistics...</source>
+        <comment>debug action</comment>
+        <translation type="obsolete">E&statistikak...</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V.</source>
-        <translation>Hautatutakoan, makina birtuala Intel VT-x eta AMD-V bezalako hostalari CPU-aren hardware birtualizazio hedapenak erabiltzen saiatuko da.</translation>
+        <source>No supported devices connected to the host PC</source>
+        <translation type="obsolete">Ez dago onartutako gailurik konektaturik ostalari PC-ra</translation>
     </message>
+</context>
+<context>
+    <name>VBoxDiskImageManagerDlg</name>
     <message>
-        <location line="+3"/>
-        <source>Enable &VT-x/AMD-V</source>
-        <translation>Gaitu &VT-x/AMD-V</translation>
+        <source>Name</source>
+        <translation type="obsolete">Izena</translation>
+    </message>
+    <message>
+        <source>Virtual Size</source>
+        <translation type="obsolete">Tamaina Birtuala</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source>
-        <translation type="unfinished"></translation>
+        <source>Actual Size</source>
+        <translation type="obsolete">Uneko Tamaina</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable Nested Pa&ging</source>
-        <translation>Gaitu &Nested Orrialdeztapena</translation>
+        <source>Size</source>
+        <translation type="obsolete">Tamaina</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="+1"/>
-        <source><qt>%1&nbsp;CPUs</qt></source>
-        <comment>%1 is host cpu count * 2 for now</comment>
-        <translation><qt>%1&nbsp;CPU</qt></translation>
+        <source>Virtual Disk Manager</source>
+        <translation type="obsolete">Disko Birtual Kudeatzailea</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="-246"/>
-        <source>When checked, the guest will support the Extended Firmware Interface (EFI), which is required to boot certain guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</source>
-        <translation type="unfinished"></translation>
+        <source>&Hard Disks</source>
+        <translation type="obsolete">Disko &Gogorrak</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable &EFI (special OSes only)</source>
-        <translation>Gaitu &EFI (SE bereziak bakarrik)</translation>
+        <source>&CD/DVD Images</source>
+        <translation type="obsolete">&CD/DVD Irudiak</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>If checked, the RTC device will report the time in UTC, otherwise in local (host) time. Unix usually expects the hardware clock to be set to UTC.</source>
-        <translation type="unfinished"></translation>
+        <source>&Floppy Images</source>
+        <translation type="obsolete">&Diskete irudiak</translation>
     </message>
     <message>
-        <source>Hardware clock in &UTC time</source>
-        <translation type="obsolete">Hardware ordularia &UTC orduan</translation>
+        <source>Help</source>
+        <translation type="obsolete">Laguntza</translation>
     </message>
     <message>
-        <location line="+55"/>
-        <location line="+39"/>
-        <source>Controls the number of virtual CPUs in the virtual machine. You need hardware virtualization support on your host system to use more than one virtual CPU.</source>
-        <translation>Makina birtualeko CPU birtual zenbatekoa kontrolatzen du. Hardware birtualizazio sostengua behar duzu zure hostalari sisteman CPU birtual bat baino gehiago erabiltzeko.</translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location line="-210"/>
-        <source>&Chipset:</source>
-        <translation>&Chipseta:</translation>
+        <source>Invoke dialog's help</source>
+        <translation type="obsolete">Leiho laguntza deitzen du</translation>
     </message>
     <message>
-        <location line="+21"/>
-        <source>Selects the chipset to be emulated in this virtual machine. Note that the ICH9 chipset emulation is experimental and not recommended except for guest systems (such as Mac OS X) which require it.</source>
-        <translation type="unfinished"></translation>
+        <source>&OK</source>
+        <translation type="obsolete">&Ados</translation>
     </message>
     <message>
-        <location line="+22"/>
-        <source>&Pointing Device:</source>
-        <translation type="unfinished"></translation>
+        <source>Alt+O</source>
+        <translation type="obsolete">ALt+A</translation>
     </message>
     <message>
-        <location line="+21"/>
-        <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation type="unfinished"></translation>
+        <source>Accept dialog</source>
+        <translation type="obsolete">Liehoa onartu</translation>
     </message>
     <message>
-        <location line="+32"/>
-        <source>When checked, the virtual machine will support the Input Output APIC (I/O APIC), which may slightly decrease performance. <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
-        <translation type="unfinished"></translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable &I/O APIC</source>
-        <translation>Gaitu &S/I APIC</translation>
+        <source>Cancel dialog</source>
+        <translation type="obsolete">Utzi leihoa</translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>Hardware Clock in &UTC Time</source>
-        <translation>Hardware Ordularia &UTC Orduan</translation>
+        <source>--</source>
+        <comment>no info</comment>
+        <translation type="obsolete">--</translation>
     </message>
     <message>
-        <location line="+98"/>
-        <source>&Execution Cap:</source>
-        <translation>&Exekuzio Muga:</translation>
+        <source>&New...</source>
+        <translation type="obsolete">&Berria...</translation>
     </message>
     <message>
-        <location line="+18"/>
-        <location line="+38"/>
-        <source>Limits the amount of time that each virtual CPU is allowed to run for. Each virtual CPU will be allowed to use up to this percentage of the processing time available on one physical CPU. The execution cap can be disabled by setting it to 100%. Setting the cap too low can make the machine feel slow to respond.</source>
-        <translation type="unfinished"></translation>
+        <source>&Add...</source>
+        <translation type="obsolete">&Gehitu...</translation>
     </message>
     <message>
-        <source>you have set the processor execution cap to a low value. This can make the machine feel slow to respond.</source>
-        <translation type="obsolete">exekuzio muga bailo apal batean ezarri duzu. Honek makinak astiro erantzutea eragingo du.</translation>
+        <source>R&emove</source>
+        <translation type="obsolete">K&endu</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="+3"/>
-        <source><qt>%1%</qt></source>
-        <comment>Min CPU execution cap in %</comment>
-        <translation><qt>%1%</qt></translation>
+        <source>Re&lease</source>
+        <translation type="obsolete">Argi&taratu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source><qt>%1%</qt></source>
-        <comment>Max CPU execution cap in %</comment>
-        <translation><qt>%1%</qt></translation>
+        <source>Re&fresh</source>
+        <translation type="obsolete">&Freskatu</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsUSB</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="+438"/>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation type="unfinished"></translation>
+        <source>New</source>
+        <translation type="obsolete">Berria</translation>
     </message>
     <message>
-        <location line="+27"/>
-        <source>&Add Empty Filter</source>
-        <translation>&Gehitu Iragazki Hutsa</translation>
+        <source>Add</source>
+        <translation type="obsolete">Gehitu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>A&dd Filter From Device</source>
-        <translation>G&ehitu Iragazkia Gailutik</translation>
+        <source>Remove</source>
+        <translation type="obsolete">Kendu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Edit Filter</source>
-        <translation>&Editatu Iragazkia</translation>
+        <source>Release</source>
+        <translation type="obsolete">Atera</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Remove Filter</source>
-        <translation>&Kendu Iragazkia</translation>
+        <source>Refresh</source>
+        <translation type="obsolete">Freskatu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Move Filter Up</source>
-        <translation>&Mugitu Iragazkia Gora</translation>
+        <source>Ctrl+N</source>
+        <translation type="obsolete">Ktrl+N</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>M&ove Filter Down</source>
-        <translation>M&ugitu Iragazkia Behera</translation>
+        <source>Ctrl+A</source>
+        <translation type="obsolete">Ktrl+A</translation>
     </message>
     <message>
-        <location line="+15"/>
-        <source>Adds a new USB filter with all fields initially set to empty strings. Note that such a filter will match any attached USB device.</source>
-        <translation type="unfinished"></translation>
+        <source>Ctrl+D</source>
+        <translation type="obsolete">Ktrl+D</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Adds a new USB filter with all fields set to the values of the selected USB device attached to the host PC.</source>
-        <translation>USB iragazki berri bat gehitzen du eremu guztietan hautaturiko hostalari PG-ra erantsitako USB gailuaren balioak ezarriz.</translation>
+        <source>Ctrl+L</source>
+        <translation type="obsolete">Ktrl+L</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Edits the selected USB filter.</source>
-        <translation>Hautaturiko USB iragazkia editatzen du.</translation>
+        <source>Ctrl+R</source>
+        <translation type="obsolete">Ktrl+R</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Removes the selected USB filter.</source>
-        <translation>Hautaturiko USB iragazkia kentzen du.</translation>
+        <source>&Actions</source>
+        <translation type="obsolete">&Ekintzak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Moves the selected USB filter up.</source>
-        <translation>Hautaturiko USB iragazkia gora mugitzen du.</translation>
+        <source>Location</source>
+        <translation type="obsolete">Kokalekuak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Moves the selected USB filter down.</source>
-        <translation>Hautaturiko USB iragazkia behera mugitzen du.</translation>
+        <source>Disk Type</source>
+        <translation type="obsolete">Disko Mota</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>New Filter %1</source>
-        <comment>usb</comment>
-        <translation>Iragazki Berria %1</translation>
+        <source>Storage Type</source>
+        <translation type="obsolete">Biltegiratze Mota</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.ui" line="+29"/>
-        <source>When checked, enables the virtual USB controller of this machine.</source>
-        <translation>Hautatutakoan, makina honen USB kontrolatzaile birtuala gaitzen du.</translation>
+        <source>Attached to</source>
+        <translation type="obsolete">Honi erantsia</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable &USB Controller</source>
-        <translation>Gaitu &USB Kontrolatzailea</translation>
+        <source>Snapshot</source>
+        <translation type="obsolete">Egoera-argazkia</translation>
     </message>
     <message>
-        <location line="+41"/>
-        <source>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</source>
-        <translation>Hautatutakoan, makina honen USB EHCI kontrolatzaile birtuala gaitzen du. USB EHCI kontrolatzaileak USB 2.0 sostengua ematen du.</translation>
+        <source>Checking accessibility</source>
+        <translation type="obsolete">Eskuragarritasuna egiaztatzen</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Gaitu USB 2.0 (E&HCI) Kontrolatzailea</translation>
+        <source><nobr><b>%1</b></nobr><br>Checking accessibility...</source>
+        <comment>HDD</comment>
+        <translation type="obsolete"><nobr><b>%1</b></nobr><br>Eskuragarritasuna egiaztatzen...</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>USB Device &Filters</source>
-        <translation>USB Gailu &Iragazkiak</translation>
+        <source><nobr><b>%1</b></nobr><br><nobr>Disk type:&nbsp;&nbsp;%2</nobr><br><nobr>Storage type:&nbsp;&nbsp;%3</nobr></source>
+        <translation type="obsolete"><nobr><b>%1</b></nobr><br><nobr>Disko mota:&nbsp;&nbsp;%2</nobr><br><nobr>Biltegiratze mota:&nbsp;&nbsp;%3</nobr></translation>
     </message>
     <message>
-        <location line="+37"/>
-        <source>Lists all USB filters of this machine. The checkbox to the left defines whether the particular filter is enabled or not. Use the context menu or buttons to the right to add or remove USB filters.</source>
-        <translation>Makina honetako USB iragazki guztiak zerrendatzen ditu. Ezkerreko hautakutxak zein iragazki bereizi gaitzen den edo ez zehazten du. Erabili hitzinguru menua edo eskuineko botoiak USB iragazkiak gehitzeko edo kentzeko.</translation>
+        <source><br><nobr>Attached to:&nbsp;&nbsp;%1</nobr></source>
+        <comment>HDD</comment>
+        <translation type="obsolete"><br><nobr>Non erantsia:&nbsp;&nbsp;%1</nobr></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>[filter]</source>
-        <translation>[iragazkia]</translation>
+        <source><br><nobr>Snapshot:&nbsp;&nbsp;%5</nobr></source>
+        <comment>HDD</comment>
+        <translation type="obsolete"><br><nobr>Egoera-argazkia:&nbsp;&nbsp;%5</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="+263"/>
-        <source><nobr>Vendor ID: %1</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Saltzaile ID-a: %1</nobr></translation>
+        <source><nobr><b>%1</b></nobr><br>Error checking accessibility of disk image files</source>
+        <comment>HDD</comment>
+        <translation type="obsolete"><nobr><b>%1</b></nobr><br>Errorea medio eskuragarritasuna egiaztatzen</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><nobr>Product ID: %2</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Produktu ID-a: %2</nobr></translation>
+        <source><nobr><b>%1</b></nobr><br>%2</source>
+        <comment>HDD</comment>
+        <translation type="obsolete"><nobr><b>%1</b></nobr><br>%2</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><nobr>Revision: %3</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Berrikuspena: %3</nobr></translation>
+        <source><nobr><b>%1</b></nobr></source>
+        <comment>CD/DVD/Floppy</comment>
+        <translation type="obsolete"><nobr><b>%1</b></nobr></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><nobr>Product: %4</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Produktua: %4</nobr></translation>
+        <source>The image file is not accessible</source>
+        <comment>CD/DVD/Floppy</comment>
+        <translation type="obsolete">Irudi fitxategia ez dago eskuragarri</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><nobr>Manufacturer: %5</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Ekoizlea: %5</nobr></translation>
+        <source>&Select</source>
+        <translation type="obsolete">&Hautatu</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><nobr>Serial No.: %1</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Serial Zbk.: %1</nobr></translation>
+        <source>All hard disk images (*.vdi; *.vmdk);;Virtual Disk images (*.vdi);;VMDK images (*.vmdk);;All files (*)</source>
+        <translation type="obsolete">Disko gogor irudi guztiak (*.vdi; *.vmdk);;Disko Birtual irudiak (*.vdi);;VMDK irudiak (*.vmdk);;Fitxategi guztiak (*)</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><nobr>Port: %1</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Ataka: %1</nobr></translation>
+        <source>Select a hard disk image file</source>
+        <translation type="obsolete">Disko gogor irudi fitxategia hautatu</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr>State: %1</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Egoera: %1</nobr></translation>
+        <source>Select a CD/DVD disk image file</source>
+        <translation type="obsolete">Hautatu CD/DVD disko irudi fitxategi bat</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsUSBFilterDetails</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp" line="+52"/>
-        <source>Any</source>
-        <comment>remote</comment>
-        <translation>Edozein</translation>
+        <source>Select a floppy disk image files</source>
+        <translation type="obsolete">Hautatu diskete irudi fitxategi bat</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Yes</source>
-        <comment>remote</comment>
-        <translation>Bai</translation>
+        <source>Create a new virtual hard disk</source>
+        <translation type="obsolete">Sortu disko birtual berri bat</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>No</source>
-        <comment>remote</comment>
-        <translation>Ez</translation>
+        <source>Add (register) an existing image file</source>
+        <translation type="obsolete">Gehitu (erregistratu) dagoen irudi fitxategi bat</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="+38"/>
-        <source>&Name:</source>
-        <translation>&Izena:</translation>
+        <source>Remove (unregister) the selected media</source>
+        <translation type="obsolete">Ezabatu (erregistroa kendu) hautatutako irudi fitxategia</translation>
     </message>
     <message>
-        <source>Displays the filter name.</source>
-        <translation type="obsolete">Iragazki izena erakusten du.</translation>
+        <source>Release the selected media by detaching it from the machine</source>
+        <translation type="obsolete">Atera hautatutako medioa berau makinatik kentzen</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Holds the filter name.</source>
-        <translation type="unfinished"></translation>
+        <source>Refresh the list of disk image files</source>
+        <translation type="obsolete">Medio zerrenda freskatu</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Vendor ID:</source>
-        <translation>&Saltzaile ID-a:</translation>
+        <source>CD/DVD images (*.iso);;All files (*)</source>
+        <translation type="obsolete">CD/DVD irudiak (*.iso);;Fitxategi guztiak (*)</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Defines the vendor ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
-        <translation>Saltzaile ID iragazkia zehazten du. <i>berdin zehatz</i> kate heuskarria da <tt>XXXX</tt> non <tt>X</tt> zenbaki hexadezimal bat da. Kate huts batek edozein balio berdinduko du.</translation>
+        <source>Floppy images (*.img);;All files (*)</source>
+        <translation type="obsolete">Diskete irudiak (*.img);;Fitxategi guztiak (*)</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Product ID:</source>
-        <translation>&Produktu ID-a:</translation>
+        <source><nobr><b>%1</b></nobr><br>Checking accessibility...</source>
+        <comment>CD/DVD/Floppy</comment>
+        <translation type="obsolete"><nobr><b>%1</b></nobr><br>Eskuragarritasuna egiaztatzen...</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Defines the product ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
-        <translation>Ekoizle ID iragazkia zehazten du. <i>berdin zehatz</i> kate heuskarria da <tt>XXXX</tt> non <tt>X</tt> zenbaki hexadezimal bat da. Kate huts batek edozein balio berdinduko du.</translation>
+        <source><br><nobr>Attached to:&nbsp;&nbsp;%1</nobr></source>
+        <comment>CD/DVD/Floppy</comment>
+        <translation type="obsolete"><br><nobr>Non erantsia:&nbsp;&nbsp;%1</nobr></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Revision:</source>
-        <translation>&Berrikuspena:</translation>
+        <source><nobr><b>%1</b></nobr><br>Error checking accessibility of disk image files</source>
+        <comment>CD/DVD/Floppy</comment>
+        <translation type="obsolete"><nobr><b>%1</b></nobr><br>Errorea medio eskuragarritasuna egiaztatzen</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Defines the revision number filter. The <i>exact match</i> string format is <tt>IIFF</tt> where <tt>I</tt> is a decimal digit of the integer part and <tt>F</tt> is a decimal digit of the fractional part. An empty string will match any value.</source>
-        <translation type="unfinished"></translation>
+        <source><nobr><b>%1</b></nobr><br>%2</source>
+        <translation type="obsolete"><nobr><b>%1</b></nobr><br>%2</translation>
     </message>
+</context>
+<context>
+    <name>VBoxEmptyFileSelector</name>
     <message>
-        <location line="+7"/>
-        <source>&Manufacturer:</source>
-        <translation>&Ekoizlea:</translation>
+        <source>Choose...</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxFilePathSelectorWidget</name>
     <message>
-        <location line="+13"/>
-        <source>Defines the manufacturer filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>Ekoizle iragazkia zehazten du <i>berdin zehatz</i> kate bat bezala. Kate huts batek edozein balio berdinduko du.</translation>
+        <source><reset to default></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Pro&duct:</source>
-        <translation>Pr&oduktua:</translation>
+        <source><not selected></source>
+        <translation type="unfinished"><ez hautaturik></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Defines the product name filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>Produktuaren izen iragazkia zehazten du <i>berdin zehatz</i> kate bat bezala. Kate huts batek edozein balio berdinduko du.</translation>
+        <source>Please use the <b>Other...</b> item from the drop-down list to select a path.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>&Serial No.:</source>
-        <translation>&Serie Zbk:</translation>
+        <source>Other...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Defines the serial number filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>Serie zenbaki iragazkia zehazten du <i>berdin zehatz</i> kate bat bezala. Kate huts batek edozein balio berdinduko du.</translation>
+        <source>Reset</source>
+        <translation type="unfinished">Berrezarri</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Por&t:</source>
-        <translation>&Ataka:</translation>
+        <source>Opens a window to select a different folder.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Defines the host USB port filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>Hostalari USB ataka iragazkia zehazten du <i>berdin zehatz</i> kate bat bezala. Kate huts batek edozein balio berdinduko du.</translation>
+        <source>Resets the folder path to the default value.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>R&emote:</source>
-        <translation>&Hurrunekoa:</translation>
+        <source>Opens a window to select a different file.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Defines whether this filter applies to USB devices attached locally to the host computer (<i>No</i>), to a VRDP client's computer (<i>Yes</i>), or both (<i>Any</i>).</source>
+        <source>Resets the file path to the default value.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Action:</source>
-        <translation type="obsolete">&Ekintza:</translation>
+        <source>&Copy</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-185"/>
-        <source>USB Filter Details</source>
-        <translation>USB Iragazki Xehetasunak</translation>
+        <source>Please type the folder path here.</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineWindow</name>
     <message>
-        <location filename="../src/runtime/UIMachineWindow.cpp" line="+226"/>
-        <source> EXPERIMENTAL build %1r%2 - %3</source>
-        <translation> ESPERIMENTALA eraiketa %1r%2 - %3</translation>
+        <source>Please type the file path here.</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineWindowNormal</name>
     <message>
-        <location filename="../src/runtime/normal/UIMachineWindowNormal.cpp" line="+558"/>
-        <source>Shows the currently assigned Host key.<br>This key, when pressed alone, toggles the keyboard and mouse capture state. It can also be used in combination with other keys to quickly perform actions from the main menu.</source>
+        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIMediumManager</name>
+    <name>VBoxGLSettingsDlg</name>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="+1216"/>
-        <source>&Hard drives</source>
-        <translation>Diska &gogorrak</translation>
-    </message>
-    <message>
-        <location line="+9"/>
-        <source>&Optical disks</source>
-        <translation>Diska &optikoak</translation>
+        <source>General</source>
+        <translation type="obsolete">Orokorra</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>&Floppy disks</source>
-        <translation>Diskete &diskak</translation>
+        <source>Language</source>
+        <translation type="obsolete"> Hizkuntza </translation>
     </message>
     <message>
-        <source>&Select</source>
-        <translation type="obsolete">&Hautatu</translation>
+        <source>USB</source>
+        <translation type="obsolete">USB</translation>
     </message>
     <message>
-        <location line="+17"/>
-        <source>C&lose</source>
-        <translation>It&xi</translation>
+        <source>Network</source>
+        <translation type="obsolete">Sarea</translation>
     </message>
 </context>
 <context>
-    <name>UIMediumTypeChangeDialog</name>
-    <message>
-        <location filename="../src/UIMediumTypeChangeDialog.cpp" line="+113"/>
-        <source>Modify medium attributes</source>
-        <translation type="unfinished"></translation>
-    </message>
+    <name>VBoxGLSettingsInput</name>
     <message>
-        <location line="+3"/>
-        <source><p>You are about to change the settings of the disk image file <b>%1</b>.</p><p>Please choose one of the following modes and press <b>%2</b> to proceed or <b>%3</b> otherwise.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Holds the key used as a Host Key in the VM window. Activate the entry field and press a new Host Key. Note that alphanumeric, cursor movement and editing keys cannot be used.</source>
+        <translation type="obsolete">MB leihoan Ostalari Tekla bezala erabilitakoa tekla erakusten du. Eremua gaitu eta Ostalari Tekla berria sakatu. Kontutan izan alfazenbakizkoak, kurtsore mugimenduak eta edizio teklak ezin direla Ostalari tekla bezala erabili.</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Choose mode:</source>
-        <translation>Hautatu modua:</translation>
+        <source>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</source>
+        <translation type="obsolete">Markaturik dagoenean, teklatua automatikoki kapturatuko da MB leiho aktibatzen den bakoitzean. Teklatua kapturatzen denean, tekla sakatze guztiak (Alt-TAb bezalako sistemakoak barne) makina birtualera bidaliko da.</translation>
     </message>
 </context>
 <context>
-    <name>UIMessageCenter</name>
+    <name>VBoxGlobal</name>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="-1473"/>
-        <location line="+2468"/>
-        <source>VirtualBox - Information</source>
-        <comment>msg box title</comment>
-        <translation>VirtualBox - Argibideak</translation>
+        <source>Differencing</source>
+        <comment>hard disk</comment>
+        <translation type="obsolete">Ezberdintzen</translation>
     </message>
     <message>
-        <location line="-2464"/>
-        <location line="+2468"/>
-        <source>VirtualBox - Question</source>
-        <comment>msg box title</comment>
-        <translation>VirtualBox - Galdera</translation>
+        <source>Unknown device %1:%2</source>
+        <comment>USB device details</comment>
+        <translation>%1 gailu ezezaguna:%2</translation>
     </message>
     <message>
-        <location line="-2464"/>
-        <location line="+2468"/>
-        <source>VirtualBox - Warning</source>
-        <comment>msg box title</comment>
-        <translation>VirtualBox - Ohartarazpena</translation>
+        <source><nobr>Vendor ID: %1</nobr><br><nobr>Product ID: %2</nobr><br><nobr>Revision: %3</nobr></source>
+        <comment>USB device tooltip</comment>
+        <translation><nobr>Saltzaile ID-a: %1</nobr><br><nobr>Produktu ID-a: %2</nobr><br><nobr>Bertsioa: %3</nobr></translation>
     </message>
     <message>
-        <location line="-2464"/>
-        <location line="+2468"/>
-        <source>VirtualBox - Error</source>
-        <comment>msg box title</comment>
-        <translation>VirtualBox - Akatsa</translation>
+        <source><br><nobr>Serial No. %1</nobr></source>
+        <comment>USB device tooltip</comment>
+        <translation><br><nobr>Serie Zb. %1</nobr></translation>
     </message>
     <message>
-        <location line="-2464"/>
-        <location line="+2468"/>
-        <source>VirtualBox - Critical Error</source>
-        <comment>msg box title</comment>
-        <translation>VirtualBox - Akats Larria</translation>
+        <source><br><nobr>State: %1</nobr></source>
+        <comment>USB device tooltip</comment>
+        <translation><br><nobr>Egoera: %1</nobr></translation>
     </message>
     <message>
-        <location line="-1852"/>
-        <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Name</source>
+        <comment>details report</comment>
+        <translation>Izena</translation>
     </message>
     <message>
-        <location line="+30"/>
-        <source>Failed to create NAT network.</source>
-        <translation type="unfinished"></translation>
+        <source>OS Type</source>
+        <comment>details report</comment>
+        <translation>SE mota</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Base Memory</source>
+        <comment>details report</comment>
+        <translation>Oinarri Memoria</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Failed to create DHCP server.</source>
-        <translation type="unfinished"></translation>
+        <source><nobr>%3 MB</nobr></source>
+        <comment>details report</comment>
+        <translation type="obsolete"><nobr>%3 MB</nobr></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>General</source>
+        <comment>details report</comment>
+        <translation>Orokorra</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <location line="+7"/>
-        <source>Failed to create the host network interface.</source>
-        <translation type="unfinished"></translation>
+        <source>Video Memory</source>
+        <comment>details report</comment>
+        <translation>Bideo Memoria</translation>
     </message>
     <message>
-        <location line="+73"/>
-        <source>Create &new disk</source>
-        <translation type="unfinished">&Sortu diska berria</translation>
+        <source><nobr>%4 MB</nobr></source>
+        <comment>details report</comment>
+        <translation type="obsolete"><nobr>%4 MB</nobr></translation>
     </message>
     <message>
-        <location line="+0"/>
-        <source>&Choose existing disk</source>
-        <translation type="unfinished">&Hautatu badagoen diska</translation>
+        <source>Boot Order</source>
+        <comment>details report</comment>
+        <translation>Abio Ordena</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <location line="+11"/>
-        <source>Leave &empty</source>
-        <translation type="unfinished">Utzi &hutsik</translation>
+        <source>ACPI</source>
+        <comment>details report</comment>
+        <translation>ACPI</translation>
     </message>
     <message>
-        <location line="-11"/>
-        <location line="+11"/>
-        <source>&Choose disk</source>
-        <translation type="unfinished">&Hautatu diska</translation>
+        <source>I/O APIC</source>
+        <comment>details report</comment>
+        <translation>I/O APIC</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+104"/>
-        <source><p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Not Attached</source>
+        <comment>details report (HDDs)</comment>
+        <translation type="obsolete">Ez erantsia</translation>
+    </message>
+    <message>
+        <source>Hard Disks</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Disko Gogorrak</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details report (ACPI)</comment>
+        <translation>Gaiturik</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Disabled</source>
+        <comment>details report (ACPI)</comment>
+        <translation>Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Enabled</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Gaiturik</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Disabled</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+22"/>
-        <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Not mounted</source>
+        <comment>details report (floppy)</comment>
+        <translation type="obsolete">Ez muntaturik</translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Image</source>
+        <comment>details report (floppy)</comment>
+        <translation type="obsolete">Irudia</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Host Drive</source>
+        <comment>details report (floppy)</comment>
+        <translation type="obsolete">Ostalari Gailua</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Floppy</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Disketea</translation>
     </message>
     <message>
-        <location line="+91"/>
-        <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>CD/DVD</source>
+        <comment>details report</comment>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location line="+16"/>
-        <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Adapter</source>
+        <comment>details report (audio)</comment>
+        <translation type="obsolete">Moldagailua</translation>
     </message>
     <message>
-        <location line="-12"/>
-        <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Audio</source>
+        <comment>details report</comment>
+        <translation>Audioa</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location line="+16"/>
-        <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Adapter %1</source>
+        <comment>details report (network)</comment>
+        <translation>%1 Moldagailua</translation>
     </message>
     <message>
-        <location line="-8"/>
-        <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Network</source>
+        <comment>details report</comment>
+        <translation>Sarea</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Device Filters</source>
+        <comment>details report (USB)</comment>
+        <translation>Gailu Iragazkiak</translation>
     </message>
     <message>
-        <location line="+30"/>
-        <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <source>%1 (%2 active)</source>
+        <comment>details report (USB)</comment>
+        <translation>%1 (%2 aktibo)</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <source>VRDP Server Port</source>
+        <comment>details report (VRDP)</comment>
+        <translation type="obsolete">VRDP Zerbitzari Ataka</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <source>%1</source>
+        <comment>details report (VRDP)</comment>
+        <translation type="obsolete">%1</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <source>Remote Display</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Huruneko Pantaila</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation type="unfinished"></translation>
+        <source>Opening URLs is not implemented yet.</source>
+        <translation type="obsolete">URL irekitzea ez dago inplementaturik oraindik.</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message numerus="yes">
-        <location line="+156"/>
-        <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
-        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation type="unfinished">
-            <numerusform></numerusform>
-            <numerusform></numerusform>
-        </translation>
+        <source>Powered Off</source>
+        <comment>MachineState</comment>
+        <translation>Itzalia</translation>
     </message>
     <message>
-        <location line="+260"/>
-        <location line="+13"/>
-        <location line="+13"/>
-        <source>Switch</source>
-        <translation type="unfinished">Aldatu</translation>
+        <source>Saved</source>
+        <comment>MachineState</comment>
+        <translation>Gordea</translation>
     </message>
     <message>
-        <location line="-7"/>
-        <source><p>The virtual machine window will be now switched to <b>Scale</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in scaled mode. You can access it by pressing <b>Host+Home</b>.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Aborted</source>
+        <comment>MachineState</comment>
+        <translation>Abortatua</translation>
     </message>
     <message>
-        <location line="+87"/>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Running</source>
+        <comment>MachineState</comment>
+        <translation>Martxan</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Paused</source>
+        <comment>MachineState</comment>
+        <translation>Gelditurik</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Starting</source>
+        <comment>MachineState</comment>
+        <translation>Abiarazten</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Stopping</source>
+        <comment>MachineState</comment>
+        <translation>Gelditzen</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Saving</source>
+        <comment>MachineState</comment>
+        <translation>Gordetzen</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Restoring</source>
+        <comment>MachineState</comment>
+        <translation>Berrezartzen</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation type="unfinished"></translation>
+        <source>Discarding</source>
+        <comment>MachineState</comment>
+        <translation type="obsolete">Baztertzen</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Closed</source>
+        <comment>SessionState</comment>
+        <translation type="obsolete">Itxia</translation>
     </message>
     <message>
-        <location line="+40"/>
-        <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Open</source>
+        <comment>SessionState</comment>
+        <translation type="obsolete">Irekia</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <location line="+10"/>
-        <location line="+40"/>
-        <location line="+10"/>
-        <location line="+29"/>
-        <location line="+10"/>
-        <source>Download</source>
-        <translation type="unfinished">Jeitsi</translation>
+        <source>Spawning</source>
+        <comment>SessionState</comment>
+        <translation>Abiarazten</translation>
     </message>
     <message>
-        <location line="-93"/>
-        <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Closing</source>
+        <comment>SessionState</comment>
+        <translation type="obsolete">Ixten</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation type="unfinished"></translation>
+        <source>None</source>
+        <comment>DeviceType</comment>
+        <translation>Batez</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Hard Disk</source>
+        <comment>DeviceType</comment>
+        <translation>Disko gogorrak</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Insert</source>
-        <comment>additions</comment>
-        <translation>Txertatu</translation>
+        <source>Primary</source>
+        <comment>DiskControllerType</comment>
+        <translation type="obsolete">Lehen mailakoa</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
-        <translation type="unfinished"></translation>
+        <source>Secondary</source>
+        <comment>DiskControllerType</comment>
+        <translation type="obsolete">Bigarren mailakoa</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Normal</source>
+        <comment>DiskType</comment>
+        <translation type="obsolete">Arrunta</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation type="unfinished"></translation>
+        <source>Immutable</source>
+        <comment>DiskType</comment>
+        <translation type="obsolete">Aldaezina</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation type="unfinished"><p>VirtualBox Erabiltzaile Eskuliburua ongi jeitsi da hemendik, <nobr><a href="%1">%2</a></nobr>baina ezin da tokian gorde honela <nobr><b>%3</b>.</nobr></p><p>Mesedez hautatu beste kokaleku bat agiriarentzat.</p> {1"?} {1<?} {2<?}</translation>
+        <source>Writethrough</source>
+        <comment>DiskType</comment>
+        <translation type="obsolete">Idatzihola</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation type="unfinished"><p>VirtualBox Erabiltzaile Eskuliburua ongi jeitsi da hemendik, <nobr><a href="%1">%2</a></nobr> eta tokian gorde da honela <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
+        <source>Virtual Disk Image</source>
+        <comment>DiskStorageType</comment>
+        <translation type="obsolete">Disko Birtual Irudia</translation>
     </message>
     <message>
-        <location line="+655"/>
-        <source>Do not show this message again</source>
-        <comment>msg box flag</comment>
-        <translation>Ez erakutsi mezu hau berriro</translation>
+        <source>iSCSI</source>
+        <comment>DiskStorageType</comment>
+        <translation type="obsolete">iSCSI</translation>
     </message>
     <message>
-        <location line="-2258"/>
-        <source>Failed to open <tt>%1</tt>. Make sure your desktop environment can properly handle URLs of this type.</source>
-        <translation>Hutsegitea <tt>%1</tt> irekitzerakoan. Zihurtatu zure mahaigin inguruak mota honetako URL-ak egoki kudeatu ditzakeela.</translation>
+        <source>VMDK Image</source>
+        <comment>DiskStorageType</comment>
+        <translation type="obsolete">VMDK Irudia</translation>
     </message>
     <message>
-        <location line="-102"/>
-        <source><p>Failed to initialize COM or to find the VirtualBox COM server. Most likely, the VirtualBox server is not running or failed to start.</p><p>The application will now terminate.</p></source>
-        <translation><p>Hutsegitea COM abiaraztean edo VirtualBox COM zerbitzaria aurkitzerakoan. Zihurrenik VirtualBox zerbitzaria ez dago ekinean edo huts egin du abiatzean.</p><p>Orain aplikazioak amaitu egingo du.</p></translation>
+        <source>Null</source>
+        <comment>VRDPAuthType</comment>
+        <translation type="obsolete">Nulua</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Hutsegitea VirtualBox COM objetua sortzerakoan.</p><p>Orain aplikazioak amaitu egingo du.</p></translation>
+        <source>External</source>
+        <comment>VRDPAuthType</comment>
+        <translation type="obsolete">Kanpokoa</translation>
     </message>
     <message>
-        <location line="+570"/>
-        <source>Failed to set global VirtualBox properties.</source>
-        <translation>Hutsegitea VirtualBox ezaugarri orokorrak ezartzerakoan.</translation>
+        <source>Guest</source>
+        <comment>VRDPAuthType</comment>
+        <translation type="obsolete">Bezeroa</translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source>Failed to access the USB subsystem.</source>
-        <translation>Hutsegitea USB azpisistemara sartzerakoan.</translation>
+        <source>Ignore</source>
+        <comment>USBFilterActionType</comment>
+        <translation type="obsolete">Alde batetara utzi</translation>
     </message>
     <message>
-        <location line="+450"/>
-        <source>Failed to create a new virtual machine.</source>
-        <translation>Hutsegitea makina birtual berri bat sortzerakoan.</translation>
+        <source>Hold</source>
+        <comment>USBFilterActionType</comment>
+        <translation type="obsolete">Eskuratu</translation>
     </message>
     <message>
-        <source>Failed to create a new virtual machine <b>%1</b>.</source>
-        <translation type="obsolete">Hutsegitea makina birtual berri bat sortzerakoan. <b>%1</b>.</translation>
+        <source>Master</source>
+        <comment>DiskControllerDevice</comment>
+        <translation type="obsolete">Nagusia</translation>
     </message>
     <message>
-        <source>Failed to apply the settings to the virtual machine <b>%1</b>.</source>
-        <translation type="obsolete">Hutsegitea <b>%1</b> makina birtualari ezarpenak ezartzerakoan.</translation>
+        <source>Slave</source>
+        <comment>DiskControllerDevice</comment>
+        <translation type="obsolete">Morroia</translation>
     </message>
     <message>
-        <location line="+342"/>
-        <location line="+8"/>
-        <source>Failed to start the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtuala abiarazterakoan.</translation>
+        <source>Device&nbsp;%1</source>
+        <comment>DiskControllerDevice</comment>
+        <translation type="obsolete">&nbsp;%1 Gailua</translation>
     </message>
     <message>
-        <location line="-1070"/>
-        <source>Failed to pause the execution of the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtualaren exekuzioa pausatzerakoan.</translation>
+        <source>Null Audio Driver</source>
+        <comment>AudioDriverType</comment>
+        <translation>Audio Kontrolatzaile Hutsa</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Failed to resume the execution of the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtualaren exekuzioa berrekiterakoan.</translation>
+        <source>Windows Multimedia</source>
+        <comment>AudioDriverType</comment>
+        <translation>Windows Multimedia</translation>
     </message>
     <message>
-        <location line="+16"/>
-        <location line="+8"/>
-        <source>Failed to save the state of the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtualaren egoera gordetzerakoan.</translation>
+        <source>OSS Audio Driver</source>
+        <comment>AudioDriverType</comment>
+        <translation>OSS Audio Kontrolatzailea</translation>
     </message>
     <message>
-        <location line="+84"/>
-        <location line="+8"/>
-        <source>Failed to create a snapshot of the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtualaren argazki bat sortzerakoan.</translation>
+        <source>ALSA Audio Driver</source>
+        <comment>AudioDriverType</comment>
+        <translation>ALSA Audio Kontrolatzailea</translation>
     </message>
     <message>
-        <location line="-76"/>
-        <location line="+8"/>
-        <source>Failed to stop the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtuala gelditzerakoan.</translation>
+        <source>Windows DirectSound</source>
+        <comment>AudioDriverType</comment>
+        <translation>Windows DirectSound</translation>
     </message>
     <message>
-        <location line="-130"/>
-        <location line="+8"/>
-        <source>Failed to remove the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtuala kentzerakoan.</translation>
+        <source>CoreAudio</source>
+        <comment>AudioDriverType</comment>
+        <translation>CoreAudio</translation>
     </message>
     <message>
-        <location line="+82"/>
-        <source>Failed to discard the saved state of the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtualaren gordetako egoera baztertzerakoan.</translation>
+        <source>Intel PRO/1000 MT Server (82545EM)</source>
+        <comment>NetworkAdapterType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-284"/>
-        <source>There is no virtual machine named <b>%1</b>.</source>
-        <translation>Ez dago <b>%1</b> izena duen makina birtualik.</translation>
+        <source>Not attached</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation>Ez erantsia</translation>
     </message>
     <message>
-        <location line="+16"/>
-        <source>Failed to create a new session.</source>
-        <translation>Hutsegitea saio berri bat sortzerakoan.</translation>
+        <source>NAT</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation>NAT</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <location line="+8"/>
-        <source>Failed to open a session for the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtualerako saio bat irekitzerakoan.</translation>
+        <source>Host Interface</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="obsolete">Ostalari Interfazea</translation>
     </message>
     <message>
-        <location line="+477"/>
-        <location line="+8"/>
-        <source>Failed to remove the host network interface <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> hostalari sare interfazea kentzerakoan.</translation>
+        <source>Internal Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation>Barne Sarea</translation>
     </message>
     <message>
-        <location line="+936"/>
-        <location line="+8"/>
-        <source>Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Hutsegitea <b>%1</b> USB gailua <b>%2</b>makina birtualera eransterakoan.</translation>
+        <source>Not supported</source>
+        <comment>USBDeviceState</comment>
+        <translation>Ez da onartzen</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <location line="+8"/>
-        <source>Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Hutsegitea <b>%1</b> USB gailua <b>%2</b>makina birtualetik deseransterakoan.</translation>
+        <source>Unavailable</source>
+        <comment>USBDeviceState</comment>
+        <translation>Erabilezina</translation>
     </message>
     <message>
-        <location line="-818"/>
-        <location line="+9"/>
-        <source>Failed to create the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.</source>
-        <translation>Hutsegitea <b>%1</b> agiritegi elkarbanatua sortzerakoan (zuzentzen <nobr><b>%2</b></nobr>-ra) <b>%3</b> makina birtualerako.</translation>
+        <source>Busy</source>
+        <comment>USBDeviceState</comment>
+        <translation>Okupatua</translation>
     </message>
     <message>
-        <source>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</source>
-        <translation type="obsolete">Hutsegitea <b>%1</b> agiritegi elkarbanatua kentzerakoan (zuzentzen <nobr><b>%2</b></nobr>-ra) <b>%3</b> makina birtualerako.</translation>
+        <source>Available</source>
+        <comment>USBDeviceState</comment>
+        <translation>Erabilgarri</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="+195"/>
-        <source>Close</source>
-        <translation type="unfinished">Itxi</translation>
+        <source>Held</source>
+        <comment>USBDeviceState</comment>
+        <translation>Mantendua</translation>
     </message>
     <message>
-        <location line="+45"/>
-        <source>Ok</source>
-        <translation type="unfinished">Ongi</translation>
+        <source>Captured</source>
+        <comment>USBDeviceState</comment>
+        <translation>Hartua</translation>
     </message>
     <message>
-        <location line="+218"/>
-        <source><p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> in the current video mode. You need to capture the mouse (by clicking over the VM display or pressing the host key) in order to use the mouse inside the guest OS.</p></source>
-        <translation type="unfinished"></translation>
+        <source><i>Checking...</i></source>
+        <comment>hard disk</comment>
+        <translation type="obsolete"><i>Egiaztatzen...</i></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>The Virtual Machine is currently in the <b>Paused</b> state and not able to see any keyboard or mouse input. If you want to continue to work inside the VM, you need to resume it by selecting the corresponding action from the menu bar.</p></source>
-        <translation><p>Makina Birtuala une honetan <b>Pausatuta</b> egoeran dago eta ez da gai teklatu edo sagurik ikusteko. Makina Birtualarekin lanean jarraitzea nahi baduzu, hau berrekin behar duzu dagokion ekintza hautatuz menu barratik.</p></translation>
+        <source><i>Inaccessible</i></source>
+        <comment>hard disk</comment>
+        <translation type="obsolete"><i>Eskuraezina</i></translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Host To Guest</source>
+        <comment>ClipboardType</comment>
+        <translation>Ostalaritik Bezerora</translation>
     </message>
     <message>
-        <source><p>Cannot run VirtualBox in <i>VM Selector</i> mode due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation type="obsolete"><p>Ezin da VirtualBox<i>MB Hautatzailea</i>n moduan ekin tokiko murrizpenengaitik.</p><p>Orain aplikazioa amaitu egingo da.</p></translation>
+        <source>Guest To Host</source>
+        <comment>ClipboardType</comment>
+        <translation>Bezerotik Ostalarira</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="+519"/>
-        <source><nobr>Fatal Error</nobr></source>
-        <comment>runtime error info</comment>
-        <translation><nobr>Akats Larria</nobr></translation>
+        <source>Bidirectional</source>
+        <comment>ClipboardType</comment>
+        <translation>Bi zentzuetakoa</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><nobr>Non-Fatal Error</nobr></source>
-        <comment>runtime error info</comment>
-        <translation><nobr>Akats Ez Larria</nobr></translation>
+        <source>Select a directory</source>
+        <translation type="obsolete">Hautatu direktorio bat</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><nobr>Warning</nobr></source>
-        <comment>runtime error info</comment>
-        <translation><nobr>Kontuz</nobr></translation>
+        <source>Select a file</source>
+        <translation type="obsolete">Hautatu fitxategi bat</translation>
     </message>
     <message>
-        <location line="+16"/>
-        <source><nobr>Error ID: </nobr></source>
-        <comment>runtime error info</comment>
-        <translation><nobr>Akats ID-a:</nobr></translation>
+        <source>Port %1</source>
+        <comment>details report (serial ports)</comment>
+        <translation>%1 ataka</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Severity: </source>
-        <comment>runtime error info</comment>
-        <translation>Larritasuna: </translation>
+        <source>Serial Ports</source>
+        <comment>details report</comment>
+        <translation>Serie Atakak</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source><p>A fatal error has occurred during virtual machine execution! The virtual machine will be powered off. Please copy the following error message using the clipboard to help diagnose the problem:</p></source>
-        <translation><p>Akats larri bat gertatu da makin birtuala exekutatzerakoan! Makina birtuala itzali egingo da. Mesedez kopiatu hurrengo akats mezua gakoa erabiliz arazoa aurkitzen laguntzeko:</p></translation>
+        <source>USB</source>
+        <comment>details report</comment>
+        <translation>USB</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source><p>An error has occurred during virtual machine execution! The error details are shown below. You may try to correct the error and resume the virtual machine execution.</p></source>
-        <translation><p>Akats bat gertatu da makina birtualaren exekuzioan! Akatsaren xehetasunak behean erakusten dira. Akatsa zuzentzen eta makina birtualaren exekuzioa berrekiten saiatu zaitezke.</p></translation>
+        <source>Shared Folders</source>
+        <comment>details report (shared folders)</comment>
+        <translation>Partekatutako Karpetak</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source><p>The virtual machine execution may run into an error condition as described below. We suggest that you take an appropriate action to avert the error.</p></source>
-        <translation><p>Makina birtualaren exekuzioa akats baldintza batean exekutatu daiteke behean azaldu bezala. Akatsa saihesteko ekintza egokia burutzea gomendatzen dugu.</p></translation>
+        <source>Stuck</source>
+        <comment>MachineState</comment>
+        <translation type="obsolete">Trabatu</translation>
     </message>
     <message>
-        <location line="+728"/>
-        <location line="+221"/>
-        <source>Result&nbsp;Code: </source>
-        <comment>error info</comment>
-        <translation>Emaitz&nbsp;Kodea: </translation>
+        <source>Disconnected</source>
+        <comment>PortMode</comment>
+        <translation>Deskonektaturik</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Component: </source>
-        <comment>error info</comment>
-        <translation>Osagaia: </translation>
+        <source>Host Pipe</source>
+        <comment>PortMode</comment>
+        <translation>Ostalari Tutua</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Interface: </source>
-        <comment>error info</comment>
-        <translation>Interfazea: </translation>
+        <source>Host Device</source>
+        <comment>PortMode</comment>
+        <translation>Ostalari Gailua</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Callee: </source>
-        <comment>error info</comment>
+        <source>PIIX3</source>
+        <comment>StorageControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Callee&nbsp;RC: </source>
-        <comment>error info</comment>
+        <source>PIIX4</source>
+        <comment>StorageControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> dialog which you can open from the <b>File</b> menu of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation type="obsolete"><p>Ezin da <b>%1</b> hizkuntzarako hizkuntza agiria aurkitu <b><nobr>%2</nobr></b> zuzenbidean.</p><p>Hizkuntza aldibaterako Ingeleran (barne-eraikita) berrezarriko da. Mesedez joan <b>Hobespenak</b> elkarrizketara VirtualBox leihoko <b>Agiria</b> menutik ireki dezakezuna, eta hautatu <b>Hizkuntza</b> orrialdean dauden hizkuntzetako bat.</p></translation>
+        <source>ICH6</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> dialog which you can open from the <b>File</b> menu of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation type="obsolete"><p>Ezin da <b><nobr>%1</nobr></b> hizkuntza agiria gertatu. <p>Hizkuntza aldibaterako Ingeleran (barne-eraikita) berrezarriko da. Mesedez joan <b>Hobespenak</b> elkarrizketara VirtualBox leihoko <b>Agiria</b> menutik ireki dezakezuna, eta hautatu <b>Hizkuntza</b> orrialdean dauden hizkuntzetako bat.</p></translation>
+        <source>AHCI</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1543"/>
-        <location line="+11"/>
-        <source><p>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</p><p>Please close all programs in the guest OS that may be using this shared folder and try again.</p></source>
-        <translation><p>Hutsegitea <b>%1</b> elkarbanatutako agiritegia kentzerakoan (hona zuzentzeno <nobr><b>%2</b></nobr>) <b>%3</b> makina birtutaletik.</p><p>Mesedez itxi elkarbanatutako agiritegi hau erabiltzen egon daitezkeen SE gonbidatuko programa guztiak eta saiatu berriro.</p></translation>
+        <source>Lsilogic</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Are you sure you want to download the VirtualBox Guest Additions CD image from <nobr><a href="%1">%2</a></nobr> (size %3 bytes)?</p></source>
-        <translation type="obsolete"><p>Zihur zaude VirtualBox Gonbidatu Gehigarriak CD irudia <nobr><a href="%1">%2</a></nobr>-tik (neurria %3 byte) jeistea nahi duzula?</p></translation>
+        <source>BusLogic</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to find license files in <nobr><b>%1</b></nobr>.</source>
-        <translation type="obsolete">Hutsegitea baimen agiriak aurkitzerakoan, <nobr><b>%1</b></nobr>.</translation>
+        <source>User-defined</source>
+        <comment>serial port</comment>
+        <translation>Erabiltzaileak-ezarria</translation>
     </message>
     <message>
-        <location line="+1170"/>
-        <source>Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.</source>
-        <translation>Hutsegitea <nobr><b>%1</b></nobr> baimen agiria irekitzerakoan. Egiaztatu agiri baimenak.</translation>
+        <source>Enabled</source>
+        <comment>details report (I/O APIC)</comment>
+        <translation type="unfinished">Gaiturik</translation>
     </message>
     <message>
-        <location line="-1549"/>
-        <source>Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Disabled</source>
+        <comment>details report (I/O APIC)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <source><p>Congratulations! You have been successfully registered as a user of VirtualBox.</p><p>Thank you for finding time to fill out the registration form!</p></source>
-        <translation type="obsolete"><p>Zorionak! Ongi erregistratu zara VirtualBox erabiltzaile bezala.</p><p>Mila esker erregistrazio galdekizuna betetzeko astia aurkitzeagaitik!</p></translation>
+        <source>Not mounted</source>
+        <comment>details report (DVD)</comment>
+        <translation type="obsolete">Ez muntaturik</translation>
     </message>
     <message>
-        <location line="-326"/>
-        <source><p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
-        <translation><p>Hutsegitea EIG itxurapen orokorra <b><nobr>%1</nobr></b>-tik gertatzerakoan.</p><p>Orain aplikazioak amaitu egingo du.</p></translation>
+        <source>Image</source>
+        <comment>details report (DVD)</comment>
+        <translation type="obsolete">Irudia</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source><p>Failed to save the global GUI configuration to <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
-        <translation><p>Hutsegitea EIG itxurapen orokorra <b><nobr>%1</nobr></b>-an gordetzerakoan.</p><p>Orain aplikazioak amaitu egingo du.</p></translation>
+        <source>Host Drive</source>
+        <comment>details report (DVD)</comment>
+        <translation type="obsolete">Ostalari Gailua</translation>
     </message>
     <message>
-        <location line="+707"/>
-        <source>Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtualaren ezarpenak<b><nobr>%2</nobr></b>-an gordetzerakoan.</translation>
+        <source>Disabled</source>
+        <comment>details report (audio)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <source>Failed to load the settings of the virtual machine <b>%1</b> from <b><nobr>%2</nobr></b>.</source>
-        <translation type="obsolete">Hutsegitea <b>%1</b> makina birtualaren ezarpenak<b><nobr>%2</nobr></b>-tik gertatzerakoan.</translation>
+        <source>Bridged adapter, %1</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-468"/>
-        <source>Discard</source>
-        <comment>saved state</comment>
-        <translation>Baztertu</translation>
+        <source>Host-only adapter, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Download</source>
-        <comment>additions</comment>
-        <translation type="obsolete">Jeitsi</translation>
+        <source>Disabled</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <source>Mount</source>
-        <comment>additions</comment>
-        <translation type="obsolete">Osatu</translation>
+        <source>Disabled</source>
+        <comment>details report (serial ports)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+1125"/>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="-49"/>
-        <source><p>The host key is currently defined as <b>%1</b>.</p></source>
-        <comment>additional message box paragraph</comment>
-        <translation><p>Hostalari tekla orain <b>%1</b> bezala zehaztuta dago.</p></translation>
+        <source>Disabled</source>
+        <comment>details report (USB)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Capture</source>
-        <comment>do input capture</comment>
-        <translation>Harpena</translation>
+        <source>%1</source>
+        <comment>details report (shadef folders)</comment>
+        <translation type="obsolete">%1</translation>
     </message>
     <message>
-        <location line="-1143"/>
-        <source>Check</source>
-        <comment>inaccessible media message box</comment>
-        <translation>Egiaztatu</translation>
+        <source>None</source>
+        <comment>details report (shared folders)</comment>
+        <translation type="unfinished">Batez</translation>
     </message>
     <message>
-        <source>Switch</source>
-        <comment>fullscreen</comment>
-        <translation type="obsolete">Aldatu</translation>
+        <source>Shared Folders</source>
+        <comment>details report</comment>
+        <translation type="unfinished">Partekatutako Karpetak</translation>
     </message>
     <message>
-        <source>Switch</source>
-        <comment>seamless</comment>
-        <translation type="obsolete">Aldatu</translation>
+        <source>Disabled</source>
+        <comment>details report (VRDP)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+23"/>
-        <source>Reset</source>
-        <comment>machine</comment>
-        <translation>Berrezarri</translation>
+        <source>Floppy</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished">Disketea</translation>
     </message>
     <message>
-        <location line="+740"/>
-        <source>Continue</source>
-        <comment>no hard disk attached</comment>
-        <translation>Jarraitu</translation>
+        <source>CD/DVD</source>
+        <comment>DeviceType</comment>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Go Back</source>
-        <comment>no hard disk attached</comment>
-        <translation>Joan Atzera</translation>
+        <source>Network</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished">Sarea</translation>
     </message>
     <message>
-        <location line="+439"/>
-        <source><p>Could not enter seamless mode due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p></source>
+        <source>Bridged Adapter</source>
+        <comment>NetworkAttachmentType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-11"/>
-        <source><p>Could not switch the guest display to fullscreen mode due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p><p>Press <b>Ignore</b> to switch to fullscreen mode anyway or press <b>Cancel</b> to cancel the operation.</p></source>
+        <source>Host-only Adapter</source>
+        <comment>NetworkAttachmentType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+147"/>
-        <source>You are already running the most recent version of VirtualBox.</source>
-        <translation>Jadanik VirtualBox bertsio berriena duzu.</translation>
+        <source>Disabled</source>
+        <comment>ClipboardType</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="-211"/>
-        <source><p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer integration is not currently supported by the guest OS) and the keyboard, which will make them unavailable to other applications running on your host machine.</p><p>You can press the <b>host key</b> at  [...]
+        <source>VT-x/AMD-V</source>
+        <comment>details report</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="-13"/>
-        <source><p>You have the <b>Auto capture keyboard</b> option turned on. This will cause the Virtual Machine to automatically <b>capture</b> the keyboard every time the VM window is activated and make it unavailable to other applications running on your host machine: when the keyboard is captured, all keystrokes (including system ones like Alt-Tab) will be directed to the VM.</p><p>You can press the <b>host key</b> at any time t [...]
+        <source>PAE/NX</source>
+        <comment>details report</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+24"/>
-        <source><p>The Virtual Machine reports that the guest OS supports <b>mouse pointer integration</b>. This means that you do not need to <i>capture</i> the mouse pointer to be able to use it in your guest OS -- all mouse actions you perform when the mouse pointer is over the Virtual Machine's display are directly sent to the guest OS. If the mouse is currently captured, it will be automatically uncaptured.</p><p>The mouse icon on the s [...]
-        <translation type="unfinished"></translation>
+        <source>Enabled</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Gaiturik</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="+201"/>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>VirtualBox bertsio berri bat argitaratu da! <b>%1</b> bertsioa eskuragari dago hemen, <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Bertsioa hau hurrengo lotura erabiliz jeitsi dezakezu:</p><p><a href=%2>%3</a></p></translation>
+        <source>Disabled</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="-805"/>
-        <source>Release</source>
-        <comment>detach medium</comment>
-        <translation>Argitaratu</translation>
+        <source>Enabled</source>
+        <comment>details report (PAE/NX)</comment>
+        <translation type="unfinished">Gaiturik</translation>
     </message>
     <message>
-        <source><p>Are you sure you want to remove the %1 <nobr><b>%2</b></nobr> from the list of known media?</p></source>
-        <translation type="obsolete"><p>Zihur zaude %1 <nobr><b>%2</b></nobr> multimedia ezagunen zerrendatik kentzea nahi duzula?</p></translation>
+        <source>Disabled</source>
+        <comment>details report (PAE/NX)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+51"/>
-        <source>Remove</source>
-        <comment>medium</comment>
-        <translation>Kendu</translation>
+        <source>Host Driver</source>
+        <comment>details report (audio)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+226"/>
-        <source><p>The hard disk storage unit at location <b>%1</b> already exists. You cannot create a new virtual hard disk that uses this location because it can be already used by another virtual hard disk.</p><p>Please specify a different location.</p></source>
+        <source>Controller</source>
+        <comment>details report (audio)</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-220"/>
-        <source><p>Do you want to delete the storage unit of the hard disk <nobr><b>%1</b></nobr>?</p><p>If you select <b>Delete</b> then the specified storage unit will be permanently deleted. This operation <b>cannot be undone</b>.</p><p>If you select <b>Keep</b> then the hard disk will be only removed from the list of known hard disks, but the storage unit will be left untouched which makes it po [...]
+        <source>Internal network, '%1'</source>
+        <comment>details report (network)</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>Delete</source>
-        <comment>hard disk storage</comment>
-        <translation>Ezabatu</translation>
+        <source>Port %1</source>
+        <comment>details report (parallel ports)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Keep</source>
-        <comment>hard disk storage</comment>
-        <translation>Heutsi</translation>
+        <source>Disabled</source>
+        <comment>details report (parallel ports)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <location line="+8"/>
-        <source>Failed to delete the storage unit of the hard disk <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> diska gogorreko biltegiratze unitatea ezabatzerakoan.</translation>
+        <source>Parallel Ports</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+204"/>
-        <location line="+8"/>
-        <location line="+8"/>
-        <source>Failed to create the hard disk storage <nobr><b>%1</b>.</nobr></source>
-        <translation>Hutsegitea diska gogor biltegia sortzerakoan <nobr><b>%1</b>.</nobr></translation>
+        <source>USB</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished">USB</translation>
     </message>
     <message>
-        <source>Failed to open the %1 <nobr><b>%2</b></nobr>.</source>
-        <translation type="obsolete">Hutsegitea %1 irekitzerakoan <nobr><b>%2</b></nobr>.</translation>
+        <source>Shared Folder</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to close the %1 <nobr><b>%2</b></nobr>.</source>
-        <translation type="obsolete">Hutsegitea %1 isterakoan <nobr><b>%2</b></nobr>.</translation>
+        <source>IDE</source>
+        <comment>StorageBus</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Failed to connect to the VirtualBox online registration service due to the following error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>Hutsegitea VirtualBox-en onlineko erregistrazio zerbitzura elkartzerakoan hurrengo akatsagaitik: </p><p><b>%1</b></p></translation>
+        <source>SATA</source>
+        <comment>StorageBus</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+211"/>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <source>SCSI</source>
+        <comment>StorageBus</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+621"/>
-        <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
-        <translation>Jadanik badaude hurrengo agiriak:<br /><br />%1<br /><br />Zihur zaude ordeztea nahi dituzula? Hauek ordezteak beren edukiak gainidaztea eragingo du.</translation>
+        <source>Primary</source>
+        <comment>StorageBusChannel</comment>
+        <translation type="obsolete">Lehen mailakoa</translation>
     </message>
     <message>
-        <location line="-1957"/>
-        <source>You are running a prerelease version of VirtualBox. This version is not suitable for production use.</source>
-        <translation>VirtualBox aurreargitalpen bertsio bat ari zara erabiltzen. Bertsio hau ez da ekoizpen erabilpenerako.</translation>
+        <source>Secondary</source>
+        <comment>StorageBusChannel</comment>
+        <translation type="obsolete">Bigarren mailakoa</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="-31"/>
-        <source>You are trying to shut down the guest with the ACPI power button. This is currently not possible because the guest does not support software shutdown.</source>
-        <translation type="unfinished"></translation>
+        <source>Master</source>
+        <comment>StorageBusDevice</comment>
+        <translation type="obsolete">Nagusia</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="+1363"/>
-        <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Slave</source>
+        <comment>StorageBusDevice</comment>
+        <translation type="obsolete">Morroia</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <location line="+7"/>
-        <location line="+11"/>
-        <location line="+6"/>
-        <location line="+11"/>
-        <source>Close VM</source>
-        <translation>Itxi MB</translation>
+        <source>Solaris Audio</source>
+        <comment>AudioDriverType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-198"/>
-        <location line="+163"/>
-        <location line="+7"/>
-        <location line="+11"/>
-        <location line="+6"/>
-        <source>Continue</source>
-        <translation>Jarraitu</translation>
+        <source>PulseAudio</source>
+        <comment>AudioDriverType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-971"/>
-        <location line="+9"/>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="-172"/>
-        <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <source>ICH AC97</source>
+        <comment>AudioControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to create the host-only network interface.</source>
-        <translation type="obsolete">Hutsegitea hostalaria-bakarrik sare interfazea sortzerakoan.</translation>
+        <source>SoundBlaster 16</source>
+        <comment>AudioControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to open appliance.</source>
-        <translation type="obsolete">Hutsegitea makina birtuala irekitzerakoan.</translation>
+        <source>PCnet-PCI II (Am79C970A)</source>
+        <comment>NetworkAdapterType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+737"/>
-        <source>Failed to open/interpret appliance <b>%1</b>.</source>
+        <source>PCnet-FAST III (Am79C973)</source>
+        <comment>NetworkAdapterType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Failed to import appliance <b>%1</b>.</source>
-        <translation>Hutsegitea makina birtuala inportatzerakoan <b>%1</b>.</translation>
+        <source>Intel PRO/1000 MT Desktop (82540EM)</source>
+        <comment>NetworkAdapterType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to create appliance.</source>
-        <translation type="obsolete">Hutsegitea makina birtuala sortzerakoan.</translation>
+        <source>Intel PRO/1000 T Server (82543GC)</source>
+        <comment>NetworkAdapterType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+36"/>
-        <location line="+8"/>
-        <source>Failed to prepare the export of the appliance <b>%1</b>.</source>
+        <source><nobr>Vendor ID: %1</nobr></source>
+        <comment>USB filter tooltip</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to create an appliance.</source>
-        <translation type="obsolete">Hutsegitea makina birtual bat sortzerakoan.</translation>
+        <source><nobr>Product ID: %2</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Failed to export appliance <b>%1</b>.</source>
-        <translation>Hutsegitea makina birtuala esportatzerakoan <b>%1</b>.</translation>
+        <source><nobr>Revision: %3</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-700"/>
-        <source><p>Deleting this host-only network will remove the host-only interface this network is based on. Do you want to remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p><p><b>Note:</b> this interface may be in use by one or more virtual network adapters belonging to one of your VMs. After it is removed, these adapters will no longer be usable until you correct their settings by either choosing a different in [...]
+        <source><nobr>Product: %4</nobr></source>
+        <comment>USB filter tooltip</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1416"/>
-        <source>A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.</source>
-        <translation>Jadanik badago <b>%1</b> izeneko agiri bat. Zihur zaude ordeztea nahi duzula? Ordezteak bere edukiak gainidaztea eragingo du.</translation>
+        <source><nobr>Manufacturer: %5</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-561"/>
-        <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Certain guests (e.g. OS/2 and QNX) require this feature.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source>
+        <source><nobr>Serial No.: %1</nobr></source>
+        <comment>USB filter tooltip</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Invalid e-mail address or password specified.</p></source>
-        <translation type="obsolete"><p>Post@ helbide edo sarhitz okerra adierazi da.</p></translation>
+        <source><nobr>Port: %1</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Failed to register the VirtualBox product.</p><p>%1</p></source>
-        <translation type="obsolete"><p>Hutsegitea VirtualBox produktua erregistratzerakoan.</p><p>%1</p></translation>
+        <source><nobr>State: %1</nobr></source>
+        <comment>USB filter tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-199"/>
-        <source>Failed to check files.</source>
-        <translation>Hutsegitea agiriak egiaztatzerakoan.</translation>
+        <source>Adapter %1</source>
+        <comment>network</comment>
+        <translation type="obsolete">%1 Moldagailua</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Failed to remove file.</source>
-        <translation>Hutsegitea agiria kentzerakoan.</translation>
+        <source><br><nobr>Attached to:&nbsp;&nbsp;%1</nobr></source>
+        <comment>medium</comment>
+        <translation type="obsolete"><br><nobr>Non erantsia:&nbsp;&nbsp;%1</nobr></translation>
     </message>
     <message>
-        <location line="-1208"/>
-        <source>You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. We strongly recommend that you change this, as it is a severe mis-configuration of your system which could cause USB devices to fail in unexpected ways.</source>
+        <source>Checking...</source>
+        <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
+        <source>Inaccessible</source>
+        <comment>medium</comment>
+        <translation type="unfinished">Eskuraezina</translation>
+    </message>
+    <message>
+        <source>3D Acceleration</source>
+        <comment>details report</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source>You are running an EXPERIMENTAL build of VirtualBox. This version is not suitable for production use.</source>
-        <translation>VirtualBox eraiketa ESPERIMENTAL bat erabiltzen ari zara. Bertsio hau ez da ekoizpen erabilpenerako.</translation>
+        <source>Enabled</source>
+        <comment>details report (3D Acceleration)</comment>
+        <translation type="unfinished">Gaiturik</translation>
     </message>
     <message>
-        <location line="+35"/>
-        <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Disabled</source>
+        <comment>details report (3D Acceleration)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
+        <source>Setting Up</source>
+        <comment>MachineState</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+36"/>
-        <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Differencing</source>
+        <comment>DiskType</comment>
+        <translation type="unfinished">Ezberdintzen</translation>
     </message>
     <message>
-        <location line="+31"/>
-        <source>Failed to access the disk image file <nobr><b>%1</b></nobr>.</source>
-        <translation>Hutsegitea disk irudi agirira sartzerakoan, <nobr><b>%1</b></nobr>.</translation>
+        <source><nobr>%1 MB</nobr></source>
+        <comment>details report</comment>
+        <translation type="unfinished"><nobr>%4 MB</nobr> {1 ?}</translation>
     </message>
     <message>
-        <location line="+171"/>
-        <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <source>Processor(s)</source>
+        <comment>details report</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <location line="+1058"/>
-        <location line="+139"/>
-        <location line="+21"/>
-        <source>Ignore</source>
-        <translation type="unfinished">Ezikusi</translation>
-    </message>
-    <message>
-        <location line="-1094"/>
-        <location line="+9"/>
-        <source>Restore</source>
-        <translation>Leheneratu</translation>
+        <source><nobr>%1</nobr></source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over several image files that VirtualBox has created together with the snapshot will be merged into one file. This can be a lengthy process, and the information in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p></source>
+        <source>System</source>
+        <comment>details report</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <location line="+15"/>
-        <source>Delete</source>
-        <translation>Ezabatu</translation>
+        <source>Disabled</source>
+        <comment>details report (VRDP Server)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+22"/>
-        <location line="+9"/>
-        <source>Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
+        <source>Display</source>
+        <comment>details report</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <location line="+8"/>
-        <source>Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
+        <source>Raw File</source>
+        <comment>PortMode</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unable to mount the %1 <nobr><b>%2</b></nobr> on the machine <b>%3</b>.</source>
-        <translation type="obsolete">Ezinezkoa %1 osatzea <nobr><b>%2</b></nobr> <b>%3</b> makinan.</translation>
+        <source>Enabled</source>
+        <comment>details report (2D Video Acceleration)</comment>
+        <translation type="unfinished">Gaiturik</translation>
     </message>
     <message>
-        <source>Unable to unmount the %1 <nobr><b>%2</b></nobr> from the machine <b>%3</b>.</source>
-        <translation type="obsolete">Ezinezkoa %1 osatzea <nobr><b>%2</b></nobr> <b>%3</b> makinatik.</translation>
+        <source>Disabled</source>
+        <comment>details report (2D Video Acceleration)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+482"/>
-        <source>Force Unmount</source>
-        <translation>Behartu Desosatzea</translation>
+        <source>2D Video Acceleration</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>E&xit</source>
-        <comment>warnAboutSettingsAutoConversion message box</comment>
-        <translation type="obsolete">I&rten</translation>
+        <source>Not Attached</source>
+        <comment>details report (Storage)</comment>
+        <translation type="unfinished">Ez erantsia</translation>
     </message>
     <message>
-        <source>hard disk</source>
-        <comment>failed to mount ...</comment>
-        <translation type="obsolete">diska gogorra</translation>
+        <source>Storage</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD</source>
-        <comment>failed to mount ... host-drive</comment>
-        <translation type="obsolete">CD/DVD</translation>
+        <source>Teleported</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD image</source>
-        <comment>failed to mount ...</comment>
-        <translation type="obsolete">CD/DVD irudia</translation>
+        <source>Guru Meditation</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>floppy</source>
-        <comment>failed to mount ... host-drive</comment>
-        <translation type="obsolete">disketea</translation>
+        <source>Teleporting</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>floppy image</source>
-        <comment>failed to mount ...</comment>
-        <translation type="obsolete">diskete irudia</translation>
+        <source>Taking Live Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Are you sure you want to delete the CD/DVD-ROM device?</p><p>You will not be able to mount any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation type="obsolete"><p>Zihur zaude CD/DVD-ROM gailua ezabatzea nahi duzula?</p><p>Ezingo duzu CD edo ISO irudirik osatu edo Gonbidatu Gehigarririk ezarri bera gabe!</p></translation>
+        <source>Teleporting Paused VM</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-302"/>
-        <source>&Remove</source>
-        <comment>medium</comment>
-        <translation>&Kendu</translation>
+        <source>Restoring Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+686"/>
-        <source><p>VT-x/AMD-V hardware acceleration is not available on your system. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</source>
-        <translation><p>VT-x/AMD-V hardware bizkorpena ez dago eskuragarri zure sisteman. Zure 64-biteko gonbidatuak huts egin du 64-bit CPU-a atzematean eta ezingo da abiarazi.</translation>
+        <source>Deleting Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+18"/>
-        <source><p>VT-x/AMD-V hardware acceleration is not available on your system. Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p></source>
-        <translation><p>VT-x/AMD-V hardware bizkorpena ez dago eskuragarri zure sisteman. Zenbait gonbidatuk (adib. OS/2 eta QNX) ezaugarri hau behar dute eta huts egingo dute abiatzean bera gabe.</p></translation>
+        <source>Floppy</source>
+        <comment>StorageBus</comment>
+        <translation type="unfinished">Disketea</translation>
     </message>
     <message>
-        <location line="-938"/>
-        <source><p>Deleting the snapshot %1 will temporarily need more disk space. In the worst case the size of image %2 will grow by %3, however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting the snapshot at your own risk.</p></source>
+        <source>Paravirtualized Network (virtio-net)</source>
+        <comment>NetworkAdapterType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1070"/>
-        <source><p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p></source>
+        <source>I82078</source>
+        <comment>StorageControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-11"/>
-        <source><p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p><p>Press <b>Ignore</b> to switch the screen anyway or press <b>Cancel</b> to cancel the operation.</p></source>
+        <source>Empty</source>
+        <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Are you sure you want to download the VirtualBox User Manual from <nobr><a href="%1">%2</a></nobr> (size %3 bytes)?</p></source>
-        <translation type="obsolete"><p>Zihur zaude VirtualBox Erabiltzaile Eskuliburua jeistea nahi duzula hemendik, <nobr><a href="%1">%2</a></nobr> (neurria %3 byte)?</p></translation>
+        <source>Host Drive '%1'</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%2</a></nobr> and saved locally as <nobr><b>%3</b>.</nobr></p></source>
-        <translation type="obsolete"><p>VirtualBox Erabiltzaile Eskuliburua ongi jeitsi da hemendik, <nobr><a href="%1">%2</a></nobr> eta tokian gorde da honela <nobr><b>%3</b>.</nobr></p></translation>
+        <source>Host Drive %1 (%2)</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%2</a></nobr> but can't be saved locally as <nobr><b>%3</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation type="obsolete"><p>VirtualBox Erabiltzaile Eskuliburua ongi jeitsi da hemendik, <nobr><a href="%1">%2</a></nobr>baina ezin da tokian gorde honela <nobr><b>%3</b>.</nobr></p><p>Mesedez hautatu beste kokaleku bat agiriarentzat.</p></translation>
+        <source><p style=white-space:pre>Type (Format):  %1 (%2)</p></source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1376"/>
-        <source>Failed to open virtual machine located in %1.</source>
-        <translation>Hutsegitea %1 kokalekuan dagoen makina birtuala irekitzerakoan.</translation>
+        <source><p>Attached to:  %1</p></source>
+        <comment>image</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.</source>
-        <translation>Hutsegitea <i>%2</i> kokalekuan dagoen <b>%1</b> makina birtuala gehitzerakoan jadanik badagoelako.</translation>
+        <source><i>Not Attached</i></source>
+        <comment>image</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+124"/>
-        <source>Delete all files</source>
-        <translation>Ezabatu agiri guztiak</translation>
+        <source><i>Checking accessibility...</i></source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Remove only</source>
-        <translation>Kendu bakarrik</translation>
+        <source>Failed to check accessibility of disk image files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-81"/>
-        <location line="+73"/>
-        <location line="+262"/>
-        <location line="+16"/>
-        <source>Remove</source>
-        <translation>Kendu</translation>
+        <source><b>No disk image file selected</b></source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+112"/>
-        <source><p>You are about to add a virtual hard disk to controller <b>%1</b>.</p><p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p></source>
+        <source>You can also change this while the machine is running.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Create &new disk</source>
-        <comment>add attachment routine</comment>
-        <translation type="obsolete">&Sortu diska berria</translation>
+        <source><b>No disk image files available</b></source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>&Choose existing disk</source>
-        <comment>add attachment routine</comment>
-        <translation type="obsolete">&Hautatu badagoen diska</translation>
+    <message numerus="yes">
+        <source>%n year(s)</source>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
-    <message>
-        <location line="+10"/>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
+    <message numerus="yes">
+        <source>%n month(s)</source>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
-    <message>
-        <source>&Choose disk</source>
-        <comment>add attachment routine</comment>
-        <translation type="obsolete">&Hautatu diska</translation>
+    <message numerus="yes">
+        <source>%n day(s)</source>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
-    <message>
-        <source>Leave &empty</source>
-        <comment>add attachment routine</comment>
-        <translation type="obsolete">Utzi &hutsik</translation>
+    <message numerus="yes">
+        <source>%n hour(s)</source>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>%n minute(s)</source>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+    <message numerus="yes">
+        <source>%n second(s)</source>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
+        <source>Screens</source>
+        <comment>details report</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+247"/>
-        <source>Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <source>SAS</source>
+        <comment>StorageBus</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <source>LsiLogic SAS</source>
+        <comment>StorageControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <source>B</source>
+        <comment>size suffix Bytes</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+952"/>
-        <location line="+8"/>
-        <source>Failed to install the Extension Pack <b>%1</b>.</source>
+        <source>KB</source>
+        <comment>size suffix KBytes=1024 Bytes</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <location line="+8"/>
-        <source>Failed to uninstall the Extension Pack <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> Hedapen Paketea kentzerakoan.</translation>
+        <source>MB</source>
+        <comment>size suffix MBytes=1024 KBytes</comment>
+        <translation type="unfinished">MB</translation>
     </message>
     <message>
-        <location line="-44"/>
-        <source>&Remove</source>
-        <translation>&Kendu</translation>
+        <source>GB</source>
+        <comment>size suffix GBytes=1024 MBytes</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1138"/>
-        <source>The current port forwarding rules are not valid. None of the host or guest port values may be set to zero.</source>
+        <source>TB</source>
+        <comment>size suffix TBytes=1024 GBytes</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source><p>There are unsaved changes in the port forwarding configuration.</p><p>If you proceed your changes will be discarded.</p></source>
+        <source>PB</source>
+        <comment>size suffix PBytes=1024 TBytes</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-33"/>
-        <source>Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Gaiturik</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <source>Nested Paging</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+144"/>
-        <location line="+8"/>
-        <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
+        <source>Unknown device</source>
+        <comment>USB device details</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+589"/>
-        <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <source>Remote Desktop Server Port</source>
+        <comment>details report (VRDE Server)</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source><p>The virtual machine window will be now switched to <b>Seamless</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in seamless mode. You can access it by pressing <b>Host+Home</b>.</p></source>
+        <source>Remote Desktop Server</source>
+        <comment>details report (VRDE Server)</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch</source>
-        <comment>scale</comment>
-        <translation type="obsolete">Aldatu</translation>
+        <source>Disabled</source>
+        <comment>details report (VRDE Server)</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+404"/>
-        <location line="+7"/>
-        <source>Failed to open the Extension Pack <b>%1</b>.</source>
-        <translation><b>%1</b> Hedapen Paketea irekitzerakoan.</translation>
+        <source>hard disk</source>
+        <translation type="obsolete">disko gogorra</translation>
     </message>
     <message>
-        <location line="-92"/>
-        <source><p>You are about to install a VirtualBox extension pack. Extension packs complement the functionality of VirtualBox and can contain system level software that could be potentially harmful to your system. Please review the description below and only proceed if you have obtained the extension pack from a trusted source.</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%1< [...]
+        <source>All files (*)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Install</source>
-        <translation type="obsolete">&Ezarri</translation>
-    </message>
-    <message>
-        <location line="+19"/>
-        <source>Extension packs complement the functionality of VirtualBox and can contain system level software that could be potentially harmful to your system. Please review the description below and only proceed if you have obtained the extension pack from a trusted source.</source>
+        <source>Fault Tolerant Syncing</source>
+        <comment>MachineState</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source><p>An older version of the extension pack is already installed, would you like to upgrade? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>New Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Current Version:&nbsp;&nbsp;</b></td& [...]
-        <translation><p>Jadanik hedapen paketearen bertsio zaharrago bat dago ezarrita, eguneratzea nahi duzu? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Izena:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>Bertsio Berria:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Oraingo Bertsioa:&nbsp;&nbsp;</b&gt [...]
+        <source>Unlocked</source>
+        <comment>SessionState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>&Upgrade</source>
-        <translation>&Eguneratu</translation>
+        <source>Locked</source>
+        <comment>SessionState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>An newer version of the extension pack is already installed, would you like to downgrade? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>New Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Current Version:&nbsp;&nbsp;</b></t [...]
-        <translation><p>Jadanik hedapen paketearen bertsio berriago bat dago ezarrita, zaharragoratzea nahi duzu? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Izena:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>Bertsio Berria:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Oraingo Bertsioa:&nbsp;&nbsp;</b [...]
+        <source>Unlocking</source>
+        <comment>SessionState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source>&Downgrade</source>
-        <translation>&Zaharragoratu</translation>
+        <source>Null</source>
+        <comment>AuthType</comment>
+        <translation type="unfinished">Nulua</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>The extension pack is already installed with the same version, would you like reinstall it? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Description:&nbsp;&nbsp;</b></td>& [...]
-        <translation><p>Hedapen paketea jadanik bertsio berdinarekin ezarrita dago, berriro ezartzea nahi duzu? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Izena:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>Bertsioa:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Azalpena:&nbsp;&nbsp;</b></td>& [...]
+        <source>External</source>
+        <comment>AuthType</comment>
+        <translation type="unfinished">Kanpokoa</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>&Reinstall</source>
-        <translation>&Berriro ezarri</translation>
+        <source>Guest</source>
+        <comment>AuthType</comment>
+        <translation type="unfinished">Bezeroa</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source><p>You are about to remove the VirtualBox extension pack <b>%1</b>.</p><p>Are you sure you want to proceed?</p></source>
-        <translation><p>VirtualBox <b>%1</b> hedapen paketea kentzear zaude.</p><p>Zihur zaude jarraitzea nahi duzula?</p></translation>
+        <source>Intel HD Audio</source>
+        <comment>AudioControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+56"/>
-        <source>The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.</source>
-        <translation><br><nobr><b>%1</b><nobr><br> hedapen paketea ongi ezarri da.</translation>
+        <source>PIIX3</source>
+        <comment>ChipsetType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-763"/>
-        <source><p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>Please check that the parent really exists and that you have permissions to create the machine folder.</p></source>
-        <translation><p>Ezin da makinaren <b>%1</b> agiritegia sortu gaineko <nobr><b>%2</b> agiritegian.</nobr></p><p>Mesedez egiaztatu gainekoa egitan dagoela eta makina agiritegia sortzeko baimena duzula.</p></translation>
+        <source>ICH9</source>
+        <comment>ChipsetType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-76"/>
-        <source>Failed to register the virtual machine <b>%1</b>.</source>
-        <translation><b>%1</b> makina birtutala erregistratzerakoan.</translation>
+        <source>MB</source>
+        <comment>size suffix MBytes=1024KBytes</comment>
+        <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location line="-435"/>
-        <source><p>The machine settings were changed while you were editing them. You currently have unsaved setting changes.</p><p>Would you like to reload the changed settings or to keep your own changes?</p></source>
-        <translation><p>Makinaren ezarpenak aldatu egin dira editatzen zenituen bitartean. Une honetan gordegabeko ezarpen aldaketak dituzu.</p><p>Aldatutako ezarpenak birgertatzea edo zeure aldaketei heustea nahi duzu?</p></translation>
+        <source>Execution Cap</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Reload settings</source>
-        <translation>Birgertatu ezarpenak</translation>
+        <source><nobr>%1%</nobr></source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+0"/>
-        <source>Keep changes</source>
-        <translation>Heutsi aldaketei</translation>
+        <source>Generic, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-14"/>
-        <source>The virtual machine that you are changing has been started. Only certain settings can be changed while a machine is running. All other changes will be lost if you close this window now.</source>
-        <translation>Aldatzen ari zaren makina birtuala abiarazi egin da. Zenbati ezarpen bakarrik aldatu daitezke makina ekinean dagoela. Beste aldaketa guztiak galdu egingo dira leiho hau orain isten baduzu.</translation>
+        <source>Generic Driver</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+453"/>
-        <location line="+8"/>
-        <source>Failed to clone the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtuala klonatzerakoan.</translation>
+        <source>Adapter %1</source>
+        <translation type="unfinished">%1 Moldagailua</translation>
     </message>
     <message>
-        <location line="-674"/>
-        <source>Create a snapshot of the current machine state</source>
-        <translation>Sortu makinaren oraingo egoeraren argazki bat</translation>
+        <source>Disabled</source>
+        <comment>DragAndDropType</comment>
+        <translation type="unfinished">Ezgaiturik</translation>
     </message>
     <message>
-        <source>Sorry, some generic error happens.</source>
-        <translation type="obsolete">Barkatu, zenbati akats generiko gertatu dira.</translation>
+        <source>Host To Guest</source>
+        <comment>DragAndDropType</comment>
+        <translation type="unfinished">Ostalaritik Bezerora</translation>
     </message>
     <message>
-        <location line="+1799"/>
-        <source>Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might not be installed on the host computer</source>
-        <translation>Ezin da Hostalari USB Proxy Zerbitzua gertatu (VERR_FILE_NOT_FOUND). Badaiteke zerbitzua hostalari ordenagailuan ezarrita ez egotea</translation>
+        <source>Guest To Host</source>
+        <comment>DragAndDropType</comment>
+        <translation type="unfinished">Bezerotik Ostalarira</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>VirtualBox is not currently allowed to access USB devices.  You can change this by adding your user to the 'vboxusers' group.  Please see the user manual for a more detailed explanation</source>
-        <translation>VirtualBox-ek ez du sarbiderik USB gailuetara.  Hau zure erabiltzailea 'vboxusers' taldera gehituz aldatu dezakezu.  Mesedez ikusi erabiltzaile eskuliburua azalpen xehetuagorako</translation>
+        <source>Bidirectional</source>
+        <comment>DragAndDropType</comment>
+        <translation type="unfinished">Bi zentzuetakoa</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>VirtualBox is not currently allowed to access USB devices.  You can change this by allowing your user to access the 'usbfs' folder and files.  Please see the user manual for a more detailed explanation</source>
-        <translation>VirtualBox-ek ez du sarbiderik USB gailuetara.  Hau zure erabiltzaileari 'usbfe' agiritegira eta agirietara sarbidea ahalbidetuz aldatu dezakezu.  Mesedez ikusi erabiltzaile eskuliburua azalpen xehetuagorako</translation>
+        <source>Normal</source>
+        <comment>MediumType</comment>
+        <translation type="unfinished">Arrunta</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>The USB Proxy Service has not yet been ported to this host</source>
-        <translation>USB Proxy Zerbitzua oraindik ez dago hostalari honetan ezarrita</translation>
+        <source>Immutable</source>
+        <comment>MediumType</comment>
+        <translation type="unfinished">Aldaezina</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Could not load the Host USB Proxy service</source>
-        <translation>Ezin da Hostalari USB Proxy zerbitzua gertatu</translation>
+        <source>Writethrough</source>
+        <comment>MediumType</comment>
+        <translation type="unfinished">Idatzihola</translation>
     </message>
     <message>
-        <location line="-984"/>
-        <source>Can't find snapshot named <b>%1</b>.</source>
-        <translation>Ezin da<b>%1</b> izeneko berehalakoa aurkitu.</translation>
+        <source>Shareable</source>
+        <comment>MediumType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p></source>
-        <translation type="obsolete"><p>Hutsegitea jeitsitako agiria gordetzerakoan,<nobr><b>%1</b>.</nobr></p></translation>
+        <source>Readonly</source>
+        <comment>MediumType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+503"/>
-        <source><p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p><p>Do you wish to download latest one from the Internet?</p></source>
-        <translation><p><b><nobr>%2</nobr></b>-ren bertsio zahar bat (%1) duzu ezarrita.</p><p>Nahi duzu azkenengoa Internetetik jeistea?</p></translation>
+        <source>Multi-attach</source>
+        <comment>MediumType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Download</source>
-        <comment>extension pack</comment>
-        <translation type="obsolete">Jeitsi</translation>
+        <source>Dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>Are you sure you want to download the <b><nobr>%1</nobr></b> from <nobr><a href="%2">%2</a></nobr> (size %3 bytes)?</p></source>
-        <translation><p>Zihur zaude <b><nobr>%1</nobr></b> <nobr><a href="%2">%2</a></nobr>-tik jeistea nahi duzula (neurria %3 byte)?</p></translation>
+        <source>Dynamically allocated differencing storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source><p>The <b><nobr>%1</nobr></b> has been successfully downloaded from <nobr><a href="%2">%2</a></nobr> and saved locally as <nobr><b>%3</b>.</nobr></p><p>Do you wish to install this extension pack?</p></source>
-        <translation><p><b><nobr>%1</nobr></b> ongi jeitsi da <nobr><a href="%2">%2</a></nobr>-tik eta tokian gorde da <nobr><b>%3</b> bezala.</nobr></p><p>Nahi duzu hedapen pakete hau ezartzea?</p></translation>
+        <source>Fixed size storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <location line="+19"/>
-        <source>Install</source>
-        <comment>extension pack</comment>
-        <translation>Ezarri</translation>
+        <source>Dynamically allocated storage split into files of less than 2GB</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-35"/>
-        <source><p>The <b><nobr>%1</nobr></b> has been successfully downloaded from <nobr><a href="%2">%2</a></nobr> but can't be saved locally as <nobr><b>%3</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p><b><nobr>%1</nobr></b> ongi jeitsi da <nobr><a href="%2">%2</a></nobr>-tik baina ezin da tokian gorde <nobr><b>%3</b> bezala.</nobr></p><p>Mesedez hautatu beste kokaleku bat agiriarentzat.</p></translation>
+        <source>Dynamically allocated differencing storage split into files of less than 2GB</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-116"/>
-        <source><p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p><p>You should download and install version %3 of this extension pack from Oracle!</p></source>
-        <translation><p><b><nobr>%2</nobr></b>-ren %1 bertsioa  duzu ezarrita.</p><p> Hedapen pakete honen %3 bertsioa jeitsi eta ezarri behar duzu Oracle-tik!</p></translation>
+        <source>Fixed size storage split into files of less than 2GB</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ok</source>
-        <comment>extension pack</comment>
-        <translation type="obsolete">Ongi</translation>
+        <source>Dynamically allocated compressed storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1629"/>
-        <source><p>Failed to initialize COM because the VirtualBox global configuration directory <b><nobr>%1</nobr></b> is not accessible. Please check the permissions of this directory and of its parent directory.</p><p>The application will now terminate.</p></source>
+        <source>Dynamically allocated differencing compressed storage</source>
+        <comment>MediumVariant</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+169"/>
-        <source><p>You are about to remove following virtual machine items from the machine list:</p><p><b>%1</b></p><p>Do you wish to proceed?</p></source>
-        <translation><p>Hurrengo makina birtual gaiak kentzear zaude makinaren zerrendatik:</p><p><b>%1</b></p><p>Jarraitzea nahi duzu?</p></translation>
+        <source>Fixed size ESX storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+53"/>
-        <source><p>You are about to remove following inaccessible virtual machines from the machine list:</p><p>%1</p><p>Do you wish to proceed?</p></source>
-        <translation><p>Hurrengo sarbiderik gabeko makina birtuala kentzear zaude makinaren zerrendatik:</p><p><b>%1</b></p><p>Jarraitzea nahi duzu?</p></translation>
+        <source>Fixed size storage on raw disk</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well? Doing this will also remove the files containing the machine's virtual hard disks if they are not in use by another machine.</p></source>
+        <source>Deny</source>
+        <comment>NetworkAdapterPromiscModePolicy</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p></source>
+        <source>Allow VMs</source>
+        <comment>NetworkAdapterPromiscModePolicy</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1374"/>
-        <source>Do you wish to cancel all current network operations?</source>
-        <translation>Une honetako sare eragiketa guztiak ezeztatzea nahi duzu?</translation>
+        <source>Allow All</source>
+        <comment>NetworkAdapterPromiscModePolicy</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1290"/>
-        <source>ACPI Shutdown</source>
-        <comment>machine</comment>
-        <translation>ACPI Itzalketa</translation>
+        <source>Ignore</source>
+        <comment>USBDeviceFilterAction</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>Power Off</source>
-        <comment>machine</comment>
-        <translation>Itzali</translation>
+        <source>Hold</source>
+        <comment>USBDeviceFilterAction</comment>
+        <translation type="unfinished">Eskuratu</translation>
     </message>
     <message>
-        <location line="+791"/>
-        <source><p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p><p>Please check that this folder really exists and that you have permissions to remove it.</p></source>
-        <translation><p>Ezin da <nobr><b>%1</b> makina agiritegia kendu.</nobr></p><p>Mesedez egiaztatu agiritegi hau egitan dagoela eta kentzeko baimena duzula.</p></translation>
+        <source>UDP</source>
+        <comment>NATProtocol</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source><p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p></source>
-        <translation><p>Ezin da<b>%1</b> makina agiritegia sortu <nobr><b>%2</b> gaineko agiritegian.</nobr></p><p>Agiritegi hau jadanik badago eta zihurrenik beste makina batena da.</p></translation>
+        <source>TCP</source>
+        <comment>NATProtocol</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-86"/>
-        <source>You are about to create a new virtual machine without a hard drive. You will not be able to install an operating system on the machine until you add one. In the mean time you will only be able to start the machine using a virtual optical disk or from the network.</source>
+        <source>IDE Primary Master</source>
+        <comment>StorageSlot</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+866"/>
-        <location line="+7"/>
-        <source>Failed to drop data.</source>
+        <source>IDE Primary Slave</source>
+        <comment>StorageSlot</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-1625"/>
-        <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
+        <source>IDE Secondary Master</source>
+        <comment>StorageSlot</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source><p>Do you really want to reset the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
+        <source>IDE Secondary Slave</source>
+        <comment>StorageSlot</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source><p>Do you really want to send an ACPI shutdown signal to the following virtual machines?</p><p><b>%1</b></p></source>
+        <source>SATA Port %1</source>
+        <comment>StorageSlot</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>Do you really want to power off the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
+        <source>SCSI Port %1</source>
+        <comment>StorageSlot</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-187"/>
-        <source><p>You are trying to move machine <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p><p>Please resolve this name-conflict and try again.</p></source>
+        <source>SAS Port %1</source>
+        <comment>StorageSlot</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source><p>You are trying to move group <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p><p>Would you like to automatically rename it?</p></source>
+        <source>Floppy Device %1</source>
+        <comment>StorageSlot</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Rename</source>
-        <translation>Berrizendatu</translation>
+        <source>General</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished">Orokorra</translation>
     </message>
     <message>
-        <location line="+249"/>
-        <source><p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p><p>You can create a snapshot of the current state of the virtual machine first by checking the box below; if you do not do this the current state will be permanently lost. Do you wish to proceed?</p></source>
+        <source>Preview</source>
+        <comment>DetailsElementType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source><p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p></source>
+        <source>System</source>
+        <comment>DetailsElementType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-249"/>
-        <source>Failed to set groups of the virtual machine <b>%1</b>.</source>
-        <translation>Hutsegitea <b>%1</b> makina birtualaren taldeak ezartzerakoan.</translation>
+        <source>Display</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1224"/>
-        <source><p>Could not start the machine <b>%1</b> because the following physical network interfaces were not found:</p><p><b>%2</b></p><p>You can either change the machine's network settings or stop the machine.</p></source>
-        <translation><p>Ezin da <b>%1</b> makina abiarazi hurrengo sare interfaze fisikoak ez direlako aurkitu:</p><p><b>%2</b></p><p>Makinaren sare ezarpenak aldatu edo makina gelditu dezakezu.</p></translation>
+        <source>Storage</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Change Network Settings</source>
-        <translation>Aldatu Sare Ezarpenak</translation>
+        <source>Audio</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished">Audioa</translation>
     </message>
     <message>
-        <source>Close Virtual Machine</source>
-        <translation type="obsolete">Itxi Makina Birtuala</translation>
+        <source>Network</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished">Sarea</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="-1"/>
-        <source>Do not show this message again</source>
-        <translation type="unfinished">Ez erakutsi mezu hau berriro</translation>
+        <source>Serial ports</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMiniToolBar</name>
     <message>
-        <location filename="../src/widgets/UIMiniToolBar.cpp" line="+573"/>
-        <source>Always show the toolbar</source>
-        <translation>Betik erakutsi tresnabarra</translation>
+        <source>Parallel ports</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+27"/>
-        <source>Minimize Window</source>
-        <translation>Txikiengotu Leihoa</translation>
+        <source>USB</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished">USB</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Irten Ikusleiho Osotik edo Irudizko Modutik</translation>
+        <source>Shared folders</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Close VM</source>
-        <translation>Itxi MB</translation>
+        <source>Description</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMultiScreenLayout</name>
     <message>
-        <location filename="../src/runtime/UIMultiScreenLayout.cpp" line="+330"/>
-        <source>Virtual Screen %1</source>
-        <translation>Ikusleiho Birtuala %1</translation>
+        <source>Please choose a virtual hard drive file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Use Host Screen %1</source>
-        <translation>Erabili Hostalari Ikusleihoa %1</translation>
+        <source>All virtual hard drive files (%1)</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UINameAndSystemEditor</name>
     <message>
-        <location filename="../src/widgets/UINameAndSystemEditor.cpp" line="+159"/>
-        <source>&Name:</source>
-        <translation>&Izena:</translation>
+        <source>Please choose a virtual optical disk file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Holds the name of the virtual machine.</source>
+        <source>All virtual optical disk files (%1)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Selects the operating system family that you plan to install into this virtual machine.</source>
-        <translation>Makina birtual honetan ezartzeko asmoa duzun sistema eragile sendia hautatzen du.</translation>
+        <source>Please choose a virtual floppy disk file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation>Makina birtual honetan ezartzeko asmoa duzun sistema eragile sendia hautatzen du (sistema eragile gonbidatua deitua).</translation>
+        <source>All virtual floppy disk files (%1)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the name of the virtual machine.</source>
-        <translation type="obsolete">Makina birtualaren izen erakusten  du.</translation>
+        <source>VDI (VirtualBox Disk Image)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-4"/>
-        <source>&Type:</source>
-        <translation>&Mota:</translation>
+        <source>VMDK (Virtual Machine Disk)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the operating system family that you plan to install into this virtual machine.</source>
-        <translation type="obsolete">Makina birtual honetan ezartzeko asmoa duzun sistema eragile sendia erakusten du.</translation>
+        <source>VHD (Virtual Hard Disk)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Version:</source>
-        <translation>&Bertsioa:</translation>
+        <source>HDD (Parallels Hard Disk)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Displays the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation type="obsolete">Makina birtual honetan ezartzeko asmoa duzun sistema eragile sendia erakusten du. (gonbidatu sistema eragilea deitua).</translation>
+        <source>QED (QEMU enhanced disk)</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UINetworkManagerDialog</name>
     <message>
-        <location filename="../src/net/UINetworkManagerDialog.cpp" line="+155"/>
-        <source>Network Operations Manager</source>
-        <translation>Sare Eragiketa Kudeatzailea</translation>
+        <source>QCOW (QEMU Copy-On-Write)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>There are no active network operations.</source>
-        <translation>Ez dago sare eragiketarik gaituta.</translation>
+        <source>Please choose a location for new virtual hard drive file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>&Cancel All</source>
-        <translation>E&zeztatu Guztiak</translation>
+        <source>Enabled</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="obsolete">Gaiturik</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Cancel all active network operations</source>
-        <translation>Ezeztatu sare eragiketa gaitu guztiak</translation>
+        <source>Disabled</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <source>Error: %1.</source>
-        <translation type="obsolete">Akatsa: %1.</translation>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkRequestWidget.cpp" line="+179"/>
-        <source>The network operation failed with the following error: %1.</source>
-        <translation>Sare eragiketak huts egin du hurrengo akatsarekin: %1.</translation>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+18"/>
-        <source>Network Operation</source>
-        <translation>Sare Eragiketa</translation>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Restart network operation</source>
-        <translation>Berrabiarazi sare eragiketa</translation>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Cancel network operation</source>
-        <translation>Ezeztatu sare eragiketa</translation>
+        <source>Enabled</source>
+        <comment>unrestricted execution</comment>
+        <translation type="obsolete">Gaiturik</translation>
     </message>
-</context>
-<context>
-    <name>UINetworkManagerIndicator</name>
     <message>
-        <location filename="../src/net/UINetworkManagerIndicator.cpp" line="+210"/>
-        <source>Current network operations:</source>
-        <translation>Oraingo sare eragiketak:</translation>
+        <source>Disabled</source>
+        <comment>unrestricted execution</comment>
+        <translation type="obsolete">Ezgaiturik</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>failed</source>
-        <comment>network operation</comment>
-        <translation>hutsegitea</translation>
+        <source>Unrestricted Execution</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>(%1 of %2)</source>
-        <translation>(%1 -> %2-tik)</translation>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Double-click for more information.</source>
-        <translation>Klik-bikoitza argibide gehiagorako.</translation>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UINetworkReplyPrivate</name>
     <message>
-        <location filename="../src/net/UINetworkReply.cpp" line="+642"/>
-        <source>Host not found</source>
-        <translation>Hostalaria ez da aurkitu</translation>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Content access denied</source>
-        <translation>Edukirako sarbidea ukatuta</translation>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Protocol failure</source>
-        <translation>Protokolo hutsegitea</translation>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Wrong SSL certificate format</source>
-        <translation>SSL egiaztagiri heuskarri okerra</translation>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished">USB</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>SSL authentication failed</source>
-        <translation>SSL egiaztapen hutsegitea</translation>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Unknown reason</source>
-        <translation>Zergaitik ezezaguna</translation>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIPopupCenter</name>
     <message>
-        <location filename="../src/widgets/UIPopupPane.cpp" line="+274"/>
-        <location line="+1"/>
-        <source>Click for full details</source>
-        <translation>Klikatu xehetasun guztietarako</translation>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIPortForwardingModel</name>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="-378"/>
-        <source>Name</source>
-        <translation>Izena</translation>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Batez</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Protocol</source>
-        <translation>Protokoloa</translation>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Lehenetsia</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Host IP</source>
-        <translation>Hostalari IP-a</translation>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Host Port</source>
-        <translation>Hostalari Ataka</translation>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Guest IP</source>
-        <translation>Gonbidatu IP-a</translation>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Guest Port</source>
-        <translation>Gonbidatu Ataka</translation>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIProgressDialog</name>
     <message>
-        <location filename="../src/widgets/UIProgressDialog.cpp" line="+288"/>
-        <source>A few seconds remaining</source>
-        <translation>Segundu gutxi gelditzen dira</translation>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-157"/>
-        <source>Canceling...</source>
-        <translation>Ezeztatzen...</translation>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Cancel</source>
-        <translation>E&zeztatu</translation>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Cancel the current operation</source>
-        <translation>Ezeztatu oraingo eragiketa</translation>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+127"/>
-        <source>%1, %2 remaining</source>
-        <comment>You may wish to translate this more like "Time remaining: %1, %2"</comment>
-        <translation>%1, %2 gelditzen da</translation>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>%1 remaining</source>
-        <comment>You may wish to translate this more like "Time remaining: %1"</comment>
-        <translation>%1 gelditzen da</translation>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UISelectorWindow</name>
     <message>
-        <location filename="../src/selector/UISelectorWindow.cpp" line="+225"/>
-        <source>Show Toolbar</source>
-        <translation>Erakutsi Tresnabarra</translation>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Show Statusbar</source>
-        <translation>Erakutsi Egoerabarra</translation>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+123"/>
-        <source>Select a virtual machine file</source>
-        <translation>Hautatu makina birtual agiria</translation>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Virtual machine files (%1)</source>
-        <translation>Makina birtual agiriak (%1)</translation>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+514"/>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Ongi etorri VirtualBox-era!</h3><p>Leiho honetako ezker aldea zure ordenagailuko makina birtualen zerrenda bat da. Zerrenda orain hutsik dago oraindik ez duzulako makina birtualik sortu.<img src=:/welcome.png align=right/></p><p>Makina birtual berri bat sortzeko, sakatu <b>Berria</b> botoia leihoaren goialdeko tresna barra nagusian.</p><p><b>%1</b> tekla sakatu dezakezu berehalako laguntza lo [...]
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+80"/>
-        <source>Manager</source>
-        <comment>Note: main window title which is pretended by the product name.</comment>
-        <translation>Kudeatzailea</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UISession</name>
     <message>
-        <location filename="../src/runtime/UISession.cpp" line="+572"/>
-        <source>Updating Guest Additions</source>
-        <translation>Gonbidatu Gehigarriak Eguneratzen</translation>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UISettingsDialog</name>
     <message>
-        <location filename="../src/settings/UISettingsDialog.ui" line="+26"/>
-        <source><i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information.</i></source>
-        <translation><i>Hautatu ezarpen kategoria bat ezkerreko zerrendatik eta mugitu sagua ezarpen gaien gainean argibide gehiago lortzeko.</i></translation>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>On the <b>%1</b> page, %2</source>
-        <translation type="obsolete"><b>%1</b> orrialdean, %2</translation>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialog.cpp" line="+232"/>
-        <source>Invalid settings detected</source>
-        <translation>Ezarpen baliogabea atzeman da</translation>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+86"/>
-        <source><b>%1</b> page:</source>
-        <translation><b>%1</b> orrialdea:</translation>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source><b>%1: %2</b> page:</source>
-        <translation><b>%1: %2</b> orrialdea:</translation>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Non-optimal settings detected</source>
-        <translation type="obsolete">Ezarpen ez-hoberena atzeman da</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-56"/>
-        <source>Settings</source>
-        <translation>Ezarpenak</translation>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UISettingsDialogGlobal</name>
+    <name>VBoxGlobalSettings</name>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="+495"/>
-        <source>General</source>
-        <translation>Orokorra</translation>
+        <source>'%1 (0x%2)' is an invalid host key code.</source>
+        <translation type="obsolete">'%1 (0x%2)' ostalari gako kode oker bat da.</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Input</source>
-        <translation>Sarrera</translation>
+        <source>The value '%1' of the key '%2' doesn't match the regexp constraint '%3'.</source>
+        <translation>'%2' gakoaren '%1' balioak ez du '%3' espresio erregular murriztapena betetzen.</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Update</source>
-        <translation>Eguneraketa</translation>
+        <source>Cannot delete the key '%1'.</source>
+        <translation>Ezin da '%1' tekla ezabatu.</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Language</source>
-        <translation>Hizkuntza</translation>
+        <source>'%1' is an invalid host-combination code-sequence.</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxGlobalSettingsDlg</name>
     <message>
-        <source>USB</source>
-        <translation type="obsolete">USB</translation>
+        <source>Category</source>
+        <translation type="obsolete">Kategoria</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Network</source>
-        <translation>Sarea</translation>
+        <source>[id]</source>
+        <translation type="obsolete">[id]</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Extensions</source>
-        <translation>Hedapenak</translation>
+        <source>[link]</source>
+        <translation type="obsolete">[lotura]</translation>
     </message>
     <message>
-        <location line="+19"/>
-        <source>VirtualBox - %1</source>
-        <translation>VirtualBox - %1</translation>
+        <source>[name]</source>
+        <translation type="obsolete">[izena]</translation>
     </message>
     <message>
-        <location line="-15"/>
-        <source>Proxy</source>
-        <translation>Proxya</translation>
+        <source><i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information<i>.</source>
+        <translation type="obsolete"><i>Hautatu ezarpen kategoria bat ezkerreko zerrendatik eta mugitu sagua elementu baten gainetik argibide gehiago jasotzeko<i>.</translation>
     </message>
     <message>
-        <location line="-10"/>
-        <source>Display</source>
-        <translation>Erakuspena</translation>
+        <source> General </source>
+        <translation type="obsolete"> Orokorra </translation>
     </message>
-</context>
-<context>
-    <name>UISettingsDialogMachine</name>
     <message>
-        <location line="+375"/>
-        <source>General</source>
-        <translation>Orokorra</translation>
+        <source>0</source>
+        <translation type="obsolete">0</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>System</source>
-        <translation>Sistema</translation>
+        <source>#general</source>
+        <translation type="obsolete">#general</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Display</source>
-        <translation>Erakutsi</translation>
+        <source> Input </source>
+        <translation type="obsolete"> Idatzi </translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Storage</source>
-        <translation>Biltegia</translation>
+        <source>1</source>
+        <translation type="obsolete">1</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Audio</source>
-        <translation>Audioa</translation>
+        <source>#input</source>
+        <translation type="obsolete">#input</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Network</source>
-        <translation>Sarea</translation>
+        <source> USB </source>
+        <translation type="obsolete"> USB </translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Ports</source>
-        <translation>Atakak</translation>
+        <source>2</source>
+        <translation type="obsolete">2</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Serial Ports</source>
-        <translation>Serieko Atakak</translation>
+        <source>#usb</source>
+        <translation type="obsolete">#usb</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Parallel Ports</source>
-        <translation>Ataka Kidetuak</translation>
+        <source>Default &Folders</source>
+        <translation type="obsolete">Lehenetsiriko &Karpetak</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>USB</source>
-        <translation>USB</translation>
+        <source>Machines</source>
+        <translation type="obsolete">Makinak</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Shared Folders</source>
-        <translation>Elkarbanatutako Agiritegiak</translation>
+        <source>VDI files</source>
+        <translation type="obsolete">VDI fitxategiak</translation>
     </message>
     <message>
-        <location line="+18"/>
-        <source>%1 - %2</source>
-        <translation>%1 - %2</translation>
+        <source>Select</source>
+        <translation type="obsolete">Hautatu</translation>
     </message>
-</context>
-<context>
-    <name>UITextEditor</name>
     <message>
-        <location filename="../src/widgets/UILineTextEdit.cpp" line="-39"/>
-        <source>Edit text</source>
-        <translation>Editatu idazkia</translation>
+        <source>&Keyboard</source>
+        <translation type="obsolete">&Teklatua</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Replace...</source>
-        <translation>&Ordeztu...</translation>
+        <source>&Host Key</source>
+        <translation type="obsolete">&Ostalari Gakoa</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Replaces the current text with the content of a file.</source>
-        <translation>Ordeztu oraingo idazkia agiri baten edukiarekin.</translation>
+        <source>&Auto capture keyboard</source>
+        <translation type="obsolete">&Auto-kapturatu teklatua</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Text (*.txt);;All (*.*)</source>
-        <translation>Idazkia (*.txt);;Guztiak (*.*)</translation>
+        <source>Alt+A</source>
+        <translation type="obsolete">Alt+A</translation>
     </message>
     <message>
-        <location line="+0"/>
-        <source>Select a file to open...</source>
-        <translation>Hautatu irekitzeko agiri bat...</translation>
+        <source>&USB Device Filters</source>
+        <translation type="obsolete">&USB Gailu Iragazkiak</translation>
     </message>
-</context>
-<context>
-    <name>UIUpdateManager</name>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="+41"/>
-        <source>1 day</source>
-        <translation>1 egun</translation>
+        <source>Ins</source>
+        <translation type="obsolete">Ins</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>2 days</source>
-        <translation>2 egun</translation>
+        <source>Add Empty (Ins)</source>
+        <translation type="obsolete">Gehitu hutsa (Ins)</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>3 days</source>
-        <translation>3 egun</translation>
+        <source>Alt+Ins</source>
+        <translation type="obsolete">Alt+Ins</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>4 days</source>
-        <translation>4 egun</translation>
+        <source>Add From (Alt+Ins)</source>
+        <translation type="obsolete">Gehitu hemendik (Alt+Ins)</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>5 days</source>
-        <translation>5 egun</translation>
+        <source>Del</source>
+        <translation type="obsolete">Ezab</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>6 days</source>
-        <translation>6 egun</translation>
+        <source>Remove (Del)</source>
+        <translation type="obsolete">Ezabatu (Ezab)</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>1 week</source>
-        <translation>1 aste</translation>
+        <source>Removes the selected USB filter.</source>
+        <translation type="obsolete">Haututako USB iragazkia kentzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>2 weeks</source>
-        <translation>2 aste</translation>
+        <source>Ctrl+Up</source>
+        <translation type="obsolete">Ktrl+Gora</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>3 weeks</source>
-        <translation>3 aste</translation>
+        <source>Move Up (Ctrl+Up)</source>
+        <translation type="obsolete">Gora Mugitu (Ktrl-Gora)</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>1 month</source>
-        <translation>1 hilabete</translation>
+        <source>Moves the selected USB filter up.</source>
+        <translation type="obsolete">Haututako USB iragazkia gora mugitzen du.</translation>
     </message>
     <message>
-        <location line="+64"/>
-        <source>Never</source>
-        <translation>Inoiz ez</translation>
+        <source>Ctrl+Down</source>
+        <translation type="obsolete">Ktrl+Behera</translation>
     </message>
-</context>
-<context>
-    <name>UIUpdateStepVirtualBox</name>
     <message>
-        <location filename="../src/net/UIUpdateManager.cpp" line="+199"/>
-        <source>Checking for a new VirtualBox version...</source>
-        <translation>VirtualBox bertsio berririk dagoen egiaztatzen...</translation>
+        <source>Move Down (Ctrl+Down)</source>
+        <translation type="obsolete">Behera Mugitu (Ktrl-+ehera)</translation>
     </message>
-</context>
-<context>
-    <name>UIVMCloseDialog</name>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="+354"/>
-        <source>Close Virtual Machine</source>
-        <translation>Itxi Makina Birtuala</translation>
+        <source>Moves the selected USB filter down.</source>
+        <translation type="obsolete">Haututako USB iragazkia behera mugitzen du.</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>You want to:</source>
-        <translation>Nahi duzu:</translation>
+        <source>Help</source>
+        <translation type="obsolete">Laguntza</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation type="unfinished"></translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location line="-1"/>
-        <source>&Save the machine state</source>
-        <translation>&Gorde makinaren egoera</translation>
+        <source>Holds the dialog help.</source>
+        <translation type="obsolete">Elkarrizketa laguntza bistaratzen du.</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation type="unfinished"></translation>
+        <source>Invalid settings detected</source>
+        <translation type="obsolete">Okerreko ezarpenak atzeman dira</translation>
     </message>
     <message>
-        <location line="-1"/>
-        <source>S&end the shutdown signal</source>
-        <translation>&Bidali itzaltze seinalea</translation>
+        <source>&OK</source>
+        <translation type="obsolete">Ad&os</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Alt+O</source>
+        <translation type="obsolete">ALt+O</translation>
     </message>
     <message>
-        <location line="-1"/>
-        <source>&Power off the machine</source>
-        <translation>&Itzali makina</translation>
+        <source>Accepts (saves) changes and closes the dialog.</source>
+        <translation type="obsolete">Onartu (gorde) aldaketak eta elkarrizketa ixten du.</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Restore the machine state stored in the current snapshot</source>
-        <translation>Leheneratu makinaren biltegiratutako egoera oraingo berehalakoan</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation><p>Hautatutakoan, makina oraingo berehalakoan biltegiratutako egoerara itzuliko da itzali ondoren. Hau erabilgarria da azken saioetako emaitzak baztertzeaz eta argazki berri bat hasteaz zihur bazaude.</p></translation>
+        <source>Cancels changes and closes the dialog.</source>
+        <translation type="obsolete">Aldaketak desegin eta leihoa ixten du.</translation>
     </message>
     <message>
-        <location line="-2"/>
-        <source>&Restore current snapshot '%1'</source>
-        <translation>&Leheneratu oraingo berehalakoa '%1'</translation>
+        <source>VirtualBox Preferences</source>
+        <translation type="obsolete">VirtualBox Hobespenak</translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <location filename="../src/selector/UIVMDesktop.cpp" line="+211"/>
-        <source>&Details</source>
-        <translation>&Xehetasunak</translation>
+        <source>Holds the key used as a Host Key in the VM window. Activate the entry field and press a new Host Key. Note that alphanumeric, cursor movement and editing keys cannot be used.</source>
+        <translation type="obsolete">MB leihoan Ostalari Tekla bezala erabilitakoa tekla erakusten du. Eremua gaitu eta Ostalari Tekla berria sakatu. Kontutan izan alfazenbakizkoak, kurtsore mugimenduak eta edizio teklak ezin direla Ostalari tekla bezala erabili.</translation>
     </message>
     <message>
-        <location line="-32"/>
-        <source>&Snapshots</source>
-        <translation>&Berehalakoak</translation>
+        <source>New Filter %1</source>
+        <comment>usb</comment>
+        <translation type="obsolete">Iragazki Berri %1</translation>
     </message>
-</context>
-<context>
-    <name>UIVMListView</name>
     <message>
-        <location filename="../src/selector/UIVMItem.cpp" line="+164"/>
-        <location line="+12"/>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="+3"/>
-        <source>Inaccessible</source>
-        <translation>Eskuraezina</translation>
+        <source>Language</source>
+        <translation type="obsolete"> Hizkuntza </translation>
     </message>
     <message>
-        <location line="+16"/>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 -> %3-tik</nobr><br><nobr>Saioa %4</nobr></translation>
+        <source>3</source>
+        <translation type="obsolete">3</translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
-        <comment>Inaccessible VM tooltip (name, last state change)</comment>
-        <translation><nobr><b>%1</b><br></nobr><nobr>Eskuraezina %2-tik</nobr></translation>
+        <source>#language</source>
+        <translation type="obsolete">#language</translation>
     </message>
-</context>
-<context>
-    <name>UIVMLogViewer</name>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="+172"/>
-        <source>Close the search panel</source>
-        <translation>Itxi bilaketa panela</translation>
+        <source>&Interface Language</source>
+        <translation type="obsolete">&Interfaze Hizkuntza</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location line="+372"/>
-        <source>&Find</source>
-        <translation>&Bilatu</translation>
+        <source>Author(s):</source>
+        <translation type="obsolete">Egilea(k):</translation>
     </message>
     <message>
-        <location line="-371"/>
-        <source>Enter a search string here</source>
-        <translation>Sartu bilaketa kate bat hemen</translation>
+        <source>Language:</source>
+        <translation type="obsolete">Hizkuntza:</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>&Previous</source>
-        <translation>&Aurrekoa</translation>
+        <source> (built-in)</source>
+        <comment>Language</comment>
+        <translation type="obsolete"> (barneratua)</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Search for the previous occurrence of the string</source>
-        <translation>Bilatu katearen aurreko gertaera</translation>
+        <source><unavailable></source>
+        <comment>Language</comment>
+        <translation type="obsolete"><erabilezina></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Next</source>
-        <translation>&Hurrengoa</translation>
+        <source><unknown></source>
+        <comment>Author(s)</comment>
+        <translation type="obsolete"><ezezaguna></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Search for the next occurrence of the string</source>
-        <translation>Bilatu katearen hurrengo gertaera</translation>
+        <source>
+<qt>Lists all available user interface languages. The effective language is
+written in <b>bold</b>. Select <i>Default</i> to reset
+to the system default language.</qt>
+                                    </source>
+        <translation type="obsolete">
+<qt>
+<qt>Interfaze hizkuntza erabilgarrien zerrenda. Erabiltzen
+dena <b>lodian</b> idatzirik dago. Hautatu <i>Lehenetsia</i>
+sistemako lehenetsiriko hizkuntza berrezartzeko.</qt>
+                                    </translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>C&ase Sensitive</source>
-        <translation>Be&reizi Hizki Larri-xeheak</translation>
+        <source>Default</source>
+        <comment>Language</comment>
+        <translation type="obsolete">Lehenetsia</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Perform case sensitive search (when checked)</source>
-        <translation>Hizki larri-xeheak bereiziz bilatzen du (hautatutakoan)</translation>
+        <source>Holds the path to the default VDI folder. This folder is used, if not explicitly specified otherwise, when adding existing or creating new virtual hard disks.</source>
+        <translation type="obsolete">Lehenetsiriko VDI karpetaren bidea bistaratzen du. Karpeta hau erabiliko, beste ezer zehazten ez den bitartean, disko gogor birtual sortu edo gehitzerakoan.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>String not found</source>
-        <translation>Katea ez da aurkitu</translation>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Berrezarri makina birtual karpeta bidea lehenetsiriko baliora. Oraingo lehenetsiriko bidea bistaraziko da aldaketak onartu eta leiho hau berriz irekitzean.</translation>
     </message>
     <message>
-        <location line="+311"/>
-        <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
-        <translation><p>Ez da ohar agiririk aurkitu. Sakatu <b>Berritu</b> botoia <nobr><b>%1</b></nobr> ohar agiritegia berriro mihatzeko.</p></translation>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">VDI karpeta bidearen lehenetsiriko balioa berrezartzen du. Uneko lehenetsiriko bidea bistaraziko da aldaketak onartu eta leiho hau berriz irekitzean.</translation>
     </message>
     <message>
-        <location line="+33"/>
-        <source>Save VirtualBox Log As</source>
-        <translation>Gorde VirtualBox Oharra Honela</translation>
+        <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
+        <translation type="obsolete">Lehenetsiriko makina birtual karpetaren bidea bistaratzen du. Karpeta hau erabiliko, beste ezer zehazten ez den bitartean, makina birtualak sortzerakoan.</translation>
     </message>
     <message>
-        <location line="+14"/>
-        <source>%1 - VirtualBox Log Viewer</source>
-        <translation>%1 - VirtualBox Ohar Ikusgailua</translation>
+        <source>Opens a window to select the default VDI folder.</source>
+        <translation type="obsolete">Lehenetsiriko VDI karpeta hautatzeko leihoa irekitzen du.</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>&Refresh</source>
-        <translation>B&erritu</translation>
+        <source>Opens a window to select the default virtual machine folder.</source>
+        <translation type="obsolete">Lehenetsiriko makina birtual karpeta hautatzeko leihoa irekitzen du.</translation>
+    </message>
+    <message>
+        <source>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</source>
+        <translation type="obsolete">Markaturik dagoenean, teklatua automatikoki kapturatuko da MB leiho aktibatzen den bakoitzean. Teklatua kapturatzen denean, tekla sakatze guztiak (Alt-TAb bezalako sistemakoak barne) makina birtualera bidaliko da.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Save</source>
-        <translation>&Gorde</translation>
+        <source>Lists all global USB filters. The checkbox to the left defines whether the particular filter is enabled or not.</source>
+        <translation type="obsolete">USB iragazki orokorrak zerrendatzen ditu. Ezkerreko aukera kutxak iragazki bat gaiturik dagoen edo ez adierazten du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Close</source>
-        <translation>Itxi</translation>
+        <source>Adds a new USB filter with all fields initially set to empty strings. Note that such a filter will match any attached USB device.</source>
+        <translation type="obsolete">Gehitu USB iragazki berri bat eremu guztiak hutsean dituela. Kontutan izan iragazki honek erantsiriko edozein USB gailu aurkituko duela.</translation>
     </message>
-</context>
-<context>
-    <name>UIVMPreviewWindow</name>
     <message>
-        <source>Update Disabled</source>
-        <translation type="obsolete">Eguneraketa ezgaituta</translation>
+        <source>Adds a new USB filter with all fields set to the values of the selected USB device attached to the host PC.</source>
+        <translation type="obsolete">Ostalari ordenagailuari erantsitako hautatutako USB gailuaren eremu balioekin USB iragazki berri bat sortu.</translation>
     </message>
     <message>
-        <source>Every 0.5 s</source>
-        <translation type="obsolete">0.5 seg-tik behin</translation>
+        <source>V&RDP Authentication Library</source>
+        <translation type="obsolete">V&RDP Autentifikazio Liburutegia</translation>
     </message>
     <message>
-        <source>Every 1 s</source>
-        <translation type="obsolete">1 seg-tik behin</translation>
+        <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
+        <translation type="obsolete">Urruneko Pantaila (VRDP) bezeroentzat autentifikazioaz hornitzen duen liburutegiaren bidea erakusten du.</translation>
     </message>
     <message>
-        <source>Every 2 s</source>
-        <translation type="obsolete">2 seg-tik behin</translation>
+        <source>Opens a window to select the VRDP authentication library file.</source>
+        <translation type="obsolete">VRDP autentifikazio liburutegiaren bidea hautatzeko leihoa irekitzen du.</translation>
     </message>
     <message>
-        <source>Every 5 s</source>
-        <translation type="obsolete">5 seg-tik behin</translation>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Estratifikazio liburutegi fitxategia lehenetsiriko balioan berrezarri. Lehenetsiriko liburutegia erakutsiko da aldaketak onartu eta leiho hau berriz irekitzean.</translation>
     </message>
     <message>
-        <source>Every 10 s</source>
-        <translation type="obsolete">10 seg-tik behin</translation>
+        <source>&Extended Features</source>
+        <translation type="obsolete">&Hedaturiko Ezaugarriak</translation>
     </message>
     <message>
-        <source>No Preview</source>
-        <translation type="obsolete">Ez dago Aurreikuspenik</translation>
+        <source>Enable &VT-x/AMD-V</source>
+        <translation type="obsolete">&VT-x/AMD-V gaitu</translation>
     </message>
-</context>
-<context>
-    <name>UIWizard</name>
     <message>
-        <location filename="../src/wizards/UIWizard.cpp" line="+123"/>
-        <source>Hide Description</source>
-        <translation>Ezkutatu Azalpena</translation>
+        <source>Alt+V</source>
+        <translation type="obsolete">Alt+V</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Show Description</source>
-        <translation>Erakutsi Azalpena</translation>
+        <source>Defines whether virtual machines should try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V by default or not.</source>
+        <translation type="obsolete">Makina birtualek ostalariaren Intel VT-x and AMD-V bezalako cpu-aren hardware birtualizazio hedapenak lehenespen bezala erabili behar dituzten ezartzen du.</translation>
     </message>
 </context>
 <context>
-    <name>UIWizardCloneVD</name>
-    <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVD.cpp" line="+114"/>
-        <source>Copy Virtual Hard Drive</source>
-        <translation>Kopiatu Diska Gogor Birtuala</translation>
-    </message>
+    <name>VBoxHardDiskSettings</name>
     <message>
-        <location line="+1"/>
-        <source>Copy</source>
-        <translation>Kopiatu</translation>
+        <source>Hard Disk</source>
+        <translation type="obsolete">Disko gogorrak</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp" line="+110"/>
-        <source>Hard drive to copy</source>
-        <translation>Diska gogorra kopiara</translation>
+        <source>&Hard Disks</source>
+        <translation type="obsolete">Disko &Gogorrak</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>Please select the virtual hard drive file that you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select one.</p></source>
-        <translation><p>Mesedez hautatu kopiatzea nahi duzun diska gogor birtual agiria jadanik hautaturik ez badago. Zerrendatik ere hautatu dezakezu bat edo erabili zerrendaren ondoko agiritegia ikurra bat hautatzeko.</p></translation>
+        <source>Ins</source>
+        <translation type="obsolete">Ins</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="+228"/>
-        <source>Choose a virtual hard drive file to copy...</source>
-        <translation>Hautatu diska gogor birtual agiri bat kopiatzeko...</translation>
+        <source>Delete</source>
+        <translation type="obsolete">Ezabatu</translation>
     </message>
+</context>
+<context>
+    <name>VBoxHelpButton</name>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp" line="+130"/>
-        <source>Hard drive file type</source>
-        <translation>Diska gogor agiri mota</translation>
+        <source>&Help</source>
+        <translation type="obsolete">&Laguntza</translation>
     </message>
+</context>
+<context>
+    <name>VBoxLicenseViewer</name>
     <message>
-        <location line="+3"/>
-        <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Mesedez hautatu diska gogor birtual berrirako erabiltzea nahi duzun agiri mota. Beste birtualizazio software batekin erabili beharrik ez baduzu ezarpen hau aldatu gabe utzi dezakezu.</translation>
+        <source>VirtualBox License</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="+121"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="+10"/>
-        <source>Storage on physical hard drive</source>
-        <translation>Bitegiratu diska gogor fisikoan</translation>
+        <source>I &Agree</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>Mesedez hautatu diska gogor birtual berria handitu egin behar den erabileraren arabera (dinamikoki esleitua) edo gehienezko neurrian sortu behar den (neurri zuzendua).</translation>
+        <source>I &Disagree</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxLogSearchPanel</name>
     <message>
-        <location line="+2"/>
-        <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
-        <translation><p><b>Dinamikoki esleitutako</b> diska gogor agiriak zure diska gogor fisikoan betetze ahala erabiliko du tokia (gehienezkora arte <b>neurri zuzendua</b>), baina ez da berriro berezgaitasunez murriztuko toki askea gelditzen denean.</p></translation>
+        <source>Close the search panel</source>
+        <translation type="obsolete">Bilaketa panela itxi</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
-        <translation><p>A <b>neurri zuzendua</b> diska gogor agiriak denbora gehiago hartu dezake sortzeko zenbait sistematan baina erabiltzeko azkarragoa da.</p></translation>
+        <source>Find </source>
+        <translation type="obsolete">Bilatu </translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
-        <translation><p>Hautatu dezakezu ere diska gogorra agiri anitzetan <b>banantzea</b> bakoitza bi gigabyte arte. Hau erabilgarria da nagusiki makina birtuala USB gailu kengarri batean edo sistema zaharretan biltegiratzea nahi baduzu, hauetako batzuek ezin dute agiri oso handika kudeatu.</translation>
+        <source>Enter a search string here</source>
+        <translation type="obsolete">Bilaketa katea idatzi hemen</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="+1"/>
-        <source>&Dynamically allocated</source>
-        <translation>&Dinamikoki esleituta</translation>
+        <source>&Previous</source>
+        <translation type="obsolete">&Aurrekoa</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="+1"/>
-        <source>&Fixed size</source>
-        <translation>&Neurri zuzendua</translation>
+        <source>Alt+P</source>
+        <translation type="obsolete">Alt+A</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="+1"/>
-        <source>&Split into files of less than 2GB</source>
-        <translation>&Banandu 2 GB baino gutxiagoko agirietan</translation>
+        <source>Search for the previous occurrence of the string</source>
+        <translation type="obsolete">Katearen aurreko errepikatzea bilatu</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp" line="+82"/>
-        <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Mesedez hautatu diska gogor birtual agiriarentzako kokaleku bat</translation>
+        <source>&Next</source>
+        <translation type="obsolete">&Hurrengoa</translation>
     </message>
     <message>
-        <location line="+114"/>
-        <source>New hard drive to create</source>
-        <translation>Diska gogor berria sortzeko</translation>
+        <source>Alt+N</source>
+        <translation type="obsolete">Alt+H</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
-        <translation>Mesedez idatzi diska gogor birtual berriarentzako izena beheko kutxan edo klikatu agiritegia ikurrean agiria sortzeko beste agiritegi bat hautatzeko.</translation>
+        <source>Search for the next occurrence of the string</source>
+        <translation type="obsolete">Katearen hurrengo errepikatzea bilatu</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="-11"/>
-        <source>Choose a location for new virtual hard drive file...</source>
-        <translation>Hautatu diska gogor birtual agiri berriarentzako kokaleku bat...</translation>
+        <source>C&ase Sensitive</source>
+        <translation type="obsolete">Min/M&aius Ezberdindu</translation>
     </message>
     <message>
-        <location line="+15"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="-60"/>
-        <source>%1_copy</source>
-        <comment>copied virtual hard drive name</comment>
-        <translation>%1_kopia</translation>
+        <source>Perform case sensitive search (when checked)</source>
+        <translation type="obsolete">Maiuskula/minuskulak ezberdintzen egin bilaketa (hautaturik dagoenean)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="+57"/>
-        <source>Hard drive to &copy</source>
-        <translation>&Kopiatzeko diska gogorra</translation>
+        <source>String not found</source>
+        <translation type="obsolete">Katea ez da aurkitu</translation>
     </message>
+</context>
+<context>
+    <name>VBoxMediaComboBox</name>
     <message>
-        <location line="+2"/>
-        <source>&New hard drive to create</source>
-        <translation>&Sortzeko diska gogor berria</translation>
+        <source><no hard disk></source>
+        <translation type="obsolete"><disko gogorrik ez></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Hard drive file &type</source>
-        <translation>Diska gogor agiri &mota</translation>
+        <source>No hard disk</source>
+        <translation type="obsolete">Disko gogorrik ez</translation>
     </message>
 </context>
 <context>
-    <name>UIWizardCloneVM</name>
+    <name>VBoxMediaManagerDlg</name>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVM.cpp" line="+80"/>
-        <source>Linked Base for %1 and %2</source>
-        <translation>Loturatutako Ohina %1 eta %2-rako</translation>
+        <source>&Actions</source>
+        <translation type="unfinished">&Ekintzak</translation>
     </message>
     <message>
-        <location line="+85"/>
-        <source>Clone Virtual Machine</source>
-        <translation>Klonatu Makina Birtuala</translation>
+        <source>&New...</source>
+        <translation type="obsolete">&Berria...</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Clone</source>
-        <translation>Klonatu</translation>
+        <source>&Add...</source>
+        <translation type="obsolete">&Gehitu...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp" line="+59"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="+48"/>
-        <source>%1 Clone</source>
-        <translation>%1 Klona</translation>
+        <source>R&emove</source>
+        <translation type="unfinished">K&endu</translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>New machine name</source>
-        <translation>Makina berriaren izena</translation>
+        <source>Re&lease</source>
+        <translation type="unfinished">Argi&taratu</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>Please choose a name for the new virtual machine. The new machine will be a clone of the machine <b>%1</b>.</p></source>
-        <translation><p>Mesedez hautatu makina birtual berriarentzako izen bat. Makina berria <b>%1</b> makinaren klon bat izando da.</p></translation>
+        <source>Re&fresh</source>
+        <translation type="unfinished">&Freskatu</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="+81"/>
-        <source>When checked a new unique MAC address will be assigned to all configured network cards.</source>
-        <translation>Hautatutakoan MAC helbide bakarra esleituko zaie itxuratutako sare txartel guztieri.</translation>
+        <source>Create a new virtual hard disk</source>
+        <translation type="obsolete">Sortu disko birtual berri bat</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="+1"/>
-        <source>&Reinitialize the MAC address of all network cards</source>
-        <translation>&Berrabiarazi sare txartel guztien MAC helbidea</translation>
+        <source>Remove the selected disk image file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp" line="+88"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="-8"/>
-        <source>Clone type</source>
-        <translation>Klonatu mota</translation>
+        <source>Release the selected disk image file by detaching it from the machines</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>Please choose the type of clone you wish to create.</p><p>If you choose <b>Full clone</b>, an exact copy (including all virtual hard drive files) of the original virtual machine will be created.</p><p>If you choose <b>Linked clone</b>, a new machine will be created, but the virtual hard drive files will be tied to the virtual hard drive files of original machine and you will not be able to move the new virtual machi [...]
-        <translation type="unfinished"></translation>
+        <source>Refresh the list of disk image files</source>
+        <translation type="unfinished">Medio zerrenda freskatu</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>If you create a <b>Linked clone</b> then a new snapshot will be created in the original virtual machine as part of the cloning process.</p></source>
-        <translation><p><b>Loturaturiko klona</b> sortzen baduzu argazki berri bat sortuko da jatorrizko makina birtualean klonazio aurrerabidearen atal bezala.</p></translation>
+        <source>Location</source>
+        <translation type="obsolete">Kokalekuak</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>&Full clone</source>
-        <translation>&Klon osoa</translation>
+        <source>Attached to</source>
+        <translation type="obsolete">Honi erantsia</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Linked clone</source>
-        <translation>&Loturiko Klona</translation>
+        <source>Checking accessibility</source>
+        <translation type="unfinished">Eskuragarritasuna egiaztatzen</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="+90"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="+3"/>
-        <source>Snapshots</source>
-        <translation>Berehalakoak</translation>
+        <source>&Select</source>
+        <translation type="obsolete">&Hautatu</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>Please choose which parts of the snapshot tree should be cloned with the machine.</p></source>
-        <translation><p>Mesedez hautatu argazki zuhaitzaren zein atal klonatu behar diren makinarekin.</p></translation>
+        <source>Select a hard disk image file</source>
+        <translation type="obsolete">Disko gogor irudi fitxategia hautatu</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source><p>If you choose <b>Current machine state</b>, the new machine will reflect the current state of the original machine and will have no snapshots.</p></source>
-        <translation><p><b>Oraingo makina egoera</b> hautatzen baduzu, makina berriak jatorrizko makinaren uneko egoera isladatuko du eta ez du argazkirik izango.</p></translation>
+        <source>CD/DVD images (*.iso);;All files (*)</source>
+        <translation type="obsolete">CD/DVD irudiak (*.iso);;Fitxategi guztiak (*)</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>If you choose <b>Current snapshot tree branch</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the tree branch starting at the current state in the original machine.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Select a CD/DVD disk image file</source>
+        <translation type="obsolete">Hautatu CD/DVD disko irudi fitxategi bat</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><p>If you choose <b>Everything</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the original machine.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Floppy images (*.img);;All files (*)</source>
+        <translation type="obsolete">Diskete irudiak (*.img);;Fitxategi guztiak (*)</translation>
     </message>
     <message>
-        <location line="+16"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="+1"/>
-        <source>Current &machine state</source>
-        <translation>Oraingo &makinaren egoera</translation>
+        <source>Select a floppy disk image files</source>
+        <translation type="obsolete">Hautatu diskete irudi fitxategi bat</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="+1"/>
-        <source>Current &snapshot tree branch</source>
-        <translation>Oraingo &argazki zuhaitz adarra</translation>
+        <source><i>Not&nbsp;Attached</i></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="+1"/>
-        <source>&Everything</source>
-        <translation>&Dena</translation>
+        <source>--</source>
+        <comment>no info</comment>
+        <translation type="unfinished">--</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="-7"/>
-        <source>New machine &name</source>
-        <translation>&Makina berriaren izena</translation>
+        <source>Virtual Media Manager</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>&Full Clone</source>
-        <translation>&Klon osoa</translation>
+        <source>Name</source>
+        <translation type="unfinished">Izena</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Linked Clone</source>
-        <translation>&Loturiko Klona</translation>
+        <source>Virtual Size</source>
+        <translation type="unfinished">Tamaina Birtuala</translation>
     </message>
-</context>
-<context>
-    <name>UIWizardExportApp</name>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportApp.cpp" line="+88"/>
-        <source>Checking files ...</source>
-        <translation>Agiriak egiaztatzen...</translation>
+        <source>Actual Size</source>
+        <translation type="unfinished">Uneko Tamaina</translation>
     </message>
     <message>
-        <location line="+22"/>
-        <source>Removing files ...</source>
-        <translation>Agiriak kentzen...</translation>
+        <source>&CD/DVD Images</source>
+        <translation type="obsolete">&CD/DVD Irudiak</translation>
     </message>
     <message>
-        <location line="+39"/>
-        <source>Exporting Appliance ...</source>
-        <translation>Makina Birtuala Esportatzen...</translation>
+        <source>Size</source>
+        <translation type="unfinished">Tamaina</translation>
     </message>
     <message>
-        <location line="+92"/>
-        <source>Export Virtual Appliance</source>
-        <translation>Esportatu Makina Birtuala</translation>
+        <source>&Floppy Images</source>
+        <translation type="obsolete">&Diskete irudiak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Restore Defaults</source>
-        <translation>Leheneratu Berezkoetara</translation>
+        <source>Attached to</source>
+        <comment>VMM: Virtual Disk</comment>
+        <translation type="obsolete">Honi erantsia</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Export</source>
-        <translation>Esportatu</translation>
+        <source>Attached to</source>
+        <comment>VMM: CD/DVD Image</comment>
+        <translation type="obsolete">Honi erantsia</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp" line="+134"/>
-        <source>Virtual machines to export</source>
-        <translation>Esportatzeko Makina Birtualak</translation>
+        <source>Attached to</source>
+        <comment>VMM: Floppy Image</comment>
+        <translation type="obsolete">Honi erantsia</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.</p></source>
-        <translation type="unfinished"></translation>
+        <source>hard disk</source>
+        <translation type="obsolete">disko gogorra</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp" line="+115"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp" line="+105"/>
-        <source>Appliance settings</source>
-        <translation>Makina Birtual ezarpenak</translation>
+        <source>Type:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Please choose where to create the virtual appliance. You can create it on your own computer, on the Sun Cloud service or on an S3 storage server.</source>
+        <source>Location:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Create on</source>
-        <translation>Sortze eguna</translation>
+        <source>Format:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&This computer</source>
-        <translation>&Ordenagailu hau</translation>
+        <source>Storage details:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+223"/>
-        <source>Sun &Cloud</source>
+        <source>Attached to:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>&Simple Storage System (S3)</source>
-        <translation>&Biltegi Arrunt Sistema (S3)</translation>
+        <source>&Copy...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="+298"/>
-        <source>Storage settings</source>
-        <translation>Biltegiratze ezarpenak</translation>
+        <source>&Modify...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+3"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="-8"/>
-        <source>Appliance</source>
-        <translation>Makina Birtuala</translation>
+        <source>Copy an existing disk image file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+9"/>
-        <source>&Username:</source>
-        <translation>&Erabiltzaile-izena:</translation>
+        <source>Modify the attributes of the selected disk image file</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>&Password:</source>
-        <translation>&Sarhitza:</translation>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>&Hostname:</source>
-        <translation>&Hostalari-izena:</translation>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>&Bucket:</source>
+        <source>Encrypted with key:</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxNIList</name>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>&File:</source>
-        <translation>&Agiria:</translation>
+        <source>VirtualBox Host Interface %1</source>
+        <translation type="obsolete">VirtualBox %1 Ostalari interfazea</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+2"/>
-        <source>Please choose a file to export the virtual appliance to</source>
-        <translation type="unfinished"></translation>
+        <source><p>Do you want to remove the selected host network interface <nobr><b>%1</b>?</nobr></p><p><b>Note:</b> This interface may be in use by one or more network adapters of this or another VM. After it is removed, these adapters will no longer work until you correct their settings by either choosing a different interface name or a different adapter attachment type.</p></source>
+        <translation type="obsolete"><p>Hautaturiko <nobr><b>%1</b></nobr> sare interfazea ezabatu nahi al duzu? </p><p><b>Oharra:</b> Interfaze hau erabilia egon daiteke sare moldagailu bat edo gehiagorengatik beste MB batetan. Ezabatu ondoren sare moldagailu horiek ez dute funtzionatuko ezarpen horiek aldatu arte  edo beste interfaze izen bat hautatuz o moldagailu eranste modu ezberdin bat hautatuaz.</p></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+9"/>
-        <source>Write in standard OVF 1.0 format.</source>
-        <translation>OVF 1.0 heuskarri estandarrean idatzia.</translation>
+        <source>Host &Interfaces</source>
+        <translation type="obsolete">Ostalari &Interfazeak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>OVF 2.0 heuskarri esperimental berrian idatzia.</translation>
+        <source>Lists all available host interfaces.</source>
+        <translation type="obsolete">Ostalari interfaze erabilgarriak zerrendatzen ditu.</translation>
     </message>
     <message>
-        <source>Please choose a virtual appliance file</source>
-        <translation type="obsolete">Mesedez hautatu makina birtual agiria</translation>
+        <source>Adds a new host interface.</source>
+        <translation type="obsolete">Ostalari interfaze berri bat gehitzen du.</translation>
     </message>
     <message>
-        <location line="-9"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="-9"/>
-        <source>Open Virtualization Format Archive (%1)</source>
-        <translation>Ireki Birtualizazio Heuskarri Artxiboa (%1)</translation>
+        <source>Removes the selected host interface.</source>
+        <translation type="obsolete">Hautatutako ostalari interfazea ezabatzen du.</translation>
     </message>
+</context>
+<context>
+    <name>VBoxOSTypeSelectorWidget</name>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>Open Virtualization Format (%1)</source>
-        <translation>Ireki Birtualizazio Heuskarria (%1)</translation>
+        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
+        <translation type="obsolete">Makina birtual honetan instalatzea pentsatzen duzun sistema eragilea erakusten du (sistema eragile bezeroa deiturikoa).</translation>
     </message>
+</context>
+<context>
+    <name>VBoxRegistrationDlg</name>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>F&ormat:</source>
-        <translation>&Heuskarria:</translation>
+        <source>Connection timed out.</source>
+        <translation type="obsolete">Konexioa denboraz kanpo.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
+</context>
+<context>
+    <name>VBoxSFDialog</name>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <source>Shared Folders</source>
+        <translation type="obsolete">Partekatutako Karpetak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
-        <translation>Idatzi ondorena OVF 0.9 heuskarria beste birtualizazio produktuekin bateragarria izateko.</translation>
+        <source>Help</source>
+        <translation type="obsolete">Laguntza</translation>
     </message>
     <message>
-        <source>&Write legacy OVF 0.9</source>
-        <translation type="obsolete">&Idatzi ondorena OVF 0.9</translation>
+        <source>&OK</source>
+        <translation type="obsolete">Ad&os</translation>
     </message>
+</context>
+<context>
+    <name>VBoxScreenshotViewer</name>
     <message>
-        <location line="+4"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+4"/>
-        <source>Create a Manifest file for automatic data integrity checks on import.</source>
-        <translation>Sortu Adierazpen agiri bat berezgaitasunezko datu barnerapen egiaztapenerako inportazioan.</translation>
+        <source>Screenshot of %1 (%2)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+1"/>
-        <source>Write &Manifest file</source>
-        <translation>Idaz &Adierazpen agiria</translation>
+        <source>Click to view non-scaled screenshot.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp" line="+3"/>
-        <source>This is the descriptive information which will be added to the virtual appliance.  You can change it by double clicking on individual lines.</source>
+        <source>Click to view scaled screenshot.</source>
         <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxSelectorWnd</name>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="-25"/>
-        <source>Virtual &machines to export</source>
-        <translation>E&sportatzeko makina birtualak</translation>
+        <source>VirtualBox OSE</source>
+        <translation type="obsolete">VirtualBox OSE</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Appliance &settings</source>
-        <translation>&Makina birtual ezarpenak</translation>
+        <source>innotek VirtualBox</source>
+        <translation type="obsolete">innotek VirtualBox</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Destination</source>
-        <translation>&Helmuga</translation>
+        <source>&Details</source>
+        <translation type="obsolete">&Xehetasunak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Storage settings</source>
-        <translation>&Biltegiratze ezarpenak</translation>
+        <source>Virtual &Disk Manager...</source>
+        <translation type="obsolete">&Disko Birtual Kudeatzailea...</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Local Filesystem </source>
-        <translation>&Tokiko Agiri-sistema </translation>
+        <source>Ctrl+D</source>
+        <translation type="obsolete">Ktrl+D</translation>
     </message>
-</context>
-<context>
-    <name>UIWizardExportAppPageBasic3</name>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="-13"/>
-        <source>Choose a file to export the virtual appliance to...</source>
-        <translation type="unfinished"></translation>
+        <source>Display the Virtual Disk Manager window</source>
+        <translation type="obsolete">Makina Birtual Kudeaketa leihoa bistazten du</translation>
     </message>
     <message>
-        <location line="+73"/>
-        <source><p>Please choose a filename to export the OVF/OVA to.</p><p>If you use an <i>ova</i> extension, then all the files will be combined into one Open Virtualization Format Archive.</p><p>If you use an <i>ovf</i> extension, several files will be written separately.</p><p>Other extensions are not allowed.</p></source>
-        <translation type="unfinished"></translation>
+        <source>&Preferences...</source>
+        <comment>global settings</comment>
+        <translation type="obsolete">Hobes&penak...</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.</source>
-        <translation>Mesedez osatu erabiltzaile-iizena, sarhitza eta ontzia bezalako eremu gehigarriak, eta eman agirizen bat OVF xedearentzat.</translation>
+        <source>Ctrl+G</source>
+        <translation type="obsolete">Ktrl+G</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Please complete the additional fields like the username, password, hostname and the bucket, and provide a filename for the OVF target.</source>
-        <translation>Mesedez osatu erabiltzaile-iizena, sarhitza, hostalari-izena eta ontzia bezalako eremu gehigarriak, eta eman agirizen bat OVF xedearentzat.</translation>
+        <source>Display the global settings window</source>
+        <translation type="obsolete">Ezarpen orokor leihoa bistarazi</translation>
     </message>
-</context>
-<context>
-    <name>UIWizardExportAppPageExpert</name>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="+8"/>
-        <source>Choose a file to export the virtual appliance to...</source>
-        <translation type="unfinished"></translation>
+        <source>E&xit</source>
+        <translation type="obsolete">I&rten</translation>
     </message>
-</context>
-<context>
-    <name>UIWizardFirstRun</name>
     <message>
-        <location filename="../src/wizards/firstrun/UIWizardFirstRun.cpp" line="+96"/>
-        <source>Select start-up disk</source>
-        <translation>Hautatu Hasiera diska</translation>
+        <source>Ctrl+Q</source>
+        <translation type="obsolete">Ktrl+Q</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Start</source>
-        <translation>Hasi</translation>
+        <source>Close application</source>
+        <translation type="obsolete">Aplikazioa Itxi</translation>
     </message>
     <message>
-        <location filename="../src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp" line="+108"/>
-        <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from and should contain the operating system you wish to install on the virtual machine if you want to do that now. The disk will be ejected from the virtual drive automatically next time you switch the virtual machine off, but you can also do this yourself if needed u [...]
-        <translation type="unfinished"></translation>
+        <source>&New...</source>
+        <translation type="obsolete">&Berria...</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from. As this virtual machine has no hard drive you will not be able to install an operating system on it at the moment.</p></source>
-        <translation type="unfinished"></translation>
+        <source>New</source>
+        <translation type="obsolete">Berria</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Choose a virtual optical disk file...</source>
-        <translation>Hautatu diska optiko birtual agiri bat...</translation>
+        <source>Ctrl+N</source>
+        <translation type="obsolete">Ktrl+N</translation>
     </message>
-</context>
-<context>
-    <name>UIWizardImportApp</name>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="+116"/>
-        <source>Restore Defaults</source>
-        <translation>Leheneratu Berezkoetara</translation>
+        <source>Create a new virtual machine</source>
+        <translation type="obsolete">Makina Birtual Berria Sortu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Import</source>
-        <translation>Inportatu</translation>
+        <source>&Settings...</source>
+        <translation type="obsolete">&Ezarpenak...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp" line="+61"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="+96"/>
-        <source>Appliance to import</source>
-        <translation>Inportatzeko makina birtuala</translation>
+        <source>Settings</source>
+        <translation type="obsolete">Ezarpenak</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below.</p></source>
-        <translation type="unfinished"></translation>
+        <source>Ctrl+S</source>
+        <translation type="obsolete">Ktrl+E</translation>
+    </message>
+    <message>
+        <source>Configure the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtuala konfiguratu</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="+1"/>
-        <source>Choose a virtual appliance file to import...</source>
-        <translation type="unfinished"></translation>
+        <source>&Delete</source>
+        <translation type="obsolete">E&zabatu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="+1"/>
-        <source>Please choose a virtual appliance file to import</source>
-        <translation type="unfinished"></translation>
+        <source>Delete</source>
+        <translation type="obsolete">Ezabatu</translation>
     </message>
     <message>
-        <source>Open appliance...</source>
-        <translation type="obsolete">Ireki makina birtuala...</translation>
+        <source>Delete the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtuala ezabatu</translation>
     </message>
     <message>
-        <source>Select an appliance to import</source>
-        <translation type="obsolete">Hautatu inportatzeko makina birtuala</translation>
+        <source>D&iscard</source>
+        <translation type="obsolete">Ba&ztertu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="+1"/>
-        <source>Open Virtualization Format (%1)</source>
-        <translation>Ireki Birtualizazio Heuskarria (%1)</translation>
+        <source>Discard</source>
+        <translation type="obsolete">Baztertu</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp" line="+56"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="+1"/>
-        <source>Appliance settings</source>
-        <translation>Makina birtual ezarpenak</translation>
+        <source>Discard the saved state of the selected virtual machine</source>
+        <translation type="obsolete">Baztertu hautatutako makina birtualaren gordetako egoera</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
-        <translation type="unfinished"></translation>
+        <source>&Refresh</source>
+        <translation type="obsolete">F&reskatu</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="-2"/>
-        <source>Import Virtual Appliance</source>
-        <translation>Inportatu Makina Birtuala</translation>
+        <source>Refresh</source>
+        <translation type="obsolete">Freskatu</translation>
     </message>
-</context>
-<context>
-    <name>UIWizardNewVD</name>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVD.cpp" line="+118"/>
-        <source>Create Virtual Hard Drive</source>
-        <translation>Sortu Diska Gogor Birtuala</translation>
+        <source>Ctrl+R</source>
+        <translation type="obsolete">Ktrl+R</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Create</source>
-        <translation>Sortu</translation>
+        <source>Refresh the accessibility state of the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtualaren eskuragarritasun egoera freskatu</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic1.cpp" line="+129"/>
-        <source>Hard drive file type</source>
-        <translation>Diska gogor agiri mota</translation>
+        <source>&Contents...</source>
+        <translation type="obsolete">&Edukiak...</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Mesedez hautatu diska gogor berriarentzako erabiltzea nahi duzun agiri mota. Ez baduzu beste birtualizazio software batekin erabili beharrik ezarpen hau aldatugabe utzi dezakezu.</translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="+121"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="+253"/>
-        <source>Storage on physical hard drive</source>
-        <translation>Biltegiratu diska gogor fisikoan</translation>
+        <source>Show the online help contents</source>
+        <translation type="obsolete">Sare bidezko laguntza edukia bistarazi</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>Mesedez hautatu diska gogor berria hazi egin behar den erabili ahala (dinamikoki esleituta) edo gehinezko neurrian sortu behar den (neurri zuzendua).</translation>
+        <source>&VirtualBox Web Site...</source>
+        <translation type="obsolete">&VirtualBox Web Gunea...</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
-        <translation><p><b>dinamikoki esleituta</b> diska gogor agiri batek bete ahala erabiltzen du tokia zure diska gogor fisikoan (gehinezkora arte <b>neurri zuzendua</b>), baina ez da gutxiagoratuko berriro toki askea gelditzen bada.</p></translation>
+        <source>Open the browser and go to the VirtualBox product web site</source>
+        <translation type="obsolete">Nabigatzailea ireki eta VirtualBox produktuaren gunera joan</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
-        <translation><p>A <b>neurri zuzendua</b> diska gogor agiriak denbora gehiago hartu dezake sortzeko zenbait sistematan baina erabiltzeko azkarragoa da.</p></translation>
+        <source>&About VirtualBox...</source>
+        <translation type="obsolete">VirtualBox-ri &Buruz...</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
-        <translation><p>Hautatu dezakezu ere diska gogorra agiri anitzetan <b>banantzea</b> bakoitza bi gigabyte arte. Hau erabilgarria da nagusiki makina birtuala USB gailu kengarri batean edo sistema zaharretan biltegiratzea nahi baduzu, hauetako batzuek ezin dute agiri oso handika kudeatu.</translation>
+        <source>Show a window with product information</source>
+        <translation type="obsolete">Produktu argibideekin leiho bat bistarazi du</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="+1"/>
-        <source>&Dynamically allocated</source>
-        <translation>&Dinamikoki esleituta</translation>
+        <source>&Reset All Warnings</source>
+        <translation type="obsolete">Abisu Guztiak Be&rrezarri</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="+1"/>
-        <source>&Fixed size</source>
-        <translation>&Neurri zuzendua</translation>
+        <source>Go back to showing all suppressed warnings and messages</source>
+        <translation type="obsolete">Ezabatutako abisu eta mezu guztiak berriz agertzea eragien du</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="+1"/>
-        <source>&Split into files of less than 2GB</source>
-        <translation>&Banandu 2 GB baino gutxiagoko agirietan</translation>
+        <source>&File</source>
+        <translation type="obsolete">&Fitxategia</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp" line="+231"/>
-        <source><nobr>%1 (%2 B)</nobr></source>
-        <translation><nobr>%1 %2</nobr></translation>
+        <source>&Help</source>
+        <translation type="obsolete">&Laguntza</translation>
     </message>
     <message>
-        <location line="+131"/>
-        <source>File location and size</source>
-        <translation>Agiri kokalekua eta neurria</translation>
+        <source>&Snapshots</source>
+        <translation type="obsolete">&Egoera-argazkia</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
-        <translation>Mesedez idatzi diska gogor birtual berriarentzako izean beheko kutxan edo klikatu agiritegia ikurrean agiria sortzeko beste agiritegi bat hautatzeko.</translation>
+        <source>D&escription</source>
+        <translation type="obsolete">A&zalpena</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="-12"/>
-        <source>Choose a location for new virtual hard drive file...</source>
-        <translation>Hautatu diska gogor birtual agiri berriarentzako kokaleku bat...</translation>
+        <source>D&escription *</source>
+        <translation type="obsolete">A&zalpena *</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Select the size of the virtual hard drive in megabytes. This size is the limit on the amount of file data that a virtual machine will be able to store on the hard drive.</source>
-        <translation>Hautatu diska gogor birtualaren neurria megabytetan. Neurri hau makina birtualak diska gogorrean biltegiratu ahalko duen datu kopuruaren muga da.</translation>
+        <source>S&how</source>
+        <translation type="obsolete">I&kusi</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="-1"/>
-        <source>File &location</source>
-        <translation>Agiri &kokalekua</translation>
+        <source>Show</source>
+        <translation type="obsolete">Ikusi</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>File &size</source>
-        <translation>Agiri &neurria</translation>
+        <source>Switch to the window of the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtualaren leihora aldatu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Hard drive file &type</source>
-        <translation>Diska gogor agiri &mota</translation>
+        <source>S&tart</source>
+        <translation type="obsolete">Abiara&zi</translation>
     </message>
-</context>
-<context>
-    <name>UIWizardNewVM</name>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVM.cpp" line="+276"/>
-        <source>Create Virtual Machine</source>
-        <translation>Sortu Makina Birtuala</translation>
+        <source>Start</source>
+        <translation type="obsolete">Abiarazi</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Create</source>
-        <translation>Sortu</translation>
+        <source>Start the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtuala abiarazi</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic1.cpp" line="+291"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="+222"/>
-        <source>Name and operating system</source>
-        <translation>Izena eta sistema eragilea</translation>
+        <source>&Machine</source>
+        <translation type="obsolete">&Makina</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</source>
-        <translation>Mesedez hautatu makina birtual berriarentzako azalpen izen bat eta ezartzen saiatzen ari zaren sistema eragile mota. Hautatzen duzun izena VirtualBox-en zehar erabiliko da makina hau ezagutzeko.</translation>
+        <source>Show &Log...</source>
+        <translation type="obsolete">E&rregistroa Ikusi...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic2.cpp" line="+127"/>
-        <source>Memory size</source>
-        <translation>Oraimen neurria</translation>
+        <source>Show Log...</source>
+        <translation type="obsolete">Erregistroa Ikusi...</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><p>Select the amount of memory (RAM) in megabytes to be allocated to the virtual machine.</p><p>The recommended memory size is <b>%1</b> MB.</p></source>
-        <translation><p>Hautatu makina birtualari esleitzeko oroimen (RAM) kopurua megabyte-tan.</p><p>Gomendaturiko oroimen neurria da: <b>%1</b> MB.</p></translation>
+        <source>Ctrl+L</source>
+        <translation type="obsolete">Ktrl+L</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp" line="+198"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="+5"/>
-        <source>Hard drive</source>
-        <translation>Diska gogorra</translation>
+        <source>Show the log files of the selected virtual machine</source>
+        <translation type="obsolete">Hautatutako makina birtualaren erregistro fitxategiak ikusi</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><p>If you wish you can add a virtual hard drive to the new machine. You can either create a new hard drive file or select one from the list or from another location using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step and make the changes to the machine settings once the machine is created.</p><p>The recommended size of the hard drive is <b>%1</b>.</p></source>
-        <translation><p>Nahi baduzu diska gogor birtual bat gehitu ahal diozu makina birtual berriari. Diska gogor agiri berri bat ere sortu dezakezu edo hautatu bat zerrendatik edo beste kokaleku batetik agiritegia ikurra erabiliz.</p><p>Biltegiratze ezarpen korapilotsuago bat behar baduzu urrats hau jauzi dezakezu eta aldaketak makinaren ezarpenetatik egin behin sortuta dagoenean.</p><p>Gomendaturiko diska gogor neurria da: <b>%1</b>.</p> [...]
+        <source>R&esume</source>
+        <translation type="obsolete">Ja&rraitu</translation>
     </message>
     <message>
-        <location line="+10"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="+4"/>
-        <source>Choose a virtual hard drive file...</source>
-        <translation>Hautatu diska gogor birtual agiri bat...</translation>
+        <source>Resume the execution of the virtual machine</source>
+        <translation type="obsolete">Makina birtualaren exekuzioa jarraitu</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="-8"/>
-        <source>&Memory size</source>
-        <translation>&Oroimen neurria</translation>
+        <source>&Pause</source>
+        <translation type="obsolete">&Gelditu</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp" line="-3"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="+5"/>
-        <source>&Do not add a virtual hard drive</source>
-        <translation>&Ez gehitu diska gogor birtual bat</translation>
+        <source>Suspend the execution of the virtual machine</source>
+        <translation type="obsolete">Makina Birtualaren exekuzioa gelditu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="+1"/>
-        <source>&Create a virtual hard drive now</source>
-        <translation>&Sortu diska gogor birtual bat orain</translation>
+        <source>Re&fresh</source>
+        <translation type="obsolete">&Freskatu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="+1"/>
-        <source>&Use an existing virtual hard drive file</source>
-        <translation>E&rabili badagoen diska gogor birtual agiri bat</translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Ongietorri VirtualBox-era!</h3><p>Leiho honen ezkerreko zatian ordenagailu honetako makina birtual guztiak daude. Zerrenda orain hutsik dago oraindik ez duzu makina birtualik sortu eta.<img src=:/welcome.png align=right/></p><p>Makina berri bat sortzeko sakatu <b>Berria</b> botoia leihoaren goialdeko tresna-barran nagusian.</p><p><b>%1</b> tekla sakatu dezakezu laguntza eskura [...]
     </message>
-</context>
-<context>
-    <name>VBoxAboutDlg</name>
     <message>
-        <location filename="../src/VBoxAboutDlg.cpp" line="+104"/>
-        <source>VirtualBox - About</source>
-        <translation>VirtualBox - Honi buruz</translation>
+        <source>&File</source>
+        <comment>Mac OS X version</comment>
+        <translation type="obsolete">&Fitxategia</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>VirtualBox Graphical User Interface</source>
-        <translation>VirtualBox Erabiltzaile Interfaze Grafika</translation>
+        <source>&File</source>
+        <comment>Non Mac OS X version</comment>
+        <translation type="obsolete">&Fitxategia</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Version %1</source>
-        <translation>Bertsioa %1</translation>
+        <source>&Add...</source>
+        <translation type="obsolete">&Gehitu...</translation>
     </message>
 </context>
 <context>
-    <name>VBoxEmptyFileSelector</name>
-    <message>
-        <source>&Choose...</source>
-        <translation type="obsolete">&Hautatu...</translation>
-    </message>
+    <name>VBoxSettingsDialog</name>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="+725"/>
-        <source>Choose...</source>
-        <translation>Hautatu...</translation>
+        <source>Settings</source>
+        <translation type="obsolete">Ezarpenak</translation>
     </message>
 </context>
 <context>
-    <name>VBoxFilePathSelectorWidget</name>
+    <name>VBoxSharedFoldersSettings</name>
     <message>
-        <location line="-442"/>
-        <source><reset to default></source>
-        <translation><berrezarri berezkoetan></translation>
+        <source>Name</source>
+        <translation type="obsolete">Izena</translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
-        <translation type="obsolete">Oraingo berezko helburu balioa aldaketak onartu eta elkarrizketa hau berriro irekitakoan erakutsiko da.</translation>
+        <source>Path</source>
+        <translation type="obsolete">Bidea</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished"></translation>
+        <source>Shared &Folders</source>
+        <translation type="obsolete">Partekatutako &Karpetak</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><not selected></source>
-        <translation><hautatu gabe></translation>
+        <source><qt>Lists all shared folders accessible to this machine.
+Use
+<tt>net use x: \\vboxsvr\share</tt>
+to access a shared folder named <i>share</i> from a DOS-like OS, or
+<tt>mount -t vboxsf share mount_point</tt>
+to access it from a Linux OS. This feature requires Guest Additions.</qt></source>
+        <translation type="obsolete"><qt>Makina honetarako eskuragarri dauden partekatutako karpeta guztiak zerrendatzen ditu.
+Erabili
+<tt>net use x: \\vboxsvr\share</tt>
+<i>share</i> izeneko karpeta bat DOS-antzerako SE batetatik, edo
+<tt>mount -t vboxsf share mount_point</tt>
+Linux SE batetatik atzitzeko. Ezaugarri honek Bezero Gehigarriak behar ditu.</qt></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Please use the <b>Other...</b> item from the drop-down list to select a path.</source>
-        <translation>Mesedez erabili <b>Beste...</b> gai bat hedagarri zerrendatik helburu bat hautatzeko.</translation>
+        <source>Adds a new shared folder definition.</source>
+        <translation type="obsolete">Partekatutako karpeta definizio berria gehitzen du.</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Other...</source>
-        <translation>Beste...</translation>
+        <source>Removes the selected shared folder definition.</source>
+        <translation type="obsolete">Hautatutako partekatutako karpeta definizioa ezabatzen du.</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Reset</source>
-        <translation>Berrezarri</translation>
+        <source> Machine Folders</source>
+        <translation type="obsolete"> Makina Karpetak</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Opens a window to select a different folder.</source>
-        <translation>Leiho bat irekitzen du beste agiritegi bat hautatzeko.</translation>
+        <source> Transient Folders</source>
+        <translation type="obsolete"> Karpeta Mugikorrak</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Opens a window to select a different file.</source>
-        <translation>Leiho bat irekitzen du beste agiri bat hautatzeko.</translation>
+        <source><nobr>Name:&nbsp;&nbsp;%1</nobr><br><nobr>Path:&nbsp;&nbsp;%2</nobr></source>
+        <translation type="obsolete"><nobr>Izena:&nbsp;&nbsp;%1</nobr><br><nobr>Bidea:&nbsp;&nbsp;%2</nobr></translation>
     </message>
     <message>
-        <source>Opens a dialog to select a different folder.</source>
-        <translation type="obsolete">Beste agiritegi bat hautatzeko elkarrizketa bat irekitzen du.</translation>
+        <source>Edits the selected shared folder definition.</source>
+        <translation type="obsolete">Hautatutako karpeta definizioa editatzen du.</translation>
     </message>
     <message>
-        <location line="-6"/>
-        <source>Resets the folder path to the default value.</source>
-        <translation>Agiritegi helburua berezko balioan berrezartzen du.</translation>
+        <source>VBoxSharedFoldersSettings</source>
+        <comment>don't translate</comment>
+        <translation type="obsolete">VBoxPartekatutakoKarpetaEzarpenak</translation>
     </message>
     <message>
-        <source>Opens a dialog to select a different file.</source>
-        <translation type="obsolete">Beste agiri bat hautatzeko elkarrizketa bat irekitzen du.</translation>
+        <source>Ins</source>
+        <translation type="obsolete">Ins</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Resets the file path to the default value.</source>
-        <translation>Agiri helburua berezko balioan berrezartzen du.</translation>
+        <source>Add a new shared folder (Ins)</source>
+        <translation type="obsolete">Partekatauko karpeta bat gehitu (Ins)</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>&Copy</source>
-        <translation>&Kopiatu</translation>
+        <source>Space</source>
+        <translation type="obsolete">Lekua</translation>
     </message>
     <message>
-        <location line="+175"/>
-        <source>Please type the folder path here.</source>
-        <translation>Mesedez idatzi agiritegi helburua hemen.</translation>
+        <source>Edit the selected shared folder (Space)</source>
+        <translation type="obsolete">Hautatutako partekatutako karpeta editatu (Lekua)</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Please type the file path here.</source>
-        <translation>Mesedez idatzi agiri helburua hemen.</translation>
+        <source>Del</source>
+        <translation type="obsolete">Ezab</translation>
     </message>
-</context>
-<context>
-    <name>VBoxGlobal</name>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-329"/>
-        <source>Unknown device %1:%2</source>
-        <comment>USB device details</comment>
-        <translation>Gailu ezezaguna %1:%2</translation>
+        <source>Remove the selected shared folder (Del)</source>
+        <translation type="obsolete">Ezabatu hautatutako partekatutako karpeta (Ezab)</translation>
     </message>
+</context>
+<context>
+    <name>VBoxSnapshotDetailsDlg</name>
     <message>
-        <location line="+25"/>
-        <source><nobr>Vendor ID: %1</nobr><br><nobr>Product ID: %2</nobr><br><nobr>Revision: %3</nobr></source>
-        <comment>USB device tooltip</comment>
-        <translation><nobr>Saltzaile ID-a: %1</nobr><br><nobr>Produktu ID-a: %2</nobr><br><nobr>Berrikuspena: %3</nobr></translation>
+        <source>VBoxSnapshotDetailsDlg</source>
+        <translation type="obsolete">VBoxEgoeraArgazkiXehetasunLeihoa</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source><br><nobr>Serial No. %1</nobr></source>
-        <comment>USB device tooltip</comment>
-        <translation><br><nobr>Serial Zbk. %1</nobr></translation>
+        <source> Snapshot Details </source>
+        <translation type="obsolete"> Egoera-argazki Xehetasunak </translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source><br><nobr>State: %1</nobr></source>
-        <comment>USB device tooltip</comment>
-        <translation><br><nobr>Egoera: %1</nobr></translation>
+        <source>&Name</source>
+        <translation type="obsolete">Ize&na</translation>
     </message>
     <message>
-        <location line="+111"/>
-        <source>Name</source>
-        <comment>details report</comment>
-        <translation>Izena</translation>
+        <source>&Description</source>
+        <translation type="obsolete">A&zalpena</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>OS Type</source>
-        <comment>details report</comment>
-        <translation>SE Mota</translation>
+        <source>&Machine Details</source>
+        <translation type="obsolete">&Makina Xehetasunak</translation>
     </message>
     <message>
-        <location line="+43"/>
-        <source>Enabled</source>
-        <comment>details report (I/O APIC)</comment>
-        <translation>Gaituta</translation>
+        <source>Help</source>
+        <translation type="obsolete">Laguntza</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (I/O APIC)</comment>
-        <translation>Ezgaituta</translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location line="+26"/>
-        <source>Base Memory</source>
-        <comment>details report</comment>
-        <translation>Ohinarri Oroimena</translation>
+        <source>&OK</source>
+        <translation type="obsolete">Ad&os</translation>
     </message>
     <message>
-        <location line="-63"/>
-        <source>General</source>
-        <comment>details report</comment>
-        <translation>Orokorra</translation>
+        <source>Alt+O</source>
+        <translation type="obsolete">ALt+O</translation>
     </message>
     <message>
-        <location line="+99"/>
-        <source>Video Memory</source>
-        <comment>details report</comment>
-        <translation>Bideo Oroimena</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
     <message>
-        <location line="-27"/>
-        <source>Boot Order</source>
-        <comment>details report</comment>
-        <translation>Abiarazpen Hurrenkera</translation>
+        <source>Details of %1 (%2)</source>
+        <translation>%1 (%2)-ren xehetasunak</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>ACPI</source>
-        <comment>details report</comment>
-        <translation>ACPI</translation>
+        <source>Click to enlarge the screenshot.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>IO APIC</source>
-        <comment>details report</comment>
-        <translation type="obsolete">IO APIC</translation>
+        <source>&Name:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-43"/>
-        <source>Enabled</source>
-        <comment>details report (ACPI)</comment>
-        <translation>Gaituta</translation>
+        <source>Taken:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (ACPI)</comment>
-        <translation>Ezgaituta</translation>
+        <source>&Description:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (IO APIC)</comment>
-        <translation type="obsolete">Gaituta</translation>
+        <source>D&etails:</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxSnapshotsWgt</name>
     <message>
-        <source>Disabled</source>
-        <comment>details report (IO APIC)</comment>
-        <translation type="obsolete">Ezgaituta</translation>
+        <source>[snapshot]</source>
+        <translation type="obsolete">[egoera-argazkiak]</translation>
     </message>
     <message>
-        <location line="+209"/>
-        <source>Disabled</source>
-        <comment>details report (audio)</comment>
-        <translation>Ezgaituta</translation>
+        <source>VBoxSnapshotsWgt</source>
+        <translation>VBoxSnapshotsWgt</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Audio</source>
-        <comment>details report</comment>
-        <translation>Audioa</translation>
+        <source>snapshotActionGroup</source>
+        <translation type="obsolete">egoera-argazkiEkintzaTaldea</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="+144"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+40"/>
-        <source>Adapter %1</source>
-        <comment>details report (network)</comment>
-        <translation>Egokitzailea %1</translation>
+        <source>Discard Snapshot</source>
+        <translation type="obsolete">Baztertu Egoera-argazkia</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+9"/>
-        <source>Disabled</source>
-        <comment>details report (network)</comment>
-        <translation>Ezgaituta</translation>
+        <source>&Discard Snapshot</source>
+        <translation type="obsolete">&Baztertu Egoera-argazkia</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Network</source>
-        <comment>details report</comment>
-        <translation>Sarea</translation>
+        <source>Ctrl+Shift+D</source>
+        <translation type="obsolete">Ktrl+Shift+D</translation>
     </message>
     <message>
-        <location line="+109"/>
-        <source>Device Filters</source>
-        <comment>details report (USB)</comment>
-        <translation>Gailu Iragazkiak</translation>
+        <source>curStateActionGroup</source>
+        <translation type="obsolete">unekoEgoeraEkintzaTaldea</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>%1 (%2 active)</source>
-        <comment>details report (USB)</comment>
-        <translation>%1 (%2 gaituta)</translation>
+        <source>Take Snapshot</source>
+        <translation type="obsolete">Egoera-argazki bat egin</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Disabled</source>
-        <comment>details report (USB)</comment>
-        <translation>Ezgaituta</translation>
+        <source>Take &Snapshot</source>
+        <translation type="unfinished">Egoera-arga&zki bat egin</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="+129"/>
-        <source>Powered Off</source>
-        <comment>MachineState</comment>
-        <translation>Itzalita</translation>
+        <source>Discard Current Snapshot and State</source>
+        <translation type="obsolete">Baztertu Uneko Egoera-argazkia eta Egoera</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Saved</source>
-        <comment>MachineState</comment>
-        <translation>Gordeta</translation>
+        <source>D&iscard Current Snapshot and State</source>
+        <translation type="obsolete">Ba&ztertu Uneko Egoera-argazkia eta Egoera</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Aborted</source>
-        <comment>MachineState</comment>
-        <translation>Utzita</translation>
+        <source>Show Details</source>
+        <translation type="obsolete">Ikusi Xehetasunak</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Running</source>
-        <comment>MachineState</comment>
-        <translation>Ekinean</translation>
+        <source>S&how Details</source>
+        <translation type="unfinished">Ikusi Xe&hetasunak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Paused</source>
-        <comment>MachineState</comment>
-        <translation>Pausatuta</translation>
+        <source>Space</source>
+        <translation type="obsolete">Lekua</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Starting</source>
-        <comment>MachineState</comment>
-        <translation>Abiatzen</translation>
+        <source>Current State (changed)</source>
+        <comment>Current State (Modified)</comment>
+        <translation>Uneko Egoera (aldatua)</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Stopping</source>
-        <comment>MachineState</comment>
-        <translation>Gelditzen</translation>
+        <source>Current State</source>
+        <comment>Current State (Unmodified)</comment>
+        <translation>Uneko Egoera</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Saving</source>
-        <comment>MachineState</comment>
-        <translation>Gordetzen</translation>
+        <source>The current state differs from the state stored in the current snapshot</source>
+        <translation>Uneko egoera egoera-argazkian gordetakoren ezberdina da</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Restoring</source>
-        <comment>MachineState</comment>
-        <translation>Leheneratzen</translation>
+        <source>The current state is identical to the state stored in the current snapshot</source>
+        <translation>Uneko egoera egoera-argazkian gordetakoren berdina da</translation>
     </message>
     <message>
-        <location line="+25"/>
-        <source>Spawning</source>
-        <comment>SessionState</comment>
-        <translation type="unfinished"></translation>
+        <source> (current, </source>
+        <comment>Snapshot details</comment>
+        <translation> (uneko, </translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source>None</source>
-        <comment>DeviceType</comment>
-        <translation>Ezer ez</translation>
+        <source>online)</source>
+        <comment>Snapshot details</comment>
+        <translation>linean)</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Floppy</source>
-        <comment>DeviceType</comment>
-        <translation>Disketea</translation>
+        <source>offline)</source>
+        <comment>Snapshot details</comment>
+        <translation>lineaz kanpo)</translation>
     </message>
     <message>
-        <source>CD/DVD-ROM</source>
-        <comment>DeviceType</comment>
-        <translation type="obsolete">CD/DVD-ROM</translation>
+        <source>Taken at %1</source>
+        <comment>Snapshot (time)</comment>
+        <translation>%1 hartzen</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Hard Disk</source>
-        <comment>DeviceType</comment>
-        <translation>Diska Gogorra</translation>
+        <source>Taken on %1</source>
+        <comment>Snapshot (date + time)</comment>
+        <translation>%1-ean hartua</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Network</source>
-        <comment>DeviceType</comment>
-        <translation>Sarea</translation>
+        <source>%1 since %2</source>
+        <comment>Current State (time or date + time)</comment>
+        <translation>%1 %2-tik</translation>
     </message>
     <message>
-        <location line="+198"/>
-        <location line="+164"/>
-        <source>Null Audio Driver</source>
-        <comment>AudioDriverType</comment>
-        <translation>Null Audio Gidagailua</translation>
+        <source>Snapshot %1</source>
+        <translation>%1 egoera-argazkia</translation>
     </message>
     <message>
-        <location line="-163"/>
-        <location line="+164"/>
-        <source>Windows Multimedia</source>
-        <comment>AudioDriverType</comment>
-        <translation>Windows Multimedia</translation>
+        <source>Discard the selected snapshot of the virtual machine</source>
+        <translation type="obsolete">Baztertu hautatutako egoera-argazkia makina birtualetik</translation>
     </message>
     <message>
-        <location line="-163"/>
-        <location line="+164"/>
-        <source>OSS Audio Driver</source>
-        <comment>AudioDriverType</comment>
-        <translation>OSS Audio Gidagailua</translation>
+        <source>Ctrl+Shift+S</source>
+        <translation type="obsolete">Ktrl+Shift+S</translation>
     </message>
     <message>
-        <location line="-163"/>
-        <location line="+164"/>
-        <source>ALSA Audio Driver</source>
-        <comment>AudioDriverType</comment>
-        <translation>ALSA Audio Gidagailua</translation>
+        <source>Take a snapshot of the current virtual machine state</source>
+        <translation type="unfinished">Uneko makina birtual egoeraren egoera-argazki bat egin</translation>
     </message>
     <message>
-        <location line="-163"/>
-        <location line="+164"/>
-        <source>Windows DirectSound</source>
-        <comment>AudioDriverType</comment>
-        <translation>Windows DirectSound</translation>
+        <source>Revert to Current Snapshot</source>
+        <translation type="obsolete">Uneko Egoera-argazkira Itzuli</translation>
     </message>
     <message>
-        <location line="-163"/>
-        <location line="+164"/>
-        <source>CoreAudio</source>
-        <comment>AudioDriverType</comment>
-        <translation>CoreAudio</translation>
+        <source>&Revert to Current Snapshot</source>
+        <translation type="obsolete">Uneko Egoe&ra-argazkira Itzuli</translation>
     </message>
     <message>
-        <location line="-263"/>
-        <source>Not attached</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Erantsi gabe</translation>
+        <source>Ctrl+Shift+R</source>
+        <translation type="obsolete">Ktrl+Shift+R</translation>
     </message>
     <message>
-        <location line="-106"/>
-        <source>CD/DVD</source>
-        <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <source>Restore the virtual machine state from the state stored in the current snapshot</source>
+        <translation type="obsolete">Makina birtuala uneko egoera-argazkian gordetako egoerara itzuli</translation>
     </message>
     <message>
-        <location line="+107"/>
-        <source>NAT</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>NAT</translation>
+        <source>Ctrl+Shift+B</source>
+        <translation type="obsolete">Ktrl+Shift+B</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Internal Network</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Barneko Sarea</translation>
+        <source>Discard the current snapshot and revert the machine to the state it had before the snapshot was taken</source>
+        <translation type="obsolete">Uneko egoera-argazkia baztertu eta makina egoera-argazkia egin baino lehen zuen egoerara itzuli</translation>
     </message>
     <message>
-        <location line="+63"/>
-        <source>Not supported</source>
-        <comment>USBDeviceState</comment>
-        <translation>Sostengatu gabea</translation>
+        <source>Show the details of the selected snapshot</source>
+        <translation type="unfinished">Hautatutako egoera-argazkiaren xehetasunak ikusi</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Unavailable</source>
-        <comment>USBDeviceState</comment>
-        <translation>Eskuraezina</translation>
+        <source> (%1)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Busy</source>
-        <comment>USBDeviceState</comment>
-        <translation>Lanpetuta</translation>
+        <source>&Restore Snapshot</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Available</source>
-        <comment>USBDeviceState</comment>
-        <translation>Eskuragarri</translation>
+        <source>&Delete Snapshot</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Held</source>
-        <comment>USBDeviceState</comment>
+        <source>Restore the selected snapshot of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Captured</source>
-        <comment>USBDeviceState</comment>
-        <translation>Hartuta</translation>
+        <source>Delete the selected snapshot of the virtual machine</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="-162"/>
-        <source>Disabled</source>
-        <comment>ClipboardType</comment>
-        <translation>Ezgaituta</translation>
+        <source> (%1 ago)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Host To Guest</source>
-        <comment>ClipboardType</comment>
-        <translation>Hostalaritik Gonbidatura</translation>
+        <source>&Clone...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Guest To Host</source>
-        <comment>ClipboardType</comment>
-        <translation>Gonbidatutik Hostalarira</translation>
+        <source>Clone the selected virtual machine</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>VBoxSwitchMenu</name>
     <message>
-        <location line="+1"/>
-        <source>Bidirectional</source>
-        <comment>ClipboardType</comment>
-        <translation>Binorabidekoa</translation>
+        <source>Disable</source>
+        <translation type="obsolete">Ezgaitu</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-87"/>
-        <source>Port %1</source>
-        <comment>details report (serial ports)</comment>
-        <translation>Ataka %1</translation>
+        <source>Enable</source>
+        <translation type="obsolete">Gaitu</translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Disabled</source>
-        <comment>details report (serial ports)</comment>
-        <translation>Ezgaituta</translation>
+        <source>%1 %2</source>
+        <translation type="obsolete">%1 %2</translation>
     </message>
+</context>
+<context>
+    <name>VBoxTakeSnapshotDlg</name>
     <message>
-        <location line="+8"/>
-        <source>Serial Ports</source>
-        <comment>details report</comment>
-        <translation>Serieko Atakak</translation>
+        <source>Take Snapshot of Virtual Machine</source>
+        <translation>Makina Birtualaren Egoera-argazki bat egin</translation>
     </message>
     <message>
-        <location line="+76"/>
-        <source>USB</source>
-        <comment>details report</comment>
-        <translation>USB</translation>
+        <source>Snapshot &Name</source>
+        <translation>Egoera-argazki Ize&na</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Shared Folders</source>
-        <comment>details report (shared folders)</comment>
-        <translation>Elkarbanatutako Agiritegiak</translation>
+        <source>Snapshot &Description</source>
+        <translation>Egoera-argazki A&zalpena</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>None</source>
-        <comment>details report (shared folders)</comment>
-        <translation>Ezer ez</translation>
+        <source>Help</source>
+        <translation type="obsolete">Laguntza</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Shared Folders</source>
-        <comment>details report</comment>
-        <translation>Elkarbanatutako Agiritegiak</translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="+140"/>
-        <location line="+178"/>
-        <source>Disconnected</source>
-        <comment>PortMode</comment>
-        <translation>Etenda</translation>
+        <source>&OK</source>
+        <translation type="obsolete">Ad&os</translation>
     </message>
     <message>
-        <location line="-177"/>
-        <location line="+178"/>
-        <source>Host Pipe</source>
-        <comment>PortMode</comment>
-        <translation>Hostalari Hodia</translation>
+        <source>Alt+O</source>
+        <translation type="obsolete">Alt+O</translation>
     </message>
     <message>
-        <location line="-177"/>
-        <location line="+178"/>
-        <source>Host Device</source>
-        <comment>PortMode</comment>
-        <translation>Hostalari Gailua</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
+    </message>
+    <message numerus="yes">
+        <source>Warning: You are taking a snapshot of a running machine which has %n immutable image(s) attached to it. As long as you are working from this snapshot the immutable image(s) will not be reset to avoid loss of data.</source>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
+</context>
+<context>
+    <name>VBoxUSBFilterSettings</name>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+373"/>
-        <source>User-defined</source>
-        <comment>serial port</comment>
-        <translation>Erabiltzaileak-zehaztuta</translation>
+        <source>VBoxUSBFilterSettings</source>
+        <comment>don't translate</comment>
+        <translation type="obsolete">VBoxUSBIragazkiEzarpenak</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="-169"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-741"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="-90"/>
-        <source>VT-x/AMD-V</source>
-        <comment>details report</comment>
-        <translation>VT-x/AMD-V</translation>
+        <source>&Name</source>
+        <translation type="obsolete">Ize&na</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-5"/>
-        <source>PAE/NX</source>
-        <comment>details report</comment>
-        <translation>PAE/NX</translation>
+        <source>Holds the filter name.</source>
+        <translation type="obsolete">Iragazki izena bistarazten du.</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="-42"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-27"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="-22"/>
-        <source>Enabled</source>
-        <comment>details report (VT-x/AMD-V)</comment>
-        <translation>Gaituta</translation>
+        <source>&Manufacturer</source>
+        <translation type="obsolete">&Egilea</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+1"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (VT-x/AMD-V)</comment>
-        <translation>Ezgaituta</translation>
+        <source>Pro&duct</source>
+        <translation type="obsolete">Pro&duktua</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="+9"/>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Gaituta</translation>
+        <source>&Serial No.</source>
+        <translation type="obsolete">&Serie Zenbakia.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Ezgaituta</translation>
+        <source>R&emote</source>
+        <translation type="obsolete">Urrun&ekoa</translation>
     </message>
     <message>
-        <location line="+37"/>
-        <source>Unrestricted Execution</source>
-        <comment>details report</comment>
-        <translation>Mugagabeko Exekuzioa</translation>
+        <source>&Action</source>
+        <translation type="obsolete">&Ekintza</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-9"/>
-        <source>Enabled</source>
-        <comment>details report (PAE/NX)</comment>
-        <translation>Gaituta</translation>
+        <source>&Vendor ID</source>
+        <translation type="obsolete">&Saltzaile ID-a</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (PAE/NX)</comment>
-        <translation>Ezgaituta</translation>
+        <source>&Product ID</source>
+        <translation type="obsolete">&Produktu ID-a</translation>
     </message>
     <message>
-        <location line="+33"/>
-        <source>I/O APIC</source>
-        <comment>details report</comment>
-        <translation>S/I APIC</translation>
+        <source>&Revision</source>
+        <translation type="obsolete">&Bertsioa</translation>
     </message>
     <message>
-        <location line="+159"/>
-        <source>Host Driver</source>
-        <comment>details report (audio)</comment>
-        <translation>Hostalari Gidagailua</translation>
+        <source>Por&t</source>
+        <translation type="obsolete">&Ataka</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Controller</source>
-        <comment>details report (audio)</comment>
-        <translation>Kontrolatzailea</translation>
+        <source>Any</source>
+        <comment>remote</comment>
+        <translation type="obsolete">Edozein</translation>
     </message>
     <message>
-        <location line="+44"/>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>NAT sarea, '%1'</translation>
+        <source>Yes</source>
+        <comment>remote</comment>
+        <translation type="obsolete">Bai</translation>
     </message>
     <message>
-        <location line="+89"/>
-        <source>Port %1</source>
-        <comment>details report (parallel ports)</comment>
-        <translation>Ataka %1</translation>
+        <source>No</source>
+        <comment>remote</comment>
+        <translation type="obsolete">Ez</translation>
+    </message>
+    <message>
+        <source><qt>Defines the manufacturer filter as an
+<i>exact match</i> string. An empty string will match any
+value.</qt></source>
+        <translation type="obsolete"><qt>Manufakturadore iragazkia ezarri
+<i>parekatze zehatz</i> kate bat bezala- Kate huts batek edozein
+baliorekin parekatzea beteko du</qt></translation>
+    </message>
+    <message>
+        <source><qt>Defines the product name filter as an
+<i>exact match</i> string. An empty string will match any
+value.</qt></source>
+        <translation type="obsolete"><qt>Produktu izen iragazkia ezarri
+<i>parekatze zehatz</i> kate bat bezala- Kate huts batek edozein
+baliorekin parekatzea beteko du</qt></translation>
+    </message>
+    <message>
+        <source><qt>Defines the serial number filter as an
+<i>exact match</i> string. An empty string will match any
+value.</qt></source>
+        <translation type="obsolete"><qt>Serie zenbaki iragazkia ezarri
+<i>parekatze zehatz</i> kate bat bezala- Kate huts batek edozein
+baliorekin parekatzea beteko du</qt></translation>
+    </message>
+    <message>
+        <source><qt>Defines whether this filter applies
+to USB devices attached locally to the host computer (<i>No</i>),
+to a VRDP client's computer (<i>Yes</i>),
+or both (<i>Any</i>).</qt></source>
+        <translation type="obsolete"><qt>Iragazki hau lokalki erantsiritako USB
+gailuetan  nola ezarriko den ezartzen du:
+Ostalari ordenagailuan (<i>Ez</i>),
+VRFP bezeroaren ordenagailuan (<i>Bai</i>),
+edo bietan (<i>Edozein</i>).</qt></translation>
+    </message>
+    <message>
+        <source><qt>Defines an action performed by the host
+computer when a matching device is attached: give it up to the host OS
+(<i>Ignore</i>) or grab it for later usage by virtual machines
+(<i>Hold</i>).</qt></source>
+        <translation type="obsolete"><qt>Iragazkia betetzen duen gailu bat eransterakoan ostalari ordenagailuak egingo duen ekintza ezartzen du(<i>Baztertu</i>) edo eskuratu gero makina birtualek erabiltzeko
+(<i>Eskuratu</i>).</qt></translation>
+    </message>
+    <message>
+        <source><qt>Defines the vendor ID filter. The
+<i>exact match</i> string format is <tt>XXXX</tt> where
+<tt>X</tt> is a hexadecimal digit. An empty string will match any
+value.</qt></source>
+        <translation type="obsolete"><qt>Saltzaile ID iragazkia ezartzen du.
+<i>parekatze zehatz</i> kate formatua <tt>XXXX</tt> da, non
+<tt>X</tt> digito hamaseitar bat den. Kate hutsak edozein
+balio bilatuko du.</qt></translation>
+    </message>
+    <message>
+        <source><qt>Defines the product ID filter. The
+<i>exact match</i> string format is <tt>XXXX</tt> where
+<tt>X</tt> is a hexadecimal digit. An empty string will match any
+value.</qt></source>
+        <translation type="obsolete"><qt>Produktu ID iragazkia ezartzen du.
+<i>parekatze zehatz</i> kate formatua <tt>XXXX</tt> da, non
+<tt>X</tt> digito hamaseitar bat den. Kate hutsak edozein
+balio bilatuko du.</qt></translation>
+    </message>
+    <message>
+        <source><qt>Defines the host USB port filter as an
+<i>exact match</i> string. An empty string will match any
+value.</qt></source>
+        <translation type="obsolete"><qt>Ostalari USB iragazkia ezartzen du.
+<i>parekatze zehatz</i> kate bat bezala.
+Kate hutsak edozein balio bilatuko du.</qt></translation>
     </message>
+</context>
+<context>
+    <name>VBoxUSBMenu</name>
     <message>
-        <location line="+9"/>
-        <source>Disabled</source>
-        <comment>details report (parallel ports)</comment>
-        <translation>Ezgaituta</translation>
+        <source><no devices available></source>
+        <comment>USB devices</comment>
+        <translation><ez dago gailu erabilgarririk></translation>
     </message>
     <message>
-        <location line="+9"/>
-        <source>Parallel Ports</source>
-        <comment>details report</comment>
-        <translation>Ataka Kidetuak</translation>
+        <source>No supported devices connected to the host PC</source>
+        <comment>USB device tooltip</comment>
+        <translation>Ez dago onartutako gailurik konektaturik ostalari PC-ra</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMDescriptionPage</name>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="-335"/>
-        <source>USB</source>
-        <comment>DeviceType</comment>
-        <translation>USB</translation>
+        <source>No description. Press the Edit button below to add it.</source>
+        <translation type="obsolete">Azalpenik ez. Editatu botoia sakatu berau gehitzeko.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Shared Folder</source>
-        <comment>DeviceType</comment>
-        <translation>Elkarbanatutako Agiritegiak</translation>
+        <source>Edit</source>
+        <translation type="obsolete">Editatu</translation>
     </message>
     <message>
-        <location line="+241"/>
-        <source>IDE</source>
-        <comment>StorageBus</comment>
-        <translation>IDE</translation>
+        <source>Edit (Ctrl+E)</source>
+        <translation type="obsolete">Editatu (Ktrl+E)</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>SATA</source>
-        <comment>StorageBus</comment>
-        <translation>SATA</translation>
+        <source>Ctrl+E</source>
+        <translation type="obsolete">Ktrl+E</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMDetailsView</name>
     <message>
-        <location line="-38"/>
-        <location line="+164"/>
-        <source>Solaris Audio</source>
-        <comment>AudioDriverType</comment>
-        <translation>Solaris Audioa</translation>
+        <source>The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:</source>
+        <translation type="obsolete">Hautaturiko makina birtuala <i>eskuraezina</i> dago. Mesedez arakatu beheko errore mezua eta <b>Freskatu</b> sakatu eskuragarritasun proba errepikatu nahi baduzu:</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMListBox</name>
     <message>
-        <location line="-165"/>
-        <location line="+164"/>
-        <source>PulseAudio</source>
-        <comment>AudioDriverType</comment>
-        <translation>PulseAudio</translation>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation type="obsolete"><nobr>%1<br></nobr><nobr>%2 %3-tik</nobr><br><nobr>%4 saioa</nobr></translation>
     </message>
     <message>
-        <location line="-152"/>
-        <location line="+165"/>
-        <source>ICH AC97</source>
-        <comment>AudioControllerType</comment>
-        <translation>ICH AC97</translation>
+        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
+        <comment>Inaccessible VM tooltip (name, last state change)</comment>
+        <translation type="obsolete"><nobr><b>%1</b><br></nobr><nobr>Eskuraezina %2 -tik</nobr></translation>
     </message>
     <message>
-        <location line="-164"/>
-        <location line="+165"/>
-        <source>SoundBlaster 16</source>
-        <comment>AudioControllerType</comment>
-        <translation>SoundBlaster 16</translation>
+        <source>Inaccessible</source>
+        <translation type="obsolete">Eskuraezina</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMLogViewer</name>
     <message>
-        <location line="-262"/>
-        <source>PCnet-PCI II (Am79C970A)</source>
-        <comment>NetworkAdapterType</comment>
-        <translation>PCnet-PCI II (Am79C970A)</translation>
+        <source>Log Viewer</source>
+        <translation type="obsolete">Erregistro ikustatzailea</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>PCnet-FAST III (Am79C973)</source>
-        <comment>NetworkAdapterType</comment>
-        <translation>PCnet-FAST III (Am79C973)</translation>
+        <source>&Save</source>
+        <translation type="obsolete">&Gorde</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Intel PRO/1000 MT Desktop (82540EM)</source>
-        <comment>NetworkAdapterType</comment>
-        <translation>Intel PRO/1000 MT Mahaigain (82540EM)</translation>
+        <source>Alt+S</source>
+        <translation type="obsolete">Alt+G</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Intel PRO/1000 T Server (82543GC)</source>
-        <comment>NetworkAdapterType</comment>
-        <translation>Intel PRO/1000 T Zerbitzaria (82543GC)</translation>
+        <source>&Refresh</source>
+        <translation type="obsolete">F&reskatu</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-492"/>
-        <source><nobr>Vendor ID: %1</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Saltzaile ID-a: %1</nobr></translation>
+        <source>Alt+R</source>
+        <translation type="obsolete">ALt+R</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr>Product ID: %2</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Produktu ID-a: %2</nobr></translation>
+        <source>%1 - VirtualBox Log Viewer</source>
+        <translation type="obsolete">%1 - VirtualBox Erregistro ikustatzailea</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr>Revision: %3</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Berrikuspena: %3</nobr></translation>
+        <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
+        <translation type="obsolete"><p>Ez da erregistro fitxategirik aurkitu. Sakatu <b>Freskatu</b> botoia erregistro karpeta berriz arakatzeko <nobr><b>%1</b></nobr>.</p></translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr>Product: %4</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Produktua: %4</nobr></translation>
+        <source>Save VirtualBox Log As</source>
+        <translation type="obsolete">VirtualBox Erregistroa Gorde Honela</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr>Manufacturer: %5</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Ekoizlea: %5</nobr></translation>
+        <source>Help</source>
+        <translation type="obsolete">Laguntza</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr>Serial No.: %1</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Serial Zbk.: %1</nobr></translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source><nobr>Port: %1</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Ataka: %1</nobr></translation>
+        <source>&Find</source>
+        <translation type="obsolete">&Bilatu</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source><nobr>State: %1</nobr></source>
-        <comment>USB filter tooltip</comment>
-        <translation><nobr>Egoera: %1</nobr></translation>
+        <source>Alt+F</source>
+        <translation type="obsolete">ALt+B</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="+537"/>
-        <source>Checking...</source>
-        <comment>medium</comment>
-        <translation>Egiaztatzen...</translation>
+        <source>Close</source>
+        <translation type="obsolete">Itxi</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMNetworkSettings</name>
     <message>
-        <location line="+4"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="+13"/>
-        <source>Inaccessible</source>
-        <comment>medium</comment>
-        <translation>Eskuraezina</translation>
+        <source>VBoxVMNetworkSettings</source>
+        <translation type="obsolete">VBOXMBSareEzarpenak</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+185"/>
-        <source>3D Acceleration</source>
-        <comment>details report</comment>
-        <translation>3D Bizkorpena</translation>
+        <source>&Enable Network Adapter</source>
+        <translation type="obsolete">&Gaitu Sare Moldagailua</translation>
     </message>
     <message>
-        <location line="-4"/>
-        <source>Enabled</source>
-        <comment>details report (3D Acceleration)</comment>
-        <translation>Gaituta</translation>
+        <source>&Attached to</source>
+        <translation type="obsolete">&Hemen erantsia</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (3D Acceleration)</comment>
-        <translation>Ezgaituta</translation>
+        <source>&MAC Address</source>
+        <translation type="obsolete">&MAC Helbidea</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="-157"/>
-        <source>Setting Up</source>
-        <comment>MachineState</comment>
-        <translation>Ezarrita</translation>
+        <source>&Generate</source>
+        <translation type="obsolete">&Sortu</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+705"/>
-        <source>Differencing</source>
-        <comment>DiskType</comment>
-        <translation>Bereizlea</translation>
+        <source>Alt+G</source>
+        <translation type="obsolete">ALT+S</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="-1"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-738"/>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation>Nested Orrialdeztapena</translation>
+        <source>Generates a new random MAC address.</source>
+        <translation type="obsolete">Ausazko MAC berri bat sortzen du.</translation>
     </message>
     <message>
-        <location line="-40"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-28"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="-6"/>
-        <source>Enabled</source>
-        <comment>details report (Nested Paging)</comment>
-        <translation>Gaituta</translation>
+        <source>Ca&ble Connected</source>
+        <translation type="obsolete">Ka&blea Konektaturik</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+1"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (Nested Paging)</comment>
-        <translation>Ezgaituta</translation>
+        <source>Alt+B</source>
+        <translation type="obsolete">Alt+B</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+217"/>
-        <source>Internal network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>Barneko Sarea, '%1'</translation>
+        <source>Host Interface Settings</source>
+        <translation type="obsolete">Ostalari Interfaze Ezarpenak</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="+278"/>
-        <source>SCSI</source>
-        <comment>StorageBus</comment>
-        <translation>SCSI</translation>
+        <source>&Interface Name</source>
+        <translation type="obsolete">&Interfaze Izena</translation>
     </message>
     <message>
-        <location line="+16"/>
-        <location line="+152"/>
-        <source>PIIX3</source>
-        <comment>StorageControllerType</comment>
-        <translation>PIIX3</translation>
+        <source>&File Descriptor</source>
+        <translation type="obsolete">&Fitxategi Deskriptorea</translation>
     </message>
     <message>
-        <location line="-151"/>
-        <location line="+152"/>
-        <source>PIIX4</source>
-        <comment>StorageControllerType</comment>
-        <translation>PIIX4</translation>
+        <source>&Setup Application</source>
+        <translation type="obsolete">Aplikazio &Konfigurazioa</translation>
     </message>
     <message>
-        <location line="-151"/>
-        <location line="+152"/>
-        <source>ICH6</source>
-        <comment>StorageControllerType</comment>
-        <translation>ICH6</translation>
+        <source>Select</source>
+        <translation type="obsolete">Hautatu</translation>
     </message>
     <message>
-        <location line="-155"/>
-        <location line="+152"/>
-        <source>AHCI</source>
-        <comment>StorageControllerType</comment>
-        <translation>AHCI</translation>
+        <source>&Terminate Application</source>
+        <translation type="obsolete">Aplikazioa &Amaitu</translation>
     </message>
     <message>
-        <location line="-154"/>
-        <location line="+152"/>
-        <source>Lsilogic</source>
-        <comment>StorageControllerType</comment>
-        <translation>Lsilogic</translation>
+        <source>Select TAP setup application</source>
+        <translation type="obsolete">Hautatu TAP konfigurazio aplikazioa</translation>
     </message>
     <message>
-        <location line="-151"/>
-        <location line="+152"/>
-        <source>BusLogic</source>
-        <comment>StorageControllerType</comment>
-        <translation>BusLogic</translation>
+        <source>Select TAP terminate application</source>
+        <translation type="obsolete">Hautatu TAP amaiera aplikazioa</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-3"/>
-        <source>Bridged adapter, %1</source>
-        <comment>details report (network)</comment>
-        <translation>Zubi egokitzailea, %1</translation>
+        <source>When checked, plugs this virtual network adapter into the virtual machine.</source>
+        <translation type="obsolete">Aukeratua dagoenean, sare moldagailu birtual hau eransten du makina birtualean.</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Host-only adapter, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>Hostalaria-bakarrik Egokitzailea, '%1'</translation>
+        <source>Controls how this virtual adapter is attached to the real network of the Host OS.</source>
+        <translation type="obsolete">Ostalari SE-ren sare errealera konektatzeko moldagailu birtualak modua kontrolatzen du.</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="-286"/>
-        <source>Intel PRO/1000 MT Server (82545EM)</source>
-        <comment>NetworkAdapterType</comment>
-        <translation>Intel PRO/1000 MT Zerbitzaria (82545EM)</translation>
+        <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}.</source>
+        <translation type="obsolete">Moldagai honen MAC helbidea bistaratzen du. Zehazki 12 karaktere ditu {0-9,A-F} tartetik.</translation>
     </message>
     <message>
-        <location line="-19"/>
-        <source>Bridged Adapter</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Zubi Egokitzailea</translation>
+        <source>Indicates whether the virtual network cable is plugged in on machine startup or not.</source>
+        <translation type="obsolete">Abiaraztean sare kable birtuala konektaturik dagoen erakusten du.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Host-only Adapter</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Hostalaria-bakarrik Egokitzailea</translation>
+        <source>Holds the name of the host interface selected for this adapter.</source>
+        <translation type="obsolete">Moldagai honetako hautaturiko interfazearen ostalari izena bistaratzen du.</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-211"/>
-        <location line="+36"/>
-        <source><nobr>%1 MB</nobr></source>
-        <comment>details report</comment>
-        <translation><nobr>%1 MB</nobr></translation>
+        <source>Holds the TAP interface name.</source>
+        <translation type="obsolete">TAP interfaze izena bistaratzen du.</translation>
     </message>
     <message>
-        <location line="-34"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="+24"/>
-        <source>Processor(s)</source>
-        <comment>details report</comment>
-        <translation>Prozesagailua(k)</translation>
+        <source>Holds the command executed to set up the TAP interface.</source>
+        <translation type="obsolete">TAP interfazea konfiguratzeko exekutatutako komandoa bistaratzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source><nobr>%1</nobr></source>
-        <comment>details report</comment>
-        <translation><nobr>%1</nobr></translation>
+        <source>Selects the setup application.</source>
+        <translation type="obsolete">Konfigurazio aplikazioa Hautatzen du.</translation>
     </message>
     <message>
-        <location line="+21"/>
-        <source>System</source>
-        <comment>details report</comment>
-        <translation>Sistema</translation>
+        <source>Holds the command executed to terminate the TAP interface.</source>
+        <translation type="obsolete">TAP interfazea amaitzeko exekutatutako komandoa bistaratzen du.</translation>
     </message>
     <message>
-        <location line="+62"/>
-        <source>Display</source>
-        <comment>details report</comment>
-        <translation>Erakutsi</translation>
+        <source>Selects the terminate application.</source>
+        <translation type="obsolete">Hautatu amaiera aplikazioa.</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMParallelPortSettings</name>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="+51"/>
-        <location line="+178"/>
-        <source>Raw File</source>
-        <comment>PortMode</comment>
-        <translation>Raw Agiria</translation>
+        <source>Port &Number</source>
+        <translation type="obsolete">Ataka Ze&nbakia</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-27"/>
-        <source>Enabled</source>
-        <comment>details report (2D Video Acceleration)</comment>
-        <translation>Gaituta</translation>
+        <source>&IRQ</source>
+        <translation type="obsolete">&IRQ</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (2D Video Acceleration)</comment>
-        <translation>Ezgaituta</translation>
+        <source>I/O Po&rt</source>
+        <translation type="obsolete">I/O A&taka</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>2D Video Acceleration</source>
-        <comment>details report</comment>
-        <translation>2D Bideo Bizkorpena</translation>
+        <source>Port &Path</source>
+        <translation type="obsolete">Ataka &Bidea</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMSerialPortSettings</name>
     <message>
-        <location line="+87"/>
-        <source>Not Attached</source>
-        <comment>details report (Storage)</comment>
-        <translation>Erantsi gabe</translation>
+        <source>VBoxVMSerialPortSettings</source>
+        <translation type="obsolete">VBoxVMSerieAtakaEzarpenak</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Storage</source>
-        <comment>details report</comment>
-        <translation>Biltegia</translation>
+        <source>&Enable Serial Port</source>
+        <translation type="obsolete">&Gaitu Serie Ataka</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="-387"/>
-        <source>Teleported</source>
-        <comment>MachineState</comment>
-        <translation>Teleramana</translation>
+        <source>When checked, enables the given serial port of the virtual machine.</source>
+        <translation type="obsolete">Hautaturik dagoenean, makina birtualaren emandako serie ataka gaitu.</translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Guru Meditation</source>
-        <comment>MachineState</comment>
-        <translation>Guru Meditation</translation>
+        <source>Port &Number</source>
+        <translation type="obsolete">Ataka Ze&nbakia</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location line="+7"/>
-        <source>Teleporting</source>
-        <comment>MachineState</comment>
-        <translation type="unfinished"></translation>
+        <source>Selects the serial port number. You can choose one of the standard serial ports or select <b>User-defined</b> and specify port parameters manually.</source>
+        <translation type="obsolete">Serie ataka zenbakia bistarazi. Serie ataka estandarretako bat hautatu edo <b>Erabiltzaileak-definituriko</b> bat eta ataka parametroak eskuz ezarri.</translation>
     </message>
     <message>
-        <location line="-6"/>
-        <source>Taking Live Snapshot</source>
-        <comment>MachineState</comment>
-        <translation type="unfinished"></translation>
+        <source>&IRQ</source>
+        <translation type="obsolete">&IRQ</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Teleporting Paused VM</source>
-        <comment>MachineState</comment>
-        <translation type="unfinished"></translation>
+        <source>Holds the IRQ number of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> is enabled for this virtual machine.</source>
+        <translation type="obsolete">Serie ataka honen IRQ zenbakia bistarazi. Balio erabilgarriak zenbaki osoak <tt>0</tt> eta <tt>255</tt> artean. <tt>15</tt> baina balioa handiagoak erabiltzeko <b>I/O APIC</b> gaiturik egon behar da makina birtual honetan.</translation>
     </message>
     <message>
-        <location line="+5"/>
-        <source>Restoring Snapshot</source>
-        <comment>MachineState</comment>
-        <translation type="unfinished">Berehalakoa Leheneratzen</translation>
+        <source>I/O Po&rt</source>
+        <translation type="obsolete">I/O A&taka</translation>
     </message>
     <message>
-        <location line="-2"/>
-        <location line="+1"/>
-        <location line="+2"/>
-        <source>Deleting Snapshot</source>
-        <comment>MachineState</comment>
-        <translation>Berehalakoa Ezabatzen</translation>
+        <source>Holds the base I/O port address of this serial port. This should be a whole number between <tt>0</tt> and <tt>0xFFFF</tt>.</source>
+        <translation type="obsolete">Serie ataka honen oinarri S/I helbidea bistaratzen du. Balio erabilgarria zenbaki osoak <tt>0</tt> eta <tt>0xFFFF</tt> tartean.</translation>
     </message>
     <message>
-        <location line="+280"/>
-        <source>Floppy</source>
-        <comment>StorageBus</comment>
-        <translation>Disketea</translation>
+        <source>Port &Mode</source>
+        <translation type="obsolete">Ataka &Modua</translation>
     </message>
     <message>
-        <location line="-119"/>
-        <source>Paravirtualized Network (virtio-net)</source>
-        <comment>NetworkAdapterType</comment>
-        <translation>Parabirtualizatutako Sarea (virtio-net)</translation>
+        <source>Controls the working mode of this serial port. If you select <b>Disconnected</b>, the guest OS will detect the serial port but will not be able to operate it.</source>
+        <translation type="obsolete">Serie ataka honen funtzionamendu modua kontrolatzen du. <b>Deskonektaturik</b> hautatuaz gero, bezero SE-ak serie ataka ikusiko du baina ezingo du berarekin lan egin.</translation>
     </message>
     <message>
-        <location line="+137"/>
-        <location line="+152"/>
-        <source>I82078</source>
-        <comment>StorageControllerType</comment>
-        <translation>I82078</translation>
+        <source>&Create Pipe</source>
+        <translation type="obsolete">&Sortu Kanalizazioa</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="-363"/>
-        <source>Empty</source>
-        <comment>medium</comment>
-        <translation>Hutsik</translation>
+        <source>Alt+C</source>
+        <translation type="obsolete">Alt+S</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>Host Drive '%1'</source>
-        <comment>medium</comment>
-        <translation>Hostalari Gidagailua '%1'</translation>
+        <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
+        <translation type="obsolete">Markaturik badago, <b>Ataka Bidean</b> ezarritako kanalizazioa sortuko da makina birtualean abiaraztean. Bestela makina birtuala dagoen kanalizazioa erabiltzen saiatuko da.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Host Drive %1 (%2)</source>
-        <comment>medium</comment>
-        <translation>Hostalari Gidagailua %1 (%2)</translation>
+        <source>Port &Path</source>
+        <translation type="obsolete">Ataka &Bidea</translation>
     </message>
     <message>
-        <location line="+146"/>
-        <source><p style=white-space:pre>Type (Format):  %1 (%2)</p></source>
-        <comment>medium</comment>
-        <translation><p style=white-space:pre>Mota (Heuskarria):  %1 (%2)</p></translation>
+        <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
+        <translation type="obsolete">Ostalarian Serial atakarako kanalizazioaren bidea erakusten du ataka <b>Ostalari Kanalizazio</b> moduan funtzionatzean, edo serie ataka izena atakak <b>Ostalari Gailua</b> moduan funtzinoatzean.</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMSettingsCD</name>
     <message>
-        <location line="+4"/>
-        <source><p>Attached to:  %1</p></source>
-        <comment>image</comment>
-        <translation><p>Erantsita hona:  %1</p></translation>
+        <source>CD/DVD image file is not selected</source>
+        <translation type="obsolete">CD/DVD irudi fitxategia ez dago hautatuta</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source><i>Not Attached</i></source>
-        <comment>image</comment>
-        <translation><i>Erantsi Gabe</i></translation>
+        <source>When checked, mounts the specified media to the CD/DVD drive of the virtual machine. Note that the CD/DVD drive is always connected to the Secondary Master IDE controller of the machine.</source>
+        <translation type="obsolete">Markaturik dagoenean, ezarritako euskarria makina birtualeko CD/DVD gailuan muntatzen du. Kontutan izan CD/DVD gailua beti bigarren IDE kontrolagailuaren ataka nagusian konektaturik dagoela.</translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source><i>Checking accessibility...</i></source>
-        <comment>medium</comment>
-        <translation><i>Sarbidetasun egiaztatzen...</i></translation>
+        <source>&Mount CD/DVD Drive</source>
+        <translation type="obsolete">&Muntatu CD/DVD Gailua</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Failed to check accessibility of disk image files.</source>
-        <comment>medium</comment>
-        <translation>Hutsegitea diska irudiko agirietarako sarbidea egiaztatzerakoan.</translation>
+        <source>Mounts the specified CD/DVD drive to the virtual CD/DVD drive.</source>
+        <translation type="obsolete">Ezarritako CD/DVD gailua CD/DVD gailu birtualean muntatzen du.</translation>
     </message>
     <message>
-        <location line="+55"/>
-        <source><b>No disk image file selected</b></source>
-        <comment>medium</comment>
-        <translation><b>Ez da diska irudi agiririk hautatu</b></translation>
+        <source>Host CD/DVD &Drive</source>
+        <translation type="obsolete">Ostalari CD/DVD &Gailua</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source><b>No disk image files available</b></source>
-        <comment>medium</comment>
-        <translation><b>Ez dago diska irudi agiririk eskuragarri</b></translation>
+        <source>Lists host CD/DVD drives available to insert to the virtual machine.</source>
+        <translation type="obsolete">Makina birtualean muntatzeko erabilgarri dauden ostalariaren CD/DVD gailuak zerrendatzen ditu.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Diska irudi agiriak makina birtualaren ezarpenetan sortu edo gehitu ditzakezu.</translation>
+        <source>When checked, allows the guest to send ATAPI commands directly to the host drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</source>
+        <translation type="obsolete">Markaturik dagoenean, bezeroari ATAPI komandoak zuzenean ostalariaren gailura bidaltzeko aukera ematen du, honek ostalarira konektatutako CD/DVD idazleak MB bidez erabiltzea posible egiten du. Kontutan izan audio CD-ak MB barnetik grabatzea ez dela onartzen oraindik.</translation>
     </message>
     <message>
-        <location line="+189"/>
-        <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
+        <source>Mounts the specified CD/DVD image to the virtual CD/DVD drive.</source>
+        <translation type="obsolete">Muntatu ezarritako CD/DVD irudia CD/DVD gailu birtualean.</translation>
     </message>
     <message>
-        <source>Failed to check media accessibility.</source>
-        <comment>medium</comment>
-        <translation type="obsolete">Hutsegitea multimedia sarbidea egiaztatzerakoan.</translation>
+        <source>&ISO Image File</source>
+        <translation type="obsolete">&ISO Irudi Fitxategia</translation>
     </message>
     <message>
-        <location line="-191"/>
-        <source>You can also change this while the machine is running.</source>
-        <translation>Hau makina ekinean dagoela ere aldatu dezakezu.</translation>
+        <source>Holds the image file to mount to the virtual CD/DVD drive and allows to quickly select a different image.</source>
+        <translation type="obsolete">CD/DVD gailu birtualean muntatu behar den irudi fitxategia erakusten du eta beste irudi bat bizkor hautatzeko aukera ematen du.</translation>
     </message>
     <message>
-        <source><b>No media available</b></source>
-        <comment>medium</comment>
-        <translation type="obsolete"><b>Ez dago multimediarik eskuragarri</b></translation>
+        <source>Invokes the Virtual Disk Manager to select a CD/DVD image to mount.</source>
+        <translation type="obsolete">Disko Birtual Kudeatzailea deitzen du muntatzeko CD/DVD irudi bat hautatzeko.</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMSettingsDlg</name>
     <message>
-        <source>You can create media images using the virtual media manager.</source>
-        <translation type="obsolete">Multimedia irudiak sortu ditzakezu multimedia birtual kudeatzailea erabiliz.</translation>
+        <source>Category</source>
+        <translation type="obsolete">Kategoria</translation>
     </message>
     <message>
-        <location line="+12"/>
-        <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
+        <source>[id]</source>
+        <translation type="obsolete">[id]</translation>
     </message>
     <message>
-        <location line="+196"/>
-        <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
+        <source>[link]</source>
+        <translation type="obsolete">[lotura]</translation>
     </message>
-    <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="+168"/>
-        <source>%n year(s)</source>
-        <translation>
-            <numerusform>%n urte</numerusform>
-            <numerusform>%n urte</numerusform>
-        </translation>
+    <message>
+        <source>[name]</source>
+        <translation type="obsolete">[izena]</translation>
     </message>
-    <message numerus="yes">
-        <location line="+5"/>
-        <source>%n month(s)</source>
-        <translation>
-            <numerusform>%n hilabete</numerusform>
-            <numerusform>%n hilabete</numerusform>
-        </translation>
+    <message>
+        <source>VBoxVMSettingsDlg</source>
+        <translation type="obsolete">VBoxMBEzarpenLeihoa</translation>
     </message>
-    <message numerus="yes">
-        <location line="+5"/>
-        <source>%n day(s)</source>
-        <translation>
-            <numerusform>%n egun</numerusform>
-            <numerusform>%n egun</numerusform>
-        </translation>
+    <message>
+        <source><i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information<i>.</source>
+        <translation type="obsolete"><i>Hautatu ezarpen kategoria bat ezkerreko zerrendatik eta mugitu sagua elementu baten gainetik argibide gehiago jasotzeko<i>.</translation>
     </message>
-    <message numerus="yes">
-        <location line="+5"/>
-        <source>%n hour(s)</source>
-        <translation>
-            <numerusform>%n ordu</numerusform>
-            <numerusform>%n ordu</numerusform>
-        </translation>
+    <message>
+        <source> General </source>
+        <translation type="obsolete"> Orokorra </translation>
     </message>
-    <message numerus="yes">
-        <location line="+5"/>
-        <source>%n minute(s)</source>
-        <translation>
-            <numerusform>%n minutu</numerusform>
-            <numerusform>%n minutu</numerusform>
-        </translation>
+    <message>
+        <source>0</source>
+        <translation type="obsolete">0</translation>
     </message>
-    <message numerus="yes">
-        <location line="+5"/>
-        <source>%n second(s)</source>
-        <translation>
-            <numerusform>%n segundu</numerusform>
-            <numerusform>%n segundu</numerusform>
-        </translation>
+    <message>
+        <source>#general</source>
+        <translation type="obsolete">#general</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-40"/>
-        <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <source> Hard Disks </source>
+        <translation type="obsolete"> Disko Gogorrak </translation>
     </message>
     <message>
-        <location line="-74"/>
-        <source>Screens</source>
-        <comment>details report</comment>
-        <translation>Ikusleihoak</translation>
+        <source>1</source>
+        <translation type="obsolete">1</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="-169"/>
-        <source>SAS</source>
-        <comment>StorageBus</comment>
-        <translation>SAS</translation>
+        <source>#hdds</source>
+        <translation type="obsolete">#hdds</translation>
     </message>
     <message>
-        <location line="+18"/>
-        <location line="+152"/>
-        <source>LsiLogic SAS</source>
-        <comment>StorageControllerType</comment>
-        <translation>LsiLogic SAS</translation>
+        <source> Floppy </source>
+        <translation type="obsolete"> Disketeak </translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="+62"/>
-        <location line="+19"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+1290"/>
-        <location line="+32"/>
-        <source>B</source>
-        <comment>size suffix Bytes</comment>
-        <translation>B</translation>
+        <source>2</source>
+        <translation type="obsolete">2</translation>
     </message>
     <message>
-        <location line="-18"/>
-        <location line="+19"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-31"/>
-        <location line="+33"/>
-        <source>KB</source>
-        <comment>size suffix KBytes=1024 Bytes</comment>
-        <translation>KB</translation>
-    </message>
-    <message>
-        <location line="-18"/>
-        <location line="+19"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-32"/>
-        <location line="+34"/>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="+28"/>
-        <location line="+191"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic2.cpp" line="+4"/>
-        <location line="+1"/>
-        <location line="+1"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="-6"/>
-        <location line="+1"/>
-        <location line="+1"/>
-        <source>MB</source>
-        <comment>size suffix MBytes=1024 KBytes</comment>
-        <translation>MB</translation>
+        <source>#floppy</source>
+        <translation type="obsolete">#floppy</translation>
     </message>
     <message>
-        <location line="-18"/>
-        <location line="+19"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-33"/>
-        <location line="+35"/>
-        <source>GB</source>
-        <comment>size suffix GBytes=1024 MBytes</comment>
-        <translation>GB</translation>
+        <source> CD/DVD </source>
+        <translation type="obsolete"> CD/DVD_ROM </translation>
     </message>
     <message>
-        <location line="-18"/>
-        <location line="+19"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-34"/>
-        <location line="+36"/>
-        <source>TB</source>
-        <comment>size suffix TBytes=1024 GBytes</comment>
-        <translation>TB</translation>
+        <source>3</source>
+        <translation type="obsolete">3</translation>
     </message>
     <message>
-        <location line="-18"/>
-        <location line="+19"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-35"/>
-        <location line="+37"/>
-        <source>PB</source>
-        <comment>size suffix PBytes=1024 TBytes</comment>
-        <translation>PB</translation>
+        <source>#dvd</source>
+        <translation type="obsolete">#dvd</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Gaituta</translation>
+        <source> Audio </source>
+        <translation type="obsolete"> Audioa </translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Ezgaituta</translation>
+        <source>4</source>
+        <translation type="obsolete">4</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="-7"/>
-        <source>Nested Paging</source>
-        <translation>Nested Orrialdeztapena</translation>
+        <source>#audio</source>
+        <translation type="obsolete">#audio</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Unrestricted Execution</source>
-        <translation>Mugagabeko Exekuzioa</translation>
+        <source> Network </source>
+        <translation type="obsolete"> Sarea </translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-1610"/>
-        <source>Unknown device</source>
-        <comment>USB device details</comment>
-        <translation>Gailu ezezaguna</translation>
+        <source>5</source>
+        <translation type="obsolete">5</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="+43"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+307"/>
-        <source>Remote Desktop Server Port</source>
-        <comment>details report (VRDE Server)</comment>
-        <translation>Hurruneko Mahaigain Zerbitzari Ataka</translation>
+        <source>#network</source>
+        <translation type="obsolete">#network</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+4"/>
-        <source>Remote Desktop Server</source>
-        <comment>details report (VRDE Server)</comment>
-        <translation>Hurruneko Mahaigain Zerbitzaria</translation>
+        <source> USB </source>
+        <translation type="obsolete"> USB </translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Disabled</source>
-        <comment>details report (VRDE Server)</comment>
-        <translation>Ezgaituta</translation>
+        <source>6</source>
+        <translation type="obsolete">6</translation>
     </message>
     <message>
-        <location line="+490"/>
-        <source>All files (*)</source>
-        <translation>Agiri guztiak (*)</translation>
+        <source>#usb</source>
+        <translation type="obsolete">#usb</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="-455"/>
-        <source>Fault Tolerant Syncing</source>
-        <comment>MachineState</comment>
-        <translation type="unfinished"></translation>
+        <source> Remote Display </source>
+        <translation type="obsolete"> Urruneko Pantaila </translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>Unlocked</source>
-        <comment>SessionState</comment>
-        <translation>Desblokeatuta</translation>
+        <source>7</source>
+        <translation type="obsolete">7</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Locked</source>
-        <comment>SessionState</comment>
-        <translation>Blokeatuta</translation>
+        <source>#vrdp</source>
+        <translation type="obsolete">#vrdp</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Unlocking</source>
-        <comment>SessionState</comment>
-        <translation>Desblokeatzen</translation>
+        <source> Shared Folders </source>
+        <translation type="obsolete"> Partekatutako Karpetak </translation>
     </message>
     <message>
-        <location line="+245"/>
-        <location line="+166"/>
-        <source>Null</source>
-        <comment>AuthType</comment>
-        <translation>Null</translation>
+        <source>8</source>
+        <translation type="obsolete">8</translation>
     </message>
     <message>
-        <location line="-165"/>
-        <location line="+166"/>
-        <source>External</source>
-        <comment>AuthType</comment>
-        <translation>Kanpokoa</translation>
+        <source>#sfolders</source>
+        <translation type="obsolete">#sfolders</translation>
     </message>
     <message>
-        <location line="-165"/>
-        <location line="+166"/>
-        <source>Guest</source>
-        <comment>AuthType</comment>
-        <translation>Gonbidatua</translation>
+        <source>&Identification</source>
+        <translation type="obsolete">&Identifikazioa</translation>
     </message>
     <message>
-        <location line="-179"/>
-        <location line="+165"/>
-        <source>Intel HD Audio</source>
-        <comment>AudioControllerType</comment>
-        <translation>Intel HD Audio</translation>
+        <source>&Name</source>
+        <translation type="obsolete">&Izena</translation>
     </message>
     <message>
-        <location line="-108"/>
-        <source>PIIX3</source>
-        <comment>ChipsetType</comment>
-        <translation>PIIX3</translation>
+        <source>Holds the name of the virtual machine.</source>
+        <translation type="obsolete">Makina birtualaren izena bistaratzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>ICH9</source>
-        <comment>ChipsetType</comment>
-        <translation>ICH9</translation>
+        <source>OS &Type</source>
+        <translation type="obsolete">SE mo&ta</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="-563"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="+1"/>
-        <source>Execution Cap</source>
-        <comment>details report</comment>
-        <translation>Exekuzio Muga</translation>
+        <source>Base &Memory Size</source>
+        <translation type="obsolete">Oinarri &Memoria Tamaina</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source><nobr>%1%</nobr></source>
-        <comment>details report</comment>
-        <translation><nobr>%1%</nobr></translation>
+        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
+        <translation type="obsolete">Makina Birtualari ezarritako memoria kantitatea ezartzen du. Gehiegi ezarriaz gero, makina agian ez da abiaraziko.</translation>
     </message>
     <message>
-        <location line="+208"/>
-        <source>Generic, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>Generikoa, '%1'</translation>
+        <source><</source>
+        <translation type="obsolete"><</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="-168"/>
-        <source>Generic Driver</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Gidagailu Generikoa</translation>
+        <source>=</source>
+        <translation type="obsolete">=</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="-162"/>
-        <source>Adapter %1</source>
-        <translation>Egokitzailea %1</translation>
+        <source>></source>
+        <translation type="obsolete">></translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="-82"/>
-        <source>Disabled</source>
-        <comment>DragAndDropType</comment>
-        <translation>Ezgaituta</translation>
+        <source>MB</source>
+        <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Host To Guest</source>
-        <comment>DragAndDropType</comment>
-        <translation>Hostalaritik Gonbidatura</translation>
+        <source>&Video Memory Size</source>
+        <translation type="obsolete">&Bideo Memoria Tamaina</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Guest To Host</source>
-        <comment>DragAndDropType</comment>
-        <translation>Gonbidatutik Hostalarira</translation>
+        <source>Controls the amount of video memory provided to the virtual machine.</source>
+        <translation type="obsolete">Makina birtualari ezarritako bideo memoria kontrolatzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Bidirectional</source>
-        <comment>DragAndDropType</comment>
-        <translation>Binorabidekoa</translation>
+        <source>&Basic</source>
+        <translation type="obsolete">&Basikoa</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>PS/2 Sagua</translation>
+        <source>Select</source>
+        <translation type="obsolete">Hautatu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB Sagua</translation>
+        <source>Selects the snapshot folder path.</source>
+        <translation type="obsolete">Egoera-argazki karpeta bidea hautatzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB Tableta</translation>
+        <source>Reset</source>
+        <translation type="obsolete">Berrezarri</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>PS/2 eta USB Sagua</translation>
+        <source>Extended Features</source>
+        <translation type="obsolete">Hedaturiko Ezaugarriak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB Multi-Ikutu Tableteta</translation>
+        <source>Enable A&CPI</source>
+        <translation type="obsolete">A&CPI Gaitu</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>Normal</source>
-        <comment>MediumType</comment>
-        <translation>Arrunta</translation>
+        <source>Alt+C</source>
+        <translation type="obsolete">Alt+C</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Immutable</source>
-        <comment>MediumType</comment>
-        <translation>Aldaezina</translation>
+        <source>Enable IO A&PIC</source>
+        <translation type="obsolete">IO A&PIC gaitu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Writethrough</source>
-        <comment>MediumType</comment>
-        <translation>Idaz-igaropena</translation>
+        <source>Alt+P</source>
+        <translation type="obsolete">Alt+P</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Shareable</source>
-        <comment>MediumType</comment>
-        <translation>Elkarbanagarria</translation>
+        <source>Boo&t Order</source>
+        <translation type="obsolete">A&bio Ordena</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Readonly</source>
-        <comment>MediumType</comment>
-        <translation>Irakurtzekoa-bakarrik</translation>
+        <source>&Advanced</source>
+        <translation type="obsolete">&Aurreratua</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Multi-attach</source>
-        <comment>MediumType</comment>
-        <translation>Eranskin-anitz</translation>
+        <source>&Description</source>
+        <translation type="obsolete">A&zalpena</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Dynamically allocated storage</source>
-        <comment>MediumVariant</comment>
-        <translation>Esleitu biltegia dinamikoki</translation>
+        <source>&Primary Master</source>
+        <translation type="obsolete">&Lehen Mailako Nagusia</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Dynamically allocated differencing storage</source>
-        <comment>MediumVariant</comment>
-        <translation>Dinamikoki esleturiko biltegiratze ezberdintasuna</translation>
+        <source><not selected></source>
+        <translation type="obsolete"><ez hautaturik></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Fixed size storage</source>
-        <comment>MediumVariant</comment>
-        <translation>Biltegiratze neurri zuzendua</translation>
+        <source>P&rimary Slave</source>
+        <translation type="obsolete">Lehen Mailako Mo&rroia</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Dynamically allocated storage split into files of less than 2GB</source>
-        <comment>MediumVariant</comment>
-        <translation>Dinamikoki esleituriko biltegi bananketa 2GB baino gutxiagoko agirietan</translation>
+        <source>&Secondary (IDE 1) Slave</source>
+        <translation type="obsolete">&Bigarren Morroia (IDE 1)</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Dynamically allocated differencing storage split into files of less than 2GB</source>
-        <comment>MediumVariant</comment>
-        <translation>Dinamikoki esleituriko biltegi bananketa aldea 2GB baino gutxiagoko agirietan</translation>
+        <source>&Mount Floppy Drive</source>
+        <translation type="obsolete">&Muntatu Diskete Gailua</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Fixed size storage split into files of less than 2GB</source>
-        <comment>MediumVariant</comment>
-        <translation>Zuzendutako neurria biltegi bananketa 2GB baino gutxiagoko agirietan</translation>
+        <source>Host Floppy &Drive</source>
+        <translation type="obsolete">Ostalari Diskete &Gailua</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Dynamically allocated compressed storage</source>
-        <comment>MediumVariant</comment>
-        <translation>Dinamikoki esleturiko biltegiratze konprimitua</translation>
+        <source>Alt+D</source>
+        <translation type="obsolete">Alt+D</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Dynamically allocated differencing compressed storage</source>
-        <comment>MediumVariant</comment>
-        <translation>Dinamikoki esleturiko biltegiratze konprimitu ezberdintasuna</translation>
+        <source>Mounts the specified host Floppy drive to the virtual Floppy drive.</source>
+        <translation type="obsolete">Hautatutako ostalari diekete gailua muntatu Diskete gailu birtualean.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Fixed size ESX storage</source>
-        <comment>MediumVariant</comment>
-        <translation>ESX biltegiratze neurri zuzendua</translation>
+        <source>&Image File</source>
+        <translation type="obsolete">&Irudi fitxategia</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Fixed size storage on raw disk</source>
-        <comment>MediumVariant</comment>
-        <translation>Biltegiratze neurri zuzendua raw diskan</translation>
+        <source>Alt+I</source>
+        <translation type="obsolete">Alt+I</translation>
     </message>
     <message>
-        <location line="+18"/>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>NAT Sarea</translation>
+        <source>Mounts the specified Floppy image to the virtual Floppy drive.</source>
+        <translation type="obsolete">Muntatu hautatutako diskete irudia diskete gailu birtualean.</translation>
     </message>
     <message>
-        <location line="+30"/>
-        <source>Deny</source>
-        <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Ukatu</translation>
+        <source>&Mount CD/DVD Drive</source>
+        <translation type="obsolete">&Muntatu CD/DVD Gailua</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Allow VMs</source>
-        <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Ahalbidetu MB-ak</translation>
+        <source>Host CD/DVD &Drive</source>
+        <translation type="obsolete">Ostalari CD/DVD &Gailua</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Allow All</source>
-        <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Ahalbidetu Denak</translation>
+        <source>Mounts the specified CD/DVD drive to the virtual CD/DVD drive.</source>
+        <translation type="obsolete">Ezarritako CD/DVD gailua CD/DVD gailu birtualean muntatzen du.</translation>
     </message>
     <message>
-        <location line="+42"/>
-        <location line="+163"/>
-        <source>Ignore</source>
-        <comment>USBDeviceFilterAction</comment>
-        <translation>Ezikusi</translation>
+        <source>&ISO Image File</source>
+        <translation type="obsolete">&ISO Irudi Fitxategia</translation>
     </message>
     <message>
-        <location line="-162"/>
-        <location line="+163"/>
-        <source>Hold</source>
-        <comment>USBDeviceFilterAction</comment>
-        <translation type="unfinished"></translation>
+        <source>Mounts the specified CD/DVD image to the virtual CD/DVD drive.</source>
+        <translation type="obsolete">Muntatu ezarritako CD/DVD irudia CD/DVD gailu birtualean.</translation>
     </message>
     <message>
-        <location line="-62"/>
-        <source>UDP</source>
-        <comment>NATProtocol</comment>
-        <translation>UDP</translation>
+        <source>&Enable Audio</source>
+        <translation type="obsolete">Audioa &Gailtu</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>TCP</source>
-        <comment>NATProtocol</comment>
-        <translation>TCP</translation>
+        <source>Host Audio &Driver</source>
+        <translation type="obsolete">Ostalari Audio &Kontrolagailua</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="+29"/>
-        <location line="+86"/>
-        <source>IDE Primary Master</source>
-        <comment>StorageSlot</comment>
-        <translation>IDE Lehen Nagusia</translation>
+        <source>Enable &USB Controller</source>
+        <translation type="obsolete">Gaitu &USB Kontrolatzailea</translation>
     </message>
     <message>
-        <location line="-84"/>
-        <location line="+85"/>
-        <source>IDE Primary Slave</source>
-        <comment>StorageSlot</comment>
-        <translation>IDE Lehen Esklabua</translation>
+        <source>Alt+U</source>
+        <translation type="obsolete">Alt+U</translation>
     </message>
     <message>
-        <location line="-83"/>
-        <location line="+84"/>
-        <source>IDE Secondary Master</source>
-        <comment>StorageSlot</comment>
-        <translation>IDE Bigarren Nagusia</translation>
+        <source>USB Device &Filters</source>
+        <translation type="obsolete">USB Gailu &Iragazkiak</translation>
     </message>
     <message>
-        <location line="-82"/>
-        <location line="+83"/>
-        <source>IDE Secondary Slave</source>
-        <comment>StorageSlot</comment>
-        <translation>IDE Bigarren Esklabua</translation>
+        <source>Ins</source>
+        <translation type="obsolete">Ins</translation>
     </message>
     <message>
-        <location line="-67"/>
-        <location line="+68"/>
-        <source>SATA Port %1</source>
-        <comment>StorageSlot</comment>
-        <translation>SATA Ataka %1</translation>
+        <source>Add Empty (Ins)</source>
+        <translation type="obsolete">Gehitu Hutsik (Ins)</translation>
     </message>
     <message>
-        <location line="-52"/>
-        <location line="+53"/>
-        <source>SCSI Port %1</source>
-        <comment>StorageSlot</comment>
-        <translation>SCSI Ataka %1</translation>
+        <source>Alt+Ins</source>
+        <translation type="obsolete">Alt+Ins</translation>
     </message>
     <message>
-        <location line="-37"/>
-        <location line="+38"/>
-        <source>SAS Port %1</source>
-        <comment>StorageSlot</comment>
-        <translation>SAS Ataka %1</translation>
+        <source>Add From (Alt+Ins)</source>
+        <translation type="obsolete">Gehitu hemendik (Alt+Ins)</translation>
     </message>
     <message>
-        <location line="-22"/>
-        <location line="+23"/>
-        <source>Floppy Device %1</source>
-        <comment>StorageSlot</comment>
-        <translation>Diskete Gailua %1</translation>
+        <source>Del</source>
+        <translation type="obsolete">Ezab</translation>
     </message>
     <message>
-        <location line="+478"/>
-        <location line="+27"/>
-        <source>General</source>
-        <comment>DetailsElementType</comment>
-        <translation>Orokorra</translation>
+        <source>Remove (Del)</source>
+        <translation type="obsolete">Ezabatu (Ezab)</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>Preview</source>
-        <comment>DetailsElementType</comment>
-        <translation>Aurreikuspena</translation>
+        <source>Removes the selected USB filter.</source>
+        <translation type="obsolete">Hautatutako USB Iragazkia ezabatzen du.</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>System</source>
-        <comment>DetailsElementType</comment>
-        <translation>Sistema</translation>
+        <source>Ctrl+Up</source>
+        <translation type="obsolete">Ktrl+Gora</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>Display</source>
-        <comment>DetailsElementType</comment>
-        <translation>Erakutsi</translation>
+        <source>Move Up (Ctrl+Up)</source>
+        <translation type="obsolete">Mugitu Gora (Ktrl+Gora)</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>Storage</source>
-        <comment>DetailsElementType</comment>
-        <translation>Biltegia</translation>
+        <source>Moves the selected USB filter up.</source>
+        <translation type="obsolete">Haututako USB iragazkia gora mugitzen du.</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>Audio</source>
-        <comment>DetailsElementType</comment>
-        <translation>Audioa</translation>
+        <source>Ctrl+Down</source>
+        <translation type="obsolete">Ktrl+Behera</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>Network</source>
-        <comment>DetailsElementType</comment>
-        <translation>Sarea</translation>
+        <source>Move Down (Ctrl+Down)</source>
+        <translation type="obsolete">Mugitu Behera (Ktrl+Behera)</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>Serial ports</source>
-        <comment>DetailsElementType</comment>
-        <translation>Serieko Atakak</translation>
+        <source>Moves the selected USB filter down.</source>
+        <translation type="obsolete">Haututako USB iragazkia behera mugitzen du.</translation>
     </message>
     <message>
-        <location line="-25"/>
-        <location line="+27"/>
-        <source>Parallel ports</source>
-        <comment>DetailsElementType</comment>
-        <translation>Ataka Kidetuak</translation>
+        <source>&Enable VRDP Server</source>
+        <translation type="obsolete">&Gaitu VRDP Zerbitzaria</translation>
     </message>
     <message>
-        <location line="-25"/>
-        <location line="+27"/>
-        <source>USB</source>
-        <comment>DetailsElementType</comment>
-        <translation>USB</translation>
+        <source>Defines the VRDP authentication method.</source>
+        <translation type="obsolete">VRDP autentifikazio metodoa ezartzen du.</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>Shared folders</source>
-        <comment>DetailsElementType</comment>
-        <translation>Elkarbanatutako Agiritegiak</translation>
+        <source>Specifies the timeout for guest authentication, in milliseconds.</source>
+        <translation type="obsolete">Bezero autentifikazioen denbora-muga ezartzen du, milisegundotan.</translation>
     </message>
     <message>
-        <location line="-26"/>
-        <location line="+27"/>
-        <source>Description</source>
-        <comment>DetailsElementType</comment>
-        <translation>Azalpena</translation>
+        <source>Help</source>
+        <translation type="obsolete">Laguntza</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="+303"/>
-        <source>Please choose a virtual hard drive file</source>
-        <translation>Mesedez hautatu diska gogor agiri birtual bat</translation>
+        <source>F1</source>
+        <translation type="obsolete">F1</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>All virtual hard drive files (%1)</source>
-        <translation>Diska gogor birtual agiri guztiak (%1)</translation>
+        <source>Holds the dialog help.</source>
+        <translation type="obsolete">Leiho laguntza erakusten du.</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>Please choose a virtual optical disk file</source>
-        <translation>Mesedez hautatu diska optiko birtual agiri bat</translation>
+        <source>Invalid settings detected</source>
+        <translation type="obsolete">Okerreko ezarpena atzeman da</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>All virtual optical disk files (%1)</source>
-        <translation>Diska optiko birtual agiri guztiak (%1)</translation>
+        <source>&OK</source>
+        <translation type="obsolete">Ad&os</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>Please choose a virtual floppy disk file</source>
-        <translation>Mesedez hautatu diskete diska birtual agiri bat</translation>
+        <source>Alt+O</source>
+        <translation type="obsolete">Alt O</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>All virtual floppy disk files (%1)</source>
-        <translation>Disketa birtual agiri guztiak (%1)</translation>
+        <source>Accepts (saves) changes and closes the dialog.</source>
+        <translation type="obsolete">Onartu (gorde) aldaketak eta elkarrizketa ixten du.</translation>
     </message>
     <message>
-        <location line="+1663"/>
-        <source>VDI (VirtualBox Disk Image)</source>
-        <translation>VDI (VirtualBox Diska Irudia)</translation>
+        <source>Cancel</source>
+        <translation type="obsolete">Utzi</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>VMDK (Virtual Machine Disk)</source>
-        <translation>VMDK (Makina Birtual Diska)</translation>
+        <source>Cancels changes and closes the dialog.</source>
+        <translation type="obsolete">Aldaketak baztertu eta leihoa ixten du.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>VHD (Virtual Hard Disk)</source>
-        <translation>VHD (Diska Gogor Birtuala)</translation>
+        <source>When checked, attaches the specified virtual hard disk to the Master slot of the Primary IDE controller.</source>
+        <translation type="obsolete">Markaturik dagoenean, ezarritako disko gogor birtuala lehenengo IDE kontrolatzailearen ataka nagusian erantsiko da.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>HDD (Parallels Hard Disk)</source>
-        <translation>HDD (Diska Gogor Kidetuak)</translation>
+        <source>When checked, attaches the specified virtual hard disk to the Slave slot of the Primary IDE controller.</source>
+        <translation type="obsolete">Markaturik dagoenean, ezarritako disko gogor birtuala lehenengo IDE kontrolatzailearen ataka morroian erantsiko da.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>QED (QEMU enhanced disk)</source>
-        <translation>QED (QEMU diska hobetua)</translation>
+        <source>When checked, attaches the specified virtual hard disk to the Slave slot of the Secondary IDE controller.</source>
+        <translation type="obsolete">Markaturik dagoenean, ezarritako disko gogor birtuala bigarren IDE kontrolatzailearen ataka morroian erantsiko da.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>QCOW (QEMU Copy-On-Write)</source>
-        <translation>QCOW (QEMU Kopiatu-Eta-Idatzi)</translation>
+        <source>Holds the virtual hard disk to attach to this IDE slot and allows to quickly select a different hard disk.</source>
+        <translation type="obsolete">IDE ataka honetan erantsiriko disko gogor birtuala erakusten du eta beste disko bat bizkor hautatzeko aukera ematen du.</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp" line="-275"/>
-        <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Mesedez hautatu diska gogor birtual agiri berriarentzako kokaleku bat</translation>
+        <source>When checked, mounts the specified media to the CD/DVD drive of the virtual machine. Note that the CD/DVD drive is always connected to the Secondary Master IDE controller of the machine.</source>
+        <translation type="obsolete">Markaturik dagoenean, ezarritako euskarria makina birtualeko CD/DVD gailuan muntatzen du. Kontutan izan CD/DVD gailua beti bigarren IDE kontrolagailuaren ataka nagusian konektaturik dagoela.</translation>
     </message>
-</context>
-<context>
-    <name>VBoxGlobalSettings</name>
     <message>
-        <location filename="../src/VBoxGlobalSettings.cpp" line="+268"/>
-        <source>The value '%1' of the key '%2' doesn't match the regexp constraint '%3'.</source>
-        <translation type="unfinished"></translation>
+        <source>Holds the image file to mount to the virtual CD/DVD drive and allows to quickly select a different image.</source>
+        <translation type="obsolete">CD/DVD gailu birtualean muntatu behar den irudi fitxategia erakusten du eta beste irudi bat bizkor hautatzeko aukera ematen du.</translation>
     </message>
     <message>
-        <location line="-9"/>
-        <source>Cannot delete the key '%1'.</source>
-        <translation>Ezin da '%1' tekla ezabatu.</translation>
+        <source>When checked, mounts the specified media to the Floppy drive of the virtual machine.</source>
+        <translation type="obsolete">Markaturik dagoenean, ezarritako euskarria makina birtualeko diskete gailuan muntatzen du.</translation>
     </message>
     <message>
-        <location line="-124"/>
-        <source>'%1' is an invalid host-combination code-sequence.</source>
-        <translation>'%1' hostalari-konbinazio kode-sekuentzia baliogabe bat da.</translation>
+        <source>Holds the image file to mount to the virtual Floppy drive and allows to quickly select a different image.</source>
+        <translation type="obsolete">Diskete gailu birtualean muntatu behar den irudi fitxategia erakusten du eta beste irudi bat bizkor hautatzeko aukera ematen du.</translation>
     </message>
-</context>
-<context>
-    <name>VBoxLicenseViewer</name>
     <message>
-        <location filename="../src/VBoxLicenseViewer.cpp" line="+95"/>
-        <source>VirtualBox License</source>
-        <translation>VirtualBox Baimena</translation>
+        <source>When checked, a virtual PCI audio card will be plugged into the virtual machine and will communicate with the host audio system using the specified driver.</source>
+        <translation type="obsolete">Markaturik dagoenean, PCI audio txartel birtuala makina birtualean erantsirik dago eta ezarritako kontrolatzailea erabiliko ostalariaren audio txartelarekin harremanetan jartzeko.</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>I &Agree</source>
-        <translation>&Onartzen dut</translation>
+        <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source>
+        <translation type="obsolete">Markaturik dagoenean, makina birtuala Urruneko Idazmahai Protokolo (RDP) zerbitzari birtuala gaituko du, bezeroei makina birtualera (martxan dagoenean) RDP bezero estandar bat erabiliaz konektatzeko aukera emanez.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>I &Disagree</source>
-        <translation>&Ez dut Onartzen</translation>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
     </message>
-</context>
-<context>
-    <name>VBoxMediaManagerDlg</name>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="-65"/>
-        <source>&Actions</source>
-        <translation>&Ekintzak</translation>
+        <source><not attached></source>
+        <comment>hard disk</comment>
+        <translation type="obsolete"><ez erantsia></translation>
     </message>
     <message>
-        <source>&New...</source>
-        <translation type="obsolete">&Berria...</translation>
+        <source> - Settings</source>
+        <translation type="obsolete"> - Ezarpenak</translation>
     </message>
     <message>
-        <source>&Add...</source>
-        <translation type="obsolete">&Gehitu...</translation>
+        <source>New Filter %1</source>
+        <comment>usb</comment>
+        <translation type="obsolete">%1 Iragazki Berria</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>R&emove</source>
-        <translation>&Kendu</translation>
+        <source>&Shared Clipboard</source>
+        <translation type="obsolete">&Partekatutako Arbela</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Re&lease</source>
-        <translation>&Argitaratu</translation>
+        <source>S&napshot Folder</source>
+        <translation type="obsolete">E&goera-argazki Karpeta</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Re&fresh</source>
-        <translation>&Berritu</translation>
+        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
+        <translation type="obsolete">Makina birtual honetan instalatzea pentsatzen duzun sistema eragilea erakusten du (sistema eragile bezeroa deiturikoa).</translation>
     </message>
     <message>
-        <location line="+49"/>
-        <source>Checking accessibility</source>
-        <translation>Sarbidetasuna egiaztatzen</translation>
+        <source><qt>When checked, the virtual machine will support
+the Advanced Configuration and Power Management Interface (ACPI). <b>Note:</b> don't disable
+this feature after having installed a Windows guest operating system!</qt></source>
+        <translation type="obsolete"><qt>Markaturik dagoenean, makina birtualak Indar Kudeaketa
+eta Konfigurazio Aurreratua (ACPI) onartuko du. <b>Oharra:</b> ez ezgaitu
+ezaugarri hau windows bezero sistema eragile bat instalatu ondoren!</qt></translation>
     </message>
     <message>
-        <source>All files (*)</source>
-        <translation type="obsolete">Agiri guztiak (*)</translation>
+        <source><qt>When checked, the virtual machine will support
+the Input Output APIC (I/O APIC), which may slightly decrease performance. <b>Note:</b> don't disable
+this feature after having installed a Windows guest operating system!</qt></source>
+        <translation type="obsolete"><qt>Markaturik dagoenean, makina birtualak Sarrera Irteera
+APIC (I/O APIC) onartuko du, honek makina birtualaren
+funtzionamendua asko geldotuko du.<b>Oharra:</b> ez ezgaitu
+ezaugarri hau windows bezero sistema eragile bat instalatu ondoren!</qt></translation>
     </message>
     <message>
-        <location line="-543"/>
-        <source><i>Not&nbsp;Attached</i></source>
-        <translation><i>Not&nbsp;Erantsita</i></translation>
+        <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <translation type="obsolete">Bezero eta ostalariaren sistema eragileen arteko arbela partekatzeko modua ezartzen du. Kontutan izan honek Bezero Gehigarriak sistema eragile bezeroan instalaturik egotea behar duela.</translation>
     </message>
     <message>
-        <location line="+1021"/>
-        <source>--</source>
-        <comment>no info</comment>
-        <translation>--</translation>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation type="obsolete">Makina birtual honen egoera-argazkiak gordeko diren bidea erakusten du. Kontutan izan egoera-argazkiek disko leku asko erabili dezaketela.</translation>
     </message>
     <message>
-        <location line="-500"/>
-        <source>Virtual Media Manager</source>
-        <translation>Multimedia Birtual Kudeatzailea</translation>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Egoera-argazki karpeta bidea lehenetsiriko balioan berrezartzen du. Uneko lehenetsiriko bidea erakutsiko da aldaketak onartu eta leiho hau berriz irekitzean.</translation>
     </message>
     <message>
-        <location line="-19"/>
-        <source>Copy an existing disk image file</source>
-        <translation>Kopiatu dagoen diska irudi agiri bat</translation>
+        <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
+        <translation type="obsolete">Makina birtualaren azalpena erakusten du. Azalpenen eremua instalaturiko bezero sistemaren eragileari edo konfigurazioari buruz iruzkinak egiteko da erabilgarria.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Modify the attributes of the selected disk image file</source>
-        <translation>Aldatu hautaturiko diska irudi agiriaren ezaugarriak</translation>
+        <source>Invokes the Virtual Disk Manager to create a new or select an existing virtual hard disk to attach.</source>
+        <translation type="obsolete">Eransteko disko gogor birtual bat sortu edo daudenen arteak aukeratzeko Disko Gogor Kudeatzaile irekitzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Remove the selected disk image file</source>
-        <translation>Kendu hautaturiko diska irudi agiria</translation>
+        <source>Lists host Floppy drives available to insert to the virtual machine.</source>
+        <translation type="obsolete">Makina birtualean muntatzeko erabilgarri dauden ostalariaren diskete gailuak zerrendatzen ditu.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Release the selected disk image file by detaching it from the machines</source>
-        <translation>Askatu hautaturiko diska irudi agiria hura makinetatik deserantsiz</translation>
+        <source>Invokes the Virtual Disk Manager to select a Floppy image to mount.</source>
+        <translation type="obsolete">Disko Birtual Kudeatzailea deitzen du muntatzeko Diskete irudi bat hautatzeko.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Refresh the list of disk image files</source>
-        <translation>Berritu diska irudi agiri zerrenda</translation>
+        <source>Lists host CD/DVD drives available to insert to the virtual machine.</source>
+        <translation type="obsolete">Makina birtualean muntatzeko erabilgarri dauden ostalariaren CD/DVD gailuak zerrendatzen ditu.</translation>
     </message>
     <message>
-        <location line="+17"/>
-        <location line="+9"/>
-        <location line="+5"/>
-        <source>Name</source>
-        <translation>Izena</translation>
+        <source>Invokes the Virtual Disk Manager to select a CD/DVD image to mount.</source>
+        <translation type="obsolete">Disko Birtual Kudeatzailea deitzen du muntatzeko CD/DVD irudi bat hautatzeko.</translation>
     </message>
     <message>
-        <location line="-13"/>
-        <source>Virtual Size</source>
-        <translation>Neurri Birtuala</translation>
+        <source><qt>Controls the audio output driver. The <b>Null Audio Driver</b>
+makes the guest see an audio card, however every access to it will be ignored.</qt></source>
+        <translation type="obsolete"><qt>Audio irteera kontrolagailua kontrolatzen du. <b>Audio Kontrolagailu Nuluak</b>
+bezeroak audio txartela ikustea eragiten du baina sortzen duen edozein irteera baztertu egingo da.</qt></translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Actual Size</source>
-        <translation>Oraingo Neurria</translation>
+        <source>When checked, enables the virtual USB controller of this machine.</source>
+        <translation type="obsolete">Markaturik dagoenean, makina honetako USB kontrolatzaile birtuala gaitzen du.</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <location line="+5"/>
-        <source>Size</source>
-        <translation>Neurria</translation>
+        <source>Lists all USB filters of this machine. The checkbox to the left defines whether the particular filter is enabled or not.</source>
+        <translation type="obsolete">Makina honetako USB iragazkiak zerrendatzen ditu. Ezkerreko aukera kutxak iragazki jakin bat gaiturik dagoen edo ez ezartzen du.</translation>
     </message>
     <message>
-        <location line="-12"/>
-        <source>Type:</source>
-        <translation>Mota:</translation>
+        <source>Adds a new USB filter with all fields initially set to empty strings. Note that such a filter will match any attached USB device.</source>
+        <translation type="obsolete">Gehitu USB iragazki berri bat eremu guztiak hutsean dituela. Kontutan izan iragazki honek erantsiriko edoizen USB gailu aurkituko duela.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location line="+7"/>
-        <location line="+5"/>
-        <source>Location:</source>
-        <translation>Kokalekua:</translation>
+        <source>Adds a new USB filter with all fields set to the values of the selected USB device attached to the host PC.</source>
+        <translation type="obsolete">Ostalari ordenagailuari erantsitako hautatutako USB gailuaren eremu balioekin USB iragazki berri bat sortu.</translation>
     </message>
     <message>
-        <location line="-11"/>
-        <source>Format:</source>
-        <translation>Heuskarria:</translation>
+        <source>Adapter %1</source>
+        <comment>network</comment>
+        <translation type="obsolete">%1 Moldagailua</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Storage details:</source>
-        <translation>Biltegi xehetasunak:</translation>
+        <source>Host &Interfaces</source>
+        <translation type="obsolete">Ostalari &Interfazeak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <location line="+5"/>
-        <location line="+5"/>
-        <source>Attached to:</source>
-        <translation>Hona Erantsita:</translation>
+        <source>Lists all available host interfaces.</source>
+        <translation type="obsolete">Ostalari interfaze erabilgarriak zerrendatzen ditu.</translation>
     </message>
     <message>
-        <location line="-50"/>
-        <source>&Copy...</source>
-        <translation>&Kopiatu...</translation>
+        <source>Adds a new host interface.</source>
+        <translation type="obsolete">Ostalari interfaze berri bat gehitzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Modify...</source>
-        <translation>&Aldatu...</translation>
+        <source>Removes the selected host interface.</source>
+        <translation type="obsolete">Hautatutako ostalari interfazea ezabatzen du.</translation>
     </message>
     <message>
-        <source>Create a new virtual hard drive</source>
-        <translation type="obsolete">Sortu diska gogor birtual berri bat</translation>
+        <source><No suitable interfaces></source>
+        <translation type="obsolete"><inerfaze ez erabilgarriak></translation>
     </message>
-</context>
-<context>
-    <name>VBoxMiniToolBar</name>
     <message>
-        <source>Always show the toolbar</source>
-        <translation type="obsolete">Betik erakutsi tresnabarra</translation>
+        <source>Add</source>
+        <translation type="obsolete">Gehitu</translation>
     </message>
     <message>
-        <source>Exit Full Screen or Seamless Mode</source>
-        <translation type="obsolete">Irten Ikusleiho Osotik edo Irudizko Modutik</translation>
+        <source>Remove</source>
+        <translation type="obsolete">Kendu</translation>
     </message>
     <message>
-        <source>Close VM</source>
-        <translation type="obsolete">Itxi MB-a</translation>
+        <source>VirtualBox Host Interface %1</source>
+        <translation type="obsolete">VirtualBox %1 Ostalari interfazea</translation>
     </message>
     <message>
-        <source>Minimize Window</source>
-        <translation type="obsolete">Txikiengotu Leihoa</translation>
+        <source><p>Do you want to remove the selected host network interface <nobr><b>%1</b>?</nobr></p><p><b>Note:</b> This interface may be in use by one or more network adapters of this or another VM. After it is removed, these adapters will no longer work until you correct their settings by either choosing a different interface name or a different adapter attachment type.</p></source>
+        <translation type="obsolete"><p>Hautaturiko <nobr><b>%1</b></nobr> sare interfazea ezabatu nahi al duzu? </p><p><b>Oharra:</b> Interfaze hau erabilia egon daiteke sare moldagailu bat edo gehiagorengatik beste MB batetan. Ezabatu ondoren sare moldagailu horiek ez dute funtzionatuko ezarpen horiek aldatu arte  edo beste interfaze izen bat hautatuz o moldagailu eranste modu ezberdin bat hautatuaz.</p></translation>
     </message>
-</context>
-<context>
-    <name>VBoxScreenshotViewer</name>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.cpp" line="+204"/>
-        <source>Screenshot of %1 (%2)</source>
-        <translation>Ikusleiho-argazkiak %1 (%2)</translation>
+        <source>9</source>
+        <translation type="obsolete">9</translation>
     </message>
     <message>
-        <location line="+36"/>
-        <source>Click to view non-scaled screenshot.</source>
-        <translation>Klikatu ez-neurriratutako ikusleiho-argazkia ikusteko.</translation>
+        <source> Serial Ports </source>
+        <translation type="obsolete"> Serie Atakak </translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Click to view scaled screenshot.</source>
-        <translation>Klikatu neurriratutako ikusleiho-argazkia ikusteko.</translation>
+        <source>#serialPorts</source>
+        <translation type="obsolete">#serialPorts</translation>
     </message>
-</context>
-<context>
-    <name>VBoxSnapshotDetailsDlg</name>
     <message>
-        <location line="-112"/>
-        <source>Details of %1 (%2)</source>
-        <translation>Xehetasunak %1 (%2)</translation>
+        <source>Enable &VT-x/AMD-V</source>
+        <translation type="obsolete">&VT-x/AMD-V gaitu</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Click to enlarge the screenshot.</source>
-        <translation>Klikatu ikusleiho-argazkia handitzeko.</translation>
+        <source>Alt+V</source>
+        <translation type="obsolete">Alt+V</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.ui" line="+32"/>
-        <source>&Name:</source>
-        <translation>&Izena:</translation>
+        <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V. The grayed checkbox state means that this setting is determined by the value of the global setting.</source>
+        <translation type="obsolete">Markaturik dagoenean makina birtuala VT-X eta AMD-X bezalako ostalariaren CPU-aren birtualizazio hedapenak erabiltzen saiatuko da. Aukera kutxa grisean badago ezarpena hau ezarpen orokorrek ezartzen dute.</translation>
     </message>
     <message>
-        <location line="+39"/>
-        <source>Taken:</source>
-        <translation>Hartua:</translation>
+        <source>Other &Settings</source>
+        <translation type="obsolete">Beste &Ezarpenak</translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>&Description:</source>
-        <translation>&Azalpena:</translation>
+        <source>&Remember Media Mounted at Runtime</source>
+        <translation type="obsolete">&Gogoratu Exekutatzean Muntaturiko Euskarria</translation>
     </message>
     <message>
-        <location line="+29"/>
-        <source>D&etails:</source>
-        <translation>&Xehetasunak:</translation>
+        <source>Alt+R</source>
+        <translation type="obsolete">Alt+G</translation>
     </message>
-</context>
-<context>
-    <name>VBoxSnapshotsWgt</name>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.ui" line="+26"/>
-        <source>VBoxSnapshotsWgt</source>
-        <translation>VBoxArgazkiWgta</translation>
+        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
+        <translation type="obsolete">Markaturik badago, Muntaturiko CD/DVD edo diskete euskarrietan eginiko edozein aldaketa gorde egingo da, abiarazteen artean muntaturiko medioen konfigurazioa mantentzeko.</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="+158"/>
-        <source>Current State (changed)</source>
-        <comment>Current State (Modified)</comment>
-        <translation>Oraingo Egoera (aldatuta)</translation>
+        <source>O&ther</source>
+        <translation type="obsolete">Bes&telakoak</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Current State</source>
-        <comment>Current State (Unmodified)</comment>
-        <translation>Oraingo Egoera</translation>
+        <source>&Enable Passthrough</source>
+        <translation type="obsolete">&Gaitu Bideratzea</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>The current state differs from the state stored in the current snapshot</source>
-        <translation>Oraingo egoera oraingo berehalakoan biltegiratutako egoeraren ezberdina da</translation>
+        <source>Alt+E</source>
+        <translation type="obsolete">Alt+G</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>The current state is identical to the state stored in the current snapshot</source>
-        <translation>Oraingo egoera oraingo berehalakoan biltegiratutako egoeraren berdina da</translation>
+        <source>When checked, allows the guest to send ATAPI commands directly to the host drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</source>
+        <translation type="obsolete">Markaturik dagoenean, bezeroari ATAPI komandoak zuzenean ostalariaren gailura bidaltzeko aukera ematen du, honek ostalarira konektatutako CD/DVD idazleak MB bidez erabiltzea posible egiten du. Kontutan izan audio CD-ak MB barnetik grabatzea ez dela onartzen oraindik.</translation>
     </message>
     <message>
-        <location line="+108"/>
-        <source> (current, </source>
-        <comment>Snapshot details</comment>
-        <translation> (orain, </translation>
+        <source>&Server Port </source>
+        <translation type="obsolete">&Zerbitzari Ataka </translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>online)</source>
-        <comment>Snapshot details</comment>
-        <translation>online)</translation>
+        <source>Authentication &Method </source>
+        <translation type="obsolete">Autentifikazio &Metodoa </translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>offline)</source>
-        <comment>Snapshot details</comment>
-        <translation>lineaz-kanpo)</translation>
+        <source>Authentication &Timeout </source>
+        <translation type="obsolete">Autentifikazio &Denbora-muga </translation>
     </message>
     <message>
-        <location line="+3"/>
-        <source>Taken at %1</source>
-        <comment>Snapshot (time)</comment>
-        <translation>Hartua %1</translation>
+        <source><qt>Holds the VRDP Server port number. You may specify <tt>0</tt> (zero) to reset the port to the default value.</qt></source>
+        <translation type="obsolete"><qt>VRDP zerbitzariaren ataka zenbakia erakusten du. <tt>0</tt> (zero) ezarri ezazu ataka lehenetsiriko baliora berrezartzeko</qt></translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Taken on %1</source>
-        <comment>Snapshot (date + time)</comment>
-        <translation>Hartua %1</translation>
+        <source>Primary Master hard disk is not selected</source>
+        <translation type="obsolete">Lehen Mailako disko gogor nagusia ez dago hautatua</translation>
     </message>
     <message>
-        <location line="+4"/>
-        <source>%1 since %2</source>
-        <comment>Current State (time or date + time)</comment>
-        <translation>%1 %2-tik</translation>
+        <source>Primary Slave hard disk is not selected</source>
+        <translation type="obsolete">Lehen Mailako disko gogor morroia ez dago hautatua</translation>
     </message>
     <message>
-        <location line="+574"/>
-        <source>Snapshot %1</source>
-        <translation>Berehalakoa %1</translation>
+        <source>Primary Slave hard disk is already attached to a different slot</source>
+        <translation type="obsolete">Lehen Mailako disko gogor morroia dagoeneko beste ataka batetan konektaturik dago</translation>
     </message>
     <message>
-        <location line="-389"/>
-        <source>Take &Snapshot</source>
-        <translation>Hartu &Berehalakoa</translation>
+        <source>Secondary Slave hard disk is not selected</source>
+        <translation type="obsolete">Bigarren Mailako disko gogor morroia ez dago hautatua</translation>
     </message>
     <message>
-        <location line="-1"/>
-        <source>S&how Details</source>
-        <translation>&Erakutsi Xehetasunak</translation>
+        <source>Secondary Slave hard disk is already attached to a different slot</source>
+        <translation type="obsolete">Bigarren Mailako disko gogor morroia dagoeneko beste ataka batetan konektaturik dago</translation>
     </message>
     <message>
-        <location line="+8"/>
-        <source>Take a snapshot of the current virtual machine state</source>
-        <translation>Hautu oraingo makina birtualaren egoera argazki bat</translation>
+        <source>CD/DVD image file is not selected</source>
+        <translation type="obsolete">CD/DVD irudi fitxategia ez dago hautatuta</translation>
     </message>
     <message>
-        <location line="-1"/>
-        <source>Show the details of the selected snapshot</source>
-        <translation>Erakutsi hautaturiko berehalakoaren xehetasunak</translation>
+        <source>Floppy image file is not selected</source>
+        <translation type="obsolete">Diskete irudi fitxategia ez dago hautatuta</translation>
     </message>
     <message>
-        <location line="-264"/>
-        <source> (%1)</source>
-        <translation> (%1)</translation>
+        <source>Incorrect host network interface is selected</source>
+        <translation type="obsolete">Ostalari sare interfaze okerra hautatu da</translation>
     </message>
     <message>
-        <location line="+255"/>
-        <source>&Restore Snapshot</source>
-        <translation>&Leheneratu Berehalakoa</translation>
+        <source>Duplicate port number selected </source>
+        <translation type="obsolete">Bikoizturiko ataka zenbakia hautatu da </translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>&Delete Snapshot</source>
-        <translation>E&zabatu Berehalakoa</translation>
+        <source>Duplicate port path entered </source>
+        <translation type="obsolete">Bikoizturiko ataka bidea idatzi da </translation>
     </message>
     <message>
-        <location line="+6"/>
-        <source>Restore the selected snapshot of the virtual machine</source>
-        <translation>Leheneratu hautaturiko makina birtualaren berehalakoa</translation>
+        <source>%1 on the <b>%2</b> page.</source>
+        <translation type="obsolete">%1 <b>%2</b> orrialdean.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Delete the selected snapshot of the virtual machine</source>
-        <translation>Ezabatu hautaturiko makina birtualaren berehalakoa</translation>
+        <source>Port %1</source>
+        <comment>serial ports</comment>
+        <translation type="obsolete">%1 Ataka</translation>
     </message>
     <message>
-        <location line="-258"/>
-        <location line="+5"/>
-        <location line="+5"/>
-        <location line="+5"/>
-        <source> (%1 ago)</source>
-        <translation> (duela %1)</translation>
+        <source>00</source>
+        <translation type="obsolete">00</translation>
     </message>
     <message>
-        <location line="+239"/>
-        <source>&Clone...</source>
-        <translation>&Klonatu...</translation>
+        <source>01</source>
+        <translation type="obsolete">01</translation>
     </message>
     <message>
-        <location line="+7"/>
-        <source>Clone the selected virtual machine</source>
-        <translation>Klonatu hautaturiko makina birtuala</translation>
+        <source>02</source>
+        <translation type="obsolete">02</translation>
     </message>
-</context>
-<context>
-    <name>VBoxTakeSnapshotDlg</name>
     <message>
-        <location filename="../src/VBoxTakeSnapshotDlg.ui" line="+26"/>
-        <source>Take Snapshot of Virtual Machine</source>
-        <translation>Hartu Makina Birtualaren Argazki bat</translation>
+        <source>03</source>
+        <translation type="obsolete">03</translation>
     </message>
     <message>
-        <location line="+38"/>
-        <source>Snapshot &Name</source>
-        <translation>Berehalako &Izena</translation>
+        <source>04</source>
+        <translation type="obsolete">04</translation>
     </message>
     <message>
-        <location line="+20"/>
-        <source>Snapshot &Description</source>
-        <translation>Argazki &Azalpena</translation>
+        <source>05</source>
+        <translation type="obsolete">05</translation>
     </message>
-    <message numerus="yes">
-        <location filename="../src/VBoxTakeSnapshotDlg.cpp" line="+73"/>
-        <source>Warning: You are taking a snapshot of a running machine which has %n immutable image(s) attached to it. As long as you are working from this snapshot the immutable image(s) will not be reset to avoid loss of data.</source>
-        <translation type="unfinished">
-            <numerusform></numerusform>
-            <numerusform></numerusform>
-        </translation>
+    <message>
+        <source>08</source>
+        <translation type="obsolete">08</translation>
     </message>
-</context>
-<context>
-    <name>VBoxUSBMenu</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="-702"/>
-        <source><no devices available></source>
-        <comment>USB devices</comment>
-        <translation><ez dago gailurik eskuragarri></translation>
+        <source>10</source>
+        <translation type="obsolete">10</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>No supported devices connected to the host PC</source>
-        <comment>USB device tooltip</comment>
-        <translation>Ez dago sostengaturiko gailurik hostalari PG-ra elkarketaturik</translation>
+        <source>09</source>
+        <translation type="obsolete">09</translation>
     </message>
-</context>
-<context>
-    <name>VBoxVMInformationDlg</name>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="-358"/>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Saio Argibideak</translation>
+        <source>06</source>
+        <translation type="obsolete">06</translation>
     </message>
     <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Xehetasunak</translation>
+        <source>07</source>
+        <translation type="obsolete">07</translation>
     </message>
     <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Runtime</translation>
+        <source>General</source>
+        <translation type="obsolete">Orokorra</translation>
     </message>
     <message>
-        <location line="+23"/>
-        <location line="+37"/>
-        <source>DMA Transfers</source>
-        <translation>DMA Eskualdaketak</translation>
+        <source>Hard Disks</source>
+        <translation type="obsolete">Disko Gogorrak</translation>
     </message>
     <message>
-        <location line="-35"/>
-        <source>PIO Transfers</source>
-        <translation>PIO Eskualdaketak</translation>
+        <source>CD/DVD</source>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <location line="+35"/>
-        <location line="+27"/>
-        <source>Data Read</source>
-        <translation>Datu Irakurrita</translation>
+        <source>Floppy</source>
+        <translation type="obsolete">Disketea</translation>
     </message>
     <message>
-        <location line="-60"/>
-        <location line="+35"/>
-        <location line="+27"/>
-        <source>Data Written</source>
-        <translation>Datu Idatzita</translation>
+        <source>Audio</source>
+        <translation type="obsolete">Audioa</translation>
     </message>
     <message>
-        <location line="+45"/>
-        <source>Data Transmitted</source>
-        <translation>Datu Igorrita</translation>
+        <source>Network</source>
+        <translation type="obsolete">Sarea</translation>
     </message>
     <message>
-        <location line="+2"/>
-        <source>Data Received</source>
-        <translation>Datu Jasota</translation>
+        <source>Serial Ports</source>
+        <translation type="obsolete">Serie Atakak</translation>
     </message>
     <message>
-        <location line="+211"/>
-        <source>Runtime Attributes</source>
-        <translation>Runtime Ezaugarriak</translation>
+        <source>USB</source>
+        <translation type="obsolete">USB</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Screen Resolution</source>
-        <translation>Ikusleiho Bereizmena</translation>
+        <source>Shared Folders</source>
+        <translation type="obsolete">Partekatutako Karpetak</translation>
     </message>
     <message>
-        <location line="-27"/>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Ez da Atzeman</translation>
+        <source>Remote Display</source>
+        <translation type="obsolete">Huruneko Pantaila</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMSettingsFD</name>
     <message>
-        <location line="+9"/>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Ez da Atzeman</translation>
+        <source>Floppy image file is not selected</source>
+        <translation type="obsolete">Diskete irudi fitxategia ez dago hautatuta</translation>
     </message>
     <message>
-        <location line="+24"/>
-        <source>Guest Additions</source>
-        <translation>Gonbidatu Gehigarriak</translation>
+        <source>When checked, mounts the specified media to the Floppy drive of the virtual machine.</source>
+        <translation type="obsolete">Markaturik dagoenean, ezarritako euskarria makina birtualeko diskete gailuan muntatzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Guest OS Type</source>
-        <translation>Gonbidatu SE Mota</translation>
+        <source>&Mount Floppy Drive</source>
+        <translation type="obsolete">&Muntatu Diskete Gailua</translation>
     </message>
     <message>
-        <location line="+108"/>
-        <source>No Network Adapters</source>
-        <translation>Ez dago Sare Egokitzailerik</translation>
+        <source>Mounts the specified host Floppy drive to the virtual Floppy drive.</source>
+        <translation type="obsolete">Hautatutako ostalari diekete gailua muntatu Diskete gailu birtualean.</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.ui" line="+26"/>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBox-MB-Argibide-Elkarrizketa</translation>
+        <source>Host Floppy &Drive</source>
+        <translation type="obsolete">Ostalari Diskete &Gailua</translation>
     </message>
     <message>
-        <location line="+11"/>
-        <source>Configuration &Details</source>
-        <translation>Itxurapen &Xehetasunak</translation>
+        <source>Lists host Floppy drives available to insert to the virtual machine.</source>
+        <translation type="obsolete">Makina birtualean muntatzeko erabilgarri dauden ostalariaren diskete gailuak zerrendatzen ditu.</translation>
     </message>
     <message>
-        <location line="+35"/>
-        <source>&Runtime Information</source>
-        <translation>&Runtime Argibideak</translation>
+        <source>Mounts the specified Floppy image to the virtual Floppy drive.</source>
+        <translation type="obsolete">Muntatu hautatutako diskete irudia diskete gailu birtualean.</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="-99"/>
-        <source>Storage Statistics</source>
-        <translation>Biltegi Estatistikak</translation>
+        <source>Holds the image file to mount to the virtual Floppy drive and allows to quickly select a different image.</source>
+        <translation type="obsolete">Diskete gailu birtualean muntatu behar den irudi fitxategia erakusten du eta beste irudi bat bizkor hautatzeko aukera ematen du.</translation>
     </message>
     <message>
-        <location line="+72"/>
-        <source>No Storage Devices</source>
-        <translation>Ez dago Biltegi Gailurik</translation>
+        <source>Invokes the Virtual Disk Manager to select a Floppy image to mount.</source>
+        <translation type="obsolete">Disko Birtual Kudeatzailea deitzen du muntatzeko Diskete irudi bat hautatzeko.</translation>
     </message>
+</context>
+<context>
+    <name>VBoxVMSettingsVRDP</name>
     <message>
-        <location line="+11"/>
-        <source>Network Statistics</source>
-        <translation>Sare Estatistikak</translation>
+        <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source>
+        <translation type="obsolete">Markaturik dagoenean, makina birtuala Urruneko Idazmahai Protokolo (RDP) zerbitzari birtuala gaituko du, bezeroei makina birtualera (martxan dagoenean) RDP bezero estandar bat erabiliaz konektatzeko aukera emanez.</translation>
     </message>
     <message>
-        <location line="-111"/>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Ez dago Eskuragarri</translation>
+        <source>&Enable VRDP Server</source>
+        <translation type="obsolete">&Gaitu VRDP Zerbitzaria</translation>
     </message>
     <message>
-        <location line="+13"/>
-        <source>Clipboard Mode</source>
-        <translation>Gako Modua</translation>
+        <source>Defines the VRDP authentication method.</source>
+        <translation type="obsolete">VRDP autentifikazio metodoa ezartzen du.</translation>
     </message>
     <message>
-        <location line="+1"/>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Arrastatu-eta-Askatu Modua</translation>
+        <source>Specifies the timeout for guest authentication, in milliseconds.</source>
+        <translation type="obsolete">Bezero autentifikazioen denbora-muga ezartzen du, milisegundotan.</translation>
     </message>
 </context>
 </TS>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fa_IR.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fa_IR.ts
index 447ca23..6adbc52 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fa_IR.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fa_IR.ts
@@ -197,31 +197,31 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>غیرفعال سازی یکپارچگ&ی ماوس</translation>
+        <translation type="obsolete">غیرفعال سازی یکپارچگ&ی ماوس</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>غیرفعالسازی موقت یکپارچگی نشانگر ماوس میزبان</translation>
+        <translation type="obsolete">غیرفعالسازی موقت یکپارچگی نشانگر ماوس میزبان</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&فشاردادن Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&فشاردادن Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>ارسال توالی Ctrl-Alt-Del به ماشین مجازی</translation>
+        <translation type="obsolete">ارسال توالی Ctrl-Alt-Del به ماشین مجازی</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>ارسال توالی Ctrl-Alt-Backspace به ماشین مجازی</translation>
+        <translation type="obsolete">ارسال توالی Ctrl-Alt-Backspace به ماشین مجازی</translation>
     </message>
     <message>
         <source>Take a snapshot of the virtual machine</source>
         <translation>ایجاد یک ضبط وضعیت ماشین مجازی</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>نمایش پنجره اطلاعات جلسه</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">نمایش پنجره اطلاعات جلسه</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -265,15 +265,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&دستگاه سی دی/دی وی دی</translation>
+        <translation type="obsolete">&دستگاه سی دی/دی وی دی</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>دست&گاه فلاپی</translation>
+        <translation type="obsolete">دست&گاه فلاپی</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>دستگاه یو& اِس بی</translation>
+        <translation type="obsolete">دستگاه یو& اِس بی</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -292,12 +292,12 @@
         <translation>ایجاد یا ویرایش پوشه های اشتراکی</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>نصب افزون&ه مهمان...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">نصب افزون&ه مهمان...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>بارگیری ایمیج نصب افزونه مهمان</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">بارگیری ایمیج نصب افزونه مهمان</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -340,15 +340,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>رفتن به حالت تما&م صفحه</translation>
+        <translation type="obsolete">رفتن به حالت تما&م صفحه</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>تعویض بین حالت معمولی و تمام صفحه</translation>
+        <translation type="obsolete">تعویض بین حالت معمولی و تمام صفحه</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>رفتن &به حالت یکپارچه</translation>
+        <translation type="obsolete">رفتن &به حالت یکپارچه</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -356,7 +356,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>رفتن به &حالت مقیاس</translation>
+        <translation type="obsolete">رفتن به &حالت مقیاس</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -432,7 +432,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>&قراردادن Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">&قراردادن Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>&File</source>
@@ -699,74 +699,297 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>کشیدن 'و' رهاکردن</translation>
+        <translation type="obsolete">کشیدن 'و' رهاکردن</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>ذخیره وضعیت ماشین ِ،ماشین مجازی</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>قطع برق ماشین مجازی</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>&تنظیمات شبکه...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation>تنظیمات پوشه های &اشتراکی...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>&نمایش ریموت</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>ضامن ارتباطات ریموت دسکتاپ (RDP) به این ماشین</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>&ضبط ویدئو</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation>ضامن ضبط ویدیو</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation>&تنظیمات ضبط ویدئو...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>پیکربندی تنظیمات ضبط ویدئو</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Logging...</source>
-        <comment>debug action</comment>
-        <translation>&وقایع نگاری...</translation>
+        <source>Popup Menu</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Popup Menu</source>
-        <translation>منوی پرشی</translation>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">نصب افزون&ه مهمان...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">بارگیری ایمیج نصب افزونه مهمان</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>&وب کم ها</translation>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
-        <translation>شبکه</translation>
+        <translation type="unfinished">شبکه</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">نمایش و&قایع...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&فایل</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
 </context>
 <context>
@@ -1210,6 +1433,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1220,7 +1450,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>رهاکردن داده ...</translation>
+        <translation type="obsolete">رهاکردن داده ...</translation>
     </message>
 </context>
 <context>
@@ -1268,6 +1498,31 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIGChooserItemGroup</name>
     <message>
         <source><b>%1</b></source>
@@ -1399,7 +1654,7 @@
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[سی دی/دی وی دی]</translation>
+        <translation type="obsolete">[سی دی/دی وی دی]</translation>
     </message>
     <message>
         <source>Controller</source>
@@ -1564,69 +1819,169 @@
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation>فیل ضبط ویدیو</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation>صفات ضبط ویدیو</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation>ضبط ویدیو</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation>غیرفعال شده</translation>
+        <translation type="unfinished">غیرفعال شده</translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>شبکه NAT، '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>اندازه فریم: %1x%2, نرخ فریم: %3فریم بر ثانیه, نرخ بیت: %4کیلوبایت بر ثانیه</translation>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGMachinePreview</name>
     <message>
-        <source>Every 0.5 s</source>
-        <translation>هر 0.5 ثانیه</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Every 1 s</source>
-        <translation>هر 1 ثانیه</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Every 2 s</source>
-        <translation>هر 2 ثانیه</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Every 5 s</source>
-        <translation>هر 5 ثانیه</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Every 10 s</source>
-        <translation>هر 10 ثانیه</translation>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">کنترلر یو اِس بی</translation>
     </message>
     <message>
-        <source>Update disabled</source>
-        <translation>بروزرسانی غیرفعال شده</translation>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">فعال شده</translation>
     </message>
     <message>
-        <source>No preview</source>
-        <translation>پیشنمایش ندارد</translation>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsDisplay</name>
     <message>
-        <source>Maximum Guest Screen &Size:</source>
-        <translation>حداکثر اندازه &صفحه مهمان:</translation>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished">غیرفعال شده</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">فعال شده</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">فعال شده</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">غیرفعال شده</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">فعال شده</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">غیرفعال شده</translation>
+    </message>
+</context>
+<context>
+    <name>UIGMachinePreview</name>
+    <message>
+        <source>Every 0.5 s</source>
+        <translation>هر 0.5 ثانیه</translation>
+    </message>
+    <message>
+        <source>Every 1 s</source>
+        <translation>هر 1 ثانیه</translation>
+    </message>
+    <message>
+        <source>Every 2 s</source>
+        <translation>هر 2 ثانیه</translation>
+    </message>
+    <message>
+        <source>Every 5 s</source>
+        <translation>هر 5 ثانیه</translation>
+    </message>
+    <message>
+        <source>Every 10 s</source>
+        <translation>هر 10 ثانیه</translation>
+    </message>
+    <message>
+        <source>Update disabled</source>
+        <translation>بروزرسانی غیرفعال شده</translation>
+    </message>
+    <message>
+        <source>No preview</source>
+        <translation>پیشنمایش ندارد</translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsDisplay</name>
+    <message>
+        <source>Maximum Guest Screen &Size:</source>
+        <translation>حداکثر اندازه &صفحه مهمان:</translation>
     </message>
     <message>
         <source>&Width:</source>
@@ -1728,7 +2083,7 @@
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation>&بسته افزونه</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -1770,28 +2125,16 @@
         <translation type="obsolete">غیر&فعالسازی محافظ صفحه نمایش میزبان</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>&داک و نوار منو:</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>نمایش خودکار در تمام صفحه</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>وقتیکه انتخاب شده،داک میزبان و نوار منو وقتیکه ماشین در حالت تمام صفحه است نشان داده خواهد شد.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>محافظ صفحه نمایش میزبان&:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>وقتیکه انتخاب شده،محافظ صفحه نمایش میزبان هرگاه ماشین مجازی در اجرا هست غیرفعال خواهد شد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>زمانیکه در حال اجرای ماشین های مجازی هست غیرفعال کن</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -1822,27 +2165,27 @@
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>کلید ترکیبی میزبان</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>به برخی از موارد همین کلید های میانبر اختصاص یافته است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation>مدیر &ویرچوال باکس</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>&ماشین مجازی</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>لیست همه میانبرهای موجود که میتواند پیکربندی شود.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>یک دنباله برای فیلتر لیست میانبر وارد کنید</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -1901,7 +2244,7 @@
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>&رابط زبان</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -1932,7 +2275,7 @@
     </message>
     <message>
         <source>DHCP upper address bound of <b>%1</b> is wrong</source>
-        <translation type="obsolete">محدوده آدرس بالاتر DHCP <b>%1</b> اشتباه است</translation>
+        <translation type="obsolete">محدوده آدرس بالاتر تر DHCP <b>%1</b> اشتباه است</translation>
     </message>
     <message>
         <source>Adapter</source>
@@ -2044,128 +2387,128 @@
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation>&شبکه های NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation>لیست تمام شبکه های NAT .</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translation>شبکه های& فقط-میزبان</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>هیچ نام جدیدی برای شبکه NAT که قبلا <b>%1</b> نامیده می شد تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation>هیچ CIDR برای شبکه NAT  <b>%1</b> تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>هیچ CIDR برای شبکه NAT که قبلا <b>%1</b> نامیده میشد تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation>مقدار CIDR نامعتبر (<i>%1</i>) برای شبکه the <b>%2</b> تعیین شده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation>مقدار CIDR نامعتبر (<i>%1</i>) برای شبکه NAT که قبلا <b>%2</b> نامیده می شد تعیین شده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translation>نام شبکه</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation>[خالی]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (تغییرنام داد به %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation>نام قدیمی شبکه</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation>نام جدید شبکه</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation>شبکه CIDR</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation>پشتیبانی از DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>yes</source>
-        <translation>بله</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>no</source>
-        <translation>خیر</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation>پشتیبانی از IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation>مسیر پیش فرض IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation>رابط میزبان <b>%1</b> اکنون آدرس IPv4 معتبر ندارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation>رابط میزبان <b>%1</b> اکنون مسک شبکه IPv4 معتبر ندارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation>رابط میزبان <b>%1</b> اکنون آدرس IPv6 معتبر ندارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation>رابط میزبان <b>%1</b> اکنون آدرس سرور DHCP معتبر ندارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>رابط میزبان <b>%1</b> اکنون سرور ماسک DHCP معتبر ندارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>رابط میزبان <b>%1</b> محدوده آدرس سرور پایین تر DHCP معتبر ندارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>رابط میزبان <b>%1</b> محدوده آدرس بالاتر سرور DHCP معتبر ندارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>نام <b>%1</b> درحال استفاده برای چندین شبکه NAT میباشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>فعال</translation>
+        <translation type="unfinished">فعال</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>&افزودن شبکه NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation>&حذف شبکه NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation>&ویرایش شبکه NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2267,177 +2610,177 @@
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation>جزئیات شبکه فقط-میزبان</translation>
+        <translation type="unfinished">جزئیات شبکه فقط-میزبان</translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation>&آداپتور</translation>
+        <translation type="unfinished">&آداپتور</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation>پیکربندی &دستی</translation>
+        <translation type="unfinished">پیکربندی &دستی</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>استفاده از پیکربندی دستی برای این آداپتور شبکه فقط-میزبان.</translation>
+        <translation type="unfinished">استفاده از پیکربندی دستی برای این آداپتور شبکه فقط-میزبان.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation>آد&رس IPv4:</translation>
+        <translation type="unfinished">آد&رس IPv4:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>آدرس میزبان IPv4 برای این آداپتور نشان میدهد.</translation>
+        <translation type="unfinished">آدرس میزبان IPv4 برای این آداپتور نشان میدهد.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation>ماسک ش&بکه IPv4:</translation>
+        <translation type="unfinished">ماسک ش&بکه IPv4:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>ماسک شبکه میزبان IPv4 برای این آداپتور نشان میدهد.</translation>
+        <translation type="unfinished">ماسک شبکه میزبان IPv4 برای این آداپتور نشان میدهد.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation>آدرس I&Pv6:</translation>
+        <translation type="unfinished">آدرس I&Pv6:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>آدرس میزبان IPv6 برای این آداپتور اگر IPv6 پشتیبانی شده باشد را نشان میدهد.</translation>
+        <translation type="unfinished">آدرس میزبان IPv6 برای این آداپتور اگر IPv6 پشتیبانی شده باشد را نشان میدهد.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation>طول ماسک ش&بکه IPv6:</translation>
+        <translation type="unfinished">طول ماسک ش&بکه IPv6:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>طول پیشوند ماسک شبکه میزبان IPv6 برای این آداپتور اگر  IPv6 پشتیبانی شده باشد را نشان میدهد.</translation>
+        <translation type="unfinished">طول پیشوند ماسک شبکه میزبان IPv6 برای این آداپتور اگر  IPv6 پشتیبانی شده باشد را نشان میدهد.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation>سر&ور DHCP</translation>
+        <translation type="unfinished">سر&ور DHCP</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>فعالسازی &سرور</translation>
+        <translation type="unfinished">فعالسازی &سرور</translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation>هرگاه سرور دی اِچ سی پی در اِستارت آپ ماشین فعال شده باشد یا نه،را نشان میدهد.</translation>
+        <translation type="unfinished">هرگاه سرور دی اِچ سی پی در اِستارت آپ ماشین فعال شده باشد یا نه،را نشان میدهد.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation>آدرس سرور&:</translation>
+        <translation type="unfinished">آدرس سرور&:</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>آدرس سرور دی اِچ سی پی خدماتی شبکه وابسته سازی شده با آداپتور فقط-میزبان را نشان میدهد.</translation>
+        <translation type="unfinished">آدرس سرور دی اِچ سی پی خدماتی شبکه وابسته سازی شده با آداپتور فقط-میزبان را نشان میدهد.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation>ماسک &سرور:</translation>
+        <translation type="unfinished">ماسک &سرور:</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>ماسک شبکه سرور دی اِچ سی پی خدماتی شبکه وابسته سازی شده با این اداپتور فقط-میزبان را نشان میدهد.</translation>
+        <translation type="unfinished">ماسک شبکه سرور دی اِچ سی پی خدماتی شبکه وابسته سازی شده با این اداپتور فقط-میزبان را نشان میدهد.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation>محدوده آدر&س پایین تر:</translation>
+        <translation type="unfinished">محدوده آدر&س پایین تر:</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>محدوده آدرس پایین تر ارائه شده توسط سرور دی اِچ سی پی خدماتی شبکه وابسته سازی شده با این آداپتور فقط-میزبان را نشان میدهد.</translation>
+        <translation type="unfinished">محدوده آدرس پایین تر ارائه شده توسط سرور دی اِچ سی پی خدماتی شبکه وابسته سازی شده با این آداپتور فقط-میزبان را نشان میدهد.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation>محدوده آ&درس بالاتر:</translation>
+        <translation type="unfinished">محدوده آ&درس بالاتر:</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>محدوده آدرس پایین تر ارائه شده توسط سرور دی اِچ سی پی خدماتی شبکه وابسته سازی شده با این اداپتور فقط-میزبان را نشان میدهد.</translation>
+        <translation type="unfinished">محدوده آدرس پایین تر ارائه شده توسط سرور دی اِچ سی پی خدماتی شبکه وابسته سازی شده با این اداپتور فقط-میزبان را نشان میدهد.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation>جزئیات شبکه NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation>&فعالسازی شبکه</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation>فعالسازی این شبکه NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation>نام &شبکه:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>نام این شبکه را نگه می دارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation>شبکه &CIDR:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>CIDR  رابرای این شبکه نگه می دارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation>گزینه های شبکه:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation>پشتیبانی از &DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation>تعیین اینکه آیا این شبکه از DHCP پشتیبانی میکند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation>پشتیبانی از &IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>تعیین اینکه آیا این شبکه از IPv6 پشتیبانی میکند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>اعلان مسیر پیش فرض IPv6&</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation>تعیین اینکه آیا شبکه باید مسیر پیش فرض IPv6 را اعلان کند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>پنجره را برای مدیریت دستورات اِرسال پورت باز میکند.</translation>
+        <translation type="unfinished">پنجره را برای مدیریت دستورات اِرسال پورت باز میکند.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation>اِرسا&ل پورت</translation>
+        <translation type="unfinished">اِرسا&ل پورت</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>دستورات اِرسال پورت</translation>
+        <translation type="unfinished">دستورات اِرسال پورت</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation>IPv4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation>IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2492,11 +2835,11 @@
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>میزبان پراکسی اکنون تایین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>پورت پراکسی اکنون تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2561,71 +2904,71 @@
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation><key_%1></translation>
+        <translation type="unfinished"><key_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation>Left </translation>
+        <translation type="unfinished">Left </translation>
     </message>
     <message>
         <source>Right </source>
-        <translation>Right </translation>
+        <translation type="unfinished">Right </translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation>Left Shift</translation>
+        <translation type="unfinished">Left Shift</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation>Right Shift</translation>
+        <translation type="unfinished">Right Shift</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation>Left Ctrl</translation>
+        <translation type="unfinished">Left Ctrl</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation>Right Ctrl</translation>
+        <translation type="unfinished">Right Ctrl</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation>Left Alt</translation>
+        <translation type="unfinished">Left Alt</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation>Right Alt</translation>
+        <translation type="unfinished">Right Alt</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation>Left WinKey</translation>
+        <translation type="unfinished">Left WinKey</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation>Right WinKey</translation>
+        <translation type="unfinished">Right WinKey</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation>Menu key</translation>
+        <translation type="unfinished">Menu key</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation>Alt Gr</translation>
+        <translation type="unfinished">Alt Gr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>Caps Lock</translation>
+        <translation type="unfinished">Caps Lock</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation>Scroll Lock</translation>
+        <translation type="unfinished">Scroll Lock</translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation>Host+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
-        <translation>None</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2696,22 +3039,22 @@
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation>ریست میانبر به پیش فرض</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation>عدمتعیین میانبر</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation>نام</translation>
+        <translation type="unfinished">نام</translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translation>میانبر</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2759,12 +3102,12 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>فعالیت های دستگاه سی دی/دی وی دی را نشان میدهد:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>فعالیت های دستگاه سی دی/دی وی دی را نشان میدهد:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>فعالیت دستگاه فلاپی را نشان میدهد:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>فعالیت دستگاه فلاپی را نشان میدهد:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -2804,7 +3147,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>کنترلر یو اِس بی غیرفعال شده است</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>کنترلر یو اِس بی غیرفعال شده است</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -2844,20 +3187,34 @@
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>فعالیت ضبط ویدیو را نشان میدهد:</nobr><br>%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>ضبط ویدئو غیرفعال شده است</b></nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>فایل ضبط ویدیو:</b> %1</nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation>وضعیت سایر ویژگی ها:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2907,19 +3264,19 @@
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>وب کمی متصل نشده است</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>وب کم پشتیبانی شده ای به رایانه میزبان متصل نشده است</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation>اتصال به آداپتور شبکه</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation>اتصال به آداپتور شبکه %1</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2961,7 +3318,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>وید&یو</translation>
+        <translation type="obsolete">وید&یو</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -3069,221 +3426,381 @@
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>&ضبط ویدئو</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>وقتیکه انتخاب شده،ویرچوال باکس،جلسه یا وضعیت ماشین مجازی را در فایل ویدیویی ضبط خواهد کرد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation>فعالسازی &ضبط ویدیو</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>&مسیر فایل:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>این گزینه نام فایلی را که ویرچوال باکس برای محتوای ضبط شده استفاده میکند را تعیین میکند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>اندازه &فریم:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>این تنظیم نسبت دید (اندازه فریم) ویدیو ضبط شده را تعیین میکند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>این تنظیم نسبت دید <b>اُفقی</b> (عرض فریم) ویدیو ضبط شده را تعیین میکند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>این تنظیم نسبت دید <b>عمودی</b> (ارتفاع فریم) ویدیو ضبط شده را تعیین میکند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>&نرخ فریم:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>این تنظیم حداکثر تعداد<b>فریم بر ثانیه</b> تعیین میکند. فریم های اضافی رد خواهد شد. کاهش این مقدار باعث افزایش تعداد فریم های رد شده میشود درنهایت حجم فایل کم میشود.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation>&کیفیت:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>این تنظیم <b>کیفیت</b> را تعیین میکند. افزایش این مقدار کیفیت ویدیو را بیشتر میکند اما حجم فایل نیز بیشتر میشود.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>این تنظیم نرخ بیت را در <b>کیلوبیت بر ثانیه</b> تعیین میکند. افزایش این مقدار کیفیت ویدیو را بیشتر میکند اما حجم فایل نیز بیشتر میشود.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation>&نمایشگرها:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>ماشین مجازی طوری راه اندازی شده که از سخت افزار شتاب دهنده گرافیکی استفاده کند. هرچند سیستم میزبان اکنون این را ارائه نمیکند، بنابراین شما قادر به اجرای ماشین مجازی نیستید.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>اکنون ماشین مجازی کمتر از <b>%1</b> حافظه ویدیویی اختصاص داده است.که آن کمترین مقدار موردنیاز برای رفتن به حالت تمام صفحه یا حالت یکپارچه هست.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>اکنون ماشین مجازی کمتر از <b>%1</b> حافظه ویدیویی اختصاص داده است.که آن کمترین مقدار موردنیاز برای ویدیو کیفیت بالا با پخش موثر است.</translation>
-    </message>
-    <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>ماشین مجازی طوری راه اندازی شده که از سخت افزار شتاب دهنده گرافیکی استفاده کند و سیستم عامل اشارع دارد که آن به ویندوز ویستا به بعد تنظیم شده است. برای بهترین کارایی باید حافظه ویدیویی ماشین را حداقل به b>%1</b> تنظیم کنید.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>ماشین مجازی طوری راه اندازی شده که از جریان ویدیو شتاب دهنده استفاده کند. از آنجا که این ویژگی فقط با ویندوز سیستم مهمان کار میکند،آن غیر فعال خواهد شد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>مقدار پورت سرور VRDE اکنون تعیین شده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>مقدار مدت زمان تایید اعتبار VRDE اکنون تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation>تعریف شده توسط کاربر</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation>%1 فریم بر ثانیه</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>fps</source>
-        <translation>فریم بر ثانیه</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation>کم</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation>متوسط</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation>بالا</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation>کیلوبیت بر ثانیه</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation>صفحه نمایش %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation>ضبط ویدیو برای صفحه نمایش %1 فعال شود.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation>نمایش ریموت اکنون برای این ماشین مجازی فعال شده است. هرچند، نیاز دارد که <b>%1</b> نصب شود. لطفا بسته افزونه را از سایت ویرچوال باکس دانلود نمایید،درغیر اینصورت ماشین مجازی با نمایش ریموت غیرفعال شده اِجرا خواهد شد</translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">نوارابزار کوچک:</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>مسیری که ضبط وضعیت ماشین مجازی در آن ذخیره شده را نشان میدهد.آگاه باشید که ضبط وضعیت فضای دیسک بسیاری استفاده می کند.</translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">اگر انتخاب شده،نوار ابزار کوچک را در حالت تمام صفحه یا یکپارچه نشان میدهد.</translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>&پایه ای</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">نمایش &در تمام صفحه/یکپارچه</translation>
     </message>
     <message>
-        <source>&Advanced</source>
-        <translation>پی&شرفته</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">اگر انتخاب شده، نوارابزار کوچک را در بالای صفحه نشان میدهد،بجای موقعیت پیش فرض آن در پایین صفحه.</translation>
     </message>
     <message>
-        <source>&Shared Clipboard:</source>
-        <translation>کلیپ برد& اشتراکی:</translation>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">نمایش در &بالای صفحه</translation>
     </message>
     <message>
-        <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>انتخاب اینکه کدام داده کلیپ برد بین مهمان و سیستم عامل میزبان کپی خواهد شد.این ویژگی نیازدارد که افزونه مهمان در سیستم عامل مهمان نصب شده باشد.</translation>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>S&napshot Folder:</source>
-        <translation>پوشه& ضبط وضعیت:</translation>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Description</source>
-        <translation>تو&ضیحات</translation>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
-        <translation>توضیحات ماشین مجازی را نشان میدهد.فیلد توضیحات برای نوشتن توضیح در جزئیات پیکربندی سیستم عامل مهمان نصب شده سودمند است.</translation>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>وقتیکه انتخاب شده،هرگونه تغییر اجرا شده در سی دی/دی وی دی بارگیری شده یا رسانه فلاپی حین اِجرای ماشین در فایل تنظیمات بمنظور حفظ پیکربندی رسانه بارگیری شده بین اِجراها ذخیره خواهد شد.</translation>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Removable Media:</source>
-        <translation>رسانه قابل حمل:</translation>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Remember Runtime Changes</source>
-        <translation>&حفظ تغییرات زمان اِجرا</translation>
+        <source>100%</source>
+        <translation type="unfinished">سه بعدی {100%?}</translation>
     </message>
     <message>
-        <source>Mini ToolBar:</source>
-        <translation>نوارابزار کوچک:</translation>
+        <source>200%</source>
+        <translation type="unfinished">سه بعدی {200%?}</translation>
     </message>
     <message>
-        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>اگر انتخاب شده،نوار ابزار کوچک را در حالت تمام صفحه یا یکپارچه نشان میدهد.</translation>
+        <source>%</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show in &Fullscreen/Seamless</source>
-        <translation>نمایش &در تمام صفحه/یکپارچه</translation>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>اگر انتخاب شده، نوارابزار کوچک را در بالای صفحه نشان میدهد،بجای موقعیت پیش فرض آن در پایین صفحه.</translation>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show at &Top of Screen</source>
-        <translation>نمایش در &بالای صفحه</translation>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
-        <translation type="obsolete">شما سیستم عامل 64 بیتی مهمان برای این ماشین مجازی انتخاب کرده اید. همینطور مهمان به سخت افزار مجازی سازی نیاز دارد (VT-x/AMD-V)، این ویزگی خودکار فعال خواهد شد.</translation>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source>&Drag'n'Drop:</source>
-        <translation>&کشیدن 'و' رهاکردن:</translation>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation>مسیری که ضبط وضعیت ماشین مجازی در آن ذخیره شده را نشان میدهد.آگاه باشید که ضبط وضعیت فضای دیسک بسیاری استفاده می کند.</translation>
     </message>
     <message>
-        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>انتخاب اینکه کدام داده بین مهمان و سیستم عامل میزبان توسط کشیدن و رهاکردن کپی خواهد شد.این ویژگی نیازدارد که افزونه مهمان در سیستم عامل مهمان نصب شده باشد.</translation>
+        <source>Basi&c</source>
+        <translation>&پایه ای</translation>
+    </message>
+    <message>
+        <source>A&dvanced</source>
+        <translation>پی&شرفته</translation>
+    </message>
+    <message>
+        <source>&Shared Clipboard:</source>
+        <translation>کلیپ برد& اشتراکی:</translation>
+    </message>
+    <message>
+        <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <translation>انتخاب اینکه کدام داده کلیپ برد بین مهمان و سیستم عامل میزبان کپی خواهد شد.این ویژگی نیازدارد که افزونه مهمان در سیستم عامل مهمان نصب شده باشد.</translation>
+    </message>
+    <message>
+        <source>S&napshot Folder:</source>
+        <translation>پوشه& ضبط وضعیت:</translation>
+    </message>
+    <message>
+        <source>D&escription</source>
+        <translation>تو&ضیحات</translation>
+    </message>
+    <message>
+        <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
+        <translation>توضیحات ماشین مجازی را نشان میدهد.فیلد توضیحات برای نوشتن توضیح در جزئیات پیکربندی سیستم عامل مهمان نصب شده سودمند است.</translation>
+    </message>
+    <message>
+        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
+        <translation type="obsolete">وقتیکه انتخاب شده،هرگونه تغییر اجرا شده در سی دی/دی وی دی بارگیری شده یا رسانه فلاپی حین اِجرای ماشین در فایل تنظیمات بمنظور حفظ پیکربندی رسانه بارگیری شده بین اِجراها ذخیره خواهد شد.</translation>
+    </message>
+    <message>
+        <source>Removable Media:</source>
+        <translation type="obsolete">رسانه قابل حمل:</translation>
+    </message>
+    <message>
+        <source>&Remember Runtime Changes</source>
+        <translation type="obsolete">&حفظ تغییرات زمان اِجرا</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">نوارابزار کوچک:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">اگر انتخاب شده،نوار ابزار کوچک را در حالت تمام صفحه یا یکپارچه نشان میدهد.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">نمایش &در تمام صفحه/یکپارچه</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">اگر انتخاب شده، نوارابزار کوچک را در بالای صفحه نشان میدهد،بجای موقعیت پیش فرض آن در پایین صفحه.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">نمایش در &بالای صفحه</translation>
+    </message>
+    <message>
+        <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
+        <translation type="obsolete">شما سیستم عامل 64 بیتی مهمان برای این ماشین مجازی انتخاب کرده اید. همینطور مهمان به سخت افزار مجازی سازی نیاز دارد (VT-x/AMD-V)، این ویزگی خودکار فعال خواهد شد.</translation>
+    </message>
+    <message>
+        <source>D&rag'n'Drop:</source>
+        <translation>&کشیدن 'و' رهاکردن:</translation>
+    </message>
+    <message>
+        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <translation>انتخاب اینکه کدام داده بین مهمان و سیستم عامل میزبان توسط کشیدن و رهاکردن کپی خواهد شد.این ویژگی نیازدارد که افزونه مهمان در سیستم عامل مهمان نصب شده باشد.</translation>
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation>نامی برای ماشین مجازی مشخص نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>سیستم عامل ماشین مجازی اشاره میکند که به نوع 64 بیت تنظیم شده است.سیستم مهمان 64 بیت نیاز به مجازی سازی سخت افزاری دارد،بنابراین اگر شما تغییرات را تایید کنید،آن خودکار فعال خواهد شد.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">سه بعدی {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">سه بعدی {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">نوارابزار کوچک:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">اگر انتخاب شده،نوار ابزار کوچک را در حالت تمام صفحه یا یکپارچه نشان میدهد.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">نمایش &در تمام صفحه/یکپارچه</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">اگر انتخاب شده، نوارابزار کوچک را در بالای صفحه نشان میدهد،بجای موقعیت پیش فرض آن در پایین صفحه.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">نمایش در &بالای صفحه</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3415,35 +3932,35 @@
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation>هیچ آداپتور شبکه پل شده اکنون انتخاب نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>هیچ نام شبکه داخلی اکنون تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>هیچ آداپتور شبکه فقط-میزبان انتخاب نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation>اکنون هیچ درایور اصلی انتخاب نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>هیچ نام شبکه  NAT اکنون تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>آدرس مک باید 12 رقم هگزادسیمال بلند باشد</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation>رقم دوم در آدرس مک نباید فرد باشد دراینصور فقط ادرس یونی کست اجازه داده میشود</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>نام شبکه NAT که این کارت شبکه به آن متصل شده است را نگه دارید. شما میتوانید توسط تنظیمات سراسری شبکه در پنجره مدیریت ماشین مجازی شبکه راحذف و ایجاد کنید.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3510,23 +4027,23 @@
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>اکنون IRQ تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>اکنون پورت I/O تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>دو یا چند پورت تنظیمات مشابه دارند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>اکنون مسیر پورتی تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>اکنون مسیر پورت های تکراری تعیین شده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3671,7 +4188,7 @@
     </message>
     <message>
         <source>When checked, the guest OS will try to automatically mount the shared folder on startup.</source>
-        <translation>وقتیکه انتخاب شده باشد،سیستم عامل مهمان سعی میکند در اِستارت آپ پوشه اشتراکی را بارگیری کند.</translation>
+        <translation>اگر انتخاب شده باشد،سیستم عامل مهمان سعی میکند در اِستارت آپ پوشه اشتراکی را بارگیری کند.</translation>
     </message>
     <message>
         <source>&Auto-mount</source>
@@ -3681,10 +4198,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation>اگر انتخاب شده باشد،این پوشه اشتراکی دائمی خواهد بود.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>پنجره</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -3727,19 +4240,19 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>اگر انتخاب شده، میله مشخص شده در فیلد <b>مسیر پورت</b> توسط ماشین مجازی حین شروع آن ایجاد خواهد شد. در غیراینصورت، ماشین مجازی فرض میکند که میله موجود است و سعی میکند که از آن استفاده کند.</translation>
+        <translation type="obsolete">اگر انتخاب شده، میله مشخص شده در فیلد <b>مسیر پورت</b> توسط ماشین مجازی حین شروع آن ایجاد خواهد شد. در غیراینصورت، ماشین مجازی فرض میکند که میله موجود است و سعی میکند که از آن استفاده کند.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>ایجاد &میله</translation>
+        <translation type="obsolete">ایجاد &میله</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>مسیر را به میله پورت سریال در میزبان را وقتیکه پورت در حالت <b>میله میزبان</b> کار میکند را نشان میدهد، یا نام دستگاه سریال میزبان را وقتیکه پورت در حالت <b>دستگاه میزبان</b> در حال کار است را نشان میدهد.</translation>
+        <translation type="obsolete">مسیر را به میله پورت سریال در میزبان را وقتیکه پورت در حالت <b>میله میزبان</b> کار میکند را نشان میدهد، یا نام دستگاه سریال میزبان را وقتیکه پورت در حالت <b>دستگاه میزبان</b> در حال کار است را نشان میدهد.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>مسیر پور&ت/فایل:</translation>
+        <translation type="obsolete">مسیر پور&ت/فایل:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -3749,6 +4262,22 @@
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>آدرس پورت ورودی/خروجی پایه را برای این پورت سریال را نشان میدهد. مقادیر معتبر اعداد صحیح در محدوده ای از <tt>0</tt> به <tt>0xFFFF</tt> هستند.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -3766,23 +4295,23 @@
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>اکنون IRQ تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>اکنون پورت I/O تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>دو یا چند پورت تنظیمات مشابه دارند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>اکنون مسیر پورتی تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>اکنون مسیر پورت های تکراری تعیین شده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3801,11 +4330,11 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>افزودن&nbsp;دستگاه&nbsp;سی دی/دی وی دی</nobr></translation>
+        <translation type="obsolete"><nobr>افزودن&nbsp;دستگاه&nbsp;سی دی/دی وی دی</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>افزودن&nbsp;دستگاه&nbsp;فلاپی</nobr></translation>
+        <translation type="obsolete"><nobr>افزودن&nbsp;دستگاه&nbsp;فلاپی</nobr></translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -3845,11 +4374,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>افزودن دستگاه سی دی/دی وی دی</translation>
+        <translation type="obsolete">افزودن دستگاه سی دی/دی وی دی</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>افزودن دستگاه فلاپی</translation>
+        <translation type="obsolete">افزودن دستگاه فلاپی</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -4001,15 +4530,15 @@
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>درایو سی دی/دی &وی دی:</translation>
+        <translation type="obsolete">درایو سی دی/دی &وی دی:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>یک دیسک مجازی سی دی/دی وی دی یا یک درایو فیزیکی برای استفاده با درایو مجازی انتخاب کنید. ماشین مجازی دیسک قرارداده شده در درایو را با داده در فایل یا در درایو فیزیکی بعنوان محتویات دیسک میبیند.</translation>
+        <translation type="obsolete">یک دیسک مجازی سی دی/دی وی دی یا یک درایو فیزیکی برای استفاده با درایو مجازی انتخاب کنید. ماشین مجازی دیسک قرارداده شده در درایو را با داده در فایل یا در درایو فیزیکی بعنوان محتویات دیسک میبیند.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>تنظیم درایو مجازی سی دی/دی وی دی</translation>
+        <translation type="obsolete">تنظیم درایو مجازی سی دی/دی وی دی</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -4017,7 +4546,7 @@
     </message>
     <message>
         <source>Choose a virtual floppy disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>یک دیسک فلاپی مجازی یا یک درایو فیزیکی برای استفاده با درایو مجازی انتخاب کنید. ماشین مجازی دیسک قرارداده شده در درایو را با داده در فایل یا در درایو فیزیکی بعنوان محتویات دیسک میبیند.</translation>
+        <translation>مجازی فلاپی دیسک یا درایو جسمی درایو مجازی استفاده کنید انتخاب کنید. ماشین مجازی دیسک وارد شده را در درایوی که با اطلاعات در پرونده یا دیسک موجود در درایو جسمی عنوان محتویاتش دید.ماشین مجازی دیسک قرارداده شده در درایو را با داده در فایل یا در درایو فیزیکی بعنوان محتویات دیسک میبیند.</translation>
     </message>
     <message>
         <source>Set up the virtual floppy drive</source>
@@ -4033,7 +4562,7 @@
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>یک فایل دیسک سی دی/دی وی دی مجازی انتخاب کنید...</translation>
+        <translation type="obsolete">یک فایل دیسک سی دی/دی وی دی مجازی انتخاب کنید...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -4103,23 +4632,71 @@
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>هیچ نامی اکنون برای کنترلر در موقعیت <b>%1</b> تعیین نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>کنترلردر موقعیت <b>%1</b> همین نام را بعنوان کنترلر در موقعیت <b>%2</b> دارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>دیسک سختی برای <i>%1</i> انتخاب نشده است.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> از دیسکی استفاده میکند که از قبل ضمیمه شده به <i>%2</i>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>ماشین اکنون درحال استفاده کنترلرهای ذخیره ساز بیشتر از %1 تراشه پشتیبانی شده هستید. لطفا نوع تراشه را در صفحه تنظیمات سیستم تغییر دهید یا تعداد کنترلرهای ذخیره ساز زیرین را در صفحه تنظیمات ذخیره ساز کاهش دهید: %2</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">یک فایل دیسک نوری مجازی انتخاب کنید...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4276,11 +4853,11 @@
     </message>
     <message>
         <source>If checked, an absolute pointing device (a USB tablet) will be supported. Otherwise, only a standard PS/2 mouse will be emulated.</source>
-        <translation type="obsolete">اگر انتخاب شده،یک دستگاه اشاره گر حقیقی (یک تبلت یو اِس بی) پشتیبانی خواهد شد. درغیراینصورت، فقط یک ماوس استاندارد PS/2 شبیه سازی خواهد شد.</translation>
+        <translation type="obsolete">اگر انتخاب شده،یک دستگاه اشاره گر مطلق (یک تبلت یو اِس بی) پشتیبانی خواهد شد. درغیراینصورت، فقط یک ماوس استاندارد PS/2 شبیه سازی خواهد شد.</translation>
     </message>
     <message>
         <source>Enable &absolute pointing device</source>
-        <translation type="obsolete">فعال &سازی دستگاه اشاره گر حقیقی</translation>
+        <translation type="obsolete">فعال &سازی دستگاه اشاره گر مطلق</translation>
     </message>
     <message>
         <source>&Chipset:</source>
@@ -4322,47 +4899,55 @@
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>&دستگاه اشاره گر:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>هرگاه دستگاه اشاره گر شبیه ساز شده یک ماوس پی اِس/2 استاندارد،یک تبلت یو اِس  بی یا یک تبلت لمسی یو اِس بی را تعیین میکند.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>بیشتر از <b>%1%</b> از حافظه رایانه میزبان را (<b>%2</b>) به ماشین مجازی اختصاص داده اید. حافظه کافی برای سیستم عامل مهمان باقی نمانده است.لطفا مقدار کمتری انتخاب نمایید.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>بیشتر از <b>%1%</b> از حافظه رایانه میزبان را (<b>%2</b>) به ماشین مجازی اختصاص داده اید. حافظه کافی برای سیستم عامل مهمان باقی نمانده است.با در نظر گرفتن این مقدار کمتری انتخاب نمایید.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>ویژگی ورودی/خروجی APIC اکنون در بخش مادربرد صفحه سیستم فعال نشده است.این برای پشتیبانی از نوع تراشه ICH9 ضروری هست. اگر تغییرات را تایید و اعمال کنید آن خودکار انجام خواهد شد.</translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>شبیه ساز کنترلر یو اِس بی اکنون در صفحه یو اِس بی فعال نشده است. بمنظور پشتیبانی از دستگاه ورودی یو اِس بی به آن نیاز است. اگر تغییرات را تایید کنید آن خودکار انجام خواهد شد..</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>به دلیل کارایی، تعداد پردازنده مجازی ضمیمه شده به ماشین مجازی نبابید بیشتر از دوبرابر پردازنده فیزیکی در میزبان (<b>%1</b>) باشد. لطفا تعداد پردازنده مجازی را کاهش دهید.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>پردازنده مجازی بیشتری نسبت به تعداد پردازنده فیزیکی سیستم میزبان (<b>%1</b>) به ماشین مجازی اختصاص داده اید. این بیشتر باعث تنزل کارایی ماشین مجازی میشود. لطفا به کاهش پردازنده مجازی توجه کنید.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>ویژگی ورودی/خروجی APIC اکنون در بخش مادربرد صفحه سیستم فعال نشده است.این برای پشتیبانی از بیشتر از یک پردازنده مجازی نیاز است. اگر تغییرات را تایید و اعمال کنید آن خودکار انجام خواهد شد.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>مجازی سازی سخت افزار اکنون در بخش شتاب دهنده صفحه سیستم فعال نشده است. برای پشتیبانی از بیشتر از یک پردازنده مجازی این ضروری است. اگر تغییرات را تایید و اعمال کنید آن خودکار انجام خواهد شد.</translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>درپوش اِجرای پردازنده به مقدار کم تنظیم شده است.این میتواند موجب احساس کندی در عملکرد و پاسخ ماشین داشته باشد.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4434,7 +5019,7 @@
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>فعالسازی کنترلر یو اِس بی 2.0 (E&HCI)</translation>
+        <translation type="obsolete">فعالسازی کنترلر یو اِس بی 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -4493,8 +5078,28 @@
         <translation type="obsolete">اکنون یو اِس بی 2.0 برای این ماشین فعال شده است. هرچند، این نیاز دارد که <b>%1</b> نصب شده باشد. لطفا بسته افزونه را از سایت ویرچوال باکس دانلود کنید. بعداز این شما قادر به فعال کردن مجدد یو اِس بی 2.0 هستید. آن در این فاصله غیرفعال شده است بجز اینکه شما تغییرات تنظیمات فعلی را لغو کنید.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>اکنون یو اِس بی 2.0 برای این ماشین فعال شده است. هرچند، این نیاز دارد که <b>%1</b> نصب شده باشد. لطفا بسته افزونه را از سایت ویرچوال باکس دانلود کنید، یا یو اِس بی 2.0 را غیرفعال کنید تا بتوانید آن را اِجرا کنید.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4633,7 +5238,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&بستن</translation>
+        <translation type="obsolete">&بستن</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4652,19 +5261,42 @@
     </message>
 </context>
 <context>
-    <name>UIMessageCenter</name>
+    <name>UIMenuBarEditorWidget</name>
     <message>
-        <source>VirtualBox - Information</source>
-        <comment>msg box title</comment>
-        <translation>ویرچوال باکس - اطلاعات</translation>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>VirtualBox - Question</source>
-        <comment>msg box title</comment>
-        <translation>ویرچوال باکس - سوال</translation>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>VirtualBox - Warning</source>
+        <source>Close</source>
+        <translation type="unfinished">بستن</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">تعویض</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMessageCenter</name>
+    <message>
+        <source>VirtualBox - Information</source>
+        <comment>msg box title</comment>
+        <translation>ویرچوال باکس - اطلاعات</translation>
+    </message>
+    <message>
+        <source>VirtualBox - Question</source>
+        <comment>msg box title</comment>
+        <translation>ویرچوال باکس - سوال</translation>
+    </message>
+    <message>
+        <source>VirtualBox - Warning</source>
         <comment>msg box title</comment>
         <translation>ویرچوال باکس - هشدار</translation>
     </message>
@@ -4693,7 +5325,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>موفق به ایجاد شی کام ویرچوال باکس نشد.</p><p>برنامه حالا بسته خواهد شد.</p></translation>
+        <translation type="obsolete"><p>موفق به ایجاد شی کام ویرچوال باکس نشد.</p><p>برنامه حالا بسته خواهد شد.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -4920,9 +5552,9 @@
         <translation type="obsolete">دانلود</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>بارگیری</translation>
+        <translation type="obsolete">بارگیری</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -4989,8 +5621,8 @@
         <translation><p>ماشین مجازی گزارش داده که از  <b>یکپارچگی نشانگر ماوس</b> پشتیبانی میکند. این معنی را میدهد که شما به <i>ضبط</i> نشانگر ماوس برای استفاده در سیستم عامل مهمان نیازی ندارید -- همه اقدامات ماوس که اِجرا کرده اید وقتیکه نشانگر ماوس روی صفحه ماشین مجازی هست مستقیما به سیستم عامل مهمان فرستاده میشود. اگر ماوس اکنون ضبط شده است، آن خودکار از ضبط خارج خواهد شد.</p><p>آیکون ماوس در نوار وضعیت شبیه این خواهد یود&nbsp;<img src [...]
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>نسخه جدید ویرچوال باکس منتشر شده است! نسخه <b>%1</b> موجود است در <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>میتوانید این نسخه را توسط این لینک دانلود کنید:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>نسخه جدید ویرچوال باکس منتشر شده است! نسخه <b>%1</b> موجود است در <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>میتوانید این نسخه را توسط این لینک دانلود کنید:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -5062,11 +5694,11 @@
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>یک یا تعداد بیشتری دیسک سخت مجازی، سی دی/دی وی دی یا رسانه فلاپی اکنون قابل دسترسی نیستند. درنتیجه، تا زمانیکه این رسانه ها قابل دسترسی نباشد شما قادر به استفاده از ماشین مجازی نیستید.</p><p>دکمه <b>بررسی</b> را برای بازکردن پنجره مدیر رسانه مجازی فشار دهید و مشاهده کنید کدام رسانه ها قابل دسترسی نیستند، یا دکمه <b>چشمپوشی</b> را برای نادیده گرفتن این پیام فشار دهید.</p></translation>
+        <translation type="obsolete"><p>یک یا تعداد بیشتری دیسک سخت مجازی، سی دی/دی وی دی یا رسانه فلاپی اکنون قابل دسترسی نیستند. درنتیجه، تا زمانیکه این رسانه ها قابل دسترسی نباشد شما قادر به استفاده از ماشین مجازی نیستید.</p><p>دکمه <b>بررسی</b> را برای بازکردن پنجره مدیر رسانه مجازی فشار دهید و مشاهده کنید کدام رسانه ها قابل دسترسی نیستند، یا دکمه <b>چشمپوشی</b> را برای نادیده گرفتن این پیام فشار دهید.</p></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>یک خطای خطرناک حین اِجرای ماشین مجازی رخ داده و اِجرای ماشین متوقف شده است.</p><p>برای راهنمایی، لطفا بخش انجمن را در <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> ببینید یا با پشتیبانی تماس بگیرید. لطفا محتویات فایل وقایع <tt>VBox.log</tt> و فایل ایمیج <tt>VBox.png</tt> را ارئه دهید، که میتوانید آنها را در دایرکتوری <nobr><b>%1</b></nobr> پیدا کنید، همچنین توضیح دهید [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>یک خطای خطرناک حین اِجرای ماشین مجازی رخ داده و اِجرای ماشین متوقف شده است.</p><p>برای راهنمایی، لطفا بخش انجمن را در <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> ببینید یا با پشتیبانی تماس بگیرید. لطفا محتویات فایل وقایع <tt>VBox.log</tt> و فایل ایمیج <tt>VBox.png</tt> را ارئه دهید، که میتوانید آنها را در دایرکتوری <nobr><b>%1</b></nobr> پیدا کنید، همچ [...]
     </message>
     <message>
         <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
@@ -5248,7 +5880,7 @@
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>آیا میخواهید دستگاه سی دی/دی وی دی رام را حذف کنید؟</p><p>شما قادر به بارگیری سی دی یا ایمیج ایزو یا نصب افزونه مهمان بدون آن نیستید!</p></translation>
+        <translation type="obsolete"><p>آیا میخواهید دستگاه سی دی/دی وی دی رام را حذف کنید؟</p><p>شما قادر به بارگیری سی دی یا ایمیج ایزو یا نصب افزونه مهمان بدون آن نیستید!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -5335,7 +5967,7 @@
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>شما درصدد افزودن درایو سی دی/دی وی دی به کنترلر <b>%1</b> هستید؟</p><p>آیا میخواهید دیسک مجازی سی دی/دی وی دی برای قراردادن در درایو انتخاب کنید یا آن را خالی بگذارید؟</p></translation>
+        <translation type="obsolete"><p>شما درصدد افزودن درایو سی دی/دی وی دی به کنترلر <b>%1</b> هستید؟</p><p>آیا میخواهید دیسک مجازی سی دی/دی وی دی برای قراردادن در درایو انتخاب کنید یا آن را خالی بگذارید؟</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -5357,11 +5989,11 @@
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>موفق به جداکردن دستگاه سی دی/دی وی دی (<nobr><b>%1</b></nobr>) از شکاف <i>%2</i> از ماشین <b>%3</b> نشد.</translation>
+        <translation type="obsolete">موفق به جداکردن دستگاه سی دی/دی وی دی (<nobr><b>%1</b></nobr>) از شکاف <i>%2</i> از ماشین <b>%3</b> نشد.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>موفق به جداکردن دستگاه فلاپی (<nobr><b>%1</b></nobr>) از شکاف <i>%2</i> از ماشین <b>%3</b> نشد.</translation>
+        <translation type="obsolete">موفق به جداکردن دستگاه فلاپی (<nobr><b>%1</b></nobr>) از شکاف <i>%2</i> از ماشین <b>%3</b> نشد.</translation>
     </message>
     <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
@@ -5393,19 +6025,19 @@
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>موفق به ضمیمه دستگاه سی دی/دی وی دی (<nobr><b>%1</b></nobr>) به شکاف <i>%2</i> از ماشین <b>%3</b> نشد.</translation>
+        <translation type="obsolete">موفق به ضمیمه دستگاه سی دی/دی وی دی (<nobr><b>%1</b></nobr>) به شکاف <i>%2</i> از ماشین <b>%3</b> نشد.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>موفق به ضمیمه دستگاه (<nobr><b>%1</b></nobr>) به شکاف <i>%2</i> از ماشین <b>%3</b> نشد.</translation>
+        <translation type="obsolete">موفق به ضمیمه دستگاه (<nobr><b>%1</b></nobr>) به شکاف <i>%2</i> از ماشین <b>%3</b> نشد.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>توجه کنید که واحد ذخیره ساز این رسانه حذف نخواهد شد و امکان استفاده آن در زمان دیگری هم هست.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>افزونه مهمان ویرچوال باکس در ماشین مجازی دردسترس ظاهر نشده است، و پوشه اشتراکی بدون آن قابل استفاده نیست. برای استفاده از پوشه اشتراکی در داخل ماشین مجازی، لطفا افزونه مهمان را نصب کنید اگر آنها نصب نشده است. یا اگر بدرستی کار نمیکند مجددا نصب کنید، گزینه <b>نصب افزونه مهمان</b> را از منوی <b>دستگاه</b> انتخاب کنید. اگر آنها نصب شده اند اما ماشین هنوز بطورکامل شروع نشده است سپس پوشه اشتراکی یک بار در آن دردسترس است.</p></translation>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>افزونه مهمان ویرچوال باکس در ماشین مجازی دردسترس ظاهر نشده است، و پوشه اشتراکی بدون آن قابل استفاده نیست. برای استفاده از پوشه اشتراکی در داخل ماشین مجازی، لطفا افزونه مهمان را نصب کنید اگر آنها نصب نشده است. یا اگر بدرستی کار نمیکند مجددا نصب کنید، گزینه <b>نصب افزونه مهمان</b> را از منوی <b>دستگاه</b> انتخاب کنید. اگر آنها نصب شده اند اما ماشین هنوز بطورکامل شروع نشده است سپس پوشه اشتراکی یک بار در آن دردسترس است.&lt [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -5634,7 +6266,7 @@
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>موفق به رها کردن داده نشد.</translation>
+        <translation type="obsolete">موفق به رها کردن داده نشد.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -5694,259 +6326,346 @@
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>به علت محدودیت محلی نمیتوان مدیر ویرچوال باکس را اجرا کرد.</p><p>برنامه حالا بسته خواهد شد.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>قادر به یافتن فایل زبان برای زبان <b>%1</b> در دایرکتوری زیر نیست: <b><nobr>%2</nobr></b> </p><p>زبان موقتا به زبان پیش فرض سیستم ریست خواهد شد. لطفا به پنجره. <b>اولویت ها</b> بروید که آن را میتوان از منوی <b>فایل</b> در پنجره اصلی برنامه یافت، و یکی از زبان های موجود در صفحه <b>زبان</b> را انتخاب کنید.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>قادر به بارگیری فایل زبان <b><nobr>%1</nobr></b> نیست. <p>زبان موقتا به زبان توکار برنامه یعنی انگلیسی ریست میشود. لطفا به پنجره <b>اولویت ها</b> بروید که میتوانید آن را از منوی <b>فایل</b> از پنجره اصلی برنامه باز کنید، و یکی از زبانهای موجود را از صفحه <b>زبان</b> انتخاب کنید.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation>ماشین مجازی با شناسه <b>%1</b> وجود ندارد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation>چشمپوشی</translation>
+        <translation type="unfinished">چشمپوشی</translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>آیا میخواهید شبکه NAT <nobr><b>%1</b> را حذف کنید؟</nobr></p><p> اگر این شبکه بایک یا تعداد بیشتری آداپتور شبکه ماشین مجازی در حال استفاده باشد دیگر قابل استفاده نخواهد بود تا زمانیکه یا نام شبکه متفاوت انتخاب کرده یا نوع ضمیمه آداپتور متفاوت انتخاب کرد.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation>موفق به ایجاد شبکه NAT نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>موفق به حذف شبکه NAT <b>%1</b> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation>موفق به ایجاد سرور DHCP نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>موفق به حذف سرور DHCP برای رابطه شبکه <b>%1</b> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>موفق به ایجاد رابط شبکه میزبان نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>ایجاد دیسک &جدید</translation>
+        <translation type="unfinished">ایجاد دیسک &جدید</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>انتخاب دی&سک موجود</translation>
+        <translation type="unfinished">انتخاب دی&سک موجود</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation>خالی &بگذار</translation>
+        <translation type="unfinished">خالی &بگذار</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>انتخاب د&یسک</translation>
+        <translation type="unfinished">انتخاب د&یسک</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>آیا میخواهید دیسک سخت مجازی <nobr><b>%1</b></nobr> ترخیص شود؟ </p><p>این آن را از ماشین مجازی زیر جدا خواهد کرد: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>آیا میخواهید دیسک نوری مجازی <nobr><b>%1</b></nobr> را ترخیص کنید؟ </p><p>این آن را از ماشین مجازی زیر جدا خواهد کرد: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>آیا میخواهید دیسک فلاپی مجازی <nobr><b>%1</b></nobr> را ترخیص کنید؟</p><p>این آن را از ماشین مجازی زیر جدا خواهد کرد: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>آیا میخواهید دیسک سخت مجازی <nobr><b>%1</b></nobr> را از لیست فایل های دیسک ایمیج شناخته شده حذف کنید؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation><p>از آنجا که این دیسک سخت  قابل دسترسی نیست،فایل ایمیج آن را نمیتوان حذف کرد.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>آیا میخواهید دیسک نوری مجازی <nobr><b>%1</b></nobr> را از لیست فایل های ایمیج شناخته شده حذف کنید؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>آیا میخواهید دیسک فلاپی مجازی <nobr><b>%1</b></nobr> را از لیست فایل های دیسک ایمیج شناخته شده حذف کنید؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>قادر به قراردادن دیسک نوری مجازی <nobr><b>%1</b></nobr> در ماشین <b>%2</b> نیست.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation><p>آیا میخواهید این دیسک را اجباری قرار دهید؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>قادر به ایجکت دیسک نوری مجازی <nobr><b>%1</b></nobr> از ماشین <b>%2</b> نیست.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation><p>آیا میخواهید این دیسک را ایجکت اجباری کنید؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>قادر به قراردادن دیسک فلاپی مجازی <nobr><b>%1</b></nobr> در ماشین <b>%2</b> نیست.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>قادر به ایجکت دیسک مجازی فلاپی <nobr><b>%1</b></nobr> از ماشین <b>%2</b> نیست.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>موفق به بازکردن فایل دیسک سخت <nobr><b>%1</b></nobr> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>موفق به بازکردن فایل دیسک نوری <nobr><b>%1</b></nobr> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>موفق به بازکردن فایل فلاپی دیسک <nobr><b>%1</b></nobr> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>موفق به بستن فایل دیسک سخت <nobr><b>%2</b></nobr> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>موفق به بستن فایل دیسک نوری <nobr><b>%2</b></nobr> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>موفق به بستن فایل فلاپی دیسک <nobr><b>%2</b></nobr> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation>
+        <translation type="unfinished">
             <numerusform><p>این %n ماشین مجازی زیر اکنون در وضعیت ذخیره شده هستند: <b>%1</b></p><p>اگر ادامه دهید وضعیت زمان اِجرای ماشین خروجیگیری شده لغو خواهد شد. سایر ماشین ها تغییر نخواهد کرد.</p></numerusform>
         </translation>
     </message>
     <message>
         <source>Switch</source>
-        <translation>تعویض</translation>
+        <translation type="unfinished">تعویض</translation>
     </message>
     <message>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>موفق به فعالسازی سرور ریموت دسکتاپ برای ماشین مجازی <b>%1</b> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>موفق به غیرفعالسازی سرور ریموت دسکتاپ برای ماشین مجازی <b>%1</b> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>موفق به فعالسازی ضبط ویدیو برای ماشین مجازی <b>%1</b> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>موفق به ضبط ویدیو برای ماشین مجازی <b>%1</b> نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>نمیتوان فایل دیسک ایمیج <b>افزونه مهمان ویرچوال باکس</b> را یافت.</p><p>آیا میخواهید فایل دیسک ایمیج را از اینترنت دانلود کند؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Download</source>
-        <translation>دانلود</translation>
+        <translation type="unfinished">دانلود</translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>آیا میخواهید فایل ایمیج دیسک <b>افزونه مهمان ویرچوال باکس</b> را از <nobr><a href="%1">%1</a></nobr> (حجم %2 بایت) دانلود کنید؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>فایل دیسک ایمیج <b>افزونه مهمان ویرچوال باکس</b> با موفقیت <nobr><a href="%1">%1</a></nobr>دانلود شد اما نمیتوان بطور محلی در اینجا ذخیره کرد: <nobr><b>%2</b> </nobr></p><p>لطفا یک مکان دیگر برای ذخیره آن انتخاب کنید.</p></translation>
-    </message>
-    <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>فایل دیسک ایمیج <b>افزونه مهمان ویرچوال باکس</b> با موفقیت از <nobr><a href="%1">%1</a></nobr> دانلود شد و بطور محلی بعنوان <nobr><b>%2</b> ذخیره شد.</nobr></p><p>آیا میخواهید این فایل دیسک ایمیج را ثبت کرده و در درایو سی دی/دی وی دی بارگیری کنید؟</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>نمیتوان فایل دیسک ایمیج <b>افزونه مهمان ویرچوال باکس</b> را در ماشین مجازی <b>%1</b>قرارداد،زیرا ماشین درایو سی دی یا دی وی دی ندارد. لطفا یک درایو توسط صفحه ذخیره ساز در پنجره تنظیمات ماشین مجازی اضافه کنید.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation><p>قادر به یافتن <b>راهنمای کاربر ویرچوال باکس</b> <nobr><b>%1</b> نیست</nobr></p><p>آیا میخواهید آن را از اینترنت دانلود کنید؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>آیا میخواهید فایل <b>راهنمای کاربر ویرچوال باکس</b> را از <nobr><a href="%1">%1</a></nobr> (حجم %2 بایت) دانلود کنید؟</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>راهنمای کاربر ویرچوال باکس با موفقیت از <nobr><a href="%1">%2</a></nobr> دانلود شد اما نمیتواند بطور محلی بعنوان <nobr><b>%3</b> ذخیره شود.</nobr></p><p>لطفا برای آن فایل محل دیگری را انتخاب کنید.</p> {1"?} {1<?} {2<?}</translation>
+        <translation type="unfinished"><p>راهنمای کاربر ویرچوال باکس با موفقیت از <nobr><a href="%1">%2</a></nobr> دانلود شد اما نمیتواند بطور محلی بعنوان <nobr><b>%3</b> ذخیره شود.</nobr></p><p>لطفا برای آن فایل محل دیگری را انتخاب کنید.</p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>راهنمای کاربر ویرچوال باکس با موفقیت از <nobr><a href="%1">%2</a></nobr> دانلود شد و بطور محلی بعنوان <nobr><b>%3</b> ذخیره شد.</nobr></p> {1"?} {1<?} {2<?}</translation>
+        <translation type="unfinished"><p>راهنمای کاربر ویرچوال باکس با موفقیت از <nobr><a href="%1">%2</a></nobr> دانلود شد و بطور محلی بعنوان <nobr><b>%3</b> ذخیره شد.</nobr></p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source>Close</source>
-        <translation>بستن</translation>
+        <translation type="unfinished">بستن</translation>
     </message>
     <message>
         <source>Ok</source>
-        <translation>تأیید</translation>
+        <translation type="unfinished">تأیید</translation>
     </message>
     <message>
         <source>Do not show this message again</source>
-        <translation>این پیام را دیگر نشان نده</translation>
+        <translation type="unfinished">این پیام را دیگر نشان نده</translation>
+    </message>
+    <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>افزونه مهمان ویرچوال باکس در ماشین مجازی دردسترس ظاهر نشده است، و پوشه اشتراکی بدون آن قابل استفاده نیست. برای استفاده از پوشه اشتراکی در داخل ماشین مجازی، لطفا افزونه مهمان را نصب کنید اگر آنها نصب نشده است. یا اگر بدرستی کار نمیکند مجددا نصب کنید، گزینه <b>نصب افزونه مهمان</b> را از منوی <b>دستگاه</b> انتخاب کنید. اگر آنها نصب شده اند اما ماشین هنوز بطورکامل شروع نشده است سپس پوشه اشتراکی یک بار در آن دردسترس است.&lt [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">بارگیری</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>موفق به ضمیمه کردن وب کم <b>%1</b> به ماشین مجازی <b>%2</b> نشد.</translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>موفق به جداسازی وب کم <b>%1</b> از ماشین مجازی <b>%2</b> نشد.</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>نمایشگر مجازی اکنون به حالت رنگی <b>%1&nbsp;بیت</b> تنظیم شده است. برای کارایی بهتر لطفا آن را به <b>%2&nbsp;بیت</b> تغییر دهید. این معمولا میتواند از قسمت <b>نمایش</b> کنترل پنل سیستم عامل مهمان یا تنظیمات سیستم انجام شود.</p></translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation>همیشه نمایش نوارابزار</translation>
+        <translation type="unfinished">همیشه نمایش نوارابزار</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation>کمینه پنجره</translation>
+        <translation type="unfinished">کمینه پنجره</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation>خروج ازحالت تمام صفحه یا حالت یکپارچه</translation>
+        <translation type="unfinished">خروج ازحالت تمام صفحه یا حالت یکپارچه</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation>بستن ماشین مجازی</translation>
+        <translation type="unfinished">بستن ماشین مجازی</translation>
     </message>
 </context>
 <context>
@@ -5963,7 +6682,7 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>نا&م:</translation>
     </message>
     <message>
@@ -6023,7 +6742,7 @@
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation>عملکرد شبکه یا خطای زیر موفق نشد: %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6050,34 +6769,34 @@
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation>میزبان یافت نشد</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation>دسترسی به محتوا رد شد</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation>پروتکل موفق نشد</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>فرمت گواهینامه SSL اشتباه است</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>تایید اعتبار SSL انجام نشد.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>دلیل ناشناخته</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>برای جزئیات کامل کلیک کنید</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6155,14 +6874,18 @@
         <translation>فایل ماشین مجازی (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>به ویرچوال باکس خوش آمدید!</h3><p>بخش راست این پنجره لیستی از همه ماشین های مجازی روی رایانه شما هست. حالا لیست خالی هست زیرا شما هنوز هیچگونه ماشین مجازی ایجاد نکرده اید.</p><p>بمنظور ایجاد ماشین مجازی جدید، دکمه <b>جدید</b> را از نوارابزار اصلی قرارگرفته در بالای پنجره فشار دهید.</p><p> میتوانید کلید <b>%1</b> برای دریافت راهنمای فوری فشاردهید، یا از سایت <a href=https://www.virtualbox.org> [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>به ویرچوال باکس خوش آمدید!</h3><p>بخش راست این پنجره لیستی از همه ماشین های مجازی روی رایانه شما هست. حالا لیست خالی هست زیرا شما هنوز هیچگونه ماشین مجازی ایجاد نکرده اید.</p><p>بمنظور ایجاد ماشین مجازی جدید، دکمه <b>جدید</b> را از نوارابزار اصلی قرارگرفته در بالای پنجره فشار دهید.</p><p> میتوانید کلید <b>%1</b> برای دریافت راهنمای فوری فشاردهید، یا از سایت <a href=http://www.vir [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>مدیر</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -6191,15 +6914,15 @@
     </message>
     <message>
         <source>Settings</source>
-        <translation>تنظیمات</translation>
+        <translation type="obsolete">تنظیمات</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation><b>%1</b> صفحه:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation><b>%1: %2</b> صفحه:</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6244,6 +6967,10 @@
         <source>Display</source>
         <translation>نمایش</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -6295,6 +7022,43 @@
         <source>%1 - %2</source>
         <translation>%1 - %2</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">تنظیمات</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">بستن</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -6381,7 +7145,7 @@
     </message>
     <message>
         <source>You want to:</source>
-        <translation>چه کاری انجام خواهید داد:</translation>
+        <translation>شما میخواهید که:</translation>
     </message>
     <message>
         <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
@@ -6419,6 +7183,14 @@
         <source>&Restore current snapshot '%1'</source>
         <translation>بازگردانی ضبط &وضعیت فعلی '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -6432,6 +7204,120 @@
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - اطلاعات جلسه</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">جزئی&ات</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">زمان اِ&جرا</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>انتقالات DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>انتقالات PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>خواندن داده</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>نوشتن داده</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>داده اِرسال شده</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>داده دریافتی</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>صفات زمان اِجرا</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>وضوح صفحه</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>تشخیص داده نشده است</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>تشخیص داده نشده است</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>افزونه مهمان</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>نوع سیستم عامل مهمان</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>هیچ آداپتور شبکه ندارد</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>آمار ذخیره ساز</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>دستگاه ذخیره ساز ندارد</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>آمار شبکه</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>موجود نیست</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>حالت کلیپ برد</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">حالت کشیدن 'و' رهاکردن</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -6549,12 +7435,28 @@
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
-        <translation>عدم نمایش توضیحات</translation>
+        <source>Hide Description</source>
+        <translation type="obsolete">عدم نمایش توضیحات</translation>
+    </message>
+    <message>
+        <source>Show Description</source>
+        <translation type="obsolete">نمایش توضیحات</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
-        <translation>نمایش توضیحات</translation>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6593,7 +7495,7 @@
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>لطفا انتخاب کنید چه موقع فایل درایو سخت مجازی جدید باید بزرگ شود به همان اندازه که استفاده شده است (پویا اختصاص داده شده) یا آن باید در حداکثر حجم ایجاد شود (حجم ثابت شده).</translation>
+        <translation>لطفا انتخاب کنید چه موقع فایل درایو سخت مجازی جدید باید بزرگ شود بمهان اندازه که استفاده شده است (پویا اختصاص داده شده) یا آن باید در حداکثر حجم ایجاد شود (حجم ثابت شده).</translation>
     </message>
     <message>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
@@ -6884,39 +7786,39 @@
     </message>
     <message>
         <source>Storage settings</source>
-        <translation>تنظیمات ذخیره ساز</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>لطفا یک فایل برای خروجیگیری وسیله مجازی انتخاب کنید</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>&فرمت:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>نوشتن در فرمت استاندارد OVF 1.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>نوشتن در فرمت آزمایشی OVF 2.0 .</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation>&تنظیمات ذخیره ساز</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6935,14 +7837,14 @@
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>یک فایل برای خروجیگیری ماشین مجازی انتخاب کنید</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>یک فایل برای خروجیگیری ماشین مجازی انتخاب کنید</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7008,19 +7910,19 @@
     </message>
     <message>
         <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
-        <translation>اینها ماشین های مجازی شامل در وسیله و تنظیمات پیشنهاد شده ماشین های مجازی واردشده هستند.میتوانید بسیاری از مشخصات نمایش داده شده را بادومرتبه کلیک روی آیتم تغییر دهید و بقیه را توسط چک باکس زیر غیرفعال کنید.</translation>
+        <translation>اینها ماشین های مجازی شامل در وسیله و تنظیمات پیشنهاد شده ماشین های مجازی واردشده هستند.میتوانید بسیاری از مشخصات نمایش داده شده را بادومرتبه کلیک روی آیتم تغییر دهید و بقیه را توسط جک باکس زیر غیرفعال کنید.</translation>
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation>وارد کردن یک وسیله مجازی</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>یک وسیله مجازی برای وارد کردن انتخاب کنید...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>لطفا یک فایل وسیله مجازی برای وارد کردن انتخاب کنید</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7047,7 +7949,7 @@
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>لطفا انتخاب کنید چه موقع فایل درایو سخت مجازی جدید باید بزرگ شود به همان اندازه که استفاده شده است (پویا اختصاص داده شده) یا آن باید در حداکثر حجم ایجاد شود (حجم ثابت شده).</translation>
+        <translation>لطفا انتخاب کنید چه موقع فایل درایو سخت مجازی جدید باید بزرگ شود بمهان اندازه که استفاده شده است (پویا اختصاص داده شده) یا آن باید در حداکثر حجم ایجاد شود (حجم ثابت شده).</translation>
     </message>
     <message>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
@@ -7204,7 +8106,7 @@
     </message>
     <message>
         <source>Choose...</source>
-        <translation>انتخاب کنید...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7214,8 +8116,8 @@
         <translation><ریست به پیش فرض></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>مقدار مسیر پیش فرض واقعی بعداز پذیرفتن تغییرات و بازکردن دوباره این پنجره نمایش داده میشود.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">مقدار مسیر پیش فرض واقعی بعداز پذیرفتن تغییرات و بازکردن دوباره این پنجره نمایش داده میشود.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -7263,8 +8165,7 @@
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">مقدار مسیر پیش فرض واقعی بعداز پذیرفتن تغییرات و بازکردن دوباره این پنجره نمایش داده میشود.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7452,7 +8353,7 @@
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>سی دی/دی وی دی-رام</translation>
+        <translation type="obsolete">سی دی/دی وی دی-رام</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -8050,17 +8951,17 @@
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>ضمیمه کردن این دیسک سخت بطور غیرمستقیم توسط یک دیسک سخت متفاوت ایجاد شده جدید اِجرا شده است.</translation>
+        <translation type="obsolete">ضمیمه کردن این دیسک سخت بطور غیرمستقیم توسط یک دیسک سخت متفاوت ایجاد شده جدید اِجرا شده است.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>برخی از رسانه ها در این زنجیره دیسک سخت غیرقابل دسترسی است. لطفا از مدیر رسانه مجازی در حالت <b>نمایش دیسک سخت متفاوت </b> برای بررسی این رسانه ها استفاده کنید.</translation>
+        <translation type="obsolete">برخی از رسانه ها در این زنجیره دیسک سخت غیرقابل دسترسی است. لطفا از مدیر رسانه مجازی در حالت <b>نمایش دیسک سخت متفاوت </b> برای بررسی این رسانه ها استفاده کنید.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>این دیسک سخت پایه غیرمستقیم ضمیمه شده توسط دیسک سخت متفاوت زیر:</translation>
+        <translation type="obsolete">این دیسک سخت پایه غیرمستقیم ضمیمه شده توسط دیسک سخت متفاوت زیر:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -8100,7 +9001,7 @@
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(سی دی/دی وی دی)</translation>
+        <translation type="obsolete">(سی دی/دی وی دی)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -8549,56 +9450,56 @@
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>فعال شده</translation>
+        <translation type="obsolete">فعال شده</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>غیرفعال شده</translation>
+        <translation type="obsolete">غیرفعال شده</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
-        <translation>اِجرای بدون محدودیت</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>PS/2 Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>PS/2 Mouse</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>موس یو اِس بی</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation>تبلت یو اِس بی</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>PS/2 and USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>ماوس پی اِس/2 و یو اِس بی</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Multi-Touch Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation>تبلت چند لمسی یو اِس بی</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network</source>
         <comment>NetworkAttachmentType</comment>
-        <translation>شبکه NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT network, '%1'</source>
         <comment>details report (network)</comment>
-        <translation>شبکه NAT، '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>شما میتوانید فایل های ایمیج دیسک را در تنظیمات ماشین مجازی اضافه یا ایجاد نمائیید.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enabled</source>
@@ -8612,12 +9513,156 @@
     </message>
     <message>
         <source>Unrestricted Execution</source>
-        <translation>اِجرای بدون محدودیت</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">یو اِس بی</translation>
+        <translation type="unfinished">یو اِس بی</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">پیش فرض</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">فعال</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">فعال</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">فعال</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8769,6 +9814,18 @@
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">ایجاد یک درایو سخت مجازی جدید</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -8972,110 +10029,4 @@
         <translation>دستگاه پشتیبانی شده ای به رایانه میزبان متصل نشده است</translation>
     </message>
 </context>
-<context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - اطلاعات جلسه</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">جزئی&ات</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">زمان اِ&جرا</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>انتقالات DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>انتقالات PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>خواندن داده</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>نوشتن داده</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>داده اِرسال شده</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>داده دریافتی</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>صفات زمان اِجرا</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>وضوح صفحه</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>تشخیص داده نشده است</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>تشخیص داده نشده است</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>افزونه مهمان</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>نوع سیستم عامل مهمان</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>هیچ آداپتور شبکه ندارد</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>آمار ذخیره ساز</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>دستگاه ذخیره ساز ندارد</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>آمار شبکه</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>موجود نیست</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>حالت کلیپ برد</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>حالت کشیدن 'و' رهاکردن</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>جزئیات &پیکربندی</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>&اطلاعات زمان اِجرا</translation>
-    </message>
-</context>
 </TS>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fi.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fi.ts
index 659b9c1..ace0c58 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fi.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fi.ts
@@ -278,7 +278,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Saumato&n tila</translation>
+        <translation type="unfinished">Saumato&n tila</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -302,11 +302,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Poista &hiirituki käytöstä</translation>
+        <translation type="obsolete">Poista &hiirituki käytöstä</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Poista väliaikaisesti käytöstä isäntätietokoneen hiiren kohdistime tuki</translation>
+        <translation type="obsolete">Poista väliaikaisesti käytöstä isäntätietokoneen hiiren kohdistime tuki</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -318,11 +318,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Lähetä Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&Lähetä Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Lähetä Ctrl-Alt-Del-näppäinyhdistelmä virtuaalikoneelle</translation>
+        <translation type="obsolete">Lähetä Ctrl-Alt-Del-näppäinyhdistelmä virtuaalikoneelle</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -330,7 +330,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Lähetä Ctrl-Alt-Backspace-näppäinyhdistelmä virtuaalikoneelle</translation>
+        <translation type="obsolete">Lähetä Ctrl-Alt-Backspace-näppäinyhdistelmä virtuaalikoneelle</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -345,8 +345,8 @@
         <translation type="obsolete">Näytä &tietoikkuna</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Näytä tietoja istunnosta</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Näytä tietoja istunnosta</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -397,16 +397,8 @@
         <translation>&Laitteet</translation>
     </message>
     <message>
-        <source>&CD/DVD Devices</source>
-        <translation></translation>
-    </message>
-    <message>
-        <source>&Floppy Devices</source>
-        <translation></translation>
-    </message>
-    <message>
         <source>&USB Devices</source>
-        <translation>&USB-laitteet</translation>
+        <translation type="obsolete">&USB-laitteet</translation>
     </message>
     <message>
         <source>Change the settings of network adapters</source>
@@ -425,12 +417,12 @@
         <translation type="obsolete">Valitse, sallitaanko tähän virtuaalikoneeseen RDP-etätyöpöytäyhteydet</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">&Asenna asiakaslisäosat...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Asenna asiakaslisäosat...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Liitä asiakaslisäosien asennuslevykuva</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Liitä asiakaslisäosien asennuslevykuva</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -449,7 +441,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">&Lokitus...</translation>
+        <translation type="obsolete">&Lokitus...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -468,26 +460,10 @@
         <translation></translation>
     </message>
     <message>
-        <source>Switch to &Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch between normal and fullscreen mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch to Seam&less Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and seamless desktop integration mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch to &Scaled Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and scaled mode</source>
         <translation type="unfinished"></translation>
     </message>
@@ -556,10 +532,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished">&Tiedosto</translation>
@@ -831,10 +803,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -879,23 +847,248 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Asenna asiakaslisäosat...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Liitä asiakaslisäosien asennuslevykuva</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Näppäimistö</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Verkko</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Näytä &loki...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Tiedosto</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Käytössä</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1408,14 +1601,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1498,6 +1691,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -1960,11 +2179,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished">Ei käytössä</translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">Ei liitetty</translation>
@@ -2163,21 +2377,121 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Ohjain</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details</comment>
-        <translation type="obsolete">Ei käytössä</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Käytössä</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished">Ei käytössä</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">Käytössä</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Käytössä</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Ei käytössä</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Käytössä</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Ei käytössä</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ohjain</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ei käytössä</translation>
+    </message>
+</context>
+<context>
     <name>UIGDetailsUpdateThreadDescription</name>
     <message>
         <source>None</source>
@@ -2496,18 +2810,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Näytä ilmoitusalueen kuvake</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3666,16 +3968,6 @@ p, li { white-space: pre-wrap; }
         <translation></translation>
     </message>
     <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
-        <comment>CD/DVD tooltip</comment>
-        <translation></translation>
-    </message>
-    <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
-        <comment>FD tooltip</comment>
-        <translation></translation>
-    </message>
-    <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
         <translation></translation>
@@ -3713,7 +4005,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB-ohjain ei ole käytössä</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB-ohjain ei ole käytössä</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -3763,6 +4055,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -3852,10 +4158,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"><qt>%1&nbsp;MB</qt></translation>
     </message>
     <message>
-        <source>&Video</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Video &Memory:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4020,10 +4322,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4075,7 +4373,55 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4102,7 +4448,7 @@ p, li { white-space: pre-wrap; }
         <translation>Näytä polku, jonne tämän virtuaalikoneen palautuspisteet tallennetaan. Huomaa, että palautuspisteet voivat viedä paljon levytilaa.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Perus</translation>
     </message>
     <message>
@@ -4146,7 +4492,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Säätää virtuaalikoneen videomuistin määrää.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Lisäasetukset</translation>
     </message>
     <message>
@@ -4242,7 +4588,7 @@ p, li { white-space: pre-wrap; }
         <translation>P&alautuspisteiden kansio:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Kuvaus</translation>
     </message>
     <message>
@@ -4255,7 +4601,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Jos asetettu, muutokset CD/DVD- ja levykeasemiin virtuaalikoneen ollessa käynnissä tallennetaan asetustiedostoon, jotta samat liitosasetukset säilytetään virtuaalikoneen suorituskertojen välillä.</translation>
+        <translation type="obsolete">Jos asetettu, muutokset CD/DVD- ja levykeasemiin virtuaalikoneen ollessa käynnissä tallennetaan asetustiedostoon, jotta samat liitosasetukset säilytetään virtuaalikoneen suorituskertojen välillä.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -4286,47 +4632,115 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Ota &3D-kiihdytys käyttöön</translation>
     </message>
     <message>
-        <source>Removable Media:</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Remember Runtime Changes</source>
+        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Mini ToolBar:</source>
+        <source>No name specified for the virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show in &Fullscreen/Seamless</source>
+        <source>Enc&ryption</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <source>When checked, enables encryption for this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show at &Top of Screen</source>
+        <source>En&able Encryption</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>Encryption C&ipher:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>No name specified for the virtual machine.</source>
+        <source>E&nter New Password:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4502,7 +4916,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>A&dvanced</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">&Lisäasetukset</translation>
     </message>
     <message>
         <source>Shows or hides additional network adapter options.</source>
@@ -4938,10 +5352,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -4992,11 +5402,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Jos asetettu, kentässä <b>Portin polku</b> määritelty putki luodaan virtuaalikoneen käynnistyessä. Muussa tapauksessa virtuaalikone yrittää käyttää olemassaolevaa putkea.</translation>
+        <translation type="obsolete">Jos asetettu, kentässä <b>Portin polku</b> määritelty putki luodaan virtuaalikoneen käynnistyessä. Muussa tapauksessa virtuaalikone yrittää käyttää olemassaolevaa putkea.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Luo putki</translation>
+        <translation type="obsolete">&Luo putki</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5004,18 +5414,30 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Näyttää polun sarjaportin putkitiedostoon, kun portti on <b>Isännän putki</b>-tilassa, tai isäntäkoneen sarjaportin laitenimen, kun portti on <b>Isäntälaite</b>-tilassa.</translation>
+        <translation type="obsolete">Näyttää polun sarjaportin putkitiedostoon, kun portti on <b>Isännän putki</b>-tilassa, tai isäntäkoneen sarjaportin laitenimen, kun portti on <b>Isäntälaite</b>-tilassa.</translation>
     </message>
     <message>
-        <source>Port/File &Path:</source>
+        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
+        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5137,14 +5559,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Add Controller</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5177,14 +5591,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Add CD/DVD Device</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Add Floppy Device</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Remove Attachment</source>
         <translation type="unfinished">Poista liitos</translation>
     </message>
@@ -5313,18 +5719,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD &Drive:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Floppy &Drive:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5345,10 +5739,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Remove disk from virtual drive</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5418,6 +5808,54 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5602,31 +6040,39 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5699,7 +6145,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Käytä USB 2.0 (E&HCI)-ohjainta</translation>
+        <translation type="obsolete">Käytä USB 2.0 (E&HCI)-ohjainta</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5754,7 +6200,27 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"><nobr>Tila: %1</nobr></translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5893,7 +6359,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Valitse</translation>
     </message>
     <message>
-        <source>C&lose</source>
+        <source>Removing medium...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5913,6 +6379,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Sulje</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Vaihda</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -5970,7 +6459,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>VirtualBoxin COM-oliota ei voitu luoda.</p><p>Ohjelma lopetataan nyt.</p></translation>
+        <translation type="obsolete"><p>VirtualBoxin COM-oliota ei voitu luoda.</p><p>Ohjelma lopetataan nyt.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -6239,15 +6728,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Kielitiedostoa <b><nobr>%1</nobr></b> ei voitu ladata.</p><p>Kieli on väliaikaisesti asetettu oletusarvoon Englanti. Siirry VirtualBoxin pääikkunan <b>File</b>-valikon kohtaan <b>Preferences</b>, josta voit valita jonkun olemassaolevista kielistä <b>Language</b>-sivulta.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Virtuaalikoneeseen asennetut VirtualBoxin asiakaslisäosat ovat liian vanhoja: asennettu versio on %1, ja vaadittu versio on %2. Jotkut ominaisuudet, jotka vaativat lisäosien toiminnan,kuten hiiren integrointi ja näytön koon automaattinen vaihto, lakkaavat luultavasti toimimasta oikein.</p><p>Päivitä asiakslisäosat uusimpaan versioon valitsemalla <b>Laitteet</b>-valikosta kohta <b>Asenna asiakaslisäosat...</b&g [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Virtuaalikoneeseen asennetut VirtualBoxin asiakaslisäosat ovat vanhentuneet: asennettu versio on %1, ja vaadittu versio on %2. Jotkut ominaisuudet, jotka vaativat lisäosien toiminnan,kuten hiiren integrointi ja näytön koon automaattinen vaihto, lakkaavat luultavasti toimimasta oikein.</p><p>Päivitä asiakslisäosat uusimpaan versioon valitsemalla <b>Laitteet</b>-valikosta kohta <b>Asenna asiakaslisäosat...</b&gt [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Virtuaalikoneeseen asennetut VirtualBoxin asiakaslisäosat ovat liian uusia tälle VirtualBoxin versiolle: asennettu versio on %1, ja vaadittu versio on %2. Uudempien lisäosien version käyttäminen vanhemman VirtualBoxin kanssa ei ole tuettu.</p><p>Asenna asiakslisäosat tähän versioon valitsemalla <b>Laitteet</b>-valikosta kohta <b>Asenna asiakaslisäosat...</b>.</p></translation>
     </message>
     <message>
@@ -6371,9 +6860,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Nouda</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Liitä</translation>
+        <translation type="obsolete">Liitä</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6529,8 +7018,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Näytä tietoja tuotteesta ikkunassa</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Uusi versio VirtualBoxista on julkaistu! Versio <b>%1</b> on saatavilla sivulta <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Voit noutaa tämän version seuraavasta linkistä: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Uusi versio VirtualBoxista on julkaistu! Versio <b>%1</b> on saatavilla sivulta <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Voit noutaa tämän version seuraavasta linkistä: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6652,7 +7141,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Yksi tai useampi kiintolevyistä, CD/DVD- tai levykemedioista ei ole tällä hetkellä saatavilla. Tästä johtuen et voi käyttää virtuaalikoneita, jotka käyttävät näitä taltioita, kunnes ne ovat taas saatavilla</p><p>Paina nappia <b>Tarkista</b>, jos haluat avata virtuaalimedioiden hallinnan ja selvittää mitkä taltiot eivät ole saatavilla, tai paina nappia <b>Älä huomioi</b> jos haluat jättää tämän viestin huomioimatta.</p&g [...]
+        <translation type="obsolete"><p>Yksi tai useampi kiintolevyistä, CD/DVD- tai levykemedioista ei ole tällä hetkellä saatavilla. Tästä johtuen et voi käyttää virtuaalikoneita, jotka käyttävät näitä taltioita, kunnes ne ovat taas saatavilla</p><p>Paina nappia <b>Tarkista</b>, jos haluat avata virtuaalimedioiden hallinnan ja selvittää mitkä taltiot eivät ole saatavilla, tai paina nappia <b>Älä huomioi</b> jos haluat jättää tämän viestin huomi [...]
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files will be automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if you want to terminate the VirtualBox application without any further actions.</p></source>
@@ -6686,8 +7175,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Korvaa</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Tapahtui kriittinen virhe suoritettaessa virtuaalikonetta, ja virtuaalikoneen suoritus on keskeytetty.</p><p>Jos tarvitset apua ongelmassa, lue lisää yhteisöosiosta sivulta <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> tai etsi yhteystiedot tukisopimuksestasi. Toimita vikaraportin mukana lokitiedostosi sisältö <tt>VBox.log</tt> sekä levykuvatiedosto <tt>VBox.png</tt>, jotka löydät kansiosta  [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Tapahtui kriittinen virhe suoritettaessa virtuaalikonetta, ja virtuaalikoneen suoritus on keskeytetty.</p><p>Jos tarvitset apua ongelmassa, lue lisää yhteisöosiosta sivulta <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> tai etsi yhteystiedot tukisopimuksestasi. Toimita vikaraportin mukana lokitiedostosi sisältö <tt>VBox.log</tt> sekä levykuvatiedosto <tt>VBox.png</tt>, jotka löy [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -6788,10 +7277,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">kiintolevy</translation>
     </message>
     <message>
-        <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Remove</source>
         <comment>medium</comment>
         <translation type="unfinished"></translation>
@@ -6841,10 +7326,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -6853,14 +7334,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6889,14 +7362,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7102,10 +7567,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7334,14 +7795,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7374,26 +7827,122 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Liitä</translation>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>Insert</source>
+        <comment>additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetAdditions</name>
@@ -7442,7 +7991,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished">&Nimi:</translation>
     </message>
     <message>
@@ -8204,14 +8753,18 @@ Kaikki VirtualBoxin komponentit käyttävät sitä koneen tunnistukseen.</p&g
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="unfinished"><h3>Tervetuloa VirtualBoxiin!</h3><p>Oikealla olevasta tilasta näet kaikki tällä tietokoneella olevat virtuaalikoneet. Luettelo on nyt tyhjä, koska et ole vielä luonut yhtäkään virtuaalikonetta.<img src=:/welcome.png align=right/></p><p>Jos haluat luoda uuden virtuaalikoneen, napsauta nappia <b>Uusi</b> ikkunan yläosassa olevasta työkalupalkista.</p><p>Voit lukea ohjeita painamalla <b&gt [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Tervetuloa VirtualBoxiin!</h3><p>Oikealla olevasta tilasta näet kaikki tällä tietokoneella olevat virtuaalikoneet. Luettelo on nyt tyhjä, koska et ole vielä luonut yhtäkään virtuaalikonetta.<img src=:/welcome.png align=right/></p><p>Jos haluat luoda uuden virtuaalikoneen, napsauta nappia <b>Uusi</b> ikkunan yläosassa olevasta työkalupalkista.</p><p>Voit lukea ohjeita painamalla <b>% [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -8240,7 +8793,7 @@ Kaikki VirtualBoxin komponentit käyttävät sitä koneen tunnistukseen.</p&g
     </message>
     <message>
         <source>Settings</source>
-        <translation type="unfinished">Asetukset</translation>
+        <translation type="obsolete">Asetukset</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -8293,6 +8846,10 @@ Kaikki VirtualBoxin komponentit käyttävät sitä koneen tunnistukseen.</p&g
         <source>Display</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8344,6 +8901,43 @@ Kaikki VirtualBoxin komponentit käyttävät sitä koneen tunnistukseen.</p&g
         <source>%1 - %2</source>
         <translation type="unfinished">%1 - %2</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Asetukset</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Sulje</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -8439,8 +9033,8 @@ Kaikki VirtualBoxin komponentit käyttävät sitä koneen tunnistukseen.</p&g
         <translation type="obsolete">Yhteenveto</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Uusi versio VirtualBoxista on julkaistu! Versio <b>%1</b> on saatavilla osoitteesta <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Voit noutaa uuden version seuraavasta linkistä:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Uusi versio VirtualBoxista on julkaistu! Versio <b>%1</b> on saatavilla osoitteesta <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Voit noutaa uuden version seuraavasta linkistä:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -8508,6 +9102,14 @@ Kaikki VirtualBoxin komponentit käyttävät sitä koneen tunnistukseen.</p&g
         <source>&Restore current snapshot '%1'</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -8521,14 +9123,180 @@ Kaikki VirtualBoxin komponentit käyttävät sitä koneen tunnistukseen.</p&g
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>Ei saatavilla</translation>
+        <source>&Close</source>
+        <translation type="obsolete">&Sulje</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
+        <source>%1 - Session Information</source>
+        <translation>%1 - tietoja istunnosta</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Yksityiskohdat</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Suoritusympäristö</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA-siirrot</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO-siirrot</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Luettu tieto</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Kirjoitettu tieto</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Lähetetty tieto</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Vastaanotettu tieto</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Käytössä</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Ei käytössä</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Suoritusympäristön ominaisuudet</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Näytön tarkkuus</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">CD/DVD-tilastot</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Verkkosovittimen tilastot</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Ei liitetty</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Versio %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Ei havaittu</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Ei havaittu</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Asiakaskoneen lisäosat</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Asiakaskäyttöjärjestelmän tyyppi</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Kiintolevytilastot</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Ei kiintolevyjä</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Ei verkkosovittimia</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Käytössä</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Ei käytössä</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Sisäkkäinen sivutus</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Sisäkkäinen sivutus</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>Ei saatavilla</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
         <translation><nobr>%1<br></nobr><nobr>%2 viimeksi %3</nobr><br><nobr>Istunto %4</nobr></translation>
     </message>
     <message>
@@ -8639,11 +9407,19 @@ Kaikki VirtualBoxin komponentit käyttävät sitä koneen tunnistukseen.</p&g
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -9573,11 +10349,11 @@ Version %1</source>
         <translation type="obsolete">Avaa jaettujen kansioiden käsittelyikkuna</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Asenna asiakaslisäosat...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Liitä asiakaslisäosien asennuslevykuva</translation>
     </message>
     <message>
@@ -9876,7 +10652,7 @@ Version %1</source>
         <translation type="obsolete">Näytä &tietoikkuna</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Näytä tietoja istunnosta</translation>
     </message>
     <message>
@@ -10172,8 +10948,8 @@ Version %1</source>
         <translation><palauta oletusarvo></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Todellinen oletuspolun arvo näytetään, kun muutokset on hyväksytty ja tämä ikkuna avataan uudestaan.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Todellinen oletuspolun arvo näytetään, kun muutokset on hyväksytty ja tämä ikkuna avataan uudestaan.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -10221,8 +10997,7 @@ Version %1</source>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Todellinen oletuspolun arvo näytetään, kun muutokset on hyväksytty ja tämä ikkuna avataan uudestaan.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10604,7 +11379,7 @@ Version %1</source>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -11386,21 +12161,6 @@ Version %1</source>
         <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
     <message numerus="yes">
         <source>%n year(s)</source>
         <translation type="unfinished">
@@ -11444,10 +12204,6 @@ Version %1</source>
         </translation>
     </message>
     <message>
-        <source>(CD/DVD)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Screens</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -11903,12 +12659,12 @@ Version %1</source>
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished">Käytössä</translation>
+        <translation type="obsolete">Käytössä</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished">Ei käytössä</translation>
+        <translation type="obsolete">Ei käytössä</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -11971,7 +12727,151 @@ Version %1</source>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Ei mitään</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Oletus</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12566,6 +13466,18 @@ Version %1</source>
         <source>Modify the attributes of the selected disk image file</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -12663,8 +13575,8 @@ Version %1</source>
         <translation type="obsolete">Yhteyden kättely ei onnistunut.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Täytä tämä rekisteröintikaavake, jolla kerrot meille käyttäväsi VirtualBoxia ja jolla voit lisäksi halutessasi rekisteröityä vastaanottamaan uutisia ja päivityksiä VirtualBoxiin liittyen.</p><p>Anna koko nimesi, käyttäen vain ASCII-merkistöä, sekä sähköpostiosoitteesi alla oleviin kenttiin. Huomaa, että Sun Microsystems käyttää näitä tietoja vain kerätäkseen tuoteen käyttötilastoja ja VirtualBoxin uutiskirjeen lähettämiseen. Sun M [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Täytä tämä rekisteröintikaavake, jolla kerrot meille käyttäväsi VirtualBoxia ja jolla voit lisäksi halutessasi rekisteröityä vastaanottamaan uutisia ja päivityksiä VirtualBoxiin liittyen.</p><p>Anna koko nimesi, käyttäen vain ASCII-merkistöä, sekä sähköpostiosoitteesi alla oleviin kenttiin. Huomaa, että Sun Microsystems käyttää näitä tietoja vain kerätäkseen tuoteen käyttötilastoja ja VirtualBoxin uutiskirjeen lähettämiseen. Sun M [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -12961,8 +13873,8 @@ Version %1</source>
         <translation type="obsolete">Keskeytä virtuaalikoneen suoritus</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Tervetuloa VirtualBoxiin!</h3><p>Oikealla olevasta tilasta näet kaikki tällä tietokoneella olevat virtuaalikoneet. Luettelo on nyt tyhjä, koska et ole vielä luonut yhtäkään virtuaalikonetta.<img src=:/welcome.png align=right/></p><p>Jos haluat luoda uuden virtuaalikoneen, napsauta nappia <b>Uusi</b> ikkunan yläosassa olevasta työkalupalkista.</p><p>Voit lukea ohjeita painamalla <b>% [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Tervetuloa VirtualBoxiin!</h3><p>Oikealla olevasta tilasta näet kaikki tällä tietokoneella olevat virtuaalikoneet. Luettelo on nyt tyhjä, koska et ole vielä luonut yhtäkään virtuaalikonetta.<img src=:/welcome.png align=right/></p><p>Jos haluat luoda uuden virtuaalikoneen, napsauta nappia <b>Uusi</b> ikkunan yläosassa olevasta työkalupalkista.</p><p>Voit lukea ohjeita painamalla <b>% [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -13573,168 +14485,6 @@ to access it from a Linux OS. This feature requires Guest Additions.</qt><
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">&Sulje</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - tietoja istunnosta</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Yksityiskohdat</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Suoritusympäristö</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA-siirrot</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO-siirrot</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Luettu tieto</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Kirjoitettu tieto</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Lähetetty tieto</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Vastaanotettu tieto</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Käytössä</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Ei käytössä</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Suoritusympäristön ominaisuudet</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Näytön tarkkuus</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">CD/DVD-tilastot</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Verkkosovittimen tilastot</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Ei liitetty</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Versio %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Ei havaittu</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Ei havaittu</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Asiakaskoneen lisäosat</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Asiakaskäyttöjärjestelmän tyyppi</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Kiintolevytilastot</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Ei kiintolevyjä</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Ei verkkosovittimia</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Käytössä</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Ei käytössä</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Sisäkkäinen sivutus</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Sisäkkäinen sivutus</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts
index 865f755..de29aad 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_fr.ts
@@ -91,10 +91,6 @@
         <source>The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necess [...]
         <translation>Le pilote du noyau Linux de VirtualBox (vboxdrv) n'est soit pas chargé ou il y a un problème de permission sur /dev/vboxdrv. Veuillez réinstaller le module noyau en éxécutant<br><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/> en tant qu'administrateur. S'il n'est pas disponible pour votre distribution, vous devriez installer d'abord le paquet DKMS. Ce paquet garde la trace des [...]
     </message>
-    <message>
-        <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation type="obsolete">Taille de l'image : %1x%2, Taux de raffraîchissement de l'image : %3 ips, Taux de débit : %4kbps</translation>
-    </message>
 </context>
 <context>
     <name>QIArrowSplitter</name>
@@ -233,11 +229,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Désactiver l'intégration &souris</translation>
+        <translation type="obsolete">Désactiver l'intégration &souris</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Désactiver temporairement l'intégration de la souris</translation>
+        <translation type="obsolete">Désactiver temporairement l'intégration de la souris</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -249,11 +245,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Insérer Ctrl-Alt-&Suppr</translation>
+        <translation type="obsolete">Insérer Ctrl-Alt-&Suppr</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Envoie la séquence Ctrl-Alt-Suppr à la machine virtuelle</translation>
+        <translation type="obsolete">Envoie la séquence Ctrl-Alt-Suppr à la machine virtuelle</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -261,7 +257,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Envoie la séquence Ctrl-Alt-Retour à la machine virtuelle</translation>
+        <translation type="obsolete">Envoie la séquence Ctrl-Alt-Retour à la machine virtuelle</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -333,15 +329,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&Lecteurs CD/DVD</translation>
+        <translation type="obsolete">&Lecteurs CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Lecteurs de &disquette</translation>
+        <translation type="obsolete">Lecteurs de &disquette</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&Périphériques USB</translation>
+        <translation type="obsolete">&Périphériques USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -457,15 +453,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Passer en mode &plein écran</translation>
+        <translation type="obsolete">Passer en mode &plein écran</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Permuter entre mode normal et plein écran</translation>
+        <translation type="obsolete">Permuter entre mode normal et plein écran</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Utiliser le &bureau intégré</translation>
+        <translation type="obsolete">Utiliser le &bureau intégré</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -473,7 +469,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Passer en mode &redimensionné</translation>
+        <translation type="obsolete">Passer en mode &redimensionné</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -721,7 +717,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>&Insérer Ctrl-Alt-Supprime</translation>
+        <translation type="obsolete">&Insérer Ctrl-Alt-Supprime</translation>
     </message>
     <message>
         <source>&Group</source>
@@ -865,83 +861,298 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Glisser-Déposer</translation>
+        <translation type="obsolete">Glisser-Déposer</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>Sauvegarder l'état de la machine virtuelle</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>Éteindre la machine virtuelle</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>Réglages &réseau...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation>Réglages des dossier&s partagés...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>Affichag&e distant</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>Permuter les connexions de bureau distant (RDP) à cette machine</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>Capture &vidéo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation>Permuter la capture vidéo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation>Réglages de la capture &vidéo...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>Configurer les réglages de capture vidéo</translation>
-    </message>
-    <message>
-        <source>&Logging...</source>
-        <comment>debug action</comment>
-        <translation>Journa&lisation...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Popup Menu</source>
-        <translation>Menu contextuel</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show Session Information Window</source>
-        <translation>Afficher la fenêtre d'information de session</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Webcams</source>
-        <translation>&Webcams</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <translation>&Insérer l'image CD des Additions Invité...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Insère le fichier d'image disque des Additions Invité dans le lecteur virtuel</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Réseau</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Afficher le &journal...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Fichier</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
-    <name>UIActonPool</name>
+    <name>UIActionPoolRuntime</name>
     <message>
-        <source>Popup Menu</source>
-        <translation type="obsolete">Menu contextuel</translation>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Activer</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
     </message>
 </context>
 <context>
@@ -976,7 +1187,7 @@
     </message>
     <message>
         <source>Description</source>
-        <translation>Déscription</translation>
+        <translation>Description</translation>
     </message>
     <message>
         <source>License</source>
@@ -1752,6 +1963,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1762,7 +1980,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Abandon des données...</translation>
+        <translation type="obsolete">Abandon des données...</translation>
     </message>
 </context>
 <context>
@@ -1818,6 +2036,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Appliance Export Wizard</source>
@@ -2252,7 +2496,7 @@
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2447,80 +2691,175 @@
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation>Fichier de capture vidéo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation>Attributs de la capture vidéo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation>Capture vidéo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation>Désactivée</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Réseau NAT, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>Taille de l'image : %1x%2, Taux de raffraîchissement de l'image : %3 ips, Taux de débit : %4kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Contrôleur </translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Mémoire vidéo </translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Écrans </translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>2D Video</source>
-        <comment>details report</comment>
-        <translation type="obsolete">2D </translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>3D</source>
-        <comment>details report</comment>
-        <translation type="obsolete">3D </translation>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Contrôleur USB</translation>
     </message>
     <message>
-        <source>Acceleration</source>
-        <comment>details</comment>
-        <translation type="obsolete">Accélération </translation>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadNetwork</name>
     <message>
-        <source>Bridged adapter, %1</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Pont avec l'interface %1 </translation>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Internal network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Réseau interne, '%1' </translation>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Contrôleur </translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Mémoire vidéo </translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Écrans </translation>
+    </message>
+    <message>
+        <source>2D Video</source>
+        <comment>details report</comment>
+        <translation type="obsolete">2D </translation>
+    </message>
+    <message>
+        <source>3D</source>
+        <comment>details report</comment>
+        <translation type="obsolete">3D </translation>
+    </message>
+    <message>
+        <source>Acceleration</source>
+        <comment>details</comment>
+        <translation type="obsolete">Accélération </translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadNetwork</name>
+    <message>
+        <source>Bridged adapter, %1</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Pont avec l'interface %1 </translation>
+    </message>
+    <message>
+        <source>Internal network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Réseau interne, '%1' </translation>
     </message>
     <message>
         <source>Host-only adapter, '%1'</source>
@@ -2732,7 +3071,7 @@
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation>Paquetages d'&extension</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2782,29 +3121,16 @@
         <translation type="obsolete">Désactiver l'é&conomiseur d'écran hôte</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>&Dock et Barre de menu :</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translatorcomment>[BM]Needs to be checked</translatorcomment>
-        <translation>Plein écran automatique</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Si cochée, le dock et la barre de menu de l'hôte seront affichés lorsque la machine virtuelle est mode plein écran.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>Economiseur d'écran de l'&hôte :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>Si cochée, l'économiseur d'écran de l'hôte sera désactivé lorsque qu'une machine virtuelle est en fonctionnement.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>Désactiver pendant le fonctionnement de machines virtuelles</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2843,27 +3169,27 @@
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>Combinaison de touches hôte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>Plusieurs éléments ont les mêmes raccourci assignés.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation>Gestionnaire &VirtualBox</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>&Machine virtuelle</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Liste tous les raccourcis disponibles qui peuvent être configurés.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Entrer une séquence de filtrage de la liste de raccourcis.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2922,7 +3248,7 @@
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>Langues de l'&interface</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3079,131 +3405,128 @@
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation>Réseaux &NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation>Liste tous les réseaux NAT disponibles.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translatorcomment>[BM]Must match with other translation of host-only elsewhere, yet to be checked.</translatorcomment>
-        <translation>Réseau &hôte uniquement</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Aucun nouveau nom spécifié pour le réseau NAT précédemment nommé <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation>Aucun CIDR spécifié pour le réseau NAT <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Aucun CIDR spécifié pour le réseau NAT précédemment nommé <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation>Le CIDR spécifié (<i>%1</i>) pour le réseau NAT <b>%2</> est invalide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translatorcomment>[BM]Called as in named could be then translated by nommé. Actual translation makes sense at this stage.</translatorcomment>
-        <translation>Le CIDR spécifié (<i>%1</i>) pour le réseau NAT appelé auparavant <b>%2</> est invalide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translatorcomment>[BM]Or Nom de réseau, if context is a network settings dialog for example.</translatorcomment>
-        <translation>Nom du réseau</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation>[vide]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (renommé depuis %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation>Précédent nom de réseau</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation>Nouveau nom de réseau</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation>Réseau CIDR</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation>Supporte le DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>yes</source>
-        <translation>oui</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>no</source>
-        <translation>non</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation>Supporte l'IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation>Route IPv6 par défaut</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation>L'interface hôte <b>%1</b> ne dispose pas actuellement d'adresse IPv4 valide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation>L'interface hôte <b>%1</b> n'a pas actuellement de masque de réseau IPv4 valide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation>L'interface hôte <b>%1</b> ne dispose pas actuellement d'adresse IPv6 valide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation>L'interface hôte <b>%1</b> n'a pas actuellement d'adresse de serveur DHCP valide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>L'interface hôte <b>%1</b> n'a pas actuellement de masque d'adresse de serveur DHCP valide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>L'interface hôte <b>%1</b> ne dispose pas actuellement de limite inférieure d'adresse de serveur DHCP valide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>L'interface hôte <b>%1</b> ne dispose pas actuellement de limite supérieure d'adresse de serveur DHCP valide.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>Le nom <b>%1</b> est actuellement utilisé pour plusieurs réseaux NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>Actif</translation>
+        <translation type="unfinished">Active</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>&Ajouter un réseau NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation>&Retirer le réseau NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation>&Éditer le réseau NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3305,177 +3628,177 @@
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation>Détails du réseau privé hôte</translation>
+        <translation type="unfinished">Détails du réseau privé hôte</translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation>C&arte</translation>
+        <translation type="unfinished">&Interface</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation>&Configuration manuelle</translation>
+        <translation type="unfinished">&Configuration manuelle</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>Utiliser la configuration manuelle pour cette interface de réseau privé hôte.</translation>
+        <translation type="unfinished">Utiliser la configuration manuelle pour cette interface de réseau privé hôte.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation>Adresse &IPv4 :</translation>
+        <translation type="unfinished">Adresse &IPv4 :</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>Affiche l'adresse IPv4 hôte pour cette carte.</translation>
+        <translation type="unfinished">Affiche l'adresse IPv4 hôte pour cette interface.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation>&Masque réseau IPv4 :</translation>
+        <translation type="unfinished">&Masque réseau IPv4 :</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>Affiche le masque réseau IPv4 hôte pour cette carte.</translation>
+        <translation type="unfinished">Affiche le masque réseau IPv4 hôte pour cette interface.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation>Adresse I&Pv6 :</translation>
+        <translation type="unfinished">Adresse I&Pv6 :</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>Affiche l'adresse IPv6 hôte pour cette carte si l'IPv6 est supporté.</translation>
+        <translation type="unfinished">Affiche l'adresse IPv6 hôte pour cette interface si l'IPv6 est supporté.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation>&Longueur du masque réseau IPv6 :</translation>
+        <translation type="unfinished">&Longueur du masque réseau IPv6 :</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>Affiche la longueur du préfixe du masque réseau IPv6 pour cette carte si l'IPv6 est supporté.</translation>
+        <translation type="unfinished">Affiche la longueur du préfixe du masque réseau IPv6 pour cette interface si l'IPv6 est supporté.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation>Serveur &DHCP</translation>
+        <translation type="unfinished">Serveur &DHCP</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>&Activer le serveur</translation>
+        <translation type="unfinished">&Activer le serveur</translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation>Indique si le serveur DHCP est activé au démarrage de la machine ou non.</translation>
+        <translation type="unfinished">Indique si le serveur DHCP est activé au démarrage de la machine.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation>Ad&resse du serveur :</translation>
+        <translation type="unfinished">Ad&resse du serveur :</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Affiche l'adresse du serveur DHCP du réseau associé à cette carte de réseau privé hôte.</translation>
+        <translation type="unfinished">Affiche l'adresse du serveur DHCP du réseau associé à cette interface de réseau privé hôte.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation>&Masque serveur :</translation>
+        <translation type="unfinished">&Masque serveur :</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Affiche le masque réseau du serveur DHCP du réseau associé à cette carte de réseau privé hôte.</translation>
+        <translation type="unfinished">Affiche le masque réseau du serveur DHCP du réseau associé à cette interface de réseau privé hôte.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation>&Limite inférieure des adresses :</translation>
+        <translation type="unfinished">&Limite inférieure des adresses :</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Affiche la limite inférieure de la plage d'adresses du serveur DHCP du réseau associé à cette carte de réseau privé hôte.</translation>
+        <translation type="unfinished">Affiche la limite inférieure de la plage d'adresses du serveur DHCP du réseau associé à cette interface de réseau privé hôte.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation>Limite s&upérieure des adresses :</translation>
+        <translation type="unfinished">Limite s&upérieure des adresses :</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Affiche la limite supérieure de la plage d'adresses du serveur DHCP du réseau associé à cette carte de réseau privé hôte.</translation>
+        <translation type="unfinished">Affiche la limite supérieure de la plage d'adresses du serveur DHCP du réseau associé à cette interface de réseau privé hôte.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation>Détails de réseau NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation>Activ&er le réseau</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation>Activer ce réseau NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation>&Nom de réseau :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>Contient le nom de ce réseau.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation>&CIDR du réseau :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>Contient le CIDR pour ce réseau.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation>Options réseau :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation>Supporte le &DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation>Détermine si ce réseau supporte le DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation>Supporte l'&IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>Détermine si ce réseau supporte l'IPv6.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>Annoncer la &route IPv6 par défaut</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation>Détermine si ce réseau doit être annoncé comme la route IPv6 par défaut.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Ouvre une fenêtre pour gérer les règles de redirection de ports.</translation>
+        <translation type="unfinished">Ouvre une fenêtre pour gérer les règles de redirection de ports.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation>Redirection de &ports</translation>
+        <translation type="unfinished">Redirection de &ports</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>Règles de redirection de ports</translation>
+        <translation type="unfinished">Règles de redirection de ports</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation>IPv4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation>IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3530,11 +3853,11 @@
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>Aucun hôte proxy actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>Aucun port proxy actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3599,71 +3922,71 @@
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation><touche_%1></translation>
+        <translation type="unfinished"><Touche_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation>Gauche </translation>
+        <translation type="unfinished">Gauche </translation>
     </message>
     <message>
         <source>Right </source>
-        <translation>Droite </translation>
+        <translation type="unfinished">Droite </translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation>Maj. gauche</translation>
+        <translation type="unfinished">Maj gauche</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation>Maj. droite</translation>
+        <translation type="unfinished">Maj droite</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation>Ctrl gauche</translation>
+        <translation type="unfinished">Ctrl gauche</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation>Ctrl droite</translation>
+        <translation type="unfinished">Ctrl droite</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation>Alt gauche</translation>
+        <translation type="unfinished">Alt gauche</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation>Alt droite</translation>
+        <translation type="unfinished">Alt droite</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation>Windows gauche</translation>
+        <translation type="unfinished">Windows gauche</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation>Windows droite</translation>
+        <translation type="unfinished">Windows droite</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation>Touche menu</translation>
+        <translation type="unfinished">Touche menu</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation>Alt Gr</translation>
+        <translation type="unfinished">Alt Gr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>Verrouillage Majuscules</translation>
+        <translation type="unfinished">Verr Maj</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation>Arrêt défilement</translation>
+        <translation type="unfinished">Arrêt défil</translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation>Hôte+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
-        <translation>Aucun(e)</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3851,23 +4174,22 @@
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation>Réinitialiser le raccourci par défaut</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation>Supprimer le raccourci</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation>Nom</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translatorcomment>Kept as Latin Alias on Macs ;-)</translatorcomment>
-        <translation>Raccourci</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3960,12 +4282,12 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indique l'activité des lecteurs CD/DVD :</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indique l'activité des lecteurs CD/DVD :</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indique l'activité des lecteurs de disquette :</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indique l'activité des lecteurs de disquette :</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4005,7 +4327,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Le contrôleur USB est désactivé</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Le contrôleur USB est désactivé</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4058,20 +4380,34 @@
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Indique l'activité de la capture vidéo : </nobr><br>%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>Capture vidéo désactivée</b></nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>Fichier de capture vidéo : </b>%1</nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation>Status de la fonctionalité supplémentaire : <br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4145,11 +4481,11 @@
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>Aucune Webcam connectée</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Aucune Webcam supportée connectée</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
@@ -4199,7 +4535,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Vidéo</translation>
+        <translation type="obsolete">&Vidéo</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4312,133 +4648,197 @@
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>&Capture vidéo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>Si cochée, VirtualBox enregistrera la session de machine virtuelle dans un fichier vidéo.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation>Activ&er la capture vidéo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>&Chemin du fichier :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Ce paramètre détermine le nom du fichier que VirtualBox utilise pour le contenu enregistré.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>&Taille de l'image :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>Ce paramètre détermine la résolution (taille d'image) de la vidéo enregistrée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>Ce paramètre détermine la résolution <b>horizontale</b> (largeur d'image) de la vidéo enregistrée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>Ce paramètre détermine la résolution <b>verticale</b> (hauteur d'image) de la vidéo enregistrée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>&Images par seconde :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>Ce paramètre détermine le nombre maximum d'<b>images par seconde</b>. Les images supplémentaires seront ignorées. La réduction de cette valeur augmentera le nombre d'images ignorées et réduira la taille du fichier.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation>&Qualité :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Ce paramètre détermine la <b>qualité</b>. L'augementation de cette valeur améliorera le rendu de la vidéo au prix d'une taille de fichier plus grande.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Ce paramètre détermine le débit en <b>kilobits par seconde</b>. L'augementation de cette valeur améliorera le rendu de la vidéo au prix d'une taille de fichier plus grande.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation>Ecran&s :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>La machine virtuelle est paramètrée pour utiliser l'accélaration graphique matérielle. Cependant le système hôte ne propose actuellement pas cette fonctionnalité. Vous ne pourrez donc pas démarrer la machine.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>Moins de <b>%1</b> de la mémoire vidéo est actuellement alloué à la machine virtuelle, ce qui est le minimum nécessaire pour basculer en mode plein écran ou en mode intégré.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>Moins de <b>%1</b> de la mémoire vidéo est actuellement alloué à la machine virtuelle, ce qui est le minimum recquis pour la reproduction efficace de la vidéo HD.</translation>
-    </message>
-    <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>La machine virtuelle est paramétrée pour utiliser l'accélération graphique et l'indicateur de système d'exploitation est réglé sur Windows Vista ou ultérieur. Pour de meilleures performances, vous devriez régler la mémoire vidéo de la machine à au moins <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>La machine virtuelle est paramètrée pour utiliser l'accélération des flux vidéo. Dans le mesure où cette fonctionnalité ne s'applique qu'aux systèmes invités Windows, elle sera désactivée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>La valeur du port du serveur VRDE n'est actuellement pas spécifiée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>La valeur du délai d'authentification n'est actuellement pas spécifiée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation>Défini par l'utilisateur</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation>%1 ips</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>fps</source>
-        <translation>ips</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation>basse</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation>moyenne</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation>haute</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation>kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation>Ecran %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation>Activer l'enregistrement vidéo pour l'écran %1.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Barre d'outils compacte :</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Si cette case est cochée la barre d'outils compacte sera affichée en modes plein écran et intégré.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">A&fficher en plein écran/mode intégré</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Si cette case est cochée la barre d'outils compacte sera affichée en haut de l'écran, plutôt qu'en bas comme par défaut.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Afficher en hau&t de l'écran</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">3D  {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">3D  {200%?}</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4449,7 +4849,7 @@
         <translation>Affiche le dossier dans lequel les instantanés de cette machine virtuelle seront sauvegardés. Sachez que les instantanés peuvent prendre beaucoup de place.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Simple</translation>
     </message>
     <message>
@@ -4461,7 +4861,7 @@
         <translation type="obsolete">Affiche le nom de la machine virtuelle.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avancé</translation>
     </message>
     <message>
@@ -4477,7 +4877,7 @@
         <translation>Dossier des i&nstantanés :</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Description</translation>
     </message>
     <message>
@@ -4486,42 +4886,42 @@
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Si cette case est cochée tous les changements apportés aux CD, DVD et disquettes pendant que la machine virtuelle est en fonction seront enregistrés dans la configuration de la machine.</translation>
+        <translation type="obsolete">Si cette case est cochée tous les changements apportés aux CD, DVD et disquettes pendant que la machine virtuelle est en fonction seront enregistrés dans la configuration de la machine.</translation>
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Média amovible :</translation>
+        <translation type="obsolete">Média amovible :</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>En&registrer les changements pendant l'exécution</translation>
+        <translation type="obsolete">En&registrer les changements pendant l'exécution</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Barre d'outils compacte :</translation>
+        <translation type="obsolete">Barre d'outils compacte :</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Si cette case est cochée la barre d'outils compacte sera affichée en modes plein écran et intégré.</translation>
+        <translation type="obsolete">Si cette case est cochée la barre d'outils compacte sera affichée en modes plein écran et intégré.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>A&fficher en plein écran/mode intégré</translation>
+        <translation type="obsolete">A&fficher en plein écran/mode intégré</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Afficher en hau&t de l'écran</translation>
+        <translation type="obsolete">Afficher en hau&t de l'écran</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Si cette case est cochée la barre d'outils compacte sera affichée en haut de l'écran, plutôt qu'en bas comme par défaut.</translation>
+        <translation type="obsolete">Si cette case est cochée la barre d'outils compacte sera affichée en haut de l'écran, plutôt qu'en bas comme par défaut.</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">vous avez choisi un système de type 64 bit pour cette machine virtuelle. Comme la virtualisation matérielle de l'hôte (VT-x/AMD-V) est nécessaire pour un tel invité, elle sera automatiquement activée.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>&Glisser-Déposer :</translation>
     </message>
     <message>
@@ -4529,12 +4929,108 @@
         <translation>Définit quelles données seront copiées entre l'invité et l'hôte par glisser-déposer. Cette fonctionnalité nécessite que les additions invités soient installées sur le SE invité.</translation>
     </message>
     <message>
-        <source>No name specified for the virtual machine.</source>
-        <translation>Aucun nom spécifié pour la machine virtuelle.</translation>
+        <source>No name specified for the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">3D  {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">3D  {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Barre d'outils compacte :</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Si cette case est cochée la barre d'outils compacte sera affichée en modes plein écran et intégré.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">A&fficher en plein écran/mode intégré</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Si cette case est cochée la barre d'outils compacte sera affichée en haut de l'écran, plutôt qu'en bas comme par défaut.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Afficher en hau&t de l'écran</translation>
     </message>
     <message>
-        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>L'indicateur de système d'exploitation virtuel est défini sur le type 64 bits. Les systèmes invités 64 bits nécessitent la virtualisation matérielle, elle sera donc automatiquement activée si vous confirmez les modifications.</translation>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4674,35 +5170,35 @@
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation>Aucun adaptateur de réseau ponté actuellement sélectionné.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>Aucun nom de réseau interne actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>Aucun nom d'adaptateur réseau hôte uniquement actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation>Aucun pilote générique actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>L'adresse MAC doit avoir 12 chiffres héxadécimaux de longueur.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation>Le deuxième chiffre dans l'adresse MAC ne peut être impair car seules les adresses unicast sont autorisées.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>Aucun nom de réseau NAT actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>Contient le nom du réseau NAT auquel cette carte réseau sera connectée. Vous pouvez créer et supprimer des réseau en utilisant les paramètres globaux de réseau dans la fenêtre du gestionnaire de machine virtuelle.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4769,24 +5265,23 @@
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translatorcomment>[BM]Interuption is femine in French</translatorcomment>
-        <translation>Aucune IRQ actuellement spécifiée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Aucun port E/S actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Plusieurs ports ont les mêmes paramètres.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Aucun chemin de port actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Plusieurs chemins de port sont actuellement en double.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4946,10 +5441,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Si cette case est cochée le dossier partagé sera créé de façon permanente.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Fenêtre</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -4988,15 +5479,15 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Si cette case est cochée le tube spécifié dans le champ <b>Chemin du port</b> sera créé lors du lancement de la machine virtuelle ; sinon elle essaiera de l'utiliser comme s'il existait.</translation>
+        <translation type="obsolete">Si cette case est cochée le tube spécifié dans le champ <b>Chemin du port</b> sera créé lors du lancement de la machine virtuelle ; sinon elle essaiera de l'utiliser comme s'il existait.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Créer le tube</translation>
+        <translation type="obsolete">&Créer le tube</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Affiche le chemin vers le tube de l'hôte pour le port série (quand il fonctionne en mode <b>tube hôte</b>) ou le nom du périphérique série (quand il fonctionne en mode <b>périphérique hôte</b>). </translation>
+        <translation type="obsolete">Affiche le chemin vers le tube de l'hôte pour le port série (quand il fonctionne en mode <b>tube hôte</b>) ou le nom du périphérique série (quand il fonctionne en mode <b>périphérique hôte</b>). </translation>
     </message>
     <message>
         <source>I/O Po&rt:</source>
@@ -5004,7 +5495,7 @@
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Port/Chemin :</translation>
+        <translation type="obsolete">&Port/Chemin :</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5014,6 +5505,22 @@
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Affiche l'adresse E/S de ce port série. Celle-ci doit être un nombre entier compris entre <tt>0</tt> et <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5031,23 +5538,23 @@
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>Aucune IRQ actuellement spécifiée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Aucun port E/S actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Plusieurs ports ont les mêmes paramètres.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Aucun chemin de port actuellement spécifié.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Les chemins de port spécifié sont actuellement en double.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5070,15 +5577,15 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Ajouter&nbsp;lecteur&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Ajouter&nbsp;lecteur&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Ajouter&nbsp;lecteur&nbsp;de&nbsp;disquettes</nobr></translation>
+        <translation type="obsolete"><nobr>Ajouter&nbsp;lecteur&nbsp;de&nbsp;disquettes</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>Aucun disque dur n'est affecté à <i>%1</i>.</translation>
+        <translation type="unfinished">Aucun disque dur n'est affecté à <i>%1</i>.</translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -5118,11 +5625,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Ajouter un lecteur CD/DVD</translation>
+        <translation type="obsolete">Ajouter un lecteur CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Ajouter un lecteur de disquettes</translation>
+        <translation type="obsolete">Ajouter un lecteur de disquettes</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5310,15 +5817,15 @@
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&Lecteur CD/DVD :</translation>
+        <translation type="obsolete">&Lecteur CD/DVD :</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Choisissez un disque CD/DVD virtuel ou un lecteur physique pour utiliser avec le lecteur virtuel. La machine virtuelle vera un disque inséré dans le lecteur avec comme contenu les données dans le fichier ou sur le disque.</translation>
+        <translation type="obsolete">Choisissez un disque CD/DVD virtuel ou un lecteur physique pour utiliser avec le lecteur virtuel. La machine virtuelle vera un disque inséré dans le lecteur avec comme contenu les données dans le fichier ou sur le disque.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Configuration dulecteur de CD/DVD virtuel</translation>
+        <translation type="obsolete">Configuration dulecteur de CD/DVD virtuel</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5342,7 +5849,7 @@
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Choisissez un fichier de CD/DVD virtuel...</translation>
+        <translation type="obsolete">Choisissez un fichier de CD/DVD virtuel...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5413,19 +5920,67 @@
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>Aucun nom n'est actuellement spécifié pour le contrôleur à la position <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>Le contrôleur à la position <b>%1</b> a le même nom que le contrôleur à la position <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> utilise un disque qui déjà attaché à <i>%2</i>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>La machine dispose actuellement de plus de contrôleurs de stockage assigné qu'un chipset %1 ne le supporte. Veuillez changer le type de chipset dans les paramètres Système ou réduire le nombre de contrôleurs de stockage suivants dans la page des paramètres Stockage : %2</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Choisissez un fichier de disque optique virtuel...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5632,47 +6187,55 @@
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>Système de &pointage : </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Détermine si le système de pointage émulé est une souris PS/2 standard, une tablette USB ou une tablette multi-touch.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>Plus de <b>%1%</b> de mémoire de l'ordinateur hôte (<b>%2</b>) est assigné à la machine virtuelle. Il ne reste plus assez de mémoire pour le système d'exploitation hôte. Veuillez choisir une quantité moins élevée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>Plus de <b>%1%</b> de mémoire de l'ordinateur hôte (<b>%2</b>) est assigné à la machine virtuelle. Il pourrait ne plus rester assez de mémoire pour le système d'exploitation hôte. Veuillez choisir une quantité moins élevée.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>La fonctionnalité E/S APIC n'est actuellement pas activée dans la section Carte-mère de la page Système. Cela est nécessaire afin de pouvoir supporter un chipset de type ICH9. Cela sera fait automatiquement si vous confirmez vos changements.</translation>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>L'émulation de contrôleur USB n'est actuellement pas activée sur la page des réglages USB. Cela est nécessaire afin de pouvoir supporter un système d'entrée USB émulé. Cela sera fait automatiquement si vous confirmez vos changements.</translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>Pour des raisons de performance, le nombre de processeurs virtuels alloués à la machine virtuelle ne peut être supérieure au double du nombre de processeurs physiques sur l'hôte (<b>%1</b>). Veuillez réduire le nombre de processeurs virtuels.</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>Le nombre de processeurs virtuels alloués à la machine virtuelle est supérieure au nombre de processeurs physiques sur l'hôte (<b>%1</b>). Veuillez considérer la réduction du nombre de processeurs virtuels.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La fonctionnalité E/S APIC n'est actuellement pas activée dans la section Carte-mère de la page Système. Cela est nécessaire afin de pouvoir supporter un chipset de type ICH9. Cela sera fait automatiquement si vous confirmez vos changements.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La virtualisation matérielle n'est actuellement pas activée dans la section Accélération de la page de réglages Système. Cela sera fait automatiquement si vous confirmez vos changements.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>Le limiteur d'exécution du procésseur est réglé sur une valeur basse. Cela pourrait rendre la machine peu répondante.</translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5745,7 +6308,7 @@
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Activer le contrôleur USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">Activer le contrôleur USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5808,8 +6371,28 @@
         <translation type="obsolete">USB 2.0 est activée pour cette machine virtuelle, mais ceci nécessite que l'extension <b>%1</b> soit installée. Veuillez installer l'extension à partir du site de téléchargement VirtualBox. Vous pourrez alors réactiver USB 2.0. En attendant, la fonctionnalité sera désactivée si vous n'annulez pas les changements actuels.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>L'USB 2.0 est actuellement activé pour cette machine virtuelle. L'installation de <b>%1</b> est cependant requise. Veuillez installer le pack d'extension depuis le site de téléchargement VirtualBox ou desactiver l'USB 2.0 afin de pouvoir démarrer la machine.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5948,7 +6531,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Fermer</translation>
+        <translation type="obsolete">&Fermer</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5967,6 +6554,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Fermer</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Basculer</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6008,7 +6618,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Échec de la création de l'objet COM de VirtualBox.</p><p>Le programme va s'arrêter.</p></translation>
+        <translation type="obsolete"><p>Échec de la création de l'objet COM de VirtualBox.</p><p>Le programme va s'arrêter.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -6326,7 +6936,7 @@
     <message>
         <source>Check</source>
         <comment>inaccessible media message box</comment>
-        <translation>Vérifier</translation>
+        <translation>Tester</translation>
     </message>
     <message>
         <source>Switch</source>
@@ -6430,8 +7040,8 @@
         <translation type="obsolete">Affiche dans une fenêtre des informations sur ce produit</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Une nouvelle version de VirtualBox est disponible ! La version <b>%1</b> est disponible sur <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Vous pouvez télécharger cette version en utilisant le lien suivant : </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Une nouvelle version de VirtualBox est disponible ! La version <b>%1</b> est disponible sur <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Vous pouvez télécharger cette version en utilisant le lien suivant : </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6511,11 +7121,11 @@
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Un ou plusieurs disques durs virtuels, CD, DVD, ou disquettes ne sont pas pas accessibles pour l'instant. Vous ne pourrez démarrer de machines virtuelles qui les utilisent tant qu'ils ne seront pas accessibles.</p><p>Cliquez sur <b>Vérifier</b> pour ouvrir le Gestionnaire de médias virtuels et voir quels médias sont inaccessibles, ou bien sur <b>Ignorer</b> pour ignorer ce message.</p></translation>
+        <translation type="obsolete"><p>Un ou plusieurs disques durs virtuels, CD, DVD, ou disquettes ne sont pas pas accessibles pour l'instant. Vous ne pourrez démarrer de machines virtuelles qui les utilisent tant qu'ils ne seront pas accessibles.</p><p>Cliquez sur <b>Ouvrir</b> pour ouvrir le Gestionnaire de médias virtuels et voir quels médias sont inaccessibles, ou bien sur <b>Ignorer</b> pour ignorer ce message.</p></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Une erreur critique est survenue pendant l'exécution de la machine virtuelle et cette dernière a été arrêtée.</p><p>Pour obtenir de l'aide vous pouvez vous rendre dans la section Community de <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> ou consulter votre contrat de support. Postez le fichier journal <tt>VBox.log</tt> et le fichier image <tt>VBox.png</tt> que vous trouverez dans l [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Une erreur critique est survenue pendant l'exécution de la machine virtuelle et cette dernière a été arrêtée.</p><p>Pour obtenir de l'aide vous pouvez vous rendre dans la section Community de <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> ou consulter votre contrat de support. Postez le fichier journal <tt>VBox.log</tt> et le fichier image <tt>VBox.png</tt> que vous tr [...]
     </message>
     <message>
         <source>Could not access USB on the host system, because neither the USB file system (usbfs) nor the DBus and hal services are currently available. If you wish to use host USB devices inside guest systems, you must correct this and restart VirtualBox.</source>
@@ -6772,7 +7382,7 @@
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Voulez-vous vraiment supprimer le lecteur CD/DVD ?</p><p>Sans lecteur vous ne pourrez ni utiliser les lecteurs physiques ou des disques CD/DVD virtuels ni installer les Additions invité dans la machine virtuelle.</p></translation>
+        <translation type="obsolete"><p>Voulez-vous vraiment supprimer le lecteur CD/DVD ?</p><p>Sans lecteur vous ne pourrez ni utiliser les lecteurs physiques ou des disques CD/DVD virtuels ni installer les Additions invité dans la machine virtuelle.</p></translation>
     </message>
     <message>
         <source><p>VT-x/AMD-V hardware acceleration is not available on your system. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</source>
@@ -6870,7 +7480,7 @@
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Vous êtes sur le point d'ajouter un nouveau lecteur CD/DVD au contrôleur <b>%1</b>.</p><p>Voulez-vous choisir un CD/DVD virtuel à insérer dans le lecteur ou bien le laisser vide pour le moment ?</p></translation>
+        <translation type="obsolete"><p>Vous êtes sur le point d'ajouter un nouveau lecteur CD/DVD au contrôleur <b>%1</b>.</p><p>Voulez-vous choisir un CD/DVD virtuel à insérer dans le lecteur ou bien le laisser vide pour le moment ?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -6892,11 +7502,11 @@
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Impossible d'détacher le lecteur CD/DVD (<nobr><b>%1</b></nobr>) de l'emplacement <i>%2</i> de la machine <b>%3</b>.</translation>
+        <translation type="obsolete">Impossible d'détacher le lecteur CD/DVD (<nobr><b>%1</b></nobr>) de l'emplacement <i>%2</i> de la machine <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Impossible de détacher le lecteur disquettes (<nobr><b>%1</b></nobr>) de l'emplacement <i>%2</i> de la machine <b>%3</b>.</translation>
+        <translation type="obsolete">Impossible de détacher le lecteur disquettes (<nobr><b>%1</b></nobr>) de l'emplacement <i>%2</i> de la machine <b>%3</b>.</translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
@@ -6939,11 +7549,11 @@
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Impossible d'attacher le lecteur CD/DVD (<nobr><b>%1</b></nobr>) à l'emplacement <i>%2</i> de la machine <b>%3</b>.</translation>
+        <translation type="obsolete">Impossible d'attacher le lecteur CD/DVD (<nobr><b>%1</b></nobr>) à l'emplacement <i>%2</i> de la machine <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Impossible d'attacher le lecteur disquettes (<nobr><b>%1</b></nobr>) à l'emplacement <i>%2</i> de la machine <b>%3</b>.</translation>
+        <translation type="obsolete">Impossible d'attacher le lecteur disquettes (<nobr><b>%1</b></nobr>) à l'emplacement <i>%2</i> de la machine <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
@@ -7198,7 +7808,7 @@
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Echec de l'abandon de données.</translation>
+        <translation type="obsolete">Echec de l'abandon de données.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -7258,240 +7868,328 @@
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>Impossible de démarrer le Gestionnaire VirtualBox en raisons de restrictions locales.</p><p>Cette application va maintenant s'arrêter.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p> Impossible de trouver le fichier de langue pour la langue <b>%1</b> dans le dossier <b><nobr>%2</b>.</p><p>La langue va temporairement être remise à la langue par défaut du système. Veuillez sélectionner une des langues disponibles sur la page <b>Langue</b> dans la fenêtre des <b>Préférences</b> accessible depuis le menu <b>Fichier</b> de la fenêtre du Gestionnaire VirtualBox.< [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p> Impossible de charger le fichier de langue pour la langue <b><nobr>%1</nobr></b>.</p><p>La langue va temporairement être réglée sur Anglais (intégré). Veuillez sélectionner une des langues disponibles sur la page <b>Langue</b> dans la fenêtre des <b>Préférences</b> accessible depuis le menu <b>Fichier</b> de la fenêtre du Gestionnaire VirtualBox.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation>Aucune machine virtuelle pour l'identifiant <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation>Ignorer</translation>
+        <translation type="unfinished">Ignorer</translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation>Echec de la création du réseau NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>Echec la suppresion du réseau NAT <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation>Echec de la création du serveur DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>Echec de la suppresion du serveur DHCP pour l'interface réseau <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>Echec de la création de l'interface du réseau hôte.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>Créer un &nouveau disque</translation>
+        <translation type="unfinished">Créer un &nouveau disque</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>&Choisir un disque existant</translation>
+        <translation type="unfinished">&Choisir un disque existant</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation>Laisser &vide</translation>
+        <translation type="unfinished">Laisser &vide</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>&Choisir un disque</translation>
+        <translation type="unfinished">&Choisir un disque</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Êtes-vous sûr de vouloir libérer le disque dur virtuel <nobr><b>%1</b></nobr> ?</p><p>Celà le libérera de la ou des machine(s) virtuelle(s) suivante(s) : <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Êtes-vous sûr de vouloir libérer le lecteur de disque optique virtuel <nobr><b>%1</b></nobr> ?</p><p>Celà le libérera de la ou des machine(s) virtuelle(s) suivante(s) : <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Êtes-vous sûr de vouloir libérer le lecteur de disquette virtuel <nobr><b>%1</b></nobr> ?</p><p>Celà le libérera de la ou des machine(s) virtuelle(s) suivante(s) : <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Êtes-vous sûr de vouloir libérer le disque dur virtuel <nobr><b>%1</b></nobr> de liste des fichiers d'image disque connus ?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation><p>Ce disque dur étant inaccessible, son fichier image ne peut être effacé.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Êtes-vous sûr de vouloir libérer le disque optique virtuel <nobr><b>%1</b></nobr> de liste des fichiers d'image disque connus ?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Êtes-vous sûr de vouloir libérer le lecteur de disquette virtuel <nobr><b>%1</b></nobr> de liste des fichiers d'image disque connus ?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Impossible d'insérer le disque optique virtuel <nobr><b>%1</b>dans la machine <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation><p>Souhaitez-vous essayer de forcer l'insertion du disque ?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Impossible d'éjecter le disque optique virtuel <nobr><b>%1</b></nobr> de la machine <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation><p>Souhaitez-vous essayer l'éjection de force du disque ?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Impossible d'insérer la disquette virtuelle <nobr><b>%1</b>dans la machine <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Impossible d'éjecter la disquette virtuelle <nobr><b>%1</b></nobr> de la machine <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Echec de l'ouverture du fichier de disque dur <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Echec de l'ouverture du fichier de disque optique <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Echec de l'ouverture du fichier de disquette <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Echec de la fermeture du fichier de disque dur <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Echec de la fermeture du fichier de disque optique <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Basculer</translation>
+    </message>
+    <message>
+        <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Download</source>
+        <translation type="unfinished">Téléchargement</translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
+        <translation type="unfinished"><p>Le guide de l'utilisateur de VirtualBox a été téléchargé a partir de <nobr><a href="%1">%2</a></nobr> mais ne peut pas être enregistré sous <nobr><b>%3</b>.</nobr></p><p>Veuillez choisir un autre emplacement pour le fichier.</p> {1"?} {1<?} {2<?}</translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
+        <translation type="unfinished"><p>Le guide de l'utilisateur de VirtualBox a été téléchargé a partir de <nobr><a href="%1">%2</a></nobr> et enregistré sous <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Fermer</translation>
+    </message>
+    <message>
+        <source>Ok</source>
+        <translation type="unfinished">Ok</translation>
+    </message>
+    <message>
+        <source>Do not show this message again</source>
+        <translation type="unfinished">Ne plus afficher ce message</translation>
+    </message>
+    <message>
+        <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Insert</source>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Echec de la fermeture du fichier de disquette virtuelle <nobr><b>%2</b></nobr>.</translation>
-    </message>
-    <message numerus="yes">
-        <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
-        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation>
-            <numerusform><p>La machine virtuelle suivante est actuellement en état sauvegardé : <b>%1</b></p><p>Si vous continuez, l'état d'exécution de la machine exportée sera supprimé. La ou les autres machines ne seront pas modifiées.</p></numerusform>
-            <numerusform><p>Les %n machines virtuelles suivantes sont actuellement en état sauvegardé : <b>%1</b></p><p>Si vous continuez, l'état d'exécution des machines exportées sera supprimé. La ou les autres machines ne seront pas modifiées.</p></numerusform>
-        </translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch</source>
-        <translation>Permuter</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>Echec de l'activation du serveur de bureau distant pour la machine virtuelle <b>%1</b>.</translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>Echec de la désactivation du serveur de bureau distant pour la machine virtuelle <b>%1</b>.</translation>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>Echec de l'activation de la capture vidéo pour la machine virtuelle <b>%1</b>.</translation>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>Echec de la désactivation de la capture vidéo pour la machine virtuelle <b>%1</b>.</translation>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>Impossible de trouver le fichier d'image disque des <b>Additions Invités VirtualBox</b>.</p>Souhaitez-vous télécharger ce fichier depuis l'Internet ?</p></translation>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Download</source>
-        <translation>Télécharger</translation>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Êtes-vous sûr de vouloir télécharger l'image disque des <b>Additions Invité VirtualBox</b> depuis <nobr><a href="%1">%1</a></nobr> (taille %2 octets) ?</p></translation>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>Le fichier d'image disque <b>Additions Invité VirtualBox</b> a bien été téléchargé depuis <nobr><a href="%1">%1</a></nobr> mais n'a pas être enregistré localement en tant que <nobr><b>%2</b>.</nobr></p><p>Veuillez choisir un autre emplacement pour ce fichier.</p></translation>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>Le fichier d'image disque <b>Additions Invité VirtualBox</b> a bien été téléchargé depuis <nobr><a href="%1">%1</a></nobr> et enregistré localement en tant que <nobr><b>%2</b>.</nobr></p><p>Souhaitez-vous consigner ce fichier d'image disque et l'insérer dans le lecteur de CD/DVD virtuel ?</p></translation>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Impossible d'insérer le fichier d'image disque <b>Additions Invité VirtualBox</b> dans la machine virtuelle <b>%1</b> : la machine n'a pas de lecteur CD/DVD. Veuillez ajouter un lecteur en utilisant la page stockage de la fenêtre des réglages de la machine virtuelle.</p></translation>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation><p>Impossible de trouver le <b>Manuel de l'utilisateur de VirtualBox</b>.<nobr><b>%1</b> Souhaitez-vous le télécharger depuis l'Internet ?</p></translation>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Êtes-vous sûr de vouloir télécharger le <b>Manuel de l'Utilisateur VirtualBox</b> depuis <a href="%1">%1</a></nobr> (taille %2 octets) ?</p></translation>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>Le guide de l'utilisateur de VirtualBox a été téléchargé à partir de <nobr><a href="%1">%1</a></nobr> mais ne peut pas être enregistré sous <nobr><b>%2</b>.</nobr></p><p>Veuillez choisir un autre emplacement pour le fichier.</p></translation>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>Le guide de l'utilisateur de VirtualBox a été téléchargé à partir de <nobr><a href="%1">%1</a></nobr> et enregistré sous <nobr><b>%2b>.</nobr></p></translation>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Close</source>
-        <translation>Fermer</translation>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ok</source>
-        <translation>Ok</translation>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Do not show this message again</source>
-        <translation>Ne plus afficher ce message</translation>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>Souhaitez-vous hôter le réseau NAT <nobr><b>%1</b> ?</nobr></p><p>Si ce réseau en cours d'utilisation par une ou plusieurs adaptateurs réseau de machine virtuelle, ces adaptateurs ne seront plus utilisable tant que vous ne saisissez pas des paramètres corects ou ne choisissiez un nom d'adaptateur ou un type  d'adaptateur réseau.</p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Échec de la connexion de la webcam <b>%1</b> à la machine virtuelle <b>%2</b>.</translation>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Échec de la déconnexion de la webcam <b>%1</b> à la machine virtuelle <b>%2</b>.</translation>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>Les Additions Invités VirtualBox semblent ne pas être actives sur cette machine virtuelle. De ce fait les dossiers partagés ne peuvent pas être utilisés. Pour utiliser les dossiers partagés dans cette machine virtuelle, installez les Additions Invités, ou bien réinstallez-les si elles ne fonctionnent pas correctement en choisissant <b>Installer les Additions Invités...</b> dans le menu <b>Périphériques</b>. Si elles sont installés et  [...]
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions</comment>
-        <translation>Insérer</translation>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>L'écran virtuel est actuellement réglé sur un mode coleur <b>%1&nbsp;bit</b>. Pour de meilleures performances, veuillez l'ajuster sur <b>%2&nbsp;bit</b>. Cela peut généralement être fait depuis la section <b>Affichage</b> du paneau de configuration ou des préférences systemes du système d'exploitation hôte.</p></translation>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7554,19 +8252,19 @@
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation>Toujours afficher la barre d'outils</translation>
+        <translation type="unfinished">Toujours afficher la barre d'outils</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation>Minimiser la fenêtre</translation>
+        <translation type="unfinished">Minimiser la fenêtre</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Quitter le mode plein écran ou intégré</translation>
+        <translation type="unfinished">Quitter le mode plein écran ou intégré</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation>Fermer la machine</translation>
+        <translation type="unfinished">Fermer la machine</translation>
     </message>
 </context>
 <context>
@@ -7583,7 +8281,7 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Nom : </translation>
     </message>
     <message>
@@ -7643,7 +8341,7 @@
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation>L'opération réseau a échoué avec l'erreur suivante : %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7670,27 +8368,27 @@
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation>Hôte introuvable</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation>Accès au contenu refusé</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation>Défaillance de protocole</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>Mauvais format de certificat SSL</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>Défaillance d'authentification SSL</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>Raison inconnue</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8149,7 +8847,7 @@ And the size is not necessarily "in megabytes", the slider chooses the
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>Cliquez pour afficher tous les détails</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8227,14 +8925,18 @@ And the size is not necessarily "in megabytes", the slider chooses the
         <translation>Fichiers machine virtuelle (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Bienvenue dans VirtualBox !</h3><p>La partie gauche de cette fenêtre affiche la liste des machines virtuelles de votre ordinateur. Cette liste est vide car vous n'avez pas encore créé de machine virtuelle.<img src=:/welcome.png align=right/></p><p>Pour créer une nouvelle machine virtuelle cliquez sur le bouton <b>Créer</b> en haut de cette liste.</p><p>Vous pouvez appuyer sur <b>%1</b> p [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Bienvenue dans VirtualBox !</h3><p>La partie gauche de cette fenêtre affiche la liste des machines virtuelles de votre ordinateur. Cette liste est vide car vous n'avez pas encore créé de machine virtuelle.<img src=:/welcome.png align=right/></p><p>Pour créer une nouvelle machine virtuelle cliquez sur le bouton <b>Créer</b> en haut de cette liste.</p><p>Vous pouvez appuyer sur <b&g [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>- Gestionnaire de machines</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -8267,15 +8969,15 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
     <message>
         <source>Settings</source>
-        <translation>Paramètres</translation>
+        <translation type="obsolete">Paramètres</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation>Page <b>%1</b> :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation>Page <b>%1:%2</b> :</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8320,6 +9022,10 @@ And the size is not necessarily "in megabytes", the slider chooses the
         <source>Display</source>
         <translation>Affichage</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8395,6 +9101,43 @@ And the size is not necessarily "in megabytes", the slider chooses the
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">Vous utilisez plus de contrôleurs de stockage qu'un chipset %1 ne supporte. Veuillez changer le type du chipset sur la page Système des paramètres de la machine ou bien reduire en nombre les contrôleurs de stockage suivants sur la page Stockage: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Paramètres</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Fermer</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -8491,8 +9234,8 @@ And the size is not necessarily "in megabytes", the slider chooses the
         <translation type="obsolete">Récapitulatif</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Une nouvelle version de VirtualBox est disponible ! La version <b>%1</b> est disponible sur <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Vous pouvez télécharger cette version en cliquant sur le lien suivant : </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Une nouvelle version de VirtualBox est disponible ! La version <b>%1</b> est disponible sur <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Vous pouvez télécharger cette version en cliquant sur le lien suivant : </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -8560,6 +9303,14 @@ And the size is not necessarily "in megabytes", the slider chooses the
         <source>&Restore current snapshot '%1'</source>
         <translation>&Restaurer l'instantané actuel '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -8573,6 +9324,126 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Détails de la session</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Détails</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Propriétés et statistiques</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transferts DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transferts PIO </translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Données lues</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Données écrites</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Données transmise</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Données reçues</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Propriétés</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Résolution de l'écran</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Non détectées</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Non détecté</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Additions invité</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Type de système invité</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Pas de cartes réseau</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translatorcomment>Again, mistake?</translatorcomment>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Non disponible</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Statistiques du stockage</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Aucun périphérique de stockage</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Statistiques du réseau</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Non disponible</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Mode du presse-papier</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Mode du Glisser-Deposer</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -8727,11 +9598,27 @@ And the size is not necessarily "in megabytes", the slider chooses the
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Cacher la description</translation>
+        <translation type="obsolete">Cacher la description</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Afficher la description</translation>
+        <translation type="obsolete">Afficher la description</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9061,39 +9948,39 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
     <message>
         <source>Storage settings</source>
-        <translation>Paramètres de stockage</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>Veuillez choisir un fichier vers lequel exporter l'application virtuelle</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>F&ormat :</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>Enregistrer au format OVF 1.0 standard.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>Enregistrer dans le nouveau format expérimental OVF 2.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation>Paramètres de &stockage</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9112,15 +9999,14 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Choisissez un fichier vers lequel exporter l'application virtuelle...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translatorcomment>[BM]Appliance has several translations in French (Appareil, Instrument, Application). None is actually fully satisfying.</translatorcomment>
-        <translation>Choisissez un fichier sur lequel exporter l'application virtuelle...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9190,15 +10076,15 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation>Importer l'application virtuelle</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>Choisir un fichier d'application virtuelle à importer...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>Veuillez choisir un fichier d'application virtuelle à importer</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9429,7 +10315,7 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
     <message>
         <source>Choose...</source>
-        <translation>Choisir...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9488,7 +10374,7 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>La valeur du chemin par défaut actuelle sera affichée une fois les changements acceptés et cette fenêtre réouverte.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9751,7 +10637,7 @@ And the size is not necessarily "in megabytes", the slider chooses the
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>Disque CD/DVD</translation>
+        <translation type="obsolete">Disque CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -10477,17 +11363,17 @@ And the size is not necessarily "in megabytes", the slider chooses the
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Ce disque sera connecté indirectement, en créant un nouveau disque dur différentiel.</translation>
+        <translation type="obsolete">Ce disque sera connecté indirectement, en créant un nouveau disque dur différentiel.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Certains des médias dans cette chaîne de disques durs sont inaccessibles. Utilisez le gestionnaire de médias virtuels en mode <b>Montrer les disques durs différentiels</b> pour voir ces médias.</translation>
+        <translation type="obsolete">Certains des médias dans cette chaîne de disques durs sont inaccessibles. Utilisez le gestionnaire de médias virtuels en mode <b>Montrer les disques durs différentiels</b> pour voir ces médias.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Ce disque dur de base est connecté indirectement à travers le disque dur différentiel suivant :</translation>
+        <translation type="obsolete">Ce disque dur de base est connecté indirectement à travers le disque dur différentiel suivant :</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -10533,7 +11419,7 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -11038,7 +11924,7 @@ And the size is not necessarily "in megabytes", the slider chooses the
     <message>
         <source>Description</source>
         <comment>DetailsElementType</comment>
-        <translation>Déscription</translation>
+        <translation>Description</translation>
     </message>
     <message>
         <source>Please choose a virtual hard drive file</source>
@@ -11093,72 +11979,201 @@ And the size is not necessarily "in megabytes", the slider chooses the
         <translation>Choisissez un emplacement pour le nouveau fichier de disque dur virtuel</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Activée</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Désactivée</translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
-        <translation>Exécution sans restriction</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>PS/2 Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>Souris PS/2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>Souris USB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>PS/2 and USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>Souris PS/2 et USB</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>unrestricted execution</comment>
-        <translation type="obsolete">Activée</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>unrestricted execution</comment>
-        <translation type="obsolete">Désactivée</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
-        <translation>Exécution sans restriction</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation>Tablette USB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Multi-Touch Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation>Tablette USB Multi-Touch</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network</source>
         <comment>NetworkAttachmentType</comment>
-        <translation>Réseau NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT network, '%1'</source>
         <comment>details report (network)</comment>
-        <translation>Réseau NAT, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Vous pouvez créer ou ajouter des fichiers d'image disque dans les réglages de la machine virtuelle.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Par défaut</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Active</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Active</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Active</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11455,6 +12470,18 @@ And the size is not necessarily "in megabytes", the slider chooses the
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Crée un nouveau disque dur virtuel</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -11590,8 +12617,8 @@ And the size is not necessarily "in megabytes", the slider chooses the
         <translation type="obsolete">Suspendre l'exécution de la machine virtuelle</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Bienvenue dans VirtualBox !</h3><p>La partie gauche de cette fenêtre affiche la liste des machines virtuelles de votre ordinateur. Cette liste est vide car vous n'avez pas encore créé de machine virtuelle.<img src=:/welcome.png align=right/></p><p>Pour créer une nouvelle machine virtuelle cliquez sur le bouton <b>Créer</b> en haut de cette liste.</p><p>Vous pouvez appuyer sur <b&g [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Bienvenue dans VirtualBox !</h3><p>La partie gauche de cette fenêtre affiche la liste des machines virtuelles de votre ordinateur. Cette liste est vide car vous n'avez pas encore créé de machine virtuelle.<img src=:/welcome.png align=right/></p><p>Pour créer une nouvelle machine virtuelle cliquez sur le bouton <b>Créer</b> en haut de cette liste.</p><p>Vous pouvez appuyer sur <b&g [...]
     </message>
     <message>
         <source>Log</source>
@@ -12028,118 +13055,6 @@ And the size is not necessarily "in megabytes", the slider chooses the
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Détails de la session</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Détails</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Propriétés et statistiques</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transferts DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transferts PIO </translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Données lues</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Données écrites</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Données transmise</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Données reçues</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Propriétés</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Résolution de l'écran</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Non détectées</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Non détecté</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Additions invité</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Type de système invité</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Pas de cartes réseau</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translatorcomment>Again, mistake?</translatorcomment>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Non disponible</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Statistiques du stockage</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Aucun périphérique de stockage</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Statistiques du réseau</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Non disponible</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Mode du presse-papier</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Mode du Glisser-Deposer</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>&Détails de configuration</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Info&rmations d'exécution</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_gl_ES.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_gl_ES.ts
index 9215222..96a98d4 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_gl_ES.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_gl_ES.ts
@@ -241,7 +241,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Modo f&luído</translation>
+        <translation type="unfinished">Modo f&luído</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -265,11 +265,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Desactivar a integración do &rato</translation>
+        <translation type="obsolete">Desactivar a integración do &rato</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Desactivar temporalmente a integración do punteiro do rato do anfitrión</translation>
+        <translation type="obsolete">Desactivar temporalmente a integración do punteiro do rato do anfitrión</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -281,11 +281,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Inserir Ctrl-Alt-Supr</translation>
+        <translation type="obsolete">&Inserir Ctrl-Alt-Supr</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Enviar a orde Ctrl-Alt-Supr a máquina virtual</translation>
+        <translation type="obsolete">Enviar a orde Ctrl-Alt-Supr a máquina virtual</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -293,7 +293,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Enviar a secuencia Ctrl-Alt-Retroceso á máquina virtual</translation>
+        <translation type="obsolete">Enviar a secuencia Ctrl-Alt-Retroceso á máquina virtual</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -308,8 +308,8 @@
         <translation type="obsolete">Diálogo da i&nformación da sesión</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Mostrar o diálogo da información da sesión</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Mostrar o diálogo da información da sesión</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -364,16 +364,8 @@
         <translation>&Dispositivos</translation>
     </message>
     <message>
-        <source>&CD/DVD Devices</source>
-        <translation></translation>
-    </message>
-    <message>
-        <source>&Floppy Devices</source>
-        <translation></translation>
-    </message>
-    <message>
         <source>&USB Devices</source>
-        <translation>Dispositivos &USB</translation>
+        <translation type="obsolete">Dispositivos &USB</translation>
     </message>
     <message>
         <source>Change the settings of network adapters</source>
@@ -396,12 +388,12 @@
         <translation type="obsolete">Activar ou desactivar as conexións de escritorio remoto a esta máquina</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">&Instalar os aplicativos para o sistema operativo convidado...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Instalar os aplicativos para o sistema operativo convidado...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Montar a imaxe de instalación dos aplicativos para o sistema operativo convidado</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Montar a imaxe de instalación dos aplicativos para o sistema operativo convidado</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -420,7 +412,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">Re&xistro...</translation>
+        <translation type="obsolete">Re&xistro...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -439,26 +431,10 @@
         <translation></translation>
     </message>
     <message>
-        <source>Switch to &Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch between normal and fullscreen mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch to Seam&less Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and seamless desktop integration mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch to &Scaled Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and scaled mode</source>
         <translation type="unfinished"></translation>
     </message>
@@ -527,10 +503,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished">&Ficheiro</translation>
@@ -802,10 +774,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -850,23 +818,248 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Instalar os aplicativos para o sistema operativo convidado...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Montar a imaxe de instalación dos aplicativos para o sistema operativo convidado</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Rede</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Mostrar re&xistro...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Ficheiro</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Activar</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1409,14 +1602,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1487,6 +1680,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2124,11 +2343,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished">Desactivado</translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">Sen conexión</translation>
@@ -2337,22 +2551,122 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Controlador</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details</comment>
-        <translation type="obsolete">Desactivado</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Controlador USB</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Activado</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished">Desactivado</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">Activado</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Activado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Desactivado</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Activado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Desactivado</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Controlador</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Desactivado</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
         <source>None</source>
         <comment>details</comment>
@@ -2670,18 +2984,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Previsualización en tempo real &da icona ancorada</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3840,16 +4142,6 @@ p, li { white-space: pre-wrap; }
         <translation></translation>
     </message>
     <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
-        <comment>CD/DVD tooltip</comment>
-        <translation></translation>
-    </message>
-    <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
-        <comment>FD tooltip</comment>
-        <translation></translation>
-    </message>
-    <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
         <translation></translation>
@@ -3887,7 +4179,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>O controlador USB está desactivado</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>O controlador USB está desactivado</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -3942,6 +4234,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4032,7 +4338,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Vídeo</translation>
+        <translation type="obsolete">&Vídeo</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4199,10 +4505,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4254,7 +4556,67 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Barra de ferramentas pequena:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Se está marcada, mostra a barra de ferramentas pequena nos modos fluído e de pantalla completa.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Mostrar en modo de &Pantalla completa/Fluído</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4265,7 +4627,7 @@ p, li { white-space: pre-wrap; }
         <translation>Mostra o camiño onde se almacenaran as instantáneas desta máquina virtual. Nota que as instantáneas poden ocupar bastante espazo en disco. </translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Básico</translation>
     </message>
     <message>
@@ -4277,7 +4639,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Mostrar o nome da máquina virtual.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avanzado</translation>
     </message>
     <message>
@@ -4293,7 +4655,7 @@ p, li { white-space: pre-wrap; }
         <translation>Cartafol da i&nstantánea:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Descrición</translation>
     </message>
     <message>
@@ -4302,54 +4664,134 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Se está marcada, calquera cambio realizado na montaxe dos medios de CD/DVD e disquete durante a execución da máquina gardarase no ficheiro de configuracións para preservar a súa configuración entre execucións.</translation>
+        <translation type="obsolete">Se está marcada, calquera cambio realizado na montaxe dos medios de CD/DVD e disquete durante a execución da máquina gardarase no ficheiro de configuracións para preservar a súa configuración entre execucións.</translation>
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Medios extraíbeis:</translation>
+        <translation type="obsolete">Medios extraíbeis:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Lemb&rar os cambios en tempo de execución</translation>
+        <translation type="obsolete">Lemb&rar os cambios en tempo de execución</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Barra de ferramentas pequena:</translation>
+        <translation type="obsolete">Barra de ferramentas pequena:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Se está marcada, mostra a barra de ferramentas pequena nos modos fluído e de pantalla completa.</translation>
+        <translation type="obsolete">Se está marcada, mostra a barra de ferramentas pequena nos modos fluído e de pantalla completa.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Mostrar en modo de &Pantalla completa/Fluído</translation>
+        <translation type="obsolete">Mostrar en modo de &Pantalla completa/Fluído</translation>
     </message>
     <message>
-        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
+        <translation type="obsolete">seleccionou un sistema operativo convidado de tipo 64-bit para esta máquina virtual. Tales convidados requiren hardware de virtualización (VT-x/AMD-V) co que esta característica activarase automaticamente.</translation>
+    </message>
+    <message>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show at &Top of Screen</source>
+        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
-        <translation type="obsolete">seleccionou un sistema operativo convidado de tipo 64-bit para esta máquina virtual. Tales convidados requiren hardware de virtualización (VT-x/AMD-V) co que esta característica activarase automaticamente.</translation>
+        <source>No name specified for the virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <source>Enc&ryption</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>No name specified for the virtual machine.</source>
+        <source>When checked, enables encryption for this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Barra de ferramentas pequena:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Se está marcada, mostra a barra de ferramentas pequena nos modos fluído e de pantalla completa.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Mostrar en modo de &Pantalla completa/Fluído</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4410,7 +4852,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>A&dvanced</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">&Avanzado</translation>
     </message>
     <message>
         <source>Shows or hides additional network adapter options.</source>
@@ -4791,10 +5233,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -4845,19 +5283,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Se está marcada, ao iniciarse a máquina virtual crearase a canalización especificada no campo <b>camiño do porto</b>. Noutro caso, a máquina virtual tentará empregar unha canalización existente.</translation>
+        <translation type="obsolete">Se está marcada, ao iniciarse a máquina virtual crearase a canalización especificada no campo <b>camiño do porto</b>. Noutro caso, a máquina virtual tentará empregar unha canalización existente.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Crear canalización</translation>
+        <translation type="obsolete">&Crear canalización</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Mostra o camiño da canalización do porto serie no anfitrión cando o porto traballa no modo <b>canalización no anfitrión</b>, ou o nome do dispositivo serie no anfitrión cando o porto traballa no modo <b>dispositivo no anfitrión</b>.</translation>
+        <translation type="obsolete">Mostra o camiño da canalización do porto serie no anfitrión cando o porto traballa no modo <b>canalización no anfitrión</b>, ou o nome do dispositivo serie no anfitrión cando o porto traballa no modo <b>dispositivo no anfitrión</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Camiño do &porto/ficheiro:</translation>
+        <translation type="obsolete">Camiño do &porto/ficheiro:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -4867,6 +5305,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -4982,14 +5436,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Add Controller</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5022,15 +5468,7 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Add CD/DVD Device</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Add Floppy Device</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Remove Attachment</source>
+        <source>Remove Attachment</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -5158,18 +5596,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD &Drive:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Floppy &Drive:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5190,10 +5616,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Remove disk from virtual drive</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5263,6 +5685,54 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5476,31 +5946,39 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5573,7 +6051,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Activar o controlador USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">Activar o controlador USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5628,7 +6106,27 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"><nobr>Estado: %1</nobr></translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5767,7 +6265,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Seleccionar</translation>
     </message>
     <message>
-        <source>C&lose</source>
+        <source>Removing medium...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5787,6 +6285,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Pechar</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Cambiar</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -5828,7 +6349,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Produciuse un fallo ao crear o obxeto COM de VirtualBox.</p><p>O aplicativo terminará agora.</p></translation>
+        <translation type="obsolete"><p>Produciuse un fallo ao crear o obxeto COM de VirtualBox.</p><p>O aplicativo terminará agora.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -6021,15 +6542,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Non foi posíbel cargar o ficheiro de idioma <b><nobr>%1</nobr></b>. <p>O idioma restabelecerase temporalmente a Inglés (integrado). Vaia ao diálogo <b>Preferencias</b> que pode abrir desde o menú <b>Ficheiro</b> da xanela principal de VirtualBox e seleccione un dos idiomas existentes na sección <b>Idioma</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Os aplicativos para o sistema operativo convidado de VirtualBox instalados no sistema operativo convidado son antigos: a versión instalada é a %1 e requírese a versión %2. Algunhas características que requiren dos aplicativos para o sistema operativo convidado (a integración do rato, o redimensionamento automático da pantalla do convidado) probablemente deixarán de traballar de maneira correcta.</p><p>Actualice os aplicativos para [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Os aplicativos para o sistema operativo convidado de VirtualBox instalados no sistema operativo convidado están desactualizados: a versión instalada é a %1 e requírese a versión %2. Algunhas características que requiren dos aplicativos para o sistema operativo convidado (a integración do rato, o redimensionamento automático da pantalla do convidado) poden non traballar como se espera.</p><p>Recoméndase actualizar os aplicativos pa [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Os aplicativos para o sistema operativo convidado de VirtualBox instalados no sistema operativo convidado son demasiado recentes: a versión instalada é a %1 e requírese a versión %2.</p><p>Non é compatíbel o uso dunha versión máis nova dos aplicativos para o sistema operativo convidado cunha versión máis vella de VirtualBox. Instale a versión actual dos aplicativos para o sistema operativo convidado elixindo <b>Instalar os a [...]
     </message>
     <message>
@@ -6126,9 +6647,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Descargar</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Montar</translation>
+        <translation type="obsolete">Montar</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6274,8 +6795,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Mostrar un diálogo con información do produto</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Unha nova versión de VirtualBox foi publicada! A versión <b>%1</b> está dispoñíbel en <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Pode descargar esta versión directamente desde esta ligazón:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Unha nova versión de VirtualBox foi publicada! A versión <b>%1</b> está dispoñíbel en <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Pode descargar esta versión directamente desde esta ligazón:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6375,7 +6896,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Un ou máis medios virtuais (disco ríxido, CD/DVD ou disqueteira) non están accesíbeis actualmente. Polo tanto, non poderá traballar coas máquinas virtuais que empreguen estes medios ata que sexan accesíbeis.</p><p>Prema en <b>Comprobar</b> para abrir o xanela do xestor de medios virtuais e consulte que medios están inaccesíbeis, ou prema en <b>Ignorar</b> para ignorar esta mensaxe.</p></translation>
+        <translation type="obsolete"><p>Un ou máis medios virtuais (disco ríxido, CD/DVD ou disqueteira) non están accesíbeis actualmente. Polo tanto, non poderá traballar coas máquinas virtuais que empreguen estes medios ata que sexan accesíbeis.</p><p>Prema en <b>Comprobar</b> para abrir o xanela do xestor de medios virtuais e consulte que medios están inaccesíbeis, ou prema en <b>Ignorar</b> para ignorar esta mensaxe.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -6405,8 +6926,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">S&obrescribir</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Ocorreu un erro crítico mentres se executaba a máquina virtual e se detivo a súa execución.</p><p>Para obter axuda, consulte a sección Comunidade en <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> ou ao servizo de asistencia que teña contratado. Proporcione os contidos do ficheiro de rexistro <tt>VBox.log</tt> e o ficheiro de imaxe <tt>VBox.png</tt>, os cales pode localizar no cartafol <nob [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Ocorreu un erro crítico mentres se executaba a máquina virtual e se detivo a súa execución.</p><p>Para obter axuda, consulte a sección Comunidade en <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> ou ao servizo de asistencia que teña contratado. Proporcione os contidos do ficheiro de rexistro <tt>VBox.log</tt> e o ficheiro de imaxe <tt>VBox.png</tt>, os cales pode localizar no ca [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -6612,10 +7133,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">disco ríxido</translation>
     </message>
     <message>
-        <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Remove</source>
         <comment>medium</comment>
         <translation type="unfinished"></translation>
@@ -6665,10 +7182,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -6677,14 +7190,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6713,14 +7218,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -6926,10 +7423,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7158,14 +7651,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7198,26 +7683,122 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Montar</translation>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>Insert</source>
+        <comment>additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetAdditions</name>
@@ -7285,7 +7866,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished">&Nome:</translation>
     </message>
     <message>
@@ -7935,14 +8516,18 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="unfinished"><h3>Dámoslle a benvida a VirtualBox.</h3><p>A parte esquerda desta xanela destínase a mostrar unha lista de todas as máquinas virtuais do seu computador. Neste intre a lista está baleira porque aínda non creou ningunha máquina virtual.<img src=:/welcome.png align=right/></p><p>Para crear unha nova máquina virtual prema no botón <b>Novo</b> da barra de ferramentas localizada na parte superior da xanela  [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Dámoslle a benvida a VirtualBox.</h3><p>A parte esquerda desta xanela destínase a mostrar unha lista de todas as máquinas virtuais do seu computador. Neste intre a lista está baleira porque aínda non creou ningunha máquina virtual.<img src=:/welcome.png align=right/></p><p>Para crear unha nova máquina virtual prema no botón <b>Novo</b> da barra de ferramentas localizada na parte superior da xanela pr [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -7971,7 +8556,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Settings</source>
-        <translation type="unfinished">Configuracións</translation>
+        <translation type="obsolete">Configuracións</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -8024,6 +8609,10 @@ p, li { white-space: pre-wrap; }
         <source>Display</source>
         <translation type="unfinished">Pantalla</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8079,36 +8668,73 @@ p, li { white-space: pre-wrap; }
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">seleccionou un sistema operativo convidado de tipo 64-bit para esta máquina virtual. Tales convidados requiren hardware de virtualización (VT-x/AMD-V) co que esta característica activarase automaticamente.</translation>
     </message>
-</context>
-<context>
-    <name>UITextEditor</name>
     <message>
-        <source>Edit text</source>
-        <translation>Editar texto</translation>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Replace...</source>
-        <translation>Substituí&r...</translation>
+        <source>Settings</source>
+        <translation type="unfinished">Configuracións</translation>
     </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
     <message>
-        <source>Replaces the current text with the content of a file.</source>
-        <translation>Substituír o texto actual co contido dun ficheiro dado.</translation>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Text (*.txt);;All (*.*)</source>
-        <translation>Texto (*.txt);;Todos (*.*)</translation>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
     <message>
-        <source>Select a file to open...</source>
-        <translation>Seleccionar un ficheiro para abrir...</translation>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIUpdateManager</name>
+    <name>UIStatusBarEditorWidget</name>
     <message>
-        <source>1 day</source>
-        <translation>1 día</translation>
-    </message>
+        <source>Close</source>
+        <translation type="unfinished">Pechar</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UITextEditor</name>
+    <message>
+        <source>Edit text</source>
+        <translation>Editar texto</translation>
+    </message>
+    <message>
+        <source>&Replace...</source>
+        <translation>Substituí&r...</translation>
+    </message>
+    <message>
+        <source>Replaces the current text with the content of a file.</source>
+        <translation>Substituír o texto actual co contido dun ficheiro dado.</translation>
+    </message>
+    <message>
+        <source>Text (*.txt);;All (*.*)</source>
+        <translation>Texto (*.txt);;Todos (*.*)</translation>
+    </message>
+    <message>
+        <source>Select a file to open...</source>
+        <translation>Seleccionar un ficheiro para abrir...</translation>
+    </message>
+</context>
+<context>
+    <name>UIUpdateManager</name>
+    <message>
+        <source>1 day</source>
+        <translation>1 día</translation>
+    </message>
     <message>
         <source>2 days</source>
         <translation>2 días</translation>
@@ -8174,8 +8800,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Resumo</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Unha nova versión de VirtualBox foi publicada! A versión <b>%1</b> está dispoñíbel en <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Pode descargar esta versión directamente desde esta ligazón:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Unha nova versión de VirtualBox foi publicada! A versión <b>%1</b> está dispoñíbel en <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Pode descargar esta versión directamente desde esta ligazón:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -8243,6 +8869,14 @@ p, li { white-space: pre-wrap; }
         <source>&Restore current snapshot '%1'</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -8256,6 +8890,156 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Información de sesión</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Detalles</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Tempo de execución</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transferencia DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transferencia PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Datos lidos</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Datos escritos</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Datos transmitidos</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Datos recibidos</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Atributos de tempo de execución</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Resolución da pantalla</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Estatísticas do CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Estatísticas do adaptador de rede</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Versión %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Non se detectou</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Non se detectou</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Os aplicativos para o sistema operativo convidado</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Tipo do sistema operativo convidado</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Estatísticas do disco ríxido</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Sen discos ríxidos</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Sen adaptadores de rede</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Activado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Desactivado</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Paxinación aniñada</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Paxinación aniñada</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -8374,11 +9158,19 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -9173,11 +9965,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Crear ou modificar cartafoles compartidos</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Instalar os aplicativos para o sistema operativo convidado...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Montar a imaxe de instalación dos aplicativos para o sistema operativo convidado</translation>
     </message>
     <message>
@@ -9392,7 +10184,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Diálogo da i&nformación da sesión</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Mostrar o diálogo da información da sesión</translation>
     </message>
     <message>
@@ -9471,8 +10263,8 @@ p, li { white-space: pre-wrap; }
         <translation><restabelecer predefinidos></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">O valor do camiño predefinido actual mostrarase despois de aceptar os cambios e ó abrir novamente este diálogo.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">O valor do camiño predefinido actual mostrarase despois de aceptar os cambios e ó abrir novamente este diálogo.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -9520,8 +10312,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">O valor do camiño predefinido actual mostrarase despois de aceptar os cambios e ó abrir novamente este diálogo.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9829,7 +10620,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -10548,21 +11339,6 @@ p, li { white-space: pre-wrap; }
         <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
     <message numerus="yes">
         <source>%n year(s)</source>
         <translation type="unfinished">
@@ -10606,10 +11382,6 @@ p, li { white-space: pre-wrap; }
         </translation>
     </message>
     <message>
-        <source>(CD/DVD)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Screens</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -11065,12 +11837,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished">Activado</translation>
+        <translation type="obsolete">Activado</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished">Desactivado</translation>
+        <translation type="obsolete">Desactivado</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -11133,7 +11905,151 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Ningún</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Predefinido</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11421,6 +12337,18 @@ p, li { white-space: pre-wrap; }
         <source>Modify the attributes of the selected disk image file</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -11487,8 +12415,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Seleccione país/territorio</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Cubra este formulario de rexistro para permitirnos saber que emprega VirtualBox e, opcionalmente, telo informado sobre as novas e actualizacións de VirtualBox.</p><p>Empregue caracteres latinos para cubrir os campos de abaixo. Nota que Sun Microsystems soamente empregará esta información para obter estatísticas de uso do produto e para enviarlle boletíns de novas. En particular, Sun Microsystems nunca pasará os seus datos a tercei [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Cubra este formulario de rexistro para permitirnos saber que emprega VirtualBox e, opcionalmente, telo informado sobre as novas e actualizacións de VirtualBox.</p><p>Empregue caracteres latinos para cubrir os campos de abaixo. Nota que Sun Microsystems soamente empregará esta información para obter estatísticas de uso do produto e para enviarlle boletíns de novas. En particular, Sun Microsystems nunca pasará os seus datos a tercei [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -11689,8 +12617,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Suspender a execución da máquina virtual</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Dámoslle a benvida a VirtualBox.</h3><p>A parte esquerda desta xanela destínase a mostrar unha lista de todas as máquinas virtuais do seu computador. Neste intre a lista está baleira porque aínda non creou ningunha máquina virtual.<img src=:/welcome.png align=right/></p><p>Para crear unha nova máquina virtual prema no botón <b>Novo</b> da barra de ferramentas localizada na parte superior da xanela pr [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Dámoslle a benvida a VirtualBox.</h3><p>A parte esquerda desta xanela destínase a mostrar unha lista de todas as máquinas virtuais do seu computador. Neste intre a lista está baleira porque aínda non creou ningunha máquina virtual.<img src=:/welcome.png align=right/></p><p>Para crear unha nova máquina virtual prema no botón <b>Novo</b> da barra de ferramentas localizada na parte superior da xanela pr [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -12046,152 +12974,6 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Información de sesión</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detalles</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Tempo de execución</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transferencia DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transferencia PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Datos lidos</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Datos escritos</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Datos transmitidos</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Datos recibidos</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Atributos de tempo de execución</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Resolución da pantalla</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Estatísticas do CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Estatísticas do adaptador de rede</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Versión %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Non se detectou</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Non se detectou</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Os aplicativos para o sistema operativo convidado</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Tipo do sistema operativo convidado</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Estatísticas do disco ríxido</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Sen discos ríxidos</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Sen adaptadores de rede</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Activado</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Desactivado</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Paxinación aniñada</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Paxinación aniñada</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_hu.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_hu.ts
index 0ae7167..86332d4 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_hu.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_hu.ts
@@ -297,7 +297,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Aszta&l-integráció</translation>
+        <translation type="unfinished">Aszta&l-integráció</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -321,11 +321,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>&Egér-integráció letiltása</translation>
+        <translation type="obsolete">&Egér-integráció letiltása</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Átmenetileg letiltja a gazdagép egerének átvételét</translation>
+        <translation type="obsolete">Átmenetileg letiltja a gazdagép egerének átvételét</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -337,11 +337,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Ctrl-Alt-Del &küldése</translation>
+        <translation type="obsolete">Ctrl-Alt-Del &küldése</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Ctrl-Alt-Del küldése a virtuális gépnek</translation>
+        <translation type="obsolete">Ctrl-Alt-Del küldése a virtuális gépnek</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -349,7 +349,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Ctrl-Alt-Backspace küldése a virtuális gépnek</translation>
+        <translation type="obsolete">Ctrl-Alt-Backspace küldése a virtuális gépnek</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -364,8 +364,8 @@
         <translation type="obsolete">Munkamenet i&nformációk</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Munkamenet információk megjelenítése</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Munkamenet információk megjelenítése</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -421,15 +421,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD eszközök</translation>
+        <translation type="obsolete">&CD/DVD eszközök</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Floppy</translation>
+        <translation type="obsolete">&Floppy</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB eszközök</translation>
+        <translation type="obsolete">&USB eszközök</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -456,12 +456,12 @@
         <translation type="obsolete">Engedélyezed vagy tiltod az RDP kapcsolatokat ehhez a géphez</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>&Integrációs szolgáltatások telepítése...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Integrációs szolgáltatások telepítése...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Integrációs szolgáltatások telepítő CD-kép felcsatolása</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Integrációs szolgáltatások telepítő CD-kép felcsatolása</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -480,7 +480,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>Nap&lózás...</translation>
+        <translation type="obsolete">Nap&lózás...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -558,15 +558,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Teljes &képernyőre váltás</translation>
+        <translation type="obsolete">Teljes &képernyőre váltás</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Váltás a normál és teljes képernyős mód között</translation>
+        <translation type="obsolete">Váltás a normál és teljes képernyős mód között</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Aszta&l-integrációs módba váltás</translation>
+        <translation type="obsolete">Aszta&l-integrációs módba váltás</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -574,7 +574,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Átméretezhető módba váltá&s</translation>
+        <translation type="obsolete">Átméretezhető módba váltá&s</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -654,7 +654,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Ctrl-Alt-Backspace küldés&e</translation>
+        <translation type="obsolete">Ctrl-Alt-Backspace küldés&e</translation>
     </message>
     <message>
         <source>&File</source>
@@ -949,75 +949,294 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Fogd és vidd</translation>
+        <translation type="obsolete">Fogd és vidd</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>A virtuális gép állapotának mentése</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>A viruális gép kikapcsolása</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>&Hálózati beállítások...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation>Megosztott mappák beállítá&sai...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>Távoli kép&ernyő</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>RDP kapcsolatok ki/bekapcsolása ehhez a géphez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>&Videó felvétele</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation>Videófelvétel-kapcsoló</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation>&Videófelvétel beállításai...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>Videófelvétel beállításainak módosítása</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Popup Menu</source>
-        <translation>Felugró menü</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Integrációs szolgáltatások telepítése...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Integrációs szolgáltatások telepítő CD-kép felcsatolása</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <comment>new</comment>
-        <translation type="obsolete">Munkamenet információk megjelenítése</translation>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>&Webkamerák</translation>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Billentyűzet</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Hálózat</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Nap&ló mutatása...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Fájl</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Engedélyez</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1836,6 +2055,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1846,7 +2072,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Adatok fogadása...</translation>
+        <translation type="obsolete">Adatok fogadása...</translation>
     </message>
 </context>
 <context>
@@ -1946,6 +2172,31 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2642,11 +2893,6 @@ p, li { white-space: pre-wrap; }
         <translation>Letiltva</translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation></translation>
-    </message>
-    <message>
         <source>Controller</source>
         <comment>details (audio)</comment>
         <translation>Vezérlő</translation>
@@ -2834,57 +3080,157 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation>Videófelvétel fájl</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation>Videófelvétel attribútumok</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation>Videó felvétele</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation>Letiltva</translation>
+        <translation type="unfinished">Letiltva</translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>NAT hálózat, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>Méret: %1x%2, frissitési ráta: %3fps, bitráta: %4kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Vezérlő</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details</comment>
-        <translation type="obsolete">Letiltva</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Videó-memória</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Képernyők</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">USB vezérlő</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Engedélyezve</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished">Letiltva</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">Engedélyezve</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Engedélyezve</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Letiltva</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Engedélyezve</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Letiltva</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Vezérlő</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Letiltva</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Videó-memória</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Képernyők</translation>
     </message>
     <message>
         <source>2D Video</source>
@@ -3190,7 +3536,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation>Kit&erjesztő csomagok</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3256,28 +3602,16 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Gazda képernyővédőjének kikapc&solása</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>&Dock és menüsor:</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>Automatikus teljes képernyő</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Ha engedélyezed, a gazda dock és menüsor megjelenik, mikor a virtuális gép teljes képernyős módban van.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>Gazda &képernyővédő:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>Ha engedélyezed, a gazda képernyővédője ki lesz kapcsolva, mikoregy virtuális gép fut.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>Kikapcsol, mikor virtuális gép fut</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3316,27 +3650,27 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>Gazda-billentyűkombináció</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>Néhány elemhez ugyanaz a hivatkozás van társítva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation>&VirtualBox kezelő</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>Virtuális &gép</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Minden elérhető és konfigurált hivatkozást listázása.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Add meg a szűrési kritériumot a hivatkozási listához.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3395,7 +3729,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>Felület nyelve&i</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3552,128 +3886,128 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation>&NAT hálózatok</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation>Minden elérhető NAT hálózat listázása.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translation>&Host-only hálózatok</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Nincs új név megadva az eddig <b>%1</b> nevű NAT hálózatnak.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation>Nincs CIDR megadva a NAT hálózathoz: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Nincs CIDR megadva az eddig <b>%1</b> nevű NAT hálózatnak.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation>Érvénytelen CIDR van megadva (<i>%1</i>) a NAT hálózathoz: <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation>Érvénytelen CIDR van megadva (<i>%1</i>) az eddig <b>%2</b> nevű NAT hálózatnak.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translation>Hálózat neve</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation>[üres]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (korábban %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation>Régi hálózati név</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation>Új hálózati név</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation>Hálózati CIDR</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation>DHCP támogatás</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>yes</source>
-        <translation>igen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>no</source>
-        <translation>nem</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation>IPv6 támogatás</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation>Alapértelmezett IPv6 útvonal</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation>A gazda interfésznek jelenleg nincs érvényes IPv4 címe: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation>A gazda interfésznek jelenleg nincs érvényes IPv4 hálózati maszkja: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation>A gazda interfésznek jelenleg nincs érvényes IPv6 címe: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation>A gazda interfésznek jelenleg nincs érvényes DHCP szerver címe: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>A gazda interfésznek jelenleg nincs érvényes DHCP szerver maszkja: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>A gazda interfésznek jelenleg nincs érvényes DHCP szerver alsó címhatára: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>A gazda interfésznek jelenleg nincs érvényes DHCP szerver felső címhatára: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>A nevet számos NAT hálózat használja: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>Aktív</translation>
+        <translation type="unfinished">Aktív</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>N&AT hálózat hozzáadása</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation>NA&T hálózat eltávolítása</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation>NAT hálózat sz&erkesztése</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3775,177 +4109,177 @@ p, li { white-space: pre-wrap; }
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation>Host-only hálózat részletei</translation>
+        <translation type="unfinished">Host-only hálózat részletei</translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation>Kárty&a</translation>
+        <translation type="unfinished">Kárty&a</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation>&Kézi beállítás</translation>
+        <translation type="unfinished">&Kézi beállítás</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>Kézi beállítás használata ehhez a host-only hálózati kártyához.</translation>
+        <translation type="unfinished">Kézi beállítás használata ehhez a host-only hálózati kártyához.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation>&IPv4 cím:</translation>
+        <translation type="unfinished">&IPv4 cím:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>A gazda IPv4 címe ehhez a kártyához.</translation>
+        <translation type="unfinished">A gazda IPv4 címe ehhez a kártyához.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation>IPv4 hálózati &maszk:</translation>
+        <translation type="unfinished">IPv4 hálózati &maszk:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>A gazda IPv4 hálózati maszkja ehhez a kártyához.</translation>
+        <translation type="unfinished">A gazda IPv4 hálózati maszkja ehhez a kártyához.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation>I&Pv6 cím:</translation>
+        <translation type="unfinished">I&Pv6 cím:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>A gazda IPv6 címe ehhez a kártyához, ha az IPv6 támogatott.</translation>
+        <translation type="unfinished">A gazda IPv6 címe ehhez a kártyához, ha az IPv6 támogatott.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation>IPv6 há&lózati maszk hossza:</translation>
+        <translation type="unfinished">IPv6 há&lózati maszk hossza:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>A gazda IPv6 hálózati maszkjának hossza ehhez a kártyához, ha IPv6 támogatott.</translation>
+        <translation type="unfinished">A gazda IPv6 hálózati maszkjának hossza ehhez a kártyához, ha IPv6 támogatott.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation>&DHCP szerver</translation>
+        <translation type="unfinished">&DHCP szerver</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>Sz&erver bekapcsolása</translation>
+        <translation type="unfinished">Sz&erver bekapcsolása</translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation>Megmutatja, hogy a DHCP szerver be van-e kapcsolva a gépen.</translation>
+        <translation type="unfinished">Megmutatja, hogy a DHCP szerver be van-e kapcsolva a gépen.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation>Sze&rver címe:</translation>
+        <translation type="unfinished">Sze&rver címe:</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Ehhez a host-only kártyához tartozó  DHCP szerver címe.</translation>
+        <translation type="unfinished">Ehhez a host-only kártyához tartozó  DHCP szerver címe.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation>Szerver &maszkja:</translation>
+        <translation type="unfinished">Szerver &maszkja:</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Ehhez a host-only kártyához tartozó  DHCP szerver hálózati maszkja.</translation>
+        <translation type="unfinished">Ehhez a host-only kártyához tartozó  DHCP szerver hálózati maszkja.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation>A&lsó címhatár:</translation>
+        <translation type="unfinished">A&lsó címhatár:</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>A DHCP szerver által, ehhez a host-only kártyával kiosztható alsó címhatár.</translation>
+        <translation type="unfinished">A DHCP szerver által, ehhez a host-only kártyával kiosztható alsó címhatár.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation>Felső &címhatár:</translation>
+        <translation type="unfinished">Felső &címhatár:</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>A DHCP szerver által, ehhez a host-only kártyával kiosztható felső címhatár.</translation>
+        <translation type="unfinished">A DHCP szerver által, ehhez a host-only kártyával kiosztható felső címhatár.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation>NAT hálózat részletei</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation>Hálózat b&ekapcsolása</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation>Ezen NAT hálózat bekapcsolása.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation>Hálózat &neve:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>Ezen hálózat neve.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation>Hálózati &CIDR:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>Ezen hálózat CIDR-je.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation>Hálózati beállításak:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation>&DHCP támogatás</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation>Meghatározza a hálózati DHCP támogatását.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation> &IPv6 támogatás</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>Meghatározza a hálózati IPv6 támogatását.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>Alapé&rtelmezett IPv6 útvonal meghirdetése</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation>Meghatározza, hogy a hálózat alapértelmezett IPv6 útvonalnak van-e meghirdetve.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Megnyitja a port továbbítási szabályait kezelő ablakot.</translation>
+        <translation type="unfinished">Megnyitja a port továbbítási szabályait kezelő ablakot.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation>&Port továbbítása</translation>
+        <translation type="unfinished">&Port továbbítása</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>Port továbbítási szabályok</translation>
+        <translation type="unfinished">Port továbbítási szabályok</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation>IPv4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation>IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4000,11 +4334,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>Jelenleg nincs gazda proxy megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>Jelenleg nincs proxy port megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4069,71 +4403,71 @@ p, li { white-space: pre-wrap; }
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation><key_%1></translation>
+        <translation type="unfinished"><key_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation>Bal </translation>
+        <translation type="unfinished">Bal </translation>
     </message>
     <message>
         <source>Right </source>
-        <translation>Jobb </translation>
+        <translation type="unfinished">Jobb </translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation>Bal Shift</translation>
+        <translation type="unfinished">Bal Shift</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation>Jobb Shift</translation>
+        <translation type="unfinished">Jobb Shift</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation>Bal Ctrl</translation>
+        <translation type="unfinished">Bal Ctrl</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation>Jobb Ctrl</translation>
+        <translation type="unfinished">Jobb Ctrl</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation>Bal Alt</translation>
+        <translation type="unfinished">Bal Alt</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation>Jobb Alt</translation>
+        <translation type="unfinished">Jobb Alt</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation>Bal Windows</translation>
+        <translation type="unfinished">Bal Windows</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation>Jobb Windows</translation>
+        <translation type="unfinished">Jobb Windows</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation>Menü gomb</translation>
+        <translation type="unfinished">Menü gomb</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation>Alt Gr</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>Caps Lock</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation>Scroll Lock</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation>Gazda+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
-        <translation>Nincs</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4292,22 +4626,22 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation>Gyorsbillentyű alapértelmezettre</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation>Gyorsbillentyű visszavonása</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation>Név</translation>
+        <translation type="unfinished">Név</translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translation>Gyorsbillentyű</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4452,12 +4786,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space: pre'><nobr>Jelzi a CD/DVD aktivitását:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space: pre'><nobr>Jelzi a CD/DVD aktivitását:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space: pre'><nobr>Jelzi a floppy aktivitását:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space: pre'><nobr>Jelzi a floppy aktivitását:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4497,7 +4831,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Az USB vezérlő le van tiltva</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Az USB vezérlő le van tiltva</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4546,20 +4880,34 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Jelzi a videófelvételi aktivitást:</nobr><br>%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>Videófelvétel letiltva</b></nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>Videófelvételi fájl:</b> %1</nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation>Kiegészítő szolgáltatás állapota:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4633,11 +4981,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>Nincs webkamera csatlakoztatva</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Nincs támogatott webkamera a gazda PC-hez csatlakoztatva</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
@@ -4687,7 +5035,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Videó</translation>
+        <translation type="obsolete">&Videó</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4804,196 +5152,260 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>&Videófelvétel</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>Ha engedélyezed, a VirtualBox videófájlba rögzíti a virtuális gép munkamenetét.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation>Videófelvétel b&ekapcsolása</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>&Fájl elérési útja:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Megadja a fájl nevét, amit a VirtualBox a felvett tartalom mentésére használ.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>&Keretméret:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>A beállítás megadja a rögzített videó felbontását (keretméret).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>A beállítás megadja a rögzített videó <b>vízszintes</b> felbontását (keret szélessége).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>A beállítás megadja a rögzített videó <b>függőleges</b> felbontását (keret magassága).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>&Frame Rate:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>A beállítás megadja a <b>képkockák másodpercenkénti</b> maximális számát. A további képkockák ki lesznek hagyva. Ezen érték csökkentése megnöveli a kihagyandó képkockák számát, és csökkenti a fájlméretet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation>&Minőség:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>A beállítás határozza meg a <b>minőséget</b>. Az érték növelésével a videó jobban fog kinézni, és a fájlméret is nőni fog.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>A beállítás határozza meg a bitsebességet <b>kilobit/másodpercben</b>. Az érték növelésével a videó jobban fog kinézni, és a fájlméret is nőni fog.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation>Ké&pernyők:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>A virtuális gép a hardveres grafikai gyorsító használatára van beállítva. Azonban a gazdarendszer ezt nem biztosítja, így a gép nem képes elindulni.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>A virtuális gépen kevesebb, mint <b>%1</b> videómemóriát adtál meg, ami nem éri el a teljes képernyőhöz vagy az asztal-integrációs módhoz szükséges minimális értéket.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>A virtuális gépen kevesebb, mint <b>%1</b> videómemóriát adtál meg, pedig ez a minimum, ami a nagyfelbontású videók lejátszásához szükséges.</translation>
-    </message>
-    <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>A virtuális gép a gardveres gafikus gyorsító használatása, és az operációs rendszer Windows Vistára vagy újabbra van állítva. A legjobb teljesítmény érdekében, a videómemória ajánlott minimuma: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>A virtuális gép a videó adatfolyam gyorsítását használja. Mivel ez a szolgáltatás csak Windows vendégrendszerrel működik, így ki lesz kapcsolva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>A VRDE szerver-port értéke jelenleg nincs megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>A VRDE azonosítási időtúllépés értéke jelenleg nincs megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation>Egyéni</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation>%1 fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>fps</source>
-        <translation>fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation>alacsony</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation>közepes</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation>magas</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation>kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation>%1 képernyő</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation>Videó rögzítésének engedélyezése a képernyőn: %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation type="unfinished"></translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Mini eszköztár:</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source><qt>%1&nbsp;MB</qt></source>
-        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Ha engedélyezed, a Mini eszköztár meg fog jelenni teljes képernyős és asztal-integrációs módban.</translation>
     </message>
     <message>
-        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>A gépről készített pillanatképek útvonala. A pillanatképek egy picit sok helyet foglalnak el.</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Jelenjen meg &teljes képernyőn</translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>&Alap</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Ha engedélyezed, a Mini ToolBar a képernyő tetején fog megjelenni, és nem az alján, ahol alapértelmezetten megjelenik.</translation>
     </message>
     <message>
-        <source>Identification</source>
-        <translation type="obsolete">Azonosítás</translation>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Legyen a képernyő &tetején</translation>
     </message>
     <message>
-        <source>&Name:</source>
-        <translation type="obsolete">&Név:</translation>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the name of the virtual machine.</source>
-        <translation type="obsolete">A virtuális gép neve.</translation>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>OS &Type:</source>
-        <translation type="obsolete">OS &típusa: </translation>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation type="obsolete">A tervezett vendég operációs rendszer típusa.</translation>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Base &Memory Size</source>
-        <translation type="obsolete">Alap&memória mérete</translation>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
-        <translation type="obsolete">A virtuális gép memóriahasználatát állítja be. Ha túl magas az értek, a virtuális gép nem indul el.</translation>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Video Memory Size</source>
-        <translation type="obsolete">&Videó-memória mérete</translation>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
     </message>
     <message>
-        <source>Controls the amount of video memory provided to the virtual machine.</source>
-        <translation type="obsolete">Megadhatod a virtuális gép videó-memóriájának méretét.</translation>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
     </message>
     <message>
-        <source>&Advanced</source>
-        <translation>H&aladó</translation>
+        <source>%</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Boo&t Order:</source>
-        <translation type="obsolete">Boo&t sorrend: </translation>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+    </message>
+    <message>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation>A gépről készített pillanatképek útvonala. A pillanatképek egy picit sok helyet foglalnak el.</translation>
+    </message>
+    <message>
+        <source>Basi&c</source>
+        <translation>&Alap</translation>
+    </message>
+    <message>
+        <source>Identification</source>
+        <translation type="obsolete">Azonosítás</translation>
+    </message>
+    <message>
+        <source>&Name:</source>
+        <translation type="obsolete">&Név:</translation>
+    </message>
+    <message>
+        <source>Holds the name of the virtual machine.</source>
+        <translation type="obsolete">A virtuális gép neve.</translation>
+    </message>
+    <message>
+        <source>OS &Type:</source>
+        <translation type="obsolete">OS &típusa: </translation>
+    </message>
+    <message>
+        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
+        <translation type="obsolete">A tervezett vendég operációs rendszer típusa.</translation>
+    </message>
+    <message>
+        <source>Base &Memory Size</source>
+        <translation type="obsolete">Alap&memória mérete</translation>
+    </message>
+    <message>
+        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
+        <translation type="obsolete">A virtuális gép memóriahasználatát állítja be. Ha túl magas az értek, a virtuális gép nem indul el.</translation>
+    </message>
+    <message>
+        <source>&Video Memory Size</source>
+        <translation type="obsolete">&Videó-memória mérete</translation>
+    </message>
+    <message>
+        <source>Controls the amount of video memory provided to the virtual machine.</source>
+        <translation type="obsolete">Megadhatod a virtuális gép videó-memóriájának méretét.</translation>
+    </message>
+    <message>
+        <source>A&dvanced</source>
+        <translation>H&aladó</translation>
+    </message>
+    <message>
+        <source>Boo&t Order:</source>
+        <translation type="obsolete">Boo&t sorrend: </translation>
+    </message>
+    <message>
+        <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
         <translation type="obsolete">Meghatározza a bootsorrendet. A pipadobozok segítségével lehetőség nyílik a boot eszközök engedélyezésére/tiltására, illetve az elemek fel-le mozgatásával a bootolási sorrend meghatározására.</translation>
     </message>
     <message>
@@ -5069,7 +5481,7 @@ p, li { white-space: pre-wrap; }
         <translation>Pilla&natkép mappa:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>L&eírás</translation>
     </message>
     <message>
@@ -5082,7 +5494,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Ha engedélyezed, minden lemezcsere után az új beállítások elmentődnek a beállítófájlba, így megőrződnek két indítás között.</translation>
+        <translation type="obsolete">Ha engedélyezed, minden lemezcsere után az új beállítások elmentődnek a beállítófájlba, így megőrződnek két indítás között.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5127,38 +5539,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Eltávolítható média:</translation>
+        <translation type="obsolete">Eltávolítható média:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Emlékezzen a változtatások&ra</translation>
+        <translation type="obsolete">Emlékezzen a változtatások&ra</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Mini eszköztár:</translation>
+        <translation type="obsolete">Mini eszköztár:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Ha engedélyezed, a Mini eszköztár meg fog jelenni teljes képernyős és asztal-integrációs módban.</translation>
+        <translation type="obsolete">Ha engedélyezed, a Mini eszköztár meg fog jelenni teljes képernyős és asztal-integrációs módban.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Jelenjen meg &teljes képernyőn</translation>
+        <translation type="obsolete">Jelenjen meg &teljes képernyőn</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Ha engedélyezed, a Mini ToolBar a képernyő tetején fog megjelenni, és nem az alján, ahol alapértelmezetten megjelenik.</translation>
+        <translation type="obsolete">Ha engedélyezed, a Mini ToolBar a képernyő tetején fog megjelenni, és nem az alján, ahol alapértelmezetten megjelenik.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Legyen a képernyő &tetején</translation>
+        <translation type="obsolete">Legyen a képernyő &tetején</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">egy 64 bites vendégrendszert választottál ehhez a géphez. Ezek a rendszerek igényik a hardvervirtualizációt (VT-x/AMD-V), így ez a tulajdonság automatikusan engedélyezve lesz.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>Fog&d és vidd:</translation>
     </message>
     <message>
@@ -5167,11 +5579,107 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation>Nincs megadva név a vituális géphez.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>A virtuális gép operációs rendszere 64bitesre van állítva. A 64bites vendégrendszerhez hardveres virtualizáció szükséges, így ezt automatikusan engedélyezve lesz, ha elfogadod a változásokat.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Mini eszköztár:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Ha engedélyezed, a Mini eszköztár meg fog jelenni teljes képernyős és asztal-integrációs módban.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Jelenjen meg &teljes képernyőn</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Ha engedélyezed, a Mini ToolBar a képernyő tetején fog megjelenni, és nem az alján, ahol alapértelmezetten megjelenik.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Legyen a képernyő &tetején</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5389,35 +5897,35 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation>Jelenleg nincs bridge-elt hálózati kártya kiválasztva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>Jelenleg nincs belső hálózati név megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>Jelenleg nincs host-only hálózati kártya kiválasztva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation>Jelenleg nincs általános meghajtó kiválasztva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>A MAC címnek 12 hexadecimális számnak kell lennie.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation>A MAC cím második számjegye talán nem valós, mert csak unicast címek engedélyezettek.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>Jelenleg nincs NAT hálózati név megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>Add meg aNAT hálózat nevét, amelyhez ez a hálózati kártya csatlakozni fog. Létrehozhatsz vagy törölhetsz hálózatokat a virtuális gép kezelése ablakon belül a globális hálózati beállítások használatával.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5534,23 +6042,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>Jelenleg nincs IRQ megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Jelenleg nincs I/O port megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Kettő vagy több portnak ugyanazok a beállításai.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Jelenleg nincs port elérési út megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Jelenleg duplikált port elérési út van megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5721,10 +6229,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Ha engedélyezed, ez a megosztott mappa végleges lesz.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Ablak</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5775,11 +6279,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Ha engedélyezed, egy cső fog létrejönni a <b>Port útvonal</b> mezőben megadott helyen a virtuális gép indulásakor. Egyébként a virtuális gép megpróbálja felhasználni a már létező csövet.</translation>
+        <translation type="obsolete">Ha engedélyezed, egy cső fog létrejönni a <b>Port útvonal</b> mezőben megadott helyen a virtuális gép indulásakor. Egyébként a virtuális gép megpróbálja felhasználni a már létező csövet.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Cső készítése</translation>
+        <translation type="obsolete">&Cső készítése</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5787,11 +6291,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>A port útvonala, ha a port <b>Gazda cső</b> üzemmódban működik, vagy a gazda soros portjának neve ha a port <b>Gazda eszköz</b> üzemmódban működik.</translation>
+        <translation type="obsolete">A port útvonala, ha a port <b>Gazda cső</b> üzemmódban működik, vagy a gazda soros portjának neve ha a port <b>Gazda eszköz</b> üzemmódban működik.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Port/fájl útvonala:</translation>
+        <translation type="obsolete">&Port/fájl útvonala:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5801,6 +6305,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>A soros port I/O báziscíme. Bármely cím érvényes <tt>0</tt> és <tt>0xFFFF</tt> között.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5818,23 +6338,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>Jelenleg nincs IRQ megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Jelenleg nincs I/O port megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Kettő vagy több portnak ugyanazok a beállításai.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Jelenleg nincs port elérési út megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Jelenleg duplikált port elérési út van megadva.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5921,15 +6441,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>CD/DVD&nbsp;hozzáadása</nobr></translation>
+        <translation type="obsolete"><nobr>CD/DVD&nbsp;hozzáadása</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Floppy&nbsp;hozzáadása</nobr></translation>
+        <translation type="obsolete"><nobr>Floppy&nbsp;hozzáadása</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>Nincs merevlemez kiválasztva a géphez: <i>%1</i>.</translation>
+        <translation type="unfinished">Nincs merevlemez kiválasztva a(z) <i>%1</i> géphez.</translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -5969,11 +6489,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>CD/DVD hozzáadása</translation>
+        <translation type="obsolete">CD/DVD hozzáadása</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Floppy hozzáadása</translation>
+        <translation type="obsolete">Floppy hozzáadása</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6163,15 +6683,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD &meghajtó:</translation>
+        <translation type="obsolete">CD/DVD &meghajtó:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Válassz egy virtuális meghajtóként használandó virtuális CD/DVD lemezt vagy fizikai meghajtót. A virtuális gép létni fogja a meghajtóba vagy a fizikai meghajtóba helyezett lemez tartalmát.</translation>
+        <translation type="obsolete">Válassz egy virtuális meghajtóként használandó virtuális CD/DVD lemezt vagy fizikai meghajtót. A virtuális gép létni fogja a meghajtóba vagy a fizikai meghajtóba helyezett lemez tartalmát.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>A virtuális CD/DVD meghajtó beállítása</translation>
+        <translation type="obsolete">A virtuális CD/DVD meghajtó beállítása</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6195,7 +6715,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Virtuális CD/DVD választása...</translation>
+        <translation type="obsolete">Virtuális CD/DVD választása...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6265,19 +6785,67 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>Nincs név adva a vezérlőhöz ezen a helyen: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>A(z) <b>%1</b> helyen levő vezérlő olyan nevet használ, amit már használ egy vezérlő ezen a helyen: <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> olyan merevlemezt használ, mely már ide van csatolva: <i>%2</i>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>A géphez jelenleg több vezérlőt használsz, mint amit a lapkakészlet támogat:  %1. Válassz másik lapkakészlet-típust a beállítások Rendszer lapján, vagy csökkentsd a vezérlők számát a beállítások Tároló lapján: %2</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Virtuális optikai lemez választása...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6505,47 +7073,55 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>&Mutatóeszköz:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Meghatározza, hogy az emulált mutatóeszköz szabványos PS/2-es egér, USB-s tablet, vagy USB-s többérintéses tablet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>A gazda rendszer memóriájának (<b>%2</b>) több, mint <b>%1%</b>-át rendelted a virtuális géphez. Így túl kevés marad a gazda operációs rendszernek. Adj kevesebb memóriát a virtuális gépnek.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>A gazda rendszer memóriájának (<b>%2</b>) több, mint <b>%1%</b>-át rendelted a virtuális géphez. Így túl kevés marad a gazda operációs rendszernek, ami problémákat okozhat. Adj kevesebb memóriát a virtuális gépnek.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>Az I/O APIC szolgáltatás jelenleg nincs bekapcsolva a Rendszer lapon Alaplap részében. Szükség van rá az ICH9 lapkakészlet támogatásához. Automatikusan bekapcsolódik, ha eelfogadod a változtatásokat.</translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>Az USB vezérlő emulációja jelenleg nincs bekapcsolva az USB lapon. Az USB-s beviteli eszközök támogatásátához ban rá szükség. Automatikusan bekapcsolódik, ha eelfogadod a változtatásokat.</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>Teljesítménybeli problémák miatt,a virtuális géphez társított virtuális processzorok száma nem lehet nagyobb, mint a fizikai processzorok számának duplája a gazda számítógépen (<b>%1</b>). Csökkentsd le a virtuális processzorok számát.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>Több virtuális processzort társítottál a virtuális géphez, mint a gazda rendszer fizikai processzora (<b>%1</b>). Ez valószínűleg csökkenteni fogja a virtuális gép teljesítményét. Fontold meg a virtuális processzorok számának csökkentését.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Az I/O APIC szolgáltatás jelenleg nincs bekapcsolva a Rendszer lapon Alaplap részében. Szükség van rá az egynél több virtuális processzor támogatásához. Automatikusan bekapcsolódik, ha eelfogadod a változtatásokat.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>A hardveres virtualizáció jelenleg nincs bekapcsolva a Rendszer lap Gyorsítás részében. Szükség van rá az egynél több virtuális processzor támogatásához. Automatikusan bekapcsolódik, ha eelfogadod a változtatásokat.</translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>A processzor végrehajtási csúcsát túl acsonyra állítottad. Ez lassíthatja a virtuális gép reakcióidejét.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6617,7 +7193,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>USB 2.0 (E&HCI) vezérlő engedélyezése</translation>
+        <translation type="obsolete">USB 2.0 (E&HCI) vezérlő engedélyezése</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6680,8 +7256,28 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Az USB 2.0 jelenleg be van kapcsolva a virtuális gépen. Azonban ehhez a következőnek telepítve kell lennie: <b><nobr>%1</nobr></b>.</p><p>A VirtualBox oldaláról letöltve telepítsd fel a Kiterjesztő csomagot. Ezután újra be engedélyezni tudod az USB 2.0-t. Addig ki lesz kapcsolva, hacsak meg nem szakítod a beállítások módosítását.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>Az USB 2.0 jelenleg be van kapcsolva a virtuális gépen. Azonban ehhez a következőnek telepítve kell lennie: <b>%1</b>.A VirtualBox oldaláról letöltve telepítsd fel a Kiterjesztő csomagot, vagy kapcsold ki az USB 2.0-t, hogy a gép el tudjon indulni.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6820,7 +7416,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>Be&zárás</translation>
+        <translation type="obsolete">Be&zárás</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6839,6 +7439,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Bezárás</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Átváltás</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6880,7 +7503,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>A VirtualBox COM feladat létrehozása sikertelen.</p><p>Az alkalmazás most bezáródik.</p></translation>
+        <translation type="obsolete"><p>A VirtualBox COM feladat létrehozása sikertelen.</p><p>Az alkalmazás most bezáródik.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -7072,15 +7695,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>A nyelvi fájl nem tölthető be: <b><nobr>%1</nobr></b>. <p>A nyelv ideiglenesen visszaáll angolra (beépítet). A Virtualbox ablakában, a <b>Fájl</b>menün belül válaszd a <b>Beállítások</b> menüpontot, és a <b>Nyelv</b> oldalon válassz egy nyelvet.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>A vendég rendszerre telepített VirtualBox Integrációs szolgáltatások túl régiiek: telepített verzió: %1, ajánlott verzió: %2. Néhány, Integrációs szolgáltatást igénylő funkció (egér-integráció, vendég képernyőjének átméretezése) valószínűleg nem fog helyesen működni.</p><p>Az <b>Eszközök</b> menüből, az <b>Integrációs szolgáltatások telepítése</b> menüpont kiválasztásával frissítsd az Integrációs szolgáltat [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>A vendég rendszerre telepített VirtualBox Integrációs szolgáltatások elavultak: telepített verzió: %1, ajánlott verzió: %2. Néhány, Integrációs szolgáltatást igénylő funkció (egér-integráció, vendég képernyőjének átméretezése) valószínűleg nem fog helyesen működni.</p><p>Az <b>Eszközök</b> menüből, az <b>Integrációs szolgáltatások telepítése</b> menüpont kiválasztásával frissítsd az Integrációs szolgáltatás [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>A vendég rendszerre telepített VirtualBox Integrációs szolgáltatások túl újak a VirtualBox ezen verziójához: telepített verzió: %1, ajánlott verzió: %2.</p><p>Régi VirtualBoxon nem támogatott egy újabb Additions használata. <p>Az <b>Eszközök</b> menüből, az <b>Integrációs szolgáltatások telepítése</b> menüpont kiválasztásával telepítsd fel az Integrációs szolgáltatások aktuális verzióját.</p></t [...]
     </message>
     <message>
@@ -7209,9 +7832,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Letöltés</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Csatolás</translation>
+        <translation type="obsolete">Csatolás</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7367,8 +7990,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Egy ablak mutatása a termékinformációkkal</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Elérhető a VirtualBox egy újabb verziója! A(z) <b>%1</b> -s verzió elérhető a <a href="https://www.virtualbox.org/">virtualbox.org</a> weboldalon.</p><p>Közvetlenül pedig erről a linkről töltheted le:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Elérhető a VirtualBox egy újabb verziója! A(z) <b>%1</b> -s verzió elérhető a <a href="http://www.virtualbox.org/">virtualbox.org</a> weboldalon.</p><p>Közvetlenül pedig erről a linkről töltheted le:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7468,7 +8091,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Egy vagy több virtuális merevlemez, CD/DVD vagy floppy jelenleg nem érhető el. Ennek eredményeképp, nem leszel képes olyan műveletek végrehajtására, melyek ezt a médiumot használnák, amíg az újra elérhető nem lesz.</p><p>Az <b>Ellenőrzés</b> gombbal nyisd meg a Virtuális médiakezelő ablakot és láthatod az elérhetetlen médiát, vagy a <b>Kihagy</b> gombbal figyelmen kívül hagyod ezt az üzenetet.</p></translation>
+        <translation type="obsolete"><p>Egy vagy több virtuális merevlemez, CD/DVD vagy floppy jelenleg nem érhető el. Ennek eredményeképp, nem leszel képes olyan műveletek végrehajtására, melyek ezt a médiumot használnák, amíg az újra elérhető nem lesz.</p><p>Az <b>Ellenőrzés</b> gombbal nyisd meg a Virtuális médiakezelő ablakot és láthatod az elérhetetlen médiát, vagy a <b>Kihagy</b> gombbal figyelmen kívül hagyod ezt az üzenetet.</p></tr [...]
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -7498,8 +8121,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">F&elülírás</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Kritikus hiba lépett fel a virtuális gép futása során és a gép leállt.</p><p>Segítségért látogass el a <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> közösségi részlegébe vagy a támogatási oldalra. Mellékeld a <tt>VBox.log</tt> naplófájl tartalmát és a <tt>VBox.png</tt> képet, melyeket a(z) <nobr><b>%1</b></nobr> mappában megtalálsz, ahogy annak a leírását is, mit csin [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Kritikus hiba lépett fel a virtuális gép futása során és a gép leállt.</p><p>Segítségért látogass el a <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> közösségi részlegébe vagy a támogatási oldalra. Mellékeld a <tt>VBox.log</tt> naplófájl tartalmát és a <tt>VBox.png</tt> képet, melyeket a(z) <nobr><b>%1</b></nobr> mappában megtalálsz, ahogy annak a leírásá [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7782,7 +8405,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Biztos, hogy törlöd ezt a CD/DVD eszközt?</p><p>Enélkül nem leszel képes CD-t vagy ISO képmást csatolni, illetve az integrációs szolgáltatásokat telepíteni!</p></translation>
+        <translation type="obsolete"><p>Biztos, hogy törlöd ezt a CD/DVD eszközt?</p><p>Enélkül nem leszel képes CD-t vagy ISO képmást csatolni, illetve az integrációs szolgáltatásokat telepíteni!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7885,7 +8508,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>>Virtuális CD/DVD meghajtót adsz hozzá a vezérlőhöz: <b>%1</b>.</p><p>Szeretnél egy virtuális CD/DVD lemezt a meghajtóba tenni vagy még maradjon üresen?</p></translation>
+        <translation type="obsolete"><p>>Virtuális CD/DVD meghajtót adsz hozzá a vezérlőhöz: <b>%1</b>.</p><p>Szeretnél egy virtuális CD/DVD lemezt a meghajtóba tenni vagy még maradjon üresen?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7907,14 +8530,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nem sikerült a CD/DVD eszközt (<nobr><b>%1</b></nobr>) leválasztani a(z) <i>%2</i> foglalatról, ezen a virtuális gépen: <b>%3</b>.</translation>
+        <translation type="obsolete">Nem sikerült a CD/DVD eszközt (<nobr><b>%1</b></nobr>) leválasztani a(z) <i>%2</i> foglalatról, ezen a virtuális gépen: <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nem sikerült a floppy eszközt (<nobr><b>%1</b></nobr>) leválasztani a(z) <i>%2</i> foglalatról, ezen a virtuális gépen: <b>%3</b>.</translation>
+        <translation type="obsolete">Nem sikerült a floppy eszközt (<nobr><b>%1</b></nobr>) leválasztani a(z) <i>%2</i> foglalatról, ezen a virtuális gépen: <b>%3</b>.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>Úgy tűnik a VirtualBox Integrációs szolgáltatások nem érhetők el a virtuális gépen, és nélküle a megosztott mappák nem használhatók. A virtuális gépen belüli megosztott mappák használatához telepítsd fel az Integrációs szolgáltatásokat, ha nincsenek telepítve, vagy ha csak nem működnek helyesen, az <b>Eszközök</b> menüben az <b>Integrációs szolgáltatások telepítése...</b> választásával. Ha telepítve vannak, de a gép ne [...]
     </message>
     <message numerus="yes">
@@ -7961,19 +8584,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nem sikerült a CD/DVD eszközt (<nobr><b>%1</b></nobr>) a(z) <i>%2</i> foglalathoz társítani ezen a virtuális gépen: <b>%3</b>.</translation>
+        <translation type="obsolete">Nem sikerült a CD/DVD eszközt (<nobr><b>%1</b></nobr>) a(z) <i>%2</i> foglalathoz társítani ezen a virtuális gépen: <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nem sikerült a floppy eszközt (<nobr><b>%1</b></nobr>) a(z) <i>%2</i> foglalathoz társítani ezen a virtuális gépen: <b>%3</b>.</translation>
+        <translation type="obsolete">Nem sikerült a floppy eszközt (<nobr><b>%1</b></nobr>) a(z) <i>%2</i> foglalathoz társítani ezen a virtuális gépen: <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Ne feledd, hogy ezen médium tárolóegysége nem lesz törölve és így később is hozzá lehet adni a listához.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>Úgy tűnik, a VirtualBox Integrációs szolgáltatások nem érhetők el a virtuális gépen, és nélküle a megosztott mappák nem használhatók. A virtuális gépen belüli megosztott mappák használatához telepítsd fel az Integrációs szolgáltatásokat, ha nincsenek telepítve, vagy ha csak nem működnek helyesen, az <b>Eszközök</b> menüben az <b>Integrációs szolgáltatások telepítése...</b> választásával. Ha telepítve vannak, a megosztott mappák elérhe [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Úgy tűnik a VirtualBox Integrációs szolgáltatások nem érhetők el a virtuális gépen, és nélküle a megosztott mappák nem használhatók. A virtuális gépen belüli megosztott mappák használatához telepítsd fel az Integrációs szolgáltatásokat, ha nincsenek telepítve, vagy ha csak nem működnek helyesen, az <b>Eszközök</b> menüben az <b>Integrációs szolgáltatások telepítése...</b> választásával. Ha telepítve vannak, de a gép ne [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -8219,7 +8842,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Failed to drop data.</source>
         <translatorcomment>CHECKIT: DnD operation "drop" state failed. See UIDnDHandler.</translatorcomment>
-        <translation>Az adatok fogadása sikertelen.</translation>
+        <translation type="obsolete">Az adatok fogadása sikertelen.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -8279,240 +8902,327 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>A VirtualBox kezelő helyi korlátozások miatt nem tud elindulni.</p><p>A progmram most leáll-</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>A(z) <b>%1</b> nyelv fájlja nem található a mappában: <b><nobr>%2</nobr></b>.</p><p>A nyelv ideiglenesen visszaáll a rendszer alapértelmezett nyelvére. A Virtualbox kezelő ablakában, a <b>Fájl</b>menün belül, válaszd a <b>Beállítások</b> menüpontot, és a <b>Nyelv</b> oldalon válassz egy elérhető nyelvet.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>A nyelvi fájl nem tölthető be: <b><nobr>%1</nobr></b>. <p>A nyelv ideiglenesen visszaáll angolra (beépített). A Virtualbox kezelő ablakában, a <b>Fájl</b>menün belül, válaszd a <b>Beállítások</b> menüpontot, és a <b>Nyelv</b> oldalon válassz egy elérhető nyelvet.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation>Nincs ilyen nevű virtuális gép: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation>Kihagy</translation>
+        <translation type="unfinished">Kihagy</translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation>A NAT hálózat létrehozása sikertelen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>A NAT hálózat eltávolítása sikertelen: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation>A DHCP szerver létrehozása sikertelen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>A hálózati kártya (<b>%1</b>) DHCP szerverének eltávolítása sikertelen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>Gazda hálózati kártya létrehozása sikertelen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>Ú&j lemez létrehozása</translation>
+        <translation type="unfinished">Ú&j lemez létrehozása</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>Létező merevlemez &használata</translation>
+        <translation type="unfinished">Létező merevlemez &használata</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation>Ür&esen hagy</translation>
+        <translation type="unfinished">Ür&esen hagy</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>Lemez &választása</translation>
+        <translation type="unfinished">Lemez &választása</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Biztos elengeded a virtuális merevlemezt: <nobr><b>%1</b></nobr>?</p><p>Le fog választódni a következő virtuális gép(ek)ről: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Biztos elengeded a virtuálisoptikai lemezt: <nobr><b>%1</b></nobr>?</p><p>Le fog választódni a következő virtuális gép(ek)ről: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Biztos elengeded a virtuális floppyt: <nobr><b>%1</b></nobr>?</p><p>Le fog választódni a következő virtuális gép(ek)ről: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Biztos törölni akarod a virtuális merevlemezt az ismert médiumok listájáról: <nobr><b>%1</b></nobr> ?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation><p>Mivel ez a merevlemez elérhetetlen, a lemezfájl sem törölhető.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Biztos törölni akarod a virtuális optikai lemezt az ismert médiumok listájáról: <nobr><b>%1</b></nobr> ?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Biztos törölni akarod a virtuális floppy lemezt az ismert médiumok listájáról: <nobr><b>%1</b></nobr> ?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>A virtuális optikai lemez <nobr>(<b>%1</b>)</nobr> nem helyezhető be a gépbe: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation><p>Szereznéd erőszakkal behelyezni a lemezt?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>A virtuális optikai lemez <nobr>(<b>%1</b>)</nobr> nem adható ki a gépből: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation><p>Szereznéd erőszakkal kiadatni a lemezt?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>A virtuális floppy lemez <nobr>(<b>%1</b>)</nobr> nem helyezhető be a gépbe: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>A virtuális floppy lemez <nobr>(<b>%1</b>)</nobr> nem adható ki a gépből: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>A merevlemez megnyitása sikertelen: <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Az optikai lemez megnyitása sikertelen: <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>A floppy fájl megnyitása sikertelen: <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>A merevlemez bezárása sikertelen: <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Az optikai lemez bezárása sikertelen: <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>A floppy lemez bezárása sikertelen: <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation>
-            <numerusform><p>A virtuális gépek (%n) jelenleg mentett állapotban vannak: <b>%1</b>.</p><p>Ha folytatod, az exportált gép futási állapota elveszik. A létező gépek nem módosulnak.</p></numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source>Switch</source>
-        <translation>Átváltás</translation>
+        <translation type="unfinished">Átváltás</translation>
     </message>
     <message>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>A távoli asztal szerver bekapcsolása sikertelen a virtuális géphez: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>A távoli asztal szerver kikapcsolása sikertelen a virtuális géphez: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>A videórögzítés bekapcsolása sikertelen a virtuális géphez: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>A videórögzítés kikapcsolása sikertelen a virtuális géphez: <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>Nem található a <b>VirtualBox Integrációs szolgáltatások </b> lemezkép fájl. <nobr></p><p>Letöltöd a lemezkép fájlt az internetről?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Download</source>
-        <translation>Letöltés</translation>
+        <translation type="unfinished">Letöltés</translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Biztos le akarod tölteni a <b>VirtualBox Integrációs szolgáltatások</b> lemezkép fájlt innen: <nobr><a href="%1">%1</a></nobr> (mérete %2 byte)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>A <b>VirtualBox Integrációs szolgáltatások</b> lemezkép fájl sikeresen letöltődött a <nobr><a href="%1">%1</a></nobr> helyről, de nem lett lementve, mint <nobr><b>%2</b>.</nobr></p><p>Kérlek, válassz másik helyet a fájlnak.</p></translation>
-    </message>
-    <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>A VirtualBox Integrációs szolgáltatások lemezkép fájl sikeresen letöltődött a <nobr><a href="%1">%1</a></nobr> helyről és el lett mentve: <nobr><b>%2</b>.</nobr></p><p>Szeretnéd regisztrálni a lemezkép fájlt és berakni a virtuális CD/DVD meghajtóba?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Nem lehet a <b>VirtualBox integrációs szolgáltatások</b> telepítőlemezét felcsatolni a(z) <b>%1</b> virtuális gépre, mert a gép nem rendelkezik CD/DVD meghajtóval. Adj egyet hozzá a virtuális gép beállításainál a Tároló lapon.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation><p>Nem található a <b>VirtualBox felhasználói kézikönyv </b>: <nobr><b>%1</b>.</nobr></p><p>Letöltöd az internetről?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Biztos le akarod tölteni a <b>VirtualBox Felhasználói kézikönyvet</b> innen: <nobr><a href="%1">%1</a></nobr> (%2 byte)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>A VirtualBox Felhasználói kézikönyv sikeresen letöltődött innen: <nobr><a href="%1">%1</a></nobr> de nem lett helyileg elmentve, mint <nobr><b>%2</b>.</nobr></p><p>Válassz a fájl számára másik helyet.</p></translation>
+        <translation type="unfinished"><p>A VirtualBox Felhasználói kézikönyv sikresen letöltődött innen: <nobr><a href="%1">%2</a></nobr> de nem lett helyikeg elmentve, mint <nobr><b>%3</b>.</nobr></p><p>Válassz a fájl számára másik helyet.</p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>A VirtualBox Felhasználói kézikönyv sikeresen letöltődött innen: <nobr><a href="%1">%1</a></nobr> és el lett mentve mint <nobr><b>%2</b>.</nobr></p></translation>
+        <translation type="unfinished"><p>A VirtualBox Felhasználói kézikönyv sikresen letöltődött innen: <nobr><a href="%1">%2</a></nobr> és el lett mentve mint <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source>Close</source>
-        <translation>Bezárás</translation>
+        <translation type="unfinished">Bezárás</translation>
     </message>
     <message>
         <source>Ok</source>
-        <translation>Ok</translation>
+        <translation type="unfinished">Ok</translation>
     </message>
     <message>
         <source>Do not show this message again</source>
-        <translation>Ne mutassa ezt az üzenetet újra</translation>
+        <translation type="unfinished">Ne mutassa ezt az üzenetet újra</translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>El akarod távolítani a NAT hálózatot: <nobr><b>%1</b>?</nobr></p><p>Ha ezt a hálózatot egy vagy több virtuális gép hálózati kártyája is használja, ezen kártyák nem használhatók majd, míg nem módosítod a beállításaikat, egy másik hálózati nevet vagy másik adaptertípust választva.</b></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>Úgy tűnik a VirtualBox Integrációs szolgáltatások nem érhetők el a virtuális gépen, és nélküle a megosztott mappák nem használhatók. A virtuális gépen belüli megosztott mappák használatához telepítsd fel az Integrációs szolgáltatásokat, ha nincsenek telepítve, vagy ha csak nem működnek helyesen, az <b>Eszközök</b> menüben az <b>Integrációs szolgáltatások telepítése...</b> választásával. Ha telepítve vannak, de a gép ne [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Csatolás</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Webkamera (<b>%1</b>) csatlakoztatása sikertelen a virtuális géphez: <b>%2</b>.</translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Webkamera (<b>%1</b>) leválasztása sikertelen a virtuális gépről: <b>%2</b>.</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>A virtuális képernyő jelenleg <b>%1&nbsp;bit</b> színmódra van beállítva. A jobb teljesítmény érdekében, állítsd át <b>%2&nbsp;bitre</b>. Ez alapesetben megtehető a vendég operációs rendszer Vezérlőpult vagy Rendszerbeállítások. <b>Képernyő</b> részében.</p></translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8575,19 +9285,19 @@ p, li { white-space: pre-wrap; }
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation>Mindig látsszon az eszköztár</translation>
+        <translation type="unfinished">Mindig látsszon az eszköztár</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation>Ablak kis méretre</translation>
+        <translation type="unfinished">Ablak kis méretre</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Kilépés a teljes képernyős vagy asztal-integrációs módból</translation>
+        <translation type="unfinished">Kilépés a teljes képernyős vagy asztal-integrációs módból</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation>Virtuális gép bezárása</translation>
+        <translation type="unfinished">Virtuális gép bezárása</translation>
     </message>
 </context>
 <context>
@@ -8604,7 +9314,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Név:</translation>
     </message>
     <message>
@@ -8664,7 +9374,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation>A hálózati művelet a következő hiba miatt sikertelen: %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8691,27 +9401,27 @@ p, li { white-space: pre-wrap; }
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation>Gazda nem található</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation>Tartalom elérése tiltott</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation>Protokoll hiba</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>Rossz SSL tanúsítvány formátum</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>SSL hitelesítési hiba</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>Ismeretlen ok</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9615,7 +10325,7 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>Kattintsd ide a részletekhez</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9697,14 +10407,18 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
         <translation>Virtuális gép fájlok (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Üdvözöl a VirtualBox!</h3><p>Az ablak bal oldali részében a virtuális gépeid listáját látod. Ez jelenleg üres, mivel még nem készítettél egyetlen virtuális gépet sem.<img src=:/welcome.png align=right/></p><p>Új virtuális gép létrehozásához kattints az <b>Új</b> gombra az eszköztáron, az ablak tetején.</p><p>Az <b>%1</b> billentyű megnyomásával azonnali segítséget kérhetsz, vagy látogass el a [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Üdvözöl a VirtualBox!</h3><p>Az ablak bal oldali részében a virtuális gépeid listáját látod. Ez jelenleg üres, mivel még nem készítettél egyetlen virtuális gépet sem.<img src=:/welcome.png align=right/></p><p>Új virtuális gép létrehozásához kattints az <b>Új</b> gombra az eszköztáron, az ablak tetején.</p><p>Az <b>%1</b> billentyű megnyomásával azonnali segítséget kérhetsz, va [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Kezelő</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9737,15 +10451,15 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
     </message>
     <message>
         <source>Settings</source>
-        <translation>Beállítások</translation>
+        <translation type="obsolete">Beállítások</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation><b>%1</b>. oldal:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation><b>%1: %2</b> oldal:</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9790,6 +10504,10 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
         <source>Display</source>
         <translation>Képernyő</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -9865,6 +10583,43 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">jelenleg több vezérlőt használsz, mint amit a(z) %1 lapkakészlet támogat. Válassz másik lapkakészlet-típust a beállítások Rendszer lapján vagy csökkentsd a vezérlők számát a beállítások Tároló lapján: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Beállítások</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Bezárás</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -9960,101 +10715,276 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
         <translation type="obsolete">Frissítések ellenőrzése</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p>
-<p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p>
-<p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Ez a varázsló ellenőrzi a VirtualBox weboldalán, hogy elérhető-e újabb verzió a jelenleginél.</p>
-<p>Nyomd meg az <b>Ellenőrzés</b> gombot a frissítések kereséséhez. A <b>Mégsem</b> gombbal kiléphetsz a varázslóból az ellenőrzés lefutása nélkül.</p>
-<p>Ezt a varázslót bármikor elindíthatod a <b>Súgó</b menü <b>Frissítések ellenőrzése...</b> menüpontjával.</p></translation>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p>
+<p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p>
+<p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Ez a varázsló ellenőrzi a VirtualBox weboldalán, hogy elérhető-e újabb verzió a jelenleginél.</p>
+<p>Nyomd meg az <b>Ellenőrzés</b> gombot a frissítések kereséséhez. A <b>Mégsem</b> gombbal kiléphetsz a varázslóból az ellenőrzés lefutása nélkül.</p>
+<p>Ezt a varázslót bármikor elindíthatod a <b>Súgó</b menü <b>Frissítések ellenőrzése...</b> menüpontjával.</p></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Mégsem</translation>
+    </message>
+    <message>
+        <source>Summary</source>
+        <translation type="obsolete">Összegzés</translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Elérhető a VirtualBox egy újabb verziója! A(z) <b>%1</b> -s verzió elérhető a <a href="http://www.virtualbox.org/">virtualbox.org</a> weboldalon.</p><p>Közvetlenül pedig erről a linkről töltheted le:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
+        <translation type="obsolete"><p>Nem lehet letölteni az új verziók információit a következő hálózati probléma miatt:</p><p><b>%1</b></p></translation>
+    </message>
+    <message>
+        <source>You are already running the most recent version of VirtualBox.</source>
+        <translation type="obsolete">Nincs a jelenleginél újabb VirtualBox verzió. Később azonban érdemes lenne újra megnézni.</translation>
+    </message>
+    <message>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Ez a varázsló ellenőrizni fogja a VirtualBox weboldalán, hogy elérhető-e újabb verzió a VirtualBox-ból.</p><p>Az <b>Ellenőrzés</b> gombbal tudod elindítani a folyamatot és a <b>Mégsem</b> gombbal jelezheted, ha nem akarsz ellenőrizni.</p><p>Bármikor elindíthatod a varázslót a <b>Súgó</b> menü <b>Frissítések ellenőrzése...</b> pontjával.</p></translation>
+    </message>
+</context>
+<context>
+    <name>UIUpdateStepVirtualBox</name>
+    <message>
+        <source>Checking for a new VirtualBox version...</source>
+        <translation>Új VirtualBox verzió keresése...</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMCloseDialog</name>
+    <message>
+        <source>Close Virtual Machine</source>
+        <translation>Virtuális gép bezárása</translation>
+    </message>
+    <message>
+        <source>You want to:</source>
+        <translation>Szeretnéd:</translation>
+    </message>
+    <message>
+        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
+        <translation><p>Elmenti a virtuális gép aktuális állapotát a merevlemezre.</p><p>Amikor a virtuális gép legközelebb el lesz indítva, a mentett állapot lesz visszatöltve, és a futás a mentés előtti állapottól fog indulni.</p><p>A virtuális gép mentése a virtuális gép memóriájának méretétől és a vendégrendszer típusától függően hosszú ideig is eltarthat. Légy türelemmel, és ne állítsd le a VirtualBox-ot addig</p></translation>
+    </message>
+    <message>
+        <source>&Save the machine state</source>
+        <translation>&Elmenteni a gép állapotát</translation>
+    </message>
+    <message>
+        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
+        <translation><p>A Power gomb megnyomásának megfelelő ACPI jelet küld a gépnek.</p><p>Alapértelmezetten a vendég rendszer észleli ezt az eseményt, és elindítja a rendes rendszer-leállítási folyamatot. Ez az ajánlott mód a virtuális gép kikapcsolására, mert annak így lehetősége van az adatok és beállítások elmentésére.</p><p>Ha a gép nem reagál semmit erre, akkor valószínűleg nem ismeri ezt az ACPI eseményt, vagy az ACPI-nek konfigurációs problémái van [...]
+    </message>
+    <message>
+        <source>S&end the shutdown signal</source>
+        <translation>L&eállítani a gépet</translation>
+    </message>
+    <message>
+        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
+        <translation><p>Kikapcsolja a virtuális gépet.</p><p>Ez a művelet azonnal kikapcsolja a virtuális gépet. Így a vendég rendszer képtelen lesz rendesen leállítani a gépet. Ennek <i>adat vesztés</i> lehet az eredménye a virtuális gépen belül. Ez a művelet csak akkor ajánlott, ha a virtuális gép nem válaszol a <b>Gép leállítása</b> gomb megnyomására.</p></translation>
+    </message>
+    <message>
+        <source>&Power off the machine</source>
+        <translation>Kika&pcsolni a gépet</translation>
+    </message>
+    <message>
+        <source>Restore the machine state stored in the current snapshot</source>
+        <translation>A gép állapotának visszaállítása az aktuális pillanatképből</translation>
+    </message>
+    <message>
+        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
+        <translation><p>Ha engedélyezed, a gép visszaáll a legutolsó pillanatkép állapotába, miután kikapcsolod. Ez akkor hasznos, ha el szeretnéd dobni a virtuális gép legutóbbi módosításait.</p></translation>
+    </message>
+    <message>
+        <source>&Restore current snapshot '%1'</source>
+        <translation>Ezen &pillanatkép visszatöltése: '%1'</translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
+    <message>
+        <source>&Details</source>
+        <translation>&Részletek</translation>
+    </message>
+    <message>
+        <source>&Snapshots</source>
+        <translation>&Pillanatkép</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Munkamenet információk</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Részletek</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Futtatókörnyezet</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA átvitelek</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO átvitelek</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Olvasott adat</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Írt adat</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Küldött adat</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Fogadott adat</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Engedélyezve</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Letiltva</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Futtatókörnyezet paraméterei</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Felbontás</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">CD/DVD statisztika</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Hálózati adapter statisztika</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Nincs csatolva</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Verzió: %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Nem található</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Nem található</translation>
     </message>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">Mégsem</translation>
+        <source>Guest Additions</source>
+        <translation>Integrációs szolgáltatások</translation>
     </message>
     <message>
-        <source>Summary</source>
-        <translation type="obsolete">Összegzés</translation>
+        <source>Guest OS Type</source>
+        <translation>Vendég OS típusa</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Elérhető a VirtualBox egy újabb verziója! A(z) <b>%1</b> -s verzió elérhető a <a href="https://www.virtualbox.org/">virtualbox.org</a> weboldalon.</p><p>Közvetlenül pedig erről a linkről töltheted le:</p><p><a href=%2>%3</a></p></translation>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Merevlemez statisztika</translation>
     </message>
     <message>
-        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>Nem lehet letölteni az új verziók információit a következő hálózati probléma miatt:</p><p><b>%1</b></p></translation>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Nincsenek merevlemezek</translation>
     </message>
     <message>
-        <source>You are already running the most recent version of VirtualBox.</source>
-        <translation type="obsolete">Nincs a jelenleginél újabb VirtualBox verzió. Később azonban érdemes lenne újra megnézni.</translation>
+        <source>No Network Adapters</source>
+        <translation>Nincsenek hálózati adapterek</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Ez a varázsló ellenőrizni fogja a VirtualBox weboldalán, hogy elérhető-e újabb verzió a VirtualBox-ból.</p><p>Az <b>Ellenőrzés</b> gombbal tudod elindítani a folyamatot és a <b>Mégsem</b> gombbal jelezheted, ha nem akarsz ellenőrizni.</p><p>Bármikor elindíthatod a varázslót a <b>Súgó</b> menü <b>Frissítések ellenőrzése...</b> pontjával.</p></translation>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Engedélyezve</translation>
     </message>
-</context>
-<context>
-    <name>UIUpdateStepVirtualBox</name>
     <message>
-        <source>Checking for a new VirtualBox version...</source>
-        <translation>Új VirtualBox verzió keresése...</translation>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Letiltva</translation>
     </message>
-</context>
-<context>
-    <name>UIVMCloseDialog</name>
     <message>
-        <source>Close Virtual Machine</source>
-        <translation>Virtuális gép bezárása</translation>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Memóriavirtualizáció</translation>
     </message>
     <message>
-        <source>You want to:</source>
-        <translation>Szeretnéd:</translation>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Nem érhető el</translation>
     </message>
     <message>
-        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation><p>Elmenti a virtuális gép aktuális állapotát a merevlemezre.</p><p>Amikor a virtuális gép legközelebb el lesz indítva, a mentett állapot lesz visszatöltve, és a futás a mentés előtti állapottól fog indulni.</p><p>A virtuális gép mentése a virtuális gép memóriájának méretétől és a vendégrendszer típusától függően hosszú ideig is eltarthat. Légy türelemmel, és ne állítsd le a VirtualBox-ot addig</p></translation>
+        <source>Storage Statistics</source>
+        <translation>Tároló statisztika</translation>
     </message>
     <message>
-        <source>&Save the machine state</source>
-        <translation>&Elmenteni a gép állapotát</translation>
+        <source>No Storage Devices</source>
+        <translation>Nincsenek tárolóeszközök</translation>
     </message>
     <message>
-        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation><p>A Power gomb megnyomásának megfelelő ACPI jelet küld a gépnek.</p><p>Alapértelmezetten a vendég rendszer észleli ezt az eseményt, és elindítja a rendes rendszer-leállítási folyamatot. Ez az ajánlott mód a virtuális gép kikapcsolására, mert annak így lehetősége van az adatok és beállítások elmentésére.</p><p>Ha a gép nem reagál semmit erre, akkor valószínűleg nem ismeri ezt az ACPI eseményt, vagy az ACPI-nek konfigurációs problémái van [...]
+        <source>Network Statistics</source>
+        <translation>Hálózati statisztika</translation>
     </message>
     <message>
-        <source>S&end the shutdown signal</source>
-        <translation>L&eállítani a gépet</translation>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Memóriavirtualizáció</translation>
     </message>
     <message>
-        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation><p>Kikapcsolja a virtuális gépet.</p><p>Ez a művelet azonnal kikapcsolja a virtuális gépet. Így a vendég rendszer képtelen lesz rendesen leállítani a gépet. Ennek <i>adat vesztés</i> lehet az eredménye a virtuális gépen belül. Ez a művelet csak akkor ajánlott, ha a virtuális gép nem válaszol a <b>Gép leállítása</b> gomb megnyomására.</p></translation>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Nem érhető el</translation>
     </message>
     <message>
-        <source>&Power off the machine</source>
-        <translation>Kika&pcsolni a gépet</translation>
+        <source>Clipboard Mode</source>
+        <translation>Vágólap mód</translation>
     </message>
     <message>
-        <source>Restore the machine state stored in the current snapshot</source>
-        <translation>A gép állapotának visszaállítása az aktuális pillanatképből</translation>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Fogd és vidd mód</translation>
     </message>
     <message>
-        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation><p>Ha engedélyezed, a gép visszaáll a legutolsó pillanatkép állapotába, miután kikapcsolod. Ez akkor hasznos, ha el szeretnéd dobni a virtuális gép legutóbbi módosításait.</p></translation>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Restore current snapshot '%1'</source>
-        <translation>Ezen &pillanatkép visszatöltése: '%1'</translation>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <source>&Details</source>
-        <translation>&Részletek</translation>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Snapshots</source>
-        <translation>&Pillanatkép</translation>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10208,11 +11138,27 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Leírás elrejtése</translation>
+        <translation type="obsolete">Leírás elrejtése</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Leírás megjelenítése</translation>
+        <translation type="obsolete">Leírás megjelenítése</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10542,39 +11488,39 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
     </message>
     <message>
         <source>Storage settings</source>
-        <translation>Tároló beállítások</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>Válassz egy fájlt, a virtuális gép exportálásához</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>F&ormátum:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>Szabványos OVF 1.0 formátumba írás.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>Új, kísérleti  OVF 2.0 formátumba írás.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation>Tároló beállítá&sok</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10593,14 +11539,14 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Válassz egy fájlt, a virtuális gép exportálásához...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Válassz egy fájlt, a virtuális gép exportálásához...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10670,15 +11616,15 @@ esetleg a <b>Létező</b> gombbal a Virtuális lemezkezelőből.<
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation>Virtuális gép importálása</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>Válassz egy fájlt, a virtuális gép importálásához...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>Válassz egy fájlt, a virtuális gép importálásához</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11217,11 +12163,11 @@ Verzió %1</translation>
         <translation type="obsolete">Ablak megnyitása az megosztott mappák beállításához</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Integrációs szolgáltatások telepítése...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Integrációs szolgáltatások telepítő CD-kép felcsatolása</translation>
     </message>
     <message>
@@ -11553,7 +12499,7 @@ Verzió %1</translation>
         <translation type="obsolete">Munkamenet i&nformációk</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Munkamenet információk megjelenítése</translation>
     </message>
     <message>
@@ -12009,7 +12955,7 @@ Verzió %1</translation>
     </message>
     <message>
         <source>Choose...</source>
-        <translation>Kiválaszt...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12019,8 +12965,8 @@ Verzió %1</translation>
         <translation><alapértelmezettre állítás></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>Az aktuális alapértelmezés akkor lesz kijelezve, ha a változásokat elfogadod, és ezt az ablakot újra megnyitod.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Az aktuális alapértelmezés akkor lesz kijelezve, ha a változásokat elfogadod, és ezt az ablakot újra megnyitod.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -12068,8 +13014,7 @@ Verzió %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Az aktuális alapértelmezés akkor lesz kijelezve, ha a változásokat elfogadod, és ezt az ablakot újra megnyitod.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12434,7 +13379,7 @@ Verzió %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -13305,17 +14250,17 @@ Verzió %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Ezen merevlemez csatlakoztatása egy új különbözeti lemez készítését fogja okozni.</translation>
+        <translation type="obsolete">Ezen merevlemez csatlakoztatása egy új különbözeti lemez készítését fogja okozni.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Valamelyik média ebben a merevlemez-láncban elérhetetlen. Kérlek, használd a Virtuális médiakezelőt <b>Különbözeti merevlemezek mutatása</b> módban a probléma felderítéséhez.</translation>
+        <translation type="obsolete">Valamelyik média ebben a merevlemez-láncban elérhetetlen. Kérlek, használd a Virtuális médiakezelőt <b>Különbözeti merevlemezek mutatása</b> módban a probléma felderítéséhez.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Ez az alap merevlemez a következő különbözeti lemezzel lesz csatlakoztatva:</translation>
+        <translation type="obsolete">Ez az alap merevlemez a következő különbözeti lemezzel lesz csatlakoztatva:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -13355,7 +14300,7 @@ Verzió %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -13884,109 +14829,253 @@ Verzió %1</translation>
         <translation>Válassz egy virtuális floppy lemez fájlt</translation>
     </message>
     <message>
-        <source>All virtual floppy disk files (%1)</source>
-        <translation>Minden virtuális floppy lemez fájl (%1)</translation>
+        <source>All virtual floppy disk files (%1)</source>
+        <translation>Minden virtuális floppy lemez fájl (%1)</translation>
+    </message>
+    <message>
+        <source>VDI (VirtualBox Disk Image)</source>
+        <translation>VDI (VirtualBox lemezkép)</translation>
+    </message>
+    <message>
+        <source>VMDK (Virtual Machine Disk)</source>
+        <translation>VMDK (Virtuális gép lemez)</translation>
+    </message>
+    <message>
+        <source>VHD (Virtual Hard Disk)</source>
+        <translation>VHD (Virtuális merevlemez)</translation>
+    </message>
+    <message>
+        <source>HDD (Parallels Hard Disk)</source>
+        <translation>HDD (Parallels merevlemez)</translation>
+    </message>
+    <message>
+        <source>QED (QEMU enhanced disk)</source>
+        <translation>QED (QEMU enhanced disk)</translation>
+    </message>
+    <message>
+        <source>QCOW (QEMU Copy-On-Write)</source>
+        <translation>QCOW (QEMU Copy-On-Write)</translation>
+    </message>
+    <message>
+        <source>Please choose a location for new virtual hard drive file</source>
+        <translation>Válaszd ki az új virtuális merevlemez fájl helyét</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="obsolete">Engedélyezve</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="obsolete">Letiltva</translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>unrestricted execution</comment>
+        <translation type="obsolete">Engedélyezve</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>unrestricted execution</comment>
+        <translation type="obsolete">Letiltva</translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Alapértelmezett</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>VDI (VirtualBox Disk Image)</source>
-        <translation>VDI (VirtualBox lemezkép)</translation>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>VMDK (Virtual Machine Disk)</source>
-        <translation>VMDK (Virtuális gép lemez)</translation>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>VHD (Virtual Hard Disk)</source>
-        <translation>VHD (Virtuális merevlemez)</translation>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>HDD (Parallels Hard Disk)</source>
-        <translation>HDD (Parallels merevlemez)</translation>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Aktív</translation>
     </message>
     <message>
-        <source>QED (QEMU enhanced disk)</source>
-        <translation>QED (QEMU enhanced disk)</translation>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>QCOW (QEMU Copy-On-Write)</source>
-        <translation>QCOW (QEMU Copy-On-Write)</translation>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Aktív</translation>
     </message>
     <message>
-        <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Válaszd ki az új virtuális merevlemez fájl helyét</translation>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
+        <source>Active</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Engedélyezve</translation>
+        <translation type="unfinished">Aktív</translation>
     </message>
     <message>
-        <source>Disabled</source>
+        <source>Inactive</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Letiltva</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <comment>details report</comment>
-        <translation>Korlátlan végrehajtás</translation>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>PS/2 egér</translation>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB egér</translation>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>PS/2 és USB egér</translation>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>unrestricted execution</comment>
-        <translation type="obsolete">Engedélyezve</translation>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>unrestricted execution</comment>
-        <translation type="obsolete">Letiltva</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <translation>Korlátlan végrehajtás</translation>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB tablet</translation>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB többérintéses tablet</translation>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>NAT hálózat</translation>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>Nat hálózat, '%1'</translation>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Képfájlokat a virtuális média menedzserrel hozhatsz létre vagy adhatsz hozzá.</translation>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -14253,11 +15342,11 @@ to the system default language.</qt>
         <translation type="obsolete">Megmutatja az aktuális alapértelmezett VDI mappát. Ez a mappa az alapértelmezés, ha nem ad meg mappát új virtuális lemez készítésekor/regisztrálásakor.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Az alapértelmezett virtuális gép mappa értékét gyári alapbeállításra állítja vissza. Az új érték a változások elfogadása és az ablak újranyitása után jelenik meg.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Az alapértelmezett VDI mappa értékét gyári alapbeállításra állítja vissza. Az új érték a változások elfogadása és az ablak újranyitása után jelenik meg.</translation>
     </message>
     <message>
@@ -14306,7 +15395,7 @@ to the system default language.</qt>
         <translation type="obsolete">Megnyit egy ablakot a VRDP azonosítási könyvtár kiválasztásához.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">A jogosultság-kezelő könyvtárát visszaállítja az alapértelmezettre. Az alapértelmezett könyvtár a változtatások elfogadása után és ezen ablak újranyitása után fog látszani.</translation>
     </message>
     <message>
@@ -14639,6 +15728,18 @@ to the system default language.</qt>
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Új virtuális merevlemez készítése</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -14731,8 +15832,8 @@ to the system default language.</qt>
         <translation type="obsolete">VirtualBox regisztrálása</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Kérlek, töltsd ki ezt a regisztrációs űrlapot, hogy tudjuk azt, hogy a felhasználóink táborába tartozol, valamint, hogy informálhassunk téged a különböző hírekről, újdonságokról.</p><p>Add meg speciális karakterek nélkül a neved, illetve az e-mail címedet. Az Innotek cég az adataidat kizárólag statisztikai célokra, és a te informálásodra használja, harmadik fél számára ki nem adja. A személyes adatok felhasználásának és kezeléséne [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Kérlek, töltsd ki ezt a regisztrációs űrlapot, hogy tudjuk azt, hogy a felhasználóink táborába tartozol, valamint, hogy informálhassunk téged a különböző hírekről, újdonságokról.</p><p>Add meg speciális karakterek nélkül a neved, illetve az e-mail címedet. Az Innotek cég az adataidat kizárólag statisztikai célokra, és a te informálásodra használja, harmadik fél számára ki nem adja. A személyes adatok felhasználásának és kezeléséne [...]
     </message>
     <message>
         <source>&Name</source>
@@ -14779,8 +15880,8 @@ to the system default language.</qt>
         <translation type="obsolete">A kapcsolódási próbálkozás sikertelen volt.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Kérlek töltsd ki ezt a regisztrációs űrlapot, hogy tudjuk, hogy használod a VirtualBox-ot. Ha akarod, a friss VirtualBox-os hírekről és frissítésekről is értesítünk.</p><p>Add meg a nevedet ékezet nélkül, és az e-mail címedet az alábbi mezőkben. A Sun Microsystems ezeket az adatokat csakis statisztikai célokra és hírlevél küldésére használja. Természetesen a Sun Microsystems vállalja, hogy harmadik fél számára ezeket az adatokat n [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Kérlek töltsd ki ezt a regisztrációs űrlapot, hogy tudjuk, hogy használod a VirtualBox-ot. Ha akarod, a friss VirtualBox-os hírekről és frissítésekről is értesítünk.</p><p>Add meg a nevedet ékezet nélkül, és az e-mail címedet az alábbi mezőkben. A Sun Microsystems ezeket az adatokat csakis statisztikai célokra és hírlevél küldésére használja. Természetesen a Sun Microsystems vállalja, hogy harmadik fél számára ezeket az adatokat n [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -14799,8 +15900,8 @@ to the system default language.</qt>
         <translation type="obsolete">Válassz országot/területet</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Kérlek, töltsd ki ezt a regisztrációs űrlapot, hogy tudjuk azt, hogy a felhasználóink táborába tartozol, valamint, hogy informálhassunk téged a különböző hírekről, újdonságokról.</p><p>Add meg speciális karakterek nélkül a neved, illetve az e-mail címedet. A Sun Microsystems az adataidat kizárólag statisztikai célokra, és a te informálásodra használja, harmadik fél számára ki nem adja. A személyes adatok felhasználásának és kezelé [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Kérlek, töltsd ki ezt a regisztrációs űrlapot, hogy tudjuk azt, hogy a felhasználóink táborába tartozol, valamint, hogy informálhassunk téged a különböző hírekről, újdonságokról.</p><p>Add meg speciális karakterek nélkül a neved, illetve az e-mail címedet. A Sun Microsystems az adataidat kizárólag statisztikai célokra, és a te informálásodra használja, harmadik fél számára ki nem adja. A személyes adatok felhasználásának és kezelé [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -15137,8 +16238,8 @@ to the system default language.</qt>
         <translation type="obsolete">Átmenetileg felfüggeszti a virtuális gép működését</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Üdvözöl a VirtualBox!</h3><p>Az ablak bal oldali részében a virtuális gépeid listáját látod. Ez jelenleg üres, hiszen most indítod ezt a programot először.<img src=:/welcome.png align=right/></p><p>Új virtuális gép létrehozásához kattints az <b>Új</b> gombra az eszköztáron.</p><p>Az <b>%1</b> billentyű megnyomásával azonnali segítséget kérhetsz, vagy látogass el a <a href=h [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Üdvözöl a VirtualBox!</h3><p>Az ablak bal oldali részében a virtuális gépeid listáját látod. Ez jelenleg üres, hiszen most indítod ezt a programot először.<img src=:/welcome.png align=right/></p><p>Új virtuális gép létrehozásához kattints az <b>Új</b> gombra az eszköztáron.</p><p>Az <b>%1</b> billentyű megnyomásával azonnali segítséget kérhetsz, vagy látogass el a <a href=h [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -15890,169 +16991,6 @@ value.</qt></source>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Munkamenet információk</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Részletek</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Futtatókörnyezet</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA átvitelek</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO átvitelek</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Olvasott adat</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Írt adat</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Küldött adat</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Fogadott adat</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Engedélyezve</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Letiltva</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Futtatókörnyezet paraméterei</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Felbontás</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">CD/DVD statisztika</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Hálózati adapter statisztika</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Nincs csatolva</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Verzió: %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Nem található</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Nem található</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Integrációs szolgáltatások</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Vendég OS típusa</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Merevlemez statisztika</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Nincsenek merevlemezek</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Nincsenek hálózati adapterek</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Engedélyezve</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Letiltva</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Memóriavirtualizáció</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation></translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Nem érhető el</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Tároló statisztika</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Nincsenek tárolóeszközök</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Hálózati statisztika</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Memóriavirtualizáció</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Nem érhető el</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Vágólap mód</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Fogd és vidd mód</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>&Konfigurációs részletek</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Futásidő info&rmációk</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -16901,7 +17839,7 @@ Input Output APIC (I/O APIC), amely egy picit visszafogja a virtuális gép telj
         <translation type="obsolete">A gépről készített pillanatképek útvonala. A pillanatképek egy picit sok helyet foglalnak el.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">A pillanatképek mappáját az alapértelmezettre állítja vissza. Az új érték a változások elfogadása és az ablak újranyitása után jelenik meg.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_id.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_id.ts
index b959734..c4f2f88 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_id.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_id.ts
@@ -93,7 +93,7 @@
     </message>
     <message>
         <source>Incompatible Qt Library Error</source>
-        <translation>Kesalahan inkompatibilitas Pustaka Qt</translation>
+        <translation>Kesalahan inkompatibilitas Qt Library</translation>
     </message>
     <message>
         <source>VirtualBox - Error In %1</source>
@@ -105,7 +105,7 @@
     </message>
     <message>
         <source>Please try reinstalling VirtualBox.</source>
-        <translation>Harap pasang ulang VirtualBox.</translation>
+        <translation>Coba instal ulang VirtualBox.</translation>
     </message>
     <message>
         <source>Make sure the kernel module has been loaded successfully.</source>
@@ -129,11 +129,11 @@
     </message>
     <message>
         <source>The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Please try completely uninstalling and reinstalling VirtualBox.</source>
-        <translation>Modul kernel VirtualBox tak cocok dengan versi VirtualBox ini. Instalasi VirtualBox sepertinya tak sukses. Silakan coba membongkar seluruhnya dan memasang ulang VirtualBox.</translation>
+        <translation>Modul kernel VirtualBox tak cocok dengan versi VirtualBox ini. Instalasi VirtualBox sepertinya tak sukses. Silakan coba membongkar seluruhnya dan menginstal ulang VirtualBox.</translation>
     </message>
     <message>
         <source>The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.</source>
-        <translation>Modul kernel VirtualBox tidak cocok dengan versi VirtualBox ini. Instalasi VirtualBox sepertinya tak sukses. Menjalankan <br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>mungkin memperbaiki hal ini. Pastikan bahwa Anda tak mencampur VirtualBox versi OSE dan versi PUEL.</translation>
+        <translation>Modul kernel VirtualBox tak cocok dengan versi VirtualBox ini. Instalasi VirtualBox sepertinya tak sukses. Menjalankan <br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>mungkin memperbaiki hal ini. Pastikan bahwa Anda tak mencampur VirtualBox versi OSE dan versi PUEL.</translation>
     </message>
     <message>
         <source>This error means that the kernel driver was either not able to allocate enough memory or that some mapping operation failed.</source>
@@ -141,7 +141,7 @@
     </message>
     <message>
         <source>The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necess [...]
-        <translation>Driver VirtualBox untuk kernel Linux (vboxdrv) mungkin tidak dimuat atau ada masalah ijin dengan /dev/vboxdrv. Silakan pasang ulang modul kernel dengan menjalankan<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>sebagai root. Bila tersedia untuk distribusi Anda, Anda mesti terlebih dahulu memasang paket DKMS. Paket ini mencatat perubahan kernel Linux dan mengkompail ulang modul kernel vboxdrv bila  [...]
+        <translation>Driver VirtualBox untuk kernel Linux (vboxdrv) mungkin tak dimuat atau ada masalah ijin dengan /dev/vboxdrv. Silakan instal ulang modul kernel dengan menjalankan<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>sebagai root. Bila tersedia untuk distribusi Anda, Anda mesti terlebih dahulu memasang paket DKMS. Paket ini mencatat perubahan kernel Linux dan mengkompail ulang modul kernel vboxdrv bila di [...]
     </message>
 </context>
 <context>
@@ -163,7 +163,7 @@
     </message>
     <message>
         <source>Select a file</source>
-        <translation>Pilih sebuah berkas</translation>
+        <translation>Pilih sebuah file</translation>
     </message>
 </context>
 <context>
@@ -223,7 +223,7 @@
     </message>
     <message>
         <source>Copy all errors to the clipboard</source>
-        <translation>Salin semua kesalahan ke papan klip</translation>
+        <translation>Salin semua error ke clipboard</translation>
     </message>
     <message>
         <source>Copy</source>
@@ -281,7 +281,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Mode Seam&less</translation>
+        <translation type="unfinished">Mode Seam&less</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -293,7 +293,7 @@
     </message>
     <message>
         <source>Automatically resize the guest display when the window is resized (requires Guest Additions)</source>
-        <translation>Ubah ukuran tampilan guest secara otomatis saat jendela diubah ukurannya (membutuhkan Guest Additions)</translation>
+        <translation>Resize tampilan guest secara otomatis saat window diresize (membutuhkan Guest Additions)</translation>
     </message>
     <message>
         <source>&Adjust Window Size</source>
@@ -301,15 +301,15 @@
     </message>
     <message>
         <source>Adjust window size and position to best fit the guest display</source>
-        <translation>Atur ukuran dan posisi windows agar paling pas dengan tampilan guest</translation>
+        <translation>Sesuaikan ukuran dan posisi windows untuk tampilan terbaik pada display guest</translation>
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Nonaktifkan Integrasi &Tetikus</translation>
+        <translation type="obsolete">Matikan Integrasi &Mouse</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Mematikan sementara integrasi penunjuk tetikus pada host</translation>
+        <translation type="obsolete">Mematikan sementara integrasi mouse pointer pada host</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -321,11 +321,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>S&isipkan Ctrl+Alt+Del</translation>
+        <translation type="obsolete">&Insert Ctrl+Alt+Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Kirim urutan Ctrl+Alt+Del ke mesin virtual</translation>
+        <translation type="obsolete">Kirim sekuens Ctrl+Alt+Del pada mesin virtual</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -333,7 +333,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Kirim urutan Ctrl+Alt+Backspace ke mesin virtual</translation>
+        <translation type="obsolete">Kirim sekuens Ctrl+Alt+Backspace pada mesin virtual</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -341,19 +341,19 @@
     </message>
     <message>
         <source>Take a snapshot of the virtual machine</source>
-        <translation>Ambil snapshot mesin virtual</translation>
+        <translation>Ambil Snapshot mesin virtual</translation>
     </message>
     <message>
         <source>Session I&nformation Dialog</source>
         <translation type="obsolete">Dialog I&nformasi Sesi </translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Tampilkan Jendela Informasi Sesi </translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Tampilkan Dialog Informasi Sesi </translation>
     </message>
     <message>
         <source>&Pause</source>
-        <translation>&Istirahat</translation>
+        <translation>&Pause</translation>
     </message>
     <message>
         <source>Suspend the execution of the virtual machine</source>
@@ -377,7 +377,7 @@
     </message>
     <message>
         <source>ACPI Sh&utdown</source>
-        <translation>ACPI Sh&utdown</translation>
+        <translation></translation>
     </message>
     <message>
         <source>ACPI S&hutdown</source>
@@ -385,7 +385,7 @@
     </message>
     <message>
         <source>Send the ACPI Power Button press event to the virtual machine</source>
-        <translation>Kirim kejadian penekanan Tombol Power ACPI ke mesin virtual </translation>
+        <translation>Kirim Tombol Power ACPI event pada mesin virtual </translation>
     </message>
     <message>
         <source>&Close...</source>
@@ -393,31 +393,23 @@
     </message>
     <message>
         <source>Close the virtual machine</source>
-        <translation>Tutup mesin virtual</translation>
+        <translation>Tutup Mesin Virtual</translation>
     </message>
     <message>
         <source>&View</source>
-        <translation>&Tilik</translation>
+        <translation></translation>
     </message>
     <message>
         <source>&Devices</source>
-        <translation>&Perangkat</translation>
-    </message>
-    <message>
-        <source>&CD/DVD Devices</source>
-        <translation>Perangkat &CD/DVD</translation>
-    </message>
-    <message>
-        <source>&Floppy Devices</source>
-        <translation>Device &Floppy</translation>
+        <translation>&Device</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Perangkat &USB</translation>
+        <translation type="obsolete">Device &USB</translation>
     </message>
     <message>
         <source>Change the settings of network adapters</source>
-        <translation>Ubah pengaturan adaptor jaringan</translation>
+        <translation></translation>
     </message>
     <message>
         <source>&Shared Folders...</source>
@@ -425,19 +417,19 @@
     </message>
     <message>
         <source>Create or modify shared folders</source>
-        <translation>Buat atau ubah folder bersama</translation>
+        <translation>Buka dialog untuk beroperasi pada folder yang di share</translation>
     </message>
     <message>
         <source>Enable or disable remote desktop (RDP) connections to this machine</source>
         <translation type="obsolete">Menyalakan atau mematikan koneksi remote desktop (RDP) pada mesin ini</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>Masukkan &image CD Guest Addition...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Install Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Masukkan berkas disk Guest Addition ke dalam drive virtual</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Pasang Guest Additions pada image instalasi</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -451,12 +443,12 @@
     <message>
         <source>&Command Line...</source>
         <comment>debug action</comment>
-        <translation>&Baris Perintah...</translation>
+        <translation>&Command Line...</translation>
     </message>
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>Pencatatan &Log...</translation>
+        <translation type="obsolete">Pencatatan &Log...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -464,15 +456,15 @@
     </message>
     <message>
         <source>Dock Icon</source>
-        <translation>Ikon Dok</translation>
+        <translation></translation>
     </message>
     <message>
         <source>Show Monitor Preview</source>
-        <translation>Tampilkan Pratinjau Monitor</translation>
+        <translation></translation>
     </message>
     <message>
         <source>Show Application Icon</source>
-        <translation>Tampilkan Ikon Aplikasi</translation>
+        <translation></translation>
     </message>
     <message>
         <source>Enable remote desktop (RDP) connections to this machine</source>
@@ -485,15 +477,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Beralih ke &Layar Penuh</translation>
+        <translation type="obsolete">Beralih ke &Fullscreen</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Bertukar antara mode normal dan layar penuh</translation>
+        <translation type="obsolete">Bertukar antara mode normal dan fullscreen</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Beralih ke Mode Seam&less</translation>
+        <translation type="obsolete">Beralih ke Mode Seam&less</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -501,7 +493,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Beralih ke Mode &Skala</translation>
+        <translation type="obsolete">Beralih ke Mode &Skala</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -525,130 +517,126 @@
     </message>
     <message>
         <source>Show the log files of the selected virtual machine</source>
-        <translation>Tampilkan berkas log mesin virtual yang dipilih</translation>
+        <translation type="unfinished">Tampilkan file log pada mesin virtual terpilih</translation>
     </message>
     <message>
         <source>&Contents...</source>
-        <translation>&Isi...</translation>
+        <translation type="unfinished">&Isi...</translation>
     </message>
     <message>
         <source>Show help contents</source>
-        <translation>Tampilkan isi bantuan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Open the browser and go to the VirtualBox product web site</source>
-        <translation>Buka peramban dan pergi ke situs web produk VirtualBox</translation>
+        <translation type="unfinished">Buka browser dan pergi ke website produk VirtualBox</translation>
     </message>
     <message>
         <source>Go back to showing all suppressed warnings and messages</source>
-        <translation>Kembali menampilkan semua peringatan dan pesan yang disembunyikan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Operations Manager...</source>
-        <translation>Ma&najer Operasi Jaringan...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show Network Operations Manager</source>
-        <translation>Tampilkan Manajer Operasi Jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Check for a new VirtualBox version</source>
-        <translation>Periksa keberadaan versi baru VirtualBox</translation>
+        <translation type="unfinished">Periksa keberadaan versi baru VirtualBox</translation>
     </message>
     <message>
         <source>&About VirtualBox...</source>
-        <translation>Tent&ang VirtualBox...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show a window with product information</source>
-        <translation>Tampilkan jendela dengan informasi produk</translation>
+        <translation type="unfinished">Tunjukkan dialog dengan informasi produk</translation>
     </message>
     <message>
         <source>Take Sn&apshot...</source>
-        <translation>&Ambil Snapshot...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Take Screensh&ot...</source>
-        <translation>Ambil Cuplikan &Layar...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Take a screenshot of the virtual machine</source>
-        <translation>Ambil cuplikan layar dari mesin virtual</translation>
-    </message>
-    <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>S&isipkan Ctrl+Alt+Backspace</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
-        <translation>&Berkas</translation>
+        <translation type="unfinished">&File</translation>
     </message>
     <message>
         <source>&File</source>
         <comment>Non Mac OS X version</comment>
-        <translation>&Berkas</translation>
+        <translation type="unfinished">&File</translation>
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
-        <translation>Manajer Media &Virtual...</translation>
+        <translation type="unfinished">Manajer Media &Virtual...</translation>
     </message>
     <message>
         <source>Display the Virtual Media Manager window</source>
-        <translation>Menampilkan jendela Manajer Media Virtual</translation>
+        <translation type="unfinished">Menampilkan dialog Manajer Disk Virtual</translation>
     </message>
     <message>
         <source>&Import Appliance...</source>
-        <translation>&Impor Appliance...</translation>
+        <translation type="unfinished">&Impor Appliance...</translation>
     </message>
     <message>
         <source>Import an appliance into VirtualBox</source>
-        <translation>Mengimpor suatu appliance ke dalam VirtualBox</translation>
+        <translation type="unfinished">Mengimpor suatu appliance ke dalam VirtualBox</translation>
     </message>
     <message>
         <source>&Export Appliance...</source>
-        <translation>&Ekspor Appliance...</translation>
+        <translation type="unfinished">&Ekspor Appliance...</translation>
     </message>
     <message>
         <source>Export one or more VirtualBox virtual machines as an appliance</source>
-        <translation>Mengekspor satu atau lebih mesin virtual VirtualBox sebagai appliance</translation>
+        <translation type="unfinished">Mengekspor satu atau lebih mesin virtual VirtualBox sebagai appliance</translation>
     </message>
     <message>
         <source>&Preferences...</source>
         <comment>global settings</comment>
-        <translation>&Preferensi...</translation>
+        <translation type="unfinished">&Preferensi...</translation>
     </message>
     <message>
         <source>Display the global settings window</source>
-        <translation>Tampilkan jendela pengaturan global</translation>
+        <translation type="unfinished">Buka dialog setting global</translation>
     </message>
     <message>
         <source>E&xit</source>
-        <translation>&Keluar</translation>
+        <translation type="unfinished">&Keluar</translation>
     </message>
     <message>
         <source>Close application</source>
-        <translation>Tutup aplikasi</translation>
+        <translation type="unfinished">Tutup aplikasi</translation>
     </message>
     <message>
         <source>&Group</source>
-        <translation>&Grup</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create a new virtual machine</source>
-        <translation>Ciptakan mesin virtual baru</translation>
+        <translation type="unfinished">Ciptakan Mesin Virtual Baru</translation>
     </message>
     <message>
         <source>Add an existing virtual machine</source>
-        <translation>Tambahkan mesin virtual yang telah ada</translation>
+        <translation type="unfinished">Tambahkan mesin virtual yang telah ada</translation>
     </message>
     <message>
         <source>Rename the selected virtual machine group</source>
-        <translation>Ubah nama grup mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>S&tart</source>
-        <translation>M&ulai</translation>
+        <translation type="unfinished">M&ulai</translation>
     </message>
     <message>
         <source>Start the selected virtual machine</source>
@@ -656,7 +644,7 @@
     </message>
     <message>
         <source>S&how</source>
-        <translation>T&ampilkan</translation>
+        <translation type="unfinished">T&ampilkan</translation>
     </message>
     <message>
         <source>Switch to the window of the selected virtual machine</source>
@@ -664,15 +652,15 @@
     </message>
     <message>
         <source>Re&fresh...</source>
-        <translation>Sega&rkan...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Refresh the accessibility state of the selected virtual machine</source>
-        <translation>Menyegarkan keadaan akesibilitas pada mesin virtual yang dipilih</translation>
+        <translation type="unfinished">Me-refresh keadaan akesibilitas pada mesin virtual terpilih</translation>
     </message>
     <message>
         <source>Show in Finder</source>
-        <translation>Tampilkan di Finder</translation>
+        <translation type="unfinished">Tampilkan di Finder</translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in Finder.</source>
@@ -680,7 +668,7 @@
     </message>
     <message>
         <source>Show in Explorer</source>
-        <translation>Tampilkan di Explorer</translation>
+        <translation type="unfinished">Tampilkan di Explorer</translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in Explorer.</source>
@@ -688,35 +676,35 @@
     </message>
     <message>
         <source>Show in File Manager</source>
-        <translation>Tampilkan di Manajer Berkas</translation>
+        <translation type="unfinished">Tampilkan di Manajer Berkas</translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in the File Manager</source>
-        <translation>Menampilkan berkas Definisi Mesin VirtualBox di dalam Manajer Berkas</translation>
+        <translation type="unfinished">Menampilkan file Definisi Mesin VirtualBox di dalam Manajer Berkas</translation>
     </message>
     <message>
         <source>&New...</source>
-        <translation>&Baru...</translation>
+        <translation type="unfinished">&Baru...</translation>
     </message>
     <message>
         <source>&Add...</source>
-        <translation>T&ambah...</translation>
+        <translation type="unfinished">T&ambah...</translation>
     </message>
     <message>
         <source>Add a new group based on the items selected</source>
-        <translation>Tambahkan grup baru berdasarkan butir-butir yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Cl&one...</source>
-        <translation>K&lon...</translation>
+        <translation type="unfinished">K&lon...</translation>
     </message>
     <message>
         <source>Clone the selected virtual machine</source>
-        <translation>Buat klon dari mesin virtual yang dipilih</translation>
+        <translation type="unfinished">Buat klon dari mesin virtual yang dipilih</translation>
     </message>
     <message>
         <source>&Remove...</source>
-        <translation>&Hapus...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Remove the selected virtual machine</source>
@@ -724,11 +712,11 @@
     </message>
     <message>
         <source>Discard</source>
-        <translation>Buang</translation>
+        <translation type="unfinished">Abaikan</translation>
     </message>
     <message>
         <source>D&iscard saved state...</source>
-        <translation>Buang keadaan yang d&isimpan...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Discard the saved state of the selected virtual machine</source>
@@ -736,7 +724,7 @@
     </message>
     <message>
         <source>Create Alias on Desktop</source>
-        <translation>Buat Alias pada Desktop</translation>
+        <translation type="unfinished">Buat Alias pada Desktop</translation>
     </message>
     <message>
         <source>Creates an Alias file to the VirtualBox Machine Definition file on your Desktop.</source>
@@ -744,7 +732,7 @@
     </message>
     <message>
         <source>Create Shortcut on Desktop</source>
-        <translation>Buat Pintasan pada Desktop</translation>
+        <translation type="unfinished">Buat Shortcut pada Desktop</translation>
     </message>
     <message>
         <source>Creates an Shortcut file to the VirtualBox Machine Definition file on your Desktop.</source>
@@ -752,190 +740,410 @@
     </message>
     <message>
         <source>&Close</source>
-        <translation>&Tutup</translation>
+        <translation type="unfinished">&Tutup</translation>
     </message>
     <message>
         <source>Show &Log...</source>
-        <translation>Tampilkan &Log...</translation>
+        <translation type="unfinished">Tampilkan &Log...</translation>
     </message>
     <message>
         <source>&VirtualBox Web Site...</source>
-        <translation>Situs Web &VirtualBox...</translation>
+        <translation type="unfinished">Website &VirtualBox...</translation>
     </message>
     <message>
         <source>&Reset All Warnings</source>
-        <translation>&Reset Semua Peringatan</translation>
+        <translation type="unfinished">&Reset Semua Peringatan</translation>
     </message>
     <message>
         <source>C&heck for Updates...</source>
-        <translation>&Periksa Pemutakhiran...</translation>
+        <translation type="unfinished">&Periksa Update...</translation>
     </message>
     <message>
         <source>Rena&me Group...</source>
-        <translation>Ubah Na&ma Grup...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Sort the items of the selected virtual machine group alphabetically</source>
-        <translation>Urutkan butir-butir grup mesin virtual yang dipilih secara alfabet</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Remove the selected virtual machines</source>
-        <translation>Hapus mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Start the selected virtual machines</source>
-        <translation>Mulai jalankan mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Switch to the windows of the selected virtual machines</source>
-        <translation>Berpindah ke jendela mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Suspend the execution of the selected virtual machines</source>
-        <translation>Tahan eksekusi mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Reset the selected virtual machines</source>
-        <translation>Reset mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Discard the saved state of the selected virtual machines</source>
-        <translation>Buang keadaan tersimpan pada mesin virtual terpilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in Finder</source>
-        <translation>Tampilkan berkas Definisi Mesin VirtualBox di dalam Finder</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in Explorer</source>
-        <translation>Tampilkan berkas Definisi Mesin VirtualBox di dalam Explorer</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Creates an alias file to the VirtualBox Machine Definition file on your desktop</source>
-        <translation>Membuat berkas alias ke berkas Definisi Mesin VirtualBox pada desktop Anda</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Creates an shortcut file to the VirtualBox Machine Definition file on your desktop</source>
-        <translation>Membuat suatu berkas pintasan ke berkas Definisi Mesin VirtualBox pada desktop Anda</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Save State</source>
-        <translation>Simpan Keadaan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Save the machine state of the selected virtual machines</source>
-        <translation>Simpan keadaan mesin dari mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Send the ACPI Power Button press event to the selected virtual machines</source>
-        <translation>Kirim kejadian penekanan Tombol Power ACPI ke mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Po&wer Off</source>
-        <translation>Matikan &Daya</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the selected virtual machines</source>
-        <translation>Matikan mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&New Machine...</source>
-        <translation>Mesi&n Baru...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Add Machine...</source>
-        <translation>T&ambah Mesin...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Ungroup...</source>
-        <translation>Bongkar Gr&up...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ungroup items of the selected virtual machine group</source>
-        <translation>Bongkar grup dari mesin virtual yang dipilih</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Sort</source>
-        <translation>Urutkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Gro&up</source>
-        <translation>Gr*up</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Sort the group of the first selected machine alphabetically</source>
-        <translation>Urutkan grup dari mesin yang dipilih pertama secara alfabet</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Shared &Clipboard</source>
-        <translation>Papan Klip Ber&sama</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop</source>
-        <translation>Drag'n'Drop</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>Simpan keadaan mesin dari mesin virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>Matikan mesin virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>Pengatura&n Jaringan...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation>Pengaturan Folder Ber&sama...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>Tamp&ilan Jarak Jauh</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>Tangkapan &Video</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation>Pengaturan Tangkapan &Video...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>Tata pengaturan penangkapan video</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Popup Menu</source>
-        <translation>Menu Popup</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Insert Guest Additions CD image...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Pasang Guest Additions pada image instalasi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>&Webcam</translation>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Keyboard</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Jaringan</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Tampilkan &Log...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&File</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Nyalakan</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1025,7 +1233,7 @@
     </message>
     <message>
         <source>Unknown Hardware Item</source>
-        <translation>Item Perangkat Keras Yang Tak Dikenal</translation>
+        <translation>Item Hardware Tak Dikenal</translation>
     </message>
     <message>
         <source>MB</source>
@@ -1578,7 +1786,7 @@
     </message>
     <message>
         <source>The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:</source>
-        <translation>Mesin virtual yang dipilih <i>tidak dapat diakses</i>. Mohon periksa pesan kesalahan yang ditunjukkan di bawah ini dan tekan tombol <b>Segarkan</b> bila Anda ingin mengulang pemeriksaan aksesibilitas:</translation>
+        <translation>Mesin virtual yang dipilih <i>tidak dapat diakses</i>. Mohon periksa pesan kesalahan yang ditunjukkan di bawah ini dan tekan tombol <b>Refresh</b> bila Anda ingin mengulang pemeriksaan aksesibilitas:</translation>
     </message>
     <message>
         <source>General</source>
@@ -1662,17 +1870,17 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
-        <translation>Menjatuhkan data ...</translation>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Menjatuhkan data ...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -1711,11 +1919,11 @@
     </message>
     <message>
         <source>Looking for %1...</source>
-        <translation>Mencari %1...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Downloading %1...</source>
-        <translation>Mengunduh %1...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -1742,29 +1950,54 @@
     </message>
     <message>
         <source>VirtualBox Guest Additions</source>
-        <translation>Guest Additions VirtualBox</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIDownloaderExtensionPack</name>
     <message>
         <source>Select folder to save %1 to</source>
-        <translation>Pilih folder tempat menyimpan %1</translation>
+        <translation>Pilih folder untuk menyimpan %1</translation>
     </message>
     <message>
         <source>VirtualBox Extension Pack</source>
-        <translation>Extension Pack VirtualBox</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIDownloaderUserManual</name>
     <message>
         <source>Select folder to save User Manual to</source>
-        <translation>Pilih folder tempat menyimpan Manual Pengguna</translation>
+        <translation>Pilih folder untuk menyimpan Manual Pengguna</translation>
     </message>
     <message>
         <source>VirtualBox User Manual</source>
-        <translation>Manual Pengguna VirtualBox</translation>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
     </message>
 </context>
 <context>
@@ -2101,66 +2334,66 @@
     <message>
         <source><b>%1</b></source>
         <comment>Group item tool-tip / Group name</comment>
-        <translation><b>%1</b></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source>%n group(s)</source>
         <comment>Group item tool-tip / Group info</comment>
-        <translation>
-            <numerusform>%n grup</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Group info wrapper</comment>
-        <translation><nobr>%1</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr></translation>
     </message>
     <message numerus="yes">
         <source>%n machine(s)</source>
         <comment>Group item tool-tip / Machine info</comment>
-        <translation>
-            <numerusform>%n mesin</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
         </translation>
     </message>
     <message numerus="yes">
         <source>(%n running)</source>
         <comment>Group item tool-tip / Running machine info</comment>
-        <translation>
-            <numerusform>(%n berjalan)</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper</comment>
-        <translation><nobr>%1</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr></translation>
     </message>
     <message>
         <source><nobr>%1 %2</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper, including running</comment>
-        <translation><nobr>%1 %2</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr> {1 %2<?}</translation>
     </message>
     <message>
         <source>Collapse group</source>
-        <translation>Runtuhkan grup</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Expand group</source>
-        <translation>Kembangkan grup</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter group</source>
-        <translation>Masuk grup</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Exit group</source>
-        <translation>Keluar grup</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIGChooserModel</name>
     <message>
         <source>New group</source>
-        <translation>Grup baru</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2168,67 +2401,62 @@
     <message>
         <source>Name</source>
         <comment>details (general)</comment>
-        <translation>Nama</translation>
+        <translation type="unfinished">Nama</translation>
     </message>
     <message>
         <source>Groups</source>
         <comment>details (general)</comment>
-        <translation>Grup</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 MB</source>
         <comment>details</comment>
-        <translation>%1 MB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Processors</source>
         <comment>details (system)</comment>
-        <translation>Prosesor</translation>
+        <translation type="unfinished">Prosesor</translation>
     </message>
     <message>
         <source>%1%</source>
         <comment>details</comment>
-        <translation>%1%</translation>
+        <translation type="unfinished">%1%</translation>
     </message>
     <message>
         <source>VT-x/AMD-V</source>
         <comment>details (system)</comment>
-        <translation>VT-x/AMD-V</translation>
+        <translation type="unfinished">VT-x/AMD-V</translation>
     </message>
     <message>
         <source>PAE/NX</source>
         <comment>details (system)</comment>
-        <translation>PAE/NX</translation>
+        <translation type="unfinished">PAE/NX</translation>
     </message>
     <message>
         <source>Acceleration</source>
         <comment>details (system)</comment>
-        <translation>Akselerasi</translation>
+        <translation type="unfinished">Akselerasi</translation>
     </message>
     <message>
         <source>Screens</source>
         <comment>details (display)</comment>
-        <translation>Layar</translation>
+        <translation type="unfinished">Layar</translation>
     </message>
     <message>
         <source>3D</source>
         <comment>details (display)</comment>
-        <translation>3D</translation>
+        <translation type="unfinished">3D</translation>
     </message>
     <message>
         <source>Acceleration</source>
         <comment>details (display)</comment>
-        <translation>Akselerasi</translation>
+        <translation type="unfinished">Akselerasi</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/vrde/VRDE server)</comment>
-        <translation>Dinonaktifkan</translation>
-    </message>
-    <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2238,12 +2466,12 @@
     <message>
         <source>Controller</source>
         <comment>details (audio)</comment>
-        <translation>Pengendali</translation>
+        <translation type="unfinished">Pengendali</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (audio)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Bridged adapter, %1</source>
@@ -2273,181 +2501,276 @@
     <message>
         <source>Adapter %1</source>
         <comment>details (network)</comment>
-        <translation>Adaptor %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (network/adapter)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Port %1</source>
         <comment>details (serial)</comment>
-        <translation>Port %1</translation>
+        <translation type="unfinished">Port %1</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (serial)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Port %1</source>
         <comment>details (parallel)</comment>
-        <translation>Port %1</translation>
+        <translation type="unfinished">Port %1</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (parallel)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (%2 active)</source>
         <comment>details (usb)</comment>
-        <translation>%1 (%2 aktif)</translation>
+        <translation type="unfinished">%1 (%2 aktif)</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (usb)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
         <comment>details (shared folders)</comment>
-        <translation>Tidak Ada</translation>
+        <translation type="unfinished">Tidak Ada</translation>
     </message>
     <message>
         <source>None</source>
         <comment>details (description)</comment>
-        <translation>Tidak Ada</translation>
+        <translation type="unfinished">Tidak Ada</translation>
     </message>
     <message>
         <source>Operating System</source>
         <comment>details (general)</comment>
-        <translation>Sistem Operasi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Information Inaccessible</source>
         <comment>details</comment>
-        <translation>Informasi Tidak Bisa Diakses</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Base Memory</source>
         <comment>details (system)</comment>
-        <translation>Memori Dasar</translation>
+        <translation type="unfinished">Memori Dasar</translation>
     </message>
     <message>
         <source>Execution Cap</source>
         <comment>details (system)</comment>
-        <translation>Batas Eksekusi</translation>
+        <translation type="unfinished">Cap Eksekusi</translation>
     </message>
     <message>
         <source>Boot Order</source>
         <comment>details (system)</comment>
-        <translation>Urutan Boot</translation>
+        <translation type="unfinished">Urutan Boot</translation>
     </message>
     <message>
         <source>Nested Paging</source>
         <comment>details (system)</comment>
-        <translation>Paging Bertingkat</translation>
+        <translation type="unfinished">Paging Bertingkat</translation>
     </message>
     <message>
         <source>Video Memory</source>
         <comment>details (display)</comment>
-        <translation>Memori Video</translation>
+        <translation type="unfinished">Memori Video</translation>
     </message>
     <message>
         <source>2D Video</source>
         <comment>details (display)</comment>
-        <translation>Video 2D</translation>
+        <translation type="unfinished">Video 2D</translation>
     </message>
     <message>
         <source>Remote Desktop Server Port</source>
         <comment>details (display/vrde)</comment>
-        <translation>Port Server Remote Desktop</translation>
+        <translation type="unfinished">Port Server Remote Desktop</translation>
     </message>
     <message>
         <source>Remote Desktop Server</source>
         <comment>details (display/vrde)</comment>
-        <translation>Server Remote Desktop</translation>
+        <translation type="unfinished">Server Remote Desktop</translation>
     </message>
     <message>
         <source>Not Attached</source>
         <comment>details (storage)</comment>
-        <translation></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host Driver</source>
         <comment>details (audio)</comment>
-        <translation>Driver Host</translation>
+        <translation type="unfinished">Driver Host</translation>
     </message>
     <message>
         <source>Bridged Adapter, %1</source>
         <comment>details (network)</comment>
-        <translation>Adaptor Ter-bridge, %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Internal Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Jaringan Internal, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host-only Adapter, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Adaptor Hanya-host, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Generic Driver, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Driver Generik, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Generic Driver, '%1' {&nbsp;%2&nbsp;}</source>
         <comment>details (network)</comment>
-        <translation>Driver Generik, '%1' {&nbsp;%2&nbsp;}</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Device Filters</source>
         <comment>details (usb)</comment>
-        <translation>Penyaring Perangkat</translation>
+        <translation type="unfinished">Filter Device</translation>
     </message>
     <message>
         <source>USB Controller Inaccessible</source>
         <comment>details (usb)</comment>
-        <translation>Pengendali USB Tidak Bisa Diakses</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Shared Folders</source>
         <comment>details (shared folders)</comment>
-        <translation>Folder Bersama</translation>
+        <translation type="unfinished">Folder yang di Share</translation>
     </message>
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation>Berkas Tangkapan Video</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation>Atribut Tangkapan Video</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation>Tangkapan Video</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Jaringan NAT, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>Ukuran Frame: %1x%2, Laju Frame: %3fps, Laju Bit: %4kbps</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Pengendali USB</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2636,23 +2959,23 @@
     </message>
     <message>
         <source>Every 0.5 s</source>
-        <translation>Setiap 0,5 d</translation>
+        <translation type="unfinished">Setiap 0,5 d</translation>
     </message>
     <message>
         <source>Every 1 s</source>
-        <translation>Setiap 1 d</translation>
+        <translation type="unfinished">Setiap 1 d</translation>
     </message>
     <message>
         <source>Every 2 s</source>
-        <translation>Setiap 2 d</translation>
+        <translation type="unfinished">Setiap 2 d</translation>
     </message>
     <message>
         <source>Every 5 s</source>
-        <translation>Setiap 5 d</translation>
+        <translation type="unfinished">Setiap 5 d</translation>
     </message>
     <message>
         <source>Every 10 s</source>
-        <translation>Setiap 10 d</translation>
+        <translation type="unfinished">Setiap 10 d</translation>
     </message>
     <message>
         <source>No Preview</source>
@@ -2660,61 +2983,61 @@
     </message>
     <message>
         <source>Update disabled</source>
-        <translation>Pemutakhiran dinonaktifkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No preview</source>
-        <translation>Tidak ada pratinjau</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsDisplay</name>
     <message>
         <source>Maximum Guest Screen &Size:</source>
-        <translation>Ukuran Layar Guest Mak&simum:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Width:</source>
-        <translation>&Lebar:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Specifies the maximum width which we would like the guest to use.</source>
-        <translation>Menyatakan lebar maksimum yang kita inginkan untuk dipakai oleh guest.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Height:</source>
-        <translation>&Tinggi:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Specifies the maximum height which we would like the guest to use.</source>
-        <translation>Menyatakan tinggi maksimum yang kita inginkan untuk dipakai oleh guest.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Automatic</source>
         <comment>Maximum Guest Screen Size</comment>
-        <translation>Otomatis</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Suggest a reasonable maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
-        <translation>Menyarankan ukuran layar maksimum yang layak ke guest. Guest hanya akan melihat saran ini ketika guest addition dipasang.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
         <comment>Maximum Guest Screen Size</comment>
-        <translation>Tidak Ada</translation>
+        <translation type="unfinished">Tidak Ada</translation>
     </message>
     <message>
         <source>Do not attempt to limit the size of the guest screen.</source>
-        <translation>Jangan mencoba membatasi ukuran layar guest.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hint</source>
         <comment>Maximum Guest Screen Size</comment>
-        <translation>Arahan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Suggest a maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
-        <translation>Menyarankan ukuran layar maksimum ke guest. Guest hanya akan melihat saran ini ketika guest addition dipasang.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Machine Windows:</source>
@@ -2737,7 +3060,7 @@
     </message>
     <message>
         <source>Lists all installed packages.</source>
-        <translation>Tampilkan semua paket terpasang.</translation>
+        <translation>Tampilkan semua paket terinstall.</translation>
     </message>
     <message>
         <source>Active</source>
@@ -2761,11 +3084,11 @@
     </message>
     <message>
         <source>Select an extension package file</source>
-        <translation>Pilih sebuah berkas paket ekstensi</translation>
+        <translation>Pilih sebuah file paket ekstensi</translation>
     </message>
     <message>
         <source>Extension package files (%1)</source>
-        <translation>Berkas paket ekstensi (%1)</translation>
+        <translation>File paket ekstensi (%1)</translation>
     </message>
     <message>
         <source>Extensions</source>
@@ -2773,7 +3096,7 @@
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation>Paket &Ekstensi</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2784,19 +3107,19 @@
     </message>
     <message>
         <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
-        <translation>Menyimpan path ke folder baku mesin virtual. Folder ini digunakan, bila nilai lain tidak dinyatakan secara eksplisit, saat menciptakan mesin virtual baru.</translation>
+        <translation>Tampilkan path ke folder default mesin virtual. Folder ini digunakan, bila nilai lain tidak dinyatakan secara eksplisit, saat menciptakan mesin virtual baru.</translation>
     </message>
     <message>
         <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
-        <translation type="unfinished">Menyimpan path ke pustaka yang menyediakan otentikasi untuk klien Tampilan Jarak Jauh (VRDP).</translation>
+        <translation>Tampilkan path ke library yang menyediakan otentikasi untuk klien Remote Display (VRDP).</translation>
     </message>
     <message>
         <source>Default &Machine Folder:</source>
-        <translation>Folder Baku &Mesin:</translation>
+        <translation>Folder Default &Mesin:</translation>
     </message>
     <message>
         <source>V&RDP Authentication Library:</source>
-        <translation>Pustaka Otentikasi V&RDP:</translation>
+        <translation>Library Otentikasi V&RDP:</translation>
     </message>
     <message>
         <source>When checked, the application will provide an icon with the context menu in the system tray.</source>
@@ -2819,28 +3142,16 @@
         <translation type="obsolete">Matikan &ScreenSaver Host</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>&Dok dan Bilah Menu:</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>Tampilkan Otomatis dalam Layar Penuh</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Saat ditandai, dok host dan bilah menu akan ditampilkan ketika sebuah mesin virtual sedang dalam mode layar penuh.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>&ScreenSaver Host:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>Saat ditandai, screensaver host akan dinonaktifkan ketika sebuah mesin virtual sedang berjalan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>Nonaktifkan Ketika Menjalankan Mesin Virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2855,11 +3166,11 @@
     </message>
     <message>
         <source>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</source>
-        <translation>Saat tertandai, papan tik secara otomatis ditangkap setiap kali jendela VM diaktifkan. Saat papan tik ditangkap, semua ketukan tombol (termasuk untuk sistem seperti Alt+Tab) diarahkan ke VM.</translation>
+        <translation>Saat tertandai, keyboard secara otomatis tertangkap setiap kali window VM diaktifkan. Saat keyboard ditangkap, semua tekanan tombol (termasuk untuk sistem seperti Alt+Tab) diarahkan ke VM.</translation>
     </message>
     <message>
         <source>&Auto Capture Keyboard</source>
-        <translation>Otom&atis Tangkap Papan Tik</translation>
+        <translation>Otom&atis Tangkap Keyboard</translation>
     </message>
     <message>
         <source>Reset host combination</source>
@@ -2871,27 +3182,27 @@
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>Kombinasi Tombol Host</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>Beberapa butir memiliki pengaturan pintasan yang sama.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation>Manajer &VirtualBox</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>&Mesin Virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Menampilkan daftar semua pintasan yang tersedia, yang dapat ditata.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Masukkan suatu urutan untuk menyaring daftar pintasan.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2899,7 +3210,7 @@
     <message>
         <source> (built-in)</source>
         <comment>Language</comment>
-        <translation> (bawaan)</translation>
+        <translation> (built-in)</translation>
     </message>
     <message>
         <source><unavailable></source>
@@ -2914,7 +3225,7 @@
     <message>
         <source>Default</source>
         <comment>Language</comment>
-        <translation>Baku</translation>
+        <translation>Default</translation>
     </message>
     <message>
         <source>Language:</source>
@@ -2926,7 +3237,7 @@
     </message>
     <message>
         <source>Lists all available user interface languages. The effective language is written in <b>bold</b>. Select <i>Default</i> to reset to the system default language.</source>
-        <translation>Menampilkan daftar semua bahasa antarmuka yang tersedia. Bahasa yang efektif dicetak <b>tebal</b>. Pilih <i>Baku</i> untuk mengembalikan ke bahasa baku sistem.</translation>
+        <translation>Menampilkan daftar semua bahasa antarmuka yang tersedia. Bahasa yang efektif dicetak <b>tebal</b>. Pilih <i>Default</i> untuk me-reset ke bahasa default sistem.</translation>
     </message>
     <message>
         <source>Name</source>
@@ -2942,15 +3253,15 @@
     </message>
     <message>
         <source>Author</source>
-        <translation>Penulis</translation>
+        <translation>Pencipta</translation>
     </message>
     <message>
         <source>Author(s):</source>
-        <translation>Penulis:</translation>
+        <translation>Pencipta:</translation>
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>Bahasa &Antar Muka</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3035,12 +3346,12 @@
     <message>
         <source>Enabled</source>
         <comment>server</comment>
-        <translation>Difungsikan</translation>
+        <translation>Diaktifkan</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>server</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Dimatikan</translation>
     </message>
     <message>
         <source>Address</source>
@@ -3073,7 +3384,7 @@
     </message>
     <message>
         <source>&Edit host-only network</source>
-        <translation>&Sunting jaringan hanya-host</translation>
+        <translation>&Edit jaringan hanya-host</translation>
     </message>
     <message>
         <source>&Host-only Networks:</source>
@@ -3089,132 +3400,132 @@
     </message>
     <message>
         <source>Networking</source>
-        <translation>Jejaring</translation>
+        <translation>Jaringan</translation>
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation>Jaringan &NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation>Tampilkan semua jaringan NAT yang tersedia.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translation>Jaringan &Hanya-host</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Tidak ada nama baru yang dinyatakan bagi jaringan NAT yang sebelumnya bernama <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation>Tidak ada CIDR yang dinyatakan bagi jaringan NAT <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Tidak ada CIDR yang dinyatakan bagi jaringan NAT yang sebelumnya bernama <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation>CIDR yang tidak valid (<i>%1</i>) dinyatakan bagi jaringan NAT <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation>CIDR yang tidak valid (<i>%1</i>) dinyatakan bagi jaringan NAT yang sebelumnya bernama <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translation>Nama Jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation>[kosong]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (ganti nama dari %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation>Nama Jaringan Lama</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation>Nama Jaringan Baru</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation>CIDR Jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation>Mendukung DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>yes</source>
-        <translation>ya</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>no</source>
-        <translation>tidak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation>Mendukung IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation>Rute IPv6 baku</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation>Antar muka host <b>%1</b> saat ini tidak memiliki alamat IPv4 yang valid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation>Antar muka host <b>%1</b> saat ini tidak memiliki mask jaringan IPv4 yang valid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation>Antar muka host <b>%1</b> saat ini tidak memiliki alamat IPv6 yang valid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation>Antar muka host <b>%1</b> saat ini tidak memiliki alamat server DHCP yang valid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>Antar muka host <b>%1</b> saat ini tidak memiliki mask server DHCP yang valid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>Antar muka host <b>%1</b> saat ini tidak memiliki batas bawah alamat server DHCP yang valid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>Antar muka host <b>%1</b> saat ini tidak memiliki batas atas alamat server DHCP yang valid.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>Nama <b>%1</b> sedang dipakai oleh beberapa jaringan NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>Aktif</translation>
+        <translation type="unfinished">Aktif</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>T&ambah jaringan NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation>&Hapus jaringan NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation>&Sunting jaringan NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3316,188 +3627,188 @@
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation>Rincian Jaringan Hanya-host</translation>
+        <translation type="unfinished">Rincian Jaringan Hanya-host</translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation>&Adaptor</translation>
+        <translation type="unfinished">&Adaptor</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation>&Konfigurasi Manual</translation>
+        <translation type="unfinished">&Konfigurasi Manual</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>Gunakan konfigurasi manual bagi adaptor jaringan hanya-host ini.</translation>
+        <translation type="unfinished">Gunakan konfigurasi manual bagi adaptor jaringan hanya-host ini.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation>Alamat &IPv4:</translation>
+        <translation type="unfinished">Alamat &IPv4:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>Menyimpan alamat IPv4 host bagi adaptor ini.</translation>
+        <translation type="unfinished">Tampilkan alamat IPv4 host bagi adaptor ini.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation>&Mask Jaringan IPv4:</translation>
+        <translation type="unfinished">&Mask Jaringan IPv4:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>Tampilkan mask jaringan IPv4 host bagi adaptor ini.</translation>
+        <translation type="unfinished">Tampilkan mask jaringan IPv4 host bagi adaptor ini.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation>Alamat I&Pv6:</translation>
+        <translation type="unfinished">Alamat I&Pv6:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>Menyimpan alamat IPv6 host bagi adaptor ini bila IPv6 didukung.</translation>
+        <translation type="unfinished">Tampilkan alamat IPv6 host bagi adaptor ini bila IPv6 didukung.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation>&Panjang Mask Jaringan IPv6:</translation>
+        <translation type="unfinished">&Panjang Mask Jaringan IPv6:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>Menyimpan panjang prefiks mask jaringan IPv6 host bagi adaptor ini bila IPv6 didukung.</translation>
+        <translation type="unfinished">Tampilkan panjang prefiks mask jaringan IPv6 host bagi adaptor ini bila IPv6 didukung.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation>Server &DHCP</translation>
+        <translation type="unfinished">Server &DHCP</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>Fungsikan S&erver</translation>
+        <translation type="unfinished">Aktifkan S&erver</translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation>Menandakan apakah Server DHCP diaktifkan saat startup mesin atau tidak.</translation>
+        <translation type="unfinished">Menandakan apakah Server DHCP diaktifkan saat startup mesin atau tidak.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation>Alamat Se&rver:</translation>
+        <translation type="unfinished">Alamat Se&rver:</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Menyimpan alamat server DHCP yang melayani jaringan yang diasosiasikan dengan adaptor hanya-host ini.</translation>
+        <translation type="unfinished">Tampilkan alamat server DHCP yang melayani jaringan yang diasosiasikan dengan adaptor hanya-host ini.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation>&Mask Server:</translation>
+        <translation type="unfinished">&Mask Server:</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Menyimpan mask jaringan dari server DHCP yang melayani jaringan yang diasosiasikan dengan adaptor hanya-host ini.</translation>
+        <translation type="unfinished">Tampilkan mask jaringan dari server DHCP yang melayani jaringan yang diasosiasikan dengan adaptor hanya-host ini.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation>Batas Bawah A&lamat:</translation>
+        <translation type="unfinished">Batas Bawah A&lamat:</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Menyimpan batas bawah alamat yang ditawarkan oleh server DHCP yang melayani jaringan yang diasosiasikan dengan adaptor hanya-host ini.</translation>
+        <translation type="unfinished">Tampilkan batas bawah alamat yang ditawarkan oleh server DHCP yang melayani jaringan yang diasosiasikan dengan adaptor hanya-host ini.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation>Batas &Atas Alamat:</translation>
+        <translation type="unfinished">Batas &Atas Alamat:</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Menyimpan batas atas alamat yang ditawarkan oleh server DHCP yang melayani jaringan yang diasosiasikan dengan adaptor hanya-host ini.</translation>
+        <translation type="unfinished">Tampilkan batas atas alamat yang ditawarkan oleh server DHCP yang melayani jaringan yang diasosiasikan dengan adaptor hanya-host ini.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation>Rincian Jaringan NAT</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation>&Fungsikan Jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation>Fungsikan jaringan NAT ini.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation>&Nama Jaringan:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>Menyimpan nama bagi jaringan ini.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation>&CIDR Jaringan:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>Menyimpan CIDR bagi jaringan ini.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation>Opsi Jaringan:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation>Mendukung &DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation>Menentukan apakan jaringan ini mendukung DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation>Mendukung &IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>Menentukan apakah jaringan ini mendukung IPv6.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>Umumkan &Rute IPv6 Baku</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation>Menentukan apakah jaringan ini mesti diumumkan sebagai rute baku IPv6.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Membuka jendela untuk mengelola aturan penerusan port.</translation>
+        <translation type="unfinished">Buka dialog untuk mengelola aturan penerusan port.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation>Penerusan &Port</translation>
+        <translation type="unfinished">Penerusan &Port</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>Aturan Penerusan Port</translation>
+        <translation type="unfinished">Aturan Penerusan Port</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation>IPv4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation>IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsProxy</name>
     <message>
         <source>When checked, VirtualBox will use the proxy settings supplied for tasks like downloading Guest Additions from the network or checking for updates.</source>
-        <translation>Bila ditandai, VirtualBox akan memakai pengaturan proksi yang diberikan untuk tugas seperti menunduh Guest Addition dari jaringan atau memeriksa pemutakhiran.</translation>
+        <translation>Bila ditandai, VirtualBox akan memakai pengaturan proksi yang diberikan untuk tugas seperti men-download Guest Addition dari jaringan atau memeriksa update.</translation>
     </message>
     <message>
         <source>&Enable Proxy</source>
-        <translation>&Fungsikan Proksi</translation>
+        <translation>&Nyalakan proksi</translation>
     </message>
     <message>
         <source>Ho&st:</source>
@@ -3541,11 +3852,11 @@
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>Host proksi saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>Port proksi saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3556,7 +3867,7 @@
     </message>
     <message>
         <source>&Check for Updates</source>
-        <translation>&Periksa Pemutakhiran</translation>
+        <translation>&Periksa update</translation>
     </message>
     <message>
         <source>&Once per:</source>
@@ -3564,7 +3875,7 @@
     </message>
     <message>
         <source>Specifies how often the new version check should be performed. Note that if you want to completely disable this check, just clear the above check box.</source>
-        <translation>Menyatakan seberapa sering pemeriksaan versi baru mesti dilakukan. Perhatikan bahwa bila Anda ingin mematikan pemeriksaan ini sepenuhnya, kosongkan saja kotak contreng di atas.</translation>
+        <translation>Nyatakan seberapa sering pemeriksaan versi baru mesti dilakukan. Perhatikan bahwa bila Anda ingin mematikan pemeriksaan ini sepenuhnya, kosongkan saja kotak contreng di atas.</translation>
     </message>
     <message>
         <source>Next Check:</source>
@@ -3576,11 +3887,11 @@
     </message>
     <message>
         <source><p>Choose this if you only wish to be notified about stable updates to VirtualBox.</p></source>
-        <translation><p>Pilih ini bila Anda hanya menghendaki untuk diberitahu tentang pemutakhiran stabil atas VirtualBox.</p></translation>
+        <translation><p>Pilih ini bila Anda hanya menghendaki untuk diberitahu tentang update stabil atas VirtualBox.</p></translation>
     </message>
     <message>
         <source>&Stable Release Versions</source>
-        <translation>Versi Rilis &Stabil</translation>
+        <translation>Versi rilis &stabil</translation>
     </message>
     <message>
         <source><p>Choose this if you wish to be notified about all new VirtualBox releases.</p></source>
@@ -3588,7 +3899,7 @@
     </message>
     <message>
         <source>&All New Releases</source>
-        <translation>Semu&a Rilis Baru</translation>
+        <translation>Semu&a rilis baru</translation>
     </message>
     <message>
         <source><p>Choose this to be notified about all new VirtualBox releases and pre-release versions of VirtualBox.</p></source>
@@ -3596,7 +3907,7 @@
     </message>
     <message>
         <source>All New Releases and &Pre-Releases</source>
-        <translation>Semua Rilis Baru dan &Prarilis</translation>
+        <translation>Semua rilis baru dan &prarilis</translation>
     </message>
 </context>
 <context>
@@ -3610,71 +3921,71 @@
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation><key_%1></translation>
+        <translation type="unfinished"><key_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation>Kiri </translation>
+        <translation type="unfinished">Kiri </translation>
     </message>
     <message>
         <source>Right </source>
-        <translation>Kanan </translation>
+        <translation type="unfinished">Kanan </translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation>Shift Kiri</translation>
+        <translation type="unfinished">Shift Kiri</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation>Shift Kanan</translation>
+        <translation type="unfinished">Shift Kanan</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation>Ctrl Kiri</translation>
+        <translation type="unfinished">Ctrl Kiri</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation>Ctrl Kanan</translation>
+        <translation type="unfinished">Ctrl Kanan</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation>Alt Kiri</translation>
+        <translation type="unfinished">Alt Kiri</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation>Alt Kanan</translation>
+        <translation type="unfinished">Alt Kanan</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation>Tombol Windows Kiri</translation>
+        <translation type="unfinished">Tombol Windows Kiri</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation>Tombol Windows Kanan</translation>
+        <translation type="unfinished">Tombol Windows Kanan</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation>Tombol Menu</translation>
+        <translation type="unfinished">Tombol Menu</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation>Alt Gr</translation>
+        <translation type="unfinished">Alt Gr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>Caps Lock</translation>
+        <translation type="unfinished">Caps Lock</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation>Scroll Lock</translation>
+        <translation type="unfinished">Scroll Lock</translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation>Host+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
-        <translation>Tidak Ada</translation>
+        <translation type="unfinished">Tidak Ada</translation>
     </message>
 </context>
 <context>
@@ -3861,22 +4172,22 @@
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation>Reset pintasan ke baku</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation>Nirtata pintasan</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation>Nama</translation>
+        <translation type="unfinished">Nama</translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translation>Pintasan</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3932,11 +4243,11 @@
     <name>UIImportLicenseViewer</name>
     <message>
         <source><b>The virtual system "%1" requires that you agree to the terms and conditions of the software license agreement shown below.</b><br /><br />Click <b>Agree</b> to continue or click <b>Disagree</b> to cancel the import.</source>
-        <translation><b>Sistem virtual "%1" menuntut Anda setuju dengan syarat dan ketentuan dari perjanjian lisensi perangkat lunak yang ditunjukkan di bawah.</b><br /><br />Klik <b>Setuju</b> untuk melanjutkan atau klik <b>Tidak Setuju</b> untuk membatalkan impor.</translation>
+        <translation><b>Sistem virtual "%1" menuntut Anda setuju dengan syarat dan ketentuan dari persetujuan lisensi software yang ditunjukkan di bawah.</b><br /><br />Klik <b>Setuju</b> untuk melanjutkan atau klik <b>Tidak Setuju</b> untuk membatalkan impor.</translation>
     </message>
     <message>
         <source>Software License Agreement</source>
-        <translation>Perjanjian Lisensi Perangkat Lunak</translation>
+        <translation>Persetujuan Lisensi Software</translation>
     </message>
     <message>
         <source>&Disagree</source>
@@ -3960,7 +4271,7 @@
     </message>
     <message>
         <source>Save license to file...</source>
-        <translation>Simpan lisensi ke berkas...</translation>
+        <translation>Simpan lisensi ke file...</translation>
     </message>
 </context>
 <context>
@@ -3968,27 +4279,27 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the virtual hard disks:</nobr>%1</p></source>
         <comment>HDD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktivitas media hard disk virtual:</nobr>%1</p></translation>
+        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktifitas media hard disk virtual:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktivitas perangkat CD/DVD:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Mengindikasikan aktifitas media CD/DVD:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktivitas perangkat floppy:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Mengindikasikan aktifitas media floppy:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktivitas antarmuka jaringan:</nobr>%1</p></translation>
+        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktifitas antarmuka jaringan:</nobr>%1</p></translation>
     </message>
     <message>
         <source><br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr></source>
         <comment>Network adapters tooltip</comment>
-        <translation><br><nobr><b>Adaptor %1 (%2)</b>: %3 kabel %4</nobr></translation>
+        <translation><br><nobr><b>Adapter %1 (%2)</b>: %3 kabel %4</nobr></translation>
     </message>
     <message>
         <source>connected</source>
@@ -4003,32 +4314,32 @@
     <message>
         <source><br><nobr><b>All network adapters are disabled</b></nobr></source>
         <comment>Network adapters tooltip</comment>
-        <translation><br><nobr><b>Semua adaptor jaringan dinonaktifkan</b></nobr></translation>
+        <translation><br><nobr><b>Semua adapter jaringan dimatikan</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the attached USB devices:</nobr>%1</p></source>
         <comment>USB device tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktivitas perangkat USB yang terpasang:</nobr>%1</p></translation>
+        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktifitas device USB terpasang:</nobr>%1</p></translation>
     </message>
     <message>
         <source><br><nobr><b>No USB devices attached</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Tidak ada perangkat USB yang terpasang</b></nobr></translation>
+        <translation><br><nobr><b>Tidak ada device USB terpasang</b></nobr></translation>
     </message>
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Pengendali USB dinonaktifkan</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Kontroler USB dimatikan</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
         <comment>Shared folders tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktivitas folder bersama:</nobr>%1</p></translation>
+        <translation><p style='white-space:pre'><nobr>Mengindikasikan aktifitas folder yang dishare:</nobr>%1</p></translation>
     </message>
     <message>
         <source><br><nobr><b>No shared folders</b></nobr></source>
         <comment>Shared folders tooltip</comment>
-        <translation><br><nobr><b>Tidak ada folder dipakai bersama</b></nobr></translation>
+        <translation><br><nobr><b>Tidak ada folder yang dishare</b></nobr></translation>
     </message>
     <message>
         <source><hr>The VRDP Server is listening on port %1</source>
@@ -4037,15 +4348,15 @@
     <message>
         <source><br><nobr><b>%1:</b>&nbsp;%2</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation><br><nobr><b>%1:</b>&nbsp;%2</nobr></translation>
+        <translation></translation>
     </message>
     <message>
         <source>Indicates whether the host mouse pointer is captured by the guest OS:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer is captured</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;mouse integration (MI) is On</nobr><br><nobr><img src=:/mouse_can_seamless_ [...]
-        <translation>Mengindikasikan apakah penunjuk tetikus host ditangkap oleh sistem operasi guest:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer tidak ditangkap</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer ditangkap</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;integrasi tetikus (MI) Menyala</nobr><br><nobr><img src=:/mo [...]
+        <translation>Mengindikasikan apakah mouse pointer host tertangkap oleh sistem operasi guest:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer tidak tertangkap</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer tertangkap</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;integrasi mouse (MI) Menyala</nobr><br><nobr><img src=:/mous [...]
     </message>
     <message>
         <source>Indicates whether the keyboard is captured by the guest OS (<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>).</source>
-        <translation>Mengindikasikan apakah papan tik ditangkap oleh Sistem Operasi guest (<img src=:/hostkey_captured_16px.png/>) atau tidak (<img src=:/hostkey_16px.png/>).</translation>
+        <translation>Mengindikasikan apakah keyboard tertangkap oleh Sistem Operasi guest (<img src=:/hostkey_captured_16px.png/>) atau tidak (<img src=:/hostkey_16px.png/>).</translation>
     </message>
     <message>
         <source>Indicates whether the Remote Desktop Server is enabled (<img src=:/vrdp_16px.png/>) or not (<img src=:/vrdp_disabled_16px.png/>).</source>
@@ -4062,27 +4373,41 @@
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Mengindikasikan aktivitas penangkapan video:</nobr><br>%1</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr><b>Video capture disabled</b></nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr><b>Video capture file:</b> %1</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
+        <comment>Virtualization Stuff LED</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>Penangkapan video dinonaktifkan</b></nobr></translation>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>Berkas tangkapan video: </b> %1</nobr></translation>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
-        <comment>Virtualization Stuff LED</comment>
-        <translation>Status fitur tambahan: <br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
     <message>
         <source>&Edit</source>
-        <translation>&Sunting</translation>
+        <translation>&Edit</translation>
     </message>
 </context>
 <context>
@@ -4097,7 +4422,7 @@
     </message>
     <message>
         <source>Preview Monitor %1</source>
-        <translation>Pemantauan Pratinjau %1</translation>
+        <translation>Pratinjau Monitor %1</translation>
     </message>
     <message>
         <source>Snapshot %1</source>
@@ -4121,23 +4446,23 @@
     </message>
     <message>
         <source>No USB Devices Connected</source>
-        <translation>Tidak Ada Perangkat USB Tersambung</translation>
+        <translation>Tidak Ada Device USB Tersambung</translation>
     </message>
     <message>
         <source>No supported devices connected to the host PC</source>
-        <translation>Tidak ada perangkat yang didukung yang terhubung ke PC host</translation>
+        <translation>Tidak ada device yang terdukung terkoneksi pada PC host</translation>
     </message>
     <message>
         <source>Select a filename for the screenshot ...</source>
-        <translation>Pilih sebuah nama berkas untuk cuplikan layar ...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>Tidak Ada Webcam Yang Tersambung</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Tidak ada webcam yang didukung yang terhubung ke PC host</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
@@ -4156,7 +4481,7 @@
     </message>
     <message>
         <source>Enable &Audio</source>
-        <translation>Fungsik&an Suara</translation>
+        <translation>&Nyalakan Suara</translation>
     </message>
     <message>
         <source>Host Audio &Driver:</source>
@@ -4187,7 +4512,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Video</translation>
+        <translation type="obsolete">&Video</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4211,7 +4536,7 @@
     </message>
     <message>
         <source>Enable &3D Acceleration</source>
-        <translation>Fungsikan Akselerasi &3D</translation>
+        <translation>Aktifkan Akselerasi &3D</translation>
     </message>
     <message>
         <source>&Remote Display</source>
@@ -4219,11 +4544,11 @@
     </message>
     <message>
         <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source>
-        <translation>Saat tertandai, VM akan bertindak sebagai server Remote Desktop Protocol (RDP), mengijinkan client jarak jauh untuk terhubung dan mengoperasikan VM (saat berjalan) menggunakan klien RDP standar.</translation>
+        <translation>Saat tertandai, VM akan bertindak sebagai server Remote Desktop Protocol (RDP), mengijinkan client jarak jauh untuk terhubung dan mengendalikan VM (saat berjalan) menggunakan client RDP standar.</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>Fungsikan S&erver</translation>
+        <translation>Aktifkan S&erver</translation>
     </message>
     <message>
         <source>Server &Port:</source>
@@ -4239,11 +4564,11 @@
     </message>
     <message>
         <source>Authentication &Timeout:</source>
-        <translation>&Tenggat Waktu Otentikasi:</translation>
+        <translation>&Timeout Otentikasi:</translation>
     </message>
     <message>
         <source>Specifies the timeout for guest authentication, in milliseconds.</source>
-        <translation>Menyatakan tenggat waktu untuk otentikasi guest, dalam milidetik.</translation>
+        <translation>Menyatakan timeout untuk otentikasi guest, dalam milidetik.</translation>
     </message>
     <message>
         <source>you have assigned less than <b>%1</b> of video memory which is the minimum amount required for HD Video to be played efficiently.</source>
@@ -4255,7 +4580,7 @@
     </message>
     <message>
         <source>Enable &2D Video Acceleration</source>
-        <translation>Fungsikan Akselerasi Video &2D</translation>
+        <translation>Aktifkan Akselerasi Video &2D</translation>
     </message>
     <message>
         <source>The VRDP Server port number. You may specify <tt>0</tt> (zero), to select port 3389, the standard port for RDP.</source>
@@ -4295,133 +4620,197 @@
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>&Tangkapan Video</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>Saat tertandai, VirtualBox akan merekam sesi mesin virtual sebagai suatu berkas video.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation>Fungsikan P&enangkapan Video</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>&Path Berkas:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Pengaturan ini menentukan nama berkas yang dipakai oleh VirtualBox untuk menyimpan isi rekaman.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>&Ukuran Frame:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>Pengaturan ini menentukan resolusi (ukuran frame) dari video rekaman.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>Pengaturan ini menentukan resolusi <b>horisontal</b> (lebar frame) dari video rekaman.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>Pengaturan ini menentukan resolusi <b>vertikal</b> (tinggi frame) dari video rekaman.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>Laju &Frame:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>Pengaturan ini menentukan cacah maksimum <b>frame per detik</b>. Frame tambahan akan dilewati. Mengurangi nilai ini akan menaikkan banyaknya frame yang dilewati dan mengurangi ukuran berkas.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation>&Kualitas:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Pengaturan ini menentukan <b>kualitas</b>. Menaikkan nilai ini akan membuat video nampak lebih baik tapi ukuran berkas meningkat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Pengaturan ini menentukan laju bit dalam <b>kilobit per detik</b>. Menaikkan nilai ini akan membuat video nampak lebih baik tapi ukuran berkas meningkat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation>&Layar:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>Mesin virtual disiapkan untuk memakai akselerasi grafis perangkat keras. Namun sistem host saat ini tidak menyediakannya, sehingga Anda tidak akan bisa mulai menjalankan mesin.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>Mesin virtual saat ini diberi memori video kurang dari <b>%1</b> yang merupakan jumlah minimum yang diperlukan untuk bertukar ke mode layar penuh atau seamless.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>Mesin virtual saat ini diberi memori video kurang dari <b>%1</b> yang merupakan jumlah minimum yang diperlukan bagi High Definition Video untuk diputar secara efisien.</translation>
-    </message>
-    <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>Mesin virtual disiapkan untuk memakai akselerasi grafis perangkat keras dan arahan sistem operasi ditata ke Windows Vista atau setelahnya. Untuk kinerja terbaik Anda mesti menata memori video mesin paling tidak <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>Mesin virtual disiapkan untuk memakai Akselerasi Stream Video. Karena fitur ini hanya bekerja dengan sistem guest Windows itu akan dinonaktifkan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>Nilai port server VRDE saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>Nilai tenggat waktu otentikasi VRDE saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation>Didefinisikan Oleh Pengguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation>%1 fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>fps</source>
-        <translation>fps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation>rendah</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation>sedang</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation>tinggi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation>kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation>Layar %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation>Fungsikan perekaman video bagi layar %1.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">ToolBar Mini:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Bila ditandai, menampilkan ToolBar Mini dalam mode Fullscreen dan Seamless.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Tampilkan Dalam &Fullscreen/Seamless</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Bila ditandai, menampilkan ToolBar Mini di puncak layar, bukan di posisi default di dasar layar.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">&Tampilkan Di Puncak Layar</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4433,10 +4822,10 @@
     </message>
     <message>
         <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>Menyimpan path tempat snapshot dari mesin virtual akan disimpan. Sadari bahwa snapshot dapat menghabiskan banyak ruang disk.</translation>
+        <translation>Tampilkan path dimana snapshot dari mesin virtual akan disimpan. Sadari bahwa snapshot dapat menghabiskan banyak ruang disk.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Dasar</translation>
     </message>
     <message>
@@ -4480,7 +4869,7 @@
         <translation type="obsolete">Mengendalikan jumlah memori video yang tersedia bagi mesin virtual.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>Tingkat L&anjut</translation>
     </message>
     <message>
@@ -4517,11 +4906,11 @@
     </message>
     <message>
         <source>&Shared Clipboard:</source>
-        <translation>Papan Klip Ber&sama:</translation>
+        <translation>Clipboard yang di-&Share:</translation>
     </message>
     <message>
         <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>Memilih data clipboard mana yang akan disalin di antara OS guest dan host. Fitur ini membutuhkan Guest Additions terpasang pada OS guest.</translation>
+        <translation>Memilih data clipboard mana yang akan disalin diantara OS guest dan host. Fitur ini membutuhkan Guest Additions terinstall pada OS guest.</translation>
     </message>
     <message>
         <source>Defines the type of the virtual IDE controller. Depending on this value, VirtualBox will provide different virtual IDE hardware devices to the guest OS.</source>
@@ -4532,64 +4921,160 @@
         <translation>Folder S&napshot:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Deskripsi</translation>
     </message>
     <message>
         <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
-        <translation>Menyimpan deskripsi mesin virtual. Field deskripsi berguna untuk memberikan komentar pada detail konfigurasi dari OS guest yang terpasang.</translation>
+        <translation>Menampilkan deskripsi mesin virtual. Field deskripsi berguna untuk memberikan komentar pada detail konfigurasi dari OS guest terinstal.</translation>
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Saat tertandai, sebarang CD/DVD atau disk floppy yang disisipkan ke atau dilepas dari drive virtual ketika mesin sedang berjalan akan diingat.</translation>
+        <translation type="obsolete">Saat tertandai, perubahan apapun pada media CD/DVD atau Floppy terpasang yang dilakukan saat eksekusi mesin akan disimpan dalam file setting guna menjaga konfigurasi media termuat diantara penjalanan.</translation>
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Media Lepas Pasang:</translation>
+        <translation type="obsolete">Media Removable:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Ingat Perubahan &Runtime</translation>
+        <translation type="obsolete">Ingat Perubahan &Runtime</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Bilah Alat Mini:</translation>
+        <translation type="obsolete">ToolBar Mini:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Bila ditandai, menampilkan Bilah Alat Mini dalam mode Layar Penuh dan Seamless.</translation>
+        <translation type="obsolete">Bila ditandai, menampilkan ToolBar Mini dalam mode Fullscreen dan Seamless.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Tampilkan Dalam Layar &Penuh/Seamless</translation>
+        <translation type="obsolete">Tampilkan Dalam &Fullscreen/Seamless</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Bila ditandai, menampilkan Bilah Alat Mini di puncak layar, bukan pada posisi baku di dasar layar.</translation>
+        <translation type="obsolete">Bila ditandai, menampilkan ToolBar Mini di puncak layar, bukan di posisi default di dasar layar.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>&Tampilkan Di Puncak Layar</translation>
+        <translation type="obsolete">&Tampilkan Di Puncak Layar</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">Anda telah memilih tipe OS guest 64-bit bagi VM ini. Karena guest seperti itu memerlukan virtualisasi hardware (VT-x/AMD-V), maka fitur ini akan otomatis diaktifkan.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
-        <translation>&Drag'n'Drop:</translation>
+        <source>D&rag'n'Drop:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>Memilih data mana yang akan disalin di antara OS guest dan host oleh drag'n'drop. Fitur ini membutuhkan Guest Additions terpasang pada OS guest.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation>Tidak ada nama yang dinyatakan bagi mesin virtual.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>Arahan sistem operasi mesin virtual ditata ke tipe 64 bit. Sistem guest 64 bit memerlukan virtualisasi perangkat keras, sehingga ini akan difungsikan secara otomatis bila Anda mengkonfirmasi perubahan.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">ToolBar Mini:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Bila ditandai, menampilkan ToolBar Mini dalam mode Fullscreen dan Seamless.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Tampilkan Dalam &Fullscreen/Seamless</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Bila ditandai, menampilkan ToolBar Mini di puncak layar, bukan di posisi default di dasar layar.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">&Tampilkan Di Puncak Layar</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4608,11 +5093,11 @@
     </message>
     <message>
         <source>&Enable Network Adapter</source>
-        <translation>&Fungsikan Adaptor Jaringan</translation>
+        <translation>&Aktifkan Adaptor Jaringan</translation>
     </message>
     <message>
         <source>Selects the type of the virtual network adapter. Depending on this value, VirtualBox will provide different network hardware to the virtual machine.</source>
-        <translation>Memilih tipe adaptor jaringan virtual. Bergantung pada nilai tersebut, VirtualBox akan menyediakan perangkat keras jaringan yang berbeda bagi mesin virtual.</translation>
+        <translation>Memilih tipe adaptor jaringan virtual. Bergantung pada nilai tersebut, VirtualBox akan menyediakan hardware jaringan yang berbeda bagi mesin virtual.</translation>
     </message>
     <message>
         <source>&Attached to:</source>
@@ -4628,7 +5113,7 @@
     </message>
     <message>
         <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
-        <translation>Menyimpan alamat MAC dari adaptor ini. Ia berisi tepat 12 karakter dipilih dari {0-9,A-F}. Perhatikan bahwa karakter kedua harus digit genap.</translation>
+        <translation>Menampilkan alamat MAC dari adaptor ini. Ia berisi tepat 12 karakter dipilih dari {0-9,A-F}. Perhatikan bahwa karakter kedua harus digit genap.</translation>
     </message>
     <message>
         <source>Generates a new random MAC address.</source>
@@ -4719,11 +5204,11 @@
     </message>
     <message>
         <source>&Cable Connected</source>
-        <translation>Ka&bel Tersambung</translation>
+        <translation>Ka&bel terhubung</translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Buka jendela untuk mengelola aturan penerusan port.</translation>
+        <translation>Buka dialog untuk mengelola aturan penerusan port.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
@@ -4767,39 +5252,39 @@
     </message>
     <message>
         <source>&MAC Address:</source>
-        <translation>Alamat &MAC:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation>Tidak ada adaptor jaringan ter-bridge yang saat ini dipilih.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>Nama jaringan internal saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>Tidak ada adaptor jaringan hanya-host saat ini yang dipilih.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation>Tidak ada driver generik yang saat ini dipilih.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>Alamat MAC mesti sepanjang 12 dijit heksadesimal.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation>Dijit kedua dalam alamat MAC tidak boleh ganjil karena hanya alamt unicast yang diijinkan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>Nama jaringan NAT saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>Menyimpan nama jaringan NAT tempat akan terhubungnya kartu jaringan ini. Anda dapat membuat dan menghapus jaringan memakai pengaturan jaringan global dalam jendela manajer mesin virtual.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4841,7 +5326,7 @@
     </message>
     <message>
         <source>&Enable Parallel Port</source>
-        <translation>Fungsikan Port Paral&el</translation>
+        <translation>Nyalakan Port Paral&el</translation>
     </message>
     <message>
         <source>Port &Number:</source>
@@ -4849,7 +5334,7 @@
     </message>
     <message>
         <source>Holds the parallel port number. You can choose one of the standard parallel ports or select <b>User-defined</b> and specify port parameters manually.</source>
-        <translation>Menyimpan nomor port paralel. Anda dapat memilih satu dari port paralel standar atau pilih <b>Didefinisikan pengguna</b> dan menyatakan parameter port secara manual.</translation>
+        <translation>Tampilkan nomor port paralel. Anda dapat memilih satu dari port paralel standar atau pilih <b>Didefinisikan pengguna</b> dan menyatakan parameter port secara manual.</translation>
     </message>
     <message>
         <source>&IRQ:</source>
@@ -4873,15 +5358,15 @@
     </message>
     <message>
         <source>Holds the host parallel device name.</source>
-        <translation>Menyimpan nama device paralel milik host.</translation>
+        <translation>Tampilkan nama device paralel milik host.</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this parallel port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation>Menyimpan nomor IRQ dari port paralel ini. Ini mesti berupa bilangan bulat antara <tt>0</tt> dan <tt>255</tt>. Nilai lebih dari <tt>15</tt> hanya bisa digunakan bila pengaturan <b>I/O APIC</b> dinyalakan untuk mesin virtual ini.</translation>
+        <translation>Tampilkan nomor IRQ dari port paralel ini. Ini mesti berupa bilangan bulat antara <tt>0</tt> dan <tt>255</tt>. Nilai lebih dari <tt>15</tt> hanya bisa digunakan bila pengaturan <b>I/O APIC</b> dinyalakan untuk mesin virtual ini.</translation>
     </message>
     <message>
         <source>Holds the base I/O port address of this parallel port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation>Menyimpan alamat dasar port I/O dari port paralel ini. Nilai yang valid adalah bilangan bulat dalam jangkauan <tt>0</tt> hingga <tt>0xFFFF</tt>.</translation>
+        <translation>Tampilkan alamat dasar port I/O dari port paralel ini. Nilai yang valid adalah bilangan bulat dalam jangkauan <tt>0</tt> hingga <tt>0xFFFF</tt>.</translation>
     </message>
 </context>
 <context>
@@ -4900,23 +5385,23 @@
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>IRQ saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Port I/O saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Dua port atau lebih memiliki pengaturan yang sama.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Path port saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Saat ini ada path port yang duplikat.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4954,15 +5439,15 @@
     <name>UIMachineSettingsSF</name>
     <message>
         <source>Adds a new shared folder definition.</source>
-        <translation>Menambahkan sebuah definisi baru folder bersama.</translation>
+        <translation>Menambahkan sebuah definisi baru folder yang di share.</translation>
     </message>
     <message>
         <source>Edits the selected shared folder definition.</source>
-        <translation>Sunting definisi folder bersama yang dipilih.</translation>
+        <translation>Edit definisi folder yang di share yang dipilih.</translation>
     </message>
     <message>
         <source>Removes the selected shared folder definition.</source>
-        <translation>Menghapus definisi folder bersama yang dipilih.</translation>
+        <translation>Hapus definisi folder yang di share yang dipilih.</translation>
     </message>
     <message>
         <source> Machine Folders</source>
@@ -4982,7 +5467,7 @@
     </message>
     <message>
         <source>Lists all shared folders accessible to this machine. Use 'net use x: \\vboxsvr\share' to access a shared folder named <i>share</i> from a DOS-like OS, or 'mount -t vboxsf share mount_point' to access it from a Linux OS. This feature requires Guest Additions.</source>
-        <translation>Menampilkan daftar semua folder bersama yang dapat diakses oleh mesin ini. Gunakan 'net use x: \\vboxsvr\share' untuk mengakses sebuah folder bersama bernama <i>share</i> dari OS serupa DOS atau 'mount -t vboxsf share titik_kait' dari OS Linux. Fitur ini membutuhkan Guest Additions.</translation>
+        <translation>Tampilkan daftar semua folder yang di share yang dapat diakses oleh mesin ini. Gunakan 'net use x: \\vboxsvr\share' untuk mengakses sebuah folder yang di share bernama <i>share</i> dari OS serupa DOS atau 'mount -t vboxsf share titik_mount_point' dari OS Linux. Fitur ini membutuhkan Guest Additions.</translation>
     </message>
     <message>
         <source>Name</source>
@@ -4998,15 +5483,15 @@
     </message>
     <message>
         <source>&Add Shared Folder</source>
-        <translation>T&ambah Folder Bersama</translation>
+        <translation>T&ambah Folder Yang Di-Share</translation>
     </message>
     <message>
         <source>&Edit Shared Folder</source>
-        <translation>&Sunting Folder Bersama</translation>
+        <translation>&Edit Folder Yang Di-Share</translation>
     </message>
     <message>
         <source>&Remove Shared Folder</source>
-        <translation>Hapus Folde&r Bersama</translation>
+        <translation>Hapus Folde&r Yang Di-Share</translation>
     </message>
     <message>
         <source>&Folders List</source>
@@ -5014,7 +5499,7 @@
     </message>
     <message>
         <source>Auto-mount</source>
-        <translation>Kaitkan Otomatis</translation>
+        <translation>Mount Otomatis</translation>
     </message>
     <message>
         <source>Yes</source>
@@ -5025,11 +5510,11 @@
     <name>UIMachineSettingsSFDetails</name>
     <message>
         <source>Add Share</source>
-        <translation>Tambahkan Berbagi Pakai</translation>
+        <translation>Tambahkan Share</translation>
     </message>
     <message>
         <source>Edit Share</source>
-        <translation>Sunting Berbagi Pakai</translation>
+        <translation>Edit Share</translation>
     </message>
     <message>
         <source>Dialog</source>
@@ -5045,11 +5530,11 @@
     </message>
     <message>
         <source>Holds the name of the shared folder (as it will be seen by the guest OS).</source>
-        <translation>Menyimpan nama dari folder yang dipakai bersama (sebagaimana terlihat oleh OS guest).</translation>
+        <translation>Tampilkan nama dari folder yang di share (sebagaimana terlihat oleh OS guest).</translation>
     </message>
     <message>
         <source>When checked, the guest OS will not be able to write to the specified shared folder.</source>
-        <translation>Saat ditandai, OS guest tidak akan dapat menulis ke folder bersama yang dinyatakan.</translation>
+        <translation>Saat ditandai, OS guest tidak akan dapat menulis ke folder yang di-share yang dinyatakan.</translation>
     </message>
     <message>
         <source>&Read-only</source>
@@ -5061,19 +5546,15 @@
     </message>
     <message>
         <source>When checked, the guest OS will try to automatically mount the shared folder on startup.</source>
-        <translation>Saat ditandai, OS guest akan mencoba mengait secara otomatis folder bersama saat awal mula.</translation>
+        <translation>Saat ditandai, OS guest akan mencoba me-mount secara otomatis, folder yang di-share, saat startup.</translation>
     </message>
     <message>
         <source>&Auto-mount</source>
-        <translation>Kaitkan otom&atis</translation>
+        <translation>Mount otom&atis</translation>
     </message>
     <message>
         <source>If checked, this shared folder will be permanent.</source>
-        <translation>Bila ditandai, folder bersama ini akan permanen.</translation>
-    </message>
-    <message>
-        <source>Window</source>
-        <translation>Jendela</translation>
+        <translation>Bila ditandai, folder yang di-share ini akan permanen.</translation>
     </message>
 </context>
 <context>
@@ -5085,11 +5566,11 @@
     </message>
     <message>
         <source>When checked, enables the given serial port of the virtual machine.</source>
-        <translation>Saat ditandai, memfungsikan port serial yang diberikan pada mesin virtual.</translation>
+        <translation>Saat ditandai, nyalakan port serial yang diberikan pada mesin virtual.</translation>
     </message>
     <message>
         <source>&Enable Serial Port</source>
-        <translation>Fungsikan Port S&erial</translation>
+        <translation>Nyalakan Port S&erial</translation>
     </message>
     <message>
         <source>Port &Number:</source>
@@ -5097,7 +5578,7 @@
     </message>
     <message>
         <source>Selects the serial port number. You can choose one of the standard serial ports or select <b>User-defined</b> and specify port parameters manually.</source>
-        <translation>Pilih nomor port serial. Anda dapat memilih satu dari port serial standar atau pilih <b>Didefinisikan oleh pengguna</b> dan menyatakan parameter port secara manual.</translation>
+        <translation>Tampilkan nomor port serial. Anda dapat memilih satu dari port serial standar atau pilih <b>Didefinisikan oleh pengguna</b> dan menyatakan parameter port secara manual.</translation>
     </message>
     <message>
         <source>&IRQ:</source>
@@ -5125,27 +5606,43 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>BIla ditandai, pipa yang disebutkan dalam ruas <b>Path Port</b> akan diciptakan oleh mesin virtual saat mulai menyala. Jika tidak, mesin virtual akan menganggap pipa ada dan mencoba menggunakannya.</translation>
+        <translation type="obsolete">BIla ditandai, pipa yang disebutkan dalam field <b>Path Port</b> akan diciptakan oleh mesin virtual saat ia mulai menyala. Jika tidak, mesin virtual akan menganggap pipa ada dan mencoba menggunakannya.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Ciptakan Pipa</translation>
+        <translation type="obsolete">&Ciptakan Pipa</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Menyimpan path ke pipa port serial pada host saat port bekerja pada mode <b>Pipa Host</a>, atau nama perangkat serial host saat port bekerja pada mode <b>Device Host</b>.</translation>
+        <translation type="obsolete">Tampilkan path ke pipa port serial pada host saat port bekerja pada mode <b>Pipa Host</a>, atau nama device serial host saat port bekerja pada mode <b>Device Host</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Path Port/File:</translation>
+        <translation type="obsolete">&Path Port/File:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation>Menyimpan nomor IRQ dari port serial ini. Ini mesti berupa bilangan bulat antara <tt>0</tt> dan <tt>255</tt>. Nilai lebih dari <tt>15</tt> hanya bisa digunakan bila pengaturan <b>I/O APIC</b> dinyalakan untuk mesin virtual ini.</translation>
+        <translation>Tampilkan nomor IRQ dari port serial ini. Ini mesti berupa bilangan bulat antara <tt>0</tt> dan <tt>255</tt>. Nilai lebih dari <tt>15</tt> hanya bisa digunakan bila pengaturan <b>I/O APIC</b> dinyalakan untuk mesin virtual ini.</translation>
     </message>
     <message>
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation>Menyimpan alamat dasar port I/O dari port paralel ini. Nilai yang valid adalah bilangan bulat dalam jangkauan <tt>0</tt> hingga <tt>0xFFFF</tt>.</translation>
+        <translation>Tampilkan alamat dasar port I/O dari port paralel ini. Nilai yang valid adalah bilangan bulat dalam jangkauan <tt>0</tt> hingga <tt>0xFFFF</tt>.</translation>
+    </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5164,23 +5661,23 @@
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>IRQ saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Port I/O saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Dua port atau lebih memiliki pengaturan yang sama.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Path port saat ini tidak dinyatakan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Saat ini ada path port yang duplikat.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5219,7 +5716,7 @@
     </message>
     <message>
         <source><nobr>Expand/Collapse&nbsp;Item</nobr></source>
-        <translation><nobr>Kembangkan/Ringkaskan&nbsp;Butir</nobr></translation>
+        <translation><nobr>Kembangkan/Ringkaskan&nbsp:Item</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Hard&nbsp;Disk</nobr></source>
@@ -5227,11 +5724,11 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Tambah&nbsp;Perangkat&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Tambah&nbsp;Device&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Tambah&nbsp;Perangkat&nbsp;Floppy</nobr></translation>
+        <translation type="obsolete"><nobr>Tambah&nbsp;Device&nbsp;Floppy</nobr></translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -5271,11 +5768,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Tambah Perangkat CD/DVD</translation>
+        <translation type="obsolete">Tambah Device CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Tambah Perangkat Floppy</translation>
+        <translation type="obsolete">Tambah Device Floppy</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5287,7 +5784,7 @@
     </message>
     <message>
         <source>Removes the controller highlighted in the Storage Tree.</source>
-        <translation>Hapus pengendali yang disorot pada Pohon Penyimpanan.</translation>
+        <translation>Hapus pengendali yang di-highlight pada Pohon Penyimpanan.</translation>
     </message>
     <message>
         <source>Adds a new attachment to the Storage Tree using currently selected controller as parent.</source>
@@ -5295,7 +5792,7 @@
     </message>
     <message>
         <source>Removes the attachment highlighted in the Storage Tree.</source>
-        <translation>Hapus cantolan yang disorot dalam Pohon Penyimpanan.</translation>
+        <translation>Hapus cantolan yang di-highlight dalam Pohon Penyimpanan.</translation>
     </message>
     <message>
         <source>IDE Controller</source>
@@ -5323,7 +5820,7 @@
     </message>
     <message>
         <source>Contains all storage controllers for this machine and the virtual images and host drives attached to them.</source>
-        <translation>Memuat semua pengendali penyimpanan bagi mesin ini dan image virtual serta drive host yang ditancapkan ke mereka.</translation>
+        <translation>Memuat semua pengendali penyimpanan bagi mesin ini dan image virtual serta drive host ditancapkan ke mereka.</translation>
     </message>
     <message>
         <source>Information</source>
@@ -5419,23 +5916,23 @@
     </message>
     <message>
         <source>Choose or create a virtual hard disk file. The virtual machine will see the data in the file as the contents of the virtual hard disk.</source>
-        <translation>Pilih atau ciptakan berkas hard disk virtual. Mesin virtual akan melihat data dalam berkas sebagai isi hard disk virtual.</translation>
+        <translation>Pilih atau ciptakan file hard disk virtual. Mesin virtual akan melihat data dalam file sebagai isi hard disk virtual.</translation>
     </message>
     <message>
         <source>Set up the virtual hard disk</source>
-        <translation>Siapkan hard disk virtual</translation>
+        <translation>Set up hard disk virtual</translation>
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&Drive CD/DVD:</translation>
+        <translation type="obsolete">&Drive CD/DVD:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Pilih disk CD/DVD virtual atau drive fisik untuk dipakai dengan drive virtual. Mesin virtual akan melihat suatu disk disisipkan ke dalam drive dengan data dalam berkas atau pada disk dalam drive fisik sebagai isinya.</translation>
+        <translation type="obsolete">Pilih disk CD/DVD virtual atau drive fisik untuk dipakai dengan drive virtual. Mesin virtual akan melihat suatu disk disisipkan ke dalam drive dengan data dalam file atau pada disk dalam drive fisik sebagai isinya.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Siapkan drive CD/DVD virtual</translation>
+        <translation type="obsolete">Set up drive CD/DVD virtual</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5443,11 +5940,11 @@
     </message>
     <message>
         <source>Choose a virtual floppy disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Pilih disk floppy virtual atau drive fisik untuk dipakai dengan drive virtual. Mesin virtual akan melihat suatu disk disisipkan ke dalam drive dengan data dalam berkas atau pada disk dalam drive fisik sebagai isinya.</translation>
+        <translation>Pilih disk floppy virtual atau drive fisik untuk dipakai dengan drive virtual. Mesin virtual akan melihat suatu disk disisipkan ke dalam drive dengan data dalam file atau pada disk dalam drive fisik sebagai isinya.</translation>
     </message>
     <message>
         <source>Set up the virtual floppy drive</source>
-        <translation>Siapkan drive floppy virtual</translation>
+        <translation>Set up drive floppy virtual</translation>
     </message>
     <message>
         <source>Create a new hard disk...</source>
@@ -5455,11 +5952,11 @@
     </message>
     <message>
         <source>Choose a virtual hard disk file...</source>
-        <translation>Pilih berkas hard disk virtual...</translation>
+        <translation>Pilih file hard disk virtual...</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Pilih sebuah berkas CD/DVD virtual...</translation>
+        <translation type="obsolete">Pilih sebuah file CD/DVD virtual...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5467,7 +5964,7 @@
     </message>
     <message>
         <source>Choose a virtual floppy disk file...</source>
-        <translation>Pilih sebuah berkas floppy virtual...</translation>
+        <translation>Pilih sebuah file floppy virtual...</translation>
     </message>
     <message>
         <source>When checked the virtual disk will not be removed when the guest system ejects it.</source>
@@ -5479,11 +5976,11 @@
     </message>
     <message>
         <source>When checked the guest system will see the virtual disk as a solid state device.</source>
-        <translation>Saat ditandai, sistem guest akan melihat disk virtual sebagai perangkat solid state.</translation>
+        <translation>Saat ditandai, sistem guest akan melihat disk virtual sebagai device solid state.</translation>
     </message>
     <message>
         <source>&Solid-state Drive</source>
-        <translation>Drive &Solid-state</translation>
+        <translation>Drive &solid-state</translation>
     </message>
     <message>
         <source>Details:</source>
@@ -5494,58 +5991,106 @@
         <translation type="obsolete">nama tak dinyatakan bagi pengendali pada posisi <b>%1</b>.</translation>
     </message>
     <message>
-        <source>controller at position <b>%1</b> uses the name that is already used by controller at position <b>%2</b>.</source>
-        <translation type="obsolete">pengendali pada posisi <b>%1</b> memakai nama yang telah dipakai oleh pengendali pada posisi <b>%2</b>.</translation>
+        <source>controller at position <b>%1</b> uses the name that is already used by controller at position <b>%2</b>.</source>
+        <translation type="obsolete">pengendali pada posisi <b>%1</b> memakai nama yang telah dipakai oleh pengendali pada posisi <b>%2</b>.</translation>
+    </message>
+    <message>
+        <source>no hard disk is selected for <i>%1</i>.</source>
+        <translation type="obsolete">tak ada hard disk yang dipilih bagi <i>%1</i>.</translation>
+    </message>
+    <message>
+        <source>at most one supported</source>
+        <comment>controller</comment>
+        <translation>paling banyak satu yang didukung</translation>
+    </message>
+    <message>
+        <source>up to %1 supported</source>
+        <comment>controllers</comment>
+        <translation>sampai dengan %1 yang didukung</translation>
+    </message>
+    <message>
+        <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
+        <translation type="obsolete">Anda kini memakai pengendali penyimpanan lebih banyak daripada yang didukung oleh chipset %1. Silakan ubah tipe chipset pada halaman pengaturan Sistem atau kurang cacah pengendali penyimpanan berikut pada halaman pengaturan Penyimpanan: %2.</translation>
+    </message>
+    <message>
+        <source>&Port Count:</source>
+        <translation>Cacah &Port:</translation>
+    </message>
+    <message>
+        <source>Selects the port count of the SATA storage controller currently selected in the Storage Tree. This must be at least one more than the highest port number you need to use.</source>
+        <translation>Pilih cacah port dari pengendali penyimpanan SATA yang kini dipilih dalam Pohon Penyimpanan. Ini mesti paling tidak lebih satu daripada nomor port tertinggi yang Anda perlu pergunakan.</translation>
+    </message>
+    <message>
+        <source>Controller: %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No name is currently specified for the controller at position <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No hard disk is selected for <i>%1</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>no hard disk is selected for <i>%1</i>.</source>
-        <translation type="obsolete">tak ada hard disk yang dipilih bagi <i>%1</i>.</translation>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>at most one supported</source>
-        <comment>controller</comment>
-        <translation>paling banyak satu yang didukung</translation>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>up to %1 supported</source>
-        <comment>controllers</comment>
-        <translation>sampai dengan %1 yang didukung</translation>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
-        <translation type="obsolete">Anda kini memakai pengendali penyimpanan lebih banyak daripada yang didukung oleh chipset %1. Silakan ubah tipe chipset pada halaman pengaturan Sistem atau kurang cacah pengendali penyimpanan berikut pada halaman pengaturan Penyimpanan: %2.</translation>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Port Count:</source>
-        <translation>Cacah &Port:</translation>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Selects the port count of the SATA storage controller currently selected in the Storage Tree. This must be at least one more than the highest port number you need to use.</source>
-        <translation>Pilih cacah port dari pengendali penyimpanan SATA yang kini dipilih dalam Pohon Penyimpanan. Ini mesti paling tidak lebih satu daripada nomor port tertinggi yang Anda perlu pergunakan.</translation>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Controller: %1</source>
-        <translation>Pengendali: %1</translation>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>Saat ini nama tidak dinyatakan bagi pengendali pada posisi <b>%1</b>.</translation>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>Pengendali pada posisi <b>%1</b> memakai nama yang sama dengan pengendali pada posisi <b>%2</b>.</translation>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>Tidak ada hard disk yang dipilih bagi <i>%1</i>.</translation>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> menggunakan hard disk yang sudah terpasang pada <i>%2</i>.</translation>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>Mesin kini memiliki pengendali penyimpanan terpasang yang lebih banyak daripada yang didukung oleh chipset %1. Silakan ubah tipe chipset pada halaman pengaturan Sistem atau kurangi cacah pengendali penyimpanan berikut pada halaman pengaturan Penyimpanan: %2</translation>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5605,7 +6150,7 @@
     </message>
     <message>
         <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
-        <translation>Menentukan urutan perangkat boot. Gunakan kotak contreng yang tersedia di sebelah kiri untuk menyalakan atau mematikan perangkat boot secara individual. Naikkan atau turunkan butir untuk mengubah urutan perangkat.</translation>
+        <translation>Menentukan urutan boot device. Gunakan checkbox yang tersedia di sebelah kiri untuk menyalakan atau mematikan boot device secara individual. Naikkan atau turunkan item untuk mengubah urutan device.</translation>
     </message>
     <message>
         <source>Move Down (Ctrl-Down)</source>
@@ -5613,7 +6158,7 @@
     </message>
     <message>
         <source>Moves the selected boot device down.</source>
-        <translation>Turunkan perangkat boot yang dipilih.</translation>
+        <translation>Turunkan boot device yang dipilih.</translation>
     </message>
     <message>
         <source>Move Up (Ctrl-Up)</source>
@@ -5621,7 +6166,7 @@
     </message>
     <message>
         <source>Moves the selected boot device up.</source>
-        <translation>Naikkan perangkat boot yang dipilih.</translation>
+        <translation>Naikkan boot device yang dipilih.</translation>
     </message>
     <message>
         <source>Extended Features:</source>
@@ -5629,11 +6174,11 @@
     </message>
     <message>
         <source>When checked, the virtual machine will support the Input Output APIC (I/O APIC), which may slightly decrease performance. <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
-        <translation>Saat tertandai, mesin virtual akan mendukung Input Output APIC (I/O APIC), yang bisa saja sedikit menurunkan kinerja mesin. <b>Catatan:</b> jangan nonaktifkan fitur ini setelah memasang sebuah sistem operasi guest Windows!</translation>
+        <translation>Saat tertandai, mesin virtual akan mendukung Input Output APIC (I/O APIC), yang bisa saja sedikit menurunkan kinerja mesin. <b>Catatan:</b> jangan matikan fitur ini setelah menginstal sebuah sistem operasi guest Windows!</translation>
     </message>
     <message>
         <source>Enable &I/O APIC</source>
-        <translation>Fungsikan &I/O APIC</translation>
+        <translation>Aktifkan &I/O APIC</translation>
     </message>
     <message>
         <source>&Processor</source>
@@ -5649,7 +6194,7 @@
     </message>
     <message>
         <source>Enable PA&E/NX</source>
-        <translation>Fungsikan PA&E/NX</translation>
+        <translation>Aktifkan PA&E/NX</translation>
     </message>
     <message>
         <source>Acce&leration</source>
@@ -5657,15 +6202,15 @@
     </message>
     <message>
         <source>Hardware Virtualization:</source>
-        <translation>Virtualisasi Perangkat Keras:</translation>
+        <translation>Virtualisasi Hardware:</translation>
     </message>
     <message>
         <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V.</source>
-        <translation>Bila ditandai, mesin virtual akan mencoba memakai ekstensi virtualisasi perangkat keras milik CPU host seperti misalnya Intel VT-x dan AMD-V.</translation>
+        <translation>Bila ditandai, mesin virtual akan mencoba memakai ekstensi virtualisasi hardware milik CPU host seperti misalnya Intel VT-x dan AMD-V.</translation>
     </message>
     <message>
         <source>Enable &VT-x/AMD-V</source>
-        <translation>Fungsikan &VT-x/AMD-V</translation>
+        <translation>Aktifkan &VT-x/AMD-V</translation>
     </message>
     <message>
         <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source>
@@ -5673,12 +6218,12 @@
     </message>
     <message>
         <source>Enable Nested Pa&ging</source>
-        <translation>Fungsikan Pa&ging Bertingkat</translation>
+        <translation>Aktifkan Pa&ging Bertingkat</translation>
     </message>
     <message>
         <source><qt>%1&nbsp;CPUs</qt></source>
         <comment>%1 is host cpu count * 2 for now</comment>
-        <translation><qt>%1&nbsp;CPU</qt></translation>
+        <translation><qt>%1&nbsp;CPUs</qt></translation>
     </message>
     <message>
         <source>When checked, the guest will support the Extended Firmware Interface (EFI), which is required to boot certain guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</source>
@@ -5686,19 +6231,19 @@
     </message>
     <message>
         <source>Enable &EFI (special OSes only)</source>
-        <translation>Fungsikan &EFI (hanya OS khusus)</translation>
+        <translation>Aktifkan &EFI (hanya OS khusus)</translation>
     </message>
     <message>
         <source>If checked, the RTC device will report the time in UTC, otherwise in local (host) time. Unix usually expects the hardware clock to be set to UTC.</source>
-        <translation>Bila ditandai, perangkat RTC akan melaporkan waktu dalam UTC, bila tidak, dalam waktu lokal (host). Unix biasanya mengharapkan jam perangkat keras ditata ke UTC.</translation>
+        <translation>Bila ditandai, device RTC akan melaporkan waktu dalam UTC, bila tidak, dalam waktu lokal (host). Unix biasanya mengharapkan jam hardware ditata ke UTC.</translation>
     </message>
     <message>
         <source>Hardware Clock in &UTC Time</source>
-        <translation>Jam Perangkat Keras dalam Waktu &UTC</translation>
+        <translation>Jam hardware dalam waktu &UTC</translation>
     </message>
     <message>
         <source>Controls the number of virtual CPUs in the virtual machine. You need hardware virtualization support on your host system to use more than one virtual CPU.</source>
-        <translation>Mengendalikan cacah CPU virtual dalam mesin virtual. Anda perlu dukungan virtualisasi perangkat keras pada sistem host Anda untuk memakai lebih dari satu CPU virtual.</translation>
+        <translation>Mengendalikan cacah CPU virtual dalam mesin virtual. Anda perlu dukungan virtualisasi hardware pada sistem host Anda untuk memakai lebih dari satu CPU virtual.</translation>
     </message>
     <message>
         <source>If checked, an absolute pointing device (a USB tablet) will be supported. Otherwise, only a standard PS/2 mouse will be emulated.</source>
@@ -5718,11 +6263,11 @@
     </message>
     <message>
         <source>&Execution Cap:</source>
-        <translation>Batas &Eksekusi:</translation>
+        <translation>Cap &Eksekusi:</translation>
     </message>
     <message>
         <source>Limits the amount of time that each virtual CPU is allowed to run for. Each virtual CPU will be allowed to use up to this percentage of the processing time available on one physical CPU. The execution cap can be disabled by setting it to 100%. Setting the cap too low can make the machine feel slow to respond.</source>
-        <translation>Membatasi lama waktu setiap CPU virtual diijinkan berjalan. Setiap CPU virtual akan diijinkan memakai sampai dengan persentase ini dari waktu pemrosesan yang tersedia pada satu CPU fisik. Batas eksekusi dapat dimatikan dengan menatanya ke 100%. Menata batas terlalu rendah dapat membuat mesin terasa lambat merespon.</translation>
+        <translation>Membatasi lama waktu setiap CPU virtual diijinkan berjalan. Setiap CPU virtual akan diijinkan memakai sampai dengan persentase ini dari waktu pemrosesan yang tersedia pada satu CPU fisik. Cap eksekusi dapat dimatikan dengan menatanya ke 100%. Menata cap terlalu rendah dapat membuat mesin terasa lambat merespon.</translation>
     </message>
     <message>
         <source>you have set the processor execution cap to a low value. This can make the machine feel slow to respond.</source>
@@ -5748,47 +6293,55 @@
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>Perangkat &Penunjuk:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Menentukan apakah perangkat penunjuk yang diemulasi adalah tetikus PS/2 standar, tablet USB, atau tablet multi-sentuh USB.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>Lebih dari <b>%1%</b> dari memori komputer host (<b>%2</b>) diserahkan ke mesin virtual. Memori tersisa tidak cukup untuk sistem operasi host. Silakan pilih nilai yang lebih kecil.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>Lebih dari <b>%1%</b> dari memori komputer host (<b>%2</b>) diserahkan ke mesin virtual. Memori tersisa mungkin tidak cukup untuk sistem operasi host. Harap pertimbangkan untuk memilih nilai yang lebih kecil.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>Fitur I/O APIC saat ini tidak difungsikan dalam bagian Motherboard dari halaman SIstem. Ini diperlukan untuk mendukung chipset bertipe ICH9. Ini akan dilakukan secara otomatis bila Anda mengkonfirmasi perubahan Anda.</translation>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>Emulasi pengendali USB saat ini tidak difungsikan pada halaman USB. Ini diperlukan untuk mendukung perangkat masukan USB teremulasi. Ini akan dilakukan secara otomatis bila Anda mengkonfirmasi perubahan Anda.</translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>Untuk alasan kinerja, cacah CPU virtual yang terpasang ke mesin virtual tidak boleh lebih dari dua kali cacah CPU fisik pada host (<b>%1</b>). Harap kurangi cacah CPU virtual.</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>Lebih banyak CPU virtual yang dipasang ke mesin virtual daripada cacah CPU fisik pada sistem host (<b>%1</b>). Ini boleh jadi menurunkan kinerja mesin virtual Anda. Harap pertimbangkan untuk mengurangi cacah CPU virtual.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Fitur I/O APIC saat ini tidak difungsikan dalam bagian Motherboard dari halaman SIstem. Ini diperlukan untuk mendukung lebih dari satu prosesor virtual. Ini akan dilakukan secara otomatis bila Anda mengkonfirmasi perubahan Anda.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Virtualisasi perangkat keras saat ini tidak difungsikan dalam bagian Akselerasi dari halaman SIstem. Ini diperlukan untuk mendukung lebih dari satu prosesor virtual. Ini akan dilakukan secara otomatis bila Anda mengkonfirmasi perubahan Anda.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>Batas eksekusi prosesor diatur ke nilai yang rendah. Ini mungkin membuat mesin terasa lambat merespon.</translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5799,11 +6352,11 @@
     </message>
     <message>
         <source>A&dd Filter From Device</source>
-        <translation>Tambahkan Filter &Dari Perangkat</translation>
+        <translation>Tambahkan Filter &Dari Device</translation>
     </message>
     <message>
         <source>&Edit Filter</source>
-        <translation>&Sunting Filter</translation>
+        <translation>&Edit Filter</translation>
     </message>
     <message>
         <source>&Remove Filter</source>
@@ -5827,7 +6380,7 @@
     </message>
     <message>
         <source>Edits the selected USB filter.</source>
-        <translation>Sunting filter USB yang dipilih.</translation>
+        <translation>Edit filter USB yang dipilih.</translation>
     </message>
     <message>
         <source>Removes the selected USB filter.</source>
@@ -5852,7 +6405,7 @@
     </message>
     <message>
         <source>Enable &USB Controller</source>
-        <translation>Fungsikan Pengendali &USB</translation>
+        <translation>Aktifkan Pengendali &USB</translation>
     </message>
     <message>
         <source>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</source>
@@ -5860,15 +6413,15 @@
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Aktifkan Pengendali USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">Aktifkan Pengendali USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
-        <translation>&Filter Perangkat USB</translation>
+        <translation>&Filter Device USB</translation>
     </message>
     <message>
         <source>Lists all USB filters of this machine. The checkbox to the left defines whether the particular filter is enabled or not. Use the context menu or buttons to the right to add or remove USB filters.</source>
-        <translation>Menampilkan semua filter USB dari mesin ini. Kotak contreng di kiri menentukan apakah filter tertentu difungsikan atau tidak. Gunakan menu konteks atau tombol di kanan untuk menambah atau menghapus filter USB.</translation>
+        <translation>Menampilkan semua filter USB dari mesin ini. Checkbox di kiri menentukan apakah filter tertentu diaktifkan atau tidak. Gunakan menu konteks atau tombol di kanan untuk menambah atau menghapus filter USB.</translation>
     </message>
     <message>
         <source>[filter]</source>
@@ -5919,8 +6472,28 @@
         <translation type="obsolete">USB 2.0 kini diaktifkan bagi mesin virtual ini. Namun, ini memerlukan instalasi <b>%1</b>. Silakan instal Extension Pack dari situs download VirtualBox. Setelah ini Anda akan dapat mengaktifkan ulang USB 2.0. Ini akan dimatikan sementara kecuali Anda membatalkan perubahan pengaturan kini.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 saat ini difungsikan bagi mesin virtual ini. Namun, ini memerlukan dipasangnya <b>%1</b>. Harap pasang Extension Pack dari situs unduh VirtualBox atau nonaktifkan USB 2.0 agar bisa memulai mesin.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5946,7 +6519,7 @@
     </message>
     <message>
         <source>Holds the filter name.</source>
-        <translation>Menyimpan nama filter.</translation>
+        <translation>Tampilkan nama filter.</translation>
     </message>
     <message>
         <source>&Vendor ID:</source>
@@ -5954,7 +6527,7 @@
     </message>
     <message>
         <source>Defines the vendor ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
-        <translation>Mendefinisikan penyaring ID vendor. Format string <i>cocok eksak</i> adalah <tt>XXXX</tt> dimana <tt>X</tt> adalah digit heksadesimal. String kosong akan cocok dengan sebarang nilai.</translation>
+        <translation>Mendefinisikan filter ID vendor. Format string <i>cocok eksak</i> adalah <tt>XXXX</tt> dimana <tt>X</tt> adalah digit heksadesimal. String kosong akan cocok dengan sebarang nilai.</translation>
     </message>
     <message>
         <source>&Product ID:</source>
@@ -5962,7 +6535,7 @@
     </message>
     <message>
         <source>Defines the product ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
-        <translation>Mendefinisikan penyaring ID produk. Format string <i>cocok eksak</i> adalah <tt>XXXX</tt> dimana <tt>X</tt> adalah digit heksadesimal. String kosong akan cocok dengan sebarang nilai.</translation>
+        <translation>Mendefinisikan filter ID produk. Format string <i>cocok eksak</i> adalah <tt>XXXX</tt> dimana <tt>X</tt> adalah digit heksadesimal. String kosong akan cocok dengan sebarang nilai.</translation>
     </message>
     <message>
         <source>&Revision:</source>
@@ -5970,7 +6543,7 @@
     </message>
     <message>
         <source>Defines the revision number filter. The <i>exact match</i> string format is <tt>IIFF</tt> where <tt>I</tt> is a decimal digit of the integer part and <tt>F</tt> is a decimal digit of the fractional part. An empty string will match any value.</source>
-        <translation>Mendefinisikan penyaring nomor revisi. Format string <i>cocok eksak</i> adalah <tt>IIFF</tt> dimana <tt>I</tt> adalah digit desimal dari bagian integer dan <tt>F</tt> adalah digit desimal dari bagian pecahan. String kosong akan cocok dengan sebarang nilai.</translation>
+        <translation>Mendefinisikan filter nomor revisi. Format string <i>cocok eksak</i> adalah <tt>IIFF</tt> dimana <tt>I</tt> adalah digit desimal dari bagian integer dan <tt>F</tt> adalah digit desimal dari bagian pecahan. String kosong akan cocok dengan sebarang nilai.</translation>
     </message>
     <message>
         <source>&Manufacturer:</source>
@@ -5978,7 +6551,7 @@
     </message>
     <message>
         <source>Defines the manufacturer filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>Mendefinisikan penyaring pabrikan sebagai suatu string <i>cocok eksak</i>. String kosong akan cocok dengan sebarang nilai.</translation>
+        <translation>Mendefinisikan filter pabrikan sebagai suatu string <i>cocok eksak</i>. String kosong akan cocok dengan sebarang nilai.</translation>
     </message>
     <message>
         <source>Pro&duct:</source>
@@ -5986,7 +6559,7 @@
     </message>
     <message>
         <source>Defines the product name filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>Mendefinisikan penyaring nama produk sebagai suatu string <i>cocok eksak</i>. String kosong akan cocok dengan sebarang nilai.</translation>
+        <translation>Mendefinisikan filter nama produk sebagai suatu string <i>cocok eksak</i>. String kosong akan cocok dengan sebarang nilai.</translation>
     </message>
     <message>
         <source>&Serial No.:</source>
@@ -5994,7 +6567,7 @@
     </message>
     <message>
         <source>Defines the serial number filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>Mendefinisikan penyaring nomor seri sebagai suatu string <i>cocok eksak</i>. String kosong akan cocok dengan sebarang nilai.</translation>
+        <translation>Mendefinisikan filter nomor seri sebagai suatu string <i>cocok eksak</i>. String kosong akan cocok dengan sebarang nilai.</translation>
     </message>
     <message>
         <source>Por&t:</source>
@@ -6002,7 +6575,7 @@
     </message>
     <message>
         <source>Defines the host USB port filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>Mendefinisikan penyaring port USB sebagai suatu string <i>cocok eksak</i>. String kosong akan cocok dengan sebarang nilai.</translation>
+        <translation>Mendefinisikan filter port USB sebagai suatu string <i>cocok eksak</i>. String kosong akan cocok dengan sebarang nilai.</translation>
     </message>
     <message>
         <source>R&emote:</source>
@@ -6010,7 +6583,7 @@
     </message>
     <message>
         <source>Defines whether this filter applies to USB devices attached locally to the host computer (<i>No</i>), to a VRDP client's computer (<i>Yes</i>), or both (<i>Any</i>).</source>
-        <translation>Menentukan apakah penyaring ini diterapkan ke device USB yang tersambung secara lokal ke komputer host (<i>Tidak</i>), ke klien VRDP komputer (<i>Ya</i>), atau keduanya (<i>Apa saja</a>).</translation>
+        <translation>Menentukan apakah filter ini diterapkan ke device USB yang tersambung secara lokal ke komputer host (<i>Tidak</i>), ke klien VRDP komputer (<i>Ya</i>), atau keduanya (<i>Apa saja</a>).</translation>
     </message>
     <message>
         <source>&Action:</source>
@@ -6022,36 +6595,36 @@
     </message>
     <message>
         <source>USB Filter Details</source>
-        <translation>Rincian Penyaring USB</translation>
+        <translation>Rincian Filter USB</translation>
     </message>
 </context>
 <context>
     <name>UIMachineWindow</name>
     <message>
         <source> EXPERIMENTAL build %1r%2 - %3</source>
-        <translation> build EKSPERIMEN %1r%2 - %3</translation>
+        <translation type="unfinished"> build EXPERIMENTAL %1r%2 - %3</translation>
     </message>
 </context>
 <context>
     <name>UIMachineWindowNormal</name>
     <message>
         <source>Shows the currently assigned Host key.<br>This key, when pressed alone, toggles the keyboard and mouse capture state. It can also be used in combination with other keys to quickly perform actions from the main menu.</source>
-        <translation>Tunjukkan tombol Host yang sedang ditugaskan.<br>Tombol ini, saat ditekan sendirian, menjungkit keadaan penangkapan papan tik dan tetikus. Ia juga dapat digunakan dalam kombinasi dengan tombol lain untuk melakukan tindakan dari dalam menu utama secara cepat.</translation>
+        <translation>Tunjukkan tombol Host yang sedang ditugaskan.<br>Tombol ini, saat ditekan sendirian, menjungkit keadaan penangkapan keyboard dan mouse. Ia juga dapat digunakan dalam kombinasi dengan kunci lain untuk melakukan tindakan dari dalam menu utama secara cepat.</translation>
     </message>
 </context>
 <context>
     <name>UIMediumManager</name>
     <message>
         <source>&Hard drives</source>
-        <translation>&Hard disk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Optical disks</source>
-        <translation>Cakram &optik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Floppy disks</source>
-        <translation>Cakram &floppy</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Select</source>
@@ -6059,7 +6632,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Tutup</translation>
+        <translation type="obsolete">&Tutup</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6070,11 +6647,34 @@
     </message>
     <message>
         <source><p>You are about to change the settings of the disk image file <b>%1</b>.</p><p>Please choose one of the following modes and press <b>%2</b> to proceed or <b>%3</b> otherwise.</p></source>
-        <translation><b>Anda akan mengubah pengaturan berkas image disk <b>%1</b>.</p><p>Harap pilih satu dari mode berikut dan tekan <b>%2</b> untuk melanjutkan atau <b>%3</b> bila tidak.</p></translation>
+        <translation></translation>
     </message>
     <message>
         <source>Choose mode:</source>
-        <translation>Pilih mode:</translation>
+        <translation>Pilih tipe medium:</translation>
+    </message>
+</context>
+<context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Tutup</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Beralih</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6119,7 +6719,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Gagal menciptakan obyek COM VirtualBox.</p><p>Aplikasi sekarang akan ditutup.</p></translation>
+        <translation type="obsolete"><p>Gagal menciptakan obyek COM VirtualBox.</p><p>Aplikasi sekarang akan ditutup.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -6299,7 +6899,7 @@
     </message>
     <message>
         <source>Failed to create the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.</source>
-        <translation>Gagal menciptakan sebuah folder bersama <b>%1</b> (menunjuk pada <nobr><b>%2</b></nobr>) bagi mesin virtual <b>%3</b>.</translation>
+        <translation>Gagal menciptakan sebuah folder yang dishare <b>%1</b> (menunjuk pada <nobr><b>%2</b></nobr>) bagi mesin virtual <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</source>
@@ -6392,16 +6992,16 @@
         <translation type="obsolete"><p>Tidak dapat memuat file bahasa <b><nobr>%1</nobr></b>. <p>Bahasa akan sementara di-reset pada bahasa Inggris (built-in). Silahkan melihat dialog <b>Preferensi</b> yang dapat anda buka dari menu <b>File</b> pada jendela utama VirtualBox , dan pilih satu dari bahasa yang tersedia pada halaman, <b>Bahasa</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
-        <translation type="obsolete"><p>VirtualBox Guest Additions terinstall pada Sistem Operasi Guest terlalu tua: versi terinstall adalah %1, versi yang diharapkan adalah %2. Beberapa fitur yang membutuhkan Guest Additions (integrasi mouse, auto-resize tampilan guest) sangat mungkin tidak bekerja dengan semestinya.</p><p>Silahkan update the Guest Additions pada versi saat ini dengan memilih <b>Insert Guest Additions CD image</b> dari menu <b>Device& [...]
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>VirtualBox Guest Additions terinstall pada Sistem Operasi Guest terlalu tua: versi terinstall adalah %1, versi yang diharapkan adalah %2. Beberapa fitur yang membutuhkan Guest Additions (integrasi mouse, auto-resize tampilan guest) sangat mungkin tidak bekerja dengan semestinya.</p><p>Silahkan update the Guest Additions pada versi saat ini dengan memilih <b>Install Guest Additions</b> dari menu <b>Device</b&gt [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
-        <translation type="obsolete"><p>VirtualBox Guest Additions terinstall pada Sistem Operasi Guest terlalu tua: versi terinstall adalah %1, versi yang diharapkan adalah %2. Beberapa fitur yang membutuhkan Guest Additions (integrasi mouse, auto-resize tampilan guest) sangat mungkin tidak bekerja dengan semestinya.</p><p>Anda dianjurkan meng-update the Guest Additions pada versi saat ini  dengan memilih <b>Insert Guest Additions CD image</b> dari menu &lt [...]
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>VirtualBox Guest Additions terinstall pada Sistem Operasi Guest terlalu tua: versi terinstall adalah %1, versi yang diharapkan adalah %2. Beberapa fitur yang membutuhkan Guest Additions (integrasi mouse, auto-resize tampilan guest) sangat mungkin tidak bekerja dengan semestinya.</p><p>Anda dianjurkan meng-update the Guest Additions pada versi saat ini  dengan memilih <b>Install Guest Additions</b> dari menu <b>De [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
-        <translation type="obsolete"><p>VirtualBox Guest Additions terinstall pada Sistem Operasi Guest terlalu baru: versi terinstall adalah %1, versi yang diharapkan adalah %2.</p><p>Menggunakan versi Additions pada versi lebih lama tidak didukung. Anda dianjurkan meng-update the Guest Additions pada versi saat ini  dengan memilih <b>Insert Guest Additions CD image</b> dari menu <b>Device</b>.</p></translation>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>VirtualBox Guest Additions terinstall pada Sistem Operasi Guest terlalu baru: versi terinstall adalah %1, versi yang diharapkan adalah %2.</p><p>Menggunakan versi Additions pada versi lebih lama tidak didukung. Anda dianjurkan meng-update the Guest Additions pada versi saat ini  dengan memilih <b>Install Guest Additions</b> dari menu <b>Device</b>.</p></translation>
     </message>
     <message>
         <source>Failed to change the snapshot folder path of the virtual machine <b>%1<b> to <nobr><b>%2</b></nobr>.</source>
@@ -6444,8 +7044,8 @@
         <translation type="obsolete"><p>Jendela mesin virtual dioptimalkan untuk bekerja pada mode warna <b>%1&nbsp;bit</b> tapi kualitas warna tampilan virtual saat ini di-set pada <b>%2&nbsp;bit</b>.</p><p>Silahkan buka dialog properti tampilan pada Sistem Operasi guest dan pilih sebuah mode warna <b>%3&nbsp;bit</b>, bila tersedia, untuk performa terbaik yang memungkinkan pada subsistem video virtual.</p><p>& [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>Kesalahan kritikal telah terjadi saat menjalankan mesin virtual dan eksekusi mesin telah dihentikan.</p><p>Untuk bantuan, silahkan kunjungi bagian Community (Komunitas) <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> atau kontrak pendukung anda. Mohon sediakan isi dari file log file <tt>VBox.log</tt> dan file image <tt>VBox.png</tt>, yang dapat anda temukan pada direktori <n [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Kesalahan kritikal telah terjadi saat menjalankan mesin virtual dan eksekusi mesin telah dihentikan.</p><p>Untuk bantuan, silahkan kunjungi bagian Community (Komunitas) <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> atau kontrak pendukung anda. Mohon sediakan isi dari file log file <tt>VBox.log</tt> dan file image <tt>VBox.png</tt>, yang dapat anda temukan pada direktori <nob [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
@@ -6552,9 +7152,9 @@
         <translation type="obsolete">Download</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Pasang</translation>
+        <translation type="obsolete">Pasang</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6573,7 +7173,7 @@
     <message>
         <source>Check</source>
         <comment>inaccessible media message box</comment>
-        <translation>Periksa</translation>
+        <translation>Cek</translation>
     </message>
     <message>
         <source><p>The following VirtualBox settings files have been automatically converted to the new settings file format version <b>%1</b>.</p><p>However, the results of the conversion were not saved back to disk yet. Please press:</p><ul><li><b>Save</b> to save all auto-converted files now (it will not be possible to use these settings files with an older version of VirtualBox in the future);</li><li><b>Ba [...]
@@ -6722,8 +7322,8 @@
         <translation type="obsolete">Tunjukkan dialog dengan informasi produk</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Sebuah versi baru VirtualBox telah dirlis! Versi <b>%1</b> tersedia di <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Anda dapat mendownload versi ini memakai taut:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Sebuah versi baru VirtualBox telah dirlis! Versi <b>%1</b> tersedia di <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Anda dapat mendownload versi ini memakai taut:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6799,7 +7399,7 @@
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Satu atau lebih hard disk virtual, CD/DVD, atau media floppy kini tak dapat diakses. Akibatnya, Anda tak akan bisa mengoperasikan mesin virtual yang memakai media tersebut sampai mereka menjadi bisa diakses nanti.</p><p>Tekan <b>Periksa</b> untuk membuka window Manajer Media Virtual dan melihat media apa yang tak dapat diakses, atau tekan <b>Abaikan</b> untuk mengabaikan pesan ini.</p></translation>
+        <translation type="obsolete"><p>Satu atau lebih hard disk virtual, CD/DVD, atau media floppy kini tak dapat diakses. Akibatnya, Anda tak akan bisa mengoperasikan mesin virtual yang memakai media tersebut sampai mereka menjadi bisa diakses nanti.</p><p>Tekan <b>Periksa</b> untuk membuka window Manajer Media Virtual dan melihat media apa yang tak dapat diakses, atau tekan <b>Abaikan</b> untuk mengabaikan pesan ini.</p></translation>
     </message>
     <message>
         <source>E&xit</source>
@@ -6807,8 +7407,8 @@
         <translation type="obsolete">&Keluar</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Kesalahan kritikal telah terjadi saat menjalankan mesin virtual dan eksekusi mesin telah dihentikan.</p><p>Untuk bantuan, silakan kunjungi bagian Community pada <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> atau kontrak pendukung Anda. Mohon sediakan isi dari file log <tt>VBox.log</tt> dan file image <tt>VBox.png</tt>, yang dapat Anda temukan pada direktori <nobr><b>%1</b>& [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Kesalahan kritikal telah terjadi saat menjalankan mesin virtual dan eksekusi mesin telah dihentikan.</p><p>Untuk bantuan, silakan kunjungi bagian Community pada <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> atau kontrak pendukung Anda. Mohon sediakan isi dari file log <tt>VBox.log</tt> dan file image <tt>VBox.png</tt>, yang dapat Anda temukan pada direktori <nobr><b&gt [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7029,7 +7629,7 @@
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Apakah Anda yakin hendak menghapus device CD/DVD?</p><p>Anda tak akan bisa me-mount image CD atau ISO atau menginstall Guest Addition tanpanya!</p></translation>
+        <translation type="obsolete"><p>Apakah Anda yakin hendak menghapus device CD/DVD?</p><p>Anda tak akan bisa me-mount image CD atau ISO atau menginstall Guest Addition tanpanya!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7102,7 +7702,8 @@
     </message>
     <message>
         <source>Delete all files</source>
-        <translation>Hapus semua berkas</translation>
+        <translatorcomment>Hapus semua file</translatorcomment>
+        <translation></translation>
     </message>
     <message>
         <source>Remove only</source>
@@ -7132,7 +7733,7 @@
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Anda akan menambahkan sebuah drive CD/DVD baru ke pengendali <b>%1</b>.</p><p>Apakah Anda ingin memilih suatu disk CD/DVD virtual untuk diletakkan di dalam drive atau membiarkannya kosong untuk saat ini?</p></translation>
+        <translation type="obsolete"><p>Anda akan menambahkan sebuah drive CD/DVD baru ke pengendali <b>%1</b>.</p><p>Apakah Anda ingin memilih suatu disk CD/DVD virtual untuk diletakkan di dalam drive atau membiarkannya kosong untuk saat ini?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7154,11 +7755,11 @@
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Gagal mencopot device CD/DVD (<nobr><b>%1</b></nobr>) dari slot <i>%2</i> mesin <b>%3</b>.</translation>
+        <translation type="obsolete">Gagal mencopot device CD/DVD (<nobr><b>%1</b></nobr>) dari slot <i>%2</i> mesin <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Gagal mencopot device floppy (<nobr><b>%1</b></nobr>) dari slot <i>%2</i> mesin <b>%3</b>.</translation>
+        <translation type="obsolete">Gagal mencopot device floppy (<nobr><b>%1</b></nobr>) dari slot <i>%2</i> mesin <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
@@ -7190,23 +7791,24 @@
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Gagal mencantol device CD/DVD (<nobr><b>%1</b></nobr>) ke slot <i>%2</i> mesin <b>%3</b>.</translation>
+        <translation type="obsolete">Gagal mencantol device CD/DVD (<nobr><b>%1</b></nobr>) ke slot <i>%2</i> mesin <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Gagal mencantol device floppy (<nobr><b>%1</b></nobr>) ke slot <i>%2</i> mesin <b>%3</b>.</translation>
+        <translation type="obsolete">Gagal mencantol device floppy (<nobr><b>%1</b></nobr>) ke slot <i>%2</i> mesin <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Perhatikan bahwa unit penyimpanan medium ini tidak akan dihapus dan dapat dipakai lagi nanti.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>VirtualBox Guest Addition sepertinya tak tak tersedia pada mesin virtual ini, dan folder shared tak dapat dipakai tanpanya. Untuk memakai shared folder di dalam mesin virtual, silakan install Guest Addition bila belum dipasang, atau install ulang bila tidak bekerja dengan benar, dengan memilih <b>Install Guest Addition</b> dari menu <b>Device</b>. Bila sudah dipasang tapi mesin belum dimulai secara penuh maka shared folder akan tersed [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>VirtualBox Guest Addition sepertinya tak tak tersedia pada mesin virtual ini, dan folder shared tak dapat dipakai tanpanya. Untuk memakai shared folder di dalam mesin virtual, silakan install Guest Addition bila belum dipasang, atau install ulang bila tidak bekerja dengan benar, dengan memilih <b>Install Guest Addition</b> dari menu <b>Device</b>. Bila sudah dipasang tapi mesin belum dimulai secara penuh maka shared fo [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
-        <translation><p>Jendela mesin virtual akan ditukar ke mode <b>layar penuh</b>. Anda dapat kembali ke mode windowed kapanpun dengan menekan <b>%1</b>.</p><p>Perhatikan bahwa tombol <i>Host</i> kini didefinisikan sebagai <b>%2</b>.</p><p>Perhatikan bahwa bilah menu utama tersembunyi dalam mode layar penuh. Anda dapat mengaksesnya dengan menekan <b>Host+Home</b>.</p></translation>
+        <translatorcomment><p>Window mesin virtual akan ditukar ke mode <b>Fullscreen</b>. Anda dapat kembali ke mode windowed kapanpun dengan menekan <b>%1</b>.</p><p>Perhatikan bahwa tombol <i>Host</i> kini didefinisikan sebagai <b>%2</b>.</p><p>Perhatikan bahwa bar manu utama tersembunyi dalam mode fullscreen. Anda dapat mengaksesnya dengan menekan <b>Host+Home</b>.</p></translatorcomment>
+        <translation></translation>
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>Seamless</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in seamless mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -7397,101 +7999,97 @@
     </message>
     <message>
         <source><p>Failed to initialize COM because the VirtualBox global configuration directory <b><nobr>%1</nobr></b> is not accessible. Please check the permissions of this directory and of its parent directory.</p><p>The application will now terminate.</p></source>
-        <translation><p>Gagal menginisiasi COM karena direktori konfigurasi global VirtualBox <b><nobr>%1</nobr></b> tidak dapat diakses. Harap periksa ijin direktori ini dan direktori induknya.</p><p>Aplikasi kini akan berakhir.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are about to remove following virtual machine items from the machine list:</p><p><b>%1</b></p><p>Do you wish to proceed?</p></source>
-        <translation><p>Anda akan menghapus butir mesin virtual berikut dari daftar mesin:</p><p><b>%1</b></p><p>Apakah Anda hendak melanjutkan?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are about to remove following inaccessible virtual machines from the machine list:</p><p>%1</p><p>Do you wish to proceed?</p></source>
-        <translation><p>Anda akan menghapus mesin virtual berikut yang tidak bisa diakses dari daftar mesin:</p><p><b>%1</b></p><p>Apakah Anda hendak melanjutkan?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well? Doing this will also remove the files containing the machine's virtual hard disks if they are not in use by another machine.</p></source>
-        <translation><p>Anda akan menghapus mesin virtual berikut dari daftar mesin:</p><p><b>%1</b></p><p>Apakah Anda juga hendak menghapus berkas yang memuat mesin virtual dari hard disk Anda? Melakukan ini juga akan menghapus berkas yang memuat hard disk virtual mesin bila mereka tidak dipakai oleh mesin lain.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p></source>
-        <translation><p>Anda akan menghapus mesin virtual berikut dari daftar mesin:</p><p><b>%1</b></p><p>Apakah Anda juga hendak menghapus berkas yang memuat mesin virtual dari hard disk Anda?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Do you wish to cancel all current network operations?</source>
-        <translation>Apakah Anda hendak membatalkan semua operasi jaringan saat ini?</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>ACPI Shutdown</source>
         <comment>machine</comment>
-        <translation>ACPI Shutdown</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power Off</source>
         <comment>machine</comment>
-        <translation>Matikan Daya</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p><p>Please check that this folder really exists and that you have permissions to remove it.</p></source>
-        <translation><p>Tidak bisa menghapus folder mesin <nobr><b>%1</b>.</nobr></p><p>Harap periksa apakah folder memang benar ada dan Anda memiliki hak untuk menghapusnya.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p></source>
-        <translation><p>Tidak bisa membuat folder mesin <b>%1</b> dalam folder induk <nobr><b>%2</b>.</nobr></p><p>Folder ini telah ada dan mungkin milik mesin lain.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>You are about to create a new virtual machine without a hard drive. You will not be able to install an operating system on the machine until you add one. In the mean time you will only be able to start the machine using a virtual optical disk or from the network.</source>
-        <translation>Anda hendak membuat suatu mesin virtual baru tanpa hard disk. Anda tidak akan bisa memasang sistem operasi pada mesin sampai Anda menambahkannya. Sementara waktu Anda hanya akan bisa memulai mesin memakai disk optik virtual atau dari jaringan.</translation>
-    </message>
-    <message>
-        <source>Failed to drop data.</source>
-        <translation>Gagal menjatuhkan data.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
-        <translation><p>Apakah Anda yakin ingin membuang keadaan tersimpan dari mesin virtual berikut? </p><p><b>%1</b></p><p>Tindakan ini setara dengan me-reset atau mematikan daya mesin tanpa melakukan shutdown yang benar pada OS guest.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Do you really want to reset the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
-        <translation><p>Apakah Anda benar-benar ingin me-reset mesin virtual berikut?</p><p><b>%1</b></p><p>Ini akan menyebabkan data yang belum disimpan pada aplikasi yang sedang berjalan di dalamnya hilang.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Do you really want to send an ACPI shutdown signal to the following virtual machines?</p><p><b>%1</b></p></source>
-        <translation><p>Apakah Anda benar-benar ingin mengirim sinyal shutdown ACPI ke mesin virtual berikut?</p><p><b>%1</b></p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Do you really want to power off the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
-        <translation><p>Apakah Anda benar-benar ingin mematikan daya mesin virtual berikut?</p><p><b>%1</b></p><p>Ini akan menyebabkan data yang belum disimpan pada aplikasi yang sedang berjalan di dalamnya hilang.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are trying to move machine <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p><p>Please resolve this name-conflict and try again.</p></source>
-        <translation><p>Anda mencoba memindah mesin <nobr><b>%1</b></nobr>ke grup <nobr><b>%2</b></nobr> yang telah memiliki sub grup <nobr><b>%1</b></nobr>.</p><p>Harap selesaikan konflik nama ini dan mencoba lagi.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are trying to move group <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p><p>Would you like to automatically rename it?</p></source>
-        <translation><p>Anda mencoba memindah grup <nobr><b>%1</b></nobr>ke grup <nobr><b>%2</b></nobr> yang telah memiliki butir lain dengan nama yang sama.</p><p>Apakah Anda ingin mengubah namanya secara otomatis?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Rename</source>
-        <translation>Ubah nama</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p><p>You can create a snapshot of the current state of the virtual machine first by checking the box below; if you do not do this the current state will be permanently lost. Do you wish to proceed?</p></source>
-        <translation><p>Anda akan mengembalikan snapshot <nobr><b>%1</b></nobr>.</p><p>Anda dapat terlebih dahulu mencipta sebuah snapshot dari keadaan mesin virtual saat ini dengan mencontreng kotak di bawah, bila Anda tidak melakukan ini maka keadaan sekarang akan hilang selamanya. Apakah Anda hendak melanjutkan?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p></source>
-        <translation><p>Apakah Anda yakin hendak mengembalikan snapshot <nobr><b>%1</b></nobr>?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to set groups of the virtual machine <b>%1</b>.</source>
-        <translation>Gagal menata grup mesin virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not start the machine <b>%1</b> because the following physical network interfaces were not found:</p><p><b>%2</b></p><p>You can either change the machine's network settings or stop the machine.</p></source>
-        <translation><p>Tidak bisa memulai mesin <b>%1</b> karena antar muka jaringan fisik berikut tidak ditemukan:</p><p><b>%2</b></p><p>Anda bisa mengubah pengaturan jaringan mesin atau menghentikan mesin.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Change Network Settings</source>
-        <translation>Ubah Pengaturan Jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Close Virtual Machine</source>
@@ -7499,240 +8097,327 @@
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>Tidak dapat menjalankan Manajer karena restriksi lokal.</p><p>Aplikasi akan diakhiri sekarang.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>Tidak dapat menemukan berkas bahasa untuk bahasa <b>%1</b> dalam direktori <b><nobr>%2</nobr></b>.</p><p>Bahasa akan sementara di-reset ke bahasa baku sistem. Silakan ke jendela <b>Preferensi</b> yang dapat Anda buka dari menu <b>Berkas</b> di jendela Manajer VirtualBox , dan pilih satu dari bahasa yang tersedia pada halaman <b>Bahasa</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>Tidak dapat memuat berkas bahasa <b><nobr>%1</nobr></b>. <p>Bahasa akan sementara di-reset pada bahasa Inggris (bawaan). Silakan ke jendela <b>Preferensi</b> yang dapat Anda buka dari menu <b>Berkas</b> di jendela Manajer VirtualBox , dan pilih satu dari bahasa yang tersedia pada halaman <b>Bahasa</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation>Tidak ada mesin virtual dengan identifier <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation>Abaikan</translation>
+        <translation type="unfinished">Abaikan</translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation>Gagal menciptakan jaringan NAT.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>Gagal menghapus jaringan NAT <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation>Gagal menciptakan server DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>Gagal menghapus server DHCP untuk antar muka jaringan <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>Gagal menciptakan antarmuka jaringan host.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>Ciptaka&n disk baru</translation>
+        <translation type="unfinished">Ciptakan disk &baru</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>&Pilih disk yang telah ada</translation>
+        <translation type="unfinished">&Pilih disk yang telah ada</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation>Biarkan &kosong</translation>
+        <translation type="unfinished">Biarkan &kosong</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>&Pilih disk</translation>
+        <translation type="unfinished">&Pilih disk</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Apakah Anda yakin hendak merilis hard disk virtual<nobr><b>%1</b></nobr>?</p><p>Ini akan melepaskannya dari mesin virtual berikut: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Apakah Anda yakin hendak merilis disk optik virtual<nobr><b>%1</b></nobr>?</p><p>Ini akan melepaskannya dari mesin virtual berikut: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Apakah Anda yakin hendak merilis disk floppy virtual<nobr><b>%1</b></nobr>?</p><p>Ini akan melepaskannya dari mesin virtual berikut: <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Apakah Anda yakin hendak menghapus hard disk virtual <nobr><b>%1</b></nobr> dari daftar berkas image disk yang dikenal?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation><p>Karena hard disk ini tidak dapat diakses, berkas imagenya tak dapat dihapus.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Apakah Anda yakin hendak menghapus disk optik virtual <nobr><b>%1</b></nobr> dari daftar berkas image disk yang dikenal?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Apakah Anda yakin hendak menghapus disk floppy virtual <nobr><b>%1</b></nobr> dari daftar berkas image disk yang dikenal?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Tidak bisa memasang disk optik virtual <nobr><b>%1</b></nobr> ke dalam mesin <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation><p>Apakah Anda hendak memaksa pemasangan disk ini?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Tidak bisa mengeluarkan disk optik virtual <nobr><b>%1</b></nobr> dari mesin <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation><p>Apakah Anda hendak memaksa mengeluarkan disk ini?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Tidak bisa memasang disk floppy virtual <nobr><b>%1</b></nobr> ke dalam mesin <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Tidak bisa mengeluarkan disk floppy virtual <nobr><b>%1</b></nobr> dari mesin <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Gagal membuka berkas hard disk <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Gagal membuka berkas disk optik <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Gagal membuka berkas disk floppy <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Gagal menutup berkas hard disk <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Gagal menutup berkas disk optik <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Gagal menutup berkas disk floppy <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation>
+        <translation type="unfinished">
             <numerusform><p>%n mesin virtual berikut kini dalam keadaan disimpan: <b>%1</b></p><p>Bila Anda meneruskan, keadaan runtime dari mesin yang diekspor akan dibuang. Mesin lain tidak akan diubah.</p></numerusform>
         </translation>
     </message>
     <message>
         <source>Switch</source>
-        <translation>Beralih</translation>
+        <translation type="unfinished">Beralih</translation>
     </message>
     <message>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>Gagal memfungsikan server desktop jarak jauh bagi mesin virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>Gagal menonaktifkan server desktop jarak jauh bagi mesin virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>Gagal memfungsikan penangkapan video bagi mesin virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>Gagal menonaktifkan penangkapan video bagi mesin virtual <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>Tidak bisa menemukan berkas image disk <b>VirtualBox Guest Additions</b>.</p><p>Apakah Anda hendak mengunduh berkas ini dari Internet?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Download</source>
-        <translation>Unduh</translation>
+        <translation type="unfinished">Download</translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Apakah Anda yakin hendak mengunduh berkas image disk <b>VirtualBox Guest Additions</b> dari <nobr><a href="%1">%1</a></nobr> (ukuran %2 byte)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>Berkas image disk <b>VirtualBox Guest Additions</b> telah sukses diunduh dari <nobr><a href="%1">%1</a></nobr> tapi tidak dapat disimpan secara lokal sebagai <nobr><b>%2</b>.</nobr></p><p>Harap pilih lokasi lain bagi berkas itu.</p></translation>
-    </message>
-    <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>Berkas image disk <b>VirtualBox Guest Additions</b> telah sukses diunduh dari <nobr><a href="%1">%1</a></nobr> dan disimpan secara lokal sebagai <nobr><b>%2</b>.</nobr></p><p>Apakah Anda ingin mendaftarkan berkas image disk ini dan memasangnya pada drive CD/DVD virtual?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><b>Tak bisa menyisipkan berkas image disk <b>VirtualBox Guest Additions</b> ke dalam mesin virtual <b>%1</b>, karena mesin tak memiliki drive CD/DVD. Silakan tambahkan sebuah drive memakai halaman penyimpanan dari dialog pengaturan mesin virtual.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation><p>Tidak bisa menemukan <b>Manual Pengguna VirtualBox</b> <nobr><b>%1</b>.</nobr></p><p>Apakah Anda hendak mengunduh berkas ini dari Internet?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Apakah Anda yakin hendak mengunduh <b>Manual Pengguna VirtualBox</b> dari <nobr><a href="%1">%1</a></nobr> (ukuran %2 byte)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>Manual Pengguna VirtualBox telah sukses diunduh dari <nobr><a href="%1">%1</a></nobr> namun tidak dapat disimpan secara lokal sebagai <nobr><b>%2</b>.</nobr></p><p>Silakan pilih lokasi lain bagi berkas itu.</p></translation>
+        <translation type="unfinished"><p>Manual Pengguna VirtualBox telah sukses didownload dari <nobr><a href="%1">%2</a></nobr> namu tak dapat disimpan secara lokal sebagai <nobr><b>%3</b>.</nobr></p><p>Silakan pilih lokasi lain bagi file itu.</p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>Manual Pengguna VirtualBox telah sukses diunduh dari <nobr><a href="%1">%1</a></nobr> dan disimpan secara lokal sebagai <nobr><b>%2</b>.</nobr></p></translation>
+        <translation type="unfinished"><p>Manual Pengguna VirtualBox telah sukses didownload dari <nobr><a href="%1">%2</a></nobr> dan disimpan secara lokal sebagai <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Tutup</translation>
+    </message>
+    <message>
+        <source>Ok</source>
+        <translation type="unfinished">Ok</translation>
+    </message>
+    <message>
+        <source>Do not show this message again</source>
+        <translation type="unfinished">Jangan tampilkan pesan ini lagi</translation>
+    </message>
+    <message>
+        <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Insert</source>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Close</source>
-        <translation>Tutup</translation>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ok</source>
-        <translation>Ok</translation>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Do not show this message again</source>
-        <translation>Jangan tampilkan pesan ini lagi</translation>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>Apakah Anda hendak menghapus jaringan NAT <nobr><b>%1</b>?</nobr></p><p>Bila jaringan ini sedang dipakai oleh adaptor jaringan satu mesin virtual atau lebih, adaptor tersebut tidak akan dapat dipakai lagi sampai Anda memperbaiki pengaturan mereka dengan memilih nama jaringan lain atau tipe pencantolan adaptor yang berbeda.</p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>VirtualBox Guest Addition sepertinya tak tak tersedia pada mesin virtual ini, dan folder shared tak dapat dipakai tanpanya. Untuk memakai shared folder di dalam mesin virtual, silakan install Guest Addition bila belum dipasang, atau install ulang bila tidak bekerja dengan benar, dengan memilih <b>Install Guest Addition</b> dari menu <b>Device</b>. Bila sudah dipasang tapi mesin belum dimulai secara penuh maka shared fo [...]
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Pasang</translation>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Gagal menghubungkan webcam <b>%1</b> ke mesin virtual <b>%2</b>.</translation>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Gagal melepas webcam <b>%1</b> dari mesin virtual <b>%2</b>.</translation>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>Layar virtual saat ini ditata ke mode warna <b>%1&nbsp;bit</b>. Untuk kinerja yang lebih baik silakan mengubah ini menjadi <b>%2&nbsp;bit</b>. Biasanya ini dapat dilakukan dari bagian <b>Tampilan</b> dari Panel Kendali atau Pengaturan Sistem sistem operasi guest.</p></translation>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7795,19 +8480,19 @@
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation>Selalu tampilkan bilah alat</translation>
+        <translation type="unfinished">Selalu tampilkan toolbar</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation>Minimalkan Jendela</translation>
+        <translation type="unfinished">Minimalkan Window</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Keluar Mode Layar Penuh atau Seamless</translation>
+        <translation type="unfinished">Keluar Mode Fullscreen atau Seamless</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation>Tutup VM</translation>
+        <translation type="unfinished">Tutup VM</translation>
     </message>
 </context>
 <context>
@@ -7824,110 +8509,110 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
-        <translation>&Nama:</translation>
+        <source>N&ame:</source>
+        <translation type="unfinished">&Nama:</translation>
     </message>
     <message>
         <source>Holds the name of the virtual machine.</source>
-        <translation>Menyimpan nama dari mesin virtual.</translation>
+        <translation type="unfinished">Tampilkan nama dari mesin virtual.</translation>
     </message>
     <message>
         <source>&Type:</source>
-        <translation>&Tipe:</translation>
+        <translation type="unfinished">&Tipe:</translation>
     </message>
     <message>
         <source>Selects the operating system family that you plan to install into this virtual machine.</source>
-        <translation>Pilih keluarga sistem operasi yang Anda rencanakan untuk dipasang ke mesin virtual ini.</translation>
+        <translation type="unfinished">Tampilkan keluarga sistem operasi yang Anda rencanakan untuk diinstal ke mesin virtual ini.</translation>
     </message>
     <message>
         <source>&Version:</source>
-        <translation>&Versi:</translation>
+        <translation type="unfinished">&Versi:</translation>
     </message>
     <message>
         <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation>Pilih tipe sistem operasi yang Anda rencanakan untuk dipasang ke mesin virtual ini (dikenal sebagai sistem operasi guest).</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UINetworkManagerDialog</name>
     <message>
         <source>Network Operations Manager</source>
-        <translation>Manajer Operasi Jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are no active network operations.</source>
-        <translation>Tidak ada operasi jaringan yang aktif.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Cancel All</source>
-        <translation>&Batalkan Semua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Cancel all active network operations</source>
-        <translation>Batalkan semua operasi jaringan yang aktif</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Operation</source>
-        <translation>Operasi Jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Restart network operation</source>
-        <translation>Start ulang operasi jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Cancel network operation</source>
-        <translation>Batalkan operasi jaringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation>Operasi jaringan gagal dengan kesalahan berikut: %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UINetworkManagerIndicator</name>
     <message>
         <source>Current network operations:</source>
-        <translation>Operasi jaringan saat ini:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>failed</source>
         <comment>network operation</comment>
-        <translation>gagal</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>(%1 of %2)</source>
-        <translation>(%1 dari %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Double-click for more information.</source>
-        <translation>Klik ganda untuk informasi lebih banyak.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation>Host tidak ditemukan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation>Akses kontek ditolak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation>Kegagalan protokol</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>Format sertifikat SSL salah</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>Otentikasi SSL gagal</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>Alasan tidak diketahui</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8629,7 +9314,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>Klik untuk rincian lengkap</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8692,28 +9377,32 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     <name>UISelectorWindow</name>
     <message>
         <source>Show Toolbar</source>
-        <translation>Tampilkan Bilah Alat</translation>
+        <translation type="unfinished">Tampilkan Toolbar</translation>
     </message>
     <message>
         <source>Show Statusbar</source>
-        <translation>Tampilkan Bilah Status</translation>
+        <translation type="unfinished">Tampilkan Statusbar</translation>
     </message>
     <message>
         <source>Select a virtual machine file</source>
-        <translation>Pilih suatu berkas mesin virtual</translation>
+        <translation type="unfinished">Pilih suatu file mesin virtual</translation>
     </message>
     <message>
         <source>Virtual machine files (%1)</source>
-        <translation>Berkas mesin virtual (%1)</translation>
+        <translation type="unfinished">File mesin virtual (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Selamat datang di VirtualBox!</h3><p>Bagian kiri dari jendela ini adalah daftar dari semua mesin virtual dalam komputer Anda. Daftar ini saat ini kosong karena Anda belum menciptakan mesin virtual apapun.<img src=:/welcome.png align=right/></p><p>Untuk menciptakan mesin virtual baru, tekan tombol <b>Baru</b> pada bilah alat utama yang terletak di bagian atas jendela.</p><p>Anda dapat menekan tombol <b [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Selamat datang di VirtualBox!</h3><p>Bagian kiri dari jendela ini ditujukan untuk menampilkan daftar dari semua mesin virtual dalam komputer Anda. Daftar ini saat ini kosong karena Anda belum menciptakan mesin virtual apapun.<img src=:/welcome.png align=right/></p><p>Untuk menciptakan mesin virtual baru, tekan tombol <b>Baru</b> pada toolbar utama yang terletak di bagian atas jendela.</p><p& [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
-        <translation>Manajer</translation>
+        <translation type="unfinished">- Manajer</translation>
+    </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8724,14 +9413,14 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Updating Guest Additions</source>
-        <translation>Memutakhirkan Guest Additions</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UISettingsDialog</name>
     <message>
         <source><i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information.</i></source>
-        <translation><i>Pilih kategori pengaturan dari daftar pada sisi kiri dan gerakkan tetikus di atas sebuah butir pengaturan untuk memperoleh informasi tambahan.</i></translation>
+        <translation><i>Pilih kategori setting dari daftar pada sisi kiri dan gerakkan mouse di atas sebuah pilihan setting untuk memperoleh informasi tambahan.</i></translation>
     </message>
     <message>
         <source>On the <b>%1</b> page, %2</source>
@@ -8739,7 +9428,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Invalid settings detected</source>
-        <translation>Pengaturan yang tidak valid terdeteksi</translation>
+        <translation>Setting yang tidak valid terdeteksi</translation>
     </message>
     <message>
         <source>Non-optimal settings detected</source>
@@ -8747,15 +9436,15 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Settings</source>
-        <translation>Pengaturan</translation>
+        <translation type="obsolete">Setting</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation>Halaman <b>%1</b>:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation>Halaman <b>%1: %2</b>:</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8770,7 +9459,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Update</source>
-        <translation>Pemutakhiran</translation>
+        <translation>Update</translation>
     </message>
     <message>
         <source>Language</source>
@@ -8798,7 +9487,11 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Display</source>
-        <translation>Tampilan</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8813,7 +9506,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Display</source>
-        <translation>Tampilan</translation>
+        <translation>Display</translation>
     </message>
     <message>
         <source>Storage</source>
@@ -8845,18 +9538,55 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Shared Folders</source>
-        <translation>Folder Bersama</translation>
+        <translation>Folder yang di Share</translation>
     </message>
     <message>
         <source>%1 - %2</source>
         <translation>%1 - %2</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Setting</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Tutup</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
     <message>
         <source>Edit text</source>
-        <translation>Sunting teks</translation>
+        <translation>Edit teks</translation>
     </message>
     <message>
         <source>&Replace...</source>
@@ -8864,7 +9594,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Replaces the current text with the content of a file.</source>
-        <translation>Ganti teks sekarang dengan isi dari suatu berkas.</translation>
+        <translation>Ganti teks sekarang dengan isi dari suatu file.</translation>
     </message>
     <message>
         <source>Text (*.txt);;All (*.*)</source>
@@ -8872,7 +9602,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Select a file to open...</source>
-        <translation>Pilih sebuah berkas untuk dibuka...</translation>
+        <translation>Pilih sebuah file untuk dibuka...</translation>
     </message>
 </context>
 <context>
@@ -8942,7 +9672,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     <name>UIUpdateStepVirtualBox</name>
     <message>
         <source>Checking for a new VirtualBox version...</source>
-        <translation>Memeriksa versi baru VirtualBox...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8957,7 +9687,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation><p>Menyimpan keadaan eksekusi mesin virtual pada hard disk fisik dari PC host.</p><p>Saat berikutnya mesin ini dinyalakan, akan dikembalikan dari keadaan yang tersimpan dan melanjutkan eksekusi dari tempat dimana Anda menyimpannya, yang akan memungkinkan Anda melanjutkan pekerjaan Anda seketika.</p><p>Perhatikan bahwa menyimpan keadaan mesin dapat membutuhkan waktu lama, bergantung pada tipe sistem operasi guest dan banyaknya memori yang [...]
+        <translation><p>Menyimpan keadaan eksekusi mesin virtual pada hard disk fisik dari PC host.</p><p>Saat waktu berikutnya mesin ini dinyalakan, akan dikembalikan dari keadaan yang tersimpan dan melanjutkan eksekusi dari tempat dimana Anda menyimpannya, yang akan memungkinkan Anda melanjutkan pekerjaan Anda seketika.</p><p>Perhatikan bahwa menyimpan keadaan mesin dapat membutuhkan waktu lama, bergantung pada tipe sistem operasi guest dan banyaknya memor [...]
     </message>
     <message>
         <source>&Save the machine state</source>
@@ -8989,7 +9719,15 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>&Restore current snapshot '%1'</source>
-        <translation>&Pulihkan snapshot saat ini '%1'</translation>
+        <translation>&Kembali pada snapshot saat ini '%1'</translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9004,6 +9742,167 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Dialog Informasi Sesi</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">&Tutup</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informasi Sesi</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Detail</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Runtime</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transfer DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transfer PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Data Terbaca</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Data Tertulis</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Data Terkirim</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Data Diterima</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Menyala</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Mati</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Atribut Runtime</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Resolusi Layar</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Statistik CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Statistik Adapter Jaringan</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Tidak terpasang</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Versi %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Tidak Terdeteksi</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Tidak Terdeteksi</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Guest Additions</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Tipe Sistem Operasi Guest</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Statistik Hard Disk</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Tidak Ada Hard Disk</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Tidak Ada Adapter Jaringan</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Menyala</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Mati</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Statistik Penyimpanan</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Tidak Ada Device Penyimpanan</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Statistik Jaringan</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Tidak Tersedia</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -9056,67 +9955,67 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     <name>UIVMLogViewer</name>
     <message>
         <source>Close the search panel</source>
-        <translation>Tutup panel pencarian</translation>
+        <translation type="unfinished">Tutup panel pencarian</translation>
     </message>
     <message>
         <source>&Find</source>
-        <translation>&Cari</translation>
+        <translation type="unfinished">&Cari </translation>
     </message>
     <message>
         <source>Enter a search string here</source>
-        <translation>Masukkan string pencarian di sini</translation>
+        <translation type="unfinished">Masukkan string pencarian disini</translation>
     </message>
     <message>
         <source>&Previous</source>
-        <translation>&Sebelumnya</translation>
+        <translation type="unfinished">&Sebelumnya</translation>
     </message>
     <message>
         <source>Search for the previous occurrence of the string</source>
-        <translation>Cari kemunculan string sebelumnya</translation>
+        <translation type="unfinished">Cari dari string kejadian sebelumnya</translation>
     </message>
     <message>
         <source>&Next</source>
-        <translation>Sela&njutnya</translation>
+        <translation type="unfinished">La&njut</translation>
     </message>
     <message>
         <source>Search for the next occurrence of the string</source>
-        <translation>Cari kemunculan string selanjutnya</translation>
+        <translation type="unfinished">Caru dari string kejadian berikutnya</translation>
     </message>
     <message>
         <source>C&ase Sensitive</source>
-        <translation>Bed&akan Huruf Besar Kecil</translation>
+        <translation type="unfinished">C&ase Sensitive</translation>
     </message>
     <message>
         <source>Perform case sensitive search (when checked)</source>
-        <translation>Lakukan pencarian yang membedakan huruf besar kecil (bila dipilih)</translation>
+        <translation type="unfinished">Lakukan pencarian secara case sensitive (bila dipilih)</translation>
     </message>
     <message>
         <source>String not found</source>
-        <translation>String tidak ditemukan</translation>
+        <translation type="unfinished">String tidak ditemukan</translation>
     </message>
     <message>
         <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
-        <translation><p>Tidak ada file log yang ditemukan. Tekan tombol <b>Segarkan</b> untuk memindai ulang folder log <nobr><b>%1</b></nobr>.</p></translation>
+        <translation type="unfinished"><p>Tidak ada file log ditemukan. Tekan tombol <b>Refresh</b> untuk me-rescan folder log <nobr><b>%1</b></nobr>.</p></translation>
     </message>
     <message>
         <source>Save VirtualBox Log As</source>
-        <translation>Simpan Log VirtualBox Sebagai</translation>
+        <translation type="unfinished">Simpan Log VirtualBox Sebagai</translation>
     </message>
     <message>
         <source>%1 - VirtualBox Log Viewer</source>
-        <translation>%1 -Penilik Log VirtualBox</translation>
+        <translation type="unfinished">%1 -Viewer Log VirtualBox</translation>
     </message>
     <message>
         <source>&Refresh</source>
-        <translation>Sega&rkan</translation>
+        <translation type="unfinished">&Refresh</translation>
     </message>
     <message>
         <source>&Save</source>
-        <translation>&Simpan</translation>
+        <translation type="unfinished">&Simpan</translation>
     </message>
     <message>
         <source>Close</source>
-        <translation>Tutup</translation>
+        <translation type="unfinished">Tutup</translation>
     </message>
 </context>
 <context>
@@ -9153,302 +10052,310 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
-        <translation>Sembunyikan Deskripsi</translation>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
-        <translation>Tampilkan Deskripsi</translation>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardCloneVD</name>
     <message>
         <source>Copy Virtual Hard Drive</source>
-        <translation>Salin Hard Disk Virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Copy</source>
-        <translation>Salin</translation>
+        <translation type="unfinished">Salin</translation>
     </message>
     <message>
         <source>Hard drive to copy</source>
-        <translation>Hard disk yang akan disalin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please select the virtual hard drive file that you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select one.</p></source>
-        <translation><p>Silakan pilih berkas hard disk virtual yang ingin Anda salin bila belum dipilih. Anda dapat memilih dari daftar atau memakai ikon folder di samping daftar untuk memilih salah satu.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual hard drive file to copy...</source>
-        <translation>Pilih file hard disk virtual yang akan disalin...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hard drive file type</source>
-        <translation>Tipe file hard disk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Silakan pilih tipe berkas yang ingin Anda pakai untuk hard disk virtual baru. Bila Anda tak perlu memakainya dengan perangkat lunak virtualisasi lain Anda dapat membiarkan setting ini tak diubah.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Storage on physical hard drive</source>
-        <translation>Penyimpanan pada hard disk fisik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>Silakan pilih apakah berkas hard disk virtual baru mesti berkembang ketika dipakai (dialokasikan secara dinamik) atau mesti diciptakan pada ukuran maksimumnya (ukuran tetap).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
-        <translation><p>Berkas hard disk virtual <b>yang dialokasikan secara dinamik</b> hanya akan memakai ruang pada hard disk fisik Anda ketika terisi (sampai dengan suatu <b>ukuran tetap</b> maksimum), walaupun mereka tak akan mengecil lagi secara otomatis ketika ruang di dalamnya dibebaskan.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
-        <translation><p>Berkas hard disk virtual <b>ukuran tetap</b> mungkin makan waktu lebih lama untuk diciptakan pada beberapa sistem tapi seringkali lebih cepat dipakainya.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
-        <translation><p>Anda juga dapat memilih untuk <b>memecah</b> berkas hard disk virtual ke dalam beberapa berkas yang masing-masing berukuran sampai dengan dua giga byte. Ini terutama berguna bila Anda hendak menyimpan mesin virtual pada perangkat USB lepas pasang atau sistem lama, yang mungkin tak bisa menangani berkas sangat besar.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Dynamically allocated</source>
-        <translation>&Dialokasikan secara dinamis</translation>
+        <translation type="unfinished">&Dialokasikan secara dinamis</translation>
     </message>
     <message>
         <source>&Fixed size</source>
-        <translation>Ukuran &tetap</translation>
+        <translation type="unfinished">Ukuran &tetap</translation>
     </message>
     <message>
         <source>&Split into files of less than 2GB</source>
-        <translation>&Pecah ke dalam file kurang dari 2GB</translation>
+        <translation type="unfinished">&Pecah ke dalam file kurang dari 2GB</translation>
     </message>
     <message>
         <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Silakah pilih lokasi untuk berkas hard disk virtual baru</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New hard drive to create</source>
-        <translation>Hard disk baru yang akan dibuat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
-        <translation>Silakan ketik nama berkas hard disk virtual baru ke kotak di bawah atau klik pada ikon folder untuk memilih folder lain tempat mencipta berkas.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a location for new virtual hard drive file...</source>
-        <translation>Pilih lokasi untuk berkas hard disk virtual baru...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1_copy</source>
         <comment>copied virtual hard drive name</comment>
-        <translation>salinan_%1</translation>
+        <translation type="unfinished">salinan_%1</translation>
     </message>
     <message>
         <source>Hard drive to &copy</source>
-        <translation>Hard disk yang akan di&salin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&New hard drive to create</source>
-        <translation>Hard disk baru yang aka&n dibuat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hard drive file &type</source>
-        <translation>&Tipe berkas hard disk</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardCloneVM</name>
     <message>
         <source>Linked Base for %1 and %2</source>
-        <translation>Basis Tertaut bagi %1 dan %2</translation>
+        <translation type="unfinished">Basis Tertaut bagi %1 dan %2</translation>
     </message>
     <message>
         <source>Clone Virtual Machine</source>
-        <translation>Buat Klon Mesin Virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Clone</source>
-        <translation>Klon</translation>
+        <translation type="unfinished">Klon</translation>
     </message>
     <message>
         <source>%1 Clone</source>
-        <translation>Klon %1</translation>
+        <translation type="unfinished">Klon %1</translation>
     </message>
     <message>
         <source>New machine name</source>
-        <translation>Nama mesin baru</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please choose a name for the new virtual machine. The new machine will be a clone of the machine <b>%1</b>.</p></source>
-        <translation><p>Harap pilih suatu nama bagi mesin virtual baru. Mesin baru akan berupa klon dari mesin <b>%1</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked a new unique MAC address will be assigned to all configured network cards.</source>
-        <translation>Saat ditandai, suatu alamat MAC unik yang baru akan diberikan ke semua kartu jaringan yang terkonfigurasi.</translation>
+        <translation type="unfinished">Saat ditandai, suatu alamat MAC unik yang baru akan diberikan ke semua kartu jaringan yang terkonfigurasi.</translation>
     </message>
     <message>
         <source>&Reinitialize the MAC address of all network cards</source>
-        <translation>Inisialisasi ulang alamat MAC dari semua kartu ja&ringan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Clone type</source>
-        <translation>Tipe klon</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please choose the type of clone you wish to create.</p><p>If you choose <b>Full clone</b>, an exact copy (including all virtual hard drive files) of the original virtual machine will be created.</p><p>If you choose <b>Linked clone</b>, a new machine will be created, but the virtual hard drive files will be tied to the virtual hard drive files of original machine and you will not be able to move the new virtual machi [...]
-        <translation><p>Harap pilih tipe klon yang hendak Anda buat.</p><p>Bila Anda memilih <b>Klon penuh</b>, suatu salinan eksak (termasuk semua berkas hard disk virtual) dari mesin virtual asli akan dibuat.</p><p>Bila Anda memilih <b>Klon tertaut</b>, suatu mesin baru akan dibuat, tapi berkas hard disk virtual akan diikatkan ke berkas hard disk virtual mesin yang asli, dan Anda tidak akan bisa memindah mesin virtual baru ke komput [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you create a <b>Linked clone</b> then a new snapshot will be created in the original virtual machine as part of the cloning process.</p></source>
-        <translation>Bila Anda memilih <b>Klon tertaut</b> maka suatu snapshot baru akan dibuat dalam mesin virtual asli sebagai bagian dari proses kloning.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Full clone</source>
-        <translation>Klon penuh</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Linked clone</source>
-        <translation>Klon &tertaut</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Snapshots</source>
-        <translation>Snapshot</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please choose which parts of the snapshot tree should be cloned with the machine.</p></source>
-        <translation><p>Silakan pilih bagian mana dari pohon snapshot yang mesti diklon dengan mesin.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you choose <b>Current machine state</b>, the new machine will reflect the current state of the original machine and will have no snapshots.</p></source>
-        <translation><p>Bila Anda memilih <b>Keadaan mesin kini</b>, mesin baru akan mencerminkan keadaan sekarang dari mesin asli dan tidak akan memiliki snapshot.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you choose <b>Current snapshot tree branch</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the tree branch starting at the current state in the original machine.</p></source>
-        <translation><p>Bila Anda memilih <b>Cabang pohon snapshot saat ini</b>, mesin baru akan mencerminkan keadaan sekarang dari mesin asli dan akan memiliki snapshot yang cocok bagi semua snapshot dalam cabang pohon yang dimulai dari keadaan sekarang dalam mesin asli.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you choose <b>Everything</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the original machine.</p></source>
-        <translation><p>Bila Anda memilih <b>Semuanya</b>, mesin baru akan mencerminkan keadaan sekarang dari mesin asli dan dan akan memiliki snapshot yang cocok bagi semua snapshot dalam mesin asli.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Current &machine state</source>
-        <translation>Keadaan &mesin kini</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Current &snapshot tree branch</source>
-        <translation>Cabang pohon &snapshot saat ini</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Everything</source>
-        <translation>S&emuanya</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New machine &name</source>
-        <translation>&Nama mesin baru</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Full Clone</source>
-        <translation>Klon &Penuh</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Linked Clone</source>
-        <translation>K&lon Tertaut</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportApp</name>
     <message>
         <source>Checking files ...</source>
-        <translation>Memeriksa berkas ...</translation>
+        <translation type="unfinished">Memeriksa file ...</translation>
     </message>
     <message>
         <source>Removing files ...</source>
-        <translation>Menghapus berkas ...</translation>
+        <translation type="unfinished">Menghapus file ...</translation>
     </message>
     <message>
         <source>Exporting Appliance ...</source>
-        <translation>Mengekspor Appliance ...</translation>
+        <translation type="unfinished">Mengekspor Appliance ...</translation>
     </message>
     <message>
         <source>Export Virtual Appliance</source>
-        <translation>Ekspor Appliance Virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Restore Defaults</source>
-        <translation>Pulihkan Baku</translation>
+        <translation type="unfinished">Kembalikan Default</translation>
     </message>
     <message>
         <source>Export</source>
-        <translation>Ekspor</translation>
+        <translation type="unfinished">Ekspor</translation>
     </message>
     <message>
         <source>Virtual machines to export</source>
-        <translation>Mesin virtual yang akan diekspor</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.</p></source>
-        <translation><p>Silakan pilih mesin virtual yang mesti ditambahkan ke appliance. Anda dapat memilih lebih dari satu. Perhatikan bahwa mesin-mesin ini mesti dimatikan sebelum dapat diekspor.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Appliance settings</source>
-        <translation>Pengaturan appliance</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose where to create the virtual appliance. You can create it on your own computer, on the Sun Cloud service or on an S3 storage server.</source>
-        <translation>Silakan pilih di mana membuat appliance virtual. Anda dapat membuatnya pada komputer Anda sendiri, pada layanan Sun Cloud, atau pada server penyimpanan S3.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create on</source>
-        <translation>Dibuat pada</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&This computer</source>
-        <translation>Kompu&ter ini</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Sun &Cloud</source>
-        <translation>&Cloud Sun</translation>
+        <translation type="unfinished">&Cloud Sun</translation>
     </message>
     <message>
         <source>&Simple Storage System (S3)</source>
-        <translation>&Simple Storage System (S3)</translation>
+        <translation type="unfinished">&Simple Storage System (S3)</translation>
     </message>
     <message>
         <source>Appliance</source>
-        <translation>Appliance</translation>
+        <translation type="unfinished">Appliance</translation>
     </message>
     <message>
         <source>&Username:</source>
-        <translation>Nama pengg&una:</translation>
+        <translation type="unfinished">Nama pengg&una:</translation>
     </message>
     <message>
         <source>&Password:</source>
-        <translation>&Password:</translation>
+        <translation type="unfinished">&Password:</translation>
     </message>
     <message>
         <source>&Hostname:</source>
-        <translation>Nama &host:</translation>
+        <translation type="unfinished">Nama &host:</translation>
     </message>
     <message>
         <source>&Bucket:</source>
-        <translation>&Bucket:</translation>
+        <translation type="unfinished">&Bucket:</translation>
     </message>
     <message>
         <source>&File:</source>
-        <translation>&Berkas:</translation>
+        <translation type="unfinished">&File:</translation>
     </message>
     <message>
         <source>Open Virtualization Format Archive (%1)</source>
-        <translation>Arsip Open Virtualization Format (%1)</translation>
+        <translation type="unfinished">Arsip Open Virtualization Format (%1)</translation>
     </message>
     <message>
         <source>Open Virtualization Format (%1)</source>
-        <translation>Open Virtualization Format (%1)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
-        <translation>Tulis dalam format legacy OVF 0.9 untuk kompatibilitas dengan produk virtualisasi lain.</translation>
+        <translation type="unfinished">Tulis dalam format legacy OVF 0.9 untuk kompatibilitas dengan produk virtualisasi lain.</translation>
     </message>
     <message>
         <source>&Write legacy OVF 0.9</source>
@@ -9456,135 +10363,135 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Create a Manifest file for automatic data integrity checks on import.</source>
-        <translation>Buat berkas Manifest untuk pemeriksaan integritas data otomatis saat impor.</translation>
+        <translation type="unfinished">Buat file Manifest untuk pemeriksaan integritas data otomatis saat impor.</translation>
     </message>
     <message>
         <source>Write &Manifest file</source>
-        <translation>Tulis berkas &Manifest</translation>
+        <translation type="unfinished">Tulis file &Manifest</translation>
     </message>
     <message>
         <source>This is the descriptive information which will be added to the virtual appliance.  You can change it by double clicking on individual lines.</source>
-        <translation>Ini adalah informasi deskriptif yang akan ditambahkan ke appliance virtual. Anda dapat mengubahnya dengan klik ganda pada baris individu.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &machines to export</source>
-        <translation>&Mesin virtual yang akan diekspor</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Appliance &settings</source>
-        <translation>&Pengaturan appliance</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Destination</source>
-        <translation>&Tujuan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Local Filesystem </source>
-        <translation>Sistem Berkas &Lokal</translation>
+        <translation type="unfinished">Sistem File &Lokal</translation>
     </message>
     <message>
         <source>Storage settings</source>
-        <translation>Pengaturan penyimpanan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>Pilih berkas tujuan ekspor appliance virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>F&ormat:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>Tulis dalam format standar OVF 1.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>Tulis dalam format eksperimen OVF 2.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation>&Pengaturan penyimpanan</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageBasic3</name>
     <message>
         <source><p>Please choose a filename to export the OVF/OVA to.</p><p>If you use an <i>ova</i> extension, then all the files will be combined into one Open Virtualization Format Archive.</p><p>If you use an <i>ovf</i> extension, several files will be written separately.</p><p>Other extensions are not allowed.</p></source>
-        <translation><p>Harap pilih suatu nama berkas tujuan ekspor OVF/OVA.</p><p>Bila Anda memakai ekstensi <i>ova</i>, maka semua berkas akan digabung ke dalam satu Open Virtualization Format Archive.</p><p>Jika Anda memakai ekstensi <i>ovf</i>, beberapa berkas akan ditulis secara terpisah.</p><p>Ekstensi lain tak diijinkan.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.</source>
-        <translation>Silakan lengkapi field tambahan seperti nama pengguna, sandi, serta buket, dan berikan nama berkas bagi target OVF.</translation>
+        <translation type="unfinished">Silakan lengkapi field tambahan seperti nama pengguna, password, dan bucket, dan berikan nama file bagi target OVF.</translation>
     </message>
     <message>
         <source>Please complete the additional fields like the username, password, hostname and the bucket, and provide a filename for the OVF target.</source>
-        <translation>Silakan lengkapi field tambahan seperti nama pengguna, sandi, nama host, serta buket, dan berikan nama berkas bagi target OVF.</translation>
+        <translation type="unfinished">Silakan lengkapi field tambahan seperti nama pengguna, password, nama host, dan bucket, dan berikan nama file bagi target OVF.</translation>
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Pilih berkas tujuan ekspor appliance virtual...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Pilih file tujuan ekspor appliance virtual...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardFirstRun</name>
     <message>
         <source>Select start-up disk</source>
-        <translation>Pilih disk awal mula</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Start</source>
-        <translation>Mulai</translation>
+        <translation type="unfinished">Mulai</translation>
     </message>
     <message>
         <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from and should contain the operating system you wish to install on the virtual machine if you want to do that now. The disk will be ejected from the virtual drive automatically next time you switch the virtual machine off, but you can also do this yourself if needed u [...]
-        <translation><p>Harap pilih berkas disk optik virtual atau drive optik fisik yang memuat suatu disk tempat asal memulai mesin virtual Anda.</p><p>Disk mesti cocok untuk memulai suatu komputer dan mesti memuat sistem operasi yang ingin Anda pasang ke mesin virtual bila Anda ingin melakukannya sekarang. Disk mesti dikeluarkan dari drive virtual secara otomatis kali berikutnya Anda mematikan mesin virtual, tapi Anda juga dapat melakukan ini sendiri bila diperlukan  [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from. As this virtual machine has no hard drive you will not be able to install an operating system on it at the moment.</p></source>
-        <translation><p>Harap pilih berkas disk optik virtual atau drive optik fisik yang memuat suatu disk tempat asal memulai mesin virtual Anda.</p><p>Disk mesti cocok untuk memulai suatu komputer. Karena mesin virtual ini tak memiliki hard disk Anda tidak akan bisa memasang sistem operasi padanya saat ini.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual optical disk file...</source>
-        <translation>Pilih berkas disk optik virtual...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardImportApp</name>
     <message>
         <source>Restore Defaults</source>
-        <translation>Pulihkan Baku</translation>
+        <translation type="unfinished">Kembalikan Default</translation>
     </message>
     <message>
         <source>Import</source>
-        <translation>Impor</translation>
+        <translation type="unfinished">Impor</translation>
     </message>
     <message>
         <source>Appliance to import</source>
-        <translation>Appliance yang akan diimpor</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below.</p></source>
-        <translation><p>VirtualBox saat ini mendukung pengimporan appliance yang disimpan dalam Open Virtualization Format (OVF). Untuk melanjutkan, pilih berkas yang hendak diimpor di bawah.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Select an appliance to import</source>
@@ -9592,121 +10499,121 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Open Virtualization Format (%1)</source>
-        <translation>Open Virtualization Format (%1)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Appliance settings</source>
-        <translation>Pengaturan appliance</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
-        <translation>Ini adalah mesin virtual yang dimuat di dalam appliance dan tatanan yang disarankan dari mesin VirtualBox yang diimpor. Anda dapat mengubah berbagai properti yang ditampilkan dengan melakukan klik ganda pada butir dan mematikan lainnya dengan memakai kotak contreng di bawah.</translation>
+        <translation type="unfinished">Ini adalah mesin virtual yang dimuat di dalam appliance dan tatanan yang disarankan dari mesin VirtualBox yang diimpor. Anda dapat mengubah berbagai properti yang ditampilkan dengan melakukan klik ganda pada butir dan mematikan lainnya dengan memakai check box di bawah.</translation>
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation>Impor Appliance Virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>Pilih berkas appliance virtual yang hendak diimpor...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>Harap pilih suatu berkas appliance virtual yang akan diimpor</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardNewVD</name>
     <message>
         <source>Create Virtual Hard Drive</source>
-        <translation>Buat Hard Disk Virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create</source>
-        <translation>Buat</translation>
+        <translation type="unfinished">Buat</translation>
     </message>
     <message>
         <source>Hard drive file type</source>
-        <translation>Tipe berkas hard disk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Silakan pilih tipe berkas yang ingin Anda pakai untuk hard disk virtual baru. Bila Anda tak perlu memakainya dengan perangkat lunak virtualisasi lain Anda dapat membiarkan setting ini tak diubah.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Storage on physical hard drive</source>
-        <translation>Penyimpanan pada hard disk fisik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>Silakan pilih apakah berkas hard disk virtual baru mesti berkembang ketika dipakai (dialokasikan secara dinamik) atau mesti diciptakan pada ukuran maksimumnya (ukuran tetap).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
-        <translation><p>Berkas hard disk virtual <b>yang dialokasikan secara dinamik</b> hanya akan memakai ruang pada hard disk fisik Anda ketika terisi (sampai dengan suatu <b>ukuran tetap</b> maksimum), walaupun mereka tak akan mengecil lagi secara otomatis ketika ruang di dalamnya dibebaskan.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
-        <translation><p>Berkas hard disk virtual <b>berukuran tetap</b> mungkin makan waktu lebih lama untuk diciptakan pada beberapa sistem tapi seringkali lebih cepat dipakainya.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
-        <translation><p>Anda juga dapat memilih untuk <b>memecah</b> berkas hard disk virtual ke dalam beberapa berkas yang masing-masing berukuran sampai dengan dua giga byte. Ini terutama berguna bila Anda hendak menyimpan mesin virtual pada perangkat USB lepas pasang atau sistem lama, yang mungkin tak bisa menangani berkas sangat besar.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Dynamically allocated</source>
-        <translation>&Dialokasikan secara dinamik</translation>
+        <translation type="unfinished">&Dialokasikan secara dinamis</translation>
     </message>
     <message>
         <source>&Fixed size</source>
-        <translation>Ukuran &tetap</translation>
+        <translation type="unfinished">Ukuran &tetap</translation>
     </message>
     <message>
         <source>&Split into files of less than 2GB</source>
-        <translation>&Pecah ke dalam berkas-berkas kurang dari 2GB</translation>
+        <translation type="unfinished">&Pecah ke dalam file kurang dari 2GB</translation>
     </message>
     <message>
         <source><nobr>%1 (%2 B)</nobr></source>
-        <translation><nobr>%1 (%2 B)</nobr></translation>
+        <translation type="unfinished"><nobr>%1 (%2 B)</nobr></translation>
     </message>
     <message>
         <source>File location and size</source>
-        <translation>Lokasi dan ukuran berkas</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
-        <translation>Silakan ketik nama berkas hard disk virtual baru ke kotak di bawah atau klik pada ikon folder untuk memilih folder lain tempat mencipta berkas.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a location for new virtual hard drive file...</source>
-        <translation>Pilih lokasi untuk berkas hard disk virtual baru...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Select the size of the virtual hard drive in megabytes. This size is the limit on the amount of file data that a virtual machine will be able to store on the hard drive.</source>
-        <translation>Pilih ukuran image hard disk virtual dalam megabyte. Ukuran ini adalah batas pada banyaknya data berkas yang dapat disimpan oleh mesin virtual pada hard disk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &location</source>
-        <translation>&Lokasi berkas</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &size</source>
-        <translation>&Ukuran berkas</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hard drive file &type</source>
-        <translation>&Tipe berkas hard disk</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardNewVM</name>
     <message>
         <source>Create Virtual Machine</source>
-        <translation>Ciptakan Mesin Virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create</source>
-        <translation>Buat</translation>
+        <translation type="unfinished">Buat</translation>
     </message>
     <message>
         <source>IDE Controller</source>
@@ -9730,47 +10637,47 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>Name and operating system</source>
-        <translation>Nama dan sistem operasi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</source>
-        <translation>Harap pilih suatu nama yang deskriptif bagi mesin virtual baru dan pilih tipe sistem operasu yang hendak Anda pasang padanya. Nama yang Anda pilih akan dipakai di seluruh VirtualBox untuk mengidentifikasi mesin ini.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Memory size</source>
-        <translation>Ukuran memori</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Select the amount of memory (RAM) in megabytes to be allocated to the virtual machine.</p><p>The recommended memory size is <b>%1</b> MB.</p></source>
-        <translation><p>Atur banyaknya memori (RAM) dalam megabyte untuk dialokasikan ke mesin virtual.</p><p>Ukuran memori yang disarankan adalah <b>%1</b> MB.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hard drive</source>
-        <translation>Hard disk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you wish you can add a virtual hard drive to the new machine. You can either create a new hard drive file or select one from the list or from another location using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step and make the changes to the machine settings once the machine is created.</p><p>The recommended size of the hard drive is <b>%1</b>.</p></source>
-        <translation><p>Bila Anda mau Anda dapat menambahkan suatu hard disk virtual ke mesin baru. Anda dapat membuat suatu berkas hard disk baru atau memilih satu dari daftar atau dari lokasi lain memakai ikon folder.</p><p>Bila Anda perlu penyiapan penyimpanan yang lebih rumit Anda dapat melewait langkah ini dan membuat perubahan ke pengaturan mesin setelah mesin dibuat.</p><p>Ukuran hard disk yang disarankan adalah <b>%1</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual hard drive file...</source>
-        <translation>Pilih suatu berkas hard disk virtual...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Memory size</source>
-        <translation>Ukuran &memori</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Do not add a virtual hard drive</source>
-        <translation>Jangan tambahkan hard &disk virtual</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Create a virtual hard drive now</source>
-        <translation>&Buat hard disk virtual sekarang</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Use an existing virtual hard drive file</source>
-        <translation>G&unakan berkas hard disk virtual yang ada</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9787,7 +10694,7 @@ langkah ini dan memasang hard disk pada waktu lain menggunakan dialog Setting Me
     </message>
     <message>
         <source>VirtualBox Graphical User Interface</source>
-        <translation>Antarmuka Pengguna Grafis VirtualBox</translation>
+        <translation>Antarmuka Pengguna Grafik VirtualBox</translation>
     </message>
     <message>
         <source>Version %1</source>
@@ -10104,11 +11011,11 @@ Versi %1</translation>
         <translation type="obsolete">Buka dialog untuk beroperasi pada folder yang di share</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="obsolete">&Insert Guest Additions CD image...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Install Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Pasang Guest Additions pada image instalasi</translation>
     </message>
     <message>
@@ -10395,7 +11302,7 @@ Versi %1</translation>
         <translation type="obsolete">Dialog I&nformasi Sesi </translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Tampilkan Dialog Informasi Sesi </translation>
     </message>
     <message>
@@ -10688,18 +11595,18 @@ Versi %1</translation>
     </message>
     <message>
         <source>Choose...</source>
-        <translation>Pilih...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>VBoxFilePathSelectorWidget</name>
     <message>
         <source><reset to default></source>
-        <translation><reset ke baku></translation>
+        <translation><reset ke default></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>Nila path baku sebenarnya akan ditampilkan setelah menerima perubahan dan membuka dialog ini lagi.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Nila path default sebenarnya akan ditampilkan setelah menerima perubahan dan membuka dialog ini lagi.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -10707,7 +11614,7 @@ Versi %1</translation>
     </message>
     <message>
         <source>Please use the <b>Other...</b> item from the drop-down list to select a path.</source>
-        <translation>Silakan pakai butir <b>Lainnya...</b> dari daftar drop-down untuk memilih suatu path.</translation>
+        <translation>Silakan pakai item <b>Lainnya...</b> dari daftar drop-down untuk memilih suatu path.</translation>
     </message>
     <message>
         <source>Other...</source>
@@ -10719,19 +11626,19 @@ Versi %1</translation>
     </message>
     <message>
         <source>Opens a window to select a different folder.</source>
-        <translation>Buka jendela untuk memilih folder lain.</translation>
+        <translation>Buka dialog untuk memilih folder lain.</translation>
     </message>
     <message>
         <source>Resets the folder path to the default value.</source>
-        <translation>Reset path folder ke nilai baku.</translation>
+        <translation>Reset path folder ke nilai default.</translation>
     </message>
     <message>
         <source>Opens a window to select a different file.</source>
-        <translation>Buka jendela untuk memilih berkas lain.</translation>
+        <translation>Buka dialog untuk memilih file lain.</translation>
     </message>
     <message>
         <source>Resets the file path to the default value.</source>
-        <translation>Reset path berkas ke nilai baku.</translation>
+        <translation>Reset path file ke nilai default.</translation>
     </message>
     <message>
         <source>&Copy</source>
@@ -10743,12 +11650,11 @@ Versi %1</translation>
     </message>
     <message>
         <source>Please type the file path here.</source>
-        <translation>Silakan ketik path berkas di sini.</translation>
+        <translation>Silakan ketik path file di sini.</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Nila path default sebenarnya akan ditampilkan setelah menerima perubahan dan membuka dialog ini lagi.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10791,12 +11697,12 @@ Versi %1</translation>
     <message>
         <source>Unknown device %1:%2</source>
         <comment>USB device details</comment>
-        <translation>Perangkat tidak dikenal %1:%2</translation>
+        <translation>Device tidak dikenal %1:%2</translation>
     </message>
     <message>
         <source><nobr>Vendor ID: %1</nobr><br><nobr>Product ID: %2</nobr><br><nobr>Revision: %3</nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><nobr>ID Vendor: %1</nobr><br><nobr>ID Produk: %2</nobr><br><nobr>Revisi: %3</nobr></translation>
+        <translation><nobr>ID Vendor: %1</nobr><br><nobr>ID Product: %2</nobr><br><nobr>Revisi: %3</nobr></translation>
     </message>
     <message>
         <source><br><nobr>Serial No. %1</nobr></source>
@@ -10816,7 +11722,7 @@ Versi %1</translation>
     <message>
         <source>OS Type</source>
         <comment>details report</comment>
-        <translation>Tipe OS</translation>
+        <translation>Tipe Sistem Operasi</translation>
     </message>
     <message>
         <source>Base Memory</source>
@@ -10831,7 +11737,7 @@ Versi %1</translation>
     <message>
         <source>General</source>
         <comment>details report</comment>
-        <translation>Umum</translation>
+        <translation>Garis Besar</translation>
     </message>
     <message>
         <source>Video Memory</source>
@@ -10871,22 +11777,22 @@ Versi %1</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (ACPI)</comment>
-        <translation>Difungsikan</translation>
+        <translation>Menyala</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (ACPI)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Enabled</source>
         <comment>details report (I/O APIC)</comment>
-        <translation>Difungsikan</translation>
+        <translation>Menyala</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (I/O APIC)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Not mounted</source>
@@ -10936,7 +11842,7 @@ Versi %1</translation>
     <message>
         <source>Disabled</source>
         <comment>details report (audio)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Audio</source>
@@ -10946,12 +11852,12 @@ Versi %1</translation>
     <message>
         <source>Adapter %1</source>
         <comment>details report (network)</comment>
-        <translation>Adaptor %1</translation>
+        <translation>Adapter %1</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (network)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Network</source>
@@ -10961,7 +11867,7 @@ Versi %1</translation>
     <message>
         <source>Device Filters</source>
         <comment>details report (USB)</comment>
-        <translation>Penyaring Perangkat</translation>
+        <translation>Filter Device</translation>
     </message>
     <message>
         <source>%1 (%2 active)</source>
@@ -10971,7 +11877,7 @@ Versi %1</translation>
     <message>
         <source>Disabled</source>
         <comment>details report (USB)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>VRDP Server Port</source>
@@ -11080,7 +11986,7 @@ Versi %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -11225,7 +12131,7 @@ Versi %1</translation>
     <message>
         <source>Not supported</source>
         <comment>USBDeviceState</comment>
-        <translation>Tidak didukung</translation>
+        <translation>Tidak terdukung</translation>
     </message>
     <message>
         <source>Unavailable</source>
@@ -11245,12 +12151,12 @@ Versi %1</translation>
     <message>
         <source>Held</source>
         <comment>USBDeviceState</comment>
-        <translation>Ditahan</translation>
+        <translation>Terpegang</translation>
     </message>
     <message>
         <source>Captured</source>
         <comment>USBDeviceState</comment>
-        <translation>Ditangkap</translation>
+        <translation>Tertangkap</translation>
     </message>
     <message>
         <source><i>Checking...</i></source>
@@ -11265,7 +12171,7 @@ Versi %1</translation>
     <message>
         <source>Disabled</source>
         <comment>ClipboardType</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Host To Guest</source>
@@ -11298,7 +12204,7 @@ Versi %1</translation>
     <message>
         <source>Disabled</source>
         <comment>details report (serial ports)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Serial Ports</source>
@@ -11313,7 +12219,7 @@ Versi %1</translation>
     <message>
         <source>Shared Folders</source>
         <comment>details report (shared folders)</comment>
-        <translation>Folder Bersama</translation>
+        <translation>Folder yang di Share</translation>
     </message>
     <message>
         <source>%1</source>
@@ -11328,7 +12234,7 @@ Versi %1</translation>
     <message>
         <source>Shared Folders</source>
         <comment>details report</comment>
-        <translation>Folder Bersama</translation>
+        <translation>Folder yang di Share</translation>
     </message>
     <message>
         <source>Stuck</source>
@@ -11348,7 +12254,7 @@ Versi %1</translation>
     <message>
         <source>Host Device</source>
         <comment>PortMode</comment>
-        <translation>Perangkat Host</translation>
+        <translation>Device Host</translation>
     </message>
     <message>
         <source>User-defined</source>
@@ -11373,22 +12279,22 @@ Versi %1</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (VT-x/AMD-V)</comment>
-        <translation>Difungsikan</translation>
+        <translation>Menyala</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (VT-x/AMD-V)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Enabled</source>
         <comment>details report (PAE/NX)</comment>
-        <translation>Difungsikan</translation>
+        <translation>Menyala</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (PAE/NX)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Host Driver</source>
@@ -11408,7 +12314,7 @@ Versi %1</translation>
     <message>
         <source>Disabled</source>
         <comment>details report (parallel ports)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Mati</translation>
     </message>
     <message>
         <source>Parallel Ports</source>
@@ -11423,7 +12329,7 @@ Versi %1</translation>
     <message>
         <source>Shared Folder</source>
         <comment>DeviceType</comment>
-        <translation>Folder Bersama</translation>
+        <translation>Folder yang di Share</translation>
     </message>
     <message>
         <source>IDE</source>
@@ -11583,12 +12489,12 @@ Versi %1</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (3D Acceleration)</comment>
-        <translation>Difungsikan</translation>
+        <translation>Diaktifkan</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (3D Acceleration)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Dimatikan</translation>
     </message>
     <message>
         <source>Setting Up</source>
@@ -11608,12 +12514,12 @@ Versi %1</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (Nested Paging)</comment>
-        <translation>Difungsikan</translation>
+        <translation>Diaktifkan</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Nested Paging)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Dimatikan</translation>
     </message>
     <message>
         <source>Internal network, '%1'</source>
@@ -11708,22 +12614,22 @@ Versi %1</translation>
     <message>
         <source>Display</source>
         <comment>details report</comment>
-        <translation>Tampilan</translation>
+        <translation>Display</translation>
     </message>
     <message>
         <source>Raw File</source>
         <comment>PortMode</comment>
-        <translation>Berkas Mentah</translation>
+        <translation>File Raw</translation>
     </message>
     <message>
         <source>Enabled</source>
         <comment>details report (2D Video Acceleration)</comment>
-        <translation>Difungsikan</translation>
+        <translation>Diaktifkan</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (2D Video Acceleration)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Dimatikan</translation>
     </message>
     <message>
         <source>2D Video Acceleration</source>
@@ -11733,7 +12639,7 @@ Versi %1</translation>
     <message>
         <source>Not Attached</source>
         <comment>details report (Storage)</comment>
-        <translation>Tidak Terpasang</translation>
+        <translation>Tidak Disambung</translation>
     </message>
     <message>
         <source>Storage</source>
@@ -11868,21 +12774,21 @@ Versi %1</translation>
     <message>
         <source>Failed to check accessibility of disk image files.</source>
         <comment>medium</comment>
-        <translation>Gagal memeriksa aksesibilitas berkas image disk.</translation>
+        <translation>Gagal memeriksa aksesibilitas media.</translation>
     </message>
     <message>
         <source><b>No disk image file selected</b></source>
         <comment>medium</comment>
-        <translation><b>Tidak ada berkas image disk yang dipilih</b></translation>
+        <translation><b>Tak ada medium yang dipilih</b></translation>
     </message>
     <message>
         <source>You can also change this while the machine is running.</source>
-        <translation>Anda juga dapat mengubah ini ketika mesin sedang berjalan.</translation>
+        <translation>Anda juga dapat mengubah ini ketika mesin berjalan.</translation>
     </message>
     <message>
         <source><b>No disk image files available</b></source>
         <comment>medium</comment>
-        <translation><b>Tidak ada berkas image disk yang tersedia</b></translation>
+        <translation><b>Tak ada media yang tersedia</b></translation>
     </message>
     <message>
         <source>You can create disk image files using the virtual media manager.</source>
@@ -11891,17 +12797,17 @@ Versi %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Pencantolan hard disk ini akan dilakukan secara tidak langsung menggunakan hard disk pembeda yang baru dibuat.</translation>
+        <translation type="obsolete">Pencantolan hard disk ini akan dilakukan secara tidak langsung menggunakan hard disk pembeda yang baru dibuat.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Beberapa berkas dalam rangkaian hard disk ini tak dapat diakses. Silakan pakai Manajer Media Virtual dalam mode <b>Tampilkan Hard Disk Pembeda</b> untuk memeriksa berkas-berkas tersebut.</translation>
+        <translation type="obsolete">Beberapa media dalam rangkaian hard disk ini tak dapat diakses. Silakan pakai Manajer Media Virtual dalam mode <b>Tampilkan Hard Disk Pembeda</b> untuk memeriksa media tersebut.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Hard disk dasar ini dicantolkan secara tidak langsung memakai hard disk pembeda berikut:</translation>
+        <translation type="obsolete">Hard disk dasar ini dicantolkan secara tidak langsung memakai hard disk pembeda berikut:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -11941,7 +12847,7 @@ Versi %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -12010,7 +12916,7 @@ Versi %1</translation>
     <message>
         <source>Unknown device</source>
         <comment>USB device details</comment>
-        <translation>Perangkat tidak dikenal</translation>
+        <translation>Device tidak dikenal</translation>
     </message>
     <message>
         <source>SAS Port %1</source>
@@ -12030,7 +12936,7 @@ Versi %1</translation>
     <message>
         <source>Disabled</source>
         <comment>details report (VRDE Server)</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation>Dimatikan</translation>
     </message>
     <message>
         <source>Choose a virtual hard disk file</source>
@@ -12062,7 +12968,7 @@ Versi %1</translation>
     </message>
     <message>
         <source>All files (*)</source>
-        <translation>Semua berkas (*)</translation>
+        <translation>Semua file (*)</translation>
     </message>
     <message>
         <source>Fault Tolerant Syncing</source>
@@ -12158,7 +13064,7 @@ Versi %1</translation>
     <message>
         <source>Execution Cap</source>
         <comment>details report</comment>
-        <translation>Batas Eksekusi</translation>
+        <translation>Cap Eksekusi</translation>
     </message>
     <message>
         <source><nobr>%1%</nobr></source>
@@ -12197,352 +13103,486 @@ Versi %1</translation>
     <message>
         <source>Disabled</source>
         <comment>DragAndDropType</comment>
-        <translation>Dinonaktifkan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host To Guest</source>
         <comment>DragAndDropType</comment>
-        <translation>Host ke Guest</translation>
+        <translation type="unfinished">Host ke Guest</translation>
     </message>
     <message>
         <source>Guest To Host</source>
         <comment>DragAndDropType</comment>
-        <translation>Guest ke Host</translation>
+        <translation type="unfinished">Guest ke Host</translation>
     </message>
     <message>
         <source>Bidirectional</source>
         <comment>DragAndDropType</comment>
-        <translation>Dua Arah</translation>
+        <translation type="unfinished">Dua Arah</translation>
     </message>
     <message>
         <source>Normal</source>
         <comment>MediumType</comment>
-        <translation>Normal</translation>
+        <translation type="unfinished">Normal</translation>
     </message>
     <message>
         <source>Immutable</source>
         <comment>MediumType</comment>
-        <translation>Tetap</translation>
+        <translation type="unfinished">Immutable</translation>
     </message>
     <message>
         <source>Writethrough</source>
         <comment>MediumType</comment>
-        <translation>Writethrough</translation>
+        <translation type="unfinished">Writethrough</translation>
     </message>
     <message>
         <source>Shareable</source>
         <comment>MediumType</comment>
-        <translation>Dapat Dipakai Bersama</translation>
+        <translation type="unfinished">Dapat Di-share</translation>
     </message>
     <message>
         <source>Readonly</source>
         <comment>MediumType</comment>
-        <translation>Baca-saja</translation>
+        <translation type="unfinished">Baca-saja</translation>
     </message>
     <message>
         <source>Multi-attach</source>
         <comment>MediumType</comment>
-        <translation>Multi-cantol</translation>
+        <translation type="unfinished">Multi-cantol</translation>
     </message>
     <message>
         <source>Dynamically allocated storage</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan yang dialokasikan secara dinamis</translation>
+        <translation type="unfinished">Penyimpanan yang dialokasikan secara dinamis</translation>
     </message>
     <message>
         <source>Dynamically allocated differencing storage</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan pembeda yang dialokasikan secara dinamis</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Fixed size storage</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan ukuran tetap</translation>
+        <translation type="unfinished">Penyimpanan ukuran tetap</translation>
     </message>
     <message>
         <source>Dynamically allocated storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan yang dialokasikan secara dinamis memecah ke file berukuran kurang dari 2GB</translation>
+        <translation type="unfinished">Penyimpanan yang dialokasikan secara dinamis memecah ke file berukuran kurang dari 2GB</translation>
     </message>
     <message>
         <source>Dynamically allocated differencing storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan pembeda yang dialokasikan secara dinamis memecah ke file berukuran kurang dari 2GB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Fixed size storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan ukuran tetap memecah ke file berukuran kurang dari 2GB</translation>
+        <translation type="unfinished">Penyimpanan ukuran tetap memecah file berukuran kurang dari 2GB</translation>
     </message>
     <message>
         <source>Dynamically allocated compressed storage</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan terkompresi yang dialokasikan secara dinamis</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Dynamically allocated differencing compressed storage</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan pembeda terkompresi yang dialokasikan secara dinamis</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Fixed size ESX storage</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan ESX ukuran tetap</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Fixed size storage on raw disk</source>
         <comment>MediumVariant</comment>
-        <translation>Penyimpanan ukuran tetap pada disk mentah</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Deny</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Tolak</translation>
+        <translation type="unfinished">Tolak</translation>
     </message>
     <message>
         <source>Allow VMs</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Ijinkan VM</translation>
+        <translation type="unfinished">Ijinkan VM</translation>
     </message>
     <message>
         <source>Allow All</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Ijinkan Semua</translation>
+        <translation type="unfinished">Ijinkan Semua</translation>
     </message>
     <message>
         <source>Ignore</source>
         <comment>USBDeviceFilterAction</comment>
-        <translation>Abaikan</translation>
+        <translation type="unfinished">Abaikan</translation>
     </message>
     <message>
         <source>Hold</source>
         <comment>USBDeviceFilterAction</comment>
-        <translation>Tahan</translation>
+        <translation type="unfinished">Tahan</translation>
     </message>
     <message>
         <source>UDP</source>
         <comment>NATProtocol</comment>
-        <translation>UDP</translation>
+        <translation type="unfinished">UDP</translation>
     </message>
     <message>
         <source>TCP</source>
         <comment>NATProtocol</comment>
-        <translation>TCP</translation>
+        <translation type="unfinished">TCP</translation>
     </message>
     <message>
         <source>IDE Primary Master</source>
         <comment>StorageSlot</comment>
-        <translation>IDE Master Primer</translation>
+        <translation type="unfinished">IDE Master Primer</translation>
     </message>
     <message>
         <source>IDE Primary Slave</source>
         <comment>StorageSlot</comment>
-        <translation>IDE Slave Primer</translation>
+        <translation type="unfinished">IDE Slave Primer</translation>
     </message>
     <message>
         <source>IDE Secondary Master</source>
         <comment>StorageSlot</comment>
-        <translation>IDE Master Sekunder</translation>
+        <translation type="unfinished">IDE Master Sekunder</translation>
     </message>
     <message>
         <source>IDE Secondary Slave</source>
         <comment>StorageSlot</comment>
-        <translation>IDE Slave Sekunder</translation>
+        <translation type="unfinished">IDE Slave Sekunder</translation>
     </message>
     <message>
         <source>SATA Port %1</source>
         <comment>StorageSlot</comment>
-        <translation>SATA Port %1</translation>
+        <translation type="unfinished">SATA Port %1</translation>
     </message>
     <message>
         <source>SCSI Port %1</source>
         <comment>StorageSlot</comment>
-        <translation>SCSI Port %1</translation>
+        <translation type="unfinished">SCSI Port %1</translation>
     </message>
     <message>
         <source>SAS Port %1</source>
         <comment>StorageSlot</comment>
-        <translation>SAS Port %1</translation>
+        <translation type="unfinished">SAS Port %1</translation>
     </message>
     <message>
         <source>Floppy Device %1</source>
         <comment>StorageSlot</comment>
-        <translation>Device Floppy %1</translation>
+        <translation type="unfinished">Device Floppy %1</translation>
     </message>
     <message>
         <source>General</source>
         <comment>DetailsElementType</comment>
-        <translation>Umum</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Preview</source>
         <comment>DetailsElementType</comment>
-        <translation>Pratinjau</translation>
+        <translation type="unfinished">Pratinjau</translation>
     </message>
     <message>
         <source>System</source>
         <comment>DetailsElementType</comment>
-        <translation>Sistem</translation>
+        <translation type="unfinished">Sistem</translation>
     </message>
     <message>
         <source>Display</source>
         <comment>DetailsElementType</comment>
-        <translation>Tampilan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Storage</source>
         <comment>DetailsElementType</comment>
-        <translation>Penyimpanan</translation>
+        <translation type="unfinished">Penyimpanan</translation>
     </message>
     <message>
         <source>Audio</source>
         <comment>DetailsElementType</comment>
-        <translation>Suara</translation>
+        <translation type="unfinished">Suara</translation>
     </message>
     <message>
         <source>Network</source>
         <comment>DetailsElementType</comment>
-        <translation>Jaringan</translation>
+        <translation type="unfinished">Jaringan</translation>
     </message>
     <message>
         <source>Serial ports</source>
         <comment>DetailsElementType</comment>
-        <translation>Port serial</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Parallel ports</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>Shared folders</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished">Deskripsi</translation>
+    </message>
+    <message>
+        <source>Please choose a virtual hard drive file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>All virtual hard drive files (%1)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please choose a virtual optical disk file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>All virtual optical disk files (%1)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please choose a virtual floppy disk file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>All virtual floppy disk files (%1)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VDI (VirtualBox Disk Image)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VMDK (Virtual Machine Disk)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VHD (Virtual Hard Disk)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HDD (Parallels Hard Disk)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>QED (QEMU enhanced disk)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>QCOW (QEMU Copy-On-Write)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please choose a location for new virtual hard drive file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Parallel ports</source>
-        <comment>DetailsElementType</comment>
-        <translation>Port paralel</translation>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished">USB</translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>DetailsElementType</comment>
-        <translation>USB</translation>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Shared folders</source>
-        <comment>DetailsElementType</comment>
-        <translation>Folder bersama</translation>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Description</source>
-        <comment>DetailsElementType</comment>
-        <translation>Deskripsi</translation>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Please choose a virtual hard drive file</source>
-        <translation>Harap pilih berkas hard disk virtual</translation>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Tidak Ada</translation>
     </message>
     <message>
-        <source>All virtual hard drive files (%1)</source>
-        <translation>Semua berkas hard disk virtual (%1)</translation>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Please choose a virtual optical disk file</source>
-        <translation>Harap pilih berkas disk optik virtual</translation>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>All virtual optical disk files (%1)</source>
-        <translation>Semua berkas disk optik virtual (%1)</translation>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Please choose a virtual floppy disk file</source>
-        <translation>Pilih sebuah berkas disk floppy virtual</translation>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>All virtual floppy disk files (%1)</source>
-        <translation>Semua berkas disk floppy virtual (%1)</translation>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>VDI (VirtualBox Disk Image)</source>
-        <translation>VDI (VirtualBox Disk Image)</translation>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Aktif</translation>
     </message>
     <message>
-        <source>VMDK (Virtual Machine Disk)</source>
-        <translation>VMDK (Virtual Machine Disk)</translation>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>VHD (Virtual Hard Disk)</source>
-        <translation>VHD (Virtual Hard Disk)</translation>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Aktif</translation>
     </message>
     <message>
-        <source>HDD (Parallels Hard Disk)</source>
-        <translation>HDD (Parallels Hard Disk)</translation>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>QED (QEMU enhanced disk)</source>
-        <translation>QED (QEMU enhanced disk)</translation>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Aktif</translation>
     </message>
     <message>
-        <source>QCOW (QEMU Copy-On-Write)</source>
-        <translation>QCOW (QEMU Copy-On-Write)</translation>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Harap pilih lokasi untuk berkas hard disk virtual baru</translation>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Difungsikan</translation>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Dinonaktifkan</translation>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <comment>details report</comment>
-        <translation>Eksekusi Tanpa Batas</translation>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tetikus PS/2</translation>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
     </message>
     <message>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tetikus USB</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tetikus PS/2 dan USB</translation>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <translation>Eksekusi Tanpa Batas</translation>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tablet USB</translation>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tablet Multi-Sentuh USB</translation>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Jaringan NAT</translation>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>Jaringan NAT, '%1'</translation>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Anda dapat membuat atau menambah berkas image disk dalam pengaturan mesin virtual.</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12553,15 +13593,15 @@ Versi %1</translation>
     </message>
     <message>
         <source>The value '%1' of the key '%2' doesn't match the regexp constraint '%3'.</source>
-        <translation>Nilai '%1' dari kunci '%2' tidak cocok dengan batasan regexp '%3'.</translation>
+        <translation>Nilai '%1' dari key '%2' tidak match dengan konstrain regexp '%3'.</translation>
     </message>
     <message>
         <source>Cannot delete the key '%1'.</source>
-        <translation>Tidak dapat menghapus kunci '%1'.</translation>
+        <translation>Tidak dapat menghapus key '%1'.</translation>
     </message>
     <message>
         <source>'%1' is an invalid host-combination code-sequence.</source>
-        <translation>'%1' adalah urutan kode kombinasi host yang tidak valid.</translation>
+        <translation>'%1' adalah urutan kode kombinasi host yang tak valid.</translation>
     </message>
 </context>
 <context>
@@ -12816,11 +13856,11 @@ ke nilai awal bahasa sistem.</qt>
         <translation type="obsolete">Menampilkan path ke nilai awal folder VDI. Folder ini digunakan, bila tidak disebutkan sebaliknya secara eksplisit, saat menambahkan atau menciptakan hard disk virtual baru.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Me-reset path folder mesin virtual pada nilai awal. Path default aktual akan ditampilkan setelah menerima perubahan dan membuka dialog ini kembali.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Me-reset path folder VDI pada nilai awal. Path default aktual akan ditampilkan setelah menerima perubahan dan membuka dialog ini kembali.</translation>
     </message>
     <message>
@@ -12864,7 +13904,7 @@ ke nilai awal bahasa sistem.</qt>
         <translation type="obsolete">Buka dialog untuk memilih file VRDP authentication library file.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Me-reset file authentication library pada nilai awal. Path file library aktual akan ditampilkan setelah menerima perubahan dan membuka dialog ini kembali.</translation>
     </message>
     <message>
@@ -13221,7 +14261,7 @@ ke nilai awal bahasa sistem.</qt>
     </message>
     <message>
         <source>Re&fresh</source>
-        <translation>Sega&rkan</translation>
+        <translation>Re&fresh</translation>
     </message>
     <message>
         <source>Create a new virtual hard disk</source>
@@ -13233,15 +14273,15 @@ ke nilai awal bahasa sistem.</qt>
     </message>
     <message>
         <source>Remove the selected disk image file</source>
-        <translation>Hapus berkas image disk yang dipilih</translation>
+        <translation>Hapus medium yang dipilih</translation>
     </message>
     <message>
         <source>Release the selected disk image file by detaching it from the machines</source>
-        <translation>Lepas berkas image disk yang dipilih dengan mencopotnya dari mesin-mesin</translation>
+        <translation>Lepas medium yang dipilih dengan mencopotnya dari mesin</translation>
     </message>
     <message>
         <source>Refresh the list of disk image files</source>
-        <translation>Segarkan daftar berkas image disk</translation>
+        <translation>Refresh daftar media</translation>
     </message>
     <message>
         <source>Location</source>
@@ -13385,16 +14425,28 @@ ke nilai awal bahasa sistem.</qt>
     </message>
     <message>
         <source>Copy an existing disk image file</source>
-        <translation>Salin berkas image disk yang ada</translation>
+        <translation>Salin media yang ada</translation>
     </message>
     <message>
         <source>Modify the attributes of the selected disk image file</source>
-        <translation>Ubah atribut berkas image disk yang dipilih</translation>
+        <translation>Ubah atribut medium yang dipilih</translation>
     </message>
     <message>
         <source>C&lose</source>
         <translation type="obsolete">&Tutup</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13468,8 +14520,8 @@ ke nilai awal bahasa sistem.</qt>
         <translation type="obsolete">Dialog Registrasi VirtualBox</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Mohon isi formulir registrasi ini agar kami dapat mengetahui bahwa anda menggunakan VirtualBox dans ecara opsional, untuk menjaga anda tetap terinformasikan mengenai berita dan update VirtualBox.</p><p>Masukkan nama lengkap anda menggunakan karakter latin dan alamat e-mail anda pada field di bawah. Mohon perhatikan bahwa innotek akan menggunakan informasi ini hanya untuk mengumpulkan statistik penggunaan produkdan mengirimi anda n [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Mohon isi formulir registrasi ini agar kami dapat mengetahui bahwa anda menggunakan VirtualBox dans ecara opsional, untuk menjaga anda tetap terinformasikan mengenai berita dan update VirtualBox.</p><p>Masukkan nama lengkap anda menggunakan karakter latin dan alamat e-mail anda pada field di bawah. Mohon perhatikan bahwa innotek akan menggunakan informasi ini hanya untuk mengumpulkan statistik penggunaan produkdan mengirimi anda n [...]
     </message>
     <message>
         <source>&Name</source>
@@ -13516,8 +14568,8 @@ ke nilai awal bahasa sistem.</qt>
         <translation type="obsolete">Tidak dapat melakukan handshake koneksi.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Silahkan mengisi formulir registration ini agar dapat memberi tahu kami bahwa anda menggunakan VirtualBox dan, secara opsional, untuk menjaga anda tetap memperoleh informasi tentang berita seputar VirtualBox dan update.</p><p>Masukkan nama lengkap anda menggunakan karakter Latin dan alamat  e-mail anda pada field dibawah ini. Perhatikan bahwa Sun Microsystems akan menggunakan informasi ini hanya untuk mengumpulkan statistik penggu [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Silahkan mengisi formulir registration ini agar dapat memberi tahu kami bahwa anda menggunakan VirtualBox dan, secara opsional, untuk menjaga anda tetap memperoleh informasi tentang berita seputar VirtualBox dan update.</p><p>Masukkan nama lengkap anda menggunakan karakter Latin dan alamat  e-mail anda pada field dibawah ini. Perhatikan bahwa Sun Microsystems akan menggunakan informasi ini hanya untuk mengumpulkan statistik penggu [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -13822,8 +14874,8 @@ ke nilai awal bahasa sistem.</qt>
         <translation type="obsolete">Tahan eksekusi mesin virtual</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Selamat datang di VirtualBox!</h3><p>Bagian kiri dari jendela ini ditujukan untuk menampilkan daftar dari semua mesin virtual dalam komputer Anda. Daftar ini saat ini kosong karena Anda belum menciptakan mesin virtual apapun.<img src=:/welcome.png align=right/></p><p>Untuk menciptakan mesin virtual baru, tekan tombol <b>Baru</b> pada toolbar utama yang terletak di bagian atas jendela.</p><p& [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Selamat datang di VirtualBox!</h3><p>Bagian kiri dari jendela ini ditujukan untuk menampilkan daftar dari semua mesin virtual dalam komputer Anda. Daftar ini saat ini kosong karena Anda belum menciptakan mesin virtual apapun.<img src=:/welcome.png align=right/></p><p>Untuk menciptakan mesin virtual baru, tekan tombol <b>Baru</b> pada toolbar utama yang terletak di bagian atas jendela.</p><p& [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -14111,11 +15163,11 @@ untuk mengaksesnya dari sebuah SIstem Operasi Linux. Fitur ini membutuhkan Guest
     </message>
     <message>
         <source>Details of %1 (%2)</source>
-        <translation>Rincian dari %1 (%2)</translation>
+        <translation>Detail dari %1 (%2)</translation>
     </message>
     <message>
         <source>Click to enlarge the screenshot.</source>
-        <translation>Klik untuk memperbesar cuplikan layar.</translation>
+        <translation>Klik untuk memperbesar screenshot.</translation>
     </message>
     <message>
         <source>&Name:</source>
@@ -14195,12 +15247,12 @@ untuk mengaksesnya dari sebuah SIstem Operasi Linux. Fitur ini membutuhkan Guest
     <message>
         <source>Current State (changed)</source>
         <comment>Current State (Modified)</comment>
-        <translation>Keadaan Saat Ini (berubah)</translation>
+        <translation>Keadaan Saat ini (berubah)</translation>
     </message>
     <message>
         <source>Current State</source>
         <comment>Current State (Unmodified)</comment>
-        <translation>Keadaan Saat Ini</translation>
+        <translation>Keadaan Saat ini</translation>
     </message>
     <message>
         <source>The current state differs from the state stored in the current snapshot</source>
@@ -14218,12 +15270,12 @@ untuk mengaksesnya dari sebuah SIstem Operasi Linux. Fitur ini membutuhkan Guest
     <message>
         <source>online)</source>
         <comment>Snapshot details</comment>
-        <translation>daring)</translation>
+        <translation>online)</translation>
     </message>
     <message>
         <source>offline)</source>
         <comment>Snapshot details</comment>
-        <translation>luring)</translation>
+        <translation>offline)</translation>
     </message>
     <message>
         <source>Taken at %1</source>
@@ -14294,7 +15346,7 @@ untuk mengaksesnya dari sebuah SIstem Operasi Linux. Fitur ini membutuhkan Guest
     </message>
     <message>
         <source>&Restore Snapshot</source>
-        <translation>&Pulihkan Snapshot</translation>
+        <translation>&Kembalikan Snapshot</translation>
     </message>
     <message>
         <source>&Delete Snapshot</source>
@@ -14302,11 +15354,11 @@ untuk mengaksesnya dari sebuah SIstem Operasi Linux. Fitur ini membutuhkan Guest
     </message>
     <message>
         <source>Restore the selected snapshot of the virtual machine</source>
-        <translation>Pulihkan snapshot yang dipilih dari mesin virtual</translation>
+        <translation>Kembalikan snapshot dari mesin virtual yang dipilih</translation>
     </message>
     <message>
         <source>Delete the selected snapshot of the virtual machine</source>
-        <translation>Hapus snapshot yang dipilih dari mesin virtual</translation>
+        <translation>Hapus snapshot dari mesin virtual yang dipilih</translation>
     </message>
     <message>
         <source> (%1 ago)</source>
@@ -14529,12 +15581,12 @@ dengan nilai apapun.</qt></translation>
     <message>
         <source><no devices available></source>
         <comment>USB devices</comment>
-        <translation><tidak ada perangkat tersedia></translation>
+        <translation><tidak ada device tersedia></translation>
     </message>
     <message>
         <source>No supported devices connected to the host PC</source>
         <comment>USB device tooltip</comment>
-        <translation>Tidak ada perangkat yang didukung yang terhubung ke PC host</translation>
+        <translation>Tidak ada device yang terdukung terkoneksi pada PC host</translation>
     </message>
 </context>
 <context>
@@ -14564,163 +15616,6 @@ dengan nilai apapun.</qt></translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Dialog Informasi Sesi</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">&Tutup</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Informasi Sesi</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detail</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Runtime</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transfer DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transfer PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Data Terbaca</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Data Tertulis</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Data Terkirim</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Data Diterima</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Menyala</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Mati</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Atribut Runtime</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Resolusi Layar</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Statistik CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Statistik Adapter Jaringan</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Tidak terpasang</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Versi %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Tidak Terdeteksi</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Tidak Terdeteksi</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Guest Additions</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Tipe OS Guest</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Statistik Hard Disk</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Tidak Ada Hard Disk</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Tidak Ada Adaptor Jaringan</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Menyala</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Mati</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Statistik Penyimpanan</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Tidak Ada Perangkat Penyimpanan</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Statistik Jaringan</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Tidak Tersedia</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Mode Papan Klip</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Mode Drag'n'Drop</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>&Rincian Konfigurasi</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Informasi &Runtime</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -15541,7 +16436,7 @@ fitur ini setelah menginstall sebuah sistem operasi guest Windows!</qt></t
         <translation type="obsolete">Menampilkan path dimana snapshot dari mesin virtual akan disimpan. Perhatikan bahwa snapshot dapat menghabiskan banyak ruang disk.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Me-reset path folder snapshot pada nilai awal. Path default aktual akan ditampilkan setelah menerima perubahan dan membuka dialog ini kembali.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_it.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_it.ts
index ee12025..7bc7820 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_it.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_it.ts
@@ -304,19 +304,19 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Disabilita l'integrazione &mouse (MI)</translation>
+        <translation type="obsolete">Disabilita l'integrazione &mouse (MI)</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Disabilita temporaneamente l'integrazione con il puntatore del mouse</translation>
+        <translation type="obsolete">Disabilita temporaneamente l'integrazione con il puntatore del mouse</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Invia Ctrl-Alt-Canc</translation>
+        <translation type="obsolete">&Invia Ctrl-Alt-Canc</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Invia la sequenza Ctrl-Alt-Canc alla macchina virtuale</translation>
+        <translation type="obsolete">Invia la sequenza Ctrl-Alt-Canc alla macchina virtuale</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -324,7 +324,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Invia la sequenza Ctrl-Alt-Backspace alla macchina virtuale</translation>
+        <translation type="obsolete">Invia la sequenza Ctrl-Alt-Backspace alla macchina virtuale</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -380,15 +380,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Dispositivi &CD/DVD</translation>
+        <translation type="obsolete">Dispositivi &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Dispositivi &floppy</translation>
+        <translation type="obsolete">Dispositivi &floppy</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Dispositivi &USB</translation>
+        <translation type="obsolete">Dispositivi &USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -455,15 +455,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Passa a sc&hermo intero</translation>
+        <translation type="obsolete">Passa a sc&hermo intero</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Passa da schermo normale a schermo intero</translation>
+        <translation type="obsolete">Passa da schermo normale a schermo intero</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Passa a&lla modalità trasparente</translation>
+        <translation type="obsolete">Passa a&lla modalità trasparente</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -471,7 +471,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Passa alla modalità &scalata</translation>
+        <translation type="obsolete">Passa alla modalità &scalata</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -507,7 +507,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Moda&lità trasparente</translation>
+        <translation>Moda&lità trasparente</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -548,7 +548,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&Registrazione...</translation>
+        <translation type="obsolete">&Registrazione...</translation>
     </message>
     <message>
         <source>Enter &Fullscreen Mode</source>
@@ -786,7 +786,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Invia Ctrl-Alt-Backspac&e</translation>
+        <translation type="obsolete">Invia Ctrl-Alt-Backspac&e</translation>
     </message>
     <message>
         <source>Sort List</source>
@@ -1070,7 +1070,7 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Trascina e rilascia</translation>
+        <translation type="obsolete">Trascina e rilascia</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
@@ -1128,7 +1128,215 @@
     </message>
     <message>
         <source>Network</source>
-        <translation type="unfinished">Rete</translation>
+        <translation>Rete</translation>
+    </message>
+    <message>
+        <source>&VirtualBox</source>
+        <translation>&VirtualBox</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>&File</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation>&Finestra</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>&Minimizza</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>Minimizza la finestra della macchina attiva</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>Modalità scher&mo intero</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>Passa dalla modalità normale a quella a schermo intero</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>Modalità s&calata</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>Barra dei &menu</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>Impostazioni barra dei &menu...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>Apre la finestra per configurare la barra dei menu</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>Mostra &barra dei menu</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>Commuta la visibilità della barra dei menu per questa macchina</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>Barra di &stato</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>Impostazioni barra di &stato...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>Apre la finestra per configurare la barra di stato</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>Mostra &barra di stato</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>Commuta la visibilità della barra di stato per questa macchina</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>Fattore di s&cala</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>&Inserimento</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>&Tastiera</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>Impostazio&ni della tastiera...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>Visualizza la finestra delle impostazioni globali per configurare le scorciatoie</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>&Inserisci %1</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>Invia la sequenza %1 alla macchina virtuale</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>&Mouse</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>Integrazione &mouse</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>Abilita l'integrazione con il puntatore del mouse dell'host</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>&Dischi fissi</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>Impostazioni dei &dischi fissi...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>Cambia le impostazioni dei dischi fissi</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>Lettori &ottici</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>Lettori &floppy</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation>&USB</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>Impostazioni &USB...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>Cambia le impostazioni dei dispositivi USB</translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>Trascinamento e rilascio</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>Cartelle condivi&se</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>&Registrazione</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>Mostra &log...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation>Ge&store dati aggiuntivi...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>Mostra la finestra del Gestore dati aggiuntivi</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation>Avvio &normale</translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation>A&vvio senza finestra</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation>Avvia le macchine virtuali selezionate sullo sfondo</translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation>Avvio sgancia&bile</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation>Avvia le macchine virtuali selezionate con la possibilità di proseguire l'esecuzione sullo sfondo</translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation>%1%</translation>
+    </message>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>Abilita</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>Ridimensiona a %1x%2</translation>
     </message>
 </context>
 <context>
@@ -1139,6 +1347,21 @@
     </message>
 </context>
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - Cifratura del disco</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>Questa macchina virtuale è protetta da password. Digita la password di cifratura di seguito.</numerusform>
+            <numerusform>Questa macchina virtuale è protetta da password. Digita le %n password di cifratura di seguito.</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIApplianceEditorWidget</name>
     <message>
         <source>Virtual System %1</source>
@@ -1944,6 +2167,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation>Recupero dei dati in corso...</translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1954,7 +2184,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Rimozione dati in corso...</translation>
+        <translation type="obsolete">Rimozione dati in corso...</translation>
     </message>
 </context>
 <context>
@@ -2066,6 +2296,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation>Stato</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation>ID</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>Password</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>Utilizzato dal seguente disco fisso:</nobr><br>%1</numerusform>
+            <numerusform><nobr>Utilizzato dai seguenti %n dischi fissi:</nobr><br>%1</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Appliance Export Wizard</source>
@@ -2799,7 +3055,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -3040,6 +3296,116 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>Risoluzione: %1x%2, Velocità: %3, Bitrate: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Paravirtualizzazione minimale</translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Paravirtualizzazione Hyper-V</translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Paravirtualizzazione KVM</translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[Lettori ottici]</translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>Controller USB</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Fattore di scala</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Uscita video HiDPI non scalata</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Abilitata</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>Posizione barra degli strumenti piccola</translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>Alto</translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>Basso</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>Barra degli strumenti piccola</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>Disabilitata</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation>Fattore di scala</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation>Uscita video HiDPI non scalata</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation>Abilitata</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation>Barra dei menu</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation>Abilitata</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation>Disabilitata</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation>Barra di stato</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation>Abilitata</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation>Disabilitata</translation>
+    </message>
 </context>
 <context>
     <name>UIGDetailsUpdateThreadAudio</name>
@@ -3438,15 +3804,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Machine Windows:</source>
-        <translation type="unfinished"></translation>
+        <translation>Finestre delle macchine:</translation>
     </message>
     <message>
         <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation type="unfinished"></translation>
+        <translation>Se marcata, le finestre delle macchine saranno alzate quando il puntatore del mouse le sorvola.</translation>
     </message>
     <message>
         <source>&Raise Window Under Mouse</source>
-        <translation type="unfinished"></translation>
+        <translation>Alza la finest&ra sotto il mouse</translation>
     </message>
 </context>
 <context>
@@ -3556,15 +3922,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation>&Pannello e barra dei menu:</translation>
+        <translation type="obsolete">&Pannello e barra dei menu:</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation>Mostra automaticamente a schermo intero</translation>
+        <translation type="obsolete">Mostra automaticamente a schermo intero</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Se marcata, il pannello e la barra dei menu dell'host saranno mostrati quando la macchina virtuale è in modalità a schermo intero.</translation>
+        <translation type="obsolete">Se marcata, il pannello e la barra dei menu dell'host saranno mostrati quando la macchina virtuale è in modalità a schermo intero.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
@@ -4779,12 +5145,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica l'attività dei dispositivi CD/DVD:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica l'attività dei dispositivi CD/DVD:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica l'attività dei dispositivi floppy:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica l'attività dei dispositivi floppy:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4824,7 +5190,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Il controller USB è disabilitato</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Il controller USB è disabilitato</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4888,6 +5254,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation>Stato delle funzionalità aggiuntive:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Indica l'attività dei lettori ottici:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Indica l'attività dei lettori di floppy:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>Indica l'attività dello schermo:</nobr>%1</p></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4964,11 +5344,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation type="unfinished"></translation>
+        <translation>Connetti scheda di rete</translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Connetti scheda di rete %1</translation>
     </message>
 </context>
 <context>
@@ -5010,7 +5390,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Video</translation>
+        <translation type="obsolete">&Video</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -5198,7 +5578,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>La macchina virtuale è configurata per utilizzare l'accelerazione grafica hardware e il sistema operativo è impostato a Windows Vista o successivo. Per migliori prestazioni, dovresti impostare la memoria video della macchina almeno a <b>%1</b>.</translation>
+        <translation type="obsolete">La macchina virtuale è configurata per utilizzare l'accelerazione grafica hardware e il sistema operativo è impostato a Windows Vista o successivo. Per migliori prestazioni, dovresti impostare la memoria video della macchina almeno a <b>%1</b>.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -5253,7 +5633,59 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Lo schermo  remoto è attualmente abilitato per questa macchina virtuale. Tuttavia, ciò richiede che <b>%1</b> sia installato. Installa l'Extension Pack scaricabile dal sito di VirtualBox altrimenti la MV sarà avviata senza schermo remoto.</translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation>Lo schermo  remoto è attualmente abilitato per questa macchina virtuale. Tuttavia, ciò richiede che <b>%1</b> sia installato. Installa l'Extension Pack scaricabile dal sito di VirtualBox altrimenti la MV sarà avviata senza schermo remoto.</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>Circa %1MB per 5 minuti di video</i></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation>La macchina virtuale è configurata per utilizzare l'accelerazione grafica hardware e il sistema operativo è impostato a Windows Vista o successivo. Per avere le prestazioni migliori, dovresti impostare la memoria video della macchina almeno a <b>%1</b>.</translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation>&Schermo</translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation>Fattore di scala:</translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation>Controlla il fattore di scala dello schermo del guest.</translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation>100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation>200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation>%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation>HiDPI:</translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation>Se marcata, il contenuto dello schermo del guest non sarà riscalata per compensare in caso di risoluzioni elevate dello schermo dell'host.</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation>&Usa uscita HiDPI non scalata</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation>Accelerazione:</translation>
     </message>
 </context>
 <context>
@@ -5264,7 +5696,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Basic</source>
-        <translation>&Base</translation>
+        <translation type="obsolete">&Base</translation>
     </message>
     <message>
         <source>&Name:</source>
@@ -5276,7 +5708,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Advanced</source>
-        <translation>&Avanzate</translation>
+        <translation type="obsolete">&Avanzate</translation>
     </message>
     <message>
         <source>&Shared Clipboard:</source>
@@ -5292,7 +5724,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Description</source>
-        <translation>&Descrizione</translation>
+        <translation type="obsolete">&Descrizione</translation>
     </message>
     <message>
         <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
@@ -5300,35 +5732,35 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Se marcata, ogni modifica ai supporti CD/DVD o floppy montati effettuata durante l'esecuzione della macchina sarà salvata nel file delle impostazioni per preservare la configurazione dei supporti tra i diversi avvii della macchina.</translation>
+        <translation type="obsolete">Se marcata, ogni modifica ai supporti CD/DVD o floppy montati effettuata durante l'esecuzione della macchina sarà salvata nel file delle impostazioni per preservare la configurazione dei supporti tra i diversi avvii della macchina.</translation>
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Supporto rimovibile:</translation>
+        <translation type="obsolete">Supporto rimovibile:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Memo&rizza le modifiche in esecuzione</translation>
+        <translation type="obsolete">Memo&rizza le modifiche in esecuzione</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Barra degli strumenti piccola:</translation>
+        <translation type="obsolete">Barra degli strumenti piccola:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Se marcata, mostra la barra degli strumenti piccola nelle modalità a schermo intero e trasparente.</translation>
+        <translation type="obsolete">Se marcata, mostra la barra degli strumenti piccola nelle modalità a schermo intero e trasparente.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Mostra a scher&mo intero/trasparente</translation>
+        <translation type="obsolete">Mostra a scher&mo intero/trasparente</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Se selezionata, mostra la barra degli strumenti piccola nella parte superiore dello schermo, invece che nella posizione predefinita (in basso).</translation>
+        <translation type="obsolete">Se selezionata, mostra la barra degli strumenti piccola nella parte superiore dello schermo, invece che nella posizione predefinita (in basso).</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Most&ra nella parte alta dello schermo</translation>
+        <translation type="obsolete">Most&ra nella parte alta dello schermo</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
@@ -5391,128 +5823,264 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Sposta in alto (Ctrl-Su)</translation>
     </message>
     <message>
-        <source>Moves the selected boot device up.</source>
-        <translation type="obsolete">Sposta in alto il dispositivo di avvio selezionato.</translation>
+        <source>Moves the selected boot device up.</source>
+        <translation type="obsolete">Sposta in alto il dispositivo di avvio selezionato.</translation>
+    </message>
+    <message>
+        <source>Move Down (Ctrl-Down)</source>
+        <translation type="obsolete">Sposta in basso (Ctrl-Giù)</translation>
+    </message>
+    <message>
+        <source>Moves the selected boot device down.</source>
+        <translation type="obsolete">Sposta in basso il dispositivo di avvio selezionato.</translation>
+    </message>
+    <message>
+        <source>Extended Features:</source>
+        <translation type="obsolete">Funzionalità estese:</translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will support the Advanced Configuration and Power Management Interface (ACPI). <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
+        <translation type="obsolete">Se marcata, la macchina virtuale supporterà la configurazione avanzata e l'interfaccia di gestione energetica (ACPI). <b>Nota:</b> non disabilitare questa funzionalità dopo aver installato un sistema operativo guest Windows!</translation>
+    </message>
+    <message>
+        <source>Enable A&CPI</source>
+        <translation type="obsolete">Abilita A&CPI</translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will support the Input Output APIC (I/O APIC), which may slightly decrease performance. <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
+        <translation type="obsolete">Se marcata, la macchina virtuale supporterà l'Input Output APIC (I/O APIC), che potrebbe leggermente ridurre le prestazioni della macchina virtuale. <b>Nota:</b> non disabilitare questa funzionalità dopo aver installato un sistema operativo guest Windows!</translation>
+    </message>
+    <message>
+        <source>Enable IO A&PIC</source>
+        <translation type="obsolete">Abilita IO A&PIC</translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V.</source>
+        <translation type="obsolete">Se marcata, la macchina virtuale proverà a utilizzare le estensioni di virtualizzazione della CPU host come Intel VT-x e AMD-V.</translation>
+    </message>
+    <message>
+        <source>Enable &VT-x/AMD-V</source>
+        <translation type="obsolete">Abilita &VT-x/AMD-V</translation>
+    </message>
+    <message>
+        <source>When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine.</source>
+        <translation type="obsolete">Se marcata, la funzionalità di estensione dell'indirizzo fisico (PAE) della CPU dell'host sarà esposta alla macchina virtuale.</translation>
+    </message>
+    <message>
+        <source>Enable PA&E/NX</source>
+        <translation type="obsolete">Abilita PA&E/NX</translation>
+    </message>
+    <message>
+        <source>Defines the type of the virtual IDE controller. Depending on this value, VirtualBox will provide different virtual IDE hardware devices to the guest OS.</source>
+        <translation type="obsolete">Definisce il tipo di controller IDE virtuale. A seconda di questo valore, VirtualBox fornirà hardware IDE virtuale diverso al sistema guest.</translation>
+    </message>
+    <message>
+        <source>&IDE Controller Type:</source>
+        <translation type="obsolete">Tipo di controller &IDE:</translation>
+    </message>
+    <message>
+        <source>&Other</source>
+        <translation type="obsolete">&Altro</translation>
+    </message>
+    <message>
+        <source>&Remember Mounted Media</source>
+        <translation type="obsolete">&Ricorda i supporti montati</translation>
+    </message>
+    <message>
+        <source>Runtime:</source>
+        <translation type="obsolete">Esecuzione:</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>75%</b> of your computer's memory (<b>%1</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
+        <translation type="obsolete">hai assegnato più del <b>75%</b> della memoria del tuo computer (<b>%1</b>) alla macchina virtuale. Non è rimasta memoria sufficiente al sistema operativo host. Seleziona un quantitativo minore. </translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>50%</b> of your computer's memory (<b>%1</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
+        <translation type="obsolete">hai assegnato più del <b>50%</b> della memoria del tuo computer (<b>%1</b>) alla macchina virtuale. Potrebbe non essere rimasta memoria sufficiente al sistema operativo host. Continua a tuo rischio. </translation>
+    </message>
+    <message>
+        <source>you have assigned less than <b>%1</b> of video memory which is the minimum amount required to switch the virtual machine to fullscreen or seamless mode.</source>
+        <translation type="obsolete">hai assegnato meno di <b>%1</b> alla memoria video che è il minimo richiesto per passare dalla modalità a schermo intero a quella trasparente.</translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will be given access to the 3D graphics capabilities available on the host.</source>
+        <translation type="obsolete">Se marcata, la macchina virtuale accederà alle capacità grafiche 3D disponibili sull'host.</translation>
+    </message>
+    <message>
+        <source>Enable &3D Acceleration</source>
+        <translation type="obsolete">Abilita accelerazione &3D</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
+        <translation type="obsolete">hai assegnato più di <b>%1%</b> della memoria del computer (<b>%2</b>) alla macchina virtuale. Non è rimasta memoria sufficiente per il sistema operativo host. Seleziona una quantità minore.</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
+        <translation type="obsolete">hai assegnato più di <b>%1%</b> della memoria del computer (<b>%2</b>) alla macchina virtuale. Potrebbe non essere rimasta memoria sufficiente per il sistema operativo host. Continua a tuo rischio.</translation>
+    </message>
+    <message>
+        <source>there is a 64 bits guest OS type assigned for this VM, which requires virtualization feature (VT-x/AMD-V) to be enabled too, else your guest will fail to detect a 64 bits CPU and will not be able to boot, so this feature will be enabled automatically when you'll accept VM Settings by pressing OK button.</source>
+        <translation type="obsolete">un tipo di sistema operativo guest a 64 bit è assegnato a questa MV, che richiede l'abilitazione di funzionalità di virtualizzazione (VT-x/AMD-V). Diversamente il guest non riuscirà a rilevare la CPU a 64 bit e non potrà avviarsi, perciò questa funzionalità sarà abilitata automaticamente all'accettazione delle impostazioni della MV premendo il pulsante OK.</translation>
+    </message>
+    <message>
+        <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source>
+        <translation type="obsolete">Se marcata, la macchina virtuale proverà a utilizzare l'estensione di paginazione nidificata di Intel VT-x e AMD-V.</translation>
+    </message>
+    <message>
+        <source>Enable Nested Pa&ging</source>
+        <translation type="obsolete">Abilita pa&ginazione nidificata</translation>
+    </message>
+    <message>
+        <source>&Drag'n'Drop:</source>
+        <translation type="obsolete">Trasci&na e rilascia:</translation>
+    </message>
+    <message>
+        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <translation>Seleziona quali dati saranno copiati tra il guest e l'host tramite l'operazione di trascinamento e rilascio. Questa funzionalità richiede l'installazione delle Guest Additions nel sistema operativo del guest.</translation>
+    </message>
+    <message>
+        <source>No name specified for the virtual machine.</source>
+        <translation>Nessun nome specificato per la macchina virtuale.</translation>
+    </message>
+    <message>
+        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <translation>Il sistema operativo della macchina virtuale è impostato a 64 bit. I sistemi guest a 64 bit richiedono la virtualizzazione hardware, che sarà abilitata se confermi le modifiche.</translation>
+    </message>
+    <message>
+        <source>Basi&c</source>
+        <translation>&Base</translation>
+    </message>
+    <message>
+        <source>A&dvanced</source>
+        <translation>A&vanzate</translation>
+    </message>
+    <message>
+        <source>D&rag'n'Drop:</source>
+        <translation>Trasci&na e rilascia:</translation>
     </message>
     <message>
-        <source>Move Down (Ctrl-Down)</source>
-        <translation type="obsolete">Sposta in basso (Ctrl-Giù)</translation>
+        <source>D&escription</source>
+        <translation>D&escrizione</translation>
     </message>
     <message>
-        <source>Moves the selected boot device down.</source>
-        <translation type="obsolete">Sposta in basso il dispositivo di avvio selezionato.</translation>
+        <source>Enc&ryption</source>
+        <translation>Cif&ratura</translation>
     </message>
     <message>
-        <source>Extended Features:</source>
-        <translation type="obsolete">Funzionalità estese:</translation>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>Se marcata, abilita la cifratura per questa macchina virtuale.</translation>
     </message>
     <message>
-        <source>When checked, the virtual machine will support the Advanced Configuration and Power Management Interface (ACPI). <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
-        <translation type="obsolete">Se marcata, la macchina virtuale supporterà la configurazione avanzata e l'interfaccia di gestione energetica (ACPI). <b>Nota:</b> non disabilitare questa funzionalità dopo aver installato un sistema operativo guest Windows!</translation>
+        <source>En&able Encryption</source>
+        <translation>&Abilita cifratura</translation>
     </message>
     <message>
-        <source>Enable A&CPI</source>
-        <translation type="obsolete">Abilita A&CPI</translation>
+        <source>Encryption C&ipher:</source>
+        <translation>C&ifrario:</translation>
     </message>
     <message>
-        <source>When checked, the virtual machine will support the Input Output APIC (I/O APIC), which may slightly decrease performance. <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
-        <translation type="obsolete">Se marcata, la macchina virtuale supporterà l'Input Output APIC (I/O APIC), che potrebbe leggermente ridurre le prestazioni della macchina virtuale. <b>Nota:</b> non disabilitare questa funzionalità dopo aver installato un sistema operativo guest Windows!</translation>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>Contiene il cifrario che deve essere utilizzato per cifrare i dischi della macchina virtuale.</translation>
     </message>
     <message>
-        <source>Enable IO A&PIC</source>
-        <translation type="obsolete">Abilita IO A&PIC</translation>
+        <source>E&nter New Password:</source>
+        <translation>Digita la &nuova password:</translation>
     </message>
     <message>
-        <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V.</source>
-        <translation type="obsolete">Se marcata, la macchina virtuale proverà a utilizzare le estensioni di virtualizzazione della CPU host come Intel VT-x e AMD-V.</translation>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>Contiene la password che deve essere assegnata alla macchina virtuale.</translation>
     </message>
     <message>
-        <source>Enable &VT-x/AMD-V</source>
-        <translation type="obsolete">Abilita &VT-x/AMD-V</translation>
+        <source>C&onfirm New Password:</source>
+        <translation>C&onferma la nuova password:</translation>
     </message>
     <message>
-        <source>When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine.</source>
-        <translation type="obsolete">Se marcata, la funzionalità di estensione dell'indirizzo fisico (PAE) della CPU dell'host sarà esposta alla macchina virtuale.</translation>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>Conferma la password che devono essere assegnate alla macchina virtuale.</translation>
     </message>
     <message>
-        <source>Enable PA&E/NX</source>
-        <translation type="obsolete">Abilita PA&E/NX</translation>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>Stai tentando di cifrare questa macchina virtuale. Tuttavia, ciò richiede che <b>%1</b> sia installato. Installa l'Extension Pack scaricabile dal sito di VirtualBox.</translation>
     </message>
     <message>
-        <source>Defines the type of the virtual IDE controller. Depending on this value, VirtualBox will provide different virtual IDE hardware devices to the guest OS.</source>
-        <translation type="obsolete">Definisce il tipo di controller IDE virtuale. A seconda di questo valore, VirtualBox fornirà hardware IDE virtuale diverso al sistema guest.</translation>
+        <source>Encryption cipher type not specified.</source>
+        <translation>Tipo di cifrario non specificato.</translation>
     </message>
     <message>
-        <source>&IDE Controller Type:</source>
-        <translation type="obsolete">Tipo di controller &IDE:</translation>
+        <source>Encryption password empty.</source>
+        <translation>La password di cifratura è vuota.</translation>
     </message>
     <message>
-        <source>&Other</source>
-        <translation type="obsolete">&Altro</translation>
+        <source>Encryption passwords do not match.</source>
+        <translation>Le password di cifratura non coincidono.</translation>
     </message>
     <message>
-        <source>&Remember Mounted Media</source>
-        <translation type="obsolete">&Ricorda i supporti montati</translation>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>Lascia inalterato</translation>
     </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
     <message>
-        <source>Runtime:</source>
-        <translation type="obsolete">Esecuzione:</translation>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>Consente la modifica dei contenuti della barra dei menu della MV.</translation>
     </message>
     <message>
-        <source>you have assigned more than <b>75%</b> of your computer's memory (<b>%1</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">hai assegnato più del <b>75%</b> della memoria del tuo computer (<b>%1</b>) alla macchina virtuale. Non è rimasta memoria sufficiente al sistema operativo host. Seleziona un quantitativo minore. </translation>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">Fattore di scala dello schermo:</translation>
     </message>
     <message>
-        <source>you have assigned more than <b>50%</b> of your computer's memory (<b>%1</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">hai assegnato più del <b>50%</b> della memoria del tuo computer (<b>%1</b>) alla macchina virtuale. Potrebbe non essere rimasta memoria sufficiente al sistema operativo host. Continua a tuo rischio. </translation>
+        <source>This setting determines the guest screen scale factor.</source>
+        <translation type="obsolete">Questa impostazione determina il fattore di scala dello schermo del guest.</translation>
     </message>
     <message>
-        <source>you have assigned less than <b>%1</b> of video memory which is the minimum amount required to switch the virtual machine to fullscreen or seamless mode.</source>
-        <translation type="obsolete">hai assegnato meno di <b>%1</b> alla memoria video che è il minimo richiesto per passare dalla modalità a schermo intero a quella trasparente.</translation>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
     </message>
     <message>
-        <source>When checked, the virtual machine will be given access to the 3D graphics capabilities available on the host.</source>
-        <translation type="obsolete">Se marcata, la macchina virtuale accederà alle capacità grafiche 3D disponibili sull'host.</translation>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
     </message>
     <message>
-        <source>Enable &3D Acceleration</source>
-        <translation type="obsolete">Abilita accelerazione &3D</translation>
+        <source>%</source>
+        <translation type="obsolete">%</translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">hai assegnato più di <b>%1%</b> della memoria del computer (<b>%2</b>) alla macchina virtuale. Non è rimasta memoria sufficiente per il sistema operativo host. Seleziona una quantità minore.</translation>
+        <source>HiDPI:</source>
+        <translation type="obsolete">HiDPI:</translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">hai assegnato più di <b>%1%</b> della memoria del computer (<b>%2</b>) alla macchina virtuale. Potrebbe non essere rimasta memoria sufficiente per il sistema operativo host. Continua a tuo rischio.</translation>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">Se marcata, il contenuto dello schermo del guest non sarà scalato per compensare in caso di alte risoluzioni dello schermo dell'host.</translation>
     </message>
     <message>
-        <source>there is a 64 bits guest OS type assigned for this VM, which requires virtualization feature (VT-x/AMD-V) to be enabled too, else your guest will fail to detect a 64 bits CPU and will not be able to boot, so this feature will be enabled automatically when you'll accept VM Settings by pressing OK button.</source>
-        <translation type="obsolete">un tipo di sistema operativo guest a 64 bit è assegnato a questa MV, che richiede l'abilitazione di funzionalità di virtualizzazione (VT-x/AMD-V). Diversamente il guest non riuscirà a rilevare la CPU a 64 bit e non potrà avviarsi, perciò questa funzionalità sarà abilitata automaticamente all'accettazione delle impostazioni della MV premendo il pulsante OK.</translation>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">&Usa uscita HiDPI non scalata</translation>
     </message>
     <message>
-        <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source>
-        <translation type="obsolete">Se marcata, la macchina virtuale proverà a utilizzare l'estensione di paginazione nidificata di Intel VT-x e AMD-V.</translation>
+        <source>Mini ToolBar:</source>
+        <translation>Barra degli strumenti piccola:</translation>
     </message>
     <message>
-        <source>Enable Nested Pa&ging</source>
-        <translation type="obsolete">Abilita pa&ginazione nidificata</translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation>Se marcata, mostra la barra degli strumenti piccola nelle modalità a schermo intero e trasparente.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
-        <translation>Trasci&na e rilascia:</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation>Mostra a scher&mo intero/trasparente</translation>
     </message>
     <message>
-        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>Seleziona quali dati saranno copiati tra il guest e l'host tramite l'operazione di trascinamento e rilascio. Questa funzionalità richiede l'installazione delle Guest Additions nel sistema operativo del guest.</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation>Se selezionata, mostra la barra degli strumenti piccola nella parte superiore dello schermo, invece che nella posizione predefinita (in basso).</translation>
     </message>
     <message>
-        <source>No name specified for the virtual machine.</source>
-        <translation>Nessun nome specificato per la macchina virtuale.</translation>
+        <source>Show at &Top of Screen</source>
+        <translation>Most&ra nella parte alta dello schermo</translation>
     </message>
     <message>
-        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>Il sistema operativo della macchina virtuale è impostato a 64 bit. I sistemi guest a 64 bit richiedono la virtualizzazione hardware, che sarà abilitata se confermi le modifiche.</translation>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>Consente la modifica dei contenuti della barra di stato della MV.</translation>
     </message>
 </context>
 <context>
@@ -6161,7 +6729,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Window</source>
-        <translation>Finestra</translation>
+        <translation type="obsolete">Finestra</translation>
     </message>
 </context>
 <context>
@@ -6205,19 +6773,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Se marcata, la pipe specificata nel campo <b>Percorso porta</b> sarà creata dalla macchina virtuale all'avvio. In caso contrario, la macchina virtuale proverà ad utilizzare la pipe esistente.</translation>
+        <translation type="obsolete">Se marcata, la pipe specificata nel campo <b>Percorso porta</b> sarà creata dalla macchina virtuale all'avvio. In caso contrario, la macchina virtuale proverà ad utilizzare la pipe esistente.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Crea pipe</translation>
+        <translation type="obsolete">&Crea pipe</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Visualizza il percorso della pipe per la porta seriale nel sistema host quando la porta lavora in modalità <b>Pipe host</b>, o il nome del dispositivo seriale dell'host quando la porta è in modalità <b>Dispositivo host</b>.</translation>
+        <translation type="obsolete">Visualizza il percorso della pipe per la porta seriale nel sistema host quando la porta lavora in modalità <b>Pipe host</b>, o il nome del dispositivo seriale dell'host quando la porta è in modalità <b>Dispositivo host</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Porta/&Percorso file:</translation>
+        <translation type="obsolete">Porta/&Percorso file:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -6239,6 +6807,22 @@ p, li { white-space: pre-wrap; }
         <source>Port &Path:</source>
         <translation type="obsolete">&Percorso porta:</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation>Se marcata, la macchina virtuale assumerà che la pipe o il socket specificato nel campo <b>Percorso/Indirizzo</b> esista e proverà a utilizzarla.Altrimenti, la pipe o il socket saranno creati dalla macchina virtuale al suo avvio.</translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>&Connetti alla pipe/socket esistente</translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation>&Percorso/Indirizzo:</translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation><p>Nella modalità <b>Pipe host</b>: contiene il percorso della pipe della porta seriale sull'host. Esempi: "\\.\pipe\myvbox" o "/tmp/myvbox", rispettivamente per Windows e sistemi di tipo UNIX.</p><p>Nella modalità <b>Dispositivo host</b>: contiene il nomde del dispositivo seriale dell'host. Esempi: "COM1" o "/dev/ttyS0".</p><p>Nella modalità <b>File raw</ [...]
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -6291,11 +6875,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Aggiungi&nbsp;dispositivo&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Aggiungi&nbsp;dispositivo&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Aggiungi&nbsp;dispositivo&nbsp;floppy</nobr></translation>
+        <translation type="obsolete"><nobr>Aggiungi&nbsp;dispositivo&nbsp;floppy</nobr></translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -6335,11 +6919,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Aggiungi dispositivo CD/DVD</translation>
+        <translation type="obsolete">Aggiungi dispositivo CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Aggiungi dispositivo floppy</translation>
+        <translation type="obsolete">Aggiungi dispositivo floppy</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6491,15 +7075,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>Lettore C&D/DVD:</translation>
+        <translation type="obsolete">Lettore C&D/DVD:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Scegli un disco CD/DVD virtuale o un lettore fisico da utilizzare come lettore virtuale. La macchina virtuale vedrà il contenuto di un disco inserito nel lettore con i dati nel file o nel disco che si trova nel lettore fisico.</translation>
+        <translation type="obsolete">Scegli un disco CD/DVD virtuale o un lettore fisico da utilizzare come lettore virtuale. La macchina virtuale vedrà il contenuto di un disco inserito nel lettore con i dati nel file o nel disco che si trova nel lettore fisico.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Configura il lettore CD/DVD virtuale</translation>
+        <translation type="obsolete">Configura il lettore CD/DVD virtuale</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6523,7 +7107,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Scegli un file di disco CD/DVD virtuale...</translation>
+        <translation type="obsolete">Scegli un file di disco CD/DVD virtuale...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6719,6 +7303,54 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>La macchina attualmente ha più controller di archiviazione assegnati di quanti ne supporta il chipset %1. Cambia il tipo di chipset nella pagina delle impostazioni Sistema o riduci il seguente numero dei controller di archiviazione nella pagina delle impostazioni Archiviazione: %2</translation>
     </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation>Se marcata, il sistema guest vedrà il disco virtuale come un dispositivo collegabile a caldo.</translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>Collega&bile a caldo</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>Scegli un file di disco ottico virtuale...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>Aggiungi&nbsp;lettore&nbsp;ottico</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>Aggiungi&nbsp;lettore&nbsp;floppy</nobr></translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation>Aggiungi controller USB</translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>Aggiungi lettore ottico</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>Aggiungi lettore floppy</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>Lettore &ottico:</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>Scegli un disco ottico virtuale o un lettore fisico per utilizzare questo lettore virtuale. La macchina virtuale vedrà un disco inserito nel lettore con i dati nel file o sul disco nel lettore virtuale come il suo contenuto.</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>Configura il lettore ottico virtuale</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation>Cifrato con chiave:</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -6961,11 +7593,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>La funzionalità I/O APIC non è attualmente abilitata nella sezione Scheda madre della pagina Sistema. Questa funzionalità è necessaria per supportare un chipset di tipo ICH9. Sarà abilitata automaticamente se confermi le modifiche.</translation>
+        <translation type="obsolete">La funzionalità I/O APIC non è attualmente abilitata nella sezione Scheda madre della pagina Sistema. Questa funzionalità è necessaria per supportare un chipset di tipo ICH9. Sarà abilitata automaticamente se confermi le modifiche.</translation>
     </message>
     <message>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>L'emulazione del controller USB non è attualmente abilitata nella pagina USB. Questa funzionalità è necessaria per supportare un dispositivo di inserimento USB emulato. Sarà abilitata automaticamente se confermi le modifiche.</translation>
+        <translation type="obsolete">L'emulazione del controller USB non è attualmente abilitata nella pagina USB. Questa funzionalità è necessaria per supportare un dispositivo di inserimento USB emulato. Sarà abilitata automaticamente se confermi le modifiche.</translation>
     </message>
     <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
@@ -6977,16 +7609,40 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La funzionalità I/O APIC non è attualmente abilitata nella sezione Scheda madre della pagina Sistema. Questa funzionalità è richiesta per supportare più di un processore virtuale. Sarà attivata automaticamente se confermi le modifiche.</translation>
+        <translation type="obsolete">La funzionalità I/O APIC non è attualmente abilitata nella sezione Scheda madre della pagina Sistema. Questa funzionalità è richiesta per supportare più di un processore virtuale. Sarà attivata automaticamente se confermi le modifiche.</translation>
     </message>
     <message>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>La virtualizzazione hardware non è attualmente abilitata nella sezione Accelerazione della pagina Sistema. Ciò è richiesto per supportare più di un processore virtuale. Sarà abilitata automaticamente se confermi le modifiche.</translation>
+        <translation type="obsolete">La virtualizzazione hardware non è attualmente abilitata nella sezione Accelerazione della pagina Sistema. Ciò è richiesto per supportare più di un processore virtuale. Sarà abilitata automaticamente se confermi le modifiche.</translation>
     </message>
     <message>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation>L'execution cap del processore è impostata a un valore basso. Ciò potrebbe rallentare la macchina.</translation>
     </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation>Interfaccia di &paravirtualizzazione:</translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>Seleziona il fornitore dell'interfaccia di paravirtualizzazione del guest che deve essere utilizzato da questa macchina virtuale.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>La funzionalità I/O APIC non è attualmente abilitata nella sezione Scheda madre della pagina Sistema. Questa funzionalità è richiesta per supportare un chipset di tipo ICH9 che hai abilitato per questa MV. Sarà abilitata automaticamente se confermi le modifiche.</translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>L'emulazione del controller USB non è attualmente abilitata nella pagina USB. Questa funzionalità è richiesta per supportare un dispositivo di inserimento USB emulato. Sarà abilitata automaticamente se confermi le modifiche.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>La funzionalità I/O APIC non è attualmente abilitata nella sezione Scheda madre della pagina Sistema. Questa funzionalità è richiesta per supportare più di un processore virtuale che hai scelto per questa MV. Sarà attivata automaticamente se confermi le modifiche.</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>La virtualizzazione hardware non è attualmente abilitata nella sezione Accelerazione della pagina Sistema. Questa funzionalità è richiesta per supportare più di un processore virtuale che hai scelto per questa MV. Sarà abilitata automaticamente se confermi le modifiche.</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSB</name>
@@ -7057,7 +7713,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Abilita controller USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">Abilita controller USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -7121,7 +7777,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 è attualmente abilitato per questa macchina virtuale. Ciò richiedere che <b>%1</b> sia installato. Installa l'Extension Pack dal sito di VirtualBox o disabilita USB 2.0 per poter avviare la macchina.</translation>
+        <translation type="obsolete">USB 2.0 è attualmente abilitato per questa macchina virtuale. Ciò richiedere che <b>%1</b> sia installato. Installa l'Extension Pack dal sito di VirtualBox o disabilita USB 2.0 per poter avviare la macchina.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation>Se marcata, abilita il controller USB OHCI virtuale di questa macchina. Il controller USB OHCI fornisce il supporto a USB 1.0.</translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>Controller USB &1.1 (OHCI)</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>Controller USB &2.0 (EHCI)</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>Se marcata, abilita il controller USB xHCI virtuale di questa macchina. Il controller USB xHCI fornisce il supporto a USB 3.0.</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>Controller USB &3.0 (xHCI)</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>USB 2.0/3.0 è attualmente abilitato per questa macchina virtuale. Tuttavia, ciò richiede che <b>%1</b> sia installato. Installa l'Extension Pack scaricabile dal sito di VirtualBox o disabilita USB 2.0/3.0 per poter avviare la macchina.</translation>
     </message>
 </context>
 <context>
@@ -7260,7 +7940,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>C&hiudi</translation>
+        <translation type="obsolete">C&hiudi</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation>Rimozione supporto...</translation>
     </message>
 </context>
 <context>
@@ -7279,6 +7963,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>Ridimensionamento schermo virtuale</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>Mappatura dello schermo virtuale</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>Cambia</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>Chiudi</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>Abilita barra dei menu</translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -7320,7 +8027,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Creazione dell'oggetto COM VirtualBox non riuscita.</p><p>L'applicazione sarà chiusa immediatamente.</p></translation>
+        <translation type="obsolete"><p>Creazione dell'oggetto COM VirtualBox non riuscita.</p><p>L'applicazione sarà chiusa immediatamente.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -7684,8 +8391,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Mostra una finestra con le informazioni sul prodotto</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Una nuova versione di VirtualBox è stata rilasciata! La versione <b>%1</b> è disponibile presso <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puoi scaricare questa versione da questo collegamento diretto:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Una nuova versione di VirtualBox è stata rilasciata! La versione <b>%1</b> è disponibile presso <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puoi scaricare questa versione da questo collegamento diretto:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7761,11 +8468,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Uno o più dischi fissi virtuali, CD/DVD o floppy non sono la momento accessibili. Ciò significa che non sarai in grado di operare con le macchine virtuali che utilizzano questi supporti fino a quando non ritorneranno accessibili.</p><p>Premi <b>Controlla</b> per aprire la finestra del gestore supporti virtuali e vedere quali supporti non sono accessibili, o premi <b>Ignora</b> per ignorare questo messaggio.</p></tran [...]
+        <translation type="obsolete"><p>Uno o più dischi fissi virtuali, CD/DVD o floppy non sono la momento accessibili. Ciò significa che non sarai in grado di operare con le macchine virtuali che utilizzano questi supporti fino a quando non ritorneranno accessibili.</p><p>Premi <b>Controlla</b> per aprire la finestra del gestore supporti virtuali e vedere quali supporti non sono accessibili, o premi <b>Ignora</b> per ignorare questo messaggio. [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Si è verificato un errore critico durante il funzionamento della macchina virtuale e l'esecuzione della macchina è stata fermata.</p><p>Per ottenere aiuto, vedi la sezione Community su <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o il contratto di supporto. Fornisci il contenuto del file di log <tt>VBox.log</tt> e il file immagine <tt>VBox.png</tt>, che puoi trovare nella cartella < [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Si è verificato un errore critico durante il funzionamento della macchina virtuale e l'esecuzione della macchina è stata fermata.</p><p>Per ottenere aiuto, vedi la sezione Community su <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> o il contratto di supporto. Fornisci il contenuto del file di log <tt>VBox.log</tt> e il file immagine <tt>VBox.png</tt>, che puoi trovare nella [...]
     </message>
     <message>
         <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
@@ -7947,7 +8654,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Sei sicuro di voler eliminare il dispositivo CD/DVD?</p><p>Senza non potrai montare alcun CD o immagine ISO o installare le Guest Additions!</p></translation>
+        <translation type="obsolete"><p>Sei sicuro di voler eliminare il dispositivo CD/DVD?</p><p>Senza non potrai montare alcun CD o immagine ISO o installare le Guest Additions!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -8050,7 +8757,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Stai per aggiungere un nuovo lettore CD/DVD al controller <b>%1</b>.</p><p>Vuoi scegliere un disco CD/DVD virtuale da inserire nel lettore o lasciarlo vuoto per il momento?<p></translation>
+        <translation type="obsolete"><p>Stai per aggiungere un nuovo lettore CD/DVD al controller <b>%1</b>.</p><p>Vuoi scegliere un disco CD/DVD virtuale da inserire nel lettore o lasciarlo vuoto per il momento?<p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -8072,11 +8779,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Scollegamento del dispositivo CD/DVD (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
+        <translation type="obsolete">Scollegamento del dispositivo CD/DVD (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Scollegamento del dispositivo floppy (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
+        <translation type="obsolete">Scollegamento del dispositivo floppy (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
@@ -8115,11 +8822,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Collegamento del dispositivo CD/DVD (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
+        <translation type="obsolete">Collegamento del dispositivo CD/DVD (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Collegamento del dispositivo floppy (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
+        <translation type="obsolete">Collegamento del dispositivo floppy (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
@@ -8451,8 +9158,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>La finestra della macchina virtuale verrà ora portata in modalità <b>trasparente</b>. È possibile tornare alla modalità finestra in un qualsiasi momento premendo <b>%1</b>. Il tasto <i>Host</i> è definito attualmente come <b>%2</b>.</p><p>Il menu principale viene nascosto in modalità trasparente. È possibile accedervi premendo <b>Host+Home</b>.</p></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>È avvenuto un errore critico durante l'esecuzione della macchina virtuale e quest'ultima è stata perciò fermata.</p><p>Per ottenere aiuto, si rimanda alla sezione Community su <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o al vostro contratto di supporto. Si prega di fornire i contenuti del file di log <tt>VBox.log</tt> e il file immagine <tt>VBox.png</tt>, che pot [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>È avvenuto un errore critico durante l'esecuzione della macchina virtuale e quest'ultima è stata perciò fermata.</p><p>Per ottenere aiuto, si rimanda alla sezione Community su <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> o al vostro contratto di supporto. Si prega di fornire i contenuti del file di log <tt>VBox.log</tt> e il file immagine <tt>VBox.png</tt>, che potet [...]
     </message>
     <message>
         <source><p>Failed to connect to the VirtualBox online registration service.</p><p>%1</p></source>
@@ -8781,7 +9488,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Rimozione dei dati non riuscita.</translation>
+        <translation type="obsolete">Rimozione dei dati non riuscita.</translation>
     </message>
     <message>
         <source><p>Failed to initialize COM because the VirtualBox global configuration directory <b><nobr>%1</nobr></b> is not accessible. Please check the permissions of this directory and of its parent directory.</p><p>The application will now terminate.</p></source>
@@ -9045,11 +9752,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>Il file dell'immagine del disco delle <b>VirtualBox Guest Additions</b> è stato scaricato correttamente da <nobr><a href="%1">%1</a></nobr> e salvato localmente come <nobr><b>%2</b>.</nobr></p><p>Vuoi registrare il file dell'immagine del disco e inserirlo nel lettore CD/DVD virtuale?</p></translation>
+        <translation type="obsolete"><p>Il file dell'immagine del disco delle <b>VirtualBox Guest Additions</b> è stato scaricato correttamente da <nobr><a href="%1">%1</a></nobr> e salvato localmente come <nobr><b>%2</b>.</nobr></p><p>Vuoi registrare il file dell'immagine del disco e inserirlo nel lettore CD/DVD virtuale?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Impossibile inserire il file dell'immagine delle <b>VirtualBox Guest Additions</b> nella macchina virtuale<b>%1</b>, poiché la macchina non ha alcun lettore CD/DVD. Aggiungi un lettore dalla pagina di archiviazione della finestra delle impostazioni della macchina virtuale.</p></translation>
+        <translation type="obsolete"><p>Impossibile inserire il file dell'immagine delle <b>VirtualBox Guest Additions</b> nella macchina virtuale<b>%1</b>, poiché la macchina non ha alcun lettore CD/DVD. Aggiungi un lettore dalla pagina di archiviazione della finestra delle impostazioni della macchina virtuale.</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
@@ -9105,6 +9812,122 @@ p, li { white-space: pre-wrap; }
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation><p>Lo schermo virtuale è attualmente impostato a una modalità di colore di <b>%1&nbsp;bit</b>. Per ottenere prestazioni migliori, modifica questa impostazione a <b>%2&nbsp;bit</b>. Ciò normalmente può essere fatto dalla sezione <b>Schermo</b> del panello di controllo del sistema operativo del guest o da Impostazioni di sistema.</p></translation>
     </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>Creazione dell'oggetto COM VirtualBoxClient non riuscita.</p><p>L'applicazione sarà chiusa immediatamente.</p></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation>Impostazione dei dati aggiuntivi globali di VirtualBox per la chiave <i>%1</i> al valore <i>{%2}</i> non riuscita.</translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation>Impostazione dei dati aggiuntivi per la chiave <i>%1</i> della macchina <i>{%2}</i>.al valore <i>{%3}</i> non riuscita.</translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>Uno o più dischi fissi virtuali, file di immagini di dischi otttici o floppy non sono attualmente accessibili. Ciò significa che non sarai in grado di operare con le macchine virtuali che utilizzano questi file fino a quando non ritorneranno accessibili.</p><p>Premi <b>Controlla</b> per aprire la finestra del gestore supporti virtuali e vedere quali supporti non sono accessibili, o premi <b>Ignora</b> per ignorare questo m [...]
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation>Salvataggio delle impostazioni non riuscito.</translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p>Stai per aggiungere un nuovo lettore ottico al controller <b>%1</b>.</p><p>Vuoi scegliere un disco ottico virtuale da inserire nel lettore o lasciarlo vuoto per il momento?<p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>Sei sicuro di voler eliminare il lettore ottico?</p><p>Senza non potrai inserire alcun disco ottico o immagine ISO o installare le Guest Additions!</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Collegamento del lettore ottico (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Collegamento del lettore floppy (<nobr><b>%1</b></nobr>) allo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation>Le regole attuali di inoltro delle porte non sono valide. I nomi delle regole devono essere univoci.</translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation>Le regole attuali di inoltro delle porte non sono valide. Alcune regole hanno le stesse porte host e indirizzi IP in conflitto.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Scollegamento del lettore ottico (<nobr><b>%1</b></nobr>) dallo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Scollegamento del dispositivo floppy (<nobr><b>%1</b></nobr>) dallo slot <i>%2</i> della macchina <b>%3</b> non riuscito.</translation>
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Connessione del cavo della scheda di rete della macchina virtuale <b>%1</b> non riuscita.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Disconnessione del cavo della scheda di rete della macchina virtuale <b>%1</b> non riuscita.</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation><p>Impossibile inserire il file dell'immagine del disco delle <b>VirtualBox Guest Additions</b> nella macchina virtuale<b>%1</b>, poiché la macchina non ha alcun lettore ottico. Aggiungi un lettore dalla pagina di archiviazione della finestra delle impostazioni della macchina virtuale.</p></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p>Il file dell'immagine del disco delle <b>VirtualBox Guest Additions</b> è stato scaricato correttamente da <nobr><a href="%1">%1</a></nobr> e salvato localmente come <nobr><b>%2</b>.</nobr></p><p>Vuoi registrare il file dell'immagine del disco e inserirlo nel lettore ottico virtuale?</p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation failed.</source>
+        <translation type="obsolete">L'operazione di trascinamento e rilascio non è riuscita.</translation>
+    </message>
+    <message>
+        <source>Failed while dropping data.</source>
+        <translation type="obsolete">Rilascio dei dati non riuscito.</translation>
+    </message>
+    <message>
+        <source>Unable to cancel drag and drop operation.</source>
+        <translation type="obsolete">Impossibile annullare l'operazione di trascinamento e rilascio.</translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation>Password errata o autenticazione non riuscita.</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation><p>Si è verificato un errore critico durante il funzionamento della macchina virtuale e l'esecuzione della macchina è stata fermata.</p><p>Per ottenere aiuto, vedi la sezione Community su <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o il contratto di supporto. Fornisci il contenuto del file di log <tt>VBox.log</tt> e il file immagine <tt>VBox.png</tt>, che puoi trovare nella cartella < [...]
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation><p>Si è verificato un errore critico durante il funzionamento della macchina virtuale e l'esecuzione della macchinadovrebbe essere fermata.</p><p>Per ottenere aiuto, vedi la sezione Community su <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> o il contratto di supporto. Fornisci il contenuto del file di log <tt>VBox.log</tt> che puoi trovare nella cartella dei log della macchina virtuale, così come una  [...]
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation><p>È stata rilasciata una nuova versione di VirtualBox! La versione <b>%1</b> è disponibile su <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puoi scaricare questa versione utilizzando il collegamento:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation>Collegamento del cavo di rete della macchina virtuale<b>%1</b> non riucito.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation>Disconnessione del cavo di rete della macchina virtuale<b>%1</b> non riucito.</translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation>Operazione di trascinamento e rilascio dall'host al guest non riuscita.</translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation>Impossibile annullare l'operazione di trascinamento e rilascio dall'host al guest.</translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation>Operazione di trascinamento e rilascio dal guest all'host non riuscita.</translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetAdditions</name>
@@ -9196,7 +10019,7 @@ p, li { white-space: pre-wrap; }
     <name>UINameAndSystemEditor</name>
     <message>
         <source>&Name:</source>
-        <translation>&Nome:</translation>
+        <translation type="obsolete">&Nome:</translation>
     </message>
     <message>
         <source>Holds the name of the virtual machine.</source>
@@ -9218,6 +10041,10 @@ p, li { white-space: pre-wrap; }
         <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
         <translation>Visualizza il tipo di sistema operativo che intendi installare nella macchina virtuale (chiamato sistema operativo Guest).</translation>
     </message>
+    <message>
+        <source>N&ame:</source>
+        <translation>&Nome:</translation>
+    </message>
 </context>
 <context>
     <name>UINetworkManager</name>
@@ -10353,14 +11180,18 @@ questo passo e collegare hard disk più tardi tramite Impostazioni della MV.<
         <translation>File di macchina virtuale (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Benvenuti in VirtualBox!</h3><p>La parte sinistra di questa finestra visualizza un elenco delle macchine virtuali sul tuo computer. L'elenco al momento è vuoto perché non hai ancora creato macchine virtuali.<img src=:/welcome.png align=right/></p><p>Per creare una nuova macchina virtuale, premi il pulsante <b>Nuova</b> nella barra degli strumenti principale posizionata nella parte alta della finestra.</p> [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Benvenuti in VirtualBox!</h3><p>La parte sinistra di questa finestra visualizza un elenco delle macchine virtuali sul tuo computer. L'elenco al momento è vuoto perché non hai ancora creato macchine virtuali.<img src=:/welcome.png align=right/></p><p>Per creare una nuova macchina virtuale, premi il pulsante <b>Nuova</b> nella barra degli strumenti principale posizionata nella parte alta della fin [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Gestore</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation><h3>Benvenuti in VirtualBox!</h3><p>La parte sinistra di questa finestra visualizza un elenco delle macchine virtuali sul tuo computer. L'elenco al momento è vuoto perché non hai ancora creato macchine virtuali.<img src=:/welcome.png align=right/></p><p>Per creare una nuova macchina virtuale, premi il pulsante <b>Nuova</b> nella barra degli strumenti principale posizionata nella parte alta della finestra.</p> [...]
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -10393,7 +11224,7 @@ questo passo e collegare hard disk più tardi tramite Impostazioni della MV.<
     </message>
     <message>
         <source>Settings</source>
-        <translation>Impostazioni</translation>
+        <translation type="obsolete">Impostazioni</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -10446,6 +11277,10 @@ questo passo e collegare hard disk più tardi tramite Impostazioni della MV.<
         <source>Display</source>
         <translation>Schermo</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation>Preferenze</translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -10502,24 +11337,61 @@ questo passo e collegare hard disk più tardi tramite Impostazioni della MV.<
         <translation type="obsolete">hai selezionato un sistema operativo guest a 64 bit per questa MV. Poiché questo tipo di guest richiede la virtualizzazione hardware (VT-x/AMD-V), questa funzionalità sarà abilitata automaticamente.</translation>
     </message>
     <message>
-        <source>you have 2D Video Acceleration enabled. As 2D Video Acceleration is supported for Windows guests only, this feature will be disabled.</source>
-        <translation type="obsolete">hai l'accelerazione video 2D abilitata. Poiché l'accelerazione 2D è supportata dai soli guest Windows, questa funzionalità sarà disabilitata.</translation>
+        <source>you have 2D Video Acceleration enabled. As 2D Video Acceleration is supported for Windows guests only, this feature will be disabled.</source>
+        <translation type="obsolete">hai l'accelerazione video 2D abilitata. Poiché l'accelerazione 2D è supportata dai soli guest Windows, questa funzionalità sarà disabilitata.</translation>
+    </message>
+    <message>
+        <source>you have enabled a USB HID (Human Interface Device). This will not work unless USB emulation is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source>
+        <translation type="obsolete">hai abilitato un HID USB (dispositivo di interfaccia umana). Non funzionerà se l'emulazione USB non è abilitata. Ciò avviene automaticamente quando accetti le impostazione della MV, premendo il pulsante OK.</translation>
+    </message>
+    <message>
+        <source>at most one supported</source>
+        <translation type="obsolete">al massimo uno supportato</translation>
+    </message>
+    <message>
+        <source>up to %1 supported</source>
+        <translation type="obsolete">fino a %1 supportati</translation>
+    </message>
+    <message>
+        <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
+        <translation type="obsolete">stai attualmente utilizzando più controller di archiviazione di quanti un chipset %1 supporti. Cambia il tipo di chipset nella pagina delle impostazioni Sistema o riduci il numero dei seguenti controller di archiviazione nella pagina delle impostazioni Archiviazione: %2.</translation>
+    </message>
+    <message>
+        <source>User Interface</source>
+        <translation>Interfaccia utente</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation>Impostazioni</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>Caricamento impostazioni...</translation>
     </message>
     <message>
-        <source>you have enabled a USB HID (Human Interface Device). This will not work unless USB emulation is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source>
-        <translation type="obsolete">hai abilitato un HID USB (dispositivo di interfaccia umana). Non funzionerà se l'emulazione USB non è abilitata. Ciò avviene automaticamente quando accetti le impostazione della MV, premendo il pulsante OK.</translation>
+        <source>Saving Settings...</source>
+        <translation>Salvataggio impostazioni...</translation>
     </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
     <message>
-        <source>at most one supported</source>
-        <translation type="obsolete">al massimo uno supportato</translation>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation><nobr>Fai <b>clic</b> per commutare la presenza dell'indicatore.</nobr><br><nobr><b>Trascina e rilascia</b> per cambiare la posizione dell'indicatore.</nobr></translation>
     </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
     <message>
-        <source>up to %1 supported</source>
-        <translation type="obsolete">fino a %1 supportati</translation>
+        <source>Close</source>
+        <translation>Chiudi</translation>
     </message>
     <message>
-        <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
-        <translation type="obsolete">stai attualmente utilizzando più controller di archiviazione di quanti un chipset %1 supporti. Cambia il tipo di chipset nella pagina delle impostazioni Sistema o riduci il numero dei seguenti controller di archiviazione nella pagina delle impostazioni Archiviazione: %2.</translation>
+        <source>Enable Status Bar</source>
+        <translation>Abilita barra di stato</translation>
     </message>
 </context>
 <context>
@@ -10620,8 +11492,8 @@ questo passo e collegare hard disk più tardi tramite Impostazioni della MV.<
         <translation type="obsolete">Riepilogo</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Una nuova versione di VirtualBox è stata rilasciata! La versione <b>%1</b> è disponibile presso <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puoi scaricare questa versione da questo collegamento diretto:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Una nuova versione di VirtualBox è stata rilasciata! La versione <b>%1</b> è disponibile presso <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puoi scaricare questa versione da questo collegamento diretto:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -10689,6 +11561,14 @@ questo passo e collegare hard disk più tardi tramite Impostazioni della MV.<
         <source>&Restore current snapshot '%1'</source>
         <translation>&Ripristina l'istantanea corrente '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>&Continua l'esecuzione sullo sfondo</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><p>Chiudi la finestra della macchina virtuale, ma mantieni la macchina in esecuzione.</p><p>Puoi utilizzare il gestore di VirtualBox per tornare a eseguire la macchina virtuale in una finestra.</p></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -10702,6 +11582,104 @@ questo passo e collegare hard disk più tardi tramite Impostazioni della MV.<
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informazione di sessione</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>&Dettagli di configurazione</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>Info&rmazioni di esecuzione</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Trasferimenti DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Trasferimenti PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Dati letti</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Dati scritti</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Dati trasmessi</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Dati ricevuti</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Non rilevate</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Non rilevate</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Non disponibile</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Attributi di esecuzione</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Risoluzione dello schermo</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation>Uptime della MV</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Modalità appunti</translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation>Modalità trascina e rilascia</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Guest Additions</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Sistema operativo guest</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Statistiche di archiviazione</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Nessun dispositivo di archiviazione</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Statistiche di rete</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Nessuna scheda di rete</translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -10884,11 +11862,27 @@ questo passo e collegare hard disk più tardi tramite Impostazioni della MV.<
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Nascondi descrizione</translation>
+        <translation type="obsolete">Nascondi descrizione</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Mostra descrizione</translation>
+        <translation type="obsolete">Mostra descrizione</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation>Modalità &esperta</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation>Passa alla<nobr><b>Modalità esperta</b></nobr>, una finestra a pagina singola per utenti avanzati.</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>Modalità &guidata</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation>Passa alla<nobr><b>Modalità guidata</b></nobr>, una procedura con più fasi con spiegazioni dettagliate.</translation>
     </message>
 </context>
 <context>
@@ -13011,7 +14005,7 @@ Versione %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -13699,17 +14693,17 @@ Versione %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Il collegamento di questo disco fisso sarà eseguito indirettamente utilizzando un nuovo disco differenziale.</translation>
+        <translation type="obsolete">Il collegamento di questo disco fisso sarà eseguito indirettamente utilizzando un nuovo disco differenziale.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Alcuni dei supporti nella catena di dischi fissi non sono accessibili. Utilizza il Gestore supporti virtuali in modalità <b>Mostra dischi fissi differenziali</b> per ispezionarli.</translation>
+        <translation type="obsolete">Alcuni dei supporti nella catena di dischi fissi non sono accessibili. Utilizza il Gestore supporti virtuali in modalità <b>Mostra dischi fissi differenziali</b> per ispezionarli.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Questo disco fisso di base è collegato indirettamente utilizzando il seguente disco differenziale:</translation>
+        <translation type="obsolete">Questo disco fisso di base è collegato indirettamente utilizzando il seguente disco differenziale:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -13755,7 +14749,7 @@ Versione %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -14622,12 +15616,12 @@ Versione %1</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Abilitata</translation>
+        <translation type="obsolete">Abilitata</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Disabilitata</translation>
+        <translation type="obsolete">Disabilitata</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -14690,7 +15684,151 @@ Versione %1</translation>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>spento</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>Attivo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>Inattivo</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>Attivo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>Inattivo</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>Attivo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>Inattivo</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation>Interfaccia di paravirtualizzazione</translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Creazione istantanee</translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Creazione istantanee in linea</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Nessuna</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Predefinita</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Vecchia generazione</translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Minimale</translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation>KVM</translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation>Ottico</translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation>Nuova archiviazione allocata dinamicamente</translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>OHCI</translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>EHCI</translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>xHCI</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>Porta USB %1</translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation>Interfaccia utente</translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation>(Lettore ottico)</translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>Il collegamento di questo disco fisso sarà eseguito indirettamente utilizzando un nuovo disco differenziale.</translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation>Alcuni dei supporti nella catena di dischi fissi non sono accessibili. Utilizza il Gestore supporti virtuali in modalità per ispezionarli.</translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>Questo disco fisso di base è collegato indirettamente utilizzando il seguente disco differenziale:</translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation>Cifrato</translation>
     </message>
 </context>
 <context>
@@ -15567,6 +16705,18 @@ la lingua a quella predefinita di sistema.</qt>
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Crea un nuovo disco fisso virtuale</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation>UUID:</translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation><i>Non&nbsp;cifrato</i></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation>Cifrato con chiave:</translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -15659,8 +16809,8 @@ la lingua a quella predefinita di sistema.</qt>
         <translation type="obsolete">Finestra di registrazione VirtualBox</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Vi preghiamo di compilare il modulo di registrazione per permetterci di sapere che usate VirtualBox e, opzionalmente, per tenervi informati riguardo a novità e aggiornamenti di VirtualBox.</p><p>Inserite il vostro nome completo con caratteri Latin e il vostro indirizzo e-mail nei campi sottostanti. Notate che innotek utilizzerà tali informazioni solo a fini statistici e per inviarvi la newsletter di VirtualBox. In particolare, inn [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Vi preghiamo di compilare il modulo di registrazione per permetterci di sapere che usate VirtualBox e, opzionalmente, per tenervi informati riguardo a novità e aggiornamenti di VirtualBox.</p><p>Inserite il vostro nome completo con caratteri Latin e il vostro indirizzo e-mail nei campi sottostanti. Notate che innotek utilizzerà tali informazioni solo a fini statistici e per inviarvi la newsletter di VirtualBox. In particolare, inn [...]
     </message>
     <message>
         <source>&Name</source>
@@ -15707,8 +16857,8 @@ la lingua a quella predefinita di sistema.</qt>
         <translation type="obsolete">Impossibile completare l'handshake della connessione.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Compila il modulo di registrazione per farci sapere che utilizzi VirtualBox e, facoltativamente, per mantenerti informato riguardo novità su VirtualBox e aggiornamenti.</p><p>Inserisci il tuo nome con caratteri Latin e il tuo indirizzo e-mail nei campi sottostanti. Nota che Sun Microsystems utilizzerà queste informazioni solo per formulare statistiche di utilizzo del prodotto e per inviarti la newsletter di VirtualBox. In particol [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Compila il modulo di registrazione per farci sapere che utilizzi VirtualBox e, facoltativamente, per mantenerti informato riguardo novità su VirtualBox e aggiornamenti.</p><p>Inserisci il tuo nome con caratteri Latin e il tuo indirizzo e-mail nei campi sottostanti. Nota che Sun Microsystems utilizzerà queste informazioni solo per formulare statistiche di utilizzo del prodotto e per inviarti la newsletter di VirtualBox. In particol [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -15727,8 +16877,8 @@ la lingua a quella predefinita di sistema.</qt>
         <translation type="obsolete">Seleziona Stato/Territorio</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Compila il modulo di registrazione per farci sapere che usi VirtualBox e, a scelta, per tenerti informato sulle novità e sugli aggiornamenti di VirtualBox.</p><p>Ti preghiamo di utilizzare caratteri Latin per la compilazione dei campi seguenti. Nota che Sun Microsystems utilizzerà queste informazioni solamente per raccogliere statistiche di utilizzo del prodotto e per inviare le newsletter di VirtualBox. In particolare, Sun Micros [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Compila il modulo di registrazione per farci sapere che usi VirtualBox e, a scelta, per tenerti informato sulle novità e sugli aggiornamenti di VirtualBox.</p><p>Ti preghiamo di utilizzare caratteri Latin per la compilazione dei campi seguenti. Nota che Sun Microsystems utilizzerà queste informazioni solamente per raccogliere statistiche di utilizzo del prodotto e per inviare le newsletter di VirtualBox. In particolare, Sun Micros [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -15901,8 +17051,8 @@ la lingua a quella predefinita di sistema.</qt>
         <translation type="obsolete">Sospendi l'esecuzione della macchina virtuale</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Benvenuti in VirtualBox!</h3><p>La parte sinistra di questa finestra visualizza un elenco delle macchine virtuali sul tuo computer. L'elenco al momento è vuoto perché non sono ancora state create macchine virtuali.<img src=:/welcome.png align=right/></p><p>Per creare una nuova macchina virtuale, premere il pulsante <b>Nuova</b> nella barra degli strumenti principale posizionata nella parte alta  [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Benvenuti in VirtualBox!</h3><p>La parte sinistra di questa finestra visualizza un elenco delle macchine virtuali sul tuo computer. L'elenco al momento è vuoto perché non sono ancora state create macchine virtuali.<img src=:/welcome.png align=right/></p><p>Per creare una nuova macchina virtuale, premere il pulsante <b>Nuova</b> nella barra degli strumenti principale posizionata nella parte alta  [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -16941,7 +18091,7 @@ qualsiasi valore.</qt></translation>
     <name>VBoxVMInformationDlg</name>
     <message>
         <source>%1 - Session Information</source>
-        <translation>%1 - Informazione di sessione</translation>
+        <translation type="obsolete">%1 - Informazione di sessione</translation>
     </message>
     <message>
         <source>&Details</source>
@@ -16953,78 +18103,78 @@ qualsiasi valore.</qt></translation>
     </message>
     <message>
         <source>DMA Transfers</source>
-        <translation>Trasferimenti DMA</translation>
+        <translation type="obsolete">Trasferimenti DMA</translation>
     </message>
     <message>
         <source>PIO Transfers</source>
-        <translation>Trasferimenti PIO</translation>
+        <translation type="obsolete">Trasferimenti PIO</translation>
     </message>
     <message>
         <source>Data Read</source>
-        <translation>Dati letti</translation>
+        <translation type="obsolete">Dati letti</translation>
     </message>
     <message>
         <source>Data Written</source>
-        <translation>Dati scritti</translation>
+        <translation type="obsolete">Dati scritti</translation>
     </message>
     <message>
         <source>Data Transmitted</source>
-        <translation>Dati trasmessi</translation>
+        <translation type="obsolete">Dati trasmessi</translation>
     </message>
     <message>
         <source>Data Received</source>
-        <translation>Dati ricevuti</translation>
+        <translation type="obsolete">Dati ricevuti</translation>
     </message>
     <message>
         <source>Runtime Attributes</source>
-        <translation>Attributi di esecuzione</translation>
+        <translation type="obsolete">Attributi di esecuzione</translation>
     </message>
     <message>
         <source>Screen Resolution</source>
-        <translation>Risoluzione dello schermo</translation>
+        <translation type="obsolete">Risoluzione dello schermo</translation>
     </message>
     <message>
         <source>Not Detected</source>
         <comment>guest additions</comment>
-        <translation>Non rilevate</translation>
+        <translation type="obsolete">Non rilevate</translation>
     </message>
     <message>
         <source>Not Detected</source>
         <comment>guest os type</comment>
-        <translation>Non rilevato</translation>
+        <translation type="obsolete">Non rilevato</translation>
     </message>
     <message>
         <source>Guest Additions</source>
-        <translation>Guest Additions</translation>
+        <translation type="obsolete">Guest Additions</translation>
     </message>
     <message>
         <source>Guest OS Type</source>
-        <translation>Sistema operativo guest</translation>
+        <translation type="obsolete">Sistema operativo guest</translation>
     </message>
     <message>
         <source>No Network Adapters</source>
-        <translation>Nessuna scheda di rete</translation>
+        <translation type="obsolete">Nessuna scheda di rete</translation>
     </message>
     <message>
         <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
+        <translation type="obsolete">VBoxVMInformationDlg</translation>
     </message>
     <message>
         <source>Storage Statistics</source>
-        <translation>Statistiche di archiviazione</translation>
+        <translation type="obsolete">Statistiche di archiviazione</translation>
     </message>
     <message>
         <source>No Storage Devices</source>
-        <translation>Nessun dispositivo di archiviazione</translation>
+        <translation type="obsolete">Nessun dispositivo di archiviazione</translation>
     </message>
     <message>
         <source>Network Statistics</source>
-        <translation>Statistiche di rete</translation>
+        <translation type="obsolete">Statistiche di rete</translation>
     </message>
     <message>
         <source>Not Available</source>
         <comment>details report (VRDE server port)</comment>
-        <translation>Non disponibile</translation>
+        <translation type="obsolete">Non disponibile</translation>
     </message>
     <message>
         <source>Session Information Dialog</source>
@@ -17137,19 +18287,19 @@ qualsiasi valore.</qt></translation>
     </message>
     <message>
         <source>Clipboard Mode</source>
-        <translation>Modalità appunti</translation>
+        <translation type="obsolete">Modalità appunti</translation>
     </message>
     <message>
         <source>Drag'n'Drop Mode</source>
-        <translation>Modalità trascina e rilascia</translation>
+        <translation type="obsolete">Modalità trascina e rilascia</translation>
     </message>
     <message>
         <source>Configuration &Details</source>
-        <translation>&Dettagli di configurazione</translation>
+        <translation type="obsolete">&Dettagli di configurazione</translation>
     </message>
     <message>
         <source>&Runtime Information</source>
-        <translation>Info&rmazioni di esecuzione</translation>
+        <translation type="obsolete">Info&rmazioni di esecuzione</translation>
     </message>
 </context>
 <context>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ja.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ja.ts
index 5c2b19e..db85892 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ja.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ja.ts
@@ -4,31 +4,26 @@
 <context>
     <name>@@@</name>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1815"/>
         <source>English</source>
         <comment>Native language name</comment>
         <translation>日本語</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1826"/>
         <source>--</source>
         <comment>Native language country name (empty if this language is for all countries)</comment>
         <translation></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1839"/>
         <source>English</source>
         <comment>Language name, in English</comment>
         <translation>Japanese</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1850"/>
         <source>--</source>
         <comment>Language country name, in English (empty if native country name is empty)</comment>
         <translation></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1863"/>
         <source>Oracle Corporation</source>
         <comment>Comma-separated list of translators</comment>
         <translation>Toshimitsu Tanaka,Ikuya Awashiro,Shushi Kurose</translation>
@@ -93,27 +88,22 @@
 <context>
     <name>QApplication</name>
     <message>
-        <location filename="../src/main.cpp" line="465"/>
         <source>Executable <b>%1</b> requires Qt %2.x, found Qt %3.</source>
         <translation>実行ファイル <b>%1</b> はQt %2.x が必要です。Qt %3 が見つかりました。</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="469"/>
         <source>Incompatible Qt Library Error</source>
         <translation>互換性のないQtライブラリーエラー</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="661"/>
         <source>VirtualBox - Error In %1</source>
         <translation>VirtualBox - %1 のエラー</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="665"/>
         <source><html><b>%1 (rc=%2)</b><br/><br/></source>
         <translation><html><b>%1 (rc=%2)</b><br/><br/></translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="107"/>
         <source>Please try reinstalling VirtualBox.</source>
         <translation>VirtualBoxを再インストールしてください。</translation>
     </message>
@@ -126,47 +116,38 @@
         <translation type="obsolete">VirtualBoxのLinuxカーネルドライバー(vboxdrv)はロードされません。または/dev/vboxdrvのパーミッションに問題があります。root権限で<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>を実行してカーネルモジュールを再セットアップしてください。Ubuntu、FedoraまたはMandrivaユーザーは最初にDKMSパッケージをインストールしてください。このパッケージはLinuxカーネルの変更を把握し、必要ならばvboxdrvカーネルモジュールを再コンパイルします。</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="102"/>
         <source>Make sure the kernel module has been loaded successfully.</source>
         <translation>カーネルモジュールが正しくロードされたことを確認してください。</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="600"/>
         <source>VirtualBox - Runtime Error</source>
         <translation>VirtualBox - ランタイムエラー</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="606"/>
         <source><b>Cannot access the kernel driver!</b><br/><br/></source>
         <translation><b>カーネルドライバーにアクセスできません!</b><br/><br/></translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="629"/>
         <source>Unknown error %2 during initialization of the Runtime</source>
         <translation>ランタイムの初期化中に予期しないエラー(%2)</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="619"/>
         <source>Kernel driver not accessible</source>
         <translation>カーネルドライバーにアクセスできません</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="76"/>
         <source>The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necess [...]
         <translation>VirtualBoxのLinuxカーネルドライバー(vboxdrv)は読み込まれていないか、/dev/vboxdrvのパーミッションに問題があります。root権限で<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>を実行してカーネルモジュールを再インストールしてください。もしディストリビューションにある場合、まずDKMSパッケージをインストールしてください。このパッケージはLinuxカーネルの変更を把握し、必要ならばvboxdrvカーネルモジュールを再コンパイルします。</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="86"/>
         <source>The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Please try completely uninstalling and reinstalling VirtualBox.</source>
         <translation>カーネルモジュールのバージョンが適合しません。VirtualBoxのインストールは成功しませんでした。この問題はVirtualBoxを完全にアンインストール後、再インストールすることで解決するかもしれません。</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="93"/>
         <source>The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.</source>
         <translation>カーネルモジュールのバージョンが適合しません。VirtualBoxのインストールは成功しませんでした。</br></br><font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>を実行すると、この問題は修正されるでしょう。VirtualBoxのOSEバージョンとPUELバージョンを混在して使用しないでください。</translation>
     </message>
     <message>
-        <location filename="../src/main.cpp" line="71"/>
         <source>This error means that the kernel driver was either not able to allocate enough memory or that some mapping operation failed.</source>
         <translation>このエラーは、カーネルドライバーに十分なメモリーを割り当てることができなかったか、何らかのマッピング操作が失敗したことを意味します。</translation>
     </message>
@@ -178,12 +159,10 @@
 <context>
     <name>QIArrowSplitter</name>
     <message>
-        <location filename="../src/extensions/QIArrowSplitter.cpp" line="32"/>
         <source>&Back</source>
         <translation>戻る(&B)</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIArrowSplitter.cpp" line="33"/>
         <source>&Next</source>
         <translation>次へ(&N)</translation>
     </message>
@@ -191,13 +170,10 @@
 <context>
     <name>QIFileDialog</name>
     <message>
-        <location filename="../src/extensions/QIFileDialog.cpp" line="270"/>
         <source>Select a directory</source>
         <translation>ディレクトリを選択</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIFileDialog.cpp" line="468"/>
-        <location filename="../src/extensions/QIFileDialog.cpp" line="717"/>
         <source>Select a file</source>
         <translation>ファイルを選択</translation>
     </message>
@@ -223,7 +199,6 @@
 <context>
     <name>QILabel</name>
     <message>
-        <location filename="../src/extensions/QILabel.cpp" line="197"/>
         <source>&Copy</source>
         <translation>コピー(&C)</translation>
     </message>
@@ -238,32 +213,22 @@
 <context>
     <name>QIMessageBox</name>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="292"/>
         <source>Copy all errors to the clipboard</source>
         <translation>クリップボードにすべてのエラーをコピー</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="310"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1733"/>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="176"/>
         <source>OK</source>
         <translation>OK</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="312"/>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="186"/>
         <source>Yes</source>
         <translation>はい</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="313"/>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="187"/>
         <source>No</source>
         <translation>いいえ</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="311"/>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="182"/>
         <source>Cancel</source>
         <translation>キャンセル</translation>
     </message>
@@ -272,17 +237,14 @@
         <translation type="obsolete">無視</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="314"/>
         <source>Copy</source>
         <translation>コピー</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="370"/>
         <source>&Details</source>
         <translation>詳細(&D)</translation>
     </message>
     <message>
-        <location filename="../src/extensions/QIMessageBox.cpp" line="394"/>
         <source>&Details (%1 of %2)</source>
         <translation>詳細(%2の%1)(&D)</translation>
     </message>
@@ -325,8 +287,6 @@
 <context>
     <name>UIActionPool</name>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="41"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="396"/>
         <source>&Machine</source>
         <translation>仮想マシン(&M)</translation>
     </message>
@@ -340,14 +300,13 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">シームレスモード(&L)</translation>
+        <translation>シームレスモード(&L)</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
         <translation type="obsolete">シームレスモードに切り替える</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="613"/>
         <source>Auto-resize &Guest Display</source>
         <translation>ゲストOSの画面を自動リサイズ(&G)</translation>
     </message>
@@ -376,7 +335,6 @@
         <translation type="obsolete">ゲストOS画面の自動リサイズを有効化(&G)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="614"/>
         <source>Automatically resize the guest display when the window is resized (requires Guest Additions)</source>
         <translation>ウィンドウをリサイズしたとき、ゲストOS画面を自動的にリサイズする(Guest Additions のインストールが必要)</translation>
     </message>
@@ -389,56 +347,48 @@
         <translation type="obsolete">ゲストOS画面の自動リサイズを無効にする</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="644"/>
         <source>&Adjust Window Size</source>
         <translation>ウィンドウのサイズを調整(&A)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="645"/>
         <source>Adjust window size and position to best fit the guest display</source>
         <translation>ゲストOS画面に合わせてウィンドウのサイズと位置を調整する</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="214"/>
         <source>Disable &Mouse Integration</source>
-        <translation>マウス統合を無効化(&M)</translation>
+        <translation type="obsolete">マウス統合を無効化(&M)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="71"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="523"/>
         <source>&Settings...</source>
         <translation>設定(&S)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="72"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="524"/>
         <source>Manage the virtual machine settings</source>
         <translation>仮想マシンの設定を変更</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="102"/>
         <source>Take Sn&apshot...</source>
         <translation>スナップショット作成(&A)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="133"/>
         <source>Take Screensh&ot...</source>
         <translation>スクリーンショットを撮る(&O)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="134"/>
         <source>Take a screenshot of the virtual machine</source>
         <translation>仮想マシンのスクリーンショットを撮る</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="164"/>
         <source>Session I&nformation...</source>
         <translation>セッション情報(&N)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="215"/>
+        <source>Show Session Information Window</source>
+        <translation>セッション情報ウィンドウを表示</translation>
+    </message>
+    <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>一時的にホストマウスポインターの統合機能を無効化</translation>
+        <translation type="obsolete">一時的にホストマウスポインターの統合機能を無効化</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -449,30 +399,26 @@
         <translation type="obsolete">一時的に無効化したホストマウスポインターの統合機能を有効化</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="245"/>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Ctrl-Alt-Delを送信(&I)</translation>
+        <translation type="obsolete">Ctrl-Alt-Delを送信(&I)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="246"/>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>仮想マシンにCtrl-Alt-Delシーケンスを送信する</translation>
+        <translation type="obsolete">仮想マシンにCtrl-Alt-Delシーケンスを送信する</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
         <translation type="obsolete">Ctrl-Alt-Backspaceを送信(&I)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="278"/>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>仮想マシンにCtrl-Alt-Backspaceシーケンスを送信する</translation>
+        <translation type="obsolete">仮想マシンにCtrl-Alt-Backspaceシーケンスを送信する</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
         <translation type="obsolete">スナップショット作成(&S)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="103"/>
         <source>Take a snapshot of the virtual machine</source>
         <translation>仮想マシンのスナップショットを作成する</translation>
     </message>
@@ -481,23 +427,18 @@
         <translation type="obsolete">セッション情報ダイアログ(&N)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="165"/>
-        <source>Show Session Information Window</source>
-        <translation>セッション情報ウィンドウを表示</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">セッション情報ダイアログを表示</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="277"/>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Ctrl-Alt-Backspaceを送信(&E)</translation>
+        <translation type="obsolete">Ctrl-Alt-Backspaceを送信(&E)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="311"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="670"/>
         <source>&Pause</source>
         <translation>一時停止(&P)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="312"/>
         <source>Suspend the execution of the virtual machine</source>
         <translation>仮想マシンの実行を一時停止する</translation>
     </message>
@@ -510,32 +451,26 @@
         <translation type="obsolete">仮想マシンの実行を再開する</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="514"/>
         <source>Switch to &Fullscreen</source>
-        <translation>フルスクリーンモードに切り替える(&F)</translation>
+        <translation type="obsolete">フルスクリーンモードに切り替える(&F)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="515"/>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>通常のウィンドウモードとフルスクリーンモードを切り換える</translation>
+        <translation type="obsolete">通常のウィンドウモードとフルスクリーンモードを切り換える</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="547"/>
         <source>Switch to Seam&less Mode</source>
-        <translation>シームレスモードに切り換える(&L)</translation>
+        <translation type="obsolete">シームレスモードに切り換える(&L)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="548"/>
         <source>Switch between normal and seamless desktop integration mode</source>
         <translation>通常のウィンドウモードとシームレスモードを切り換える</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="580"/>
         <source>Switch to &Scaled Mode</source>
-        <translation>スケールモードに切り換える(&S)</translation>
+        <translation type="obsolete">スケールモードに切り換える(&S)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="581"/>
         <source>Switch between normal and scaled mode</source>
         <translation>通常のウィンドウモードとスケールモードを切り換える</translation>
     </message>
@@ -544,24 +479,18 @@
         <translation type="obsolete">セッション情報(&N)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="342"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="701"/>
         <source>&Reset</source>
         <translation>リセット(&R)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="343"/>
         <source>Reset the virtual machine</source>
         <translation>仮想マシンをリセットする</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="369"/>
         <source>Save the machine state of the virtual machine</source>
         <translation>選択した仮想マシンを保存状態にする</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="403"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="939"/>
         <source>ACPI Sh&utdown</source>
         <translation>ACPI シャットダウン(&U)</translation>
     </message>
@@ -570,117 +499,90 @@
         <translation type="obsolete">ACPI シャットダウン(&H)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="404"/>
         <source>Send the ACPI Power Button press event to the virtual machine</source>
         <translation>仮想マシンに電源ボタン オフのACPIイベントを送信する</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="430"/>
         <source>Power off the virtual machine</source>
         <translation>選択した仮想マシンを電源オフ</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="461"/>
         <source>&Close...</source>
         <translation>閉じる(&C)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="462"/>
         <source>Close the virtual machine</source>
         <translation>仮想マシンを閉じる</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="482"/>
         <source>&View</source>
-        <translation>ビュー(&V)</translation>
+        <translation>表示(&V)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="665"/>
         <source>&Devices</source>
         <translation>デバイス(&D)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="686"/>
         <source>&CD/DVD Devices</source>
-        <translation>CD/DVD デバイス(&C)</translation>
+        <translation type="obsolete">CD/DVD デバイス(&C)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="707"/>
         <source>&Floppy Devices</source>
-        <translation>フロッピーデバイス(&F)</translation>
+        <translation type="obsolete">フロッピーデバイス(&F)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="728"/>
         <source>&USB Devices</source>
-        <translation>USB デバイス(&U)</translation>
+        <translation type="obsolete">USB デバイス(&U)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="749"/>
         <source>&Webcams</source>
-        <translation>ウェブカメラ(&W)</translation>
+        <translation>Webカメラ(&W)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="769"/>
         <source>Shared &Clipboard</source>
         <translation>クリップボードの共有(&C)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="789"/>
         <source>Drag'n'Drop</source>
-        <translation>ドラッグ&ドロップ</translation>
-    </message>
-    <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="809"/>
-        <source>Network</source>
-        <translation type="unfinished">ネットワーク</translation>
+        <translation type="obsolete">ドラッグ&ドロップ</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="834"/>
         <source>&Network Settings...</source>
         <translation>ネットワーク設定(&N)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="877"/>
         <source>&Shared Folders Settings...</source>
         <translation>共有フォルダー設定(&S)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="905"/>
         <source>R&emote Display</source>
         <translation>リモートディスプレイ(&E)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="906"/>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
         <translation>この仮想マシンへのリモートデスクトップ(RDP)接続を切り替え</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="950"/>
         <source>&Video Capture</source>
         <translation>ビデオキャプチャー(&V)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="951"/>
         <source>Toggle video capture</source>
         <translation>ビデオキャプチャーの切り替え</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="976"/>
         <source>&Video Capture Settings...</source>
         <translation>ビデオキャプチャーの設定(&V)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="977"/>
         <source>Configure video capture settings</source>
         <translation>ビデオキャプチャーの設定を変更</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1007"/>
         <source>&Insert Guest Additions CD image...</source>
-        <translation>Guest Additions のCDイメージを挿入(&I)...</translation>
+        <translation>Guest Additions CD イメージの挿入(&I)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1008"/>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
         <translation>Guest Additions ディスクファイルを仮想ドライブに挿入します</translation>
     </message>
@@ -689,7 +591,6 @@
         <translation type="obsolete">ネットワークアダプター(&N)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="835"/>
         <source>Change the settings of network adapters</source>
         <translation>ネットワークアダプターの設定変更</translation>
     </message>
@@ -698,7 +599,6 @@
         <translation type="obsolete">共有フォルダー(&S)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="878"/>
         <source>Create or modify shared folders</source>
         <translation>共有フォルダーを作成または変更</translation>
     </message>
@@ -749,307 +649,244 @@
         <translation type="obsolete">Guest Additions インストールイメージをマウントする</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1029"/>
         <source>De&bug</source>
         <translation>デバッグ(&B)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1054"/>
         <source>&Statistics...</source>
         <comment>debug action</comment>
         <translation>統計(&S)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1079"/>
         <source>&Command Line...</source>
         <comment>debug action</comment>
         <translation>コマンドライン(&C)...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1104"/>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>ログ取得(&L)...</translation>
+        <translation type="obsolete">ログ取得(&L)...</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="327"/>
         <source>Show the log files of the selected virtual machine</source>
         <translation>選択した仮想マシンのログファイルを参照する</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="326"/>
         <source>Show &Log...</source>
         <translation>ログを参照(&L)...</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="347"/>
         <source>&Help</source>
         <translation>ヘルプ(&H)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="382"/>
         <source>&Contents...</source>
         <translation>ヘルプを表示(&C)...</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="383"/>
         <source>Show help contents</source>
         <translation>ヘルプを表示</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="408"/>
         <source>&VirtualBox Web Site...</source>
         <translation>VirtualBox Webサイト(&V)...</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="434"/>
         <source>&Reset All Warnings</source>
         <translation>すべての警告をリセット(&R)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="488"/>
         <source>C&heck for Updates...</source>
         <translation>アップデートを確認(&H)...</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="409"/>
         <source>Open the browser and go to the VirtualBox product web site</source>
         <translation>WebブラウザーでVirtualBox製品のWebサイトを開く</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="435"/>
         <source>Go back to showing all suppressed warnings and messages</source>
         <translation>すべての抑止された警告とメッセージを再度表示させる</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="461"/>
         <source>&Network Operations Manager...</source>
         <translation>ネットワーク操作マネージャー(&N)...</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="462"/>
         <source>Show Network Operations Manager</source>
         <translation>ネットワーク操作マネージャーの表示</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="489"/>
         <source>Check for a new VirtualBox version</source>
         <translation>VirtualBoxの最新バージョンを確認</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="516"/>
         <source>&About VirtualBox...</source>
         <translation>VirtualBox について(&A)...</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIActionPool.cpp" line="517"/>
         <source>Show a window with product information</source>
         <translation>製品情報ウィンドウを表示</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1143"/>
         <source>Dock Icon</source>
         <translation>ドックアイコン</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1168"/>
         <source>Show Monitor Preview</source>
         <translation>ディスプレイのプレビューを表示</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="1193"/>
         <source>Show Application Icon</source>
         <translation>アプリケーションアイコンを表示</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="42"/>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation>ファイル(&F)</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="44"/>
         <source>&File</source>
         <comment>Non Mac OS X version</comment>
         <translation>ファイル(&F)</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="75"/>
         <source>&Virtual Media Manager...</source>
         <translation>仮想メディアマネージャー(&V)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="76"/>
         <source>Display the Virtual Media Manager window</source>
         <translation>仮想メディアマネージャー ウィンドウを表示</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="106"/>
         <source>&Import Appliance...</source>
         <translation>仮想アプライアンスのインポート(&I)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="107"/>
         <source>Import an appliance into VirtualBox</source>
         <translation>仮想アプライアンスをVirtualBoxにインポート</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="137"/>
         <source>&Export Appliance...</source>
         <translation>仮想アプライアンスのエクスポート(&E)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="138"/>
         <source>Export one or more VirtualBox virtual machines as an appliance</source>
         <translation>VirtualBoxの仮想マシンを仮想アプライアンスにエクスポート</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="169"/>
         <source>&Preferences...</source>
         <comment>global settings</comment>
         <translation>環境設定(&P)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="170"/>
         <source>Display the global settings window</source>
         <translation>環境設定ウィンドウを表示</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="201"/>
         <source>E&xit</source>
         <translation>終了(&X)</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="202"/>
         <source>Close application</source>
         <translation>アプリケーションを閉じる</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="223"/>
         <source>&Group</source>
         <translation>グループ(&G)</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="253"/>
         <source>&New Machine...</source>
         <translation>新しい仮想マシン(&N)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="286"/>
         <source>&Add Machine...</source>
         <translation>仮想マシンを追加(&A)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="317"/>
         <source>Rena&me Group...</source>
         <translation>グループ名を変更(&M)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="857"/>
         <source>Sort the group of the first selected machine alphabetically</source>
         <translation>選択したグループの仮想マシンをアルファベット順にソートします</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="623"/>
         <source>Start the selected virtual machines</source>
         <translation>選択した仮想マシンを起動</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="631"/>
         <source>Switch to the windows of the selected virtual machines</source>
         <translation>選択した仮想マシンのウィンドウに切り替え</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="671"/>
         <source>Suspend the execution of the selected virtual machines</source>
         <translation>仮想マシンの実行を一時停止する</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="702"/>
         <source>Reset the selected virtual machines</source>
         <translation>選択した仮想マシンを再起動</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="736"/>
         <source>Discard the saved state of the selected virtual machines</source>
         <translation>選択した仮想マシンを破棄</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="793"/>
         <source>Show the VirtualBox Machine Definition file in Finder</source>
         <translation>仮想マシン定義ファイルをFinderに表示します</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="796"/>
         <source>Show the VirtualBox Machine Definition file in Explorer</source>
         <translation>仮想マシン定義ファイルをエクスプローラーに表示</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="827"/>
         <source>Creates an alias file to the VirtualBox Machine Definition file on your desktop</source>
         <translation>仮想マシン定義ファイルのエイリアスをデスクトップに作成</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="830"/>
         <source>Creates an shortcut file to the VirtualBox Machine Definition file on your desktop</source>
         <translation>仮想マシン定義ファイルのショートカットをデスクトップに作成</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="368"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="908"/>
         <source>Save State</source>
         <translation>保存状態</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="909"/>
         <source>Save the machine state of the selected virtual machines</source>
         <translation>選択した仮想マシンを保存状態に</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="940"/>
         <source>Send the ACPI Power Button press event to the selected virtual machines</source>
         <translation>仮想マシンに電源ボタン オフのACPIイベントを送信する</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIActionPoolRuntime.cpp" line="429"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="970"/>
         <source>Po&wer Off</source>
         <translation>電源オフ(&W)</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="971"/>
         <source>Power off the selected virtual machines</source>
         <translation>選択した仮想マシンを電源オフ</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="254"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="427"/>
         <source>Create a new virtual machine</source>
         <translation>新規仮想マシンの作成</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="287"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="460"/>
         <source>Add an existing virtual machine</source>
         <translation>既存の仮想マシンを追加</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="318"/>
         <source>Rename the selected virtual machine group</source>
         <translation>選択した仮想マシンの名前を変更</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="375"/>
         <source>Sort the items of the selected virtual machine group alphabetically</source>
         <translation>選択した仮想マシングループのアイテムをアルファベット順にソートします</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="590"/>
         <source>Remove the selected virtual machines</source>
         <translation>選択した仮想マシンを除去</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="622"/>
         <source>S&tart</source>
         <translation>起動(&T)</translation>
     </message>
@@ -1058,7 +895,6 @@
         <translation type="obsolete">選択した仮想マシンを起動</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="630"/>
         <source>S&how</source>
         <translation>表示(&H)</translation>
     </message>
@@ -1067,17 +903,14 @@
         <translation type="obsolete">選択した仮想マシンのウィンドウに切り替え</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="765"/>
         <source>Re&fresh...</source>
         <translation>最新の情報に更新(&F)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="766"/>
         <source>Refresh the accessibility state of the selected virtual machine</source>
         <translation>選択した仮想マシンのアクセス可否状態を最新の情報に更新する</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="792"/>
         <source>Show in Finder</source>
         <translation>Finderに表示</translation>
     </message>
@@ -1086,7 +919,6 @@
         <translation type="obsolete">仮想マシン定義ファイルをFinderに表示します。</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="795"/>
         <source>Show in Explorer</source>
         <translation>エクスプローラーに表示</translation>
     </message>
@@ -1095,63 +927,50 @@
         <translation type="obsolete">仮想マシン定義ファイルをエクスプローラーに表示します。</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="798"/>
         <source>Show in File Manager</source>
         <translation>ファイルマネージャーで表示</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="799"/>
         <source>Show the VirtualBox Machine Definition file in the File Manager</source>
         <translation>仮想マシン定義ファイルをファイルマネージャーで表示します</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="426"/>
         <source>&New...</source>
         <translation>新規(&N)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="348"/>
         <source>&Ungroup...</source>
         <translation>グループ解除(&U)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="349"/>
         <source>Ungroup items of the selected virtual machine group</source>
         <translation>選択した仮想マシングループのグループを解除</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="374"/>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="856"/>
         <source>Sort</source>
         <translation>ソート</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="459"/>
         <source>&Add...</source>
         <translation>追加(&A)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="490"/>
         <source>Gro&up</source>
         <translation>グループ(&U)</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="491"/>
         <source>Add a new group based on the items selected</source>
         <translation>選択したアイテムに基づいて新しいグループを作成</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="556"/>
         <source>Cl&one...</source>
         <translation>クローン(&O)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="557"/>
         <source>Clone the selected virtual machine</source>
         <translation>選択した仮想マシンをクローン</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="589"/>
         <source>&Remove...</source>
         <translation>除去(&R)...</translation>
     </message>
@@ -1160,12 +979,10 @@
         <translation type="obsolete">選択した仮想マシンを除去</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="734"/>
         <source>Discard</source>
         <translation>破棄</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="735"/>
         <source>D&iscard saved state...</source>
         <translation>保存状態を破棄(&I)...</translation>
     </message>
@@ -1174,7 +991,6 @@
         <translation type="obsolete">選択した仮想マシンを破棄</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="826"/>
         <source>Create Alias on Desktop</source>
         <translation>デスクトップにエイリアスを作成</translation>
     </message>
@@ -1183,7 +999,6 @@
         <translation type="obsolete">仮想マシン定義ファイルのエイリアスをデスクトップに作成します。</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="829"/>
         <source>Create Shortcut on Desktop</source>
         <translation>デスクトップにショートカットを作成</translation>
     </message>
@@ -1192,16 +1007,225 @@
         <translation type="obsolete">仮想マシン定義ファイルのショートカットをデスクトップに作成します。</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIActionPoolSelector.cpp" line="878"/>
         <source>&Close</source>
         <translation>閉じる(&C)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIShortcutPool.cpp" line="234"/>
-        <location filename="../src/globals/UIShortcutPool.cpp" line="241"/>
         <source>Popup Menu</source>
         <translation>ポップアップメニュー</translation>
     </message>
+    <message>
+        <source>&VirtualBox</source>
+        <translation>&VirtualBox</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>メニューバー(&M)</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>メニューバーの設定(&M)...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>メニューバーの設定をするのにウィンドウを開きます</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>メニューバーを表示(&B)</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>この仮想マシンのメニューバーの表示非表示を切り替えます</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>ステータスバー(&S)</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>ステータスバーの設定(&S)...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>ステータスバーの設定をするのにウィンドウを開きます</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>ステータスバーの表示(&B)</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>この仮想マシンのステータスバーの表示非表示を切り替えます</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>入力(&I)</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>キーボード(&K)</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>キーボードの設定(&K)...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>ショートカットの設定に環境設定ウィンドウを表示</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>マウス(&M)</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>ハードドライブ(&H)</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>ハードドライブの設定(&H)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>ハードドライブの設定変更</translation>
+    </message>
+    <message>
+        <source>Network</source>
+        <translation>ネットワーク</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>USBの設定(&U)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>USB デバイスの設定変更</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>共有フォルダー(&S)</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>ログを参照(&L)...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation>エクストラデータマネージャー(&X)...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>エクストラデータマネージャーのウィンドウを表示</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>ファイル(&F)</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation>ウィンドウ(&W)</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>最小化(&M)</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>アクティブな仮想マシンのウィンドウを最小化する</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>フルスクリーンモード(&F)</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>通常とフルスクリーンモードを切り替え</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>スケールモード(&C)</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>表示倍率(&C)</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>送信(&I) %1</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>%1 シーケンスを仮想マシンに送信</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>マウス統合(&M)</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>ホストマウスポインターの統合を有効化</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>光学ドライブ(&O)</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>フロッピードライブ(&F)</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation>&USB</translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>ドラッグ&ドロップ</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>ログ取得(&L)</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation>通常起動(&N)</translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation>ヘッドレス起動(&H)</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation>仮想マシンをバックグラウンドで起動します</translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation>デタッチモード起動(&D)</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation>仮想マシンを、ウィンドウを閉じてもバックグラウンドで継続できるオプション付きで起動します</translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>有効</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>%1 x %2 にリサイズ</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation>%1%</translation>
+    </message>
 </context>
 <context>
     <name>UIActonPool</name>
@@ -1211,120 +1235,110 @@
     </message>
 </context>
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - ディスク暗号化</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>この仮想マシンはパスワード保護されています。以下に %n パスワードを入力してください。</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIApplianceEditorWidget</name>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="102"/>
         <source>Virtual System %1</source>
         <translation>仮想システム %1</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="199"/>
         <source>Name</source>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="200"/>
         <source>Product</source>
         <translation>製品</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="201"/>
         <source>Product-URL</source>
         <translation>製品URL</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="202"/>
         <source>Vendor</source>
         <translation>ベンダー</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="203"/>
         <source>Vendor-URL</source>
         <translation>ベンダーURL</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="204"/>
         <source>Version</source>
         <translation>バージョン</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="205"/>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="880"/>
         <source>Description</source>
         <translation>説明</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="206"/>
         <source>License</source>
         <translation>ライセンス</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="207"/>
         <source>Guest OS Type</source>
         <translation>ゲストOSのタイプ</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="208"/>
         <source>CPU</source>
         <translation>CPU</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="209"/>
         <source>RAM</source>
         <translation>RAM</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="210"/>
         <source>Hard Disk Controller (IDE)</source>
         <translation>ハードディスクコントローラー (IDE)</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="211"/>
         <source>Hard Disk Controller (SATA)</source>
         <translation>ハードディスクコントローラー (SATA)</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="212"/>
         <source>Hard Disk Controller (SCSI)</source>
         <translation>ハードディスクコントローラー (SCSI)</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="213"/>
         <source>Hard Disk Controller (SAS)</source>
         <translation>ハードディスクコントローラー (SAS)</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="214"/>
         <source>DVD</source>
         <translation>DVD</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="215"/>
         <source>Floppy</source>
         <translation>フロッピー</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="216"/>
         <source>Network Adapter</source>
         <translation>ネットワークアダプター</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="217"/>
         <source>USB Controller</source>
         <translation>USB コントローラー</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="218"/>
         <source>Sound Card</source>
         <translation>サウンドカード</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="219"/>
         <source>Virtual Disk Image</source>
         <translation>仮想ディスクイメージ</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="220"/>
         <source>Unknown Hardware Item</source>
         <translation>不明なハードウェア項目</translation>
     </message>
@@ -1338,7 +1352,6 @@
         <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="254"/>
         <source><b>Original Value:</b> %1</source>
         <translation><b>元の値:</b> %1</translation>
     </message>
@@ -1348,22 +1361,18 @@
         <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="881"/>
         <source>Configuration</source>
         <translation>構成</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.ui" line="48"/>
         <source>When checked a new unique MAC address will assigned to all configured network cards.</source>
         <translation>新しい一意のMACアドレスがすべての設定してあるネットワークカードに付与されます。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.ui" line="51"/>
         <source>&Reinitialize the MAC address of all network cards</source>
         <translation>すべてのネットワークカードのMACアドレスを再初期化(&R)</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceEditorWidget.ui" line="76"/>
         <source>Warnings:</source>
         <translation>警告:</translation>
     </message>
@@ -1371,12 +1380,10 @@
 <context>
     <name>UIApplianceImportEditorWidget</name>
     <message>
-        <location filename="../src/widgets/UIApplianceImportEditorWidget.cpp" line="149"/>
         <source>Importing Appliance ...</source>
         <translation>仮想アプライアンスのインポート...</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIApplianceImportEditorWidget.cpp" line="69"/>
         <source>Reading Appliance ...</source>
         <translation>仮想アプライアンスの読み込み...</translation>
     </message>
@@ -1840,7 +1847,6 @@
         <translation type="obsolete">なし</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIVMDesktop.cpp" line="134"/>
         <source>The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:</source>
         <translation>選択した仮想マシンに<i>アクセスできません</i>。アクセス可否を再確認するには以下に示されたエラーメッセージを調査して<b>[最新の情報に更新]</b>ボタンをクリックしてください:</translation>
     </message>
@@ -1906,9 +1912,15 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation>データを読み出し中...</translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
-        <location filename="../src/runtime/UIDnDHandler.cpp" line="98"/>
         <source>Dropping data ...</source>
         <translation>データのドロップ...</translation>
     </message>
@@ -1916,9 +1928,8 @@
 <context>
     <name>UIDnDMimeData</name>
     <message>
-        <location filename="../src/runtime/UIDnDHandler.cpp" line="188"/>
         <source>Dropping data ...</source>
-        <translation>データのドロップ...</translation>
+        <translation type="obsolete">データのドロップ...</translation>
     </message>
 </context>
 <context>
@@ -1960,12 +1971,10 @@
         <translation type="obsolete">ダウンロード処理がユーザーによってキャンセルされました。</translation>
     </message>
     <message>
-        <location filename="../src/net/UIDownloader.cpp" line="45"/>
         <source>Looking for %1...</source>
         <translation>%1 を探しています...</translation>
     </message>
     <message>
-        <location filename="../src/net/UIDownloader.cpp" line="58"/>
         <source>Downloading %1...</source>
         <translation>%1 をダウンロードしています...</translation>
     </message>
@@ -1989,12 +1998,10 @@
         <translation type="obsolete"><p>ダウンロードしたファイル(<nobr><b>%1</b></nobr>)の保存に失敗しました。</p></translation>
     </message>
     <message>
-        <location filename="../src/net/UIDownloaderAdditions.cpp" line="56"/>
         <source>VirtualBox Guest Additions</source>
         <translation>VirtualBox Guest Additions</translation>
     </message>
     <message>
-        <location filename="../src/net/UIDownloaderAdditions.cpp" line="107"/>
         <source>Select folder to save Guest Additions image to</source>
         <translation>Guest Additionsイメージを保存するフォルダーを選択</translation>
     </message>
@@ -2002,12 +2009,10 @@
 <context>
     <name>UIDownloaderExtensionPack</name>
     <message>
-        <location filename="../src/net/UIDownloaderExtensionPack.cpp" line="57"/>
         <source>VirtualBox Extension Pack</source>
         <translation>VirtualBox 拡張機能パック</translation>
     </message>
     <message>
-        <location filename="../src/net/UIDownloaderExtensionPack.cpp" line="124"/>
         <source>Select folder to save %1 to</source>
         <translation>%1 を保存するフォルダーを選択</translation>
     </message>
@@ -2015,17 +2020,40 @@
 <context>
     <name>UIDownloaderUserManual</name>
     <message>
-        <location filename="../src/net/UIDownloaderUserManual.cpp" line="56"/>
         <source>VirtualBox User Manual</source>
         <translation>VirtualBox ユーザーマニュアル</translation>
     </message>
     <message>
-        <location filename="../src/net/UIDownloaderUserManual.cpp" line="111"/>
         <source>Select folder to save User Manual to</source>
         <translation>ユーザーマニュアルを保存するフォルダーを選択</translation>
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation>パスワード表フィールド</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation>ID</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>パスワード</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>以下の %n ハードドライブで使用中:</nobr><br>%1</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2575,13 +2603,11 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGChooserItemGroup</name>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="653"/>
         <source><b>%1</b></source>
         <comment>Group item tool-tip / Group name</comment>
         <translation><b>%1</b></translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="663"/>
         <source>%n group(s)</source>
         <comment>Group item tool-tip / Group info</comment>
         <translation>
@@ -2589,13 +2615,11 @@ p, li { white-space: pre-wrap; }
         </translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="666"/>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Group info wrapper</comment>
         <translation><nobr>%1</nobr></translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="679"/>
         <source>%n machine(s)</source>
         <comment>Group item tool-tip / Machine info</comment>
         <translation>
@@ -2603,7 +2627,6 @@ p, li { white-space: pre-wrap; }
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="680"/>
         <source>(%n running)</source>
         <comment>Group item tool-tip / Running machine info</comment>
         <translation>
@@ -2611,34 +2634,28 @@ p, li { white-space: pre-wrap; }
         </translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="684"/>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper</comment>
         <translation><nobr>%1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="685"/>
         <source><nobr>%1 %2</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper, including running</comment>
         <translation><nobr>%1</nobr> {1 %2<?}</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="700"/>
         <source>Collapse group</source>
         <translation>グループをたたむ</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="700"/>
         <source>Expand group</source>
         <translation>グループを広げる</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="710"/>
         <source>Enter group</source>
         <translation>グループに入る</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserItemGroup.cpp" line="712"/>
         <source>Exit group</source>
         <translation>グループを出る</translation>
     </message>
@@ -2646,7 +2663,6 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGChooserModel</name>
     <message>
-        <location filename="../src/selector/graphics/chooser/UIGChooserModel.cpp" line="506"/>
         <source>New group</source>
         <translation>新しいグループ</translation>
     </message>
@@ -2654,83 +2670,69 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGDetails</name>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="117"/>
         <source>Name</source>
         <comment>details (general)</comment>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="139"/>
         <source>Groups</source>
         <comment>details (general)</comment>
         <translation>グループ</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="291"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="388"/>
         <source>%1 MB</source>
         <comment>details</comment>
         <translation>%1 MB</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="296"/>
         <source>Processors</source>
         <comment>details (system)</comment>
         <translation>プロセッサー</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="303"/>
         <source>%1%</source>
         <comment>details</comment>
         <translation>%1%</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="325"/>
         <source>VT-x/AMD-V</source>
         <comment>details (system)</comment>
         <translation>VT-x/AMD-V</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="332"/>
         <source>PAE/NX</source>
         <comment>details (system)</comment>
         <translation>PAE/NX</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="334"/>
         <source>Acceleration</source>
         <comment>details (system)</comment>
         <translation>アクセラレーション</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="393"/>
         <source>Screens</source>
         <comment>details (display)</comment>
         <translation>スクリーン</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="404"/>
         <source>3D</source>
         <comment>details (display)</comment>
         <translation>3D</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="406"/>
         <source>Acceleration</source>
         <comment>details (display)</comment>
         <translation>アクセラレーション</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="418"/>
         <source>Disabled</source>
         <comment>details (display/vrde/VRDE server)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="509"/>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2738,13 +2740,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">未割り当て</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="581"/>
         <source>Controller</source>
         <comment>details (audio)</comment>
         <translation>コントローラー</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="585"/>
         <source>Disabled</source>
         <comment>details (audio)</comment>
         <translation>無効</translation>
@@ -2765,230 +2765,294 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ホストオンリーアダプター, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="120"/>
         <source>Operating System</source>
         <comment>details (general)</comment>
         <translation>オペレーティングシステム</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="143"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="338"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="438"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="526"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="589"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="697"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="782"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="847"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="917"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="972"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="1027"/>
         <source>Information Inaccessible</source>
         <comment>details</comment>
         <translation>取得不可能な情報</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="290"/>
         <source>Base Memory</source>
         <comment>details (system)</comment>
         <translation>メインメモリー</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="302"/>
         <source>Execution Cap</source>
         <comment>details (system)</comment>
         <translation>使用率制限</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="316"/>
         <source>Boot Order</source>
         <comment>details (system)</comment>
         <translation>起動順序</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="328"/>
         <source>Nested Paging</source>
         <comment>details (system)</comment>
         <translation>ネステッドページング</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="387"/>
         <source>Video Memory</source>
         <comment>details (display)</comment>
         <translation>ビデオメモリー</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="400"/>
         <source>2D Video</source>
         <comment>details (display)</comment>
         <translation>2D ビデオ</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="414"/>
         <source>Remote Desktop Server Port</source>
         <comment>details (display/vrde)</comment>
         <translation>リモートデスクトップサーバーポート</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="417"/>
         <source>Remote Desktop Server</source>
         <comment>details (display/vrde)</comment>
         <translation>リモートデスクトップサーバー</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="424"/>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
         <translation>ビデオキャプチャーしたファイル</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="426"/>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
         <translation>ビデオキャプチャーの属性</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="427"/>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>フレームサイズ: %1x%2, フレームレート: %3fps, ビットレート: %4kbps</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="433"/>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
         <translation>ビデオキャプチャー</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="434"/>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="523"/>
         <source>Not Attached</source>
         <comment>details (storage)</comment>
         <translation>未割り当て</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="577"/>
         <source>Host Driver</source>
         <comment>details (audio)</comment>
         <translation>ホストドライバー</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="652"/>
         <source>Bridged Adapter, %1</source>
         <comment>details (network)</comment>
         <translation>ブリッジアダプター, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="658"/>
         <source>Internal Network, '%1'</source>
         <comment>details (network)</comment>
         <translation>内部ネットワーク, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="664"/>
         <source>Host-only Adapter, '%1'</source>
         <comment>details (network)</comment>
         <translation>ホストオンリーアダプター, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="672"/>
         <source>Generic Driver, '%1'</source>
         <comment>details (network)</comment>
         <translation>汎用ドライバー, '%1' </translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="673"/>
         <source>Generic Driver, '%1' {&nbsp;%2&nbsp;}</source>
         <comment>details (network)</comment>
         <translation>汎用ドライバー, '%1' {&nbsp;%2&nbsp;} </translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="679"/>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
         <translation>NAT ネットワーク, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="689"/>
         <source>Adapter %1</source>
         <comment>details (network)</comment>
         <translation>アダプター %1</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="694"/>
         <source>Disabled</source>
         <comment>details (network/adapter)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="774"/>
         <source>Port %1</source>
         <comment>details (serial)</comment>
         <translation>ポート %1</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="779"/>
         <source>Disabled</source>
         <comment>details (serial)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="839"/>
         <source>Port %1</source>
         <comment>details (parallel)</comment>
         <translation>ポート %1</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="844"/>
         <source>Disabled</source>
         <comment>details (parallel)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="907"/>
         <source>Device Filters</source>
         <comment>details (usb)</comment>
         <translation>デバイスフィルター</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="914"/>
         <source>USB Controller Inaccessible</source>
         <comment>details (usb)</comment>
         <translation>USB コントローラーにアクセスできません</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="967"/>
         <source>Shared Folders</source>
         <comment>details (shared folders)</comment>
         <translation>共有フォルダー</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="908"/>
         <source>%1 (%2 active)</source>
         <comment>details (usb)</comment>
         <translation>%1 (%2 アクティブ)</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="911"/>
         <source>Disabled</source>
         <comment>details (usb)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="969"/>
         <source>None</source>
         <comment>details (shared folders)</comment>
         <translation>なし</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="1024"/>
         <source>None</source>
         <comment>details (description)</comment>
         <translation>なし</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>最低限の準仮想化</translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Hyper-V 準仮想化</translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>KVM 準仮想化</translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[光学ドライブ]</translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>USB コントローラー</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">表示倍率</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">スケールしない HiDPI 出力</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">有効</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>ミニツールバーの場所</translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>上部</translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>下部</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>ミニツールバー</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>無効</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">表示倍率</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">スケールしない HiDPI 出力</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">有効</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">有効</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">無効</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">有効</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">無効</translation>
+    </message>
 </context>
 <context>
     <name>UIGDetailsUpdateThreadAudio</name>
@@ -3195,37 +3259,30 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">更新を無効化</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="275"/>
         <source>Update disabled</source>
         <translation>更新を無効化</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="276"/>
         <source>Every 0.5 s</source>
         <translation>0.5秒毎</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="277"/>
         <source>Every 1 s</source>
         <translation>1秒毎</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="278"/>
         <source>Every 2 s</source>
         <translation>2秒毎</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="279"/>
         <source>Every 5 s</source>
         <translation>5秒毎</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="280"/>
         <source>Every 10 s</source>
         <translation>10秒毎</translation>
     </message>
     <message>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="121"/>
         <source>No preview</source>
         <translation>プレビューなし</translation>
     </message>
@@ -3237,78 +3294,64 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGlobalSettingsDisplay</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="24"/>
         <source>Maximum Guest Screen &Size:</source>
         <translation>ゲストスクリーンのサイズを最大化(&S):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="47"/>
         <source>&Width:</source>
         <translation>幅(&W):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="66"/>
         <source>Specifies the maximum width which we would like the guest to use.</source>
         <translation>ゲストで使用するスクリーンの最大幅を指定してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="73"/>
         <source>&Height:</source>
         <translation>高さ(&H):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="92"/>
         <source>Specifies the maximum height which we would like the guest to use.</source>
         <translation>ゲストで使用するスクリーンの最大高を指定してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="99"/>
-        <source>Machine Windows:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="115"/>
-        <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.ui" line="118"/>
-        <source>&Raise Window Under Mouse</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.cpp" line="182"/>
         <source>Automatic</source>
         <comment>Maximum Guest Screen Size</comment>
         <translation>自動</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.cpp" line="184"/>
         <source>Suggest a reasonable maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
         <translation>ゲストで使用する最大の適切なスクリーンサイズを提示します。Guest Additionsがインストールされている場合は、ゲストにはこの提案されたサイズだけが表示されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.cpp" line="187"/>
         <source>None</source>
         <comment>Maximum Guest Screen Size</comment>
         <translation>なし</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.cpp" line="189"/>
         <source>Do not attempt to limit the size of the guest screen.</source>
         <translation>ゲストスクリーンのサイズを制限しません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.cpp" line="191"/>
         <source>Hint</source>
         <comment>Maximum Guest Screen Size</comment>
         <translation>ヒント</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsDisplay.cpp" line="193"/>
         <source>Suggest a maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
         <translation>ゲストで使用する最大のスクリーンサイズを提示します。Guest Additionsがインストールされている場合は、ゲストにはこの提案されたサイズだけが表示されます。</translation>
     </message>
+    <message>
+        <source>Machine Windows:</source>
+        <translation>仮想マシンのウィンドウ:</translation>
+    </message>
+    <message>
+        <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
+        <translation>仮想マシンのウィンドウが、マウスポインターが通過する際にアクティブになるようになります。</translation>
+    </message>
+    <message>
+        <source>&Raise Window Under Mouse</source>
+        <translation>マウス通過でウィンドウをアクティブ化(&R)</translation>
+    </message>
 </context>
 <context>
     <name>UIGlobalSettingsExtension</name>
@@ -3317,53 +3360,42 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">機能拡張パッケージ(&E):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.ui" line="24"/>
         <source>&Extension Packages</source>
         <translation>拡張パッケージ(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.ui" line="55"/>
         <source>Lists all installed packages.</source>
         <translation>すべてのインストール済みパッケージをリスト表示します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.ui" line="62"/>
         <source>Active</source>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.ui" line="67"/>
         <source>Name</source>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.ui" line="72"/>
         <source>Version</source>
         <translation>バージョン</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.cpp" line="199"/>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.cpp" line="410"/>
         <source>Extensions</source>
         <translation>機能拡張</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.cpp" line="278"/>
         <source>Add package</source>
         <translation>パッケージを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.cpp" line="279"/>
         <source>Remove package</source>
         <translation>パッケージを除去</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.cpp" line="319"/>
         <source>Select an extension package file</source>
         <translation>機能拡張パッケージを選択</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsExtension.cpp" line="323"/>
         <source>Extension package files (%1)</source>
         <translation>機能拡張パッケージファイル(%1)</translation>
     </message>
@@ -3375,42 +3407,34 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">デフォルトのVDIフォルダーのパスを指定します。新規仮想ハードディスクの作成時に保存先を明示的に指定しない場合、このフォルダーが使用されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="43"/>
         <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
         <translation>デフォルトの仮想マシンフォルダーのパスを指定します。新規仮想マシンの作成時に保存先を明示的に指定しない場合、このフォルダーが使用されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="69"/>
         <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
         <translation>リモートディスプレイ(VRDP)クライアントに認証を提供するライブラリーのパスを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="76"/>
         <source>&Dock and Menubar:</source>
-        <translation>ドックとメニューバー(&D):</translation>
+        <translation type="obsolete">ドックとメニューバー(&D):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="89"/>
         <source>Auto-Show in Fullscreen</source>
-        <translation>フルスクリーン時に自動表示</translation>
+        <translation type="obsolete">フルスクリーン時に自動表示</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="92"/>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>フルスクリーンモードの際、クリックするとホストのドックとメニューバーが表示されます。</translation>
+        <translation type="obsolete">フルスクリーンモードの際、クリックするとホストのドックとメニューバーが表示されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="99"/>
         <source>&Host Screensaver:</source>
         <translation>ホストのスクリーンセーバー(&H):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="112"/>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
         <translation>仮想マシンの動作中にクリックすると、ホストのスクリーンセーバーを無効にすることができます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="115"/>
         <source>Disable When Running Virtual Machines</source>
         <translation>仮想マシンの動作時に無効</translation>
     </message>
@@ -3419,12 +3443,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">デフォルトのハードディスクフォルダー(&H):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="24"/>
         <source>Default &Machine Folder:</source>
         <translation>デフォルトの仮想マシンフォルダー(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsGeneral.ui" line="50"/>
         <source>V&RDP Authentication Library:</source>
         <translation>VRDP 認証ライブラリー(&R):</translation>
     </message>
@@ -3488,45 +3510,34 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシンのウィンドウでホストキーとして使用するキーをリセットします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.ui" line="24"/>
         <source>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</source>
         <translation>仮想マシンのウィンドウがアクティブのとき、キーボードを自動的にキャプチャーします。キーボードがキャプチャーされると、すべてのキーストローク(Alt-Tabなどを含む)が仮想マシンに送られます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.ui" line="27"/>
         <source>&Auto Capture Keyboard</source>
         <translation>キーボードの自動キャプチャー(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="97"/>
         <source>Host Key Combination</source>
         <translation>ホストキーの組み合わせ</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="173"/>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="183"/>
         <source>Some items have the same shortcuts assigned.</source>
         <translation>いくつかのアイテムに同じショートカットが割り当てられています。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="206"/>
         <source>&VirtualBox Manager</source>
         <translation>VirtualBox マネージャー(&V)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="207"/>
         <source>Virtual &Machine</source>
         <translation>仮想マシン(&M)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="208"/>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="210"/>
         <source>Lists all the available shortcuts which can be configured.</source>
         <translation>設定できるすべてのショートカット一覧を表示します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="212"/>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="213"/>
         <source>Enter a sequence to filter the shortcut list.</source>
         <translation>検索語を入力してショートカットリストを絞り込みます。</translation>
     </message>
@@ -3534,32 +3545,26 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGlobalSettingsLanguage</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="89"/>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="90"/>
         <source> (built-in)</source>
         <comment>Language</comment>
         <translation>(内蔵)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="116"/>
         <source><unavailable></source>
         <comment>Language</comment>
         <translation><利用不可></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="117"/>
         <source><unknown></source>
         <comment>Author(s)</comment>
         <translation><不明></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="130"/>
         <source>Default</source>
         <comment>Language</comment>
         <translation>デフォルト</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="367"/>
         <source>Language:</source>
         <translation>言語:</translation>
     </message>
@@ -3568,37 +3573,30 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">インターフェース言語(&I):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.ui" line="24"/>
         <source>&Interface Languages</source>
         <translation>インターフェース言語(&I)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.ui" line="34"/>
         <source>Lists all available user interface languages. The effective language is written in <b>bold</b>. Select <i>Default</i> to reset to the system default language.</source>
         <translation>利用できるユーザーインターフェース言語の一覧です。有効な言語は<b>太字</b>で示されます。システムのデフォルト言語に戻すには<i>デフォルト</i>を選択してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.ui" line="41"/>
         <source>Name</source>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.ui" line="46"/>
         <source>Id</source>
         <translation>Id</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.ui" line="51"/>
         <source>Language</source>
         <translation>言語</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.ui" line="56"/>
         <source>Author</source>
         <translation>作者</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsLanguage.cpp" line="369"/>
         <source>Author(s):</source>
         <translation>作者:</translation>
     </message>
@@ -3639,269 +3637,211 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">DHCP アドレス上限値<b>"%1"</b>が不正</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="130"/>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
         <translation>以前の <b>%1</b> NATネットワークに新しい名前が与えられていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="140"/>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
         <translation><b>%1</b> NATネットワークにCIDRが与えられていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="142"/>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
         <translation>以前の <b>%1</b> NATネットワークにCIDRが与えられていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="153"/>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
         <translation>無効なCIDR (<i>%1</i>) がNATネットワーク <b>%2</b>で指定されています。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="156"/>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
         <translation>無効なCIDR (<i>%1</i>) が以前のNATネットワーク <b>%2</b>で指定されています。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="179"/>
         <source>Network Name</source>
         <translation>ネットワーク名</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="186"/>
         <source>[empty]</source>
         <translation>[空]</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="187"/>
         <source>%1 (renamed from %2)</source>
         <translation>%1 (%2 から名称変更した)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="188"/>
         <source>Old Network Name</source>
         <translation>古いネットワーク名</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="189"/>
         <source>New Network Name</source>
         <translation>新しいネットワーク名</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="193"/>
         <source>Network CIDR</source>
         <translation>ネットワークCIDR</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="194"/>
         <source>Supports DHCP</source>
         <translation>DHCPのサポート</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="195"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="197"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="199"/>
         <source>yes</source>
         <translation>はい</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="195"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="197"/>
         <source>no</source>
         <translation>いいえ</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="196"/>
         <source>Supports IPv6</source>
         <translation>IPv6のサポート</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="199"/>
         <source>Default IPv6 route</source>
         <translation>IPv6デフォルトルート</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="244"/>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
         <translation>ホストインターフェース <b>%1</b> は正しいIPv4アドレスではありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="251"/>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
         <translation>ホストインターフェース <b>%1</b> は正しいIPv4ネットワークマスクではありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="260"/>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
         <translation>ホストインターフェース <b>%1</b> は正しいIPv6アドレスではありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="272"/>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
         <translation>ホストインターフェース <b>%1</b> は正しいDHCPサーバーアドレスではありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="278"/>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
         <translation>ホストインターフェース <b>%1</b> は正しいDHCPサーバーマスクではありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="284"/>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
         <translation>ホストインターフェース <b>%1</b> は正しいDHCPサーバーのアドレス下限にありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="290"/>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
         <translation>ホストインターフェース <b>%1</b> は正しいDHCPサーバーのアドレス上限にありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="308"/>
         <source>Adapter</source>
         <translation>アダプター</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="310"/>
         <source>Automatically configured</source>
         <comment>interface</comment>
         <translation>自動構成</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="311"/>
         <source>Manually configured</source>
         <comment>interface</comment>
         <translation>手動構成</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="314"/>
         <source>IPv4 Address</source>
         <translation>IPv4 アドレス</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="316"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="326"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="344"/>
         <source>Not set</source>
         <comment>address</comment>
         <translation>未設定</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="318"/>
         <source>IPv4 Network Mask</source>
         <translation>IPv4 ネットマスク</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="320"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="348"/>
         <source>Not set</source>
         <comment>mask</comment>
         <translation>未設定</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="324"/>
         <source>IPv6 Address</source>
         <translation>IPv6 アドレス</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="328"/>
         <source>IPv6 Network Mask Length</source>
         <translation>IPv6 ネットマスク</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="330"/>
         <source>Not set</source>
         <comment>length</comment>
         <translation>未設定</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="336"/>
         <source>DHCP Server</source>
         <translation>DHCP サーバー</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="338"/>
         <source>Enabled</source>
         <comment>server</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="339"/>
         <source>Disabled</source>
         <comment>server</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="342"/>
         <source>Address</source>
         <translation>アドレス</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="346"/>
         <source>Network Mask</source>
         <translation>ネットマスク</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="350"/>
         <source>Lower Bound</source>
         <translation>下限</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="352"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="356"/>
         <source>Not set</source>
         <comment>bound</comment>
         <translation>未設定</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="354"/>
         <source>Upper Bound</source>
         <translation>上限</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="589"/>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
         <translation><b>%1</b> はいくつかのNATネットワークで使用されています。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="639"/>
         <source>Active</source>
         <comment>NAT network</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="643"/>
         <source>&Add NAT network</source>
         <translation>NATネットワークの追加(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="644"/>
         <source>&Remove NAT network</source>
         <translation>NATネットワークの除去(&R)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="645"/>
         <source>&Edit NAT network</source>
         <translation>NATネットワークの編集(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="659"/>
         <source>&Add host-only network</source>
         <translation>ホストオンリーネットワークを追加(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="660"/>
         <source>&Remove host-only network</source>
         <translation>ホストオンリーネットワークを除去(&R)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="661"/>
         <source>&Edit host-only network</source>
         <translation>ホストオンリーネットワークを編集(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="778"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="830"/>
         <source>Networking</source>
         <translation>ネットワーク</translation>
     </message>
@@ -3919,28 +3859,22 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ホストオンリーネットワーク(&H):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.ui" line="22"/>
         <source>&NAT Networks</source>
         <translation>&NATネットワーク</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.ui" line="46"/>
         <source>Lists all available NAT networks.</source>
         <translation>利用可能なNATネットワークをリスト表示します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.ui" line="60"/>
         <source>&Host-only Networks</source>
         <translation>ホストオンリーネットワーク(&H)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.ui" line="84"/>
         <source>Lists all available host-only networks.</source>
         <translation>利用可能なホストオンリーネットワークをリスト表示します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.ui" line="91"/>
-        <location filename="../src/settings/global/UIGlobalSettingsNetwork.cpp" line="640"/>
         <source>Name</source>
         <translation>名前</translation>
     </message>
@@ -4043,117 +3977,94 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="26"/>
         <source>Host-only Network Details</source>
         <translation>ホストオンリーネットワークの詳細</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="42"/>
         <source>&Adapter</source>
         <translation>アダプター(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="48"/>
         <source>Manual &Configuration</source>
         <translation>手動構成(&C)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="54"/>
         <source>Use manual configuration for this host-only network adapter.</source>
         <translation>このホストオンリーネットワークアダプターを手動で構成します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="61"/>
         <source>&IPv4 Address:</source>
         <translation>IPv4 アドレス(&I):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="80"/>
         <source>Holds the host IPv4 address for this adapter.</source>
         <translation>このアダプターのホスト IPv4 アドレスを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="87"/>
         <source>IPv4 Network &Mask:</source>
         <translation>IPv4 ネットマスク(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="106"/>
         <source>Holds the host IPv4 network mask for this adapter.</source>
         <translation>このアダプターのホスト IPv4 ネットマスクを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="113"/>
         <source>I&Pv6 Address:</source>
         <translation>IPv6 アドレス(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="132"/>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
         <translation>IPv6がサポートされるとき、このアダプターのホスト IPv6 アドレスを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="139"/>
         <source>IPv6 Network Mask &Length:</source>
         <translation>IPv6 ネットマスク長(&L):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="158"/>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
         <translation>IPv6がサポートされるとき、このアダプターのホスト IPv6 ネットマスクのプレフィックス長を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="179"/>
         <source>&DHCP Server</source>
         <translation>DHCP サーバー(&D)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="185"/>
         <source>&Enable Server</source>
         <translation>サーバーを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="188"/>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
         <translation>仮想マシンの起動時にDHCP サーバーを有効化するかどうかを示します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="195"/>
         <source>Server Add&ress:</source>
         <translation>サーバー アドレス(&R):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="214"/>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
         <translation>ホストオンリーアダプターにDHCP サーバーによって割り当てられるIPアドレスを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="221"/>
         <source>Server &Mask:</source>
         <translation>サーバー マスク(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="240"/>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
         <translation>ホストオンリーアダプターでDHCP サーバーによって割り当てられるネットマスクを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="247"/>
         <source>&Lower Address Bound:</source>
         <translation>アドレス下限(&L):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="266"/>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
         <translation>ホストオンリーアダプターでDHCP サーバーによって割り当てられるアドレスの下限値を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="273"/>
         <source>&Upper Address Bound:</source>
         <translation>アドレス上限(&U):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsHost.ui" line="292"/>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
         <translation>ホストオンリーアダプターでDHCP サーバーによって割り当てられるアドレスの上限値を指定します。</translation>
     </message>
@@ -4161,82 +4072,66 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="18"/>
         <source>NAT Network Details</source>
         <translation>NAT ネットワーク詳細</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="24"/>
         <source>&Enable Network</source>
         <translation>ネットワークを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="27"/>
         <source>Enable this NAT network.</source>
         <translation>このNATネットワークを有効化します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="53"/>
         <source>Network &Name:</source>
         <translation>ネットワーク名(&N):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="66"/>
         <source>Holds the name for this network.</source>
         <translation>このネットワークの名前を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="73"/>
         <source>Network &CIDR:</source>
         <translation>ネットワーク &CIDR:</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="86"/>
         <source>Holds the CIDR for this network.</source>
         <translation>このネットワークのCIDRを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="96"/>
         <source>Network Options:</source>
         <translation>ネットワークオプション:</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="103"/>
         <source>Supports &DHCP</source>
         <translation>&DHCPのサポート</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="106"/>
         <source>Determines whether this network supports DHCP.</source>
         <translation>このネットワークでDHCPをサポートするかを決定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="113"/>
         <source>Supports &IPv6</source>
         <translation>&IPv6サポート</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="116"/>
         <source>Determines whether this network supports IPv6.</source>
         <translation>このネットワークでIPv6をサポートするかを決定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="123"/>
         <source>Advertise Default IPv6 &Route</source>
         <translation>IPv6デフォルトルートのアドバタイズ(&R)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="126"/>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
         <translation>このネットワークでIPv6デフォルトルートのアドバタイズをするかどうかを決定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="133"/>
         <source>Opens a window to manage port forwarding rules.</source>
         <translation>ポートフォワーディングのルールを設定するウィンドウを開きます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsNetworkDetailsNAT.ui" line="136"/>
         <source>&Port Forwarding</source>
         <translation>ポートフォワーディング(&P)</translation>
     </message>
@@ -4244,17 +4139,14 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp" line="103"/>
         <source>Port Forwarding Rules</source>
         <translation>ポートフォワーディングのルール</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp" line="105"/>
         <source>IPv4</source>
         <translation>IPv4</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp" line="106"/>
         <source>IPv6</source>
         <translation>IPv6</translation>
     </message>
@@ -4262,32 +4154,26 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGlobalSettingsProxy</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.ui" line="24"/>
         <source>When checked, VirtualBox will use the proxy settings supplied for tasks like downloading Guest Additions from the network or checking for updates.</source>
         <translation>VirtualBoxはGuest Additionsのネットワークからのダウンロードやアップデートの確認にプロキシー設定を使用します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.ui" line="27"/>
         <source>&Enable Proxy</source>
         <translation>プロキシーを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.ui" line="62"/>
         <source>Ho&st:</source>
         <translation>ホスト(&S):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.ui" line="75"/>
         <source>Changes the proxy host.</source>
         <translation>プロキシーのホストを変更します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.ui" line="82"/>
         <source>&Port:</source>
         <translation>ポート(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.ui" line="95"/>
         <source>Changes the proxy port.</source>
         <translation>プロキシーのポートを変更します。</translation>
     </message>
@@ -4316,12 +4202,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">認証に使用するパスワードを変更します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.cpp" line="121"/>
         <source>No proxy host is currently specified.</source>
         <translation>現在プロキシーのホストが指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsProxy.cpp" line="128"/>
         <source>No proxy port is currently specified.</source>
         <translation>現在プロキシーのポートが指定されていません。</translation>
     </message>
@@ -4329,62 +4213,50 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIGlobalSettingsUpdate</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="24"/>
         <source>When checked, the application will periodically connect to the VirtualBox website and check whether a new VirtualBox version is available.</source>
         <translation>定期的にVirtualBoxウェブサイトに接続して、VirtualBoxの新しいバージョンが利用可能であるかどうか確認します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="27"/>
         <source>&Check for Updates</source>
         <translation>アップデートを確認(&C)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="56"/>
         <source>&Once per:</source>
         <translation>頻度(&O):</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="71"/>
         <source>Specifies how often the new version check should be performed. Note that if you want to completely disable this check, just clear the above check box.</source>
         <translation>アップデートを確認する頻度を指定します。 注:アップデートを確認しない場合は、上のチェックボックスをオフにしてください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="99"/>
         <source>Next Check:</source>
         <translation>次回の確認:</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="112"/>
         <source>Check for:</source>
         <translation>確認:</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="122"/>
         <source><p>Choose this if you only wish to be notified about stable updates to VirtualBox.</p></source>
         <translation><p>VirtualBoxの安定版のみ通知します。</p></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="125"/>
         <source>&Stable Release Versions</source>
         <translation>安定版のみ(&S)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="132"/>
         <source><p>Choose this if you wish to be notified about all new VirtualBox releases.</p></source>
         <translation><p>VirtualBoxのすべてのリリース版に関して通知します。</p></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="135"/>
         <source>&All New Releases</source>
         <translation>すべてのリリース版(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="142"/>
         <source><p>Choose this to be notified about all new VirtualBox releases and pre-release versions of VirtualBox.</p></source>
         <translation><p>VirtualBoxのすべてのリリース版とプレリリース版に関して通知します。</p></translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsUpdate.ui" line="145"/>
         <source>All New Releases and &Pre-Releases</source>
         <translation>すべてのリリース版とプレリリース版(&P)</translation>
     </message>
@@ -4392,7 +4264,6 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIHelpButton</name>
     <message>
-        <location filename="../src/widgets/UISpecialControls.cpp" line="173"/>
         <source>&Help</source>
         <translation>ヘルプ(&H)</translation>
     </message>
@@ -4400,89 +4271,70 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIHostComboEditor</name>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="103"/>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="117"/>
         <source><key_%1></source>
         <translation><キー_%1></translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="129"/>
         <source>Left </source>
         <translation>左 </translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="135"/>
         <source>Right </source>
         <translation>右 </translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="250"/>
         <source>Left Shift</source>
         <translation>左 Shift</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="251"/>
         <source>Right Shift</source>
         <translation>右 Shift</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="252"/>
         <source>Left Ctrl</source>
         <translation>左 Ctrl</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="253"/>
         <source>Right Ctrl</source>
         <translation>右 Ctrl</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="254"/>
         <source>Left Alt</source>
         <translation>左 Alt</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="255"/>
         <source>Right Alt</source>
         <translation>右 Alt</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="256"/>
         <source>Left WinKey</source>
         <translation>左 Windowsキー</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="257"/>
         <source>Right WinKey</source>
         <translation>右 Windowsキー</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="258"/>
         <source>Menu key</source>
         <translation>メニューキー</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="259"/>
         <source>Alt Gr</source>
         <translation>Alt Gr</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="260"/>
         <source>Caps Lock</source>
         <translation>Caps Lock</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="261"/>
         <source>Scroll Lock</source>
         <translation>Scroll Lock</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="278"/>
         <source>Host+</source>
         <translation>Host+</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="293"/>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="733"/>
         <source>None</source>
         <translation>なし</translation>
     </message>
@@ -4670,13 +4522,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Back</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHotKeyEditor.cpp" line="172"/>
         <source>Reset shortcut to default</source>
         <translation>ショートカットを既定にリセットする</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIHostComboEditor.cpp" line="367"/>
-        <location filename="../src/widgets/UIHotKeyEditor.cpp" line="173"/>
         <source>Unset shortcut</source>
         <translation>ショートカットを戻す</translation>
     </message>
@@ -4684,12 +4533,10 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="331"/>
         <source>Name</source>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/settings/global/UIGlobalSettingsInput.cpp" line="332"/>
         <source>Shortcut</source>
         <translation>ショートカット</translation>
     </message>
@@ -4784,42 +4631,34 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIImportLicenseViewer</name>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="117"/>
         <source><b>The virtual system "%1" requires that you agree to the terms and conditions of the software license agreement shown below.</b><br /><br />Click <b>Agree</b> to continue or click <b>Disagree</b> to cancel the import.</source>
         <translation><b>仮想システム"%1"のインポートには、以下のソフトウェア使用許諾契約への同意が必要です。</b><br /><br />[同意する]をクリックして続行するか、[同意しない]をクリックしてインポートを中止してください。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="115"/>
         <source>Software License Agreement</source>
         <translation>ソフトウェア使用許諾契約</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="121"/>
         <source>&Disagree</source>
         <translation>同意しない(&D)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="122"/>
         <source>&Agree</source>
         <translation>同意する(&A)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="123"/>
         <source>&Print...</source>
         <translation>印刷(&P)...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="124"/>
         <source>&Save...</source>
         <translation>保存(&S)...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="96"/>
         <source>Text (*.txt)</source>
         <translation>テキストファイル(*.txt)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="97"/>
         <source>Save license to file...</source>
         <translation>使用許諾契約をファイルに保存...</translation>
     </message>
@@ -4827,100 +4666,83 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIIndicatorsPool</name>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="76"/>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the virtual hard disks:</nobr>%1</p></source>
         <comment>HDD tooltip</comment>
         <translation><p style='white-space:pre'><nobr>アクティブな仮想ハードディスクを表示:</nobr>%1</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="142"/>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>アクティブなCD/DVD デバイスを表示:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>アクティブなCD/DVD デバイスを表示:</nobr>%1</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="212"/>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>アクティブなフロッピーデバイスを表示:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>アクティブなフロッピーデバイスを表示:</nobr>%1</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="289"/>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
         <translation><p style='white-space:pre'><nobr>アクティブなネットワーク デバイスを表示:</nobr>%1</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="326"/>
         <source><br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr></source>
         <comment>Network adapters tooltip</comment>
         <translation><br><nobr><b>アダプター %1 (%2)</b>:%3 ケーブル %4</nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="332"/>
         <source>connected</source>
         <comment>Network adapters tooltip</comment>
         <translation>接続</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="333"/>
         <source>disconnected</source>
         <comment>Network adapters tooltip</comment>
         <translation>切断</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="343"/>
         <source><br><nobr><b>All network adapters are disabled</b></nobr></source>
         <comment>Network adapters tooltip</comment>
         <translation><br><nobr><b>すべてのネットワークアダプターが無効</b></nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="388"/>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the attached USB devices:</nobr>%1</p></source>
         <comment>USB device tooltip</comment>
         <translation><p style='white-space:pre'><nobr>アクティブなUSB デバイスを表示:</nobr>%1</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="413"/>
         <source><br><nobr><b>No USB devices attached</b></nobr></source>
         <comment>USB device tooltip</comment>
         <translation><br><nobr><b>USB デバイスが割り当てられていない</b></nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="416"/>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB コントローラーが無効</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB コントローラーが無効</b></nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="454"/>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
         <comment>Shared folders tooltip</comment>
         <translation><p style='white-space:pre'><nobr>アクティブな共有フォルダーを表示:</nobr>%1</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="490"/>
         <source><br><nobr><b>No shared folders</b></nobr></source>
         <comment>Shared folders tooltip</comment>
         <translation><br><nobr><b>共有フォルダーなし</b></nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="547"/>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
         <translation><nobr>ビデオキャプチャーの状態を表示:</nobr><br>%1</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="552"/>
         <source><nobr><b>Video capture disabled</b></nobr></source>
         <translation><nobr><b>ビデオキャプチャーが無効</b></nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="557"/>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
         <translation><nobr><b>ビデオキャプチャーのファイル:</b> %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="680"/>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
         <translation>仮想マシンで使用されているさまざまな機能の状態を表示:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
@@ -4948,26 +4770,36 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシンで使用される仮想化支援機能の状態を表示:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="694"/>
         <source><br><nobr><b>%1:</b>&nbsp;%2</nobr></source>
         <comment>Virtualization Stuff LED</comment>
         <translation><br><nobr><b>%1:</b>&nbsp;%2</nobr></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="727"/>
         <source>Indicates whether the host mouse pointer is captured by the guest OS:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer is captured</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;mouse integration (MI) is On</nobr><br><nobr><img src=:/mouse_can_seamless_ [...]
         <translation>ホストマウスポインターのキャプチャー状態を表示:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;キャプチャーされていません</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;キャプチャーされています</nobr><br><nobr><<img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;マウス統合は有効です</nobr><br><nobr><img src=:/mouse_can_seamless_16px.png/>&nbsp;&nbsp;マウス統合は無効、キャプチャーされています</nobr>< [...]
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="777"/>
         <source>Indicates whether the keyboard is captured by the guest OS (<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>).</source>
         <translation>キーボードがゲストOSにキャプチャーされているとき(<img src=:/hostkey_captured_16px.png/>)か、そうではないとき(<img src=:/hostkey_16px.png/>)かを表示します。</translation>
     </message>
-</context>
-<context>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>アクティブなディスプレイを表示:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>アクティブな光学ドライブを表示:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>アクティブなフロッピーデバイスを表示:</nobr>%1</p></translation>
+    </message>
+</context>
+<context>
     <name>UILineTextEdit</name>
     <message>
-        <location filename="../src/widgets/UILineTextEdit.cpp" line="113"/>
         <source>&Edit</source>
         <translation>編集(&E)</translation>
     </message>
@@ -4983,34 +4815,20 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">試験的ビルド %1r%2 - %3</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="764"/>
         <source>Preview Monitor %1</source>
         <translation>プレビュー ディスプレイ %1</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1306"/>
         <source>Snapshot %1</source>
         <translation>スナップショット %1</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1975"/>
         <source>No Webcams Connected</source>
-        <translation>ウェブカメラが接続されていません</translation>
+        <translation>Webカメラ未接続</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1976"/>
         <source>No supported webcams connected to the host PC</source>
-        <translation>ホストPCに接続されているウェブカメラはサポートされていません</translation>
-    </message>
-    <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="2201"/>
-        <source>Connect Network Adapter</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="2201"/>
-        <source>Connect Network Adapter %1</source>
-        <translation type="unfinished"></translation>
+        <translation>ホストPCにサポートしているWebカメラが接続されていません</translation>
     </message>
     <message>
         <source>More CD/DVD Images...</source>
@@ -5029,7 +4847,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">フロッピーデバイスのマウント解除</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1401"/>
         <source>Select a filename for the screenshot ...</source>
         <translation>スクリーンショットの名前を選択...</translation>
     </message>
@@ -5050,45 +4867,45 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">フロッピーデバイス 未割り当て</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1909"/>
         <source>No USB Devices Connected</source>
         <translation>USB デバイス 未接続</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1910"/>
         <source>No supported devices connected to the host PC</source>
-        <translation>ホストマシンに接続されたデバイスはサポートされていません</translation>
+        <translation>ホストPCにサポートしているデバイスが接続されていません</translation>
+    </message>
+    <message>
+        <source>Connect Network Adapter</source>
+        <translation>ネットワークアダプターを接続</translation>
+    </message>
+    <message>
+        <source>Connect Network Adapter %1</source>
+        <translation>ネットワークアダプターを接続 %1</translation>
     </message>
 </context>
 <context>
     <name>UIMachineSettingsAudio</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsAudio.ui" line="24"/>
         <source>When checked, a virtual PCI audio card will be plugged into the virtual machine and will communicate with the host audio system using the specified driver.</source>
         <translation>指定されたドライバーを使用してホストのオーディオカードと通信する仮想PCIオーディオカードを仮想マシンに接続します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsAudio.ui" line="27"/>
         <source>Enable &Audio</source>
         <translation>オーディオを有効化(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsAudio.ui" line="56"/>
         <source>Host Audio &Driver:</source>
         <translation>ホストオーディオドライバー(&D):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsAudio.ui" line="75"/>
         <source>Controls the audio output driver. The <b>Null Audio Driver</b> makes the guest see an audio card, however every access to it will be ignored.</source>
         <translation>オーディオ出力ドライバーを選択します。<b>Null Audio Driver</b>はゲストOSからオーディオカードとして認識されますが、デバイスへのすべてのアクセスは無視されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsAudio.ui" line="82"/>
         <source>Audio &Controller:</source>
         <translation>オーディオコントローラー(&C):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsAudio.ui" line="101"/>
         <source>Selects the type of the virtual sound card. Depending on this value, VirtualBox will provide different audio hardware to the virtual machine.</source>
         <translation>仮想サウンドカードのタイプを選択します。 この値により、VirtualBoxは異なったオーディオ ハードウェアを仮想マシンに提供します。</translation>
     </message>
@@ -5116,248 +4933,189 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">2D ビデオアクセラレーションが有効化されました。しかし 2D ビデオアクセラレーションはWindowsゲストでのみサポートされるため、本機能は無効化されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="322"/>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
         <translation>仮想マシンはハードウェアグラフィックスアクセラレーションを使用するように設定されています。しかしホストシステムがこの機能を提供しておらず、マシンを開始することができません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="335"/>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
         <translation>仮想マシンはビデオメモリーが <b>%1</b> よりも少なく割り当てられています。フルスクリーンやシームレスモードに切り替えるなら最低でも左記の量を割り当ててください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="346"/>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
         <translation>仮想マシンはビデオメモリーが <b>%1</b> よりも少なく割り当てられています。HDビデオを効果的に再生するなら最低でも左記の量を割り当ててください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="363"/>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>仮想マシンはハードウェアグラフィックスアクセラレーションを使用するように設定されており、かつOSのヒントがWindows Vistaかそれ以降を指定しています。ベストパフォーマンスを引き出すために、マシンのビデオメモリーを少なくとも<b>%1</b>にしてください。</translation>
+        <translation type="obsolete">仮想マシンはハードウェアグラフィックスアクセラレーションを使用するように設定されており、かつOSのヒントがWindows Vistaかそれ以降を指定しています。ベストパフォーマンスを引き出すために、マシンのビデオメモリーを少なくとも<b>%1</b>にしてください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="377"/>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation>仮想マシンはビデオストリームアクセラレーションを使用するように設定されています。この機能はWindowsゲストでしか動作しないので無効化されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="397"/>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="408"/>
         <source>The VRDE server port value is not currently specified.</source>
         <translation>VRDEサーバーのポート値が指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="415"/>
         <source>The VRDE authentication timeout value is not currently specified.</source>
         <translation>VRDE認証のタイムアウト値が指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="469"/>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="470"/>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="896"/>
         <source><qt>%1&nbsp;MB</qt></source>
         <translation><qt>%1&nbsp;MB</qt></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="471"/>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="472"/>
         <source><qt>%1</qt></source>
         <translation><qt>%1</qt></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="480"/>
         <source>User Defined</source>
         <translation>ユーザー定義</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="481"/>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="482"/>
         <source>%1 fps</source>
         <translation>%1 fps</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="483"/>
         <source>fps</source>
         <translation>fps</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="484"/>
         <source>low</source>
         <comment>quality</comment>
         <translation>低</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="485"/>
         <source>medium</source>
         <comment>quality</comment>
         <translation>中</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="486"/>
         <source>high</source>
         <comment>quality</comment>
         <translation>高</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.cpp" line="487"/>
         <source>kbps</source>
         <translation>kbps</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="30"/>
         <source>&Video</source>
-        <translation>ビデオ(&V)</translation>
+        <translation type="obsolete">ビデオ(&V)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="39"/>
         <source>Video &Memory:</source>
         <translation>ビデオメモリー(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="57"/>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="88"/>
         <source>Controls the amount of video memory provided to the virtual machine.</source>
         <translation>仮想マシンに割り当てるビデオメモリーのサイズを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="95"/>
         <source>MB</source>
         <translation>MB</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="102"/>
         <source>Mo&nitor Count:</source>
         <translation>ディスプレイ数(&N):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="120"/>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="151"/>
         <source>Controls the amount of virtual monitors provided to the virtual machine.</source>
         <translation>仮想マシンに割り当てる仮想ディスプレイの数を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="158"/>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="318"/>
         <source>Extended Features:</source>
         <translation>拡張機能:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="174"/>
         <source>When checked, the virtual machine will be given access to the 3D graphics capabilities available on the host.</source>
         <translation>仮想マシンはホストマシンの3Dグラフィックス機能を利用します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="177"/>
         <source>Enable &3D Acceleration</source>
         <translation>3Dアクセラレーションを有効化(&3)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="217"/>
         <source>&Remote Display</source>
         <translation>リモートディスプレイ(&R)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="226"/>
         <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source>
         <translation>仮想マシンのリモートデスクトッププロトコル(RDP)サーバー機能を有効にします。リモートクライアントが標準的なRDPクライアントを使用して実行中の仮想マシンに接続し、操作することを可能にします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="229"/>
         <source>&Enable Server</source>
         <translation>サーバーを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="258"/>
         <source>Server &Port:</source>
         <translation>サーバーのポート番号(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="334"/>
         <source>Specifies whether multiple simultaneous connections to the VM are permitted.</source>
         <translation>仮想マシンへの複数の同時接続を許可するかどうかを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="337"/>
         <source>&Allow Multiple Connections</source>
         <translation>複数の接続を許可(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="364"/>
         <source>Video &Capture</source>
         <translation>ビデオキャプチャー(&C)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="376"/>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
         <translation>チェックを入れると、VirtualBoxは仮想マシンのセッションをビデオファイルで録画するようになります。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="379"/>
         <source>&Enable Video Capture</source>
         <translation>ビデオキャプチャーを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="408"/>
         <source>File &Path:</source>
         <translation>ファイルのパス(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="421"/>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
         <translation>この設定は、VirtualBoxが録画したファイルをどこに保存するかを決定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="428"/>
         <source>Frame &Size:</source>
         <translation>フレームサイズ(&S):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="447"/>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
         <translation>この設定は、録画するビデオの解像度(フレームサイズ)を決定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="454"/>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
         <translation>この設定は、録画するビデオの <b>横</b> の解像度(フレーム幅)を決定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="461"/>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
         <translation>この設定は、録画するビデオの <b>縦</b> の解像度(フレーム高)を決定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="468"/>
         <source>&Frame Rate:</source>
         <translation>フレームレート(&F):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="487"/>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="519"/>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
         <translation>この設定は、最大の<b>フレーム毎秒</b>を決定します。 追加のフレームはスキップされます。この値を少なくするとスキップするフレームが多くなり、ファイルサイズが小さくなります。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="529"/>
         <source>&Quality:</source>
         <translation>画質(&Q):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="548"/>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
         <translation>この設定は<b>画質</b>を決定します。この値を増やすとビデオの見た目が良くなり、ファイルサイズが増加します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="596"/>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
         <translation>この設定はビットレート(<b>キロバイト毎秒</b>)を決定します。この値を大きくするとビデオの見た目が良くなり、ファイルサイズが増加します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="606"/>
         <source>&Screens:</source>
         <translation>スクリーン(&S):</translation>
     </message>
@@ -5366,22 +5124,18 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">VRDP サーバーのポート番号を指定します。ポートをデフォルト値にリセットするには<tt>0</tt>(ゼロ)を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="278"/>
         <source>Authentication &Method:</source>
         <translation>認証方式(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="291"/>
         <source>Defines the VRDP authentication method.</source>
         <translation>VRDP の認証方式を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="298"/>
         <source>Authentication &Timeout:</source>
         <translation>認証タイムアウト値(&T):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="311"/>
         <source>Specifies the timeout for guest authentication, in milliseconds.</source>
         <translation>ゲスト認証のタイムアウト値をミリ秒単位で指定します。</translation>
     </message>
@@ -5390,30 +5144,97 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">HD Videoを効率よく再生するために必要な値(%1)より少ないビデオメモリーが仮想マシンに割り当てられました。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="190"/>
         <source>When checked, the virtual machine will be given access to the Video Acceleration capabilities available on the host.</source>
         <translation>仮想マシンはホストマシンのビデオアクセラレーション機能を利用します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="193"/>
         <source>Enable &2D Video Acceleration</source>
         <translation>2Dビデオアクセラレーションを有効化(&2)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsDisplay.ui" line="271"/>
         <source>The VRDP Server port number. You may specify <tt>0</tt> (zero), to select port 3389, the standard port for RDP.</source>
         <translation>VRDP サーバーのポート番号です。RDP標準のポート番号(3389)を選択するために<tt>0</tt>(ゼロ)を指定できます。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIFilmContainer.cpp" line="142"/>
         <source>Screen %1</source>
         <translation>スクリーン %1</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIFilmContainer.cpp" line="143"/>
         <source>Enable video recording for screen %1.</source>
         <translation>スクリーン %1 のビデオを録画します。</translation>
     </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">ミニ ツールバー:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">フルスクリーンモードまたはシームレスモード時にミニ ツールバーを表示します。</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">フルスクリーン/シームレスモード時に表示(&F)</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">ミニ ツールバーを画面の上部に表示します。デフォルトの設定では画面の下部に表示します。</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">画面の上部に表示(&T)</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>おおよそ 5分/%1MBのビデオ</i></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation>リモートディスプレイがこの仮想マシンで有効です。しかし、これには <b>%1</b> のインストールが必要です。VirtualBoxダウンロードサイトから拡張パックをインストールするか、マシンを開始するためにリモートディスプレイを無効にしてください。</translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation>仮想マシンはハードウェアグラフィックスアクセラレーションを使用するように設定されており、かつOSタイプがWindows Vistaかそれ以降を指定しています。ベストパフォーマンスを引き出すために、マシンのビデオメモリーを少なくとも<b>%1</b>にしてください。</translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished">HiDPI:</translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished">スケールしない HiDPI 出力を使用(&U)</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsGeneral</name>
@@ -5426,23 +5247,19 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">64ビットのゲストOSタイプが選択されました。ゲストOSが仮想化支援機能(VT-x/AMD-V)を必要とするので、この機能は自動的に有効化されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.cpp" line="238"/>
         <source>No name specified for the virtual machine.</source>
         <translation>仮想マシンに名前がありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.cpp" line="245"/>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation>この仮想マシンのOSタイプは64bitです。64bitゲストシステムにはハードウェア仮想化が必須であり、設定を確認すると自動的に有効化されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.cpp" line="282"/>
         <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
         <translation>この仮想マシンのスナップショットの保存先パスを指定します。注:スナップショットは多くのディスク容量を消費します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="33"/>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>基本(&B)</translation>
     </message>
     <message>
@@ -5494,8 +5311,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシンに割り当てるビデオメモリーのサイズを指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="59"/>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>高度(&A)</translation>
     </message>
     <message>
@@ -5563,12 +5379,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">PAE/NXを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="97"/>
         <source>&Shared Clipboard:</source>
         <translation>クリップボードの共有(&S):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="116"/>
         <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
         <translation>ゲストOSとホストOSの間でクリップボードを共有するモードを定義します。注:本機能の利用にはゲストOSに Guest Additions のインストールが必要です。</translation>
     </message>
@@ -5581,27 +5395,22 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">IDE コントローラータイプ(&I):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="74"/>
         <source>S&napshot Folder:</source>
         <translation>スナップショットの保存先(&N):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="136"/>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>ドラッグ&ドロップ(&D):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="155"/>
         <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
         <translation>ドラッグ&ドロップによって選択したデータをホストOSとゲストOS間でコピーします。注:本機能の利用にはゲストOSに Guest Additions のインストールが必要です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="269"/>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>説明(&D)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="278"/>
         <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
         <translation>仮想マシンの説明を指定します。これはインストールされたゲストOSの詳細な構成に関する注釈として役立ちます。</translation>
     </message>
@@ -5610,9 +5419,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">その他(&O)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="191"/>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>仮想マシン実行中に変更したCD/DVDまたはフロッピーメディアの構成を設定ファイルに保存します。</translation>
+        <translation type="obsolete">仮想マシン実行中に変更したCD/DVDまたはフロッピーメディアの構成を設定ファイルに保存します。</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5663,39 +5471,152 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ネステッドページングを有効化(&G)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="175"/>
         <source>Removable Media:</source>
-        <translation>リムーバブル メディア:</translation>
+        <translation type="obsolete">リムーバブル メディア:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="194"/>
         <source>&Remember Runtime Changes</source>
-        <translation>実行時に変更したメディアを記録(&R)</translation>
+        <translation type="obsolete">実行時に変更したメディアを記録(&R)</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">ミニ ツールバー:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">フルスクリーンモードまたはシームレスモード時にミニ ツールバーを表示します。</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">フルスクリーン/シームレスモード時に表示(&F)</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">ミニ ツールバーを画面の上部に表示します。デフォルトの設定では画面の下部に表示します。</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">画面の上部に表示(&T)</translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation>暗号化(&R)</translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>この仮想マシンを暗号化します。</translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation>暗号化を有効化(&A)</translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation>暗号化方式(&I):</translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>仮想マシンのディスクを暗号化する際に使用する暗号化方式を決定します。</translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation>新しいパスワードの入力(&E):</translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>仮想マシンに割り当てるパスワードを決定します。</translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation>新しいパスワードの確認(&O):</translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>仮想マシンに割り当てるパスワードを確認します。</translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>この仮想マシンを暗号化しようとしています。しかし、これには<i>%1</i> のインストールが必要です。VirtualBoxダウンロードサイトから拡張パックをインストールしてください。 </translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation>暗号化方式が指定されていません。</translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation>暗号化パスワードが空です。</translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation>暗号化パスワードが一致しません。</translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>変更しない</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>VM メニューバーの内容変更を許可します。</translation>
+    </message>
+    <message>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">スクリーンの表示倍率:</translation>
+    </message>
+    <message>
+        <source>This setting determines the guest screen scale factor.</source>
+        <translation type="obsolete">この設定はゲストスクリーンの表示倍率を決定します。</translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="obsolete">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="obsolete">HiDPI:</translation>
+    </message>
+    <message>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">ゲストスクリーンの内容をホストのスクリーン解像度に合わせてスケールする処理を行いません。</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">スケールしない HiDPI 出力を使用(&U)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="204"/>
         <source>Mini ToolBar:</source>
-        <translation>ミニ ツールバー:</translation>
+        <translation>ミニツールバー:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="220"/>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>フルスクリーンモードまたはシームレスモード時にミニ ツールバーを表示します。</translation>
+        <translation>フルスクリーンモードとシームレスモード時にミニツールバーを表示します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="223"/>
         <source>Show in &Fullscreen/Seamless</source>
         <translation>フルスクリーン/シームレスモード時に表示(&F)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="239"/>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>ミニ ツールバーを画面の上部に表示します。デフォルトの設定では画面の下部に表示します。</translation>
+        <translation>ミニツールバーをスクリーンの上部に表示します。デフォルトの設定ではスクリーンの下部に表示します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsGeneral.ui" line="242"/>
         <source>Show at &Top of Screen</source>
-        <translation>画面の上部に表示(&T)</translation>
+        <translation>スクリーンの上部に表示(&T)</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>VM ステータスバーの内容変更を許可します。</translation>
     </message>
 </context>
 <context>
@@ -5709,12 +5630,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">TAP終了アプリケーションを選択</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="29"/>
         <source>When checked, plugs this virtual network adapter into the virtual machine.</source>
         <translation>仮想ネットワークアダプターを仮想マシンに接続します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="32"/>
         <source>&Enable Network Adapter</source>
         <translation>ネットワークアダプターを有効化(&E)</translation>
     </message>
@@ -5723,17 +5642,14 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">アダプタータイプ(&D):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="159"/>
         <source>Selects the type of the virtual network adapter. Depending on this value, VirtualBox will provide different network hardware to the virtual machine.</source>
         <translation>仮想ネットワークアダプターのタイプを選択します。 この値により、VirtualBoxは異なったネットワーク ハードウェアを仮想マシンに提供します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="61"/>
         <source>&Attached to:</source>
         <translation>割り当て(&A):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="80"/>
         <source>Controls how this virtual adapter is attached to the real network of the Host OS.</source>
         <translation>仮想アダプターをホストOSの実際のネットワークに割り当てる方式を指定します。</translation>
     </message>
@@ -5746,17 +5662,14 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">このアダプター用に選択した内部ネットワーク名を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="192"/>
         <source>&MAC Address:</source>
         <translation>MACアドレス(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="211"/>
         <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
         <translation>このアダプターのMACアドレスを指定します。MACアドレスは{0-9,A-F}から選択された12文字で構成されます。注:2番目の文字は偶数でなければなりません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="218"/>
         <source>Generates a new random MAC address.</source>
         <translation>MACアドレスをランダムに生成します。</translation>
     </message>
@@ -5765,7 +5678,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">生成(&G)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="249"/>
         <source>Indicates whether the virtual network cable is plugged in on machine startup or not.</source>
         <translation>仮想マシンの起動時に仮想ネットワークケーブルが接続されるかどうかを示します。</translation>
     </message>
@@ -5853,7 +5765,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">未接続</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="140"/>
         <source>Adapter &Type:</source>
         <translation>アダプタータイプ(&T):</translation>
     </message>
@@ -5886,68 +5797,54 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ユニキャストアドレスのみ許可されているため、MAC アドレスの2番目の数字は奇数にできません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="190"/>
         <source>No bridged network adapter is currently selected.</source>
         <translation>現在ブリッジネットワークアダプターが未選択です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="199"/>
         <source>No internal network name is currently specified.</source>
         <translation>現在内部ネットワーク名が未指定です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="208"/>
         <source>No host-only network adapter is currently selected.</source>
         <translation>現在ホストオンリーネットワークアダプターが未選択です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="217"/>
         <source>No generic driver is currently selected.</source>
         <translation>現在汎用ドライバーが未選択です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="226"/>
         <source>No NAT network name is currently specified.</source>
         <translation>現在NATネットワーク名が未選択です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="238"/>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
         <translation>MAC アドレスは12バイトの16進数である必要があります。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="248"/>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
         <translation>ユニキャストアドレスのみ許可されているため、MAC アドレスの2番目の数字は奇数にできません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="410"/>
         <source>Selects the network adapter on the host system that traffic to and from this network card will go through.</source>
         <translation>このネットワークカードに入出力するトラフィックが通過する、ホストシステムのネットワークアダプターを選択してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="417"/>
         <source>Holds the name of the internal network that this network card will be connected to. You can create a new internal network by choosing a name which is not used by any other network cards in this virtual machine or others.</source>
         <translation>このネットワークカードの接続先の内部ネットワーク名を入力してください。この仮想マシンまたは他に存在する、他のすべてのネットワークカードで使われていない名前を選択すると、内部ネットワークを作成することができます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="426"/>
         <source>Selects the virtual network adapter on the host system that traffic to and from this network card will go through. You can create and remove adapters using the global network settings in the virtual machine manager window.</source>
         <translation>このネットワークカードに入出力するトラフィックが通過する、ホストシステムの仮想ネットワークアダプターを選択してください。仮想マシンマネージャーウィンドウでグローバルネットワーク設定を利用すると、アダプターを作成/削除できます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="435"/>
         <source>Selects the driver to be used with this network card.</source>
         <translation>このネットワークカードで使用するドライバーを選択してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="441"/>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
         <translation>ネットワークカードに接続するNATネットワーク名を指定します。仮想マシンマネージャーウィンドウにある全体のネットワーク設定でネットワークの追加と削除ができます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="718"/>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="720"/>
         <source>Not selected</source>
         <comment>network adapter name</comment>
         <translation>未選択</translation>
@@ -5957,7 +5854,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">現在の割り当てタイプのための追加オプションダイアログを開きます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="87"/>
         <source>&Name:</source>
         <translation>名前(&N):</translation>
     </message>
@@ -5966,22 +5862,18 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><b>ブリッジアダプター</b>または<b>ホストオンリーアダプター</b>を割り当てた場合は使用するネットワークアダプターの名前を選択します。<b>内部ネットワーク</b>を割り当てた場合は内部ネットワークの名前を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="128"/>
         <source>A&dvanced</source>
         <translation>高度(&D)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="131"/>
         <source>Shows or hides additional network adapter options.</source>
         <translation>ネットワークアダプターの高度なオプションの表示/非表示を切り替えます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="166"/>
         <source>&Promiscuous Mode:</source>
         <translation>プロミスキャスモード(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="185"/>
         <source>Selects the promiscuous mode policy of the network adapter when attached to an internal network, host only network or a bridge.</source>
         <translation>内部ネットワーク/ホストオンリーネットワーク/ブリッジに接続した際の、ネットワークアダプターのプロミスキャスモードのポリシーを選択してください。</translation>
     </message>
@@ -5990,27 +5882,22 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">MACアドレス(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="232"/>
         <source>Generic Properties:</source>
         <translation>全般のプロパティ:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="242"/>
         <source>Enter any configuration settings here for the network attachment driver you will be using. The settings should be of the form <b>name=value</b> and will depend on the driver. Use <b>shift-enter</b> to add a new entry.</source>
         <translation>利用する予定のネットワーク接続ドライバーの設定を入力してください。設定は <b>name=value</b> の形式である必要があり、ドライバーに依存します。新しくエントリーを追加するには、<b>shift-enter</b> キーを使用してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="252"/>
         <source>&Cable Connected</source>
         <translation>ケーブル接続(&C)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="259"/>
         <source>Opens a window to manage port forwarding rules.</source>
         <translation>ポートフォワーディングのルールを設定するウィンドウを開きます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.ui" line="262"/>
         <source>&Port Forwarding</source>
         <translation>ポートフォワーディング(&P)</translation>
     </message>
@@ -6120,33 +6007,27 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIMachineSettingsParallel</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.cpp" line="130"/>
         <source>Port %1</source>
         <comment>parallel ports</comment>
         <translation>ポート %1</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="29"/>
         <source>When checked, enables the given parallel port of the virtual machine.</source>
         <translation>仮想マシンのパラレルポートを有効にします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="32"/>
         <source>&Enable Parallel Port</source>
         <translation>パラレルポートを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="73"/>
         <source>Port &Number:</source>
         <translation>ポート番号(&N):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="86"/>
         <source>Holds the parallel port number. You can choose one of the standard parallel ports or select <b>User-defined</b> and specify port parameters manually.</source>
         <translation>パラレルポート番号を指定します。 標準のパラレルポートか<b>[ユーザー定義]</b>を選択し、手動でポートパラメーターを指定することができます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="93"/>
         <source>&IRQ:</source>
         <translation>IRQ(&I):</translation>
     </message>
@@ -6155,7 +6036,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">このパラレルポートのIRQ番号を指定します。有効値は<tt>0</tt>から<tt>255</tt>までの範囲の整数です。<tt>15</tt>以上の値はこの仮想マシンで<b>I/O APIC</b>が有効なとき使用されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="116"/>
         <source>I/O Po&rt:</source>
         <translation>I/Oポート(&R):</translation>
     </message>
@@ -6164,22 +6044,18 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">このパラレルポートのベースI/Oポートアドレスを指定します。 有効値は<tt>0</tt>から<tt>0xFFFF</tt>の範囲の整数です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="139"/>
         <source>Port &Path:</source>
         <translation>ポートパス(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="152"/>
         <source>Holds the host parallel device name.</source>
         <translation>ホストのパラレル デバイス名を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="109"/>
         <source>Holds the IRQ number of this parallel port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
         <translation>このパラレルポートのIRQ番号を指定します。この値は<tt>0</tt>から<tt>255</tt>の範囲の整数でなければなりません。<tt>15</tt>以上の値はこの仮想マシンで<b>I/O APIC</b>が有効なとき使用されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.ui" line="132"/>
         <source>Holds the base I/O port address of this parallel port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>このパラレルポートのベースI/Oポートアドレスを指定します。 有効値は<tt>0</tt>から<tt>0xFFFF</tt>の範囲の整数です。</translation>
     </message>
@@ -6199,27 +6075,22 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">指定したポートパスはすでに使用されている</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.cpp" line="357"/>
         <source>No IRQ is currently specified.</source>
         <translation>現在IRQが指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.cpp" line="362"/>
         <source>No I/O port is currently specified.</source>
         <translation>現在 I/Oポートが指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.cpp" line="367"/>
         <source>Two or more ports have the same settings.</source>
         <translation>2つ以上のポートが同じ設定になっています。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.cpp" line="372"/>
         <source>No port path is currently specified.</source>
         <translation>現在ポートパスが指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsParallel.cpp" line="377"/>
         <source>There are currently duplicate port paths specified.</source>
         <translation>現在ポートパスが重複して指定されています。</translation>
     </message>
@@ -6227,37 +6098,30 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIMachineSettingsPortForwardingDlg</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp" line="87"/>
         <source>Port Forwarding Rules</source>
         <translation>ポートフォワーディング ルール</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="741"/>
         <source>This table contains a list of port forwarding rules.</source>
         <translation>ポートフォワーディング ルールをリスト表示します。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="744"/>
         <source>Insert new rule</source>
         <translation>新規ルールを追加</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="745"/>
         <source>Copy selected rule</source>
         <translation>選択したルールをコピー</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="746"/>
         <source>Delete selected rule</source>
         <translation>選択したルールを削除</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="747"/>
         <source>This button adds new port forwarding rule.</source>
         <translation>新規ポートフォワーディング ルールを追加します。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="748"/>
         <source>This button deletes selected port forwarding rule.</source>
         <translation>選択したポートフォワーディング ルールを削除します。</translation>
     </message>
@@ -6277,67 +6141,54 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">選択した共有フォルダーを除去(&R)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="416"/>
         <source>Adds a new shared folder definition.</source>
         <translation>新規共有フォルダーを追加します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="417"/>
         <source>Edits the selected shared folder definition.</source>
         <translation>選択した共有フォルダーの設定を編集します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="418"/>
         <source>Removes the selected shared folder definition.</source>
         <translation>選択した共有フォルダーの設定を除去します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="422"/>
         <source>Yes</source>
         <translation>はい</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="690"/>
         <source> Machine Folders</source>
         <translation>共有フォルダー</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="693"/>
         <source> Transient Folders</source>
         <translation>一時的な共有フォルダー</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="420"/>
         <source>Full</source>
         <translation>完全</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="421"/>
         <source>Read-only</source>
         <translation>読み込み専用</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.ui" line="69"/>
         <source>Lists all shared folders accessible to this machine. Use 'net use x: \\vboxsvr\share' to access a shared folder named <i>share</i> from a DOS-like OS, or 'mount -t vboxsf share mount_point' to access it from a Linux OS. This feature requires Guest Additions.</source>
         <translation>この仮想マシンでアクセス可能なすべての共有フォルダーをリスト表示します。DOS/Windows系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxsvr¥share</tt> コマンドを使用してください。<i>share</i>はアクセスしたいフォルダーの名前です。 LinuxゲストOSからアクセスする場合は <tt>mount -t vboxsf share mount_point</tt> コマンドを使用してください。本機能を使用するには Guest Additions のインストールが必要です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.ui" line="79"/>
         <source>Name</source>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.ui" line="84"/>
         <source>Path</source>
         <translation>パス</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.ui" line="89"/>
         <source>Auto-mount</source>
         <translation>自動マウント</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.ui" line="94"/>
         <source>Access</source>
         <translation>アクセス権</translation>
     </message>
@@ -6346,22 +6197,18 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">グローバルフォルダー</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="405"/>
         <source>&Add Shared Folder</source>
         <translation>共有フォルダーを追加(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="406"/>
         <source>&Edit Shared Folder</source>
         <translation>共有フォルダーを編集(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.cpp" line="407"/>
         <source>&Remove Shared Folder</source>
         <translation>共有フォルダーを除去(&R)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSF.ui" line="32"/>
         <source>&Folders List</source>
         <translation>フォルダー リスト(&F)</translation>
     </message>
@@ -6369,12 +6216,10 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIMachineSettingsSFDetails</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.cpp" line="125"/>
         <source>Add Share</source>
         <translation>共有フォルダーの追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.cpp" line="128"/>
         <source>Edit Share</source>
         <translation>設定の編集</translation>
     </message>
@@ -6383,52 +6228,38 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ダイアログ</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="26"/>
-        <source>Window</source>
-        <translation>ウィンドウ</translation>
-    </message>
-    <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="32"/>
         <source>Folder Path:</source>
         <translation>フォルダーのパス:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="45"/>
         <source>Folder Name:</source>
         <translation>フォルダー名:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="55"/>
         <source>Holds the name of the shared folder (as it will be seen by the guest OS).</source>
         <translation>ゲストOSで使用される共有フォルダー名を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="62"/>
         <source>When checked, the guest OS will not be able to write to the specified shared folder.</source>
         <translation>ゲストOSから指定された共有フォルダーへの書き込みを禁止します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="65"/>
         <source>&Read-only</source>
         <translation>読み込み専用(&R)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="72"/>
         <source>When checked, the guest OS will try to automatically mount the shared folder on startup.</source>
         <translation>ゲストOSの起動時に共有フォルダーを自動マウントします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="75"/>
         <source>&Auto-mount</source>
         <translation>自動マウント(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="82"/>
         <source>If checked, this shared folder will be permanent.</source>
         <translation>共有フォルダーを永続化します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSFDetails.ui" line="85"/>
         <source>&Make Permanent</source>
         <translation>永続化する(&M)</translation>
     </message>
@@ -6436,33 +6267,27 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIMachineSettingsSerial</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.cpp" line="148"/>
         <source>Port %1</source>
         <comment>serial ports</comment>
         <translation>ポート %1</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="29"/>
         <source>When checked, enables the given serial port of the virtual machine.</source>
         <translation>仮想マシンのシリアルポートを有効にします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="32"/>
         <source>&Enable Serial Port</source>
         <translation>シリアルポートを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="73"/>
         <source>Port &Number:</source>
         <translation>ポート番号(&N):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="86"/>
         <source>Selects the serial port number. You can choose one of the standard serial ports or select <b>User-defined</b> and specify port parameters manually.</source>
         <translation>シリアルポート番号を表示します。 標準のシリアルポートか<b>[ユーザー定義]</b>を選択し、手動でポートパラメタを指定することができます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="93"/>
         <source>&IRQ:</source>
         <translation>IRQ(&I):</translation>
     </message>
@@ -6471,7 +6296,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">このシリアルポートのIRQ番号を指定します。有効値は<tt>0</tt>から<tt>255</tt>までの範囲の整数です。<tt>15</tt>以上の値はこの仮想マシンで<b>I/O APIC</b>が有効なとき使用されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="110"/>
         <source>I/O Po&rt:</source>
         <translation>I/Oポート(&R):</translation>
     </message>
@@ -6480,49 +6304,57 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">このシリアルポートのベースI/Oポートアドレスを指定します。 有効値は<tt>0</tt>から<tt>0xFFFF</tt>の範囲の整数です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="146"/>
         <source>Port &Mode:</source>
         <translation>ポートモード(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="159"/>
         <source>Controls the working mode of this serial port. If you select <b>Disconnected</b>, the guest OS will detect the serial port but will not be able to operate it.</source>
         <translation>このシリアルポートの動作モードを指定します。 <b>[切断]</b>を選択すると、ゲストOSはシリアルポートを検出しますが、それを操作することはできません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="179"/>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>オンの場合、仮想マシンの起動時に <b>[ポートパス]</b>フィールドで指定されたパイプが作成されます。そうでなければ仮想マシンは既存のパイプを使用します。</translation>
+        <translation type="obsolete">オンの場合、仮想マシンの起動時に <b>[ポートパス]</b>フィールドで指定されたパイプが作成されます。そうでなければ仮想マシンは既存のパイプを使用します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="182"/>
         <source>&Create Pipe</source>
-        <translation>パイプ作成(&C)</translation>
+        <translation type="obsolete">パイプ作成(&C)</translation>
     </message>
     <message>
         <source>Port &Path:</source>
         <translation type="obsolete">ポートパス(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="202"/>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>ポートが<b>[ホストパイプ]</b>モードで動作しているとき、シリアルポートのパイプのパスを指定します。ポートが<b>[ホストデバイス]</b>モードで動作しているとき、ホストシリアルデバイス名を表示します。</translation>
+        <translation type="obsolete">ポートが<b>[ホストパイプ]</b>モードで動作しているとき、シリアルポートのパイプのパスを指定します。ポートが<b>[ホストデバイス]</b>モードで動作しているとき、ホストシリアルデバイス名を表示します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="189"/>
         <source>Port/File &Path:</source>
-        <translation>ポート/ファイルパス(&P):</translation>
+        <translation type="obsolete">ポート/ファイルパス(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="103"/>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
         <translation>このシリアルポートのIRQ番号を指定します。この値は<tt>0</tt>から<tt>255</tt>の範囲の整数でなければなりません。<tt>15</tt>以上の値はこの仮想マシンで<b>I/O APIC</b>が有効なとき使用されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.ui" line="120"/>
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>このシリアルポートのベースI/Oポートアドレスを指定します。 有効値は<tt>0</tt>から<tt>0xFFFF</tt>の範囲の整数です。</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation>仮想マシンは<b>パス/アドレス</b>フィールドで指定したパイプまたはソケットが存在するものと想定し、これを使おうとします。チェックを入れない場合、パイプまたはソケットは仮想マシンの開始時に作成されます。</translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>存在するパイプ/ソケットに接続(&C)</translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation>パス/アドレス(&P):</translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation><p><b>ホストにパイプ</b> モード: ホストのシリアルポートのパスに設定します。 例: Windows と Unixライクなシステムでは "\\.\pipe\myvbox" または "/tmp/myvbox"です。</p><p><b>ホストデバイス</b> モード: ホストのシリアルデバイス名に設定します。 例: "COM1" or "/dev/ttyS0"</p><p><b>Rawファイル</b> モード: シリアル出力がダンプされるホストのファイルパスを設定します</p><p><b>TCP</b>モード: TCP サーバーの場合は"ポート"、クライアントモードの場合は "ホスト名:ポート" を設定します。</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -6539,27 +6371,22 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">指定したポートパスはすでに使用されている</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.cpp" line="399"/>
         <source>No IRQ is currently specified.</source>
         <translation>現在IRQが指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.cpp" line="404"/>
         <source>No I/O port is currently specified.</source>
         <translation>現在 I/Oポートが指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.cpp" line="409"/>
         <source>Two or more ports have the same settings.</source>
         <translation>2つ以上のポートが同じ設定になっています。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.cpp" line="422"/>
         <source>No port path is currently specified.</source>
         <translation>現在ポートパスが指定されていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSerial.cpp" line="427"/>
         <source>There are currently duplicate port paths specified.</source>
         <translation>現在ポートパスが重複して指定されています。</translation>
     </message>
@@ -6643,52 +6470,42 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想IDE コントローラーのタイプを定義します。この値により、VirtualBoxは異なった仮想IDEハードウェア デバイスをゲストOSに提供します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="549"/>
         <source><nobr><b>%1</b></nobr><br><nobr>Bus:&nbsp;&nbsp;%2</nobr><br><nobr>Type:&nbsp;&nbsp;%3</nobr></source>
         <translation><nobr><b>%1</b></nobr><br><nobr>バス:&nbsp;&nbsp;%2</nobr><br><nobr>タイプ:&nbsp;&nbsp;%3</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="736"/>
         <source>Host Drive</source>
         <translation>ホストドライブ</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="736"/>
         <source>Image</source>
         <translation>イメージ</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="903"/>
         <source><nobr>Expand/Collapse&nbsp;Item</nobr></source>
         <translation><nobr>項目を展開する/折り畳む&nbsp;</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="906"/>
         <source><nobr>Add&nbsp;Hard&nbsp;Disk</nobr></source>
         <translation><nobr>ハードディスク&nbsp;の追加</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="909"/>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>CD/DVD&nbsp;デバイス&nbsp;の追加</nobr></translation>
+        <translation type="obsolete"><nobr>CD/DVD&nbsp;デバイス&nbsp;の追加</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="912"/>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>フロッピー&nbsp;デバイス&nbsp;の追加</nobr></translation>
+        <translation type="obsolete"><nobr>フロッピー&nbsp;デバイス&nbsp;の追加</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2125"/>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
         <translation>現在 <b>%1</b> に割り当てたコントローラーに名前が与えられていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2131"/>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
         <translation><b>%1</b> に割り当てたコントローラーの名前は、 <b>%2</b> に割り当てたコントローラーですでに使用中です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2149"/>
         <source>No hard disk is selected for <i>%1</i>.</source>
         <translation> <i>%1</i>のためのハードディスクが選択されていません。</translation>
     </message>
@@ -6709,13 +6526,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><i>%1</i>が使用するメディアはすでに<i>%2</i>に割り当てられています。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2175"/>
         <source>at most one supported</source>
         <comment>controller</comment>
         <translation>1個だけサポート</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2176"/>
         <source>up to %1 supported</source>
         <comment>controllers</comment>
         <translation>%1個までサポート</translation>
@@ -6725,92 +6540,78 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">%1チップセットがサポートするより多くのストレージコントローラーを指定しています。 システムページでチップセットのタイプを変更するか、ストレージページで次のストレージコントローラーの数を減らしてください: %2。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2155"/>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
         <translation>ディスク <i>%1</i>はすでに<i>%2</i>に割り当てられています。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2182"/>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>現在 %1 チップセットがサポートしている以上のストレージコントローラーを割り当てています。 システムページでチップセットのタイプを変更するか、ストレージページで次のストレージコントローラーの数を減らしてください: %2</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2208"/>
         <source>Add Controller</source>
         <translation>コントローラーを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2209"/>
         <source>Add IDE Controller</source>
         <translation>IDE コントローラーを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2210"/>
         <source>Add SATA Controller</source>
         <translation>SATA コントローラーを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2211"/>
         <source>Add SCSI Controller</source>
         <translation>SCSI コントローラーを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2212"/>
         <source>Add SAS Controller</source>
         <translation>SAS コントローラーを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2213"/>
         <source>Add Floppy Controller</source>
         <translation>フロッピーコントローラーを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2214"/>
+        <source>Add USB Controller</source>
+        <translation>USB コントローラーを追加</translation>
+    </message>
+    <message>
         <source>Remove Controller</source>
         <translation>コントローラーを除去</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2215"/>
         <source>Add Attachment</source>
         <translation>割り当ての追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2216"/>
         <source>Add Hard Disk</source>
         <translation>ハードディスクを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2217"/>
         <source>Add CD/DVD Device</source>
-        <translation>CD/DVD デバイスを追加</translation>
+        <translation type="obsolete">CD/DVD デバイスを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2218"/>
         <source>Add Floppy Device</source>
-        <translation>フロッピーデバイスを追加</translation>
+        <translation type="obsolete">フロッピーデバイスを追加</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2219"/>
         <source>Remove Attachment</source>
         <translation>割り当てを除去</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2221"/>
         <source>Adds a new controller to the end of the Storage Tree.</source>
         <translation>新しいコントローラーをストレージツリーの最後に追加します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2222"/>
         <source>Removes the controller highlighted in the Storage Tree.</source>
         <translation>ハイライト表示されたストレージツリーのコントローラーを除去します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2223"/>
         <source>Adds a new attachment to the Storage Tree using currently selected controller as parent.</source>
         <translation>現在選択されているコントローラーを親として新たな割り当てをストレージツリーに追加します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2225"/>
         <source>Removes the attachment highlighted in the Storage Tree.</source>
         <translation>ハイライト表示されたストレージツリーの割り当てを除去します。</translation>
     </message>
@@ -6835,77 +6636,58 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">SAS コントローラー</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2502"/>
         <source>Hard &Disk:</source>
         <translation>ハードディスク(&D):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2504"/>
         <source>Choose or create a virtual hard disk file. The virtual machine will see the data in the file as the contents of the virtual hard disk.</source>
         <translation>仮想ハードディスクファイルを選択または作成します。仮想マシンはファイルのデータを仮想的なハードディスクの内容と見なします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2506"/>
         <source>Set up the virtual hard disk</source>
         <translation>仮想ハードディスクの設定</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2509"/>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVDドライブ(&D):</translation>
+        <translation type="obsolete">CD/DVDドライブ(&D):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2511"/>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>仮想CD/DVDディスクを選択するか、物理ドライブを仮想ドライブに割り当てます。仮想マシンはファイルのデータまたは物理的なドライブの内容が仮想ドライブに挿入されていると見なします。</translation>
+        <translation type="obsolete">仮想CD/DVDディスクを選択するか、物理ドライブを仮想ドライブに割り当てます。仮想マシンはファイルのデータまたは物理的なドライブの内容が仮想ドライブに挿入されていると見なします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2514"/>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>仮想CD/DVDドライブの設定</translation>
+        <translation type="obsolete">仮想CD/DVDドライブの設定</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2517"/>
         <source>Floppy &Drive:</source>
         <translation>フロッピー ドライブ(&D):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2519"/>
         <source>Choose a virtual floppy disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
         <translation>仮想フロッピーディスクを選択するか、物理ドライブを仮想ドライブに割り当てます。仮想マシンはファイルのデータまたは物理的なドライブの内容が仮想ドライブに挿入されていると見なします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2522"/>
         <source>Set up the virtual floppy drive</source>
         <translation>仮想フロッピードライブの設定</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2650"/>
         <source>Create a new hard disk...</source>
         <translation>新規仮想ハードディスクの作成...</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2655"/>
         <source>Choose a virtual hard disk file...</source>
         <translation>仮想ハードディスクファイルの選択...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1718"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2663"/>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>仮想CD/DVDディスクファイルの選択...</translation>
+        <translation type="obsolete">仮想CD/DVDディスクファイルの選択...</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1719"/>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1725"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2670"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2687"/>
         <source>Remove disk from virtual drive</source>
         <translation>仮想ドライブからディスクを除去</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMachineLogic.cpp" line="1724"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="2680"/>
         <source>Choose a virtual floppy disk file...</source>
         <translation>仮想フロッピーディスクファイルの選択...</translation>
     </message>
@@ -6918,69 +6700,54 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">フロッピーデバイス(&F):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="51"/>
         <source>&Storage Tree</source>
         <translation>ストレージツリー(&S)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="69"/>
         <source>Contains all storage controllers for this machine and the virtual images and host drives attached to them.</source>
         <translation>この仮想マシンのすべてのストレージコントローラーと仮想イメージ、割り当てられたホストデバイスを含みます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="115"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="386"/>
         <source>Information</source>
         <translation>情報</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="122"/>
         <source>The Storage Tree can contain several controllers of different types. This machine currently has no controllers.</source>
         <translation>ストレージツリーは異なったタイプの複数のコントローラーを含むことができます。この仮想マシンには今のところコントローラーがありません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="161"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="279"/>
         <source>Attributes</source>
         <translation>属性</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="168"/>
         <source>&Name:</source>
         <translation>名前(&N):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="181"/>
         <source>Changes the name of the storage controller currently selected in the Storage Tree.</source>
         <translation>ストレージツリーで選択されているストレージコントローラーの名前を変更します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="188"/>
         <source>&Type:</source>
         <translation>タイプ(&T):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="201"/>
         <source>Selects the sub-type of the storage controller currently selected in the Storage Tree.</source>
         <translation>ストレージツリーで選択されているストレージコントローラーのサブタイプを選択します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="214"/>
         <source>&Port Count:</source>
         <translation>ポートの数(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="227"/>
         <source>Selects the port count of the SATA storage controller currently selected in the Storage Tree. This must be at least one more than the highest port number you need to use.</source>
         <translation>現在ストレージツリーで選択しているSATAストレージコントローラーのポート数を選択してください。1つから使用したい数だけ設定してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="240"/>
         <source>Allows to use host I/O caching capabilities.</source>
         <translation>ホストのI/O キャッシュ機能を使用します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="243"/>
         <source>Use Host I/O Cache</source>
         <translation>ホストのI/O キャッシュを使う</translation>
     </message>
@@ -6989,7 +6756,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">スロット(&L):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="313"/>
         <source>Selects the slot on the storage controller used by this attachment. The available slots depend on the type of the controller and other attachments on it.</source>
         <translation>この割り当てで使用するストレージコントローラーのスロットを選択します。利用できるスロットはコントローラーのタイプと、それを利用する他の割り当てに依存します。</translation>
     </message>
@@ -7010,72 +6776,58 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">差分ディスク(&I)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="344"/>
         <source>When checked, allows the guest to send ATAPI commands directly to the host-drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</source>
         <translation>仮想マシン内でホストに接続されたCD/DVDライターを使用可能にするため、ATAPIコマンドを直接ホストデバイスに送信します。 注:仮想マシン内でオーディオCDの書き込みはサポートされていません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="347"/>
         <source>&Passthrough</source>
         <translation>パススルー(&P)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="360"/>
         <source>When checked the virtual disk will not be removed when the guest system ejects it.</source>
         <translation>ゲストシステムが取り出ししても、仮想ディスクを除去しません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="363"/>
         <source>&Live CD/DVD</source>
         <translation>&Live CD/DVD</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="376"/>
         <source>When checked the guest system will see the virtual disk as a solid state device.</source>
         <translation>ゲストOSの仮想ディスクをSSDとして扱います。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="379"/>
         <source>&Solid-state Drive</source>
         <translation>SSD(Solid-state drive)(&S)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="413"/>
         <source>Type:</source>
         <translation>タイプ:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="433"/>
         <source>Virtual Size:</source>
         <translation>仮想的なサイズ:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="453"/>
         <source>Actual Size:</source>
         <translation>実際のサイズ:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="473"/>
         <source>Size:</source>
         <translation>サイズ:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="493"/>
         <source>Details:</source>
         <translation>詳細:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="513"/>
         <source>Location:</source>
         <translation>場所:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="393"/>
         <source>Type (Format):</source>
         <translation>タイプ(形式):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.ui" line="533"/>
         <source>Attached to:</source>
         <translation>割り当て:</translation>
     </message>
@@ -7088,13 +6840,53 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ストレージコントローラー 1</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="551"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1221"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="490"/>
-        <location filename="../src/settings/machine/UIMachineSettingsStorage.cpp" line="544"/>
         <source>Controller: %1</source>
         <translation>コントローラー: %1</translation>
     </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation>ゲストOSの仮想ディスクをホットプラグ可能なデバイスとして扱います。</translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>ホットプラグ可能(&H)</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>仮想光学ディスクファイルの選択...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>光学&nbsp;ドライブ&nbsp;の追加</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>フロッピー&nbsp;ドライブ&nbsp;の追加</nobr></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>光学ドライブを追加</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>フロッピードライブを追加</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>光学ドライブ(&D):</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>仮想光学ドライブを選択するか、物理ドライブを仮想ドライブに割り当てます。仮想マシンはファイルのデータまたは物理ドライブの内容が仮想ドライブに挿入されていると見なします。</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>仮想光学ドライブの設定</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -7139,70 +6931,56 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">USB HID(Human Interface Device)を有効にしました。 これは、USB エミュレーションも有効にしないと動作しません。OKボタンを押してVMの設定を有効にすると、自動的にこの設定を行います。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="302"/>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
         <translation>ホストコンピューターの実メモリー(<b>%2</b>)の<b>%1%</b>を超えるメモリーが仮想マシンに割り当てられています。 ホストOSが十分なメモリーを使用できません。割り当てメモリーを減らしてください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="311"/>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
         <translation>ホストコンピューターの実メモリー(<b>%2</b>)の<b>%1%</b>を超えるメモリーが仮想マシンに割り当てられています。 ホストOSが十分なメモリーを使用できないでしょう。割り当てメモリーを減らすことを考えてください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="321"/>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>I/O APIC機能はシステムページのマザーボードセクションで有効になっていません。チップセットのタイプをICH9にするなら必須です。変更を確認すると自動的に有効になります。</translation>
+        <translation type="obsolete">I/O APIC機能はシステムページのマザーボードセクションで有効になっていません。チップセットのタイプをICH9にするなら必須です。変更を確認すると自動的に有効になります。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="330"/>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>USBコントローラーエミュレーションがUSBのページで有効になっていません。USBインプットデバイスのエミュレーションを使用するのに必要です。変更を確認すると自動的に有効になります。</translation>
+        <translation type="obsolete">USBコントローラーエミュレーションがUSBのページで有効になっていません。USBインプットデバイスのエミュレーションを使用するのに必要です。変更を確認すると自動的に有効になります。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="351"/>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation>パフォーマンス上の理由で、仮想マシンに割り当てるCPU数はホストマシンの物理CPU数(<b>%1</b>)の2倍を超えてはいけません。仮想CPUの数を減らしてください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="359"/>
         <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation>ホストマシンの物理CPU数 (<b>%1</b>)より多いCPUが仮想マシンに割り当てられました。これは仮想マシンの性能を低下させます。仮想CPUの数を減らすことを考慮してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="368"/>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>I/O APIC機能はシステムページのマザーボードセクションで有効になっていません。仮想プロセッサーを複数にするのなら必須です。変更を確認すると自動的に有効になります。</translation>
+        <translation type="obsolete">I/O APIC機能はシステムページのマザーボードセクションで有効になっていません。仮想プロセッサーを複数にするのなら必須です。変更を確認すると自動的に有効になります。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="377"/>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>ハードウェア仮想化がシステムページのアクセラレーションセクションで有効になっていません。仮想プロセッサーを複数にするのなら必須です。変更を確認すると自動的に有効になります。</translation>
+        <translation type="obsolete">ハードウェア仮想化がシステムページのアクセラレーションセクションで有効になっていません。仮想プロセッサーを複数にするのなら必須です。変更を確認すると自動的に有効になります。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="386"/>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation>プロセッサーの使用率制限が低すぎます。マシンの反応が遅く感じられるでしょう。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="435"/>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="436"/>
         <source><qt>%1&nbsp;MB</qt></source>
         <translation><qt>%1&nbsp;MB</qt></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="439"/>
         <source><qt>%1&nbsp;CPU</qt></source>
         <comment>%1 is 1 for now</comment>
         <translation><qt>%1&nbsp;CPU</qt></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="443"/>
         <source><qt>%1%</qt></source>
         <comment>Min CPU execution cap in %</comment>
         <translation><qt>%1</qt></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="444"/>
         <source><qt>%1%</qt></source>
         <comment>Max CPU execution cap in %</comment>
         <translation><qt>%1</qt></translation>
@@ -7213,53 +6991,42 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><qt>%1&nbsp;CPUs</qt></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="22"/>
         <source>&Motherboard</source>
         <translation>マザーボード(&M)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="28"/>
         <source>Base &Memory:</source>
         <translation>メインメモリー(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="53"/>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="94"/>
         <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
         <translation>仮想マシンに割り当てるメインメモリーのサイズを指定します。割り当て量が多すぎると仮想マシンは起動しないかもしれません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="101"/>
         <source>MB</source>
         <translation>MB</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="110"/>
         <source>&Boot Order:</source>
         <translation>起動順序(&B):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="134"/>
         <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
         <translation>起動デバイスの優先順序を指定します。チェックボックスを使い各デバイスを有効または無効にできます。項目を上または下に移動してデバイスの順序を変更してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="186"/>
         <source>Move Down (Ctrl-Down)</source>
         <translation>下に移動(Ctrl-Down)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="189"/>
         <source>Moves the selected boot device down.</source>
         <translation>選択した起動デバイスを下に移動します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="236"/>
         <source>&Chipset:</source>
         <translation>チップセット(&C):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="257"/>
         <source>Selects the chipset to be emulated in this virtual machine. Note that the ICH9 chipset emulation is experimental and not recommended except for guest systems (such as Mac OS X) which require it.</source>
         <translation>この仮想マシンで使用するチップセットのタイプを指定します。ICH9チップセットのエミュレーションは実験的で、要求するゲストOS(MacOS Xなど)を使用しない限りは設定するべきではありません。</translation>
     </message>
@@ -7272,45 +7039,34 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">絶対座標指定のデバイスを有効化(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="407"/>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="446"/>
         <source>Controls the number of virtual CPUs in the virtual machine. You need hardware virtualization support on your host system to use more than one virtual CPU.</source>
         <translation>仮想マシンに割り当てるCPUの数を指定します。複数の仮想CPUを使用するにはホストマシンの仮想化支援機能が必要です。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="453"/>
         <source>&Execution Cap:</source>
         <translation>使用率制限(&E):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="471"/>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="509"/>
         <source>Limits the amount of time that each virtual CPU is allowed to run for. Each virtual CPU will be allowed to use up to this percentage of the processing time available on one physical CPU. The execution cap can be disabled by setting it to 100%. Setting the cap too low can make the machine feel slow to respond.</source>
         <translation>設定したそれぞれの仮想CPUの時間量を制限します。仮想CPUは物理CPUで使用する処理時間をパーセントで許可できます。使用率制限は 100% にすることによって無効になります。使用率制限を低く設定しすぎると、仮想マシンの反応が遅く感じられます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="163"/>
         <source>Move Up (Ctrl-Up)</source>
         <translation>上に移動(Ctrl-Up)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="166"/>
         <source>Moves the selected boot device up.</source>
         <translation>選択した起動デバイスを上に移動します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="279"/>
         <source>&Pointing Device:</source>
         <translation>ポインティングデバイス(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="300"/>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
         <translation>ポインティングデバイスのエミュレーションを標準のPS/2マウスにするか、USBタブレットにするか、USBマルチタッチタブレットにするかを選択します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="322"/>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="516"/>
         <source>Extended Features:</source>
         <translation>拡張機能:</translation>
     </message>
@@ -7323,32 +7079,26 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ACPIを有効化(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="332"/>
         <source>When checked, the virtual machine will support the Input Output APIC (I/O APIC), which may slightly decrease performance. <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
         <translation>仮想マシンでI/O APIC(Input Output APIC)サポートを有効にします。これは仮想マシンの性能をわずかに低下させるかもしれません。<b>注:</b>Windows ゲストOSをインストールした後で本機能を無効にしないでください!</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="335"/>
         <source>Enable &I/O APIC</source>
         <translation>I/O APICを有効化(&I)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="352"/>
         <source>If checked, the RTC device will report the time in UTC, otherwise in local (host) time. Unix usually expects the hardware clock to be set to UTC.</source>
         <translation>ハードウェアクロック(RTC)が報告する時刻を協定世界時(UTC)に設定します。オフの場合はローカルタイム(ホスト時刻)を使用します。通常UnixはハードウェアクロックをUTCとして扱います。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="355"/>
         <source>Hardware Clock in &UTC Time</source>
         <translation>ハードウェアクロックをUTCにする(&U)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="376"/>
         <source>&Processor</source>
         <translation>プロセッサー(&P)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="382"/>
         <source>&Processor(s):</source>
         <translation>プロセッサー数(&P):</translation>
     </message>
@@ -7357,61 +7107,74 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシンに割り当てるCPUの数を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="526"/>
         <source>When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine.</source>
         <translation>仮想マシンでホストCPUのPAE(物理アドレス拡張機能)を有効にします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="529"/>
         <source>Enable PA&E/NX</source>
         <translation>PAE/NXを有効化(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="550"/>
         <source>Acce&leration</source>
         <translation>アクセラレーション(&L)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="556"/>
         <source>Hardware Virtualization:</source>
         <translation>仮想化支援機能:</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="569"/>
         <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V.</source>
         <translation>仮想マシンでホストCPUの仮想化支援機能(Intel VT-xまたはAMD-V)を有効にします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="572"/>
         <source>Enable &VT-x/AMD-V</source>
         <translation>VT-x/AMD-Vを有効化(&V)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="585"/>
         <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source>
         <translation>仮想マシンでホストCPUのネステッドページング(Intel VT-x/EPTまたはAMD-V/RVI)を有効にします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="588"/>
         <source>Enable Nested Pa&ging</source>
         <translation>ネステッドページングを有効化(&G)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.cpp" line="440"/>
         <source><qt>%1&nbsp;CPUs</qt></source>
         <comment>%1 is host cpu count * 2 for now</comment>
         <translation><qt>%1&nbsp;CPUs</qt></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="342"/>
         <source>When checked, the guest will support the Extended Firmware Interface (EFI), which is required to boot certain guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</source>
         <translation>一部のOSが起動に必要とするExtended Firmware Interface(EFI)を有効化します。本オプションが有効な場合、EFIに対応していないOSは起動できません。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsSystem.ui" line="345"/>
         <source>Enable &EFI (special OSes only)</source>
         <translation>EFIを有効化(一部のOSのみ)(&E)</translation>
     </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation>準仮想化インターフェース(&P):</translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>この仮想マシンで使用する準仮想化ゲストインターフェースプロバイダーを選択します。</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>I/O APIC機能がシステムページのマザーボードセクションで有効になっていません。チップセットのタイプをICH9にするなら必須です。変更を確認すると自動的に有効になります。</translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>USBコントローラーエミュレーションがUSBのページで有効になっていません。USB入力デバイスのエミュレーションを使用するのに必要です。変更を確認すると自動的に有効になります。</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>I/O APIC機能がシステムページのマザーボードセクションで有効になっていません。仮想プロセッサーを複数にするのなら必須です。変更を確認すると自動的に有効になります。</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>ハードウェア仮想化がシステムページのアクセラレーションセクションで有効になっていません。仮想プロセッサーを複数にするのなら必須です。変更を確認すると自動的に有効になります。</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSB</name>
@@ -7424,267 +7187,241 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">この仮想マシンでUSB 2.0を有効にするには<b>%1</b>のインストールが必要です。VirtualBoxのダウンロードサイトから機能拡張パッケージをダウンロードし、インストールしてください。機能拡張パッケージをインストールすると、USB 2.0を有効にすることができます。現在の設定をキャンセルしない場合、USB 2.0は無効化されます。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="438"/>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0がこの仮想マシンで有効です。しかし、これには <b>%1</b> のインストールが必要です。VirtualBoxダウンロードサイトから拡張パックをインストールするか、マシンを開始するのにUSB 2.0を無効にしてください。</translation>
+        <translation type="obsolete">USB 2.0がこの仮想マシンで有効です。しかし、これには <b>%1</b> のインストールが必要です。VirtualBoxダウンロードサイトから拡張パックをインストールするか、マシンを開始するのにUSB 2.0を無効にしてください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="465"/>
         <source>&Add Empty Filter</source>
         <translation>空のフィルターを追加(&A)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="466"/>
         <source>A&dd Filter From Device</source>
         <translation>デバイスからフィルターを追加する(&D)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="467"/>
         <source>&Edit Filter</source>
         <translation>フィルターを編集する(&E)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="468"/>
         <source>&Remove Filter</source>
         <translation>フィルターを除去する(&R)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="469"/>
         <source>&Move Filter Up</source>
         <translation>フィルターを上に移動する(&M)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="470"/>
         <source>M&ove Filter Down</source>
         <translation>フィルターを下に移動(&O)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="485"/>
         <source>Adds a new USB filter with all fields initially set to empty strings. Note that such a filter will match any attached USB device.</source>
         <translation>すべてのフィールドが空の新規USB フィルターを追加します。注:このフィルターはすべての接続されたUSB デバイスに適合します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="489"/>
         <source>Adds a new USB filter with all fields set to the values of the selected USB device attached to the host PC.</source>
         <translation>ホストマシンに接続された、選択したUSB デバイスの値をすべてのフィールドに設定した新規USB フィルターを追加します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="492"/>
         <source>Edits the selected USB filter.</source>
         <translation>選択したUSB フィルターを編集します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="493"/>
         <source>Removes the selected USB filter.</source>
         <translation>選択したUSB フィルターを除去します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="494"/>
         <source>Moves the selected USB filter up.</source>
         <translation>選択したUSB フィルターを上に移動します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="495"/>
         <source>Moves the selected USB filter down.</source>
         <translation>選択したUSB フィルターを下に移動します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="497"/>
         <source>New Filter %1</source>
         <comment>usb</comment>
         <translation>新規フィルター %1</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="760"/>
         <source><nobr>Vendor ID: %1</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>ベンダーID: %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="764"/>
         <source><nobr>Product ID: %2</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>プロダクトID: %2</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="768"/>
         <source><nobr>Revision: %3</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>リビジョン: %3</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="772"/>
         <source><nobr>Product: %4</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>製品: %4</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="776"/>
         <source><nobr>Manufacturer: %5</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>メーカー: %5</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="780"/>
         <source><nobr>Serial No.: %1</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>シリアルNo.: %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="784"/>
         <source><nobr>Port: %1</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>ポート: %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="789"/>
         <source><nobr>State: %1</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>状態: %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.ui" line="29"/>
         <source>When checked, enables the virtual USB controller of this machine.</source>
         <translation>この仮想マシンの仮想USB コントローラーを有効にします。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.ui" line="32"/>
         <source>Enable &USB Controller</source>
         <translation>USB コントローラーを有効化(&U)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.ui" line="73"/>
         <source>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</source>
         <translation>仮想マシンの仮想USB EHCI コントローラーを有効にします。USB EHCI コントローラーはUSB 2.0 サポートを提供します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.ui" line="76"/>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>USB 2.0 (EHCI)コントローラーを有効化(&H)</translation>
+        <translation type="obsolete">USB 2.0 (EHCI)コントローラーを有効化(&H)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.ui" line="83"/>
         <source>USB Device &Filters</source>
         <translation>USB デバイスフィルター(&F)</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.ui" line="120"/>
         <source>Lists all USB filters of this machine. The checkbox to the left defines whether the particular filter is enabled or not. Use the context menu or buttons to the right to add or remove USB filters.</source>
         <translation>仮想マシンのすべてのUSB フィルターをリスト表示します。左のチェックボックスは、特定のフィルターが可能にされるかどうかを定義します。 USB フィルターを追加するか、または除去する場合はコンテキストメニューかボタンを使用してください。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.ui" line="127"/>
         <source>[filter]</source>
         <translation>[フィルター]</translation>
     </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation>仮想マシンの仮想USB OHCI コントローラーを有効にします。USB OHCI コントローラーはUSB 1.0 サポートを提供します。</translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>USB &1.1 (OHCI) コントローラー</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>USB &2.0 (EHCI) コントローラー</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>仮想マシンの仮想USB xHCI コントローラーを有効にします。USB xHCI コントローラーはUSB 3.0 サポートを提供します。</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>USB &3.0 (xHCI) コントローラー</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>USB 2.0/3.0がこの仮想マシンで有効です。しかし、これには <b>%1</b> のインストールが必要です。VirtualBoxダウンロードサイトから拡張パックをインストールするか、マシンを開始するためにUSB 2.0/3.0を無効にしてください。</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSBFilterDetails</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp" line="52"/>
         <source>Any</source>
         <comment>remote</comment>
         <translation>任意</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp" line="53"/>
         <source>Yes</source>
         <comment>remote</comment>
         <translation>はい</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp" line="54"/>
         <source>No</source>
         <comment>remote</comment>
         <translation>いいえ</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="38"/>
         <source>&Name:</source>
         <translation>名前(&N):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="51"/>
         <source>Holds the filter name.</source>
         <translation>フィルター名を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="58"/>
         <source>&Vendor ID:</source>
         <translation>ベンダーID(&V):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="71"/>
         <source>Defines the vendor ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
         <translation>ベンダーIDフィルターを定義します。<i>完全一致</i>する文字列の形式は<tt>XXXX</tt>で、<tt>X</tt>は16進数です。空の文字列はすべての値と一致します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="78"/>
         <source>&Product ID:</source>
         <translation>プロダクトID(&P):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="91"/>
         <source>Defines the product ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
         <translation>プロダクトIDフィルターを定義します。<i>完全一致</i>する文字列の形式は<tt>XXXX</tt>で、<tt>X</tt>は16進数です。空の文字列はすべての値と一致します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="98"/>
         <source>&Revision:</source>
         <translation>リビジョン(&R):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="111"/>
         <source>Defines the revision number filter. The <i>exact match</i> string format is <tt>IIFF</tt> where <tt>I</tt> is a decimal digit of the integer part and <tt>F</tt> is a decimal digit of the fractional part. An empty string will match any value.</source>
         <translation>リビジョン番号フィルターを定義します。<i>完全一致</i>する文字列の形式は<tt>IIFF</tt>で、<tt>I</tt>は10進数で整数部、<tt>F</tt>は10進数で小数部です。空の文字列はすべての値と一致します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="118"/>
         <source>&Manufacturer:</source>
         <translation>メーカー(&M):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="131"/>
         <source>Defines the manufacturer filter as an <i>exact match</i> string. An empty string will match any value.</source>
         <translation><i>完全一致</i>するメーカー フィルターを定義します。空の文字列はすべての値と一致します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="138"/>
         <source>Pro&duct:</source>
         <translation>製品名(&D):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="151"/>
         <source>Defines the product name filter as an <i>exact match</i> string. An empty string will match any value.</source>
         <translation><i>完全一致</i>する製品名フィルターを定義します。空の文字列はすべての値と一致します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="158"/>
         <source>&Serial No.:</source>
         <translation>シリアル No.(&S):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="171"/>
         <source>Defines the serial number filter as an <i>exact match</i> string. An empty string will match any value.</source>
         <translation><i>完全一致</i>するシリアル番号フィルターを定義します。空の文字列はすべての値と一致します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="178"/>
         <source>Por&t:</source>
         <translation>ポート(&T):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="191"/>
         <source>Defines the host USB port filter as an <i>exact match</i> string. An empty string will match any value.</source>
         <translation><i>完全一致</i>するホストUSBポート フィルターを定義します。空の文字列はすべての値と一致します。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="198"/>
         <source>R&emote:</source>
         <translation>リモート(&E):</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="217"/>
         <source>Defines whether this filter applies to USB devices attached locally to the host computer (<i>No</i>), to a VRDP client's computer (<i>Yes</i>), or both (<i>Any</i>).</source>
         <translation>ローカルに接続されたUSB デバイスにこのフィルターを適用するかどうかを定義します。ホストマシン(<i>いいえ</i>)、VRDP クライアントのコンピューター(<i>はい</i>)、両方((<i>任意</i>))。</translation>
     </message>
@@ -7697,7 +7434,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">一致するデバイスが接続されたとき、ホストマシンが実行する動作を定義します:ホストOSに譲る(<i>無視</i>) 、仮想マシンで使用するために捕捉(<i>保持</i>)。</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSBFilterDetails.ui" line="32"/>
         <source>USB Filter Details</source>
         <translation>USB フィルター詳細</translation>
     </message>
@@ -7705,7 +7441,6 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIMachineWindow</name>
     <message>
-        <location filename="../src/runtime/UIMachineWindow.cpp" line="226"/>
         <source> EXPERIMENTAL build %1r%2 - %3</source>
         <translation>試験的ビルド %1r%2 - %3</translation>
     </message>
@@ -7713,7 +7448,6 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIMachineWindowNormal</name>
     <message>
-        <location filename="../src/runtime/normal/UIMachineWindowNormal.cpp" line="558"/>
         <source>Shows the currently assigned Host key.<br>This key, when pressed alone, toggles the keyboard and mouse capture state. It can also be used in combination with other keys to quickly perform actions from the main menu.</source>
         <translation>現在割り当てられているホストキーを表示します。<br>ホストキーを単独で押すと、キーボードとマウスの制御が切り替わります。また、他のキーと合わせてメインメニューからキーボード ショートカットの操作に使用することもできます。</translation>
     </message>
@@ -7721,17 +7455,14 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIMediumManager</name>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1216"/>
         <source>&Hard drives</source>
         <translation>ハードドライブ(&H)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1225"/>
         <source>&Optical disks</source>
         <translation>光学ディスク(&O)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1230"/>
         <source>&Floppy disks</source>
         <translation>フロッピーディスク(&F)</translation>
     </message>
@@ -7740,169 +7471,157 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">選択(&S)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1247"/>
         <source>C&lose</source>
-        <translation>閉じる(&L)</translation>
+        <translation type="obsolete">閉じる(&L)</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation>メディアを除去中...</translation>
     </message>
 </context>
 <context>
     <name>UIMediumTypeChangeDialog</name>
     <message>
-        <location filename="../src/UIMediumTypeChangeDialog.cpp" line="113"/>
         <source>Modify medium attributes</source>
         <translation>メディアの属性を変更</translation>
     </message>
     <message>
-        <location filename="../src/UIMediumTypeChangeDialog.cpp" line="116"/>
         <source><p>You are about to change the settings of the disk image file <b>%1</b>.</p><p>Please choose one of the following modes and press <b>%2</b> to proceed or <b>%3</b> otherwise.</p></source>
         <translation><p><b>%1</b> にある仮想ディスクの属性を変更しようとしています。</p><p>メディアタイプを選択し <b>%2</b> を押して開始するか、それ以外の <b>%3</b> を行なってください。</p></translation>
     </message>
     <message>
-        <location filename="../src/UIMediumTypeChangeDialog.cpp" line="124"/>
         <source>Choose mode:</source>
         <translation>メディアタイプを選択:</translation>
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>仮想スクリーンのリサイズ</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>仮想スクリーンのマッピング</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>閉じる</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>切り替え</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>メニューバーを有効にする</translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="260"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2728"/>
         <source>VirtualBox - Information</source>
         <comment>msg box title</comment>
         <translation>VirtualBox - 情報</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="264"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2732"/>
         <source>VirtualBox - Question</source>
         <comment>msg box title</comment>
         <translation>VirtualBox - 質問</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="268"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2736"/>
         <source>VirtualBox - Warning</source>
         <comment>msg box title</comment>
         <translation>VirtualBox - 警告</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="272"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2740"/>
         <source>VirtualBox - Error</source>
         <comment>msg box title</comment>
         <translation>VirtualBox - エラー</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="276"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2744"/>
         <source>VirtualBox - Critical Error</source>
         <comment>msg box title</comment>
         <translation>VirtualBox - 重大なエラー</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="892"/>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
         <translation><p>NATネットワーク<nobr><b>%1</b></nobr> を除去しますか?</p> <p>このネットワークをひとつ以上の仮想マシンネットワークアダプターで使用中の場合は、別のネットワーク名や別のアダプタータイプを選択しない限りふたたび使えるようにはなりません。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1942"/>
         <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>ウェブカメラ<b>"%1"</b>の仮想マシン<b>"%2"</b>への割り当てに失敗しました。</translation>
+        <translation>Webカメラ <b>"%1"</b> の仮想マシン <b>"%2"</b> への割り当てに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1950"/>
         <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>ウェブカメラ<b>"%1"</b>の仮想マシン<b>"%2"</b>への割り当て解除に失敗しました。</translation>
+        <translation>Webカメラ <b>"%1"</b> の仮想マシン <b>"%2"</b> からの割り当て解除に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1959"/>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン <b>%1</b> のリモートデスクトップサーバーを有効化できませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1960"/>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン <b>%1</b> のリモートデスクトップサーバーを無効化できませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1970"/>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン <b>%1</b> のビデオキャプチャーを有効化できませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1971"/>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン <b>%1</b> のビデオキャプチャーを無効化できませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1978"/>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>VirtualBox Guest Additionsがインストールされていないため、共有フォルダーは利用できません。共有フォルダーを使用するには<b>[デバイス]</b>メニューから<b>[Guest Additions のCDイメージを挿入]</b>を選びGuest Additionsをインストールまたは再インストールしてください。インストール後、仮想マシンを再起動すると共有フォルダーが利用できます。</p></translation>
+        <translation><p>VirtualBox Guest Additionsがインストールされていないため、共有フォルダーは利用できません。共有フォルダーを使用するには<b>[デバイス]</b>メニューから<b>[Guest Additions CD イメージのインストール]</b>を選びGuest Additionsをインストールまたは再インストールしてください。インストール後、仮想マシンを再起動すると共有フォルダーが利用できます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2029"/>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
         <translation><p><b>VirtualBox Guest Additions</b> ディスクイメージファイルが見つかりません。</p><p>インターネットからディスクイメージをダウンロードしますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2032"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2042"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2082"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2092"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2121"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2131"/>
         <source>Download</source>
         <translation>ダウンロード</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2038"/>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
         <translation><p>本当に<b>VirtualBox Guest Additions</b> ディスクイメージを<nobr><a href="%1">%1</a></nobr> からダウンロードしますか? (サイズ %2バイト)</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2048"/>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
         <translation><p><b>VirtualBox Guest Additions</b> ディスクイメージを<nobr><a href="%1">%1</a></nobr>からダウンロードしましたが、<nobr><b>%2</b></nobr>に保存できません。</p><p>他の保存場所を選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2058"/>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p><b>VirtualBox Guest Additions</b> ディスクイメージを<nobr><a href="%1">%1</a></nobr>からダウンロードし、<nobr><b>%2</b>に保存しました。</nobr></p><p>ディスクイメージファイルを登録し、仮想CD/DVDドライブに挿入しますか?</p></translation>
+        <translation type="obsolete"><p><b>VirtualBox Guest Additions</b> ディスクイメージを<nobr><a href="%1">%1</a></nobr>からダウンロードし、<nobr><b>%2</b>に保存しました。</nobr></p><p>ディスクイメージファイルを登録し、仮想CD/DVDドライブに挿入しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2064"/>
         <source>Insert</source>
         <comment>additions</comment>
         <translation>挿入</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1989"/>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>仮想マシン<b>"%1"</b>にCD/DVDドライブがないので、<b>VirtualBox Guest Additions</b>のディスクイメージを仮想マシンに挿入できません。 仮想マシン設定ウィンドウのストレージページでドライブを追加してください。</p></translation>
+        <translation type="obsolete"><p>仮想マシン<b>"%1"</b>にCD/DVDドライブがないので、<b>VirtualBox Guest Additions</b>のディスクイメージを仮想マシンに挿入できません。 仮想マシン設定ウィンドウのストレージページでドライブを追加してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2078"/>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation><p><b>VirtualBox ユーザーマニュアル</b> <nobr><b>%1</b></nobr>が見つかりません。</p><p>ダウンロードしますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2088"/>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
         <translation><p><b>VirtualBox ユーザーマニュアル</b>を<nobr><a href="%1">%1</a></nobr> からダウンロードしますか? (サイズ %2バイト)</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2098"/>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
         <translation><p>VirtualBox ユーザーマニュアルを<nobr><a href="%1">%1</a></nobr>からダウンロードしましたが、<nobr><b>%2</b></nobr>に保存できません。</p><p>他の保存場所を選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2108"/>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
         <translation><p>VirtualBox ユーザーマニュアルを<nobr><a href="%1">%1</a></nobr>からダウンロードし、<nobr><b>%2</b></nobr>に保存しました。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2763"/>
         <source>Do not show this message again</source>
         <comment>msg box flag</comment>
         <translation>次回からこのメッセージを表示しない</translation>
@@ -7912,37 +7631,30 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">クラッシュを防ぐため、Windows/x64では仮想マシンに含まれるすべてのファイルの削除は現在できません。これは次回のリリースで修正されます。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="505"/>
         <source>Failed to open <tt>%1</tt>. Make sure your desktop environment can properly handle URLs of this type.</source>
         <translation><tt>%1</tt>を開けませんでした。デスクトップ環境が適切にURLを扱えることを確認してください。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="403"/>
         <source><p>Failed to initialize COM or to find the VirtualBox COM server. Most likely, the VirtualBox server is not running or failed to start.</p><p>The application will now terminate.</p></source>
         <translation><p>COM の初期化に失敗したか、またはVirtualBox COMサーバーが見つかりませんでした。VirtualBoxサーバーが起動していないか、または起動に失敗しています。</p><p>アプリケーションを終了します。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="392"/>
         <source><p>Failed to initialize COM because the VirtualBox global configuration directory <b><nobr>%1</nobr></b> is not accessible. Please check the permissions of this directory and of its parent directory.</p><p>The application will now terminate.</p></source>
         <translation><p>VirtualBox のグローバル設定ディレクトリー <b><nobr>%1</nobr></b> にアクセスできないため、 COM の初期化に失敗しました。このディレクトリーならびに親ディレクトリーのパーミッションを確認してください。</p><p>このアプリケーションは終了します。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="412"/>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>VirtualBox COMオブジェクトの作成に失敗しました。</p><p>アプリケーションを終了します。</p></translation>
+        <translation type="obsolete"><p>VirtualBox COMオブジェクトの作成に失敗しました。</p><p>アプリケーションを終了します。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="982"/>
         <source>Failed to set global VirtualBox properties.</source>
         <translation>グローバルなVirtualBoxのプロパティの設定に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="996"/>
         <source>Failed to access the USB subsystem.</source>
         <translation>USBサブシステムのアクセスに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1446"/>
         <source>Failed to create a new virtual machine.</source>
         <translation>新規仮想マシンの作成に失敗しました。</translation>
     </message>
@@ -7951,17 +7663,14 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">新規仮想マシン<b>"%1"</b>の作成に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="513"/>
         <source>Failed to open virtual machine located in %1.</source>
         <translation>仮想マシン<b>"%1"</b>を開けませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1453"/>
         <source>Failed to register the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン <b>%1</b> の登録に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="521"/>
         <source>Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.</source>
         <translation>仮想マシン<b>"%1"</b>(<i>"%2"</i>)の追加に失敗しました。すでに存在します。</translation>
     </message>
@@ -7970,73 +7679,54 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシン<b>"%1"</b>の設定の適用に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1018"/>
         <source><p>The machine settings were changed while you were editing them. You currently have unsaved setting changes.</p><p>Would you like to reload the changed settings or to keep your own changes?</p></source>
         <translation><p>編集中にマシンの設定が変更されました。現在保存されていない変更が含まれています。</p><p>変更を再読み込みするか、現在の設定を保持しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1022"/>
         <source>Reload settings</source>
         <translation>設定を再読み込み</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1022"/>
         <source>Keep changes</source>
         <translation>設定を保持</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1008"/>
         <source>The virtual machine that you are changing has been started. Only certain settings can be changed while a machine is running. All other changes will be lost if you close this window now.</source>
         <translation>設定を変更した仮想マシンを開始しました。マシンの起動中に変更できる設定は特定のもののみとなります。このウィンドウをすぐに閉じた場合は、他のすべての変更点は失われます。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1788"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1796"/>
         <source>Failed to start the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>の起動に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="726"/>
         <source>Failed to pause the execution of the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>の一時停止に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="734"/>
         <source>Failed to resume the execution of the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>の再開に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="750"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="758"/>
         <source>Failed to save the state of the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>の状態の保存に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1461"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1469"/>
         <source>Failed to clone the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン <b>%1</b>.のクローンに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="842"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="850"/>
         <source>Failed to create a snapshot of the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>のスナップショット作成に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="774"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="782"/>
         <source>Failed to stop the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>の停止に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="652"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="660"/>
         <source>Failed to remove the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>の除去に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="742"/>
         <source>Failed to discard the saved state of the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>の保存された状態の破棄に失敗しました。</translation>
     </message>
@@ -8053,7 +7743,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシン<b>"%1"</b>の最新のスナップショットと状態の破棄に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="458"/>
         <source>There is no virtual machine named <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>がありません。</translation>
     </message>
@@ -8112,13 +7801,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">%1 <nobr><b>%2</b></nobr>の登録解除に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="474"/>
         <source>Failed to create a new session.</source>
         <translation>新規セッションの作成に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="481"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="489"/>
         <source>Failed to open a session for the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>のセッションを開けませんでした。</translation>
     </message>
@@ -8131,26 +7817,18 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ホストネットワークインターフェース<b>"%1"</b>の作成に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="966"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="974"/>
         <source>Failed to remove the host network interface <b>%1</b>.</source>
         <translation>ホストネットワークインターフェース<b>"%1"</b>を除去できませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1910"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1918"/>
         <source>Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.</source>
         <translation>USB デバイス<b>"%1"</b>の仮想マシン<b>"%2"</b>への割り当てに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1926"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1934"/>
         <source>Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.</source>
         <translation>USB デバイス<b>"%1"</b>の仮想マシン<b>"%2"</b>からの割り当て解除に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1116"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1125"/>
         <source>Failed to create the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.</source>
         <translation>仮想マシン<b>"%3"</b>の共有フォルダー<b>"%1"</b>(参照先 <nobr><b>%2</b></nobr>)の作成に失敗しました。</translation>
     </message>
@@ -8159,48 +7837,38 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシン<b>"%3"</b>の共有フォルダー<b>"%1"</b>(参照先 <nobr><b>%2</b></nobr>)の除去に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="195"/>
         <source>Close</source>
         <translation>閉じる</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="240"/>
         <source>Ok</source>
         <translation>OK</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="458"/>
         <source><p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> in the current video mode. You need to capture the mouse (by clicking over the VM display or pressing the host key) in order to use the mouse inside the guest OS.</p></source>
         <translation><p>現在のビデオモードではゲストOSで<b>マウス統合</b>機能がサポートされません。ゲストOSでマウスを使用するためにはマウスをキャプチャー(仮想マシンの画面をクリックするか、またはホストキーを押す)する必要があります。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="468"/>
         <source><p>The Virtual Machine is currently in the <b>Paused</b> state and not able to see any keyboard or mouse input. If you want to continue to work inside the VM, you need to resume it by selecting the corresponding action from the menu bar.</p></source>
         <translation><p>仮想マシンは現在<b>"一時停止"</b>状態のため、キーボードとマウス操作を受け付けません。仮想マシンでの作業を続けたい場合は、メニューバーから対応する動作を選択して、仮想マシンを再開する必要があります。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="482"/>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>現在仮想スクリーンは<b>%1&nbsp;ビット</b> カラーモードです。パフォーマンス向上のために <b>%2&nbsp;ビット</b> に変更してください。通常ゲストOSのコントロールパネルあるいはシステム設定にある<b>ディスプレイ</b> で変更できます。</p></translation>
+        <translation><p>仮想スクリーンは現在<b>%1&nbsp;ビット</b> カラーモードです。パフォーマンス向上のため、<b>%2&nbsp;ビット</b> に変更してください。 この操作は通常ゲストOSのコントロールパネルまたはシステム設定の <b>ディスプレイ</b> セクションで行えます。</p></translation>
     </message>
     <message>
         <source><p>Cannot run VirtualBox in <i>VM Selector</i> mode due to local restrictions.</p><p>The application will now terminate.</p></source>
         <translation type="obsolete"><p>ローカルの制限のため、 <i>VM Selector</i>モードでVirtualBoxを実行できません。</p><p>アプリケーションを終了します。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2070"/>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation>Guest Additionsの更新に失敗しました。Guest Additionsのインストールイメージは手動インストールのためマウントされます。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2260"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2268"/>
         <source>Failed to install the Extension Pack <b>%1</b>.</source>
         <translation>機能拡張パッケージ<b>"%1"</b>のインストールに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2276"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2284"/>
         <source>Failed to uninstall the Extension Pack <b>%1</b>.</source>
         <translation>機能拡張パッケージ<b>"%1"</b>のアンインストールに失敗しました。</translation>
     </message>
@@ -8209,195 +7877,150 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">機能拡張パッケージ<b>"%1"</b>を除去します。本当に除去しますか?</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2240"/>
         <source>&Remove</source>
         <translation>除去(&R)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1102"/>
         <source>The current port forwarding rules are not valid. None of the host or guest port values may be set to zero.</source>
         <translation>現在のポートフォワーディングルールは無効です。 ホストまたはゲストポートの値にゼロが設定されています。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="371"/>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
         <translation><p>ローカルの制限のため、VirtualBox マネージャーを実行できません。</p><p>アプリケーションを終了します。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="420"/>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
         <translation><p>言語ファイル<b>"%1"</b>が<b><nobr>%2</nobr></b>ディレクトリで見つかりません。</p><p>言語は一時的にシステムのデフォルト言語に設定されます。VirtualBox マネージャーウィンドウの<b>ファイル</b>メニューから<b>環境設定</b>ウィンドウを開き、<b>言語</b>ページにある言語から選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="430"/>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
         <translation><p>言語ファイル<b><nobr>"%1"</nobr></b>が読み込めません。</p> <p>言語は一時的にEnglish(内蔵)に設定されます。VirtualBox マネージャーウィンドウの<b>ファイル</b>メニューから<b>環境設定</b>ウィンドウを開き、<b>言語</b>ページで表示されている言語から選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="466"/>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
         <translation>IDが <b>"%1"</b> の仮想マシンはありません。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="676"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1734"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1873"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1894"/>
         <source>Ignore</source>
         <translation>無視</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="922"/>
         <source>Failed to create NAT network.</source>
         <translation>NATネットワークの作成に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="929"/>
         <source>Failed to remove NAT network <b>%1</b>.</source>
         <translation>NATネットワーク <b>%1</b> の除去に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="937"/>
         <source>Failed to create DHCP server.</source>
         <translation>DHCPサーバーの作成しに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="944"/>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
         <translation>ネットワークインターフェース <b>%1</b> のDHCPサーバーの除去に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="952"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="959"/>
         <source>Failed to create the host network interface.</source>
         <translation>ホストネットワークインターフェースの作成しに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1032"/>
         <source>Create &new disk</source>
         <translation>新規ディスクの作成(&N)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1032"/>
         <source>&Choose existing disk</source>
         <translation>既存のディスクを選択(&C)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1043"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1054"/>
         <source>Leave &empty</source>
         <translation>空のままにする(&E)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1043"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1054"/>
         <source>&Choose disk</source>
         <translation>ディスクを選択(&C)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1109"/>
         <source><p>There are unsaved changes in the port forwarding configuration.</p><p>If you proceed your changes will be discarded.</p></source>
         <translation><p>ポートフォワーディング設定の変更が保存されていません。</p><p>続行すると変更は破棄されます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1177"/>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1183"/>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
         <translation><p>仮想光学ディスク <nobr><b>%1</b></nobr>を解放しますか?</p><p>次の仮想マシンから取り外します: <b>%2</b></p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1189"/>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
         <translation><p>仮想フロッピーディスク <nobr><b>%1</b></nobr>を解放しますか?</p><p>次の仮想マシンから取り外します: <b>%2</b></p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1211"/>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
         <translation><p>ディスクイメージファイルのリストから仮想ハードディスク <nobr><b>%1</b></nobr>を除去しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1223"/>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
         <translation><p>注:このハードディスクイメージにアクセスできないため、除去できません。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1230"/>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
         <translation><p>ディスクイメージファイルのリストから仮想光学ドライブ <nobr><b>%1</b></nobr>を除去しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1238"/>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
         <translation><p>ディスクイメージファイルのリストから仮想フロッピードライブ <nobr><b>%1</b></nobr>を除去しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1329"/>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
         <translation><p>仮想光学ディスク <nobr><b>%1</b></nobr> をマシン <b>%2</b> に挿入できません。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1331"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1347"/>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
         <translation><p>このディスクを強制挿入してみますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1335"/>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
         <translation><p>仮想光学ディスク <nobr><b>%1</b></nobr> をマシン <b>%2</b> から取り出せません。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1337"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1353"/>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
         <translation><p>このディスクを強制排出してみますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1345"/>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
         <translation><p>仮想フロッピーディスク <nobr><b>%1</b></nobr> をマシン <b>%2</b> に挿入できません。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1351"/>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
         <translation><p>仮想フロッピーディスク <nobr><b>%1</b></nobr> をマシン <b>%2</b> から取り出せません。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1381"/>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
         <translation>ハードディスクファイル <nobr><b>%1</b></nobr> を開けませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1386"/>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
         <translation>光学ディスクファイル <nobr><b>%1</b></nobr> を開けませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1391"/>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
         <translation>フロッピーディスクファイル <nobr><b>%1</b></nobr> を開けませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1410"/>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
         <translation>ハードディスクファイル <nobr><b>%2</b></nobr> を閉じられませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1415"/>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
         <translation>光学ディスクファイル <nobr><b>%2</b></nobr> を閉じられませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1420"/>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
         <translation>フロッピディスクファイル <nobr><b>%2</b></nobr> を閉じられませんでした。</translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1576"/>
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
         <translation>
@@ -8405,47 +8028,39 @@ p, li { white-space: pre-wrap; }
         </translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1644"/>
         <source><nobr>Fatal Error</nobr></source>
         <comment>runtime error info</comment>
         <translation><nobr>致命的なエラー</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1650"/>
         <source><nobr>Non-Fatal Error</nobr></source>
         <comment>runtime error info</comment>
         <translation><nobr>致命的でないエラー</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1656"/>
         <source><nobr>Warning</nobr></source>
         <comment>runtime error info</comment>
         <translation><nobr>警告</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1672"/>
         <source><nobr>Error ID: </nobr></source>
         <comment>runtime error info</comment>
         <translation><nobr>エラーID: </nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1673"/>
         <source>Severity: </source>
         <comment>runtime error info</comment>
         <translation>重要度:</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1681"/>
         <source><p>A fatal error has occurred during virtual machine execution! The virtual machine will be powered off. Please copy the following error message using the clipboard to help diagnose the problem:</p></source>
         <translation><p>仮想マシンの実行中に致命的なエラーが発生しました!仮想マシンの電源をオフにします。調査のために以下のエラーメッセージをクリップボードにコピーして使用してください:</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1689"/>
         <source><p>An error has occurred during virtual machine execution! The error details are shown below. You may try to correct the error and resume the virtual machine execution.</p></source>
         <translation><p>仮想マシンの実行中にエラーが発生しました!エラーの詳細を以下に示します。説明されたエラーを修正し、仮想マシンの再実行することができます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1697"/>
         <source><p>The virtual machine execution may run into an error condition as described below. We suggest that you take an appropriate action to avert the error.</p></source>
         <translation><p>仮想マシンの実行中、以下で説明されるエラーが発生するかもしれません。このメッセージは無視できますが、動作を確実にするために、説明された誤りを対策することが推奨されます。</p></translation>
     </message>
@@ -8454,51 +8069,42 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">申し訳ありません。不明なエラーが発生しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1076"/>
         <source>Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
         <translation>ハードディスク(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当てに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1082"/>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>CD/DVDデバイス(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当てに失敗しました。</translation>
+        <translation type="obsolete">CD/DVDデバイス(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当てに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1088"/>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>フロッピーデバイス(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当てに失敗しました。</translation>
+        <translation type="obsolete">フロッピーデバイス(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当てに失敗しました。</translation>
     </message>
     <message>
         <source><p>USB 2.0 is currently enabled for this virtual machine. However this requires the <b><nobr>%1</nobr></b> to be installed.</p><p>Please install the Extension Pack from the VirtualBox download site. After this you will be able to re-enable USB 2.0. It will be disabled in the meantime unless you cancel the current settings changes.</p></source>
         <translation type="obsolete"><p>この仮想マシンでUSB 2.0を有効化するには<b><nobr>%1</nobr></b>のインストールが必要です。VirtualBoxのダウンロードサイトから機能拡張パッケージをダウンロードし、インストールしてください。機能拡張パッケージをインストールすると、USB 2.0を有効化することができます。現在の設定をキャンセルしない場合、USB 2.0は無効化されます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2425"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2646"/>
         <source>Result&nbsp;Code: </source>
         <comment>error info</comment>
         <translation>終了コード&nbsp;: </translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2652"/>
         <source>Component: </source>
         <comment>error info</comment>
         <translation>コンポーネント: </translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2660"/>
         <source>Interface: </source>
         <comment>error info</comment>
         <translation>インターフェース: </translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2669"/>
         <source>Callee: </source>
         <comment>error info</comment>
         <translation>呼び出し先: </translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2677"/>
         <source>Callee&nbsp;RC: </source>
         <comment>error info</comment>
         <translation>呼び出し先&nbsp;RC: </translation>
@@ -8528,8 +8134,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシン<b>%1<b>のスナップショット保存フォルダーのパスを<nobr><b>%2</b></nobr>に変更できませんでした。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1134"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1145"/>
         <source><p>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</p><p>Please close all programs in the guest OS that may be using this shared folder and try again.</p></source>
         <translation><p>仮想マシン<b>%3</b>の共有フォルダー<b>%1</b>(参照先:<nobr><b>%2</b></nobr>)の除去に失敗しました。</p><p>この共有フォルダーを使用しているゲストOSのすべてのプログラムを終了し、再実行してください。</p></translation>
     </message>
@@ -8563,8 +8167,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>仮想マシンウィンドウは<b>%1&nbsp;ビット</b>カラーモードに最適化されますが、現在仮想ディスプレイは<b>%2&nbsp;ビット</b>に設定されています。</p><p>最良の仮想ビデオサブシステム性能を得るため、利用可能であるならばゲストOSの画面設定ダイアログを開き、<b>%3&nbsp;ビット</b>カラーモードを選択してください。</p><p><b>注</b>:OS/2など、いくつかのオペレーティングシステムは32&nbsp;ビットモードの動作を24&nbsp;ビット(約1600万色)として報告します。 このメッセージが消えるか、またはゲストOSで必要な色深度(%4&nbsp;ビット) が利用できないことが分かっているならば、単にメッセージを無効にできるか確認するために異 [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>仮想マシン実行中に重大なエラーが発生したため、仮想マシンは停止しました。</p><p>問題の解決のため、<a href=https://www.virtualbox.org>https://www.virtualbox.org</a>のCommunityセクションを参照するか、サポート契約を締結してください。あなたがエラー発生時に行った操作と共に、<nobr><b>%1</b></nobr>ディレクトリに格納されているログファイル(<tt>VBox.log</tt>)とイメージファイル(<tt>VBox.png</tt>)を提供してください。注:VirualBoxメインウィンドウの<b>[仮想マシン]</b>メニューから[ログを参照]を選択して、上記ファイルにアクセスすることができます。</p>< [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>仮想マシン実行中に重大なエラーが発生したため、仮想マシンは停止しました。</p><p>問題の解決のため、<a href=http://www.virtualbox.org>http://www.virtualbox.org</a>のCommunityセクションを参照するか、サポート契約を締結してください。あなたがエラー発生時に行った操作と共に、<nobr><b>%1</b></nobr>ディレクトリに格納されているログファイル(<tt>VBox.log</tt>)とイメージファイル(<tt>VBox.png</tt>)を提供してください。注:VirualBoxメインウィンドウの<b>[仮想マシン]</b>メニューから[ログを参照]を選択して、上記ファイルにアクセスすることができます。</p><p& [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
@@ -8575,12 +8179,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><nobr><b>"%1"</b></nobr>にライセンスファイルが見つかりません。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2315"/>
         <source>Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.</source>
         <translation>ライセンスファイル<nobr><b>"%1"</b></nobr>が開けません。ファイルのパーミッションを確認してください。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="766"/>
         <source>Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>"%1"</b>への電源ボタン オフのACPIイベント送信に失敗しました。</translation>
     </message>
@@ -8601,19 +8203,16 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>グローバルなVirtualBox設定の<b><nobr>"%1"</nobr></b>への保存に失敗しました。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="440"/>
         <source><p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
         <translation><p>グローバルなGUI構成の<b><nobr>"%1"</nobr></b>からの読み込みに失敗しました。</p>
 <p>アプリケーションを終了します。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="449"/>
         <source><p>Failed to save the global GUI configuration to <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
         <translation><p>グローバルなGUI構成の<b><nobr>"%1"</nobr></b>への保存に失敗しました。</p>
 <p>アプリケーションを終了します。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1156"/>
         <source>Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.</source>
         <translation>仮想マシン<b>"%1"</b>の設定の<b><nobr>"%2"</nobr></b>への保存に失敗しました。</translation>
     </message>
@@ -8632,7 +8231,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">登録解除</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="688"/>
         <source>Discard</source>
         <comment>saved state</comment>
         <translation>破棄</translation>
@@ -8687,14 +8285,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">マウント</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1813"/>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="433"/>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
         <comment>additional message box paragraph</comment>
         <translation><p>現在ホストキーは<b>%1</b>に割り当てられています。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1819"/>
         <source>Capture</source>
         <comment>do input capture</comment>
         <translation>キャプチャー</translation>
@@ -8705,7 +8300,6 @@ p, li { white-space: pre-wrap; }
 <p><b>[確認]</b>ボタンをクリックして仮想ディスクマネージャーを起動し、どのメディアにアクセスできないのか確認してください。または<b>[無視]</b>ボタンをクリックして、このメッセージを無視してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="676"/>
         <source>Check</source>
         <comment>inaccessible media message box</comment>
         <translation>確認</translation>
@@ -8749,19 +8343,16 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>仮想マシンを本当にリセットしますか?</p><p>仮想マシンをリセットすると、その中で稼動中のすべてのアプリケーションの保存されていないデータは失われます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="699"/>
         <source>Reset</source>
         <comment>machine</comment>
         <translation>リセット</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1439"/>
         <source>Continue</source>
         <comment>no hard disk attached</comment>
         <translation>続ける</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1440"/>
         <source>Go Back</source>
         <comment>no hard disk attached</comment>
         <translation>戻る</translation>
@@ -8786,12 +8377,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">選択</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1879"/>
         <source><p>Could not enter seamless mode due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p></source>
         <translation><p>ゲストOSのビデオメモリー不足のため、シームレスモードに切り替えできません。</p><p>仮想マシンの設定でビデオメモリーを <b>%1</b>以上に設定してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1868"/>
         <source><p>Could not switch the guest display to fullscreen mode due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p><p>Press <b>Ignore</b> to switch to fullscreen mode anyway or press <b>Cancel</b> to cancel the operation.</p></source>
         <translation><p>ゲストOSのビデオメモリー不足のため、ゲスト画面をフルスクリーンモードに切り替えできません。</p><p>仮想マシンの設定でビデオメモリーを <b>%1</b>以上に設定してください。</p><p><b>[無視]</b>ボタンをクリックしてフルスクリーンモードに切り換えるか、<b>[キャンセル]</b>ボタンをクリックして操作を取り消してください。</p></translation>
     </message>
@@ -8800,22 +8389,18 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>ネットワークエラーのため、新しいバージョン情報を取得できません:</p><p><b>%1</b></p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2015"/>
         <source>You are already running the most recent version of VirtualBox.</source>
         <translation>最新バージョンのVirtualBoxがインストールされています。 後でバージョン確認を行ってください。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1804"/>
         <source><p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer integration is not currently supported by the guest OS) and the keyboard, which will make them unavailable to other applications running on your host machine.</p><p>You can press the <b>host key</b> at  [...]
         <translation><p>仮想マシンの画面を<b>マウスでクリック</b>するか、または<b>ホストキー</b>を押すと、仮想マシンはマウスポインター(マウス統合機能がゲストOSでサポートされていないときのみ)とキーボードを<b>キャプチャー</b>します。仮想マシンにキーボードとマウスがキャプチャーされるとホストマシンで動作する他のアプリケーションは利用できません。</p><p></p><p><b>ホストキー</b>を押すと、キーボードとマウス(キャプチャーされているとき)は<b>キャプチャー解除</b>され、通常の操作に戻ることができます。現在割り当てられているホストキーは仮想マシンのウィンドウ下部のステータスバーに&nbsp;<img src=:/hostkey_16px.png/>&nbsp;アイコンで表示されます。このアイコンはマウス [...]
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="420"/>
         <source><p>You have the <b>Auto capture keyboard</b> option turned on. This will cause the Virtual Machine to automatically <b>capture</b> the keyboard every time the VM window is activated and make it unavailable to other applications running on your host machine: when the keyboard is captured, all keystrokes (including system ones like Alt-Tab) will be directed to the VM.</p><p>You can press the <b>host key</b> at any time t [...]
         <translation><p><b>キーボードの自動キャプチャー</b>機能が有効です。仮想マシンのウィンドウがアクティブのとき、仮想マシンはキーボードを自動的に<b>キャプチャー</b>します。キーボードがキャプチャーされると、すべてのキーストローク(Alt-Tabなどを含む)が仮想マシンに送られるため、ホストマシンで動作する他のアプリケーションは利用できません。</p><p><b>ホストキー</b>を押すと、キーボードとマウス(キャプチャーされているとき)は<b>キャプチャー解除</b>され、通常の操作に戻ることができます。現在割り当てられているホストキーは仮想マシンのウィンドウ下部のステータスバーに&nbsp;<img src=:/hostkey_16px.png/>&nbsp;アイコンで表示されます。このアイコンはマウスアイコンと共に現在のキーボードとマウスのキャプチャー状態を表示します [...]
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="444"/>
         <source><p>The Virtual Machine reports that the guest OS supports <b>mouse pointer integration</b>. This means that you do not need to <i>capture</i> the mouse pointer to be able to use it in your guest OS -- all mouse actions you perform when the mouse pointer is over the Virtual Machine's display are directly sent to the guest OS. If the mouse is currently captured, it will be automatically uncaptured.</p><p>The mouse icon on the s [...]
         <translation><p>ゲストOSで<b>マウス統合</b>機能がサポートされています。ゲストOSでマウスポインターを<i>キャプチャー</i>することなく使用できます。仮想マシンの画面上にマウスポインターがあるとき、すべてのマウスの動作は直接ゲストOSに送られます。現在マウスがキャプチャーされているときは、自動的にキャプチャー解除されます。ステータスバーのマウスアイコンは、マウス統合機能がゲストOSでサポートされ、現在有効であることを示すため&nbsp;<img src=:/mouse_seamless_16px.png/>&nbsp;のように表示されます。 </p><p><b>注</b>: マウス統合機能が有効なとき、いくつかのアプリケーションの動作が不正になるかもしれません。メニューバーから対応する動作を選択して現在のセッションのマウス統合機能を無効化(または有効化)することができます。</p> [...]
     </message>
@@ -8876,9 +8461,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">製品情報ダイアログを表示</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2005"/>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>VirtualBoxの新しいバージョンがリリースされました! バージョン <b>%1</b>は<a href="https://www.virtualbox.org/">virtualbox.org</a>から入手できます。</p><p>このリンクから最新バージョンをダウンロードできます。: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>VirtualBoxの新しいバージョンがリリースされました! バージョン <b>%1</b>は<a href="http://www.virtualbox.org/">virtualbox.org</a>から入手できます。</p><p>このリンクから最新バージョンをダウンロードできます。: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -8893,12 +8477,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>仮想マシン<b>"%1"</b>をリストから除去します。</p><p>仮想マシンを構成するファイルをハードディスクから削除しますか?他の仮想マシンで使用されていない仮想ハードディスクは削除されます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="645"/>
         <source>Delete all files</source>
         <translation>すべてのファイルを削除</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="646"/>
         <source>Remove only</source>
         <translation>除去のみ</translation>
     </message>
@@ -8907,15 +8489,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">アクセスできない仮想マシン<b>"%1"</b>をリストから除去します。続行しますか?</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="565"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="638"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="900"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="916"/>
         <source>Remove</source>
         <translation>除去</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1200"/>
         <source>Release</source>
         <comment>detach medium</comment>
         <translation>解放</translation>
@@ -8937,36 +8514,29 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>注:このメディアのストレージ装置は削除されません。後でリストに再度追加することが可能です。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1251"/>
         <source>Remove</source>
         <comment>medium</comment>
         <translation>除去</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1477"/>
         <source><p>The hard disk storage unit at location <b>%1</b> already exists. You cannot create a new virtual hard disk that uses this location because it can be already used by another virtual hard disk.</p><p>Please specify a different location.</p></source>
         <translation><p>ハードディスクストレージ装置の場所 <b>"%1"</b>はすでに存在します。別の仮想ハードディスクが使用しているため、この場所に新規仮想ハードディスクを作成できません。</p><p>別の場所を指定してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1257"/>
         <source><p>Do you want to delete the storage unit of the hard disk <nobr><b>%1</b></nobr>?</p><p>If you select <b>Delete</b> then the specified storage unit will be permanently deleted. This operation <b>cannot be undone</b>.</p><p>If you select <b>Keep</b> then the hard disk will be only removed from the list of known hard disks, but the storage unit will be left untouched which makes it po [...]
         <translation><p>ハードディスク<nobr><b>"%1"</b></nobr>のストレージ装置を削除しますか?</p><p><b>[削除]</b>を選択すると、指定されたストレージ装置は永久に削除されます。この操作は<b>元に戻せません</b>。</p><p><b>[保持]</b>を選択すると、ハードディスクはリストから取り除かれますが、ストレージ装置は後でリストに再度追加できるように、そのまま置かれます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1268"/>
         <source>Delete</source>
         <comment>hard disk storage</comment>
         <translation>削除</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1269"/>
         <source>Keep</source>
         <comment>hard disk storage</comment>
         <translation>保持</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1275"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1283"/>
         <source>Failed to delete the storage unit of the hard disk <b>%1</b>.</source>
         <translation>ハードディスクストレージ装置<b>"%1"</b>の削除に失敗しました。</translation>
     </message>
@@ -8975,9 +8545,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>新規の割り当てに利用できる未使用のハードディスクがありません。</p><p><b>[作成]</b>ボタンをクリックし、<i>新規仮想ディスク作成ウィザード</i>を起動して新規ハードディスクイメージを作成するか、<b>[選択]</b>ボタンをクリックして、<i>仮想メディアマネージャー</i>を開き、動作を選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1487"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1495"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1503"/>
         <source>Failed to create the hard disk storage <nobr><b>%1</b>.</nobr></source>
         <translation>ハードディスクストレージ<nobr><b>"%1"</b>の作成に失敗しました。</nobr></translation>
     </message>
@@ -9006,7 +8573,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">"%1 <nobr><b>%2</b></nobr>"のクローズに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="497"/>
         <source>Failed to access the disk image file <nobr><b>%1</b></nobr>.</source>
         <translation>メディア<nobr><b>"%1"</b></nobr>のアクセス可否状態の取得に失敗しました。</translation>
     </message>
@@ -9019,9 +8585,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>新しいバージョンの情報を取得できません。エラー:</p><p><b>%1</b></p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="668"/>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>一つ以上の仮想ハードディスク、CD/DVDまたはフロッピーメディアのに現在アクセスできません。アクセス可能になるまでこれらのメディアを使用する仮想マシンを操作できません。</p><p><b>[確認]</b>ボタンをクリックして仮想メディアマネージャーを起動し、どのメディアにアクセスできないのか確認してください。または<b>[無視]</b>ボタンをクリックして、このメッセージを無視してください。</p></translation>
+        <translation type="obsolete"><p>一つ以上の仮想ハードディスク、CD/DVDまたはフロッピーメディアのに現在アクセスできません。アクセス可能になるまでこれらのメディアを使用する仮想マシンを操作できません。</p><p><b>[確認]</b>ボタンをクリックして仮想メディアマネージャーを起動し、どのメディアにアクセスできないのか確認してください。または<b>[無視]</b>ボタンをクリックして、このメッセージを無視してください。</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -9051,9 +8616,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">上書き(&V)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1714"/>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>仮想マシン実行中に重大なエラーが発生したため、仮想マシンは停止しました。</p><p>問題の解決のため、<a href=https://www.virtualbox.org>https://www.virtualbox.org</a>のCommunityセクションを参照するか、サポートに連絡してください。あなたがエラー発生時に行った操作と共に、<nobr><b>%1</b></nobr>ディレクトリに格納されているログファイル(<tt>VBox.log</tt>)とイメージファイル(<tt>VBox.png</tt>)を提供してください。注:VirtualBoxメインウィンドウの<b>[仮想マシン]</b>メニューから[ログを参照]を選択して、上記ファイルにアクセスすることができます。</p><p>仮想マシンを電源オフする [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>仮想マシン実行中に重大なエラーが発生したため、仮想マシンは停止しました。</p><p>問題の解決のため、<a href=http://www.virtualbox.org>http://www.virtualbox.org</a>のCommunityセクションを参照するか、サポートに連絡してください。あなたがエラー発生時に行った操作と共に、<nobr><b>%1</b></nobr>ディレクトリに格納されているログファイル(<tt>VBox.log</tt>)とイメージファイル(<tt>VBox.png</tt>)を提供してください。注:VirtualBoxメインウィンドウの<b>[仮想マシン]</b>メニューから[ログを参照]を選択して、上記ファイルにアクセスすることができます。</p><p&g [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -9075,7 +8639,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ファイル名<b>"%1"</b>はすでに使われています。ファイルを置き換えますか?<br /><br />ファイルは"%2"に存在します。ファイルの内容は上書きされます。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2335"/>
         <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
         <translation>以下のファイルはすでに存在しています:<br /><br />%1<br /><br />ファイルを置き換えますか?ファイルの内容は上書きされます。</translation>
     </message>
@@ -9084,7 +8647,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><b>"%1"</b>の除去に失敗しました。<br /><br />手作業でファイルを取り除き、再実行してください。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="378"/>
         <source>You are running a prerelease version of VirtualBox. This version is not suitable for production use.</source>
         <translation>これはVirtualBoxのプレリリースバージョンです。このバージョンは実務作業には適していません。</translation>
     </message>
@@ -9093,30 +8655,18 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">USBファイルシステム(usbfs)もDBusとhalサービスも利用できないため、ホストシステムでUSBにアクセスできませんでした。 ゲストOSでホストUSB デバイスを使用するには、これを修正してVirtualBoxを再起動してください。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="413"/>
         <source>You are trying to shut down the guest with the ACPI power button. This is currently not possible because the guest does not support software shutdown.</source>
         <translation>電源ボタン オフのACPIイベントでゲストOSをシャットダウンしようとしています。ゲストOSがACPIサブシステムを使用しないためシャットダウンできません。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1741"/>
         <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source>
         <translation><p>仮想化支援機能(VT-x/AMD-V)を有効化できません。64ビット ゲストOSは64ビットCPUを検出できず、起動できません。</p><p>ホストマシンのBIOS設定でVT-x/AMD-Vを有効化してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1747"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1754"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1765"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1771"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1782"/>
         <source>Close VM</source>
         <translation>仮想マシンを閉じる</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1584"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1747"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1754"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1765"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1771"/>
         <source>Continue</source>
         <translation>続ける</translation>
     </message>
@@ -9129,9 +8679,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">破棄</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="800"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="809"/>
-        <location filename="../src/globals/UIPopupCenter.cpp" line="241"/>
         <source>Cancel</source>
         <translation>キャンセル</translation>
     </message>
@@ -9165,7 +8712,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>スナップショット <b>%1</b> をリストアしようとしています。</p><p>現在の仮想マシンの状態から下にチェックを入れたところまでのスナップショットを作成することができます。もしこれをしないと、現在の状態が永久に失われてしまします。続行しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="795"/>
         <source>Create a snapshot of the current machine state</source>
         <translation>現在のマシンの状態のスナップショットを作成</translation>
     </message>
@@ -9174,53 +8720,42 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>本当にスナップショット <b>%1</b> をリストアしますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1614"/>
         <source>Can't find snapshot named <b>%1</b>.</source>
         <translation><b>%1</b> という名前のスナップショットが見つかりません。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="542"/>
         <source>Rename</source>
         <translation>名前を変更</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="561"/>
         <source><p>You are about to remove following virtual machine items from the machine list:</p><p><b>%1</b></p><p>Do you wish to proceed?</p></source>
         <translation><p>以下の仮想マシンを除去しようとしています:</p><p><b>%1</b></p><p>続行しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="614"/>
         <source><p>You are about to remove following inaccessible virtual machines from the machine list:</p><p>%1</p><p>Do you wish to proceed?</p></source>
         <translation><p>以下のアクセスできない仮想マシンを除去しようとしています:</p><p><b>%1</b></p><p>続行しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="619"/>
         <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well? Doing this will also remove the files containing the machine's virtual hard disks if they are not in use by another machine.</p></source>
         <translation><p>以下の仮想マシンを除去しようとしています:</p><p><b>%1</b></p><p>仮想マシンを構成するファイルをハードディスクから削除しますか? 他の仮想マシンで使用されていない仮想ハードディスクも削除します。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="625"/>
         <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p></source>
         <translation><p>以下の仮想マシンを除去しようとしています:</p><p><b>%1</b></p><p>仮想マシンを構成するファイルをハードディスクから削除しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="682"/>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation><p>以下の仮想マシンの保存状態を破棄しますか?</p><p><b>%1</b></p><p>この操作はゲストOSを適切にシャットダウンせずにリセットまたは電源をオフにすることと同等です。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1164"/>
         <source><p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p></source>
         <translation><p>メディアタイプを<b>%1</b> から <b>%2</b> にする際にエラーが発生しました。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1232"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1240"/>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>注:このメディアの記憶装置は削除されません。再度利用することができます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1028"/>
         <source><p>You are about to add a virtual hard disk to controller <b>%1</b>.</p><p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p></source>
         <translation><p>仮想ハードディスクをコントローラー<b>"%1"</b>に追加します。</p><p>空の仮想ハードディスクを新規作成しますか?既存の仮想ハードディスクを選択しますか?</p></translation>
     </message>
@@ -9235,9 +8770,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">既存のディスクを選択(&C)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1038"/>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>CD/DVDドライブをコントローラー<b>"%1"</b>に追加します。</p><p>仮想CD/DVDディスクをドライブに割り当てますか?空のドライブだけ割り当てますか?</p></translation>
+        <translation type="obsolete"><p>CD/DVDドライブをコントローラー<b>"%1"</b>に追加します。</p><p>仮想CD/DVDディスクをドライブに割り当てますか?空のドライブだけ割り当てますか?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -9250,24 +8784,20 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">空のドライブ(&E)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1049"/>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
         <translation><p>フロッピードライブをコントローラー<b>"%1"</b>に追加します。</p><p>仮想フロッピーディスクをドライブに割り当てますか?空のドライブだけ割り当てますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1296"/>
         <source>Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
         <translation>ハードディスク(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当て解除に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1302"/>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>CD/DVDデバイス(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当て解除に失敗しました。</translation>
+        <translation type="obsolete">CD/DVDデバイス(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当て解除に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1308"/>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>フロッピーデバイス(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当て解除に失敗しました。</translation>
+        <translation type="obsolete">フロッピーデバイス(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当て解除に失敗しました。</translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
@@ -9278,12 +8808,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想アプライアンスのオープンに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1546"/>
         <source>Failed to open/interpret appliance <b>%1</b>.</source>
         <translation>仮想アプライアンス<b>"%1"</b>のオープンまたは解析に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1554"/>
         <source>Failed to import appliance <b>%1</b>.</source>
         <translation>仮想アプライアンス<b>"%1"</b>のインポートに失敗しました。</translation>
     </message>
@@ -9298,8 +8826,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想アプライアンスの作成に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1590"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1598"/>
         <source>Failed to prepare the export of the appliance <b>%1</b>.</source>
         <translation>仮想アプライアンス<b>"%1"</b>のエクスポートの前処理に失敗しました。</translation>
     </message>
@@ -9308,42 +8834,34 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想アプライアンスの作成に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1606"/>
         <source>Failed to export appliance <b>%1</b>.</source>
         <translation>仮想アプライアンス<b>"%1"</b>のエクスポートに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="906"/>
         <source><p>Deleting this host-only network will remove the host-only interface this network is based on. Do you want to remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p><p><b>Note:</b> this interface may be in use by one or more virtual network adapters belonging to one of your VMs. After it is removed, these adapters will no longer be usable until you correct their settings by either choosing a different in [...]
         <translation><p>このインターフェースを除去すると、このインターフェースが基づいているホストオンリーネットワークインターフェースが削除されます。ホストオンリーネットワークインターフェース<nobr><b>%1</b></nobr>を削除しますか?</p><p><b>注:</b>このインターフェースは他の仮想ネットワークアダプターで使用しているかもしれません。削除した場合、それらのアダプターは、他のインターフェース名を選ぶか、別のアダプタータイプを選んで設定を変更するまで使用できません。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2322"/>
         <source>A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.</source>
         <translation>ファイル名<b>"%1"</b>はすでに使われています。ファイルを置き換えますか?<br /><br />ファイルの内容は上書きされます。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1761"/>
         <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Certain guests (e.g. OS/2 and QNX) require this feature.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source>
         <translation><p>仮想化支援機能(VT-x/AMD-V)が有効化されましたが使用できません。いくつかのゲストOS(OS/2やQNXなど))は本機能を必要とします。</p><p>ホストマシンのBIOS設定でVT-x/AMD-Vを有効化してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="791"/>
         <source><p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p><p>You can create a snapshot of the current state of the virtual machine first by checking the box below; if you do not do this the current state will be permanently lost. Do you wish to proceed?</p></source>
         <translation><p>スナップショット <b>%1</b> をリストアしようとしています。</p><p>現在の仮想マシンの状態から下にチェックを入れたところまでのスナップショットを作成することができます。もしこれをしないと、現在の状態が永久に失われてしまします。続行しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="802"/>
         <source><p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p></source>
         <translation><p>本当にスナップショット <b>%1</b> をリストアしますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1777"/>
         <source><p>Could not start the machine <b>%1</b> because the following physical network interfaces were not found:</p><p><b>%2</b></p><p>You can either change the machine's network settings or stop the machine.</p></source>
         <translation><p>次の物理ネットワークインターフェースが見つからないので、仮想マシン<b>%1</b>を開始できません:</p><p><b>%2</b></p><p>マシンのネットワーク設定を変更するとか、マシンを停止してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1782"/>
         <source>Change Network Settings</source>
         <translation>ネットワーク設定の変更</translation>
     </message>
@@ -9352,17 +8870,14 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">仮想マシンを閉じる</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="528"/>
         <source><p>You are trying to move machine <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p><p>Please resolve this name-conflict and try again.</p></source>
         <translation><p>マシン<nobr><b>%1</b></nobr>(すでにサブグループ<nobr><b>%1</b></nobr>に入っている)をグループ<nobr><b>%2</b></nobr>に移動しようとしています。</p><p>名前の衝突を回避し、もう一度実行してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="537"/>
         <source><p>You are trying to move group <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p><p>Would you like to automatically rename it?</p></source>
         <translation><p>同じ名前で別のアイテムを持つグループ<nobr><b>%1</b></nobr>を<nobr><b>%2</b></nobr>に移動しようとしています。</p><p>自動的に名前を変更しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="553"/>
         <source>Failed to set groups of the virtual machine <b>%1</b>.</source>
         <translation>仮想マシン<b>%1</b>のグループの設定に失敗しました。</translation>
     </message>
@@ -9383,52 +8898,42 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>VirtualBoxの登録に失敗しました。</p><p>%1</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1999"/>
         <source>Do you wish to cancel all current network operations?</source>
         <translation>すべての現在のネットワーク操作をキャンセルしますか?</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="694"/>
         <source><p>Do you really want to reset the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
         <translation><p>以下の仮想マシンを本当にリセットしますか?</p><p><b>%1</b></p><p>仮想マシンをリセットすると、その中で稼動中のすべてのアプリケーションの保存されていないデータは失われます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="705"/>
         <source><p>Do you really want to send an ACPI shutdown signal to the following virtual machines?</p><p><b>%1</b></p></source>
         <translation><p>以下の仮想マシンに本当にACPIシャットダウン信号を送りますか?</p><p><b>%1</b></p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="715"/>
         <source><p>Do you really want to power off the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
         <translation><p>以下の仮想マシンを本当に電源オフしますか?</p><p><b>%1</b></p><p>仮想マシンを電源オフすると、その中で稼動中のすべてのアプリケーションの保存されていないデータは失われます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1562"/>
         <source>Failed to check files.</source>
         <translation>ファイルの確認に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1569"/>
         <source>Failed to remove file.</source>
         <translation>ファイルの除去に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="361"/>
         <source>You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. We strongly recommend that you change this, as it is a severe mis-configuration of your system which could cause USB devices to fail in unexpected ways.</source>
         <translation>USBFS ファイルシステムを/sys/bus/usb/driversにマウントしています。これを変更することを強く勧めます。誤ったシステム構成によりUSB デバイスの使用に失敗するかもしれません。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="385"/>
         <source>You are running an EXPERIMENTAL build of VirtualBox. This version is not suitable for production use.</source>
         <translation>これはVirtualBoxの試験的ビルドです。このバージョンは実務作業には適していません。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1750"/>
         <source><p>VT-x/AMD-V hardware acceleration is not available on your system. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</source>
         <translation><p>ホストマシンの仮想化支援機能(VT-x/AMD-V)が使用できません。64ビット ゲストOSは64ビットCPUを検出できず、起動できません。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1768"/>
         <source><p>VT-x/AMD-V hardware acceleration is not available on your system. Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p></source>
         <translation><p>ホストマシンの仮想化支援機能(VT-x/AMD-V)が使用できません。本機能を必要とするいくつかのゲストOS(OS/2やQNXなど)は起動できません。</p></translation>
     </message>
@@ -9437,53 +8942,38 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>スナップショット<b>"%1"</b>に復元しますか?現在の仮想マシンの状態は失われ、それを回復することはできません。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="800"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="809"/>
         <source>Restore</source>
         <translation>復元</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="815"/>
         <source><p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over several image files that VirtualBox has created together with the snapshot will be merged into one file. This can be a lengthy process, and the information in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p></source>
         <translation><p>スナップショットを削除すると、スナップショットに格納されている情報は失われ、VirtualBoxがスナップショットと共に作成した複数のディスクデータはひとつのファイルにマージされます。これには長い時間がかかるかもしれません。そしてスナップショットの情報を回復することはできません。</p><p>スナップショット<b>"%1"</b>を削除しますか?。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="821"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="836"/>
         <source>Delete</source>
         <translation>削除</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="830"/>
         <source><p>Deleting the snapshot %1 will temporarily need more disk space. In the worst case the size of image %2 will grow by %3, however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting the snapshot at your own risk.</p></source>
         <translation><p>スナップショット %1の削除には多くのディスク容量を必要とします。ディスクイメージファイル %2のサイズは最大で%3まで増加します。しかし、ディスクの空き容量は%4しかありません。</p><p>マージ作業中にディスク容量が不足すると、仮想マシンのデータを失う可能性があります。</p><p>スナップショットの削除を自己責任で続行できます。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="858"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="867"/>
         <source>Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
         <translation>仮想マシン<b>"%2"</b>のスナップショット<b>"%1"</b>への復元に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="876"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="884"/>
         <source>Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
         <translation>仮想マシン<b>"%2"</b>のスナップショット<b>"%1"</b>の削除に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1836"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1849"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1862"/>
         <source>Switch</source>
         <translation>切り替え</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1900"/>
         <source><p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p></source>
         <translation><p>ビデオメモリー不足のため、ゲスト スクリーンをこのホスト スクリーンに変更できません。</p><p>仮想マシンの構成で<b>%1</b>以上のビデオメモリーを指定してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1889"/>
         <source><p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p><p>Press <b>Ignore</b> to switch the screen anyway or press <b>Cancel</b> to cancel the operation.</p></source>
         <translation><p>ビデオメモリー不足のため、ゲスト スクリーンをこのホスト スクリーンに変更できません。</p><p>仮想マシンの構成で<b>%1</b>以上のビデオメモリーを指定してください。</p><p><b>[無視]</b>ボタンをクリックしするとスクリーンを強制的に切り換えます。<b>[キャンセル]</b>ボタンをクリックすると操作は取り消されます。</p></translation>
     </message>
@@ -9514,12 +9004,10 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>新規の割り当てに利用できる未使用のメディアがありません。</p><p><b>[選択]</b>ボタンをクリックして、<i>仮想メディアマネージャー</i>を開いてください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1060"/>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>CD/DVD デバイスを削除しますか?</p><p>デバイスがない場合、CD/DVDメディアやISOイメージファイルのマウントおよびGuest Additions のインストールはできません!</p></translation>
+        <translation type="obsolete"><p>CD/DVD デバイスを削除しますか?</p><p>デバイスがない場合、CD/DVDメディアやISOイメージファイルのマウントおよびGuest Additions のインストールはできません!</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1064"/>
         <source>&Remove</source>
         <comment>medium</comment>
         <translation>除去(&R)</translation>
@@ -9549,7 +9037,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">メディアを強制マウント解除しますか?</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1366"/>
         <source>Force Unmount</source>
         <translation>強制マウント解除</translation>
     </message>
@@ -9586,7 +9073,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>VirtualBox ユーザーマニュアルを<nobr><a href="%1">%2</a></nobr>からダウンロードしましたが、<nobr><b>%3</b></nobr>に保存できません。</p><p>他の保存場所を選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2117"/>
         <source><p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p><p>Do you wish to download latest one from the Internet?</p></source>
         <translation><p> <b><nobr>%2</nobr></b> の古いバージョン(%1)がインストールされています。</p><p>最新版をインターネットからダウンロードしますか?</p></translation>
     </message>
@@ -9596,7 +9082,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">ダウンロード</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2021"/>
         <source><p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p><p>You should download and install version %3 of this extension pack from Oracle!</p></source>
         <translation><p> <b><nobr>%2</nobr></b> のバージョン %1 がインストールされています。</p><p>Oracleからバージョン %3 の拡張機能をダウンロードし、インストールしてください!</p></translation>
     </message>
@@ -9606,24 +9091,19 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">OK</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2127"/>
         <source><p>Are you sure you want to download the <b><nobr>%1</nobr></b> from <nobr><a href="%2">%2</a></nobr> (size %3 bytes)?</p></source>
         <translation><p><nobr><a href="%2">%2</a></nobr> から <b><nobr>%1</nobr></b>をダウンロードをしますか (サイズ %3 bytes) ?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2147"/>
         <source><p>The <b><nobr>%1</nobr></b> has been successfully downloaded from <nobr><a href="%2">%2</a></nobr> and saved locally as <nobr><b>%3</b>.</nobr></p><p>Do you wish to install this extension pack?</p></source>
         <translation><p><nobr><a href="%2">%2</a></nobr> から<b><nobr>%1</nobr></b>のダウンロードに成功し、<nobr><b>%3</b> として保存しました。</nobr></p><p>拡張機能パックをインストールしますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2153"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2172"/>
         <source>Install</source>
         <comment>extension pack</comment>
         <translation>インストール</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2137"/>
         <source><p>The <b><nobr>%1</nobr></b> has been successfully downloaded from <nobr><a href="%2">%2</a></nobr> but can't be saved locally as <nobr><b>%3</b>.</nobr></p><p>Please choose another location for that file.</p></source>
         <translation><p><nobr><a href="%2">%2</a></nobr>から<b><nobr>%1</nobr></b> のダウンロードに成功しましたが、<nobr><b>%3</b> として保存することができませんでした。</nobr></p><p>ほかの場所を選択してください。</p></translation>
     </message>
@@ -9637,17 +9117,14 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>次のVirtualBox設定ファイルは古い形式から新バージョンのVirtualBoxが必要とする新しい形式に自動的に変更されます。</p><p><b>[OK]</b>ボタンをクリックしてVirtualBoxを起動するか、設定ファイルの変更を行わずにVirtualBoxアプリケーションを終了させたいなら<b>[終了]</b>ボタンをクリックしてください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1829"/>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
         <translation><p>仮想マシンのウィンドウを"フルスクリーン"モードに切り替えます。<b>%1</b>キーを押すといつでもウィンドウモードに戻ることができます。</p><p>注:<i>ホスト</i>キーは現在<b>%2</b>に割り当てられています。</p><p>注:フルスクリーンモードではメインメニューバーは表示されません。メニューバーにアクセスするには <b>ホスト+Home</b>キーを押してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1842"/>
         <source><p>The virtual machine window will be now switched to <b>Seamless</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in seamless mode. You can access it by pressing <b>Host+Home</b>.</p></source>
         <translation><p>仮想マシンのウィンドウを"シームレス"モードに切り替えます。<b>%1</b>キーを押すといつでもウィンドウ表示に戻ることができます。</p><p>注:<i>ホスト</i>キーは現在<b>%2</b>に割り当てられています。</p><p>注:シームレスモードではメインメニューバーは表示されません。メニューバーにアクセスするには <b>ホスト+Home</b>キーを押してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1855"/>
         <source><p>The virtual machine window will be now switched to <b>Scale</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in scaled mode. You can access it by pressing <b>Host+Home</b>.</p></source>
         <translation><p>仮想マシンのウィンドウを"スケール"モードに切り替えます。<b>%1</b>キーを押すといつでもウィンドウ表示に戻ることができます。</p><p>注:<i>ホスト</i>キーは現在<b>%2</b>に割り当てられています。</p><p>注:スケールモードではメインメニューバーは表示されません。メニューバーにアクセスするには <b>ホスト+Home</b>キーを押してください。</p></translation>
     </message>
@@ -9657,34 +9134,28 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">切り替え</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="709"/>
         <source>ACPI Shutdown</source>
         <comment>machine</comment>
         <translation>ACPI シャットダウン</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="720"/>
         <source>Power Off</source>
         <comment>machine</comment>
         <translation>電源オフ</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1511"/>
         <source><p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p><p>Please check that this folder really exists and that you have permissions to remove it.</p></source>
         <translation><p>仮想マシンのフォルダー<nobr><b>%1</b>を除去できません。</nobr></p><p>このフォルダーが本当に存在し、除去する権限があるか確認してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1520"/>
         <source><p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p></source>
         <translation><p>仮想マシンのフォルダー<b>%1</b>を親フォルダー<nobr><b>%2</b>に作成できません。</nobr></p><p>このフォルダーはすでに存在し、ほかマシンに属している可能性があります。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1529"/>
         <source><p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>Please check that the parent really exists and that you have permissions to create the machine folder.</p></source>
         <translation><p>仮想マシンフォルダー<b>%1</b>を親フォルダー<nobr><b>%2</b>に作成できません。</nobr></p><p>親フォルダーの存在と、フォルダー作成に必要な権限の有無を確認してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="1434"/>
         <source>You are about to create a new virtual machine without a hard drive. You will not be able to install an operating system on the machine until you add one. In the mean time you will only be able to start the machine using a virtual optical disk or from the network.</source>
         <translation>ハードドライブなしで新しい仮想マシンを作成しようとしています。それを追加するまではオペレーティングシステムをインストールすることはできません。仮想光学ディスクか、ネットワークから起動することしかできないことを意味します。</translation>
     </message>
@@ -9696,13 +9167,10 @@ p, li { white-space: pre-wrap; }
         </translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2246"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2253"/>
         <source>Failed to open the Extension Pack <b>%1</b>.</source>
         <translation>機能拡張パッケージ<b>"%1"</b>のオープンに失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2161"/>
         <source><p>You are about to install a VirtualBox extension pack. Extension packs complement the functionality of VirtualBox and can contain system level software that could be potentially harmful to your system. Please review the description below and only proceed if you have obtained the extension pack from a trusted source.</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%1< [...]
         <translation><p>VirtualBox 機能拡張パッケージをインストールします。機能拡張パッケージはVirtualBoxに機能を追加しますが、コンピューターに危害を与えるようなシステムレベルのソフトウェアを含んでいる可能性があります。信頼できる発行元から機能拡張パッケージを入手した場合に限り、以下の内容を確認して、処理を続行してください。</p><p><table cellpadding=0 cellspacing=0><tr><td><b>名前:&nbsp;&nbsp;</b></td><td>%1</td></tr><tr><td><b>バージョン:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td>< [...]
     </message>
@@ -9711,47 +9179,38 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">インストール(&I)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2180"/>
         <source>Extension packs complement the functionality of VirtualBox and can contain system level software that could be potentially harmful to your system. Please review the description below and only proceed if you have obtained the extension pack from a trusted source.</source>
         <translation>機能拡張パッケージはVirtualBoxに機能を追加しますが、システムに危害を与えるシステムレベルのソフトウェアを含むこともできます。信頼できる発行元から機能拡張パッケージを入手した場合に限り、以下の内容を確認して、処理を続行してください。</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2194"/>
         <source><p>An older version of the extension pack is already installed, would you like to upgrade? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>New Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Current Version:&nbsp;&nbsp;</b></td& [...]
         <translation><p>古いバージョンの機能拡張パッケージがインストールされています。アップグレードしますか?<p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>名前:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>バージョン:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>現在のバージョン:&nbsp;&nbsp;</b></td><td>%4</td></tr><tr><td&g [...]
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2204"/>
         <source>&Upgrade</source>
         <translation>アップグレード(&U)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2207"/>
         <source><p>An newer version of the extension pack is already installed, would you like to downgrade? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>New Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Current Version:&nbsp;&nbsp;</b></t [...]
         <translation><p>新しいバージョンの機能拡張パッケージがインストールされています。ダウングレードしますか?<p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>名前:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>バージョン:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>現在のバージョン:&nbsp;&nbsp;</b></td><td>%4</td></tr><tr><td& [...]
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2217"/>
         <source>&Downgrade</source>
         <translation>ダウングレード(&D)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2220"/>
         <source><p>The extension pack is already installed with the same version, would you like reinstall it? <p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>Name:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>Version:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>Description:&nbsp;&nbsp;</b></td>& [...]
         <translation><p>同じバージョンの機能拡張パッケージがインストールされています。再インストールしますか?<p>%1</p><p><table cellpadding=0 cellspacing=0><tr><td><b>名前:&nbsp;&nbsp;</b></td><td>%2</td></tr><tr><td><b>バージョン:&nbsp;&nbsp;</b></td><td>%3</td></tr><tr><td><b>説明:&nbsp;&nbsp;</b></td><td>%4</td></tr></table></p> [...]
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2229"/>
         <source>&Reinstall</source>
         <translation>再インストール(&R)</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2236"/>
         <source><p>You are about to remove the VirtualBox extension pack <b>%1</b>.</p><p>Are you sure you want to proceed?</p></source>
         <translation><p> VirtualBox 機能拡張パッケージ"<b>%1</b>"を除去します。</p><p>続行しますか?</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2292"/>
         <source>The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.</source>
         <translation>機能拡張パッケージ<br><nobr><b>%1</b><nobr><br>のインストールに成功しました。</translation>
     </message>
@@ -9781,37 +9240,30 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">フロッピーイメージ</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2300"/>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2307"/>
         <source>Failed to drop data.</source>
-        <translation>データのドロップに失敗しました。</translation>
+        <translation type="obsolete">データのドロップに失敗しました。</translation>
     </message>
     <message>
         <source><p>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b><nobr>%1</nobr></b> to be installed.</p><p>Please install the Extension Pack from the VirtualBox download site. After this you will be able to re-enable USB 2.0. It will be disabled in the meantime unless you cancel the current settings changes.</p></source>
         <translation type="obsolete"><p>この仮想マシンでUSB 2.0を有効にするには<b><nobr>%1</nobr></b>のインストールが必要です。</p><p>VirtualBoxのダウンロードサイトから機能拡張パッケージをダウンロードし、インストールしてください。機能拡張パッケージをインストールすると、USB 2.0を有効にすることができます。現在の設定をキャンセルしない場合、USB 2.0は無効にします。</p></translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2594"/>
         <source>Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might not be installed on the host computer</source>
         <translation>USBプロキシーサービスが読み込めません (VERR_FILE_NOT_FOUND)。このサービスはホストコンピューターにインストールされている必要があります</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2595"/>
         <source>VirtualBox is not currently allowed to access USB devices.  You can change this by adding your user to the 'vboxusers' group.  Please see the user manual for a more detailed explanation</source>
         <translation>VirtualBoxは現在USBデバイスへのアクセスが許可されていません。ユーザーを'vboxusers'グループに追加してください。詳細な説明はユーザーマニュアルをお読みください</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2596"/>
         <source>VirtualBox is not currently allowed to access USB devices.  You can change this by allowing your user to access the 'usbfs' folder and files.  Please see the user manual for a more detailed explanation</source>
         <translation>VirtualBoxは現在USBデバイスへのアクセスが許可されていません。ユーザーを'usbfs'フォルダーとファイルに追加してください。詳細な説明はユーザーマニュアルをお読みください</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2597"/>
         <source>The USB Proxy Service has not yet been ported to this host</source>
         <translation>USB プロキシーサービスはこのホストにはまだ移植されていません</translation>
     </message>
     <message>
-        <location filename="../src/globals/UIMessageCenter.cpp" line="2598"/>
         <source>Could not load the Host USB Proxy service</source>
         <translation>ホストのUSB プロキシーサービスを読み込むことができません</translation>
     </message>
@@ -9831,75 +9283,174 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">フロッピーデバイス</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPopupPaneButtonPane.cpp" line="181"/>
         <source>Do not show this message again</source>
         <translation>次回からこのメッセージを表示しない</translation>
     </message>
-</context>
-<context>
-    <name>UIMiniProcessWidgetAdditions</name>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">キャンセル</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation>現在のポートフォワーディングルールは無効です。 ルール名は一意である必要があります。</translation>
     </message>
     <message>
-        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
-        <translation type="obsolete">VirtualBox Guest Additions CDイメージのダウンロードをキャンセル</translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation>現在のポートフォワーディングルールは無効です。 ホストと同じポートの割当とIPアドレスの競合があります。</translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
-        <translation type="obsolete">VirtualBox Guest Additions CDイメージを<nobr><b>%1</b>からダウンロード...</nobr></translation>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>VirtualBoxClient COMオブジェクトの作成に失敗しました。</p><p>アプリケーションを終了します。</p></translation>
     </message>
-</context>
-<context>
-    <name>UIMiniProcessWidgetUserManual</name>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">キャンセル</translation>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation>VirtualBox全体のエクストラデータキー: <i>%1</i> 値: <i>{%2}</i> の設定に失敗しました。</translation>
     </message>
     <message>
-        <source>Cancel the VirtualBox User Manual download</source>
-        <translation type="obsolete">VirtualBox ユーザーマニュアルのダウンロードをキャンセル</translation>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation>エクストラデータキー: <i>%1</i> マシン: <i>%2</i> 値: <i>{%3}</i> の設定に失敗しました。</translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox User Manual</source>
-        <translation type="obsolete">VirtualBox ユーザーマニュアルのダウンロード</translation>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>現在一つ以上の仮想ハードディスク、光学またはフロッピーメディアにアクセスできません。アクセス可能になるまでこれらのメディアを使用する仮想マシンを操作できません。</p><p><b>[確認]</b>ボタンをクリックして仮想メディアマネージャーを起動し、どのメディアにアクセスできないのか確認してください。または<b>[無視]</b>ボタンをクリックして、このメッセージを無視してください。</p></translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox User Manual <nobr><b>%1</b>...</nobr></source>
-        <translation type="obsolete">VirtualBox ユーザーマニュアルを<nobr><b>%1</b>からダウンロード...</nobr></translation>
+        <source>Failed to save the settings.</source>
+        <translation>設定の保存に失敗しました。</translation>
     </message>
-</context>
-<context>
-    <name>UIMiniProgressWidgetAdditions</name>
     <message>
-        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
-        <translation type="obsolete">VirtualBox Guest Additions CDイメージのダウンロードをキャンセル</translation>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p>光学ドライブをコントローラー<b>"%1"</b>に追加します。</p><p>仮想光学ディスクをドライブに割り当てますか? それとも空のドライブだけ割り当てますか?</p></translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>光学ドライブを削除しますか?</p><p>デバイスがない場合、光学ディスクやISOイメージファイルのマウントおよびGuest Additions のインストールはできません!</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>光学ドライブ(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当てに失敗しました。</translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>フロッピードライブ(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当てに失敗しました。</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>光学ドライブ(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当て解除に失敗しました。</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>フロッピードライブ(<nobr><b>%1</b></nobr>)の、仮想マシン<b>"%3"</b>のスロット<i>"%2"</i> への割り当て解除に失敗しました。</translation>
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">仮想マシン <b>%1</b> のネットワークアダプターケーブルの接続に失敗しました。</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">仮想マシン <b>%1</b> のネットワークアダプターケーブルの切断に失敗しました。</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation><p>仮想マシン<b>"%1"</b>に光学ドライブがないため、<b>VirtualBox Guest Additions</b>のディスクイメージを仮想マシンに挿入できません。 仮想マシン設定ウィンドウのストレージページでドライブを追加してください。</p></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p><b>VirtualBox Guest Additions</b> ディスクイメージを<nobr><a href="%1">%1</a></nobr>からダウンロードし、<nobr><b>%2</b>に保存しました。</nobr></p><p>ディスクイメージファイルを登録し、仮想光学ドライブに挿入しますか?</p></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation>誤ったパスワードか、認証に失敗しました。</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation><p>仮想マシン実行中に重大なエラーが発生したため、仮想マシンは停止しました。</p><p>問題の解決のため、<a href=http://www.virtualbox.org>http://www.virtualbox.org</a>のCommunityセクションを参照するか、サポート契約を確認してください。あなたがエラー発生時に行った操作と共に、<nobr><b>%1</b></nobr>ディレクトリに格納されているログファイル(<tt>VBox.log</tt>)とイメージファイル(<tt>VBox.png</tt>)を提供してください。注:VirtualBoxメインウィンドウの<b>[仮想マシン]</b>メニューから[ログを参照]を選択して、上記ファイルにアクセスすることができます。</p><p>仮想マシンを電源オフする [...]
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation><p>仮想マシンの実行中に致命的な問題が起き、マシンの実行が停止します。</p><p><a href=http://www.virtualbox.org>http://www.virtualbox.org</a> のコミュニティセクションを確認するか、サポート契約を確認してください。その際は仮想マシンのログディレクトリにあるログファイル <tt>VBox.log</tt> の中身を提供してください。同時にエラーが起きた時に何をしたのかの情報も提供してください。前述のファイルはVirtualBoxウィンドウの<b>仮想マシン</b>  にある <b>ログを参照</b> からでもアクセスできます。</p><p><b>OK</b> ボタンを押して仮想マシンの電源を切ります。</p></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation><p>VirtualBoxの新しいバージョンがリリースされました! バージョン <b>%1</b>は<a href="http://www.virtualbox.org/">virtualbox.org</a>から入手できます。</p><p>次のリンクから最新バージョンをダウンロードできます。: </p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation>ホストからゲストへのドラッグ&ドロップの操作に失敗しました。</translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation>ホストからゲストへのドラッグ&ドロップ操作はキャンセルできません。</translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation>ゲストからホストへのドラッグ&ドロップの操作に失敗しました。</translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProcessWidgetAdditions</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">キャンセル</translation>
+    </message>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">VirtualBox Guest Additions CDイメージのダウンロードをキャンセル</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete">VirtualBox Guest Additions CDイメージを<nobr><b>%1</b>からダウンロード...</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProcessWidgetUserManual</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">キャンセル</translation>
+    </message>
+    <message>
+        <source>Cancel the VirtualBox User Manual download</source>
+        <translation type="obsolete">VirtualBox ユーザーマニュアルのダウンロードをキャンセル</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox User Manual</source>
+        <translation type="obsolete">VirtualBox ユーザーマニュアルのダウンロード</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox User Manual <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete">VirtualBox ユーザーマニュアルを<nobr><b>%1</b>からダウンロード...</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProgressWidgetAdditions</name>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">VirtualBox Guest Additions CDイメージのダウンロードをキャンセル</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
         <translation type="obsolete">VirtualBox Guest Additions CDイメージを<nobr><b>%1</b>からダウンロード...</nobr></translation>
     </message>
 </context>
 <context>
     <name>UIMiniToolBar</name>
     <message>
-        <location filename="../src/widgets/UIMiniToolBar.cpp" line="573"/>
         <source>Always show the toolbar</source>
         <translation>常にツールバーを表示する</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIMiniToolBar.cpp" line="600"/>
         <source>Minimize Window</source>
         <translation>ウィンドウを最小化</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIMiniToolBar.cpp" line="608"/>
         <source>Exit Full Screen or Seamless Mode</source>
         <translation>フルスクリーンモードまたはシームレスモードを終了する</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIMiniToolBar.cpp" line="615"/>
         <source>Close VM</source>
         <translation>仮想マシンを閉じる</translation>
     </message>
@@ -9907,12 +9458,10 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIMultiScreenLayout</name>
     <message>
-        <location filename="../src/runtime/UIMultiScreenLayout.cpp" line="330"/>
         <source>Virtual Screen %1</source>
         <translation>仮想スクリーン %1</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIMultiScreenLayout.cpp" line="337"/>
         <source>Use Host Screen %1</source>
         <translation>ホスト スクリーン %1 を使う</translation>
     </message>
@@ -9920,32 +9469,26 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <location filename="../src/widgets/UINameAndSystemEditor.cpp" line="159"/>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>名前(&N):</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UINameAndSystemEditor.cpp" line="160"/>
         <source>Holds the name of the virtual machine.</source>
         <translation>仮想マシンの名前を指定します。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UINameAndSystemEditor.cpp" line="161"/>
         <source>&Type:</source>
         <translation>タイプ(&T):</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UINameAndSystemEditor.cpp" line="162"/>
         <source>Selects the operating system family that you plan to install into this virtual machine.</source>
         <translation>仮想マシンにインストールしようとしているOSファミリーを選択します。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UINameAndSystemEditor.cpp" line="164"/>
         <source>&Version:</source>
         <translation>バージョン(&V):</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UINameAndSystemEditor.cpp" line="165"/>
         <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
         <translation>仮想マシンで実行するOS(ゲストOSと呼びます)のタイプを選択します。</translation>
     </message>
@@ -9953,22 +9496,18 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINetworkManagerDialog</name>
     <message>
-        <location filename="../src/net/UINetworkManagerDialog.cpp" line="155"/>
         <source>Network Operations Manager</source>
         <translation>ネットワーク操作マネージャー</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkManagerDialog.cpp" line="158"/>
         <source>There are no active network operations.</source>
         <translation>アクティブなネットワーク操作がありません。</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkManagerDialog.cpp" line="161"/>
         <source>&Cancel All</source>
         <translation>すべてキャンセル(&C)</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkManagerDialog.cpp" line="162"/>
         <source>Cancel all active network operations</source>
         <translation>すべてのネットワーク操作をキャンセル</translation>
     </message>
@@ -9977,22 +9516,18 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">エラー: %1 です。</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkRequestWidget.cpp" line="179"/>
         <source>The network operation failed with the following error: %1.</source>
         <translation>ネットワークの操作は次の理由でエラーになりました: %1。</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkRequestWidget.cpp" line="197"/>
         <source>Network Operation</source>
         <translation>ネットワーク操作</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkRequestWidget.cpp" line="200"/>
         <source>Restart network operation</source>
         <translation>ネットワーク操作を再起動</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkRequestWidget.cpp" line="203"/>
         <source>Cancel network operation</source>
         <translation>ネットワーク操作をキャンセル</translation>
     </message>
@@ -10000,23 +9535,19 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINetworkManagerIndicator</name>
     <message>
-        <location filename="../src/net/UINetworkManagerIndicator.cpp" line="210"/>
         <source>Current network operations:</source>
         <translation>現在のネットワーク操作:</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkManagerIndicator.cpp" line="217"/>
         <source>failed</source>
         <comment>network operation</comment>
         <translation>失敗</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkManagerIndicator.cpp" line="218"/>
         <source>(%1 of %2)</source>
         <translation>(%2 の %1)</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkManagerIndicator.cpp" line="226"/>
         <source>Double-click for more information.</source>
         <translation>詳細な情報を知るにはダブルクリックしてください。</translation>
     </message>
@@ -10024,32 +9555,26 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINetworkReplyPrivate</name>
     <message>
-        <location filename="../src/net/UINetworkReply.cpp" line="642"/>
         <source>Host not found</source>
         <translation>ホストが見つかりません</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkReply.cpp" line="644"/>
         <source>Content access denied</source>
         <translation>内容へのアクセスを拒否されました</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkReply.cpp" line="646"/>
         <source>Protocol failure</source>
         <translation>プロトコル失敗</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkReply.cpp" line="648"/>
         <source>Wrong SSL certificate format</source>
         <translation>誤ったSSL証明書のフォーマット</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkReply.cpp" line="650"/>
         <source>SSL authentication failed</source>
         <translation>SSL認証に失敗</translation>
     </message>
     <message>
-        <location filename="../src/net/UINetworkReply.cpp" line="652"/>
         <source>Unknown reason</source>
         <translation>原因不明</translation>
     </message>
@@ -10750,8 +10275,6 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIPopupCenter</name>
     <message>
-        <location filename="../src/widgets/UIPopupPane.cpp" line="274"/>
-        <location filename="../src/widgets/UIPopupPane.cpp" line="275"/>
         <source>Click for full details</source>
         <translation>クリックしてすべての情報を表示</translation>
     </message>
@@ -10759,32 +10282,26 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIPortForwardingModel</name>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="370"/>
         <source>Name</source>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="371"/>
         <source>Protocol</source>
         <translation>プロトコル</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="372"/>
         <source>Host IP</source>
         <translation>ホスト IP</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="373"/>
         <source>Host Port</source>
         <translation>ホスト ポート</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="374"/>
         <source>Guest IP</source>
         <translation>ゲスト IP</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIPortForwardingTable.cpp" line="375"/>
         <source>Guest Port</source>
         <translation>ゲスト ポート</translation>
     </message>
@@ -10792,7 +10309,6 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIProgressDialog</name>
     <message>
-        <location filename="../src/widgets/UIProgressDialog.cpp" line="132"/>
         <source>&Cancel</source>
         <translation>キャンセル(&C)</translation>
     </message>
@@ -10853,28 +10369,23 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">残り時間 %1秒</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIProgressDialog.cpp" line="288"/>
         <source>A few seconds remaining</source>
         <translation>残り時間 数秒</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIProgressDialog.cpp" line="131"/>
         <source>Canceling...</source>
         <translation>キャンセル...</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIProgressDialog.cpp" line="133"/>
         <source>Cancel the current operation</source>
         <translation>現在の操作をキャンセル</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIProgressDialog.cpp" line="260"/>
         <source>%1, %2 remaining</source>
         <comment>You may wish to translate this more like "Time remaining: %1, %2"</comment>
         <translation>残り時間:%1, %2</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UIProgressDialog.cpp" line="261"/>
         <source>%1 remaining</source>
         <comment>You may wish to translate this more like "Time remaining: %1"</comment>
         <translation>残り時間:%1</translation>
@@ -10883,36 +10394,34 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UISelectorWindow</name>
     <message>
-        <location filename="../src/selector/UISelectorWindow.cpp" line="225"/>
         <source>Show Toolbar</source>
         <translation>ツールバーを表示</translation>
     </message>
     <message>
-        <location filename="../src/selector/UISelectorWindow.cpp" line="229"/>
         <source>Show Statusbar</source>
         <translation>ステータスバーを表示</translation>
     </message>
     <message>
-        <location filename="../src/selector/UISelectorWindow.cpp" line="352"/>
         <source>Select a virtual machine file</source>
         <translation>仮想マシンファイルを選択</translation>
     </message>
     <message>
-        <location filename="../src/selector/UISelectorWindow.cpp" line="356"/>
         <source>Virtual machine files (%1)</source>
         <translation>仮想マシンファイル(%1)</translation>
     </message>
     <message>
-        <location filename="../src/selector/UISelectorWindow.cpp" line="870"/>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>ようこそVirtualBoxへ!</h3><p>このウィンドウの左側にコンピューター上のすべての仮想マシンがリスト表示されます。しかしまだ仮想マシンが作成されていないため、リストは空です。<img src=:/welcome.png align=right/></p><p>新規仮想マシンを作成するにはウィンドウ上部にあるメインツールバーの<b>[新規]</b>ボタンをクリックしてください。</p><p><b>%1</b>キーでヘルプを表示できます。または最新情報とニュースを取得するため <a href=https://www.virtualbox.org>www.virtualbox.org</a> を訪問ください。</p></translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>ようこそVirtualBoxへ!</h3><p>このウィンドウの左側にコンピューター上のすべての仮想マシンがリスト表示されます。しかしまだ仮想マシンが作成されていないため、リストは空です。<img src=:/welcome.png align=right/></p><p>新規仮想マシンを作成するにはウィンドウ上部にあるメインツールバーの<b>[新規]</b>ボタンをクリックしてください。</p><p><b>%1</b>キーでヘルプを表示できます。または最新情報とニュースを取得するため <a href=http://www.virtualbox.org>www.virtualbox.org</a> を訪問ください。</p></translation>
     </message>
     <message>
-        <location filename="../src/selector/UISelectorWindow.cpp" line="950"/>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>マネージャー</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation><h3>ようこそVirtualBoxへ!</h3><p>このウィンドウの左側にコンピューター上のすべての仮想マシンがリスト表示されます。しかしまだ仮想マシンが作成されていないため、リストは空です。<img src=:/welcome.png align=right/></p><p>新規仮想マシンを作成するにはウィンドウ上部にあるメインツールバーの<b>[新規]</b>ボタンをクリックしてください。</p><p><b>%1</b>キーでヘルプを表示できます。または最新情報とニュースを取得するため <a href=http://www.virtualbox.org>www.virtualbox.org</a> を訪問ください。</p></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -10921,7 +10430,6 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">インストール</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UISession.cpp" line="572"/>
         <source>Updating Guest Additions</source>
         <translation>Guest Additions をアップデートしています</translation>
     </message>
@@ -10929,7 +10437,6 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UISettingsDialog</name>
     <message>
-        <location filename="../src/settings/UISettingsDialog.ui" line="26"/>
         <source><i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information.</i></source>
         <translation><i>左側のリストから設定のカテゴリーを選択し、設定項目をマウスオーバーして詳細な情報を参照してください。</i></translation>
     </message>
@@ -10938,17 +10445,14 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete"><b>%1</b>ページ,%2</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialog.cpp" line="232"/>
         <source>Invalid settings detected</source>
         <translation>無効な設定が見つかりました</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialog.cpp" line="318"/>
         <source><b>%1</b> page:</source>
         <translation><b>%1</b> ページ:</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialog.cpp" line="319"/>
         <source><b>%1: %2</b> page:</source>
         <translation><b>%1: %2</b> ページ:</translation>
     </message>
@@ -10957,35 +10461,29 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">適切でない設定が見つかりました</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialog.cpp" line="263"/>
         <source>Settings</source>
-        <translation>設定</translation>
+        <translation type="obsolete">設定</translation>
     </message>
 </context>
 <context>
     <name>UISettingsDialogGlobal</name>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="495"/>
         <source>General</source>
         <translation>一般</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="498"/>
         <source>Input</source>
         <translation>入力</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="502"/>
         <source>Update</source>
         <translation>アップデート</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="506"/>
         <source>Language</source>
         <translation>言語</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="509"/>
         <source>Display</source>
         <translation>ディスプレイ</translation>
     </message>
@@ -10994,85 +10492,73 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">USB</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="512"/>
         <source>Network</source>
         <translation>ネットワーク</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="515"/>
         <source>Extensions</source>
         <translation>機能拡張</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="519"/>
         <source>Proxy</source>
         <translation>プロキシー</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="534"/>
         <source>VirtualBox - %1</source>
         <translation>VirtualBox - %1</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation>環境設定</translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="884"/>
         <source>General</source>
         <translation>一般</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="887"/>
         <source>System</source>
         <translation>システム</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="890"/>
         <source>Display</source>
         <translation>ディスプレイ</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="893"/>
         <source>Storage</source>
         <translation>ストレージ</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="896"/>
         <source>Audio</source>
         <translation>オーディオ</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="899"/>
         <source>Network</source>
         <translation>ネットワーク</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="902"/>
         <source>Ports</source>
         <translation>ポート</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="905"/>
         <source>Serial Ports</source>
         <translation>シリアルポート</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="908"/>
         <source>Parallel Ports</source>
         <translation>パラレルポート</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="911"/>
         <source>USB</source>
         <translation>USB</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="914"/>
         <source>Shared Folders</source>
         <translation>共有フォルダー</translation>
     </message>
     <message>
-        <location filename="../src/settings/UISettingsDialogSpecific.cpp" line="932"/>
         <source>%1 - %2</source>
         <translation>%1 - %2</translation>
     </message>
@@ -11100,31 +10586,63 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">%1チップセットがサポートするより多くのストレージコントローラーを指定しています。 システムページでチップセットの種類を変更するか、ストレージページで次のストレージコントローラーの数を減らしてください: %2。</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation>ユーザーインターフェース</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation>設定</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>設定を読み込み中...</translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation>設定を保存中...</translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation><nobr><b>クリック</b> でインジケーターの表示非表示を切り替えます。</nobr><br><nobr><b>ドラッグ&ドロップ(&D)</b> でインジケーターの場所を変更します。</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation>閉じる</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation>ステータスバーを有効にする</translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
     <message>
-        <location filename="../src/widgets/UILineTextEdit.cpp" line="74"/>
         <source>Edit text</source>
         <translation>テキストを編集</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UILineTextEdit.cpp" line="75"/>
         <source>&Replace...</source>
         <translation>置換(&R)...</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UILineTextEdit.cpp" line="76"/>
         <source>Replaces the current text with the content of a file.</source>
         <translation>現在のテキストを指定のファイルの内容で置き換えます。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UILineTextEdit.cpp" line="81"/>
         <source>Text (*.txt);;All (*.*)</source>
         <translation>テキストファイル(*.txt);;すべてのファイル(*.*)</translation>
     </message>
     <message>
-        <location filename="../src/widgets/UILineTextEdit.cpp" line="81"/>
         <source>Select a file to open...</source>
         <translation>開くファイルを選択...</translation>
     </message>
@@ -11132,57 +10650,46 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIUpdateManager</name>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="41"/>
         <source>1 day</source>
         <translation>1日</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="42"/>
         <source>2 days</source>
         <translation>2日</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="43"/>
         <source>3 days</source>
         <translation>3日</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="44"/>
         <source>4 days</source>
         <translation>4日</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="45"/>
         <source>5 days</source>
         <translation>5日</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="46"/>
         <source>6 days</source>
         <translation>6日</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="49"/>
         <source>1 week</source>
         <translation>1週間</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="50"/>
         <source>2 weeks</source>
         <translation>2週間</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="51"/>
         <source>3 weeks</source>
         <translation>3週間</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="54"/>
         <source>1 month</source>
         <translation>1月</translation>
     </message>
     <message>
-        <location filename="../src/net/UIUpdateDefs.cpp" line="118"/>
         <source>Never</source>
         <translation>確認しない</translation>
     </message>
@@ -11225,8 +10732,8 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">概要</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>VirtualBoxの新しいバージョンがリリースされました!バージョン <b>%1</b>は<a href="https://www.virtualbox.org/">virtualbox.org</a>から入手できます。</p><p>このリンクから最新バージョンをダウンロードできます。: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>VirtualBoxの新しいバージョンがリリースされました!バージョン <b>%1</b>は<a href="http://www.virtualbox.org/">virtualbox.org</a>から入手できます。</p><p>このリンクから最新バージョンをダウンロードできます。: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -11244,7 +10751,6 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIUpdateStepVirtualBox</name>
     <message>
-        <location filename="../src/net/UIUpdateManager.cpp" line="199"/>
         <source>Checking for a new VirtualBox version...</source>
         <translation>VirtualBoxの最新バージョンを確認...</translation>
     </message>
@@ -11252,91 +10758,256 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIVMCloseDialog</name>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="354"/>
         <source>Close Virtual Machine</source>
         <translation>仮想マシンを閉じる</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="357"/>
         <source>You want to:</source>
         <translation>操作を選択:</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="361"/>
         <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
         <translation><p>現在実行中の仮想マシンの状態をホストマシンの物理ハードディスクに保存します。</p><p>この仮想マシンの次回の起動時、すぐに作業を再開できるように仮想マシンは保存した状態を復元します。</p><p>注:ゲストOSの種別と仮想マシンに割り当てたメモリー量によっては、仮想マシンの状態の保存に長い時間を必要とします。</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="360"/>
         <source>&Save the machine state</source>
         <translation>仮想マシンの状態を保存(&S)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="367"/>
         <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
         <translation><p>仮想マシンに電源ボタン オフのACPIイベントを送信します。</p><p>通常、仮想マシン内で動作するゲストOSは、このイベントを検出して正しい終了処理を実行します。ゲストOSで動作するすべてのアプリケーションがデータと状態を保存することができるので、仮想マシンの電源を切るお勧めの方法です。</p><p>仮想マシンがこの動作に反応しないならば、ゲストOSの構成に誤りがあるか、電源ボタン オフのACPIイベントに対応していません。この場合、仮想マシンの実行を停止するには<b>[仮想マシンの電源オフ]</b>を選択します。</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="366"/>
         <source>S&end the shutdown signal</source>
         <translation>シャットダウン シグナル送信(&E)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="375"/>
         <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
         <translation><p>仮想マシンの電源を切ります。</p><p>注:この動作は、ゲストOSを正しく終了することなく、直ちに仮想マシンの実行を停止します。仮想マシン内の<i>データの損失</i>を招くかもしれません。この動作は、仮想マシンが<b>[シャットダウン シグナル送信]</b>に反応しない場合のみ選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="374"/>
         <source>&Power off the machine</source>
         <translation>仮想マシンの電源オフ(&P)</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="381"/>
         <source>Restore the machine state stored in the current snapshot</source>
         <translation>現在のスナップショットの状態にマシンを復元する</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="382"/>
         <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
         <translation><p>仮想マシンをオフにした後、現在のスナップショットに保存された状態に復元します。これは直前のセッションの状態を破棄し、差現在のスナップショットの状態に戻りたい場合に役立ちます。</p></translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIVMCloseDialog.cpp" line="380"/>
         <source>&Restore current snapshot '%1'</source>
         <translation>現在のスナップショット  '%1'  に復元(&R)</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>バックグラウンドで動作を継続(&C)</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><P>仮想マシンのウィンドウを閉じても、仮想マシンを実行し続けます。</p><p>VirtualBox マネージャーで仮想マシンのウィンドウ表示を戻せます。</p></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
     <message>
-        <location filename="../src/selector/UIVMDesktop.cpp" line="345"/>
         <source>&Details</source>
         <translation>詳細(&D)</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIVMDesktop.cpp" line="313"/>
         <source>&Snapshots</source>
         <translation>スナップショット(&S)</translation>
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">セッション情報ダイアログ</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">閉じる(&C)</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - セッション情報</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">詳細(&D)</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">ランタイム(&R)</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA 転送</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO 転送</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>データ読み込み</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>データ書き込み</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>データ送信</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>データ受信</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>利用不可</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>ランタイム属性</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>画面解像度</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">CD/DVD 統計</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">ネットワークアダプター統計</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">バージョン %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>未検出</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>未検出</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>クリップボードモード</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">ドラッグ&ドロップモード</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Guest Additions</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>ゲストOSのタイプ</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">ハードディスク統計</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">ハードディスクなし</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>ネットワークアダプターなし</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">有効</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">無効</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">ネステッドページング</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">ネステッドページング</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">有効</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">無効</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>設定の詳細(&D)</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>ランタイム情報(&R)</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">利用不可</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>ストレージ統計</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>ストレージデバイス なし</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>ネットワーク 統計</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation>VM アップデート</translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation>ドラッグ&ドロップモード</translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
-        <location filename="../src/selector/UIVMItem.cpp" line="164"/>
-        <location filename="../src/selector/UIVMItem.cpp" line="176"/>
-        <location filename="../src/selector/graphics/details/UIGMachinePreview.cpp" line="124"/>
         <source>Inaccessible</source>
         <translation>アクセスできません</translation>
     </message>
     <message>
-        <location filename="../src/selector/UIVMItem.cpp" line="192"/>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
         <comment>VM tooltip (name, last state change, session state)</comment>
         <translation><nobr>%1<br></nobr><nobr>%3からの状態 %2</nobr><br><nobr>セッション %4</nobr></translation>
     </message>
     <message>
-        <location filename="../src/selector/UIVMItem.cpp" line="204"/>
         <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
         <comment>Inaccessible VM tooltip (name, last state change)</comment>
         <translation><nobr><b>%1</b><br></nobr><nobr>%2からの状態 アクセスできません</nobr></translation>
@@ -11377,83 +11048,66 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIVMLogViewer</name>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="172"/>
         <source>Close the search panel</source>
         <translation>検索パネルを閉じる</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="174"/>
-        <location filename="../src/UIVMLogViewer.cpp" line="546"/>
         <source>&Find</source>
         <translation>検索(&F)</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="175"/>
         <source>Enter a search string here</source>
         <translation>検索する文字列をここに入力</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="177"/>
         <source>&Previous</source>
         <translation>前へ(&P)</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="178"/>
         <source>Search for the previous occurrence of the string</source>
         <translation>前の文字列を検索</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="179"/>
         <source>&Next</source>
         <translation>次へ(&N)</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="180"/>
         <source>Search for the next occurrence of the string</source>
         <translation>次の文字列を検索</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="182"/>
         <source>C&ase Sensitive</source>
         <translation>大文字と小文字を区別(&A)</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="183"/>
         <source>Perform case sensitive search (when checked)</source>
         <translation>大文字小文字を区別して検索(チェックを入れた場合)</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="185"/>
         <source>String not found</source>
         <translation>文字列が見つかりません</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="496"/>
         <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
         <translation><p>ログファイルが見つかりません。<b>[最新の情報に更新]</b>ボタンをクリックしてログフォルダー<nobr><b>"%1"</b></nobr>を再スキャンしてください。</p></translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="529"/>
         <source>Save VirtualBox Log As</source>
         <translation>名前をつけてVirtualBoxのログを保存</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="543"/>
         <source>%1 - VirtualBox Log Viewer</source>
         <translation>%1 -VirtualBox ログビューアー</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="547"/>
         <source>&Refresh</source>
         <translation>最新の情報に更新(&R)</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="548"/>
         <source>&Save</source>
         <translation>保存(&S)</translation>
     </message>
     <message>
-        <location filename="../src/UIVMLogViewer.cpp" line="549"/>
         <source>Close</source>
         <translation>閉じる</translation>
     </message>
@@ -11492,138 +11146,122 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIWizard</name>
     <message>
-        <location filename="../src/wizards/UIWizard.cpp" line="123"/>
         <source>Hide Description</source>
-        <translation>説明を隠す</translation>
+        <translation type="obsolete">説明を隠す</translation>
     </message>
     <message>
-        <location filename="../src/wizards/UIWizard.cpp" line="124"/>
         <source>Show Description</source>
-        <translation>説明を表示</translation>
+        <translation type="obsolete">説明を表示</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation>エキスパートモード(&E)</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation><nobr><b>エキスパートモード</b></nobr> に切り替え: 経験者向けに1ページにまとめて表示します。.</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>ガイド付きモード(&G)</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation><nobr><b>ガイド付きモード</b></nobr> に切り替え: 詳細な解説付きでひとつひとつダイアログを表示します。</translation>
     </message>
 </context>
 <context>
     <name>UIWizardCloneVD</name>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVD.cpp" line="114"/>
         <source>Copy Virtual Hard Drive</source>
         <translation>仮想ハードドライブをコピー</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVD.cpp" line="115"/>
         <source>Copy</source>
         <translation>コピー</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp" line="110"/>
         <source>Hard drive to copy</source>
         <translation>コピーするハードドライブ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp" line="113"/>
         <source><p>Please select the virtual hard drive file that you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select one.</p></source>
         <translation><p>選択していない場合、コピーしたい仮想ハードドライブのファイルを選択してください。リストから選択するか、リストの横にあるフォルダーアイコンからも選択できます。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp" line="116"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="228"/>
         <source>Choose a virtual hard drive file to copy...</source>
         <translation>コピーする仮想ハードドライブのファイルを選択...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp" line="130"/>
         <source>Hard drive file type</source>
         <translation>ハードドライブのファイルタイプ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp" line="133"/>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
         <translation>新しい仮想ハードドライブで使用したいファイルのタイプを選択してください。もしほかの仮想ソフトウェアで使用する必要がなければ、設定はそのままにしておいてください。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="121"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="238"/>
         <source>Storage on physical hard drive</source>
         <translation>物理ハードドライブにあるストレージ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="124"/>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
         <translation>新しい仮想ハードドライブファイルは使用したぶんだけ大きくなるか(可変サイズ)、または最大サイズで作成するか(固定サイズ)を選択してください。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="126"/>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
         <translation><p><b>可変サイズ</b>のハードドライブファイルは使用した分だけ(<b>固定サイズ</b>を上限として)領域を消費しますが、スペースを開放しても自動的に縮小はしません。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="129"/>
         <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
         <translation><p><b>固定サイズ</b>のハードドライブファイルはシステムによっては作成に時間がかかるかもしれませんが、使用すると高速です</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="131"/>
         <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
         <translation><p>ハードドライブファイルを2GBごとに<b>分割</b>することもできます。仮想マシンをリムーバブルUSBデバイスに作成したい場合や、非常に大きなファイルを扱うことができない古いシステムで便利でしょう。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="135"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="239"/>
         <source>&Dynamically allocated</source>
         <translation>可変サイズ(&D)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="136"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="240"/>
         <source>&Fixed size</source>
         <translation>固定サイズ(&F)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp" line="137"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="241"/>
         <source>&Split into files of less than 2GB</source>
         <translation>2GB以下にファイルを分割(&S)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp" line="82"/>
         <source>Please choose a location for new virtual hard drive file</source>
         <translation>新しい仮想ハードドライブファイルの場所を選択</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp" line="196"/>
         <source>New hard drive to create</source>
         <translation>作成する新しいハードドライブ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp" line="199"/>
         <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
         <translation>新しい仮想ハードドライブファイルの名前を下のボックスに入力するか、フォルダーアイコンをクリックしてファイルを作成する別のフォルダーを選択してください。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp" line="201"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="230"/>
         <source>Choose a location for new virtual hard drive file...</source>
         <translation>新しい仮想ハードドライブファイルの場所を選択...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp" line="216"/>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="170"/>
         <source>%1_copy</source>
         <comment>copied virtual hard drive name</comment>
         <translation>%1_コピー</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="227"/>
         <source>Hard drive to &copy</source>
         <translation>コピーするハードドライブ(&C)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="229"/>
         <source>&New hard drive to create</source>
         <translation>作成する新しいハードドライブ(&N)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp" line="231"/>
         <source>Hard drive file &type</source>
         <translation>ハードドライブのファイルタイプ(&T)</translation>
     </message>
@@ -11631,130 +11269,98 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIWizardCloneVM</name>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVM.cpp" line="80"/>
         <source>Linked Base for %1 and %2</source>
         <translation>%1 と %2 を基準にリンクする</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVM.cpp" line="165"/>
         <source>Clone Virtual Machine</source>
         <translation>仮想マシンのクローン</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVM.cpp" line="166"/>
         <source>Clone</source>
         <translation>クローン</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp" line="59"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="48"/>
         <source>%1 Clone</source>
         <translation>%1 のクローン</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp" line="79"/>
         <source>New machine name</source>
         <translation>新しいマシン名</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp" line="82"/>
         <source><p>Please choose a name for the new virtual machine. The new machine will be a clone of the machine <b>%1</b>.</p></source>
-        <translation><p>新しい仮想マシンの名前を選択してください。新し仮想マシンは <b>%1</b> のクローンになるでしょう。</p></translation>
+        <translation><p>新しい仮想マシンの名前を選択してください。新しい仮想マシンは <b>%1</b> のクローンになるでしょう。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp" line="85"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="129"/>
         <source>When checked a new unique MAC address will be assigned to all configured network cards.</source>
         <translation>新しい一意のMACアドレスがすべての設定してあるネットワークカードに付与されます。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp" line="86"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="130"/>
         <source>&Reinitialize the MAC address of all network cards</source>
         <translation>すべてのネットワークカードのMACアドレスを再初期化(&R)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp" line="88"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="122"/>
         <source>Clone type</source>
         <translation>クローンのタイプ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp" line="91"/>
         <source><p>Please choose the type of clone you wish to create.</p><p>If you choose <b>Full clone</b>, an exact copy (including all virtual hard drive files) of the original virtual machine will be created.</p><p>If you choose <b>Linked clone</b>, a new machine will be created, but the virtual hard drive files will be tied to the virtual hard drive files of original machine and you will not be able to move the new virtual machi [...]
         <translation><p>作成したいクローンのタイプを選択してください。</p><p><b>すべてをクローン</b>を選択すると、元の仮想マシンのコピー(すべての仮想ハードドライブファイルを含む)を抽出して作成します。</p><p><b>リンクしたクローン</b>を選択すると、新しいマシンを作成しますが、仮想ハードドライブファイルは元のマシンに紐づき、元のファイルも同様に移動しないと新しい仮想マシンから異なったコンピューターに移動することができません。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp" line="101"/>
         <source><p>If you create a <b>Linked clone</b> then a new snapshot will be created in the original virtual machine as part of the cloning process.</p></source>
         <translation><p><b>リンクしたクローン</b>にすると、新しいスナップショットはクローンプロセスの一部分として元の仮想マシンに作成されます。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp" line="105"/>
         <source>&Full clone</source>
         <translation>すべてをクローン(&F)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp" line="106"/>
         <source>&Linked clone</source>
         <translation>リンクしたクローン(&L)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="90"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="125"/>
         <source>Snapshots</source>
         <translation>スナップショット</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="93"/>
         <source><p>Please choose which parts of the snapshot tree should be cloned with the machine.</p></source>
         <translation><p>スナップショットツリーのどの部分をクローンするか選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="95"/>
         <source><p>If you choose <b>Current machine state</b>, the new machine will reflect the current state of the original machine and will have no snapshots.</p></source>
         <translation><p><b>現在のマシンの状態</b>を選択すると、元のマシンの現在の状態かつスナップショットがない状態が反映されます。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="98"/>
         <source><p>If you choose <b>Current snapshot tree branch</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the tree branch starting at the current state in the original machine.</p></source>
         <translation><p><b>現在のスナップショットツリーのブランチ</b>を選択すると、</p>新しいマシンは元のマシンの現在の状態と、元のマシンの現在の状態から開始するすべてのスナップショットのツリーブランチを反映します。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="103"/>
         <source><p>If you choose <b>Everything</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the original machine.</p></source>
         <translation><p><b>すべて</b>を選択すると、新しいマシンは元のマシンの現在の状態と、元のマシンのすべてのスナップショットを反映します。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="119"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="126"/>
         <source>Current &machine state</source>
         <translation>現在のマシンの状態(&M)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="120"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="127"/>
         <source>Current &snapshot tree branch</source>
         <translation>現在のスナップショットのツリーブランチ(&S)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp" line="121"/>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="128"/>
         <source>&Everything</source>
         <translation>すべて(&E)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="121"/>
         <source>New machine &name</source>
         <translation>新しいマシン名(&N)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="123"/>
         <source>&Full Clone</source>
         <translation>すべてをクローン(&F)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp" line="124"/>
         <source>&Linked Clone</source>
         <translation>リンクしたクローン(&L)</translation>
     </message>
@@ -11762,134 +11368,98 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIWizardExportApp</name>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportApp.cpp" line="88"/>
         <source>Checking files ...</source>
         <translation>ファイルを確認中...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportApp.cpp" line="110"/>
         <source>Removing files ...</source>
         <translation>ファイルを除去中...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportApp.cpp" line="149"/>
         <source>Exporting Appliance ...</source>
         <translation>仮想アプライアンスのエクスポート...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportApp.cpp" line="241"/>
         <source>Export Virtual Appliance</source>
         <translation>仮想アプライアンスのエクスポート</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportApp.cpp" line="242"/>
         <source>Restore Defaults</source>
         <translation>デフォルト値に戻す</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportApp.cpp" line="243"/>
         <source>Export</source>
         <translation>エクスポート</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp" line="134"/>
         <source>Virtual machines to export</source>
         <translation>エクスポートする仮想マシン</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp" line="137"/>
         <source><p>Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.</p></source>
         <translation><p>アプライアンスに追加する仮想マシンを選択してください。複数の仮想マシンを選択できます。それらのマシンはエクスポートする前に電源オフにしている必要があります。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp" line="115"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp" line="105"/>
         <source>Appliance settings</source>
         <translation>アプライアンスの設定</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp" line="118"/>
         <source>Please choose where to create the virtual appliance. You can create it on your own computer, on the Sun Cloud service or on an S3 storage server.</source>
         <translation>仮想アプライアンスをどこに作成するか選択してください。自分のコンピューター、Sun クラウドサービス、またはS3 ストレージサーバーに作成できます。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp" line="121"/>
         <source>Create on</source>
         <translation>作成場所</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp" line="122"/>
         <source>&This computer</source>
         <translation>このコンピューター(&T)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp" line="123"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="223"/>
         <source>Sun &Cloud</source>
         <translation>Sun Cloud(&C)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp" line="124"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="224"/>
         <source>&Simple Storage System (S3)</source>
         <translation>Simple Storage System (S3)(&S)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="298"/>
         <source>Storage settings</source>
         <translation>ストレージの設定</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="301"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="216"/>
         <source>Appliance</source>
         <translation>仮想アプライアンス</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="303"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="225"/>
         <source>&Username:</source>
         <translation>ユーザー名(&U):</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="304"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="226"/>
         <source>&Password:</source>
         <translation>パスワード(&P):</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="305"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="227"/>
         <source>&Hostname:</source>
         <translation>ホスト名(&H):</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="306"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="228"/>
         <source>&Bucket:</source>
         <translation>バケット名(&B):</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="307"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="229"/>
         <source>&File:</source>
         <translation>ファイル(&F):</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="309"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="231"/>
         <source>Please choose a file to export the virtual appliance to</source>
         <translation>エクスポートする仮想アプライアンスのファイルを選択してください</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="318"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="240"/>
         <source>Write in standard OVF 1.0 format.</source>
         <translation>標準のOVF 1.0フォーマットで書き出します。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="319"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="241"/>
         <source>Write in new experimental OVF 2.0 format.</source>
         <translation>新しく実験的なOVF 2.0フォーマットで書き出します。</translation>
     </message>
@@ -11898,44 +11468,30 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">仮想アプライアンスファイルを選択してください</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="310"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="232"/>
         <source>Open Virtualization Format Archive (%1)</source>
         <translation>Open Virtualization Format Archive (%1)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="311"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="233"/>
         <source>Open Virtualization Format (%1)</source>
         <translation>Open Virtualization Format (%1)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="312"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="234"/>
         <source>F&ormat:</source>
         <translation>フォーマット(&O):</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="313"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="235"/>
         <source>OVF 0.9</source>
         <translation>OVF 0.9</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="314"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="236"/>
         <source>OVF 1.0</source>
         <translation>OVF 1.0</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="315"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="237"/>
         <source>OVF 2.0</source>
         <translation>OVF 2.0</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="316"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="238"/>
         <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
         <translation>ほかの仮想プロダクトとの互換性のため、古いOVF 0.9フォーマットで書き込みます。</translation>
     </message>
@@ -11944,44 +11500,34 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">古いOVF 0.9形式で書き込み(&W)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="320"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="242"/>
         <source>Create a Manifest file for automatic data integrity checks on import.</source>
         <translation>インポート時にデータ完全性を自動チェックするためのマニフェストファイルを作成します。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="321"/>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="243"/>
         <source>Write &Manifest file</source>
         <translation>マニフェストファイルの書き込み(&M)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp" line="108"/>
         <source>This is the descriptive information which will be added to the virtual appliance.  You can change it by double clicking on individual lines.</source>
         <translation>これは仮想アプライアンスに追加する詳細な情報です。各行をダブルクリックすることによって変更できます。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="218"/>
         <source>Virtual &machines to export</source>
         <translation>エクスポートする仮想マシン(&M)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="219"/>
         <source>Appliance &settings</source>
         <translation>アプライアンスの設定(&S)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="220"/>
         <source>&Destination</source>
         <translation>保存場所(&D)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="221"/>
         <source>&Storage settings</source>
         <translation>ストレージの設定(&S)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="222"/>
         <source>&Local Filesystem </source>
         <translation>ローカルファイルシステム(&L)</translation>
     </message>
@@ -11989,22 +11535,18 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIWizardExportAppPageBasic3</name>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="308"/>
         <source>Choose a file to export the virtual appliance to...</source>
         <translation>エクスポートする仮想アプライアンスのファイルを選択...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="381"/>
         <source><p>Please choose a filename to export the OVF/OVA to.</p><p>If you use an <i>ova</i> extension, then all the files will be combined into one Open Virtualization Format Archive.</p><p>If you use an <i>ovf</i> extension, several files will be written separately.</p><p>Other extensions are not allowed.</p></source>
         <translation><p>エクスポートするOVF/OVAファイルの名前を選択してください。拡張子<i>ova</i>を選択するとすべてのファイルはOpen Virtualization Format Archive形式に結合されます。拡張子<i>ovf</i>を選択すると複数のファイルに保存されます。他の拡張子は利用できません。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="392"/>
         <source>Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.</source>
         <translation>ユーザー名、パスワードおよびバケット名などの追加フィールドをすべて指定してください。最後にOVFターゲットのファイル名を指定しなければなりません。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp" line="399"/>
         <source>Please complete the additional fields like the username, password, hostname and the bucket, and provide a filename for the OVF target.</source>
         <translation>ユーザー名、パスワード、ホスト名およびバケット名などの追加フィールドをすべて指定してください。最後にOVFターゲットのファイル名を指定しなければなりません。</translation>
     </message>
@@ -12012,7 +11554,6 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
-        <location filename="../src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp" line="230"/>
         <source>Choose a file to export the virtual appliance to...</source>
         <translation>エクスポートする仮想アプライアンスのファイルを選択...</translation>
     </message>
@@ -12020,27 +11561,22 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIWizardFirstRun</name>
     <message>
-        <location filename="../src/wizards/firstrun/UIWizardFirstRun.cpp" line="96"/>
         <source>Select start-up disk</source>
         <translation>起動ハードディスクを選択</translation>
     </message>
     <message>
-        <location filename="../src/wizards/firstrun/UIWizardFirstRun.cpp" line="97"/>
         <source>Start</source>
         <translation>起動</translation>
     </message>
     <message>
-        <location filename="../src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp" line="108"/>
         <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from and should contain the operating system you wish to install on the virtual machine if you want to do that now. The disk will be ejected from the virtual drive automatically next time you switch the virtual machine off, but you can also do this yourself if needed u [...]
         <translation><p>開始したい新しい仮想マシンを含むディスクのある、仮想光学ディスクファイルか、ディスクが挿入されている物理光学ドライブを選択してください。</p><p>このディスクはコンピューターを起動することができ、仮想マシンにインストールしたいオペレーティングシステムを含んでいなければなりません。このディスクは仮想マシンをオフにした次の回に自動的に取り出されますが、必要であればデバイスメニューから取り出すこともできます。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp" line="118"/>
         <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from. As this virtual machine has no hard drive you will not be able to install an operating system on it at the moment.</p></source>
         <translation><p>開始したい新しい仮想マシンを含むディスクのある、仮想光学ディスクファイルか、ディスクが挿入されている物理光学ドライブを選択してください。</p><p>そのディスクはコンピューターを起動できるものである必要があります。この仮想マシンにはハードドライブがないので、即座にオペレーティングシステムをインストールすることはできません。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp" line="124"/>
         <source>Choose a virtual optical disk file...</source>
         <translation>仮想光学ディスクファイルの選択...</translation>
     </message>
@@ -12052,40 +11588,30 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">仮想アプライアンスのインポート</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="212"/>
         <source>Import Virtual Appliance</source>
         <translation>仮想アプライアンスのインポート</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="213"/>
         <source>Restore Defaults</source>
         <translation>デフォルト値に戻す</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportApp.cpp" line="214"/>
         <source>Import</source>
         <translation>インポート</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp" line="61"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="96"/>
         <source>Appliance to import</source>
         <translation>インポートしたいアプライアンス</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp" line="64"/>
         <source><p>VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below.</p></source>
         <translation><p>VirtualBoxは今のところOpen Virtualizasion Format (OVF)で保存された仮想アプライアンスのインポートだけをサポートしています。継続するには、下のインポートしたいファイルを選択してください。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp" line="67"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="97"/>
         <source>Choose a virtual appliance file to import...</source>
         <translation>インポートする仮想アプライアンスのファイルを選択...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp" line="68"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="98"/>
         <source>Please choose a virtual appliance file to import</source>
         <translation>インポートする仮想アプライアンスのファイルを選択してください</translation>
     </message>
@@ -12098,19 +11624,14 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">インポートする仮想アプライアンスを選択</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp" line="69"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="99"/>
         <source>Open Virtualization Format (%1)</source>
         <translation>Open Virtualization Format (%1)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp" line="56"/>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageExpert.cpp" line="100"/>
         <source>Appliance settings</source>
         <translation>アプライアンスの設定</translation>
     </message>
     <message>
-        <location filename="../src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp" line="59"/>
         <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
         <translation>VirtualBoxにインポートする仮想アプライアンス情報で記載された仮想マシン構成です。項目をダブルクリックすると、表示されているプロパティの大部分を変更できます。また、以下のチェックボックスを使用して他のプロパティを無効にすることができます。</translation>
     </message>
@@ -12118,107 +11639,82 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIWizardNewVD</name>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVD.cpp" line="118"/>
         <source>Create Virtual Hard Drive</source>
         <translation>仮想ハードドライブの作成</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVD.cpp" line="119"/>
         <source>Create</source>
         <translation>作成</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic1.cpp" line="129"/>
         <source>Hard drive file type</source>
         <translation>ハードドライブのファイルタイプ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic1.cpp" line="132"/>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
         <translation>新しい仮想ハードドライブで使用したいファイルのタイプを選択してください。もしほかの仮想ソフトウェアで使用する必要がなければ、設定はそのままにしておいてください。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="121"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="253"/>
         <source>Storage on physical hard drive</source>
         <translation>物理ハードドライブにあるストレージ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="124"/>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
         <translation>新しい仮想ハードドライブファイルは使用したぶんだけ大きくなるか(可変サイズ)、または最大サイズで作成するか(固定サイズ)を選択してください。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="126"/>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
         <translation><p><b>可変サイズ</b>のハードドライブファイルは使用した分だけ(<b>固定サイズ</b>を上限として)領域を消費しますが、スペースを開放しても自動的に縮小はしません。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="129"/>
         <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
         <translation><p><b>固定サイズ</b>のハードドライブファイルはシステムによっては作成に時間がかかるかもしれませんが、使用すると高速です</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="131"/>
         <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
         <translation><p>ハードドライブファイルを2GBごとに<b>分割</b>することもできます。仮想マシンをリムーバブルUSBデバイスに作成したい場合や、非常に大きなファイルを扱うことができない古いシステムで便利でしょう。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="135"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="254"/>
         <source>&Dynamically allocated</source>
         <translation>可変サイズ(&D)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="136"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="255"/>
         <source>&Fixed size</source>
         <translation>固定サイズ(&F)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic2.cpp" line="137"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="256"/>
         <source>&Split into files of less than 2GB</source>
         <translation>2GB以下でファイルを分割(&S)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp" line="231"/>
         <source><nobr>%1 (%2 B)</nobr></source>
         <translation><nobr>%1 (%2 B)</nobr></translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp" line="362"/>
         <source>File location and size</source>
         <translation>ファイルの場所とサイズ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp" line="365"/>
         <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
         <translation>新しい仮想ハードドライブファイルの名前を下のボックスに入力するか、フォルダーアイコンをクリックしてファイルを作成する別のフォルダーを選択してください。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp" line="367"/>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="244"/>
         <source>Choose a location for new virtual hard drive file...</source>
         <translation>新しい仮想ハードドライブファイルの場所を選択...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp" line="368"/>
         <source>Select the size of the virtual hard drive in megabytes. This size is the limit on the amount of file data that a virtual machine will be able to store on the hard drive.</source>
         <translation>仮想ハードドライブのサイズをメガバイト単位で指定してください。このサイズは仮想マシンがハードドライブに置くことができるファイルデータの上限です。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="243"/>
         <source>File &location</source>
         <translation>ファイルの場所(&L)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="245"/>
         <source>File &size</source>
         <translation>ファイルサイズ(&S)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageExpert.cpp" line="246"/>
         <source>Hard drive file &type</source>
         <translation>ハードドライブのファイルタイプ(&T)</translation>
     </message>
@@ -12226,12 +11722,10 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>UIWizardNewVM</name>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVM.cpp" line="276"/>
         <source>Create Virtual Machine</source>
         <translation>仮想マシンの作成</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVM.cpp" line="277"/>
         <source>Create</source>
         <translation>作成</translation>
     </message>
@@ -12256,52 +11750,38 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">SAS コントローラー</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic1.cpp" line="291"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="222"/>
         <source>Name and operating system</source>
         <translation>名前とオペレーティングシステム</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic1.cpp" line="294"/>
         <source>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</source>
         <translation>新しい仮想マシンの記述名を指定し、インストールするオペレーティングシステムのタイプを選択してください。入力した名前はVirtualBoxでこのマシンを特定するのに使われます。</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic2.cpp" line="127"/>
         <source>Memory size</source>
         <translation>メモリーサイズ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic2.cpp" line="132"/>
         <source><p>Select the amount of memory (RAM) in megabytes to be allocated to the virtual machine.</p><p>The recommended memory size is <b>%1</b> MB.</p></source>
         <translation><p>この仮想マシンに割り当てるメモリー(RAM)の容量をメガバイト単位で選択してください。</p><p>必要なメモリーサイズは<b>%1</b>MBです。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp" line="198"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="227"/>
         <source>Hard drive</source>
         <translation>ハードドライブ</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp" line="203"/>
         <source><p>If you wish you can add a virtual hard drive to the new machine. You can either create a new hard drive file or select one from the list or from another location using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step and make the changes to the machine settings once the machine is created.</p><p>The recommended size of the hard drive is <b>%1</b>.</p></source>
         <translation><p>新しいマシンに仮想ハードドライブを割り当てることができます。その場合は新しいハードドライブファイルを作成するか、リストから選択またはフォルダーアイコンを使用してほかの場所から指定できます。</p><p>複雑なストレージの設定をする場合は、このステップをスキップしてマシンを一度作成してからマシン設定で変更を加えてください。</p><p>必要なハードドライブのサイズは<b>%1</b>です。</p></translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp" line="210"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="228"/>
         <source>&Do not add a virtual hard drive</source>
         <translation>仮想ハードドライブを追加しない(&D)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp" line="211"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="229"/>
         <source>&Create a virtual hard drive now</source>
         <translation>仮想ハードドライブを作成する(&C)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp" line="212"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="230"/>
         <source>&Use an existing virtual hard drive file</source>
         <translation>すでにある仮想ハードドライブファイルを使用する(&U)</translation>
     </message>
@@ -12318,13 +11798,10 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete">すでにある仮想ハードドライブファイルを使用する(&U)</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic3.cpp" line="213"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="231"/>
         <source>Choose a virtual hard drive file...</source>
         <translation>仮想ハードドライブファイルを選択...</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="223"/>
         <source>&Memory size</source>
         <translation>メモリーサイズ(&M)</translation>
     </message>
@@ -12332,7 +11809,6 @@ step and attach hard disks later using the VM Settings dialog.</p></source
 <context>
     <name>VBoxAboutDlg</name>
     <message>
-        <location filename="../src/VBoxAboutDlg.cpp" line="104"/>
         <source>VirtualBox - About</source>
         <translation>VirtualBox について</translation>
     </message>
@@ -12346,12 +11822,10 @@ step and attach hard disks later using the VM Settings dialog.</p></source
         <translation type="obsolete"><qt>VirtualBox グラフィカルユーザーインターフェース バージョン %1<br>%2</qt></translation>
     </message>
     <message>
-        <location filename="../src/VBoxAboutDlg.cpp" line="105"/>
         <source>VirtualBox Graphical User Interface</source>
         <translation>VirtualBox グラフィカルユーザーインターフェース</translation>
     </message>
     <message>
-        <location filename="../src/VBoxAboutDlg.cpp" line="118"/>
         <source>Version %1</source>
         <translation>バージョン %1</translation>
     </message>
@@ -12945,7 +12419,7 @@ Version %1</source>
         <translation type="obsolete">セッション情報ダイアログ(&N)</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">セッション情報ダイアログを表示</translation>
     </message>
     <message>
@@ -13416,7 +12890,6 @@ Version %1</source>
         <translation type="obsolete">選択(&C)...</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="725"/>
         <source>Choose...</source>
         <translation>選択...</translation>
     </message>
@@ -13424,7 +12897,6 @@ Version %1</source>
 <context>
     <name>VBoxFilePathSelectorWidget</name>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="283"/>
         <source><reset to default></source>
         <translation><デフォルトに戻す></translation>
     </message>
@@ -13433,62 +12905,50 @@ Version %1</source>
         <translation type="obsolete">変更後、再度このダイアログを開くとデフォルトパスが表示されます。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="284"/>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>変更後、再度このダイアログを開くとデフォルトパスが表示されます。</translation>
+        <translation>変更後、再度このウィンドウを開くとデフォルトパスが表示されます。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="289"/>
         <source><not selected></source>
         <translation><選択されていません></translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="290"/>
         <source>Please use the <b>Other...</b> item from the drop-down list to select a path.</source>
         <translation>ドロップダウンリストから<b>[その他...]</b>を実行して、使用するパスを選択してください。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="303"/>
         <source>Other...</source>
         <translation>その他...</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="307"/>
         <source>Reset</source>
         <translation>リセット</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="314"/>
         <source>Opens a window to select a different folder.</source>
         <translation>他のフォルダーを選択するウィンドウを開きます。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="317"/>
         <source>Resets the folder path to the default value.</source>
         <translation>フォルダーパスの値をデフォルトに戻します。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="323"/>
         <source>Opens a window to select a different file.</source>
         <translation>他のファイルを選択するウィンドウを開きます。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="326"/>
         <source>Resets the file path to the default value.</source>
         <translation>ファイルパスの値をデフォルトに戻します。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="334"/>
         <source>&Copy</source>
         <translation>コピー(&C)</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="509"/>
         <source>Please type the folder path here.</source>
         <translation>ここに使用するフォルダーのパスを入力してください。</translation>
     </message>
     <message>
-        <location filename="../src/widgets/VBoxFilePathSelectorWidget.cpp" line="510"/>
         <source>Please type the file path here.</source>
         <translation>ここに使用するファイルパスを入力してください。</translation>
     </message>
@@ -13559,43 +13019,36 @@ Version %1</source>
         <translation type="obsolete">差分</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="892"/>
         <source>Unknown device %1:%2</source>
         <comment>USB device details</comment>
         <translation>不明なデバイス %1:%2</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="917"/>
         <source><nobr>Vendor ID: %1</nobr><br><nobr>Product ID: %2</nobr><br><nobr>Revision: %3</nobr></source>
         <comment>USB device tooltip</comment>
         <translation><nobr>ベンダーID: %1</nobr><br><nobr>プロダクトID: %2</nobr><br><nobr>リビジョン: %3</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="926"/>
         <source><br><nobr>Serial No. %1</nobr></source>
         <comment>USB device tooltip</comment>
         <translation><br><nobr>シリアルNo. %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="933"/>
         <source><br><nobr>State: %1</nobr></source>
         <comment>USB device tooltip</comment>
         <translation><br><nobr>状態: %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1044"/>
         <source>Name</source>
         <comment>details report</comment>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1046"/>
         <source>OS Type</source>
         <comment>details report</comment>
         <translation>OSタイプ</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1116"/>
         <source>Base Memory</source>
         <comment>details report</comment>
         <translation>メインメモリー</translation>
@@ -13606,13 +13059,11 @@ Version %1</source>
         <translation type="obsolete"><nobr>%3 MB</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1053"/>
         <source>General</source>
         <comment>details report</comment>
         <translation>一般</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1152"/>
         <source>Video Memory</source>
         <comment>details report</comment>
         <translation>ビデオメモリー</translation>
@@ -13623,19 +13074,16 @@ Version %1</source>
         <translation type="obsolete"><nobr>%4 MB</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1125"/>
         <source>Boot Order</source>
         <comment>details report</comment>
         <translation>起動順序</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1127"/>
         <source>ACPI</source>
         <comment>details report</comment>
         <translation>ACPI</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1128"/>
         <source>I/O APIC</source>
         <comment>details report</comment>
         <translation>I/O APIC</translation>
@@ -13651,25 +13099,21 @@ Version %1</source>
         <translation type="obsolete">ハードディスク</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1084"/>
         <source>Enabled</source>
         <comment>details report (ACPI)</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1085"/>
         <source>Disabled</source>
         <comment>details report (ACPI)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1089"/>
         <source>Enabled</source>
         <comment>details report (I/O APIC)</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1090"/>
         <source>Disabled</source>
         <comment>details report (I/O APIC)</comment>
         <translation>無効</translation>
@@ -13715,50 +13159,41 @@ Version %1</source>
         <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1294"/>
         <source>Disabled</source>
         <comment>details report (audio)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1300"/>
         <source>Audio</source>
         <comment>details report</comment>
         <translation>オーディオ</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="695"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1340"/>
         <source>Adapter %1</source>
         <comment>details report (network)</comment>
         <translation>アダプター %1</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1349"/>
         <source>Disabled</source>
         <comment>details report (network)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1357"/>
         <source>Network</source>
         <comment>details report</comment>
         <translation>ネットワーク</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1466"/>
         <source>Device Filters</source>
         <comment>details report (USB)</comment>
         <translation>デバイスフィルター</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1467"/>
         <source>%1 (%2 active)</source>
         <comment>details report (USB)</comment>
         <translation>%1 (%2 アクティブ)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1472"/>
         <source>Disabled</source>
         <comment>details report (USB)</comment>
         <translation>無効</translation>
@@ -13788,55 +13223,46 @@ Version %1</source>
         <translation type="obsolete">"URLを開く"はまだ実装されていません。</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="129"/>
         <source>Powered Off</source>
         <comment>MachineState</comment>
         <translation>電源オフ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="130"/>
         <source>Saved</source>
         <comment>MachineState</comment>
         <translation>保存</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="131"/>
         <source>Aborted</source>
         <comment>MachineState</comment>
         <translation>中断</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="133"/>
         <source>Running</source>
         <comment>MachineState</comment>
         <translation>実行中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="134"/>
         <source>Paused</source>
         <comment>MachineState</comment>
         <translation>一時停止</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="138"/>
         <source>Starting</source>
         <comment>MachineState</comment>
         <translation>起動中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="139"/>
         <source>Stopping</source>
         <comment>MachineState</comment>
         <translation>停止中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="140"/>
         <source>Saving</source>
         <comment>MachineState</comment>
         <translation>保存中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="141"/>
         <source>Restoring</source>
         <comment>MachineState</comment>
         <translation>復元中</translation>
@@ -13857,7 +13283,6 @@ Version %1</source>
         <translation type="obsolete">オープン</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="166"/>
         <source>Spawning</source>
         <comment>SessionState</comment>
         <translation>生成中</translation>
@@ -13868,31 +13293,26 @@ Version %1</source>
         <translation type="obsolete">閉鎖中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="178"/>
         <source>None</source>
         <comment>DeviceType</comment>
         <translation>なし</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="179"/>
         <source>Floppy</source>
         <comment>DeviceType</comment>
         <translation>フロッピー</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="180"/>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="181"/>
         <source>Hard Disk</source>
         <comment>DeviceType</comment>
         <translation>ハードディスク</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="182"/>
         <source>Network</source>
         <comment>DeviceType</comment>
         <translation>ネットワーク</translation>
@@ -13953,55 +13373,41 @@ Version %1</source>
         <translation type="obsolete">保持</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="380"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="544"/>
         <source>Null Audio Driver</source>
         <comment>AudioDriverType</comment>
         <translation>Null Audio Driver</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="381"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="545"/>
         <source>Windows Multimedia</source>
         <comment>AudioDriverType</comment>
         <translation>Windows マルチメディア</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="382"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="546"/>
         <source>OSS Audio Driver</source>
         <comment>AudioDriverType</comment>
         <translation>OSS オーディオドライバー</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="383"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="547"/>
         <source>ALSA Audio Driver</source>
         <comment>AudioDriverType</comment>
         <translation>ALSA オーディオドライバー</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="384"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="548"/>
         <source>Windows DirectSound</source>
         <comment>AudioDriverType</comment>
         <translation>Windows DirectSound</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="385"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="549"/>
         <source>CoreAudio</source>
         <comment>AudioDriverType</comment>
         <translation>CoreAudio</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="286"/>
         <source>Not attached</source>
         <comment>NetworkAttachmentType</comment>
         <translation>未割り当て</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="287"/>
         <source>NAT</source>
         <comment>NetworkAttachmentType</comment>
         <translation>NAT</translation>
@@ -14012,68 +13418,56 @@ Version %1</source>
         <translation type="obsolete">ホストインターフェース</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="289"/>
         <source>Internal Network</source>
         <comment>NetworkAttachmentType</comment>
         <translation>内部ネットワーク</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="291"/>
         <source>Generic Driver</source>
         <comment>NetworkAttachmentType</comment>
         <translation>汎用ドライバー</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="447"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="599"/>
         <source>LsiLogic SAS</source>
         <comment>StorageControllerType</comment>
         <translation>LsiLogic SAS</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="352"/>
         <source>Not supported</source>
         <comment>USBDeviceState</comment>
         <translation>未サポート</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="225"/>
         <source>USB Tablet</source>
         <comment>PointingHIDType</comment>
         <translation>USBタブレット</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="227"/>
         <source>USB Multi-Touch Tablet</source>
         <comment>PointingHIDType</comment>
         <translation>USB マルチタッチタブレット</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="353"/>
         <source>Unavailable</source>
         <comment>USBDeviceState</comment>
         <translation>利用不可</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="354"/>
         <source>Busy</source>
         <comment>USBDeviceState</comment>
         <translation>ビジー</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="355"/>
         <source>Available</source>
         <comment>USBDeviceState</comment>
         <translation>利用可能</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="356"/>
         <source>Held</source>
         <comment>USBDeviceState</comment>
         <translation>保持</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="357"/>
         <source>Captured</source>
         <comment>USBDeviceState</comment>
         <translation>キャプチャー</translation>
@@ -14089,25 +13483,21 @@ Version %1</source>
         <translation type="obsolete"><i>アクセス不可</i></translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="195"/>
         <source>Disabled</source>
         <comment>ClipboardType</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="196"/>
         <source>Host To Guest</source>
         <comment>ClipboardType</comment>
         <translation>ホストOSからゲストOSへ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="197"/>
         <source>Guest To Host</source>
         <comment>ClipboardType</comment>
         <translation>ゲストOSからホストOSへ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="198"/>
         <source>Bidirectional</source>
         <comment>ClipboardType</comment>
         <translation>双方向</translation>
@@ -14121,31 +13511,26 @@ Version %1</source>
         <translation type="obsolete">ファイルを選択</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1385"/>
         <source>Port %1</source>
         <comment>details report (serial ports)</comment>
         <translation>ポート %1</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1394"/>
         <source>Disabled</source>
         <comment>details report (serial ports)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1402"/>
         <source>Serial Ports</source>
         <comment>details report</comment>
         <translation>シリアルポート</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1478"/>
         <source>USB</source>
         <comment>details report</comment>
         <translation>USB</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1491"/>
         <source>Shared Folders</source>
         <comment>details report (shared folders)</comment>
         <translation>共有フォルダー</translation>
@@ -14156,13 +13541,11 @@ Version %1</source>
         <translation type="obsolete">%1</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1496"/>
         <source>None</source>
         <comment>details report (shared folders)</comment>
         <translation>なし</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1502"/>
         <source>Shared Folders</source>
         <comment>details report</comment>
         <translation>共有フォルダー</translation>
@@ -14173,40 +13556,31 @@ Version %1</source>
         <translation type="obsolete">スタック</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="338"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="516"/>
         <source>Disconnected</source>
         <comment>PortMode</comment>
         <translation>切断</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="339"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="517"/>
         <source>Host Pipe</source>
         <comment>PortMode</comment>
         <translation>ホストにパイプ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="340"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="518"/>
         <source>Host Device</source>
         <comment>PortMode</comment>
         <translation>ホストデバイス</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="458"/>
         <source>PIIX3</source>
         <comment>ChipsetType</comment>
         <translation>PIIX3</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="459"/>
         <source>ICH9</source>
         <comment>ChipsetType</comment>
         <translation>ICH9</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1875"/>
         <source>User-defined</source>
         <comment>serial port</comment>
         <translation>ユーザー定義</translation>
@@ -14217,210 +13591,165 @@ Version %1</source>
         <translation type="obsolete">カスタム ハードディスク</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="526"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1134"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="687"/>
         <source>VT-x/AMD-V</source>
         <comment>details report</comment>
         <translation>VT-x/AMD-V</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1129"/>
         <source>PAE/NX</source>
         <comment>details report</comment>
         <translation>PAE/NX</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="484"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1102"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="665"/>
         <source>Enabled</source>
         <comment>details report (VT-x/AMD-V)</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="485"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1103"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="666"/>
         <source>Disabled</source>
         <comment>details report (VT-x/AMD-V)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="490"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="675"/>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>有効</translation>
+        <translation type="obsolete">有効</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="491"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="676"/>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>無効</translation>
+        <translation type="obsolete">無効</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="528"/>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translatorcomment>CPUのレジスタ名なのでそのまま</translatorcomment>
         <translation>Unrestricted Execution</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="531"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1190"/>
         <source>Remote Desktop Server Port</source>
         <comment>details report (VRDE Server)</comment>
         <translation>リモートデスクトップサーバーポート</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1094"/>
         <source>Enabled</source>
         <comment>details report (PAE/NX)</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1095"/>
         <source>Disabled</source>
         <comment>details report (PAE/NX)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1122"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="690"/>
         <source>Execution Cap</source>
         <comment>details report</comment>
         <translation>使用率制限</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1123"/>
         <source><nobr>%1%</nobr></source>
         <comment>details report</comment>
         <translation><nobr>%1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1287"/>
         <source>Host Driver</source>
         <comment>details report (audio)</comment>
         <translation>ホストドライバー</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1290"/>
         <source>Controller</source>
         <comment>details report (audio)</comment>
         <translation>コントローラー</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1331"/>
         <source>Generic, '%1'</source>
         <comment>details report (network)</comment>
         <translation>一般, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1334"/>
         <source>NAT network, '%1'</source>
         <comment>details report (network)</comment>
         <translation>NATネットワーク, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1423"/>
         <source>Port %1</source>
         <comment>details report (parallel ports)</comment>
         <translation>ポート %1</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1432"/>
         <source>Disabled</source>
         <comment>details report (parallel ports)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1441"/>
         <source>Parallel Ports</source>
         <comment>details report</comment>
         <translation>パラレルポート</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1634"/>
         <source>Please choose a virtual hard drive file</source>
         <translation>仮想ハードドライブファイルを選択してください</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1635"/>
         <source>All virtual hard drive files (%1)</source>
         <translation>すべての仮想ハードドライブファイル (%1)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1646"/>
         <source>Please choose a virtual optical disk file</source>
         <translation>仮想光学ディスクファイルを選択してください</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1647"/>
         <source>All virtual optical disk files (%1)</source>
         <translation>すべての仮想光学ディスクファイル (%1)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1658"/>
         <source>Please choose a virtual floppy disk file</source>
         <translation>仮想フロッピーディスクファイルを選択してください</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1659"/>
         <source>All virtual floppy disk files (%1)</source>
         <translation>すべての仮想フロッピーディスクファイル (%1)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="3322"/>
         <source>VDI (VirtualBox Disk Image)</source>
         <translation>VDI (VirtualBox Disk Image)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="3324"/>
         <source>VMDK (Virtual Machine Disk)</source>
         <translation>VMDK (Virtual Machine Disk)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="3326"/>
         <source>VHD (Virtual Hard Disk)</source>
         <translation>VHD (Virtual Hard Disk)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="3328"/>
         <source>HDD (Parallels Hard Disk)</source>
         <translation>HDD (Parallels Hard Disk)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="3330"/>
         <source>QED (QEMU enhanced disk)</source>
         <translation>QED (QEMU enhanced disk)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="3332"/>
         <source>QCOW (QEMU Copy-On-Write)</source>
         <translation>QCOW (QEMU Copy-On-Write)</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="183"/>
         <source>USB</source>
         <comment>DeviceType</comment>
         <translation>USB</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="184"/>
         <source>Shared Folder</source>
         <comment>DeviceType</comment>
         <translation>共有フォルダー</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="425"/>
         <source>IDE</source>
         <comment>StorageBus</comment>
         <translation>IDE</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="426"/>
         <source>SATA</source>
         <comment>StorageBus</comment>
         <translation>SATA</translation>
@@ -14456,47 +13785,36 @@ Version %1</source>
         <translation type="obsolete">VHD イメージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="388"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="552"/>
         <source>Solaris Audio</source>
         <comment>AudioDriverType</comment>
         <translation>Solaris オーディオ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="387"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="551"/>
         <source>PulseAudio</source>
         <comment>AudioDriverType</comment>
         <translation>PulseAudio</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="399"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="564"/>
         <source>ICH AC97</source>
         <comment>AudioControllerType</comment>
         <translation>ICH AC97</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="400"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="565"/>
         <source>SoundBlaster 16</source>
         <comment>AudioControllerType</comment>
         <translation>SoundBlaster 16</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="303"/>
         <source>PCnet-PCI II (Am79C970A)</source>
         <comment>NetworkAdapterType</comment>
         <translation>PCnet-PCI II (Am79C970A)</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="304"/>
         <source>PCnet-FAST III (Am79C973)</source>
         <comment>NetworkAdapterType</comment>
         <translation>PCnet-FAST III (Am79C973)</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="305"/>
         <source>Intel PRO/1000 MT Desktop (82540EM)</source>
         <comment>NetworkAdapterType</comment>
         <translation>Intel PRO/1000 MT Desktop (82540EM)</translation>
@@ -14512,55 +13830,46 @@ Version %1</source>
         <translation type="obsolete">PIIX4</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="306"/>
         <source>Intel PRO/1000 T Server (82543GC)</source>
         <comment>NetworkAdapterType</comment>
         <translation>Intel PRO/1000 T Server (82543GC)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="949"/>
         <source><nobr>Vendor ID: %1</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>ベンダーID: %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="954"/>
         <source><nobr>Product ID: %2</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>プロダクトID: %2</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="959"/>
         <source><nobr>Revision: %3</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>リビジョン: %3</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="964"/>
         <source><nobr>Product: %4</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>製品: %4</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="969"/>
         <source><nobr>Manufacturer: %5</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>メーカー: %5</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="974"/>
         <source><nobr>Serial No.: %1</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>シリアルNo.: %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="979"/>
         <source><nobr>Port: %1</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>ポート: %1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="986"/>
         <source><nobr>State: %1</nobr></source>
         <comment>USB filter tooltip</comment>
         <translation><nobr>状態: %1</nobr></translation>
@@ -14611,14 +13920,11 @@ Version %1</source>
         <translation type="obsolete"><hr><img src=%1/>&nbsp;このハードディスクの割り当ては、新規作成された差分ハードディスクの使用により、間接的に実行されます。</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="537"/>
         <source>Checking...</source>
         <comment>medium</comment>
         <translation>確認中...</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="541"/>
-        <location filename="../src/selector/graphics/details/UIGDetailsElements.cpp" line="503"/>
         <source>Inaccessible</source>
         <comment>medium</comment>
         <translation>アクセスできません</translation>
@@ -14632,54 +13938,41 @@ Version %1</source>
         <translation type="obsolete">%1<hr>このベースハードディスクは以下の差分ハードディスクを使用して間接的に割り当てられます:<br>%2%3</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1171"/>
         <source>3D Acceleration</source>
         <comment>details report</comment>
         <translation>3D アクセラレーション</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1167"/>
         <source>Enabled</source>
         <comment>details report (3D Acceleration)</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1168"/>
         <source>Disabled</source>
         <comment>details report (3D Acceleration)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="149"/>
         <source>Setting Up</source>
         <comment>MachineState</comment>
         <translation>セットアップ</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1873"/>
         <source>Differencing</source>
         <comment>DiskType</comment>
         <translation>差分</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="527"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1135"/>
         <source>Nested Paging</source>
         <comment>details report</comment>
         <translation>ネステッドページング</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="487"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1107"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="670"/>
         <source>Enabled</source>
         <comment>details report (Nested Paging)</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="488"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1108"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="671"/>
         <source>Disabled</source>
         <comment>details report (Nested Paging)</comment>
         <translation>無効</translation>
@@ -14690,7 +13983,6 @@ Version %1</source>
         <translation type="obsolete">ブリッジネットワーク, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1325"/>
         <source>Internal network, '%1'</source>
         <comment>details report (network)</comment>
         <translation>内部ネットワーク, '%1'</translation>
@@ -14701,7 +13993,6 @@ Version %1</source>
         <translation type="obsolete">ホストオンリーネットワーク, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="427"/>
         <source>SCSI</source>
         <comment>StorageBus</comment>
         <translation>SCSI</translation>
@@ -14717,99 +14008,76 @@ Version %1</source>
         <translation type="obsolete">ホストオンリーネットワーク</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="443"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="595"/>
         <source>PIIX3</source>
         <comment>StorageControllerType</comment>
         <translation>PIIX3</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="444"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="596"/>
         <source>PIIX4</source>
         <comment>StorageControllerType</comment>
         <translation>PIIX4</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="445"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="597"/>
         <source>ICH6</source>
         <comment>StorageControllerType</comment>
         <translation>ICH6</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="442"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="594"/>
         <source>AHCI</source>
         <comment>StorageControllerType</comment>
         <translation>AHCI</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="440"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="592"/>
         <source>Lsilogic</source>
         <comment>StorageControllerType</comment>
         <translation>Lsilogic</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="441"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="593"/>
         <source>BusLogic</source>
         <comment>StorageControllerType</comment>
         <translation>BusLogic</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1322"/>
         <source>Bridged adapter, %1</source>
         <comment>details report (network)</comment>
         <translation>ブリッジアダプター, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1328"/>
         <source>Host-only adapter, '%1'</source>
         <comment>details report (network)</comment>
         <translation>ホストオンリーアダプター, '%1'</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="307"/>
         <source>Intel PRO/1000 MT Server (82545EM)</source>
         <comment>NetworkAdapterType</comment>
         <translation>Intel PRO/1000 MT Server (82545EM)</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="288"/>
         <source>Bridged Adapter</source>
         <comment>NetworkAttachmentType</comment>
         <translation>ブリッジアダプター</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="290"/>
         <source>Host-only Adapter</source>
         <comment>NetworkAttachmentType</comment>
         <translation>ホストオンリーアダプター</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1117"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1153"/>
         <source><nobr>%1 MB</nobr></source>
         <comment>details report</comment>
         <translation><nobr>%1 MB</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1119"/>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="695"/>
         <source>Processor(s)</source>
         <comment>details report</comment>
         <translation>プロセッサー数</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1120"/>
         <source><nobr>%1</nobr></source>
         <comment>details report</comment>
         <translation><nobr>%1</nobr></translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1141"/>
         <source>System</source>
         <comment>details report</comment>
         <translation>システム</translation>
@@ -14830,73 +14098,60 @@ Version %1</source>
         <translation type="obsolete">無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1203"/>
         <source>Display</source>
         <comment>details report</comment>
         <translation>ディスプレイ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="341"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="519"/>
         <source>Raw File</source>
         <comment>PortMode</comment>
         <translation>Rawファイル</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1176"/>
         <source>Enabled</source>
         <comment>details report (2D Video Acceleration)</comment>
         <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="883"/>
         <source>Unknown device</source>
         <comment>USB device details</comment>
         <translation>不明なデバイス</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1161"/>
         <source>Screens</source>
         <comment>details report</comment>
         <translation>スクリーン</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1177"/>
         <source>Disabled</source>
         <comment>details report (2D Video Acceleration)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1180"/>
         <source>2D Video Acceleration</source>
         <comment>details report</comment>
         <translation>2D ビデオアクセラレーション</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1194"/>
         <source>Remote Desktop Server</source>
         <comment>details report (VRDE Server)</comment>
         <translation>リモートデスクトップサーバー</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1195"/>
         <source>Disabled</source>
         <comment>details report (VRDE Server)</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1235"/>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1267"/>
         <source>Not Attached</source>
         <comment>details report (Storage)</comment>
         <translation>未割り当て</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1275"/>
         <source>Storage</source>
         <comment>details report</comment>
         <translation>ストレージ</translation>
@@ -14935,275 +14190,230 @@ Version %1</source>
         <translation type="obsolete">すべての%1イメージ(%2)</translation>
     </message>
     <message>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="1685"/>
         <source>All files (*)</source>
         <translation>すべてのファイル(*)</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="132"/>
         <source>Teleported</source>
         <comment>MachineState</comment>
         <translation>テレポーテーション</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="135"/>
         <source>Guru Meditation</source>
         <comment>MachineState</comment>
         <translation>瞑想中(システムエラー)</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="136"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="143"/>
         <source>Teleporting</source>
         <comment>MachineState</comment>
         <translation>テレポーテーション中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="137"/>
         <source>Taking Live Snapshot</source>
         <comment>MachineState</comment>
         <translation>スナップショットの作成中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="142"/>
         <source>Teleporting Paused VM</source>
         <comment>MachineState</comment>
         <translation>仮想マシンのテレポーテーションを中断</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="147"/>
         <source>Restoring Snapshot</source>
         <comment>MachineState</comment>
         <translation>スナップショットに復元中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="145"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="146"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="148"/>
         <source>Deleting Snapshot</source>
         <comment>MachineState</comment>
         <translation>スナップショットを削除中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="144"/>
         <source>Fault Tolerant Syncing</source>
         <comment>MachineState</comment>
         <translation>フォールトトレラントの同期中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="164"/>
         <source>Unlocked</source>
         <comment>SessionState</comment>
         <translation>アンロック</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="165"/>
         <source>Locked</source>
         <comment>SessionState</comment>
         <translation>ロック</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="167"/>
         <source>Unlocking</source>
         <comment>SessionState</comment>
         <translation>アンロック中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="209"/>
         <source>Disabled</source>
         <comment>DragAndDropType</comment>
         <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="210"/>
         <source>Host To Guest</source>
         <comment>DragAndDropType</comment>
         <translation>ホストOSからゲストOSへ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="211"/>
         <source>Guest To Host</source>
         <comment>DragAndDropType</comment>
         <translation>ゲストOSからホストOSへ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="212"/>
         <source>Bidirectional</source>
         <comment>DragAndDropType</comment>
         <translation>双方向</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="223"/>
         <source>PS/2 Mouse</source>
         <comment>PointingHIDType</comment>
         <translation>PS/2 マウス</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="224"/>
         <source>USB Mouse</source>
         <comment>PointingHIDType</comment>
         <translation>USBマウス</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="226"/>
         <source>PS/2 and USB Mouse</source>
         <comment>PointingHIDType</comment>
         <translation>PS/2とUSBマウス</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="238"/>
         <source>Normal</source>
         <comment>MediumType</comment>
         <translation>通常</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="239"/>
         <source>Immutable</source>
         <comment>MediumType</comment>
         <translation>変更不可</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="240"/>
         <source>Writethrough</source>
         <comment>MediumType</comment>
         <translation>ライトスルー</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="241"/>
         <source>Shareable</source>
         <comment>MediumType</comment>
         <translation>共有可能</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="242"/>
         <source>Readonly</source>
         <comment>MediumType</comment>
         <translation>読み込み専用</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="243"/>
         <source>Multi-attach</source>
         <comment>MediumType</comment>
         <translation>複数割り当て</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="256"/>
         <source>Dynamically allocated storage</source>
         <comment>MediumVariant</comment>
         <translation>可変サイズのストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="258"/>
         <source>Dynamically allocated differencing storage</source>
         <comment>MediumVariant</comment>
         <translation>可変サイズの差分ストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="260"/>
         <source>Fixed size storage</source>
         <comment>MediumVariant</comment>
         <translation>固定サイズのストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="262"/>
         <source>Dynamically allocated storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
         <translation>2GB以下のファイルで分割する可変サイズのストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="264"/>
         <source>Dynamically allocated differencing storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
         <translation>2GB以下のファイルで分割する可変サイズの差分ストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="266"/>
         <source>Fixed size storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
         <translation>2GB以下のファイルで分割する固定サイズのストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="268"/>
         <source>Dynamically allocated compressed storage</source>
         <comment>MediumVariant</comment>
         <translation>可変サイズの圧縮ストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="270"/>
         <source>Dynamically allocated differencing compressed storage</source>
         <comment>MediumVariant</comment>
         <translation>可変サイズの差分圧縮ストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="272"/>
         <source>Fixed size ESX storage</source>
         <comment>MediumVariant</comment>
         <translation>固定サイズのESXストレージ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="274"/>
         <source>Fixed size storage on raw disk</source>
         <comment>MediumVariant</comment>
         <translation>固定サイズのrawディスク</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="292"/>
         <source>NAT Network</source>
         <comment>NetworkAttachmentType</comment>
         <translation>NATネットワーク</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="322"/>
         <source>Deny</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
         <translation>拒否</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="324"/>
         <source>Allow VMs</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
         <translation>許可したVM</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="326"/>
         <source>Allow All</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
         <translation>すべて許可</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="368"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="531"/>
         <source>Ignore</source>
         <comment>USBDeviceFilterAction</comment>
         <translation>無視</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="369"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="532"/>
         <source>Hold</source>
         <comment>USBDeviceFilterAction</comment>
         <translation>保持</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="428"/>
         <source>Floppy</source>
         <comment>StorageBus</comment>
         <translation>フロッピー</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="429"/>
         <source>SAS</source>
         <comment>StorageBus</comment>
         <translation>SAS</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="470"/>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation>USB</translation>
+    </message>
+    <message>
         <source>UDP</source>
         <comment>NATProtocol</comment>
         <translation>UDP</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="471"/>
         <source>TCP</source>
         <comment>NATProtocol</comment>
         <translation>TCP</translation>
@@ -15269,35 +14479,26 @@ Version %1</source>
         <translation type="obsolete">複数割り当て</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="412"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="578"/>
         <source>Null</source>
         <comment>AuthType</comment>
         <translation>Null</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="413"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="579"/>
         <source>External</source>
         <comment>AuthType</comment>
         <translation>外部</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="414"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="580"/>
         <source>Guest</source>
         <comment>AuthType</comment>
         <translation>ゲスト</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="401"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="566"/>
         <source>Intel HD Audio</source>
         <comment>AudioControllerType</comment>
         <translation>Intel HD オーディオ</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="309"/>
         <source>Paravirtualized Network (virtio-net)</source>
         <comment>NetworkAdapterType</comment>
         <translation>準仮想化ネットワーク (virtio-net)</translation>
@@ -15318,8 +14519,6 @@ Version %1</source>
         <translation type="obsolete">TCP</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="446"/>
-        <location filename="../src/converter/UIConverterBackendCOM.cpp" line="598"/>
         <source>I82078</source>
         <comment>StorageControllerType</comment>
         <translation>I82078</translation>
@@ -15334,134 +14533,90 @@ Version %1</source>
         <translation type="obsolete">^(?:(?:(\d+)(?:\s?(B|KB|MB|GB|TB|PB))?)|(?:(\d*)%1(\d{1,2})(?:\s?(KB|MB|GB|TB|PB))))$</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="62"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="81"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2451"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2483"/>
         <source>B</source>
         <comment>size suffix Bytes</comment>
         <translation>B</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="63"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="82"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2452"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2485"/>
         <source>KB</source>
         <comment>size suffix KBytes=1024 Bytes</comment>
         <translation>KB</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="64"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="83"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2453"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2487"/>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="241"/>
-        <location filename="../src/widgets/UIApplianceEditorWidget.cpp" line="432"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic2.cpp" line="136"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic2.cpp" line="137"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageBasic2.cpp" line="138"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="224"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="225"/>
-        <location filename="../src/wizards/newvm/UIWizardNewVMPageExpert.cpp" line="226"/>
         <source>MB</source>
         <comment>size suffix MBytes=1024 KBytes</comment>
         <translation>MB</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="65"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="84"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2454"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2489"/>
         <source>GB</source>
         <comment>size suffix GBytes=1024 MBytes</comment>
         <translation>GB</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="66"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="85"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2455"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2491"/>
         <source>TB</source>
         <comment>size suffix TBytes=1024 GBytes</comment>
         <translation>TB</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="67"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="86"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2456"/>
-        <location filename="../src/globals/VBoxGlobal.cpp" line="2493"/>
         <source>PB</source>
         <comment>size suffix PBytes=1024 TBytes</comment>
         <translation>PB</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="178"/>
         <source>Empty</source>
         <comment>medium</comment>
         <translation>空</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="182"/>
         <source>Host Drive '%1'</source>
         <comment>medium</comment>
         <translation>ホストドライブ '%1'</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="184"/>
         <source>Host Drive %1 (%2)</source>
         <comment>medium</comment>
         <translation>ホストドライブ %1 (%2)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="330"/>
         <source><p style=white-space:pre>Type (Format):  %1 (%2)</p></source>
         <comment>medium</comment>
         <translation><p style=white-space:pre>タイプ (形式):  %1 (%2)</p></translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="334"/>
         <source><p>Attached to:  %1</p></source>
         <comment>image</comment>
         <translation><p>割り当て:  %1</p></translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="335"/>
         <source><i>Not Attached</i></source>
         <comment>image</comment>
         <translation><i>未割り当て</i></translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="341"/>
         <source><i>Checking accessibility...</i></source>
         <comment>medium</comment>
         <translation><i>アクセス可否を確認中...</i></translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="354"/>
         <source>Failed to check accessibility of disk image files.</source>
         <comment>medium</comment>
         <translation>メディアのアクセス可否の確認に失敗しました。</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="409"/>
         <source><b>No disk image file selected</b></source>
         <comment>medium</comment>
         <translation><b>メディア 未選択</b></translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="410"/>
         <source>You can also change this while the machine is running.</source>
         <translation>仮想マシンの動作中、これを変更することができます。</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="411"/>
         <source><b>No disk image files available</b></source>
         <comment>medium</comment>
         <translation><b>メディア 利用不可</b></translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="412"/>
         <source>You can create or add disk image files in the virtual machine settings.</source>
         <translation>仮想マシン設定でディスクイメージファイルを作成ないし追加できます。</translation>
     </message>
@@ -15470,60 +14625,51 @@ Version %1</source>
         <translation type="obsolete">仮想メディアマネージャーを使ってメディアのイメージを作成できます。</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="422"/>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>このハードディスクの割り当ては、新規作成された差分ハードディスクの使用により、間接的に実行されます。</translation>
+        <translation type="obsolete">このハードディスクの割り当ては、新規作成された差分ハードディスクの使用により、間接的に実行されます。</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="601"/>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>ハードディスクチェーン中のいくつかのメディアにアクセスできません。仮想メディアマネージャーの<b>[差分ハードディスクを表示]</b>を使用して、これらのメディアを確認してください。</translation>
+        <translation type="obsolete">ハードディスクチェーン中のいくつかのメディアにアクセスできません。仮想メディアマネージャーの<b>[差分ハードディスクを表示]</b>を使用して、これらのメディアを確認してください。</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMedium.cpp" line="618"/>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>このベースハードディスクは以下の差分ハードディスクを使用して間接的に割り当てられます:</translation>
+        <translation type="obsolete">このベースハードディスクは以下の差分ハードディスクを使用して間接的に割り当てられます:</translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="168"/>
         <source>%n year(s)</source>
         <translation>
             <numerusform>%n 年</numerusform>
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="173"/>
         <source>%n month(s)</source>
         <translation>
             <numerusform>%n 月</numerusform>
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="178"/>
         <source>%n day(s)</source>
         <translation>
             <numerusform>%n 日</numerusform>
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="183"/>
         <source>%n hour(s)</source>
         <translation>
             <numerusform>%n 時間</numerusform>
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="188"/>
         <source>%n minute(s)</source>
         <translation>
             <numerusform>%n 分</numerusform>
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/globals/VBoxGlobal.h" line="193"/>
         <source>%n second(s)</source>
         <translation>
             <numerusform>%n 秒</numerusform>
@@ -15550,12 +14696,10 @@ Version %1</source>
         <translation type="obsolete">無効</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="688"/>
         <source>Nested Paging</source>
         <translation>ネステッドページング</translation>
     </message>
     <message>
-        <location filename="../src/runtime/UIIndicatorsPool.cpp" line="689"/>
         <source>Unrestricted Execution</source>
         <translatorcomment>CPUのレジスタ名なのでそのまま</translatorcomment>
         <translation>Unrestricted Execution</translation>
@@ -15566,154 +14710,256 @@ Version %1</source>
         <translation type="obsolete">MB</translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsNetwork.cpp" line="279"/>
         <source>Adapter %1</source>
         <translation>アダプター %1</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="115"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="201"/>
         <source>IDE Primary Master</source>
         <comment>StorageSlot</comment>
         <translation>IDE プライマリマスター</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="117"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="202"/>
-        <source>IDE Primary Slave</source>
-        <comment>StorageSlot</comment>
-        <translation>IDE プライマリスレーブ</translation>
+        <source>IDE Primary Slave</source>
+        <comment>StorageSlot</comment>
+        <translation>IDE プライマリスレーブ</translation>
+    </message>
+    <message>
+        <source>IDE Secondary Master</source>
+        <comment>StorageSlot</comment>
+        <translation>IDE セカンダリマスター</translation>
+    </message>
+    <message>
+        <source>IDE Secondary Slave</source>
+        <comment>StorageSlot</comment>
+        <translation>IDE セカンダリスレーブ</translation>
+    </message>
+    <message>
+        <source>SATA Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>SATA ポート %1</translation>
+    </message>
+    <message>
+        <source>SCSI Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>SCSI ポート %1</translation>
+    </message>
+    <message>
+        <source>SAS Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>SAS ポート %1</translation>
+    </message>
+    <message>
+        <source>Floppy Device %1</source>
+        <comment>StorageSlot</comment>
+        <translation>フロッピーデバイス %1</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>USB ポート %1</translation>
+    </message>
+    <message>
+        <source>General</source>
+        <comment>DetailsElementType</comment>
+        <translation>一般</translation>
+    </message>
+    <message>
+        <source>Preview</source>
+        <comment>DetailsElementType</comment>
+        <translation>プレビュー</translation>
+    </message>
+    <message>
+        <source>System</source>
+        <comment>DetailsElementType</comment>
+        <translation>システム</translation>
+    </message>
+    <message>
+        <source>Display</source>
+        <comment>DetailsElementType</comment>
+        <translation>ディスプレイ</translation>
+    </message>
+    <message>
+        <source>Storage</source>
+        <comment>DetailsElementType</comment>
+        <translation>ストレージ</translation>
+    </message>
+    <message>
+        <source>Audio</source>
+        <comment>DetailsElementType</comment>
+        <translation>オーディオ</translation>
+    </message>
+    <message>
+        <source>Network</source>
+        <comment>DetailsElementType</comment>
+        <translation>ネットワーク</translation>
+    </message>
+    <message>
+        <source>Serial ports</source>
+        <comment>DetailsElementType</comment>
+        <translation>シリアルポート</translation>
+    </message>
+    <message>
+        <source>Parallel ports</source>
+        <comment>DetailsElementType</comment>
+        <translation>パラレルポート</translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>DetailsElementType</comment>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>Shared folders</source>
+        <comment>DetailsElementType</comment>
+        <translation>共有フォルダー</translation>
+    </message>
+    <message>
+        <source>Description</source>
+        <comment>DetailsElementType</comment>
+        <translation>説明</translation>
+    </message>
+    <message>
+        <source>Please choose a location for new virtual hard drive file</source>
+        <translation>新しい仮想ハードドライブファイルの場所を選択</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>オフ</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation>準仮想化インターフェース</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>なし</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>デフォルト</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Legacy</translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Minimal</translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation>新しい可変サイズのストレージ</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="119"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="203"/>
-        <source>IDE Secondary Master</source>
-        <comment>StorageSlot</comment>
-        <translation>IDE セカンダリマスター</translation>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="121"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="204"/>
-        <source>IDE Secondary Slave</source>
-        <comment>StorageSlot</comment>
-        <translation>IDE セカンダリスレーブ</translation>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="137"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="205"/>
-        <source>SATA Port %1</source>
-        <comment>StorageSlot</comment>
-        <translation>SATA ポート %1</translation>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="153"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="206"/>
-        <source>SCSI Port %1</source>
-        <comment>StorageSlot</comment>
-        <translation>SCSI ポート %1</translation>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>有効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="169"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="207"/>
-        <source>SAS Port %1</source>
-        <comment>StorageSlot</comment>
-        <translation>SAS ポート %1</translation>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>無効</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="185"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="208"/>
-        <source>Floppy Device %1</source>
-        <comment>StorageSlot</comment>
-        <translation>フロッピーデバイス %1</translation>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>スナップショット作成中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="686"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="713"/>
-        <source>General</source>
-        <comment>DetailsElementType</comment>
-        <translation>一般</translation>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>オンラインスナップショットの作成中</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="687"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="714"/>
-        <source>Preview</source>
-        <comment>DetailsElementType</comment>
-        <translation>プレビュー</translation>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation>KVM</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="688"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="715"/>
-        <source>System</source>
-        <comment>DetailsElementType</comment>
-        <translation>システム</translation>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation>光学</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="689"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="716"/>
-        <source>Display</source>
-        <comment>DetailsElementType</comment>
-        <translation>ディスプレイ</translation>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="690"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="717"/>
-        <source>Storage</source>
-        <comment>DetailsElementType</comment>
-        <translation>ストレージ</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>OHCI</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="691"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="718"/>
-        <source>Audio</source>
-        <comment>DetailsElementType</comment>
-        <translation>オーディオ</translation>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>EHCI</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="692"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="719"/>
-        <source>Network</source>
-        <comment>DetailsElementType</comment>
-        <translation>ネットワーク</translation>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>xHCI</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="693"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="720"/>
-        <source>Serial ports</source>
+        <source>User interface</source>
         <comment>DetailsElementType</comment>
-        <translation>シリアルポート</translation>
+        <translation>ユーザーインターフェース</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="695"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="722"/>
-        <source>Parallel ports</source>
-        <comment>DetailsElementType</comment>
-        <translation>パラレルポート</translation>
+        <source>(Optical Drive)</source>
+        <translation>(光学ドライブ)</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="697"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="724"/>
-        <source>USB</source>
-        <comment>DetailsElementType</comment>
-        <translation>USB</translation>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>このハードドライブの割り当ては、新規作成された差分ハードドライブの使用により、間接的に実行されます。</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="698"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="725"/>
-        <source>Shared folders</source>
-        <comment>DetailsElementType</comment>
-        <translation>共有フォルダー</translation>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation>ハードドライブチェーン中のいくつかのメディアにアクセスできません。仮想メディアマネージャーの<b>[差分ハードドライブを表示]</b>を使用して、これらのメディアを確認してください。</translation>
     </message>
     <message>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="699"/>
-        <location filename="../src/converter/UIConverterBackendGlobal.cpp" line="726"/>
-        <source>Description</source>
-        <comment>DetailsElementType</comment>
-        <translation>説明</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>このベースハードドライブは以下の差分ハードドライブを使用して間接的に割り当てられます:</translation>
     </message>
     <message>
-        <location filename="../src/wizards/newvd/UIWizardNewVDPageBasic3.cpp" line="93"/>
-        <source>Please choose a location for new virtual hard drive file</source>
-        <translation>新しい仮想ハードドライブファイルの場所を選択</translation>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation>暗号化</translation>
     </message>
 </context>
 <context>
@@ -15723,17 +14969,14 @@ Version %1</source>
         <translation type="obsolete">'%1 (0x%2)'は無効なホストキーのコードです。</translation>
     </message>
     <message>
-        <location filename="../src/VBoxGlobalSettings.cpp" line="135"/>
         <source>'%1' is an invalid host-combination code-sequence.</source>
         <translation>'%1'は無効なホストキーの組み合わせです。</translation>
     </message>
     <message>
-        <location filename="../src/VBoxGlobalSettings.cpp" line="268"/>
         <source>The value '%1' of the key '%2' doesn't match the regexp constraint '%3'.</source>
         <translation>'%2'キーの値'%1'は正規表現の規則'%3'に適合しません。</translation>
     </message>
     <message>
-        <location filename="../src/VBoxGlobalSettings.cpp" line="259"/>
         <source>Cannot delete the key '%1'.</source>
         <translation>'%1'キーを削除できません。</translation>
     </message>
@@ -16207,17 +15450,14 @@ USB フィルターを追加または除去するにはコンテキストメニ
 <context>
     <name>VBoxLicenseViewer</name>
     <message>
-        <location filename="../src/VBoxLicenseViewer.cpp" line="97"/>
         <source>I &Agree</source>
         <translation>同意します(&A)</translation>
     </message>
     <message>
-        <location filename="../src/VBoxLicenseViewer.cpp" line="98"/>
         <source>I &Disagree</source>
         <translation>同意しません(&D)</translation>
     </message>
     <message>
-        <location filename="../src/VBoxLicenseViewer.cpp" line="95"/>
         <source>VirtualBox License</source>
         <translation>VirtualBox ライセンス</translation>
     </message>
@@ -16287,7 +15527,6 @@ USB フィルターを追加または除去するにはコンテキストメニ
 <context>
     <name>VBoxMediaManagerDlg</name>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1182"/>
         <source>&Actions</source>
         <translation>動作(&A)</translation>
     </message>
@@ -16300,27 +15539,22 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">追加(&A)...</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1184"/>
         <source>&Copy...</source>
         <translation>コピー(&C)...</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1185"/>
         <source>&Modify...</source>
         <translation>変更(&M)...</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1186"/>
         <source>R&emove</source>
         <translation>除去(&E)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1187"/>
         <source>Re&lease</source>
         <translation>解放(&L)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1188"/>
         <source>Re&fresh</source>
         <translation>最新の情報に更新(&F)</translation>
     </message>
@@ -16337,27 +15571,22 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">既存のメディアを追加</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1196"/>
         <source>Copy an existing disk image file</source>
         <translation>既存のメディアをコピー</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1197"/>
         <source>Modify the attributes of the selected disk image file</source>
         <translation>選択したメディアの属性を変更</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1198"/>
         <source>Remove the selected disk image file</source>
         <translation>選択したメディアを除去</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1199"/>
         <source>Release the selected disk image file by detaching it from the machines</source>
         <translation>選択したメディアを仮想マシンから割り当て解除して解放する</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1200"/>
         <source>Refresh the list of disk image files</source>
         <translation>メディアリストを最新の情報に更新</translation>
     </message>
@@ -16382,7 +15611,6 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">割り当て</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1237"/>
         <source>Checking accessibility</source>
         <translation>アクセス可否を確認</translation>
     </message>
@@ -16427,18 +15655,15 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">すべての%1イメージ(%2)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="694"/>
         <source><i>Not&nbsp;Attached</i></source>
         <translation><i>未割り当て</i></translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1715"/>
         <source>--</source>
         <comment>no info</comment>
         <translation>--</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1215"/>
         <source>Virtual Media Manager</source>
         <translation>仮想メディアマネージャー</translation>
     </message>
@@ -16447,48 +15672,34 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">ハードディスク(&D)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1217"/>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1226"/>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1231"/>
         <source>Name</source>
         <translation>名前</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1218"/>
         <source>Virtual Size</source>
         <translation>仮想的なサイズ</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1219"/>
         <source>Actual Size</source>
         <translation>実際のサイズ</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1220"/>
         <source>Type:</source>
         <translation>タイプ:</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1221"/>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1228"/>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1233"/>
         <source>Location:</source>
         <translation>場所:</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1222"/>
         <source>Format:</source>
         <translation>フォーマット:</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1223"/>
         <source>Storage details:</source>
         <translation>ストレージの詳細:</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1224"/>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1229"/>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1234"/>
         <source>Attached to:</source>
         <translation>割り当て:</translation>
     </message>
@@ -16497,8 +15708,6 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">CD/DVDイメージ(&C)</translation>
     </message>
     <message>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1227"/>
-        <location filename="../src/medium/UIMediumManager.cpp" line="1232"/>
         <source>Size</source>
         <translation>サイズ</translation>
     </message>
@@ -16521,6 +15730,18 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <comment>VMM: Floppy Image</comment>
         <translation type="obsolete">割り当て</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation>UUID:</translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -16653,8 +15874,8 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">接続を確立できませんでした。</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>登録フォームに入力し、あなたが VirtualBox を使用していることを我々に知らせてください。VirtualBox のニュースと更新情報をお知らせします(任意)。</p><p>フルネーム(英字)とメールアドレスを下のフィールドに入力してください。注:Sun Microsystems は、この情報を製品使用の統計を収集し、VirtualBox ニュースレターを送信するためだけに使用します。Sun Microsystems が個人情報を第三者に渡すことはありません。個人情報の扱いに関する詳細情報は、VirtualBox マニュアルの"<b>Privacy Policy</b>" セクションまたは VirtualBox webサイトの"<a href=https://www.virtualbox.org/wiki/PrivacyPolicy>Privacy Policy</a>&q [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>登録フォームに入力し、あなたが VirtualBox を使用していることを我々に知らせてください。VirtualBox のニュースと更新情報をお知らせします(任意)。</p><p>フルネーム(英字)とメールアドレスを下のフィールドに入力してください。注:Sun Microsystems は、この情報を製品使用の統計を収集し、VirtualBox ニュースレターを送信するためだけに使用します。Sun Microsystems が個人情報を第三者に渡すことはありません。個人情報の扱いに関する詳細情報は、VirtualBox マニュアルの"<b>Privacy Policy</b>" セクションまたは VirtualBox webサイトの"<a href=http://www.virtualbox.org/wiki/PrivacyPolicy>Privacy Policy</a>&qu [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -16673,8 +15894,8 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">国/地域を選択</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>登録フォームに入力し、あなたが VirtualBox を使用していることを我々に知らせてください。VirtualBox のニュースと更新情報をお知らせします(任意)。</p><p>フルネーム(英字)とメールアドレスを下のフィールドに入力してください。注:Sun Microsystems は、この情報を製品使用の統計を収集し、VirtualBox ニュースレターを送信するためだけに使用します。Sun Microsystems が個人情報を第三者に渡すことはありません。個人情報の扱いに関する詳細情報は、VirtualBox マニュアルの"<b>Privacy Policy</b>" セクションまたは VirtualBox webサイトの"<a href=https://www.virtualbox.org/wiki/PrivacyPolicy>Privacy Policy</a>&q [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>登録フォームに入力し、あなたが VirtualBox を使用していることを我々に知らせてください。VirtualBox のニュースと更新情報をお知らせします(任意)。</p><p>フルネーム(英字)とメールアドレスを下のフィールドに入力してください。注:Sun Microsystems は、この情報を製品使用の統計を収集し、VirtualBox ニュースレターを送信するためだけに使用します。Sun Microsystems が個人情報を第三者に渡すことはありません。個人情報の扱いに関する詳細情報は、VirtualBox マニュアルの"<b>Privacy Policy</b>" セクションまたは VirtualBox webサイトの"<a href=http://www.virtualbox.org/wiki/PrivacyPolicy>Privacy Policy</a>&qu [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -16747,17 +15968,14 @@ USB フィルターを追加または除去するにはコンテキストメニ
 <context>
     <name>VBoxScreenshotViewer</name>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.cpp" line="204"/>
         <source>Screenshot of %1 (%2)</source>
         <translation>%1(%2)のスクリーンショット</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.cpp" line="240"/>
         <source>Click to view non-scaled screenshot.</source>
         <translation>クリックして実寸のスクリーンショットを表示します。</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.cpp" line="247"/>
         <source>Click to view scaled screenshot.</source>
         <translation>クリックしてスクリーンショットを表示します。</translation>
     </message>
@@ -17068,8 +16286,8 @@ USB フィルターを追加または除去するにはコンテキストメニ
         <translation type="obsolete">ファイル(&F)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>ようこそVirtualBoxへ!</h3><p>このウィンドウの左側にコンピューター上のすべての仮想マシンがリスト表示されます。まだ仮想マシンが作成されていないため、リストは空です。<img src=:/welcome.png align=right/></p><p>新規仮想マシンを作成するにはウィンドウ上部にあるメインツールバーの<b>[新規]</b>ボタンをクリックしてください。</p><p><b>%1</b>キーでヘルプを表示できます。または最新の情報とニュースを取得するため <a href=https://www.virtualbox.org>www.virtualbox.org</a> を訪問してください。</p></translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>ようこそVirtualBoxへ!</h3><p>このウィンドウの左側にコンピューター上のすべての仮想マシンがリスト表示されます。まだ仮想マシンが作成されていないため、リストは空です。<img src=:/welcome.png align=right/></p><p>新規仮想マシンを作成するにはウィンドウ上部にあるメインツールバーの<b>[新規]</b>ボタンをクリックしてください。</p><p><b>%1</b>キーでヘルプを表示できます。または最新の情報とニュースを取得するため <a href=http://www.virtualbox.org>www.virtualbox.org</a> を訪問してください。</p></translation>
     </message>
     <message>
         <source>Show Toolbar</source>
@@ -17296,7 +16514,6 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">キャンセル</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.cpp" line="135"/>
         <source>Details of %1 (%2)</source>
         <translation>%1 (%2)の詳細</translation>
     </message>
@@ -17305,27 +16522,22 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">スナップショット詳細</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.cpp" line="137"/>
         <source>Click to enlarge the screenshot.</source>
         <translation>クリックしてスクリーンショットを拡大します。</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.ui" line="32"/>
         <source>&Name:</source>
         <translation>名前(&N):</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.ui" line="71"/>
         <source>Taken:</source>
         <translation>作成:</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.ui" line="91"/>
         <source>&Description:</source>
         <translation>説明(&D):</translation>
     </message>
     <message>
-        <location filename="../src/VBoxSnapshotDetailsDlg.ui" line="120"/>
         <source>D&etails:</source>
         <translation>詳細(&E):</translation>
     </message>
@@ -17337,7 +16549,6 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">[snapshot]</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.ui" line="26"/>
         <source>VBoxSnapshotsWgt</source>
         <translation>VBoxSnapshotsWgt</translation>
     </message>
@@ -17366,7 +16577,6 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">スナップショット作成</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="469"/>
         <source>Take &Snapshot</source>
         <translation>スナップショット作成(&S)</translation>
     </message>
@@ -17383,88 +16593,70 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">詳細を表示</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="468"/>
         <source>S&how Details</source>
         <translation>詳細を表示(&H)</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="158"/>
         <source>Current State (changed)</source>
         <comment>Current State (Modified)</comment>
         <translation>最新の状態(変更)</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="159"/>
         <source>Current State</source>
         <comment>Current State (Unmodified)</comment>
         <translation>最新の状態</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="161"/>
         <source>The current state differs from the state stored in the current snapshot</source>
         <translation>最新の状態は最新のスナップショットに保存されている状態と異なります</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="163"/>
         <source>The current state is identical to the state stored in the current snapshot</source>
         <translation>最新の状態は最新のスナップショットに保存されている状態と同じです</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="216"/>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="221"/>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="226"/>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="231"/>
         <source> (%1 ago)</source>
         <translation>(%1前)</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="271"/>
         <source> (current, </source>
         <comment>Snapshot details</comment>
         <translation>(最新,</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="274"/>
         <source>online)</source>
         <comment>Snapshot details</comment>
         <translation>オンライン)</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="275"/>
         <source>offline)</source>
         <comment>Snapshot details</comment>
         <translation>オフライン)</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="278"/>
         <source>Taken at %1</source>
         <comment>Snapshot (time)</comment>
         <translation>作成時刻 %1</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="280"/>
         <source>Taken on %1</source>
         <comment>Snapshot (date + time)</comment>
         <translation>作成日時 %1</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="284"/>
         <source>%1 since %2</source>
         <comment>Current State (time or date + time)</comment>
         <translation>%2からの状態 %1</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="470"/>
         <source>&Clone...</source>
         <translation>クローン(&C)...</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="477"/>
         <source>Clone the selected virtual machine</source>
         <translation>選択した仮想マシンをクローン</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="858"/>
         <source>Snapshot %1</source>
         <translation>スナップショット %1</translation>
     </message>
@@ -17477,7 +16669,6 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">Ctrl+Shift+S</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="476"/>
         <source>Take a snapshot of the current virtual machine state</source>
         <translation>現在の仮想マシンの状態のスナップショットを作成</translation>
     </message>
@@ -17506,7 +16697,6 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">最新のスナップショットを破棄し、スナップショットを作成する前の状態に戻す</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="475"/>
         <source>Show the details of the selected snapshot</source>
         <translation>選択したスナップショットの詳細を表示</translation>
     </message>
@@ -17515,7 +16705,6 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">Ctrl+スペース</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="211"/>
         <source> (%1)</source>
         <translation> (%1)</translation>
     </message>
@@ -17544,22 +16733,18 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         </translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="466"/>
         <source>&Restore Snapshot</source>
         <translation>スナップショットに復元(&R)</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="467"/>
         <source>&Delete Snapshot</source>
         <translation>スナップショットを削除(&D)</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="473"/>
         <source>Restore the selected snapshot of the virtual machine</source>
         <translation>選択した仮想マシンのスナップショットに復元</translation>
     </message>
     <message>
-        <location filename="../src/selector/VBoxSnapshotsWgt.cpp" line="474"/>
         <source>Delete the selected snapshot of the virtual machine</source>
         <translation>選択した仮想マシンのスナップショットを削除</translation>
     </message>
@@ -17582,17 +16767,14 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
 <context>
     <name>VBoxTakeSnapshotDlg</name>
     <message>
-        <location filename="../src/VBoxTakeSnapshotDlg.ui" line="26"/>
         <source>Take Snapshot of Virtual Machine</source>
         <translation>仮想マシンのスナップショット作成</translation>
     </message>
     <message>
-        <location filename="../src/VBoxTakeSnapshotDlg.ui" line="64"/>
         <source>Snapshot &Name</source>
         <translation>スナップショットの名前(&N)</translation>
     </message>
     <message>
-        <location filename="../src/VBoxTakeSnapshotDlg.ui" line="84"/>
         <source>Snapshot &Description</source>
         <translation>スナップショットの説明(&D)</translation>
     </message>
@@ -17613,7 +16795,6 @@ DOS系ゲストOSからアクセスする場合は <tt>net use x:¥¥vboxs
         <translation type="obsolete">キャンセル</translation>
     </message>
     <message numerus="yes">
-        <location filename="../src/VBoxTakeSnapshotDlg.cpp" line="73"/>
         <source>Warning: You are taking a snapshot of a running machine which has %n immutable image(s) attached to it. As long as you are working from this snapshot the immutable image(s) will not be reset to avoid loss of data.</source>
         <translation>
             <numerusform>警告:%n 個の変更不可の仮想ディスクを割り当てた仮想マシンのスナップショットを作成しています。データ喪失を避けるため、このスナップショットから起動する限り、仮想ディスクはリセットされません。</numerusform>
@@ -17788,13 +16969,11 @@ value.</qt></source>
 <context>
     <name>VBoxUSBMenu</name>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="87"/>
         <source><no devices available></source>
         <comment>USB devices</comment>
         <translation><利用できるデバイスがありません></translation>
     </message>
     <message>
-        <location filename="../src/settings/machine/UIMachineSettingsUSB.cpp" line="89"/>
         <source>No supported devices connected to the host PC</source>
         <comment>USB device tooltip</comment>
         <translation>ホストマシンに接続されたデバイスはサポートされていません</translation>
@@ -17827,201 +17006,6 @@ value.</qt></source>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">セッション情報ダイアログ</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">閉じる(&C)</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="173"/>
-        <source>%1 - Session Information</source>
-        <translation>%1 - セッション情報</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">詳細(&D)</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">ランタイム(&R)</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="196"/>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="233"/>
-        <source>DMA Transfers</source>
-        <translation>DMA 転送</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="198"/>
-        <source>PIO Transfers</source>
-        <translation>PIO 転送</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="200"/>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="235"/>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="262"/>
-        <source>Data Read</source>
-        <translation>データ読み込み</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="202"/>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="237"/>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="264"/>
-        <source>Data Written</source>
-        <translation>データ書き込み</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="309"/>
-        <source>Data Transmitted</source>
-        <translation>データ送信</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="311"/>
-        <source>Data Received</source>
-        <translation>データ受信</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="511"/>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>利用不可</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="522"/>
-        <source>Runtime Attributes</source>
-        <translation>ランタイム属性</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="523"/>
-        <source>Screen Resolution</source>
-        <translation>画面解像度</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">CD/DVD 統計</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">ネットワークアダプター統計</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">バージョン %1.%2</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="496"/>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>未検出</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="505"/>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>未検出</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="524"/>
-        <source>Clipboard Mode</source>
-        <translation>クリップボードモード</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="525"/>
-        <source>Drag'n'Drop Mode</source>
-        <translation>ドラッグ&ドロップモード</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="529"/>
-        <source>Guest Additions</source>
-        <translation>Guest Additions</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="530"/>
-        <source>Guest OS Type</source>
-        <translation>ゲストOSのタイプ</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">ハードディスク統計</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">ハードディスクなし</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="638"/>
-        <source>No Network Adapters</source>
-        <translation>ネットワークアダプターなし</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">有効</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">無効</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">ネステッドページング</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">ネステッドページング</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">有効</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">無効</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.ui" line="26"/>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.ui" line="37"/>
-        <source>Configuration &Details</source>
-        <translation>設定の詳細(&D)</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.ui" line="72"/>
-        <source>&Runtime Information</source>
-        <translation>ランタイム情報(&R)</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">利用不可</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="539"/>
-        <source>Storage Statistics</source>
-        <translation>ストレージ統計</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="611"/>
-        <source>No Storage Devices</source>
-        <translation>ストレージデバイス なし</translation>
-    </message>
-    <message>
-        <location filename="../src/VBoxVMInformationDlg.cpp" line="622"/>
-        <source>Network Statistics</source>
-        <translation>ネットワーク 統計</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_km_KH.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_km_KH.ts
index e8a3493..d610d76 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_km_KH.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_km_KH.ts
@@ -33,7 +33,7 @@
     <name>QApplication</name>
     <message>
         <source>Executable <b>%1</b> requires Qt %2.x, found Qt %3.</source>
-        <translation>អាច​ប្រតិបត្តិបាន <b>%1</b> ទាមទារ Qt %2.x រក​ឃើញ Qt %3 ។</translation>
+        <translation>អាច​ប្រតិបត្តិបាន <b>%1</b> ទាមទារ Qt %2.x រក​ឃើញ Qt %3 ។</translation>
     </message>
     <message>
         <source>Incompatible Qt Library Error</source>
@@ -49,11 +49,11 @@
     </message>
     <message>
         <source>Please try reinstalling VirtualBox.</source>
-        <translation>វា​អាច​ជួយ​ឲ្យ​ដំឡើង VirtualBox ឡើង​វិញ ។</translation>
+        <translation>វា​អាច​ជួយ​ឲ្យ​ដំឡើង VirtualBox ឡើង​វិញ ។</translation>
     </message>
     <message>
         <source>This error means that the kernel driver was either not able to allocate enough memory or that some mapping operation failed.</source>
-        <translation>កំហុស​នេះ​មាន​ន័យ​ថា កម្មវិធី​បញ្ជា​ខឺណែល​មិនអាច​បម្រុង​ទុក​សតិ​គ្រប់គ្រាន់​ ឬ​បានបរាជ័យ​ក្នុងកា​រ​ផ្គូផ្គង​មួយ​ចំនួន ។</translation>
+        <translation>កំហុស​នេះ​មាន​ន័យ​ថា កម្មវិធី​បញ្ជា​ខឺណែល​មិនអាច​បម្រុង​ទុក​សតិ​គ្រប់គ្រាន់​ ឬ​បានបរាជ័យ​ក្នុងកា​រ​ផ្គូផ្គង​មួយ​ចំនួន ។</translation>
     </message>
     <message>
         <source>The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>as root. Users of Ubuntu, Fedora or Mandriva should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.</source>
@@ -61,15 +61,15 @@
     </message>
     <message>
         <source>The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Please try completely uninstalling and reinstalling VirtualBox.</source>
-        <translation>ម៉ូ​ឌុល​ខឺ​ណែល​របស់​ VirtualBox មិន​ផ្គូផ្គង​​កំណែ​របស់​ VirtualBox នេះ​ទេ​ ។ ជាក់​ស្តែង​ការ​ដំឡើង VirtualBox ​​​មិន​ទទួល​បាន​ជោគជ័យ​នោះ​ទេ ។ សូម​ព្យាយាម​លុប​​ ហើយ​​ដំឡើង​ VirtualBox ឡើង​វិញ ។</translation>
+        <translation>ម៉ូ​ឌុល​ខឺ​ណែល​របស់​ VirtualBox មិន​ផ្គូផ្គង​​កំណែ​របស់​ VirtualBox នេះ​ទេ​ ។ ជាក់​ស្តែង​ការ​ដំឡើង VirtualBox ​​​មិន​ទទួល​បាន​ជោគជ័យ​នោះ​ទេ ។ សូម​ព្យាយាម​លុប​​ ហើយ​​ដំឡើង​ VirtualBox ឡើង​វិញ ។</translation>
     </message>
     <message>
         <source>The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.</source>
-        <translation>ម៉ូឌុល​ខឺ​ណែល​របស់​ VirtualBox មិន​ផ្គូផ្គង​កំណែ​របស់​ VirtualBox នេះទេ ។ ជាក់​ស្តែង​ការ​ដំឡើង​របស់​ VirtualBox មិន​ទទួល​បាន​ជោគជ័យ​នោះ​ទេ ។ ការ​ប្រតិបត្តិ​<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>នេះ​អាច​ត្រឹមត្រូវ​ ។ សូម​ប្រាកដ​ថា​ អ្នក​មិនបញ្ចូល​កំណែ​ OSE និង​​កំណែ​ PUEL របស់​ VirtualBox ចូល​គ្នា​ឡើយ ។</translation>
+        <translation>ម៉ូឌុល​ខឺ​ណែល​របស់​ VirtualBox មិន​ផ្គូផ្គង​កំណែ​របស់​ VirtualBox នេះទេ ។ ជាក់​ស្តែង​ការ​ដំឡើង​របស់​ VirtualBox មិន​ទទួល​បាន​ជោគជ័យ​នោះ​ទេ ។ ការ​ប្រតិបត្តិ​<br/><br/>  <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>នេះ​អាច​ត្រឹមត្រូវ​ ។ សូម​ប្រាកដ​ថា​ អ្នក​មិនបញ្ចូល​កំណែ​ OSE និង​​កំណែ​ PUEL របស់​ VirtualBox ចូល​គ្នា​ឡើយ ។</translation>
     </message>
     <message>
         <source>Make sure the kernel module has been loaded successfully.</source>
-        <translation>ប្រាកដ​ថា ​ម៉ូឌុល​ខឺណែល​ត្រូវ​បាន​ផ្ទុក​ដោយ​​ជោគ​ជ័យ​ ។</translation>
+        <translation>ប្រាកដ​ថា ​ម៉ូឌុល​ខឺណែល​ត្រូវ​បាន​ផ្ទុក​ដោយ​​ជោគ​ជ័យ​ ។</translation>
     </message>
     <message>
         <source>VirtualBox - Runtime Error</source>
@@ -77,7 +77,7 @@
     </message>
     <message>
         <source><b>Cannot access the kernel driver!</b><br/><br/></source>
-        <translation><b>មិន​អាច​ដំណើរ​ការ​កម្មវិធី​បញ្ជា​ខឺ​​ណែល​​​បាន​ទេ !</b><br/><br/></translation>
+        <translation><b>មិន​អាច​ដំណើរ​ការ​កម្មវិធី​បញ្ជា​ខឺ​​ណែល​​​បាន​ទេ !</b><br/><br/></translation>
     </message>
     <message>
         <source>Kernel driver not accessible</source>
@@ -122,7 +122,7 @@
     </message>
     <message>
         <source>Could not locate the file on the server (response: %1)</source>
-        <translation type="obsolete">មិនអាច​បម្រុង​ទុក​ឯកសារ​នៅ​លើ​ម៉ាស៊ីន​បម្រើ (ឆ្លើយតប ៖ %1)</translation>
+        <translation type="obsolete">មិនអាច​បម្រុង​ទុក​ឯកសារ​នៅ​លើ​ម៉ាស៊ីន​បម្រើ (ឆ្លើយតប ៖ %1)</translation>
     </message>
 </context>
 <context>
@@ -185,11 +185,11 @@
     </message>
     <message>
         <source><qt>The value of the <b>%1</b> field on the <b>%2</b> page is %3.</qt></source>
-        <translation type="obsolete"><qt>តម្លៃ​របស់​វាល <b>%1</b> នៅ​លើ​ទំព័រ <b>%2</b> គឺ %3 ។</qt></translation>
+        <translation type="obsolete"><qt>តម្លៃ​របស់​វាល <b>%1</b> នៅ​លើ​ទំព័រ <b>%2</b> គឺ %3 ។</qt></translation>
     </message>
     <message>
         <source><qt>One of the values on the <b>%1</b> page is %2.</qt></source>
-        <translation type="obsolete"><qt>តម្លៃ​មួយ​ក្នុង​ចំណោមតម្លៃ​នៅ​លើ​ទំព័រ <b>%1</b> គឺ %2 ។</qt></translation>
+        <translation type="obsolete"><qt>តម្លៃ​មួយ​ក្នុង​ចំណោមតម្លៃ​នៅ​លើ​ទំព័រ <b>%1</b> គឺ %2 ។</qt></translation>
     </message>
 </context>
 <context>
@@ -208,7 +208,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">របៀប​គ្មាន​ថ្នេរ</translation>
+        <translation type="unfinished">របៀប​គ្មាន​ថ្នេរ</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -232,11 +232,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>បិទការ​រួម​បញ្ចូល​កណ្ដុរ</translation>
+        <translation type="obsolete">បិទការ​រួម​បញ្ចូល​កណ្ដុរ</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>បិទ​ការ​រួមបញ្ចូល​ព្រួញ​កណ្ដុរ​របស់ម៉ាស៊ីន​ជា​បណ្ដោះអាសន្ន</translation>
+        <translation type="obsolete">បិទ​ការ​រួមបញ្ចូល​ព្រួញ​កណ្ដុរ​របស់ម៉ាស៊ីន​ជា​បណ្ដោះអាសន្ន</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -248,11 +248,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>បញ្ជាន់ (Insert) បញ្ជា(Ctrl)-ជំនួស(Alt)-លុប(Del)</translation>
+        <translation type="obsolete">បញ្ជាន់ (Insert) បញ្ជា(Ctrl)-ជំនួស(Alt)-លុប(Del)</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>ផ្ញើ​លំដាប់​បញ្ជា(Ctrl)-ជំនួស(Alt)-លុប(Del) ទៅ​កាន់​ម៉ាស៊ីន​និម្មិត</translation>
+        <translation type="obsolete">ផ្ញើ​លំដាប់​បញ្ជា(Ctrl)-ជំនួស(Alt)-លុប(Del) ទៅ​កាន់​ម៉ាស៊ីន​និម្មិត</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -260,7 +260,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>ផ្ញើ​លំដាប់​បញ្ជា(Ctrl)-ជំនួស(Alt)-លុបថយក្រោយ(Backspace) ទៅ​កាន់​ម៉ាស៊ីន​និម្មិត</translation>
+        <translation type="obsolete">ផ្ញើ​លំដាប់​បញ្ជា(Ctrl)-ជំនួស(Alt)-លុបថយក្រោយ(Backspace) ទៅ​កាន់​ម៉ាស៊ីន​និម្មិត</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -275,8 +275,8 @@
         <translation type="obsolete">ប្រអប់​ព័ត៌មាន​សម័យ</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">បង្ហាញ​ប្រអប់​ព័ត៌មាន​សម័យ</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">បង្ហាញ​ប្រអប់​ព័ត៌មាន​សម័យ</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -328,15 +328,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>ឧបករណ៍​ស៊ី​ឌី​/ឌីវីឌី</translation>
+        <translation type="obsolete">ឧបករណ៍​ស៊ី​ឌី​/ឌីវីឌី</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>ឧបករណ៍​ថាសទន់​</translation>
+        <translation type="obsolete">ឧបករណ៍​ថាសទន់​</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>ឧបករណ៍​ USB</translation>
+        <translation type="obsolete">ឧបករណ៍​ USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -359,12 +359,12 @@
         <translation type="obsolete">បើក ឬ​បិទ​ការ​តភ្ជាប់​ផ្ទៃតុ​ពី​ចម្ងាយ (RDP) ទៅ​កាន់​ម៉ាស៊ីន​នេះ</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">ដំឡើង​ការ​បន្ថែម​ភ្ញៀវ...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">ដំឡើង​ការ​បន្ថែម​ភ្ញៀវ...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">ម៉ោន​រូបភាព​ដំឡើង​បន្ថែម​ភ្ញៀវ</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">ម៉ោន​រូបភាព​ដំឡើង​បន្ថែម​ភ្ញៀវ</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -383,7 +383,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">កំពុង​ធ្វើ​កំណត់​ហេតុ...</translation>
+        <translation type="obsolete">កំពុង​ធ្វើ​កំណត់​ហេតុ...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -402,26 +402,10 @@
         <translation></translation>
     </message>
     <message>
-        <source>Switch to &Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch between normal and fullscreen mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch to Seam&less Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and seamless desktop integration mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch to &Scaled Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and scaled mode</source>
         <translation type="unfinished"></translation>
     </message>
@@ -490,10 +474,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished">ឯកសារ</translation>
@@ -761,10 +741,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -809,23 +785,247 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">ដំឡើង​ការ​បន្ថែម​ភ្ញៀវ...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">ម៉ោន​រូបភាព​ដំឡើង​បន្ថែម​ភ្ញៀវ</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">បណ្ដាញ</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">បង្ហាញ​កំណត់​ហេតុ...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">ឯកសារ</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">បើក</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -971,7 +1171,7 @@
     <name>UIDescriptionPagePrivate</name>
     <message>
         <source>No description. Press the Edit button below to add it.</source>
-        <translation type="obsolete">គ្មាន​សេចក្ដី​ពិពណ៌នា​ទេ ។ ចុច​ប៊ុតុង កែសម្រួល​ខា​ងក្រោម​ដើម្បី​បន្ថែម​វា ។</translation>
+        <translation type="obsolete">គ្មាន​សេចក្ដី​ពិពណ៌នា​ទេ ។ ចុច​ប៊ុតុង កែសម្រួល​ខា​ងក្រោម​ដើម្បី​បន្ថែម​វា ។</translation>
     </message>
     <message>
         <source>Edit</source>
@@ -1227,7 +1427,7 @@
     </message>
     <message>
         <source>The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:</source>
-        <translation type="unfinished">ម៉ាស៊ីន​និម្មិត​ដែល​បាន​ជ្រើស​ <i>មិន​អាច​ចូលដំណើរការ​បានទេ</i> ។ សូម​ពិនិត្យ​មើល​សារ​កំហុស​ដែល​បានបង្ហាញ​ខាង​ក្រោម ហើយ​ចុច​ប៊ូតុង <b>ធ្វើ​ឲ្យ​ស្រស់</b> ប្រសិន​បើ​អ្នក​ចង់​ធ្វើការ​ពិនិត្យ​ការ​ចូលដំណើរការ​​ឡើង​វិញ ៖</translation>
+        <translation type="unfinished">ម៉ាស៊ីន​និម្មិត​ដែល​បាន​ជ្រើស​ <i>មិន​អាច​ចូលដំណើរការ​បានទេ</i> ។ សូម​ពិនិត្យ​មើល​សារ​កំហុស​ដែល​បានបង្ហាញ​ខាង​ក្រោម ហើយ​ចុច​ប៊ូតុង <b>ធ្វើ​ឲ្យ​ស្រស់</b> ប្រសិន​បើ​អ្នក​ចង់​ធ្វើការ​ពិនិត្យ​ការ​ចូលដំណើរការ​​ឡើង​វិញ ៖</translation>
     </message>
     <message>
         <source>General</source>
@@ -1266,14 +1466,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1283,7 +1483,7 @@
     <name>UIDownloader</name>
     <message>
         <source>The download process has been cancelled by the user.</source>
-        <translation type="obsolete">ដំណើរការ​​ទាញយក​ត្រូវ​បានបោះបង់​ដោយ​អ្នកប្រើ​ ។</translation>
+        <translation type="obsolete">ដំណើរការ​​ទាញយក​ត្រូវ​បានបោះបង់​ដោយ​អ្នកប្រើ​ ។</translation>
     </message>
     <message>
         <source>Looking for %1...</source>
@@ -1310,7 +1510,7 @@
     </message>
     <message>
         <source><p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p></source>
-        <translation type="obsolete"><p>បាន​បរាជ័យ​ក្នុងកា​ររក្សាទុក​ឯកសារ​ដែលបាន​ទាញ​យក​ជា <nobr><b>%1</b> ។</nobr></p></translation>
+        <translation type="obsolete"><p>បាន​បរាជ័យ​ក្នុងកា​ររក្សាទុក​ឯកសារ​ដែលបាន​ទាញ​យក​ជា <nobr><b>%1</b> ។</nobr></p></translation>
     </message>
     <message>
         <source>Select folder to save Guest Additions image to</source>
@@ -1344,6 +1544,31 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -1359,7 +1584,7 @@
     </message>
     <message>
         <source>Please choose a filename to export the OVF to.</source>
-        <translation type="obsolete">សូម​ជ្រើស​ឈ្មោះ​ឯកសារ​​ ដើម្បី​នាំ​ចូល​ OVF ។</translation>
+        <translation type="obsolete">សូម​ជ្រើស​ឈ្មោះ​ឯកសារ​​ ដើម្បី​នាំ​ចូល​ OVF ។</translation>
     </message>
     <message>
         <source>Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.</source>
@@ -1401,9 +1626,9 @@ p, li { white-space: pre-wrap; }
 <html><head><meta name="qrichtext" content="1" /><style type="text/css">
 p, li { white-space: pre-wrap; }
 </style></head><body>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">អ្នក​ជំនួយ​កា​រនេះ​នឹង​នាំអ្នក​តាមរយៈ​ដំណើរការ​នាំចេញ​ឧបករណ៍ ។</p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">ប្រើ​ប៊ូតុង <span style=" font-weight:600;">បន្ទាប់</span> ដើម្បី​ទៅ​កាន់​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយ​ការ​ ហើយ​ប៊ូតុង <span style=" font-weight:600;">ថយក្រោយ</span> ដើម្បី​ត្រឡប់​ទៅ​ទំព័រ​មុន ។</p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">សូម​ជ្រើស​ម៉ាស៊ីន​និម្មិត ដែល​អ្នក​ចង់បាន​ឧបករណ៍ ។ អ្នក​អាចជ្រើស​ច្រើនជាង​មួយ​បាន ។ សូម​ចំណាំថា ម៉ាស៊ីន​ទាំង​នេះ​ត្រូវ​តែ​បិទ មុន​នឹង​ពួកវា​អាច​ត្រូវ​បាន​នាំចេញ ។</p></body></html></translation>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">អ្នក​ជំនួយ​កា​រនេះ​នឹង​នាំអ្នក​តាមរយៈ​ដំណើរការ​នាំចេញ​ឧបករណ៍ ។</p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">ប្រើ​ប៊ូតុង <span style=" font-weight:600;">បន្ទាប់</span> ដើម្បី​ទៅ​កាន់​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយ​ការ​ ហើយ​ប៊ូតុង <span style=" font-weight:600;">ថយក្រោយ</span> ដើម្បី​ត្រឡប់​ទៅ​ទំព័រ​មុន ។</p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">សូម​ជ្រើស​ម៉ាស៊ីន​និម្មិត ដែល​អ្នក​ចង់បាន​ឧបករណ៍ ។ អ្នក​អាចជ្រើស​ច្រើនជាង​មួយ​បាន ។ សូម​ចំណាំថា ម៉ាស៊ីន​ទាំង​នេះ​ត្រូវ​តែ​បិទ មុន​នឹង​ពួកវា​អាច​ត្រូវ​បាន​នាំចេញ ។</p></body></html></translation>
     </message>
     <message>
         <source>< &Back</source>
@@ -1423,7 +1648,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Here you can change additional configuration values of the selected virtual machines. You can modify most of the properties shown by double-clicking on the items.</source>
-        <translation type="obsolete">នៅ​ទី​នេះ អ្នក​​អាច​ប្តូរ​តម្លៃ​​​កំណត់​រចនា​សម្ព័ន្ធ​​​បន្ថែម​របស់​​ម៉ាស៊ីន​និម្មិត​​​ដែល​​បាន​ជ្រើស​ ។ អ្នក​អាច​កែប្រែ​លក្ខណសម្បត្តិ​ភាគច្រើន ដែលបាន​បង្ហាញ​ដោយ​ចុច​ទ្វេរដង​លើ​ធាតុ ។ ។</translation>
+        <translation type="obsolete">នៅ​ទី​នេះ អ្នក​​អាច​ប្តូរ​តម្លៃ​​​កំណត់​រចនា​សម្ព័ន្ធ​​​បន្ថែម​របស់​​ម៉ាស៊ីន​និម្មិត​​​ដែល​​បាន​ជ្រើស​ ។ អ្នក​អាច​កែប្រែ​លក្ខណសម្បត្តិ​ភាគច្រើន ដែលបាន​បង្ហាញ​ដោយ​ចុច​ទ្វេរដង​លើ​ធាតុ ។ ។</translation>
     </message>
     <message>
         <source>Restore Defaults</source>
@@ -1431,7 +1656,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Please specify the target for the OVF export. You can choose between a local file system export, uploading the OVF to the Sun Cloud service or an S3 storage server.</source>
-        <translation type="obsolete">សូម​បញ្ជាក់​គោល​ដៅ​សម្រាប់​នាំ​ចេញ​​ OVF ។ អ្នក​អាច​ជ្រើស​​រវាង​​ការ​នាំ​ចេញ​ប្រព័ន្ធ​ឯកសារ​មូល​ដ្ឋាន​​ ការ​ផ្ទុក​ OVF ឡើង​ទៅ​​កាន់​ Sun អាច​ជា​​សេវា​ ឬម៉ា​ស៊ីន​បម្រើ​ផ្ទុក S3 ។</translation>
+        <translation type="obsolete">សូម​បញ្ជាក់​គោល​ដៅ​សម្រាប់​នាំ​ចេញ​​ OVF ។ អ្នក​អាច​ជ្រើស​​រវាង​​ការ​នាំ​ចេញ​ប្រព័ន្ធ​ឯកសារ​មូល​ដ្ឋាន​​ ការ​ផ្ទុក​ OVF ឡើង​ទៅ​​កាន់​ Sun អាច​ជា​​សេវា​ ឬម៉ា​ស៊ីន​បម្រើ​ផ្ទុក S3 ។</translation>
     </message>
     <message>
         <source>&Local Filesystem </source>
@@ -1455,7 +1680,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&File:</source>
-        <translation type="obsolete">ឯកសារ​ ៖</translation>
+        <translation type="obsolete">ឯកសារ​ ៖</translation>
     </message>
     <message>
         <source>&Bucket:</source>
@@ -1463,7 +1688,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Hostname:</source>
-        <translation type="obsolete">ឈ្មោះ​ម៉ាស៊ីន​ ៖</translation>
+        <translation type="obsolete">ឈ្មោះ​ម៉ាស៊ីន​ ៖</translation>
     </message>
     <message>
         <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
@@ -1489,7 +1714,7 @@ p, li { white-space: pre-wrap; }
     <name>UIExportApplianceWzdPage2</name>
     <message>
         <source>Here you can change additional configuration values of the selected virtual machines. You can modify most of the properties shown by double-clicking on the items.</source>
-        <translation type="obsolete">នៅ​ទី​នេះ អ្នក​​អាច​ប្តូរ​តម្លៃ​​​កំណត់​រចនា​សម្ព័ន្ធ​​​បន្ថែម​របស់​​ម៉ាស៊ីន​និម្មិត​​​ដែល​​បាន​ជ្រើស​ ។ អ្នក​អាច​កែប្រែ​លក្ខណសម្បត្តិ​ភាគច្រើន ដែលបាន​បង្ហាញ​ដោយ​ចុច​ទ្វេរដង​លើ​ធាតុ ។ ។</translation>
+        <translation type="obsolete">នៅ​ទី​នេះ អ្នក​​អាច​ប្តូរ​តម្លៃ​​​កំណត់​រចនា​សម្ព័ន្ធ​​​បន្ថែម​របស់​​ម៉ាស៊ីន​និម្មិត​​​ដែល​​បាន​ជ្រើស​ ។ អ្នក​អាច​កែប្រែ​លក្ខណសម្បត្តិ​ភាគច្រើន ដែលបាន​បង្ហាញ​ដោយ​ចុច​ទ្វេរដង​លើ​ធាតុ ។ ។</translation>
     </message>
     <message>
         <source>Appliance Export Settings</source>
@@ -1497,7 +1722,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Please specify the target for the OVF export. You can choose between a local file system export, uploading the OVF to the Sun Cloud service or an S3 storage server.</source>
-        <translation type="obsolete">សូម​បញ្ជាក់​គោល​ដៅ​សម្រាប់​នាំ​ចេញ​​ OVF ។ អ្នក​អាច​ជ្រើស​​រវាង​​ការ​នាំ​ចេញ​ប្រព័ន្ធ​ឯកសារ​មូល​ដ្ឋាន​​ ការ​ផ្ទុក​ OVF ឡើង​ទៅ​​កាន់​ Sun អាច​ជា​​សេវា​ ឬម៉ា​ស៊ីន​បម្រើ​ផ្ទុក S3 ។</translation>
+        <translation type="obsolete">សូម​បញ្ជាក់​គោល​ដៅ​សម្រាប់​នាំ​ចេញ​​ OVF ។ អ្នក​អាច​ជ្រើស​​រវាង​​ការ​នាំ​ចេញ​ប្រព័ន្ធ​ឯកសារ​មូល​ដ្ឋាន​​ ការ​ផ្ទុក​ OVF ឡើង​ទៅ​​កាន់​ Sun អាច​ជា​​សេវា​ ឬម៉ា​ស៊ីន​បម្រើ​ផ្ទុក S3 ។</translation>
     </message>
     <message>
         <source>&Local Filesystem </source>
@@ -1516,7 +1741,7 @@ p, li { white-space: pre-wrap; }
     <name>UIExportApplianceWzdPage3</name>
     <message>
         <source>Please specify the target for the OVF export. You can choose between a local file system export, uploading the OVF to the Sun Cloud service or an S3 storage server.</source>
-        <translation type="obsolete">សូម​បញ្ជាក់​គោល​ដៅ​សម្រាប់​នាំ​ចេញ​​ OVF ។ អ្នក​អាច​ជ្រើស​​រវាង​​ការ​នាំ​ចេញ​ប្រព័ន្ធ​ឯកសារ​មូល​ដ្ឋាន​​ ការ​ផ្ទុក​ OVF ឡើង​ទៅ​​កាន់​ Sun អាច​ជា​​សេវា​ ឬម៉ា​ស៊ីន​បម្រើ​ផ្ទុក S3 ។</translation>
+        <translation type="obsolete">សូម​បញ្ជាក់​គោល​ដៅ​សម្រាប់​នាំ​ចេញ​​ OVF ។ អ្នក​អាច​ជ្រើស​​រវាង​​ការ​នាំ​ចេញ​ប្រព័ន្ធ​ឯកសារ​មូល​ដ្ឋាន​​ ការ​ផ្ទុក​ OVF ឡើង​ទៅ​​កាន់​ Sun អាច​ជា​​សេវា​ ឬម៉ា​ស៊ីន​បម្រើ​ផ្ទុក S3 ។</translation>
     </message>
     <message>
         <source>&Local Filesystem </source>
@@ -1540,7 +1765,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Hostname:</source>
-        <translation type="obsolete">ឈ្មោះ​ម៉ាស៊ីន​ ៖</translation>
+        <translation type="obsolete">ឈ្មោះ​ម៉ាស៊ីន​ ៖</translation>
     </message>
     <message>
         <source>&Bucket:</source>
@@ -1548,7 +1773,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&File:</source>
-        <translation type="obsolete">ឯកសារ​ ៖</translation>
+        <translation type="obsolete">ឯកសារ​ ៖</translation>
     </message>
     <message>
         <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
@@ -1587,7 +1812,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Hostname:</source>
-        <translation type="obsolete">ឈ្មោះ​ម៉ាស៊ីន​ ៖</translation>
+        <translation type="obsolete">ឈ្មោះ​ម៉ាស៊ីន​ ៖</translation>
     </message>
     <message>
         <source>&Bucket:</source>
@@ -1595,7 +1820,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&File:</source>
-        <translation type="obsolete">ឯកសារ​ ៖</translation>
+        <translation type="obsolete">ឯកសារ​ ៖</translation>
     </message>
     <message>
         <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
@@ -1623,7 +1848,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Please choose a filename to export the OVF to.</source>
-        <translation type="obsolete">សូម​ជ្រើស​ឈ្មោះ​ឯកសារ​​ ដើម្បី​នាំ​ចូល​ OVF ។</translation>
+        <translation type="obsolete">សូម​ជ្រើស​ឈ្មោះ​ឯកសារ​​ ដើម្បី​នាំ​ចូល​ OVF ។</translation>
     </message>
     <message>
         <source>Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.</source>
@@ -1647,7 +1872,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Here you can change additional configuration values of the selected virtual machines. You can modify most of the properties shown by double-clicking on the items.</source>
-        <translation type="obsolete">នៅ​ទី​នេះ អ្នក​​អាច​ប្តូរ​តម្លៃ​​​កំណត់​រចនា​សម្ព័ន្ធ​​​បន្ថែម​របស់​​ម៉ាស៊ីន​និម្មិត​​​ដែល​​បាន​ជ្រើស​ ។ អ្នក​អាច​កែប្រែ​លក្ខណសម្បត្តិ​ភាគច្រើន ដែលបាន​បង្ហាញ​ដោយ​ចុច​ទ្វេរដង​លើ​ធាតុ ។ ។</translation>
+        <translation type="obsolete">នៅ​ទី​នេះ អ្នក​​អាច​ប្តូរ​តម្លៃ​​​កំណត់​រចនា​សម្ព័ន្ធ​​​បន្ថែម​របស់​​ម៉ាស៊ីន​និម្មិត​​​ដែល​​បាន​ជ្រើស​ ។ អ្នក​អាច​កែប្រែ​លក្ខណសម្បត្តិ​ភាគច្រើន ដែលបាន​បង្ហាញ​ដោយ​ចុច​ទ្វេរដង​លើ​ធាតុ ។ ។</translation>
     </message>
 </context>
 <context>
@@ -1658,15 +1883,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You have started a newly created virtual machine for the first time. This wizard will help you to perform the steps necessary for installing an operating system of your choice onto this virtual machine.</p><p>Use the <b>Next</b> button to go to the next page of the wizard and the <b>Back</b> button to return to the previous page. You can also press <b>Cancel</b> if you want to cancel the execution of this wizard.&lt [...]
-        <translation type="obsolete"><p>អ្នក​បាន​ចាប់ផ្ដើម​ម៉ាស៊ីន​និម្មិត​ដែលបាន​បង្កើត​ថ្មីៗ​ពេល​ដំបូង​បាន​ ។ អ្នក​ជំនួយការ​នេះ​នឹង​ជួយ​អ្នក​ឲ្យ​អនុវត្ត​ជំហាន​ដែល​ចាំបាច់​សម្រាប់ដំឡើង​​ប្រព័ន្ធ​ប្រតិបត្តិការ​នៃ​ជម្រើស​របស់អ្នក​ក្នុង​​ម៉ាស៊ីន​និម្មិត​នេះ ។</p><p>ប្រើ​ប៊ូតុង <b>បន្ទាប់</b> ដើម្បី​ទៅ​កាន់​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយការ ហើយ​ប៊ូតុង​ <b>ថយក្រោយ</b> ដើម្បីត្រឡប់​ទៅ​ទំព័រ​មុន ។ អ្នកក៏​អាច​ចុច <b>បោះបង់</b> ប្រសិន​បើ​អ្នក​ [...]
+        <translation type="obsolete"><p>អ្នក​បាន​ចាប់ផ្ដើម​ម៉ាស៊ីន​និម្មិត​ដែលបាន​បង្កើត​ថ្មីៗ​ពេល​ដំបូង​បាន​ ។ អ្នក​ជំនួយការ​នេះ​នឹង​ជួយ​អ្នក​ឲ្យ​អនុវត្ត​ជំហាន​ដែល​ចាំបាច់​សម្រាប់ដំឡើង​​ប្រព័ន្ធ​ប្រតិបត្តិការ​នៃ​ជម្រើស​របស់អ្នក​ក្នុង​​ម៉ាស៊ីន​និម្មិត​នេះ ។</p><p>ប្រើ​ប៊ូតុង <b>បន្ទាប់</b> ដើម្បី​ទៅ​កាន់​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយការ ហើយ​ប៊ូតុង​ <b>ថយក្រោយ</b> ដើម្បីត្រឡប់​ទៅ​ទំព័រ​មុន ។ អ្នកក៏​អាច​ចុច <b>បោះបង់</b> ប្រសិន​បើ​អ្នក​ [...]
     </message>
     <message>
         <source>Welcome to the First Run Wizard!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មកកាន់​អ្នក​ជំនួយកា​រដំបូង !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មកកាន់​អ្នក​ជំនួយកា​រដំបូង !</translation>
     </message>
     <message>
         <source><p>Select the type of media you would like to use for installation.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​ប្រភេទ​មេឌៀ​ដែល​អ្នក​ចង់​ប្រើ​សម្រាប់​ដំឡើងខាង​ក្រោម ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​ប្រភេទ​មេឌៀ​ដែល​អ្នក​ចង់​ប្រើ​សម្រាប់​ដំឡើងខាង​ក្រោម ។</p></translation>
     </message>
     <message>
         <source>Media Type</source>
@@ -1682,7 +1907,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Select the media which contains the setup program of the operating system you want to install. This media must be bootable, otherwise the setup program will not be able to start.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​មេឌៀ​ដែល​មាន​កម្មវិធីរៀបចំ​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​ចង់​ដំឡើង ។ មេឌៀ​នេះ​ត្រូវ​តែ​អាច​ចាប់ផ្ដើម​បាន បើ​មិនដូច្នេះ​ទេ កម្មវិធី​រៀបចំ​នឹង​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​មេឌៀ​ដែល​មាន​កម្មវិធីរៀបចំ​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​ចង់​ដំឡើង ។ មេឌៀ​នេះ​ត្រូវ​តែ​អាច​ចាប់ផ្ដើម​បាន បើ​មិនដូច្នេះ​ទេ កម្មវិធី​រៀបចំ​នឹង​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</p></translation>
     </message>
     <message>
         <source>Media Source</source>
@@ -1694,7 +1919,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You have selected the following media to boot from:</p></source>
-        <translation type="obsolete"><p>អ្នក​បាន​ជ្រើស​មេឌៀ​ដូចខាងក្រោម​ដើម្បី​ចាប់ផ្ដើម ៖</p></translation>
+        <translation type="obsolete"><p>អ្នក​បាន​ជ្រើស​មេឌៀ​ដូចខាងក្រោម​ដើម្បី​ចាប់ផ្ដើម ៖</p></translation>
     </message>
     <message>
         <source>Summary</source>
@@ -1710,23 +1935,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You have started a newly created virtual machine for the first time. This wizard will help you to perform the steps necessary for booting an operating system of your choice on the virtual machine.</p><p>Note that you will not be able to install an operating system into this virtual machine right now because you did not attach any hard disk to it. If this is not what you want, you can cancel the execution of this wizard, select <b>Settings</b& [...]
-        <translation type="obsolete"><p>អ្នក​បាន​ចាប់ផ្ដើម​ម៉ាស៊ីន​និម្មិត​ដែល​ទើប​បានបង្កើត​ថ្មី​ជា​លើក​ដំបូង ។ អ្នក​ជំនួយ​ការ​នេះ​នឹង​ជួយ​អ្នក​ក្នុងការ​អនុវត្ត​ជំហាន​ដែល​ចាំបាច់​សម្រាប់​ចាប់ផ្ដើម​ប្រព័ន្ធ​ប្រតិបត្តិការ​ជា​ជម្រើស​របស់​អ្នក​នៅ​លើ​ម៉ាស៊ីន​និម្មិត ។</p><p>ចំណាំ​ថា អ្នក​នឹង​មិន​អាច​ដំឡើង​ប្រព័ន្ធ​ប្រតិបត្តិការ​ក្នុង​ម៉ាស៊ីន​និម្មិត​ឥឡូវ​បានទេ ពីព្រោះ​អ្នក​មិន​បាន​ភ្ជាប់​ថាសរឹង​ ។ ប្រសិន​បើ​នេះ​មិនមែន​ជា​អ្វី​ដែល​អ្នក​ចង់​បានទេ អ្នក​អាច​បោះបង់​ប្រតិបត្តិការ [...]
+        <translation type="obsolete"><p>អ្នក​បាន​ចាប់ផ្ដើម​ម៉ាស៊ីន​និម្មិត​ដែល​ទើប​បានបង្កើត​ថ្មី​ជា​លើក​ដំបូង ។ អ្នក​ជំនួយ​ការ​នេះ​នឹង​ជួយ​អ្នក​ក្នុងការ​អនុវត្ត​ជំហាន​ដែល​ចាំបាច់​សម្រាប់​ចាប់ផ្ដើម​ប្រព័ន្ធ​ប្រតិបត្តិការ​ជា​ជម្រើស​របស់​អ្នក​នៅ​លើ​ម៉ាស៊ីន​និម្មិត ។</p><p>ចំណាំ​ថា អ្នក​នឹង​មិន​អាច​ដំឡើង​ប្រព័ន្ធ​ប្រតិបត្តិការ​ក្នុង​ម៉ាស៊ីន​និម្មិត​ឥឡូវ​បានទេ ពីព្រោះ​អ្នក​មិន​បាន​ភ្ជាប់​ថាសរឹង​ ។ ប្រសិន​បើ​នេះ​មិនមែន​ជា​អ្វី​ដែល​អ្នក​ចង់​បានទេ អ្នក​អាច​បោះបង់​ប្រតិបត្តិការ [...]
     </message>
     <message>
         <source><p>Select the type of media you would like to use for booting an operating system.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​ប្រភេទ​មេឌៀ​ដែល​អ្នកចង់​ប្រើ​ដើម្បី​ចាប់ផ្ដើម​ប្រព័ន្ធ​ប្រតិបត្តិការ​ ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​ប្រភេទ​មេឌៀ​ដែល​អ្នកចង់​ប្រើ​ដើម្បី​ចាប់ផ្ដើម​ប្រព័ន្ធ​ប្រតិបត្តិការ​ ។</p></translation>
     </message>
     <message>
         <source><p>Select the media that contains the operating system you want to work with. This media must be bootable, otherwise the operating system will not be able to start.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​មេឌៀ​ដែល​មាន​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​ចង់​ធ្វើការ​ជា​មួយ ។ មេឌៀ​នេះ​ត្រូវទេ​អាច​ចាប់ផ្ដើម​បាន បើ​មិន​ដូច្នេះ​ទេ ប្រព័ន្ធ​ប្រតិបត្តិការ​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​មេឌៀ​ដែល​មាន​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​ចង់​ធ្វើការ​ជា​មួយ ។ មេឌៀ​នេះ​ត្រូវទេ​អាច​ចាប់ផ្ដើម​បាន បើ​មិន​ដូច្នេះ​ទេ ប្រព័ន្ធ​ប្រតិបត្តិការ​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</p></translation>
     </message>
     <message>
         <source><p>You have selected the following media to boot an operating system from:</p></source>
-        <translation type="obsolete"><p>អ្នក​បាន​ជ្រើស​មេឌៀ​ដូចខាង​ក្រោម​ដើម្បី​ចាប់ផ្ដើម​ប្រព័ន្ធ​ប្រតិបត្តិការ ៖</p></translation>
+        <translation type="obsolete"><p>អ្នក​បាន​ជ្រើស​មេឌៀ​ដូចខាង​ក្រោម​ដើម្បី​ចាប់ផ្ដើម​ប្រព័ន្ធ​ប្រតិបត្តិការ ៖</p></translation>
     </message>
     <message>
         <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be mounted on the virtual machine and the machine will start execution.</p></source>
-        <translation type="obsolete"><p>ប្រសិន​បើ​ខា​ងលើ​ត្រឹមត្រូវ​ហើយ ចុច​ប៊ូតុង <b>បញ្ចប់</b> ។ នៅពេល​អ្នក​ចុច​វា មេឌៀ​ដែល​បាន​ជ្រើស​នឹង​ត្រូវ​បានម៉ោន​​លើ​ម៉ាស៊ីន​និម្មិត ហើយ​ម៉ាស៊ីន​នឹង​ចាប់ផ្ដើម​ប្រតិបត្តិ ។</p></translation>
+        <translation type="obsolete"><p>ប្រសិន​បើ​ខា​ងលើ​ត្រឹមត្រូវ​ហើយ ចុច​ប៊ូតុង <b>បញ្ចប់</b> ។ នៅពេល​អ្នក​ចុច​វា មេឌៀ​ដែល​បាន​ជ្រើស​នឹង​ត្រូវ​បានម៉ោន​​លើ​ម៉ាស៊ីន​និម្មិត ហើយ​ម៉ាស៊ីន​នឹង​ចាប់ផ្ដើម​ប្រតិបត្តិ ។</p></translation>
     </message>
     <message>
         <source>< &Back</source>
@@ -1763,18 +1988,18 @@ p, li { white-space: pre-wrap; }
     <name>UIFirstRunWzdPage1</name>
     <message>
         <source>Welcome to the First Run Wizard!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មកកាន់​អ្នក​ជំនួយកា​រដំបូង !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មកកាន់​អ្នក​ជំនួយកា​រដំបូង !</translation>
     </message>
 </context>
 <context>
     <name>UIFirstRunWzdPage2</name>
     <message>
         <source><p>Select the media which contains the setup program of the operating system you want to install. This media must be bootable, otherwise the setup program will not be able to start.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​មេឌៀ​ដែល​មាន​កម្មវិធីរៀបចំ​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​ចង់​ដំឡើង ។ មេឌៀ​នេះ​ត្រូវ​តែ​អាច​ចាប់ផ្ដើម​បាន បើ​មិនដូច្នេះ​ទេ កម្មវិធី​រៀបចំ​នឹង​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​មេឌៀ​ដែល​មាន​កម្មវិធីរៀបចំ​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​ចង់​ដំឡើង ។ មេឌៀ​នេះ​ត្រូវ​តែ​អាច​ចាប់ផ្ដើម​បាន បើ​មិនដូច្នេះ​ទេ កម្មវិធី​រៀបចំ​នឹង​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</p></translation>
     </message>
     <message>
         <source><p>Select the media that contains the operating system you want to work with. This media must be bootable, otherwise the operating system will not be able to start.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​មេឌៀ​ដែល​មាន​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​ចង់​ធ្វើការ​ជា​មួយ ។ មេឌៀ​នេះ​ត្រូវទេ​អាច​ចាប់ផ្ដើម​បាន បើ​មិន​ដូច្នេះ​ទេ ប្រព័ន្ធ​ប្រតិបត្តិការ​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​មេឌៀ​ដែល​មាន​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​ចង់​ធ្វើការ​ជា​មួយ ។ មេឌៀ​នេះ​ត្រូវទេ​អាច​ចាប់ផ្ដើម​បាន បើ​មិន​ដូច្នេះ​ទេ ប្រព័ន្ធ​ប្រតិបត្តិការ​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</p></translation>
     </message>
     <message>
         <source>Media Source</source>
@@ -1789,11 +2014,11 @@ p, li { white-space: pre-wrap; }
     <name>UIFirstRunWzdPage3</name>
     <message>
         <source><p>You have selected the following media to boot from:</p></source>
-        <translation type="obsolete"><p>អ្នក​បាន​ជ្រើស​មេឌៀ​ដូចខាងក្រោម​ដើម្បី​ចាប់ផ្ដើម ៖</p></translation>
+        <translation type="obsolete"><p>អ្នក​បាន​ជ្រើស​មេឌៀ​ដូចខាងក្រោម​ដើម្បី​ចាប់ផ្ដើម ៖</p></translation>
     </message>
     <message>
         <source><p>You have selected the following media to boot an operating system from:</p></source>
-        <translation type="obsolete"><p>អ្នក​បាន​ជ្រើស​មេឌៀ​ដូចខាង​ក្រោម​ដើម្បី​ចាប់ផ្ដើម​ប្រព័ន្ធ​ប្រតិបត្តិការ ៖</p></translation>
+        <translation type="obsolete"><p>អ្នក​បាន​ជ្រើស​មេឌៀ​ដូចខាង​ក្រោម​ដើម្បី​ចាប់ផ្ដើម​ប្រព័ន្ធ​ប្រតិបត្តិការ ៖</p></translation>
     </message>
     <message>
         <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be temporarily mounted on the virtual machine and the machine will start execution.</p><p>Please note that when you close the virtual machine, the specified media will be automatically unmounted and the boot device will be set back to the first hard disk.</p><p>Depending on the type of the setup program, you may need to manually  [...]
@@ -1801,7 +2026,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>If the above is correct, press the <b>Finish</b> button. Once you press it, the selected media will be mounted on the virtual machine and the machine will start execution.</p></source>
-        <translation type="obsolete"><p>ប្រសិន​បើ​ខា​ងលើ​ត្រឹមត្រូវ​ហើយ ចុច​ប៊ូតុង <b>បញ្ចប់</b> ។ នៅពេល​អ្នក​ចុច​វា មេឌៀ​ដែល​បាន​ជ្រើស​នឹង​ត្រូវ​បានម៉ោន​​លើ​ម៉ាស៊ីន​និម្មិត ហើយ​ម៉ាស៊ីន​នឹង​ចាប់ផ្ដើម​ប្រតិបត្តិ ។</p></translation>
+        <translation type="obsolete"><p>ប្រសិន​បើ​ខា​ងលើ​ត្រឹមត្រូវ​ហើយ ចុច​ប៊ូតុង <b>បញ្ចប់</b> ។ នៅពេល​អ្នក​ចុច​វា មេឌៀ​ដែល​បាន​ជ្រើស​នឹង​ត្រូវ​បានម៉ោន​​លើ​ម៉ាស៊ីន​និម្មិត ហើយ​ម៉ាស៊ីន​នឹង​ចាប់ផ្ដើម​ប្រតិបត្តិ ។</p></translation>
     </message>
     <message>
         <source>CD/DVD Device</source>
@@ -1948,11 +2173,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">មិន​បានភ្ជាប់</translation>
@@ -2161,29 +2381,124 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">វត្ថុ​បញ្ជា</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>None</source>
-        <comment>details</comment>
-        <translation type="obsolete">គ្មាន</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">សតិ​វីដេអូ</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">ឧបករណ៍​បញ្ជា​ USB</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">វត្ថុ​បញ្ជា</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">គ្មាន</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">សតិ​វីដេអូ</translation>
     </message>
 </context>
 <context>
@@ -2415,31 +2730,31 @@ p, li { white-space: pre-wrap; }
     <name>UIGlobalSettingsGeneral</name>
     <message>
         <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
-        <translation>បង្ហាញ​ផ្លូវ​ទៅ​កាន់​ថត​ម៉ាស៊ីន​និម្មិត​លំនាំដើម ។ ថត​នេះ​ត្រូវ​បាន​ប្រើ ប្រសិនបើ​មិន​បានបញ្ជាក់ជាក់លាក់​ទេ នៅពេល​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី ។</translation>
+        <translation>បង្ហាញ​ផ្លូវ​ទៅ​កាន់​ថត​ម៉ាស៊ីន​និម្មិត​លំនាំដើម ។ ថត​នេះ​ត្រូវ​បាន​ប្រើ ប្រសិនបើ​មិន​បានបញ្ជាក់ជាក់លាក់​ទេ នៅពេល​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី ។</translation>
     </message>
     <message>
         <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
-        <translation>បង្ហាញ​ផ្លូវ​ទៅ​បណ្ណាល័យ ដែល​ផ្ដល់​នូវ​ការ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ​សម្រាប់​ម៉ាស៊ីន​ភ្ញៀវ​បង្ហាញ​ពី​ចម្ងាយ (​VRDP) ។</translation>
+        <translation>បង្ហាញ​ផ្លូវ​ទៅ​បណ្ណាល័យ ដែល​ផ្ដល់​នូវ​ការ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ​សម្រាប់​ម៉ាស៊ីន​ភ្ញៀវ​បង្ហាញ​ពី​ចម្ងាយ (​VRDP) ។</translation>
     </message>
     <message>
         <source>Default &Hard Disk Folder:</source>
-        <translation type="obsolete">ថត​ថាសរឹង​លំនាំដើម ៖</translation>
+        <translation type="obsolete">ថត​ថាសរឹង​លំនាំដើម ៖</translation>
     </message>
     <message>
         <source>Default &Machine Folder:</source>
-        <translation>ថត​ម៉ាស៊ីន​លំនាំដើម ៖</translation>
+        <translation>ថត​ម៉ាស៊ីន​លំនាំដើម ៖</translation>
     </message>
     <message>
         <source>V&RDP Authentication Library:</source>
-        <translation>បណ្ណាល័យ​ការ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ​របស់ VRDP ៖</translation>
+        <translation>បណ្ណាល័យ​ការ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ​របស់ VRDP ៖</translation>
     </message>
     <message>
         <source>Holds the path to the default hard disk folder. This folder is used, if not explicitly specified otherwise, when adding existing or creating new virtual hard disks.</source>
-        <translation type="obsolete">បង្ហាញ​ផ្លូវ​ទៅ​កាន់​ថត​ថាសរឹង​លំនាំដើម ។ ថត​នេះ​ត្រូ​វបានប្រើ ប្រសិនបើ​គ្មាន​ការ​កំណត់​ជាក់លាក់ នៅពេលបន្ថែម​ថាសរឹង​និម្មិត​ថ្មី​ ឬ​មាន​ស្រាប់ ។</translation>
+        <translation type="obsolete">បង្ហាញ​ផ្លូវ​ទៅ​កាន់​ថត​ថាសរឹង​លំនាំដើម ។ ថត​នេះ​ត្រូ​វបានប្រើ ប្រសិនបើ​គ្មាន​ការ​កំណត់​ជាក់លាក់ នៅពេលបន្ថែម​ថាសរឹង​និម្មិត​ថ្មី​ ឬ​មាន​ស្រាប់ ។</translation>
     </message>
     <message>
         <source>When checked, the application will provide an icon with the context menu in the system tray.</source>
-        <translation type="obsolete">នៅពេល​បាន​គូស​ធីក កម្មវិធី​នឹង​ផ្ដល់​នូវ​រូបតំណាង​ដែល​មាន​ម៉ឺនុយ​បរិបទ​នៅ​ក្នុង​ថាស​ប្រព័ន្ធ ។</translation>
+        <translation type="obsolete">នៅពេល​បាន​គូស​ធីក កម្មវិធី​នឹង​ផ្ដល់​នូវ​រូបតំណាង​ដែល​មាន​ម៉ឺនុយ​បរិបទ​នៅ​ក្នុង​ថាស​ប្រព័ន្ធ ។</translation>
     </message>
     <message>
         <source>&Show System Tray Icon</source>
@@ -2447,7 +2762,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>When checked, the Dock Icon will reflect the VM window content in realtime.</source>
-        <translation type="obsolete">នៅពេលបានគូស​ធីក រូប​តំណាង​ចូលផែ​នឹង​ជះឥទ្ធិពល​លើ​មាតិកា​បង្អួច​ VM នៅ​ក្នុង realtime ។</translation>
+        <translation type="obsolete">នៅពេលបានគូស​ធីក រូប​តំណាង​ចូលផែ​នឹង​ជះឥទ្ធិពល​លើ​មាតិកា​បង្អួច​ VM នៅ​ក្នុង realtime ។</translation>
     </message>
     <message>
         <source>&Dock Icon Realtime Preview</source>
@@ -2458,18 +2773,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">បង្ហាញ​ចត​ដោយ​ស្វ័យ​ប្រវត្តិ​ និងរបារ​ម៉ឺនុយ​​អេក្រង់​ពេញ​</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2486,15 +2789,15 @@ p, li { white-space: pre-wrap; }
     <name>UIGlobalSettingsInput</name>
     <message>
         <source>Host &Key:</source>
-        <translation type="obsolete">គ្រាប់ចុច​ម៉ាស៊ីន ៖</translation>
+        <translation type="obsolete">គ្រាប់ចុច​ម៉ាស៊ីន ៖</translation>
     </message>
     <message>
         <source>Holds the key used as a Host Key in the VM window. Activate the entry field and press a new Host Key. Note that alphanumeric, cursor movement and editing keys cannot be used.</source>
-        <translation type="obsolete">បង្ហាញគ្រាប់ចុច​ដែល​បាន​ប្រើ​ជា​គ្រាប់​ចុច​ម៉ាស៊ីន​នៅ​ក្នុង​បង្អួច VM ។ ធ្វើ​ឲ្យ​វាល​ធាតុ​សកម្ម ហើយ​ចុច​គ្រាប់ចុច​ម៉ាស៊ីន​ថ្មី ។ ចំណាំថា​លេខ ចលនា​ទស្សន៍ទ្រនិច និង​គ្រាប់ចុចកែសម្រួល​មិនអាច​ត្រូវ​បាន​ប្រើ​ជា​គ្រាប់ចុច​ម៉ាស៊ីន​ទេ ។</translation>
+        <translation type="obsolete">បង្ហាញគ្រាប់ចុច​ដែល​បាន​ប្រើ​ជា​គ្រាប់​ចុច​ម៉ាស៊ីន​នៅ​ក្នុង​បង្អួច VM ។ ធ្វើ​ឲ្យ​វាល​ធាតុ​សកម្ម ហើយ​ចុច​គ្រាប់ចុច​ម៉ាស៊ីន​ថ្មី ។ ចំណាំថា​លេខ ចលនា​ទស្សន៍ទ្រនិច និង​គ្រាប់ចុចកែសម្រួល​មិនអាច​ត្រូវ​បាន​ប្រើ​ជា​គ្រាប់ចុច​ម៉ាស៊ីន​ទេ ។</translation>
     </message>
     <message>
         <source>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</source>
-        <translation type="unfinished">នៅពេល​បានគូស​ធីក ក្ដារចុច​ត្រូ​វបាន​ចាប់យក​ដោយ​ស្វ័យ​ប្រវត្តិ​រាល់ពេល​ដែល​បង្អួច VM ត្រូវ​បាន​ធ្វើ​ឲ្យ​សកម្ម ។ នៅពេល​ក្ដារចុច​ត្រូវ​បាន​ចាប់យក  keystrokes (រួម​មាន​ប្រព័ន្ធ​​មួយ ដូចជា ជំនួស(Alt)-ថេប(Tab)) ត្រូវ​បាន​បញ្ជូន​ទៅ​កាន់ VM ។</translation>
+        <translation type="unfinished">នៅពេល​បានគូស​ធីក ក្ដារចុច​ត្រូ​វបាន​ចាប់យក​ដោយ​ស្វ័យ​ប្រវត្តិ​រាល់ពេល​ដែល​បង្អួច VM ត្រូវ​បាន​ធ្វើ​ឲ្យ​សកម្ម ។ នៅពេល​ក្ដារចុច​ត្រូវ​បាន​ចាប់យក  keystrokes (រួម​មាន​ប្រព័ន្ធ​​មួយ ដូចជា ជំនួស(Alt)-ថេប(Tab)) ត្រូវ​បាន​បញ្ជូន​ទៅ​កាន់ VM ។</translation>
     </message>
     <message>
         <source>&Auto Capture Keyboard</source>
@@ -2549,15 +2852,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Language:</source>
-        <translation>ភាសា ៖</translation>
+        <translation>ភាសា ៖</translation>
     </message>
     <message>
         <source>&Interface Language:</source>
-        <translation type="obsolete">ភាសា​ចំណុច​ប្រទាក់ ៖</translation>
+        <translation type="obsolete">ភាសា​ចំណុច​ប្រទាក់ ៖</translation>
     </message>
     <message>
         <source>Lists all available user interface languages. The effective language is written in <b>bold</b>. Select <i>Default</i> to reset to the system default language.</source>
-        <translation>រាយ​ភាសា​ចំណុច​ប្រទាក់​អ្នក​ប្រើ​ដែល​អាច​ប្រើ​បាន ។ ភាសា​ដែល​មានប្រសិទ្ធភាព​ត្រូវ​បាន​សរសេរ​ <b>ដិត</b> ។ ជ្រើស <i>លំនាំដើម</i> ដើម្បី​កំណត់​ភាសា​លំនាំដើម​របស់​ប្រព័ន្ធ​ឡើង​វិញ ។</translation>
+        <translation>រាយ​ភាសា​ចំណុច​ប្រទាក់​អ្នក​ប្រើ​ដែល​អាច​ប្រើ​បាន ។ ភាសា​ដែល​មានប្រសិទ្ធភាព​ត្រូវ​បាន​សរសេរ​ <b>ដិត</b> ។ ជ្រើស <i>លំនាំដើម</i> ដើម្បី​កំណត់​ភាសា​លំនាំដើម​របស់​ប្រព័ន្ធ​ឡើង​វិញ ។</translation>
     </message>
     <message>
         <source>Name</source>
@@ -2577,7 +2880,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Author(s):</source>
-        <translation>អ្នកនិពន្ធ ៖</translation>
+        <translation>អ្នកនិពន្ធ ៖</translation>
     </message>
     <message>
         <source>&Interface Languages</source>
@@ -2757,11 +3060,11 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>&Host-only Networks:</source>
-        <translation type="obsolete">បណ្ដាញ​ម៉ាស៊ីន​ប៉ុណ្ណោះ ៖</translation>
+        <translation type="obsolete">បណ្ដាញ​ម៉ាស៊ីន​ប៉ុណ្ណោះ ៖</translation>
     </message>
     <message>
         <source>Lists all available host-only networks.</source>
-        <translation>រាយ​បណ្ដាញ​ម៉ាស៊ីន​ដែលអាច​ប្រើបាន ។</translation>
+        <translation>រាយ​បណ្ដាញ​ម៉ាស៊ីន​ដែលអាច​ប្រើបាន ។</translation>
     </message>
     <message>
         <source>Name</source>
@@ -2975,27 +3278,27 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation type="obsolete">របាំង​បណ្តាញ​ IPv4 ៖</translation>
+        <translation type="obsolete">របាំង​បណ្តាញ​ IPv4 ៖</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation type="obsolete">បង្ហាញ​របាំង​បណ្តាញ​ម៉ាស៊ីន​ IPv4 សម្រាប់​អាដាប់​ទ័រ​នេះ​ ។</translation>
+        <translation type="obsolete">បង្ហាញ​របាំង​បណ្តាញ​ម៉ាស៊ីន​ IPv4 សម្រាប់​អាដាប់​ទ័រ​នេះ​ ។</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation type="obsolete">អាសយដ្ឋាន​ IPv6 ៖</translation>
+        <translation type="obsolete">អាសយដ្ឋាន​ IPv6 ៖</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation type="obsolete">បង្ហាញ​​អា​សយដ្ឋាន​ម៉ាស៊ីន​ IPv6 សម្រាប់​​អាដាប់​ទ័រ​​នេះ ​ប្រ​សិន​បើ​​ IPv6 ត្រូវ​បាន​គាំ​ទ្រ ។</translation>
+        <translation type="obsolete">បង្ហាញ​​អា​សយដ្ឋាន​ម៉ាស៊ីន​ IPv6 សម្រាប់​​អាដាប់​ទ័រ​​នេះ ​ប្រ​សិន​បើ​​ IPv6 ត្រូវ​បាន​គាំ​ទ្រ ។</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation type="obsolete">ប្រ​វែង​របាំង​បណ្តាញ​ IPv6 ៖</translation>
+        <translation type="obsolete">ប្រ​វែង​របាំង​បណ្តាញ​ IPv6 ៖</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation type="obsolete">បង្ហាញ​ប្រ​វែង​​បុព្វបទ​របាំង​បណ្តាញ​ម៉ាស៊ីន​ IPv6​ សម្រាប់​​អាដាប់​ទ័រ​​នេះ ​ប្រ​សិន​បើ​ IPv6 ត្រូវ​បាន​គាំ​ទ្រ​ ។</translation>
+        <translation type="obsolete">បង្ហាញ​ប្រ​វែង​​បុព្វបទ​របាំង​បណ្តាញ​ម៉ាស៊ីន​ IPv6​ សម្រាប់​​អាដាប់​ទ័រ​​នេះ ​ប្រ​សិន​បើ​ IPv6 ត្រូវ​បាន​គាំ​ទ្រ​ ។</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
@@ -3007,11 +3310,11 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation type="obsolete">បង្ហាញ​​ថា​តើ​ម៉ា​ស៊ីន​បម្រើ​​ DHCP ត្រូវ​បាន​បើក​នៅពេល​ចាប់ផ្ដើម​ដែរ​ឬទេ ។</translation>
+        <translation type="obsolete">បង្ហាញ​​ថា​តើ​ម៉ា​ស៊ីន​បម្រើ​​ DHCP ត្រូវ​បាន​បើក​នៅពេល​ចាប់ផ្ដើម​ដែរ​ឬទេ ។</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation type="obsolete">អាសយដ្ឋាន​ម៉ាស៊ីន​បម្រើ​ ៖</translation>
+        <translation type="obsolete">អាសយដ្ឋាន​ម៉ាស៊ីន​បម្រើ​ ៖</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
@@ -3019,27 +3322,27 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation type="obsolete">របាំង​ម៉ា​ស៊ីនបម្រើ​ ៖</translation>
+        <translation type="obsolete">របាំង​ម៉ា​ស៊ីនបម្រើ​ ៖</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="obsolete">បង្ហាញ​របាំង​បណ្តាញ​​សេវា​​បម្រើ​ម៉ា​ស៊ីន​របស់​ DHCP ដែល​ភ្ជាប់​​​ជា​មួយ​កម្ម​វិធី​សម្រួល​ម៉ា​ស៊ីន​​-​តែ​មួយ​នេះ​ ។</translation>
+        <translation type="obsolete">បង្ហាញ​របាំង​បណ្តាញ​​សេវា​​បម្រើ​ម៉ា​ស៊ីន​របស់​ DHCP ដែល​ភ្ជាប់​​​ជា​មួយ​កម្ម​វិធី​សម្រួល​ម៉ា​ស៊ីន​​-​តែ​មួយ​នេះ​ ។</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation type="obsolete">ព្រំ​ដែន​អា​សយ​ដ្ឋាន​ទាប​ ៖</translation>
+        <translation type="obsolete">ព្រំ​ដែន​អា​សយ​ដ្ឋាន​ទាប​ ៖</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="obsolete">បង្ហាញ​ព្រំដែន​អាសយដ្ឋានទាប​ដែល​បានផ្ដល់ដោយ​សេវា​ម៉ាស៊ីន​បម្រើ DHCP ដែល​បានភ្ជាប់​ជា​មួយនឹងកម្មវិធី​សម្រួល​ម៉ាស៊ីន​ ។</translation>
+        <translation type="obsolete">បង្ហាញ​ព្រំដែន​អាសយដ្ឋានទាប​ដែល​បានផ្ដល់ដោយ​សេវា​ម៉ាស៊ីន​បម្រើ DHCP ដែល​បានភ្ជាប់​ជា​មួយនឹងកម្មវិធី​សម្រួល​ម៉ាស៊ីន​ ។</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation type="obsolete">ព្រំដែន​អា​សយដ្ឋានខ្ពស់​ ៖</translation>
+        <translation type="obsolete">ព្រំដែន​អា​សយដ្ឋានខ្ពស់​ ៖</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="obsolete">បង្ហាញ​ព្រំដែន​អាសយដ្ឋាន​ខ្ពស់​ដែលបានផ្ដល់​ដោយ​ម៉ាស៊ីន​បម្រើ DHCP ដោយ​ផ្ដល់​សេវា​បណ្ដាញ​ភ្ជាប់​ជា​មួយ​នឹង​អាដាប់ទ័រ​ម៉ាស៊ីន​ ។</translation>
+        <translation type="obsolete">បង្ហាញ​ព្រំដែន​អាសយដ្ឋាន​ខ្ពស់​ដែលបានផ្ដល់​ដោយ​ម៉ាស៊ីន​បម្រើ DHCP ដោយ​ផ្ដល់​សេវា​បណ្ដាញ​ភ្ជាប់​ជា​មួយ​នឹង​អាដាប់ទ័រ​ម៉ាស៊ីន​ ។</translation>
     </message>
 </context>
 <context>
@@ -3070,27 +3373,27 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation type="unfinished">របាំង​បណ្តាញ​ IPv4 ៖</translation>
+        <translation type="unfinished">របាំង​បណ្តាញ​ IPv4 ៖</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation type="unfinished">បង្ហាញ​របាំង​បណ្តាញ​ម៉ាស៊ីន​ IPv4 សម្រាប់​អាដាប់​ទ័រ​នេះ​ ។</translation>
+        <translation type="unfinished">បង្ហាញ​របាំង​បណ្តាញ​ម៉ាស៊ីន​ IPv4 សម្រាប់​អាដាប់​ទ័រ​នេះ​ ។</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation type="unfinished">អាសយដ្ឋាន​ IPv6 ៖</translation>
+        <translation type="unfinished">អាសយដ្ឋាន​ IPv6 ៖</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation type="unfinished">បង្ហាញ​​អា​សយដ្ឋាន​ម៉ាស៊ីន​ IPv6 សម្រាប់​​អាដាប់​ទ័រ​​នេះ ​ប្រ​សិន​បើ​​ IPv6 ត្រូវ​បាន​គាំ​ទ្រ ។</translation>
+        <translation type="unfinished">បង្ហាញ​​អា​សយដ្ឋាន​ម៉ាស៊ីន​ IPv6 សម្រាប់​​អាដាប់​ទ័រ​​នេះ ​ប្រ​សិន​បើ​​ IPv6 ត្រូវ​បាន​គាំ​ទ្រ ។</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation type="unfinished">ប្រ​វែង​របាំង​បណ្តាញ​ IPv6 ៖</translation>
+        <translation type="unfinished">ប្រ​វែង​របាំង​បណ្តាញ​ IPv6 ៖</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation type="unfinished">បង្ហាញ​ប្រ​វែង​​បុព្វបទ​របាំង​បណ្តាញ​ម៉ាស៊ីន​ IPv6​ សម្រាប់​​អាដាប់​ទ័រ​​នេះ ​ប្រ​សិន​បើ​ IPv6 ត្រូវ​បាន​គាំ​ទ្រ​ ។</translation>
+        <translation type="unfinished">បង្ហាញ​ប្រ​វែង​​បុព្វបទ​របាំង​បណ្តាញ​ម៉ាស៊ីន​ IPv6​ សម្រាប់​​អាដាប់​ទ័រ​​នេះ ​ប្រ​សិន​បើ​ IPv6 ត្រូវ​បាន​គាំ​ទ្រ​ ។</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
@@ -3102,11 +3405,11 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation type="unfinished">បង្ហាញ​​ថា​តើ​ម៉ា​ស៊ីន​បម្រើ​​ DHCP ត្រូវ​បាន​បើក​នៅពេល​ចាប់ផ្ដើម​ដែរ​ឬទេ ។</translation>
+        <translation type="unfinished">បង្ហាញ​​ថា​តើ​ម៉ា​ស៊ីន​បម្រើ​​ DHCP ត្រូវ​បាន​បើក​នៅពេល​ចាប់ផ្ដើម​ដែរ​ឬទេ ។</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation type="unfinished">អាសយដ្ឋាន​ម៉ាស៊ីន​បម្រើ​ ៖</translation>
+        <translation type="unfinished">អាសយដ្ឋាន​ម៉ាស៊ីន​បម្រើ​ ៖</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
@@ -3114,27 +3417,27 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation type="unfinished">របាំង​ម៉ា​ស៊ីនបម្រើ​ ៖</translation>
+        <translation type="unfinished">របាំង​ម៉ា​ស៊ីនបម្រើ​ ៖</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished">បង្ហាញ​របាំង​បណ្តាញ​​សេវា​​បម្រើ​ម៉ា​ស៊ីន​របស់​ DHCP ដែល​ភ្ជាប់​​​ជា​មួយ​កម្ម​វិធី​សម្រួល​ម៉ា​ស៊ីន​​-​តែ​មួយ​នេះ​ ។</translation>
+        <translation type="unfinished">បង្ហាញ​របាំង​បណ្តាញ​​សេវា​​បម្រើ​ម៉ា​ស៊ីន​របស់​ DHCP ដែល​ភ្ជាប់​​​ជា​មួយ​កម្ម​វិធី​សម្រួល​ម៉ា​ស៊ីន​​-​តែ​មួយ​នេះ​ ។</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation type="unfinished">ព្រំ​ដែន​អា​សយ​ដ្ឋាន​ទាប​ ៖</translation>
+        <translation type="unfinished">ព្រំ​ដែន​អា​សយ​ដ្ឋាន​ទាប​ ៖</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished">បង្ហាញ​ព្រំដែន​អាសយដ្ឋានទាប​ដែល​បានផ្ដល់ដោយ​សេវា​ម៉ាស៊ីន​បម្រើ DHCP ដែល​បានភ្ជាប់​ជា​មួយនឹងកម្មវិធី​សម្រួល​ម៉ាស៊ីន​ ។</translation>
+        <translation type="unfinished">បង្ហាញ​ព្រំដែន​អាសយដ្ឋានទាប​ដែល​បានផ្ដល់ដោយ​សេវា​ម៉ាស៊ីន​បម្រើ DHCP ដែល​បានភ្ជាប់​ជា​មួយនឹងកម្មវិធី​សម្រួល​ម៉ាស៊ីន​ ។</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation type="unfinished">ព្រំដែន​អា​សយដ្ឋានខ្ពស់​ ៖</translation>
+        <translation type="unfinished">ព្រំដែន​អា​សយដ្ឋានខ្ពស់​ ៖</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation type="unfinished">បង្ហាញ​ព្រំដែន​អាសយដ្ឋាន​ខ្ពស់​ដែលបានផ្ដល់​ដោយ​ម៉ាស៊ីន​បម្រើ DHCP ដោយ​ផ្ដល់​សេវា​បណ្ដាញ​ភ្ជាប់​ជា​មួយ​នឹង​អាដាប់ទ័រ​ម៉ាស៊ីន​ ។</translation>
+        <translation type="unfinished">បង្ហាញ​ព្រំដែន​អាសយដ្ឋាន​ខ្ពស់​ដែលបានផ្ដល់​ដោយ​ម៉ាស៊ីន​បម្រើ DHCP ដោយ​ផ្ដល់​សេវា​បណ្ដាញ​ភ្ជាប់​ជា​មួយ​នឹង​អាដាប់ទ័រ​ម៉ាស៊ីន​ ។</translation>
     </message>
 </context>
 <context>
@@ -3258,7 +3561,7 @@ creating/removing host-only network</comment>
     <name>UIGlobalSettingsUpdate</name>
     <message>
         <source>When checked, the application will periodically connect to the VirtualBox website and check whether a new VirtualBox version is available.</source>
-        <translation>នៅពេល​បាន​គូសធីក កម្មវិធី​នឹង​តភ្ជាប់​ទៅ​កាន់តំបន់បណ្ដាញ VirtualBox តាម​កាល​កំណត់ ហើយ​ពិនិត្យ​មើល​ថាតើ​មានកំណែ VirtualBox ដែរឬទេ ។</translation>
+        <translation>នៅពេល​បាន​គូសធីក កម្មវិធី​នឹង​តភ្ជាប់​ទៅ​កាន់តំបន់បណ្ដាញ VirtualBox តាម​កាល​កំណត់ ហើយ​ពិនិត្យ​មើល​ថាតើ​មានកំណែ VirtualBox ដែរឬទេ ។</translation>
     </message>
     <message>
         <source>&Check for Updates</source>
@@ -3266,23 +3569,23 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>&Once per:</source>
-        <translation>ម្ដង​ក្នុង ៖</translation>
+        <translation>ម្ដង​ក្នុង ៖</translation>
     </message>
     <message>
         <source>Specifies how often the new version check should be performed. Note that if you want to completely disable this check, just clear the above check box.</source>
-        <translation>បញ្ជាក់​វិធី​ដែល​កំណែ​ថ្មី​ពិនិត្យ​មើល​គួរ​ត្រូវ​បាន​អនុវត្ត​ ។ ចំណាំថា ប្រសិនបើ​ង្នក​ចង់​បញ្ចប់ បិទ​ការ​ពិនិត្យនេះ គ្រាន់តែ​ជម្រះ​ប្រអប់​គូស​ធីក​ខាង​លើ ។</translation>
+        <translation>បញ្ជាក់​វិធី​ដែល​កំណែ​ថ្មី​ពិនិត្យ​មើល​គួរ​ត្រូវ​បាន​អនុវត្ត​ ។ ចំណាំថា ប្រសិនបើ​ង្នក​ចង់​បញ្ចប់ បិទ​ការ​ពិនិត្យនេះ គ្រាន់តែ​ជម្រះ​ប្រអប់​គូស​ធីក​ខាង​លើ ។</translation>
     </message>
     <message>
         <source>Next Check:</source>
-        <translation>ការ​ពិនិត្យ​មើល​បន្ទាប់ ៖</translation>
+        <translation>ការ​ពិនិត្យ​មើល​បន្ទាប់ ៖</translation>
     </message>
     <message>
         <source>Check for:</source>
-        <translation>ពិនិត្យ​មើល ៖</translation>
+        <translation>ពិនិត្យ​មើល ៖</translation>
     </message>
     <message>
         <source><p>Choose this if you only wish to be notified about stable updates to VirtualBox.</p></source>
-        <translation><p>ជ្រើសវា​ ប្រសិនបើ​អ្នក​ចង់​ឲ្យ​ជូន​ដំណឹង​អំពី​ភាព​ទាន់សម័យ​ស្ថិតស្ថេរ​ដល់ VirtualBox ។</p></translation>
+        <translation><p>ជ្រើសវា​ ប្រសិនបើ​អ្នក​ចង់​ឲ្យ​ជូន​ដំណឹង​អំពី​ភាព​ទាន់សម័យ​ស្ថិតស្ថេរ​ដល់ VirtualBox ។</p></translation>
     </message>
     <message>
         <source>&Stable Release Versions</source>
@@ -3290,7 +3593,7 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source><p>Choose this if you wish to be notified about all new VirtualBox releases.</p></source>
-        <translation><p>ជ្រើសវា​ ប្រសិន​បើ​អ្នក​ចង់​ឲ្យ​ជូន​ដំណឹង​អំពី​ការ​ចេញផ្សាយ​ VirtualBox ថ្មី ។</p></translation>
+        <translation><p>ជ្រើសវា​ ប្រសិន​បើ​អ្នក​ចង់​ឲ្យ​ជូន​ដំណឹង​អំពី​ការ​ចេញផ្សាយ​ VirtualBox ថ្មី ។</p></translation>
     </message>
     <message>
         <source>&All New Releases</source>
@@ -3298,7 +3601,7 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source><p>Choose this to be notified about all new VirtualBox releases and pre-release versions of VirtualBox.</p></source>
-        <translation><p>ជ្រើស​វាដើម្បី​ឲ្យ​ជូន​ដំណឹង​អំពី​​កំណែ​​ចេញផ្សាយ​​​របស់ VirtualBox និង​និងចេញ​ផ្សាយ​មុន​របស់ VirtualBox ។</p></translation>
+        <translation><p>ជ្រើស​វាដើម្បី​ឲ្យ​ជូន​ដំណឹង​អំពី​​កំណែ​​ចេញផ្សាយ​​​របស់ VirtualBox និង​និងចេញ​ផ្សាយ​មុន​របស់ VirtualBox ។</p></translation>
     </message>
     <message>
         <source>All New Releases and &Pre-Releases</source>
@@ -3601,7 +3904,7 @@ creating/removing host-only network</comment>
     </message>
     <message>
         <source>Welcome to the Appliance Import Wizard!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​អ្នក​ជំនួយកា​រនាំចូល​ឧបករណ៍ !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​អ្នក​ជំនួយកា​រនាំចូល​ឧបករណ៍ !</translation>
     </message>
     <message>
         <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
@@ -3615,9 +3918,9 @@ p, li { white-space: pre-wrap; }
 <html><head><meta name="qrichtext" content="1" /><style type="text/css">
 p, li { white-space: pre-wrap; }
 </style></head><body>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">អ្នក​ជំនួយ​ការ​នេះ​នឹង​នាំយក​​តាម​រយៈ​ការ​នាំចូល​ឧបករណ៍ ។</p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">ប្រើ​ប៊ូតុង <span style=" font-weight:600;">បន្ទាប់</span> ទៅ​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយ​ការ និងប៊ូតុង​ <span style=" font-weight:600;">ថយក្រោយ</span> ដើម្បី​ត្រឡប់​ទៅ​ទំព័រ​មុន ។</p>
-<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">បច្ចុប្បន្ន VirtualBox គាំទ្រ​ការ​នាំចូល​ឧបករណ៍ ដែលបាន​រក្សាទុក​នៅ​ក្នុង​ទ្រង់ទ្រាយ Open Virtualization Format (OVF) ។ ដើម្បី​បន្ត ជ្រើស​ឯកសារ​​ត្រូវ​នាំ​ចូល​ខាង​ក្រោម ៖</p></body></html></translation>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">អ្នក​ជំនួយ​ការ​នេះ​នឹង​នាំយក​​តាម​រយៈ​ការ​នាំចូល​ឧបករណ៍ ។</p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">ប្រើ​ប៊ូតុង <span style=" font-weight:600;">បន្ទាប់</span> ទៅ​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយ​ការ និងប៊ូតុង​ <span style=" font-weight:600;">ថយក្រោយ</span> ដើម្បី​ត្រឡប់​ទៅ​ទំព័រ​មុន ។</p>
+<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">បច្ចុប្បន្ន VirtualBox គាំទ្រ​ការ​នាំចូល​ឧបករណ៍ ដែលបាន​រក្សាទុក​នៅ​ក្នុង​ទ្រង់ទ្រាយ Open Virtualization Format (OVF) ។ ដើម្បី​បន្ត ជ្រើស​ឯកសារ​​ត្រូវ​នាំ​ចូល​ខាង​ក្រោម ៖</p></body></html></translation>
     </message>
     <message>
         <source>< &Back</source>
@@ -3637,7 +3940,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
-        <translation type="obsolete">មាន​ម៉ាស៊ីន​និម្មិត​ដែល​មាន​នៅ​ក្នុង​ឧបករណ៍​ និង​ការ​កំណត់​ដែលបាន​ស្នើ​របស់ម៉ាស៊ីន VirtualBox ដែល​បាននាំចូល ។ អ្នក​អាច​ផ្លាស់ប្ដូរ​លក្ខណសម្បត្តិ​ដែលបានបង្ហាញ​ដោយ​ចុច​ទ្វេដង​លើ​ធាតុ និងបិទ​​លក្ខណសម្បត្តិ​ផ្សេងៗ​ទៀត ដោយ​ប្រើ​ប្រ​អប់ធីក​ខាង​ក្រោម ។</translation>
+        <translation type="obsolete">មាន​ម៉ាស៊ីន​និម្មិត​ដែល​មាន​នៅ​ក្នុង​ឧបករណ៍​ និង​ការ​កំណត់​ដែលបាន​ស្នើ​របស់ម៉ាស៊ីន VirtualBox ដែល​បាននាំចូល ។ អ្នក​អាច​ផ្លាស់ប្ដូរ​លក្ខណសម្បត្តិ​ដែលបានបង្ហាញ​ដោយ​ចុច​ទ្វេដង​លើ​ធាតុ និងបិទ​​លក្ខណសម្បត្តិ​ផ្សេងៗ​ទៀត ដោយ​ប្រើ​ប្រ​អប់ធីក​ខាង​ក្រោម ។</translation>
     </message>
     <message>
         <source>Restore Defaults</source>
@@ -3660,14 +3963,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Welcome to the Appliance Import Wizard!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​អ្នក​ជំនួយកា​រនាំចូល​ឧបករណ៍ !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​អ្នក​ជំនួយកា​រនាំចូល​ឧបករណ៍ !</translation>
     </message>
 </context>
 <context>
     <name>UIImportApplianceWzdPage2</name>
     <message>
         <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
-        <translation type="obsolete">មាន​ម៉ាស៊ីន​និម្មិត​ដែល​មាន​នៅ​ក្នុង​ឧបករណ៍​ និង​ការ​កំណត់​ដែលបាន​ស្នើ​របស់ម៉ាស៊ីន VirtualBox ដែល​បាននាំចូល ។ អ្នក​អាច​ផ្លាស់ប្ដូរ​លក្ខណសម្បត្តិ​ដែលបានបង្ហាញ​ដោយ​ចុច​ទ្វេដង​លើ​ធាតុ និងបិទ​​លក្ខណសម្បត្តិ​ផ្សេងៗ​ទៀត ដោយ​ប្រើ​ប្រ​អប់ធីក​ខាង​ក្រោម ។</translation>
+        <translation type="obsolete">មាន​ម៉ាស៊ីន​និម្មិត​ដែល​មាន​នៅ​ក្នុង​ឧបករណ៍​ និង​ការ​កំណត់​ដែលបាន​ស្នើ​របស់ម៉ាស៊ីន VirtualBox ដែល​បាននាំចូល ។ អ្នក​អាច​ផ្លាស់ប្ដូរ​លក្ខណសម្បត្តិ​ដែលបានបង្ហាញ​ដោយ​ចុច​ទ្វេដង​លើ​ធាតុ និងបិទ​​លក្ខណសម្បត្តិ​ផ្សេងៗ​ទៀត ដោយ​ប្រើ​ប្រ​អប់ធីក​ខាង​ក្រោម ។</translation>
     </message>
     <message>
         <source>Appliance Import Settings</source>
@@ -3714,22 +4017,22 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the virtual hard disks:</nobr>%1</p></source>
         <comment>HDD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថាសរឹង​និម្មិត ៖</nobr>%1</p></translation>
+        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថាសរឹង​និម្មិត ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>បង្ហាញ​​សកម្ម​ភាព​​​របស់​ឧបករណ៍​​ស៊ី​ឌី​​/ឌីវីឌី ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​​សកម្ម​ភាព​​​របស់​ឧបករណ៍​​ស៊ី​ឌី​​/ឌីវីឌី ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍​ថាស​ទន់ ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍​ថាស​ទន់ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ចំណុច​ប្រទាក់​បណ្ដាញ ៖</nobr>%1</p></translation>
+        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ចំណុច​ប្រទាក់​បណ្ដាញ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr></source>
@@ -3754,7 +4057,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the attached USB devices:</nobr>%1</p></source>
         <comment>USB device tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍ USB ដែល​បាន​ភ្ជាប់ ៖</nobr>%1</p></translation>
+        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍ USB ដែល​បាន​ភ្ជាប់ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><br><nobr><b>No USB devices attached</b></nobr></source>
@@ -3764,12 +4067,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>វត្ថុ​បញ្ជា USB ត្រូវ​បាន​បិទ</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>វត្ថុ​បញ្ជា USB ត្រូវ​បាន​បិទ</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
         <comment>Shared folders tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថត​ដែល​បានចែករំលែក​របស់​ម៉ាស៊ីន ៖</nobr>%1</p></translation>
+        <translation><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថត​ដែល​បានចែករំលែក​របស់​ម៉ាស៊ីន ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><br><nobr><b>No shared folders</b></nobr></source>
@@ -3778,7 +4081,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Indicates whether the Remote Display (VRDP Server) is enabled (<img src=:/vrdp_16px.png/>) or not (<img src=:/vrdp_disabled_16px.png/>).</source>
-        <translation type="obsolete">បង្ហាញ​ថាតើ​ការ​បង្ហាញ​ពី​ចម្ងាយ (ម៉ាស៊ីន​បម្រើ VRDP) ត្រូវ​បានបើក (<img src=:/vrdp_16px.png/>) ឬ​អត់ (<img src=:/vrdp_disabled_16px.png/>) ។</translation>
+        <translation type="obsolete">បង្ហាញ​ថាតើ​ការ​បង្ហាញ​ពី​ចម្ងាយ (ម៉ាស៊ីន​បម្រើ VRDP) ត្រូវ​បានបើក (<img src=:/vrdp_16px.png/>) ឬ​អត់ (<img src=:/vrdp_disabled_16px.png/>) ។</translation>
     </message>
     <message>
         <source><hr>The VRDP Server is listening on port %1</source>
@@ -3787,7 +4090,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Indicates the status of the hardware virtualization features used by this virtual machine:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation type="obsolete">បង្ហាញថា ​ស្ថាន​ភាព​របស់​លក្ខណៈពិសេស​និម្មិត​ផ្នែក​រឹង​ត្រូ​វបាន​ប្រើ​ដោយ​ម៉ាស៊ីន​និម្មិត​នេះ ៖​<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></translation>
+        <translation type="obsolete">បង្ហាញថា ​ស្ថាន​ភាព​របស់​លក្ខណៈពិសេស​និម្មិត​ផ្នែក​រឹង​ត្រូ​វបាន​ប្រើ​ដោយ​ម៉ាស៊ីន​និម្មិត​នេះ ៖​<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></translation>
     </message>
     <message>
         <source><br><nobr><b>%1:</b>&nbsp;%2</nobr></source>
@@ -3796,11 +4099,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Indicates whether the host mouse pointer is captured by the guest OS:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer is captured</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;mouse integration (MI) is On</nobr><br><nobr><img src=:/mouse_can_seamless_ [...]
-        <translation>បង្ហាញថា​តើ​ទស្សន៍​ទ្រនិច​កណ្ដុរ​របស់​ម៉ាស៊ីន​ត្រូ​វបាន​ចាប់យក​ដោយ​ប្រព័ន្ធ​ប្រតបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ដែរឬទេ ៖<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;ទស្សន៍​ទ្រនិច​មិន​ត្រូ​វបាន​ចាប់យក​ទេ</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;ទស្សន៍​ទ្រនិច​ត្រូវ​បាន​ចាប់យក</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;ការ​រួម​បញ្ចូល​កណ្ដ [...]
+        <translation>បង្ហាញថា​តើ​ទស្សន៍​ទ្រនិច​កណ្ដុរ​របស់​ម៉ាស៊ីន​ត្រូ​វបាន​ចាប់យក​ដោយ​ប្រព័ន្ធ​ប្រតបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ដែរឬទេ ៖<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;ទស្សន៍​ទ្រនិច​មិន​ត្រូ​វបាន​ចាប់យក​ទេ</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;ទស្សន៍​ទ្រនិច​ត្រូវ​បាន​ចាប់យក</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;ការ​រួម​បញ្ចូល​កណ្ដ [...]
     </message>
     <message>
         <source>Indicates whether the keyboard is captured by the guest OS (<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>).</source>
-        <translation>បង្ហាញ​ថាតើ​ក្ដារចុច​ត្រូវ​បានចាប់យក​ដោយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ (<img src=:/hostkey_captured_16px.png/>) ឬ​មិនមែន (<img src=:/hostkey_16px.png/>) ។</translation>
+        <translation>បង្ហាញ​ថាតើ​ក្ដារចុច​ត្រូវ​បានចាប់យក​ដោយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ (<img src=:/hostkey_captured_16px.png/>) ឬ​មិនមែន (<img src=:/hostkey_16px.png/>) ។</translation>
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
@@ -3819,6 +4122,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -3902,7 +4219,7 @@ p, li { white-space: pre-wrap; }
     <name>UIMachineSettingsAudio</name>
     <message>
         <source>When checked, a virtual PCI audio card will be plugged into the virtual machine and will communicate with the host audio system using the specified driver.</source>
-        <translation>នៅពេល​បាន​គូស​ធីក កាត​អូឌីយ៉ូ PCI និម្មិត​នៅ​ក្នុង​ម៉ាស៊ីន​និម្មិត ​ដែល​ប្រើ​កម្មវិធី​បញ្ជា​ដែល​បានបញ្ជាក់​ទាក់ទង​ទៅ​កាត​អូឌីយ៉ូ​របស់​ម៉ាស៊ីន ។</translation>
+        <translation>នៅពេល​បាន​គូស​ធីក កាត​អូឌីយ៉ូ PCI និម្មិត​នៅ​ក្នុង​ម៉ាស៊ីន​និម្មិត ​ដែល​ប្រើ​កម្មវិធី​បញ្ជា​ដែល​បានបញ្ជាក់​ទាក់ទង​ទៅ​កាត​អូឌីយ៉ូ​របស់​ម៉ាស៊ីន ។</translation>
     </message>
     <message>
         <source>Enable &Audio</source>
@@ -3910,30 +4227,30 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host Audio &Driver:</source>
-        <translation>កម្មវិធី​បញ្ជា​អូឌីយ៉ូ​របស់​ម៉ាស៊ីន ៖</translation>
+        <translation>កម្មវិធី​បញ្ជា​អូឌីយ៉ូ​របស់​ម៉ាស៊ីន ៖</translation>
     </message>
     <message>
         <source>Controls the audio output driver. The <b>Null Audio Driver</b> makes the guest see an audio card, however every access to it will be ignored.</source>
-        <translation>ត្រួតពិនិត្យ​កម្មវិធី​បញ្ជា​លទ្ធផល​អូឌីយ៉ូ ។ <b>គ្មាន​កម្មវិធី​បញ្ជា​អូឌីយ៉ូ</b> ធ្វើ​ឲ្យ​ម៉ាស៊ីន​ភ្ញៀវ​ឃើញ​កាត​អូឌីយ៉ូ ទោះ​ជា​យ៉ាង​ណា​រាល់​ពេល​ចូលដំណើរការ​វា​នឹង​ត្រូ​វបាន​មិនអើពើ ។</translation>
+        <translation>ត្រួតពិនិត្យ​កម្មវិធី​បញ្ជា​លទ្ធផល​អូឌីយ៉ូ ។ <b>គ្មាន​កម្មវិធី​បញ្ជា​អូឌីយ៉ូ</b> ធ្វើ​ឲ្យ​ម៉ាស៊ីន​ភ្ញៀវ​ឃើញ​កាត​អូឌីយ៉ូ ទោះ​ជា​យ៉ាង​ណា​រាល់​ពេល​ចូលដំណើរការ​វា​នឹង​ត្រូ​វបាន​មិនអើពើ ។</translation>
     </message>
     <message>
         <source>Audio &Controller:</source>
-        <translation>វត្ថុ​បញ្ជា​អូឌីយ៉ូ ៖</translation>
+        <translation>វត្ថុ​បញ្ជា​អូឌីយ៉ូ ៖</translation>
     </message>
     <message>
         <source>Selects the type of the virtual sound card. Depending on this value, VirtualBox will provide different audio hardware to the virtual machine.</source>
-        <translation>ជ្រើស​ប្រភេទ​កាត​សំឡេង​និម្មិត ។ ដោយ​អាស្រ័យ​លើ​តម្លៃនេះ VirtualBox នឹ​ងផ្ដល់​នូវ​ផ្នែក​រឹង​អូឌីយ៉ូ​ផ្សេងៗ​គ្នា​ដល់​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation>ជ្រើស​ប្រភេទ​កាត​សំឡេង​និម្មិត ។ ដោយ​អាស្រ័យ​លើ​តម្លៃនេះ VirtualBox នឹ​ងផ្ដល់​នូវ​ផ្នែក​រឹង​អូឌីយ៉ូ​ផ្សេងៗ​គ្នា​ដល់​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
 </context>
 <context>
     <name>UIMachineSettingsDisplay</name>
     <message>
         <source>you have assigned less than <b>%1</b> of video memory which is the minimum amount required to switch the virtual machine to fullscreen or seamless mode.</source>
-        <translation type="obsolete">អ្នកបានផ្ដល់​សតិវីដេអូតិច​ជាង <b>%1</b> ដែល​ជា​ចំនួន​អប្បបរមាដែលបានទាមទារ​ដើម្បី​ប្ដូរ​ម៉ាស៊ីន​និម្មិត​ទៅរបៀប​​ពេញអេក្រង់ ឬ​ពង្រីក ។</translation>
+        <translation type="obsolete">អ្នកបានផ្ដល់​សតិវីដេអូតិច​ជាង <b>%1</b> ដែល​ជា​ចំនួន​អប្បបរមាដែលបានទាមទារ​ដើម្បី​ប្ដូរ​ម៉ាស៊ីន​និម្មិត​ទៅរបៀប​​ពេញអេក្រង់ ឬ​ពង្រីក ។</translation>
     </message>
     <message>
         <source>you have assigned less than <b>%1</b> of video memory which is the minimum amount required for HD Video to be played efficiently.</source>
-        <translation type="obsolete">អ្នក​បានផ្ដល់​សតិ​វីដេអូតិច​ជាង <b>%1</b> ដែលជា​ចំនួន​អប្បបរមា​សម្រាប់​វីដេអូ HD ដើម្បីចាក់​ឲ្យ​មាន​ប្រសិទ្ធភាព ។</translation>
+        <translation type="obsolete">អ្នក​បានផ្ដល់​សតិ​វីដេអូតិច​ជាង <b>%1</b> ដែលជា​ចំនួន​អប្បបរមា​សម្រាប់​វីដេអូ HD ដើម្បីចាក់​ឲ្យ​មាន​ប្រសិទ្ធភាព ។</translation>
     </message>
     <message>
         <source><qt>%1&nbsp;MB</qt></source>
@@ -3941,15 +4258,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>វីដេអូ​</translation>
+        <translation type="obsolete">វីដេអូ​</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
-        <translation>សតិ​វីដេអូ​ ៖</translation>
+        <translation>សតិ​វីដេអូ​ ៖</translation>
     </message>
     <message>
         <source>Controls the amount of video memory provided to the virtual machine.</source>
-        <translation>ត្រួតពិនិត្យ​ចំនួន​សតិ​វីដេ​អូ​​ដែល​បានផ្ដល់​ឲ្យ​​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation>ត្រួតពិនិត្យ​ចំនួន​សតិ​វីដេ​អូ​​ដែល​បានផ្ដល់​ឲ្យ​​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
     <message>
         <source>MB</source>
@@ -3957,11 +4274,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Extended Features:</source>
-        <translation>លក្ខណសម្បត្តិ​ដែល​បានពង្រីក ៖</translation>
+        <translation>លក្ខណសម្បត្តិ​ដែល​បានពង្រីក ៖</translation>
     </message>
     <message>
         <source>When checked, the virtual machine will be given access to the 3D graphics capabilities available on the host.</source>
-        <translation>នៅពេល​បាន​គូស​ធីក ម៉ាស៊ីន​និម្មិត​នឹង​ចូលដំណើរការ​សមត្ថភាព​ក្រាហ្វិក​ត្រីមាត្រ​ដែល​​អាច​រក​បាន​​នៅ​លើ​ម៉ាស៊ីន ។</translation>
+        <translation>នៅពេល​បាន​គូស​ធីក ម៉ាស៊ីន​និម្មិត​នឹង​ចូលដំណើរការ​សមត្ថភាព​ក្រាហ្វិក​ត្រីមាត្រ​ដែល​​អាច​រក​បាន​​នៅ​លើ​ម៉ាស៊ីន ។</translation>
     </message>
     <message>
         <source>Enable &3D Acceleration</source>
@@ -3981,7 +4298,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source>
-        <translation>នៅពេល​បាន​គូស​ធីក VM នឹង​ដើរតួ​ជា​ម៉ាស៊ីន​បម្រើ​ពិធីការ​ផ្ទៃតុ​ពី​ចម្ងាយ (RDP) ដោយ​អនុញ្ញាត​ឲ្យ​ម៉ាស៊ីនភ្ញៀវ​ពី​ចម្ងាយ​តភ្ជាប់​ និង​ប្រតិបត្តិ​ VM (នៅ​ពេល​កំពុង​រត់) ដោយ​ប្រើ​ម៉ាស៊ីន​ភ្ញៀវ RDP ស្តង់ដារ ។</translation>
+        <translation>នៅពេល​បាន​គូស​ធីក VM នឹង​ដើរតួ​ជា​ម៉ាស៊ីន​បម្រើ​ពិធីការ​ផ្ទៃតុ​ពី​ចម្ងាយ (RDP) ដោយ​អនុញ្ញាត​ឲ្យ​ម៉ាស៊ីនភ្ញៀវ​ពី​ចម្ងាយ​តភ្ជាប់​ និង​ប្រតិបត្តិ​ VM (នៅ​ពេល​កំពុង​រត់) ដោយ​ប្រើ​ម៉ាស៊ីន​ភ្ញៀវ RDP ស្តង់ដារ ។</translation>
     </message>
     <message>
         <source>&Enable Server</source>
@@ -3989,7 +4306,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Server &Port:</source>
-        <translation>ច្រក​ម៉ាស៊ីនបម្រើ ៖</translation>
+        <translation>ច្រក​ម៉ាស៊ីនបម្រើ ៖</translation>
     </message>
     <message>
         <source>The VRDP Server port number. You may specify <tt>0</tt> (zero), to select port 3389, the standard port for RDP.</source>
@@ -3997,19 +4314,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Authentication &Method:</source>
-        <translation>វិធីសាស្ត្រ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ ៖</translation>
+        <translation>វិធីសាស្ត្រ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ ៖</translation>
     </message>
     <message>
         <source>Defines the VRDP authentication method.</source>
-        <translation>កំណត់​វិធីសាស្ត្រ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ​របស់ VRDP ។</translation>
+        <translation>កំណត់​វិធីសាស្ត្រ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ​របស់ VRDP ។</translation>
     </message>
     <message>
         <source>Authentication &Timeout:</source>
-        <translation>អស់ពេល​ក្នុងការ​​​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ ៖</translation>
+        <translation>អស់ពេល​ក្នុងការ​​​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ ៖</translation>
     </message>
     <message>
         <source>Specifies the timeout for guest authentication, in milliseconds.</source>
-        <translation>បញ្ជាក់​ការ​អស់ពេល ​សម្រាប់​ការ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ គិត​​ជា​មិល្លី​វិនាទី ។</translation>
+        <translation>បញ្ជាក់​ការ​អស់ពេល ​សម្រាប់​ការ​ផ្ទៀងផ្ទាត់​ភាព​ត្រឹមត្រូវ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ គិត​​ជា​មិល្លី​វិនាទី ។</translation>
     </message>
     <message>
         <source>Mo&nitor Count:</source>
@@ -4108,10 +4425,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4163,7 +4476,75 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">របារ​ឧបករណ៍​តូច​ ៖</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">ប្រ​សិន​បើ​ធីក​ បង្ហាញ​របារ​ឧបករណ៍​តូច​ក្នុងរបៀប​​អេ​​ក្រង់​ពេញ​ និង​​​ព​ង្រីក​ ។</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">​បង្ហាញ​អេ​ក្រង់​ពេញ​​/​ពង្រីក​</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">ប្រ​សិន​បើ​ធីក​ បង្ហាញ​របារឧបករណ៍​តូច​​នៅ​ផ្នែកខាង​លើ​​អេក្រង់​ ជា​ជាង​ក្នុង​ទី​តាំង​លំនាំ​ដើម​នៃ​ប៊ូតុង​របស់​អេក្រង់​ ។</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">បង្ហាញ​កំពូល​​អេក្រង់​</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4171,82 +4552,82 @@ p, li { white-space: pre-wrap; }
     <name>UIMachineSettingsGeneral</name>
     <message>
         <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>បង្ហាញ​ផ្លូវ​ដែល​រូបថត​របស់ម៉ាស៊ីន​និម្មិត​នេះ​នឹង​ត្រូ​វបានផ្ទុក ។ ចំណាំ​ថា រូបថត​អាចចាប់យក​​ទំហំ​ថាស​ជា​ច្រើន​​យ៉ាង​ស្ងៀវស្ងាត់​ ។</translation>
+        <translation>បង្ហាញ​ផ្លូវ​ដែល​រូបថត​របស់ម៉ាស៊ីន​និម្មិត​នេះ​នឹង​ត្រូ​វបានផ្ទុក ។ ចំណាំ​ថា រូបថត​អាចចាប់យក​​ទំហំ​ថាស​ជា​ច្រើន​​យ៉ាង​ស្ងៀវស្ងាត់​ ។</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>មូលដ្ឋាន</translation>
     </message>
     <message>
         <source>&Name:</source>
-        <translation type="obsolete">ឈ្មោះ ៖</translation>
+        <translation type="obsolete">ឈ្មោះ ៖</translation>
     </message>
     <message>
         <source>Holds the name of the virtual machine.</source>
-        <translation type="obsolete">បង្ហាញ​ឈ្មោះ​របស់​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation type="obsolete">បង្ហាញ​ឈ្មោះ​របស់​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>កម្រិតខ្ពស់</translation>
     </message>
     <message>
         <source>&Shared Clipboard:</source>
-        <translation>ក្ដារតម្បៀតខ្ទាស់​ដែល​បាន​ចែករំលែក ៖</translation>
+        <translation>ក្ដារតម្បៀតខ្ទាស់​ដែល​បាន​ចែករំលែក ៖</translation>
     </message>
     <message>
         <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>កំណត់​របៀប​ចែករំលែក​ក្ដារតម្បៀតខ្ទាស់​រវាង​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ និង​របស់ម៉ាស៊ីន ។ ចំណាំ​ថា លក្ខណៈពិសេស​នេះ​តម្រូវ​ឲ្យ​ដំឡើង​ផ្នែក​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ​ក្នុង​ប្រព័ន្ធប្រតិបត្តិការ​របស់​ម៉ាស៊ីន ។</translation>
+        <translation>កំណត់​របៀប​ចែករំលែក​ក្ដារតម្បៀតខ្ទាស់​រវាង​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ និង​របស់ម៉ាស៊ីន ។ ចំណាំ​ថា លក្ខណៈពិសេស​នេះ​តម្រូវ​ឲ្យ​ដំឡើង​ផ្នែក​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ​ក្នុង​ប្រព័ន្ធប្រតិបត្តិការ​របស់​ម៉ាស៊ីន ។</translation>
     </message>
     <message>
         <source>S&napshot Folder:</source>
-        <translation>ថត​រូបថត ៖</translation>
+        <translation>ថត​រូបថត ៖</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>សេចក្ដី​ពិពណ៌នា</translation>
     </message>
     <message>
         <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
-        <translation>បង្ហាញ​សេចក្ដីពិពណ៌នា​របស់ម៉ាស៊ីន​និម្មិត ។ វាល​សេចក្ដី​ពិពន៌នា​មានប្រយោជន៍​សម្រាប់​ផ្ដល់​យោបល់​អំពី​សេចក្ដី​លម្អិត​កំណត់​រចនាសម្ព័ន្ធ​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​ដែល​បាន​ដំឡើង ។</translation>
+        <translation>បង្ហាញ​សេចក្ដីពិពណ៌នា​របស់ម៉ាស៊ីន​និម្មិត ។ វាល​សេចក្ដី​ពិពន៌នា​មានប្រយោជន៍​សម្រាប់​ផ្ដល់​យោបល់​អំពី​សេចក្ដី​លម្អិត​កំណត់​រចនាសម្ព័ន្ធ​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​ដែល​បាន​ដំឡើង ។</translation>
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>ប្រសិនបើបាន​គូស​ធីក ការ​ផ្លាស់ប្ដូរ​ទៅ​មេឌៀ​ថាសទន់ ឬ​ស៊ីឌី/ឌីវីឌី​ដែល​បានម៉ោន​ បាន អនុវត្ត​កំឡុង​ពេល​​ប្រតិបត្តិការ​ម៉ាស៊ីន នឹង​ត្រូវ​បាន​រក្សាទុក​ក្នុង​ឯកសារ​កំណត់​ ដើម្បី​បម្រុង​ទុក​នូវ​ការ​កំណត់​រចនាសម្ព័ន្ធ​របស់​មេឌៀ​ដែល​បានម៉ោន​​ចន្លោះ​ពេល​រត់ ។</translation>
+        <translation type="obsolete">ប្រសិនបើបាន​គូស​ធីក ការ​ផ្លាស់ប្ដូរ​ទៅ​មេឌៀ​ថាសទន់ ឬ​ស៊ីឌី/ឌីវីឌី​ដែល​បានម៉ោន​ បាន អនុវត្ត​កំឡុង​ពេល​​ប្រតិបត្តិការ​ម៉ាស៊ីន នឹង​ត្រូវ​បាន​រក្សាទុក​ក្នុង​ឯកសារ​កំណត់​ ដើម្បី​បម្រុង​ទុក​នូវ​ការ​កំណត់​រចនាសម្ព័ន្ធ​របស់​មេឌៀ​ដែល​បានម៉ោន​​ចន្លោះ​ពេល​រត់ ។</translation>
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>មេឌៀ​ចល័ត ៖</translation>
+        <translation type="obsolete">មេឌៀ​ចល័ត ៖</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>ចង់​ចាំ​ការផ្លាស់​ប្តូរ​ពេល​ដំណើរ​ការ​</translation>
+        <translation type="obsolete">ចង់​ចាំ​ការផ្លាស់​ប្តូរ​ពេល​ដំណើរ​ការ​</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>របារ​ឧបករណ៍​តូច​ ៖</translation>
+        <translation type="obsolete">របារ​ឧបករណ៍​តូច​ ៖</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>ប្រ​សិន​បើ​ធីក​ បង្ហាញ​របារ​ឧបករណ៍​តូច​ក្នុងរបៀប​​អេ​​ក្រង់​ពេញ​ និង​​​ព​ង្រីក​ ។</translation>
+        <translation type="obsolete">ប្រ​សិន​បើ​ធីក​ បង្ហាញ​របារ​ឧបករណ៍​តូច​ក្នុងរបៀប​​អេ​​ក្រង់​ពេញ​ និង​​​ព​ង្រីក​ ។</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>​បង្ហាញ​អេ​ក្រង់​ពេញ​​/​ពង្រីក​</translation>
+        <translation type="obsolete">​បង្ហាញ​អេ​ក្រង់​ពេញ​​/​ពង្រីក​</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>ប្រ​សិន​បើ​ធីក​ បង្ហាញ​របារឧបករណ៍​តូច​​នៅ​ផ្នែកខាង​លើ​​អេក្រង់​ ជា​ជាង​ក្នុង​ទី​តាំង​លំនាំ​ដើម​នៃ​ប៊ូតុង​របស់​អេក្រង់​ ។</translation>
+        <translation type="obsolete">ប្រ​សិន​បើ​ធីក​ បង្ហាញ​របារឧបករណ៍​តូច​​នៅ​ផ្នែកខាង​លើ​​អេក្រង់​ ជា​ជាង​ក្នុង​ទី​តាំង​លំនាំ​ដើម​នៃ​ប៊ូតុង​របស់​អេក្រង់​ ។</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>បង្ហាញ​កំពូល​​អេក្រង់​</translation>
+        <translation type="obsolete">បង្ហាញ​កំពូល​​អេក្រង់​</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">អ្នក​បាន​​ជ្រើស​ប្រ​ភេទ​ប្រ​ព័ន្ធ​ប្រ​តិបត្តិ​​ការ​ម៉ាស៊ីន​ភ្ញៀវ​ ៦៤​-​ប៊ីត​ សម្រាប់​​ VM នេះ​ ។ ជាក់​ស្តែង​ ដូច​ម៉ាស៊ីន​ភ្ញៀវ​ទាមទារ​ថាសរឹង​ (VT-x/AMD-V) លក្ខណៈ​ពិសេស​នេះ​នឹង​ត្រូវ​បាន​បើក​ដោយ​ស្វ័យ​ប្រ​វត្តិ​ ។</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -4261,12 +4642,100 @@ p, li { white-space: pre-wrap; }
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">របារ​ឧបករណ៍​តូច​ ៖</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">ប្រ​សិន​បើ​ធីក​ បង្ហាញ​របារ​ឧបករណ៍​តូច​ក្នុងរបៀប​​អេ​​ក្រង់​ពេញ​ និង​​​ព​ង្រីក​ ។</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">​បង្ហាញ​អេ​ក្រង់​ពេញ​​/​ពង្រីក​</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">ប្រ​សិន​បើ​ធីក​ បង្ហាញ​របារឧបករណ៍​តូច​​នៅ​ផ្នែកខាង​លើ​​អេក្រង់​ ជា​ជាង​ក្នុង​ទី​តាំង​លំនាំ​ដើម​នៃ​ប៊ូតុង​របស់​អេក្រង់​ ។</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">បង្ហាញ​កំពូល​​អេក្រង់​</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
     <message>
         <source>When checked, plugs this virtual network adapter into the virtual machine.</source>
-        <translation>នៅពេល​គូស​ធីក ដោត​អាដាប់ទ័រ​បណ្ដាញ​និម្មិត​ទៅ​ក្នុងម៉ាស៊ីន​នកម្មិត ។</translation>
+        <translation>នៅពេល​គូស​ធីក ដោត​អាដាប់ទ័រ​បណ្ដាញ​និម្មិត​ទៅ​ក្នុងម៉ាស៊ីន​នកម្មិត ។</translation>
     </message>
     <message>
         <source>&Enable Network Adapter</source>
@@ -4274,23 +4743,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Selects the type of the virtual network adapter. Depending on this value, VirtualBox will provide different network hardware to the virtual machine.</source>
-        <translation>ជ្រើស​ប្រភេទ​អាដាប់ទ័រ​បណ្ដាញ​និម្មិត ។ អាស្រ័យ​លើ​តម្លៃ​នេះ VirtualBox នឹង​ផ្ដល់​នូវ​ផ្នែករឹង​​បណ្ដាញ​ផ្សេង​ទៅ​ឲ្យ​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation>ជ្រើស​ប្រភេទ​អាដាប់ទ័រ​បណ្ដាញ​និម្មិត ។ អាស្រ័យ​លើ​តម្លៃ​នេះ VirtualBox នឹង​ផ្ដល់​នូវ​ផ្នែករឹង​​បណ្ដាញ​ផ្សេង​ទៅ​ឲ្យ​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
     <message>
         <source>&Attached to:</source>
-        <translation>បាន​ភ្ជាប់​ទៅ ៖</translation>
+        <translation>បាន​ភ្ជាប់​ទៅ ៖</translation>
     </message>
     <message>
         <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
-        <translation>បង្ហាញ​អាសយដ្ឋាន MAC របស់​អាដាប់ទ័រ​នេះ ។ វា​មាន​តួអក្សរ​យ៉ាង​ជាក់លាក់​ចំនួន​ ១២ ដែល​បាន​ជ្រើស​ពី {0-9,A-F} ។ ចំណាំ​ថា​តួអក្សរ​ទីពីរ​ត្រូវ​តែ​ជា​​តួលេខ​គូ ។</translation>
+        <translation>បង្ហាញ​អាសយដ្ឋាន MAC របស់​អាដាប់ទ័រ​នេះ ។ វា​មាន​តួអក្សរ​យ៉ាង​ជាក់លាក់​ចំនួន​ ១២ ដែល​បាន​ជ្រើស​ពី {0-9,A-F} ។ ចំណាំ​ថា​តួអក្សរ​ទីពីរ​ត្រូវ​តែ​ជា​​តួលេខ​គូ ។</translation>
     </message>
     <message>
         <source>Generates a new random MAC address.</source>
-        <translation>បង្កើត​អាសយដ្ឋាន MAC ចៃដន្យ​ថ្មី ។</translation>
+        <translation>បង្កើត​អាសយដ្ឋាន MAC ចៃដន្យ​ថ្មី ។</translation>
     </message>
     <message>
         <source>Indicates whether the virtual network cable is plugged in on machine startup or not.</source>
-        <translation>បង្ហាញ​ថាតើ​ខ្សែ​បណ្ដាញ​និម្មិត​ត្រូ​វបានដោត​​នៅពេល​ម៉ាស៊ីន​ចាប់ផ្ដើម​ ឬ​ក៏អត់ ។</translation>
+        <translation>បង្ហាញ​ថាតើ​ខ្សែ​បណ្ដាញ​និម្មិត​ត្រូ​វបានដោត​​នៅពេល​ម៉ាស៊ីន​ចាប់ផ្ដើម​ ឬ​ក៏អត់ ។</translation>
     </message>
     <message>
         <source>no bridged network adapter is selected</source>
@@ -4313,15 +4782,15 @@ network adapter name</comment>
     </message>
     <message>
         <source>Controls how this virtual adapter is attached to the real network of the Host OS.</source>
-        <translation>ត្រួតពិនិត្យ​វិធី​ដែល​អាដាប់ទ័រ​និម្មិត​នេះ​ត្រូវ​បាន​ភ្ជាប់​ទៅ​បណ្ដាញ​ពិតប្រាកដ​​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន ។</translation>
+        <translation>ត្រួតពិនិត្យ​វិធី​ដែល​អាដាប់ទ័រ​និម្មិត​នេះ​ត្រូវ​បាន​ភ្ជាប់​ទៅ​បណ្ដាញ​ពិតប្រាកដ​​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន ។</translation>
     </message>
     <message>
         <source>&Name:</source>
-        <translation>ឈ្មោះ ៖</translation>
+        <translation>ឈ្មោះ ៖</translation>
     </message>
     <message>
         <source>Selects the name of the network adapter for <b>Bridged Adapter</b> or <b>Host-only Adapter</b> attachments and the name of the network <b>Internal Network</b> attachments.</source>
-        <translation type="obsolete">ជ្រើស​ឈ្មោះ​អាដាប់ទ័រ​បណ្ដាញ​សម្រាប់ <b>អាដាប់ទ័រ​ប្រ៊ីដ្យ</b> ឬ <b>អាដាប់ទ័រម៉ាស៊ីន</b> ការ​ភ្ជាប់ និង​ឈ្មោះ​​របស់​បណ្ដាញ ការ​ភ្ជាប់<b>បណ្ដាញ​ខាង​ក្នុង</b> ។</translation>
+        <translation type="obsolete">ជ្រើស​ឈ្មោះ​អាដាប់ទ័រ​បណ្ដាញ​សម្រាប់ <b>អាដាប់ទ័រ​ប្រ៊ីដ្យ</b> ឬ <b>អាដាប់ទ័រម៉ាស៊ីន</b> ការ​ភ្ជាប់ និង​ឈ្មោះ​​របស់​បណ្ដាញ ការ​ភ្ជាប់<b>បណ្ដាញ​ខាង​ក្នុង</b> ។</translation>
     </message>
     <message>
         <source>A&dvanced</source>
@@ -4329,15 +4798,15 @@ network adapter name</comment>
     </message>
     <message>
         <source>Shows or hides additional network adapter options.</source>
-        <translation>បង្ហាញ​ ឬ​លាក់​ជម្រើស​អាដាប់ទ័រ​បណ្ដាញ​បន្ថែម ។</translation>
+        <translation>បង្ហាញ​ ឬ​លាក់​ជម្រើស​អាដាប់ទ័រ​បណ្ដាញ​បន្ថែម ។</translation>
     </message>
     <message>
         <source>Adapter &Type:</source>
-        <translation>ប្រភេទ​អាដាប់​ទ័រ​ ៖</translation>
+        <translation>ប្រភេទ​អាដាប់​ទ័រ​ ៖</translation>
     </message>
     <message>
         <source>&Mac Address:</source>
-        <translation type="obsolete">អាសយដ្ឋាន Mac ៖</translation>
+        <translation type="obsolete">អាសយដ្ឋាន Mac ៖</translation>
     </message>
     <message>
         <source>&Cable Connected</source>
@@ -4434,7 +4903,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>When checked, enables the given parallel port of the virtual machine.</source>
-        <translation>នៅពេល​បាន​គូស​ធីក បើក​ច្រក​ប៉ារ៉ាឡែល​របស់​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation>នៅពេល​បាន​គូស​ធីក បើក​ច្រក​ប៉ារ៉ាឡែល​របស់​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
     <message>
         <source>&Enable Parallel Port</source>
@@ -4442,35 +4911,35 @@ network adapter name</comment>
     </message>
     <message>
         <source>Port &Number:</source>
-        <translation>លេខ​ច្រក ៖</translation>
+        <translation>លេខ​ច្រក ៖</translation>
     </message>
     <message>
         <source>Holds the parallel port number. You can choose one of the standard parallel ports or select <b>User-defined</b> and specify port parameters manually.</source>
-        <translation>បង្ហាញលេចច្រក​ប៉ារ៉ាឡែល ។ អ្នកអាចជ្រើស​ច្រក​មួយ​ក្នុងចំណោម​ច្រក​ប៉ារ៉ាឡែល​ជា​ច្រើន ឬ​ជ្រើស <b>កំណត់​ដោយ​អ្នក​ប្រើ</b> ហើយ​បញ្ញាក់​ប៉ារ៉ាម៉ែត្រ​ច្រក​ដោយ​ដៃ ។</translation>
+        <translation>បង្ហាញលេចច្រក​ប៉ារ៉ាឡែល ។ អ្នកអាចជ្រើស​ច្រក​មួយ​ក្នុងចំណោម​ច្រក​ប៉ារ៉ាឡែល​ជា​ច្រើន ឬ​ជ្រើស <b>កំណត់​ដោយ​អ្នក​ប្រើ</b> ហើយ​បញ្ញាក់​ប៉ារ៉ាម៉ែត្រ​ច្រក​ដោយ​ដៃ ។</translation>
     </message>
     <message>
         <source>&IRQ:</source>
-        <translation>IRQ ៖</translation>
+        <translation>IRQ ៖</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this parallel port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation>បង្ហាញលេខ IRQ របស​ច្រក​ប៉ារ៉ាឡែល​នេះ ។ តម្លៃ​ត្រឹមត្រូវ​ជា​ចំនួន​គត់​ដែល​ស្ថិត​ក្នុងជួរពី <tt>0</tt> ដល់ <tt>២៥៥</tt> ។ តម្លៃ​ធំជាង <tt>១៥</tt> អាច​ត្រូវ​បានប្រើ​តែ​ក្នុងករណី​ដែល <b>I/O APIC</b> ត្រូ​វបានបើក​សម្រាប់​ម៉ាស៊ីន​និម្មិត​នេះ​ប៉ុណ្ណោះ ។</translation>
+        <translation>បង្ហាញលេខ IRQ របស​ច្រក​ប៉ារ៉ាឡែល​នេះ ។ តម្លៃ​ត្រឹមត្រូវ​ជា​ចំនួន​គត់​ដែល​ស្ថិត​ក្នុងជួរពី <tt>0</tt> ដល់ <tt>២៥៥</tt> ។ តម្លៃ​ធំជាង <tt>១៥</tt> អាច​ត្រូវ​បានប្រើ​តែ​ក្នុងករណី​ដែល <b>I/O APIC</b> ត្រូ​វបានបើក​សម្រាប់​ម៉ាស៊ីន​និម្មិត​នេះ​ប៉ុណ្ណោះ ។</translation>
     </message>
     <message>
         <source>I/O Po&rt:</source>
-        <translation>ច្រក I/O ៖</translation>
+        <translation>ច្រក I/O ៖</translation>
     </message>
     <message>
         <source>Holds the base I/O port address of this parallel port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation>បង្ហាញអាសយដ្ឋាន​ច្រក​ I/O មូលដ្ឋាន ។ តម្លៃដែល​ត្រឹមត្រូវ​គឺ​ធំជាង​ចំនួន​ដែល​ស្ថិត​ក្នុងជួរ​ពី <tt>0</tt>ដល់<tt>0xFFFF</tt> ។</translation>
+        <translation>បង្ហាញអាសយដ្ឋាន​ច្រក​ I/O មូលដ្ឋាន ។ តម្លៃដែល​ត្រឹមត្រូវ​គឺ​ធំជាង​ចំនួន​ដែល​ស្ថិត​ក្នុងជួរ​ពី <tt>0</tt>ដល់<tt>0xFFFF</tt> ។</translation>
     </message>
     <message>
         <source>Port &Path:</source>
-        <translation>ផ្លូវ​ច្រក ៖</translation>
+        <translation>ផ្លូវ​ច្រក ៖</translation>
     </message>
     <message>
         <source>Holds the host parallel device name.</source>
-        <translation>បង្ហាញ​ឈ្មោះ​ឧបករណ៍​ស្រប​គ្នា​​របស់​ម៉ាស៊ីន ។</translation>
+        <translation>បង្ហាញ​ឈ្មោះ​ឧបករណ៍​ស្រប​គ្នា​​របស់​ម៉ាស៊ីន ។</translation>
     </message>
 </context>
 <context>
@@ -4543,11 +5012,11 @@ network adapter name</comment>
     <name>UIMachineSettingsSF</name>
     <message>
         <source>Adds a new shared folder definition.</source>
-        <translation>បន្ថែម​កា​រកំណត់​ថត​ដែលបានចែករំលែកថ្មី ។</translation>
+        <translation>បន្ថែម​កា​រកំណត់​ថត​ដែលបានចែករំលែកថ្មី ។</translation>
     </message>
     <message>
         <source>Edits the selected shared folder definition.</source>
-        <translation>កែសម្រួល​កា​រកំណត់​ថត​ដែល​បានចែករំលែក​ដែល​បានជ្រើស ។</translation>
+        <translation>កែសម្រួល​កា​រកំណត់​ថត​ដែល​បានចែករំលែក​ដែល​បានជ្រើស ។</translation>
     </message>
     <message>
         <source>Removes the selected shared folder definition.</source>
@@ -4571,7 +5040,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>Lists all shared folders accessible to this machine. Use 'net use x: \\vboxsvr\share' to access a shared folder named <i>share</i> from a DOS-like OS, or 'mount -t vboxsf share mount_point' to access it from a Linux OS. This feature requires Guest Additions.</source>
-        <translation>រាយ​ថត​ដែល​បានចែករំលែក​ទាំង​អស់​ដែល​អាច​ចូលដំណើរការ​បានទៅ​ម៉ាស៊ីន​នេះ ។ ប្រើ​ 'net ប្រើ x: \\vboxsvr\share' ដើម្បី​ចូលដំណើរការ​ថត​ដែល​បានចែករំលែក​ដែលមាន​ឈ្មោះ <i>ចែករំលែក</i> ពីប្រព័ន្ធ​ប្រតិបត្តិការ​ដូចនឹង DOS ដែរ ឬ​ 'mount -t vboxsf share mount_point' ដើម្បីចូលដំណើរការ​វា​ពី​ប្រព័ន្ធ​ប្រតិបត្តិការ​លីនុច ។ លក្ខណៈពិសេស​នេះ​ត្រូវការ​ផ្នែក​បន្ថែម​របស់ម៉ាស៊ីន​ភ្ញៀវ ។</translation>
+        <translation>រាយ​ថត​ដែល​បានចែករំលែក​ទាំង​អស់​ដែល​អាច​ចូលដំណើរការ​បានទៅ​ម៉ាស៊ីន​នេះ ។ ប្រើ​ 'net ប្រើ x: \\vboxsvr\share' ដើម្បី​ចូលដំណើរការ​ថត​ដែល​បានចែករំលែក​ដែលមាន​ឈ្មោះ <i>ចែករំលែក</i> ពីប្រព័ន្ធ​ប្រតិបត្តិការ​ដូចនឹង DOS ដែរ ឬ​ 'mount -t vboxsf share mount_point' ដើម្បីចូលដំណើរការ​វា​ពី​ប្រព័ន្ធ​ប្រតិបត្តិការ​លីនុច ។ លក្ខណៈពិសេស​នេះ​ត្រូវការ​ផ្នែក​បន្ថែម​របស់ម៉ាស៊ីន​ភ្ញៀវ ។</translation>
     </message>
     <message>
         <source>Name</source>
@@ -4630,19 +5099,19 @@ network adapter name</comment>
     </message>
     <message>
         <source>Folder Path:</source>
-        <translation>ផ្លូវ​ថត ៖</translation>
+        <translation>ផ្លូវ​ថត ៖</translation>
     </message>
     <message>
         <source>Folder Name:</source>
-        <translation>ឈ្មោះ​ថត ៖</translation>
+        <translation>ឈ្មោះ​ថត ៖</translation>
     </message>
     <message>
         <source>Holds the name of the shared folder (as it will be seen by the guest OS).</source>
-        <translation>បង្ហាញ​ឈ្មោះ​របស់​ថត​ដែលបានចែករំលែក (ព្រោះថា​វា​នឹង​ត្រូវ​បានឃើញ​ដោយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ) ។</translation>
+        <translation>បង្ហាញ​ឈ្មោះ​របស់​ថត​ដែលបានចែករំលែក (ព្រោះថា​វា​នឹង​ត្រូវ​បានឃើញ​ដោយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ) ។</translation>
     </message>
     <message>
         <source>When checked, the guest OS will not be able to write to the specified shared folder.</source>
-        <translation>នៅពេល​បានគូសធីក ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​មិនអាច​សរសេរ​ទៅកាន​ថត​ដែល​បានចែករំលែក​​ដែល​បាន​បញ្ជាក់​ទេ ។</translation>
+        <translation>នៅពេល​បានគូសធីក ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​មិនអាច​សរសេរ​ទៅកាន​ថត​ដែល​បានចែករំលែក​​ដែល​បាន​បញ្ជាក់​ទេ ។</translation>
     </message>
     <message>
         <source>&Read-only</source>
@@ -4664,10 +5133,6 @@ network adapter name</comment>
         <source>If checked, this shared folder will be permanent.</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -4678,7 +5143,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>When checked, enables the given serial port of the virtual machine.</source>
-        <translation>នៅពេល​គូសធីក បើក​ច្រក​ស៊េរី​ដែល​បានផ្ដល់​របស់ម៉ាស៊ីននិម្មិត ។</translation>
+        <translation>នៅពេល​គូសធីក បើក​ច្រក​ស៊េរី​ដែល​បានផ្ដល់​របស់ម៉ាស៊ីននិម្មិត ។</translation>
     </message>
     <message>
         <source>&Enable Serial Port</source>
@@ -4686,51 +5151,67 @@ network adapter name</comment>
     </message>
     <message>
         <source>Port &Number:</source>
-        <translation>លេខ​ច្រក ៖</translation>
+        <translation>លេខ​ច្រក ៖</translation>
     </message>
     <message>
         <source>Selects the serial port number. You can choose one of the standard serial ports or select <b>User-defined</b> and specify port parameters manually.</source>
-        <translation>បង្ហាញលេខ​ច្រក​ស៊េរៀល ។ អ្នកអាច​ជ្រើ​ស​ច្រក​ស៊េរៀល​ស្តង់ដារ​មួយ​ក្នុងចំណោម​ច្រកជា​ច្រើន ឬ​ជ្រើស <b>កំណត់​ដោយ​អ្នក​ប្រើ</b> ហើយ​បញ្ជាក់​ប៉ារ៉ាម៉ែត្រ​ច្រក​ដោយដៃ ។</translation>
+        <translation>បង្ហាញលេខ​ច្រក​ស៊េរៀល ។ អ្នកអាច​ជ្រើ​ស​ច្រក​ស៊េរៀល​ស្តង់ដារ​មួយ​ក្នុងចំណោម​ច្រកជា​ច្រើន ឬ​ជ្រើស <b>កំណត់​ដោយ​អ្នក​ប្រើ</b> ហើយ​បញ្ជាក់​ប៉ារ៉ាម៉ែត្រ​ច្រក​ដោយដៃ ។</translation>
     </message>
     <message>
         <source>&IRQ:</source>
-        <translation>IRQ ៖</translation>
+        <translation>IRQ ៖</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation>បង្ហាញ​លេខ IRQ របស់​ច្រក​ស៊េរៀល​នេះ ។ តម្លៃ​ដែល​ត្រឹមត្រូវ​គឺ​ជា​ចំនួន​គត់​ដែល​ស្ថិត​នៅ​ក្នុង​ចន្លោះ​ពី <tt>0</tt> ដល់ <tt>២៥៥</tt> ។ តម្លៃ​ធំជាង​ <tt>១៥</tt> អាច​ត្រូ​វបានប្រើ​តែ​ក្នុងករណី​ដែល <b>I/O APIC</b> ត្រូវ​បានបើក​សម្រាប់​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation>បង្ហាញ​លេខ IRQ របស់​ច្រក​ស៊េរៀល​នេះ ។ តម្លៃ​ដែល​ត្រឹមត្រូវ​គឺ​ជា​ចំនួន​គត់​ដែល​ស្ថិត​នៅ​ក្នុង​ចន្លោះ​ពី <tt>0</tt> ដល់ <tt>២៥៥</tt> ។ តម្លៃ​ធំជាង​ <tt>១៥</tt> អាច​ត្រូ​វបានប្រើ​តែ​ក្នុងករណី​ដែល <b>I/O APIC</b> ត្រូវ​បានបើក​សម្រាប់​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
     <message>
         <source>I/O Po&rt:</source>
-        <translation>ច្រក​ I/O ៖</translation>
+        <translation>ច្រក​ I/O ៖</translation>
     </message>
     <message>
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation>បង្ហាញ​អាសយដ្ឋាន​ច្រក I/O មូលដ្ឋាន​របស់​ច្រក​ស៊េរៀលនេះ ។ តម្លៃ​ដែល​ត្រឹមត្រូវ​គឺ​ជា​ចំនួន​ដែល​ស្ថិត​ក្នុង​ចន្លោះពី <tt>0</tt> ដល់<tt>0xFFFF</tt> ។</translation>
+        <translation>បង្ហាញ​អាសយដ្ឋាន​ច្រក I/O មូលដ្ឋាន​របស់​ច្រក​ស៊េរៀលនេះ ។ តម្លៃ​ដែល​ត្រឹមត្រូវ​គឺ​ជា​ចំនួន​ដែល​ស្ថិត​ក្នុង​ចន្លោះពី <tt>0</tt> ដល់<tt>0xFFFF</tt> ។</translation>
     </message>
     <message>
         <source>Port &Mode:</source>
-        <translation>របៀប​ច្រក ៖</translation>
+        <translation>របៀប​ច្រក ៖</translation>
     </message>
     <message>
         <source>Controls the working mode of this serial port. If you select <b>Disconnected</b>, the guest OS will detect the serial port but will not be able to operate it.</source>
-        <translation>ពិនិត្យ​មើល​របៀប​ដំណើរការ​របស់​ច្រក​ស៊េរៀល ។ ប្រសិនបើ​អ្នក​ជ្រើស​ <b>បានផ្ដាច់</b> ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​រកឃើញ​ច្រក​ស៊េរៀល​ ប៉ុន្តែ​នឹង​មិន​អាច​ប្រតិបត្តិ​វា​បានទេ ។</translation>
+        <translation>ពិនិត្យ​មើល​របៀប​ដំណើរការ​របស់​ច្រក​ស៊េរៀល ។ ប្រសិនបើ​អ្នក​ជ្រើស​ <b>បានផ្ដាច់</b> ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​រកឃើញ​ច្រក​ស៊េរៀល​ ប៉ុន្តែ​នឹង​មិន​អាច​ប្រតិបត្តិ​វា​បានទេ ។</translation>
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>ប្រសិន​បើ​បានគូស​ធីក បំពង់​បាន​បញ្ជាក់​នៅ​ក្នុងវាល <b>ផ្លូវ​ច្រក</b> នឹង​ត្រូវ​បាន​បង្កើត​ដោយ​​ម៉ាស៊ីន​និម្មិត នៅពេល​វា​ចាប់ផ្ដើម ។ បើ​មិន​ដូច្នេះ​ទេ ម៉ាស៊ីន​និម្មិត​នឹង​ព្យាយាម​ប្រើ​បំពង់​ដែល​បានស្រាប់ ។</translation>
+        <translation type="obsolete">ប្រសិន​បើ​បានគូស​ធីក បំពង់​បាន​បញ្ជាក់​នៅ​ក្នុងវាល <b>ផ្លូវ​ច្រក</b> នឹង​ត្រូវ​បាន​បង្កើត​ដោយ​​ម៉ាស៊ីន​និម្មិត នៅពេល​វា​ចាប់ផ្ដើម ។ បើ​មិន​ដូច្នេះ​ទេ ម៉ាស៊ីន​និម្មិត​នឹង​ព្យាយាម​ប្រើ​បំពង់​ដែល​បានស្រាប់ ។</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>បង្កើត​បំពង់</translation>
+        <translation type="obsolete">បង្កើត​បំពង់</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>បង្ហាញ​ផ្លូវ​ទៅកាន់​ច្រក​ស៊េរៀល​នៅ​លើ​ម៉ាស៊ីន នៅពេល​ច្រក​ដំណើការ​ក្នុង​របៀប <b>បំពង់​ម៉ាស៊ីន</b> ឬ​ឈ្មោះ​ឧបករណ៍​ស៊េរៀល​នៅពេល​ច្រក​ដំណើរការ​ក្នុង​របៀប <b>ឧបករណ៍​ម៉ាស៊ីន</b> ។</translation>
+        <translation type="obsolete">បង្ហាញ​ផ្លូវ​ទៅកាន់​ច្រក​ស៊េរៀល​នៅ​លើ​ម៉ាស៊ីន នៅពេល​ច្រក​ដំណើការ​ក្នុង​របៀប <b>បំពង់​ម៉ាស៊ីន</b> ឬ​ឈ្មោះ​ឧបករណ៍​ស៊េរៀល​នៅពេល​ច្រក​ដំណើរការ​ក្នុង​របៀប <b>ឧបករណ៍​ម៉ាស៊ីន</b> ។</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>ផ្លូវ​ ច្រក​​/ឯកសារ​ ៖</translation>
+        <translation type="obsolete">ផ្លូវ​ ច្រក​​/ឯកសារ​ ៖</translation>
+    </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4772,7 +5253,7 @@ network adapter name</comment>
     <name>UIMachineSettingsStorage</name>
     <message>
         <source>If checked, shows the differencing hard disks that are attached to slots rather than their base hard disks (shown for indirect attachments) and allows explicit attaching of differencing hard disks. Check this only if you need a complex hard disk setup.</source>
-        <translation type="obsolete">ប្រសិនបើ​បានគូសធីគ វា​នឹង​បង្ហាញ​ថាសរឹង​ផ្សេងៗ​ដែល​បានភ្ជាប់​ទៅ​រន្ធ​ជំនួស​ឲ្យ​ថាសរឹង​មូលដ្ឋាន​​របស់​ពួកវា (បង្ហាញតែ​ក្នុងករណី​ដែល​មានការ​ភ្ជាប់​ដោយ​ប្រយោល​ប៉ុណ្ណោះ) ហើយ​នឹង​អនុញ្ញាត​ឲ្យ​ភ្ជាប់​ថាសរឹង​ផ្សេងៗ​ផងដែរ ។ គូស​ធីក​តែ​ក្នុងករណី​ដែល​អ្នក​ត្រូវការ​ការ​រៀបចំ​ថាសរឹង​ស្មុគស្មាញ​ប៉ុណ្ណោះ ។</translation>
+        <translation type="obsolete">ប្រសិនបើ​បានគូសធីគ វា​នឹង​បង្ហាញ​ថាសរឹង​ផ្សេងៗ​ដែល​បានភ្ជាប់​ទៅ​រន្ធ​ជំនួស​ឲ្យ​ថាសរឹង​មូលដ្ឋាន​​របស់​ពួកវា (បង្ហាញតែ​ក្នុងករណី​ដែល​មានការ​ភ្ជាប់​ដោយ​ប្រយោល​ប៉ុណ្ណោះ) ហើយ​នឹង​អនុញ្ញាត​ឲ្យ​ភ្ជាប់​ថាសរឹង​ផ្សេងៗ​ផងដែរ ។ គូស​ធីក​តែ​ក្នុងករណី​ដែល​អ្នក​ត្រូវការ​ការ​រៀបចំ​ថាសរឹង​ស្មុគស្មាញ​ប៉ុណ្ណោះ ។</translation>
     </message>
     <message>
         <source><nobr><b>%1</b></nobr><br><nobr>Bus:&nbsp;&nbsp;%2</nobr><br><nobr>Type:&nbsp;&nbsp;%3</nobr></source>
@@ -4788,19 +5269,19 @@ network adapter name</comment>
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>បន្ថែម​ឧបករណ៍&nbsp;ស៊ីឌី/ឌីវឌី&nbsp;</nobr></translation>
+        <translation type="obsolete"><nobr>បន្ថែម​ឧបករណ៍&nbsp;ស៊ីឌី/ឌីវឌី&nbsp;</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>បន្ថែម​ឧបករណ៍&nbsp;ថាសទន់&nbsp;</nobr></translation>
+        <translation type="obsolete"><nobr>បន្ថែម​ឧបករណ៍&nbsp;ថាសទន់&nbsp;</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation type="unfinished">មិន​មាន​ថាស​រឹង​​ត្រូវ​បាន​ជ្រើស​​សម្រាប់<i>%1</i> នោះ​ទេ ។</translation>
+        <translation type="unfinished">មិន​មាន​ថាស​រឹង​​ត្រូវ​បាន​ជ្រើស​​សម្រាប់<i>%1</i> នោះ​ទេ ។</translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
-        <translation type="obsolete"><i>%1</i>ប្រើខ្នាត​​មធ្យម​ដែល​ភ្ជាប់​ទៅ​កាន់<i>%2</i>រួច​ហើយ​​​ ។</translation>
+        <translation type="obsolete"><i>%1</i>ប្រើខ្នាត​​មធ្យម​ដែល​ភ្ជាប់​ទៅ​កាន់<i>%2</i>រួច​ហើយ​​​ ។</translation>
     </message>
     <message>
         <source>Add Controller</source>
@@ -4836,11 +5317,11 @@ network adapter name</comment>
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>បន្ថែម​ឧបករណ៍​ស៊ីឌី/ឌីវីឌី</translation>
+        <translation type="obsolete">បន្ថែម​ឧបករណ៍​ស៊ីឌី/ឌីវីឌី</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>បន្ថែម​ឧបករណ៍​ថាស​ទន់​</translation>
+        <translation type="obsolete">បន្ថែម​ឧបករណ៍​ថាស​ទន់​</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -4848,19 +5329,19 @@ network adapter name</comment>
     </message>
     <message>
         <source>Adds a new controller to the end of the Storage Tree.</source>
-        <translation>បន្ថែម​វត្ថុ​បញ្ជា​ថ្មី​ទៅ​ចុង​មែកធាង​ផ្ទុក ។</translation>
+        <translation>បន្ថែម​វត្ថុ​បញ្ជា​ថ្មី​ទៅ​ចុង​មែកធាង​ផ្ទុក ។</translation>
     </message>
     <message>
         <source>Removes the controller highlighted in the Storage Tree.</source>
-        <translation>យក​ឧបករណ៍​បញ្ជា​ដែលបានបន្លិច​ចេញ​នៅ​ក្នុង​មែកធាង​ផ្ទុក ។</translation>
+        <translation>យក​ឧបករណ៍​បញ្ជា​ដែលបានបន្លិច​ចេញ​នៅ​ក្នុង​មែកធាង​ផ្ទុក ។</translation>
     </message>
     <message>
         <source>Adds a new attachment to the Storage Tree using currently selected controller as parent.</source>
-        <translation>បន្ថែម​ឯកសារ​ភ្ជាប់ថ្មី​ទៅ​​មែក​ធាង​ផ្ទុក ដោយ​ប្រើ​​កម្មវិធីបញ្ជាដែលបានជ្រើស​ជា​មេ​ ។</translation>
+        <translation>បន្ថែម​ឯកសារ​ភ្ជាប់ថ្មី​ទៅ​​មែក​ធាង​ផ្ទុក ដោយ​ប្រើ​​កម្មវិធីបញ្ជាដែលបានជ្រើស​ជា​មេ​ ។</translation>
     </message>
     <message>
         <source>Removes the attachment highlighted in the Storage Tree.</source>
-        <translation>យក​ឯកសារ​ភ្ជាប់​ដែល​បាន​បន្លិច​ចេញ​នៅ​ក្នុង​មែកធាង​ផ្ទុក ។</translation>
+        <translation>យក​ឯកសារ​ភ្ជាប់​ដែល​បាន​បន្លិច​ចេញ​នៅ​ក្នុង​មែកធាង​ផ្ទុក ។</translation>
     </message>
     <message>
         <source>IDE Controller</source>
@@ -4880,15 +5361,15 @@ network adapter name</comment>
     </message>
     <message>
         <source>Hard &Disk:</source>
-        <translation>ថាស​រឹង​ ៖</translation>
+        <translation>ថាស​រឹង​ ៖</translation>
     </message>
     <message>
         <source>&CD/DVD Device:</source>
-        <translation type="obsolete">ឧបករណ៍​​ស៊ី​ឌី​​/ឌីវីឌី ៖</translation>
+        <translation type="obsolete">ឧបករណ៍​​ស៊ី​ឌី​​/ឌីវីឌី ៖</translation>
     </message>
     <message>
         <source>&Floppy Device:</source>
-        <translation type="obsolete">ឧបករណ៍ថាសទន់ ៖</translation>
+        <translation type="obsolete">ឧបករណ៍ថាសទន់ ៖</translation>
     </message>
     <message>
         <source>&Storage Tree</source>
@@ -4896,7 +5377,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>Contains all storage controllers for this machine and the virtual images and host drives attached to them.</source>
-        <translation>មាន​ឧបករណ៍​បញ្ជា​ផ្ទុក​ទាំង​អស់​សម្រាប់​ម៉ាស៊ី​ននេះ​ និង​រូប​ភាព​និម្មិត​ និងដ្រាយ​​ម៉ាស៊ីន​ដែល​បាន​​ភ្ជាប់​​ទៅកាន់​ពួកវា ។</translation>
+        <translation>មាន​ឧបករណ៍​បញ្ជា​ផ្ទុក​ទាំង​អស់​សម្រាប់​ម៉ាស៊ី​ននេះ​ និង​រូប​ភាព​និម្មិត​ និងដ្រាយ​​ម៉ាស៊ីន​ដែល​បាន​​ភ្ជាប់​​ទៅកាន់​ពួកវា ។</translation>
     </message>
     <message>
         <source>Information</source>
@@ -4904,7 +5385,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>The Storage Tree can contain several controllers of different types. This machine currently has no controllers.</source>
-        <translation>មែក​ធាង​ផ្ទុក​អាច​មាន​ឧបករណ៍​បញ្ជា​​​បី​ បួន​​​​ប្រ​ភេទ​ខុសៗ​គ្នា​ ។ ម៉ាស៊ីន​បច្ចុប្បន្ន​នេះ មិន​មាន​ឧបករណ៍​បញ្ជា​ឡើយ​ ។</translation>
+        <translation>មែក​ធាង​ផ្ទុក​អាច​មាន​ឧបករណ៍​បញ្ជា​​​បី​ បួន​​​​ប្រ​ភេទ​ខុសៗ​គ្នា​ ។ ម៉ាស៊ីន​បច្ចុប្បន្ន​នេះ មិន​មាន​ឧបករណ៍​បញ្ជា​ឡើយ​ ។</translation>
     </message>
     <message>
         <source>Attributes</source>
@@ -4912,27 +5393,27 @@ network adapter name</comment>
     </message>
     <message>
         <source>&Name:</source>
-        <translation>ឈ្មោះ ៖</translation>
+        <translation>ឈ្មោះ ៖</translation>
     </message>
     <message>
         <source>Changes the name of the storage controller currently selected in the Storage Tree.</source>
-        <translation>ប្តូរ​ឈ្មោះ​របស់​ឧបករណ៍​បញ្ជា​ផ្ទុក ​បច្ចុប្បន្ន​ដែល​បានជ្រើស​ក្នុ​ងមែក​ធាង​ផ្ទុក ។</translation>
+        <translation>ប្តូរ​ឈ្មោះ​របស់​ឧបករណ៍​បញ្ជា​ផ្ទុក ​បច្ចុប្បន្ន​ដែល​បានជ្រើស​ក្នុ​ងមែក​ធាង​ផ្ទុក ។</translation>
     </message>
     <message>
         <source>&Type:</source>
-        <translation>ប្រភេទ ៖</translation>
+        <translation>ប្រភេទ ៖</translation>
     </message>
     <message>
         <source>Selects the sub-type of the storage controller currently selected in the Storage Tree.</source>
-        <translation>​ជ្រើស​ប្រ​ភេទ​រង​​របស់​ឧបករណ៍​បញ្ជា​ផ្ទុក​បច្ចុប្បន្ន​ដែល​បាន​ជ្រើស​ក្នុ​ង​មែក​ធាង​ផ្ទុក ។</translation>
+        <translation>​ជ្រើស​ប្រ​ភេទ​រង​​របស់​ឧបករណ៍​បញ្ជា​ផ្ទុក​បច្ចុប្បន្ន​ដែល​បាន​ជ្រើស​ក្នុ​ង​មែក​ធាង​ផ្ទុក ។</translation>
     </message>
     <message>
         <source>S&lot:</source>
-        <translation type="obsolete">រន្ធ ៖</translation>
+        <translation type="obsolete">រន្ធ ៖</translation>
     </message>
     <message>
         <source>Selects the slot on the storage controller used by this attachment. The available slots depend on the type of the controller and other attachments on it.</source>
-        <translation>ជ្រើស​រន្ធ​លើ​ឧបករណ៍​បញ្ជា​ផ្ទុក ​ដែល​បាន​ប្រើ​ដោយ​ឯកសារ​ភ្ជាប់​នេះ​ ។​ ​រន្ធ​ដែលអាចរកបានអាស្រ័យ​​លើ​ប្រ​ភេទ​របស់​ឧបករណ៍បញ្ជា​ និង​ឯកសារ​ភ្ជាប់​​​​លើ​វាផ្សេង​ទៀត​​ ។</translation>
+        <translation>ជ្រើស​រន្ធ​លើ​ឧបករណ៍​បញ្ជា​ផ្ទុក ​ដែល​បាន​ប្រើ​ដោយ​ឯកសារ​ភ្ជាប់​នេះ​ ។​ ​រន្ធ​ដែលអាចរកបានអាស្រ័យ​​លើ​ប្រ​ភេទ​របស់​ឧបករណ៍បញ្ជា​ និង​ឯកសារ​ភ្ជាប់​​​​លើ​វាផ្សេង​ទៀត​​ ។</translation>
     </message>
     <message>
         <source>Selects the virtual disk image or the host drive used by this attachment.</source>
@@ -4940,7 +5421,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>Opens the Virtual Media Manager to select a virtual image for this attachment.</source>
-        <translation type="obsolete">បើក​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត ដើម្បី​ជ្រើស​រូបភាព​​និម្មិត​សម្រាប់​ឯកសារ​ភ្ជាប់​នេះ ។</translation>
+        <translation type="obsolete">បើក​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត ដើម្បី​ជ្រើស​រូបភាព​​និម្មិត​សម្រាប់​ឯកសារ​ភ្ជាប់​នេះ ។</translation>
     </message>
     <message>
         <source>Open Virtual Media Manager</source>
@@ -4952,7 +5433,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>When checked, allows the guest to send ATAPI commands directly to the host-drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</source>
-        <translation>នៅ​ពេល​ដែល​បាន​ធីក​ អនុញ្ញាត​ម៉ាស៊ីន​ភ្ញៀវ​ផ្ញើពាក្យ​បញ្ជា​​ ATAPI ដោយ​ផ្ទាល់​​ទៅ​ដ្រាយ​ម៉ាស៊ីន ដែល​​​ធ្វើ​ឲ្យ​វា​អាច​ប្រើ​​ឧបករណ៍​​​សរសេរ​ស៊ី​ឌី​​/​ឌី​វី​ឌី​ ​ដែល​បាន​តភ្ជាប់​ទៅ​ម៉ាស៊ីន​នៅ​​ក្នុង​ VM ។ ចំណាំថា ​ការ​សរសេរស៊ីឌីអូឌីយ៉ូ​ខាង​ក្នុង​ VM មិន​ត្រូវ​បាន​គាំ​ទ្រ​នៅ​ឡើយ​ទេ​ ។</translation>
+        <translation>នៅ​ពេល​ដែល​បាន​ធីក​ អនុញ្ញាត​ម៉ាស៊ីន​ភ្ញៀវ​ផ្ញើពាក្យ​បញ្ជា​​ ATAPI ដោយ​ផ្ទាល់​​ទៅ​ដ្រាយ​ម៉ាស៊ីន ដែល​​​ធ្វើ​ឲ្យ​វា​អាច​ប្រើ​​ឧបករណ៍​​​សរសេរ​ស៊ី​ឌី​​/​ឌី​វី​ឌី​ ​ដែល​បាន​តភ្ជាប់​ទៅ​ម៉ាស៊ីន​នៅ​​ក្នុង​ VM ។ ចំណាំថា ​ការ​សរសេរស៊ីឌីអូឌីយ៉ូ​ខាង​ក្នុង​ VM មិន​ត្រូវ​បាន​គាំ​ទ្រ​នៅ​ឡើយ​ទេ​ ។</translation>
     </message>
     <message>
         <source>&Passthrough</source>
@@ -4960,11 +5441,11 @@ network adapter name</comment>
     </message>
     <message>
         <source>Virtual Size:</source>
-        <translation>ទំហំនិម្មិត​ ៖</translation>
+        <translation>ទំហំនិម្មិត​ ៖</translation>
     </message>
     <message>
         <source>Actual Size:</source>
-        <translation>ទំហំ​ពិត​ ៖</translation>
+        <translation>ទំហំ​ពិត​ ៖</translation>
     </message>
     <message>
         <source>Size:</source>
@@ -4980,7 +5461,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>Attached to:</source>
-        <translation>បាន​​ភ្ជាប់ទៅកាន់ ៖</translation>
+        <translation>បាន​​ភ្ជាប់ទៅកាន់ ៖</translation>
     </message>
     <message>
         <source>Allows to use host I/O caching capabilities.</source>
@@ -5015,18 +5496,6 @@ network adapter name</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD &Drive:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Floppy &Drive:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5047,10 +5516,6 @@ network adapter name</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Remove disk from virtual drive</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5116,32 +5581,80 @@ network adapter name</comment>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSystem</name>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSystem</name>
     <message>
         <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">អ្នកបាន​ផ្ដល់សតិ​កុំព្យូទ័ររបស់​អ្នក​ច្រើនជាង <b>%1%</b> (<b>%2</b>) ដល់​ម៉ាស៊ីន​និម្មិត ។ មិនមាន​សតិ​គ្រប់គ្រាន់​នៅ​សល់​សម្រាប់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​របស់​អ្នក​ទេ ។ សូម​ជ្រើស​​ចំនួន​សតិ​តូច​ជាង​​នេះ ។</translation>
+        <translation type="obsolete">អ្នកបាន​ផ្ដល់សតិ​កុំព្យូទ័ររបស់​អ្នក​ច្រើនជាង <b>%1%</b> (<b>%2</b>) ដល់​ម៉ាស៊ីន​និម្មិត ។ មិនមាន​សតិ​គ្រប់គ្រាន់​នៅ​សល់​សម្រាប់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​របស់​អ្នក​ទេ ។ សូម​ជ្រើស​​ចំនួន​សតិ​តូច​ជាង​​នេះ ។</translation>
     </message>
     <message>
         <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">អ្នក​បាន​ផ្ដល់​សតិ​កុំព្យូទ័រ​ច្រើន <b>%1%</b> (<b>%2</b>) ដល់​ម៉ាស៊ីន​និម្មិត ។ វា​ប្រហែលជា​មិន​គ្រប់គ្រាន់​​សម្រាប់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​របស់​អ្នក​ទេ ។ បន្ត​ដោយ​មានគ្រោះថ្នាក់ ។</translation>
+        <translation type="obsolete">អ្នក​បាន​ផ្ដល់​សតិ​កុំព្យូទ័រ​ច្រើន <b>%1%</b> (<b>%2</b>) ដល់​ម៉ាស៊ីន​និម្មិត ។ វា​ប្រហែលជា​មិន​គ្រប់គ្រាន់​​សម្រាប់​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​របស់​អ្នក​ទេ ។ បន្ត​ដោយ​មានគ្រោះថ្នាក់ ។</translation>
     </message>
     <message>
         <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation type="obsolete">សម្រាប់​អនុវត្ត ចំនួន​ស៊ីភីយូ​ដែល​បាន​ភ្ជាប់​ទៅ​ម៉ាស៊ីន​មិន​អាច​លើស​ពី​​ចំនួន​ពីរ​នៃ​ស៊ីភីយូ​ហ្វីស៊ីខល​នៅ​លើ​ម៉ាស៊ីន (<b>%1</b>) ។ សូម​កាត់​បន្ថយ​ចំនួន​ស៊ីភីយូ​និម្មិត ។</translation>
+        <translation type="obsolete">សម្រាប់​អនុវត្ត ចំនួន​ស៊ីភីយូ​ដែល​បាន​ភ្ជាប់​ទៅ​ម៉ាស៊ីន​មិន​អាច​លើស​ពី​​ចំនួន​ពីរ​នៃ​ស៊ីភីយូ​ហ្វីស៊ីខល​នៅ​លើ​ម៉ាស៊ីន (<b>%1</b>) ។ សូម​កាត់​បន្ថយ​ចំនួន​ស៊ីភីយូ​និម្មិត ។</translation>
     </message>
     <message>
         <source>you have assigned more virtual CPUs to the virtual machine than the number of physical CPUs on your host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation type="obsolete">អ្នក​បានផ្ដល់​ស៊ីភីយូ​និម្មិត​ច្រើន​ដល់​ម៉ាស៊ីន​និម្មិត​ជាង​ចំនួន​ស៊ីភីយូ​ហ្វីស៊ីខល​នៅ​ក្នុង​ប្រព័ន្ធ​ម៉ាស៊ីន​របស់​អ្នក (<b>%1</b>) ។ វា​ទំនង​ជា​បន្ថយ​ការ​អនុវត្ត​ម៉ាស៊ីននិម្មិត​របស់​អ្នក ។ សូម​ពិចារណា​លើការ​កាត់បន្ថយ​ចំនួន​ស៊ីភីយូ​និម្មិត ។</translation>
+        <translation type="obsolete">អ្នក​បានផ្ដល់​ស៊ីភីយូ​និម្មិត​ច្រើន​ដល់​ម៉ាស៊ីន​និម្មិត​ជាង​ចំនួន​ស៊ីភីយូ​ហ្វីស៊ីខល​នៅ​ក្នុង​ប្រព័ន្ធ​ម៉ាស៊ីន​របស់​អ្នក (<b>%1</b>) ។ វា​ទំនង​ជា​បន្ថយ​ការ​អនុវត្ត​ម៉ាស៊ីននិម្មិត​របស់​អ្នក ។ សូម​ពិចារណា​លើការ​កាត់បន្ថយ​ចំនួន​ស៊ីភីយូ​និម្មិត ។</translation>
     </message>
     <message>
         <source>you have assigned more than one virtual CPU to this VM. This will not work unless the IO-APIC feature is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source>
-        <translation type="obsolete">អ្នកបានផ្ដល់​ស៊ីភីយូ​និម្មិត​ច្រើនជាង​ដល់ VM នេះ ។ វា​នឹង​មិន​ដំណើរការ​ទេ លុះត្រា​តែ​លក្ខណៈពិសេស​របស់ IO-APIC ត្រូវ​បានបើក ។ វា​នឹង​ត្រូវ​បាន​ធ្វើ​ដោយ​ស្វ័យ​ប្រវត្តិ នៅពេល​អ្នក​ទទួល​យក​ការ​កំណត់ VM ដោយ​ចុច​ប៊ូតុង​យល់ព្រម ។</translation>
+        <translation type="obsolete">អ្នកបានផ្ដល់​ស៊ីភីយូ​និម្មិត​ច្រើនជាង​ដល់ VM នេះ ។ វា​នឹង​មិន​ដំណើរការ​ទេ លុះត្រា​តែ​លក្ខណៈពិសេស​របស់ IO-APIC ត្រូវ​បានបើក ។ វា​នឹង​ត្រូវ​បាន​ធ្វើ​ដោយ​ស្វ័យ​ប្រវត្តិ នៅពេល​អ្នក​ទទួល​យក​ការ​កំណត់ VM ដោយ​ចុច​ប៊ូតុង​យល់ព្រម ។</translation>
     </message>
     <message>
         <source>you have assigned more than one virtual CPU to this VM. This will not work unless hardware virtualization (VT-x/AMD-V) is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source>
-        <translation type="obsolete">អ្នក​បានផ្ដល់​ស៊ីភីយូ​និម្មិត​ច្រើនជាង​មួយ​ដល់ VM ។ វា​នឹង​មិនដំណើរការ​ទេ លុះត្រា​តែ​ផ្នែក​រឹង​និម្មិត (VT-x/AMD-V) ត្រូវ​បានបើក​ដែរ ។ វា​នឹង​ត្រូវ​បានធ្វើ​ដោយ​ស្វ័យ​ប្រវត្តិ នៅពេល​អ្នក​ទទួល​យក​ការ​កំណត់ VM ដោយ​ចុច​ប៊ូតុងយល់ព្រម ។</translation>
+        <translation type="obsolete">អ្នក​បានផ្ដល់​ស៊ីភីយូ​និម្មិត​ច្រើនជាង​មួយ​ដល់ VM ។ វា​នឹង​មិនដំណើរការ​ទេ លុះត្រា​តែ​ផ្នែក​រឹង​និម្មិត (VT-x/AMD-V) ត្រូវ​បានបើក​ដែរ ។ វា​នឹង​ត្រូវ​បានធ្វើ​ដោយ​ស្វ័យ​ប្រវត្តិ នៅពេល​អ្នក​ទទួល​យក​ការ​កំណត់ VM ដោយ​ចុច​ប៊ូតុងយល់ព្រម ។</translation>
     </message>
     <message>
         <source><qt>%1&nbsp;MB</qt></source>
@@ -5167,11 +5680,11 @@ network adapter name</comment>
     </message>
     <message>
         <source>Base &Memory:</source>
-        <translation>សតិ​គោល​ ៖</translation>
+        <translation>សតិ​គោល​ ៖</translation>
     </message>
     <message>
         <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
-        <translation>ត្រួតពិនិត្យ​ចំនួន​សតិ​ដែលបានផ្ដល់​ទៅ​ម៉ាស៊ីន​និម្មិត ។ ប្រសិនបើ​អ្នក​ផ្ដល់​ច្រើនពេក ម៉ាស៊ីន​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</translation>
+        <translation>ត្រួតពិនិត្យ​ចំនួន​សតិ​ដែលបានផ្ដល់​ទៅ​ម៉ាស៊ីន​និម្មិត ។ ប្រសិនបើ​អ្នក​ផ្ដល់​ច្រើនពេក ម៉ាស៊ីន​មិនអាច​ចាប់ផ្ដើម​បានទេ ។</translation>
     </message>
     <message>
         <source>MB</source>
@@ -5179,11 +5692,11 @@ network adapter name</comment>
     </message>
     <message>
         <source>&Boot Order:</source>
-        <translation>លំដាប់​ចាប់ផ្ដើម ៖</translation>
+        <translation>លំដាប់​ចាប់ផ្ដើម ៖</translation>
     </message>
     <message>
         <source>Defines the boot device order. Use the checkboxes on the left to enable or disable individual boot devices. Move items up and down to change the device order.</source>
-        <translation>កំណត់​លំដាប់​ឧបករណ៍​ចាប់ផ្ដើម​ឡើង ។ ប្រើ​ប្រអប់​ធីក​នៅ​ខាង​ឆ្វេង ដើម្បី​បើក ឬ​បិទ​ឧបករណ៍​ចាប់ផ្ដើមឡើង ។ ផ្លាស់ទី​វា​ឡើង​លើ និង​ចុះក្រោម​ ដើម្បី​ផ្លាស់ប្ដូរ​លំដាប់​ឧបករណ៍ ។</translation>
+        <translation>កំណត់​លំដាប់​ឧបករណ៍​ចាប់ផ្ដើម​ឡើង ។ ប្រើ​ប្រអប់​ធីក​នៅ​ខាង​ឆ្វេង ដើម្បី​បើក ឬ​បិទ​ឧបករណ៍​ចាប់ផ្ដើមឡើង ។ ផ្លាស់ទី​វា​ឡើង​លើ និង​ចុះក្រោម​ ដើម្បី​ផ្លាស់ប្ដូរ​លំដាប់​ឧបករណ៍ ។</translation>
     </message>
     <message>
         <source>Move Up (Ctrl-Up)</source>
@@ -5191,7 +5704,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>Moves the selected boot device up.</source>
-        <translation>ផ្លាស់ទី​ឧបករណ៍​ចាប់ផ្ដើម​ដែលបាន​ជ្រើស​ឡើង​លើ ។</translation>
+        <translation>ផ្លាស់ទី​ឧបករណ៍​ចាប់ផ្ដើម​ដែលបាន​ជ្រើស​ឡើង​លើ ។</translation>
     </message>
     <message>
         <source>Move Down (Ctrl-Down)</source>
@@ -5203,11 +5716,11 @@ network adapter name</comment>
     </message>
     <message>
         <source>Extended Features:</source>
-        <translation>លក្ខណៈ​ពិសេស​ដែល​បានពង្រីក ៖</translation>
+        <translation>លក្ខណៈ​ពិសេស​ដែល​បានពង្រីក ៖</translation>
     </message>
     <message>
         <source>When checked, the virtual machine will support the Input Output APIC (I/O APIC), which may slightly decrease performance. <b>Note:</b> don't disable this feature after having installed a Windows guest operating system!</source>
-        <translation>នៅ​ពេល​បានគូស​ធីក ម៉ាស៊ីន​និម្មិត​នឹង​គាំទ្រ​ Input Output APIC (I/O APIC) ដែលអាច​បន្ថយ​ការ​អនុវត្ត​បន្តិចបន្តួច ។ <b>ចំណាំ ៖</b> កុំ​បិទ​លក្ខណៈពិសេស​នេះ បន្ទាប់​ពី​ដំឡើង​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​វីនដូ !</translation>
+        <translation>នៅ​ពេល​បានគូស​ធីក ម៉ាស៊ីន​និម្មិត​នឹង​គាំទ្រ​ Input Output APIC (I/O APIC) ដែលអាច​បន្ថយ​ការ​អនុវត្ត​បន្តិចបន្តួច ។ <b>ចំណាំ ៖</b> កុំ​បិទ​លក្ខណៈពិសេស​នេះ បន្ទាប់​ពី​ដំឡើង​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​វីនដូ !</translation>
     </message>
     <message>
         <source>Enable &I/O APIC</source>
@@ -5215,7 +5728,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>When checked, the guest will support the Extended Firmware Interface (EFI), which is required to boot certain guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</source>
-        <translation>​នៅ​ពេល​​ដែលបាន​គូស​ធីក​ ម៉ាស៊ីន​ភ្ញៀវ​នឹង​គាំ​ទ្រ Extended Firmware Interface (EFI) ដែល​ត្រូវ​បាន​ទាម​ទារ​ដើម្បី​ចាប់ផ្ដើម​ប្រ​ព័ន្ធ​ប្រតិបត្តិ​​ការ​​ម៉ាស៊ីន​ភ្ញៀវពិត​ប្រាកដ ។​ ប្រ​ព័ន្ធ​ប្រតិបត្តិ​ការ​​ដែល​មិនមែន​ ​EFI ​​នឹង​មិនអាច​ទៅ​ចាប់ផ្តើម​​បាន​ទេ ​​ប្រ​សិន​បើ​ជម្រើស​ត្រូវ​បាន​ធ្វើ​ឲ្យ​សកម្ម​ ។</translation>
+        <translation>​នៅ​ពេល​​ដែលបាន​គូស​ធីក​ ម៉ាស៊ីន​ភ្ញៀវ​នឹង​គាំ​ទ្រ Extended Firmware Interface (EFI) ដែល​ត្រូវ​បាន​ទាម​ទារ​ដើម្បី​ចាប់ផ្ដើម​ប្រ​ព័ន្ធ​ប្រតិបត្តិ​​ការ​​ម៉ាស៊ីន​ភ្ញៀវពិត​ប្រាកដ ។​ ប្រ​ព័ន្ធ​ប្រតិបត្តិ​ការ​​ដែល​មិនមែន​ ​EFI ​​នឹង​មិនអាច​ទៅ​ចាប់ផ្តើម​​បាន​ទេ ​​ប្រ​សិន​បើ​ជម្រើស​ត្រូវ​បាន​ធ្វើ​ឲ្យ​សកម្ម​ ។</translation>
     </message>
     <message>
         <source>Enable &EFI (special OSes only)</source>
@@ -5231,11 +5744,11 @@ network adapter name</comment>
     </message>
     <message>
         <source>Controls the number of virtual CPUs in the virtual machine.</source>
-        <translation type="obsolete">ត្រួត​ពិនិត្យចំនួន​ស៊ីភីយូ​និម្មិត​នៅ​ក្នុង​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation type="obsolete">ត្រួត​ពិនិត្យចំនួន​ស៊ីភីយូ​និម្មិត​នៅ​ក្នុង​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
     <message>
         <source>When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine.</source>
-        <translation>នៅពេល​បាន​គូស​ធីក លក្ខណៈពិសេស Physical Address Extension (PAE) របស់​ស៊ីភីយូ​​ម៉ាស៊ីន​នឹង​ត្រូវ​បានបង្ហាញ​​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation>នៅពេល​បាន​គូស​ធីក លក្ខណៈពិសេស Physical Address Extension (PAE) របស់​ស៊ីភីយូ​​ម៉ាស៊ីន​នឹង​ត្រូវ​បានបង្ហាញ​​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
     <message>
         <source>Enable PA&E/NX</source>
@@ -5247,11 +5760,11 @@ network adapter name</comment>
     </message>
     <message>
         <source>Hardware Virtualization:</source>
-        <translation>ការ​ធ្វើ​ផ្នែក​រឹង​និម្មិត ៖</translation>
+        <translation>ការ​ធ្វើ​ផ្នែក​រឹង​និម្មិត ៖</translation>
     </message>
     <message>
         <source>When checked, the virtual machine will try to make use of the host CPU's hardware virtualization extensions such as Intel VT-x and AMD-V.</source>
-        <translation>នៅ​ពេលបាន​គូស​ធីក ម៉ាស៊ីននិម្មិត​នឹង​ព្យាយាម​ប្រាកដថា​ ការ​ប្រើ​ប្រាស់​ផ្នែកបន្ថែម​និម្មិត​ផ្នែក​រឹង​របស់​ស៊ីភីយូ ដូ​ចជា Intel VT-x និង AMD-V ។</translation>
+        <translation>នៅ​ពេលបាន​គូស​ធីក ម៉ាស៊ីននិម្មិត​នឹង​ព្យាយាម​ប្រាកដថា​ ការ​ប្រើ​ប្រាស់​ផ្នែកបន្ថែម​និម្មិត​ផ្នែក​រឹង​របស់​ស៊ីភីយូ ដូ​ចជា Intel VT-x និង AMD-V ។</translation>
     </message>
     <message>
         <source>Enable &VT-x/AMD-V</source>
@@ -5259,7 +5772,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source>
-        <translation>នៅពេល​ដែលបានគូស​ធីក ម៉ាស៊ីន​និម្មិត​នឹង​ព្យាយាម​ប្រាកដ​ថា​ផ្នែក​បន្ថែម paging ខាង​ក្នុង​របស់ Intel VT-x និង AMD-V ។</translation>
+        <translation>នៅពេល​ដែលបានគូស​ធីក ម៉ាស៊ីន​និម្មិត​នឹង​ព្យាយាម​ប្រាកដ​ថា​ផ្នែក​បន្ថែម paging ខាង​ក្នុង​របស់ Intel VT-x និង AMD-V ។</translation>
     </message>
     <message>
         <source>Enable Nested Pa&ging</source>
@@ -5330,31 +5843,39 @@ network adapter name</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5386,27 +5907,27 @@ network adapter name</comment>
     </message>
     <message>
         <source>Adds a new USB filter with all fields initially set to empty strings. Note that such a filter will match any attached USB device.</source>
-        <translation>បន្ថែម​តម្រង USB ថ្មី​ដែលមាន​វាល​ទាំងអស់​ ដោយ​ដំបូង​កំណត់​ខ្សែអក្សរ​ទៅ​ទទេ ។ ចំណាំ​ថា តម្រង​បែប​នេះ​នឹង​ផ្គូផ្គង​ឧបករណ៍ USB ដែល​បាន​ភ្ជាប់ ។</translation>
+        <translation>បន្ថែម​តម្រង USB ថ្មី​ដែលមាន​វាល​ទាំងអស់​ ដោយ​ដំបូង​កំណត់​ខ្សែអក្សរ​ទៅ​ទទេ ។ ចំណាំ​ថា តម្រង​បែប​នេះ​នឹង​ផ្គូផ្គង​ឧបករណ៍ USB ដែល​បាន​ភ្ជាប់ ។</translation>
     </message>
     <message>
         <source>Adds a new USB filter with all fields set to the values of the selected USB device attached to the host PC.</source>
-        <translation>បន្ថែម​តម្រង USB ថ្មី​ដែល​មាន​វាល​ទាំងអស់​កំណត់​ទៅ​តម្លៃ​របស់​ឧបករណ៍​ USB ដែល​ជ្រើស​ដែលបានភ្ជាប់​ទៅ នឹង​ម៉ាស៊ីន ។</translation>
+        <translation>បន្ថែម​តម្រង USB ថ្មី​ដែល​មាន​វាល​ទាំងអស់​កំណត់​ទៅ​តម្លៃ​របស់​ឧបករណ៍​ USB ដែល​ជ្រើស​ដែលបានភ្ជាប់​ទៅ នឹង​ម៉ាស៊ីន ។</translation>
     </message>
     <message>
         <source>Edits the selected USB filter.</source>
-        <translation>កែសម្រួល​តម្រង USB ដែល​បាន​ជ្រើស ។</translation>
+        <translation>កែសម្រួល​តម្រង USB ដែល​បាន​ជ្រើស ។</translation>
     </message>
     <message>
         <source>Removes the selected USB filter.</source>
-        <translation>យក​តម្រង USB ដែលបាន​ជ្រើស​ចេញ ។</translation>
+        <translation>យក​តម្រង USB ដែលបាន​ជ្រើស​ចេញ ។</translation>
     </message>
     <message>
         <source>Moves the selected USB filter up.</source>
-        <translation>ផ្លាស់ទី​តម្រង​ USB ដែលបាន​ជ្រើស​ឡើង​វលើ ។</translation>
+        <translation>ផ្លាស់ទី​តម្រង​ USB ដែលបាន​ជ្រើស​ឡើង​វលើ ។</translation>
     </message>
     <message>
         <source>Moves the selected USB filter down.</source>
-        <translation>ផ្លាស់ទី​តម្រង​ USB ដែលបាន​ជ្រើស​ចុះក្រោម ។</translation>
+        <translation>ផ្លាស់ទី​តម្រង​ USB ដែលបាន​ជ្រើស​ចុះក្រោម ។</translation>
     </message>
     <message>
         <source>New Filter %1</source>
@@ -5415,7 +5936,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>When checked, enables the virtual USB controller of this machine.</source>
-        <translation>នៅពេល​បានគូសធីក បើក​ឧបករណ៍​ត្រួតពិនិត្យ​ USB និម្មិត​របស់ម៉ាស៊ីន​នេះ ។</translation>
+        <translation>នៅពេល​បានគូសធីក បើក​ឧបករណ៍​ត្រួតពិនិត្យ​ USB និម្មិត​របស់ម៉ាស៊ីន​នេះ ។</translation>
     </message>
     <message>
         <source>Enable &USB Controller</source>
@@ -5423,11 +5944,11 @@ network adapter name</comment>
     </message>
     <message>
         <source>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</source>
-        <translation>នៅពេល​បានគូស​ធីក បើក​ឧបករណ៍​ត្រួតពិនិត្យ​ USB EHCI និម្មិត​របស់​ម៉ាស៊ីន​នេះ ។ ឧបករណ៍​បញ្ជា USB EHCI ផ្ដល់​នូវ​ការ​គាំទ្រ USB 2.0 ។</translation>
+        <translation>នៅពេល​បានគូស​ធីក បើក​ឧបករណ៍​ត្រួតពិនិត្យ​ USB EHCI និម្មិត​របស់​ម៉ាស៊ីន​នេះ ។ ឧបករណ៍​បញ្ជា USB EHCI ផ្ដល់​នូវ​ការ​គាំទ្រ USB 2.0 ។</translation>
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>បើក​វត្ថុ​បញ្ជា USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">បើក​វត្ថុ​បញ្ជា USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5435,7 +5956,7 @@ network adapter name</comment>
     </message>
     <message>
         <source>Lists all USB filters of this machine. The checkbox to the left defines whether the particular filter is enabled or not. Use the context menu or buttons to the right to add or remove USB filters.</source>
-        <translation>រាយ​តម្រង USB ទាំង​អស់​របស់ម៉ាស៊ីន​នេះ ។ ប្រអប់​ធីក​នៅ​ខាង​ឆ្វេ​ងកំណត់​ថាតើ​តម្រង​ជាក់លាក់​ត្រូ​វបើក​ ឬ​ក៏​អត់ ។ ប្រើម៉ឺនុយ​បរិបទ​ ឬ​ប៊ូតុង​នៅ​ខាង​ស្ដាំ​ដើម្បី​បន្ថែម ឬ​យក​តម្រង  USB ចេញ ។</translation>
+        <translation>រាយ​តម្រង USB ទាំង​អស់​របស់ម៉ាស៊ីន​នេះ ។ ប្រអប់​ធីក​នៅ​ខាង​ឆ្វេ​ងកំណត់​ថាតើ​តម្រង​ជាក់លាក់​ត្រូ​វបើក​ ឬ​ក៏​អត់ ។ ប្រើម៉ឺនុយ​បរិបទ​ ឬ​ប៊ូតុង​នៅ​ខាង​ស្ដាំ​ដើម្បី​បន្ថែម ឬ​យក​តម្រង  USB ចេញ ។</translation>
     </message>
     <message>
         <source>[filter]</source>
@@ -5444,45 +5965,65 @@ network adapter name</comment>
     <message>
         <source><nobr>Vendor ID: %1</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation type="unfinished"><nobr>លេខ​សម្គាល់​អ្នក​លក់ ៖ %1</nobr></translation>
+        <translation type="unfinished"><nobr>លេខ​សម្គាល់​អ្នក​លក់ ៖ %1</nobr></translation>
     </message>
     <message>
         <source><nobr>Product ID: %2</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation type="unfinished"><nobr>លេខសម្គាល់​ផលិតផល ៖ %2</nobr></translation>
+        <translation type="unfinished"><nobr>លេខសម្គាល់​ផលិតផល ៖ %2</nobr></translation>
     </message>
     <message>
         <source><nobr>Revision: %3</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation type="unfinished"><nobr>កា​រពិនិត្យ​ឡើង​វិញ ៖ %3</nobr></translation>
+        <translation type="unfinished"><nobr>កា​រពិនិត្យ​ឡើង​វិញ ៖ %3</nobr></translation>
     </message>
     <message>
         <source><nobr>Product: %4</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation type="unfinished"><nobr>ផលិតផល ៖ %4</nobr></translation>
+        <translation type="unfinished"><nobr>ផលិតផល ៖ %4</nobr></translation>
     </message>
     <message>
         <source><nobr>Manufacturer: %5</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation type="unfinished"><nobr>ក្រុមហ៊ុន​ផលិត ៖ %5</nobr></translation>
+        <translation type="unfinished"><nobr>ក្រុមហ៊ុន​ផលិត ៖ %5</nobr></translation>
     </message>
     <message>
         <source><nobr>Serial No.: %1</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation type="unfinished"><nobr>លេខ​ស៊េរី ៖ %1</nobr></translation>
+        <translation type="unfinished"><nobr>លេខ​ស៊េរី ៖ %1</nobr></translation>
     </message>
     <message>
         <source><nobr>Port: %1</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation type="unfinished"><nobr>ច្រក ៖ %1</nobr></translation>
+        <translation type="unfinished"><nobr>ច្រក ៖ %1</nobr></translation>
     </message>
     <message>
         <source><nobr>State: %1</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation type="unfinished"><nobr>ស្ថានភាព ៖ %1</nobr></translation>
+        <translation type="unfinished"><nobr>ស្ថានភាព ៖ %1</nobr></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5505,83 +6046,83 @@ network adapter name</comment>
     </message>
     <message>
         <source>&Name:</source>
-        <translation>ឈ្មោះ ៖</translation>
+        <translation>ឈ្មោះ ៖</translation>
     </message>
     <message>
         <source>Holds the filter name.</source>
-        <translation>បង្ហាញឈ្មោះ​តម្រង ។</translation>
+        <translation>បង្ហាញឈ្មោះ​តម្រង ។</translation>
     </message>
     <message>
         <source>&Vendor ID:</source>
-        <translation>លេខ​សម្គាល់​អ្នក​លក់ ៖</translation>
+        <translation>លេខ​សម្គាល់​អ្នក​លក់ ៖</translation>
     </message>
     <message>
         <source>Defines the vendor ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
-        <translation>កំណត់​តម្រង​លេខ​សម្គាល់​អ្នក​លក់ ។ ទ្រង់ទ្រាយ​ខ្សែអក្សរ <i>ផ្គូផ្គងជាក់លាក់</i> គឺ <tt>XXXX</tt> ដែល <tt>X</tt> ជា​គោល​ដប់ប្រាំមួយ ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
+        <translation>កំណត់​តម្រង​លេខ​សម្គាល់​អ្នក​លក់ ។ ទ្រង់ទ្រាយ​ខ្សែអក្សរ <i>ផ្គូផ្គងជាក់លាក់</i> គឺ <tt>XXXX</tt> ដែល <tt>X</tt> ជា​គោល​ដប់ប្រាំមួយ ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
     </message>
     <message>
         <source>&Product ID:</source>
-        <translation>លេខ​សម្គាល់​ផលិតផល ៖</translation>
+        <translation>លេខ​សម្គាល់​ផលិតផល ៖</translation>
     </message>
     <message>
         <source>Defines the product ID filter. The <i>exact match</i> string format is <tt>XXXX</tt> where <tt>X</tt> is a hexadecimal digit. An empty string will match any value.</source>
-        <translation>កំណត់​តម្រង​លេខ​សម្គាល់​ផលិតផល ។ ទ្រង់ទ្រាយ​ខ្សែអក្សរ<i>ផ្គូផ្គង​ជាក់លាក់</i> គឺ<tt>XXXX</tt> ដែល <tt>X</tt> គឺជា​គោល​ដប់​ប្រាំមួយ ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
+        <translation>កំណត់​តម្រង​លេខ​សម្គាល់​ផលិតផល ។ ទ្រង់ទ្រាយ​ខ្សែអក្សរ<i>ផ្គូផ្គង​ជាក់លាក់</i> គឺ<tt>XXXX</tt> ដែល <tt>X</tt> គឺជា​គោល​ដប់​ប្រាំមួយ ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
     </message>
     <message>
         <source>&Revision:</source>
-        <translation>ការ​ពិនិត្យ​ឡើង​វិញ ៖</translation>
+        <translation>ការ​ពិនិត្យ​ឡើង​វិញ ៖</translation>
     </message>
     <message>
         <source>Defines the revision number filter. The <i>exact match</i> string format is <tt>IIFF</tt> where <tt>I</tt> is a decimal digit of the integer part and <tt>F</tt> is a decimal digit of the fractional part. An empty string will match any value.</source>
-        <translation>កំណត់​ការ​ពិនិត្យ​តម្រង​លេខ​ឡើង​វិញ ។ ទ្រង់ទ្រាយ​ខ្សែអក្សរ <i>ផ្គូផ្គង​ជាក់លាក់</i> គឺ​<tt>IIFF</tt> ដែល <tt>I</tt> ជា​ចំនួន​គោល​ដប់​របស់​ផ្នែក​ចំនួន​គត់​ ហើយ <tt>F</tt> គឺជា​ចំនួន​គោលដប់​របស់​ផ្នែក​ប្រភាគ ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
+        <translation>កំណត់​ការ​ពិនិត្យ​តម្រង​លេខ​ឡើង​វិញ ។ ទ្រង់ទ្រាយ​ខ្សែអក្សរ <i>ផ្គូផ្គង​ជាក់លាក់</i> គឺ​<tt>IIFF</tt> ដែល <tt>I</tt> ជា​ចំនួន​គោល​ដប់​របស់​ផ្នែក​ចំនួន​គត់​ ហើយ <tt>F</tt> គឺជា​ចំនួន​គោលដប់​របស់​ផ្នែក​ប្រភាគ ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
     </message>
     <message>
         <source>&Manufacturer:</source>
-        <translation>អ្នក​បង្កើត ៖</translation>
+        <translation>អ្នក​បង្កើត ៖</translation>
     </message>
     <message>
         <source>Defines the manufacturer filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>កំណត់​តម្រង​អ្នក​ផលិត​ជាខ្សែអក្សរ <i>ផ្គូផ្គង​ជាក់លាក់</i> ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
+        <translation>កំណត់​តម្រង​អ្នក​ផលិត​ជាខ្សែអក្សរ <i>ផ្គូផ្គង​ជាក់លាក់</i> ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
     </message>
     <message>
         <source>Pro&duct:</source>
-        <translation>ផលិតផល ៖</translation>
+        <translation>ផលិតផល ៖</translation>
     </message>
     <message>
         <source>Defines the product name filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>កំណត់​តម្រង​ឈ្មោះផលិតផល​ជាខ្សែអក្សរ <i>ផ្គូផ្គងជាក់លាក់</i> ។ ខ្សែអក្សរទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
+        <translation>កំណត់​តម្រង​ឈ្មោះផលិតផល​ជាខ្សែអក្សរ <i>ផ្គូផ្គងជាក់លាក់</i> ។ ខ្សែអក្សរទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
     </message>
     <message>
         <source>&Serial No.:</source>
-        <translation>លេខ​ស៊េរី ៖</translation>
+        <translation>លេខ​ស៊េរី ៖</translation>
     </message>
     <message>
         <source>Defines the serial number filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>កំណត់​តម្រង​លេខ​ស៊េរី​ជា​ខ្សែអក្សរ <i>កា​រផ្គូផ្គង​ជាក់លាក់</i> ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
+        <translation>កំណត់​តម្រង​លេខ​ស៊េរី​ជា​ខ្សែអក្សរ <i>កា​រផ្គូផ្គង​ជាក់លាក់</i> ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
     </message>
     <message>
         <source>Por&t:</source>
-        <translation>ច្រក ៖</translation>
+        <translation>ច្រក ៖</translation>
     </message>
     <message>
         <source>Defines the host USB port filter as an <i>exact match</i> string. An empty string will match any value.</source>
-        <translation>កំណត់​តម្រង​ច្រក USB ម៉ាស៊ីណ​ជា​ខ្សែអក្សរ <i>ផ្គូផ្គង​ពិតប្រាកដ</i> ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
+        <translation>កំណត់​តម្រង​ច្រក USB ម៉ាស៊ីណ​ជា​ខ្សែអក្សរ <i>ផ្គូផ្គង​ពិតប្រាកដ</i> ។ ខ្សែអក្សរ​ទទេ​នឹង​ផ្គូផ្គង​តម្លៃ​ណាមួយ ។</translation>
     </message>
     <message>
         <source>R&emote:</source>
-        <translation>ពីចម្ងាយ ៖</translation>
+        <translation>ពីចម្ងាយ ៖</translation>
     </message>
     <message>
         <source>Defines whether this filter applies to USB devices attached locally to the host computer (<i>No</i>), to a VRDP client's computer (<i>Yes</i>), or both (<i>Any</i>).</source>
-        <translation>កំណត់​ថាតើ​តម្រង​នេះ​អនុវត្ត​ទៅកាន់​ឧបករណ៍ USB ដែលបាន​ភ្ជាប់​ទៅ​​កុំព្យូទ័រ​ដែរឬទេ (<i>គ្មានទេ</i>) ទៅកាន់​កុំព្យូទ័រ​ភ្ញៀវ​របស់ VRDP (<i>បាទ/ចាស</i>) ឬ​ទាំង​ពីរ (<i>ណាមួយ</i>) ។</translation>
+        <translation>កំណត់​ថាតើ​តម្រង​នេះ​អនុវត្ត​ទៅកាន់​ឧបករណ៍ USB ដែលបាន​ភ្ជាប់​ទៅ​​កុំព្យូទ័រ​ដែរឬទេ (<i>គ្មានទេ</i>) ទៅកាន់​កុំព្យូទ័រ​ភ្ញៀវ​របស់ VRDP (<i>បាទ/ចាស</i>) ឬ​ទាំង​ពីរ (<i>ណាមួយ</i>) ។</translation>
     </message>
     <message>
         <source>&Action:</source>
-        <translation type="obsolete">សកម្មភាព ៖</translation>
+        <translation type="obsolete">សកម្មភាព ៖</translation>
     </message>
     <message>
         <source>Defines an action performed by the host computer when a matching device is attached: give it up to the host OS (<i>Ignore</i>) or grab it for later usage by virtual machines (<i>Hold</i>).</source>
-        <translation type="obsolete">កំណត់​សកម្មភាព​ដែល​បាន​អនុវត្ត​ដោយ​កុំព្យូទ័រ នៅពេល​ផ្គូផ្គង​ឧបករណ៍​ដែល​ត្រូវ​បាន​ភ្ជាប់ ៖ ផ្ដល់​វា​ទៅ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន (<i>មិនអើពើ</i>) ឬ​ចាប់យក​វា​សម្រាប់​ប្រើ​ពេលក្រោយ ដោយ​ម៉ាស៊ីន​និម្មិត <i>រង់ចាំ</i>) ។</translation>
+        <translation type="obsolete">កំណត់​សកម្មភាព​ដែល​បាន​អនុវត្ត​ដោយ​កុំព្យូទ័រ នៅពេល​ផ្គូផ្គង​ឧបករណ៍​ដែល​ត្រូវ​បាន​ភ្ជាប់ ៖ ផ្ដល់​វា​ទៅ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន (<i>មិនអើពើ</i>) ឬ​ចាប់យក​វា​សម្រាប់​ប្រើ​ពេលក្រោយ ដោយ​ម៉ាស៊ីន​និម្មិត <i>រង់ចាំ</i>) ។</translation>
     </message>
     <message>
         <source>USB Filter Details</source>
@@ -5599,7 +6140,7 @@ network adapter name</comment>
     <name>UIMachineWindowNormal</name>
     <message>
         <source>Shows the currently assigned Host key.<br>This key, when pressed alone, toggles the keyboard and mouse capture state. It can also be used in combination with other keys to quickly perform actions from the main menu.</source>
-        <translation>បង្ហាញ​គ្រាប់ចុច​ម៉ាស៊ីន​ដែលបានផ្ដល់​បច្ចុប្បន្ន ។<br>គ្រាប់ចុច​នេះ នៅពេល​ចុច​យូរ បិទ/បើក​ក្ដារចុច ហើយ​ស្ថានភាព​ចាប់យក​កណ្ដុរ ។ វា​អាច​ត្រូវ​បាន​ប្រើ​ក្នុង​បន្សំ​ជា​មួយ​គ្រាប់ចុច​ផ្សេង ដើម្បី​អនុវត្ត​សកម្មភាព​យ៉ាង​លឿន ពី​ម៉ឺនុយ​ចម្បង ។</translation>
+        <translation>បង្ហាញ​គ្រាប់ចុច​ម៉ាស៊ីន​ដែលបានផ្ដល់​បច្ចុប្បន្ន ។<br>គ្រាប់ចុច​នេះ នៅពេល​ចុច​យូរ បិទ/បើក​ក្ដារចុច ហើយ​ស្ថានភាព​ចាប់យក​កណ្ដុរ ។ វា​អាច​ត្រូវ​បាន​ប្រើ​ក្នុង​បន្សំ​ជា​មួយ​គ្រាប់ចុច​ផ្សេង ដើម្បី​អនុវត្ត​សកម្មភាព​យ៉ាង​លឿន ពី​ម៉ឺនុយ​ចម្បង ។</translation>
     </message>
 </context>
 <context>
@@ -5621,7 +6162,7 @@ network adapter name</comment>
         <translation type="obsolete">ជ្រើស</translation>
     </message>
     <message>
-        <source>C&lose</source>
+        <source>Removing medium...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5641,6 +6182,29 @@ network adapter name</comment>
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">បិទ</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">ប្ដូរ</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -5674,123 +6238,123 @@ network adapter name</comment>
     </message>
     <message>
         <source>Failed to open <tt>%1</tt>. Make sure your desktop environment can properly handle URLs of this type.</source>
-        <translation>បានបរាជ័យ​ក្នុងការ​បើក <tt>%1</tt> ។ ប្រាកដ​ថា​បរិស្ថាន​ផ្ទៃតុ​របស់​អ្នក​អាច​គ្រប់គ្រង URLs នៃ​ប្រភេទ​នេះ​យ៉ាង​ត្រឹមត្រូវ ។</translation>
+        <translation>បានបរាជ័យ​ក្នុងការ​បើក <tt>%1</tt> ។ ប្រាកដ​ថា​បរិស្ថាន​ផ្ទៃតុ​របស់​អ្នក​អាច​គ្រប់គ្រង URLs នៃ​ប្រភេទ​នេះ​យ៉ាង​ត្រឹមត្រូវ ។</translation>
     </message>
     <message>
         <source><p>Failed to initialize COM or to find the VirtualBox COM server. Most likely, the VirtualBox server is not running or failed to start.</p><p>The application will now terminate.</p></source>
-        <translation><p>បានបរាជ័យ​ក្នុងកា​រចាប់ផ្ដើម COM ឬ​រកម៉ាស៊ីនបម្រើ VirtualBox COM ។ ភាគ​ច្រើន​ម៉ាស៊ីនបម្រើ VirtualBox មិន​រត់​ ឬ​បរាជ័យ​ក្នុងកា​រចាប់ផ្ដើម ។</p><p>កម្មវិធី​នឹង​បិទ​ឥឡូវ ។</p></translation>
+        <translation><p>បានបរាជ័យ​ក្នុងកា​រចាប់ផ្ដើម COM ឬ​រកម៉ាស៊ីនបម្រើ VirtualBox COM ។ ភាគ​ច្រើន​ម៉ាស៊ីនបម្រើ VirtualBox មិន​រត់​ ឬ​បរាជ័យ​ក្នុងកា​រចាប់ផ្ដើម ។</p><p>កម្មវិធី​នឹង​បិទ​ឥឡូវ ។</p></translation>
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>បានបរាជ័យ​ក្នុងកា​របង្កើត​វត្ថុ VirtualBox COM ។</p><p>កម្មវិធី​នឹង​បិទ​ឥឡូវ​នេះ ។</p></translation>
+        <translation type="obsolete"><p>បានបរាជ័យ​ក្នុងកា​របង្កើត​វត្ថុ VirtualBox COM ។</p><p>កម្មវិធី​នឹង​បិទ​ឥឡូវ​នេះ ។</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
-        <translation>បាន​បរាជ័យ​ក្នុង​ការ​កំណត់លក្ខណៈសម្បត្តិរបស់ VirtualBox ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុង​ការ​កំណត់លក្ខណៈសម្បត្តិរបស់ VirtualBox ។</translation>
     </message>
     <message>
         <source>Failed to access the USB subsystem.</source>
-        <translation>បាន​បរាជ័យ​ក្នុង​ការ​​ចូលដំណើរការ​ប្រព័ន្ធ​រង​របស់ USB ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុង​ការ​​ចូលដំណើរការ​ប្រព័ន្ធ​រង​របស់ USB ។</translation>
     </message>
     <message>
         <source>Failed to create a new virtual machine.</source>
-        <translation>បាន​បរាជ័យ​ក្នុង​ការ​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុង​ការ​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី ។</translation>
     </message>
     <message>
         <source>Failed to create a new virtual machine <b>%1</b>.</source>
-        <translation type="obsolete">បានបរាជ័យ​ក្នុងការ​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី <b>%1</b> ។</translation>
+        <translation type="obsolete">បានបរាជ័យ​ក្នុងការ​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to apply the settings to the virtual machine <b>%1</b>.</source>
-        <translation type="obsolete">បានបរាជ័យ​ក្នុងការ​អនុវត្ត​ការ​កំណត់ទៅ​កាន់​ម៉ាស៊ីន​និម្មិត​ថ្មី <b>%1</b> ។</translation>
+        <translation type="obsolete">បានបរាជ័យ​ក្នុងការ​អនុវត្ត​ការ​កំណត់ទៅ​កាន់​ម៉ាស៊ីន​និម្មិត​ថ្មី <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to start the virtual machine <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងការ​ចាប់ផ្ដើម​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងការ​ចាប់ផ្ដើម​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to pause the execution of the virtual machine <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុង​កា​រផ្អាក​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុង​កា​រផ្អាក​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to resume the execution of the virtual machine <b>%1</b>.</source>
-        <translation>បានបរាជ័យ​ក្នុងការ​បន្ត​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
+        <translation>បានបរាជ័យ​ក្នុងការ​បន្ត​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to save the state of the virtual machine <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងកា​ររក្សាទុក​ស្ថានភាព​របស់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងកា​ររក្សាទុក​ស្ថានភាព​របស់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to create a snapshot of the virtual machine <b>%1</b>.</source>
-        <translation>បានបរាជ័យ​ក្នុងការ​បង្កើត​រូបថត​អេក្រង់​របស់ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
+        <translation>បានបរាជ័យ​ក្នុងការ​បង្កើត​រូបថត​អេក្រង់​របស់ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to stop the virtual machine <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងការ​បញ្ឈប់​ម៉ាស៊ីននិម្មិត <b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងការ​បញ្ឈប់​ម៉ាស៊ីននិម្មិត <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to remove the virtual machine <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងកា​រយក​ម៉ាស៊ីន​និម្មិត​ចេញ <b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងកា​រយក​ម៉ាស៊ីន​និម្មិត​ចេញ <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to discard the saved state of the virtual machine <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងការ​បោះបង់​ស្ថានភាព​របស់​ម៉ាស៊ីន​និម្មិត​ដែលបាន​រក្សាទុក <b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងការ​បោះបង់​ស្ថានភាព​របស់​ម៉ាស៊ីន​និម្មិត​ដែលបាន​រក្សាទុក <b>%1</b> ។</translation>
     </message>
     <message>
         <source>There is no virtual machine named <b>%1</b>.</source>
-        <translation>គ្មាន​ម៉ាស៊ីន​និម្មិត​ដែល​មាន​ឈ្មោះ <b>%1</b> នោះ​ទេ ។</translation>
+        <translation>គ្មាន​ម៉ាស៊ីន​និម្មិត​ដែល​មាន​ឈ្មោះ <b>%1</b> នោះ​ទេ ។</translation>
     </message>
     <message>
         <source><p>Are you sure you want to permanently delete the virtual machine <b>%1</b>?</p><p>This operation cannot be undone.</p></source>
-        <translation type="obsolete"><p>តើអ្នក​ប្រាកដ​ជា​ចង់​លុប​ម៉ាស៊ីន​និម្មិត <b>%1</b> ជា​អចិន្ត្រៃយ៍​ឬ ?</p><p>ប្រតិបត្តិការ​នេះ​មិនអាច​ត្រូវ​បាន​ធ្វើ​វិញ​ទេ ។</p></translation>
+        <translation type="obsolete"><p>តើអ្នក​ប្រាកដ​ជា​ចង់​លុប​ម៉ាស៊ីន​និម្មិត <b>%1</b> ជា​អចិន្ត្រៃយ៍​ឬ ?</p><p>ប្រតិបត្តិការ​នេះ​មិនអាច​ត្រូវ​បាន​ធ្វើ​វិញ​ទេ ។</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to unregister the inaccessible virtual machine <b>%1</b>?</p><p>You will not be able to register it again from GUI.</p></source>
-        <translation type="obsolete"><p>តើ​អ្នក​ប្រាកដ​ជា​ចង់​លុប​ឈ្មោះ​ម៉ាស៊ីននិម្មិត <b>%1</b>​ដែល​មិនអាច​ចូលដំណើរការ​បាន​​ដែរឬទេ?</p><p>អ្នក​នឹង​មិនអាច​ចុះឈ្មោះ​វា​បានទៀតទេ​ពី GUI ។</p></translation>
+        <translation type="obsolete"><p>តើ​អ្នក​ប្រាកដ​ជា​ចង់​លុប​ឈ្មោះ​ម៉ាស៊ីននិម្មិត <b>%1</b>​ដែល​មិនអាច​ចូលដំណើរការ​បាន​​ដែរឬទេ?</p><p>អ្នក​នឹង​មិនអាច​ចុះឈ្មោះ​វា​បានទៀតទេ​ពី GUI ។</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to discard the saved state of the virtual machine <b>%1</b>?</p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
-        <translation type="obsolete"><p>តើ​អ្នក​ប្រាកដ​ជា​ចង់​បោះបង់​ស្ថានភាព​ដែលបានរក្សាទុក​របស់ម៉ាស៊ីន​និម្មិត <b>%1</b>ដែរឬទេ ?</p><p>ប្រតិបត្តិការ​នេះ​មិន​ស្មើ​នឹង​កា​រកំណត់​ឡើង​វិញ ឬ​បិទ​ម៉ាស៊ីន​​ដោ​​យ​មិន​បានចុច​ប៊ូតុង​ដោយ​សមរម្យ​តាម​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។</p></translation>
+        <translation type="obsolete"><p>តើ​អ្នក​ប្រាកដ​ជា​ចង់​បោះបង់​ស្ថានភាព​ដែលបានរក្សាទុក​របស់ម៉ាស៊ីន​និម្មិត <b>%1</b>ដែរឬទេ ?</p><p>ប្រតិបត្តិការ​នេះ​មិន​ស្មើ​នឹង​កា​រកំណត់​ឡើង​វិញ ឬ​បិទ​ម៉ាស៊ីន​​ដោ​​យ​មិន​បានចុច​ប៊ូតុង​ដោយ​សមរម្យ​តាម​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។</p></translation>
     </message>
     <message>
         <source>Failed to create a new session.</source>
-        <translation>បានបរាជ័យ​ក្នុងការ​បង្កើត​សម័យ​ថ្មី ។</translation>
+        <translation>បានបរាជ័យ​ក្នុងការ​បង្កើត​សម័យ​ថ្មី ។</translation>
     </message>
     <message>
         <source>Failed to open a session for the virtual machine <b>%1</b>.</source>
-        <translation>បានបរាជ័យ​ក្នុងកា​របើក​សម័យ​សម្រាប់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
+        <translation>បានបរាជ័យ​ក្នុងកា​របើក​សម័យ​សម្រាប់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to remove the host network interface <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងការ​យក​ចំណុច​ប្រទាក់​បណ្ដាញ​ម៉ាស៊ីន​ <b>%1</b> ចេញ ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងការ​យក​ចំណុច​ប្រទាក់​បណ្ដាញ​ម៉ាស៊ីន​ <b>%1</b> ចេញ ។</translation>
     </message>
     <message>
         <source>Failed to attach the USB device <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងកា​រភ្ជាប់​ឧបករណ៍ USB <b>%1</b> ទៅ​ម៉ាស៊ីន​និម្មិត <b>%2</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងកា​រភ្ជាប់​ឧបករណ៍ USB <b>%1</b> ទៅ​ម៉ាស៊ីន​និម្មិត <b>%2</b> ។</translation>
     </message>
     <message>
         <source>Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>បាន​ប​រាជ័យ​ក្នុងការ​ផ្ដាច់​ឧបករណ៍ USB <b>%1</b> ពី​ម៉ាស៊ីន​និម្មិត <b>%2</b> ។</translation>
+        <translation>បាន​ប​រាជ័យ​ក្នុងការ​ផ្ដាច់​ឧបករណ៍ USB <b>%1</b> ពី​ម៉ាស៊ីន​និម្មិត <b>%2</b> ។</translation>
     </message>
     <message>
         <source>Failed to create the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងកា​របង្កើត​ថត <b>%1</b> (ចង្អុល​ទៅ​ <nobr><b>%2</b></nobr>) សម្រាប់​ម៉ាស៊ីន​និម្មិត <b>%3</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងកា​របង្កើត​ថត <b>%1</b> (ចង្អុល​ទៅ​ <nobr><b>%2</b></nobr>) សម្រាប់​ម៉ាស៊ីន​និម្មិត <b>%3</b> ។</translation>
     </message>
     <message>
         <source>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងកា​រយក​ថត​ដែល​បាន​ចែករំលែក​ចេញ <b>%1</b> (ចង្អុល​ទៅ <nobr><b>%2</b></nobr>) ពី​ម៉ាស៊ីន​និម្មិត <b>%3</b> ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងកា​រយក​ថត​ដែល​បាន​ចែករំលែក​ចេញ <b>%1</b> (ចង្អុល​ទៅ <nobr><b>%2</b></nobr>) ពី​ម៉ាស៊ីន​និម្មិត <b>%3</b> ។</translation>
     </message>
     <message>
         <source><p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> in the current video mode. You need to capture the mouse (by clicking over the VM display or pressing the host key) in order to use the mouse inside the guest OS.</p></source>
-        <translation><p>ម៉ាស៊ីន​និម្មិត​រាយការណ៍​ថា​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​មិន​គាំទ្រទេ ។ <b>ការ​រួម​បញ្ចូល​ទ្រនិច​កណ្ដុរ</b> នៅ​ក្នុង​របៀប​វីដេអូ​បច្ចុប្បន្ន ។ អ្នក​ត្រូវតែ​ចាប់យក​កណ្ដុរ (ដោយ​ចុច​លើ​ការ​បង្ហាញ VM ឬ​ចុច​គ្រាប់ចុច​លើ​ម៉ាស៊ីន) ដើម្បី​ប្រើ​កណ្ដុរ​ខាង​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។</p></translation>
+        <translation><p>ម៉ាស៊ីន​និម្មិត​រាយការណ៍​ថា​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​មិន​គាំទ្រទេ ។ <b>ការ​រួម​បញ្ចូល​ទ្រនិច​កណ្ដុរ</b> នៅ​ក្នុង​របៀប​វីដេអូ​បច្ចុប្បន្ន ។ អ្នក​ត្រូវតែ​ចាប់យក​កណ្ដុរ (ដោយ​ចុច​លើ​ការ​បង្ហាញ VM ឬ​ចុច​គ្រាប់ចុច​លើ​ម៉ាស៊ីន) ដើម្បី​ប្រើ​កណ្ដុរ​ខាង​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។</p></translation>
     </message>
     <message>
         <source><p>The Virtual Machine is currently in the <b>Paused</b> state and not able to see any keyboard or mouse input. If you want to continue to work inside the VM, you need to resume it by selecting the corresponding action from the menu bar.</p></source>
-        <translation><p>ម៉ាស៊ីន​និម្មិត​បច្ចុប្បន្ន​ស្ថិត​ក្នុង​ស្ថានភាព <b>បាន​ផ្អាក</b> ហើយ​ដូច្នេះ​មិន​ទទួល​​ក្ដារចុច​ ឬ​កណ្ដុរ​ណា​មួយ ។ ប្រសិន​បើ​អ្នក​ចង់​បន្ត​ដំណើរការ​ខាង​ក្នុង VM អ្នក​ត្រូវ​តែ​បន្តវា ដោយ​ជ្រើស​សកម្មភាព​ដែល​ទាក់ទង​ពីរបារ​ម៉ឺនុយ ។</p></translation>
+        <translation><p>ម៉ាស៊ីន​និម្មិត​បច្ចុប្បន្ន​ស្ថិត​ក្នុង​ស្ថានភាព <b>បាន​ផ្អាក</b> ហើយ​ដូច្នេះ​មិន​ទទួល​​ក្ដារចុច​ ឬ​កណ្ដុរ​ណា​មួយ ។ ប្រសិន​បើ​អ្នក​ចង់​បន្ត​ដំណើរការ​ខាង​ក្នុង VM អ្នក​ត្រូវ​តែ​បន្តវា ដោយ​ជ្រើស​សកម្មភាព​ដែល​ទាក់ទង​ពីរបារ​ម៉ឺនុយ ។</p></translation>
     </message>
     <message>
         <source><p>Cannot run VirtualBox in <i>VM Selector</i> mode due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation type="obsolete"><p>មិន​អាច​រត់ VirtualBox នៅ​ក្នុងរបៀប <i>កម្មវិធី​ជ្រើស VM​</i> ដោយសារ​តែ​ការ​ដាក់កម្រិត​មូលដ្ឋាន ។</p><p>កម្មវិធី​នឹង​បញ្ចប់​ឥឡូវ ។</p></translation>
+        <translation type="obsolete"><p>មិន​អាច​រត់ VirtualBox នៅ​ក្នុងរបៀប <i>កម្មវិធី​ជ្រើស VM​</i> ដោយសារ​តែ​ការ​ដាក់កម្រិត​មូលដ្ឋាន ។</p><p>កម្មវិធី​នឹង​បញ្ចប់​ឥឡូវ ។</p></translation>
     </message>
     <message>
         <source><nobr>Fatal Error</nobr></source>
@@ -5810,85 +6374,85 @@ network adapter name</comment>
     <message>
         <source><nobr>Error ID: </nobr></source>
         <comment>runtime error info</comment>
-        <translation><nobr>លេខសម្គាល់​កំហុស ៖</nobr></translation>
+        <translation><nobr>លេខសម្គាល់​កំហុស ៖</nobr></translation>
     </message>
     <message>
         <source>Severity: </source>
         <comment>runtime error info</comment>
-        <translation>ភាព​ម៉ឺងម៉ាត់ ៖</translation>
+        <translation>ភាព​ម៉ឺងម៉ាត់ ៖</translation>
     </message>
     <message>
         <source><p>A fatal error has occurred during virtual machine execution! The virtual machine will be powered off. Please copy the following error message using the clipboard to help diagnose the problem:</p></source>
-        <translation><p>កំហុស​ធ្ងន់ធ្ងរ​មានកើត​ឡើង​កំឡុង​ពេល​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត ! ម៉ាស៊ីន​និម្មិត​នឹង​ត្រូវ​បាន​បិទ ។ វា​ត្រូ​វបាន​ស្នើ​ឲ្យ​ប្រើ​ក្ដារតម្បៀតខ្ទាស់​ដើម្បី​ចម្លង​សារ​កំហុស​ដើម្បីពិនិត្យ​មើល​បន្ថែម​ទេ ៖</p></translation>
+        <translation><p>កំហុស​ធ្ងន់ធ្ងរ​មានកើត​ឡើង​កំឡុង​ពេល​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត ! ម៉ាស៊ីន​និម្មិត​នឹង​ត្រូវ​បាន​បិទ ។ វា​ត្រូ​វបាន​ស្នើ​ឲ្យ​ប្រើ​ក្ដារតម្បៀតខ្ទាស់​ដើម្បី​ចម្លង​សារ​កំហុស​ដើម្បីពិនិត្យ​មើល​បន្ថែម​ទេ ៖</p></translation>
     </message>
     <message>
         <source><p>An error has occurred during virtual machine execution! The error details are shown below. You may try to correct the error and resume the virtual machine execution.</p></source>
-        <translation><p>កំហុស​បានកើត​ឡើង​កំឡុង​ពេល​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត ! សេចក្ដី​លម្អិត​កំហុស​ត្រូវ​បានបង្ហាញ​ខាង​ក្រោម ។ អ្នកអាច​ព្យាយាម​កែ​កំហុស​ដែល​ពិពណ៌នា ហើយ​បន្ត​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត ។</p></translation>
+        <translation><p>កំហុស​បានកើត​ឡើង​កំឡុង​ពេល​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត ! សេចក្ដី​លម្អិត​កំហុស​ត្រូវ​បានបង្ហាញ​ខាង​ក្រោម ។ អ្នកអាច​ព្យាយាម​កែ​កំហុស​ដែល​ពិពណ៌នា ហើយ​បន្ត​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត ។</p></translation>
     </message>
     <message>
         <source><p>The virtual machine execution may run into an error condition as described below. We suggest that you take an appropriate action to avert the error.</p></source>
-        <translation><p>ការ​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត​អាច​រត់​ក្នុង​លក្ខខណ្ឌ​មាន​កំហុស​ដូច​បាន​ពិពណ៌នា​ខាង​ក្រោម ។ អ្នក​អាច​មិនអើពើ​សារ​នេះ​បាន ប៉ុន្តែ​វា​ត្រូវ​បាន​ស្នើ​ឲ្យ​អនុវត្ត​សកម្មភាព​ដែល​សមរម្យ ដើម្បីប្រាកដ​ថា​សារ​ដែលបានពិពណ៌នា​មិន​កើតឡើង​ទេ ។</p></translation>
+        <translation><p>ការ​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត​អាច​រត់​ក្នុង​លក្ខខណ្ឌ​មាន​កំហុស​ដូច​បាន​ពិពណ៌នា​ខាង​ក្រោម ។ អ្នក​អាច​មិនអើពើ​សារ​នេះ​បាន ប៉ុន្តែ​វា​ត្រូវ​បាន​ស្នើ​ឲ្យ​អនុវត្ត​សកម្មភាព​ដែល​សមរម្យ ដើម្បីប្រាកដ​ថា​សារ​ដែលបានពិពណ៌នា​មិន​កើតឡើង​ទេ ។</p></translation>
     </message>
     <message>
         <source>Result&nbsp;Code: </source>
         <comment>error info</comment>
-        <translation>កូដ​&nbsp;លទ្ធផល ៖</translation>
+        <translation>កូដ​&nbsp;លទ្ធផល ៖</translation>
     </message>
     <message>
         <source>Component: </source>
         <comment>error info</comment>
-        <translation>សមាសភាគ ៖</translation>
+        <translation>សមាសភាគ ៖</translation>
     </message>
     <message>
         <source>Interface: </source>
         <comment>error info</comment>
-        <translation>ចំណុច​ប្រទាក់ ៖</translation>
+        <translation>ចំណុច​ប្រទាក់ ៖</translation>
     </message>
     <message>
         <source>Callee: </source>
         <comment>error info</comment>
-        <translation>Callee ៖ </translation>
+        <translation>Callee ៖ </translation>
     </message>
     <message>
         <source>Callee&nbsp;RC: </source>
         <comment>error info</comment>
-        <translation>Callee&nbsp;RC ៖ </translation>
+        <translation>Callee&nbsp;RC ៖ </translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation type="obsolete"><p>រក​មិន​ឃើញ​​ឯកសារ​ភាសា​សម្រាប់​ភាសា <b>%1</b> នៅ​ក្នុង <b><nobr>%2</nobr></b>ទេ ។</p><p>ភាសា​នឹង​ត្រូវ​បានកំណត់​ឡើង​វិញជា​បណ្ដោះអាសន្ន​ទៅ​ភាសា​លំនាំដើម​របស់​ប្រព័ន្ធ ។ សូម​ចូល​ទៅ​ប្រអប់ <b>ចំណូលចិត្ត</b> ដែល​អ្នក​អាច​បើក​ពី​ម៉ឺនុយ <b>ឯកសារ</b> នៃ​បង្អួច​ VirtualBox មេ ហើយ​ជ្រើស​ភាសា​មួយ​ក្នុង​ចំណោម​ភាសា​ដែល​មាន​នៅ​លើ​ទំព័រ <b>ភាសា</b> ។</p></translation>
+        <translation type="obsolete"><p>រក​មិន​ឃើញ​​ឯកសារ​ភាសា​សម្រាប់​ភាសា <b>%1</b> នៅ​ក្នុង <b><nobr>%2</nobr></b>ទេ ។</p><p>ភាសា​នឹង​ត្រូវ​បានកំណត់​ឡើង​វិញជា​បណ្ដោះអាសន្ន​ទៅ​ភាសា​លំនាំដើម​របស់​ប្រព័ន្ធ ។ សូម​ចូល​ទៅ​ប្រអប់ <b>ចំណូលចិត្ត</b> ដែល​អ្នក​អាច​បើក​ពី​ម៉ឺនុយ <b>ឯកសារ</b> នៃ​បង្អួច​ VirtualBox មេ ហើយ​ជ្រើស​ភាសា​មួយ​ក្នុង​ចំណោម​ភាសា​ដែល​មាន​នៅ​លើ​ទំព័រ <b>ភាសា</b> ។</p></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the main VirtualBox window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation type="obsolete"><p>មិនអាច​ផ្ទុក​ឯកសារ​ភាសា <b><nobr>%1</nobr></b> បានទេ ។ <p>ភាសា​នឹង​ត្រូវ​បានកំណត់​ទៅ​ជា​ភាសា​អង់គ្លេស​ជា​បណ្ដោះអាសន្ន ។ សូម​ចូល​ទៅ​ប្រអប់ <b>ចំណូល​ចិត្ត</b> ដែល​អ្នក​អាច​បើក​ពី​ម៉ឺនុយ​ <b>ឯកសារ</b> នៃ​បង្អួច VirtualBox មេ ហើយ​ជ្រើស​ភាសា​មួយ​ក្នុងចំណោម​ភាសា​ដែល​មាន​ស្រាប់​នៅ​លើ​ទំព័រ <b>ភាសា</b> ។</p></translation>
+        <translation type="obsolete"><p>មិនអាច​ផ្ទុក​ឯកសារ​ភាសា <b><nobr>%1</nobr></b> បានទេ ។ <p>ភាសា​នឹង​ត្រូវ​បានកំណត់​ទៅ​ជា​ភាសា​អង់គ្លេស​ជា​បណ្ដោះអាសន្ន ។ សូម​ចូល​ទៅ​ប្រអប់ <b>ចំណូល​ចិត្ត</b> ដែល​អ្នក​អាច​បើក​ពី​ម៉ឺនុយ​ <b>ឯកសារ</b> នៃ​បង្អួច VirtualBox មេ ហើយ​ជ្រើស​ភាសា​មួយ​ក្នុងចំណោម​ភាសា​ដែល​មាន​ស្រាប់​នៅ​លើ​ទំព័រ <b>ភាសា</b> ។</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
-        <translation type="obsolete"><p>ផ្នែក​បន្ថែម​ភាសា​ភ្ញៀវ​របស់ VirtualBox បាន​ដំឡើង​នៅ​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ចាស់​ពេក ៖ កំណែ​ដែល​បាន​ដំឡើង​គឺ %1 កំណែ​ដែល​រំពឹង​ទុកគឺ %2 ។ លក្ខណៈពិសេស​មួយ​ចំនួន​ត្រូវការ​ផ្នែកបន្ថែម​របស់​ម៉ាស៊ីន​ភ្ញៀវ (ការ​រួម​បញ្ចូល​កណ្ដុរ បង្ហាញ​ការ​ផ្លាស់ប្ដូរ​ទំហំ​ដោយ​ស្វ័យ​ប្រវត្តិ​របស់​ម៉ាស៊ីន​ភ្ញៀវ) នឹង​បញ្ឈប់​ដំណើរការ​យ៉ាង​ត្រឹមត្រូវ ។</p><p>សូម​ធ្វើ​ឲ្យ​ផ្នែក​បន្ថែម​របស់ម៉ាស៊ីន​ភ្ញៀវ​ទាន់សម័យ​ទៅ​កំណែ​បច្ចុប្បន្ន​ ដ [...]
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>ផ្នែក​បន្ថែម​ភាសា​ភ្ញៀវ​របស់ VirtualBox បាន​ដំឡើង​នៅ​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ចាស់​ពេក ៖ កំណែ​ដែល​បាន​ដំឡើង​គឺ %1 កំណែ​ដែល​រំពឹង​ទុកគឺ %2 ។ លក្ខណៈពិសេស​មួយ​ចំនួន​ត្រូវការ​ផ្នែកបន្ថែម​របស់​ម៉ាស៊ីន​ភ្ញៀវ (ការ​រួម​បញ្ចូល​កណ្ដុរ បង្ហាញ​ការ​ផ្លាស់ប្ដូរ​ទំហំ​ដោយ​ស្វ័យ​ប្រវត្តិ​របស់​ម៉ាស៊ីន​ភ្ញៀវ) នឹង​បញ្ឈប់​ដំណើរការ​យ៉ាង​ត្រឹមត្រូវ ។</p><p>សូម​ធ្វើ​ឲ្យ​ផ្នែក​បន្ថែម​របស់ម៉ាស៊ីន​ភ្ញៀវ​ទាន់សម័យ​ទៅ​កំណែ​បច្ចុប្បន្ន​ ដ [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
-        <translation type="obsolete"><p>ផ្នែក​បន្ថែម​របស់ម៉ាស៊ីន​ភ្ញៀវ VirtualBox បានដំឡើង​នៅ​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​គឺ​ហួស​សម័យ​ហើយ ៖ កំណែ​ដែលបានដំឡើង​គឺ %1 កំណែ​ដែល​រំពឹង​ទុក​គឺ %2 ។ លក្ខណៈ​ពិសេស​មួយ​ចំនួន​ដែល​ត្រូវការ​ផ្នែក​បន្ថែម​របស់​ម៉ាស៊ីន​ភ្ញៀវ (ការ​រួម​បញ្ចូល​កណ្ដុរ បង្ហាញ​កា​រផ្លាស់ប្ដូរ​ទំហំ​ដោយ​ស្វ័យ​ប្រវត្តិ​របស់ម៉ាស៊ីន​ភ្ញៀវ) មិនអាច​ដំណើរការ​ដូច​ដែល​បាន​រំពឹង​ទុក​ទេ ។</p><p>វា​ត្រូ​វបានផ្ដល់​អនុសាសន៍​ឲ្យ​ធ្វើ​ឲ្យ​ផ្នែកបន្ថែម​របស់​ម៉ាស៊ី [...]
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>ផ្នែក​បន្ថែម​របស់ម៉ាស៊ីន​ភ្ញៀវ VirtualBox បានដំឡើង​នៅ​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​គឺ​ហួស​សម័យ​ហើយ ៖ កំណែ​ដែលបានដំឡើង​គឺ %1 កំណែ​ដែល​រំពឹង​ទុក​គឺ %2 ។ លក្ខណៈ​ពិសេស​មួយ​ចំនួន​ដែល​ត្រូវការ​ផ្នែក​បន្ថែម​របស់​ម៉ាស៊ីន​ភ្ញៀវ (ការ​រួម​បញ្ចូល​កណ្ដុរ បង្ហាញ​កា​រផ្លាស់ប្ដូរ​ទំហំ​ដោយ​ស្វ័យ​ប្រវត្តិ​របស់ម៉ាស៊ីន​ភ្ញៀវ) មិនអាច​ដំណើរការ​ដូច​ដែល​បាន​រំពឹង​ទុក​ទេ ។</p><p>វា​ត្រូ​វបានផ្ដល់​អនុសាសន៍​ឲ្យ​ធ្វើ​ឲ្យ​ផ្នែកបន្ថែម​របស់​ម៉ាស៊ី [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
-        <translation type="obsolete"><p>ផ្នែក​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ​របស់ VirtualBox នៅ​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ថ្មីពេក​សម្រាប់​កំណែ​របស់ VirtualBox ៖ កំណែ​ដែល​បាន​ដំឡើង​គឺ %1 កំណែ​ដែល​រំពឹង​ទុក​គឺ %2 ។</p><p>កា​រប្រើកំណែ​ថ្មី​របស់​បន្ថែម​ផ្នែកបន្ថែម​ជាង​កំណែ​ចាស់​របស់ VirtualBox មិន​ត្រូវ​បានគាំទ្រទេ ។ សូម​ដំឡើង​កំណែ​បច្ចុប្បន្ន​របស់​ផ្នែកបន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ ដោយ​ជ្រើស​<b>ដំឡើង​ផ្នែក​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ</b> ពី​ម៉ឺនុយ <b>ឧបករណ៍&l [...]
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
+        <translation type="obsolete"><p>ផ្នែក​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ​របស់ VirtualBox នៅ​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ថ្មីពេក​សម្រាប់​កំណែ​របស់ VirtualBox ៖ កំណែ​ដែល​បាន​ដំឡើង​គឺ %1 កំណែ​ដែល​រំពឹង​ទុក​គឺ %2 ។</p><p>កា​រប្រើកំណែ​ថ្មី​របស់​បន្ថែម​ផ្នែកបន្ថែម​ជាង​កំណែ​ចាស់​របស់ VirtualBox មិន​ត្រូវ​បានគាំទ្រទេ ។ សូម​ដំឡើង​កំណែ​បច្ចុប្បន្ន​របស់​ផ្នែកបន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ ដោយ​ជ្រើស​<b>ដំឡើង​ផ្នែក​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ</b> ពី​ម៉ឺនុយ <b>ឧបករណ៍&l [...]
     </message>
     <message>
         <source>Failed to change the snapshot folder path of the virtual machine <b>%1<b> to <nobr><b>%2</b></nobr>.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងការ​ផ្លាស់ប្ដូរ​ផ្លូវ​ថត​រូបថត​របស់​ម៉ាស៊ីន​និម្មិត <b>%1<b> ទៅ <nobr><b>%2</b></nobr> ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងការ​ផ្លាស់ប្ដូរ​ផ្លូវ​ថត​រូបថត​របស់​ម៉ាស៊ីន​និម្មិត <b>%1<b> ទៅ <nobr><b>%2</b></nobr> ។</translation>
     </message>
     <message>
         <source><p>Failed to remove the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</p><p>Please close all programs in the guest OS that may be using this shared folder and try again.</p></source>
-        <translation><p>បានបរាជ័យ​ក្នុងកា​រយក​ថត​ដែល​បានចែករំលែក <b>%1</b> ចេញ (ចង្អុល​ទៅ <nobr><b>%2</b></nobr>) ពី​ម៉ាស៊ីន​និម្មិត <b>%3</b> ។</p><p>សូម​បិទ​កម្មវិធី​ទាំង​អស់​នៅ​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​ភ្ញៀវ​ដែល​អាច​កំពុង​ប្រើ​ថត​ដែលបានចែករំលែក​នេះ ហើយ​ព្យាយាម​ម្ដង​ទៀត ។</p></translation>
+        <translation><p>បានបរាជ័យ​ក្នុងកា​រយក​ថត​ដែល​បានចែករំលែក <b>%1</b> ចេញ (ចង្អុល​ទៅ <nobr><b>%2</b></nobr>) ពី​ម៉ាស៊ីន​និម្មិត <b>%3</b> ។</p><p>សូម​បិទ​កម្មវិធី​ទាំង​អស់​នៅ​ក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​ភ្ញៀវ​ដែល​អាច​កំពុង​ប្រើ​ថត​ដែលបានចែករំលែក​នេះ ហើយ​ព្យាយាម​ម្ដង​ទៀត ។</p></translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file <nobr><b>%1</b></nobr> or <nobr><b>%2</b>.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation type="obsolete"><p>មិនអាច​រក​​ឯកសារ​រូបភាព​ស៊ីឌី​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ​របស់ VirtualBox <nobr><b>%1</b></nobr> ឬ <nobr><b>%2</b> ។</nobr></p><p>តើអ្នក​ចង់​ទាញ​យក​រូបភាព​ស៊ីឌី​ពី​អ៊ីនធឺណិត​ដែរឬទេ ?</p></translation>
+        <translation type="obsolete"><p>មិនអាច​រក​​ឯកសារ​រូបភាព​ស៊ីឌី​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ​របស់ VirtualBox <nobr><b>%1</b></nobr> ឬ <nobr><b>%2</b> ។</nobr></p><p>តើអ្នក​ចង់​ទាញ​យក​រូបភាព​ស៊ីឌី​ពី​អ៊ីនធឺណិត​ដែរឬទេ ?</p></translation>
     </message>
     <message>
         <source><p>Failed to download the VirtualBox Guest Additions disk image file from <nobr><a href="%1">%2</a>.</nobr></p><p>%3</p></source>
-        <translation type="obsolete"><p>បាន​បរាជ័យ​ក្នុងកា​រទាញ​​​យក​រូបភាព​ស៊ីឌី​បន្ថែម​របស់ម៉ាស៊ីន​ភ្ញៀវ​របស់ VirtualBox ពី <nobr><a href="%1">%2</a> ។</nobr></p><p>%3</p></translation>
+        <translation type="obsolete"><p>បាន​បរាជ័យ​ក្នុងកា​រទាញ​​​យក​រូបភាព​ស៊ីឌី​បន្ថែម​របស់ម៉ាស៊ីន​ភ្ញៀវ​របស់ VirtualBox ពី <nobr><a href="%1">%2</a> ។</nobr></p><p>%3</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the VirtualBox Guest Additions disk image file from <nobr><a href="%1">%2</a></nobr> (size %3 bytes)?</p></source>
@@ -5896,51 +6460,51 @@ network adapter name</comment>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions disk image file has been successfully downloaded from <nobr><a href="%1">%2</a></nobr> and saved locally as <nobr><b>%3</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="obsolete"><p>រូបភាពស៊ីឌីផ្នែក​នែក​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ VirtualBត្រូ​វបាន​ទាញយក​ដោយ​ជោគជ័យ​ពីr<nobr><a href="%1">​%2</a></nobr>bហើយ​បាន​រក្សាទុក​ក្នុង​មូលដ្ឋាន​ជា as <nobr><b>%3</b> ។</nobr></p><p>តើ​អ្នក​ចង់​ចុះឈ្មោះ​រូបភាព​ស៊ីឌី​នេះ ហើយ​ម៉ោន​វា​នៅ​លើ​ដ្រាយ​ស៊ីឌី/ឌីវីឌី​និម្មិតដែរឬទេ ?ve?</p></translation>
+        <translation type="obsolete"><p>រូបភាពស៊ីឌីផ្នែក​នែក​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ VirtualBត្រូ​វបាន​ទាញយក​ដោយ​ជោគជ័យ​ពីr<nobr><a href="%1">​%2</a></nobr>bហើយ​បាន​រក្សាទុក​ក្នុង​មូលដ្ឋាន​ជា as <nobr><b>%3</b> ។</nobr></p><p>តើ​អ្នក​ចង់​ចុះឈ្មោះ​រូបភាព​ស៊ីឌី​នេះ ហើយ​ម៉ោន​វា​នៅ​លើ​ដ្រាយ​ស៊ីឌី/ឌីវីឌី​និម្មិតដែរឬទេ ?ve?</p></translation>
     </message>
     <message>
         <source><p>The virtual machine window is optimized to work in <b>%1&nbsp;bit</b> color mode but the virtual display is currently set to <b>%2&nbsp;bit</b>.</p><p>Please open the display properties dialog of the guest OS and select a <b>%3&nbsp;bit</b> color mode, if it is available, for best possible performance of the virtual video subsystem.</p><p><b>Note</b>. Some operating systems, like  [...]
-        <translation type="obsolete"><p>បង្អួច​ម៉ាស៊ីន​និម្មិត​ត្រូវ​បានធ្វើ​ឲ្យ​ប្រសើរ​ដើម្បី​ធ្វើការ​ក្នុងរបៀប​ពណ៌ <b>%1&nbsp;ប៊ីត</b> ប៉ុន្តែ​គុណភាពពណ៌​​នៃ​ការ​បង្ហាញ​និម្មិត​បច្ចុប្បន្ន​ត្រូវ​បានកំណត់​ទៅ <b>%2&nbsp;ប៊ីត</b> ។</p><p>សូម​បើក​ប្រអប់លក្ខណៈសម្បត្តិ​បង្ហាញ​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ហើយ​ជ្រើសរបៀប​ពណ៌ <b>%3&nbsp;ប៊ីត</b> ប្រសិនបើ​មាន សម្រាប់​ការអនុវត្ត​ដ៏​ល្អ​បំផុត​របស់​ប្រព័ន្ធ​រង​វីដែអូ​ [...]
+        <translation type="obsolete"><p>បង្អួច​ម៉ាស៊ីន​និម្មិត​ត្រូវ​បានធ្វើ​ឲ្យ​ប្រសើរ​ដើម្បី​ធ្វើការ​ក្នុងរបៀប​ពណ៌ <b>%1&nbsp;ប៊ីត</b> ប៉ុន្តែ​គុណភាពពណ៌​​នៃ​ការ​បង្ហាញ​និម្មិត​បច្ចុប្បន្ន​ត្រូវ​បានកំណត់​ទៅ <b>%2&nbsp;ប៊ីត</b> ។</p><p>សូម​បើក​ប្រអប់លក្ខណៈសម្បត្តិ​បង្ហាញ​របស់​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ហើយ​ជ្រើសរបៀប​ពណ៌ <b>%3&nbsp;ប៊ីត</b> ប្រសិនបើ​មាន សម្រាប់​ការអនុវត្ត​ដ៏​ល្អ​បំផុត​របស់​ប្រព័ន្ធ​រង​វីដែអូ​ [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
-        <translation type="obsolete"><p>អ្នកមិនបានភ្ជាប់​ថាសរឹង​ទៅកាន់​ម៉ាស៊ីន​និម្មិត​ថ្មីទេ ។ ម៉ាស៊ីន​នឹង​មិនអាច​ចាប់ផ្ដើម​បានទេ លុះត្រា​តែ​អ្នក​ភ្ជាប់​ថាសរឹង​ជា​មួយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ ឬ​មេឌៀ​ចាប់ផ្ដើម​ផ្សេងៗ​មួយ​ចំនួន​ទៀត​ទៅវា​ ពេលក្រោយ​ប្រើ​ប្រអប់​កំណត់​ម៉ាស៊ីន​ ឬ​រត់​អ្នក​ជំនួយការ​សិន ។</p><p>តើអ្នក​ចង់​បន្ត​ដែរឬទេ ?</p></translation>
+        <translation type="obsolete"><p>អ្នកមិនបានភ្ជាប់​ថាសរឹង​ទៅកាន់​ម៉ាស៊ីន​និម្មិត​ថ្មីទេ ។ ម៉ាស៊ីន​នឹង​មិនអាច​ចាប់ផ្ដើម​បានទេ លុះត្រា​តែ​អ្នក​ភ្ជាប់​ថាសរឹង​ជា​មួយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ ឬ​មេឌៀ​ចាប់ផ្ដើម​ផ្សេងៗ​មួយ​ចំនួន​ទៀត​ទៅវា​ ពេលក្រោយ​ប្រើ​ប្រអប់​កំណត់​ម៉ាស៊ីន​ ឬ​រត់​អ្នក​ជំនួយការ​សិន ។</p><p>តើអ្នក​ចង់​បន្ត​ដែរឬទេ ?</p></translation>
     </message>
     <message>
         <source>Failed to find license files in <nobr><b>%1</b></nobr>.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​យក្នុងកា​ររក​ឯកសារ​អាជ្ញាបណ្ណ​នៅ​ក្នុង <nobr><b>%1</b></nobr> ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​យក្នុងកា​ររក​ឯកសារ​អាជ្ញាបណ្ណ​នៅ​ក្នុង <nobr><b>%1</b></nobr> ។</translation>
     </message>
     <message>
         <source>Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងកា​របើក​ឯកសារ​អាជ្ញាប័ណ្ណ <nobr><b>%1</b></nobr> ។ ពិនិត្យ​មើល​សិទ្ធិ​របស់​ឯកសារ ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងកា​របើក​ឯកសារ​អាជ្ញាប័ណ្ណ <nobr><b>%1</b></nobr> ។ ពិនិត្យ​មើល​សិទ្ធិ​របស់​ឯកសារ ។</translation>
     </message>
     <message>
         <source>Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងការ​ផ្ញើ​កា​រចុច​ប៊ូតុងថាមពល ACPI ទៅ​កាន់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងការ​ផ្ញើ​កា​រចុច​ប៊ូតុងថាមពល ACPI ទៅ​កាន់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ។</translation>
     </message>
     <message>
         <source><p>Congratulations! You have been successfully registered as a user of VirtualBox.</p><p>Thank you for finding time to fill out the registration form!</p></source>
-        <translation type="obsolete"><p>សូមអបអរសាទរ ! អ្នក​បានចុះឈ្មោះ​ជា​អ្នក​ប្រើ VirtualBox ដោយ​ជោគជ័យ​ហើយ ។ </p><p>សូម​អរគុណ​ចំពោះ​ការ​ចំណាយ​ពេលវេលា​បំពេញ​សំណុំបែបបទ​ចុះឈ្មោះ !</p></translation>
+        <translation type="obsolete"><p>សូមអបអរសាទរ ! អ្នក​បានចុះឈ្មោះ​ជា​អ្នក​ប្រើ VirtualBox ដោយ​ជោគជ័យ​ហើយ ។ </p><p>សូម​អរគុណ​ចំពោះ​ការ​ចំណាយ​ពេលវេលា​បំពេញ​សំណុំបែបបទ​ចុះឈ្មោះ !</p></translation>
     </message>
     <message>
         <source><p>Failed to save the global VirtualBox settings to <b><nobr>%1</nobr></b>.</p></source>
-        <translation type="obsolete"><p>បានបរាជ័យ​ក្នុងកា​ររក្សាទុក​ការ​កំណត់ VirtualBox សកល​ទៅ​កាន់ <b><nobr>%1</nobr></b> ។</p></translation>
+        <translation type="obsolete"><p>បានបរាជ័យ​ក្នុងកា​ររក្សាទុក​ការ​កំណត់ VirtualBox សកល​ទៅ​កាន់ <b><nobr>%1</nobr></b> ។</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
-        <translation><p>បានបរាជ័យ​ក្នុងការ​ផ្ទុក​ការ​កំណត់​រចនាសម្ព័ន្ធ​ចំណុច​ប្រទាក់​អ្នក​ប្រើ​សកល​ពី <b><nobr>%1</nobr></b> ។</p><p>កម្មវិធី​នឹង​បិទ​ឥឡូវ ។</p></translation>
+        <translation><p>បានបរាជ័យ​ក្នុងការ​ផ្ទុក​ការ​កំណត់​រចនាសម្ព័ន្ធ​ចំណុច​ប្រទាក់​អ្នក​ប្រើ​សកល​ពី <b><nobr>%1</nobr></b> ។</p><p>កម្មវិធី​នឹង​បិទ​ឥឡូវ ។</p></translation>
     </message>
     <message>
         <source><p>Failed to save the global GUI configuration to <b><nobr>%1</nobr></b>.</p><p>The application will now terminate.</p></source>
-        <translation><p>បានបរាជ័យ​ក្នុងកា​ររក្សាទុក​ការកំណត់​រចនាសម្ព័ន្ធ​ចំណុច​ប្រទាក់​អ្នក​ប្រើសកល​ទៅ​<b><nobr>%1</nobr></b> ។</p><p>កម្មវិធី​នឹង​បិទ​ឥឡូវ ។</p></translation>
+        <translation><p>បានបរាជ័យ​ក្នុងកា​ររក្សាទុក​ការកំណត់​រចនាសម្ព័ន្ធ​ចំណុច​ប្រទាក់​អ្នក​ប្រើសកល​ទៅ​<b><nobr>%1</nobr></b> ។</p><p>កម្មវិធី​នឹង​បិទ​ឥឡូវ ។</p></translation>
     </message>
     <message>
         <source>Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.</source>
-        <translation>បានបរាជ័យ​ក្នុង​ការ​រក្សាទុក​ការ​កំណត់​​របស់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ទៅ<b><nobr>%2</nobr></b> ។</translation>
+        <translation>បានបរាជ័យ​ក្នុង​ការ​រក្សាទុក​ការ​កំណត់​​របស់​ម៉ាស៊ីន​និម្មិត <b>%1</b> ទៅ<b><nobr>%2</nobr></b> ។</translation>
     </message>
     <message>
         <source>Failed to load the settings of the virtual machine <b>%1</b> from <b><nobr>%2</nobr></b>.</source>
-        <translation type="obsolete">បានបរាជ័យ​ក្នុងកា​រផ្ទុក​កា​រកំណត់​របស់ម៉ាស៊ីន​និម្មិត <b>%1</b> ពី <b><nobr>%2</nobr></b> ។</translation>
+        <translation type="obsolete">បានបរាជ័យ​ក្នុងកា​រផ្ទុក​កា​រកំណត់​របស់ម៉ាស៊ីន​និម្មិត <b>%1</b> ពី <b><nobr>%2</nobr></b> ។</translation>
     </message>
     <message>
         <source>Delete</source>
@@ -5968,14 +6532,14 @@ network adapter name</comment>
         <translation type="obsolete">ទាញយក</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">ម៉ោន</translation>
+        <translation type="obsolete">ម៉ោន</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
         <comment>additional message box paragraph</comment>
-        <translation><p>គ្រាប់ចុច​ម៉ាស៊ីន​បច្ចុប្បន្ន​ត្រូវ​បាន​កំណត់​ជា <b>%1</b> ។</p></translation>
+        <translation><p>គ្រាប់ចុច​ម៉ាស៊ីន​បច្ចុប្បន្ន​ត្រូវ​បាន​កំណត់​ជា <b>%1</b> ។</p></translation>
     </message>
     <message>
         <source>Capture</source>
@@ -5999,7 +6563,7 @@ network adapter name</comment>
     </message>
     <message>
         <source><p>Do you really want to reset the virtual machine?</p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
-        <translation type="obsolete"><p>តើ​អ្នក​ពិត​ជា​ចង់​កំណត់​ម៉ាស៊ីននិម្មិត​ឡើង​វិញ​ដែរឬទេ ?</p><p>នៅ​ពេល​ម៉ាស៊ីន​ត្រូវ​បាន​កំណត់​ឡើង​វិញ ទិន្នន័យ​របស់​កម្មវិធី​ដែល​មិនបានរក្សាទុកទាំង​អស់​ដែល​កំពុង​រត់​វា​នឹង​ត្រូវ​បានបាត់បង់ ។</p></translation>
+        <translation type="obsolete"><p>តើ​អ្នក​ពិត​ជា​ចង់​កំណត់​ម៉ាស៊ីននិម្មិត​ឡើង​វិញ​ដែរឬទេ ?</p><p>នៅ​ពេល​ម៉ាស៊ីន​ត្រូវ​បាន​កំណត់​ឡើង​វិញ ទិន្នន័យ​របស់​កម្មវិធី​ដែល​មិនបានរក្សាទុកទាំង​អស់​ដែល​កំពុង​រត់​វា​នឹង​ត្រូវ​បានបាត់បង់ ។</p></translation>
     </message>
     <message>
         <source>Reset</source>
@@ -6018,39 +6582,39 @@ network adapter name</comment>
     </message>
     <message>
         <source>Failed to copy file <b><nobr>%1</nobr></b> to <b><nobr>%2</nobr></b> (%3).</source>
-        <translation type="obsolete">បានបរាជ័យ​ក្នុងកា​រចម្លង​ឯកសារ <b><nobr>%1</nobr></b> ទៅ <b><nobr>%2</nobr></b> (%3) ។</translation>
+        <translation type="obsolete">បានបរាជ័យ​ក្នុងកា​រចម្លង​ឯកសារ <b><nobr>%1</nobr></b> ទៅ <b><nobr>%2</nobr></b> (%3) ។</translation>
     </message>
     <message>
         <source><p>Could not enter seamless mode due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p></source>
-        <translation><p>មិនអាច​ចូល​របៀប​គ្មាន​ថេរ ដោយសារ​តែ​សតិ​វីដេអូ​ម៉ាស៊ីន​ភ្ញៀវ​មិន​គ្រប់គ្រាន់ ។</p><p>អ្នក​គួរ​កំណត់​រចនាសម្ព័ន្ធ​ម៉ាស៊ីន​និម្មិត​យ៉ាង​ហោចណាស់​មានសតិ​វីដេអូ <b>%1</b> ។</p></translation>
+        <translation><p>មិនអាច​ចូល​របៀប​គ្មាន​ថេរ ដោយសារ​តែ​សតិ​វីដេអូ​ម៉ាស៊ីន​ភ្ញៀវ​មិន​គ្រប់គ្រាន់ ។</p><p>អ្នក​គួរ​កំណត់​រចនាសម្ព័ន្ធ​ម៉ាស៊ីន​និម្មិត​យ៉ាង​ហោចណាស់​មានសតិ​វីដេអូ <b>%1</b> ។</p></translation>
     </message>
     <message>
         <source><p>Could not switch the guest display to fullscreen mode due to insufficient guest video memory.</p><p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p><p>Press <b>Ignore</b> to switch to fullscreen mode anyway or press <b>Cancel</b> to cancel the operation.</p></source>
-        <translation><p>មិនអាច​ប្ដូរ​ការ​បង្ហាញ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ទៅ​របៀប​ពេញ​អេក្រង់​បានទេ ដោយសារ​តែ​សតិ​វីដេអូ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​មិន​គ្រប់គ្រាន់ ។</p><p>អ្នក​គួរ​កំណត់​រចនាសម្ព័ន្ធ​ម៉ាស៊ីន​និម្មិត​ឲ្យ​មានសតិ​​យ៉ាង​ហោចណាស់​ <b>%1</b> នៃ​សតិ​វីដេអូ ។</p><p>ចុច​ <b>មិនអើពើ</b> ដើម្បី​ប្ដូរ​ទៅ​របៀប​ពេញអេក្រង់ ឬ​បើ​មិន​ដូច្នេះ​ទេ​ចុច <b>បោះបង់</b> ដើម្បី​បោះបង់​ប្រតិបត្តិការ ។</p></translation>
+        <translation><p>មិនអាច​ប្ដូរ​ការ​បង្ហាញ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ទៅ​របៀប​ពេញ​អេក្រង់​បានទេ ដោយសារ​តែ​សតិ​វីដេអូ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​មិន​គ្រប់គ្រាន់ ។</p><p>អ្នក​គួរ​កំណត់​រចនាសម្ព័ន្ធ​ម៉ាស៊ីន​និម្មិត​ឲ្យ​មានសតិ​​យ៉ាង​ហោចណាស់​ <b>%1</b> នៃ​សតិ​វីដេអូ ។</p><p>ចុច​ <b>មិនអើពើ</b> ដើម្បី​ប្ដូរ​ទៅ​របៀប​ពេញអេក្រង់ ឬ​បើ​មិន​ដូច្នេះ​ទេ​ចុច <b>បោះបង់</b> ដើម្បី​បោះបង់​ប្រតិបត្តិការ ។</p></translation>
     </message>
     <message>
         <source>You are already running the most recent version of VirtualBox.</source>
-        <translation>អ្នក​បាន​ដំឡើង​កំណែ VirtualBox ចុងក្រោយ​បំផុត​រួ​ចហើយ ។ សូម​​ពិនិត្យ​មើល​កំណែ​ពេលក្រោយ ។</translation>
+        <translation>អ្នក​បាន​ដំឡើង​កំណែ VirtualBox ចុងក្រោយ​បំផុត​រួ​ចហើយ ។ សូម​​ពិនិត្យ​មើល​កំណែ​ពេលក្រោយ ។</translation>
     </message>
     <message>
         <source><p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer integration is not currently supported by the guest OS) and the keyboard, which will make them unavailable to other applications running on your host machine.</p><p>You can press the <b>host key</b> at  [...]
-        <translation><p>អ្នក​បាន <b>ចុចកណ្ដុរ</b> ខាង​ក្នុង​ការ​បង្ហាញ​របស់​ម៉ាស៊ីន​និម្មិត ឬ​បាន​ចុច​ <b>គ្រាប់ចុច host</b> ។ វា​នឹងធ្វើ​​ឲ្យ​ម៉ាស៊ីន​និម្មិត <b>ចាប់យក</b> ទស្សន៍ទ្រនិច​កណ្ដុរ​របស់​ម៉ាស៊ីន (តែ​ក្នុងករណី​ដែល​ការ​រួម​បញ្ចូល​ទស្សន៍ទ្រនិច​បច្ចុប្បន្ន​មិន​ត្រូ​វបានគាំទ្រ​ដោយ​ប្រព័ន្ធប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ទេ ។) ហើយ​នឹង​ក្ដារចុច ដែល​នឹង​ធ្វើ​ឲ្យ​កម្មវិធី​ផ្សេងៗ​ដែល​កំពុង​រត់​ក្នុង​ម៉ាស៊ីន​របស់​​​មិនអាច​ប្រើបាន​ទេ ។</p>& [...]
+        <translation><p>អ្នក​បាន <b>ចុចកណ្ដុរ</b> ខាង​ក្នុង​ការ​បង្ហាញ​របស់​ម៉ាស៊ីន​និម្មិត ឬ​បាន​ចុច​ <b>គ្រាប់ចុច host</b> ។ វា​នឹងធ្វើ​​ឲ្យ​ម៉ាស៊ីន​និម្មិត <b>ចាប់យក</b> ទស្សន៍ទ្រនិច​កណ្ដុរ​របស់​ម៉ាស៊ីន (តែ​ក្នុងករណី​ដែល​ការ​រួម​បញ្ចូល​ទស្សន៍ទ្រនិច​បច្ចុប្បន្ន​មិន​ត្រូ​វបានគាំទ្រ​ដោយ​ប្រព័ន្ធប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ទេ ។) ហើយ​នឹង​ក្ដារចុច ដែល​នឹង​ធ្វើ​ឲ្យ​កម្មវិធី​ផ្សេងៗ​ដែល​កំពុង​រត់​ក្នុង​ម៉ាស៊ីន​របស់​​​មិនអាច​ប្រើបាន​ទេ ។</p>& [...]
     </message>
     <message>
         <source><p>You have the <b>Auto capture keyboard</b> option turned on. This will cause the Virtual Machine to automatically <b>capture</b> the keyboard every time the VM window is activated and make it unavailable to other applications running on your host machine: when the keyboard is captured, all keystrokes (including system ones like Alt-Tab) will be directed to the VM.</p><p>You can press the <b>host key</b> at any time t [...]
-        <translation><p>អ្នក​បានបើក​ជម្រើស <b>ចាប់យក​ក្ដារចុច​ដោយ​ស្វ័យ​ប្រវត្តិ</b> ។ វា​នឹង​​ធ្វើ​ឲ្យ​ម៉ាស៊ីន​និម្មិត​ <b>ចាប់យក</b> ក្ដារចុច​ដោយ​ស្វ័យ​ប្រវត្តិ​រាល់ពេល​ដែល​បង្អួច VM ត្រូវ​បាន​ធ្វើ​ឲ្យ​សកម្ម​ ហើយ​ធ្វើ​ឲ្យ​វា​មិនអាច​ប្រើបាន​ចំពោះ​កម្មវិធី​ផ្សេងៗ​ដែល​កំពុង​រត់​ក្នុង​ម៉ាស៊ីន​របស់​អ្នក ៖ នៅពេល​ក្ដារចុច​ត្រូវ​បាន​ចាប់យក  keystrokes ទាំង អស់ (រួម​មាន​ប្រព័ន្ធ​មួយ​ដូចជា ជំនួស(Alt)-ថេប(Tab)) នឹង​ត្រូវ​បញ្ជូន​បន្ត​ទៅ​ VM ។</p><p>អ្នក​អា [...]
+        <translation><p>អ្នក​បានបើក​ជម្រើស <b>ចាប់យក​ក្ដារចុច​ដោយ​ស្វ័យ​ប្រវត្តិ</b> ។ វា​នឹង​​ធ្វើ​ឲ្យ​ម៉ាស៊ីន​និម្មិត​ <b>ចាប់យក</b> ក្ដារចុច​ដោយ​ស្វ័យ​ប្រវត្តិ​រាល់ពេល​ដែល​បង្អួច VM ត្រូវ​បាន​ធ្វើ​ឲ្យ​សកម្ម​ ហើយ​ធ្វើ​ឲ្យ​វា​មិនអាច​ប្រើបាន​ចំពោះ​កម្មវិធី​ផ្សេងៗ​ដែល​កំពុង​រត់​ក្នុង​ម៉ាស៊ីន​របស់​អ្នក ៖ នៅពេល​ក្ដារចុច​ត្រូវ​បាន​ចាប់យក  keystrokes ទាំង អស់ (រួម​មាន​ប្រព័ន្ធ​មួយ​ដូចជា ជំនួស(Alt)-ថេប(Tab)) នឹង​ត្រូវ​បញ្ជូន​បន្ត​ទៅ​ VM ។</p><p>អ្នក​អា [...]
     </message>
     <message>
         <source><p>The Virtual Machine reports that the guest OS supports <b>mouse pointer integration</b>. This means that you do not need to <i>capture</i> the mouse pointer to be able to use it in your guest OS -- all mouse actions you perform when the mouse pointer is over the Virtual Machine's display are directly sent to the guest OS. If the mouse is currently captured, it will be automatically uncaptured.</p><p>The mouse icon on the s [...]
-        <translation><p>ម៉ាស៊ីន​និម្មិត​រាយការណ៍​ថា​ប្រព័ន្ធ​ប្រតិបត្តិការ​គាំទ្រ <b>ការ​រួម​បញ្ចូល​ទស្សន៍​ទ្រនិច​កណ្ដុរ</b> ។ នេះ​មានន័យ​ថា អ្នក​មិន​ចាំបាច់ <i>ចាប់យក</i> ទស្សន៍ទ្រនិ​ច​កណ្ដុរ ដើម្បី​អាច​ប្រើ​វា​នៅ​ក្នុង​ប្រព័ន្ធប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​បានទេ -- សកម្មភាព​កណ្ដុរ​ទាំង​អស់​ដែល​អ្នក​អនុវត្ត​នៅពេល​ទស្សន៍ទ្រនិចកណ្ដុរ​នៅ​លើ​កា​របង្ហាញ​របស់​ម៉ាស៊ីន​និម្មិត ត្រូវ​បានបញ្ជូន​ដោយ​ផ្ទាល់​ទៅ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។ ប្រសិនបើកណ្ដុរបច្ [...]
+        <translation><p>ម៉ាស៊ីន​និម្មិត​រាយការណ៍​ថា​ប្រព័ន្ធ​ប្រតិបត្តិការ​គាំទ្រ <b>ការ​រួម​បញ្ចូល​ទស្សន៍​ទ្រនិច​កណ្ដុរ</b> ។ នេះ​មានន័យ​ថា អ្នក​មិន​ចាំបាច់ <i>ចាប់យក</i> ទស្សន៍ទ្រនិ​ច​កណ្ដុរ ដើម្បី​អាច​ប្រើ​វា​នៅ​ក្នុង​ប្រព័ន្ធប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​បានទេ -- សកម្មភាព​កណ្ដុរ​ទាំង​អស់​ដែល​អ្នក​អនុវត្ត​នៅពេល​ទស្សន៍ទ្រនិចកណ្ដុរ​នៅ​លើ​កា​របង្ហាញ​របស់​ម៉ាស៊ីន​និម្មិត ត្រូវ​បានបញ្ជូន​ដោយ​ផ្ទាល់​ទៅ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។ ប្រសិនបើកណ្ដុរបច្ [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>. Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
-        <translation type="obsolete"><p>បង្អួច​ម៉ាស៊ីន​និម្មិត​នឹង​ត្រូ​វបានប្ដូរ​ទៅ​របៀប <b>ពេញអេក្រង់</b> ឥឡូវ ។ អ្នក​អាច​ត្រឡប់ក្រោយ​​ទៅ​របៀប​បង្អួច​ នៅពេល​ណាមួយ ដោយ​ចុច <b>%1</b> ។ ចំណាំ​ថា គ្រាប់ចុច <i>ម៉ាស៊ីន</i> បច្ចុប្បន្ន​ត្រូវ​បាន​កំណត់​ជា <b>%2</b> ។</p><p>ចំណាំ​ថា របារ​ម៉ឺនុយ​មេ​​ត្រូវ​បានលាក់​ក្នុង​របៀប​ពេញអេក្រង់ ។​ អ្នក​អាច​ចូលដំណើរការ​វា​ដោយ​ចុច <b>ម៉ាស៊ីន(Host)+ដើម(Home)</b>.</p></translation>
+        <translation type="obsolete"><p>បង្អួច​ម៉ាស៊ីន​និម្មិត​នឹង​ត្រូ​វបានប្ដូរ​ទៅ​របៀប <b>ពេញអេក្រង់</b> ឥឡូវ ។ អ្នក​អាច​ត្រឡប់ក្រោយ​​ទៅ​របៀប​បង្អួច​ នៅពេល​ណាមួយ ដោយ​ចុច <b>%1</b> ។ ចំណាំ​ថា គ្រាប់ចុច <i>ម៉ាស៊ីន</i> បច្ចុប្បន្ន​ត្រូវ​បាន​កំណត់​ជា <b>%2</b> ។</p><p>ចំណាំ​ថា របារ​ម៉ឺនុយ​មេ​​ត្រូវ​បានលាក់​ក្នុង​របៀប​ពេញអេក្រង់ ។​ អ្នក​អាច​ចូលដំណើរការ​វា​ដោយ​ចុច <b>ម៉ាស៊ីន(Host)+ដើម(Home)</b>.</p></translation>
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>Seamless</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>. Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in seamless mode. You can access it by pressing <b>Host+Home</b>.</p></source>
-        <translation type="obsolete"><p>បង្អួច​ម៉ាស៊ីន​និម្មិត​​នឹង​ត្រូ​វបានប្ដូរ​ទៅ​របៀប <b>គ្មាន​ថ្នេរ</b> ឥឡូវ ។ អ្នកអាច​ត្រឡប់​ទៅ​​របៀប​បង្អួច​នៅ​ពេល​ណាមួយ​ដោយចុច <b>%1</b> ។ ចំណាំ​ថា គ្រាប់ចុច <i>Host</i> បច្ចុប្បន្ន​ត្រូវ​បានកំណត់​ជា <b>%2</b> ។</p><p>ចំណាំថា របារ​ម៉ឺនុយមេ​ត្រូវ​បានលាក់​នៅ​ក្នុង​របៀប​គ្មាន​ថ្នេរ ។ អ្នកអាច​ចូលដំណើរការ​វា ដោយ​ចុច​ <b>Host+ដើម(Home)</b> ។</p></translation>
+        <translation type="obsolete"><p>បង្អួច​ម៉ាស៊ីន​និម្មិត​​នឹង​ត្រូ​វបានប្ដូរ​ទៅ​របៀប <b>គ្មាន​ថ្នេរ</b> ឥឡូវ ។ អ្នកអាច​ត្រឡប់​ទៅ​​របៀប​បង្អួច​នៅ​ពេល​ណាមួយ​ដោយចុច <b>%1</b> ។ ចំណាំ​ថា គ្រាប់ចុច <i>Host</i> បច្ចុប្បន្ន​ត្រូវ​បានកំណត់​ជា <b>%2</b> ។</p><p>ចំណាំថា របារ​ម៉ឺនុយមេ​ត្រូវ​បានលាក់​នៅ​ក្នុង​របៀប​គ្មាន​ថ្នេរ ។ អ្នកអាច​ចូលដំណើរការ​វា ដោយ​ចុច​ <b>Host+ដើម(Home)</b> ។</p></translation>
     </message>
     <message>
         <source>&Contents...</source>
@@ -6101,12 +6665,12 @@ network adapter name</comment>
         <translation type="obsolete">បង្ហាញ​ប្រអប់​ដែល​មាន​ព័ត៌មាន​ផលិតផល</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>កំណែ​ថ្មី​របស់ VirtualBox ត្រូវ​បាន​ចេញ​ផ្សាយ ! គឺ​កំណែ <b>%1</b> ដែលអាច​រក​បាន​នៅ <a href="https://www.virtualbox.org/">virtualbox.org</a> ។</p><p>អ្នក​អាច​ទាញ​យក​កំណែ​នេះ​ពី​តំណ​នេះ​ដោយ​ផ្ទាល់ ៖</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>កំណែ​ថ្មី​របស់ VirtualBox ត្រូវ​បាន​ចេញ​ផ្សាយ ! គឺ​កំណែ <b>%1</b> ដែលអាច​រក​បាន​នៅ <a href="http://www.virtualbox.org/">virtualbox.org</a> ។</p><p>អ្នក​អាច​ទាញ​យក​កំណែ​នេះ​ពី​តំណ​នេះ​ដោយ​ផ្ទាល់ ៖</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
-        <translation type="obsolete"><p>តើ​អ្នក​ប្រាកដ​ជា​ចង់​ចេញផ្សាយ %1 <nobr><b>%2</b></nobr>?</p><p>វា​នឹង​ផ្ដាច់​វា​ពី​ម៉ាស៊ីន​និម្មិត​ដូច​ខាងក្រោម ៖ <b>%3</b> ។</p></translation>
+        <translation type="obsolete"><p>តើ​អ្នក​ប្រាកដ​ជា​ចង់​ចេញផ្សាយ %1 <nobr><b>%2</b></nobr>?</p><p>វា​នឹង​ផ្ដាច់​វា​ពី​ម៉ាស៊ីន​និម្មិត​ដូច​ខាងក្រោម ៖ <b>%3</b> ។</p></translation>
     </message>
     <message>
         <source>Release</source>
@@ -6115,19 +6679,19 @@ network adapter name</comment>
     </message>
     <message>
         <source><p>Are you sure you want to remove the %1 <nobr><b>%2</b></nobr> from the list of known disk image files?</p></source>
-        <translation type="obsolete"><p>តើអ្នក​ប្រាកដ​ជា​ចង់​យក %1 <nobr><b>%2</b></nobr> ចេញ​ពី​មេឌៀ​ដែលបាន​ស្គាល់​ដែរឬទេ ?</p></translation>
+        <translation type="obsolete"><p>តើអ្នក​ប្រាកដ​ជា​ចង់​យក %1 <nobr><b>%2</b></nobr> ចេញ​ពី​មេឌៀ​ដែលបាន​ស្គាល់​ដែរឬទេ ?</p></translation>
     </message>
     <message>
         <source>As this hard disk is inaccessible its image file can not be deleted.</source>
-        <translation type="obsolete">ចំណាំថា ថាសរឹង​នេះ​មិនអាច​ចូលដំណើរការ​បានទេ ដូច្នេះ​ឯកតា​ផ្ទុក​របស់វា​មិនអាច​ត្រូវ​បានលុប​ឥឡូវ​ទេ ។</translation>
+        <translation type="obsolete">ចំណាំថា ថាសរឹង​នេះ​មិនអាច​ចូលដំណើរការ​បានទេ ដូច្នេះ​ឯកតា​ផ្ទុក​របស់វា​មិនអាច​ត្រូវ​បានលុប​ឥឡូវ​ទេ ។</translation>
     </message>
     <message>
         <source>The next dialog will let you choose whether you also want to delete the storage unit of this hard disk or keep it for later usage.</source>
-        <translation type="obsolete">ប្រអប់​បន្ទាប់​នឹង​អនុញ្ញាត​ឲ្យ​អ្នក​ជ្រើស​ថាតើ អ្នក​ចង់​លុប​ឯកតា​ផ្ទុក​របស់​ថាសរឹង​នេះ ឬ​ទុក​វា​សម្រាប់​ប្រើ​ពេលក្រោយ ។</translation>
+        <translation type="obsolete">ប្រអប់​បន្ទាប់​នឹង​អនុញ្ញាត​ឲ្យ​អ្នក​ជ្រើស​ថាតើ អ្នក​ចង់​លុប​ឯកតា​ផ្ទុក​របស់​ថាសរឹង​នេះ ឬ​ទុក​វា​សម្រាប់​ប្រើ​ពេលក្រោយ ។</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to add it to the list later again.</p></source>
-        <translation type="obsolete"><p>ចំណាំ​ថា ឯកតា​ផ្ទុក​របស់​ឧបករណ៍​ផ្ទុក​នេះ​នឹង​មិន​ត្រូវ​បានលុប​ទេ ហើយ​ដូច្នេះ​វា​នឹង​អាច​បន្ថែម​ទៅ​កាន់​បញ្ជី​ពេល​ក្រោយ​ម្ដង​ទៀត ។</p></translation>
+        <translation type="obsolete"><p>ចំណាំ​ថា ឯកតា​ផ្ទុក​របស់​ឧបករណ៍​ផ្ទុក​នេះ​នឹង​មិន​ត្រូវ​បានលុប​ទេ ហើយ​ដូច្នេះ​វា​នឹង​អាច​បន្ថែម​ទៅ​កាន់​បញ្ជី​ពេល​ក្រោយ​ម្ដង​ទៀត ។</p></translation>
     </message>
     <message>
         <source>Remove</source>
@@ -6136,11 +6700,11 @@ network adapter name</comment>
     </message>
     <message>
         <source><p>The hard disk storage unit at location <b>%1</b> already exists. You cannot create a new virtual hard disk that uses this location because it can be already used by another virtual hard disk.</p><p>Please specify a different location.</p></source>
-        <translation><p>មាន​ឯកតា​ផ្ទុក​​របស់​ថាសរឹង​នៅ​ទីតាំង <b>%1</b> រួច​ហើយ ។ អ្នក​មិនអាច​បង្កើត​ថាសរឹង​និម្មិត​ថ្មី​បាន​ទេ ដែល​ប្រើ​ទីតាំង​នេះ ពីព្រោះ​វា​អាច​ត្រូវ​បានប្រើ​ដោយ​ថាសរឹង​និម្មិត​ផ្សេង ។</p><p>សូម​បញ្ជាក់​ទីតាំង​ផ្សេង ​។</p></translation>
+        <translation><p>មាន​ឯកតា​ផ្ទុក​​របស់​ថាសរឹង​នៅ​ទីតាំង <b>%1</b> រួច​ហើយ ។ អ្នក​មិនអាច​បង្កើត​ថាសរឹង​និម្មិត​ថ្មី​បាន​ទេ ដែល​ប្រើ​ទីតាំង​នេះ ពីព្រោះ​វា​អាច​ត្រូវ​បានប្រើ​ដោយ​ថាសរឹង​និម្មិត​ផ្សេង ។</p><p>សូម​បញ្ជាក់​ទីតាំង​ផ្សេង ​។</p></translation>
     </message>
     <message>
         <source><p>Do you want to delete the storage unit of the hard disk <nobr><b>%1</b></nobr>?</p><p>If you select <b>Delete</b> then the specified storage unit will be permanently deleted. This operation <b>cannot be undone</b>.</p><p>If you select <b>Keep</b> then the hard disk will be only removed from the list of known hard disks, but the storage unit will be left untouched which makes it po [...]
-        <translation><p>តើ​អ្នក​ចង់​លុប​ឯកតា​ផ្ទុក​របស់​ថាសរឹង​ <nobr><b>%1</b></nobr>ដែរឬទេ?</p><p>ប្រសិនបើ​អ្នក​ជ្រើស <b>លុប</b> បន្ទាប់​មក​ឯកតា​ផ្ទុក​ដែល​បានបញ្ជាក់​នឹង​ត្រូ​វបាន​លុប​ជា​អចិន្ត្រៃយ៍ ។ ប្រតិបត្តិការ​នេះ <b>មិនអាច​ត្រូ​វបាន​ធ្វើ​វិញ​បានទេ</b> ។</p><p>ប្រសិនបើ​អ្នក​ជ្រើស <b>រក្សាទុក</b> បន្ទាប់​មក​ថាសរឹង​នឹង​ត្រូវ​បានយកចេញ​តែ​ពី​បញ្ជី​របស់​ថាសរឹង​ដែល​ស្គាល់​ប៉ុណ្ណោះ ប៉ុន្តែ​ឯកតា​ផ្ទុ [...]
+        <translation><p>តើ​អ្នក​ចង់​លុប​ឯកតា​ផ្ទុក​របស់​ថាសរឹង​ <nobr><b>%1</b></nobr>ដែរឬទេ?</p><p>ប្រសិនបើ​អ្នក​ជ្រើស <b>លុប</b> បន្ទាប់​មក​ឯកតា​ផ្ទុក​ដែល​បានបញ្ជាក់​នឹង​ត្រូ​វបាន​លុប​ជា​អចិន្ត្រៃយ៍ ។ ប្រតិបត្តិការ​នេះ <b>មិនអាច​ត្រូ​វបាន​ធ្វើ​វិញ​បានទេ</b> ។</p><p>ប្រសិនបើ​អ្នក​ជ្រើស <b>រក្សាទុក</b> បន្ទាប់​មក​ថាសរឹង​នឹង​ត្រូវ​បានយកចេញ​តែ​ពី​បញ្ជី​របស់​ថាសរឹង​ដែល​ស្គាល់​ប៉ុណ្ណោះ ប៉ុន្តែ​ឯកតា​ផ្ទុ [...]
     </message>
     <message>
         <source>Delete</source>
@@ -6154,76 +6718,76 @@ network adapter name</comment>
     </message>
     <message>
         <source>Failed to delete the storage unit of the hard disk <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងការ​លុប​ការ​ផ្ទុក​របស់​ថាសរឹង <b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងការ​លុប​ការ​ផ្ទុក​របស់​ថាសរឹង <b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to create the hard disk storage <nobr><b>%1</b>.</nobr></source>
-        <translation>បានបរាជ័យ​ក្នុង​​ការ​បង្កើត​ការ​ផ្ទុក​ថាសរឹង <nobr><b>%1</b> ។</nobr></translation>
+        <translation>បានបរាជ័យ​ក្នុង​​ការ​បង្កើត​ការ​ផ្ទុក​ថាសរឹង <nobr><b>%1</b> ។</nobr></translation>
     </message>
     <message>
         <source>Failed to open the %1 <nobr><b>%2</b></nobr>.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងការ​បើក %1 <nobr><b>%2</b></nobr> ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងការ​បើក %1 <nobr><b>%2</b></nobr> ។</translation>
     </message>
     <message>
         <source>Failed to close the %1 <nobr><b>%2</b></nobr>.</source>
-        <translation type="obsolete">បានបរាជ័យ​ក្នុងកា​របិទ %1 <nobr><b>%2</b></nobr> ។</translation>
+        <translation type="obsolete">បានបរាជ័យ​ក្នុងកា​របិទ %1 <nobr><b>%2</b></nobr> ។</translation>
     </message>
     <message>
         <source>Failed to access the disk image file <nobr><b>%1</b></nobr>.</source>
-        <translation>បានបរាជ័យ​ក្នុងកា​រ​ចូលដំណើរការ​ស្ថានភាព​របស់​ឧបករណ៍​ផ្ទុក <nobr><b>%1</b></nobr> ។</translation>
+        <translation>បានបរាជ័យ​ក្នុងកា​រ​ចូលដំណើរការ​ស្ថានភាព​របស់​ឧបករណ៍​ផ្ទុក <nobr><b>%1</b></nobr> ។</translation>
     </message>
     <message>
         <source><p>Failed to connect to the VirtualBox online registration service due to the following error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>បានបរាជ័យ​ក្នុងកា​រតភ្ជាប់​ទៅ​កាន់​សេវា​ចុះឈ្មោះ​លើ​បណ្ដាញ​របស់ VirtualBox ដោយ​សារ​តែ​កំហុស​ដូច​ខាងក្រោម ៖</p><p><b>%1</b></p></translation>
+        <translation type="obsolete"><p>បានបរាជ័យ​ក្នុងកា​រតភ្ជាប់​ទៅ​កាន់​សេវា​ចុះឈ្មោះ​លើ​បណ្ដាញ​របស់ VirtualBox ដោយ​សារ​តែ​កំហុស​ដូច​ខាងក្រោម ៖</p><p><b>%1</b></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>មិនអាច​ទទួល​យក​ព័ត៌មានកំណែ​ថ្មី​បាន​ទេ ដោយ​សារ​តែ​កំហុស​ដូច​ខាងក្រោម ៖</p><p><b>%1</b></p></translation>
+        <translation type="obsolete"><p>មិនអាច​ទទួល​យក​ព័ត៌មានកំណែ​ថ្មី​បាន​ទេ ដោយ​សារ​តែ​កំហុស​ដូច​ខាងក្រោម ៖</p><p><b>%1</b></p></translation>
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>ថាសរឹង​និម្មិត​មួយ ឬ​ច្រើន ស៊ីឌី/ឌីវីឌី ឬ​មេឌៀ​ថាសទន់​បច្ចុប្បន្ន​មិនអាច​ចូលដំណើរការ​បានទេ ។ ជា​លទ្ធផល អ្នកនឹង​មិនអាច​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត​ ដែល​ប្រើ​មេឌៀ​នេះ​បាន​ទេ រហូត​ដល់​ពួកវា​អាច​ចូលដំណើរការ​បាននៅពេល​ក្រោយ ។</p><p>ចុច <b>ពិនិត្យ​មើល</b> ដើម្បី​ប្រើ​បង្អួច​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត ហើយ​មើល​អ្វី​ដែល​មេឌៀ​មិនអាច​ចូលដំណើរការ​បាន ឬ​ចុច <b>មិនអើពើ</b> ដើម្បី​មិនអើពើ​នឹង​សារ​នេះ ។</p></translation>
+        <translation type="obsolete"><p>ថាសរឹង​និម្មិត​មួយ ឬ​ច្រើន ស៊ីឌី/ឌីវីឌី ឬ​មេឌៀ​ថាសទន់​បច្ចុប្បន្ន​មិនអាច​ចូលដំណើរការ​បានទេ ។ ជា​លទ្ធផល អ្នកនឹង​មិនអាច​ប្រតិបត្តិ​ម៉ាស៊ីន​និម្មិត​ ដែល​ប្រើ​មេឌៀ​នេះ​បាន​ទេ រហូត​ដល់​ពួកវា​អាច​ចូលដំណើរការ​បាននៅពេល​ក្រោយ ។</p><p>ចុច <b>ពិនិត្យ​មើល</b> ដើម្បី​ប្រើ​បង្អួច​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត ហើយ​មើល​អ្វី​ដែល​មេឌៀ​មិនអាច​ចូលដំណើរការ​បាន ឬ​ចុច <b>មិនអើពើ</b> ដើម្បី​មិនអើពើ​នឹង​សារ​នេះ ។</p></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>កំហុស​ធ្ងន់ធ្ងរ​បាន​កើត​ឡើង​ខណៈពេល​កំពុង​រត់​ម៉ាស៊ីននិម្មិត ហើយ​ការ​ប្រតិបត្តិ​ម៉ាស៊ីន​ត្រូ​វបានបញ្ឈប់ ។</p><p>ចំពោះ​ជំនួយ សូមមើល​ផ្នែក​សហគមន៍​នៅ​លើ <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> ឬ​កិច្ចសន្យា​គាំទ្រ​របស់​អ្នក ។ សូម​ផ្ដល់​នូវ​ខ្លឹមសារ​របស់​ឯកសារ​កំណត់ហេតុ <tt>VBox.log</tt> ហើយ​នឹង​ឯកសារ​រូបភាព <tt>VBox.png</tt> ដែល​អ្នក​អាច​រក​បាន​នៅ​ក្នុង​ថត <nobr><b>%1</b>& [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>កំហុស​ធ្ងន់ធ្ងរ​បាន​កើត​ឡើង​ខណៈពេល​កំពុង​រត់​ម៉ាស៊ីននិម្មិត ហើយ​ការ​ប្រតិបត្តិ​ម៉ាស៊ីន​ត្រូ​វបានបញ្ឈប់ ។</p><p>ចំពោះ​ជំនួយ សូមមើល​ផ្នែក​សហគមន៍​នៅ​លើ <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> ឬ​កិច្ចសន្យា​គាំទ្រ​របស់​អ្នក ។ សូម​ផ្ដល់​នូវ​ខ្លឹមសារ​របស់​ឯកសារ​កំណត់ហេតុ <tt>VBox.log</tt> ហើយ​នឹង​ឯកសារ​រូបភាព <tt>VBox.png</tt> ដែល​អ្នក​អាច​រក​បាន​នៅ​ក្នុង​ថត <nobr><b&gt [...]
     </message>
     <message>
         <source>A file named <b>%1</b> already exists. Are you sure you want to replace it?<br /><br />Replacing it will overwrite its contents.</source>
-        <translation>​មាន​ឈ្មោះ​ឯកសាររបស់​<b>%1</b>រួច​ហើយ​ ។ តើ​អ្នក​ពិត​ជាចង់​ជំនួស​វា​​ឬ ?<br /><br />​ការ​ជំនួស​វា​នឹង​សរសេរ​ជាន់​លើ​
-មាតិកា​​របស់​វា​ ។</translation>
+        <translation>​មាន​ឈ្មោះ​ឯកសាររបស់​<b>%1</b>រួច​ហើយ​ ។ តើ​អ្នក​ពិត​ជាចង់​ជំនួស​វា​​ឬ ?<br /><br />​ការ​ជំនួស​វា​នឹង​សរសេរ​ជាន់​លើ​
+មាតិកា​​របស់​វា​ ។</translation>
     </message>
     <message>
         <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
-        <translation>មាន​ឯកសារ​​ជាបន្ត​បន្ទាប់​រួច​ហើយ​ ៖<br /><br />%1<br /><br />តើ​​អ្នក​ពិត​ជាចង់​ជំនួស​​​ពួកវា​ឬ ? ការ​ជំនួស​វា​នឹង​សរសេរ​ជាប់​លើ​មាតិកា​របស់វា ។</translation>
+        <translation>មាន​ឯកសារ​​ជាបន្ត​បន្ទាប់​រួច​ហើយ​ ៖<br /><br />%1<br /><br />តើ​​អ្នក​ពិត​ជាចង់​ជំនួស​​​ពួកវា​ឬ ? ការ​ជំនួស​វា​នឹង​សរសេរ​ជាប់​លើ​មាតិកា​របស់វា ។</translation>
     </message>
     <message>
         <source>Failed to remove the file <b>%1</b>.<br /><br />Please try to remove the file yourself and try again.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងកា​រយក​ឯកសារ <b>%1</b>ចេញ ។<br /><br />សូម​ព្យាយាម​យក​ឯកសារ​ចេញ​ដោយ​ខ្លួន​ឯង ហើយ​ព្យាយាម​ម្ដង​ទៀត ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងកា​រយក​ឯកសារ <b>%1</b>ចេញ ។<br /><br />សូម​ព្យាយាម​យក​ឯកសារ​ចេញ​ដោយ​ខ្លួន​ឯង ហើយ​ព្យាយាម​ម្ដង​ទៀត ។</translation>
     </message>
     <message>
         <source>You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. We strongly recommend that you change this, as it is a severe mis-configuration of your system which could cause USB devices to fail in unexpected ways.</source>
-        <translation>អ្នក​ហាក់​បី​ដូច​ជា​មាន​ប្រព័ន្ធ​ឯកសារ USBFS បាន​ម៉ោន​នៅ /sys/bus/usb/drivers ។ យើ​ង​ផ្ដល់​អនុសាសន៍​ឲ្យ​ផ្លាស់ប្ដូរ​វា ព្រោះ​ថា​វា​ជា​កា​រកំណត់​រចនាសម្ព័ន្ធ​មិន​ត្រឹមត្រូវ​នៃ​ប្រព័ន្ធ​របស់​អ្នក ដែល​អាច​ធ្វើ​ឲ្យ​ឧបករណ៍ USB បរាជ័យ​​តាម​វិធី​ដែល​មិនបាន​រំពឹង​ទុក ។</translation>
+        <translation>អ្នក​ហាក់​បី​ដូច​ជា​មាន​ប្រព័ន្ធ​ឯកសារ USBFS បាន​ម៉ោន​នៅ /sys/bus/usb/drivers ។ យើ​ង​ផ្ដល់​អនុសាសន៍​ឲ្យ​ផ្លាស់ប្ដូរ​វា ព្រោះ​ថា​វា​ជា​កា​រកំណត់​រចនាសម្ព័ន្ធ​មិន​ត្រឹមត្រូវ​នៃ​ប្រព័ន្ធ​របស់​អ្នក ដែល​អាច​ធ្វើ​ឲ្យ​ឧបករណ៍ USB បរាជ័យ​​តាម​វិធី​ដែល​មិនបាន​រំពឹង​ទុក ។</translation>
     </message>
     <message>
         <source>You are running a prerelease version of VirtualBox. This version is not suitable for production use.</source>
-        <translation>អ្នក​កំពុង​ដំណើរការ​កំណែ​ចេញ​ផ្សាយ​មុន​របស់ VirtualBox ។ កំណែ​នេះ​មិន​សម​សម្រាប់​ការ​ប្រើផលិតផល​នេះ​ទេ ។</translation>
+        <translation>អ្នក​កំពុង​ដំណើរការ​កំណែ​ចេញ​ផ្សាយ​មុន​របស់ VirtualBox ។ កំណែ​នេះ​មិន​សម​សម្រាប់​ការ​ប្រើផលិតផល​នេះ​ទេ ។</translation>
     </message>
     <message>
         <source>You are running an EXPERIMENTAL build of VirtualBox. This version is not suitable for production use.</source>
-        <translation>អ្នកកំពុង​ដំណើរការ​ការ​ស្ថាបនា​ពិសោធន៍របស់ VirtualBox ។ កំណែ​នេះ​មិន​សម​សម្រាប់ការ​ប្រើ​ផលិតផល​នេះ​ទេ ។</translation>
+        <translation>អ្នកកំពុង​ដំណើរការ​ការ​ស្ថាបនា​ពិសោធន៍របស់ VirtualBox ។ កំណែ​នេះ​មិន​សម​សម្រាប់ការ​ប្រើ​ផលិតផល​នេះ​ទេ ។</translation>
     </message>
     <message>
         <source>Could not access USB on the host system, because neither the USB file system (usbfs) nor the DBus and hal services are currently available. If you wish to use host USB devices inside guest systems, you must correct this and restart VirtualBox.</source>
-        <translation type="obsolete">មិនអាច​ដំណើរការ​ USB ក្នុង​ប្រព័ន្ធ​របស់​ម៉ាស៊ីនបាន​ទេ ពីព្រោះប្រព័ន្ធ​ឯកសារ USB (usbfs) ឬ DBus និង​សេវា hal បច្ចុប្បន្ននេះអាច​ប្រើ​បាន ។ ប្រសិនបើ​អ្នក​ចង់​ប្រើ​ឧបករណ៍​ USB របស់​ម៉ាស៊ីន អ្នក​ត្រូវ​តែ​កែវា ហើយ​ចាប់ផ្ដើម VirtualBox ឡើង​វិញ ។</translation>
+        <translation type="obsolete">មិនអាច​ដំណើរការ​ USB ក្នុង​ប្រព័ន្ធ​របស់​ម៉ាស៊ីនបាន​ទេ ពីព្រោះប្រព័ន្ធ​ឯកសារ USB (usbfs) ឬ DBus និង​សេវា hal បច្ចុប្បន្ននេះអាច​ប្រើ​បាន ។ ប្រសិនបើ​អ្នក​ចង់​ប្រើ​ឧបករណ៍​ USB របស់​ម៉ាស៊ីន អ្នក​ត្រូវ​តែ​កែវា ហើយ​ចាប់ផ្ដើម VirtualBox ឡើង​វិញ ។</translation>
     </message>
     <message>
         <source>You are trying to shut down the guest with the ACPI power button. This is currently not possible because the guest does not support software shutdown.</source>
-        <translation>អ្នក​កំពុង​ព្យាយាប​បិទ​ម៉ាស៊ីន​ដោយ​ប្រើប៊ូតុង​ថាមពល ACPI  ហើយ ។ បច្ចុប្បន្ន​នេះ​មិនអាច​ប្រើបាន​ទេ ពីព្រោះ​ម៉ាស៊ីន​​មិន​គាំទ្រ​​កម្មវិធី​បិទ​​ទេ ។</translation>
+        <translation>អ្នក​កំពុង​ព្យាយាប​បិទ​ម៉ាស៊ីន​ដោយ​ប្រើប៊ូតុង​ថាមពល ACPI  ហើយ ។ បច្ចុប្បន្ន​នេះ​មិនអាច​ប្រើបាន​ទេ ពីព្រោះ​ម៉ាស៊ីន​​មិន​គាំទ្រ​​កម្មវិធី​បិទ​​ទេ ។</translation>
     </message>
     <message>
         <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source>
-        <translation><p>ការ​បង្កើន​ល្បឿន​ផ្នែក​រឹង VT-x/AMD-V ត្រូវ​បានបើក ប៉ុន្តែ​មិន​ដំណើរការ​ទេ ។ ម៉ាស៊ីន​ ៦៤ ប៊ីត​របស់​អ្នក​នឹង​បរាជ័យ​ក្នុង​រក​ស៊ីភីយូ ៦៤ ប៊ីត ហើយ​មិន​អាច​ចាប់ផ្ដើម​បាន​ទេ ។</p><p>សូម​ប្រាកដ​ថា អ្នក​បានបើក VT-x/AMD-V យ៉ាង​ត្រាមត្រូវ​នៅ​ក្នុង BIOS នៃ​កុំព្យូទ័រ​របស់​អ្នក ។</p></translation>
+        <translation><p>ការ​បង្កើន​ល្បឿន​ផ្នែក​រឹង VT-x/AMD-V ត្រូវ​បានបើក ប៉ុន្តែ​មិន​ដំណើរការ​ទេ ។ ម៉ាស៊ីន​ ៦៤ ប៊ីត​របស់​អ្នក​នឹង​បរាជ័យ​ក្នុង​រក​ស៊ីភីយូ ៦៤ ប៊ីត ហើយ​មិន​អាច​ចាប់ផ្ដើម​បាន​ទេ ។</p><p>សូម​ប្រាកដ​ថា អ្នក​បានបើក VT-x/AMD-V យ៉ាង​ត្រាមត្រូវ​នៅ​ក្នុង BIOS នៃ​កុំព្យូទ័រ​របស់​អ្នក ។</p></translation>
     </message>
     <message>
         <source>Close VM</source>
@@ -6235,11 +6799,11 @@ network adapter name</comment>
     </message>
     <message>
         <source><p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Certain guests (e.g. OS/2 and QNX) require this feature.</p><p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p></source>
-        <translation><p>ការ​បង្កើន​ល្បឿន​ផ្នែក​រឹង VT-x/AMD-V ត្រូវ​បានបើក ប៉ុន្តែ​មិន​អាច​ដំណើរការ​បាន​ទេ ។ ម៉ាស៊ីន​ជាក់លាក់ (ឧ. OS/2 និង QNX) ទាមទារ​លក្ខណៈពិសេស​នេះ ។</p><p>សូម​ប្រាកដ​ថា អ្នក​បានបើក​ VT-x/AMD-V យ៉ាង​ត្រឹមត្រូវ​នៅ​ក្នុង BIOS នៃ​​កុំព្យូទ័រ​របស់​អ្នក ។</p></translation>
+        <translation><p>ការ​បង្កើន​ល្បឿន​ផ្នែក​រឹង VT-x/AMD-V ត្រូវ​បានបើក ប៉ុន្តែ​មិន​អាច​ដំណើរការ​បាន​ទេ ។ ម៉ាស៊ីន​ជាក់លាក់ (ឧ. OS/2 និង QNX) ទាមទារ​លក្ខណៈពិសេស​នេះ ។</p><p>សូម​ប្រាកដ​ថា អ្នក​បានបើក​ VT-x/AMD-V យ៉ាង​ត្រឹមត្រូវ​នៅ​ក្នុង BIOS នៃ​​កុំព្យូទ័រ​របស់​អ្នក ។</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to restore snapshot <b>%1</b>? This will cause you to lose your current machine state, which cannot be recovered.</p></source>
-        <translation type="obsolete"><p>តើ​អ្នក​ប្រាក​ដ​ជា​ចង់​ស្ដារ​រូបថត​ <b>%1</b>ឬ ? វា​នឹង​ធ្វើ​ឲ្យ​អ្នក​បាត់បង់​ស្ថានភាព​ម៉ាស៊ីន​បច្ចុប្បន្ន​របស់​អ្នក ដែល​មិនអាច​សង្គ្រោះ​បាន​ទេ ។</p></translation>
+        <translation type="obsolete"><p>តើ​អ្នក​ប្រាក​ដ​ជា​ចង់​ស្ដារ​រូបថត​ <b>%1</b>ឬ ? វា​នឹង​ធ្វើ​ឲ្យ​អ្នក​បាត់បង់​ស្ថានភាព​ម៉ាស៊ីន​បច្ចុប្បន្ន​របស់​អ្នក ដែល​មិនអាច​សង្គ្រោះ​បាន​ទេ ។</p></translation>
     </message>
     <message>
         <source>Restore</source>
@@ -6251,7 +6815,7 @@ network adapter name</comment>
     </message>
     <message>
         <source><p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over several image files that VirtualBox has created together with the snapshot will be merged into one file. This can be a lengthy process, and the information in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p></source>
-        <translation><p>ការ​លុប​រូប​ថត​នឹង​បណ្តាល​ឲ្យព័ត៌​មានចេញ​​ដែល​បាន​រ​ក្សា​ទុក​ត្រូវ​បាន​បាត់​បង់​ និងការ​ផ្សាយ​​ទិន្នន័យ​ថាស​​​លើ​ឯកសារ​រូប​ភាពបី​បួន​​ដែល​ VirtualBox ត្រូវ​បានបង្កើត​ជាមួយ​គ្នា ​រូប​ថត​នឹង​ត្រូវ​បានបញ្ចូល​ចូល​​គ្នា​​ទៅ​ក្នុង​ឯកសារ​តែ​មួយ​ ។​ វាអាច​ដំណើរ​ការ​យូរ​ និង​ព័ត៌​មាន​ក្នុង​រូប​ថត​មិន​អាច​ត្រូវ​បានយកបាន​​ឡើយ ។</p></p>តើ​អ្នក​ប្រាកដ​ជា​ចង់​លុប​រូប​ថត​ដែលបាន​​ជ្រើស​<b>%1</b> ឬ ?</p></translation>
+        <translation><p>ការ​លុប​រូប​ថត​នឹង​បណ្តាល​ឲ្យព័ត៌​មានចេញ​​ដែល​បាន​រ​ក្សា​ទុក​ត្រូវ​បាន​បាត់​បង់​ និងការ​ផ្សាយ​​ទិន្នន័យ​ថាស​​​លើ​ឯកសារ​រូប​ភាពបី​បួន​​ដែល​ VirtualBox ត្រូវ​បានបង្កើត​ជាមួយ​គ្នា ​រូប​ថត​នឹង​ត្រូវ​បានបញ្ចូល​ចូល​​គ្នា​​ទៅ​ក្នុង​ឯកសារ​តែ​មួយ​ ។​ វាអាច​ដំណើរ​ការ​យូរ​ និង​ព័ត៌​មាន​ក្នុង​រូប​ថត​មិន​អាច​ត្រូវ​បានយកបាន​​ឡើយ ។</p></p>តើ​អ្នក​ប្រាកដ​ជា​ចង់​លុប​រូប​ថត​ដែលបាន​​ជ្រើស​<b>%1</b> ឬ ?</p></translation>
     </message>
     <message>
         <source>Delete</source>
@@ -6263,15 +6827,15 @@ network adapter name</comment>
     </message>
     <message>
         <source>Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.</source>
-        <translation>បានបរាជ័យក្នុងការ​​​លុប​រូបថត​​<b>%1</b> របស់​​ម៉ាស៊ីន​​និម្មិត​​<b>%2</b> ។</translation>
+        <translation>បានបរាជ័យក្នុងការ​​​លុប​រូបថត​​<b>%1</b> របស់​​ម៉ាស៊ីន​​និម្មិត​​<b>%2</b> ។</translation>
     </message>
     <message>
         <source><p>There are hard disks attached to ports of the additional controller. If you disable the additional controller, all these hard disks will be automatically detached.</p><p>Are you sure you want to disable the additional controller?</p></source>
-        <translation type="obsolete"><p>មានថាស​រឹង​​ដែ​ល​ភ្ជាប់​ជា​មួយច្រក​របស់​ឧបករណ៍​បញ្ជា​បន្ថែម​ ។ ប្រ​សិន​បើ​អ្នកបិទ​​ឧបករណ៍​បញ្ជា​បន្ថែម​ គ្រប់​ថាស​រឹង​ទាំង​នេះ​នឹង​ត្រូវ​បាន​ផ្តាច់​ដោយ​ស្វ័យ​ប្រ​វត្តិ​ ។</p><p>​តើ​​អ្នក​ប្រាកដ​​ជា​​ចង់បិទ​​ឧបករណ៍​បញ្ជា​បន្ថែម​ ឬ ?</p></translation>
+        <translation type="obsolete"><p>មានថាស​រឹង​​ដែ​ល​ភ្ជាប់​ជា​មួយច្រក​របស់​ឧបករណ៍​បញ្ជា​បន្ថែម​ ។ ប្រ​សិន​បើ​អ្នកបិទ​​ឧបករណ៍​បញ្ជា​បន្ថែម​ គ្រប់​ថាស​រឹង​ទាំង​នេះ​នឹង​ត្រូវ​បាន​ផ្តាច់​ដោយ​ស្វ័យ​ប្រ​វត្តិ​ ។</p><p>​តើ​​អ្នក​ប្រាកដ​​ជា​​ចង់បិទ​​ឧបករណ៍​បញ្ជា​បន្ថែម​ ឬ ?</p></translation>
     </message>
     <message>
         <source><p>There are hard disks attached to ports of the additional controller. If you change the additional controller, all these hard disks will be automatically detached.</p><p>Are you sure you want to change the additional controller?</p></source>
-        <translation type="obsolete"><p>មាន​ថាសរឹង​ដែល​ភ្ជាប់​ជាមួយ​ច្រក​របស់​ឧបករណ៍​បញ្ជា​បន្ថែម​ ។ ប្រ​សិន​បើ​អ្នក​​ផ្លាស់​ប្តូរ​ឧបរណ៍​បញ្ញា​បន្ថែម​​ គ្រប់​ថាស​រឹង​ទាំង​នេះ​នឹង​ត្រូវ​បាន​ផ្តាច់​ដោយ​ស្វ័យ​ប្រវត្តិ​ ។​</p><p>​តើ​អ្នក​ប្រាកដជា​​ចង់​ផ្លាស់​ប្តូរ​​ឧបករណ៍​បញ្ជា​បន្ថែម​ឬ ?</p></translation>
+        <translation type="obsolete"><p>មាន​ថាសរឹង​ដែល​ភ្ជាប់​ជាមួយ​ច្រក​របស់​ឧបករណ៍​បញ្ជា​បន្ថែម​ ។ ប្រ​សិន​បើ​អ្នក​​ផ្លាស់​ប្តូរ​ឧបរណ៍​បញ្ញា​បន្ថែម​​ គ្រប់​ថាស​រឹង​ទាំង​នេះ​នឹង​ត្រូវ​បាន​ផ្តាច់​ដោយ​ស្វ័យ​ប្រវត្តិ​ ។​</p><p>​តើ​អ្នក​ប្រាកដជា​​ចង់​ផ្លាស់​ប្តូរ​​ឧបករណ៍​បញ្ជា​បន្ថែម​ឬ ?</p></translation>
     </message>
     <message>
         <source>Change</source>
@@ -6306,31 +6870,31 @@ medium</comment>
     </message>
     <message>
         <source><p>There are no unused media available for the newly created attachment.</p><p>Press the <b>Select</b> if you wish to open the <i>Virtual Media Manager</i>.</p></source>
-        <translation type="obsolete"><p>មិនមាន​មេឌៀ​មិន​បាន​ប្រើទេ សម្រាប់​ឯកសារ​ភ្ជាប់​ដែលបានបង្កើត​ថ្មី ។</p><p>ចុច <b>ជ្រើស</b> ប្រសិន​បើ​អ្នក​ចង់​បើក <i>កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត</i> ។</p></translation>
+        <translation type="obsolete"><p>មិនមាន​មេឌៀ​មិន​បាន​ប្រើទេ សម្រាប់​ឯកសារ​ភ្ជាប់​ដែលបានបង្កើត​ថ្មី ។</p><p>ចុច <b>ជ្រើស</b> ប្រសិន​បើ​អ្នក​ចង់​បើក <i>កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត</i> ។</p></translation>
     </message>
     <message>
         <source>Failed to attach the %1 to slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងការ​ភ្ជាប់ %1 ទៅ​រន្ធ <i>%2</i> របស់​ម៉ាស៊ីន<b>%3</b> ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងការ​ភ្ជាប់ %1 ទៅ​រន្ធ <i>%2</i> របស់​ម៉ាស៊ីន<b>%3</b> ។</translation>
     </message>
     <message>
         <source>Failed to detach the %1 from slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​ក្នុង​ការ​ផ្ដាច់​ %1 ពី​រន្ធ <i>%2</i> របស់​ម៉ាស៊ីន<b>%3</b> ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​ក្នុង​ការ​ផ្ដាច់​ %1 ពី​រន្ធ <i>%2</i> របស់​ម៉ាស៊ីន<b>%3</b> ។</translation>
     </message>
     <message>
         <source>Unable to insert the %1 <nobr><b>%2</b></nobr> into the machine <b>%3</b>.</source>
-        <translation type="obsolete">មិនអាច​ម៉ោន %1 <nobr><b>%2</b></nobr> នៅ​លើ​ម៉ាស៊ីន <b>%3</b>បាន​ទេ ។</translation>
+        <translation type="obsolete">មិនអាច​ម៉ោន %1 <nobr><b>%2</b></nobr> នៅ​លើ​ម៉ាស៊ីន <b>%3</b>បាន​ទេ ។</translation>
     </message>
     <message>
         <source> Would you like to force mounting of this medium?</source>
-        <translation type="obsolete"> តើ​អ្នក​ចង់​បង្ខំ​ម៉ោន​ឧបករណ៍​ផ្ទុក​នេះ​ដែរឬទេ ?</translation>
+        <translation type="obsolete"> តើ​អ្នក​ចង់​បង្ខំ​ម៉ោន​ឧបករណ៍​ផ្ទុក​នេះ​ដែរឬទេ ?</translation>
     </message>
     <message>
         <source>Unable to unmount the %1 <nobr><b>%2</b></nobr> from the machine <b>%3</b>.</source>
-        <translation type="obsolete">មិនអាច​អាន់ម៉ោន​ %1 <nobr><b>%2</b></nobr> ពី​ម៉ាស៊ីន <b>%3</b> ។</translation>
+        <translation type="obsolete">មិនអាច​អាន់ម៉ោន​ %1 <nobr><b>%2</b></nobr> ពី​ម៉ាស៊ីន <b>%3</b> ។</translation>
     </message>
     <message>
         <source> Would you like to force unmounting of this medium?</source>
-        <translation type="obsolete"> តើ​អ្នក​ចង់​បង្ខំ​អាន់ម៉ោន​ឧបករណ៍​ផ្ទុក​នេះ​ដែរឬទេ ?</translation>
+        <translation type="obsolete"> តើ​អ្នក​ចង់​បង្ខំ​អាន់ម៉ោន​ឧបករណ៍​ផ្ទុក​នេះ​ដែរឬទេ ?</translation>
     </message>
     <message>
         <source>Force Unmount</source>
@@ -6338,7 +6902,7 @@ medium</comment>
     </message>
     <message>
         <source>Failed to eject the disk from the virtual drive. The drive may be locked by the guest operating system. Please check this and try again.</source>
-        <translation type="obsolete">បានបរាជ័យ​​ក្នុង​កា​រច្រាន​ថាស​ចេញ​ពី​ដ្រាយ​និម្មិត ។ ដ្រាយ​អាច​ត្រូវ​បានចាក់​សោ​ដោយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ ។ សូម​ពិនិត្យ​មើល​វា ហើយ​ព្យាយាម​ម្ដង​ទៀត ។</translation>
+        <translation type="obsolete">បានបរាជ័យ​​ក្នុង​កា​រច្រាន​ថាស​ចេញ​ពី​ដ្រាយ​និម្មិត ។ ដ្រាយ​អាច​ត្រូវ​បានចាក់​សោ​ដោយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ ។ សូម​ពិនិត្យ​មើល​វា ហើយ​ព្យាយាម​ម្ដង​ទៀត ។</translation>
     </message>
     <message>
         <source><p>Deleting this host-only network will remove the host-only interface this network is based on. Do you want to remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p><p><b>Note:</b> this interface may be in use by one or more virtual network adapters belonging to one of your VMs. After it is removed, these adapters will no longer be usable until you correct their settings by either choosing a different in [...]
@@ -6350,19 +6914,19 @@ medium</comment>
     </message>
     <message>
         <source><p>Could not insert the VirtualBox Guest Additions installer disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="obsolete"><p>មិនអាច​បញ្ចូល​រូបភាព​ស៊ីឌី​កម្មវិធី​ដំឡើង​បន្ថែម​របស់​ម៉ាស៊ីន VirtualBox ​ទៅ​ក្នុង​ម៉ាស៊ីន​និម្មិត​<b>%1</b>បាន​ទេ ព្រោះ​ថា​ម៉ាស៊ីន​មាន​ដ្រាយ​ស៊ីឌី/ឌីវីឌី​រ៉ូម ។ សូម​បន្ថែម​ដ្រាយ ដោយ​ប្រើ​ទំព័រ​ផ្ទុក​នៃ​ប្រអប់​កំណត់​ម៉ាស៊ីន​និម្មិត ។</p></translation>
+        <translation type="obsolete"><p>មិនអាច​បញ្ចូល​រូបភាព​ស៊ីឌី​កម្មវិធី​ដំឡើង​បន្ថែម​របស់​ម៉ាស៊ីន VirtualBox ​ទៅ​ក្នុង​ម៉ាស៊ីន​និម្មិត​<b>%1</b>បាន​ទេ ព្រោះ​ថា​ម៉ាស៊ីន​មាន​ដ្រាយ​ស៊ីឌី/ឌីវីឌី​រ៉ូម ។ សូម​បន្ថែម​ដ្រាយ ដោយ​ប្រើ​ទំព័រ​ផ្ទុក​នៃ​ប្រអប់​កំណត់​ម៉ាស៊ីន​និម្មិត ។</p></translation>
     </message>
     <message>
         <source><p>Invalid e-mail address or password specified.</p></source>
-        <translation type="obsolete"><p>អាសយដ្ឋាន​អ៊ីមែល ឬ​ពាក្យ​សម្ងាត់​ដែលបាន​បញ្ជាក់មិន​ត្រឹមត្រូវ ។</p></translation>
+        <translation type="obsolete"><p>អាសយដ្ឋាន​អ៊ីមែល ឬ​ពាក្យ​សម្ងាត់​ដែលបាន​បញ្ជាក់មិន​ត្រឹមត្រូវ ។</p></translation>
     </message>
     <message>
         <source><p>Failed to register the VirtualBox product.</p><p>%1</p></source>
-        <translation type="obsolete"><p>បាន​បរាជ័យ​ក្នុងកា​រចុះឈ្មោះផលិតផល VirtualBox ។</p><p>%1</p></translation>
+        <translation type="obsolete"><p>បាន​បរាជ័យ​ក្នុងកា​រចុះឈ្មោះផលិតផល VirtualBox ។</p><p>%1</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files will be automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if you want to terminate the VirtualBox application without any further actions.</p></source>
-        <translation type="obsolete"><p>ឯកសារ​កំណត់​ VirtualBox មាន​ស្រាប់​​របស់​អ្នក នឹង​ត្រូវ​បានបម្លែង​ដោយ​ស្វ័យ​ប្រវត្តិ​ពី​ទ្រង់ទ្រាយ​ចាស់ ទៅ​ទ្រង់ទ្រាយ​ថ្មី​ដែលបានទាមទារ​ដោយ​កំណែ​ថ្មី​របស់ VirtualBox ​។</p><p>ចុច <b>យល់</b> ដើម្បី​ចាប់ផ្ដើម VirtualBox ឥឡូវ ឬ​ចុច <b>ចាកចេញ</b> ប្រសិនបើ​អ្នក​ចង់​បញ្ចប់​កម្មវិធី​របស់ VirtualBox ដោយ​គ្មាន​សកម្មភាព​បន្ថែម​ផ្សេង​ទៀត ។</p></translation>
+        <translation type="obsolete"><p>ឯកសារ​កំណត់​ VirtualBox មាន​ស្រាប់​​របស់​អ្នក នឹង​ត្រូវ​បានបម្លែង​ដោយ​ស្វ័យ​ប្រវត្តិ​ពី​ទ្រង់ទ្រាយ​ចាស់ ទៅ​ទ្រង់ទ្រាយ​ថ្មី​ដែលបានទាមទារ​ដោយ​កំណែ​ថ្មី​របស់ VirtualBox ​។</p><p>ចុច <b>យល់</b> ដើម្បី​ចាប់ផ្ដើម VirtualBox ឥឡូវ ឬ​ចុច <b>ចាកចេញ</b> ប្រសិនបើ​អ្នក​ចង់​បញ្ចប់​កម្មវិធី​របស់ VirtualBox ដោយ​គ្មាន​សកម្មភាព​បន្ថែម​ផ្សេង​ទៀត ។</p></translation>
     </message>
     <message>
         <source>E&xit</source>
@@ -6375,19 +6939,19 @@ warnAboutSettingsAutoConversion message box</comment>
     </message>
     <message>
         <source><p>The following VirtualBox settings files will be automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if you want to terminate the VirtualBox application without any further actions.</p></source>
-        <translation type="obsolete"><p>ឯកសារ​កំណត់ VirtualBox ដូច​ខាងក្រោម​នឹង​ត្រូវ​បានបម្លែង​ដោយ​ស្វ័យ​ប្រវត្តិ​ពី​ទ្រង់ទ្រាយ​ចាស់​ទៅ​ទ្រង់ទ្រាយ​ថ្មី​របស់ VirtualBox ។</p><p>ចុច <b>យល់</b> ដើម្បី​ចាប់ផ្ដើម VirtualBox ឥឡូវ ឬ​ចុច <b>ចាកចេញ</b> ប្រសិនបើ​អ្នក​ចង់​បញ្ចប់​កម្មវិធី VirtualBox ដោយ​គ្មាន​សកម្មភាព​បន្ថែម​ទៀត ។</p></translation>
+        <translation type="obsolete"><p>ឯកសារ​កំណត់ VirtualBox ដូច​ខាងក្រោម​នឹង​ត្រូវ​បានបម្លែង​ដោយ​ស្វ័យ​ប្រវត្តិ​ពី​ទ្រង់ទ្រាយ​ចាស់​ទៅ​ទ្រង់ទ្រាយ​ថ្មី​របស់ VirtualBox ។</p><p>ចុច <b>យល់</b> ដើម្បី​ចាប់ផ្ដើម VirtualBox ឥឡូវ ឬ​ចុច <b>ចាកចេញ</b> ប្រសិនបើ​អ្នក​ចង់​បញ្ចប់​កម្មវិធី VirtualBox ដោយ​គ្មាន​សកម្មភាព​បន្ថែម​ទៀត ។</p></translation>
     </message>
     <message>
         <source>Failed to open appliance.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងកា​របើក​ឧបករណ៍ ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​ក្នុងកា​របើក​ឧបករណ៍ ។</translation>
     </message>
     <message>
         <source>Failed to open/interpret appliance <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងកា​របើក/បកប្រែ​ឧបករណ៍<b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងកា​របើក/បកប្រែ​ឧបករណ៍<b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to import appliance <b>%1</b>.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងកា​រនាំចូល​ឧបករណ៍<b>%1</b> ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងកា​រនាំចូល​ឧបករណ៍<b>%1</b> ។</translation>
     </message>
     <message>
         <source>Failed to check files.</source>
@@ -6395,11 +6959,11 @@ warnAboutSettingsAutoConversion message box</comment>
     </message>
     <message>
         <source>Failed to remove file.</source>
-        <translation>បាន​បរាជ័យ​ក្នុងកា​រយក​ឯកសារ​ចេញ ។</translation>
+        <translation>បាន​បរាជ័យ​ក្នុងកា​រយក​ឯកសារ​ចេញ ។</translation>
     </message>
     <message>
         <source>Failed to create appliance.</source>
-        <translation type="obsolete">បាន​បរាជ័យ​ទៅ​បង្កើតឧបករណ៍ ។</translation>
+        <translation type="obsolete">បាន​បរាជ័យ​ទៅ​បង្កើតឧបករណ៍ ។</translation>
     </message>
     <message>
         <source>Failed to prepare the export of the appliance <b>%1</b>.</source>
@@ -6495,7 +7059,7 @@ failed to close ...</comment>
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>តើ​​​អ្នក​ប្រាកដ​ជា​ចង់​លុប​ឧបករណ៍​​ស៊ី​ឌី​​/​ឌី​វីឌី​-រ៉ូម​ឬ​​?</p><p>អ្នក​នឹង​​មិន​អាច​ម៉ោន​ស៊ី​ឌី​ ឬ​រូប​ភាព ISO ឬ​ដំឡើង​​ការ​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ​​ដោយ​គ្មាន​វា​បាន​​ទេ ​​!</p></translation>
+        <translation type="obsolete"><p>តើ​​​អ្នក​ប្រាកដ​ជា​ចង់​លុប​ឧបករណ៍​​ស៊ី​ឌី​​/​ឌី​វីឌី​-រ៉ូម​ឬ​​?</p><p>អ្នក​នឹង​​មិន​អាច​ម៉ោន​ស៊ី​ឌី​ ឬ​រូប​ភាព ISO ឬ​ដំឡើង​​ការ​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ​​ដោយ​គ្មាន​វា​បាន​​ទេ ​​!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -6617,10 +7181,6 @@ medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -6629,14 +7189,6 @@ medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6665,14 +7217,6 @@ medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -6799,7 +7343,7 @@ medium</comment>
     </message>
     <message>
         <source><p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p></source>
-        <translation type="obsolete"><p>បាន​បរាជ័យ​ក្នុងកា​ររក្សាទុក​ឯកសារ​ដែលបាន​ទាញ​យក​ជា <nobr><b>%1</b> ។</nobr></p></translation>
+        <translation type="obsolete"><p>បាន​បរាជ័យ​ក្នុងកា​ររក្សាទុក​ឯកសារ​ដែលបាន​ទាញ​យក​ជា <nobr><b>%1</b> ។</nobr></p></translation>
     </message>
     <message>
         <source><p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p><p>Do you wish to download latest one from the Internet?</p></source>
@@ -6878,10 +7422,6 @@ medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7109,14 +7649,6 @@ medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7149,26 +7681,122 @@ medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">ម៉ោន</translation>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>Insert</source>
+        <comment>additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetAdditions</name>
@@ -7225,28 +7853,28 @@ medium</comment>
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
-        <translation type="unfinished">ឈ្មោះ ៖</translation>
+        <source>N&ame:</source>
+        <translation type="unfinished">ឈ្មោះ ៖</translation>
     </message>
     <message>
         <source>Holds the name of the virtual machine.</source>
-        <translation type="unfinished">បង្ហាញ​ឈ្មោះ​របស់​ម៉ាស៊ីន​និម្មិត ។</translation>
+        <translation type="unfinished">បង្ហាញ​ឈ្មោះ​របស់​ម៉ាស៊ីន​និម្មិត ។</translation>
     </message>
     <message>
         <source>&Type:</source>
-        <translation type="unfinished">ប្រភេទ ៖</translation>
+        <translation type="unfinished">ប្រភេទ ៖</translation>
     </message>
     <message>
         <source>Selects the operating system family that you plan to install into this virtual machine.</source>
-        <translation type="unfinished">បង្ហាញ​ក្រុមគ្រួសារ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​មានគម្រោង​ដំឡើង​ក្នុង​ម៉ាស៊ីន​និម្មិត​នេះ ។</translation>
+        <translation type="unfinished">បង្ហាញ​ក្រុមគ្រួសារ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​មានគម្រោង​ដំឡើង​ក្នុង​ម៉ាស៊ីន​និម្មិត​នេះ ។</translation>
     </message>
     <message>
         <source>&Version:</source>
-        <translation type="unfinished">កំណែ ៖</translation>
+        <translation type="unfinished">កំណែ ៖</translation>
     </message>
     <message>
         <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation type="unfinished">បង្ហាញ​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​​មាន​​គម្រោង​ដំឡើង​ម៉ាស៊ីន​និម្មិត​នេះ (បាន​ហៅ​ប្រព័ន្ធ​ប្រតិបត្តិ​របស់​ម៉ាស៊ីន​ភ្ញៀវ) ។</translation>
+        <translation type="unfinished">បង្ហាញ​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​​មាន​​គម្រោង​ដំឡើង​ម៉ាស៊ីន​និម្មិត​នេះ (បាន​ហៅ​ប្រព័ន្ធ​ប្រតិបត្តិ​របស់​ម៉ាស៊ីន​ភ្ញៀវ) ។</translation>
     </message>
 </context>
 <context>
@@ -7339,7 +7967,7 @@ medium</comment>
     </message>
     <message>
         <source>Welcome to the Create New Virtual Disk Wizard!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​​អ្នក​ជំនួយការ​បង្កើត​ថាស​និម្មិ​តថ្មី !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​​អ្នក​ជំនួយការ​បង្កើត​ថាស​និម្មិ​តថ្មី !</translation>
     </message>
     <message>
         <source>Virtual Disk Location and Size</source>
@@ -7399,7 +8027,7 @@ medium</comment>
     </message>
     <message>
         <source><p>This wizard will help you to create a new virtual hard disk for your virtual machine.</p><p>Use the <b>Next</b> button to go to the next page of the wizard and the <b>Back</b> button to return to the previous page.</p></source>
-        <translation type="obsolete"><p>អ្នក​ជំនួយការ​នេះ​ជួយ​អ្នក​ក្នុងកា​របង្កើត​ថាសរឹង​និម្មិត​សម្រាប់​ម៉ាស៊ីន​និម្មិត​របស់​អ្នក ។</p><p>ប្រើប៊ូតុង <b>បន្ទាប់</b> ដើម្បី​ទៅកាន់​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយការ ប៊ូតុង<b>ថយក្រោយ</b> ដើម្បី​ត្រឡប់​ទៅ​ទំព័រ​មុន ។</p></translation>
+        <translation type="obsolete"><p>អ្នក​ជំនួយការ​នេះ​ជួយ​អ្នក​ក្នុងកា​របង្កើត​ថាសរឹង​និម្មិត​សម្រាប់​ម៉ាស៊ីន​និម្មិត​របស់​អ្នក ។</p><p>ប្រើប៊ូតុង <b>បន្ទាប់</b> ដើម្បី​ទៅកាន់​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយការ ប៊ូតុង<b>ថយក្រោយ</b> ដើម្បី​ត្រឡប់​ទៅ​ទំព័រ​មុន ។</p></translation>
     </message>
     <message>
         <source>Hard Disk Storage Type</source>
@@ -7407,7 +8035,7 @@ medium</comment>
     </message>
     <message>
         <source><p>Select the type of virtual hard disk you want to create.</p><p>A <b>dynamically expanding storage</b> initially occupies a very small amount of space on your physical hard disk. It will grow dynamically (up to the size specified) as the Guest OS claims disk space.</p><p>A <b>fixed-size storage</b> does not grow. It is stored in a file of approximately the same size as the size of the virtual hard disk. The creation  [...]
-        <translation type="obsolete"><p>ជ្រើស​ប្រភេទ​ថាសរឹង​និម្មិត​ដែល​អ្នក​ចង់​បង្កើត ។</p><p> <b>កា​រផ្ទុក​ពង្រីក​ជា​ថាមវន្ត</b> ដំបូង​គ្រប់គ្រង​រាល់​ទំហំ​តូចៗ​របស់ចន្លោះ​នៅ​ក្នុង​ថាសរឹង​ហ្វីស៊ីខល​របស់​អ្នក ។ វា​នឹង​ពង្រីក​ដោយ​ថាមវន្ត (ដល់​ទំហំ​ដែល​បាន​បញ្ជាក់) ជា​ការ​អះអាង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។</p><p> <b>កា​រផ្ទុក​ទំហំថេរ</b> មិន​រីកចំរើន​ទេ ។ វា​ត្រូ​វបាន​ផ្ទុក​នៅ​ក្នុង​ឯកសារ​របស់​ទំហំ​​ប្រហែល​ ជា​ទំហំ​របស់​ [...]
+        <translation type="obsolete"><p>ជ្រើស​ប្រភេទ​ថាសរឹង​និម្មិត​ដែល​អ្នក​ចង់​បង្កើត ។</p><p> <b>កា​រផ្ទុក​ពង្រីក​ជា​ថាមវន្ត</b> ដំបូង​គ្រប់គ្រង​រាល់​ទំហំ​តូចៗ​របស់ចន្លោះ​នៅ​ក្នុង​ថាសរឹង​ហ្វីស៊ីខល​របស់​អ្នក ។ វា​នឹង​ពង្រីក​ដោយ​ថាមវន្ត (ដល់​ទំហំ​ដែល​បាន​បញ្ជាក់) ជា​ការ​អះអាង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។</p><p> <b>កា​រផ្ទុក​ទំហំថេរ</b> មិន​រីកចំរើន​ទេ ។ វា​ត្រូ​វបាន​ផ្ទុក​នៅ​ក្នុង​ឯកសារ​របស់​ទំហំ​​ប្រហែល​ ជា​ទំហំ​របស់​ [...]
     </message>
     <message>
         <source>Storage Type</source>
@@ -7423,7 +8051,7 @@ medium</comment>
     </message>
     <message>
         <source><p>Press the <b>Select</b> button to select the location of a file to store the hard disk data or type a file name in the entry field.</p></source>
-        <translation type="obsolete"><p>ចុច​ប៊ូតុង <b>ជ្រើស</b> ដើម្បី​ជ្រើស​ទីតាំង​របស់​ឯកសារ​ដើម្បី​ផ្ទុក​ថាសរឹង ឬ​ប្រភេទ​ឈ្មោះ​ឯកសារ​នៅ​ក្នុង​វាល​ធាតុ ។</p></translation>
+        <translation type="obsolete"><p>ចុច​ប៊ូតុង <b>ជ្រើស</b> ដើម្បី​ជ្រើស​ទីតាំង​របស់​ឯកសារ​ដើម្បី​ផ្ទុក​ថាសរឹង ឬ​ប្រភេទ​ឈ្មោះ​ឯកសារ​នៅ​ក្នុង​វាល​ធាតុ ។</p></translation>
     </message>
     <message>
         <source>&Location</source>
@@ -7431,7 +8059,7 @@ medium</comment>
     </message>
     <message>
         <source><p>Select the size of the virtual hard disk in megabytes. This size will be reported to the Guest OS as the maximum size of this hard disk.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​ទំហំ​ថាសរឹង​និម្មិត​គិត​ជាមេកាបៃ ។ ទំហំ​នេះ​នឹង​ត្រូវ​បាន​រាយការណ៍​ទៅ​កាន់​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​តាម​ទំហំ​អតិបរមា​របស់​ថាសរឹង​នេះ ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​ទំហំ​ថាសរឹង​និម្មិត​គិត​ជាមេកាបៃ ។ ទំហំ​នេះ​នឹង​ត្រូវ​បាន​រាយការណ៍​ទៅ​កាន់​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​តាម​ទំហំ​អតិបរមា​របស់​ថាសរឹង​នេះ ។</p></translation>
     </message>
     <message>
         <source>&Size</source>
@@ -7439,11 +8067,11 @@ medium</comment>
     </message>
     <message>
         <source>You are going to create a new virtual hard disk with the following parameters:</source>
-        <translation type="obsolete">អ្នកនឹង​បង្កើត​ថាសរឹង​និម្មិត​ថ្មី​ដោយ​មាន​ប៉ារ៉ាម៉ែត្រ​ដូច​ខាងក្រោម ៖</translation>
+        <translation type="obsolete">អ្នកនឹង​បង្កើត​ថាសរឹង​និម្មិត​ថ្មី​ដោយ​មាន​ប៉ារ៉ាម៉ែត្រ​ដូច​ខាងក្រោម ៖</translation>
     </message>
     <message>
         <source>If the above settings are correct, press the <b>Finish</b> button. Once you press it, a new hard disk will be created.</source>
-        <translation type="obsolete">ប្រសិនបើ​កា​រកំណត់​ខាង​លើ​ត្រឹមត្រូវ ចុច​ប៊ូតុង <b>បញ្ចប់</b> ។ នៅពេល​អ្នក​ចុចវា ថាសរឹង​ថ្មី​នឹង​ត្រូវ​បានបង្កើត​ឡើង ។</translation>
+        <translation type="obsolete">ប្រសិនបើ​កា​រកំណត់​ខាង​លើ​ត្រឹមត្រូវ ចុច​ប៊ូតុង <b>បញ្ចប់</b> ។ នៅពេល​អ្នក​ចុចវា ថាសរឹង​ថ្មី​នឹង​ត្រូវ​បានបង្កើត​ឡើង ។</translation>
     </message>
 </context>
 <context>
@@ -7461,14 +8089,14 @@ medium</comment>
     <name>UINewHDWizardPageWelcome</name>
     <message>
         <source>Welcome to the Create New Virtual Disk Wizard!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​​អ្នក​ជំនួយការ​បង្កើត​ថាស​និម្មិ​តថ្មី !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​​អ្នក​ជំនួយការ​បង្កើត​ថាស​និម្មិ​តថ្មី !</translation>
     </message>
 </context>
 <context>
     <name>UINewHDWzdPage2</name>
     <message>
         <source><p>Select the type of virtual hard disk you want to create.</p><p>A <b>dynamically expanding storage</b> initially occupies a very small amount of space on your physical hard disk. It will grow dynamically (up to the size specified) as the Guest OS claims disk space.</p><p>A <b>fixed-size storage</b> does not grow. It is stored in a file of approximately the same size as the size of the virtual hard disk. The creation  [...]
-        <translation type="obsolete"><p>ជ្រើស​ប្រភេទ​ថាសរឹង​និម្មិត​ដែល​អ្នក​ចង់​បង្កើត ។</p><p> <b>កា​រផ្ទុក​ពង្រីក​ជា​ថាមវន្ត</b> ដំបូង​គ្រប់គ្រង​រាល់​ទំហំ​តូចៗ​របស់ចន្លោះ​នៅ​ក្នុង​ថាសរឹង​ហ្វីស៊ីខល​របស់​អ្នក ។ វា​នឹង​ពង្រីក​ដោយ​ថាមវន្ត (ដល់​ទំហំ​ដែល​បាន​បញ្ជាក់) ជា​ការ​អះអាង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។</p><p> <b>កា​រផ្ទុក​ទំហំថេរ</b> មិន​រីកចំរើន​ទេ ។ វា​ត្រូ​វបាន​ផ្ទុក​នៅ​ក្នុង​ឯកសារ​របស់​ទំហំ​​ប្រហែល​ ជា​ទំហំ​របស់​ [...]
+        <translation type="obsolete"><p>ជ្រើស​ប្រភេទ​ថាសរឹង​និម្មិត​ដែល​អ្នក​ចង់​បង្កើត ។</p><p> <b>កា​រផ្ទុក​ពង្រីក​ជា​ថាមវន្ត</b> ដំបូង​គ្រប់គ្រង​រាល់​ទំហំ​តូចៗ​របស់ចន្លោះ​នៅ​ក្នុង​ថាសរឹង​ហ្វីស៊ីខល​របស់​អ្នក ។ វា​នឹង​ពង្រីក​ដោយ​ថាមវន្ត (ដល់​ទំហំ​ដែល​បាន​បញ្ជាក់) ជា​ការ​អះអាង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ ។</p><p> <b>កា​រផ្ទុក​ទំហំថេរ</b> មិន​រីកចំរើន​ទេ ។ វា​ត្រូ​វបាន​ផ្ទុក​នៅ​ក្នុង​ឯកសារ​របស់​ទំហំ​​ប្រហែល​ ជា​ទំហំ​របស់​ [...]
     </message>
     <message>
         <source>Storage Type</source>
@@ -7491,7 +8119,7 @@ medium</comment>
     <name>UINewHDWzdPage3</name>
     <message>
         <source><p>Press the <b>Select</b> button to select the location of a file to store the hard disk data or type a file name in the entry field.</p></source>
-        <translation type="obsolete"><p>ចុច​ប៊ូតុង <b>ជ្រើស</b> ដើម្បី​ជ្រើស​ទីតាំង​របស់​ឯកសារ​ដើម្បី​ផ្ទុក​ថាសរឹង ឬ​ប្រភេទ​ឈ្មោះ​ឯកសារ​នៅ​ក្នុង​វាល​ធាតុ ។</p></translation>
+        <translation type="obsolete"><p>ចុច​ប៊ូតុង <b>ជ្រើស</b> ដើម្បី​ជ្រើស​ទីតាំង​របស់​ឯកសារ​ដើម្បី​ផ្ទុក​ថាសរឹង ឬ​ប្រភេទ​ឈ្មោះ​ឯកសារ​នៅ​ក្នុង​វាល​ធាតុ ។</p></translation>
     </message>
     <message>
         <source>&Location</source>
@@ -7499,7 +8127,7 @@ medium</comment>
     </message>
     <message>
         <source><p>Select the size of the virtual hard disk in megabytes. This size will be reported to the Guest OS as the maximum size of this hard disk.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​ទំហំ​ថាសរឹង​និម្មិត​គិត​ជាមេកាបៃ ។ ទំហំ​នេះ​នឹង​ត្រូវ​បាន​រាយការណ៍​ទៅ​កាន់​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​តាម​ទំហំ​អតិបរមា​របស់​ថាសរឹង​នេះ ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​ទំហំ​ថាសរឹង​និម្មិត​គិត​ជាមេកាបៃ ។ ទំហំ​នេះ​នឹង​ត្រូវ​បាន​រាយការណ៍​ទៅ​កាន់​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​តាម​ទំហំ​អតិបរមា​របស់​ថាសរឹង​នេះ ។</p></translation>
     </message>
     <message>
         <source>&Size</source>
@@ -7522,7 +8150,7 @@ medium</comment>
     <name>UINewHDWzdPage4</name>
     <message>
         <source>You are going to create a new virtual hard disk with the following parameters:</source>
-        <translation type="obsolete">អ្នកនឹង​បង្កើត​ថាសរឹង​និម្មិត​ថ្មី​ដោយ​មាន​ប៉ារ៉ាម៉ែត្រ​ដូច​ខាងក្រោម ៖</translation>
+        <translation type="obsolete">អ្នកនឹង​បង្កើត​ថាសរឹង​និម្មិត​ថ្មី​ដោយ​មាន​ប៉ារ៉ាម៉ែត្រ​ដូច​ខាងក្រោម ៖</translation>
     </message>
     <message>
         <source>Type</source>
@@ -7548,7 +8176,7 @@ medium</comment>
     </message>
     <message>
         <source>Welcome to the New Virtual Machine Wizard!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​អ្នក​ជំនួយការ​ម៉ាស៊ីន​និម្មិត​ថ្មី !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​អ្នក​ជំនួយការ​ម៉ាស៊ីន​និម្មិត​ថ្មី !</translation>
     </message>
     <message>
         <source>N&ame</source>
@@ -7564,7 +8192,7 @@ medium</comment>
     </message>
     <message>
         <source><p>Select the amount of base memory (RAM) in megabytes to be allocated to the virtual machine.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​ចំនួន​សតិ (RAM) ​មូលដ្ឋាន​គិត​ជាមេកាបៃ ដែល​​ត្រូវ​បម្រុង​ទុក​សម្រាប់​ម៉ាស៊ីន​និម្មិត ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​ចំនួន​សតិ (RAM) ​មូលដ្ឋាន​គិត​ជាមេកាបៃ ដែល​​ត្រូវ​បម្រុង​ទុក​សម្រាប់​ម៉ាស៊ីន​និម្មិត ។</p></translation>
     </message>
     <message>
         <source>Base &Memory Size</source>
@@ -7588,15 +8216,15 @@ medium</comment>
     </message>
     <message>
         <source>The recommended base memory size is <b>%1</b> MB.</source>
-        <translation type="obsolete">ទំហំ​សតិ​មូលដ្ឋាន​ដែលបានផ្ដល់​អនុសាសន៍​គឺ <b>%1</b> មេកាបៃ ។</translation>
+        <translation type="obsolete">ទំហំ​សតិ​មូលដ្ឋាន​ដែលបានផ្ដល់​អនុសាសន៍​គឺ <b>%1</b> មេកាបៃ ។</translation>
     </message>
     <message>
         <source>The recommended size of the start-up disk is <b>%1</b> MB.</source>
-        <translation type="obsolete">ទំហំ​ដែល​បានផ្ដល់​អនុសាសន៍​របស់​ថាសរឹង​ចាប់ផ្ដើម​គឺ <b>%1</b> មេកាបៃ ។</translation>
+        <translation type="obsolete">ទំហំ​ដែល​បានផ្ដល់​អនុសាសន៍​របស់​ថាសរឹង​ចាប់ផ្ដើម​គឺ <b>%1</b> មេកាបៃ ។</translation>
     </message>
     <message>
         <source><p>This wizard will guide you through the steps that are necessary to create a new virtual machine for VirtualBox.</p><p>Use the <b>Next</b> button to go the next page of the wizard and the <b>Back</b> button to return to the previous page.</p></source>
-        <translation type="obsolete"><p>អ្នក​ជំនួយ​កា​រនេះ​នឹង​នាំអ្នក​តាម​ជំហាន​ដែល​ចាំបាច់​ដើម្បីបង្កើត​ម៉ាស៊ីន​និម្មិ​តថ្មី​សម្រាប់ VirtualBox ។</p><p>ប្រើ​ប៊ូតុង <b>បន្ទាប់</b> ដើម្បី​ទៅកាន់​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយការ ហើយ​ប៊ូតុង <b>ថយក្រោយ</b> ដើម្បី​ត្រឡប់​ទៅ​ទំព័រ​មុន ។</p></translation>
+        <translation type="obsolete"><p>អ្នក​ជំនួយ​កា​រនេះ​នឹង​នាំអ្នក​តាម​ជំហាន​ដែល​ចាំបាច់​ដើម្បីបង្កើត​ម៉ាស៊ីន​និម្មិ​តថ្មី​សម្រាប់ VirtualBox ។</p><p>ប្រើ​ប៊ូតុង <b>បន្ទាប់</b> ដើម្បី​ទៅកាន់​ទំព័រ​បន្ទាប់​របស់​អ្នក​ជំនួយការ ហើយ​ប៊ូតុង <b>ថយក្រោយ</b> ដើម្បី​ត្រឡប់​ទៅ​ទំព័រ​មុន ។</p></translation>
     </message>
     <message>
         <source>< &Back</source>
@@ -7608,15 +8236,15 @@ medium</comment>
     </message>
     <message>
         <source><p>Enter a name for the new virtual machine and select the type of the guest operating system you plan to install onto the virtual machine.</p><p>The name of the virtual machine usually indicates its software and hardware configuration. It will be used by all VirtualBox components to identify your virtual machine.</p></source>
-        <translation type="obsolete"><p>បញ្ចូល​ឈ្មោះ​ឲ្យ​ម៉ាស៊ីន​និម្មតិ​ថ្មី ហើយ​ជ្រើស​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ ដែល​អ្នក​ចង់​ដំឡើង​ក្នុង​ម៉ាស៊ីន​និម្មិត ។ </p><p>ឈ្មោះ​របស់​ម៉ាស៊ីន​និម្មិត​តាមធម្មតា​បង្ហាញ​ការ​កំណត់​រចនាសម្ព័ន្ធ​ផ្នែក​រឹង និង​ផ្នែក​ទន់​របស់​វា ។ វា​នឹង​ត្រូវ​បាន​ប្រើ​ដោយ​សមាសធាតុ​ VirtualBox ដើម្បី​បញ្ជាក់​អត្តសញ្ញាណ​ម៉ាស៊ីន​និម្មិត​របស់​អ្នក ។</p></translation>
+        <translation type="obsolete"><p>បញ្ចូល​ឈ្មោះ​ឲ្យ​ម៉ាស៊ីន​និម្មតិ​ថ្មី ហើយ​ជ្រើស​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ ដែល​អ្នក​ចង់​ដំឡើង​ក្នុង​ម៉ាស៊ីន​និម្មិត ។ </p><p>ឈ្មោះ​របស់​ម៉ាស៊ីន​និម្មិត​តាមធម្មតា​បង្ហាញ​ការ​កំណត់​រចនាសម្ព័ន្ធ​ផ្នែក​រឹង និង​ផ្នែក​ទន់​របស់​វា ។ វា​នឹង​ត្រូវ​បាន​ប្រើ​ដោយ​សមាសធាតុ​ VirtualBox ដើម្បី​បញ្ជាក់​អត្តសញ្ញាណ​ម៉ាស៊ីន​និម្មិត​របស់​អ្នក ។</p></translation>
     </message>
     <message>
         <source><p>You are going to create a new virtual machine with the following parameters:</p></source>
-        <translation type="obsolete"><p>អ្នករៀបនឹង​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី​ដែល​មាន​ប៉ារ៉ាម៉ែត្រ​ដូច​ខាងក្រោម ៖</p></translation>
+        <translation type="obsolete"><p>អ្នករៀបនឹង​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី​ដែល​មាន​ប៉ារ៉ាម៉ែត្រ​ដូច​ខាងក្រោម ៖</p></translation>
     </message>
     <message>
         <source><p>If the above is correct press the <b>Finish</b> button. Once you press it, a new virtual machine will be created. </p><p>Note that you can alter these and all other setting of the created virtual machine at any time using the <b>Settings</b> dialog accessible through the menu of the main window.</p></source>
-        <translation type="obsolete"><p>ប្រសិនបើ​ខា​ងលើ​ត្រឹមត្រូវ​​ហើយ ចុច​ប៊ូតុង <b>បញ្ចប់</b> ។ នៅពេល​អ្នក​ចុច​វា ម៉ាស៊ីន​និម្មិត​ថ្មី​នឹង​ត្រូវ​បាន​បង្កើត​ឡើង ។ </p><p>ចំណាំ​ថា អ្នក​អាច​ត្រង​ការ​កំណត់​ទាំង​នេះ និង​ការ​កំណត់​ផ្សេងៗ​របស់​ម៉ាស៊ីន​និម្មិត​ដែល​បានបង្កើត​​នៅពេល​ដែល​ប្រើ​ប្រអប់ <b>ការ​កំណត់</b> ដែល​អាច​ចូល​ដំណើរ​ការ​បាន​តាមរយៈ​ម៉ឺនុយ​របស់​បង្អួច​មេ ។</p></translation>
+        <translation type="obsolete"><p>ប្រសិនបើ​ខា​ងលើ​ត្រឹមត្រូវ​​ហើយ ចុច​ប៊ូតុង <b>បញ្ចប់</b> ។ នៅពេល​អ្នក​ចុច​វា ម៉ាស៊ីន​និម្មិត​ថ្មី​នឹង​ត្រូវ​បាន​បង្កើត​ឡើង ។ </p><p>ចំណាំ​ថា អ្នក​អាច​ត្រង​ការ​កំណត់​ទាំង​នេះ និង​ការ​កំណត់​ផ្សេងៗ​របស់​ម៉ាស៊ីន​និម្មិត​ដែល​បានបង្កើត​​នៅពេល​ដែល​ប្រើ​ប្រអប់ <b>ការ​កំណត់</b> ដែល​អាច​ចូល​ដំណើរ​ការ​បាន​តាមរយៈ​ម៉ឺនុយ​របស់​បង្អួច​មេ ។</p></translation>
     </message>
     <message>
         <source>&Finish</source>
@@ -7653,7 +8281,7 @@ medium</comment>
     </message>
     <message>
         <source><p>Select a hard disk image to be used as the boot hard disk of the virtual machine. You can either create a new hard disk using the <b>New</b> button or select an existing hard disk image from the drop-down list or by pressing the <b>Existing</b> button (to invoke the Virtual Media Manager window).</p><p>If you need a more complex virtual disk setup you can skip this step and make the changes to the machine settings once the mach [...]
-        <translation type="obsolete"><p>ជ្រើស​រូបភាព​ថាសរឹង​ត្រូវ​ប្រើ​ជា​ថាស​រឹង​ចាប់ផ្ដើម​របស់ម៉ាស៊ីន​និម្មិត ។ អ្នកអាច​បង្កើត​ថាសរឹង​ថ្មី​ដោយ​ប្រើ​ប៊ូតុង <b>ថ្មី</b> ឬ​ជ្រើស​រូបភាព​ថាសរឹង​ដែលមាន​ស្រាប់​ពី​បញ្ជី​ទម្លាក់ចុះ ឬ​ដោយ​ចុច​ប៊ូតុង <b>មាន​ស្រាប់</b> (ដើម្បីដកហូត​ប្រអប់​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត) ។</p><p>ប្រសិនបើ​អ្នក​ត្រូវការ​រៀបចំ​ថាសរឹង​ដែល​ស្មុគស្មាញ អ្នក​ក៏​អាច​រំលង​ជំហាន​នេះ ហើយ​ភ្ជាប់​ថាសរឹង​ពេលក្រោយ​ដោយ​ប្រើ​ប្រអប់​កំណត់របស [...]
+        <translation type="obsolete"><p>ជ្រើស​រូបភាព​ថាសរឹង​ត្រូវ​ប្រើ​ជា​ថាស​រឹង​ចាប់ផ្ដើម​របស់ម៉ាស៊ីន​និម្មិត ។ អ្នកអាច​បង្កើត​ថាសរឹង​ថ្មី​ដោយ​ប្រើ​ប៊ូតុង <b>ថ្មី</b> ឬ​ជ្រើស​រូបភាព​ថាសរឹង​ដែលមាន​ស្រាប់​ពី​បញ្ជី​ទម្លាក់ចុះ ឬ​ដោយ​ចុច​ប៊ូតុង <b>មាន​ស្រាប់</b> (ដើម្បីដកហូត​ប្រអប់​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត) ។</p><p>ប្រសិនបើ​អ្នក​ត្រូវការ​រៀបចំ​ថាសរឹង​ដែល​ស្មុគស្មាញ អ្នក​ក៏​អាច​រំលង​ជំហាន​នេះ ហើយ​ភ្ជាប់​ថាសរឹង​ពេលក្រោយ​ដោយ​ប្រើ​ប្រអប់​កំណត់របស [...]
     </message>
     <message>
         <source>Start-up &Disk (Primary Master)</source>
@@ -7672,14 +8300,14 @@ medium</comment>
     <name>UINewVMWzdPage1</name>
     <message>
         <source>Welcome to the New Virtual Machine Wizard!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​អ្នក​ជំនួយការ​ម៉ាស៊ីន​និម្មិត​ថ្មី !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​អ្នក​ជំនួយការ​ម៉ាស៊ីន​និម្មិត​ថ្មី !</translation>
     </message>
 </context>
 <context>
     <name>UINewVMWzdPage2</name>
     <message>
         <source><p>Enter a name for the new virtual machine and select the type of the guest operating system you plan to install onto the virtual machine.</p><p>The name of the virtual machine usually indicates its software and hardware configuration. It will be used by all VirtualBox components to identify your virtual machine.</p></source>
-        <translation type="obsolete"><p>បញ្ចូល​ឈ្មោះ​ឲ្យ​ម៉ាស៊ីន​និម្មតិ​ថ្មី ហើយ​ជ្រើស​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ ដែល​អ្នក​ចង់​ដំឡើង​ក្នុង​ម៉ាស៊ីន​និម្មិត ។ </p><p>ឈ្មោះ​របស់​ម៉ាស៊ីន​និម្មិត​តាមធម្មតា​បង្ហាញ​ការ​កំណត់​រចនាសម្ព័ន្ធ​ផ្នែក​រឹង និង​ផ្នែក​ទន់​របស់​វា ។ វា​នឹង​ត្រូវ​បាន​ប្រើ​ដោយ​សមាសធាតុ​ VirtualBox ដើម្បី​បញ្ជាក់​អត្តសញ្ញាណ​ម៉ាស៊ីន​និម្មិត​របស់​អ្នក ។</p></translation>
+        <translation type="obsolete"><p>បញ្ចូល​ឈ្មោះ​ឲ្យ​ម៉ាស៊ីន​និម្មតិ​ថ្មី ហើយ​ជ្រើស​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ ដែល​អ្នក​ចង់​ដំឡើង​ក្នុង​ម៉ាស៊ីន​និម្មិត ។ </p><p>ឈ្មោះ​របស់​ម៉ាស៊ីន​និម្មិត​តាមធម្មតា​បង្ហាញ​ការ​កំណត់​រចនាសម្ព័ន្ធ​ផ្នែក​រឹង និង​ផ្នែក​ទន់​របស់​វា ។ វា​នឹង​ត្រូវ​បាន​ប្រើ​ដោយ​សមាសធាតុ​ VirtualBox ដើម្បី​បញ្ជាក់​អត្តសញ្ញាណ​ម៉ាស៊ីន​និម្មិត​របស់​អ្នក ។</p></translation>
     </message>
     <message>
         <source>N&ame</source>
@@ -7698,7 +8326,7 @@ medium</comment>
     <name>UINewVMWzdPage3</name>
     <message>
         <source><p>Select the amount of base memory (RAM) in megabytes to be allocated to the virtual machine.</p></source>
-        <translation type="obsolete"><p>ជ្រើស​ចំនួន​សតិ (RAM) ​មូលដ្ឋាន​គិត​ជាមេកាបៃ ដែល​​ត្រូវ​បម្រុង​ទុក​សម្រាប់​ម៉ាស៊ីន​និម្មិត ។</p></translation>
+        <translation type="obsolete"><p>ជ្រើស​ចំនួន​សតិ (RAM) ​មូលដ្ឋាន​គិត​ជាមេកាបៃ ដែល​​ត្រូវ​បម្រុង​ទុក​សម្រាប់​ម៉ាស៊ីន​និម្មិត ។</p></translation>
     </message>
     <message>
         <source>Base &Memory Size</source>
@@ -7714,7 +8342,7 @@ medium</comment>
     </message>
     <message>
         <source>The recommended base memory size is <b>%1</b> MB.</source>
-        <translation type="obsolete">ទំហំ​សតិ​មូលដ្ឋាន​ដែលបានផ្ដល់​អនុសាសន៍​គឺ <b>%1</b> មេកាបៃ ។</translation>
+        <translation type="obsolete">ទំហំ​សតិ​មូលដ្ឋាន​ដែលបានផ្ដល់​អនុសាសន៍​គឺ <b>%1</b> មេកាបៃ ។</translation>
     </message>
     <message>
         <source>MB</source>
@@ -7726,7 +8354,7 @@ medium</comment>
     <name>UINewVMWzdPage4</name>
     <message>
         <source><p>Select a hard disk image to be used as the boot hard disk of the virtual machine. You can either create a new hard disk using the <b>New</b> button or select an existing hard disk image from the drop-down list or by pressing the <b>Existing</b> button (to invoke the Virtual Media Manager window).</p><p>If you need a more complex virtual disk setup you can skip this step and make the changes to the machine settings once the mach [...]
-        <translation type="obsolete"><p>ជ្រើស​រូបភាព​ថាសរឹង​ត្រូវ​ប្រើ​ជា​ថាស​រឹង​ចាប់ផ្ដើម​របស់ម៉ាស៊ីន​និម្មិត ។ អ្នកអាច​បង្កើត​ថាសរឹង​ថ្មី​ដោយ​ប្រើ​ប៊ូតុង <b>ថ្មី</b> ឬ​ជ្រើស​រូបភាព​ថាសរឹង​ដែលមាន​ស្រាប់​ពី​បញ្ជី​ទម្លាក់ចុះ ឬ​ដោយ​ចុច​ប៊ូតុង <b>មាន​ស្រាប់</b> (ដើម្បីដកហូត​ប្រអប់​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត) ។</p><p>ប្រសិនបើ​អ្នក​ត្រូវការ​រៀបចំ​ថាសរឹង​ដែល​ស្មុគស្មាញ អ្នក​ក៏​អាច​រំលង​ជំហាន​នេះ ហើយ​ភ្ជាប់​ថាសរឹង​ពេលក្រោយ​ដោយ​ប្រើ​ប្រអប់​កំណត់របស [...]
+        <translation type="obsolete"><p>ជ្រើស​រូបភាព​ថាសរឹង​ត្រូវ​ប្រើ​ជា​ថាស​រឹង​ចាប់ផ្ដើម​របស់ម៉ាស៊ីន​និម្មិត ។ អ្នកអាច​បង្កើត​ថាសរឹង​ថ្មី​ដោយ​ប្រើ​ប៊ូតុង <b>ថ្មី</b> ឬ​ជ្រើស​រូបភាព​ថាសរឹង​ដែលមាន​ស្រាប់​ពី​បញ្ជី​ទម្លាក់ចុះ ឬ​ដោយ​ចុច​ប៊ូតុង <b>មាន​ស្រាប់</b> (ដើម្បីដកហូត​ប្រអប់​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត) ។</p><p>ប្រសិនបើ​អ្នក​ត្រូវការ​រៀបចំ​ថាសរឹង​ដែល​ស្មុគស្មាញ អ្នក​ក៏​អាច​រំលង​ជំហាន​នេះ ហើយ​ភ្ជាប់​ថាសរឹង​ពេលក្រោយ​ដោយ​ប្រើ​ប្រអប់​កំណត់របស [...]
     </message>
     <message>
         <source>Start-up &Disk (Primary Master)</source>
@@ -7746,14 +8374,14 @@ medium</comment>
     </message>
     <message>
         <source>The recommended size of the start-up disk is <b>%1</b> MB.</source>
-        <translation type="obsolete">ទំហំ​ដែល​បានផ្ដល់​អនុសាសន៍​របស់​ថាសរឹង​ចាប់ផ្ដើម​គឺ <b>%1</b> មេកាបៃ ។</translation>
+        <translation type="obsolete">ទំហំ​ដែល​បានផ្ដល់​អនុសាសន៍​របស់​ថាសរឹង​ចាប់ផ្ដើម​គឺ <b>%1</b> មេកាបៃ ។</translation>
     </message>
 </context>
 <context>
     <name>UINewVMWzdPage5</name>
     <message>
         <source><p>You are going to create a new virtual machine with the following parameters:</p></source>
-        <translation type="obsolete"><p>អ្នករៀបនឹង​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី​ដែល​មាន​ប៉ារ៉ាម៉ែត្រ​ដូច​ខាងក្រោម ៖</p></translation>
+        <translation type="obsolete"><p>អ្នករៀបនឹង​បង្កើត​ម៉ាស៊ីន​និម្មិត​ថ្មី​ដែល​មាន​ប៉ារ៉ាម៉ែត្រ​ដូច​ខាងក្រោម ៖</p></translation>
     </message>
     <message>
         <source>Name</source>
@@ -7878,14 +8506,18 @@ You may wish to translate this more like "Time remaining: %1"</comment
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="unfinished"><h3>សូមស្វាគមន៍​​មក​កាន់ VirtualBox !</h3><p>ផ្នែកដែល​នៅ​សល់​របស់​បង្អួច​នេះ គឺជា​បញ្ជី​ម៉ាស៊ីន​និម្មិត​នៅ​ក្នុង​កុំព្យូទ័រ​របស់​អ្នក ។ បញ្ជី​ទទេ​ឥឡូវ​នេះ ពីព្រោះ​អ្នកមិនបានបង្កើត​ម៉ាស៊ីននិម្មិត​នៅ​ឡើយ​ទេ ។<img src=:/welcome.png align=right/></p><p>ដើម្បី​បង្កើត​ម៉ាស៊ីន​និម្មិត ចុច​ប៊ូតុង <b>ថ្មី</b> ក្នុង​របារ​ឧបករណ៍​ដែល​មាននៅ​​ផ្នែក​ខាង​លើ​នៃ​បង្អួច ។</p><p>អ្នក​អាច​ចុច​គ្រាប់ចុច <b&gt [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>សូមស្វាគមន៍​​មក​កាន់ VirtualBox !</h3><p>ផ្នែកដែល​នៅ​សល់​របស់​បង្អួច​នេះ គឺជា​បញ្ជី​ម៉ាស៊ីន​និម្មិត​នៅ​ក្នុង​កុំព្យូទ័រ​របស់​អ្នក ។ បញ្ជី​ទទេ​ឥឡូវ​នេះ ពីព្រោះ​អ្នកមិនបានបង្កើត​ម៉ាស៊ីននិម្មិត​នៅ​ឡើយ​ទេ ។<img src=:/welcome.png align=right/></p><p>ដើម្បី​បង្កើត​ម៉ាស៊ីន​និម្មិត ចុច​ប៊ូតុង <b>ថ្មី</b> ក្នុង​របារ​ឧបករណ៍​ដែល​មាននៅ​​ផ្នែក​ខាង​លើ​នៃ​បង្អួច ។</p><p>អ្នក​អាច​ចុច​គ្រាប់ចុច <b>% [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -7914,7 +8546,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>Settings</source>
-        <translation type="unfinished">កំណត់</translation>
+        <translation type="obsolete">កំណត់</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -7967,6 +8599,10 @@ You may wish to translate this more like "Time remaining: %1"</comment
         <source>Display</source>
         <translation type="unfinished">បង្ហាញ​</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8026,6 +8662,43 @@ You may wish to translate this more like "Time remaining: %1"</comment
         <source>you have 2D Video Acceleration enabled. As 2D Video Acceleration is supported for Windows guests only, this feature will be disabled.</source>
         <translation type="obsolete">អ្នកបាន​បើក​បង្កើនល្បឿន​​វី​ដេអូ​​ទ្វេ​​មាត្រ​ ។ បង្កើនល្បឿន​វីដេអូ​​ទ្វេ​មាត្រ​​ត្រូវ​បាន​គាំ​ទ្រ​សម្រាប់​​​ម៉ាស៊ីន​វីនដូ​តែ​ប៉ុ​ណ្ណោះ​ លក្ខណៈ​ពិសេសនេះ​​នឹង​​មិន​ត្រូវ​បាន​អនុញ្ញាត​ ។​</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">កំណត់</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">បិទ</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -8039,7 +8712,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>Replaces the current text with the content of a file.</source>
-        <translation>ជំនួស​អត្ថបទ​បច្ចុប្បន្ន​ដោយ​មាតិកា​របស់​ឯកសារ​មួយ ។</translation>
+        <translation>ជំនួស​អត្ថបទ​បច្ចុប្បន្ន​ដោយ​មាតិកា​របស់​ឯកសារ​មួយ ។</translation>
     </message>
     <message>
         <source>Text (*.txt);;All (*.*)</source>
@@ -8121,20 +8794,20 @@ You may wish to translate this more like "Time remaining: %1"</comment
         <translation type="obsolete">សេចក្ដី​សង្ខេប</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>កំណែ​ថ្មី​របស់ VirtualBox ត្រូ​វបាន​ចេញ​ផ្សាយ​ហើយ ! គឺ​កំណែ <b>%1</b> ដែល​អាច​រក​បាននៅ <a href="https://www.virtualbox.org/">virtualbox.org</a>។</p><p>អ្នកអាច​ទាញ​យក​កំណែ​នេះ​​ដោយ​ផ្ទាល់ពី​តំណ ៖</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>កំណែ​ថ្មី​របស់ VirtualBox ត្រូ​វបាន​ចេញ​ផ្សាយ​ហើយ ! គឺ​កំណែ <b>%1</b> ដែល​អាច​រក​បាននៅ <a href="http://www.virtualbox.org/">virtualbox.org</a>។</p><p>អ្នកអាច​ទាញ​យក​កំណែ​នេះ​​ដោយ​ផ្ទាល់ពី​តំណ ៖</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>មិនអាច​យក​ព័ត៌មានកំណែ​ថ្មី​បានទេ ដោយសារ​តែ​កំហុស​បណ្ដាញ​ដូច​ខាងក្រោម ៖</p><p><b>%1</b></p></translation>
+        <translation type="obsolete"><p>មិនអាច​យក​ព័ត៌មានកំណែ​ថ្មី​បានទេ ដោយសារ​តែ​កំហុស​បណ្ដាញ​ដូច​ខាងក្រោម ៖</p><p><b>%1</b></p></translation>
     </message>
     <message>
         <source>You are already running the most recent version of VirtualBox.</source>
-        <translation type="obsolete">អ្នក​បាន​ដំឡើង​កំណែ​របស់ VirtualBox ចុងក្រោយ​រួច​ហើយ ។ សូម​ធ្វើ​ការ​ពិនិត្យ​ពេលក្រោយ​ម្ដង​ទៀត ។</translation>
+        <translation type="obsolete">អ្នក​បាន​ដំឡើង​កំណែ​របស់ VirtualBox ចុងក្រោយ​រួច​ហើយ ។ សូម​ធ្វើ​ការ​ពិនិត្យ​ពេលក្រោយ​ម្ដង​ទៀត ។</translation>
     </message>
     <message>
         <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>អ្នក​ជំនួយ​ការ​នេះ​នឹង​តភ្ជាប់​ទៅ​កាន់​តំបន់​បណ្ដាញ​របស់ VirtualBox ហើយ​ពិនិត្យ​មើល​ប្រសិនបើ​មានកំណែ​ថ្មី​របស់​ VirtualBox ។</p><p>ប្រើ​ប៊ូតុង <b>ពិនិត្យ​មើល</b> ដើម្បី​ពិនិត្យ​មើល​កំណែ​ថ្មី​ឥឡូវ ឬ​ប៊ូតុង <b>បោះបង់</b> ប្រសិនបើ​អ្នក​មិន​ចង់​អនុវត្ត​ការ​ត្រួតពិនិត្យ​នេះ​ទេ ។</p><p>អ្នក​អាច​រត់​អ្នក​ជំនួយការ​នេះ​នៅពេល​ណាមួយ ដោយ​​ជ្រើស <b>ពិនិត្យ​រកមើល​ភាព​ទាន់សម័យ...</b> ពី​ម៉ឺនុយ < [...]
+        <translation type="obsolete"><p>អ្នក​ជំនួយ​ការ​នេះ​នឹង​តភ្ជាប់​ទៅ​កាន់​តំបន់​បណ្ដាញ​របស់ VirtualBox ហើយ​ពិនិត្យ​មើល​ប្រសិនបើ​មានកំណែ​ថ្មី​របស់​ VirtualBox ។</p><p>ប្រើ​ប៊ូតុង <b>ពិនិត្យ​មើល</b> ដើម្បី​ពិនិត្យ​មើល​កំណែ​ថ្មី​ឥឡូវ ឬ​ប៊ូតុង <b>បោះបង់</b> ប្រសិនបើ​អ្នក​មិន​ចង់​អនុវត្ត​ការ​ត្រួតពិនិត្យ​នេះ​ទេ ។</p><p>អ្នក​អាច​រត់​អ្នក​ជំនួយការ​នេះ​នៅពេល​ណាមួយ ដោយ​​ជ្រើស <b>ពិនិត្យ​រកមើល​ភាព​ទាន់សម័យ...</b> ពី​ម៉ឺនុយ < [...]
     </message>
 </context>
 <context>
@@ -8152,11 +8825,11 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>You want to:</source>
-        <translation type="unfinished">អ្នក​ចង់ ៖</translation>
+        <translation type="unfinished">អ្នក​ចង់ ៖</translation>
     </message>
     <message>
         <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation type="unfinished"><p>រក្សាទុក​ស្ថានភាព​ប្រតិបត្តិ​បច្ចុប្បន្ន​របស់​ម៉ាស៊ីន​និម្មិត ទៅ​ថាសរឹង​ហ្វីស៊ីខល​របស់​ម៉ាស៊ីន ។</p><p>ពេល​​ចាប់ផ្ដើម​ម៉ាស៊ីន​នេះ​លើកក្រោយ វា​នឹង​ត្រូ​វបាន​ស្ដារ​ពី​ស្ថានភាព​ដែល​បាន​រក្សាទុក និង​បន្ត​ប្រតិបត្តិការ​ពី​កន្លែង​ដដែល​ដែល​អ្នក​បាន​រក្សាទុក​វា ដែល​នឹង​អនុញ្ញាត​ឲ្យ​អ្នក​បន្ត​ការងារ​របស់​អ្នក​បាន​ភ្លាមៗ ។</p><p>ចំណាំ​ថា ការ​រក្សាទុក​ស្ថានភាព​របស់​ម៉ាស៊ីន​អាច​ចំណាយ​ពេល​យូ ដោយអាស្រ័យ​លើ​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្ [...]
+        <translation type="unfinished"><p>រក្សាទុក​ស្ថានភាព​ប្រតិបត្តិ​បច្ចុប្បន្ន​របស់​ម៉ាស៊ីន​និម្មិត ទៅ​ថាសរឹង​ហ្វីស៊ីខល​របស់​ម៉ាស៊ីន ។</p><p>ពេល​​ចាប់ផ្ដើម​ម៉ាស៊ីន​នេះ​លើកក្រោយ វា​នឹង​ត្រូ​វបាន​ស្ដារ​ពី​ស្ថានភាព​ដែល​បាន​រក្សាទុក និង​បន្ត​ប្រតិបត្តិការ​ពី​កន្លែង​ដដែល​ដែល​អ្នក​បាន​រក្សាទុក​វា ដែល​នឹង​អនុញ្ញាត​ឲ្យ​អ្នក​បន្ត​ការងារ​របស់​អ្នក​បាន​ភ្លាមៗ ។</p><p>ចំណាំ​ថា ការ​រក្សាទុក​ស្ថានភាព​របស់​ម៉ាស៊ីន​អាច​ចំណាយ​ពេល​យូ ដោយអាស្រ័យ​លើ​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្ [...]
     </message>
     <message>
         <source>&Save the machine state</source>
@@ -8164,7 +8837,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation type="unfinished"><p>ផ្ញើ​ព្រឹត្តិការ​ចុច​ប៊ូតុង​ថាមពល ACPI ទៅកាន់​ម៉ាស៊ីន​និម្មិត ។</p><p>ជា​ធម្មតា ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​រត់​ខាង​ក្នុង​ម៉ាស៊ីន​និម្មិត នឹង​រកឃើញ​ព្រឹត្តិការ​នេះ ហើយ​អនុវត្ត​នីតិវិធី​បិទ​ការ​ជម្រះ ។ នេះ​ជា​មធ្យោបាយ​ដែល​បានផ្ដល់​អនុសាសន៍ ឲ្យ​បិទ​ម៉ាស៊ីន​និម្មិត ពីព្រោះ​កម្មវិធី​ទាំង​អស់​ដែល​កំពុង​រត់​ខាង​ក្នុង​នឹង​មាន​ឱកាស​រក្សាទុក​ស្ថានភាព និង​ទិន្នន័យ​របស់​វា ។</p><p>ប្រសិន​បើ​ម៉ាស៊ីន​មិន​ឆ្លើយតប​នឹង​សកម្ [...]
+        <translation type="unfinished"><p>ផ្ញើ​ព្រឹត្តិការ​ចុច​ប៊ូតុង​ថាមពល ACPI ទៅកាន់​ម៉ាស៊ីន​និម្មិត ។</p><p>ជា​ធម្មតា ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​រត់​ខាង​ក្នុង​ម៉ាស៊ីន​និម្មិត នឹង​រកឃើញ​ព្រឹត្តិការ​នេះ ហើយ​អនុវត្ត​នីតិវិធី​បិទ​ការ​ជម្រះ ។ នេះ​ជា​មធ្យោបាយ​ដែល​បានផ្ដល់​អនុសាសន៍ ឲ្យ​បិទ​ម៉ាស៊ីន​និម្មិត ពីព្រោះ​កម្មវិធី​ទាំង​អស់​ដែល​កំពុង​រត់​ខាង​ក្នុង​នឹង​មាន​ឱកាស​រក្សាទុក​ស្ថានភាព និង​ទិន្នន័យ​របស់​វា ។</p><p>ប្រសិន​បើ​ម៉ាស៊ីន​មិន​ឆ្លើយតប​នឹង​សកម្ [...]
     </message>
     <message>
         <source>S&end the shutdown signal</source>
@@ -8172,7 +8845,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation type="unfinished"><p>បិទ​ម៉ាស៊ីន​និម្មិត ។</p><p>ចំណាំ​ថា សកម្មភាព​នេះ​នឹង​បញ្ឈប់​កា​រប្រតិបត្តិ​របស់ម៉ាស៊ីន​ភ្លាមៗ​តែ​ម្ដង ដូច្នេះ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​ភ្ញៀវ​កំពុង​រត់​ខាង​​ក្នុង​វា​នឹង​មិនអាច​អនុវត្ត​នីតិវិធី​បិទ​ការ​ជម្រះ​ដែល​អាច​បណ្ដាល​ឲ្យ <i>បាត់បង់​ទិន្នន័យ</i> ខាង​ក្នុង​ម៉ាស៊ីន​និម្មិត​បានទេ ។ កា​រជ្រើស​សកម្ម​ភាព​នេះ​ត្រូវ​បានផ្ដល់​អនុសាសន៍​តែ​ក្នុងករណី​ដែល​ម៉ាស៊ីន​និមន្មិត​មិន​ឆ្លើយតប​នឹង​សកម្មភាព <b>ផ្ញើ​សញ្ញ [...]
+        <translation type="unfinished"><p>បិទ​ម៉ាស៊ីន​និម្មិត ។</p><p>ចំណាំ​ថា សកម្មភាព​នេះ​នឹង​បញ្ឈប់​កា​រប្រតិបត្តិ​របស់ម៉ាស៊ីន​ភ្លាមៗ​តែ​ម្ដង ដូច្នេះ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​ភ្ញៀវ​កំពុង​រត់​ខាង​​ក្នុង​វា​នឹង​មិនអាច​អនុវត្ត​នីតិវិធី​បិទ​ការ​ជម្រះ​ដែល​អាច​បណ្ដាល​ឲ្យ <i>បាត់បង់​ទិន្នន័យ</i> ខាង​ក្នុង​ម៉ាស៊ីន​និម្មិត​បានទេ ។ កា​រជ្រើស​សកម្ម​ភាព​នេះ​ត្រូវ​បានផ្ដល់​អនុសាសន៍​តែ​ក្នុងករណី​ដែល​ម៉ាស៊ីន​និមន្មិត​មិន​ឆ្លើយតប​នឹង​សកម្មភាព <b>ផ្ញើ​សញ្ញ [...]
     </message>
     <message>
         <source>&Power off the machine</source>
@@ -8184,12 +8857,20 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation type="unfinished"><p>នៅពេល​គូស​ធីក ស្ថានភាព​ម៉ាស៊ីន​នឹង​ត្រូវ​បាន​ស្ដារ​ពី​ស្ថានភាព​ដែល​បាន​ទុក​នៅ​ក្នុង​រូបថត​បច្ចុប្បន្ន​ខាង​ស្ដាំ​បន្ទាប់​ពី​​បិទ ។ វា​មាន​ប្រយោជន៍​ប្រសិន​បើ​​អ្នក​ប្រាកដ​ថា អ្នក​ចង់​បោះបង់​លទ្ធផល​នៃ​សម័យ​ចុងក្រោយ​របស់​អ្នក ហើយ​ត្រឡប់​ទៅ​រូបថត​បច្ចុប្បន្ន ។</p></translation>
+        <translation type="unfinished"><p>នៅពេល​គូស​ធីក ស្ថានភាព​ម៉ាស៊ីន​នឹង​ត្រូវ​បាន​ស្ដារ​ពី​ស្ថានភាព​ដែល​បាន​ទុក​នៅ​ក្នុង​រូបថត​បច្ចុប្បន្ន​ខាង​ស្ដាំ​បន្ទាប់​ពី​​បិទ ។ វា​មាន​ប្រយោជន៍​ប្រសិន​បើ​​អ្នក​ប្រាកដ​ថា អ្នក​ចង់​បោះបង់​លទ្ធផល​នៃ​សម័យ​ចុងក្រោយ​របស់​អ្នក ហើយ​ត្រឡប់​ទៅ​រូបថត​បច្ចុប្បន្ន ។</p></translation>
     </message>
     <message>
         <source>&Restore current snapshot '%1'</source>
         <translation type="unfinished">ស្តារ​រូប​ថត​បច្ចុប្បន្ន​ '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -8203,15 +8884,157 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>មិនអាច​ចូលដំណើរការ​បាន</translation>
+        <source>%1 - Session Information</source>
+        <translation>%1 - ព័ត៌មាន​សម័យ</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 តាំងពី %3</nobr><br><nobr>សម័យ %4</nobr></translation>
+        <source>&Details</source>
+        <translation type="obsolete">សេចក្ដី​លម្អិត</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">ពេលវេលា​រត់</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>ការ​ផ្ទេរ DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>ការ​ផ្ទេរ PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>អាន​ទិន្នន័យ</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>សរសេរ​ទិន្នន័យ</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>បានផ្ទេរ​ទិន្នន័យ</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>បាន​ទទួល​ទិន្នន័យ</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>គុណលក្ខណៈ​ពេលវេលា​រត់</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>គុណភាព​បង្ហាញ​របស់​អេក្រង់</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">កំណែ %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>រក​មិនឃើញ</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>រក​មិន​ឃើញ</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>ការ​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>គ្មានអាដាប់ទ័រ​បណ្ដាញ​ទេ</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">បានបើក</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">បានបិទ</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">ភេយីង​ខាង​ក្នុង</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>
+
+
+details report (VRDP server port)</comment>
+        <translation type="obsolete">មិនអាច​ប្រើបាន​</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>ស្ថិតិ​ផ្ទុក​</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>គ្មាន​ឧបករណ៍​ផ្ទុក​ទេ​</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>ស្ថិតិ​បណ្ដាញ</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">មិនអាច​ប្រើបាន​</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation type="unfinished">មិនអាច​ប្រើបាន​</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>មិនអាច​ចូលដំណើរការ​បាន</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation><nobr>%1<br></nobr><nobr>%2 តាំងពី %3</nobr><br><nobr>សម័យ %4</nobr></translation>
     </message>
     <message>
         <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
@@ -8295,7 +9118,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
-        <translation type="unfinished"><p>រក​មិនឃើញ​កំណត់ហេតុទេ ។ ចុច​ប៊ូតុង <b>ធ្វើ​ឲ្យ​ស្រស់</b> ដើម្បី​វិភាគ​ថត​កំណត់ហេតុ​ម្ដង​ទៀត <nobr><b>%1</b></nobr> ។</p></translation>
+        <translation type="unfinished"><p>រក​មិនឃើញ​កំណត់ហេតុទេ ។ ចុច​ប៊ូតុង <b>ធ្វើ​ឲ្យ​ស្រស់</b> ដើម្បី​វិភាគ​ថត​កំណត់ហេតុ​ម្ដង​ទៀត <nobr><b>%1</b></nobr> ។</p></translation>
     </message>
     <message>
         <source>Save VirtualBox Log As</source>
@@ -8321,11 +9144,19 @@ You may wish to translate this more like "Time remaining: %1"</comment
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -8596,7 +9427,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>&Hostname:</source>
-        <translation type="unfinished">ឈ្មោះ​ម៉ាស៊ីន​ ៖</translation>
+        <translation type="unfinished">ឈ្មោះ​ម៉ាស៊ីន​ ៖</translation>
     </message>
     <message>
         <source>&Bucket:</source>
@@ -8604,7 +9435,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>&File:</source>
-        <translation type="unfinished">ឯកសារ​ ៖</translation>
+        <translation type="unfinished">ឯកសារ​ ៖</translation>
     </message>
     <message>
         <source>Open Virtualization Format Archive (%1)</source>
@@ -8768,7 +9599,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
-        <translation type="unfinished">មាន​ម៉ាស៊ីន​និម្មិត​ដែល​មាន​នៅ​ក្នុង​ឧបករណ៍​ និង​ការ​កំណត់​ដែលបាន​ស្នើ​របស់ម៉ាស៊ីន VirtualBox ដែល​បាននាំចូល ។ អ្នក​អាច​ផ្លាស់ប្ដូរ​លក្ខណសម្បត្តិ​ដែលបានបង្ហាញ​ដោយ​ចុច​ទ្វេដង​លើ​ធាតុ និងបិទ​​លក្ខណសម្បត្តិ​ផ្សេងៗ​ទៀត ដោយ​ប្រើ​ប្រ​អប់ធីក​ខាង​ក្រោម ។</translation>
+        <translation type="unfinished">មាន​ម៉ាស៊ីន​និម្មិត​ដែល​មាន​នៅ​ក្នុង​ឧបករណ៍​ និង​ការ​កំណត់​ដែលបាន​ស្នើ​របស់ម៉ាស៊ីន VirtualBox ដែល​បាននាំចូល ។ អ្នក​អាច​ផ្លាស់ប្ដូរ​លក្ខណសម្បត្តិ​ដែលបានបង្ហាញ​ដោយ​ចុច​ទ្វេដង​លើ​ធាតុ និងបិទ​​លក្ខណសម្បត្តិ​ផ្សេងៗ​ទៀត ដោយ​ប្រើ​ប្រ​អប់ធីក​ខាង​ក្រោម ។</translation>
     </message>
     <message>
         <source>Import Virtual Appliance</source>
@@ -8960,7 +9791,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>You want to:</source>
-        <translation type="obsolete">អ្នក​ចង់ ៖</translation>
+        <translation type="obsolete">អ្នក​ចង់ ៖</translation>
     </message>
     <message>
         <source>&Save the machine state</source>
@@ -8976,19 +9807,19 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation type="obsolete"><p>នៅពេល​គូស​ធីក ស្ថានភាព​ម៉ាស៊ីន​នឹង​ត្រូវ​បាន​ស្ដារ​ពី​ស្ថានភាព​ដែល​បាន​ទុក​នៅ​ក្នុង​រូបថត​បច្ចុប្បន្ន​ខាង​ស្ដាំ​បន្ទាប់​ពី​​បិទ ។ វា​មាន​ប្រយោជន៍​ប្រសិន​បើ​​អ្នក​ប្រាកដ​ថា អ្នក​ចង់​បោះបង់​លទ្ធផល​នៃ​សម័យ​ចុងក្រោយ​របស់​អ្នក ហើយ​ត្រឡប់​ទៅ​រូបថត​បច្ចុប្បន្ន ។</p></translation>
+        <translation type="obsolete"><p>នៅពេល​គូស​ធីក ស្ថានភាព​ម៉ាស៊ីន​នឹង​ត្រូវ​បាន​ស្ដារ​ពី​ស្ថានភាព​ដែល​បាន​ទុក​នៅ​ក្នុង​រូបថត​បច្ចុប្បន្ន​ខាង​ស្ដាំ​បន្ទាប់​ពី​​បិទ ។ វា​មាន​ប្រយោជន៍​ប្រសិន​បើ​​អ្នក​ប្រាកដ​ថា អ្នក​ចង់​បោះបង់​លទ្ធផល​នៃ​សម័យ​ចុងក្រោយ​របស់​អ្នក ហើយ​ត្រឡប់​ទៅ​រូបថត​បច្ចុប្បន្ន ។</p></translation>
     </message>
     <message>
         <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation type="obsolete"><p>រក្សាទុក​ស្ថានភាព​ប្រតិបត្តិ​បច្ចុប្បន្ន​របស់​ម៉ាស៊ីន​និម្មិត ទៅ​ថាសរឹង​ហ្វីស៊ីខល​របស់​ម៉ាស៊ីន ។</p><p>ពេល​​ចាប់ផ្ដើម​ម៉ាស៊ីន​នេះ​លើកក្រោយ វា​នឹង​ត្រូ​វបាន​ស្ដារ​ពី​ស្ថានភាព​ដែល​បាន​រក្សាទុក និង​បន្ត​ប្រតិបត្តិការ​ពី​កន្លែង​ដដែល​ដែល​អ្នក​បាន​រក្សាទុក​វា ដែល​នឹង​អនុញ្ញាត​ឲ្យ​អ្នក​បន្ត​ការងារ​របស់​អ្នក​បាន​ភ្លាមៗ ។</p><p>ចំណាំ​ថា ការ​រក្សាទុក​ស្ថានភាព​របស់​ម៉ាស៊ីន​អាច​ចំណាយ​ពេល​យូ ដោយអាស្រ័យ​លើ​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិ [...]
+        <translation type="obsolete"><p>រក្សាទុក​ស្ថានភាព​ប្រតិបត្តិ​បច្ចុប្បន្ន​របស់​ម៉ាស៊ីន​និម្មិត ទៅ​ថាសរឹង​ហ្វីស៊ីខល​របស់​ម៉ាស៊ីន ។</p><p>ពេល​​ចាប់ផ្ដើម​ម៉ាស៊ីន​នេះ​លើកក្រោយ វា​នឹង​ត្រូ​វបាន​ស្ដារ​ពី​ស្ថានភាព​ដែល​បាន​រក្សាទុក និង​បន្ត​ប្រតិបត្តិការ​ពី​កន្លែង​ដដែល​ដែល​អ្នក​បាន​រក្សាទុក​វា ដែល​នឹង​អនុញ្ញាត​ឲ្យ​អ្នក​បន្ត​ការងារ​របស់​អ្នក​បាន​ភ្លាមៗ ។</p><p>ចំណាំ​ថា ការ​រក្សាទុក​ស្ថានភាព​របស់​ម៉ាស៊ីន​អាច​ចំណាយ​ពេល​យូ ដោយអាស្រ័យ​លើ​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិ [...]
     </message>
     <message>
         <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation type="obsolete"><p>ផ្ញើ​ព្រឹត្តិការ​ចុច​ប៊ូតុង​ថាមពល ACPI ទៅកាន់​ម៉ាស៊ីន​និម្មិត ។</p><p>ជា​ធម្មតា ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​រត់​ខាង​ក្នុង​ម៉ាស៊ីន​និម្មិត នឹង​រកឃើញ​ព្រឹត្តិការ​នេះ ហើយ​អនុវត្ត​នីតិវិធី​បិទ​ការ​ជម្រះ ។ នេះ​ជា​មធ្យោបាយ​ដែល​បានផ្ដល់​អនុសាសន៍ ឲ្យ​បិទ​ម៉ាស៊ីន​និម្មិត ពីព្រោះ​កម្មវិធី​ទាំង​អស់​ដែល​កំពុង​រត់​ខាង​ក្នុង​នឹង​មាន​ឱកាស​រក្សាទុក​ស្ថានភាព និង​ទិន្នន័យ​របស់​វា ។</p><p>ប្រសិន​បើ​ម៉ាស៊ីន​មិន​ឆ្លើយតប​នឹង​សកម្មភ [...]
+        <translation type="obsolete"><p>ផ្ញើ​ព្រឹត្តិការ​ចុច​ប៊ូតុង​ថាមពល ACPI ទៅកាន់​ម៉ាស៊ីន​និម្មិត ។</p><p>ជា​ធម្មតា ប្រព័ន្ធ​ប្រតិបត្តិការ​ម៉ាស៊ីន​ភ្ញៀវ​រត់​ខាង​ក្នុង​ម៉ាស៊ីន​និម្មិត នឹង​រកឃើញ​ព្រឹត្តិការ​នេះ ហើយ​អនុវត្ត​នីតិវិធី​បិទ​ការ​ជម្រះ ។ នេះ​ជា​មធ្យោបាយ​ដែល​បានផ្ដល់​អនុសាសន៍ ឲ្យ​បិទ​ម៉ាស៊ីន​និម្មិត ពីព្រោះ​កម្មវិធី​ទាំង​អស់​ដែល​កំពុង​រត់​ខាង​ក្នុង​នឹង​មាន​ឱកាស​រក្សាទុក​ស្ថានភាព និង​ទិន្នន័យ​របស់​វា ។</p><p>ប្រសិន​បើ​ម៉ាស៊ីន​មិន​ឆ្លើយតប​នឹង​សកម្មភ [...]
     </message>
     <message>
         <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation type="obsolete"><p>បិទ​ម៉ាស៊ីន​និម្មិត ។</p><p>ចំណាំ​ថា សកម្មភាព​នេះ​នឹង​បញ្ឈប់​កា​រប្រតិបត្តិ​របស់ម៉ាស៊ីន​ភ្លាមៗ​តែ​ម្ដង ដូច្នេះ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​ភ្ញៀវ​កំពុង​រត់​ខាង​​ក្នុង​វា​នឹង​មិនអាច​អនុវត្ត​នីតិវិធី​បិទ​ការ​ជម្រះ​ដែល​អាច​បណ្ដាល​ឲ្យ <i>បាត់បង់​ទិន្នន័យ</i> ខាង​ក្នុង​ម៉ាស៊ីន​និម្មិត​បានទេ ។ កា​រជ្រើស​សកម្ម​ភាព​នេះ​ត្រូវ​បានផ្ដល់​អនុសាសន៍​តែ​ក្នុងករណី​ដែល​ម៉ាស៊ីន​និមន្មិត​មិន​ឆ្លើយតប​នឹង​សកម្មភាព <b>ផ្ញើ​សញ្ញា​ [...]
+        <translation type="obsolete"><p>បិទ​ម៉ាស៊ីន​និម្មិត ។</p><p>ចំណាំ​ថា សកម្មភាព​នេះ​នឹង​បញ្ឈប់​កា​រប្រតិបត្តិ​របស់ម៉ាស៊ីន​ភ្លាមៗ​តែ​ម្ដង ដូច្នេះ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​ភ្ញៀវ​កំពុង​រត់​ខាង​​ក្នុង​វា​នឹង​មិនអាច​អនុវត្ត​នីតិវិធី​បិទ​ការ​ជម្រះ​ដែល​អាច​បណ្ដាល​ឲ្យ <i>បាត់បង់​ទិន្នន័យ</i> ខាង​ក្នុង​ម៉ាស៊ីន​និម្មិត​បានទេ ។ កា​រជ្រើស​សកម្ម​ភាព​នេះ​ត្រូវ​បានផ្ដល់​អនុសាសន៍​តែ​ក្នុងករណី​ដែល​ម៉ាស៊ីន​និមន្មិត​មិន​ឆ្លើយតប​នឹង​សកម្មភាព <b>ផ្ញើ​សញ្ញា​ [...]
     </message>
     <message>
         <source>Restore the machine state stored in the current snapshot</source>
@@ -9100,11 +9931,11 @@ You may wish to translate this more like "Time remaining: %1"</comment
         <translation type="obsolete">បើក​ប្រអប់​ដើម្បី​ប្រតិបត្តិ​លើ​ថត​ដែល​បានចែករំលែក</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">ដំឡើង​ការ​បន្ថែម​ភ្ញៀវ...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">ម៉ោន​រូបភាព​ដំឡើង​បន្ថែម​ភ្ញៀវ</translation>
     </message>
     <message>
@@ -9183,7 +10014,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     <message>
         <source><br><nobr><b>Adapter %1 (%2)</b>: cable %3</nobr></source>
         <comment>Network adapters tooltip</comment>
-        <translation type="obsolete"><br><nobr><b>អាដាប់ទ័រ %1 (%2)</b> ៖ ខ្សែ %3</nobr></translation>
+        <translation type="obsolete"><br><nobr><b>អាដាប់ទ័រ %1 (%2)</b> ៖ ខ្សែ %3</nobr></translation>
     </message>
     <message>
         <source>connected</source>
@@ -9220,7 +10051,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
         <translation type="obsolete">ប្រអប់​ព័ត៌មាន​សម័យ</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">បង្ហាញ​ប្រអប់​ព័ត៌មាន​សម័យ</translation>
     </message>
     <message>
@@ -9235,19 +10066,19 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>Indicates whether the guest display auto-resize function is On (<img src=:/auto_resize_on_16px.png/>) or Off (<img src=:/auto_resize_off_16px.png/>). Note that this function requires Guest Additions to be installed in the guest OS.</source>
-        <translation type="obsolete">បង្ហាញ​ថាតើ​ការបង្ហាញ​ម៉ាស៊ីន​​ភ្ញៀវ​មុខងារ​ផ្លាស់ប្ដូរ​ទំហំ​ដោយ​ស្វ័យ​ប្រវត្តិ​បើក (<img src=:/auto_resize_on_16px.png/>) ឬ​បិទ (<img src=:/auto_resize_off_16px.png/>) ។ ចំណាំ​ថា មុខងារ​នេះ​ត្រូវការ​ការ​បន្ថែម​ភ្ញៀវ​ដើម្បី​ដំឡើង​នៅក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​ភ្ញៀវ ។</translation>
+        <translation type="obsolete">បង្ហាញ​ថាតើ​ការបង្ហាញ​ម៉ាស៊ីន​​ភ្ញៀវ​មុខងារ​ផ្លាស់ប្ដូរ​ទំហំ​ដោយ​ស្វ័យ​ប្រវត្តិ​បើក (<img src=:/auto_resize_on_16px.png/>) ឬ​បិទ (<img src=:/auto_resize_off_16px.png/>) ។ ចំណាំ​ថា មុខងារ​នេះ​ត្រូវការ​ការ​បន្ថែម​ភ្ញៀវ​ដើម្បី​ដំឡើង​នៅក្នុង​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់ម៉ាស៊ីន​ភ្ញៀវ ។</translation>
     </message>
     <message>
         <source>Indicates whether the host mouse pointer is captured by the guest OS:<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;pointer is not captured</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;pointer is captured</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;mouse integration (MI) is On</nobr><br><nobr><img src=:/mouse_can_seamless_ [...]
-        <translation type="obsolete">បង្ហាញថា​តើ​ទស្សន៍​ទ្រនិច​កណ្ដុរ​របស់​ម៉ាស៊ីន​ត្រូ​វបាន​ចាប់យក​ដោយ​ប្រព័ន្ធ​ប្រតបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ដែរឬទេ ៖<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;ទស្សន៍​ទ្រនិច​មិន​ត្រូ​វបាន​ចាប់យក​ទេ</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;ទស្សន៍​ទ្រនិច​ត្រូវ​បាន​ចាប់យក</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;ការ [...]
+        <translation type="obsolete">បង្ហាញថា​តើ​ទស្សន៍​ទ្រនិច​កណ្ដុរ​របស់​ម៉ាស៊ីន​ត្រូ​វបាន​ចាប់យក​ដោយ​ប្រព័ន្ធ​ប្រតបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ​ដែរឬទេ ៖<br><nobr><img src=:/mouse_disabled_16px.png/>&nbsp;&nbsp;ទស្សន៍​ទ្រនិច​មិន​ត្រូ​វបាន​ចាប់យក​ទេ</nobr><br><nobr><img src=:/mouse_16px.png/>&nbsp;&nbsp;ទស្សន៍​ទ្រនិច​ត្រូវ​បាន​ចាប់យក</nobr><br><nobr><img src=:/mouse_seamless_16px.png/>&nbsp;&nbsp;ការ [...]
     </message>
     <message>
         <source>Indicates whether the keyboard is captured by the guest OS (<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>).</source>
-        <translation type="obsolete">បង្ហាញ​ថាតើ​ក្ដារចុច​ត្រូវ​បានចាប់យក​ដោយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ (<img src=:/hostkey_captured_16px.png/>) ឬ​មិនមែន (<img src=:/hostkey_16px.png/>) ។</translation>
+        <translation type="obsolete">បង្ហាញ​ថាតើ​ក្ដារចុច​ត្រូវ​បានចាប់យក​ដោយ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ (<img src=:/hostkey_captured_16px.png/>) ឬ​មិនមែន (<img src=:/hostkey_16px.png/>) ។</translation>
     </message>
     <message>
         <source>Indicates whether the Remote Display (VRDP Server) is enabled (<img src=:/vrdp_16px.png/>) or not (<img src=:/vrdp_disabled_16px.png/>).</source>
-        <translation type="obsolete">បង្ហាញ​ថាតើ​ការ​បង្ហាញ​ពី​ចម្ងាយ (ម៉ាស៊ីន​បម្រើ VRDP) ត្រូវ​បានបើក (<img src=:/vrdp_16px.png/>) ឬ​អត់ (<img src=:/vrdp_disabled_16px.png/>) ។</translation>
+        <translation type="obsolete">បង្ហាញ​ថាតើ​ការ​បង្ហាញ​ពី​ចម្ងាយ (ម៉ាស៊ីន​បម្រើ VRDP) ត្រូវ​បានបើក (<img src=:/vrdp_16px.png/>) ឬ​អត់ (<img src=:/vrdp_disabled_16px.png/>) ។</translation>
     </message>
     <message>
         <source>&Logging...</source>
@@ -9256,7 +10087,7 @@ You may wish to translate this more like "Time remaining: %1"</comment
     </message>
     <message>
         <source>Shows the currently assigned Host key.<br>This key, when pressed alone, toggles the keyboard and mouse capture state. It can also be used in combination with other keys to quickly perform actions from the main menu.</source>
-        <translation type="obsolete">បង្ហាញ​គ្រាប់ចុច​ម៉ាស៊ីន​ដែលបានផ្ដល់​បច្ចុប្បន្ន ។<br>គ្រាប់ចុច​នេះ នៅពេល​ចុច​យូរ បិទ/បើក​ក្ដារចុច ហើយ​ស្ថានភាព​ចាប់យក​កណ្ដុរ ។ វា​អាច​ត្រូវ​បាន​ប្រើ​ក្នុង​បន្សំ​ជា​មួយ​គ្រាប់ចុច​ផ្សេង ដើម្បី​អនុវត្ត​សកម្មភាព​យ៉ាង​លឿន ពី​ម៉ឺនុយ​ចម្បង ។</translation>
+        <translation type="obsolete">បង្ហាញ​គ្រាប់ចុច​ម៉ាស៊ីន​ដែលបានផ្ដល់​បច្ចុប្បន្ន ។<br>គ្រាប់ចុច​នេះ នៅពេល​ចុច​យូរ បិទ/បើក​ក្ដារចុច ហើយ​ស្ថានភាព​ចាប់យក​កណ្ដុរ ។ វា​អាច​ត្រូវ​បាន​ប្រើ​ក្នុង​បន្សំ​ជា​មួយ​គ្រាប់ចុច​ផ្សេង ដើម្បី​អនុវត្ត​សកម្មភាព​យ៉ាង​លឿន ពី​ម៉ឺនុយ​ចម្បង ។</translation>
     </message>
     <message>
         <source>Sun VirtualBox</source>
@@ -9320,7 +10151,7 @@ enable/disable...</comment>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the virtual hard disks:</nobr>%1</p></source>
         <comment>
 HDD tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថាសរឹង​និម្មិត ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថាសរឹង​និម្មិត ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
@@ -9338,7 +10169,7 @@ CD/DVD tooltip</comment>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>
 FD tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍​ថាស​ទន់ ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍​ថាស​ទន់ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><br><nobr><b>No floppy devices attached</b></nobr></source>
@@ -9350,19 +10181,19 @@ FD tooltip</comment>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>
 Network adapters tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ចំណុច​ប្រទាក់​បណ្ដាញ ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ចំណុច​ប្រទាក់​បណ្ដាញ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the attached USB devices:</nobr>%1</p></source>
         <comment>
 USB device tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍ USB ដែល​បាន​ភ្ជាប់ ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍ USB ដែល​បាន​ភ្ជាប់ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
         <comment>
 Shared folders tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថត​ដែល​បានចែករំលែក​របស់​ម៉ាស៊ីន ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថត​ដែល​បានចែករំលែក​របស់​ម៉ាស៊ីន ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source>Indicates the status of the hardware virtualization features used by this virtual machine:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></source>
@@ -9373,7 +10204,7 @@ Shared folders tooltip</comment>
 
 
 Virtualization Stuff LED</comment>
-        <translation type="obsolete">បង្ហាញថា ​ស្ថាន​ភាព​របស់​លក្ខណៈពិសេស​និម្មិត​ផ្នែក​រឹង​ត្រូ​វបាន​ប្រើ​ដោយ​ម៉ាស៊ីន​និម្មិត​នេះ ៖​<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></translation>
+        <translation type="obsolete">បង្ហាញថា ​ស្ថាន​ភាព​របស់​លក្ខណៈពិសេស​និម្មិត​ផ្នែក​រឹង​ត្រូ​វបាន​ប្រើ​ដោយ​ម៉ាស៊ីន​និម្មិត​នេះ ៖​<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></translation>
     </message>
     <message>
         <source><br><nobr><b>%1:</b>&nbsp;%2</nobr></source>
@@ -9389,7 +10220,7 @@ Virtualization Stuff LED</comment>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the virtual hard disks:</nobr>%1</p></source>
         <comment>HDD tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថាសរឹង​និម្មិត ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថាសរឹង​និម្មិត ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
@@ -9404,7 +10235,7 @@ Virtualization Stuff LED</comment>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍​ថាស​ទន់ ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍​ថាស​ទន់ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><br><nobr><b>No floppy devices attached</b></nobr></source>
@@ -9414,22 +10245,22 @@ Virtualization Stuff LED</comment>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ចំណុច​ប្រទាក់​បណ្ដាញ ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ចំណុច​ប្រទាក់​បណ្ដាញ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the attached USB devices:</nobr>%1</p></source>
         <comment>USB device tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍ USB ដែល​បាន​ភ្ជាប់ ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ឧបករណ៍ USB ដែល​បាន​ភ្ជាប់ ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
         <comment>Shared folders tooltip</comment>
-        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថត​ដែល​បានចែករំលែក​របស់​ម៉ាស៊ីន ៖</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>បង្ហាញ​សកម្មភាព​របស់​ថត​ដែល​បានចែករំលែក​របស់​ម៉ាស៊ីន ៖</nobr>%1</p></translation>
     </message>
     <message>
         <source>Indicates the status of the hardware virtualization features used by this virtual machine:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation type="obsolete">បង្ហាញថា ​ស្ថាន​ភាព​របស់​លក្ខណៈពិសេស​និម្មិត​ផ្នែក​រឹង​ត្រូ​វបាន​ប្រើ​ដោយ​ម៉ាស៊ីន​និម្មិត​នេះ ៖​<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></translation>
+        <translation type="obsolete">បង្ហាញថា ​ស្ថាន​ភាព​របស់​លក្ខណៈពិសេស​និម្មិត​ផ្នែក​រឹង​ត្រូ​វបាន​ប្រើ​ដោយ​ម៉ាស៊ីន​និម្មិត​នេះ ៖​<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr></translation>
     </message>
     <message>
         <source><br><nobr><b>%1:</b>&nbsp;%2</nobr></source>
@@ -9459,8 +10290,8 @@ Virtualization Stuff LED</comment>
         <translation><កំណត់​ទៅ​លំនាំដើម​ឡើងវិញ></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">តម្លៃ​ផ្លូវ​លំនាំដើម​ពិតប្រាកដ​នឹង​ត្រូវ​បានបង្ហាញ​បន្ទាប់ពី​ទទួល​ការ​ផ្លាស់ប្ដូរ និង​បើក​ប្រអប់នេះ​ម្ដង​ទៀត ។</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">តម្លៃ​ផ្លូវ​លំនាំដើម​ពិតប្រាកដ​នឹង​ត្រូវ​បានបង្ហាញ​បន្ទាប់ពី​ទទួល​ការ​ផ្លាស់ប្ដូរ និង​បើក​ប្រអប់នេះ​ម្ដង​ទៀត ។</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -9468,7 +10299,7 @@ Virtualization Stuff LED</comment>
     </message>
     <message>
         <source>Please use the <b>Other...</b> item from the drop-down list to select a path.</source>
-        <translation>សូម​ប្រើធាតុ <b>ផ្សេងៗ...</b> ពី​បញ្ជី​ទម្លាក់ចុះ​ដើម្បី​ជ្រើស​ផ្លូវ​ដែល​ចង់​បាន ។</translation>
+        <translation>សូម​ប្រើធាតុ <b>ផ្សេងៗ...</b> ពី​បញ្ជី​ទម្លាក់ចុះ​ដើម្បី​ជ្រើស​ផ្លូវ​ដែល​ចង់​បាន ។</translation>
     </message>
     <message>
         <source>Other...</source>
@@ -9480,19 +10311,19 @@ Virtualization Stuff LED</comment>
     </message>
     <message>
         <source>Opens a window to select a different folder.</source>
-        <translation>បើក​ប្រអប់ ដើម្បី​ជ្រើស​ថត​ផ្សេង ។</translation>
+        <translation>បើក​ប្រអប់ ដើម្បី​ជ្រើស​ថត​ផ្សេង ។</translation>
     </message>
     <message>
         <source>Resets the folder path to the default value.</source>
-        <translation>កំណត់​ផ្លូវថត​ទៅ​តម្លៃ​លំនាំដើម​ឡើង​វិញ ។</translation>
+        <translation>កំណត់​ផ្លូវថត​ទៅ​តម្លៃ​លំនាំដើម​ឡើង​វិញ ។</translation>
     </message>
     <message>
         <source>Opens a window to select a different file.</source>
-        <translation>បើក​ប្រអប់​ដើម្បី​ជ្រើស​ឯកសារ​ផ្សេង ។</translation>
+        <translation>បើក​ប្រអប់​ដើម្បី​ជ្រើស​ឯកសារ​ផ្សេង ។</translation>
     </message>
     <message>
         <source>Resets the file path to the default value.</source>
-        <translation>កំណត់​ផ្លូវ​ឯកសារ​ទៅ​តម្លៃ​លំនាំដើម​ឡើង​វិញ ។</translation>
+        <translation>កំណត់​ផ្លូវ​ឯកសារ​ទៅ​តម្លៃ​លំនាំដើម​ឡើង​វិញ ។</translation>
     </message>
     <message>
         <source>&Copy</source>
@@ -9500,16 +10331,15 @@ Virtualization Stuff LED</comment>
     </message>
     <message>
         <source>Please type the folder path here.</source>
-        <translation>សូម​វាយ​ផ្លូវ​ថត​ដែល​ចង់​បាននៅ​ទីនេះ ។</translation>
+        <translation>សូម​វាយ​ផ្លូវ​ថត​ដែល​ចង់​បាននៅ​ទីនេះ ។</translation>
     </message>
     <message>
         <source>Please type the file path here.</source>
-        <translation>សូម​វាយ​ផ្លូវ​ឯកសារ​ដែល​ចង់​បាន​នៅ​ទីនេះ ។</translation>
+        <translation>សូម​វាយ​ផ្លូវ​ឯកសារ​ដែល​ចង់​បាន​នៅ​ទីនេះ ។</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">តម្លៃ​ផ្លូវ​លំនាំដើម​ពិតប្រាកដ​នឹង​ត្រូវ​បានបង្ហាញ​បន្ទាប់ពី​ទទួល​ការ​ផ្លាស់ប្ដូរ និង​បើក​ប្រអប់នេះ​ម្ដង​ទៀត ។</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9547,15 +10377,15 @@ Virtualization Stuff LED</comment>
     <name>VBoxGLSettingsInput</name>
     <message>
         <source>Host &Key:</source>
-        <translation type="obsolete">គ្រាប់ចុច​ម៉ាស៊ីន ៖</translation>
+        <translation type="obsolete">គ្រាប់ចុច​ម៉ាស៊ីន ៖</translation>
     </message>
     <message>
         <source>Holds the key used as a Host Key in the VM window. Activate the entry field and press a new Host Key. Note that alphanumeric, cursor movement and editing keys cannot be used.</source>
-        <translation type="obsolete">បង្ហាញគ្រាប់ចុច​ដែល​បាន​ប្រើ​ជា​គ្រាប់​ចុច​ម៉ាស៊ីន​នៅ​ក្នុង​បង្អួច VM ។ ធ្វើ​ឲ្យ​វាល​ធាតុ​សកម្ម ហើយ​ចុច​គ្រាប់ចុច​ម៉ាស៊ីន​ថ្មី ។ ចំណាំថា​លេខ ចលនា​ទស្សន៍ទ្រនិច និង​គ្រាប់ចុចកែសម្រួល​មិនអាច​ត្រូវ​បាន​ប្រើ​ជា​គ្រាប់ចុច​ម៉ាស៊ីន​ទេ ។</translation>
+        <translation type="obsolete">បង្ហាញគ្រាប់ចុច​ដែល​បាន​ប្រើ​ជា​គ្រាប់​ចុច​ម៉ាស៊ីន​នៅ​ក្នុង​បង្អួច VM ។ ធ្វើ​ឲ្យ​វាល​ធាតុ​សកម្ម ហើយ​ចុច​គ្រាប់ចុច​ម៉ាស៊ីន​ថ្មី ។ ចំណាំថា​លេខ ចលនា​ទស្សន៍ទ្រនិច និង​គ្រាប់ចុចកែសម្រួល​មិនអាច​ត្រូវ​បាន​ប្រើ​ជា​គ្រាប់ចុច​ម៉ាស៊ីន​ទេ ។</translation>
     </message>
     <message>
         <source>When checked, the keyboard is automatically captured every time the VM window is activated. When the keyboard is captured, all keystrokes (including system ones like Alt-Tab) are directed to the VM.</source>
-        <translation type="obsolete">នៅពេល​បានគូស​ធីក ក្ដារចុច​ត្រូ​វបាន​ចាប់យក​ដោយ​ស្វ័យ​ប្រវត្តិ​រាល់ពេល​ដែល​បង្អួច VM ត្រូវ​បាន​ធ្វើ​ឲ្យ​សកម្ម ។ នៅពេល​ក្ដារចុច​ត្រូវ​បាន​ចាប់យក  keystrokes (រួម​មាន​ប្រព័ន្ធ​​មួយ ដូចជា ជំនួស(Alt)-ថេប(Tab)) ត្រូវ​បាន​បញ្ជូន​ទៅ​កាន់ VM ។</translation>
+        <translation type="obsolete">នៅពេល​បានគូស​ធីក ក្ដារចុច​ត្រូ​វបាន​ចាប់យក​ដោយ​ស្វ័យ​ប្រវត្តិ​រាល់ពេល​ដែល​បង្អួច VM ត្រូវ​បាន​ធ្វើ​ឲ្យ​សកម្ម ។ នៅពេល​ក្ដារចុច​ត្រូវ​បាន​ចាប់យក  keystrokes (រួម​មាន​ប្រព័ន្ធ​​មួយ ដូចជា ជំនួស(Alt)-ថេប(Tab)) ត្រូវ​បាន​បញ្ជូន​ទៅ​កាន់ VM ។</translation>
     </message>
     <message>
         <source>&Auto Capture Keyboard</source>
@@ -9567,12 +10397,12 @@ Virtualization Stuff LED</comment>
     <message>
         <source>Unknown device %1:%2</source>
         <comment>USB device details</comment>
-        <translation>មិនស្គាល់​ឧបករណ៍ %1 ៖ %2</translation>
+        <translation>មិនស្គាល់​ឧបករណ៍ %1 ៖ %2</translation>
     </message>
     <message>
         <source><nobr>Vendor ID: %1</nobr><br><nobr>Product ID: %2</nobr><br><nobr>Revision: %3</nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><nobr>លេខសម្គាល់​អ្នកលក់ ៖ %1</nobr><br><nobr>លេខសម្គាល់​អ្នក​ផលិត ៖ %2</nobr><br><nobr>ការ​ពិនិត្យ​ឡើង​វិញ ៖ %3</nobr></translation>
+        <translation><nobr>លេខសម្គាល់​អ្នកលក់ ៖ %1</nobr><br><nobr>លេខសម្គាល់​អ្នក​ផលិត ៖ %2</nobr><br><nobr>ការ​ពិនិត្យ​ឡើង​វិញ ៖ %3</nobr></translation>
     </message>
     <message>
         <source><br><nobr>Serial No. %1</nobr></source>
@@ -9582,7 +10412,7 @@ Virtualization Stuff LED</comment>
     <message>
         <source><br><nobr>State: %1</nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr>ស្ថានភាព ៖ %1</nobr></translation>
+        <translation><br><nobr>ស្ថានភាព ៖ %1</nobr></translation>
     </message>
     <message>
         <source>Name</source>
@@ -9762,7 +10592,7 @@ Virtualization Stuff LED</comment>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>ស៊ីឌី/ឌីវីឌីរ៉ូម</translation>
+        <translation type="obsolete">ស៊ីឌី/ឌីវីឌីរ៉ូម</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -10107,42 +10937,42 @@ Virtualization Stuff LED</comment>
     <message>
         <source><nobr>Vendor ID: %1</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation><nobr>លេខ​សម្គាល់​អ្នក​លក់ ៖ %1</nobr></translation>
+        <translation><nobr>លេខ​សម្គាល់​អ្នក​លក់ ៖ %1</nobr></translation>
     </message>
     <message>
         <source><nobr>Product ID: %2</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation><nobr>លេខសម្គាល់​ផលិតផល ៖ %2</nobr></translation>
+        <translation><nobr>លេខសម្គាល់​ផលិតផល ៖ %2</nobr></translation>
     </message>
     <message>
         <source><nobr>Revision: %3</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation><nobr>កា​រពិនិត្យ​ឡើង​វិញ ៖ %3</nobr></translation>
+        <translation><nobr>កា​រពិនិត្យ​ឡើង​វិញ ៖ %3</nobr></translation>
     </message>
     <message>
         <source><nobr>Product: %4</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation><nobr>ផលិតផល ៖ %4</nobr></translation>
+        <translation><nobr>ផលិតផល ៖ %4</nobr></translation>
     </message>
     <message>
         <source><nobr>Manufacturer: %5</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation><nobr>ក្រុមហ៊ុន​ផលិត ៖ %5</nobr></translation>
+        <translation><nobr>ក្រុមហ៊ុន​ផលិត ៖ %5</nobr></translation>
     </message>
     <message>
         <source><nobr>Serial No.: %1</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation><nobr>លេខ​ស៊េរី ៖ %1</nobr></translation>
+        <translation><nobr>លេខ​ស៊េរី ៖ %1</nobr></translation>
     </message>
     <message>
         <source><nobr>Port: %1</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation><nobr>ច្រក ៖ %1</nobr></translation>
+        <translation><nobr>ច្រក ៖ %1</nobr></translation>
     </message>
     <message>
         <source><nobr>State: %1</nobr></source>
         <comment>USB filter tooltip</comment>
-        <translation><nobr>ស្ថានភាព ៖ %1</nobr></translation>
+        <translation><nobr>ស្ថានភាព ៖ %1</nobr></translation>
     </message>
     <message>
         <source>Adapter %1</source>
@@ -10686,7 +11516,7 @@ medium</comment>
 
 
 medium</comment>
-        <translation type="obsolete">បានបរាជ័យ​ក្នុងកា​រ​ពិនិត្យ​មើល​មធ្យោ​បាយ​ងាយ​ស្រួល​​របស់​មេឌៀ ។​</translation>
+        <translation type="obsolete">បានបរាជ័យ​ក្នុងកា​រ​ពិនិត្យ​មើល​មធ្យោ​បាយ​ងាយ​ស្រួល​​របស់​មេឌៀ ។​</translation>
     </message>
     <message>
         <source><b>No disk image file selected</b></source>
@@ -10699,7 +11529,7 @@ medium</comment>
     </message>
     <message>
         <source>You can also change this while the machine is running.</source>
-        <translation>អ្នក​ក៏អាច​ផ្លាស់ប្ដូរ​វា ខណៈពេល​ដែល​ម៉ាស៊ីន​កំពុង​រត់ ។</translation>
+        <translation>អ្នក​ក៏អាច​ផ្លាស់ប្ដូរ​វា ខណៈពេល​ដែល​ម៉ាស៊ីន​កំពុង​រត់ ។</translation>
     </message>
     <message>
         <source><b>No disk image files available</b></source>
@@ -10712,7 +11542,7 @@ medium</comment>
     </message>
     <message>
         <source>You can create disk image files using the virtual media manager.</source>
-        <translation type="obsolete">អ្នក​អាច​បង្កើត​រូបភាព​មេឌៀ ដោយ​ប្រើ​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត ។</translation>
+        <translation type="obsolete">អ្នក​អាច​បង្កើត​រូបភាព​មេឌៀ ដោយ​ប្រើ​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត ។</translation>
     </message>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
@@ -10722,7 +11552,7 @@ medium</comment>
 
 
 medium</comment>
-        <translation type="obsolete">ការ​ភ្ជាប់​ជា​មួយ​នឹង​ថាស​រឹង​នេះ នឹង​ត្រូវ​បាន​អនុវត្ត​ដោយ​ប្រយោល​ ដោយ​ប្រើ​ថាសរឹង​ផ្សេង​ដែលបានបង្កើត​ថ្មីៗ ។</translation>
+        <translation type="obsolete">ការ​ភ្ជាប់​ជា​មួយ​នឹង​ថាស​រឹង​នេះ នឹង​ត្រូវ​បាន​អនុវត្ត​ដោយ​ប្រយោល​ ដោយ​ប្រើ​ថាសរឹង​ផ្សេង​ដែលបានបង្កើត​ថ្មីៗ ។</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
@@ -10733,7 +11563,7 @@ medium</comment>
 
 
 medium</comment>
-        <translation type="obsolete">មេឌៀ​មួយ​ចំនួន​នៅ​ក្នុង​ស្រឡាយ​ផ្នែក​រឹង​នេះ​មិនអាច​ចូល​ដំណើរការ​បាន​ទេ ។ សូម​ប្រើ​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត​នៅ​ក្នុង​របៀប <b>បង្ហាញ​ថាសរឹង​ផ្សេងៗ​គ្នា</b> ដើម្បី​ពិនិត្យមើល​មេឌៀ​ទាំង​នេះ ។</translation>
+        <translation type="obsolete">មេឌៀ​មួយ​ចំនួន​នៅ​ក្នុង​ស្រឡាយ​ផ្នែក​រឹង​នេះ​មិនអាច​ចូល​ដំណើរការ​បាន​ទេ ។ សូម​ប្រើ​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត​នៅ​ក្នុង​របៀប <b>បង្ហាញ​ថាសរឹង​ផ្សេងៗ​គ្នា</b> ដើម្បី​ពិនិត្យមើល​មេឌៀ​ទាំង​នេះ ។</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
@@ -10743,7 +11573,7 @@ medium</comment>
 
 
 medium</comment>
-        <translation type="obsolete">ថាសរឹង​មូលដ្ឋាន​នេះ​ត្រូវ​បាន​ភ្ជាប់​ដោយ​ប្រយោល​ ដោយ​ប្រើ​ថាសរឹង​ផ្សេង ៖</translation>
+        <translation type="obsolete">ថាសរឹង​មូលដ្ឋាន​នេះ​ត្រូវ​បាន​ភ្ជាប់​ដោយ​ប្រយោល​ ដោយ​ប្រើ​ថាសរឹង​ផ្សេង ៖</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -10783,7 +11613,7 @@ medium</comment>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(ស៊ីឌី​/​ឌី​វីឌី​)</translation>
+        <translation type="obsolete">(ស៊ីឌី​/​ឌី​វីឌី​)</translation>
     </message>
     <message>
         <source>Processor(s)</source>
@@ -10828,7 +11658,7 @@ medium</comment>
     <message>
         <source>Failed to check accessibility of disk image files.</source>
         <comment>medium</comment>
-        <translation type="unfinished">បានបរាជ័យ​ក្នុងកា​រ​ពិនិត្យ​មើល​មធ្យោ​បាយ​ងាយ​ស្រួល​​របស់​មេឌៀ ។​</translation>
+        <translation type="unfinished">បានបរាជ័យ​ក្នុងកា​រ​ពិនិត្យ​មើល​មធ្យោ​បាយ​ងាយ​ស្រួល​​របស់​មេឌៀ ។​</translation>
     </message>
     <message>
         <source><b>No disk image file selected</b></source>
@@ -10843,17 +11673,17 @@ medium</comment>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation type="unfinished">ការ​ភ្ជាប់​ជា​មួយ​នឹង​ថាស​រឹង​នេះ នឹង​ត្រូវ​បាន​អនុវត្ត​ដោយ​ប្រយោល​ ដោយ​ប្រើ​ថាសរឹង​ផ្សេង​ដែលបានបង្កើត​ថ្មីៗ ។</translation>
+        <translation type="obsolete">ការ​ភ្ជាប់​ជា​មួយ​នឹង​ថាស​រឹង​នេះ នឹង​ត្រូវ​បាន​អនុវត្ត​ដោយ​ប្រយោល​ ដោយ​ប្រើ​ថាសរឹង​ផ្សេង​ដែលបានបង្កើត​ថ្មីៗ ។</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation type="unfinished">មេឌៀ​មួយ​ចំនួន​នៅ​ក្នុង​ស្រឡាយ​ផ្នែក​រឹង​នេះ​មិនអាច​ចូល​ដំណើរការ​បាន​ទេ ។ សូម​ប្រើ​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត​នៅ​ក្នុង​របៀប <b>បង្ហាញ​ថាសរឹង​ផ្សេងៗ​គ្នា</b> ដើម្បី​ពិនិត្យមើល​មេឌៀ​ទាំង​នេះ ។</translation>
+        <translation type="obsolete">មេឌៀ​មួយ​ចំនួន​នៅ​ក្នុង​ស្រឡាយ​ផ្នែក​រឹង​នេះ​មិនអាច​ចូល​ដំណើរការ​បាន​ទេ ។ សូម​ប្រើ​កម្មវិធី​គ្រប់គ្រង​មេឌៀ​និម្មិត​នៅ​ក្នុង​របៀប <b>បង្ហាញ​ថាសរឹង​ផ្សេងៗ​គ្នា</b> ដើម្បី​ពិនិត្យមើល​មេឌៀ​ទាំង​នេះ ។</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation type="unfinished">ថាសរឹង​មូលដ្ឋាន​នេះ​ត្រូវ​បាន​ភ្ជាប់​ដោយ​ប្រយោល​ ដោយ​ប្រើ​ថាសរឹង​ផ្សេង ៖</translation>
+        <translation type="obsolete">ថាសរឹង​មូលដ្ឋាន​នេះ​ត្រូវ​បាន​ភ្ជាប់​ដោយ​ប្រយោល​ ដោយ​ប្រើ​ថាសរឹង​ផ្សេង ៖</translation>
     </message>
     <message>
         <source>Enabled</source>
@@ -11529,16 +12359,6 @@ medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -11589,22 +12409,166 @@ medium</comment>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">គ្មាន</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">លំនាំដើម</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>VBoxGlobalSettings</name>
     <message>
         <source>'%1 (0x%2)' is an invalid host key code.</source>
-        <translation type="obsolete">'%1 (0x%2)' គឺជា​កូដ​គ្រាប់ចុច​ម៉ាស៊ីន​មិនត្រឹមត្រូវ ។</translation>
+        <translation type="obsolete">'%1 (0x%2)' គឺជា​កូដ​គ្រាប់ចុច​ម៉ាស៊ីន​មិនត្រឹមត្រូវ ។</translation>
     </message>
     <message>
         <source>The value '%1' of the key '%2' doesn't match the regexp constraint '%3'.</source>
-        <translation>តម្លៃ '%1' នៃ​សោ '%2' មិនផ្គូផ្គង​កម្រិត​ regexp '%3' ។</translation>
+        <translation>តម្លៃ '%1' នៃ​សោ '%2' មិនផ្គូផ្គង​កម្រិត​ regexp '%3' ។</translation>
     </message>
     <message>
         <source>Cannot delete the key '%1'.</source>
-        <translation>មិន​អាច​លុប​គ្រាប់ចុច '%1' បានទេ ។</translation>
+        <translation>មិន​អាច​លុប​គ្រាប់ចុច '%1' បានទេ ។</translation>
     </message>
     <message>
         <source>'%1' is an invalid host-combination code-sequence.</source>
@@ -11860,7 +12824,7 @@ VMM: Floppy Image</comment>
     </message>
     <message>
         <source>Attached to:</source>
-        <translation type="unfinished">បាន​​ភ្ជាប់ទៅកាន់ ៖</translation>
+        <translation type="unfinished">បាន​​ភ្ជាប់ទៅកាន់ ៖</translation>
     </message>
     <message>
         <source>&Copy...</source>
@@ -11878,6 +12842,18 @@ VMM: Floppy Image</comment>
         <source>Modify the attributes of the selected disk image file</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -11905,19 +12881,19 @@ VMM: Floppy Image</comment>
     <name>VBoxOSTypeSelectorWidget</name>
     <message>
         <source>Operating &System:</source>
-        <translation type="obsolete">ប្រព័ន្ធ​ប្រតិបត្តិការ ៖</translation>
+        <translation type="obsolete">ប្រព័ន្ធ​ប្រតិបត្តិការ ៖</translation>
     </message>
     <message>
         <source>Selects the operating system family that you plan to install into this virtual machine.</source>
-        <translation type="obsolete">បង្ហាញ​ក្រុមគ្រួសារ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​មានគម្រោង​ដំឡើង​ក្នុង​ម៉ាស៊ីន​និម្មិត​នេះ ។</translation>
+        <translation type="obsolete">បង្ហាញ​ក្រុមគ្រួសារ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​មានគម្រោង​ដំឡើង​ក្នុង​ម៉ាស៊ីន​និម្មិត​នេះ ។</translation>
     </message>
     <message>
         <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation type="obsolete">បង្ហាញ​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​​មាន​​គម្រោង​ដំឡើង​ម៉ាស៊ីន​និម្មិត​នេះ (បាន​ហៅ​ប្រព័ន្ធ​ប្រតិបត្តិ​របស់​ម៉ាស៊ីន​ភ្ញៀវ) ។</translation>
+        <translation type="obsolete">បង្ហាញ​ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​ដែល​អ្នក​​មាន​​គម្រោង​ដំឡើង​ម៉ាស៊ីន​និម្មិត​នេះ (បាន​ហៅ​ប្រព័ន្ធ​ប្រតិបត្តិ​របស់​ម៉ាស៊ីន​ភ្ញៀវ) ។</translation>
     </message>
     <message>
         <source>&Version:</source>
-        <translation type="obsolete">កំណែ ៖</translation>
+        <translation type="obsolete">កំណែ ៖</translation>
     </message>
 </context>
 <context>
@@ -11928,19 +12904,19 @@ VMM: Floppy Image</comment>
     </message>
     <message>
         <source>Enter your full name using Latin characters.</source>
-        <translation type="obsolete">បញ្ចូល​ឈ្មោះ​ពេញ​ ដោយ​ប្រើ​តួអក្សរ​ឡាតាំង ។</translation>
+        <translation type="obsolete">បញ្ចូល​ឈ្មោះ​ពេញ​ ដោយ​ប្រើ​តួអក្សរ​ឡាតាំង ។</translation>
     </message>
     <message>
         <source>Enter your e-mail address. Please use a valid address here.</source>
-        <translation type="obsolete">បញ្ចូល​អាសយដ្ឋាន​អ៊ីមែល​ដែល​ត្រឹមត្រូវ​របស់អ្នក ។</translation>
+        <translation type="obsolete">បញ្ចូល​អាសយដ្ឋាន​អ៊ីមែល​ដែល​ត្រឹមត្រូវ​របស់អ្នក ។</translation>
     </message>
     <message>
         <source>Welcome to the VirtualBox Registration Form!</source>
-        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​សំណុំ​បែបបទ​ចុះឈ្មោះ​របស់ VirtualBox !</translation>
+        <translation type="obsolete">សូម​ស្វាគមន៍​មក​កាន់​សំណុំ​បែបបទ​ចុះឈ្មោះ​របស់ VirtualBox !</translation>
     </message>
     <message>
         <source>Could not perform connection handshake.</source>
-        <translation type="obsolete">មិនអាច​អនុវត្ត​ការ​តភ្ជាប់​ចាប់ដៃ​បានទេ ។</translation>
+        <translation type="obsolete">មិនអាច​អនុវត្ត​ការ​តភ្ជាប់​ចាប់ដៃ​បានទេ ។</translation>
     </message>
     <message>
         <source>Cancel</source>
@@ -11951,12 +12927,12 @@ VMM: Floppy Image</comment>
         <translation type="obsolete">ជ្រើស​​​ដែន​ដី​​/​ប្រ​ទេស​</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>សូម​បំ​ពេញ​សំណុំ​​បែប​បទ​ការ​ចុះ​ឈ្មោះ​នេះ​​ដើម្បី​អនុ​ញ្ញាត​ពួក​យើង​ដឹង​ថា​អ្នក​ប្រើ​ VirtualBox និង ដោយ​ជម្រើស​ ​ដើម្បី​រក្សា​ទុកដែល​អ្នក​បាន​អង្កេត​អំពី​​ព័ត៌​មាន និងភាព​ទាន់​សម័យ​របស់​​​ VirtualBox ។</p><p>សូម​ប្រើ​តូ​អក្សរ​ឡាតាំង​តែ​មួយ​​ដើម្បី​បំ​ពេញ​ក្នុង​វាល​ខាង​ក្រោម​ ។ ប្រ​ព័ន្ធ​ម៉ៃ​​​ក្រូ​ Sun នឹង​ប្រើ​ព័ត៌​មានស្ថិតិ​​ប្រើ​ផលិតផល​ជាមួយ​គ្នា​ និង​​​ផ្ញើ​​សំបុត្រ​ព័ត៌​មានឲ្យ​អ្នក​​របស់​​ VirtualBox ។ ពិសេស​​ ប្រព័ន្ធ​ម៉ៃ​ [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>សូម​បំ​ពេញ​សំណុំ​​បែប​បទ​ការ​ចុះ​ឈ្មោះ​នេះ​​ដើម្បី​អនុ​ញ្ញាត​ពួក​យើង​ដឹង​ថា​អ្នក​ប្រើ​ VirtualBox និង ដោយ​ជម្រើស​ ​ដើម្បី​រក្សា​ទុកដែល​អ្នក​បាន​អង្កេត​អំពី​​ព័ត៌​មាន និងភាព​ទាន់​សម័យ​របស់​​​ VirtualBox ។</p><p>សូម​ប្រើ​តូ​អក្សរ​ឡាតាំង​តែ​មួយ​​ដើម្បី​បំ​ពេញ​ក្នុង​វាល​ខាង​ក្រោម​ ។ ប្រ​ព័ន្ធ​ម៉ៃ​​​ក្រូ​ Sun នឹង​ប្រើ​ព័ត៌​មានស្ថិតិ​​ប្រើ​ផលិតផល​ជាមួយ​គ្នា​ និង​​​ផ្ញើ​​សំបុត្រ​ព័ត៌​មានឲ្យ​អ្នក​​របស់​​ VirtualBox ។ ពិសេស​​ ប្រព័ន្ធ​ម៉ៃ​ [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
-        <translation type="obsolete">ខ្ញុំ​មាន​គណនី​លើបណ្តាញ​របស់​​ Sun រួច​ហើយ ៖</translation>
+        <translation type="obsolete">ខ្ញុំ​មាន​គណនី​លើបណ្តាញ​របស់​​ Sun រួច​ហើយ ៖</translation>
     </message>
     <message>
         <source>&E-mail:</source>
@@ -11964,39 +12940,39 @@ VMM: Floppy Image</comment>
     </message>
     <message>
         <source>&Password:</source>
-        <translation type="obsolete">​ពាក្យ​សម្ងាត់​ ៖</translation>
+        <translation type="obsolete">​ពាក្យ​សម្ងាត់​ ៖</translation>
     </message>
     <message>
         <source>I &would like to create a new Sun Online account:</source>
-        <translation type="obsolete">ខ្ញុំ​ចង់​បង្កើត​​គណនី​លើ​បណ្តាញ​របស់​ Sun ថ្មី ៖</translation>
+        <translation type="obsolete">ខ្ញុំ​ចង់​បង្កើត​​គណនី​លើ​បណ្តាញ​របស់​ Sun ថ្មី ៖</translation>
     </message>
     <message>
         <source>&First Name:</source>
-        <translation type="obsolete">នាម​ខ្លួន​ ៖</translation>
+        <translation type="obsolete">នាម​ខ្លួន​ ៖</translation>
     </message>
     <message>
         <source>&Last Name:</source>
-        <translation type="obsolete">នាម​ត្រ​កូល​ ៖</translation>
+        <translation type="obsolete">នាម​ត្រ​កូល​ ៖</translation>
     </message>
     <message>
         <source>&Company:</source>
-        <translation type="obsolete">ក្រុម​ហ៊ុន​​ ៖</translation>
+        <translation type="obsolete">ក្រុម​ហ៊ុន​​ ៖</translation>
     </message>
     <message>
         <source>Co&untry:</source>
-        <translation type="obsolete">ប្រ​ទេស​ ៖</translation>
+        <translation type="obsolete">ប្រ​ទេស​ ៖</translation>
     </message>
     <message>
         <source>E-&mail:</source>
-        <translation type="obsolete">អ៊ី​មែល​ ៖</translation>
+        <translation type="obsolete">អ៊ី​មែល​ ៖</translation>
     </message>
     <message>
         <source>P&assword:</source>
-        <translation type="obsolete">ពាក្យសម្ងាត់​ ៖</translation>
+        <translation type="obsolete">ពាក្យសម្ងាត់​ ៖</translation>
     </message>
     <message>
         <source>Co&nfirm Password:</source>
-        <translation type="obsolete">បញ្ជាក់​ពាក្យ​សម្ងាត់ ៖</translation>
+        <translation type="obsolete">បញ្ជាក់​ពាក្យ​សម្ងាត់ ៖</translation>
     </message>
     <message>
         <source>&Register</source>
@@ -12018,7 +12994,7 @@ VMM: Floppy Image</comment>
     </message>
     <message>
         <source>Click to view non-scaled screenshot.</source>
-        <translation>ចុច​ ដើម្បី​មើល​រូបថត​អេក្រង់​គ្មានមាត្រដ្ឋាន ។</translation>
+        <translation>ចុច​ ដើម្បី​មើល​រូបថត​អេក្រង់​គ្មានមាត្រដ្ឋាន ។</translation>
     </message>
     <message>
         <source>Click to view scaled screenshot.</source>
@@ -12190,8 +13166,8 @@ VMM: Floppy Image</comment>
         <translation type="obsolete">ធ្វើ​ឲ្យ​ស្រស់</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>សូមស្វាគមន៍​​មក​កាន់ VirtualBox !</h3><p>ផ្នែកដែល​នៅ​សល់​របស់​បង្អួច​នេះ គឺជា​បញ្ជី​ម៉ាស៊ីន​និម្មិត​នៅ​ក្នុង​កុំព្យូទ័រ​របស់​អ្នក ។ បញ្ជី​ទទេ​ឥឡូវ​នេះ ពីព្រោះ​អ្នកមិនបានបង្កើត​ម៉ាស៊ីននិម្មិត​នៅ​ឡើយ​ទេ ។<img src=:/welcome.png align=right/></p><p>ដើម្បី​បង្កើត​ម៉ាស៊ីន​និម្មិត ចុច​ប៊ូតុង <b>ថ្មី</b> ក្នុង​របារ​ឧបករណ៍​ដែល​មាននៅ​​ផ្នែក​ខាង​លើ​នៃ​បង្អួច ។</p><p>អ្នក​អាច​ចុច​គ្រាប់ចុច <b>% [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>សូមស្វាគមន៍​​មក​កាន់ VirtualBox !</h3><p>ផ្នែកដែល​នៅ​សល់​របស់​បង្អួច​នេះ គឺជា​បញ្ជី​ម៉ាស៊ីន​និម្មិត​នៅ​ក្នុង​កុំព្យូទ័រ​របស់​អ្នក ។ បញ្ជី​ទទេ​ឥឡូវ​នេះ ពីព្រោះ​អ្នកមិនបានបង្កើត​ម៉ាស៊ីននិម្មិត​នៅ​ឡើយ​ទេ ។<img src=:/welcome.png align=right/></p><p>ដើម្បី​បង្កើត​ម៉ាស៊ីន​និម្មិត ចុច​ប៊ូតុង <b>ថ្មី</b> ក្នុង​របារ​ឧបករណ៍​ដែល​មាននៅ​​ផ្នែក​ខាង​លើ​នៃ​បង្អួច ។</p><p>អ្នក​អាច​ចុច​គ្រាប់ចុច <b>% [...]
     </message>
     <message>
         <source>&File</source>
@@ -12220,7 +13196,7 @@ VMM: Floppy Image</comment>
     <name>VBoxSettingsDialog</name>
     <message>
         <source><i>Select a settings category from the list on the left-hand side and move the mouse over a settings item to get more information</i>.</source>
-        <translation type="obsolete"><i>ជ្រើស​ប្រភេទ​ការ​កំណត់​ពី​បញ្ជីនៅ​ខាង​ផ្នែកខាង​ឆ្វេង​ ហើយ​ផ្លាស់ទី​កណ្ដុរ​លើ​ធាតុ​កំណត់​ដើម្បី​ទទួល​យក​ព័ត៌មានបន្ថែម</i> ។</translation>
+        <translation type="obsolete"><i>ជ្រើស​ប្រភេទ​ការ​កំណត់​ពី​បញ្ជីនៅ​ខាង​ផ្នែកខាង​ឆ្វេង​ ហើយ​ផ្លាស់ទី​កណ្ដុរ​លើ​ធាតុ​កំណត់​ដើម្បី​ទទួល​យក​ព័ត៌មានបន្ថែម</i> ។</translation>
     </message>
     <message>
         <source>Invalid settings detected</source>
@@ -12247,15 +13223,15 @@ VMM: Floppy Image</comment>
     </message>
     <message>
         <source>Click to enlarge the screenshot.</source>
-        <translation>ចុច ដើម្បី​ពង្រីក​រូប​ថត​អេ​ក្រង់​ ។</translation>
+        <translation>ចុច ដើម្បី​ពង្រីក​រូប​ថត​អេ​ក្រង់​ ។</translation>
     </message>
     <message>
         <source>&Name:</source>
-        <translation>ឈ្មោះ ៖</translation>
+        <translation>ឈ្មោះ ៖</translation>
     </message>
     <message>
         <source>Taken:</source>
-        <translation>បាន​ថត ៖</translation>
+        <translation>បាន​ថត ៖</translation>
     </message>
     <message>
         <source>&Description:</source>
@@ -12263,7 +13239,7 @@ VMM: Floppy Image</comment>
     </message>
     <message>
         <source>D&etails:</source>
-        <translation>សេច​ក្តី​លម្អិត​ ៖</translation>
+        <translation>សេច​ក្តី​លម្អិត​ ៖</translation>
     </message>
 </context>
 <context>
@@ -12401,7 +13377,7 @@ VMM: Floppy Image</comment>
     <message numerus="yes">
         <source>Warning: You are taking a snapshot of a running machine which has %n immutable image(s) attached to it. As long as you are working from this snapshot the immutable image(s) will not be reset to avoid loss of data.</source>
         <translation type="unfinished">
-            <numerusform>ការ​ព្រមាន ៖ អ្នកកំពុង​ថត​រូប​របស់​ម៉ាស៊ីន​ដែល​កំពុង​រត់ ដែលមាន​រូបភាព​មិនប្រែប្រួល %n បានភ្ជាប់​ទៅកាន់​វា ។ ដ៏រាប​ណា​អ្នកកំពុង​ធ្វើការ​​ពី​រូបភាព​ដែល​មិនប្រែប្រួល​នេះ នឹង​មិន​ត្រូ​វបានកំណត់​ឡើងវិញ​ ដើម្បី​ចៀសវាង​ពី​ការ​បាត់បង់​ទិន្នន័យ​ទេ ។</numerusform>
+            <numerusform>ការ​ព្រមាន ៖ អ្នកកំពុង​ថត​រូប​របស់​ម៉ាស៊ីន​ដែល​កំពុង​រត់ ដែលមាន​រូបភាព​មិនប្រែប្រួល %n បានភ្ជាប់​ទៅកាន់​វា ។ ដ៏រាប​ណា​អ្នកកំពុង​ធ្វើការ​​ពី​រូបភាព​ដែល​មិនប្រែប្រួល​នេះ នឹង​មិន​ត្រូ​វបានកំណត់​ឡើងវិញ​ ដើម្បី​ចៀសវាង​ពី​ការ​បាត់បង់​ទិន្នន័យ​ទេ ។</numerusform>
         </translation>
     </message>
 </context>
@@ -12446,7 +13422,7 @@ VMM: Floppy Image</comment>
     <name>VBoxVMDescriptionPage</name>
     <message>
         <source>No description. Press the Edit button below to add it.</source>
-        <translation type="obsolete">គ្មាន​សេចក្ដី​ពិពណ៌នា​ទេ ។ ចុច​ប៊ុតុង កែសម្រួល​ខា​ងក្រោម​ដើម្បី​បន្ថែម​វា ។</translation>
+        <translation type="obsolete">គ្មាន​សេចក្ដី​ពិពណ៌នា​ទេ ។ ចុច​ប៊ុតុង កែសម្រួល​ខា​ងក្រោម​ដើម្បី​បន្ថែម​វា ។</translation>
     </message>
     <message>
         <source>Edit</source>
@@ -12461,145 +13437,7 @@ VMM: Floppy Image</comment>
     <name>VBoxVMDetailsView</name>
     <message>
         <source>The selected virtual machine is <i>inaccessible</i>. Please inspect the error message shown below and press the <b>Refresh</b> button if you want to repeat the accessibility check:</source>
-        <translation type="obsolete">ម៉ាស៊ីន​និម្មិត​ដែល​បាន​ជ្រើស​ <i>មិន​អាច​ចូលដំណើរការ​បានទេ</i> ។ សូម​ពិនិត្យ​មើល​សារ​កំហុស​ដែល​បានបង្ហាញ​ខាង​ក្រោម ហើយ​ចុច​ប៊ូតុង <b>ធ្វើ​ឲ្យ​ស្រស់</b> ប្រសិន​បើ​អ្នក​ចង់​ធ្វើការ​ពិនិត្យ​ការ​ចូលដំណើរការ​​ឡើង​វិញ ៖</translation>
-    </message>
-</context>
-<context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - ព័ត៌មាន​សម័យ</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">សេចក្ដី​លម្អិត</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">ពេលវេលា​រត់</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>ការ​ផ្ទេរ DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>ការ​ផ្ទេរ PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>អាន​ទិន្នន័យ</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>សរសេរ​ទិន្នន័យ</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>បានផ្ទេរ​ទិន្នន័យ</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>បាន​ទទួល​ទិន្នន័យ</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>គុណលក្ខណៈ​ពេលវេលា​រត់</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>គុណភាព​បង្ហាញ​របស់​អេក្រង់</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">កំណែ %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>រក​មិនឃើញ</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>រក​មិន​ឃើញ</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>ការ​បន្ថែម​ម៉ាស៊ីន​ភ្ញៀវ</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>ប្រភេទ​ប្រព័ន្ធ​ប្រតិបត្តិការ​របស់​ម៉ាស៊ីន​ភ្ញៀវ</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>គ្មានអាដាប់ទ័រ​បណ្ដាញ​ទេ</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">បានបើក</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">បានបិទ</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">ភេយីង​ខាង​ក្នុង</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>
-
-
-details report (VRDP server port)</comment>
-        <translation type="obsolete">មិនអាច​ប្រើបាន​</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>ស្ថិតិ​ផ្ទុក​</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>គ្មាន​ឧបករណ៍​ផ្ទុក​ទេ​</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>ស្ថិតិ​បណ្ដាញ</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">មិនអាច​ប្រើបាន​</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation type="unfinished">មិនអាច​ប្រើបាន​</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">ម៉ាស៊ីន​និម្មិត​ដែល​បាន​ជ្រើស​ <i>មិន​អាច​ចូលដំណើរការ​បានទេ</i> ។ សូម​ពិនិត្យ​មើល​សារ​កំហុស​ដែល​បានបង្ហាញ​ខាង​ក្រោម ហើយ​ចុច​ប៊ូតុង <b>ធ្វើ​ឲ្យ​ស្រស់</b> ប្រសិន​បើ​អ្នក​ចង់​ធ្វើការ​ពិនិត្យ​ការ​ចូលដំណើរការ​​ឡើង​វិញ ៖</translation>
     </message>
 </context>
 <context>
@@ -12622,7 +13460,7 @@ details report (VRDP server port)</comment>
     </message>
     <message>
         <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
-        <translation type="obsolete"><p>រក​មិនឃើញ​កំណត់ហេតុទេ ។ ចុច​ប៊ូតុង <b>ធ្វើ​ឲ្យ​ស្រស់</b> ដើម្បី​វិភាគ​ថត​កំណត់ហេតុ​ម្ដង​ទៀត <nobr><b>%1</b></nobr> ។</p></translation>
+        <translation type="obsolete"><p>រក​មិនឃើញ​កំណត់ហេតុទេ ។ ចុច​ប៊ូតុង <b>ធ្វើ​ឲ្យ​ស្រស់</b> ដើម្បី​វិភាគ​ថត​កំណត់ហេតុ​ម្ដង​ទៀត <nobr><b>%1</b></nobr> ។</p></translation>
     </message>
     <message>
         <source>Save VirtualBox Log As</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ko.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ko.ts
index b8de5af..eed12ea 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ko.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ko.ts
@@ -26,7 +26,7 @@
     <message>
         <source>Oracle Corporation</source>
         <comment>Comma-separated list of translators</comment>
-        <translation>Park Shinjo</translation>
+        <translation>Shinjo Park</translation>
     </message>
 </context>
 <context>
@@ -252,7 +252,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">심리스 모드(&L)</translation>
+        <translation>심리스 모드(&L)</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -276,11 +276,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>마우스 통합 비활성화(&M)</translation>
+        <translation type="obsolete">마우스 통합 비활성화(&M)</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>호스트 마우스 포인터 통합을 임시적으로 비활성화시킵니다</translation>
+        <translation type="obsolete">호스트 마우스 포인터 통합을 임시적으로 비활성화시킵니다</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -292,11 +292,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Ctrl-Alt-Del 누르기(&I)</translation>
+        <translation type="obsolete">Ctrl-Alt-Del 누르기(&I)</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>가상 머신에 Ctrl-Alt-Del 키를 입력합니다</translation>
+        <translation type="obsolete">가상 머신에 Ctrl-Alt-Del 키를 입력합니다</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -304,7 +304,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>가상 머신에 Ctrl-Alt-Backspace 키를 입력합니다</translation>
+        <translation type="obsolete">가상 머신에 Ctrl-Alt-Backspace 키를 입력합니다</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -319,8 +319,8 @@
         <translation type="obsolete">세션 정보 대화상자(&N)</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">세션 정보 대화 상자 보이기</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">세션 정보 대화 상자 보이기</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -376,15 +376,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>CD/DVD 장치(&C)</translation>
+        <translation type="obsolete">CD/DVD 장치(&C)</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>플로피 장치(&F)</translation>
+        <translation type="obsolete">플로피 장치(&F)</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>USB 장치(&U)</translation>
+        <translation type="obsolete">USB 장치(&U)</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -411,12 +411,12 @@
         <translation type="obsolete">이 머신으로 들어오는 원격 데스크톱(RDP) 연결을 켜거나 끕니다</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">게스트 확장 설치(&I)...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">게스트 확장 설치(&I)...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">게스트 확장 설치 이미지를 마운트합니다</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">게스트 확장 설치 이미지를 마운트합니다</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -435,7 +435,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>로그(&L)...</translation>
+        <translation type="obsolete">로그(&L)...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -464,15 +464,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>전체 화면 모드로 전환(&F)</translation>
+        <translation type="obsolete">전체 화면 모드로 전환(&F)</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>창 모드와 전체 화면 모드를 전환합니다</translation>
+        <translation type="obsolete">창 모드와 전체 화면 모드를 전환합니다</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>심리스 모드로 전환(&L)</translation>
+        <translation type="obsolete">심리스 모드로 전환(&L)</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -480,7 +480,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>크기 조정 모드로 전환(&S)</translation>
+        <translation type="obsolete">크기 조정 모드로 전환(&S)</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -560,7 +560,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Ctrl-Alt-Backspace 누르기(&E)</translation>
+        <translation type="obsolete">Ctrl-Alt-Backspace 누르기(&E)</translation>
     </message>
     <message>
         <source>&File</source>
@@ -883,7 +883,7 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>드래그 앤 드롭</translation>
+        <translation type="obsolete">드래그 앤 드롭</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
@@ -930,22 +930,232 @@
         <translation>팝업 메뉴</translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation>세션 정보 대화 상자 보이기</translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation>웹캠(&W)</translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">게스트 확장 설치(&I)...</translation>
+        <translation>게스트 확장 CD 이미지 삽입(&I)...</translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">게스트 확장 설치 이미지를 마운트합니다</translation>
+        <translation>VirtualBox 게스트 확장 디스크 파일을 가상 드라이브에 삽입</translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation type="unfinished"></translation>
+        <source>&VirtualBox</source>
+        <translation>VirtualBox(&V)</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>메뉴 표시줄(&M)</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>메뉴 표시줄 설정(&M)...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>메뉴 표시줄을 설정하는 창을 엽니다</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>메뉴 표시줄 보이기(&B)</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>이 가상 머신의 메뉴 표시줄 보이기/숨기기</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>상태 표시줄(&S)</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>상태 표시줄 설정(&S)...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>상태 표시줄을 설정하는 창을 엽니다</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>상태 표시줄 보이기(&B)</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>이 가상 머신의 상태 표시줄 보이기/숨기기</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>입력(&I)</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>키보드(&K)</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>키보드 설정(&K)...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>전역 단축키 설정 대화 상자를 표시합니다</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>마우스(&M)</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>하드 드라이브(&H)</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>하드 드라이브 설정(&H)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>하드 드라이브 설정 바꾸기</translation>
     </message>
     <message>
         <source>Network</source>
-        <translation type="unfinished">네트워크</translation>
+        <translation>네트워크</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>USB 설정(&U)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>USB 장치 설정 바꾸기</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>공유 폴더(&S)</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>로그 보기(&L)...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation>추가 데이터 관리자(&X)...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>추가 데이터 관리자 대화상자를 표시합니다</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>파일(&F)</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation>창(&W)</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>최소화(&M)</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>활성 가상 머신 창 최소화</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>전체 화면 모드(&F)</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>창 모드와 전체 화면 모드를 전환합니다</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>크기 조정 모드(&C)</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>크기 조정 비율(&C)</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>%1 삽입(&I)</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>가상 머신에 %1 키를 입력합니다</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>마우스 통합(&M)</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>호스트 마우스 통합 활성화</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>광학 드라이브(&O)</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>플로피 드라이브(&F)</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation>USB(&U)</translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>드래그 앤 드롭</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>로그(&L)</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation>일반 시작(&N)</translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation>헤드리스 시작(&H)</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation>선택한 가상 머신을 백그라운드에서 시작합니다</translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation>떼낼 수 있도록 시작(&D)</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation>선택한 가상 머신을 시작한 후 백그라운드에서 계속 실행할 수 있도록 합니다</translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>사용함</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>%1x%2(으)로 크기 조정</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation>%1%</translation>
     </message>
 </context>
 <context>
@@ -956,6 +1166,20 @@
     </message>
 </context>
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - 디스크 암호화</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>이 가상 머신은 암호로 보호되어 있습니다.암호 %n개를 입력하십시오.</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIApplianceEditorWidget</name>
     <message>
         <source>Virtual System %1</source>
@@ -1742,6 +1966,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation>데이터 가져오는 중...</translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1752,7 +1983,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>끌어다 놓은 데이터 처리 중...</translation>
+        <translation type="obsolete">끌어다 놓은 데이터 처리 중...</translation>
     </message>
 </context>
 <context>
@@ -1824,6 +2055,31 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation>상태</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation>ID</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>암호</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>다음 하드 드라이브 %n개에 사용됨:</nobr><br>%1</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2504,7 +2760,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2725,6 +2981,116 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>프레임 크기: %1x%2, 프레임 레이트: %3fps, 비트 전송률: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>최소 반가상화</translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Hyper-V 반가상화</translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>KVM 반가상화</translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[광학 드라이브]</translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>USB 컨트롤러</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">크기 조정 비율</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">조정되지 않은 HiDPI 비디오 출력</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">사용함</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>작은 도구 모음 위치</translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>위</translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>아래</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>작은 도구 모음</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>사용 안함</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">크기 조정 비율</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">조정되지 않은 HiDPI 비디오 출력</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">사용함</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">사용함</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">사용 안함</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">사용함</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">사용 안함</translation>
+    </message>
 </context>
 <context>
     <name>UIGDetailsUpdateThreadAudio</name>
@@ -3024,15 +3390,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Machine Windows:</source>
-        <translation type="unfinished"></translation>
+        <translation>머신 창:</translation>
     </message>
     <message>
         <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation type="unfinished"></translation>
+        <translation>선택하면 마우스 커서가 머신 창 위로 지나갈 때 머신 창이 위로 올라옵니다.</translation>
     </message>
     <message>
         <source>&Raise Window Under Mouse</source>
-        <translation type="unfinished"></translation>
+        <translation>마우스 아래 창 올리기(&R)</translation>
     </message>
 </context>
 <context>
@@ -3138,15 +3504,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation>도크 및 메뉴 표시줄(&D):</translation>
+        <translation type="obsolete">도크 및 메뉴 표시줄(&D):</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation>전체 화면에서 자동으로 보이기</translation>
+        <translation type="obsolete">전체 화면에서 자동으로 보이기</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>선택하면 가상 머신이 전체 화면일 때 호스트 도크와 메뉴 표시줄을 자동으로 표시합니다.</translation>
+        <translation type="obsolete">선택하면 가상 머신이 전체 화면일 때 호스트 도크와 메뉴 표시줄을 자동으로 표시합니다.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
@@ -4361,12 +4727,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>CD/DVD 장치의 활동 상태를 표시합니다:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>CD/DVD 장치의 활동 상태를 표시합니다:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>플로피 장치의 활동 상태를 표시합니다:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>플로피 장치의 활동 상태를 표시합니다:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4406,7 +4772,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB 컨트롤러가 비활성화됨</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB 컨트롤러가 비활성화됨</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4474,6 +4840,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation>추가 기능 상태:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>디스플레이의 활동 상태를 표시합니다:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>광학 드라이브의 활동 상태를 표시합니다:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>플로피 드라이브 활동 상태를 표시합니다:</nobr>%1</p></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4546,19 +4926,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation type="unfinished"></translation>
+        <translation>웹캠이 연결되지 않았음</translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation type="unfinished"></translation>
+        <translation>호스트 PC에 지원하는 웹캠이 연결되지 않았음</translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation type="unfinished"></translation>
+        <translation>네트워크 어댑터 연결</translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation type="unfinished"></translation>
+        <translation>네트워크 어댑터 %1 연결</translation>
     </message>
 </context>
 <context>
@@ -4600,7 +4980,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>비디오(&V)</translation>
+        <translation type="obsolete">비디오(&V)</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4788,7 +5168,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>가상 머신에 하드웨어 그래픽 가속이 켜져 있으면 운영 체제 종류를 Windows Vista 이후로 선택하였습니다. 최적의 성능을 위해서 비디오 메모리를 <b>%1</b> 이상으로 설정하십시오.</translation>
+        <translation type="obsolete">가상 머신에 하드웨어 그래픽 가속이 켜져 있으면 운영 체제 종류를 Windows Vista 이후로 선택하였습니다. 최적의 성능을 위해서 비디오 메모리를 <b>%1</b> 이상으로 설정하십시오.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -4842,22 +5222,90 @@ p, li { white-space: pre-wrap; }
         <translation>화면 %1의 동영상 녹화를 사용합니다.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation type="unfinished"></translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">작은 도구 모음:</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source><qt>%1&nbsp;MB</qt></source>
-        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">선택하면 전체 화면 및 심리스 모드에서 작은 도구 모음을 표시합니다.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">전체 화면/심리스 모드에서 보이기(&F)</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">선택하면 작은 도구 모음을 화면 아래 대신 위에 표시합니다.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">화면 위에 보이기(&T)</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>동영상 5분 당 약 %1MB</i></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation>현재 가상 머신에서 원격 디스플레이가 활성화되어 있으나, <b>%1</b>을(를) 설치해야 합니다. 원격 디스플레이를 사용하려면 VirtualBox 다운로드 사이트에서 확장 기능 패키지를 설치하거나, 설치하지 않고 계속 진행하면 원격 디스플레이를 사용하지 않습니다.</translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation>가상 머신에 하드웨어 그래픽 가속이 켜져 있으며 운영 체제 종류를 Windows Vista 이후로 선택하였습니다. 최적의 성능을 위해서 비디오 메모리를 <b>%1</b> 이상으로 설정하십시오.</translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished">HiDPI:</translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished">조정되지 않은 HiDPI 출력 사용(&U)</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
     </message>
     <message>
         <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
         <translation>이 가상 머신의 스냅샷을 저장할 경로를 표시합니다. 스냅샷은 많은 디스크 공간을 차지할 수도 있습니다.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>기본(&B)</translation>
     </message>
     <message>
@@ -4901,7 +5349,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">가상 머신에 할당할 비디오 메모리 크기를 설정합니다.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>고급(&A)</translation>
     </message>
     <message>
@@ -4989,7 +5437,7 @@ p, li { white-space: pre-wrap; }
         <translation>스냅샷 폴더(&N):</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>설명(&D)</translation>
     </message>
     <message>
@@ -5002,7 +5450,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>만약 선택하면 가상 머신을 실행하는 동안 CD/DVD나 플로피 미디어가 마운트된 상태의 변경 사항을 저장하여 다음 번 실행 때 사용할 수 있도록 합니다.</translation>
+        <translation type="obsolete">만약 선택하면 가상 머신을 실행하는 동안 CD/DVD나 플로피 미디어가 마운트된 상태의 변경 사항을 저장하여 다음 번 실행 때 사용할 수 있도록 합니다.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5046,38 +5494,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>이동식 미디어:</translation>
+        <translation type="obsolete">이동식 미디어:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>실행 중 변경 사항 기억하기(&R)</translation>
+        <translation type="obsolete">실행 중 변경 사항 기억하기(&R)</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>작은 도구 모음:</translation>
+        <translation type="obsolete">작은 도구 모음:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>선택하면 전체 화면 및 심리스 모드에서 작은 도구 모음을 표시합니다.</translation>
+        <translation type="obsolete">선택하면 전체 화면 및 심리스 모드에서 작은 도구 모음을 표시합니다.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>전체 화면/심리스 모드에서 보이기(&F)</translation>
+        <translation type="obsolete">전체 화면/심리스 모드에서 보이기(&F)</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>선택하면 작은 도구 모음을 화면 아래 대신 위에 표시합니다.</translation>
+        <translation type="obsolete">선택하면 작은 도구 모음을 화면 아래 대신 위에 표시합니다.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>화면 위에 보이기(&T)</translation>
+        <translation type="obsolete">화면 위에 보이기(&T)</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">이 가상 머신에 64비트 게스트 운영 체제를 사용하려면 하드웨어 가상화(VT-x/AMD-V)가 필요하므로, 이 기능은 자동으로 활성화됩니다.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>드래그 앤 드롭(&D):</translation>
     </message>
     <message>
@@ -5092,6 +5540,126 @@ p, li { white-space: pre-wrap; }
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation>가상 머신 운영 체제 종류가 64비트로 지정되었습니다. 64비트 게스트 운영 체제는 하드웨어 가상화 기능을 필요로 하므로 변경 사항을 저장하면 자동적으로 활성화될 것입니다.</translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation>암호화(&R)</translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>선택하면 이 가상 머신을 암호화합니다.</translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation>암호화 사용(&A)</translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation>암호화 방식(&I):</translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>가상 머신 디스크를 암호화할 방식을 지정합니다.</translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation>새 암호 입력(&N):</translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>가상 머신에 사용할 암호를 지정합니다.</translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation>새 암호 확인(&O):</translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>가상 머신에 사용할 암호를 확인합니다.</translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>이 가상 머신을 암호화하려면 <i>%1</i>을(를) 설치해야 합니다. VirtualBox 다운로드 사이트에서 게스트 확장을 설치하십시오.</translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation>암호화 방식을 지정하지 않았습니다.</translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation>암호가 비어 있습니다.</translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation>암호가 일치하지 않습니다.</translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>변경하지 않음</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>VM 메뉴 표시줄을 수정할 수 있도록 합니다.</translation>
+    </message>
+    <message>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">크기 조정 비율:</translation>
+    </message>
+    <message>
+        <source>This setting determines the guest screen scale factor.</source>
+        <translation type="obsolete">이 설정은 게스트 크기 조정 비율을 결정합니다.</translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="obsolete">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="obsolete">HiDPI:</translation>
+    </message>
+    <message>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">선택하면 게스트 화면 내용이 호스트의 높은 해상도에 맞도록 조정되지 않습니다.</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">조정되지 않은 HiDPI 출력 사용(&U)</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation>작은 도구 모음:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation>선택하면 전체 화면 및 심리스 모드에서 작은 도구 모음을 표시합니다.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation>전체 화면/심리스 모드에서 보이기(&F)</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation>선택하면 작은 도구 모음을 화면 아래 대신 위에 표시합니다.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation>화면 위에 보이기(&T)</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>VM 상태 표시줄을 수정할 수 있도록 합니다.</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5662,10 +6230,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>선택하면 이 공유 폴더를 항상 사용합니다.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5716,11 +6280,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>만약 선택한다면 가상 머신을 시작할 때 <b>포트 경로</b>에 지정한 파이프를 만듭니다. 그렇지 않다면 가상 머신에서는 존재하는 파이프를 사용하려고 시도합니다.</translation>
+        <translation type="obsolete">만약 선택한다면 가상 머신을 시작할 때 <b>포트 경로</b>에 지정한 파이프를 만듭니다. 그렇지 않다면 가상 머신에서는 존재하는 파이프를 사용하려고 시도합니다.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>파이프 만들기(&C)</translation>
+        <translation type="obsolete">파이프 만들기(&C)</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5728,11 +6292,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation><b>호스트 파이프</b> 모드로 작동할 때는 직렬 포트의 파이프 경로를 표시하고, <b>호스트 장치</b> 모드로 작동할 때는 호스트의 직렬 장치 이름을 표시합니다.</translation>
+        <translation type="obsolete"><b>호스트 파이프</b> 모드로 작동할 때는 직렬 포트의 파이프 경로를 표시하고, <b>호스트 장치</b> 모드로 작동할 때는 호스트의 직렬 장치 이름을 표시합니다.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>포트/파일 경로(&P):</translation>
+        <translation type="obsolete">포트/파일 경로(&P):</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5742,6 +6306,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>이 직렬 포트의 기본 I/O 포트 주소를 표시합니다. 16진수 숫자<tt>0</tt>부터 <tt>0xFFFF</tt> 사이의 숫자를 사용할 수 있습니다.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation>선택하면 가상 머신에 지정한 <b>경로/주소</b>에 있는 파이프나 소켓을 존재하는 것으로 간주하고 사용합니다. 선택하지 않으면 가상 머신을 시작할 때 파이프나 소켓을 만듭니다.</translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>존재하는 파이프/소켓에 연결(&C)</translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation>경로/주소(&P):</translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation><p><b>호스트 파이프</b> 모드: 호스트의 시리얼 포트 파이프 이름을 지정합니다. 예: Windows의 경우 "\\.\pipe\myvbox", 유닉스 계열 시스템의 경우 "/tmp/myvbox".</p><p><b>호스트 장치</b> 모드: 호스트의 시리얼 포트 장치 이름을 지정합니다. 예: "COM1", "/dev/ttyS0".</p><p><b>원본 파일</b> 모드: 시리얼 출력을 저장할 호스트의 파일 경로를 지정합니다.</p><p><b>TCP</b> 모드: 서버 모드의 경우 TCP "포트", 클라이언트 모드의 경우 "호스트이름:포트"를 지정합니다.</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5858,11 +6438,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>CD/DVD&nbsp;장치&nbsp;추가하기</nobr></translation>
+        <translation type="obsolete"><nobr>CD/DVD&nbsp;장치&nbsp;추가하기</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>플로피&nbsp;장치&nbsp;추가하기</nobr></translation>
+        <translation type="obsolete"><nobr>플로피&nbsp;장치&nbsp;추가하기</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -5906,11 +6486,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>CD/DVD 장치 추가하기</translation>
+        <translation type="obsolete">CD/DVD 장치 추가하기</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>플로피 장치 추가하기</translation>
+        <translation type="obsolete">플로피 장치 추가하기</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6098,15 +6678,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD 드라이브(&D):</translation>
+        <translation type="obsolete">CD/DVD 드라이브(&D):</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>가상 CD/DVD 디스크나 가상 드라이브처럼 사용할 실제 드라이브를 선택하십시오. 가상 머신은 드라이브 안에 있는 디스크나 파일에 있는 데이터를 가상 디스크에 있는 데이터처럼 처리합니다.</translation>
+        <translation type="obsolete">가상 CD/DVD 디스크나 가상 드라이브처럼 사용할 실제 드라이브를 선택하십시오. 가상 머신은 드라이브 안에 있는 디스크나 파일에 있는 데이터를 가상 디스크에 있는 데이터처럼 처리합니다.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>가상 CD/DVD 드라이브 설정</translation>
+        <translation type="obsolete">가상 CD/DVD 드라이브 설정</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6130,7 +6710,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>가상 CD/DVD 디스크 파일 선택...</translation>
+        <translation type="obsolete">가상 CD/DVD 디스크 파일 선택...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6214,6 +6794,54 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>%1 칩셋이 지원하는 개수 이상의 저장소 컨트롤러를 사용하고 있습니다. 시스템 설정 페이지에서 칩셋 종류를 바꾸거나 저장소 설정 페이지의 다음 저장소 컨트롤러의 개수를 줄이십시오: %2</translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation>USB 컨트롤러 추가</translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation>선택하면 이 디스크를 핫플러그 가능한 장치로 표시합니다.</translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>핫플러그 가능(&H)</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>가상 광학 디스크 파일 선택...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>광학&nbsp;드라이브&nbsp;추가</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>플로피&nbsp;드라이브&nbsp;추가</nobr></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>광학 드라이브 추가</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>플로피 드라이브 추가</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>광학 드라이브(&D):</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>가상 광학 디스크나 가상 드라이브처럼 사용할 실제 드라이브를 선택하십시오. 가상 머신은 드라이브 안에 있는 디스크나 파일에 있는 데이터를 가상 디스크에 있는 데이터처럼 처리합니다.</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>가상 광학 드라이브 설정</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -6456,11 +7084,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>시스템 페이지의 메인보드 영역에서 I/O APIC를 활성화하지 않았습니다. ICH9 칩셋을 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
+        <translation type="obsolete">시스템 페이지의 메인보드 영역에서 I/O APIC를 활성화하지 않았습니다. ICH9 칩셋을 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
     </message>
     <message>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>USB 페이지에서 USB 컨트롤러 에뮬레이션이 꺼져 있습니다. USB 입력 장치를 사용하려면 켜져 있어야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
+        <translation type="obsolete">USB 페이지에서 USB 컨트롤러 에뮬레이션이 꺼져 있습니다. USB 입력 장치를 사용하려면 켜져 있어야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
     </message>
     <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
@@ -6472,16 +7100,40 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>시스템 페이지의 메인보드 영역에서 I/O APIC를 활성화하지 않았습니다. 하나 이상의 가상 프로세서를 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
+        <translation type="obsolete">시스템 페이지의 메인보드 영역에서 I/O APIC를 활성화하지 않았습니다. 하나 이상의 가상 프로세서를 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
     </message>
     <message>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>시스템 페이지의 가속 영역에서 하드웨어 가속을 활성화하지 않았습니다. 하나 이상의 가상 프로세서를 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
+        <translation type="obsolete">시스템 페이지의 가속 영역에서 하드웨어 가속을 활성화하지 않았습니다. 하나 이상의 가상 프로세서를 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
     </message>
     <message>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation>실행 제한을 너무 낮게 설정하였습니다. 가상 머신이 느리게 작동할 수 있습니다.</translation>
     </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation>반가상화 인터페이스(&P):</translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>현재 가상 머신에서 사용할 반가상화 게스트 인터페이스 공급자를 선택합니다.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>시스템 페이지의 메인보드 영역에서 I/O APIC를 활성화하지 않았습니다. 이 가상 머신에 지정한 ICH9 칩셋을 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>USB 페이지에서 USB 컨트롤러 에뮬레이션을 활성화하지 않았습니다. 이 가상 머신에서 USB 입력 장치 에뮬레이션을 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>시스템 페이지의 메인보드 영역에서 I/O APIC를 활성화하지 않았습니다. 이 가상 머신에 지정한 두 개 이상의 가상 프로세서를 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>시스템 페이지의 가속 영역에서 하드웨어 가상화를 활성화하지 않았습니다. 이 가상 머신에 지정한 두 개 이상의 가상 프로세서를 사용하려면 이 기능을 활성화해야 합니다. 변경 사항을 저장하면 자동으로 켜질 것입니다.</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSB</name>
@@ -6552,7 +7204,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>USB 2.0 EHCI 컨트롤러 사용하기(&H)</translation>
+        <translation type="obsolete">USB 2.0 EHCI 컨트롤러 사용하기(&H)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6616,7 +7268,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>현재 가상 머신에서 USB 2.0을 사용할 수 있으나, <b>%1</b>을(를) 설치해야 합니다. 가상 머신을 시작하려면 VirtualBox 다운로드 사이트에서 확장 기능 패키지를 설치하거나 USB 2.0을 비활성화시키십시오.</translation>
+        <translation type="obsolete">현재 가상 머신에서 USB 2.0을 사용할 수 있으나, <b>%1</b>을(를) 설치해야 합니다. 가상 머신을 시작하려면 VirtualBox 다운로드 사이트에서 확장 기능 패키지를 설치하거나 USB 2.0을 비활성화시키십시오.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation>선택하면 이 가상 머신의 USB OHCI 컨트롤러를 사용합니다. USB OHCI 컨트롤러는 USB 1.0을 지원합니다.</translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>USB 1.1(OHCI) 컨트롤러(&1)</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>USB 2.0(EHCI) 컨트롤러(&2)</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>선택하면 이 가상 머신의 USB xHCI 컨트롤러를 사용합니다. USB xHCI 컨트롤러는 USB 3.0을 지원합니다.</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>USB 3.0(xHCI) 컨트롤러(&3)</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>현재 가상 머신에서 USB 2.0/3.0을 사용할 수 있으나, <b>%1</b>을(를) 설치해야 합니다. 가상 머신을 시작하려면 VirtualBox 다운로드 사이트에서 확장 기능 패키지를 설치하거나 USB 2.0/3.0을 비활성화시키십시오.</translation>
     </message>
 </context>
 <context>
@@ -6755,7 +7431,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>닫기(&L)</translation>
+        <translation type="obsolete">닫기(&L)</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation>미디어 제거 중...</translation>
     </message>
 </context>
 <context>
@@ -6774,6 +7454,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>가상 화면 크기 조정</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>가상 화면 매핑</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>닫기</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>전환</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>메뉴 표시줄 활성화</translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6815,7 +7518,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>VirtualBox COM 개체를 만들 수 없습니다.</p><p>프로그램을 종료합니다.</p></translation>
+        <translation type="obsolete"><p>VirtualBox COM 개체를 만들 수 없습니다.</p><p>프로그램을 종료합니다.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -7008,15 +7711,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>언어 파일 <b><nobr>%1</nobr></b>을(를) 불러올 수 없습니다.<p>언어를 내장되어 있는 영어로 초기화합니다. VirtualBox 주 창의 <b>파일</b> 메뉴의 <b>환경 설정</b> 대화상자를 연 다음, <b>언어</b> 페이지에 있는 언어 중 하나를 선택하십시오.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>게스트 운영 체제에 설치된 VirtualBox 게스트 확장이 너무 오래되었습니다. 예상하는 버전은 %2이지만 설치된 버전은 %1입니다. 마우스 통합, 게스트 디스플레이 자동 크기 조정 같은 게스트 확장이 필요한 기능들이 작동하지 않을 수 있습니다.</p><p><b>장치</b> 메뉴의 <b>게스트 확장 설치</b> 항목을 선택하셔서 새 버전의 게스트 확장을 설치하십시오.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>게스트 운영 체제에 설치된 VirtualBox 게스트 확장이 오래되었습니다. 예상하는 버전은 %2이지만 설치된 버전은 %1입니다. 마우스 통합, 게스트 디스플레이 자동 크기 조정 같은 게스트 확장이 필요한 기능들이 예상한 대로 작동하지 않을 수 있습니다.</p><p><b>장치</b> 메뉴의 <b>게스트 확장 설치</b> 항목을 선택하셔서 새 버전의 게스트 확장을 설치하십시오.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>게스트 운영 체제에 설치된 VirtualBox 게스트 확장의 버전이 높습니다. 예상하는 버전은 %2이지만 설치된 버전은 %1입니다.</p>새 버전의 게스트 확장을 오래된 버전의 VirtualBox에서 사용하는 것은 지원되지 않습니다. <b>장치</b> 메뉴의 <b>게스트 확장 설치</b> 항목을 선택하셔서 현재 버전의 게스트 확장을 설치하십시오.</p></translation>
     </message>
     <message>
@@ -7117,9 +7820,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">다운로드</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">마운트</translation>
+        <translation type="obsolete">마운트</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7357,8 +8060,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>다음 이유로 VirtualBox 온라인 등록 서비스에 연결할 수 없습니다:</p><p><b>%1</b></p></translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>VirtualBox 새 버전이 출시되었습니다! <a href="https://www.virtualbox.org/">virtualbox.org</a> 웹 사이트에 새 버전 <b>%1</b>이(가) 올라와 있습니다.</p><p>이 링크를 사용해서 새 버전을 다운로드하십시오:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>VirtualBox 새 버전이 출시되었습니다! <a href="http://www.virtualbox.org/">virtualbox.org</a> 웹 사이트에 새 버전 <b>%1</b>이(가) 올라와 있습니다.</p><p>이 링크를 사용해서 새 버전을 다운로드하십시오:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following error:</p><p><b>%1</b></p></source>
@@ -7366,7 +8069,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>하나 이상의 등록된 가상 하드 디스크나, CD/DVD 또는 플로피 미디어에 접근할 수 없습니다. 접근할 수 있게 될 때까지 이들 미디어를 사용하는 가상 머신을 작동할 수 없습니다.</p><p><b>검사하기</b> 단추를 눌러서 가상 미디어 관리자를 연 다음 어떤 미디어에 접근할 수 없는가 확인하거나, <b>무시</b> 단추를 눌러서 이 메시지를 무시할 수 있습니다.</p></translation>
+        <translation type="obsolete"><p>하나 이상의 등록된 가상 하드 디스크나, CD/DVD 또는 플로피 미디어에 접근할 수 없습니다. 접근할 수 있게 될 때까지 이들 미디어를 사용하는 가상 머신을 작동할 수 없습니다.</p><p><b>검사하기</b> 단추를 눌러서 가상 미디어 관리자를 연 다음 어떤 미디어에 접근할 수 없는가 확인하거나, <b>무시</b> 단추를 눌러서 이 메시지를 무시할 수 있습니다.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -7396,8 +8099,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">덮어쓰기(&V)</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>가상 머신을 실행하는 중 치명적 오류가 발생하였고 가상 머신의 실행이 중단되었습니다.</p><p>도움말을 보시려면 <a href="https://www.virtualbox.org">https://www.virtualbox.org</a> 사이트의 커뮤니티 섹션을 참조하거나 지원 업체에 연락하십시오. <nobr><b>%1</b></nobr> 디렉터리에 있는 로그 파일 <tt>VBox.log</tt>와 이미지 파일 <tt>VBox.png</tt>의 내용도 같이 알려 주십시오. 이 파일의 내용은 오류가 발생했을 때 무엇을 하고 있었는지 알려 줍니다. 위 파일들은 주 VirtualBox 창의 <b>머신</b> 메뉴의 <b>로그 보기</b> [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>가상 머신을 실행하는 중 치명적 오류가 발생하였고 가상 머신의 실행이 중단되었습니다.</p><p>도움말을 보시려면 <a href="http://www.virtualbox.org">http://www.virtualbox.org</a> 사이트의 커뮤니티 섹션을 참조하거나 지원 업체에 연락하십시오. <nobr><b>%1</b></nobr> 디렉터리에 있는 로그 파일 <tt>VBox.log</tt>와 이미지 파일 <tt>VBox.png</tt>의 내용도 같이 알려 주십시오. 이 파일의 내용은 오류가 발생했을 때 무엇을 하고 있었는지 알려 줍니다. 위 파일들은 주 VirtualBox 창의 <b>머신</b> 메뉴의 <b>로 [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7680,7 +8383,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>이 CD/DVD 장치를 삭제하시겠습니까?</p><p>CD나 ISO 이미지를 마운트할 수도, 게스트 확장을 설치할 수도 없습니다!</p></translation>
+        <translation type="obsolete"><p>이 CD/DVD 장치를 삭제하시겠습니까?</p><p>CD나 ISO 이미지를 마운트할 수도, 게스트 확장을 설치할 수도 없습니다!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7783,7 +8486,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>CD/DVD 드라이브를 컨트롤러 <b>%1</b>에 추가하려고 하고 있습니다.</p><p>드라이브에 삽입할 가상 CD/DVD 디스크를 선택하거나, 나중에 추가하기 위해서 비워 두시겠습니까?</p></translation>
+        <translation type="obsolete"><p>CD/DVD 드라이브를 컨트롤러 <b>%1</b>에 추가하려고 하고 있습니다.</p><p>드라이브에 삽입할 가상 CD/DVD 디스크를 선택하거나, 나중에 추가하기 위해서 비워 두시겠습니까?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7805,14 +8508,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>CD/DVD 장치 <nobr><b>%1</b></nobr>을(를) 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에서 연결 해제할 수 없습니다.</translation>
+        <translation type="obsolete">CD/DVD 장치 <nobr><b>%1</b></nobr>을(를) 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에서 연결 해제할 수 없습니다.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>플로피 장치 <nobr><b>%1</b></nobr>을(를) 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에서 연결 해제할 수 없습니다.</translation>
+        <translation type="obsolete">플로피 장치 <nobr><b>%1</b></nobr>을(를) 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에서 연결 해제할 수 없습니다.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>현재 가상 머신에서 VirtualBox 게스트 확장을 사용할 수 없는 것 같으며, 공유 폴더를 사용하려면 이 기능이 필요합니다. 가상 머신에서 공유 폴더를 사용하려면, 게스트 확장이 설치되어 있지 않으면 우선 설치하시고, 작동하지 않으면 <b>머신</b> 메뉴의 <b>게스트 확장 설치</b> 항목을 선택하셔서 다시 설치하십시오. 게스트 확장이 설치되어 있으나 가상 머신이 시작하는 중일 때에는 공유 폴더 기능이 작동하지 않습니다.</p></translation>
     </message>
     <message numerus="yes">
@@ -7859,19 +8562,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>CD/DVD 장치 <nobr><b>%1</b></nobr>을(를) 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에 연결할 수 없습니다.</translation>
+        <translation type="obsolete">CD/DVD 장치 <nobr><b>%1</b></nobr>을(를) 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에 연결할 수 없습니다.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>플로피 장치 <nobr><b>%1</b></nobr>을(를) 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에 연결할 수 없습니다.</translation>
+        <translation type="obsolete">플로피 장치 <nobr><b>%1</b></nobr>을(를) 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에 연결할 수 없습니다.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>이 미디어의 저장소 유닛은 삭제되지 않을 것이며 다음에 다시 사용할 때 추가할 수 있습니다.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation type="unfinished"><p>현재 가상 머신에서 VirtualBox 게스트 확장을 사용할 수 없는 것 같으며, 공유 폴더를 사용하려면 이 기능이 필요합니다. 가상 머신에서 공유 폴더를 사용하려면, 게스트 확장이 설치되어 있지 않으면 우선 설치하시고, 작동하지 않으면 <b>장치</b> 메뉴의 <b>게스트 확장 설치</b> 항목을 선택하셔서 다시 설치하십시오. 게스트 확장이 설치되어 있으나 가상 머신이 시작하는 중일 때에는 공유 폴더 기능이 작동하지 않습니다.</p></translation>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>현재 가상 머신에서 VirtualBox 게스트 확장을 사용할 수 없는 것 같으며, 공유 폴더를 사용하려면 이 기능이 필요합니다. 가상 머신에서 공유 폴더를 사용하려면, 게스트 확장이 설치되어 있지 않으면 우선 설치하시고, 작동하지 않으면 <b>장치</b> 메뉴의 <b>게스트 확장 설치</b> 항목을 선택하셔서 다시 설치하십시오. 게스트 확장이 설치되어 있으나 가상 머신이 시작하는 중일 때에는 공유 폴더 기능이 작동하지 않습니다.</p></translation>
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -8112,7 +8815,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>데이터를 드롭할 수 없습니다.</translation>
+        <translation type="obsolete">데이터를 드롭할 수 없습니다.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -8347,11 +9050,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p><b>VirtualBox 게스트 확장</b> 디스크 이미지 파일을 <nobr><a href="%1">%1</a></nobr>에서 다운로드했으며 <nobr><b>%2</b></nobr>에 저장했습니다.</p><p>이 디스크 이미지를 등록하고 가상 CD/DVD 드라이브에 마운트하시겠습니까?</p></translation>
+        <translation type="obsolete"><p><b>VirtualBox 게스트 확장</b> 디스크 이미지 파일을 <nobr><a href="%1">%1</a></nobr>에서 다운로드했으며 <nobr><b>%2</b></nobr>에 저장했습니다.</p><p>이 디스크 이미지를 등록하고 가상 CD/DVD 드라이브에 마운트하시겠습니까?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>가상 머신 <b>%1</b>에는 CD/DVD 드라이브가 없기 때문에 <b>VirtualBox 게스트 확장</b> 디스크 이미지를 마운트할 수 없습니다. 가상 머신 설정 대화상자에서 드라이브를 추가해 주십시오.</p></translation>
+        <translation type="obsolete"><p>가상 머신 <b>%1</b>에는 CD/DVD 드라이브가 없기 때문에 <b>VirtualBox 게스트 확장</b> 디스크 이미지를 마운트할 수 없습니다. 가상 머신 설정 대화상자에서 드라이브를 추가해 주십시오.</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
@@ -8386,71 +9089,186 @@ p, li { white-space: pre-wrap; }
         <translation><p>NAT 네트워크 <nobr><b>%1</b></nobr>을(를) 삭제하시겠습니까?</p><p>하나 이상의 가상 머신 네트워크 어댑터에서 이 네트워크 어댑터를 사용 중이라면 다른 네트워크 이름을 지정하거나 다른 연결 방식을 지정하지 않으면 해당하는 네트워크 어댑터를 사용할 수 없습니다.</p></translation>
     </message>
     <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation>가상 머신 <b>%2</b>에 웹캠 <b>%1</b>을(를) 추가할 수 없습니다.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation>가상 머신 <b>%2</b>에서 웹캠 <b>%1</b>을(를) 제거할 수 없습니다.</translation>
+    </message>
+    <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>현재 가상 머신에서 VirtualBox 게스트 확장을 사용할 수 없는 것 같으며, 공유 폴더를 사용하려면 이 기능이 필요합니다. 가상 머신에서 공유 폴더를 사용하려면, 게스트 확장이 설치되어 있지 않으면 우선 설치하시고, 작동하지 않으면 <b>장치</b> 메뉴의 <b>게스트 확장 설치</b> 항목을 선택하셔서 다시 설치하십시오. 게스트 확장이 설치되어 있으나 가상 머신이 시작하는 중일 때에는 공유 폴더 기능이 작동하지 않습니다.</p></translation>
+        <translation><p>현재 가상 머신에서 VirtualBox 게스트 확장을 사용할 수 없는 것 같으며, 공유 폴더를 사용하려면 이 기능이 필요합니다. 가상 머신에서 공유 폴더를 사용하려면, 게스트 확장이 설치되어 있지 않으면 우선 설치하시고, 작동하지 않으면 <b>장치</b> 메뉴의 <b>게스트 확장 CD 이미지 삽입</b> 항목을 선택하셔서 다시 설치하십시오. 게스트 확장이 설치되어 있으나 가상 머신이 시작하는 중일 때에는 공유 폴더 기능이 작동하지 않습니다.</p></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">마운트</translation>
+        <comment>additions</comment>
+        <translation>삽입</translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation type="unfinished"></translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation><p>가상 화면의 색 농도가 <b>%1비트</b>로 설정되어 있습니다. 최적화된 성능을 위하여 <b>%2비트</b>로 전환하는 것을 추천합니다. 게스트 운영 체제의 시스템 설정의 <b>디스플레이</b> 부분을 참고하십시오.</p></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation type="unfinished"></translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation>현재 포트 포워딩 규칙이 올바르지 않습니다. 규칙 이름은 유일해야 합니다.</translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation type="unfinished"></translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation>현재 포트 포워딩 규칙이 올바르지 않습니다. 일부 규칙에서 동일한 호스트 포트를 사용하나 IP 주소가 충돌합니다.</translation>
     </message>
-</context>
-<context>
-    <name>UIMiniProcessWidgetAdditions</name>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">취소</translation>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>VirtualBoxClient COM 개체를 만들 수 없습니다.</p><p>프로그램을 종료합니다.</p></translation>
     </message>
     <message>
-        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
-        <translation type="obsolete">VirtualBox 게스트 확장 CD 이미지 다운로드 취소</translation>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation>전역 VirtualBox 추가 데이터의 키 <i>%1</i>의 값 <i>{%2}</i>을(를) 설정할 수 없습니다.</translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
-        <translation type="obsolete"><nobr><b>%1</b></nobr>에서 VirtualBox 게스트 확장 CD 이미지 다운로드 중...</translation>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation>가상 머신 <i>%2</i>의 추가 데이터의 키 <i>%1</i>의 값 <i>{%3}</i>을(를) 설정할 수 없습니다.</translation>
     </message>
-</context>
-<context>
-    <name>UIMiniProcessWidgetUserManual</name>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">취소</translation>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>하나 이상의 등록된 가상 하드 디스크나, 광학 디스크 및 플로피 디스크 이미지 파일에 접근할 수 없습니다. 접근할 수 있게 될 때까지 이들 미디어를 사용하는 가상 머신을 작동할 수 없습니다.</p><p><b>검사하기</b> 단추를 눌러서 가상 미디어 관리자를 연 다음 어떤 미디어에 접근할 수 없는가 확인하거나, <b>무시</b> 단추를 눌러서 이 메시지를 무시할 수 있습니다.</p></translation>
     </message>
     <message>
-        <source>Cancel the VirtualBox User Manual download</source>
-        <translation type="obsolete">VirtualBox 사용자 설명서 다운로드 취소</translation>
+        <source>Failed to save the settings.</source>
+        <translation>설정을 저장할 수 없습니다.</translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox User Manual</source>
-        <translation type="obsolete">VirtualBox 사용자 설명서 다운로드 중</translation>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p>새 광학 드라이브를 컨트롤러 <b>%1</b>에 추가하려고 하고 있습니다.</p><p>드라이브에 삽입할 가상 광학 디스크를 선택하거나, 나중에 추가하기 위해서 비워 두시겠습니까?</p></translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox User Manual <nobr><b>%1</b>...</nobr></source>
-        <translation type="obsolete"><nobr><b>%1</b></nobr>에서 VirtualBox 사용자 설명서 다운로드 중...</translation>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>이 광학 드라이브를 삭제하시겠습니까?</p><p>광학 디스크나 ISO 이미지를 마운트할 수도, 게스트 확장을 설치할 수도 없습니다!</p></translation>
     </message>
-</context>
-<context>
-    <name>UIMiniProgressWidgetAdditions</name>
     <message>
-        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
-        <translation type="obsolete">VirtualBox 게스트 확장 CD 이미지 다운로드 취소</translation>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>광학 드라이브(<nobr><b>%1</b></nobr>)를 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에 연결할 수 없습니다.</translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
-        <translation type="obsolete"><nobr><b>%1</b></nobr>에서 VirtualBox 게스트 확장 CD 이미지 다운로드 중...</translation>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>플로피 드라이브(<nobr><b>%1</b></nobr>)를 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에 연결할 수 없습니다.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>광학 드라이브(<nobr><b>%1</b></nobr>)를 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에서 연결 해제할 수 없습니다.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>플로피 드라이브(<nobr><b>%1</b></nobr>)를 가상 머신 <b>%3</b>의 슬롯 <i>%2</i>에서 연결 해제할 수 없습니다.</translation>
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">가상 머신 <b>%1</b>의 네트워크 어댑터 케이블을 연결할 수 없습니다.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">가상 머신 <b>%1</b>의 네트워크 어댑터 케이블의 연결을 해제할 수 없습니다.</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation><p>가상 머신 <b>%1</b>에는 광학 드라이브가 없기 때문에 <b>VirtualBox 게스트 확장</b> 디스크 이미지를 마운트할 수 없습니다. 가상 머신 설정 대화상자에서 드라이브를 추가해 주십시오.</p></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p><b>VirtualBox 게스트 확장</b> 디스크 이미지 파일을 <nobr><a href="%1">%1</a></nobr>에서 다운로드했으며 <nobr><b>%2</b></nobr>에 저장했습니다.</p><p>이 디스크 이미지를 등록하고 가상 광학 드라이브에 마운트하시겠습니까?</p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation failed.</source>
+        <translation type="obsolete">드래그 앤 드롭 작업이 실패했습니다.</translation>
+    </message>
+    <message>
+        <source>Failed while dropping data.</source>
+        <translation type="obsolete">데이터를 드롭할 수 없습니다.</translation>
+    </message>
+    <message>
+        <source>Unable to cancel drag and drop operation.</source>
+        <translation type="obsolete">드래그 앤 드롭 작업을 취소할 수 없습니다.</translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation>암호가 잘못되었거나 인증이 실패하였습니다.</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation><p>가상 머신을 실행하는 중 치명적 오류가 발생하였고 가상 머신의 실행이 중단되었습니다.</p><p>도움말을 보시려면 <a href="http://www.virtualbox.org">http://www.virtualbox.org</a> 사이트의 커뮤니티 섹션을 참조하거나 지원 업체에 연락하십시오. <nobr><b>%1</b></nobr> 디렉터리에 있는 로그 파일 <tt>VBox.log</tt>와 이미지 파일 <tt>VBox.png</tt> 및 오류가 발생했을 때 무엇을 하고 있었는지 알려 주십시오. 위 파일들은 주 VirtualBox 창의 <b>머신</b> 메뉴의 <b>로그 보기</b> 항목에서도 볼 수 있습니다.</p> [...]
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation><p>가상 머신을 실행하는 중 치명적 오류가 발생하였고 가상 머신의 실행이 중단되었습니다.</p><p>도움말을 보시려면 <a href="http://www.virtualbox.org">http://www.virtualbox.org</a> 사이트의 커뮤니티 섹션을 참조하거나 지원 업체에 연락하십시오. <nobr>가상 머신 로그 디렉터리에 있는 로그 파일 <tt>VBox.log</tt>의 내용 및 오류가 발생했을 때 무엇을 하고 있었는지 알려 주십시오. 위 파일들은 주 VirtualBox 창의 <b>머신</b> 메뉴의 <b>로그 보기</b> 항목에서도 볼 수 있습니다.</p><p>가상 머신의 전원을 끄려면 <b>확인</b> 단추를 누르십시오.< [...]
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation><p>VirtualBox 새 버전이 출시되었습니다! <a href="http://www.virtualbox.org/">virtualbox.org</a> 웹 사이트에 새 버전 <b>%1</b>이(가) 올라와 있습니다.</p><p>이 링크를 사용해서 새 버전을 다운로드하십시오:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProcessWidgetAdditions</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">취소</translation>
+    </message>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">VirtualBox 게스트 확장 CD 이미지 다운로드 취소</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete"><nobr><b>%1</b></nobr>에서 VirtualBox 게스트 확장 CD 이미지 다운로드 중...</translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProcessWidgetUserManual</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">취소</translation>
+    </message>
+    <message>
+        <source>Cancel the VirtualBox User Manual download</source>
+        <translation type="obsolete">VirtualBox 사용자 설명서 다운로드 취소</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox User Manual</source>
+        <translation type="obsolete">VirtualBox 사용자 설명서 다운로드 중</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox User Manual <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete"><nobr><b>%1</b></nobr>에서 VirtualBox 사용자 설명서 다운로드 중...</translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProgressWidgetAdditions</name>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">VirtualBox 게스트 확장 CD 이미지 다운로드 취소</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete"><nobr><b>%1</b></nobr>에서 VirtualBox 게스트 확장 CD 이미지 다운로드 중...</translation>
     </message>
 </context>
 <context>
@@ -8486,7 +9304,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>이름(&N):</translation>
     </message>
     <message>
@@ -9345,14 +10163,18 @@ p, li { white-space: pre-wrap; }
         <translation>가상 머신 파일 (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>VirtualBox에 오신 것을 환영합니다!</h3><p>이 창의 왼쪽 부분은 컴퓨터에 있는 모든 가상 머신 목록을 표시합니다. 아직 가상 머신을 만들지 않았기 때문에 이 목록은 현재 비어 있습니다.<img src=:/welcome.png align=right/></p><p>새 가상 머신을 만드시려면, 창 위쪽 도구 모음의 <b>새로 만들기</b> 단추를 누르십시오.</p><p><b>%1</b> 키를 누르면 상황에 맞는 도움말을 볼 수 있으며, 최근 정보와 뉴스를 보려면 <a href=https://www.virtualbox.org>www.virtualbox.org</a>를 방문하십시오.</p></translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>VirtualBox에 오신 것을 환영합니다!</h3><p>이 창의 왼쪽 부분은 컴퓨터에 있는 모든 가상 머신 목록을 표시합니다. 아직 가상 머신을 만들지 않았기 때문에 이 목록은 현재 비어 있습니다.<img src=:/welcome.png align=right/></p><p>새 가상 머신을 만드시려면, 창 위쪽 도구 모음의 <b>새로 만들기</b> 단추를 누르십시오.</p><p><b>%1</b> 키를 누르면 상황에 맞는 도움말을 볼 수 있으며, 최근 정보와 뉴스를 보려면 <a href=http://www.virtualbox.org>www.virtualbox.org</a>를 방문하십시오.</p></translation>
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>관리자</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation><h3>VirtualBox에 오신 것을 환영합니다!</h3><p>이 창의 왼쪽 부분은 컴퓨터에 있는 모든 가상 머신 목록을 표시합니다. 아직 가상 머신을 만들지 않았기 때문에 이 목록은 현재 비어 있습니다.<img src=:/welcome.png align=right/></p><p>새 가상 머신을 만드시려면, 창 위쪽 주 도구 모음의 <b>새로 만들기</b> 단추를 누르십시오.</p><p><b>%1</b> 키를 누르면 상황에 맞는 도움말을 볼 수 있으며, 최근 정보와 뉴스를 보려면 <a href=https://www.virtualbox.org>www.virtualbox.org</a>를 방문하십시오.</p></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9385,7 +10207,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Settings</source>
-        <translation>설정</translation>
+        <translation type="obsolete">설정</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -9438,6 +10260,10 @@ p, li { white-space: pre-wrap; }
         <source>Display</source>
         <translation>디스플레이</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation>환경 설정</translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -9513,6 +10339,43 @@ p, li { white-space: pre-wrap; }
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">%1 칩셋이 지원하는 개수 이상의 저장소 컨트롤러를 사용하고 있습니다. 시스템 설정 페이지에서 칩셋 종류를 바꾸거나 저장소 설정 페이지의 다음 저장소 컨트롤러의 개수를 줄이십시오: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation>사용자 인터페이스</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation>설정</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>설정 불러오는 중...</translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation>설정 저장하는 중...</translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation><nobr>표시기를 켜거나 끄려면 <b>누르십시오</b>.</nobr><br><nobr>표시기 위치를 변경하려면 <b>드래그 앤 드롭</b>을 사용하십시오.</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation>닫기</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation>상태 표시줄 활성화</translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -9612,8 +10475,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>이 마법사는 VirtualBox 웹 사이트에 접속해서 새 버전이 있는지 확인합니다.</p><p>새 버전을 지금 확인하려면 <b>검사하기</b> 단추를 누르고, 나중에 확인하려면 <b>취소</b> 단추를 누르십시오.</p><p><b>도움말</b> 메뉴에서 <b>업데이트 찾기...</b> 항목을 선택해서 언제든지 이 마법사를 실행할 수 있습니다.</p></translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>VirtualBox 새 버전이 출시되었습니다! <a href="https://www.virtualbox.org/">virtualbox.org</a> 웹 사이트에 새 버전 <b>%1</b>이(가) 올라와 있습니다.</p><p>이 링크를 사용해서 새 버전을 다운로드하십시오:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>VirtualBox 새 버전이 출시되었습니다! <a href="http://www.virtualbox.org/">virtualbox.org</a> 웹 사이트에 새 버전 <b>%1</b>이(가) 올라와 있습니다.</p><p>이 링크를 사용해서 새 버전을 다운로드하십시오:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -9677,6 +10540,14 @@ p, li { white-space: pre-wrap; }
         <source>&Restore current snapshot '%1'</source>
         <translation>현재 스냅샷 '%1'(으)로 되돌리기(&R)</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>계속 배경에서 실행(&C)</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><p>가상 머신 창을 닫지만 계속 실행되도록 합니다.</p><p>VirtualBox 관리자를 사용하여 가상 머신 창을 다시 볼 수 있습니다.</p></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -9690,6 +10561,165 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - 세션 정보</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">자세한 정보(&D)</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">실행 시간(&R)</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA 전송</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO 전송</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>읽은 데이터</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>쓴 데이터</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>보낸 데이터</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>받은 데이터</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>런타임 속성</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>화면 해상도</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">CD/DVD 통계</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">네트워크 어댑터 통계</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">버전 %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>알 수 없음</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>알 수 없음</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>게스트 확장</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>게스트 운영 체제 종류</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">하드 디스크 통계</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">하드 디스크 없음</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>네트워크 어댑터 없음</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">사용함</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">사용 안함</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">네스티드 페이징</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">사용할 수 없음</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>저장소 통계</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>저장소 없음</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>네트워크 통계</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">네스티드 페이징</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>사용할 수 없음</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>클립보드 모드</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">드래그 앤 드롭 모드</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>설정 정보(&D)</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>런타임 정보(&R)</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation>VM 실행 시간</translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation>드래그 앤 드롭 모드</translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -9840,11 +10870,27 @@ p, li { white-space: pre-wrap; }
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>설명 숨기기</translation>
+        <translation type="obsolete">설명 숨기기</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>설명 보이기</translation>
+        <translation type="obsolete">설명 보이기</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation>전문가 모드(&E)</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation>고급 사용자를 위한 하나의 대화상자인 <nobr><b>전문가 모드</b></nobr>로 전환합니다.</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>가이드 모드(&G)</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation>단계별 설명을 포함한 마법사인 <nobr><b>가이드 모드</b></nobr>로 전환합니다.</translation>
     </message>
 </context>
 <context>
@@ -10713,11 +11759,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">공유 폴더 대화상자를 엽니다</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">게스트 확장 설치(&I)...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">게스트 확장 설치 이미지를 마운트합니다</translation>
     </message>
     <message>
@@ -10932,7 +11978,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">세션 정보 대화상자(&N)</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">세션 정보 대화 상자 보이기</translation>
     </message>
     <message>
@@ -11141,8 +12187,8 @@ p, li { white-space: pre-wrap; }
         <translation><기본값으로 초기화></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">실제 기본 경로는 이 대화 상자의 변경 사항을 저장하고 다시 시작했을 때 표시됩니다.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">실제 기본 경로는 이 대화 상자의 변경 사항을 저장하고 다시 시작했을 때 표시됩니다.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -11190,8 +12236,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">실제 기본 경로는 이 대화 상자의 변경 사항을 저장하고 다시 시작했을 때 표시됩니다.</translation>
+        <translation>실제 기본 경로는 이 대화 상자의 변경 사항을 저장하고 다시 시작했을 때 표시됩니다.</translation>
     </message>
 </context>
 <context>
@@ -11532,7 +12577,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -12326,17 +13371,17 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>이 하드 디스크를 추가하면 차이만 기록하는 새 하드 디스크를 추가할 것입니다.</translation>
+        <translation type="obsolete">이 하드 디스크를 추가하면 차이만 기록하는 새 하드 디스크를 추가할 것입니다.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>이 하드 디스크의 미디어 중 일부에 접근할 수 없습니다. 가상 미디어 관리자의 <b>변경 사항을 저장하는 하드 디스크 보이기</b> 모드를 사용하셔서 이 미디어를 찾아 보십시오.</translation>
+        <translation type="obsolete">이 하드 디스크의 미디어 중 일부에 접근할 수 없습니다. 가상 미디어 관리자의 <b>변경 사항을 저장하는 하드 디스크 보이기</b> 모드를 사용하셔서 이 미디어를 찾아 보십시오.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>이 기본 하드 디스크는 다음 변경 사항만 기록하는 하드 디스크를 통해서 간접적으로 추가되어 있습니다:</translation>
+        <translation type="obsolete">이 기본 하드 디스크는 다음 변경 사항만 기록하는 하드 디스크를 통해서 간접적으로 추가되어 있습니다:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -12376,7 +13421,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -12938,12 +13983,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>사용함</translation>
+        <translation type="obsolete">사용함</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>사용 안함</translation>
+        <translation type="obsolete">사용 안함</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -13006,7 +14051,151 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>USB 포트 %1</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>끔</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation>반가상화 인터페이스</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>없음</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>기본값</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>레거시</translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>최소</translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation>새 동적 확장 저장소</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>활성화됨</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>비활성화됨</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>활성화됨</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>비활성화됨</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>활성화됨</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>비활성화됨</translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>스냅샷 찍는 중</translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>온라인 스냅샷 찍는 중</translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation>KVM</translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation>광학</translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>OHCI</translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>EHCI</translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>xHCI</translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation>사용자 인터페이스</translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation>(광학 드라이브)</translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>이 하드 디스크를 추가하면 차이만 기록하는 새 하드 디스크를 추가할 것입니다.</translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation>이 하드 드라이브 체인 중 일부 파일에 접근할 수 없습니다. 가상 미디어 관리자에서 파일을 확인하십시오.</translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>이 기본 하드 디스크는 다음 변경 사항만 기록하는 하드 디스크를 통해서 간접적으로 추가되어 있습니다:</translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -13314,6 +14503,18 @@ p, li { white-space: pre-wrap; }
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">새 가상 하드 드라이브 만들기</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation>UUID:</translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13399,8 +14600,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">연결 협상을 진행할 수 없습니다.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>이 등록 양식을 작성하셔서 VirtualBox를 사용하고 있다는 것을 알려 주십시오. 선택적으로 VirtualBox 뉴스와 업데이트를 받을 수도 있습니다.</p><p>영문자로 전체 이름을 작성하시고 전자 우편 주소를 적어 주십시오. 썬 마이크로시스템즈에서는 수집한 개인 정보를 제 3자에게 보내지 않으며, 이 정보를 사용하여 VirtualBox 사용 통계를 모으고 연락하는 데만 사용할 것입니다. 개인 정보를 어떻게 사용하는가에 대해서 알아보시려면 VirtualBox 설명서의 <b>개인 정보 정책</b> 섹션이나 VirtualBox 웹 사이트의 <a href=https://www.virtualbox.org/wiki/PrivacyPolicy>개인 정보 정책</a>을 참고하십시오.</p></translation>
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>이 등록 양식을 작성하셔서 VirtualBox를 사용하고 있다는 것을 알려 주십시오. 선택적으로 VirtualBox 뉴스와 업데이트를 받을 수도 있습니다.</p><p>영문자로 전체 이름을 작성하시고 전자 우편 주소를 적어 주십시오. 썬 마이크로시스템즈에서는 수집한 개인 정보를 제 3자에게 보내지 않으며, 이 정보를 사용하여 VirtualBox 사용 통계를 모으고 연락하는 데만 사용할 것입니다. 개인 정보를 어떻게 사용하는가에 대해서 알아보시려면 VirtualBox 설명서의 <b>개인 정보 정책</b> 섹션이나 VirtualBox 웹 사이트의 <a href=http://www.virtualbox.org/wiki/PrivacyPolicy>개인 정보 정책</a>을 참고하십시오.</p></translation>
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -13419,8 +14620,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">국가 및 지역 선택</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>이 등록 양식을 작성하셔서 VirtualBox를 사용하고 있다는 것을 알려 주십시오. 선택적으로 VirtualBox 뉴스와 업데이트를 받을 수도 있습니다.</p><p>영문자로 전체 이름을 작성하시고 전자 우편 주소를 적어 주십시오. Sun 마이크로시스템즈에서는 수집한 개인 정보를 제 3자에게 보내지 않으며, 이 정보를 사용하여 VirtualBox 사용 통계를 모으고 연락하는 데만 사용할 것입니다. 개인 정보를 어떻게 사용하는가에 대해서 알아보시려면 VirtualBox 설명서의 <b>개인 정보 정책</b> 섹션이나 VirtualBox 웹 사이트의 <a href=https://www.virtualbox.org/wiki/PrivacyPolicy>개인 정보 정책</a>을 참고하십시오.</p></translation>
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>이 등록 양식을 작성하셔서 VirtualBox를 사용하고 있다는 것을 알려 주십시오. 선택적으로 VirtualBox 뉴스와 업데이트를 받을 수도 있습니다.</p><p>영문자로 전체 이름을 작성하시고 전자 우편 주소를 적어 주십시오. Sun 마이크로시스템즈에서는 수집한 개인 정보를 제 3자에게 보내지 않으며, 이 정보를 사용하여 VirtualBox 사용 통계를 모으고 연락하는 데만 사용할 것입니다. 개인 정보를 어떻게 사용하는가에 대해서 알아보시려면 VirtualBox 설명서의 <b>개인 정보 정책</b> 섹션이나 VirtualBox 웹 사이트의 <a href=http://www.virtualbox.org/wiki/PrivacyPolicy>개인 정보 정책</a>을 참고하십시오.</p></translation>
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -13621,8 +14822,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">가상 머신의 실행을 일시 중지합니다</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>VirtualBox에 오신 것을 환영합니다!</h3><p>이 창의 왼쪽 부분은 컴퓨터에 있는 모든 가상 머신 목록을 표시합니다. 아직 가상 머신을 만들지 않았기 때문에 이 목록은 현재 비어 있습니다.<img src=:/welcome.png align=right/></p><p>새 가상 머신을 만들시려면, 창 위쪽 도구 모음의 <b>새로 만들기</b> 단추를 누르십시오.</p><p><b>%1</b> 키를 누르면 상황에 맞는 도움말을 볼 수 있으며, 최근 정보와 뉴스를 보려면 <a href=https://www.virtualbox.org>www.virtualbox.org</a>를 방문하십시오.</p></translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>VirtualBox에 오신 것을 환영합니다!</h3><p>이 창의 왼쪽 부분은 컴퓨터에 있는 모든 가상 머신 목록을 표시합니다. 아직 가상 머신을 만들지 않았기 때문에 이 목록은 현재 비어 있습니다.<img src=:/welcome.png align=right/></p><p>새 가상 머신을 만들시려면, 창 위쪽 도구 모음의 <b>새로 만들기</b> 단추를 누르십시오.</p><p><b>%1</b> 키를 누르면 상황에 맞는 도움말을 볼 수 있으며, 최근 정보와 뉴스를 보려면 <a href=http://www.virtualbox.org>www.virtualbox.org</a>를 방문하십시오.</p></translation>
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -14062,157 +15263,6 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - 세션 정보</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">자세한 정보(&D)</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">실행 시간(&R)</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA 전송</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO 전송</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>읽은 데이터</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>쓴 데이터</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>보낸 데이터</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>받은 데이터</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>런타임 속성</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>화면 해상도</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">CD/DVD 통계</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">네트워크 어댑터 통계</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">버전 %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>알 수 없음</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>알 수 없음</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>게스트 확장</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>게스트 운영 체제 종류</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">하드 디스크 통계</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">하드 디스크 없음</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>네트워크 어댑터 없음</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">사용함</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">사용 안함</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">네스티드 페이징</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">사용할 수 없음</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>저장소 통계</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>저장소 없음</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>네트워크 통계</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">네스티드 페이징</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>사용할 수 없음</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>클립보드 모드</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>드래그 앤 드롭 모드</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>설정 정보(&D)</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>런타임 정보(&R)</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_lt.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_lt.ts
index 549c583..c0121a7 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_lt.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_lt.ts
@@ -239,11 +239,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Uždrausti &pelės integravimą</translation>
+        <translation type="obsolete">Uždrausti &pelės integravimą</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Laikinai uždrausti kompiuterio pelės žymeklio integravimą</translation>
+        <translation type="obsolete">Laikinai uždrausti kompiuterio pelės žymeklio integravimą</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -255,11 +255,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Su&rinkti Vald+Alt+Šalinti</translation>
+        <translation type="obsolete">Su&rinkti Vald+Alt+Šalinti</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Mašinai nusiųsti klavišų kombinaciją Vald(Ctrl)+Alt+Šalinti(Delete)</translation>
+        <translation type="obsolete">Mašinai nusiųsti klavišų kombinaciją Vald(Ctrl)+Alt+Šalinti(Delete)</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -267,7 +267,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Mašinai nusiųsti klavišų kombinaciją Vald(Ctrl)+Alt+Naikinti(Backspace)</translation>
+        <translation type="obsolete">Mašinai nusiųsti klavišų kombinaciją Vald(Ctrl)+Alt+Naikinti(Backspace)</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -282,8 +282,8 @@
         <translation type="obsolete">Sesijos i&nformacija</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Rodyti informaciją apie šią sesiją</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Rodyti informaciją apie šią sesiją</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -339,15 +339,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD įtaisai</translation>
+        <translation type="obsolete">&CD/DVD įtaisai</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Diskeliai</translation>
+        <translation type="obsolete">&Diskeliai</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB įtaisai</translation>
+        <translation type="obsolete">&USB įtaisai</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -366,12 +366,12 @@
         <translation>Kurti arba keisti bendruosius aplankus</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">Į&diegti svečio papildinius...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">Į&diegti svečio papildinius...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Prijungti svečio papildinių disko atvaizdį</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Prijungti svečio papildinių disko atvaizdį</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -465,15 +465,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Pereiti į darbą &visame ekrane</translation>
+        <translation type="obsolete">Pereiti į darbą &visame ekrane</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Pereiti į įprastą arba viso ekrano veikseną</translation>
+        <translation type="obsolete">Pereiti į įprastą arba viso ekrano veikseną</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Pereiti į &integruotą veikseną</translation>
+        <translation type="obsolete">Pereiti į &integruotą veikseną</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -481,7 +481,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Pereiti į &keičiamo lango dydžio veikseną</translation>
+        <translation type="obsolete">Pereiti į &keičiamo lango dydžio veikseną</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -702,7 +702,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished">Į&terpti Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">Į&terpti Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>Sort List</source>
@@ -893,10 +893,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -933,32 +929,257 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Logging...</source>
-        <comment>debug action</comment>
+        <source>Popup Menu</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Popup Menu</source>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">Į&diegti svečio papildinius...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Prijungti svečio papildinių disko atvaizdį</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Tinklas</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Peržiūrėti ž&urnalus...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Rinkmena</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Įgalinti</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1756,14 +1977,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1822,6 +2043,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Appliance Export Wizard</source>
@@ -2259,11 +2507,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">Neprijungta</translation>
@@ -2482,48 +2725,148 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Valdiklis</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Information inaccessible</source>
-        <comment>details</comment>
-        <translation type="obsolete">Informacija neprieinama</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>Information inaccessible</source>
-        <comment>details</comment>
-        <translation type="obsolete">Informacija neprieinama</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Vaizdo atmintis</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Ekranai</translation>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">USB valdiklis</translation>
     </message>
     <message>
-        <source>2D Video</source>
-        <comment>details report</comment>
-        <translation type="obsolete">2D vaizdas</translation>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Įgalinta</translation>
     </message>
     <message>
-        <source>3D</source>
-        <comment>details report</comment>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">Įgalinta</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Įgalinta</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Įgalinta</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Valdiklis</translation>
+    </message>
+    <message>
+        <source>Information inaccessible</source>
+        <comment>details</comment>
+        <translation type="obsolete">Informacija neprieinama</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>Information inaccessible</source>
+        <comment>details</comment>
+        <translation type="obsolete">Informacija neprieinama</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Vaizdo atmintis</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ekranai</translation>
+    </message>
+    <message>
+        <source>2D Video</source>
+        <comment>details report</comment>
+        <translation type="obsolete">2D vaizdas</translation>
+    </message>
+    <message>
+        <source>3D</source>
+        <comment>details report</comment>
         <translation type="obsolete">3D</translation>
     </message>
     <message>
@@ -2878,18 +3221,6 @@
         <translation>Rodo kelią iki bibliotekos, kuri pateikia nuotolinio ekrano (VRDP) klientų atpažinimo funkciją.</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4141,12 +4472,12 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Rodo CD/DVD įtaisų aktyvumą:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Rodo CD/DVD įtaisų aktyvumą:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Rodo diskelių įtaisų aktyvumą:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Rodo diskelių įtaisų aktyvumą:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4181,7 +4512,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB valdiklis uždraustas</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB valdiklis uždraustas</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4233,6 +4564,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4351,7 +4696,7 @@
     <name>UIMachineSettingsDisplay</name>
     <message>
         <source>&Video</source>
-        <translation>&Vaizdas</translation>
+        <translation type="obsolete">&Vaizdas</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4542,10 +4887,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4597,14 +4938,82 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Maža įrankinė:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Jei pažymėta, viso ekrano ir integruoto darbo veiksenose bus rodoma maža įrankinė.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Rodyti viso &ekrano/integravimo veiksenoje</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Jei pažymėta, maža įrankinė bus rodoma ekrano viršuje, o ne apačioje.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Rodyti &virš kitų langų</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIMachineSettingsGeneral</name>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Pagrindai</translation>
     </message>
     <message>
@@ -4616,7 +5025,7 @@
         <translation type="obsolete">Parodo virtualios mašinos pavadinimą.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Sudėtingiau</translation>
     </message>
     <message>
@@ -4633,38 +5042,38 @@
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Keičiamoji laikmena:</translation>
+        <translation type="obsolete">Keičiamoji laikmena:</translation>
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Jei pažymėta, bus įsimintas bet koks CD/DVD ar diskelių prijungimo pakeitimas mašinos veikimo metu. Šie pakeitimai bus įrašyti į nuostatas tam, kad būtų išlaikyta ta pati pakeista prijungtų įtaisių konfigūracija sekantį kartą paleidus svečio OS.</translation>
+        <translation type="obsolete">Jei pažymėta, bus įsimintas bet koks CD/DVD ar diskelių prijungimo pakeitimas mašinos veikimo metu. Šie pakeitimai bus įrašyti į nuostatas tam, kad būtų išlaikyta ta pati pakeista prijungtų įtaisių konfigūracija sekantį kartą paleidus svečio OS.</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Įsi&minti pakeitimus, atliktus darbo metu</translation>
+        <translation type="obsolete">Įsi&minti pakeitimus, atliktus darbo metu</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Maža įrankinė:</translation>
+        <translation type="obsolete">Maža įrankinė:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Jei pažymėta, viso ekrano ir integruoto darbo veiksenose bus rodoma maža įrankinė.</translation>
+        <translation type="obsolete">Jei pažymėta, viso ekrano ir integruoto darbo veiksenose bus rodoma maža įrankinė.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Rodyti viso &ekrano/integravimo veiksenoje</translation>
+        <translation type="obsolete">Rodyti viso &ekrano/integravimo veiksenoje</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Jei pažymėta, maža įrankinė bus rodoma ekrano viršuje, o ne apačioje.</translation>
+        <translation type="obsolete">Jei pažymėta, maža įrankinė bus rodoma ekrano viršuje, o ne apačioje.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Rodyti &virš kitų langų</translation>
+        <translation type="obsolete">Rodyti &virš kitų langų</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Aprašas</translation>
     </message>
     <message>
@@ -4680,7 +5089,7 @@
         <translation type="obsolete">šiai mašinai pasirinkote 64 bitų svečio OS. Kadangi toks svečias reikalauja virtualizaciją palaikančio procesoriaus (VT-x/AMD-V), pastaroji parinktis bus įgalinta automatiškai.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -4695,6 +5104,102 @@
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Maža įrankinė:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Jei pažymėta, viso ekrano ir integruoto darbo veiksenose bus rodoma maža įrankinė.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Rodyti viso &ekrano/integravimo veiksenoje</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Jei pažymėta, maža įrankinė bus rodoma ekrano viršuje, o ne apačioje.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Rodyti &virš kitų langų</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5087,10 +5592,6 @@
         <source>Edit Share</source>
         <translation>Keisti bendrąjį išteklių</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5136,25 +5637,41 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Pažymėjus, virtuali mašina pasileisdama sukurs kanalą, nurodytą laukelyje <b>Prievado kelias</b>. Priešingu atveju, virtuali mašina manys, kad kanalas jau yra ir mėgins jį naudoti.</translation>
+        <translation type="obsolete">Pažymėjus, virtuali mašina pasileisdama sukurs kanalą, nurodytą laukelyje <b>Prievado kelias</b>. Priešingu atveju, virtuali mašina manys, kad kanalas jau yra ir mėgins jį naudoti.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>Sukurti &kanalą</translation>
+        <translation type="obsolete">Sukurti &kanalą</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Prievado/rinkmenos kelias:</translation>
+        <translation type="obsolete">&Prievado/rinkmenos kelias:</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Rodo kelią iki nuosekliojo prievado kanalo pagrindiniame kompiuteryje, kai dirbama <b>Pagrindinio kompiuterio kanalo</b> veiksenoje, arba pagrindinio kompiuterio nuosekliojo įtaiso vardą, kai dirbama <b>Pagrindinio kompiuterio įtaiso</b> veiksenoje.</translation>
+        <translation type="obsolete">Rodo kelią iki nuosekliojo prievado kanalo pagrindiniame kompiuteryje, kai dirbama <b>Pagrindinio kompiuterio kanalo</b> veiksenoje, arba pagrindinio kompiuterio nuosekliojo įtaiso vardą, kai dirbama <b>Pagrindinio kompiuterio įtaiso</b> veiksenoje.</translation>
     </message>
     <message>
         <source>Port %1</source>
         <comment>serial ports</comment>
         <translation>%1 prievadas</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5299,11 +5816,11 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Pridėti&nbsp;CD/DVD&nbsp;įtaisą</nobr></translation>
+        <translation type="obsolete"><nobr>Pridėti&nbsp;CD/DVD&nbsp;įtaisą</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Pridėti&nbsp;diskelių&nbsp;įtaisą</nobr></translation>
+        <translation type="obsolete"><nobr>Pridėti&nbsp;diskelių&nbsp;įtaisą</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -5351,11 +5868,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Pridėti CD/DVD įtaisą</translation>
+        <translation type="obsolete">Pridėti CD/DVD įtaisą</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Pridėti diskelių įtaisą</translation>
+        <translation type="obsolete">Pridėti diskelių įtaisą</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5411,15 +5928,15 @@
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&CD/DVD įtaisas:</translation>
+        <translation type="obsolete">&CD/DVD įtaisas:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Pasirinkite virtualų CD/DVD diską arba fizinį įtaisą, kurį naudosite kaip virtualų įtaisą. Virtuali mašina matys atitinkmai arba į įtaisą įdėtą diską su rinkmenoje esančiais duomenis, arba diską fiziniame įtaise su jo duomenimis.</translation>
+        <translation type="obsolete">Pasirinkite virtualų CD/DVD diską arba fizinį įtaisą, kurį naudosite kaip virtualų įtaisą. Virtuali mašina matys atitinkmai arba į įtaisą įdėtą diską su rinkmenoje esančiais duomenis, arba diską fiziniame įtaise su jo duomenimis.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Įrengti virtualų CD/DVD įtaisą</translation>
+        <translation type="obsolete">Įrengti virtualų CD/DVD įtaisą</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5443,7 +5960,7 @@
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Pasirinkti virtualaus CD/DVD disko rinkmeną...</translation>
+        <translation type="obsolete">Pasirinkti virtualaus CD/DVD disko rinkmeną...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5527,6 +6044,54 @@
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5743,31 +6308,39 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5787,7 +6360,7 @@
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Įgalinti USB 2.0 (E&HCI) valdiklį</translation>
+        <translation type="obsolete">Įgalinti USB 2.0 (E&HCI) valdiklį</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5903,7 +6476,27 @@
         <translation type="obsolete">Šioje virtualioje mašinoje įgalintas USB 2.0. Tačiau tam turi įdiegtas <b>%1</b>. Įdiegike papildinių paketą, kurį rasite VirtualBox svetainėje. Tuomet vėl galėsite įgalite USB 2.0. Iki tol ši funkcija bus uždrausta, nebent atsisakysite dabartinių nuostatų pakeitimų.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6043,7 +6636,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation type="unfinished">&Užverti</translation>
+        <translation type="obsolete">&Užverti</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6062,6 +6659,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Užverti</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Perjungti</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6109,7 +6729,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Nepavyko sukurti VirtualBox COM objekto.</p><p>Programa netrukus išsijungs.</p></translation>
+        <translation type="obsolete"><p>Nepavyko sukurti VirtualBox COM objekto.</p><p>Programa netrukus išsijungs.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -6298,15 +6918,15 @@
         <translation type="obsolete"><p>Nepavyksta įkelti kalbos rinkmenos <b><nobr>%1</nobr></b>. <p>Laikinai bus naudojama anglų kalba.Eikite į <b>nuostatas</b> per <b>rinkmenos</b> meniu, esantį pagrindiniame VirtualBox lange, ir pasirinkite egzistuojančią kalbą <b>kalbos</b> kortelėje.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Įdiegtieji VirtualBox svečio papildiniai yra per seni: yra įdiegta %1 versija, bet tikėtasi %2 versijos. Kai kurios funkcijos (pelės integravimas, svečio ekrano dydžio automatinis keitimas) gali neveikti tinkamai.</p><p>Atnaujinkite svečio papildinius iki tinkamos versijos nuspaudę <b>Įdiegti svečio papildinius</b> iš <b>įtaisų</b> meniu.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Įdiegtieji VirtualBox svečio papildiniai nėra patys naujausi: yra įdiegta %1 versija, bet tikėtasi %2 versijos. Kai kurios funkcijos (pelės integravimas, svečio ekrano dydžio automatinis keitimas) gali neveikti tinkamai.</p><p>Patariama atnaujinti svečio papildinius iki tinkamos versijos nuspaudus <b>Įdiegti svečio papildinius</b> iš <b>įtaisų</b> meniu.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Įdiegtieji VirtualBox svečio papildiniai yra per nauji: yra įdiegta %1 versija, bet tikėtasi %2 versijos. Negalima naudoti naujesnių svečio papildinių už versiją, kurią palaiko VirtualBox.</p><p>Atnaujinkite svečio papildinius iki tinkamos versijos nuspaudę <b>Įdiegti svečio papildinius</b> iš <b>įtaisų</b> meniu.</p></translation>
     </message>
     <message>
@@ -6407,7 +7027,7 @@
         <translation type="obsolete">Parsiųsti</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions
 </comment>
         <translation type="obsolete">Prijungti</translation>
@@ -6547,8 +7167,8 @@
         <translation type="obsolete">Rodyti langą su produkto informacija</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Pasirodė nauja VirtualBox versija! Versija <b>%1</b> pasiekiama <a href="https://www.virtualbox.org/">virtualbox.org</a> svetainėje.</p><p>Šią versiją galite atsisiųsti spustelėję šią nuorodą: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Pasirodė nauja VirtualBox versija! Versija <b>%1</b> pasiekiama <a href="http://www.virtualbox.org/">virtualbox.org</a> svetainėje.</p><p>Šią versiją galite atsisiųsti spustelėję šią nuorodą: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6632,11 +7252,11 @@
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Vienas ar keli virtualūs standieji diskai, CD/DVD ar diskelių įtaisai nebepasiekiami. Todėl negalėsite naudotis tomis virtualiomis mašinomis, kurios naudoja tas laikmenas tol, kol jos nebus pasiekiamos.</p><p>Norėdami atverti virtualių laikmenų tvarkytuvę ir pamatyti tas laikmenas, spauskite <b>Tikrinti</b>, o norėdami nekreipti dėmesio į šį pranešimą, spauskite <b>Nepaisyti</b>.</p></translation>
+        <translation type="obsolete"><p>Vienas ar keli virtualūs standieji diskai, CD/DVD ar diskelių įtaisai nebepasiekiami. Todėl negalėsite naudotis tomis virtualiomis mašinomis, kurios naudoja tas laikmenas tol, kol jos nebus pasiekiamos.</p><p>Norėdami atverti virtualių laikmenų tvarkytuvę ir pamatyti tas laikmenas, spauskite <b>Tikrinti</b>, o norėdami nekreipti dėmesio į šį pranešimą, spauskite <b>Nepaisyti</b>.</p></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Virtualios mašinos veikimo metu įvyko kritinė klaida, tad mašina sustojo.</p><p>Norėdami gauti pagalbos, žiūrėkite „Bendruomenės“ (angl. „Community“) skyrių <a href=https://www.virtualbox.org>https://www.virtualbox.org</a>  svetainėje arba palaikymo kontrakte. Prašom pateikti <tt>VBox.log</tt> žurnalo rinkmenos turinį ir <tt>VBox.png</tt> paveiksliuką, kuriuos galite rasti <nobr><b>%1</b></ [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Virtualios mašinos veikimo metu įvyko kritinė klaida, tad mašina sustojo.</p><p>Norėdami gauti pagalbos, žiūrėkite „Bendruomenės“ (angl. „Community“) skyrių <a href=http://www.virtualbox.org>http://www.virtualbox.org</a>  svetainėje arba palaikymo kontrakte. Prašom pateikti <tt>VBox.log</tt> žurnalo rinkmenos turinį ir <tt>VBox.png</tt> paveiksliuką, kuriuos galite rasti <nobr><b>%1& [...]
     </message>
     <message>
         <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
@@ -6892,7 +7512,7 @@
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Tikrai pašalinti CD/DVD įtaisą?</p><p>Jei taip, negalėsite prijungti jokio CD ar ISO atvaizdžio, negalėsite įdiegti svečio papildinių!</p></translation>
+        <translation type="obsolete"><p>Tikrai pašalinti CD/DVD įtaisą?</p><p>Jei taip, negalėsite prijungti jokio CD ar ISO atvaizdžio, negalėsite įdiegti svečio papildinių!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7051,7 +7671,7 @@
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Ketinate prie <b>%1</b> valdiklio pridėti naują CD/DVD įtaisą.</p><p>Ar norėtumėte tuo pačiu pasirinkti virtualų CD/DVD diską ir jį įdėti į įtaisą, ar šiuo metu įtaisą palikti tuščią?</p></translation>
+        <translation type="obsolete"><p>Ketinate prie <b>%1</b> valdiklio pridėti naują CD/DVD įtaisą.</p><p>Ar norėtumėte tuo pačiu pasirinkti virtualų CD/DVD diską ir jį įdėti į įtaisą, ar šiuo metu įtaisą palikti tuščią?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7078,14 +7698,14 @@
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nepavyko atjungti CD/DVD įtaiso (<nobr><b>%1</b></nobr>) nuo <i>%2</i> lizdo mašinoje <b>%3</b>.</translation>
+        <translation type="obsolete">Nepavyko atjungti CD/DVD įtaiso (<nobr><b>%1</b></nobr>) nuo <i>%2</i> lizdo mašinoje <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nepavyko atjungti diskelio įtaiso (<nobr><b>%1</b></nobr>) nuo <i>%2</i> lizdo mašinoje <b>%3</b>.</translation>
+        <translation type="obsolete">Nepavyko atjungti diskelio įtaiso (<nobr><b>%1</b></nobr>) nuo <i>%2</i> lizdo mašinoje <b>%3</b>.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>Regis šioje virtualioje mašinoje neprieinami VirtualBox svečio papildiniai, tad negalite naudoti bendrųjų aplankų. Norėdami naudoti bendruosius aplankus virtualioje mašinoje, įdiekite svečio papildinius (jei jie neįdiegti) arba iš naujo įdiekite juos (jei jie veikia netinkamai) pasirinkdami <b>Įdiegti svečio papildinius</b> iš <b>Mašinos</b> meniu. Jei jie įdiegti, bet mašina dar pilnai nepasileido, tuomet luktelėkite. [...]
     </message>
     <message>
@@ -7094,9 +7714,9 @@
         <translation type="obsolete">Parsiųsti</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Prijungti</translation>
+        <translation type="obsolete">Prijungti</translation>
     </message>
     <message>
         <source>Check</source>
@@ -7221,11 +7841,11 @@
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nepavyko priskirti CD/DVD įtaiso (<nobr><b>%1</b></nobr>) prie <i>%2</i> lizdo <b>%3</b> mašinoje.</translation>
+        <translation type="obsolete">Nepavyko priskirti CD/DVD įtaiso (<nobr><b>%1</b></nobr>) prie <i>%2</i> lizdo <b>%3</b> mašinoje.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Nepavyko priskirti diskelio įtaiso (<nobr><b>%1</b></nobr>) prie <i>%2</i> lizdo <b>%3</b> mašinoje.</translation>
+        <translation type="obsolete">Nepavyko priskirti diskelio įtaiso (<nobr><b>%1</b></nobr>) prie <i>%2</i> lizdo <b>%3</b> mašinoje.</translation>
     </message>
     <message>
         <source>Result&nbsp;Code: </source>
@@ -7247,8 +7867,8 @@
         <translation><p>Atminkite, kad ši laikmena nebus ištrinta, tad vėliau ją vėl galėsite naudoti.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation type="unfinished"><p>Regis šioje virtualioje mašinoje neprieinami VirtualBox svečio papildiniai, tad negalite naudoti bendrųjų aplankų. Norėdami naudoti bendruosius aplankus virtualioje mašinoje, įdiekite svečio papildinius (jei jie neįdiegti) arba iš naujo įdiekite juos (jei jie veikia netinkamai) pasirinkdami <b>Įdiegti svečio papildinius</b> iš <b>Įtaisų</b> meniu. Jei jie įdiegti, bet mašina dar pilnai nepasileido, tuomet luktelėkite [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Regis šioje virtualioje mašinoje neprieinami VirtualBox svečio papildiniai, tad negalite naudoti bendrųjų aplankų. Norėdami naudoti bendruosius aplankus virtualioje mašinoje, įdiekite svečio papildinius (jei jie neįdiegti) arba iš naujo įdiekite juos (jei jie veikia netinkamai) pasirinkdami <b>Įdiegti svečio papildinius</b> iš <b>Įtaisų</b> meniu. Jei jie įdiegti, bet mašina dar pilnai nepasileido, tuomet luktelėkite.& [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -7481,10 +8101,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7714,14 +8330,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7754,25 +8362,120 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>Regis šioje virtualioje mašinoje neprieinami VirtualBox svečio papildiniai, tad negalite naudoti bendrųjų aplankų. Norėdami naudoti bendruosius aplankus virtualioje mašinoje, įdiekite svečio papildinius (jei jie neįdiegti) arba iš naujo įdiekite juos (jei jie veikia netinkamai) pasirinkdami <b>Įdiegti svečio papildinius</b> iš <b>Įtaisų</b> meniu. Jei jie įdiegti, bet mašina dar pilnai nepasileido, tuomet luktelėkite.& [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Prijungti</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -7865,7 +8568,7 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished">&Pavadinimas:</translation>
     </message>
     <message>
@@ -8541,14 +9244,18 @@
         <translation type="unfinished">Virtualių mašinų rinkmenos (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="unfinished"><h3>Jus sveikina VirtualBox!</h3><p>Kairėje lango pusėje pateikiamas visų Jūsų virtualių mašinų sąrašas. Kol kas šis sąrašas tuščias, kadangi dar nesukūrėte nei vienos virtualios mašinos.<img src=:/welcome.png align=right/></p><p>Norėdami sukurti naują VM, spauskite mygtuką <b>Nauja</b>, kuris yra pagrindinėje įrankių juostoje lango viršuje.</p><p>Trumpą pagalbą gausite nuspaudę <b>%1 [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Jus sveikina VirtualBox!</h3><p>Kairėje lango pusėje pateikiamas visų Jūsų virtualių mašinų sąrašas. Kol kas šis sąrašas tuščias, kadangi dar nesukūrėte nei vienos virtualios mašinos.<img src=:/welcome.png align=right/></p><p>Norėdami sukurti naują VM, spauskite mygtuką <b>Nauja</b>, kuris yra pagrindinėje įrankių juostoje lango viršuje.</p><p>Trumpą pagalbą gausite nuspaudę <b>%1&l [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished">Tvarkyklė</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -8581,7 +9288,7 @@
     </message>
     <message>
         <source>Settings</source>
-        <translation>Nuostatos</translation>
+        <translation type="obsolete">Nuostatos</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -8634,6 +9341,10 @@
         <source>Display</source>
         <translation type="unfinished">Ekranas</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8709,6 +9420,43 @@
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">naudojate daugiau laikmenų valdiklių nei palaiko %1 lustų rinkinys. Todėl arba pakeiskite lustų rinkinio tipą sistemos nuostatose, arba sumažinkite laikmenų valdiklių skaičių laikmenų nuostatose: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Nuostatos</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Užverti</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -8804,8 +9552,8 @@
         <translation type="obsolete">Santrauka</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Pasirodė nauja VirtualBox versija! Versija <b>%1</b> pasiekiama <a href="https://www.virtualbox.org/">virtualbox.org</a> svetainėje.</p><p>Šią versiją galite atsisiųsti spustelėję šią nuorodą: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Pasirodė nauja VirtualBox versija! Versija <b>%1</b> pasiekiama <a href="http://www.virtualbox.org/">virtualbox.org</a> svetainėje.</p><p>Šią versiją galite atsisiųsti spustelėję šią nuorodą: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -8873,6 +9621,14 @@
         <source>&Restore current snapshot '%1'</source>
         <translation>&Atkurti dabartinį momentinį būvį „%1“</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -8886,6 +9642,134 @@
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - sesijos informacija</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Detalės</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Vykdymas</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA perdavimai</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO perdavimai</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Perskaityta duomenų</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Įrašyta duomenų</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Perduota duomenų</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Gauta duomenų</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Vykdymo ypatybės</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Ekrano skiriamoji geba</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions
+</comment>
+        <translation type="obsolete">Neaptikta</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type
+</comment>
+        <translation type="obsolete">Neaptikta</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Svečio papildiniai</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Svečio OS tipas</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Tinklo plokščių nėra</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)
+</comment>
+        <translation type="obsolete">Neprieinama</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Atminties įtaisų statistika</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Atminties įtaisų nėra</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Tinklo statistika</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Neaptikta</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Neaptikta</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Neprieinama</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -9051,11 +9935,19 @@
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -9751,8 +10643,8 @@
         <translation><numatyta></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Pasirinkus, patvirtinus pasirinkimą ir iš naujo atvėrus šį langą, matysite numatytąjį kelią.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Pasirinkus, patvirtinus pasirinkimą ir iš naujo atvėrus šį langą, matysite numatytąjį kelią.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -9800,8 +10692,7 @@
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Pasirinkus, patvirtinus pasirinkimą ir iš naujo atvėrus šį langą, matysite numatytąjį kelią.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11353,7 +12244,7 @@ IPv6.</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Su šiuo standžiuoju disku bus dirbama ne tiesiogiai, o naudojant naujai sukurtą standžiojo disko vedinį.</translation>
+        <translation type="obsolete">Su šiuo standžiuoju disku bus dirbama ne tiesiogiai, o naudojant naujai sukurtą standžiojo disko vedinį.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
@@ -11364,7 +12255,7 @@ IPv6.</translation>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Šis pagrindinis standusis diskas prijungtas ne tiesiogiai, o naudojant šį jo vedinį:</translation>
+        <translation type="obsolete">Šis pagrindinis standusis diskas prijungtas ne tiesiogiai, o naudojant šį jo vedinį:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -11416,7 +12307,7 @@ IPv6.</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -11563,7 +12454,7 @@ IPv6.</translation>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Kai kurių laikmenų neavyksta rasti standžiajame diske. Tas laimenas pamatysite, jei virtualių laikmenų tvarkytuvėje pasirinksite <b>rodyti diskų vedinius</b>.</translation>
+        <translation type="obsolete">Kai kurių laikmenų neavyksta rasti standžiajame diske. Tas laimenas pamatysite, jei virtualių laikmenų tvarkytuvėje pasirinksite <b>rodyti diskų vedinius</b>.</translation>
     </message>
     <message>
         <source>Enabled</source>
@@ -12045,7 +12936,7 @@ IPv6.</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -12786,12 +13677,7 @@ IPv6.</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished">Įgalinta</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Įgalinta</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -12849,7 +13735,151 @@ IPv6.</translation>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Numatytoji</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Aktyvus</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Aktyvus</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Aktyvus</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -13166,6 +14196,18 @@ IPv6.</translation>
         <source>C&lose</source>
         <translation type="obsolete">&Užverti</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13338,8 +14380,8 @@ IPv6.</translation>
         <translation type="obsolete">Sustabdyti virtualią mašiną jos būseną išsaugant diske</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Jus sveikina VirtualBox!</h3><p>Kairėje lango pusėje pateikiamas visų Jūsų virtualių mašinų sąrašas. Kol kas šis sąrašas tuščias, kadangi dar nesukūrėte nei vienos virtualios mašinos.<img src=:/welcome.png align=right/></p><p>Norėdami sukurti naują VM, spauskite mygtuką <b>Nauja</b>, kuris yra pagrindinėje įrankių juostoje lango viršuje.</p><p>Trumpą pagalbą gausite nuspaudę <b>%1&l [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Jus sveikina VirtualBox!</h3><p>Kairėje lango pusėje pateikiamas visų Jūsų virtualių mašinų sąrašas. Kol kas šis sąrašas tuščias, kadangi dar nesukūrėte nei vienos virtualios mašinos.<img src=:/welcome.png align=right/></p><p>Norėdami sukurti naują VM, spauskite mygtuką <b>Nauja</b>, kuris yra pagrindinėje įrankių juostoje lango viršuje.</p><p>Trumpą pagalbą gausite nuspaudę <b>%1&l [...]
     </message>
     <message>
         <source>Log</source>
@@ -13866,130 +14908,6 @@ konkrečių nuostatų, matysite paaiškinimus<i>.</translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - sesijos informacija</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detalės</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Vykdymas</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA perdavimai</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO perdavimai</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Perskaityta duomenų</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Įrašyta duomenų</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Perduota duomenų</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Gauta duomenų</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Vykdymo ypatybės</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Ekrano skiriamoji geba</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions
-</comment>
-        <translation type="obsolete">Neaptikta</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type
-</comment>
-        <translation type="obsolete">Neaptikta</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Svečio papildiniai</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Svečio OS tipas</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Tinklo plokščių nėra</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)
-</comment>
-        <translation type="obsolete">Neprieinama</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Atminties įtaisų statistika</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Atminties įtaisų nėra</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Tinklo statistika</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Neaptikta</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Neaptikta</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Neprieinama</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_nl.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_nl.ts
index 5a1dfa6..536c212 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_nl.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_nl.ts
@@ -224,19 +224,19 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>&Muis-integratie uitschakelen</translation>
+        <translation type="obsolete">&Muis-integratie uitschakelen</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Tijdelijk de integratie van muis met host uitschakelen</translation>
+        <translation type="obsolete">Tijdelijk de integratie van muis met host uitschakelen</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Invoegen Ctrl+Alt+Del</translation>
+        <translation type="obsolete">&Invoegen Ctrl+Alt+Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Stuur Ctrl+Alt+Del-combinatie naar de virtuele machine</translation>
+        <translation type="obsolete">Stuur Ctrl+Alt+Del-combinatie naar de virtuele machine</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -244,7 +244,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Stuur Ctrl+Alt+Backspace-combinatie naar de virtuele machine</translation>
+        <translation type="obsolete">Stuur Ctrl+Alt+Backspace-combinatie naar de virtuele machine</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -255,8 +255,8 @@
         <translation>Maak een snapshot van de virtuele machine</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Toon sessie-informatievenster</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Toon sessie-informatiedialoog</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -300,15 +300,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD-apparaten</translation>
+        <translation type="obsolete">&CD/DVD-apparaten</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Diskette-apparaten</translation>
+        <translation type="obsolete">&Diskette-apparaten</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB-apparaten</translation>
+        <translation type="obsolete">&USB-apparaten</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -327,13 +327,13 @@
         <translation>Aanmaken/bewerken gedeelde mappen</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translatorcomment>Guest Additions als naam laten staan</translatorcomment>
-        <translation>&Installeren Guest Additions...</translation>
+        <translation type="obsolete">&Installeren Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Doe het Guest Additions-schijfbestand in het virtuele station</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Koppel Guest Additions installatie-image aan</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -376,15 +376,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Schakel over op Scherm&vullend</translation>
+        <translation type="obsolete">Schakel over op Scherm&vullend</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Schakel tussen Normale en Schermvullende modus</translation>
+        <translation type="obsolete">Schakel tussen Normale en Schermvullende modus</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Schakel over op Naad&loze modus</translation>
+        <translation type="obsolete">Schakel over op Naad&loze modus</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -392,7 +392,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Schakel over op &Schaalmodus</translation>
+        <translation type="obsolete">Schakel over op &Schaalmodus</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -472,7 +472,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Invo&egen Ctrl+Alt+Backspace</translation>
+        <translation type="obsolete">Invo&egen Ctrl+Alt+Backspace</translation>
     </message>
     <message>
         <source>&File</source>
@@ -769,7 +769,7 @@
     <message>
         <source>Drag'n'Drop</source>
         <translatorcomment>Zoals bij Mozillavertalingen</translatorcomment>
-        <translation>Slepen naar</translation>
+        <translation type="obsolete">Slepen naar</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
@@ -814,29 +814,243 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&Loggen...</translation>
+        <translation type="obsolete">&Loggen...</translation>
     </message>
     <message>
         <source>Popup Menu</source>
         <translation>Popupmenu</translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Installeren Guest Additions...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Koppel Guest Additions installatie-image aan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>&Webcams</translation>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
-        <translation>Netwerk</translation>
+        <translation type="unfinished">Netwerk</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Bestand</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Uitschakelen</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
     </message>
 </context>
 <context>
@@ -847,6 +1061,21 @@
     </message>
 </context>
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIApplianceEditorWidget</name>
     <message>
         <source>Virtual System %1</source>
@@ -1615,6 +1844,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1625,7 +1861,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Droppen data ...</translation>
+        <translation type="obsolete">Droppen data ...</translation>
     </message>
 </context>
 <context>
@@ -1676,6 +1912,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Appliance Export Wizard</source>
@@ -2035,7 +2297,7 @@
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2251,6 +2513,106 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>Framegrootte: %1x%2, Framerate: %3fps, Bitrate: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">USB-controller</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Ingeschakeld</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished">Uitgeschakeld</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">Ingeschakeld</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Ingeschakeld</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Uitgeschakeld</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Ingeschakeld</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Uitgeschakeld</translation>
+    </message>
 </context>
 <context>
     <name>UIGDetailsUpdateThreadAudio</name>
@@ -2620,15 +2982,15 @@
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation>&Dock en menubalk:</translation>
+        <translation type="obsolete">&Dock en menubalk:</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation>Automatisch tonen bij schermvullend</translation>
+        <translation type="obsolete">Automatisch tonen bij schermvullend</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Als dit is ingesteld wordt hostdock en menubalk getoond als de virtuele machine in schermvullende modus is.</translation>
+        <translation type="obsolete">Als dit is ingesteld wordt hostdock en menubalk getoond als de virtuele machine in schermvullende modus is.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
@@ -3654,12 +4016,12 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Geeft activiteit van CD/DVD-apparaten weer:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Geeft activiteit van CD/DVD-apparaten weer:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Geeft activiteit van diskette-apparaten weer:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Geeft activiteit van diskette-apparaten weer:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -3699,7 +4061,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB-controller is uitgeschakeld</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB-controller is uitgeschakeld</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -3755,6 +4117,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation>Overige status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -3807,19 +4183,19 @@
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>Er zijn geen webcams aangesloten</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Er zijn geen ondersteunde webcams aan de host-PC verbonden</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation>Verbind netwerkadapter</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation>Verbind netwerkadapter %1</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3861,7 +4237,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Video</translation>
+        <translation type="obsolete">&Video</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4041,7 +4417,7 @@
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>De virtuele machine is ingesteld om hardwarematige grafische accelleratie te gebruiken en os-hint staat op Windows Vista of later. Voor de beste prestaties moet u het videogeheugen van de machine op ten minste <b>%1</b> zetten.</translation>
+        <translation type="obsolete">De virtuele machine is ingesteld om hardwarematige grafische accelleratie te gebruiken en os-hint staat op Windows Vista of later. Voor de beste prestaties moet u het videogeheugen van de machine op ten minste <b>%1</b> zetten.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -4095,8 +4471,76 @@
         <translation>Schakel video-opname in voor scherm %1.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation>Beeldscherm op Afstand is voor deze virtuele machine momenteel ingeschakeld. Hiervoor moet echter <b>%1</b> geïnstalleerd zijn. Installeer het Extension Pack dat te vinden is op de downloadsite van VirtualBox, anders start deze VM op met Beeldscherm op Afstand uitgeschakeld.</translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Miniwerkbalk:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Als dit is ingesteld wordt de miniwerkbalk getoont in schermvullende en naadloze modi.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Toon in &Schermvullend/Naadloos</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Als dit is ingesteld wordt de miniwerkbalk boven in het scherm weergegeven in plaats van de standaardpositie onder aan het scherm.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Geef &boven in het scherm weer</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4106,7 +4550,7 @@
         <translation>Geeft het pad weer waar snapshots van deze virtuele machine worden opgeslagen. Wees ervan bewust dat snapshots erg veel ruimte op de harde schijf kunnen innemen.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Basis</translation>
     </message>
     <message>
@@ -4118,7 +4562,7 @@
         <translation type="obsolete">Toont de naam van de virtuele machine.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Geavanceerd</translation>
     </message>
     <message>
@@ -4134,7 +4578,7 @@
         <translation>S&napshotmap:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Beschrijving</translation>
     </message>
     <message>
@@ -4143,42 +4587,42 @@
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Als dit is ingesteld wordt iedere verandering bij aangekoppelde CD/DVD/diskette-media aangebracht tijdens het draaien van de virtuele machine opgeslagen in het instellingenbestand. Zo wordt tussen runs de configuratie van aangekoppelde media behouden.</translation>
+        <translation type="obsolete">Als dit is ingesteld wordt iedere verandering bij aangekoppelde CD/DVD/diskette-media aangebracht tijdens het draaien van de virtuele machine opgeslagen in het instellingenbestand. Zo wordt tussen runs de configuratie van aangekoppelde media behouden.</translation>
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Verwijderbare media:</translation>
+        <translation type="obsolete">Verwijderbare media:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Onthoud runtime wijzigingen</translation>
+        <translation type="obsolete">&Onthoud runtime wijzigingen</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Miniwerkbalk:</translation>
+        <translation type="obsolete">Miniwerkbalk:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Als dit is ingesteld wordt de miniwerkbalk getoont in schermvullende en naadloze modi.</translation>
+        <translation type="obsolete">Als dit is ingesteld wordt de miniwerkbalk getoont in schermvullende en naadloze modi.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Toon in &Schermvullend/Naadloos</translation>
+        <translation type="obsolete">Toon in &Schermvullend/Naadloos</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Als dit is ingesteld wordt de miniwerkbalk boven in het scherm weergegeven in plaats van de standaardpositie onder aan het scherm.</translation>
+        <translation type="obsolete">Als dit is ingesteld wordt de miniwerkbalk boven in het scherm weergegeven in plaats van de standaardpositie onder aan het scherm.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Geef &boven in het scherm weer</translation>
+        <translation type="obsolete">Geef &boven in het scherm weer</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">U hebt een 64-Bit gastbesturingssysteem voor deze VM geselecteerd. Daardoor is hardware-virtualisering (VT-x/AMD-V) voor de gast vereist, deze optie wordt automatisch ingeschakeld.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>&Drag'n'Drop:</translation>
     </message>
     <message>
@@ -4193,6 +4637,102 @@
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation>De systeemhint voor deze virtuele machine is gezet op een 64-bittype. 64-bit Gastsystemen vereisen hardwarevirtualisatie. Hardwarevirtualisatie zal automatisch worden ingeschakeld op het moment dat u de verandering bevestigd.</translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Miniwerkbalk:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Als dit is ingesteld wordt de miniwerkbalk getoont in schermvullende en naadloze modi.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Toon in &Schermvullend/Naadloos</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Als dit is ingesteld wordt de miniwerkbalk boven in het scherm weergegeven in plaats van de standaardpositie onder aan het scherm.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Geef &boven in het scherm weer</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -4593,10 +5133,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Als dit is ingesteld zal deze gedeelde map permanent worden.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Venster</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -4640,19 +5176,19 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Als dit is ingesteld zal de pijp gespecificeerd in het <b>Poort/bestandspad</b>-veld door de virtuele machine worden aangemaakt zodra deze opstart. Niet aangevinkt zal de virtuele machine een bestaande pijp proberen te gebruiken.</translation>
+        <translation type="obsolete">Als dit is ingesteld zal de pijp gespecificeerd in het <b>Poort/bestandspad</b>-veld door de virtuele machine worden aangemaakt zodra deze opstart. Niet aangevinkt zal de virtuele machine een bestaande pijp proberen te gebruiken.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>Maak &pijp aan</translation>
+        <translation type="obsolete">Maak &pijp aan</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Toont het pad naar de seriële poort op de host indien de poort in <b>Host pijp</b>-modus werkt; en de naam van het host seriële-apparaat als de poort in <b>Host apparaat</b>-modus werkt.</translation>
+        <translation type="obsolete">Toont het pad naar de seriële poort op de host indien de poort in <b>Host pijp</b>-modus werkt; en de naam van het host seriële-apparaat als de poort in <b>Host apparaat</b>-modus werkt.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Poort/bestandspad:</translation>
+        <translation type="obsolete">&Poort/bestandspad:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -4662,6 +5198,22 @@
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Geeft het basis I/O poortadres van deze seriële poort weer. Geldige waarden zijn gehele getallen in de reeks van <tt>0</tt> tot <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -4714,11 +5266,11 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Voeg&nbsp;CD/DVD-speler&nbsp;toe</nobr></translation>
+        <translation type="obsolete"><nobr>Voeg&nbsp;CD/DVD-speler&nbsp;toe</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Voeg&nbsp;diskettestation&nbsp;toe</nobr></translation>
+        <translation type="obsolete"><nobr>Voeg&nbsp;diskettestation&nbsp;toe</nobr></translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -4758,11 +5310,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Voeg CD/DVD-speler toe</translation>
+        <translation type="obsolete">Voeg CD/DVD-speler toe</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Voeg diskettestation toe</translation>
+        <translation type="obsolete">Voeg diskettestation toe</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -4917,15 +5469,15 @@
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD-&station:</translation>
+        <translation type="obsolete">CD/DVD-&station:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Kies een virtuele CD/DVD-schijf of een fysiek station om met het virtuele station te gebruiken. De virtuele machine zal een schijf ingebracht in het station, met de gegevens in het bestand of op de schijf in het fysieke station, beschouwen als haar inhoud.</translation>
+        <translation type="obsolete">Kies een virtuele CD/DVD-schijf of een fysiek station om met het virtuele station te gebruiken. De virtuele machine zal een schijf ingebracht in het station, met de gegevens in het bestand of op de schijf in het fysieke station, beschouwen als haar inhoud.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Zet een virtuele CD/DVD-station op</translation>
+        <translation type="obsolete">Zet een virtuele CD/DVD-station op</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -4949,7 +5501,7 @@
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Kies een virtuele CD/DVD-schijfbestand...</translation>
+        <translation type="obsolete">Kies een virtuele CD/DVD-schijfbestand...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5038,6 +5590,54 @@
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>De machine heeft momenteel meer opslagcontrolers toegewezen gekregen dan een %1-chipset ondersteunt. Wijzig het type chipset bij pagina Systeeminstellingen of verminder het aantal van de volgende opslagcontrolers op de pagina Opslaginstellingen: %2</translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Kies een virtuele optische schijf bestand...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5261,11 +5861,11 @@
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>De I/O-APIC-eigenschap is momenteel niet ingeschakeld bij de sectie Moederbord op de pagina Systeem. Dit is echter nodig om een chipset van het type ICH9 te kunnen ondersteunen. De inschakeling zal automatisch gebeuren op het moment dat u uw keuze bevestigt.</translation>
+        <translation type="obsolete">De I/O-APIC-eigenschap is momenteel niet ingeschakeld bij de sectie Moederbord op de pagina Systeem. Dit is echter nodig om een chipset van het type ICH9 te kunnen ondersteunen. De inschakeling zal automatisch gebeuren op het moment dat u uw keuze bevestigt.</translation>
     </message>
     <message>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>USB-controlleremulatie is momenteel op de USB-pagina niet ingeschakeld. Dit is echter nodig om een USB-inputapparaat te kunnen ondersteunen. De inschakeling zal automatisch gebeuren op het moment dat u uw keuze voor een USB-inputapparaat bevestigt.</translation>
+        <translation type="obsolete">USB-controlleremulatie is momenteel op de USB-pagina niet ingeschakeld. Dit is echter nodig om een USB-inputapparaat te kunnen ondersteunen. De inschakeling zal automatisch gebeuren op het moment dat u uw keuze voor een USB-inputapparaat bevestigt.</translation>
     </message>
     <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
@@ -5277,16 +5877,40 @@
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>De I/O-APIC-eigenschap is momenteel niet ingeschakeld bij de sectie Moederbord op de pagina Systeem. Dit is echter nodig om meer dan één virtuele processor te kunnen ondersteunen. De inschakeling zal automatisch gebeuren op het moment dat u uw keuze voor meer dan één virtuele processor bevestigt.</translation>
+        <translation type="obsolete">De I/O-APIC-eigenschap is momenteel niet ingeschakeld bij de sectie Moederbord op de pagina Systeem. Dit is echter nodig om meer dan één virtuele processor te kunnen ondersteunen. De inschakeling zal automatisch gebeuren op het moment dat u uw keuze voor meer dan één virtuele processor bevestigt.</translation>
     </message>
     <message>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Hardwarevirtualisatie is momenteel niet ingeschakeld bij de sectie Acceleratie op de pagina Systeem. Dit is echter nodig om meer dan één virtuele processor te kunnen ondersteunen. De inschakeling zal automatisch gebeuren op het moment dat u uw keuze voor meer dan één virtuele processor bevestigt.</translation>
+        <translation type="obsolete">Hardwarevirtualisatie is momenteel niet ingeschakeld bij de sectie Acceleratie op de pagina Systeem. Dit is echter nodig om meer dan één virtuele processor te kunnen ondersteunen. De inschakeling zal automatisch gebeuren op het moment dat u uw keuze voor meer dan één virtuele processor bevestigt.</translation>
     </message>
     <message>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation>U hebt de processor-execution-cap op een lage waarde ingesteld. Dit kan de indruk wekken dat de machine langzaam reageert.</translation>
     </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSB</name>
@@ -5357,7 +5981,7 @@
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>USB &2.0-controller inschakelen</translation>
+        <translation type="obsolete">USB &2.0-controller inschakelen</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5418,7 +6042,31 @@
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 is momenteel voor deze virtuele machine ingeschakeld. Dit vereist echter dat <b>%1</b> is geïnstalleerd. Installeer het Extention Pack van de VirtualBox-downloadsite of schakel USB 2.0 uit waardoor de machine kan opstarten.</translation>
+        <translation type="obsolete">USB 2.0 is momenteel voor deze virtuele machine ingeschakeld. Dit vereist echter dat <b>%1</b> is geïnstalleerd. Installeer het Extention Pack van de VirtualBox-downloadsite of schakel USB 2.0 uit waardoor de machine kan opstarten.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5558,7 +6206,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation>S&luiten</translation>
+        <translation type="obsolete">S&luiten</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5573,8 +6225,31 @@
         <translation><p>U staat op het punt de attributen van de virtuele schijf op plek <b>%1</b> te veranderen.</p><p>Kies hieronder een mediumtype en druk op <b>%2</b> om door te gaan, of <b>%3</b>.</p></translation>
     </message>
     <message>
-        <source>Choose mode:</source>
-        <translation>Kies mediumtype:</translation>
+        <source>Choose mode:</source>
+        <translation>Kies mediumtype:</translation>
+    </message>
+</context>
+<context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Sluiten</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5627,7 +6302,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Het is niet gelukt het VirtualBox COM-object aan te maken.</p><p>Het programma wordt nu afgesloten.</p></translation>
+        <translation type="obsolete"><p>Het is niet gelukt het VirtualBox COM-object aan te maken.</p><p>Het programma wordt nu afgesloten.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -5868,9 +6543,9 @@
         <translation type="obsolete">Download</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Aankoppelen</translation>
+        <translation type="obsolete">Aankoppelen</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6007,8 +6682,8 @@
         <translation type="obsolete">Toon produktinformatie</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Er is een nieuwe versie van VirtualBox vrijgegeven! Versie <b>%1</b> is beschikbaar bij <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>U kunt deze versie direct downloaden via deze link:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Er is een nieuwe versie van VirtualBox vrijgegeven! Versie <b>%1</b> is beschikbaar bij <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>U kunt deze versie direct downloaden via deze link:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6084,11 +6759,11 @@
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Eén of meer virtuele harde schijven, cd/dvd's of diskettes zijn nu niet te benaderen. U kunt niet met de virtuele machines die deze media gebruiken werken, totdat dit medium of deze media weer benaderbaar zijn.</p><p>Druk op de knop <b>Controleren</b> om de Virtuele Media Manager te openen om na te gaan welk medium niet te benaderen is, of druk op de knop <b>Negeren</b> om dit bericht te negeren.</p></translation>
+        <translation type="obsolete"><p>Eén of meer virtuele harde schijven, cd/dvd's of diskettes zijn nu niet te benaderen. U kunt niet met de virtuele machines die deze media gebruiken werken, totdat dit medium of deze media weer benaderbaar zijn.</p><p>Druk op de knop <b>Controleren</b> om de Virtuele Media Manager te openen om na te gaan welk medium niet te benaderen is, of druk op de knop <b>Negeren</b> om dit bericht te negeren.</p [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Een fatale fout is opgetreden terwijl de virtuele machine draaide. De machine is nu gestopt.</p><p>Kijk voor ondersteuning op de community sectie van <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> of raadpleeg uw eigen ondersteuningscontact. Stel alstublieft de inhoud van het logbestand <tt>VBox.log</tt> en het imagebestand <tt>VBox.png</tt> ter beschikking. Deze kunt u terugvinden in de < [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Een fatale fout is opgetreden terwijl de virtuele machine draaide. De machine is nu gestopt.</p><p>Kijk voor ondersteuning op de community sectie van <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> of raadpleeg uw eigen ondersteuningscontact. Stel alstublieft de inhoud van het logbestand <tt>VBox.log</tt> en het imagebestand <tt>VBox.png</tt> ter beschikking. Deze kunt u terugvin [...]
     </message>
     <message>
         <source>You are trying to shut down the guest with the ACPI power button. This is currently not possible because the guest does not support software shutdown.</source>
@@ -6251,7 +6926,7 @@
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Weet u zeker dat u het cd/dvd-apparaat wilt verwijderen?</p><p>Het is daarna niet meer mogelijk om CD's of ISO-images te koppelen of de Guest Additions te installeren.</p></translation>
+        <translation type="obsolete"><p>Weet u zeker dat u het cd/dvd-apparaat wilt verwijderen?</p><p>Het is daarna niet meer mogelijk om CD's of ISO-images te koppelen of de Guest Additions te installeren.</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -6354,7 +7029,7 @@
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>U staat op het punt een nieuw CD/DVD-station aan controller <b>%1</b> toe te voegen.</p><p>Wilt u een virtuele CD/DVD-schijf in het station plaatsen of voorlopig leeg laten?</p></translation>
+        <translation type="obsolete"><p>U staat op het punt een nieuw CD/DVD-station aan controller <b>%1</b> toe te voegen.</p><p>Wilt u een virtuele CD/DVD-schijf in het station plaatsen of voorlopig leeg laten?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -6376,11 +7051,11 @@
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Het is niet gelukt CD/DVD-station <nobr><b>%1</b></nobr> los te koppelen van het slot <i>%2</i> van virtuele machine <b>%3</b>.</translation>
+        <translation type="obsolete">Het is niet gelukt CD/DVD-station <nobr><b>%1</b></nobr> los te koppelen van het slot <i>%2</i> van virtuele machine <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Het is niet gelukt diskettestation <nobr><b>%1</b></nobr> los te koppelen van het slot <i>%2</i> van virtuele machine <b>%3</b>.</translation>
+        <translation type="obsolete">Het is niet gelukt diskettestation <nobr><b>%1</b></nobr> los te koppelen van het slot <i>%2</i> van virtuele machine <b>%3</b>.</translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
@@ -6425,19 +7100,19 @@
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Het is niet gelukt CD/DVD-station <nobr><b>%1</b></nobr> te koppelen aan het slot <i>%2</i> van de machine <b>%3</b>.</translation>
+        <translation type="obsolete">Het is niet gelukt CD/DVD-station <nobr><b>%1</b></nobr> te koppelen aan het slot <i>%2</i> van de machine <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Het is niet gelukt diskettestation <nobr><b>%1</b></nobr> te koppelen aan het slot <i>%2</i> van de machine <b>%3</b>.</translation>
+        <translation type="obsolete">Het is niet gelukt diskettestation <nobr><b>%1</b></nobr> te koppelen aan het slot <i>%2</i> van de machine <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Weet dat de opslageenheid van dit medium niet wordt verwijderd en het dus mogelijk is deze later opnieuw te gebruiken.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>De VirtualBox Guest Additions lijken niet beschikbaar op deze virtuele machine. Gedeelde mappen kunnen dan niet worden gebruikt. Om gedeelde mappen binnen de virtuele machine te kunnen gebruiken, installeert u de Guest Additions indien deze nog niet zijn geïnstalleerd. Indien wel, moet u deze herinstalleren. Selecteer <b>Installeer Guest Additions</b> uit het menu <b>Machine</b>. Zijn de Guest Additions wel goed geïnstalleerd maar is  [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>De VirtualBox Guest Additions lijken niet beschikbaar op deze virtuele machine. Gedeelde mappen kunnen dan niet worden gebruikt. Om gedeelde mappen te kunnen gebruiken binnen de virtuele machine installeert u de Guest Additions indien deze nog niet zijn geïnstalleerd. Indien wel, moet u deze herinstalleren. Selecteer <b>Installeer Guest Additions</b> uit het menu <b>Machine</b>. Zijn de Guest Additions wel goed geïnsta [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -6677,7 +7352,7 @@
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Data droppen is niet gelukt.</translation>
+        <translation type="obsolete">Data droppen is niet gelukt.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -6875,8 +7550,8 @@
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
         <translation>
-            <numerusform><p>De volgende virtuele machine bevindt zich momenteel in opgeslagen staat: %n  <b>%1</b></p><p>Indien u doorgaat wordt de runtime-staat van de geëxporteerde machine weggegooid. De bestaande machine wordt niet veranderd.</p></numerusform>
-            <numerusform><p>De volgende virtuele machines bevinden zich momenteel in opgeslagen staat: %n  <b>%1</b></p><p>Indien u doorgaat wordt de runtime-staat van de geëxporteerde machines weggegooid. De bestaande machines worden niet veranderd.</p></numerusform>
+            <numerusform><p>De volgende virtuele machine bevindt zich momenteel in opgeslagen staat: <b>%1</b></p><p>Indien u doorgaat wordt de runtime-staat van de geëxporteerde machine weggegooid. De bestaande machine wordt niet veranderd.</p></numerusform>
+            <numerusform><p>De volgende virtuele machines bevinden zich momenteel in opgeslagen staat: <b>%1</b></p><p>Indien u doorgaat wordt de runtime-staat van de geëxporteerde machines weggegooid. De bestaande machines worden niet veranderd.</p></numerusform>
         </translation>
     </message>
     <message>
@@ -6917,11 +7592,11 @@
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>Het <b>VirtualBox Guest Additions</b>-schijfimagebestand is met succes gedownload van <nobr><a href="%1">%1</a></nobr> en lokaal opgeslagen als <nobr><b>%2</b></nobr>.</p><p>Wilt u het schijfimagebestand registreren en in het virtuele cd/dvd-station doen?</p></translation>
+        <translation type="obsolete"><p>Het <b>VirtualBox Guest Additions</b>-schijfimagebestand is met succes gedownload van <nobr><a href="%1">%1</a></nobr> en lokaal opgeslagen als <nobr><b>%2</b></nobr>.</p><p>Wilt u het schijfimagebestand registreren en in het virtuele cd/dvd-station doen?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Kon het <b>VirtualBox Guest Additions</b>-schijfimagebestand niet in de virtuele machine <b>%1</b> doen, omdat de machine geen cd/dvd-station heeft. Voeg een station toe via de pagina Opslag bij Instellingen van de virtuele machine.</p></translation>
+        <translation type="obsolete"><p>Kon het <b>VirtualBox Guest Additions</b>-schijfimagebestand niet in de virtuele machine <b>%1</b> doen, omdat de machine geen cd/dvd-station heeft. Voeg een station toe via de pagina Opslag bij Instellingen van de virtuele machine.</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
@@ -6956,29 +7631,121 @@
         <translation><p>Wilt u het NAT-netwerk <nobr><b>%1</b> verwijderen?</nobr></p><p>Als dit netwerk door één of meer virtuele netwerkadapters wordt gebruikt, zullen deze adapters niet langer werken totdat u de instellingen daarvan aanpast. Kies in dat geval een andere netwerknaam of een ander adapter-attachmenttype voor deze adapters.</p></translation>
     </message>
     <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>De VirtualBox Guest Additions lijken niet beschikbaar op deze virtuele machine. Gedeelde mappen kunnen dan niet worden gebruikt. Om gedeelde mappen te kunnen gebruiken binnen de virtuele machine installeert u de Guest Additions indien deze nog niet zijn geïnstalleerd. Indien wel, moet u deze herinstalleren. Selecteer <b>Installeer Guest Additions</b> uit het menu <b>Machine</b>. Zijn de Guest Additions wel goed geïnsta [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Aankoppelen</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Het is niet gelukt webcam <b>%1</b> te koppelen aan virtuele machine <b>%2</b>.</translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Het is niet gelukt webcam <b>%1</b> van virtuele machine <b>%2</b> los te koppelen.</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translatorcomment>In het Nederlands wordt dit afhankelijk van het OS vertaald:
-Windows: Beeldscherm en Configuratiescherm
-Linux: Schermen en Voorkeuren</translatorcomment>
-        <translation><p>Het virtuele scherm staat momenteel in <b>%1&nbsp;bit</b>-colormodus. Verander dit in <b>%2&nbsp;bit</b> voor een betere prestatie. Normaal gesproken kan dit via het menu-item <b>Beeldscherm</b> in het Configuratiescherm of via <b>Schermen</b> bij Voorkeuren van het gastbesturingssysteem (afhankelijk van de gast).</p></translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7051,7 +7818,7 @@ Linux: Schermen en Voorkeuren</translatorcomment>
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Naam:</translation>
     </message>
     <message>
@@ -7585,14 +8352,18 @@ Linux: Schermen en Voorkeuren</translatorcomment>
         <translation>Bestanden virtuele machine (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Welkom bij VirtualBox!</h3><p>Het linker deel van dit venster zal straks alle virtuele machines tonen die op uw computer staan. De lijst is nu leeg omdat u nog geen virtuele machines hebt aangemaakt.<img src=:/welcome.png align=right/></p><p>Om een nieuwe virtuele machine aan te maken klikt u op de knop <b>Nieuw</b> in de werkbalk linksboven in het venster.</p><p>De toets <b>%1</b> opent een  [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Welkom bij VirtualBox!</h3><p>Het linker deel van dit venster zal straks alle virtuele machines tonen die op uw computer staan. De lijst is nu leeg omdat u nog geen virtuele machines hebt aangemaakt.<img src=:/welcome.png align=right/></p><p>Om een nieuwe virtuele machine aan te maken klikt u op de knop <b>Nieuw</b> in de werkbalk linksboven in het venster.</p><p>De toets <b>%1</ [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Manager</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -7625,7 +8396,7 @@ Linux: Schermen en Voorkeuren</translatorcomment>
     </message>
     <message>
         <source>Settings</source>
-        <translation>Instellingen</translation>
+        <translation type="obsolete">Instellingen</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -7678,6 +8449,10 @@ Linux: Schermen en Voorkeuren</translatorcomment>
         <source>Display</source>
         <translation>Beeldscherm</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -7729,6 +8504,43 @@ Linux: Schermen en Voorkeuren</translatorcomment>
         <source>%1 - %2</source>
         <translation>%1 - %2</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Instellingen</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Sluiten</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -7853,19 +8665,143 @@ Linux: Schermen en Voorkeuren</translatorcomment>
         <translation><p>Als dit is ingesteld zal de staat van de machine nadat deze is uitgezet, teruggezet worden naar de staat zoals deze in het huidige snapshot is vastgelegd. Dit is handig indien u er zeker van bent, dat u de resultaten van uw laatste sessie niet wilt bewaren en de volgende keer wilt beginnen vanaf het huidige snapshot.</p></translation>
     </message>
     <message>
-        <source>&Restore current snapshot '%1'</source>
-        <translation>&Terugzetten huidig snapshot '%1'</translation>
+        <source>&Restore current snapshot '%1'</source>
+        <translation>&Terugzetten huidig snapshot '%1'</translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
+    <message>
+        <source>&Details</source>
+        <translation>&Details</translation>
+    </message>
+    <message>
+        <source>&Snapshots</source>
+        <translation>&Snapshots</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Sessie-informatie</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Details</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Runtime</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA overdracht</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO-overdracht</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Gelezen data</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Geschreven data</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Verzonden data</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Ontvangen data</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Runtime attributen</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Schermresolutie</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Niet ontdekt</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Niet ontdekt</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translatorcomment>als begrip niet vertalen</translatorcomment>
+        <translation>Guest Additions</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Gast OS-type</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Geen netwerkadapters</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Opslagstatistieken</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Geen opslagapparaten</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Netwerkstatistieken</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Niet beschikbaar</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Klembordmodus</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translatorcomment>RL: Of 'Slepen-en-Neerzetten' - 't blijft een eeuwige discussie</translatorcomment>
+        <translation type="obsolete">Slepen-naar-modus</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>Configuratie&details</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>&Runtime-informatie</translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <source>&Details</source>
-        <translation>&Details</translation>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Snapshots</source>
-        <translation>&Snapshots</translation>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7987,11 +8923,27 @@ Linux: Schermen en Voorkeuren</translatorcomment>
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Beschrijving verbergen</translation>
+        <translation type="obsolete">Beschrijving verbergen</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Beschrijving tonen</translation>
+        <translation type="obsolete">Beschrijving tonen</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8667,8 +9619,8 @@ Linux: Schermen en Voorkeuren</translatorcomment>
         <translation><standaard terugzetten></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>De daadwerkelijke waarde van het standaardpad wordt pas weergegeven na acceptatie van de wijzigingen en het opnieuw openen van dit venster.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">De daadwerkelijke waarde van het standaardpad wordt pas weergegeven na acceptatie van de wijzigingen en het opnieuw openen van dit dialoog.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -8716,8 +9668,7 @@ Linux: Schermen en Voorkeuren</translatorcomment>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">De daadwerkelijke waarde van het standaardpad wordt pas weergegeven na acceptatie van de wijzigingen en het opnieuw openen van dit dialoog.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8905,7 +9856,7 @@ Linux: Schermen en Voorkeuren</translatorcomment>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>cd/dvd</translation>
+        <translation type="obsolete">cd/dvd</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -9598,17 +10549,17 @@ Linux: Schermen en Voorkeuren</translatorcomment>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
         <translatorcomment>RL - Definitie: "A differencing disk is a virtual hard disk you use to isolate changes to a virtual hard disk or the guest operating system by storing them in a separate file." Een techterm dus. Niet vertalen.</translatorcomment>
-        <translation>Aankoppelen van deze harde schijf wordt indirect uitgevoerd met gebruik van een nieuw aangemaakte differencing harde schijf.</translation>
+        <translation type="obsolete">Aankoppelen van deze harde schijf wordt indirect uitgevoerd met gebruik van een nieuw aangemaakte differencing harde schijf.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Enkele media in deze keten van harde schijven zijn niet te benaderen. Gebruik de Virtuele Media Manager in <b>Geef differencing harde schijven weer</b>-modus om deze media te inspecteren.</translation>
+        <translation type="obsolete">Enkele media in deze keten van harde schijven zijn niet te benaderen. Gebruik de Virtuele Media Manager in <b>Geef differencing harde schijven weer</b>-modus om deze media te inspecteren.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Deze basis harde schijf wordt indirect gekoppeld met gebruik van de volgende differencing harde schijf:</translation>
+        <translation type="obsolete">Deze basis harde schijf wordt indirect gekoppeld met gebruik van de volgende differencing harde schijf:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -9656,7 +10607,7 @@ Linux: Schermen en Voorkeuren</translatorcomment>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -10204,12 +11155,12 @@ Linux: Schermen en Voorkeuren</translatorcomment>
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Ingeschakeld</translation>
+        <translation type="obsolete">Ingeschakeld</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Uitgeschakeld</translation>
+        <translation type="obsolete">Uitgeschakeld</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -10272,7 +11223,151 @@ Linux: Schermen en Voorkeuren</translatorcomment>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Geen</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Standaard</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Actief</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Actief</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Actief</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10524,6 +11619,18 @@ Linux: Schermen en Voorkeuren</translatorcomment>
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Maak een nieuwe virtuele harde schijf aan</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -10792,8 +11899,8 @@ Linux: Schermen en Voorkeuren</translatorcomment>
         <translation type="obsolete">Hervat de uitvoering van de geselecteerde virtuele machine</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Welkom bij VirtualBox!</h3><p>Het linker deel van dit venster is bedoeld om alle virtuele machines die op uw compter staan weer te geven. De lijst is nu leeg omdat u nog geen virtuele machines hebt aangemaakt.<img src=:/welcome.png align=right/></p><p>Om een nieuwe virtuele machine aan te maken klikt u op de knop <b>Nieuw</b> in de werkbalk boven in het venster.</p><p>De toets <b>%1 [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Welkom bij VirtualBox!</h3><p>Het linker deel van dit venster is bedoeld om alle virtuele machines die op uw compter staan weer te geven. De lijst is nu leeg omdat u nog geen virtuele machines hebt aangemaakt.<img src=:/welcome.png align=right/></p><p>Om een nieuwe virtuele machine aan te maken klikt u op de knop <b>Nieuw</b> in de werkbalk boven in het venster.</p><p>De toets <b>%1 [...]
     </message>
     <message>
         <source>Show Toolbar</source>
@@ -10986,114 +12093,6 @@ Linux: Schermen en Voorkeuren</translatorcomment>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Sessie-informatie</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Details</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Runtime</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA overdracht</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO-overdracht</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Gelezen data</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Geschreven data</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Verzonden data</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Ontvangen data</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Runtime attributen</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Schermresolutie</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Niet ontdekt</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Niet ontdekt</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translatorcomment>als begrip niet vertalen</translatorcomment>
-        <translation>Guest Additions</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Gast OS-type</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Geen netwerkadapters</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Opslagstatistieken</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Geen opslagapparaten</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Netwerkstatistieken</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Niet beschikbaar</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Klembordmodus</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translatorcomment>RL: Of 'Slepen-en-Neerzetten' - 't blijft een eeuwige discussie</translatorcomment>
-        <translation>Slepen-naar-modus</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>Configuratie&details</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>&Runtime-informatie</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pl.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pl.ts
index a9a6982..2419f2c 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pl.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pl.ts
@@ -296,7 +296,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">T&ryb zintegrowany</translation>
+        <translation type="unfinished">T&ryb zintegrowany</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -320,11 +320,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Wyłącz &integrację myszy</translation>
+        <translation type="obsolete">Wyłącz &integrację myszy</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Tymczasowo wyłącza integrację kursora myszy gospodarza</translation>
+        <translation type="obsolete">Tymczasowo wyłącza integrację kursora myszy gospodarza</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -336,11 +336,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Wyślij Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&Wyślij Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Wysyła sekwencję Ctrl-Alt-Del do maszyny wirtualnej</translation>
+        <translation type="obsolete">Wysyła sekwencję Ctrl-Alt-Del do maszyny wirtualnej</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -348,7 +348,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Wysyła sekwencję Ctrl-Alt-Backspace do maszyny wirtualnej</translation>
+        <translation type="obsolete">Wysyła sekwencję Ctrl-Alt-Backspace do maszyny wirtualnej</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -363,8 +363,8 @@
         <translation type="obsolete">I&nformacje o sesji</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Wyświetla okno z informacjami o sesji</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Wyświetla okno z informacjami o sesji</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -420,15 +420,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Płyty &CD/DVD</translation>
+        <translation type="obsolete">Płyty &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>D&yskietki</translation>
+        <translation type="obsolete">D&yskietki</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&Urządzenia USB</translation>
+        <translation type="obsolete">&Urządzenia USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -455,12 +455,12 @@
         <translation type="obsolete">Włącza lub wyłącza zdalne połączenia RDP do tej maszyny</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">Za&instaluj Dodatki (Guest Additions)...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">Za&instaluj Dodatki (Guest Additions)...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Montuje obraz z instalatorem Dodatków dla goszczonych systemów (Guest Additions)</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Montuje obraz z instalatorem Dodatków dla goszczonych systemów (Guest Additions)</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -479,7 +479,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">&Logowanie...</translation>
+        <translation type="obsolete">&Logowanie...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -556,26 +556,10 @@
         <translation type="obsolete">Wyłącz &logowanie...</translation>
     </message>
     <message>
-        <source>Switch to &Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch between normal and fullscreen mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch to Seam&less Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and seamless desktop integration mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch to &Scaled Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and scaled mode</source>
         <translation type="unfinished"></translation>
     </message>
@@ -644,10 +628,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished">&Plik</translation>
@@ -919,10 +899,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -967,23 +943,249 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">Za&instaluj Dodatki (Guest Additions)...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Montuje obraz z instalatorem Dodatków dla goszczonych systemów (Guest Additions)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Klawiatura</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Sieć</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Pokaż &log...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Plik</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Włącz</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1499,14 +1701,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1621,6 +1823,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2306,11 +2535,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">Niepodłączona</translation>
@@ -2519,24 +2743,119 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Kontroler</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>None</source>
-        <comment>details</comment>
-        <translation type="obsolete">Brak</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Kontroler USB</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Kontroler</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Brak</translation>
+    </message>
+</context>
+<context>
     <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
         <source>Video Memory</source>
@@ -2845,18 +3164,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Automatycznie pokazuj Dock oraz pasek menu w trybie pełnoekranowym</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4025,12 +4332,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Wskaźnik aktywności nośników CD/DVD:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Wskaźnik aktywności nośników CD/DVD:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Wskaźnik aktywności dyskietek:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Wskaźnik aktywności dyskietek:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4070,7 +4377,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Kontroler USB jest wyłączony</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Kontroler USB jest wyłączony</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4125,6 +4432,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4251,7 +4572,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Wideo</translation>
+        <translation type="obsolete">&Wideo</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4426,10 +4747,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4481,7 +4798,75 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Miniaturowy pasek narzędzi:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Pokazywanie miniaturowego paska narzędzi w trybach pełnoekranowym i zintegrowanym.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Pokaż w trybie p&ełnoekranowym/zintegrowanym</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Pokazywanie miniaturowego paska narzędzi u góry ekranu, zamiast domyślnej pozycji u dołu ekranu.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Pokaż u &góry ekranu</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4496,7 +4881,7 @@ p, li { white-space: pre-wrap; }
         <translation>Zawiera ścieżkę do katalogu, w którym będą zapisywane migawki maszyny wirtualnej. Uwaga: migawki mogą zająć sporo miejsca na dysku.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Podstawowe</translation>
     </message>
     <message>
@@ -4544,7 +4929,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Kontroluje ilość pamięci wideo przydzielonej maszynie wirtualnej.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Zaawansowane</translation>
     </message>
     <message>
@@ -4632,7 +5017,7 @@ p, li { white-space: pre-wrap; }
         <translation>&Katalog migawek:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>Opi&s</translation>
     </message>
     <message>
@@ -4645,7 +5030,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Zaznaczenie tej opcji powoduje, że zmiany w ustawieniach zamontowanych nośników CD/DVD oraz dyskietek dokonane podczas pracy maszyny będą zapisywane pomiędzy kolejnymi uruchomieniami maszyny.</translation>
+        <translation type="obsolete">Zaznaczenie tej opcji powoduje, że zmiany w ustawieniach zamontowanych nośników CD/DVD oraz dyskietek dokonane podczas pracy maszyny będą zapisywane pomiędzy kolejnymi uruchomieniami maszyny.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -4689,38 +5074,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Nośniki wymienne:</translation>
+        <translation type="obsolete">Nośniki wymienne:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Z&apamiętaj zmiany wprowadzone podczas pracy maszyny</translation>
+        <translation type="obsolete">Z&apamiętaj zmiany wprowadzone podczas pracy maszyny</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Miniaturowy pasek narzędzi:</translation>
+        <translation type="obsolete">Miniaturowy pasek narzędzi:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Pokazywanie miniaturowego paska narzędzi w trybach pełnoekranowym i zintegrowanym.</translation>
+        <translation type="obsolete">Pokazywanie miniaturowego paska narzędzi w trybach pełnoekranowym i zintegrowanym.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Pokaż w trybie p&ełnoekranowym/zintegrowanym</translation>
+        <translation type="obsolete">Pokaż w trybie p&ełnoekranowym/zintegrowanym</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Pokazywanie miniaturowego paska narzędzi u góry ekranu, zamiast domyślnej pozycji u dołu ekranu.</translation>
+        <translation type="obsolete">Pokazywanie miniaturowego paska narzędzi u góry ekranu, zamiast domyślnej pozycji u dołu ekranu.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Pokaż u &góry ekranu</translation>
+        <translation type="obsolete">Pokaż u &góry ekranu</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">wybrano 64-bitowy system operacyjny dla tej maszyny wirtualnej. Ponieważ tego typu goszczone systemy wymagają wsparcia dla sprzętowej wirtualizacji (VT-x/AMD-V), funkcja ta zostanie włączona automatycznie.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -4735,6 +5120,102 @@ p, li { white-space: pre-wrap; }
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Miniaturowy pasek narzędzi:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Pokazywanie miniaturowego paska narzędzi w trybach pełnoekranowym i zintegrowanym.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Pokaż w trybie p&ełnoekranowym/zintegrowanym</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Pokazywanie miniaturowego paska narzędzi u góry ekranu, zamiast domyślnej pozycji u dołu ekranu.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Pokaż u &góry ekranu</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5336,10 +5817,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5390,11 +5867,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Zaznaczenie tej opcji powoduje, że nazwane łącze wskazane w polu <b>Ścieżka portu</b> zostanie utworzone podczas uruchamiania maszyny wirtualnej. W przeciwnym razie maszyna wirtualna spróbuje użyć istniejącego łącza nazwanego.</translation>
+        <translation type="obsolete">Zaznaczenie tej opcji powoduje, że nazwane łącze wskazane w polu <b>Ścieżka portu</b> zostanie utworzone podczas uruchamiania maszyny wirtualnej. W przeciwnym razie maszyna wirtualna spróbuje użyć istniejącego łącza nazwanego.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Stwórz łącze nazwane</translation>
+        <translation type="obsolete">&Stwórz łącze nazwane</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5402,11 +5879,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Zawiera ścieżkę do łącza nazwanego dla portu szeregowego w systemie gospodarza, jeśli port pracuje w trybie <b>Nazwane łącze w systemie gospodarza</b> lub nazwę sprzętowego portu szeregowego, jeśli port pracuje w trybie <b>Sprzętowy port gospodarza</b>.</translation>
+        <translation type="obsolete">Zawiera ścieżkę do łącza nazwanego dla portu szeregowego w systemie gospodarza, jeśli port pracuje w trybie <b>Nazwane łącze w systemie gospodarza</b> lub nazwę sprzętowego portu szeregowego, jeśli port pracuje w trybie <b>Sprzętowy port gospodarza</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Ś&cieżka portu/pliku:</translation>
+        <translation type="obsolete">Ś&cieżka portu/pliku:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5416,6 +5893,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Zawiera bazowy adres I/O danego portu szeregowego. Poprawne wartości to liczby szesnastkowe od <tt>0</tt> do <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5532,11 +6025,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Dodaj&nbsp;płytę&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Dodaj&nbsp;płytę&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Dodaj&nbsp;stację&nbsp;dyskietek</nobr></translation>
+        <translation type="obsolete"><nobr>Dodaj&nbsp;stację&nbsp;dyskietek</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -5580,11 +6073,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Dodaj płytę CD/DVD</translation>
+        <translation type="obsolete">Dodaj płytę CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Dodaj dyskietkę</translation>
+        <translation type="obsolete">Dodaj dyskietkę</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5771,18 +6264,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD &Drive:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Floppy &Drive:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5803,11 +6284,7 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Remove disk from virtual drive</source>
+        <source>Remove disk from virtual drive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -5872,6 +6349,54 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -6088,31 +6613,39 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6185,7 +6718,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Włącz kontroler USB 2.0 (E&HCI)</translation>
+        <translation type="obsolete">Włącz kontroler USB 2.0 (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6240,7 +6773,27 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"><nobr>Stan: %1</nobr></translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6379,7 +6932,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Wybierz</translation>
     </message>
     <message>
-        <source>C&lose</source>
+        <source>Removing medium...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6399,6 +6952,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Zamknij</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Przełącz</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6440,7 +7016,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Nie udało się stworzyć obiektu COM VirtualBox.</p><p>Aplikacja zostanie zamknięta.</p></translation>
+        <translation type="obsolete"><p>Nie udało się stworzyć obiektu COM VirtualBox.</p><p>Aplikacja zostanie zamknięta.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -6721,15 +7297,15 @@ p, li { white-space: pre-wrap; }
         <translation><p>Wystąpił błąd podczas pracy maszyny wirtualnej! Więcej informacji o błędzie znajduje się poniżej. Można spróbować usunąć przyczynę błędu i wznowić pracę maszyny wirtualnej.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Dodatki VirtualBox (Guest Additions) zainstalowane w goszczonym systemie operacyjnym są zbyt stare: zainstalowana wersja to %1, a wersja wymagana - %2. Niektóre z funkcji wymagające do pracy Dodatków (jak np. integracja myszy, automatyczne skalowanie ekranu gościa) najprawdopodobniej przestaną pracować poprawnie.</p><p>Proszę uaktualnić Dodatki do wymaganej wersji poprzez wybranie opcji <b>Zainstaluj Dodatki (Guest Additions [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Dodatki VirtualBox (Guest Additions) zainstalowane w goszczonym systemie operacyjnym są zbyt stare: zainstalowana wersja to %1, a wersja wymagana to %2. Niektóre z funkcji wymagające do pracy Dodatków (jak np. integracja myszy, automatyczne skalowanie ekranu gościa) mogą pracować niezgodnie z oczekiwaniami.</p><p>Zalecane jest uaktualnienie Dodatków do wymaganej wersji poprzez wybranie opcji <b>Zainstaluj Dodatki (Guest Addi [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Dodatki VirtualBox (Guest Additions) zainstalowane w goszczonym systemie operacyjnym są zbyt nowe dla tej wersji programu VirtualBox: zainstalowana wersja to %1, a wersja wymagana - %2. Używanie nowszej wersji Dodatków wraz ze starsza wersją programu VirtualBox nie jest wspierane. Proszę zainstalować wymaganą wersję Dodatków poprzez wybranie opcji <b>Zainstaluj Dodatki (Guest Additions)...</b> z menu <b>Urządzenia</b>. [...]
     </message>
     <message>
@@ -6773,8 +7349,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Okno maszyny wirtualnej jest zoptymalizowane do pracy w <b>%1&nbsp;bitowym</b> trybie kolorów, natomiast w goszczonym systemie operacyjnym ustawiony jest aktualnie tryb <b>%2&nbsp;bitowy</b>.</p><p>Proszę otworzyć okno ustawień ekranu w goszczonym sytemie i jeśli to możliwe, wybrać tryb <b>%3&nbsp;bitowego</b> koloru, aby uzyskać najlepszą wydajność wirtualnego podsystemu wideo.</ [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>Wystąpił błąd krytyczny podczas pracy maszyny wirtualnej i została ona zatrzymana.</p><p>Pomoc można uzyskać korzystając z forum na stronie <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> (sekcja Community) lub kontaktując się bezpośrednio z nami. Proszę pamiętać, aby do opisu problemu dołączyć zawartość pliku z logiem <tt>VBox.log</tt> oraz plik obrazu <tt>VBox.png</tt>, które [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Wystąpił błąd krytyczny podczas pracy maszyny wirtualnej i została ona zatrzymana.</p><p>Pomoc można uzyskać korzystając z forum na stronie <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> (sekcja Community) lub kontaktując się bezpośrednio z nami. Proszę pamiętać, aby do opisu problemu dołączyć zawartość pliku z logiem <tt>VBox.log</tt> oraz plik obrazu <tt>VBox.png</tt>, które m [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
@@ -6881,9 +7457,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Pobierz</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Zamontuj</translation>
+        <translation type="obsolete">Zamontuj</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7051,8 +7627,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Pokazuje okno z informacjami o produkcie</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Została wydana nowa wersja VirtualBox! Wersja <b>%1</b> jest dostępna na <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Można pobrać tę wersję bezpośrednio spod adresu:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Została wydana nowa wersja VirtualBox! Wersja <b>%1</b> jest dostępna na <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Można pobrać tę wersję bezpośrednio spod adresu:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7152,7 +7728,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Jeden lub więcej z zarejestrowanych wirtualnych twardych dysków, nośników CD/DVD lub dyskietek nie jest w tej chwili dostępny. W wyniku tego nie będzie można używać maszyn wirtualnych korzystających z tych nośników, dopóki dostęp do nich nie zostanie uzyskany ponownie.</p><p>Proszę wcisnąć <b>Sprawdź</b>, aby otworzyć Menedżera nośników wirtualnych i sprawdzić które z nośników są niedostępne lub <b>Ignoruj</b>, aby zignoro [...]
+        <translation type="obsolete"><p>Jeden lub więcej z zarejestrowanych wirtualnych twardych dysków, nośników CD/DVD lub dyskietek nie jest w tej chwili dostępny. W wyniku tego nie będzie można używać maszyn wirtualnych korzystających z tych nośników, dopóki dostęp do nich nie zostanie uzyskany ponownie.</p><p>Proszę wcisnąć <b>Sprawdź</b>, aby otworzyć Menedżera nośników wirtualnych i sprawdzić które z nośników są niedostępne lub <b>Ignoruj</b& [...]
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -7182,8 +7758,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Nadpisz</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Wystąpił błąd krytyczny podczas pracy maszyny wirtualnej i została ona zatrzymana.</p><p>Pomoc można uzyskać korzystając z forum na stronie <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> (sekcja Community) lub kontaktując się bezpośrednio z nami. Proszę pamiętać, aby do opisu problemu dołączyć zawartość pliku z logiem <tt>VBox.log</tt> oraz plik obrazu <tt>VBox.png</tt>, które można znaleźć w [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Wystąpił błąd krytyczny podczas pracy maszyny wirtualnej i została ona zatrzymana.</p><p>Pomoc można uzyskać korzystając z forum na stronie <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> (sekcja Community) lub kontaktując się bezpośrednio z nami. Proszę pamiętać, aby do opisu problemu dołączyć zawartość pliku z logiem <tt>VBox.log</tt> oraz plik obrazu <tt>VBox.png</tt>, które m [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7466,7 +8042,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Usunąć napęd CD/DVD?</p><p>Po jego usunięciu nie będzie możliwe montowanie płyt CD, obrazów ISO oraz instalacja Dodatków (Guest Additions)!</p></translation>
+        <translation type="obsolete"><p>Usunąć napęd CD/DVD?</p><p>Po jego usunięciu nie będzie możliwe montowanie płyt CD, obrazów ISO oraz instalacja Dodatków (Guest Additions)!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7546,10 +8122,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7558,14 +8130,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -7594,14 +8158,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7807,10 +8363,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -8040,14 +8592,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -8080,26 +8624,122 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Zamontuj</translation>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>Insert</source>
+        <comment>additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetAdditions</name>
@@ -8179,7 +8819,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished">&Nazwa:</translation>
     </message>
     <message>
@@ -9084,14 +9724,18 @@ Będzie ona używana przez wszystkie moduły VirtualBox, aby móc rozróżnić t
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="unfinished"><h3>Witamy w VirtualBox!</h3><p>Lewa część tego okna przeznaczona jest do wyświetlania listy maszyn wirtualnych dostępnych na tym komputerze. Lista jest teraz pusta, ponieważ nie utworzono jeszcze żadnej maszyny.<img src=:/welcome.png align=right/></p><p>Aby utworzyć nową wirtualną maszynę, proszę wcisnąć przycisk <b>Nowa</b> na głównym pasku narzędziowym, umieszczonym na górze okna.</p><p> [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Witamy w VirtualBox!</h3><p>Lewa część tego okna przeznaczona jest do wyświetlania listy maszyn wirtualnych dostępnych na tym komputerze. Lista jest teraz pusta, ponieważ nie utworzono jeszcze żadnej maszyny.<img src=:/welcome.png align=right/></p><p>Aby utworzyć nową wirtualną maszynę, proszę wcisnąć przycisk <b>Nowa</b> na głównym pasku narzędziowym, umieszczonym na górze okna.</p><p>Mo [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9120,7 +9764,7 @@ Będzie ona używana przez wszystkie moduły VirtualBox, aby móc rozróżnić t
     </message>
     <message>
         <source>Settings</source>
-        <translation type="unfinished">Ustawienia</translation>
+        <translation type="obsolete">Ustawienia</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -9173,6 +9817,10 @@ Będzie ona używana przez wszystkie moduły VirtualBox, aby móc rozróżnić t
         <source>Display</source>
         <translation type="unfinished">Ekran</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -9236,6 +9884,43 @@ Będzie ona używana przez wszystkie moduły VirtualBox, aby móc rozróżnić t
         <source>you have enabled a USB HID (Human Interface Device). This will not work unless USB emulation is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source>
         <translation type="obsolete">włączony jest USB HID (Human Interface Device). Nie będzie to działać, chyba że włączona będzie również emulacja USB. Zostanie to wykonane automatycznie po zatwierdzeniu ustawień maszyny wirtualnej przyciskiem OK.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Ustawienia</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Zamknij</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -9335,8 +10020,8 @@ Będzie ona używana przez wszystkie moduły VirtualBox, aby móc rozróżnić t
         <translation type="obsolete">Podsumowanie</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Została wydana nowa wersja VirtualBox! Wersja <b>%1</b> jest dostępna na <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Można pobrać tę wersję bezpośrednio spod adresu:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Została wydana nowa wersja VirtualBox! Wersja <b>%1</b> jest dostępna na <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Można pobrać tę wersję bezpośrednio spod adresu:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -9404,6 +10089,14 @@ Będzie ona używana przez wszystkie moduły VirtualBox, aby móc rozróżnić t
         <source>&Restore current snapshot '%1'</source>
         <translation type="unfinished">&Przywróć aktualną migawkę '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -9417,15 +10110,234 @@ Będzie ona używana przez wszystkie moduły VirtualBox, aby móc rozróżnić t
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>Niedostępna</translation>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Informacje o sesji</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 od %3</nobr><br><nobr>Sesja %4</nobr></translation>
+        <source>&Close</source>
+        <translation type="obsolete">Z&amknij</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informacje o sesji</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Szczegóły</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">Łączny &czas używania</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transfer DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transfer PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Dane odczytane</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Dane zapisane</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Dane wysłane</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Dane odebrane</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Włączone</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Wyłączone</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Parametry maszyny</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Rozdzielczość ekranu</translation>
+    </message>
+    <message>
+        <source>Hardware Virtualization</source>
+        <translation type="obsolete">Wirtualizacja sprzętu</translation>
+    </message>
+    <message>
+        <source>IDE Hard Disk Statistics</source>
+        <translation type="obsolete">Statystyki dysków twardych IDE</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Statystyki CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Statystyki kart sieciowych</translation>
+    </message>
+    <message>
+        <source>Adapter 1</source>
+        <translation type="obsolete">Karta 1</translation>
+    </message>
+    <message>
+        <source>Adapter 2</source>
+        <translation type="obsolete">Karta 2</translation>
+    </message>
+    <message>
+        <source>Adapter 3</source>
+        <translation type="obsolete">Karta 3</translation>
+    </message>
+    <message>
+        <source>Adapter 4</source>
+        <translation type="obsolete">Karta 4</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Niepodłączona</translation>
+    </message>
+    <message>
+        <source>Hard Disks Statistics</source>
+        <translation type="obsolete">Statystyki dysków twardych</translation>
+    </message>
+    <message>
+        <source>Primary Master</source>
+        <translation type="obsolete">Pierwszy (Primary, IDE0) Nadrzędny (Master)</translation>
+    </message>
+    <message>
+        <source>Primary Slave</source>
+        <translation type="obsolete">Pierwszy (Primary, IDE0) Podrzędny (Slave)</translation>
+    </message>
+    <message>
+        <source>Secondary Master</source>
+        <translation type="obsolete">Drugi (Secondary, IDE1) Nadrzędny (Master)</translation>
+    </message>
+    <message>
+        <source>Secondary Slave</source>
+        <translation type="obsolete">Drugi (Secondary, IDE1) Podrzędny (Slave)</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Wersja %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Nie wykryto</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Nie wykryto</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Dodatki (Guest Additions)</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Typ systemu operacyjnego gościa</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Statystyki dysków twardych</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Brak dysków twardych</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Brak kart sieciowych</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Włączone</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Wyłączone</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Zagnieżdżone stronicowanie</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Niedostępne</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Statystyka nośników</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Brak urządzeń</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Statystyka sieci</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Zagnieżdżone stronicowanie</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation type="unfinished">Niedostępne</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>Niedostępna</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation><nobr>%1<br></nobr><nobr>%2 od %3</nobr><br><nobr>Sesja %4</nobr></translation>
     </message>
     <message>
         <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
@@ -9535,11 +10447,19 @@ Będzie ona używana przez wszystkie moduły VirtualBox, aby móc rozróżnić t
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -10545,11 +11465,11 @@ Wersja %1</translation>
         <translation type="obsolete">Otwiera okno ustawień współdzielonych katalogów</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">Za&instaluj Dodatki (Guest Additions)...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Montuje obraz z instalatorem Dodatków dla goszczonych systemów (Guest Additions)</translation>
     </message>
     <message>
@@ -10894,7 +11814,7 @@ Wersja %1</translation>
         <translation type="obsolete">I&nformacje o sesji</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Wyświetla okno z informacjami o sesji</translation>
     </message>
     <message>
@@ -11344,8 +12264,8 @@ Wersja %1</translation>
         <translation><przywróć domyślny></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Aktualna domyślna ścieżka będzie widoczna po zatwierdzeniu zmian i ponownym otwarciu tego okna.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Aktualna domyślna ścieżka będzie widoczna po zatwierdzeniu zmian i ponownym otwarciu tego okna.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -11393,8 +12313,7 @@ Wersja %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Aktualna domyślna ścieżka będzie widoczna po zatwierdzeniu zmian i ponownym otwarciu tego okna.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11759,7 +12678,7 @@ Wersja %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -12633,17 +13552,17 @@ Wersja %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Podłączenie tego dysku twardego zostanie wykonane pośrednio, z użyciem nowo utworzonego różnicowego dysku twardego.</translation>
+        <translation type="obsolete">Podłączenie tego dysku twardego zostanie wykonane pośrednio, z użyciem nowo utworzonego różnicowego dysku twardego.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Niektóre nośniki w tym łańcuchu dysków twardych są niedostępne. Proszę użyć Menedżera nośników wirtualnych w trybie <b>Pokaż różnicowe dyski twarde</b>, aby sprawdzić te nośniki.</translation>
+        <translation type="obsolete">Niektóre nośniki w tym łańcuchu dysków twardych są niedostępne. Proszę użyć Menedżera nośników wirtualnych w trybie <b>Pokaż różnicowe dyski twarde</b>, aby sprawdzić te nośniki.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Ten bazowy dysk twardy jest podłączony pośrednio, z użyciem następujących różnicowych dysków twardych:</translation>
+        <translation type="obsolete">Ten bazowy dysk twardy jest podłączony pośrednio, z użyciem następujących różnicowych dysków twardych:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -12695,7 +13614,7 @@ Wersja %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -13172,16 +14091,6 @@ Wersja %1</translation>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -13232,23 +14141,167 @@ Wersja %1</translation>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
     </message>
-</context>
-<context>
-    <name>VBoxGlobalSettings</name>
     <message>
-        <source>'%1 (0x%2)' is an invalid host key code.</source>
-        <translation type="obsolete">'%1 (0x%2)' jest nieprawidłowym kodem klawisza gospodarza.</translation>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The value '%1' of the key '%2' doesn't match the regexp constraint '%3'.</source>
-        <translation>Wartość '%1' klucza '%2' nie odpowiada ograniczeniu wyrażenia regularnego '%3'.</translation>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Cannot delete the key '%1'.</source>
-        <translation>Nie można usunąć klucza '%1'.</translation>
-    </message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Brak</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Domyślny</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>VBoxGlobalSettings</name>
+    <message>
+        <source>'%1 (0x%2)' is an invalid host key code.</source>
+        <translation type="obsolete">'%1 (0x%2)' jest nieprawidłowym kodem klawisza gospodarza.</translation>
+    </message>
+    <message>
+        <source>The value '%1' of the key '%2' doesn't match the regexp constraint '%3'.</source>
+        <translation>Wartość '%1' klucza '%2' nie odpowiada ograniczeniu wyrażenia regularnego '%3'.</translation>
+    </message>
+    <message>
+        <source>Cannot delete the key '%1'.</source>
+        <translation>Nie można usunąć klucza '%1'.</translation>
+    </message>
     <message>
         <source>'%1' is an invalid host-combination code-sequence.</source>
         <translation type="unfinished"></translation>
@@ -13446,11 +14499,11 @@ języka ustawiony jako domyślny dla systemu.</qt>
         <translation type="obsolete">Zawiera ścieżkę do domyślnego katalogu z obrazami dysków VDI. Katalog ten będzie użyty w przypadku, gdy nie zostanie wybrany inny podczas dodawania istniejących bądź tworzenia nowych wirtualnych dysków twardych.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Przywraca domyślną ścieżkę do katalogu maszyn wirtualnych. Nowa ścieżka będzie widoczna po zatwierdzeniu zmian i ponownym otwarciu tego okna.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Przywraca domyślną ścieżkę do katalogu z obrazami dysków VDI. Nowa ścieżka będzie widoczna po zatwierdzeniu zmian i ponownym otwarciu tego okna.</translation>
     </message>
     <message>
@@ -13499,7 +14552,7 @@ języka ustawiony jako domyślny dla systemu.</qt>
         <translation type="obsolete">Otwiera okno umożliwiające wybór pliku biblioteki uwierzytelniania dla VRDP.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Przywraca domyślną ścieżkę do pliku biblioteki uwierzytelniania. Nowa ścieżka będzie widoczna po zatwierdzeniu zmian i ponownym otwarciu tego okna.</translation>
     </message>
     <message>
@@ -14027,6 +15080,18 @@ języka ustawiony jako domyślny dla systemu.</qt>
         <source>Modify the attributes of the selected disk image file</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -14103,8 +15168,8 @@ języka ustawiony jako domyślny dla systemu.</qt>
         <translation type="obsolete">Okno rejestracji programu VirtualBox</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Wypełnij ten formularz w celu poinformowania nas, że korzystasz z programu VirtualBox oraz, opcjonalnie, aby być informowanym o jego uaktualnieniach i nowościach.</p><p>Wprowadź poniżej swoje imię i nazwisko używając znaków alfabetu łacińskiego oraz swój adres e-mail. Uwaga: firma innotek będzie używała tych danych tylko w celu gromadzenia statystyk popularności programu i wysyłania biuletynów. W szczególności, innotek nigdy nie p [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Wypełnij ten formularz w celu poinformowania nas, że korzystasz z programu VirtualBox oraz, opcjonalnie, aby być informowanym o jego uaktualnieniach i nowościach.</p><p>Wprowadź poniżej swoje imię i nazwisko używając znaków alfabetu łacińskiego oraz swój adres e-mail. Uwaga: firma innotek będzie używała tych danych tylko w celu gromadzenia statystyk popularności programu i wysyłania biuletynów. W szczególności, innotek nigdy nie p [...]
     </message>
     <message>
         <source>&Name</source>
@@ -14151,8 +15216,8 @@ języka ustawiony jako domyślny dla systemu.</qt>
         <translation type="obsolete">Nie udało się ustanowić połączenia.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Wypełnij ten formularz w celu poinformowania nas, że korzystasz z programu VirtualBox oraz, opcjonalnie, aby być informowanym o jego uaktualnieniach i nowościach.</p><p>Wprowadź poniżej swoje imię i nazwisko używając znaków alfabetu łacińskiego oraz swój adres e-mail. Uwaga: firma Sun Microsystems będzie używała tych danych tylko w celu gromadzenia statystyk popularności programu i wysyłania biuletynów. W szczególności, Sun Micros [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Wypełnij ten formularz w celu poinformowania nas, że korzystasz z programu VirtualBox oraz, opcjonalnie, aby być informowanym o jego uaktualnieniach i nowościach.</p><p>Wprowadź poniżej swoje imię i nazwisko używając znaków alfabetu łacińskiego oraz swój adres e-mail. Uwaga: firma Sun Microsystems będzie używała tych danych tylko w celu gromadzenia statystyk popularności programu i wysyłania biuletynów. W szczególności, Sun Micros [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -14171,8 +15236,8 @@ języka ustawiony jako domyślny dla systemu.</qt>
         <translation type="obsolete">Wybierz kraj/region</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Wypełnij ten formularz w celu poinformowania nas, że korzystasz z programu VirtualBox oraz, opcjonalnie, aby być informowanym o jego uaktualnieniach i nowościach.</p><p>Prosimy o używanie wyłącznie znaków alfabetu łacińskiego podczas wypełniania poniższych pól. Firma Sun Microsystems będzie używać tych danych tylko w celu gromadzenia statystyk popularności programu i wysyłania biuletynów. W szczególności, Sun Microsystems nigdy ni [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Wypełnij ten formularz w celu poinformowania nas, że korzystasz z programu VirtualBox oraz, opcjonalnie, aby być informowanym o jego uaktualnieniach i nowościach.</p><p>Prosimy o używanie wyłącznie znaków alfabetu łacińskiego podczas wypełniania poniższych pól. Firma Sun Microsystems będzie używać tych danych tylko w celu gromadzenia statystyk popularności programu i wysyłania biuletynów. W szczególności, Sun Microsystems nigdy ni [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -14481,8 +15546,8 @@ języka ustawiony jako domyślny dla systemu.</qt>
         <translation type="obsolete">Wstrzymuje pracę maszyny wirtualnej</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Witamy w VirtualBox!</h3><p>Lewa część tego okna przeznaczona jest do wyświetlania listy maszyn wirtualnych dostępnych na tym komputerze. Lista jest teraz pusta, ponieważ nie utworzono jeszcze żadnej maszyny.<img src=:/welcome.png align=right/></p><p>Aby utworzyć nową wirtualną maszynę, proszę wcisnąć przycisk <b>Nowa</b> na głównym pasku narzędziowym, umieszczonym na górze okna.</p><p>Mo [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Witamy w VirtualBox!</h3><p>Lewa część tego okna przeznaczona jest do wyświetlania listy maszyn wirtualnych dostępnych na tym komputerze. Lista jest teraz pusta, ponieważ nie utworzono jeszcze żadnej maszyny.<img src=:/welcome.png align=right/></p><p>Aby utworzyć nową wirtualną maszynę, proszę wcisnąć przycisk <b>Nowa</b> na głównym pasku narzędziowym, umieszczonym na górze okna.</p><p>Mo [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -15164,221 +16229,6 @@ Puste pole sprawi, że filtr zadziała dla jakiejkolwiek wartości.</qt></
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Informacje o sesji</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">Z&amknij</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Informacje o sesji</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Szczegóły</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">Łączny &czas używania</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transfer DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transfer PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Dane odczytane</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Dane zapisane</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Dane wysłane</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Dane odebrane</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Włączone</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Wyłączone</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Parametry maszyny</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Rozdzielczość ekranu</translation>
-    </message>
-    <message>
-        <source>Hardware Virtualization</source>
-        <translation type="obsolete">Wirtualizacja sprzętu</translation>
-    </message>
-    <message>
-        <source>IDE Hard Disk Statistics</source>
-        <translation type="obsolete">Statystyki dysków twardych IDE</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Statystyki CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Statystyki kart sieciowych</translation>
-    </message>
-    <message>
-        <source>Adapter 1</source>
-        <translation type="obsolete">Karta 1</translation>
-    </message>
-    <message>
-        <source>Adapter 2</source>
-        <translation type="obsolete">Karta 2</translation>
-    </message>
-    <message>
-        <source>Adapter 3</source>
-        <translation type="obsolete">Karta 3</translation>
-    </message>
-    <message>
-        <source>Adapter 4</source>
-        <translation type="obsolete">Karta 4</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Niepodłączona</translation>
-    </message>
-    <message>
-        <source>Hard Disks Statistics</source>
-        <translation type="obsolete">Statystyki dysków twardych</translation>
-    </message>
-    <message>
-        <source>Primary Master</source>
-        <translation type="obsolete">Pierwszy (Primary, IDE0) Nadrzędny (Master)</translation>
-    </message>
-    <message>
-        <source>Primary Slave</source>
-        <translation type="obsolete">Pierwszy (Primary, IDE0) Podrzędny (Slave)</translation>
-    </message>
-    <message>
-        <source>Secondary Master</source>
-        <translation type="obsolete">Drugi (Secondary, IDE1) Nadrzędny (Master)</translation>
-    </message>
-    <message>
-        <source>Secondary Slave</source>
-        <translation type="obsolete">Drugi (Secondary, IDE1) Podrzędny (Slave)</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Wersja %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Nie wykryto</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Nie wykryto</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Dodatki (Guest Additions)</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Typ systemu operacyjnego gościa</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Statystyki dysków twardych</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Brak dysków twardych</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Brak kart sieciowych</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Włączone</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Wyłączone</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Zagnieżdżone stronicowanie</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Niedostępne</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Statystyka nośników</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Brak urządzeń</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Statystyka sieci</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Zagnieżdżone stronicowanie</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation type="unfinished">Niedostępne</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -16207,7 +17057,7 @@ tej opcji po zainstalowaniu na tej maszynie systemu Windows!</qt></transla
         <translation type="obsolete">Zawiera ścieżkę, do której będą zapisywane migawki maszyny wirtualnej. Uwaga: migawki mogą zająć sporo miejsca na dysku.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Przywraca domyślną ścieżkę do katalogu z migawkami. Nowa ścieżka będzie widoczna po zatwierdzeniu zmian i ponownym otwarciu tego okna.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt.ts
index d9cde27..8471599 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt.ts
@@ -292,7 +292,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Modo 'Seam&less'</translation>
+        <translation type="unfinished">Modo 'Seam&less'</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -316,11 +316,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Desactivar I&ntegração do Rato</translation>
+        <translation type="obsolete">Desactivar I&ntegração do Rato</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Desactiva temporariamente a integração do dispositivo apontador</translation>
+        <translation type="obsolete">Desactiva temporariamente a integração do dispositivo apontador</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -332,11 +332,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Inserir Ctrl-Alt-Apagar</translation>
+        <translation type="obsolete">&Inserir Ctrl-Alt-Apagar</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Envia o comando Ctrl-Alt-Apagar para a máquina virtual</translation>
+        <translation type="obsolete">Envia o comando Ctrl-Alt-Apagar para a máquina virtual</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -344,7 +344,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Envia o comando Ctrl-Alt-Backspace para a máquina virtual</translation>
+        <translation type="obsolete">Envia o comando Ctrl-Alt-Backspace para a máquina virtual</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -359,8 +359,8 @@
         <translation type="obsolete">Diálogo de I&nformação da Sessão</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Mostra o Diálogo de Informação da Sessão</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Mostra o Diálogo de Informação da Sessão</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -416,15 +416,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Dispositivos &CD/DVD</translation>
+        <translation type="obsolete">Dispositivos &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Dispositivos de Dis&quete</translation>
+        <translation type="obsolete">Dispositivos de Dis&quete</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Dispositivos &USB</translation>
+        <translation type="obsolete">Dispositivos &USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -447,12 +447,12 @@
         <translation type="obsolete">Activa ou desactiva ligações de ecrã remoto (RDP) para esta máquina</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">&Instalar Adições de Convidado...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Instalar Adições de Convidado...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Monta a imagem de instalação das Adições de Convidado</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Monta a imagem de instalação das Adições de Convidado</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -495,15 +495,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Mudar para &Ecrã Completo</translation>
+        <translation type="obsolete">Mudar para &Ecrã Completo</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Mudar entre modo normal e modo ecrã completo</translation>
+        <translation type="obsolete">Mudar entre modo normal e modo ecrã completo</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Mudar para Modo In&tegrado</translation>
+        <translation type="obsolete">Mudar para Modo In&tegrado</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -511,7 +511,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Mudar para Modo E&scala</translation>
+        <translation type="obsolete">Mudar para Modo E&scala</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -590,10 +590,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished">&Ficheiro</translation>
@@ -885,10 +881,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -929,32 +921,252 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Logging...</source>
-        <comment>debug action</comment>
+        <source>Popup Menu</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Popup Menu</source>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Instalar Adições de Convidado...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Monta a imagem de instalação das Adições de Convidado</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Teclado</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Rede</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Mostrar &Registo...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Ficheiro</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Activar</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1550,14 +1762,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1672,6 +1884,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Appliance Export Wizard</source>
@@ -2159,11 +2397,6 @@
         <translation type="unfinished">Desactivado</translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">Não conectado</translation>
@@ -2357,44 +2590,144 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Controlador</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details</comment>
-        <translation type="obsolete">Desactivado</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>None</source>
-        <comment>details</comment>
-        <translation type="obsolete">Nenhum</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Memória Gráfica</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Ecrãs</translation>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Controladora USB</translation>
     </message>
     <message>
-        <source>2D Video</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Vídeo 2D</translation>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Activado</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished">Desactivado</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">Activado</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Activado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">Desactivado</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Activado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">Desactivado</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Controlador</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details</comment>
+        <translation type="obsolete">Desactivado</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Nenhum</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Memória Gráfica</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ecrãs</translation>
+    </message>
+    <message>
+        <source>2D Video</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Vídeo 2D</translation>
     </message>
     <message>
         <source>3D</source>
@@ -2730,18 +3063,6 @@
         <translation type="obsolete">Desactivar &Protector de Ecrã do Hospedeiro</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3863,16 +4184,6 @@
         <translation></translation>
     </message>
     <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
-        <comment>CD/DVD tooltip</comment>
-        <translation></translation>
-    </message>
-    <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
-        <comment>FD tooltip</comment>
-        <translation></translation>
-    </message>
-    <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
         <translation></translation>
@@ -3910,7 +4221,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Controlador USB desactivado</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Controlador USB desactivado</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -3968,6 +4279,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4058,7 +4383,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Gráfica</translation>
+        <translation type="obsolete">&Gráfica</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4233,10 +4558,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4288,7 +4609,75 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Mini Barra de Ferramentas:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Se seleccionado, mostra a Mini Barra de Ferramentas em modo Ecrã Completo ou Integrado.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Mostrar em &Ecrã Completo/Integrado</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Se seleccionado, mostra a Mini Barra de Ferramentas no topo do ecrã, em vez da sua posição predefinida no fundo do ecrã.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Mostrar no &Topo do Ecrã</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4303,7 +4692,7 @@
         <translation>Mostra a localização onde as capturas desta máquina virtual serão armazenadas. Note que estas capturas podem ocupar bastante espaço em disco.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Básico</translation>
     </message>
     <message>
@@ -4351,7 +4740,7 @@
         <translation type="obsolete">Controla a quantidade de memória gráfica alocada para a máquina virtual.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avançado</translation>
     </message>
     <message>
@@ -4439,7 +4828,7 @@
         <translation>Pasta de &Capturas:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Descrição</translation>
     </message>
     <message>
@@ -4452,7 +4841,7 @@
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Se seleccionado, qualquer alteração nos dispositivos CD/DVD ou Disquetes montados realizada durante a execução da máquina será gravada no ficheiro de definições para preservar a configuração dos dispositivos montados entre execuções.</translation>
+        <translation type="obsolete">Se seleccionado, qualquer alteração nos dispositivos CD/DVD ou Disquetes montados realizada durante a execução da máquina será gravada no ficheiro de definições para preservar a configuração dos dispositivos montados entre execuções.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -4480,38 +4869,38 @@
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Média Removível:</translation>
+        <translation type="obsolete">Média Removível:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Lembrar Mudanças do Ambiente de Execução</translation>
+        <translation type="obsolete">&Lembrar Mudanças do Ambiente de Execução</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Mini Barra de Ferramentas:</translation>
+        <translation type="obsolete">Mini Barra de Ferramentas:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Se seleccionado, mostra a Mini Barra de Ferramentas em modo Ecrã Completo ou Integrado.</translation>
+        <translation type="obsolete">Se seleccionado, mostra a Mini Barra de Ferramentas em modo Ecrã Completo ou Integrado.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Mostrar em &Ecrã Completo/Integrado</translation>
+        <translation type="obsolete">Mostrar em &Ecrã Completo/Integrado</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Se seleccionado, mostra a Mini Barra de Ferramentas no topo do ecrã, em vez da sua posição predefinida no fundo do ecrã.</translation>
+        <translation type="obsolete">Se seleccionado, mostra a Mini Barra de Ferramentas no topo do ecrã, em vez da sua posição predefinida no fundo do ecrã.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Mostrar no &Topo do Ecrã</translation>
+        <translation type="obsolete">Mostrar no &Topo do Ecrã</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">seleccionou um SO convidado 64 bit para esta MV. Como tal os convidados requerem virtualização de material (VT-x/AMD-V), esta opção será activada automaticamente.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -4526,6 +4915,102 @@
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Mini Barra de Ferramentas:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Se seleccionado, mostra a Mini Barra de Ferramentas em modo Ecrã Completo ou Integrado.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Mostrar em &Ecrã Completo/Integrado</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Se seleccionado, mostra a Mini Barra de Ferramentas no topo do ecrã, em vez da sua posição predefinida no fundo do ecrã.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Mostrar no &Topo do Ecrã</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5042,10 +5527,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Se seleccionado, esta pasta partilhada será permanente.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5096,11 +5577,11 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Se seleccionado, a via de comunicação indicado no campo <b>Localização da Porta</b> será criada pela máquina virtual quando esta iniciar. Caso contrário, a máquina virtual tentará usar a via existente.</translation>
+        <translation type="obsolete">Se seleccionado, a via de comunicação indicado no campo <b>Localização da Porta</b> será criada pela máquina virtual quando esta iniciar. Caso contrário, a máquina virtual tentará usar a via existente.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Criar Via de Comunicação</translation>
+        <translation type="obsolete">&Criar Via de Comunicação</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5108,11 +5589,11 @@
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Mostra a localização para a via de comunicação da porta série no hospedeiro quando a porta estiver configurada no modo <b>Via de Comunicação do Hospedeiro</b>, ou o nome do dispositivo série quando a porta estiver configurada para o modo <b>Dispositivo do Hospedeiro</b>.</translation>
+        <translation type="obsolete">Mostra a localização para a via de comunicação da porta série no hospedeiro quando a porta estiver configurada no modo <b>Via de Comunicação do Hospedeiro</b>, ou o nome do dispositivo série quando a porta estiver configurada para o modo <b>Dispositivo do Hospedeiro</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Localização da Porta/Ficheiro:</translation>
+        <translation type="obsolete">&Localização da Porta/Ficheiro:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5122,12 +5603,28 @@
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Mostra o endereço da porta de E/S base desta porta em série. Os valores válidos são n+umeros inteiros no intervalo de <tt>0</tt> até <tt>0xFFFF</tt>.</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSerialPage</name>
     <message>
-        <source>Duplicate port number selected </source>
-        <translation type="obsolete">Está seleccionado um número de porta duplicado</translation>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSerialPage</name>
+    <message>
+        <source>Duplicate port number selected </source>
+        <translation type="obsolete">Está seleccionado um número de porta duplicado</translation>
     </message>
     <message>
         <source>Port path not specified </source>
@@ -5222,11 +5719,11 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Adicionar&nbsp;Dispositivo&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Adicionar&nbsp;Dispositivo&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Adicionar&nbsp;Dispositivo&nbsp;Disquete</nobr></translation>
+        <translation type="obsolete"><nobr>Adicionar&nbsp;Dispositivo&nbsp;Disquete</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -5266,11 +5763,7 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Adicionar Dispositivo CD/DVD</translation>
-    </message>
-    <message>
-        <source>Add Floppy Device</source>
-        <translation></translation>
+        <translation type="obsolete">Adicionar Dispositivo CD/DVD</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5422,15 +5915,15 @@
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>Uni&dade CD/DVD:</translation>
+        <translation type="obsolete">Uni&dade CD/DVD:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Escolha um CD/DVD virtual ou uma unidade física para usar com o dispositivo virtual. A máquina virtual procurará um disco inserido no dispositivo com os dados no ficheiro ou num disco na unidade física assim como os seus conteúdos.</translation>
+        <translation type="obsolete">Escolha um CD/DVD virtual ou uma unidade física para usar com o dispositivo virtual. A máquina virtual procurará um disco inserido no dispositivo com os dados no ficheiro ou num disco na unidade física assim como os seus conteúdos.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Definir o dispositivo CD/DVD virtual</translation>
+        <translation type="obsolete">Definir o dispositivo CD/DVD virtual</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5454,7 +5947,7 @@
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Escolher um ficheiro de CD/DVD virtual...</translation>
+        <translation type="obsolete">Escolher um ficheiro de CD/DVD virtual...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5526,6 +6019,54 @@
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5706,31 +6247,39 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5803,7 +6352,7 @@
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Activar Controlador USB &2.0 (EHCI)</translation>
+        <translation type="obsolete">Activar Controlador USB &2.0 (EHCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5862,7 +6411,27 @@
         <translation type="obsolete">O USB 2.0 está actualmente activado para esta máquina virtual. No entanto isto requer que o <b>%1</b> seja instalado. Por favor instale o Pacote de Extensão do sítio de transferências do VirtualBox. Depois poderá re-activar o USB 2.0. Será desactivado entretanto a não ser que cancele as alterações das definições actuais.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5997,7 +6566,7 @@
         <translation type="obsolete">&Seleccionar</translation>
     </message>
     <message>
-        <source>C&lose</source>
+        <source>Removing medium...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6017,6 +6586,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Fechar</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Mudar</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6058,7 +6650,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Falha ao criar o objeto COM VirtualBox.</p><p>A aplicação será agora terminada.</p></translation>
+        <translation type="obsolete"><p>Falha ao criar o objeto COM VirtualBox.</p><p>A aplicação será agora terminada.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -6339,15 +6931,15 @@
         <translation type="obsolete"><p>Não foi possível carregar o ficheiro de linguagem <b><nobr>%1</nobr></b>. <p>O idioma será temporariamente redefinido para Inglês (embutido). Por favor vá até o diálogo <b>Preferências</b> a partir do menu <b>Ficheiro</b> na janela principal do VirtualBox, e seleccione um dos idiomas existentes na página <b>Idiomas</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>As Adições de Convidado VirtualBox instalados no SO Convidado são muito antigas: a versão instalada é %1, e a versão esperada é %2. Alguns recursos das Adições de Convidado (integração do rato, auto-redimensionamento da janela do convidado) provavelmente não irão funcionar correctamente.</p><p>Por favor actualize as Adições de Convidado para a versão actual escolhendo <b>Instalar Adições de Convidado</b> no menu <b& [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>As Adições de Convidado VirtualBox instalados no SO Convidado estão desactualizadas: a versão instalada é %1, e a versão esperada é %2. Alguns recursos das Adições de Convidado (integração do rato, auto-redimensionamento de janela do convidado) podem não funcionar correctamente.</p><p>É recomendado que actualize as Adições de Convidado para a versão actual usando a função <b>Instalar Adições de Convidado</b> no menu &l [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>As Adições de ConvidadoVirtualBox instalados no SO Convidado são demasiado recentes para esta versão VirtualBox: a versão instalada é %1, a versão esperada é %2.</p><p>O uso de uma versão mais nova das Adições com uma versão mais antiga do VirtualBox não é suportado. Por favor instale a versão actual das Adições de Convidado escolhendo <b>Instalar Adições de Convidado</b> do menu  <b>Dispositivos</b>.</p [...]
     </message>
     <message>
@@ -6391,8 +6983,8 @@
         <translation type="obsolete"><p>A janela da máquina virtual está optimizada para funcionar em modo de cores <b>%1&nbsp;bits</b>, mas o modo de cores do monitor virtual está definido como <b>%2&nbsp;bits</b>.</p><p>Abra o diálogo de propriedades do monitor no sistema operativo convidado e seleccione um modo de cores <b>%3&nbsp;bits</b> se estiver disponível, de forma a obter o melhor desempenho possível do sub-siste [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>Ocorreu um erro crítico enquanto a máquina virtual estava em execução e a execução foi interrompida.</p><p>Para ajuda, consulte a secção Comunidade no endereço <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> ou use os recursos disponibilizados pelo seu contrato de suporte. Por favor forneça o conteúdo do ficheiro <tt>VBox.log</tt> e o ficheiro de imagem <tt>VBox.png</tt>, que p [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Ocorreu um erro crítico enquanto a máquina virtual estava em execução e a execução foi interrompida.</p><p>Para ajuda, consulte a secção Comunidade no endereço <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> ou use os recursos disponibilizados pelo seu contrato de suporte. Por favor forneça o conteúdo do ficheiro <tt>VBox.log</tt> e o ficheiro de imagem <tt>VBox.png</tt>, que pod [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
@@ -6499,9 +7091,9 @@
         <translation type="obsolete">Transferir</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Montar</translation>
+        <translation type="obsolete">Montar</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6669,8 +7261,8 @@
         <translation type="obsolete">Mostra um diálogo com informações do produto</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Uma nova versão do VirtualBox está disponível! A version <b>%1</b> está disponível em <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Poderá fazer a transferência desta versão utilizando este atalho directo:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Uma nova versão do VirtualBox está disponível! A version <b>%1</b> está disponível em <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Poderá fazer a transferência desta versão utilizando este atalho directo:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6749,10 +7341,6 @@
         <translation>Falha ao determinar o estado de acessibilidade da média <nobr><b>%1</b></nobr>.</translation>
     </message>
     <message>
-        <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&More</source>
         <comment>warnAboutAutoConvertedSettings message box</comment>
         <translation type="obsolete">&Mais</translation>
@@ -6768,10 +7356,6 @@
         <translation type="obsolete">Sobre-escre&ver</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>hard disk</source>
         <comment>failed to close ...</comment>
         <translation type="obsolete">disco rígido</translation>
@@ -6936,10 +7520,6 @@
         <translation type="obsolete">disco rígido</translation>
     </message>
     <message>
-        <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Remove</source>
         <comment>medium</comment>
         <translation>&Remover</translation>
@@ -6999,10 +7579,6 @@
         <translation type="obsolete">Es&colher disco existente</translation>
     </message>
     <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Choose disk</source>
         <comment>add attachment routine</comment>
         <translation type="obsolete">Es&colher disco</translation>
@@ -7021,14 +7597,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -7057,14 +7625,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7274,10 +7834,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7506,14 +8062,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7546,26 +8094,122 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Montar</translation>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>Insert</source>
+        <comment>additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetAdditions</name>
@@ -7641,7 +8285,7 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished">&Nome:</translation>
     </message>
     <message>
@@ -8466,14 +9110,18 @@ diálogo de Configurações da MV.</p></translation>
         <translation type="unfinished">Ficheiros de máquina virtual (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="unfinished"><h3>Bem-vindo ao VirtualBox!</h3><p>A parte esquerda desta janela é uma lista de todas as máquinas virtuais no seu computador. A lista está vazia agora porque ainda não criou qualquer máquina virtual.<img src=:/welcome.png align=right/></p><p>Para poder criar uma nova máquina virtual, prima o botão <b>Nova</b> na barra de ferramentas no topo da janela.</p><p>Pode premir a tecla <b>%1& [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Bem-vindo ao VirtualBox!</h3><p>A parte esquerda desta janela é uma lista de todas as máquinas virtuais no seu computador. A lista está vazia agora porque ainda não criou qualquer máquina virtual.<img src=:/welcome.png align=right/></p><p>Para poder criar uma nova máquina virtual, prima o botão <b>Nova</b> na barra de ferramentas no topo da janela.</p><p>Pode premir a tecla <b>%1&lt [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished">Gestor</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -8506,7 +9154,7 @@ diálogo de Configurações da MV.</p></translation>
     </message>
     <message>
         <source>Settings</source>
-        <translation>Definições</translation>
+        <translation type="obsolete">Definições</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -8559,6 +9207,10 @@ diálogo de Configurações da MV.</p></translation>
         <source>Display</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8634,6 +9286,43 @@ diálogo de Configurações da MV.</p></translation>
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">está actualmente a usar mais controladores de armazenamento do que o 'chipset' %1 suporta. Por favor mude o tipo de 'chipset' na página de definições do sistema ou reduza o número de controladores de armazenamento na página de definições de Armazenamento: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Fechar</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -8693,121 +9382,334 @@ diálogo de Configurações da MV.</p></translation>
         <translation>2 semanas</translation>
     </message>
     <message>
-        <source>3 weeks</source>
-        <translation>3 semanas</translation>
+        <source>3 weeks</source>
+        <translation>3 semanas</translation>
+    </message>
+    <message>
+        <source>1 month</source>
+        <translation>1 mês</translation>
+    </message>
+    <message>
+        <source>Never</source>
+        <translation>Nunca</translation>
+    </message>
+    <message>
+        <source>Chec&k</source>
+        <translation type="obsolete">&Verificar</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">&Fechar</translation>
+    </message>
+    <message>
+        <source>VirtualBox Update Wizard</source>
+        <translation type="obsolete">Assitente de Actualização VirtualBox</translation>
+    </message>
+    <message>
+        <source>Check for Updates</source>
+        <translation type="obsolete">Procurar por Actualizações</translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Cancelar</translation>
+    </message>
+    <message>
+        <source>Summary</source>
+        <translation type="obsolete">Resumo</translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Uma nova versão do VirtualBox está disponível! A version <b>%1</b> está disponível em <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Poderá fazer a transferência desta versão utilizando este atalho directo:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
+        <translation type="obsolete"><p>Não é possível obter informação acerca da nova versões devido ao seguinte erro da rede:</p><p><b>%1</b></p></translation>
+    </message>
+    <message>
+        <source>You are already running the most recent version of VirtualBox.</source>
+        <translation type="obsolete">Já tem instalada a última versão do VirtualBox. Por favor procure por novas versões mais tarde.</translation>
+    </message>
+    <message>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Este assistente conectará ao sítio 'web' VirtualBox e verifica se está disponível uma nova versão.</p><p>Use o botão <b>Verificar</b> para verificar agora acerca de uma nova versão ou o botão <b>Cancelar</b> se não deseja executar esta verificação.</p><p>Pode correr este assistente em qualquer altura ao escolher <b>Verificar Actualizações...</b> no menu <b>Ajuda</b [...]
+    </message>
+</context>
+<context>
+    <name>UIUpdateStepVirtualBox</name>
+    <message>
+        <source>Checking for a new VirtualBox version...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMCloseDialog</name>
+    <message>
+        <source>Close Virtual Machine</source>
+        <translation>Fechar Máquina Virtual</translation>
+    </message>
+    <message>
+        <source>You want to:</source>
+        <translation>Deseja:</translation>
+    </message>
+    <message>
+        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
+        <translation><p>Grava o estado de execução actual da máquina virtual para o disco rígido físico do PC hospedeiro. </p><p>Na próxima vez que a máquina virtual for executada, será restaurada a partir do estado gravado e continuará a execução do mesmo sítio em que foi gravada, o que permitirá continuar o seu trabalho imediatamente.</p><p>Note que gravar o estado da máquina poderá demorar algum tempo, dependente do tipo do sistema operativo convidado e d [...]
+    </message>
+    <message>
+        <source>&Save the machine state</source>
+        <translation>Gravar o e&stado da máquina</translation>
+    </message>
+    <message>
+        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
+        <translation><p>Envia o evento ACPI de pressionar o botão de alimentação para a máquina virtual.</p><p>Normalmente, o sistema operativo convidado a correr na máquina virtual detectará este evento e realizará o processo de desligar a máquina virtual de uma forma limpa. Esta é a forma recomendada de desligar a máquina virtual porque todas as aplicação a funcionar no seu interior terão a oportunidade de salvar os seus dados.</p><p>Se a máquina não respo [...]
+    </message>
+    <message>
+        <source>S&end the shutdown signal</source>
+        <translation>&Enviar pedido para desligar</translation>
+    </message>
+    <message>
+        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
+        <translation><p>Desliga a máquina virtual.</p><p>Note-se que esta acção parará a execução da máquina virtual imediatamente, de tal forma que, o sistema operativo convidado não terá oportunidade de se desligar de uma forma limpa, o que poderá resultar em <i>perdas de dados</i> dentro da máquina virtual. Seleccionar esta acção é apenas recomendável se a máquina virtual não responder à acção de enviar <b>Desligar máquina virtual</b>.</p&g [...]
+    </message>
+    <message>
+        <source>&Power off the machine</source>
+        <translation>&Desliga a máquina</translation>
+    </message>
+    <message>
+        <source>Restore the machine state stored in the current snapshot</source>
+        <translation>Restaura o estado da máquina guardado na captura actual</translation>
+    </message>
+    <message>
+        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
+        <translation><p>Quando seleccionado, a estado da máquina virtual será restaurado a partir do estado armazenado na captura actual logo após ter sido desligado. Isto é útil se tem a certeza que deseja descartar os resultados da sua última sessão e voltar à captura actual.</p></translation>
+    </message>
+    <message>
+        <source>&Restore current snapshot '%1'</source>
+        <translation>&Restaurar captura actual '%1'</translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
+    <message>
+        <source>&Details</source>
+        <translation>&Detalhes</translation>
+    </message>
+    <message>
+        <source>&Snapshots</source>
+        <translation>&Capturas</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Diálogo de Informação de Sessão</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">Fe&char</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informação de Sessão</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Detalhes</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Execução</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transferências DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transferências PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Dados Lidos</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Dados Gravados</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Dados Transferidos</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Dados Recebidos</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Activado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Desactivado</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Atributos de Execução</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Resolução de Ecrã</translation>
+    </message>
+    <message>
+        <source>Hardware Virtualization</source>
+        <translation type="obsolete">Virtualização do Material</translation>
+    </message>
+    <message>
+        <source>IDE Hard Disk Statistics</source>
+        <translation type="obsolete">Estatisticas de Disco Rígido IDE</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Estatisticas CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Estatisticas de Adaptador de Rede</translation>
+    </message>
+    <message>
+        <source>Adapter 1</source>
+        <translation type="obsolete">Adaptador 1</translation>
+    </message>
+    <message>
+        <source>Adapter 2</source>
+        <translation type="obsolete">Adaptador 2</translation>
+    </message>
+    <message>
+        <source>Adapter 3</source>
+        <translation type="obsolete">Adaptador 3</translation>
+    </message>
+    <message>
+        <source>Adapter 4</source>
+        <translation type="obsolete">Adaptador 4</translation>
     </message>
     <message>
-        <source>1 month</source>
-        <translation>1 mês</translation>
+        <source>Not attached</source>
+        <translation type="obsolete">Não conectado</translation>
     </message>
     <message>
-        <source>Never</source>
-        <translation>Nunca</translation>
+        <source>Hard Disks Statistics</source>
+        <translation type="obsolete">Estatisticas do Disco Rígido</translation>
     </message>
     <message>
-        <source>Chec&k</source>
-        <translation type="obsolete">&Verificar</translation>
+        <source>Primary Master</source>
+        <translation type="obsolete">'Master' Primário</translation>
     </message>
     <message>
-        <source>&Close</source>
-        <translation type="obsolete">&Fechar</translation>
+        <source>Primary Slave</source>
+        <translation type="obsolete">'Slave' Primário</translation>
     </message>
     <message>
-        <source>VirtualBox Update Wizard</source>
-        <translation type="obsolete">Assitente de Actualização VirtualBox</translation>
+        <source>Secondary Master</source>
+        <translation type="obsolete">'Master' Secundário</translation>
     </message>
     <message>
-        <source>Check for Updates</source>
-        <translation type="obsolete">Procurar por Actualizações</translation>
+        <source>Secondary Slave</source>
+        <translation type="obsolete">'Slave' Secundário</translation>
     </message>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">Cancelar</translation>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Versão %1.%2</translation>
     </message>
     <message>
-        <source>Summary</source>
-        <translation type="obsolete">Resumo</translation>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Não Detectadas</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Uma nova versão do VirtualBox está disponível! A version <b>%1</b> está disponível em <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Poderá fazer a transferência desta versão utilizando este atalho directo:</p><p><a href=%2>%3</a></p></translation>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Não Detectado</translation>
     </message>
     <message>
-        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>Não é possível obter informação acerca da nova versões devido ao seguinte erro da rede:</p><p><b>%1</b></p></translation>
+        <source>Guest Additions</source>
+        <translation>Adições de Convidado</translation>
     </message>
     <message>
-        <source>You are already running the most recent version of VirtualBox.</source>
-        <translation type="obsolete">Já tem instalada a última versão do VirtualBox. Por favor procure por novas versões mais tarde.</translation>
+        <source>Guest OS Type</source>
+        <translation>Tipo de SO Convidado</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Este assistente conectará ao sítio 'web' VirtualBox e verifica se está disponível uma nova versão.</p><p>Use o botão <b>Verificar</b> para verificar agora acerca de uma nova versão ou o botão <b>Cancelar</b> se não deseja executar esta verificação.</p><p>Pode correr este assistente em qualquer altura ao escolher <b>Verificar Actualizações...</b> no menu <b>Ajuda</b [...]
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Estatísticas do Disco Rígido</translation>
     </message>
-</context>
-<context>
-    <name>UIUpdateStepVirtualBox</name>
     <message>
-        <source>Checking for a new VirtualBox version...</source>
-        <translation type="unfinished"></translation>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Sem Discos Rígidos</translation>
     </message>
-</context>
-<context>
-    <name>UIVMCloseDialog</name>
     <message>
-        <source>Close Virtual Machine</source>
-        <translation>Fechar Máquina Virtual</translation>
+        <source>No Network Adapters</source>
+        <translation>Sem Adaptadores de Rede</translation>
     </message>
     <message>
-        <source>You want to:</source>
-        <translation>Deseja:</translation>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Activado</translation>
     </message>
     <message>
-        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation><p>Grava o estado de execução actual da máquina virtual para o disco rígido físico do PC hospedeiro. </p><p>Na próxima vez que a máquina virtual for executada, será restaurada a partir do estado gravado e continuará a execução do mesmo sítio em que foi gravada, o que permitirá continuar o seu trabalho imediatamente.</p><p>Note que gravar o estado da máquina poderá demorar algum tempo, dependente do tipo do sistema operativo convidado e d [...]
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Desactivado</translation>
     </message>
     <message>
-        <source>&Save the machine state</source>
-        <translation>Gravar o e&stado da máquina</translation>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
     </message>
     <message>
-        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation><p>Envia o evento ACPI de pressionar o botão de alimentação para a máquina virtual.</p><p>Normalmente, o sistema operativo convidado a correr na máquina virtual detectará este evento e realizará o processo de desligar a máquina virtual de uma forma limpa. Esta é a forma recomendada de desligar a máquina virtual porque todas as aplicação a funcionar no seu interior terão a oportunidade de salvar os seus dados.</p><p>Se a máquina não respo [...]
+        <source>Storage Statistics</source>
+        <translation>Estatísticas de Armazenamento</translation>
     </message>
     <message>
-        <source>S&end the shutdown signal</source>
-        <translation>&Enviar pedido para desligar</translation>
+        <source>No Storage Devices</source>
+        <translation>Sem Dispositivos de Armazenamento</translation>
     </message>
     <message>
-        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation><p>Desliga a máquina virtual.</p><p>Note-se que esta acção parará a execução da máquina virtual imediatamente, de tal forma que, o sistema operativo convidado não terá oportunidade de se desligar de uma forma limpa, o que poderá resultar em <i>perdas de dados</i> dentro da máquina virtual. Seleccionar esta acção é apenas recomendável se a máquina virtual não responder à acção de enviar <b>Desligar máquina virtual</b>.</p&g [...]
+        <source>Network Statistics</source>
+        <translation>Estatísticas da Rede</translation>
     </message>
     <message>
-        <source>&Power off the machine</source>
-        <translation>&Desliga a máquina</translation>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Não Disponível</translation>
     </message>
     <message>
-        <source>Restore the machine state stored in the current snapshot</source>
-        <translation>Restaura o estado da máquina guardado na captura actual</translation>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation><p>Quando seleccionado, a estado da máquina virtual será restaurado a partir do estado armazenado na captura actual logo após ter sido desligado. Isto é útil se tem a certeza que deseja descartar os resultados da sua última sessão e voltar à captura actual.</p></translation>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Restore current snapshot '%1'</source>
-        <translation>&Restaurar captura actual '%1'</translation>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <source>&Details</source>
-        <translation>&Detalhes</translation>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Snapshots</source>
-        <translation>&Capturas</translation>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8960,11 +9862,19 @@ diálogo de Configurações da MV.</p></translation>
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -9947,11 +10857,11 @@ Versão %1</translation>
         <translation type="obsolete">Abre o diálogo de pastas partilhadas</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Instalar Adições de Convidado...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Monta a imagem de instalação das Adições de Convidado</translation>
     </message>
     <message>
@@ -10292,7 +11202,7 @@ Versão %1</translation>
         <translation type="obsolete">Diálogo de I&nformação da Sessão</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Mostra o Diálogo de Informação da Sessão</translation>
     </message>
     <message>
@@ -10614,8 +11524,8 @@ Versão %1</translation>
         <translation><restaurar para predefinido></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">O caminho predefinido actual será apresentado após aceitar as alterações e abrir este diálogo novamente.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">O caminho predefinido actual será apresentado após aceitar as alterações e abrir este diálogo novamente.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -10663,8 +11573,7 @@ Versão %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">O caminho predefinido actual será apresentado após aceitar as alterações e abrir este diálogo novamente.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11017,7 +11926,7 @@ Versão %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -11858,17 +12767,17 @@ Versão %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>A ligação deste disco será executada indirectamente usando um disco rígido de diferenciação recém criado.</translation>
+        <translation type="obsolete">A ligação deste disco será executada indirectamente usando um disco rígido de diferenciação recém criado.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Algumas das médias neste disco rígido estão inacessiveis. Por favor use o Gestor de Médias Virtual no modo <b>Mostrar Discos Rígidos de Diferenciação</b> para inspecionar esta média.</translation>
+        <translation type="obsolete">Algumas das médias neste disco rígido estão inacessiveis. Por favor use o Gestor de Médias Virtual no modo <b>Mostrar Discos Rígidos de Diferenciação</b> para inspecionar esta média.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Este disco rígido base está ligado indirectamente usando o seguinte disco rígido de diferenciação:</translation>
+        <translation type="obsolete">Este disco rígido base está ligado indirectamente usando o seguinte disco rígido de diferenciação:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -11914,7 +12823,7 @@ Versão %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -12440,75 +13349,219 @@ Versão %1</translation>
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished">Activado</translation>
+        <translation type="obsolete">Activado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="obsolete">Desactivado</translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>unrestricted execution</comment>
+        <translation type="obsolete">Activado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>unrestricted execution</comment>
+        <translation type="obsolete">Desactivado</translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Nenhum</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Predefinido</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Activo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Activo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Activo</translation>
     </message>
     <message>
-        <source>Disabled</source>
+        <source>Inactive</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished">Desactivado</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <comment>details report</comment>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>unrestricted execution</comment>
-        <translation type="obsolete">Activado</translation>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>unrestricted execution</comment>
-        <translation type="obsolete">Desactivado</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
+        <source>(Optical Drive)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12778,11 +13831,11 @@ usar o idioma predefinido do sistema.</qt>
         <translation type="obsolete">Mostra a localização para a pasta predefinida VDI. Esta pasta é sempre usada para adicionar discos rígidos virtuais novos ou existentes, a não ser que seja definida outra quando estes são criados.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restaura a localização da pasta de máquinas virtuais para o valor predefinido. A localização predefinida será mostrada após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restaura a localização da pasta VDI para o valor predefinido. A localização predefinida actual será mostrada após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
@@ -12826,7 +13879,7 @@ usar o idioma predefinido do sistema.</qt>
         <translation type="obsolete">Abre um diálogo para seleccionar o ficheiro da biblioteca de autenticação VRDP.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restaura o nome do ficheiro da biblioteca de autenticação para o valor predefinido. O ficheiro de biblioteca predefinido actual será mostrado após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
@@ -13354,6 +14407,18 @@ para ligar ao encaixe actualmente destacado.</qt>
         <source>Modify the attributes of the selected disk image file</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13442,8 +14507,8 @@ para ligar ao encaixe actualmente destacado.</qt>
         <translation type="obsolete">Diálogo de Registo Virtualbox</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Por favor preencha este formulário para que possamos saber que usa o VirtualBox e, opcionalmente, para o manter informado acerca de notícias e actualizações VirtualBox.</p><p>Indique o seu nome completo (usando caracteres latinos) e o seu endereço electrónico nos campos abaixo. Note que a innotek usará esta informação apenas para recolha de estatísticas acerca do uso do produto e para lhe enviar notícias do VirtualBox. Em particul [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Por favor preencha este formulário para que possamos saber que usa o VirtualBox e, opcionalmente, para o manter informado acerca de notícias e actualizações VirtualBox.</p><p>Indique o seu nome completo (usando caracteres latinos) e o seu endereço electrónico nos campos abaixo. Note que a innotek usará esta informação apenas para recolha de estatísticas acerca do uso do produto e para lhe enviar notícias do VirtualBox. Em particul [...]
     </message>
     <message>
         <source>&Name</source>
@@ -13490,8 +14555,8 @@ para ligar ao encaixe actualmente destacado.</qt>
         <translation type="obsolete">Não foi possível estabelecer uma ligação.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Por favor preencha este formulário de registo para sabermos que usa o VirtualBox e, opcionalmente, para o manter informado acerca de noticias e actualizações do VirtualBox.</p><p>Indique o seu nome completo usando caracteres em Latim e o seu endereço electrónico nos campos em baixo. Por favor note que a Sun Microsystems irá usar esta informação apenas para elaborar estatíticas do uso do produto e para lhe enviar noticias acerca do [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Por favor preencha este formulário de registo para sabermos que usa o VirtualBox e, opcionalmente, para o manter informado acerca de noticias e actualizações do VirtualBox.</p><p>Indique o seu nome completo usando caracteres em Latim e o seu endereço electrónico nos campos em baixo. Por favor note que a Sun Microsystems irá usar esta informação apenas para elaborar estatíticas do uso do produto e para lhe enviar noticias acerca do [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -13804,8 +14869,8 @@ para ligar ao encaixe actualmente destacado.</qt>
         <translation type="obsolete">Suspende a execução da máquina virtual</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Bem-vindo ao VirtualBox!</h3><p>A parte esquerda desta janela é uma lista de todas as máquinas virtuais no seu computador. A lista está vazia agora porque ainda não criou qualquer máquina virtual.<img src=:/welcome.png align=right/></p><p>Para poder criar uma nova máquina virtual, prima o botão <b>Nova</b> na barra de ferramentas no topo da janela.</p><p>Pode premir a tecla <b>%1&lt [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Bem-vindo ao VirtualBox!</h3><p>A parte esquerda desta janela é uma lista de todas as máquinas virtuais no seu computador. A lista está vazia agora porque ainda não criou qualquer máquina virtual.<img src=:/welcome.png align=right/></p><p>Para poder criar uma nova máquina virtual, prima o botão <b>Nova</b> na barra de ferramentas no topo da janela.</p><p>Pode premir a tecla <b>%1&lt [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -14624,207 +15689,6 @@ corresponder a qualquer valor.</qt></translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Diálogo de Informação de Sessão</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">Fe&char</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Informação de Sessão</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detalhes</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Execução</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transferências DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transferências PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Dados Lidos</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Dados Gravados</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Dados Transferidos</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Dados Recebidos</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Activado</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Desactivado</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Atributos de Execução</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Resolução de Ecrã</translation>
-    </message>
-    <message>
-        <source>Hardware Virtualization</source>
-        <translation type="obsolete">Virtualização do Material</translation>
-    </message>
-    <message>
-        <source>IDE Hard Disk Statistics</source>
-        <translation type="obsolete">Estatisticas de Disco Rígido IDE</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Estatisticas CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Estatisticas de Adaptador de Rede</translation>
-    </message>
-    <message>
-        <source>Adapter 1</source>
-        <translation type="obsolete">Adaptador 1</translation>
-    </message>
-    <message>
-        <source>Adapter 2</source>
-        <translation type="obsolete">Adaptador 2</translation>
-    </message>
-    <message>
-        <source>Adapter 3</source>
-        <translation type="obsolete">Adaptador 3</translation>
-    </message>
-    <message>
-        <source>Adapter 4</source>
-        <translation type="obsolete">Adaptador 4</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Não conectado</translation>
-    </message>
-    <message>
-        <source>Hard Disks Statistics</source>
-        <translation type="obsolete">Estatisticas do Disco Rígido</translation>
-    </message>
-    <message>
-        <source>Primary Master</source>
-        <translation type="obsolete">'Master' Primário</translation>
-    </message>
-    <message>
-        <source>Primary Slave</source>
-        <translation type="obsolete">'Slave' Primário</translation>
-    </message>
-    <message>
-        <source>Secondary Master</source>
-        <translation type="obsolete">'Master' Secundário</translation>
-    </message>
-    <message>
-        <source>Secondary Slave</source>
-        <translation type="obsolete">'Slave' Secundário</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Versão %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Não Detectadas</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Não Detectado</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Adições de Convidado</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Tipo de SO Convidado</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Estatísticas do Disco Rígido</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Sem Discos Rígidos</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Sem Adaptadores de Rede</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Activado</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Desactivado</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Estatísticas de Armazenamento</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Sem Dispositivos de Armazenamento</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Estatísticas da Rede</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Não Disponível</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -15750,7 +16614,7 @@ e Saída APIC (I/O APIC), o que deve diminuir levemente o desempenho da MV.
         <translation type="obsolete">Mostra a localização onde as capturas desta máquina virtual serão armazenadas. Note que estas capturas podem ocupar bastante espaço em disco.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restaura a localização da pasta de capturaspara o valor predefinido. O valor predefinido actual será mostrado após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt_BR.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt_BR.ts
index 7e018eb..58c381e 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt_BR.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_pt_BR.ts
@@ -296,7 +296,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Modo Seam&less</translation>
+        <translation>Modo Seam&less</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -320,11 +320,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Desabilitar Integração de &Mouse</translation>
+        <translation type="obsolete">Desabilitar Integração de &Mouse</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Temporariamente desabilitar integração de ponteiro de mouse</translation>
+        <translation type="obsolete">Temporariamente desabilitar integração de ponteiro de mouse</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -336,11 +336,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Inserir Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&Inserir Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Envia a sequência Ctrl-Alt-Del para a máquina virtual</translation>
+        <translation type="obsolete">Envia a sequência Ctrl-Alt-Del para a máquina virtual</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -348,7 +348,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Envia a sequência Ctrl-Alt-Backspace para a máquina virtual</translation>
+        <translation type="obsolete">Envia a sequência Ctrl-Alt-Backspace para a máquina virtual</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -363,8 +363,8 @@
         <translation type="obsolete">I&nformações sobre a Sessão</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Exibe Janela de Informações Sobre a Sessão</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Exibe Informações Sobre a Sessão</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -420,15 +420,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Dispositivos de &CD/DVD</translation>
+        <translation type="obsolete">Dispositivos de &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Dispositivos de Disquete (&F)</translation>
+        <translation type="obsolete">Dispositivos de Disquete (&F)</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Dispositivos &USB</translation>
+        <translation type="obsolete">Dispositivos &USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -455,12 +455,12 @@
         <translation type="obsolete">Habilita ou desabilita conexões de desktop remoto (RDP) para esta máquina</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>&Inserir imagem de CD dos Adicionais para Convidado...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Instalar Adicionais para Convidado...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Inserir a imagem dos Adicionais para Convidado no drive virtual</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Montar a imagem de instalação dos Adicionais para Convidado</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -479,7 +479,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>Opções de &Log...</translation>
+        <translation type="obsolete">Opções de &Log...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -557,15 +557,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Alternar para Tela Cheia (&F)</translation>
+        <translation type="obsolete">Alternar para Tela Cheia (&F)</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Alternar entre modo de tela cheia e normal</translation>
+        <translation type="obsolete">Alternar entre modo de tela cheia e normal</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Alternar para Modo Seam&less</translation>
+        <translation type="obsolete">Alternar para Modo Seam&less</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -573,7 +573,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Alternar para Modo E&scalonado</translation>
+        <translation type="obsolete">Alternar para Modo E&scalonado</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -780,7 +780,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>&Enviar Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">&Enviar Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>Sort List</source>
@@ -1044,11 +1044,11 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Arrastar e Soltar</translation>
+        <translation type="obsolete">Arrastar e Soltar</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>Salva o estado da máquina virtual</translation>
+        <translation>Salvar o estado das máquina virtual</translation>
     </message>
     <message>
         <source>&Network Settings...</source>
@@ -1060,19 +1060,19 @@
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>Tela &Remota</translation>
+        <translation>T&ela Remota</translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>Permite/bloqueia conexões de desktop remoto (RDP) para esta máquina</translation>
+        <translation>Habilitar conexões de desktop remoto (RDP) para esta máquina</translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>Capturar &Vídeo</translation>
+        <translation>Captura de &Vídeo:</translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation>Liga/desliga captura de vídeo</translation>
+        <translation>Habilita captura de vídeo</translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
@@ -1080,29 +1080,254 @@
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>Configura parâmetros de captura de vídeo</translation>
+        <translation>Altera configurações de captura de vídeo</translation>
     </message>
     <message>
         <source>Popup Menu</source>
         <translation>Menu Popup</translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation>Exibe Janela de Informações Sobre a Sessão</translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation>&Webcams</translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Instalar Adicionais para Convidado...</translation>
+        <translation>&Inserir imagem de CD dos Adicionais para Convidado...</translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Montar a imagem de instalação dos Adicionais para Convidado</translation>
+        <translation>Insere o arquivo de imagem dos Adicionais de Convidado no drive virtual</translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>&Webcams</translation>
+        <source>&VirtualBox</source>
+        <translation>&VirtualBox</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>Barra de &Menu</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>Configurações de Barra de &Menu...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>Abre um diálogo para configurar a barra de menus</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>Exibir &Barra de Menu</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>Define a visibilidade da barra de menus para esta máquina</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>Barra de &Status</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>Configurações de Barra de &Status...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>Abre um diálogo para configurar a barra de status</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>Exibir &Barra de Status</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>Define a visibilidade da barra de status para esta máquina</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>Entrada (&I)</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>Teclado (&K)</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>Configurações de Teclado (&K)...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>Exibe o diálogo de configurações globais para configurar atalhos</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>&Mouse</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>Discos Rígidos (&H)</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>Configurações de Disco Rígido (&H)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>Alterar as configurações de discos rígidos</translation>
     </message>
     <message>
         <source>Network</source>
-        <translation type="unfinished">Rede</translation>
+        <translation>Rede</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>Configurações de &USB...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>Alterar as configurações de dispositivos USB</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>Pa&stas Compartilhadas</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>Exibir &Log...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation>Gerenciador de Dados E&xtras...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>Exibe a janela do Gerenciador de Dados Extras</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>Arquivo (&F)</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation>Janela (&W)</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>&Minimizar</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>Minimizar a Janela da máquina ativa</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>Modo Tela Cheia (&F)</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>Alternar entre modo de tela cheia e normal</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>Alternar para Modo Es&calonado</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>Fator de Es&calonamento</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>&Inserir %1</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>Envia a sequência %1 para a máquina virtual</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>Integração de &Mouse</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>Habilitar Integração de ponteiro de mouse</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>Discos &Ópticos</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>Drive de Disquete (&F)</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation>&USB</translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>Arrastar e Soltar</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>Opções de &Log</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>Habilitar</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>Redimensionar para %1x%2</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation>%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - Criptografia de Disco</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>Esta máquina virtual está protegida por senha. Por favor entra a(s) %n senha(s) criptográfica(s) abaixo.</numerusform>
+            <numerusform></numerusform>
+        </translation>
     </message>
 </context>
 <context>
@@ -1923,6 +2148,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation>Obtendo dados...</translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1935,7 +2167,7 @@
     <message>
         <source>Dropping data ...</source>
         <translatorcomment>se refere a drag and drop</translatorcomment>
-        <translation>Soltando dados...</translation>
+        <translation type="obsolete">Soltando dados...</translation>
     </message>
 </context>
 <context>
@@ -2047,6 +2279,32 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation>Status</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation>ID</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>Senha</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>Usado pelo(s) seguinte(s) %n disco(s) rígido(s):</nobr><br>%1</numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2808,7 +3066,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -3049,6 +3307,116 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>Tamanho do Frame: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Paravirtualização Mínima</translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Paravirtualização Hyper-V</translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Paravirtualização KVM</translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[Discos Óptico]</translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>Controladora USB</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Fator de Escala</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Saída de Vídeo HiDPI Sem Escala</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Habilitada</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>Posição da Minibarra de Ferramentas</translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>Superior</translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>Inferior</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>Minibarra de Ferramentas</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>Desabilitada</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">Fator de Escala</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">Saída de Vídeo HiDPI Sem Escala</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIGDetailsUpdateThreadAudio</name>
@@ -3363,15 +3731,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Machine Windows:</source>
-        <translation type="unfinished"></translation>
+        <translation>Janelas da Máquina:</translation>
     </message>
     <message>
         <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation type="unfinished"></translation>
+        <translation>Quando selecionado, as janelas relativas a esta máquina terão o foco quando o ponteiro do mouse passar por cima delas.</translation>
     </message>
     <message>
         <source>&Raise Window Under Mouse</source>
-        <translation type="unfinished"></translation>
+        <translation>T&razer a Janela Sob o Mouse Para o Topo</translation>
     </message>
 </context>
 <context>
@@ -3476,20 +3844,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Desligar &ScreenSaver do Hospedeiro</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>Painel e Barra &de Menus:</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>Exibir Automaticamente em Tela Cheia</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Quando selecionado, o painel e a barra de menus serão exibidas quando a máquina estiver em modo de tela cheia. estiver ativa.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>Screensaver do &Hospedeiro: </translation>
+        <translation>Screensaver do &Hospedeiro:</translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
@@ -3497,7 +3853,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>Desabilitar Quando Estiver Executando Máquinas Virtuais</translation>
+        <translation>Desabilitar Quando Máquinas Virtuais Estiverem em Execução</translation>
     </message>
 </context>
 <context>
@@ -3536,11 +3892,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>Combinação de Tecla de Hospedeiro</translation>
+        <translation>Combinação de Teclas do Hospedeiro</translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>Alguns itens tiveram seus atalhos redefinidos.</translation>
+        <translation>Alguns items possuem os mesmos atalhos de teclado definidos.</translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
@@ -3548,15 +3904,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>&Máquina Virtual </translation>
+        <translation>&Máquina Virtual</translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Lista todos os atalhos disponíveis para configuração.</translation>
+        <translation>Lista todos os atalhos de teclado disponíveis para configuração.</translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Entre com uma sequência para filtrar na lista de atalhos.</translation>
+        <translation>Entre uma sequência ser filtrada da lista de atalhos.</translation>
     </message>
 </context>
 <context>
@@ -3615,7 +3971,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>Idiomas da &Interface</translation>
+        <translation>&Idiomas da Interface</translation>
     </message>
 </context>
 <context>
@@ -3784,7 +4140,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Nenhum novo nome especificado para a rede NAT previamente conhecida como <b>%1</b>.</translation>
+        <translation>Nenhum nome especificado para a rede NAT previamente conhecida como <b>%1</b>.</translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
@@ -3792,7 +4148,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Nenhum CIDR especificado para a rede NAT previamente conhecida por <b>%1</b>.</translation>
+        <translation>Nenhum CIDR especificado para a rede NAT previamente chamada de <b>%1</b>.</translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
@@ -3800,7 +4156,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation>CIDR inválido (<i>%1</i>) especificado para a rede NAT previamente conhecida como <b>%2</b>.</translation>
+        <translation>CIDR inválido (<i>%1</i>) especificado para a rede NAT previamente chamada <b>%2</b>.</translation>
     </message>
     <message>
         <source>Network Name</source>
@@ -3864,28 +4220,28 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>A interface do hospedeiro <b>%1</b> não possui uma máscara de servidor DHCP válida.</translation>
+        <translation>A interface do hospedeiro <b>%1</b> não possui uma máscara de servidor DHCP válido.</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>A interface do hospedeiro <b>%1</b> não possui uma faixa inferior de endereçamento DHCP válida.</translation>
+        <translation>A interface do hospedeiro <b>%1</b> não possui uma faixa inferior de endereços definida para o servidor DHCP.</translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>A interface do hospedeiro <b>%1</b> não possui uma faixa superior de endereçamento DHCP válida.</translation>
+        <translation>A interface do hospedeiro <b>%1</b> não possui uma faixa superior de endereços definida para o servidor DHCP.</translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>O nome <b>%1</b> está sendo utilizado para várias redes NAT.</translation>
+        <translation>O nome <b>%1</b> está sendo utilizado para diversas redes NAT.</translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>Ativa</translation>
+        <translation>Ativo</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>&Acrescentar rede NAT</translation>
+        <translation>&Acrescentar Rede NAT</translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
@@ -4114,7 +4470,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>Contém o CIDR desta rede.</translation>
+        <translation>Contém o CIDR para esta rede.</translation>
     </message>
     <message>
         <source>Network Options:</source>
@@ -4134,11 +4490,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>Determina se esta rede suporta IPv6.</translation>
+        <translation>Determina se esta rede suporta IPv6</translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>Divulga a &Rota IPv6 Padrão </translation>
+        <translation>Divulgar Rota IPv6 Padrâo</translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
@@ -4220,11 +4576,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>Nenhum servidor de proxy foi especificado.</translation>
+        <translation>Nenhum servidor de proxy especificado.</translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>Nenhuma porta de proxy foi especificada.</translation>
+        <translation>Nenhuma porta de proxy especificada.</translation>
     </message>
 </context>
 <context>
@@ -4349,7 +4705,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host+</source>
-        <translation>Host+</translation>
+        <translation>Tecla de Hospedeiro +</translation>
     </message>
     <message>
         <source>None</source>
@@ -4700,12 +5056,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica a atividade dos dispositivos de CD/DVD:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica a atividade dos dispositivos de CD/DVD:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indica a atividade dos dispositivos de disquete:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indica a atividade dos dispositivos de disquete:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4745,7 +5101,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Controladora USB desabilitada</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Controladora USB desabilitada</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4794,7 +5150,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Indica atividade de captura de vídeo.</nobr><br>%1</translation>
+        <translation><nobr>Indica atividade de captura de vídeo:</nobr><br>%1</translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
@@ -4809,6 +5165,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation>Status dos recursos adicionais:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>Indica a atividade da tela:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Indica a atividade dos drives ópticos:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Indica a atividade dos drives de disquete:</nobr>%1</p></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4885,15 +5255,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Não há webcam suportada conectada ao PC hospedeiro</translation>
+        <translation>nenhuma webcam suportada conectada ao PC hospedeiro</translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation type="unfinished"></translation>
+        <translation>Conectar Placa de Rede</translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Conectar Placa de Rede %1</translation>
     </message>
 </context>
 <context>
@@ -4935,7 +5305,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Vídeo</translation>
+        <translation type="obsolete">&Vídeo</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -5051,11 +5421,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>&Captura de Vídeo </translation>
+        <translation>Captura de &Vídeo</translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>Quando marcado, faz com que o VirtualBox grave a sessão da máquina virtual em um arquivo de vídeo.</translation>
+        <translation>Quando selecionado, permite que o VirtualBox grave uma sessão de uma máquina virtual como um arquivo de vídeo.</translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
@@ -5063,19 +5433,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>Caminho do Arquivo(&P):</translation>
+        <translation>Caminho do Arquivo (&P):</translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Esta configuração determina o nome que o VirtualBox utiliza para salvar o conteúdo gravado.</translation>
+        <translation>Esta configuração determina o nome de arquivo que o VirtualBox utilizará para salvar o conteúdo gravado.</translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>Tamanho do Frame(&S):</translation>
+        <translation>Tamanho do Frame (&S):</translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>Esta configuração determina a resolução (tamanho do frame) para o vídeo gravado.</translation>
+        <translation>Esta configuração determina a resolução (tamanho do frame) do vídeo gravado.</translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
@@ -5087,11 +5457,12 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>&Frame Rate:</translation>
+        <translatorcomment>taxa de quadros seria o mais adequado, mas não é intuitivo.</translatorcomment>
+        <translation>Taxa de &Frames:</translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>Esta configuração determina o número máximo de <b>frames por segundo</b>. Frames gerados acima deste limite serão descartados. Quanto menor o valor, mais frames serão descartados, resultando em arquivos menores.</translation>
+        <translation>Esta configuração determina o número máximo de <b>frames por segundo</b> no vídeo resultante. Frames adicionais serão descartados. Reduzir este valor aumentará a quantidade de frames descartados, mas reduzirá o tamanho do arquivo final.</translation>
     </message>
     <message>
         <source>&Quality:</source>
@@ -5099,11 +5470,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Esta configuração determina a <b>qualidade</b>. Aumentar este valor fará com que o vídeo fique com uma aparência melhor, mas com tamanhos maiores de arquivo.</translation>
+        <translation>Esta configuração determina a <b>qualidade</b>. Aumentar este valor fará com que o vídeo tenha uma aparência melhor, ao custo de um tamanho maior de arquivo.</translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Esta configuração determina o bitrate em <b>kilobits por segundo</b>. Aumentar este valor fará com que o vídeo fique com aparência melhor, mas com tamanho maior de arquivo.</translation>
+        <translation>Esta configuração determina o bitrate em <b>kilobits por segundo</b>. Aumentar este valor fará com que o vídeo tenha uma aparência melhor, ao custo de um tamanho maior de arquivo.</translation>
     </message>
     <message>
         <source>&Screens:</source>
@@ -5111,31 +5482,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>A máquina virtual está configurada para utilizar aceleração gráfica por hardware. O sistema hospedeiro não pode fornecer este recurso agora, logo a máquina virtual não será iniciada.</translation>
+        <translation>A máquina virtual está configurada para utilizar a aceleração gráfica por hardware. No entanto, o sistema hospedeiro não possui este recurso, logo não será possível iniciar esta máquina.</translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>A máquina virtual está configurada para usar menos de <b>%1</b> de memória de vídeo, que é a quantidade mínima de memória necessária para utilizar tela cheia ou o modo seamless.</translation>
+        <translation>A máquina virtual atualmente está configurada com menos que <b>%1</b> de memória de vídeo, que seria o mínimo necessário para permitir alternar para tela cheia ou modo seamless.</translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>A máquina virtual está configurada para usar menos de <b>%1</b> de memória de vídeo, que é a quantidade mínima de memória necessária para que vídeos de alta resolução possam ser tocados eficientemente.</translation>
+        <translation>A máquina virtual atualmente está configurada com menos que <b>%1</b> de memória de vídeo, que seria o mínimo necessário para permitir que vídeo de alta resolução seja reproduzido com eficiência.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>A máquina virtual está configurada para  utilizar aceleração gráfica por hardware e o tipo de sistema operacional está definido como Windows Vista ou melhor. Para melhor performance é recomendado que a memória de vídeo seja definida para pelo menos <b>%1</b>.</translation>
+        <translation type="obsolete">A máquina virtual está configurada para utilizar a aceleração gráfica por hardware e o tipo de sistema operacional está definido como Windows Vista ou posterior. Para melhor performance você deve definir a memória de vídeo para pelo menos <b>%1</b>.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>A máquina virtual está definida para utilizar Aceleração de Streaming de Vídeo. Este recurso somente funciona com sistemas convidados do tipo Windows, logo será desabilitado.</translation>
+        <translation>A máquina virtual está configurada para utilizar a aceleração de Video Stream. Este recurso somente funciona com sistemas convidados Windows, logo será desabilitado.</translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>O valor da porta do servidor VRDE não foi especificado.</translation>
+        <translation>A porta do servidor VRDE não foi especificada.</translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>O valor de timeout de autenticação VRDE não foi especificado.</translation>
+        <translation>O timeout para autenticação VRDE não foi especificado.</translation>
     </message>
     <message>
         <source>User Defined</source>
@@ -5177,7 +5548,75 @@ p, li { white-space: pre-wrap; }
         <translation>Habilitar gravação de vídeo para a tela %1.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Minibarra de Ferramentas:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Se habilitado, exibe a minibarra de ferramentas enquanto estiver nos modos Tela Cheia ou Seamless.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Exibir nos modos Tela Cheia/Seamless (&F)</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">se marcado, exibe a mini barra de ferramentas no topo da tela, ao invés da posição padrão na parte de baixo da tela.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Exibir No &Topo da Tela</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>Cerca de %1MB a cada 5 minutos de vídeo</i></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation>O recurso de Tela de Remota está habilitado para esta máquina virtual. No entanto, este recurso precisa que <i>%1</i> esteja instalado. Baixe e instale o Pacote de Adicionais do site do VirtualBox, caso contrário sua VM será iniciada com o recurso de Tela Remota desabilitado.</translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished">HiDPI:</translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished">&Utilizar Saída HiDPI Sem Escala</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5192,7 +5631,7 @@ p, li { white-space: pre-wrap; }
         <translation>Mostra o caminho onde os snapshots desta máquina virtual serão armazenados. Note que estes snapshots podem ocupar bastante espaço em disco.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Básico</translation>
     </message>
     <message>
@@ -5244,7 +5683,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Controla a quantidade de memória de vídeo alocada para a máquina virtual.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avançado</translation>
     </message>
     <message>
@@ -5332,7 +5771,7 @@ p, li { white-space: pre-wrap; }
         <translation>Pasta de S&napshots:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Descrição</translation>
     </message>
     <message>
@@ -5345,7 +5784,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Se estiver marcado, qualquer mudança às mídias de CD/DVD e Disquete realizadas durante a execução da máquina serão salvas no arquivo de configuração para preservar o estado das mídias entre execuções.</translation>
+        <translation type="obsolete">Se estiver marcado, qualquer mudança às mídias de CD/DVD e Disquete realizadas durante a execução da máquina serão salvas no arquivo de configuração para preservar o estado das mídias entre execuções.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5397,38 +5836,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Mídia Removível:</translation>
+        <translation type="obsolete">Mídia Removível:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Lembra&r de Alterações Feitas Durante a Execução</translation>
+        <translation type="obsolete">Lembra&r de Alterações Feitas Durante a Execução</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Minibarra de Ferramentas:</translation>
+        <translation type="obsolete">Minibarra de Ferramentas:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Se habilitado, exibe a minibarra de ferramentas enquanto estiver nos modos Tela Cheia ou Seamless.</translation>
+        <translation type="obsolete">Se habilitado, exibe a minibarra de ferramentas enquanto estiver nos modos Tela Cheia ou Seamless.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Exibir nos modos Tela Cheia/Seamless (&F)</translation>
+        <translation type="obsolete">Exibir nos modos Tela Cheia/Seamless (&F)</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>se marcado, exibe a mini barra de ferramentas no topo da tela, ao invés da posição padrão na parte de baixo da tela.</translation>
+        <translation type="obsolete">se marcado, exibe a mini barra de ferramentas no topo da tela, ao invés da posição padrão na parte de baixo da tela.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Exibir No &Topo da Tela</translation>
+        <translation type="obsolete">Exibir No &Topo da Tela</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">você selecionou um tipo de sistema operacional convidado de 64 bits para esta VM. Como tais sistemas convidados exigem virtualização de hardware (VT-x/AMD-V), este recurso será habilitado automaticamente.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>Arrastar e Soltar (&D):</translation>
     </message>
     <message>
@@ -5437,11 +5876,131 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation>Nenhum nome especificado para a máquina virtual.</translation>
+        <translation>Nome não especificado para a máquina virtual.</translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>O tipo de sistema operacional para a máquina virtual foi definida como sendo 64 bits. Sistemas convidados de 64 bits requerem virtualização de hardware, logo este recurso será ativado automaticamente se você confirmar as configurações.</translation>
+        <translation>O tipo de sistema operacional para a máquina virtual foi definido para 64 bits. Sistemas convidados de 64 bits necessitam de virtualização de hardware, logo este recurso será habilitado automaticamente caso você confirme as mudanças.</translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation>C&riptografia</translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>Quando selecionado, habilita a criptografia para esta máquina virtual.</translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation>H&abilitar Criptografia</translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation>Algor&itmo de Criptografia:</translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>Contém o algoritmo utilizado para criptografar os discos da máquina virtual.</translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation>E&ntre Com a Nova Senha:</translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>Contém a senha a ser atribuída para a máquina virtual.</translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation>C&onfirme a Nova Senha:</translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>Confirma a senha atribuída a esta máquina virtual.</translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>Você está tentando criptografar esta máquina virtual. No entanto, isto requer que <i>%1</i> esteja instalado. Instale o pacote de Adicionais para Convidado do site do VirtualBox.</translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation>Tipo de algoritmo de criptografia não especificado.</translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation>Senha de criptografia vazia.</translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation>As senhas de criptografia não coincidem.</translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>Não Alterar</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>Permite modificar o conteúdo da barra de menu da VM.</translation>
+    </message>
+    <message>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">Fator de Escala de Tela:</translation>
+    </message>
+    <message>
+        <source>This setting determines the guest screen scale factor.</source>
+        <translation type="obsolete">Esta configuração determina o fator de escala para a tela do convidado.</translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="obsolete">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="obsolete">HiDPI:</translation>
+    </message>
+    <message>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">Quando selecionado, o conteúdo da tela do sistema convidado não será redimensionado para compensar resoluções de tela mais altas no sistema hospedeiro.</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">&Utilizar Saída HiDPI Sem Escala</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation>Minibarra de Ferramentas:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation>Se habilitado, exibe a minibarra de ferramentas enquanto estiver nos modos Tela Cheia ou Seamless.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation>Exibir nos modos Tela Cheia/Seamless (&F)</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation>Se marcado, exibe a mini barra de ferramentas no topo da tela, ao invés da posição padrão na parte de baixo da tela.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation>Exibir no &Topo da Tela</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>Permite modificar o conteúdo da barra de status da VM.</translation>
     </message>
 </context>
 <context>
@@ -5700,11 +6259,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>Nenhum nome para a rede interna foi especificado.</translation>
+        <translation>O nome da rede interna não foi especificado.</translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>Nenhuma placa de rede exclusiva do hospedeiro foi selecionada.</translation>
+        <translation>Nenhuma placa de rede apenas para hospedeiro (host-only) foi selecionada.</translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
@@ -5712,7 +6271,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>O endereço MAC deve conter 12 dígitos hexadecimais.</translation>
+        <translation>O endereço MAC deve ser composto de 12 dígitos hexadecimais.</translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
@@ -5720,11 +6279,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>Nenhum nome para a rede NAT foi especificado.</translation>
+        <translation>O nome da rede NAT não foi especificado.</translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>Contém o nome da rede NAT à qual esta placa de rede está conectada. Você pode criar e remover redes utilizando as configurações globais de rede na tela do gerenciador de máquinas virtuais.</translation>
+        <translation>Contém o nome da rede NAT à qual esta placa de rede será conectada. Você pode criar e remover redes utilizando as configurações globais de rede na janela do gerenciador de máquinas virtuais.</translation>
     </message>
 </context>
 <context>
@@ -5913,7 +6472,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Nenhum caminho para a porta foi especificado.</translation>
+        <translation>O caminho da porta não foi especificado.</translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
@@ -6088,10 +6647,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Se selecionado, esta pasta compartilhada será permanente.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Janela (&W)</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -6142,11 +6697,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Se a opção estiver marcada, o pipe especificado no campo <b>Caminho da Porta</b> será criado pela máquina virtual quando esta for iniciada. Caso contrário, a máquina virtual tentará utilizar o pipe existente.</translation>
+        <translation type="obsolete">Se a opção estiver marcada, o pipe especificado no campo <b>Caminho da Porta</b> será criado pela máquina virtual quando esta for iniciada. Caso contrário, a máquina virtual tentará utilizar o pipe existente.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Criar Pipe</translation>
+        <translation type="obsolete">&Criar Pipe</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -6154,11 +6709,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Exibe o caminho para o pipe da porta serial no hospedeiro quando a porta estiver configurada para o modo <b>Pipe do Hospedeiro</b>, ou o nome do dispositivo serial quando a porta estiver configurada para o modo <b>Dispositivo do Hospedeiro</b>.</translation>
+        <translation type="obsolete">Exibe o caminho para o pipe da porta serial no hospedeiro quando a porta estiver configurada para o modo <b>Pipe do Hospedeiro</b>, ou o nome do dispositivo serial quando a porta estiver configurada para o modo <b>Dispositivo do Hospedeiro</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Porta/Caminho do Arquivo:</translation>
+        <translation type="obsolete">&Porta/Caminho do Arquivo:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -6168,6 +6723,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Exibe o endereço-base de I/O para esta porta serial. Os valores válidos são números na faixa <tt>0</tt> a <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation>Se selecionado, a máquina virtual irá assumir que o pipe ou socket especificado no campo <b>Caminho/Endereço</b> existe e tentará utilizá-lo. Caso contrário, o pipe ou socket será criado pela máquina virtual quando esta for iniciada.</translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>&Conectar a pipe/socket existente</translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation>Caminho/Endereço (&P):</translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation><p>No modo <b>Pipe do Hospedeiro</b> : Contém o caminho para o pipe da porta serial na máquina hospedeira. Exemplos: "\\.\pipe\myvbox" or "/tmp/myvbox", para sistemas Windows e UNIX, respectivamente.</p><p>No modo <b>Dispositivo do Hospedeiro</b>: Contém o nome do dispositivo serial na máquina hospedeira. Exemplos: "COM1" ou "/dev/ttyS0".</p><p>No modo <b>Arquivo Puro& [...]
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -6185,19 +6756,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>Nenhum IRQ foi especificado.</translation>
+        <translation>IRQ não foi especificado.</translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Nenhuma porta de I/O foi especificada.</translation>
+        <translation>Porta de I/O não foi especificada.</translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Duas ou mais portas possuem as mesmas configurações.</translation>
+        <translation>Duas ou mais portas possuem a mesma configuração.</translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Nenhum caminho para a porta foi especificado.</translation>
+        <translation>O caminho da porta não foi especificado.</translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
@@ -6296,11 +6867,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Adicionar&nbsp;Dispositivo&nbsp;de&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Adicionar&nbsp;Dispositivo&nbsp;de&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Adicionar&nbsp;Dispositivo&nbsp;de&nbsp;Disquete</nobr></translation>
+        <translation type="obsolete"><nobr>Adicionar&nbsp;Dispositivo&nbsp;de&nbsp;Disquete</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -6344,11 +6915,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Adicionar Dispositivo de CD/DVD</translation>
+        <translation type="obsolete">Adicionar Dispositivo de CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Adicionar Dispositivo de Disquete</translation>
+        <translation type="obsolete">Adicionar Dispositivo de Disquete</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6536,15 +7107,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&Drive de CD/DVD:</translation>
+        <translation type="obsolete">&Drive de CD/DVD:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Escolha um disco de CD/DVD virtual ou um drive físico para ser utilizado como drive virtual. A máquina virtual irá enxergar um disco inserido com os dados do arquivo que você selecionar, ou o conteúdo do disco no drive físico selecionado.</translation>
+        <translation type="obsolete">Escolha um disco de CD/DVD virtual ou um drive físico para ser utilizado como drive virtual. A máquina virtual irá enxergar um disco inserido com os dados do arquivo que você selecionar, ou o conteúdo do disco no drive físico selecionado.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Configurar o drive de CD/DVD virtual</translation>
+        <translation type="obsolete">Configurar o drive de CD/DVD virtual</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6568,7 +7139,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Selecione um arquivo de CD/DVD virtual...</translation>
+        <translation type="obsolete">Selecione um arquivo de CD/DVD virtual...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6638,19 +7209,67 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>Nenhum nome especificado para a controladora na posição <b>%1</b>.</translation>
+        <translation>Nenhum nome foi especificado para a controladora na posição <b>%1</b>.</translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>A controladora na posição <b>%1</b> tem o mesmo nome da controladora na posição <b>%2</b>.</translation>
+        <translation>A controladora na posição <b>%1</b> possui o mesmo nome da controladora na posição <b>%2</b>.</translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> está utilizando o disco rígido que já está conectado a  <i>%2</i>.</translation>
+        <translation><i>%1</i> está utilizando um disco que já estava conectado a <i>%2</i>.</translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>A máquina atualmente possui mais controladoras de armazenamento associadas que um chipset do tipo %1 suporta. Altere o tipo de chipset na página de configurações de Sistema ou reduza o número de controladoras de armazenamento na página de Armazenamento: %2</translation>
+        <translation>A máquina atualmente possui mais armazenamento configurado que o chipset %1 suporta. Altere o tipo do chipset na página de configuração de Sistema ou reduza a quantidade de controladoras de armazenamento na página de Armazenamento: %2</translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation>Acrescentar Controladora USB</translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation>Quando selecionado, o sistema convidado irá ver o disco virtual como um dispositivo hot-plug.</translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>&Hot-plug</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>Selecione um arquivo de disco óptico virtual...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>Acrescentar&nbsp;Disco&nbsp;Óptico</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>Acrescentar&nbsp;Drive&nbsp;de&nbsp;Disquete</nobr></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>Acrescentar Drive Óptico</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>Acrescentar Drive de Disquete</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>&Drive Óptico:</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>Escolha um disco óptico virtual ou físico para utilizar como drive virtual. A máquina virtual irá ver um disco inserido no drive com os dados contidos no arquivo ou no disco do drive físico como seu conteúdo.</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>Configurar o drive óptico virtual</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6878,47 +7497,55 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>Dispositivo de A&pontamento:</translation>
+        <translation>Dispositivo de A&pontador:</translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Determina se o tipo de dispositivo de apontamento é um mouse PS/2 padrão, um tablet USB ou um tablet multi-touch USB.</translation>
+        <translation>Deterimina se o dispositivo de apontador emulado é um mouse padrão PS/2, um tablet USB ou um tablet USB multitouch.</translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>Mais de <b>%1%</b> da memória do computador hospedeiro (<b>%2</b>) foi configurada para a máquina virtual. Desta forma, não haverá memória suficiente para o sistema operacional nativo. Escolha um valor menor.</translation>
+        <translation>Mais de <b>%1%</b> da memória do sistema hospedeiro (<b>%2</b>) está configurada para a máquina virtual. Desta maneira, não sobrará memória suficiente para o sistema operacional hospedeiro. Selecione um valor menor.</translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>Mais de <b>%1%</b> da memória do computador hospedeiro (<b>%2</b>) foi configurada para a máquina virtual. Desta forma, não haverá memória suficiente para o sistema operacional nativo. Escolha um valor menor.</translation>
+        <translation>Mais de <b>%1%</b> da memória do computador hospedeiro (<b>%2</b>) está configurada para a máquina virtual. Pode não haver memória suficiente para o sistema operacional do hospedeiro. Reduza a quantidade de memória definida.</translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>O recurso de I/O APIC não está habilitado na seção Placa-Mãe na página Sistema. Isto é necessário para poder suportar um chipset do tipo ICH9. Esta opção será automaticamente habilitada se você confirmar suas mudanças.</translation>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation>Por razões de performance, a quantidade de CPUs virtuais conectadas à máquina virtual não pode ser superior ao dobro da quantidade de CPUs físicas no hospedeiro (<b>%1</b>). Reduza a quantidade de CPUs virtuais.</translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>A emulação de controladora USB não está habilitada na página USB. Isto é necessário para suportar um dispositivo de entrada USB emulado. Esta opção será habilitada automaticamente se você confirmar suas mudanças. </translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation>Mais CPUs virtuais estão configuradas para a máquina virtual do que a quantidade de CPUs físicas disponíveis na máquina hospedeira (<b>%1</b>). Isto pode degradar consideravelmente a performance da sua máquina virtual. Reduza a quantidade de CPUs virtuais.</translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>Por razões de performance, o número de CPUs virtuais associadas à sua máquina virtual não pode ser maior que o dobro do quantidade de CPUs físicas na máquina hospedeira (<b>%1</b>). Reduza o número de CPUs virtuais.</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation>O limite de processamento está definido para um valor muito baixo. Isto pode tornar a máquina muito lenta para responder.</translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>Mais CPUs virtuais estão associadas a esta máquina virtual do que o número de CPUs físicas disponíveis na máquina hospedeira (<b>%1</b>). Isto poderá degradas a performance da sua máquina virtual. Recomenda-se reduzir o número de CPUs virtuais.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation>Interface de &paravirtualização:</translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>O recurso de I/O APIC não está habilitado na seção Placa-Mãe na página Sistema. Isto é necessário para poder suportar mais de um processador virtual. Esta opção será automaticamente habilitada se você confirmar suas mudanças.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>Seleciona o provedor da interface de paravirtualização a ser utilizada para o sistema convidado.</translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>A virtualização em hardware não está habilitada na seção Aceleração na página Sistema. Isto é necessário para poder suportar mais de um processador virtual. Esta opção será automaticamente habilitada se você confirmar suas mudanças.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>O recurso de I/O APIC não está habilitado na seção Placa Mãe da página Sistema. Isto é necessário para suportar o tipo de chipset ICH9 que foi habilitado para esta VM. Isto será feito automaticamente caso você confirme as mudanças.</translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>O limite de execução de processador foi definido muito baixo. Isto pode tornar a máquina virtual muito lenta.</translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>A emulação da controladora USB não está habilitada na página USB. Isto é necessário para suportar um dispositivo de entrada USB emulado que você habilitou para esta VM. Isto será feito automaticamente se confirmar as mudanças.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>O recurso de I/O APIC não está habilitado na seção Placa Mãe da página Sistema. Isto é necessário para suportar mais de um processador virtual, que foi habilitado para esta VM. Isto será feito automaticamente caso você confirme as mudanças.</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>O recurso de Virtualização de Hardware não está habilitado na seção Aceleração da página Sistema. Isto é necessário para suportar mais de um processador virtual, que foi habilitado para esta VM. Isto será feito automaticamente caso você confirme as mudanças.</translation>
     </message>
 </context>
 <context>
@@ -6990,7 +7617,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Habilitar Controladora USB 2.0  (E&HCI)</translation>
+        <translation type="obsolete">Habilitar Controladora USB 2.0  (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -7053,8 +7680,28 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">A USB 2.0 está habilitada para esta máquina virtual. No entanto, isto requer que <b>%1</b> esteja instalado. Instale o Pacote de Extensões no site do VirtualBox. Após instalar, será necessário habilitar novamente a USB 2.0 nesta máquina virtual. Por enquanto este recurso será desabilitado, a menos que você cancele suas mudanças.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 está habilitado para esta máquina virtual. Isto exige que <b>%1</b> esteja instalado. Baixe e instale o Pacote de Extensões no site do VirtualBox ou desabilite USB 2.0 para poder iniciar esta máquina.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation>Quando selecionado, habilita a controladora virtual USB OHCI para esta máquina. A controladora USB OHCI fornece suporte a USB 1.0.</translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>Controladora USB &1.1 (OHCI)</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>Controladora USB &2.0 (EHCI)</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>Quando selecionado, habilita a controladora virtual USB xHCI para esta máquina. A controladora USB xHCI fornece suporte a USB 3.0.</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>Controladora USB &3.0 (xHCI)</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>O suporte a USB 2.0/3.0 está habilitado para esta máquina virtual. No entanto, isto requer que <i>%1</i> esteja instalado. Baixe e instale o Extension Pack no site do VirtualBox ou desabilite o USB 2.0/3.0 para poder iniciar esta máquina.</translation>
     </message>
 </context>
 <context>
@@ -7193,7 +7840,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>Fechar (&L)</translation>
+        <translation type="obsolete">Fechar (&L)</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation>Removendo mídia...</translation>
     </message>
 </context>
 <context>
@@ -7212,6 +7863,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>Redimensionar Tela Virtual</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>Mapeamento de Tela Virtual</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>Fechar</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>Trocar</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>Habilitar Barra de Menu</translation>
+    </message>
+</context>
+<context>
     <name>UIMenuHelper</name>
     <message>
         <source>&Window</source>
@@ -7264,7 +7938,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Falha ao criar o objeto COM do VirtualBox.</p><p>A aplicação será finalizada.</p></translation>
+        <translation type="obsolete"><p>Falha ao criar o objeto COM do VirtualBox.</p><p>A aplicação será finalizada.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -7545,15 +8219,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Não foi possível carregar o arquivo de linguagem <b><nobr>%1</nobr></b>. <p>O idioma será temporariamente redefinido para Inglês (embutido). Por favor vá até o diálogo <b>Preferências</b> a partir do menu <b>Arquivo</b> na janela principal do VirtualBox, e selecione um dos idiomas existentes na página <b>Idiomas</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Os Adicionais para Convidado do VirtualBox instalados no Sistema Operacional Convidado são muito antigos: a versão instalada é %1, e a versão esperada é %2. Alguns recursos dos Adicionais para Convidado (integração de mouse, auto-redimensionamento de janela do convidado) provavelmente não irão funcionar corretamente.</p><p>Por favor atualize os Adicionais para Convidado para a versão atual usando a função  <b>Instalar Adicio [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Os Adicionais para Convidado do VirtualBox instalados no Sistema Operacional Convidado estão desatualizados: a versão instalada é %1, e a versão esperada é %2. Alguns recursos dos Adicionais para Convidado (integração de mouse, auto-redimensionamento de janela do convidado) podem não funcionar corretamente.</p><p>É recomendado que se atualize os Adicionais para Convidado para a versão atual  usando a função <b>Instalar Adici [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Os Adicionais para Convidado do VirtualBox instalados no Sistema Operacional Convidado são recentes demais para esta versão do VirtualBox: a versão instalada é %1, a versão esperada é %2.</p><p>O uso de uma versão mais nova dos Adicionais com uma versão mais antiga do VirtualBox não é suportado. Por favor instale a versão atual dos Adicionais para Convidado usando a função <b>Instalar Adicionais para Convidado</b> do m [...]
     </message>
     <message>
@@ -7597,8 +8271,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>A janela da máquina virtual está otimizada para trabalhar com o modo de cores de <b>%1&nbsp;bits</b>, mas o modo de cores do monitor virtual está definido como <b>%2&nbsp;bits</b>.</p><p>Abra o diálogo de propriedades do monitor no sistema operacional convidado e selecione um modo de cores de <b>%3&nbsp;bits</b> se estiver disponível, de forma a obter a melhor performance possível do [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>Um erro crítico ocorreu enquanto a máquina virtual estava em execução e por isto a execução foi interrompida.</p><p>Para ajuda, consulte a seção Comunidade no endereço <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> ou utilize os recursos disponibilizados por seu contrato de suporte. Por favor forneça o conteúdo do arquivo de log <tt>VBox.log</tt> e o arquivo de imagem <tt>VBox.png&l [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Um erro crítico ocorreu enquanto a máquina virtual estava em execução e por isto a execução foi interrompida.</p><p>Para ajuda, consulte a seção Comunidade no endereço <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> ou utilize os recursos disponibilizados por seu contrato de suporte. Por favor forneça o conteúdo do arquivo de log <tt>VBox.log</tt> e o arquivo de imagem <tt>VBox.png< [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
@@ -7705,9 +8379,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Baixar</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Inserir</translation>
+        <translation type="obsolete">Montar</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7879,8 +8553,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Mostra um diálogo com informações de produto</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Uma nova versão do VirtualBox foi lançada! A versão <b>%1</b> está disponível em <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Você pode baixá-la diretamente através deste link:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Uma nova versão do VirtualBox foi lançada! A versão <b>%1</b> está disponível em <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Você pode baixá-la diretamente através deste link:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7980,7 +8654,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Um ou mais discos rígidos virtuais, mídias de CD/DVD ou disquete registrados não estão acessíveis. Portanto, você não poderá operar máquinas virtuais que utilizem estas mídias até que elas estejam acessíveis.</p><p>Pressione <b>OK</b> para abrir a janela do Gerenciador de Mídias Virtuais e verificar quais mídias estão inacessíveis, ou pressione <b>Ignorar</b> para ignorar esta mensagem.</p></translation>
+        <translation type="obsolete"><p>Um ou mais discos rígidos virtuais, mídias de CD/DVD ou disquete registrados não estão acessíveis. Portanto, você não poderá operar máquinas virtuais que utilizem estas mídias até que elas estejam acessíveis.</p><p>Pressione <b>OK</b> para abrir a janela do Gerenciador de Mídias Virtuais e verificar quais mídias estão inacessíveis, ou pressione <b>Ignorar</b> para ignorar esta mensagem.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -8010,8 +8684,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Sobrescre&ver</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Um erro crítico ocorreu enquanto a máquina virtual estava em execução e por isto a execução foi interrompida.</p><p>Para ajuda, consulte a seção Comunidade no endereço <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> ou utilize os recursos disponibilizados por seu contrato de suporte. Por favor forneça o conteúdo do arquivo de log <tt>VBox.log</tt> e o arquivo de imagem <tt>VBox.png</tt>, os qu [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Um erro crítico ocorreu enquanto a máquina virtual estava em execução e por isto a execução foi interrompida.</p><p>Para ajuda, consulte a seção Comunidade no endereço <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> ou utilize os recursos disponibilizados por seu contrato de suporte. Por favor forneça o conteúdo do arquivo de log <tt>VBox.log</tt> e o arquivo de imagem <tt>VBox.png< [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -8294,7 +8968,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Você tem certeza de que deseja remover o dispositivo de CD/DVD?</p><p>Você não poderá ler nenhum CD, montar imagens ISO ou instalar os Adicionais para Convidado sem ele!</p></translation>
+        <translation type="obsolete"><p>Você tem certeza de que deseja remover o dispositivo de CD/DVD?</p><p>Você não poderá ler nenhum CD, montar imagens ISO ou instalar os Adicionais para Convidado sem ele!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -8397,7 +9071,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Você está prestes a acrescentar um drive de CD/DVD à controladora <b>%1</b>. Gostaria de escolher um disco virtual de CD/DVD para inserir no drive ou deseja deixá-lo vazio por enquanto?</p></translation>
+        <translation type="obsolete"><p>Você está prestes a acrescentar um drive de CD/DVD à controladora <b>%1</b>. Gostaria de escolher um disco virtual de CD/DVD para inserir no drive ou deseja deixá-lo vazio por enquanto?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -8419,14 +9093,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Falha ao desconectar o dispositivo de CD/DVD (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
+        <translation type="obsolete">Falha ao desconectar o dispositivo de CD/DVD (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Falha ao desconectar o dispositivo de disquete (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
+        <translation type="obsolete">Falha ao desconectar o dispositivo de disquete (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>Os Adicionais para Convidado não estão disponíveis nesta máquina virtual, e portanto não é possível utilizar o recurso de pastas compartilhadas. Para utilizar pastas compartilhadas dentro da máquina virtual, instale os Adicionais para Convidado, ou instale-os novamente caso não estejam funcionando corretamente. Para fazer isto, selecione a opção <b>Instalar Adicionais para Convidado</b> no menu <b>Máquina</b>. Caso já  [...]
     </message>
     <message numerus="yes">
@@ -8474,19 +9148,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Falha ao conectar o dispositivo de CD/DVD (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
+        <translation type="obsolete">Falha ao conectar o dispositivo de CD/DVD (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Falha ao conectar o dispositivo de disquete (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
+        <translation type="obsolete">Falha ao conectar o dispositivo de disquete (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>A unidade de armazenamento desta mídia não será apagada, logo será possível acrescentá-la à lista posteriormente.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>Os Adicionais para Convidado não estão disponíveis nesta máquina virtual, e portanto não é possível utilizar o recurso de pastas compartilhadas. Para utilizar pastas compartilhadas dentro da máquina virtual, instale os Adicionais para Convidado, ou instale-os novamente caso não estejam funcionando corretamente. Para fazer isto, selecione a opção <b>Inserir Imagem dos Adicionais para Convidado</b> no menu <b>Dispositivos</b>. Caso já e [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Os Adicionais para Convidado não estão disponíveis nesta máquina virtual, e portanto não é possível utilizar o recurso de pastas compartilhadas. Para utilizar pastas compartilhadas dentro da máquina virtual, instale os Adicionais para Convidado, ou instale-os novamente caso não estejam funcionando corretamente. Para fazer isto, selecione a opção <b>Instalar Adicionais para Convidado</b> no menu <b>Máquina</b>. Caso já  [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -8728,7 +9402,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Falha ao descartar dados.</translation>
+        <translation type="obsolete">Falha ao descartar dados.</translation>
     </message>
     <message>
         <source>&Network Operations Manager...</source>
@@ -8820,15 +9494,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>Não foi possível executar o Gerenciador do VirtualBox devido a restrições locais.</p><p>A aplicação será finalizada.</p></translation>
+        <translation><p>Não é possível iniciar o Gerenciador do VirtualBox por restrições locais.</p><p>A aplicação será fechada agora.</p></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>Não foi possível encontrar um arquivo de linguagem para o idioma <b>%1</b> no diretório <b><nobr>%2</nobr></b>.</p><p>O idioma será temporariamente definido para o idioma padrão do sistema. Por favor abra o diálogo de <b>Preferências</b> no menu <b>Arquivo</b> da janela principal do Gerenciador do VirtualBox, e selecione um dos idiomas existentes na página <b>Idiomas</b>.< [...]
+        <translation><p>Não foi possível encontrar um arquivo de tradução para o idioma <b>%1</b> no diretório <b><nobr>%2</nobr></b>.</p><p>O idioma será temporariamente definido para o idioma padrão do sistema. Abra a janela de <b>Preferências</b> a partir do menu <b>Arquivo</b> na janela do Gerenciador do VirtualBox, e selecione um dos idiomas existentes na página <b>Idiomas</b>.</p></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>Não foi possível carregar o arquivo de linguagem <b><nobr>%1</nobr></b>. <p>O idioma será temporariamente redefinido para Inglês (embutido). Por favor vá até o diálogo <b>Preferências</b> a partir do menu <b>Arquivo</b> na janela do Gerenciador do VirtualBox, e selecione um dos idiomas existentes na página <b>Idiomas</b>.</p></translation>
+        <translation><p>Não foi possível encontrar o arquivo de tradução <b><nobr>%1</nobr></b>. <p>O idioma será temporariamente definido para English (built-in). Abra a janela <b>Preferências</b> a partir do menu <b>Arquivo</b> na janela do Gerenciador do VirtualBox, e selecione um dos idiomas existentes na página <b>Idiomas</b>.</p></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
@@ -8844,7 +9518,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>Falha ao remover a rede NAT <b>%1<./b>.</translation>
+        <translation>Falha ao remover a rede NAT <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
@@ -8852,19 +9526,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>Falha ao remover o servidor DHCP da placa de rede <b>%1</b>.</translation>
+        <translation>Falha ao remover o servidor DHCP para a placa de rede <b>%1</b>.</translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>Falha ao criar a placa de rede exclusiva de hospedeiro.</translation>
+        <translation>Falha ao criar a placa de rede do hospedeiro.</translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>Criar &novo disco</translation>
+        <translation>&Criar novo disco</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>Utilizar dis&co rígido existente</translation>
+        <translation>Utilizar disco rígido existente (&C)</translation>
     </message>
     <message>
         <source>Leave &empty</source>
@@ -8880,15 +9554,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Você tem certeza de que deseja liberar o disco ótico virtual <nobr><b>%1</b></nobr>?</p><p>Esta ação irá desconectá-lo das seguintes máquinas virtuais:<b>%2</b>.</p></translation>
+        <translation><p>Você tem certeza de que deseja liberar o disco óptico virtual <nobr><b>%1</b></nobr>?</p><p>Esta ação irá desconectá-lo das seguintes máquinas virtuais:<b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Você tem certeza de que deseja liberar o drive de disquete virtual <nobr><b>%1</b></nobr>?</p><p>Esta ação irá desconectá-lo das seguintes máquinas virtuais:<b>%2</b>.</p></translation>
+        <translation><p>Você tem certeza de que deseja liberar o disquete virtual <nobr><b>%1</b></nobr>?</p><p>Esta ação irá desconectá-lo das seguintes máquinas virtuais:<b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Você tem certeza de que deseja remover o disco rígido virtual <nobr><b>%1</b></nobr> da lista de imagens de disco conhecidas?</p></translation>
+        <translation><p>Você tem certeza de que deseja remover o disco rígido <nobr><b>%1</b></nobr> da lista de imagens de disco conhecidas?</p></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
@@ -8896,15 +9570,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Você tem certeza de que deseja remover o disco ótico virtual <nobr><b>%1</b></nobr> da lista de imagens de disco conhecidas?</p></translation>
+        <translation><p>Você tem certeza de que deseja remover o disco óptico virtual <nobr><b>%1</b></nobr> da lista de imagens de disco conhecidas?</p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Você tem certeza de que deseja remover o drive de disquete virtual <nobr><b>%1</b></nobr> da lista de imagens de disco conhecidas?</p></translation>
+        <translation><p>Você tem certeza de que deseja remover o disquete virtual <nobr><b>%1</b></nobr> da lista de imagens de disco conhecidas?</p></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Não foi possível inserir o disco ótico virtual <nobr><b>%1</b></nobr> na máquina <b>%2</b>.</p></translation>
+        <translation><p>Falha ao inserir o disco óptico virtual <nobr><b>%1</b></nobr> na máquina <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
@@ -8912,7 +9586,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Não foi possível ejetar o disco ótico virtual <nobr><b>%1</b></nobr> da máquina <b>%2</b>.</p></translation>
+        <translation><p>Falha ao ejetar o disco óptico virtual <nobr><b>%1</b></nobr> da máquina <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
@@ -8920,11 +9594,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Não foi possível inserir o disquete virtual <nobr><b>%1</b></nobr> na máquina <b>%2</b>.</p></translation>
+        <translation><p>Falha ao inserir o disquete virtual <nobr><b>%1</b></nobr> na máquina <b>%2</b>.</p></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Não foi possível ejetar o disquete virtual <nobr><b>%1</b></nobr> da máquina <b>%2</b>.</p></translation>
+        <translation><p>Falha ao ejetar o disquete virtual <nobr><b>%1</b></nobr> da máquina <b>%2</b>.</p></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
@@ -8932,7 +9606,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Falha ao abrir o arquivo de disco ótico <nobr><b>%1</b></nobr>.</translation>
+        <translation>Falha ao abrir o arquivo de disco óptico <nobr><b>%1</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
@@ -8940,11 +9614,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Falha ao fechar o arquivo de disquete <nobr><b>%2</b></nobr>.</translation>
+        <translation>Falha ao fechar o arquivo de disco rígido <nobr><b>%2</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Falha ao fechar o arquivo de disco ótico <nobr><b>%2</b></nobr>.</translation>
+        <translation>Falha ao fechar o arquivo de disco óptico <nobr><b>%2</b></nobr>.</translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
@@ -8954,8 +9628,8 @@ p, li { white-space: pre-wrap; }
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
         <translation>
-            <numerusform><p>A seguinte %n máquina virtual possui um estado de execução salvo: <b>%1</b></p><p>Se você continuar, o estado atual de execução da máquina exportada será descartado. As outras máquinas não serão afetadas.</p></numerusform>
-            <numerusform><p>As %n máquinas virtuais possuem estado de execução salvo:<b>%1</b></p><p>Se você continuar, o estado atual de execução destas máquinas será descartado. As outras máquinas não serão afetadas.</p></numerusform>
+            <numerusform><p>A seguinte %n máquina virtual atualmente possui o estado salvo: <b>%1</b></p><p>Se você continuar, o estado salvo das máquina exportada será descartado. As outras máquinas não serão afetadas.</p></numerusform>
+            <numerusform><p>As seguintes %n máquinas virtuais atualmente possuem o estado salvo: <b>%1</b></p><p>Se você continuar, o estado salvo das máquinas exportadas será descartado. As outras máquinas não serão afetadas.</p></numerusform>
         </translation>
     </message>
     <message>
@@ -8980,7 +9654,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>Não foi possível encontrar o arquivo de imagem de disco de <b>Adicionais para Convidado do VirtualBox</b></p><p>Deseja baixar este arquivo da internet?</p></translation>
+        <translation><p>Não foi possível encontrar o arquivo de imagem de disco dos <b>Adicionais para Convidado do VirtualBox</b>.</p><p>Deseja baixar este arquivo de imagem da internet?</p></translation>
     </message>
     <message>
         <source>Download</source>
@@ -8988,19 +9662,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Você tem certeza de que deseja baixar o arquivo de imagem de disco de <b>Adicionais para Convidado do VirtualBox</b> a partir de <nobr><a href="%1">%1</a></nobr> (tamanho %2 bytes)?</p></translation>
+        <translation><p>Você tem certeza de que deseja baixar a imagem de disco dos <b>Adicionais para Convidado do VirtualBox</b> a partir de <nobr><a href="%1">%1</a></nobr> (tamanho %2 bytes)?</p></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>O arquivo de imagem de disco de <b>Adicionais para Convidado do VirtualBox</b> foi baixado com sucesso a partir de <nobr><a href="%1">%1</a></nobr> mas não pode ser gravado localmente como <nobr><b>%2</b>.</nobr></p><p>Escolha outro local para gravá-lo.</p></translation>
-    </message>
-    <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>O arquivo de imagem de disco de <b>Adicionais para Convidado do VirtualBox</b> foi baixado com sucesso a partir de <nobr><a href="%1">%1</a></nobr> e gravado localmente como <nobr><b>%2</b>.</nobr></p><p>Deseja registrar este arquivo de imagem de disco e inseri-lo no drive de CD/DVD virtual?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Não foi possível inserir o arquivo de imagem de disco de <b>Adicionais para Convidado do VirtualBox</b> na máquina virtual <b>%1</b>, pois esta máquina não possui drives de CD/DVD. Acrescente um drive na página de armazenamento na janela de configurações da máquina virtual.</p></translation>
+        <translation><p>O arquivo de imagem de disco dos <b>Adicionais para Convidado do VirtualBox</b> foi baixado com sucesso a partir de <nobr><a href="%1">%1</a></nobr> mas não pode ser salvo localmente como <nobr><b>%2</b>.</nobr></p><p>Escolha outro local para salvar este arquivo.</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
@@ -9016,7 +9682,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>O Manual do Usuário do VirtualBox foi baixado com sucesso a partir de <nobr><a href="%1">%1</a></nobr> e gravado localmente como <nobr><b>%2</b>.</nobr></p> </translation>
+        <translation><p>O Manual do Usuário do VirtualBox foi baixado com sucesso a partir de <nobr><a href="%1">%1</a></nobr> e salvo localmente como <nobr><b>%2</b>.</nobr></p></translation>
     </message>
     <message>
         <source>Close</source>
@@ -9028,21 +9694,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Do not show this message again</source>
-        <translation>Não exibir esta mensagem novamente</translation>
+        <translation>Não mostrar esta mensagem novamente</translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>Você deseja remover a rede NAT <nobr><b>%1</b>?</nobr></p><p>Se esta rede estiver em uso por uma ou mais placas de rede nas máquinas virtuais, estas placas poderão ficar inacessíveis até que suas configurações sejam corrigidas, escolhendo-se outra rede ou outro tipo de conexão.</p></translation>
-    </message>
-    <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>Os Adicionais para Convidado não estão disponíveis nesta máquina virtual, e portanto não é possível utilizar o recurso de pastas compartilhadas. Para utilizar pastas compartilhadas dentro da máquina virtual, instale os Adicionais para Convidado, ou instale-os novamente caso não estejam funcionando corretamente. Para fazer isto, selecione a opção <b>Instalar Adicionais para Convidado</b> no menu <b>Máquina</b>. Caso já  [...]
-    </message>
-    <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Montar</translation>
+        <translation><p>Você deseja remover a rede NAT <nobr><b>%1</b>?</nobr></p><p>Caso esta rede esteja sendo usada por uma ou mais placas de rede, estas placas de rede não poderão ser utilizadas até que suas configurações sejam alteradas, seja para utilizar outro nome de rede ou um tipo de conexão diferente.</p></translation>
     </message>
     <message>
         <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
@@ -9053,18 +9709,139 @@ p, li { white-space: pre-wrap; }
         <translation>Falha ao desconectar a webcam <b>%1</b> da máquina virtual <b>%2</b>.</translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>A tela virtual está definida atualmente para o modo de cores <b>%1&nbsp;bit</b>. Para melhor performance, mude para o modo de cores <b>%2&nbsp;bit</b>. Normalmente isto pode ser feito na seção <b>Monitor</b> do Painel de Controle ou Configurações do Sistema do sistema convidado.</p></translation>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation><p>Os Adicionais para Convidado não estão disponíveis nesta máquina virtual, e portanto não é possível utilizar o recurso de pastas compartilhadas. Para utilizar pastas compartilhadas dentro da máquina virtual, instale os Adicionais para Convidado, ou instale-os novamente caso não estejam funcionando corretamente. Para fazer isto, selecione a opção <b>Instalar Adicionais para Convidado</b> no menu <b>Dispositivos</b>. Caso já esteja inst [...]
     </message>
-</context>
-<context>
-    <name>UIMiniProcessWidgetAdditions</name>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">Cancelar</translation>
+        <source>Insert</source>
+        <comment>additions</comment>
+        <translation>Inserir</translation>
     </message>
     <message>
-        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation><p>A tela virtual está configurada para o modo de cores <b>%1&nbsp;bit</b>. Para melhor performance, configure-a para utilizar <b>%2&nbsp;bit</b>. Isto pode ser feito na seção <b>Tela</b> do Painel de Controle ou Configurações do Sistema do sistema operacional convidado.</p></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation>As regras atuais de redirecionamento de portas não são válidas. Os nomes das regras precisam ser únicos.</translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation>As regras atuais de redirecionamento de portas não são válidas. Algumas das regras possuem endereços IP e portas conflitantes.</translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>Falha ao criar o objeto COM do VirtualBoxClient.</p><p>A aplicação será finalizada agora.</p></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation>Falha ao definir os dados extras globais do VirtualBox da chave <i>%1</i> para o valor <i>{%2}</i>.</translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation>Falha ao definir os dados extras da chave <i>%1</i> da máquina <i>%2</i> para o valor <i>{%3}</i>.</translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>Um ou mais arquivos de imagem de discos virtuais rígidos, ópticos, ou de disquete não estão acessíveis. Portanto, você não poderá operar máquinas virtuais que utilizem estes arquivos até que estes estejam acessíveis.</p><p>Pressione <b>Verificar</b> para abrir a janela do Gerenciador de Mídias Virtuais e verificar quais arquivos estão inacessíveis, ou pressione <b>Ignorar</b> para ignorar esta mensagem.</p></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation>Falha ao gravar as configurações.</translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p>Você está prestes a acrescentar um drive óptico à controladora <b>%1</b>. Gostaria de escolher um disco óptico virtual para inserir no drive ou deseja deixá-lo vazio por enquanto?</p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>Você tem certeza de que deseja remover o drive óptico?</p><p>Você não poderá inserir nenhum disco óptico, imagens ISO ou instalar os Adicionais para Convidado sem ele!</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Falha ao conectar o drive óptico (<nobr><b>%1</b></nobr>) ao slot <i>%2</i> da máquina <b>%3</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Falha ao conectar o drive de disquete (<nobr><b>%1</b></nobr>) ao slot <i>%2</i> da máquina <b>%3</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Falha ao desconectar o drive óptico (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>Falha ao desconectar o drive de disquete (<nobr><b>%1</b></nobr>) do slot <i>%2</i> da máquina <b>%3</b>.</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this er [...]
+        <translation type="obsolete"><p>Um erro crítico ocorreu durante a execução da máquina virtual e sua execução deve ser interrompida.</p><p>Para ajuda, consulte a seção Comunidade em <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> ou o seu contrato de suporte. Forneça o conteúdo do arquivo de log <tt>VBox.log</tt>, que pode ser encontrado no diretório da máquina virtual, assim como uma descrição do que você estava fazendo qu [...]
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Falha ao conectar o cabo de rede da máquina virtual <b>%1</b>.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">Falha ao desconectar o cabo de rede da máquina virtual <b>%1</b>.</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation><p>Não foi possível inserir o arquivo de imagem de disco dos <b>Adicionais para Convidado do VirtualBox</b> na máquina virtual <b>%1</b>, pois a máquina não possui nenhum drive óptico. Acrescente um drive óptico utilizando a página de armazenamento na janela de configurações da máquina virtual.</p></translation>
+    </message>
+    <message>
+        <source>Unable to enter password!</source>
+        <translation type="obsolete">Não foi possível entrar com a senha!</translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p>O arquivo de imagem de disco dos <b>Adicionais para Convidado do VirtualBox</b> foi baixado com sucesso a partir de <nobr><a href="%1">%1</a></nobr> e salvo localmente como <nobr><b>%2</b>.</nobr></p><p>Você deseja registrar este arquivo de imagem de disco e inseri-lo no drive óptico virtual?</p></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProcessWidgetAdditions</name>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Cancelar</translation>
+    </message>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
         <translation type="obsolete">Cancelar o download da imagem de CD dos Adicionais para Convidado do VirtualBox</translation>
     </message>
     <message>
@@ -9146,7 +9923,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Nome:</translation>
     </message>
     <message>
@@ -9280,15 +10057,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>Formato inválido de certificado SSL</translation>
+        <translation>Formato de certificado SSL incorreto</translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>Autenticação SSL falhou</translation>
+        <translation>Falha na autenticação SSL</translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>Motivo desconhecido</translation>
+        <translation>Razão desconhecida</translation>
     </message>
 </context>
 <context>
@@ -10208,7 +10985,7 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>Clique para obter mais detalhes</translation>
+        <translation>Clique para mais detalhes</translation>
     </message>
 </context>
 <context>
@@ -10342,14 +11119,18 @@ utilizando o diálogo de Configurações da MV.</p></translation>
         <translation>Arquivos de máquina virtual (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Bem-Vindo ao VirtualBox!</h3><p>A parte esquerda desta janela mostra uma lista de todas as máquinas virtuais disponíveis em seu computador. A lista está vazia agora porque você ainda não criou nenhuma máquina virtual.<img src=:/welcome.png align=right/></p><p>Para criar uma nova máquina virtual, pressione o botão <b>Novo</b> na barra de ferramentas principal, localizada no topo da janela.</p><p>Você pode [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Bem-Vindo ao VirtualBox!</h3><p>A parte esquerda desta janela mostra uma lista de todas as máquinas virtuais disponíveis em seu computador. A lista está vazia agora porque você ainda não criou nenhuma máquina virtual.<img src=:/welcome.png align=right/></p><p>Para criar uma nova máquina virtual, pressione o botão <b>Novo</b> na barra de ferramentas principal, localizada no topo da janela.</p>&l [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Gerenciador</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -10382,7 +11163,7 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     </message>
     <message>
         <source>Settings</source>
-        <translation>Configurações</translation>
+        <translation type="obsolete">Configurações</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -10435,6 +11216,10 @@ utilizando o diálogo de Configurações da MV.</p></translation>
         <source>Display</source>
         <translation>Tela</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -10510,6 +11295,44 @@ utilizando o diálogo de Configurações da MV.</p></translation>
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">você está utilizando mais controladoras de armazenamento que o chipset %1 suporta. Altere o tipo de chipset na página de Configurações do Sistema ou reduza a quantidade das seguintes controladoras de armazenamento na página de Configurações de Armazenamento: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation>Interface do Usuário</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Configurações</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>Carregando Configurações...</translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation>Salvando Configurações...</translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translatorcomment>O warning de accelerator é falso.</translatorcomment>
+        <translation><nobr><b>Clique</b> para chavear a presença dos indicadores.</nobr><br><nobr><b>Arraste e solte</b>para mudar a posição do indicador.</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation>Fechar</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation>Habilitar Barra de Status</translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -10621,8 +11444,8 @@ utilizando o diálogo de Configurações da MV.</p></translation>
         <translation type="obsolete">Sumário</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Uma nova versão do VirtualBox foi lançada! A versão <b>%1</b> está disponível em <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Você pode baixá-la diretamente através deste link:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Uma nova versão do VirtualBox foi lançada! A versão <b>%1</b> está disponível em <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Você pode baixá-la diretamente através deste link:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -10690,6 +11513,14 @@ utilizando o diálogo de Configurações da MV.</p></translation>
         <source>&Restore current snapshot '%1'</source>
         <translation>&Restaurar o snapshot '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>&Continuar executando em background</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><p>Ao fechar as janelas das máquinas virtuais, elas continuarão em execução.</p><p>Você pode utilizar o Gerenciador do VirtualBox para recuperar a janela da máquina virtual posteriormente.</p></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -10703,6 +11534,229 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Diálogo de Informações sobre a Sessão</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">Fe&char</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informações sobre a Sessão</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Detalhes</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">Tempo de execução (&R)</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transferências de DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transferências de PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Dados Lidos</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Dados Gravados</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Dados Transmitidos</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Dados Recebidos</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Habilitado</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Desabilitado</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Atributos de Tempo de Execução</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Resolução da Tela</translation>
+    </message>
+    <message>
+        <source>Hardware Virtualization</source>
+        <translation type="obsolete">Virtualização de Hardware</translation>
+    </message>
+    <message>
+        <source>IDE Hard Disk Statistics</source>
+        <translation type="obsolete">Estatísticas de Disco Rígido IDE</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Estatísticas de CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Estatísticas de Placa de Rede</translation>
+    </message>
+    <message>
+        <source>Adapter 1</source>
+        <translation type="obsolete">Adaptador %1</translation>
+    </message>
+    <message>
+        <source>Adapter 2</source>
+        <translation type="obsolete">Adaptador %1</translation>
+    </message>
+    <message>
+        <source>Adapter 3</source>
+        <translation type="obsolete">Adaptador %1</translation>
+    </message>
+    <message>
+        <source>Adapter 4</source>
+        <translation type="obsolete">Adaptador %1</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Não conectado</translation>
+    </message>
+    <message>
+        <source>Hard Disks Statistics</source>
+        <translation type="obsolete">Estatísticas de Disco Rígido</translation>
+    </message>
+    <message>
+        <source>Primary Master</source>
+        <translation type="obsolete">Primário Master</translation>
+    </message>
+    <message>
+        <source>Primary Slave</source>
+        <translation type="obsolete">Primário Slave</translation>
+    </message>
+    <message>
+        <source>Secondary Master</source>
+        <translation type="obsolete">Secundário Master</translation>
+    </message>
+    <message>
+        <source>Secondary Slave</source>
+        <translation type="obsolete">Secundário Slave</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Versão %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Não Detectado</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Não Detectado</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Adicionais Para Convidado</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Tipo de Sistema Operacional Convidado</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Estatísticas de Disco Rígido</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Nenhum Disco Rígido</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Nenhuma Placa de Rede</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Habilitada</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Desabilitado</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Paginação Aninhada</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Não Disponível</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Estatísticas de Armazenamento</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Nenhum Dispositivo de Armazenamento</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Estatísticas de Rede</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Paginação Aninhada</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Não Disponível</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Modo de Área de Transferência</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Modo Arrastar e Soltar</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>&Detalhes de Configuração</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>Informações de &Runtime</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation>Uptime da VM</translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation>Modo Arrastar e Soltar</translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -10885,11 +11939,27 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Ocultar Descrição</translation>
+        <translation type="obsolete">Ocultar Descrição</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Exibir Descrição</translation>
+        <translation type="obsolete">Exibir Descrição</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation>Modo &Expert</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation>Alterna para o <nobr><b>Modo Expert</b></nobr>, um diálogo de uma página para usuários experientes.</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>Modo &Guiado</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation>Alterna para o <nobr><b>Modo Guiado</b></nobr>, um diálogo passo-a-passo com explicações detalhadas.</translation>
     </message>
 </context>
 <context>
@@ -10920,7 +11990,7 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     </message>
     <message>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Escolha o tipo de arquivo que você gostaria de utilizar para o novo disco rígido virtual. Caso não necessite utilizá-lo com outros softwares de virtualização, pode deixar esta opção como está.</translation>
+        <translation><p>Escolha o tipo de arquivo que você gostaria de utilizar para o novo disco rígido virtual. Caso não necessite utilizá-lo com outros softwares de virtualização, pode deixar esta opção como está.</p></translation>
     </message>
     <message>
         <source>Storage on physical hard drive</source>
@@ -11223,11 +12293,11 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>Escolha um nome de arquivo para exportar o appliance virtual</translation>
+        <translation>Escolha um arquivo para exportar o appliance virtual</translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>&Formato:</translation>
+        <translation>F&ormato:</translation>
     </message>
     <message>
         <source>OVF 0.9</source>
@@ -11243,11 +12313,11 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>Grava no formato padrão OVF 1.0.</translation>
+        <translation>Gravar no formato padrão OVF 1.0.</translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>Grava no novo formato experimental OVF 2.0.</translation>
+        <translation>Gravar no formato experimental OVF 2.0.</translation>
     </message>
     <message>
         <source>&Storage settings</source>
@@ -11270,14 +12340,14 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Escolha um nome de arquivo para exportar o appliance virtual...</translation>
+        <translation>Escolha um arquivo para exportar o appliance virtual...</translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Escolha um nome de arquivo para exportar o appliance virtual...</translation>
+        <translation>Escolha um arquivo para exportar o appliance virtual...</translation>
     </message>
 </context>
 <context>
@@ -11351,11 +12421,11 @@ utilizando o diálogo de Configurações da MV.</p></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>Escolha um nome de arquivo de appliance virtual para importar...</translation>
+        <translation>Escolha um arquivo para importar o appliance virtual...</translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>Escolha um nome de arquivo de appliance virtual para importar</translation>
+        <translation>Escolha um arquivo para importar o appliance virtual</translation>
     </message>
 </context>
 <context>
@@ -11922,11 +12992,11 @@ Versão %1</translation>
         <translation type="obsolete">Abre o diálogo de pastas compartilhadas</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Instalar Adicionais para Convidado...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Montar a imagem de instalação dos Adicionais para Convidado</translation>
     </message>
     <message>
@@ -12275,7 +13345,7 @@ Versão %1</translation>
         <translation type="obsolete">I&nformações sobre a Sessão</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Exibe Informações Sobre a Sessão</translation>
     </message>
     <message>
@@ -12769,8 +13839,8 @@ Versão %1</translation>
         <translation><redefinir para o padrão></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>O valor padrão real será exibido após aceitar as mudanças e abrir este diálogo novamente.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">O valor padrão real será exibido após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -12818,8 +13888,7 @@ Versão %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">O valor padrão real será exibido após aceitar as mudanças e abrir este diálogo novamente.</translation>
+        <translation>O valor padrão real do caminho será exibido após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
 </context>
 <context>
@@ -13184,7 +14253,7 @@ Versão %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -14068,17 +15137,17 @@ Versão %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>A conexão deste disco rígido será feita indiretamente utilizando um disco rígido diferencial adicional.</translation>
+        <translation type="obsolete">A conexão deste disco rígido será feita indiretamente utilizando um disco rígido diferencial adicional.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Algumas das mídias neste disco rígido estão inacessíveis. Utilize o Gerenciador de Discos Virtuais no modo <b>Exibir Discos Rígidos Diferenciais</b> para inspecionar estas mídias.</translation>
+        <translation type="obsolete">Algumas das mídias neste disco rígido estão inacessíveis. Utilize o Gerenciador de Discos Virtuais no modo <b>Exibir Discos Rígidos Diferenciais</b> para inspecionar estas mídias.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Este disco rígido de base está indiretamente conectado através do seguinte disco rígido diferencial:</translation>
+        <translation type="obsolete">Este disco rígido de base está indiretamente conectado através do seguinte disco rígido diferencial:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -14124,7 +15193,7 @@ Versão %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -14684,67 +15753,201 @@ Versão %1</translation>
         <translation>Escolha a localização para o arquivo contendo o novo disco rígido virtual</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Habilitada</translation>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation>Execução Sem Limites</translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Desabilitada</translation>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation>Mouse PS/2</translation>
+    </message>
+    <message>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation>Mouse USB</translation>
+    </message>
+    <message>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation>Mouse PS/2 e USB</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
+        <translation>Execução Sem Limites</translation>
+    </message>
+    <message>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation>Tablet USB</translation>
+    </message>
+    <message>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation>Tablet USB Multi-Touch</translation>
+    </message>
+    <message>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation>Rede NAT</translation>
+    </message>
+    <message>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation>Rede NAT, '%1'</translation>
+    </message>
+    <message>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation>Você pode criar ou acrescentar imagens de discos utilizando as configurações da máquina virtual.</translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>Porta USB %1</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>desligado</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
         <comment>details report</comment>
-        <translation>Execução sem Restrições</translation>
+        <translation>Interface de paravirtualização</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Nenhuma</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Padrão</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Legado</translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Mínima</translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation>Novo armazenamento dinamicamente alocado</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>Ativo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>Inativo</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>Ativo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>Inativo</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>Ativo</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>Inativo</translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Criando Snapshot</translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Criando Snapshot Online</translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation>KVM</translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation>Óptico</translation>
     </message>
     <message>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Mouse PS/2</translation>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
     </message>
     <message>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Mouse USB</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>OHCI</translation>
     </message>
     <message>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>Mouse PS/2 e USB</translation>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>EHCI</translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <translation>Execução sem Restrições</translation>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>xHCI</translation>
     </message>
     <message>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tablet USB</translation>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation>Interface do Usuário</translation>
     </message>
     <message>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>Tablet Multi-Touch USB</translation>
+        <source>(Optical Drive)</source>
+        <translation>(Drive Óptico)</translation>
     </message>
     <message>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>Rede NAT</translation>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>A conexão deste disco rígido será feita indiretamente utilizando um novo disco rígido diferencial.</translation>
     </message>
     <message>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>Rede NAT, '%1'</translation>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation>Alguns dos arquivos nesta cadeia de discos rígidos estão inacessíveis. Utilize o Gerenciador de Mídias Virtuais para inspecionar estes arquivos.</translation>
     </message>
     <message>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Você pode criar ou acrescentar arquivos de imagem de disco nas configurações da máquina virtual.</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>Este disco rígido de base está indiretamente conectado através do seguinte disco rígido diferencial:</translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -15008,11 +16211,11 @@ to the system default language.</qt>
         <translation type="obsolete">Mostra o caminho para a pasta padrão de arquivos VDI. Esta pasta será sempre utilizada para acrescentar discos rígidos virtuais novos ou existentes, a não ser que seja definida especificamente outra pasta na máquina virtual.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Redefine o caminho da pasta de máquinas virtuais para o valor padrão. O caminho padrão será mostrado após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Redefine o caminho da pasta de arquivos VDI para o valor padrão. O valor será mostrado após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
@@ -15056,7 +16259,7 @@ to the system default language.</qt>
         <translation type="obsolete">Abre um diálogo para seleção do arquivo da biblioteca de autenticação VRDP.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Redefine o nome do arquivo da biblioteca de autenticação para o valor padrão. O valor padrão será mostrado após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
@@ -15622,6 +16825,18 @@ to the system default language.</qt>
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Criar um novo disco rígido virtual</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation>UUID:</translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -15714,8 +16929,8 @@ to the system default language.</qt>
         <translation type="obsolete">Diálogo de Registro do VirtualBox</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Por favor preencha este formulário de registro para que possamos saber que você utiliza o VirtualBox, e opcionalmente permitir que o informemos sobre notícias e updates do VirtualBox.</p><p>Entre com o seu nome completo usando caracteres Latinos (sem acentos e símbolos) e o seu endereço de e-mail nos campos abaixo. A innotek se compromete a utilizar estas informações apenas para coletar estatísticas de uso do produto e para enviar [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Por favor preencha este formulário de registro para que possamos saber que você utiliza o VirtualBox, e opcionalmente permitir que o informemos sobre notícias e updates do VirtualBox.</p><p>Entre com o seu nome completo usando caracteres Latinos (sem acentos e símbolos) e o seu endereço de e-mail nos campos abaixo. A innotek se compromete a utilizar estas informações apenas para coletar estatísticas de uso do produto e para enviar [...]
     </message>
     <message>
         <source>&Name</source>
@@ -15762,8 +16977,8 @@ to the system default language.</qt>
         <translation type="obsolete">Não foi possível estabelecer negociação da conexão.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Por favor, preencha este formulário de registro para informar-nos que você utiliza o VirtualBox e opcionalmente receber notícias e informações sobre atualizações.</p><p>Informe o seu nome completo utilizando apenas caracteres Latinos e o seu endereço de e-mail nos campos abaixo. A Sun MicroSystems irá utilizar esta informação apenas para fins de obter estatísticas de uso do produto e para enviar mensagens informativas sobre o Virt [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Por favor, preencha este formulário de registro para informar-nos que você utiliza o VirtualBox e opcionalmente receber notícias e informações sobre atualizações.</p><p>Informe o seu nome completo utilizando apenas caracteres Latinos e o seu endereço de e-mail nos campos abaixo. A Sun MicroSystems irá utilizar esta informação apenas para fins de obter estatísticas de uso do produto e para enviar mensagens informativas sobre o Virt [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -15782,8 +16997,8 @@ to the system default language.</qt>
         <translation type="obsolete">Selecione o País/Território</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Por favor preencha este formulário de registro para que nós possamos ser informados que você utiliza o VirtualBox, e opcionalmente podermos mantê-lo informado sobre eventuais novidades e atualizações do VirtualBox.</p><p>Por favor use caracteres acentuados nos campos abaixo. A Sun Microsystems garante que irá utilizar esta informação apenas para obter estatísticas de uso do produto e para enviar newsletters do VirtualBox para você [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Por favor preencha este formulário de registro para que nós possamos ser informados que você utiliza o VirtualBox, e opcionalmente podermos mantê-lo informado sobre eventuais novidades e atualizações do VirtualBox.</p><p>Por favor use caracteres acentuados nos campos abaixo. A Sun Microsystems garante que irá utilizar esta informação apenas para obter estatísticas de uso do produto e para enviar newsletters do VirtualBox para você [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -16071,8 +17286,8 @@ to the system default language.</qt>
         <translation type="obsolete">Suspender a execução da máquina virtual</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Bem-Vindo ao VirtualBox!</h3><p>A parte esquerda desta janela mostra uma lista de todas as máquinas virtuais disponíveis em seu computador. A lista está vazia agora porque você ainda não criou nenhuma máquina virtual ainda.<img src=:/welcome.png align=right/></p><p>Para criar uma nova máquina virtual, pressione o botão <b>Novo</b> na barra de ferramentas principal, localizada no topo da janela.</p [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Bem-Vindo ao VirtualBox!</h3><p>A parte esquerda desta janela mostra uma lista de todas as máquinas virtuais disponíveis em seu computador. A lista está vazia agora porque você ainda não criou nenhuma máquina virtual ainda.<img src=:/welcome.png align=right/></p><p>Para criar uma nova máquina virtual, pressione o botão <b>Novo</b> na barra de ferramentas principal, localizada no topo da janela.</p [...]
     </message>
     <message>
         <source>Log</source>
@@ -16992,221 +18207,6 @@ qualquer valor.</qt></translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Diálogo de Informações sobre a Sessão</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">Fe&char</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Informações sobre a Sessão</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detalhes</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">Tempo de execução (&R)</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transferências de DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transferências de PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Dados Lidos</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Dados Gravados</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Dados Transmitidos</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Dados Recebidos</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Habilitado</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Desabilitado</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Atributos de Tempo de Execução</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Resolução da Tela</translation>
-    </message>
-    <message>
-        <source>Hardware Virtualization</source>
-        <translation type="obsolete">Virtualização de Hardware</translation>
-    </message>
-    <message>
-        <source>IDE Hard Disk Statistics</source>
-        <translation type="obsolete">Estatísticas de Disco Rígido IDE</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Estatísticas de CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Estatísticas de Placa de Rede</translation>
-    </message>
-    <message>
-        <source>Adapter 1</source>
-        <translation type="obsolete">Adaptador %1</translation>
-    </message>
-    <message>
-        <source>Adapter 2</source>
-        <translation type="obsolete">Adaptador %1</translation>
-    </message>
-    <message>
-        <source>Adapter 3</source>
-        <translation type="obsolete">Adaptador %1</translation>
-    </message>
-    <message>
-        <source>Adapter 4</source>
-        <translation type="obsolete">Adaptador %1</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Não conectado</translation>
-    </message>
-    <message>
-        <source>Hard Disks Statistics</source>
-        <translation type="obsolete">Estatísticas de Disco Rígido</translation>
-    </message>
-    <message>
-        <source>Primary Master</source>
-        <translation type="obsolete">Primário Master</translation>
-    </message>
-    <message>
-        <source>Primary Slave</source>
-        <translation type="obsolete">Primário Slave</translation>
-    </message>
-    <message>
-        <source>Secondary Master</source>
-        <translation type="obsolete">Secundário Master</translation>
-    </message>
-    <message>
-        <source>Secondary Slave</source>
-        <translation type="obsolete">Secundário Slave</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Versão %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Não Detectado</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Não Detectado</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Adicionais Para Convidado</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Tipo de Sistema Operacional Convidado</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Estatísticas de Disco Rígido</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Nenhum Disco Rígido</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Nenhuma Placa de Rede</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Habilitada</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Desabilitado</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Paginação Aninhada</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Não Disponível</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Estatísticas de Armazenamento</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Nenhum Dispositivo de Armazenamento</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Estatísticas de Rede</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Paginação Aninhada</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Não Disponível</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Modo de Área de Transferência</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Modo Arrastar e Soltar</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>&Detalhes de Configuração</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Informações do &Runtime</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -18125,7 +19125,7 @@ o recurso de Input Output APIC (I/O APIC), o que deve diminuir levemente a perfo
         <translation type="obsolete">Mostra o caminho onde os snapshots desta máquina virtual serão armazenados. Note que estes snapshots podem ocupar bastante espaço em disco.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Reinicializa o caminho onde os snapshots são salvos para um valor padrão. O valor padrão será mostrado após aceitar as mudanças e abrir este diálogo novamente.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ro.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ro.ts
index 0768b4a..19eff55 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ro.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ro.ts
@@ -307,7 +307,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Mod trans*parent</translation>
+        <translation type="unfinished">Mod trans*parent</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -331,11 +331,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Dezactivează integrarea &mouse</translation>
+        <translation type="obsolete">Dezactivează integrarea &mouse</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Dezactivează temporar intergrarea mouse</translation>
+        <translation type="obsolete">Dezactivează temporar intergrarea mouse</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -347,11 +347,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Inserează Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&Inserează Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Trimite secvența Ctrl-Alt-Del către mașina virtuală</translation>
+        <translation type="obsolete">Trimite secvența Ctrl-Alt-Del către mașina virtuală</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -359,7 +359,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Trimite secvența Ctrl-Alt-Backspace către mașina virtuală</translation>
+        <translation type="obsolete">Trimite secvența Ctrl-Alt-Backspace către mașina virtuală</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -374,8 +374,8 @@
         <translation type="obsolete">Dialog i&nformații despre sesiune</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Arată dialogul de informații despre sesiune</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Arată dialogul de informații despre sesiune</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -427,15 +427,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Dispozitive &CD/DVD</translation>
+        <translation type="obsolete">Dispozitive &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Unități de &dischetă</translation>
+        <translation type="obsolete">Unități de &dischetă</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Dispozitive &USB</translation>
+        <translation type="obsolete">Dispozitive &USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -462,12 +462,12 @@
         <translation type="obsolete">Activează sau dezactivează conexiuni remote desktop (RDP) către această mașină</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">&Instalare Guest Additions...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Instalare Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Montează imaginea de instalare Guest Additions</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Montează imaginea de instalare Guest Additions</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -486,7 +486,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">Jurna&lizare...</translation>
+        <translation type="obsolete">Jurna&lizare...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -505,26 +505,10 @@
         <translation>Arată iconul aplicației</translation>
     </message>
     <message>
-        <source>Switch to &Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch between normal and fullscreen mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch to Seam&less Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and seamless desktop integration mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch to &Scaled Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and scaled mode</source>
         <translation type="unfinished"></translation>
     </message>
@@ -593,10 +577,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished">&Fișier</translation>
@@ -864,10 +844,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -912,23 +888,249 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Instalare Guest Additions...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Montează imaginea de instalare Guest Additions</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Tastatură</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Rețea</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Afișează &log...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Fișier</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Activează</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1390,14 +1592,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1512,6 +1714,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2138,11 +2367,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">Neconectat</translation>
@@ -2341,24 +2565,119 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Controlor</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>None</source>
-        <comment>details</comment>
-        <translation type="obsolete">Nici unul</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Controlor USB</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Controlor</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Nici unul</translation>
+    </message>
+</context>
+<context>
     <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
         <source>Video Memory</source>
@@ -2644,18 +2963,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="obsolete">Previzualizare în timp re&al</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3758,16 +4065,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation></translation>
     </message>
     <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
-        <comment>CD/DVD tooltip</comment>
-        <translation></translation>
-    </message>
-    <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
-        <comment>FD tooltip</comment>
-        <translation></translation>
-    </message>
-    <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
         <translation></translation>
@@ -3805,7 +4102,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Controlorul USB este dezactivat</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Controlorul USB este dezactivat</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -3856,6 +4153,20 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -3954,7 +4265,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Video</translation>
+        <translation type="obsolete">&Video</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4121,10 +4432,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4176,7 +4483,75 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Minibară:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Dacă este bifat, afișează Minibara în modul pe tot ecranul și în cel transparent.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Arată în mod pe tot &ecranul/transparent</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Dacă este bifată, poziționează minibara în partea de sus a ecranului, deși poziția implicită este la baza ecranului.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Poziționează &sus</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4191,7 +4566,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation>Afișează calea unde vor fi stocate instantaneele acestei mașini virtuale. Notați faptul că instantaneele pot ocupa puțin mai mult spațiu pe disc.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Elementar</translation>
     </message>
     <message>
@@ -4243,7 +4618,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="obsolete">Controlează cantitatea de memorie video oferită mașinii virtuale.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avansat</translation>
     </message>
     <message>
@@ -4331,7 +4706,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation>Director i&nstantanee:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Descriere</translation>
     </message>
     <message>
@@ -4348,7 +4723,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Dacă este bifat, orice schimbare la CD/DVD-ul montat sau mediul dischetă efectuată în timpul execuției mașinii va fi salvată în fișierul de setări pentru a păstra configurația mediilor monate de la o rulare la alta.</translation>
+        <translation type="obsolete">Dacă este bifat, orice schimbare la CD/DVD-ul montat sau mediul dischetă efectuată în timpul execuției mașinii va fi salvată în fișierul de setări pentru a păstra configurația mediilor monate de la o rulare la alta.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -4376,34 +4751,34 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Medii amovibile:</translation>
+        <translation type="obsolete">Medii amovibile:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Reține schimbările din timpul rulării</translation>
+        <translation type="obsolete">&Reține schimbările din timpul rulării</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Minibară:</translation>
+        <translation type="obsolete">Minibară:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Dacă este bifat, afișează Minibara în modul pe tot ecranul și în cel transparent.</translation>
+        <translation type="obsolete">Dacă este bifat, afișează Minibara în modul pe tot ecranul și în cel transparent.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Arată în mod pe tot &ecranul/transparent</translation>
+        <translation type="obsolete">Arată în mod pe tot &ecranul/transparent</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Dacă este bifată, poziționează minibara în partea de sus a ecranului, deși poziția implicită este la baza ecranului.</translation>
+        <translation type="obsolete">Dacă este bifată, poziționează minibara în partea de sus a ecranului, deși poziția implicită este la baza ecranului.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Poziționează &sus</translation>
+        <translation type="obsolete">Poziționează &sus</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -4418,6 +4793,102 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Minibară:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Dacă este bifat, afișează Minibara în modul pe tot ecranul și în cel transparent.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Arată în mod pe tot &ecranul/transparent</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Dacă este bifată, poziționează minibara în partea de sus a ecranului, deși poziția implicită este la baza ecranului.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Poziționează &sus</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -4938,10 +5409,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <source>If checked, this shared folder will be permanent.</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -4992,11 +5459,11 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Dacă este bifat, țeava specificată în câmpul <b>Cale port</b> va fi creată de mașina virtuală, când aceasta pornește. Altfel, mașina virtuală va încerca să folosească țeava existentă.</translation>
+        <translation type="obsolete">Dacă este bifat, țeava specificată în câmpul <b>Cale port</b> va fi creată de mașina virtuală, când aceasta pornește. Altfel, mașina virtuală va încerca să folosească țeava existentă.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Crează țeavă</translation>
+        <translation type="obsolete">&Crează țeavă</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5004,11 +5471,11 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Afișează calea către țeava portului serial pe gazdă, când portul lucrează în mod <b>Țeavă gazdă</b>, sau numele dispozitivul serial de pe gazdă, când portul lucrează în mod <b>Dispozitiv gazdă</b>.</translation>
+        <translation type="obsolete">Afișează calea către țeava portului serial pe gazdă, când portul lucrează în mod <b>Țeavă gazdă</b>, sau numele dispozitivul serial de pe gazdă, când portul lucrează în mod <b>Dispozitiv gazdă</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Cale port/fișier:</translation>
+        <translation type="obsolete">&Cale port/fișier:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5018,6 +5485,22 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Afișează adresa portului I/O de bază pentru acest port paralel. Valori valide sunt întregi între <tt>0</tt> și <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5129,16 +5612,8 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Add Controller</source>
-        <translation>Adaugă controlor</translation>
+        <source>Add Controller</source>
+        <translation>Adaugă controlor</translation>
     </message>
     <message>
         <source>Add IDE Controller</source>
@@ -5170,11 +5645,11 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Adaugă dispozitiv CD/DVD</translation>
+        <translation type="obsolete">Adaugă dispozitiv CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Adaugă unitate de dischetă</translation>
+        <translation type="obsolete">Adaugă unitate de dischetă</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5345,18 +5820,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD &Drive:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Floppy &Drive:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5377,10 +5840,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Remove disk from virtual drive</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5450,6 +5909,54 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5647,31 +6154,39 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5744,7 +6259,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Activează controlor (E&HCI) USB 2.0</translation>
+        <translation type="obsolete">Activează controlor (E&HCI) USB 2.0</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5799,7 +6314,27 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"><nobr>Stare %1</nobr></translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5938,7 +6473,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>C&lose</source>
+        <source>Removing medium...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5958,6 +6493,29 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Închide</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Schimbă</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -5999,7 +6557,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Nu am putut crea obiectul COM VirtualBox.</p><p>Aplicația se va închide acum.</p></translation>
+        <translation type="obsolete"><p>Nu am putut crea obiectul COM VirtualBox.</p><p>Aplicația se va închide acum.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -6289,15 +6847,15 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="obsolete"><p>Unul sau mai multe discuri virtuale sau medii CD/DVD sau dischetă înregistrate nu sunt accesibile. Prin urmare, nu veți putea opera mașinile virtuale care fac uz de aceste medii până când ele devin accesibile din nou.</p><p>Apăsați <b>OK</b> pentru a deschide fereastra Manager de discuri virtuale și a vedea care medii sunt inaccesibile, sau apăsați <b>Ignoră</b> pentru a ignora acest mesaj.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Pachetul VirtualBox Guest Additions instalat pe SO musafir este prea vechi: versiunea instalată este %1, versiunea așteptată fiind %2. Unele funcții care necesită Guest Additions (integrarea cursorului, auto redimensionarea ecranului musafir) s-ar putea să nu mai funcționeze corect.</p><p>Vă rugăm aduceți Guest Additions la versiunea curentă alegând <b>Instalare Guest Additions</b> din meniul <b>Dispozitive</b [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Pachetul VirtualBox Guest Additions instalat pe SO musafir este depășit: versiunea instalată este %1, versiunea așteptată fiind %2. Unele funcții care necesită Guest Additions (integrarea cursorului, auto redimensionarea ecranului musafir) s-ar putea să nu mai funcționeze corect.</p><p>Vă rugăm aduceți Guest Additions la versiunea curentă alegând <b>Instalare Guest Additions</b> din meniul <b>Dispozitive</b&gt [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Pachetul VirtualBox Guest Additions instalat pe SO musafir este prea nou pentru acestă versiune a VirtualBox: versiunea instalată este %1, versiunea așteptată fiind %2. Folosirea unei versiuni mai noi a Guest Additions într-o versiune mai veche a VirtualBox nu este suportată.</p><p>Vă rugăm instalați versiunea curentă a Guest Additions alegând <b>Instalare Guest Additions</b> din meniul <b>Dispozitive</b>.& [...]
     </message>
     <message>
@@ -6342,8 +6900,8 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="obsolete"><p>Fereastra mașinii virtuale este optimizată pentru lucrul în modul de culori <b>%1&nbsp;bit</b>, dar calitatea culorii al ecranului virtual este în prezent setată la <b>%2&nbsp;bit</b>.</p><p>Vă rugăm deschideți dialogul de proprietăți ecran ale SO musafir și selectați modul de culoare <b>%3&nbsp;bit</b>, dacă este disponibil, pentru cea mai bună performanță posibilă a subsistemului v [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>O eroare critică s-a petrecut în timpul execuției mașinii virtuale și execuția a fost oprită.</p><p>Pentru ajutor, vă rugăm verificați secțiunea Community pe <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> sau contractul dvs de suport tehnic. Vă rugăm oferiți conținutul fișierului jurnal <tt>VBox.log</tt> și fișierul imagine <tt>VBox.png</tt>, pe care le puteți găsi în dosarul  [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>O eroare critică s-a petrecut în timpul execuției mașinii virtuale și execuția a fost oprită.</p><p>Pentru ajutor, vă rugăm verificați secțiunea Community pe <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> sau contractul dvs de suport tehnic. Vă rugăm oferiți conținutul fișierului jurnal <tt>VBox.log</tt> și fișierul imagine <tt>VBox.png</tt>, pe care le puteți găsi în dosarul &l [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
@@ -6450,9 +7008,9 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="obsolete">Descarcă</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Montează</translation>
+        <translation type="obsolete">Montează</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6628,8 +7186,8 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="obsolete">Arată dialogul cu informații despre produs</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>O versiune mai nouă a VirtualBox a fost lansată! Versiunea <b>%1</b> este disponibilă la <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puteți descărca această versiune direct de la:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>O versiune mai nouă a VirtualBox a fost lansată! Versiunea <b>%1</b> este disponibilă la <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puteți descărca această versiune direct de la:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6680,10 +7238,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&More</source>
         <comment>warnAboutAutoConvertedSettings message box</comment>
         <translation type="obsolete">&Mai mult</translation>
@@ -6699,8 +7253,8 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="obsolete">Su&prascrie</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>O eroare critică s-a petrecut în timpul execuției mașinii virtuale și execuția a fost oprită.</p><p>Pentru ajutor, vă rugăm verificați secțiunea Community pe <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> sau contractul dvs de suport tehnic. Vă rugăm oferiți conținutul fișierului jurnal <tt>VBox.log</tt> și fișierul imagine <tt>VBox.png</tt>, pe care le puteți găsi în dosarul <nobr>< [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>O eroare critică s-a petrecut în timpul execuției mașinii virtuale și execuția a fost oprită.</p><p>Pentru ajutor, vă rugăm verificați secțiunea Community pe <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> sau contractul dvs de suport tehnic. Vă rugăm oferiți conținutul fișierului jurnal <tt>VBox.log</tt> și fișierul imagine <tt>VBox.png</tt>, pe care le puteți găsi în dosarul &l [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -6874,10 +7428,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="obsolete">dispozitiv dischetă</translation>
     </message>
     <message>
-        <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Remove</source>
         <comment>medium</comment>
         <translation>Ș&terge</translation>
@@ -6927,10 +7477,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -6939,14 +7485,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6975,14 +7513,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7184,10 +7714,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7417,14 +7943,6 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7457,26 +7975,122 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Montează</translation>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>Insert</source>
+        <comment>additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetAdditions</name>
@@ -7545,7 +8159,7 @@ Acest director este folosit, dacă nu este explicit specificat altfel, atunci c
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished">&Nume:</translation>
     </message>
     <message>
@@ -8467,14 +9081,18 @@ din listă apăsând butonul <b>Existent</b> (pentru a invoca dialog
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="unfinished"><h3>Bun venit în VirtualBox!</h3><p>Partea din stânga a ferestrei arată lista tuturor mașinilor virtuale din computerul dvs. Lista este goală acum deoarece nu a fost creată nici o mașină virtuală până acum.<img src=:/welcome.png align=right/></p><p>Pentru a crea o mașină virtuală nouă apăsați butonul <b>Nouă</b> în bara de unelte principală localizată în partea de sus a ferestrei.</p><p>Put [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Bun venit în VirtualBox!</h3><p>Partea din stânga a ferestrei arată lista tuturor mașinilor virtuale din computerul dvs. Lista este goală acum deoarece nu a fost creată nici o mașină virtuală până acum.<img src=:/welcome.png align=right/></p><p>Pentru a crea o mașină virtuală nouă apăsați butonul <b>Nouă</b> în bara de unelte principală localizată în partea de sus a ferestrei.</p><p>Puteț [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -8503,7 +9121,7 @@ din listă apăsând butonul <b>Existent</b> (pentru a invoca dialog
     </message>
     <message>
         <source>Settings</source>
-        <translation type="unfinished">Setări</translation>
+        <translation type="obsolete">Setări</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -8556,6 +9174,10 @@ din listă apăsând butonul <b>Existent</b> (pentru a invoca dialog
         <source>Display</source>
         <translation type="unfinished">Afișare</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8607,6 +9229,43 @@ din listă apăsând butonul <b>Existent</b> (pentru a invoca dialog
         <source>%1 - %2</source>
         <translation type="unfinished">%1 - %2</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Setări</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Închide</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -8718,118 +9377,336 @@ din listă apăsând butonul <b>Existent</b> (pentru a invoca dialog
         <translation type="obsolete"><p>Nu am putut obține informații despre ultima versiune, datorită unei erori din rețea:</p><p><b>%1</b></p></translation>
     </message>
     <message>
-        <source>You are already running the most recent version of VirtualBox.version, there is no newer version currently available.</source>
-        <translation type="obsolete">Aveți instalată ultima versiune a VirtualBox, momentan nu există o versiune mai nouă.</translation>
+        <source>You are already running the most recent version of VirtualBox.version, there is no newer version currently available.</source>
+        <translation type="obsolete">Aveți instalată ultima versiune a VirtualBox, momentan nu există o versiune mai nouă.</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">În&chide</translation>
+    </message>
+    <message>
+        <source>VirtualBox Update Wizard</source>
+        <translation type="obsolete">Asistent actualizare VirtualBox</translation>
+    </message>
+    <message>
+        <source>Check for Updates</source>
+        <translation type="obsolete">Verifică după actualizări</translation>
+    </message>
+    <message>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p>
+<p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p>
+<p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Acest asistent se va conecta la site-ul VirtualBox și va verifica dacă o versiune mai nouă este disponibilă.</p>
+<p>Folosiți butonul <b>Verifică</b> pentru a verifica aacum dacă există o nouă versiune, sau butonul <b>Renunță</b> dacă nu doriți să faceți această verificare.</p>
+<p>Puteți rula acest asistent oricând alegănd din meniul <b>Ajutor</b> comanda <b>Verifică după actualizări...</b></p></translation>
+    </message>
+    <message>
+        <source>Cancel</source>
+        <translation type="obsolete">Renunță</translation>
+    </message>
+    <message>
+        <source>Summary</source>
+        <translation type="obsolete">Rezumat</translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>O versiune mai nouă a VirtualBox a fost lansată! Versiunea <b>%1</b> este disponibilă la <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puteți descărca această versiune direct de la:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
+        <translation type="obsolete"><p>Nu am putut obține informații despre ultima versiune datorită unei erori din rețea:</p><p><b>%1</b></p></translation>
+    </message>
+    <message>
+        <source>You are already running the most recent version of VirtualBox.</source>
+        <translation type="obsolete">Aveți instalată ultima versiune a VirtualBox. Vă rog repetați verificarea actualizărilor mai târziu.</translation>
+    </message>
+    <message>
+        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
+        <translation type="obsolete"><p>Acest asistent se va conecta la site-ul VirtualBox și va verifica dacă o versiune mai nouă este disponibilă.</p><p>Folosiți butonul <b>Verifică</b> pentru a verifica acum dacă există o nouă versiune, sau butonul <b>Renunță</b> dacă nu doriți să faceți această verificare.</p>
+<p>Puteți rula acest asistent oricând alegănd din meniul <b>Ajutor</b> comanda <b>Verifică după actualizări...</b></p></translation>
+    </message>
+</context>
+<context>
+    <name>UIUpdateStepVirtualBox</name>
+    <message>
+        <source>Checking for a new VirtualBox version...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMCloseDialog</name>
+    <message>
+        <source>Close Virtual Machine</source>
+        <translation type="unfinished">Închidere mașină virtuală</translation>
+    </message>
+    <message>
+        <source>You want to:</source>
+        <translation type="unfinished">Doriți să:</translation>
+    </message>
+    <message>
+        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
+        <translation type="unfinished"><p>Salvează starea curentă de execuția a mașinii virtuale pe discul fizic de pe PC gazdă.</p><p>Data viitoare când mașina este pornită, va fi restaurată starea salvată și se va continua execuția din același loc în care ați salvat-o, ceea ce vă va permite să vă continuați lucrul imediat.</p><p>Notați faptul că salvarea stării de execuție poate dura mai mult timp, depinzând de tipul sistemului de operare de pe musafir și  [...]
+    </message>
+    <message>
+        <source>&Save the machine state</source>
+        <translation type="unfinished">&Salvați starea curentă a mașinii</translation>
+    </message>
+    <message>
+        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
+        <translation type="unfinished"><p>Trimite evenimentul apăsare buton Pornire ACPI către mașina virtuală.</p><p>În mod normal, sistemul de operare musafir din interiorul mașinii virtuale va detecta acest eveniment și va efectua p procedură curată de închidere. Aceasta este calea recomandată de a opri o mașină virtuală, pentru că toate aplicațiile rulând în interior, vor avea posibilitatea de a-și salva starea și datele.</p><p>Dacă mașina nu răspunde la [...]
+    </message>
+    <message>
+        <source>S&end the shutdown signal</source>
+        <translation type="unfinished">Trimit&e semnalul de închidere</translation>
+    </message>
+    <message>
+        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
+        <translation type="unfinished"><p>Închide mașina virtuală</p><p>Notați faptul că această acțiune va opri execuția mașinii virtuale imediat, astfel că sistemul de operare musafir nu va fi capabil să efectueze o procedură de închidere curată ceea ce va rezulta în <i>pierderi de date</i> în interiorul mașinii virtuale. Selectarea acestei acțiuni este recomandată numai dacă mașina virtuală nu răspunde la acțiunea <b>Trimite semnal oprire</b>. [...]
+    </message>
+    <message>
+        <source>&Power off the machine</source>
+        <translation type="unfinished">O&priți mașina</translation>
+    </message>
+    <message>
+        <source>Restore the machine state stored in the current snapshot</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
+        <translation type="unfinished"><p>Când este bifat, starea mașinii va fi restaurată din starea salvată în instantaneul curent imediat după ce este oprită. Acest lucru este util dacă sunteți sigur că doriți să ștergeți rezultatele ultimelor sesiuni și să vă întoarceți la instantaneul curent.</p></translation>
+    </message>
+    <message>
+        <source>&Restore current snapshot '%1'</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
+    <message>
+        <source>&Details</source>
+        <translation type="unfinished">&Detalii</translation>
+    </message>
+    <message>
+        <source>&Snapshots</source>
+        <translation type="unfinished">In&stantaneu</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Dialog informații despre sesiune</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">În&chide</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - informații despre sesiune</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Detalii</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">Timp &rulare</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Transferuri DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Transferuri PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Citire date</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Scriere date</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Date transmise</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Date primite</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Activat</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Dezactivat</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Atribute la rulare</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Rezoluție ecran</translation>
+    </message>
+    <message>
+        <source>Hardware Virtualization</source>
+        <translation type="obsolete">Virtualizare hardware</translation>
+    </message>
+    <message>
+        <source>IDE Hard Disk Statistics</source>
+        <translation type="obsolete">Statistici disc hard ID</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Statistici CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Statistici placă de rețea</translation>
+    </message>
+    <message>
+        <source>Adapter 1</source>
+        <translation type="obsolete">Placă 1</translation>
+    </message>
+    <message>
+        <source>Adapter 2</source>
+        <translation type="obsolete">Placă 2</translation>
+    </message>
+    <message>
+        <source>Adapter 3</source>
+        <translation type="obsolete">Placă 3</translation>
+    </message>
+    <message>
+        <source>Adapter 4</source>
+        <translation type="obsolete">Placă 4</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Neconectat</translation>
+    </message>
+    <message>
+        <source>Hard Disks Statistics</source>
+        <translation type="obsolete">Statistici discuri hard</translation>
+    </message>
+    <message>
+        <source>Primary Master</source>
+        <translation type="obsolete">Primar master</translation>
     </message>
     <message>
-        <source>&Close</source>
-        <translation type="obsolete">În&chide</translation>
+        <source>Primary Slave</source>
+        <translation type="obsolete">Primar slave</translation>
     </message>
     <message>
-        <source>VirtualBox Update Wizard</source>
-        <translation type="obsolete">Asistent actualizare VirtualBox</translation>
+        <source>Secondary Master</source>
+        <translation type="obsolete">Secundar master</translation>
     </message>
     <message>
-        <source>Check for Updates</source>
-        <translation type="obsolete">Verifică după actualizări</translation>
+        <source>Secondary Slave</source>
+        <translation type="obsolete">Secundar slave</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p>
-<p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p>
-<p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Acest asistent se va conecta la site-ul VirtualBox și va verifica dacă o versiune mai nouă este disponibilă.</p>
-<p>Folosiți butonul <b>Verifică</b> pentru a verifica aacum dacă există o nouă versiune, sau butonul <b>Renunță</b> dacă nu doriți să faceți această verificare.</p>
-<p>Puteți rula acest asistent oricând alegănd din meniul <b>Ajutor</b> comanda <b>Verifică după actualizări...</b></p></translation>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Versiunea %1.%2</translation>
     </message>
     <message>
-        <source>Cancel</source>
-        <translation type="obsolete">Renunță</translation>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Nedetectat</translation>
     </message>
     <message>
-        <source>Summary</source>
-        <translation type="obsolete">Rezumat</translation>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Nedetectat</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>O versiune mai nouă a VirtualBox a fost lansată! Versiunea <b>%1</b> este disponibilă la <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Puteți descărca această versiune direct de la:</p><p><a href=%2>%3</a></p></translation>
+        <source>Guest Additions</source>
+        <translation></translation>
     </message>
     <message>
-        <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
-        <translation type="obsolete"><p>Nu am putut obține informații despre ultima versiune datorită unei erori din rețea:</p><p><b>%1</b></p></translation>
+        <source>Guest OS Type</source>
+        <translation>Tip SO musafir</translation>
     </message>
     <message>
-        <source>You are already running the most recent version of VirtualBox.</source>
-        <translation type="obsolete">Aveți instalată ultima versiune a VirtualBox. Vă rog repetați verificarea actualizărilor mai târziu.</translation>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Statistici disc fix</translation>
     </message>
     <message>
-        <source><p>This wizard will connect to the VirtualBox web-site and check if a newer version of VirtualBox is available.</p><p>Use the <b>Check</b> button to check for a new version now or the <b>Cancel</b> button if you do not want to perform this check.</p><p>You can run this wizard at any time by choosing <b>Check for Updates...</b> from the <b>Help</b> menu.</p></source>
-        <translation type="obsolete"><p>Acest asistent se va conecta la site-ul VirtualBox și va verifica dacă o versiune mai nouă este disponibilă.</p><p>Folosiți butonul <b>Verifică</b> pentru a verifica acum dacă există o nouă versiune, sau butonul <b>Renunță</b> dacă nu doriți să faceți această verificare.</p>
-<p>Puteți rula acest asistent oricând alegănd din meniul <b>Ajutor</b> comanda <b>Verifică după actualizări...</b></p></translation>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Lipsă discuri fixe</translation>
     </message>
-</context>
-<context>
-    <name>UIUpdateStepVirtualBox</name>
     <message>
-        <source>Checking for a new VirtualBox version...</source>
-        <translation type="unfinished"></translation>
+        <source>No Network Adapters</source>
+        <translation>Lipsă plăci de rețea</translation>
     </message>
-</context>
-<context>
-    <name>UIVMCloseDialog</name>
     <message>
-        <source>Close Virtual Machine</source>
-        <translation type="unfinished">Închidere mașină virtuală</translation>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Activat</translation>
     </message>
     <message>
-        <source>You want to:</source>
-        <translation type="unfinished">Doriți să:</translation>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Dezactivat</translation>
     </message>
     <message>
-        <source><p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p><p>Next time this machine is started, it will be restored from the saved state and continue execution from the same place you saved it at, which will let you continue your work immediately.</p><p>Note that saving the machine state may take a long time, depending on the guest operating system type and the amount of memory you assigned to th [...]
-        <translation type="unfinished"><p>Salvează starea curentă de execuția a mașinii virtuale pe discul fizic de pe PC gazdă.</p><p>Data viitoare când mașina este pornită, va fi restaurată starea salvată și se va continua execuția din același loc în care ați salvat-o, ceea ce vă va permite să vă continuați lucrul imediat.</p><p>Notați faptul că salvarea stării de execuție poate dura mai mult timp, depinzând de tipul sistemului de operare de pe musafir și  [...]
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
     </message>
     <message>
-        <source>&Save the machine state</source>
-        <translation type="unfinished">&Salvați starea curentă a mașinii</translation>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Indisponibil</translation>
     </message>
     <message>
-        <source><p>Sends the ACPI Power Button press event to the virtual machine.</p><p>Normally, the guest operating system running inside the virtual machine will detect this event and perform a clean shutdown procedure. This is a recommended way to turn off the virtual machine because all applications running inside it will get a chance to save their data and state.</p><p>If the machine doesn't respond to this action then the guest operating system  [...]
-        <translation type="unfinished"><p>Trimite evenimentul apăsare buton Pornire ACPI către mașina virtuală.</p><p>În mod normal, sistemul de operare musafir din interiorul mașinii virtuale va detecta acest eveniment și va efectua p procedură curată de închidere. Aceasta este calea recomandată de a opri o mașină virtuală, pentru că toate aplicațiile rulând în interior, vor avea posibilitatea de a-și salva starea și datele.</p><p>Dacă mașina nu răspunde la [...]
+        <source>Storage Statistics</source>
+        <translation>Statistici stocare</translation>
     </message>
     <message>
-        <source>S&end the shutdown signal</source>
-        <translation type="unfinished">Trimit&e semnalul de închidere</translation>
+        <source>No Storage Devices</source>
+        <translation>Lipsă dispozitive de stocare</translation>
     </message>
     <message>
-        <source><p>Turns off the virtual machine.</p><p>Note that this action will stop machine execution immediately so that the guest operating system running inside it will not be able to perform a clean shutdown procedure which may result in <i>data loss</i> inside the virtual machine. Selecting this action is recommended only if the virtual machine does not respond to the <b>Send the shutdown signal</b> action.</p></source>
-        <translation type="unfinished"><p>Închide mașina virtuală</p><p>Notați faptul că această acțiune va opri execuția mașinii virtuale imediat, astfel că sistemul de operare musafir nu va fi capabil să efectueze o procedură de închidere curată ceea ce va rezulta în <i>pierderi de date</i> în interiorul mașinii virtuale. Selectarea acestei acțiuni este recomandată numai dacă mașina virtuală nu răspunde la acțiunea <b>Trimite semnal oprire</b>. [...]
+        <source>Network Statistics</source>
+        <translation>Statistici rețea</translation>
     </message>
     <message>
-        <source>&Power off the machine</source>
-        <translation type="unfinished">O&priți mașina</translation>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation type="unfinished">Indisponibil</translation>
     </message>
     <message>
-        <source>Restore the machine state stored in the current snapshot</source>
+        <source>Clipboard Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation type="unfinished"><p>Când este bifat, starea mașinii va fi restaurată din starea salvată în instantaneul curent imediat după ce este oprită. Acest lucru este util dacă sunteți sigur că doriți să ștergeți rezultatele ultimelor sesiuni și să vă întoarceți la instantaneul curent.</p></translation>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Restore current snapshot '%1'</source>
+        <source>&Runtime Information</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <source>&Details</source>
-        <translation type="unfinished">&Detalii</translation>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Snapshots</source>
-        <translation type="unfinished">In&stantaneu</translation>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8963,11 +9840,19 @@ din listă apăsând butonul <b>Existent</b> (pentru a invoca dialog
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -9973,11 +10858,11 @@ Versiunea %1</translation>
         <translation type="obsolete">Deschide dialogul directoare partajate</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Instalare Guest Additions...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Montează imaginea de instalare Guest Additions</translation>
     </message>
     <message>
@@ -10350,7 +11235,7 @@ Versiunea %1</translation>
         <translation type="obsolete">Dialog i&nformații despre sesiune</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Arată dialogul de informații despre sesiune</translation>
     </message>
     <message>
@@ -10812,8 +11697,8 @@ Versiunea %1</translation>
         <translation><restabilește valoarea implicită></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Valoarea implicită actuală va fi afișată după acceptarea schimbărilor și redeschiderea acestei ferestre de dialog.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Valoarea implicită actuală va fi afișată după acceptarea schimbărilor și redeschiderea acestei ferestre de dialog.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -10861,8 +11746,7 @@ Versiunea %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Valoarea implicită actuală va fi afișată după acceptarea schimbărilor și redeschiderea acestei ferestre de dialog.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11227,7 +12111,7 @@ Versiunea %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -12037,21 +12921,6 @@ Versiunea %1</translation>
         <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
     <message numerus="yes">
         <source>%n year(s)</source>
         <translation>
@@ -12102,7 +12971,7 @@ Versiunea %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -12543,83 +13412,217 @@ Versiunea %1</translation>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>HDD (Parallels Hard Disk)</source>
+        <source>HDD (Parallels Hard Disk)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>QED (QEMU enhanced disk)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>QCOW (QEMU Copy-On-Write)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please choose a location for new virtual hard drive file</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Nici unul</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Implicită</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>QED (QEMU enhanced disk)</source>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>QCOW (QEMU Copy-On-Write)</source>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Please choose a location for new virtual hard drive file</source>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <comment>details report</comment>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
+        <source>TCP</source>
+        <comment>PortMode</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
+        <source>(Optical Drive)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB</source>
-        <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12707,13 +13710,13 @@ folosit, daca nu este explicit specificat altfel, atunci când creați noi sau a
     </message>
     <message>
         <source>Resets the virtual machine folder path to the default value.
-The actual default path will be displayed after accepting the changes and opening this window again.</source>
+The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restează calea către directorul mașinii virtuale la valoarea implicită.
 Calea implicită actuală va fi afișată după ce acceptați schimbările și deschideți acet dialog din nou.</translation>
     </message>
     <message>
         <source>Resets the VDI folder path to the default value.
-The actual default path will be displayed after accepting the changes and opening this window again.</source>
+The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restează calea către directorul VDI la valoarea implicită.
 Calea implicită actuală va fi afișată după ce acceptați schimbările și deschideți acet dialog din nou.</translation>
     </message>
@@ -12951,11 +13954,11 @@ către cea a sistemului de operare.</qt>
         <translation type="obsolete">Afișează calea către directorul VDI implicit. Acest director este folosit, dacă nu este explicit specificat altfel, atunci când creați noi sau adăugați discuri hard virtuale existente.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restează calea către directorul mașinii virtuale la valoarea implicită. Calea implicită actuală va fi afișată după ce acceptați schimbările și deschideți acest dialog din nou.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restează calea către directorul VDI la valoarea implicită.
 Calea implicită actuală va fi afișată după ce acceptați schimbările și deschideți acest dialog din nou.</translation>
     </message>
@@ -13004,7 +14007,7 @@ toate apăsarile de taste (inclusiv cele specifice sistemului, gen Alt+Tab) sunt
         <translation type="obsolete">Deschide un dialog de selecție a fișierului bibliotecă de autentificare VRDP.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Resetează fișierul bibliotecă autentificare la valoarea implicită. Valoarea actuală implicită va fi afișată după acceptarea schimbărilor și redeschiderea acestui dialog.</translation>
     </message>
     <message>
@@ -13500,6 +14503,18 @@ Folosiți meniul contextual sau butaonele din dreapta pentru a adâuga sau șter
         <source>Modify the attributes of the selected disk image file</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13588,8 +14603,8 @@ Folosiți meniul contextual sau butaonele din dreapta pentru a adâuga sau șter
         <translation type="obsolete">Dialog înregistrare VirtualBox</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Vă rugăm completați formularul de înregistrare pentru ca noi să știm că folosiți VirtualBox și, opțional, să vă ținem la curent cu noutățile și actualizările VirtualBox. </p><p>Introduceți numele dvs complet folosind caractere Latine și adresa dvs de e-mail în câmpurile de mai jos. Notați faptul că innotek va folosi aceste informații numai pentru a obține statistici de utilizare a produsului și a vă trimite newsletter. În particul [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Vă rugăm completați formularul de înregistrare pentru ca noi să știm că folosiți VirtualBox și, opțional, să vă ținem la curent cu noutățile și actualizările VirtualBox. </p><p>Introduceți numele dvs complet folosind caractere Latine și adresa dvs de e-mail în câmpurile de mai jos. Notați faptul că innotek va folosi aceste informații numai pentru a obține statistici de utilizare a produsului și a vă trimite newsletter. În particul [...]
     </message>
     <message>
         <source>&Name</source>
@@ -13636,8 +14651,8 @@ Folosiți meniul contextual sau butaonele din dreapta pentru a adâuga sau șter
         <translation type="obsolete">Nu am putut efectua strângerea de mâini necesară conexiunii.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Vă rugăm completați formularul de înregistrare pentru ca noi să știm că folosiți VirtualBox și, opțional, să vă ținem la curent cu noutățile și actualizările VirtualBox. </p><p>Introduceți numele dvs complet folosind caractere latine și adresa dvs de e-mail în câmpurile de mai jos. Notați faptul că Sun Microsystems va folosi aceste informații numai pentru a obține statistici de utilizare a produsului și pentru a vă trimite newslet [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Vă rugăm completați formularul de înregistrare pentru ca noi să știm că folosiți VirtualBox și, opțional, să vă ținem la curent cu noutățile și actualizările VirtualBox. </p><p>Introduceți numele dvs complet folosind caractere latine și adresa dvs de e-mail în câmpurile de mai jos. Notați faptul că Sun Microsystems va folosi aceste informații numai pentru a obține statistici de utilizare a produsului și pentru a vă trimite newslet [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -14010,8 +15025,8 @@ Folosiți meniul contextual sau butaonele din dreapta pentru a adâuga sau șter
         <translation type="obsolete">Caută pe server actualizări VirtualBox</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Bun venit în VirtualBox!</h3><p>Partea din stânga a ferestrei arată lista tuturor mașinilor virtuale din computerul dvs. Lista este goală acum deoarece nu a fost creată nici o mașină virtuală până acum.<img src=:/welcome.png align=right/></p><p>Pentru a crea o mașină virtuală nouă apăsați butonul <b>Nouă</b> în bara de unelte principală localizată în partea de sus a ferestrei.</p><p>Puteț [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Bun venit în VirtualBox!</h3><p>Partea din stânga a ferestrei arată lista tuturor mașinilor virtuale din computerul dvs. Lista este goală acum deoarece nu a fost creată nici o mașină virtuală până acum.<img src=:/welcome.png align=right/></p><p>Pentru a crea o mașină virtuală nouă apăsați butonul <b>Nouă</b> în bara de unelte principală localizată în partea de sus a ferestrei.</p><p>Puteț [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -14823,212 +15838,6 @@ value.</qt></source>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Dialog informații despre sesiune</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">În&chide</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - informații despre sesiune</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Detalii</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">Timp &rulare</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Transferuri DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Transferuri PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Citire date</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Scriere date</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Date transmise</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Date primite</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Activat</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Dezactivat</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Atribute la rulare</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Rezoluție ecran</translation>
-    </message>
-    <message>
-        <source>Hardware Virtualization</source>
-        <translation type="obsolete">Virtualizare hardware</translation>
-    </message>
-    <message>
-        <source>IDE Hard Disk Statistics</source>
-        <translation type="obsolete">Statistici disc hard ID</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Statistici CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Statistici placă de rețea</translation>
-    </message>
-    <message>
-        <source>Adapter 1</source>
-        <translation type="obsolete">Placă 1</translation>
-    </message>
-    <message>
-        <source>Adapter 2</source>
-        <translation type="obsolete">Placă 2</translation>
-    </message>
-    <message>
-        <source>Adapter 3</source>
-        <translation type="obsolete">Placă 3</translation>
-    </message>
-    <message>
-        <source>Adapter 4</source>
-        <translation type="obsolete">Placă 4</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Neconectat</translation>
-    </message>
-    <message>
-        <source>Hard Disks Statistics</source>
-        <translation type="obsolete">Statistici discuri hard</translation>
-    </message>
-    <message>
-        <source>Primary Master</source>
-        <translation type="obsolete">Primar master</translation>
-    </message>
-    <message>
-        <source>Primary Slave</source>
-        <translation type="obsolete">Primar slave</translation>
-    </message>
-    <message>
-        <source>Secondary Master</source>
-        <translation type="obsolete">Secundar master</translation>
-    </message>
-    <message>
-        <source>Secondary Slave</source>
-        <translation type="obsolete">Secundar slave</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Versiunea %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Nedetectat</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Nedetectat</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation></translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Tip SO musafir</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Statistici disc fix</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Lipsă discuri fixe</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Lipsă plăci de rețea</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Activat</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Dezactivat</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Indisponibil</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Statistici stocare</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Lipsă dispozitive de stocare</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Statistici rețea</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation type="unfinished">Indisponibil</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -15685,7 +16494,7 @@ virtuale. Notați faptul că instantaneele pot ocupa puțin mai mult spațiu pe
     </message>
     <message>
         <source>Resets the snapshot folder path to the default value.
-The actual default path will be displayed after accepting the changes and opening this window again.</source>
+The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restează calea către directorul de instantanee la valoarea implicită.
 Calea implicită actuală va fi afișată după ce acceptați schimbările și deschideți acet dialog din nou.</translation>
     </message>
@@ -16155,7 +16964,7 @@ această opțiune după ce ați instalat un sistem de operare musafir Microsoft!
         <translation type="obsolete">Afișează calea unde vor fi stocate instantaneele acestei mașini virtuale. Notați faptul că instantaneele pot ocupa puțin mai mult spațiu pe disc.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Restează calea către directorul de instantanee la valoarea implicită. Calea implicită actuală va fi afișată după ce acceptați schimbările și deschideți acest dialog din nou.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts
index 473398d..d4d9aee 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_ru.ts
@@ -252,7 +252,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Режим интеграции &дисплея</translation>
+        <translation type="unfinished">Режим интеграции &дисплея</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -276,11 +276,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Выключить интеграцию &мыши</translation>
+        <translation type="obsolete">Выключить интеграцию &мыши</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Временно отключить интеграцию указателя мыши</translation>
+        <translation type="obsolete">Временно отключить интеграцию указателя мыши</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -292,11 +292,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Посл&ать Ctrl-Alt-Del</translation>
+        <translation type="obsolete">Посл&ать Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Послать последовательность клавиш Ctrl-Alt-Del в виртуальную машину</translation>
+        <translation type="obsolete">Послать последовательность клавиш Ctrl-Alt-Del в виртуальную машину</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -304,7 +304,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Послать последовательность клавиш Ctrl-Alt-Backspace в виртуальную машину</translation>
+        <translation type="obsolete">Послать последовательность клавиш Ctrl-Alt-Backspace в виртуальную машину</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -376,15 +376,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&Приводы оптических дисков</translation>
+        <translation type="obsolete">&Приводы оптических дисков</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>П&риводы гибких дисков</translation>
+        <translation type="obsolete">П&риводы гибких дисков</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&Устройства USB</translation>
+        <translation type="obsolete">&Устройства USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -431,7 +431,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>С&бор данных...</translation>
+        <translation type="obsolete">С&бор данных...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -509,15 +509,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>&Полноэкранный режим</translation>
+        <translation type="obsolete">&Полноэкранный режим</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Переключиться в полноэкранный режим</translation>
+        <translation type="obsolete">Переключиться в полноэкранный режим</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>&Режим интеграции дисплея</translation>
+        <translation type="obsolete">&Режим интеграции дисплея</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -525,7 +525,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Р&ежим масштабирования</translation>
+        <translation type="obsolete">Р&ежим масштабирования</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -605,7 +605,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Посла&ть Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">Посла&ть Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>&File</source>
@@ -900,7 +900,7 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Drag'n'Drop</translation>
+        <translation type="obsolete">Drag'n'Drop</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
@@ -963,9 +963,217 @@
         <translation>Подключить установочный образ диска c пакетом Дополнений гостевой ОС</translation>
     </message>
     <message>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Network</source>
         <translation type="unfinished">Сеть</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Показать &журнал...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Файл</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Включить</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
 </context>
 <context>
     <name>UIActonPool</name>
@@ -975,6 +1183,22 @@
     </message>
 </context>
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIApplianceEditorWidget</name>
     <message>
         <source>Virtual System %1</source>
@@ -1790,6 +2014,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1800,7 +2031,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Копирование данных ...</translation>
+        <translation type="obsolete">Копирование данных ...</translation>
     </message>
 </context>
 <context>
@@ -1872,6 +2103,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2557,7 +2815,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[Привод CD/DVD]</translation>
+        <translation type="obsolete">[Привод CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2778,72 +3036,167 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>Размер кадра: %1х%2, Скорость записи: %3кдр/сек, Битрейт: %4кб/сек</translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Контроллер</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Видеопамять</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Мониторы</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>2D Video</source>
-        <comment>details report</comment>
-        <translation type="obsolete">2D-ускорение видео</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>3D</source>
-        <comment>details report</comment>
-        <translation type="obsolete">3D-ускорение</translation>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">USB-контроллер</translation>
     </message>
     <message>
-        <source>Acceleration</source>
-        <comment>details</comment>
-        <translation type="obsolete">Ускорение</translation>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Desktop Server Port</source>
-        <comment>details</comment>
-        <translation type="obsolete">Порт сервера удалённого дисплея</translation>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Desktop Server</source>
-        <comment>details</comment>
-        <translation type="obsolete">Сервер удалённого дисплея</translation>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadGeneral</name>
     <message>
-        <source>Name</source>
-        <comment>details</comment>
-        <translation type="obsolete">Имя</translation>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadNetwork</name>
     <message>
-        <source>Bridged adapter, %1</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Сетевой мост, '%1'</translation>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Internal network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation type="obsolete">Внутренняя сеть, '%1'</translation>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Контроллер</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Видеопамять</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Мониторы</translation>
+    </message>
+    <message>
+        <source>2D Video</source>
+        <comment>details report</comment>
+        <translation type="obsolete">2D-ускорение видео</translation>
+    </message>
+    <message>
+        <source>3D</source>
+        <comment>details report</comment>
+        <translation type="obsolete">3D-ускорение</translation>
+    </message>
+    <message>
+        <source>Acceleration</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ускорение</translation>
+    </message>
+    <message>
+        <source>Remote Desktop Server Port</source>
+        <comment>details</comment>
+        <translation type="obsolete">Порт сервера удалённого дисплея</translation>
+    </message>
+    <message>
+        <source>Remote Desktop Server</source>
+        <comment>details</comment>
+        <translation type="obsolete">Сервер удалённого дисплея</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadGeneral</name>
+    <message>
+        <source>Name</source>
+        <comment>details</comment>
+        <translation type="obsolete">Имя</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadNetwork</name>
+    <message>
+        <source>Bridged adapter, %1</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Сетевой мост, '%1'</translation>
+    </message>
+    <message>
+        <source>Internal network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation type="obsolete">Внутренняя сеть, '%1'</translation>
     </message>
     <message>
         <source>Host-only adapter, '%1'</source>
@@ -3124,15 +3477,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation>&Док и меню-бар:</translation>
+        <translation type="obsolete">&Док и меню-бар:</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation>Показывать в полноэкранном режиме</translation>
+        <translation type="obsolete">Показывать в полноэкранном режиме</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>Когда стоит галочка, док и меню-бар хоста будут видны, даже если машина находится в полноэкранном режиме.</translation>
+        <translation type="obsolete">Когда стоит галочка, док и меню-бар хоста будут видны, даже если машина находится в полноэкранном режиме.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
@@ -4327,12 +4680,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Отображает активность приводов оптических дисков:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Отображает активность приводов оптических дисков:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Отображает активность приводов гибких дисков:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Отображает активность приводов гибких дисков:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4372,7 +4725,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Контроллер USB выключен</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Контроллер USB выключен</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4440,6 +4793,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation>Статус дополнительных опций:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4566,7 +4933,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Видео</translation>
+        <translation type="obsolete">&Видео</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4754,7 +5121,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>Виртуальная машина настроена на использование аппаратного ускорения, а операционной системой является Windows Vista (или более новая версия). Для достижения наилучшей производительности следует выделить под видеопамять машины как минимум <b>%1</b>.</translation>
+        <translation type="obsolete">Виртуальная машина настроена на использование аппаратного ускорения, а операционной системой является Windows Vista (или более новая версия). Для достижения наилучшей производительности следует выделить под видеопамять машины как минимум <b>%1</b>.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -4808,7 +5175,75 @@ p, li { white-space: pre-wrap; }
         <translation>Включить захват видео для дисплея %1.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Мини тулбар:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Если стоит галочка, в полноэкранных режимах работы будет использоваться мини тулбар.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">&Использовать в полноэкранных режимах</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Если стоит галочка, мини тулбар будет расположен сверху, в отличие от своей позиции по-умолчанию - снизу.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">&Расположить сверху экрана</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">3D-ускорение {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">3D-ускорение {200%?}</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4823,7 +5258,7 @@ p, li { white-space: pre-wrap; }
         <translation>Показывает путь к папке для сохранения снимков этой виртуальной машины. Имейте ввиду, что снимки могут занимать достаточно много места на жестком диске.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>О&сновные</translation>
     </message>
     <message>
@@ -4867,7 +5302,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Регулирует количество видеопамяти, доступной для виртуальной машины.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Дополнительно</translation>
     </message>
     <message>
@@ -4951,7 +5386,7 @@ p, li { white-space: pre-wrap; }
         <translation>Папка для с&нимков:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>О&писание</translation>
     </message>
     <message>
@@ -4964,7 +5399,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Если стоит галочка, то любое изменение подключенных CD/DVD-носителей или гибких дисков, произведенное во время работы машины, будет сохранено в файле настроек для восстановления конфигурации подключенных носителей при последующих запусках.</translation>
+        <translation type="obsolete">Если стоит галочка, то любое изменение подключенных CD/DVD-носителей или гибких дисков, произведенное во время работы машины, будет сохранено в файле настроек для восстановления конфигурации подключенных носителей при последующих запусках.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5016,38 +5451,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Сменные носители информации:</translation>
+        <translation type="obsolete">Сменные носители информации:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Запоминать изменения в процессе работы ВМ</translation>
+        <translation type="obsolete">&Запоминать изменения в процессе работы ВМ</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Мини тулбар:</translation>
+        <translation type="obsolete">Мини тулбар:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Если стоит галочка, в полноэкранных режимах работы будет использоваться мини тулбар.</translation>
+        <translation type="obsolete">Если стоит галочка, в полноэкранных режимах работы будет использоваться мини тулбар.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>&Использовать в полноэкранных режимах</translation>
+        <translation type="obsolete">&Использовать в полноэкранных режимах</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Если стоит галочка, мини тулбар будет расположен сверху, в отличие от своей позиции по-умолчанию - снизу.</translation>
+        <translation type="obsolete">Если стоит галочка, мини тулбар будет расположен сверху, в отличие от своей позиции по-умолчанию - снизу.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>&Расположить сверху экрана</translation>
+        <translation type="obsolete">&Расположить сверху экрана</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">для этой машины выбран 64-битный тип гостевой ОС. В связи с тем, что такие гостевые ОС требуют активации функций аппаратной виртуализации (VT-x/AMD-V), эти функции будут включены автоматически.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>&Drag'n'Drop:</translation>
     </message>
     <message>
@@ -5062,6 +5497,102 @@ p, li { white-space: pre-wrap; }
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation>Для этой машины выбран 64х-битный тип гостевой ОС. В связи с тем, что такие ОС требуют средств аппаратной виртуализации (VT-x/AMD-V), эти функции будут включены автоматически.</translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">3D-ускорение {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">3D-ускорение {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Мини тулбар:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Если стоит галочка, в полноэкранных режимах работы будет использоваться мини тулбар.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">&Использовать в полноэкранных режимах</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Если стоит галочка, мини тулбар будет расположен сверху, в отличие от своей позиции по-умолчанию - снизу.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">&Расположить сверху экрана</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5703,10 +6234,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Если стоит галочка, выбранная общая папка будет постоянной для данной машины.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5757,11 +6284,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Если стоит галочка, то канал, указанный в поле <b>Путь к порту</b>, будет создан при старте виртуальной машины. В противном случае, виртуальная машина попытается использовать существующий канал.</translation>
+        <translation type="obsolete">Если стоит галочка, то канал, указанный в поле <b>Путь к порту</b>, будет создан при старте виртуальной машины. В противном случае, виртуальная машина попытается использовать существующий канал.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Создать канал</translation>
+        <translation type="obsolete">&Создать канал</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5769,11 +6296,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Показывает путь к каналу последовательного порта на основном ПК, когда порт работает в режиме <b>Хост-канал</b>, либо имя устройства последовательного порта основного ПК, когда порт работает в режиме <b>Хост-устройство</b>.</translation>
+        <translation type="obsolete">Показывает путь к каналу последовательного порта на основном ПК, когда порт работает в режиме <b>Хост-канал</b>, либо имя устройства последовательного порта основного ПК, когда порт работает в режиме <b>Хост-устройство</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>П&уть к порту/файлу:</translation>
+        <translation type="obsolete">П&уть к порту/файлу:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5783,6 +6310,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Показывает базовый адрес ввода-вывода для этого последовательного порта. Допустимые значения -- целые числа в диапазоне от <tt>0</tt> до <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5907,11 +6450,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Добавить&nbsp;привод&nbsp;оптических&nbsp;дисков</nobr></translation>
+        <translation type="obsolete"><nobr>Добавить&nbsp;привод&nbsp;оптических&nbsp;дисков</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Добавить&nbsp;привод&nbsp;гибких&nbsp;дисков</nobr></translation>
+        <translation type="obsolete"><nobr>Добавить&nbsp;привод&nbsp;гибких&nbsp;дисков</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -5955,11 +6498,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Добавить привод оптических дисков</translation>
+        <translation type="obsolete">Добавить привод оптических дисков</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Добавить привод гибких дисков</translation>
+        <translation type="obsolete">Добавить привод гибких дисков</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6147,15 +6690,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&Привод:</translation>
+        <translation type="obsolete">&Привод:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Выбрать файл образа оптического диска или привод хоста для использования в виртуальном приводе гостевой ВМ. Виртуальная машина получит доступ к информации, содержащейся в образе или на носителе привода хоста, как если бы эта информация находилась на оптическом диске внутри виртуальной машины.</translation>
+        <translation type="obsolete">Выбрать файл образа оптического диска или привод хоста для использования в виртуальном приводе гостевой ВМ. Виртуальная машина получит доступ к информации, содержащейся в образе или на носителе привода хоста, как если бы эта информация находилась на оптическом диске внутри виртуальной машины.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Настроить привод оптических дисков</translation>
+        <translation type="obsolete">Настроить привод оптических дисков</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6179,7 +6722,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Выбрать образ оптического диска...</translation>
+        <translation type="obsolete">Выбрать образ оптического диска...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6263,15 +6806,63 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>В данный момент больше контроллеров носителей информации, чем поддерживается чипсетом %1. Пожалуйста, измените тип чипсета на странице 'Система' или уменьшите количество следующих контроллеров на странице 'Носители': %2.</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSystem</name>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">виртуальной машине назначено более <b>%1%</b> памяти компьютера (<b>%2</b>). Недостаточно памяти для операционной системы хоста. Задайте меньшее значение.</translation>
+        <source>Add USB Controller</source>
+        <translation>Добавить USB контроллер</translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished">Выбрать образ оптического диска...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSystem</name>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
+        <translation type="obsolete">виртуальной машине назначено более <b>%1%</b> памяти компьютера (<b>%2</b>). Недостаточно памяти для операционной системы хоста. Задайте меньшее значение.</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
         <translation type="obsolete">виртуальной машине назначено более <b>%1%</b> памяти компьютера (<b>%2</b>). Для операционной системы хоста может оказаться недостаточно памяти. Продолжайте на свой страх и риск.</translation>
     </message>
     <message>
@@ -6505,11 +7096,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>Данная машина настроена на использование чипсета ICH9, для работы которого требуется функция IO-APIC, которая будет включена автоматически при сохранении настроек.</translation>
+        <translation type="obsolete">Данная машина настроена на использование чипсета ICH9, для работы которого требуется функция IO-APIC, которая будет включена автоматически при сохранении настроек.</translation>
     </message>
     <message>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>Данная машина настроена на использование одного из USB устройств в качетве манипулятора курсора. Данная опция не сможет функционировать без эмуляции USB, которая будет включена автоматически при сохранении настроек.</translation>
+        <translation type="obsolete">Данная машина настроена на использование одного из USB устройств в качетве манипулятора курсора. Данная опция не сможет функционировать без эмуляции USB, которая будет включена автоматически при сохранении настроек.</translation>
     </message>
     <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
@@ -6521,16 +7112,40 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Данная машина настроена на использование более одного виртуального процессора, что в свою очередь требует активации функции IO-APIC, которая будет включена автоматически при сохранении настроек.</translation>
+        <translation type="obsolete">Данная машина настроена на использование более одного виртуального процессора, что в свою очередь требует активации функции IO-APIC, которая будет включена автоматически при сохранении настроек.</translation>
     </message>
     <message>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Данная машина настроена на использование более одного виртуального процессора, что в свою очередь требует средств аппаратной виртуализации, которые будет включены автоматически при сохранении настроек.</translation>
+        <translation type="obsolete">Данная машина настроена на использование более одного виртуального процессора, что в свою очередь требует средств аппаратной виртуализации, которые будет включены автоматически при сохранении настроек.</translation>
     </message>
     <message>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation>Вы установили слишком низкий предел загрузки ЦПУ, что может привести к очень медленной работе виртуальной машины.</translation>
     </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSB</name>
@@ -6601,7 +7216,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Включить контроллер USB &2.0 (EHCI)</translation>
+        <translation type="obsolete">Включить контроллер USB &2.0 (EHCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6665,7 +7280,31 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>Данная машина настроена на эмуляцию USB 2.0, для чего требуюется установить <b>%1</b>. Если необходимо, установите данный плагин, предварительно скачав его с сайта VirtualBox или отключите USB 2.0 для дальнейшей работы с машиной.</translation>
+        <translation type="obsolete">Данная машина настроена на эмуляцию USB 2.0, для чего требуюется установить <b>%1</b>. Если необходимо, установите данный плагин, предварительно скачав его с сайта VirtualBox или отключите USB 2.0 для дальнейшей работы с машиной.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6804,7 +7443,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Закрыть</translation>
+        <translation type="obsolete">&Закрыть</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6823,6 +7466,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Закрыть</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Переключить</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6864,7 +7530,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Не удалось создать COM-объект VirtualBox.</p><p>Работа приложения будет завершена.</p></translation>
+        <translation type="obsolete"><p>Не удалось создать COM-объект VirtualBox.</p><p>Работа приложения будет завершена.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -7322,8 +7988,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Показать диалоговое окно с информацией о программе VirtualBox</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Выпущена новая версия программы VirtualBox! Версия <b>%1</b> доступна на сайте <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Вы можете скачать эту версию, используя следующую прямую ссылку: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Выпущена новая версия программы VirtualBox! Версия <b>%1</b> доступна на сайте <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Вы можете скачать эту версию, используя следующую прямую ссылку: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7423,7 +8089,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Один или несколько виртуальных жестких дисков, образов CD/DVD или дискет сейчас недоступны. В результате, Вы не сможете запускать виртуальные машины, использующие эти носители, до тех пор, пока к ним не появится доступ.</p><p>Нажмите <b>Проверить</b>, чтобы открыть окно Менеджера виртуальных носителей и увидеть, какие именно носители недоступны, или нажмите <b>Игнорировать</b>, чтобы пропустить это сообщение.</p></tr [...]
+        <translation type="obsolete"><p>Один или несколько виртуальных жестких дисков, образов CD/DVD или дискет сейчас недоступны. В результате, Вы не сможете запускать виртуальные машины, использующие эти носители, до тех пор, пока к ним не появится доступ.</p><p>Нажмите <b>Проверить</b>, чтобы открыть окно Менеджера виртуальных носителей и увидеть, какие именно носители недоступны, или нажмите <b>Игнорировать</b>, чтобы пропустить это сообщени [...]
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -7453,8 +8119,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Перезаписать</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Во время работы виртуальной машины произошла критическая ошибка. Выполнение виртуальной машины приостановлено.</p><p>Вы можете обратиться за помощью к разделу Community на веб-сайте <a href=https://www.virtualbox.org>https://www.virtualbox.org</a>, либо к Вашему контракту на поддержку и сопровождение продукта. Пожалуйста, предоставьте содержимое журнала <tt>VBox.log</tt> и изображение <tt>VBox.png</tt>, которые [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Во время работы виртуальной машины произошла критическая ошибка. Выполнение виртуальной машины приостановлено.</p><p>Вы можете обратиться за помощью к разделу Community на веб-сайте <a href=http://www.virtualbox.org>http://www.virtualbox.org</a>, либо к Вашему контракту на поддержку и сопровождение продукта. Пожалуйста, предоставьте содержимое журнала <tt>VBox.log</tt> и изображение <tt>VBox.png</t [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7737,7 +8403,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Вы уверены, что хотите удалить виртуальный привод оптических дисков?</p><p>Без такого устройства у Вас не будет возможности подключать привод оптических дисков основного компьютера или образ оптического диска к виртуальной машине. Кроме того, Вы не сможете установить дополнения гостевой операционной системы!</p></translation>
+        <translation type="obsolete"><p>Вы уверены, что хотите удалить виртуальный привод оптических дисков?</p><p>Без такого устройства у Вас не будет возможности подключать привод оптических дисков основного компьютера или образ оптического диска к виртуальной машине. Кроме того, Вы не сможете установить дополнения гостевой операционной системы!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7840,7 +8506,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Вы собираетесь добавить новый привод оптических дисков к контроллеру <b>%1</b>.</p><p>Желаете выбрать образ оптического диска и поместить его в данный привод или оставить привод пустым?</p></translation>
+        <translation type="obsolete"><p>Вы собираетесь добавить новый привод оптических дисков к контроллеру <b>%1</b>.</p><p>Желаете выбрать образ оптического диска и поместить его в данный привод или оставить привод пустым?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7862,11 +8528,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Не удалось отсоединить привод оптических дисков <nobr><b>%1</b></nobr> от слота <i>%2</i> машины <b>%3</b>.</translation>
+        <translation type="obsolete">Не удалось отсоединить привод оптических дисков <nobr><b>%1</b></nobr> от слота <i>%2</i> машины <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Не удалось отсоединить привод гибких дисков <nobr><b>%1</b></nobr> от слота <i>%2</i> машины <b>%3</b>.</translation>
+        <translation type="obsolete">Не удалось отсоединить привод гибких дисков <nobr><b>%1</b></nobr> от слота <i>%2</i> машины <b>%3</b>.</translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
@@ -7910,11 +8576,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Не удалось подсоединить привод оптических дисков <nobr><b>%1</b></nobr> к слоту  <i>%2</i> машины <b>%3</b>.</translation>
+        <translation type="obsolete">Не удалось подсоединить привод оптических дисков <nobr><b>%1</b></nobr> к слоту  <i>%2</i> машины <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Не удалось подсоединить привод гибких дисков <nobr><b>%1</b></nobr> к слоту  <i>%2</i> машины <b>%3</b>.</translation>
+        <translation type="obsolete">Не удалось подсоединить привод гибких дисков <nobr><b>%1</b></nobr> к слоту  <i>%2</i> машины <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
@@ -8165,7 +8831,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Не удалось скопировать данные.</translation>
+        <translation type="obsolete">Не удалось скопировать данные.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -8402,11 +9068,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p><b>Образ дополнений гостевой ОС</b> был успешно загружен с сетевого адреса <nobr><a href="%1">%1</a></nobr> и сохранён локально по адресу <nobr><b>%2</b>.</nobr></p><p>Хотите ли подключить его к виртуальному приводу оптических дисков?</p></translation>
+        <translation type="obsolete"><p><b>Образ дополнений гостевой ОС</b> был успешно загружен с сетевого адреса <nobr><a href="%1">%1</a></nobr> и сохранён локально по адресу <nobr><b>%2</b>.</nobr></p><p>Хотите ли подключить его к виртуальному приводу оптических дисков?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Не удалось подключить установочный пакет <b>Образа дополнений гостевой ОС</b> к виртуальной машине <b>%1</b>, поскольку данная машина не имеет привода оптических дисков. Пожалуйста добавьте привод, используя настройки носителей информации виртуальной машины.</p></translation>
+        <translation type="obsolete"><p>Не удалось подключить установочный пакет <b>Образа дополнений гостевой ОС</b> к виртуальной машине <b>%1</b>, поскольку данная машина не имеет привода оптических дисков. Пожалуйста добавьте привод, используя настройки носителей информации виртуальной машины.</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
@@ -8459,6 +9125,102 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation><p>Виртуальный экран настроен на использование глубины цвета <b>%1&nbsp;бит</b>. Для достижения наилучшей производительности измените этот атрибут на <b>%2&nbsp;бит</b>. Обычно это можно сделать из диалога настройки<b>Параметров экрана</b> панели управления гостевой операционной системы.</p></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -8540,7 +9302,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Имя:</translation>
     </message>
     <message>
@@ -9451,14 +10213,18 @@ p, li { white-space: pre-wrap; }
         <translation>Файлы виртуальных машин (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Добро пожаловать в мир VirtualBox!</h3><p>Левая часть этого окна предназначена для отображения списка Ваших  виртуальных машин. Этот список сейчас пуст, потому что Вы не создали ни одной виртуальной машины.<img src=:/welcome.png align=right/></p><p>Чтобы создать новую машину, нажмите кнопку <b>Создать</b> на основной панели инструментов, расположенной вверху окна.</p><p>Hажмите клавишу <b>%1</b& [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Добро пожаловать в мир VirtualBox!</h3><p>Левая часть этого окна предназначена для отображения списка Ваших  виртуальных машин. Этот список сейчас пуст, потому что Вы не создали ни одной виртуальной машины.<img src=:/welcome.png align=right/></p><p>Чтобы создать новую машину, нажмите кнопку <b>Создать</b> на основной панели инструментов, расположенной вверху окна.</p><p>Hажмите клавишу &l [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Менеджер</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9491,7 +10257,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Settings</source>
-        <translation>Настройки</translation>
+        <translation type="obsolete">Настройки</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -9544,6 +10310,10 @@ p, li { white-space: pre-wrap; }
         <source>Display</source>
         <translation>Дисплей</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -9619,6 +10389,43 @@ p, li { white-space: pre-wrap; }
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">В данный момент больше контроллеров носителей информации, чем поддерживается чипсетом %1. Пожалуйста, измените тип чипсета на странице 'Система' или уменьшите количество следующих контроллеров на странице 'Носители': %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Закрыть</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -9714,8 +10521,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Итог</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Выпущена новая версия программы VirtualBox! Версия <b>%1</b> доступна на сайте <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Вы можете скачать эту версию, используя следующую прямую ссылку: </p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Выпущена новая версия программы VirtualBox! Версия <b>%1</b> доступна на сайте <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Вы можете скачать эту версию, используя следующую прямую ссылку: </p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -9783,6 +10590,14 @@ p, li { white-space: pre-wrap; }
         <source>&Restore current snapshot '%1'</source>
         <translation>Восстановить &текущий снимок '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -9796,45 +10611,195 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>Недоступна</translation>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Информация о сессии</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 с %3</nobr><br><nobr>Сессия %4</nobr></translation>
+        <source>&Details</source>
+        <translation type="obsolete">&Детали</translation>
     </message>
     <message>
-        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
-        <comment>Inaccessible VM tooltip (name, last state change)</comment>
-        <translation><nobr><b>%1</b><br></nobr><nobr>Недоступна с %2</nobr></translation>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Работа</translation>
     </message>
     <message>
-        <source>S&how</source>
-        <translation type="obsolete">&Показать</translation>
+        <source>DMA Transfers</source>
+        <translation>Запросов DMA</translation>
     </message>
     <message>
-        <source>Switch to the window of the selected virtual machine</source>
-        <translation type="obsolete">Переключиться в окно выбранной виртуальной машины</translation>
+        <source>PIO Transfers</source>
+        <translation>Запросов PIO</translation>
     </message>
     <message>
-        <source>S&tart</source>
-        <translation type="obsolete">С&тарт</translation>
+        <source>Data Read</source>
+        <translation>Данных считано</translation>
     </message>
     <message>
-        <source>Start the selected virtual machine</source>
-        <translation type="obsolete">Начать выполнение выбранной виртуальной машины</translation>
+        <source>Data Written</source>
+        <translation>Данных записано</translation>
     </message>
     <message>
-        <source>R&esume</source>
-        <translation type="obsolete">П&родолжить</translation>
+        <source>Data Transmitted</source>
+        <translation>Данных передано</translation>
     </message>
     <message>
-        <source>Resume the execution of the virtual machine</source>
-        <translation type="obsolete">Возобновить работу приостановленной виртуальной машины</translation>
-    </message>
+        <source>Data Received</source>
+        <translation>Данных принято</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Рабочие характеристики</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Разрешение экрана</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Статистика CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Статистика сетевых адаптеров</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Версия %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Не обнаружены</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Не определен</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Дополнения гостевой ОС</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Тип гостевой ОС</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Статистика жестких дисков</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Нет жестких дисков</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Нет сетевых адаптеров</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Включена</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Выключена</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Функция Nested Paging</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Не доступен</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Статистика носителей</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Нет носителей информации</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Сетевая статистика</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Не доступен</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Общий буфер обмена</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Drag'n'Drop</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>&Детали конфигурации</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>&Информация о сессии</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>Недоступна</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation><nobr>%1<br></nobr><nobr>%2 с %3</nobr><br><nobr>Сессия %4</nobr></translation>
+    </message>
+    <message>
+        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
+        <comment>Inaccessible VM tooltip (name, last state change)</comment>
+        <translation><nobr><b>%1</b><br></nobr><nobr>Недоступна с %2</nobr></translation>
+    </message>
+    <message>
+        <source>S&how</source>
+        <translation type="obsolete">&Показать</translation>
+    </message>
+    <message>
+        <source>Switch to the window of the selected virtual machine</source>
+        <translation type="obsolete">Переключиться в окно выбранной виртуальной машины</translation>
+    </message>
+    <message>
+        <source>S&tart</source>
+        <translation type="obsolete">С&тарт</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machine</source>
+        <translation type="obsolete">Начать выполнение выбранной виртуальной машины</translation>
+    </message>
+    <message>
+        <source>R&esume</source>
+        <translation type="obsolete">П&родолжить</translation>
+    </message>
+    <message>
+        <source>Resume the execution of the virtual machine</source>
+        <translation type="obsolete">Возобновить работу приостановленной виртуальной машины</translation>
+    </message>
     <message>
         <source>&Pause</source>
         <translation type="obsolete">Па&уза</translation>
@@ -9946,11 +10911,27 @@ p, li { white-space: pre-wrap; }
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Скрыть подробности</translation>
+        <translation type="obsolete">Скрыть подробности</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Показать подробности</translation>
+        <translation type="obsolete">Показать подробности</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11638,7 +12619,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -12452,17 +13433,17 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Подключение данного жёсткого диска будет осуществлено косвенно, используя новый разностный диск.</translation>
+        <translation type="obsolete">Подключение данного жёсткого диска будет осуществлено косвенно, используя новый разностный диск.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Некоторые устройства данной цепочки жёстких дисков недоступны. Для проверки вы можете использовать менеджер виртуальных носителей в режиме <b>отображения разностных жёстких дисков</b>.</translation>
+        <translation type="obsolete">Некоторые устройства данной цепочки жёстких дисков недоступны. Для проверки вы можете использовать менеджер виртуальных носителей в режиме <b>отображения разностных жёстких дисков</b>.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Этот базовый жёсткий диск косвенно подсоединен с помощью следующего разностного диска:</translation>
+        <translation type="obsolete">Этот базовый жёсткий диск косвенно подсоединен с помощью следующего разностного диска:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -12514,7 +13495,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -13076,12 +14057,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Enabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Включено</translation>
+        <translation type="obsolete">Включено</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details report (Unrestricted Execution)</comment>
-        <translation>Выключено</translation>
+        <translation type="obsolete">Выключено</translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
@@ -13144,7 +14125,151 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>USB порт %1</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">По умолчанию</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -13452,6 +14577,18 @@ p, li { white-space: pre-wrap; }
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Создать новый виртуальный жесткий диск</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13572,8 +14709,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Не удалось установить соединение.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Пожалуйста, заполните предлагаемую регистрационную форму. Тем самым, Вы известите нас о том, что пользуетесь нашим продуктом, а также получите возможность быть в курсе новостей и обновлений VirtualBox (по желанию).</p><p>Впишите Ваше полное имя, используя для этого символы латиницы, а также адрес электронной почты в расположенные ниже поля. Пожалуйста, примите к сведению, что эта информация будет использована только для сбора стат [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Пожалуйста, заполните предлагаемую регистрационную форму. Тем самым, Вы известите нас о том, что пользуетесь нашим продуктом, а также получите возможность быть в курсе новостей и обновлений VirtualBox (по желанию).</p><p>Впишите Ваше полное имя, используя для этого символы латиницы, а также адрес электронной почты в расположенные ниже поля. Пожалуйста, примите к сведению, что эта информация будет использована только для сбора стат [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -13592,8 +14729,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Укажите Страну/Территорию</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Пожалуйста, заполните предлагаемую регистрационную форму. Тем самым, Вы известите нас о том, что пользуетесь нашим продуктом, а также получите возможность быть в курсе новостей и обновлений VirtualBox (по желанию).</p><p>Впишите Ваше полное имя, используя для этого символы латиницы, а также адрес электронной почты в расположенные ниже поля. Пожалуйста, примите к сведению, что эта информация будет использована только для сбора стат [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Пожалуйста, заполните предлагаемую регистрационную форму. Тем самым, Вы известите нас о том, что пользуетесь нашим продуктом, а также получите возможность быть в курсе новостей и обновлений VirtualBox (по желанию).</p><p>Впишите Ваше полное имя, используя для этого символы латиницы, а также адрес электронной почты в расположенные ниже поля. Пожалуйста, примите к сведению, что эта информация будет использована только для сбора стат [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -13798,8 +14935,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Приостановить работу виртуальной машины</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Добро пожаловать в мир VirtualBox!</h3><p>Левая часть этого окна предназначена для отображения списка Ваших  виртуальных машин. Этот список сейчас пуст, потому что Вы не создали ни одной виртуальной машины.<img src=:/welcome.png align=right/></p><p>Чтобы создать новую машину, нажмите кнопку <b>Создать</b> на основной панели инструментов, расположенной вверху окна.</p><p>Hажмите клавишу &l [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Добро пожаловать в мир VirtualBox!</h3><p>Левая часть этого окна предназначена для отображения списка Ваших  виртуальных машин. Этот список сейчас пуст, потому что Вы не создали ни одной виртуальной машины.<img src=:/welcome.png align=right/></p><p>Чтобы создать новую машину, нажмите кнопку <b>Создать</b> на основной панели инструментов, расположенной вверху окна.</p><p>Hажмите клавишу &l [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -14265,152 +15402,6 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Информация о сессии</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Детали</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Работа</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Запросов DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Запросов PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Данных считано</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Данных записано</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Данных передано</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Данных принято</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Рабочие характеристики</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Разрешение экрана</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Статистика CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Статистика сетевых адаптеров</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Версия %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Не обнаружены</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Не определен</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Дополнения гостевой ОС</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Тип гостевой ОС</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Статистика жестких дисков</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Нет жестких дисков</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Нет сетевых адаптеров</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Включена</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Выключена</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Функция Nested Paging</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation></translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Не доступен</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Статистика носителей</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Нет носителей информации</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Сетевая статистика</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Не доступен</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Общий буфер обмена</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Drag'n'Drop</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>&Детали конфигурации</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>&Информация о сессии</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sk.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sk.ts
index de6eb9c..6fa0dfe 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sk.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sk.ts
@@ -292,7 +292,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Režim &plynulého prechodu</translation>
+        <translation type="unfinished">Režim &plynulého prechodu</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -316,11 +316,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Vypnúť Integráciu &myši</translation>
+        <translation type="obsolete">Vypnúť Integráciu &myši</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Dočasne vypne hostiteľskú integráciu ukazovateľa myši</translation>
+        <translation type="obsolete">Dočasne vypne hostiteľskú integráciu ukazovateľa myši</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -332,11 +332,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Poslať Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&Poslať Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Pošle virtuálnemu stroju klávesovú sekvenciu Ctrl-Alt-Del</translation>
+        <translation type="obsolete">Pošle virtuálnemu stroju klávesovú sekvenciu Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -344,7 +344,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Pošle virtuálnemu stroju klávesovú sekvenciu Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">Pošle virtuálnemu stroju klávesovú sekvenciu Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -359,8 +359,8 @@
         <translation type="obsolete">I&nformačné okno o relácii</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Zobrazí informačné okno o relácii</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Zobrazí informačné okno o relácii</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -412,15 +412,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>Zariadenia &CD/DVD</translation>
+        <translation type="obsolete">Zariadenia &CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Disketové zariadenia</translation>
+        <translation type="obsolete">&Disketové zariadenia</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB zariadenia</translation>
+        <translation type="obsolete">&USB zariadenia</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -447,12 +447,12 @@
         <translation type="obsolete">Zapne alebo vypne spojenia Vzdialenej plochy (RDP) k tomuto stroju</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">&Nainštalovať Hosťovské doplnky...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Nainštalovať Hosťovské doplnky...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Pripojí inštalačný obraz Hosťovských doplnkov</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Pripojí inštalačný obraz Hosťovských doplnkov</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -471,7 +471,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">&Logovanie...</translation>
+        <translation type="obsolete">&Logovanie...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -500,15 +500,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>P&repnúť na celú obrazovku</translation>
+        <translation type="obsolete">P&repnúť na celú obrazovku</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Prepnúť medzi normálnym zobrazením a celou obrazovkou</translation>
+        <translation type="obsolete">Prepnúť medzi normálnym zobrazením a celou obrazovkou</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Prepnúť do &bezošvého režimu</translation>
+        <translation type="obsolete">Prepnúť do &bezošvého režimu</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -516,7 +516,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Prepnúť do rež&imu škálovania</translation>
+        <translation type="obsolete">Prepnúť do rež&imu škálovania</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -591,10 +591,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished">&Súbor</translation>
@@ -866,10 +862,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -914,23 +906,249 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">&Nainštalovať Hosťovské doplnky...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Pripojí inštalačný obraz Hosťovských doplnkov</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished">&Klávesnica</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Sieť</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Zobraziť &záznam...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Súbor</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Zapnúť</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1613,14 +1831,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1735,6 +1953,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2341,11 +2586,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">Nepripojená</translation>
@@ -2554,37 +2794,132 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Radič</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>None</source>
-        <comment>details</comment>
-        <translation type="obsolete">Žiadne</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Videopamäť</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Obrazovky</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>2D Video</source>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">USB radič</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Radič</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Žiadne</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Videopamäť</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Obrazovky</translation>
+    </message>
+    <message>
+        <source>2D Video</source>
         <comment>details report</comment>
         <translation type="obsolete">2D video</translation>
     </message>
@@ -2925,18 +3260,6 @@
         <translation type="obsolete">Vypnúť š&etrič obrazovky hostiteľa</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4101,12 +4424,12 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Zobrazuje aktivitu CD/DVD zariadení:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Zobrazuje aktivitu CD/DVD zariadení:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Zobrazuje aktivitu zariadení disketovej mechaniky:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Zobrazuje aktivitu zariadení disketovej mechaniky:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4146,7 +4469,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB ovládač je vypnutý</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB ovládač je vypnutý</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4177,7 +4500,7 @@
     </message>
     <message>
         <source>Indicates whether the keyboard is captured by the guest OS (<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>).</source>
-        <translation>Indikuje, či je klávesnica odchytávaná hosťovaným OS (<img src=:/hostkey_captured_16px.png/>) alebo nie (<img src=:/hostkey_16px.png/>).</translation>
+        <translation>Indikuje, či je klávesnica odchytávaná hosťovaným OS (<img src=:/hostkey_captured_16px.png/>) alebo nie (<img src=:/hostkey_16px.png/>).</translation>
     </message>
     <message>
         <source><hr>The Remote Desktop Server is listening on port %1</source>
@@ -4200,6 +4523,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4318,7 +4655,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Video</translation>
+        <translation type="obsolete">&Video</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4493,10 +4830,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4548,7 +4881,71 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Mini nástrojová lišta:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Ak je zaškrtnuté, zobrazí v režime na celú obrazovku a v režime plynulého prechodu malú lištu nástrojov.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Zobraziť v rež&ime celej obrazovky/plynulého prechodu</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Z&obraziť na vrchu obrazovky</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4563,7 +4960,7 @@
         <translation>Určuje cestu, kam budú ukladané snímky tohto virtuálneho stroja. Uvedomte si, že snímky môžu zaberať veľkú časť miesta na disku.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Základné</translation>
     </message>
     <message>
@@ -4607,7 +5004,7 @@
         <translation type="obsolete">Ovláda množstvo videopamäte poskytnutej virtuálnemu stroju.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Rozšírené</translation>
     </message>
     <message>
@@ -4659,7 +5056,7 @@
         <translation>Priečinok pre s&nímky:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Popis</translation>
     </message>
     <message>
@@ -4667,39 +5064,31 @@
         <translation>Zobrazí popis virtuálneho stroja. Pole s popisom je užitočné pre uloženie komentára o detailoch konfigurácie inštalovaného hosťovského OS.</translation>
     </message>
     <message>
-        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Removable Media:</source>
-        <translation>Vymeniteľné médiá:</translation>
+        <translation type="obsolete">Vymeniteľné médiá:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>P&amatať si nastavenia urobené počas behu</translation>
+        <translation type="obsolete">P&amatať si nastavenia urobené počas behu</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Mini nástrojová lišta:</translation>
+        <translation type="obsolete">Mini nástrojová lišta:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Ak je zaškrtnuté, zobrazí v režime na celú obrazovku a v režime plynulého prechodu malú lištu nástrojov.</translation>
+        <translation type="obsolete">Ak je zaškrtnuté, zobrazí v režime na celú obrazovku a v režime plynulého prechodu malú lištu nástrojov.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Zobraziť v rež&ime celej obrazovky/plynulého prechodu</translation>
-    </message>
-    <message>
-        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Zobraziť v rež&ime celej obrazovky/plynulého prechodu</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Z&obraziť na vrchu obrazovky</translation>
+        <translation type="obsolete">Z&obraziť na vrchu obrazovky</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -4714,6 +5103,102 @@
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Mini nástrojová lišta:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Ak je zaškrtnuté, zobrazí v režime na celú obrazovku a v režime plynulého prechodu malú lištu nástrojov.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Zobraziť v rež&ime celej obrazovky/plynulého prechodu</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Z&obraziť na vrchu obrazovky</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5178,10 +5663,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Keď je zaškrtnuté, zdieľaný priečinok bude permanentným.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5224,26 +5705,34 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Ak je zaškrtnuté, rúra uvedená v poli <b>Cesta k portu</b> bude vytvorená virtuálnym strojom pri spustení. Inak virtuálny stroj bude predpokladať, že rúra existuje a pokúsi sa ju použiť.</translation>
+        <translation type="obsolete">Ak je zaškrtnuté, rúra uvedená v poli <b>Cesta k portu</b> bude vytvorená virtuálnym strojom pri spustení. Inak virtuálny stroj bude predpokladať, že rúra existuje a pokúsi sa ju použiť.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Vytvoriť rúru (pipe)</translation>
+        <translation type="obsolete">&Vytvoriť rúru (pipe)</translation>
     </message>
     <message>
-        <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
+        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Port/File &Path:</source>
+        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5309,16 +5798,8 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Add Controller</source>
-        <translation>Pridať radič</translation>
+        <source>Add Controller</source>
+        <translation>Pridať radič</translation>
     </message>
     <message>
         <source>Add IDE Controller</source>
@@ -5350,11 +5831,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Pridať zariadenie CD/DVD</translation>
+        <translation type="obsolete">Pridať zariadenie CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Pridať zariadenie disketovej mechaniky</translation>
+        <translation type="obsolete">Pridať zariadenie disketovej mechaniky</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5513,18 +5994,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD &Drive:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Floppy &Drive:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5545,10 +6014,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Remove disk from virtual drive</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5618,6 +6083,54 @@
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5798,31 +6311,39 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5894,10 +6415,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>USB Device &Filters</source>
         <translation type="unfinished">&Filtre zariadení USB</translation>
     </message>
@@ -5950,7 +6467,27 @@
         <translation type="unfinished"><nobr>Stav: %1</nobr></translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6082,7 +6619,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation type="unfinished">&Zavrieť</translation>
+        <translation type="obsolete">&Zavrieť</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6101,6 +6642,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Zatvoriť</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Prepnúť</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6142,7 +6706,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Nepodarilo sa vytvoriť VirtualBox COM objekt.</p><p>Aplikácia sa teraz ukončí.</p></translation>
+        <translation type="obsolete"><p>Nepodarilo sa vytvoriť VirtualBox COM objekt.</p><p>Aplikácia sa teraz ukončí.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -6465,9 +7029,9 @@
         <translation type="obsolete">Stiahnuť</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Pripojiť</translation>
+        <translation type="obsolete">Pripojiť</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6607,10 +7171,6 @@
         <translation type="obsolete">Zobrazí dialógové okno s informáciami o produkte</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Release</source>
         <comment>detach medium</comment>
         <translation>Uvoľniť</translation>
@@ -6651,19 +7211,11 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>E&xit</source>
         <comment>warnAboutAutoConvertedSettings message box</comment>
         <translation type="obsolete">&Ukončiť</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>hard disk</source>
         <comment>failed to close ...</comment>
         <translation type="obsolete">pevný disk</translation>
@@ -6838,10 +7390,6 @@
         <translation type="obsolete">zariadenie disketovej mechaniky</translation>
     </message>
     <message>
-        <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Remove</source>
         <comment>medium</comment>
         <translation>&Odstrániť</translation>
@@ -6891,10 +7439,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -6903,14 +7447,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -6939,14 +7475,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7152,10 +7680,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7385,14 +7909,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -7425,26 +7941,122 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Pripojiť</translation>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>Insert</source>
+        <comment>additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetAdditions</name>
@@ -7513,7 +8125,7 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished">&Názov:</translation>
     </message>
     <message>
@@ -8131,7 +8743,7 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
     </message>
     <message>
         <source><p>If the above is correct press the <b>Finish</b> button. Once you press it, a new virtual machine will be created. </p><p>Note that you can alter these and all other setting of the created virtual machine at any time using the <b>Settings</b> dialog accessible through the menu of the main window.</p></source>
-        <translation type="obsolete"><p>Ak je vyššie uvedené v poriadku, stlačte tlačidlo <b>Dokončiť</b>. Potom sa začne vytvárať virtuálny stroj.</p><p>Poznámka: Všetky tieto i ďalšie nastavenia pre virtuálny stroj môžete kedykoľvek zmeniť v dialógovom okne <b>Nastavenia</b>, ktoré vyvoláte z ponuky v hlavnom menu.</p></translation>
+        <translation type="obsolete"><p>Ak je vyššie uvedené v poriadku, stlačte tlačidlo <b>Dokončiť</b>. Potom sa začne vytvárať virtuálny stroj.</p><p>Poznámka: Všetky tieto i ďalšie nastavenia pre virtuálny stroj môžete kedykoľvek zmeniť v dialógovom okne <b>Nastavenia</b>, ktoré vyvoláte z ponuky v hlavnom menu.</p></translation>
     </message>
     <message>
         <source>&Finish</source>
@@ -8305,7 +8917,7 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
     </message>
     <message>
         <source><p>If the above is correct press the <b>%1</b> button. Once you press it, a new virtual machine will be created. </p><p>Note that you can alter these and all other setting of the created virtual machine at any time using the <b>Settings</b> dialog accessible through the menu of the main window.</p></source>
-        <translation type="obsolete"><p>Ak sú vyššie uvedené údaje v poriadku, stlačte tlačidlo <b>%1</b> Potom sa začne vytvárať virtuálny stroj.</p><p>Poznámka: Všetky tieto i dodatočené nastavenia pre virtuálny stroj môžete kedykoľvek zmeniť v dialógovom okne <b>Nastavenia</b>, ktoré vyvoláte z ponuky v hlavnom menu.</p></translation>
+        <translation type="obsolete"><p>Ak sú vyššie uvedené údaje v poriadku, stlačte tlačidlo <b>%1</b> Potom sa začne vytvárať virtuálny stroj.</p><p>Poznámka: Všetky tieto i dodatočené nastavenia pre virtuálny stroj môžete kedykoľvek zmeniť v dialógovom okne <b>Nastavenia</b>, ktoré vyvoláte z ponuky v hlavnom menu.</p></translation>
     </message>
 </context>
 <context>
@@ -8390,12 +9002,12 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <source>Manager</source>
+        <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Manager</source>
-        <comment>Note: main window title which is pretended by the product name.</comment>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -8430,7 +9042,7 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
     </message>
     <message>
         <source>Settings</source>
-        <translation>Nastavenia</translation>
+        <translation type="obsolete">Nastavenia</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -8483,6 +9095,10 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
         <source>Display</source>
         <translation type="unfinished">Displej</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8538,16 +9154,53 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
         <source>you have 2D Video Acceleration enabled. As 2D Video Acceleration is supported for Windows guests only, this feature will be disabled.</source>
         <translation type="obsolete">povolili ste 2D akceleráciu videa. Pretože 2D akcelerácia videa je podporovaná iba pre hosťovské systémy s Windows, táto vlastnosť bude vypnutá.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Nastavenia</translation>
+    </message>
 </context>
 <context>
-    <name>UITextEditor</name>
+    <name>UISettingsSerializerProgress</name>
     <message>
-        <source>Edit text</source>
-        <translation>Upraviť text</translation>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Replace...</source>
-        <translation>&Nahradiť...</translation>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Zatvoriť</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UITextEditor</name>
+    <message>
+        <source>Edit text</source>
+        <translation>Upraviť text</translation>
+    </message>
+    <message>
+        <source>&Replace...</source>
+        <translation>&Nahradiť...</translation>
     </message>
     <message>
         <source>Replaces the current text with the content of a file.</source>
@@ -8694,6 +9347,14 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
         <source>&Restore current snapshot '%1'</source>
         <translation>&Obnoviť aktuálnu snímku '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -8707,6 +9368,169 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Informačné okno o relácii</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">&Zatvoriť</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Informácie o relácii</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Podrobnosti</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>Prenosy DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Prenosy PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Prečítané dáta</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Zapísané dáta</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Prenesené dáta</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Prijaté dáta</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Zapnutá</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Rozlíšenie obrazovky</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Štatistika CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Štatistika sieťových adaptérov</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Nepripojená</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Verzia %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Nedetegované</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Nedetegovaný</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Hosťovské doplnky</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Typ hostiteľského OS</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Štatistika pevných diskov</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Žiadne pevné disky</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Žiadne sieťové adaptéry</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Zapnuté</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Vypnuté</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Priamy prístup k hardware</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Nedostupný</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Štatistiky o úložiskách</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Bez zariadení pre úložiská</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Sieťové štatistiky</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Priamy prístup k hardware</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation type="unfinished">Nedostupný</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -8856,11 +9680,19 @@ preskočiť a pripojiť pevné disky neskôr pomocou dialógu Nastavenia virtuá
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -9817,11 +10649,11 @@ verzia %1</translation>
         <translation type="obsolete">Otvorí dialóg operácií so zdieľanými priečinkami</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Nainštalovať Hosťovské doplnky...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Pripojí inštalačný obraz Hosťovských doplnkov</translation>
     </message>
     <message>
@@ -10100,7 +10932,7 @@ verzia %1</translation>
         <translation type="obsolete">I&nformačné okno o relácii</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Zobrazí informačné okno o relácii</translation>
     </message>
     <message>
@@ -10120,7 +10952,7 @@ verzia %1</translation>
     </message>
     <message>
         <source>Indicates whether the keyboard is captured by the guest OS (<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>).</source>
-        <translation type="obsolete">Indikuje, či je klávesnica odchytávaná hosťovaným OS (<img src=:/hostkey_captured_16px.png/>) alebo nie (<img src=:/hostkey_16px.png/>).</translation>
+        <translation type="obsolete">Indikuje, či je klávesnica odchytávaná hosťovaným OS (<img src=:/hostkey_captured_16px.png/>) alebo nie (<img src=:/hostkey_16px.png/>).</translation>
     </message>
     <message>
         <source>Indicates whether the Remote Display (VRDP Server) is enabled (<img src=:/vrdp_16px.png/>) or not (<img src=:/vrdp_disabled_16px.png/>).</source>
@@ -10515,8 +11347,8 @@ verzia %1</translation>
         <translation><nastaviť na východzie></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Aktuálna východzia cesta bude zobrazená po akceptovaní zmien a novom otvorení tohto dialógového okna.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Aktuálna východzia cesta bude zobrazená po akceptovaní zmien a novom otvorení tohto dialógového okna.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -10564,8 +11396,7 @@ verzia %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Aktuálna východzia cesta bude zobrazená po akceptovaní zmien a novom otvorení tohto dialógového okna.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10917,7 +11748,7 @@ verzia %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -11778,21 +12609,6 @@ verzia %1</translation>
         <source>You can create disk image files using the virtual media manager.</source>
         <translation type="obsolete">Obrazy médií môžete vytvoriť pomocou Správcu virtuálnych médií.</translation>
     </message>
-    <message>
-        <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
     <message numerus="yes">
         <source>%n year(s)</source>
         <translation>
@@ -11843,7 +12659,7 @@ verzia %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -12365,16 +13181,6 @@ verzia %1</translation>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -12425,7 +13231,151 @@ verzia %1</translation>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Žiadne</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Aktívne</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Aktívne</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Aktívne</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12703,11 +13653,11 @@ je zobrazený <b>tučným</b> písmom. Voľbou <i>Štandardný
         <translation type="obsolete">Zobrazí cestu k štandardnému priečinku VDI. Priečinok sa použije, ak nie je výslovne uvedené inak, pri pridávaní existujúcich a tvorbe nových virtuálnych pevných diskov.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Obnoví štandardnú cestu k virtuálnym strojom na štandardnú hodnotu. Skutočná štandardná cesta sa zobrazí po prijatí zmien a opätovnom otvorení tohto dialógu.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Obnoví štandardnú cestu k VDI na štandardnú hodnotu. Skutočná štandardná cesta sa zobrazí po prijatí zmien a opätovnom otvorení tohto dialógu.</translation>
     </message>
     <message>
@@ -12751,7 +13701,7 @@ je zobrazený <b>tučným</b> písmom. Voľbou <i>Štandardný
         <translation type="obsolete">Otvorí dialóg pre výber autentifikačnej knižnice VRDP.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Obnoví súbor autentifikačnej knižnice na štandardnú hodnotu. Skutočná štandardný súbor autentifikačnej knižnice sa zobrazí po prijatí zmien a opätovnom otvorení tohto dialógu.</translation>
     </message>
     <message>
@@ -13152,6 +14102,18 @@ je zobrazený <b>tučným</b> písmom. Voľbou <i>Štandardný
         <source>C&lose</source>
         <translation type="obsolete">&Zavrieť</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13741,7 +14703,7 @@ je zobrazený <b>tučným</b> písmom. Voľbou <i>Štandardný
     </message>
     <message>
         <source>Edit the selected shared folder (Ctrl+Space)</source>
-        <translation type="obsolete">Upraví vybraný zdieľaný priečinok (Ctrl + Medzera)</translation>
+        <translation type="obsolete">Upraví vybraný zdieľaný priečinok (Ctrl + Medzera)</translation>
     </message>
     <message>
         <source>Full</source>
@@ -14145,7 +15107,7 @@ je zobrazený <b>tučným</b> písmom. Voľbou <i>Štandardný
     </message>
     <message>
         <source>&Product ID</source>
-        <translation type="obsolete">&ID produktu</translation>
+        <translation type="obsolete">&ID produktu</translation>
     </message>
     <message>
         <source>&Revision</source>
@@ -14211,169 +15173,6 @@ je zobrazený <b>tučným</b> písmom. Voľbou <i>Štandardný
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Informačné okno o relácii</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">&Zatvoriť</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Informácie o relácii</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Podrobnosti</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Prenosy DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Prenosy PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Prečítané dáta</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Zapísané dáta</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Prenesené dáta</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Prijaté dáta</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Zapnutá</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Rozlíšenie obrazovky</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Štatistika CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Štatistika sieťových adaptérov</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Nepripojená</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Verzia %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Nedetegované</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Nedetegovaný</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Hosťovské doplnky</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Typ hostiteľského OS</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Štatistika pevných diskov</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Žiadne pevné disky</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Žiadne sieťové adaptéry</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Zapnuté</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Vypnuté</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Priamy prístup k hardware</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Nedostupný</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Štatistiky o úložiskách</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Bez zariadení pre úložiská</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Sieťové štatistiky</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Priamy prístup k hardware</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation type="unfinished">Nedostupný</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -15090,7 +15889,7 @@ je zobrazený <b>tučným</b> písmom. Voľbou <i>Štandardný
         <translation type="obsolete">Určuje cestu, kam budú ukladané snímky virtuálneho stroja. Všimnite si, že snímky môžu zaberať veľkú časť diskového priestoru.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Obnoví štandardnú cestu pre snímky. Vlastná štandardná cesta bude zobrazená po prijatí zmien a opätovnom otvorení tohto dialógového okna.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sr.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sr.ts
index efc2f84..3441f74 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sr.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sr.ts
@@ -248,7 +248,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">&Интегрисан биро</translation>
+        <translation type="unfinished">&Интегрисан биро</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -272,11 +272,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Онемогучи интегрисање ми&ша</translation>
+        <translation type="obsolete">Онемогучи интегрисање ми&ша</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Привремено онемогучи хост интеграција миша</translation>
+        <translation type="obsolete">Привремено онемогучи хост интеграција миша</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -288,11 +288,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Пошаљи Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&Пошаљи Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Пошаљи Ctrl-Alt-Del виртуелној машини</translation>
+        <translation type="obsolete">Пошаљи Ctrl-Alt-Del виртуелној машини</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -300,7 +300,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Пошаљи Ctrl-Alt-Backspace виртуелној машини</translation>
+        <translation type="obsolete">Пошаљи Ctrl-Alt-Backspace виртуелној машини</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -315,8 +315,8 @@
         <translation type="obsolete">Информација сесије</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Покажи информације сесије</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Покажи информације сесије</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -364,15 +364,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>CD/DVD Уређаји</translation>
+        <translation type="obsolete">CD/DVD Уређаји</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Флопи уређаји</translation>
+        <translation type="obsolete">Флопи уређаји</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>USB уре&ђаји</translation>
+        <translation type="obsolete">USB уре&ђаји</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -399,12 +399,12 @@
         <translation type="obsolete">Омогучи или не привезивање удаљене површине (RDP) на ову машину</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">Инсталирај 'додатци госта'...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">Инсталирај 'додатци госта'...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Монтирај слику 'додатака госта'</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Монтирај слику 'додатака госта'</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -423,7 +423,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">Журнал...</translation>
+        <translation type="obsolete">Журнал...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -452,15 +452,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Пређи на Пун Екран</translation>
+        <translation type="obsolete">Пређи на Пун Екран</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Пребаци нормални/пун екран</translation>
+        <translation type="obsolete">Пребаци нормални/пун екран</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Пређи интегрисан мод</translation>
+        <translation type="obsolete">Пређи интегрисан мод</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -468,7 +468,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Пређи на зумиран мод</translation>
+        <translation type="obsolete">Пређи на зумиран мод</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -543,10 +543,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished"></translation>
@@ -838,10 +834,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -886,18 +878,249 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Монтирај слику 'додатака госта'</translation>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Webcams</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>&Insert Guest Additions CD image...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Network</source>
         <translation type="unfinished">Мрежа</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">По&кажи журнал...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Омогући</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1670,14 +1893,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -1752,6 +1975,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2430,11 +2680,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Not attached</source>
         <comment>details (storage)</comment>
         <translation type="obsolete">Није прикачено</translation>
@@ -2653,34 +2898,129 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadAudio</name>
     <message>
-        <source>Controller</source>
-        <comment>details</comment>
-        <translation type="obsolete">Контролер</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDescription</name>
     <message>
-        <source>None</source>
-        <comment>details</comment>
-        <translation type="obsolete">Ништа</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGDetailsUpdateThreadDisplay</name>
     <message>
-        <source>Video Memory</source>
-        <comment>details</comment>
-        <translation type="obsolete">Видео меморија</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Screens</source>
-        <comment>details</comment>
-        <translation type="obsolete">Екрани</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">USB контролер</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadAudio</name>
+    <message>
+        <source>Controller</source>
+        <comment>details</comment>
+        <translation type="obsolete">Контролер</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDescription</name>
+    <message>
+        <source>None</source>
+        <comment>details</comment>
+        <translation type="obsolete">Ништа</translation>
+    </message>
+</context>
+<context>
+    <name>UIGDetailsUpdateThreadDisplay</name>
+    <message>
+        <source>Video Memory</source>
+        <comment>details</comment>
+        <translation type="obsolete">Видео меморија</translation>
+    </message>
+    <message>
+        <source>Screens</source>
+        <comment>details</comment>
+        <translation type="obsolete">Екрани</translation>
     </message>
     <message>
         <source>2D Video</source>
@@ -3035,18 +3375,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Угаси скрин сејвер хоста</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4148,12 +4476,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Показује активност CD/DVD уређаја:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Показује активност CD/DVD уређаја:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Показује активност флопи уређаја:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Показује активност флопи уређаја:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4193,7 +4521,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB контролер је угашен</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB контролер је угашен</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4261,6 +4589,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4379,7 +4721,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>Видео</translation>
+        <translation type="obsolete">Видео</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4558,10 +4900,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4613,7 +4951,75 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Мини алатна-трака:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Ако унето, показати алатну траку у пуном екрану или интегрисаном моду.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Покажи у пуном екрану/интегрисано</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Ако унето, покажи малу алатну траку на врх екрана, уместо на дну.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Покажи на врх екрана</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4628,7 +5034,7 @@ p, li { white-space: pre-wrap; }
         <translation>Показује путању где се налазе снимци машине. Снимци могу користити доста простора.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Класично</translation>
     </message>
     <message>
@@ -4672,7 +5078,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Контолише дату видео меморију машини.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Напредно</translation>
     </message>
     <message>
@@ -4760,7 +5166,7 @@ p, li { white-space: pre-wrap; }
         <translation>Фасцикла снимка:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Опис</translation>
     </message>
     <message>
@@ -4769,7 +5175,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Ако одабрано, промене монтираних CD/DVD или Флопи медија док машина ради ће бити сачувани да би се заштитили задњи подешавањи.</translation>
+        <translation type="obsolete">Ако одабрано, промене монтираних CD/DVD или Флопи медија док машина ради ће бити сачувани да би се заштитили задњи подешавањи.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -4821,38 +5227,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Преносни медиј:</translation>
+        <translation type="obsolete">Преносни медиј:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Упамти промене рада</translation>
+        <translation type="obsolete">Упамти промене рада</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Мини алатна-трака:</translation>
+        <translation type="obsolete">Мини алатна-трака:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Ако унето, показати алатну траку у пуном екрану или интегрисаном моду.</translation>
+        <translation type="obsolete">Ако унето, показати алатну траку у пуном екрану или интегрисаном моду.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Покажи у пуном екрану/интегрисано</translation>
+        <translation type="obsolete">Покажи у пуном екрану/интегрисано</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Ако унето, покажи малу алатну траку на врх екрана, уместо на дну.</translation>
+        <translation type="obsolete">Ако унето, покажи малу алатну траку на врх екрана, уместо на дну.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Покажи на врх екрана</translation>
+        <translation type="obsolete">Покажи на врх екрана</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">одабрали сте 64-битни ОС. Пошто је госту потребно хардверска виртуализација (VT-x/AMD-V), ова способност ће бити омоигучена.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -4867,6 +5273,102 @@ p, li { white-space: pre-wrap; }
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Мини алатна-трака:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Ако унето, показати алатну траку у пуном екрану или интегрисаном моду.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Покажи у пуном екрану/интегрисано</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Ако унето, покажи малу алатну траку на врх екрана, уместо на дну.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Покажи на врх екрана</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5402,10 +5904,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Ако унето, дељена фасцикла ће бити трајна.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5456,11 +5954,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Ако одабрано, туба специфирана у <b>Путања порта</b> ће бити креирана на покретање машине. Инаће, машина ће мислити да тзба постоји и пробаће да је користи.</translation>
+        <translation type="obsolete">Ако одабрано, туба специфирана у <b>Путања порта</b> ће бити креирана на покретање машине. Инаће, машина ће мислити да тзба постоји и пробаће да је користи.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Креирај тубу</translation>
+        <translation type="obsolete">&Креирај тубу</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5468,11 +5966,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Показује путању са хоста за серијске интерфејси када интерфејс ради у моду <b>Хост туба</b>, или име уређаја када порт ради као <b>Хост уређај</b>.</translation>
+        <translation type="obsolete">Показује путању са хоста за серијске интерфејси када интерфејс ради у моду <b>Хост туба</b>, или име уређаја када порт ради као <b>Хост уређај</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Путања порта/датотеке:</translation>
+        <translation type="obsolete">Путања порта/датотеке:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5482,6 +5980,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Показује базну I/O адресу серијалног порта. Вредности су бројеви између <tt>0</tt> и <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5606,11 +6120,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Додај&nbsp;CD/DVD&nbsp;уређај</nobr></translation>
+        <translation type="obsolete"><nobr>Додај&nbsp;CD/DVD&nbsp;уређај</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Додај&nbsp;флопи&nbsp;уређај</nobr></translation>
+        <translation type="obsolete"><nobr>Додај&nbsp;флопи&nbsp;уређај</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -5654,11 +6168,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Додај CD/DVD уређај</translation>
+        <translation type="obsolete">Додај CD/DVD уређај</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Додај флопи уређај</translation>
+        <translation type="obsolete">Додај флопи уређај</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5838,15 +6352,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD драјв:</translation>
+        <translation type="obsolete">CD/DVD драјв:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Одабрати виртуални CD/DVD диск или физички драј за овај виртуални драјв. Машина ће видети унет диск или физички драјв као њен садржај.</translation>
+        <translation type="obsolete">Одабрати виртуални CD/DVD диск или физички драј за овај виртуални драјв. Машина ће видети унет диск или физички драјв као њен садржај.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Подеси виртуелни CD/DVD драјв</translation>
+        <translation type="obsolete">Подеси виртуелни CD/DVD драјв</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5870,7 +6384,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Одабрати виртуелни CD/DVD диск...</translation>
+        <translation type="obsolete">Одабрати виртуелни CD/DVD диск...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5954,20 +6468,68 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSystem</name>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">поставили сте више од <b>%1%</b> меморије рачунара (<b>%2</b>) виртуелној машини. Није остављено довољно меморије за рад оперативног система. Одабрати мању количину.</translation>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">поставили сте више од <b>%1%</b> меморије рачунара (<b>%2</b>) виртуелној машини. Није остављено довољно меморије за рад оперативног система. Наставити на ваш ризик.</translation>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation type="obsolete">због перформанса, виртуелних проџцесори машине не могу бити више од два пута физичких хоста (<b>%1</b>). Умањити број виртуелних процесора.</translation>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSystem</name>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
+        <translation type="obsolete">поставили сте више од <b>%1%</b> меморије рачунара (<b>%2</b>) виртуелној машини. Није остављено довољно меморије за рад оперативног система. Одабрати мању количину.</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
+        <translation type="obsolete">поставили сте више од <b>%1%</b> меморије рачунара (<b>%2</b>) виртуелној машини. Није остављено довољно меморије за рад оперативног система. Наставити на ваш ризик.</translation>
+    </message>
+    <message>
+        <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="obsolete">због перформанса, виртуелних проџцесори машине не могу бити више од два пута физичких хоста (<b>%1</b>). Умањити број виртуелних процесора.</translation>
     </message>
     <message>
         <source>you have assigned more virtual CPUs to the virtual machine than the number of physical CPUs on your host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
@@ -6191,31 +6753,39 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6288,7 +6858,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Упали USB 2.0  (EHCI) контролер</translation>
+        <translation type="obsolete">Упали USB 2.0  (EHCI) контролер</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6347,7 +6917,27 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">USB 2.0 је активно за ову машину. Али, потребно је да <b>%1</b> буде инсталиран. Инсталирајте пакет са VirtualBox сајта. После тога, мочићете да поново упали USB 2.0. Дотле, биће онемогућен осим ако поништите актуелне промене поставке.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6487,7 +7077,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation type="unfinished">Затвори</translation>
+        <translation type="obsolete">Затвори</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6506,6 +7100,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Затвори</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Пребаци</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6547,7 +7164,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Неуспешна креација COM објекта за VirtualBox.</p><p>Програм ће се зауставити.</p></translation>
+        <translation type="obsolete"><p>Неуспешна креација COM објекта за VirtualBox.</p><p>Програм ће се зауставити.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -6745,15 +7362,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Не може да се нађе датотека за језик <b>%1</b> у фасцикли <b><nobr>%2</nobr></b>.</p><p>Језик ће бити врачен на Енгленски. Ићи на дијалог <b>Параметри</b> који се отвара са менија <b>Датотека</b> са главног прозора VirtualBox-а, и одабрати постојећи језик са језичка <b>Језик</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>'Гост додатци' је престаро: инсталирана верзија је %1, а очекује се %2. Неке способности (интеграција миша, ауто6величина дисплеја госта) ће највероватније престати да раде.</p><p>Ажурирати 'гост додатци' преко <b>Инсталирај 'гост додатци'</b> са менија <b>Уређаји</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>'Гост додатци' је престаро: инсталирана верзија је %1, а очекује се %2. Неке способности (интеграција миша, ауто6величина дисплеја госта) могу да не раде.</p><p>Препоручено је да се ажурира 'гост додатци' преко <b>Инсталирај 'гост додатци'</b> са менија <b>Уређаји</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>'Гост додатци' је новији за ову верзију: инсталирана верзија је %1, а очекује се %2.</p><p>Употреба новије верзије додатка са старијом веруијом Virtualbox-а није дозвоњено. Инсталирати актуелну верзију 'гост додатци' преко <b>Инсталирај 'гост додатци'</b> са менија <b>Уређаји</b>.</p></translation>
     </message>
     <message>
@@ -6858,9 +7475,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Преузми</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Монтирај</translation>
+        <translation type="obsolete">Монтирај</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7006,8 +7623,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Покажи дијалог са информација производа</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Нађена новија верзија VirtualBox-а! Верзија <b>%1</b> је доступна на <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Можете преузети ову верзију са овим линком:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Нађена новија верзија VirtualBox-а! Верзија <b>%1</b> је доступна на <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Можете преузети ову верзију са овим линком:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7107,7 +7724,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Један или више виртуелних хард диска, ЦД/ДВД или флопи нису доступни. Као резултат, нећете моћи да радите са машинама које користе те медије док не буду поново доступни.</p><p>Стиснути <b>Провери</b> за отварање менаджера да би се видело који медиј није доступан, или одабрати <b>Игнориши</b> за игнорисање ове поруке.</p></translation>
+        <translation type="obsolete"><p>Један или више виртуелних хард диска, ЦД/ДВД или флопи нису доступни. Као резултат, нећете моћи да радите са машинама које користе те медије док не буду поново доступни.</p><p>Стиснути <b>Провери</b> за отварање менаджера да би се видело који медиј није доступан, или одабрати <b>Игнориши</b> за игнорисање ове поруке.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -7137,8 +7754,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Препиши</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Критична грешка се појавила при раду машине, тако да је рад заустављен.</p><p>За помоћ, видети <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> или вашу подршку. Послати садржај журнала <tt>VBox.log</tt> и слику <tt>VBox.png</tt>, које су у фасцикли <nobr><b>%1</b></nobr>, као и опис шта сте радили пре појављивање грешке. Можете исто приступити овим датотекама преко < [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Критична грешка се појавила при раду машине, тако да је рад заустављен.</p><p>За помоћ, видети <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> или вашу подршку. Послати садржај журнала <tt>VBox.log</tt> и слику <tt>VBox.png</tt>, које су у фасцикли <nobr><b>%1</b></nobr>, као и опис шта сте радили пре појављивање грешке. Можете исто приступити овим датотек [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7421,7 +8038,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Сигурн избрисати CD/DVD уређај?</p><p>Нећете моћи да монтирате CD или ISO слике или да инсталирате 'додатке госта'!</p></translation>
+        <translation type="obsolete"><p>Сигурн избрисати CD/DVD уређај?</p><p>Нећете моћи да монтирате CD или ISO слике или да инсталирате 'додатке госта'!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7524,7 +8141,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Спремате се да креирате нов контролер <b>%1</b> CD/DVD драјва.</p><p>Да ли да одаберете виртуални CD/DVD диск да се убаци унутра или да се остави празно за сада?</p></translation>
+        <translation type="obsolete"><p>Спремате се да креирате нов контролер <b>%1</b> CD/DVD драјва.</p><p>Да ли да одаберете виртуални CD/DVD диск да се убаци унутра или да се остави празно за сада?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7546,11 +8163,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Неуспешан одвој CD/DVD уређаја (<nobr><b>%1</b></nobr>) са слота <i>%2</i> од машине <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешан одвој CD/DVD уређаја (<nobr><b>%1</b></nobr>) са слота <i>%2</i> од машине <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Неуспешан одвој флопи уређаја (<nobr><b>%1</b></nobr>) са слота <i>%2</i> од машине <b>%3</b>.</translation>
+        <translation type="obsolete">Неуспешан одвој флопи уређаја (<nobr><b>%1</b></nobr>) са слота <i>%2</i> од машине <b>%3</b>.</translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
@@ -7590,19 +8207,19 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Погрешно закачивање CD/DVD уређаја (<nobr><b>%1</b></nobr>) на слот <i>%2</i> од машине <b>%3</b>.</translation>
+        <translation type="obsolete">Погрешно закачивање CD/DVD уређаја (<nobr><b>%1</b></nobr>) на слот <i>%2</i> од машине <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Погрешно закачивање флопиа (<nobr><b>%1</b></nobr>) на слот <i>%2</i> од машине <b>%3</b>.</translation>
+        <translation type="obsolete">Погрешно закачивање флопиа (<nobr><b>%1</b></nobr>) на слот <i>%2</i> од машине <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Стовариште овог медијума неће бити избрисан и мочиће да се опет искористи.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation type="unfinished"><p>'Додатци госта' делује да није доступан на овој машини, тако да дељене фасцикле не могу да се користе. Да би користили дељене фасцикле, , инсталирајте 'додатци госта' ако није инсталиран, или га поново инсталирајте ако не ради како треба, преко <b>Инсталирај додатци госта</b> из менија <b>Уређаји</b>. Ако је инсталирано а машина није потпуно покренута, онда ће дељење бити доспупно после покретања. [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>'Додатци госта' делује да није доступан на овој машини, тако да дељене фасцикле не могу да се користе. Да би користили дељене фасцикле, , инсталирајте 'додатци госта' ако није инсталиран, или га поново инсталирајте ако не ради како треба, преко <b>Инсталирај додатци госта</b> из менија <b>Уређаји</b>. Ако је инсталирано а машина није потпуно покренута, онда ће дељење бити доспупно после покретања.&l [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -7839,10 +8456,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -8072,14 +8685,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -8112,25 +8717,120 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>'Додатци госта' делује да није доступан на овој машини, тако да дељене фасцикле не могу да се користе. Да би користили дељене фасцикле, , инсталирајте 'додатци госта' ако није инсталиран, или га поново инсталирајте ако не ради како треба, преко <b>Инсталирај додатци госта</b> из менија <b>Уређаји</b>. Ако је инсталирано а машина није потпуно покренута, онда ће дељење бити доспупно после покретања.&l [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Монтирај</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -8223,7 +8923,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished">Име:</translation>
     </message>
     <message>
@@ -9134,14 +9834,18 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished">Машина (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="unfinished"><h3>Добродошли у VirtualBox!</h3><p>Леви део прозор показује списак виртуелне машине са рачунара. Списак је празан пошто нисте још креирали виртуелну машину.<img src=:/welcome.png align=right/></p><p>За креацију нове виртуелне машине, стиснути <b>Ново</b> са главне траке која је на горњи део прозора.</p><p>Можете да стиснете <b>F1</b> за инстантни помоћ, или ићи на <a href=ht [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Добродошли у VirtualBox!</h3><p>Леви део прозор показује списак виртуелне машине са рачунара. Списак је празан пошто нисте још креирали виртуелну машину.<img src=:/welcome.png align=right/></p><p>За креацију нове виртуелне машине, стиснути <b>Ново</b> са главне траке која је на горњи део прозора.</p><p>Можете да стиснете <b>F1</b> за инстантни помоћ, или ићи на <a href=http [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished">Уреди</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9174,7 +9878,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Settings</source>
-        <translation>Параметри</translation>
+        <translation type="obsolete">Параметри</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -9227,6 +9931,10 @@ p, li { white-space: pre-wrap; }
         <source>Display</source>
         <translation type="unfinished">Дисплеј</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -9286,6 +9994,43 @@ p, li { white-space: pre-wrap; }
         <source>you have 2D Video Acceleration enabled. As 2D Video Acceleration is supported for Windows guests only, this feature will be disabled.</source>
         <translation type="obsolete">имате 2D видео убрзавање упаљено. Пошто је 2D видео убрзавање је подршана само са тране Windows госта, опција ће бити онемогућена.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Параметри</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Затвори</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -9381,8 +10126,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Резиме</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Нађена новија верзија VirtualBox-а! Верзија <b>%1</b> је доступна на <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Можете преузети ову верзију са овим линком:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Нађена новија верзија VirtualBox-а! Верзија <b>%1</b> је доступна на <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Можете преузети ову верзију са овим линком:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -9450,6 +10195,14 @@ p, li { white-space: pre-wrap; }
         <source>&Restore current snapshot '%1'</source>
         <translation>Врати актуелну слику '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -9463,24 +10216,179 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>Недоступно</translation>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Информација сесије</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 од %3</nobr><br><nobr>Сесија %4</nobr></translation>
+        <source>&Details</source>
+        <translation type="obsolete">Детаљи</translation>
     </message>
     <message>
-        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
-        <comment>Inaccessible VM tooltip (name, last state change)</comment>
-        <translation><nobr><b>%1</b><br></nobr><nobr>Недоступно од %2</nobr></translation>
+        <source>&Runtime</source>
+        <translation type="obsolete">Ради</translation>
     </message>
     <message>
-        <source>S&how</source>
-        <translation type="obsolete">&Покажи</translation>
+        <source>DMA Transfers</source>
+        <translation>DMA трансфери</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO трансфери</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Читано</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Писано</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Пренешено</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Примљено</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Атрибути рада</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Резолуција екрана</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Статистике CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Статистике мрежног адаптера</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Верзија %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Ненађено</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Ненађено</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Додатци госта</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Тип ОС госта</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Статистике хард диска</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Без хард диска</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Без мрежних адаптера</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Упаљено</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Угашено</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Подметнуто записивање</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Недоступно</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Статистике стоваришта</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Нема стоваришна уређаја</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Мрежне статистике</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Подметнуто записивање</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Недоступно</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>Недоступно</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation><nobr>%1<br></nobr><nobr>%2 од %3</nobr><br><nobr>Сесија %4</nobr></translation>
+    </message>
+    <message>
+        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
+        <comment>Inaccessible VM tooltip (name, last state change)</comment>
+        <translation><nobr><b>%1</b><br></nobr><nobr>Недоступно од %2</nobr></translation>
+    </message>
+    <message>
+        <source>S&how</source>
+        <translation type="obsolete">&Покажи</translation>
     </message>
     <message>
         <source>Switch to the window of the selected virtual machine</source>
@@ -9612,11 +10520,19 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -10462,11 +11378,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">креирај или промени дељене фасцикле</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Инсталирај 'додатци госта'...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Монтирај слику 'додатака госта'</translation>
     </message>
     <message>
@@ -10681,7 +11597,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Информација сесије</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Покажи информације сесије</translation>
     </message>
     <message>
@@ -10853,8 +11769,8 @@ p, li { white-space: pre-wrap; }
         <translation><Рисетуј на иницијално></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Актуелна путања ће бити показана после прихватања промене и поновног отварање овог дијалога.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Актуелна путања ће бити показана после прихватања промене и поновног отварање овог дијалога.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -10902,8 +11818,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Актуелна путања ће бити показана после прихватања промене и поновног отварање овог дијалога.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11245,7 +12160,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -12049,17 +12964,17 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Привезивање овог хард диска ће бити индиректан користечи новог креираног различитог хард диска.</translation>
+        <translation type="obsolete">Привезивање овог хард диска ће бити индиректан користечи новог креираног различитог хард диска.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Меки медиј из хард диска није доступан. Користити витуелни менаџер медија у <b>Покажи различит хард диск</b> за проверу овог медија.</translation>
+        <translation type="obsolete">Меки медиј из хард диска није доступан. Користити витуелни менаџер медија у <b>Покажи различит хард диск</b> за проверу овог медија.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Овај базни хард диск је индиректно прикачен са овим различитим диском:</translation>
+        <translation type="obsolete">Овај базни хард диск је индиректно прикачен са овим различитим диском:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -12111,7 +13026,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -12656,16 +13571,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -12713,6 +13618,155 @@ p, li { white-space: pre-wrap; }
         <source>You can create or add disk image files in the virtual machine settings.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Ништа</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Иницијално</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Активно</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Активно</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Активно</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxGlobalSettings</name>
@@ -13015,6 +14069,18 @@ p, li { white-space: pre-wrap; }
         <source>C&lose</source>
         <translation type="obsolete">Затвори</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13135,8 +14201,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Неуспешно пријављивање везе.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to thir [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to thir [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -13155,8 +14221,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Одабрати земљу/територију</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Молимо вас да попунити овај формулар да би знали да користите VirtualBox и, необавезно, да будете информисани о ажурирања VirtualBox-а.</p><p>Унети само латинске карактере. Sun Microsystems користи ове информације само за статистике и да вам пошаље VirtualBox новости. Sun Microsystems неће никада попустити Ваше податке другима. Детаљи о употреби личних информацијама може се наћи у <b>Политика приватности</b> руковника  [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Молимо вас да попунити овај формулар да би знали да користите VirtualBox и, необавезно, да будете информисани о ажурирања VirtualBox-а.</p><p>Унети само латинске карактере. Sun Microsystems користи ове информације само за статистике и да вам пошаље VirtualBox новости. Sun Microsystems неће никада попустити Ваше податке другима. Детаљи о употреби личних информацијама може се наћи у <b>Политика приватности</b> руковника  [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -13361,8 +14427,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Паузирај рад машине</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Добродошли у VirtualBox!</h3><p>Леви део прозор показује списак виртуелне машине са рачунара. Списак је празан пошто нисте још креирали виртуелну машину.<img src=:/welcome.png align=right/></p><p>За креацију нове виртуелне машине, стиснути <b>Ново</b> са главне траке која је на горњи део прозора.</p><p>Можете да стиснете <b>F1</b> за инстантни помоћ, или ићи на <a href=http [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Добродошли у VirtualBox!</h3><p>Леви део прозор показује списак виртуелне машине са рачунара. Списак је празан пошто нисте још креирали виртуелну машину.<img src=:/welcome.png align=right/></p><p>За креацију нове виртуелне машине, стиснути <b>Ново</b> са главне траке која је на горњи део прозора.</p><p>Можете да стиснете <b>F1</b> за инстантни помоћ, или ићи на <a href=http [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -13804,157 +14870,6 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Информација сесије</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">Детаљи</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">Ради</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA трансфери</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO трансфери</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Читано</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Писано</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Пренешено</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Примљено</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Атрибути рада</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Резолуција екрана</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Статистике CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Статистике мрежног адаптера</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Верзија %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Ненађено</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Ненађено</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Додатци госта</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Тип ОС госта</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Статистике хард диска</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Без хард диска</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Без мрежних адаптера</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Упаљено</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Угашено</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Подметнуто записивање</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Недоступно</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Статистике стоваришта</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Нема стоваришна уређаја</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Мрежне статистике</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Подметнуто записивање</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Недоступно</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sv.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sv.ts
index 64febef..409fd79 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sv.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_sv.ts
@@ -263,7 +263,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Söm&löst läge</translation>
+        <translation type="unfinished">Söm&löst läge</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -287,11 +287,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>Inaktivera &musintegration</translation>
+        <translation type="obsolete">Inaktivera &musintegration</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Inaktivera värdmuspekarintegrationen temporärt</translation>
+        <translation type="obsolete">Inaktivera värdmuspekarintegrationen temporärt</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -303,11 +303,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>In&foga Ctrl-Alt-Del</translation>
+        <translation type="obsolete">In&foga Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Skicka Ctrl-Alt-Del-sekvens till den virtuella maskinen</translation>
+        <translation type="obsolete">Skicka Ctrl-Alt-Del-sekvens till den virtuella maskinen</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -315,7 +315,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Skicka Ctrl-Alt-Backsteg-sekvens till den virtuella maskinen</translation>
+        <translation type="obsolete">Skicka Ctrl-Alt-Backsteg-sekvens till den virtuella maskinen</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -339,7 +339,7 @@
     </message>
     <message>
         <source>Suspend the execution of the virtual machine</source>
-        <translation>Pausa körningen av den virtuella maskinen</translation>
+        <translation></translation>
     </message>
     <message>
         <source>R&esume</source>
@@ -387,15 +387,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD-enheter</translation>
+        <translation type="obsolete">&CD/DVD-enheter</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Diskettenheter</translation>
+        <translation type="obsolete">&Diskettenheter</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB-enheter</translation>
+        <translation type="obsolete">&USB-enheter</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -446,7 +446,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>&Loggning...</translation>
+        <translation type="obsolete">&Loggning...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -524,15 +524,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Växla till &helskärm</translation>
+        <translation type="obsolete">Växla till &helskärm</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Växla mellan normalt läge och helskärmsläge</translation>
+        <translation type="obsolete">Växla mellan normalt läge och helskärmsläge</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Växla till söm&löst läge</translation>
+        <translation type="obsolete">Växla till söm&löst läge</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -540,7 +540,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Växla till &skalningsläge</translation>
+        <translation type="obsolete">Växla till &skalningsläge</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -569,77 +569,77 @@
     <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
-        <translation>&Arkiv</translation>
+        <translation type="unfinished">&Arkiv</translation>
     </message>
     <message>
         <source>&File</source>
         <comment>Non Mac OS X version</comment>
-        <translation>&Arkiv</translation>
+        <translation type="unfinished">&Arkiv</translation>
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
-        <translation>Hanterare för virtuella &media...</translation>
+        <translation type="unfinished">Hanterare för virtuella &media...</translation>
     </message>
     <message>
         <source>Display the Virtual Media Manager window</source>
-        <translation>Visa Hanterare för virtuella media</translation>
+        <translation type="unfinished">Visa Hanterare för virtuella media</translation>
     </message>
     <message>
         <source>&Import Appliance...</source>
-        <translation>&Importera appliance...</translation>
+        <translation type="unfinished">&Importera appliance...</translation>
     </message>
     <message>
         <source>Import an appliance into VirtualBox</source>
-        <translation>Importera en appliance till VirtualBox</translation>
+        <translation type="unfinished">Importera en appliance till VirtualBox</translation>
     </message>
     <message>
         <source>&Export Appliance...</source>
-        <translation>&Exportera appliance...</translation>
+        <translation type="unfinished">&Exportera appliance...</translation>
     </message>
     <message>
         <source>Export one or more VirtualBox virtual machines as an appliance</source>
-        <translation>Exportera en eller flera virtuella VirtualBox-maskiner som en appliance</translation>
+        <translation type="unfinished">Exportera en appliance från virtuella maskiner från VirtualBox</translation>
     </message>
     <message>
         <source>&Preferences...</source>
         <comment>global settings</comment>
-        <translation>&Inställningar...</translation>
+        <translation type="unfinished">&Inställningar...</translation>
     </message>
     <message>
         <source>Display the global settings window</source>
-        <translation>Visa fönster för allmänna inställningar</translation>
+        <translation type="unfinished">Visa allmänna inställningar</translation>
     </message>
     <message>
         <source>E&xit</source>
-        <translation>A&vsluta</translation>
+        <translation type="unfinished">A&vsluta</translation>
     </message>
     <message>
         <source>Close application</source>
-        <translation>Stäng programmet</translation>
+        <translation type="unfinished">Stäng programmet</translation>
     </message>
     <message>
         <source>&New...</source>
-        <translation>&Ny...</translation>
+        <translation type="unfinished">&Ny...</translation>
     </message>
     <message>
         <source>Create a new virtual machine</source>
-        <translation>Skapa en ny virtuell maskin</translation>
+        <translation type="unfinished">Skapa en ny virtuell maskin</translation>
     </message>
     <message>
         <source>&Add...</source>
-        <translation>&Lägg till...</translation>
+        <translation type="unfinished">&Lägg till...</translation>
     </message>
     <message>
         <source>Add an existing virtual machine</source>
-        <translation>Lägg till en befintlig virtuell maskin</translation>
+        <translation type="unfinished">Lägg till en befintlig virtuell maskin</translation>
     </message>
     <message>
         <source>Cl&one...</source>
-        <translation>Kl&ona...</translation>
+        <translation type="unfinished">Kl&ona...</translation>
     </message>
     <message>
         <source>Clone the selected virtual machine</source>
-        <translation>Klona den markerade virtuella maskinen</translation>
+        <translation type="unfinished">Klona den markerade virtuella maskinen</translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -651,7 +651,7 @@
     </message>
     <message>
         <source>S&tart</source>
-        <translation>St&arta</translation>
+        <translation type="unfinished">St&arta</translation>
     </message>
     <message>
         <source>Start the selected virtual machine</source>
@@ -659,7 +659,7 @@
     </message>
     <message>
         <source>S&how</source>
-        <translation>V&isa</translation>
+        <translation type="unfinished">V&isa</translation>
     </message>
     <message>
         <source>Switch to the window of the selected virtual machine</source>
@@ -667,7 +667,7 @@
     </message>
     <message>
         <source>Discard</source>
-        <translation>Förkasta</translation>
+        <translation type="unfinished">Förkasta</translation>
     </message>
     <message>
         <source>D&iscard Saved State</source>
@@ -683,19 +683,19 @@
     </message>
     <message>
         <source>Refresh the accessibility state of the selected virtual machine</source>
-        <translation>Uppdatera tillgänglighetstillståndet för den markerade virtuella maskinen</translation>
+        <translation type="unfinished">Uppdatera tillgänglighetstillståndet för den markerade virtuella maskinen</translation>
     </message>
     <message>
         <source>Show &Log...</source>
-        <translation>Visa lo&gg...</translation>
+        <translation type="unfinished">Visa lo&gg...</translation>
     </message>
     <message>
         <source>Show the log files of the selected virtual machine</source>
-        <translation>Visa loggfilerna för den markerade virtuella maskinen</translation>
+        <translation type="unfinished">Visa loggfilerna för den markerade virtuella maskinen</translation>
     </message>
     <message>
         <source>Show in Finder</source>
-        <translation>Visa i Finder</translation>
+        <translation type="unfinished">Visa i Finder</translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in Finder.</source>
@@ -703,7 +703,7 @@
     </message>
     <message>
         <source>Show in Explorer</source>
-        <translation>Visa i Utforskaren</translation>
+        <translation type="unfinished">Visa i Utforskaren</translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in Explorer.</source>
@@ -711,15 +711,15 @@
     </message>
     <message>
         <source>Show in File Manager</source>
-        <translation>Visa i filhanterare</translation>
+        <translation type="unfinished">Visa i filhanterare</translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in the File Manager</source>
-        <translation>Visa VirtualBox Machine Definition-filen i filhanteraren</translation>
+        <translation type="unfinished">Visa VirtualBox Machine Definition-filen i filhanteraren</translation>
     </message>
     <message>
         <source>Create Alias on Desktop</source>
-        <translation>Skapa alias på skrivbordet</translation>
+        <translation type="unfinished">Skapa alias på skrivbordet</translation>
     </message>
     <message>
         <source>Creates an Alias file to the VirtualBox Machine Definition file on your Desktop.</source>
@@ -727,7 +727,7 @@
     </message>
     <message>
         <source>Create Shortcut on Desktop</source>
-        <translation>Skapa genväg på skrivbordet</translation>
+        <translation type="unfinished">Skapa genväg på skrivbordet</translation>
     </message>
     <message>
         <source>Creates an Shortcut file to the VirtualBox Machine Definition file on your Desktop.</source>
@@ -735,19 +735,19 @@
     </message>
     <message>
         <source>Take Sn&apshot...</source>
-        <translation>Ta ö&gonblicksbild...</translation>
+        <translation type="unfinished">Ta ö&gonblicksbild...</translation>
     </message>
     <message>
         <source>Take Screensh&ot...</source>
-        <translation>Ta skärmbil&d...</translation>
+        <translation type="unfinished">Ta skärmbil&d...</translation>
     </message>
     <message>
         <source>Take a screenshot of the virtual machine</source>
-        <translation>Ta en skärmbild av den virtuella maskinen</translation>
+        <translation type="unfinished">Ta en skärmbild av den virtuella maskinen</translation>
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Info&ga Ctrl-Alt-Backsteg</translation>
+        <translation type="obsolete">Info&ga Ctrl-Alt-Backsteg</translation>
     </message>
     <message>
         <source>Sort List</source>
@@ -759,247 +759,466 @@
     </message>
     <message>
         <source>&Close</source>
-        <translation>S&täng</translation>
+        <translation type="unfinished">S&täng</translation>
     </message>
     <message>
         <source>Po&wer Off</source>
-        <translation>Stäng a&v</translation>
+        <translation type="unfinished">Stäng a&v</translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>Stäng av den virtuella maskinen</translation>
+        <translation type="unfinished">Stäng av den virtuella maskinen</translation>
     </message>
     <message>
         <source>&Contents...</source>
-        <translation>&Innehåll...</translation>
+        <translation type="unfinished">&Innehåll...</translation>
     </message>
     <message>
         <source>Show help contents</source>
-        <translation>Visa hjälpinnehållet</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Open the browser and go to the VirtualBox product web site</source>
-        <translation>Öppna webbläsaren och gå till VirtualBox produktwebbplats</translation>
+        <translation type="unfinished">Öppna webbläsaren och gå till VirtualBox produktwebbplats</translation>
     </message>
     <message>
         <source>Go back to showing all suppressed warnings and messages</source>
-        <translation>Gör att alla tysta varningar och meddelanden visas igen</translation>
+        <translation type="unfinished">Gör att alla tysta varningar och meddelanden visas igen</translation>
     </message>
     <message>
         <source>&Network Operations Manager...</source>
-        <translation>Hanterare för &nätverksåtgärder...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show Network Operations Manager</source>
-        <translation>Visa Hanterare för nätverksåtgärder</translation>
+        <translation type="unfinished">Visa Hanterare för nätverksåtgärder</translation>
     </message>
     <message>
         <source>Check for a new VirtualBox version</source>
-        <translation>Leta efter en ny version av VirtualBox</translation>
+        <translation type="unfinished">Leta efter en ny version av VirtualBox</translation>
     </message>
     <message>
         <source>&About VirtualBox...</source>
-        <translation>&Om VirtualBox...</translation>
+        <translation type="unfinished">&Om VirtualBox...</translation>
     </message>
     <message>
         <source>Show a window with product information</source>
-        <translation>Visa en dialogruta med produktinformation</translation>
+        <translation type="unfinished">Visa en dialogruta med produktinformation</translation>
     </message>
     <message>
         <source>&Group</source>
-        <translation>&Grupp</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Rename the selected virtual machine group</source>
-        <translation>Byt namn på markerad virtuell maskingrupp</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Re&fresh...</source>
-        <translation>Up&pdatera...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Add a new group based on the items selected</source>
-        <translation>Lägg till en ny grupp baserad på markerade objekt</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove...</source>
-        <translation>&Ta bort...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>D&iscard saved state...</source>
-        <translation>För&kasta sparat tillstånd...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Web Site...</source>
-        <translation>&VirtualBox webbplats...</translation>
+        <translation type="unfinished">&VirtualBox webbplats...</translation>
     </message>
     <message>
         <source>&Reset All Warnings</source>
-        <translation>&Nollställ alla varningar</translation>
+        <translation type="unfinished">&Nollställ alla varningar</translation>
     </message>
     <message>
         <source>C&heck for Updates...</source>
-        <translation>Leta e&fter uppdateringar...</translation>
+        <translation type="unfinished">Leta e&fter uppdateringar...</translation>
     </message>
     <message>
         <source>Rena&me Group...</source>
-        <translation>Byt na&mn på grupp...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Sort the items of the selected virtual machine group alphabetically</source>
-        <translation>Sortera objekten alfabetiskt i den markerade virtuella maskingruppen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Remove the selected virtual machines</source>
-        <translation>Ta bort markerade virtuella maskiner</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Start the selected virtual machines</source>
-        <translation>Starta markerade virtuella maskiner</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Switch to the windows of the selected virtual machines</source>
-        <translation>Växla till fönstren för de markerade virtuella maskinerna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Suspend the execution of the selected virtual machines</source>
-        <translation>Pausa körningen av markerade virtuella maskiner</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Reset the selected virtual machines</source>
-        <translation>Starta om markerade virtuella maskiner</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Discard the saved state of the selected virtual machines</source>
-        <translation>Förkasta sparat tillstånd för markerade virtuella maskiner</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in Finder</source>
-        <translation>Visa VirtualBox Machine Definition-filen i Finder</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show the VirtualBox Machine Definition file in Explorer</source>
-        <translation>Visa VirtualBox Machine Definition-filen i Utforskaren</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Creates an alias file to the VirtualBox Machine Definition file on your desktop</source>
-        <translation>Skapar en aliasfil till VirtualBox Machine Definition-filen på ditt skrivbord</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Creates an shortcut file to the VirtualBox Machine Definition file on your desktop</source>
-        <translation>Skapar en genvägsfil till VirtualBox Machine Definition-filen på ditt skrivbord</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Save State</source>
-        <translation>Spara tillstånd</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Save the machine state of the selected virtual machines</source>
-        <translation>Spara maskintillståndet för de markerade virtuella maskinerna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Send the ACPI Power Button press event to the selected virtual machines</source>
-        <translation>Skicka ACPI Power Button-händelse till de markerade virtuella maskinerna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Power off the selected virtual machines</source>
-        <translation>Stäng av de markerade virtuella maskinerna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&New Machine...</source>
-        <translation>&Ny maskin...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Add Machine...</source>
-        <translation>&Lägg till maskin...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Ungroup...</source>
-        <translation>Ta &bort ur grupp...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ungroup items of the selected virtual machine group</source>
-        <translation>Ta bort objekt ur den markerade virtuella maskingruppen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Sort</source>
-        <translation>Sortera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Gro&up</source>
-        <translation>Gr&upp</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Sort the group of the first selected machine alphabetically</source>
-        <translation>Sortera gruppen efter första markerade maskinen i alfabetsordning</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Shared &Clipboard</source>
-        <translation>Delade &urklipp</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop</source>
-        <translation>Dra och släpp</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>Spara maskintillståndet för den virtuella maskinen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>&Nätverksinställningar...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
-        <translation>Inställningar för &delade mappar...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>F&järrskrivbord</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translation>Växla fjärrskrivbordsanslutningar (RDP) till denna maskin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture</source>
-        <translation>&Videofångst</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Toggle video capture</source>
-        <translation>Växla videofångst</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Video Capture Settings...</source>
-        <translation>Inställningar för vide&ofångst...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configure video capture settings</source>
-        <translation>Konfigurera inställningar för videofångst</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Popup Menu</source>
-        <translation>Popup-meny</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Show Session Information Window</source>
-        <translation>Visa fönstret för sessionsinformation</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Webcams</source>
-        <translation>&Webbkameror</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
-        <translation>Mata &in cd-avbild för gästtillägg...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Mata in diskfilen för gästtillägg i den virtuella enheten</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
-        <translation>Nätverk</translation>
+        <translation type="unfinished">Nätverk</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished">Visa lo&gg...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Arkiv</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Aktivera</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
     </message>
 </context>
 <context>
@@ -1128,7 +1347,7 @@
     </message>
     <message>
         <source>&Reinitialize the MAC address of all network cards</source>
-        <translation>Initi&era om MAC-adressen för alla nätverkskort</translation>
+        <translation>Ominiti&era MAC-adressen för alla nätverkskort</translation>
     </message>
 </context>
 <context>
@@ -1818,17 +2037,17 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
-        <translation>Släpper data ...</translation>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Släpper data ...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -1871,11 +2090,11 @@
     </message>
     <message>
         <source>Looking for %1...</source>
-        <translation>Letar efter %1...</translation>
+        <translation type="unfinished">Letar efter %1...</translation>
     </message>
     <message>
         <source>Downloading %1...</source>
-        <translation>Hämtar %1...</translation>
+        <translation type="unfinished">Hämtar %1...</translation>
     </message>
 </context>
 <context>
@@ -1902,7 +2121,7 @@
     </message>
     <message>
         <source>VirtualBox Guest Additions</source>
-        <translation>VirtualBox Gästtillägg</translation>
+        <translation type="unfinished">VirtualBox Gästtillägg</translation>
     </message>
 </context>
 <context>
@@ -1913,7 +2132,7 @@
     </message>
     <message>
         <source>VirtualBox Extension Pack</source>
-        <translation>VirtualBox tilläggspaket</translation>
+        <translation type="unfinished">VirtualBox tilläggspaket</translation>
     </message>
 </context>
 <context>
@@ -1924,7 +2143,33 @@
     </message>
     <message>
         <source>VirtualBox User Manual</source>
-        <translation>Handbok för VirtualBox</translation>
+        <translation type="unfinished">Handbok för VirtualBox</translation>
+    </message>
+</context>
+<context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
     </message>
 </context>
 <context>
@@ -2485,69 +2730,69 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><b>%1</b></source>
         <comment>Group item tool-tip / Group name</comment>
-        <translation><b>%1</b></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source>%n group(s)</source>
         <comment>Group item tool-tip / Group info</comment>
-        <translation>
-            <numerusform>%n grupp</numerusform>
-            <numerusform>%n grupper</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Group info wrapper</comment>
-        <translation><nobr>%1</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr></translation>
     </message>
     <message numerus="yes">
         <source>%n machine(s)</source>
         <comment>Group item tool-tip / Machine info</comment>
-        <translation>
-            <numerusform>%n maskin</numerusform>
-            <numerusform>%n maskiner</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message numerus="yes">
         <source>(%n running)</source>
         <comment>Group item tool-tip / Running machine info</comment>
-        <translation>
-            <numerusform>(%n kör)</numerusform>
-            <numerusform>(%n kör)</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
         <source><nobr>%1</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper</comment>
-        <translation><nobr>%1</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr></translation>
     </message>
     <message>
         <source><nobr>%1 %2</nobr></source>
         <comment>Group item tool-tip / Machine info wrapper, including running</comment>
-        <translation><nobr>%1 %2</nobr></translation>
+        <translation type="unfinished"><nobr>%1</nobr> {1 %2<?}</translation>
     </message>
     <message>
         <source>Collapse group</source>
-        <translation>Fäll ut grupp</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Expand group</source>
-        <translation>Fäll in grupp</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter group</source>
-        <translation>Gå in i grupp</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Exit group</source>
-        <translation>Gå ur grupp</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIGChooserModel</name>
     <message>
         <source>New group</source>
-        <translation>Ny grupp</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2555,12 +2800,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Name</source>
         <comment>details (general)</comment>
-        <translation>Namn</translation>
+        <translation type="unfinished">Namn</translation>
     </message>
     <message>
         <source>Groups</source>
         <comment>details (general)</comment>
-        <translation>Grupper</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Information inaccessible</source>
@@ -2570,57 +2815,52 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>%1 MB</source>
         <comment>details</comment>
-        <translation>%1 MB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Processors</source>
         <comment>details (system)</comment>
-        <translation>Processorer</translation>
+        <translation type="unfinished">Processorer</translation>
     </message>
     <message>
         <source>%1%</source>
         <comment>details</comment>
-        <translation>%1%</translation>
+        <translation type="unfinished">%1%</translation>
     </message>
     <message>
         <source>VT-x/AMD-V</source>
         <comment>details (system)</comment>
-        <translation>VT-x/AMD-V</translation>
+        <translation type="unfinished">VT-x/AMD-V</translation>
     </message>
     <message>
         <source>PAE/NX</source>
         <comment>details (system)</comment>
-        <translation>PAE/NX</translation>
+        <translation type="unfinished">PAE/NX</translation>
     </message>
     <message>
         <source>Acceleration</source>
         <comment>details (system)</comment>
-        <translation>Acceleration</translation>
+        <translation type="unfinished">Acceleration</translation>
     </message>
     <message>
         <source>Screens</source>
         <comment>details (display)</comment>
-        <translation>Skärmar</translation>
+        <translation type="unfinished">Skärmar</translation>
     </message>
     <message>
         <source>3D</source>
         <comment>details (display)</comment>
-        <translation>3D</translation>
+        <translation type="unfinished">3D</translation>
     </message>
     <message>
         <source>Acceleration</source>
         <comment>details (display)</comment>
-        <translation>Acceleration</translation>
+        <translation type="unfinished">Acceleration</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/vrde/VRDE server)</comment>
-        <translation>Inaktiverad</translation>
-    </message>
-    <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2630,12 +2870,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Controller</source>
         <comment>details (audio)</comment>
-        <translation>Styrkort</translation>
+        <translation type="unfinished">Styrkort</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (audio)</comment>
-        <translation>Inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Bridged adapter, %1</source>
@@ -2665,181 +2905,276 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Adapter %1</source>
         <comment>details (network)</comment>
-        <translation>Adapter %1</translation>
+        <translation type="unfinished">Adapter %1</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (network/adapter)</comment>
-        <translation>Inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Port %1</source>
         <comment>details (serial)</comment>
-        <translation>Port %1</translation>
+        <translation type="unfinished">Port %1</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (serial)</comment>
-        <translation>Inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Port %1</source>
         <comment>details (parallel)</comment>
-        <translation>Port %1</translation>
+        <translation type="unfinished">Port %1</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (parallel)</comment>
-        <translation>Inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (%2 active)</source>
         <comment>details (usb)</comment>
-        <translation>%1 (%2 aktiv)</translation>
+        <translation type="unfinished">%1 (%2 aktiv)</translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (usb)</comment>
-        <translation>Inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
         <comment>details (shared folders)</comment>
-        <translation>Ingen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
         <comment>details (description)</comment>
-        <translation>Ingen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Operating System</source>
         <comment>details (general)</comment>
-        <translation>Operativsystem</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Information Inaccessible</source>
         <comment>details</comment>
-        <translation>Information inte tillgänglig</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Base Memory</source>
         <comment>details (system)</comment>
-        <translation>Basminne</translation>
+        <translation type="unfinished">Basminne</translation>
     </message>
     <message>
         <source>Execution Cap</source>
         <comment>details (system)</comment>
-        <translation>Exekveringsgräns</translation>
+        <translation type="unfinished">Exekveringsgräns</translation>
     </message>
     <message>
         <source>Boot Order</source>
         <comment>details (system)</comment>
-        <translation>Uppstartsordning</translation>
+        <translation type="unfinished">Uppstartsordning</translation>
     </message>
     <message>
         <source>Nested Paging</source>
         <comment>details (system)</comment>
-        <translation>Nested Paging</translation>
+        <translation type="unfinished">Nested Paging</translation>
     </message>
     <message>
         <source>Video Memory</source>
         <comment>details (display)</comment>
-        <translation>Grafikminne</translation>
+        <translation type="unfinished">Grafikminne</translation>
     </message>
     <message>
         <source>2D Video</source>
         <comment>details (display)</comment>
-        <translation>2D-grafik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Remote Desktop Server Port</source>
         <comment>details (display/vrde)</comment>
-        <translation>Port för fjärrskrivbordsserver</translation>
+        <translation type="unfinished">Port för fjärrskrivbordsserver</translation>
     </message>
     <message>
         <source>Remote Desktop Server</source>
         <comment>details (display/vrde)</comment>
-        <translation>Fjärrskrivbordsserver</translation>
+        <translation type="unfinished">Fjärrskrivbordsserver</translation>
     </message>
     <message>
         <source>Not Attached</source>
         <comment>details (storage)</comment>
-        <translation>Inte ansluten</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host Driver</source>
         <comment>details (audio)</comment>
-        <translation>Värddrivrutin</translation>
+        <translation type="unfinished">Värddrivrutin</translation>
     </message>
     <message>
         <source>Bridged Adapter, %1</source>
         <comment>details (network)</comment>
-        <translation>Bryggad adapter, %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Internal Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Internt nätverk, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host-only Adapter, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Endast-värd-adapter, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Generic Driver, '%1'</source>
         <comment>details (network)</comment>
-        <translation>Allmän drivrutin, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Generic Driver, '%1' {&nbsp;%2&nbsp;}</source>
         <comment>details (network)</comment>
-        <translation>Allmän drivrutin, '%1' {&nbsp;%2&nbsp;}</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Device Filters</source>
         <comment>details (usb)</comment>
-        <translation>Enhetsfilter</translation>
+        <translation type="unfinished">Enhetsfilter</translation>
     </message>
     <message>
         <source>USB Controller Inaccessible</source>
         <comment>details (usb)</comment>
-        <translation>USB-styrkort inte tillgängligt</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Shared Folders</source>
         <comment>details (shared folders)</comment>
-        <translation>Delade mappar</translation>
+        <translation type="unfinished">Delade mappar</translation>
     </message>
     <message>
         <source>Video Capture File</source>
         <comment>details (display/video capture)</comment>
-        <translation>Fil för videofångst</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture Attributes</source>
         <comment>details (display/video capture)</comment>
-        <translation>Attribut för videofångst</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Video Capture</source>
         <comment>details (display/video capture)</comment>
-        <translation>Videofångst</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disabled</source>
         <comment>details (display/video capture)</comment>
-        <translation>Inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translation>NAT-nätverk, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
-        <translation>Bildstorlek: %1x%2, Bildfrekvens: %3 bilder/s, Bitfrekvens: %4 kbps</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">USB-styrkort</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3073,23 +3408,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Every 0.5 s</source>
-        <translation>Var 0,5 s</translation>
+        <translation type="unfinished">Var 0,5 s</translation>
     </message>
     <message>
         <source>Every 1 s</source>
-        <translation>Var 1 s</translation>
+        <translation type="unfinished">Var 1 s</translation>
     </message>
     <message>
         <source>Every 2 s</source>
-        <translation>Var 2 s</translation>
+        <translation type="unfinished">Var 2 s</translation>
     </message>
     <message>
         <source>Every 5 s</source>
-        <translation>Var 5 s</translation>
+        <translation type="unfinished">Var 5 s</translation>
     </message>
     <message>
         <source>Every 10 s</source>
-        <translation>Var 10 s</translation>
+        <translation type="unfinished">Var 10 s</translation>
     </message>
     <message>
         <source>No Preview</source>
@@ -3097,61 +3432,61 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Update disabled</source>
-        <translation>Uppdatering inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No preview</source>
-        <translation>Ingen förhandsvisning</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsDisplay</name>
     <message>
         <source>Maximum Guest Screen &Size:</source>
-        <translation>Maximal storlek för gästs&kärm:</translation>
+        <translation type="unfinished">Maximal storlek för gästs&kärm:</translation>
     </message>
     <message>
         <source>&Width:</source>
-        <translation>&Bredd:</translation>
+        <translation type="unfinished">&Bredd:</translation>
     </message>
     <message>
         <source>Specifies the maximum width which we would like the guest to use.</source>
-        <translation>Anger maximal bredd som vi vill använda för gästskärmen.</translation>
+        <translation type="unfinished">Anger maximal bredd som vi vill använda för gästskärmen.</translation>
     </message>
     <message>
         <source>&Height:</source>
-        <translation>&Höjd:</translation>
+        <translation type="unfinished">&Höjd:</translation>
     </message>
     <message>
         <source>Specifies the maximum height which we would like the guest to use.</source>
-        <translation>Anger maximal höjd som vi vill använda för gästskärmen.</translation>
+        <translation type="unfinished">Anger maximal höjd som vi vill använda för gästskärmen.</translation>
     </message>
     <message>
         <source>Automatic</source>
         <comment>Maximum Guest Screen Size</comment>
-        <translation>Automatiskt</translation>
+        <translation type="unfinished">Automatiskt</translation>
     </message>
     <message>
         <source>Suggest a reasonable maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
-        <translation>Föreslå en rimlig maximal skärmstorlek för gästen. Gästen kommer endast att se detta förslag när gästtillägg har installerats.</translation>
+        <translation type="unfinished">Föreslå en rimlig maximal skärmstorlek för gästen. Gästen kommer endast att se detta förslag när gästtillägg har installerats.</translation>
     </message>
     <message>
         <source>None</source>
         <comment>Maximum Guest Screen Size</comment>
-        <translation>Ingen</translation>
+        <translation type="unfinished">Ingen</translation>
     </message>
     <message>
         <source>Do not attempt to limit the size of the guest screen.</source>
-        <translation>Försök inte att begränsa storleken för gästskärmen.</translation>
+        <translation type="unfinished">Försök inte att begränsa storleken för gästskärmen.</translation>
     </message>
     <message>
         <source>Hint</source>
         <comment>Maximum Guest Screen Size</comment>
-        <translation>Tips</translation>
+        <translation type="unfinished">Tips</translation>
     </message>
     <message>
         <source>Suggest a maximum screen size to the guest. The guest will only see this suggestion when guest additions are installed.</source>
-        <translation>Föreslå en maximal skärmstorlek för gästen. Gästen kommer endast att se detta förslag när gästtillägg har installerats.</translation>
+        <translation type="unfinished">Föreslå en maximal skärmstorlek för gästen. Gästen kommer endast att se detta förslag när gästtillägg har installerats.</translation>
     </message>
     <message>
         <source>Machine Windows:</source>
@@ -3210,7 +3545,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Extension Packages</source>
-        <translation>&Tilläggspaket</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3272,28 +3607,16 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Inaktivera &skärmsläckare på värddatorn</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>&Docka och menyrad:</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>Visa automatiskt i helskärm</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>När kryssad kommer värddatorns docka och menyrad att visas när en virtuell maskin körs i helskärmsläge.</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
-        <translation>Skärmsläckare för gäs&t:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, the host screensaver will be disabled whenever a virtual machine is running.</source>
-        <translation>När kryssad kommer värddatorns skärmsläckare att vara inaktiverad när en virtuell maskin körs.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Disable When Running Virtual Machines</source>
-        <translation>Inaktivera när virtuella maskiner körs</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3332,27 +3655,27 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Host Key Combination</source>
-        <translation>Värdtangentskombination</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Some items have the same shortcuts assigned.</source>
-        <translation>Några objekt har samma tilldelade genvägar.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translation>Hanterare för &VirtualBox</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &Machine</source>
-        <translation>Virtuell &maskin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all the available shortcuts which can be configured.</source>
-        <translation>Listar alla tillgängliga genvägar som kan konfigueras.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enter a sequence to filter the shortcut list.</source>
-        <translation>Ange en sekvens för att filtrera genvägslistan.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3411,7 +3734,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Interface Languages</source>
-        <translation>&Gränssnittsspråk</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3568,128 +3891,128 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&NAT Networks</source>
-        <translation>&NAT-nätverk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Lists all available NAT networks.</source>
-        <translation>Listar alla tillgängliga NAT-nätverk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Host-only Networks</source>
-        <translation>&Endast-värd-nätverk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No new name specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Inget nytt namn angivet för NAT-nätverket som tidigare kallades för <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translation>Ingen CIDR angiven för NAT-nätverket <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No CIDR specified for the NAT network previously called <b>%1</b>.</source>
-        <translation>Ingen CIDR angiven för NAT-nätverket som tidigare kallades för <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network <b>%2</b>.</source>
-        <translation>Ogiltig CIDR angiven (<i>%1</i>) för NAT-nätverket <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Invalid CIDR specified (<i>%1</i>) for the NAT network previously called <b>%2</b>.</source>
-        <translation>Ogiltig CIDR angiven (<i>%1</i>) för NAT-nätverket som tidigare kallades för <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Name</source>
-        <translation>Nätverksnamn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>[empty]</source>
-        <translation>[tom]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 (renamed from %2)</source>
-        <translation>%1 (döptes om från %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Old Network Name</source>
-        <translation>Gammalt nätverksnamn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New Network Name</source>
-        <translation>Nytt nätverksnamn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network CIDR</source>
-        <translation>Nätverkets CIDR</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports DHCP</source>
-        <translation>Stöd för DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>yes</source>
-        <translation>ja</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>no</source>
-        <translation>nej</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports IPv6</source>
-        <translation>Stöd för IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Default IPv6 route</source>
-        <translation>Standardrutt för IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 address.</source>
-        <translation>Värdgränssnittet <b>%1</b> har inte en giltig IPv4-adress.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv4 network mask.</source>
-        <translation>Värdgränssnittet <b>%1</b> har inte en giltig IPv4-nätverksmask.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid IPv6 address.</source>
-        <translation>Värdgränssnittet <b>%1</b> har inte en giltig IPv6-adress.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server address.</source>
-        <translation>Värdgränssnittet <b>%1</b> har inte en giltig DHCP-serveradress.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server mask.</source>
-        <translation>Värdgränssnittet <b>%1</b> har inte en giltig DHCP-servermask.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server lower address bound.</source>
-        <translation>Värdgränssnittet <b>%1</b> har inte en giltig nedre adressgräns för DHCP-servern.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host interface <b>%1</b> does not currently have a valid DHCP server upper address bound.</source>
-        <translation>Värdgränssnittet <b>%1</b> har inte en giltig övre adressgräns för DHCP-servern.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The name <b>%1</b> is being used for several NAT networks.</source>
-        <translation>Namnet <b>%1</b> används för flera NAT-nätverk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Active</source>
         <comment>NAT network</comment>
-        <translation>Aktiv</translation>
+        <translation type="unfinished">Aktiv</translation>
     </message>
     <message>
         <source>&Add NAT network</source>
-        <translation>&Lägg till NAT-nätverk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Remove NAT network</source>
-        <translation>&Ta bort NAT-nätverk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Edit NAT network</source>
-        <translation>R&edigera NAT-nätverk</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3791,177 +4114,177 @@ p, li { white-space: pre-wrap; }
     <name>UIGlobalSettingsNetworkDetailsHost</name>
     <message>
         <source>Host-only Network Details</source>
-        <translation>Detaljer för endast-värd-nätverk</translation>
+        <translation type="unfinished">Detaljer för endast-värd-nätverk</translation>
     </message>
     <message>
         <source>&Adapter</source>
-        <translation>&Adapter</translation>
+        <translation type="unfinished">&Adapter</translation>
     </message>
     <message>
         <source>Manual &Configuration</source>
-        <translation>Manuell &konfiguration</translation>
+        <translation type="unfinished">Manuell &konfiguration</translation>
     </message>
     <message>
         <source>Use manual configuration for this host-only network adapter.</source>
-        <translation>Använd manuell konfiguration för detta endast-värd-nätverksadapter.</translation>
+        <translation type="unfinished">Använd manuell konfiguration för detta endast-värd-nätverkskort.</translation>
     </message>
     <message>
         <source>&IPv4 Address:</source>
-        <translation>&IPv4-adress:</translation>
+        <translation type="unfinished">&IPv4-adress:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>Innehåller värdens IPv4-adress för denna adapter.</translation>
+        <translation type="unfinished">Visar värdens IPv4-adress för detta kort.</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
-        <translation>&Mask för IPv4-nätverk:</translation>
+        <translation type="unfinished">&Mask för IPv4-nätverk:</translation>
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>Innehåller värdens IPv4-nätverksmask för denna adapter.</translation>
+        <translation type="unfinished">Visar värdens IPv4-nätverksmask för detta kort.</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
-        <translation>I&Pv6-adress:</translation>
+        <translation type="unfinished">I&Pv6-adress:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>Innehåller värdens IPv6-adress för denna adapter om IPv6 stöds.</translation>
+        <translation type="unfinished">Visar värdens IPv6-adress för detta kort om IPv6 stöds.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
-        <translation>Mask&längd för IPv6-nätverk:</translation>
+        <translation type="unfinished">Mask&längd för IPv6-nätverk:</translation>
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>Innehåller prefixlängd för värdens IPv6-nätverksmask för denna adapter om IPv6 stöds.</translation>
+        <translation type="unfinished">Visar prefixlängd för värdens IPv6-nätverksmask för detta kort om IPv6 stöds.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
-        <translation>&DHCP-server</translation>
+        <translation type="unfinished">&DHCP-server</translation>
     </message>
     <message>
         <source>&Enable Server</source>
-        <translation>&Aktivera server</translation>
+        <translation type="unfinished">&Aktivera server</translation>
     </message>
     <message>
         <source>Indicates whether the DHCP Server is enabled on machine startup or not.</source>
-        <translation>Indikerar huruvida DHCP-servern är aktiverad vid maskinens uppstart eller inte.</translation>
+        <translation type="unfinished">Indikerar huruvida DHCP-servern är aktiverad vid maskinens uppstart eller inte.</translation>
     </message>
     <message>
         <source>Server Add&ress:</source>
-        <translation>Serverad&ress:</translation>
+        <translation type="unfinished">Serverad&ress:</translation>
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Innehåller adressen för DHCP-servern som är verksam på nätverket som är associerat med detta endast-värd-kort.</translation>
+        <translation type="unfinished">Visar adressen för DHCP-servern som är verksam på nätverket som är associerat med detta endast-värd-kort.</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
-        <translation>Server&mask:</translation>
+        <translation type="unfinished">Server&mask:</translation>
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Innehåller nätverksmasken för DHCP-servern som är verksam på nätverket som är associerat med detta endast-värd-kort.</translation>
+        <translation type="unfinished">Visar nätverksmasken för DHCP-servern som är verksam på nätverket som är associerat med detta endast-värd-kort.</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
-        <translation>&Nedre adressgräns:</translation>
+        <translation type="unfinished">&Nedre adressgräns:</translation>
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Innehåller den nedre adressgränsen som erbjuds av DHCP-servern som är verksam på nätverket som är associerat med detta endast-värd-kort.</translation>
+        <translation type="unfinished">Visar den nedre adressgränsen som erbjuds av DHCP-servern som är verksam på nätverket som är associerat med detta endast-värd-kort.</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
-        <translation>&Övre adressgräns:</translation>
+        <translation type="unfinished">&Övre adressgräns:</translation>
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>Innehåller den övre adressgränsen som erbjuds av DHCP-servern som är verksam på nätverket som är associerat med detta endast-värd-kort.</translation>
+        <translation type="unfinished">Visar den övre adressgränsen som erbjuds av DHCP-servern som är verksam på nätverket som är associerat med detta endast-värd-kort.</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsNetworkDetailsNAT</name>
     <message>
         <source>NAT Network Details</source>
-        <translation>Detaljer om NAT-nätverk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Network</source>
-        <translation>A&ktivera nätverk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable this NAT network.</source>
-        <translation>Aktivera detta NAT-nätverk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &Name:</source>
-        <translation>Nätverks&namn:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>Innehåller namnet för detta nätverk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
-        <translation>Nätverkets &CIDR:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>Innehåller CIDR för detta nätverk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network Options:</source>
-        <translation>Nätverksalternativ:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &DHCP</source>
-        <translation>Stöd för &DHCP</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports DHCP.</source>
-        <translation>Bestämmer huruvida detta nätverk har stöd för DHCP.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Supports &IPv6</source>
-        <translation>Stöd för &IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network supports IPv6.</source>
-        <translation>Bestämmer huruvida detta nätverk har stöd för IPv6.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translation>Annonsera standardrutt för I&Pv6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether this network should be advertised as the default IPv6 route.</source>
-        <translation>Bestämmer huruvida detta nätverk ska annonseras som standardrutt för IPv6.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Öppnar ett fönster för att hantera regler för omdirigering av portar.</translation>
+        <translation type="unfinished">Öppnar dialogrutan för att hantera regler för omdirigering av portar.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
-        <translation>Omdirigering av &portar</translation>
+        <translation type="unfinished">Omdirigering av &portar</translation>
     </message>
 </context>
 <context>
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>Regler för omdirigering av portar</translation>
+        <translation type="unfinished">Regler för omdirigering av portar</translation>
     </message>
     <message>
         <source>IPv4</source>
-        <translation>IPv4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>IPv6</source>
-        <translation>IPv6</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4016,11 +4339,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No proxy host is currently specified.</source>
-        <translation>Ingen proxyvärd har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No proxy port is currently specified.</source>
-        <translation>Ingen proxyport har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4085,71 +4408,71 @@ p, li { white-space: pre-wrap; }
     <name>UIHostComboEditor</name>
     <message>
         <source><key_%1></source>
-        <translation><tangent_%1></translation>
+        <translation type="unfinished"><tangent_%1></translation>
     </message>
     <message>
         <source>Left </source>
-        <translation>Vänster </translation>
+        <translation type="unfinished">Vänster</translation>
     </message>
     <message>
         <source>Right </source>
-        <translation>Höger </translation>
+        <translation type="unfinished">Höger</translation>
     </message>
     <message>
         <source>Left Shift</source>
-        <translation>Vänster Skift</translation>
+        <translation type="unfinished">Vänster Skift</translation>
     </message>
     <message>
         <source>Right Shift</source>
-        <translation>Höger Skift</translation>
+        <translation type="unfinished">Höger Skift</translation>
     </message>
     <message>
         <source>Left Ctrl</source>
-        <translation>Vänster Ctrl</translation>
+        <translation type="unfinished">Vänster Ctrl</translation>
     </message>
     <message>
         <source>Right Ctrl</source>
-        <translation>Höger Ctrl</translation>
+        <translation type="unfinished">Höger Ctrl</translation>
     </message>
     <message>
         <source>Left Alt</source>
-        <translation>Vänster Alt</translation>
+        <translation type="unfinished">Vänster Alt</translation>
     </message>
     <message>
         <source>Right Alt</source>
-        <translation>Höger Alt</translation>
+        <translation type="unfinished">Höger Alt</translation>
     </message>
     <message>
         <source>Left WinKey</source>
-        <translation>Vänster Win-tangent</translation>
+        <translation type="unfinished">Vänster Win-tangent</translation>
     </message>
     <message>
         <source>Right WinKey</source>
-        <translation>Höger Win-tangent</translation>
+        <translation type="unfinished">Höger Win-tangent</translation>
     </message>
     <message>
         <source>Menu key</source>
-        <translation>Menytangent</translation>
+        <translation type="unfinished">Menytangent</translation>
     </message>
     <message>
         <source>Alt Gr</source>
-        <translation>AltGr</translation>
+        <translation type="unfinished">AltGr</translation>
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>CapsLock</translation>
+        <translation type="unfinished">CapsLock</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
-        <translation>ScrollLock</translation>
+        <translation type="unfinished">ScrollLock</translation>
     </message>
     <message>
         <source>Host+</source>
-        <translation>Värd+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>None</source>
-        <translation>Ingen</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4336,22 +4659,22 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Reset shortcut to default</source>
-        <translation>Återställ genväg till standard</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unset shortcut</source>
-        <translation>Nollställ genväg</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIHotKeyTableModel</name>
     <message>
         <source>Name</source>
-        <translation>Namn</translation>
+        <translation type="unfinished">Namn</translation>
     </message>
     <message>
         <source>Shortcut</source>
-        <translation>Genväg</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4496,12 +4819,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indikerar aktiviteten för CD/DVD-enheterna:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indikerar aktiviteten för CD/DVD-enheterna:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Indikerar aktiviteten för diskettenheterna:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Indikerar aktiviteten för diskettenheterna:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4541,7 +4864,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB-styrkort är inaktiverat</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB-styrkort är inaktiverat</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4594,20 +4917,34 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Indicates video capturing activity:</nobr><br>%1</source>
-        <translation><nobr>Indikerar aktivitet för videofångst:</nobr><br>%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture disabled</b></nobr></source>
-        <translation><nobr><b>Videofångst inaktiverad</b></nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><nobr><b>Video capture file:</b> %1</nobr></source>
-        <translation><nobr><b>Fil för videofångst:</b> %1</nobr></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Additional feature status:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></source>
         <comment>Virtualization Stuff LED</comment>
-        <translation>Status för ytterligare funktioner:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4669,23 +5006,23 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Select a filename for the screenshot ...</source>
-        <translation>Välj ett filnamn för skärmbilden ...</translation>
+        <translation type="unfinished">Välj ett filnamn för skärmbilden ...</translation>
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>Inga anslutna webbkameror</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Inga webbkameror som stöds är anslutna till värddatorn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation>Anslut nätverksadapter</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation>Anslut nätverksadapter %1</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4727,7 +5064,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Grafik</translation>
+        <translation type="obsolete">&Grafik</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4843,134 +5180,198 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Video &Capture</source>
-        <translation>Video&fångst</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>När kryssad kommer VirtualBox att spela in den virtuella maskinens session som en videofil.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
-        <translation>A&ktivera videofångst</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &Path:</source>
-        <translation>Filsök&väg:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the filename VirtualBox uses to save the recorded content.</source>
-        <translation>Denna inställning bestämmer filnamnet som VirtualBox använder för att spara det inspelade materialet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Frame &Size:</source>
-        <translation>Bildst&orlek:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the resolution (frame size) of the recorded video.</source>
-        <translation>Denna inställning bestämmer upplösningen (bildstorlek) för inspelad video.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>horizontal</b> resolution (frame width) of the recorded video.</source>
-        <translation>Denna inställning bestämmer <b>horisontell</b> upplösning (bildbredd) för inspelad video.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>Denna inställning bestämmer <b>vertikal</b> upplösning (bildhöjd) för inspelad video.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
-        <translation>&Bildfrekvens:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the maximum number of <b>frames per second</b>. Additional frames will be skipped. Reducing this value will increase the number of skipped frames and reduce the file size.</source>
-        <translation>Denna inställning bestämmer maximalt antal <b>bilder per sekund</b>. Bilder som överstiger värdet kommer att förkastas. Minskning av detta värde kommer att öka antalet förkastade bilder och minska filstorleken.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Quality:</source>
-        <translation>Kva&litet:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the <b>quality</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Denna inställning bestämmer <b>kvaliteten</b>. Ökning av detta värde kommer att göra att videon ser bättre ut men filstorleken kan öka kraftigt.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>This setting determines the bitrate in <b>kilobits per second</b>. Increasing this value will make the video look better at the cost of an increased file size.</source>
-        <translation>Denna inställning bestämmer bitfrekvensen i <b>kilobit per sekund</b>. Ökning av detta värde kommer att göra att videon ser bättre ut men filstorleken kan öka kraftigt.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Screens:</source>
-        <translation>&Skärmar:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration. However the host system does not currently provide this, so you will not be able to start the machine.</source>
-        <translation>Den virtuella maskinen är konfigurerad att använda grafikacceleration i hårdvaran. Dock tillhandahåller inte värdsystemet detta så du kommer inte kunna att starta maskinen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required to switch to fullscreen or seamless mode.</source>
-        <translation>Den virtuella maskinen har tilldelats mindre än <b>%1</b> för grafikminne. Detta är det minsta värdet som krävs för att växla till helskärm eller sömlöst läge.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is currently assigned less than <b>%1</b> of video memory which is the minimum amount required for High Definition Video to be played efficiently.</source>
-        <translation>Den virtuella maskinen har tilldelats mindre än <b>%1</b> för grafikminne. Detta är det minsta värdet som krävs för att High Definition Video ska fungera effektivt.</translation>
-    </message>
-    <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>Den virtuella maskinen är konfigurerad att använda grafikacceleration i hårdvaran och operativsystemet är inställt till Windows Vista eller senare. För bästa prestanda så bör du ställa in maskinens grafikminne till minst <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
-        <translation>Den virtuella maskinen är konfigurerad att använda Video Stream Acceleration. Denna funktion kommer att inaktiveras eftersom den endast fungerar för Windows-gästsystem.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE server port value is not currently specified.</source>
-        <translation>Värdet för VRDE-serverport har inte angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The VRDE authentication timeout value is not currently specified.</source>
-        <translation>Tidsgränsvärdet för VRDE-autentisering har inte angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>User Defined</source>
-        <translation>Användardefinierad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1 fps</source>
-        <translation>%1 bilder/s</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>fps</source>
-        <translation>bilder/s</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>low</source>
         <comment>quality</comment>
-        <translation>låg</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>medium</source>
         <comment>quality</comment>
-        <translation>medel</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>high</source>
         <comment>quality</comment>
-        <translation>hög</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>kbps</source>
-        <translation>kbps</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Screen %1</source>
-        <translation>Skärm %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Enable video recording for screen %1.</source>
-        <translation>Aktivera videoinspelning för skärm %1.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Minimal verktygsrad:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Om kryssad, visa minimal verktygsrad i helskärmsläge och sömlöst läge.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">Visa i &helskärm/sömlöst läge</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Om kryssad kommer minimala verktygsraden att visas överst på skärmen istället för på dess standardposition längst ner på skärmen.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Visa övers&t på skärmen</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation>Fjärrskrivbord är för närvarande aktiverad för denna virtuella maskin. Dock kräver detta att <b>%1</b> installeras. Installera tilläggspaketet från VirtualBox webbplats, om inte så kommer din virtuella maskin att startas med fjärrskrivbord inaktiverat.</translation>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4984,8 +5385,8 @@ p, li { white-space: pre-wrap; }
         <translation>Visar sökvägen där ögonblicksbilder av den virtuella maskinen lagras. Observera att ögonblicksbilder kan ta upp en hel del diskutrymme.</translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>A&llmänt</translation>
+        <source>Basi&c</source>
+        <translation>&Grundläggande</translation>
     </message>
     <message>
         <source>Identification</source>
@@ -5036,7 +5437,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Kontrollerar den mängd grafikminne som tilldelas den virtuella maskinen.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Avancerat</translation>
     </message>
     <message>
@@ -5124,7 +5525,7 @@ p, li { white-space: pre-wrap; }
         <translation>Mapp för ö&gonblicksbilder:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Beskrivning</translation>
     </message>
     <message>
@@ -5137,7 +5538,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>När kryssad så kommer byte till monterat CD/DVD- eller diskettmedia som genomförs under maskinkörning att sparas i inställningsfilen för att behålla konfigurationen av monterade media mellan körningar.</translation>
+        <translation type="obsolete">När kryssad så kommer byte till monterat CD/DVD- eller diskettmedia som genomförs under maskinkörning att sparas i inställningsfilen för att behålla konfigurationen av monterade media mellan körningar.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -5189,51 +5590,147 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Flyttbart media:</translation>
+        <translation type="obsolete">Flyttbart media:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Kom ihåg körtidsändringar</translation>
+        <translation type="obsolete">&Kom ihåg körtidsändringar</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Minimal verktygsrad:</translation>
+        <translation type="obsolete">Minimal verktygsrad:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Om kryssad, visa minimal verktygsrad i helskärmsläge och sömlöst läge.</translation>
+        <translation type="obsolete">Om kryssad, visa minimal verktygsrad i helskärmsläge och sömlöst läge.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>Visa i &helskärm/sömlöst läge</translation>
+        <translation type="obsolete">Visa i &helskärm/sömlöst läge</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Om kryssad kommer minimala verktygsraden att visas överst på skärmen istället för på dess standardposition längst ner på skärmen.</translation>
+        <translation type="obsolete">Om kryssad kommer minimala verktygsraden att visas överst på skärmen istället för på dess standardposition längst ner på skärmen.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Visa övers&t på skärmen</translation>
+        <translation type="obsolete">Visa övers&t på skärmen</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">du har valt en 64-bitars operativsystemstyp för denna virtuella maskin. Eftersom sådana gästoperativsystem kräver maskinvirtualisering (VT-x/AMD-V) så kommer denna funktion att vara automatiskt aktiverad.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
-        <translation>&Dra och släpp:</translation>
+        <source>D&rag'n'Drop:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>Väljer vilket data som ska kopieras mellan gästen och värddatorn genom att dra och släppa. Denna funktion kräver att gästtillägg installeras i gästens operativsystem.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No name specified for the virtual machine.</source>
-        <translation>Inget namn har angivits för den virtuella maskinen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>Den virtuella maskinen är inställd till ett operativsystem med 64 bitar. Gästsystem med 64 bitar kräver hårdvaruvirtualisering. Detta kommer att aktiveras automatiskt om du bekräftar ändringen.</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">3D {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">3D {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Minimal verktygsrad:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Om kryssad, visa minimal verktygsrad i helskärmsläge och sömlöst läge.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">Visa i &helskärm/sömlöst läge</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Om kryssad kommer minimala verktygsraden att visas överst på skärmen istället för på dess standardposition längst ner på skärmen.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Visa övers&t på skärmen</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5280,7 +5777,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&MAC Address:</source>
-        <translation>Maski&nvaruadress:</translation>
+        <translation type="unfinished">Maski&nvaruadress:</translation>
     </message>
     <message>
         <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
@@ -5480,35 +5977,35 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>No bridged network adapter is currently selected.</source>
-        <translation>Ingen adapter för bryggat nätverk har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No internal network name is currently specified.</source>
-        <translation>Inget namn för internt nätverk har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No host-only network adapter is currently selected.</source>
-        <translation>Ingen adapter för endast-värd-nätverk har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No generic driver is currently selected.</source>
-        <translation>Ingen allmän drivrutin har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The MAC address must be 12 hexadecimal digits long.</source>
-        <translation>MAC-adressen måste vara hexadecimal och 12 siffror lång.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The second digit in the MAC address may not be odd as only unicast addresses are allowed.</source>
-        <translation>Den andra siffran i MAC-adressen får inte vara udda eftersom endast unicast-adresser tillåts.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No NAT network name is currently specified.</source>
-        <translation>Inget namn för NAT-nätverket har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>Innehåller namnet på det NAT-nätverk som detta nätverkskort kommer anslutas till. Du kan skapa och ta bort nätverk via de allmänna nätverksinställningarna i den virtuella maskinens inställningar.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5691,23 +6188,23 @@ parallel ports</comment>
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>Ingen IRQ har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Ingen I/O-port har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Två eller flera portar har samma inställningar.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Ingen portsökväg har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Den finns dubletter angivna i portsökvägarna.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -5878,10 +6375,6 @@ parallel ports</comment>
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Om kryssad kommer denna delade mapp att vara permanent.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>Fönster</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5933,11 +6426,11 @@ serial ports</comment>
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>När kryssad kommer röret angivet i fältet <b>Portsökväg</b> att skapas av den virtuella maskinen när den startas. Om inte kommer den virtuella maskinen att försöka använda det befintliga röret.</translation>
+        <translation type="obsolete">När kryssad kommer röret angivet i fältet <b>Portsökväg</b> att skapas av den virtuella maskinen när den startas. Om inte kommer den virtuella maskinen att försöka använda det befintliga röret.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>Skapa &rör</translation>
+        <translation type="obsolete">Skapa &rör</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5945,7 +6438,7 @@ serial ports</comment>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Visar sökvägen till serieportens rör på värden när porten arbetar i läget <b>Värdrör</b>, eller värdmaskinens serieenhetsnamn när porten arbetar i läget <b>Värdenhet</b>.</translation>
+        <translation type="obsolete">Visar sökvägen till serieportens rör på värden när porten arbetar i läget <b>Värdrör</b>, eller värdmaskinens serieenhetsnamn när porten arbetar i läget <b>Värdenhet</b>.</translation>
     </message>
     <message>
         <source>Port %1</source>
@@ -5954,7 +6447,7 @@ serial ports</comment>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>Port/Filsökvä&g:</translation>
+        <translation type="obsolete">Port/Filsökvä&g:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5964,6 +6457,22 @@ serial ports</comment>
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Visar I/O-basportadressen för denna serieport. Giltiga värden är heltal inom intervallet <tt>0</tt> till <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5981,23 +6490,23 @@ serial ports</comment>
     </message>
     <message>
         <source>No IRQ is currently specified.</source>
-        <translation>Ingen IRQ har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No I/O port is currently specified.</source>
-        <translation>Ingen I/O-port har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Two or more ports have the same settings.</source>
-        <translation>Två eller flera portar har samma inställningar.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No port path is currently specified.</source>
-        <translation>Ingen portsökväg har angivits.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There are currently duplicate port paths specified.</source>
-        <translation>Den finns dubletter angivna i portsökvägarna.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6092,15 +6601,15 @@ serial ports</comment>
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Lägg&nbsp;till&nbsp;CD/DVD-enhet</nobr></translation>
+        <translation type="obsolete"><nobr>Lägg&nbsp;till&nbsp;CD/DVD-enhet</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Lägg&nbsp;till&nbsp;diskettenhet</nobr></translation>
+        <translation type="obsolete"><nobr>Lägg&nbsp;till&nbsp;diskettenhet</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
-        <translation>Ingen hårddisk har valts för <i>%1</i>.</translation>
+        <translation type="unfinished">Ingen hårddisk har valts för <i>%1</i>.</translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -6140,11 +6649,11 @@ serial ports</comment>
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Lägg till CD/DVD-enhet</translation>
+        <translation type="obsolete">Lägg till CD/DVD-enhet</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Lägg till diskettenhet</translation>
+        <translation type="obsolete">Lägg till diskettenhet</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -6332,15 +6841,15 @@ serial ports</comment>
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD-&enhet:</translation>
+        <translation type="obsolete">CD/DVD-&enhet:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Välj en virtuell CD/DVD-skiva eller en fysisk enhet att använda med den virtuella enheten. Den virtuella maskinen kommer att se en skiva matas in i enheten med data i filen eller på skivan i den fysiska enheten som dess innehåll.</translation>
+        <translation type="obsolete">Välj en virtuell CD/DVD-skiva eller en fysisk enhet att använda med den virtuella enheten. Den virtuella maskinen kommer att se en skiva matas in i enheten med data i filen eller på skivan i den fysiska enheten som dess innehåll.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Konfigurera den virtuella CD/DVD-enheten</translation>
+        <translation type="obsolete">Konfigurera den virtuella CD/DVD-enheten</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -6364,7 +6873,7 @@ serial ports</comment>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Välj en virtuell CD/DVD-skivfil...</translation>
+        <translation type="obsolete">Välj en virtuell CD/DVD-skivfil...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -6438,27 +6947,71 @@ serial ports</comment>
     </message>
     <message>
         <source>Controller: %1</source>
-        <translation>Styrkort: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>No name is currently specified for the controller at position <b>%1</b>.</source>
-        <translation>Inget namn har angivits för styrkortet på plats <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The controller at position <b>%1</b> has the same name as the controller at position <b>%2</b>.</source>
-        <translation>Styrkortet på plats <b>%1</b> har samma namn som styrkortet på plats <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><i>%1</i> is using a disk that is already attached to <i>%2</i>.</source>
-        <translation><i>%1</i> använder en disk som redan anslutits till <i>%2</i>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>Maskinen har fler lagringsstyrkort tilldelade än vad ett %1-chipset har stöd för. Ändra typ av chipset i systeminställningarna eller minska antalet av följande lagringsstyrkort i lagringsinställningarna: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Add USB Controller</source>
-        <translation type="obsolete">Lägg till USB-styrkort</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6616,7 +7169,7 @@ serial ports</comment>
     </message>
     <message>
         <source>Enable &EFI (special OSes only)</source>
-        <translation>Aktivera &EFI (endast specifika operativsystem)</translation>
+        <translation>Aktivera &EFI (endast speciella OS)</translation>
     </message>
     <message>
         <source>If checked, the RTC device will report the time in UTC, otherwise in local (host) time. Unix usually expects the hardware clock to be set to UTC.</source>
@@ -6682,47 +7235,55 @@ serial ports</comment>
     </message>
     <message>
         <source>&Pointing Device:</source>
-        <translation>&Pekdon:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Bestämmer huruvida det emulerade pekdonet är en PS/2-standardmus, en USB-musplatta eller en USB-musplatta med multi-touch.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
-        <translation>Mer än <b>%1%</b> av värddatorns minne (<b>%2</b>) har tilldelats den virtuella maskinen. Det inte finns tillräckligt mycket minne kvar för värdens operativsystem. Välj ett mindre värde.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. There might not be enough memory left for the host operating system. Please consider selecting a smaller amount.</source>
-        <translation>Mer än <b>%1%</b> av värddatorns minne (<b>%2</b>) har tilldelats den virtuella maskinen. Det kan innebära att det inte finns tillräckligt mycket minne kvar för värdens operativsystem. Överväg att minska detta värde.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>I/O APIC-funktionen är för närvarande inte aktiverad i Moderkort-delen på sidan System. Detta krävs för att ge stöd för chipset av typen ICH9. Detta kan göras automatiskt om du bekräftar dina ändringar.</translation>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>Emulering av USB-styrkort är för närvarande inte aktiverat på USB-sidan. Detta krävs för att ge stöd för en emulerad USB-inmatningsenhet. Det kan göras automatiskt om du bekräftar dina ändringar.</translation>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation>Av prestandaskäl så får inte antalet virtuella processorer anslutna till den virtuella maskinen vara mer än dubbelt det antal fysiska processorer som värden (<b>%1</b>) har. Minska därför antalet virtuella processorer.</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation>Fler virtuella processorer har tilldelats den virtuella maskinen än antalet fysiska processorer på värdsystemet (<b>%1</b>). Detta kan ge degraderad prestanda för din virtuella maskin. Överväg att minska antalet virtuella processorer.</translation>
+        <source>&Paravirtualization Interface:</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>I/O APIC-funktionen är för närvarande inte aktiverad i Moderkort-delen på sidan System. Detta krävs för att ge stöd för fler än en virtuell processor. Detta kan göras automatiskt om du bekräftar dina ändringar.</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Hårdvaruvirtualisering är för närvarande inte aktiverat i Acceleration-delen på sidan System. Detta krävs för att ge stöd för fler än en virtuell processor. Det kan göras automatiskt om du bekräftar dina ändringar.</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>Processorns exekveringsgräns är inställd till ett lågt värde. Detta kan göras att maskinen känns långsam att svara.</translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6794,7 +7355,7 @@ serial ports</comment>
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Aktivera USB 2.0-styrkort (E&HCI)</translation>
+        <translation type="obsolete">Aktivera USB 2.0-styrkort (E&HCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6857,8 +7418,28 @@ serial ports</comment>
         <translation type="obsolete">USB 2.0 är för närvarande aktiverat för denna virtuella maskin. Dock kräver detta att <b>%1</b> installeras. Installera Extension Pack (tilläggspaket) från VirtualBox webbplats. Efter det kommer du att kunna återaktivera USB 2.0. Det kommer att vara inaktiverat under tiden såvida inte du avbryter de aktuella inställningsändringarna.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 är för närvarande aktiverat för denna virtuella maskin. Dock kräver detta att <b>%1</b> installeras. Installera Extension Pack (tilläggspaket) från VirtualBox webbplats eller inaktivera USB 2.0 för att kunna starta maskinen.</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6967,7 +7548,7 @@ serial ports</comment>
     <name>UIMachineWindow</name>
     <message>
         <source> EXPERIMENTAL build %1r%2 - %3</source>
-        <translation> EXPERIMENTELL byggnation %1r%2 - %3</translation>
+        <translation type="unfinished"> EXPERIMENTELL byggnation %1r%2 - %3</translation>
     </message>
 </context>
 <context>
@@ -6981,15 +7562,15 @@ serial ports</comment>
     <name>UIMediumManager</name>
     <message>
         <source>&Hard drives</source>
-        <translation>&Hårddiskar</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Optical disks</source>
-        <translation>&Optiska diskar</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Floppy disks</source>
-        <translation>&Disketter</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Select</source>
@@ -6997,9 +7578,13 @@ serial ports</comment>
     </message>
     <message>
         <source>C&lose</source>
-        <translation>S&täng</translation>
+        <translation type="obsolete">S&täng</translation>
     </message>
-</context>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
 <context>
     <name>UIMediumTypeChangeDialog</name>
     <message>
@@ -7016,6 +7601,29 @@ serial ports</comment>
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Stäng</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Växla</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -7057,7 +7665,7 @@ serial ports</comment>
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Misslyckades med att skapa VirtualBox COM-objekt.</p><p>Programmet kommer nu att avslutas.</p></translation>
+        <translation type="obsolete"><p>Misslyckades med att skapa VirtualBox COM-objekt.</p><p>Programmet kommer nu att avslutas.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -7338,8 +7946,8 @@ serial ports</comment>
         <translation type="obsolete"><p>Det virtuella maskinfönstret är optimerat till att arbeta i <b>%1-bitars</b> färgläge men färgkvaliteten för den virtuella displayen är för närvarande inställd till <b>%2&nbsp;bitar</b>.</p><p>Öppna dialogrutan för displayegenskaper i gästoperativsystemet och välj ett <b>%3-bitars</b> färgläge, om det finns tillgängligt, för bästa tänkbara prestanda för det virtuella grafiksystemet.</p&gt [...]
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation type="obsolete"><p>Ett kritiskt fel har inträffat vid körning av den virtuella maskinen och maskinkörningen har stoppats.</p><p>Se Community-sektionen på <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> för mer hjälp eller ditt supportkontrakt. Tillhandahåll innehållet i loggfilen <tt>VBox.log</tt> och bildfilen <tt>VBox.png</tt>, vilka du kan hitta i katalogen <nobr><b>%1</b>&lt [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Ett kritiskt fel har inträffat vid körning av den virtuella maskinen och maskinkörningen har stoppats.</p><p>Se Community-sektionen på <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> för mer hjälp eller ditt supportkontrakt. Tillhandahåll innehållet i loggfilen <tt>VBox.log</tt> och bildfilen <tt>VBox.png</tt>, vilka du kan hitta i katalogen <nobr><b>%1</b></ [...]
     </message>
     <message>
         <source><p>You didn't attach a hard disk to the new virtual machine. The machine will not be able to boot unless you attach a hard disk with a guest operating system or some other bootable media to it later using the machine settings window or the First Run Wizard.</p><p>Do you wish to continue?</p></source>
@@ -7620,8 +8228,8 @@ serial ports</comment>
         <translation type="obsolete">Visa en dialogruta med produktinformation</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>En ny version av VirtualBox har släppts! Version <b>%1</b> finns tillgänglig på <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Du kan hämta ner denna version från denna direktlänk:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>En ny version av VirtualBox har släppts! Version <b>%1</b> finns tillgänglig på <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Du kan hämta ner denna version från denna direktlänk:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7721,7 +8329,7 @@ serial ports</comment>
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>En eller flera virtuella hårddiskar, CD/DVD- eller diskettmedia är inte tillgängliga för närvarande. Du kommer därför inte att kunna använda virtuella maskiner som använder dessa media förrän de blir åtkomliga.</p><p>Tryck på <b>Kontrollera</b> för att öppna Hanterare för virtuella media och se vilket media som är oåtkomligt, eller tryck på <b>Ignorera</b> för att ignorera detta meddelande.</p></translation>
+        <translation type="obsolete"><p>En eller flera virtuella hårddiskar, CD/DVD- eller diskettmedia är inte tillgängliga för närvarande. Du kommer därför inte att kunna använda virtuella maskiner som använder dessa media förrän de blir åtkomliga.</p><p>Tryck på <b>Kontrollera</b> för att öppna Hanterare för virtuella media och se vilket media som är oåtkomligt, eller tryck på <b>Ignorera</b> för att ignorera detta meddelande.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -7751,8 +8359,8 @@ serial ports</comment>
         <translation type="obsolete">Skriv &över</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Ett kritiskt fel har inträffat vid körning av den virtuella maskinen och därför har maskinkörningen stoppats.</p><p>För hjälp kan du se avsnittet Community på <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> eller ditt supportkontrakt. Tillhandahåll innehållet i loggfilen <tt>VBox.log</tt> och bildfilen <tt>VBox.png</tt> som du kan hitta i katalogen <nobr><b>%1</b></nobr&gt [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Ett kritiskt fel har inträffat vid körning av den virtuella maskinen och därför har maskinkörningen stoppats.</p><p>För hjälp kan du se avsnittet Community på <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> eller ditt supportkontrakt. Tillhandahåll innehållet i loggfilen <tt>VBox.log</tt> och bildfilen <tt>VBox.png</tt> som du kan hitta i katalogen <nobr><b>%1</b&g [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -8035,7 +8643,7 @@ serial ports</comment>
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Är du säker på att du vill ta bort CD/DVD-enheten?</p><p>Du kommer inte att kunna montera några CD- eller ISO-avbildningar eller installera Gästtillägg utan den!</p></translation>
+        <translation type="obsolete"><p>Är du säker på att du vill ta bort CD/DVD-enheten?</p><p>Du kommer inte att kunna montera några CD- eller ISO-avbildningar eller installera Gästtillägg utan den!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -8138,7 +8746,7 @@ serial ports</comment>
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Du är på väg att lägga till en ny CD/DVD-enhet till styrkortet <b>%1</b>.</p><p>Vill du välja en virtuell CD/DVD-skiva att lägga i enheten eller lämna den tom för stunden?</p></translation>
+        <translation type="obsolete"><p>Du är på väg att lägga till en ny CD/DVD-enhet till styrkortet <b>%1</b>.</p><p>Vill du välja en virtuell CD/DVD-skiva att lägga i enheten eller lämna den tom för stunden?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -8160,11 +8768,11 @@ serial ports</comment>
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Misslyckades med att koppla från CD/DVD-enheten (<nobr><b>%1</b></nobr>) från platsen <i>%2</i> för maskinen <b>%3</b>.</translation>
+        <translation type="obsolete">Misslyckades med att koppla från CD/DVD-enheten (<nobr><b>%1</b></nobr>) från platsen <i>%2</i> för maskinen <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Misslyckades med att koppla från diskettenheten (<nobr><b>%1</b></nobr>) från platsen <i>%2</i> för maskinen <b>%3</b>.</translation>
+        <translation type="obsolete">Misslyckades med att koppla från diskettenheten (<nobr><b>%1</b></nobr>) från platsen <i>%2</i> för maskinen <b>%3</b>.</translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
@@ -8207,11 +8815,11 @@ serial ports</comment>
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Misslyckades med att ansluta CD/DVD-enheten (<nobr><b>%1</b></nobr>) till platsen <i>%2</i> för maskinen <b>%3</b>.</translation>
+        <translation type="obsolete">Misslyckades med att ansluta CD/DVD-enheten (<nobr><b>%1</b></nobr>) till platsen <i>%2</i> för maskinen <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Misslyckades med att ansluta diskettenheten (<nobr><b>%1</b></nobr>) till platsen <i>%2</i> för maskinen <b>%3</b>.</translation>
+        <translation type="obsolete">Misslyckades med att ansluta diskettenheten (<nobr><b>%1</b></nobr>) till platsen <i>%2</i> för maskinen <b>%3</b>.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
@@ -8410,15 +9018,15 @@ serial ports</comment>
     </message>
     <message>
         <source><p>You are about to remove following inaccessible virtual machines from the machine list:</p><p>%1</p><p>Do you wish to proceed?</p></source>
-        <translation><p>Du är på väg att ta bort följande oåtkomliga virtuella maskiner från maskinlistan:</p><p>%1</p><p>Vill du fortsätta?</p></translation>
+        <translation type="unfinished"><p>Du är på väg att ta bort följande oåtkomliga virtuella maskiner från maskinlistan:</p><p>%1</p><p>Vill du fortsätta?</p></translation>
     </message>
     <message>
         <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well? Doing this will also remove the files containing the machine's virtual hard disks if they are not in use by another machine.</p></source>
-        <translation><p>Du är på väg att ta bort följande virtuella maskiner från maskinlistan:</p><p>%1</p><p>Vill du även ta bort filerna som innehåller den virtuella maskinen från din hårddisk? Genom att göra det så tas även filerna bort som innehåller maskinens virtuella hårddiskar, om de inte används av en annan maskin.</p></translation>
+        <translation type="unfinished"><p>Du är på väg att ta bort följande virtuella maskiner från maskinlistan:</p><p>%1</p><p>Vill du även ta bort filerna som innehåller den virtuella maskinen från din hårddisk? Genom att göra det så tas även filerna bort som innehåller maskinens virtuella hårddiskar, om de inte används av en annan maskin.</p></translation>
     </message>
     <message>
         <source><p>You are about to remove following virtual machines from the machine list:</p><p>%1</p><p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p></source>
-        <translation><p>Du är på väg att ta bort följande virtuella maskiner från maskinlistan:</p><p>%1</p><p>Vill du även ta bort filerna som innehåller den virtuella maskinen från din hårddisk?</p></translation>
+        <translation type="unfinished"><p>Du är på väg att ta bort följande virtuella maskiner från maskinlistan:</p><p>%1</p><p>Vill du även ta bort filerna som innehåller den virtuella maskinen från din hårddisk?</p></translation>
     </message>
     <message>
         <source><p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p><p>You should download and install version %3 of this extension pack from Oracle!</p></source>
@@ -8431,7 +9039,7 @@ serial ports</comment>
     </message>
     <message>
         <source>Do you wish to cancel all current network operations?</source>
-        <translation>Vill du avbryta alla aktuella nätverksåtgärder?</translation>
+        <translation type="unfinished">Vill du avbryta alla aktuella nätverksåtgärder?</translation>
     </message>
     <message>
         <source>Do you wish to cancel all current network operations or leave them running in the background?</source>
@@ -8452,7 +9060,7 @@ serial ports</comment>
     <message>
         <source>ACPI Shutdown</source>
         <comment>machine</comment>
-        <translation>ACPI Stäng av</translation>
+        <translation type="unfinished">ACPI Stäng av</translation>
     </message>
     <message>
         <source><p>Do you really want to power off the virtual machine?</p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
@@ -8461,15 +9069,15 @@ serial ports</comment>
     <message>
         <source>Power Off</source>
         <comment>machine</comment>
-        <translation>Stäng av</translation>
+        <translation type="unfinished">Stäng av</translation>
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Misslyckades med att släppa data.</translation>
+        <translation type="obsolete">Misslyckades med att släppa data.</translation>
     </message>
     <message>
         <source><p>Failed to initialize COM because the VirtualBox global configuration directory <b><nobr>%1</nobr></b> is not accessible. Please check the permissions of this directory and of its parent directory.</p><p>The application will now terminate.</p></source>
-        <translation><p>Misslyckades med att initiera COM därför att den allmänna konfigurationskatalogen <b><nobr>%1</nobr></b> för VirtualBox inte är tillgänglig. Kontrollera behörigheten för denna katalog och dess föräldrakatalog.</p><p>Programmet kommer nu att avslutas.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
@@ -8481,67 +9089,67 @@ serial ports</comment>
     </message>
     <message>
         <source><p>You are about to remove following virtual machine items from the machine list:</p><p><b>%1</b></p><p>Do you wish to proceed?</p></source>
-        <translation><p>Du är på väg att ta bort följande virtuella maskinobjekt från maskinlistan:</p><p>%1</p><p>Vill du fortsätta?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p><p>Please check that this folder really exists and that you have permissions to remove it.</p></source>
-        <translation><p>Kan inte ta bort maskinmappen <nobr><b>%1</b>.</nobr></p><p>Kontrollera att denna mapp finns och att du har behörighet att ta bort den.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p><p>This folder already exists and possibly belongs to another machine.</p></source>
-        <translation><p>Kan inte skapa maskinmappen <b>%1</b> i föräldramappen <nobr><b>%2</b>.</nobr></p><p>Denna mapp finns redan och kan möjligtvis användas av en annan maskin.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>You are about to create a new virtual machine without a hard drive. You will not be able to install an operating system on the machine until you add one. In the mean time you will only be able to start the machine using a virtual optical disk or from the network.</source>
-        <translation>Du är på väg att skapa en ny virtuell maskin utan en hårddisk. Du kommer inte att kunna installera ett operativsystem på maskinen tills du lägger till en hårddisk. Du kommer för tillfället endast att kunna starta maskinen med en virtuell optisk disk eller från nätverket.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
-        <translation><p>Är du säker på att du vill förkasta det sparade tillståndet för följande virtuella maskiner?</p><p><b>%1</b></p><p>Den här åtgärden är samma som att starta om eller stänga av maskinen utan att göra en korrekt avstängning i gästoperativsystemet.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Do you really want to reset the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
-        <translation><p>Vill du verkligen starta om följande virtuella maskiner?</p><p><b>%1</b></p><p>Detta gör att allt osparat data i program som körs inuti den kommer att gå förlorat.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Do you really want to send an ACPI shutdown signal to the following virtual machines?</p><p><b>%1</b></p></source>
-        <translation><p>Vill du verkligen skicka en ACPI Stäng av-signal till följande virtuella maskiner?</p><p><b>%1</b></p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Do you really want to power off the following virtual machines?</p><p><b>%1</b></p><p>This will cause any unsaved data in applications running inside it to be lost.</p></source>
-        <translation><p>Vill du verkligen stänga av följande virtuella maskiner?</p><p><b>%1</b></p><p>Detta gör att allt osparat data i program som körs inuti den kommer att gå förlorat.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are trying to move machine <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p><p>Please resolve this name-conflict and try again.</p></source>
-        <translation><p>Du försöker att flytta maskinen <nobr><b>%1</b></nobr> till gruppen <nobr><b>%2</b></nobr> som redan innehåller undergruppen <nobr><b>%1</b></nobr>.</p><p>Korrigera denna namnkonflikt och försök igen.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are trying to move group <nobr><b>%1</b></nobr> to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p><p>Would you like to automatically rename it?</p></source>
-        <translation><p>Du försöker att flytta gruppen <nobr><b>%1</b></nobr> till gruppen <nobr><b>%2</b></nobr> som redan innehåller ett objekt med samma namn.</p><p>Vill du automatiskt byta namn på den?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Rename</source>
-        <translation>Byt namn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p><p>You can create a snapshot of the current state of the virtual machine first by checking the box below; if you do not do this the current state will be permanently lost. Do you wish to proceed?</p></source>
-        <translation></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p></source>
-        <translation><p>Är du säker på att du vill återskapa ögonblicksbilden <nobr><b>%1</b></nobr>?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to set groups of the virtual machine <b>%1</b>.</source>
-        <translation>Misslyckades med att ställa in grupper för den virtuella maskinen <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not start the machine <b>%1</b> because the following physical network interfaces were not found:</p><p><b>%2</b></p><p>You can either change the machine's network settings or stop the machine.</p></source>
-        <translation><p>Kunde inte starta maskinen <b>%1</b> därför att följande fysiska nätverkskort inte hittades:</p><p><b>%2</b></p><p>Du kan antingen ändra maskinens nätverksinställningar eller stoppa maskinen.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Change Network Settings</source>
-        <translation>Ändra nätverksinställningar</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Close Virtual Machine</source>
@@ -8549,240 +9157,328 @@ serial ports</comment>
     </message>
     <message>
         <source><p>Cannot start the VirtualBox Manager due to local restrictions.</p><p>The application will now terminate.</p></source>
-        <translation><p>Kan inte starta VirtualBox Manager på grund av lokala begränsningar.</p><p>Programmet kommer nu att avslutas.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p><p>The language will be temporarily reset to the system default language. Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>Kunde inte hitta en språkfil för språket <b>%1</b> i katalogen <b><nobr>%2</nobr></b>.</p><p>Språket kommer att temporärt återställas till systemets standardspråk. Gå till dialogrutan <b>Inställningar</b> som du kan öppna från menyn <b>Arkiv</b> i VirtualBox huvudfönster, och välj ett av de befintliga språken på sidan <b>Språk</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not load the language file <b><nobr>%1</nobr></b>. <p>The language will be temporarily reset to English (built-in). Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p></source>
-        <translation><p>Kunde inte läsa in språkfilen <b><nobr>%1</nobr></b>. <p>Språket kommer att temporärt återställas till engelska (inbyggt). Gå till dialogrutan <b>Inställningar</b> som du kan öppna från menyn <b>Arkiv</b> i VirtualBox huvudfönster, välj sedan ett av de befintliga språken på sidan <b>Språk</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>There is no virtual machine with the identifier <b>%1</b>.</source>
-        <translation>Det finns ingen virtuell maskin med namnet <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Ignore</source>
-        <translation>Ignorera</translation>
+        <translation type="unfinished">Ignorera</translation>
     </message>
     <message>
         <source>Failed to create NAT network.</source>
-        <translation>Misslyckades med att skapa NAT-nätverk.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove NAT network <b>%1</b>.</source>
-        <translation>Misslyckades med att ta bort NAT-nätverket <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create DHCP server.</source>
-        <translation>Misslyckades med att skapa DHCP-server.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to remove DHCP server for network interface <b>%1</b>.</source>
-        <translation>Misslyckades med att ta bort DHCP-servern för nätverketskortet <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to create the host network interface.</source>
-        <translation>Misslyckades med att skapa värdnätverksgränssnittet.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create &new disk</source>
-        <translation>Skapa &ny disk</translation>
+        <translation type="unfinished">Skapa &ny disk</translation>
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>&Välj befintlig disk</translation>
+        <translation type="unfinished">&Välj befintlig disk</translation>
     </message>
     <message>
         <source>Leave &empty</source>
-        <translation>Lämna &tom</translation>
+        <translation type="unfinished">Lämna &tom</translation>
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>&Välj disk</translation>
+        <translation type="unfinished">&Välj disk</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Är du säker på att du vill frigöra den virtuella hårddisken <nobr><b>%1</b></nobr>?</p><p>Detta kommer att koppla loss den från följande virtuella maskin(er): <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Är du säker på att du vill frigöra den virtuella optiska disken <nobr><b>%1</b></nobr>?</p><p>Detta kommer att koppla loss den från följande virtuella maskin(er): <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
-        <translation><p>Är du säker på att du vill frigöra den virtuella disketten <nobr><b>%1</b></nobr>?</p><p>Detta kommer att koppla loss den från följande virtuella maskin(er): <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual hard disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Är du säker på att du vill ta bort den virtuella hårddisken <nobr><b>%1</b></nobr> från listan över kända diskavbildsfiler?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>As this hard disk is inaccessible its image file can not be deleted.</p></source>
-        <translation><p>Eftersom denna hårddisk inte är tillgänglig så kan inte dess avbildsfil tas bort.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual optical disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Är du säker på att du vill ta bort den virtuella optiska disken <nobr><b>%1</b></nobr> från listan över kända diskavbildsfiler?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to remove the virtual floppy disk <nobr><b>%1</b></nobr> from the list of known disk image files?</p></source>
-        <translation><p>Är du säker på att du vill ta bort den virtuella disketten <nobr><b>%1</b></nobr> från listan över kända diskavbildsfiler?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Kunde inte mata in den virtuella optiska disken <nobr><b>%1</b></nobr> i maskinen <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translation><p>Vill du försöka att tvinga inmatning av denna disk?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Kunde inte mata ut den virtuella optiska disken <nobr><b>%1</b></nobr> från maskinen <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Would you like to try to force ejection of this disk?</p></source>
-        <translation><p>Vill du försöka att tvinga utmatning av denna disk?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>Kunde inte mata in den virtuella disketten <nobr><b>%1</b></nobr> i maskinen <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
-        <translation><p>Kunde inte mata ut den virtuella disketten <nobr><b>%1</b></nobr> från maskinen <b>%2</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the hard disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Misslyckades med att öppna hårddiskfilen <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the optical disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Misslyckades med att öppna den optiska diskfilen <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to open the floppy disk file <nobr><b>%1</b></nobr>.</source>
-        <translation>Misslyckades med att öppna diskettfilen <nobr><b>%1</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the hard disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Misslyckades med att stänga hårddiskfilen <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the optical disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Misslyckades med att stänga den optiska diskfilen <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to close the floppy disk file <nobr><b>%2</b></nobr>.</source>
-        <translation>Misslyckades med att stänga diskettfilen <nobr><b>%2</b></nobr>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
-        <translation>
-            <numerusform><p>Följande %n virtuella maskiner befinner sig i ett sparat tillstånd: <b>%1</b></p><p>Om du fortsätter så kommer körtidstillståndet för de exporterade maskinerna att förkastas. Observera att de andra maskinerna inte kommer att ändras.</p></numerusform>
-            <numerusform><p>Följande %n virtuella maskiner befinner sig i ett sparat tillstånd: <b>%1</b></p><p>Om du fortsätter så kommer körtidstillståndet för de exporterade maskinerna att förkastas. Observera att de andra maskinerna inte kommer att ändras.</p></numerusform>
+        <translation type="unfinished">
+            <numerusform><p>Virtuella maskinen <b>%1</b> befinner sig i ett sparat tillstånd.</p><p>Om du fortsätter så kommer körtidstillståndet för de exporterade maskinerna att förkastas. Observera att de befintliga maskinerna inte kommer att ändras.</p></numerusform>
+            <numerusform><p>Virtuella maskinerna <b>%1</b> befinner sig i ett sparat tillstånd.</p><p>Om du fortsätter så kommer körtidstillståndet för de exporterade maskinerna att förkastas. Observera att de befintliga maskinerna inte kommer att ändras.</p></numerusform>
         </translation>
     </message>
     <message>
         <source>Switch</source>
-        <translation>Växla</translation>
+        <translation type="unfinished">Växla</translation>
     </message>
     <message>
         <source>Failed to enable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>Misslyckades med att aktivera fjärrskrivbordsservern för den virtuella maskinen <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable the remote desktop server for the virtual machine <b>%1</b>.</source>
-        <translation>Misslyckades med att inaktivera fjärrskrivbordsservern för den virtuella maskinen <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to enable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>Misslyckades med att aktivera videofångst för den virtuella maskinen <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to disable video capturing for the virtual machine <b>%1</b>.</source>
-        <translation>Misslyckades med att inaktivera videofångst för den virtuella maskinen <b>%1</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p><p>Do you wish to download this disk image file from the Internet?</p></source>
-        <translation><p>Kunde inte hitta diskavbildsfilen för <b>VirtualBox gästtillägg</b>.</p><p>Vill du hämta denna diskavbildsfil från Internet?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Download</source>
-        <translation>Hämta</translation>
+        <translation type="unfinished">Hämta</translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Är du säker på att du vill hämta diskavbildsfilen för <b>VirtualBox gästtillägg</b> från <nobr><a href="%1">%1</a></nobr> (storlek %2 byte)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>Diskavbildsfilen för <b>VirtualBox gästtillägg</b> har hämtats från <nobr><a href="%1">%1</a></nobr> men kan inte sparas lokalt som <nobr><b>%2</b>.</nobr></p><p>Välj en annan plats att spara filen på.</p></translation>
-    </message>
-    <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>Diskavbildsfilen för <b>VirtualBox gästtillägg</b> har hämtats ner från <nobr><a href="%1">%1</a></nobr> och sparats lokalt som <nobr><b>%2</b>.</nobr></p><p>Vill du registrera den här diskavbildsfilen och mata in den i den virtuella CD/DVD-enheten?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>Kunde inte mata in diskavbildsfilen för <b>VirtualBox gästtillägg</b> i den virtuella maskinen <b>%1</b>, eftersom maskinen inte har någon cd/dvd-enhet. Lägg till en enhet under Lagring i inställningarna för den virtuella maskinen.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
-        <translation><p>Kunde inte hitta <b>Handboken för VirtualBox</b> <nobr><b>%1</b>.</nobr></p><p>Vill du hämta denna fil från Internet?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Are you sure you want to download the <b>VirtualBox User Manual</b> from <nobr><a href="%1">%1</a></nobr> (size %2 bytes)?</p></source>
-        <translation><p>Är du säker på att du vill hämta <b>Handboken för VirtualBox</b> från <nobr><a href="%1">%1</a></nobr> (storlek %2 byte)?</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> but can't be saved locally as <nobr><b>%2</b>.</nobr></p><p>Please choose another location for that file.</p></source>
-        <translation><p>Användarhandboken för VirtualBox har hämtats från <nobr><a href="%1">%1</a></nobr> men kan inte sparas lokalt som <nobr><b>%2</b>.</nobr></p><p>Välj en annan plats för denna fil.</p></translation>
+        <translation type="unfinished"><p>Användarhandboken för VirtualBox har hämtats från <nobr><a href="%1">%2</a></nobr> men kan inte sparas lokalt som <nobr><b>%3</b>.</nobr></p><p>Välj en annan plats för denna fil.</p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>Användarhandboken för VirtualBox har hämtats från <nobr><a href="%1">%1</a></nobr> och sparats lokalt som <nobr><b>%2</b>.</nobr></p></translation>
+        <translation type="unfinished"><p>Användarhandboken för VirtualBox har hämtats från <nobr><a href="%1">%2</a></nobr> och sparats lokalt som <nobr><b>%3</b>.</nobr></p> {1"?} {1<?} {2<?}</translation>
     </message>
     <message>
         <source>Close</source>
-        <translation>Stäng</translation>
+        <translation type="unfinished">Stäng</translation>
     </message>
     <message>
         <source>Ok</source>
-        <translation>Ok</translation>
+        <translation type="unfinished">Ok</translation>
     </message>
     <message>
         <source>Do not show this message again</source>
-        <translation>Visa inte det här meddelandet igen</translation>
+        <translation type="unfinished">Visa inte det här meddelandet igen</translation>
     </message>
     <message>
         <source><p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p><p>If this network is in use by one or more virtual machine network adapters these adapters will no longer be usable until you correct their settings by either choosing a different network name or a different adapter attachment type.</p></source>
-        <translation><p>Vill du ta bort NAT-nätverket <nobr><b>%1</b>?</nobr></p><p>Om detta nätverk används av en eller flera nätverksadaptrar så kommer dessa inte längre att vara användbara tills du har korrigerat inställningarna, antingen genom att välja ett annan nätverksnamn eller en annan adaptertyp.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>Misslyckades med att ansluta webbkameran <b>%1</b> till den virtuella maskinen <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>Misslyckades med att koppla från webbkameran <b>%1</b> från den virtuella maskinen <b>%2</b>.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>VirtualBox gästtillägg verkar inte finnas tillgänglig på denna virtuella maskin och delade mappar kan inte användas utan dem. För att använda delade mappar inne i den virtuella maskinen så måste gästtillägg installeras. Installera om dem om de inte fungerar korrekt genom att välja <b>Mata in cd-avbild för gästtillägg</b> från menyn <b>Enheter</b>. Om de är installerade men maskinen inte är helt uppstartad så kan delade mappar bli till [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
         <comment>additions</comment>
-        <translation>Mata in</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>Den virtuella skärmen är för närvarande inställd till <b>%1-bitars</b> färgläge. Ändra detta till <b>%2&nbsp;bitar</b> för bättre prestanda. Detta kan oftast göras från avsnittet <b>Skärm</b> i gästoperativsystemets kontrollpanel eller systeminställningar.</p></translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8845,19 +9541,19 @@ serial ports</comment>
     <name>UIMiniToolBar</name>
     <message>
         <source>Always show the toolbar</source>
-        <translation>Visa alltid verktygsraden</translation>
+        <translation type="unfinished">Visa alltid verktygsraden</translation>
     </message>
     <message>
         <source>Minimize Window</source>
-        <translation>Minimera fönstret</translation>
+        <translation type="unfinished">Minimera fönstret</translation>
     </message>
     <message>
         <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Avsluta helskämsläge eller sömlöst läge</translation>
+        <translation type="unfinished">Avsluta helskämsläge eller sömlöst läge</translation>
     </message>
     <message>
         <source>Close VM</source>
-        <translation>Stäng virtuell maskin</translation>
+        <translation type="unfinished">Stäng virtuell maskin</translation>
     </message>
 </context>
 <context>
@@ -8874,28 +9570,28 @@ serial ports</comment>
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
-        <translation>&Namn:</translation>
+        <source>N&ame:</source>
+        <translation type="unfinished">&Namn:</translation>
     </message>
     <message>
         <source>Holds the name of the virtual machine.</source>
-        <translation>Innehåller namnet på den virtuella maskinen.</translation>
+        <translation type="unfinished">Visar namnet på den virtuella maskinen.</translation>
     </message>
     <message>
         <source>&Type:</source>
-        <translation>&Typ:</translation>
+        <translation type="unfinished">&Typ:</translation>
     </message>
     <message>
         <source>Selects the operating system family that you plan to install into this virtual machine.</source>
-        <translation>Väljer familj av operativsystem som du planerar att installera på denna virtuella maskin.</translation>
+        <translation type="unfinished">Visar operativsystemsfamiljen som du planerar att installera på denna virtuella maskin.</translation>
     </message>
     <message>
         <source>&Version:</source>
-        <translation>&Version:</translation>
+        <translation type="unfinished">&Version:</translation>
     </message>
     <message>
         <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation>Väljer typ av operativsystem som du planerar att installera på denna virtuella maskin (så kallat gästoperativsystem).</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -8937,19 +9633,19 @@ serial ports</comment>
     <name>UINetworkManagerDialog</name>
     <message>
         <source>Network Operations Manager</source>
-        <translation>Hanterare för nätverksåtgärder</translation>
+        <translation type="unfinished">Hanterare för nätverksåtgärder</translation>
     </message>
     <message>
         <source>There are no active network operations.</source>
-        <translation>Det finns inga aktiva nätverksåtgärder.</translation>
+        <translation type="unfinished">Det finns inga aktiva nätverksåtgärder.</translation>
     </message>
     <message>
         <source>&Cancel All</source>
-        <translation>A&vbryt alla</translation>
+        <translation type="unfinished">A&vbryt alla</translation>
     </message>
     <message>
         <source>Cancel all active network operations</source>
-        <translation>Avbryt alla aktiva nätverksåtgärder</translation>
+        <translation type="unfinished">Avbryt alla aktiva nätverksåtgärder</translation>
     </message>
     <message>
         <source>Error: %1.</source>
@@ -8957,66 +9653,66 @@ serial ports</comment>
     </message>
     <message>
         <source>Network Operation</source>
-        <translation>Nätverksåtgärd</translation>
+        <translation type="unfinished">Nätverksåtgärd</translation>
     </message>
     <message>
         <source>Restart network operation</source>
-        <translation>Starta om nätverksåtgärd</translation>
+        <translation type="unfinished">Starta om nätverksåtgärd</translation>
     </message>
     <message>
         <source>Cancel network operation</source>
-        <translation>Avbryt nätverksåtgärd</translation>
+        <translation type="unfinished">Avbryt nätverksåtgärd</translation>
     </message>
     <message>
         <source>The network operation failed with the following error: %1.</source>
-        <translation>Nätverksåtgärden misslyckades med följande fel: %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UINetworkManagerIndicator</name>
     <message>
         <source>Current network operations:</source>
-        <translation>Aktuella nätverksåtgärder:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>failed</source>
         <comment>network operation</comment>
-        <translation>misslyckades</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>(%1 of %2)</source>
-        <translation>(%1 av %2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Double-click for more information.</source>
-        <translation>Dubbelklicka för mer information.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UINetworkReplyPrivate</name>
     <message>
         <source>Host not found</source>
-        <translation>Värden hittades inte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Content access denied</source>
-        <translation>Innehållsåtkomst nekades</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Protocol failure</source>
-        <translation>Protokollfel</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Wrong SSL certificate format</source>
-        <translation>Felaktigt SSL-certifikatformat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>SSL authentication failed</source>
-        <translation>SSL-autentisering misslyckades</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unknown reason</source>
-        <translation>Okänd anledning</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9783,7 +10479,7 @@ serial ports</comment>
     <name>UIPopupCenter</name>
     <message>
         <source>Click for full details</source>
-        <translation>Klicka för fullständiga detaljer</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9902,28 +10598,32 @@ serial ports</comment>
     <name>UISelectorWindow</name>
     <message>
         <source>Show Toolbar</source>
-        <translation>Visa verktygsrad</translation>
+        <translation type="unfinished">Visa verktygsrad</translation>
     </message>
     <message>
         <source>Show Statusbar</source>
-        <translation>Visa statusrad</translation>
+        <translation type="unfinished">Visa statusrad</translation>
     </message>
     <message>
         <source>Select a virtual machine file</source>
-        <translation>Välj en virtuell maskin-fil</translation>
+        <translation type="unfinished">Välj en virtuell maskin-fil</translation>
     </message>
     <message>
         <source>Virtual machine files (%1)</source>
-        <translation>Virtuella maskin-filer (%1)</translation>
+        <translation type="unfinished">Virtuella maskin-filer (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Välkommen till VirtualBox!</h3><p>På den vänstra sidan av detta fönster finns en lista över alla virtuella maskiner på din dator. Listan är tom just nu därför att du inte har skapat några virtuella maskiner än.<img src=:/welcome.png align=right/></p><p>Tryck på knappen <b>Ny</b> i huvudverktygsraden i överkanten av fönstret för att skapa en ny virtuell maskin.</p><p>Du kan trycka på tangenten <b>%1 [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Välkommen till VirtualBox!</h3><p>På den vänstra sidan av detta fönster finns en lista över alla virtuella maskiner på din dator. Listan är tom just nu därför att du inte har skapat några virtuella maskiner än.<img src=:/welcome.png align=right/></p><p>Tryck på knappen <b>Ny</b> i huvudverktygsraden i överkanten av fönstret för att skapa en ny virtuell maskin.</p><p>Du kan trycka på tange [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
-        <translation>Manager</translation>
+        <translation type="unfinished">Hanterare</translation>
+    </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9934,7 +10634,7 @@ serial ports</comment>
     </message>
     <message>
         <source>Updating Guest Additions</source>
-        <translation>Uppdaterar gästtillägg</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -9957,15 +10657,15 @@ serial ports</comment>
     </message>
     <message>
         <source>Settings</source>
-        <translation>Inställningar</translation>
+        <translation type="obsolete">Inställningar</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
-        <translation><b>%1</b> sida:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><b>%1: %2</b> page:</source>
-        <translation><b>%1: %2</b> sida:</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10008,7 +10708,11 @@ serial ports</comment>
     </message>
     <message>
         <source>Display</source>
-        <translation>Skärm</translation>
+        <translation type="unfinished">Skärm</translation>
+    </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10085,6 +10789,43 @@ serial ports</comment>
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">du använder för närvarande fler lagringsstyrkort än vad ett %1-chipset har stöd för. Ändra typ av chipset i systeminställningarna eller minska antalet av följande lagringsstyrkort i lagringsinställningarna: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Inställningar</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Stäng</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -10196,8 +10937,8 @@ serial ports</comment>
         <translation type="obsolete">Sammandrag</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>En ny version av VirtualBox har släppts! Version <b>%1</b> finns tillgänglig på <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Du kan hämta ner denna version från denna direktlänk:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>En ny version av VirtualBox har släppts! Version <b>%1</b> finns tillgänglig på <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Du kan hämta ner denna version från denna direktlänk:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -10216,7 +10957,7 @@ serial ports</comment>
     <name>UIUpdateStepVirtualBox</name>
     <message>
         <source>Checking for a new VirtualBox version...</source>
-        <translation>Letar efter en ny version av VirtualBox...</translation>
+        <translation type="unfinished">Letar efter en ny version av VirtualBox...</translation>
     </message>
 </context>
 <context>
@@ -10265,6 +11006,14 @@ serial ports</comment>
         <source>&Restore current snapshot '%1'</source>
         <translation>&Återställ aktuell ögonblicksbild "%1"</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -10281,7 +11030,7 @@ serial ports</comment>
     <name>UIVMInfoDialog</name>
     <message>
         <source>%1 - Session Information</source>
-        <translation type="obsolete">%1 - Sessionsinformation</translation>
+        <translation>%1 - Sessionsinformation</translation>
     </message>
     <message>
         <source>&Details</source>
@@ -10293,35 +11042,35 @@ serial ports</comment>
     </message>
     <message>
         <source>DMA Transfers</source>
-        <translation type="obsolete">DMA-överföringar</translation>
+        <translation>DMA-överföringar</translation>
     </message>
     <message>
         <source>PIO Transfers</source>
-        <translation type="obsolete">PIO-överföringar</translation>
+        <translation>PIO-överföringar</translation>
     </message>
     <message>
         <source>Data Read</source>
-        <translation type="obsolete">Data läst</translation>
+        <translation>Data läst</translation>
     </message>
     <message>
         <source>Data Written</source>
-        <translation type="obsolete">Data skriven</translation>
+        <translation>Data skriven</translation>
     </message>
     <message>
         <source>Data Transmitted</source>
-        <translation type="obsolete">Data överförd</translation>
+        <translation>Data överförd</translation>
     </message>
     <message>
         <source>Data Received</source>
-        <translation type="obsolete">Data mottagen</translation>
+        <translation>Data mottagen</translation>
     </message>
     <message>
         <source>Runtime Attributes</source>
-        <translation type="obsolete">Körtidsattribut</translation>
+        <translation>Körtidsattribut</translation>
     </message>
     <message>
         <source>Screen Resolution</source>
-        <translation type="obsolete">Skärmupplösning</translation>
+        <translation>Skärmupplösning</translation>
     </message>
     <message>
         <source>CD/DVD Statistics</source>
@@ -10339,20 +11088,20 @@ serial ports</comment>
     <message>
         <source>Not Detected</source>
         <comment>guest additions</comment>
-        <translation type="obsolete">Inte identifierad</translation>
+        <translation>Inte identifierad</translation>
     </message>
     <message>
         <source>Not Detected</source>
         <comment>guest os type</comment>
-        <translation type="obsolete">Inte identifierad</translation>
+        <translation>Inte identifierad</translation>
     </message>
     <message>
         <source>Guest Additions</source>
-        <translation type="obsolete">Gästtillägg</translation>
+        <translation>Gästtillägg</translation>
     </message>
     <message>
         <source>Guest OS Type</source>
-        <translation type="obsolete">Typ av gästoperativsystem</translation>
+        <translation>Typ av gästoperativsystem</translation>
     </message>
     <message>
         <source>Hard Disk Statistics</source>
@@ -10364,7 +11113,7 @@ serial ports</comment>
     </message>
     <message>
         <source>No Network Adapters</source>
-        <translation type="obsolete">Inga nätverksadaptrar</translation>
+        <translation>Inga nätverksadaptrar</translation>
     </message>
     <message>
         <source>Enabled</source>
@@ -10391,15 +11140,15 @@ serial ports</comment>
     </message>
     <message>
         <source>Storage Statistics</source>
-        <translation type="obsolete">Lagringsstatistik</translation>
+        <translation>Lagringsstatistik</translation>
     </message>
     <message>
         <source>No Storage Devices</source>
-        <translation type="obsolete">Inga lagringsenheter</translation>
+        <translation>Inga lagringsenheter</translation>
     </message>
     <message>
         <source>Network Statistics</source>
-        <translation type="obsolete">Nätverksstatistik</translation>
+        <translation>Nätverksstatistik</translation>
     </message>
     <message>
         <source>Nested Paging</source>
@@ -10409,27 +11158,31 @@ serial ports</comment>
     <message>
         <source>Not Available</source>
         <comment>details report (VRDE server port)</comment>
-        <translation type="obsolete">Inte tillgänglig</translation>
+        <translation>Inte tillgänglig</translation>
     </message>
     <message>
         <source>Clipboard Mode</source>
-        <translation type="obsolete">Urklippsläge</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="obsolete">Dra och släpp-läge</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Configuration &Details</source>
-        <translation type="obsolete">Konfigurations&detaljer</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Runtime Information</source>
-        <translation type="obsolete">&Körtidsinformation</translation>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIVMListView</name>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
         <translation>Oåtkomlig</translation>
@@ -10485,67 +11238,67 @@ serial ports</comment>
     </message>
     <message>
         <source>&Save</source>
-        <translation>S&para</translation>
+        <translation type="unfinished">S&para</translation>
     </message>
     <message>
         <source>&Refresh</source>
-        <translation>&Uppdatera</translation>
+        <translation type="unfinished">&Uppdatera</translation>
     </message>
     <message>
         <source>%1 - VirtualBox Log Viewer</source>
-        <translation>%1 - VirtualBox loggvisare</translation>
+        <translation type="unfinished">%1 - VirtualBox loggvisare</translation>
     </message>
     <message>
         <source><p>No log files found. Press the <b>Refresh</b> button to rescan the log folder <nobr><b>%1</b></nobr>.</p></source>
-        <translation><p>Inga loggfiler hittades. Tryck på knappen <b>Uppdatera</b> för att söka igenom loggmappen <nobr><b>%1</b></nobr> igen.</p></translation>
+        <translation type="unfinished"><p>Inga loggfiler hittades. Tryck på knappen <b>Uppdatera</b> för att söka igenom loggmappen <nobr><b>%1</b></nobr> igen.</p></translation>
     </message>
     <message>
         <source>Save VirtualBox Log As</source>
-        <translation>Spara VirtualBox-logg som</translation>
+        <translation type="unfinished">Spara VirtualBox-logg som</translation>
     </message>
     <message>
         <source>&Find</source>
-        <translation>&Sök</translation>
+        <translation type="unfinished">&Sök</translation>
     </message>
     <message>
         <source>Close</source>
-        <translation>Stäng</translation>
+        <translation type="unfinished">Stäng</translation>
     </message>
     <message>
         <source>Close the search panel</source>
-        <translation>Stäng sökpanelen</translation>
+        <translation type="unfinished">Stäng sökpanelen</translation>
     </message>
     <message>
         <source>Enter a search string here</source>
-        <translation>Ange en söksträng här</translation>
+        <translation type="unfinished">Ange en söksträng här</translation>
     </message>
     <message>
         <source>&Previous</source>
-        <translation>&Föregående</translation>
+        <translation type="unfinished">&Föregående</translation>
     </message>
     <message>
         <source>Search for the previous occurrence of the string</source>
-        <translation>Sök efter tidigare förekomst av strängen</translation>
+        <translation type="unfinished">Sök efter föregående förekomst av strängen</translation>
     </message>
     <message>
         <source>&Next</source>
-        <translation>&Nästa</translation>
+        <translation type="unfinished">&Nästa</translation>
     </message>
     <message>
         <source>Search for the next occurrence of the string</source>
-        <translation>Sök efter nästa förekomst av strängen</translation>
+        <translation type="unfinished">Sök efter nästa förekomst av strängen</translation>
     </message>
     <message>
         <source>C&ase Sensitive</source>
-        <translation>Skiftläges&känslig</translation>
+        <translation type="unfinished">Skiftläges&känslig</translation>
     </message>
     <message>
         <source>Perform case sensitive search (when checked)</source>
-        <translation>Genomför skiftlägeskänslig sökning (om kryssad)</translation>
+        <translation type="unfinished">Genomför skiftlägeskänslig sökning (om kryssad)</translation>
     </message>
     <message>
         <source>String not found</source>
-        <translation>Strängen hittades inte</translation>
+        <translation type="unfinished">Strängen hittades inte</translation>
     </message>
 </context>
 <context>
@@ -10582,434 +11335,442 @@ serial ports</comment>
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
-        <translation>Dölj beskrivning</translation>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
-        <translation>Visa beskrivning</translation>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardCloneVD</name>
     <message>
         <source>Copy Virtual Hard Drive</source>
-        <translation>Kopiera virtuell hårddisk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Copy</source>
-        <translation>Kopiera</translation>
+        <translation type="unfinished">Kopiera</translation>
     </message>
     <message>
         <source>Hard drive to copy</source>
-        <translation>Hårddisk att kopiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please select the virtual hard drive file that you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select one.</p></source>
-        <translation><p>Välj den virtuella hårddiskfilen som du vill kopiera om den inte redan har valts. Du kan antingen välja från listan eller använda mappikonen bredvid listan för att välja en.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual hard drive file to copy...</source>
-        <translation>Välj en virtuell hårddiskfil att kopiera...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hard drive file type</source>
-        <translation>Typ av hårddiskfil</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Välj den typ av fil som du vill använda för den nya virtuella hårddisken. Om du inte behöver att använda den med andra virtualiseringsprogram så kan du lämna denna inställning oförändrad.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Storage on physical hard drive</source>
-        <translation>Lagring på fysisk hårddisk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>Välj huruvida den nya virtuella hårddiskfilen ska växa när den används (dynamiskt allokerad) eller om den ska skapas med dess maximala storlek (fast storlek).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
-        <translation><p>En hårddiskfil som är <b>dynamiskt allokerad</b> kommer endast att använda utrymme på din fysiska hårddisk när den fylls upp (upp till maximal <b>fast storlek</b>), dock kommer den inte att minska igen när utrymme frigörs på den.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
-        <translation><p>En hårddiskfil med <b>fast storlek</b> kan ta längre tid att skapa på vissa system men är oftast snabbare att använda.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
-        <translation><p>Du kan även välja att <b>dela upp</b> hårddiskfilen i flera filer på upp till två gigabyte vardera. Detta är oftast användbart om du önskar att lagra den virtuella maskinen på flyttbara USB-enheter eller äldre system, vilka kan ha problem att hantera mycket stora filer.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Dynamically allocated</source>
-        <translation>&Dynamiskt allokerad</translation>
+        <translation type="unfinished">&Dynamiskt allokerad</translation>
     </message>
     <message>
         <source>&Fixed size</source>
-        <translation>&Fast storlek</translation>
+        <translation type="unfinished">&Fast storlek</translation>
     </message>
     <message>
         <source>&Split into files of less than 2GB</source>
-        <translation>&Dela upp i filer mindre än 2 GB</translation>
+        <translation type="unfinished">&Dela upp i filer mindre än 2 GB</translation>
     </message>
     <message>
         <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Välj en plats för den nya virtuella hårddiskfilen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New hard drive to create</source>
-        <translation>Ny hårddisk att skapa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
-        <translation>Ange namnet på den nya virtuella hårddiskfilen i rutan nedan eller klicka på mappikonen för att välja en annan mapp att skapa filen i.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a location for new virtual hard drive file...</source>
-        <translation>Välj en plats för den nya virtuella hårddiskfilen...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>%1_copy</source>
         <comment>copied virtual hard drive name</comment>
-        <translation>%1_kopia</translation>
+        <translation type="unfinished">%1_kopia</translation>
     </message>
     <message>
         <source>Hard drive to &copy</source>
-        <translation>Hårddisk att &kopiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&New hard drive to create</source>
-        <translation>&Ny hårddisk att skapa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hard drive file &type</source>
-        <translation>&Typ av hårddiskfil</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardCloneVM</name>
     <message>
         <source>Linked Base for %1 and %2</source>
-        <translation>Länkad bas för %1 och %2</translation>
+        <translation type="unfinished">Länkad bas för %1 och %2</translation>
     </message>
     <message>
         <source>Clone Virtual Machine</source>
-        <translation>Klona virtuell maskin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Clone</source>
-        <translation>Klona</translation>
+        <translation type="unfinished">Klona</translation>
     </message>
     <message>
         <source>%1 Clone</source>
-        <translation>%1-klon</translation>
+        <translation type="unfinished">%1-klon</translation>
     </message>
     <message>
         <source>New machine name</source>
-        <translation>Nytt maskinnamn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please choose a name for the new virtual machine. The new machine will be a clone of the machine <b>%1</b>.</p></source>
-        <translation><p>Välj ett namn för den nya virtuella maskinen. Den nya maskinen kommer att bli en klon av maskinen <b>%1</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>When checked a new unique MAC address will be assigned to all configured network cards.</source>
-        <translation>När kryssad kommer en ny unik MAC-adress att tilldelas till alla konfigurerade nätverkskort.</translation>
+        <translation type="unfinished">När kryssad kommer en ny unik MAC-adress att tilldelas till alla konfigurerade nätverkskort.</translation>
     </message>
     <message>
         <source>&Reinitialize the MAC address of all network cards</source>
-        <translation>Åt&erinitiera MAC-adressen på alla nätverkskort</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Clone type</source>
-        <translation>Klontyp</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please choose the type of clone you wish to create.</p><p>If you choose <b>Full clone</b>, an exact copy (including all virtual hard drive files) of the original virtual machine will be created.</p><p>If you choose <b>Linked clone</b>, a new machine will be created, but the virtual hard drive files will be tied to the virtual hard drive files of original machine and you will not be able to move the new virtual machi [...]
-        <translation><p>Välj den typ av klon som du vill skapa.</p><p>Om du väljer <b>Fullständig klon</b> så kommer en exakt kopia (inklusive alla virtuella hårddiskfiler) av den ursprungliga virtuella maskinen att skapas.</p><p>Om du väljer <b>Länkad klon</b> så kommer en ny maskin att skapas, men de virtuella hårddiskfiler kommer att knytas till de virtuella hårddiskfilerna för ursprungsmaskinen och du kommer inte kunna att flytta  [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you create a <b>Linked clone</b> then a new snapshot will be created in the original virtual machine as part of the cloning process.</p></source>
-        <translation><p>Om du skapar en <b>Länkad klon</b> så kommer en ny ögonblicksbild att skapas i den ursprungliga virtuella maskinen som en del av kloningsprocessen.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Full clone</source>
-        <translation>&Fullständig klon</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Linked clone</source>
-        <translation>&Länkad klon</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Snapshots</source>
-        <translation>Ögonblicksbilder</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please choose which parts of the snapshot tree should be cloned with the machine.</p></source>
-        <translation></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you choose <b>Current machine state</b>, the new machine will reflect the current state of the original machine and will have no snapshots.</p></source>
-        <translation><p>Om du väljer <b>Aktuellt maskintillstånd</b> så kommer den nya maskinen att likna det aktuella tillståndet för originalmaskinen men inte ha några ögonblicksbilder.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you choose <b>Current snapshot tree branch</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the tree branch starting at the current state in the original machine.</p></source>
-        <translation><p>Om du väljer <b>Aktuell trädgrupp för ögonblicksbilder</b> så kommer den nya maskinen att likna det aktuella tillståndet för originalmaskinen och ha matchande ögonblicksbilder i trädgruppen, och börja med aktuellt tillstånd för originalmaskinen.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you choose <b>Everything</b>, the new machine will reflect the current state of the original machine and will have matching snapshots for all snapshots in the original machine.</p></source>
-        <translation><p>Om du väljer <b>Allting</b> så kommer den nya maskinen att likna det aktuella tillståndet för originalmaskinen och ha matchande ögonblicksbilder för alla ögonblicksbilder i originalmaskinen.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Current &machine state</source>
-        <translation>Aktuellt &maskintillstånd</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Current &snapshot tree branch</source>
-        <translation>Aktuell träd&grupp för ögonblicksbilder</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Everything</source>
-        <translation>A&llting</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>New machine &name</source>
-        <translation>Nytt maskin&namn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Full Clone</source>
-        <translation>&Fullständig klon</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Linked Clone</source>
-        <translation>&Länkad klon</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportApp</name>
     <message>
         <source>Checking files ...</source>
-        <translation>Kontrollerar filer ...</translation>
+        <translation type="unfinished">Kontrollerar filer ...</translation>
     </message>
     <message>
         <source>Removing files ...</source>
-        <translation>Tar bort filer ...</translation>
+        <translation type="unfinished">Tar bort filer ...</translation>
     </message>
     <message>
         <source>Exporting Appliance ...</source>
-        <translation>Exporterar appliance ...</translation>
+        <translation type="unfinished">Exporterar appliance ...</translation>
     </message>
     <message>
         <source>Export Virtual Appliance</source>
-        <translation>Exportera virtuell appliance</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Restore Defaults</source>
-        <translation>Återställ till standardvärden</translation>
+        <translation type="unfinished">Återställ till standardvärden</translation>
     </message>
     <message>
         <source>Export</source>
-        <translation>Exportera</translation>
+        <translation type="unfinished">Exportera</translation>
     </message>
     <message>
         <source>Virtual machines to export</source>
-        <translation>Virtuella maskiner att exportera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please select the virtual machines that should be added to the appliance. You can select more than one. Please note that these machines have to be turned off before they can be exported.</p></source>
-        <translation><p>Välj de virtuella maskiner som ska läggas till i denna appliance. Du kan välja fler än en. Observera att dessa maskiner måste stängas av innan de kan exporteras.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Appliance settings</source>
-        <translation>Inställningar för appliance</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose where to create the virtual appliance. You can create it on your own computer, on the Sun Cloud service or on an S3 storage server.</source>
-        <translation>Välj var virtuell appliance ska skapas. Du kan skapa den på din egna dator, via tjänsten Sun Cloud eller på en S3-lagringsserver.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create on</source>
-        <translation>Skapa på</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&This computer</source>
-        <translation>&Denna dator</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Sun &Cloud</source>
-        <translation>Sun &Cloud</translation>
+        <translation type="unfinished">Sun &Cloud</translation>
     </message>
     <message>
         <source>&Simple Storage System (S3)</source>
-        <translation>&Simple Storage System (S3)</translation>
+        <translation type="unfinished">&Simple Storage System (S3)</translation>
     </message>
     <message>
         <source>Appliance</source>
-        <translation>Appliance</translation>
+        <translation type="unfinished">Appliance</translation>
     </message>
     <message>
         <source>&Username:</source>
-        <translation>&Användarnamn:</translation>
+        <translation type="unfinished">&Användarnamn:</translation>
     </message>
     <message>
         <source>&Password:</source>
-        <translation>&Lösenord:</translation>
+        <translation type="unfinished">&Lösenord:</translation>
     </message>
     <message>
         <source>&Hostname:</source>
-        <translation>&Värdnamn:</translation>
+        <translation type="unfinished">&Värdnamn:</translation>
     </message>
     <message>
         <source>&Bucket:</source>
-        <translation>&Bucket:</translation>
+        <translation type="unfinished">&Bucket:</translation>
     </message>
     <message>
         <source>&File:</source>
-        <translation>&Fil:</translation>
+        <translation type="unfinished">&Fil:</translation>
     </message>
     <message>
         <source>Open Virtualization Format Archive (%1)</source>
-        <translation>Open Virtualization Format Archive (%1)</translation>
+        <translation type="unfinished">Open Virtualization Format-arkiv (%1)</translation>
     </message>
     <message>
         <source>Open Virtualization Format (%1)</source>
-        <translation>Open Virtualization Format (%1)</translation>
+        <translation type="unfinished">Open Virtualization Format (%1)</translation>
     </message>
     <message>
         <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
-        <translation>Skriv i det äldre formatet OVF 0.9 för kompatibilitet med andra virtualiseringsprodukter.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create a Manifest file for automatic data integrity checks on import.</source>
-        <translation>Skapa en Manifest-fil för automatiska dataintegritetskontroller vid import.</translation>
+        <translation type="unfinished">Skapa en Manifest-fil för automatiska dataintegritetskontroller vid import.</translation>
     </message>
     <message>
         <source>Write &Manifest file</source>
-        <translation>Skriv &Manifest-fil</translation>
+        <translation type="unfinished">Skriv &Manifest-fil</translation>
     </message>
     <message>
         <source>This is the descriptive information which will be added to the virtual appliance.  You can change it by double clicking on individual lines.</source>
-        <translation>Detta är en beskrivande information som kommer att läggas till i virtuell appliance.  Du kan ändra den genom att dubbelklicka på individuella rader.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Virtual &machines to export</source>
-        <translation>Virtuella &maskiner att exportera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Appliance &settings</source>
-        <translation>Inställninga&r för appliance</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Destination</source>
-        <translation>&Mål</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Local Filesystem </source>
-        <translation>&Lokalt filsystem </translation>
+        <translation type="unfinished">&Lokalt filsystem </translation>
     </message>
     <message>
         <source>Storage settings</source>
-        <translation>Lagringsinställningar</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a file to export the virtual appliance to</source>
-        <translation>Välj en fil att exportera virtuell appliance till</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>F&ormat:</source>
-        <translation>F&ormat:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 0.9</source>
-        <translation>OVF 0.9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 1.0</source>
-        <translation>OVF 1.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>OVF 2.0</source>
-        <translation>OVF 2.0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in standard OVF 1.0 format.</source>
-        <translation>Skriv i standardformatet OVF 1.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Write in new experimental OVF 2.0 format.</source>
-        <translation>Skriv i nya experimentformatet OVF 2.0.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Storage settings</source>
-        <translation>La&gringsinställningar</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageBasic3</name>
     <message>
         <source><p>Please choose a filename to export the OVF/OVA to.</p><p>If you use an <i>ova</i> extension, then all the files will be combined into one Open Virtualization Format Archive.</p><p>If you use an <i>ovf</i> extension, several files will be written separately.</p><p>Other extensions are not allowed.</p></source>
-        <translation><p>Välj ett filnamn att exportera OVF/OVA-filen till.</p><p>Om du använder filändelsen <i>ova</i> så kommer alla filer att kombineras i ett Open Virtualization Format Archive.</p><p>Om du använder filändelsen <i>ovf</i> så kommer flera filer att skrivas separat.</p><p>Andra filändelser tillåts inte.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please complete the additional fields like the username, password and the bucket, and provide a filename for the OVF target.</source>
-        <translation>Färdigställ ytterligare fält såsom användarnamn, lösenord och bucket, samt ett filnamn för OVF-filen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please complete the additional fields like the username, password, hostname and the bucket, and provide a filename for the OVF target.</source>
-        <translation>Färdigställ ytterligare fält såsom användarnamn, lösenord, värdnamn och bucket, samt ett filnamn för OVF-filen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Välj en fil att exportera virtuell appliance till...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardExportAppPageExpert</name>
     <message>
         <source>Choose a file to export the virtual appliance to...</source>
-        <translation>Välj en fil att exportera virtuell appliance till...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardFirstRun</name>
     <message>
         <source>Select start-up disk</source>
-        <translation>Välj uppstartsdisk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Start</source>
-        <translation>Starta</translation>
+        <translation type="unfinished">Starta</translation>
     </message>
     <message>
         <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from and should contain the operating system you wish to install on the virtual machine if you want to do that now. The disk will be ejected from the virtual drive automatically next time you switch the virtual machine off, but you can also do this yourself if needed u [...]
-        <translation><p>Välj en virtuell optisk diskfil eller en fysisk optisk enhet som innehåller en disk för att starta upp din nya virtuella maskin från.</p><p>Disken bör vara lämplig för att starta upp en dator från och bör innehålla operativsystemet som du vill installera på den virtuella maskinen om du vill göra det nu. Disken kommer automatiskt att matas ut från den virtuella enheten nästa gång som du stänger av den virtuella maskinen, men du kan även göra detta [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from. As this virtual machine has no hard drive you will not be able to install an operating system on it at the moment.</p></source>
-        <translation><p>Välj en virtuell optisk diskfil eller en fysisk optisk enhet som innehåller en disk för att starta upp din nya virtuella maskin från.</p><p>Disken bör vara lämplig för att starta upp en dator från. Eftersom denna virtuella maskin inte har någon hårddisk så kommer du inte kunna att installera ett operativsystem på den för tillfället.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual optical disk file...</source>
-        <translation>Välj en virtuell optisk diskfil...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardImportApp</name>
     <message>
         <source>Restore Defaults</source>
-        <translation>Återställ till standardvärden</translation>
+        <translation type="unfinished">Återställ till standardvärden</translation>
     </message>
     <message>
         <source>Import</source>
-        <translation>Importera</translation>
+        <translation type="unfinished">Importera</translation>
     </message>
     <message>
         <source>Appliance to import</source>
-        <translation>Appliance att importera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>VirtualBox currently supports importing appliances saved in the Open Virtualization Format (OVF). To continue, select the file to import below.</p></source>
-        <translation><p>VirtualBox har stöd för att importera appliance som sparats i Open Virtualization Format (OVF). Välj en fil att importera för att fortsätta.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Select an appliance to import</source>
@@ -11017,121 +11778,121 @@ serial ports</comment>
     </message>
     <message>
         <source>Open Virtualization Format (%1)</source>
-        <translation>Open Virtualization Format (%1)</translation>
+        <translation type="unfinished">Open Virtualization Format (%1)</translation>
     </message>
     <message>
         <source>Appliance settings</source>
-        <translation>Inställningar för appliance</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>These are the virtual machines contained in the appliance and the suggested settings of the imported VirtualBox machines. You can change many of the properties shown by double-clicking on the items and disable others using the check boxes below.</source>
-        <translation>Detta är de virtuella maskiner som finns i denna appliance och de föredragna inställningarna för de importerade VirtualBox-maskinerna. Du kan ändra flera av egenskaperna som visas genom att dubbelklicka på objekten och inaktivera andra via kryssrutorna nedan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Import Virtual Appliance</source>
-        <translation>Importera virtuell appliance</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual appliance file to import...</source>
-        <translation>Välj en virtuell appliance-fil att importera...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual appliance file to import</source>
-        <translation>Välj en virtuell appliance-fil att importera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardNewVD</name>
     <message>
         <source>Create Virtual Hard Drive</source>
-        <translation>Skapa virtuell hårddisk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create</source>
-        <translation>Skapa</translation>
+        <translation type="unfinished">Skapa</translation>
     </message>
     <message>
         <source>Hard drive file type</source>
-        <translation>Typ av hårddiskfil</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Välj den typ av fil som du vill använda för den nya virtuella hårddisken. Om du inte behöver använda den med andra virtualiseringsprogram så kan du lämna denna inställning oförändrad.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Storage on physical hard drive</source>
-        <translation>Lagring på fysisk hårddisk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>Välj huruvida den nya virtuella hårddiskfilen ska växa när den används (dynamiskt allokerad) eller om den ska skapas med dess maximala storlek (fast storlek).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
-        <translation><p>En hårddiskfil som är <b>dynamiskt allokerad</b> kommer endast att använda utrymme på din fysiska hårddisk när den fylls upp (upp till maximal <b>fast storlek</b>), dock kommer den inte att minska igen när utrymme frigörs på den.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
-        <translation><p>En hårddiskfil med <b>fast storlek</b> kan ta längre tid att skapa på vissa system men är oftast snabbare att använda.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
-        <translation><p>Du kan även välja att <b>dela upp</b> hårddiskfilen i flera filer på upp till två gigabyte vardera. Detta är oftast användbart om du önskar att lagra den virtuella maskinen på flyttbara USB-enheter eller äldre system, vilka kan ha problem att hantera mycket stora filer.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Dynamically allocated</source>
-        <translation>&Dynamiskt allokerad</translation>
+        <translation type="unfinished">&Dynamiskt allokerad</translation>
     </message>
     <message>
         <source>&Fixed size</source>
-        <translation>&Fast storlek</translation>
+        <translation type="unfinished">&Fast storlek</translation>
     </message>
     <message>
         <source>&Split into files of less than 2GB</source>
-        <translation>&Dela upp i filer mindre än 2 GB</translation>
+        <translation type="unfinished">&Dela upp i filer mindre än 2 GB</translation>
     </message>
     <message>
         <source><nobr>%1 (%2 B)</nobr></source>
-        <translation><nobr>%1 (%2 B)</nobr></translation>
+        <translation type="unfinished"><nobr>%1 (%2 B)</nobr></translation>
     </message>
     <message>
         <source>File location and size</source>
-        <translation>Plats och storlek för fil</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
-        <translation>Välj ett namn för den nya virtuella hårddiskfilen i rutan nedan eller klicka på mappikonen för att välja en annan mapp att skapa filen i.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a location for new virtual hard drive file...</source>
-        <translation>Välj en plats för nya virtuella hårddiskfilen...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Select the size of the virtual hard drive in megabytes. This size is the limit on the amount of file data that a virtual machine will be able to store on the hard drive.</source>
-        <translation>Välj storlek för den virtuella hårddisk i megabyte. Denna storlek är den övre gränsen för det fildata som en virtuell maskin kommer att kunna lagra på hårddisken.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &location</source>
-        <translation>Pla&ts för fil</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>File &size</source>
-        <translation>Fil&storlek</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hard drive file &type</source>
-        <translation>&Typ av hårddiskfil</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>UIWizardNewVM</name>
     <message>
         <source>Create Virtual Machine</source>
-        <translation>Skapa virtuell maskin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Create</source>
-        <translation>Skapa</translation>
+        <translation type="unfinished">Skapa</translation>
     </message>
     <message>
         <source>IDE Controller</source>
@@ -11155,47 +11916,47 @@ serial ports</comment>
     </message>
     <message>
         <source>Name and operating system</source>
-        <translation>Namn och operativsystem</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</source>
-        <translation>Välj ett beskrivande namn för den nya virtuella maskinen och välj den typ av operativsystem som du planerar att installera på den. Namnet som du väljer kommer att användas i VirtualBox för att identifiera denna maskin.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Memory size</source>
-        <translation>Minnesstorlek</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>Select the amount of memory (RAM) in megabytes to be allocated to the virtual machine.</p><p>The recommended memory size is <b>%1</b> MB.</p></source>
-        <translation><p>Välj storlek på minnet (RAM) i megabyte som ska allokeras till den virtuella maskinen.</p><p>Rekommenderad minnesstorlek är <b>%1</b> MB.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Hard drive</source>
-        <translation>Hårddisk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source><p>If you wish you can add a virtual hard drive to the new machine. You can either create a new hard drive file or select one from the list or from another location using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step and make the changes to the machine settings once the machine is created.</p><p>The recommended size of the hard drive is <b>%1</b>.</p></source>
-        <translation><p>Om du så önskar så kan du lägga till en virtuell hårddisk till den nya maskinen. Du kan antingen skapa en ny hårddiskfil eller välja en från listan från andra platser med hjälp av mappikonen.</p><p>Om du behöver mer komplexa lagringskonfigurationer så kan du hoppa över detta steg och göra ändringarna i maskininställningarna när maskinen har skapats.</p><p>Rekommenderad storlek för hårddisken är <b>%1</b>.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Choose a virtual hard drive file...</source>
-        <translation>Välj en virtuell hårddiskfil...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Memory size</source>
-        <translation>&Minnesstorlek</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Do not add a virtual hard drive</source>
-        <translation>Lägg &inte till en virtuell hårddisk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Create a virtual hard drive now</source>
-        <translation>S&kapa en virtuell hårddisk nu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>&Use an existing virtual hard drive file</source>
-        <translation>A&nvänd en befintlig virtuell hårddiskfil</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12024,7 +12785,7 @@ Version %1</translation>
     </message>
     <message>
         <source>Choose...</source>
-        <translation>Välj...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12083,7 +12844,7 @@ Version %1</translation>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>Värdet för standardsökväg kommer att visas efter att ändringarna har godkänts och detta fönster öppnats igen.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -12438,7 +13199,7 @@ Version %1</translation>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -13297,17 +14058,17 @@ Version %1</translation>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Anslutning av denna hårddisk kommer att genomföras indirekt med en nyligen skapad skiljande hårddisk.</translation>
+        <translation type="obsolete">Anslutning av denna hårddisk kommer att genomföras indirekt med en nyligen skapad skiljande hårddisk.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Några av de media som finns på denna hårddiskkedja är inte åtkomliga. Använd Hanterare för virtuella media i <b>Visa skiljande hårddiskar</b>-läget för att inspektera dessa media.</translation>
+        <translation type="obsolete">Några av de media som finns på denna hårddiskkedja är inte åtkomliga. Använd Hanterare för virtuella media i <b>Visa skiljande hårddiskar</b>-läget för att inspektera dessa media.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Denna bashårddisk är indirekt ansluten med följande skiljande hårddisk:</translation>
+        <translation type="obsolete">Denna bashårddisk är indirekt ansluten med följande skiljande hårddisk:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -13353,7 +14114,7 @@ Version %1</translation>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -13628,357 +14389,486 @@ Version %1</translation>
     <message>
         <source>Disabled</source>
         <comment>DragAndDropType</comment>
-        <translation>Inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Host To Guest</source>
         <comment>DragAndDropType</comment>
-        <translation>Värd till gäst</translation>
+        <translation type="unfinished">Värd till gäst</translation>
     </message>
     <message>
         <source>Guest To Host</source>
         <comment>DragAndDropType</comment>
-        <translation>Gäst till värd</translation>
+        <translation type="unfinished">Gäst till värd</translation>
     </message>
     <message>
         <source>Bidirectional</source>
         <comment>DragAndDropType</comment>
-        <translation>Dubbelriktad</translation>
+        <translation type="unfinished">Dubbelriktad</translation>
     </message>
     <message>
         <source>Normal</source>
         <comment>MediumType</comment>
-        <translation>Normal</translation>
+        <translation type="unfinished">Normal</translation>
     </message>
     <message>
         <source>Immutable</source>
         <comment>MediumType</comment>
-        <translation>Oföränderlig</translation>
+        <translation type="unfinished">Oföränderlig</translation>
     </message>
     <message>
         <source>Writethrough</source>
         <comment>MediumType</comment>
-        <translation>Writethrough</translation>
+        <translation type="unfinished">Writethrough</translation>
     </message>
     <message>
         <source>Shareable</source>
         <comment>MediumType</comment>
-        <translation>Delningsbar</translation>
+        <translation type="unfinished">Delningsbar</translation>
     </message>
     <message>
         <source>Readonly</source>
         <comment>MediumType</comment>
-        <translation>Skrivskyddad</translation>
+        <translation type="unfinished">Skrivskyddad</translation>
     </message>
     <message>
         <source>Multi-attach</source>
         <comment>MediumType</comment>
-        <translation>Multi-attach</translation>
+        <translation type="unfinished">Multi-attach</translation>
     </message>
     <message>
         <source>Dynamically allocated storage</source>
         <comment>MediumVariant</comment>
-        <translation>Dynamiskt allokerad lagring</translation>
+        <translation type="unfinished">Dynamiskt allokerad lagring</translation>
     </message>
     <message>
         <source>Dynamically allocated differencing storage</source>
         <comment>MediumVariant</comment>
-        <translation>Dynamiskt allokerad lagring (endast förändringar)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Fixed size storage</source>
         <comment>MediumVariant</comment>
-        <translation>Lagring med fast storlek</translation>
+        <translation type="unfinished">Lagring med fast storlek</translation>
     </message>
     <message>
         <source>Dynamically allocated storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
-        <translation>Dynamiskt allokerad lagring delad i filer mindre än 2 GB</translation>
+        <translation type="unfinished">Dynamiskt allokerad lagring delad i filer mindre än 2 GB</translation>
     </message>
     <message>
         <source>Dynamically allocated differencing storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
-        <translation>Dynamiskt allokerad lagring (endast förändringar) delad i filer mindre än 2 GB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Fixed size storage split into files of less than 2GB</source>
         <comment>MediumVariant</comment>
-        <translation>Lagring med fast storlek delad i filer mindre än 2 GB</translation>
+        <translation type="unfinished">Lagring med fast storlek delad i filer mindre än 2 GB</translation>
     </message>
     <message>
         <source>Dynamically allocated compressed storage</source>
         <comment>MediumVariant</comment>
-        <translation>Dynamiskt allokerad komprimerad lagring</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Dynamically allocated differencing compressed storage</source>
         <comment>MediumVariant</comment>
-        <translation>Dynamiskt allokerad och komprimerad lagring (endast förändringar)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Fixed size ESX storage</source>
         <comment>MediumVariant</comment>
-        <translation>ESX-lagring med fast storlek</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Fixed size storage on raw disk</source>
         <comment>MediumVariant</comment>
-        <translation>Lagring med fast storlek på rå disk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Deny</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Neka</translation>
+        <translation type="unfinished">Neka</translation>
     </message>
     <message>
         <source>Allow VMs</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Tillåt virtuella maskiner</translation>
+        <translation type="unfinished">Tillåt virtuella maskiner</translation>
     </message>
     <message>
         <source>Allow All</source>
         <comment>NetworkAdapterPromiscModePolicy</comment>
-        <translation>Tillåt alla</translation>
+        <translation type="unfinished">Tillåt alla</translation>
     </message>
     <message>
         <source>Ignore</source>
         <comment>USBDeviceFilterAction</comment>
-        <translation>Ignorera</translation>
+        <translation type="unfinished">Ignorera</translation>
     </message>
     <message>
         <source>Hold</source>
         <comment>USBDeviceFilterAction</comment>
-        <translation>Håll kvar</translation>
+        <translation type="unfinished">Håll kvar</translation>
     </message>
     <message>
         <source>UDP</source>
         <comment>NATProtocol</comment>
-        <translation>UDP</translation>
+        <translation type="unfinished">UDP</translation>
     </message>
     <message>
         <source>TCP</source>
         <comment>NATProtocol</comment>
-        <translation>TCP</translation>
+        <translation type="unfinished">TCP</translation>
     </message>
     <message>
         <source>IDE Primary Master</source>
         <comment>StorageSlot</comment>
-        <translation>IDE Primär master</translation>
+        <translation type="unfinished">IDE Primär master</translation>
     </message>
     <message>
         <source>IDE Primary Slave</source>
         <comment>StorageSlot</comment>
-        <translation>IDE Primär slav</translation>
+        <translation type="unfinished">IDE Primär slav</translation>
     </message>
     <message>
         <source>IDE Secondary Master</source>
         <comment>StorageSlot</comment>
-        <translation>IDE Sekundär master</translation>
+        <translation type="unfinished">IDE Sekundär master</translation>
     </message>
     <message>
         <source>IDE Secondary Slave</source>
         <comment>StorageSlot</comment>
-        <translation>IDE Sekundär slav</translation>
+        <translation type="unfinished">IDE Sekundär slav</translation>
     </message>
     <message>
         <source>SATA Port %1</source>
         <comment>StorageSlot</comment>
-        <translation>SATA-port %1</translation>
+        <translation type="unfinished">SATA-port %1</translation>
     </message>
     <message>
         <source>SCSI Port %1</source>
         <comment>StorageSlot</comment>
-        <translation>SCSI-port %1</translation>
+        <translation type="unfinished">SCSI-port %1</translation>
     </message>
     <message>
         <source>SAS Port %1</source>
         <comment>StorageSlot</comment>
-        <translation>SAS-port %1</translation>
+        <translation type="unfinished">SAS-port %1</translation>
     </message>
     <message>
         <source>Floppy Device %1</source>
         <comment>StorageSlot</comment>
-        <translation>Diskettenhet %1</translation>
+        <translation type="unfinished">Diskettenhet %1</translation>
     </message>
     <message>
         <source>General</source>
         <comment>DetailsElementType</comment>
-        <translation>Allmänt</translation>
+        <translation type="unfinished">Allmänt</translation>
     </message>
     <message>
         <source>Preview</source>
         <comment>DetailsElementType</comment>
-        <translation>Förhandsvisning</translation>
+        <translation type="unfinished">Förhandsvisning</translation>
     </message>
     <message>
         <source>System</source>
         <comment>DetailsElementType</comment>
-        <translation>System</translation>
+        <translation type="unfinished">System</translation>
     </message>
     <message>
         <source>Display</source>
         <comment>DetailsElementType</comment>
-        <translation>Skärm</translation>
+        <translation type="unfinished">Skärm</translation>
     </message>
     <message>
         <source>Storage</source>
         <comment>DetailsElementType</comment>
-        <translation>Lagring</translation>
+        <translation type="unfinished">Lagring</translation>
     </message>
     <message>
         <source>Audio</source>
         <comment>DetailsElementType</comment>
-        <translation>Ljud</translation>
+        <translation type="unfinished">Ljud</translation>
     </message>
     <message>
         <source>Network</source>
         <comment>DetailsElementType</comment>
-        <translation>Nätverk</translation>
+        <translation type="unfinished">Nätverk</translation>
     </message>
     <message>
         <source>Serial ports</source>
         <comment>DetailsElementType</comment>
-        <translation>Serieportar</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Parallel ports</source>
         <comment>DetailsElementType</comment>
-        <translation>Parallelportar</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB</source>
         <comment>DetailsElementType</comment>
-        <translation>USB</translation>
+        <translation type="unfinished">USB</translation>
     </message>
     <message>
         <source>Shared folders</source>
         <comment>DetailsElementType</comment>
-        <translation>Delade mappar</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Description</source>
         <comment>DetailsElementType</comment>
-        <translation>Beskrivning</translation>
+        <translation type="unfinished">Beskrivning</translation>
     </message>
     <message>
         <source>Please choose a virtual hard drive file</source>
-        <translation>Välj en virtuell hårddiskfil</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>All virtual hard drive files (%1)</source>
-        <translation>Alla virtuella hårddiskfiler (%1)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual optical disk file</source>
-        <translation>Välj en virtuell optisk diskfil</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>All virtual optical disk files (%1)</source>
-        <translation>Alla virtuella optiska diskfiler (%1)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a virtual floppy disk file</source>
-        <translation>Välj en virtuell diskettavbildsfil</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>All virtual floppy disk files (%1)</source>
-        <translation>Alla virtuella diskettavbildsfiler (%1)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>VDI (VirtualBox Disk Image)</source>
-        <translation>VDI (VirtualBox diskavbild)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>VMDK (Virtual Machine Disk)</source>
-        <translation>VMDK (Virtuell maskin-disk)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>VHD (Virtual Hard Disk)</source>
-        <translation>VHD (Virtuell hårddisk)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>HDD (Parallels Hard Disk)</source>
-        <translation>HDD (Parallels-hårddisk)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>QED (QEMU enhanced disk)</source>
-        <translation>QED (QEMU utökad disk)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>QCOW (QEMU Copy-On-Write)</source>
-        <translation>QCOW (QEMU Copy-On-Write)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Välj en plats för den nya virtuella hårddiskfilen</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Aktiverad</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Inaktiverad</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
-        <translation>Obegränsad körning</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>PS/2 Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>PS/2-mus</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>USB-mus</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>PS/2 and USB Mouse</source>
         <comment>PointingHIDType</comment>
-        <translation>PS/2 och USB-mus</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Unrestricted Execution</source>
-        <translation>Obegränsad körning</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation>USB-musplatta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB Multi-Touch Tablet</source>
         <comment>PointingHIDType</comment>
-        <translation>USB-musplatta (Multi Touch)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT Network</source>
         <comment>NetworkAttachmentType</comment>
-        <translation>NAT-nätverk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>NAT network, '%1'</source>
         <comment>details report (network)</comment>
-        <translation>NAT-nätverk, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Du kan skapa eller lägga till diskavbildsfiler i inställningarna för virtuella maskinen.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
     </message>
     <message>
         <source>USB Port %1</source>
         <comment>StorageSlot</comment>
-        <translation type="obsolete">USB-port %1</translation>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Standard</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Aktiv</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -14286,6 +15176,18 @@ Version %1</translation>
         <source>C&lose</source>
         <translation type="obsolete">S&täng</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -14414,8 +15316,8 @@ Version %1</translation>
         <translation type="obsolete">Kunde inte genomföra anslutningshandskakning.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Fyll i det här registreringsformuläret för att informera oss om att du använder VirtualBox och, valfritt, för att hålla dig informerad om nyheter och uppdateringar för VirtualBox.</p><p>Ange ditt fullständiga namn med latinska bokstäver och din e-postadress i nedanstående fält. Observera att Sun Microsystems endast kommer att använda den här informationen för att samla in statistik om produktanvändning och för att skicka ut nyhets [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Fyll i det här registreringsformuläret för att informera oss om att du använder VirtualBox och, valfritt, för att hålla dig informerad om nyheter och uppdateringar för VirtualBox.</p><p>Ange ditt fullständiga namn med latinska bokstäver och din e-postadress i nedanstående fält. Observera att Sun Microsystems endast kommer att använda den här informationen för att samla in statistik om produktanvändning och för att skicka ut nyhets [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -14434,8 +15336,8 @@ Version %1</translation>
         <translation type="obsolete">Välj land/region</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Fyll i detta registreringsformulär för att informera oss om att du använder VirtualBox och, upp till dig själv, för att hålla dig informerad om nyheter och uppdateringar för VirtualBox.</p><p>Observera att Sun Microsystems endast kommer att använda denna information för att samla in statistik om användningen av produkten och för att skicka ut nyhetsbrev om VirtualBox. Sun Microsystems kommer aldrig att skicka vidare din informatio [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Fyll i detta registreringsformulär för att informera oss om att du använder VirtualBox och, upp till dig själv, för att hålla dig informerad om nyheter och uppdateringar för VirtualBox.</p><p>Observera att Sun Microsystems endast kommer att använda denna information för att samla in statistik om användningen av produkten och för att skicka ut nyhetsbrev om VirtualBox. Sun Microsystems kommer aldrig att skicka vidare din informatio [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -14591,8 +15493,8 @@ Version %1</translation>
         <translation type="obsolete">Pausa körningen av den virtuella maskinen</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Välkommen till VirtualBox!</h3><p>Den vänstra sidan av detta fönster är tänkt att visa en lista över alla virtuella maskiner på din dator. Listan är tom just nu därför att du inte har skapat några virtuella maskiner än.<img src=:/welcome.png align=right/></p><p>Tryck på knappen <b>Ny</b> i huvudverktygsraden i överkanten av fönstret för att skapa en ny virtuell maskin.</p><p>Du kan trycka [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Välkommen till VirtualBox!</h3><p>Den vänstra sidan av detta fönster är tänkt att visa en lista över alla virtuella maskiner på din dator. Listan är tom just nu därför att du inte har skapat några virtuella maskiner än.<img src=:/welcome.png align=right/></p><p>Tryck på knappen <b>Ny</b> i huvudverktygsraden i överkanten av fönstret för att skapa en ny virtuell maskin.</p><p>Du kan trycka [...]
     </message>
     <message>
         <source>Log</source>
@@ -15122,104 +16024,6 @@ Version %1</translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>Konfigurations&detaljer</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>&Körtidsinformation</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Sessionsinformation</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA-överföringar</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO-överföringar</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Data läst</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Data skriven</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Data överförd</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Data mottagen</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Inte upptäckt</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Inte upptäckt</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Inte tillgänglig</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Körtidsattribut</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Skärmupplösning</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Urklippsläge</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Dra och släpp-läge</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Gästtillägg</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Typ av gästoperativsystem</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Lagringsstatistik</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Inga lagringsenheter</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Nätverksstatistik</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Inga nätverksadaptrar</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_tr.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_tr.ts
index 26d2d60..3378a70 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_tr.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_tr.ts
@@ -285,7 +285,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">Tam U&yum Kipi</translation>
+        <translation>Ö&zgün Kipi</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -309,11 +309,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>&Fare Bütünleştirme etkisiz</translation>
+        <translation type="obsolete">&Fare Bütünleştirme etkisiz</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Anamakine fare işaretçisi bütünleştirme geçici olarak etkisiz</translation>
+        <translation type="obsolete">Anamakine fare işaretçisi bütünleştirme geçici olarak etkisiz</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -325,11 +325,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>Ctrl-Alt-Del &Ekle</translation>
+        <translation type="obsolete">Ctrl-Alt-Del &Ekle</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Sanal makineye Ctrl-Alt-Del sıralaması gönder</translation>
+        <translation type="obsolete">Sanal makineye Ctrl-Alt-Del sıralaması gönder</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -337,7 +337,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Sanal makineye Ctrl-Alt-Backspace sıralaması gönder</translation>
+        <translation type="obsolete">Sanal makineye Ctrl-Alt-Backspace sıralaması gönder</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -352,8 +352,8 @@
         <translation type="obsolete">Oturum &Bilgileri Penceresi</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>Oturum Bilgisi Penceresi Göster</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Oturum Bilgileri İletisi Göster</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -409,15 +409,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&CD/DVD Aygıtları</translation>
+        <translation type="obsolete">&CD/DVD Aygıtları</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>&Disket Aygıtları</translation>
+        <translation type="obsolete">&Disket Aygıtları</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>&USB Aygıtları</translation>
+        <translation type="obsolete">&USB Aygıtları</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -440,12 +440,12 @@
         <translation type="obsolete">Bu makineye yapılan uzak masaüstü (RDP) bağlantılarını etkinleştir ya da pasifleştir</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>Misafir Eklentileri CD kalıbını &ekle...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">&Misafir Eklentilerini Yükle...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>Misafir Eklentileri diski dosyasını sanal sürücüye ekle</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Misafir Eklentileri kurulum kalıbını bağla</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -464,7 +464,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation>Gün&lükleniyor...</translation>
+        <translation type="obsolete">Gün&lükleniyor...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -493,15 +493,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>&Tam Ekrana değiştir</translation>
+        <translation type="obsolete">&Tam Ekrana değiştir</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Normal ve tam ekran kipi arasında değiştir</translation>
+        <translation type="obsolete">Normal ve tam ekran kipi arasında değiştir</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Ö&zgün Kipine değiştir</translation>
+        <translation type="obsolete">Ö&zgün Kipine değiştir</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -509,7 +509,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Küçültme Ki&pine değiştir</translation>
+        <translation type="obsolete">Küçültme Ki&pine değiştir</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -537,7 +537,7 @@
     </message>
     <message>
         <source>&Contents...</source>
-        <translation>İçin&dekiler...</translation>
+        <translation>&İçerikler...</translation>
     </message>
     <message>
         <source>Show help contents</source>
@@ -549,7 +549,7 @@
     </message>
     <message>
         <source>Go back to showing all suppressed warnings and messages</source>
-        <translation>Gösterilen tüm önlenmiş uyarılara ve mesajlara geri dön</translation>
+        <translation>Gösterilen tüm önlenmiş uyarılara ve iletilere geri dön</translation>
     </message>
     <message>
         <source>&Network Operations Manager...</source>
@@ -569,15 +569,15 @@
     </message>
     <message>
         <source>Show a window with product information</source>
-        <translation>Ürün bilgisinin olduğu bir ileti göster</translation>
+        <translation>Ürün bilgisinin olduğu bir pencere göster</translation>
     </message>
     <message>
         <source>Take Sn&apshot...</source>
-        <translation>A&nlık görüntü al...</translation>
+        <translation>A&nlık Görüntü Al...</translation>
     </message>
     <message>
         <source>Take Screensh&ot...</source>
-        <translation>Ekran görüntü&sü al...</translation>
+        <translation>Ekran Görüntü&sü Al...</translation>
     </message>
     <message>
         <source>Take a screenshot of the virtual machine</source>
@@ -585,7 +585,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Ctrl-Alt-Backspace &ekle</translation>
+        <translation type="obsolete">Ctrl-Alt-Backspace &ekle</translation>
     </message>
     <message>
         <source>&File</source>
@@ -603,7 +603,7 @@
     </message>
     <message>
         <source>Display the Virtual Media Manager window</source>
-        <translation>Sanal Ortam Yöneticisi iletisini göster</translation>
+        <translation>Sanal Ortam Yöneticisi penceresini görüntüle</translation>
     </message>
     <message>
         <source>&Import Appliance...</source>
@@ -628,7 +628,7 @@
     </message>
     <message>
         <source>Display the global settings window</source>
-        <translation>Genel ayarlar iletisini göster</translation>
+        <translation>Genel ayarlar penceresini görüntüle</translation>
     </message>
     <message>
         <source>E&xit</source>
@@ -640,7 +640,7 @@
     </message>
     <message>
         <source>&Group</source>
-        <translation>&Grup</translation>
+        <translation>&Grupla</translation>
     </message>
     <message>
         <source>Create a new virtual machine</source>
@@ -808,7 +808,7 @@
     </message>
     <message>
         <source>Save State</source>
-        <translation>Kaydetme Durumu</translation>
+        <translation>Durumu Kaydet</translation>
     </message>
     <message>
         <source>Save the machine state of the selected virtual machines</source>
@@ -848,7 +848,7 @@
     </message>
     <message>
         <source>Gro&up</source>
-        <translation>Gr&up</translation>
+        <translation>Gr&upla</translation>
     </message>
     <message>
         <source>Sort the group of the first selected machine alphabetically</source>
@@ -860,7 +860,7 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>Sürükle'v'Bırak</translation>
+        <translation type="obsolete">Sürükle'v'Bırak</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
@@ -907,13 +907,233 @@
         <translation>Açılır Menü</translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation>Oturum Bilgisi Penceresini Göster</translation>
+    </message>
+    <message>
         <source>&Webcams</source>
-        <translation>&Web kameraları</translation>
+        <translation>&Web Kameraları</translation>
+    </message>
+    <message>
+        <source>&Insert Guest Additions CD image...</source>
+        <translation>Misafir Eklentileri CD kalıbını &yerleştir...</translation>
+    </message>
+    <message>
+        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <translation>Sanal sürücü içine Misafir Eklentileri disk dosyasını yerleştir</translation>
+    </message>
+    <message>
+        <source>&VirtualBox</source>
+        <translation>&VirtualBox</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>&Menü Çubuğu</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>&Menü Çubuğu Ayarları...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>Menü çubuğunu yapılandırmak için pencere açar</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>Menü Çu&buğunu Göster</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>Bu makine için menü çubuğu görünürlüğünü değiştir</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>&Durum Çubuğu</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>&Durum Çubuğu Ayarları...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>Durum çubuğunu yapılandırmak için pencere açar</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>Durum Çu&buğunu Göster</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>Bu makine için durum çubuğu görünürlüğünü değiştir</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>&Girdi</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>&Klavye</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>&Klavye Ayarları...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>Kısayolları yapılandırmak için genel ayarlar penceresini görüntüle</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>&Fare</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>&Sabit Sürücüler</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>&Sabit Sürücü Ayarları...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>Sabit sürücülerin ayarlarını değiştir</translation>
     </message>
     <message>
         <source>Network</source>
         <translation>Ağ</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>&USB Ayarları...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>US aygıtların ayarlarını değiştir</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>&Paylaşılan Klasörler</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>Gün&lüğü Göster...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation>İla&ve Veri Yöneticisi...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>İlave Veri Yöneticisi penceresini görünütüle</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>&Dosya</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation>&Pencere</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>&Simge Durumuna</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>Aktif makine penceresini simge durumuna küçült</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>&Tam Ekran Kipi</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>Normal ve tam ekran kipi arasında değiştir</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>&Küçültme Kipi</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>Ö&lçek Etkeni</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>%1 &Ekle</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>Sanal makineye %1 sıralaması gönder</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>&Fare Bütünleştirme</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>Anamakine fare işaretçisi bütünleştirmesini etkinleştir</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>&Optik Sürücüler</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>&Disket Sürücüler</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation>&USB</translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>Sürükle ve Bırak</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>&Günlükleme</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation>&Normal Başlat</translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation>&Gözetimsiz Başlat</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation>Seçilen sanal makineleri arka planda başlat</translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation>&Ayrılabilir Başlat</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation>Seçilen sanal makineleri arka planda devam ettiren seçenek ile başlat</translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>Etkinleştir</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>%1x%2 olarak yeniden boyutlandır</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation>% %1</translation>
+    </message>
 </context>
 <context>
     <name>UIActonPool</name>
@@ -923,6 +1143,20 @@
     </message>
 </context>
 <context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - Disk Şifreleme</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>Bu sanal makine parola korumalıdır. Lütfen aşağıya %n şifreleme parolasını girin.</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIApplianceEditorWidget</name>
     <message>
         <source>Virtual System %1</source>
@@ -998,7 +1232,7 @@
     </message>
     <message>
         <source>USB Controller</source>
-        <translation>USB Denetleyici</translation>
+        <translation>USB Denetleyicisi</translation>
     </message>
     <message>
         <source>Sound Card</source>
@@ -1044,7 +1278,7 @@
     </message>
     <message>
         <source>When checked a new unique MAC address will assigned to all configured network cards.</source>
-        <translation>Yeni bir benzersiz MAC adresi işaretlendiğinde tüm yapılandırılmış ağ kartlarına atanacaktır.</translation>
+        <translation>İşaretlendiğinde, yeni bir benzersiz MAC adresi tüm yapılandırılmış ağ kartlarına atanacak.</translation>
     </message>
     <message>
         <source>&Reinitialize the MAC address of all network cards</source>
@@ -1522,6 +1756,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation>Veri alınıyor...</translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1532,7 +1773,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Veri kaldırılıyor...</translation>
+        <translation type="obsolete">Veri kaldırılıyor...</translation>
     </message>
 </context>
 <context>
@@ -1628,6 +1869,31 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation>Durum</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation>KİMLİK</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>Parola</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>Aşağıdaki %n sabit sürücü(ler) tarafından kullanılır:</nobr><br>%1</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>< &Back</source>
@@ -1966,7 +2232,7 @@
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2162,6 +2428,116 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>Kare Boyutu: %1x%2, Kare Oranı: %3fps, Bit Oranı: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>En Az Yarı Sanallaştırma</translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Hyper-V Yarı Sanallaştırma</translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>KVM Yarı Sanallaştırma</translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[Optik Sürücü]</translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>USB Denetleyicisi</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Küçültme etkeni</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">Küçültülmemiş HiDPI Görüntü Çıktısı</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">Etkinleştirildi</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>Küçük Araç Çubuğu Konumu</translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>Üstte</translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>Altta</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>Küçük Araç Çubuğu</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>Etkisizleştirildi</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation>Ölçek etkeni</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation>Küçültülmemiş HiDPI Görüntü Çıktısı</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation>Etkinleştirildi</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation>Menü çubuğu</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation>Etkinleştirildi</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation>Etkisizleştirildi</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation>Durum çubuğu</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation>Etkinleştirildi</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation>Etkisizleştirildi</translation>
+    </message>
 </context>
 <context>
     <name>UIGDetailsUpdateThreadAudio</name>
@@ -2393,15 +2769,15 @@
     </message>
     <message>
         <source>Machine Windows:</source>
-        <translation type="unfinished"></translation>
+        <translation>Makine Pencereleri:</translation>
     </message>
     <message>
         <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation type="unfinished"></translation>
+        <translation>Eğer işaretlendiyse, fare işaretçisi üzerilerine hareket ettiğinde makine pencereleri öne gelecektir.</translation>
     </message>
     <message>
         <source>&Raise Window Under Mouse</source>
-        <translation type="unfinished"></translation>
+        <translation>Fare Altındaki Pencereyi Öne &Getir</translation>
     </message>
 </context>
 <context>
@@ -2459,11 +2835,11 @@
     </message>
     <message>
         <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
-        <translation>Varsayılan sanal makine klasörüne yolu gösterir. Eğer açıkça aksi hali belirtilmemişse, yeni sanal makineler oluşturulurken, bu klasör kullanılır.</translation>
+        <translation>Varsayılan sanal makine klasörü için yolu tutar. Eğer açıkça aksi hali belirtilmemişse, yeni sanal makineler oluşturulurken, bu klasör kullanılır.</translation>
     </message>
     <message>
         <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
-        <translation>Uzak Ekran (VRDP) istemcileri için kimlik doğrulaması sağlayan kütüphaneye yolu gösterir.</translation>
+        <translation>Uzak Görüntü (VRDP) istemcilerine kimlik doğrulaması sağlayan kütüphane için yolu tutar.</translation>
     </message>
     <message>
         <source>Default &Hard Disk Folder:</source>
@@ -2503,15 +2879,15 @@
     </message>
     <message>
         <source>&Dock and Menubar:</source>
-        <translation>&Yapışık Alan ve Menü Çubuğu:</translation>
+        <translation type="obsolete">&Yapışık Alan ve Menü Çubuğu:</translation>
     </message>
     <message>
         <source>Auto-Show in Fullscreen</source>
-        <translation>Tam Ekranda Otomatik Göster</translation>
+        <translation type="obsolete">Tam Ekranda Otomatik Göster</translation>
     </message>
     <message>
         <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>İşaretlendiğinde, anamakine yapışık alanı ve menü çubuğu, sanal makine tam ekran kipinde olduğunda gösterilecektir.</translation>
+        <translation type="obsolete">İşaretlendiğinde, anamakine yapışık alanı ve menü çubuğu, sanal makine tam ekran kipinde olduğunda gösterilecektir.</translation>
     </message>
     <message>
         <source>&Host Screensaver:</source>
@@ -3353,7 +3729,7 @@
     </message>
     <message>
         <source>Host+</source>
-        <translation>Host+</translation>
+        <translation>Anamakine+</translation>
     </message>
     <message>
         <source>None</source>
@@ -3618,12 +3994,12 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>CD/DVD aygıtlarının etkinliğini gösterir:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>CD/DVD aygıtlarının etkinliğini gösterir:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Disket aygıtlarının etkinliğini gösterir:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Disket aygıtlarının etkinliğini gösterir:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -3663,7 +4039,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB Denetleyicisi etkisizleştirildi</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB Denetleyicisi etkisizleştirildi</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -3726,6 +4102,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation>İlave özellik durumu:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>Görüntünün etkinliğini gösterir:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Optik sürücülerin etkinliğini gösterir:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>Disket sürücülerin etkinliğini gösterir:</nobr>%1</p></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -3778,15 +4168,15 @@
     </message>
     <message>
         <source>No Webcams Connected</source>
-        <translation>Bağlanmış Web Kameraları Yok</translation>
+        <translation>Bağlı Web Kameraları Yok</translation>
     </message>
     <message>
         <source>No supported webcams connected to the host PC</source>
-        <translation>Anamakineye bağlanmış desteklenen web kameraları yok</translation>
+        <translation>Anamakine PC'ye bağlı desteklenen web kameraları yok</translation>
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation>Ağ Bağdaştırıcısı Bağla</translation>
+        <translation>Ağ Bağdaştırıcısını Bağla</translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
@@ -3832,7 +4222,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Görüntü</translation>
+        <translation type="obsolete">&Görüntü</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -3856,11 +4246,11 @@
     </message>
     <message>
         <source>Enable &3D Acceleration</source>
-        <translation>&3B Hızlandırma etkin</translation>
+        <translation>&3B Hızlandırmayı etkinleştir</translation>
     </message>
     <message>
         <source>&Remote Display</source>
-        <translation>&Uzak Ekran</translation>
+        <translation>&Uzak Görüntü</translation>
     </message>
     <message>
         <source>When checked, the VM will act as a Remote Desktop Protocol (RDP) server, allowing remote clients to connect and operate the VM (when it is running) using a standard RDP client.</source>
@@ -3904,7 +4294,7 @@
     </message>
     <message>
         <source>Enable &2D Video Acceleration</source>
-        <translation>&2B Görüntü Hızlandırma etkin</translation>
+        <translation>&2B Görüntü Hızlandırmayı etkinleştir</translation>
     </message>
     <message>
         <source>The VRDP Server port number. You may specify <tt>0</tt> (zero), to select port 3389, the standard port for RDP.</source>
@@ -4016,7 +4406,7 @@
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>Sanal makine, donanım grafikleri hızlandırmasını kullanması için ayarlanır ve işletim sistemi ipucu, Windows Vista veya sonrasına ayarlıdır. En iyi performans için makinenin görüntü belleğini en az <b>%1</b> olarak ayarlamalısınız.</translation>
+        <translation type="obsolete">Sanal makine, donanım grafikleri hızlandırmasını kullanması için ayarlanır ve işletim sistemi ipucu, Windows Vista veya sonrasına ayarlıdır. En iyi performans için makinenin görüntü belleğini en az <b>%1</b> olarak ayarlamalısınız.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -4070,54 +4460,122 @@
         <translation>Ekran %1 için görüntü kaydını etkinleştir.</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
-        <translation>Uzak Görüntü bu sanal makine için şu an etkinleştirildi. Ancak bu, <b>%1</b> yüklenmesini gerektirir. Lütfen VirtualBox indirme sayfasından Genişletme Paketini yükleyin aksi halde VM'iniz etkisizleştirilmiş Uzak Görüntü ile başlatılacaktır.</translation>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Küçük Araç Çubuğu:</translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsGeneral</name>
     <message>
-        <source><qt>%1&nbsp;MB</qt></source>
-        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Eğer işaretlenmişse, Tam Ekran ve Özgün kiplerinde Küçük Araç Çubuğunu gösterir.</translation>
     </message>
     <message>
-        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>Bu sanal makinenin anlık görüntülerinin saklanacağı yeri gösterir. Anlık görüntülerin oldukça disk alanı kaplayabileceğinden haberiniz olsun.</translation>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">&Tam Ekran/Özgün İçinde Göster</translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>&Temel</translation>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Eğer işaretlenmişse, ekranın en altındaki varsayılan konumu yerine, ekranın en üstünde Küçük Araç Çubuğunu gösterir.</translation>
     </message>
     <message>
-        <source>Identification</source>
-        <translation type="obsolete">Kimlik</translation>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Ekranın En Üstünde &Göster</translation>
     </message>
     <message>
-        <source>&Name:</source>
-        <translation type="obsolete">&İsim:</translation>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>5 dakikalık görüntü başına yaklaşık %1MB</i></translation>
     </message>
     <message>
-        <source>Holds the name of the virtual machine.</source>
-        <translation type="obsolete">Sanal makinenin adını gösterir.</translation>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation>Uzak Görüntü bu sanal makine için şu an etkinleştirildi. Ancak bu, <i>%1</i> yüklenmesini gerektirir. Lütfen VirtualBox indirme sitesinden Genişletme Paketini yükleyin aksi halde VM'iniz Uzak Görüntü etkisizleştirilmiş olarak başlatılacaktır.</translation>
     </message>
     <message>
-        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
-        <translation type="obsolete">Sanak makine içerisine kurmak istediğiniz şiletim sistemi tipini gösterir (misafir işletim sistemi olarak da adlandırılır).</translation>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation>Sanal makine, donanım grafikleri hızlandırmasını kullanması için ayarlanır ve işletim sistemi ipucu, Windows Vista veya sonrasına ayarlıdır. En iyi performans için makinenin görüntü belleğini en az <b>%1</b> olarak ayarlamalısınız.</translation>
     </message>
     <message>
-        <source>Base &Memory Size</source>
-        <translation type="obsolete">Te&mel Bellek Boyutu</translation>
+        <source>&Screen</source>
+        <translation>&Ekran</translation>
     </message>
     <message>
-        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
-        <translation type="obsolete">Sanal makineye sağlanan bellek miktarını kontrol eder. Eğer çok fazla bellek atarsanız makine başlamayabilir.</translation>
+        <source>Scale Factor:</source>
+        <translation>Ölçek Etkeni:</translation>
     </message>
     <message>
-        <source><</source>
-        <translation type="obsolete"><</translation>
+        <source>Controls the guest screen scale factor.</source>
+        <translation>Misafir ekranı ölçek etkenini kontrol eder.</translation>
     </message>
     <message>
-        <source>></source>
+        <source>100%</source>
+        <translation>% 100</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation>% 200</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation>%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation>HiDPI:</translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation>İşaretlendiğinde, misafir ekran içerikleri yüksek anamakine ekran çözünürlüklerini dengelemek için büyütülmeyecektir.</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation>&Küçültülmemiş HiDPI Çıktısı kullan</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation>Hızlandırma:</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsGeneral</name>
+    <message>
+        <source><qt>%1&nbsp;MB</qt></source>
+        <translation type="obsolete"><qt>%1&nbsp;MB</qt></translation>
+    </message>
+    <message>
+        <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
+        <translation>Bu sanal makinenin anlık görüntülerinin saklanacağı yerin yolunu tutar. Anlık görüntülerin oldukça disk alanı kaplayabileceğinden haberiniz olsun.</translation>
+    </message>
+    <message>
+        <source>Basi&c</source>
+        <translation>&Temel</translation>
+    </message>
+    <message>
+        <source>Identification</source>
+        <translation type="obsolete">Kimlik</translation>
+    </message>
+    <message>
+        <source>&Name:</source>
+        <translation type="obsolete">&İsim:</translation>
+    </message>
+    <message>
+        <source>Holds the name of the virtual machine.</source>
+        <translation type="obsolete">Sanal makinenin adını gösterir.</translation>
+    </message>
+    <message>
+        <source>Selects the operating system type that you plan to install into this virtual machine (called a guest operating system).</source>
+        <translation type="obsolete">Sanak makine içerisine kurmak istediğiniz şiletim sistemi tipini gösterir (misafir işletim sistemi olarak da adlandırılır).</translation>
+    </message>
+    <message>
+        <source>Base &Memory Size</source>
+        <translation type="obsolete">Te&mel Bellek Boyutu</translation>
+    </message>
+    <message>
+        <source>Controls the amount of memory provided to the virtual machine. If you assign too much, the machine might not start.</source>
+        <translation type="obsolete">Sanal makineye sağlanan bellek miktarını kontrol eder. Eğer çok fazla bellek atarsanız makine başlamayabilir.</translation>
+    </message>
+    <message>
+        <source><</source>
+        <translation type="obsolete"><</translation>
+    </message>
+    <message>
+        <source>></source>
         <translation type="obsolete">></translation>
     </message>
     <message>
@@ -4133,7 +4591,7 @@
         <translation type="obsolete">Sanal makineye sağlanan video belleği miktarını kontrol eder.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Gelişmiş</translation>
     </message>
     <message>
@@ -4190,7 +4648,7 @@
     </message>
     <message>
         <source>Selects which clipboard data will be copied between the guest and the host OS. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>Misafir ve anamakine İS arasında kopyalanacak olan pano verisini seçer. Bu özellik misafir İS içinde Misafir Eklentilerinin yüklü olmasını gerektirir.</translation>
+        <translation>Misafir ve anamakine İS arasında kopyalanacak olan pano verisini seçer. Bu özellik misafir İS içinde Misafir Eklentilerinin yüklenmesini gerektirir.</translation>
     </message>
     <message>
         <source>&IDE Controller Type:</source>
@@ -4201,12 +4659,12 @@
         <translation>A&nlık Görüntü Klasörü:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Açıklama</translation>
     </message>
     <message>
         <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
-        <translation>Sanal makinenin tanımını gösterir. Açıklama alanı yüklü misafir İS'nin yapılandırma ayrıntılarında yorum yapmak için faydalıdır.</translation>
+        <translation>Sanal makinenin tanımını tutar. Açıklama alanı yüklü misafir İS'nin yapılandırma ayrıntılarında yorum yapmak için faydalıdır.</translation>
     </message>
     <message>
         <source>&Other</source>
@@ -4214,7 +4672,7 @@
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Eğer işaretlenmişse, makine çalışırken sanal sürücülerden kaldırılan ya da yerleştirilen herhangi bir CD/DVD disk ya da disket hatırlanacaktır.</translation>
+        <translation type="obsolete">Eğer işaretlenmişse, makine çalışırken sanal sürücülerden kaldırılan ya da yerleştirilen herhangi bir CD/DVD disk ya da disket hatırlanacaktır.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -4230,38 +4688,38 @@
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Kaldırılabilir Ortam:</translation>
+        <translation type="obsolete">Kaldırılabilir Ortam:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>Çalışma Zamanı Değişikliklerini &hatırla</translation>
+        <translation type="obsolete">Çalışma Zamanı Değişikliklerini &Hatırla</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Küçük Araç Çubuğu:</translation>
+        <translation type="obsolete">Küçük Araç Çubuğu:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Eğer işaretlenmişse, Tam Ekran ve Özgün kiplerinde Küçük Araç Çubuğunu gösterir.</translation>
+        <translation type="obsolete">Eğer işaretlenmişse, Tam Ekran ve Özgün kiplerinde Küçük Araç Çubuğunu gösterir.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>&Tam Ekran/Özgün içinde göster</translation>
+        <translation type="obsolete">&Tam Ekran/Özgün İçinde Göster</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Eğer işaretlenmişse, ekranın en altındaki varsayılan konumu yerine, ekranın en üstünde Küçük Araç Çubuğunu gösterir.</translation>
+        <translation type="obsolete">Eğer işaretlenmişse, ekranın en altındaki varsayılan konumu yerine, ekranın en üstünde Küçük Araç Çubuğunu gösterir.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Ekranın En Üstünde &göster</translation>
+        <translation type="obsolete">Ekranın En Üstünde &Göster</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">bu VM için 64-bit misafir İS türü seçtiniz. Bu gibi misafirler donanım sanallaştırma (VT-x/AMD-V) gerektirir, bu özellik otomatik olarak etkinleştirilecektir.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>&Sürükle'v'Bırak:</translation>
     </message>
     <message>
@@ -4276,6 +4734,126 @@
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation>Sanal makine işletim sistemi ipucu 64-bit türüne ayarlı. 64-bit misafir sistemleri donanım sanallaştırması gerektirir, bu yüzden eğer değişiklikleri onaylarsanız, bu otomatik olarak etkinleştirilecektir.</translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation>Şif&releme</translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>İşaretlendiğinde, bu sanal makine için şifrelemeyi etkinleştirir.</translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation>Şifrelemeyi &etkinleştir</translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation>Şifreleme Ş&ifreleyici:</translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>Sanal makine disklerini şifrelemek için kullanılacak şifreleyiciyi tutar.</translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation>Yeni Parolayı Giri&n:</translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>Sanal makineye atanacak olan parolayı tutar.</translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation>Yeni Parolayı &Onaylayın:</translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>Sanal makineye atanacak olan parolayı onaylar.</translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>Bu sanal makineyi şifrelemeye çalışıyorsunuz. Ancak bu, <i>%1</i> yüklenmesini gerektirir. Lütfen VirtualBox indirme sitesinden Genişletme Paketini yükleyin.</translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation>Şifreleme şifreleyicisi türü belirlenmemiş.</translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation>Şifreleme parolası boş.</translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation>Şifreleme parolaları eşleşmiyor.</translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>Değiştirilmemiş Bırak</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>VM menü çubuğu içeriklerini değiştirmeye izin verir.</translation>
+    </message>
+    <message>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">Ekran Küçültme Etkeni:</translation>
+    </message>
+    <message>
+        <source>This setting determines the guest screen scale factor.</source>
+        <translation type="obsolete">Bu ayar misafir ekranı küçültme etkenini belirler.</translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">% 100</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">% 200</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="obsolete">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="obsolete">HiDPI:</translation>
+    </message>
+    <message>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">Eğer işaretlendiyse, misafir ekranı içerikleri yüksek anamakine ekranı çözünürlüğüne karşılık gelene kadar küçültülmeyecektir.</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">&Küçültülmemiş HiDPI Çıktısı kullan</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation>Küçük Araç Çubuğu:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation>Eğer işaretlendiyse, Tam Ekran ve Özgün kiplerinde Küçük Araç Çubuğunu gösterir.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation>&Tam Ekran/Özgün İçinde Göster</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation>Eğer işaretlendiyse, ekranın en altındaki varsayılan konumu yerine, ekranın en üstünde Küçük Araç Çubuğunu gösterir.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation>Ekranın En Üstünde &Göster</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>VM durum çubuğu içeriklerini değiştirmeye izin verir.</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -4289,11 +4867,11 @@
     </message>
     <message>
         <source>When checked, plugs this virtual network adapter into the virtual machine.</source>
-        <translation>Seçilirse bu sanal ağ bağdaştırıcısını sanal makineye bağlar.</translation>
+        <translation>İşaretlendiğinde, bu sanal ağ bağdaştırıcısını sanal makineye bağlar.</translation>
     </message>
     <message>
         <source>&Enable Network Adapter</source>
-        <translation>Ağ Bağdaştırıcısı &etkin</translation>
+        <translation>Ağ Bağdaştırıcısını &etkinleştir</translation>
     </message>
     <message>
         <source>A&dapter Type:</source>
@@ -4321,7 +4899,7 @@
     </message>
     <message>
         <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
-        <translation>Bu bağdaştırıcının MAC adresini gösterir. Bu, {0-9,A-F} grubundan seçilen tam olarak 12 karakteri içerir. İkinci karakterin her zaman bir çift rakam olmak zorunda olduğunu unutmayın.</translation>
+        <translation>Bu bağdaştırıcının MAC adresini tutar. Bu, {0-9,A-F} grubundan seçilen tam olarak 12 karakteri içerir. İkinci karakterin her zaman bir çift rakam olmak zorunda olduğunu unutmayın.</translation>
     </message>
     <message>
         <source>Generates a new random MAC address.</source>
@@ -4424,7 +5002,7 @@
     </message>
     <message>
         <source>Opens a window to manage port forwarding rules.</source>
-        <translation>Bağlantı noktası yönlendirme kurallarını yönetmek için ileti açar.</translation>
+        <translation>Bağlantı noktası yönlendirme kurallarını yönetmek için bir pencere açar.</translation>
     </message>
     <message>
         <source>&Port Forwarding</source>
@@ -4456,7 +5034,7 @@
     </message>
     <message>
         <source>Holds the name of the internal network that this network card will be connected to. You can create a new internal network by choosing a name which is not used by any other network cards in this virtual machine or others.</source>
-        <translation>Bağlanacak olan bu ağ kartının dahili ağ adını girin. Bu sanal makinede ya da diğerlerinde kullanılmayan herhangi bir diğer ağ kartının adını seçerek yeni bir dahili ağ oluşturabilirsiniz.</translation>
+        <translation>Bu ağ kartının bağlanacak olduğu dahili ağın adını tutar. Bu sanal makinede ya da diğerlerinde herhangi bir başka ağ kartı tarafından kullanılmayan bir adı seçerek yeni bir dahili ağ oluşturabilirsiniz.</translation>
     </message>
     <message>
         <source>Selects the virtual network adapter on the host system that traffic to and from this network card will go through. You can create and remove adapters using the global network settings in the virtual machine manager window.</source>
@@ -4550,7 +5128,7 @@
     </message>
     <message>
         <source>&Enable Parallel Port</source>
-        <translation>&Paralel B.Noktası etkin</translation>
+        <translation>&Paralel B.Noktasını etkinleştir</translation>
     </message>
     <message>
         <source>Port &Number:</source>
@@ -4558,7 +5136,7 @@
     </message>
     <message>
         <source>Holds the parallel port number. You can choose one of the standard parallel ports or select <b>User-defined</b> and specify port parameters manually.</source>
-        <translation>Paralel bağlantı noktası numarasını gösterir. Standart paralel bağlantı noktalarından birini seçebilir ya da <b>Kullanıcı-tanımlı</b> seçebilirsiniz ve bağlantı noktası parametrelerini el ile belirleyebilirsiniz.</translation>
+        <translation>Paralel bağlantı noktası numarasını tutar. Standart paralel bağlantı noktalarından birini seçebilir ya da <b>Kullanıcı-tanımlı</b> seçebilirsiniz ve bağlantı noktası parametrelerini el ile belirleyebilirsiniz.</translation>
     </message>
     <message>
         <source>&IRQ:</source>
@@ -4574,15 +5152,15 @@
     </message>
     <message>
         <source>Holds the host parallel device name.</source>
-        <translation>Anamakine paralel aygıt adını gösterir.</translation>
+        <translation>Anamakine paralel aygıt adını tutar.</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this parallel port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation>Bu paralel bağlantı.noktasının IRQ numarasını gösterir. Bu <tt>0</tt> ve <tt>255</tt> arasında bütün bir numara olmalıdır. Eğer bu sanal makine için <b>I/O APIC</b> ayarı etkinleştirilmişse sadece <tt>15</tt>'ten büyük değerler kullanılabilir.</translation>
+        <translation>Bu paralel bağlantı noktasının IRQ numarasını tutar. Bu <tt>0</tt> ve <tt>255</tt> arasında bütün bir numara olmalıdır. Eğer bu sanal makine için <b>I/O APIC</b> ayarı etkinleştirilmişse sadece <tt>15</tt>'ten büyük değerler kullanılabilir.</translation>
     </message>
     <message>
         <source>Holds the base I/O port address of this parallel port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation>Bu paralel bağlantı.noktasının temel G/Ç bağlantı noktası adresini gösterir. Geçerli değerler <tt>0</tt>'dan<tt>0xFFFF</tt> değerine kadar aralıktaki tam sayı numaralarıdır.</translation>
+        <translation>Bu paralel bağlantı noktasının temel G/Ç bağlantı noktası adresini tutar. Geçerli değerler <tt>0</tt>'dan<tt>0xFFFF</tt> değerine kadar aralıktaki tam sayı numaralarıdır.</translation>
     </message>
 </context>
 <context>
@@ -4738,11 +5316,11 @@
     <name>UIMachineSettingsSFDetails</name>
     <message>
         <source>Add Share</source>
-        <translation>Paylaşım Ekle</translation>
+        <translation>Paylaşım ekle</translation>
     </message>
     <message>
         <source>Edit Share</source>
-        <translation>Paylaşımı Düzenle</translation>
+        <translation>Paylaşımı düzenle</translation>
     </message>
     <message>
         <source>Dialog</source>
@@ -4758,7 +5336,7 @@
     </message>
     <message>
         <source>Holds the name of the shared folder (as it will be seen by the guest OS).</source>
-        <translation>Paylaşılan klasörün adını gösterir (misafir İS tarafından görüldüğü şekilde olacaktır).</translation>
+        <translation>Paylaşılan klasörün adını tutar (misafir İS tarafından görüldüğü şekilde olacaktır).</translation>
     </message>
     <message>
         <source>When checked, the guest OS will not be able to write to the specified shared folder.</source>
@@ -4782,11 +5360,7 @@
     </message>
     <message>
         <source>If checked, this shared folder will be permanent.</source>
-        <translation>Eğer işaretlenmişse, bu paylaşılan klasör kalıcı olacaktır.</translation>
-    </message>
-    <message>
-        <source>Window</source>
-        <translation>Pencere</translation>
+        <translation>Eğer işaretlendiyse, bu paylaşılan klasör kalıcı olacaktır.</translation>
     </message>
 </context>
 <context>
@@ -4802,7 +5376,7 @@
     </message>
     <message>
         <source>&Enable Serial Port</source>
-        <translation>S&eri B.Noktası etkin</translation>
+        <translation>S&eri B.Noktasını etkinleştir</translation>
     </message>
     <message>
         <source>Port &Number:</source>
@@ -4838,11 +5412,11 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Eğer işaretlenmişse, başlatılırken sanal makine tarafından <b>Bağlantı Noktası Yolu</b> alanı içinde belirtilen hat oluşturulacaktır. Aksi taktirde, sanal makine hattın var olduğunu farzedecek ve bunu kullanmayı deneyecek.</translation>
+        <translation type="obsolete">Eğer işaretlenmişse, başlatılırken sanal makine tarafından <b>Bağlantı Noktası Yolu</b> alanı içinde belirtilen hat oluşturulacaktır. Aksi taktirde, sanal makine hattın var olduğunu farzedecek ve bunu kullanmayı deneyecek.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Hat oluştur</translation>
+        <translation type="obsolete">&Hat oluştur</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -4850,19 +5424,35 @@
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Bağlantı noktası <b>Anamakine Hattı</b> kipinde çalışıyorken anamakine üzerindeki seri bağlantı noktasının hattına olan yolu gösterir ya da bağlantı noktası <b>Anamakine Aygıtı</b> kipinde çalışıyorken anamakine seri aygıt adını gösterir.</translation>
+        <translation type="obsolete">Bağlantı noktası <b>Anamakine Hattı</b> kipinde çalışıyorken anamakine üzerindeki seri bağlantı noktasının hattına olan yolu gösterir ya da bağlantı noktası <b>Anamakine Aygıtı</b> kipinde çalışıyorken anamakine seri aygıt adını gösterir.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>B.Noktası/Dosya &Yolu:</translation>
+        <translation type="obsolete">B.Noktası/Dosya &Yolu:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation>Bu seri bağlantı noktasının IRQ numarasını gösterir. Bu <tt>0</tt> ve <tt>255</tt> arasında bütün bir numara olmalıdır. Eğer bu sanal makine için <b>I/O APIC</b> ayarı etkinleştirilmişse sadece <tt>15</tt>'ten büyük değerler kullanılabilir.</translation>
+        <translation>Bu seri bağlantı noktasının IRQ numarasını tutar. Bu <tt>0</tt> ve <tt>255</tt> arasında bütün bir numara olmalıdır. Eğer bu sanal makine için <b>I/O APIC</b> ayarı etkinleştirilmişse sadece <tt>15</tt>'ten büyük değerler kullanılabilir.</translation>
     </message>
     <message>
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation>Bu seri bağlantı.noktasının temel G/Ç bağlantı noktası adresini gösterir. Geçerli değerler <tt>0</tt>'dan<tt>0xFFFF</tt> değerine kadar aralıktaki tam sayı numaralarıdır.</translation>
+        <translation>Bu seri bağlantı noktasının temel G/Ç bağlantı noktası adresini tutar. Geçerli değerler <tt>0</tt>'dan<tt>0xFFFF</tt> değerine kadar aralıktaki tam sayı numaralarıdır.</translation>
+    </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation>Eğer işaretlendiyse, sanal makine <b>Yol/Adres</b> alanında belirtilmiş hat ya da yuvanın mevcut olduğunu varsayacak ve kullanmaya çalışacak. Aksi halde hat ya da yuva sanal makine tarafından başlatıldığında oluşturulacaktır.</translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>Varolan hatta/yuvaya &bağlan</translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation>&Yol/Adres:</translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation><p><b>Anamakine Hattı</b> kipinde: Anamakinedeki seri bağlantı noktasının hattı için yolu tutar. Örnek: "\\.\pipe\myvbox" veya "/tmp/myvbox", ayrı ayrı Windows ve UNIX-gibi sistemler için.</p><p><b>Anamakine Aygıtı</b> kipinde: Anamakine seri aygıt adını tutar. Örnek: "COM1" veya "/dev/ttyS0".</p><p><b>Ham Dosya</b> kipinde: Anamakine sistemindeki, seri çıktının  [...]
     </message>
 </context>
 <context>
@@ -4944,11 +5534,11 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>CD/DVD&nbsp;Aygıtı&nbsp;Ekle</nobr></translation>
+        <translation type="obsolete"><nobr>CD/DVD&nbsp;Aygıtı&nbsp;Ekle</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Disket&nbsp;Aygıtı&nbsp;Ekle</nobr></translation>
+        <translation type="obsolete"><nobr>Disket&nbsp;Aygıtı&nbsp;Ekle</nobr></translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -4988,11 +5578,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>CD/DVD Aygıtı ekle</translation>
+        <translation type="obsolete">CD/DVD Aygıtı ekle</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Disket Aygıtı ekle</translation>
+        <translation type="obsolete">Disket Aygıtı ekle</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5140,19 +5730,19 @@
     </message>
     <message>
         <source>Set up the virtual hard disk</source>
-        <translation>Sanal sabit disk ayarla</translation>
+        <translation>Sanal sabit diski ayarla</translation>
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD &Sürücü:</translation>
+        <translation type="obsolete">CD/DVD &Sürücü:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Sanal sürücü ile kullanmak için sanal bir CD/DVD disk ya da fiziksel bir sürücü seçin. Sanal makine, dosyadaki veriyle sürücüye yerleştirilen bir diski veya fiziksel sürücüdeki diski, içerikleri gibi görecek.</translation>
+        <translation type="obsolete">Sanal sürücü ile kullanmak için sanal bir CD/DVD disk ya da fiziksel bir sürücü seçin. Sanal makine, dosyadaki veriyle sürücüye yerleştirilen bir diski veya fiziksel sürücüdeki diski, içerikleri gibi görecek.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Sanal CD/DVD sürücü ayarla</translation>
+        <translation type="obsolete">Sanal CD/DVD sürücü ayarla</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5164,7 +5754,7 @@
     </message>
     <message>
         <source>Set up the virtual floppy drive</source>
-        <translation>Sanal disket sürücü ayarla</translation>
+        <translation>Sanal disket sürücüyü ayarla</translation>
     </message>
     <message>
         <source>Create a new hard disk...</source>
@@ -5176,7 +5766,7 @@
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Sanal bir CD/DVD disk dosyası seçin...</translation>
+        <translation type="obsolete">Sanal bir CD/DVD disk dosyası seçin...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5196,7 +5786,7 @@
     </message>
     <message>
         <source>When checked the guest system will see the virtual disk as a solid state device.</source>
-        <translation>İşaretlendiğinde, misafir sistem sanal diski katı hal sürücüsü (SSD) gibi görecek.</translation>
+        <translation>İşaretlendiğinde, misafir sistem sanal diski bir katı hal aygıtı (SSD) gibi görecek.</translation>
     </message>
     <message>
         <source>&Solid-state Drive</source>
@@ -5264,6 +5854,54 @@
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>Makine şu anda %1 yonga setinin desteklediğinden daha fazla depolama denetleyicisine atanmış. Lütfen Sistem ayarları sayfasındaki yonga seti türünü değiştirin ya da Depolama ayarları sayfasında belirtilen depolama denetleyicilerinin sayısını azaltın: %2</translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation>USB Denetleyicisi ekle</translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation>İşaretlendiğinde, misafir sistem sanal diski bir çalışırken-takılabilir aygıt gibi görecek.</translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>Çalışırken-&takılabilir</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>Sanal bir optik disk dosyası seçin...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>Optik&nbsp;Sürücü&nbsp;Ekle</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>Disket&nbsp;Sürücü&nbsp;Ekle</nobr></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>Optik Sürücü ekle</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>Disket Sürücü ekle</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>Optik &Sürücü:</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>Sanal sürücü ile kullanmak için sanal bir optik disk ya da fiziksel bir sürücü seçin. Sanal makine, dosyadaki veriyle sürücüye yerleştirilen bir diski veya fiziksel sürücüdeki diski, içerikleri gibi görecek.</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>Sanal optik sürücüyü ayarla</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation>Şu anahtar ile şifrelenmiş:</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5350,7 +5988,7 @@
     </message>
     <message>
         <source>Enable &I/O APIC</source>
-        <translation>&G/Ç APIC etkin</translation>
+        <translation>&G/Ç APIC etkinleştir</translation>
     </message>
     <message>
         <source>&Processor</source>
@@ -5366,7 +6004,7 @@
     </message>
     <message>
         <source>Enable PA&E/NX</source>
-        <translation>PA&E/NX etkin</translation>
+        <translation>PA&E/NX etkinleştir</translation>
     </message>
     <message>
         <source>Acce&leration</source>
@@ -5382,7 +6020,7 @@
     </message>
     <message>
         <source>Enable &VT-x/AMD-V</source>
-        <translation>&VT-x/AMD-V etkin</translation>
+        <translation>&VT-x/AMD-V etkinleştir</translation>
     </message>
     <message>
         <source>When checked, the virtual machine will try to make use of the nested paging extension of Intel VT-x and AMD-V.</source>
@@ -5390,7 +6028,7 @@
     </message>
     <message>
         <source>Enable Nested Pa&ging</source>
-        <translation>İçiçe Sa&yfalama etkin</translation>
+        <translation>İçiçe Sa&yfalamayı etkinleştir</translation>
     </message>
     <message>
         <source><qt>%1&nbsp;CPUs</qt></source>
@@ -5399,19 +6037,19 @@
     </message>
     <message>
         <source>When checked, the guest will support the Extended Firmware Interface (EFI), which is required to boot certain guest OSes. Non-EFI aware OSes will not be able to boot if this option is activated.</source>
-        <translation>İşaretlendiğinde, misafir, belli misafir İS'lerin önyüklemesini gerektiren Genişletilmiş Donanım Yazılımı Arayüzünü (EFI) destekleyecek. Eğer bu seçenek etkinleştirildiyse, EFI-olmamadan habersiz İS'leri önyükleme yapılamayacaktır.</translation>
+        <translation>İşaretlendiğinde misafir, belli misafir İS'lerin önyüklemesini gerektiren Genişletilmiş Donanım Yazılımı Arayüzünü (EFI) destekleyecek. Eğer bu seçenek etkinleştirildiyse, EFI'sız tanınan İS'leri önyükleme yapılamayacaktır.</translation>
     </message>
     <message>
         <source>Enable &EFI (special OSes only)</source>
-        <translation>&EFI (sadece özel İS'leri) etkin</translation>
+        <translation>&EFI etkinleştir (sadece özel İS'leri)</translation>
     </message>
     <message>
         <source>If checked, the RTC device will report the time in UTC, otherwise in local (host) time. Unix usually expects the hardware clock to be set to UTC.</source>
-        <translation>Eğer işaretlenmişse, RTC aygıtı UTC olarak zamanı, aksi takdirde yerel (anamakine) zamanı bildirecek. Unix genellikle donanım saatinin UTC'ye ayarlanmasını bekler.</translation>
+        <translation>Eğer işaretlendiyse, RTC aygıtı zamanı UTC olarak, aksi takdirde yerel (anamakine) zamanı bildirecek. Unix genellikle donanım saatinin UTC'ye ayarlanmasını bekler.</translation>
     </message>
     <message>
         <source>Hardware Clock in &UTC Time</source>
-        <translation>&UTC zamanı olarak donanım saati</translation>
+        <translation>&UTC Zamanı olarak Donanım Saati</translation>
     </message>
     <message>
         <source>Controls the number of virtual CPUs in the virtual machine. You need hardware virtualization support on your host system to use more than one virtual CPU.</source>
@@ -5431,7 +6069,7 @@
     </message>
     <message>
         <source>Selects the chipset to be emulated in this virtual machine. Note that the ICH9 chipset emulation is experimental and not recommended except for guest systems (such as Mac OS X) which require it.</source>
-        <translation>Bu sanal makinede uyarlanan yonga setini seçer. ICH9 yonga seti uyarlamasının deneysel olduğunu ve gerektiren misafir sistemler (Mac OS X gibi) hariç, önerilmediğini unutmayın.</translation>
+        <translation>Bu sanal makinede benzetilen yonga setini seçer. ICH9 yonga seti benzetiminin deneysel olduğunu ve gerektiren misafir sistemler (Mac OS X gibi) hariç, önerilmediğini unutmayın.</translation>
     </message>
     <message>
         <source>&Execution Cap:</source>
@@ -5469,7 +6107,7 @@
     </message>
     <message>
         <source>Determines whether the emulated pointing device is a standard PS/2 mouse, a USB tablet or a USB multi-touch tablet.</source>
-        <translation>Uyarlanan işaretleme aygıtının bir standart PS/2 fare, bir USB tablet ya da bir USB çoklu-dokunmalı tablet olup olmadığını belirler.</translation>
+        <translation>Benzetilen işaretleme aygıtının bir standart PS/2 fare, bir USB tablet ya da bir USB çoklu-dokunmalı tablet olup olmadığını belirler.</translation>
     </message>
     <message>
         <source>More than <b>%1%</b> of the host computer's memory (<b>%2</b>) is assigned to the virtual machine. Not enough memory is left for the host operating system. Please select a smaller amount.</source>
@@ -5481,11 +6119,11 @@
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>G/Ç APIC özelliği şu anda Sistem sayfasının Anakart bölümünde etkin değil. Bu, ICH9 türü bir yonga setini desteklemek için gereklidir. Eğer değişiklikleri onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
+        <translation type="obsolete">G/Ç APIC özelliği şu anda Sistem sayfasının Anakart bölümünde etkin değil. Bu, ICH9 türü bir yonga setini desteklemek için gereklidir. Eğer değişiklikleri onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
     </message>
     <message>
         <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>USB denetleyicisi uyarlama şu anda USB sayfasında etkin değil. Bu, bir uyarlanmış USB girdi aygıtı desteklemek için gereklidir. Eğer değişiklikleri onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
+        <translation type="obsolete">USB denetleyicisi uyarlama şu anda USB sayfasında etkin değil. Bu, bir uyarlanmış USB girdi aygıtı desteklemek için gereklidir. Eğer değişiklikleri onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
     </message>
     <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
@@ -5497,16 +6135,40 @@
     </message>
     <message>
         <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>G/Ç APIC özelliği şu anda Sistem sayfasının Anakart bölümünde etkin değil. Bu, birden fazla sanal işlemciyi desteklemek için gerelidir. Eğer değişiklikleri onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
+        <translation type="obsolete">G/Ç APIC özelliği şu anda Sistem sayfasının Anakart bölümünde etkin değil. Bu, birden fazla sanal işlemciyi desteklemek için gerelidir. Eğer değişiklikleri onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
     </message>
     <message>
         <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>Donanım hızlandırma şu anda Sistem sayfasının Hızlandırma bölümünde etkin değil. Bu, birden fazla sanal işlemciyi desteklemek için gerelidir. Eğer değişiklikleri onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
+        <translation type="obsolete">Donanım hızlandırma şu anda Sistem sayfasının Hızlandırma bölümünde etkin değil. Bu, birden fazla sanal işlemciyi desteklemek için gerelidir. Eğer değişiklikleri onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
     </message>
     <message>
         <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation>İşlemci çalıştırılma üst sınırı düşük bir değere ayarlı. Bu, makinenin yavaş yanıt vermesini hissettirebilir.</translation>
     </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation>&Yarı Sanallaştırma Arayüzü:</translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>Bu sanal makine tarafından kullanılacak yarı sanallaştırma misafir arayüzü sağlayıcısını seçer.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>G/Ç APIC özelliği şu an Sistem sayfasının Anakart bölümünde etkinleştirilmedi. Bu, sizin bu VM için etkinleştirdiğiniz ICH9 türü bir yonga setini desteklemek için gereklidir. Eğer değişikliklerinizi onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>USB denetleyicisi benzetimi şu an USB sayfasında etkinleştirilmedi. Bu, sizin bu VM için etkinleştirdiğiniz bir benzetilen USB girdi aygıtı desteklemek için gereklidir. Eğer değişikliklerinizi onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>G/Ç APIC özelliği şu an Sistem sayfasının Anakart bölümünde etkinleştirilmedi. Bu, sizin bu VM için seçtiğiniz birden fazla sanal işlemciyi desteklemek için gereklidir. Eğer değişikliklerinizi onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>Donanım sanallaştırma şu an Sistem sayfasının Hızlandırma bölümünde etkinleştirilmedi. Bu, sizin bu VM için seçtiğiniz birden fazla sanal işlemciyi desteklemek için gereklidir. Eğer değişikliklerinizi onaylarsanız, bu otomatik olarak yapılacaktır.</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsUSB</name>
@@ -5569,7 +6231,7 @@
     </message>
     <message>
         <source>Enable &USB Controller</source>
-        <translation>&USB Denetleyicisi etkin</translation>
+        <translation>&USB Denetleyicisini etkinleştir</translation>
     </message>
     <message>
         <source>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</source>
@@ -5577,7 +6239,7 @@
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>USB 2.0 (E&HCI) Denetleyicisi etkin</translation>
+        <translation type="obsolete">USB 2.0 (E&HCI) Denetleyicisi etkin</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5637,7 +6299,31 @@
     </message>
     <message>
         <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 bu sanal makine için şu an etkinleştirildi. Ancak bu, <b>%1</b> yüklenmesini gerektirir. Lütfen VirtualBox indirme sayfasından Genişletme Paketini yükleyin ya da makineyi başlatmak için USB 2.0'ı etkisizleştirin.</translation>
+        <translation type="obsolete">USB 2.0 şu anda bu sanal makine için etkinleştirildi. Ancak, bu <b>%1</b> yüklenmesini gerektirir. Lütfen VirtualBox indirme sitesinden Genişletme Paketini yükleyin ya da makineyi başlatmak için USB 2.0'ı etkisizleştirin.</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation>İşaretlendiğinde, bu makinenin sanal USB OHCI denetleyicisini etkinleştirir. USB OHCI denetleyicisi USB 1.0 desteği sağlar.</translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>USB &1.1 (OHCI) Denetleyicisi</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>USB &2.0 (EHCI) Denetleyicisi</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>İşaretlendiğinde, bu makinenin sanal USB xHCI denetleyicisini etkinleştirir. USB xHCI denetleyicisi USB 3.0 desteği sağlar.</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>USB &3.0 (xHCI) Denetleyicisi</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>USB 2.0/3.0 bu sanal makine için şu an etkinleştirildi. Ancak bu, <b>%1</b> yüklenmesini gerektirir. Lütfen VirtualBox indirme sitesinden Genişletme Paketini yükleyin ya da makineyi başlatabilmek için USB 2.0/3.0'ı etkisizleştirin.</translation>
     </message>
 </context>
 <context>
@@ -5663,7 +6349,7 @@
     </message>
     <message>
         <source>Holds the filter name.</source>
-        <translation>Süzgeç adını gösterir.</translation>
+        <translation>Süzgeç adını tutar.</translation>
     </message>
     <message>
         <source>&Vendor ID:</source>
@@ -5727,7 +6413,7 @@
     </message>
     <message>
         <source>Defines whether this filter applies to USB devices attached locally to the host computer (<i>No</i>), to a VRDP client's computer (<i>Yes</i>), or both (<i>Any</i>).</source>
-        <translation>Bu süzgecin anamakine bilgisayarına yerel olarak takılı USB aygıtlara (<i>Hayır</i>), VRDP istemcilerinin bilgisayarlarına (<i>Evet</i>) ya da her ikisinede (<i>Herhangi</i>) uygulanıp uygulanmayacağını tanımlar.</translation>
+        <translation>Bu süzgecin anamakine bilgisayarına yerel olarak takılı USB aygıtlara (<i>Hayır</i>), VRDP istemcilerinin bilgisayarlarına (<i>Evet</i>) ya da her ikisine de (<i>Herhangi</i>) uygulanıp uygulanmayacağını tanımlar.</translation>
     </message>
     <message>
         <source>&Action:</source>
@@ -5753,14 +6439,14 @@
     <name>UIMachineWindowNormal</name>
     <message>
         <source>Shows the currently assigned Host key.<br>This key, when pressed alone, toggles the keyboard and mouse capture state. It can also be used in combination with other keys to quickly perform actions from the main menu.</source>
-        <translation>Şu andaki atanmış Anamakine tuşunu gösterir.<br> Bu tuş, yalnız basıldığında, klavye ve fare yakalama durumunu değiştirir. Ayrıca eylemleri ana menüden daha hızlı gerçekleştirmek için diğer tuşlar ile birlikte kullanılabilir.</translation>
+        <translation>Şu anki atanmış Anamakine tuşunu gösterir.<br> Bu tuş, yalnız basıldığında, klavye ve fare yakalama durumunu değiştirir. Ayrıca eylemleri ana menüden daha hızlı gerçekleştirmek için diğer tuşlar ile birlikte kullanılabilir.</translation>
     </message>
 </context>
 <context>
     <name>UIMediumManager</name>
     <message>
         <source>&Hard drives</source>
-        <translation>Sa&bit diskler</translation>
+        <translation>Sa&bit sürücüler</translation>
     </message>
     <message>
         <source>&Optical disks</source>
@@ -5776,7 +6462,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation>K&apat</translation>
+        <translation type="obsolete">K&apat</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation>Ortam kaldırılıyor...</translation>
     </message>
 </context>
 <context>
@@ -5795,6 +6485,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>Sanal Ekran Yeniden Boyutlandırma</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>Sanal Ekran Eşleme</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>Kapat</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>Değiştir</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>Menü Çubuğunu etkinleştir</translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -5836,7 +6549,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>VirtualBox COM nesnesini oluşturma başarısız.</p><p>Uygulama şimdi sonlandırılacak.</p></translation>
+        <translation type="obsolete"><p>VirtualBox COM nesnesini oluşturma başarısız.</p><p>Uygulama şimdi sonlandırılacak.</p></translation>
     </message>
     <message>
         <source><p>Failed to load the global GUI configuration.</p><p>The application will now terminate.</p></source>
@@ -6013,7 +6726,7 @@
     </message>
     <message>
         <source>Failed to detach the USB device <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation><b>%1</b> USB aygıtını <b>%2</b> sanal makinesinden çıkartma başarısız.</translation>
+        <translation><b>%1</b> USB aygıtını <b>%2</b> sanal makinesinden ayırma başarısız.</translation>
     </message>
     <message>
         <source>Failed to create the shared folder <b>%1</b> (pointing to <nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.</source>
@@ -6025,7 +6738,7 @@
     </message>
     <message>
         <source><p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> in the current video mode. You need to capture the mouse (by clicking over the VM display or pressing the host key) in order to use the mouse inside the guest OS.</p></source>
-        <translation><p>Sanal makine misafir İS'de şu anki görüntü kipinde <b>fare işaretçisi bütünleştirme</b> desteklemediğini bildiriyor. Misafir İS içerisinde farenizi kullanmak için farenizi yakalamanız (VM ekranı üzerine tıklayarak ya da anamakine tuşuna basarak) gerekli.</p></translation>
+        <translation><p>Sanal Makine misafir İS'de şu anki görüntü kipinde <b>fare işaretçisi bütünleştirmeyi</b> desteklemediğini bildiriyor. Misafir İS içerisinde farenizi kullanmak için farenizi yakalamanız (VM ekranı üzerine tıklayarak ya da anamakine tuşuna basarak) gerekli.</p></translation>
     </message>
     <message>
         <source><p>The Virtual Machine is currently in the <b>Paused</b> state and not able to see any keyboard or mouse input. If you want to continue to work inside the VM, you need to resume it by selecting the corresponding action from the menu bar.</p></source>
@@ -6062,7 +6775,7 @@
     </message>
     <message>
         <source><p>A fatal error has occurred during virtual machine execution! The virtual machine will be powered off. Please copy the following error message using the clipboard to help diagnose the problem:</p></source>
-        <translation><p>Sanal makinenin çalıştırılması sırasında önemli bir hata meydana geldi! Sanal makine gücü kapatılacaktır. Lütfen sorunu teşhis etmede yardımcı olmak için panoyu kullanarak aşağıdaki hata mesajını kopyalayın:</p></translation>
+        <translation><p>Sanal makinenin çalıştırılması sırasında önemli bir hata meydana geldi! Sanal makine gücü kapatılacaktır. Lütfen sorunu teşhis etmede yardımcı olmak için panoyu kullanarak aşağıdaki hata iletisini kopyalayın:</p></translation>
     </message>
     <message>
         <source><p>An error has occurred during virtual machine execution! The error details are shown below. You may try to correct the error and resume the virtual machine execution.</p></source>
@@ -6106,15 +6819,15 @@
         <translation type="obsolete"><p><b><nobr>%1</nobr></b> dil dosyası yüklenemedi.</p><p>Dil geçici olarak varsayılan İngilizce (bütünleşik) diline sıfırlanacak. Lütfen VirtualBox ana penceresinin <b>Dosya</b> menüsünden açabileceğiniz <b>Tercihler</b> iletisine gidin ve <b>Dil</b> sayfasındaki mecut dillerden birini seçin.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Misafir işletim sistemine kurulan VirtualBox Guest Additions çok eski: kurulu sürüm %1, beklenen sürüm ise %2. Bazı Misafir Eklentileri özellikleri düzgün çalışmayabilir.</p><p>Lütfen <b>Aygıtlar</b> menüsünden <b>Misafir Eklentilerini (Guest Additions) Yükle...</b> ögesini seçerek Misafir Eklentilerini güncelleyin.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Misafir işletim sistemine kurulan VirtualBox Guest Additions sürümü güncelliğini yitirmiş durumda: kurulu sürüm %1, beklenen sürüm ise %2. Bazı Misafir Eklentileri özellikleri düzgün çalışmayabilir.</p><p>Lütfen <b>Aygıtlar</b> menüsünden <b>Misafir Eklentilerini (Guest Additions) Yükle...</b> ögesini seçerek Misafir Eklentilerinin güncel sürümünü yükleyin.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Misafir işletim sistemine kurulan VirtualBox Guest Additions sürümü çok yeni: kurulu sürüm %1, beklenen sürüm ise %2. Bazı Misafir Eklentileri özellikleri düzgün çalışmayabilir.</p><p>Lütfen <b>Aygıtlar</b> menüsünden <b>Misafir Eklentilerini (Guest Additions) Yükle...</b> ögesini seçerek Misafir Eklentilerinin güncel sürümünü yükleyin.</p></translation>
     </message>
     <message>
@@ -6234,9 +6947,9 @@
         <translation type="obsolete">İndir</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation>Ekle</translation>
+        <translation type="obsolete">Bağla</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -6329,11 +7042,11 @@
     </message>
     <message>
         <source><p>You have the <b>Auto capture keyboard</b> option turned on. This will cause the Virtual Machine to automatically <b>capture</b> the keyboard every time the VM window is activated and make it unavailable to other applications running on your host machine: when the keyboard is captured, all keystrokes (including system ones like Alt-Tab) will be directed to the VM.</p><p>You can press the <b>host key</b> at any time t [...]
-        <translation><p><b>Klavyeyi otomatik yakala</b> seçeneğiniz açılmış. Bu, VM pencersinin etkinleştirildiği her seferde Sanal Makinenin klavyenizi otomatik olarak <b>yakalamasına</b> neden olacak ve anamakinenizde çalışan diğer uygulamar için kullanılamaz yapacak: klavye yakalandığında tüm tuşa basmalar (Alt-Tab gibi sistem için olanlar da dahil) VM'eyönlendirilecektir.</p><p>İstediğiniz zaman klavyeyi ve fareyi (eğer yakalandıysa) &lt [...]
+        <translation><p><b>Klavyeyi otomatik yakala</b> seçeneğiniz açılmış. Bu, VM penceresinin etkinleştirildiği her seferde Sanal Makinenin klavyenizi otomatik olarak <b>yakalamasına</b> neden olacak ve anamakinenizde çalışan diğer uygulamar için kullanılamaz yapacak: klavye yakalandığında tüm tuşa basmalar (Alt-Tab gibi sistem için olanlar da dahil) VM'eyönlendirilecektir.</p><p>İstediğiniz zaman klavyeyi ve fareyi (eğer yakalandıysa) &l [...]
     </message>
     <message>
         <source><p>The Virtual Machine reports that the guest OS supports <b>mouse pointer integration</b>. This means that you do not need to <i>capture</i> the mouse pointer to be able to use it in your guest OS -- all mouse actions you perform when the mouse pointer is over the Virtual Machine's display are directly sent to the guest OS. If the mouse is currently captured, it will be automatically uncaptured.</p><p>The mouse icon on the s [...]
-        <translation><p>Sanal Makine misafir İS'nin <b>fare işaretçisi bütünleştirme</b> desteklediğini bildiriyor. Bu, fare işaretçisinin misafir İS'niz içinde kullanılabilmesi için <i>yaklamanıza</i> gerek olmadığı anlamına geliyor -- Sanal Makine ekranının üzerine fare işaretçisi geldiğinde gerçekleştirdiğiniz tüm fare eylemleri doğrudan misafir İS'ne gönderilir. Eğer fare şu anda yakalanırsa, otomatik olarak serbest bırakılacaktır.</p&g [...]
+        <translation><p>Sanal Makine misafir İS'nin <b>fare işaretçisi bütünleştirmeyi</b> desteklediğini bildiriyor. Bu, fare işaretçisinin misafir İS'niz içinde kullanılabilmesi için <i>yakalamanıza</i> gerek olmadığı anlamına geliyor -- Sanal Makine ekranının üzerine fare işaretçisi geldiğinde gerçekleştirdiğiniz tüm fare eylemleri doğrudan misafir İS'ne gönderilir. Eğer fare şu anda yakalanırsa, otomatik olarak serbest bırakılacaktır.</ [...]
     </message>
     <message>
         <source>&Contents...</source>
@@ -6384,8 +7097,8 @@
         <translation type="obsolete">Ürün bilgilerini gösteren bir pencere aç</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>VirtualBox'ın yeni bir sürümü yayımlandı! Sürüm <b>%1</b> <a href="https://www.virtualbox.org/">virtualbox.org</a> adresinde mevcuttur.</p><p>Şu bağlantıyı kullanarak bu sürümü indirebilirsiniz:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>VirtualBox'ın yeni bir sürümü yayımlandı! Sürüm <b>%1</b> <a href="http://www.virtualbox.org/">virtualbox.org</a> adresinde mevcuttur.</p><p>Şu bağlantıyı kullanarak bu sürümü indirebilirsiniz:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6465,7 +7178,7 @@
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Bir ya da daha fazla sanal sabit disk, CD/DVD veya disket kalıbı dosyası şu anda erişilebilir değil. Sonuç olarak, daha sonra erişilebilir olana kadar bu dosyaları kullanan sanal makineleri işletemeyceksiniz.</p><p>Sanal Ortam Yöneticisi penceresini açmak için <b>Kontrol et</b> düğmesine basın ve hangi dosyaların erişilemez olduğunu görün, ya da bu mesajı yoksaymak için <b>Yoksay</b> düğmesine basın.</p></translation>
+        <translation type="obsolete"><p>Bir ya da daha fazla sanal sabit disk, CD/DVD veya disket kalıbı dosyası şu anda erişilebilir değil. Sonuç olarak, daha sonra erişilebilir olana kadar bu dosyaları kullanan sanal makineleri işletemeyceksiniz.</p><p>Sanal Ortam Yöneticisi penceresini açmak için <b>Kontrol et</b> düğmesine basın ve hangi dosyaların erişilemez olduğunu görün, ya da bu mesajı yoksaymak için <b>Yoksay</b> düğmesine basın.</p& [...]
     </message>
     <message>
         <source>&More</source>
@@ -6483,8 +7196,8 @@
         <translation type="obsolete">&Üzerine Yaz</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Sanal makine çalışırken ciddi bir hata meydana geldi ve makinenin çalıştırılması durdu.</p><p>Yardım için lütfen <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> adresindeki Community bölümüne veya destek sözleşmenize bakın. Lütfen <nobr><b>%1</b></nobr> dizininde bulabileceğiniz <tt>VBox.log</tt> günlük dosyasının ve <tt>VBox.png</tt> resim dosyasının içeriklerinin yanı [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Sanal makine çalışırken ciddi bir hata meydana geldi ve makinenin çalışması durduruldu.</p><p>Yardım için lütfen <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> adresindeki Community bölümüne veya destek sözleşmenize bakın. Lütfen <nobr><b>%1</b></nobr> dizininde bulabileceğiniz <tt>VBox.log</tt> günlük dosyasının ve <tt>VBox.png</tt> resim dosyasının içer [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -6704,7 +7417,7 @@
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>CD/DVD aygıtını silmek istediğinize emin misiniz?</p><p>Herhangi bir CD veya ISO kalıbını yerleştiremeyeceksiniz ya da onsuz Misafir Eklentilerini yükleyemeyeceksiniz!</p></translation>
+        <translation type="obsolete"><p>CD/DVD aygıtını silmek istediğinize emin misiniz?</p><p>Herhangi bir CD veya ISO kalıbını yerleştiremeyeceksiniz ya da onsuz Misafir Eklentilerini yükleyemeyeceksiniz!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -6791,7 +7504,7 @@
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p><b>%1</b> denetleyicisine yeni bir CD/DVD sürücü eklemek üzeresiniz.</p><p>Sürücüye koymak için sanal bir CD/DVD disk seçmek ya da şimdilik boş bırakmak ister misiniz?</p></translation>
+        <translation type="obsolete"><p><b>%1</b> denetleyicisine yeni bir CD/DVD sürücü eklemek üzeresiniz.</p><p>Sürücüye koymak için sanal bir CD/DVD disk seçmek ya da şimdilik boş bırakmak ister misiniz?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -6809,15 +7522,15 @@
     </message>
     <message>
         <source>Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation><b>%3</b> makinesinin <i>%2</i> yuvasından sabit diski (<nobr><b>%1</b></nobr>) çıkartma başarısız.</translation>
+        <translation><b>%3</b> makinesinin <i>%2</i> yuvasından sabit diski (<nobr><b>%1</b></nobr>) ayırma başarısız.</translation>
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation><b>%3</b> makinesinin <i>%2</i> yuvasından CD/DVD aygıtını (<nobr><b>%1</b></nobr>) çıkartma başarısız.</translation>
+        <translation type="obsolete"><b>%3</b> makinesinin <i>%2</i> yuvasından CD/DVD aygıtını (<nobr><b>%1</b></nobr>) çıkartma başarısız.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation><b>%3</b> makinesinin <i>%2</i> yuvasından disket aygıtını (<nobr><b>%1</b></nobr>) çıkartma başarısız.</translation>
+        <translation type="obsolete"><b>%3</b> makinesinin <i>%2</i> yuvasından disket aygıtını (<nobr><b>%1</b></nobr>) çıkartma başarısız.</translation>
     </message>
     <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
@@ -6837,7 +7550,7 @@
     </message>
     <message>
         <source>The current port forwarding rules are not valid. None of the host or guest port values may be set to zero.</source>
-        <translation>Şu anki bağlantı noktası yönlendirme kuralları geçerli değil. Anamakine veya misafir bağlantı noktası değerleri sıfıra ayarlanmış olabilir.</translation>
+        <translation>Şu anki bağlantı noktası yönlendirme kuralları geçerli değil. Anamakine veya misafir bağlantı noktası değerlerinin hiçbiri sıfıra ayarlanmamış olabilir.</translation>
     </message>
     <message>
         <source><p>There are unsaved changes in the port forwarding configuration.</p><p>If you proceed your changes will be discarded.</p></source>
@@ -6849,19 +7562,19 @@
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation><b>%3</b> makinesinin <i>%2</i> yuvasına CD/DVD aygıtını (<nobr><b>%1</b></nobr>) takma başarısız.</translation>
+        <translation type="obsolete"><b>%3</b> makinesinin <i>%2</i> yuvasına CD/DVD aygıtını (<nobr><b>%1</b></nobr>) takma başarısız.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation><b>%3</b> makinesinin <i>%2</i> yuvasına disket aygıtını (<nobr><b>%1</b></nobr>) takma başarısız.</translation>
+        <translation type="obsolete"><b>%3</b> makinesinin <i>%2</i> yuvasına disket aygıtını (<nobr><b>%1</b></nobr>) takma başarısız.</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>Bu ortamın depolama biriminin silinmeyeceğini ve de daha sonra tekrar kullanmanın mümkün olacağını unutmayın.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>VirtualBox Misafir Eklentileri bu sanal makinede kullanılabilir görünmüyor ve paylaşılan klasörler onlar olmadan kullanılamaz. Paylaşılan klasörleri sanal makine içerisinde kullanmak için lütfen <b>Aygıtlar</b> menüsünden <b>Misafir Eklentileri CD kalıbını ekle</b>'yi seçerek, yüklü değillerse Misafir Eklentilerini yükleyin veya düzgün olarak çalışmıyorlarsa, yeniden yükleyin. Eğer yüklü ama makine tam olarak henüz başlatılmadıys [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>VirtualBox Misafir Eklentileri bu sanal makinede mevcut görünmüyor ve paylaşılan klasörler onlar olmadan kullanılamaz. Paylaşılan klasörleri sanal makine içerisinde kullanmak için lütfen <b>Aygıtlar</b> menüsünden <b>Misafir Eklentilerini Yükle</b>'yi seçerek, yüklü değillerse Misafir Eklentilerini yükleyin veya düzgün olarak çalışmıyorlarsa, yeniden yükleyin. Eğer yüklü ama makine tam olarak henüz başlatılmadıysa [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -7086,11 +7799,11 @@
     </message>
     <message>
         <source>You are about to create a new virtual machine without a hard drive. You will not be able to install an operating system on the machine until you add one. In the mean time you will only be able to start the machine using a virtual optical disk or from the network.</source>
-        <translation>Sabit diski olmayan yeni bir sanal makine oluşturmak üzeresiniz. Bir tane ekleyene kadar makine üzerine bir işletim sistemi yükleyemeyeceksiniz. Bu arada sadece sanal optik diski kullanarak veya ağdan makineyi başlatabileceksiniz.</translation>
+        <translation>Sabit sürücü olmayan yeni bir sanal makine oluşturmak üzeresiniz. Bir tane ekleyene kadar makine üzerine bir işletim sistemi yükleyemeyeceksiniz. Bu arada sadece sanal optik diski kullanarak veya ağdan makineyi başlatabileceksiniz.</translation>
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Veriyi kaldırma başarısız.</translation>
+        <translation type="obsolete">Veriyi kaldırma başarısız.</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -7194,7 +7907,7 @@
     </message>
     <message>
         <source>&Choose existing disk</source>
-        <translation>Mevcut diski &seçin</translation>
+        <translation>Mevcut diski &seç</translation>
     </message>
     <message>
         <source>Leave &empty</source>
@@ -7202,7 +7915,7 @@
     </message>
     <message>
         <source>&Choose disk</source>
-        <translation>&Disk seçin</translation>
+        <translation>&Disk seç</translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%2</b>.</p></source>
@@ -7325,11 +8038,11 @@
     </message>
     <message>
         <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p><b>VirtualBox Misafir Eklentileri</b> disk kalıbı dosyası <nobr><a href="%1">%1</a></nobr> adresinden başarılı olarak indirildi ve <nobr><b>%2</b></nobr> ile yerel olarak kaydedildi.</p><p>Bu disk kalıbı dosyasını kaydettirmek ve sanal CD/DVD sürücüsüne yerleştirmek ister misiniz?</p></translation>
+        <translation type="obsolete"><p><b>VirtualBox Misafir Eklentileri</b> disk kalıbı dosyası <nobr><a href="%1">%1</a></nobr> adresinden başarılı olarak indirildi ve <nobr><b>%2</b></nobr> ile yerel olarak kaydedildi.</p><p>Bu disk kalıbı dosyasını kaydettirmek ve sanal CD/DVD sürücüsüne yerleştirmek ister misiniz?</p></translation>
     </message>
     <message>
         <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><b>%1</b> sanal makinesi içine <b>VirtualBox Misafir Eklentileri</b> disk kalıbı dosyası yerleştirilemedi, makine CD/DVD sürücülere sahip değil gibi. Lütfen sanal makine ayarları penceresinin depolama sayfasını kullanarak bir sürücü ekleyin.</p></translation>
+        <translation type="obsolete"><b>%1</b> sanal makinesi içine <b>VirtualBox Misafir Eklentileri</b> disk kalıbı dosyası yerleştirilemedi, makine CD/DVD sürücülere sahip değil gibi. Lütfen sanal makine ayarları penceresinin depolama sayfasını kullanarak bir sürücü ekleyin.</p></translation>
     </message>
     <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
@@ -7364,74 +8077,197 @@
         <translation><p><nobr><b>%1</b></nobr> NAT ağını kaldırmak istiyor musunuz?</p><p>Eğer bu ağ bir ya da daha fazla sanal makine ağ bağdaştırıcıları tarafından kullanımdaysa, bu bağdaştırıcılar, siz ya farklı bir ağ adı ya da farklı bir bağdaştırıcı ekleme türü seçerek ayarlarını düzeltene kadar artık kullanılabilir olmayacak.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>VirtualBox Misafir Eklentileri bu sanal makinede mevcut görünmüyor ve paylaşılan klasörler onlar olmadan kullanılamaz. Paylaşılan klasörleri sanal makine içerisinde kullanmak için lütfen <b>Aygıtlar</b> menüsünden <b>Misafir Eklentilerini Yükle</b>'yi seçerek, yüklü değillerse Misafir Eklentilerini yükleyin veya düzgün olarak çalışmıyorlarsa, yeniden yükleyin. Eğer yüklü ama makine tam olarak henüz başlatılmadıysa [...]
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation><b>%1</b> web kamerasını <b>%2</b> sanal makinesine takma başarısız.</translation>
     </message>
     <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Bağla</translation>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation><b>%1</b> web kamerasını <b>%2</b> sanal makinesinden ayırma başarısız.</translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation><b>%2</b> sanal makinesine <b>%1</b> web kamerasını takma başarısız.</translation>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation><p>VirtualBox Misafir Eklentileri bu sanal makinede mevcut görünmüyor ve paylaşılan klasörler onlar olmadan kullanılamaz. Paylaşılan klasörleri sanal makine içerisinde kullanmak için lütfen <b>Aygıtlar</b> menüsünden <b>Misafir Eklentileri CD kalıbını yerleştir</b>'i seçerek, yüklü değillerse Misafir Eklentilerini yükleyin veya düzgün olarak çalışmıyorlarsa, yeniden yükleyin. Eğer yüklü ama makine tam olarak henüz başlatılmadıysa o  [...]
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation><b>%2</b> sanal makinesinden <b>%1</b> web kamerasını çıkartma başarısız.</translation>
+        <source>Insert</source>
+        <comment>additions</comment>
+        <translation>Ekle</translation>
     </message>
     <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>Sanal ekran şu anda <b>%1&nbsp;bit</b> renk kipine ayarlı. Daha iyi performans için lütfen bunu <b>%2&nbsp;bit</b> olarak değiştirin. Bu genelde misafir işletim sisteminin Denetim Masasının ya da Sistem Ayarlarının <b>Görüntü</b> bölümünden yapılabilir.</p></translation>
+        <translation><p>Sanal ekran şu an <b>%1&nbsp;bit</b> renk kipine ayarlı. Daha iyi performans için lütfen bunu <b>%2&nbsp;bit</b> olarak değiştirin. Bu genellikle misafir işletim sisteminin Denetim Masası'nın ya da Sistem Ayarları'nın <b>Görüntü</b> bölümünden yapılabilir.</p></translation>
     </message>
-</context>
-<context>
-    <name>UIMiniProcessWidgetAdditions</name>
     <message>
-        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
-        <translation type="obsolete">VirtualBox Guest Additions CD kalıbı indirme işlemini iptal et</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation>Şu anki bağlantı noktası yönlendirme kuralları geçerli değil. Kural adları benzersiz olmalıdır.</translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
-        <translation type="obsolete">VirtualBox Guest Additions CD kalıbı <nobr><b>%1</b> adresinden indiriliyor...</nobr></translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation>Şu anki bağlantı noktası yönlendirme kuralları geçerli değil. Birkaç kural aynı anamakine bağlantı noktalarına ve çakışan IP adreslerine sahip.</translation>
     </message>
-</context>
-<context>
-    <name>UIMiniProgressWidgetAdditions</name>
     <message>
-        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
-        <translation type="obsolete">VirtualBox Guest Additions CD kalıbı indirme işlemini iptal et</translation>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>VirtualBoxClient COM nesnesini oluşturma başarısız.</p><p>Uygulama şimdi sonlandırılacak.</p></translation>
     </message>
     <message>
-        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
-        <translation type="obsolete">VirtualBox Guest Additions CD kalıbı <nobr><b>%1</b> adresinden indiriliyor...</nobr></translation>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation><i>%1</i> anahtarı için genel VirtualBox ilave verisini <i>{%2}</i> değerine ayarlama başarısız.</translation>
     </message>
-</context>
-<context>
-    <name>UIMiniToolBar</name>
     <message>
-        <source>Always show the toolbar</source>
-        <translation>Araç çubuğunu her zaman göster</translation>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation><i>%2</i> makinesinin <i>%1</i> anahtarı için ilave verisini <i>{%3}</i> değerine ayarlama başarısız.</translation>
     </message>
     <message>
-        <source>Minimize Window</source>
-        <translation>Pencere Simge Durumuna</translation>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>Bir ya da daha fazla sanal sabit disk, optik disk veya disket kalıbı dosyası şu anda erişilebilir değil. Sonuç olarak, daha sonra erişilebilir olana kadar bu dosyaları kullanan sanal makineleri işletemeyceksiniz.</p><p>Sanal Ortam Yöneticisi penceresini açmak için <b>Kontrol et</b> düğmesine basın ve hangi dosyaların erişilemez olduğunu görün, ya da bu iletiyi yoksaymak için <b>Yoksay</b> düğmesine basın.</p></translation>
     </message>
     <message>
-        <source>Exit Full Screen or Seamless Mode</source>
-        <translation>Tam Ekran veya Özgün Kipinden Çık</translation>
+        <source>Failed to save the settings.</source>
+        <translation>Ayarları kaydetme başarısız.</translation>
     </message>
     <message>
-        <source>Close VM</source>
-        <translation>VM'i Kapat</translation>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p><b>%1</b> denetleyicisine yeni bir optik sürücü eklemek üzeresiniz.</p><p>Sürücüye koymak için sanal bir optik disk seçmek ya da şimdilik boş bırakmak ister misiniz?</p></translation>
     </message>
-</context>
-<context>
-    <name>UIMultiScreenLayout</name>
     <message>
-        <source>Virtual Screen %1</source>
-        <translation>Sanal Ekran %1</translation>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>Optik sürücüyü silmek istediğinize emin misiniz?</p><p>Herhangi bir optik diski veya ISO kalıbını yerleştiremeyeceksiniz ya da onsuz Misafir Eklentilerini yükleyemeyeceksiniz!</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation><b>%3</b> makinesinin <i>%2</i> yuvasına optik sürücüyü (<nobr><b>%1</b></nobr>) takma başarısız.</translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation><b>%3</b> makinesinin <i>%2</i> yuvasına disket sürücüyü (<nobr><b>%1</b></nobr>) takma başarısız.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation><b>%3</b> makinesinin <i>%2</i> yuvasından optik sürücüyü (<nobr><b>%1</b></nobr>) ayırma başarısız.</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation><b>%3</b> makinesinin <i>%2</i> yuvasından disket sürücüyü (<nobr><b>%1</b></nobr>) ayırma başarısız.</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this er [...]
+        <translation type="obsolete"><p>Sanal makine çalışırken ciddi bir hata meydana geldi ve makinenin çalışması durdurulmalı.</p><p>Yardım için lütfen <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> adresindeki Community bölümüne veya destek sözleşmenize bakın. Lütfen sanal amkine günlük dizininde bulabileceğiniz <tt>VBox.log</tt> günlük dosyasının içeriklerinin yanısıra bu hata olduğunda ne yapıyor olduğunuzun açıklamasını da [...]
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete"><b>%1</b> sanal makinesinin ağ bağdaştırıcısı kablosunu bağlama başarısız.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete"><b>%1</b> sanal makinesinden ağ bağdaştırıcısı kablosu bağlantısını kesme başarısız.</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation><b>%1</b> sanal makinesi içine <b>VirtualBox Misafir Eklentileri</b> disk kalıbı dosyası yerleştirilemedi, makine optik sürücülere sahip değil gibi. Lütfen sanal makine ayarları penceresinin depolama sayfasını kullanarak bir sürücü ekleyin.</p></translation>
+    </message>
+    <message>
+        <source>Unable to enter password!</source>
+        <translation type="obsolete">Parola girilemiyor!</translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p><b>VirtualBox Misafir Eklentileri</b> disk kalıbı dosyası <nobr><a href="%1">%1</a></nobr> adresinden başarılı olarak indirildi ve <nobr><b>%2</b></nobr> ile yerel olarak kaydedildi.</p><p>Bu disk kalıbı dosyasını kaydettirmek ve sanal optik sürücü içine yerleştirmek ister misiniz?</p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation failed.</source>
+        <translation type="obsolete">Sürükle ve bırak işlemi başarısız oldu.</translation>
+    </message>
+    <message>
+        <source>Failed while dropping data.</source>
+        <translation type="obsolete">Veri bırakılırken başarısız.</translation>
+    </message>
+    <message>
+        <source>Unable to cancel drag and drop operation.</source>
+        <translation type="obsolete">Sürükle ve bırak işlemi iptal edilemiyor.</translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation>Hatalı parola ya da kimlik doğrulaması başarısız.</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation><p>Sanal makine çalışırken ciddi bir hata meydana geldi ve makinenin çalışması durduruldu.</p><p>Yardım için lütfen <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> adresindeki Community bölümüne veya destek sözleşmenize bakın. Lütfen <nobr><b>%1</b></nobr> dizininde bulabileceğiniz <tt>VBox.log</tt> günlük dosyasının ve <tt>VBox.png</tt> resim dosyasının içeriklerinin yanı [...]
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation><p>Sanal makine çalışırken ciddi bir hata meydana geldi ve makinenin çalışması durdurulmalı.</p><p>Yardım için lütfen <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> adresindeki Community bölümüne veya destek sözleşmenize bakın. Lütfen sanal amkine günlük dizininde bulabileceğiniz <tt>VBox.log</tt> günlük dosyasının içeriklerinin yanısıra bu hata olduğunda ne yapıyor olduğunuzun açıklamasını da verin. Ayrıca [...]
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation><p>VirtualBox'ın yeni bir sürümü yayımlandı! Sürüm <b>%1</b> <a href="https://www.virtualbox.org/">virtualbox.org</a> adresinde mevcuttur.</p><p>Şu bağlantıyı kullanarak bu sürümü indirebilirsiniz:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation>Anamakineden misafire sürükle ve bırak işlemi başarısız oldu.</translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation>Anamakineden misafire sürükle ve bırak işlemi iptal edilemiyor.</translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation>Misafirden anamakineye sürükle ve bırak işlemi başarısız oldu.</translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation><b>%1</b> sanal makinesinin ağ bağdaştırıcısı kablosunu bağlama başarısız.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation><b>%1</b> sanal makinesinden ağ bağdaştırıcısı kablosu bağlantısını kesme başarısız.</translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProcessWidgetAdditions</name>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">VirtualBox Guest Additions CD kalıbı indirme işlemini iptal et</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete">VirtualBox Guest Additions CD kalıbı <nobr><b>%1</b> adresinden indiriliyor...</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniProgressWidgetAdditions</name>
+    <message>
+        <source>Cancel the VirtualBox Guest Additions disk image file download</source>
+        <translation type="obsolete">VirtualBox Guest Additions CD kalıbı indirme işlemini iptal et</translation>
+    </message>
+    <message>
+        <source>Downloading the VirtualBox Guest Additions disk image file from <nobr><b>%1</b>...</nobr></source>
+        <translation type="obsolete">VirtualBox Guest Additions CD kalıbı <nobr><b>%1</b> adresinden indiriliyor...</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIMiniToolBar</name>
+    <message>
+        <source>Always show the toolbar</source>
+        <translation>Araç çubuğunu her zaman göster</translation>
+    </message>
+    <message>
+        <source>Minimize Window</source>
+        <translation>Pencere Simge Durumuna</translation>
+    </message>
+    <message>
+        <source>Exit Full Screen or Seamless Mode</source>
+        <translation>Tam Ekran veya Özgün Kipinden Çık</translation>
+    </message>
+    <message>
+        <source>Close VM</source>
+        <translation>VM'i Kapat</translation>
+    </message>
+</context>
+<context>
+    <name>UIMultiScreenLayout</name>
+    <message>
+        <source>Virtual Screen %1</source>
+        <translation>Sanal Ekran %1</translation>
     </message>
     <message>
         <source>Use Host Screen %1</source>
@@ -7441,12 +8277,12 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Adı:</translation>
     </message>
     <message>
         <source>Holds the name of the virtual machine.</source>
-        <translation>Sanal makinenin adını gösterir.</translation>
+        <translation>Sanal makinenin adını tutar.</translation>
     </message>
     <message>
         <source>&Type:</source>
@@ -8238,14 +9074,18 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
         <translation>Sanal makine dosyaları (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>VirtualBox'a Hoş Geldiniz!</h3><p>Bu pencerenin sol tarafı bilgisayarınızdaki tüm sanal makinelerin listesidir. Liste şimdi boş çünkü henüz herhangi bir sanal makine oluşturmadınız.<img src=:/welcome.png align=right/></p><p>Yeni bir sanal makine oluşturmak için pencerenin en üstünde bulunan ana araç çubuğundaki <b>Yeni</b> düğmesine basın.</p><p><b>%1</b> tuşuna basarak anında yardım ala [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>VirtualBox'a Hoş Geldiniz!</h3><p>Bu pencerenin sol tarafı bilgisayarınızdaki tüm sanal makinelerin listesidir. Liste şimdi boş çünkü henüz herhangi bir sanal makine oluşturmadınız.<img src=:/welcome.png align=right/></p><p>Yeni bir sanal makine oluşturmak için pencerenin en üstünde bulunan ana araç çubuğundaki <b>Yeni</b> düğmesine basın.</p><p><b>%1</b> tuşuna basarak a [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Yöneticisi</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation><h3>VirtualBox'a Hoş Geldiniz!</h3><p>Bu pencerenin sol tarafı bilgisayarınızdaki tüm sanal makinelerin listesidir. Liste şimdi boş çünkü henüz herhangi bir sanal makine oluşturmadınız.<img src=:/welcome.png align=right/></p><p>Yeni bir sanal makine oluşturmak için pencerenin en üstünde bulunan ana araç çubuğundaki <b>Yeni</b> düğmesine basın.</p><p><b>%1</b> tuşuna basarak anında yardım ala [...]
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -8274,7 +9114,7 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>Settings</source>
-        <translation>Ayarlar</translation>
+        <translation type="obsolete">Ayarlar</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -8327,6 +9167,10 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
         <source>Display</source>
         <translation>Ekran</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation>Tercihler</translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -8378,6 +9222,43 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
         <source>%1 - %2</source>
         <translation>%1 - %2</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation>Kullanıcı Arayüzü</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation>Ayarlar</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>Ayarlar yükleniyor...</translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation>Ayarlar kaydediliyor...</translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation><nobr>Gösterge varlığını değiştirmek için <b>tıklayın</b>.</nobr><br><nobr>Gösterge konumunu değiştirmek için <b>Sürükle ve Bırak</b>'ın.</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation>Kapat</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation>Durum Çubuğunu etkinleştir</translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -8534,6 +9415,14 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
         <source>&Restore current snapshot '%1'</source>
         <translation>Şu anki '%1' anlık görüntüsünü geri &yükle</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>Arka planda çalışmaya &devam et</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><p>Sanal makine pencerelerini kapatır ama sanal makineyi çalışır halde tutar.</p><p>Çalışan sanal makineyi bir pencere içine döndürmek için VirtualBox Yöneticisi'ni kullanabilirsiniz.</p></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -8547,6 +9436,180 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>Session Information Dialog</source>
+        <translation type="obsolete">Oturum Bilgileri Penceresi</translation>
+    </message>
+    <message>
+        <source>&Close</source>
+        <translation type="obsolete">&Kapat</translation>
+    </message>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - Oturum Bilgisi</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">&Ayrıntılar</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">Çalışma &Zamanı</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA Aktarımları</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO Aktarımları</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Okunan Veri</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Yazılan Veri</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Aktarılan Veri</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Alınan Veri</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <translation type="obsolete">Etkin</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <translation type="obsolete">Pasifleştirilmiş</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Çalışma Zamanı Öznitelikleri</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Ekran Çözünürlüğü</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">CD/DVD İstatistikleri</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Ağ Bağdaştırıcısı İstatistikleri</translation>
+    </message>
+    <message>
+        <source>Not attached</source>
+        <translation type="obsolete">Eklenmedi</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Sürüm %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Algılanmamış</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Algılanmamış</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Misafir Eklentileri</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Misafir İS Türü</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Sabit Disk İstatistikleri</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Sabit Disk Yok</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Ağ Bağdaştırıcıları Yok</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Etkin</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Pasifleştirilmiş</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Yerleşik Sayfalama</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">VBoxSMBilgiİletisi</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Depolama İstatistikleri</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Depolama Aygıtları Yok</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Ağ İstatistikleri</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Yerleşik Sayfalama</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Mevcut Değil</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Pano Kipi</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Sürükle'v'Bırak Kipi</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>Yapılandırma &Ayrıntıları</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>Çalışma &Zamanı Bilgisi</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation>VM Çalışma Zamanı</translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation>Sürükle ve Bırak Kipi</translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -8555,12 +9618,12 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
         <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%3 tarihinden bu yana %2</nobr><br><nobr>Oturum %4</nobr></translation>
+        <translation><nobr>%1<br></nobr><nobr>%3 tarihinden/saatinden bu yana %2</nobr><br><nobr>Oturum %4</nobr></translation>
     </message>
     <message>
         <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
         <comment>Inaccessible VM tooltip (name, last state change)</comment>
-        <translation><nobr><b>%1</b><br></nobr><nobr>%2 tarihinden bu yana erişilemez</nobr></translation>
+        <translation><nobr><b>%1</b><br></nobr><nobr>%2 tarihinden/saatinden bu yana erişilemez</nobr></translation>
     </message>
     <message>
         <source>S&how</source>
@@ -8697,18 +9760,34 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Açıklamayı Gizle</translation>
+        <translation type="obsolete">Açıklamayı Gizle</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Açıklamayı Göster</translation>
+        <translation type="obsolete">Açıklamayı Göster</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation>&Uzman Kipi</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation><nobr><b>Uzman Kipi</b></nobr>'ne değiştirin, deneyimli kullanıcılar için tek sayfalık bir iletidir.</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>&Rehberli Kip</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation><nobr><b>Rehberli Kip</b></nobr>'e değiştirin, ayrıntılı açıklamaları olan adım adım bir iletidir.</translation>
     </message>
 </context>
 <context>
     <name>UIWizardCloneVD</name>
     <message>
         <source>Copy Virtual Hard Drive</source>
-        <translation>Sanal Sabit Diski Kopyala</translation>
+        <translation>Sanal Sabit Sürücüyü Kopyala</translation>
     </message>
     <message>
         <source>Copy</source>
@@ -8716,43 +9795,43 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>Hard drive to copy</source>
-        <translation>Kopyalamak için sabit disk</translation>
+        <translation>Kopyalamak için sabit sürücü</translation>
     </message>
     <message>
         <source><p>Please select the virtual hard drive file that you would like to copy if it is not already selected. You can either choose one from the list or use the folder icon beside the list to select one.</p></source>
-        <translation><p>Lütfen kopyalamak istediğiniz sanal sabit disk dosyası eğer seçilmediyse seçin. Ya listeden birisini seçebilirsiniz ya da birini seçmek için listenin yanındaki klasör simgesini kullanabilirsiniz.</p></translation>
+        <translation><p>Lütfen kopyalamak istediğiniz sanal sabit sürücü dosyası eğer seçilmediyse seçin. Ya listeden birisini seçebilirsiniz ya da birini seçmek için listenin yanındaki klasör simgesini kullanabilirsiniz.</p></translation>
     </message>
     <message>
         <source>Choose a virtual hard drive file to copy...</source>
-        <translation>Kopyalamak için sanal sabit disk dosyasını seçin...</translation>
+        <translation>Kopyalamak için sanal sabit sürücü dosyasını seçin...</translation>
     </message>
     <message>
         <source>Hard drive file type</source>
-        <translation>Sabit disk dosyası türü</translation>
+        <translation>Sabit sürücü dosyası türü</translation>
     </message>
     <message>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Lütfen yeni sanal sabit disk için kullanmak istediğiniz dosyanın türünü seçin. Eğer diğer sanallaştırma yazılımları ile kullanmaya ihtiyacınız yoksa bu ayarı değiştirmeden bırakabilirsiniz.</translation>
+        <translation>Lütfen yeni sanal sabit sürücü için kullanmak istediğiniz dosyanın türünü seçin. Eğer diğer sanallaştırma yazılımları ile kullanmaya ihtiyacınız yoksa bu ayarı değiştirmeden bırakabilirsiniz.</translation>
     </message>
     <message>
         <source>Storage on physical hard drive</source>
-        <translation>Fiziksel sabit diskte depolama</translation>
+        <translation>Fiziksel sabit sürücü depolama</translation>
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>Lütfen yeni sanal sabit disk dosyasının kullanılmasına göre (değişken olarak ayrılan) büyüyüp büyümemesini ya da en fazla boyutunda (sabitlenmiş boyut) oluşturulup oluşturulmamalıysa seçin.</translation>
+        <translation>Lütfen yeni sanal sabit sürücü dosyasının kullanılmasına göre (değişken olarak ayrılan) büyüyüp büyümemesini ya da en fazla boyutunda (sabitlenmiş boyut) oluşturulup oluşturulmamalıysa seçin.</translation>
     </message>
     <message>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
-        <translation><p><b>Değişken olarak ayrılan</b> sabit disk dosyası sadece fiziksel sabit diskinizdeki alanı doldurarak (en fazla <b>sabitlenmiş boyuta</b> kadar) kullanacak olmasına rağmen alan serbest kaldığında otomatik olarak tekrar küçülmeyecektir.</p></translation>
+        <translation><p><b>Değişken olarak ayrılan</b> sabit sürücü dosyası sadece fiziksel sabit sürücünüzdeki alanı doldurarak (en fazla <b>sabitlenmiş boyuta</b> kadar) kullanacak olmasına rağmen alan serbest kaldığında otomatik olarak tekrar küçülmeyecektir.</p></translation>
     </message>
     <message>
         <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
-        <translation><p><b>Sabitlenmiş boyutlu</b> sabit disk dosyasını oluşturmak bazı sistemlerde uzun sürebilir ama kullanması çoğu kez en hızlı olandır.</p></translation>
+        <translation><p><b>Sabitlenmiş boyutlu</b> sabit sürücü dosyasını oluşturmak bazı sistemlerde uzun sürebilir ama kullanması çoğu kez en hızlı olandır.</p></translation>
     </message>
     <message>
         <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
-        <translation><p>Ayrıca sabit disk dosyasını her biri iki gigabayta kadar birkaç dosyaya <b>bölmeyi</b> seçebilirsiniz. Bu çoğunlukla eğer sanal makineyi kaldırılabilir USB aygıtlarda veya çok büyük dosyalarla başa çıkamayan bazı eski sistemlerde depolamak isterseniz faydalıdır.</translation>
+        <translation><p>Ayrıca sabit sürücü dosyasını her biri iki gigabayta kadar birkaç dosyaya <b>bölmeyi</b> seçebilirsiniz. Bu çoğunlukla eğer sanal makineyi kaldırılabilir USB aygıtlarda veya çok büyük dosyalarla başa çıkamayan bazı eski sistemlerde depolamak isterseniz faydalıdır.</translation>
     </message>
     <message>
         <source>&Dynamically allocated</source>
@@ -8768,19 +9847,19 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Lütfen yeni sanal sabit disk dosyası için bir yer seçin</translation>
+        <translation>Lütfen yeni sanal sabit sürücü dosyası için bir yer seçin</translation>
     </message>
     <message>
         <source>New hard drive to create</source>
-        <translation>Oluşturmak için yeni sabit disk</translation>
+        <translation>Oluşturmak için yeni sabit sürücü</translation>
     </message>
     <message>
         <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
-        <translation>Lütfen aşağıdaki kutuya yeni sanal sabit disk dosyasının adını yazın ya da içine oluşturulacak farklı bir klasörü seçmek için klasör simgesine tıklayın.</translation>
+        <translation>Lütfen aşağıdaki kutuya yeni sanal sabit sürücü dosyasının adını yazın ya da içine oluşturulacak farklı bir klasörü seçmek için klasör simgesine tıklayın.</translation>
     </message>
     <message>
         <source>Choose a location for new virtual hard drive file...</source>
-        <translation>Yeni sanal sabit disk dosyası için bir yer seçin...</translation>
+        <translation>Yeni sanal sabit sürücü dosyası için bir yer seçin...</translation>
     </message>
     <message>
         <source>%1_copy</source>
@@ -8789,15 +9868,15 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>Hard drive to &copy</source>
-        <translation>&Kopyalamak için sabit disk</translation>
+        <translation>&Kopyalamak için sabit sürücü</translation>
     </message>
     <message>
         <source>&New hard drive to create</source>
-        <translation>Oluşturmak için &yeni sabit disk</translation>
+        <translation>Oluşturmak için &yeni sabit sürücü</translation>
     </message>
     <message>
         <source>Hard drive file &type</source>
-        <translation>Sabit disk dosyası &türü</translation>
+        <translation>Sabit sürücü dosyası &türü</translation>
     </message>
 </context>
 <context>
@@ -8840,7 +9919,7 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source><p>Please choose the type of clone you wish to create.</p><p>If you choose <b>Full clone</b>, an exact copy (including all virtual hard drive files) of the original virtual machine will be created.</p><p>If you choose <b>Linked clone</b>, a new machine will be created, but the virtual hard drive files will be tied to the virtual hard drive files of original machine and you will not be able to move the new virtual machi [...]
-        <translation><p>Lütfen oluşturmak istediğiniz çoğaltma türünü seçin.</p><p>Eğer <b>Tam çoğaltma</b> seçerseniz, orijinal sanal makinenin tam bir kopyası (tüm sanal sabit disk dosyaları dahil) oluşturulacaktır.</p><p>Eğer <b>Birbirine bağlantılı çoğaltma</b> seçerseniz, yeni bir sanal makine oluşturulacaktır ama sanal sabit disk dosyaları orijinal makinenin sanal sabit disk dosyalarına bağlanacaktır ve yeni sanal makineyi farkl [...]
+        <translation><p>Lütfen oluşturmak istediğiniz çoğaltma türünü seçin.</p><p>Eğer <b>Tam çoğaltma</b> seçerseniz, orijinal sanal makinenin tam bir kopyası (tüm sanal sabit sürücü dosyaları dahil) oluşturulacaktır.</p><p>Eğer <b>Birbirine bağlantılı çoğaltma</b> seçerseniz, yeni bir sanal makine oluşturulacaktır ama sanal sabit sürücü dosyaları orijinal makinenin sanal sabit sürücü dosyalarına bağlanacaktır ve yeni sanal makineyi [...]
     </message>
     <message>
         <source><p>If you create a <b>Linked clone</b> then a new snapshot will be created in the original virtual machine as part of the cloning process.</p></source>
@@ -9108,7 +10187,7 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source><p>Please select a virtual optical disk file or a physical optical drive containing a disk to start your new virtual machine from.</p><p>The disk should be suitable for starting a computer from. As this virtual machine has no hard drive you will not be able to install an operating system on it at the moment.</p></source>
-        <translation><p>Lütfen sanal bir optik disk dosyası veya yeni sanal makinenizi ondan başlatmak için bir disk içeren fiziksel optik disk sürücüsü seçin.</p><p>Disk bir bilgisayarı başlatması için uygun olmalı. Bu sanal makine olarak hiç sabit diske sahip değil, şu anda bir işletim sistemi yükleyemeyeceksiniz.</p></translation>
+        <translation><p>Lütfen sanal bir optik disk dosyası veya yeni sanal makinenizi ondan başlatmak için bir disk içeren fiziksel optik sürücü seçin.</p><p>Disk bir bilgisayarı ondan başlatmak için uygun olmalıdır. Bu sanal makine gibi hiç sabit sürücüye sahip değil, şu anda bir işletim sistemi yükleyemeyeceksiniz.</p></translation>
     </message>
     <message>
         <source>Choose a virtual optical disk file...</source>
@@ -9174,7 +10253,7 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     <name>UIWizardNewVD</name>
     <message>
         <source>Create Virtual Hard Drive</source>
-        <translation>Sanal Sabit Disk Oluştur</translation>
+        <translation>Sanal Sabit Sürücü Oluştur</translation>
     </message>
     <message>
         <source>Create</source>
@@ -9182,31 +10261,31 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>Hard drive file type</source>
-        <translation>Sabit disk dosyası türü</translation>
+        <translation>Sabit sürücü dosyası türü</translation>
     </message>
     <message>
         <source>Please choose the type of file that you would like to use for the new virtual hard drive. If you do not need to use it with other virtualization software you can leave this setting unchanged.</source>
-        <translation>Lütfen yeni sanal sabit disk için kullanmak istediğiniz dosyanın türünü seçin. Eğer diğer sanallaştırma yazılımları ile kullanmaya ihtiyacınız yoksa bu ayarı değiştirmeden bırakabilirsiniz.</translation>
+        <translation>Lütfen yeni sanal sabit sürücü için kullanmak istediğiniz dosyanın türünü seçin. Eğer diğer sanallaştırma yazılımları ile kullanmaya ihtiyacınız yoksa bu ayarı değiştirmeden bırakabilirsiniz.</translation>
     </message>
     <message>
         <source>Storage on physical hard drive</source>
-        <translation>Fiziksel sabit diskte depolama</translation>
+        <translation>Fiziksel sabit sürücüde depolama</translation>
     </message>
     <message>
         <source>Please choose whether the new virtual hard drive file should grow as it is used (dynamically allocated) or if it should be created at its maximum size (fixed size).</source>
-        <translation>Lütfen yeni sanal sabit disk dosyasının kullanılmasına göre (değişken olarak ayrılan) büyüyüp büyümemesini ya da en fazla boyutunda (sabitlenmiş boyut) oluşturulup oluşturulmamalıysa seçin.</translation>
+        <translation>Lütfen yeni sanal sabit sürücü dosyasının kullanılmasına göre (değişken olarak ayrılan) büyüyüp büyümemesini ya da en fazla boyutunda (sabitlenmiş boyut) oluşturulup oluşturulmamalıysa seçin.</translation>
     </message>
     <message>
         <source><p>A <b>dynamically allocated</b> hard drive file will only use space on your physical hard drive as it fills up (up to a maximum <b>fixed size</b>), although it will not shrink again automatically when space on it is freed.</p></source>
-        <translation><p><b>Değişken olarak ayrılan</b> sabit disk dosyası sadece fiziksel sabit diskinizdeki alanı doldurarak (en fazla <b>sabitlenmiş boyuta</b> kadar) kullanacak olmasına rağmen alan serbest kaldığında otomatik olarak tekrar küçülmeyecektir.</p></translation>
+        <translation><p><b>Değişken olarak ayrılan</b> sabit sürücü dosyası sadece fiziksel sabit sürücünüzdeki alanı doldurarak (en fazla <b>sabitlenmiş boyuta</b> kadar) kullanacak olmasına rağmen alan serbest kaldığında otomatik olarak tekrar küçülmeyecektir.</p></translation>
     </message>
     <message>
         <source><p>A <b>fixed size</b> hard drive file may take longer to create on some systems but is often faster to use.</p></source>
-        <translation><p><b>Sabitlenmiş boyutlu</b> sabit disk dosyasını oluşturmak bazı sistemlerde uzun sürebilir ama kullanması çoğu kez en hızlı olandır.</p></translation>
+        <translation><p><b>Sabitlenmiş boyutlu</b> sabit sürücü dosyasını oluşturmak bazı sistemlerde uzun sürebilir ama kullanması çoğu kez en hızlı olandır.</p></translation>
     </message>
     <message>
         <source><p>You can also choose to <b>split</b> the hard drive file into several files of up to two gigabytes each. This is mainly useful if you wish to store the virtual machine on removable USB devices or old systems, some of which cannot handle very large files.</source>
-        <translation><p>Ayrıca sabit disk dosyasını her biri iki gigabayta kadar birkaç dosyaya <b>bölmeyi</b> seçebilirsiniz. Bu çoğunlukla eğer sanal makineyi kaldırılabilir USB aygıtlarda veya çok büyük dosyalarla başa çıkamayan bazı eski sistemlerde depolamak isterseniz faydalıdır.</translation>
+        <translation><p>Ayrıca sabit sürücü dosyasını her biri iki gigabayta kadar birkaç dosyaya <b>bölmeyi</b> seçebilirsiniz. Bu çoğunlukla eğer sanal makineyi kaldırılabilir USB aygıtlarda veya çok büyük dosyalarla başa çıkamayan bazı eski sistemlerde depolamak isterseniz faydalıdır.</translation>
     </message>
     <message>
         <source>&Dynamically allocated</source>
@@ -9230,15 +10309,15 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>Please type the name of the new virtual hard drive file into the box below or click on the folder icon to select a different folder to create the file in.</source>
-        <translation>Lütfen aşağıdaki kutuya yeni sanal sabit disk dosyasının adını yazın ya da içine oluşturulacak farklı bir klasörü seçmek için klasör simgesine tıklayın.</translation>
+        <translation>Lütfen aşağıdaki kutuya yeni sanal sabit sürücü dosyasının adını yazın ya da içine oluşturulacak farklı bir klasörü seçmek için klasör simgesine tıklayın.</translation>
     </message>
     <message>
         <source>Choose a location for new virtual hard drive file...</source>
-        <translation>Yeni sanal sabit disk dosyası için bir yer seçin...</translation>
+        <translation>Yeni sanal sabit sürücü dosyası için bir yer seçin...</translation>
     </message>
     <message>
         <source>Select the size of the virtual hard drive in megabytes. This size is the limit on the amount of file data that a virtual machine will be able to store on the hard drive.</source>
-        <translation>Megabayt olarak sanal sabit sürücünün boyutunu seçin. Bu boyut sabit diskte depolanabilecek bir sanal makine dosya verisinin miktarını sınırlandırır.</translation>
+        <translation>Megabayt olarak sanal sabit sürücünün boyutunu seçin. Bu boyut sabit sürücüdeki depolanabilecek bir sanal makine dosya verisinin miktarını sınırlandırır.</translation>
     </message>
     <message>
         <source>File &location</source>
@@ -9250,7 +10329,7 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>Hard drive file &type</source>
-        <translation>Sabit disk dosyası &türü</translation>
+        <translation>Sabit sürücü dosyası &türü</translation>
     </message>
 </context>
 <context>
@@ -9301,15 +10380,15 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>Hard drive</source>
-        <translation>Sabit disk</translation>
+        <translation>Sabit sürücü</translation>
     </message>
     <message>
         <source><p>If you wish you can add a virtual hard drive to the new machine. You can either create a new hard drive file or select one from the list or from another location using the folder icon.</p><p>If you need a more complex storage set-up you can skip this step and make the changes to the machine settings once the machine is created.</p><p>The recommended size of the hard drive is <b>%1</b>.</p></source>
-        <translation>Eğer isterseniz yeni makineye sanal bir sabit disk ekleyebilirsiniz. Ya yeni bir sabit disk dosyası oluşturabilirsiniz ya da listeden veya klasör simgesini kullanarak başka bir yerden birini seçebilirsiniz.</p><p>Eğer daha karışık depolama ayarlamasına ihtiyacınız varsa bu adımı atlayabilir ve makine bir kere oluşturuldumu makine ayarlarından değişiklikleri yapabilirsiniz.</p><p>Sabit disk için önerilen boyut <b>%1</b>.</p></ [...]
+        <translation>Eğer isterseniz yeni makineye sanal bir sabit sürücü ekleyebilirsiniz. Ya yeni bir sabit sürücü dosyası oluşturabilirsiniz ya da listeden veya klasör simgesini kullanarak başka bir yerden birini seçebilirsiniz.</p><p>Eğer daha karışık depolama ayarlamasına ihtiyacınız varsa bu adımı atlayabilir ve makine bir kere oluşturuldumu makine ayarlarından değişiklikleri yapabilirsiniz.</p><p>Sabit sürücü için önerilen boyut <b>%1</b>.</p [...]
     </message>
     <message>
         <source>Choose a virtual hard drive file...</source>
-        <translation>Sanal sabit disk dosyası seçin...</translation>
+        <translation>Sanal sabit sürücü dosyası seçin...</translation>
     </message>
     <message>
         <source>&Memory size</source>
@@ -9317,15 +10396,15 @@ bu basamağı atlayarak sabit diskleri Sanal Makine Ayarları penceresinden ekle
     </message>
     <message>
         <source>&Do not add a virtual hard drive</source>
-        <translation>Sanal sabit disk &ekleme</translation>
+        <translation>Sanal bir sabit sürücü &ekleme</translation>
     </message>
     <message>
         <source>&Create a virtual hard drive now</source>
-        <translation>Şimdi sanal sabit disk &oluştur</translation>
+        <translation>Şimdi sanal bir sabit sürücü &oluştur</translation>
     </message>
     <message>
         <source>&Use an existing virtual hard drive file</source>
-        <translation>Mevcut sanal sabit disk dosyası &kullan</translation>
+        <translation>Mevcut sanal bir sabit sürücü dosyası &kullan</translation>
     </message>
 </context>
 <context>
@@ -9670,11 +10749,11 @@ Version %1</source>
         <translation type="obsolete">Paylaşılan dizinler üzerinde işlem yapmak için pencereyi aç</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">&Misafir Eklentilerini (Guest Additions) Yükle...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Misafir Eklentilerini yükleyici kalıbı bağla</translation>
     </message>
     <message>
@@ -9945,7 +11024,7 @@ Version %1</source>
         <translation type="obsolete">Oturum &Bilgileri Penceresi</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Oturum Bilgileri Penceresini Göster</translation>
     </message>
     <message>
@@ -10252,8 +11331,8 @@ Version %1</source>
         <translation><varsayılana sıfırla></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>Gerçek varsayılan yol değeri, değişiklikler kabul edildikten ve bu pencere tekrar açıldıktan sonra görüntülenecektir.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Gerçek varsayılan yol değeri, değişiklikler kabul edildikten ve bu ileti tekrar açıldıktan sonra görüntülenecektir.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -10273,7 +11352,7 @@ Version %1</source>
     </message>
     <message>
         <source>Opens a window to select a different folder.</source>
-        <translation>Farklı bir klasör seçmek için bir ileti açar.</translation>
+        <translation>Farklı bir klasör seçmek için bir pencere açar.</translation>
     </message>
     <message>
         <source>Resets the folder path to the default value.</source>
@@ -10281,7 +11360,7 @@ Version %1</source>
     </message>
     <message>
         <source>Opens a window to select a different file.</source>
-        <translation>Farklı bir dosya seçmek için bir ileti açar.</translation>
+        <translation>Farklı bir dosya seçmek için bir pencere açar.</translation>
     </message>
     <message>
         <source>Resets the file path to the default value.</source>
@@ -10301,8 +11380,7 @@ Version %1</source>
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Gerçek varsayılan yol değeri, değişiklikler kabul edildikten ve bu ileti tekrar açıldıktan sonra görüntülenecektir.</translation>
+        <translation>Gerçek varsayılan yol değeri, değişiklikler kabul edildikten ve bu pencere tekrar açıldıktan sonra görüntülenecektir.</translation>
     </message>
 </context>
 <context>
@@ -10654,7 +11732,7 @@ Version %1</source>
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -11387,7 +12465,7 @@ Version %1</source>
     <message>
         <source>Paravirtualized Network (virtio-net)</source>
         <comment>NetworkAdapterType</comment>
-        <translation>Parasanallaştırılmış Ağ (virtio-net)</translation>
+        <translation>Yarı Sanallaştırılmış Ağ (virtio-net)</translation>
     </message>
     <message>
         <source>I82078</source>
@@ -11455,17 +12533,17 @@ Version %1</source>
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Takılan bu sabit disk yeni olarak oluşturulmuş ayrımlanan sabit disk kullanımını dolaylı olarak gerçekleştirecektir.</translation>
+        <translation type="obsolete">Takılan bu sabit disk yeni olarak oluşturulmuş ayrımlanan sabit disk kullanımını dolaylı olarak gerçekleştirecektir.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Bu sabit disk zincirindeki ortamın bazısı erişilemez. Lütfen bu ortamı incelemek için <b>Ayrımlanan Sabit Diskleri Göster</b> içindeki Sanal Ortam Yönetcisini kullanın.</translation>
+        <translation type="obsolete">Bu sabit disk zincirindeki ortamın bazısı erişilemez. Lütfen bu ortamı incelemek için <b>Ayrımlanan Sabit Diskleri Göster</b> içindeki Sanal Ortam Yönetcisini kullanın.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Bu ana sabit disk aşağıdaki ayrımlanan sabit diskleri kullanarak dolaylı olarak takılır:</translation>
+        <translation type="obsolete">Bu ana sabit disk aşağıdaki ayrımlanan sabit diskleri kullanarak dolaylı olarak takılır:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -11505,7 +12583,7 @@ Version %1</source>
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -11602,7 +12680,7 @@ Version %1</source>
     <message>
         <source>Unlocked</source>
         <comment>SessionState</comment>
-        <translation>Kilit Açıldı</translation>
+        <translation>Kilidi Açıldı</translation>
     </message>
     <message>
         <source>Locked</source>
@@ -11612,7 +12690,7 @@ Version %1</source>
     <message>
         <source>Unlocking</source>
         <comment>SessionState</comment>
-        <translation>Kilit açılıyor</translation>
+        <translation>Kilidi açılıyor</translation>
     </message>
     <message>
         <source>Null</source>
@@ -11910,123 +12988,272 @@ Version %1</source>
     </message>
     <message>
         <source>Please choose a virtual hard drive file</source>
-        <translation>Lütfen sanal sabit sürücü dosyası seçin</translation>
+        <translation>Lütfen sanal bir sabit sürücü dosyası seçin</translation>
     </message>
     <message>
         <source>All virtual hard drive files (%1)</source>
         <translation>Tüm sanal sabit sürücü dosyaları (%1)</translation>
     </message>
     <message>
-        <source>Please choose a virtual optical disk file</source>
-        <translation>Lütfen sanal optik disk dosyası seçin</translation>
+        <source>Please choose a virtual optical disk file</source>
+        <translation>Lütfen sanal bir optik disk dosyası seçin</translation>
+    </message>
+    <message>
+        <source>All virtual optical disk files (%1)</source>
+        <translation>Tüm sanal optik disk dosyaları (%1)</translation>
+    </message>
+    <message>
+        <source>Please choose a virtual floppy disk file</source>
+        <translation>Lütfen sanal bir disket dosyası seçin</translation>
+    </message>
+    <message>
+        <source>All virtual floppy disk files (%1)</source>
+        <translation>Tüm sanal disket dosyaları (%1)</translation>
+    </message>
+    <message>
+        <source>VDI (VirtualBox Disk Image)</source>
+        <translation>VDI (VirtualBox Disk Kalıbı)</translation>
+    </message>
+    <message>
+        <source>VMDK (Virtual Machine Disk)</source>
+        <translation>VMDK (Sanal Makine Diski)</translation>
+    </message>
+    <message>
+        <source>VHD (Virtual Hard Disk)</source>
+        <translation>VHD (Sanal Sabit Disk)</translation>
+    </message>
+    <message>
+        <source>HDD (Parallels Hard Disk)</source>
+        <translation>HDD (Paralel Sabit Disk)</translation>
+    </message>
+    <message>
+        <source>QED (QEMU enhanced disk)</source>
+        <translation>QED (QEMU Geliştirilmiş Disk)</translation>
+    </message>
+    <message>
+        <source>QCOW (QEMU Copy-On-Write)</source>
+        <translation>QCOW (QEMU Yazarken Kopyalama)</translation>
+    </message>
+    <message>
+        <source>Please choose a location for new virtual hard drive file</source>
+        <translation>Lütfen yeni sanal sabit sürücü dosyası için bir yer seçin</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="obsolete">Etkinleştirildi</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="obsolete">Etkisizleştirildi</translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <comment>details report</comment>
+        <translation>Kısıtsız Yürütme</translation>
+    </message>
+    <message>
+        <source>PS/2 Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation>PS/2 Fare</translation>
+    </message>
+    <message>
+        <source>USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation>USB Fare</translation>
+    </message>
+    <message>
+        <source>PS/2 and USB Mouse</source>
+        <comment>PointingHIDType</comment>
+        <translation>PS/2 ve USB Fare</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>unrestricted execution</comment>
+        <translation type="obsolete">Etkinleştirildi</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>unrestricted execution</comment>
+        <translation type="obsolete">Etkisizleştirildi</translation>
+    </message>
+    <message>
+        <source>Unrestricted Execution</source>
+        <translation>Kısıtsız Yürütme</translation>
+    </message>
+    <message>
+        <source>USB Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation>USB Tablet</translation>
+    </message>
+    <message>
+        <source>USB Multi-Touch Tablet</source>
+        <comment>PointingHIDType</comment>
+        <translation>USB Çoklu Dokunmalı Tablet</translation>
+    </message>
+    <message>
+        <source>NAT Network</source>
+        <comment>NetworkAttachmentType</comment>
+        <translation>NAT Ağı</translation>
+    </message>
+    <message>
+        <source>NAT network, '%1'</source>
+        <comment>details report (network)</comment>
+        <translation>NAT ağı, '%1'</translation>
+    </message>
+    <message>
+        <source>You can create or add disk image files in the virtual machine settings.</source>
+        <translation>Sanal makine ayarlarında disk kalıbı dosyalarını oluşturabilir ya da ekleyebilirsiniz.</translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>USB B.Noktası %1</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>kapalı</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation>Yarı Sanallaştırma Arayüzü</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Yok</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Varsayılan</translation>
     </message>
     <message>
-        <source>All virtual optical disk files (%1)</source>
-        <translation>Tüm sanal optik disk dosyaları (%1)</translation>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Eski</translation>
     </message>
     <message>
-        <source>Please choose a virtual floppy disk file</source>
-        <translation>Lütfen sanal bir disket dosyası seçin</translation>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>En Az</translation>
     </message>
     <message>
-        <source>All virtual floppy disk files (%1)</source>
-        <translation>Tüm sanal disket dosyaları (%1)</translation>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
     </message>
     <message>
-        <source>VDI (VirtualBox Disk Image)</source>
-        <translation>VDI (VirtualBox Disk Kalıbı)</translation>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation>Yeni değişken olarak ayrılan depolama</translation>
     </message>
     <message>
-        <source>VMDK (Virtual Machine Disk)</source>
-        <translation>VMDK (Sanal Makine Diski)</translation>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>Aktif</translation>
     </message>
     <message>
-        <source>VHD (Virtual Hard Disk)</source>
-        <translation>VHD (Sanal Sabit Disk)</translation>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>Devre dışı</translation>
     </message>
     <message>
-        <source>HDD (Parallels Hard Disk)</source>
-        <translation>HDD (Paralel Sabit Disk)</translation>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>Aktif</translation>
     </message>
     <message>
-        <source>QED (QEMU enhanced disk)</source>
-        <translation>QED (QEMU Geliştirilmiş Disk)</translation>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>Devre dışı</translation>
     </message>
     <message>
-        <source>QCOW (QEMU Copy-On-Write)</source>
-        <translation>QCOW (QEMU Yazarken Kopyalama)</translation>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>Aktif</translation>
     </message>
     <message>
-        <source>Please choose a location for new virtual hard drive file</source>
-        <translation>Lütfen yeni sanal sabit sürücü dosyası için bir yer seçin</translation>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>Devre dışı</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Etkinleştirildi</translation>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Anlık Görüntü alınıyor</translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>Etkisizleştirildi</translation>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>Çevrimiçi Anlık Görüntü alınıyor</translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <comment>details report</comment>
-        <translation>Kısıtsız Yürütme</translation>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation>KVM</translation>
     </message>
     <message>
-        <source>PS/2 Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>PS/2 Fare</translation>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation>Optik</translation>
     </message>
     <message>
-        <source>USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB Fare</translation>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
     </message>
     <message>
-        <source>PS/2 and USB Mouse</source>
-        <comment>PointingHIDType</comment>
-        <translation>PS/2 ve USB Fare</translation>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>OHCI</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>unrestricted execution</comment>
-        <translation type="obsolete">Etkinleştirildi</translation>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>EHCI</translation>
     </message>
     <message>
-        <source>Disabled</source>
-        <comment>unrestricted execution</comment>
-        <translation type="obsolete">Etkisizleştirildi</translation>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>xHCI</translation>
     </message>
     <message>
-        <source>Unrestricted Execution</source>
-        <translation>Kısıtsız Yürütme</translation>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation>Kullanıcı arayüzü</translation>
     </message>
     <message>
-        <source>USB Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB Tablet</translation>
+        <source>(Optical Drive)</source>
+        <translation>(Optik Sürücü)</translation>
     </message>
     <message>
-        <source>USB Multi-Touch Tablet</source>
-        <comment>PointingHIDType</comment>
-        <translation>USB Çoklu Dokunmalı Tablet</translation>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>Takılan bu sabit sürücü yeni olarak oluşturulmuş ayrımlanan sabit sürücüyü kullanarak dolaylı olarak gerçekleştirecektir.</translation>
     </message>
     <message>
-        <source>NAT Network</source>
-        <comment>NetworkAttachmentType</comment>
-        <translation>NAT Ağı</translation>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation>Bu sabit sürücü zincirindeki dosyaların bazıları erişilemez. Lütfen bu dosyaları incelemek için Sanal Ortam Yönetcisi'ni kullanın.</translation>
     </message>
     <message>
-        <source>NAT network, '%1'</source>
-        <comment>details report (network)</comment>
-        <translation>NAT ağı, '%1'</translation>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>Bu ana sabit sürücü aşağıdaki ayrımlanan sabit sürücüyü kullanarak dolaylı olarak takılır:</translation>
     </message>
     <message>
-        <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>Sanal makine ayarlarında disk kalıbı dosyalarını oluşturabilir ya da ekleyebilirsiniz.</translation>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation>Şifrelenmiş</translation>
     </message>
 </context>
 <context>
@@ -12300,11 +13527,11 @@ to the system default language.</qt>
         <translation type="obsolete">Varsayılan VDI klasörüne yolu gösterir. Eğer açıkça aksi hali belirtilmemişse daha önceden var olan ya da yeni oluşturulmuş sabit diskleri eklemek için bu klasör kullanılır.</translation>
     </message>
     <message>
-        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the virtual machine folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Sanal makine dizin yolunu ön tanımlı değerlerine geri döndürür. Şu anki ön tanımlı yol, değişiklikleri onayladıktan ve bu diyaloğu yeniden açtığınızda görüntülenir.</translation>
     </message>
     <message>
-        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the VDI folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">VDI dizinini ön tanımlı değerlerine tekrar döndürür. Şu anki ön tanımlı yol, değişiklikler onaylandıktan ve bu diyaloğu tekrar açtıktan sonra görüntülenecektir.</translation>
     </message>
     <message>
@@ -12348,7 +13575,7 @@ to the system default language.</qt>
         <translation type="obsolete">VRDP kimlik doğrulama kütüphanesi dosyasını seçmek için bir pencere açar.</translation>
     </message>
     <message>
-        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the authentication library file to the default value. The actual default library file will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Kimlik doğrulama kütüphanesi dosyasını öntanımlı değerine döndürür. Değişiklikler kabul edildikten sonra geçerli öntanımlı kütüphane dosyası gösterilir ve bu pencere yeniden açılır.</translation>
     </message>
     <message>
@@ -12823,6 +14050,18 @@ to the system default language.</qt>
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Yeni bir sanal sabit sürücü oluştur</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation>UUID:</translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation><i>Şifrelenmemiş</i></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation>Şu anahtar ile şifrelenmiş:</translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -12904,8 +14143,8 @@ to the system default language.</qt>
         <translation type="obsolete">VirtualBox Kayıt Formu</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
-        <translation type="obsolete"><p>Lütfen VirtualBox kullandığınızı öğrenebilmemiz ve sizi VirtualBox haberleri ve güncellemeleri gibi konularda bilgilendirebilmemiz için kayıt formunu doldurun.</p><p>Aşağıdaki alanlara Latin karakterlerini kullanarak tam adınızı ve e-posta adresinizi girin. Lütfen innotek'in bu bilgileri sadece ürün kullanımı istatistiklerini toplamak ve size VirtualBox ilgili haberleri göndermek için kullandığını unutmayın. Özellikle innotek [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Please note that innotek will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, innotek will never pass your data to third parties. Detailed in [...]
+        <translation type="obsolete"><p>Lütfen VirtualBox kullandığınızı öğrenebilmemiz ve sizi VirtualBox haberleri ve güncellemeleri gibi konularda bilgilendirebilmemiz için kayıt formunu doldurun.</p><p>Aşağıdaki alanlara Latin karakterlerini kullanarak tam adınızı ve e-posta adresinizi girin. Lütfen innotek'in bu bilgileri sadece ürün kullanımı istatistiklerini toplamak ve size VirtualBox ilgili haberleri göndermek için kullandığını unutmayın. Özellikle innotek [...]
     </message>
     <message>
         <source>&Name</source>
@@ -12952,8 +14191,8 @@ to the system default language.</qt>
         <translation type="obsolete">Bağlantı anlaşması yapılamadı.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Lütfen VirtualBox kullandığınızı öğrenebilmemiz ve sizi VirtualBox haberleri ve güncellemeleri gibi konularda bilgilendirebilmemiz için kayıt formunu doldurun.</p><p>Aşağıdaki alanlara Latin karakterlerini kullanarak tam adınızı ve e-posta adresinizi girin. Lütfen innotek'in bu bilgileri sadece ürün kullanımı istatistiklerini toplamak ve size VirtualBox ilgili haberleri göndermek için kullandığını unutmayın. Özellikle innotek [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Lütfen VirtualBox kullandığınızı öğrenebilmemiz ve sizi VirtualBox haberleri ve güncellemeleri gibi konularda bilgilendirebilmemiz için kayıt formunu doldurun.</p><p>Aşağıdaki alanlara Latin karakterlerini kullanarak tam adınızı ve e-posta adresinizi girin. Lütfen innotek'in bu bilgileri sadece ürün kullanımı istatistiklerini toplamak ve size VirtualBox ilgili haberleri göndermek için kullandığını unutmayın. Özellikle innotek [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -13262,8 +14501,8 @@ to the system default language.</qt>
         <translation type="obsolete">Sanal makine uygulamasını askıya al</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>VirtualBox Uygulamasına Hoşgeldiniz!</h3><p>Bu pencerenin sol tarafı bilgisayarınızdaki sanal işletim sistemlerinin tümünün listesini gösterir. Liste şimdi boş çünkü henüz bir sanal makine oluşturmadınız.<img src=:/welcome.png align=right/></p><p>Yeni bir sanal makine oluşturmak için pencerenin yukarısındaki ana araç çubuğunda bulunan <b>Yeni</b> düğmesine tıklayın.</p><p>Ayrıca <b> [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>VirtualBox Uygulamasına Hoşgeldiniz!</h3><p>Bu pencerenin sol tarafı bilgisayarınızdaki sanal işletim sistemlerinin tümünün listesini gösterir. Liste şimdi boş çünkü henüz bir sanal makine oluşturmadınız.<img src=:/welcome.png align=right/></p><p>Yeni bir sanal makine oluşturmak için pencerenin yukarısındaki ana araç çubuğunda bulunan <b>Yeni</b> düğmesine tıklayın.</p><p>Ayrıca <b> [...]
     </message>
     <message>
         <source>&Virtual Media Manager...</source>
@@ -13890,172 +15129,6 @@ eşleşebilir.</qt></translation>
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>Session Information Dialog</source>
-        <translation type="obsolete">Oturum Bilgileri Penceresi</translation>
-    </message>
-    <message>
-        <source>&Close</source>
-        <translation type="obsolete">&Kapat</translation>
-    </message>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - Oturum Bilgisi</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Ayrıntılar</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">Çalışma &Zamanı</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA Aktarımları</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO Aktarımları</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Okunan Veri</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Yazılan Veri</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Aktarılan Veri</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Alınan Veri</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <translation type="obsolete">Etkin</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <translation type="obsolete">Pasifleştirilmiş</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Çalışma Zamanı Öznitelikleri</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Ekran Çözünürlüğü</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">CD/DVD İstatistikleri</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Ağ Bağdaştırıcısı İstatistikleri</translation>
-    </message>
-    <message>
-        <source>Not attached</source>
-        <translation type="obsolete">Eklenmedi</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Sürüm %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Algılanmamış</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Algılanmamış</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Misafir Eklentileri</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Misafir İS Türü</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Sabit Disk İstatistikleri</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Sabit Disk Yok</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Ağ Bağdaştırıcıları Yok</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Etkin</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Pasifleştirilmiş</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Yerleşik Sayfalama</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxSMBilgiİletisi</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Depolama İstatistikleri</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Depolama Aygıtları Yok</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Ağ İstatistikleri</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Yerleşik Sayfalama</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Mevcut Değil</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Pano Kipi</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Sürükle'v'Bırak Kipi</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>Yapılandırma &Ayrıntıları</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>Çalışma &Zamanı Bilgisi</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMListBox</name>
     <message>
         <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
@@ -14848,7 +15921,7 @@ işletim sistemi yükledikten sonra bunu pasifleştirmeyin!</qt></translat
         <translation type="obsolete">Bu sanal makinenin anlık görüntülerinin nereye kaydedileceğini tanımlar. Anlık görüntülerin çok yer kaplayabileceğini unutmayın.</translation>
     </message>
     <message>
-        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this window again.</source>
+        <source>Resets the snapshot folder path to the default value. The actual default path will be displayed after accepting the changes and opening this dialog again.</source>
         <translation type="obsolete">Anlık görüntü dizinini öntanımlı ayarlarına döndürür. Güncel öntanımlı yol bu ayarlar kabul edildikten sonra bu pencere yeniden açılarak gösterilecektir.</translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_uk.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_uk.ts
index 2f1a635..9f3b55d 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_uk.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_uk.ts
@@ -248,7 +248,7 @@
     </message>
     <message>
         <source>Seam&less Mode</source>
-        <translation type="obsolete">&Цілокроєний режим</translation>
+        <translation type="unfinished">&Цілокроєний режим</translation>
     </message>
     <message>
         <source>Switch to seamless desktop integration mode</source>
@@ -272,11 +272,11 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>В&имкнути інтеграцію миші</translation>
+        <translation type="obsolete">В&имкнути інтеграцію миші</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>Тимчасово вимкнути інтеграцію головного курсора миші</translation>
+        <translation type="obsolete">Тимчасово вимкнути інтеграцію головного курсора миші</translation>
     </message>
     <message>
         <source>Enable &Mouse Integration</source>
@@ -288,11 +288,11 @@
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>&Ввести Ctrl-Alt-Del</translation>
+        <translation type="obsolete">&Ввести Ctrl-Alt-Del</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>Відправити послідовність клавіш Ctrl-Alt-Del у віртуальну машину</translation>
+        <translation type="obsolete">Відправити послідовність клавіш Ctrl-Alt-Del у віртуальну машину</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -300,7 +300,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>Відправити послідовність клавіш Ctrl-Alt-Backspace у віртуальну машину</translation>
+        <translation type="obsolete">Відправити послідовність клавіш Ctrl-Alt-Backspace у віртуальну машину</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -315,8 +315,8 @@
         <translation type="obsolete">&Інформація про сеанс</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation type="unfinished">Показувати інформацію про сеанс</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">Показувати інформацію про сеанс</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -364,15 +364,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>&Пристрої CD/DVD</translation>
+        <translation type="obsolete">&Пристрої CD/DVD</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>Пристрої &дискет</translation>
+        <translation type="obsolete">Пристрої &дискет</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>Пристро&ї USB</translation>
+        <translation type="obsolete">Пристро&ї USB</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -395,12 +395,12 @@
         <translation type="obsolete">Дозволити або заборонити під'єднання віддаленої стільниці (RDP) до цієї машини</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation type="unfinished">Вс&тановити гостьові доповнення...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">Вс&тановити гостьові доповнення...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation type="unfinished">Змонтувати гостьові доповнення з установчого образу</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">Змонтувати гостьові доповнення з установчого образу</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -419,7 +419,7 @@
     <message>
         <source>&Logging...</source>
         <comment>debug action</comment>
-        <translation type="unfinished">&Реєстрування...</translation>
+        <translation type="obsolete">&Реєстрування...</translation>
     </message>
     <message>
         <source>&Help</source>
@@ -497,15 +497,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>Перемкнутись у &повноекранний режим</translation>
+        <translation type="obsolete">Перемкнутись у &повноекранний режим</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>Перемкнутись між повноекранним і звичайним екраном</translation>
+        <translation type="obsolete">Перемкнутись між повноекранним і звичайним екраном</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>Перемкнутись у &ціловикроєний режим</translation>
+        <translation type="obsolete">Перемкнутись у &ціловикроєний режим</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -513,7 +513,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>Перемкнутись на &масштабний режим</translation>
+        <translation type="obsolete">Перемкнутись на &масштабний режим</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -720,7 +720,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>Вс&тавити Ctrl-Alt-Backspace</translation>
+        <translation type="obsolete">Вс&тавити Ctrl-Alt-Backspace</translation>
     </message>
     <message>
         <source>Sort List</source>
@@ -911,10 +911,6 @@
         <translation>Вимкнути вибрану віртуальну машину</translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -955,23 +951,249 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">Вс&тановити гостьові доповнення...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">Змонтувати гостьові доповнення з установчого образу</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished">Мережа</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished">&Файл</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished">Ввімкнути</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished">%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1789,6 +2011,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1799,7 +2028,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>Викидання даних …</translation>
+        <translation type="obsolete">Викидання даних …</translation>
     </message>
 </context>
 <context>
@@ -1871,6 +2100,33 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Select a file to export into</source>
@@ -2602,7 +2858,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
+        <translation type="obsolete">[CD/DVD]</translation>
     </message>
     <message>
         <source>Not Attached</source>
@@ -2743,47 +2999,142 @@ p, li { white-space: pre-wrap; }
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGMachinePreview</name>
     <message>
-        <source>Update disabled</source>
-        <translation>Оновлення вимкнено</translation>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Every 0.5 s</source>
-        <translation>Кожні 0.5 секунди</translation>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Every 1 s</source>
-        <translation>Кожну 1 секунду</translation>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Every 2 s</source>
-        <translation>Кожні 2 секунди</translation>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Every 5 s</source>
-        <translation>Кожних 5 секунд</translation>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished">Контролер USB</translation>
     </message>
     <message>
-        <source>Every 10 s</source>
-        <translation>Кожних 10 секунд</translation>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>No preview</source>
-        <translation>Без перегляду</translation>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIGlobalSettingsDisplay</name>
     <message>
-        <source>Maximum Guest Screen &Size:</source>
-        <translation>Максимальний &розмір гостьового екрана:</translation>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Width:</source>
-        <translation>&Ширина:</translation>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIGMachinePreview</name>
+    <message>
+        <source>Update disabled</source>
+        <translation>Оновлення вимкнено</translation>
+    </message>
+    <message>
+        <source>Every 0.5 s</source>
+        <translation>Кожні 0.5 секунди</translation>
+    </message>
+    <message>
+        <source>Every 1 s</source>
+        <translation>Кожну 1 секунду</translation>
+    </message>
+    <message>
+        <source>Every 2 s</source>
+        <translation>Кожні 2 секунди</translation>
+    </message>
+    <message>
+        <source>Every 5 s</source>
+        <translation>Кожних 5 секунд</translation>
+    </message>
+    <message>
+        <source>Every 10 s</source>
+        <translation>Кожних 10 секунд</translation>
+    </message>
+    <message>
+        <source>No preview</source>
+        <translation>Без перегляду</translation>
+    </message>
+</context>
+<context>
+    <name>UIGlobalSettingsDisplay</name>
+    <message>
+        <source>Maximum Guest Screen &Size:</source>
+        <translation>Максимальний &розмір гостьового екрана:</translation>
+    </message>
+    <message>
+        <source>&Width:</source>
+        <translation>&Ширина:</translation>
     </message>
     <message>
         <source>&Height:</source>
@@ -2939,18 +3290,6 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Вимкнути &зберігач головного екрана</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4163,12 +4502,12 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Індикатори активності пристроїв CD/DVD:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Індикатори активності пристроїв CD/DVD:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>Індикатори активності пристроїв дискет:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>Індикатори активності пристроїв дискет:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -4208,7 +4547,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>Контролер USB вимкнутий</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>Контролер USB вимкнутий</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -4276,6 +4615,20 @@ p, li { white-space: pre-wrap; }
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -4402,7 +4755,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>&Video</source>
-        <translation>&Відео</translation>
+        <translation type="obsolete">&Відео</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -4589,10 +4942,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4644,7 +4993,75 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">Зменшена панель інструментів:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">Якщо це позначено, показувати зменшену панель інструментів в повноекранному і ціловикроєному режимі.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">&Показувати в повноекранному/ціловикроєному</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">Якщо це позначено, показувати зменшену панель інструментів зверху екрана, а не, як типово, знизу.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">Показувати &зверху екрана</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">Просторове {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">Просторове {200%?}</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4659,7 +5076,7 @@ p, li { white-space: pre-wrap; }
         <translation>Показує шлях, де будуть зберігатися зрізи цієї машини. Майте на увазі, зрізи можуть займати доволі чимало дискового простору.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>&Основне</translation>
     </message>
     <message>
@@ -4703,7 +5120,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Керує об'ємом відеопам'яті, котра забезпечує віртуальну машину.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>&Додатково</translation>
     </message>
     <message>
@@ -4791,7 +5208,7 @@ p, li { white-space: pre-wrap; }
         <translation>Тека &зрізів:</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>&Опис</translation>
     </message>
     <message>
@@ -4804,7 +5221,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>Якщо це позначено, будь-які зміни для носіїв CD/DVD або дискет, які змонтовані, виконані під час роботи машини будуть збережені в файл налаштувань в порядку збереження налаштувань носіїв, які змонтовані, перед запуском.</translation>
+        <translation type="obsolete">Якщо це позначено, будь-які зміни для носіїв CD/DVD або дискет, які змонтовані, виконані під час роботи машини будуть збережені в файл налаштувань в порядку збереження налаштувань носіїв, які змонтовані, перед запуском.</translation>
     </message>
     <message>
         <source>&Remember Mounted Media</source>
@@ -4836,38 +5253,38 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>Змінний носій:</translation>
+        <translation type="obsolete">Змінний носій:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>&Запам'ятати зміни часу оброблення</translation>
+        <translation type="obsolete">&Запам'ятати зміни часу оброблення</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>Зменшена панель інструментів:</translation>
+        <translation type="obsolete">Зменшена панель інструментів:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>Якщо це позначено, показувати зменшену панель інструментів в повноекранному і ціловикроєному режимі.</translation>
+        <translation type="obsolete">Якщо це позначено, показувати зменшену панель інструментів в повноекранному і ціловикроєному режимі.</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>&Показувати в повноекранному/ціловикроєному</translation>
+        <translation type="obsolete">&Показувати в повноекранному/ціловикроєному</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>Якщо це позначено, показувати зменшену панель інструментів зверху екрана, а не, як типово, знизу.</translation>
+        <translation type="obsolete">Якщо це позначено, показувати зменшену панель інструментів зверху екрана, а не, як типово, знизу.</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>Показувати &зверху екрана</translation>
+        <translation type="obsolete">Показувати &зверху екрана</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">ви вибрали 64-ох бітну гостьову операційну систему для цієї віртуальної машини. Потрібна відповідна апаратна віртуалізація (VT-x/AMD-V), цю можливість буде автоматично ввімкнено.</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>&Перегування:</translation>
     </message>
     <message>
@@ -4882,6 +5299,102 @@ p, li { white-space: pre-wrap; }
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">Просторове {100%?}</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">Просторове {200%?}</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished">Зменшена панель інструментів:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished">Якщо це позначено, показувати зменшену панель інструментів в повноекранному і ціловикроєному режимі.</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished">&Показувати в повноекранному/ціловикроєному</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished">Якщо це позначено, показувати зменшену панель інструментів зверху екрана, а не, як типово, знизу.</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished">Показувати &зверху екрана</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -5420,10 +5933,6 @@ p, li { white-space: pre-wrap; }
         <source>If checked, this shared folder will be permanent.</source>
         <translation>Якщо це позначено, ця спільна тека буде незмінною.</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -5474,11 +5983,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>Якщо це позначено, канал описується в полі <b>Шлях порту</b>, яке буде створене при запуску віртуальної машини. Інакше віртуальна машина спробує використати наявний канал.</translation>
+        <translation type="obsolete">Якщо це позначено, канал описується в полі <b>Шлях порту</b>, яке буде створене при запуску віртуальної машини. Інакше віртуальна машина спробує використати наявний канал.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>&Створити канал</translation>
+        <translation type="obsolete">&Створити канал</translation>
     </message>
     <message>
         <source>Port &Path:</source>
@@ -5486,11 +5995,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>Показує шлях до головного каналу послідовного порту, коли порт працює в режимі <b>Головний канал</b>, або назву головного пристрою послідовного порту, коли порт працює в режимі <b>Головний пристрій</b>.</translation>
+        <translation type="obsolete">Показує шлях до головного каналу послідовного порту, коли порт працює в режимі <b>Головний канал</b>, або назву головного пристрою послідовного порту, коли порт працює в режимі <b>Головний пристрій</b>.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>&Шлях порту/файла:</translation>
+        <translation type="obsolete">&Шлях порту/файла:</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -5500,6 +6009,22 @@ p, li { white-space: pre-wrap; }
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>Показує базову адресу порту В/В цього послідовного порту. Правильне значення — ціле число від <tt>0</tt> до <tt>0xFFFF</tt>.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -5624,11 +6149,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>Додати&nbsp;пристрій&nbsp;CD/DVD</nobr></translation>
+        <translation type="obsolete"><nobr>Додати&nbsp;пристрій&nbsp;CD/DVD</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>Додати&nbsp;пристрій&nbsp;дискет</nobr></translation>
+        <translation type="obsolete"><nobr>Додати&nbsp;пристрій&nbsp;дискет</nobr></translation>
     </message>
     <message>
         <source>No hard disk is selected for <i>%1</i>.</source>
@@ -5672,11 +6197,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>Додати пристрій CD/DVD</translation>
+        <translation type="obsolete">Додати пристрій CD/DVD</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>Додати пристрій дискет</translation>
+        <translation type="obsolete">Додати пристрій дискет</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -5864,15 +6389,15 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>&Носій CD/DVD:</translation>
+        <translation type="obsolete">&Носій CD/DVD:</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>Виберіть віртуальний диск CD/DVD або фізичний носій для застосування віртуальним носієм. Віртуальна машина розпізнає диск замість носія з даними у файлі або на диску у фізичного носія як його вміст.</translation>
+        <translation type="obsolete">Виберіть віртуальний диск CD/DVD або фізичний носій для застосування віртуальним носієм. Віртуальна машина розпізнає диск замість носія з даними у файлі або на диску у фізичного носія як його вміст.</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>Налаштувати віртуальний носій CD/DVD</translation>
+        <translation type="obsolete">Налаштувати віртуальний носій CD/DVD</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -5896,7 +6421,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>Вибрати файл віртуально диска CD/DVD…</translation>
+        <translation type="obsolete">Вибрати файл віртуально диска CD/DVD…</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5980,24 +6505,72 @@ p, li { white-space: pre-wrap; }
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
-</context>
-<context>
-    <name>UIMachineSettingsSystem</name>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
-        <translation type="obsolete">ви вказали більше, ніж <b>%1%</b> пам'яті вашого комп'ютера (<b>%2</b>) у віртуальній машині. Недостатньо пам'яті для вашої головної операційної системи. Будь ласка, виберіть менший об'єм.</translation>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
-        <translation type="obsolete">ви вказали більше, ніж <b>%1%</b> пам'яті вашого комп'ютера (<b>%2</b>) у віртуальній машині. Недостатньо пам'яті для вашої головної операційної системи. Продовжуйте на власний ризик.</translation>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
-        <translation type="obsolete">з точки зору швидкодії, число віртуальних процесорів, які під'єднані до машини, не можуть перевищувати більше двох фізичних процесорів на головному комп'ютері (<b>%1</b>).Будь ласка, зменшіть число віртуальних процесорів.</translation>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>you have assigned more virtual CPUs to the virtual machine than the number of physical CPUs on your host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
-        <translation type="obsolete">ви вказали більше віртуальних процесорів, ніж фізично на головному комп'ютері (<b>%1</b>). Імовірно це занизить швидкодію вашої віртуальної машини. Будь ласка, прийміть до уваги зниження числа віртуальних процесорів.</translation>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsSystem</name>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. Not enough memory is left for your host operating system. Please select a smaller amount.</source>
+        <translation type="obsolete">ви вказали більше, ніж <b>%1%</b> пам'яті вашого комп'ютера (<b>%2</b>) у віртуальній машині. Недостатньо пам'яті для вашої головної операційної системи. Будь ласка, виберіть менший об'єм.</translation>
+    </message>
+    <message>
+        <source>you have assigned more than <b>%1%</b> of your computer's memory (<b>%2</b>) to the virtual machine. There might not be enough memory left for your host operating system. Continue at your own risk.</source>
+        <translation type="obsolete">ви вказали більше, ніж <b>%1%</b> пам'яті вашого комп'ютера (<b>%2</b>) у віртуальній машині. Недостатньо пам'яті для вашої головної операційної системи. Продовжуйте на власний ризик.</translation>
+    </message>
+    <message>
+        <source>for performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <translation type="obsolete">з точки зору швидкодії, число віртуальних процесорів, які під'єднані до машини, не можуть перевищувати більше двох фізичних процесорів на головному комп'ютері (<b>%1</b>).Будь ласка, зменшіть число віртуальних процесорів.</translation>
+    </message>
+    <message>
+        <source>you have assigned more virtual CPUs to the virtual machine than the number of physical CPUs on your host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <translation type="obsolete">ви вказали більше віртуальних процесорів, ніж фізично на головному комп'ютері (<b>%1</b>). Імовірно це занизить швидкодію вашої віртуальної машини. Будь ласка, прийміть до уваги зниження числа віртуальних процесорів.</translation>
     </message>
     <message>
         <source>you have assigned more than one virtual CPU to this VM. This will not work unless the IO-APIC feature is also enabled. This will be done automatically when you accept the VM Settings by pressing the OK button.</source>
@@ -6217,31 +6790,39 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6314,7 +6895,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>Уві&мкнути контролер USB 2.0 (EHCI)</translation>
+        <translation type="obsolete">Уві&мкнути контролер USB 2.0 (EHCI)</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -6377,7 +6958,27 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">USB 2.0 тепер увімкнуто для цієї віртуальної машини. Однак, це потребує встановити <b>%1</b>. Будь ласка, встановіть пакунок розширень із сайту звантаження VirtualBox. Після цього ви зможете перезапустити USB 2.0. Покищо це вимкнуто, поки ви не скасуєте поточні зміни налаштувань.</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6517,7 +7118,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>C&lose</source>
-        <translation>&Закрити</translation>
+        <translation type="obsolete">&Закрити</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -6536,6 +7141,29 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Закрити</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished">Перемкнути</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -6577,7 +7205,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>Не вдалося створити об'єкт COM програми VirtualBox.</p><p>Програма зараз завершить роботу.</p></translation>
+        <translation type="obsolete"><p>Не вдалося створити об'єкт COM програми VirtualBox.</p><p>Програма зараз завершить роботу.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -6774,15 +7402,15 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete"><p>Не вдалося завантажити файл мови <b><nobr>%1</nobr></b>. <p>Тимчасово буде встановлена англійська мова (вбудована). Будь ласка, перейдіть у діалог <b>Налаштування</b>, який можна відкрити з меню <b>Файл</b> головного вікна VirtualBox, і виберіть один з наявних мов на сторінці <b>Мова</b>.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too old: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) will most likely stop working properly.</p><p>Please update the Guest Additions to the current version by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Гостьові доповнення VirtualBox, які встановлено в гостьовій операційній системі занадто старі: поточна версія — %1, потрібна версія — %2. Деякі властивості, які потребують гостьових доповнень (інтеграцію миші, авторозмір гостьового термінала тощо), найімовірніше не будуть працювати як слід.</p><p>Будь ласка, оновіть гостьові доповнення до поточної версії вибравши <b>Встановити гостьові доповнення</b> з меню <b>Пр [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are outdated: the installed version is %1, the expected version is %2. Some features that require Guest Additions (mouse integration, guest display auto-resize) may not work as expected.</p><p>It is recommended to update the Guest Additions to the current version  by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Гостьові доповнення VirtualBox, які встановлено в гостьову операційну систему, застаріли: поточна версія — %1, потрібна версія — %2. Деякі властивості, які потребують гостьових доповнень (інтеграцію миші, авторозмір гостьового екрана тощо), не можуть працювати як слід.</p><p>Рекомендується оновити гостьові доповнення до поточної версії вибравши <b>Встановити гостьові доповнення</b> з меню <b>Пристрої</b>.&l [...]
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu.</p></source>
+        <source><p>The VirtualBox Guest Additions installed in the Guest OS are too recent for this version of VirtualBox: the installed version is %1, the expected version is %2.</p><p>Using a newer version of Additions with an older version of VirtualBox is not supported. Please install the current version of the Guest Additions by choosing <b>Install Guest Additions</b> from the <b>Devices</b> menu.</p></source>
         <translation type="obsolete"><p>Гостьові доповненя VirtualBox, які встановлені в гостьову операційну систему, — новіші, ніж версія VirtualBox: Встановлена версія — %1, Потрібна версія — %2.</p><p>Не підтримується використання найновішої версії доповнень зі старішою версією. Будь ласка, встановіть поточну версію гостьових доповнень вибравши <b>Встановити гостьові доповнення</b> в меню <b>Пристрої</b>.</p></translation>
     </message>
     <message>
@@ -6887,9 +7515,9 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Звантажити</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translation type="unfinished">Змонтувати</translation>
+        <translation type="obsolete">Змонтувати</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -7035,8 +7663,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Показати вікно з інформацією про продукцію</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>Випущено нову версію VirtualBox! Версія <b>%1</b> доступна на <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Ви можете звантажити цю версію прямим посиланням:<p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Випущено нову версію VirtualBox! Версія <b>%1</b> доступна на <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Ви можете звантажити цю версію прямим посиланням:<p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -7136,7 +7764,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>Один або більше віртуальних носіїв жорстких дисків, CD/DVD або дискет — недоступні. У результаті, ви не можете керувати віртуальною машиною, що використовує той носій, допоки носій не стане доступним.</p><p>Натисність <b>Перевірити</b>, щоб відкрити вікно менеджера віртуальних носіїв і побачити які носії недоступні, або натиснути <b>Ігнорувати</b>, щоб уникнути цього повідомлення.</p></translation>
+        <translation type="obsolete"><p>Один або більше віртуальних носіїв жорстких дисків, CD/DVD або дискет — недоступні. У результаті, ви не можете керувати віртуальною машиною, що використовує той носій, допоки носій не стане доступним.</p><p>Натисність <b>Перевірити</b>, щоб відкрити вікно менеджера віртуальних носіїв і побачити які носії недоступні, або натиснути <b>Ігнорувати</b>, щоб уникнути цього повідомлення.</p></translation>
     </message>
     <message>
         <source><p>Your existing VirtualBox settings files were automatically converted from the old format to a new format required by the new version of VirtualBox.</p><p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if you want to get more information about what files were converted and access additional actions.</p><p>Press <b>Exit</b> to terminate the VirtualBox application without saving the results of [...]
@@ -7166,8 +7794,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Перезап&исати</translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>Трапилась критична помилка під час роботи віртуальної машини і її виконання припинено.</p><p>Зверніться до спільноти за допомогою на сайті <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> або до вашої групи підтримки. Будь ласка, додайте свій журнал помилок <tt>VBox.log</tt> та зображення <tt>VBox.png</tt>, які ви можете знайти в теці <nobr><b>%1</b></nobr>, і також опис [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>Трапилась критична помилка під час роботи віртуальної машини і її виконання припинено.</p><p>Зверніться до спільноти за допомогою на сайті <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> або до вашої групи підтримки. Будь ласка, додайте свій журнал помилок <tt>VBox.log</tt> та зображення <tt>VBox.png</tt>, які ви можете знайти в теці <nobr><b>%1</b></nobr> [...]
     </message>
     <message>
         <source>hard disk</source>
@@ -7474,7 +8102,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>Вилучити пристрій CD/DVD?</p><p>Ви не зможете змонтувати ані CD, ані образ ISO, ані встановити гостьові доповнення без нього!</p></translation>
+        <translation type="obsolete"><p>Вилучити пристрій CD/DVD?</p><p>Ви не зможете змонтувати ані CD, ані образ ISO, ані встановити гостьові доповнення без нього!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -7549,7 +8177,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>Ви збираєтесь додати новий носій CD/DVD до контролера <b>%1</b>.</p><p>Бажаєте вибрати віртуальний диск CD/DVD, щоб застосувати у носії, або залишити це порожнім поки що?</p></translation>
+        <translation type="obsolete"><p>Ви збираєтесь додати новий носій CD/DVD до контролера <b>%1</b>.</p><p>Бажаєте вибрати віртуальний диск CD/DVD, щоб застосувати у носії, або залишити це порожнім поки що?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -7571,14 +8199,14 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Не вдалось від'єднати носій CD/DVD (<nobr><b>%1</b></nobr>) із гнізда <i>%2</i> машини <b>%3</b>.</translation>
+        <translation type="obsolete">Не вдалось від'єднати носій CD/DVD (<nobr><b>%1</b></nobr>) із гнізда <i>%2</i> машини <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Не вдалось від'єднати носій дискет (<nobr><b>%1</b></nobr>) із гнізда <i>%2</i> машини <b>%3</b>.</translation>
+        <translation type="obsolete">Не вдалось від'єднати носій дискет (<nobr><b>%1</b></nobr>) із гнізда <i>%2</i> машини <b>%3</b>.</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Machine</b> menu. If they are installed but the machine is not yet fully started then s [...]
         <translation type="obsolete"><p>Гостьові доповнення VirtualBox не з'явились доступними на віртуальній машині, і без них неможливо використовувати спільні теки. Щоб використовувати їх усередині віртуальної машини, будь ласка, встановіть гостьові доповнення, якщо вони все ще не встановлені, або перевстановіть, якщо вони працюють некоректно, вибравши <b>Встановити гостьові доповнення</b> з меню <b>Машина</b>. Якщо вони встановлені, але машина поки  [...]
     </message>
     <message numerus="yes">
@@ -7627,11 +8255,11 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Не вдалось під'єднати носій CD/DVD (<nobr><b>%1</b></nobr>) до гнізда <i>%2</i> машини <b>%3</b>.</translation>
+        <translation type="obsolete">Не вдалось під'єднати носій CD/DVD (<nobr><b>%1</b></nobr>) до гнізда <i>%2</i> машини <b>%3</b>.</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>Не вдалось під'єднати носій дискет (<nobr><b>%1</b></nobr>) до гнізда <i>%2</i> машини <b>%3</b>.</translation>
+        <translation type="obsolete">Не вдалось під'єднати носій дискет (<nobr><b>%1</b></nobr>) до гнізда <i>%2</i> машини <b>%3</b>.</translation>
     </message>
     <message>
         <source>Deletion of all files belonging to the VM is currently disabled on Windows/x64 to prevent a crash. That will be fixed in the next release.</source>
@@ -7642,8 +8270,8 @@ p, li { white-space: pre-wrap; }
         <translation><p>Зауважте, одиниці пам'яті цього носія не буде вилучено і це буде можливо згодом знову.</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation type="unfinished"><p>Гостьові доповнення VirtualBox не стали доступними для цієї віртуальної машини, а спільні теки неможливо використовувати без них. Щоб використовувати спільні теки всередині віртуальної машини, будь ласка, встановіть гостьові доповнення, якщо їх не встановлено, або перевстановіть їх, якщо вони працюють некоректно, вибравши <b>Встановити гостьові доповнення</b> з меню <b>Пристрої</b>. Якщо вони встановлені, однак машин [...]
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>Гостьові доповнення VirtualBox не стали доступними для цієї віртуальної машини, а спільні теки неможливо використовувати без них. Щоб використовувати спільні теки всередині віртуальної машини, будь ласка, встановіть гостьові доповнення, якщо їх не встановлено, або перевстановіть їх, якщо вони працюють некоректно, вибравши <b>Встановити гостьові доповнення</b> з меню <b>Пристрої</b>. Якщо вони встановлені, однак машина  [...]
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -7885,7 +8513,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>Не вдалось кинути дані.</translation>
+        <translation type="obsolete">Не вдалось кинути дані.</translation>
     </message>
     <message>
         <source><p>Failed to initialize COM because the VirtualBox global configuration directory <b><nobr>%1</nobr></b> is not accessible. Please check the permissions of this directory and of its parent directory.</p><p>The application will now terminate.</p></source>
@@ -8150,14 +8778,6 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -8190,25 +8810,120 @@ p, li { white-space: pre-wrap; }
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>Гостьові доповнення VirtualBox не стали доступними для цієї віртуальної машини, а спільні теки неможливо використовувати без них. Щоб використовувати спільні теки всередині віртуальної машини, будь ласка, встановіть гостьові доповнення, якщо їх не встановлено, або перевстановіть їх, якщо вони працюють некоректно, вибравши <b>Встановити гостьові доповнення</b> з меню <b>Пристрої</b>. Якщо вони встановлені, однак машина  [...]
+        <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">Змонтувати</translation>
+        <comment>additions</comment>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -8301,7 +9016,7 @@ p, li { white-space: pre-wrap; }
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>&Назва:</translation>
     </message>
     <message>
@@ -9272,14 +9987,18 @@ p, li { white-space: pre-wrap; }
         <translation>Файли віртуальної машини (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>Ласкаво просимо до VirtualBox!</h3><p>У лівій частині цього вікна показується список віртуальних машин на вашому комп'ютері. Зараз список порожній, оскільки, поки що, ви не маєте створених віртуальних машин.<img src=:/welcome.png align=right/></p><p>Для того, щоб створити нову віртуальну машину, натисніть <b>Створити</b> в головному меню панелі інструментів, які розміщено зверху вікна.</p><p>Ви може [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Ласкаво просимо до VirtualBox!</h3><p>У лівій частині цього вікна показується список віртуальних машин на вашому комп'ютері. Зараз список порожній, оскільки, поки що, ви не маєте створених віртуальних машин.<img src=:/welcome.png align=right/></p><p>Для того, щоб створити нову віртуальну машину, натисніть <b>Створити</b> в головному меню панелі інструментів, які розміщено зверху вікна.</p> [...]
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>Керування</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -9312,7 +10031,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>Settings</source>
-        <translation>Налаштування</translation>
+        <translation type="obsolete">Налаштування</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -9365,6 +10084,10 @@ p, li { white-space: pre-wrap; }
         <source>Display</source>
         <translation>Екран</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -9440,6 +10163,43 @@ p, li { white-space: pre-wrap; }
         <source>you are currently using more storage controllers than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2.</source>
         <translation type="obsolete">ви тепер використовуєте більше пам'яті контролерів, аніж підтримується — %1. Будь ласка, змініть тип комплекс мікросхем на сторінці налаштувань системи або або збільште кількість кількість пам'яті таких контролерів на сторінці налаштувань пам'яті: %2.</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">Налаштування</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished">Закрити</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -9535,8 +10295,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Підсумок</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="obsolete"><p>Вийшла нова версія VirtualBox! Версія <b>%1</b> доступна на <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>Ви можете звантажити цю версію прямим посиланням:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>Вийшла нова версія VirtualBox! Версія <b>%1</b> доступна на <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>Ви можете звантажити цю версію прямим посиланням:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Unable to obtain the new version information due to the following network error:</p><p><b>%1</b></p></source>
@@ -9604,6 +10364,14 @@ p, li { white-space: pre-wrap; }
         <source>&Restore current snapshot '%1'</source>
         <translation>&Відновити поточний зріз '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -9617,24 +10385,183 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>UIVMListView</name>
+    <name>UIVMInfoDialog</name>
     <message>
-        <source>Inaccessible</source>
-        <translation>Недоступний</translation>
+        <source>%1 - Session Information</source>
+        <translation>%1 — Інформація про сеанс</translation>
     </message>
     <message>
-        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
-        <comment>VM tooltip (name, last state change, session state)</comment>
-        <translation><nobr>%1<br></nobr><nobr>%2 починаючи з %3</nobr><br><nobr>Сеанс %4</nobr></translation>
+        <source>&Details</source>
+        <translation type="obsolete">&Подробиці</translation>
     </message>
     <message>
-        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
-        <comment>Inaccessible VM tooltip (name, last state change)</comment>
-        <translation><nobr><b>%1</b><br></nobr><nobr>Недоступний починаючи з %2</nobr></translation>
+        <source>&Runtime</source>
+        <translation type="obsolete">&Час Роботи</translation>
     </message>
     <message>
-        <source>S&how</source>
-        <translation type="obsolete">По&казати</translation>
+        <source>DMA Transfers</source>
+        <translation>Передавання DMA</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>Передавання PIO</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>Дані зчитано</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>Дані записано</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>Дані передано</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>Дані отримано</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>Параметри часу обробки</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>Розширення екрана</translation>
+    </message>
+    <message>
+        <source>CD/DVD Statistics</source>
+        <translation type="obsolete">Статистика CD/DVD</translation>
+    </message>
+    <message>
+        <source>Network Adapter Statistics</source>
+        <translation type="obsolete">Статистика мережевого адаптера</translation>
+    </message>
+    <message>
+        <source>Version %1.%2</source>
+        <comment>guest additions</comment>
+        <translation type="obsolete">Версія %1.%2</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>Не виявлено</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>Не виявлено</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Гостьові доповнення</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>Тип гостьової операційної системи</translation>
+    </message>
+    <message>
+        <source>Hard Disk Statistics</source>
+        <translation type="obsolete">Статистика жорсткого диска</translation>
+    </message>
+    <message>
+        <source>No Hard Disks</source>
+        <translation type="obsolete">Нема жодного жорсткого диска</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>Нема жодного мережевого адаптера</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Ввімкнуте</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>nested paging</comment>
+        <translation type="obsolete">Вимкнуте</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <translation type="obsolete">Вкладене заміщення сторінок</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">UIVMInfoDialog</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDP server port)</comment>
+        <translation type="obsolete">Недоступний</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>Статистика пам'яті</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>Немає пристрою з накопичуванням пам'яті</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>Статистика мережі</translation>
+    </message>
+    <message>
+        <source>Nested Paging</source>
+        <comment>details report</comment>
+        <translation type="obsolete">Вкладене заміщення сторінок</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>Недоступний</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>Режим буфера</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">Режим перетягування</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMListView</name>
+    <message>
+        <source>Inaccessible</source>
+        <translation>Недоступний</translation>
+    </message>
+    <message>
+        <source><nobr>%1<br></nobr><nobr>%2 since %3</nobr><br><nobr>Session %4</nobr></source>
+        <comment>VM tooltip (name, last state change, session state)</comment>
+        <translation><nobr>%1<br></nobr><nobr>%2 починаючи з %3</nobr><br><nobr>Сеанс %4</nobr></translation>
+    </message>
+    <message>
+        <source><nobr><b>%1</b><br></nobr><nobr>Inaccessible since %2</nobr></source>
+        <comment>Inaccessible VM tooltip (name, last state change)</comment>
+        <translation><nobr><b>%1</b><br></nobr><nobr>Недоступний починаючи з %2</nobr></translation>
+    </message>
+    <message>
+        <source>S&how</source>
+        <translation type="obsolete">По&казати</translation>
     </message>
     <message>
         <source>Switch to the window of the selected virtual machine</source>
@@ -9771,11 +10698,27 @@ p, li { white-space: pre-wrap; }
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>Ховати опис</translation>
+        <translation type="obsolete">Ховати опис</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>Показувати опис</translation>
+        <translation type="obsolete">Показувати опис</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -10628,11 +11571,11 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Відкрити діалог для керування спільними теками</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
+        <source>&Install Guest Additions...</source>
         <translation type="obsolete">Вс&тановити гостьові доповнення...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>Mount the Guest Additions installation image</source>
         <translation type="obsolete">Змонтувати гостьові доповнення з установчого образу</translation>
     </message>
     <message>
@@ -10851,7 +11794,7 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">&Інформація про сеанс</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Show Session Information Dialog</source>
         <translation type="obsolete">Показати інформацію про сеанс</translation>
     </message>
     <message>
@@ -11019,8 +11962,8 @@ p, li { white-space: pre-wrap; }
         <translation><перезавантажити до типових></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation type="unfinished">Значення для фактичного шляху будуть показані після прийняття змін і відкриття діалогу знову.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">Значення для фактичного шляху будуть показані після прийняття змін і відкриття діалогу знову.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -11068,8 +12011,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">Значення для фактичного шляху будуть показані після прийняття змін і відкриття діалогу знову.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -11419,7 +12361,7 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
+        <translation type="obsolete">CD/DVD</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -12223,17 +13165,17 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>Під'єднання цього жорсткого диска буде здійснюватись непрямим чином, використовуючи новостворені обчислення жорсткого диска.</translation>
+        <translation type="obsolete">Під'єднання цього жорсткого диска буде здійснюватись непрямим чином, використовуючи новостворені обчислення жорсткого диска.</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>Деякі носії цієї низки жорсткий дисків недоступні. Будь ласка, використайте керування віртуальними носіями в режимі <b>Показати обчислення жорстких дисків</b>, щоб оглянути цей носій.</translation>
+        <translation type="obsolete">Деякі носії цієї низки жорсткий дисків недоступні. Будь ласка, використайте керування віртуальними носіями в режимі <b>Показати обчислення жорстких дисків</b>, щоб оглянути цей носій.</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
-        <translation>Цей базовий жорсткий диск не напряму під'єднано, використовуючи такі обчислення жорсткого диска:</translation>
+        <translation type="obsolete">Цей базовий жорсткий диск не напряму під'єднано, використовуючи такі обчислення жорсткого диска:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -12290,7 +13232,7 @@ p, li { white-space: pre-wrap; }
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
+        <translation type="obsolete">(CD/DVD)</translation>
     </message>
     <message>
         <source>VDE network, '%1'</source>
@@ -12845,16 +13787,6 @@ p, li { white-space: pre-wrap; }
         <translation>Виберіть адресу для нового файла віртуального жорсткого диска</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -12905,7 +13837,151 @@ p, li { white-space: pre-wrap; }
     <message>
         <source>USB</source>
         <comment>StorageControllerType</comment>
-        <translation type="obsolete">USB</translation>
+        <translation type="unfinished">USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished">Типова</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished">Активні</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished">Активні</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished">Активні</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished">TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -13213,6 +14289,18 @@ p, li { white-space: pre-wrap; }
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">Створити новий віртуальний жорсткий диск</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -13333,8 +14421,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Не вдалось здійснити встановлення зв'язку.</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
-        <translation type="obsolete"><p>Будь ласка, заповніть реєстраційну форму, цим самим, ми будемо знати, що ви користуєтесь програмою VirtualBox і, за власним бажанням, отримаєте можливість бути в курсі новин і оновлень про VirtualBox.</p><p>Введіть ваше повне і'мя, користуючись латинськими символами, та адресу електронної пошти в нижніх полях. Будь ласка, майте на увазі, що ця інформація буде використовуватись лише для статистичних даних кількості користувачі [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Enter your full name using Latin characters and your e-mail address to the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed i [...]
+        <translation type="obsolete"><p>Будь ласка, заповніть реєстраційну форму, цим самим, ми будемо знати, що ви користуєтесь програмою VirtualBox і, за власним бажанням, отримаєте можливість бути в курсі новин і оновлень про VirtualBox.</p><p>Введіть ваше повне і'мя, користуючись латинськими символами, та адресу електронної пошти в нижніх полях. Будь ласка, майте на увазі, що ця інформація буде використовуватись лише для статистичних даних кількості користувачі [...]
     </message>
     <message>
         <source>Check this box if you do not want to receive mail from Sun Microsystems at the e-mail address specified above.</source>
@@ -13353,8 +14441,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Виберіть країну/територію</translation>
     </message>
     <message>
-        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
-        <translation type="obsolete"><p>Будь ласка, заповніть цю реєстраційну форму, щоб ми знали, що ви використуєте VirtualBox, і, за вашим бажанням, ми триматимемо вас у курсі всіх новин і оновлень щодо VirtualBox.</p><p>Будь ласка, використовуйте латинські символи для заповнення полів нижче. Будь ласка, майте на увазі, Sun Microsystems використовуватиме цю інформацію лише для збору статистичної інформації та розсилки новин. Власне, Sun Microsystems ніколи не надасть [...]
+        <source><p>Please fill out this registration form to let us know that you use VirtualBox and, optionally, to keep you informed about VirtualBox news and updates.</p><p>Please use Latin characters only to fill in  the fields below. Sun Microsystems will use this information only to gather product usage statistics and to send you VirtualBox newsletters. In particular, Sun Microsystems will never pass your data to third parties. Detailed information about how we us [...]
+        <translation type="obsolete"><p>Будь ласка, заповніть цю реєстраційну форму, щоб ми знали, що ви використуєте VirtualBox, і, за вашим бажанням, ми триматимемо вас у курсі всіх новин і оновлень щодо VirtualBox.</p><p>Будь ласка, використовуйте латинські символи для заповнення полів нижче. Будь ласка, майте на увазі, Sun Microsystems використовуватиме цю інформацію лише для збору статистичної інформації та розсилки новин. Власне, Sun Microsystems ніколи не надасть [...]
     </message>
     <message>
         <source>I &already have a Sun Online account:</source>
@@ -13506,8 +14594,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Призупинити роботу віртуально машини</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>F1</b> key to [...]
-        <translation type="obsolete"><h3>Ласкаво просимо до програми VirtualBox!</h3><p>Ліва частина цього вікна призначена для показу списку всіх віртуальних машин на вашому комп'ютері. Цей список зараз порожній, бо ви ще не створили жодної віртуальної машини.<img src=:/welcome.png align=right/></p><p>Щоб створити нову віртуальну машину, натисніть кнопку <b>Створити</b> на головній панелі інструментів, який знаходиться зверху вікна.&l [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>F1</b> key to [...]
+        <translation type="obsolete"><h3>Ласкаво просимо до програми VirtualBox!</h3><p>Ліва частина цього вікна призначена для показу списку всіх віртуальних машин на вашому комп'ютері. Цей список зараз порожній, бо ви ще не створили жодної віртуальної машини.<img src=:/welcome.png align=right/></p><p>Щоб створити нову віртуальну машину, натисніть кнопку <b>Створити</b> на головній панелі інструментів, який знаходиться зверху вікна.&l [...]
     </message>
     <message>
         <source>Log</source>
@@ -13519,8 +14607,8 @@ p, li { white-space: pre-wrap; }
         <translation type="obsolete">Sun VirtualBox</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>Ласкаво просимо до VirtualBox!</h3><p>У лівій частині цього вікна показується список віртуальних машин на вашому комп'ютері. Зараз список порожній, оскільки, поки що, ви не маєте створених віртуальних машин.<img src=:/welcome.png align=right/></p><p>Для того, щоб створити нову віртуальну машину, натисніть <b>Створити</b> в головному меню панелі інструментів, які розміщено зверху вікна.</p> [...]
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>Ласкаво просимо до VirtualBox!</h3><p>У лівій частині цього вікна показується список віртуальних машин на вашому комп'ютері. Зараз список порожній, оскільки, поки що, ви не маєте створених віртуальних машин.<img src=:/welcome.png align=right/></p><p>Для того, щоб створити нову віртуальну машину, натисніть <b>Створити</b> в головному меню панелі інструментів, які розміщено зверху вікна.</p> [...]
     </message>
     <message>
         <source>Select a virtual machine file</source>
@@ -14042,157 +15130,6 @@ p, li { white-space: pre-wrap; }
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 — Інформація про сеанс</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">&Подробиці</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">&Час Роботи</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>Передавання DMA</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>Передавання PIO</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>Дані зчитано</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>Дані записано</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>Дані передано</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>Дані отримано</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>Параметри часу обробки</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>Розширення екрана</translation>
-    </message>
-    <message>
-        <source>CD/DVD Statistics</source>
-        <translation type="obsolete">Статистика CD/DVD</translation>
-    </message>
-    <message>
-        <source>Network Adapter Statistics</source>
-        <translation type="obsolete">Статистика мережевого адаптера</translation>
-    </message>
-    <message>
-        <source>Version %1.%2</source>
-        <comment>guest additions</comment>
-        <translation type="obsolete">Версія %1.%2</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>Не виявлено</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>Не виявлено</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Гостьові доповнення</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>Тип гостьової операційної системи</translation>
-    </message>
-    <message>
-        <source>Hard Disk Statistics</source>
-        <translation type="obsolete">Статистика жорсткого диска</translation>
-    </message>
-    <message>
-        <source>No Hard Disks</source>
-        <translation type="obsolete">Нема жодного жорсткого диска</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>Нема жодного мережевого адаптера</translation>
-    </message>
-    <message>
-        <source>Enabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Ввімкнуте</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>nested paging</comment>
-        <translation type="obsolete">Вимкнуте</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <translation type="obsolete">Вкладене заміщення сторінок</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDP server port)</comment>
-        <translation type="obsolete">Недоступний</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>Статистика пам'яті</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>Немає пристрою з накопичуванням пам'яті</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>Статистика мережі</translation>
-    </message>
-    <message>
-        <source>Nested Paging</source>
-        <comment>details report</comment>
-        <translation type="obsolete">Вкладене заміщення сторінок</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>Недоступний</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>Режим буфера</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>Режим перетягування</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_xx_YY.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_xx_YY.ts
index fe25b8d..b7cafde 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_xx_YY.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_xx_YY.ts
@@ -171,26 +171,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Disable &Mouse Integration</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Temporarily disable host mouse pointer integration</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Insert Ctrl-Alt-Del</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Take a snapshot of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -235,18 +215,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&CD/DVD Devices</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Floppy Devices</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&USB Devices</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Change the settings of network adapters</source>
         <translation type="unfinished"></translation>
     </message>
@@ -285,26 +253,10 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch to &Fullscreen</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch between normal and fullscreen mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Switch to Seam&less Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and seamless desktop integration mode</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Switch to &Scaled Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Switch between normal and scaled mode</source>
         <translation type="unfinished"></translation>
     </message>
@@ -373,10 +325,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation type="unfinished"></translation>
@@ -640,10 +588,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation type="unfinished"></translation>
     </message>
@@ -684,16 +628,15 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Logging...</source>
-        <comment>debug action</comment>
+        <source>Popup Menu</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Popup Menu</source>
+        <source>Show Session Information Window</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <source>&Webcams</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -701,17 +644,239 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
+        <source>Insert the Guest Additions disk file into the virtual drive</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Webcams</source>
+        <source>&VirtualBox</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
         <source>Network</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -847,14 +1012,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
+        <source>Retrieving data ...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation type="unfinished"></translation>
@@ -905,6 +1070,31 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation type="unfinished">
+            <numerusform></numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIGChooserItemGroup</name>
     <message>
         <source><b>%1</b></source>
@@ -1034,11 +1224,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Controller</source>
         <comment>details (audio)</comment>
         <translation type="unfinished"></translation>
@@ -1227,6 +1412,101 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIGMachinePreview</name>
@@ -1367,31 +1647,19 @@
 <context>
     <name>UIGlobalSettingsGeneral</name>
     <message>
-        <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Default &Machine Folder:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>V&RDP Authentication Library:</source>
+        <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
+        <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Auto-Show in Fullscreen</source>
+        <source>Default &Machine Folder:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
+        <source>V&RDP Authentication Library:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -2135,16 +2403,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
-        <comment>CD/DVD tooltip</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
-        <comment>FD tooltip</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
         <translation type="unfinished"></translation>
@@ -2180,11 +2438,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
-        <comment>USB device tooltip</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
         <comment>Shared folders tooltip</comment>
         <translation type="unfinished"></translation>
@@ -2224,6 +2477,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -2305,10 +2572,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Video</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Video &Memory:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2469,10 +2732,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -2524,7 +2783,55 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -2535,11 +2842,11 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -2555,7 +2862,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -2563,51 +2870,107 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
+        <source>D&rag'n'Drop:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Removable Media:</source>
+        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Remember Runtime Changes</source>
+        <source>No name specified for the virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Mini ToolBar:</source>
+        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <source>Enc&ryption</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show in &Fullscreen/Seamless</source>
+        <source>When checked, enables encryption for this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <source>En&able Encryption</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show at &Top of Screen</source>
+        <source>Encryption C&ipher:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <source>E&nter New Password:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>No name specified for the virtual machine.</source>
+        <source>Holds the password to be assigned to the virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <source>C&onfirm New Password:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -2966,10 +3329,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation type="unfinished"></translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -3011,27 +3370,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
+        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Create Pipe</source>
+        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Port/File &Path:</source>
+        <source>&Connect to existing pipe/socket</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
+        <source>&Path/Address:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -3073,14 +3432,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Add Controller</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3113,14 +3464,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Add CD/DVD Device</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Add Floppy Device</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Remove Attachment</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3249,18 +3592,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD &Drive:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Floppy &Drive:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3281,10 +3612,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Remove disk from virtual drive</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3354,6 +3681,54 @@
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -3526,31 +3901,39 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
+        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
+        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system (<b>%1</b>). This is likely to degrade the performance of your virtual machine. Please consider reducing the number of virtual CPUs.</source>
+        <source>&Paravirtualization Interface:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -3622,10 +4005,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>USB Device &Filters</source>
         <translation type="unfinished"></translation>
     </message>
@@ -3678,7 +4057,27 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -3805,7 +4204,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>C&lose</source>
+        <source>Removing medium...</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -3825,6 +4224,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -3865,10 +4287,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to set global VirtualBox properties.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4094,10 +4512,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Release</source>
         <comment>detach medium</comment>
         <translation type="unfinished"></translation>
@@ -4134,15 +4548,7 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to access the disk image file <nobr><b>%1</b></nobr>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <source>Failed to access the disk image file <nobr><b>%1</b></nobr>.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -4242,10 +4648,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>&Remove</source>
         <comment>medium</comment>
         <translation type="unfinished"></translation>
@@ -4295,10 +4697,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -4307,14 +4705,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation type="unfinished"></translation>
     </message>
@@ -4343,14 +4733,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -4542,10 +4924,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to drop data.</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -4769,14 +5147,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation type="unfinished"></translation>
     </message>
@@ -4809,24 +5179,120 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
         <source>Insert</source>
         <comment>additions</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -4863,7 +5329,7 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
@@ -5051,12 +5517,12 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <source>Manager</source>
+        <comment>Note: main window title which is pretended by the product name.</comment>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Manager</source>
-        <comment>Note: main window title which is pretended by the product name.</comment>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5078,10 +5544,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Settings</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source><b>%1</b> page:</source>
         <translation type="unfinished"></translation>
     </message>
@@ -5128,6 +5590,10 @@
         <source>Display</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -5179,6 +5645,43 @@
         <source>%1 - %2</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -5303,6 +5806,14 @@
         <source>&Restore current snapshot '%1'</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -5311,7 +5822,105 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>&Snapshots</source>
+        <source>&Snapshots</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -5402,11 +6011,19 @@
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
+        <source>&Expert Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Show Description</source>
+        <source>&Guided Mode</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -6254,11 +6871,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>CD/DVD</source>
-        <comment>DeviceType</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Hard Disk</source>
         <comment>DeviceType</comment>
         <translation type="unfinished"></translation>
@@ -6847,21 +7459,6 @@
         <comment>medium</comment>
         <translation type="unfinished"></translation>
     </message>
-    <message>
-        <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
-        <comment>medium</comment>
-        <translation type="unfinished"></translation>
-    </message>
     <message numerus="yes">
         <source>%n year(s)</source>
         <translation type="unfinished">
@@ -6899,10 +7496,6 @@
         </translation>
     </message>
     <message>
-        <source>(CD/DVD)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Screens</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -7337,16 +7930,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translation type="unfinished"></translation>
@@ -7394,6 +7977,155 @@
         <source>You can create or add disk image files in the virtual machine settings.</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxGlobalSettings</name>
@@ -7524,6 +8256,18 @@
         <source>Modify the attributes of the selected disk image file</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxScreenshotViewer</name>
@@ -7708,102 +8452,4 @@
         <translation type="unfinished"></translation>
     </message>
 </context>
-<context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
 </TS>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_CN.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_CN.ts
index a98b98a..0b21f61 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_CN.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_CN.ts
@@ -219,19 +219,19 @@
     </message>
     <message>
         <source>Disable &Mouse Integration</source>
-        <translation>禁止自动独占鼠标(&M)</translation>
+        <translation type="obsolete">禁止自动独占鼠标(&M)</translation>
     </message>
     <message>
         <source>Temporarily disable host mouse pointer integration</source>
-        <translation>临时禁止自动独占鼠标</translation>
+        <translation type="obsolete">临时禁止自动独占鼠标</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Del</source>
-        <translation>发送 Ctrl-Alt-Del (&E)</translation>
+        <translation type="obsolete">发送 Ctrl-Alt-Del (&E)</translation>
     </message>
     <message>
         <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>发送 Ctrl-Alt-Del 键盘序列到虚拟电脑</translation>
+        <translation type="obsolete">发送 Ctrl-Alt-Del 键盘序列到虚拟电脑</translation>
     </message>
     <message>
         <source>&Insert Ctrl-Alt-Backspace</source>
@@ -239,7 +239,7 @@
     </message>
     <message>
         <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>发送 Ctrl-Alt-Backspace 键盘序列到虚拟电脑</translation>
+        <translation type="obsolete">发送 Ctrl-Alt-Backspace 键盘序列到虚拟电脑</translation>
     </message>
     <message>
         <source>Take &Snapshot...</source>
@@ -247,11 +247,11 @@
     </message>
     <message>
         <source>Take a snapshot of the virtual machine</source>
-        <translation>为当前虚拟电脑生成一个备份(系统快照)</translation>
+        <translation>为当前虚拟电脑生成一个备份[系统快照]</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>显示当前运行状态信息</translation>
+        <source>Show Session Information Dialog</source>
+        <translation type="obsolete">显示当前运行状态信息</translation>
     </message>
     <message>
         <source>&Pause</source>
@@ -295,15 +295,15 @@
     </message>
     <message>
         <source>&CD/DVD Devices</source>
-        <translation>分配光驱(&C)</translation>
+        <translation type="obsolete">分配光驱(&C)</translation>
     </message>
     <message>
         <source>&Floppy Devices</source>
-        <translation>分配软驱(&F)</translation>
+        <translation type="obsolete">分配软驱(&F)</translation>
     </message>
     <message>
         <source>&USB Devices</source>
-        <translation>分配USB设备(&U)</translation>
+        <translation type="obsolete">分配USB设备(&U)</translation>
     </message>
     <message>
         <source>&Network Adapters...</source>
@@ -322,12 +322,12 @@
         <translation>打开共享文件夹对话框</translation>
     </message>
     <message>
-        <source>&Insert Guest Additions CD image...</source>
-        <translation>安装增强功能(&I)...</translation>
+        <source>&Install Guest Additions...</source>
+        <translation type="obsolete">安装增强功能(&I)...</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>打开增强功能包所在虚拟光盘</translation>
+        <source>Mount the Guest Additions installation image</source>
+        <translation type="obsolete">打开增强功能包所在虚拟光盘</translation>
     </message>
     <message>
         <source>De&bug</source>
@@ -370,15 +370,15 @@
     </message>
     <message>
         <source>Switch to &Fullscreen</source>
-        <translation>切换到全屏模式(&F)</translation>
+        <translation type="obsolete">切换到全屏模式(&F)</translation>
     </message>
     <message>
         <source>Switch between normal and fullscreen mode</source>
-        <translation>切换正常或全屏模式</translation>
+        <translation type="obsolete">切换正常或全屏模式</translation>
     </message>
     <message>
         <source>Switch to Seam&less Mode</source>
-        <translation>切换到无缝模式(&L)</translation>
+        <translation type="obsolete">切换到无缝模式(&L)</translation>
     </message>
     <message>
         <source>Switch between normal and seamless desktop integration mode</source>
@@ -386,7 +386,7 @@
     </message>
     <message>
         <source>Switch to &Scaled Mode</source>
-        <translation>切换到自动缩放模式(&S)</translation>
+        <translation type="obsolete">切换到自动缩放模式(&S)</translation>
     </message>
     <message>
         <source>Switch between normal and scaled mode</source>
@@ -458,7 +458,6 @@
     </message>
     <message>
         <source>Take Screensh&ot...</source>
-        <translatorcomment>Fixed</translatorcomment>
         <translation>屏幕截图(&O)...</translation>
     </message>
     <message>
@@ -467,7 +466,7 @@
     </message>
     <message>
         <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>发送 Ctrl-Alt-Backspace (&E)</translation>
+        <translation type="obsolete">发送 Ctrl-Alt-Backspace (&E)</translation>
     </message>
     <message>
         <source>&File</source>
@@ -764,19 +763,19 @@
     </message>
     <message>
         <source>Drag'n'Drop</source>
-        <translation>拖放</translation>
+        <translation type="obsolete">拖放</translation>
     </message>
     <message>
         <source>Save the machine state of the virtual machine</source>
-        <translation>保存此虚拟电脑的休眠状态</translation>
+        <translation>保存虚拟电脑的状态</translation>
     </message>
     <message>
         <source>Power off the virtual machine</source>
-        <translation>关闭此虚拟电脑的电源</translation>
+        <translation>强制退出</translation>
     </message>
     <message>
         <source>&Network Settings...</source>
-        <translation>更改网络设置(&N)...</translation>
+        <translation>网络(&N)...</translation>
     </message>
     <message>
         <source>&Shared Folders Settings...</source>
@@ -784,12 +783,11 @@
     </message>
     <message>
         <source>R&emote Display</source>
-        <translation>远程桌面(&E)</translation>
+        <translation>远程桌面(&R)</translation>
     </message>
     <message>
         <source>Toggle remote desktop (RDP) connections to this machine</source>
-        <translatorcomment>TODO</translatorcomment>
-        <translation>启用到当前虚拟电脑的远程桌面(RDP)连接</translation>
+        <translation>切换到当前虚拟电脑的远程桌面(RDP)连接</translation>
     </message>
     <message>
         <source>&Video Capture</source>
@@ -808,32 +806,257 @@
         <translation>设定录像选项</translation>
     </message>
     <message>
-        <source>&Logging...</source>
-        <comment>debug action</comment>
-        <translation>启用日志(&L)...</translation>
-    </message>
-    <message>
         <source>Popup Menu</source>
         <translation>弹出菜单</translation>
     </message>
     <message>
+        <source>Show Session Information Window</source>
+        <translation>显示当前运行状态信息</translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation>摄像头(&W)</translation>
+    </message>
+    <message>
         <source>&Insert Guest Additions CD image...</source>
-        <comment>new</comment>
-        <translation type="obsolete">安装增强功能(&I)...</translation>
+        <translation>安装增强功能(&I)...</translation>
     </message>
     <message>
         <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <comment>new</comment>
-        <translation type="obsolete">打开增强功能包所在虚拟光盘</translation>
+        <translation>打开增强功能包所在虚拟光盘</translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>摄像头(&W)</translation>
+        <source>&VirtualBox</source>
+        <translation>&VirtualBox</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>菜单栏(&M)</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>菜单栏设置(&M)...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>打开对话框选配置菜单栏</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>显示菜单栏(&B)</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>切换菜单栏</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>状态栏(&S)</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>状态栏设置(&S)...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>打开对话框选配置状态栏</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>显示状态栏(&B)</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>切换状态栏</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>热键(&I)</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>热键(&K)</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>热键设置(&K)...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>打开全局设定界面设置热键</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>鼠标(&M)</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>虚拟硬盘(&H)</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>虚拟硬盘设置(&H)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>更改虚拟硬盘设置</translation>
     </message>
     <message>
         <source>Network</source>
         <translation>网络</translation>
     </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>USB设置(&U)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>更改USB设置</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>共享文件夹(&S)</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>日志(&L)...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translatorcomment>todo</translatorcomment>
+        <translation>外部数据管理(&x)...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>打开外部数据管理界面</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>管理(&F)</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translatorcomment>todo</translatorcomment>
+        <translation>窗口(&W)</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>窗口最小化(&M)</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>当前虚拟电脑窗口最小化</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>全屏模式(&F)</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>切换正常或全屏模式</translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation>无缝模式(&L)</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>自动缩放模式(&S)</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>缩放率(&c)</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>载入 %1 (&I)</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>发送 %1 键盘序列到虚拟电脑</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>鼠标集成(&M)</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>启用主机鼠标指针合并</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>分配光驱(&O)</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>分配软驱(&F)</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation>&USB</translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>拖放</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>日志(&L)</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation>正常启动(&N)</translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation>无界面启动(&H)</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation>在后台运行选中的虚拟电脑</translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation>分离式启动(&D)</translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation>启动所选虚拟电脑,并允许其可在后台继续运行</translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>启用</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>重设为 %1x%2</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation>%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - 虚拟盘加密</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>虚拟电脑已加密码保护。请在下面输入密码。</numerusform>
+        </translation>
+    </message>
 </context>
 <context>
     <name>UIApplianceEditorWidget</name>
@@ -1604,6 +1827,13 @@
     </message>
 </context>
 <context>
+    <name>UIDnDDrag</name>
+    <message>
+        <source>Retrieving data ...</source>
+        <translation>获取数据...</translation>
+    </message>
+</context>
+<context>
     <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
@@ -1614,7 +1844,7 @@
     <name>UIDnDMimeData</name>
     <message>
         <source>Dropping data ...</source>
-        <translation>丢弃数据...</translation>
+        <translation type="obsolete">丢弃数据...</translation>
     </message>
 </context>
 <context>
@@ -1662,6 +1892,31 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation>状态</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation>ID</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>密码</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>用于如下 %n 个硬盘:</nobr><br>%1</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIExportApplianceWzd</name>
     <message>
         <source>Appliance Export Wizard</source>
@@ -2019,7 +2274,7 @@
     <message>
         <source>[CD/DVD]</source>
         <comment>details (storage)</comment>
-        <translation>[光驱]</translation>
+        <translation type="obsolete">[光驱]</translation>
     </message>
     <message>
         <source>Not attached</source>
@@ -2224,13 +2479,124 @@
     <message>
         <source>NAT Network, '%1'</source>
         <comment>details (network)</comment>
-        <translatorcomment>TODO</translatorcomment>
         <translation>NAT 网络, '%1'</translation>
     </message>
     <message>
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>帧尺寸: %1x%2, 帧率: %3fps, 比特率: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>最少半虚拟化</translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Hyper-V 半虚拟化</translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>KVM 半虚拟化</translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[光驱]</translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>USB 控制器</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translatorcomment>todo</translatorcomment>
+        <translation type="obsolete">缩放率</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translatorcomment>todo</translatorcomment>
+        <translation type="obsolete">原始 HiDPI 视频输出</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">已启用</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>小工具栏位置</translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>顶部</translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>底部</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>小工具栏</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>已禁用</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">缩放率</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">原始 HiDPI 视频输出</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIGDetailsUpdateThreadAudio</name>
@@ -2482,15 +2848,15 @@
     </message>
     <message>
         <source>Machine Windows:</source>
-        <translation type="unfinished"></translation>
+        <translation>虚拟机窗口:</translation>
     </message>
     <message>
         <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation type="unfinished"></translation>
+        <translation>选中时, 鼠标移到虚拟机窗口上则该窗口变为前置窗口。</translation>
     </message>
     <message>
         <source>&Raise Window Under Mouse</source>
-        <translation type="unfinished"></translation>
+        <translation>鼠标前置窗口(&R)</translation>
     </message>
 </context>
 <context>
@@ -2579,19 +2945,6 @@
         <translation type="obsolete">禁用主机的屏幕保护程序(&S)</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translatorcomment>TODO</translatorcomment>
-        <translation>小工具栏(&D):</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>在全屏模式自动显示</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>选中时,若虚拟机为全屏状态则显示小工具栏。</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation>主机的屏幕保护程序(&S):</translation>
     </message>
@@ -2640,7 +2993,6 @@
     </message>
     <message>
         <source>&VirtualBox Manager</source>
-        <translatorcomment>TODO</translatorcomment>
         <translation>虚拟电脑管理器(&V)</translation>
     </message>
     <message>
@@ -2871,7 +3223,6 @@
     </message>
     <message>
         <source>No CIDR specified for the NAT network <b>%1</b>.</source>
-        <translatorcomment>TODO</translatorcomment>
         <translation>没有为 <b>%1</b> NAT网络指定CIDR。</translation>
     </message>
     <message>
@@ -3116,7 +3467,7 @@
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>显示主机虚拟网络界面的 IPv6 地址(若支持IPv6).</translation>
+        <translation>显示主机虚拟网络界面的 IPv6 地址.</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
@@ -3124,7 +3475,7 @@
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>显示主机虚拟网络界面的 IPv6 网络掩码前缀(若支持IPv6).</translation>
+        <translation>显示主机虚拟网络界面的 IPv6 网络掩码前缀.</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
@@ -3144,7 +3495,6 @@
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translatorcomment>TODO</translatorcomment>
         <translation>显示 DHCP 服务器地址.</translation>
     </message>
     <message>
@@ -3224,7 +3574,6 @@
     </message>
     <message>
         <source>Advertise Default IPv6 &Route</source>
-        <translatorcomment>TODO</translatorcomment>
         <translation>建议默认 IPv6 路径(&R)</translation>
     </message>
     <message>
@@ -3619,12 +3968,12 @@
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
         <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>指示光驱活动状态:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>指示光驱活动状态:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
         <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>指示软驱活动状态:</nobr>%1</p></translation>
+        <translation type="obsolete"><p style='white-space:pre'><nobr>指示软驱活动状态:</nobr>%1</p></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
@@ -3664,7 +4013,7 @@
     <message>
         <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
         <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB控制器已被禁用</b></nobr></translation>
+        <translation type="obsolete"><br><nobr><b>USB控制器已被禁用</b></nobr></translation>
     </message>
     <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
@@ -3719,6 +4068,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation>其他功能状态:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>指示显示器活动状态:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>指示光驱活动状态:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>指示软驱活动状态:</nobr>%1</p></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -3825,7 +4188,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>显卡(&V)</translation>
+        <translation type="obsolete">显卡(&V)</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -3967,7 +4330,7 @@
     </message>
     <message>
         <source>This setting determines the <b>vertical</b> resolution (frame height) of the recorded video.</source>
-        <translation>录像的<b>垂直</b> 分辨率 (帧高度) 。</translation>
+        <translation></translation>
     </message>
     <message>
         <source>&Frame Rate:</source>
@@ -4007,7 +4370,7 @@
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>虚拟电脑设置为启用显卡硬件加速,并且操作系统设置为Windows Vista及更新版。为获得最佳性能,应将虚拟电脑的显存至少设置为 <b>%1</b>.</translation>
+        <translation type="obsolete">虚拟电脑设置为启用显卡硬件加速,并且操作系统设置为Windows Vista及更新版。为获得最佳性能,应将虚拟电脑的显存至少设置为 <b>%1</b>.</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -4061,9 +4424,77 @@
         <translation>启用屏幕 %1 录像。</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source>Mini ToolBar:</source>
+        <translation type="obsolete">小工具栏:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation type="obsolete">选中,将在全屏或无缝模式显示小工具栏。</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation type="obsolete">在全屏或无缝模式显示(&F)</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation type="obsolete">选中,小工具栏将出现在屏幕的顶部,而不是默认的底部位置。</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation type="obsolete">在屏幕顶部显示(&T)</translation>
+    </message>
+    <message>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>五分钟视频约 %1MB</i></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
         <translation>本虚拟机当前已启用远程桌面。然而,这需要安装 <b>%1</b>。请从 VirtualBox 下载站中安装“扩展增强包” (菜单操作:设备--安装增强功能),不然远程桌面将禁用。</translation>
     </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation>虚拟电脑设置为启用显卡硬件加速,并且操作系统设置为Windows Vista及更新版。为获得最佳性能,应将虚拟电脑的显存至少设置为 <b>%1</b>.</translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished">HiDPI:</translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished">用原始 HiDPI 输出(&U)</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsGeneral</name>
@@ -4072,7 +4503,7 @@
         <translation>指定用于存放备份的文件夹。需要注意的是备份会占用一定的磁盘空间.</translation>
     </message>
     <message>
-        <source>&Basic</source>
+        <source>Basi&c</source>
         <translation>基本(&B)</translation>
     </message>
     <message>
@@ -4084,7 +4515,7 @@
         <translation type="obsolete">显示虚拟电脑名称.</translation>
     </message>
     <message>
-        <source>&Advanced</source>
+        <source>A&dvanced</source>
         <translation>高级(&A)</translation>
     </message>
     <message>
@@ -4100,7 +4531,7 @@
         <translation>备份的位置(&n):</translation>
     </message>
     <message>
-        <source>&Description</source>
+        <source>D&escription</source>
         <translation>说明(&D)</translation>
     </message>
     <message>
@@ -4109,42 +4540,42 @@
     </message>
     <message>
         <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>选中后,在虚拟电脑运行过程中对任何介质的分配变动都将被保存在配置文件中.</translation>
+        <translation type="obsolete">选中后,在虚拟电脑运行过程中对任何介质的分配变动都将被保存在配置文件中.</translation>
     </message>
     <message>
         <source>Removable Media:</source>
-        <translation>光驱状态:</translation>
+        <translation type="obsolete">光驱状态:</translation>
     </message>
     <message>
         <source>&Remember Runtime Changes</source>
-        <translation>保存运行时的变动(&R)</translation>
+        <translation type="obsolete">保存运行时的变动(&R)</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
-        <translation>小工具栏:</translation>
+        <translation type="obsolete">小工具栏:</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>选中,将在全屏或无缝模式显示小工具栏。</translation>
+        <translation type="obsolete">选中,将在全屏或无缝模式显示小工具栏。</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
-        <translation>在全屏或无缝模式显示(&F)</translation>
+        <translation type="obsolete">在全屏或无缝模式显示(&F)</translation>
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>选中,小工具栏将出现在屏幕的顶部,而不是默认的底部位置。</translation>
+        <translation type="obsolete">选中,小工具栏将出现在屏幕的顶部,而不是默认的底部位置。</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>在屏幕顶部显示(&T)</translation>
+        <translation type="obsolete">在屏幕顶部显示(&T)</translation>
     </message>
     <message>
         <source>you have selected a 64-bit guest OS type for this VM. As such guests require hardware virtualization (VT-x/AMD-V), this feature will be enabled automatically.</source>
         <translation type="obsolete">您已经为该虚拟电脑选择了一个64位的操作系统。该操作系统需要硬件虚拟指令 (VT-x/AMD-V) 的支持方能运行,因此该特性将被自动启用。</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
+        <source>D&rag'n'Drop:</source>
         <translation>拖放(&D):</translation>
     </message>
     <message>
@@ -4157,9 +4588,129 @@
     </message>
     <message>
         <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translatorcomment>TODO</translatorcomment>
         <translation>虚拟电脑操作系统提示设为64位。 64位系统需要硬件虚拟。若设置则更改时自动选择。</translation>
     </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation>加密(&r)</translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>选中后,将为这个虚拟电脑启用加密.</translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation>启用加密(&a)</translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation>加密算法(&i):</translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>显示加密虚拟硬盘所用算法。</translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation>新密码(&n):</translation>
+    </message>
+    <message>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>显示虚拟电脑所用密码。</translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation>重输新密码(&o):</translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>确认所设密码。</translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>你准备加密此虚拟电脑。不过,这需要安装<i>%1</i>。请从 VirtualBox 网站下载安装增强包。</translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation>未设置加密算法。</translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation>密码为空。</translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation>密码不匹配。</translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>不更改</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>允许修改菜单栏。</translation>
+    </message>
+    <message>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">屏幕缩放率:</translation>
+    </message>
+    <message>
+        <source>This setting determines the guest screen scale factor.</source>
+        <translation type="obsolete">设置虚拟电脑屏幕缩放率。</translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="obsolete">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translatorcomment>todo</translatorcomment>
+        <translation type="obsolete">HiDPI:</translation>
+    </message>
+    <message>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">选中时,虚拟电脑显示内容将不缩放匹配主机高分辨率屏幕。</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">用原始 HiDPI 输出(&U)</translation>
+    </message>
+    <message>
+        <source>Mini ToolBar:</source>
+        <translation>小工具栏:</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
+        <translation>选中,将在全屏或无缝模式显示小工具栏。</translation>
+    </message>
+    <message>
+        <source>Show in &Fullscreen/Seamless</source>
+        <translation>在全屏或无缝模式显示(&F)</translation>
+    </message>
+    <message>
+        <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
+        <translation>选中,小工具栏将出现在屏幕的顶部,而不是默认的底部位置。</translation>
+    </message>
+    <message>
+        <source>Show at &Top of Screen</source>
+        <translation>在屏幕顶部显示(&T)</translation>
+    </message>
+    <message>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>允许修改状态栏。</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsNetwork</name>
@@ -4563,10 +5114,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation>选中时,该共享文件夹将是永久性的。</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>窗口</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -4609,19 +5156,19 @@
     </message>
     <message>
         <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>如果选中,在 <b>端口路径</b>域中指定的通道将在虚拟电脑启动时被创建。否则虚拟电脑将尝试使用已存在的通道.</translation>
+        <translation type="obsolete">如果选中,在 <b>端口路径</b>域中指定的通道将在虚拟电脑启动时被创建。否则虚拟电脑将尝试使用已存在的通道.</translation>
     </message>
     <message>
         <source>&Create Pipe</source>
-        <translation>创建通道(&C)</translation>
+        <translation type="obsolete">创建通道(&C)</translation>
     </message>
     <message>
         <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>当端口工作在 <b>Host Pipe</b> 模式时将显示该串口通道在主机上的路径,或者当端口工作在 <b>Host Device</b> 模式时将显示主机上的串口设备名.</translation>
+        <translation type="obsolete">当端口工作在 <b>Host Pipe</b> 模式时将显示该串口通道在主机上的路径,或者当端口工作在 <b>Host Device</b> 模式时将显示主机上的串口设备名.</translation>
     </message>
     <message>
         <source>Port/File &Path:</source>
-        <translation>端口/文件位置(&P):</translation>
+        <translation type="obsolete">端口/文件位置(&P):</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
@@ -4631,6 +5178,22 @@
         <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
         <translation>显示该串口的 I/O 端口地址,正确的数值为从 <tt>0</tt> 到 <tt>0xFFFF</tt>的整数.</translation>
     </message>
+    <message>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation>如果选中,虚拟电脑将假设在 <b>路径/地址</b>域中指定的通道或套接字存在并尝试启用之,否则将在启动时创建之。</translation>
+    </message>
+    <message>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>连接至现有通道或套接字(&C)</translation>
+    </message>
+    <message>
+        <source>&Path/Address:</source>
+        <translation>路径/地址(&P):</translation>
+    </message>
+    <message>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation><p>在 <b>主机通道</b> 模式: 显示到主机串口通道的路径. 例如: "\\.\pipe\myvbox" 或 "/tmp/myvbox", 对应 Windows 与 类UNIX 系统.</p><p>在 <b>主机设备</b> 模式: 显示主机串口设备名称. 例如: "COM1" 或 "/dev/ttyS0".</p><p>在 <b>裸文件</b> 模式: 显示主机中的串口输出存储文件的路径.</p><p>在 <b>TCP</b> 模式: 显示 TCP "端口" (服务器), 或 "主机名:端口" (客户端).</translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerialPage</name>
@@ -4683,11 +5246,11 @@
     </message>
     <message>
         <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>添加&nbsp;虚拟&nbsp;光驱</nobr></translation>
+        <translation type="obsolete"><nobr>添加&nbsp;虚拟&nbsp;光驱</nobr></translation>
     </message>
     <message>
         <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>添加&nbsp;虚拟&nbsp;软驱</nobr></translation>
+        <translation type="obsolete"><nobr>添加&nbsp;虚拟&nbsp;软驱</nobr></translation>
     </message>
     <message>
         <source><i>%1</i> uses a medium that is already attached to <i>%2</i>.</source>
@@ -4727,11 +5290,11 @@
     </message>
     <message>
         <source>Add CD/DVD Device</source>
-        <translation>添加虚拟光驱</translation>
+        <translation type="obsolete">添加虚拟光驱</translation>
     </message>
     <message>
         <source>Add Floppy Device</source>
-        <translation>添加虚拟软驱</translation>
+        <translation type="obsolete">添加虚拟软驱</translation>
     </message>
     <message>
         <source>Remove Attachment</source>
@@ -4883,15 +5446,15 @@
     </message>
     <message>
         <source>CD/DVD &Drive:</source>
-        <translation>分配光驱(&D):</translation>
+        <translation type="obsolete">分配光驱(&D):</translation>
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>选择用于虚拟驱动器的虚拟光盘或物理光驱。虚拟机将会看到插入的光盘上的数据。</translation>
+        <translation type="obsolete">选择用于虚拟驱动器的虚拟光盘或物理光驱。虚拟机将会看到插入的光盘上的数据。</translation>
     </message>
     <message>
         <source>Set up the virtual CD/DVD drive</source>
-        <translation>设置虚拟光盘</translation>
+        <translation type="obsolete">设置虚拟光盘</translation>
     </message>
     <message>
         <source>Floppy &Drive:</source>
@@ -4915,7 +5478,7 @@
     </message>
     <message>
         <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>选择一个虚拟光盘...</translation>
+        <translation type="obsolete">选择一个虚拟光盘...</translation>
     </message>
     <message>
         <source>Remove disk from virtual drive</source>
@@ -5006,6 +5569,54 @@
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
         <translation>您当前使用的存储控制器比 %1 芯片组支持的多。请在系统设置页面更改芯片组类型,或在存储设置页面减少以下存储控制器的数量: %2</translation>
     </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation>添加USB控制器</translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation>选中时,虚拟机系统会将虚拟磁盘视为热插拔设备。</translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>热插拔(&H)</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>选择一个虚拟光盘文件...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>添加&nbsp;虚拟&nbsp;光驱</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>添加&nbsp;虚拟&nbsp;软驱</nobr></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>添加虚拟光驱</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>添加虚拟软驱</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>分配光驱(&D):</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>选择用于虚拟驱动器的虚拟光盘或物理光驱。虚拟机将会看到插入的光盘上的数据。</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>设置虚拟光盘</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMachineSettingsSystem</name>
@@ -5104,7 +5715,7 @@
     </message>
     <message>
         <source>When checked, the Physical Address Extension (PAE) feature of the host CPU will be exposed to the virtual machine.</source>
-        <translation>选中,电脑上的物理地址扩展(PAE)特性将会传递给虚拟电脑.</translation>
+        <translation>选中,电脑上的物理地址扩展(PAE)特性将会传递给虚拟电脑.</translation>
     </message>
     <message>
         <source>Enable PA&E/NX</source>
@@ -5226,15 +5837,6 @@
         <translation>您已将当前电脑总内存 (<b>%2</b>) 中超过 <b>%1%</b> 的部分分配给了当前的虚拟电脑。这会导致主控系统上没有足够的内存来保证正常运行。因此请选择一个更小的数目。</translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translatorcomment>TODO</translatorcomment>
-        <translation>您已为该虚拟机分配了 ICH9 芯片组类型。只有同时启用 IO-APIC 功能,才能正常工作。这将在您按“确定”按钮访问虚拟机设置时自动完成。</translation>
-    </message>
-    <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>USB配置页中USB控制器模拟未启用。 模拟USB输入设备时需要启用。 确认更改时将自动启用。</translation>
-    </message>
-    <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation>为了获得更好的性能,分配给虚拟电脑的虚拟处理器的数量不应超过电脑上实际的处理器数量 (<b>%1</b>) 的两倍,因此请减少为该虚拟电脑所分配的虚拟处理器的数量。</translation>
     </message>
@@ -5243,16 +5845,32 @@
         <translation>您为该虚拟电脑分配的虚拟CPU数量已超过电脑上实际CPU数量 (<b>%1</b>),这会降低该虚拟电脑的运行速度,因此请考虑减少为该虚拟电脑分配的虚拟CPU数量。</translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation>您已将处理器运行峰值设置为低值。这可能会使虚拟机感觉响应很慢。</translation>
+    </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation>半虚拟化接口(&P):</translation>
+    </message>
+    <message>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>选择虚拟电脑要采用的半虚拟化接口。</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
         <translation>您已为该虚拟机分配了 ICH9 芯片组类型。只有同时启用 IO-APIC 功能,才能正常工作。这将在您按“确定”按钮访问虚拟机设置时自动完成。</translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>尚未启用硬件虚拟。支持多个虚拟处理器时需要启用。当你按确认按钮接受虚拟机设定的时此选项将被启用。</translation>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>USB配置页中USB控制器模拟未启用。 模拟USB输入设备时需要启用。 确认更改时将自动启用。</translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>您已将处理器运行峰值设置为低值。这可能会使虚拟机感觉响应很慢。</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>您已为该虚拟机分配了 ICH9 芯片组类型。只有同时启用 IO-APIC 功能,才能正常工作。这将在您按“确定”按钮访问虚拟机设置时自动完成。</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>尚未启用硬件虚拟。支持多个虚拟处理器时需要启用。当你按确认按钮接受虚拟机设定的时此选项将被启用。</translation>
     </message>
 </context>
 <context>
@@ -5320,11 +5938,11 @@
     </message>
     <message>
         <source>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</source>
-        <translation>选中,在该虚拟电脑上启用 USB EHCI 控制器。该控制器将提供 USB 2.0支持.</translation>
+        <translation>选中时,在该虚拟电脑上启用 USB EHCI 控制器。该控制器将提供 USB 2.0支持.</translation>
     </message>
     <message>
         <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>启用 USB 2.0 (E&HCI) 控制器</translation>
+        <translation type="obsolete">启用 USB 2.0 (E&HCI) 控制器</translation>
     </message>
     <message>
         <source>USB Device &Filters</source>
@@ -5384,8 +6002,28 @@
         <translation type="obsolete">本虚拟机当前已启用 USB 2.0。然而,这需要安装 <b>%1</b>。请从 VirtualBox 下载站中安装“扩展增强包”。安装之后您将可以重新启用 USB 2.0。在此期间,除非您取消当前设置更改,否则将禁用此功能。</translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>本虚拟机当前已启用 USB 2.0。然而,这需要安装 <b>%1</b>。请从 VirtualBox 下载站中安装“扩展增强包”。或者禁用 USB 2.0 以便启动虚拟电脑。</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation>选中时,在该虚拟电脑上启用 USB OHCI 控制器。该控制器将提供 USB 1.0支持.</translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>USB &1.1 (OHCI) 控制器</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>USB &2.0 (EHCI) 控制器</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>选中时,在该虚拟电脑上启用 USB xHCI 控制器。该控制器将提供 USB 3.0支持.</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>USB &3.0 (xHCI) 控制器</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>本虚拟机当前已启用 USB 2.0/3.0。然而,这需要安装 <i>%1</i>。请从 VirtualBox 下载站中安装“扩展增强包”。或者禁用 USB 2.0/3.0 以便启动虚拟电脑。</translation>
     </message>
 </context>
 <context>
@@ -5524,7 +6162,11 @@
     </message>
     <message>
         <source>C&lose</source>
-        <translation>退出(&L)</translation>
+        <translation type="obsolete">退出(&L)</translation>
+    </message>
+    <message>
+        <source>Removing medium...</source>
+        <translation>移除介质...</translation>
     </message>
 </context>
 <context>
@@ -5543,6 +6185,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>虚拟显示屏改变大小</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>虚拟显示屏映射</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>关闭</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>切换</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>启用菜单栏</translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -5584,7 +6249,7 @@
     </message>
     <message>
         <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>创建 COM 对象失败.</p><p>应用程序将被中断.</p></translation>
+        <translation type="obsolete"><p>创建 COM 对象失败.</p><p>应用程序将被中断.</p></translation>
     </message>
     <message>
         <source>Failed to set global VirtualBox properties.</source>
@@ -5827,10 +6492,9 @@
         <translation type="obsolete">下载</translation>
     </message>
     <message>
-        <source>Insert</source>
+        <source>Mount</source>
         <comment>additions</comment>
-        <translatorcomment>TODO</translatorcomment>
-        <translation>载入</translation>
+        <translation type="obsolete">分配</translation>
     </message>
     <message>
         <source><p>The host key is currently defined as <b>%1</b>.</p></source>
@@ -5949,8 +6613,8 @@
         <translation type="obsolete">显示产品信息的对话框</translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>VirtualBox 新版本已发布!版本 <b>%1</b> 可在此了解 <a href="https://www.virtualbox.org/">virtualbox.org</a>。</p><p>您可以使用此链接下载该版本:</p><p><a href=%2>%3</a></p></translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>VirtualBox 新版本已发布!版本 <b>%1</b> 可在此了解 <a href="http://www.virtualbox.org/">virtualbox.org</a>。</p><p>您可以使用此链接下载该版本:</p><p><a href=%2>%3</a></p></translation>
     </message>
     <message>
         <source><p>Are you sure you want to release the %1 <nobr><b>%2</b></nobr>?</p><p>This will detach it from the following virtual machine(s): <b>%3</b>.</p></source>
@@ -6026,11 +6690,11 @@
     </message>
     <message>
         <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>有一个或多个虚拟硬盘、光盘或软盘当前无法访问.。因此,你可能无法打开那些要使用这些介质的虚拟电脑直到它可以再次访问为止.</p><p>按 <b>检测</b> 打开虚拟介质管理器可以查看那些无法访问的介质,或按 <b>忽略</b> 忽略这个提示.</p></translation>
+        <translation type="obsolete"><p>有一个或多个虚拟硬盘、光盘或软盘当前无法访问.。因此,你可能无法打开那些要使用这些介质的虚拟电脑直到它可以再次访问为止.</p><p>按 <b>检测</b> 打开虚拟介质管理器可以查看那些无法访问的介质,或按 <b>忽略</b> 忽略这个提示.</p></translation>
     </message>
     <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>虚拟电脑在运行中发生一个严重错误,现在将被关闭.</p><p>请联系您的供应商. 并提供日志文件 <tt>VBox.log</tt> 和映像文件 <tt>VBox.png</tt>, 它们位于 <nobr><b>%1</b></nobr> 文件夹, 同时就该错误是如何发生的提供一份详细说明. </p><p>按<b>确定</b> 如果您想关闭该虚拟电脑,或者按 <b>忽略</b> 如果您想调试它. 请注意调试需要专业的知识和工具, 因此建议您按 <b>确定</b> .</p></translation>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>虚拟电脑在运行中发生一个严重错误,现在将被关闭.</p><p>请联系您的供应商. 并提供日志文件 <tt>VBox.log</tt> 和映像文件 <tt>VBox.png</tt>, 它们位于 <nobr><b>%1</b></nobr> 文件夹, 同时就该错误是如何发生的提供一份详细说明. </p><p>按<b>确定</b> 如果您想关闭该虚拟电脑,或者按 <b>忽略</b> 如果您想调试它. 请注意调试需要专业的知识和工具, 因此建议您按 <b>确定</b> .</p></translation>
     </message>
     <message>
         <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
@@ -6212,7 +6876,7 @@
     </message>
     <message>
         <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>您确定要删除光驱?</p><p>您将无法使用任何光盘或虚拟光盘以及存放增强功能包的虚拟光盘!</p></translation>
+        <translation type="obsolete"><p>您确定要删除光驱?</p><p>您将无法使用任何光盘或虚拟光盘以及存放增强功能包的虚拟光盘!</p></translation>
     </message>
     <message>
         <source>&Remove</source>
@@ -6316,7 +6980,7 @@
     </message>
     <message>
         <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>您将要添加新光驱到控制器 <b>%1</b>。</p><p>您是否要选择一个虚拟光盘来放入驱动器,或将其现在留空?</p></translation>
+        <translation type="obsolete"><p>您将要添加新光驱到控制器 <b>%1</b>。</p><p>您是否要选择一个虚拟光盘来放入驱动器,或将其现在留空?</p></translation>
     </message>
     <message>
         <source>&Choose disk</source>
@@ -6338,11 +7002,11 @@
     </message>
     <message>
         <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 分离光驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
+        <translation type="obsolete">从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 分离光驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
     </message>
     <message>
         <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 分离软驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
+        <translation type="obsolete">从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 分离软驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
     </message>
     <message numerus="yes">
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
@@ -6381,20 +7045,19 @@
     </message>
     <message>
         <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 附加光驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
+        <translation type="obsolete">从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 附加光驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
     </message>
     <message>
         <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 附加软驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
+        <translation type="obsolete">从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 附加软驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
     </message>
     <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>注意,将不会删除该介质的存储文件,它可以在以后重新使用。</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translatorcomment>TODO</translatorcomment>
-        <translation><p>VirtualBox功能增强包似乎在该虚拟机中不可用,没有它们,共享文件夹将无法使用。要在虚拟机内部使用共享文件夹,未安装功能增强包的话请安装,如果已安装而无法正常工作,请重新安装,要安装请从<b>设备</b>菜单中选择<b>安装功能增强</b>。如果已安装而虚拟机尚未完全启动,那么一旦启动完毕,共享文件夹将变为可用。</p></translation>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Install Guest Additions</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully started then s [...]
+        <translation type="obsolete"><p>VirtualBox功能增强包似乎在该虚拟机中不可用,没有它们,共享文件夹将无法使用。要在虚拟机内部使用共享文件夹,未安装功能增强包的话请安装,如果已安装而无法正常工作,请重新安装,要安装请从<b>设备</b>菜单中选择<b>安装功能增强</b>。如果已安装而虚拟机尚未完全启动,那么一旦启动完毕,共享文件夹将变为可用。</p></translation>
     </message>
     <message>
         <source><p>The virtual machine window will be now switched to <b>fullscreen</b> mode. You can go back to windowed mode at any time by pressing <b>%1</b>.</p><p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p><p>Note that the main menu bar is hidden in fullscreen mode. You can access it by pressing <b>Host+Home</b>.</p></source>
@@ -6496,7 +7159,7 @@
     </message>
     <message>
         <source>Create a snapshot of the current machine state</source>
-        <translation>创建当前虚拟机状态的备份(系统快照)</translation>
+        <translation>创建当前虚拟机状态的备份[系统快照]</translation>
     </message>
     <message>
         <source><p>Are you sure you want to restore snapshot <b>%1</b>?</p></source>
@@ -6636,7 +7299,7 @@
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>未能丢弃数据。</translation>
+        <translation type="obsolete">未能丢弃数据。</translation>
     </message>
     <message>
         <source><p>Could not find the VirtualBox Guest Additions disk image file file.</nobr></p><p>Do you wish to download this disk image file from the Internet?</p></source>
@@ -6785,7 +7448,6 @@
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
-        <translatorcomment>TODO</translatorcomment>
         <translation><p>您是否要强制挂载该介质?</p></translation>
     </message>
     <message>
@@ -6832,7 +7494,7 @@
         <source><p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p><p>If you continue the runtime state of the exported machine(s) will be discarded. The other machine(s) will not be changed.</p></source>
         <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).</comment>
         <translation>
-            <numerusform><p>下面%n虚拟机 <b>%1</b> 当前处于保存状态。</p><p>如果您继续,将放弃已导出虚拟机的运行时状态。注意,现有的虚拟机不会更改。</p></numerusform>
+            <numerusform><p>虚拟机 <b>%1</b> 当前处于保存状态。</p><p>如果您继续,将放弃已导出虚拟机的运行时状态。注意,现有的虚拟机不会更改。</p></numerusform>
         </translation>
     </message>
     <message>
@@ -6872,14 +7534,6 @@
         <translation><p>VirtualBox 用户手册已成功从 <nobr><a href="%1">%1</a></nobr> 下载,但未能在本地保存为 <nobr><b>%2</b></nobr>。</p><p>请为文件选择另一个位置。</p></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>增强功能包虚拟光盘已从 <nobr><a href="%1">%1</a></nobr>成功下载并保存在 <nobr><b>%2</b>.</nobr></p><p>您是否要注册该虚拟光盘并把它立即挂载到该虚拟电脑上?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>无法分配存放增强功能包的虚拟光盘到虚拟电脑 <b>%1</b>, 因为该虚拟电脑没有光驱. 请先到虚拟电脑设置对话框的存储页中添加一个光驱.</p></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation><p>无法找到 VirtualBox 用户手册 <nobr><b>%1</b></nobr>。</p><p>您是否要从网上下载该文件?</p></translation>
     </message>
@@ -6912,16 +7566,6 @@
         <translation><p>是否删除NAT网络 <nobr><b>%1</b>?</nobr></p><p>相关的网卡需要重新设置才可使用。</p></translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <comment>new</comment>
-        <translation type="obsolete"><p>VirtualBox功能增强包似乎在该虚拟机中不可用,没有它们,共享文件夹将无法使用。要在虚拟机内部使用共享文件夹,未安装功能增强包的话请安装,如果已安装而无法正常工作,请重新安装,要安装请从<b>设备</b>菜单中选择<b>安装功能增强</b>。如果已安装而虚拟机尚未完全启动,那么一旦启动完毕,共享文件夹将变为可用。</p></translation>
-    </message>
-    <message>
-        <source>Insert</source>
-        <comment>additions-new</comment>
-        <translation type="obsolete">分配</translation>
-    </message>
-    <message>
         <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
         <translation>不能分配摄像头 <b>%1</b> 到虚拟电脑 <b>%2</b>.</translation>
     </message>
@@ -6930,9 +7574,144 @@
         <translation>不能将 摄像头 <b>%1</b> 从虚拟电脑 <b>%2</b> 中释放.</translation>
     </message>
     <message>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation><p>VirtualBox功能增强包似乎在该虚拟机中不可用,没有它们,共享文件夹将无法使用。要在虚拟机内部使用共享文件夹,未安装功能增强包的话请安装,如果已安装而无法正常工作,请重新安装,要安装请从<b>设备</b>菜单中选择<b>安装功能增强</b>。如果已安装而虚拟机尚未完全启动,那么一旦启动完毕,共享文件夹将变为可用。</p></translation>
+    </message>
+    <message>
+        <source>Insert</source>
+        <comment>additions</comment>
+        <translation>载入</translation>
+    </message>
+    <message>
         <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
         <translation><p>虚拟显示屏目前设置为 <b>%1&nbsp;位</b>颜色模式。 需要更好显示效果请切换至 <b>%2&nbsp;位</b>。 通常可在虚拟电脑中操作系统的控制面板或系统设置的 <b>显示</b> 部分设定。</p></translation>
     </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation>当前端口转发规则无效。规则名称应唯一。</translation>
+    </message>
+    <message>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation>当前端口转发规则无效。一些规则用相同的主机端口且IP地址冲突。</translation>
+    </message>
+    <message>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>创建 VirtualBoxClient COM 对象失败.</p><p>应用程序将被中断.</p></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translatorcomment>todo</translatorcomment>
+        <translation>为全局 VirtualBox 外部数据中的键 <i>%1</i> 赋值 <i>{%2}</i> 失败.</translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation>为虚拟电脑 <i>%2</i> 外部数据中的键 <i>%1</i> 赋值 <i>{%2}</i> 失败.</translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>有一个或多个虚拟硬盘、光盘或软盘当前无法访问.。因此,你可能无法打开那些要使用这些介质的虚拟电脑直到它可以再次访问为止.</p><p>按 <b>检测</b> 打开虚拟介质管理器可以查看那些无法访问的介质,或按 <b>忽略</b> 忽略这个提示.</p></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation>保存设置失败.</translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p>您将要添加新光驱到控制器 <b>%1</b>。</p><p>您是否要选择一个虚拟光盘来放入驱动器,或将其现在留空?</p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>您确定要删除光驱?</p><p>您将无法使用任何光盘或虚拟光盘以及存放增强功能包的虚拟光盘!</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 附加光驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 附加软驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 分离光驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>从虚拟机 <b>%3</b> 的插槽 <i>%2</i> 分离软驱 (<nobr><b>%1</b></nobr>) 失败。</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this er [...]
+        <translation type="obsolete"><p>运行虚拟电脑时发生严重错误, 应将其关闭.</p><p>要获取帮助, 请查看社区内容 <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> 或咨询你的支持部门. 请提供日志文件 <tt>VBox.log</tt>, 位于虚拟电脑的log文件夹中, 并描述出错时的操作. 注意: 也可从管理器的主菜单 <b>控制</b> 中选择 <b>日志</b>.</p><p>点击 <b>确定</b> 关闭虚拟电脑.</p></translation>
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">为虚拟电脑 <b>%1</b> 连接网线失败.</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">为虚拟电脑 <b>%1</b> 断开网线失败.</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation><p>无法分配存放增强功能包的虚拟光盘到虚拟电脑 <b>%1</b>, 因为该虚拟电脑没有光驱. 请先到虚拟电脑设置对话框的存储页中添加一个光驱.</p></translation>
+    </message>
+    <message>
+        <source>Unable to enter password!</source>
+        <translation type="obsolete">未能输入密码!</translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p>增强功能包虚拟光盘已从 <nobr><a href="%1">%1</a></nobr>成功下载并保存在 <nobr><b>%2</b>.</nobr></p><p>您是否要注册该虚拟光盘并把它立即挂载到该虚拟电脑上?</p></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation failed.</source>
+        <translation type="obsolete">拖放操作失败。</translation>
+    </message>
+    <message>
+        <source>Failed while dropping data.</source>
+        <translation type="obsolete">拖放数据失败。</translation>
+    </message>
+    <message>
+        <source>Unable to cancel drag and drop operation.</source>
+        <translation type="obsolete">未能取消拖放操作。</translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation>密码错误或验证失败。</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translatorcomment>todo</translatorcomment>
+        <translation><p>运行虚拟电脑时发生严重错误, 应将其关闭.</p><p>要获取帮助, 请查看社区内容 <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> 或咨询你的支持部门. 请提供日志文件 <tt>VBox.log</tt>和图像文件 <tt>VBox.png</tt>, 位于 <nobr><b>%1</b></nobr> 文件夹中, 并描述出错时的操作. 注意: 也可从管理器的主菜单 <b>控制</b> 中选择 <b>日志</b>.</p><p>点击 <b>确定</b> 关闭虚拟电脑.如果你想调试它. 请注意调试需要专业的知识和工具, 因此建议你按 <b>确定</b> .</p&gt [...]
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation><p>运行虚拟电脑时发生严重错误, 应将其关闭.</p><p>要获取帮助, 请查看社区内容 <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> 或咨询你的支持部门. 请提供日志文件 <tt>VBox.log</tt>, 位于虚拟电脑的log文件夹中, 并描述出错时的操作. 注意: 也可从管理器的主菜单 <b>控制</b> 中选择 <b>日志</b>.</p><p>点击 <b>确定</b> 关闭虚拟电脑.</p></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation><p>VirtualBox 新版本已发布!版本 <b>%1</b> 可在此了解 <a href="http://www.virtualbox.org/">virtualbox.org</a>。</p><p>您可以使用此链接下载该版本:</p><p><a href=%2>%3</a></p></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UIMiniProcessWidgetUserManual</name>
@@ -7004,7 +7783,7 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
+        <source>N&ame:</source>
         <translation>名称(&N):</translation>
     </message>
     <message>
@@ -7543,14 +8322,18 @@
         <translation>虚拟电脑 (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>欢迎使用虚拟电脑控制台!</h3><p>窗口的左边用来显示已生成的虚拟电脑. 现在是空的,因为你还没有新建任何虚拟电脑.<img src=:/welcome.png align=right/></p><p>要新建一个虚拟电脑, 请按位于窗口顶部工具栏上的 <b>新建</b> 按钮。</p><p>你可以按  <b>%1</b> 键来查看帮助,或访问 <a href=https://www.virtualbox.org>www.virtualbox.org</a> 查看最新信息和新闻.</p></translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>欢迎使用虚拟电脑控制台!</h3><p>窗口的左边用来显示已生成的虚拟电脑. 现在是空的,因为你还没有新建任何虚拟电脑.<img src=:/welcome.png align=right/></p><p>要新建一个虚拟电脑, 请按位于窗口顶部工具栏上的 <b>新建</b> 按钮。</p><p>你可以按  <b>%1</b> 键来查看帮助,或访问 <a href=http://www.virtualbox.org>www.virtualbox.org</a> 查看最新信息和新闻.</p></translation>
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>管理器</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation><h3>欢迎使用虚拟电脑控制台!</h3><p>窗口的左边用来显示已生成的虚拟电脑. 现在是空的,因为你还没有新建任何虚拟电脑.<img src=:/welcome.png align=right/></p><p>要新建一个虚拟电脑, 请按位于窗口顶部工具栏上的 <b>新建</b> 按钮。</p><p>你可以按  <b>%1</b> 键来查看帮助,或访问 <a href=http://www.virtualbox.org>www.virtualbox.org</a> 查看最新信息和新闻.</p></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -7583,7 +8366,7 @@
     </message>
     <message>
         <source>Settings</source>
-        <translation>设置</translation>
+        <translation type="obsolete">设置</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -7636,6 +8419,10 @@
         <source>Display</source>
         <translation>显示</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation>全局设定</translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -7687,6 +8474,43 @@
         <source>%1 - %2</source>
         <translation>%1 - %2</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation>用户界面</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation>设置</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>载入设置...</translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation>保存设置...</translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation><nobr><b>点击</b> 切换状态.</nobr><br><nobr><b>拖放</b> 更改位置.</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation>关闭</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation>显示状态栏</translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -7811,6 +8635,14 @@
         <source>&Restore current snapshot '%1'</source>
         <translation>恢复到当前备份(&R) '%1'</translation>
     </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>继续在后台运行(&C)</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><p>关闭虚拟电脑窗口但保持其运行.</p><p>你可用管理器返回窗口状态.</p></translation>
+    </message>
 </context>
 <context>
     <name>UIVMDesktop</name>
@@ -7820,11 +8652,124 @@
     </message>
     <message>
         <source>&Snapshots</source>
-        <translatorcomment>Fix</translatorcomment>
         <translation>备份[系统快照](&S)</translation>
     </message>
 </context>
 <context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - 的运行状态</translation>
+    </message>
+    <message>
+        <source>&Details</source>
+        <translation type="obsolete">配置明细(&D)</translation>
+    </message>
+    <message>
+        <source>&Runtime</source>
+        <translation type="obsolete">当前状态(&R)</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA 传输</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO 传输</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>读数据</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>写数据</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>数据传输</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>数据接收</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>硬件特征</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>显示设置</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>未检测到</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>未检测到</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>增强功能</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>虚拟电脑操作系统类型</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>没有网络连接</translation>
+    </message>
+    <message>
+        <source>UIVMInfoDialog</source>
+        <translation type="obsolete">虚拟电脑信息</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>存储介质</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>未分配存储介质</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>网络连接</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>不可用</translation>
+    </message>
+    <message>
+        <source>Clipboard Mode</source>
+        <translation>剪贴板模式</translation>
+    </message>
+    <message>
+        <source>Drag'n'Drop Mode</source>
+        <translation type="obsolete">拖放模式</translation>
+    </message>
+    <message>
+        <source>Configuration &Details</source>
+        <translation>配置详情(&D)</translation>
+    </message>
+    <message>
+        <source>&Runtime Information</source>
+        <translation>运行状态(&R)</translation>
+    </message>
+    <message>
+        <source>VM Uptime</source>
+        <translation>运行时间</translation>
+    </message>
+    <message>
+        <source>Drag and Drop Mode</source>
+        <translation>拖放模式</translation>
+    </message>
+</context>
+<context>
     <name>UIVMListView</name>
     <message>
         <source>Inaccessible</source>
@@ -7943,11 +8888,27 @@
     <name>UIWizard</name>
     <message>
         <source>Hide Description</source>
-        <translation>隐藏描述</translation>
+        <translation type="obsolete">隐藏描述</translation>
     </message>
     <message>
         <source>Show Description</source>
-        <translation>显示描述</translation>
+        <translation type="obsolete">显示描述</translation>
+    </message>
+    <message>
+        <source>&Expert Mode</source>
+        <translation>专家模式(&E)</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation>切换到 <nobr><b>专家模式</b></nobr>, 适合有经验用户的单页对话框.</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>向导模式(&G)</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation>切换到 <nobr><b>向导模式</b></nobr>, 带详细提示的逐步对话框.</translation>
     </message>
 </context>
 <context>
@@ -8626,8 +9587,8 @@
         <translation><恢复为默认值></translation>
     </message>
     <message>
-        <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <translation>当保存变化后再打开本对话框时,将显示新的默认路径.</translation>
+        <source>The actual default path value will be displayed after accepting the changes and opening this dialog again.</source>
+        <translation type="obsolete">当保存变化后再打开本对话框时,新的默认路径将被显示.</translation>
     </message>
     <message>
         <source><not selected></source>
@@ -8675,8 +9636,7 @@
     </message>
     <message>
         <source>The actual default path value will be displayed after accepting the changes and opening this window again.</source>
-        <comment>new</comment>
-        <translation type="obsolete">当保存变化后再打开本对话框时,新的默认路径将被显示.</translation>
+        <translation>当保存变化后再打开本对话框时,将显示新的默认路径.</translation>
     </message>
 </context>
 <context>
@@ -8864,7 +9824,7 @@
     <message>
         <source>CD/DVD</source>
         <comment>DeviceType</comment>
-        <translation>光驱</translation>
+        <translation type="obsolete">光驱</translation>
     </message>
     <message>
         <source>Hard Disk</source>
@@ -9556,18 +10516,18 @@
     <message>
         <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
         <comment>medium</comment>
-        <translation>分配此硬盘将间接使用最近创建的备份硬盘。</translation>
+        <translation type="obsolete">分配此硬盘将间接使用最近创建的备份硬盘。</translation>
     </message>
     <message>
         <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
         <comment>medium</comment>
-        <translation>该硬盘链中的某些介质不可访问。请使用<b>显示备份硬盘</b>模式中的“虚拟机介质管理器”来检查这些介质。</translation>
+        <translation type="obsolete">该硬盘链中的某些介质不可访问。请使用<b>显示备份硬盘</b>模式中的“虚拟机介质管理器”来检查这些介质。</translation>
     </message>
     <message>
         <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
         <comment>medium</comment>
         <translatorcomment>TODO</translatorcomment>
-        <translation>该基本硬盘是使用以下备份硬盘间接分配的:</translation>
+        <translation type="obsolete">该基本硬盘是使用以下备份硬盘间接分配的:</translation>
     </message>
     <message numerus="yes">
         <source>%n year(s)</source>
@@ -9607,7 +10567,7 @@
     </message>
     <message>
         <source>(CD/DVD)</source>
-        <translation>(光驱)</translation>
+        <translation type="obsolete">(光驱)</translation>
     </message>
     <message>
         <source>Screens</source>
@@ -10152,16 +11112,6 @@
         <translation>请选择虚拟硬盘文件保存的位置</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>已启用</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>已禁用</translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translation>不受限执行</translation>
@@ -10209,6 +11159,157 @@
         <source>You can create or add disk image files in the virtual machine settings.</source>
         <translation>您也可以通过虚拟介质管理器来创建或添加虚拟介质.</translation>
     </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>USB 端口 %1</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>关闭</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation>半虚拟化接口</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>空</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>默认</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>旧的</translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>最少</translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation>新建动态分配存储</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>活动</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>不活动</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>活动</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>不活动</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>活动</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>不活动</translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>生成备份</translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translatorcomment>todo</translatorcomment>
+        <translation>正在生成当前运行状态的备份</translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation>KVM</translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translatorcomment>todo</translatorcomment>
+        <translation>光驱</translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>OHCI</translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>EHCI</translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>xHCI</translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation>用户界面</translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation>(光驱)</translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>分配此硬盘将间接使用最近创建的备份硬盘。</translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation>该硬盘链中的某些介质不可访问。请使用“虚拟机介质管理器”来检查这些介质。</translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>该基本硬盘是使用以下备份硬盘间接分配的:</translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxGlobalSettings</name>
@@ -10454,6 +11555,18 @@
         <source>Create a new virtual hard drive</source>
         <translation type="obsolete">创建一个新的虚拟硬盘</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation>UUID:</translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxMiniToolBar</name>
@@ -10497,15 +11610,15 @@
     <name>VBoxScreenshotViewer</name>
     <message>
         <source>Screenshot of %1 (%2)</source>
-        <translation>屏幕快照 %1 (%2)</translation>
+        <translation>屏幕截图 %1 (%2)</translation>
     </message>
     <message>
         <source>Click to view non-scaled screenshot.</source>
-        <translation>单击查看未缩放的快照。</translation>
+        <translation>单击查看未缩放的屏幕截图。</translation>
     </message>
     <message>
         <source>Click to view scaled screenshot.</source>
-        <translation>单击查看缩放的快照。</translation>
+        <translation>单击查看缩放的屏幕截图。</translation>
     </message>
 </context>
 <context>
@@ -10536,8 +11649,8 @@
         <translation type="obsolete">将正在运行的虚拟电脑暂停</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation type="obsolete"><h3>欢迎使用虚拟电脑控制台!</h3><p>窗口的左边用来显示已生成的虚拟电脑. 现在是空的,因为你还没有新建任何虚拟电脑.<img src=:/welcome.png align=right/></p><p>要新建一个虚拟电脑, 请按位于窗口顶部工具栏上的 <b>新建</b> 按钮。</p><p>你可以按  <b>%1</b> 键来查看帮助,或访问 <a href=https://www.virtualbox.org>www.virtualbox.org</a> 查看最新信息和新闻.</p></translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>欢迎使用虚拟电脑控制台!</h3><p>窗口的左边用来显示已生成的虚拟电脑. 现在是空的,因为你还没有新建任何虚拟电脑.<img src=:/welcome.png align=right/></p><p>要新建一个虚拟电脑, 请按位于窗口顶部工具栏上的 <b>新建</b> 按钮。</p><p>你可以按  <b>%1</b> 键来查看帮助,或访问 <a href=http://www.virtualbox.org>www.virtualbox.org</a> 查看最新信息和新闻.</p></translation>
     </message>
     <message>
         <source>Log</source>
@@ -10922,113 +12035,6 @@
     </message>
 </context>
 <context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - 的运行状态</translation>
-    </message>
-    <message>
-        <source>&Details</source>
-        <translation type="obsolete">配置明细(&D)</translation>
-    </message>
-    <message>
-        <source>&Runtime</source>
-        <translation type="obsolete">当前状态(&R)</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA 传输</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO 传输</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>读数据</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>写数据</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>数据传输</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>数据接收</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>硬件特征</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>显示设置</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>未检测到</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>未检测到</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>增强功能</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>虚拟电脑操作系统类型</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>没有网络连接</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>虚拟电脑信息</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>存储介质</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>未分配存储介质</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>网络连接</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>不可用</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>剪贴板模式</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>拖放模式</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translatorcomment>TODO</translatorcomment>
-        <translation>配置(&D)</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>明细(&R)</translation>
-    </message>
-</context>
-<context>
     <name>VBoxVMLogViewer</name>
     <message>
         <source>Log Viewer</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_TW.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_TW.ts
index 0f05d47..ab66d18 100644
--- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_TW.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_zh_TW.ts
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
-<TS version="2.0" language="zh_TW">
+<TS version="2.0" language="zh_TW" sourcelanguage="en">
 <context>
     <name>@@@</name>
     <message>
@@ -171,26 +171,6 @@
         <translation>調整視窗大小與位置以最適合客體顯示</translation>
     </message>
     <message>
-        <source>Disable &Mouse Integration</source>
-        <translation>停用滑鼠整合(&M)</translation>
-    </message>
-    <message>
-        <source>Temporarily disable host mouse pointer integration</source>
-        <translation>暫時停用主機滑鼠指標整合</translation>
-    </message>
-    <message>
-        <source>&Insert Ctrl-Alt-Del</source>
-        <translation>傳送 Ctrl-Alt-Del 鍵(&I)</translation>
-    </message>
-    <message>
-        <source>Send the Ctrl-Alt-Del sequence to the virtual machine</source>
-        <translation>傳送 Ctrl-Alt-Del 序列到虛擬機器</translation>
-    </message>
-    <message>
-        <source>Send the Ctrl-Alt-Backspace sequence to the virtual machine</source>
-        <translation>傳送 Ctrl-Alt-Backspace 序列到虛擬機器</translation>
-    </message>
-    <message>
         <source>Take a snapshot of the virtual machine</source>
         <translation>取得虛擬機器的快照</translation>
     </message>
@@ -235,18 +215,6 @@
         <translation>裝置(&D)</translation>
     </message>
     <message>
-        <source>&CD/DVD Devices</source>
-        <translation>CD/DVD 裝置(&C)</translation>
-    </message>
-    <message>
-        <source>&Floppy Devices</source>
-        <translation>軟碟裝置(&F)</translation>
-    </message>
-    <message>
-        <source>&USB Devices</source>
-        <translation>USB 裝置(&U)</translation>
-    </message>
-    <message>
         <source>Change the settings of network adapters</source>
         <translation>變更網路卡的設定值</translation>
     </message>
@@ -285,26 +253,10 @@
         <translation>顯示應用程式圖示</translation>
     </message>
     <message>
-        <source>Switch to &Fullscreen</source>
-        <translation>切換為全螢幕(&F)</translation>
-    </message>
-    <message>
-        <source>Switch between normal and fullscreen mode</source>
-        <translation>在標準和全螢幕模式之間切換</translation>
-    </message>
-    <message>
-        <source>Switch to Seam&less Mode</source>
-        <translation>切換為無縫模式(&L)</translation>
-    </message>
-    <message>
         <source>Switch between normal and seamless desktop integration mode</source>
         <translation>在標準和無縫桌面整合模式之間切換</translation>
     </message>
     <message>
-        <source>Switch to &Scaled Mode</source>
-        <translation>切換為縮放模式(&S)</translation>
-    </message>
-    <message>
         <source>Switch between normal and scaled mode</source>
         <translation>在標準和縮放模式之間切換</translation>
     </message>
@@ -373,10 +325,6 @@
         <translation>取得虛擬機器的快照</translation>
     </message>
     <message>
-        <source>Ins&ert Ctrl-Alt-Backspace</source>
-        <translation>傳送 Ctrl-Alt-Backspace 鍵(&E)</translation>
-    </message>
-    <message>
         <source>&File</source>
         <comment>Mac OS X version</comment>
         <translation>檔案(&F)</translation>
@@ -640,10 +588,6 @@
         <translation>共用剪貼簿(&C)</translation>
     </message>
     <message>
-        <source>Drag'n'Drop</source>
-        <translation>拖放</translation>
-    </message>
-    <message>
         <source>Save the machine state of the virtual machine</source>
         <translation>啟用虛擬機器的機器狀態</translation>
     </message>
@@ -684,33 +628,254 @@
         <translation>組態視訊擷取設定</translation>
     </message>
     <message>
-        <source>&Logging...</source>
-        <comment>debug action</comment>
-        <translation>記錄(&L)...</translation>
-    </message>
-    <message>
         <source>Popup Menu</source>
         <translation>Popup Menu</translation>
     </message>
     <message>
-        <source>Insert the Guest Additions disk file into the virtual drive</source>
-        <translation>插入 Guest Additions 磁碟檔案到虛擬磁碟機</translation>
+        <source>Show Session Information Window</source>
+        <translation>顯示工作階段資訊視窗</translation>
+    </message>
+    <message>
+        <source>&Webcams</source>
+        <translation>Webcams(&W)</translation>
     </message>
     <message>
         <source>&Insert Guest Additions CD image...</source>
         <translation>插入 Guest Additions CD 映像(&I)...</translation>
     </message>
     <message>
-        <source>Show Session Information Window</source>
-        <translation>顯示工作階段資訊視窗</translation>
+        <source>Insert the Guest Additions disk file into the virtual drive</source>
+        <translation>插入 Guest Additions 磁碟檔案到虛擬磁碟機</translation>
     </message>
     <message>
-        <source>&Webcams</source>
-        <translation>Webcams(&W)</translation>
+        <source>&VirtualBox</source>
+        <translation>&VirtualBox</translation>
+    </message>
+    <message>
+        <source>&Menu Bar</source>
+        <translation>功能表列(&M)</translation>
+    </message>
+    <message>
+        <source>&Menu Bar Settings...</source>
+        <translation>功能表列設定(&M)...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure menu-bar</source>
+        <translation>開啟視窗以組態功能表列</translation>
+    </message>
+    <message>
+        <source>Show Menu &Bar</source>
+        <translation>顯示功能表列(&B)</translation>
+    </message>
+    <message>
+        <source>Toggle menu-bar visibility for this machine</source>
+        <translation>切換此機器的功能表列可見性</translation>
+    </message>
+    <message>
+        <source>&Status Bar</source>
+        <translation>狀態列(&S)</translation>
+    </message>
+    <message>
+        <source>&Status Bar Settings...</source>
+        <translation>狀態列設定(&S)...</translation>
+    </message>
+    <message>
+        <source>Opens window to configure status-bar</source>
+        <translation>開啟視窗以組態狀態列</translation>
+    </message>
+    <message>
+        <source>Show Status &Bar</source>
+        <translation>顯示狀態列(&B)</translation>
+    </message>
+    <message>
+        <source>Toggle status-bar visibility for this machine</source>
+        <translation>切換此機器的狀態列可見性</translation>
+    </message>
+    <message>
+        <source>&Input</source>
+        <translation>輸入(&I)</translation>
+    </message>
+    <message>
+        <source>&Keyboard</source>
+        <translation>鍵盤(&K)</translation>
+    </message>
+    <message>
+        <source>&Keyboard Settings...</source>
+        <translation>鍵盤設定(&K)...</translation>
+    </message>
+    <message>
+        <source>Display the global settings window to configure shortcuts</source>
+        <translation>顯示全域設定視窗以組態快速鍵</translation>
+    </message>
+    <message>
+        <source>&Mouse</source>
+        <translation>滑鼠(&M)</translation>
+    </message>
+    <message>
+        <source>&Hard Drives</source>
+        <translation>硬碟(&H)</translation>
+    </message>
+    <message>
+        <source>&Hard Drive Settings...</source>
+        <translation>硬碟設定(&H)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of hard drives</source>
+        <translation>變更硬碟設定</translation>
     </message>
     <message>
         <source>Network</source>
-        <translation type="unfinished">網路</translation>
+        <translation>網路</translation>
+    </message>
+    <message>
+        <source>&USB Settings...</source>
+        <translation>USB 設定(&U)...</translation>
+    </message>
+    <message>
+        <source>Change the settings of USB devices</source>
+        <translation>變更 USB 裝置的設定</translation>
+    </message>
+    <message>
+        <source>&Shared Folders</source>
+        <translation>共用資料夾(&S)</translation>
+    </message>
+    <message>
+        <source>Show &Log...</source>
+        <comment>debug action</comment>
+        <translation>顯示日誌(&L)...</translation>
+    </message>
+    <message>
+        <source>E&xtra Data Manager...</source>
+        <translation>額外資料管理員(&X)...</translation>
+    </message>
+    <message>
+        <source>Display the Extra Data Manager window</source>
+        <translation>顯示額外資料管理員視窗</translation>
+    </message>
+    <message>
+        <source>&File</source>
+        <translation>檔案(&F)</translation>
+    </message>
+    <message>
+        <source>&Window</source>
+        <translation>視窗(&W)</translation>
+    </message>
+    <message>
+        <source>&Minimize</source>
+        <translation>最小化(&M)</translation>
+    </message>
+    <message>
+        <source>Minimize active machine-window</source>
+        <translation>最小化使用中機器視窗</translation>
+    </message>
+    <message>
+        <source>&Full-screen Mode</source>
+        <translation>全螢幕模式(&F)</translation>
+    </message>
+    <message>
+        <source>Switch between normal and full-screen mode</source>
+        <translation>在標準和全螢幕模式之間切換</translation>
+    </message>
+    <message>
+        <source>Seam&less Mode</source>
+        <translation>無縫模式(&L)</translation>
+    </message>
+    <message>
+        <source>S&caled Mode</source>
+        <translation>縮放模式(&C)</translation>
+    </message>
+    <message>
+        <source>S&cale Factor</source>
+        <translation>縮放係數(&C)</translation>
+    </message>
+    <message>
+        <source>&Insert %1</source>
+        <translation>插入 %1(&I)</translation>
+    </message>
+    <message>
+        <source>Send the %1 sequence to the virtual machine</source>
+        <translation>傳送 %1 序列到虛擬機器</translation>
+    </message>
+    <message>
+        <source>&Mouse Integration</source>
+        <translation>滑鼠整合(&M)</translation>
+    </message>
+    <message>
+        <source>Enable host mouse pointer integration</source>
+        <translation>啟用主機滑鼠指標整合</translation>
+    </message>
+    <message>
+        <source>&Optical Drives</source>
+        <translation>光碟機(&O)</translation>
+    </message>
+    <message>
+        <source>&Floppy Drives</source>
+        <translation>軟碟機(&F)</translation>
+    </message>
+    <message>
+        <source>&USB</source>
+        <translation>USB(&U)</translation>
+    </message>
+    <message>
+        <source>Drag and Drop</source>
+        <translation>拖放</translation>
+    </message>
+    <message>
+        <source>&Logging</source>
+        <comment>debug action</comment>
+        <translation>記錄(&L)</translation>
+    </message>
+    <message>
+        <source>&Normal Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Headless Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Detachable Start</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Start the selected virtual machines with the option of continuing them in the background</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>UIActionPoolRuntime</name>
+    <message>
+        <source>Enable</source>
+        <comment>Virtual Screen</comment>
+        <translation>啟用</translation>
+    </message>
+    <message>
+        <source>Resize to %1x%2</source>
+        <comment>Virtual Screen</comment>
+        <translation>調整大小成 %1x%2</translation>
+    </message>
+    <message>
+        <source>%1%</source>
+        <comment>scale-factor</comment>
+        <translation>%1%</translation>
+    </message>
+</context>
+<context>
+    <name>UIAddDiskEncryptionPasswordDialog</name>
+    <message>
+        <source>%1 - Disk Encryption</source>
+        <translation>%1 - 磁碟加密</translation>
+    </message>
+    <message numerus="yes">
+        <source>This virtual machine is password protected. Please enter the %n encryption password(s) below.</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many passwords are in the list and doesn't need to be told).</comment>
+        <translation>
+            <numerusform>這個虛擬機器受到密碼保護。 請在下方輸入 %n 加密密碼。</numerusform>
+        </translation>
     </message>
 </context>
 <context>
@@ -847,14 +1012,14 @@
     </message>
 </context>
 <context>
-    <name>UIDnDHandler</name>
+    <name>UIDnDDrag</name>
     <message>
-        <source>Dropping data ...</source>
-        <translation>正在拖放資料 ...</translation>
+        <source>Retrieving data ...</source>
+        <translation>正在檢索資料 ...</translation>
     </message>
 </context>
 <context>
-    <name>UIDnDMimeData</name>
+    <name>UIDnDHandler</name>
     <message>
         <source>Dropping data ...</source>
         <translation>正在拖放資料 ...</translation>
@@ -905,6 +1070,31 @@
     </message>
 </context>
 <context>
+    <name>UIEncryptionDataModel</name>
+    <message>
+        <source>Status</source>
+        <comment>password table field</comment>
+        <translation>狀態</translation>
+    </message>
+    <message>
+        <source>ID</source>
+        <comment>password table field</comment>
+        <translation>ID</translation>
+    </message>
+    <message>
+        <source>Password</source>
+        <comment>password table field</comment>
+        <translation>密碼</translation>
+    </message>
+    <message numerus="yes">
+        <source><nobr>Used by the following %n hard drive(s):</nobr><br>%1</source>
+        <comment>This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many hard drives are in the tool-tip and doesn't need to be told).</comment>
+        <translation>
+            <numerusform><nobr>由以下 %n 硬碟所使用:</nobr><br>%1</numerusform>
+        </translation>
+    </message>
+</context>
+<context>
     <name>UIGChooserItemGroup</name>
     <message>
         <source><b>%1</b></source>
@@ -1034,11 +1224,6 @@
         <translation>停用</translation>
     </message>
     <message>
-        <source>[CD/DVD]</source>
-        <comment>details (storage)</comment>
-        <translation>[CD/DVD]</translation>
-    </message>
-    <message>
         <source>Controller</source>
         <comment>details (audio)</comment>
         <translation>控制器</translation>
@@ -1126,7 +1311,7 @@
     <message>
         <source>Nested Paging</source>
         <comment>details (system)</comment>
-        <translation>Nested Paging</translation>
+        <translation>巢式分頁</translation>
     </message>
     <message>
         <source>Video Memory</source>
@@ -1227,6 +1412,116 @@
         <source>Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps</source>
         <translation>框架大小: %1x%2,畫面播放率: %3fps,位元率: %4kbps</translation>
     </message>
+    <message>
+        <source>Minimal Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>最小半虛擬化</translation>
+    </message>
+    <message>
+        <source>Hyper-V Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>Hyper-V 半虛擬化</translation>
+    </message>
+    <message>
+        <source>KVM Paravirtualization</source>
+        <comment>details (system)</comment>
+        <translation>KVM 半虛擬化</translation>
+    </message>
+    <message>
+        <source>[Optical Drive]</source>
+        <comment>details (storage)</comment>
+        <translation>[光碟機]</translation>
+    </message>
+    <message>
+        <source>USB Controller</source>
+        <comment>details (usb)</comment>
+        <translation>USB 控制器</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">縮放係數</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (user interface)</comment>
+        <translation type="obsolete">不縮放的 HiDPI 視訊輸出</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/Unscaled HiDPI Video Output)</comment>
+        <translation type="obsolete">啟用</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar Position</source>
+        <comment>details (user interface)</comment>
+        <translation>迷你工具列位置</translation>
+    </message>
+    <message>
+        <source>Top</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>頂端</translation>
+    </message>
+    <message>
+        <source>Bottom</source>
+        <comment>details (user interface/mini-toolbar position)</comment>
+        <translation>底端</translation>
+    </message>
+    <message>
+        <source>Mini-toolbar</source>
+        <comment>details (user interface)</comment>
+        <translation>迷你工具列</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/mini-toolbar)</comment>
+        <translation>停用</translation>
+    </message>
+    <message>
+        <source>Scale-factor</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">縮放係數</translation>
+    </message>
+    <message>
+        <source>Unscaled HiDPI Video Output</source>
+        <comment>details (display)</comment>
+        <translation type="unfinished">不縮放的 HiDPI 視訊輸出</translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (display/Unscaled HiDPI Video Output)</comment>
+        <translation type="unfinished">啟用</translation>
+    </message>
+    <message>
+        <source>Menu-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">啟用</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/menu-bar)</comment>
+        <translation type="unfinished">停用</translation>
+    </message>
+    <message>
+        <source>Status-bar</source>
+        <comment>details (user interface)</comment>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Enabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">啟用</translation>
+    </message>
+    <message>
+        <source>Disabled</source>
+        <comment>details (user interface/status-bar)</comment>
+        <translation type="unfinished">停用</translation>
+    </message>
 </context>
 <context>
     <name>UIGMachinePreview</name>
@@ -1310,15 +1605,15 @@
     </message>
     <message>
         <source>Machine Windows:</source>
-        <translation type="unfinished"></translation>
+        <translation>機器視窗:</translation>
     </message>
     <message>
         <source>If checked, machine windows will be raised when the mouse pointer moves over them.</source>
-        <translation type="unfinished"></translation>
+        <translation>如果勾選,滑鼠指標移至機器視窗上方時將帶出視窗。</translation>
     </message>
     <message>
         <source>&Raise Window Under Mouse</source>
-        <translation type="unfinished"></translation>
+        <translation>提昇滑鼠下視窗(&R)</translation>
     </message>
 </context>
 <context>
@@ -1368,11 +1663,11 @@
     <name>UIGlobalSettingsGeneral</name>
     <message>
         <source>Holds the path to the default virtual machine folder. This folder is used, if not explicitly specified otherwise, when creating new virtual machines.</source>
-        <translation>預設虛擬機器資料夾所使用的路徑。 新建虛擬機器時,如果沒有特別指定,則會使用這個資料夾。</translation>
+        <translation>保留預設虛擬機器資料夾的路徑。 新建虛擬機器時,如果沒有特別指定,則會使用這個資料夾。</translation>
     </message>
     <message>
         <source>Holds the path to the library that provides authentication for Remote Display (VRDP) clients.</source>
-        <translation>提供遠端顯示 (VRDP) 用戶端驗證所使用的程式庫路徑。</translation>
+        <translation>保留提供遠端顯示 (VRDP) 用戶端驗證的程式庫路徑。</translation>
     </message>
     <message>
         <source>Default &Machine Folder:</source>
@@ -1383,18 +1678,6 @@
         <translation>VRDP 驗證程式庫(&R):</translation>
     </message>
     <message>
-        <source>&Dock and Menubar:</source>
-        <translation>停駐和功能表列(&D):</translation>
-    </message>
-    <message>
-        <source>Auto-Show in Fullscreen</source>
-        <translation>自動以全螢幕顯示</translation>
-    </message>
-    <message>
-        <source>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</source>
-        <translation>勾選時,虛擬機器於全螢幕模式時將顯示停駐和功能表列。</translation>
-    </message>
-    <message>
         <source>&Host Screensaver:</source>
         <translation>主機螢幕保護(&H):</translation>
     </message>
@@ -1753,7 +2036,7 @@
     </message>
     <message>
         <source>Holds the host IPv4 address for this adapter.</source>
-        <translation>此網路卡所使用的 IPv4 位址。</translation>
+        <translation>保留這個網路卡的 IPv4 位址。</translation>
     </message>
     <message>
         <source>IPv4 Network &Mask:</source>
@@ -1761,7 +2044,7 @@
     </message>
     <message>
         <source>Holds the host IPv4 network mask for this adapter.</source>
-        <translation>此網路卡所使用的 IPv4 網路遮罩。</translation>
+        <translation>保留這個網路卡的 IPv4 網路遮罩。</translation>
     </message>
     <message>
         <source>I&Pv6 Address:</source>
@@ -1769,7 +2052,7 @@
     </message>
     <message>
         <source>Holds the host IPv6 address for this adapter if IPv6 is supported.</source>
-        <translation>此網路卡所使用的 IPv6 位址,如果支援 IPv6。</translation>
+        <translation>保留這個網路卡的 IPv6 位址,如果支援 IPv6。</translation>
     </message>
     <message>
         <source>IPv6 Network Mask &Length:</source>
@@ -1777,7 +2060,7 @@
     </message>
     <message>
         <source>Holds the host IPv6 network mask prefix length for this adapter if IPv6 is supported.</source>
-        <translation>此網路卡所使用的主機 IPv6 網路遮罩字首長度,如果支援 IPv6。</translation>
+        <translation>保留這個網路卡的主機 IPv6 網路遮罩前置長度,如果支援 IPv6。</translation>
     </message>
     <message>
         <source>&DHCP Server</source>
@@ -1797,7 +2080,7 @@
     </message>
     <message>
         <source>Holds the address of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>DHCP 伺服器所使用的位址,服務與此「僅限主機」網路卡關聯的網路。</translation>
+        <translation>保留 DHCP 伺服器的位址,服務與此「僅限主機」網路卡關聯的網路。</translation>
     </message>
     <message>
         <source>Server &Mask:</source>
@@ -1805,7 +2088,7 @@
     </message>
     <message>
         <source>Holds the network mask of the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>DHCP 伺服器所使用的網路遮罩,服務與此「僅限主機」網路卡關聯的網路。</translation>
+        <translation>保留 DHCP 伺服器的網路遮罩,服務與這個「僅限主機」網路卡關聯的網路。</translation>
     </message>
     <message>
         <source>&Lower Address Bound:</source>
@@ -1813,7 +2096,7 @@
     </message>
     <message>
         <source>Holds the lower address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>DHCP 伺服器所提供使用的位址下限,服務與此「僅限主機」網路卡關聯的網路。</translation>
+        <translation>保留 DHCP 伺服器所提供的位址下限,服務與這個「僅限主機」網路卡關聯的網路。</translation>
     </message>
     <message>
         <source>&Upper Address Bound:</source>
@@ -1821,7 +2104,7 @@
     </message>
     <message>
         <source>Holds the upper address bound offered by the DHCP server servicing the network associated with this host-only adapter.</source>
-        <translation>DHCP 伺服器所提供使用的位址上限,服務與此「僅限主機」網路卡關聯的網路。</translation>
+        <translation>保留 DHCP 伺服器所提供的位址上限,服務與這個「僅限主機」網路卡關聯的網路。</translation>
     </message>
 </context>
 <context>
@@ -1844,7 +2127,7 @@
     </message>
     <message>
         <source>Holds the name for this network.</source>
-        <translation>這個網路所使用的名稱。</translation>
+        <translation>保留這個網路的名稱。</translation>
     </message>
     <message>
         <source>Network &CIDR:</source>
@@ -1852,7 +2135,7 @@
     </message>
     <message>
         <source>Holds the CIDR for this network.</source>
-        <translation>此網路所使用的 CIDR。</translation>
+        <translation>保留這個網路的 CIDR。</translation>
     </message>
     <message>
         <source>Network Options:</source>
@@ -1895,7 +2178,7 @@
     <name>UIGlobalSettingsPortForwardingDlg</name>
     <message>
         <source>Port Forwarding Rules</source>
-        <translation>通訊埠轉送規則</translation>
+        <translation>連接埠轉送規則</translation>
     </message>
     <message>
         <source>IPv4</source>
@@ -2055,7 +2338,7 @@
     </message>
     <message>
         <source>Caps Lock</source>
-        <translation>Caps Lock</translation>
+        <translation>大寫鎖定</translation>
     </message>
     <message>
         <source>Scroll Lock</source>
@@ -2135,16 +2418,6 @@
         <translation><p style='white-space:pre'><nobr>指示虛擬硬碟的活動:</nobr>%1</p></translation>
     </message>
     <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the CD/DVD devices:</nobr>%1</p></source>
-        <comment>CD/DVD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>指示 CD/DVD 裝置的活動:</nobr>%1</p></translation>
-    </message>
-    <message>
-        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy devices:</nobr>%1</p></source>
-        <comment>FD tooltip</comment>
-        <translation><p style='white-space:pre'><nobr>指示軟碟裝置的活動:</nobr>%1</p></translation>
-    </message>
-    <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the network interfaces:</nobr>%1</p></source>
         <comment>Network adapters tooltip</comment>
         <translation><p style='white-space:pre'><nobr>指示網路卡的活動:</nobr>%1</p></translation>
@@ -2180,11 +2453,6 @@
         <translation><br><nobr><b>未附加 USB 裝置</b></nobr></translation>
     </message>
     <message>
-        <source><br><nobr><b>USB Controller is disabled</b></nobr></source>
-        <comment>USB device tooltip</comment>
-        <translation><br><nobr><b>USB 控制器已停用</b></nobr></translation>
-    </message>
-    <message>
         <source><p style='white-space:pre'><nobr>Indicates the activity of the machine's shared folders:</nobr>%1</p></source>
         <comment>Shared folders tooltip</comment>
         <translation><p style='white-space:pre'><nobr>指示電腦共用資料夾的活動:</nobr>%1</p></translation>
@@ -2224,6 +2492,20 @@
         <comment>Virtualization Stuff LED</comment>
         <translation>額外功能狀態:<br><nobr><b>%1:</b>&nbsp;%2</nobr><br><nobr><b>%3:</b>&nbsp;%4</nobr><br><nobr><b>%5:</b>&nbsp;%6</nobr><br><nobr><b>%7:</b>&nbsp;%8%</nobr></translation>
     </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the display:</nobr>%1</p></source>
+        <translation><p style='white-space:pre'><nobr>指示顯示器的活動性:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the optical drives:</nobr>%1</p></source>
+        <comment>CD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>指示光碟機的活動性:</nobr>%1</p></translation>
+    </message>
+    <message>
+        <source><p style='white-space:pre'><nobr>Indicates the activity of the floppy drives:</nobr>%1</p></source>
+        <comment>FD tooltip</comment>
+        <translation><p style='white-space:pre'><nobr>指示軟碟機的活動性:</nobr>%1</p></translation>
+    </message>
 </context>
 <context>
     <name>UILineTextEdit</name>
@@ -2264,11 +2546,11 @@
     </message>
     <message>
         <source>Connect Network Adapter</source>
-        <translation type="unfinished"></translation>
+        <translation>連接網路卡</translation>
     </message>
     <message>
         <source>Connect Network Adapter %1</source>
-        <translation type="unfinished"></translation>
+        <translation>連接網路卡 %1</translation>
     </message>
 </context>
 <context>
@@ -2306,7 +2588,7 @@
     </message>
     <message>
         <source>&Video</source>
-        <translation>視訊(&V)</translation>
+        <translation type="obsolete">視訊(&V)</translation>
     </message>
     <message>
         <source>Video &Memory:</source>
@@ -2402,7 +2684,7 @@
     </message>
     <message>
         <source>When checked, VirtualBox will record the virtual machine session as a video file.</source>
-        <translation>勾選時,VirtualBox 將以視訊檔案錄製虛擬機器工作階段。</translation>
+        <translation>勾選時,VirtualBox 將錄製虛擬機器工作階段為視訊檔。</translation>
     </message>
     <message>
         <source>&Enable Video Capture</source>
@@ -2470,7 +2752,7 @@
     </message>
     <message>
         <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least b>%1</b>.</source>
-        <translation>虛擬機器設成使用硬體圖形加速和作業系統提示設成 Windows Vista 或以上。 為了最佳效能,應該設定機器至少  <b>%1</b> 的視訊記憶體。</translation>
+        <translation type="obsolete">虛擬機器設成使用硬體圖形加速和作業系統提示設成 Windows Vista 或以上。 為了最佳效能,應該設定機器至少  <b>%1</b> 的視訊記憶體。</translation>
     </message>
     <message>
         <source>The virtual machine is set up to use Video Stream Acceleration. As this feature only works with Windows guest systems it will be disabled.</source>
@@ -2524,7 +2806,55 @@
         <translation>啟用畫面 %1 的視訊錄製。</translation>
     </message>
     <message>
-        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <source><i>About %1MB per 5 minute video</i></source>
+        <translation><i>每 5 分鐘視訊約 %1MB </i></translation>
+    </message>
+    <message>
+        <source>Remote Display is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site as otherwise your VM will be started with Remote Display disabled.</source>
+        <translation>這部虛擬機器目前啟用遠端顯示。 然而,這需要安裝 <i>%1</i>。 請從 VirtualBox 下載網站安裝 Extension Pack,否則 VM 將停用遠端顯示來啟動。</translation>
+    </message>
+    <message>
+        <source>The virtual machine is set up to use hardware graphics acceleration and the operating system hint is set to Windows Vista or later. For best performance you should set the machine's video memory to at least <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>&Screen</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Scale Factor:</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Controls the guest screen scale factor.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="unfinished">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="unfinished">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="unfinished">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="unfinished">HiDPI:</translation>
+    </message>
+    <message>
+        <source>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="unfinished">使用不縮放的 HiDPI 視訊輸出(&U)</translation>
+    </message>
+    <message>
+        <source>Acceleration:</source>
         <translation type="unfinished"></translation>
     </message>
 </context>
@@ -2532,15 +2862,15 @@
     <name>UIMachineSettingsGeneral</name>
     <message>
         <source>Holds the path where snapshots of this virtual machine will be stored. Be aware that snapshots can take quite a lot of disk space.</source>
-        <translation>將儲存這部虛擬機器快照所使用的路徑。 注意,快照可能需要相當多的磁碟空間。</translation>
+        <translation>保留將儲存這部虛擬機器快照的路徑。 注意,快照可能需要相當多的磁碟空間。</translation>
     </message>
     <message>
-        <source>&Basic</source>
-        <translation>基本(&B)</translation>
+        <source>Basi&c</source>
+        <translation>基本(&C)</translation>
     </message>
     <message>
-        <source>&Advanced</source>
-        <translation>進階(&A)</translation>
+        <source>A&dvanced</source>
+        <translation>進階(&D)</translation>
     </message>
     <message>
         <source>&Shared Clipboard:</source>
@@ -2555,24 +2885,124 @@
         <translation>快照資料夾(&N):</translation>
     </message>
     <message>
-        <source>&Description</source>
-        <translation>描述(&D)</translation>
+        <source>D&escription</source>
+        <translation>描述(&E)</translation>
     </message>
     <message>
         <source>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</source>
-        <translation>虛擬機器所使用的描述。 描述欄位對於註解已安裝的客體作業系統之組態詳細資料是有用的。</translation>
+        <translation>保留虛擬機器的描述。 描述欄位對於註解已安裝的客體作業系統之組態詳細資料是有用的。</translation>
     </message>
     <message>
-        <source>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</source>
-        <translation>如果勾選,將記住機器執行時所放入或從虛擬磁碟移除的任何 CD/DVD 或軟體。</translation>
+        <source>D&rag'n'Drop:</source>
+        <translation>拖放(&R):</translation>
     </message>
     <message>
-        <source>Removable Media:</source>
-        <translation>卸除式媒體:</translation>
+        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
+        <translation>選取要使用拖放在客體和主機作業系統之間複製的資料。 此功能需要在客體 OS 安裝 Guest Additions。</translation>
+    </message>
+    <message>
+        <source>No name specified for the virtual machine.</source>
+        <translation>未指定虛擬機器的名稱。</translation>
+    </message>
+    <message>
+        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
+        <translation>虛擬機器作業系統提示設成 64 位元類型。  64 位元客體需要硬體虛擬化,因此如果您確認變更這將會自動啟用。</translation>
+    </message>
+    <message>
+        <source>Enc&ryption</source>
+        <translation>加密(&R)</translation>
+    </message>
+    <message>
+        <source>When checked, enables encryption for this virtual machine.</source>
+        <translation>如果勾選,對此虛擬機器啟用加密。</translation>
+    </message>
+    <message>
+        <source>En&able Encryption</source>
+        <translation>啟用加密(&A)</translation>
+    </message>
+    <message>
+        <source>Encryption C&ipher:</source>
+        <translation>加密 Cipher(&I) :</translation>
+    </message>
+    <message>
+        <source>Holds the cipher to be used for encrypting the virtual machine disks.</source>
+        <translation>保留虛擬機器磁碟所使用的 Cipher。</translation>
+    </message>
+    <message>
+        <source>E&nter New Password:</source>
+        <translation>輸入新密碼(&N):</translation>
     </message>
     <message>
-        <source>&Remember Runtime Changes</source>
-        <translation>記住執行階段變更(&R)</translation>
+        <source>Holds the password to be assigned to the virtual machine.</source>
+        <translation>保留指派給虛擬機器的密碼。</translation>
+    </message>
+    <message>
+        <source>C&onfirm New Password:</source>
+        <translation>確認新密碼(&O):</translation>
+    </message>
+    <message>
+        <source>Confirms the password to be assigned to the virtual machine.</source>
+        <translation>確認要指派給虛擬機器的密碼。</translation>
+    </message>
+    <message>
+        <source>You are trying to encrypt this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site.</source>
+        <translation>您正嘗試加密此虛擬機器。 然而這需要安裝 <i>%1</i>。 從 VirtualBox 網站下載並安裝 Extension Pack。</translation>
+    </message>
+    <message>
+        <source>Encryption cipher type not specified.</source>
+        <translation>加密 Cipher 類型未指定。</translation>
+    </message>
+    <message>
+        <source>Encryption password empty.</source>
+        <translation>加密密碼為空。</translation>
+    </message>
+    <message>
+        <source>Encryption passwords do not match.</source>
+        <translation>加密密碼不相符。</translation>
+    </message>
+    <message>
+        <source>Leave Unchanged</source>
+        <comment>cipher type</comment>
+        <translation>保留不變更</translation>
+    </message>
+</context>
+<context>
+    <name>UIMachineSettingsInterface</name>
+    <message>
+        <source>Allows to modify VM menu-bar contents.</source>
+        <translation>允許修改虛擬機器功能表列內容。</translation>
+    </message>
+    <message>
+        <source>Screen Scale Factor:</source>
+        <translation type="obsolete">畫面縮放係數:</translation>
+    </message>
+    <message>
+        <source>This setting determines the guest screen scale factor.</source>
+        <translation type="obsolete">此設定決定客體畫面縮放係數。</translation>
+    </message>
+    <message>
+        <source>100%</source>
+        <translation type="obsolete">100%</translation>
+    </message>
+    <message>
+        <source>200%</source>
+        <translation type="obsolete">200%</translation>
+    </message>
+    <message>
+        <source>%</source>
+        <translation type="obsolete">%</translation>
+    </message>
+    <message>
+        <source>HiDPI:</source>
+        <translation type="obsolete">HiDPI:</translation>
+    </message>
+    <message>
+        <source>If checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</source>
+        <translation type="obsolete">如果勾選,將不會放大客體畫面內容以補償高主機螢幕解析度。</translation>
+    </message>
+    <message>
+        <source>Use &Unscaled HiDPI Output</source>
+        <translation type="obsolete">使用不縮放的 HiDPI 視訊輸出(&U)</translation>
     </message>
     <message>
         <source>Mini ToolBar:</source>
@@ -2580,7 +3010,7 @@
     </message>
     <message>
         <source>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</source>
-        <translation>如果勾選,在全螢幕及無縫模式顯示迷你工具列。</translation>
+        <translation>如果勾選,在全螢幕和無縫模式顯示迷你工具列。</translation>
     </message>
     <message>
         <source>Show in &Fullscreen/Seamless</source>
@@ -2588,27 +3018,15 @@
     </message>
     <message>
         <source>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</source>
-        <translation>如果勾選,在螢幕上方顯示迷你工具列,而不是它的預設位置在螢幕的下方。</translation>
+        <translation>如果勾選,在螢幕的頂端顯示迷你工具列,而不是在其預設位置螢幕的底端。</translation>
     </message>
     <message>
         <source>Show at &Top of Screen</source>
-        <translation>顯示在螢幕上方(&T)</translation>
+        <translation>顯示在螢幕頂端(&T)</translation>
     </message>
     <message>
-        <source>&Drag'n'Drop:</source>
-        <translation>拖放(&D):</translation>
-    </message>
-    <message>
-        <source>Selects which data will be copied between the guest and the host OS by drag'n'drop. This feature requires Guest Additions to be installed in the guest OS.</source>
-        <translation>選取要使用拖放在客體和主機作業系統之間複製的資料。 此功能需要在客體 OS 安裝 Guest Additions。</translation>
-    </message>
-    <message>
-        <source>No name specified for the virtual machine.</source>
-        <translation>未指定虛擬機器的名稱。</translation>
-    </message>
-    <message>
-        <source>The virtual machine operating system hint is set to a 64-bit type. 64-bit guest systems require hardware virtualization, so this will be enabled automatically if you confirm the changes.</source>
-        <translation>虛擬機器作業系統提示設成 64 位元類型。  64 位元客體需要硬體虛擬化,因此如果您確認變更這將會自動啟用。</translation>
+        <source>Allows to modify VM status-bar contents.</source>
+        <translation>允許修改虛擬機器狀態列內容。</translation>
     </message>
 </context>
 <context>
@@ -2656,7 +3074,7 @@
     </message>
     <message>
         <source>Holds the MAC address of this adapter. It contains exactly 12 characters chosen from {0-9,A-F}. Note that the second character must be an even digit.</source>
-        <translation>這個網路卡所使用的 MAC 位址。 其確切包含 12 個字元選擇自 {0-9, A-F}。 請注意第二個字元必須是偶數數字。</translation>
+        <translation>保留這個網路卡的 MAC 位址。 其確切包含 12 個字元選擇自 {0-9, A-F}。 請注意,第二個字元必須是偶數數字。</translation>
     </message>
     <message>
         <source>Generates a new random MAC address.</source>
@@ -2700,7 +3118,7 @@
     </message>
     <message>
         <source>Holds the name of the internal network that this network card will be connected to. You can create a new internal network by choosing a name which is not used by any other network cards in this virtual machine or others.</source>
-        <translation>這個網路卡將連接所使用的內部網路名稱。 可以選擇名稱以建立新的內部網路,其名稱未在此或其它虛擬機器中由其他任何網路卡所使用。</translation>
+        <translation>保留這個網路卡將連接的內部網路名稱。 可以選擇名稱以建立新的內部網路,其名稱未在此或其它虛擬機器中由其他任何網路卡所使用。</translation>
     </message>
     <message>
         <source>Selects the virtual network adapter on the host system that traffic to and from this network card will go through. You can create and remove adapters using the global network settings in the virtual machine manager window.</source>
@@ -2744,7 +3162,7 @@
     </message>
     <message>
         <source>Holds the name of the NAT network that this network card will be connected to. You can create and remove networks using the global network settings in the virtual machine manager window.</source>
-        <translation>這個網路卡將連接的 NAT 網路所使用的名稱。 可以使用 [虛擬機器管理員] 視窗中的 [全域網路] 設定建立或移除網路。</translation>
+        <translation>保留這個網路卡將連接的 NAT 網路的名稱。 可以使用 [虛擬機器管理員] 視窗中的 [全域網路] 設定建立或移除網路。</translation>
     </message>
 </context>
 <context>
@@ -2768,7 +3186,7 @@
     </message>
     <message>
         <source>Holds the parallel port number. You can choose one of the standard parallel ports or select <b>User-defined</b> and specify port parameters manually.</source>
-        <translation>使用的並列埠號。您可以選擇標準並列埠之一,或是選擇<b>使用者定義</b>並手動指定連接埠參數。</translation>
+        <translation>保留並列埠號。您可以選擇標準並列埠之一,或是選擇<b>使用者定義</b>並手動指定連接埠參數。</translation>
     </message>
     <message>
         <source>&IRQ:</source>
@@ -2784,15 +3202,15 @@
     </message>
     <message>
         <source>Holds the host parallel device name.</source>
-        <translation>主機並列裝置所使用的名稱。</translation>
+        <translation>保留主機並列裝置名稱。</translation>
     </message>
     <message>
         <source>Holds the IRQ number of this parallel port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation>這個並列埠所使用的 IRQ 號碼。這應該是介於 <tt>0</tt> 與 <tt>255</tt> 之間的整數。 只有這部虛擬機器啟用 <b>I/O APIC</b> 時,才會使用大於 <tt>15</tt> 的值。</translation>
+        <translation>保留這個並列埠的 IRQ 號碼。這應該是介於 <tt>0</tt> 與 <tt>255</tt> 之間的整數。 只有這部虛擬機器啟用 <b>I/O APIC</b> 設定時,才會使用大於 <tt>15</tt> 的值。</translation>
     </message>
     <message>
         <source>Holds the base I/O port address of this parallel port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation>這個並列埠所使用的基礎 I/O 連接埠位址。有效值從 <tt>0</tt> 到 <tt>0xFFFF</tt> 的整數。</translation>
+        <translation>保留這個並列埠的基礎 I/O 連接埠位址。有效值從 <tt>0</tt> 到 <tt>0xFFFF</tt> 的整數。</translation>
     </message>
 </context>
 <context>
@@ -2940,7 +3358,7 @@
     </message>
     <message>
         <source>Holds the name of the shared folder (as it will be seen by the guest OS).</source>
-        <translation>共用資料夾所使用的名稱 (客體作業系統將會看到的)。</translation>
+        <translation>保留共用資料夾的名稱 (客體作業系統將會看到的)。</translation>
     </message>
     <message>
         <source>When checked, the guest OS will not be able to write to the specified shared folder.</source>
@@ -2966,10 +3384,6 @@
         <source>If checked, this shared folder will be permanent.</source>
         <translation>如果勾選,這個共用資料夾將永久存在。</translation>
     </message>
-    <message>
-        <source>Window</source>
-        <translation>視窗</translation>
-    </message>
 </context>
 <context>
     <name>UIMachineSettingsSerial</name>
@@ -2980,11 +3394,11 @@
     </message>
     <message>
         <source>When checked, enables the given serial port of the virtual machine.</source>
-        <translation>勾選時,虛擬機器啟用給予的序列埠。</translation>
+        <translation>勾選時,虛擬機器啟用給予的串列埠。</translation>
     </message>
     <message>
         <source>&Enable Serial Port</source>
-        <translation>啟用序列埠(&E)</translation>
+        <translation>啟用串列埠(&E)</translation>
     </message>
     <message>
         <source>Port &Number:</source>
@@ -2992,7 +3406,7 @@
     </message>
     <message>
         <source>Selects the serial port number. You can choose one of the standard serial ports or select <b>User-defined</b> and specify port parameters manually.</source>
-        <translation>選取序列埠號。 您可以選擇標準序列埠之一,或是選擇<b>使用者定義</b>並手動指定連接埠參數。</translation>
+        <translation>選取串列埠號。 您可以選擇標準串列埠之一,或是選擇<b>使用者定義</b>並手動指定連接埠參數。</translation>
     </message>
     <message>
         <source>&IRQ:</source>
@@ -3008,31 +3422,31 @@
     </message>
     <message>
         <source>Controls the working mode of this serial port. If you select <b>Disconnected</b>, the guest OS will detect the serial port but will not be able to operate it.</source>
-        <translation>控制這個序列埠的工作模式。 如果您選取<b>已中斷連接</b>,客體作業系統將偵測到序列埠但無法操作。</translation>
+        <translation>控制這個串列埠的工作模式。 如果您選取<b>已中斷連接</b>,客體作業系統將偵測到串列埠但無法操作。</translation>
     </message>
     <message>
-        <source>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</source>
-        <translation>如果勾選,虛擬機器於啟動時將建立<b>連接埠路徑</b>欄位中指定的管線。 否則,虛擬機器將假設管線存在並嘗試使用。</translation>
+        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
+        <translation>保留這個串列埠的 IRQ 號碼。這應該是介於 <tt>0</tt> 與 <tt>255</tt> 之間的整數。 只有這部虛擬機器啟用 <b>I/O APIC</b> 設定時,才會使用大於 <tt>15</tt> 的值。</translation>
     </message>
     <message>
-        <source>&Create Pipe</source>
-        <translation>建立管線(&C)</translation>
+        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
+        <translation>保留這個串列埠的基礎 I/O 連接埠位址。有效值從 <tt>0</tt> 到 <tt>0xFFFF</tt> 的整數。</translation>
     </message>
     <message>
-        <source>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</source>
-        <translation>連接埠工作在<b>主機管線</b>模式時,主機中序列埠管線所使用的路徑,或者當連接埠工作在<b>主機裝置</b>模式時所使用的主機序列裝置名稱。</translation>
+        <source>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</source>
+        <translation>如果勾選,虛擬機器將假設於 <b>路徑/位址</b>欄位中指定的管線或通訊端存在並嘗試去使用。 否則,虛擬機器將在啟動時建立管線或通訊端。</translation>
     </message>
     <message>
-        <source>Port/File &Path:</source>
-        <translation>連接埠/檔案路徑(&P):</translation>
+        <source>&Connect to existing pipe/socket</source>
+        <translation>連線到現有管線/通訊端(&C)</translation>
     </message>
     <message>
-        <source>Holds the IRQ number of this serial port. This should be a whole number between <tt>0</tt> and <tt>255</tt>. Values greater than <tt>15</tt> may only be used if the <b>I/O APIC</b> setting is enabled for this virtual machine.</source>
-        <translation>這個序列埠所使用的 IRQ 號碼。這應該是介於 <tt>0</tt> 與 <tt>255</tt> 之間的整數。 除非這部虛擬機器啟用 <b>I/O APIC</b> 時,才會使用大於 <tt>15</tt> 的值。</translation>
+        <source>&Path/Address:</source>
+        <translation>路徑/位址(&P):</translation>
     </message>
     <message>
-        <source>Holds the base I/O port address of this serial port. Valid values are integer numbers in range from <tt>0</tt> to <tt>0xFFFF</tt>.</source>
-        <translation>這個序列埠所使用的基礎 I/O 連接埠位址。有效值從 <tt>0</tt> 到 <tt>0xFFFF</tt> 的整數。</translation>
+        <source><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the seri [...]
+        <translation><p>在<b>主機管線</b>模式: 保留路徑為主機的串列埠管線。 範例: "\\.\pipe\myvbox" 或 "/tmp/myvbox", 分別對 Windows 和 UNIX 類的系統。</p><p>在<b>主機裝置</b>模式: 保留主機串列裝置名稱。 範例: "COM1" 或 "/dev/ttyS0"。</p><p>在 <b>Raw 檔案</b>模式: 保留在主機系統的檔案路徑,其中將傾印串列輸出。</p><p>在 <b>TCP</b> 模式: 在伺服器模式時保留 TCP "連接埠" 或在用戶端模式時保留 "主機名稱:連接埠" 。</translation>
     </message>
 </context>
 <context>
@@ -3073,14 +3487,6 @@
         <translation><nobr>加入硬碟</nobr></translation>
     </message>
     <message>
-        <source><nobr>Add&nbsp;CD/DVD&nbsp;Device</nobr></source>
-        <translation><nobr>加入&nbsp;CD/DVD&nbsp;裝置</nobr></translation>
-    </message>
-    <message>
-        <source><nobr>Add&nbsp;Floppy&nbsp;Device</nobr></source>
-        <translation><nobr>加入軟碟裝置</nobr></translation>
-    </message>
-    <message>
         <source>Add Controller</source>
         <translation>加入控制器</translation>
     </message>
@@ -3113,14 +3519,6 @@
         <translation>加入硬碟</translation>
     </message>
     <message>
-        <source>Add CD/DVD Device</source>
-        <translation>加入 CD/DVD 裝置</translation>
-    </message>
-    <message>
-        <source>Add Floppy Device</source>
-        <translation>加入軟碟裝置</translation>
-    </message>
-    <message>
         <source>Remove Attachment</source>
         <translation>移除附件</translation>
     </message>
@@ -3249,18 +3647,6 @@
         <translation>設定虛擬硬碟</translation>
     </message>
     <message>
-        <source>CD/DVD &Drive:</source>
-        <translation>CD/DVD 光碟機(&D):</translation>
-    </message>
-    <message>
-        <source>Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
-        <translation>選擇與虛擬磁碟機使用的虛擬 CD/DVD 磁碟或實體光碟機。 虛擬機器將看到插入光碟機的磁碟,以檔案中資料或實體光碟機中磁碟為內容。</translation>
-    </message>
-    <message>
-        <source>Set up the virtual CD/DVD drive</source>
-        <translation>設定虛擬 CD/DVD 光碟機</translation>
-    </message>
-    <message>
         <source>Floppy &Drive:</source>
         <translation>軟碟機(&D):</translation>
     </message>
@@ -3281,10 +3667,6 @@
         <translation>選擇虛擬硬碟檔案...</translation>
     </message>
     <message>
-        <source>Choose a virtual CD/DVD disk file...</source>
-        <translation>選擇虛擬 CD/DVD 磁碟檔案...</translation>
-    </message>
-    <message>
         <source>Remove disk from virtual drive</source>
         <translation>從虛擬磁碟機移除磁碟</translation>
     </message>
@@ -3352,7 +3734,55 @@
     </message>
     <message>
         <source>The machine currently has more storage controllers assigned than a %1 chipset supports. Please change the chipset type on the System settings page or reduce the number of the following storage controllers on the Storage settings page: %2</source>
-        <translation>機器目前指派超過 %1 晶片組所支援的存放控制器。 請在 [系統] 設定頁中變更晶片組類型或在 [存放] 設定頁中減少以下存放控制器的數量: %2。</translation>
+        <translation>機器目前指派超過 %1 晶片組所支援的存放控制器。 請在 [系統] 設定頁中變更晶片組類型或在 [存放裝置] 設定頁中減少以下存放控制器的數量: %2</translation>
+    </message>
+    <message>
+        <source>Add USB Controller</source>
+        <translation>加入 USB 控制器</translation>
+    </message>
+    <message>
+        <source>When checked the guest system will see the virtual disk as a hot-pluggable device.</source>
+        <translation>勾選時,客體系統將看到虛擬磁碟為熱插拔裝置。</translation>
+    </message>
+    <message>
+        <source>&Hot-pluggable</source>
+        <translation>可熱插拔(&H)</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk file...</source>
+        <translation>選擇虛擬光碟檔案...</translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Optical&nbsp;Drive</nobr></source>
+        <translation><nobr>加入光碟機</nobr></translation>
+    </message>
+    <message>
+        <source><nobr>Add&nbsp;Floppy&nbsp;Drive</nobr></source>
+        <translation><nobr>加入軟碟機</nobr></translation>
+    </message>
+    <message>
+        <source>Add Optical Drive</source>
+        <translation>加入光碟機</translation>
+    </message>
+    <message>
+        <source>Add Floppy Drive</source>
+        <translation>加入軟碟機</translation>
+    </message>
+    <message>
+        <source>Optical &Drive:</source>
+        <translation>光碟機(&D):</translation>
+    </message>
+    <message>
+        <source>Choose a virtual optical disk or a physical drive to use with the virtual drive. The virtual machine will see a disk inserted into the drive with the data in the file or on the disk in the physical drive as its contents.</source>
+        <translation>選擇與虛擬磁碟機使用的虛擬光碟或實體光碟機。 虛擬機器將看到插入光碟機的磁碟的檔案中資料,或實體光碟機中磁碟為其內容。</translation>
+    </message>
+    <message>
+        <source>Set up the virtual optical drive</source>
+        <translation>設定虛擬光碟機</translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -3526,14 +3956,6 @@
         <translation>指派超過主機電腦記憶體 (<b>%2</b>) 的 <b>%1%</b> 到虛擬機器。 主機的作業系統可能沒有足夠的剩餘記憶體。 請考慮選取較小的記憶體數。</translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9. It will be done automatically if you confirm your changes.</source>
-        <translation>目前未在 [系統] 頁的 [主機板] 區啟用 /IO APIC 功能。 這是需要的以便支援 ICH9 類型的晶片組。 如果您確認變更將會自動完成。</translation>
-    </message>
-    <message>
-        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device. It will be done automatically if you confirm your changes.</source>
-        <translation>目前沒有在 USB 頁面啟用 USB 控制器模擬。 這是需要的以支援模擬的 USB 輸入裝置。 如果您確認變更將會自動完成。</translation>
-    </message>
-    <message>
         <source>For performance reasons, the number of virtual CPUs attached to the virtual machine may not be more than twice the number of physical CPUs on the host (<b>%1</b>). Please reduce the number of virtual CPUs.</source>
         <translation>為了效能原因,附加到虛擬機器的虛擬 CPU 數不可多於主機中實體 CPU 數 (<b>%1</b> 顆) 的兩倍。 請降低虛擬 CPU 數。</translation>
     </message>
@@ -3542,16 +3964,32 @@
         <translation>指派超過主機系統實體 CPU (<b>%1</b> 顆) 的虛擬 CPU 到虛擬機器。 這可能會降低虛擬機器的效能。 請考慮降低除虛擬 CPU 數。</translation>
     </message>
     <message>
-        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>目前未在 [系統] 頁的 [主機板] 區啟用 /IO APIC 功能。 這是需要的以便支援一個以上的虛擬處理器。 如果您確認變更將會自動完成。</translation>
+        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
+        <translation>處理器執行上限設定成低的值。 這會使機器回應感覺變慢。</translation>
+    </message>
+    <message>
+        <source>&Paravirtualization Interface:</source>
+        <translation>半虛擬化介面(&P):</translation>
     </message>
     <message>
-        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor. It will be done automatically if you confirm your changes.</source>
-        <translation>硬體虛擬化目前未在 [系統] 頁的 [加速] 區啟用。 這是需要的以便支援一個以上的虛擬處理器。 如果您確認變更將會自動完成。</translation>
+        <source>Selects the paravirtualization guest interface provider to be used by this virtual machine.</source>
+        <translation>選取這個虛擬機器所使用的半虛擬化客體介面提供者。</translation>
     </message>
     <message>
-        <source>The processor execution cap is set to a low value. This may make the machine feel slow to respond.</source>
-        <translation>處理器執行上限設定成低的值。 這會使機器回應感覺變慢。</translation>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support a chip set of type ICH9 you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>目前未在 [系統] 頁的 [主機板] 區啟用 /IO APIC 功能。 這是需要的以便在您啟用的這個 VM 支援 ICH9 類型的晶片組。 如果您確認變更將會自動完成。</translation>
+    </message>
+    <message>
+        <source>USB controller emulation is not currently enabled on the USB page. This is needed to support an emulated USB input device you have enabled for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>目前沒有在 USB 頁面啟用 USB 控制器模擬。 這是需要的以便在您啟用的這個 VM 支援模擬的 USB 輸入裝置。 如果您確認變更將會自動完成。</translation>
+    </message>
+    <message>
+        <source>The I/O APIC feature is not currently enabled in the Motherboard section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>目前未在 [系統] 頁的 [主機板] 區啟用 /IO APIC 功能。 這是需要的以便在您選擇的這個 VM 支援一個以上的虛擬處理器。 如果您確認變更將會自動完成。</translation>
+    </message>
+    <message>
+        <source>Hardware virtualization is not currently enabled in the Acceleration section of the System page. This is needed in order to support more than one virtual processor you have chosen for this VM. It will be done automatically if you confirm your changes.</source>
+        <translation>硬體虛擬化目前未在 [系統] 頁的 [加速] 區啟用。 這是需要的以便在您選擇的這個 VM 支援一個以上的虛擬處理器。 如果您確認變更將會自動完成。</translation>
     </message>
 </context>
 <context>
@@ -3622,10 +4060,6 @@
         <translation>勾選時,啟用這部機器的虛擬 USB EHCI 控制器。 USB EHCI 控制器提供 USB 2.0 支援。</translation>
     </message>
     <message>
-        <source>Enable USB 2.0 (E&HCI) Controller</source>
-        <translation>啟用 USB 2.0 (EHCI) 控制器(&H)</translation>
-    </message>
-    <message>
         <source>USB Device &Filters</source>
         <translation>USB 裝置篩選器(&F)</translation>
     </message>
@@ -3678,8 +4112,28 @@
         <translation><nobr>狀態: %1</nobr></translation>
     </message>
     <message>
-        <source>USB 2.0 is currently enabled for this virtual machine. However, this requires the <b>%1</b> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0 to be able to start the machine.</source>
-        <translation>USB 2.0 目前在這部虛擬機器啟用。 然而這需要安裝 <b>%1</b>。 請從 VirtualBox 下載網站安裝擴充包或停用 USB 2.0 使能夠啟動機器。</translation>
+        <source>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</source>
+        <translation>勾選時,啟用這部機器的虛擬 USB OHCI 控制器。  USB OHCI 控制器提供 USB 1.0 支援。</translation>
+    </message>
+    <message>
+        <source>USB &1.1 (OHCI) Controller</source>
+        <translation>USB 1.1 (EHCI) 控制器(&1)</translation>
+    </message>
+    <message>
+        <source>USB &2.0 (EHCI) Controller</source>
+        <translation>USB 2.0 (EHCI) 控制器(&2)</translation>
+    </message>
+    <message>
+        <source>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</source>
+        <translation>勾選時,啟用這部機器的虛擬 USB xHCI 控制器。  USB xHCI 控制器提供 USB 3.0 支援。</translation>
+    </message>
+    <message>
+        <source>USB &3.0 (xHCI) Controller</source>
+        <translation>USB 3.0 (xHCI) 控制器(&3)</translation>
+    </message>
+    <message>
+        <source>USB 2.0/3.0 is currently enabled for this virtual machine. However, this requires the <i>%1</i> to be installed. Please install the Extension Pack from the VirtualBox download site or disable USB 2.0/3.0 to be able to start the machine.</source>
+        <translation>USB 2.0/3.0 目前在這部虛擬機器啟用。 然而,這需要安裝 <i>%1</i> 。 請從 VirtualBox 下載網站下載並安裝 Extension Pack 或停用 USB 2.0/3.0 使可以啟動機器。</translation>
     </message>
 </context>
 <context>
@@ -3705,7 +4159,7 @@
     </message>
     <message>
         <source>Holds the filter name.</source>
-        <translation>篩選器所使用的名稱。</translation>
+        <translation>保留篩選器名稱。</translation>
     </message>
     <message>
         <source>&Vendor ID:</source>
@@ -3805,8 +4259,8 @@
         <translation>軟碟(&F)</translation>
     </message>
     <message>
-        <source>C&lose</source>
-        <translation>關閉(&L)</translation>
+        <source>Removing medium...</source>
+        <translation>移除媒體...</translation>
     </message>
 </context>
 <context>
@@ -3825,6 +4279,29 @@
     </message>
 </context>
 <context>
+    <name>UIMenuBarEditorWidget</name>
+    <message>
+        <source>Virtual Screen Resize</source>
+        <translation>虛擬畫面調整大小</translation>
+    </message>
+    <message>
+        <source>Virtual Screen Mapping</source>
+        <translation>虛擬畫面對應</translation>
+    </message>
+    <message>
+        <source>Close</source>
+        <translation>關閉</translation>
+    </message>
+    <message>
+        <source>Switch</source>
+        <translation>切換</translation>
+    </message>
+    <message>
+        <source>Enable Menu Bar</source>
+        <translation>啟用功能表列</translation>
+    </message>
+</context>
+<context>
     <name>UIMessageCenter</name>
     <message>
         <source>VirtualBox - Information</source>
@@ -3865,10 +4342,6 @@
         <translation><p>初始化 COM 或尋找 VirtualBox COM 伺服器時失敗。 很有可能,VirtualBox 伺服器未執作或是啟動失敗。</p><p>應用程式現在將終止。</p></translation>
     </message>
     <message>
-        <source><p>Failed to create the VirtualBox COM object.</p><p>The application will now terminate.</p></source>
-        <translation><p>建立 VirtualBox COM 物件時失敗。</p><p>應用程式現在將終止。</p></translation>
-    </message>
-    <message>
         <source>Failed to set global VirtualBox properties.</source>
         <translation>設定全域 VirtualBox 內容失敗。</translation>
     </message>
@@ -3988,7 +4461,7 @@
     <message>
         <source>Result&nbsp;Code: </source>
         <comment>error info</comment>
-        <translation>結果碼(&N): </translation>
+        <translation>結果碼: </translation>
     </message>
     <message>
         <source>Component: </source>
@@ -4094,8 +4567,8 @@
         <translation><p>虛擬機器回報客體作業系統支援<b>滑鼠指標整合</b>。 這意味著不需要在客體作業系統中使用<i>擷取</i>滑鼠指標來使用它 -- 當滑鼠指標位於虛擬機器的顯示上方時,所有執行的滑鼠動作將直接傳送到客體作業系統。 如果目前已擷取滑鼠,將會自動取消擷取。</p><p>狀態列的滑鼠圖示將看起來像&nbsp;< img src=:/mouse_seamless_16px.png/ >&nbsp;以通知您客體作業系統支援滑鼠指標整合並且目前已開啟。 </p><p><b>注意</b>: 某些應用程式可能在滑鼠指標整合模式下的行為不正確。 您可以從功能表列中選取相對應的動作於目前工作階段一律停用它 (與再次啟用) 。</p></translation>
     </message>
     <message>
-        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
-        <translation><p>VirtualBox 的新版本已發佈! 版本 <b>%1</b> 在 <a href="https://www.virtualbox.org/">virtualbox.org</a>可用。</p><p>您可以使用連結:</p><p><a href=%2>%3</a></p>下載這個版本</translation>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="http://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="obsolete"><p>VirtualBox 的新版本已發佈! 版本 <b>%1</b> 在 <a href="http://www.virtualbox.org/">virtualbox.org</a>可用。</p><p>您可以使用連結:</p><p><a href=%2>%3</a></p>下載這個版本</translation>
     </message>
     <message>
         <source>Release</source>
@@ -4138,12 +4611,8 @@
         <translation>存取磁碟映像檔案 <nobr><b>%1</b></nobr> 失敗。</translation>
     </message>
     <message>
-        <source><p>One or more virtual hard disks, CD/DVD or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
-        <translation><p>一或多個虛擬硬碟、CD/DVD 或軟碟映像檔案目前不可存取。 因此您將無法操作使用這些檔案的虛擬機器,直至它們稍後成為可存取。</p><p>按下 [<b>檢查</b>] 來開啟虛擬媒體管理員視窗並查看哪些檔案不可存取或按下 [<b>忽略</b>] 以忽略這個訊息。</p></translation>
-    </message>
-    <message>
-        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
-        <translation><p>執行虛擬機器時發生關鍵錯誤並已停止機器執行。</p><p>有關協助,請查閱 <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> 的 Community 區或您的技術支援。 請提供日誌檔 <tt>VBox.log</tt> 的內容和圖像檔 <tt>VBox.png</tt>,您可以在 <nobr><b>%1</b></nobr> 目錄找到,以及說明您正在做什麼時發生此錯誤。 請注意,您也可以從 VirtualBox 主視窗的<b>機器</b>功能表選取<b>顯示紀錄</b>存取以上檔案。</p><p>如果您要關閉機器按下 [<b>確定</b>] 或如果您要保留它作為除錯按下 [<b>忽略 [...]
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nobr& [...]
+        <translation type="obsolete"><p>執行虛擬機器時發生關鍵錯誤並已停止機器執行。</p><p>有關協助,請查閱 <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> 的 Community 區或您的技術支援。 請提供日誌檔 <tt>VBox.log</tt> 的內容和圖像檔 <tt>VBox.png</tt>,您可以在 <nobr><b>%1</b></nobr> 目錄找到,以及說明您正在做什麼時發生此錯誤。 請注意,您也可以從 VirtualBox 主視窗的<b>機器</b>功能表選取<b>顯示紀錄</b>存取以上檔案。</p><p>如果您要關閉機器按下 [<b>確定</b>] 或如果您要保留它作為除錯按 [...]
     </message>
     <message>
         <source>The following files already exist:<br /><br />%1<br /><br />Are you sure you want to replace them? Replacing them will overwrite their contents.</source>
@@ -4242,10 +4711,6 @@
         <translation>強制卸載</translation>
     </message>
     <message>
-        <source><p>Are you sure you want to delete the CD/DVD device?</p><p>You will not be able to insert any CDs or ISO images or install the Guest Additions without it!</p></source>
-        <translation><p>您確定要刪除 CD/DVD 裝置嗎?</p><p>沒有它您將無法放入任何 CD 或 ISO 映像或安裝 Guest Additions!</p></translation>
-    </message>
-    <message>
         <source>&Remove</source>
         <comment>medium</comment>
         <translation>移除(&R)</translation>
@@ -4292,11 +4757,7 @@
     </message>
     <message>
         <source><p>You are about to add a virtual hard disk to controller <b>%1</b>.</p><p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p></source>
-        <translation><p>您即將加入虛擬硬碟到控制器 <b>%1</b>。</p><p>您希望建立新的空檔案來持有磁碟內容或選取現有的檔案?</p></translation>
-    </message>
-    <message>
-        <source><p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual CD/DVD disk to put in the drive or to leave it empty for now?</p></source>
-        <translation><p>您即將加入新的 CD/DVD 光碟機到控制器 <b>%1</b>。</p><p>您希望選擇虛擬 CD/DVD 磁碟放在光碟機或現在保持為空嗎?</p></translation>
+        <translation><p>您即將加入虛擬硬碟到控制器 <b>%1</b>。</p><p>您希望建立新的空檔案來保留磁碟內容或選取現有的檔案?</p></translation>
     </message>
     <message>
         <source><p>You are about to add a new floppy drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual floppy disk to put in the drive or to leave it empty for now?</p></source>
@@ -4307,14 +4768,6 @@
         <translation>從機器 <b>%3</b> 的插槽 <i>%2</i> 分離硬碟裝置 (<nobr><b>%1</b></nobr>) 失敗。</translation>
     </message>
     <message>
-        <source>Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>從機器 <b>%3</b> 的插槽 <i>%2</i> 分離 CD/DVD 裝置 (<nobr><b>%1</b></nobr>) 失敗。</translation>
-    </message>
-    <message>
-        <source>Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>從機器 <b>%3</b> 的插槽 <i>%2</i> 分離軟碟裝置 (<nobr><b>%1</b></nobr>) 失敗。</translation>
-    </message>
-    <message>
         <source>Failed to update Guest Additions. The Guest Additions disk image file will be inserted for user installation.</source>
         <translation>更新 Guest Additions 失敗。 將放入 Guest Additions 磁碟映像檔案供使用者安裝。</translation>
     </message>
@@ -4343,14 +4796,6 @@
         <translation>在機器 <b>%3</b> 的插槽 <i>%2</i> 附加硬碟裝置 (<nobr><b>%1</b></nobr>) 失敗。</translation>
     </message>
     <message>
-        <source>Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>在機器 <b>%3</b> 的插槽 <i>%2</i> 附加 CD/DVD 裝置 (<nobr><b>%1</b></nobr>) 失敗。</translation>
-    </message>
-    <message>
-        <source>Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
-        <translation>在機器 <b>%3</b> 的插槽 <i>%2</i> 附加軟碟裝置 (<nobr><b>%1</b></nobr>) 失敗。</translation>
-    </message>
-    <message>
         <source><p>Note that the storage unit of this medium will not be deleted and that it will be possible to use it later again.</p></source>
         <translation><p>請注意,這個媒體的存放單元將不會刪除且可以稍後再次使用。</p></translation>
     </message>
@@ -4543,7 +4988,7 @@
     </message>
     <message>
         <source>Failed to drop data.</source>
-        <translation>拖放資料失敗。</translation>
+        <translation type="obsolete">拖放資料失敗。</translation>
     </message>
     <message>
         <source><p>Are you sure you want to discard the saved state of the following virtual machines?</p><p><b>%1</b></p><p>This operation is equivalent to resetting or powering off the machine without doing a proper shutdown of the guest OS.</p></source>
@@ -4679,7 +5124,7 @@
     </message>
     <message>
         <source><p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>無法放入虛擬光碟 <nobr><b>%1</b></nobr> 至虛擬機器 <b>%1</b>。</p></translation>
+        <translation><p>無法放入虛擬光碟 <nobr><b>%1</b></nobr> 至虛擬機器 <b>%2</b>。</p></translation>
     </message>
     <message>
         <source><p>Would you like to try to force insertion of this disk?</p></source>
@@ -4695,7 +5140,7 @@
     </message>
     <message>
         <source><p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p></source>
-        <translation><p>無法放入虛擬軟碟 <nobr><b>%1</b></nobr> 至虛擬機器 <b>%1</b>。</p></translation>
+        <translation><p>無法放入虛擬軟碟 <nobr><b>%1</b></nobr> 至虛擬機器 <b>%2</b>。</p></translation>
     </message>
     <message>
         <source><p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p></source>
@@ -4769,14 +5214,6 @@
         <translation><p>從 <nobr><a href="%1">%1</a></nobr> 下載 <b>VirtualBox Guest Additions</b> 磁碟映像檔案成功,但無法在本機儲存為  <nobr><b>%2</b>。</nobr></p><p>請為該檔案選擇另一個位置。</p></translation>
     </message>
     <message>
-        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p></source>
-        <translation><p>從 <nobr><a href="%1">%1</a></nobr> 下載 <b>VirtualBox Guest Additions</b> 磁碟映像檔案成功並在本機儲存為 <nobr><b>%2</b>。</nobr></p><p>您希望註冊此磁碟映像檔案並放入到虛擬 CD/DVD 磁碟機嗎?</p></translation>
-    </message>
-    <message>
-        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no CD/DVD drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
-        <translation><p>無法放入 <b>VirtualBox Guest Additions</b> 磁碟映像檔案到虛擬機器 <b>%1</b>,因為機器沒有 CD/DVD 磁碟機。 請使用虛擬機器設定視窗的 [存放裝置] 頁面加入磁碟機。</p></translation>
-    </message>
-    <message>
         <source><p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p><p>Do you wish to download this file from the Internet?</p></source>
         <translation><p>找不到 <b>VirtualBox 使用者手冊</b> <nobr><b>%1</b>。</nobr></p><p>您希望從 Internet 下載此檔案嗎?</p></translation>
     </message>
@@ -4790,7 +5227,7 @@
     </message>
     <message>
         <source><p>The VirtualBox User Manual has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p></source>
-        <translation><p>從 <nobr><a href="%1">%1</a></nobr> 下載 VirtualBox 使用者手冊成功並在本機儲存為 <nobr><b>%2</b>。</translation>
+        <translation><p>從 <nobr><a href="%1">%1</a></nobr> 下載 VirtualBox 使用者手冊成功並在本機儲存為 <nobr><b>%2</b>。</nobr></p></translation>
     </message>
     <message>
         <source>Close</source>
@@ -4809,25 +5246,137 @@
         <translation><p>您確定要移除 NAT 網路 <nobr><b>%1</b> 嗎?</nobr></p><p>如果一個或數個虛擬機器網路卡正在使用此網路,除非選擇不同的網路名稱或以不同的網路卡附加類型來修正其設定,否則這些網路卡將不再能使用。</p></translation>
     </message>
     <message>
+        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
+        <translation>附加 Webcam <b>%1</b> 到虛擬機器 <b>%2</b> 失敗。</translation>
+    </message>
+    <message>
+        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
+        <translation>從虛擬機器 <b>%2</b> 附加 Webcam <b>%1</b> 失敗。</translation>
+    </message>
+    <message>
+        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
+        <translation><p>VirtualBox Guest Additions 似乎在這部虛擬機器不可使用,因此共用資料夾無法使用。 若要在虛擬機器內使用共用資料夾,如果未安裝則請安裝 Guest Additions ,或者如果是未正常動作則請重新安裝,從<b>裝置</b>功能表選取<b>插入 Guest Additions CD 映像</b>。 如果已安裝但機器尚未完全啟動,則共用資料夾將在啟動後可以使用。</p></translation>
+    </message>
+    <message>
         <source>Insert</source>
         <comment>additions</comment>
         <translation>插入</translation>
     </message>
     <message>
-        <source><p>The VirtualBox Guest Additions do not appear to be available on this virtual machine, and shared folders cannot be used without them. To use shared folders inside the virtual machine, please install the Guest Additions if they are not installed, or re-install them if they are not working correctly, by selecting <b>Insert Guest Additions CD image</b> from the <b>Devices</b> menu. If they are installed but the machine is not yet fully starte [...]
-        <translation><p>VirtualBox Guest Additions 似乎在這部虛擬機器不可使用,因此共用資料夾無法使用。 若要在虛擬機器內使用共用資料夾,如果未安裝則請安裝 Guest Additions ,或者如果是未正常動作則請重新安裝,從<b>裝置</b>功能表選取<b>插入 Guest Additions CD 映像</b>。 如果已安裝但機器尚未完全啟動,則共用資料夾將在啟動後可以使用。</p></translation>
+        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
+        <translation><p>虛擬螢幕目前設成 <b>%1&nbsp;位元</b>色彩模式。 為了更好的效能,請變更此為 <b>%2&nbsp;位元</b>。 這通常能從客體作業系統的控制台或系統設定中的<b>顯示</b>區段完成。</p></translation>
     </message>
     <message>
-        <source>Failed to attach the webcam <b>%1</b> to the virtual machine <b>%2</b>.</source>
-        <translation>附加 Webcam <b>%1</b> 到虛擬機器 <b>%2</b> 失敗。</translation>
+        <source>The current port forwarding rules are not valid. Rule names should be unique.</source>
+        <translation>目前連接埠轉送規則無效。規則名稱應該唯一。</translation>
     </message>
     <message>
-        <source>Failed to detach the webcam <b>%1</b> from the virtual machine <b>%2</b>.</source>
-        <translation>從虛擬機器 <b>%2</b> 附加 Webcam <b>%1</b> 失敗。</translation>
+        <source>The current port forwarding rules are not valid. Few rules have same host ports and conflicting IP addresses.</source>
+        <translation>目前連接埠轉送規則無效。 一些規則具有相同的主機埠和 IP 位址衝突。</translation>
     </message>
     <message>
-        <source><p>The virtual screen is currently set to a <b>%1&nbsp;bit</b> color mode. For better performance please change this to <b>%2&nbsp;bit</b>. This can usually be done from the <b>Display</b> section of the guest operating system's Control Panel or System Settings.</p></source>
-        <translation><p>虛擬螢幕目前設成 <b>%1&nbsp;位元</b>色彩模式。 為了更好的效能,請變更此為 <b>%2&nbsp;位元</b>。 這通常能從客體作業系統的控制台或系統設定中的<b>顯示</b>區段完成。</p></translation>
+        <source><p>Failed to create the VirtualBoxClient COM object.</p><p>The application will now terminate.</p></source>
+        <translation><p>建立 VirtualBoxClient COM 物件時失敗。</p><p>應用程式現在將終止。</p></translation>
+    </message>
+    <message>
+        <source>Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.</source>
+        <translation>設定機碼 <i>%1</i> 的全域 VirtualBox 額外資料為數值 <i>{%2}</i> 失敗。</translation>
+    </message>
+    <message>
+        <source>Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.</source>
+        <translation>設定機器 <i>%2</i> 機碼<i>%1</i> 的額外資料為數值 <i>{%3}</i> 失敗。</translation>
+    </message>
+    <message>
+        <source><p>One or more virtual hard disks, optical or floppy disk image files are not currently accessible. As a result, you will not be able to operate virtual machines that use these files until they become accessible later.</p><p>Press <b>Check</b> to open the Virtual Media Manager window and see which files are inaccessible, or press <b>Ignore</b> to ignore this message.</p></source>
+        <translation><p>一或多個虛擬硬碟、光碟機 或軟碟映像檔案目前不可存取。 因此您將無法操作使用這些檔案的虛擬機器,直至它們稍後成為可存取。</p><p>按下 [<b>檢查</b>] 來開啟虛擬媒體管理員視窗並查看哪些檔案不可存取或按下 [<b>忽略</b>] 以忽略這個訊息。</p></translation>
+    </message>
+    <message>
+        <source>Failed to save the settings.</source>
+        <translation>儲存設定失敗。</translation>
+    </message>
+    <message>
+        <source><p>You are about to add a new optical drive to controller <b>%1</b>.</p><p>Would you like to choose a virtual optical disk to put in the drive or to leave it empty for now?</p></source>
+        <translation><p>您即將加入新的光碟機到控制器 <b>%1</b>。</p><p>您希望選擇虛擬光碟以放在光碟機或現在保持為空嗎?</p></translation>
+    </message>
+    <message>
+        <source><p>Are you sure you want to delete the optical drive?</p><p>You will not be able to insert any optical disks or ISO images or install the Guest Additions without it!</p></source>
+        <translation><p>您確定要刪除光碟機嗎?</p><p>沒有它您將無法放入任何光碟或 ISO 映像或安裝 Guest Additions!</p></translation>
+    </message>
+    <message>
+        <source>Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>在機器 <b>%3</b> 的插槽 <i>%2</i> 附加光碟機 (<nobr><b>%1</b></nobr>) 失敗。</translation>
+    </message>
+    <message>
+        <source>Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>在機器 <b>%3</b> 的插槽 <i>%2</i> 附加軟碟機 (<nobr><b>%1</b></nobr>) 失敗。</translation>
+    </message>
+    <message>
+        <source>Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>在機器 <b>%3</b> 的插槽 <i>%2</i> 分離光碟機 (<nobr><b>%1</b></nobr>) 失敗。</translation>
+    </message>
+    <message>
+        <source>Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.</source>
+        <translation>在機器 <b>%3</b> 的插槽 <i>%2</i> 分離軟碟機 (<nobr><b>%1</b></nobr>) 失敗。</translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this er [...]
+        <translation type="obsolete"><p>執行虛擬機器時發生嚴重錯誤,且需要停止執行虛擬機器。</p><p>請查看在 <a href=http://www.virtualbox.org>http://www.virtualbox.org</a> 的 Community 區或您的技術支援合約取得協助。 請提供日誌檔案 <tt>VBox.log</tt> 的內容。您可以在虛擬機器的 log 目錄找到,以及發生此錯誤時的動作描述。 請注意,您也可以從 VirtualBox 主視窗的 [<b>機器</b>] 功能表選取 [<b>顯示日誌</b>] 來存取上述檔案。</p><p>按下 [<b>確定</b>] 以關閉機器。</p></translation>
+    </message>
+    <message>
+        <source>Failed to connect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">連接虛擬機器 <b>%1</b> 的網路卡失敗。</translation>
+    </message>
+    <message>
+        <source>Failed to disconnect network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="obsolete">中斷連接虛擬機器 <b>%1</b> 的網路卡失敗。</translation>
+    </message>
+    <message>
+        <source><p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, as the machine has no optical drives. Please add a drive using the storage page of the virtual machine settings window.</p></source>
+        <translation><p>無法放入 <b>VirtualBox Guest Additions</b> 磁碟映像檔案到虛擬機器 <b>%1</b>,因為機器沒有光碟機。 請使用虛擬機器設定視窗的 [存放裝置] 頁面加入磁碟機。</p></translation>
+    </message>
+    <message>
+        <source>Unable to enter password!</source>
+        <translation type="obsolete">無法輸入密碼!</translation>
+    </message>
+    <message>
+        <source><p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded from <nobr><a href="%1">%1</a></nobr> and saved locally as <nobr><b>%2</b>.</nobr></p><p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p></source>
+        <translation><p>從 <nobr><a href="%1">%1</a></nobr> 下載 <b>VirtualBox Guest Additions</b> 磁碟映像檔案成功並在本機儲存為 <nobr><b>%2</b>。</nobr></p><p>您希望註冊此磁碟映像檔案並放入到虛擬光碟機嗎?</p></translation>
+    </message>
+    <message>
+        <source>Bad password or authentication failure.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution has been stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, which you can find in the <nobr><b>%1</b></nob [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A critical error has occurred while running the virtual machine and the machine execution should be stopped.</p><p>For help, please see the Community section on <a href=https://www.virtualbox.org>https://www.virtualbox.org</a> or your support contract. Please provide the contents of the log file <tt>VBox.log</tt>, which you can find in the virtual machine log directory, as well as a description of what you were doing when this  [...]
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href="https://www.virtualbox.org/">virtualbox.org</a>.</p><p>You can download this version using the link:</p><p><a href=%2>%3</a></p></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from host to guest failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Unable to cancel host to guest drag and drop operation.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Drag and drop operation from guest to host failed.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to connect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -4863,12 +5412,12 @@
 <context>
     <name>UINameAndSystemEditor</name>
     <message>
-        <source>&Name:</source>
-        <translation>名稱(&N):</translation>
+        <source>N&ame:</source>
+        <translation>名稱(&A):</translation>
     </message>
     <message>
         <source>Holds the name of the virtual machine.</source>
-        <translation>虛擬機器所使用的名稱。</translation>
+        <translation>保留虛擬機器的名稱。</translation>
     </message>
     <message>
         <source>&Type:</source>
@@ -5051,14 +5600,18 @@
         <translation>虛擬機器檔案 (%1)</translation>
     </message>
     <message>
-        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
-        <translation><h3>歡迎使用 VirtualBox!</h3><p>此視窗的左側是電腦中所有虛擬機器的清單。 此清單目前是空的因為尚未建立任何虛擬機器。<img src=:/welcome.png align=right/></p><p>為了新建虛擬機器,按下位於視窗頂端的主工具列的 [<b>新增</b>] 按鈕。</p><p>您可以按下 <b>%1</b> 鍵取得即時說明,或訪問 <a href=https://www.virtualbox.org>www.virtualbox.org</a> 取得最新資訊和新聞。</p></translation>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="obsolete"><h3>歡迎使用 VirtualBox!</h3><p>此視窗的左側是電腦中所有虛擬機器的清單。 此清單目前是空的因為尚未建立任何虛擬機器。<img src=:/welcome.png align=right/></p><p>為了新建虛擬機器,按下位於視窗頂端的主工具列的 [<b>新增</b>] 按鈕。</p><p>您可以按下 <b>%1</b> 鍵取得即時說明,或訪問 <a href=http://www.virtualbox.org>www.virtualbox.org</a> 取得最新資訊和新聞。</p></translation>
     </message>
     <message>
         <source>Manager</source>
         <comment>Note: main window title which is pretended by the product name.</comment>
         <translation>管理員</translation>
     </message>
+    <message>
+        <source><h3>Welcome to VirtualBox!</h3><p>The left part of this window is  a list of all virtual machines on your computer. The list is empty now because you haven't created any virtual machines yet.<img src=:/welcome.png align=right/></p><p>In order to create a new virtual machine, press the <b>New</b> button in the main tool bar located at the top of the window.</p><p>You can press the <b>%1</b> key to [...]
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISession</name>
@@ -5079,7 +5632,7 @@
     </message>
     <message>
         <source>Settings</source>
-        <translation>設定值</translation>
+        <translation type="obsolete">設定值</translation>
     </message>
     <message>
         <source><b>%1</b> page:</source>
@@ -5128,6 +5681,10 @@
         <source>Display</source>
         <translation>顯示</translation>
     </message>
+    <message>
+        <source>Preferences</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>UISettingsDialogMachine</name>
@@ -5161,7 +5718,7 @@
     </message>
     <message>
         <source>Serial Ports</source>
-        <translation>序列埠</translation>
+        <translation>串列埠</translation>
     </message>
     <message>
         <source>Parallel Ports</source>
@@ -5179,6 +5736,43 @@
         <source>%1 - %2</source>
         <translation>%1 - %2</translation>
     </message>
+    <message>
+        <source>User Interface</source>
+        <translation>使用者介面</translation>
+    </message>
+    <message>
+        <source>Settings</source>
+        <translation type="unfinished">設定值</translation>
+    </message>
+</context>
+<context>
+    <name>UISettingsSerializerProgress</name>
+    <message>
+        <source>Loading Settings...</source>
+        <translation>正在載入設定...</translation>
+    </message>
+    <message>
+        <source>Saving Settings...</source>
+        <translation>正在儲存設定...</translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorButton</name>
+    <message>
+        <source><nobr><b>Click</b> to toggle indicator presence.</nobr><br><nobr><b>Drag&Drop</b> to change indicator position.</nobr></source>
+        <translation><nobr><b>按一下</b>以切換顯示指示器。</nobr><br><nobr><b>拖曳</b>以變更指示器位置。</nobr></translation>
+    </message>
+</context>
+<context>
+    <name>UIStatusBarEditorWidget</name>
+    <message>
+        <source>Close</source>
+        <translation>關閉</translation>
+    </message>
+    <message>
+        <source>Enable Status Bar</source>
+        <translation>啟用狀態列</translation>
+    </message>
 </context>
 <context>
     <name>UITextEditor</name>
@@ -5288,31 +5882,137 @@
         <translation><p>關閉虛擬機器電源。</p><p>請注意這個動作將立即停止機器執行,以致執行在客體內部的作業系統無法執行乾淨關機程序,這可能會導致虛擬機器中的<i>資料遺失</i>。 建議只有在虛擬機器對<b>傳送關機訊號</b>動作沒有回應時才選取這個動作。</p></translation>
     </message>
     <message>
-        <source>&Power off the machine</source>
-        <translation>機器關機(&P)</translation>
+        <source>&Power off the machine</source>
+        <translation>機器關機(&P)</translation>
+    </message>
+    <message>
+        <source>Restore the machine state stored in the current snapshot</source>
+        <translation>還原儲存在目前快照的機器狀態</translation>
+    </message>
+    <message>
+        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
+        <translation><p>勾選時,機器將在關閉之後返回目前快照中儲存的狀態。 這是有用的,如果您確認要放棄上次的工作階段結果並再次啟動該快照。</p></translation>
+    </message>
+    <message>
+        <source>&Restore current snapshot '%1'</source>
+        <translation>還原目前快照「%1」(&R)</translation>
+    </message>
+    <message>
+        <source>&Continue running in the background</source>
+        <translation>繼續在背景執行(&C)</translation>
+    </message>
+    <message>
+        <source><p>Close the virtual machine windows but keep the virtual machine running.</p><p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p></source>
+        <translation><p>關閉虛擬機器視窗但保持虛擬機器執行中。</p><p>您可以使用 VirtualBox 管理員以返回執行中虛擬機器在視窗。</p></translation>
+    </message>
+</context>
+<context>
+    <name>UIVMDesktop</name>
+    <message>
+        <source>&Details</source>
+        <translation>詳細資料(&D)</translation>
+    </message>
+    <message>
+        <source>&Snapshots</source>
+        <translation>快照(&S)</translation>
+    </message>
+</context>
+<context>
+    <name>UIVMInfoDialog</name>
+    <message>
+        <source>%1 - Session Information</source>
+        <translation>%1 - 工作階段資訊</translation>
+    </message>
+    <message>
+        <source>DMA Transfers</source>
+        <translation>DMA 傳輸</translation>
+    </message>
+    <message>
+        <source>PIO Transfers</source>
+        <translation>PIO 傳輸</translation>
+    </message>
+    <message>
+        <source>Data Read</source>
+        <translation>資料讀取</translation>
+    </message>
+    <message>
+        <source>Data Written</source>
+        <translation>資料寫入</translation>
+    </message>
+    <message>
+        <source>Data Transmitted</source>
+        <translation>資料已傳送</translation>
+    </message>
+    <message>
+        <source>Data Received</source>
+        <translation>資料已接收</translation>
+    </message>
+    <message>
+        <source>Runtime Attributes</source>
+        <translation>執行階段屬性</translation>
+    </message>
+    <message>
+        <source>Screen Resolution</source>
+        <translation>螢幕解析度</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest additions</comment>
+        <translation>未偵測到</translation>
+    </message>
+    <message>
+        <source>Not Detected</source>
+        <comment>guest os type</comment>
+        <translation>未偵測到</translation>
+    </message>
+    <message>
+        <source>Guest Additions</source>
+        <translation>Guest Additions</translation>
+    </message>
+    <message>
+        <source>Guest OS Type</source>
+        <translation>客體作業系統類型</translation>
+    </message>
+    <message>
+        <source>No Network Adapters</source>
+        <translation>沒有網路卡</translation>
+    </message>
+    <message>
+        <source>Storage Statistics</source>
+        <translation>存放裝置統計</translation>
+    </message>
+    <message>
+        <source>No Storage Devices</source>
+        <translation>沒有存放裝置</translation>
+    </message>
+    <message>
+        <source>Network Statistics</source>
+        <translation>網路統計</translation>
+    </message>
+    <message>
+        <source>Not Available</source>
+        <comment>details report (VRDE server port)</comment>
+        <translation>不可用</translation>
     </message>
     <message>
-        <source>Restore the machine state stored in the current snapshot</source>
-        <translation>還原儲存在目前快照的機器狀態</translation>
+        <source>Clipboard Mode</source>
+        <translation>剪貼簿模式</translation>
     </message>
     <message>
-        <source><p>When checked, the machine will be returned to the state stored in the current snapshot after it is turned off. This is useful if you are sure that you want to discard the results of your last sessions and start again at that snapshot.</p></source>
-        <translation><p>勾選時,機器將在關閉之後返回目前快照中儲存的狀態。 這是有用的,如果您確認要放棄上次的工作階段結果並再次啟動該快照。</p></translation>
+        <source>Configuration &Details</source>
+        <translation>組態詳細資料(&D)</translation>
     </message>
     <message>
-        <source>&Restore current snapshot '%1'</source>
-        <translation>還原目前快照「%1」(&R)</translation>
+        <source>&Runtime Information</source>
+        <translation>執行階段資訊(&R)</translation>
     </message>
-</context>
-<context>
-    <name>UIVMDesktop</name>
     <message>
-        <source>&Details</source>
-        <translation>詳細資料(&D)</translation>
+        <source>VM Uptime</source>
+        <translation>VM 開機時間</translation>
     </message>
     <message>
-        <source>&Snapshots</source>
-        <translation>快照(&S)</translation>
+        <source>Drag and Drop Mode</source>
+        <translation>拖放模式</translation>
     </message>
 </context>
 <context>
@@ -5402,12 +6102,20 @@
 <context>
     <name>UIWizard</name>
     <message>
-        <source>Hide Description</source>
-        <translation>隱藏描述</translation>
+        <source>&Expert Mode</source>
+        <translation>專家模式(&E)</translation>
+    </message>
+    <message>
+        <source>Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users.</source>
+        <translation>切換到<nobr><b>專家模式</b></nobr>,針對有經驗使用者的一頁對話方塊。</translation>
+    </message>
+    <message>
+        <source>&Guided Mode</source>
+        <translation>指導模式(&G)</translation>
     </message>
     <message>
-        <source>Show Description</source>
-        <translation>顯示描述</translation>
+        <source>Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations.</source>
+        <translation>切換到<nobr><b>指導模式</b></nobr>,含詳細解釋的逐步對話方塊。</translation>
     </message>
 </context>
 <context>
@@ -5689,11 +6397,11 @@
     </message>
     <message>
         <source>Open Virtualization Format Archive (%1)</source>
-        <translation>Open Virtualization Format Archive (%1)</translation>
+        <translation>開啟 Virtualization Format Archive (%1)</translation>
     </message>
     <message>
         <source>Open Virtualization Format (%1)</source>
-        <translation>Open Virtualization Format (%1)</translation>
+        <translation>開啟 Virtualization Format (%1)</translation>
     </message>
     <message>
         <source>Write in legacy OVF 0.9 format for compatibility with other virtualization products.</source>
@@ -5833,7 +6541,7 @@
     </message>
     <message>
         <source>Open Virtualization Format (%1)</source>
-        <translation>Open Virtualization Format (%1)</translation>
+        <translation>開啟 Virtualization Format (%1)</translation>
     </message>
     <message>
         <source>Appliance settings</source>
@@ -5955,7 +6663,7 @@
     </message>
     <message>
         <source>Please choose a descriptive name for the new virtual machine and select the type of operating system you intend to install on it. The name you choose will be used throughout VirtualBox to identify this machine.</source>
-        <translation>請選擇新虛擬機器的描述性名稱,並選取您打算在其上安裝的作業系統類型。 VirtualBox 將使用整個選擇的名稱來識別此機器。</translation>
+        <translation>請選擇新虛擬機器的描述性名稱,並選取您打算在上面安裝的作業系統類型。 VirtualBox 將使用整個選擇的名稱來識別此機器。</translation>
     </message>
     <message>
         <source>Memory size</source>
@@ -6254,11 +6962,6 @@
         <translation>軟碟</translation>
     </message>
     <message>
-        <source>CD/DVD</source>
-        <comment>DeviceType</comment>
-        <translation>CD/DVD</translation>
-    </message>
-    <message>
         <source>Hard Disk</source>
         <comment>DeviceType</comment>
         <translation>硬碟</translation>
@@ -6316,7 +7019,7 @@
     <message>
         <source>Not supported</source>
         <comment>USBDeviceState</comment>
-        <translation>未支援</translation>
+        <translation>不支援</translation>
     </message>
     <message>
         <source>Unavailable</source>
@@ -6376,7 +7079,7 @@
     <message>
         <source>Serial Ports</source>
         <comment>details report</comment>
-        <translation>序列埠</translation>
+        <translation>串列埠</translation>
     </message>
     <message>
         <source>USB</source>
@@ -6611,7 +7314,7 @@
     <message>
         <source>Nested Paging</source>
         <comment>details report</comment>
-        <translation>Nested Paging</translation>
+        <translation>巢式分頁</translation>
     </message>
     <message>
         <source>Enabled</source>
@@ -6847,21 +7550,6 @@
         <comment>medium</comment>
         <translation><b>沒有可用的磁碟映像檔案</b></translation>
     </message>
-    <message>
-        <source>Attaching this hard disk will be performed indirectly using a newly created differencing hard disk.</source>
-        <comment>medium</comment>
-        <translation>附加這個硬碟將使用新建立的差異硬碟間接執行。</translation>
-    </message>
-    <message>
-        <source>Some of the files in this hard disk chain are inaccessible. Please use the Virtual Media Manager in <b>Show Differencing Hard Disks</b> mode to inspect these files.</source>
-        <comment>medium</comment>
-        <translation>在這個硬碟鏈結中某些檔案無法存取。 請使用虛擬媒體管理員在<b>顯示差異硬碟</b>模式來檢查這些檔案。</translation>
-    </message>
-    <message>
-        <source>This base hard disk is indirectly attached using the following differencing hard disk:</source>
-        <comment>medium</comment>
-        <translation>這個基礎硬碟使用以下差異硬碟間接附加:</translation>
-    </message>
     <message numerus="yes">
         <source>%n year(s)</source>
         <translation>
@@ -6899,10 +7587,6 @@
         </translation>
     </message>
     <message>
-        <source>(CD/DVD)</source>
-        <translation>(CD/DVD)</translation>
-    </message>
-    <message>
         <source>Screens</source>
         <comment>details report</comment>
         <translation>畫面</translation>
@@ -6949,7 +7633,7 @@
     </message>
     <message>
         <source>Nested Paging</source>
-        <translation>Nested Paging</translation>
+        <translation>巢式分頁</translation>
     </message>
     <message>
         <source>Unknown device</source>
@@ -7262,7 +7946,7 @@
     <message>
         <source>Serial ports</source>
         <comment>DetailsElementType</comment>
-        <translation>序列埠</translation>
+        <translation>串列埠</translation>
     </message>
     <message>
         <source>Parallel ports</source>
@@ -7337,16 +8021,6 @@
         <translation>請選擇新虛擬硬碟檔案的位置</translation>
     </message>
     <message>
-        <source>Enabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>啟用</translation>
-    </message>
-    <message>
-        <source>Disabled</source>
-        <comment>details report (Unrestricted Execution)</comment>
-        <translation>停用</translation>
-    </message>
-    <message>
         <source>Unrestricted Execution</source>
         <comment>details report</comment>
         <translation>無限制的執行</translation>
@@ -7392,7 +8066,156 @@
     </message>
     <message>
         <source>You can create or add disk image files in the virtual machine settings.</source>
-        <translation>您可以使用虛擬機器設定建立或加入磁碟映像檔案。</translation>
+        <translation>您可以在虛擬機器設定建立或加入磁碟映像檔案。</translation>
+    </message>
+    <message>
+        <source>USB</source>
+        <comment>StorageControllerType</comment>
+        <translation>USB</translation>
+    </message>
+    <message>
+        <source>USB Port %1</source>
+        <comment>StorageSlot</comment>
+        <translation>USB 連接埠 %1</translation>
+    </message>
+    <message>
+        <source>off</source>
+        <comment>guest monitor status</comment>
+        <translation>關閉</translation>
+    </message>
+    <message>
+        <source>Paravirtualization Interface</source>
+        <comment>details report</comment>
+        <translation>半虛擬化介面</translation>
+    </message>
+    <message>
+        <source>None</source>
+        <comment>ParavirtProvider</comment>
+        <translation>無</translation>
+    </message>
+    <message>
+        <source>Default</source>
+        <comment>ParavirtProvider</comment>
+        <translation>預設值</translation>
+    </message>
+    <message>
+        <source>Legacy</source>
+        <comment>ParavirtProvider</comment>
+        <translation>舊版</translation>
+    </message>
+    <message>
+        <source>Minimal</source>
+        <comment>ParavirtProvider</comment>
+        <translation>最小</translation>
+    </message>
+    <message>
+        <source>Hyper-V</source>
+        <comment>ParavirtProvider</comment>
+        <translation>Hyper-V</translation>
+    </message>
+    <message>
+        <source>New dynamically allocated storage</source>
+        <comment>MediumVariant</comment>
+        <translation>新增動態配置存放裝置</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>啟動</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (VT-x/AMD-V)</comment>
+        <translation>停用</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>啟動</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Nested Paging)</comment>
+        <translation>停用</translation>
+    </message>
+    <message>
+        <source>Active</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>啟動</translation>
+    </message>
+    <message>
+        <source>Inactive</source>
+        <comment>details report (Unrestricted Execution)</comment>
+        <translation>停用</translation>
+    </message>
+    <message>
+        <source>Taking Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>拍照</translation>
+    </message>
+    <message>
+        <source>Taking Online Snapshot</source>
+        <comment>MachineState</comment>
+        <translation>取得線上快照</translation>
+    </message>
+    <message>
+        <source>KVM</source>
+        <comment>ParavirtProvider</comment>
+        <translation>KVM</translation>
+    </message>
+    <message>
+        <source>Optical</source>
+        <comment>DeviceType</comment>
+        <translation>光碟機</translation>
+    </message>
+    <message>
+        <source>TCP</source>
+        <comment>PortMode</comment>
+        <translation>TCP</translation>
+    </message>
+    <message>
+        <source>OHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>OHCI</translation>
+    </message>
+    <message>
+        <source>EHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>EHCI</translation>
+    </message>
+    <message>
+        <source>xHCI</source>
+        <comment>USBControllerType</comment>
+        <translation>xHCI</translation>
+    </message>
+    <message>
+        <source>User interface</source>
+        <comment>DetailsElementType</comment>
+        <translation>使用者介面</translation>
+    </message>
+    <message>
+        <source>(Optical Drive)</source>
+        <translation>(光碟機)</translation>
+    </message>
+    <message>
+        <source>Attaching this hard drive will be performed indirectly using a newly created differencing hard drive.</source>
+        <comment>medium</comment>
+        <translation>附加這個硬碟機將使用新建立的差異硬碟機間接執行。</translation>
+    </message>
+    <message>
+        <source>Some of the files in this hard drive chain are inaccessible. Please use the Virtual Medium Manager to inspect these files.</source>
+        <comment>medium</comment>
+        <translation>在這個硬碟機鏈結中某些檔案無法存取。 請使用虛擬媒體管理員來檢查這些檔案。</translation>
+    </message>
+    <message>
+        <source>This base hard drive is indirectly attached using the following differencing hard drive:</source>
+        <comment>medium</comment>
+        <translation>這個基礎硬碟機使用以下差異硬碟機間接附加:</translation>
+    </message>
+    <message>
+        <source>Encrypted</source>
+        <comment>medium</comment>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -7524,6 +8347,18 @@
         <source>Modify the attributes of the selected disk image file</source>
         <translation>修改選取磁碟映像檔案的屬性</translation>
     </message>
+    <message>
+        <source>UUID:</source>
+        <translation>UUID:</translation>
+    </message>
+    <message>
+        <source><i>Not&nbsp;Encrypted</i></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Encrypted with key:</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>VBoxScreenshotViewer</name>
@@ -7708,102 +8543,4 @@
         <translation>沒有已支援的裝置連接到主機 PC</translation>
     </message>
 </context>
-<context>
-    <name>VBoxVMInformationDlg</name>
-    <message>
-        <source>%1 - Session Information</source>
-        <translation>%1 - 工作階段資訊</translation>
-    </message>
-    <message>
-        <source>DMA Transfers</source>
-        <translation>DMA 傳輸</translation>
-    </message>
-    <message>
-        <source>PIO Transfers</source>
-        <translation>PIO 傳輸</translation>
-    </message>
-    <message>
-        <source>Data Read</source>
-        <translation>資料讀取</translation>
-    </message>
-    <message>
-        <source>Data Written</source>
-        <translation>資料寫入</translation>
-    </message>
-    <message>
-        <source>Data Transmitted</source>
-        <translation>資料已傳送</translation>
-    </message>
-    <message>
-        <source>Data Received</source>
-        <translation>資料已接收</translation>
-    </message>
-    <message>
-        <source>Runtime Attributes</source>
-        <translation>執行階段屬性</translation>
-    </message>
-    <message>
-        <source>Screen Resolution</source>
-        <translation>螢幕解析度</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest additions</comment>
-        <translation>未偵測到</translation>
-    </message>
-    <message>
-        <source>Not Detected</source>
-        <comment>guest os type</comment>
-        <translation>未偵測到</translation>
-    </message>
-    <message>
-        <source>Guest Additions</source>
-        <translation>Guest Additions</translation>
-    </message>
-    <message>
-        <source>Guest OS Type</source>
-        <translation>客體作業系統類型</translation>
-    </message>
-    <message>
-        <source>No Network Adapters</source>
-        <translation>沒有網路卡</translation>
-    </message>
-    <message>
-        <source>VBoxVMInformationDlg</source>
-        <translation>VBoxVMInformationDlg</translation>
-    </message>
-    <message>
-        <source>Storage Statistics</source>
-        <translation>存放裝置統計</translation>
-    </message>
-    <message>
-        <source>No Storage Devices</source>
-        <translation>沒有存放裝置</translation>
-    </message>
-    <message>
-        <source>Network Statistics</source>
-        <translation>網路統計</translation>
-    </message>
-    <message>
-        <source>Not Available</source>
-        <comment>details report (VRDE server port)</comment>
-        <translation>不可用</translation>
-    </message>
-    <message>
-        <source>Clipboard Mode</source>
-        <translation>剪貼簿模式</translation>
-    </message>
-    <message>
-        <source>Drag'n'Drop Mode</source>
-        <translation>拖放模式</translation>
-    </message>
-    <message>
-        <source>Configuration &Details</source>
-        <translation>組態詳細資料(&D)</translation>
-    </message>
-    <message>
-        <source>&Runtime Information</source>
-        <translation>執行階段資訊(&R)</translation>
-    </message>
-</context>
 </TS>
diff --git a/src/VBox/Frontends/VirtualBox/nls/qt_bg.ts b/src/VBox/Frontends/VirtualBox/nls/qt_bg.ts
index 5ef1720..5ced86a 100644
--- a/src/VBox/Frontends/VirtualBox/nls/qt_bg.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/qt_bg.ts
@@ -3995,74 +3995,74 @@ Please choose a different file name.</source>
     <name>QUnicodeControlCharacterMenu</name>
     <message>
         <source>LRM Left-to-right mark</source>
-        <translation type="unfinished"></translation>
+        <translation>LRM Маркер от ляво надясно</translation>
     </message>
     <message>
         <source>RLM Right-to-left mark</source>
-        <translation type="unfinished"></translation>
+        <translation>LRM Маркер от дясно наляво</translation>
     </message>
     <message>
         <source>ZWJ Zero width joiner</source>
-        <translation type="unfinished"></translation>
+        <translation>ZWJ Свързване с нулева ширина</translation>
     </message>
     <message>
         <source>ZWNJ Zero width non-joiner</source>
-        <translation type="unfinished"></translation>
+        <translation>ZWNJ Несвързване с нулева ширина</translation>
     </message>
     <message>
         <source>ZWSP Zero width space</source>
-        <translation type="unfinished"></translation>
+        <translation>ZWSP Интервал с нулева ширина</translation>
     </message>
     <message>
         <source>LRE Start of left-to-right embedding</source>
-        <translation type="unfinished"></translation>
+        <translation>LRE Начало на вмъкване от ляво надясно</translation>
     </message>
     <message>
         <source>RLE Start of right-to-left embedding</source>
-        <translation type="unfinished"></translation>
+        <translation>RLE Начало на вмъкване от дясно наляво</translation>
     </message>
     <message>
         <source>LRO Start of left-to-right override</source>
-        <translation type="unfinished"></translation>
+        <translation>LRO Начало на презапис от ляво надясно</translation>
     </message>
     <message>
         <source>RLO Start of right-to-left override</source>
-        <translation type="unfinished"></translation>
+        <translation>RLO Начало на презапис от дясно наляво</translation>
     </message>
     <message>
         <source>PDF Pop directional formatting</source>
-        <translation type="unfinished"></translation>
+        <translation>PDF Прекъсване на посочно форматиране</translation>
     </message>
     <message>
         <source>Insert Unicode control character</source>
-        <translation type="unfinished"></translation>
+        <translation>Вмъкване на Уникод контролен символ</translation>
     </message>
 </context>
 <context>
     <name>QWebFrame</name>
     <message>
         <source>Request cancelled</source>
-        <translation type="unfinished"></translation>
+        <translation>Заявката е отказана</translation>
     </message>
     <message>
         <source>Request blocked</source>
-        <translation type="unfinished"></translation>
+        <translation>Заявката е блокирана</translation>
     </message>
     <message>
         <source>Cannot show URL</source>
-        <translation type="unfinished"></translation>
+        <translation>Не може да се покаже URL</translation>
     </message>
     <message>
         <source>Frame load interruped by policy change</source>
-        <translation type="unfinished"></translation>
+        <translation>Зареждането на кадри е прекъснато от промяна в политиката</translation>
     </message>
     <message>
         <source>Cannot show mimetype</source>
-        <translation type="unfinished"></translation>
+        <translation>Не може да се покаже mime тип</translation>
     </message>
     <message>
         <source>File does not exist</source>
-        <translation type="unfinished"></translation>
+        <translation>Файлът не съществува</translation>
     </message>
 </context>
 <context>
@@ -4313,7 +4313,7 @@ Please choose a different file name.</source>
     </message>
     <message>
         <source>Web Inspector - %2</source>
-        <translation type="unfinished"></translation>
+        <translation>Уеб инспектор - %2</translation>
     </message>
 </context>
 <context>
@@ -4444,817 +4444,819 @@ Please choose a different file name.</source>
     </message>
     <message>
         <source>error triggered by consumer</source>
-        <translation type="unfinished"></translation>
+        <translation>грешка, предизвикана от потребител</translation>
     </message>
     <message>
         <source>unexpected end of file</source>
-        <translation type="unfinished"></translation>
+        <translation>неочакван край на файл</translation>
     </message>
     <message>
         <source>more than one document type definition</source>
-        <translation type="unfinished"></translation>
+        <translation>повече от една дефиниция за тип на документ</translation>
     </message>
     <message>
         <source>error occurred while parsing element</source>
-        <translation type="unfinished"></translation>
+        <translation>възникнала грешка при изчитане на елемент</translation>
     </message>
     <message>
         <source>tag mismatch</source>
-        <translation type="unfinished"></translation>
+        <translation>пропуск на таг</translation>
     </message>
     <message>
         <source>error occurred while parsing content</source>
-        <translation type="unfinished"></translation>
+        <translation>възникнала грешка при изчитане на съдържание</translation>
     </message>
     <message>
         <source>unexpected character</source>
-        <translation type="unfinished"></translation>
+        <translation>неочакван символ</translation>
     </message>
     <message>
         <source>invalid name for processing instruction</source>
-        <translation type="unfinished"></translation>
+        <translation>невалидно име за изпълнение на инструкция</translation>
     </message>
     <message>
         <source>version expected while reading the XML declaration</source>
-        <translation type="unfinished"></translation>
+        <translation>очаква се версия при четенето на XML декларация</translation>
     </message>
     <message>
         <source>wrong value for standalone declaration</source>
-        <translation type="unfinished"></translation>
+        <translation>грешна стойност на самостоятелна декларация</translation>
     </message>
     <message>
         <source>encoding declaration or standalone declaration expected while reading the XML declaration</source>
-        <translation type="unfinished"></translation>
+        <translation>очаква се декларация за кодировка или самостоятелна декларация при четенето на XML декларация</translation>
     </message>
     <message>
         <source>standalone declaration expected while reading the XML declaration</source>
-        <translation type="unfinished"></translation>
+        <translation>очаква се самостоятелна декларация при четенето на XML декларация</translation>
     </message>
     <message>
         <source>error occurred while parsing document type definition</source>
-        <translation type="unfinished"></translation>
+        <translation>възникнала грешка при изчитането на дефиницията за тип на документа</translation>
     </message>
     <message>
         <source>letter is expected</source>
-        <translation type="unfinished"></translation>
+        <translation>очаква се буква</translation>
     </message>
     <message>
         <source>error occurred while parsing comment</source>
-        <translation type="unfinished"></translation>
+        <translation>възникнала грешка при изчитане на коментар</translation>
     </message>
     <message>
         <source>error occurred while parsing reference</source>
-        <translation type="unfinished"></translation>
+        <translation>възникнала грешка при изчитане на справка</translation>
     </message>
     <message>
         <source>internal general entity reference not allowed in DTD</source>
-        <translation type="unfinished"></translation>
+        <translation>справка от вътрешен общ обхват не е позволена в DTD</translation>
     </message>
     <message>
         <source>external parsed general entity reference not allowed in attribute value</source>
-        <translation type="unfinished"></translation>
+        <translation>справка от външен общ изчетен обект не е позволена в стойност на атрибут</translation>
     </message>
     <message>
         <source>external parsed general entity reference not allowed in DTD</source>
-        <translation type="unfinished"></translation>
+        <translation>справка от външен общ изчетен обект не е позволена в DTD</translation>
     </message>
     <message>
         <source>unparsed entity reference in wrong context</source>
-        <translation type="unfinished"></translation>
+        <translation>неизчетена справка за обект в грешен контекст</translation>
     </message>
     <message>
         <source>recursive entities</source>
-        <translation type="unfinished"></translation>
+        <translation>рекурсивни обекти</translation>
     </message>
     <message>
         <source>error in the text declaration of an external entity</source>
-        <translation type="unfinished"></translation>
+        <translation>грешка в текстовата декларация на външен обект</translation>
     </message>
 </context>
 <context>
     <name>QXmlStream</name>
     <message>
         <source>Extra content at end of document.</source>
-        <translation type="unfinished"></translation>
+        <translation>Допълнително съдържание в края на документа.</translation>
     </message>
     <message>
         <source>Invalid entity value.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалидна стойност на обект.</translation>
     </message>
     <message>
         <source>Invalid XML character.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалиден XML символ.</translation>
     </message>
     <message>
         <source>Sequence ']]>' not allowed in content.</source>
-        <translation type="unfinished"></translation>
+        <translation>Последователността ']]>' не е позволена в съдържанието.</translation>
     </message>
     <message>
         <source>Namespace prefix '%1' not declared</source>
-        <translation type="unfinished"></translation>
+        <translation>Префикс '%1' в пространство от имена не е указан</translation>
     </message>
     <message>
         <source>Attribute redefined.</source>
-        <translation type="unfinished"></translation>
+        <translation>Преуказан атрибут.</translation>
     </message>
     <message>
         <source>Unexpected character '%1' in public id literal.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неочакван символ '%1' в публичен id literal.</translation>
     </message>
     <message>
         <source>Invalid XML version string.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалиден стринг за XML версия.</translation>
     </message>
     <message>
         <source>Unsupported XML version.</source>
-        <translation type="unfinished"></translation>
+        <translation>Неподдържана XML версия.</translation>
     </message>
     <message>
         <source>%1 is an invalid encoding name.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 е невалидно име за кодировка.</translation>
     </message>
     <message>
         <source>Encoding %1 is unsupported</source>
-        <translation type="unfinished"></translation>
+        <translation>Кодировката %1 не се поддържа</translation>
     </message>
     <message>
         <source>Standalone accepts only yes or no.</source>
-        <translation type="unfinished"></translation>
+        <translation>Самостоятелният приема само да и не.</translation>
     </message>
     <message>
         <source>Invalid attribute in XML declaration.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалиден атрибут в XML декларация.</translation>
     </message>
     <message>
         <source>Premature end of document.</source>
-        <translation type="unfinished"></translation>
+        <translation>Преждевременен край на документ.</translation>
     </message>
     <message>
         <source>Invalid document.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалиден документ.</translation>
     </message>
     <message>
         <source>Expected </source>
-        <translation type="unfinished"></translation>
+        <translation>Очаквано </translation>
     </message>
     <message>
         <source>, but got '</source>
-        <translation type="unfinished"></translation>
+        <translation>, но получено '</translation>
     </message>
     <message>
         <source>Unexpected '</source>
-        <translation type="unfinished"></translation>
+        <translation>Неочаквано '</translation>
     </message>
     <message>
         <source>Expected character data.</source>
-        <translation type="unfinished"></translation>
+        <translation>Очаквани символни данни.</translation>
     </message>
     <message>
         <source>Recursive entity detected.</source>
-        <translation type="unfinished"></translation>
+        <translation>Засечен е рекурсивен обект.</translation>
     </message>
     <message>
         <source>Start tag expected.</source>
-        <translation type="unfinished"></translation>
+        <translation>Очаква се начален таг.</translation>
     </message>
     <message>
         <source>XML declaration not at start of document.</source>
-        <translation type="unfinished"></translation>
+        <translation>XML декларацията не е в началото на документа.</translation>
     </message>
     <message>
         <source>NDATA in parameter entity declaration.</source>
-        <translation type="unfinished"></translation>
+        <translation>NDATA в декларацията на параметрите на обект.</translation>
     </message>
     <message>
         <source>%1 is an invalid processing instruction name.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 е невалидно име за инструкция за обработка.</translation>
     </message>
     <message>
         <source>Invalid processing instruction name.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалидно име за инструкция за обработка.</translation>
     </message>
     <message>
         <source>Illegal namespace declaration.</source>
-        <translation type="unfinished"></translation>
+        <translation>Непозволена декларация за пространство от имена.</translation>
     </message>
     <message>
         <source>Invalid XML name.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалидно XML име.</translation>
     </message>
     <message>
         <source>Opening and ending tag mismatch.</source>
-        <translation type="unfinished"></translation>
+        <translation>Пропуснати отварящ и затварящ тагове.</translation>
     </message>
     <message>
         <source>Reference to unparsed entity '%1'.</source>
-        <translation type="unfinished"></translation>
+        <translation>Препратка към неизчетен обект '%1'.</translation>
     </message>
     <message>
         <source>Entity '%1' not declared.</source>
-        <translation type="unfinished"></translation>
+        <translation>Обектът '%1' не е деклариран.</translation>
     </message>
     <message>
         <source>Reference to external entity '%1' in attribute value.</source>
-        <translation type="unfinished"></translation>
+        <translation>Препратка към външен обект '%1' в стойност на атрибут.</translation>
     </message>
     <message>
         <source>Invalid character reference.</source>
-        <translation type="unfinished"></translation>
+        <translation>Невалидна препратка към символ.</translation>
     </message>
     <message>
         <source>Encountered incorrectly encoded content.</source>
-        <translation type="unfinished"></translation>
+        <translation>Намерено некоректно кодирано съдържание.</translation>
     </message>
     <message>
         <source>The standalone pseudo attribute must appear after the encoding.</source>
-        <translation type="unfinished"></translation>
+        <translation>Самостоятелният псевдо атрибут трябва да се появи преди кодировката.</translation>
     </message>
     <message>
         <source>%1 is an invalid PUBLIC identifier.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 е невалиден ПУБЛИЧЕН указател.</translation>
     </message>
 </context>
 <context>
     <name>QtXmlPatterns</name>
     <message>
         <source>An %1-attribute with value %2 has already been declared.</source>
-        <translation type="unfinished"></translation>
+        <translation>Атрибут %1 със стойност %2 вече е деклариран.</translation>
     </message>
     <message>
         <source>An %1-attribute must have a valid %2 as value, which %3 isn't.</source>
-        <translation type="unfinished"></translation>
+        <translation>Атрибут %1 трябва да има валиден %2 като стойност, а %3 не е.</translation>
     </message>
     <message>
         <source>Network timeout.</source>
-        <translation type="unfinished"></translation>
+        <translation>Просрочено мрежово време.</translation>
     </message>
     <message>
         <source>Element %1 can't be serialized because it appears outside the document element.</source>
-        <translation type="unfinished"></translation>
+        <translation>Елемент %1 не може да се сериализира, тъй като е извън документовия елемент.</translation>
     </message>
     <message>
         <source>Attribute %1 can't be serialized because it appears at the top level.</source>
-        <translation type="unfinished"></translation>
+        <translation>Атрибут %1 не може да се сериализира, защото е в горното ниво.</translation>
     </message>
     <message>
         <source>Year %1 is invalid because it begins with %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Година %1 е невалидна, защото започва с %2.</translation>
     </message>
     <message>
         <source>Day %1 is outside the range %2..%3.</source>
-        <translation type="unfinished"></translation>
+        <translation>Ден %1 е извън обхвата %2..%3.</translation>
     </message>
     <message>
         <source>Month %1 is outside the range %2..%3.</source>
-        <translation type="unfinished"></translation>
+        <translation>Месец %1 е извън обхвата %2..%3.</translation>
     </message>
     <message>
         <source>Overflow: Can't represent date %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Препълване: Не може да се покаже дата %1.</translation>
     </message>
     <message>
         <source>Day %1 is invalid for month %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Ден %1 е невалиден за месец %2.</translation>
     </message>
     <message>
         <source>Time 24:%1:%2.%3 is invalid. Hour is 24, but minutes, seconds, and milliseconds are not all 0; </source>
-        <translation type="unfinished"></translation>
+        <translation>Време 24:%1:%2.%3 е невалидно. Часът е 24, но не всички минути, секунди и милисекунди са 0; </translation>
     </message>
     <message>
         <source>Time %1:%2:%3.%4 is invalid.</source>
-        <translation type="unfinished"></translation>
+        <translation>Време %1:%2:%3.%4 е невалидно.</translation>
     </message>
     <message>
         <source>Overflow: Date can't be represented.</source>
-        <translation type="unfinished"></translation>
+        <translation>Препълване: Не може да се покаже датата.</translation>
     </message>
     <message>
         <source>At least one component must be present.</source>
-        <translation type="unfinished"></translation>
+        <translation>Поне един компонент трябва да е наличен.</translation>
     </message>
     <message>
         <source>At least one time component must appear after the %1-delimiter.</source>
-        <translation type="unfinished"></translation>
+        <translation>Поне един времеви компонент трябва да е след ограничението %1.</translation>
     </message>
     <message>
         <source>No operand in an integer division, %1, can be %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма операнда в целочислено деление, %1, може да е %2.</translation>
     </message>
     <message>
         <source>The first operand in an integer division, %1, cannot be infinity (%2).</source>
-        <translation type="unfinished"></translation>
+        <translation>Първата операнда е целочислено деление, %1, не може да е безкрайност (%2).</translation>
     </message>
     <message>
         <source>The second operand in a division, %1, cannot be zero (%2).</source>
-        <translation type="unfinished"></translation>
+        <translation>Втората операнда в делението, %1, не може да е нула (%2).</translation>
     </message>
     <message>
         <source>%1 is not a valid value of type %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е валидна стойност от тип %2.</translation>
     </message>
     <message>
         <source>When casting to %1 from %2, the source value cannot be %3.</source>
-        <translation type="unfinished"></translation>
+        <translation>Когато се разпределя към %1 от %2 входящата стойност не може да е %3.</translation>
     </message>
     <message>
         <source>Integer division (%1) by zero (%2) is undefined.</source>
-        <translation type="unfinished"></translation>
+        <translation>Целочисленото деление (%1) на нула (%2) не е дефинирано.</translation>
     </message>
     <message>
         <source>Division (%1) by zero (%2) is undefined.</source>
-        <translation type="unfinished"></translation>
+        <translation>Делението (%1) на нула (%2) не е дефинирано.</translation>
     </message>
     <message>
         <source>Modulus division (%1) by zero (%2) is undefined.</source>
-        <translation type="unfinished"></translation>
+        <translation>Модулното деление (%1) на нула (%2) не е дефинирано.</translation>
     </message>
     <message>
         <source>Dividing a value of type %1 by %2 (not-a-number) is not allowed.</source>
-        <translation type="unfinished"></translation>
+        <translation>Делението на стойност от тип %1 на %2 (не е число) не е позволено.</translation>
     </message>
     <message>
         <source>Dividing a value of type %1 by %2 or %3 (plus or minus zero) is not allowed.</source>
-        <translation type="unfinished"></translation>
+        <translation>Делението на стойност от тип %1 на %2 или %3 (плюс или минус нула) не е позволено.</translation>
     </message>
     <message>
         <source>Multiplication of a value of type %1 by %2 or %3 (plus or minus infinity) is not allowed.</source>
-        <translation type="unfinished"></translation>
+        <translation>Умножението на стойност от тип %1 с %2 или %3 (плюс или минус безкрайност) не е позволено.</translation>
     </message>
     <message>
         <source>A value of type %1 cannot have an Effective Boolean Value.</source>
-        <translation type="unfinished"></translation>
+        <translation>Стойност от тип %1 не може да има Ефективна Булева Стойност.</translation>
     </message>
     <message>
         <source>Effective Boolean Value cannot be calculated for a sequence containing two or more atomic values.</source>
-        <translation type="unfinished"></translation>
+        <translation>Ефективна Булева Стойност не може да се изчисли за поредица, съдържаща две или повече атомични стойности.</translation>
     </message>
     <message>
         <source>Value %1 of type %2 exceeds maximum (%3).</source>
-        <translation type="unfinished"></translation>
+        <translation>Стойност %1 от тип %2 надвишава максимума (%3).</translation>
     </message>
     <message>
         <source>Value %1 of type %2 is below minimum (%3).</source>
-        <translation type="unfinished"></translation>
+        <translation>Стойност %1 от тип %2 е под минимума (%3).</translation>
     </message>
     <message>
         <source>A value of type %1 must contain an even number of digits. The value %2 does not.</source>
-        <translation type="unfinished"></translation>
+        <translation>Стойност от тип %1 трябва да съдържа четен брой цифри. Стойността %2 не съдържа.</translation>
     </message>
     <message>
         <source>%1 is not valid as a value of type %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е валидна като стойност от тип %2.</translation>
     </message>
     <message>
         <source>Operator %1 cannot be used on type %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Оператор %1 не може да се използва върху тип %2.</translation>
     </message>
     <message>
         <source>Operator %1 cannot be used on atomic values of type %2 and %3.</source>
-        <translation type="unfinished"></translation>
+        <translation>Оператор %1 не може да се използва върху атомични стойности от тип %2 и %3.</translation>
     </message>
     <message>
         <source>The namespace URI in the name for a computed attribute cannot be %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Именното URI пространство в името за изчислен атрибут не може да е %1.</translation>
     </message>
     <message>
         <source>The name for a computed attribute cannot have the namespace URI %1 with the local name %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Името за изчислен атрибут не може да има именно URI пространство %1 с локално име %2.</translation>
     </message>
     <message>
         <source>Type error in cast, expected %1, received %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Печатна грешка в изчислението, очаквано %1, получено %2.</translation>
     </message>
     <message>
         <source>When casting to %1 or types derived from it, the source value must be of the same type, or it must be a string literal. Type %2 is not allowed.</source>
-        <translation type="unfinished"></translation>
+        <translation>Когато се изчислява към %1 или типове, изхождащи от него, входящата стойност трябва да бъде от същия тип или трябва да е буквен низ. Тип %2 не е позволен.</translation>
     </message>
     <message>
         <source>No casting is possible with %1 as the target type.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е възможно изчисление с %1 като целеви тип.</translation>
     </message>
     <message>
         <source>It is not possible to cast from %1 to %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е възможно изчисление от %1 към %2.</translation>
     </message>
     <message>
         <source>Casting to %1 is not possible because it is an abstract type, and can therefore never be instantiated.</source>
-        <translation type="unfinished"></translation>
+        <translation>Изчисление към %1 не е възможно, защото е абстрактен тип, и в този случай никога няма да се представи.</translation>
     </message>
     <message>
         <source>It's not possible to cast the value %1 of type %2 to %3</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е възможно изчисление на стойност %1 от тип %2 към %3</translation>
     </message>
     <message>
         <source>Failure when casting from %1 to %2: %3</source>
-        <translation type="unfinished"></translation>
+        <translation>Неуспешно изчисление от %1 към %2: %3</translation>
     </message>
     <message>
         <source>A comment cannot contain %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Коментарът не може да съдържа %1</translation>
     </message>
     <message>
         <source>A comment cannot end with a %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Коментарът не може да завърша с %1.</translation>
     </message>
     <message>
         <source>No comparisons can be done involving the type %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не може да се прави сравнение при използване на тип %1.</translation>
     </message>
     <message>
         <source>Operator %1 is not available between atomic values of type %2 and %3.</source>
-        <translation type="unfinished"></translation>
+        <translation>Оператор %1 не е наличен между атомични стойности от тип %2 и %3.</translation>
     </message>
     <message>
         <source>An attribute node cannot be a child of a document node. Therefore, the attribute %1 is out of place.</source>
-        <translation type="unfinished"></translation>
+        <translation>Атрибутен възел не може да е дете на документен възел. Следователно атрибутът %1 не е на мястото си.</translation>
     </message>
     <message>
         <source>A library module cannot be evaluated directly. It must be imported from a main module.</source>
-        <translation type="unfinished"></translation>
+        <translation>Библиотечен модул не може да се прилага директно. Трябва да е вмъкнат от основен модул.</translation>
     </message>
     <message>
         <source>A value of type %1 cannot be a predicate. A predicate must have either a numeric type or an Effective Boolean Value type.</source>
-        <translation type="unfinished"></translation>
+        <translation>Стойност от тип %1 не може да е предикат. Предикатът трябва да има или числов тип, или тип Ефективна Булева Стойност.</translation>
     </message>
     <message>
         <source>A positional predicate must evaluate to a single numeric value.</source>
-        <translation type="unfinished"></translation>
+        <translation>Позиционен предикат трябва да се прилага към единична числова стойност.</translation>
     </message>
     <message>
         <source>The target name in a processing instruction cannot be %1 in any combination of upper and lower case. Therefore, is %2 invalid.</source>
-        <translation type="unfinished"></translation>
+        <translation>Целевото име в изпълняваната инструкция не може да е %1 в каквато и да е комбинация от големи и малки букви. Следователно %2 не е валидно.</translation>
     </message>
     <message>
         <source>%1 is not a valid target name in a processing instruction. It must be a %2 value, e.g. %3.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е валидно целево име в изпълняваната инструкция. Трябва да е стойност %2, например %3.</translation>
     </message>
     <message>
         <source>The last step in a path must contain either nodes or atomic values. It cannot be a mixture between the two.</source>
-        <translation type="unfinished"></translation>
+        <translation>Последната стъпка в пътя трябва да съдържа или възли, или атомични стойности. Не може да е смес от двете.</translation>
     </message>
     <message>
         <source>The data of a processing instruction cannot contain the string %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Данните на изпълняваната инструкция не може да съдържат низ %1</translation>
     </message>
     <message>
         <source>No namespace binding exists for the prefix %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма указано пространство от имена за префикс %1</translation>
     </message>
     <message>
         <source>No namespace binding exists for the prefix %1 in %2</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма указано пространство от имена за префикс %1 в %2</translation>
     </message>
     <message>
         <source>%1 is an invalid %2</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е валидно %2</translation>
     </message>
     <message numerus="yes">
         <source>%1 takes at most %n argument(s). %2 is therefore invalid.</source>
-        <translation type="unfinished">
-            <numerusform></numerusform>
+        <translation>
+            <numerusform>%1 поема най-много %n аргумент. Следователно %2 не е валидно.</numerusform>
+            <numerusform>%1 поема най-много %n аргумента. Следователно %2 не е валидно.</numerusform>
         </translation>
     </message>
     <message numerus="yes">
         <source>%1 requires at least %n argument(s). %2 is therefore invalid.</source>
-        <translation type="unfinished">
-            <numerusform></numerusform>
+        <translation>
+            <numerusform>%1 изисква поне %n аргумент. Следователно %2 не е валидно.</numerusform>
+            <numerusform>%1 изисква поне %n аргумента. Следователно %2 не е валидно.</numerusform>
         </translation>
     </message>
     <message>
         <source>The first argument to %1 cannot be of type %2. It must be a numeric type, xs:yearMonthDuration or xs:dayTimeDuration.</source>
-        <translation type="unfinished"></translation>
+        <translation>Първият аргумент към %1 не може да е от тип %2. Трябва да е числов тип, xs:yearMonthDuration или xs:dayTimeDuration.</translation>
     </message>
     <message>
         <source>The first argument to %1 cannot be of type %2. It must be of type %3, %4, or %5.</source>
-        <translation type="unfinished"></translation>
+        <translation>Първият аргумент към %1 не може да е от тип %2. Трябва да е от тип %3, %4 или %5.</translation>
     </message>
     <message>
         <source>The second argument to %1 cannot be of type %2. It must be of type %3, %4, or %5.</source>
-        <translation type="unfinished"></translation>
+        <translation>Вторият аргумент към %1 не може да е от тип %2. Трябва да е от тип %3, %4 или %5.</translation>
     </message>
     <message>
         <source>%1 is not a valid XML 1.0 character.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е валиден XML 1.0 символ.</translation>
     </message>
     <message>
         <source>The first argument to %1 cannot be of type %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Първият аргумент към %1 не може да е от тип %2.</translation>
     </message>
     <message>
         <source>If both values have zone offsets, they must have the same zone offset. %1 and %2 are not the same.</source>
-        <translation type="unfinished"></translation>
+        <translation>Ако и двете стойности имат зоново отместване, те трябва да имат еднакво зоново отместване. %1 и %2 не са еднакви.</translation>
     </message>
     <message>
         <source>%1 was called.</source>
-        <translation type="unfinished"></translation>
+        <translation>Повикан е %1.</translation>
     </message>
     <message>
         <source>%1 must be followed by %2 or %3, not at the end of the replacement string.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 трябва да е следван от %2 или %3, не в края на заместващия низ.</translation>
     </message>
     <message>
         <source>In the replacement string, %1 must be followed by at least one digit when not escaped.</source>
-        <translation type="unfinished"></translation>
+        <translation>В заместващия низ, %1 трябва да е следван от поне една цифра, когато не е ескейпнат.</translation>
     </message>
     <message>
         <source>In the replacement string, %1 can only be used to escape itself or %2, not %3</source>
-        <translation type="unfinished"></translation>
+        <translation>В заместващия низ, %1 може да се използва само за ескейпване на себе си или %2, не %3</translation>
     </message>
     <message>
         <source>%1 matches newline characters</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 съвпада със символи за нов ред</translation>
     </message>
     <message>
         <source>%1 and %2 match the start and end of a line.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 и %2 съвпадат с начало и край на линия.</translation>
     </message>
     <message>
         <source>Matches are case insensitive</source>
-        <translation type="unfinished"></translation>
+        <translation>Съвпаденията са нечувсвтителни към регистъра</translation>
     </message>
     <message>
         <source>Whitespace characters are removed, except when they appear in character classes</source>
-        <translation type="unfinished"></translation>
+        <translation>Празните символи са премахнати, освен участващите в символни класове</translation>
     </message>
     <message>
         <source>%1 is an invalid regular expression pattern: %2</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 е невалиден модел за регулярен израз: %2</translation>
     </message>
     <message>
         <source>%1 is an invalid flag for regular expressions. Valid flags are:</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 е невалиден флаг за регулярен израз. Валидните флагове са:</translation>
     </message>
     <message>
         <source>If the first argument is the empty sequence or a zero-length string (no namespace), a prefix cannot be specified. Prefix %1 was specified.</source>
-        <translation type="unfinished"></translation>
+        <translation>Ако първият аргумент е празна поредица или низ с нулева дължина (без пространство от имена), не може да бъде указан префикс. Указан е префик %1.</translation>
     </message>
     <message>
         <source>It will not be possible to retrieve %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма да е възможно получаването на %1.</translation>
     </message>
     <message>
         <source>The root node of the second argument to function %1 must be a document node. %2 is not a document node.</source>
-        <translation type="unfinished"></translation>
+        <translation>Кореновият възел на втория аргумент към функция %1 трябва да е документен възел. %2 не е документен възел.</translation>
     </message>
     <message>
         <source>The default collection is undefined</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е дефинирана колецията по подразбиране</translation>
     </message>
     <message>
         <source>%1 cannot be retrieved</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не може да се получи</translation>
     </message>
     <message>
         <source>The normalization form %1 is unsupported. The supported forms are %2, %3, %4, and %5, and none, i.e. the empty string (no normalization).</source>
-        <translation type="unfinished"></translation>
+        <translation>Нормализационната форма %1 не се поддържа. Поддържаните форми са %2, %3, %4 и %5, и без, например празен низ (без нормализация).</translation>
     </message>
     <message>
         <source>A zone offset must be in the range %1..%2 inclusive. %3 is out of range.</source>
-        <translation type="unfinished"></translation>
+        <translation>Зоновото отместване трябва да е в обхвата %1..%2 включително. %3 е извън обхвата.</translation>
     </message>
     <message>
         <source>%1 is not a whole number of minutes.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е цяло число от минути.</translation>
     </message>
     <message>
         <source>Required cardinality is %1; got cardinality %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Изискваната кардиналност е %1, получена кардиналност %2.</translation>
     </message>
     <message>
         <source>The item %1 did not match the required type %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Елементът %1 не съвпада с изисквания тип %2.</translation>
     </message>
     <message>
         <source>%1 is an unknown schema type.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е тип схема.</translation>
     </message>
     <message>
         <source>Only one %1 declaration can occur in the query prolog.</source>
-        <translation type="unfinished"></translation>
+        <translation>Само една %1 декларация може да присъства в пролога на заявката.</translation>
     </message>
     <message>
         <source>The initialization of variable %1 depends on itself</source>
-        <translation type="unfinished"></translation>
+        <translation>Инициализирането на променлива %1 зависи от себе си</translation>
     </message>
     <message>
         <source>No variable by name %1 exists</source>
-        <translation type="unfinished"></translation>
+        <translation>Променлива с име %1 не съществува</translation>
     </message>
     <message>
         <source>The variable %1 is unused</source>
-        <translation type="unfinished"></translation>
+        <translation>Променливата %1 не се използва</translation>
     </message>
     <message>
         <source>Version %1 is not supported. The supported XQuery version is 1.0.</source>
-        <translation type="unfinished"></translation>
+        <translation>Версия %1 е неподдържана. Поддържаната XQuery версия е 1.0.</translation>
     </message>
     <message>
         <source>The encoding %1 is invalid. It must contain Latin characters only, must not contain whitespace, and must match the regular expression %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Кодировката %1 е невалидна. Трябва да съдържа само латински символи, трябва да не съдържа празни символи и трябва да съвпада с регулярния израз %2.</translation>
     </message>
     <message>
         <source>No function with signature %1 is available</source>
-        <translation type="unfinished"></translation>
+        <translation>Функция с подпис %1 не е налична</translation>
     </message>
     <message>
         <source>A default namespace declaration must occur before function, variable, and option declarations.</source>
-        <translation type="unfinished"></translation>
+        <translation>Декларацията за пространство от имена по подразбиране трябва да е преди функция, променлива и допълнителни декларации.</translation>
     </message>
     <message>
         <source>Namespace declarations must occur before function, variable, and option declarations.</source>
-        <translation type="unfinished"></translation>
+        <translation>Декларациите за пространство от имена трябва да са преди функция, променлива и допълнителни декларации.</translation>
     </message>
     <message>
         <source>Module imports must occur before function, variable, and option declarations.</source>
-        <translation type="unfinished"></translation>
+        <translation>Внасянето на модули трябва да е преди функция, променлива и допълнителни декларации.</translation>
     </message>
     <message>
         <source>It is not possible to redeclare prefix %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е възможно предекларирането на префикс %1.</translation>
     </message>
     <message>
         <source>Only the prefix %1 can be declared to bind the namespace %2. By default, it is already bound to the prefix %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Само префиксът %1 може да се декларира за указване на пространство от имена %2. По подразбиране вече е указано към префикс %1.</translation>
     </message>
     <message>
         <source>Prefix %1 is already declared in the prolog.</source>
-        <translation type="unfinished"></translation>
+        <translation>Префикс %1 вече е деклариран в пролога.</translation>
     </message>
     <message>
         <source>The name of an option must have a prefix. There is no default namespace for options.</source>
-        <translation type="unfinished"></translation>
+        <translation>Името на опцията трябва да има префикс. По подразбиране няма пространство от имена за опции.</translation>
     </message>
     <message>
         <source>The Schema Import feature is not supported, and therefore %1 declarations cannot occur.</source>
-        <translation type="unfinished"></translation>
+        <translation>Функцията Внасяне на схема не се поддържа, следователно %1 декларации не може да има.</translation>
     </message>
     <message>
         <source>The target namespace of a %1 cannot be empty.</source>
-        <translation type="unfinished"></translation>
+        <translation>Целевото пространство от имена от %1 не може да е празно.</translation>
     </message>
     <message>
         <source>The module import feature is not supported</source>
-        <translation type="unfinished"></translation>
+        <translation>Функцията за внадяне на модул не се поддържа</translation>
     </message>
     <message>
         <source>A variable by name %1 has already been declared in the prolog.</source>
-        <translation type="unfinished"></translation>
+        <translation>Променлива с име %1 вече е декларирана в пролога.</translation>
     </message>
     <message>
         <source>No value is available for the external variable by name %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е налична стойност за външната променлива с име %1.</translation>
     </message>
     <message>
         <source>The namespace for a user defined function cannot be empty (try the predefined prefix %1 which exists for cases like this)</source>
-        <translation type="unfinished"></translation>
+        <translation>Пространството от имена за потребителски дефинирана функция не може да е празно (опитайте предефинирания префикс %1, който съществува за случаи като този)</translation>
     </message>
     <message>
         <source>The namespace %1 is reserved; therefore user defined functions may not use it. Try the predefined prefix %2, which exists for these cases.</source>
-        <translation type="unfinished"></translation>
+        <translation>Пространството от имена %1 е запазено, следователно потребителски дефинираните функции не могат да го ползват. Опитайте предефинирания префикс %2, който съществува за случаи като този.</translation>
     </message>
     <message>
         <source>The namespace of a user defined function in a library module must be equivalent to the module namespace. In other words, it should be %1 instead of %2</source>
-        <translation type="unfinished"></translation>
+        <translation>Пространството от имена за потребителски дефинирана функция в библиотечен модул трябва да е еквивалентен на модула за пространство от имена, трябва да е %1 вместо %2</translation>
     </message>
     <message>
         <source>A function already exists with the signature %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Вече съществува функция с подпис %1.</translation>
     </message>
     <message>
         <source>No external functions are supported. All supported functions can be used directly, without first declaring them as external</source>
-        <translation type="unfinished"></translation>
+        <translation>Не се поддържат външни функции. Всички поддържани функции могат да се използват директно, без да се декларират предварително като външни</translation>
     </message>
     <message>
         <source>An argument by name %1 has already been declared. Every argument name must be unique.</source>
-        <translation type="unfinished"></translation>
+        <translation>Аргумент с име %1 вече е деклариран. Имената на аргументите трябва да са уникални.</translation>
     </message>
     <message>
         <source>The name of a variable bound in a for-expression must be different from the positional variable. Hence, the two variables named %1 collide.</source>
-        <translation type="unfinished"></translation>
+        <translation>Името на променлива, указана за израз, трябва да е различна от позиционална променлива. Следователно променливите с имена %1 си противоречат.</translation>
     </message>
     <message>
         <source>The Schema Validation Feature is not supported. Hence, %1-expressions may not be used.</source>
-        <translation type="unfinished"></translation>
+        <translation>Функцията за валидация на схеми не се поддържа. Следователно %1 изрази не могат да се ползват.</translation>
     </message>
     <message>
         <source>None of the pragma expressions are supported. Therefore, a fallback expression must be present</source>
-        <translation type="unfinished"></translation>
+        <translation>Никой от прагма изразите не се поддържа. Следователно трябва да има наличен авариен израз</translation>
     </message>
     <message>
         <source>The %1-axis is unsupported in XQuery</source>
-        <translation type="unfinished"></translation>
+        <translation>Оста %1 не се поддържа в XQuery</translation>
     </message>
     <message>
         <source>%1 is not a valid numeric literal.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е валиден числов литерал.</translation>
     </message>
     <message>
         <source>No function by name %1 is available.</source>
-        <translation type="unfinished"></translation>
+        <translation>Няма налична функция с име %1.</translation>
     </message>
     <message>
         <source>The namespace URI cannot be the empty string when binding to a prefix, %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>URI пространството от имена не може да е празен низ, когато се указва към префикс, %1.</translation>
     </message>
     <message>
         <source>%1 is an invalid namespace URI.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 е невалидно URI пространство от имена.</translation>
     </message>
     <message>
         <source>It is not possible to bind to the prefix %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Не може да се укаже към префикс %1</translation>
     </message>
     <message>
         <source>Namespace %1 can only be bound to %2 (and it is, in either case, pre-declared).</source>
-        <translation type="unfinished"></translation>
+        <translation>Пространство от имена %1 може да се укаже само към %2 (и то е във всеки случай предекларирано).</translation>
     </message>
     <message>
         <source>Prefix %1 can only be bound to %2 (and it is, in either case, pre-declared).</source>
-        <translation type="unfinished"></translation>
+        <translation>Префикс %1 може да се укаже само към %2 (и той е във всеки случай предеклариран).</translation>
     </message>
     <message>
         <source>Two namespace declaration attributes have the same name: %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Два атрибута за декларации на пространство от имена имат едно и също име: %1.</translation>
     </message>
     <message>
         <source>The namespace URI must be a constant and cannot use enclosed expressions.</source>
-        <translation type="unfinished"></translation>
+        <translation>URI пространството от имена трябва да е константа или не може да използва заградени изрази.</translation>
     </message>
     <message>
         <source>An attribute by name %1 has already appeared on this element.</source>
-        <translation type="unfinished"></translation>
+        <translation>Атрибут с име %1 вече има към този елемент.</translation>
     </message>
     <message>
         <source>A direct element constructor is not well-formed. %1 is ended with %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>Директен конструктор на елементи не е формиран добре. %1 завършва с %2.</translation>
     </message>
     <message>
         <source>The name %1 does not refer to any schema type.</source>
-        <translation type="unfinished"></translation>
+        <translation>Името %1 не води към никой тип схема.</translation>
     </message>
     <message>
         <source>%1 is an complex type. Casting to complex types is not possible. However, casting to atomic types such as %2 works.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 е комплексен тип. Изчисление към комплесни типове е невъзможно. Следователно изчисление към атомични типове като %2 работи.</translation>
     </message>
     <message>
         <source>%1 is not an atomic type. Casting is only possible to atomic types.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е атомичен тип. Възможно е изчисление само към атомични типове.</translation>
     </message>
     <message>
         <source>%1 is not a valid name for a processing-instruction. Therefore this name test will never match.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е валидно име за изпълняваната инструкция. Следователно тази проба на името никога няма да съвпадне.</translation>
     </message>
     <message>
         <source>%1 is not in the in-scope attribute declarations. Note that the schema import feature is not supported.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 не е в обхватните атрибутни декларации. Имайте предвид, че функцията за внасяне на схема не се поддържа.</translation>
     </message>
     <message>
         <source>The name of an extension expression must be in a namespace.</source>
-        <translation type="unfinished"></translation>
+        <translation>Името на разширителен израз трябва да е в пространство от имена.</translation>
     </message>
     <message>
         <source>empty</source>
-        <translation type="unfinished"></translation>
+        <translation>празно</translation>
     </message>
     <message>
         <source>zero or one</source>
-        <translation type="unfinished"></translation>
+        <translation>нула или едно</translation>
     </message>
     <message>
         <source>exactly one</source>
-        <translation type="unfinished"></translation>
+        <translation>точно едно</translation>
     </message>
     <message>
         <source>one or more</source>
-        <translation type="unfinished"></translation>
+        <translation>едно или повече</translation>
     </message>
     <message>
         <source>zero or more</source>
-        <translation type="unfinished"></translation>
+        <translation>нула или повече</translation>
     </message>
     <message>
         <source>Required type is %1, but %2 was found.</source>
-        <translation type="unfinished"></translation>
+        <translation>Изисква се тип %1, но %2 е намерен.</translation>
     </message>
     <message>
         <source>Promoting %1 to %2 may cause loss of precision.</source>
-        <translation type="unfinished"></translation>
+        <translation>Указването на %1 към %2 може да предизвика загуба на точност.</translation>
     </message>
     <message>
         <source>The focus is undefined.</source>
-        <translation type="unfinished"></translation>
+        <translation>Фокусът не е дефиниран.</translation>
     </message>
     <message>
         <source>It's not possible to add attributes after any other kind of node.</source>
-        <translation type="unfinished"></translation>
+        <translation>Не е възможно добавянето на атрибути след всеки друг вид възли.</translation>
     </message>
     <message>
         <source>An attribute by name %1 has already been created.</source>
-        <translation type="unfinished"></translation>
+        <translation>Атрибут с име %1 вече е създаден.</translation>
     </message>
     <message>
         <source>Only the Unicode Codepoint Collation is supported(%1). %2 is unsupported.</source>
-        <translation type="unfinished"></translation>
+        <translation>Поддържа се само Уникод Кодова Съпоставка(%1). %2 не се поддържа.</translation>
     </message>
 </context>
 <context>
diff --git a/src/VBox/Frontends/VirtualBox/nls/qt_ca.ts b/src/VBox/Frontends/VirtualBox/nls/qt_ca.ts
index 2384290..57b3922 100644
--- a/src/VBox/Frontends/VirtualBox/nls/qt_ca.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/qt_ca.ts
@@ -591,7 +591,7 @@ a
         <translation>Tanca la finestra</translation>
     </message>
     <message>
-        <source>Displays the name of the window and contains controls to manipulate it</source>
+        <source>Holds the name of the window and contains controls to manipulate it</source>
         <translation>Mostra el nom de la finestra i conté controls per a manipular-la</translation>
     </message>
 </context>
diff --git a/src/VBox/Frontends/VirtualBox/nls/qt_ca_VA.ts b/src/VBox/Frontends/VirtualBox/nls/qt_ca_VA.ts
index 6b617b3..ea63484 100644
--- a/src/VBox/Frontends/VirtualBox/nls/qt_ca_VA.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/qt_ca_VA.ts
@@ -591,7 +591,7 @@ a
         <translation>Tanca la finestra</translation>
     </message>
     <message>
-        <source>Displays the name of the window and contains controls to manipulate it</source>
+        <source>Holds the name of the window and contains controls to manipulate it</source>
         <translation>Mostra el nom de la finestra i conté controls per a manipular-la</translation>
     </message>
 </context>
diff --git a/src/VBox/Frontends/VirtualBox/nls/qt_eu.ts b/src/VBox/Frontends/VirtualBox/nls/qt_eu.ts
index db42c6d..665cb52 100644
--- a/src/VBox/Frontends/VirtualBox/nls/qt_eu.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/qt_eu.ts
@@ -1,6535 +1,5292 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS><TS version="1.1" language="eu">
-<context>
-    <name>AudioOutput</name>
-    <message>
-        <location filename="" line="363"/>
-        <source><html>The audio playback device <b>%1</b> does not work.<br/>Falling back to <b>%2</b>.</html></source>
-        <translation><html><b>%1</b> audio irakurketa gailuak ez du lan egiten.<br/><b>%2</b>-ra itzultzen.</html></translation>
-    </message>
-    <message>
-        <location filename="" line="363"/>
-        <source><html>Switching to the audio playback device <b>%1</b><br/>which just became available and has higher preference.</html></source>
-        <translation><html><b>%1</b> audio irakurketa gailura aldatzen<br/>eskuragarri dagoena eta hobespentasun handiagoa duena.</html></translation>
-    </message>
-    <message>
-        <location filename="" line="363"/>
-        <source>Revert back to device '%1'</source>
-        <translation>Itzuli atzera '%1' gailura</translation>
-    </message>
-</context>
+<!DOCTYPE TS>
+<TS version="2.0">
 <context>
     <name>MAC_APPLICATION_MENU</name>
     <message>
-        <location filename="" line="363"/>
         <source>Services</source>
-        <translation>Zerbitzuak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Hide %1</source>
-        <translation>Ezkutatu %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Hide Others</source>
-        <translation>Ezkutatu Besteak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show All</source>
-        <translation>Erakutsi Denak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Preferences...</source>
-        <translation>Hobespenak...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Quit %1</source>
-        <translation>Utzi %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>About %1</source>
-        <translation>%1-ri buruz</translation>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>AudioOutput</name>
+    <message>
+        <source><html>The audio playback device <b>%1</b> does not work.<br/>Falling back to <b>%2</b>.</html></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source><html>Switching to the audio playback device <b>%1</b><br/>which just became available and has higher preference.</html></source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Revert back to device '%1'</source>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Phonon::</name>
     <message>
-        <location filename="" line="363"/>
         <source>Notifications</source>
-        <translation>Jakinarazpenak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Music</source>
-        <translation>Musika</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Video</source>
-        <translation>Bideoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Communication</source>
-        <translation>Hedabideak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Games</source>
-        <translation>Jolasak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Accessibility</source>
-        <translation>Sarbidetasuna</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Phonon::Gstreamer::Backend</name>
     <message>
-        <location filename="" line="363"/>
         <source>Warning: You do not seem to have the package gstreamer0.10-plugins-good installed.
           Some video features have been disabled.</source>
-        <translation>Kontuz: Ez dirudi gstreamer0.10-pluginak ongi ezarrita dituzunik.
-          Zenbait bideo ezaugarri ezgaitu egin dira.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Warning: You do not seem to have the base GStreamer plugins installed.
           All audio and video support has been disabled</source>
-        <translation>Kontuz: Ez dirudi GStreamer pluginak ezarrita dituzunik.          Audio eta bideo sostengu guztiak ezgaitu egin dira</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Phonon::Gstreamer::MediaObject</name>
     <message>
-        <location filename="" line="363"/>
         <source>Cannot start playback. 
 
 Check your Gstreamer installation and make sure you 
 have libgstreamer-plugins-base installed.</source>
-        <translation>Ezin da irakurketa hasi.
-
-Egiaztatu zure Gstreamer ezarpena eta zihurtatu
-libgstreamer-plugins-base ezarrita duzula.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
-        <location filename="" line="363"/>
         <source>A required codec is missing. You need to install the following codec(s) to play this content: %0</source>
-        <translation>
-            <numerusform>Beharrezko kodeka ez dago. Hurrengo kodeka ezarri behar duzu eduki hau irakurtzeko: %0</numerusform>
-            <numerusform>Beharrezko kodekak ez daude. Hurrengo kodekak ezarri behar dituzu eduki hau irakurtzeko: %0</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not open media source.</source>
-        <translation>Ezinezkoa multimedia ituruburua irekitzea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid source type.</source>
-        <translation>Iturburu mota baliogabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not locate media source.</source>
-        <translation>Ezinezkoa multimedia iturburua kokatzea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not open audio device. The device is already in use.</source>
-        <translation>Ezinezkoa audio gailua irekitzea. Gailua jadanik erabiltzen dago.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not decode media source.</source>
-        <translation>Ezinezkoa multimedia iturburua dekodeatzea.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Phonon::VolumeSlider</name>
     <message>
-        <location filename="" line="363"/>
         <source>Volume: %1%</source>
-        <translation>Bolumena: %1%</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Use this slider to adjust the volume. The leftmost position is 0%, the rightmost is %1%</source>
-        <translation>Erabili irristari hau bolumena ezartzeko. Ezkerreneko kopapena 0% da, eskuinekoena %1%</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3Accel</name>
     <message>
-        <location filename="" line="363"/>
         <source>%1, %2 not defined</source>
-        <translation>%1, %2 zehaztu gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ambiguous %1 not handled</source>
-        <translation>%1 zehazgabea kudeatu gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3DataTable</name>
     <message>
-        <location filename="" line="363"/>
         <source>True</source>
-        <translation>Egia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>False</source>
-        <translation>Faltsua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Insert</source>
-        <translation>Txertatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Update</source>
-        <translation>Eguneratu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Delete</source>
-        <translation>Ezabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3FileDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>Copy or Move a File</source>
-        <translation>Kopiatu edo Mugitu Agiri bat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Read: %1</source>
-        <translation>Irakurri: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Write: %1</source>
-        <translation>Idatzi: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>All Files (*)</source>
-        <translation>Agiri Guztiak (*)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Name</source>
-        <translation>Izena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Size</source>
-        <translation>Neurria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Type</source>
-        <translation>Mota</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Date</source>
-        <translation>Eguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Attributes</source>
-        <translation>Ezaugarriak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&OK</source>
-        <translation>&Ongi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Look &in:</source>
-        <translation>Bilatu &hemen:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>File &name:</source>
-        <translation>Agiri &izena:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>File &type:</source>
-        <translation>Agiri &mota:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Back</source>
-        <translation>Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>One directory up</source>
-        <translation>Igo zuzenbide bat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Create New Folder</source>
-        <translation>Sortu Agiritegi Berria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>List View</source>
-        <translation>Zerrenda Ikuspegia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Detail View</source>
-        <translation>Xehetasun Ikuspegia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Preview File Info</source>
-        <translation>Aurreikusi Agiri Argibideak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Preview File Contents</source>
-        <translation>Aurreikusi Agiri Edukiak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Read-write</source>
-        <translation>Irakur-idaztekoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Read-only</source>
-        <translation>Irakurtzekoa-bakarrik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Write-only</source>
-        <translation>Idaztekoa-bakarrik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Inaccessible</source>
-        <translation>Eskuraezina</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Symlink to File</source>
-        <translation>Lotura-sinbolikoa Agirira</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Symlink to Directory</source>
-        <translation>Symlotura Zuzenbidera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Symlink to Special</source>
-        <translation>Symlotura Berezira</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>File</source>
-        <translation>Agiria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Dir</source>
-        <translation>Zuzenbidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Special</source>
-        <translation>Berezia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open</source>
-        <translation>Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Save As</source>
-        <translation>Gorde Honela</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Open</source>
-        <translation>&Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Save</source>
-        <translation>&Gorde</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Rename</source>
-        <translation>&Berreizendatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Delete</source>
-        <translation>E&zabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>R&eload</source>
-        <translation>&Birgertatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Sort by &Name</source>
-        <translation>Antolatu &Izenez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Sort by &Size</source>
-        <translation>Antolatu &Neurriz</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Sort by &Date</source>
-        <translation>Antolatu &Egunez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Unsorted</source>
-        <translation>&Antolatugabe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Sort</source>
-        <translation>Antolatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show &hidden files</source>
-        <translation>Eraklutsi e&zkutuko agiriak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>the file</source>
-        <translation>agiria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>the directory</source>
-        <translation>zuzenbidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>the symlink</source>
-        <translation>symlotura</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Delete %1</source>
-        <translation>Ezabatu %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source><qt>Are you sure you wish to delete %1 "%2"?</qt></source>
-        <translation><qt>Zihur zaude %1 «%2» ezabatzea nahi duzula?</qt></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Yes</source>
-        <translation>&Bai</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&No</source>
-        <translation>&Ez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>New Folder 1</source>
-        <translation>Agiritegi Berria 1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>New Folder</source>
-        <translation>Agiritegi Berria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>New Folder %1</source>
-        <translation>Agiritegi Berria %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Find Directory</source>
-        <translation>Bilatu  Zuzenbidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Directories</source>
-        <translation>Zuzenbideak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Directory:</source>
-        <translation>Zuzenbidea:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error</source>
-        <translation>Akatsa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1
 File not found.
 Check path and filename.</source>
-        <translation>%1
-Agiria ez da aurkitu.
-Egiaztatu helburua eta agirizena.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3LocalFs</name>
     <message>
-        <location filename="" line="363"/>
         <source>Could not read directory
 %1</source>
-        <translation>Ezinezkoa zuzenbidea sortzea
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not create directory
 %1</source>
-        <translation>Ezinezkoa zuzenbidea sortzea
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not remove file or directory
 %1</source>
-        <translation>Ezinezkoa agiria edo zuzenbidea kentzea
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not rename
 %1
 to
 %2</source>
-        <translation>Ezinezkoa berrizendatzea
-%1
-honela
-%2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not open
 %1</source>
-        <translation>Ezinezkoa irekitzea
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not write
 %1</source>
-        <translation>Ezinezkoa idaztea
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3MainWindow</name>
     <message>
-        <location filename="" line="363"/>
         <source>Line up</source>
-        <translation>Lerroan gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Customize...</source>
-        <translation>Norbereratu...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3NetworkProtocol</name>
     <message>
-        <location filename="" line="363"/>
         <source>Operation stopped by the user</source>
-        <translation>Eragiketa erabiltzaileak geldiarazita</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3ProgressDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3TabDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>OK</source>
-        <translation>Ongi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Apply</source>
-        <translation>Ezarri</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Help</source>
-        <translation>Laguntza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Defaults</source>
-        <translation>Berezkoak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3TextEdit</name>
     <message>
-        <location filename="" line="363"/>
         <source>&Undo</source>
-        <translation>&Desegin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Redo</source>
-        <translation>&Berregin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cu&t</source>
-        <translation>&Ebaki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Copy</source>
-        <translation>&Kopiatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Paste</source>
-        <translation>&Itsatsi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Clear</source>
-        <translation>Garbitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Select All</source>
-        <translation>Hautatu Denak</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3TitleBar</name>
     <message>
-        <location filename="" line="363"/>
         <source>System</source>
-        <translation>Sistema</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Restore up</source>
-        <translation>Leheneratu gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Minimize</source>
-        <translation>Txikiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Restore down</source>
-        <translation>Leheneratu behera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Maximize</source>
-        <translation>Handiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Close</source>
-        <translation>Itxi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Contains commands to manipulate the window</source>
-        <translation>Leihoa manipulatzeko komandoak ditu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Puts a minimized back to normal</source>
-        <translation>Txikiengotua atzera arrunt jartzen du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Moves the window out of the way</source>
-        <translation>Leihoa bidetik kanpo mugitzen du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Puts a maximized window back to normal</source>
-        <translation>Lehio handiendua atzera arrunt jartzen du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Makes the window full screen</source>
-        <translation>Leihoa ikusleiho-osoko egiten du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Closes the window</source>
-        <translation>Leihoa isten du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Holds the name of the window and contains controls to manipulate it</source>
-        <translation>Leihoaren izena eta bere manipulatzeko aginteak ditu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3ToolBar</name>
     <message>
-        <location filename="" line="363"/>
         <source>More...</source>
-        <translation>Gehiago...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3UrlOperator</name>
     <message>
-        <location filename="" line="363"/>
         <source>The protocol `%1' is not supported</source>
-        <translation>`%1' protokoloa ez dago sostengaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The protocol `%1' does not support listing directories</source>
-        <translation>`%1' protokoloak ez ditu zerrendaturiko zuzenbideak sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The protocol `%1' does not support creating new directories</source>
-        <translation>`%1' protokoloak ez du zuzenbide berriak sortzea sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The protocol `%1' does not support removing files or directories</source>
-        <translation>`%1' protokoloak ez du zuzenbideak edo agiriak kentzea sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The protocol `%1' does not support renaming files or directories</source>
-        <translation>`%1' protokoloak ez du agiriak edo zuzenbideak berrizendatzea sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The protocol `%1' does not support getting files</source>
-        <translation>`%1' protokoloak ez du agiriak lortzea sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The protocol `%1' does not support putting files</source>
-        <translation>`%1' protokoloak ez du agiriak jartzea sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The protocol `%1' does not support copying or moving files or directories</source>
-        <translation>`%1' protokoloak ez du agiriak edo zuzenbideak kopiatzea edo mugitzea sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>(unknown)</source>
-        <translation>(ezezaguna)</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>Q3Wizard</name>
     <message>
-        <location filename="" line="363"/>
         <source>&Cancel</source>
-        <translation>E&zeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>< &Back</source>
-        <translation>< &Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Next ></source>
-        <translation>&Hurrengoa ></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Finish</source>
-        <translation>A&maitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Help</source>
-        <translation>&Laguntza</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QAbstractSocket</name>
     <message>
-        <location filename="" line="363"/>
         <source>Host not found</source>
-        <translation>Hostalaria ez da aurkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection refused</source>
-        <translation>Elkarketa baztertuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Socket operation timed out</source>
-        <translation>Hartune eragiketa epez kanpo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Socket is not connected</source>
-        <translation>Hartunea ez dago elkarketuta</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QAbstractSpinBox</name>
     <message>
-        <location filename="" line="363"/>
         <source>&Step up</source>
-        <translation>Urratsa &gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Step &down</source>
-        <translation>Urratsa &behera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Select All</source>
-        <translation>&Hautatu Denak</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QApplication</name>
     <message>
-        <location filename="" line="363"/>
         <source>Activate</source>
-        <translation>Eragin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Executable '%1' requires Qt %2, found Qt %3.</source>
-        <translation>'%1' exekutagarriak Qt %2 behar du, aurkitu da Qt %3.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Incompatible Qt Library Error</source>
-        <translation>Bateraezintasun Qt Liburutegi Akatsa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>QT_LAYOUT_DIRECTION</source>
         <comment>Translate this string to the string 'LTR' in left-to-right languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to get proper widget layout.</comment>
-        <translation>EZES</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Activates the program's main window</source>
-        <translation>Programaren leiho nagusia eragiten du</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QCheckBox</name>
     <message>
-        <location filename="" line="363"/>
         <source>Uncheck</source>
-        <translation>Ez Hautatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Check</source>
-        <translation>Hautatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Toggle</source>
-        <translation>Aldatu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QColorDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>Hu&e:</source>
-        <translation>&Nabardura</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Sat:</source>
-        <translation>&Margoaset.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Val:</source>
-        <translation>&Bal:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Red:</source>
-        <translation>&Gorria:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Green:</source>
-        <translation>&Orlegia:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bl&ue:</source>
-        <translation>&Urdina:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A&lpha channel:</source>
-        <translation>A&lfa bidea:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Basic colors</source>
-        <translation>O&hinarrizko margoak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Custom colors</source>
-        <translation>&Norbere margoak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Add to Custom Colors</source>
-        <translation>&Gehitu Norbere Margoetara</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Select color</source>
-        <translation>Hautatu margoa</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QComboBox</name>
     <message>
-        <location filename="" line="363"/>
         <source>Open</source>
-        <translation>Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>False</source>
-        <translation>Faltsua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>True</source>
-        <translation>Egia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Close</source>
-        <translation>Itxi</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QCoreApplication</name>
     <message>
-        <location filename="" line="363"/>
         <source>%1: permission denied</source>
         <comment>QSystemSemaphore</comment>
-        <translation>%1: baimena ukatuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: already exists</source>
         <comment>QSystemSemaphore</comment>
-        <translation>%1: jadanik badago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: doesn't exists</source>
         <comment>QSystemSemaphore</comment>
-        <translation>%1: ez dago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: out of resources</source>
         <comment>QSystemSemaphore</comment>
-        <translation>%1: baliabideetatik kanpo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: unknown error %2</source>
         <comment>QSystemSemaphore</comment>
-        <translation>%1: %2 akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: key is empty</source>
         <comment>QSystemSemaphore</comment>
-        <translation>%1: giltza hutsik dago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: unable to make key</source>
         <comment>QSystemSemaphore</comment>
-        <translation>%1: ezinezkoa giltza egitea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: ftok failed</source>
         <comment>QSystemSemaphore</comment>
-        <translation>%1: ftok hutsegitea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDB2Driver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to connect</source>
-        <translation>Ezinezkoa elkarketatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to rollback transaction</source>
-        <translation>Ezinezkoa eskualdaketa ezeztatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to set autocommit</source>
-        <translation>Ezinezkoa berez-aurkeztu ezartzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDB2Result</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute statement</source>
-        <translation>Ezinezkoa estamentua exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to prepare statement</source>
-        <translation>Ezinezkoa stamentua gertatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to bind variable</source>
-        <translation>Ezinezkoa aldaera lotzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch record %1</source>
-        <translation>Ezinezkoa %1 grabaketa lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch next</source>
-        <translation>Ezinezkoa hurrengoa lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch first</source>
-        <translation>Ezinezkoa lehena lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDateTimeEdit</name>
     <message>
-        <location filename="" line="363"/>
         <source>AM</source>
-        <translation>GO</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>am</source>
-        <translation>go</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>PM</source>
-        <translation>AR</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>pm</source>
-        <translation>ar</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDial</name>
     <message>
-        <location filename="" line="363"/>
         <source>QDial</source>
-        <translation>QDial</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>SpeedoMeter</source>
-        <translation>Abiadura-Neurgailua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>SliderHandle</source>
-        <translation>Irristari Heldutokia</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>What's This?</source>
-        <translation>Zer da Hau?</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Done</source>
-        <translation>Eginda</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDialogButtonBox</name>
     <message>
-        <location filename="" line="363"/>
         <source>OK</source>
-        <translation>Ongi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Save</source>
-        <translation>Gorde</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open</source>
-        <translation>Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Close</source>
-        <translation>Itxi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Apply</source>
-        <translation>Ezarri</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Reset</source>
-        <translation>Berrabiarazi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Help</source>
-        <translation>Laguntza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Don't Save</source>
-        <translation>Ez Gorde</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Discard</source>
-        <translation>Baztertu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Yes</source>
-        <translation>&Bai</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Yes to &All</source>
-        <translation>Bai G&uztiari</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&No</source>
-        <translation>&Ez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>N&o to All</source>
-        <translation>Ez Guz&tiari</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Save All</source>
-        <translation>Gorde Denak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Abort</source>
-        <translation>Utzi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Retry</source>
-        <translation>Bersaiatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ignore</source>
-        <translation>Ezikusi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Restore Defaults</source>
-        <translation>Berrezarri Berezkoak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Close without Saving</source>
-        <translation>Itxi Gorde gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&OK</source>
-        <translation>&Ongi</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDirModel</name>
     <message>
-        <location filename="" line="363"/>
         <source>Name</source>
-        <translation>Izena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Size</source>
-        <translation>Neurria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Kind</source>
         <comment>Match OS X Finder</comment>
-        <translation>Mota</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Type</source>
         <comment>All other platforms</comment>
-        <translation>Mota</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Date Modified</source>
-        <translation>Aldatze Eguna</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDockWidget</name>
     <message>
-        <location filename="" line="363"/>
         <source>Close</source>
-        <translation>Itxi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Dock</source>
-        <translation>Uztartu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Float</source>
-        <translation>Gainean</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QDoubleSpinBox</name>
     <message>
-        <location filename="" line="363"/>
         <source>More</source>
-        <translation>Gehiago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Less</source>
-        <translation>Gutxiago</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QErrorMessage</name>
     <message>
-        <location filename="" line="363"/>
         <source>Debug Message:</source>
-        <translation>Garbiketa  Mezua:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Warning:</source>
-        <translation>Kontuz:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Fatal Error:</source>
-        <translation>Akats Larria:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Show this message again</source>
-        <translation>&Erakutsi mezu hau berriro</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&OK</source>
-        <translation>&Ongi</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QFileDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>All Files (*)</source>
-        <translation>Agiri Guztiak (*)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Directories</source>
-        <translation>Zuzenbideak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Open</source>
-        <translation>&Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Save</source>
-        <translation>&Gorde</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open</source>
-        <translation>Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 already exists.
 Do you want to replace it?</source>
-        <translation>%1 jadanik badago.
-Ordeztea nahi duzu?</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1
 File not found.
 Please verify the correct file name was given.</source>
-        <translation>%1
-Agiria ez da aurkitu.
-Mesedez egiaztatu emaniko agiri izena zuzena dela.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>My Computer</source>
-        <translation>Nire Ordenagailua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Rename</source>
-        <translation>Be&rrizendatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Delete</source>
-        <translation>E&zabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show &hidden files</source>
-        <translation>Erakutsi  e&zkutuko agiriak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Back</source>
-        <translation>Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Parent Directory</source>
-        <translation>Gaineko Zuzenbidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>List View</source>
-        <translation>Zerrenda Ikuspegia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Detail View</source>
-        <translation>Xehetasun Ikuspegia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Files of type:</source>
-        <translation>Agiri mota:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Directory:</source>
-        <translation>Zuzenbidea:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1
 Directory not found.
 Please verify the correct directory name was given.</source>
-        <translation>%1
-Zuzenbidea ez da aurkitu.
-Mesedez egiaztatu emaniko zuzenbide izena zuzena dela.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>'%1' is write protected.
 Do you want to delete it anyway?</source>
-        <translation>'%1' idaz-aurka babestuta dago.
-Horrela ere ezabatzea nahi duzu?</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Are sure you want to delete '%1'?</source>
-        <translation>Zihur zaude '%1' ezabatzea nahi duzula?</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not delete directory.</source>
-        <translation>Ezinezkoa zuzenbidea ezabatzea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Save As</source>
-        <translation>Gorde Honela</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Drive</source>
-        <translation>Gidagailua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>File</source>
-        <translation>Agiria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown</source>
-        <translation>Ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Find Directory</source>
-        <translation>Bilatu Zuzenbidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show </source>
-        <translation>Erakutsi </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Forward</source>
-        <translation>Aurrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>New Folder</source>
-        <translation>Agiritegi Berria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&New Folder</source>
-        <translation>Agiritegi &Berria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Choose</source>
-        <translation>&Hautatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Remove</source>
-        <translation>Kendu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>File &name:</source>
-        <translation>Agiri &izena:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Look in:</source>
-        <translation>Begiratu hemen:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Create New Folder</source>
-        <translation>Sortu Agiritegi Berria</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QFileSystemModel</name>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid filename</source>
-        <translation>Agirizen baliogabea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source><b>The name "%1" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks.</source>
-        <translation><b>"%1" izena ezin da erabili.</b><p>Saiatu beste izen bat erabiltzen, hizki gutxiagokin edo puntuaketa marka gabe.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Name</source>
-        <translation>Izena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Size</source>
-        <translation>Neurria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Kind</source>
         <comment>Match OS X Finder</comment>
-        <translation>Mota</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Type</source>
         <comment>All other platforms</comment>
-        <translation>Mota</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Date Modified</source>
-        <translation>Aldaketa Eguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>My Computer</source>
-        <translation>Nire Ordenagailua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Computer</source>
-        <translation>Ordenagailua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 TB</source>
-        <translation>%1 TB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 GB</source>
-        <translation>%1 GB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 MB</source>
-        <translation>%1 MB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 KB</source>
-        <translation>%1 KB</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 bytes</source>
-        <translation>%1 byte</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QFontDatabase</name>
     <message>
-        <location filename="" line="363"/>
         <source>Normal</source>
-        <translation>Arrunta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bold</source>
-        <translation>Lodia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Demi Bold</source>
-        <translation>Erdi Lodia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Black</source>
-        <translation>Beltza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Demi</source>
-        <translation>Erdia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Light</source>
-        <translation>Argia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Italic</source>
-        <translation>Etzana</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Oblique</source>
-        <translation>Okerra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Any</source>
-        <translation>Edozein</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Latin</source>
-        <translation>Latinera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Greek</source>
-        <translation>Greziera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cyrillic</source>
-        <translation>Ziriliarra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Armenian</source>
-        <translation>Armeniera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Hebrew</source>
-        <translation>Hebraiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Arabic</source>
-        <translation>Arabiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Syriac</source>
-        <translation>Siriera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Thaana</source>
-        <translation>Thaanaera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Devanagari</source>
-        <translation>Devanagariera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bengali</source>
-        <translation>Bengaliera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Gurmukhi</source>
-        <translation>Gurmukhiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Gujarati</source>
-        <translation>Guxaratiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Oriya</source>
-        <translation>Oriyaera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Tamil</source>
-        <translation>Tamilera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Telugu</source>
-        <translation>Teluguera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Kannada</source>
-        <translation>Kannadaera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Malayalam</source>
-        <translation>Malayalamera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Sinhala</source>
-        <translation>Sinhalaera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Thai</source>
-        <translation>Thailandiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Lao</source>
-        <translation>Laosera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Tibetan</source>
-        <translation>Tibetera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Myanmar</source>
-        <translation>Myanmarrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Georgian</source>
-        <translation>Georgiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Khmer</source>
-        <translation>Khmerrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Simplified Chinese</source>
-        <translation>Txinera Arrundua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Traditional Chinese</source>
-        <translation>Txinera Tradizionala</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Japanese</source>
-        <translation>Japoniera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Korean</source>
-        <translation>Koreaera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Vietnamese</source>
-        <translation>Vietnamera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Symbol</source>
-        <translation>Ikurra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ogham</source>
-        <translation>Oghamera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Runic</source>
-        <translation>Errunikoa</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QFontDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>&Font</source>
-        <translation>&Hizkia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Font st&yle</source>
-        <translation>Hizki &estiloa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Size</source>
-        <translation>&Neurria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Effects</source>
-        <translation>Eraginak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Stri&keout</source>
-        <translation>&Marratua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Underline</source>
-        <translation>&Azpimarratua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Sample</source>
-        <translation>Lagina</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Wr&iting System</source>
-        <translation>I&dazketa Sistema</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Select Font</source>
-        <translation>Hautatu Hizkia</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QFtp</name>
     <message>
-        <location filename="" line="363"/>
         <source>Not connected</source>
-        <translation>Elkarketatu  gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Host %1 not found</source>
-        <translation>Hostalaria %1 ez da aurkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection refused to host %1</source>
-        <translation>%1 hostalariak elkarketa bazteru du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connected to host %1</source>
-        <translation>%1 hostalarira elkarketaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection refused for data connection</source>
-        <translation>Elkarketa ukatua datu elkarketatik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown error</source>
-        <translation>Akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connecting to host failed:
 %1</source>
-        <translation>Hutsegitea hostalariarekin elkarketatzerakoan:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Login failed:
 %1</source>
-        <translation>Saio haste hutsegitea:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Listing directory failed:
 %1</source>
-        <translation>Zuzenbide zerrendapen hutsegitea:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Changing directory failed:
 %1</source>
-        <translation>Zuzenbide aldaketa hutsegitea:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Downloading file failed:
 %1</source>
-        <translation>Agiri jeisketa hutsegitea:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Uploading file failed:
 %1</source>
-        <translation>Agiri igotze hutsegitea:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Removing file failed:
 %1</source>
-        <translation>Agiri kentze hutsegitea:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Creating directory failed:
 %1</source>
-        <translation>Zuzenbide sortze hutsegitea:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Removing directory failed:
 %1</source>
-        <translation>Zuzenbide kentze hutsegitea:
-%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection closed</source>
-        <translation>Elkarketa itxita</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Host %1 found</source>
-        <translation>%1 hostalaria aurkitu da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection to %1 closed</source>
-        <translation>%1-rako elkarketa itxita</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Host found</source>
-        <translation>Hostalaria aurkitu da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connected to host</source>
-        <translation>Hostalarira elkarketaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QHostInfo</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown error</source>
-        <translation>Akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QHostInfoAgent</name>
     <message>
-        <location filename="" line="363"/>
         <source>Host not found</source>
-        <translation>Hostalaria ez da aurkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown address type</source>
-        <translation>Helbide mota ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown error</source>
-        <translation>Akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QHttp</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown error</source>
-        <translation>Akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Request aborted</source>
-        <translation>Eskaera utzita</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No server set to connect to</source>
-        <translation>Ez da zerbitzaririk ezarri hona elkarketatzeko</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Wrong content length</source>
-        <translation>Eduki luzera okerra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Server closed connection unexpectedly</source>
-        <translation>Zerbitzariak elkarketa itxi du ustekabean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection refused</source>
-        <translation>Elkarketa ukatua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Host %1 not found</source>
-        <translation>%1 hostalaria ez da aurkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>HTTP request failed</source>
-        <translation>HTTP eskaera hutsegitea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid HTTP response header</source>
-        <translation>HTTP erantzun idazburu baliogabea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid HTTP chunked body</source>
-        <translation>HTTP zatiketa gorputz baliogabea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Host %1 found</source>
-        <translation>%1 hostalaria aurkitu da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connected to host %1</source>
-        <translation>%1 hostalarira elkarketaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection to %1 closed</source>
-        <translation>%1-rako elkarketa itxita</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Host found</source>
-        <translation>Hostalaria aurkitu da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connected to host</source>
-        <translation>Hostalariari elkarketaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection closed</source>
-        <translation>Elkarketa itxita</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Proxy authentication required</source>
-        <translation>Proxy egiaztapena beharrezkoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Authentication required</source>
-        <translation>Egiaztapena beharrezkoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>HTTPS connection requested but SSL support not compiled in</source>
-        <translation>HTTPS elkarketa eskatuta baina SSL sostengua ez dago bilduta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection refused (or timed out)</source>
-        <translation>Elkarketa baztertuta (edo denboraz kanpo)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Proxy requires authentication</source>
-        <translation>Proxyak egiaztapen behar du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Host requires authentication</source>
-        <translation>Hostalariak egiaztapena behar du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Data corrupted</source>
-        <translation>Datuak hondatuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown protocol specified</source>
-        <translation>Protokolo ezezaguna adierazi da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>SSL handshake failed</source>
-        <translation>SSL eskuemate hutsegitea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QHttpSocketEngine</name>
     <message>
-        <location filename="" line="363"/>
         <source>Authentication required</source>
-        <translation>Egiaztapena beharrezkoa</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QIBaseDriver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Error opening database</source>
-        <translation>Akatsa datubasea irekitzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not start transaction</source>
-        <translation>Ezinezkoa eskualdaketa abiaraztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to rollback transaction</source>
-        <translation>Ezinezkoa eskualdaketa ezeztatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QIBaseResult</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to create BLOB</source>
-        <translation>Ezinezkoa BLOB sortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to write BLOB</source>
-        <translation>Ezinezkoa BLOB idaztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to open BLOB</source>
-        <translation>BLOB irekitzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to read BLOB</source>
-        <translation>Ezinezkoa BLOB irakurtzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not find array</source>
-        <translation>Ezin da arraya aurkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not get array data</source>
-        <translation>Ezin da array daturik lortu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not get query info</source>
-        <translation>Ezin da eskaera argibiderik lortu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not start transaction</source>
-        <translation>Ezin da eskualdaketa hasi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not allocate statement</source>
-        <translation>Ezin da estamentua esleitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not prepare statement</source>
-        <translation>Ezin da estamentua gertatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not describe input statement</source>
-        <translation>Ezin da sarrera estamentua azaldu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not describe statement</source>
-        <translation>Ezin da estamentua azaldu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to close statement</source>
-        <translation>Ezinezkoa estamentua istea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute query</source>
-        <translation>Ezinezkoa eskaera exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not fetch next item</source>
-        <translation>Ezin da hurrengo gaia lortu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not get statement info</source>
-        <translation>Ezin da estamentu argibiderik lortu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QIODevice</name>
     <message>
-        <location filename="" line="363"/>
         <source>Permission denied</source>
-        <translation>Baimena ukatuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Too many open files</source>
-        <translation>Agiri gehiegi irekita</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No such file or directory</source>
-        <translation>Ez dago agiria edo zuzenbidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No space left on device</source>
-        <translation>Ez da tokirik gelditzen gailuan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown error</source>
-        <translation>Akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QInputContext</name>
     <message>
-        <location filename="" line="363"/>
         <source>XIM</source>
-        <translation>XIM</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>XIM input method</source>
-        <translation>XIM sarrera metodoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Windows input method</source>
-        <translation>Windows sarrera metodoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Mac OS X input method</source>
-        <translation>Mac OS X sarrera metodoa</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QLibrary</name>
     <message>
-        <location filename="" line="363"/>
         <source>QLibrary::load_sys: Cannot load %1 (%2)</source>
-        <translation>QLibrary::load_sys: Ezin da gertatu %1 (%2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>QLibrary::unload_sys: Cannot unload %1 (%2)</source>
-        <translation>QLibrary::unload_sys: Ezin da desgertatu %1 (%2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>QLibrary::resolve_sys: Symbol "%1" undefined in %2 (%3)</source>
-        <translation>QLibrary::resolve_sys: "%1" sinboloa zehaztugabe hemen %2 (%3)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not mmap '%1': %2</source>
-        <translation>Ezin da mmapatu '%1': %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Plugin verification data mismatch in '%1'</source>
-        <translation>Plugin egiaztapen datuak ez datoz bat hemen, '%1'</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not unmap '%1': %2</source>
-        <translation>Ezin da desmapatu '%1': %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The plugin '%1' uses incompatible Qt library. (%2.%3.%4) [%5]</source>
-        <translation>'%1' pluginak Qt liburutegi bateraezina erabiltzen du. (%2.%3.%4) [%5]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The plugin '%1' uses incompatible Qt library. Expected build key "%2", got "%3"</source>
-        <translation>'%1' pluginak Qt liburutegi bateraezina erabiltzen du. Itxarondako eraiketa giltza "%2", lortua "%3"</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown error</source>
-        <translation>Akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The shared library was not found.</source>
-        <translation>Elkarbanatutako liburutegia ez da aurkitu.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The file '%1' is not a valid Qt plugin.</source>
-        <translation>'%1' agiria ez da baliozko Qt plugina.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The plugin '%1' uses incompatible Qt library. (Cannot mix debug and release libraries.)</source>
-        <translation>'%1' pluginak Qt liburutegi bateraezina erabiltzen du. (Ezin dira garbiketa eta argitalpen liburutegiak nahastu.)</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QLineEdit</name>
     <message>
-        <location filename="" line="363"/>
         <source>&Undo</source>
-        <translation>&Desegin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Redo</source>
-        <translation>&Berregin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cu&t</source>
-        <translation>&Ebaki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Copy</source>
-        <translation>&Kopiatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Paste</source>
-        <translation>&Itsasi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Delete</source>
-        <translation>Ezabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Select All</source>
-        <translation>Hautatu Denak</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QLocalServer</name>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Name error</source>
-        <translation>%1: Izen akatsa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Permission denied</source>
-        <translation>%1: Baimena ukatuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Address in use</source>
-        <translation>%1: Helbidea erabilia da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Unknown error %2</source>
-        <translation>%1: Akats ezezaguna %2</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QLocalSocket</name>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Connection refused</source>
-        <translation>%1: Elkarketa baztertua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Remote closed</source>
-        <translation>%1: Hurrunekoa itxita</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Invalid name</source>
-        <translation>%1: Izen baliogabea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Socket access error</source>
-        <translation>%1: Aho sarbie akatsa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Socket resource error</source>
-        <translation>%1: Aho baliabide akatsa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Socket operation timed out</source>
-        <translation>%1: Ahoa eragiketa epez kanpo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Datagram too large</source>
-        <translation>%1: Datagrama handiegia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Connection error</source>
-        <translation>%1: Elkarketa akatsa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: The socket operation is not supported</source>
-        <translation>%1: Aho eragiketa ez dago sostengaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: Unknown error %2</source>
-        <translation>%1: Akats ezezaguna %2</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QMYSQLDriver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to open database '</source>
-        <translation>Ezinezkoa datubasea irekitzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to connect</source>
-        <translation>Ezinezkoa elkarketatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to begin transaction</source>
-        <translation>Ezinezkoa eskualdaketa hastea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to rollback transaction</source>
-        <translation>Ezinezkoa eskualdaketa ezeztatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QMYSQLResult</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch data</source>
-        <translation>Ezinezkoa datuak lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute query</source>
-        <translation>Ezinezkoa eskaera exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to store result</source>
-        <translation>Ezinezkoa emaitza biltegiratzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to prepare statement</source>
-        <translation>Ezinezkoa estamentua gertatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to reset statement</source>
-        <translation>Ezinezkoa estamentua berrezartzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to bind value</source>
-        <translation>Ezinezkoa balioa lotzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute statement</source>
-        <translation>Ezinezkoa estametua exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to bind outvalues</source>
-        <translation>Ezinezkoa kanpo-balioak lotzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to store statement results</source>
-        <translation>Ezinezkoa estametu emaitzak biltegiratzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute next query</source>
-        <translation>Ezinezkoa hurrengo eskaera exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to store next result</source>
-        <translation>Ezinezkoa hurrengo emaitza biltegiratzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QMdiArea</name>
     <message>
-        <location filename="" line="363"/>
         <source>(Untitled)</source>
-        <translation>(Izenburu gabea)</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QMdiSubWindow</name>
     <message>
-        <location filename="" line="363"/>
         <source>%1 - [%2]</source>
-        <translation>%1 - [%2]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Close</source>
-        <translation>Itxi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Minimize</source>
-        <translation>Txikiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Restore Down</source>
-        <translation>Leheneratu Behera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Restore</source>
-        <translation>&Leheneratu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Move</source>
-        <translation>&Mugitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Size</source>
-        <translation>&Neurria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Mi&nimize</source>
-        <translation>T&xikiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ma&ximize</source>
-        <translation>&Handiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Stay on &Top</source>
-        <translation>Eduki &Gainean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Close</source>
-        <translation>It&xi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>- [%1]</source>
-        <translation>- [%1]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Maximize</source>
-        <translation>Handiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unshade</source>
-        <translation>Desitzaldu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Shade</source>
-        <translation>Itzaldu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Restore</source>
-        <translation>Leheneratu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Help</source>
-        <translation>Laguntza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Menu</source>
-        <translation>Menua</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QMenu</name>
     <message>
-        <location filename="" line="363"/>
         <source>Close</source>
-        <translation>Itxi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open</source>
-        <translation>Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Execute</source>
-        <translation>Exekutatu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QMessageBox</name>
     <message>
-        <location filename="" line="363"/>
         <source>Help</source>
-        <translation>Laguntza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>OK</source>
-        <translation>Ongi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>About Qt</source>
-        <translation>Qt-ri buruz</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source><p>This program uses Qt version %1.</p></source>
-        <translation><p>Programa honek Qt %1 bertsio erabiltzen du.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show Details...</source>
-        <translation>Erakutsi Xehetasunak...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Hide Details...</source>
-        <translation>Ezkutatu Xehetasunak...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source><p>This program uses Qt Open Source Edition version %1.</p><p>Qt Open Source Edition is intended for the development of Open Source applications. You need a commercial Qt license for development of proprietary (closed source) applications.</p><p>Please see <a href="http://www.trolltech.com/company/model/">www.trolltech.com/company/model/</a> for an overview of Qt licensing.</p></source>
-        <translation><p>Programa honek Qt Iturburu Irekia Edizioa %1 bertsioa erabiltzen du.</p><p>Qt Iturburu Irekia Edizioa Iturburu Irekiko aplikazioak garatzeko egina dago. Qt merkatal baimen bat behar duzu jabetzako (iturburu itxiko) aplikazioak garatzeko.</p><p>Mesedez ikusi <a href="http://www.trolltech.com/company/model/">www.trolltech.com/company/model/</a> Qt baimenari gainbegirada bat emateko.</p></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source><h3>About Qt</h3>%1<p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is a Nokia product. See <a href="http://www.trolltech.com/qt/">www.trolltech.com/qt/&l [...]
-        <translation><h3>Qt-ri buruz</h3>%1<p>Qt plataforma-anitzeko aplikazioen garapenerako C++ tresna-kit bat da.</p><p>Qt-k iturburu-bakarreko eramangarritasuna eskaintzen du MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, etal Unix merkatal aldaera nagusi guztien artean. Qt eskuragarri dago ere barneratutako gailuetarako Barneratutako Linux eta Windows CE-rako Qt-rekin.</p><p>Qt Nokia produktu bat da. Ikusi <a href="http://ww [...]
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QMultiInputContext</name>
     <message>
-        <location filename="" line="363"/>
         <source>Select IM</source>
-        <translation>Hautatu SM</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QMultiInputContextPlugin</name>
     <message>
-        <location filename="" line="363"/>
         <source>Multiple input method switcher</source>
-        <translation>Sarrera anitz metodo aldagailua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Multiple input method switcher that uses the context menu of the text widgets</source>
-        <translation>Idazki widgeten hitzingurua erabiltzen duen sarrera metodo anitz aldatzailea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QNativeSocketEngine</name>
     <message>
-        <location filename="" line="363"/>
         <source>The remote host closed the connection</source>
-        <translation>Hurruneko hostalariak elkarketa itxi du</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Network operation timed out</source>
-        <translation>Sare eragiketa denboraz kanpo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Out of resources</source>
-        <translation>Baliabide gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unsupported socket operation</source>
-        <translation>Sostegatu gabeko aho eragiketa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Protocol type not supported</source>
-        <translation>Protokolo mota ez dago sostengaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid socket descriptor</source>
-        <translation>Baliogabeko aho azaltzailea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Network unreachable</source>
-        <translation>Sarea erdietsiezina</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Permission denied</source>
-        <translation>Baimena ukatuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection timed out</source>
-        <translation>Elkarketa denboraz kanpo</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Connection refused</source>
-        <translation>Elkarketa baztertuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The bound address is already in use</source>
-        <translation>Muga helbidea jadanik erabilia da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The address is not available</source>
-        <translation>Helbidea ez dago eskuragarri</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The address is protected</source>
-        <translation>Helbidea babestuta dago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to send a message</source>
-        <translation>Ezinezkoa mezu bat bidaltzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to receive a message</source>
-        <translation>Ezinezkoa mezu bat jasotzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to write</source>
-        <translation>Ezinezkoa idaztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Network error</source>
-        <translation>Sare akatsa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Another socket is already listening on the same port</source>
-        <translation>Jadanik beste aho bat dago ataka berean aditzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to initialize non-blocking socket</source>
-        <translation>Ezinezkoa blokeatze-gabeko ahoa abiaraztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to initialize broadcast socket</source>
-        <translation>Ezinezkoa broadcast ahoa abiaraztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Attempt to use IPv6 socket on a platform with no IPv6 support</source>
-        <translation>IPv6 ahoa erabiltzeko saiakera IPv6 sostengurik ez duen plataforma batean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Host unreachable</source>
-        <translation>Hostalaria erdietsiezina</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Datagram was too large to send</source>
-        <translation>Datagrama handiegia da bidaltzeko</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Operation on non-socket</source>
-        <translation>Eragiketa aho-gabean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown error</source>
-        <translation>Akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The proxy type is invalid for this operation</source>
-        <translation>Proxy mota baliogabea da eragiketa honetarako</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QNetworkAccessFileBackend</name>
     <message>
-        <location filename="" line="363"/>
         <source>Request for opening non-local file %1</source>
-        <translation>Ez-tokiko %1 agiri irekitze eskaera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error opening %1: %2</source>
-        <translation>Akatsa irekitzerakoan %1: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Write error writing to %1: %2</source>
-        <translation>Idazketa akatsa %1-ra idazterakoan: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cannot open %1: Path is a directory</source>
-        <translation>Ezin da %1 ireki: Helburua zuzenbide bat da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Read error reading from %1: %2</source>
-        <translation>Irakurketa akatsa %1-tik irakurtzerakoan: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QNetworkAccessFtpBackend</name>
     <message>
-        <location filename="" line="363"/>
         <source>Cannot open %1: is a directory</source>
-        <translation>Ezin da %1 ireki: zuzenbide bat da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Logging in to %1 failed: authentication required</source>
-        <translation>Saio haste hutsegitea %1: egiaztapena beharrezkoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error while downloading %1: %2</source>
-        <translation>Akatsa %1 jeisketerakoan: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error while uploading %1: %2</source>
-        <translation>Akatsa %1 igotzerakoan: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QNetworkReply</name>
     <message>
-        <location filename="" line="363"/>
         <source>Error downloading %1 - server replied: %2</source>
-        <translation>Akatsa %1 jeisterakoan- zerbitzariaren erantzuna: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Protocol "%1" is unknown</source>
-        <translation>"%1" protokoloa ezezaguna da</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QNetworkReplyImpl</name>
     <message>
-        <location filename="" line="363"/>
         <source>Operation canceled</source>
-        <translation>Eragiketa ezeztatuta</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QOCIDriver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to logon</source>
-        <translation>Ezinezkoa saioa hastea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to initialize</source>
         <comment>QOCIDriver</comment>
-        <translation>Ezinezkoa abiaraztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to begin transaction</source>
-        <translation>Ezinezkoa eskualdaketa hastea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to rollback transaction</source>
-        <translation>Ezinezkoa eskualdaketa ezeztatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QOCIResult</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to bind column for batch execute</source>
-        <translation>Ezinezkoa zutabea lotzea multzo exekuziorako</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute batch statement</source>
-        <translation>Ezinezkoa multzo estamentua exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to goto next</source>
-        <translation>Ezinezkoa hurrengora joatea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to alloc statement</source>
-        <translation>Ezinezkoa estamentua esleitzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to prepare statement</source>
-        <translation>Ezinezkoa estametua gertatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to bind value</source>
-        <translation>Ezinezkoa balioa lotzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute select statement</source>
-        <translation>Ezinezkoa hautaturiko estametua exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute statement</source>
-        <translation>Ezinezkoa estametua exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QODBCDriver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to connect</source>
-        <translation>Ezinezkoa elkarketatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to connect - Driver doesn't support all needed functionality</source>
-        <translation>Ezinezkoa elkarketatzea - Gidatzaileak ez ditu beharrezko eginkizun guztiak sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to disable autocommit</source>
-        <translation>Ezinezkoa berez-aurkeztea ezgaitzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to rollback transaction</source>
-        <translation>Ezinezkoa eskualdaketa ezeztatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to enable autocommit</source>
-        <translation>Ezinezkoa berez-aurkeztea gaitzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QODBCResult</name>
     <message>
-        <location filename="" line="363"/>
         <source>QODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration</source>
-        <translation>QODBCResult::reset: Ezinezkoa 'SQL_CURSOR_STATIC' estamentu ezaugarri bezala ezartzea. Mesedez egiaztatu zure ODBC gidagailu itxurapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute statement</source>
-        <translation>Ezinezkoa estamentua exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch next</source>
-        <translation>Ezinezkoa hurrengoa lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to prepare statement</source>
-        <translation>Ezinezkoa estametua gertatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to bind variable</source>
-        <translation>Ezinezkoa aldaera lotzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch last</source>
-        <translation>Ezinezkoa azkena lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch</source>
-        <translation>Ezinezkoa lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch first</source>
-        <translation>Ezinezkoa lehena lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch previous</source>
-        <translation>Ezinezkoa aurrekoa lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QObject</name>
     <message>
-        <location filename="" line="363"/>
         <source>Operation not supported on %1</source>
-        <translation>Eragiketa ez dago sostengaturik %1-ean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid URI: %1</source>
-        <translation>URI baliogabea: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Write error writing to %1: %2</source>
-        <translation>Idazketa akatsa %1-ra idazterakoan: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Read error reading from %1: %2</source>
-        <translation>Irakurketa akatsa %1-tik irakurtzerakoan: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Socket error on %1: %2</source>
-        <translation>Socket akatsa %1:%2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Remote host closed the connection prematurely on %1</source>
-        <translation>Hurruneko hostalariak elkarketa goizegi itxi du %1-ean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Protocol error: packet of size 0 received</source>
-        <translation>Protokolo akatsa: 0 neurriko paketea jaso da</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPPDOptionsModel</name>
     <message>
-        <location filename="" line="363"/>
         <source>Name</source>
-        <translation>Izena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Value</source>
-        <translation>Balioa</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPSQLDriver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to connect</source>
-        <translation>Ezinezkoa elkarketatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not begin transaction</source>
-        <translation>Ezinezkoa eskualdaketa hasi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Could not rollback transaction</source>
-        <translation>Ezin izan da eskualdaketa ezeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to subscribe</source>
-        <translation>Ezinekoa harpidetzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to unsubscribe</source>
-        <translation>Ezinezkoa harpidetza etetea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPSQLResult</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to create query</source>
-        <translation>Ezinezkoa eskaera sortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to prepare statement</source>
-        <translation>Ezinezkoa estamentua gertatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPageSetupWidget</name>
     <message>
-        <location filename="" line="363"/>
         <source>Centimeters (cm)</source>
-        <translation>Metroehunen (me)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Millimeters (mm)</source>
-        <translation>Metromilaenak (mm)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Inches (in)</source>
-        <translation>Hatzbeteak (hb)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Points (pt)</source>
-        <translation>Puntoak (pt)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Form</source>
-        <translation>Forma</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Paper</source>
-        <translation>Papera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page size:</source>
-        <translation>Orrialde neurria:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Width:</source>
-        <translation>Zabalera:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Height:</source>
-        <translation>Garaiera:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Paper source:</source>
-        <translation>Paper iturburua:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Orientation</source>
-        <translation>Norabidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Portrait</source>
-        <translation>Argazkia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Landscape</source>
-        <translation>Landargazkia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Reverse landscape</source>
-        <translation>Alderantzizkatu landargazkia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Reverse portrait</source>
-        <translation>Alderantzizkatu argazkia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Margins</source>
-        <translation>Bazterrak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>top margin</source>
-        <translation>goio bazterra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>left margin</source>
-        <translation>ezker bazterra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>right margin</source>
-        <translation>eskuin bazterra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>bottom margin</source>
-        <translation>beheko bazterra</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPluginLoader</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown error</source>
-        <translation>Akats ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The plugin was not loaded.</source>
-        <translation>Plugina ez da gertatu.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPrintDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>locally connected</source>
-        <translation>tokian elkarketaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Aliases: %1</source>
-        <translation>Izenordea: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>unknown</source>
-        <translation>ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print To File ...</source>
-        <translation>Irarkitu Agirira...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>File %1 is not writable.
 Please choose a different file name.</source>
-        <translation>%1 agiria ez da idazgarria.
-Mesedez hautatu agiri izen ezberdin bat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 already exists.
 Do you want to overwrite it?</source>
-        <translation>%1 badago jadanik..
-Gainidaztea nahi duzu?</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is a directory.
 Please choose a different file name.</source>
-        <translation>%1 zuzenbide bat da.
-Mesedez hautatu agiri izen ezberdin bat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A0</source>
-        <translation>A0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A1</source>
-        <translation>A1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A2</source>
-        <translation>A2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A3</source>
-        <translation>A3</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A4</source>
-        <translation>A4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A5</source>
-        <translation>A5</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A6</source>
-        <translation>A6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A7</source>
-        <translation>A7</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A8</source>
-        <translation>A8</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A9</source>
-        <translation>A9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B0</source>
-        <translation>B0</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B1</source>
-        <translation>B1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B2</source>
-        <translation>B2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B3</source>
-        <translation>B3</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B4</source>
-        <translation>B4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B5</source>
-        <translation>B5</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B6</source>
-        <translation>B6</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B7</source>
-        <translation>B7</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B8</source>
-        <translation>B8</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B9</source>
-        <translation>B9</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>B10</source>
-        <translation>B10</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>C5E</source>
-        <translation>C5E</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>DLE</source>
-        <translation>DLE</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Executive</source>
-        <translation>Exekutiboa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Folio</source>
-        <translation>Orria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ledger</source>
-        <translation>Salerosketa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Legal</source>
-        <translation>Legezkoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Letter</source>
-        <translation>Gutuna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Tabloid</source>
-        <translation>Tabloidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>US Common #10 Envelope</source>
-        <translation>AEB Arrunta #10 Gutuna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Custom</source>
-        <translation>Norberea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Options >></source>
-        <translation>A&ukerak >></translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Print</source>
-        <translation>&Irarkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Options <<</source>
-        <translation>A&ukerak <<</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print to File (PDF)</source>
-        <translation>Irarkitu Agirira (PDF)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print to File (Postscript)</source>
-        <translation>Irarkitu Agirira (Postscript)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Local file</source>
-        <translation>Tokiko agiria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Write %1 file</source>
-        <translation>Idatzi %1 agiria</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPrintPreviewDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>Page Setup</source>
-        <translation>Orrialde Ezarpena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print Preview</source>
-        <translation>Irarketa Aurreikuspena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Next page</source>
-        <translation>Hurrengo orrialdea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Previous page</source>
-        <translation>Aurreko orrialdea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>First page</source>
-        <translation>Lehen orrialdea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Last page</source>
-        <translation>Azken orrialdea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Fit width</source>
-        <translation>Finkatu zabalera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Fit page</source>
-        <translation>Finkatu orrialdea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Zoom in</source>
-        <translation>Zooma gehitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Zoom out</source>
-        <translation>Zooma gutxitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Portrait</source>
-        <translation>Argazkia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Landscape</source>
-        <translation>Landargazkia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show single page</source>
-        <translation>Erakutsi orrialde bakarra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show facing pages</source>
-        <translation>Erautsi alderantzizko orrialdeak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show overview of all pages</source>
-        <translation>Erakutsi orrialde guztien gainikuspena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print</source>
-        <translation>Irarkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page setup</source>
-        <translation>Orrialde ezarpena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Close</source>
-        <translation>Itxi</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPrintPropertiesWidget</name>
     <message>
-        <location filename="" line="363"/>
         <source>Form</source>
-        <translation>Forma</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page</source>
-        <translation>Orrialdea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Advanced</source>
-        <translation>Aurreratua</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPrintSettingsOutput</name>
     <message>
-        <location filename="" line="363"/>
         <source>Form</source>
-        <translation>Forma</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Copies</source>
-        <translation>Kopiak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print range</source>
-        <translation>Irarketa maila</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print all</source>
-        <translation>Irarkitu denak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Pages from</source>
-        <translation>Orrialdeen forma</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>to</source>
-        <translation>hona</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Selection</source>
-        <translation>Hautapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Output Settings</source>
-        <translation>Irteera Ezarpenak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Copies:</source>
-        <translation>Kopiak:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Collate</source>
-        <translation>Alderatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Reverse</source>
-        <translation>Alderantzizkoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Options</source>
-        <translation>Aukerak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Color Mode</source>
-        <translation>Margo Modua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Color</source>
-        <translation>Margoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Grayscale</source>
-        <translation>Urdinabar-neurria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Duplex Printing</source>
-        <translation>Irarketa Bikoitza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>None</source>
-        <translation>Ezer ez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Long side</source>
-        <translation>Alde luzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Short side</source>
-        <translation>Alde laburra</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPrintWidget</name>
     <message>
-        <location filename="" line="363"/>
         <source>Form</source>
-        <translation>Forma</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Printer</source>
-        <translation>Irarkailua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Name:</source>
-        <translation>&Izena:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>P&roperties</source>
-        <translation>&Ezaugarriak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Location:</source>
-        <translation>Kokalekua:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Preview</source>
-        <translation>Aurreikuspena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Type:</source>
-        <translation>Mota:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Output &file:</source>
-        <translation>Irteera &Agiria:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>...</source>
-        <translation>...</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QProgressDialog</name>
     <message>
-        <location filename="" line="363"/>
         <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QPushButton</name>
     <message>
-        <location filename="" line="363"/>
         <source>Open</source>
-        <translation>Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QRadioButton</name>
     <message>
-        <location filename="" line="363"/>
         <source>Check</source>
-        <translation>Hautatu</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QRegExp</name>
     <message>
-        <location filename="" line="363"/>
         <source>no error occurred</source>
-        <translation>ez da akatsik gertatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>disabled feature used</source>
-        <translation>erabilitako ezaugarria ezgaituta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>bad char class syntax</source>
-        <translation>hizki class joskera gaitza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>bad lookahead syntax</source>
-        <translation>aurrerabegira joskera gaitza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>bad repetition syntax</source>
-        <translation>errepikapen joskera gaitza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>invalid octal value</source>
-        <translation>Octal balio baliogabea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>missing left delim</source>
-        <translation>ezker muga ez dago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>unexpected end</source>
-        <translation>ustekabeko amaiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>met internal limit</source>
-        <translation>met barne muga</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSQLite2Driver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Error to open database</source>
-        <translation>Akatsa datubasea irekitzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to begin transaction</source>
-        <translation>Ezinezkoa eskualdaketa hastea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to rollback Transaction</source>
-        <translation>Ezinezkoa Eskualdaketa ezeztatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSQLite2Result</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch results</source>
-        <translation>Ezinezkoa emaitzak lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute statement</source>
-        <translation>Ezinezkoa estamentua exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSQLiteDriver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Error opening database</source>
-        <translation>Akatsa datubasea irekitzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error closing database</source>
-        <translation>Akatsa datubasea isterakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to begin transaction</source>
-        <translation>Ezinezkoa eskualdaketa hastea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to commit transaction</source>
-        <translation>Ezinezkoa eskualdaketa aurkeztea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to rollback transaction</source>
-        <translation>Ezinezkoa eskualdaketa ezeztatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSQLiteResult</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to fetch row</source>
-        <translation>Ezinezkoa lerroa lortzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to execute statement</source>
-        <translation>Ezinezkoa estamentua exekutatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to reset statement</source>
-        <translation>Ezinezkoa estamentua berrezartzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to bind parameters</source>
-        <translation>Ezinezkoa parametroak lotzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Parameter count mismatch</source>
-        <translation>Parametro zenbatekoa ez dator bat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No query</source>
-        <translation>Eskaerarik ez</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QScrollBar</name>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll here</source>
-        <translation>Irristatu hemen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Left edge</source>
-        <translation>Ezker hertza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Top</source>
-        <translation>Goia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Right edge</source>
-        <translation>Eskuin hertza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bottom</source>
-        <translation>Behea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page left</source>
-        <translation>Orrialde ezkerra</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page up</source>
-        <translation>Orrialde goia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page right</source>
-        <translation>Orrialde eskuina</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page down</source>
-        <translation>Orrialde behea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll left</source>
-        <translation>Irristatu ezkerrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll up</source>
-        <translation>Irristatu gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll right</source>
-        <translation>Irristatu eskuinera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll down</source>
-        <translation>Irristatu behera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Line up</source>
-        <translation>Lerroan gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Position</source>
-        <translation>Kokapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Line down</source>
-        <translation>Lerroan behera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSharedMemory</name>
     <message>
-        <location filename="" line="363"/>
         <source>%1: unable to set key on lock</source>
-        <translation>%1: ezinezkoa giltza ezartzea blokeatzean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: create size is less then 0</source>
-        <translation>%1: sortu neurria 0 baino gutxiago da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: unable to lock</source>
-        <translation>%1: ezinezkoa blokeatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: unable to unlock</source>
-        <translation>%1: ezinezkoa desblokeatzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: permission denied</source>
-        <translation>%1: baimena ukatuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: already exists</source>
-        <translation>%1: badago jadanik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: doesn't exists</source>
-        <translation>%1: ez dago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: out of resources</source>
-        <translation>%1: baliabide gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: unknown error %2</source>
-        <translation>%1: akats ezezaguna %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: key is empty</source>
-        <translation>%1: giltza hutsik dago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: unix key file doesn't exists</source>
-        <translation>%1: unix giltza agiria ez dago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: ftok failed</source>
-        <translation>%1: ftok hutsegitea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: unable to make key</source>
-        <translation>%1: ezinezkoa giltza egitea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: system-imposed size restrictions</source>
-        <translation>%1: sistemak-ezarritako neurri murrizketak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1: not attached</source>
-        <translation>%1: erantsi gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QShortcut</name>
     <message>
-        <location filename="" line="363"/>
         <source>Space</source>
-        <translation>Tartea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Esc</source>
-        <translation>Irten</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Tab</source>
-        <translation>Tab</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Backtab</source>
-        <translation>Tab Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Backspace</source>
-        <translation>Ezabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Return</source>
-        <translation>Sartu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Enter</source>
-        <translation>Sartu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ins</source>
-        <translation>Txert</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Del</source>
-        <translation>Ezab</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Pause</source>
-        <translation>Pausatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print</source>
-        <translation>Irarkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>SysReq</source>
-        <translation>Sis-Eskab</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Home</source>
-        <translation>Hasiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>End</source>
-        <translation>Amaiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Left</source>
-        <translation>Ezker</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Up</source>
-        <translation>Gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Right</source>
-        <translation>Eskuin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Down</source>
-        <translation>Behera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>PgUp</source>
-        <translation>OrrGora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>PgDown</source>
-        <translation>OrrBehera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>CapsLock</source>
-        <translation>LarriBlok</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>NumLock</source>
-        <translation>ZenbBlok</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>ScrollLock</source>
-        <translation>IrriskBlok</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Menu</source>
-        <translation>Menua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Help</source>
-        <translation>Laguntza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Back</source>
-        <translation>Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Forward</source>
-        <translation>Aurrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Stop</source>
-        <translation>Gelditu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Refresh</source>
-        <translation>Berritu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Volume Down</source>
-        <translation>Jeitsi  Bolumena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Volume Mute</source>
-        <translation>Mututu Bolumena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Volume Up</source>
-        <translation>Igo Bolumena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bass Boost</source>
-        <translation>Behe Bultzada</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bass Up</source>
-        <translation>Hotslodi Gorapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bass Down</source>
-        <translation>Hotslodi Beherapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Treble Up</source>
-        <translation>Hotsmehe Gorapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Treble Down</source>
-        <translation>Hotsmehe Gorapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Media Play</source>
-        <translation>Multimedia Irakurri</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Media Stop</source>
-        <translation>Multimedia Gelditu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Media Previous</source>
-        <translation>Multimedia Aurrekoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Media Next</source>
-        <translation>Multimedia Hurrengoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Media Record</source>
-        <translation>Multimedia Grabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Favorites</source>
-        <translation>Gogokoenak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Search</source>
-        <translation>Bilatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Standby</source>
-        <translation>Itxaroten</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open URL</source>
-        <translation>Ireki URL-a</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch Mail</source>
-        <translation>Abiarazi Post@</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch Media</source>
-        <translation>Abiarazi Multimedia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (0)</source>
-        <translation>Abiarazi (0)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (1)</source>
-        <translation>Abiarazi (1)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (2)</source>
-        <translation>Abiarazi (2)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (3)</source>
-        <translation>Abiarazi (3)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (4)</source>
-        <translation>Abiarazi (4)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (5)</source>
-        <translation>Abiarazi (5)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (6)</source>
-        <translation>Abiarazi (6)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (7)</source>
-        <translation>Abiarazi (7)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (8)</source>
-        <translation>Abiarazi (8)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (9)</source>
-        <translation>Abiarazi (9)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (A)</source>
-        <translation>Abiarazi (A)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (B)</source>
-        <translation>Abiarazi (B)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (C)</source>
-        <translation>Abiarazi (C)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (D)</source>
-        <translation>Abiarazi (D)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (E)</source>
-        <translation>Abiarazi (E)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Launch (F)</source>
-        <translation>Abiarazi (F)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Print Screen</source>
-        <translation>Irark Ikusleihoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page Up</source>
-        <translation>Orriald Gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page Down</source>
-        <translation>Orriald Behera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Caps Lock</source>
-        <translation>Larri Blok</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Num Lock</source>
-        <translation>Zenb Blok</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Number Lock</source>
-        <translation>Zenbaki Blokeoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll Lock</source>
-        <translation>Irristari Blokeoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Insert</source>
-        <translation>Txertatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Delete</source>
-        <translation>Ezabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Escape</source>
-        <translation>Irten</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>System Request</source>
-        <translation>Sistema Eskabidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Select</source>
-        <translation>Hautatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Yes</source>
-        <translation>Bai</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No</source>
-        <translation>Ez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Context1</source>
-        <translation>Hitzingurua1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Context2</source>
-        <translation>Hitzingurua2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Context3</source>
-        <translation>Hitzingurua3</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Context4</source>
-        <translation>Hitzingurua4</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Call</source>
-        <translation>Deitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Hangup</source>
-        <translation>Eskegi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Flip</source>
-        <translation>Itzulikatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ctrl</source>
-        <translation>Ktrl</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Shift</source>
-        <translation>Shift</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Alt</source>
-        <translation>Alt</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Meta</source>
-        <translation>Meta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>+</source>
-        <translation>+</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>F%1</source>
-        <translation>F%1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Home Page</source>
-        <translation>Hasiera Orrialdea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSlider</name>
     <message>
-        <location filename="" line="363"/>
         <source>Page left</source>
-        <translation>Orrialdean ezkerrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page up</source>
-        <translation>Orraialdean gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Position</source>
-        <translation>Kokapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page right</source>
-        <translation>Orrialdean eskuinera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page down</source>
-        <translation>Orrialdean behera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSocks5SocketEngine</name>
     <message>
-        <location filename="" line="363"/>
         <source>Socks5 timeout error connecting to socks server</source>
-        <translation>Socks5 epemuga akatsa sock zerbitzariarekin elkarketatzean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Network operation timed out</source>
-        <translation>Sare eragiketa denboraz kanpo</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSpinBox</name>
     <message>
-        <location filename="" line="363"/>
         <source>More</source>
-        <translation>Gehiago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Less</source>
-        <translation>Gutxiago</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSql</name>
     <message>
-        <location filename="" line="363"/>
         <source>Delete</source>
-        <translation>Ezabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Delete this record?</source>
-        <translation>Grabaketa hau ezabatu?</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Yes</source>
-        <translation>Bai</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No</source>
-        <translation>Ez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Insert</source>
-        <translation>Txertatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Update</source>
-        <translation>Eguneratu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Save edits?</source>
-        <translation>Editatua gorde?</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Confirm</source>
-        <translation>Baieztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cancel your edits?</source>
-        <translation>Ezeztatu edizioak?</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QSslSocket</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to write data: %1</source>
-        <translation>Ezinezkoa datuak idaztea: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error while reading: %1</source>
-        <translation>Akats irakurtzerakoan: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error during SSL handshake: %1</source>
-        <translation>Akatsa SSL esmuematerakoan: %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error creating SSL context (%1)</source>
-        <translation>Akatsa SSL hitzingurua sortzerakoan (%1)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid or empty cipher list (%1)</source>
-        <translation>Zifra zerrenda baliogabea edo hutsik (%1)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error creating SSL session, %1</source>
-        <translation>Akatsa SSL saioa sortzerakoan, %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error creating SSL session: %1</source>
-        <translation>Akatsa SSL saioa sortzerakoan, %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cannot provide a certificate with no key, %1</source>
-        <translation>Ezin da egiaztagiri bat eman giltza gabe, %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error loading local certificate, %1</source>
-        <translation>Akatsa tokiko egiaztagiria gertatzekoran, %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Error loading private key, %1</source>
-        <translation>Akatsa giltza pribatua gertatzerakoan, %1</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Private key does not certificate public key, %1</source>
-        <translation>Giltza pribatua ez da giltza publiko egiaztagiritua, %1</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QTDSDriver</name>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to open connection</source>
-        <translation>Ezinezkoa elkarketa irekitzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unable to use database</source>
-        <translation>Ezinezkoa datubasea erabiltzea</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QTabBar</name>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll Left</source>
-        <translation>Irristatu Ezkerrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll Right</source>
-        <translation>Irristatu Eskuinera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QTextControl</name>
     <message>
-        <location filename="" line="363"/>
         <source>&Undo</source>
-        <translation>&Desegin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Redo</source>
-        <translation>&Berregin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cu&t</source>
-        <translation>&Ebaki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Copy</source>
-        <translation>&Kopiatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Copy &Link Location</source>
-        <translation>Kopiatu &Lotura Helbidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Paste</source>
-        <translation>&Itsatsi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Delete</source>
-        <translation>Ezabatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Select All</source>
-        <translation>Hautatu Dena</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QToolButton</name>
     <message>
-        <location filename="" line="363"/>
         <source>Press</source>
-        <translation>Sakatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open</source>
-        <translation>Ireki</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QUdpSocket</name>
     <message>
-        <location filename="" line="363"/>
         <source>This platform does not support IPv6</source>
-        <translation>Plataforma honek ez du IPv6 sostengatzen</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QUndoGroup</name>
     <message>
-        <location filename="" line="363"/>
         <source>Undo</source>
-        <translation>Desegin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Redo</source>
-        <translation>Berregin</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QUndoModel</name>
     <message>
-        <location filename="" line="363"/>
         <source><empty></source>
-        <translation><hutsik></translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QUndoStack</name>
     <message>
-        <location filename="" line="363"/>
         <source>Undo</source>
-        <translation>Desegin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Redo</source>
-        <translation>Berregin</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QUnicodeControlCharacterMenu</name>
     <message>
-        <location filename="" line="363"/>
         <source>LRM Left-to-right mark</source>
-        <translation>EZES Ezkerretik-eskuinerako marka</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>RLM Right-to-left mark</source>
-        <translation>ESEZ Eskuinetik-ezkerrerako marka</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>ZWJ Zero width joiner</source>
-        <translation>ZWJ Huts zabalera bateratzailea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>ZWNJ Zero width non-joiner</source>
-        <translation>ZWNJ Huts zabalera ez-bateratzailea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>ZWSP Zero width space</source>
-        <translation>ZZTR Zero zabaleera tartea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>LRE Start of left-to-right embedding</source>
-        <translation>EZESB Hasi ezker-eskuin barneratuz</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>RLE Start of right-to-left embedding</source>
-        <translation>ESEZB Hasi eskuin-ezker- barneratuz</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>LRO Start of left-to-right override</source>
-        <translation>EZESE Hasi ezker-eskuin ezeztatuz</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>RLO Start of right-to-left override</source>
-        <translation>ESEZE Hasi eskuin-ezker ezeztatuz</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>PDF Pop directional formatting</source>
-        <translation>PDF Pop direkzional fomatoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Insert Unicode control character</source>
-        <translation>Txertatu Unicode aginte hizkia</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QWebFrame</name>
     <message>
-        <location filename="" line="363"/>
         <source>Request cancelled</source>
-        <translation>Eskabidea ezeztaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Request blocked</source>
-        <translation>Eskabidea bloketaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cannot show URL</source>
-        <translation>Ezinezkoa URL-a erakustea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Frame load interruped by policy change</source>
-        <translation>Frame gertaketa etenda araudi aldaketagaitik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cannot show mimetype</source>
-        <translation>Ezinezkoa mimemota erakustea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>File does not exist</source>
-        <translation>Agiria ez dago</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QWebPage</name>
     <message>
-        <location filename="" line="363"/>
         <source>Bad HTTP request</source>
-        <translation>HTTP eskaera gaitza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Submit</source>
         <comment>default label for Submit buttons in forms on web pages</comment>
-        <translation>Aurkeztu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Submit</source>
         <comment>Submit (input element) alt text for <input> elements with no alt, title, or value</comment>
-        <translation>Aurkeztu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Reset</source>
         <comment>default label for Reset buttons in forms on web pages</comment>
-        <translation>Berrezarri</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>This is a searchable index. Enter search keywords: </source>
         <comment>text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'</comment>
-        <translation>Hau bilaketa aurkibide bat da. Sartu bilaketa hitzak: </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Choose File</source>
         <comment>title for file button used in HTML forms</comment>
-        <translation>Hautatu Agiria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No file selected</source>
         <comment>text to display in file button used in HTML forms when no file is selected</comment>
-        <translation>Ez da agiririk hautatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open in New Window</source>
         <comment>Open in New Window context menu item</comment>
-        <translation>Ireki Leiho Berrian</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Save Link...</source>
         <comment>Download Linked File context menu item</comment>
-        <translation>Gorde Lotura...</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Copy Link</source>
         <comment>Copy Link context menu item</comment>
-        <translation>Kopiatu Lotura</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open Image</source>
         <comment>Open Image in New Window context menu item</comment>
-        <translation>Ireki Irudia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Save Image</source>
         <comment>Download Image context menu item</comment>
-        <translation>Gorde Irudia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Copy Image</source>
         <comment>Copy Link context menu item</comment>
-        <translation>Kopiatu Irudia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open Frame</source>
         <comment>Open Frame in New Window context menu item</comment>
-        <translation>Ireki Framea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Copy</source>
         <comment>Copy context menu item</comment>
-        <translation>Kopiatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Go Back</source>
         <comment>Back context menu item</comment>
-        <translation>Joan Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Go Forward</source>
         <comment>Forward context menu item</comment>
-        <translation>Joan Aurrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Stop</source>
         <comment>Stop context menu item</comment>
-        <translation>Gelditu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Reload</source>
         <comment>Reload context menu item</comment>
-        <translation>Birgertatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cut</source>
         <comment>Cut context menu item</comment>
-        <translation>Ebaki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Paste</source>
         <comment>Paste context menu item</comment>
-        <translation>Itsatsi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No Guesses Found</source>
         <comment>No Guesses Found context menu item</comment>
-        <translation>Ez da Gonbidaturik Aurkitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ignore</source>
         <comment>Ignore Spelling context menu item</comment>
-        <translation>Ezikusi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Add To Dictionary</source>
         <comment>Learn Spelling context menu item</comment>
-        <translation>Gehitu Hiztegira</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Search The Web</source>
         <comment>Search The Web context menu item</comment>
-        <translation>Bilatu Webean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Look Up In Dictionary</source>
         <comment>Look Up in Dictionary context menu item</comment>
-        <translation>Begiratu Hiztegian</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Open Link</source>
         <comment>Open Link context menu item</comment>
-        <translation>Ireki Lotura</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ignore</source>
         <comment>Ignore Grammar context menu item</comment>
-        <translation>Ezikusi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Spelling</source>
         <comment>Spelling and Grammar context sub-menu item</comment>
-        <translation>Egiaztapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Show Spelling and Grammar</source>
         <comment>menu item title</comment>
-        <translation>Erakutsi Egiaztapena eta Idazkera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Hide Spelling and Grammar</source>
         <comment>menu item title</comment>
-        <translation>Ezkutatu Egiaztapena eta Idazkera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Check Spelling</source>
         <comment>Check spelling context menu item</comment>
-        <translation>Idaz Egiaztapena</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Check Spelling While Typing</source>
         <comment>Check spelling while typing context menu item</comment>
-        <translation>Egiaztatu idazkera Idazterakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Check Grammar With Spelling</source>
         <comment>Check grammar with spelling context menu item</comment>
-        <translation>Egiaztatu Idazkera Egiaztatzailearekin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Fonts</source>
         <comment>Font context sub-menu item</comment>
-        <translation>Hizkiak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bold</source>
         <comment>Bold context menu item</comment>
-        <translation>Lodi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Italic</source>
         <comment>Italic context menu item</comment>
-        <translation>Etzana</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Underline</source>
         <comment>Underline context menu item</comment>
-        <translation>Azpimarratuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Outline</source>
         <comment>Outline context menu item</comment>
-        <translation>Ingurua</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Direction</source>
         <comment>Writing direction context sub-menu item</comment>
-        <translation>Norabidea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Default</source>
         <comment>Default writing direction context menu item</comment>
-        <translation>Berezkoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>LTR</source>
         <comment>Left to Right context menu item</comment>
-        <translation>ESEZ</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>RTL</source>
         <comment>Right to Left context menu item</comment>
-        <translation>EZES</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Inspect</source>
         <comment>Inspect Element context menu item</comment>
-        <translation>Ikertu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No recent searches</source>
         <comment>Label for only item in menu that appears when clicking on the search field image, when no searches have been performed</comment>
-        <translation>Ez dago bilaketa berririk</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Recent searches</source>
         <comment>label for first item in the menu that appears when clicking on the search field image, used as embedded menu title</comment>
-        <translation>Bilaketa berriak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Clear recent searches</source>
         <comment>menu item in Recent Searches menu that empties menu's contents</comment>
-        <translation>Garbitu bilaketa berriak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unknown</source>
         <comment>Unknown filesize FTP directory listing item</comment>
-        <translation>Ezezaguna</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 (%2x%3 pixels)</source>
         <comment>Title string for images</comment>
-        <translation>%1 (%2x%3 pixel)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Web Inspector - %2</source>
-        <translation>Web Ikerlea: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QWhatsThisAction</name>
     <message>
-        <location filename="" line="363"/>
         <source>What's This?</source>
-        <translation>Zer da Hau?</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QWidget</name>
     <message>
-        <location filename="" line="363"/>
         <source>*</source>
-        <translation>*</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QWizard</name>
     <message>
-        <location filename="" line="363"/>
         <source>Go Back</source>
-        <translation>Joan Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Continue</source>
-        <translation>Jarraitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Commit</source>
-        <translation>Aurkeztu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Done</source>
-        <translation>Eginda</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Quit</source>
-        <translation>Utzi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Help</source>
-        <translation>Laguntza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>< &Back</source>
-        <translation>< &Atzera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Finish</source>
-        <translation>A&maitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Cancel</source>
-        <translation>Ezeztatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Help</source>
-        <translation>&Laguntza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Next</source>
-        <translation>&Hurrengoa</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Next ></source>
-        <translation>&Hurrengoa ></translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QWorkspace</name>
     <message>
-        <location filename="" line="363"/>
         <source>&Restore</source>
-        <translation>&Leheneratu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Move</source>
-        <translation>&Mugitu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Size</source>
-        <translation>&Neurria</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Mi&nimize</source>
-        <translation>T&xikiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Ma&ximize</source>
-        <translation>&Handiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Close</source>
-        <translation>It&xi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Stay on &Top</source>
-        <translation>Eduki &Gainean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Sh&ade</source>
-        <translation>&Itzala</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 - [%2]</source>
-        <translation>%1 - [%2]</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Minimize</source>
-        <translation>Txikiengotu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Restore Down</source>
-        <translation>Leheneratu Behera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Close</source>
-        <translation>Itxi</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>&Unshade</source>
-        <translation>It&zalgabe</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QXml</name>
     <message>
-        <location filename="" line="363"/>
         <source>no error occurred</source>
-        <translation>ez da akatsik gertatu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>error triggered by consumer</source>
-        <translation>akatsa kontsumitzaileak eragina</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>unexpected end of file</source>
-        <translation>ustekabeko agiri amaiera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>more than one document type definition</source>
-        <translation>agiri mota azalpen bat baino gehiago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>error occurred while parsing element</source>
-        <translation>akatsa gertatu da gaia aztertzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>tag mismatch</source>
-        <translation>etiketa ez dator bat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>error occurred while parsing content</source>
-        <translation>akatsa gertatu da edukia aztertzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>unexpected character</source>
-        <translation>ustekabeko hizkia</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>invalid name for processing instruction</source>
-        <translation>izen baliogabea agindua prozesatzeko</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>version expected while reading the XML declaration</source>
-        <translation>itxarondako bertsioa XML adierazpena irakurtzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>wrong value for standalone declaration</source>
-        <translation>balio okerra bakarkako adierezpenerako</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>encoding declaration or standalone declaration expected while reading the XML declaration</source>
-        <translation>itxarondako kodeaketa adierazpen edo bakarkako adierazpena XML adierazpena irakurtzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>standalone declaration expected while reading the XML declaration</source>
-        <translation>itxarondako bakarkako adierazpena XML adierazpena irakurtzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>error occurred while parsing document type definition</source>
-        <translation>akatsa gertatu da agiri mota adiera aztertzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>letter is expected</source>
-        <translation>hizkia itxarondakoa da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>error occurred while parsing comment</source>
-        <translation>akatsa gertatu da aipamena aztertzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>error occurred while parsing reference</source>
-        <translation>akatsa gertatu da xehetasuna aztertzerakoan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>internal general entity reference not allowed in DTD</source>
-        <translation>barneko entitate xehetasun orokorra ez dago ahalbidetuta DTD-an</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>external parsed general entity reference not allowed in attribute value</source>
-        <translation>kanpoko aztertutako entitate xehetasun orokorra ez dago ahalbidetuta ezaugarri balioan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>external parsed general entity reference not allowed in DTD</source>
-        <translation>kanpoko aztertutako entitate xehetasun orokorra ez dago ahalbidetuta DTD-an</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>unparsed entity reference in wrong context</source>
-        <translation>aztertugabeko entitate xehetasuna hitzinguru okerrean</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>recursive entities</source>
-        <translation>entitate errekursiboak</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>error in the text declaration of an external entity</source>
-        <translation>akatsa kanpoko entitate baten adierazpen idazkian</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QXmlStream</name>
     <message>
-        <location filename="" line="363"/>
         <source>Extra content at end of document.</source>
-        <translation>Eduki gehigarria agiriaren amaieran.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid entity value.</source>
-        <translation>Entitate balio baliogabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid XML character.</source>
-        <translation>XML hizki baliogabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Sequence ']]>' not allowed in content.</source>
-        <translation>']]>' sekuentzia ez dago ahalbidetuta edukian.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Namespace prefix '%1' not declared</source>
-        <translation>'%1' izentarte aurrizkia adierazi gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Attribute redefined.</source>
-        <translation>Ezaugarria ber-zehaztuta.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unexpected character '%1' in public id literal.</source>
-        <translation>Ustekabeko hizkia '%1' id publiko literalean.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid XML version string.</source>
-        <translation>XML bertsio katea baliogabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unsupported XML version.</source>
-        <translation>XML bertsio sostengatu gabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an invalid encoding name.</source>
-        <translation>%1 kodeaketa izen baliogabea da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Encoding %1 is unsupported</source>
-        <translation>%1 kodeaketa ez dago sostengaturik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Standalone accepts only yes or no.</source>
-        <translation>Bakarkakoak bai edo ez bakarrik onartzen du.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid attribute in XML declaration.</source>
-        <translation>Ezaugarri baliogabea XML adierazpenean.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Premature end of document.</source>
-        <translation>Agiria goizegi amaitu da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid document.</source>
-        <translation>Agiri baliogabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Expected </source>
-        <translation>Itxarondakoa </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>, but got '</source>
-        <translation>, baina lortu da '</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Unexpected '</source>
-        <translation>Ustekabekoa '</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Expected character data.</source>
-        <translation>Itxarondako hizki datua.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Recursive entity detected.</source>
-        <translation>Entitate errekursiboa atzemanda.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Start tag expected.</source>
-        <translation>Itxarondako etiketa hasiera.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>XML declaration not at start of document.</source>
-        <translation>XML adierazpena ez dago agiriaren hasieran.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>NDATA in parameter entity declaration.</source>
-        <translation>NDATA parametro entitate adierazpenan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an invalid processing instruction name.</source>
-        <translation>%1 prozesapen jarraipide izen baliogabea da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid processing instruction name.</source>
-        <translation>Prozesapen jarraipide izen baliogabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Illegal namespace declaration.</source>
-        <translation>Legezkanpoko izentarte adierazpena.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid XML name.</source>
-        <translation>XML izen baliogabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Opening and ending tag mismatch.</source>
-        <translation>Irekitze eta kodeatze etiketak ez datoz bat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Reference to unparsed entity '%1'.</source>
-        <translation>Aztertugabeko entitate xehetasuna '%1'.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Entity '%1' not declared.</source>
-        <translation>'%1' entitatea ez da adierazi.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Reference to external entity '%1' in attribute value.</source>
-        <translation>'%1' kanpoko entitate xehetasuna ezaugarri balioan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Invalid character reference.</source>
-        <translation>Hizki xehetasun baliogabea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Encountered incorrectly encoded content.</source>
-        <translation>Eduki oker kodeatua aurkitu da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The standalone pseudo attribute must appear after the encoding.</source>
-        <translation>Bakarkako sasi ezaugarria kodeaketaren ondoren agertu behar da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an invalid PUBLIC identifier.</source>
-        <translation>%1 ezgutarazle PUBLIKOA da.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>QtXmlPatterns</name>
     <message>
-        <location filename="" line="363"/>
         <source>An %1-attribute with value %2 has already been declared.</source>
-        <translation>%1-ezaugarri bat %2 balioarekin jadanik adierazi da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>An %1-attribute must have a valid %2 as value, which %3 isn't.</source>
-        <translation>%1-ezaugarri batek %2 baliozkoa izan behar du balio bezala, %3 ez da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Network timeout.</source>
-        <translation>Sare epemuga.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Element %1 can't be serialized because it appears outside the document element.</source>
-        <translation>%1 elementoa ezin da serializatu agiri elementutik kanpo agertzen delako.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Attribute %1 can't be serialized because it appears at the top level.</source>
-        <translation>%1 ezaugarria ezin da serializatu goiko mailan agertzen delako.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Year %1 is invalid because it begins with %2.</source>
-        <translation>%1 urtea baliogabea da %2-rekin hasten delako.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Day %1 is outside the range %2..%3.</source>
-        <translation>%1 eguna mailaz kanpo dago, %2..%3.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Month %1 is outside the range %2..%3.</source>
-        <translation>%1 hilabetea mailaz kanpo dago, %2..%3.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Overflow: Can't represent date %1.</source>
-        <translation>Gainjarioa: Ezin da %1 data adierazi.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Day %1 is invalid for month %2.</source>
-        <translation>%1 eguna baliogabea da %2 hilabeterako.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Time 24:%1:%2.%3 is invalid. Hour is 24, but minutes, seconds, and milliseconds are not all 0; </source>
-        <translation>Denbora 24:%1:%2.%3 baliogabea da. Ordua 24 da, baina minutuak, segunduak eta segundumilaenak ez dira denak 0; </translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Time %1:%2:%3.%4 is invalid.</source>
-        <translation>Denbora %1:%2:%3.%4 baliogabea da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Overflow: Date can't be represented.</source>
-        <translation>Gainjarioa: Data ezin da adierazi.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>At least one component must be present.</source>
-        <translation>Gutxienez osagi bat egon behar da bertan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>At least one time component must appear after the %1-delimiter.</source>
-        <translation>Gutxienez denbora osagi bat agertu behar da %1-mugatzailearen ondoren.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No operand in an integer division, %1, can be %2.</source>
-        <translation>Ez dago eragilerik zatiketa oso batean, %1 izan behar da %2.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The first operand in an integer division, %1, cannot be infinity (%2).</source>
-        <translation>Lehen eragilea zatiketa oso batean, %1 ezin da mugagabea izan (%2).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The second operand in a division, %1, cannot be zero (%2).</source>
-        <translation>Bigarren eragilea zatiketa batean, %1 ezin da huts izan (%2).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not a valid value of type %2.</source>
-        <translation>%1 ez da %2 motako baliozko balio bat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>When casting to %1 from %2, the source value cannot be %3.</source>
-        <translation>%1-tik %2-ra bihuratzerakoan, iturburu balioa ezin da %3 izan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Integer division (%1) by zero (%2) is undefined.</source>
-        <translation>Zatiketa osa (%1) hutsrekin (%2) zehaztugabea da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Division (%1) by zero (%2) is undefined.</source>
-        <translation>Zatiketa (%1) hutsrekin (%2) zehaztugabea da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Modulus division (%1) by zero (%2) is undefined.</source>
-        <translation>Modulo zatiketa (%1) hutsrekin (%2) zehaztugabea da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Dividing a value of type %1 by %2 (not-a-number) is not allowed.</source>
-        <translation>%1 motako balio bat %2-rekin zatitzea (ez-zenbaki-bat) ez dago ahalbidetuta.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Dividing a value of type %1 by %2 or %3 (plus or minus zero) is not allowed.</source>
-        <translation>%1 motako balio bat %2 edo %3-rekin zatitzea (gehi edo ken huts) ez dago ahalbidetuta.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Multiplication of a value of type %1 by %2 or %3 (plus or minus infinity) is not allowed.</source>
-        <translation>%1 motako balio bat %2 edo %3-rekin biderkatzea (gehi edo ken mugagabe) ez dago ahalbidetuta.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A value of type %1 cannot have an Effective Boolean Value.</source>
-        <translation>%1 motako balio batek ezin du Effective Boolean Balioa izan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Effective Boolean Value cannot be calculated for a sequence containing two or more atomic values.</source>
-        <translation>Effective Boolean Balioa ezin da kalkulatu bi edo gehiago balio atomiko dituen sekuentzia baterako.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Value %1 of type %2 exceeds maximum (%3).</source>
-        <translation>%2 motako %1 balioak gehinezkoa gainditzen du (%3).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Value %1 of type %2 is below minimum (%3).</source>
-        <translation>%2 motako %1 balioak gutxinekotik behera dago (%3).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A value of type %1 must contain an even number of digits. The value %2 does not.</source>
-        <translation>%1 motako balio batek zenbaki kopuru bikoiti bat izan behar du. %2 balioa ez da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not valid as a value of type %2.</source>
-        <translation>%1 ez da %2 motako baliozko balio bat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Operator %1 cannot be used on type %2.</source>
-        <translation>%1 eragilea ezin da %2 motan erabili.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Operator %1 cannot be used on atomic values of type %2 and %3.</source>
-        <translation>%1 eragilea ezin da %2 eta %3 motako balio atomikoetan erabili.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The namespace URI in the name for a computed attribute cannot be %1.</source>
-        <translation>Izentarte URI-a konputaturiko ezaugarri batentzat ezin da %1 izan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The name for a computed attribute cannot have the namespace URI %1 with the local name %2.</source>
-        <translation>Konputaturiko ezaugarri batentzako izenak ezin du %1 izentarte URI-a izan %2 tokiko izenarekin.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Type error in cast, expected %1, received %2.</source>
-        <translation>Akatsa bihurketan, itxarondakoa %1, jasotakoa %2.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>When casting to %1 or types derived from it, the source value must be of the same type, or it must be a string literal. Type %2 is not allowed.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No casting is possible with %1 as the target type.</source>
-        <translation>Ezin da bihurketarik egin %1 xede mota bezala hartuta.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>It is not possible to cast from %1 to %2.</source>
-        <translation>Ezin da %1-tik %2-ra bihurtu.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Casting to %1 is not possible because it is an abstract type, and can therefore never be instantiated.</source>
-        <translation>Ezin da %1-ra bihurtu mota abstraktokoa delako, eta hortaz inoiz ezin da eskabidetu.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>It's not possible to cast the value %1 of type %2 to %3</source>
-        <translation>Ezin da %2 motako %1 balioa %3-ra bihurtu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Failure when casting from %1 to %2: %3</source>
-        <translation>Hutsegitea %1-tik %2-ra bihurtzerakoan: %3</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A comment cannot contain %1</source>
-        <translation>Aipamen batek ezin du %1 eduki</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A comment cannot end with a %1.</source>
-        <translation>Aipamen bat ezin da %1 batekin amaitu.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No comparisons can be done involving the type %1.</source>
-        <translation>Ezin dira alderaketak egin %1 mota barne hartuta.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Operator %1 is not available between atomic values of type %2 and %3.</source>
-        <translation>%1 eragilea ez dago eskuragarri %2 eta %3 motako balio atomikoen artean.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>An attribute node cannot be a child of a document node. Therefore, the attribute %1 is out of place.</source>
-        <translation>Ezaugarri elkargune bat ezin da agiri elkargune baten azpikoa izan. Hortaz, %1 ezaugarria tokiz kanpo dago.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A library module cannot be evaluated directly. It must be imported from a main module.</source>
-        <translation>Liburutegi modulo bat ezin da zuzenean aztertu. Modulo nagusi batetik inportatu behar da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A value of type %1 cannot be a predicate. A predicate must have either a numeric type or an Effective Boolean Value type.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A positional predicate must evaluate to a single numeric value.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The target name in a processing instruction cannot be %1 in any combination of upper and lower case. Therefore, is %2 invalid.</source>
-        <translation>Xede izena prosezapen jarraipide batean ezin da %1 izan hizki larri xehe konbinazio batean. Hortaz, %2 baliogabea da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not a valid target name in a processing instruction. It must be a %2 value, e.g. %3.</source>
-        <translation>%1 ez da baliozko xede izena prozesapen jarraipidean. Izan behar da %2 balio bat, adib. %3.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The last step in a path must contain either nodes or atomic values. It cannot be a mixture between the two.</source>
-        <translation>Helburu bateko azken urratsak elkarguneak edo balio atomikoak izan behar ditu. Ezin da bien arteko nahastura bat izan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The data of a processing instruction cannot contain the string %1</source>
-        <translation>Prozesapen jarraipide bateko datuek ezin dute %1 katea izan</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No namespace binding exists for the prefix %1</source>
-        <translation>Ez dago izentarte loturarik %1 aurrizkiarentzat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No namespace binding exists for the prefix %1 in %2</source>
-        <translation>Ez dago izentarte loturarik %1 aurrizkiarentzat hemen: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an invalid %2</source>
-        <translation>%1 %2 baliogabe bat da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message numerus="yes">
-        <location filename="" line="363"/>
         <source>%1 takes at most %n argument(s). %2 is therefore invalid.</source>
-        <translation>
-            <numerusform>%1-ek gehienez %n argumento hartzen ditu. %2 hortaz baliogabea da.</numerusform>
-            <numerusform>%1-ek gehienez %n argumento hartzen ditu. %2 hortaz baliogabea da.</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
         </translation>
     </message>
     <message numerus="yes">
-        <location filename="" line="363"/>
         <source>%1 requires at least %n argument(s). %2 is therefore invalid.</source>
-        <translation>
-            <numerusform>%1-ek gutxienez %n argumento behar ditu. %2 hortaz baliogabea da.</numerusform>
-            <numerusform>%1-ek gutxienez %n argumento behar ditu. %2 hortaz baliogabea da.</numerusform>
+        <translation type="unfinished">
+            <numerusform></numerusform>
         </translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The first argument to %1 cannot be of type %2. It must be a numeric type, xs:yearMonthDuration or xs:dayTimeDuration.</source>
-        <translation>%1-ko lehen argumentoa ezin da %2 motakoa izan. Zenbaki motakoa izan behar da, xs:yearMonthDuration edo xs:dayTimeDuration.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The first argument to %1 cannot be of type %2. It must be of type %3, %4, or %5.</source>
-        <translation>%1-ko lehen argumentoa ezin da %2 motakoa izan. %3, %4, edo %5 motakoa izan behar da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The second argument to %1 cannot be of type %2. It must be of type %3, %4, or %5.</source>
-        <translation>%1-ko bigarren argumentoa ezin da %2 motakoa izan. %3, %4, edo %5 motakoa izan behar da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not a valid XML 1.0 character.</source>
-        <translation>%1 ez da baliozko XML 1.0 hizkia.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The first argument to %1 cannot be of type %2.</source>
-        <translation>%1-ko lehen argumentoa ezin da %2 motakoa izan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>If both values have zone offsets, they must have the same zone offset. %1 and %2 are not the same.</source>
-        <translation>Bi balioek eremu orekak badituzte, eremu oreka berdina izan behar dute. %1 eta %2 ez dira berdinak.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 was called.</source>
-        <translation>%1 deituta.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 must be followed by %2 or %3, not at the end of the replacement string.</source>
-        <translation>%1 %2 edo %3-z jarraitua izan behar da, ez kate ordezpenaren amaieran.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>In the replacement string, %1 must be followed by at least one digit when not escaped.</source>
-        <translation>Ordezkapen katean, %1 gutxienez zenbaki batez jarraitua izan behar da ez irtetzerakoan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>In the replacement string, %1 can only be used to escape itself or %2, not %3</source>
-        <translation>Ordezkapen katean, %1 bera bakarrik edo %2 irtetzeko bakarrik erabili daiteke, ez %3</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 matches newline characters</source>
-        <translation>%1 bat dator lerroberri hizkiekin</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 and %2 match the start and end of a line.</source>
-        <translation>%1 eta %2 bat datoz lerro baten hasiera eta amaierarekin.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Matches are case insensitive</source>
-        <translation>Bat etortzeek hizki larri-xeheak bereizten dituzte</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Whitespace characters are removed, except when they appear in character classes</source>
-        <translation>Zuriune hizkiak kendu egiten dira, hizki klaseetan agertzen direnean ezik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an invalid regular expression pattern: %2</source>
-        <translation>%1 adierazpen arrunt eredu baliogabea da: %2</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an invalid flag for regular expressions. Valid flags are:</source>
-        <translation>%1 ikur baliogabea da adierazpen arruntentzat. Baliozko ikurrak dira:</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>If the first argument is the empty sequence or a zero-length string (no namespace), a prefix cannot be specified. Prefix %1 was specified.</source>
-        <translation>Lehen argumentoa sekuentzia huts bat edo huts-luzerako kate bat bada (ez izentartea), aurrizkia ezin da adierazi. %1 aurrizkia adierazi da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>It will not be possible to retrieve %1.</source>
-        <translation>Ezingo da %1 berreskuratu.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The root node of the second argument to function %1 must be a document node. %2 is not a document node.</source>
-        <translation>%1 funtzioko bigarren argumentoko erro elkargunea agiri elkargune bat izan behar da. %2 ez da agiri elkargune bat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The default collection is undefined</source>
-        <translation>Berezko bilduma zehazgabea da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 cannot be retrieved</source>
-        <translation>%1 ezin da berreskuratu</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The normalization form %1 is unsupported. The supported forms are %2, %3, %4, and %5, and none, i.e. the empty string (no normalization).</source>
-        <translation>%1 normalkuntza forma ez dago sostengatua. Sostengaturiko formak dira  %2, %3, %4, eta %5, eta ezer ez, adib. kate hutsa (ez normalkuntza).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A zone offset must be in the range %1..%2 inclusive. %3 is out of range.</source>
-        <translation>Eremu oreka %1..%2 barne mailan egon behar da. %3 mailaz kanpo dago.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not a whole number of minutes.</source>
-        <translation>%1 ez da minutu zenbateko oso bat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Required cardinality is %1; got cardinality %2.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The item %1 did not match the required type %2.</source>
-        <translation>%1 gaia ez dator bat beharrezko %2 motarekin.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an unknown schema type.</source>
-        <translation>%1 eskema mota ezezaguna da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Only one %1 declaration can occur in the query prolog.</source>
-        <translation>%1 adierazpen bakarra gertatu daiteke eskaera hitzaurrean.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The initialization of variable %1 depends on itself</source>
-        <translation>%1 aldaeraren abiarazpena bere mende dago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No variable by name %1 exists</source>
-        <translation>Ez dago %1 izenarentzako aldaerarik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The variable %1 is unused</source>
-        <translation>%1 aldaera erabiligabea da</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Version %1 is not supported. The supported XQuery version is 1.0.</source>
-        <translation>%1 bertsioa ez dago sostengatuta. Sostengatutako XQuery bertsioa 1.0 da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The encoding %1 is invalid. It must contain Latin characters only, must not contain whitespace, and must match the regular expression %2.</source>
-        <translation>%1 kodeaketa baliogabea da. Latinezko hizkiak bakarrik izan behar ditu, ezin du zurigunerik izan, eta %2 adierazpen arruntarekin bat etorri behar da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No function with signature %1 is available</source>
-        <translation>Ez dago %1 sinadura duen funtziorik eskuragarri</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A default namespace declaration must occur before function, variable, and option declarations.</source>
-        <translation>Berezko izentarte adierazpen bat gertatau behar da eginkizunaren aurretik, aldaera, eta aukera aiderazpenak.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Namespace declarations must occur before function, variable, and option declarations.</source>
-        <translation>Izentarte adierazpen bat gertatau behar da eginkizunaren aurretik, aldaera, eta aukera aiderazpenak.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Module imports must occur before function, variable, and option declarations.</source>
-        <translation>Modulo inportazioak gertatau behar dira eginkizunaren aurretik, aldaera, eta aukera aiderazpenak.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>It is not possible to redeclare prefix %1.</source>
-        <translation>Ezin da %1 aurrizkia berradierazi.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Only the prefix %1 can be declared to bind the namespace %2. By default, it is already bound to the prefix %1.</source>
-        <translation>%1 aurrizkia bakarrik adierazi daitek %2 izentartea loturatzeko. Berez, jadanik %1 aurrizkiaren muga da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Prefix %1 is already declared in the prolog.</source>
-        <translation>%1 aurrizkia jadanik hitzaurrean adierazi da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The name of an option must have a prefix. There is no default namespace for options.</source>
-        <translation>Aukera baten izenak aurrizki bat izan behar du. Ez dago berezko izentarterik aukerentzat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The Schema Import feature is not supported, and therefore %1 declarations cannot occur.</source>
-        <translation>Eskema inportazio ezaugarri ez dago sostengatuta, eta hortaz ezin dira %1 adierazpenak gertatu.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The target namespace of a %1 cannot be empty.</source>
-        <translation>%1-ren xede izentartea ezin da hutsik egon.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The module import feature is not supported</source>
-        <translation>Modulo inportazio ezaugarria ez dago sostengatuta</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A variable by name %1 has already been declared in the prolog.</source>
-        <translation>%1 izenaren aldaera bat jadanik adierazi da hitzaurrean.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No value is available for the external variable by name %1.</source>
-        <translation>Ez dago balio eskuragarririk %1 izenaren kanpoko aldaerentzat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The namespace for a user defined function cannot be empty (try the predefined prefix %1 which exists for cases like this)</source>
-        <translation>Erabiltzaile batek adierazitako eginkizun baterako izentartea ezin da hutsik egon (saiatu aurrezehazturiko %1 aurrizkiarekin, hau bezalako kasuetarko dagoena)</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The namespace %1 is reserved; therefore user defined functions may not use it. Try the predefined prefix %2, which exists for these cases.</source>
-        <translation>%1 izentartea gordeta dago; hortaz erabiltzaileak adierazitako eginzkizunek badaiteke hura ez erabiltzea. Saiatu aurrezehazturiko %2 aurrizkiarekin, hau bezalako kasuetarko dagoena.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The namespace of a user defined function in a library module must be equivalent to the module namespace. In other words, it should be %1 instead of %2</source>
-        <translation>Liburutegi modulo batean erabiltzaileak adierazitako eginkizun bateko izentartea moduloaren izentartearen baliokidea izan behar da. Beste hitz batzuekin, %1 izan behar da %2-ren ordez</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A function already exists with the signature %1.</source>
-        <translation>Jadanik badago eginkizun bat %1 sinadurarekin.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No external functions are supported. All supported functions can be used directly, without first declaring them as external</source>
-        <translation>Ez da kanpoko eginkizunik sostengatzen. Sostengaturiko eginkizun guztiak zuzenean erabili daitezke, lehenik kanpoko bezala adierazi gabe</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>An argument by name %1 has already been declared. Every argument name must be unique.</source>
-        <translation>Jadanik adierazi da %1 izena duen argumento bat. Argumento bakoitza bakarra izan behar da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The name of a variable bound in a for-expression must be different from the positional variable. Hence, the two variables named %1 collide.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The Schema Validation Feature is not supported. Hence, %1-expressions may not be used.</source>
-        <translation>Eskema Balioztapen Ezaugarria ez dago sostengatuta. Hortaz, %1-adierazpena badaiteke ez erabiltzea.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>None of the pragma expressions are supported. Therefore, a fallback expression must be present</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The %1-axis is unsupported in XQuery</source>
-        <translation>%1-ardatza ez dago sostengatua XQueryn</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not a valid numeric literal.</source>
-        <translation>%1 ez da baliozko zenbaki literala.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>No function by name %1 is available.</source>
-        <translation>Ez dago %1 izenik duen funtziorik eskuragarri.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The namespace URI cannot be the empty string when binding to a prefix, %1.</source>
-        <translation>Izentarte URI-a ezin da kate hutsa izan aurrizki bati loturatzerakoan, %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an invalid namespace URI.</source>
-        <translation>%1 izentarte URI baliogabe bat da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>It is not possible to bind to the prefix %1</source>
-        <translation>Ezinezkoa da %1 aurrizkira lotzea</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Namespace %1 can only be bound to %2 (and it is, in either case, pre-declared).</source>
-        <translation>%1 izentartea %2-rekin bakarrik izan daiteke lotua (eta da, edonola, aurre-adierazita).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Prefix %1 can only be bound to %2 (and it is, in either case, pre-declared).</source>
-        <translation>%1 aurrizkia %2-rekin bakarrik izan daiteke lotua (eta da, edonola, aurre-adierazita).</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Two namespace declaration attributes have the same name: %1.</source>
-        <translation>Bi izentarte adierazpen ezaugarrik izen berdina dute: %1.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The namespace URI must be a constant and cannot use enclosed expressions.</source>
-        <translation>Izentarte URI-a aldagaitza izan behar da eta ezin ditu itxitako adierazpenak erabili.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>An attribute by name %1 has already appeared on this element.</source>
-        <translation>Jadanik agertzen da %1 izeneko ezaugarri bat elemento honetan.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>A direct element constructor is not well-formed. %1 is ended with %2.</source>
-        <translation>Zuzeneko elemento eraikitzaile bat ez dago ongi-osatuta. %1 %2-rekin amaitzen da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The name %1 does not refer to any schema type.</source>
-        <translation>%1 izenak ez du eskema motarik adierazten.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is an complex type. Casting to complex types is not possible. However, casting to atomic types such as %2 works.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not an atomic type. Casting is only possible to atomic types.</source>
-        <translation>%1 ez da mota atomiko bat. Bihurketa ez da ahalezkoa mota atomikoentzat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not a valid name for a processing-instruction. Therefore this name test will never match.</source>
-        <translation>%1 ez da prozesapen-jarraipide batentzako baliozko izena. Hortaz izen azterketa ez da inoiz berdinduko.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>%1 is not in the in-scope attribute declarations. Note that the schema import feature is not supported.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The name of an extension expression must be in a namespace.</source>
-        <translation>Hedapen adierazpen baten izena izentartean egon behar da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>empty</source>
-        <translation>hutsik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>zero or one</source>
-        <translation>huts edo bat</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>exactly one</source>
-        <translation>bat zehaz-mehatz</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>one or more</source>
-        <translation>bat edo gehiago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>zero or more</source>
-        <translation>huts edo gehiago</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Required type is %1, but %2 was found.</source>
-        <translation>Beharrezko mota da %1, baina %2 aurkitu da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Promoting %1 to %2 may cause loss of precision.</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>The focus is undefined.</source>
-        <translation>Fokua zehaztugabea da.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>It's not possible to add attributes after any other kind of node.</source>
-        <translation>Ezin da ezaugarririk gehitu beste elkargune moten ondoren.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>An attribute by name %1 has already been created.</source>
-        <translation>Jadanik sortu da %1 izeneko ezaugarri bat.</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Only the Unicode Codepoint Collation is supported(%1). %2 is unsupported.</source>
-        <translation>Unicode Codepoint Collation bakarrik sostengatzen da (%1). %2 ez dago sostengatuta.</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>VolumeSlider</name>
     <message>
-        <location filename="" line="363"/>
         <source>Muted</source>
-        <translation>Mututurik</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Volume: %1%</source>
-        <translation>Bolumena: %1%</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
     <name>WebCore::PlatformScrollbar</name>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll here</source>
-        <translation>Irristatu hemen</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Left edge</source>
-        <translation>Ezker hertza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Top</source>
-        <translation>Goren</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Right edge</source>
-        <translation>Eskuin hertza</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Bottom</source>
-        <translation>Beheren</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page left</source>
-        <translation>Orrialdean ezkerrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page up</source>
-        <translation>Orraialdean gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page right</source>
-        <translation>Orrialdean eskuinera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Page down</source>
-        <translation>Orrialdean behera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll left</source>
-        <translation>Irristatu ezkerrera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll up</source>
-        <translation>Irristatu gora</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll right</source>
-        <translation>Irristatu eskuinera</translation>
+        <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="" line="363"/>
         <source>Scroll down</source>
-        <translation>Irristatu behera</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 </TS>
diff --git a/src/VBox/Frontends/VirtualBox/nls/qt_fa_IR.ts b/src/VBox/Frontends/VirtualBox/nls/qt_fa_IR.ts
index 7ed8fc0..0c02744 100644
--- a/src/VBox/Frontends/VirtualBox/nls/qt_fa_IR.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/qt_fa_IR.ts
@@ -104,7 +104,7 @@ have libgstreamer-plugins-base installed.</source>
     <message numerus="yes">
       <source>A required codec is missing. You need to install the following codec(s) to play this content: %0</source>
       <translation>
-        <numerusform>کدک موردنیاز وجود ندارد. برای پخش این محتوا باید کدک زیر را نصب کنید: %0</numerusform>
+        <numerusform>کدک مورد نیاز یافت نشد. شما باید کدک ذیل را برای اجرای این مضمون نصب کنید : %0</numerusform>
       </translation>
     </message>
     <message>
@@ -4906,13 +4906,13 @@ Please choose a different file name.</source>
     <message numerus="yes">
       <source>%1 takes at most %n argument(s). %2 is therefore invalid.</source>
       <translation>
-        <numerusform>%1 حداکثر %n نشانوند می گیرد. %2 از این رو نامعتبر است</numerusform>
+        <numerusform>%1 گرفته بیش از %n نشانوند. %2 از این رو نامعتبر است.</numerusform>
       </translation>
     </message>
     <message numerus="yes">
       <source>%1 requires at least %n argument(s). %2 is therefore invalid.</source>
       <translation>
-        <numerusform>%1 حداقل %n نشانوند نیاز دارد. %2 از این رو نامعتبر است</numerusform>
+        <numerusform>%1 حداقل %n به نشانوند نیاز دارد. %2 از اینرو نامعتبر است.</numerusform>
       </translation>
     </message>
     <message>
diff --git a/src/VBox/Frontends/VirtualBox/nls/qt_it.ts b/src/VBox/Frontends/VirtualBox/nls/qt_it.ts
index 38d66cc..1b85a8a 100644
--- a/src/VBox/Frontends/VirtualBox/nls/qt_it.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/qt_it.ts
@@ -2442,19 +2442,19 @@ Vuoi eliminarlo comunque?</translation>
     <name>QOCIResult</name>
     <message>
         <source>Unable to bind column for batch execute</source>
-        <translation type="unfinished">Impossibile associare la colonna per l'esecuzione sequenziale</translation>
+        <translation>Impossibile associare la colonna per l'esecuzione sequenziale</translation>
     </message>
     <message>
         <source>Unable to execute batch statement</source>
-        <translation type="unfinished">Impossibile eseguire l'istruzione sequenziale</translation>
+        <translation>Impossibile eseguire l'istruzione sequenziale</translation>
     </message>
     <message>
         <source>Unable to goto next</source>
-        <translation type="unfinished">Impossibile spostarsi al successivo</translation>
+        <translation>Impossibile spostarsi al successivo</translation>
     </message>
     <message>
         <source>Unable to alloc statement</source>
-        <translation type="unfinished">Impossibile allocare l'istruzione</translation>
+        <translation>Impossibile allocare l'istruzione</translation>
     </message>
     <message>
         <source>Unable to prepare statement</source>
@@ -3321,7 +3321,7 @@ Scegli un nome diverso.</translation>
     <name>QSharedMemory</name>
     <message>
         <source>%1: unable to set key on lock</source>
-        <translation type="unfinished"></translation>
+        <translation>%1: impossibile impostare la chiave sul blocco</translation>
     </message>
     <message>
         <source>%1: create size is less then 0</source>
@@ -3361,7 +3361,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>%1: unix key file doesn't exists</source>
-        <translation type="unfinished"></translation>
+        <translation>%1: il file della chiave UNIX non esiste</translation>
     </message>
     <message>
         <source>%1: ftok failed</source>
@@ -3369,7 +3369,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>%1: unable to make key</source>
-        <translation type="unfinished"></translation>
+        <translation>%1: impossibile creare la chiave</translation>
     </message>
     <message>
         <source>%1: system-imposed size restrictions</source>
@@ -3392,15 +3392,15 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Tab</source>
-        <translation></translation>
+        <translation>Tab</translation>
     </message>
     <message>
         <source>Backtab</source>
-        <translation type="unfinished"></translation>
+        <translation>Tab inverso</translation>
     </message>
     <message>
         <source>Backspace</source>
-        <translation type="unfinished"></translation>
+        <translation>Backspace</translation>
     </message>
     <message>
         <source>Return</source>
@@ -3512,7 +3512,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Bass Boost</source>
-        <translation type="unfinished"></translation>
+        <translation>Esalta bassi</translation>
     </message>
     <message>
         <source>Bass Up</source>
@@ -3568,11 +3568,11 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Launch Mail</source>
-        <translation type="unfinished"></translation>
+        <translation>Avvia Posta</translation>
     </message>
     <message>
         <source>Launch Media</source>
-        <translation type="unfinished"></translation>
+        <translation>Avvia Media</translation>
     </message>
     <message>
         <source>Launch (0)</source>
@@ -3656,7 +3656,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Num Lock</source>
-        <translation>Bllocc Num</translation>
+        <translation>Blocc Num</translation>
     </message>
     <message>
         <source>Number Lock</source>
@@ -3736,7 +3736,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Meta</source>
-        <translation></translation>
+        <translation>Meta</translation>
     </message>
     <message>
         <source>+</source>
@@ -3859,7 +3859,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Invalid or empty cipher list (%1)</source>
-        <translation>Lista di cifratura non valida o vuota (%1)</translation>
+        <translation>Elenco dei cifrari non valido o vuoto (%1)</translation>
     </message>
     <message>
         <source>Error creating SSL session, %1</source>
@@ -3994,47 +3994,47 @@ Scegli un nome diverso.</translation>
     <name>QUnicodeControlCharacterMenu</name>
     <message>
         <source>LRM Left-to-right mark</source>
-        <translation type="unfinished"></translation>
+        <translation>LRM Contrassegno sinistra-destra</translation>
     </message>
     <message>
         <source>RLM Right-to-left mark</source>
-        <translation type="unfinished"></translation>
+        <translation>RLM Contrassegno destra-sinistra</translation>
     </message>
     <message>
         <source>ZWJ Zero width joiner</source>
-        <translation type="unfinished"></translation>
+        <translation>ZWJ Spazio di unione a larghezza nulla</translation>
     </message>
     <message>
         <source>ZWNJ Zero width non-joiner</source>
-        <translation type="unfinished"></translation>
+        <translation>ZWNJ Spazio non di unione a larghezza nulla</translation>
     </message>
     <message>
         <source>ZWSP Zero width space</source>
-        <translation type="unfinished"></translation>
+        <translation>ZWSP Spazio a larghezza nulla</translation>
     </message>
     <message>
         <source>LRE Start of left-to-right embedding</source>
-        <translation type="unfinished"></translation>
+        <translation>LRE Inserimento sinistra-destra</translation>
     </message>
     <message>
         <source>RLE Start of right-to-left embedding</source>
-        <translation type="unfinished"></translation>
+        <translation>RLE Inserimento destra-sinistra</translation>
     </message>
     <message>
         <source>LRO Start of left-to-right override</source>
-        <translation type="unfinished"></translation>
+        <translation>LRO Forza sinistra-destra</translation>
     </message>
     <message>
         <source>RLO Start of right-to-left override</source>
-        <translation type="unfinished"></translation>
+        <translation>RLO Forza destra-sinistra</translation>
     </message>
     <message>
         <source>PDF Pop directional formatting</source>
-        <translation type="unfinished"></translation>
+        <translation>PDF Cattura formattazione direzionale</translation>
     </message>
     <message>
         <source>Insert Unicode control character</source>
-        <translation>Inserisci carattere di controllo unicode</translation>
+        <translation>Inserisci carattere di controllo Unicode</translation>
     </message>
 </context>
 <context>
@@ -4443,7 +4443,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>error triggered by consumer</source>
-        <translation type="unfinished"></translation>
+        <translation>errore innescato da utente</translation>
     </message>
     <message>
         <source>unexpected end of file</source>
@@ -4495,7 +4495,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>letter is expected</source>
-        <translation type="unfinished"></translation>
+        <translation>lettera attesa</translation>
     </message>
     <message>
         <source>error occurred while parsing comment</source>
@@ -4507,19 +4507,19 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>internal general entity reference not allowed in DTD</source>
-        <translation type="unfinished"></translation>
+        <translation>riferimento interno a entità generica non consentito in DTD</translation>
     </message>
     <message>
         <source>external parsed general entity reference not allowed in attribute value</source>
-        <translation type="unfinished"></translation>
+        <translation>riferimento esterno a entità generale analizzata non consentito nel valore dell'attributo</translation>
     </message>
     <message>
         <source>external parsed general entity reference not allowed in DTD</source>
-        <translation type="unfinished"></translation>
+        <translation>riferimento esterno a entità generale analizzata non consentito in DTD</translation>
     </message>
     <message>
         <source>unparsed entity reference in wrong context</source>
-        <translation type="unfinished"></translation>
+        <translation>riferimento entità non analizzata nel contesto errato</translation>
     </message>
     <message>
         <source>recursive entities</source>
@@ -4558,7 +4558,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Unexpected character '%1' in public id literal.</source>
-        <translation type="unfinished"></translation>
+        <translation>Carattere inatteso '%1' in letterale identificativo pubblico.</translation>
     </message>
     <message>
         <source>Invalid XML version string.</source>
@@ -4606,7 +4606,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Expected character data.</source>
-        <translation type="unfinished"></translation>
+        <translation>Dati di carattere inattesi.</translation>
     </message>
     <message>
         <source>Recursive entity detected.</source>
@@ -4622,7 +4622,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>NDATA in parameter entity declaration.</source>
-        <translation type="unfinished"></translation>
+        <translation>NDATA nella dichiarazione dell'entità del parametro.</translation>
     </message>
     <message>
         <source>%1 is an invalid processing instruction name.</source>
@@ -4646,7 +4646,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Reference to unparsed entity '%1'.</source>
-        <translation type="unfinished"></translation>
+        <translation>Riferimento all'identità non analizzata '%1'.</translation>
     </message>
     <message>
         <source>Entity '%1' not declared.</source>
@@ -4658,7 +4658,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Invalid character reference.</source>
-        <translation type="unfinished"></translation>
+        <translation>Riferimento di carattere non valido.</translation>
     </message>
     <message>
         <source>Encountered incorrectly encoded content.</source>
@@ -4666,7 +4666,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>The standalone pseudo attribute must appear after the encoding.</source>
-        <translation type="unfinished"></translation>
+        <translation>Lo pseudo-attributo standalone deve comparire dopo la codifica.</translation>
     </message>
     <message>
         <source>%1 is an invalid PUBLIC identifier.</source>
@@ -4709,7 +4709,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Overflow: Can't represent date %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Overflow: impossibile rappresentare la data %1.</translation>
     </message>
     <message>
         <source>Day %1 is invalid for month %2.</source>
@@ -4725,7 +4725,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Overflow: Date can't be represented.</source>
-        <translation type="unfinished"></translation>
+        <translation>Overflow: la data non può essere rappresentata.</translation>
     </message>
     <message>
         <source>At least one component must be present.</source>
@@ -4733,7 +4733,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>At least one time component must appear after the %1-delimiter.</source>
-        <translation type="unfinished"></translation>
+        <translation>Almeno un componente deve apparire dopo il delimitatore %1.</translation>
     </message>
     <message>
         <source>No operand in an integer division, %1, can be %2.</source>
@@ -4765,19 +4765,19 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Modulus division (%1) by zero (%2) is undefined.</source>
-        <translation type="unfinished"></translation>
+        <translation>La divisione del modulo (%1) per zero (%2) non è definita.</translation>
     </message>
     <message>
         <source>Dividing a value of type %1 by %2 (not-a-number) is not allowed.</source>
-        <translation type="unfinished"></translation>
+        <translation>La divisione di un valore di tipo %1 per %2 (non un numero) non è consentita.</translation>
     </message>
     <message>
         <source>Dividing a value of type %1 by %2 or %3 (plus or minus zero) is not allowed.</source>
-        <translation type="unfinished"></translation>
+        <translation>La divisione di un valore di tipo %1 per %2 o%3 (più o meno zero) non è consentita.</translation>
     </message>
     <message>
         <source>Multiplication of a value of type %1 by %2 or %3 (plus or minus infinity) is not allowed.</source>
-        <translation type="unfinished"></translation>
+        <translation>La moltiplicazione di un valore di tipo %1 per %2 o%3 (più o meno infinito) non è consentita.</translation>
     </message>
     <message>
         <source>A value of type %1 cannot have an Effective Boolean Value.</source>
@@ -4797,7 +4797,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>A value of type %1 must contain an even number of digits. The value %2 does not.</source>
-        <translation type="unfinished"></translation>
+        <translation>Un valore di tipo %1 deve contenere un numero di cifre pari. Il valore %2 non è corretto.</translation>
     </message>
     <message>
         <source>%1 is not valid as a value of type %2.</source>
@@ -4809,7 +4809,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Operator %1 cannot be used on atomic values of type %2 and %3.</source>
-        <translation type="unfinished"></translation>
+        <translation>L'operatore %1 non può essere utilizzato su valori atomici di tipo %2 e %3.</translation>
     </message>
     <message>
         <source>The namespace URI in the name for a computed attribute cannot be %1.</source>
@@ -4869,7 +4869,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>A library module cannot be evaluated directly. It must be imported from a main module.</source>
-        <translation type="unfinished"></translation>
+        <translation>Un modulo di libreria non può essere valutato direttamente. Deve essere importato da un modulo principale.</translation>
     </message>
     <message>
         <source>A value of type %1 cannot be a predicate. A predicate must have either a numeric type or an Effective Boolean Value type.</source>
@@ -4885,15 +4885,15 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>%1 is not a valid target name in a processing instruction. It must be a %2 value, e.g. %3.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 non è un valore di destinazione valido in un'istruzione di elaborazione. Deve essere un valore %2, ad es. %3.</translation>
     </message>
     <message>
         <source>The last step in a path must contain either nodes or atomic values. It cannot be a mixture between the two.</source>
-        <translation type="unfinished"></translation>
+        <translation>L'ultimo passo in un percorso deve contenere nodi o valori atomici. Non può essere un misto dei due.</translation>
     </message>
     <message>
         <source>The data of a processing instruction cannot contain the string %1</source>
-        <translation type="unfinished"></translation>
+        <translation>I dati dell'istruzione di elaborazione non possono contenere la stringa %1</translation>
     </message>
     <message>
         <source>No namespace binding exists for the prefix %1</source>
@@ -4911,25 +4911,27 @@ Scegli un nome diverso.</translation>
         <source>%1 takes at most %n argument(s). %2 is therefore invalid.</source>
         <translation type="unfinished">
             <numerusform></numerusform>
+            <numerusform></numerusform>
         </translation>
     </message>
     <message numerus="yes">
         <source>%1 requires at least %n argument(s). %2 is therefore invalid.</source>
-        <translation type="unfinished">
-            <numerusform></numerusform>
+        <translation>
+            <numerusform>%1 richiede almeno un argomento. %2 non è perciò valido.</numerusform>
+            <numerusform>%1 richiede almeno %n argomenti. %2 non è perciò valido.</numerusform>
         </translation>
     </message>
     <message>
         <source>The first argument to %1 cannot be of type %2. It must be a numeric type, xs:yearMonthDuration or xs:dayTimeDuration.</source>
-        <translation type="unfinished"></translation>
+        <translation>Il primo argomento di %1 non può essere di tipo %2. Deve essere un tipo numerico, xs:yearMonthDuration o xs:dayTimeDuration.</translation>
     </message>
     <message>
         <source>The first argument to %1 cannot be of type %2. It must be of type %3, %4, or %5.</source>
-        <translation type="unfinished"></translation>
+        <translation>Il primo argomento di %1 non può essere di tipo %2. Deve essere di tipo%3, %4, o %5.</translation>
     </message>
     <message>
         <source>The second argument to %1 cannot be of type %2. It must be of type %3, %4, or %5.</source>
-        <translation type="unfinished"></translation>
+        <translation>Il secondo argomento di %1 non può essere di tipo %2. Deve essere di tipo%3, %4, o %5.</translation>
     </message>
     <message>
         <source>%1 is not a valid XML 1.0 character.</source>
@@ -4949,15 +4951,15 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>%1 must be followed by %2 or %3, not at the end of the replacement string.</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 deve essere seguito da %2 o %3, non alla fine della stringa di sostituzione.</translation>
     </message>
     <message>
         <source>In the replacement string, %1 must be followed by at least one digit when not escaped.</source>
-        <translation type="unfinished"></translation>
+        <translation>Nella stringa di sostituzione, %1 deve essere seguito da almeno una cifra se non è presente un carattere di escape.</translation>
     </message>
     <message>
         <source>In the replacement string, %1 can only be used to escape itself or %2, not %3</source>
-        <translation type="unfinished"></translation>
+        <translation>Nella stringa di sostituzione, %1 può essere utilizzato come sequenza di escape di se stesso o %2, non %3</translation>
     </message>
     <message>
         <source>%1 matches newline characters</source>
@@ -4973,11 +4975,11 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Whitespace characters are removed, except when they appear in character classes</source>
-        <translation type="unfinished"></translation>
+        <translation>I caratteri di spaziatura sono rimossi, eccetto quando compaiono in classi di caratteri</translation>
     </message>
     <message>
         <source>%1 is an invalid regular expression pattern: %2</source>
-        <translation type="unfinished"></translation>
+        <translation>%1 è un modello di espressione regolare non valido: %2</translation>
     </message>
     <message>
         <source>%1 is an invalid flag for regular expressions. Valid flags are:</source>
@@ -5017,7 +5019,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Required cardinality is %1; got cardinality %2.</source>
-        <translation type="unfinished"></translation>
+        <translation>La cardinalità richiesta è %1, la cardinalità ottenuta è %2.</translation>
     </message>
     <message>
         <source>The item %1 did not match the required type %2.</source>
@@ -5069,7 +5071,7 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>It is not possible to redeclare prefix %1.</source>
-        <translation type="unfinished"></translation>
+        <translation>Non è possibile dichiarare nuovamente il prefisso %1.</translation>
     </message>
     <message>
         <source>Only the prefix %1 can be declared to bind the namespace %2. By default, it is already bound to the prefix %1.</source>
@@ -5237,11 +5239,11 @@ Scegli un nome diverso.</translation>
     </message>
     <message>
         <source>Promoting %1 to %2 may cause loss of precision.</source>
-        <translation type="unfinished"></translation>
+        <translation>La promozione di %1 a %2 potrebbe causare una perdita di precisione.</translation>
     </message>
     <message>
         <source>The focus is undefined.</source>
-        <translation type="unfinished"></translation>
+        <translation>Il fuoco non è definito.</translation>
     </message>
     <message>
         <source>It's not possible to add attributes after any other kind of node.</source>
diff --git a/src/VBox/Frontends/VirtualBox/nls/qt_zh_CN.ts b/src/VBox/Frontends/VirtualBox/nls/qt_zh_CN.ts
index f62bf20..24aff0d 100644
--- a/src/VBox/Frontends/VirtualBox/nls/qt_zh_CN.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/qt_zh_CN.ts
@@ -2234,7 +2234,7 @@ Do you want to delete it anyway?</source>
     </message>
     <message>
         <source><h3>About Qt</h3>%1<p>Qt is a C++ toolkit for cross-platform application development.</p><p>Qt provides single-source portability across MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, and all major commercial Unix variants. Qt is also available for embedded devices as Qt for Embedded Linux and Qt for Windows CE.</p><p>Qt is a Nokia product. See <a href="http://www.trolltech.com/qt/">www.trolltech.com/qt/&l [...]
-        <translation><h3>关于 Qt</h3>%1<p>Qt 是一种开发跨平台应用的 C++ 工具包。</p><p>Qt 提供单一代码移植性,适用于MS&nbsp;Windows, Mac&nbsp;OS&nbsp;X, Linux, 及主要的商业Unix。 Qt 亦可用于嵌入式设备,有 Qt Linux 嵌入版和 Qt Windows CE 版。</p><p>Qt 为 Nokia 产品。 访问 <a href="http://www.trolltech.com/qt/">www.trolltech.com/qt/</a> 获取更多信息。<b>注意</b>Qt新版位于 <a href="http://qt-project.org/">qt-project.org/</a> </p></translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
@@ -2512,7 +2512,7 @@ Do you want to delete it anyway?</source>
     <name>QODBCResult</name>
     <message>
         <source>QODBCResult::reset: Unable to set 'SQL_CURSOR_STATIC' as statement attribute. Please check your ODBC driver configuration</source>
-        <translation>QODBCResult::reset: 不能把“SQL_CURSOR_STATIC”设置为语句属性。请检查你的ODBC驱动程序设置</translation>
+        <translation>QODBCResult::reset: 不能把“SQL_CURSOR_STATIC”设置为语句属性。请检查你的ODBC驱动程序设置。</translation>
     </message>
     <message>
         <source>Unable to execute statement</source>
@@ -2851,8 +2851,7 @@ Please choose a different file name.</source>
     </message>
     <message>
         <source>Executive</source>
-        <translatorcomment>TODO</translatorcomment>
-        <translation>决策文书</translation>
+        <translation type="unfinished">决策文书</translation>
     </message>
     <message>
         <source>Folio</source>
@@ -5262,7 +5261,7 @@ Please choose a different file name.</source>
     </message>
     <message>
         <source>The namespace for a user defined function cannot be empty (try the predefined prefix %1 which exists for cases like this)</source>
-        <translation>用户定义的函数的命名空间不能为空(请试试预定义的前缀 %1,它就是用于这种情况的)</translation>
+        <translation type="unfinished"></translation>
     </message>
 </context>
 <context>
diff --git a/src/VBox/Frontends/VirtualBox/nls/qt_zh_TW.ts b/src/VBox/Frontends/VirtualBox/nls/qt_zh_TW.ts
index 58b17b0..be2ff11 100644
--- a/src/VBox/Frontends/VirtualBox/nls/qt_zh_TW.ts
+++ b/src/VBox/Frontends/VirtualBox/nls/qt_zh_TW.ts
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
-<TS version="2.0" language="zh_TW">
+<TS version="2.0" language="zh_TW" sourcelanguage="en">
 <context>
     <name>MAC_APPLICATION_MENU</name>
     <message>
@@ -103,7 +103,7 @@ have libgstreamer-plugins-base installed.</source>
     </message>
     <message numerus="yes">
         <source>A required codec is missing. You need to install the following codec(s) to play this content: %0</source>
-        <translation>
+        <translation type="unfinished">
             <numerusform>遺失所需的轉碼器。 您需要安裝以下轉碼器以播放這個內容: %0</numerusform>
         </translation>
     </message>
@@ -590,7 +590,7 @@ to
     </message>
     <message>
         <source>Holds the name of the window and contains controls to manipulate it</source>
-        <translation>視窗所使用的名稱並包含對其進行操作的控制項</translation>
+        <translation>保留視窗的名稱並包含對其進行操作的控制項</translation>
     </message>
 </context>
 <context>
@@ -674,7 +674,7 @@ to
     </message>
     <message>
         <source>Socket operation timed out</source>
-        <translation>通訊端操作未逾時</translation>
+        <translation>通訊端操作逾時</translation>
     </message>
     <message>
         <source>Socket is not connected</source>
@@ -928,7 +928,7 @@ to
     <name>QDialog</name>
     <message>
         <source>What's This?</source>
-        <translation>這是? </translation>
+        <translation>這是?</translation>
     </message>
     <message>
         <source>Done</source>
@@ -1122,7 +1122,7 @@ to
         <source>%1 already exists.
 Do you want to replace it?</source>
         <translation>%1 已經存在。
-您要取代它嗎? </translation>
+您要取代它嗎?</translation>
     </message>
     <message>
         <source>%1
@@ -1184,11 +1184,11 @@ Please verify the correct directory name was given.</source>
         <source>'%1' is write protected.
 Do you want to delete it anyway?</source>
         <translation>「%1」有寫入保護。
-您仍然要刪除嗎? </translation>
+您仍然要刪除嗎?</translation>
     </message>
     <message>
         <source>Are sure you want to delete '%1'?</source>
-        <translation>您確定要刪除「%1」嗎? </translation>
+        <translation>您確定要刪除「%1」嗎?</translation>
     </message>
     <message>
         <source>Could not delete directory.</source>
@@ -2101,7 +2101,7 @@ Do you want to delete it anyway?</source>
     <name>QMdiArea</name>
     <message>
         <source>(Untitled)</source>
-        <translation> (未命名) </translation>
+        <translation>(未命名)</translation>
     </message>
 </context>
 <context>
@@ -2263,7 +2263,7 @@ Do you want to delete it anyway?</source>
     </message>
     <message>
         <source>Unsupported socket operation</source>
-        <translation>未支援的通訊端操作</translation>
+        <translation>不支援的通訊端操作</translation>
     </message>
     <message>
         <source>Protocol type not supported</source>
@@ -2299,7 +2299,7 @@ Do you want to delete it anyway?</source>
     </message>
     <message>
         <source>The address is protected</source>
-        <translation>位址不受保護</translation>
+        <translation>位址受到保護</translation>
     </message>
     <message>
         <source>Unable to send a message</source>
@@ -2741,7 +2741,7 @@ Please choose a different file name.</source>
         <source>%1 already exists.
 Do you want to overwrite it?</source>
         <translation>%1 已經存在。
-您要覆寫它嗎? </translation>
+您要覆寫它嗎?</translation>
     </message>
     <message>
         <source>%1 is a directory.
@@ -3804,7 +3804,7 @@ Please choose a different file name.</source>
     </message>
     <message>
         <source>Delete this record?</source>
-        <translation>刪除這個紀錄嗎? </translation>
+        <translation>刪除這個紀錄嗎?</translation>
     </message>
     <message>
         <source>Yes</source>
@@ -3824,7 +3824,7 @@ Please choose a different file name.</source>
     </message>
     <message>
         <source>Save edits?</source>
-        <translation>儲存編輯嗎? </translation>
+        <translation>儲存編輯嗎?</translation>
     </message>
     <message>
         <source>Cancel</source>
@@ -3836,7 +3836,7 @@ Please choose a different file name.</source>
     </message>
     <message>
         <source>Cancel your edits?</source>
-        <translation>取消您的編輯嗎? </translation>
+        <translation>取消您的編輯嗎?</translation>
     </message>
 </context>
 <context>
@@ -4319,7 +4319,7 @@ Please choose a different file name.</source>
     <name>QWhatsThisAction</name>
     <message>
         <source>What's This?</source>
-        <translation>這是? </translation>
+        <translation>這是?</translation>
     </message>
 </context>
 <context>
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV.c b/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV.c
index 332cef6..7caed50 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV.c
@@ -1,3 +1,4 @@
+/* $Id: cconvAYUV.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uSrcTex;
 void vboxCConvApplyAYUV(vec4 color);
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV_void.c b/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV_void.c
index 8e8d7bb..40d59ff 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV_void.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvAYUV_void.c
@@ -1,2 +1,3 @@
+/* $Id: cconvAYUV_void.c $ */
 void vboxCConv()
 {}
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvApplyAYUV.c b/src/VBox/Frontends/VirtualBox/shaders/cconvApplyAYUV.c
index 8625b1c..9db3d92 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvApplyAYUV.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvApplyAYUV.c
@@ -1,3 +1,4 @@
+/* $Id: cconvApplyAYUV.c $ */
 void vboxCConvApplyAYUV(vec4 color)
 {
     float y, u, v, r, g, b;
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvBGR.c b/src/VBox/Frontends/VirtualBox/shaders/cconvBGR.c
index 898bb70..6f839e5 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvBGR.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvBGR.c
@@ -1,3 +1,4 @@
+/* $Id: cconvBGR.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uSrcTex;
 void vboxCConv()
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvBGR_void.c b/src/VBox/Frontends/VirtualBox/shaders/cconvBGR_void.c
index 8e8d7bb..dab037c 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvBGR_void.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvBGR_void.c
@@ -1,2 +1,3 @@
+/* $Id: cconvBGR_void.c $ */
 void vboxCConv()
 {}
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY.c b/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY.c
index 108c43b..a228455 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY.c
@@ -1,3 +1,4 @@
+/* $Id: cconvUYVY.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uSrcTex;
 void vboxCConvApplyAYUV(vec4 color);
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY_void.c b/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY_void.c
index 8e8d7bb..af49276 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY_void.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvUYVY_void.c
@@ -1,2 +1,3 @@
+/* $Id: cconvUYVY_void.c $ */
 void vboxCConv()
 {}
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2.c b/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2.c
index fa8ebb9..7220888 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2.c
@@ -1,3 +1,4 @@
+/* $Id: cconvYUY2.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uSrcTex;
 void vboxCConvApplyAYUV(vec4 color);
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2_void.c b/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2_void.c
index 8e8d7bb..a199fde 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2_void.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvYUY2_void.c
@@ -1,2 +1,3 @@
+/* $Id: cconvYUY2_void.c $ */
 void vboxCConv()
 {}
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvYV12.c b/src/VBox/Frontends/VirtualBox/shaders/cconvYV12.c
index 08240db..8ad7d23 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvYV12.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvYV12.c
@@ -1,3 +1,4 @@
+/* $Id: cconvYV12.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uSrcTex;
 uniform sampler2DRect uVTex;
diff --git a/src/VBox/Frontends/VirtualBox/shaders/cconvYV12_void.c b/src/VBox/Frontends/VirtualBox/shaders/cconvYV12_void.c
index 8e8d7bb..0e4f62e 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/cconvYV12_void.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/cconvYV12_void.c
@@ -1,2 +1,3 @@
+/* $Id: cconvYV12_void.c $ */
 void vboxCConv()
 {}
diff --git a/src/VBox/Frontends/VirtualBox/shaders/ckeyDst.c b/src/VBox/Frontends/VirtualBox/shaders/ckeyDst.c
index 808f5ec..e4399e2 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/ckeyDst.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/ckeyDst.c
@@ -1,3 +1,4 @@
+/* $Id: ckeyDst.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uDstTex;
 uniform vec4 uDstClr;
diff --git a/src/VBox/Frontends/VirtualBox/shaders/ckeyDst2.c b/src/VBox/Frontends/VirtualBox/shaders/ckeyDst2.c
index ba00805..7532586 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/ckeyDst2.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/ckeyDst2.c
@@ -1,3 +1,4 @@
+/* $Id: ckeyDst2.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uDstTex;
 uniform vec4 uDstClr;
diff --git a/src/VBox/Frontends/VirtualBox/shaders/ckeyDst_void.c b/src/VBox/Frontends/VirtualBox/shaders/ckeyDst_void.c
index 8777874..eab01bd 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/ckeyDst_void.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/ckeyDst_void.c
@@ -1,3 +1,4 @@
+/* $Id: ckeyDst_void.c $ */
 void vboxCKeyDst(void)
 {
 }
diff --git a/src/VBox/Frontends/VirtualBox/shaders/mainOverlay.c b/src/VBox/Frontends/VirtualBox/shaders/mainOverlay.c
index 37e31fd..1d58bb5 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/mainOverlay.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/mainOverlay.c
@@ -1,3 +1,4 @@
+/* $Id: mainOverlay.c $ */
 void vboxCKeyDst(void);
 void vboxCConv();
 void main(void)
diff --git a/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoCKey.c b/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoCKey.c
index a6ee783..df65f64 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoCKey.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoCKey.c
@@ -1,3 +1,4 @@
+/* $Id: mainOverlayNoCKey.c $ */
 void vboxCConv();
 void main(void)
 {
diff --git a/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoDiscard.c b/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoDiscard.c
index 8822368..a13e28c 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoDiscard.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoDiscard.c
@@ -1,3 +1,4 @@
+/* $Id: mainOverlayNoDiscard.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uDstTex;
 uniform vec4 uDstClr;
diff --git a/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoDiscard2.c b/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoDiscard2.c
index 38ea104..5bdf193 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoDiscard2.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/mainOverlayNoDiscard2.c
@@ -1,3 +1,4 @@
+/* $Id: mainOverlayNoDiscard2.c $ */
 #extension GL_ARB_texture_rectangle : enable
 uniform sampler2DRect uDstTex;
 uniform vec4 uDstClr;
diff --git a/src/VBox/Frontends/VirtualBox/shaders/splitBGRA.c b/src/VBox/Frontends/VirtualBox/shaders/splitBGRA.c
index 359b6fa..17a5c55 100644
--- a/src/VBox/Frontends/VirtualBox/shaders/splitBGRA.c
+++ b/src/VBox/Frontends/VirtualBox/shaders/splitBGRA.c
@@ -1,3 +1,4 @@
+/* $Id: splitBGRA.c $ */
 float vboxSplitBGRA(vec4 color, float coord)
 {
     int pix = int(coord);
diff --git a/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp b/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp
index 038f803..388ded9 100644
--- a/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMediumTypeChangeDialog.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMediumTypeChangeDialog class implementation
+ * VBox Qt GUI - UIMediumTypeChangeDialog class implementation.
  */
 
 /*
@@ -17,6 +15,10 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
 #include <QVBoxLayout>
 #include <QGroupBox>
@@ -32,6 +34,9 @@
 #include "UIConverter.h"
 #include "UIMedium.h"
 
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
 /* Constructor: */
 UIMediumTypeChangeDialog::UIMediumTypeChangeDialog(QWidget *pParent, const QString &strMediumId)
     : QIWithRetranslateUI<QIDialog>(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h b/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h
index 953c22c..7c639a8 100644
--- a/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h
+++ b/src/VBox/Frontends/VirtualBox/src/UIMediumTypeChangeDialog.h
@@ -1,7 +1,6 @@
+/* $Id: UIMediumTypeChangeDialog.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMediumTypeChangeDialog class declaration
+ * VBox Qt GUI - UIMediumTypeChangeDialog class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.cpp b/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.cpp
new file mode 100644
index 0000000..f431bbb
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.cpp
@@ -0,0 +1,918 @@
+/* $Id: UIVMInfoDialog.cpp $ */
+/** @file
+ * VBox Qt GUI - UIVMInfoDialog class implementation.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QTimer>
+# include <QScrollBar>
+# include <QPushButton>
+
+/* GUI includes: */
+# include "UIVMInfoDialog.h"
+# include "UIExtraDataManager.h"
+# include "UISession.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindow.h"
+# include "UIMachineView.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
+# include "QITabWidget.h"
+# include "QIDialogButtonBox.h"
+# include "VBoxGlobal.h"
+# include "VBoxUtils.h"
+
+/* COM includes: */
+# include "COMEnums.h"
+# include "CMachine.h"
+# include "CConsole.h"
+# include "CSystemProperties.h"
+# include "CMachineDebugger.h"
+# include "CDisplay.h"
+# include "CGuest.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
+# include "CNetworkAdapter.h"
+
+/* Other VBox includes: */
+# include <iprt/time.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include "CVRDEServerInfo.h"
+
+
+/* static */
+UIVMInfoDialog* UIVMInfoDialog::m_spInstance = 0;
+
+void UIVMInfoDialog::invoke(UIMachineWindow *pMachineWindow)
+{
+    /* Make sure dialog instance exists: */
+    if (!m_spInstance)
+    {
+        /* Create new dialog instance if it doesn't exists yet: */
+        new UIVMInfoDialog(pMachineWindow);
+    }
+
+    /* Show dialog: */
+    m_spInstance->show();
+    /* Raise it: */
+    m_spInstance->raise();
+    /* De-miniaturize if necessary: */
+    m_spInstance->setWindowState(m_spInstance->windowState() & ~Qt::WindowMinimized);
+    /* And activate finally: */
+    m_spInstance->activateWindow();
+}
+
+UIVMInfoDialog::UIVMInfoDialog(UIMachineWindow *pMachineWindow)
+    : QIWithRetranslateUI<QMainWindow>(0)
+    , m_pMachineWindow(pMachineWindow)
+    , m_pTabWidget(0)
+    , m_session(pMachineWindow->session())
+    , m_pTimer(new QTimer(this))
+{
+    /* Initialize instance: */
+    m_spInstance = this;
+
+    /* Prepare: */
+    prepare();
+}
+
+UIVMInfoDialog::~UIVMInfoDialog()
+{
+    /* Cleanup: */
+    cleanup();
+
+    /* Deinitialize instance: */
+    m_spInstance = 0;
+}
+
+void UIVMInfoDialog::retranslateUi()
+{
+    sltUpdateDetails();
+
+    AssertReturnVoid(!m_session.isNull());
+    CMachine machine = m_session.GetMachine();
+    AssertReturnVoid(!machine.isNull());
+
+    /* Setup dialog title: */
+    setWindowTitle(tr("%1 - Session Information").arg(machine.GetName()));
+
+    /* Translate tabs: */
+    m_pTabWidget->setTabText(0, tr("Configuration &Details"));
+    m_pTabWidget->setTabText(1, tr("&Runtime Information"));
+
+    /* Clear counter names initially: */
+    m_names.clear();
+    m_units.clear();
+    m_links.clear();
+
+    /* Storage statistics: */
+    CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties();
+    CStorageControllerVector controllers = m_session.GetMachine().GetStorageControllers();
+    int iIDECount = 0, iSATACount = 0, iSCSICount = 0;
+    foreach (const CStorageController &controller, controllers)
+    {
+        switch (controller.GetBus())
+        {
+            case KStorageBus_IDE:
+            {
+                for (ULONG i = 0; i < sp.GetMaxPortCountForStorageBus(KStorageBus_IDE); ++i)
+                {
+                    for (ULONG j = 0; j < sp.GetMaxDevicesPerPortForStorageBus(KStorageBus_IDE); ++j)
+                    {
+                        /* Names: */
+                        m_names[QString("/Devices/IDE%1/ATA%2/Unit%3/*DMA")
+                            .arg(iIDECount).arg(i).arg(j)] = tr("DMA Transfers");
+                        m_names[QString("/Devices/IDE%1/ATA%2/Unit%3/*PIO")
+                            .arg(iIDECount).arg(i).arg(j)] = tr("PIO Transfers");
+                        m_names[QString("/Devices/IDE%1/ATA%2/Unit%3/ReadBytes")
+                            .arg(iIDECount).arg(i).arg(j)] = tr("Data Read");
+                        m_names[QString("/Devices/IDE%1/ATA%2/Unit%3/WrittenBytes")
+                            .arg(iIDECount).arg(i).arg(j)] = tr("Data Written");
+
+                        /* Units: */
+                        m_units[QString("/Devices/IDE%1/ATA%2/Unit%3/*DMA")
+                            .arg(iIDECount).arg(i).arg(j)] = "[B]";
+                        m_units[QString("/Devices/IDE%1/ATA%2/Unit%3/*PIO")
+                            .arg(iIDECount).arg(i).arg(j)] = "[B]";
+                        m_units[QString("/Devices/IDE%1/ATA%2/Unit%3/ReadBytes")
+                            .arg(iIDECount).arg(i).arg(j)] = "B";
+                        m_units[QString("/Devices/IDE%1/ATA%2/Unit%3/WrittenBytes")
+                            .arg(iIDECount).arg(i).arg(j)] = "B";
+
+                        /* Belongs to */
+                        m_links[QString("/Devices/IDE%1/ATA%2/Unit%3").arg(iIDECount).arg(i).arg(j)] = QStringList()
+                            << QString("/Devices/IDE%1/ATA%2/Unit%3/*DMA").arg(iIDECount).arg(i).arg(j)
+                            << QString("/Devices/IDE%1/ATA%2/Unit%3/*PIO").arg(iIDECount).arg(i).arg(j)
+                            << QString("/Devices/IDE%1/ATA%2/Unit%3/ReadBytes").arg(iIDECount).arg(i).arg(j)
+                            << QString("/Devices/IDE%1/ATA%2/Unit%3/WrittenBytes").arg(iIDECount).arg(i).arg(j);
+                    }
+                }
+                ++iIDECount;
+                break;
+            }
+            case KStorageBus_SATA:
+            {
+                for (ULONG i = 0; i < sp.GetMaxPortCountForStorageBus(KStorageBus_SATA); ++i)
+                {
+                    for (ULONG j = 0; j < sp.GetMaxDevicesPerPortForStorageBus(KStorageBus_SATA); ++j)
+                    {
+                        /* Names: */
+                        m_names[QString("/Devices/SATA%1/Port%2/DMA").arg(iSATACount).arg(i)]
+                            = tr("DMA Transfers");
+                        m_names[QString("/Devices/SATA%1/Port%2/ReadBytes").arg(iSATACount).arg(i)]
+                            = tr("Data Read");
+                        m_names[QString("/Devices/SATA%1/Port%2/WrittenBytes").arg(iSATACount).arg(i)]
+                            = tr("Data Written");
+
+                        /* Units: */
+                        m_units[QString("/Devices/SATA%1/Port%2/DMA").arg(iSATACount).arg(i)] = "[B]";
+                        m_units[QString("/Devices/SATA%1/Port%2/ReadBytes").arg(iSATACount).arg(i)] = "B";
+                        m_units[QString("/Devices/SATA%1/Port%2/WrittenBytes").arg(iSATACount).arg(i)] = "B";
+
+                        /* Belongs to: */
+                        m_links[QString("/Devices/SATA%1/Port%2").arg(iSATACount).arg(i)] = QStringList()
+                            << QString("/Devices/SATA%1/Port%2/DMA").arg(iSATACount).arg(i)
+                            << QString("/Devices/SATA%1/Port%2/ReadBytes").arg(iSATACount).arg(i)
+                            << QString("/Devices/SATA%1/Port%2/WrittenBytes").arg(iSATACount).arg(i);
+                    }
+                }
+                ++iSATACount;
+                break;
+            }
+            case KStorageBus_SCSI:
+            {
+                for (ULONG i = 0; i < sp.GetMaxPortCountForStorageBus(KStorageBus_SCSI); ++i)
+                {
+                    for (ULONG j = 0; j < sp.GetMaxDevicesPerPortForStorageBus(KStorageBus_SCSI); ++j)
+                    {
+                        /* Names: */
+                        m_names[QString("/Devices/SCSI%1/%2/ReadBytes").arg(iSCSICount).arg(i)]
+                            = tr("Data Read");
+                        m_names[QString("/Devices/SCSI%1/%2/WrittenBytes").arg(iSCSICount).arg(i)]
+                            = tr("Data Written");
+
+                        /* Units: */
+                        m_units[QString("/Devices/SCSI%1/%2/ReadBytes").arg(iSCSICount).arg(i)] = "B";
+                        m_units[QString("/Devices/SCSI%1/%2/WrittenBytes").arg(iSCSICount).arg(i)] = "B";
+
+                        /* Belongs to: */
+                        m_links[QString("/Devices/SCSI%1/%2").arg(iSCSICount).arg(i)] = QStringList()
+                            << QString("/Devices/SCSI%1/%2/ReadBytes").arg(iSCSICount).arg(i)
+                            << QString("/Devices/SCSI%1/%2/WrittenBytes").arg(iSCSICount).arg(i);
+                    }
+                }
+                ++iSCSICount;
+                break;
+            }
+            default:
+                break;
+        }
+    }
+
+    /* Network statistics: */
+    ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
+    for (ulong i = 0; i < count; ++i)
+    {
+        CNetworkAdapter na = machine.GetNetworkAdapter(i);
+        KNetworkAdapterType ty = na.GetAdapterType();
+        const char *name;
+
+        switch (ty)
+        {
+            case KNetworkAdapterType_I82540EM:
+            case KNetworkAdapterType_I82543GC:
+            case KNetworkAdapterType_I82545EM:
+                name = "E1k";
+                break;
+            case KNetworkAdapterType_Virtio:
+                name = "VNet";
+                break;
+            default:
+                name = "PCNet";
+                break;
+        }
+
+        /* Names: */
+        m_names[QString("/Devices/%1%2/TransmitBytes").arg(name).arg(i)] = tr("Data Transmitted");
+        m_names[QString("/Devices/%1%2/ReceiveBytes").arg(name).arg(i)] = tr("Data Received");
+
+        /* Units: */
+        m_units[QString("/Devices/%1%2/TransmitBytes").arg(name).arg(i)] = "B";
+        m_units[QString("/Devices/%1%2/ReceiveBytes").arg(name).arg(i)] = "B";
+
+        /* Belongs to: */
+        m_links[QString("NA%1").arg(i)] = QStringList()
+            << QString("/Devices/%1%2/TransmitBytes").arg(name).arg(i)
+            << QString("/Devices/%1%2/ReceiveBytes").arg(name).arg(i);
+    }
+
+    /* Statistics page update: */
+    refreshStatistics();
+}
+
+bool UIVMInfoDialog::event(QEvent *pEvent)
+{
+    /* Pre-process through base-class: */
+    bool fResult = QMainWindow::event(pEvent);
+
+    /* Process required events: */
+    switch (pEvent->type())
+    {
+        /* Handle every Resize and Move we keep track of the geometry. */
+        case QEvent::Resize:
+        {
+            if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0)
+            {
+                QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
+                m_geometry.setSize(pResizeEvent->size());
+            }
+            break;
+        }
+        case QEvent::Move:
+        {
+            if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0)
+            {
+#ifdef Q_WS_MAC
+                QMoveEvent *pMoveEvent = static_cast<QMoveEvent*>(pEvent);
+                m_geometry.moveTo(pMoveEvent->pos());
+#else /* Q_WS_MAC */
+                m_geometry.moveTo(geometry().x(), geometry().y());
+#endif /* !Q_WS_MAC */
+            }
+            break;
+        }
+        default:
+            break;
+    }
+
+    /* Return result: */
+    return fResult;
+}
+
+void UIVMInfoDialog::sltUpdateDetails()
+{
+    /* Details page update: */
+    setText(m_browsers[0], vboxGlobal().detailsReport(m_session.GetMachine(), false /* with links */));
+}
+
+void UIVMInfoDialog::sltProcessStatistics()
+{
+    /* Get machine debugger: */
+    CMachineDebugger dbg = m_session.GetConsole().GetDebugger();
+    QString strInfo;
+
+    /* Process selected VM statistics: */
+    for (DataMapType::const_iterator it = m_names.begin(); it != m_names.end(); ++it)
+    {
+        strInfo = dbg.GetStats(it.key(), true);
+        m_values[it.key()] = parseStatistics(strInfo);
+    }
+
+    /* Update VM statistics page: */
+    refreshStatistics();
+}
+
+void UIVMInfoDialog::sltHandlePageChanged(int iIndex)
+{
+    /* Focus the browser on shown page: */
+    m_pTabWidget->widget(iIndex)->setFocus();
+}
+
+void UIVMInfoDialog::prepare()
+{
+    /* Prepare dialog: */
+    prepareThis();
+    /* Load settings: */
+    loadSettings();
+}
+
+void UIVMInfoDialog::prepareThis()
+{
+    /* Delete dialog on close: */
+    setAttribute(Qt::WA_DeleteOnClose);
+    /* Delete dialog on machine-window destruction: */
+    connect(m_pMachineWindow, SIGNAL(destroyed(QObject*)), this, SLOT(suicide()));
+
+#ifdef Q_WS_MAC
+    /* No window-icon on Mac OX X, because it acts as proxy icon which isn't necessary here. */
+    setWindowIcon(QIcon());
+#else /* !Q_WS_MAC */
+    /* Assign window-icon(s: */
+    setWindowIcon(UIIconPool::iconSetFull(":/session_info_32px.png", ":/session_info_16px.png"));
+#endif /* !Q_WS_MAC */
+
+    /* Prepare central-widget: */
+    prepareCentralWidget();
+
+    /* Configure handlers: */
+    connect(m_pMachineWindow->uisession(), SIGNAL(sigMediumChange(const CMediumAttachment&)), this, SLOT(sltUpdateDetails()));
+    connect(m_pMachineWindow->uisession(), SIGNAL(sigSharedFolderChange()), this, SLOT(sltUpdateDetails()));
+    /* TODO_NEW_CORE: this is ofc not really right in the mm sense. There are more than one screens. */
+    connect(m_pMachineWindow->machineView(), SIGNAL(sigFrameBufferResize()), this, SLOT(sltProcessStatistics()));
+    connect(m_pTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandlePageChanged(int)));
+    connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltUpdateDetails()));
+    connect(m_pTimer, SIGNAL(timeout()), this, SLOT(sltProcessStatistics()));
+
+    /* Retranslate: */
+    retranslateUi();
+
+    /* Details page update: */
+    sltUpdateDetails();
+
+    /* Statistics page update: */
+    sltProcessStatistics();
+    m_pTimer->start(5000);
+}
+
+void UIVMInfoDialog::prepareCentralWidget()
+{
+    /* Create central-widget: */
+    setCentralWidget(new QWidget);
+    AssertPtrReturnVoid(centralWidget());
+    {
+        /* Create main-layout: */
+        new QVBoxLayout(centralWidget());
+        AssertPtrReturnVoid(centralWidget()->layout());
+        {
+            /* Create tab-widget: */
+            prepareTabWidget();
+            /* Create button-box: */
+            prepareButtonBox();
+        }
+    }
+}
+
+void UIVMInfoDialog::prepareTabWidget()
+{
+    /* Create tab-widget: */
+    m_pTabWidget = new QITabWidget;
+    AssertPtrReturnVoid(m_pTabWidget);
+    {
+        /* Create tabs: */
+        for (int iTabIndex = 0; iTabIndex < 2; ++iTabIndex)
+            prepareTab(iTabIndex);
+        /* Configure tab-widget: */
+        m_pTabWidget->setTabIcon(0, UIIconPool::iconSet(":/session_info_details_16px.png"));
+        m_pTabWidget->setTabIcon(1, UIIconPool::iconSet(":/session_info_runtime_16px.png"));
+        m_pTabWidget->setCurrentIndex(1);
+        /* Add tab-widget into main-layout: */
+        centralWidget()->layout()->addWidget(m_pTabWidget);
+    }
+}
+
+void UIVMInfoDialog::prepareTab(int iTabIndex)
+{
+    /* Create tab: */
+    m_tabs.insert(iTabIndex, new QWidget);
+    AssertPtrReturnVoid(m_tabs.value(iTabIndex));
+    {
+        /* Create tab-layout: */
+        QVBoxLayout *pLayout = new QVBoxLayout(m_tabs.value(iTabIndex));
+        {
+            /* Configure tab-layout: */
+            pLayout->setContentsMargins(0, 0, 0, 0);
+            /* Create browser: */
+            m_browsers.insert(iTabIndex, new QRichTextEdit);
+            AssertPtrReturnVoid(m_browsers.value(iTabIndex));
+            {
+                /* Configure browser: */
+                m_browsers[iTabIndex]->setReadOnly(true);
+                m_browsers[iTabIndex]->setFrameShadow(QFrame::Plain);
+                m_browsers[iTabIndex]->setFrameShape(QFrame::NoFrame);
+                m_browsers[iTabIndex]->setViewportMargins(5, 5, 5, 5);
+                m_browsers[iTabIndex]->viewport()->setAutoFillBackground(false);
+                m_tabs[iTabIndex]->setFocusProxy(m_browsers.value(iTabIndex));
+                /* Add browser into tab-layout: */
+                pLayout->addWidget(m_browsers.value(iTabIndex));
+            }
+        }
+        /* Add tab into tab-widget: */
+        m_pTabWidget->addTab(m_tabs.value(iTabIndex), QString());
+    }
+}
+
+void UIVMInfoDialog::prepareButtonBox()
+{
+    /* Create button-box: */
+    m_pButtonBox = new QIDialogButtonBox;
+    AssertPtrReturnVoid(m_pButtonBox);
+    {
+        /* Configure button-box: */
+        m_pButtonBox->setStandardButtons(QDialogButtonBox::Close);
+        m_pButtonBox->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape);
+        connect(m_pButtonBox, SIGNAL(rejected()), this, SLOT(close()));
+        /* Add button-box into main-layout: */
+        centralWidget()->layout()->addWidget(m_pButtonBox);
+    }
+}
+
+void UIVMInfoDialog::loadSettings()
+{
+    /* Restore window geometry: */
+    {
+        /* Load geometry: */
+        m_geometry = gEDataManager->informationWindowGeometry(this, m_pMachineWindow, vboxGlobal().managedVMUuid());
+#ifdef Q_WS_MAC
+        move(m_geometry.topLeft());
+        resize(m_geometry.size());
+#else /* Q_WS_MAC */
+        setGeometry(m_geometry);
+#endif /* !Q_WS_MAC */
+        LogRel(("UIVMInfoDialog: Geometry loaded to: %dx%d @ %dx%d.\n",
+                m_geometry.x(), m_geometry.y(), m_geometry.width(), m_geometry.height()));
+
+        /* Maximize (if necessary): */
+        if (gEDataManager->informationWindowShouldBeMaximized(vboxGlobal().managedVMUuid()))
+            showMaximized();
+    }
+}
+
+void UIVMInfoDialog::saveSettings()
+{
+    /* Save window geometry: */
+    {
+        /* Save geometry: */
+#ifdef Q_WS_MAC
+        gEDataManager->setInformationWindowGeometry(m_geometry, ::darwinIsWindowMaximized(this), vboxGlobal().managedVMUuid());
+#else /* Q_WS_MAC */
+        gEDataManager->setInformationWindowGeometry(m_geometry, isMaximized(), vboxGlobal().managedVMUuid());
+#endif /* !Q_WS_MAC */
+        LogRel(("UIVMInfoDialog: Geometry saved as: %dx%d @ %dx%d.\n",
+                m_geometry.x(), m_geometry.y(), m_geometry.width(), m_geometry.height()));
+    }
+}
+
+void UIVMInfoDialog::cleanup()
+{
+    /* Save settings: */
+    saveSettings();
+}
+
+QString UIVMInfoDialog::parseStatistics(const QString &strText)
+{
+    /* Filters VM statistics counters body: */
+    QRegExp query("^.+<Statistics>\n(.+)\n</Statistics>.*$");
+    if (query.indexIn(strText) == -1)
+        return QString();
+
+    /* Split whole VM statistics text to lines: */
+    const QStringList text = query.cap(1).split("\n");
+
+    /* Iterate through all VM statistics: */
+    ULONG64 uSumm = 0;
+    for (QStringList::const_iterator lineIt = text.begin(); lineIt != text.end(); ++lineIt)
+    {
+        /* Get current line: */
+        QString strLine = *lineIt;
+        strLine.remove(1, 1);
+        strLine.remove(strLine.length() -2, 2);
+
+        /* Parse incoming counter and fill the counter-element values: */
+        CounterElementType counter;
+        counter.type = strLine.section(" ", 0, 0);
+        strLine = strLine.section(" ", 1);
+        QStringList list = strLine.split("\" ");
+        for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
+        {
+            QString pair = *it;
+            QRegExp regExp("^(.+)=\"([^\"]*)\"?$");
+            regExp.indexIn(pair);
+            counter.list.insert(regExp.cap(1), regExp.cap(2));
+        }
+
+        /* Fill the output with the necessary counter's value.
+         * Currently we are using "c" field of simple counter only. */
+        QString result = counter.list.contains("c") ? counter.list["c"] : "0";
+        uSumm += result.toULongLong();
+    }
+
+    return QString::number(uSumm);
+}
+
+void UIVMInfoDialog::refreshStatistics()
+{
+    /* Skip for inactive session: */
+    if (m_session.isNull())
+        return;
+
+    /* Prepare templates: */
+    QString strTable = "<table width=100% cellspacing=1 cellpadding=0>%1</table>";
+    QString strHeader = "<tr><td width=22><img width=16 height=16 src='%1'></td>"
+                        "<td colspan=2><nobr><b>%2</b></nobr></td></tr>";
+    QString strParagraph = "<tr><td colspan=3></td></tr>";
+    QString strResult;
+
+    /* Get current machine: */
+    CMachine m = m_session.GetMachine();
+
+    /* Runtime Information: */
+    {
+        /* Get current console: */
+        CConsole console = m_session.GetConsole();
+
+        ULONG cGuestScreens = m.GetMonitorCount();
+        QVector<QString> aResolutions(cGuestScreens);
+        for (ULONG iScreen = 0; iScreen < cGuestScreens; ++iScreen)
+        {
+            /* Determine resolution: */
+            ULONG uWidth = 0;
+            ULONG uHeight = 0;
+            ULONG uBpp = 0;
+            LONG xOrigin = 0;
+            LONG yOrigin = 0;
+            KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
+            console.GetDisplay().GetScreenResolution(iScreen, uWidth, uHeight, uBpp, xOrigin, yOrigin, monitorStatus);
+            QString strResolution = QString("%1x%2").arg(uWidth).arg(uHeight);
+            if (uBpp)
+                strResolution += QString("x%1").arg(uBpp);
+            strResolution += QString(" @%1,%2").arg(xOrigin).arg(yOrigin);
+            if (monitorStatus == KGuestMonitorStatus_Disabled)
+            {
+                strResolution += QString(" ");
+                strResolution += QString(VBoxGlobal::tr("off", "guest monitor status"));
+            }
+            aResolutions[iScreen] = strResolution;
+        }
+
+        /* Calculate uptime: */
+        uint32_t uUpSecs = (RTTimeProgramSecTS() / 5) * 5;
+        char szUptime[32];
+        uint32_t uUpDays = uUpSecs / (60 * 60 * 24);
+        uUpSecs -= uUpDays * 60 * 60 * 24;
+        uint32_t uUpHours = uUpSecs / (60 * 60);
+        uUpSecs -= uUpHours * 60 * 60;
+        uint32_t uUpMins  = uUpSecs / 60;
+        uUpSecs -= uUpMins * 60;
+        RTStrPrintf(szUptime, sizeof(szUptime), "%dd %02d:%02d:%02d",
+                    uUpDays, uUpHours, uUpMins, uUpSecs);
+        QString strUptime = QString(szUptime);
+
+        /* Determine clipboard mode: */
+        QString strClipboardMode = gpConverter->toString(m.GetClipboardMode());
+        /* Determine Drag&Drop mode: */
+        QString strDnDMode = gpConverter->toString(m.GetDnDMode());
+
+        /* Deterine virtualization attributes: */
+        CMachineDebugger debugger = console.GetDebugger();
+        QString strVirtualization = debugger.GetHWVirtExEnabled() ?
+            VBoxGlobal::tr("Active", "details report (VT-x/AMD-V)") :
+            VBoxGlobal::tr("Inactive", "details report (VT-x/AMD-V)");
+        QString strNestedPaging = debugger.GetHWVirtExNestedPagingEnabled() ?
+            VBoxGlobal::tr("Active", "details report (Nested Paging)") :
+            VBoxGlobal::tr("Inactive", "details report (Nested Paging)");
+        QString strUnrestrictedExecution = debugger.GetHWVirtExUXEnabled() ?
+            VBoxGlobal::tr("Active", "details report (Unrestricted Execution)") :
+            VBoxGlobal::tr("Inactive", "details report (Unrestricted Execution)");
+        QString strParavirtProvider = gpConverter->toString(m.GetEffectiveParavirtProvider());
+
+        /* Guest information: */
+        CGuest guest = console.GetGuest();
+        QString strGAVersion = guest.GetAdditionsVersion();
+        if (strGAVersion.isEmpty())
+            strGAVersion = tr("Not Detected", "guest additions");
+        else
+        {
+            ULONG uRevision = guest.GetAdditionsRevision();
+            if (uRevision != 0)
+                strGAVersion += QString(" r%1").arg(uRevision);
+        }
+        QString strOSType = guest.GetOSTypeId();
+        if (strOSType.isEmpty())
+            strOSType = tr("Not Detected", "guest os type");
+        else
+            strOSType = vboxGlobal().vmGuestOSTypeDescription(strOSType);
+
+        /* VRDE information: */
+        int iVRDEPort = console.GetVRDEServerInfo().GetPort();
+        QString strVRDEInfo = (iVRDEPort == 0 || iVRDEPort == -1)?
+            tr("Not Available", "details report (VRDE server port)") :
+            QString("%1").arg(iVRDEPort);
+
+        /* Searching for longest string: */
+        QStringList values;
+        for (ULONG iScreen = 0; iScreen < cGuestScreens; ++iScreen)
+            values << aResolutions[iScreen];
+        values << strUptime
+               << strVirtualization << strNestedPaging << strUnrestrictedExecution
+               << strGAVersion << strOSType << strVRDEInfo;
+        int iMaxLength = 0;
+        foreach (const QString &strValue, values)
+            iMaxLength = iMaxLength < fontMetrics().width(strValue)
+                         ? fontMetrics().width(strValue) : iMaxLength;
+
+        /* Summary: */
+        strResult += strHeader.arg(":/state_running_16px.png").arg(tr("Runtime Attributes"));
+        for (ULONG iScreen = 0; iScreen < cGuestScreens; ++iScreen)
+        {
+            QString strLabel(tr("Screen Resolution"));
+            /* The screen number makes sense only if there are multiple monitors in the guest: */
+            if (cGuestScreens > 1)
+                strLabel += QString(" %1").arg(iScreen + 1);
+            strResult += formatValue(strLabel, aResolutions[iScreen], iMaxLength);
+        }
+        strResult += formatValue(tr("VM Uptime"), strUptime, iMaxLength);
+        strResult += formatValue(tr("Clipboard Mode"), strClipboardMode, iMaxLength);
+        strResult += formatValue(tr("Drag and Drop Mode"), strDnDMode, iMaxLength);
+        strResult += formatValue(VBoxGlobal::tr("VT-x/AMD-V", "details report"), strVirtualization, iMaxLength);
+        strResult += formatValue(VBoxGlobal::tr("Nested Paging", "details report"), strNestedPaging, iMaxLength);
+        strResult += formatValue(VBoxGlobal::tr("Unrestricted Execution", "details report"), strUnrestrictedExecution, iMaxLength);
+        strResult += formatValue(VBoxGlobal::tr("Paravirtualization Interface", "details report"), strParavirtProvider, iMaxLength);
+        strResult += formatValue(tr("Guest Additions"), strGAVersion, iMaxLength);
+        strResult += formatValue(tr("Guest OS Type"), strOSType, iMaxLength);
+        strResult += formatValue(VBoxGlobal::tr("Remote Desktop Server Port", "details report (VRDE Server)"), strVRDEInfo, iMaxLength);
+        strResult += strParagraph;
+    }
+
+    /* Storage statistics: */
+    {
+        /* Prepare storage-statistics: */
+        QString strStorageStat;
+
+        /* Append result with storage-statistics header: */
+        strResult += strHeader.arg(":/hd_16px.png").arg(tr("Storage Statistics"));
+
+        /* Enumerate storage-controllers: */
+        CStorageControllerVector controllers = m.GetStorageControllers();
+        int iIDECount = 0, iSATACount = 0, iSCSICount = 0;
+        foreach (const CStorageController &controller, controllers)
+        {
+            /* Get controller attributes: */
+            QString strName = controller.GetName();
+            KStorageBus busType = controller.GetBus();
+            CMediumAttachmentVector attachments = m.GetMediumAttachmentsOfController(strName);
+            /* Skip empty and floppy attachments: */
+            if (!attachments.isEmpty() && busType != KStorageBus_Floppy)
+            {
+                /* Prepare storage templates: */
+                QString strHeaderStorage = "<tr><td></td><td colspan=2><nobr>%1</nobr></td></tr>";
+                /* Prepare full controller name: */
+                QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1");
+                /* Append storage-statistics with controller name: */
+                strStorageStat += strHeaderStorage.arg(strControllerName.arg(controller.GetName()));
+                int iSCSIIndex = 0;
+                /* Enumerate storage-attachments: */
+                foreach (const CMediumAttachment &attachment, attachments)
+                {
+                    const LONG iPort = attachment.GetPort();
+                    const LONG iDevice = attachment.GetDevice();
+                    switch (busType)
+                    {
+                        case KStorageBus_IDE:
+                        {
+                            /* Append storage-statistics with IDE controller statistics: */
+                            strStorageStat += formatStorageElement(strName, iPort, iDevice,
+                                                                   QString("/Devices/IDE%1/ATA%2/Unit%3")
+                                                                          .arg(iIDECount).arg(iPort).arg(iDevice));
+                            break;
+                        }
+                        case KStorageBus_SATA:
+                        {
+                            /* Append storage-statistics with SATA controller statistics: */
+                            strStorageStat += formatStorageElement(strName, iPort, iDevice,
+                                                                   QString("/Devices/SATA%1/Port%2")
+                                                                          .arg(iSATACount).arg(iPort));
+                            break;
+                        }
+                        case KStorageBus_SCSI:
+                        {
+                            /* Append storage-statistics with SCSI controller statistics: */
+                            strStorageStat += formatStorageElement(strName, iPort, iDevice,
+                                                                   QString("/Devices/SCSI%1/%2")
+                                                                          .arg(iSCSICount).arg(iSCSIIndex));
+                            ++iSCSIIndex;
+                            break;
+                        }
+                        default:
+                            break;
+                    }
+                    strStorageStat += strParagraph;
+                }
+            }
+            /* Increment controller counters: */
+            switch (busType)
+            {
+                case KStorageBus_IDE:  ++iIDECount; break;
+                case KStorageBus_SATA: ++iSATACount; break;
+                case KStorageBus_SCSI: ++iSCSICount; break;
+                default: break;
+            }
+        }
+
+        /* If there are no storage devices: */
+        if (strStorageStat.isNull())
+        {
+            strStorageStat = composeArticle(tr("No Storage Devices"));
+            strStorageStat += strParagraph;
+        }
+
+        /* Append result with storage-statistics: */
+        strResult += strStorageStat;
+    }
+
+    /* Network statistics: */
+    {
+        /* Prepare netork-statistics: */
+        QString strNetworkStat;
+
+        /* Append result with network-statistics header: */
+        strResult += strHeader.arg(":/nw_16px.png").arg(tr("Network Statistics"));
+
+        /* Enumerate network-adapters: */
+        ulong uCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(m.GetChipsetType());
+        for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
+        {
+            /* Skip disabled adapters: */
+            if (m.GetNetworkAdapter(uSlot).GetEnabled())
+            {
+                /* Append network-statistics with adapter-statistics: */
+                strNetworkStat += formatNetworkElement(uSlot, QString("NA%1").arg(uSlot));
+                strNetworkStat += strParagraph;
+            }
+        }
+
+        /* If there are no network adapters: */
+        if (strNetworkStat.isNull())
+        {
+            strNetworkStat = composeArticle(tr("No Network Adapters"));
+            strNetworkStat += strParagraph;
+        }
+
+        /* Append result with network-statistics: */
+        strResult += strNetworkStat;
+    }
+
+    /* Show full composed page & save/restore scroll-bar position: */
+    int iScrollBarValue = m_browsers[1]->verticalScrollBar()->value();
+    setText(m_browsers[1], strResult);
+    m_browsers[1]->verticalScrollBar()->setValue(iScrollBarValue);
+}
+
+QString UIVMInfoDialog::formatValue(const QString &strValueName,
+                                    const QString &strValue,
+                                    int iMaxSize)
+{
+    if (m_session.isNull())
+        return QString();
+
+    QString strMargin;
+    int size = iMaxSize - fontMetrics().width(strValue);
+    for (int i = 0; i < size; ++i)
+        strMargin += QString("<img width=1 height=1 src=:/tpixel.png>");
+
+    QString bdyRow = "<tr>"
+                     "<td></td>"
+                     "<td><nobr>%1</nobr></td>"
+                     "<td align=right><nobr>%2%3</nobr></td>"
+                     "</tr>";
+
+    return bdyRow.arg(strValueName).arg(strValue).arg(strMargin);
+}
+
+QString UIVMInfoDialog::formatStorageElement(const QString &strControllerName,
+                                             LONG iPort, LONG iDevice,
+                                             const QString &strBelongsTo)
+{
+    if (m_session.isNull())
+        return QString();
+
+    QString strHeader = "<tr><td></td><td colspan=2><nobr>  %1:</nobr></td></tr>";
+    CStorageController ctr = m_session.GetMachine().GetStorageControllerByName(strControllerName);
+    QString strName = gpConverter->toString(StorageSlot(ctr.GetBus(), iPort, iDevice));
+
+    return strHeader.arg(strName) + composeArticle(strBelongsTo, 2);
+}
+
+QString UIVMInfoDialog::formatNetworkElement(ULONG uSlot,
+                                             const QString &strBelongsTo)
+{
+    if (m_session.isNull())
+        return QString();
+
+    QString strHeader = "<tr><td></td><td colspan=2><nobr>%1</nobr></td></tr>";
+    QString strName = VBoxGlobal::tr("Adapter %1", "details report (network)").arg(uSlot + 1);
+
+    return strHeader.arg(strName) + composeArticle(strBelongsTo, 1);
+}
+
+QString UIVMInfoDialog::composeArticle(const QString &strBelongsTo, int iSpacesCount /* = 0 */)
+{
+    QFontMetrics fm = QApplication::fontMetrics();
+
+    QString strBody = "<tr><td></td><td width=50%><nobr>%1%2</nobr></td>"
+                      "<td align=right><nobr>%3%4</nobr></td></tr>";
+    QString strIndent;
+    for (int i = 0; i < iSpacesCount; ++i)
+        strIndent += "  ";
+    strBody = strBody.arg(strIndent);
+
+    QString strResult;
+
+    if (m_links.contains(strBelongsTo))
+    {
+        QStringList keys = m_links[strBelongsTo];
+        foreach (const QString &key, keys)
+        {
+            QString line(strBody);
+            if (m_names.contains(key) && m_values.contains(key) && m_units.contains(key))
+            {
+                line = line.arg(m_names[key]).arg(QString("%L1").arg(m_values[key].toULongLong()));
+                line = m_units[key].contains(QRegExp("\\[\\S+\\]")) ?
+                    line.arg(QString("<img src=:/tpixel.png width=%1 height=1>")
+                                    .arg(fm.width(QString(" %1").arg(m_units[key].mid(1, m_units[key].length() - 2))))) :
+                    line.arg(QString (" %1").arg(m_units[key]));
+                strResult += line;
+            }
+        }
+    }
+    else
+        strResult = strBody.arg(strBelongsTo).arg(QString()).arg(QString());
+
+    return strResult;
+}
+
+/* static */
+void UIVMInfoDialog::setText(QRichTextEdit *pTextEdit, QString strText)
+{
+    /* Temporary replace ":/tpixel.png" with "__tpixel__": */
+    strText.replace(":/tpixel.png", "__tpixel__");
+    /* Search for all the mentioned pixmaps: */
+    QRegExp exp(":/([^/]+.png)");
+    exp.setMinimal(true);
+    /* Initialize iterator: */
+    int iPos = exp.indexIn(strText);
+    while (iPos != -1)
+    {
+        /* Replace pixmap record with HiDPI-aware analog: */
+        strText.replace(iPos, 2, "pixmaps://");
+        /* Load HiDPI-aware pixmap: */
+        QPixmap pixmap = UIIconPool::pixmap(exp.cap(0));
+        /* Register loaded pixmap in text-edit' document: */
+        pTextEdit->document()->addResource(QTextDocument::ImageResource,
+                                           QUrl(QString("pixmaps://%1").arg(exp.cap(1))), QVariant(pixmap));
+        /* Advance iterator: */
+        iPos = exp.indexIn(strText);
+    }
+    /* Replace "__tpixel__" with ":/tpixel.png" back: */
+    strText.replace("__tpixel__", ":/tpixel.png");
+    /* Assign text finally: */
+    pTextEdit->setText(strText);
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.h b/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.h
new file mode 100644
index 0000000..8d3228a
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/UIVMInfoDialog.h
@@ -0,0 +1,159 @@
+/* $Id: UIVMInfoDialog.h $ */
+/** @file
+ * VBox Qt GUI - UIVMInfoDialog class declaration.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIVMInfoDialog_h___
+#define ___UIVMInfoDialog_h___
+
+/* Qt includes: */
+#include <QMainWindow>
+
+/* GUI includes: */
+#include "QIWithRetranslateUI.h"
+
+/* COM includes: */
+#include "COMEnums.h"
+#include "CSession.h"
+
+/* Forward declarations: */
+class QITabWidget;
+class QIDialogButtonBox;
+class QRichTextEdit;
+class UIMachineWindow;
+class QTimer;
+
+/** QMainWindow based dialog providing user with VM details and statistics. */
+class UIVMInfoDialog : public QIWithRetranslateUI<QMainWindow>
+{
+    Q_OBJECT;
+
+public:
+
+    /** VM statistics counter data map. */
+    typedef QMap <QString, QString> DataMapType;
+    /** VM statistics counter links map. */
+    typedef QMap <QString, QStringList> LinksMapType;
+    /** VM statistics counter struct. */
+    struct CounterElementType { QString type; DataMapType list; };
+
+    /** Shows (and creates if necessary)
+      * information-dialog for passed @a pMachineWindow. */
+    static void invoke(UIMachineWindow *pMachineWindow);
+
+protected:
+
+    /** Information dialog constructor. */
+    UIVMInfoDialog(UIMachineWindow *pMachineWindow);
+    /** Information dialog destructor. */
+    ~UIVMInfoDialog();
+
+    /** Translation handler. */
+    void retranslateUi();
+
+    /** Common event-handler. */
+    bool event(QEvent *pEvent);
+
+private slots:
+
+    /** Slot to destroy dialog immediately. */
+    void suicide() { delete this; }
+    /** Slot to update general VM details. */
+    void sltUpdateDetails();
+    /** Slot to update runtime VM statistics. */
+    void sltProcessStatistics();
+    /** Slot to handle tab-widget page change. */
+    void sltHandlePageChanged(int iIndex);
+
+private:
+
+    /** General prepare helper. */
+    void prepare();
+    /** Prepare helper for dialog itself. */
+    void prepareThis();
+    /** Prepare helper for central-widget. */
+    void prepareCentralWidget();
+    /** Prepare helper for tab-widget. */
+    void prepareTabWidget();
+    /** Prepare helper for @a iTabIndex. */
+    void prepareTab(int iTabIndex);
+    /** Prepare helper for button-box. */
+    void prepareButtonBox();
+    /** Load settings helper. */
+    void loadSettings();
+
+    /** Save settings helper. */
+    void saveSettings();
+    /** General cleanup helper. */
+    void cleanup();
+
+    /** Helper to parse passed VM statistics @a aText. */
+    QString parseStatistics(const QString &strText);
+    /** Helper to re-acquire whole VM statistics. */
+    void refreshStatistics();
+
+    /** Helper to format common VM statistics value. */
+    QString formatValue(const QString &strValueName, const QString &strValue, int iMaxSize);
+    /** Helper to format VM storage-statistics value. */
+    QString formatStorageElement(const QString &strCtrName, LONG iPort, LONG iDevice, const QString &strBelongsTo);
+    /** Helper to format VM network-statistics value. */
+    QString formatNetworkElement(ULONG uSlot, const QString &strBelongsTo);
+
+    /** Helper to compose user-oriented article. */
+    QString composeArticle(const QString &strBelongsTo, int iSpacesCount = 0);
+
+    /** Helper to set @a strText with HiDPI-aware pixmaps to corresponding @a pTextEdit. */
+    static void setText(QRichTextEdit *pTextEdit, QString strText);
+
+    /** @name General variables.
+     * @{ */
+    /** Dialog instance pointer. */
+    static UIVMInfoDialog *m_spInstance;
+    /** Machine-window to center dialog according. */
+    UIMachineWindow       *m_pMachineWindow;
+    /** Current dialog geometry. */
+    QRect                  m_geometry;
+    /** @} */
+
+    /** @name Widget variables.
+     * @{ */
+    /** Dialog tab-widget. */
+    QITabWidget               *m_pTabWidget;
+    /** Dialog tabs map. */
+    QMap<int, QWidget*>        m_tabs;
+    /** Dialog browsers map. */
+    QMap<int, QRichTextEdit*>  m_browsers;
+    /** Dialog button-box. */
+    QIDialogButtonBox         *m_pButtonBox;
+    /** @} */
+
+    /** @name VM details/statistics variables.
+     * @{ */
+    /** Session to acquire VM details/statistics from. */
+    CSession           m_session;
+    /** VM statistics update timer. */
+    QTimer            *m_pTimer;
+    /** VM statistics counter names. */
+    DataMapType        m_names;
+    /** VM statistics counter values. */
+    DataMapType        m_values;
+    /** VM statistics counter units. */
+    DataMapType        m_units;
+    /** VM statistics counter links. */
+    LinksMapType       m_links;
+    /** @} */
+};
+
+#endif /* !___UIVMInfoDialog_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.cpp b/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.cpp
index 6126b3e..854274c 100644
--- a/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIVMLogViewer.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIVMLogViewer class implementation
+ * VBox Qt GUI - UIVMLogViewer class implementation.
  */
 
 /*
@@ -18,34 +16,35 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QCheckBox>
-#include <QDateTime>
-#include <QDir>
-#include <QFileDialog>
-#include <QKeyEvent>
-#include <QLabel>
-#include <QScrollBar>
-#include <QTextEdit>
+# include <QCheckBox>
+# include <QDateTime>
+# include <QDir>
+# include <QFileDialog>
+# include <QKeyEvent>
+# include <QLabel>
+# include <QScrollBar>
+# include <QTextEdit>
 
 /* GUI includes: */
-#include "UIVMLogViewer.h"
-#include "QITabWidget.h"
-#include "UIIconPool.h"
-#include "UISpecialControls.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "VBoxUtils.h"
+# include "UIVMLogViewer.h"
+# include "QITabWidget.h"
+# include "UIIconPool.h"
+# include "UISpecialControls.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "VBoxUtils.h"
 
 /* COM includes: */
-#include "COMEnums.h"
-#include "CSystemProperties.h"
+# include "COMEnums.h"
+# include "CSystemProperties.h"
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 /* VM Log Viewer search panel: */
 class UIVMLogViewerSearchPanel : public QIWithRetranslateUI<QWidget>
 {
@@ -73,13 +72,13 @@ public:
         m_pSearchLabel->setBuddy(m_pSearchEditor);
 
         /* Next/Previous buttons: */
-        m_pNextPrevButtons = new UIRoundRectSegmentedButton(2, this);
+        m_pNextPrevButtons = new UIRoundRectSegmentedButton(this, 2);
         m_pNextPrevButtons->setEnabled(0, false);
         m_pNextPrevButtons->setEnabled(1, false);
 #ifndef Q_WS_MAC
         /* No icons on the Mac: */
-        m_pNextPrevButtons->setIcon(0, UIIconPool::defaultIcon(UIIconPool::ArrowBackIcon, this));
-        m_pNextPrevButtons->setIcon(1, UIIconPool::defaultIcon(UIIconPool::ArrowForwardIcon, this));
+        m_pNextPrevButtons->setIcon(0, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowBack, this));
+        m_pNextPrevButtons->setIcon(1, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowForward, this));
 #endif /* !Q_WS_MAC */
 
         /* Case sensitive check-box: */
@@ -89,7 +88,7 @@ public:
         m_pWarningSpacer = new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Minimum);
         m_pWarningIcon = new QLabel(this);
         m_pWarningIcon->hide();
-        QIcon icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, this);
+        QIcon icon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxWarning, this);
         if (!icon.isNull())
             m_pWarningIcon->setPixmap(icon.pixmap(16, 16));
         m_pWarningLabel = new QLabel(this);
@@ -383,9 +382,7 @@ UIVMLogViewer::UIVMLogViewer(QWidget *pParent, Qt::WindowFlags flags, const CMac
     Ui::UIVMLogViewer::setupUi(this);
 
     /* Apply window icons: */
-    setWindowIcon(UIIconPool::iconSetFull(QSize(32, 32), QSize(16, 16),
-                                          ":/vm_show_logs_32px.png",
-                                          ":/vm_show_logs_16px.png"));
+    setWindowIcon(UIIconPool::iconSetFull(":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png"));
 
     /* Create VM Log Vewer container: */
     m_pViewerContainer = new QITabWidget(centralWidget());
@@ -597,7 +594,7 @@ void UIVMLogViewer::keyPressEvent(QKeyEvent *pEvent)
             mBtnClose->animateClick();
             return;
         }
-        /* Precess Back key as switch to previous tab: */
+        /* Process Back key as switch to previous tab: */
         case Qt::Key_Back:
         {
             if (m_pViewerContainer->currentIndex() > 0)
@@ -607,7 +604,7 @@ void UIVMLogViewer::keyPressEvent(QKeyEvent *pEvent)
             }
             break;
         }
-        /* Precess Forward key as switch to next tab: */
+        /* Process Forward key as switch to next tab: */
         case Qt::Key_Forward:
         {
             if (m_pViewerContainer->currentIndex() < m_pViewerContainer->count())
diff --git a/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.h b/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.h
index 4af8e81..8b156ab 100644
--- a/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.h
+++ b/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.h
@@ -1,7 +1,6 @@
+/* $Id: UIVMLogViewer.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIVMLogViewer class declaration
+ * VBox Qt GUI - UIVMLogViewer class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.cpp
index 9fe4d7d..6c314ab 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxAboutDlg.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxAboutDlg class implementation
+ * VBox Qt GUI - VBoxAboutDlg class implementation.
  */
 
 /*
@@ -18,8 +16,9 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes */
 # include <QDir>
 # include <QEvent>
@@ -30,8 +29,13 @@
 /* Local includes */
 # include "VBoxAboutDlg.h"
 # include "VBoxGlobal.h"
+# include "UIConverter.h"
+# include "UIExtraDataManager.h"
+# include "UIIconPool.h"
+
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 VBoxAboutDlg::VBoxAboutDlg(QWidget *pParent, const QString &strVersion)
     : QIWithRetranslateUI2<QIDialog>(pParent, Qt::CustomizeWindowHint | Qt::WindowTitleHint)
     , m_strVersion(strVersion)
@@ -53,8 +57,10 @@ VBoxAboutDlg::VBoxAboutDlg(QWidget *pParent, const QString &strVersion)
             strPath = strTmpPath;
     }
 
-    /* Assign image: */
-    m_bgImage.load(strPath);
+    /* Load image: */
+    QIcon icon = UIIconPool::iconSet(strPath);
+    m_size = icon.availableSizes().first();
+    m_pixmap = icon.pixmap(m_size);
 
     /* Translate: */
     retranslateUi();
@@ -63,7 +69,7 @@ VBoxAboutDlg::VBoxAboutDlg(QWidget *pParent, const QString &strVersion)
 bool VBoxAboutDlg::event(QEvent *pEvent)
 {
     if (pEvent->type() == QEvent::Polish)
-        setFixedSize(m_bgImage.size());
+        setFixedSize(m_size);
     if (pEvent->type() == QEvent::WindowDeactivate)
         close();
     return QIDialog::event(pEvent);
@@ -72,7 +78,7 @@ bool VBoxAboutDlg::event(QEvent *pEvent)
 void VBoxAboutDlg::paintEvent(QPaintEvent* /* pEvent */)
 {
     QPainter painter(this);
-    painter.drawPixmap(0, 0, m_bgImage);
+    painter.drawPixmap(0, 0, m_pixmap);
     painter.setFont(font());
 
     /* Branding: Set a different text color (because splash also could be white),
@@ -103,15 +109,6 @@ void VBoxAboutDlg::retranslateUi()
 {
     setWindowTitle(tr("VirtualBox - About"));
     QString strAboutText =  tr("VirtualBox Graphical User Interface");
-#ifdef DEBUG
-    QString strRenderingInfo(" (%1)");
-    QString strRenderingMode("QImage");
-# ifdef VBOX_GUI_USE_QUARTZ2D
-    if (vboxGlobal().vmRenderMode() == Quartz2DMode)
-        strRenderingMode = "Quartz2D";
-# endif /* VBOX_GUI_USE_QUARTZ2D */
-    strAboutText += strRenderingInfo.arg(strRenderingMode);
-#endif /* DEBUG */
 #ifdef VBOX_BLEEDING_EDGE
     QString strVersionText = "EXPERIMENTAL build %1 - " + QString(VBOX_BLEEDING_EDGE);
 #else
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h b/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h
index 187bbec..e7fa18d 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxAboutDlg.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxAboutDlg class declaration
+ * VBox Qt GUI - VBoxAboutDlg class declaration.
  */
 
 /*
@@ -54,7 +53,8 @@ private:
     /* Variables: */
     QString m_strAboutText;
     QString m_strVersion;
-    QPixmap m_bgImage;
+    QPixmap m_pixmap;
+    QSize   m_size;
 };
 
 #endif /* __VBoxAboutDlg_h__ */
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
index e3cd7e3..30b3089 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
@@ -1,6 +1,6 @@
 /* $Id: VBoxFBOverlay.cpp $ */
 /** @file
- * VBoxFBOverlay implementation
+ * VBox Qt GUI - VBoxFBOverlay implementation.
  */
 
 /*
@@ -14,46 +14,56 @@
  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
-#if defined (VBOX_GUI_USE_QGL)
+#if defined(VBOX_GUI_USE_QGL)
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#define LOG_GROUP LOG_GROUP_GUI
+# define LOG_GROUP LOG_GROUP_GUI
 
 /* Qt includes: */
-#include <QGLWidget>
-#include <QFile>
-#include <QTextStream>
+# include <QGLWidget>
+# include <QFile>
+# include <QTextStream>
 
 /* GUI includes: */
-#include "VBoxFBOverlay.h"
-#include "UIMessageCenter.h"
-#include "UIPopupCenter.h"
-#include "VBoxGlobal.h"
+# include "VBoxFBOverlay.h"
+# include "UIMessageCenter.h"
+# include "UIPopupCenter.h"
+# include "UIExtraDataManager.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "CSession.h"
-#include "CConsole.h"
-#include "CMachine.h"
-#include "CDisplay.h"
+# include "CSession.h"
+# include "CConsole.h"
+# include "CMachine.h"
+# include "CDisplay.h"
 
 /* Other VBox includes: */
-#include <iprt/asm.h>
-#include <iprt/semaphore.h>
-#include <iprt/memcache.h>
+# include <iprt/asm.h>
+# include <iprt/semaphore.h>
+
+# include <VBox/VBoxGL2D.h>
+
+#ifdef Q_WS_MAC
+# include "VBoxUtils-darwin.h"
+#endif /* Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#include <VBox/VBoxGL2D.h>
+/* Other VBox includes: */
+#include <iprt/memcache.h>
 #include <VBox/err.h>
 
 #ifdef VBOX_WITH_VIDEOHWACCEL
-#include <VBox/VBoxVideo.h>
-#include <VBox/types.h>
-#include <VBox/vmm/ssm.h>
+# include <VBox/VBoxVideo.h>
+# include <VBox/vmm/ssm.h>
 #endif /* VBOX_WITH_VIDEOHWACCEL */
 
-#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+/* Other includes: */
+#include <math.h>
+
 
 #ifdef VBOXQGL_PROF_BASE
 # ifdef VBOXQGL_DBG_SURF
@@ -211,8 +221,6 @@ private:
     RTMEMCACHE mVBoxCmdEntryCache;
 };
 
-static VBoxVHWAEntriesCache g_VBoxCmdEntriesCache;
-
 static struct VBOXVHWACMD * vhwaHHCmdCreate(VBOXVHWACMD_TYPE type, size_t size)
 {
     char *buf = (char*)malloc(VBOXVHWACMD_SIZE_FROMBODYSIZE(size));
@@ -311,7 +319,7 @@ uint32_t VBoxVHWAHandleTable::put(void * data)
     if(mcUsage == mcSize)
     {
         /* @todo: resize */
-        Assert(0);
+        AssertFailed();
     }
 
     Assert(mcUsage < mcSize);
@@ -333,7 +341,7 @@ uint32_t VBoxVHWAHandleTable::put(void * data)
         mCursor = 1; /* 0 is treated as invalid */
     }
 
-    Assert(0);
+    AssertFailed();
     return VBOXVHWA_SURFHANDLE_INVALID;
 }
 
@@ -485,7 +493,7 @@ int VBoxVHWAGlShaderComponent::init()
     QFile fi(mRcName);
     if (!fi.open(QIODevice::ReadOnly))
     {
-        Assert(0);
+        AssertFailed();
         return VERR_GENERAL_FAILURE;
     }
 
@@ -919,7 +927,7 @@ int VBoxVHWAGlProgramVHWA::init()
                 case FOURCC_AYUV:
                     break;
                 default:
-                    Assert(0);
+                    AssertFailed();
                     break;
             }
         }
@@ -957,7 +965,7 @@ int VBoxVHWAGlProgramVHWA::init()
     if(rc == VINF_SUCCESS)
         return VINF_SUCCESS;
 
-    Assert(0);
+    AssertFailed();
     VBoxVHWAGlProgram::uninit();
     return VERR_GENERAL_FAILURE;
 }
@@ -1106,7 +1114,7 @@ VBoxVHWAGlProgramVHWA * VBoxVHWAGlProgramMngr::createProgram(uint32_t type, uint
 
     if(type & VBOXVHWA_PROGRAM_SRCCOLORKEY)
     {
-        Assert(0);
+        AssertFailed();
         /* disabled for now, not really necessary for video overlaying */
     }
 
@@ -1359,7 +1367,7 @@ ulong VBoxVHWASurfaceBase::calcBytesPerPixel(GLenum format, GLenum type)
         numComponents = 2;
         break;
     default:
-        Assert(0);
+        AssertFailed();
         break;
     }
 
@@ -1381,7 +1389,7 @@ ulong VBoxVHWASurfaceBase::calcBytesPerPixel(GLenum format, GLenum type)
         componentSize = 4;
         break;
     default:
-        Assert(0);
+        AssertFailed();
         break;
     }
     return numComponents * componentSize;
@@ -1565,7 +1573,7 @@ void VBoxVHWATexture::dbgDump()
     );
     VBOXQGLDBGPRINT(("<?dml?><exec cmd=\"!vbvdbg.ms 0x%p 0n%d 0n%d\">texture info</exec>\n",
             pvBuf, mRect.width(), mRect.height()));
-    Assert(0);
+    AssertFailed();
 
     free(pvBuf);
 #endif
@@ -2204,7 +2212,7 @@ int VBoxVHWAImage::vhwaSurfaceCanCreate(struct VBOXVHWACMD_SURF_CANCREATE *pCmd)
 
     if(!(pCmd->SurfInfo.flags & VBOXVHWA_SD_CAPS))
     {
-        Assert(0);
+        AssertFailed();
         pCmd->u.out.ErrInfo = -1;
         return VINF_SUCCESS;
     }
@@ -2212,7 +2220,7 @@ int VBoxVHWAImage::vhwaSurfaceCanCreate(struct VBOXVHWACMD_SURF_CANCREATE *pCmd)
     if(pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_OFFSCREENPLAIN)
     {
 #ifdef DEBUGVHWASTRICT
-        Assert(0);
+        AssertFailed();
 #endif
         pCmd->u.out.ErrInfo = -1;
         return VINF_SUCCESS;
@@ -2224,7 +2232,7 @@ int VBoxVHWAImage::vhwaSurfaceCanCreate(struct VBOXVHWACMD_SURF_CANCREATE *pCmd)
         if(pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_COMPLEX)
         {
 #ifdef DEBUG_misha
-            Assert(0);
+            AssertFailed();
 #endif
             pCmd->u.out.ErrInfo = -1;
         }
@@ -2239,7 +2247,7 @@ int VBoxVHWAImage::vhwaSurfaceCanCreate(struct VBOXVHWACMD_SURF_CANCREATE *pCmd)
     if ((pCmd->SurfInfo.surfCaps & VBOXVHWA_SCAPS_OVERLAY) == 0)
     {
 #ifdef DEBUGVHWASTRICT
-        Assert (0);
+        AssertFailed();
 #endif
         pCmd->u.out.ErrInfo = -1;
         return VINF_SUCCESS;
@@ -2250,7 +2258,7 @@ int VBoxVHWAImage::vhwaSurfaceCanCreate(struct VBOXVHWACMD_SURF_CANCREATE *pCmd)
     {
         if (!(pCmd->SurfInfo.flags & VBOXVHWA_SD_PIXELFORMAT))
         {
-            Assert (0);
+            AssertFailed();
             pCmd->u.out.ErrInfo = -1;
             return VINF_SUCCESS;
         }
@@ -2260,7 +2268,7 @@ int VBoxVHWAImage::vhwaSurfaceCanCreate(struct VBOXVHWACMD_SURF_CANCREATE *pCmd)
             if (pCmd->SurfInfo.PixelFormat.c.rgbBitCount != 32
                     && pCmd->SurfInfo.PixelFormat.c.rgbBitCount != 24)
             {
-                Assert (0);
+                AssertFailed();
                 pCmd->u.out.ErrInfo = -1;
                 return VINF_SUCCESS;
             }
@@ -2284,7 +2292,7 @@ int VBoxVHWAImage::vhwaSurfaceCanCreate(struct VBOXVHWACMD_SURF_CANCREATE *pCmd)
         }
         else
         {
-            Assert (0);
+            AssertFailed();
             pCmd->u.out.ErrInfo = -1;
             return VINF_SUCCESS;
         }
@@ -2304,7 +2312,7 @@ int VBoxVHWAImage::vhwaSurfaceCreate (struct VBOXVHWACMD_SURF_CREATE *pCmd)
         handle = pCmd->SurfInfo.hSurf;
         if(mSurfHandleTable.get(handle))
         {
-            Assert(0);
+            AssertFailed();
             return VERR_GENERAL_FAILURE;
         }
     }
@@ -3230,7 +3238,7 @@ int VBoxVHWAImage::vhwaLoadSurface(VHWACommandList * pCmdList, struct SSMHANDLE
         }
         else
         {
-            Assert(0);
+            AssertFailed();
         }
 
         if(cBackBuffers)
@@ -3777,7 +3785,7 @@ void VBoxVHWAImage::resize(const VBoxFBSizeInfo & size)
     bool bUsesGuestVram;
 
     /* check if we support the pixel format and can use the guest VRAM directly */
-    if (size.pixelFormat() == FramebufferPixelFormat_FOURCC_RGB)
+    if (size.pixelFormat() == KBitmapFormat_BGR)
     {
 
         bitsPerPixel = size.bitsPerPixel();
@@ -3790,19 +3798,19 @@ void VBoxVHWAImage::resize(const VBoxFBSizeInfo & size)
                 break;
             case 24:
 #ifdef DEBUG_misha
-                Assert(0);
+                AssertFailed();
 #endif
                 break;
             case 8:
 #ifdef DEBUG_misha
-                Assert(0);
+                AssertFailed();
 #endif
                 g = b = 0;
                 remind = true;
                 break;
             case 1:
 #ifdef DEBUG_misha
-                Assert(0);
+                AssertFailed();
 #endif
                 r = 1;
                 g = b = 0;
@@ -3810,7 +3818,7 @@ void VBoxVHWAImage::resize(const VBoxFBSizeInfo & size)
                 break;
             default:
 #ifdef DEBUG_misha
-                Assert(0);
+                AssertFailed();
 #endif
                 remind = true;
                 fallback = true;
@@ -3858,8 +3866,9 @@ void VBoxVHWAImage::resize(const VBoxFBSizeInfo & size)
     }
 
     ulong bytesPerPixel = bitsPerPixel/8;
-    ulong displayWidth = bytesPerLine/bytesPerPixel;
-    ulong displayHeight = size.height();
+    const QSize scaledSize = size.scaledSize();
+    const ulong displayWidth = scaledSize.isValid() ? scaledSize.width() : bytesPerLine / bytesPerPixel;
+    const ulong displayHeight = scaledSize.isValid() ? scaledSize.height() : size.height();
 
 #ifdef VBOXQGL_DBG_SURF
     for(int i = 0; i < RT_ELEMENTS(g_apSurf); i++)
@@ -4026,7 +4035,7 @@ void VBoxVHWAColorFormat::init (uint32_t fourcc)
             mWidthCompression = 4;
             break;
         default:
-            Assert(0);
+            AssertFailed();
             mBitsPerPixel = 0;
             mBitsPerPixelTex = 0;
             mWidthCompression = 0;
@@ -4051,7 +4060,7 @@ void VBoxVHWAColorFormat::init (uint32_t bitsPerPixel, uint32_t r, uint32_t g, u
             break;
         case 24:
 #ifdef DEBUG_misha
-            Assert(0);
+            AssertFailed();
 #endif
             mInternalFormat = 3;//GL_RGB;
             mFormat = GL_BGR_EXT;
@@ -4062,7 +4071,7 @@ void VBoxVHWAColorFormat::init (uint32_t bitsPerPixel, uint32_t r, uint32_t g, u
             break;
         case 16:
 #ifdef DEBUG_misha
-            Assert(0);
+            AssertFailed();
 #endif
             mInternalFormat = GL_RGB5;
             mFormat = GL_BGR_EXT;
@@ -4073,7 +4082,7 @@ void VBoxVHWAColorFormat::init (uint32_t bitsPerPixel, uint32_t r, uint32_t g, u
             break;
         case 8:
 #ifdef DEBUG_misha
-            Assert(0);
+            AssertFailed();
 #endif
             mInternalFormat = 1;//GL_RGB;
             mFormat = GL_RED;//GL_RGB;
@@ -4082,7 +4091,7 @@ void VBoxVHWAColorFormat::init (uint32_t bitsPerPixel, uint32_t r, uint32_t g, u
             break;
         case 1:
 #ifdef DEBUG_misha
-            Assert(0);
+            AssertFailed();
 #endif
             mInternalFormat = 1;
             mFormat = GL_COLOR_INDEX;
@@ -4091,7 +4100,7 @@ void VBoxVHWAColorFormat::init (uint32_t bitsPerPixel, uint32_t r, uint32_t g, u
             break;
         default:
 #ifdef DEBUG_misha
-            Assert(0);
+            AssertFailed();
 #endif
             mBitsPerPixel = 0;
             mBitsPerPixelTex = 0;
@@ -4147,9 +4156,9 @@ void VBoxVHWAColorFormat::pixel2Normalized (uint32_t pix, float *r, float *g, fl
     *b = mB.colorValNorm (pix);
 }
 
-VBoxQGLOverlay::VBoxQGLOverlay (QWidget *pViewport,QObject *pPostEventObject,  CSession * aSession, uint32_t id)
+VBoxQGLOverlay::VBoxQGLOverlay ()
     : mpOverlayWgt (NULL),
-      mpViewport (pViewport),
+      mpViewport (NULL),
       mGlOn (false),
       mOverlayWidgetVisible (false),
       mOverlayVisible (false),
@@ -4157,15 +4166,24 @@ VBoxQGLOverlay::VBoxQGLOverlay (QWidget *pViewport,QObject *pPostEventObject,  C
       mProcessingCommands (false),
       mNeedOverlayRepaint (false),
       mNeedSetVisible (false),
-      mCmdPipe (pPostEventObject),
-      mSettings (*aSession),
-      mpSession(aSession),
+      mCmdPipe (),
+      mSettings (),
+      mpSession(),
       mpShareWgt (NULL),
-      m_id(id)
+      m_id(0)
 {
     /* postpone the gl widget initialization to avoid conflict with 3D on Mac */
 }
 
+void VBoxQGLOverlay::init(QWidget *pViewport, QObject *pPostEventObject,  CSession * aSession, uint32_t id)
+{
+    mpViewport = pViewport;
+    mpSession = aSession;
+    m_id = id;
+    mSettings.init(*aSession);
+    mCmdPipe.init(pPostEventObject);
+}
+
 class VBoxGLShareWgt : public QGLWidget
 {
 public:
@@ -4396,14 +4414,49 @@ void VBoxQGLOverlay::onVHWACommandEvent(QEvent * pEvent)
     mGlCurrent = false;
 }
 
-bool VBoxQGLOverlay::onNotifyUpdate(ULONG aX, ULONG aY,
-                         ULONG aW, ULONG aH)
+bool VBoxQGLOverlay::onNotifyUpdate(ULONG uX, ULONG uY,
+                                    ULONG uW, ULONG uH)
 {
+    /* Prepare corresponding viewport part: */
+    QRect rect(uX, uY, uW, uH);
+
+    /* Take the scaling into account: */
+    const double dScaleFactor = mSizeInfo.scaleFactor();
+    const QSize scaledSize = mSizeInfo.scaledSize();
+    if (scaledSize.isValid())
+    {
+        /* Calculate corresponding scale-factors: */
+        const double xScaleFactor = mSizeInfo.visualState() == UIVisualStateType_Scale ?
+                                    (double)scaledSize.width()  / mSizeInfo.width()  : dScaleFactor;
+        const double yScaleFactor = mSizeInfo.visualState() == UIVisualStateType_Scale ?
+                                    (double)scaledSize.height() / mSizeInfo.height() : dScaleFactor;
+        /* Adjust corresponding viewport part: */
+        rect.moveTo(floor((double)rect.x() * xScaleFactor) - 1,
+                    floor((double)rect.y() * yScaleFactor) - 1);
+        rect.setSize(QSize(ceil((double)rect.width()  * xScaleFactor) + 2,
+                           ceil((double)rect.height() * yScaleFactor) + 2));
+    }
+
+#ifdef Q_WS_MAC
+    /* Take the backing-scale-factor into account: */
+    if (mSizeInfo.useUnscaledHiDPIOutput())
+    {
+        const double dBackingScaleFactor = darwinBackingScaleFactor(mpViewport->window());
+        if (dBackingScaleFactor > 1.0)
+        {
+            rect.moveTo(floor((double)rect.x() / dBackingScaleFactor) - 1,
+                        floor((double)rect.y() / dBackingScaleFactor) - 1);
+            rect.setSize(QSize(ceil((double)rect.width()  / dBackingScaleFactor) + 2,
+                               ceil((double)rect.height() / dBackingScaleFactor) + 2));
+        }
+    }
+#endif /* Q_WS_MAC */
+
     /* we do not to miss notify updates, because we have to update bg textures for it,
-     * so no not check for m_fIsMarkedAsUnused here,
+     * so no not check for m_fUnused here,
      * mOverlay will store the required info for us */
-    QRect r(aX, aY, aW, aH);
-    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &r);
+    mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &rect);
+
     return true;
 }
 
@@ -4823,7 +4876,7 @@ void VBoxQGLOverlay::vboxDoVHWACmdExec(void *cmd)
         } break;
 #endif
         default:
-            Assert(0);
+            AssertFailed();
             pCmd->rc = VERR_NOT_IMPLEMENTED;
             break;
     }
@@ -4944,12 +4997,12 @@ void VBoxQGLOverlay::processCmd(VBoxVHWACommandElement * pCmd)
         }
 #endif
         default:
-            Assert(0);
+            AssertFailed();
     }
 }
 
-VBoxVHWACommandElementProcessor::VBoxVHWACommandElementProcessor(QObject *pNotifyObject) :
-    m_pNotifyObject(pNotifyObject),
+VBoxVHWACommandElementProcessor::VBoxVHWACommandElementProcessor() :
+    m_pNotifyObject(NULL),
     mpCurCmd(NULL),
     mbResetting(false),
     mcDisabled(0)
@@ -4958,6 +5011,13 @@ VBoxVHWACommandElementProcessor::VBoxVHWACommandElementProcessor(QObject *pNotif
     AssertRC(rc);
 
     RTListInit(&mCommandList);
+
+    m_pCmdEntryCache = new VBoxVHWAEntriesCache;
+}
+
+void VBoxVHWACommandElementProcessor::init(QObject *pNotifyObject)
+{
+    m_pNotifyObject = pNotifyObject;
 }
 
 VBoxVHWACommandElementProcessor::~VBoxVHWACommandElementProcessor()
@@ -4966,6 +5026,8 @@ VBoxVHWACommandElementProcessor::~VBoxVHWACommandElementProcessor()
     RTListIsEmpty(&mCommandList);
 
     RTCritSectDelete(&mCritSect);
+
+    delete m_pCmdEntryCache;
 }
 
 void VBoxVHWACommandElementProcessor::postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData)
@@ -4977,7 +5039,7 @@ void VBoxVHWACommandElementProcessor::postCmd(VBOXVHWA_PIPECMD_TYPE aType, void
     /* 1. lock*/
     RTCritSectEnter(&mCritSect);
 
-    VBoxVHWACommandElement * pCmd = g_VBoxCmdEntriesCache.alloc();
+    VBoxVHWACommandElement * pCmd = m_pCmdEntryCache->alloc();
     if(!pCmd)
     {
         VBOXQGLLOG(("!!!no more free elements!!!\n"));
@@ -5078,7 +5140,7 @@ void VBoxVHWACommandElementProcessor::doneCmd()
     RTCritSectLeave(&mCritSect);
 
     if (pEl)
-        g_VBoxCmdEntriesCache.free(pEl);
+        m_pCmdEntryCache->free(pEl);
 }
 
 VBoxVHWACommandElement * VBoxVHWACommandElementProcessor::getCmd()
@@ -5172,19 +5234,19 @@ void VBoxVHWACommandElementProcessor::reset(CDisplay *pDisplay)
             break;
         case VBOXVHWA_PIPECMD_FUNC:
             /* should not happen, don't handle this for now */
-            Assert(0);
+            AssertFailed();
             break;
 #endif
         case VBOXVHWA_PIPECMD_PAINT:
             break;
         default:
             /* should not happen, don't handle this for now */
-            Assert(0);
+            AssertFailed();
             break;
         }
 
         RTListNodeRemove(&pCur->ListNode);
-        g_VBoxCmdEntriesCache.free(pCur);
+        m_pCmdEntryCache->free(pCur);
     }
 
     RTCritSectEnter(&mCritSect);
@@ -5259,7 +5321,7 @@ int VBoxVHWACommandElementProcessor::loadExec (struct SSMHANDLE * pSSM, uint32_t
                             break;
                         }
                         default:
-                            Assert(0);
+                            AssertFailed();
                             break;
                     }
 
@@ -5305,7 +5367,7 @@ void VBoxVHWACommandElementProcessor::saveExec (struct SSMHANDLE * pSSM, void *p
                 break;
             }
             default:
-                Assert(0);
+                AssertFailed();
                 break;
         }
     }
@@ -5771,26 +5833,25 @@ int VBoxVHWATextureImage::setCKey (VBoxVHWAGlProgramVHWA * pProgram, const VBoxV
     return RT_SUCCESS(rcL) /*&& RT_SUCCESS(rcU)*/ ? VINF_SUCCESS: VERR_GENERAL_FAILURE;
 }
 
-VBoxVHWASettings::VBoxVHWASettings (CSession &session)
+VBoxVHWASettings::VBoxVHWASettings ()
 {
-    CMachine machine = session.GetMachine();
+}
+
+void VBoxVHWASettings::init(CSession &session)
+{
+    const QString strMachineID = session.GetMachine().GetId();
 
-    QString str = machine.GetExtraData (GUI_Accelerate2D_StretchLinear);
-    mStretchLinearEnabled = str != "off";
+    mStretchLinearEnabled = gEDataManager->useLinearStretch(strMachineID);
 
     uint32_t aFourccs[VBOXVHWA_NUMFOURCC];
     int num = 0;
-    str = machine.GetExtraData (GUI_Accelerate2D_PixformatAYUV);
-    if (str != "off")
+    if (gEDataManager->usePixelFormatAYUV(strMachineID))
         aFourccs[num++] = FOURCC_AYUV;
-    str = machine.GetExtraData (GUI_Accelerate2D_PixformatUYVY);
-    if (str != "off")
+    if (gEDataManager->usePixelFormatUYVY(strMachineID))
         aFourccs[num++] = FOURCC_UYVY;
-    str = machine.GetExtraData (GUI_Accelerate2D_PixformatYUY2);
-    if (str != "off")
+    if (gEDataManager->usePixelFormatYUY2(strMachineID))
         aFourccs[num++] = FOURCC_YUY2;
-    str = machine.GetExtraData (GUI_Accelerate2D_PixformatYV12);
-    if (str != "off")
+    if (gEDataManager->usePixelFormatYV12(strMachineID))
         aFourccs[num++] = FOURCC_YV12;
 
     mFourccEnabledCount = num;
@@ -5821,5 +5882,5 @@ int VBoxVHWASettings::calcIntersection (int c1, const uint32_t *a1, int c2, cons
     return cMatch;
 }
 
-#endif
+#endif /* VBOX_GUI_USE_QGL */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h b/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h
index fc96caf..21053d0 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.h
@@ -1,7 +1,6 @@
+/* $Id:  $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxFrameBuffer Overly classes declarations
+ * VBox Qt GUI - VBoxFrameBuffer Overly classes declarations.
  */
 
 /*
@@ -31,6 +30,8 @@
 /* GUI includes: */
 #include "UIDefs.h"
 #include "VBoxFBOverlayCommon.h"
+#include "runtime/UIFrameBuffer.h"
+#include "runtime/UIMachineView.h"
 
 /* COM includes: */
 #include "COMEnums.h"
@@ -83,7 +84,8 @@ private:
 class VBoxVHWASettings
 {
 public:
-    VBoxVHWASettings (CSession &session);
+    VBoxVHWASettings ();
+    void init(CSession &session);
 
     int fourccEnabledCount() const { return mFourccEnabledCount; }
     const uint32_t * fourccEnabledList() const { return mFourccEnabledList; }
@@ -269,10 +271,10 @@ public:
             switch (mFormat)
             {
                 case GL_BGRA_EXT:
-                    return FramebufferPixelFormat_FOURCC_RGB;
+                    return KBitmapFormat_BGR;
             }
         }
-        return FramebufferPixelFormat_Opaque;
+        return KBitmapFormat_Opaque;
     }
 
 private:
@@ -1306,10 +1308,12 @@ private:
     volatile uint32_t m_cRefs;
 };
 
+class VBoxVHWAEntriesCache;
 class VBoxVHWACommandElementProcessor
 {
 public:
-    VBoxVHWACommandElementProcessor(QObject *pNotifyObject);
+    VBoxVHWACommandElementProcessor();
+    void init(QObject *pNotifyObject);
     ~VBoxVHWACommandElementProcessor();
     void postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData);
     VBoxVHWACommandElement *getCmd();
@@ -1330,40 +1334,58 @@ private:
     VBoxVHWACommandElement *mpCurCmd;
     bool mbResetting;
     uint32_t mcDisabled;
+    VBoxVHWAEntriesCache *m_pCmdEntryCache;
 };
 
 /* added to workaround this ** [VBox|UI] duplication */
 class VBoxFBSizeInfo
 {
 public:
+
     VBoxFBSizeInfo() {}
-    template<class T> VBoxFBSizeInfo(T * fb) :
-        mPixelFormat(fb->pixelFormat()), mVRAM(fb->address()), mBitsPerPixel(fb->bitsPerPixel()),
-        mBytesPerLine(fb->bytesPerLine()), mWidth(fb->width()), mHeight(fb->height()),
-        mUsesGuestVram(fb->usesGuestVRAM()) {}
-
-    VBoxFBSizeInfo(ulong aPixelFormat, uchar *aVRAM,
-                     ulong aBitsPerPixel, ulong aBytesPerLine,
-                     ulong aWidth, ulong aHeight,
-                     bool bUsesGuestVram) :
-        mPixelFormat (aPixelFormat), mVRAM (aVRAM), mBitsPerPixel (aBitsPerPixel),
-        mBytesPerLine (aBytesPerLine), mWidth (aWidth), mHeight (aHeight),
+    template<class T> VBoxFBSizeInfo(T *pFb) :
+        m_visualState(pFb->visualState()),
+        mPixelFormat(pFb->pixelFormat()), mVRAM(pFb->address()), mBitsPerPixel(pFb->bitsPerPixel()),
+        mBytesPerLine(pFb->bytesPerLine()), mWidth(pFb->width()), mHeight(pFb->height()),
+        m_dScaleFactor(pFb->scaleFactor()), m_scaledSize(pFb->scaledSize()), m_fUseUnscaledHiDPIOutput(pFb->useUnscaledHiDPIOutput()),
+        mUsesGuestVram(true) {}
+
+    VBoxFBSizeInfo(UIVisualStateType visualState,
+                   ulong aPixelFormat, uchar *aVRAM,
+                   ulong aBitsPerPixel, ulong aBytesPerLine,
+                   ulong aWidth, ulong aHeight,
+                   double dScaleFactor, const QSize &scaledSize, bool fUseUnscaledHiDPIOutput,
+                   bool bUsesGuestVram) :
+        m_visualState(visualState),
+        mPixelFormat(aPixelFormat), mVRAM(aVRAM), mBitsPerPixel(aBitsPerPixel),
+        mBytesPerLine(aBytesPerLine), mWidth(aWidth), mHeight(aHeight),
+        m_dScaleFactor(dScaleFactor), m_scaledSize(scaledSize), m_fUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput),
         mUsesGuestVram(bUsesGuestVram) {}
+
+    UIVisualStateType visualState() const { return m_visualState; }
     ulong pixelFormat() const { return mPixelFormat; }
     uchar *VRAM() const { return mVRAM; }
     ulong bitsPerPixel() const { return mBitsPerPixel; }
     ulong bytesPerLine() const { return mBytesPerLine; }
     ulong width() const { return mWidth; }
     ulong height() const { return mHeight; }
+    double scaleFactor() const { return m_dScaleFactor; }
+    QSize scaledSize() const { return m_scaledSize; }
+    bool useUnscaledHiDPIOutput() const { return m_fUseUnscaledHiDPIOutput; }
     bool usesGuestVram() const {return mUsesGuestVram;}
 
 private:
+
+    UIVisualStateType m_visualState;
     ulong mPixelFormat;
     uchar *mVRAM;
     ulong mBitsPerPixel;
     ulong mBytesPerLine;
     ulong mWidth;
     ulong mHeight;
+    double m_dScaleFactor;
+    QSize m_scaledSize;
+    bool m_fUseUnscaledHiDPIOutput;
     bool mUsesGuestVram;
 };
 
@@ -1670,7 +1692,8 @@ private:
 class VBoxQGLOverlay
 {
 public:
-    VBoxQGLOverlay(QWidget *pViewport, QObject *pPostEventObject, CSession * aSession, uint32_t id);
+    VBoxQGLOverlay();
+    void init(QWidget *pViewport, QObject *pPostEventObject, CSession * aSession, uint32_t id);
     ~VBoxQGLOverlay()
     {
         if (mpShareWgt)
@@ -1816,107 +1839,6 @@ private:
     uint32_t m_id;
 };
 
-/* these two additional class V, class R are to workaround the [VBox|UI] duplication,
- * @todo: remove them once VBox stuff is removed */
-template <class T, class V, class R>
-class VBoxOverlayFrameBuffer : public T
-{
-public:
-    VBoxOverlayFrameBuffer (V *pView, CSession * aSession, uint32_t id)
-        : T (pView),
-          mOverlay(pView->viewport(), pView, aSession, id),
-          mpView (pView)
-    {
-        /* sync with framebuffer */
-        mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(this), QPoint(mpView->contentsX(), mpView->contentsY()));
-    }
-
-    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
-    {
-        int rc;
-        T::lock();
-        /* Make sure frame-buffer is used: */
-        if (T::m_fIsMarkedAsUnused)
-        {
-            LogRel2(("ProcessVHWACommand: Postponed!\n"));
-            /* Unlock access to frame-buffer: */
-            T::unlock();
-            /* tell client to pend ProcessVHWACommand */
-            return E_ACCESSDENIED;
-        }
-        rc = mOverlay.onVHWACommand ((struct VBOXVHWACMD*)pCommand);
-        T::unlock();
-        if (rc == VINF_CALLBACK_RETURN)
-            return S_OK;
-        else if (RT_SUCCESS(rc))
-            return S_FALSE;
-        else if (rc == VERR_INVALID_STATE)
-            return E_ACCESSDENIED;
-        return E_FAIL;
-    }
-
-    void doProcessVHWACommand (QEvent * pEvent)
-    {
-        mOverlay.onVHWACommandEvent (pEvent);
-    }
-
-    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
-                             ULONG aW, ULONG aH)
-    {
-        HRESULT hr = S_OK;
-        T::lock();
-        /* Make sure frame-buffer is used: */
-        if (T::m_fIsMarkedAsUnused)
-        {
-            LogRel2(("NotifyUpdate: Ignored!\n"));
-            mOverlay.onNotifyUpdateIgnore (aX, aY, aW, aH);
-            /* Unlock access to frame-buffer: */
-            T::unlock();
-            /*can we actually ignore the notify update?*/
-            /* Ignore NotifyUpdate: */
-            return E_FAIL;
-        }
-
-        if (!mOverlay.onNotifyUpdate (aX, aY, aW, aH))
-            hr = T::NotifyUpdate (aX, aY, aW, aH);
-        T::unlock();
-        return hr;
-    }
-
-    void resizeEvent (R *re)
-    {
-        T::resizeEvent (re);
-        mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(this),
-                QPoint(mpView->contentsX(), mpView->contentsY()));
-    }
-
-    void viewportResized (QResizeEvent * re)
-    {
-        mOverlay.onViewportResized (re);
-        T::viewportResized (re);
-    }
-
-    void viewportScrolled (int dx, int dy)
-    {
-        mOverlay.onViewportScrolled (QPoint(mpView->contentsX(), mpView->contentsY()));
-        T::viewportScrolled (dx, dy);
-    }
-
-    void setView(V * pView)
-    {
-        /* lock to ensure we do not collide with the EMT thread passing commands to us */
-        T::lock();
-        T::setView(pView);
-        mpView = pView;
-        mOverlay.updateAttachment(pView ? pView->viewport() : NULL, pView);
-        T::unlock();
-    }
-
-private:
-    VBoxQGLOverlay mOverlay;
-    V *mpView;
-};
-
 #endif
 
 #endif /* #ifndef __VBoxFBOverlay_h__ */
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlayCommon.h b/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlayCommon.h
index 70eda2a..6361428 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlayCommon.h
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlayCommon.h
@@ -1,7 +1,6 @@
+/* $Id:  $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxFrameBuffer Overly classes declarations
+ * VBox Qt GUI - VBoxFrameBuffer Overlay classes declarations.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxGLSupportInfo.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxGLSupportInfo.cpp
index baaf46a..2cd0052 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxGLSupportInfo.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxGLSupportInfo.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxGLSupportInfo.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * OpenGL support info used for 2D support detection
+ * VBox Qt GUI - OpenGL support info used for 2D support detection.
  */
 
 /*
@@ -18,25 +16,29 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
-#include <iprt/assert.h>
-#include <iprt/log.h>
+
+# include <iprt/assert.h>
+# include <iprt/log.h>
+# include <iprt/env.h>
+# include <iprt/param.h>
+# include <iprt/path.h>
+# include <iprt/process.h>
+# include <iprt/string.h>
+# include <iprt/time.h>
+# include <iprt/thread.h>
+
+# include <QGLWidget>
+
+# include <VBox/VBoxGL2D.h>
+# include "VBoxFBOverlayCommon.h"
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #include <iprt/err.h>
-#include <iprt/env.h>
-#include <iprt/param.h>
-#include <iprt/path.h>
-#include <iprt/process.h>
-#include <iprt/string.h>
-#include <iprt/time.h>
-#include <iprt/thread.h>
-
-#include <QGLWidget>
+
 #include <QGLContext>
 
-#include <VBox/VBoxGL2D.h>
-#include "VBoxFBOverlayCommon.h"
-#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /*****************/
 
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.cpp
index 27358b2..d90d9dc 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxGlobalSettings.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxGlobalSettingsData, VBoxGlobalSettings class implementation
+ * VBox Qt GUI - VBoxGlobalSettingsData, VBoxGlobalSettings class implementation.
  */
 
 /*
@@ -18,25 +16,32 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QString>
-#include <QRegExp>
-#include <QVariant>
+# include <QString>
+# include <QRegExp>
+# include <QVariant>
 
 /* GUI includes: */
-#include "UIDefs.h"
-#include "VBoxGlobalSettings.h"
-#include "UIHostComboEditor.h"
+# include "UIDefs.h"
+# include "UIExtraDataDefs.h"
+# include "VBoxGlobalSettings.h"
+# include "UIHostComboEditor.h"
 
 /* COM includes: */
-#include "COMEnums.h"
-#include "CVirtualBox.h"
+# include "COMEnums.h"
+# include "CVirtualBox.h"
+
+# ifdef Q_WS_MAC
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+# endif /* Q_WS_MAC */
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 /** @class VBoxGlobalSettingsData
  *
  *  The VBoxGlobalSettingsData class encapsulates the global settings
@@ -61,7 +66,6 @@ VBoxGlobalSettingsData::VBoxGlobalSettingsData()
     maxGuestRes = "auto";
     remapScancodes = QString::null;
     proxySettings = QString::null;
-    presentationModeEnabled = false;
     hostScreenSaverDisabled = false;
 }
 
@@ -74,7 +78,6 @@ VBoxGlobalSettingsData::VBoxGlobalSettingsData (const VBoxGlobalSettingsData &th
     maxGuestRes = that.maxGuestRes;
     remapScancodes = that.remapScancodes;
     proxySettings = that.proxySettings;
-    presentationModeEnabled = that.presentationModeEnabled;
     hostScreenSaverDisabled = that.hostScreenSaverDisabled;
 }
 
@@ -92,7 +95,6 @@ bool VBoxGlobalSettingsData::operator== (const VBoxGlobalSettingsData &that) con
          maxGuestRes == that.maxGuestRes &&
          remapScancodes == that.remapScancodes &&
          proxySettings == that.proxySettings &&
-         presentationModeEnabled == that.presentationModeEnabled &&
          hostScreenSaverDisabled == that.hostScreenSaverDisabled
         );
 }
@@ -122,9 +124,6 @@ gPropertyMap[] =
     { "GUI/MaxGuestResolution",                    "maxGuestRes",             "\\d*[1-9]\\d*,\\d*[1-9]\\d*|any|auto", true },
     { "GUI/RemapScancodes",                        "remapScancodes",          "(\\d+=\\d+,)*\\d+=\\d+", true },
     { "GUI/ProxySettings",                         "proxySettings",           "[\\s\\S]*", true },
-#ifdef Q_WS_MAC
-    { GUI_PresentationModeEnabled,                 "presentationModeEnabled", "true|false", true },
-#endif /* Q_WS_MAC */
     { "GUI/HostScreenSaverDisabled",               "hostScreenSaverDisabled", "true|false", true }
 };
 
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h b/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h
index 42b347c..53c6838 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxGlobalSettings.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxGlobalSettingsData, VBoxGlobalSettings class declarations
+ * VBox Qt GUI - VBoxGlobalSettingsData, VBoxGlobalSettings class declarations.
  */
 
 /*
@@ -44,7 +43,6 @@ private:
     QString maxGuestRes;
     QString remapScancodes;
     QString proxySettings;
-    bool presentationModeEnabled;
     bool hostScreenSaverDisabled;
 
     friend class VBoxGlobalSettings;
@@ -62,7 +60,6 @@ class VBoxGlobalSettings : public QObject, public CIShared <VBoxGlobalSettingsDa
     Q_PROPERTY (QString maxGuestRes READ maxGuestRes WRITE setMaxGuestRes)
     Q_PROPERTY (QString remapScancodes READ remapScancodes WRITE setRemapScancodes)
     Q_PROPERTY (QString proxySettings READ proxySettings WRITE setProxySettings)
-    Q_PROPERTY (bool presentationModeEnabled READ presentationModeEnabled WRITE setPresentationModeEnabled)
     Q_PROPERTY (bool hostScreenSaverDisabled READ hostScreenSaverDisabled WRITE setHostScreenSaverDisabled)
 
 public:
@@ -119,12 +116,6 @@ public:
         mData()->proxySettings = aProxySettings;
     }
 
-    bool presentationModeEnabled() const { return data()->presentationModeEnabled; }
-    void setPresentationModeEnabled (bool enabled)
-    {
-        mData()->presentationModeEnabled = enabled;
-    }
-
     bool hostScreenSaverDisabled() const { return data()->hostScreenSaverDisabled; }
     void setHostScreenSaverDisabled (bool disabled)
     {
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
index 1f2e489..ca3f28f 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxLicenseViewer.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxLicenseViewer class implementation
+ * VBox Qt GUI - VBoxLicenseViewer class implementation.
  */
 
 /*
@@ -18,20 +16,23 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
-#include "VBoxLicenseViewer.h"
-#include "QIDialogButtonBox.h"
-#include "UIMessageCenter.h"
+
+# include "VBoxLicenseViewer.h"
+# include "QIDialogButtonBox.h"
+# include "UIMessageCenter.h"
 
 /* Qt includes */
-#include <QTextBrowser>
-#include <QPushButton>
-#include <QVBoxLayout>
-#include <QScrollBar>
-#include <QFile>
+# include <QTextBrowser>
+# include <QPushButton>
+# include <QVBoxLayout>
+# include <QScrollBar>
+# include <QFile>
+
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 VBoxLicenseViewer::VBoxLicenseViewer(QWidget *pParent /* = 0 */)
     : QIWithRetranslateUI2<QDialog>(pParent)
     , mLicenseText (0)
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.h b/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.h
index 6d2dde6..0d596c4 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.h
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxLicenseViewer.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxLicenseViewer class declaration
+ * VBox Qt GUI - VBoxLicenseViewer class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp
index c9c8aca..93dd3a2 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxSnapshotDetailsDlg.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxSnapshotDetailsDlg class implementation
+ * VBox Qt GUI - VBoxSnapshotDetailsDlg class implementation.
  */
 
 /*
@@ -18,25 +16,26 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QDateTime>
-#include <QPushButton>
-#include <QScrollArea>
+# include <QDateTime>
+# include <QPushButton>
+# include <QScrollArea>
 
 /* GUI includes: */
-#include <VBoxGlobal.h>
-#include <UIMessageCenter.h>
-#include <VBoxSnapshotDetailsDlg.h>
-#include <VBoxUtils.h>
+# include <VBoxGlobal.h>
+# include <UIMessageCenter.h>
+# include <VBoxSnapshotDetailsDlg.h>
+# include <VBoxUtils.h>
 
 /* COM includes: */
-#include "CMachine.h"
+# include "CMachine.h"
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 VBoxSnapshotDetailsDlg::VBoxSnapshotDetailsDlg (QWidget *aParent)
     : QIWithRetranslateUI <QDialog> (aParent)
 {
@@ -74,9 +73,9 @@ void VBoxSnapshotDetailsDlg::getFromSnapshot (const CSnapshot &aSnapshot)
 
     /* Get thumbnail if present */
     ULONG width = 0, height = 0;
-    QVector <BYTE> thumbData = machine.ReadSavedThumbnailToArray (0, true, width, height);
+    QVector <BYTE> thumbData = machine.ReadSavedThumbnailToArray (0, KBitmapFormat_BGR0, width, height);
     mThumbnail = thumbData.size() != 0 ? QPixmap::fromImage (QImage (thumbData.data(), width, height, QImage::Format_RGB32).copy()) : QPixmap();
-    QVector <BYTE> screenData = machine.ReadSavedScreenshotPNGToArray (0, width, height);
+    QVector <BYTE> screenData = machine.ReadSavedScreenshotToArray (0, KBitmapFormat_PNG, width, height);
     mScreenshot = screenData.size() != 0 ? QPixmap::fromImage (QImage::fromData (screenData.data(), screenData.size(), "PNG")) : QPixmap();
 
     QGridLayout *lt = qobject_cast <QGridLayout*> (layout());
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.h b/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.h
index 674b64f..2eeb078 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.h
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxSnapshotDetailsDlg.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxSnapshotDetailsDlg class declaration
+ * VBox Qt GUI - VBoxSnapshotDetailsDlg class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.cpp
index 19ecf67..4d4099d 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxTakeSnapshotDlg.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxTakeSnapshotDlg class implementation
+ * VBox Qt GUI - VBoxTakeSnapshotDlg class implementation.
  */
 
 /*
@@ -18,29 +16,30 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QPushButton>
+# include <QPushButton>
 
 /* GUI includes: */
-#include "VBoxTakeSnapshotDlg.h"
-#include "UIMessageCenter.h"
-#include "VBoxUtils.h"
-#ifdef Q_WS_MAC
-# include "UIMachineWindowNormal.h"
-# include "VBoxSnapshotsWgt.h"
-#endif /* Q_WS_MAC */
+# include "VBoxTakeSnapshotDlg.h"
+# include "UIMessageCenter.h"
+# include "VBoxUtils.h"
+# ifdef Q_WS_MAC
+#  include "UIMachineWindowNormal.h"
+#  include "VBoxSnapshotsWgt.h"
+# endif /* Q_WS_MAC */
 
 /* COM includes: */
-#include "COMEnums.h"
-#include "CMachine.h"
-#include "CMedium.h"
-#include "CMediumAttachment.h"
+# include "COMEnums.h"
+# include "CMachine.h"
+# include "CMedium.h"
+# include "CMediumAttachment.h"
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 VBoxTakeSnapshotDlg::VBoxTakeSnapshotDlg(QWidget *pParent, const CMachine &machine)
     : QIWithRetranslateUI<QIDialog>(pParent)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.h b/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.h
index d3e8de7..f4e2722 100644
--- a/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.h
+++ b/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxTakeSnapshotDlg.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxTakeSnapshotDlg class declaration
+ * VBox Qt GUI - VBoxTakeSnapshotDlg class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp
deleted file mode 100644
index ea372a1..0000000
--- a/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp
+++ /dev/null
@@ -1,733 +0,0 @@
-/* $Id: VBoxVMInformationDlg.cpp $ */
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMInformationDlg class implementation
- */
-
-/*
- * Copyright (C) 2006-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
-#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
-/* Qt includes: */
-#include <QTimer>
-#include <QScrollBar>
-
-/* GUI includes: */
-#include "UIIconPool.h"
-#include "UIMachineLogic.h"
-#include "UIMachineView.h"
-#include "UIMachineWindow.h"
-#include "UISession.h"
-#include "VBoxGlobal.h"
-#include "VBoxVMInformationDlg.h"
-#include "UIConverter.h"
-
-/* COM includes: */
-#include "COMEnums.h"
-#include "CConsole.h"
-#include "CSystemProperties.h"
-#include "CMachineDebugger.h"
-#include "CDisplay.h"
-#include "CGuest.h"
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
-#include "CNetworkAdapter.h"
-#include "CVRDEServerInfo.h"
-
-#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
-VBoxVMInformationDlg::InfoDlgMap VBoxVMInformationDlg::mSelfArray = InfoDlgMap();
-
-void VBoxVMInformationDlg::createInformationDlg(UIMachineWindow *pMachineWindow)
-{
-    CMachine machine = pMachineWindow->machineLogic()->uisession()->session().GetMachine();
-    if (mSelfArray.find (machine.GetName()) == mSelfArray.end())
-    {
-        /* Creating new information dialog if there is no one existing */
-        VBoxVMInformationDlg *id = new VBoxVMInformationDlg(pMachineWindow, Qt::Window);
-        id->centerAccording (pMachineWindow);
-        // TODO_NEW_CORE: this seems not necessary, cause we set WA_DeleteOnClose.
-        id->setAttribute (Qt::WA_DeleteOnClose);
-        mSelfArray [machine.GetName()] = id;
-    }
-
-    VBoxVMInformationDlg *info = mSelfArray [machine.GetName()];
-    info->show();
-    info->raise();
-    info->setWindowState (info->windowState() & ~Qt::WindowMinimized);
-    info->activateWindow();
-}
-
-VBoxVMInformationDlg::VBoxVMInformationDlg (UIMachineWindow *pMachineWindow, Qt::WindowFlags aFlags)
-# ifdef Q_WS_MAC
-    : QIWithRetranslateUI2 <QIMainDialog> (pMachineWindow, aFlags)
-# else /* Q_WS_MAC */
-    : QIWithRetranslateUI2 <QIMainDialog> (0, aFlags)
-# endif /* Q_WS_MAC */
-    , mSession (pMachineWindow->session())
-    , mIsPolished (false)
-    , mStatTimer (new QTimer (this))
-{
-    /* Apply UI decorations */
-    Ui::VBoxVMInformationDlg::setupUi (this);
-
-#ifdef Q_WS_MAC
-    /* No icon for this window on the mac, cause this would act as proxy icon which isn't necessary here. */
-    setWindowIcon(QIcon());
-#else
-    /* Apply window icons */
-    setWindowIcon(UIIconPool::iconSetFull(QSize (32, 32), QSize (16, 16),
-                                          ":/session_info_32px.png", ":/session_info_16px.png"));
-#endif
-
-    /* Enable size grip without using a status bar. */
-    setSizeGripEnabled (true);
-
-    /* Setup focus-proxy for pages */
-    mPage1->setFocusProxy (mDetailsText);
-    mPage2->setFocusProxy (mStatisticText);
-
-    /* Setup browsers */
-    mDetailsText->viewport()->setAutoFillBackground (false);
-    mStatisticText->viewport()->setAutoFillBackground (false);
-
-    /* Setup margins */
-    mDetailsText->setViewportMargins (5, 5, 5, 5);
-    mStatisticText->setViewportMargins (5, 5, 5, 5);
-
-    /* Setup handlers */
-    connect (pMachineWindow->uisession(), SIGNAL (sigMediumChange(const CMediumAttachment&)), this, SLOT (updateDetails()));
-    connect (pMachineWindow->uisession(), SIGNAL (sigSharedFolderChange()), this, SLOT (updateDetails()));
-    /* TODO_NEW_CORE: this is ofc not really right in the mm sense. There are
-     * more than one screens. */
-    connect (pMachineWindow->machineView(), SIGNAL (resizeHintDone()), this, SLOT (processStatistics()));
-    connect (mInfoStack, SIGNAL (currentChanged (int)), this, SLOT (onPageChanged (int)));
-    connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(updateDetails()));
-    connect (mStatTimer, SIGNAL (timeout()), this, SLOT (processStatistics()));
-
-    /* Loading language constants */
-    retranslateUi();
-
-    /* Details page update */
-    updateDetails();
-
-    /* Statistics page update */
-    processStatistics();
-    mStatTimer->start (5000);
-
-    /* Preload dialog attributes for this vm */
-    QString dlgsize = mSession.GetMachine().GetExtraData(GUI_InfoDlgState);
-    if (dlgsize.isEmpty())
-    {
-        mWidth = 400;
-        mHeight = 450;
-        mMax = false;
-    }
-    else
-    {
-        QStringList list = dlgsize.split (',');
-        mWidth = list [0].toInt(), mHeight = list [1].toInt();
-        mMax = list [2] == "max";
-    }
-
-    /* Make statistics page the default one */
-    mInfoStack->setCurrentIndex (1);
-}
-
-VBoxVMInformationDlg::~VBoxVMInformationDlg()
-{
-    /* Save dialog attributes for this vm */
-    QString dlgsize ("%1,%2,%3");
-    mSession.GetMachine().SetExtraData(GUI_InfoDlgState,
-                                       dlgsize.arg(mWidth).arg(mHeight).arg(isMaximized() ? "max" : "normal"));
-
-    if (!mSession.isNull() && !mSession.GetMachine().isNull())
-        mSelfArray.remove (mSession.GetMachine().GetName());
-}
-
-void VBoxVMInformationDlg::retranslateUi()
-{
-    /* Translate uic generated strings */
-    Ui::VBoxVMInformationDlg::retranslateUi (this);
-
-    updateDetails();
-
-    AssertReturnVoid (!mSession.isNull());
-    CMachine machine = mSession.GetMachine();
-    AssertReturnVoid (!machine.isNull());
-
-    /* Setup a dialog caption */
-    setWindowTitle (tr ("%1 - Session Information").arg (machine.GetName()));
-
-    /* Clear counter names initially */
-    mNamesMap.clear();
-    mUnitsMap.clear();
-    mLinksMap.clear();
-
-    /* Storage statistics */
-    CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties();
-    CStorageControllerVector controllers = mSession.GetMachine().GetStorageControllers();
-    int ideCount = 0, sataCount = 0, scsiCount = 0;
-    foreach (const CStorageController &controller, controllers)
-    {
-        switch (controller.GetBus())
-        {
-            case KStorageBus_IDE:
-            {
-                for (ULONG i = 0; i < sp.GetMaxPortCountForStorageBus (KStorageBus_IDE); ++ i)
-                {
-                    for (ULONG j = 0; j < sp.GetMaxDevicesPerPortForStorageBus (KStorageBus_IDE); ++ j)
-                    {
-                        /* Names */
-                        mNamesMap [QString ("/Devices/IDE%1/ATA%2/Unit%3/*DMA")
-                            .arg (ideCount).arg (i).arg (j)] = tr ("DMA Transfers");
-                        mNamesMap [QString ("/Devices/IDE%1/ATA%2/Unit%3/*PIO")
-                            .arg (ideCount).arg (i).arg (j)] = tr ("PIO Transfers");
-                        mNamesMap [QString ("/Devices/IDE%1/ATA%2/Unit%3/ReadBytes")
-                            .arg (ideCount).arg (i).arg (j)] = tr ("Data Read");
-                        mNamesMap [QString ("/Devices/IDE%1/ATA%2/Unit%3/WrittenBytes")
-                            .arg (ideCount).arg (i).arg (j)] = tr ("Data Written");
-
-                        /* Units */
-                        mUnitsMap [QString ("/Devices/IDE%1/ATA%2/Unit%3/*DMA")
-                            .arg (ideCount).arg (i).arg (j)] = "[B]";
-                        mUnitsMap [QString ("/Devices/IDE%1/ATA%2/Unit%3/*PIO")
-                            .arg (ideCount).arg (i).arg (j)] = "[B]";
-                        mUnitsMap [QString ("/Devices/IDE%1/ATA%2/Unit%3/ReadBytes")
-                            .arg (ideCount).arg (i).arg (j)] = "B";
-                        mUnitsMap [QString ("/Devices/IDE%1/ATA%2/Unit%3/WrittenBytes")
-                            .arg (ideCount).arg (i).arg (j)] = "B";
-
-                        /* Belongs to */
-                        mLinksMap [QString ("/Devices/IDE%1/ATA%2/Unit%3").arg (ideCount).arg (i).arg (j)] = QStringList()
-                                << QString ("/Devices/IDE%1/ATA%2/Unit%3/*DMA").arg (ideCount).arg (i).arg (j)
-                                << QString ("/Devices/IDE%1/ATA%2/Unit%3/*PIO").arg (ideCount).arg (i).arg (j)
-                                << QString ("/Devices/IDE%1/ATA%2/Unit%3/ReadBytes").arg (ideCount).arg (i).arg (j)
-                                << QString ("/Devices/IDE%1/ATA%2/Unit%3/WrittenBytes").arg (ideCount).arg (i).arg (j);
-                    }
-                }
-                ++ ideCount;
-                break;
-            }
-            case KStorageBus_SATA:
-            {
-                for (ULONG i = 0; i < sp.GetMaxPortCountForStorageBus (KStorageBus_SATA); ++ i)
-                {
-                    for (ULONG j = 0; j < sp.GetMaxDevicesPerPortForStorageBus (KStorageBus_SATA); ++ j)
-                    {
-                        /* Names */
-                        mNamesMap [QString ("/Devices/SATA%1/Port%2/DMA").arg (sataCount).arg (i)]
-                            = tr ("DMA Transfers");
-                        mNamesMap [QString ("/Devices/SATA%1/Port%2/ReadBytes").arg (sataCount).arg (i)]
-                            = tr ("Data Read");
-                        mNamesMap [QString ("/Devices/SATA%1/Port%2/WrittenBytes").arg (sataCount).arg (i)]
-                            = tr ("Data Written");
-
-                        /* Units */
-                        mUnitsMap [QString ("/Devices/SATA%1/Port%2/DMA").arg (sataCount).arg (i)] = "[B]";
-                        mUnitsMap [QString ("/Devices/SATA%1/Port%2/ReadBytes").arg (sataCount).arg (i)] = "B";
-                        mUnitsMap [QString ("/Devices/SATA%1/Port%2/WrittenBytes").arg (sataCount).arg (i)] = "B";
-
-                        /* Belongs to */
-                        mLinksMap [QString ("/Devices/SATA%1/Port%2").arg (sataCount).arg (i)] = QStringList()
-                                << QString ("/Devices/SATA%1/Port%2/DMA").arg (sataCount).arg (i)
-                                << QString ("/Devices/SATA%1/Port%2/ReadBytes").arg (sataCount).arg (i)
-                                << QString ("/Devices/SATA%1/Port%2/WrittenBytes").arg (sataCount).arg (i);
-                    }
-                }
-                ++ sataCount;
-                break;
-            }
-            case KStorageBus_SCSI:
-            {
-                for (ULONG i = 0; i < sp.GetMaxPortCountForStorageBus (KStorageBus_SCSI); ++ i)
-                {
-                    for (ULONG j = 0; j < sp.GetMaxDevicesPerPortForStorageBus (KStorageBus_SCSI); ++ j)
-                    {
-                        /* Names */
-                        mNamesMap [QString ("/Devices/SCSI%1/%2/ReadBytes").arg (scsiCount).arg (i)]
-                            = tr ("Data Read");
-                        mNamesMap [QString ("/Devices/SCSI%1/%2/WrittenBytes").arg (scsiCount).arg (i)]
-                            = tr ("Data Written");
-
-                        /* Units */
-                        mUnitsMap [QString ("/Devices/SCSI%1/%2/ReadBytes").arg (scsiCount).arg (i)] = "B";
-                        mUnitsMap [QString ("/Devices/SCSI%1/%2/WrittenBytes").arg (scsiCount).arg (i)] = "B";
-
-                        /* Belongs to */
-                        mLinksMap [QString ("/Devices/SCSI%1/%2").arg (scsiCount).arg (i)] = QStringList()
-                                << QString ("/Devices/SCSI%1/%2/ReadBytes").arg (scsiCount).arg (i)
-                                << QString ("/Devices/SCSI%1/%2/WrittenBytes").arg (scsiCount).arg (i);
-                    }
-                }
-                ++ scsiCount;
-                break;
-            }
-            default:
-                break;
-        }
-    }
-
-    /* Network statistics: */
-    ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
-    for (ulong i = 0; i < count; ++ i)
-    {
-        CNetworkAdapter na = machine.GetNetworkAdapter (i);
-        KNetworkAdapterType ty = na.GetAdapterType();
-        const char *name;
-
-        switch (ty)
-        {
-            case KNetworkAdapterType_I82540EM:
-            case KNetworkAdapterType_I82543GC:
-            case KNetworkAdapterType_I82545EM:
-                name = "E1k";
-                break;
-            case KNetworkAdapterType_Virtio:
-                name = "VNet";
-                break;
-            default:
-                name = "PCNet";
-                break;
-        }
-
-        /* Names */
-        mNamesMap [QString ("/Devices/%1%2/TransmitBytes")
-            .arg (name).arg (i)] = tr ("Data Transmitted");
-        mNamesMap [QString ("/Devices/%1%2/ReceiveBytes")
-            .arg (name).arg (i)] = tr ("Data Received");
-
-        /* Units */
-        mUnitsMap [QString ("/Devices/%1%2/TransmitBytes")
-            .arg (name).arg (i)] = "B";
-        mUnitsMap [QString ("/Devices/%1%2/ReceiveBytes")
-            .arg (name).arg (i)] = "B";
-
-        /* Belongs to */
-        mLinksMap [QString ("NA%1").arg (i)] = QStringList()
-            << QString ("/Devices/%1%2/TransmitBytes").arg (name).arg (i)
-            << QString ("/Devices/%1%2/ReceiveBytes").arg (name).arg (i);
-    }
-
-    /* Statistics page update. */
-    refreshStatistics();
-}
-
-bool VBoxVMInformationDlg::event (QEvent *aEvent)
-{
-    bool result = QIMainDialog::event (aEvent);
-    switch (aEvent->type())
-    {
-        case QEvent::WindowStateChange:
-        {
-            if (mIsPolished)
-                mMax = isMaximized();
-            else if (mMax == isMaximized())
-                mIsPolished = true;
-            break;
-        }
-        default:
-            break;
-    }
-    return result;
-}
-
-void VBoxVMInformationDlg::resizeEvent (QResizeEvent *aEvent)
-{
-    QIMainDialog::resizeEvent (aEvent);
-
-    /* Store dialog size for this vm */
-    if (mIsPolished && !isMaximized())
-    {
-        mWidth = width();
-        mHeight = height();
-    }
-}
-
-void VBoxVMInformationDlg::showEvent (QShowEvent *aEvent)
-{
-    /* One may think that QWidget::polish() is the right place to do things
-     * below, but apparently, by the time when QWidget::polish() is called,
-     * the widget style & layout are not fully done, at least the minimum
-     * size hint is not properly calculated. Since this is sometimes necessary,
-     * we provide our own "polish" implementation */
-    if (!mIsPolished)
-    {
-        /* Load window size and state */
-        resize (mWidth, mHeight);
-        if (mMax)
-            QTimer::singleShot (0, this, SLOT (showMaximized()));
-        else
-            mIsPolished = true;
-    }
-
-    QIMainDialog::showEvent (aEvent);
-}
-
-
-void VBoxVMInformationDlg::updateDetails()
-{
-    /* Details page update */
-    mDetailsText->setText (vboxGlobal().detailsReport (mSession.GetMachine(), false /* aWithLinks */));
-}
-
-void VBoxVMInformationDlg::processStatistics()
-{
-    CMachineDebugger dbg = mSession.GetConsole().GetDebugger();
-    QString info;
-
-    /* Process selected statistics: */
-    for (DataMapType::const_iterator it = mNamesMap.begin(); it != mNamesMap.end(); ++ it)
-    {
-        info = dbg.GetStats(it.key(), true);
-        mValuesMap[it.key()] = parseStatistics(info);
-    }
-
-    /* Statistics page update */
-    refreshStatistics();
-}
-
-void VBoxVMInformationDlg::onPageChanged (int aIndex)
-{
-    /* Focusing the browser on shown page */
-    mInfoStack->widget (aIndex)->setFocus();
-}
-
-QString VBoxVMInformationDlg::parseStatistics (const QString &aText)
-{
-    /* Filters the statistic counters body */
-    QRegExp query ("^.+<Statistics>\n(.+)\n</Statistics>.*$");
-    if (query.indexIn (aText) == -1)
-        return QString::null;
-
-    QStringList wholeList = query.cap (1).split ("\n");
-
-    ULONG64 summa = 0;
-    for (QStringList::Iterator lineIt = wholeList.begin(); lineIt != wholeList.end(); ++ lineIt)
-    {
-        QString text = *lineIt;
-        text.remove (1, 1);
-        text.remove (text.length() - 2, 2);
-
-        /* Parse incoming counter and fill the counter-element values. */
-        CounterElementType counter;
-        counter.type = text.section (" ", 0, 0);
-        text = text.section (" ", 1);
-        QStringList list = text.split ("\" ");
-        for (QStringList::Iterator it = list.begin(); it != list.end(); ++ it)
-        {
-            QString pair = *it;
-            QRegExp regExp ("^(.+)=\"([^\"]*)\"?$");
-            regExp.indexIn (pair);
-            counter.list.insert (regExp.cap (1), regExp.cap (2));
-        }
-
-        /* Fill the output with the necessary counter's value.
-         * Currently we are using "c" field of simple counter only. */
-        QString result = counter.list.contains ("c") ? counter.list ["c"] : "0";
-        summa += result.toULongLong();
-    }
-
-    return QString::number (summa);
-}
-
-void VBoxVMInformationDlg::refreshStatistics()
-{
-    if (mSession.isNull())
-        return;
-
-    QString table = "<table width=100% cellspacing=1 cellpadding=0>%1</table>";
-    QString hdrRow = "<tr><td width=22><img src='%1'></td>"
-                     "<td colspan=2><nobr><b>%2</b></nobr></td></tr>";
-    QString paragraph = "<tr><td colspan=3></td></tr>";
-    QString result;
-
-    CMachine m = mSession.GetMachine();
-
-    /* Runtime Information */
-    {
-        CConsole console = mSession.GetConsole();
-
-        ULONG width = 0;
-        ULONG height = 0;
-        ULONG bpp = 0;
-        LONG xOrigin = 0;
-        LONG yOrigin = 0;
-        console.GetDisplay().GetScreenResolution(0, width, height, bpp, xOrigin, yOrigin);
-        QString resolution = QString ("%1x%2")
-            .arg (width)
-            .arg (height);
-        if (bpp)
-            resolution += QString ("x%1").arg (bpp);
-        resolution += QString (" @%1,%2")
-                          .arg (xOrigin)
-                          .arg (yOrigin);
-
-        QString clipboardMode = gpConverter->toString(m.GetClipboardMode());
-        QString dragAndDropMode = gpConverter->toString(m.GetDragAndDropMode());
-
-        CMachineDebugger debugger = console.GetDebugger();
-        QString virtualization = debugger.GetHWVirtExEnabled() ?
-            VBoxGlobal::tr ("Enabled", "details report (VT-x/AMD-V)") :
-            VBoxGlobal::tr ("Disabled", "details report (VT-x/AMD-V)");
-        QString nested = debugger.GetHWVirtExNestedPagingEnabled() ?
-            VBoxGlobal::tr ("Enabled", "details report (Nested Paging)") :
-            VBoxGlobal::tr ("Disabled", "details report (Nested Paging)");
-        QString unrestricted = debugger.GetHWVirtExUXEnabled() ?
-            VBoxGlobal::tr ("Enabled", "details report (Unrestricted Execution)") :
-            VBoxGlobal::tr ("Disabled", "details report (Unrestricted Execution)");
-
-        CGuest guest = console.GetGuest();
-        QString addVersionStr = guest.GetAdditionsVersion();
-        if (addVersionStr.isEmpty())
-            addVersionStr = tr("Not Detected", "guest additions");
-        else
-        {
-            ULONG revision = guest.GetAdditionsRevision();
-            if (revision != 0)
-                addVersionStr += QString(" r%1").arg(revision);
-        }
-        QString osType = guest.GetOSTypeId();
-        if (osType.isEmpty())
-            osType = tr ("Not Detected", "guest os type");
-        else
-            osType = vboxGlobal().vmGuestOSTypeDescription (osType);
-
-        int vrdePort = console.GetVRDEServerInfo().GetPort();
-        QString vrdeInfo = (vrdePort == 0 || vrdePort == -1)?
-            tr ("Not Available", "details report (VRDE server port)") :
-            QString ("%1").arg (vrdePort);
-
-        /* Searching for longest string */
-        QStringList valuesList;
-        valuesList << resolution << virtualization << nested << unrestricted << addVersionStr << osType << vrdeInfo;
-        int maxLength = 0;
-        foreach (const QString &value, valuesList)
-            maxLength = maxLength < fontMetrics().width (value) ?
-                        fontMetrics().width (value) : maxLength;
-
-        result += hdrRow.arg (":/state_running_16px.png").arg (tr ("Runtime Attributes"));
-        result += formatValue (tr ("Screen Resolution"), resolution, maxLength);
-        result += formatValue (tr ("Clipboard Mode"), clipboardMode, maxLength);
-        result += formatValue (tr ("Drag'n'Drop Mode"), dragAndDropMode, maxLength);
-        result += formatValue (VBoxGlobal::tr ("VT-x/AMD-V", "details report"), virtualization, maxLength);
-        result += formatValue (VBoxGlobal::tr ("Nested Paging", "details report"), nested, maxLength);
-        result += formatValue (VBoxGlobal::tr ("Unrestricted Execution", "details report"), unrestricted, maxLength);
-        result += formatValue (tr ("Guest Additions"), addVersionStr, maxLength);
-        result += formatValue (tr ("Guest OS Type"), osType, maxLength);
-        result += formatValue (VBoxGlobal::tr ("Remote Desktop Server Port", "details report (VRDE Server)"), vrdeInfo, maxLength);
-        result += paragraph;
-    }
-
-    /* Storage statistics */
-    {
-        QString storageStat;
-
-        result += hdrRow.arg (":/hd_16px.png").arg (tr ("Storage Statistics"));
-
-        CStorageControllerVector controllers = mSession.GetMachine().GetStorageControllers();
-        int ideCount = 0, sataCount = 0, scsiCount = 0;
-        foreach (const CStorageController &controller, controllers)
-        {
-            QString ctrName = controller.GetName();
-            KStorageBus busType = controller.GetBus();
-            CMediumAttachmentVector attachments = mSession.GetMachine().GetMediumAttachmentsOfController (ctrName);
-            if (!attachments.isEmpty() && busType != KStorageBus_Floppy)
-            {
-                QString header = "<tr><td></td><td colspan=2><nobr>%1</nobr></td></tr>";
-                QString strControllerName = QApplication::translate("UIMachineSettingsStorage", "Controller: %1");
-                storageStat += header.arg(strControllerName.arg(controller.GetName()));
-                int scsiIndex = 0;
-                foreach (const CMediumAttachment &attachment, attachments)
-                {
-                    LONG attPort = attachment.GetPort();
-                    LONG attDevice = attachment.GetDevice();
-                    switch (busType)
-                    {
-                        case KStorageBus_IDE:
-                        {
-                            storageStat += formatMedium (ctrName, attPort, attDevice,
-                                                         QString ("/Devices/IDE%1/ATA%2/Unit%3").arg (ideCount).arg (attPort).arg (attDevice));
-                            break;
-                        }
-                        case KStorageBus_SATA:
-                        {
-                            storageStat += formatMedium (ctrName, attPort, attDevice,
-                                                         QString ("/Devices/SATA%1/Port%2").arg (sataCount).arg (attPort));
-                            break;
-                        }
-                        case KStorageBus_SCSI:
-                        {
-                            storageStat += formatMedium (ctrName, attPort, attDevice,
-                                                         QString ("/Devices/SCSI%1/%2").arg (scsiCount).arg (scsiIndex));
-                            ++ scsiIndex;
-                            break;
-                        }
-                        default:
-                            break;
-                    }
-                    storageStat += paragraph;
-                }
-            }
-
-            switch (busType)
-            {
-                case KStorageBus_IDE:
-                {
-                    ++ ideCount;
-                    break;
-                }
-                case KStorageBus_SATA:
-                {
-                    ++ sataCount;
-                    break;
-                }
-                case KStorageBus_SCSI:
-                {
-                    ++ scsiCount;
-                    break;
-                }
-                default:
-                    break;
-            }
-        }
-
-        /* If there are no Hard Disks */
-        if (storageStat.isNull())
-        {
-            storageStat = composeArticle (tr ("No Storage Devices"));
-            storageStat += paragraph;
-        }
-
-        result += storageStat;
-    }
-
-    /* Network Adapters Statistics */
-    {
-        QString networkStat;
-
-        result += hdrRow.arg (":/nw_16px.png").arg (tr ("Network Statistics"));
-
-        /* Network Adapters list */
-        ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
-        for (ulong slot = 0; slot < count; ++ slot)
-        {
-            if (m.GetNetworkAdapter (slot).GetEnabled())
-            {
-                networkStat += formatAdapter (slot, QString ("NA%1").arg (slot));
-                networkStat += paragraph;
-            }
-        }
-
-        /* If there are no Network Adapters */
-        if (networkStat.isNull())
-        {
-            networkStat = composeArticle (tr ("No Network Adapters"));
-            networkStat += paragraph;
-        }
-
-        result += networkStat;
-    }
-
-    /* Show full composed page & save/restore scroll-bar position */
-    int vv = mStatisticText->verticalScrollBar()->value();
-    mStatisticText->setText (table.arg (result));
-    mStatisticText->verticalScrollBar()->setValue (vv);
-}
-
-/**
- *  Allows left-aligned values formatting in right column.
- *
- *  aValueName - the name of value in the left column.
- *  aValue - left-aligned value itself in the right column.
- *  aMaxSize - maximum width (in pixels) of value in right column.
- */
-QString VBoxVMInformationDlg::formatValue (const QString &aValueName,
-                                           const QString &aValue, int aMaxSize)
-{
-    QString strMargin;
-    int size = aMaxSize - fontMetrics().width(aValue);
-    for (int i = 0; i < size; ++i)
-        strMargin += QString("<img width=1 height=1 src=:/tpixel.png>");
-
-    QString bdyRow = "<tr>"
-                     "<td></td>"
-                     "<td><nobr>%1</nobr></td>"
-                     "<td align=right><nobr>%2%3</nobr></td>"
-                     "</tr>";
-
-    return bdyRow.arg (aValueName).arg (aValue).arg (strMargin);
-}
-
-QString VBoxVMInformationDlg::formatMedium (const QString &aCtrName,
-                                            LONG aPort, LONG aDevice,
-                                            const QString &aBelongsTo)
-{
-    if (mSession.isNull())
-        return QString::null;
-
-    QString header = "<tr><td></td><td colspan=2><nobr>  %1:</nobr></td></tr>";
-    CStorageController ctr = mSession.GetMachine().GetStorageControllerByName (aCtrName);
-    QString name = gpConverter->toString (StorageSlot (ctr.GetBus(), aPort, aDevice));
-    return header.arg (name) + composeArticle (aBelongsTo, 2);
-}
-
-QString VBoxVMInformationDlg::formatAdapter (ULONG aSlot,
-                                             const QString &aBelongsTo)
-{
-    if (mSession.isNull())
-        return QString::null;
-
-    QString header = "<tr><td></td><td colspan=2><nobr>%1</nobr></td></tr>";
-    QString name = VBoxGlobal::tr ("Adapter %1", "details report (network)").arg (aSlot + 1);
-    return header.arg (name) + composeArticle (aBelongsTo, 1);
-}
-
-QString VBoxVMInformationDlg::composeArticle (const QString &aBelongsTo, int aSpacesCount)
-{
-    QString body = "<tr><td></td><td width=50%><nobr>%1%2</nobr></td>"
-                   "<td align=right><nobr>%3%4</nobr></td></tr>";
-    QString indent;
-    for (int i = 0; i < aSpacesCount; ++ i)
-        indent += "  ";
-    body = body.arg (indent);
-
-    QString result;
-
-    if (mLinksMap.contains (aBelongsTo))
-    {
-        QStringList keys = mLinksMap [aBelongsTo];
-        foreach (const QString &key, keys)
-        {
-            QString line (body);
-            if (mNamesMap.contains (key) && mValuesMap.contains (key) && mUnitsMap.contains (key))
-            {
-                line = line.arg (mNamesMap [key]).arg (QString ("%L1").arg (mValuesMap [key].toULongLong()));
-                line = mUnitsMap [key].contains (QRegExp ("\\[\\S+\\]")) ?
-                    line.arg (QString ("<img src=:/tpixel.png width=%1 height=1>")
-                              .arg (QApplication::fontMetrics().width (
-                              QString (" %1").arg (mUnitsMap [key]
-                              .mid (1, mUnitsMap [key].length() - 2))))) :
-                    line.arg (QString (" %1").arg (mUnitsMap [key]));
-                result += line;
-            }
-        }
-    }
-    else
-        result = body.arg (aBelongsTo).arg (QString::null).arg (QString::null);
-
-    return result;
-}
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.h b/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.h
deleted file mode 100644
index a048681..0000000
--- a/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxVMInformationDlg class declaration
- */
-
-/*
- * Copyright (C) 2006-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef __VBoxVMInformationDlg_h__
-#define __VBoxVMInformationDlg_h__
-
-/* Local includes: */
-#include "VBoxVMInformationDlg.gen.h"
-#include "QIMainDialog.h"
-#include "QIWithRetranslateUI.h"
-
-/* COM includes: */
-#include "COMEnums.h"
-#include "CSession.h"
-
-class UIMachineWindow;
-class QTimer;
-
-class VBoxVMInformationDlg : public QIWithRetranslateUI2 <QIMainDialog>, public Ui::VBoxVMInformationDlg
-{
-    Q_OBJECT;
-
-public:
-
-    typedef QMap <QString, QString> DataMapType;
-    typedef QMap <QString, QStringList> LinksMapType;
-    struct CounterElementType { QString type; DataMapType list; };
-    typedef QMap <QString, VBoxVMInformationDlg*> InfoDlgMap;
-
-    static void createInformationDlg(UIMachineWindow *pMachineWindow);
-
-protected:
-
-    VBoxVMInformationDlg (UIMachineWindow *pMachineWindow, Qt::WindowFlags aFlags);
-   ~VBoxVMInformationDlg();
-
-    void retranslateUi();
-
-    virtual bool event (QEvent *aEvent);
-    virtual void resizeEvent (QResizeEvent *aEvent);
-    virtual void showEvent (QShowEvent *aEvent);
-
-private slots:
-
-    void updateDetails();
-    void processStatistics();
-    void onPageChanged (int aIndex);
-
-private:
-
-    QString parseStatistics (const QString &aText);
-    void refreshStatistics();
-
-    QString formatValue (const QString &aValueName, const QString &aValue, int aMaxSize);
-    QString formatMedium (const QString &aCtrName, LONG aPort, LONG aDevice, const QString &aBelongsTo);
-    QString formatAdapter (ULONG aSlot, const QString &aBelongsTo);
-
-    QString composeArticle (const QString &aBelongsTo, int aSpacesCount = 0);
-
-    static InfoDlgMap  mSelfArray;
-
-    CSession           mSession;
-    bool               mIsPolished;
-    QTimer            *mStatTimer;
-
-    int                mWidth;
-    int                mHeight;
-    bool               mMax;
-
-    DataMapType        mNamesMap;
-    DataMapType        mValuesMap;
-    DataMapType        mUnitsMap;
-    LinksMapType       mLinksMap;
-};
-
-#endif // __VBoxVMInformationDlg_h__
-
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.ui b/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.ui
deleted file mode 100644
index 6614447..0000000
--- a/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.ui
+++ /dev/null
@@ -1,155 +0,0 @@
-<ui version="4.0" >
- <comment>
- VBox frontends: Qt4 GUI ("VirtualBox"):
-
- Copyright (C) 2008-2012 Oracle Corporation
-
- This file is part of VirtualBox Open Source Edition (OSE), as
- available from http://www.virtualbox.org. This file is free software;
- you can redistribute it and/or modify it under the terms of the GNU
- General Public License (GPL) as published by the Free Software
- Foundation, in version 2 as it comes in the "COPYING" file of the
- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- </comment>
- <class>VBoxVMInformationDlg</class>
- <widget class="QMainWindow" name="VBoxVMInformationDlg" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>487</width>
-    <height>391</height>
-   </rect>
-  </property>
-  <property name="windowTitle" >
-   <string>VBoxVMInformationDlg</string>
-  </property>
-  <widget class="QWidget" name="centralwidget" >
-   <layout class="QVBoxLayout" >
-    <item>
-     <widget class="QITabWidget" name="mInfoStack" >
-      <property name="currentIndex" >
-       <number>0</number>
-      </property>
-      <widget class="QWidget" name="mPage1" >
-       <attribute name="title" >
-        <string>Configuration &Details</string>
-       </attribute>
-       <attribute name="icon" >
-        <iconset resource="../VirtualBox1.qrc" >:/session_info_details_16px.png</iconset>
-       </attribute>
-       <layout class="QVBoxLayout" >
-        <property name="leftMargin" >
-         <number>0</number>
-        </property>
-        <property name="topMargin" >
-         <number>0</number>
-        </property>
-        <property name="rightMargin" >
-         <number>0</number>
-        </property>
-        <property name="bottomMargin" >
-         <number>0</number>
-        </property>
-        <item>
-         <widget class="QRichTextEdit" name="mDetailsText" >
-          <property name="frameShape" >
-           <enum>QFrame::NoFrame</enum>
-          </property>
-          <property name="frameShadow" >
-           <enum>QFrame::Plain</enum>
-          </property>
-          <property name="readOnly" >
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-      <widget class="QWidget" name="mPage2" >
-       <attribute name="title" >
-        <string>&Runtime Information</string>
-       </attribute>
-       <attribute name="icon" >
-        <iconset resource="../VirtualBox1.qrc" >:/session_info_runtime_16px.png</iconset>
-       </attribute>
-       <layout class="QVBoxLayout" >
-        <property name="leftMargin" >
-         <number>0</number>
-        </property>
-        <property name="topMargin" >
-         <number>0</number>
-        </property>
-        <property name="rightMargin" >
-         <number>0</number>
-        </property>
-        <property name="bottomMargin" >
-         <number>0</number>
-        </property>
-        <item>
-         <widget class="QRichTextEdit" name="mStatisticText" >
-          <property name="frameShape" >
-           <enum>QFrame::NoFrame</enum>
-          </property>
-          <property name="frameShadow" >
-           <enum>QFrame::Plain</enum>
-          </property>
-          <property name="readOnly" >
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-     </widget>
-    </item>
-    <item>
-     <widget class="QIDialogButtonBox" name="mButtonBox" >
-      <property name="standardButtons" >
-       <set>QDialogButtonBox::Close</set>
-      </property>
-     </widget>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>QIDialogButtonBox</class>
-   <extends>QDialogButtonBox</extends>
-   <header>QIDialogButtonBox.h</header>
-  </customwidget>
-  <customwidget>
-   <class>QRichTextEdit</class>
-   <extends>QTextEdit</extends>
-   <header>VBoxUtils.h</header>
-  </customwidget>
-  <customwidget>
-   <class>QITabWidget</class>
-   <extends>QTabWidget</extends>
-   <header>QITabWidget.h</header>
-  </customwidget>
- </customwidgets>
- <resources>
-  <include location="../VirtualBox1.qrc" />
- </resources>
- <connections>
-  <connection>
-   <sender>mButtonBox</sender>
-   <signal>rejected()</signal>
-   <receiver>VBoxVMInformationDlg</receiver>
-   <slot>close()</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>246</x>
-     <y>348</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>246</x>
-     <y>195</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
-</ui>
diff --git a/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.cpp b/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.cpp
index 7935adc..5e1933e 100644
--- a/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIConverter.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIConverter implementation
+ * VBox Qt GUI - UIConverter implementation.
  */
 
 /*
@@ -17,8 +15,13 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else
 /* GUI includes: */
-#include "UIConverter.h"
+# include "UIConverter.h"
+#endif
+
 
 /* static */
 UIConverter* UIConverter::m_spInstance = 0;
diff --git a/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.h b/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.h
index f74252d..9f40ccb 100644
--- a/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.h
+++ b/src/VBox/Frontends/VirtualBox/src/converter/UIConverter.h
@@ -1,7 +1,6 @@
+/* $Id: UIConverter.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIConverter declaration
+ * VBox Qt GUI - UIConverter declaration.
  */
 
 /*
@@ -42,12 +41,12 @@ public:
         Assert(0); return QColor();
     }
 
-    /* QPixmap <= template class: */
-    template<class T> QPixmap toPixmap(const T &data) const
+    /* QIcon <= template class: */
+    template<class T> QIcon toIcon(const T &data) const
     {
         if (canConvert<T>())
-            return ::toPixmap(data);
-        Assert(0); return QPixmap();
+            return ::toIcon(data);
+        Assert(0); return QIcon();
     }
     /* QPixmap <= template class: */
     template<class T> QPixmap toWarningPixmap(const T &data) const
@@ -87,6 +86,21 @@ public:
         Assert(0); return T();
     }
 
+    /* int <= template class: */
+    template<class T> int toInternalInteger(const T &data) const
+    {
+        if (canConvert<T>())
+            return ::toInternalInteger(data);
+        Assert(0); return 0;
+    }
+    /* Template class <= int: */
+    template<class T> T fromInternalInteger(const int &iData) const
+    {
+        if (canConvert<T>())
+            return ::fromInternalInteger<T>(iData);
+        Assert(0); return T();
+    }
+
 private:
 
     /* Constructor: */
diff --git a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
index 5cdf9a5..a455080 100644
--- a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
+++ b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
@@ -1,11 +1,10 @@
+/* $Id: UIConverterBackend.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIConverterBackend declaration
+ * VBox Qt GUI - UIConverterBackend declaration.
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -22,10 +21,15 @@
 /* Qt includes: */
 #include <QString>
 #include <QColor>
+#include <QIcon>
 #include <QPixmap>
 
 /* GUI includes: */
 #include "UIDefs.h"
+#include "UIExtraDataDefs.h"
+
+/* Other VBox includes: */
+#include <iprt/assert.h>
 
 /* Determines if 'Object of type X' can be converted to object of other type.
  * This function always returns 'false' until re-determined for specific object type. */
@@ -35,9 +39,10 @@ template<class X> bool canConvert() { return false; }
  * This function returns null QColor for any object type until re-determined for specific one. */
 template<class X> QColor toColor(const X & /* xobject */) { Assert(0); return QColor(); }
 
-/* Converts passed 'Object X' to QPixmap.
- * This function returns null QPixmap for any object type until re-determined for specific one. */
-template<class X> QPixmap toPixmap(const X & /* xobject */) { Assert(0); return QPixmap(); }
+/* Converts passed 'Object X' to QIcon.
+ * This function returns null QIcon for any object type until re-determined for specific one. */
+template<class X> QIcon toIcon(const X & /* xobject */) { Assert(0); return QIcon(); }
+
 /* Converts passed 'Object X' to QPixmap.
  * This function returns null QPixmap for any object type until re-determined for specific one. */
 template<class X> QPixmap toWarningPixmap(const X & /* xobject */) { Assert(0); return QPixmap(); }
@@ -56,36 +61,52 @@ template<class X> QString toInternalString(const X & /* xobject */) { Assert(0);
  * This function returns default constructed object for any object type until re-determined for specific one. */
 template<class X> X fromInternalString(const QString & /* strData */) { Assert(0); return X(); }
 
+/* Converts passed 'Object of type X' to abstract integer.
+ * This function returns 0 for any object type until re-determined for specific one. */
+template<class X> int toInternalInteger(const X & /* xobject */) { Assert(0); return 0; }
+/* Converts passed abstract integer to 'Object of type X'.
+ * This function returns default constructed object for any object type until re-determined for specific one. */
+template<class X> X fromInternalInteger(const int & /* iData */) { Assert(0); return X(); }
+
 /* Declare global canConvert specializations: */
 template<> bool canConvert<SizeSuffix>();
 template<> bool canConvert<StorageSlot>();
-template<> bool canConvert<RuntimeMenuType>();
-#ifdef Q_WS_MAC
-template<> bool canConvert<RuntimeMenuApplicationActionType>();
-#endif /* Q_WS_MAC */
-template<> bool canConvert<RuntimeMenuMachineActionType>();
-template<> bool canConvert<RuntimeMenuViewActionType>();
-template<> bool canConvert<RuntimeMenuDevicesActionType>();
+template<> bool canConvert<UIExtraDataMetaDefs::MenuType>();
+template<> bool canConvert<UIExtraDataMetaDefs::MenuApplicationActionType>();
+template<> bool canConvert<UIExtraDataMetaDefs::MenuHelpActionType>();
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>();
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuViewActionType>();
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuInputActionType>();
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>();
 #ifdef VBOX_WITH_DEBUGGER_GUI
-template<> bool canConvert<RuntimeMenuDebuggerActionType>();
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>();
 #endif /* VBOX_WITH_DEBUGGER_GUI */
-template<> bool canConvert<RuntimeMenuHelpActionType>();
+#ifdef Q_WS_MAC
+template<> bool canConvert<UIExtraDataMetaDefs::MenuWindowActionType>();
+#endif /* Q_WS_MAC */
 template<> bool canConvert<UIVisualStateType>();
 template<> bool canConvert<DetailsElementType>();
+template<> bool canConvert<PreviewUpdateIntervalType>();
 template<> bool canConvert<GlobalSettingsPageType>();
 template<> bool canConvert<MachineSettingsPageType>();
+template<> bool canConvert<WizardType>();
 template<> bool canConvert<IndicatorType>();
 template<> bool canConvert<MachineCloseAction>();
 template<> bool canConvert<MouseCapturePolicy>();
 template<> bool canConvert<GuruMeditationHandlerType>();
+template<> bool canConvert<ScalingOptimizationType>();
 template<> bool canConvert<HiDPIOptimizationType>();
+#ifndef Q_WS_MAC
+template<> bool canConvert<MiniToolbarAlignment>();
+#endif /* !Q_WS_MAC */
 
 /* Declare COM canConvert specializations: */
 template<> bool canConvert<KMachineState>();
 template<> bool canConvert<KSessionState>();
+template<> bool canConvert<KParavirtProvider>();
 template<> bool canConvert<KDeviceType>();
 template<> bool canConvert<KClipboardMode>();
-template<> bool canConvert<KDragAndDropMode>();
+template<> bool canConvert<KDnDMode>();
 template<> bool canConvert<KPointingHIDType>();
 template<> bool canConvert<KMediumType>();
 template<> bool canConvert<KMediumVariant>();
@@ -93,6 +114,7 @@ template<> bool canConvert<KNetworkAttachmentType>();
 template<> bool canConvert<KNetworkAdapterType>();
 template<> bool canConvert<KNetworkAdapterPromiscModePolicy>();
 template<> bool canConvert<KPortMode>();
+template<> bool canConvert<KUSBControllerType>();
 template<> bool canConvert<KUSBDeviceState>();
 template<> bool canConvert<KUSBDeviceFilterAction>();
 template<> bool canConvert<KAudioDriverType>();
@@ -108,55 +130,73 @@ template<> QString toString(const SizeSuffix &sizeSuffix);
 template<> SizeSuffix fromString<SizeSuffix>(const QString &strSizeSuffix);
 template<> QString toString(const StorageSlot &storageSlot);
 template<> StorageSlot fromString<StorageSlot>(const QString &strStorageSlot);
-template<> QString toInternalString(const RuntimeMenuType &runtimeMenuType);
-template<> RuntimeMenuType fromInternalString<RuntimeMenuType>(const QString &strRuntimeMenuType);
-#ifdef Q_WS_MAC
-template<> QString toInternalString(const RuntimeMenuApplicationActionType &runtimeMenuApplicationActionType);
-template<> RuntimeMenuApplicationActionType fromInternalString<RuntimeMenuApplicationActionType>(const QString &strRuntimeMenuApplicationActionType);
-#endif /* Q_WS_MAC */
-template<> QString toInternalString(const RuntimeMenuMachineActionType &runtimeMenuMachineActionType);
-template<> RuntimeMenuMachineActionType fromInternalString<RuntimeMenuMachineActionType>(const QString &strRuntimeMenuMachineActionType);
-template<> QString toInternalString(const RuntimeMenuViewActionType &runtimeMenuViewActionType);
-template<> RuntimeMenuViewActionType fromInternalString<RuntimeMenuViewActionType>(const QString &strRuntimeMenuViewActionType);
-template<> QString toInternalString(const RuntimeMenuDevicesActionType &runtimeMenuDevicesActionType);
-template<> RuntimeMenuDevicesActionType fromInternalString<RuntimeMenuDevicesActionType>(const QString &strRuntimeMenuDevicesActionType);
+template<> QString toInternalString(const UIExtraDataMetaDefs::MenuType &menuType);
+template<> UIExtraDataMetaDefs::MenuType fromInternalString<UIExtraDataMetaDefs::MenuType>(const QString &strMenuType);
+template<> QString toInternalString(const UIExtraDataMetaDefs::MenuApplicationActionType &menuApplicationActionType);
+template<> UIExtraDataMetaDefs::MenuApplicationActionType fromInternalString<UIExtraDataMetaDefs::MenuApplicationActionType>(const QString &strMenuApplicationActionType);
+template<> QString toInternalString(const UIExtraDataMetaDefs::MenuHelpActionType &menuHelpActionType);
+template<> UIExtraDataMetaDefs::MenuHelpActionType fromInternalString<UIExtraDataMetaDefs::MenuHelpActionType>(const QString &strMenuHelpActionType);
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuMachineActionType &runtimeMenuMachineActionType);
+template<> UIExtraDataMetaDefs::RuntimeMenuMachineActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(const QString &strRuntimeMenuMachineActionType);
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuViewActionType &runtimeMenuViewActionType);
+template<> UIExtraDataMetaDefs::RuntimeMenuViewActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(const QString &strRuntimeMenuViewActionType);
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuInputActionType &runtimeMenuInputActionType);
+template<> UIExtraDataMetaDefs::RuntimeMenuInputActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuInputActionType>(const QString &strRuntimeMenuInputActionType);
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType &runtimeMenuDevicesActionType);
+template<> UIExtraDataMetaDefs::RuntimeMenuDevicesActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(const QString &strRuntimeMenuDevicesActionType);
 #ifdef VBOX_WITH_DEBUGGER_GUI
-template<> QString toInternalString(const RuntimeMenuDebuggerActionType &runtimeMenuDebuggerActionType);
-template<> RuntimeMenuDebuggerActionType fromInternalString<RuntimeMenuDebuggerActionType>(const QString &strRuntimeMenuDebuggerActionType);
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType &runtimeMenuDebuggerActionType);
+template<> UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(const QString &strRuntimeMenuDebuggerActionType);
 #endif /* VBOX_WITH_DEBUGGER_GUI */
-template<> QString toInternalString(const RuntimeMenuHelpActionType &runtimeMenuHelpActionType);
-template<> RuntimeMenuHelpActionType fromInternalString<RuntimeMenuHelpActionType>(const QString &strRuntimeMenuHelpActionType);
+#ifdef Q_WS_MAC
+template<> QString toInternalString(const UIExtraDataMetaDefs::MenuWindowActionType &menuWindowActionType);
+template<> UIExtraDataMetaDefs::MenuWindowActionType fromInternalString<UIExtraDataMetaDefs::MenuWindowActionType>(const QString &strMenuWindowActionType);
+#endif /* Q_WS_MAC */
 template<> QString toInternalString(const UIVisualStateType &visualStateType);
 template<> UIVisualStateType fromInternalString<UIVisualStateType>(const QString &strVisualStateType);
 template<> QString toString(const DetailsElementType &detailsElementType);
 template<> DetailsElementType fromString<DetailsElementType>(const QString &strDetailsElementType);
 template<> QString toInternalString(const DetailsElementType &detailsElementType);
 template<> DetailsElementType fromInternalString<DetailsElementType>(const QString &strDetailsElementType);
+template<> QString toInternalString(const PreviewUpdateIntervalType &previewUpdateIntervalType);
+template<> PreviewUpdateIntervalType fromInternalString<PreviewUpdateIntervalType>(const QString &strPreviewUpdateIntervalType);
+template<> int toInternalInteger(const PreviewUpdateIntervalType &previewUpdateIntervalType);
+template<> PreviewUpdateIntervalType fromInternalInteger<PreviewUpdateIntervalType>(const int &iPreviewUpdateIntervalType);
 template<> QString toInternalString(const GlobalSettingsPageType &globalSettingsPageType);
 template<> GlobalSettingsPageType fromInternalString<GlobalSettingsPageType>(const QString &strGlobalSettingsPageType);
 template<> QPixmap toWarningPixmap(const GlobalSettingsPageType &globalSettingsPageType);
 template<> QString toInternalString(const MachineSettingsPageType &machineSettingsPageType);
 template<> MachineSettingsPageType fromInternalString<MachineSettingsPageType>(const QString &strMachineSettingsPageType);
 template<> QPixmap toWarningPixmap(const MachineSettingsPageType &machineSettingsPageType);
+template<> QString toInternalString(const WizardType &wizardType);
+template<> WizardType fromInternalString<WizardType>(const QString &strWizardType);
 template<> QString toInternalString(const IndicatorType &indicatorType);
 template<> IndicatorType fromInternalString<IndicatorType>(const QString &strIndicatorType);
+template<> QIcon toIcon(const IndicatorType &indicatorType);
 template<> QString toInternalString(const MachineCloseAction &machineCloseAction);
 template<> MachineCloseAction fromInternalString<MachineCloseAction>(const QString &strMachineCloseAction);
 template<> QString toInternalString(const MouseCapturePolicy &mouseCapturePolicy);
 template<> MouseCapturePolicy fromInternalString<MouseCapturePolicy>(const QString &strMouseCapturePolicy);
 template<> QString toInternalString(const GuruMeditationHandlerType &guruMeditationHandlerType);
 template<> GuruMeditationHandlerType fromInternalString<GuruMeditationHandlerType>(const QString &strGuruMeditationHandlerType);
+template<> QString toInternalString(const ScalingOptimizationType &optimizationType);
+template<> ScalingOptimizationType fromInternalString<ScalingOptimizationType>(const QString &strOptimizationType);
 template<> QString toInternalString(const HiDPIOptimizationType &optimizationType);
 template<> HiDPIOptimizationType fromInternalString<HiDPIOptimizationType>(const QString &strOptimizationType);
+#ifndef Q_WS_MAC
+template<> QString toInternalString(const MiniToolbarAlignment &miniToolbarAlignment);
+template<> MiniToolbarAlignment fromInternalString<MiniToolbarAlignment>(const QString &strMiniToolbarAlignment);
+#endif /* !Q_WS_MAC */
 
 /* Declare COM conversion specializations: */
 template<> QColor toColor(const KMachineState &state);
-template<> QPixmap toPixmap(const KMachineState &state);
+template<> QIcon toIcon(const KMachineState &state);
 template<> QString toString(const KMachineState &state);
 template<> QString toString(const KSessionState &state);
+template<> QString toString(const KParavirtProvider &type);
 template<> QString toString(const KDeviceType &type);
 template<> QString toString(const KClipboardMode &mode);
-template<> QString toString(const KDragAndDropMode &mode);
+template<> QString toString(const KDnDMode &mode);
 template<> QString toString(const KPointingHIDType &type);
 template<> QString toString(const KMediumType &type);
 template<> QString toString(const KMediumVariant &variant);
@@ -164,6 +204,7 @@ template<> QString toString(const KNetworkAttachmentType &type);
 template<> QString toString(const KNetworkAdapterType &type);
 template<> QString toString(const KNetworkAdapterPromiscModePolicy &policy);
 template<> QString toString(const KPortMode &mode);
+template<> QString toString(const KUSBControllerType &type);
 template<> QString toString(const KUSBDeviceState &state);
 template<> QString toString(const KUSBDeviceFilterAction &action);
 template<> QString toString(const KAudioDriverType &type);
diff --git a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp
index 7a9735a..40bbaa6 100644
--- a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendCOM.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIConverterBackendCOM.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIConverterBackend implementation
+ * VBox Qt GUI - UIConverterBackend implementation.
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,23 +15,32 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QHash>
+# include <QApplication>
+# include <QHash>
 
 /* GUI includes: */
-#include "UIConverterBackend.h"
+# include "UIConverterBackend.h"
+# include "UIIconPool.h"
 
 /* COM includes: */
-#include "COMEnums.h"
+# include "COMEnums.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Determines if <Object of type X> can be converted to object of other type.
  * These functions returns 'true' for all allowed conversions. */
 template<> bool canConvert<KMachineState>() { return true; }
 template<> bool canConvert<KSessionState>() { return true; }
+template<> bool canConvert<KParavirtProvider>() { return true; }
 template<> bool canConvert<KDeviceType>() { return true; }
 template<> bool canConvert<KClipboardMode>() { return true; }
-template<> bool canConvert<KDragAndDropMode>() { return true; }
+template<> bool canConvert<KDnDMode>() { return true; }
 template<> bool canConvert<KPointingHIDType>() { return true; }
 template<> bool canConvert<KMediumType>() { return true; }
 template<> bool canConvert<KMediumVariant>() { return true; }
@@ -41,6 +48,7 @@ template<> bool canConvert<KNetworkAttachmentType>() { return true; }
 template<> bool canConvert<KNetworkAdapterType>() { return true; }
 template<> bool canConvert<KNetworkAdapterPromiscModePolicy>() { return true; }
 template<> bool canConvert<KPortMode>() { return true; }
+template<> bool canConvert<KUSBControllerType>() { return true; }
 template<> bool canConvert<KUSBDeviceState>() { return true; }
 template<> bool canConvert<KUSBDeviceFilterAction>() { return true; }
 template<> bool canConvert<KAudioDriverType>() { return true; }
@@ -64,6 +72,8 @@ template<> QColor toColor(const KMachineState &state)
         case KMachineState_Paused:                 return QColor(Qt::darkGreen);
         case KMachineState_Stuck:                  return QColor(Qt::darkMagenta);
         case KMachineState_Teleporting:            return QColor(Qt::blue);
+        case KMachineState_Snapshotting:           return QColor(Qt::green);
+        case KMachineState_OnlineSnapshotting:     return QColor(Qt::green);
         case KMachineState_LiveSnapshotting:       return QColor(Qt::green);
         case KMachineState_Starting:               return QColor(Qt::green);
         case KMachineState_Stopping:               return QColor(Qt::green);
@@ -86,39 +96,41 @@ template<> QColor toColor(const KMachineState &state)
     return QColor();
 }
 
-/* QPixmap <= KMachineState: */
-template<> QPixmap toPixmap(const KMachineState &state)
+/* QIcon <= KMachineState: */
+template<> QIcon toIcon(const KMachineState &state)
 {
     switch (state)
     {
-        case KMachineState_PoweredOff:             return QPixmap(":/state_powered_off_16px.png");
-        case KMachineState_Saved:                  return QPixmap(":/state_saved_16px.png");
-        case KMachineState_Aborted:                return QPixmap(":/state_aborted_16px.png");
-        case KMachineState_Teleported:             return QPixmap(":/state_saved_16px.png");
-        case KMachineState_Running:                return QPixmap(":/state_running_16px.png");
-        case KMachineState_Paused:                 return QPixmap(":/state_paused_16px.png");
-        case KMachineState_Stuck:                  return QPixmap(":/state_stuck_16px.png");
-        case KMachineState_Teleporting:            return QPixmap(":/state_running_16px.png");
-        case KMachineState_LiveSnapshotting:       return QPixmap(":/state_running_16px.png");
-        case KMachineState_Starting:               return QPixmap(":/state_running_16px.png");
-        case KMachineState_Stopping:               return QPixmap(":/state_running_16px.png");
-        case KMachineState_Saving:                 return QPixmap(":/state_saving_16px.png");
-        case KMachineState_Restoring:              return QPixmap(":/state_restoring_16px.png");
-        case KMachineState_TeleportingPausedVM:    return QPixmap(":/state_saving_16px.png");
-        case KMachineState_TeleportingIn:          return QPixmap(":/state_restoring_16px.png");
+        case KMachineState_PoweredOff:             return UIIconPool::iconSet(":/state_powered_off_16px.png");
+        case KMachineState_Saved:                  return UIIconPool::iconSet(":/state_saved_16px.png");
+        case KMachineState_Aborted:                return UIIconPool::iconSet(":/state_aborted_16px.png");
+        case KMachineState_Teleported:             return UIIconPool::iconSet(":/state_saved_16px.png");
+        case KMachineState_Running:                return UIIconPool::iconSet(":/state_running_16px.png");
+        case KMachineState_Paused:                 return UIIconPool::iconSet(":/state_paused_16px.png");
+        case KMachineState_Stuck:                  return UIIconPool::iconSet(":/state_stuck_16px.png");
+        case KMachineState_Teleporting:            return UIIconPool::iconSet(":/state_running_16px.png");
+        case KMachineState_Snapshotting:           return UIIconPool::iconSet(":/state_saving_16px.png");
+        case KMachineState_OnlineSnapshotting:     return UIIconPool::iconSet(":/state_running_16px.png");
+        case KMachineState_LiveSnapshotting:       return UIIconPool::iconSet(":/state_running_16px.png");
+        case KMachineState_Starting:               return UIIconPool::iconSet(":/state_running_16px.png");
+        case KMachineState_Stopping:               return UIIconPool::iconSet(":/state_running_16px.png");
+        case KMachineState_Saving:                 return UIIconPool::iconSet(":/state_saving_16px.png");
+        case KMachineState_Restoring:              return UIIconPool::iconSet(":/state_restoring_16px.png");
+        case KMachineState_TeleportingPausedVM:    return UIIconPool::iconSet(":/state_saving_16px.png");
+        case KMachineState_TeleportingIn:          return UIIconPool::iconSet(":/state_restoring_16px.png");
         // case KMachineState_FaultTolerantSyncing:
-        case KMachineState_DeletingSnapshotOnline: return QPixmap(":/state_discarding_16px.png");
-        case KMachineState_DeletingSnapshotPaused: return QPixmap(":/state_discarding_16px.png");
-        case KMachineState_RestoringSnapshot:      return QPixmap(":/state_discarding_16px.png");
-        case KMachineState_DeletingSnapshot:       return QPixmap(":/state_discarding_16px.png");
-        case KMachineState_SettingUp:              return QPixmap(":/vm_settings_16px.png"); // TODO: Change icon!
+        case KMachineState_DeletingSnapshotOnline: return UIIconPool::iconSet(":/state_discarding_16px.png");
+        case KMachineState_DeletingSnapshotPaused: return UIIconPool::iconSet(":/state_discarding_16px.png");
+        case KMachineState_RestoringSnapshot:      return UIIconPool::iconSet(":/state_discarding_16px.png");
+        case KMachineState_DeletingSnapshot:       return UIIconPool::iconSet(":/state_discarding_16px.png");
+        case KMachineState_SettingUp:              return UIIconPool::iconSet(":/vm_settings_16px.png"); // TODO: Change icon!
         // case KMachineState_FirstOnline:
         // case KMachineState_LastOnline:
         // case KMachineState_FirstTransient:
         // case KMachineState_LastTransient:
-        default: AssertMsgFailed(("No pixmap for %d", state)); break;
+        default: AssertMsgFailed(("No icon for %d", state)); break;
     }
-    return QPixmap();
+    return QIcon();
 }
 
 /* QString <= KMachineState: */
@@ -134,6 +146,8 @@ template<> QString toString(const KMachineState &state)
         case KMachineState_Paused:                 return QApplication::translate("VBoxGlobal", "Paused", "MachineState");
         case KMachineState_Stuck:                  return QApplication::translate("VBoxGlobal", "Guru Meditation", "MachineState");
         case KMachineState_Teleporting:            return QApplication::translate("VBoxGlobal", "Teleporting", "MachineState");
+        case KMachineState_Snapshotting:           return QApplication::translate("VBoxGlobal", "Taking Snapshot", "MachineState");
+        case KMachineState_OnlineSnapshotting:     return QApplication::translate("VBoxGlobal", "Taking Online Snapshot", "MachineState");
         case KMachineState_LiveSnapshotting:       return QApplication::translate("VBoxGlobal", "Taking Live Snapshot", "MachineState");
         case KMachineState_Starting:               return QApplication::translate("VBoxGlobal", "Starting", "MachineState");
         case KMachineState_Stopping:               return QApplication::translate("VBoxGlobal", "Stopping", "MachineState");
@@ -170,6 +184,22 @@ template<> QString toString(const KSessionState &state)
     return QString();
 }
 
+/* QString <= KParavirtProvider: */
+template<> QString toString(const KParavirtProvider &type)
+{
+    switch (type)
+    {
+        case KParavirtProvider_None:    return QApplication::translate("VBoxGlobal", "None", "ParavirtProvider");
+        case KParavirtProvider_Default: return QApplication::translate("VBoxGlobal", "Default", "ParavirtProvider");
+        case KParavirtProvider_Legacy:  return QApplication::translate("VBoxGlobal", "Legacy", "ParavirtProvider");
+        case KParavirtProvider_Minimal: return QApplication::translate("VBoxGlobal", "Minimal", "ParavirtProvider");
+        case KParavirtProvider_HyperV:  return QApplication::translate("VBoxGlobal", "Hyper-V", "ParavirtProvider");
+        case KParavirtProvider_KVM:     return QApplication::translate("VBoxGlobal", "KVM", "ParavirtProvider");
+        default: AssertMsgFailed(("No text for %d", type)); break;
+    }
+    return QString();
+}
+
 /* QString <= KDeviceType: */
 template<> QString toString(const KDeviceType &type)
 {
@@ -177,7 +207,7 @@ template<> QString toString(const KDeviceType &type)
     {
         case KDeviceType_Null:         return QApplication::translate("VBoxGlobal", "None", "DeviceType");
         case KDeviceType_Floppy:       return QApplication::translate("VBoxGlobal", "Floppy", "DeviceType");
-        case KDeviceType_DVD:          return QApplication::translate("VBoxGlobal", "CD/DVD", "DeviceType");
+        case KDeviceType_DVD:          return QApplication::translate("VBoxGlobal", "Optical", "DeviceType");
         case KDeviceType_HardDisk:     return QApplication::translate("VBoxGlobal", "Hard Disk", "DeviceType");
         case KDeviceType_Network:      return QApplication::translate("VBoxGlobal", "Network", "DeviceType");
         case KDeviceType_USB:          return QApplication::translate("VBoxGlobal", "USB", "DeviceType");
@@ -201,15 +231,15 @@ template<> QString toString(const KClipboardMode &mode)
     return QString();
 }
 
-/* QString <= KDragAndDropMode: */
-template<> QString toString(const KDragAndDropMode &mode)
+/* QString <= KDnDMode: */
+template<> QString toString(const KDnDMode &mode)
 {
     switch (mode)
     {
-        case KDragAndDropMode_Disabled:      return QApplication::translate("VBoxGlobal", "Disabled", "DragAndDropType");
-        case KDragAndDropMode_HostToGuest:   return QApplication::translate("VBoxGlobal", "Host To Guest", "DragAndDropType");
-        case KDragAndDropMode_GuestToHost:   return QApplication::translate("VBoxGlobal", "Guest To Host", "DragAndDropType");
-        case KDragAndDropMode_Bidirectional: return QApplication::translate("VBoxGlobal", "Bidirectional", "DragAndDropType");
+        case KDnDMode_Disabled:      return QApplication::translate("VBoxGlobal", "Disabled", "DragAndDropType");
+        case KDnDMode_HostToGuest:   return QApplication::translate("VBoxGlobal", "Host To Guest", "DragAndDropType");
+        case KDnDMode_GuestToHost:   return QApplication::translate("VBoxGlobal", "Guest To Host", "DragAndDropType");
+        case KDnDMode_Bidirectional: return QApplication::translate("VBoxGlobal", "Bidirectional", "DragAndDropType");
         default: AssertMsgFailed(("No text for %d", mode)); break;
     }
     return QString();
@@ -254,6 +284,8 @@ template<> QString toString(const KMediumVariant &variant)
     {
         case KMediumVariant_Standard:
             return QApplication::translate("VBoxGlobal", "Dynamically allocated storage", "MediumVariant");
+        case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_VdiZeroExpand):
+            return QApplication::translate("VBoxGlobal", "New dynamically allocated storage", "MediumVariant");
         case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Diff):
             return QApplication::translate("VBoxGlobal", "Dynamically allocated differencing storage", "MediumVariant");
         case (KMediumVariant)(KMediumVariant_Standard | KMediumVariant_Fixed):
@@ -339,11 +371,25 @@ template<> QString toString(const KPortMode &mode)
         case KPortMode_HostPipe:     return QApplication::translate("VBoxGlobal", "Host Pipe", "PortMode");
         case KPortMode_HostDevice:   return QApplication::translate("VBoxGlobal", "Host Device", "PortMode");
         case KPortMode_RawFile:      return QApplication::translate("VBoxGlobal", "Raw File", "PortMode");
+        case KPortMode_TCP:          return QApplication::translate("VBoxGlobal", "TCP", "PortMode");
         AssertMsgFailed(("No text for %d", mode)); break;
     }
     return QString();
 }
 
+/* QString <= KUSBControllerType: */
+template<> QString toString(const KUSBControllerType &type)
+{
+    switch (type)
+    {
+        case KUSBControllerType_OHCI: return QApplication::translate("VBoxGlobal", "OHCI", "USBControllerType");
+        case KUSBControllerType_EHCI: return QApplication::translate("VBoxGlobal", "EHCI", "USBControllerType");
+        case KUSBControllerType_XHCI: return QApplication::translate("VBoxGlobal", "xHCI", "USBControllerType");
+        AssertMsgFailed(("No text for %d", type)); break;
+    }
+    return QString();
+}
+
 /* QString <= KUSBDeviceState: */
 template<> QString toString(const KUSBDeviceState &state)
 {
@@ -445,6 +491,7 @@ template<> QString toString(const KStorageControllerType &type)
         case KStorageControllerType_ICH6:        return QApplication::translate("VBoxGlobal", "ICH6", "StorageControllerType");
         case KStorageControllerType_I82078:      return QApplication::translate("VBoxGlobal", "I82078", "StorageControllerType");
         case KStorageControllerType_LsiLogicSas: return QApplication::translate("VBoxGlobal", "LsiLogic SAS", "StorageControllerType");
+        case KStorageControllerType_USB:         return QApplication::translate("VBoxGlobal", "USB", "StorageControllerType");
         AssertMsgFailed(("No text for %d", type)); break;
     }
     return QString();
@@ -517,6 +564,7 @@ template<> KPortMode fromString<KPortMode>(const QString &strMode)
     list.insert(QApplication::translate("VBoxGlobal", "Host Pipe", "PortMode"),    KPortMode_HostPipe);
     list.insert(QApplication::translate("VBoxGlobal", "Host Device", "PortMode"),  KPortMode_HostDevice);
     list.insert(QApplication::translate("VBoxGlobal", "Raw File", "PortMode"),     KPortMode_RawFile);
+    list.insert(QApplication::translate("VBoxGlobal", "TCP", "PortMode"),          KPortMode_TCP);
     if (!list.contains(strMode))
     {
         AssertMsgFailed(("No value for '%s'", strMode.toAscii().constData()));
@@ -597,6 +645,7 @@ template<> KStorageControllerType fromString<KStorageControllerType>(const QStri
     list.insert(QApplication::translate("VBoxGlobal", "ICH6", "StorageControllerType"),         KStorageControllerType_ICH6);
     list.insert(QApplication::translate("VBoxGlobal", "I82078", "StorageControllerType"),       KStorageControllerType_I82078);
     list.insert(QApplication::translate("VBoxGlobal", "LsiLogic SAS", "StorageControllerType"), KStorageControllerType_LsiLogicSas);
+    list.insert(QApplication::translate("VBoxGlobal", "USB", "StorageControllerType"),          KStorageControllerType_USB);
     if (!list.contains(strType))
     {
         AssertMsgFailed(("No value for '%s'", strType.toAscii().constData()));
diff --git a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
index e96c3cd..441f9cd 100644
--- a/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIConverterBackendGlobal.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIConverterBackendGlobal implementation
+ * VBox Qt GUI - UIConverterBackendGlobal implementation.
  */
 
 /*
@@ -17,41 +15,57 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QHash>
+# include <QApplication>
+# include <QHash>
 
 /* GUI includes: */
-#include "UIConverterBackend.h"
-#include "VBoxGlobal.h"
+# include "UIConverterBackend.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Determines if <Object of type X> can be converted to object of other type.
  * These functions returns 'true' for all allowed conversions. */
 template<> bool canConvert<SizeSuffix>() { return true; }
 template<> bool canConvert<StorageSlot>() { return true; }
-template<> bool canConvert<RuntimeMenuType>() { return true; }
-#ifdef Q_WS_MAC
-template<> bool canConvert<RuntimeMenuApplicationActionType>() { return true; }
-#endif /* Q_WS_MAC */
-template<> bool canConvert<RuntimeMenuMachineActionType>() { return true; }
-template<> bool canConvert<RuntimeMenuViewActionType>() { return true; }
-template<> bool canConvert<RuntimeMenuDevicesActionType>() { return true; }
+template<> bool canConvert<UIExtraDataMetaDefs::MenuType>() { return true; }
+template<> bool canConvert<UIExtraDataMetaDefs::MenuApplicationActionType>() { return true; }
+template<> bool canConvert<UIExtraDataMetaDefs::MenuHelpActionType>() { return true; }
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>() { return true; }
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuViewActionType>() { return true; }
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuInputActionType>() { return true; }
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>() { return true; }
 #ifdef VBOX_WITH_DEBUGGER_GUI
-template<> bool canConvert<RuntimeMenuDebuggerActionType>() { return true; }
+template<> bool canConvert<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>() { return true; }
 #endif /* VBOX_WITH_DEBUGGER_GUI */
-template<> bool canConvert<RuntimeMenuHelpActionType>() { return true; }
+#ifdef Q_WS_MAC
+template<> bool canConvert<UIExtraDataMetaDefs::MenuWindowActionType>() { return true; }
+#endif /* Q_WS_MAC */
 template<> bool canConvert<UIVisualStateType>() { return true; }
 template<> bool canConvert<DetailsElementType>() { return true; }
+template<> bool canConvert<PreviewUpdateIntervalType>() { return true; }
 template<> bool canConvert<GlobalSettingsPageType>() { return true; }
 template<> bool canConvert<MachineSettingsPageType>() { return true; }
+template<> bool canConvert<WizardType>() { return true; }
 template<> bool canConvert<IndicatorType>() { return true; }
 template<> bool canConvert<MachineCloseAction>() { return true; }
 template<> bool canConvert<MouseCapturePolicy>() { return true; }
 template<> bool canConvert<GuruMeditationHandlerType>() { return true; }
+template<> bool canConvert<ScalingOptimizationType>() { return true; }
 template<> bool canConvert<HiDPIOptimizationType>() { return true; }
+#ifndef Q_WS_MAC
+template<> bool canConvert<MiniToolbarAlignment>() { return true; }
+#endif /* !Q_WS_MAC */
 
 /* QString <= SizeSuffix: */
 template<> QString toString(const SizeSuffix &sizeSuffix)
@@ -185,6 +199,22 @@ template<> QString toString(const StorageSlot &storageSlot)
             strResult = QApplication::translate("VBoxGlobal", "Floppy Device %1", "StorageSlot").arg(storageSlot.device);
             break;
         }
+        case KStorageBus_USB:
+        {
+            int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(storageSlot.bus);
+            if (storageSlot.port < 0 || storageSlot.port > iMaxPort)
+            {
+                AssertMsgFailed(("No text for bus=%d & port=%d", storageSlot.bus, storageSlot.port));
+                break;
+            }
+            if (storageSlot.device != 0)
+            {
+                AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
+                break;
+            }
+            strResult = QApplication::translate("VBoxGlobal", "USB Port %1", "StorageSlot").arg(storageSlot.port);
+            break;
+        }
         default:
         {
             AssertMsgFailed(("No text for bus=%d & port=%d & device=%d", storageSlot.bus, storageSlot.port, storageSlot.device));
@@ -206,6 +236,7 @@ template<> StorageSlot fromString<StorageSlot>(const QString &strStorageSlot)
     list[5] = QApplication::translate("VBoxGlobal", "SCSI Port %1", "StorageSlot");
     list[6] = QApplication::translate("VBoxGlobal", "SAS Port %1", "StorageSlot");
     list[7] = QApplication::translate("VBoxGlobal", "Floppy Device %1", "StorageSlot");
+    list[8] = QApplication::translate("VBoxGlobal", "USB Port %1", "StorageSlot");
     int index = -1;
     QRegExp regExp;
     for (int i = 0; i < list.size(); ++i)
@@ -310,6 +341,22 @@ template<> StorageSlot fromString<StorageSlot>(const QString &strStorageSlot)
             result.device = iDevice;
             break;
         }
+        case 8:
+        {
+            KStorageBus bus = KStorageBus_USB;
+            int iMaxPort = vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(bus);
+            LONG iPort = regExp.cap(1).toInt();
+            LONG iDevice = 0;
+            if (iPort < 0 || iPort > iMaxPort)
+            {
+                AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
+                break;
+            }
+            result.bus = bus;
+            result.port = iPort;
+            result.device = iDevice;
+            break;
+        }
         default:
         {
             AssertMsgFailed(("No storage slot for text='%s'", strStorageSlot.toAscii().constData()));
@@ -319,157 +366,226 @@ template<> StorageSlot fromString<StorageSlot>(const QString &strStorageSlot)
     return result;
 }
 
-/* QString <= RuntimeMenuType: */
-template<> QString toInternalString(const RuntimeMenuType &runtimeMenuType)
+/* QString <= UIExtraDataMetaDefs::MenuType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::MenuType &menuType)
 {
     QString strResult;
-    switch (runtimeMenuType)
+    switch (menuType)
     {
-        case RuntimeMenuType_Machine: strResult = "Machine"; break;
-        case RuntimeMenuType_View:    strResult = "View"; break;
-        case RuntimeMenuType_Devices: strResult = "Devices"; break;
-        case RuntimeMenuType_Debug:   strResult = "Debug"; break;
-        case RuntimeMenuType_Help:    strResult = "Help"; break;
-        case RuntimeMenuType_All:     strResult = "All"; break;
+        case UIExtraDataMetaDefs::MenuType_Application: strResult = "Application"; break;
+        case UIExtraDataMetaDefs::MenuType_Machine:     strResult = "Machine"; break;
+        case UIExtraDataMetaDefs::MenuType_View:        strResult = "View"; break;
+        case UIExtraDataMetaDefs::MenuType_Input:       strResult = "Input"; break;
+        case UIExtraDataMetaDefs::MenuType_Devices:     strResult = "Devices"; break;
+#ifdef VBOX_WITH_DEBUGGER_GUI
+        case UIExtraDataMetaDefs::MenuType_Debug:       strResult = "Debug"; break;
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef RT_OS_DARWIN
+        case UIExtraDataMetaDefs::MenuType_Window:      strResult = "Window"; break;
+#endif /* RT_OS_DARWIN */
+        case UIExtraDataMetaDefs::MenuType_Help:        strResult = "Help"; break;
+        case UIExtraDataMetaDefs::MenuType_All:         strResult = "All"; break;
         default:
         {
-            AssertMsgFailed(("No text for indicator type=%d", runtimeMenuType));
+            AssertMsgFailed(("No text for indicator type=%d", menuType));
             break;
         }
     }
     return strResult;
 }
 
-/* RuntimeMenuType <= QString: */
-template<> RuntimeMenuType fromInternalString<RuntimeMenuType>(const QString &strRuntimeMenuType)
+/* UIExtraDataMetaDefs::MenuType <= QString: */
+template<> UIExtraDataMetaDefs::MenuType fromInternalString<UIExtraDataMetaDefs::MenuType>(const QString &strMenuType)
 {
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
-    QStringList keys;  QList<RuntimeMenuType> values;
-    keys << "Machine"; values << RuntimeMenuType_Machine;
-    keys << "View";    values << RuntimeMenuType_View;
-    keys << "Devices"; values << RuntimeMenuType_Devices;
-    keys << "Debug";   values << RuntimeMenuType_Debug;
-    keys << "Help";    values << RuntimeMenuType_Help;
-    keys << "All";     values << RuntimeMenuType_All;
+    QStringList keys;      QList<UIExtraDataMetaDefs::MenuType> values;
+    keys << "Application"; values << UIExtraDataMetaDefs::MenuType_Application;
+    keys << "Machine";     values << UIExtraDataMetaDefs::MenuType_Machine;
+    keys << "View";        values << UIExtraDataMetaDefs::MenuType_View;
+    keys << "Input";       values << UIExtraDataMetaDefs::MenuType_Input;
+    keys << "Devices";     values << UIExtraDataMetaDefs::MenuType_Devices;
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    keys << "Debug";       values << UIExtraDataMetaDefs::MenuType_Debug;
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef RT_OS_DARWIN
+    keys << "Window";      values << UIExtraDataMetaDefs::MenuType_Window;
+#endif /* RT_OS_DARWIN */
+    keys << "Help";        values << UIExtraDataMetaDefs::MenuType_Help;
+    keys << "All";         values << UIExtraDataMetaDefs::MenuType_All;
     /* Invalid type for unknown words: */
-    if (!keys.contains(strRuntimeMenuType, Qt::CaseInsensitive))
-        return RuntimeMenuType_Invalid;
+    if (!keys.contains(strMenuType, Qt::CaseInsensitive))
+        return UIExtraDataMetaDefs::MenuType_Invalid;
     /* Corresponding type for known words: */
-    return values.at(keys.indexOf(QRegExp(strRuntimeMenuType, Qt::CaseInsensitive)));
+    return values.at(keys.indexOf(QRegExp(strMenuType, Qt::CaseInsensitive)));
 }
 
-#ifdef Q_WS_MAC
-/* QString <= RuntimeMenuApplicationActionType: */
-template<> QString toInternalString(const RuntimeMenuApplicationActionType &runtimeMenuApplicationActionType)
+/* QString <= UIExtraDataMetaDefs::MenuApplicationActionType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::MenuApplicationActionType &menuApplicationActionType)
 {
     QString strResult;
-    switch (runtimeMenuApplicationActionType)
+    switch (menuApplicationActionType)
     {
-        case RuntimeMenuApplicationActionType_About: strResult = "About"; break;
-        case RuntimeMenuApplicationActionType_All:   strResult = "All"; break;
+#ifdef Q_WS_MAC
+        case UIExtraDataMetaDefs::MenuApplicationActionType_About:                strResult = "About"; break;
+#endif /* Q_WS_MAC */
+        case UIExtraDataMetaDefs::MenuApplicationActionType_Preferences:          strResult = "Preferences"; break;
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+        case UIExtraDataMetaDefs::MenuApplicationActionType_NetworkAccessManager: strResult = "NetworkAccessManager"; break;
+        case UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates:      strResult = "CheckForUpdates"; break;
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+        case UIExtraDataMetaDefs::MenuApplicationActionType_ResetWarnings:        strResult = "ResetWarnings"; break;
+        case UIExtraDataMetaDefs::MenuApplicationActionType_Close:                strResult = "Close"; break;
+        case UIExtraDataMetaDefs::MenuApplicationActionType_All:                  strResult = "All"; break;
         default:
         {
-            AssertMsgFailed(("No text for action type=%d", runtimeMenuApplicationActionType));
+            AssertMsgFailed(("No text for action type=%d", menuApplicationActionType));
             break;
         }
     }
     return strResult;
 }
 
-/* RuntimeMenuApplicationActionType <= QString: */
-template<> RuntimeMenuApplicationActionType fromInternalString<RuntimeMenuApplicationActionType>(const QString &strRuntimeMenuApplicationActionType)
+/* UIExtraDataMetaDefs::MenuApplicationActionType <= QString: */
+template<> UIExtraDataMetaDefs::MenuApplicationActionType fromInternalString<UIExtraDataMetaDefs::MenuApplicationActionType>(const QString &strMenuApplicationActionType)
 {
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
-    QStringList keys; QList<RuntimeMenuApplicationActionType> values;
-    keys << "About";  values << RuntimeMenuApplicationActionType_About;
-    keys << "All";    values << RuntimeMenuApplicationActionType_All;
+    QStringList keys;               QList<UIExtraDataMetaDefs::MenuApplicationActionType> values;
+#ifdef Q_WS_MAC
+    keys << "About";                values << UIExtraDataMetaDefs::MenuApplicationActionType_About;
+#endif /* Q_WS_MAC */
+    keys << "Preferences";          values << UIExtraDataMetaDefs::MenuApplicationActionType_Preferences;
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    keys << "NetworkAccessManager"; values << UIExtraDataMetaDefs::MenuApplicationActionType_NetworkAccessManager;
+    keys << "CheckForUpdates";      values << UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates;
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+    keys << "ResetWarnings";        values << UIExtraDataMetaDefs::MenuApplicationActionType_ResetWarnings;
+    keys << "Close";                values << UIExtraDataMetaDefs::MenuApplicationActionType_Close;
+    keys << "All";                  values << UIExtraDataMetaDefs::MenuApplicationActionType_All;
     /* Invalid type for unknown words: */
-    if (!keys.contains(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive))
-        return RuntimeMenuApplicationActionType_Invalid;
+    if (!keys.contains(strMenuApplicationActionType, Qt::CaseInsensitive))
+        return UIExtraDataMetaDefs::MenuApplicationActionType_Invalid;
     /* Corresponding type for known words: */
-    return values.at(keys.indexOf(QRegExp(strRuntimeMenuApplicationActionType, Qt::CaseInsensitive)));
+    return values.at(keys.indexOf(QRegExp(strMenuApplicationActionType, Qt::CaseInsensitive)));
 }
-#endif /* Q_WS_MAC */
 
-/* QString <= RuntimeMenuMachineActionType: */
-template<> QString toInternalString(const RuntimeMenuMachineActionType &runtimeMenuMachineActionType)
+/* QString <= UIExtraDataMetaDefs::MenuHelpActionType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::MenuHelpActionType &menuHelpActionType)
 {
     QString strResult;
-    switch (runtimeMenuMachineActionType)
+    switch (menuHelpActionType)
     {
-        case RuntimeMenuMachineActionType_SettingsDialog:    strResult = "SettingsDialog"; break;
-        case RuntimeMenuMachineActionType_TakeSnapshot:      strResult = "TakeSnapshot"; break;
-        case RuntimeMenuMachineActionType_TakeScreenshot:    strResult = "TakeScreenshot"; break;
-        case RuntimeMenuMachineActionType_InformationDialog: strResult = "InformationDialog"; break;
-        case RuntimeMenuMachineActionType_MouseIntegration:  strResult = "MouseIntegration"; break;
-        case RuntimeMenuMachineActionType_TypeCAD:           strResult = "TypeCAD"; break;
-#ifdef Q_WS_X11
-        case RuntimeMenuMachineActionType_TypeCABS:          strResult = "TypeCABS"; break;
-#endif /* Q_WS_X11 */
-        case RuntimeMenuMachineActionType_Pause:             strResult = "Pause"; break;
-        case RuntimeMenuMachineActionType_Reset:             strResult = "Reset"; break;
-        case RuntimeMenuMachineActionType_SaveState:         strResult = "SaveState"; break;
-        case RuntimeMenuMachineActionType_Shutdown:          strResult = "Shutdown"; break;
-        case RuntimeMenuMachineActionType_PowerOff:          strResult = "PowerOff"; break;
+        case UIExtraDataMetaDefs::MenuHelpActionType_Contents:             strResult = "Contents"; break;
+        case UIExtraDataMetaDefs::MenuHelpActionType_WebSite:              strResult = "WebSite"; break;
 #ifndef Q_WS_MAC
-        case RuntimeMenuMachineActionType_Close:             strResult = "Close"; break;
+        case UIExtraDataMetaDefs::MenuHelpActionType_About:                strResult = "About"; break;
 #endif /* !Q_WS_MAC */
-        case RuntimeMenuMachineActionType_All:               strResult = "All"; break;
+        case UIExtraDataMetaDefs::MenuHelpActionType_All:                  strResult = "All"; break;
         default:
         {
-            AssertMsgFailed(("No text for action type=%d", runtimeMenuMachineActionType));
+            AssertMsgFailed(("No text for action type=%d", menuHelpActionType));
             break;
         }
     }
     return strResult;
 }
 
-/* RuntimeMenuMachineActionType <= QString: */
-template<> RuntimeMenuMachineActionType fromInternalString<RuntimeMenuMachineActionType>(const QString &strRuntimeMenuMachineActionType)
+/* UIExtraDataMetaDefs::MenuHelpActionType <= QString: */
+template<> UIExtraDataMetaDefs::MenuHelpActionType fromInternalString<UIExtraDataMetaDefs::MenuHelpActionType>(const QString &strMenuHelpActionType)
 {
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
-    QStringList keys;            QList<RuntimeMenuMachineActionType> values;
-    keys << "SettingsDialog";    values << RuntimeMenuMachineActionType_SettingsDialog;
-    keys << "TakeSnapshot";      values << RuntimeMenuMachineActionType_TakeSnapshot;
-    keys << "TakeScreenshot";    values << RuntimeMenuMachineActionType_TakeScreenshot;
-    keys << "InformationDialog"; values << RuntimeMenuMachineActionType_InformationDialog;
-    keys << "MouseIntegration";  values << RuntimeMenuMachineActionType_MouseIntegration;
-    keys << "TypeCAD";           values << RuntimeMenuMachineActionType_TypeCAD;
-#ifdef Q_WS_X11
-    keys << "TypeCABS";          values << RuntimeMenuMachineActionType_TypeCABS;
-#endif /* Q_WS_X11 */
-    keys << "Pause";             values << RuntimeMenuMachineActionType_Pause;
-    keys << "Reset";             values << RuntimeMenuMachineActionType_Reset;
-    keys << "SaveState";         values << RuntimeMenuMachineActionType_SaveState;
-    keys << "Shutdown";          values << RuntimeMenuMachineActionType_Shutdown;
-    keys << "PowerOff";          values << RuntimeMenuMachineActionType_PowerOff;
+    QStringList keys;               QList<UIExtraDataMetaDefs::MenuHelpActionType> values;
+    keys << "Contents";             values << UIExtraDataMetaDefs::MenuHelpActionType_Contents;
+    keys << "WebSite";              values << UIExtraDataMetaDefs::MenuHelpActionType_WebSite;
 #ifndef Q_WS_MAC
-    keys << "Close";             values << RuntimeMenuMachineActionType_Close;
+    keys << "About";                values << UIExtraDataMetaDefs::MenuHelpActionType_About;
 #endif /* !Q_WS_MAC */
-    keys << "All";               values << RuntimeMenuMachineActionType_All;
+    keys << "All";                  values << UIExtraDataMetaDefs::MenuHelpActionType_All;
+    /* Invalid type for unknown words: */
+    if (!keys.contains(strMenuHelpActionType, Qt::CaseInsensitive))
+        return UIExtraDataMetaDefs::MenuHelpActionType_Invalid;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strMenuHelpActionType, Qt::CaseInsensitive)));
+}
+
+/* QString <= UIExtraDataMetaDefs::RuntimeMenuMachineActionType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuMachineActionType &runtimeMenuMachineActionType)
+{
+    QString strResult;
+    switch (runtimeMenuMachineActionType)
+    {
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog:    strResult = "SettingsDialog"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot:      strResult = "TakeSnapshot"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog: strResult = "InformationDialog"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause:             strResult = "Pause"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset:             strResult = "Reset"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState:         strResult = "SaveState"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown:          strResult = "Shutdown"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff:          strResult = "PowerOff"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Nothing:           strResult = "Nothing"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuMachineActionType_All:               strResult = "All"; break;
+        default:
+        {
+            AssertMsgFailed(("No text for action type=%d", runtimeMenuMachineActionType));
+            break;
+        }
+    }
+    return strResult;
+}
+
+/* UIExtraDataMetaDefs::RuntimeMenuMachineActionType <= QString: */
+template<> UIExtraDataMetaDefs::RuntimeMenuMachineActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(const QString &strRuntimeMenuMachineActionType)
+{
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;            QList<UIExtraDataMetaDefs::RuntimeMenuMachineActionType> values;
+    keys << "SettingsDialog";    values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog;
+    keys << "TakeSnapshot";      values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot;
+    keys << "InformationDialog"; values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog;
+    keys << "Pause";             values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause;
+    keys << "Reset";             values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset;
+    keys << "SaveState";         values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState;
+    keys << "Shutdown";          values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown;
+    keys << "PowerOff";          values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff;
+    keys << "Nothing";           values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Nothing;
+    keys << "All";               values << UIExtraDataMetaDefs::RuntimeMenuMachineActionType_All;
     /* Invalid type for unknown words: */
     if (!keys.contains(strRuntimeMenuMachineActionType, Qt::CaseInsensitive))
-        return RuntimeMenuMachineActionType_Invalid;
+        return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid;
     /* Corresponding type for known words: */
     return values.at(keys.indexOf(QRegExp(strRuntimeMenuMachineActionType, Qt::CaseInsensitive)));
 }
 
-/* QString <= RuntimeMenuViewActionType: */
-template<> QString toInternalString(const RuntimeMenuViewActionType &runtimeMenuViewActionType)
+/* QString <= UIExtraDataMetaDefs::RuntimeMenuViewActionType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuViewActionType &runtimeMenuViewActionType)
 {
     QString strResult;
     switch (runtimeMenuViewActionType)
     {
-        case RuntimeMenuViewActionType_Fullscreen:      strResult = "Fullscreen"; break;
-        case RuntimeMenuViewActionType_Seamless:        strResult = "Seamless"; break;
-        case RuntimeMenuViewActionType_Scale:           strResult = "Scale"; break;
-        case RuntimeMenuViewActionType_GuestAutoresize: strResult = "GuestAutoresize"; break;
-        case RuntimeMenuViewActionType_AdjustWindow:    strResult = "AdjustWindow"; break;
-        case RuntimeMenuViewActionType_Multiscreen:     strResult = "Multiscreen"; break;
-        case RuntimeMenuViewActionType_All:             strResult = "All"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen:           strResult = "Fullscreen"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless:             strResult = "Seamless"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale:                strResult = "Scale"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize:      strResult = "GuestAutoresize"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow:         strResult = "AdjustWindow"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot:       strResult = "TakeScreenshot"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCapture:         strResult = "VideoCapture"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings: strResult = "VideoCaptureSettings"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture:    strResult = "StartVideoCapture"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer:           strResult = "VRDEServer"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar:              strResult = "MenuBar"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings:      strResult = "MenuBarSettings"; break;
+#ifndef Q_WS_MAC
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar:        strResult = "ToggleMenuBar"; break;
+#endif /* !Q_WS_MAC */
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar:            strResult = "StatusBar"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings:    strResult = "StatusBarSettings"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar:      strResult = "ToggleStatusBar"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor:          strResult = "ScaleFactor"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize:               strResult = "Resize"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen:          strResult = "Multiscreen"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuViewActionType_All:                  strResult = "All"; break;
         default:
         {
             AssertMsgFailed(("No text for action type=%d", runtimeMenuViewActionType));
@@ -479,44 +595,113 @@ template<> QString toInternalString(const RuntimeMenuViewActionType &runtimeMenu
     return strResult;
 }
 
-/* RuntimeMenuViewActionType <= QString: */
-template<> RuntimeMenuViewActionType fromInternalString<RuntimeMenuViewActionType>(const QString &strRuntimeMenuViewActionType)
+/* UIExtraDataMetaDefs::RuntimeMenuViewActionType <= QString: */
+template<> UIExtraDataMetaDefs::RuntimeMenuViewActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(const QString &strRuntimeMenuViewActionType)
 {
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
-    QStringList keys;          QList<RuntimeMenuViewActionType> values;
-    keys << "Fullscreen";      values << RuntimeMenuViewActionType_Fullscreen;
-    keys << "Seamless";        values << RuntimeMenuViewActionType_Seamless;
-    keys << "Scale";           values << RuntimeMenuViewActionType_Scale;
-    keys << "GuestAutoresize"; values << RuntimeMenuViewActionType_GuestAutoresize;
-    keys << "AdjustWindow";    values << RuntimeMenuViewActionType_AdjustWindow;
-    keys << "Multiscreen";     values << RuntimeMenuViewActionType_Multiscreen;
-    keys << "All";             values << RuntimeMenuViewActionType_All;
+    QStringList keys;               QList<UIExtraDataMetaDefs::RuntimeMenuViewActionType> values;
+    keys << "Fullscreen";           values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen;
+    keys << "Seamless";             values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless;
+    keys << "Scale";                values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale;
+    keys << "GuestAutoresize";      values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize;
+    keys << "AdjustWindow";         values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow;
+    keys << "TakeScreenshot";       values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot;
+    keys << "VideoCapture";         values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCapture;
+    keys << "VideoCaptureSettings"; values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings;
+    keys << "StartVideoCapture";    values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture;
+    keys << "VRDEServer";           values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer;
+    keys << "MenuBar";              values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar;
+    keys << "MenuBarSettings";      values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings;
+#ifndef Q_WS_MAC
+    keys << "ToggleMenuBar";        values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar;
+#endif /* !Q_WS_MAC */
+    keys << "StatusBar";            values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar;
+    keys << "StatusBarSettings";    values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings;
+    keys << "ToggleStatusBar";      values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar;
+    keys << "ScaleFactor";          values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor;
+    keys << "Resize";               values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize;
+    keys << "Multiscreen";          values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen;
+    keys << "All";                  values << UIExtraDataMetaDefs::RuntimeMenuViewActionType_All;
     /* Invalid type for unknown words: */
     if (!keys.contains(strRuntimeMenuViewActionType, Qt::CaseInsensitive))
-        return RuntimeMenuViewActionType_Invalid;
+        return UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid;
     /* Corresponding type for known words: */
     return values.at(keys.indexOf(QRegExp(strRuntimeMenuViewActionType, Qt::CaseInsensitive)));
 }
 
-/* QString <= RuntimeMenuDevicesActionType: */
-template<> QString toInternalString(const RuntimeMenuDevicesActionType &runtimeMenuDevicesActionType)
+/* QString <= UIExtraDataMetaDefs::RuntimeMenuInputActionType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuInputActionType &runtimeMenuInputActionType)
+{
+    QString strResult;
+    switch (runtimeMenuInputActionType)
+    {
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard:          strResult = "Keyboard"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings:  strResult = "KeyboardSettings"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD:           strResult = "TypeCAD"; break;
+#ifdef Q_WS_X11
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS:          strResult = "TypeCABS"; break;
+#endif /* Q_WS_X11 */
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak:     strResult = "TypeCtrlBreak"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert:        strResult = "TypeInsert"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse:             strResult = "Mouse"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration:  strResult = "MouseIntegration"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuInputActionType_All:               strResult = "All"; break;
+        default:
+        {
+            AssertMsgFailed(("No text for action type=%d", runtimeMenuInputActionType));
+            break;
+        }
+    }
+    return strResult;
+}
+
+/* UIExtraDataMetaDefs::RuntimeMenuInputActionType <= QString: */
+template<> UIExtraDataMetaDefs::RuntimeMenuInputActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuInputActionType>(const QString &strRuntimeMenuInputActionType)
+{
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;            QList<UIExtraDataMetaDefs::RuntimeMenuInputActionType> values;
+    keys << "Keyboard";          values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard;
+    keys << "KeyboardSettings";  values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings;
+    keys << "TypeCAD";           values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD;
+#ifdef Q_WS_X11
+    keys << "TypeCABS";          values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS;
+#endif /* Q_WS_X11 */
+    keys << "TypeCtrlBreak";     values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak;
+    keys << "TypeInsert";        values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert;
+    keys << "Mouse";             values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse;
+    keys << "MouseIntegration";  values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration;
+    keys << "All";               values << UIExtraDataMetaDefs::RuntimeMenuInputActionType_All;
+    /* Invalid type for unknown words: */
+    if (!keys.contains(strRuntimeMenuInputActionType, Qt::CaseInsensitive))
+        return UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strRuntimeMenuInputActionType, Qt::CaseInsensitive)));
+}
+
+/* QString <= UIExtraDataMetaDefs::RuntimeMenuDevicesActionType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType &runtimeMenuDevicesActionType)
 {
     QString strResult;
     switch (runtimeMenuDevicesActionType)
     {
-        case RuntimeMenuDevicesActionType_OpticalDevices:        strResult = "OpticalDevices"; break;
-        case RuntimeMenuDevicesActionType_FloppyDevices:         strResult = "FloppyDevices"; break;
-        case RuntimeMenuDevicesActionType_USBDevices:            strResult = "USBDevices"; break;
-        case RuntimeMenuDevicesActionType_WebCams:               strResult = "WebCams"; break;
-        case RuntimeMenuDevicesActionType_SharedClipboard:       strResult = "SharedClipboard"; break;
-        case RuntimeMenuDevicesActionType_DragAndDrop:           strResult = "DragAndDrop"; break;
-        case RuntimeMenuDevicesActionType_NetworkSettings:       strResult = "NetworkSettings"; break;
-        case RuntimeMenuDevicesActionType_SharedFoldersSettings: strResult = "SharedFoldersSettings"; break;
-        case RuntimeMenuDevicesActionType_VRDEServer:            strResult = "VRDEServer"; break;
-        case RuntimeMenuDevicesActionType_VideoCapture:          strResult = "VideoCapture"; break;
-        case RuntimeMenuDevicesActionType_InstallGuestTools:     strResult = "InstallGuestTools"; break;
-        case RuntimeMenuDevicesActionType_All:                   strResult = "All"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives:            strResult = "HardDrives"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings:    strResult = "HardDrivesSettings"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices:        strResult = "OpticalDevices"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices:         strResult = "FloppyDevices"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network:               strResult = "Network"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings:       strResult = "NetworkSettings"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices:            strResult = "USBDevices"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings:    strResult = "USBDevicesSettings"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams:               strResult = "WebCams"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard:       strResult = "SharedClipboard"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop:           strResult = "DragAndDrop"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders:         strResult = "SharedFolders"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings: strResult = "SharedFoldersSettings"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools:     strResult = "InstallGuestTools"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing:               strResult = "Nothing"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_All:                   strResult = "All"; break;
         default:
         {
             AssertMsgFailed(("No text for action type=%d", runtimeMenuDevicesActionType));
@@ -526,43 +711,47 @@ template<> QString toInternalString(const RuntimeMenuDevicesActionType &runtimeM
     return strResult;
 }
 
-/* RuntimeMenuDevicesActionType <= QString: */
-template<> RuntimeMenuDevicesActionType fromInternalString<RuntimeMenuDevicesActionType>(const QString &strRuntimeMenuDevicesActionType)
+/* UIExtraDataMetaDefs::RuntimeMenuDevicesActionType <= QString: */
+template<> UIExtraDataMetaDefs::RuntimeMenuDevicesActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(const QString &strRuntimeMenuDevicesActionType)
 {
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
-    QStringList keys;                QList<RuntimeMenuDevicesActionType> values;
-    keys << "OpticalDevices";        values << RuntimeMenuDevicesActionType_OpticalDevices;
-    keys << "FloppyDevices";         values << RuntimeMenuDevicesActionType_FloppyDevices;
-    keys << "USBDevices";            values << RuntimeMenuDevicesActionType_USBDevices;
-    keys << "WebCams";               values << RuntimeMenuDevicesActionType_WebCams;
-    keys << "SharedClipboard";       values << RuntimeMenuDevicesActionType_SharedClipboard;
-    keys << "DragAndDrop";           values << RuntimeMenuDevicesActionType_DragAndDrop;
-    keys << "NetworkSettings";       values << RuntimeMenuDevicesActionType_NetworkSettings;
-    keys << "SharedFoldersSettings"; values << RuntimeMenuDevicesActionType_SharedFoldersSettings;
-    keys << "VRDEServer";            values << RuntimeMenuDevicesActionType_VRDEServer;
-    keys << "VideoCapture";          values << RuntimeMenuDevicesActionType_VideoCapture;
-    keys << "InstallGuestTools";     values << RuntimeMenuDevicesActionType_InstallGuestTools;
-    keys << "All";                   values << RuntimeMenuDevicesActionType_All;
+    QStringList keys;                QList<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType> values;
+    keys << "HardDrives";            values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives;
+    keys << "HardDrivesSettings";    values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings;
+    keys << "OpticalDevices";        values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices;
+    keys << "FloppyDevices";         values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices;
+    keys << "Network";               values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network;
+    keys << "NetworkSettings";       values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings;
+    keys << "USBDevices";            values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices;
+    keys << "USBDevicesSettings";    values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings;
+    keys << "WebCams";               values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams;
+    keys << "SharedClipboard";       values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard;
+    keys << "DragAndDrop";           values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop;
+    keys << "SharedFolders";         values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders;
+    keys << "SharedFoldersSettings"; values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings;
+    keys << "InstallGuestTools";     values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools;
+    keys << "Nothing";               values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing;
+    keys << "All";                   values << UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_All;
     /* Invalid type for unknown words: */
     if (!keys.contains(strRuntimeMenuDevicesActionType, Qt::CaseInsensitive))
-        return RuntimeMenuDevicesActionType_Invalid;
+        return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid;
     /* Corresponding type for known words: */
     return values.at(keys.indexOf(QRegExp(strRuntimeMenuDevicesActionType, Qt::CaseInsensitive)));
 }
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
-/* QString <= RuntimeMenuDebuggerActionType: */
-template<> QString toInternalString(const RuntimeMenuDebuggerActionType &runtimeMenuDebuggerActionType)
+/* QString <= UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType &runtimeMenuDebuggerActionType)
 {
     QString strResult;
     switch (runtimeMenuDebuggerActionType)
     {
-        case RuntimeMenuDebuggerActionType_Statistics:  strResult = "Statistics"; break;
-        case RuntimeMenuDebuggerActionType_CommandLine: strResult = "CommandLine"; break;
-        case RuntimeMenuDebuggerActionType_Logging:     strResult = "Logging"; break;
-        case RuntimeMenuDebuggerActionType_LogDialog:   strResult = "LogDialog"; break;
-        case RuntimeMenuDebuggerActionType_All:         strResult = "All"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics:  strResult = "Statistics"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine: strResult = "CommandLine"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging:     strResult = "Logging"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog:   strResult = "LogDialog"; break;
+        case UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All:         strResult = "All"; break;
         default:
         {
             AssertMsgFailed(("No text for action type=%d", runtimeMenuDebuggerActionType));
@@ -572,72 +761,60 @@ template<> QString toInternalString(const RuntimeMenuDebuggerActionType &runtime
     return strResult;
 }
 
-/* RuntimeMenuDebuggerActionType <= QString: */
-template<> RuntimeMenuDebuggerActionType fromInternalString<RuntimeMenuDebuggerActionType>(const QString &strRuntimeMenuDebuggerActionType)
+/* UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType <= QString: */
+template<> UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType fromInternalString<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(const QString &strRuntimeMenuDebuggerActionType)
 {
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
-    QStringList keys;      QList<RuntimeMenuDebuggerActionType> values;
-    keys << "Statistics";  values << RuntimeMenuDebuggerActionType_Statistics;
-    keys << "CommandLine"; values << RuntimeMenuDebuggerActionType_CommandLine;
-    keys << "Logging";     values << RuntimeMenuDebuggerActionType_Logging;
-    keys << "LogDialog";   values << RuntimeMenuDebuggerActionType_LogDialog;
-    keys << "All";         values << RuntimeMenuDebuggerActionType_All;
+    QStringList keys;      QList<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType> values;
+    keys << "Statistics";  values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics;
+    keys << "CommandLine"; values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine;
+    keys << "Logging";     values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging;
+    keys << "LogDialog";   values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog;
+    keys << "All";         values << UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All;
     /* Invalid type for unknown words: */
     if (!keys.contains(strRuntimeMenuDebuggerActionType, Qt::CaseInsensitive))
-        return RuntimeMenuDebuggerActionType_Invalid;
+        return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid;
     /* Corresponding type for known words: */
     return values.at(keys.indexOf(QRegExp(strRuntimeMenuDebuggerActionType, Qt::CaseInsensitive)));
 }
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
-/* QString <= RuntimeMenuHelpActionType: */
-template<> QString toInternalString(const RuntimeMenuHelpActionType &runtimeMenuHelpActionType)
+#ifdef Q_WS_MAC
+/* QString <= UIExtraDataMetaDefs::MenuWindowActionType: */
+template<> QString toInternalString(const UIExtraDataMetaDefs::MenuWindowActionType &menuWindowActionType)
 {
     QString strResult;
-    switch (runtimeMenuHelpActionType)
+    switch (menuWindowActionType)
     {
-        case RuntimeMenuHelpActionType_Contents:             strResult = "Contents"; break;
-        case RuntimeMenuHelpActionType_WebSite:              strResult = "WebSite"; break;
-        case RuntimeMenuHelpActionType_ResetWarnings:        strResult = "ResetWarnings"; break;
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-        case RuntimeMenuHelpActionType_NetworkAccessManager: strResult = "NetworkAccessManager"; break;
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#ifndef Q_WS_MAC
-        case RuntimeMenuHelpActionType_About:                strResult = "About"; break;
-#endif /* !Q_WS_MAC */
-        case RuntimeMenuHelpActionType_All:                  strResult = "All"; break;
+        case UIExtraDataMetaDefs::MenuWindowActionType_Minimize: strResult = "Minimize"; break;
+        case UIExtraDataMetaDefs::MenuWindowActionType_Switch:   strResult = "Switch"; break;
+        case UIExtraDataMetaDefs::MenuWindowActionType_All:      strResult = "All"; break;
         default:
         {
-            AssertMsgFailed(("No text for action type=%d", runtimeMenuHelpActionType));
+            AssertMsgFailed(("No text for action type=%d", menuWindowActionType));
             break;
         }
     }
     return strResult;
 }
 
-/* RuntimeMenuHelpActionType <= QString: */
-template<> RuntimeMenuHelpActionType fromInternalString<RuntimeMenuHelpActionType>(const QString &strRuntimeMenuHelpActionType)
+/* UIExtraDataMetaDefs::MenuWindowActionType <= QString: */
+template<> UIExtraDataMetaDefs::MenuWindowActionType fromInternalString<UIExtraDataMetaDefs::MenuWindowActionType>(const QString &strMenuWindowActionType)
 {
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
-    QStringList keys;               QList<RuntimeMenuHelpActionType> values;
-    keys << "Contents";             values << RuntimeMenuHelpActionType_Contents;
-    keys << "WebSite";              values << RuntimeMenuHelpActionType_WebSite;
-    keys << "ResetWarnings";        values << RuntimeMenuHelpActionType_ResetWarnings;
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    keys << "NetworkAccessManager"; values << RuntimeMenuHelpActionType_NetworkAccessManager;
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#ifndef Q_WS_MAC
-    keys << "About";                values << RuntimeMenuHelpActionType_About;
-#endif /* !Q_WS_MAC */
-    keys << "All";                  values << RuntimeMenuHelpActionType_All;
+    QStringList keys;   QList<UIExtraDataMetaDefs::MenuWindowActionType> values;
+    keys << "Minimize"; values << UIExtraDataMetaDefs::MenuWindowActionType_Minimize;
+    keys << "Switch";   values << UIExtraDataMetaDefs::MenuWindowActionType_Switch;
+    keys << "All";      values << UIExtraDataMetaDefs::MenuWindowActionType_All;
     /* Invalid type for unknown words: */
-    if (!keys.contains(strRuntimeMenuHelpActionType, Qt::CaseInsensitive))
-        return RuntimeMenuHelpActionType_Invalid;
+    if (!keys.contains(strMenuWindowActionType, Qt::CaseInsensitive))
+        return UIExtraDataMetaDefs::MenuWindowActionType_Invalid;
     /* Corresponding type for known words: */
-    return values.at(keys.indexOf(QRegExp(strRuntimeMenuHelpActionType, Qt::CaseInsensitive)));
+    return values.at(keys.indexOf(QRegExp(strMenuWindowActionType, Qt::CaseInsensitive)));
 }
+#endif /* Q_WS_MAC */
 
 /* QString <= UIVisualStateType: */
 template<> QString toInternalString(const UIVisualStateType &visualStateType)
@@ -696,6 +873,7 @@ template<> QString toString(const DetailsElementType &detailsElementType)
 #endif /* VBOX_WITH_PARALLEL_PORTS */
         case DetailsElementType_USB:         strResult = QApplication::translate("VBoxGlobal", "USB", "DetailsElementType"); break;
         case DetailsElementType_SF:          strResult = QApplication::translate("VBoxGlobal", "Shared folders", "DetailsElementType"); break;
+        case DetailsElementType_UI:          strResult = QApplication::translate("VBoxGlobal", "User interface", "DetailsElementType"); break;
         case DetailsElementType_Description: strResult = QApplication::translate("VBoxGlobal", "Description", "DetailsElementType"); break;
         default:
         {
@@ -709,26 +887,29 @@ template<> QString toString(const DetailsElementType &detailsElementType)
 /* DetailsElementType <= QString: */
 template<> DetailsElementType fromString<DetailsElementType>(const QString &strDetailsElementType)
 {
-    QHash<QString, DetailsElementType> list;
-    list.insert(QApplication::translate("VBoxGlobal", "General", "DetailsElementType"),        DetailsElementType_General);
-    list.insert(QApplication::translate("VBoxGlobal", "Preview", "DetailsElementType"),        DetailsElementType_Preview);
-    list.insert(QApplication::translate("VBoxGlobal", "System", "DetailsElementType"),         DetailsElementType_System);
-    list.insert(QApplication::translate("VBoxGlobal", "Display", "DetailsElementType"),        DetailsElementType_Display);
-    list.insert(QApplication::translate("VBoxGlobal", "Storage", "DetailsElementType"),        DetailsElementType_Storage);
-    list.insert(QApplication::translate("VBoxGlobal", "Audio", "DetailsElementType"),          DetailsElementType_Audio);
-    list.insert(QApplication::translate("VBoxGlobal", "Network", "DetailsElementType"),        DetailsElementType_Network);
-    list.insert(QApplication::translate("VBoxGlobal", "Serial ports", "DetailsElementType"),   DetailsElementType_Serial);
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;                                                                      QList<DetailsElementType> values;
+    keys << QApplication::translate("VBoxGlobal", "General", "DetailsElementType");        values << DetailsElementType_General;
+    keys << QApplication::translate("VBoxGlobal", "Preview", "DetailsElementType");        values << DetailsElementType_Preview;
+    keys << QApplication::translate("VBoxGlobal", "System", "DetailsElementType");         values << DetailsElementType_System;
+    keys << QApplication::translate("VBoxGlobal", "Display", "DetailsElementType");        values << DetailsElementType_Display;
+    keys << QApplication::translate("VBoxGlobal", "Storage", "DetailsElementType");        values << DetailsElementType_Storage;
+    keys << QApplication::translate("VBoxGlobal", "Audio", "DetailsElementType");          values << DetailsElementType_Audio;
+    keys << QApplication::translate("VBoxGlobal", "Network", "DetailsElementType");        values << DetailsElementType_Network;
+    keys << QApplication::translate("VBoxGlobal", "Serial ports", "DetailsElementType");   values << DetailsElementType_Serial;
 #ifdef VBOX_WITH_PARALLEL_PORTS
-    list.insert(QApplication::translate("VBoxGlobal", "Parallel ports", "DetailsElementType"), DetailsElementType_Parallel);
+    keys << QApplication::translate("VBoxGlobal", "Parallel ports", "DetailsElementType"); values << DetailsElementType_Parallel;
 #endif /* VBOX_WITH_PARALLEL_PORTS */
-    list.insert(QApplication::translate("VBoxGlobal", "USB", "DetailsElementType"),            DetailsElementType_USB);
-    list.insert(QApplication::translate("VBoxGlobal", "Shared folders", "DetailsElementType"), DetailsElementType_SF);
-    list.insert(QApplication::translate("VBoxGlobal", "Description", "DetailsElementType"),    DetailsElementType_Description);
-    if (!list.contains(strDetailsElementType))
-    {
-        AssertMsgFailed(("No value for '%s'", strDetailsElementType.toAscii().constData()));
-    }
-    return list.value(strDetailsElementType);
+    keys << QApplication::translate("VBoxGlobal", "USB", "DetailsElementType");            values << DetailsElementType_USB;
+    keys << QApplication::translate("VBoxGlobal", "Shared folders", "DetailsElementType"); values << DetailsElementType_SF;
+    keys << QApplication::translate("VBoxGlobal", "User interface", "DetailsElementType"); values << DetailsElementType_UI;
+    keys << QApplication::translate("VBoxGlobal", "Description", "DetailsElementType");    values << DetailsElementType_Description;
+    /* Invalid type for unknown words: */
+    if (!keys.contains(strDetailsElementType, Qt::CaseInsensitive))
+        return DetailsElementType_Invalid;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strDetailsElementType, Qt::CaseInsensitive)));
 }
 
 /* QString <= DetailsElementType: */
@@ -750,6 +931,7 @@ template<> QString toInternalString(const DetailsElementType &detailsElementType
 #endif /* VBOX_WITH_PARALLEL_PORTS */
         case DetailsElementType_USB:         strResult = "usb"; break;
         case DetailsElementType_SF:          strResult = "sharedFolders"; break;
+        case DetailsElementType_UI:          strResult = "userInterface"; break;
         case DetailsElementType_Description: strResult = "description"; break;
         default:
         {
@@ -763,26 +945,102 @@ template<> QString toInternalString(const DetailsElementType &detailsElementType
 /* DetailsElementType <= QString: */
 template<> DetailsElementType fromInternalString<DetailsElementType>(const QString &strDetailsElementType)
 {
-    QHash<QString, DetailsElementType> list;
-    list.insert("general",       DetailsElementType_General);
-    list.insert("preview",       DetailsElementType_Preview);
-    list.insert("system",        DetailsElementType_System);
-    list.insert("display",       DetailsElementType_Display);
-    list.insert("storage",       DetailsElementType_Storage);
-    list.insert("audio",         DetailsElementType_Audio);
-    list.insert("network",       DetailsElementType_Network);
-    list.insert("serialPorts",   DetailsElementType_Serial);
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;        QList<DetailsElementType> values;
+    keys << "general";       values << DetailsElementType_General;
+    keys << "preview";       values << DetailsElementType_Preview;
+    keys << "system";        values << DetailsElementType_System;
+    keys << "display";       values << DetailsElementType_Display;
+    keys << "storage";       values << DetailsElementType_Storage;
+    keys << "audio";         values << DetailsElementType_Audio;
+    keys << "network";       values << DetailsElementType_Network;
+    keys << "serialPorts";   values << DetailsElementType_Serial;
 #ifdef VBOX_WITH_PARALLEL_PORTS
-    list.insert("parallelPorts", DetailsElementType_Parallel);
+    keys << "parallelPorts"; values << DetailsElementType_Parallel;
 #endif /* VBOX_WITH_PARALLEL_PORTS */
-    list.insert("usb",           DetailsElementType_USB);
-    list.insert("sharedFolders", DetailsElementType_SF);
-    list.insert("description",   DetailsElementType_Description);
-    if (!list.contains(strDetailsElementType))
+    keys << "usb";           values << DetailsElementType_USB;
+    keys << "sharedFolders"; values << DetailsElementType_SF;
+    keys << "userInterface"; values << DetailsElementType_UI;
+    keys << "description";   values << DetailsElementType_Description;
+    /* Invalid type for unknown words: */
+    if (!keys.contains(strDetailsElementType, Qt::CaseInsensitive))
+        return DetailsElementType_Invalid;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strDetailsElementType, Qt::CaseInsensitive)));
+}
+
+/* QString <= PreviewUpdateIntervalType: */
+template<> QString toInternalString(const PreviewUpdateIntervalType &previewUpdateIntervalType)
+{
+    /* Return corresponding QString representation for passed enum value: */
+    switch (previewUpdateIntervalType)
     {
-        AssertMsgFailed(("No value for '%s'", strDetailsElementType.toAscii().constData()));
+        case PreviewUpdateIntervalType_Disabled: return "disabled";
+        case PreviewUpdateIntervalType_500ms:    return "500";
+        case PreviewUpdateIntervalType_1000ms:   return "1000";
+        case PreviewUpdateIntervalType_2000ms:   return "2000";
+        case PreviewUpdateIntervalType_5000ms:   return "5000";
+        case PreviewUpdateIntervalType_10000ms:  return "10000";
+        default: AssertMsgFailed(("No text for '%d'", previewUpdateIntervalType)); break;
     }
-    return list.value(strDetailsElementType);
+    /* Return QString() by default: */
+    return QString();
+}
+
+/* PreviewUpdateIntervalType <= QString: */
+template<> PreviewUpdateIntervalType fromInternalString<PreviewUpdateIntervalType>(const QString &strPreviewUpdateIntervalType)
+{
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;   QList<PreviewUpdateIntervalType> values;
+    keys << "disabled"; values << PreviewUpdateIntervalType_Disabled;
+    keys << "500";      values << PreviewUpdateIntervalType_500ms;
+    keys << "1000";     values << PreviewUpdateIntervalType_1000ms;
+    keys << "2000";     values << PreviewUpdateIntervalType_2000ms;
+    keys << "5000";     values << PreviewUpdateIntervalType_5000ms;
+    keys << "10000";    values << PreviewUpdateIntervalType_10000ms;
+    /* 1000ms type for unknown words: */
+    if (!keys.contains(strPreviewUpdateIntervalType, Qt::CaseInsensitive))
+        return PreviewUpdateIntervalType_1000ms;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strPreviewUpdateIntervalType, Qt::CaseInsensitive)));
+}
+
+/* int <= PreviewUpdateIntervalType: */
+template<> int toInternalInteger(const PreviewUpdateIntervalType &previewUpdateIntervalType)
+{
+    /* Return corresponding integer representation for passed enum value: */
+    switch (previewUpdateIntervalType)
+    {
+        case PreviewUpdateIntervalType_Disabled: return 0;
+        case PreviewUpdateIntervalType_500ms:    return 500;
+        case PreviewUpdateIntervalType_1000ms:   return 1000;
+        case PreviewUpdateIntervalType_2000ms:   return 2000;
+        case PreviewUpdateIntervalType_5000ms:   return 5000;
+        case PreviewUpdateIntervalType_10000ms:  return 10000;
+        default: AssertMsgFailed(("No value for '%d'", previewUpdateIntervalType)); break;
+    }
+    /* Return 0 by default: */
+    return 0;
+}
+
+/* PreviewUpdateIntervalType <= int: */
+template<> PreviewUpdateIntervalType fromInternalInteger<PreviewUpdateIntervalType>(const int &iPreviewUpdateIntervalType)
+{
+    /* Add all the enum values into the hash: */
+    QHash<int, PreviewUpdateIntervalType> hash;
+    hash.insert(0,     PreviewUpdateIntervalType_Disabled);
+    hash.insert(500,   PreviewUpdateIntervalType_500ms);
+    hash.insert(1000,  PreviewUpdateIntervalType_1000ms);
+    hash.insert(2000,  PreviewUpdateIntervalType_2000ms);
+    hash.insert(5000,  PreviewUpdateIntervalType_5000ms);
+    hash.insert(10000, PreviewUpdateIntervalType_10000ms);
+    /* Make sure hash contains incoming integer representation: */
+    if (!hash.contains(iPreviewUpdateIntervalType))
+        AssertMsgFailed(("No value for '%d'", iPreviewUpdateIntervalType));
+    /* Return corresponding enum value for passed integer representation: */
+    return hash.value(iPreviewUpdateIntervalType);
 }
 
 /* QString <= GlobalSettingsPageType: */
@@ -817,7 +1075,7 @@ template<> GlobalSettingsPageType fromInternalString<GlobalSettingsPageType>(con
 {
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
-    QStringList keys;    QList<GlobalSettingsPageType> values;
+    QStringList keys;     QList<GlobalSettingsPageType> values;
     keys << "General";    values << GlobalSettingsPageType_General;
     keys << "Input";      values << GlobalSettingsPageType_Input;
 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
@@ -842,17 +1100,17 @@ template<> QPixmap toWarningPixmap(const GlobalSettingsPageType &type)
 {
     switch (type)
     {
-        case GlobalSettingsPageType_General:    return QPixmap(":/machine_warning_16px.png");
-        case GlobalSettingsPageType_Input:      return QPixmap(":/hostkey_warning_16px.png");
+        case GlobalSettingsPageType_General:    return UIIconPool::pixmap(":/machine_warning_16px.png");
+        case GlobalSettingsPageType_Input:      return UIIconPool::pixmap(":/hostkey_warning_16px.png");
 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-        case GlobalSettingsPageType_Update:     return QPixmap(":/refresh_warning_16px.png");
+        case GlobalSettingsPageType_Update:     return UIIconPool::pixmap(":/refresh_warning_16px.png");
 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-        case GlobalSettingsPageType_Language:   return QPixmap(":/site_warning_16px.png");
-        case GlobalSettingsPageType_Display:    return QPixmap(":/vrdp_warning_16px.png");
-        case GlobalSettingsPageType_Network:    return QPixmap(":/nw_warning_16px.png");
-        case GlobalSettingsPageType_Extensions: return QPixmap(":/extension_pack_warning_16px.png");
+        case GlobalSettingsPageType_Language:   return UIIconPool::pixmap(":/site_warning_16px.png");
+        case GlobalSettingsPageType_Display:    return UIIconPool::pixmap(":/vrdp_warning_16px.png");
+        case GlobalSettingsPageType_Network:    return UIIconPool::pixmap(":/nw_warning_16px.png");
+        case GlobalSettingsPageType_Extensions: return UIIconPool::pixmap(":/extension_pack_warning_16px.png");
 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-        case GlobalSettingsPageType_Proxy:      return QPixmap(":/proxy_warning_16px.png");
+        case GlobalSettingsPageType_Proxy:      return UIIconPool::pixmap(":/proxy_warning_16px.png");
 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
         default: AssertMsgFailed(("No pixmap for %d", type)); break;
     }
@@ -865,17 +1123,18 @@ template<> QString toInternalString(const MachineSettingsPageType &machineSettin
     QString strResult;
     switch (machineSettingsPageType)
     {
-        case MachineSettingsPageType_General:  strResult = "General"; break;
-        case MachineSettingsPageType_System:   strResult = "System"; break;
-        case MachineSettingsPageType_Display:  strResult = "Display"; break;
-        case MachineSettingsPageType_Storage:  strResult = "Storage"; break;
-        case MachineSettingsPageType_Audio:    strResult = "Audio"; break;
-        case MachineSettingsPageType_Network:  strResult = "Network"; break;
-        case MachineSettingsPageType_Ports:    strResult = "Ports"; break;
-        case MachineSettingsPageType_Serial:   strResult = "Serial"; break;
-        case MachineSettingsPageType_Parallel: strResult = "Parallel"; break;
-        case MachineSettingsPageType_USB:      strResult = "USB"; break;
-        case MachineSettingsPageType_SF:       strResult = "SharedFolders"; break;
+        case MachineSettingsPageType_General:   strResult = "General"; break;
+        case MachineSettingsPageType_System:    strResult = "System"; break;
+        case MachineSettingsPageType_Display:   strResult = "Display"; break;
+        case MachineSettingsPageType_Storage:   strResult = "Storage"; break;
+        case MachineSettingsPageType_Audio:     strResult = "Audio"; break;
+        case MachineSettingsPageType_Network:   strResult = "Network"; break;
+        case MachineSettingsPageType_Ports:     strResult = "Ports"; break;
+        case MachineSettingsPageType_Serial:    strResult = "Serial"; break;
+        case MachineSettingsPageType_Parallel:  strResult = "Parallel"; break;
+        case MachineSettingsPageType_USB:       strResult = "USB"; break;
+        case MachineSettingsPageType_SF:        strResult = "SharedFolders"; break;
+        case MachineSettingsPageType_Interface: strResult = "Interface"; break;
         default:
         {
             AssertMsgFailed(("No text for settings page type=%d", machineSettingsPageType));
@@ -902,6 +1161,7 @@ template<> MachineSettingsPageType fromInternalString<MachineSettingsPageType>(c
     keys << "Parallel";      values << MachineSettingsPageType_Parallel;
     keys << "USB";           values << MachineSettingsPageType_USB;
     keys << "SharedFolders"; values << MachineSettingsPageType_SF;
+    keys << "Interface";     values << MachineSettingsPageType_Interface;
     /* Invalid type for unknown words: */
     if (!keys.contains(strMachineSettingsPageType, Qt::CaseInsensitive))
         return MachineSettingsPageType_Invalid;
@@ -914,22 +1174,65 @@ template<> QPixmap toWarningPixmap(const MachineSettingsPageType &type)
 {
     switch (type)
     {
-        case MachineSettingsPageType_General:  return QPixmap(":/machine_warning_16px.png");
-        case MachineSettingsPageType_System:   return QPixmap(":/chipset_warning_16px.png");
-        case MachineSettingsPageType_Display:  return QPixmap(":/vrdp_warning_16px.png");
-        case MachineSettingsPageType_Storage:  return QPixmap(":/hd_warning_16px.png");
-        case MachineSettingsPageType_Audio:    return QPixmap(":/sound_warning_16px.png");
-        case MachineSettingsPageType_Network:  return QPixmap(":/nw_warning_16px.png");
-        case MachineSettingsPageType_Ports:    return QPixmap(":/serial_port_warning_16px.png");
-        case MachineSettingsPageType_Serial:   return QPixmap(":/serial_port_warning_16px.png");
-        case MachineSettingsPageType_Parallel: return QPixmap(":/parallel_port_warning_16px.png");
-        case MachineSettingsPageType_USB:      return QPixmap(":/usb_warning_16px.png");
-        case MachineSettingsPageType_SF:       return QPixmap(":/sf_warning_16px.png");
+        case MachineSettingsPageType_General:   return UIIconPool::pixmap(":/machine_warning_16px.png");
+        case MachineSettingsPageType_System:    return UIIconPool::pixmap(":/chipset_warning_16px.png");
+        case MachineSettingsPageType_Display:   return UIIconPool::pixmap(":/vrdp_warning_16px.png");
+        case MachineSettingsPageType_Storage:   return UIIconPool::pixmap(":/hd_warning_16px.png");
+        case MachineSettingsPageType_Audio:     return UIIconPool::pixmap(":/sound_warning_16px.png");
+        case MachineSettingsPageType_Network:   return UIIconPool::pixmap(":/nw_warning_16px.png");
+        case MachineSettingsPageType_Ports:     return UIIconPool::pixmap(":/serial_port_warning_16px.png");
+        case MachineSettingsPageType_Serial:    return UIIconPool::pixmap(":/serial_port_warning_16px.png");
+        case MachineSettingsPageType_Parallel:  return UIIconPool::pixmap(":/parallel_port_warning_16px.png");
+        case MachineSettingsPageType_USB:       return UIIconPool::pixmap(":/usb_warning_16px.png");
+        case MachineSettingsPageType_SF:        return UIIconPool::pixmap(":/sf_warning_16px.png");
+        case MachineSettingsPageType_Interface: return UIIconPool::pixmap(":/interface_warning_16px.png");
         default: AssertMsgFailed(("No pixmap for %d", type)); break;
     }
     return QPixmap();
 }
 
+/* QString <= WizardType: */
+template<> QString toInternalString(const WizardType &wizardType)
+{
+    QString strResult;
+    switch (wizardType)
+    {
+        case WizardType_NewVM:           strResult = "NewVM"; break;
+        case WizardType_CloneVM:         strResult = "CloneVM"; break;
+        case WizardType_ExportAppliance: strResult = "ExportAppliance"; break;
+        case WizardType_ImportAppliance: strResult = "ImportAppliance"; break;
+        case WizardType_FirstRun:        strResult = "FirstRun"; break;
+        case WizardType_NewVD:           strResult = "NewVD"; break;
+        case WizardType_CloneVD:         strResult = "CloneVD"; break;
+        default:
+        {
+            AssertMsgFailed(("No text for wizard type=%d", wizardType));
+            break;
+        }
+    }
+    return strResult;
+}
+
+/* WizardType <= QString: */
+template<> WizardType fromInternalString<WizardType>(const QString &strWizardType)
+{
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;          QList<WizardType> values;
+    keys << "NewVM";           values << WizardType_NewVM;
+    keys << "CloneVM";         values << WizardType_CloneVM;
+    keys << "ExportAppliance"; values << WizardType_ExportAppliance;
+    keys << "ImportAppliance"; values << WizardType_ImportAppliance;
+    keys << "FirstRun";        values << WizardType_FirstRun;
+    keys << "NewVD";           values << WizardType_NewVD;
+    keys << "CloneVD";         values << WizardType_CloneVD;
+    /* Invalid type for unknown words: */
+    if (!keys.contains(strWizardType, Qt::CaseInsensitive))
+        return WizardType_Invalid;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strWizardType, Qt::CaseInsensitive)));
+}
+
 /* QString <= IndicatorType: */
 template<> QString toInternalString(const IndicatorType &indicatorType)
 {
@@ -942,6 +1245,7 @@ template<> QString toInternalString(const IndicatorType &indicatorType)
         case IndicatorType_Network:       strResult = "Network"; break;
         case IndicatorType_USB:           strResult = "USB"; break;
         case IndicatorType_SharedFolders: strResult = "SharedFolders"; break;
+        case IndicatorType_Display:       strResult = "Display"; break;
         case IndicatorType_VideoCapture:  strResult = "VideoCapture"; break;
         case IndicatorType_Features:      strResult = "Features"; break;
         case IndicatorType_Mouse:         strResult = "Mouse"; break;
@@ -967,6 +1271,7 @@ template<> IndicatorType fromInternalString<IndicatorType>(const QString &strInd
     keys << "Network";       values << IndicatorType_Network;
     keys << "USB";           values << IndicatorType_USB;
     keys << "SharedFolders"; values << IndicatorType_SharedFolders;
+    keys << "Display";       values << IndicatorType_Display;
     keys << "VideoCapture";  values << IndicatorType_VideoCapture;
     keys << "Features";      values << IndicatorType_Features;
     keys << "Mouse";         values << IndicatorType_Mouse;
@@ -978,12 +1283,38 @@ template<> IndicatorType fromInternalString<IndicatorType>(const QString &strInd
     return values.at(keys.indexOf(QRegExp(strIndicatorType, Qt::CaseInsensitive)));
 }
 
+/* QIcon <= IndicatorType: */
+template<> QIcon toIcon(const IndicatorType &indicatorType)
+{
+    switch (indicatorType)
+    {
+        case IndicatorType_HardDisks:     return UIIconPool::iconSet(":/hd_16px.png");
+        case IndicatorType_OpticalDisks:  return UIIconPool::iconSet(":/cd_16px.png");
+        case IndicatorType_FloppyDisks:   return UIIconPool::iconSet(":/fd_16px.png");
+        case IndicatorType_Network:       return UIIconPool::iconSet(":/nw_16px.png");
+        case IndicatorType_USB:           return UIIconPool::iconSet(":/usb_16px.png");
+        case IndicatorType_SharedFolders: return UIIconPool::iconSet(":/sf_16px.png");
+        case IndicatorType_Display:       return UIIconPool::iconSet(":/display_software_16px.png");
+        case IndicatorType_VideoCapture:  return UIIconPool::iconSet(":/video_capture_16px.png");
+        case IndicatorType_Features:      return UIIconPool::iconSet(":/vtx_amdv_16px.png");
+        case IndicatorType_Mouse:         return UIIconPool::iconSet(":/mouse_16px.png");
+        case IndicatorType_Keyboard:      return UIIconPool::iconSet(":/hostkey_16px.png");
+        default:
+        {
+            AssertMsgFailed(("No icon for indicator type=%d", indicatorType));
+            break;
+        }
+    }
+    return QIcon();
+}
+
 /* QString <= MachineCloseAction: */
 template<> QString toInternalString(const MachineCloseAction &machineCloseAction)
 {
     QString strResult;
     switch (machineCloseAction)
     {
+        case MachineCloseAction_Detach:                     strResult = "Detach"; break;
         case MachineCloseAction_SaveState:                  strResult = "SaveState"; break;
         case MachineCloseAction_Shutdown:                   strResult = "Shutdown"; break;
         case MachineCloseAction_PowerOff:                   strResult = "PowerOff"; break;
@@ -1003,6 +1334,7 @@ template<> MachineCloseAction fromInternalString<MachineCloseAction>(const QStri
     /* Here we have some fancy stuff allowing us
      * to search through the keys using 'case-insensitive' rule: */
     QStringList keys;                    QList<MachineCloseAction> values;
+    keys << "Detach";                    values << MachineCloseAction_Detach;
     keys << "SaveState";                 values << MachineCloseAction_SaveState;
     keys << "Shutdown";                  values << MachineCloseAction_Shutdown;
     keys << "PowerOff";                  values << MachineCloseAction_PowerOff;
@@ -1079,6 +1411,38 @@ template<> GuruMeditationHandlerType fromInternalString<GuruMeditationHandlerTyp
     return values.at(keys.indexOf(QRegExp(strGuruMeditationHandlerType, Qt::CaseInsensitive)));
 }
 
+/* QString <= ScalingOptimizationType: */
+template<> QString toInternalString(const ScalingOptimizationType &optimizationType)
+{
+    QString strResult;
+    switch (optimizationType)
+    {
+        case ScalingOptimizationType_None:        strResult = "None"; break;
+        case ScalingOptimizationType_Performance: strResult = "Performance"; break;
+        default:
+        {
+            AssertMsgFailed(("No text for type=%d", optimizationType));
+            break;
+        }
+    }
+    return strResult;
+}
+
+/* ScalingOptimizationType <= QString: */
+template<> ScalingOptimizationType fromInternalString<ScalingOptimizationType>(const QString &strOptimizationType)
+{
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys;      QList<ScalingOptimizationType> values;
+    keys << "None";        values << ScalingOptimizationType_None;
+    keys << "Performance"; values << ScalingOptimizationType_Performance;
+    /* 'None' type for empty/unknown words: */
+    if (!keys.contains(strOptimizationType, Qt::CaseInsensitive))
+        return ScalingOptimizationType_None;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strOptimizationType, Qt::CaseInsensitive)));
+}
+
 /* QString <= HiDPIOptimizationType: */
 template<> QString toInternalString(const HiDPIOptimizationType &optimizationType)
 {
@@ -1104,10 +1468,41 @@ template<> HiDPIOptimizationType fromInternalString<HiDPIOptimizationType>(const
     QStringList keys;      QList<HiDPIOptimizationType> values;
     keys << "None";        values << HiDPIOptimizationType_None;
     keys << "Performance"; values << HiDPIOptimizationType_Performance;
-    /* 'None' type for empty/unknown words: */
+    /* 'Performance' type for empty/unknown words (for trunk): */
     if (!keys.contains(strOptimizationType, Qt::CaseInsensitive))
-        return HiDPIOptimizationType_None;
+        return HiDPIOptimizationType_Performance;
     /* Corresponding type for known words: */
     return values.at(keys.indexOf(QRegExp(strOptimizationType, Qt::CaseInsensitive)));
 }
 
+#ifndef Q_WS_MAC
+/* QString <= MiniToolbarAlignment: */
+template<> QString toInternalString(const MiniToolbarAlignment &miniToolbarAlignment)
+{
+    /* Return corresponding QString representation for passed enum value: */
+    switch (miniToolbarAlignment)
+    {
+        case MiniToolbarAlignment_Bottom: return "Bottom";
+        case MiniToolbarAlignment_Top:    return "Top";
+        default: AssertMsgFailed(("No text for '%d'", miniToolbarAlignment)); break;
+    }
+    /* Return QString() by default: */
+    return QString();
+}
+
+/* MiniToolbarAlignment <= QString: */
+template<> MiniToolbarAlignment fromInternalString<MiniToolbarAlignment>(const QString &strMiniToolbarAlignment)
+{
+    /* Here we have some fancy stuff allowing us
+     * to search through the keys using 'case-insensitive' rule: */
+    QStringList keys; QList<MiniToolbarAlignment> values;
+    keys << "Bottom"; values << MiniToolbarAlignment_Bottom;
+    keys << "Top";    values << MiniToolbarAlignment_Top;
+    /* Bottom type for unknown words: */
+    if (!keys.contains(strMiniToolbarAlignment, Qt::CaseInsensitive))
+        return MiniToolbarAlignment_Bottom;
+    /* Corresponding type for known words: */
+    return values.at(keys.indexOf(QRegExp(strMiniToolbarAlignment, Qt::CaseInsensitive)));
+}
+#endif /* !Q_WS_MAC */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedSlider.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedSlider.cpp
index 357c830..5b6e5f7 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedSlider.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedSlider.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIAdvancedSlider.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIAdvancedSlider class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QIAdvancedSlider class implementation.
  */
 
 /*
@@ -17,18 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#include "QIAdvancedSlider.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+# include "QIAdvancedSlider.h"
 
 /* Qt includes */
-#include <QVBoxLayout>
-#include <QPainter>
-#include <QStyle>
+# include <QVBoxLayout>
+# include <QPainter>
+# include <QStyle>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #include <QStyleOptionSlider>
 
 /* System includes */
 #include <math.h>
 
-class CPrivateSlider: public QSlider
+
+
+class CPrivateSlider : public QSlider
 {
 public:
     CPrivateSlider(Qt::Orientation fOrientation, QWidget *pParent = 0)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedSlider.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedSlider.h
index 7cda6e8..0cee68d 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedSlider.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedSlider.h
@@ -1,7 +1,6 @@
+/* $Id: QIAdvancedSlider.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIAdvancedSlider class implementation
+ * VBox Qt GUI - Qt extensions: QIAdvancedSlider class implementation
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedToolBar.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedToolBar.cpp
index 073a81e..6a9de97 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedToolBar.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedToolBar.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIAdvancedToolBar.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIAdvancedToolBar class implementation
+ * VBox Qt GUI - QIAdvancedToolBar class implementation.
  */
 
 /*
@@ -17,14 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHBoxLayout>
-#include <QAction>
-#include <QToolButton>
+# include <QHBoxLayout>
+# include <QAction>
+# include <QToolButton>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* GUI includes: */
 #include "QIAdvancedToolBar.h"
 
+
 /* More configurable tool-button for QIAdvancedToolBar: */
 class QIAdvancedToolButton : public QToolButton
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedToolBar.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedToolBar.h
index 88ae4c5..b1adcae 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedToolBar.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIAdvancedToolBar.h
@@ -1,7 +1,6 @@
+/* $Id: QIAdvancedToolBar.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIAdvancedToolBar class implementation
+ * VBox Qt GUI - QIAdvancedToolBar class implementation
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.cpp
index 231f8a7..94b4a20 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.cpp
@@ -1,12 +1,10 @@
 /* $Id: QIArrowButtonPress.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowButtonPress class implementation
+ * VBox Qt GUI - QIArrowButtonPress class implementation.
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,57 +15,50 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* VBox includes */
-#include "QIArrowButtonPress.h"
-#include "UIIconPool.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/* Qt includes */
-#include <QKeyEvent>
+/* Qt includes: */
+# include <QKeyEvent>
 
+/* GUI includes: */
+# include "QIArrowButtonPress.h"
 
-/** @class QIArrowButtonPress
- *
- *  The QIArrowButtonPress class is an arrow tool-button with text-label,
- *  used as back/next buttons in QIMessageBox class.
- *
- */
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-QIArrowButtonPress::QIArrowButtonPress (QWidget *aParent)
-    : QIRichToolButton (aParent)
-    , mNext (true)
-{
-    updateIcon();
-}
 
-QIArrowButtonPress::QIArrowButtonPress (bool aNext, const QString &aName, QWidget *aParent)
-    : QIRichToolButton (aName, aParent)
-    , mNext (aNext)
+QIArrowButtonPress::QIArrowButtonPress(QIArrowButtonPress::ButtonType buttonType,
+                                       QWidget *pParent /* = 0 */)
+    : QIWithRetranslateUI<QIRichToolButton>(pParent)
+    , m_buttonType(buttonType)
 {
-    updateIcon();
+    /* Retranslate UI: */
+    retranslateUi();
 }
 
-void QIArrowButtonPress::updateIcon()
+void QIArrowButtonPress::retranslateUi()
 {
-    mButton->setIcon(UIIconPool::iconSet(mNext ?
-                                         ":/arrow_right_10px.png" : ":/arrow_left_10px.png"));
+    /* Retranslate: */
+    switch (m_buttonType)
+    {
+        case ButtonType_Back: setText(QApplication::translate("QIArrowSplitter", "&Back")); break;
+        case ButtonType_Next: setText(QApplication::translate("QIArrowSplitter", "&Next")); break;
+        default: break;
+    }
 }
 
-bool QIArrowButtonPress::eventFilter (QObject *aObject, QEvent *aEvent)
+void QIArrowButtonPress::keyPressEvent(QKeyEvent *pEvent)
 {
-    /* Process only QIArrowButtonPress or children */
-    if (!(aObject == this || children().contains (aObject)))
-        return QIRichToolButton::eventFilter (aObject, aEvent);
-
-    /* Process keyboard events */
-    if (aEvent->type() == QEvent::KeyPress)
+    /* Handle different keys: */
+    switch (pEvent->key())
     {
-        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
-        if ((mNext && kEvent->key() == Qt::Key_PageUp) ||
-            (!mNext && kEvent->key() == Qt::Key_PageDown))
-            animateClick();
+        /* Animate-click for the Space key: */
+        case Qt::Key_PageUp: if (m_buttonType == ButtonType_Next) return animateClick(); break;
+        case Qt::Key_PageDown: if (m_buttonType == ButtonType_Back) return animateClick(); break;
+        default: break;
     }
-
-    /* Default one handler */
-    return QIRichToolButton::eventFilter (aObject, aEvent);
+    /* Call to base-class: */
+    QIWithRetranslateUI<QIRichToolButton>::keyPressEvent(pEvent);
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.h
index 14cd1c5..57c781a 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonPress.h
@@ -1,11 +1,10 @@
+/* $Id: QIArrowButtonPress.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowButtonPress class declaration
+ * VBox Qt GUI - QIArrowButtonPress class declaration.
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,39 +15,42 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __QIArrowButtonPress_h__
-#define __QIArrowButtonPress_h__
+#ifndef ___QIArrowButtonPress_h___
+#define ___QIArrowButtonPress_h___
 
-/* VBox includes */
+/* GUI includes: */
 #include "QIRichToolButton.h"
+#include "QIWithRetranslateUI.h"
 
-/* VBox forwards */
-class QIRichToolButton;
-
-/** @class QIArrowButtonPress
- *
- *  The QIArrowButtonPress class is an arrow tool-button with text-label,
- *  used as back/next buttons in QIMessageBox class.
- *
- */
-class QIArrowButtonPress : public QIRichToolButton
+/** QIRichToolButton extension
+  * representing arrow tool-button with text-label,
+  * can be used as back/next buttons in various places. */
+class QIArrowButtonPress : public QIWithRetranslateUI<QIRichToolButton>
 {
     Q_OBJECT;
 
 public:
 
-    QIArrowButtonPress (QWidget *aParent = 0);
-    QIArrowButtonPress (bool aNext, const QString &aName, QWidget *aParent = 0);
+    /** Button types. */
+    enum ButtonType { ButtonType_Back, ButtonType_Next };
 
-    void setNext (bool aNext) { mNext = aNext; }
+    /** Constructor, passes @a pParent to the QIRichToolButton constructor.
+      * @param buttonType is used to define which type of the button it is. */
+    QIArrowButtonPress(ButtonType buttonType, QWidget *pParent = 0);
 
-private:
+protected:
 
-    void updateIcon();
-    bool eventFilter (QObject *aObject, QEvent *aEvent);
+    /** Retranslation routine.
+      * @todo Fix translation context. */
+    virtual void retranslateUi();
 
-    bool mNext;
-};
+    /** Key-press-event handler. */
+    virtual void keyPressEvent(QKeyEvent *pEvent);
 
-#endif
+private:
+
+    /** Holds the button-type. */
+    ButtonType m_buttonType;
+};
 
+#endif /* !___QIArrowButtonPress_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonSwitch.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonSwitch.cpp
index 532fce7..982e398 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonSwitch.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonSwitch.cpp
@@ -1,12 +1,10 @@
 /* $Id: QIArrowButtonSwitch.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowButtonSwitch class implementation
+ * VBox Qt GUI - QIArrowButtonSwitch class implementation.
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,64 +15,60 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* VBox includes */
-#include "QIArrowButtonSwitch.h"
-#include "UIIconPool.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/* Qt includes */
-#include <QKeyEvent>
+/* Qt includes: */
+# include <QKeyEvent>
 
+/* GUI includes: */
+# include "QIArrowButtonSwitch.h"
 
-/** @class QIArrowButtonSwitch
- *
- *  The QIArrowButtonSwitch class is an arrow tool-button with text-label,
- *  used as collaps/expand switch in QIMessageBox class.
- *
- */
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-QIArrowButtonSwitch::QIArrowButtonSwitch (QWidget *aParent)
-    : QIRichToolButton (aParent)
-    , mIsExpanded (false)
-{
-    updateIcon();
-}
 
-QIArrowButtonSwitch::QIArrowButtonSwitch (const QString &aName, QWidget *aParent)
-    : QIRichToolButton (aName, aParent)
-    , mIsExpanded (false)
+QIArrowButtonSwitch::QIArrowButtonSwitch(QWidget *pParent /* = 0 */)
+    : QIRichToolButton(pParent)
+    , m_buttonState(ButtonState_Collapsed)
 {
+    /* Update icon: */
     updateIcon();
 }
 
-void QIArrowButtonSwitch::buttonClicked()
+void QIArrowButtonSwitch::setIconForButtonState(QIArrowButtonSwitch::ButtonState buttonState, const QIcon &icon)
 {
-    mIsExpanded = !mIsExpanded;
+    /* Assign icon: */
+    m_icons[buttonState] = icon;
+    /* Update icon: */
     updateIcon();
-    QIRichToolButton::buttonClicked();
 }
 
-void QIArrowButtonSwitch::updateIcon()
+void QIArrowButtonSwitch::sltButtonClicked()
 {
-    mButton->setIcon(UIIconPool::iconSet(mIsExpanded ?
-                                         ":/arrow_down_10px.png" : ":/arrow_right_10px.png"));
+    /* Toggle button-state: */
+    m_buttonState = m_buttonState == ButtonState_Collapsed ?
+                    ButtonState_Expanded : ButtonState_Collapsed;
+    /* Update icon: */
+    updateIcon();
 }
 
-bool QIArrowButtonSwitch::eventFilter (QObject *aObject, QEvent *aEvent)
+void QIArrowButtonSwitch::keyPressEvent(QKeyEvent *pEvent)
 {
-    /* Process only QIArrowButtonSwitch or children */
-    if (!(aObject == this || children().contains (aObject)))
-        return QIRichToolButton::eventFilter (aObject, aEvent);
-
-    /* Process keyboard events */
-    if (aEvent->type() == QEvent::KeyPress)
+    /* Handle different keys: */
+    switch (pEvent->key())
     {
-        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
-        if ((mIsExpanded && kEvent->key() == Qt::Key_Minus) ||
-            (!mIsExpanded && kEvent->key() == Qt::Key_Plus))
-            animateClick();
+        /* Animate-click for the Space key: */
+        case Qt::Key_Minus: if (m_buttonState == ButtonState_Expanded) return animateClick(); break;
+        case Qt::Key_Plus: if (m_buttonState == ButtonState_Collapsed) return animateClick(); break;
+        default: break;
     }
+    /* Call to base-class: */
+    QIRichToolButton::keyPressEvent(pEvent);
+}
 
-    /* Default one handler */
-    return QIRichToolButton::eventFilter (aObject, aEvent);
+void QIArrowButtonSwitch::updateIcon()
+{
+    setIcon(m_icons.value(m_buttonState));
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonSwitch.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonSwitch.h
index 883798e..1b00c81 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonSwitch.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowButtonSwitch.h
@@ -1,11 +1,10 @@
+/* $Id: QIArrowButtonSwitch.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowButtonSwitch class declaration
+ * VBox Qt GUI - QIArrowButtonSwitch class declaration.
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,44 +15,56 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __QIArrowButtonSwitch_h__
-#define __QIArrowButtonSwitch_h__
-
-/* VBox includes */
-#include "QIRichToolButton.h"
+#ifndef ___QIArrowButtonSwitch_h___
+#define ___QIArrowButtonSwitch_h___
 
-/* VBox forwards */
-class QIRichToolButton;
+/* Qt includes: */
+#include <QMap>
+#include <QIcon>
 
+/* GUI includes: */
+#include "QIRichToolButton.h"
 
-/** @class QIArrowButtonSwitch
- *
- *  The QIArrowButtonSwitch class is an arrow tool-button with text-label,
- *  used as collaps/expand switch in QIMessageBox class.
- *
- */
+/** QIRichToolButton extension
+  * representing arrow tool-button with text-label,
+  * can be used as collaps/expand switch in various places. */
 class QIArrowButtonSwitch : public QIRichToolButton
 {
     Q_OBJECT;
 
 public:
 
-    QIArrowButtonSwitch (QWidget *aParent = 0);
-    QIArrowButtonSwitch (const QString &aName, QWidget *aParent = 0);
+    /** Button states. */
+    enum ButtonState { ButtonState_Collapsed, ButtonState_Expanded };
+
+    /** Constructor, passes @a pParent to the QIRichToolButton constructor. */
+    QIArrowButtonSwitch(QWidget *pParent = 0);
+
+    /** Defines the @a icon for the @a buttonState. */
+    void setIconForButtonState(ButtonState buttonState, const QIcon &icon);
 
-    bool isExpanded() const { return mIsExpanded; }
+    /** Returns whether button-state is ButtonState_Expanded. */
+    bool isExpanded() const { return m_buttonState == ButtonState_Expanded; }
 
-private slots:
+protected slots:
 
-    void buttonClicked();
+    /** Button-click handler. */
+    virtual void sltButtonClicked();
+
+protected:
+
+    /** Key-press-event handler. */
+    virtual void keyPressEvent(QKeyEvent *pEvent);
 
 private:
 
+    /** Updates icon according button-state. */
     void updateIcon();
-    bool eventFilter (QObject *aObject, QEvent *aEvent);
 
-    bool mIsExpanded;
+    /** Holds the button-state. */
+    ButtonState m_buttonState;
+    /** Holds icons for button-states. */
+    QMap<ButtonState, QIcon> m_icons;
 };
 
-#endif
-
+#endif /* !___QIArrowButtonSwitch_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.cpp
index b3e7a8c..70f08d9 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.cpp
@@ -1,12 +1,10 @@
 /* $Id: QIArrowSplitter.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowSplitter class implementation
+ * VBox Qt GUI - QIArrowSplitter class implementation.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,165 +15,344 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* VBox includes */
-#include "QIArrowSplitter.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QApplication>
+# include <QDesktopWidget>
+# include <QStyle>
+# include <QHBoxLayout>
+# include <QTextEdit>
+
+/* GUI includes: */
+# include "QIArrowSplitter.h"
+# include "QIArrowButtonSwitch.h"
+# include "QIArrowButtonPress.h"
+# include "UIIconPool.h"
+
+/* Other VBox includes: */
+# include "iprt/assert.h"
 
-/* Qt includes */
-#include <QApplication>
-#include <QHBoxLayout>
-#include <QKeyEvent>
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-QIArrowSplitter::QIArrowSplitter (QWidget *aChild, QWidget *aParent)
-    : QWidget (aParent)
-    , mMainLayout (new QVBoxLayout (this))
-    , mSwitchButton (new QIArrowButtonSwitch())
-    , mBackButton (new QIArrowButtonPress (false, tr ("&Back")))
-    , mNextButton (new QIArrowButtonPress (true,  tr ("&Next")))
-    , mChild (aChild)
+
+
+/** QTextEdit extension
+  * taking into account text-document size-hint.
+  * @note Used with QIMessageBox class only.
+  * @todo Should be moved/renamed accordingly. */
+class QIDetailsBrowser : public QTextEdit
 {
-    /* Setup main-layout */
-    mMainLayout->setContentsMargins(0, 0, 0, 0);
-    mMainLayout->setSpacing(3);
+    Q_OBJECT;
 
-    /* Setup buttons */
-    mBackButton->setVisible (false);
-    mNextButton->setVisible (false);
+public:
 
-    /* Setup connections */
-    connect (mSwitchButton, SIGNAL (clicked()), this, SLOT (toggleWidget()));
-    connect (mBackButton, SIGNAL (clicked()), this, SIGNAL (showBackDetails()));
-    connect (mNextButton, SIGNAL (clicked()), this, SIGNAL (showNextDetails()));
+    /** Constructor, passes @a pParent to the QTextEdit constructor. */
+    QIDetailsBrowser(QWidget *pParent = 0);
 
-    /* Setup button layout */
-    QHBoxLayout *buttonLayout = new QHBoxLayout();
-    buttonLayout->setContentsMargins(0, 0, 0, 0);
-    buttonLayout->setSpacing (0);
-    buttonLayout->addWidget (mSwitchButton);
-    buttonLayout->addStretch();
-    buttonLayout->addWidget (mBackButton);
-    buttonLayout->addWidget (mNextButton);
+    /** Returns minimum size-hint. */
+    QSize minimumSizeHint() const;
+    /** Returns size-hint. */
+    QSize sizeHint() const;
 
-    /* Append layout with children */
-    mMainLayout->addLayout (buttonLayout);
-    mMainLayout->addWidget (mChild);
+    /** Update scroll-bars. */
+    void updateScrollBars();
+};
 
-    /* Install event-filter */
-    qApp->installEventFilter (this);
+QIDetailsBrowser::QIDetailsBrowser(QWidget *pParent /* = 0 */)
+    : QTextEdit(pParent)
+{
+    /* Prepare: */
+    setReadOnly(true);
+}
 
-    /* Hide child initially: */
-    toggleWidget();
+QSize QIDetailsBrowser::minimumSizeHint() const
+{
+    /* Get document size as the basis: */
+    QSize documentSize = document()->size().toSize();
+    /* But only document ideal-width can advice wise width: */
+    const int iDocumentIdealWidth = document()->idealWidth();
+    /* Moreover we should take document margins into account: */
+    const int iDocumentMargin = document()->documentMargin();
+
+    /* Compose minimum size-hint on the basis of values above: */
+    documentSize.setWidth(iDocumentIdealWidth + iDocumentMargin);
+    documentSize.setHeight(documentSize.height() + iDocumentMargin);
+
+    /* Get 40% of the screen-area to limit the resulting hint: */
+    const QSize screenGeometryDot4 = QApplication::desktop()->screenGeometry(this).size() * .4;
+
+    /* Calculate minimum size-hint which is document-size limited by screen-area: */
+    QSize mSizeHint = documentSize.boundedTo(screenGeometryDot4);
+
+    /* If there is not enough of vertical space: */
+    if (mSizeHint.height() < documentSize.height())
+    {
+        /* We should also take into account vertical scroll-bar extent: */
+        int iExtent = QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent);
+        mSizeHint.setWidth(mSizeHint.width() + iExtent);
+    }
+
+    /* Always bound cached hint by 40% of current screen-area: */
+    return mSizeHint;
 }
 
-void QIArrowSplitter::setMultiPaging (bool aMultiPage)
+QSize QIDetailsBrowser::sizeHint() const
 {
-    mBackButton->setVisible (aMultiPage);
-    mNextButton->setVisible (aMultiPage);
+    /* Return minimum size-hint: */
+    return minimumSizeHint();
 }
 
-void QIArrowSplitter::setButtonEnabled (bool aNext, bool aEnabled)
+void QIDetailsBrowser::updateScrollBars()
 {
-    aNext ? mNextButton->setEnabled (aEnabled)
-          : mBackButton->setEnabled (aEnabled);
+    /* Some Qt issue prevents scroll-bars from update.. */
+    Qt::ScrollBarPolicy horizontalPolicy = horizontalScrollBarPolicy();
+    Qt::ScrollBarPolicy verticalPolicy = verticalScrollBarPolicy();
+    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    setHorizontalScrollBarPolicy(horizontalPolicy);
+    setVerticalScrollBarPolicy(verticalPolicy);
 }
 
-void QIArrowSplitter::setName (const QString &aName)
+
+QIArrowSplitter::QIArrowSplitter(QWidget *pParent /* = 0 */)
+    : QIWithRetranslateUI<QWidget>(pParent)
+    , m_pMainLayout(0)
+    , m_pSwitchButton(0)
+    , m_pBackButton(0)
+    , m_pNextButton(0)
+    , m_pDetailsBrowser(0)
+    , m_iDetailsIndex(-1)
 {
-    mSwitchButton->setText (aName);
-    emit sigSizeChanged();
+    /* Prepare: */
+    prepare();
 }
 
 QSize QIArrowSplitter::minimumSizeHint() const
 {
-    /* Get size-hints: */
-    QSize switchButtonHint = mSwitchButton->minimumSizeHint();
-    QSize backButtonHint = mBackButton->minimumSizeHint();
-    QSize nextButtonHint = mNextButton->minimumSizeHint();
-    int iChildWidthHint = 0;
-    int iChildHeightHint = 0;
-    if (mChild)
-    {
-        QSize childHint = mChild->minimumSize();
-        if (childHint.isNull())
-            childHint = mChild->minimumSizeHint();
-        iChildWidthHint = childHint.width();
-        iChildHeightHint = childHint.height();
-    }
+    /* Get minimum size-hints: */
+    const QSize switchButtonHint = m_pSwitchButton->minimumSizeHint();
+    const QSize backButtonHint = m_pBackButton->minimumSizeHint();
+    const QSize nextButtonHint = m_pNextButton->minimumSizeHint();
+    const QSize detailsBrowserHint = m_pDetailsBrowser->minimumSizeHint();
 
     /* Calculate width-hint: */
     int iWidthHint = 0;
     iWidthHint += switchButtonHint.width();
+    iWidthHint += 100 /* button spacing */;
     iWidthHint += backButtonHint.width();
     iWidthHint += nextButtonHint.width();
-    if (mChild)
-        iWidthHint = qMax(iWidthHint, iChildWidthHint);
+    iWidthHint = qMax(iWidthHint, detailsBrowserHint.width());
 
     /* Calculate height-hint: */
     int iHeightHint = 0;
     iHeightHint = qMax(iHeightHint, switchButtonHint.height());
     iHeightHint = qMax(iHeightHint, backButtonHint.height());
     iHeightHint = qMax(iHeightHint, nextButtonHint.height());
-    if (mChild && mChild->isVisible())
-        iHeightHint += mMainLayout->spacing() + iChildHeightHint;
+    if (m_pDetailsBrowser->isVisible())
+        iHeightHint += m_pMainLayout->spacing() + detailsBrowserHint.height();
 
     /* Return result: */
     return QSize(iWidthHint, iHeightHint);
 }
 
-void QIArrowSplitter::toggleWidget()
+void QIArrowSplitter::setName(const QString &strName)
+{
+    /* Assign name for the switch-button: */
+    m_pSwitchButton->setText(strName);
+    /* Update size-hints: */
+    sltUpdateSizeHints();
+}
+
+void QIArrowSplitter::setDetails(const QStringPairList &details)
 {
-    mChild->setVisible (mSwitchButton->isExpanded());
-    emit sigSizeChanged();
+    /* Assign new details: */
+    m_details = details;
+    /* Reset the details-list index: */
+    m_iDetailsIndex = m_details.isEmpty() ? -1 : 0;
+    /* Update navigation-buttons visibility: */
+    sltUpdateNavigationButtonsVisibility();
+    /* Update details-browser visibility: */
+    sltUpdateDetailsBrowserVisibility();
+    /* Update details: */
+    updateDetails();
 }
 
-bool QIArrowSplitter::eventFilter (QObject *aObject, QEvent *aEvent)
+void QIArrowSplitter::sltUpdateSizeHints()
 {
-    /* Process only parent window children */
-    if (!(aObject == window() || window()->children().contains (aObject)))
-        return QWidget::eventFilter (aObject, aEvent);
+    /* Let parent layout know our size-hint changed: */
+    updateGeometry();
+    /* Notify parent about our size-hint changed: */
+    emit sigSizeHintChange();
+    /* Update details-browser scroll-bars: */
+    m_pDetailsBrowser->updateScrollBars();
+}
 
-    /* Do not process QIArrowButtonSwitch & QIArrowButtonPress children */
-    if (aObject == mSwitchButton ||
-        aObject == mBackButton ||
-        aObject == mNextButton ||
-        mSwitchButton->children().contains (aObject) ||
-        mBackButton->children().contains (aObject) ||
-        mNextButton->children().contains (aObject))
-        return QWidget::eventFilter (aObject, aEvent);
+void QIArrowSplitter::sltUpdateNavigationButtonsVisibility()
+{
+    /* Depending on switch-button state: */
+    const bool fExpanded = m_pSwitchButton->isExpanded();
+    /* Update back/next button visibility: */
+    m_pBackButton->setVisible(m_details.size() > 1 && fExpanded);
+    m_pNextButton->setVisible(m_details.size() > 1 && fExpanded);
+}
 
-    /* Process some keyboard events */
-    if (aEvent->type() == QEvent::KeyPress)
+void QIArrowSplitter::sltUpdateDetailsBrowserVisibility()
+{
+    /* Update details-browser visibility according switch-button state: */
+    m_pDetailsBrowser->setVisible(m_details.size() > 0 && m_pSwitchButton->isExpanded());
+    /* Update size-hints: */
+    sltUpdateSizeHints();
+}
+
+void QIArrowSplitter::sltSwitchDetailsPageBack()
+{
+    /* Make sure details-page index feats the bounds: */
+    AssertReturnVoid(m_iDetailsIndex > 0);
+    /* Decrease details-list index: */
+    --m_iDetailsIndex;
+    /* Update details: */
+    updateDetails();
+}
+
+void QIArrowSplitter::sltSwitchDetailsPageNext()
+{
+    /* Make sure details-page index feats the bounds: */
+    AssertReturnVoid(m_iDetailsIndex < m_details.size() - 1);
+    /* Increase details-list index: */
+    ++m_iDetailsIndex;
+    /* Update details: */
+    updateDetails();
+}
+
+void QIArrowSplitter::prepare()
+{
+    /* Create main-layout: */
+    m_pMainLayout = new QVBoxLayout(this);
+    AssertPtrReturnVoid(m_pMainLayout);
     {
-        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
-        switch (kEvent->key())
+        /* Configure main-layout: */
+        m_pMainLayout->setContentsMargins(0, 0, 0, 0);
+        m_pMainLayout->setSpacing(3);
+        /* Create button-layout: */
+        QHBoxLayout *pButtonLayout = new QHBoxLayout;
+        AssertPtrReturnVoid(pButtonLayout);
         {
-            case Qt::Key_Plus:
-            {
-                if (!mSwitchButton->isExpanded())
-                    mSwitchButton->animateClick();
-                break;
-            }
-            case Qt::Key_Minus:
+            /* Configure button-layout: */
+            pButtonLayout->setContentsMargins(0, 0, 0, 0);
+            pButtonLayout->setSpacing(0);
+            /* Create switch-button: */
+            m_pSwitchButton = new QIArrowButtonSwitch;
+            AssertPtrReturnVoid(m_pSwitchButton);
             {
-                if (mSwitchButton->isExpanded())
-                    mSwitchButton->animateClick();
-                break;
+                /* Configure switch-button: */
+                m_pSwitchButton->setIconSize(QSize(10, 10));
+                m_pSwitchButton->setIconForButtonState(QIArrowButtonSwitch::ButtonState_Collapsed,
+                                                       UIIconPool::iconSet(":/arrow_right_10px.png"));
+                m_pSwitchButton->setIconForButtonState(QIArrowButtonSwitch::ButtonState_Expanded,
+                                                       UIIconPool::iconSet(":/arrow_down_10px.png"));
+                connect(m_pSwitchButton, SIGNAL(sigClicked()), this, SLOT(sltUpdateNavigationButtonsVisibility()));
+                connect(m_pSwitchButton, SIGNAL(sigClicked()), this, SLOT(sltUpdateDetailsBrowserVisibility()));
+                /* Add switch-button into button-layout: */
+                pButtonLayout->addWidget(m_pSwitchButton);
             }
-            case Qt::Key_PageUp:
+            /* Add stretch: */
+            pButtonLayout->addStretch();
+            /* Create back-button: */
+            m_pBackButton = new QIArrowButtonPress(QIArrowButtonPress::ButtonType_Back);
+            AssertPtrReturnVoid(m_pBackButton);
             {
-                if (mNextButton->isEnabled())
-                    mNextButton->animateClick();
-                break;
+                /* Configure back-button: */
+                m_pBackButton->setIconSize(QSize(10, 10));
+                m_pBackButton->setIcon(UIIconPool::iconSet(":/arrow_left_10px.png"));
+                connect(m_pBackButton, SIGNAL(sigClicked()), this, SLOT(sltSwitchDetailsPageBack()));
+                /* Add back-button into button-layout: */
+                pButtonLayout->addWidget(m_pBackButton);
             }
-            case Qt::Key_PageDown:
+            /* Create next-button: */
+            m_pNextButton = new QIArrowButtonPress(QIArrowButtonPress::ButtonType_Next);
+            AssertPtrReturnVoid(m_pNextButton);
             {
-                if (mBackButton->isEnabled())
-                    mBackButton->animateClick();
-                break;
+                /* Configure next-button: */
+                m_pNextButton->setIconSize(QSize(10, 10));
+                m_pNextButton->setIcon(UIIconPool::iconSet(":/arrow_right_10px.png"));
+                connect(m_pNextButton, SIGNAL(sigClicked()), this, SLOT(sltSwitchDetailsPageNext()));
+                /* Add next-button into button-layout: */
+                pButtonLayout->addWidget(m_pNextButton);
             }
+            /* Add button layout into main-layout: */
+            m_pMainLayout->addLayout(pButtonLayout);
+            /* Update navigation-buttons visibility: */
+            sltUpdateNavigationButtonsVisibility();
+        }
+        /* Create details-browser: */
+        m_pDetailsBrowser = new QIDetailsBrowser;
+        AssertPtrReturnVoid(m_pDetailsBrowser);
+        {
+            /* Add details-browser into main-layout: */
+            m_pMainLayout->addWidget(m_pDetailsBrowser);
+            /* Update details-browser visibility: */
+            sltUpdateDetailsBrowserVisibility();
+            /* Update details: */
+            updateDetails();
         }
     }
 
-    /* Default one handler */
-    return QWidget::eventFilter (aObject, aEvent);
+    /* Apply size-policy finally: */
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+}
+
+void QIArrowSplitter::retranslateUi()
+{
+    /* Update details: */
+    updateDetails();
+}
+
+void QIArrowSplitter::updateDetails()
+{
+    /* If details are empty: */
+    if (m_details.isEmpty())
+    {
+        /* Make sure details-list index is invalid: */
+        AssertReturnVoid(m_iDetailsIndex == -1);
+
+        /* Reset name: */
+        setName(QString());
+    }
+    /* If details are NOT empty: */
+    else
+    {
+        /* Make sure details-list index feats the bounds: */
+        AssertReturnVoid(m_iDetailsIndex >= 0 && m_iDetailsIndex < m_details.size());
+
+        /* Single page: */
+        if (m_details.size() == 1)
+        {
+            setName(QApplication::translate("QIMessageBox", "&Details"));
+            m_pBackButton->setEnabled(false);
+            m_pNextButton->setEnabled(false);
+        }
+        /* Multi-paging: */
+        else if (m_details.size() > 1)
+        {
+            setName(QApplication::translate("QIMessageBox", "&Details (%1 of %2)").arg(m_iDetailsIndex + 1).arg(m_details.size()));
+            m_pBackButton->setEnabled(m_iDetailsIndex > 0);
+            m_pNextButton->setEnabled(m_iDetailsIndex < m_details.size() - 1);
+        }
+
+        /* Update details-browser: */
+        const QString strFirstPart = m_details[m_iDetailsIndex].first;
+        const QString strSecondPart = m_details[m_iDetailsIndex].second;
+        if (strFirstPart.isEmpty())
+            m_pDetailsBrowser->setText(strSecondPart);
+        else
+            m_pDetailsBrowser->setText(QString("%1<br>%2").arg(strFirstPart, strSecondPart));
+    }
+    /* Update size-hints: */
+    sltUpdateSizeHints();
 }
 
+#include "QIArrowSplitter.moc"
+
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.h
index d10afcb..225a08c 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.h
@@ -1,11 +1,10 @@
+/* $Id: QIArrowSplitter.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIArrowSplitter class declaration
+ * VBox Qt GUI - QIArrowSplitter class declaration.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,65 +15,95 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __QIArrowSplitter_h__
-#define __QIArrowSplitter_h__
-
-/* VBox includes */
-#include "QIArrowButtonPress.h"
-#include "QIArrowButtonSwitch.h"
+#ifndef ___QIArrowSplitter_h___
+#define ___QIArrowSplitter_h___
 
-/* Qt includes */
+/* Qt includes: */
 #include <QWidget>
-#include <QHBoxLayout>
 
-/* VBox forwards */
-class QIArrowButtonPress;
-class QIArrowButtonSwitch;
+/* GUI includes: */
+#include "QIWithRetranslateUI.h"
 
-/* Qt forwards */
+/* Forward declarations: */
 class QVBoxLayout;
+class QIArrowButtonSwitch;
+class QIArrowButtonPress;
+class QIDetailsBrowser;
 
-/** @class QIArrowSplitter
- *
- *  The QIArrowSplitter class is a folding widget placeholder.
- *
- */
-class QIArrowSplitter : public QWidget
+/* Type definitions: */
+typedef QPair<QString, QString> QStringPair;
+typedef QList<QStringPair> QStringPairList;
+
+/** QWidget extension
+  * allowing to toggle visibility for any other child widget. */
+class QIArrowSplitter : public QIWithRetranslateUI<QWidget>
 {
     Q_OBJECT;
 
-public:
-
-    QIArrowSplitter (QWidget *aChild, QWidget *aParent = 0);
+signals:
 
-    void setMultiPaging (bool aMultiPage);
+    /** Notifies listeners about size-hint change: */
+    void sigSizeHintChange();
 
-    void setButtonEnabled (bool aNext, bool aEnabled);
+public:
 
-    void setName (const QString &aName);
+    /** Constructor, passes @a pParent to the QWidget constructor. */
+    QIArrowSplitter(QWidget *pParent = 0);
 
+    /** Returns minimum size-hint. */
     QSize minimumSizeHint() const;
 
+    /** Defines the @a strName for the switch-button. */
+    void setName(const QString &strName);
+
+    /** Returns splitter details. */
+    const QStringPairList& details() const { return m_details; }
+    /** Defines splitter @a details. */
+    void setDetails(const QStringPairList &details);
+
 public slots:
 
-    void toggleWidget();
+    /** Updates size-hints. */
+    void sltUpdateSizeHints();
 
-signals:
+    /** Updates navigation-buttons visibility. */
+    void sltUpdateNavigationButtonsVisibility();
+    /** Updates details-browser visibility. */
+    void sltUpdateDetailsBrowserVisibility();
 
-    void showBackDetails();
-    void showNextDetails();
-    void sigSizeChanged();
+    /** Navigates through details-list backward. */
+    void sltSwitchDetailsPageBack();
+    /** Navigates through details-list forward. */
+    void sltSwitchDetailsPageNext();
 
 private:
 
-    bool eventFilter (QObject *aObject, QEvent *aEvent);
+    /** Prepare routine. */
+    void prepare();
 
-    QVBoxLayout *mMainLayout;
-    QIArrowButtonSwitch *mSwitchButton;
-    QIArrowButtonPress *mBackButton;
-    QIArrowButtonPress *mNextButton;
-    QWidget *mChild;
-};
+    /** Retranslation routine.
+      * @todo Fix translation context. */
+    void retranslateUi();
+
+    /** Updates details. */
+    void updateDetails();
+
+    /** Holds the main-layout. */
+    QVBoxLayout *m_pMainLayout;
 
-#endif
+    /** Holds the switch-button. */
+    QIArrowButtonSwitch *m_pSwitchButton;
+    /** Holds the back-button. */
+    QIArrowButtonPress *m_pBackButton;
+    /** Holds the next-button. */
+    QIArrowButtonPress *m_pNextButton;
+
+    /** Holds the details-browser. */
+    QIDetailsBrowser *m_pDetailsBrowser;
+    /** Holds details-list. */
+    QStringPairList m_details;
+    /** Holds details-list index. */
+    int m_iDetailsIndex;
+};
 
+#endif /* !___QIArrowSplitter_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.cpp
index f034659..62d6d4e 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIDialog.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIDialog class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QIDialog class implementation.
  */
 
 /*
@@ -17,9 +15,16 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "QIDialog.h"
-#include "VBoxGlobal.h"
+# include "QIDialog.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 QIDialog::QIDialog(QWidget *pParent /* = 0 */, Qt::WindowFlags flags /* = 0 */)
     : QDialog(pParent, flags)
@@ -39,25 +44,27 @@ void QIDialog::setVisible(bool fVisible)
     /* Call to base-class: */
     QDialog::setVisible(fVisible);
 
-    /* Exit from the event-loop if
-     * 1. there is any and
-     * 2. we are changing our state from visible to invisible: */
+    /* Exit from the event-loop if there is any and
+     * we are changing our state from visible to hidden. */
     if (m_pEventLoop && !fVisible)
         m_pEventLoop->exit();
 }
 
-int QIDialog::exec(bool fShow /* = true */, bool fApplicationModal /* = false*/)
+int QIDialog::exec(bool fShow /* = true */, bool fApplicationModal /* = false */)
 {
+    /* Check for the recursive run: */
+    AssertMsgReturn(!m_pEventLoop, ("QIDialog::exec() is called recursively!\n"), QDialog::Rejected);
+
     /* Reset the result-code: */
     setResult(QDialog::Rejected);
 
     /* Should we delete ourself on close in theory? */
-    bool fOldDeleteOnClose = testAttribute(Qt::WA_DeleteOnClose);
+    const bool fOldDeleteOnClose = testAttribute(Qt::WA_DeleteOnClose);
     /* For the exec() time, set this attribute to 'false': */
     setAttribute(Qt::WA_DeleteOnClose, false);
 
     /* Which is the current window-modality? */
-    Qt::WindowModality oldModality = windowModality();
+    const Qt::WindowModality oldModality = windowModality();
     /* For the exec() time, set this attribute to 'window-modal' or 'application-modal': */
     setWindowModality(!fApplicationModal ? Qt::WindowModal : Qt::ApplicationModal);
 
@@ -85,7 +92,7 @@ int QIDialog::exec(bool fShow /* = true */, bool fApplicationModal /* = false*/)
     }
 
     /* Save the result-code early (we can delete ourself on close): */
-    int iResultCode = result();
+    const int iResultCode = result();
 
     /* Return old modality: */
     setWindowModality(oldModality);
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.h
index 3666c0c..c291733 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIDialog.h
@@ -1,7 +1,6 @@
+/* $Id: QIDialog.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIDialog class declaration
+ * VBox Qt GUI - VBox Qt extensions: QIDialog class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.cpp
index 43a4305..f22b20d 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIDialogButtonBox.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIDialogButtonBox class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QIDialogButtonBox class implementation.
  */
 
 /*
@@ -16,16 +14,23 @@
  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
-#include "QIDialogButtonBox.h"
-#include "UISpecialControls.h"
+# include "QIDialogButtonBox.h"
+# include "UISpecialControls.h"
 
-#include <iprt/assert.h>
+# include <iprt/assert.h>
 
 /* Qt includes */
-#include <QPushButton>
-#include <QEvent>
-#include <QBoxLayout>
+# include <QPushButton>
+# include <QEvent>
+# include <QBoxLayout>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 QIDialogButtonBox::QIDialogButtonBox (StandardButtons aButtons, Qt::Orientation aOrientation, QWidget *aParent)
    : QIWithRetranslateUI<QDialogButtonBox> (aParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.h
index 6d12985..e6cdccc 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.h
@@ -1,7 +1,6 @@
+/* $Id: QIDialogButtonBox.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIDialogButtonBox class declaration
+ * VBox Qt GUI - VBox Qt extensions: QIDialogButtonBox class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.cpp
index 6f7e3d7..802346a 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIFileDialog.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Qt extensions: QIFileDialog class implementation
+ * VBox Qt GUI - Qt extensions: QIFileDialog class implementation.
  */
 
 /*
@@ -17,28 +15,30 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* VBox includes */
-#include "VBoxGlobal.h"
-#include "UIModalWindowManager.h"
-#include "UIMessageCenter.h"
-#include "QIFileDialog.h"
-
-#if defined Q_WS_WIN
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/// @todo bird: Use (U)INT_PTR, (U)LONG_PTR, DWORD_PTR, or (u)intptr_t.
-#if defined Q_OS_WIN64
-typedef unsigned __int64 Q_ULONG;   /* word up to 64 bit unsigned */
-#else
-typedef unsigned long Q_ULONG;      /* word up to 64 bit unsigned */
-#endif
+/* VBox includes */
+# include "VBoxGlobal.h"
+# include "UIModalWindowManager.h"
+# include "UIMessageCenter.h"
+# include "QIFileDialog.h"
 
+# ifdef Q_WS_WIN
 /* Qt includes */
-#include <QEvent>
-#include <QEventLoop>
-#include <QThread>
+#  include <QEvent>
+#  include <QEventLoop>
+#  include <QThread>
 
 /* WinAPI includes */
-#include "shlobj.h"
+#  include "shlobj.h"
+# endif /* !Q_WS_WIN */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+#ifdef Q_WS_WIN
 
 static QString extractFilter (const QString &aRawFilter)
 {
@@ -140,7 +140,7 @@ static int __stdcall winGetExistDirCallbackProc (HWND hwnd, UINT uMsg,
         QString *initDir = (QString *)(lpData);
         if (!initDir->isEmpty())
         {
-            SendMessage (hwnd, BFFM_SETSELECTION, TRUE, Q_ULONG (
+            SendMessage (hwnd, BFFM_SETSELECTION, TRUE, uintptr_t(
                 initDir->isNull() ? 0 : initDir->utf16()));
         }
     }
@@ -153,7 +153,7 @@ static int __stdcall winGetExistDirCallbackProc (HWND hwnd, UINT uMsg,
             SendMessage (hwnd, BFFM_ENABLEOK, 1, 1);
         else
             SendMessage (hwnd, BFFM_ENABLEOK, 0, 0);
-        SendMessage (hwnd, BFFM_SETSTATUSTEXT, 1, Q_ULONG (path));
+        SendMessage (hwnd, BFFM_SETSTATUSTEXT, 1, uintptr_t(path));
     }
     return 0;
 }
@@ -281,7 +281,7 @@ QString QIFileDialog::getExistingDirectory (const QString &aDir,
             bi.pszDisplayName = initPath;
             bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT | BIF_NEWDIALOGSTYLE;
             bi.lpfn = winGetExistDirCallbackProc;
-            bi.lParam = Q_ULONG (&mDir);
+            bi.lParam = uintptr_t(&mDir);
 
             LPITEMIDLIST itemIdList = SHBrowseForFolder (&bi);
             if (itemIdList)
@@ -344,25 +344,23 @@ QString QIFileDialog::getExistingDirectory (const QString &aDir,
     return dlg.exec() ? dlg.selectedFiles() [0] : QString::null;
 #elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600)
 
-    /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using
-     * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because
-     * we are lazy, we recreate the old behavior. Unfortunately there is a bug
-     * in Qt 4.5.x which result in showing the native & the Qt dialog at the
-     * same time. */
-    QFileDialog dlg (aParent, Qt::Sheet);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aDir);
-    dlg.setResolveSymlinks (aResolveSymlinks);
-    dlg.setFileMode (aDirOnly ? QFileDialog::DirectoryOnly : QFileDialog::Directory);
+    /* After 4.5 exec ignores the Qt::Sheet flag.
+     * See "New Ways of Using Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why.
+     * We want the old behavior for file-save dialog. Unfortunately there is a bug in Qt 4.5.x
+     * which result in showing the native & the Qt dialog at the same time. */
+    QFileDialog dlg(aParent);
+    dlg.setWindowTitle(aCaption);
+    dlg.setDirectory(aDir);
+    dlg.setResolveSymlinks(aResolveSymlinks);
+    dlg.setFileMode(aDirOnly ? QFileDialog::DirectoryOnly : QFileDialog::Directory);
 
     QEventLoop eventLoop;
     QObject::connect(&dlg, SIGNAL(finished(int)),
                      &eventLoop, SLOT(quit()));
-    /* Use the new open call. */
     dlg.open();
     eventLoop.exec();
 
-    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles() [0] : QString::null;
+    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles().value(0, QString()) : QString();
 
 #else
 
@@ -567,30 +565,38 @@ QString QIFileDialog::getSaveFileName (const QString &aStartWith,
 
 #elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600)
 
-    /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using
-     * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because
-     * we are lazy, we recreate the old behavior. Unfortunately there is a bug
-     * in Qt 4.5.x which result in showing the native & the Qt dialog at the
-     * same time. */
-    QFileDialog dlg (aParent);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aStartWith);
-    dlg.setFilter (aFilters);
-    dlg.setFileMode (QFileDialog::QFileDialog::AnyFile);
-    dlg.setAcceptMode (QFileDialog::AcceptSave);
+    /* After 4.5 exec ignores the Qt::Sheet flag.
+     * See "New Ways of Using Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why.
+     * We want the old behavior for file-save dialog. Unfortunately there is a bug in Qt 4.5.x
+     * which result in showing the native & the Qt dialog at the same time. */
+    QFileDialog dlg(aParent);
+    dlg.setWindowTitle(aCaption);
+
+    /* Some predictive algorithm which seems missed in native code. */
+    QDir dir(aStartWith);
+    while (!dir.isRoot() && !dir.exists())
+        dir = QDir(QFileInfo(dir.absolutePath()).absolutePath());
+    const QString strDirectory = dir.absolutePath();
+    if (!strDirectory.isNull())
+        dlg.setDirectory(strDirectory);
+    if (strDirectory != aStartWith)
+        dlg.selectFile(QFileInfo(aStartWith).absoluteFilePath());
+
+    dlg.setNameFilter(aFilters);
+    dlg.setFileMode(QFileDialog::AnyFile);
+    dlg.setAcceptMode(QFileDialog::AcceptSave);
     if (aSelectedFilter)
-        dlg.selectFilter (*aSelectedFilter);
-    dlg.setResolveSymlinks (aResolveSymlinks);
-    dlg.setConfirmOverwrite (fConfirmOverwrite);
+        dlg.selectFilter(*aSelectedFilter);
+    dlg.setResolveSymlinks(aResolveSymlinks);
+    dlg.setConfirmOverwrite(fConfirmOverwrite);
 
     QEventLoop eventLoop;
     QObject::connect(&dlg, SIGNAL(finished(int)),
                      &eventLoop, SLOT(quit()));
-    /* Use the new open call. */
     dlg.open();
     eventLoop.exec();
 
-    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles().value (0, "") : QString::null;
+    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles().value(0, QString()) : QString();
 
 #else
 
@@ -816,31 +822,39 @@ QStringList QIFileDialog::getOpenFileNames (const QString &aStartWith,
 
 #elif defined (Q_WS_MAC) && (QT_VERSION >= 0x040600)
 
-    /* After 4.5 exec ignores the Qt::Sheet flag. See "New Ways of Using
-     * Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why. Because
-     * we are lazy, we recreate the old behavior. Unfortunately there is a bug
-     * in Qt 4.5.x which result in showing the native & the Qt dialog at the
-     * same time. */
-    QFileDialog dlg (aParent, Qt::Sheet);
-    dlg.setWindowTitle (aCaption);
-    dlg.setDirectory (aStartWith);
-    dlg.setNameFilter (aFilters);
+    /* After 4.5 exec ignores the Qt::Sheet flag.
+     * See "New Ways of Using Dialogs" in http://doc.trolltech.com/qq/QtQuarterly30.pdf why.
+     * We want the old behavior for file-save dialog. Unfortunately there is a bug in Qt 4.5.x
+     * which result in showing the native & the Qt dialog at the same time. */
+    QFileDialog dlg(aParent);
+    dlg.setWindowTitle(aCaption);
+
+    /* Some predictive algorithm which seems missed in native code. */
+    QDir dir(aStartWith);
+    while (!dir.isRoot() && !dir.exists())
+        dir = QDir(QFileInfo(dir.absolutePath()).absolutePath());
+    const QString strDirectory = dir.absolutePath();
+    if (!strDirectory.isNull())
+        dlg.setDirectory(strDirectory);
+    if (strDirectory != aStartWith)
+        dlg.selectFile(QFileInfo(aStartWith).absoluteFilePath());
+
+    dlg.setNameFilter(aFilters);
     if (aSingleFile)
-        dlg.setFileMode (QFileDialog::ExistingFile);
+        dlg.setFileMode(QFileDialog::ExistingFile);
     else
-        dlg.setFileMode (QFileDialog::ExistingFiles);
+        dlg.setFileMode(QFileDialog::ExistingFiles);
     if (aSelectedFilter)
-        dlg.selectFilter (*aSelectedFilter);
-    dlg.setResolveSymlinks (aResolveSymlinks);
+        dlg.selectFilter(*aSelectedFilter);
+    dlg.setResolveSymlinks(aResolveSymlinks);
 
     QEventLoop eventLoop;
     QObject::connect(&dlg, SIGNAL(finished(int)),
                      &eventLoop, SLOT(quit()));
-    /* Use the new open call. */
     dlg.open();
     eventLoop.exec();
 
-    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles() : QStringList() << QString::null;
+    return dlg.result() == QDialog::Accepted ? dlg.selectedFiles() : QStringList() << QString();
 
 #else
 
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.h
index f83dba4..75f7183 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIFileDialog.h
@@ -1,7 +1,6 @@
+/* $Id: QIFileDialog.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Qt extensions: QIFileDialog class declarations
+ * VBox Qt GUI - Qt extensions: QIFileDialog class declarations.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp
index 742d1ee..f453cbe 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.cpp
@@ -1,8 +1,6 @@
 /* $Id: QILabel.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QILabel class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QILabel class implementation.
  */
 
 /*
@@ -21,19 +19,26 @@
  * This class is based on the original QLabel implementation.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes */
-#include <QApplication>
-#include <QClipboard>
-#include <QContextMenuEvent>
-#include <QFocusEvent>
-#include <QMenu>
-#include <QMimeData>
-#include <QMouseEvent>
-#include <QPainter>
-#include <QStyleOptionFocusRect>
+# include <QApplication>
+# include <QClipboard>
+# include <QContextMenuEvent>
+# include <QFocusEvent>
+# include <QMenu>
+# include <QMimeData>
+# include <QMouseEvent>
+# include <QPainter>
+# include <QStyleOptionFocusRect>
 
 /* Local includes */
-#include "QILabel.h"
+# include "QILabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Some constant regular expressions */
 const QRegExp QILabel::mCopyRegExp = QRegExp ("<[^>]*>");
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.h b/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.h
index 8f2b045..d7eb4aa 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QILabel.h
@@ -1,7 +1,6 @@
+/* $Id: QILabel.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QILabel class declaration
+ * VBox Qt GUI - Qt extensions: QILabel class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.cpp
index 0b16d1b..1d1c5d1 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.cpp
@@ -1,8 +1,6 @@
 /* $Id: QILabelSeparator.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QILabelSeparator class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QILabelSeparator class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes */
-#include <QLabel>
-#include <QHBoxLayout>
+# include <QLabel>
+# include <QHBoxLayout>
 
 /* Local includes */
-#include "QILabelSeparator.h"
+# include "QILabelSeparator.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 QILabelSeparator::QILabelSeparator (QWidget *aParent /* = NULL */, Qt::WindowFlags aFlags /* = 0 */)
     : QWidget (aParent, aFlags)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.h b/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.h
index 157961e..d23e8bf 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QILabelSeparator.h
@@ -1,7 +1,6 @@
+/* $Id: QILabelSeparator.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QILabelSeparator class declaration
+ * VBox Qt GUI - Qt extensions: QILabelSeparator class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp
index 0fea289..4650364 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.cpp
@@ -15,20 +15,28 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#include "QILineEdit.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+# include "QILineEdit.h"
 
 /* Qt includes */
-#include <QStyleOptionFrame>
+# ifdef Q_WS_WIN32
+#  include <QLibrary>
 
-#if defined (Q_WS_WIN32)
+#  include <Windows.h>
+#  include "iprt/ldr.h"
+# endif
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QStyleOptionFrame>
+#ifdef Q_WS_WIN32
 # include <QWindowsVistaStyle>
-# include <QLibrary>
-#endif
-#if defined (Q_WS_WIN32)
-# include <Windows.h>
-# include "iprt/ldr.h"
 #endif
 
+
 void QILineEdit::setMinimumWidthByText (const QString &aText)
 {
     setMinimumWidth (featTextWidth (aText).width());
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h b/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h
index 13ce7f0..ecdef0e 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QILineEdit.h
@@ -1,7 +1,6 @@
+/* $Id: QILineEdit.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QILineEdit class declarations
+ * VBox Qt GUI - QILineEdit class declarations.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIListView.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIListView.cpp
index 7a7351a..88eea6b 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIListView.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIListView.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIListView.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIListView, QIItemDelegate class implementation
+ * VBox Qt GUI - QIListView, QIItemDelegate class implementation.
  */
 
 /*
@@ -17,16 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#if MAC_LEOPARD_STYLE
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-# include <QPainter>
-# include <QApplication>
+# if MAC_LEOPARD_STYLE
+#  include <QPainter>
+#  include <QApplication>
+# endif /* MAC_LEOPARD_STYLE */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#if MAC_LEOPARD_STYLE
 # include <qmacstyle_mac.h>
 #endif /* MAC_LEOPARD_STYLE */
 
 /* GUI includes: */
 #include "QIListView.h"
 
+
 QIListView::QIListView (QWidget *aParent /* = 0 */)
     :QListView (aParent)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIListView.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIListView.h
index 6e646aa..29ea554 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIListView.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIListView.h
@@ -1,7 +1,6 @@
+/* $Id: QIListView.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIListView, QIItemDelegate class declarations
+ * VBox Qt GUI - QIListView, QIItemDelegate class declarations.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp
index a5f9fce..6ee8faa 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.cpp
@@ -1,12 +1,10 @@
 /* $Id: QIMainDialog.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIMainDialog class implementation
+ * VBox Qt GUI - Qt extensions: QIMainDialog class implementation.
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,228 +15,193 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#include "QIMainDialog.h"
-#include "VBoxUtils.h"
-#include "VBoxGlobal.h"
-
-#include <iprt/assert.h>
-
-/* Qt includes */
-#include <QProcess>
-#include <QEventLoop>
-#include <QApplication>
-#include <QDir>
-#include <QUrl>
-#include <QMenu>
-#include <QSizeGrip>
-#include <QPushButton>
-#include <QDialogButtonBox>
-
-QIMainDialog::QIMainDialog (QWidget *aParent /* = 0 */,
-                            Qt::WindowFlags aFlags /* = Qt::Dialog */)
-    : QMainWindow (aParent, aFlags)
-    , mRescode (QDialog::Rejected)
-    , mPolished (false)
-    , mIsAutoCentering (true)
-    , mCenterWidget (aParent)
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QDir>
+# include <QUrl>
+# include <QMenu>
+# include <QProcess>
+# include <QSizeGrip>
+# include <QEventLoop>
+# include <QPushButton>
+# include <QApplication>
+# include <QDialogButtonBox>
+
+/* GUI includes: */
+# include "QIMainDialog.h"
+# include "VBoxGlobal.h"
+# include "VBoxUtils.h"
+
+/* Other VBox includes: */
+# include <iprt/assert.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+QIMainDialog::QIMainDialog(QWidget *pParent /* = 0 */,
+                           Qt::WindowFlags enmFlags /* = Qt::Dialog */,
+                           bool fIsAutoCentering /* = true */)
+    : QMainWindow(pParent, enmFlags)
+    , m_fIsAutoCentering(fIsAutoCentering)
+    , m_fPolished(false)
+    , m_enmResult(QDialog::Rejected)
 {
-    qApp->installEventFilter (this);
+    /* Install event-filter: */
+    qApp->installEventFilter(this);
 }
 
-QDialog::DialogCode QIMainDialog::exec()
+QDialog::DialogCode QIMainDialog::exec(bool fApplicationModal /* = true */)
 {
     /* Check for the recursive run: */
-    AssertMsg(!mEventLoop, ("QIMainDialog::exec() is called recursively!\n"));
+    AssertMsgReturn(!m_pEventLoop, ("QIMainDialog::exec() is called recursively!\n"), QDialog::Rejected);
 
     /* Reset the result code: */
     setResult(QDialog::Rejected);
 
-    /* Tune some attributes: */
-    bool fDeleteOnClose = testAttribute(Qt::WA_DeleteOnClose); NOREF(fDeleteOnClose);
-    AssertMsg(!fDeleteOnClose, ("QIMainDialog is NOT supposed to be run in 'delete-on-close' mode!"));
+    /* Should we delete ourself on close in theory? */
+    const bool fOldDeleteOnClose = testAttribute(Qt::WA_DeleteOnClose);
+    /* For the exec() time, set this attribute to 'false': */
     setAttribute(Qt::WA_DeleteOnClose, false);
-    bool fWasShowModal = testAttribute(Qt::WA_ShowModal);
-    setAttribute(Qt::WA_ShowModal, true);
 
-    /* Create a local event-loop: */
-    QEventLoop eventLoop;
-    mEventLoop = &eventLoop;
-    /* Show the window: */
+    /* Which is the current window-modality? */
+    const Qt::WindowModality oldModality = windowModality();
+    /* For the exec() time, set this attribute to 'window-modal' or 'application-modal': */
+    setWindowModality(!fApplicationModal ? Qt::WindowModal : Qt::ApplicationModal);
+
+    /* Show ourself: */
     show();
-    /* A guard to ourself for the case we destroy ourself: */
-    QPointer<QIMainDialog> guard = this;
-    /* Start the event-loop: */
-    eventLoop.exec();
-    /* Check if dialog is still valid: */
-    if (guard.isNull())
-        return QDialog::Rejected;
-    mEventLoop = 0;
-    /* Prepare result: */
-    QDialog::DialogCode res = result();
-    /* Restore old show-modal attribute: */
-    setAttribute(Qt::WA_ShowModal, fWasShowModal);
-    /* Return the final result: */
-    return res;
+
+    /* Create a local event-loop: */
+    {
+        QEventLoop eventLoop;
+        m_pEventLoop = &eventLoop;
+
+        /* Guard ourself for the case
+         * we destroyed ourself in our event-loop: */
+        QPointer<QIMainDialog> guard = this;
+
+        /* Start the blocking event-loop: */
+        eventLoop.exec();
+
+        /* Are we still valid? */
+        if (guard.isNull())
+            return QDialog::Rejected;
+
+        m_pEventLoop = 0;
+    }
+
+    /* Save the result code early (we can delete ourself on close): */
+    const QDialog::DialogCode enmResultCode = result();
+
+    /* Return old modality: */
+    setWindowModality(oldModality);
+
+    /* Reset attribute to previous value: */
+    setAttribute(Qt::WA_DeleteOnClose, fOldDeleteOnClose);
+    /* Delete ourself if we should do that on close: */
+    if (fOldDeleteOnClose)
+        delete this;
+
+    /* Return the result code: */
+    return enmResultCode;
 }
 
-QDialog::DialogCode QIMainDialog::result() const
+QPushButton* QIMainDialog::defaultButton() const
 {
-    return mRescode;
+    return m_pDefaultButton;
 }
 
-void QIMainDialog::setFileForProxyIcon (const QString& aFile)
+void QIMainDialog::setDefaultButton(QPushButton *pButton)
 {
-    mFileForProxyIcon = aFile;
+    m_pDefaultButton = pButton;
 }
 
-QString QIMainDialog::fileForProxyIcon() const
+bool QIMainDialog::isSizeGripEnabled() const
 {
-    return mFileForProxyIcon;
+    return m_pSizeGrip;
 }
 
-void QIMainDialog::setSizeGripEnabled (bool aEnabled)
+void QIMainDialog::setSizeGripEnabled(bool fEnabled)
 {
-    if (!mSizeGrip && aEnabled)
+    /* Create if missed: */
+    if (!m_pSizeGrip && fEnabled)
     {
-        mSizeGrip = new QSizeGrip (this);
-        mSizeGrip->resize (mSizeGrip->sizeHint());
-        mSizeGrip->show();
+        m_pSizeGrip = new QSizeGrip(this);
+        m_pSizeGrip->resize(m_pSizeGrip->sizeHint());
+        m_pSizeGrip->show();
+    }
+    /* Destroy if present: */
+    else if (m_pSizeGrip && !fEnabled)
+    {
+        delete m_pSizeGrip;
+        m_pSizeGrip = 0;
     }
-    else if (mSizeGrip && !aEnabled)
-        delete mSizeGrip;
 }
 
-bool QIMainDialog::isSizeGripEnabled() const
+void QIMainDialog::setVisible(bool fVisible)
 {
-    return mSizeGrip;
-}
+    /* Call to base-class: */
+    QMainWindow::setVisible(fVisible);
 
-void QIMainDialog::setDefaultButton (QPushButton* aButton)
-{
-    mDefaultButton = aButton;
+    /* Exit from the event-loop if there is any and
+     * we are changing our state from visible to hidden. */
+    if (m_pEventLoop && !fVisible)
+        m_pEventLoop->exit();
 }
 
-QPushButton* QIMainDialog::defaultButton() const
+bool QIMainDialog::event(QEvent *pEvent)
 {
-    return mDefaultButton;
-}
+    /* Depending on event-type: */
+    switch (pEvent->type())
+    {
+        case QEvent::Polish:
+        {
+            /* Initially search for the default-button: */
+            m_pDefaultButton = searchDefaultButton();
+            break;
+        }
+        default:
+            break;
+    }
 
-void QIMainDialog::setAutoCenteringEnabled(bool fIsAutoCentering)
-{
-    mIsAutoCentering = fIsAutoCentering;
+    /* Call to base-class: */
+    return QMainWindow::event(pEvent);
 }
 
-void QIMainDialog::setVisible (bool aVisible)
+void QIMainDialog::showEvent(QShowEvent *pEvent)
 {
-    QMainWindow::setVisible (aVisible);
-    /* Exit from the event loop if there is any and we are changing our state
-     * from visible to invisible. */
-    if (mEventLoop && !aVisible)
-        mEventLoop->exit();
-}
+    /* Make sure we should polish dialog: */
+    if (m_fPolished)
+        return;
 
-bool QIMainDialog::event (QEvent *aEvent)
-{
-     switch (aEvent->type())
-     {
-#ifdef Q_WS_MAC
-          case QEvent::IconDrag:
-          {
-              Qt::KeyboardModifiers currentModifiers = qApp->keyboardModifiers();
-
-              if (currentModifiers == Qt::NoModifier)
-              {
-                  if (!mFileForProxyIcon.isEmpty())
-                  {
-                      aEvent->accept();
-                      /* Create a drag object we can use */
-                      QDrag *drag = new QDrag (this);
-                      QMimeData *data = new QMimeData();
-                      /* Set the appropriate url data */
-                      data->setUrls (QList<QUrl>() << QUrl::fromLocalFile (mFileForProxyIcon));
-                      drag->setMimeData (data);
-                      /* Make a nice looking DnD icon */
-                      QFileInfo fi (mFileForProxyIcon);
-                      QPixmap cursorPixmap (::darwinCreateDragPixmap (QPixmap (windowIcon().pixmap (16, 16)), fi.fileName()));
-                      drag->setPixmap (cursorPixmap);
-                      drag->setHotSpot (QPoint (5, cursorPixmap.height() - 5));
-                      /* Start the DnD action */
-                      drag->start (Qt::LinkAction | Qt::CopyAction);
-                      return true;
-                  }
-              }
-              else if (currentModifiers == Qt::ControlModifier)
-              {
-                  if (!mFileForProxyIcon.isEmpty())
-                  {
-                      aEvent->accept();
-                      /* Create the proxy icon menu */
-                      QMenu menu (this);
-                      connect (&menu, SIGNAL (triggered (QAction*)),
-                               this, SLOT (openAction (QAction*)));
-                      /* Add the file with the disk icon to the menu */
-                      QFileInfo fi (mFileForProxyIcon);
-                      QAction *action = menu.addAction (fi.fileName());
-                      action->setIcon (windowIcon());
-                      /* Create some nice looking menu out of the other
-                       * directory parts. */
-                      QDir dir (fi.absolutePath());
-                      do
-                      {
-                          if (dir.isRoot())
-                              action = menu.addAction ("/");
-                          else
-                              action = menu.addAction (dir.dirName());
-                          action->setIcon (vboxGlobal().icon(QFileInfo (dir, "")));
-                      }
-                      while (dir.cdUp());
-                      /* Show the menu */
-                      menu.exec (QPoint (QCursor::pos().x() - 20, frameGeometry().y() - 5));
-                      return true;
-                  }
-              }
-              break;
-          }
-#endif /* Q_WS_MAC */
-          case QEvent::Polish:
-          {
-              /* Initially search for the default button. */
-              mDefaultButton = searchDefaultButton();
-              break;
-          }
-          default:
-              break;
-     }
-     return QMainWindow::event (aEvent);
+    /* Call to polish-event: */
+    polishEvent(pEvent);
+
+    /* Mark dialog as polished: */
+    m_fPolished = true;
 }
 
-void QIMainDialog::showEvent (QShowEvent *aEvent)
+void QIMainDialog::polishEvent(QShowEvent*)
 {
-    QMainWindow::showEvent (aEvent);
-
-    /* Polishing border */
-    if (mPolished)
-        return;
-    mPolished = true;
-
-    /* Explicit widget centering relatively to it's centering
-     * widget if any or desktop if centering widget is missed. */
-    if (mIsAutoCentering)
-        VBoxGlobal::centerWidget (this, mCenterWidget, false);
+    /* Explicit centering according to our parent: */
+    if (m_fIsAutoCentering)
+        VBoxGlobal::centerWidget(this, parentWidget(), false);
 }
 
-void QIMainDialog::resizeEvent (QResizeEvent *aEvent)
+void QIMainDialog::resizeEvent(QResizeEvent *pEvent)
 {
-    QMainWindow::resizeEvent (aEvent);
+    /* Call to base-class: */
+    QMainWindow::resizeEvent(pEvent);
 
-    /* Adjust the size-grip location for the current resize event */
-    if (mSizeGrip)
+    /* Adjust the size-grip location for the current resize event: */
+    if (m_pSizeGrip)
     {
         if (isRightToLeft())
-            mSizeGrip->move (rect().bottomLeft() - mSizeGrip->rect().bottomLeft());
+            m_pSizeGrip->move(rect().bottomLeft() - m_pSizeGrip->rect().bottomLeft());
         else
-            mSizeGrip->move (rect().bottomRight() - mSizeGrip->rect().bottomRight());
-        aEvent->accept();
+            m_pSizeGrip->move(rect().bottomRight() - m_pSizeGrip->rect().bottomRight());
     }
 }
 
@@ -296,110 +259,78 @@ void QIMainDialog::keyPressEvent(QKeyEvent *pEvent)
         /* Default handling for others: */
         default: break;
     }
+
     /* Call to base-class: */
     return QMainWindow::keyPressEvent(pEvent);
 }
 
-bool QIMainDialog::eventFilter (QObject *aObject, QEvent *aEvent)
+bool QIMainDialog::eventFilter(QObject *pObject, QEvent *pEvent)
 {
+    /* Skip for inactive window: */
     if (!isActiveWindow())
-        return QMainWindow::eventFilter (aObject, aEvent);
+        return QMainWindow::eventFilter(pObject, pEvent);
 
-    if (qobject_cast<QWidget*> (aObject) &&
-        qobject_cast<QWidget*> (aObject)->window() != this)
-        return QMainWindow::eventFilter (aObject, aEvent);
+    /* Skip for children of other than this one window: */
+    if (qobject_cast<QWidget*>(pObject) &&
+        qobject_cast<QWidget*>(pObject)->window() != this)
+        return QMainWindow::eventFilter(pObject, pEvent);
 
-    switch (aEvent->type())
+    /* Depending on event-type: */
+    switch (pEvent->type())
     {
-        /* Auto-default button focus-in processor used to move the "default"
+        /* Auto-default-button focus-in processor used to move the "default"
          * button property into the currently focused button. */
         case QEvent::FocusIn:
         {
-            if (qobject_cast<QPushButton*> (aObject) &&
-                (aObject->parent() == centralWidget() ||
-                 qobject_cast<QDialogButtonBox*> (aObject->parent())))
+            if (qobject_cast<QPushButton*>(pObject) &&
+                (pObject->parent() == centralWidget() ||
+                 qobject_cast<QDialogButtonBox*>(pObject->parent())))
             {
-                qobject_cast<QPushButton*> (aObject)->setDefault (aObject != mDefaultButton);
-                if (mDefaultButton)
-                    mDefaultButton->setDefault (aObject == mDefaultButton);
+                qobject_cast<QPushButton*>(pObject)->setDefault(pObject != m_pDefaultButton);
+                if (m_pDefaultButton)
+                    m_pDefaultButton->setDefault(pObject == m_pDefaultButton);
             }
             break;
         }
-        /* Auto-default button focus-out processor used to remove the "default"
+        /* Auto-default-button focus-out processor used to remove the "default"
          * button property from the previously focused button. */
         case QEvent::FocusOut:
         {
-            if (qobject_cast<QPushButton*> (aObject) &&
-                (aObject->parent() == centralWidget() ||
-                 qobject_cast<QDialogButtonBox*> (aObject->parent())))
+            if (qobject_cast<QPushButton*>(pObject) &&
+                (pObject->parent() == centralWidget() ||
+                 qobject_cast<QDialogButtonBox*>(pObject->parent())))
             {
-                if (mDefaultButton)
-                    mDefaultButton->setDefault (aObject != mDefaultButton);
-                qobject_cast<QPushButton*> (aObject)->setDefault (aObject == mDefaultButton);
+                if (m_pDefaultButton)
+                    m_pDefaultButton->setDefault(pObject != m_pDefaultButton);
+                qobject_cast<QPushButton*>(pObject)->setDefault(pObject == m_pDefaultButton);
             }
             break;
         }
         default:
             break;
     }
-    return QMainWindow::eventFilter (aObject, aEvent);
-}
-
-QPushButton* QIMainDialog::searchDefaultButton() const
-{
-    /* Search for the first default button in the dialog. */
-    QList<QPushButton*> list = qFindChildren<QPushButton*> (this);
-    foreach (QPushButton *button, list)
-        if (button->isDefault() &&
-            (button->parent() == centralWidget() ||
-             qobject_cast<QDialogButtonBox*> (button->parent())))
-            return button;
-    return NULL;
-}
 
-
-void QIMainDialog::accept()
-{
-    done (QDialog::Accepted);
+    /* Call to base-class: */
+    return QMainWindow::eventFilter(pObject, pEvent);
 }
 
-void QIMainDialog::reject()
+QPushButton* QIMainDialog::searchDefaultButton() const
 {
-    done (QDialog::Rejected);
+    /* Search for the first default-button in the dialog: */
+    QList<QPushButton*> list = qFindChildren<QPushButton*>(this);
+    foreach (QPushButton *pButton, list)
+        if (pButton->isDefault() &&
+            (pButton->parent() == centralWidget() ||
+             qobject_cast<QDialogButtonBox*>(pButton->parent())))
+            return pButton;
+    return 0;
 }
 
-void QIMainDialog::done (QDialog::DialogCode aResult)
+void QIMainDialog::done(QDialog::DialogCode enmResult)
 {
-    /* Set the final result */
-    setResult (aResult);
-    /* Hide this window */
+    /* Set the final result: */
+    setResult(enmResult);
+    /* Hide: */
     hide();
-    /* And close the window */
-    close();
-}
-
-void QIMainDialog::setResult (QDialog::DialogCode aRescode)
-{
-    mRescode = aRescode;
-}
-
-void QIMainDialog::openAction (QAction *aAction)
-{
-#ifdef Q_WS_MAC
-    if (!mFileForProxyIcon.isEmpty())
-    {
-        QString path = mFileForProxyIcon.left (mFileForProxyIcon.indexOf (aAction->text())) + aAction->text();
-        /* Check for the first item */
-        if (mFileForProxyIcon != path)
-        {
-            /* @todo: vboxGlobal().openURL (path); should be able to open paths */
-            QProcess process;
-            process.start ("/usr/bin/open", QStringList() << path, QIODevice::ReadOnly);
-            process.waitForFinished();
-        }
-    }
-#else /* Q_WS_MAC */
-    NOREF (aAction);
-#endif /* Q_WS_MAC */
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h
index 29487be..c98a4ea 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIMainDialog.h
@@ -1,11 +1,10 @@
+/* $Id: QIMainDialog.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIMainDialog class implementation
+ * VBox Qt GUI - Qt extensions: QIMainDialog class implementation.
  */
 
 /*
- * Copyright (C) 2008-2010 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,80 +15,104 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __QIMainDialog_h__
-#define __QIMainDialog_h__
+#ifndef ___QIMainDialog_h___
+#define ___QIMainDialog_h___
 
-/* Qt includes */
+/* Qt includes: */
 #include <QMainWindow>
-#include <QDialog>
 #include <QPointer>
+#include <QDialog>
 
+/* Forward declarations: */
+class QPushButton;
 class QEventLoop;
 class QSizeGrip;
 
+/** QDialog analog based on QMainWindow. */
 class QIMainDialog: public QMainWindow
 {
     Q_OBJECT;
 
 public:
 
-    QIMainDialog (QWidget *aParent = 0, Qt::WindowFlags aFlags = Qt::Dialog);
-
-    QDialog::DialogCode exec();
-    QDialog::DialogCode result() const;
+    /** Constructor.
+      * @param pParent           holds the parent widget passed to the base-class,
+      * @param enmFlags          holds the cumulative window flags passed to the base-class,
+      * @param fIsAutoCentering  defines whether this dialog should be centered according it's parent. */
+    QIMainDialog(QWidget *pParent = 0,
+                 Qt::WindowFlags enmFlags = Qt::Dialog,
+                 bool fIsAutoCentering = true);
 
-    void setFileForProxyIcon (const QString &aFile);
-    QString fileForProxyIcon () const;
+    /** Returns the dialog's result code. */
+    QDialog::DialogCode result() const { return m_enmResult; }
 
-    void setSizeGripEnabled (bool aEnabled);
-    bool isSizeGripEnabled () const;
+    /** Executes the dialog, launching local event-loop.
+      * @param fApplicationModal defines whether this dialog should be modal to application or window. */
+    QDialog::DialogCode exec(bool fApplicationModal = true);
 
-    void setDefaultButton (QPushButton *aButton);
-    QPushButton* defaultButton () const;
+    /** Returns dialog's default-button. */
+    QPushButton* defaultButton() const;
+    /** Defines dialog's default-button. */
+    void setDefaultButton(QPushButton *pButton);
 
-    void setAutoCenteringEnabled(bool fIsAutoCentering);
+    /** Returns whether size-grip was enabled for that dialog. */
+    bool isSizeGripEnabled() const;
+    /** Defines whether size-grip should be @a fEnabled for that dialog. */
+    void setSizeGripEnabled(bool fEnabled);
 
 public slots:
 
-    virtual void setVisible (bool aVisible);
+    /** Defines whether the dialog is @a fVisible. */
+    virtual void setVisible(bool fVisible);
 
 protected:
 
-    virtual bool event (QEvent *aEvent);
-    virtual void showEvent (QShowEvent *aEvent);
-    virtual void resizeEvent (QResizeEvent *aEvent);
+    /** General event handler. */
+    virtual bool event(QEvent *pEvent);
+    /** Show event handler. */
+    virtual void showEvent(QShowEvent *pEvent);
+    /** Our own polish event handler. */
+    virtual void polishEvent(QShowEvent *pEvent);
+    /** Resize event handler. */
+    virtual void resizeEvent(QResizeEvent *pEvent);
+    /** Key-press event handler. */
     virtual void keyPressEvent(QKeyEvent *pEvent);
-    virtual bool eventFilter (QObject *aObject, QEvent *aEvent);
+    /** General event filter. */
+    virtual bool eventFilter(QObject *aObject, QEvent *pEvent);
 
+    /** Function to search for dialog's default-button. */
     QPushButton* searchDefaultButton() const;
 
-    void centerAccording (QWidget *aWidget) { mCenterWidget = aWidget; }
-
 protected slots:
 
-    virtual void accept();
-    virtual void reject();
-
-    void done (QDialog::DialogCode aRescode);
-    void setResult (QDialog::DialogCode aRescode);
+    /** Sets the modal dialog's result code to @a enmResult. */
+    void setResult(QDialog::DialogCode enmResult) { m_enmResult = enmResult; }
 
-    void openAction (QAction *aAction);
+    /** Closes the modal dialog and sets its result code to @a enmResult.
+      * If this dialog is shown with exec(), done() causes the local
+      * event-loop to finish, and exec() to return @a enmResult. */
+    virtual void done(QDialog::DialogCode enmResult);
+    /** Hides the modal dialog and sets the result code to Accepted. */
+    virtual void accept() { done(QDialog::Accepted); }
+    /** Hides the modal dialog and sets the result code to Rejected. */
+    virtual void reject() { done(QDialog::Rejected); }
 
 private:
 
-    /* Private member vars */
-    QDialog::DialogCode mRescode;
-    QPointer<QEventLoop> mEventLoop;
+    /** Holds whether this dialog should be centered according it's parent. */
+    const bool m_fIsAutoCentering;
+    /** Holds whether this dialog is polished. */
+    bool m_fPolished;
 
-    QString mFileForProxyIcon;
+    /** Holds modal dialog's result code. */
+    QDialog::DialogCode m_enmResult;
+    /** Holds modal dialog's event-loop. */
+    QPointer<QEventLoop> m_pEventLoop;
 
-    QPointer<QSizeGrip> mSizeGrip;
-    QPointer<QPushButton> mDefaultButton;
-
-    bool mPolished;
-    bool mIsAutoCentering;
-    QWidget *mCenterWidget;
+    /** Holds dialog's default-button. */
+    QPointer<QPushButton> m_pDefaultButton;
+    /** Holds dialog's size-grip. */
+    QPointer<QSizeGrip> m_pSizeGrip;
 };
 
-#endif /* __QIMainDialog_h__ */
-
+#endif /* !___QIMainDialog_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIMenu.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIMenu.cpp
new file mode 100644
index 0000000..4cf684b
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIMenu.cpp
@@ -0,0 +1,40 @@
+/* $Id: QIMenu.cpp $ */
+/** @file
+ * VBox Qt GUI - QIMenu class implementation.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else
+/* GUI includes: */
+# include "QIMenu.h"
+#endif
+
+
+QIMenu::QIMenu(QWidget *pParent /* = 0 */)
+    : QMenu(pParent)
+{
+}
+
+void QIMenu::sltHighlightFirstAction()
+{
+#ifdef Q_WS_WIN
+    /* Windows host requires window-activation: */
+    activateWindow();
+#endif /* Q_WS_WIN */
+    /* Focus next child: */
+    QMenu::focusNextChild();
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIMenu.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIMenu.h
new file mode 100644
index 0000000..9232313
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIMenu.h
@@ -0,0 +1,41 @@
+/* $Id: QIMenu.h $ */
+/** @file
+ * VBox Qt GUI - QIMenu class declaration.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___QIMenu_h___
+#define ___QIMenu_h___
+
+/* Qt includes: */
+#include <QMenu>
+
+/** QMenu extension
+  * which allows to highlight first menu item for popped up menu. */
+class QIMenu : public QMenu
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pParent to the QMenu constructor. */
+    QIMenu(QWidget *pParent = 0);
+
+private slots:
+
+    /** Highlights first menu action for popped up menu. */
+    void sltHighlightFirstAction();
+};
+
+#endif /* !___QIMenu_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp
index 34a25f8..13e9ccf 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp
@@ -1,12 +1,10 @@
 /* $Id: QIMessageBox.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIMessageBox class implementation
+ * VBox Qt GUI - QIMessageBox class implementation.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,64 +15,81 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QClipboard>
-#include <QLabel>
-#include <QTextEdit>
-#include <QCheckBox>
-#include <QPushButton>
+# include <QVBoxLayout>
+# include <QHBoxLayout>
+# include <QClipboard>
+# include <QLabel>
+# include <QCheckBox>
+# include <QPushButton>
+# include <QStyle>
 
 /* GUI includes: */
-#include "QIMessageBox.h"
-#include "UIIconPool.h"
-#include "QILabel.h"
-#include "QIArrowSplitter.h"
-#include "QIDialogButtonBox.h"
+# include "QIMessageBox.h"
+# include "QILabel.h"
+# include "QIArrowSplitter.h"
+# include "QIDialogButtonBox.h"
+# include "UIIconPool.h"
 
 /* Other VBox includes: */
-#include <VBox/sup.h>
+# include <iprt/assert.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-QIMessageBox::QIMessageBox(const QString &strCaption, const QString &strMessage, AlertIconType iconType,
+
+QIMessageBox::QIMessageBox(const QString &strTitle, const QString &strMessage, AlertIconType iconType,
                            int iButton1 /* = 0*/, int iButton2 /* = 0*/, int iButton3 /* = 0*/, QWidget *pParent /* = 0*/)
     : QIDialog(pParent)
+    , m_strTitle(strTitle)
+    , m_iconType(iconType)
+    , m_pLabelIcon(0)
+    , m_strMessage(strMessage)
+    , m_pLabelText(0)
+    , m_pFlagCheckBox(0)
+    , m_pDetailsContainer(0)
     , m_iButton1(iButton1)
     , m_iButton2(iButton2)
     , m_iButton3(iButton3)
     , m_iButtonEsc(0)
-    , m_iconType(iconType)
-    , m_strMessage(strMessage)
-    , m_iDetailsIndex(-1)
+    , m_pButton1(0)
+    , m_pButton2(0)
+    , m_pButton3(0)
+    , m_pButtonBox(0)
     , m_fDone(false)
 {
-    /* Set caption: */
-    setWindowTitle(strCaption);
-
-    /* Prepare content: */
-    prepareContent();
-}
-
-QString QIMessageBox::detailsText() const
-{
-    /* Return in html format: */
-    return m_pDetailsTextView->toHtml();
+    /* Prepare: */
+    prepare();
 }
 
 void QIMessageBox::setDetailsText(const QString &strText)
 {
+    /* Make sure details-text is NOT empty: */
+    AssertReturnVoid(!strText.isEmpty());
+
     /* Split details into paragraphs: */
-    AssertMsg(!strText.isEmpty(), ("Details text should NOT be empty!"));
     QStringList paragraphs(strText.split("<!--EOP-->", QString::SkipEmptyParts));
-    AssertMsg(paragraphs.size() != 0, ("There should be at least one paragraph."));
-    /* Populate details list: */
+    /* Make sure details-text has at least one paragraph: */
+    AssertReturnVoid(!paragraphs.isEmpty());
+
+    /* Enumerate all the paragraphs: */
+    QStringPairList details;
     foreach (const QString &strParagraph, paragraphs)
     {
+        /* Split each paragraph into pairs: */
         QStringList parts(strParagraph.split("<!--EOM-->", QString::KeepEmptyParts));
-        AssertMsg(parts.size() == 2, ("Each paragraph should consist of 2 parts."));
-        m_details << QPair<QString, QString>(parts[0], parts[1]);
+        /* Make sure each paragraph consist of 2 parts: */
+        AssertReturnVoid(parts.size() == 2);
+        /* Append each pair into details-list: */
+        details << QStringPair(parts[0], parts[1]);
     }
-    /* Update details container: */
+
+    /* Pass details-list to details-container: */
+    m_pDetailsContainer->setDetails(details);
+    /* Update details-container finally: */
     updateDetailsContainer();
 }
 
@@ -88,31 +103,14 @@ void QIMessageBox::setFlagChecked(bool fChecked)
     m_pFlagCheckBox->setChecked(fChecked);
 }
 
-QString QIMessageBox::flagText() const
+void QIMessageBox::setFlagText(const QString &strFlagText)
 {
-    return m_pFlagCheckBox->text();
-}
-
-void QIMessageBox::setFlagText(const QString &strText)
-{
-    /* Set check-box text: */
-    m_pFlagCheckBox->setText(strText);
-    /* And update check-box finally: */
+    /* Pass text to flag check-box: */
+    m_pFlagCheckBox->setText(strFlagText);
+    /* Update flag check-box finally: */
     updateCheckBox();
 }
 
-QString QIMessageBox::buttonText(int iButton) const
-{
-    switch (iButton)
-    {
-        case 0: if (m_pButton1) return m_pButton1->text(); break;
-        case 1: if (m_pButton2) return m_pButton2->text(); break;
-        case 2: if (m_pButton3) return m_pButton3->text(); break;
-        default: break;
-    }
-    return QString();
-}
-
 void QIMessageBox::setButtonText(int iButton, const QString &strText)
 {
     switch (iButton)
@@ -124,81 +122,53 @@ void QIMessageBox::setButtonText(int iButton, const QString &strText)
     }
 }
 
-void QIMessageBox::reject()
+void QIMessageBox::sltUpdateSize()
 {
-    if (m_iButtonEsc)
-    {
-        QDialog::reject();
-        setResult(m_iButtonEsc & AlertButtonMask);
-    }
+    /* Fix minimum possible size: */
+    setFixedSize(minimumSizeHint());
 }
 
-void QIMessageBox::copy() const
+void QIMessageBox::sltCopy() const
 {
     /* Create the error string with all errors. First the html version. */
     QString strError = "<html><body><p>" + m_strMessage + "</p>";
-    for (int i = 0; i < m_details.size(); ++i)
-        strError += m_details.at(i).first + m_details.at(i).second + "<br>";
+    foreach (const QStringPair &pair, m_pDetailsContainer->details())
+        strError += pair.first + pair.second + "<br>";
     strError += "</body></html>";
     strError.remove(QRegExp("</+qt>"));
     strError = strError.replace(QRegExp(" "), " ");
     /* Create a new mime data object holding both the html and the plain text version. */
-    QMimeData *pMd = new QMimeData();
-    pMd->setHtml(strError);
+    QMimeData *pMimeData = new QMimeData();
+    pMimeData->setHtml(strError);
     /* Replace all the html entities. */
     strError = strError.replace(QRegExp("<br>|</tr>"), "\n");
     strError = strError.replace(QRegExp("</p>"), "\n\n");
     strError = strError.remove(QRegExp("<[^>]*>"));
-    pMd->setText(strError);
+    pMimeData->setText(strError);
     /* Add the mime data to the global clipboard. */
     QClipboard *pClipboard = QApplication::clipboard();
-    pClipboard->setMimeData(pMd);
-}
-
-void QIMessageBox::detailsBack()
-{
-    /* Make sure details-page index feats the bounds: */
-    if (m_iDetailsIndex <= 0)
-        return;
-
-    /* Advance the page index: */
-    --m_iDetailsIndex;
-    /* Update details-page: */
-    updateDetailsPage();
-}
-
-void QIMessageBox::detailsNext()
-{
-    /* Make sure details-page index feats the bounds: */
-    if (m_iDetailsIndex >= m_details.size() - 1)
-        return;
-
-    /* Advance the page index: */
-    ++m_iDetailsIndex;
-    /* Update details-page: */
-    updateDetailsPage();
+    pClipboard->setMimeData(pMimeData);
 }
 
-void QIMessageBox::sltUpdateSize()
+void QIMessageBox::reject()
 {
-    /* Reactivate all the layouts: */
-    QList<QLayout*> layouts = findChildren<QLayout*>();
-    foreach (QLayout *pLayout, layouts)
+    if (m_iButtonEsc)
     {
-        pLayout->update();
-        pLayout->activate();
+        QDialog::reject();
+        setResult(m_iButtonEsc & AlertButtonMask);
     }
-    QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
-    /* And fix the size to the minimum possible: */
-    setFixedSize(minimumSizeHint());
 }
 
-void QIMessageBox::prepareContent()
+void QIMessageBox::prepare()
 {
+    /* Set caption: */
+    setWindowTitle(m_strTitle);
+
     /* Create main-layout: */
     QVBoxLayout *pMainLayout = new QVBoxLayout(this);
+    AssertPtrReturnVoid(pMainLayout);
     {
-        /* Configure layout: */
+        /* Configure main-layout: */
 #ifdef Q_WS_MAC
         pMainLayout->setContentsMargins(40, 11, 40, 11);
         pMainLayout->setSpacing(15);
@@ -208,90 +178,84 @@ void QIMessageBox::prepareContent()
 #endif /* !Q_WS_MAC */
         /* Create top-layout: */
         QHBoxLayout *pTopLayout = new QHBoxLayout;
+        AssertPtrReturnVoid(pTopLayout);
         {
-            /* Insert into parent layout: */
-            pMainLayout->addLayout(pTopLayout);
-            /* Configure layout: */
+            /* Configure top-layout: */
             pTopLayout->setContentsMargins(0, 0, 0, 0);
             pTopLayout->setSpacing(10);
             /* Create icon-label: */
-            m_pIconLabel = new QLabel;
+            m_pLabelIcon = new QLabel;
+            AssertPtrReturnVoid(m_pLabelIcon);
             {
-                /* Insert into parent layout: */
-                pTopLayout->addWidget(m_pIconLabel);
-                /* Configure label: */
-                m_pIconLabel->setPixmap(standardPixmap(m_iconType, this));
-                m_pIconLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
-                m_pIconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
+                /* Configure icon-label: */
+                m_pLabelIcon->setPixmap(standardPixmap(m_iconType, this));
+                m_pLabelIcon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
+                m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
+                /* Add icon-label into top-layout: */
+                pTopLayout->addWidget(m_pLabelIcon);
             }
             /* Create text-label: */
-            m_pTextLabel = new QILabel(m_strMessage);
+            m_pLabelText = new QILabel(m_strMessage);
+            AssertPtrReturnVoid(m_pLabelText);
             {
-                /* Insert into parent layout: */
-                pTopLayout->addWidget(m_pTextLabel);
-                /* Configure label: */
-                m_pTextLabel->setWordWrap(true);
-                m_pTextLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
+                /* Configure text-label: */
+                m_pLabelText->setWordWrap(true);
+                m_pLabelText->setAlignment(Qt::AlignLeft | Qt::AlignTop);
                 QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
                 sizePolicy.setHeightForWidth(true);
-                m_pTextLabel->setSizePolicy(sizePolicy);
+                m_pLabelText->setSizePolicy(sizePolicy);
+                /* Add text-label into top-layout: */
+                pTopLayout->addWidget(m_pLabelText);
             }
-        }
-        /* Create details text-view: */
-        m_pDetailsTextView = new QTextEdit;
-        {
-            /* Configure text-view: */
-            m_pDetailsTextView->setReadOnly(true);
-            m_pDetailsTextView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
-            /* Calculate the minimum size dynamically, approx. for 40 chars, 4 lines & 2 <table> margins: */
-            QFontMetrics fm = m_pDetailsTextView->fontMetrics();
-            m_pDetailsTextView->setMinimumSize(fm.width ('m') * 40, fm.lineSpacing() * 4 + 4 * 2);
+            /* Add top-layout into main-layout: */
+            pMainLayout->addLayout(pTopLayout);
         }
         /* Create details-container: */
-        m_pDetailsContainer = new QIArrowSplitter(m_pDetailsTextView);
+        m_pDetailsContainer = new QIArrowSplitter;
+        AssertPtrReturnVoid(m_pDetailsContainer);
         {
-            /* Insert into parent layout: */
-            pMainLayout->addWidget(m_pDetailsContainer);
             /* Configure container: */
-            connect(m_pDetailsContainer, SIGNAL(showBackDetails()), this, SLOT(detailsBack()));
-            connect(m_pDetailsContainer, SIGNAL(showNextDetails()), this, SLOT(detailsNext()));
-            connect(m_pDetailsContainer, SIGNAL(sigSizeChanged()), this, SLOT(sltUpdateSize()));
-            /* And update container finally: */
+            connect(m_pDetailsContainer, SIGNAL(sigSizeHintChange()), this, SLOT(sltUpdateSize()));
+            /* Add details-container into main-layout: */
+            pMainLayout->addWidget(m_pDetailsContainer);
+            /* Update details-container finally: */
             updateDetailsContainer();
         }
-        /* Create details check-box: */
+        /* Create flag check-box: */
         m_pFlagCheckBox = new QCheckBox;
+        AssertPtrReturnVoid(m_pFlagCheckBox);
         {
-            /* Insert into parent layout: */
-            pMainLayout->addWidget(m_pFlagCheckBox, 0, Qt::AlignHCenter | Qt::AlignVCenter);
-            /* Configure check-box: */
+            /* Configure flag check-box: */
             m_pFlagCheckBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-            /* And update check-box finally: */
+            /* Add flag check-box into main-layout: */
+            pMainLayout->addWidget(m_pFlagCheckBox, 0, Qt::AlignHCenter | Qt::AlignVCenter);
+            /* Update flag check-box finally: */
             updateCheckBox();
         }
         /* Create button-box: */
         m_pButtonBox = new QIDialogButtonBox;
+        AssertPtrReturnVoid(m_pButtonBox);
         {
-            /* Insert into parent layout: */
-            pMainLayout->addWidget(m_pButtonBox);
             /* Configure button-box: */
             m_pButtonBox->setCenterButtons(true);
             m_pButton1 = createButton(m_iButton1);
             if (m_pButton1)
-                connect(m_pButton1, SIGNAL(clicked()), SLOT(done1()));
+                connect(m_pButton1, SIGNAL(clicked()), SLOT(sltDone1()));
             m_pButton2 = createButton(m_iButton2);
             if (m_pButton2)
-                connect(m_pButton2, SIGNAL(clicked()), SLOT(done2()));
+                connect(m_pButton2, SIGNAL(clicked()), SLOT(sltDone2()));
             m_pButton3 = createButton(m_iButton3);
             if (m_pButton3)
-                connect(m_pButton3, SIGNAL(clicked()), SLOT(done3()));
+                connect(m_pButton3, SIGNAL(clicked()), SLOT(sltDone3()));
             /* If this is a critical message add a "Copy to clipboard" button: */
             if (m_iconType == AlertIconType_Critical)
             {
                 QPushButton *pCopyButton = createButton(AlertButton_Copy);
                 pCopyButton->setToolTip(tr("Copy all errors to the clipboard"));
-                connect(pCopyButton, SIGNAL(clicked()), SLOT(copy()));
+                connect(pCopyButton, SIGNAL(clicked()), SLOT(sltCopy()));
             }
+            /* Add button-box into main-layout: */
+            pMainLayout->addWidget(m_pButtonBox);
         }
     }
 }
@@ -336,15 +300,15 @@ QPushButton* QIMessageBox::createButton(int iButton)
 
 void QIMessageBox::polishEvent(QShowEvent *pPolishEvent)
 {
-    /* Tune our size: */
-    m_pTextLabel->useSizeHintForWidth(m_pTextLabel->width());
-    m_pTextLabel->updateGeometry();
+    /* Tune text-label size: */
+    m_pLabelText->useSizeHintForWidth(m_pLabelText->width());
+    m_pLabelText->updateGeometry();
 
     /* Call to base-class: */
     QIDialog::polishEvent(pPolishEvent);
 
-    /* Make the size fixed: */
-    setFixedSize(size());
+    /* Update size finally: */
+    sltUpdateSize();
 }
 
 void QIMessageBox::closeEvent(QCloseEvent *pCloseEvent)
@@ -357,50 +321,18 @@ void QIMessageBox::closeEvent(QCloseEvent *pCloseEvent)
 
 void QIMessageBox::updateDetailsContainer()
 {
-    /* Do we have details to show? */
-    m_pDetailsContainer->setVisible(!m_details.isEmpty());
-
-    /* Reset the details page index: */
-    m_iDetailsIndex = m_details.isEmpty() ? -1 : 0;
-
-    /* Do we have any details? */
-    if (m_details.isEmpty())
-        m_pDetailsContainer->setName(QString());
-    else if (m_details.size() == 1)
-        m_pDetailsContainer->setName(tr("&Details"));
-    else
-        m_pDetailsContainer->setMultiPaging(true);
-
-    /* Do we have any details? */
-    if (!m_details.isEmpty())
-        updateDetailsPage();
-}
-
-void QIMessageBox::updateDetailsPage()
-{
-    /* Make sure details-page index feats the bounds: */
-    if (m_iDetailsIndex < 0 || m_iDetailsIndex >= m_details.size())
-        return;
-
-    /* Update message text-label: */
-    m_pTextLabel->setText(m_strMessage + m_details[m_iDetailsIndex].first);
-
-    /* Update details text-view: */
-    m_pDetailsTextView->setText(m_details[m_iDetailsIndex].second);
-
-    /* Update details-container: */
-    if (m_details.size() > 1)
-    {
-        m_pDetailsContainer->setName(tr("&Details (%1 of %2)").arg(m_iDetailsIndex + 1).arg(m_details.size()));
-        m_pDetailsContainer->setButtonEnabled(true, m_iDetailsIndex < m_details.size() - 1);
-        m_pDetailsContainer->setButtonEnabled(false, m_iDetailsIndex > 0);
-    }
+    /* Details-container with details is always visible: */
+    m_pDetailsContainer->setVisible(!m_pDetailsContainer->details().isEmpty());
+    /* Update size: */
+    sltUpdateSize();
 }
 
 void QIMessageBox::updateCheckBox()
 {
     /* Flag check-box with text is always visible: */
     m_pFlagCheckBox->setVisible(!m_pFlagCheckBox->text().isEmpty());
+    /* Update size: */
+    sltUpdateSize();
 }
 
 /* static */
@@ -410,10 +342,10 @@ QPixmap QIMessageBox::standardPixmap(AlertIconType iconType, QWidget *pWidget /*
     QIcon icon;
     switch (iconType)
     {
-        case AlertIconType_Information:    icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxInformationIcon, pWidget); break;
-        case AlertIconType_Warning:        icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, pWidget); break;
-        case AlertIconType_Critical:       icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, pWidget); break;
-        case AlertIconType_Question:       icon = UIIconPool::defaultIcon(UIIconPool::MessageBoxQuestionIcon, pWidget); break;
+        case AlertIconType_Information:    icon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxInformation, pWidget); break;
+        case AlertIconType_Warning:        icon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxWarning, pWidget); break;
+        case AlertIconType_Critical:       icon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxCritical, pWidget); break;
+        case AlertIconType_Question:       icon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxQuestion, pWidget); break;
         case AlertIconType_GuruMeditation: icon = UIIconPool::iconSet(":/meditation_32px.png"); break;
         default: break;
     }
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h
index 02be902..f155a20 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h
@@ -1,11 +1,10 @@
+/* $Id: QIMessageBox.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIMessageBox class declaration
+ * VBox Qt GUI - QIMessageBox class declaration.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,8 +15,8 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __QIMessageBox_h__
-#define __QIMessageBox_h__
+#ifndef ___QIMessageBox_h___
+#define ___QIMessageBox_h___
 
 /* Qt includes: */
 #include <QMessageBox>
@@ -26,17 +25,14 @@
 #include "QIDialog.h"
 
 /* Forward declarations: */
-class QShowEvent;
-class QCloseEvent;
 class QLabel;
-class QTextEdit;
-class QCheckBox;
-class QPushButton;
 class QILabel;
+class QPushButton;
+class QCheckBox;
 class QIArrowSplitter;
 class QIDialogButtonBox;
 
-/* Button type enumerator: */
+/** Button types. */
 enum AlertButton
 {
     AlertButton_NoButton      =  0x0,  /* 00000000 00000000 */
@@ -48,7 +44,7 @@ enum AlertButton
     AlertButtonMask           = 0xFF   /* 00000000 11111111 */
 };
 
-/* Button option enumerator: */
+/** Button options. */
 enum AlertButtonOption
 {
     AlertButtonOption_Default = 0x100, /* 00000001 00000000 */
@@ -56,7 +52,7 @@ enum AlertButtonOption
     AlertButtonOptionMask     = 0x300  /* 00000011 00000000 */
 };
 
-/* Alert option enumerator: */
+/** Alert options. */
 enum AlertOption
 {
     AlertOption_AutoConfirmed = 0x400, /* 00000100 00000000 */
@@ -64,95 +60,125 @@ enum AlertOption
     AlertOptionMask           = 0xFC00 /* 11111100 00000000 */
 };
 
-/* Icon type enumerator: */
+/** Icon types. */
 enum AlertIconType
 {
-    AlertIconType_NoIcon = QMessageBox::NoIcon,
-    AlertIconType_Information = QMessageBox::Information,
-    AlertIconType_Warning = QMessageBox::Warning,
-    AlertIconType_Critical = QMessageBox::Critical,
-    AlertIconType_Question = QMessageBox::Question,
+    AlertIconType_NoIcon         = QMessageBox::NoIcon,
+    AlertIconType_Information    = QMessageBox::Information,
+    AlertIconType_Warning        = QMessageBox::Warning,
+    AlertIconType_Critical       = QMessageBox::Critical,
+    AlertIconType_Question       = QMessageBox::Question,
     AlertIconType_GuruMeditation
 };
 
-/* QIDialog extension representing GUI alerts: */
+/** QIDialog extension
+  * representing GUI alerts. */
 class QIMessageBox : public QIDialog
 {
     Q_OBJECT;
 
 public:
 
-    /* Constructor: */
-    QIMessageBox(const QString &strCaption, const QString &strMessage, AlertIconType iconType,
+    /** Constructor, passes @a pParent to the QIDialog constructor.
+      * @param strTitle   defines title,
+      * @param strMessage defines message,
+      * @param iconType   defines icon-type,
+      * @param iButton1   specifies integer-code for the 1st button,
+      * @param iButton2   specifies integer-code for the 2nd button,
+      * @param iButton3   specifies integer-code for the 3rd button. */
+    QIMessageBox(const QString &strTitle, const QString &strMessage, AlertIconType iconType,
                  int iButton1 = 0, int iButton2 = 0, int iButton3 = 0, QWidget *pParent = 0);
 
-    /* API: Details stuff: */
-    QString detailsText() const;
+    /** Defines details-text. */
     void setDetailsText(const QString &strText);
 
-    /* API: Flag stuff: */
+    /** Returns whether flag is checked. */
     bool flagChecked() const;
+    /** Defines whether flag is @a fChecked. */
     void setFlagChecked(bool fChecked);
-    QString flagText() const;
-    void setFlagText(const QString &strText);
+    /** Defines @a strFlagText. */
+    void setFlagText(const QString &strFlagText);
 
-    /* API: Button stuff: */
-    QString buttonText(int iButton) const;
+    /** Defines @a iButton @a strText. */
     void setButtonText(int iButton, const QString &strText);
 
 private slots:
 
-    /* Handler: Reject slot reimplementation: */
-    void reject();
-
-    /* Handlers: Done slot variants for up to three buttons: */
-    void done1() { m_fDone = true; done(m_iButton1 & AlertButtonMask); }
-    void done2() { m_fDone = true; done(m_iButton2 & AlertButtonMask); }
-    void done3() { m_fDone = true; done(m_iButton3 & AlertButtonMask); }
+    /** Updates dialog size: */
+    void sltUpdateSize();
 
-    /* Handler: Copy button stuff: */
-    void copy() const;
+    /** Copy details-text. */
+    void sltCopy() const;
 
-    /* Handlers: Details navigation stuff: */
-    void detailsBack();
-    void detailsNext();
+    /** Closes dialog like user would press the Cancel button. */
+    virtual void reject();
 
-    /* Handler: Update stuff: */
-    void sltUpdateSize();
+    /** Closes dialog like user would press the 1st button. */
+    void sltDone1() { m_fDone = true; done(m_iButton1 & AlertButtonMask); }
+    /** Closes dialog like user would press the 2nd button. */
+    void sltDone2() { m_fDone = true; done(m_iButton2 & AlertButtonMask); }
+    /** Closes dialog like user would press the 3rd button. */
+    void sltDone3() { m_fDone = true; done(m_iButton3 & AlertButtonMask); }
 
 private:
 
-    /* Helpers: Prepare stuff: */
-    void prepareContent();
+    /** Prepare routine. */
+    void prepare();
+
+    /** Push-button factory. */
     QPushButton* createButton(int iButton);
 
-    /* Handler: Event-processing stuff: */
+    /** Polish-event handler. */
     void polishEvent(QShowEvent *pPolishEvent);
+    /** Close-event handler. */
     void closeEvent(QCloseEvent *pCloseEvent);
 
-    /* Helpers: Update stuff: */
+    /** Visibility update routine for details-container. */
     void updateDetailsContainer();
-    void updateDetailsPage();
+    /** Visibility update routine for check-box. */
     void updateCheckBox();
 
-    /* Static helper: Standard pixmap stuff: */
+    /** Generates standard pixmap for passed @a iconType using @a pWidget as hint. */
     static QPixmap standardPixmap(AlertIconType iconType, QWidget *pWidget = 0);
 
-    /* Variables: */
-    int m_iButton1, m_iButton2, m_iButton3, m_iButtonEsc;
+    /** Holds the title. */
+    QString m_strTitle;
+
+    /** Holds the icon-type. */
     AlertIconType m_iconType;
-    QLabel *m_pIconLabel;
-    QILabel *m_pTextLabel;
-    QPushButton *m_pButton1, *m_pButton2, *m_pButton3;
+    /** Holds the icon-label instance. */
+    QLabel *m_pLabelIcon;
+
+    /** Holds the message. */
+    QString m_strMessage;
+    /** Holds the message-label instance. */
+    QILabel *m_pLabelText;
+
+    /** Holds the flag check-box instance. */
     QCheckBox *m_pFlagCheckBox;
+
+    /** Holds the flag details-container instance. */
     QIArrowSplitter *m_pDetailsContainer;
-    QTextEdit *m_pDetailsTextView;
+
+    /** Holds the integer-code for the 1st button. */
+    int m_iButton1;
+    /** Holds the integer-code for the 2nd button. */
+    int m_iButton2;
+    /** Holds the integer-code for the 3rd button. */
+    int m_iButton3;
+    /** Holds the integer-code of the cancel-button. */
+    int m_iButtonEsc;
+    /** Holds the 1st button instance. */
+    QPushButton *m_pButton1;
+    /** Holds the 2nd button instance. */
+    QPushButton *m_pButton2;
+    /** Holds the 3rd button instance. */
+    QPushButton *m_pButton3;
+    /** Holds the button-box instance. */
     QIDialogButtonBox *m_pButtonBox;
-    QString m_strMessage;
-    QList<QPair<QString, QString> > m_details;
-    int m_iDetailsIndex;
+
+    /** Defines whether message was accepted. */
     bool m_fDone : 1;
 };
 
-#endif
-
+#endif /* !___QIMessageBox_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.cpp
index fe44fc7..04bba1c 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIProcess.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIProcess class implementation
+ * VBox Qt GUI - QIProcess class implementation.
  */
 
 /*
@@ -17,14 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 /* GUI includes: */
-#include "QIProcess.h"
+# include "QIProcess.h"
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* External includes: */
 #ifdef Q_WS_X11
 # include <sys/wait.h>
 #endif /* Q_WS_X11 */
 
+
 /* static */
 QByteArray QIProcess::singleShot(const QString &strProcessName, int iTimeout)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.h
index 7a4e6f1..5d8db0c 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIProcess.h
@@ -1,7 +1,6 @@
+/* $Id: QIProcess.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIProcess class declaration
+ * VBox Qt GUI - QIProcess class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.cpp
index 67daa7b..b67caaf 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIRichTextLabel.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIRichTextLabel class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QIRichTextLabel class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QVBoxLayout>
-#include <QUrl>
+# include <QVBoxLayout>
+# include <QUrl>
 
 /* Local includes: */
-#include "QIRichTextLabel.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Constructor: */
 QIRichTextLabel::QIRichTextLabel(QWidget *pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.h
index b42f1d3..01754cb 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIRichTextLabel.h
@@ -1,7 +1,6 @@
+/* $Id: QIRichTextLabel.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIRichTextLabel class declaration
+ * VBox Qt GUI - Qt extensions: QIRichTextLabel class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIRichToolButton.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIRichToolButton.cpp
index 56f14db..c648430 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIRichToolButton.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIRichToolButton.cpp
@@ -1,12 +1,10 @@
 /* $Id: QIRichToolButton.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIRichToolButton class implementation
+ * VBox Qt GUI - QIRichToolButton class declaration.
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,99 +15,126 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* VBox includes */
-#include "QIRichToolButton.h"
-
-/* Qt includes */
-#include <QApplication>
-#include <QLabel>
-#include <QHBoxLayout>
-#include <QToolButton>
-#include <QKeyEvent>
-#include <QStylePainter>
-#include <QStyleOptionFocusRect>
-
-QIRichToolButton::QIRichToolButton (QWidget *aParent)
-    : QWidget (aParent)
-    , mButton (new QToolButton())
-    , mLabel (new QLabel())
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QHBoxLayout>
+# include <QLabel>
+# include <QStylePainter>
+# include <QStyleOptionFocusRect>
+# include <QKeyEvent>
+
+/* GUI includes: */
+# include "QIRichToolButton.h"
+# include "QIToolButton.h"
+
+/* Other VBox includes: */
+# include "iprt/assert.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+QIRichToolButton::QIRichToolButton(QWidget *pParent)
+    : QWidget(pParent)
+    , m_pButton(0)
+    , m_pLabel(0)
 {
-    init();
+    /* Prepare: */
+    prepare();
 }
 
-QIRichToolButton::QIRichToolButton (const QString &aName, QWidget *aParent)
-    : QWidget (aParent)
-    , mButton (new QToolButton())
-    , mLabel (new QLabel (aName))
+void QIRichToolButton::setIconSize(const QSize &iconSize)
 {
-    init();
+    m_pButton->setIconSize(iconSize);
 }
 
-void QIRichToolButton::init()
+void QIRichToolButton::setIcon(const QIcon &icon)
 {
-    /* Setup itself */
-    setFocusPolicy (Qt::StrongFocus);
-
-    /* Setup tool-button */
-    mButton->setAutoRaise (true);
-    mButton->setFixedSize (17, 16);
-    mButton->setFocusPolicy (Qt::NoFocus);
-    mButton->setStyleSheet ("QToolButton {border: 0px none black;}");
-    connect (mButton, SIGNAL (clicked (bool)), this, SLOT (buttonClicked()));
-
-    /* Setup text-label */
-    mLabel->setBuddy (mButton);
-    mLabel->setStyleSheet ("QLabel {padding: 2px 0px 2px 0px;}");
-
-    /* Setup main-layout */
-    QHBoxLayout *mainLayout = new QHBoxLayout (this);
-    mainLayout->setContentsMargins(0, 0, 0, 0);
-    mainLayout->setSpacing (0);
-    mainLayout->addWidget (mButton);
-    mainLayout->addWidget (mLabel);
-
-    /* Install event-filter */
-    qApp->installEventFilter (this);
+    m_pButton->setIcon(icon);
 }
 
-bool QIRichToolButton::eventFilter (QObject *aObject, QEvent *aEvent)
+void QIRichToolButton::animateClick()
 {
-    /* Process only QIRichToolButton or children */
-    if (!(aObject == this || children().contains (aObject)))
-        return QWidget::eventFilter (aObject, aEvent);
+    m_pButton->animateClick();
+}
+
+void QIRichToolButton::setText(const QString &strText)
+{
+    m_pLabel->setText(strText);
+}
 
-    /* Process keyboard events */
-    if (aEvent->type() == QEvent::KeyPress)
+void QIRichToolButton::paintEvent(QPaintEvent *pEvent)
+{
+    /* Draw focus around whole button if focused: */
+    if (hasFocus())
     {
-        QKeyEvent *kEvent = static_cast <QKeyEvent*> (aEvent);
-        if (kEvent->key() == Qt::Key_Space)
-            animateClick();
+        QStylePainter painter(this);
+        QStyleOptionFocusRect option;
+        option.initFrom(this);
+        option.rect = geometry();
+        painter.drawPrimitive(QStyle::PE_FrameFocusRect, option);
     }
 
-    /* Process mouse events */
-    if ((aEvent->type() == QEvent::MouseButtonPress ||
-         aEvent->type() == QEvent::MouseButtonDblClick)
-        && aObject == mLabel)
+    /* Call to base-class: */
+    QWidget::paintEvent(pEvent);
+}
+
+void QIRichToolButton::keyPressEvent(QKeyEvent *pEvent)
+{
+    /* Handle different keys: */
+    switch (pEvent->key())
     {
-        /* Label click as toggle */
-        animateClick();
+        /* Animate-click for the Space key: */
+        case Qt::Key_Space: return animateClick();
+        default: break;
     }
+    /* Call to base-class: */
+    QWidget::keyPressEvent(pEvent);
+}
 
-    /* Default one handler */
-    return QWidget::eventFilter (aObject, aEvent);
+void QIRichToolButton::mousePressEvent(QMouseEvent *pEvent)
+{
+    NOREF(pEvent);
+    /* Animate-click: */
+    animateClick();
 }
 
-void QIRichToolButton::paintEvent (QPaintEvent *aEvent)
+void QIRichToolButton::prepare()
 {
-    /* Draw focus around mLabel if focused */
-    if (hasFocus())
+    /* Enable string focus: */
+    setFocusPolicy(Qt::StrongFocus);
+
+    /* Create main-layout: */
+    QHBoxLayout *pMainLayout = new QHBoxLayout(this);
+    AssertPtrReturnVoid(pMainLayout);
     {
-        QStylePainter painter (this);
-        QStyleOptionFocusRect option;
-        option.initFrom (this);
-        option.rect = mLabel->frameGeometry();
-        painter.drawPrimitive (QStyle::PE_FrameFocusRect, option);
+        /* Configure main-layout: */
+        pMainLayout->setContentsMargins(0, 0, 0, 0);
+        pMainLayout->setSpacing(0);
+        /* Create tool-button: */
+        m_pButton = new QIToolButton;
+        AssertPtrReturnVoid(m_pButton);
+        {
+            /* Configure tool-button: */
+            m_pButton->removeBorder();
+            m_pButton->setFocusPolicy(Qt::NoFocus);
+            connect(m_pButton, SIGNAL(clicked(bool)), this, SLOT(sltButtonClicked()));
+            connect(m_pButton, SIGNAL(clicked(bool)), this, SIGNAL(sigClicked()));
+            /* Add tool-button into main-layout: */
+            pMainLayout->addWidget(m_pButton);
+        }
+        /* Create text-label: */
+        m_pLabel = new QLabel;
+        AssertPtrReturnVoid(m_pLabel);
+        {
+            /* Configure text-label: */
+            m_pLabel->setBuddy(m_pButton);
+            m_pLabel->setStyleSheet("QLabel {padding: 2px 0px 2px 0px;}");
+            /* Add text-label into main-layout: */
+            pMainLayout->addWidget(m_pLabel);
+        }
     }
-    QWidget::paintEvent (aEvent);
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIRichToolButton.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIRichToolButton.h
index ed457c0..ecb9c89 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIRichToolButton.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIRichToolButton.h
@@ -1,11 +1,10 @@
+/* $Id: QIRichToolButton.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIRichToolButton class declaration
+ * VBox Qt GUI - QIRichToolButton class declaration.
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,49 +15,67 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __QIRichToolButton_h__
-#define __QIRichToolButton_h__
+#ifndef ___QIRichToolButton_h___
+#define ___QIRichToolButton_h___
 
-/* Qt includes */
-#include <QLabel>
+/* Qt includes: */
 #include <QWidget>
-#include <QToolButton>
 
-/** @class QIRichToolButton
- *
- *  The QIRichToolButton class is a tool-button with separate text-label.
- *
- */
+/* Forward declarations: */
+class QIToolButton;
+class QLabel;
+
+/** QWidget extension
+  * representing tool-button with separate text-label. */
 class QIRichToolButton : public QWidget
 {
     Q_OBJECT;
 
-public:
+signals:
 
-    QIRichToolButton (QWidget *aParent = 0);
-    QIRichToolButton (const QString &aName, QWidget *aParent = 0);
+    /** Notifies listeners about button click. */
+    void sigClicked();
 
-    void animateClick() { mButton->animateClick(); }
-    void setText (const QString &aName) { mLabel->setText (aName); }
-    QString text() const { return mLabel->text(); }
+public:
 
-signals:
+    /** Constructor, passes @a pParent to the QWidget constructor. */
+    QIRichToolButton(QWidget *pParent = 0);
+
+    /** Defines tool-button @a iconSize. */
+    void setIconSize(const QSize &iconSize);
+    /** Defines tool-button @a icon. */
+    void setIcon(const QIcon &icon);
+    /** Animates tool-button click: */
+    void animateClick();
 
-    void clicked();
+    /** Defines text-label @a strText. */
+    void setText(const QString &strText);
 
 protected slots:
 
-    virtual void buttonClicked() { emit clicked(); }
+    /** Button-click handler. */
+    virtual void sltButtonClicked() {}
 
 protected:
 
-    void init();
-    bool eventFilter (QObject *aObject, QEvent *aEvent);
-    void paintEvent (QPaintEvent *aEvent);
+    /** Paint-event handler. */
+    virtual void paintEvent(QPaintEvent *pEvent);
+    /** Key-press-event handler. */
+    virtual void keyPressEvent(QKeyEvent *pEvent);
+    /** Mouse-press-event handler. */
+    virtual void mousePressEvent(QMouseEvent *pEvent);
 
-    QToolButton *mButton;
-    QLabel *mLabel;
-};
+private:
+
+    /** Prepare routine. */
+    void prepare();
 
-#endif
+    /** Holds the tool-button instance. */
+    QIToolButton *m_pButton;
+    /** Holds the text-label instance. */
+    QLabel *m_pLabel;
+    /** Holds the text for text-label instance. */
+    QString m_strName;
+};
 
+#endif /* !___QIRichToolButton_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.cpp
index 5b28b48..363a688 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.cpp
@@ -1,8 +1,6 @@
 /* $Id: QISplitter.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QISplitter class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QISplitter class implementation.
  */
 
 /*
@@ -17,14 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QEvent>
-#include <QPainter>
-#include <QPaintEvent>
+# include <QApplication>
+# include <QEvent>
+# include <QPainter>
+# include <QPaintEvent>
 
 /* GUI includes: */
-#include "QISplitter.h"
+# include "QISplitter.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* A simple shaded line: */
 class QIShadeSplitterHandle: public QSplitterHandle
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.h b/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.h
index 9bea2bb..daa114b 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.h
@@ -1,7 +1,6 @@
+/* $Id:  $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QISplitter class declaration
+ * VBox Qt GUI - Qt extensions: QISplitter class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIStateIndicator.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIStateIndicator.cpp
deleted file mode 100644
index ef328fe..0000000
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIStateIndicator.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $Id: QIStateIndicator.cpp $ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIStateIndicator class implementation
- */
-
-/*
- * Copyright (C) 2006-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include "QIStateIndicator.h"
-
-/* Qt includes */
-#include <QPainter>
-#ifdef Q_WS_MAC
-# include <QContextMenuEvent>
-#endif
-
-QIStateIndicator::QIStateIndicator(QWidget *pParent /* = 0*/)
-  : QIWithRetranslateUI<QFrame>(pParent)
-  , mState(0)
-  , mSize(0, 0)
-{
-    setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
-}
-
-QIStateIndicator::~QIStateIndicator()
-{
-    qDeleteAll (mStateIcons);
-}
-
-QSize QIStateIndicator::sizeHint() const
-{
-    return mSize;
-}
-
-QPixmap QIStateIndicator::stateIcon (int aState) const
-{
-    Icon *icon = mStateIcons [aState];
-    return icon ? icon->pixmap : QPixmap();
-}
-
-/**
- *  Sets an icon for the specified state. The first icon set by this method
- *  defines the preferred size of this indicator. All other icons will be
- *  scaled to fit this size.
- *
- *  @note If this widget is constructed with the WNoAutoErase flag, then all
- *  transparent areas of the new state icon are filled with the widget
- *  background color or pixmap (as taken from the widget palette), to provide
- *  flicker free state redraws in one single operation (which is useful for
- *  indicators that frequently change their state).
- */
-void QIStateIndicator::setStateIcon (int aState, const QPixmap &aPixmap)
-{
-    /* Here we just set the original pixmap. All actual work from the @note
-     * above takes place in #drawContents(). */
-    mStateIcons.insert (aState, new Icon (aPixmap));
-
-    if (mSize.isNull())
-        mSize = aPixmap.size();
-}
-
-void QIStateIndicator::setState (int aState)
-{
-    mState = aState;
-    repaint();
-}
-
-void QIStateIndicator::paintEvent (QPaintEvent * /* aEv */)
-{
-    QPainter painter (this);
-    drawContents (&painter);
-}
-
-void QIStateIndicator::drawContents (QPainter *aPainter)
-{
-    Icon *icon = mStateIcons [mState];
-    if (icon)
-        aPainter->drawPixmap (contentsRect(), icon->pixmap);
-}
-
-#ifdef Q_WS_MAC
-/**
- * Make the left button also show the context menu to make things
- * simpler for users with single mouse button mice (laptops++).
- */
-void QIStateIndicator::mousePressEvent (QMouseEvent *aEv)
-{
-    /* Do this for the left mouse button event only, cause in the case of the
-     * right mouse button it could happen that the context menu event is
-     * triggered twice. Also this isn't necessary for the middle mouse button
-     * which would be some kind of overstated. */
-    if (aEv->button() == Qt::LeftButton)
-    {
-        QContextMenuEvent qme (QContextMenuEvent::Mouse, aEv->pos(), aEv->globalPos());
-        emit contextMenuRequested (this, &qme);
-        if (qme.isAccepted())
-            aEv->accept();
-        else
-            QFrame::mousePressEvent (aEv);
-    }
-    else
-        QFrame::mousePressEvent (aEv);
-}
-#endif /* Q_WS_MAC */
-
-void QIStateIndicator::mouseDoubleClickEvent (QMouseEvent * e)
-{
-    emit mouseDoubleClicked (this, e);
-}
-
-void QIStateIndicator::contextMenuEvent (QContextMenuEvent * e)
-{
-    emit contextMenuRequested (this, e);
-}
-
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIStateIndicator.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIStateIndicator.h
deleted file mode 100644
index 9698af5..0000000
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIStateIndicator.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIStateIndicator class declaration
- */
-
-/*
- * Copyright (C) 2006-2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef __QIStateIndicator_h__
-#define __QIStateIndicator_h__
-
-/* Qt includes */
-#include <QFrame>
-#include <QHash>
-
-/* GUI includes: */
-#include "QIWithRetranslateUI.h"
-
-class QIStateIndicator : public QIWithRetranslateUI<QFrame>
-{
-    Q_OBJECT;
-
-public:
-
-    QIStateIndicator(QWidget *pParent = 0);
-    ~QIStateIndicator();
-
-    virtual QSize sizeHint() const;
-
-    int state () const { return mState; }
-
-    QPixmap stateIcon (int aState) const;
-    void setStateIcon (int aState, const QPixmap &aPixmap);
-
-    virtual void updateAppearance() {}
-
-public slots:
-
-    virtual void setState (int aState);
-    virtual void setState (bool aState) { setState ((int) aState); }
-
-signals:
-
-    void mouseDoubleClicked (QIStateIndicator *aIndicator,
-                             QMouseEvent *aEv);
-    void contextMenuRequested (QIStateIndicator *aIndicator,
-                               QContextMenuEvent *aEv);
-
-protected:
-
-    virtual void paintEvent (QPaintEvent *aEv);
-    virtual void drawContents (QPainter *aPainter);
-
-#ifdef Q_WS_MAC
-    virtual void mousePressEvent (QMouseEvent *aEv);
-#endif
-    virtual void mouseDoubleClickEvent (QMouseEvent *aEv);
-    virtual void contextMenuEvent (QContextMenuEvent *aEv);
-
-private:
-
-    int mState;
-    QSize mSize;
-
-    struct Icon
-    {
-        Icon (const QPixmap &aPixmap)
-            : pixmap (aPixmap)
-            , bgPixmap (NULL) {}
-
-        QPixmap pixmap;
-        QPixmap cached;
-        QColor bgColor;
-        const QPixmap *bgPixmap;
-        QPoint bgOff;
-    };
-
-    QHash <int, Icon *> mStateIcons;
-};
-
-#endif // __QIStateIndicator_h__
-
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBar.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBar.cpp
index fc7a25b..d6e284a 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBar.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBar.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIStatusBar.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIStatusBar class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QIStatusBar class implementation.
  */
 
 /*
@@ -17,7 +15,12 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#include "QIStatusBar.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else
+# include "QIStatusBar.h"
+#endif
+
 
 QIStatusBar::QIStatusBar (QWidget *aParent)
     : QStatusBar (aParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBar.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBar.h
index e756684..95b0eb8 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBar.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBar.h
@@ -1,7 +1,6 @@
+/* $Id: QIStatusBar.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIStatusBar class declaration
+ * VBox Qt GUI - Qt extensions: QIStatusBar class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBarIndicator.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBarIndicator.cpp
new file mode 100644
index 0000000..0f4c653
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBarIndicator.cpp
@@ -0,0 +1,139 @@
+/* $Id: QIStatusBarIndicator.cpp $ */
+/** @file
+ * VBox Qt GUI - QIStatusBarIndicator interface implementation.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QIcon>
+# include <QPainter>
+# include <QHBoxLayout>
+# include <QLabel>
+# ifdef Q_WS_MAC
+#  include <QContextMenuEvent>
+# endif /* Q_WS_MAC */
+
+/* GUI includes: */
+# include "QIStatusBarIndicator.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+
+QIStatusBarIndicator::QIStatusBarIndicator(QWidget *pParent /* = 0 */)
+    : QWidget(pParent)
+{
+    /* Configure size-policy: */
+    setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+}
+
+#ifdef Q_WS_MAC
+void QIStatusBarIndicator::mousePressEvent(QMouseEvent *pEvent)
+{
+    /* Do this for the left mouse button event only, cause in the case of the
+     * right mouse button it could happen that the context menu event is
+     * triggered twice. Also this isn't necessary for the middle mouse button
+     * which would be some kind of overstated. */
+    if (pEvent->button() == Qt::LeftButton)
+    {
+        QContextMenuEvent cme(QContextMenuEvent::Mouse, pEvent->pos(), pEvent->globalPos());
+        emit sigContextMenuRequest(this, &cme);
+        if (cme.isAccepted())
+            pEvent->accept();
+        else
+            QWidget::mousePressEvent(pEvent);
+    }
+    else
+        QWidget::mousePressEvent(pEvent);
+}
+#endif /* Q_WS_MAC */
+
+void QIStatusBarIndicator::mouseDoubleClickEvent(QMouseEvent *pEvent)
+{
+    emit sigMouseDoubleClick(this, pEvent);
+}
+
+void QIStatusBarIndicator::contextMenuEvent(QContextMenuEvent *pEvent)
+{
+    emit sigContextMenuRequest(this, pEvent);
+}
+
+
+QIStateStatusBarIndicator::QIStateStatusBarIndicator(QWidget *pParent /* = 0 */)
+  : QIStatusBarIndicator(pParent)
+  , m_iState(0)
+{
+}
+
+QIcon QIStateStatusBarIndicator::stateIcon(int iState) const
+{
+    /* Check if state-icon was set before: */
+    return m_icons.value(iState, QIcon());
+}
+
+void QIStateStatusBarIndicator::setStateIcon(int iState, const QIcon &icon)
+{
+    /* Adjust size-hint: */
+    m_size = m_size.expandedTo(icon.availableSizes().first());
+    /* Cache passed-icon: */
+    m_icons[iState] = icon;
+}
+
+void QIStateStatusBarIndicator::paintEvent(QPaintEvent*)
+{
+    QPainter painter(this);
+    drawContents(&painter);
+}
+
+void QIStateStatusBarIndicator::drawContents(QPainter *pPainter)
+{
+    if (m_icons.contains(m_iState))
+        pPainter->drawPixmap(contentsRect().topLeft(), m_icons.value(m_iState).pixmap(m_size));
+}
+
+
+QITextStatusBarIndicator::QITextStatusBarIndicator(QWidget *pParent /* = 0 */)
+    : QIStatusBarIndicator(pParent)
+{
+    /* Create main-layout: */
+    QHBoxLayout *pMainLayout = new QHBoxLayout(this);
+    if (pMainLayout)
+    {
+        /* Configure main-layout: */
+        pMainLayout->setContentsMargins(0, 0, 0, 0);
+        pMainLayout->setSpacing(0);
+        /* Crete label: */
+        m_pLabel = new QLabel;
+        if (m_pLabel)
+        {
+            /* Add label into main-layout: */
+            pMainLayout->addWidget(m_pLabel);
+        }
+    }
+}
+
+QString QITextStatusBarIndicator::text() const
+{
+    return m_pLabel->text();
+}
+
+void QITextStatusBarIndicator::setText(const QString &strText)
+{
+    m_pLabel->setText(strText);
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBarIndicator.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBarIndicator.h
new file mode 100644
index 0000000..de0d72d
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIStatusBarIndicator.h
@@ -0,0 +1,128 @@
+/* $Id: QIStatusBarIndicator.h $ */
+/** @file
+ * VBox Qt GUI - QIStatusBarIndicator interface declaration.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___QIStatusBarIndicators_h___
+#define ___QIStatusBarIndicators_h___
+
+/* Qt includes: */
+#include <QWidget>
+#include <QMap>
+#include <QIcon>
+
+/* Forward declarations: */
+class QLabel;
+
+/** QWidget extension used as status-bar indicator. */
+class QIStatusBarIndicator : public QWidget
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies about mouse-double-click-event: */
+    void sigMouseDoubleClick(QIStatusBarIndicator *pIndicator, QMouseEvent *pEvent);
+    /** Notifies about context-menu-request-event: */
+    void sigContextMenuRequest(QIStatusBarIndicator *pIndicator, QContextMenuEvent *pEvent);
+
+public:
+
+    /** Constructor, passes @a pParent to the QWidget constructor. */
+    QIStatusBarIndicator(QWidget *pParent = 0);
+
+    /** Returns size-hint. */
+    virtual QSize sizeHint() const { return m_size.isValid() ? m_size : QWidget::sizeHint(); }
+
+protected:
+
+#ifdef Q_WS_MAC
+    /** Mac OS X: Mouse-press-event handler.
+      *           Make the left button also show the context-menu to make things
+      *           simpler for users with single mouse button mice (laptops++). */
+    virtual void mousePressEvent(QMouseEvent *pEvent);
+#endif /* Q_WS_MAC */
+    /** Mouse-double-click-event handler. */
+    virtual void mouseDoubleClickEvent(QMouseEvent *pEvent);
+    /** Context-menu-event handler. */
+    virtual void contextMenuEvent(QContextMenuEvent *pEvent);
+
+    /** Holds currently cached size. */
+    QSize m_size;
+};
+
+/** QIStatusBarIndicator extension used as status-bar state indicator. */
+class QIStateStatusBarIndicator : public QIStatusBarIndicator
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pParent to the QIStatusBarIndicator constructor. */
+    QIStateStatusBarIndicator(QWidget *pParent = 0);
+
+    /** Returns current state. */
+    int state() const { return m_iState; }
+
+    /** Returns state-icon for passed @a iState. */
+    QIcon stateIcon(int iState) const;
+    /** Defines state-icon for passed @a iState as @a icon. */
+    void setStateIcon(int iState, const QIcon &icon);
+
+public slots:
+
+    /** Defines int @a state. */
+    virtual void setState(int iState) { m_iState = iState; repaint(); }
+    /** Defines bool @a state. */
+    virtual void setState(bool fState) { setState((int)fState); }
+
+protected:
+
+    /** Paint-event handler. */
+    virtual void paintEvent(QPaintEvent *pEvent);
+
+    /** Draw-contents routine. */
+    virtual void drawContents(QPainter *pPainter);
+
+private:
+
+    /** Holds current state. */
+    int m_iState;
+    /** Holds cached state icons. */
+    QMap<int, QIcon> m_icons;
+};
+
+/** QIStatusBarIndicator extension used as status-bar state indicator. */
+class QITextStatusBarIndicator : public QIStatusBarIndicator
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pParent to the QIStatusBarIndicator constructor. */
+    QITextStatusBarIndicator(QWidget *pParent = 0);
+
+    /** Returns text. */
+    QString text() const;
+    /** Defines @a strText. */
+    void setText(const QString &strText);
+
+private:
+
+    /** Holds the label instance. */
+    QLabel *m_pLabel;
+};
+
+#endif /* !___QIStatusBarIndicators_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIStyledItemDelegate.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIStyledItemDelegate.h
new file mode 100644
index 0000000..cf45774
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIStyledItemDelegate.h
@@ -0,0 +1,67 @@
+/* $Id: QIStyledItemDelegate.h $ */
+/** @file
+ * VBox Qt GUI - QIStyledItemDelegate class declaration.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+/* Qt includes: */
+# include <QStyledItemDelegate>
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/** Own QStyledItemDelegate implementation. */
+class QIStyledItemDelegate : public QStyledItemDelegate
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listeners about
+      * created editor's Enter/Return key triggering. */
+    void sigEditorEnterKeyTriggered();
+
+public:
+
+    /** Constructor. */
+    QIStyledItemDelegate(QObject *pParent)
+        : QStyledItemDelegate(pParent)
+        , m_fWatchForEditorEnterKeyTriggering(false)
+    {}
+
+    /** Defines whether QIStyledItemDelegate should watch for the created editor's Enter/Return key triggering. */
+    void setWatchForEditorEnterKeyTriggering(bool fWatch) { m_fWatchForEditorEnterKeyTriggering = fWatch; }
+
+private:
+
+    /** Returns the widget used to edit the item specified by @a index for editing.
+      * The @a pParent widget and style @a option are used to control how the editor widget appears.
+      * Besides that, we are installing the hooks to redirect editor's sigCommitData and sigEnterKeyTriggered signals. */
+    QWidget* createEditor(QWidget *pParent, const QStyleOptionViewItem &option, const QModelIndex &index) const
+    {
+        /* Call to base-class to get actual editor created: */
+        QWidget *pEditor = QStyledItemDelegate::createEditor(pParent, option, index);
+        /* All the stuff we actually need from QIStyledItemDelegate is to redirect these signals: */
+        connect(pEditor, SIGNAL(sigCommitData(QWidget*)), this, SIGNAL(commitData(QWidget*)));
+        if (m_fWatchForEditorEnterKeyTriggering)
+            connect(pEditor, SIGNAL(sigEnterKeyTriggered()), this, SIGNAL(sigEditorEnterKeyTriggered()));
+        /* Return actual editor: */
+        return pEditor;
+    }
+
+    /** Holds whether QIStyledItemDelegate should watch
+      * for the created editor's Enter/Return key triggering. */
+    bool m_fWatchForEditorEnterKeyTriggering;
+};
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITabWidget.h b/src/VBox/Frontends/VirtualBox/src/extensions/QITabWidget.h
index cfd2584..7f6b267 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITabWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITabWidget.h
@@ -1,7 +1,6 @@
+/* $Id: QITabWidget.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITabWidget class declaration/implementation
+ * VBox Qt GUI - Qt extensions: QITabWidget class declaration/implementation.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.cpp
index 964cf5d..7b546d4 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.cpp
@@ -1,8 +1,6 @@
 /* $Id: QITableView.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITableView class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QITableView class implementation.
  */
 
 /*
@@ -17,8 +15,15 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Local includes */
-#include "QITableView.h"
+# include "QITableView.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 QITableView::QITableView(QWidget *pParent)
     : QTableView(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.h b/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.h
index 2acb375..523a6df 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITableView.h
@@ -1,7 +1,6 @@
+/* $Id: QITableView.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITableView class declaration
+ * VBox Qt GUI - Qt extensions: QITableView class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITextEdit.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QITextEdit.cpp
deleted file mode 100644
index bd6870e..0000000
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITextEdit.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $Id: QITextEdit.cpp $ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITextEdit class implementation
- */
-
-/*
- * Copyright (C) 2011 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-/* Local includes: */
-#include "QITextEdit.h"
-
-/* Constructor: */
-QITextEdit::QITextEdit(QWidget *pParent)
-    : QTextEdit(pParent)
-{
-}
-
-QSize QITextEdit::sizeHint() const
-{
-    return document()->size().toSize();
-}
-
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITextEdit.h b/src/VBox/Frontends/VirtualBox/src/extensions/QITextEdit.h
deleted file mode 100644
index bf4ba57..0000000
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITextEdit.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITextEdit class declaration
- */
-
-/*
- * Copyright (C) 2011 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef __QITextEdit_h__
-#define __QITextEdit_h__
-
-/* Global includes: */
-#include <QTextEdit>
-
-/* QTextEdit class extension: */
-class QITextEdit : public QTextEdit
-{
-    Q_OBJECT;
-
-public:
-
-    /* Constructor: */
-    QITextEdit(QWidget *pParent = 0);
-
-    /* Size hint: */
-    QSize sizeHint() const;
-};
-
-#endif // __QITextEdit_h__
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIToolButton.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIToolButton.h
index 0f32037..fd22df4 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIToolButton.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIToolButton.h
@@ -1,7 +1,6 @@
+/* $Id: QIToolButton.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIToolButton class declaration
+ * VBox Qt GUI - Qt extensions: QIToolButton class declaration.
  */
 
 /*
@@ -33,8 +32,25 @@ public:
         : QToolButton(pParent)
     {
 #ifdef Q_WS_MAC
-        setStyleSheet("QToolButton { border: 0px none black; margin: 2px 4px 0px 4px; } QToolButton::menu-indicator {image: none;}");
-#endif /* Q_WS_MAC */
+        /* Keep size-hint alive: */
+        const QSize sh = sizeHint();
+        setStyleSheet("QToolButton { border: 0px none black; margin: 0px 0px 0px 0px; } QToolButton::menu-indicator {image: none;}");
+        setFixedSize(sh);
+#else /* !Q_WS_MAC */
+        setAutoRaise(true);
+#endif /* !Q_WS_MAC */
+    }
+
+    /** Sets the auto-raise status. */
+    virtual void setAutoRaise(bool fEnable)
+    {
+#ifdef Q_WS_MAC
+        /* Ignore for Mac OS X: */
+        Q_UNUSED(fEnable);
+#else /* !Q_WS_MAC */
+        /* Call to base-class: */
+        QToolButton::setAutoRaise(fEnable);
+#endif /* !Q_WS_MAC */
     }
 
     void removeBorder()
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.cpp
index 45673a9..96cfa18 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.cpp
@@ -1,8 +1,6 @@
 /* $Id: QITreeView.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITreeView class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QITreeView class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes */
-#include <QMouseEvent>
-#include <QPainter>
+# include <QMouseEvent>
+# include <QPainter>
 
 /* Local includes */
-#include "QITreeView.h"
+# include "QITreeView.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 QITreeView::QITreeView (QWidget *aParent)
     : QTreeView (aParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.h b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.h
index a9ecd6e..d6ca889 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.h
@@ -1,7 +1,6 @@
+/* $Id:  $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITreeView class declaration
+ * VBox Qt GUI - Qt extensions: QITreeView class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp
index 6f9262a..58559ae 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.cpp
@@ -1,8 +1,6 @@
 /* $Id: QITreeWidget.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITreeWidget class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QITreeWidget class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes */
-#include <QPainter>
-#include <QResizeEvent>
+# include <QPainter>
+# include <QResizeEvent>
 
 /* Local includes */
-#include "QITreeWidget.h"
+# include "QITreeWidget.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 QITreeWidget::QITreeWidget (QWidget *aParent)
     : QTreeWidget (aParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h
index c6cdb60..6e0b878 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h
@@ -1,7 +1,6 @@
+/* $Id: QITreeWidget.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QITreeWidget class implementation
+ * VBox Qt GUI - Qt extensions: QITreeWidget class implementation.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.cpp
index 5ce54f4..a8d9a07 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIWidgetValidator.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIWidgetValidator class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: QIWidgetValidator class implementation.
  */
 
 /*
@@ -17,10 +15,117 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#include "QIWidgetValidator.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* GUI includes: */
-#include "UISettingsPage.h"
+# include "QIWidgetValidator.h"
+# include "UISettingsPage.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+
+QObjectValidator::QObjectValidator(QValidator *pValidator, QObject *pParent /* = 0 */)
+    : QObject(pParent)
+    , m_pValidator(pValidator)
+    , m_state(QValidator::Invalid)
+{
+    /* Prepare: */
+    prepare();
+}
+
+void QObjectValidator::sltValidate(QString strInput /* = QString() */)
+{
+    /* Make sure validator assigned: */
+    AssertPtrReturnVoid(m_pValidator);
+
+    /* Validate: */
+    int iPosition = 0;
+    const QValidator::State state = m_pValidator->validate(strInput, iPosition);
+
+    /* If validity state changed: */
+    if (m_state != state)
+    {
+        /* Update last validity state: */
+        m_state = state;
+
+        /* Notifies listener(s) about validity change: */
+        emit sigValidityChange(m_state);
+    }
+}
+
+void QObjectValidator::prepare()
+{
+    /* Make sure validator assigned: */
+    AssertPtrReturnVoid(m_pValidator);
+
+    /* Register validator as child: */
+    m_pValidator->setParent(this);
+
+    /* Validate: */
+    sltValidate();
+}
+
+
+QObjectValidatorGroup::QObjectValidatorGroup(QObject *pParent)
+    : QObject(pParent)
+    , m_fResult(false)
+{
+}
+
+void QObjectValidatorGroup::addObjectValidator(QObjectValidator *pObjectValidator)
+{
+    /* Make sure object-validator passed: */
+    AssertPtrReturnVoid(pObjectValidator);
+
+    /* Register object-validator as child: */
+    pObjectValidator->setParent(this);
+
+    /* Insert object-validator to internal map: */
+    m_group.insert(pObjectValidator, toResult(pObjectValidator->state()));
+
+    /* Attach object-validator to group: */
+    connect(pObjectValidator, SIGNAL(sigValidityChange(QValidator::State)),
+            this, SLOT(sltValidate(QValidator::State)));
+}
+
+void QObjectValidatorGroup::sltValidate(QValidator::State state)
+{
+    /* Determine sender object-validator: */
+    QObjectValidator *pObjectValidatorSender = qobject_cast<QObjectValidator*>(sender());
+    /* Make sure that is one of our senders: */
+    AssertReturnVoid(pObjectValidatorSender && m_group.contains(pObjectValidatorSender));
+
+    /* Update internal map: */
+    m_group[pObjectValidatorSender] = toResult(state);
+
+    /* Enumerate all the registered object-validators: */
+    bool fResult = true;
+    foreach (QObjectValidator *pObjectValidator, m_group.keys())
+        if (!toResult(pObjectValidator->state()))
+        {
+            fResult = false;
+            break;
+        }
+
+    /* If validity state changed: */
+    if (m_fResult != fResult)
+    {
+        /* Update last validity state: */
+        m_fResult = fResult;
+
+        /* Notifies listener(s) about validity change: */
+        emit sigValidityChange(m_fResult);
+    }
+}
+
+/* static */
+bool QObjectValidatorGroup::toResult(QValidator::State state)
+{
+    return state == QValidator::Acceptable;
+}
 
 
 UIPageValidator::UIPageValidator(QObject *pParent, UISettingsPage *pPage)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h b/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h
index 5fb0e71..8674c78 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/QIWidgetValidator.h
@@ -1,7 +1,6 @@
+/* $Id: QIWidgetValidator.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: QIWidgetValidator class declaration
+ * VBox Qt GUI - Qt extensions: QIWidgetValidator class declaration.
  */
 
 /*
@@ -22,6 +21,7 @@
 /* Qt includes: */
 #include <QValidator>
 #include <QPixmap>
+#include <QMap>
 
 /* External includes: */
 #ifdef Q_WS_X11
@@ -31,6 +31,85 @@
 /* Forward declarations: */
 class UISettingsPage;
 
+/** QObject reimplementation,
+  * providing passed QObject with validation routine. */
+class QObjectValidator : public QObject
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listener(s) about validity change. */
+    void sigValidityChange(QValidator::State state);
+
+public:
+
+    /** Constructor.
+      * @param pParent    is passed on to the QObject constructor,
+      * @param pValidator is passed on to the OObject children
+      *                   and used to perform validation itself. */
+    QObjectValidator(QValidator *pValidator, QObject *pParent = 0);
+
+    /** Returns last validation state. */
+    QValidator::State state() const { return m_state; }
+
+private slots:
+
+    /** Performs validation: */
+    void sltValidate(QString strInput = QString());
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Holds validator. */
+    QValidator *m_pValidator;
+    /** Holds validation state. */
+    QValidator::State m_state;
+};
+
+/** QObject reimplementation,
+  * which can group various QObjectValidator instances to operate on. */
+class QObjectValidatorGroup : public QObject
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listener(s) about validity change. */
+    void sigValidityChange(bool fValid);
+
+public:
+
+    /** Constructor.
+      * @param pParent is passed on to the QObject constructor. */
+    QObjectValidatorGroup(QObject *pParent);
+
+    /** Adds object-validator.
+      * @note The ownership of @a pObjectValidator is transferred to the group,
+      *       and it's the group's responsibility to delete it. */
+    void addObjectValidator(QObjectValidator *pObjectValidator);
+
+    /** Returns last validation result. */
+    bool result() const { return m_fResult; }
+
+private slots:
+
+    /** Performs validation: */
+    void sltValidate(QValidator::State state);
+
+private:
+
+    /** Converts QValidator::State to bool result. */
+    static bool toResult(QValidator::State state);
+
+    /** Holds object-validators and their states. */
+    QMap<QObjectValidator*, bool> m_group;
+    /** Holds validation result. */
+    bool m_fResult;
+};
+
 /* Page validator prototype: */
 class UIPageValidator : public QObject
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsWidget.cpp b/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsWidget.cpp
index 1988929..b678a3e 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsWidget.cpp
@@ -1,8 +1,6 @@
 /* $Id: QIGraphicsWidget.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIGraphicsWidget class definition
+ * VBox Qt GUI - QIGraphicsWidget class definition.
  */
 
 /*
@@ -17,8 +15,15 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "QIGraphicsWidget.h"
+# include "QIGraphicsWidget.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 QIGraphicsWidget::QIGraphicsWidget(QGraphicsWidget *pParent)
     : QGraphicsWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsWidget.h b/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsWidget.h
index 7556892..63c1563 100644
--- a/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/extensions/graphics/QIGraphicsWidget.h
@@ -1,7 +1,6 @@
+/* $Id: QIGraphicsWidget.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * QIGraphicsWidget class declaration
+ * VBox Qt GUI - QIGraphicsWidget class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
new file mode 100644
index 0000000..daf6f9c
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
@@ -0,0 +1,166 @@
+/* $Id: UIExtraDataDefs.cpp $ */
+/** @file
+ * VBox Qt GUI - Extra-data related definitions.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* GUI includes: */
+# include "UIExtraDataDefs.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+/* General: */
+const char* UIExtraDataDefs::GUI_LanguageId = "GUI/LanguageID";
+
+/* Messaging: */
+const char* UIExtraDataDefs::GUI_SuppressMessages = "GUI/SuppressMessages";
+const char* UIExtraDataDefs::GUI_InvertMessageOption = "GUI/InvertMessageOption";
+#if !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG)
+const char* UIExtraDataDefs::GUI_PreventBetaWarning = "GUI/PreventBetaWarning";
+#endif /* !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG) */
+
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+/* Application Update: */
+const char* UIExtraDataDefs::GUI_PreventApplicationUpdate = "GUI/PreventApplicationUpdate";
+const char* UIExtraDataDefs::GUI_UpdateDate = "GUI/UpdateDate";
+const char* UIExtraDataDefs::GUI_UpdateCheckCount = "GUI/UpdateCheckCount";
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+
+/* Settings: */
+const char* UIExtraDataDefs::GUI_RestrictedGlobalSettingsPages = "GUI/RestrictedGlobalSettingsPages";
+const char* UIExtraDataDefs::GUI_RestrictedMachineSettingsPages = "GUI/RestrictedMachineSettingsPages";
+
+/* Settings: Display: */
+const char* UIExtraDataDefs::GUI_ActivateHoveredMachineWindow = "GUI/ActivateHoveredMachineWindow";
+
+/* Settings: Keyboard: */
+const char* UIExtraDataDefs::GUI_Input_SelectorShortcuts = "GUI/Input/SelectorShortcuts";
+const char* UIExtraDataDefs::GUI_Input_MachineShortcuts = "GUI/Input/MachineShortcuts";
+
+/* Settings: Storage: */
+const char* UIExtraDataDefs::GUI_RecentFolderHD = "GUI/RecentFolderHD";
+const char* UIExtraDataDefs::GUI_RecentFolderCD = "GUI/RecentFolderCD";
+const char* UIExtraDataDefs::GUI_RecentFolderFD = "GUI/RecentFolderFD";
+const char* UIExtraDataDefs::GUI_RecentListHD = "GUI/RecentListHD";
+const char* UIExtraDataDefs::GUI_RecentListCD = "GUI/RecentListCD";
+const char* UIExtraDataDefs::GUI_RecentListFD = "GUI/RecentListFD";
+
+/* VirtualBox Manager: */
+const char* UIExtraDataDefs::GUI_LastSelectorWindowPosition = "GUI/LastWindowPosition";
+const char* UIExtraDataDefs::GUI_SplitterSizes = "GUI/SplitterSizes";
+const char* UIExtraDataDefs::GUI_Toolbar = "GUI/Toolbar";
+const char* UIExtraDataDefs::GUI_Statusbar = "GUI/Statusbar";
+const char* UIExtraDataDefs::GUI_GroupDefinitions = "GUI/GroupDefinitions";
+const char* UIExtraDataDefs::GUI_LastItemSelected = "GUI/LastItemSelected";
+const char* UIExtraDataDefs::GUI_DetailsPageBoxes = "GUI/DetailsPageBoxes";
+const char* UIExtraDataDefs::GUI_PreviewUpdate = "GUI/PreviewUpdate";
+
+/* Wizards: */
+const char* UIExtraDataDefs::GUI_HideDescriptionForWizards = "GUI/HideDescriptionForWizards";
+
+/* Virtual Machine: */
+const char* UIExtraDataDefs::GUI_HideFromManager = "GUI/HideFromManager";
+const char* UIExtraDataDefs::GUI_HideDetails = "GUI/HideDetails";
+const char* UIExtraDataDefs::GUI_PreventReconfiguration = "GUI/PreventReconfiguration";
+const char* UIExtraDataDefs::GUI_PreventSnapshotOperations = "GUI/PreventSnapshotOperations";
+const char* UIExtraDataDefs::GUI_FirstRun = "GUI/FirstRun";
+#ifndef Q_WS_MAC
+const char* UIExtraDataDefs::GUI_MachineWindowIcons = "GUI/MachineWindowIcons";
+const char* UIExtraDataDefs::GUI_MachineWindowNamePostfix = "GUI/MachineWindowNamePostfix";
+#endif /* !Q_WS_MAC */
+const char* UIExtraDataDefs::GUI_LastNormalWindowPosition = "GUI/LastNormalWindowPosition";
+const char* UIExtraDataDefs::GUI_LastScaleWindowPosition = "GUI/LastScaleWindowPosition";
+const char* UIExtraDataDefs::GUI_Geometry_State_Max = "max";
+#ifndef Q_WS_MAC
+const char* UIExtraDataDefs::GUI_MenuBar_Enabled = "GUI/MenuBar/Enabled";
+#endif /* !Q_WS_MAC */
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeMenus = "GUI/RestrictedRuntimeMenus";
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeApplicationMenuActions = "GUI/RestrictedRuntimeApplicationMenuActions";
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeMachineMenuActions = "GUI/RestrictedRuntimeMachineMenuActions";
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeViewMenuActions = "GUI/RestrictedRuntimeViewMenuActions";
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeInputMenuActions = "GUI/RestrictedRuntimeInputMenuActions";
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeDevicesMenuActions = "GUI/RestrictedRuntimeDevicesMenuActions";
+#ifdef VBOX_WITH_DEBUGGER_GUI
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeDebuggerMenuActions = "GUI/RestrictedRuntimeDebuggerMenuActions";
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeWindowMenuActions = "GUI/RestrictedRuntimeWindowMenuActions";
+#endif /* Q_WS_MAC */
+const char* UIExtraDataDefs::GUI_RestrictedRuntimeHelpMenuActions = "GUI/RestrictedRuntimeHelpMenuActions";
+const char* UIExtraDataDefs::GUI_RestrictedVisualStates = "GUI/RestrictedVisualStates";
+const char* UIExtraDataDefs::GUI_Fullscreen = "GUI/Fullscreen";
+const char* UIExtraDataDefs::GUI_Seamless = "GUI/Seamless";
+const char* UIExtraDataDefs::GUI_Scale = "GUI/Scale";
+#ifdef Q_WS_X11
+const char* UIExtraDataDefs::GUI_Fullscreen_LegacyMode = "GUI/Fullscreen/LegacyMode";
+#endif /* Q_WS_X11 */
+const char* UIExtraDataDefs::GUI_AutoresizeGuest = "GUI/AutoresizeGuest";
+const char* UIExtraDataDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint";
+const char* UIExtraDataDefs::GUI_LastGuestSizeHintWasFullscreen = "GUI/LastGuestSizeHintWasFullscreen";
+const char* UIExtraDataDefs::GUI_VirtualScreenToHostScreen = "GUI/VirtualScreenToHostScreen";
+const char* UIExtraDataDefs::GUI_AutomountGuestScreens = "GUI/AutomountGuestScreens";
+#ifdef VBOX_WITH_VIDEOHWACCEL
+const char* UIExtraDataDefs::GUI_Accelerate2D_StretchLinear = "GUI/Accelerate2D/StretchLinear";
+const char* UIExtraDataDefs::GUI_Accelerate2D_PixformatYV12 = "GUI/Accelerate2D/PixformatYV12";
+const char* UIExtraDataDefs::GUI_Accelerate2D_PixformatUYVY = "GUI/Accelerate2D/PixformatUYVY";
+const char* UIExtraDataDefs::GUI_Accelerate2D_PixformatYUY2 = "GUI/Accelerate2D/PixformatYUY2";
+const char* UIExtraDataDefs::GUI_Accelerate2D_PixformatAYUV = "GUI/Accelerate2D/PixformatAYUV";
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+const char* UIExtraDataDefs::GUI_HiDPI_UnscaledOutput = "GUI/HiDPI/UnscaledOutput";
+const char* UIExtraDataDefs::GUI_HiDPI_Optimization = "GUI/HiDPI/Optimization";
+#ifndef Q_WS_MAC
+const char* UIExtraDataDefs::GUI_ShowMiniToolBar = "GUI/ShowMiniToolBar";
+const char* UIExtraDataDefs::GUI_MiniToolBarAutoHide = "GUI/MiniToolBarAutoHide";
+const char* UIExtraDataDefs::GUI_MiniToolBarAlignment = "GUI/MiniToolBarAlignment";
+#endif /* !Q_WS_MAC */
+const char* UIExtraDataDefs::GUI_StatusBar_Enabled = "GUI/StatusBar/Enabled";
+const char* UIExtraDataDefs::GUI_RestrictedStatusBarIndicators = "GUI/RestrictedStatusBarIndicators";
+const char* UIExtraDataDefs::GUI_StatusBar_IndicatorOrder = "GUI/StatusBar/IndicatorOrder";
+#ifdef Q_WS_MAC
+const char* UIExtraDataDefs::GUI_RealtimeDockIconUpdateEnabled = "GUI/RealtimeDockIconUpdateEnabled";
+const char* UIExtraDataDefs::GUI_RealtimeDockIconUpdateMonitor = "GUI/RealtimeDockIconUpdateMonitor";
+#endif /* Q_WS_MAC */
+const char* UIExtraDataDefs::GUI_PassCAD = "GUI/PassCAD";
+const char* UIExtraDataDefs::GUI_MouseCapturePolicy = "GUI/MouseCapturePolicy";
+const char* UIExtraDataDefs::GUI_GuruMeditationHandler = "GUI/GuruMeditationHandler";
+const char* UIExtraDataDefs::GUI_HidLedsSync = "GUI/HidLedsSync";
+const char* UIExtraDataDefs::GUI_ScaleFactor = "GUI/ScaleFactor";
+const char* UIExtraDataDefs::GUI_Scaling_Optimization = "GUI/Scaling/Optimization";
+
+/* Virtual Machine: Information dialog: */
+const char* UIExtraDataDefs::GUI_InformationWindowGeometry = "GUI/InformationWindowGeometry";
+
+/* Virtual Machine: Close dialog: */
+const char* UIExtraDataDefs::GUI_DefaultCloseAction = "GUI/DefaultCloseAction";
+const char* UIExtraDataDefs::GUI_RestrictedCloseActions = "GUI/RestrictedCloseActions";
+const char* UIExtraDataDefs::GUI_LastCloseAction = "GUI/LastCloseAction";
+const char* UIExtraDataDefs::GUI_CloseActionHook = "GUI/CloseActionHook";
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+/* Virtual Machine: Debug UI: */
+const char* UIExtraDataDefs::GUI_Dbg_Enabled = "GUI/Dbg/Enabled";
+const char* UIExtraDataDefs::GUI_Dbg_AutoShow = "GUI/Dbg/AutoShow";
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef DEBUG
+/* VirtualBox: Extra-data Manager window: */
+const char* UIExtraDataDefs::GUI_ExtraDataManager_Geometry = "GUI/ExtraDataManager/Geometry";
+const char* UIExtraDataDefs::GUI_ExtraDataManager_SplitterHints = "GUI/ExtraDataManager/SplitterHints";
+#endif /* DEBUG */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
new file mode 100644
index 0000000..2533ac5
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
@@ -0,0 +1,648 @@
+/* $Id: UIExtraDataDefs.h $ */
+/** @file
+ * VBox Qt GUI - Extra-data related definitions.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIExtraDataDefs_h___
+#define ___UIExtraDataDefs_h___
+
+/* Qt includes: */
+#include <QMetaType>
+
+/* Other VBox includes: */
+#include <iprt/cdefs.h>
+
+/** Extra-data namespace. */
+namespace UIExtraDataDefs
+{
+    /** @name General
+      * @{ */
+        /** VBox language ID. */
+        extern const char* GUI_LanguageId;
+    /** @} */
+
+    /** @name Messaging
+      * @{ */
+        /** Holds the list of supressed messages for the Message/Popup center frameworks. */
+        extern const char* GUI_SuppressMessages;
+        /** Holds the list of messages for the Message/Popup center frameworks with inverted check-box state. */
+        extern const char* GUI_InvertMessageOption;
+#if !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG)
+        /** Holds version for which user wants to prevent BETA build warning. */
+        extern const char* GUI_PreventBetaWarning;
+#endif /* !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG) */
+    /** @} */
+
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    /** @name Application Update
+      * @{ */
+        /** Holds whether Application Update functionality enabled. */
+        extern const char* GUI_PreventApplicationUpdate;
+        /** Holds Application Update data. */
+        extern const char* GUI_UpdateDate;
+        /** Holds Application Update check counter. */
+        extern const char* GUI_UpdateCheckCount;
+    /** @} */
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+
+    /** @name Settings
+      * @{ */
+        /** Holds restricted Global Settings pages. */
+        extern const char* GUI_RestrictedGlobalSettingsPages;
+        /** Holds restricted Machine Settings pages. */
+        extern const char* GUI_RestrictedMachineSettingsPages;
+    /** @} */
+
+    /** @name Settings: Display
+      * @{ */
+        /** Holds whether hovered machine-window should be activated. */
+        extern const char* GUI_ActivateHoveredMachineWindow;
+    /** @} */
+
+    /** @name Settings: Keyboard
+      * @{ */
+        /** Holds Selector UI shortcut overrides. */
+        extern const char* GUI_Input_SelectorShortcuts;
+        /** Holds Runtime UI shortcut overrides. */
+        extern const char* GUI_Input_MachineShortcuts;
+    /** @} */
+
+    /** @name Settings: Storage
+      * @{ */
+        /** Holds recent folder for hard-drives. */
+        extern const char* GUI_RecentFolderHD;
+        /** Holds recent folder for optical-disks. */
+        extern const char* GUI_RecentFolderCD;
+        /** Holds recent folder for floppy-disks. */
+        extern const char* GUI_RecentFolderFD;
+        /** Holds the list of recently used hard-drives. */
+        extern const char* GUI_RecentListHD;
+        /** Holds the list of recently used optical-disks. */
+        extern const char* GUI_RecentListCD;
+        /** Holds the list of recently used floppy-disks. */
+        extern const char* GUI_RecentListFD;
+    /** @} */
+
+    /** @name VirtualBox Manager
+      * @{ */
+        /** Holds selector-window geometry. */
+        extern const char* GUI_LastSelectorWindowPosition;
+        /** Holds selector-window splitter hints. */
+        extern const char* GUI_SplitterSizes;
+        /** Holds whether selector-window tool-bar visible. */
+        extern const char* GUI_Toolbar;
+        /** Holds whether selector-window status-bar visible. */
+        extern const char* GUI_Statusbar;
+        /** Prefix used by composite extra-data keys,
+          * which holds selector-window chooser-pane' groups definitions. */
+        extern const char* GUI_GroupDefinitions;
+        /** Holds last item chosen in selector-window chooser-pane. */
+        extern const char* GUI_LastItemSelected;
+        /** Holds selector-window details-pane' elements. */
+        extern const char* GUI_DetailsPageBoxes;
+        /** Holds selector-window details-pane' preview update interval. */
+        extern const char* GUI_PreviewUpdate;
+    /** @} */
+
+    /** @name Wizards
+      * @{ */
+        /** Holds wizard types for which descriptions should be hidden. */
+        extern const char* GUI_HideDescriptionForWizards;
+    /** @} */
+
+    /** @name Virtual Machine
+      * @{ */
+        /** Holds whether machine shouldn't be shown in selector-window chooser-pane. */
+        extern const char* GUI_HideFromManager;
+        /** Holds whether machine shouldn't be shown in selector-window details-pane. */
+        extern const char* GUI_HideDetails;
+        /** Holds whether machine reconfiguration disabled. */
+        extern const char* GUI_PreventReconfiguration;
+        /** Holds whether machine snapshot operations disabled. */
+        extern const char* GUI_PreventSnapshotOperations;
+        /** Holds whether this machine is first time started. */
+        extern const char* GUI_FirstRun;
+#ifndef Q_WS_MAC
+        /** Except Mac OS X: Holds redefined machine-window icon names. */
+        extern const char* GUI_MachineWindowIcons;
+        /** Except Mac OS X: Holds redefined machine-window name postfix. */
+        extern const char* GUI_MachineWindowNamePostfix;
+#endif /* !Q_WS_MAC */
+        /** Prefix used by composite extra-data keys,
+          * which holds normal machine-window geometry per screen-index. */
+        extern const char* GUI_LastNormalWindowPosition;
+        /** Prefix used by composite extra-data keys,
+          * which holds scaled machine-window geometry per screen-index. */
+        extern const char* GUI_LastScaleWindowPosition;
+        /** Holds machine-window geometry maximized state flag. */
+        extern const char* GUI_Geometry_State_Max;
+#ifndef Q_WS_MAC
+        /** Holds Runtime UI menu-bar availability status. */
+        extern const char* GUI_MenuBar_Enabled;
+#endif /* !Q_WS_MAC */
+        /** Holds restricted Runtime UI menu types. */
+        extern const char* GUI_RestrictedRuntimeMenus;
+        /** Holds restricted Runtime UI action types for 'Application' menu. */
+        extern const char* GUI_RestrictedRuntimeApplicationMenuActions;
+        /** Holds restricted Runtime UI action types for Machine menu. */
+        extern const char* GUI_RestrictedRuntimeMachineMenuActions;
+        /** Holds restricted Runtime UI action types for View menu. */
+        extern const char* GUI_RestrictedRuntimeViewMenuActions;
+        /** Holds restricted Runtime UI action types for Input menu. */
+        extern const char* GUI_RestrictedRuntimeInputMenuActions;
+        /** Holds restricted Runtime UI action types for Devices menu. */
+        extern const char* GUI_RestrictedRuntimeDevicesMenuActions;
+#ifdef VBOX_WITH_DEBUGGER_GUI
+        /** Holds restricted Runtime UI action types for Debugger menu. */
+        extern const char* GUI_RestrictedRuntimeDebuggerMenuActions;
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+        /** Mac OS X: Holds restricted Runtime UI action types for 'Window' menu. */
+        extern const char* GUI_RestrictedRuntimeWindowMenuActions;
+#endif /* Q_WS_MAC */
+        /** Holds restricted Runtime UI action types for Help menu. */
+        extern const char* GUI_RestrictedRuntimeHelpMenuActions;
+        /** Holds restricted Runtime UI visual-states. */
+        extern const char* GUI_RestrictedVisualStates;
+        /** Holds whether full screen visual-state is requested. */
+        extern const char* GUI_Fullscreen;
+        /** Holds whether seamless visual-state is requested. */
+        extern const char* GUI_Seamless;
+        /** Holds whether scaled visual-state is requested. */
+        extern const char* GUI_Scale;
+#ifdef Q_WS_X11
+        /** Holds whether legacy full-screen mode is requested. */
+        extern const char* GUI_Fullscreen_LegacyMode;
+#endif /* Q_WS_X11 */
+        /** Holds whether guest-screen auto-resize according machine-window size is enabled. */
+        extern const char* GUI_AutoresizeGuest;
+        /** Prefix used by composite extra-data keys,
+          * which holds last guest-screen size-hint per screen-index. */
+        extern const char* GUI_LastGuestSizeHint;
+        /** Prefix used by composite extra-data keys,
+          * which holds whether guest size-hint was for full or seamless screen per screen-index. */
+        extern const char* GUI_LastGuestSizeHintWasFullscreen;
+        /** Prefix used by composite extra-data keys,
+          * which holds host-screen index per guest-screen index. */
+        extern const char* GUI_VirtualScreenToHostScreen;
+        /** Holds whether automatic mounting/unmounting of guest-screens enabled. */
+        extern const char* GUI_AutomountGuestScreens;
+#ifdef VBOX_WITH_VIDEOHWACCEL
+        /** Holds whether 2D acceleration should use linear sretch. */
+        extern const char* GUI_Accelerate2D_StretchLinear;
+        /** Holds whether 2D acceleration should use YV12 pixel format. */
+        extern const char* GUI_Accelerate2D_PixformatYV12;
+        /** Holds whether 2D acceleration should use UYVY pixel format. */
+        extern const char* GUI_Accelerate2D_PixformatUYVY;
+        /** Holds whether 2D acceleration should use YUY2 pixel format. */
+        extern const char* GUI_Accelerate2D_PixformatYUY2;
+        /** Holds whether 2D acceleration should use AYUV pixel format. */
+        extern const char* GUI_Accelerate2D_PixformatAYUV;
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+        /** Holds whether Runtime UI should use unscaled HiDPI output. */
+        extern const char* GUI_HiDPI_UnscaledOutput;
+        /** Holds Runtime UI HiDPI optimization type. */
+        extern const char* GUI_HiDPI_Optimization;
+#ifndef Q_WS_MAC
+        /** Holds whether mini-toolbar is enabled for full and seamless screens. */
+        extern const char* GUI_ShowMiniToolBar;
+        /** Holds whether mini-toolbar should auto-hide itself. */
+        extern const char* GUI_MiniToolBarAutoHide;
+        /** Holds mini-toolbar alignment. */
+        extern const char* GUI_MiniToolBarAlignment;
+#endif /* !Q_WS_MAC */
+        /** Holds Runtime UI status-bar availability status. */
+        extern const char* GUI_StatusBar_Enabled;
+        /** Holds restricted Runtime UI status-bar indicators. */
+        extern const char* GUI_RestrictedStatusBarIndicators;
+        /** Holds Runtime UI status-bar indicator order. */
+        extern const char* GUI_StatusBar_IndicatorOrder;
+#ifdef Q_WS_MAC
+        /** Mac OS X: Holds whether Dock icon should be updated at runtime. */
+        extern const char* GUI_RealtimeDockIconUpdateEnabled;
+        /** Mac OS X: Holds guest-screen which Dock icon should reflect at runtime. */
+        extern const char* GUI_RealtimeDockIconUpdateMonitor;
+#endif /* Q_WS_MAC */
+        /** Holds whether machine should pass CAD to guest. */
+        extern const char* GUI_PassCAD;
+        /** Holds the mouse capture policy. */
+        extern const char* GUI_MouseCapturePolicy;
+        /** Holds redefined guru-meditation handler type. */
+        extern const char* GUI_GuruMeditationHandler;
+        /** Holds whether machine should perform HID LEDs synchronization. */
+        extern const char* GUI_HidLedsSync;
+        /** Holds the scale-factor. */
+        extern const char* GUI_ScaleFactor;
+        /** Holds the scaling optimization type. */
+        extern const char* GUI_Scaling_Optimization;
+    /** @} */
+
+    /** @name Virtual Machine: Information dialog
+      * @{ */
+        /** Holds information-window geometry. */
+        extern const char* GUI_InformationWindowGeometry;
+    /** @} */
+
+    /** @name Virtual Machine: Close dialog
+      * @{ */
+        /** Holds default machine close action. */
+        extern const char* GUI_DefaultCloseAction;
+        /** Holds restricted machine close actions. */
+        extern const char* GUI_RestrictedCloseActions;
+        /** Holds last machine close action. */
+        extern const char* GUI_LastCloseAction;
+        /** Holds machine close hook script name as simple string. */
+        extern const char* GUI_CloseActionHook;
+    /** @} */
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** @name Virtual Machine: Debug UI
+      * @{ */
+        /** Holds whether debugger UI enabled. */
+        extern const char* GUI_Dbg_Enabled;
+        /** Holds whether debugger UI should be auto-shown. */
+        extern const char* GUI_Dbg_AutoShow;
+    /** @} */
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef DEBUG
+    /** @name VirtualBox: Extra-data Manager window
+      * @{ */
+        /** Holds extra-data manager geometry. */
+        extern const char* GUI_ExtraDataManager_Geometry;
+        /** Holds extra-data manager splitter hints. */
+        extern const char* GUI_ExtraDataManager_SplitterHints;
+    /** @} */
+#endif /* DEBUG */
+}
+
+/** Extra-data meta definitions. */
+class UIExtraDataMetaDefs : public QObject
+{
+    Q_OBJECT;
+    Q_ENUMS(MenuType);
+    Q_ENUMS(MenuApplicationActionType);
+    Q_ENUMS(MenuHelpActionType);
+    Q_ENUMS(RuntimeMenuMachineActionType);
+    Q_ENUMS(RuntimeMenuViewActionType);
+    Q_ENUMS(RuntimeMenuInputActionType);
+    Q_ENUMS(RuntimeMenuDevicesActionType);
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    Q_ENUMS(RuntimeMenuDebuggerActionType);
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef RT_OS_DARWIN
+    Q_ENUMS(MenuWindowActionType);
+#endif /* RT_OS_DARWIN */
+
+public:
+
+    /** Common UI: Menu types. */
+    enum MenuType
+    {
+        MenuType_Invalid     = 0,
+        MenuType_Application = RT_BIT(0),
+        MenuType_Machine     = RT_BIT(1),
+        MenuType_View        = RT_BIT(2),
+        MenuType_Input       = RT_BIT(3),
+        MenuType_Devices     = RT_BIT(4),
+#ifdef VBOX_WITH_DEBUGGER_GUI
+        MenuType_Debug       = RT_BIT(5),
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef RT_OS_DARWIN
+        MenuType_Window      = RT_BIT(6),
+#endif /* RT_OS_DARWIN */
+        MenuType_Help        = RT_BIT(7),
+        MenuType_All         = 0xFF
+    };
+
+    /** Menu "Application": Action types. */
+    enum MenuApplicationActionType
+    {
+        MenuApplicationActionType_Invalid              = 0,
+#ifdef RT_OS_DARWIN
+        MenuApplicationActionType_About                = RT_BIT(0),
+#endif /* RT_OS_DARWIN */
+        MenuApplicationActionType_Preferences          = RT_BIT(1),
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+        MenuApplicationActionType_NetworkAccessManager = RT_BIT(2),
+        MenuApplicationActionType_CheckForUpdates      = RT_BIT(3),
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+        MenuApplicationActionType_ResetWarnings        = RT_BIT(4),
+        MenuApplicationActionType_Close                = RT_BIT(5),
+        MenuApplicationActionType_All                  = 0xFFFF
+    };
+
+    /** Menu "Help": Action types. */
+    enum MenuHelpActionType
+    {
+        MenuHelpActionType_Invalid              = 0,
+        MenuHelpActionType_Contents             = RT_BIT(0),
+        MenuHelpActionType_WebSite              = RT_BIT(1),
+#ifndef RT_OS_DARWIN
+        MenuHelpActionType_About                = RT_BIT(2),
+#endif /* !RT_OS_DARWIN */
+        MenuHelpActionType_All                  = 0xFFFF
+    };
+
+    /** Runtime UI: Menu "Machine": Action types. */
+    enum RuntimeMenuMachineActionType
+    {
+        RuntimeMenuMachineActionType_Invalid           = 0,
+        RuntimeMenuMachineActionType_SettingsDialog    = RT_BIT(0),
+        RuntimeMenuMachineActionType_TakeSnapshot      = RT_BIT(1),
+        RuntimeMenuMachineActionType_InformationDialog = RT_BIT(2),
+        RuntimeMenuMachineActionType_Pause             = RT_BIT(3),
+        RuntimeMenuMachineActionType_Reset             = RT_BIT(4),
+        RuntimeMenuMachineActionType_SaveState         = RT_BIT(5),
+        RuntimeMenuMachineActionType_Shutdown          = RT_BIT(6),
+        RuntimeMenuMachineActionType_PowerOff          = RT_BIT(7),
+        RuntimeMenuMachineActionType_Nothing           = RT_BIT(8),
+        RuntimeMenuMachineActionType_All               = 0xFFFF
+    };
+
+    /** Runtime UI: Menu "View": Action types. */
+    enum RuntimeMenuViewActionType
+    {
+        RuntimeMenuViewActionType_Invalid              = 0,
+        RuntimeMenuViewActionType_Fullscreen           = RT_BIT(0),
+        RuntimeMenuViewActionType_Seamless             = RT_BIT(1),
+        RuntimeMenuViewActionType_Scale                = RT_BIT(2),
+        RuntimeMenuViewActionType_GuestAutoresize      = RT_BIT(3),
+        RuntimeMenuViewActionType_AdjustWindow         = RT_BIT(4),
+        RuntimeMenuViewActionType_TakeScreenshot       = RT_BIT(5),
+        RuntimeMenuViewActionType_VideoCapture         = RT_BIT(6),
+        RuntimeMenuViewActionType_VideoCaptureSettings = RT_BIT(7),
+        RuntimeMenuViewActionType_StartVideoCapture    = RT_BIT(8),
+        RuntimeMenuViewActionType_VRDEServer           = RT_BIT(9),
+        RuntimeMenuViewActionType_MenuBar              = RT_BIT(10),
+        RuntimeMenuViewActionType_MenuBarSettings      = RT_BIT(11),
+#ifndef RT_OS_DARWIN
+        RuntimeMenuViewActionType_ToggleMenuBar        = RT_BIT(12),
+#endif /* !RT_OS_DARWIN */
+        RuntimeMenuViewActionType_StatusBar            = RT_BIT(13),
+        RuntimeMenuViewActionType_StatusBarSettings    = RT_BIT(14),
+        RuntimeMenuViewActionType_ToggleStatusBar      = RT_BIT(15),
+        RuntimeMenuViewActionType_ScaleFactor          = RT_BIT(16),
+        RuntimeMenuViewActionType_Resize               = RT_BIT(17),
+        RuntimeMenuViewActionType_Multiscreen          = RT_BIT(18),
+        RuntimeMenuViewActionType_All                  = 0xFFFF
+    };
+
+    /** Runtime UI: Menu "Input": Action types. */
+    enum RuntimeMenuInputActionType
+    {
+        RuntimeMenuInputActionType_Invalid           = 0,
+        RuntimeMenuInputActionType_Keyboard          = RT_BIT(0),
+        RuntimeMenuInputActionType_KeyboardSettings  = RT_BIT(1),
+        RuntimeMenuInputActionType_TypeCAD           = RT_BIT(2),
+#ifdef Q_WS_X11
+        RuntimeMenuInputActionType_TypeCABS          = RT_BIT(3),
+#endif /* Q_WS_X11 */
+        RuntimeMenuInputActionType_TypeCtrlBreak     = RT_BIT(4),
+        RuntimeMenuInputActionType_TypeInsert        = RT_BIT(5),
+        RuntimeMenuInputActionType_Mouse             = RT_BIT(6),
+        RuntimeMenuInputActionType_MouseIntegration  = RT_BIT(7),
+        RuntimeMenuInputActionType_All               = 0xFFFF
+    };
+
+    /** Runtime UI: Menu "Devices": Action types. */
+    enum RuntimeMenuDevicesActionType
+    {
+        RuntimeMenuDevicesActionType_Invalid               = 0,
+        RuntimeMenuDevicesActionType_HardDrives            = RT_BIT(0),
+        RuntimeMenuDevicesActionType_HardDrivesSettings    = RT_BIT(1),
+        RuntimeMenuDevicesActionType_OpticalDevices        = RT_BIT(2),
+        RuntimeMenuDevicesActionType_FloppyDevices         = RT_BIT(3),
+        RuntimeMenuDevicesActionType_Network               = RT_BIT(4),
+        RuntimeMenuDevicesActionType_NetworkSettings       = RT_BIT(5),
+        RuntimeMenuDevicesActionType_USBDevices            = RT_BIT(6),
+        RuntimeMenuDevicesActionType_USBDevicesSettings    = RT_BIT(7),
+        RuntimeMenuDevicesActionType_WebCams               = RT_BIT(8),
+        RuntimeMenuDevicesActionType_SharedClipboard       = RT_BIT(9),
+        RuntimeMenuDevicesActionType_DragAndDrop           = RT_BIT(10),
+        RuntimeMenuDevicesActionType_SharedFolders         = RT_BIT(11),
+        RuntimeMenuDevicesActionType_SharedFoldersSettings = RT_BIT(12),
+        RuntimeMenuDevicesActionType_InstallGuestTools     = RT_BIT(13),
+        RuntimeMenuDevicesActionType_Nothing               = RT_BIT(14),
+        RuntimeMenuDevicesActionType_All                   = 0xFFFF
+    };
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** Runtime UI: Menu "Debugger": Action types. */
+    enum RuntimeMenuDebuggerActionType
+    {
+        RuntimeMenuDebuggerActionType_Invalid     = 0,
+        RuntimeMenuDebuggerActionType_Statistics  = RT_BIT(0),
+        RuntimeMenuDebuggerActionType_CommandLine = RT_BIT(1),
+        RuntimeMenuDebuggerActionType_Logging     = RT_BIT(2),
+        RuntimeMenuDebuggerActionType_LogDialog   = RT_BIT(3),
+        RuntimeMenuDebuggerActionType_All         = 0xFFFF
+    };
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef RT_OS_DARWIN
+    /** Menu "Window": Action types. */
+    enum MenuWindowActionType
+    {
+        MenuWindowActionType_Invalid  = 0,
+        MenuWindowActionType_Minimize = RT_BIT(0),
+        MenuWindowActionType_Switch   = RT_BIT(1),
+        MenuWindowActionType_All      = 0xFFFF
+    };
+#endif /* RT_OS_DARWIN */
+};
+
+/** Common UI: Global settings page types. */
+enum GlobalSettingsPageType
+{
+    GlobalSettingsPageType_Invalid,
+    GlobalSettingsPageType_General,
+    GlobalSettingsPageType_Input,
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    GlobalSettingsPageType_Update,
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+    GlobalSettingsPageType_Language,
+    GlobalSettingsPageType_Display,
+    GlobalSettingsPageType_Network,
+    GlobalSettingsPageType_Extensions,
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    GlobalSettingsPageType_Proxy,
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+    GlobalSettingsPageType_Max
+};
+Q_DECLARE_METATYPE(GlobalSettingsPageType);
+
+/** Common UI: Machine settings page types. */
+enum MachineSettingsPageType
+{
+    MachineSettingsPageType_Invalid,
+    MachineSettingsPageType_General,
+    MachineSettingsPageType_System,
+    MachineSettingsPageType_Display,
+    MachineSettingsPageType_Storage,
+    MachineSettingsPageType_Audio,
+    MachineSettingsPageType_Network,
+    MachineSettingsPageType_Ports,
+    MachineSettingsPageType_Serial,
+    MachineSettingsPageType_Parallel,
+    MachineSettingsPageType_USB,
+    MachineSettingsPageType_SF,
+    MachineSettingsPageType_Interface,
+    MachineSettingsPageType_Max
+};
+Q_DECLARE_METATYPE(MachineSettingsPageType);
+
+/** Common UI: Wizard types. */
+enum WizardType
+{
+    WizardType_Invalid,
+    WizardType_NewVM,
+    WizardType_CloneVM,
+    WizardType_ExportAppliance,
+    WizardType_ImportAppliance,
+    WizardType_FirstRun,
+    WizardType_NewVD,
+    WizardType_CloneVD
+};
+
+/** Common UI: Wizard modes. */
+enum WizardMode
+{
+    WizardMode_Auto,
+    WizardMode_Basic,
+    WizardMode_Expert
+};
+
+
+/** Selector UI: Details-element types. */
+enum DetailsElementType
+{
+    DetailsElementType_Invalid,
+    DetailsElementType_General,
+    DetailsElementType_System,
+    DetailsElementType_Preview,
+    DetailsElementType_Display,
+    DetailsElementType_Storage,
+    DetailsElementType_Audio,
+    DetailsElementType_Network,
+    DetailsElementType_Serial,
+#ifdef VBOX_WITH_PARALLEL_PORTS
+    DetailsElementType_Parallel,
+#endif /* VBOX_WITH_PARALLEL_PORTS */
+    DetailsElementType_USB,
+    DetailsElementType_SF,
+    DetailsElementType_UI,
+    DetailsElementType_Description
+};
+Q_DECLARE_METATYPE(DetailsElementType);
+
+/** Selector UI: Preview update interval types. */
+enum PreviewUpdateIntervalType
+{
+    PreviewUpdateIntervalType_Disabled,
+    PreviewUpdateIntervalType_500ms,
+    PreviewUpdateIntervalType_1000ms,
+    PreviewUpdateIntervalType_2000ms,
+    PreviewUpdateIntervalType_5000ms,
+    PreviewUpdateIntervalType_10000ms,
+    PreviewUpdateIntervalType_Max
+};
+
+
+/** Runtime UI: Visual-state types. */
+enum UIVisualStateType
+{
+    UIVisualStateType_Invalid    = 0,
+    UIVisualStateType_Normal     = RT_BIT(0),
+    UIVisualStateType_Fullscreen = RT_BIT(1),
+    UIVisualStateType_Seamless   = RT_BIT(2),
+    UIVisualStateType_Scale      = RT_BIT(3),
+    UIVisualStateType_All        = 0xFF
+};
+Q_DECLARE_METATYPE(UIVisualStateType);
+
+/** Runtime UI: Indicator types. */
+enum IndicatorType
+{
+    IndicatorType_Invalid,
+    IndicatorType_HardDisks,
+    IndicatorType_OpticalDisks,
+    IndicatorType_FloppyDisks,
+    IndicatorType_Network,
+    IndicatorType_USB,
+    IndicatorType_SharedFolders,
+    IndicatorType_Display,
+    IndicatorType_VideoCapture,
+    IndicatorType_Features,
+    IndicatorType_Mouse,
+    IndicatorType_Keyboard,
+    IndicatorType_KeyboardExtension,
+    IndicatorType_Max
+};
+Q_DECLARE_METATYPE(IndicatorType);
+
+/** Runtime UI: Machine close actions. */
+enum MachineCloseAction
+{
+    MachineCloseAction_Invalid                    = 0,
+    MachineCloseAction_Detach                     = RT_BIT(0),
+    MachineCloseAction_SaveState                  = RT_BIT(1),
+    MachineCloseAction_Shutdown                   = RT_BIT(2),
+    MachineCloseAction_PowerOff                   = RT_BIT(3),
+    MachineCloseAction_PowerOff_RestoringSnapshot = RT_BIT(4),
+    MachineCloseAction_All                        = 0xFF
+};
+Q_DECLARE_METATYPE(MachineCloseAction);
+
+/** Runtime UI: Mouse capture policy types. */
+enum MouseCapturePolicy
+{
+    MouseCapturePolicy_Default,
+    MouseCapturePolicy_HostComboOnly,
+    MouseCapturePolicy_Disabled
+};
+
+/** Guru Meditation handler types. */
+enum GuruMeditationHandlerType
+{
+    GuruMeditationHandlerType_Default,
+    GuruMeditationHandlerType_PowerOff,
+    GuruMeditationHandlerType_Ignore
+};
+
+/** Runtime UI: Scaling optimization types. */
+enum ScalingOptimizationType
+{
+    ScalingOptimizationType_None,
+    ScalingOptimizationType_Performance
+};
+
+/** Runtime UI: HiDPI optimization types. */
+enum HiDPIOptimizationType
+{
+    HiDPIOptimizationType_None,
+    HiDPIOptimizationType_Performance
+};
+
+#ifndef Q_WS_MAC
+/** Runtime UI: Mini-toolbar alignment. */
+enum MiniToolbarAlignment
+{
+    MiniToolbarAlignment_Bottom,
+    MiniToolbarAlignment_Top
+};
+#endif /* !Q_WS_MAC */
+
+#endif /* !___UIExtraDataDefs_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
new file mode 100644
index 0000000..978737c
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
@@ -0,0 +1,3873 @@
+/* $Id: UIExtraDataManager.cpp $ */
+/** @file
+ * VBox Qt GUI - UIExtraDataManager class implementation.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QMutex>
+# include <QMetaEnum>
+# include <QDesktopWidget>
+# ifdef DEBUG
+#  include <QMainWindow>
+#  include <QMenuBar>
+#  include <QListView>
+#  include <QTableView>
+#  include <QHeaderView>
+#  include <QSortFilterProxyModel>
+#  include <QStyledItemDelegate>
+#  include <QPainter>
+#  include <QLabel>
+#  include <QLineEdit>
+#  include <QComboBox>
+#  include <QPushButton>
+# endif /* DEBUG */
+
+/* GUI includes: */
+# include "UIExtraDataManager.h"
+# include "UIMainEventListener.h"
+# include "VBoxGlobalSettings.h"
+# include "VBoxGlobal.h"
+# include "UIActionPool.h"
+# include "UIConverter.h"
+# include "UISettingsDefs.h"
+# include "UIMessageCenter.h"
+# ifdef DEBUG
+#  include "VBoxUtils.h"
+#  include "UIVirtualBoxEventHandler.h"
+#  include "UIIconPool.h"
+#  include "UIToolBar.h"
+#  include "QIWidgetValidator.h"
+#  include "QIDialogButtonBox.h"
+#  include "QIFileDialog.h"
+#  include "QISplitter.h"
+#  include "QIDialog.h"
+# endif /* DEBUG */
+
+/* COM includes: */
+# include "COMEnums.h"
+# include "CEventSource.h"
+# include "CVirtualBox.h"
+# include "CMachine.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#ifdef DEBUG
+# include <QStandardItemModel>
+# include <QXmlStreamWriter>
+# include <QXmlStreamReader>
+#endif
+
+
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+using namespace UISettingsDefs;
+
+
+/** QObject extension
+  * notifying UIExtraDataManager whenever any of extra-data values changed. */
+class UIExtraDataEventHandler : public QObject
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies about 'extra-data change' event: */
+    void sigExtraDataChange(QString strMachineID, QString strKey, QString strValue);
+
+public:
+
+    /** Extra-data event-handler constructor. */
+    UIExtraDataEventHandler(QObject *pParent);
+
+public slots:
+
+    /** Preprocess 'extra-data can change' event: */
+    void sltPreprocessExtraDataCanChange(QString strMachineID, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason);
+    /** Preprocess 'extra-data change' event: */
+    void sltPreprocessExtraDataChange(QString strMachineID, QString strKey, QString strValue);
+
+private:
+
+    /** Protects sltPreprocessExtraDataChange. */
+    QMutex m_mutex;
+};
+
+UIExtraDataEventHandler::UIExtraDataEventHandler(QObject *pParent)
+    : QObject(pParent)
+{
+}
+
+void UIExtraDataEventHandler::sltPreprocessExtraDataCanChange(QString strMachineID, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason)
+{
+    /* Preprocess global 'extra-data can change' event: */
+    if (QUuid(strMachineID).isNull())
+    {
+        if (strKey.startsWith("GUI/"))
+        {
+            /* Try to set the global setting to check its syntax: */
+            VBoxGlobalSettings gs(false /* non-null */);
+            /* Known GUI property key? */
+            if (gs.setPublicProperty(strKey, strValue))
+            {
+                /* But invalid GUI property value? */
+                if (!gs)
+                {
+                    /* Remember veto reason: */
+                    strVetoReason = gs.lastError();
+                    /* And disallow that change: */
+                    fVeto = true;
+                }
+            }
+        }
+    }
+}
+
+void UIExtraDataEventHandler::sltPreprocessExtraDataChange(QString strMachineID, QString strKey, QString strValue)
+{
+    /* Preprocess global 'extra-data change' event: */
+    if (QUuid(strMachineID).isNull())
+    {
+        if (strKey.startsWith("GUI/"))
+        {
+            /* Apply global property: */
+            m_mutex.lock();
+            vboxGlobal().settings().setPublicProperty(strKey, strValue);
+            m_mutex.unlock();
+            AssertMsgReturnVoid(!!vboxGlobal().settings(), ("Failed to apply global property.\n"));
+        }
+    }
+
+    /* Motify listener about 'extra-data change' event: */
+    emit sigExtraDataChange(strMachineID, strKey, strValue);
+}
+
+
+#ifdef DEBUG
+/** Data fields. */
+enum Field
+{
+    Field_ID = Qt::UserRole + 1,
+    Field_Name,
+    Field_OsTypeID,
+    Field_Known
+};
+
+
+/** QStyledItemDelegate extension
+  * reflecting items of Extra Data Manager window: Chooser pane. */
+class UIChooserPaneDelegate : public QStyledItemDelegate
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor. */
+    UIChooserPaneDelegate(QObject *pParent);
+
+private:
+
+    /** Size-hint calculation routine. */
+    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+
+    /** Paint routine. */
+    void paint(QPainter *pPainter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+
+    /** Fetch pixmap info for passed QModelIndex. */
+    static void fetchPixmapInfo(const QModelIndex &index, QPixmap &pixmap, QSize &pixmapSize);
+
+    /** Margin. */
+    int m_iMargin;
+    /** Spacing. */
+    int m_iSpacing;
+};
+
+UIChooserPaneDelegate::UIChooserPaneDelegate(QObject *pParent)
+    : QStyledItemDelegate(pParent)
+    , m_iMargin(3)
+    , m_iSpacing(3)
+{
+}
+
+QSize UIChooserPaneDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    /* Font metrics: */
+    const QFontMetrics &fm = option.fontMetrics;
+    /* Pixmap: */
+    QPixmap pixmap;
+    QSize pixmapSize;
+    fetchPixmapInfo(index, pixmap, pixmapSize);
+
+    /* Calculate width: */
+    const int iWidth = m_iMargin +
+                       pixmapSize.width() +
+                       2 * m_iSpacing +
+                       qMax(fm.width(index.data(Field_Name).toString()),
+                            fm.width(index.data(Field_ID).toString())) +
+                       m_iMargin;
+    /* Calculate height: */
+    const int iHeight = m_iMargin +
+                        qMax(pixmapSize.height(),
+                             fm.height() + m_iSpacing + fm.height()) +
+                        m_iMargin;
+
+    /* Return result: */
+    return QSize(iWidth, iHeight);
+}
+
+void UIChooserPaneDelegate::paint(QPainter *pPainter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+    /* Item rect: */
+    const QRect &optionRect = option.rect;
+    /* Palette: */
+    const QPalette &palette = option.palette;
+    /* Font metrics: */
+    const QFontMetrics &fm = option.fontMetrics;
+    /* Pixmap: */
+    QPixmap pixmap;
+    QSize pixmapSize;
+    fetchPixmapInfo(index, pixmap, pixmapSize);
+
+    /* If item selected: */
+    if (option.state & QStyle::State_Selected)
+    {
+        /* Fill background with selection color: */
+        QColor highlight = palette.color(option.state & QStyle::State_Active ?
+                                         QPalette::Active : QPalette::Inactive,
+                                         QPalette::Highlight);
+        QLinearGradient bgGrad(optionRect.topLeft(), optionRect.bottomLeft());
+        bgGrad.setColorAt(0, highlight.lighter(120));
+        bgGrad.setColorAt(1, highlight);
+        pPainter->fillRect(optionRect, bgGrad);
+        /* Draw focus frame: */
+        QStyleOptionFocusRect focusOption;
+        focusOption.rect = optionRect;
+        QApplication::style()->drawPrimitive(QStyle::PE_FrameFocusRect, &focusOption, pPainter);
+    }
+
+    /* Draw pixmap: */
+    const QPoint pixmapOrigin = optionRect.topLeft() +
+                                QPoint(m_iMargin, m_iMargin);
+    pPainter->drawPixmap(pixmapOrigin, pixmap);
+
+    /* Is that known item? */
+    bool fKnown = index.data(Field_Known).toBool();
+    if (fKnown)
+    {
+        pPainter->save();
+        QFont font = pPainter->font();
+        font.setBold(true);
+        pPainter->setFont(font);
+    }
+
+    /* Draw item name: */
+    const QPoint nameOrigin = pixmapOrigin +
+                              QPoint(pixmapSize.width(), 0) +
+                              QPoint(2 * m_iSpacing, 0) +
+                              QPoint(0, fm.ascent());
+    pPainter->drawText(nameOrigin, index.data(Field_Name).toString());
+
+    /* Was that known item? */
+    if (fKnown)
+        pPainter->restore();
+
+    /* Draw item ID: */
+    const QPoint idOrigin = nameOrigin +
+                            QPoint(0, m_iSpacing) +
+                            QPoint(0, fm.height());
+    pPainter->drawText(idOrigin, index.data(Field_ID).toString());
+}
+
+/* static */
+void UIChooserPaneDelegate::fetchPixmapInfo(const QModelIndex &index, QPixmap &pixmap, QSize &pixmapSize)
+{
+    /* If proper machine ID passed => return corresponding pixmap/size: */
+    if (index.data(Field_ID).toString() != UIExtraDataManager::GlobalID)
+        pixmap = vboxGlobal().vmGuestOSTypeIcon(index.data(Field_OsTypeID).toString(), &pixmapSize);
+    else
+    {
+        /* For global ID we return static pixmap/size: */
+        const QIcon icon = UIIconPool::iconSet(":/edataglobal_32px.png");
+        pixmapSize = icon.availableSizes().first();
+        pixmap = icon.pixmap(pixmapSize);
+    }
+}
+
+
+/** QSortFilterProxyModel extension
+  * used by the chooser-pane of the UIExtraDataManagerWindow. */
+class UIChooserPaneSortingModel : public QSortFilterProxyModel
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pParent to the QIRichToolButton constructor. */
+    UIChooserPaneSortingModel(QObject *pParent) : QSortFilterProxyModel(pParent) {}
+
+protected:
+
+    /** Returns true if the value of the item referred to by the given index left
+      * is less than the value of the item referred to by the given index right,
+      * otherwise returns false. */
+    bool lessThan(const QModelIndex &leftIdx, const QModelIndex &rightIdx) const
+    {
+        /* Compare by ID first: */
+        const QString strID1 = leftIdx.data(Field_ID).toString();
+        const QString strID2 = rightIdx.data(Field_ID).toString();
+        if (strID1 == UIExtraDataManager::GlobalID)
+            return true;
+        else if (strID2 == UIExtraDataManager::GlobalID)
+            return false;
+        /* Compare role finally: */
+        return QSortFilterProxyModel::lessThan(leftIdx, rightIdx);
+    }
+};
+
+
+/** QMainWindow extension
+  * providing Extra Data Manager with UI features. */
+class UIExtraDataManagerWindow : public QMainWindow
+{
+    Q_OBJECT;
+
+public:
+
+    /** @name Constructor/Destructor
+      * @{ */
+        /** Extra-data Manager Window constructor. */
+        UIExtraDataManagerWindow();
+        /** Extra-data Manager Window destructor. */
+        ~UIExtraDataManagerWindow();
+    /** @} */
+
+    /** @name Management
+      * @{ */
+        /** Show and raise. */
+        void showAndRaise(QWidget *pCenterWidget);
+    /** @} */
+
+private slots:
+
+    /** @name General
+      * @{ */
+        /** Handles machine (un)registration. */
+        void sltMachineRegistered(QString strID, bool fAdded);
+        /** Handles extra-data map acknowledging. */
+        void sltExtraDataMapAcknowledging(QString strID);
+        /** Handles extra-data change. */
+        void sltExtraDataChange(QString strID, QString strKey, QString strValue);
+    /** @} */
+
+    /** @name Chooser-pane
+      * @{ */
+        /** Handles filter-apply signal for the chooser-pane. */
+        void sltChooserApplyFilter(const QString &strFilter);
+        /** Handles current-changed signal for the chooser-pane: */
+        void sltChooserHandleCurrentChanged(const QModelIndex &index);
+        /** Handles item-selection-changed signal for the chooser-pane: */
+        void sltChooserHandleSelectionChanged(const QItemSelection &selected,
+                                              const QItemSelection &deselected);
+    /** @} */
+
+    /** @name Data-pane
+      * @{ */
+        /** Handles filter-apply signal for the data-pane. */
+        void sltDataApplyFilter(const QString &strFilter);
+        /** Handles item-selection-changed signal for the data-pane: */
+        void sltDataHandleSelectionChanged(const QItemSelection &selected,
+                                           const QItemSelection &deselected);
+        /** Handles item-changed signal for the data-pane: */
+        void sltDataHandleItemChanged(QStandardItem *pItem);
+        /** Handles context-menu-requested signal for the data-pane: */
+        void sltDataHandleCustomContextMenuRequested(const QPoint &pos);
+    /** @} */
+
+    /** @name Actions
+      * @{ */
+        /** Add handler. */
+        void sltAdd();
+        /** Remove handler. */
+        void sltDel();
+        /** Save handler. */
+        void sltSave();
+        /** Load handler. */
+        void sltLoad();
+    /** @} */
+
+private:
+
+    /** @name Prepare/Cleanup
+      * @{ */
+        /** Prepare instance. */
+        void prepare();
+        /** Prepare this. */
+        void prepareThis();
+        /** Prepare connections. */
+        void prepareConnections();
+        /** Prepare menu. */
+        void prepareMenu();
+        /** Prepare central widget. */
+        void prepareCentralWidget();
+        /** Prepare tool-bar. */
+        void prepareToolBar();
+        /** Prepare splitter. */
+        void prepareSplitter();
+        /** Prepare panes: */
+        void preparePanes();
+        /** Prepare chooser pane. */
+        void preparePaneChooser();
+        /** Prepare data pane. */
+        void preparePaneData();
+        /** Prepare button-box. */
+        void prepareButtonBox();
+        /** Load window settings. */
+        void loadSettings();
+
+        /** Save window settings. */
+        void saveSettings();
+        /** Cleanup instance. */
+        void cleanup();
+    /** @} */
+
+    /** @name Event Processing
+      * @{ */
+        /** Common event-handler. */
+        bool event(QEvent *pEvent);
+    /** @} */
+
+    /** @name Actions
+      * @{ */
+        /** */
+        void updateActionsAvailability();
+    /** @} */
+
+    /** @name Chooser-pane
+      * @{ */
+        /** Returns chooser index for @a iRow. */
+        QModelIndex chooserIndex(int iRow) const;
+        /** Returns current chooser index. */
+        QModelIndex currentChooserIndex() const;
+
+        /** Returns chooser ID for @a iRow. */
+        QString chooserID(int iRow) const;
+        /** Returns current chooser ID. */
+        QString currentChooserID() const;
+
+        /** Returns chooser Name for @a iRow. */
+        QString chooserName(int iRow) const;
+        /** Returns current Name. */
+        QString currentChooserName() const;
+
+        /** Adds chooser item. */
+        void addChooserItem(const QString &strID,
+                            const QString &strName,
+                            const QString &strOsTypeID,
+                            const int iPosition = -1);
+        /** Adds chooser item by machine. */
+        void addChooserItemByMachine(const CMachine &machine,
+                                     const int iPosition = -1);
+        /** Adds chooser item by ID. */
+        void addChooserItemByID(const QString &strID,
+                                const int iPosition = -1);
+
+        /** Make sure chooser have current-index if possible. */
+        void makeSureChooserHaveCurrentIndexIfPossible();
+    /** @} */
+
+    /** @name Data-pane
+      * @{ */
+        /** Returns data index for @a iRow and @a iColumn. */
+        QModelIndex dataIndex(int iRow, int iColumn) const;
+
+        /** Returns data-key index for @a iRow. */
+        QModelIndex dataKeyIndex(int iRow) const;
+
+        /** Returns data-value index for @a iRow. */
+        QModelIndex dataValueIndex(int iRow) const;
+
+        /** Returns current data-key. */
+        QString dataKey(int iRow) const;
+
+        /** Returns current data-value. */
+        QString dataValue(int iRow) const;
+
+        /** Adds data item. */
+        void addDataItem(const QString &strKey,
+                         const QString &strValue,
+                         const int iPosition = -1);
+
+        /** Sorts data items. */
+        void sortData();
+
+        /** Returns the list of known extra-data keys. */
+        static QStringList knownExtraDataKeys();
+    /** @} */
+
+
+    /** @name General
+      * @{ */
+        /** Current geometry. */
+        QRect m_geometry;
+        QVBoxLayout *m_pMainLayout;
+        /** Data pane: Tool-bar. */
+        UIToolBar *m_pToolBar;
+        /** Splitter. */
+        QISplitter *m_pSplitter;
+    /** @} */
+
+    /** @name Chooser-pane
+      * @{ */
+        /** Chooser pane. */
+        QWidget *m_pPaneOfChooser;
+        /** Chooser filter. */
+        QLineEdit *m_pFilterOfChooser;
+        /** Chooser pane: List-view. */
+        QListView *m_pViewOfChooser;
+        /** Chooser pane: Source-model. */
+        QStandardItemModel *m_pModelSourceOfChooser;
+        /** Chooser pane: Proxy-model. */
+        UIChooserPaneSortingModel *m_pModelProxyOfChooser;
+    /** @} */
+
+    /** @name Data-pane
+      * @{ */
+        /** Data pane. */
+        QWidget *m_pPaneOfData;
+        /** Data filter. */
+        QLineEdit *m_pFilterOfData;
+        /** Data pane: Table-view. */
+        QTableView *m_pViewOfData;
+        /** Data pane: Item-model. */
+        QStandardItemModel *m_pModelSourceOfData;
+        /** Data pane: Proxy-model. */
+        QSortFilterProxyModel *m_pModelProxyOfData;
+    /** @} */
+
+    /** @name Button Box
+      * @{ */
+        /** Dialog button-box. */
+        QIDialogButtonBox *m_pButtonBox;
+    /** @} */
+
+    /** @name Actions
+      * @{ */
+        /** Add action. */
+        QAction *m_pActionAdd;
+        /** Del action. */
+        QAction *m_pActionDel;
+        /** Load action. */
+        QAction *m_pActionLoad;
+        /** Save action. */
+        QAction *m_pActionSave;
+    /** @} */
+};
+
+UIExtraDataManagerWindow::UIExtraDataManagerWindow()
+    : m_pMainLayout(0), m_pToolBar(0), m_pSplitter(0)
+    , m_pPaneOfChooser(0), m_pFilterOfChooser(0), m_pViewOfChooser(0)
+    , m_pModelSourceOfChooser(0), m_pModelProxyOfChooser(0)
+    , m_pPaneOfData(0), m_pFilterOfData(0), m_pViewOfData(0),
+      m_pModelSourceOfData(0), m_pModelProxyOfData(0)
+    , m_pButtonBox(0)
+    , m_pActionAdd(0), m_pActionDel(0)
+    , m_pActionLoad(0), m_pActionSave(0)
+{
+    /* Prepare: */
+    prepare();
+}
+
+UIExtraDataManagerWindow::~UIExtraDataManagerWindow()
+{
+    /* Cleanup: */
+    cleanup();
+}
+
+void UIExtraDataManagerWindow::showAndRaise(QWidget*)
+{
+    /* Show: */
+    show();
+    /* Restore from minimized state: */
+    setWindowState(windowState() & ~Qt::WindowMinimized);
+    /* Raise: */
+    activateWindow();
+//    /* Center according passed widget: */
+//    VBoxGlobal::centerWidget(this, pCenterWidget, false);
+}
+
+void UIExtraDataManagerWindow::sltMachineRegistered(QString strID, bool fRegistered)
+{
+    /* Machine registered: */
+    if (fRegistered)
+    {
+        /* Gather list of 'known IDs': */
+        QStringList knownIDs;
+        for (int iRow = 0; iRow < m_pModelSourceOfChooser->rowCount(); ++iRow)
+            knownIDs << chooserID(iRow);
+
+        /* Get machine items: */
+        const CMachineVector machines = vboxGlobal().virtualBox().GetMachines();
+        /* Look for the proper place to insert new machine item: */
+        QString strPositionID = UIExtraDataManager::GlobalID;
+        foreach (const CMachine &machine, machines)
+        {
+            /* Get iterated machine ID: */
+            const QString strIteratedID = machine.GetId();
+            /* If 'iterated ID' equal to 'added ID' => break now: */
+            if (strIteratedID == strID)
+                break;
+            /* If 'iterated ID' is 'known ID' => remember it: */
+            if (knownIDs.contains(strIteratedID))
+                strPositionID = strIteratedID;
+        }
+
+        /* Add new chooser item into source-model: */
+        addChooserItemByID(strID, knownIDs.indexOf(strPositionID) + 1);
+        /* And sort proxy-model: */
+        m_pModelProxyOfChooser->sort(0, Qt::AscendingOrder);
+        /* Make sure chooser have current-index if possible: */
+        makeSureChooserHaveCurrentIndexIfPossible();
+    }
+    /* Machine unregistered: */
+    else
+    {
+        /* Remove chooser item with 'removed ID' if it is among 'known IDs': */
+        for (int iRow = 0; iRow < m_pModelSourceOfChooser->rowCount(); ++iRow)
+            if (chooserID(iRow) == strID)
+                m_pModelSourceOfChooser->removeRow(iRow);
+    }
+}
+
+void UIExtraDataManagerWindow::sltExtraDataMapAcknowledging(QString strID)
+{
+    /* Update item with 'changed ID' if it is among 'known IDs': */
+    for (int iRow = 0; iRow < m_pModelSourceOfChooser->rowCount(); ++iRow)
+        if (chooserID(iRow) == strID)
+            m_pModelSourceOfChooser->itemFromIndex(chooserIndex(iRow))->setData(true, Field_Known);
+}
+
+void UIExtraDataManagerWindow::sltExtraDataChange(QString strID, QString strKey, QString strValue)
+{
+    /* Skip unrelated IDs: */
+    if (currentChooserID() != strID)
+        return;
+
+    /* List of 'known keys': */
+    QStringList knownKeys;
+    for (int iRow = 0; iRow < m_pModelSourceOfData->rowCount(); ++iRow)
+        knownKeys << dataKey(iRow);
+
+    /* Check if 'changed key' is 'known key': */
+    int iPosition = knownKeys.indexOf(strKey);
+    /* If that is 'known key': */
+    if (iPosition != -1)
+    {
+        /* If 'changed value' is empty => REMOVE item: */
+        if (strValue.isEmpty())
+            m_pModelSourceOfData->removeRow(iPosition);
+        /* If 'changed value' is NOT empty => UPDATE item: */
+        else
+            m_pModelSourceOfData->itemFromIndex(dataValueIndex(iPosition))->setText(strValue);
+    }
+    /* Else if 'changed value' is NOT empty: */
+    else if (!strValue.isEmpty())
+    {
+        /* Look for the proper place for 'changed key': */
+        QString strPositionKey;
+        foreach (const QString &strIteratedKey, gEDataManager->map(strID).keys())
+        {
+            /* If 'iterated key' equal to 'changed key' => break now: */
+            if (strIteratedKey == strKey)
+                break;
+            /* If 'iterated key' is 'known key' => remember it: */
+            if (knownKeys.contains(strIteratedKey))
+                strPositionKey = strIteratedKey;
+        }
+        /* Calculate resulting position: */
+        iPosition = knownKeys.indexOf(strPositionKey) + 1;
+        /* INSERT item to the required position: */
+        addDataItem(strKey, strValue, iPosition);
+        /* And sort proxy-model: */
+        sortData();
+    }
+}
+
+void UIExtraDataManagerWindow::sltChooserApplyFilter(const QString &strFilter)
+{
+    /* Apply filtering rule: */
+    m_pModelProxyOfChooser->setFilterWildcard(strFilter);
+    /* Make sure chooser have current-index if possible: */
+    makeSureChooserHaveCurrentIndexIfPossible();
+}
+
+void UIExtraDataManagerWindow::sltChooserHandleCurrentChanged(const QModelIndex &index)
+{
+    /* Remove all the old items first: */
+    while (m_pModelSourceOfData->rowCount())
+        m_pModelSourceOfData->removeRow(0);
+
+    /* Ignore invalid indexes: */
+    if (!index.isValid())
+        return;
+
+    /* Add all the new items finally: */
+    const QString strID = index.data(Field_ID).toString();
+    if (!gEDataManager->contains(strID))
+        gEDataManager->hotloadMachineExtraDataMap(strID);
+    const ExtraDataMap data = gEDataManager->map(strID);
+    foreach (const QString &strKey, data.keys())
+        addDataItem(strKey, data.value(strKey));
+    /* And sort proxy-model: */
+    sortData();
+}
+
+void UIExtraDataManagerWindow::sltChooserHandleSelectionChanged(const QItemSelection&,
+                                                                const QItemSelection&)
+{
+    /* Update actions availability: */
+    updateActionsAvailability();
+}
+
+void UIExtraDataManagerWindow::sltDataApplyFilter(const QString &strFilter)
+{
+    /* Apply filtering rule: */
+    m_pModelProxyOfData->setFilterWildcard(strFilter);
+}
+
+void UIExtraDataManagerWindow::sltDataHandleSelectionChanged(const QItemSelection&,
+                                                             const QItemSelection&)
+{
+    /* Update actions availability: */
+    updateActionsAvailability();
+}
+
+void UIExtraDataManagerWindow::sltDataHandleItemChanged(QStandardItem *pItem)
+{
+    /* Value-data index: */
+    const QModelIndex valueIndex = m_pModelSourceOfData->indexFromItem(pItem);
+    const int iRow = valueIndex.row();
+    const int iColumn = valueIndex.column();
+    AssertMsgReturnVoid(iColumn == 1, ("Only 2nd column can be changed!\n"));
+
+    /* Key-data index: */
+    const QModelIndex keyIndex = dataKeyIndex(iRow);
+
+    /* Update extra-data: */
+    gEDataManager->setExtraDataString(keyIndex.data().toString(),
+                                      valueIndex.data().toString(),
+                                      currentChooserID());
+}
+
+void UIExtraDataManagerWindow::sltDataHandleCustomContextMenuRequested(const QPoint &pos)
+{
+    /* Prepare menu: */
+    QMenu menu;
+    menu.addAction(m_pActionAdd);
+    menu.addAction(m_pActionDel);
+    menu.addSeparator();
+    menu.addAction(m_pActionSave);
+    /* Execute menu: */
+    m_pActionSave->setProperty("CalledFromContextMenu", true);
+    menu.exec(m_pViewOfData->viewport()->mapToGlobal(pos));
+    m_pActionSave->setProperty("CalledFromContextMenu", QVariant());
+}
+
+void UIExtraDataManagerWindow::sltAdd()
+{
+    /* Make sure this slot called by corresponding action only: */
+    QAction *pSenderAction = qobject_cast<QAction*>(sender());
+    AssertReturnVoid(pSenderAction && m_pActionAdd);
+
+    /* Create input-dialog: */
+    QPointer<QIDialog> pInputDialog = new QIDialog(this);
+    AssertPtrReturnVoid(pInputDialog.data());
+    {
+        /* Configure input-dialog: */
+        pInputDialog->setWindowTitle("Add extra-data record..");
+        pInputDialog->setMinimumWidth(400);
+        /* Create main-layout: */
+        QVBoxLayout *pMainLayout = new QVBoxLayout(pInputDialog);
+        AssertPtrReturnVoid(pMainLayout);
+        {
+            /* Create dialog validator group: */
+            QObjectValidatorGroup *pValidatorGroup = new QObjectValidatorGroup(pInputDialog);
+            AssertReturnVoid(pValidatorGroup);
+            /* Create input-layout: */
+            QGridLayout *pInputLayout = new QGridLayout;
+            AssertPtrReturnVoid(pInputLayout);
+            {
+                /* Create key-label: */
+                QLabel *pLabelKey = new QLabel("&Name:");
+                {
+                    /* Configure key-label: */
+                    pLabelKey->setAlignment(Qt::AlignRight);
+                    /* Add key-label into input-layout: */
+                    pInputLayout->addWidget(pLabelKey, 0, 0);
+                }
+                /* Create key-editor: */
+                QComboBox *pEditorKey = new QComboBox;
+                {
+                    /* Configure key-editor: */
+                    pEditorKey->setEditable(true);
+                    pEditorKey->addItems(knownExtraDataKeys());
+                    pLabelKey->setBuddy(pEditorKey);
+                    /* Create key-editor property setter: */
+                    QObjectPropertySetter *pKeyPropertySetter = new QObjectPropertySetter(pInputDialog, "Key");
+                    AssertPtrReturnVoid(pKeyPropertySetter);
+                    {
+                        /* Configure key-editor property setter: */
+                        connect(pEditorKey, SIGNAL(editTextChanged(const QString&)),
+                                pKeyPropertySetter, SLOT(sltAssignProperty(const QString&)));
+                    }
+                    /* Create key-editor validator: */
+                    QObjectValidator *pKeyValidator = new QObjectValidator(new QRegExpValidator(QRegExp("[\\s\\S]+"), this));
+                    AssertPtrReturnVoid(pKeyValidator);
+                    {
+                        /* Configure key-editor validator: */
+                        connect(pEditorKey, SIGNAL(editTextChanged(const QString&)),
+                                pKeyValidator, SLOT(sltValidate(QString)));
+                        /* Add key-editor validator into dialog validator group: */
+                        pValidatorGroup->addObjectValidator(pKeyValidator);
+                    }
+                    /* Add key-editor into input-layout: */
+                    pInputLayout->addWidget(pEditorKey, 0, 1);
+                }
+                /* Create value-label: */
+                QLabel *pLabelValue = new QLabel("&Value:");
+                {
+                    /* Configure value-label: */
+                    pLabelValue->setAlignment(Qt::AlignRight);
+                    /* Add value-label into input-layout: */
+                    pInputLayout->addWidget(pLabelValue, 1, 0);
+                }
+                /* Create value-editor: */
+                QLineEdit *pEditorValue = new QLineEdit;
+                {
+                    /* Configure value-editor: */
+                    pLabelValue->setBuddy(pEditorValue);
+                    /* Create value-editor property setter: */
+                    QObjectPropertySetter *pValuePropertySetter = new QObjectPropertySetter(pInputDialog, "Value");
+                    AssertPtrReturnVoid(pValuePropertySetter);
+                    {
+                        /* Configure value-editor property setter: */
+                        connect(pEditorValue, SIGNAL(textEdited(const QString&)),
+                                pValuePropertySetter, SLOT(sltAssignProperty(const QString&)));
+                    }
+                    /* Create value-editor validator: */
+                    QObjectValidator *pValueValidator = new QObjectValidator(new QRegExpValidator(QRegExp("[\\s\\S]+"), this));
+                    AssertPtrReturnVoid(pValueValidator);
+                    {
+                        /* Configure value-editor validator: */
+                        connect(pEditorValue, SIGNAL(textEdited(const QString&)),
+                                pValueValidator, SLOT(sltValidate(QString)));
+                        /* Add value-editor validator into dialog validator group: */
+                        pValidatorGroup->addObjectValidator(pValueValidator);
+                    }
+                    /* Add value-editor into input-layout: */
+                    pInputLayout->addWidget(pEditorValue, 1, 1);
+                }
+                /* Add input-layout into main-layout: */
+                pMainLayout->addLayout(pInputLayout);
+            }
+            /* Create stretch: */
+            pMainLayout->addStretch();
+            /* Create dialog button-box: */
+            QIDialogButtonBox *pButtonBox = new QIDialogButtonBox;
+            AssertPtrReturnVoid(pButtonBox);
+            {
+                /* Configure button-box: */
+                pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+                pButtonBox->button(QDialogButtonBox::Ok)->setAutoDefault(true);
+                pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(pValidatorGroup->result());
+                pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape);
+                connect(pValidatorGroup, SIGNAL(sigValidityChange(bool)),
+                        pButtonBox->button(QDialogButtonBox::Ok), SLOT(setEnabled(bool)));
+                connect(pButtonBox, SIGNAL(accepted()), pInputDialog, SLOT(accept()));
+                connect(pButtonBox, SIGNAL(rejected()), pInputDialog, SLOT(reject()));
+                /* Add button-box into main-layout: */
+                pMainLayout->addWidget(pButtonBox);
+            }
+        }
+    }
+
+    /* Execute input-dialog: */
+    if (pInputDialog->exec() == QDialog::Accepted)
+    {
+        gEDataManager->setExtraDataString(pInputDialog->property("Key").toString(),
+                                          pInputDialog->property("Value").toString(),
+                                          currentChooserID());
+    }
+
+    /* Destroy input-dialog: */
+    if (pInputDialog)
+        delete pInputDialog;
+}
+
+void UIExtraDataManagerWindow::sltDel()
+{
+    /* Make sure this slot called by corresponding action only: */
+    QAction *pSenderAction = qobject_cast<QAction*>(sender());
+    AssertReturnVoid(pSenderAction && m_pActionDel);
+
+    /* Gather the map of chosen items: */
+    QMap<QString, QString> items;
+    foreach (const QModelIndex &keyIndex, m_pViewOfData->selectionModel()->selectedRows(0))
+        items.insert(keyIndex.data().toString(), dataValueIndex(keyIndex.row()).data().toString());
+
+    /* Prepare details: */
+    const QString strTableTemplate("<!--EOM--><table border=0 cellspacing=10 cellpadding=0 width=500>%1</table>");
+    const QString strRowTemplate("<tr><td><tt>%1</tt></td><td align=right><tt>%2</tt></td></tr>");
+    QString strDetails;
+    foreach (const QString &strKey, items.keys())
+        strDetails += strRowTemplate.arg(strKey, items.value(strKey));
+    strDetails = strTableTemplate.arg(strDetails);
+
+    /* Ask for user' confirmation: */
+    if (!msgCenter().errorWithQuestion(this, MessageType_Question,
+                                       QString("<p>Do you really wish to "
+                                               "remove chosen records?</p>"),
+                                       strDetails))
+        return;
+
+    /* Erase all the chosen extra-data records: */
+    foreach (const QString &strKey, items.keys())
+        gEDataManager->setExtraDataString(strKey, QString(), currentChooserID());
+}
+
+void UIExtraDataManagerWindow::sltSave()
+{
+    /* Make sure this slot called by corresponding action only: */
+    QAction *pSenderAction = qobject_cast<QAction*>(sender());
+    AssertReturnVoid(pSenderAction && m_pActionSave);
+
+    /* Compose initial file-name: */
+    const QString strInitialFileName = QDir(vboxGlobal().homeFolder()).absoluteFilePath(QString("%1_ExtraData.xml").arg(currentChooserName()));
+    /* Open file-save dialog to choose file to save extra-data into: */
+    const QString strFileName = QIFileDialog::getSaveFileName(strInitialFileName, "XML files (*.xml)", this,
+                                                              "Choose file to save extra-data into..", 0, true, true);
+    /* Make sure file-name was chosen: */
+    if (strFileName.isEmpty())
+        return;
+
+    /* Create file: */
+    QFile output(strFileName);
+    /* Open file for writing: */
+    bool fOpened = output.open(QIODevice::WriteOnly);
+    AssertReturnVoid(fOpened);
+    {
+        /* Create XML stream writer: */
+        QXmlStreamWriter stream(&output);
+        /* Configure XML stream writer: */
+        stream.setAutoFormatting(true);
+        stream.setAutoFormattingIndent(2);
+        /* Write document: */
+        stream.writeStartDocument();
+        {
+            stream.writeStartElement("VirtualBox");
+            {
+                const QString strID = currentChooserID();
+                bool fIsMachine = strID != UIExtraDataManager::GlobalID;
+                const QString strType = fIsMachine ? "Machine" : "Global";
+                stream.writeStartElement(strType);
+                {
+                    if (fIsMachine)
+                        stream.writeAttribute("uuid", QString("{%1}").arg(strID));
+                    stream.writeStartElement("ExtraData");
+                    {
+                        /* Called from context-menu: */
+                        if (pSenderAction->property("CalledFromContextMenu").toBool() &&
+                            !m_pViewOfData->selectionModel()->selection().isEmpty())
+                        {
+                            foreach (const QModelIndex &keyIndex, m_pViewOfData->selectionModel()->selectedRows())
+                            {
+                                /* Get data-value index: */
+                                const QModelIndex valueIndex = dataValueIndex(keyIndex.row());
+                                /* Write corresponding extra-data item into stream: */
+                                stream.writeStartElement("ExtraDataItem");
+                                {
+                                    stream.writeAttribute("name", keyIndex.data().toString());
+                                    stream.writeAttribute("value", valueIndex.data().toString());
+                                }
+                                stream.writeEndElement(); /* ExtraDataItem */
+                            }
+                        }
+                        /* Called from menu-bar/tool-bar: */
+                        else
+                        {
+                            for (int iRow = 0; iRow < m_pModelProxyOfData->rowCount(); ++iRow)
+                            {
+                                /* Get indexes: */
+                                const QModelIndex keyIndex = m_pModelProxyOfData->index(iRow, 0);
+                                const QModelIndex valueIndex = m_pModelProxyOfData->index(iRow, 1);
+                                /* Write corresponding extra-data item into stream: */
+                                stream.writeStartElement("ExtraDataItem");
+                                {
+                                    stream.writeAttribute("name", keyIndex.data().toString());
+                                    stream.writeAttribute("value", valueIndex.data().toString());
+                                }
+                                stream.writeEndElement(); /* ExtraDataItem */
+                            }
+                        }
+                    }
+                    stream.writeEndElement(); /* ExtraData */
+                }
+                stream.writeEndElement(); /* strType */
+            }
+            stream.writeEndElement(); /* VirtualBox */
+        }
+        stream.writeEndDocument();
+        /* Close file: */
+        output.close();
+    }
+}
+
+void UIExtraDataManagerWindow::sltLoad()
+{
+    /* Make sure this slot called by corresponding action only: */
+    QAction *pSenderAction = qobject_cast<QAction*>(sender());
+    AssertReturnVoid(pSenderAction && m_pActionLoad);
+
+    /* Compose initial file-name: */
+    const QString strInitialFileName = QDir(vboxGlobal().homeFolder()).absoluteFilePath(QString("%1_ExtraData.xml").arg(currentChooserName()));
+    /* Open file-open dialog to choose file to open extra-data into: */
+    const QString strFileName = QIFileDialog::getOpenFileName(strInitialFileName, "XML files (*.xml)", this,
+                                                              "Choose file to load extra-data from..");
+    /* Make sure file-name was chosen: */
+    if (strFileName.isEmpty())
+        return;
+
+    /* Create file: */
+    QFile input(strFileName);
+    /* Open file for writing: */
+    bool fOpened = input.open(QIODevice::ReadOnly);
+    AssertReturnVoid(fOpened);
+    {
+        /* Create XML stream reader: */
+        QXmlStreamReader stream(&input);
+        /* Read XML stream: */
+        while (!stream.atEnd())
+        {
+            /* Read subsequent token: */
+            const QXmlStreamReader::TokenType tokenType = stream.readNext();
+            /* Skip non-interesting tokens: */
+            if (tokenType != QXmlStreamReader::StartElement)
+                continue;
+
+            /* Get the name of the current element: */
+            const QStringRef strElementName = stream.name();
+
+            /* Search for the scope ID: */
+            QString strLoadingID;
+            if (strElementName == "Global")
+                strLoadingID = UIExtraDataManager::GlobalID;
+            else if (strElementName == "Machine")
+            {
+                const QXmlStreamAttributes attributes = stream.attributes();
+                if (attributes.hasAttribute("uuid"))
+                {
+                    const QString strUuid = attributes.value("uuid").toString();
+                    const QUuid uuid = strUuid;
+                    if (!uuid.isNull())
+                        strLoadingID = uuid.toString().remove(QRegExp("[{}]"));
+                    else
+                        msgCenter().alert(this, MessageType_Warning,
+                                          QString("<p>Invalid extra-data ID:</p>"
+                                                  "<p>%1</p>").arg(strUuid));
+                }
+            }
+            /* Look particular extra-data entries: */
+            else if (strElementName == "ExtraDataItem")
+            {
+                const QXmlStreamAttributes attributes = stream.attributes();
+                if (attributes.hasAttribute("name") && attributes.hasAttribute("value"))
+                {
+                    const QString strName = attributes.value("name").toString();
+                    const QString strValue = attributes.value("value").toString();
+                    gEDataManager->setExtraDataString(strName, strValue, currentChooserID());
+                }
+            }
+
+            /* Check extra-data ID: */
+            if (!strLoadingID.isNull() && strLoadingID != currentChooserID() &&
+                !msgCenter().questionBinary(this, MessageType_Question,
+                                            QString("<p>Inconsistent extra-data ID:</p>"
+                                                    "<p>Current: {%1}</p>"
+                                                    "<p>Loading: {%2}</p>"
+                                                    "<p>Continue with loading?</p>")
+                                                    .arg(currentChooserID(), strLoadingID)))
+                break;
+        }
+        /* Handle XML stream error: */
+        if (stream.hasError())
+            msgCenter().alert(this, MessageType_Warning,
+                              QString("<p>Error reading XML file:</p>"
+                                      "<p>%1</p>").arg(stream.error()));
+        /* Close file: */
+        input.close();
+    }
+}
+
+void UIExtraDataManagerWindow::prepare()
+{
+    /* Prepare this: */
+    prepareThis();
+    /* Prepare connections: */
+    prepareConnections();
+    /* Prepare menu: */
+    prepareMenu();
+    /* Prepare central-widget: */
+    prepareCentralWidget();
+    /* Load settings: */
+    loadSettings();
+}
+
+void UIExtraDataManagerWindow::prepareThis()
+{
+#ifndef Q_WS_MAC
+    /* Apply window icons: */
+    setWindowIcon(UIIconPool::iconSetFull(":/edataman_32px.png",
+                                          ":/edataman_16px.png"));
+#endif /* !Q_WS_MAC */
+
+    /* Apply window title: */
+    setWindowTitle("Extra-data Manager");
+
+    /* Do not count that window as important for application,
+     * it will NOT be taken into account when other top-level windows will be closed: */
+    setAttribute(Qt::WA_QuitOnClose, false);
+
+    /* Delete window when closed: */
+    setAttribute(Qt::WA_DeleteOnClose);
+}
+
+void UIExtraDataManagerWindow::prepareConnections()
+{
+    /* Prepare connections: */
+    connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)),
+            this, SLOT(sltMachineRegistered(QString, bool)));
+}
+
+void UIExtraDataManagerWindow::prepareMenu()
+{
+    /* Create 'Actions' menu: */
+    QMenu *pActionsMenu = menuBar()->addMenu("Actions");
+    AssertReturnVoid(pActionsMenu);
+    {
+        /* Create 'Add' action: */
+        m_pActionAdd = pActionsMenu->addAction("Add");
+        AssertReturnVoid(m_pActionAdd);
+        {
+            /* Configure 'Add' action: */
+            m_pActionAdd->setIcon(UIIconPool::iconSetFull(":/edata_add_22px.png", ":/edata_add_16px.png",
+                                                          ":/edata_add_disabled_22px.png", ":/edata_add_disabled_16px.png"));
+            m_pActionAdd->setShortcut(QKeySequence("Ctrl+T"));
+            connect(m_pActionAdd, SIGNAL(triggered(bool)), this, SLOT(sltAdd()));
+        }
+        /* Create 'Del' action: */
+        m_pActionDel = pActionsMenu->addAction("Remove");
+        AssertReturnVoid(m_pActionDel);
+        {
+            /* Configure 'Del' action: */
+            m_pActionDel->setIcon(UIIconPool::iconSetFull(":/edata_remove_22px.png", ":/edata_remove_16px.png",
+                                                          ":/edata_remove_disabled_22px.png", ":/edata_remove_disabled_16px.png"));
+            m_pActionDel->setShortcut(QKeySequence("Ctrl+R"));
+            connect(m_pActionDel, SIGNAL(triggered(bool)), this, SLOT(sltDel()));
+        }
+
+        /* Add separator: */
+        pActionsMenu->addSeparator();
+
+        /* Create 'Load' action: */
+        m_pActionLoad = pActionsMenu->addAction("Load");
+        AssertReturnVoid(m_pActionLoad);
+        {
+            /* Configure 'Load' action: */
+            m_pActionLoad->setIcon(UIIconPool::iconSetFull(":/edata_load_22px.png", ":/edata_load_16px.png",
+                                                           ":/edata_load_disabled_22px.png", ":/edata_load_disabled_16px.png"));
+            m_pActionLoad->setShortcut(QKeySequence("Ctrl+L"));
+            connect(m_pActionLoad, SIGNAL(triggered(bool)), this, SLOT(sltLoad()));
+        }
+        /* Create 'Save' action: */
+        m_pActionSave = pActionsMenu->addAction("Save As...");
+        AssertReturnVoid(m_pActionSave);
+        {
+            /* Configure 'Save' action: */
+            m_pActionSave->setIcon(UIIconPool::iconSetFull(":/edata_save_22px.png", ":/edata_save_16px.png",
+                                                           ":/edata_save_disabled_22px.png", ":/edata_save_disabled_16px.png"));
+            m_pActionSave->setShortcut(QKeySequence("Ctrl+S"));
+            connect(m_pActionSave, SIGNAL(triggered(bool)), this, SLOT(sltSave()));
+        }
+    }
+}
+
+void UIExtraDataManagerWindow::prepareCentralWidget()
+{
+    /* Prepare central-widget: */
+    setCentralWidget(new QWidget);
+    AssertPtrReturnVoid(centralWidget());
+    {
+        /* Prepare layout: */
+        m_pMainLayout = new QVBoxLayout(centralWidget());
+        AssertReturnVoid(m_pMainLayout && centralWidget()->layout() &&
+                         m_pMainLayout == centralWidget()->layout());
+        {
+#if MAC_LEOPARD_STYLE
+            /* No spacing/margins on the Mac: */
+            m_pMainLayout->setContentsMargins(0, 0, 0, 0);
+            m_pMainLayout->insertSpacing(0, 10);
+#else /* !MAC_LEOPARD_STYLE */
+            /* Set spacing/margin like in the selector window: */
+            m_pMainLayout->setSpacing(5);
+            m_pMainLayout->setContentsMargins(5, 5, 5, 5);
+#endif /* !MAC_LEOPARD_STYLE */
+            /* Prepare tool-bar: */
+            prepareToolBar();
+            /* Prepare splitter: */
+            prepareSplitter();
+            /* Prepare button-box: */
+            prepareButtonBox();
+        }
+        /* Initial focus: */
+        if (m_pViewOfChooser)
+            m_pViewOfChooser->setFocus();
+    }
+}
+
+void UIExtraDataManagerWindow::prepareToolBar()
+{
+    /* Create tool-bar: */
+    m_pToolBar = new UIToolBar(this);
+    AssertPtrReturnVoid(m_pToolBar);
+    {
+        /* Configure tool-bar: */
+        m_pToolBar->setIconSize(QSize(22, 22));
+        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+        /* Add actions: */
+        m_pToolBar->addAction(m_pActionAdd);
+        m_pToolBar->addAction(m_pActionDel);
+        m_pToolBar->addSeparator();
+        m_pToolBar->addAction(m_pActionLoad);
+        m_pToolBar->addAction(m_pActionSave);
+        /* Integrate tool-bar into dialog: */
+#if MAC_LEOPARD_STYLE
+        /* Enable unified tool-bars on Mac OS X. Available on Qt >= 4.3: */
+        addToolBar(m_pToolBar);
+        m_pToolBar->enableMacToolbar();
+#else /* !MAC_LEOPARD_STYLE */
+        /* Add tool-bar into main-layout: */
+        m_pMainLayout->addWidget(m_pToolBar);
+#endif /* !MAC_LEOPARD_STYLE */
+    }
+}
+
+void UIExtraDataManagerWindow::prepareSplitter()
+{
+    /* Create splitter: */
+    m_pSplitter = new QISplitter;
+    AssertPtrReturnVoid(m_pSplitter);
+    {
+        /* Prepare panes: */
+        preparePanes();
+        /* Configure splitter: */
+        m_pSplitter->setChildrenCollapsible(false);
+        m_pSplitter->setStretchFactor(0, 0);
+        m_pSplitter->setStretchFactor(1, 1);
+        /* Add splitter into main layout: */
+        m_pMainLayout->addWidget(m_pSplitter);
+    }
+}
+
+void UIExtraDataManagerWindow::preparePanes()
+{
+    /* Prepare chooser-pane: */
+    preparePaneChooser();
+    /* Prepare data-pane: */
+    preparePaneData();
+    /* Link chooser and data panes: */
+    connect(m_pViewOfChooser->selectionModel(),
+            SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
+            this, SLOT(sltChooserHandleCurrentChanged(const QModelIndex&)));
+    connect(m_pViewOfChooser->selectionModel(),
+            SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
+            this, SLOT(sltChooserHandleSelectionChanged(const QItemSelection&, const QItemSelection&)));
+    connect(m_pViewOfData->selectionModel(),
+            SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
+            this, SLOT(sltDataHandleSelectionChanged(const QItemSelection&, const QItemSelection&)));
+    connect(m_pModelSourceOfData, SIGNAL(itemChanged(QStandardItem*)),
+            this, SLOT(sltDataHandleItemChanged(QStandardItem*)));
+    /* Make sure chooser have current-index if possible: */
+    makeSureChooserHaveCurrentIndexIfPossible();
+}
+
+void UIExtraDataManagerWindow::preparePaneChooser()
+{
+    /* Create chooser-pane: */
+    m_pPaneOfChooser = new QWidget;
+    AssertPtrReturnVoid(m_pPaneOfChooser);
+    {
+        /* Create layout: */
+        QVBoxLayout *pLayout = new QVBoxLayout(m_pPaneOfChooser);
+        AssertReturnVoid(pLayout && m_pPaneOfChooser->layout() &&
+                         pLayout == m_pPaneOfChooser->layout());
+        {
+            /* Configure layout: */
+            pLayout->setContentsMargins(0, 0, 3, 0);
+            /* Create chooser-filter: */
+            m_pFilterOfChooser = new QLineEdit;
+            {
+                /* Configure chooser-filter: */
+#if QT_VERSION >= 0x040700
+                m_pFilterOfChooser->setPlaceholderText("Search..");
+#endif /* QT_VERSION >= 0x040700 */
+                connect(m_pFilterOfChooser, SIGNAL(textChanged(const QString&)),
+                        this, SLOT(sltChooserApplyFilter(const QString&)));
+                /* Add chooser-filter into layout: */
+                pLayout->addWidget(m_pFilterOfChooser);
+            }
+            /* Create chooser-view: */
+            m_pViewOfChooser = new QListView;
+            AssertPtrReturnVoid(m_pViewOfChooser);
+            {
+                /* Configure chooser-view: */
+                delete m_pViewOfChooser->itemDelegate();
+                m_pViewOfChooser->setItemDelegate(new UIChooserPaneDelegate(m_pViewOfChooser));
+                m_pViewOfChooser->setSelectionMode(QAbstractItemView::SingleSelection);
+                /* Create source-model: */
+                m_pModelSourceOfChooser = new QStandardItemModel(m_pViewOfChooser);
+                AssertPtrReturnVoid(m_pModelSourceOfChooser);
+                {
+                    /* Create proxy-model: */
+                    m_pModelProxyOfChooser = new UIChooserPaneSortingModel(m_pViewOfChooser);
+                    AssertPtrReturnVoid(m_pModelProxyOfChooser);
+                    {
+                        /* Configure proxy-model: */
+                        m_pModelProxyOfChooser->setSortRole(Field_Name);
+                        m_pModelProxyOfChooser->setFilterRole(Field_Name);
+                        m_pModelProxyOfChooser->setSortCaseSensitivity(Qt::CaseInsensitive);
+                        m_pModelProxyOfChooser->setFilterCaseSensitivity(Qt::CaseInsensitive);
+                        m_pModelProxyOfChooser->setSourceModel(m_pModelSourceOfChooser);
+                        m_pViewOfChooser->setModel(m_pModelProxyOfChooser);
+                    }
+                    /* Add global chooser item into source-model: */
+                    addChooserItemByID(UIExtraDataManager::GlobalID);
+                    /* Add machine chooser items into source-model: */
+                    CMachineVector machines = vboxGlobal().virtualBox().GetMachines();
+                    foreach (const CMachine &machine, machines)
+                        addChooserItemByMachine(machine);
+                    /* And sort proxy-model: */
+                    m_pModelProxyOfChooser->sort(0, Qt::AscendingOrder);
+                }
+                /* Add chooser-view into layout: */
+                pLayout->addWidget(m_pViewOfChooser);
+            }
+        }
+        /* Add chooser-pane into splitter: */
+        m_pSplitter->addWidget(m_pPaneOfChooser);
+    }
+}
+
+void UIExtraDataManagerWindow::preparePaneData()
+{
+    /* Create data-pane: */
+    m_pPaneOfData = new QWidget;
+    AssertPtrReturnVoid(m_pPaneOfData);
+    {
+        /* Create layout: */
+        QVBoxLayout *pLayout = new QVBoxLayout(m_pPaneOfData);
+        AssertReturnVoid(pLayout && m_pPaneOfData->layout() &&
+                         pLayout == m_pPaneOfData->layout());
+        {
+            /* Configure layout: */
+            pLayout->setContentsMargins(3, 0, 0, 0);
+            /* Create data-filter: */
+            m_pFilterOfData = new QLineEdit;
+            {
+                /* Configure data-filter: */
+#if QT_VERSION >= 0x040700
+                m_pFilterOfData->setPlaceholderText("Search..");
+#endif /* QT_VERSION >= 0x040700 */
+                connect(m_pFilterOfData, SIGNAL(textChanged(const QString&)),
+                        this, SLOT(sltDataApplyFilter(const QString&)));
+                /* Add data-filter into layout: */
+                pLayout->addWidget(m_pFilterOfData);
+            }
+            /* Create data-view: */
+            m_pViewOfData = new QTableView;
+            AssertPtrReturnVoid(m_pViewOfData);
+            {
+                /* Create item-model: */
+                m_pModelSourceOfData = new QStandardItemModel(0, 2, m_pViewOfData);
+                AssertPtrReturnVoid(m_pModelSourceOfData);
+                {
+                    /* Create proxy-model: */
+                    m_pModelProxyOfData = new QSortFilterProxyModel(m_pViewOfChooser);
+                    AssertPtrReturnVoid(m_pModelProxyOfData);
+                    {
+                        /* Configure proxy-model: */
+                        m_pModelProxyOfData->setSortCaseSensitivity(Qt::CaseInsensitive);
+                        m_pModelProxyOfData->setFilterCaseSensitivity(Qt::CaseInsensitive);
+                        m_pModelProxyOfData->setSourceModel(m_pModelSourceOfData);
+                        m_pViewOfData->setModel(m_pModelProxyOfData);
+                    }
+                    /* Configure item-model: */
+                    m_pModelSourceOfData->setHorizontalHeaderLabels(QStringList() << "Key" << "Value");
+                }
+                /* Configure data-view: */
+                m_pViewOfData->setSortingEnabled(true);
+                m_pViewOfData->setAlternatingRowColors(true);
+                m_pViewOfData->setContextMenuPolicy(Qt::CustomContextMenu);
+                m_pViewOfData->setSelectionMode(QAbstractItemView::ExtendedSelection);
+                m_pViewOfData->setSelectionBehavior(QAbstractItemView::SelectRows);
+                connect(m_pViewOfData, SIGNAL(customContextMenuRequested(const QPoint&)),
+                        this, SLOT(sltDataHandleCustomContextMenuRequested(const QPoint&)));
+                QHeaderView *pVHeader = m_pViewOfData->verticalHeader();
+                QHeaderView *pHHeader = m_pViewOfData->horizontalHeader();
+                pVHeader->hide();
+                pHHeader->setSortIndicator(0, Qt::AscendingOrder);
+                pHHeader->resizeSection(0, qMin(300, pHHeader->width() / 3));
+                pHHeader->setStretchLastSection(true);
+                /* Add data-view into layout: */
+                pLayout->addWidget(m_pViewOfData);
+            }
+        }
+        /* Add data-pane into splitter: */
+        m_pSplitter->addWidget(m_pPaneOfData);
+    }
+}
+
+void UIExtraDataManagerWindow::prepareButtonBox()
+{
+    /* Create button-box: */
+    m_pButtonBox = new QIDialogButtonBox;
+    AssertPtrReturnVoid(m_pButtonBox);
+    {
+        /* Configure button-box: */
+        m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Close);
+        m_pButtonBox->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape);
+        connect(m_pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog()));
+        connect(m_pButtonBox, SIGNAL(rejected()), this, SLOT(close()));
+        /* Add button-box into main layout: */
+        m_pMainLayout->addWidget(m_pButtonBox);
+    }
+}
+
+void UIExtraDataManagerWindow::loadSettings()
+{
+    /* Load window geometry: */
+    {
+        /* Load geometry: */
+        m_geometry = gEDataManager->extraDataManagerGeometry(this);
+#ifdef Q_WS_MAC
+        move(m_geometry.topLeft());
+        resize(m_geometry.size());
+#else /* Q_WS_MAC */
+        setGeometry(m_geometry);
+#endif /* !Q_WS_MAC */
+        LogRel(("UIExtraDataManagerWindow: Geometry loaded to: %dx%d @ %dx%d.\n",
+                m_geometry.x(), m_geometry.y(), m_geometry.width(), m_geometry.height()));
+
+        /* Maximize (if necessary): */
+        if (gEDataManager->extraDataManagerShouldBeMaximized())
+            showMaximized();
+    }
+
+    /* Load splitter hints: */
+    {
+        m_pSplitter->setSizes(gEDataManager->extraDataManagerSplitterHints(this));
+    }
+}
+
+void UIExtraDataManagerWindow::saveSettings()
+{
+    /* Save splitter hints: */
+    {
+        gEDataManager->setExtraDataManagerSplitterHints(m_pSplitter->sizes());
+    }
+
+    /* Save window geometry: */
+    {
+        /* Save geometry: */
+#ifdef Q_WS_MAC
+        gEDataManager->setExtraDataManagerGeometry(m_geometry, ::darwinIsWindowMaximized(this));
+#else /* Q_WS_MAC */
+        gEDataManager->setExtraDataManagerGeometry(m_geometry, isMaximized());
+#endif /* !Q_WS_MAC */
+        LogRel(("UIExtraDataManagerWindow: Geometry saved as: %dx%d @ %dx%d.\n",
+                m_geometry.x(), m_geometry.y(), m_geometry.width(), m_geometry.height()));
+    }
+}
+
+void UIExtraDataManagerWindow::cleanup()
+{
+    /* Save settings: */
+    saveSettings();
+}
+
+bool UIExtraDataManagerWindow::event(QEvent *pEvent)
+{
+    /* Pre-process through base-class: */
+    bool fResult = QMainWindow::event(pEvent);
+
+    /* Process required events: */
+    switch (pEvent->type())
+    {
+        /* Handle every Resize and Move we keep track of the geometry. */
+        case QEvent::Resize:
+        {
+            if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0)
+            {
+                QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
+                m_geometry.setSize(pResizeEvent->size());
+            }
+            break;
+        }
+        case QEvent::Move:
+        {
+            if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0)
+            {
+#ifdef Q_WS_MAC
+                QMoveEvent *pMoveEvent = static_cast<QMoveEvent*>(pEvent);
+                m_geometry.moveTo(pMoveEvent->pos());
+#else /* !Q_WS_MAC */
+                m_geometry.moveTo(geometry().x(), geometry().y());
+#endif /* !Q_WS_MAC */
+            }
+            break;
+        }
+        default:
+            break;
+    }
+
+    /* Return result: */
+    return fResult;
+}
+
+void UIExtraDataManagerWindow::updateActionsAvailability()
+{
+    /* Is there something selected in chooser-view? */
+    bool fChooserHasSelection = !m_pViewOfChooser->selectionModel()->selection().isEmpty();
+    /* Is there something selected in data-view? */
+    bool fDataHasSelection = !m_pViewOfData->selectionModel()->selection().isEmpty();
+
+    /* Enable/disable corresponding actions: */
+    m_pActionAdd->setEnabled(fChooserHasSelection);
+    m_pActionDel->setEnabled(fChooserHasSelection && fDataHasSelection);
+    m_pActionLoad->setEnabled(fChooserHasSelection);
+    m_pActionSave->setEnabled(fChooserHasSelection);
+}
+
+QModelIndex UIExtraDataManagerWindow::chooserIndex(int iRow) const
+{
+    return m_pModelSourceOfChooser->index(iRow, 0);
+}
+
+QModelIndex UIExtraDataManagerWindow::currentChooserIndex() const
+{
+    return m_pViewOfChooser->currentIndex();
+}
+
+QString UIExtraDataManagerWindow::chooserID(int iRow) const
+{
+    return chooserIndex(iRow).data(Field_ID).toString();
+}
+
+QString UIExtraDataManagerWindow::currentChooserID() const
+{
+    return currentChooserIndex().data(Field_ID).toString();
+}
+
+QString UIExtraDataManagerWindow::chooserName(int iRow) const
+{
+    return chooserIndex(iRow).data(Field_Name).toString();
+}
+
+QString UIExtraDataManagerWindow::currentChooserName() const
+{
+    return currentChooserIndex().data(Field_Name).toString();
+}
+
+void UIExtraDataManagerWindow::addChooserItem(const QString &strID,
+                                              const QString &strName,
+                                              const QString &strOsTypeID,
+                                              const int iPosition /* = -1 */)
+{
+    /* Create item: */
+    QStandardItem *pItem = new QStandardItem;
+    AssertPtrReturnVoid(pItem);
+    {
+        /* Which is NOT editable: */
+        pItem->setEditable(false);
+        /* Contains passed ID: */
+        pItem->setData(strID, Field_ID);
+        /* Contains passed name: */
+        pItem->setData(strName, Field_Name);
+        /* Contains passed OS Type ID: */
+        pItem->setData(strOsTypeID, Field_OsTypeID);
+        /* And designated as known/unknown depending on extra-data manager status: */
+        pItem->setData(gEDataManager->contains(strID), Field_Known);
+        /* If insert position defined: */
+        if (iPosition != -1)
+        {
+            /* Insert this item at specified position: */
+            m_pModelSourceOfChooser->insertRow(iPosition, pItem);
+        }
+        /* If insert position undefined: */
+        else
+        {
+            /* Add this item as the last one: */
+            m_pModelSourceOfChooser->appendRow(pItem);
+        }
+    }
+}
+
+void UIExtraDataManagerWindow::addChooserItemByMachine(const CMachine &machine,
+                                                       const int iPosition /* = -1 */)
+{
+    /* Make sure VM is accessible: */
+    if (!machine.isNull() && machine.GetAccessible())
+        return addChooserItem(machine.GetId(), machine.GetName(), machine.GetOSTypeId(), iPosition);
+}
+
+void UIExtraDataManagerWindow::addChooserItemByID(const QString &strID,
+                                                  const int iPosition /* = -1 */)
+{
+    /* Global ID? */
+    if (strID == UIExtraDataManager::GlobalID)
+        return addChooserItem(strID, QString("Global"), QString(), iPosition);
+
+    /* Search for the corresponding machine by ID: */
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    const CMachine machine = vbox.FindMachine(strID);
+    /* Make sure VM is accessible: */
+    if (vbox.isOk() && !machine.isNull() && machine.GetAccessible())
+        return addChooserItem(strID, machine.GetName(), machine.GetOSTypeId(), iPosition);
+}
+
+void UIExtraDataManagerWindow::makeSureChooserHaveCurrentIndexIfPossible()
+{
+    /* Make sure chooser have current-index if possible: */
+    if (!m_pViewOfChooser->currentIndex().isValid())
+    {
+        /* Do we still have anything to select? */
+        const QModelIndex firstIndex = m_pModelProxyOfChooser->index(0, 0);
+        if (firstIndex.isValid())
+            m_pViewOfChooser->setCurrentIndex(firstIndex);
+    }
+}
+
+QModelIndex UIExtraDataManagerWindow::dataIndex(int iRow, int iColumn) const
+{
+    return m_pModelSourceOfData->index(iRow, iColumn);
+}
+
+QModelIndex UIExtraDataManagerWindow::dataKeyIndex(int iRow) const
+{
+    return dataIndex(iRow, 0);
+}
+
+QModelIndex UIExtraDataManagerWindow::dataValueIndex(int iRow) const
+{
+    return dataIndex(iRow, 1);
+}
+
+QString UIExtraDataManagerWindow::dataKey(int iRow) const
+{
+    return dataKeyIndex(iRow).data().toString();
+}
+
+QString UIExtraDataManagerWindow::dataValue(int iRow) const
+{
+    return dataValueIndex(iRow).data().toString();
+}
+
+void UIExtraDataManagerWindow::addDataItem(const QString &strKey,
+                                           const QString &strValue,
+                                           const int iPosition /* = -1 */)
+{
+    /* Prepare items: */
+    QList<QStandardItem*> items;
+    /* Create key item: */
+    items << new QStandardItem(strKey);
+    items.last()->setEditable(false);
+    AssertPtrReturnVoid(items.last());
+    /* Create value item: */
+    items << new QStandardItem(strValue);
+    AssertPtrReturnVoid(items.last());
+    /* If insert position defined: */
+    if (iPosition != -1)
+    {
+        /* Insert these items as the row at the required position: */
+        m_pModelSourceOfData->insertRow(iPosition, items);
+    }
+    /* If insert position undefined: */
+    else
+    {
+        /* Add these items as the last one row: */
+        m_pModelSourceOfData->appendRow(items);
+    }
+}
+
+void UIExtraDataManagerWindow::sortData()
+{
+    /* Sort using current rules: */
+    const QHeaderView *pHHeader = m_pViewOfData->horizontalHeader();
+    const int iSortSection = pHHeader->sortIndicatorSection();
+    const Qt::SortOrder sortOrder = pHHeader->sortIndicatorOrder();
+    m_pModelProxyOfData->sort(iSortSection, sortOrder);
+}
+
+/* static */
+QStringList UIExtraDataManagerWindow::knownExtraDataKeys()
+{
+    return QStringList()
+           << QString()
+           << GUI_LanguageId
+           << GUI_SuppressMessages << GUI_InvertMessageOption
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+           << GUI_PreventApplicationUpdate << GUI_UpdateDate << GUI_UpdateCheckCount
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+           << GUI_RestrictedGlobalSettingsPages << GUI_RestrictedMachineSettingsPages
+           << GUI_ActivateHoveredMachineWindow
+           << GUI_Input_SelectorShortcuts << GUI_Input_MachineShortcuts
+           << GUI_RecentFolderHD << GUI_RecentFolderCD << GUI_RecentFolderFD
+           << GUI_RecentListHD << GUI_RecentListCD << GUI_RecentListFD
+           << GUI_LastSelectorWindowPosition << GUI_SplitterSizes
+           << GUI_Toolbar << GUI_Statusbar
+           << GUI_GroupDefinitions << GUI_LastItemSelected
+           << GUI_DetailsPageBoxes << GUI_PreviewUpdate
+           << GUI_HideDescriptionForWizards
+           << GUI_HideFromManager << GUI_HideDetails
+           << GUI_PreventReconfiguration << GUI_PreventSnapshotOperations
+           << GUI_FirstRun
+#ifndef Q_WS_MAC
+           << GUI_MachineWindowIcons << GUI_MachineWindowNamePostfix
+#endif /* !Q_WS_MAC */
+           << GUI_LastNormalWindowPosition << GUI_LastScaleWindowPosition
+           << GUI_RestrictedRuntimeMenus
+           << GUI_RestrictedRuntimeApplicationMenuActions
+           << GUI_RestrictedRuntimeMachineMenuActions
+           << GUI_RestrictedRuntimeViewMenuActions
+           << GUI_RestrictedRuntimeInputMenuActions
+           << GUI_RestrictedRuntimeDevicesMenuActions
+#ifdef VBOX_WITH_DEBUGGER_GUI
+           << GUI_RestrictedRuntimeDebuggerMenuActions
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+           << GUI_RestrictedRuntimeWindowMenuActions
+#endif /* Q_WS_MAC */
+           << GUI_RestrictedRuntimeHelpMenuActions
+           << GUI_RestrictedVisualStates
+           << GUI_Fullscreen << GUI_Seamless << GUI_Scale
+#ifdef Q_WS_X11
+           << GUI_Fullscreen_LegacyMode
+#endif /* Q_WS_X11 */
+           << GUI_AutoresizeGuest << GUI_LastGuestSizeHint << GUI_LastGuestSizeHintWasFullscreen
+           << GUI_VirtualScreenToHostScreen << GUI_AutomountGuestScreens
+#ifdef VBOX_WITH_VIDEOHWACCEL
+           << GUI_Accelerate2D_StretchLinear
+           << GUI_Accelerate2D_PixformatYV12 << GUI_Accelerate2D_PixformatUYVY
+           << GUI_Accelerate2D_PixformatYUY2 << GUI_Accelerate2D_PixformatAYUV
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+           << GUI_HiDPI_UnscaledOutput
+           << GUI_HiDPI_Optimization
+#ifndef Q_WS_MAC
+           << GUI_ShowMiniToolBar << GUI_MiniToolBarAutoHide << GUI_MiniToolBarAlignment
+#endif /* !Q_WS_MAC */
+           << GUI_StatusBar_Enabled << GUI_RestrictedStatusBarIndicators << GUI_StatusBar_IndicatorOrder
+#ifdef Q_WS_MAC
+           << GUI_RealtimeDockIconUpdateEnabled << GUI_RealtimeDockIconUpdateMonitor
+#endif /* Q_WS_MAC */
+           << GUI_PassCAD
+           << GUI_MouseCapturePolicy
+           << GUI_GuruMeditationHandler
+           << GUI_HidLedsSync
+           << GUI_ScaleFactor << GUI_Scaling_Optimization
+           << GUI_InformationWindowGeometry
+           << GUI_DefaultCloseAction << GUI_RestrictedCloseActions
+           << GUI_LastCloseAction << GUI_CloseActionHook
+#ifdef VBOX_WITH_DEBUGGER_GUI
+           << GUI_Dbg_Enabled << GUI_Dbg_AutoShow
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+           << GUI_ExtraDataManager_Geometry << GUI_ExtraDataManager_SplitterHints;
+}
+#endif /* DEBUG */
+
+
+/* static */
+UIExtraDataManager *UIExtraDataManager::m_spInstance = 0;
+const QString UIExtraDataManager::GlobalID = QUuid().toString().remove(QRegExp("[{}]"));
+
+/* static */
+UIExtraDataManager* UIExtraDataManager::instance()
+{
+    /* Create/prepare instance if not yet exists: */
+    if (!m_spInstance)
+    {
+        new UIExtraDataManager;
+        m_spInstance->prepare();
+    }
+    /* Return instance: */
+    return m_spInstance;
+}
+
+/* static */
+void UIExtraDataManager::destroy()
+{
+    /* Destroy/cleanup instance if still exists: */
+    if (m_spInstance)
+    {
+        m_spInstance->cleanup();
+        delete m_spInstance;
+    }
+}
+
+#ifdef DEBUG
+/* static */
+void UIExtraDataManager::openWindow(QWidget *pCenterWidget)
+{
+    /* Pass to instance: */
+    instance()->open(pCenterWidget);
+}
+#endif /* DEBUG */
+
+void UIExtraDataManager::hotloadMachineExtraDataMap(const QString &strID)
+{
+    /* Make sure it is valid ID: */
+    AssertMsgReturnVoid(!strID.isNull() && strID != GlobalID,
+                        ("Invalid VM ID = {%s}\n", strID.toAscii().constData()));
+    /* Which is not loaded yet: */
+    AssertReturnVoid(!m_data.contains(strID));
+
+    /* Search for corresponding machine: */
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    CMachine machine = vbox.FindMachine(strID);
+    AssertReturnVoid(vbox.isOk() && !machine.isNull());
+
+    /* Make sure at least empty map is created: */
+    m_data[strID] = ExtraDataMap();
+
+    /* Do not handle inaccessible machine: */
+    if (!machine.GetAccessible())
+        return;
+
+    /* Load machine extra-data map: */
+    foreach (const QString &strKey, machine.GetExtraDataKeys())
+        m_data[strID][strKey] = machine.GetExtraData(strKey);
+
+    /* Notifies about extra-data map acknowledged: */
+    emit sigExtraDataMapAcknowledging(strID);
+}
+
+QString UIExtraDataManager::extraDataString(const QString &strKey, const QString &strID /* = GlobalID */)
+{
+    /* Hot-load machine extra-data map if necessary: */
+    if (strID != GlobalID && !m_data.contains(strID))
+        hotloadMachineExtraDataMap(strID);
+
+    /* Read-only access corresponding map: */
+    const ExtraDataMap data = m_data.value(strID);
+
+    /* QString() if value was not set: */
+    if (!data.contains(strKey))
+        return QString();
+
+    /* Returns corresponding value: */
+    return data[strKey];
+}
+
+void UIExtraDataManager::setExtraDataString(const QString &strKey, const QString &strValue, const QString &strID /* = GlobalID */)
+{
+    /* Make sure VBoxSVC is available: */
+    if (!vboxGlobal().isVBoxSVCAvailable())
+        return;
+
+    /* Hot-load machine extra-data map if necessary: */
+    if (strID != GlobalID && !m_data.contains(strID))
+        hotloadMachineExtraDataMap(strID);
+
+    /* Access corresponding map: */
+    ExtraDataMap &data = m_data[strID];
+
+    /* [Re]cache passed value: */
+    data[strKey] = strValue;
+
+    /* Global extra-data: */
+    if (strID == GlobalID)
+    {
+        /* Get global object: */
+        CVirtualBox vbox = vboxGlobal().virtualBox();
+        /* Update global extra-data: */
+        vbox.SetExtraData(strKey, strValue);
+        if (!vbox.isOk())
+            msgCenter().cannotSetExtraData(vbox, strKey, strValue);
+    }
+    /* Machine extra-data: */
+    else
+    {
+        /* Search for corresponding machine: */
+        CVirtualBox vbox = vboxGlobal().virtualBox();
+        const CMachine machine = vbox.FindMachine(strID);
+        AssertReturnVoid(vbox.isOk() && !machine.isNull());
+        /* Check the configuration access-level: */
+        const KMachineState machineState = machine.GetState();
+        const KSessionState sessionState = machine.GetSessionState();
+        const ConfigurationAccessLevel cLevel = configurationAccessLevel(sessionState, machineState);
+        /* Prepare machine session: */
+        CSession session;
+        if (cLevel == ConfigurationAccessLevel_Full)
+            session = vboxGlobal().openSession(strID);
+        else
+            session = vboxGlobal().openExistingSession(strID);
+        AssertReturnVoid(!session.isNull());
+        /* Get machine from that session: */
+        CMachine sessionMachine = session.GetMachine();
+        /* Update machine extra-data: */
+        sessionMachine.SetExtraData(strKey, strValue);
+        if (!sessionMachine.isOk())
+            msgCenter().cannotSetExtraData(sessionMachine, strKey, strValue);
+        session.UnlockMachine();
+    }
+}
+
+QStringList UIExtraDataManager::extraDataStringList(const QString &strKey, const QString &strID /* = GlobalID */)
+{
+    /* Hot-load machine extra-data map if necessary: */
+    if (strID != GlobalID && !m_data.contains(strID))
+        hotloadMachineExtraDataMap(strID);
+
+    /* Read-only access corresponding map: */
+    const ExtraDataMap data = m_data.value(strID);
+
+    /* QStringList() if machine value was not set: */
+    if (!data.contains(strKey))
+        return QStringList();
+
+    /* Few old extra-data string-lists were separated with 'semicolon' symbol.
+     * All new separated by 'comma'. We have to take that into account. */
+    return data[strKey].split(QRegExp("[;,]"), QString::SkipEmptyParts);
+}
+
+void UIExtraDataManager::setExtraDataStringList(const QString &strKey, const QStringList &value, const QString &strID /* = GlobalID */)
+{
+    /* Make sure VBoxSVC is available: */
+    if (!vboxGlobal().isVBoxSVCAvailable())
+        return;
+
+    /* Hot-load machine extra-data map if necessary: */
+    if (strID != GlobalID && !m_data.contains(strID))
+        hotloadMachineExtraDataMap(strID);
+
+    /* Access corresponding map: */
+    ExtraDataMap &data = m_data[strID];
+
+    /* [Re]cache passed value: */
+    data[strKey] = value.join(",");
+
+    /* Global extra-data: */
+    if (strID == GlobalID)
+    {
+        /* Get global object: */
+        CVirtualBox vbox = vboxGlobal().virtualBox();
+        /* Update global extra-data: */
+        vbox.SetExtraDataStringList(strKey, value);
+        if (!vbox.isOk())
+            msgCenter().cannotSetExtraData(vbox, strKey, value.join(","));
+    }
+    /* Machine extra-data: */
+    else
+    {
+        /* Search for corresponding machine: */
+        CVirtualBox vbox = vboxGlobal().virtualBox();
+        const CMachine machine = vbox.FindMachine(strID);
+        AssertReturnVoid(vbox.isOk() && !machine.isNull());
+        /* Check the configuration access-level: */
+        const KMachineState machineState = machine.GetState();
+        const KSessionState sessionState = machine.GetSessionState();
+        const ConfigurationAccessLevel cLevel = configurationAccessLevel(sessionState, machineState);
+        /* Prepare machine session: */
+        CSession session;
+        if (cLevel == ConfigurationAccessLevel_Full)
+            session = vboxGlobal().openSession(strID);
+        else
+            session = vboxGlobal().openExistingSession(strID);
+        AssertReturnVoid(!session.isNull());
+        /* Get machine from that session: */
+        CMachine sessionMachine = session.GetMachine();
+        /* Update machine extra-data: */
+        sessionMachine.SetExtraDataStringList(strKey, value);
+        if (!sessionMachine.isOk())
+            msgCenter().cannotSetExtraData(sessionMachine, strKey, value.join(","));
+        session.UnlockMachine();
+    }
+}
+
+UIExtraDataManager::UIExtraDataManager()
+    : m_pHandler(0)
+{
+    /* Connect to static instance: */
+    m_spInstance = this;
+}
+
+UIExtraDataManager::~UIExtraDataManager()
+{
+    /* Disconnect from static instance: */
+    m_spInstance = 0;
+}
+
+QStringList UIExtraDataManager::suppressedMessages()
+{
+    return extraDataStringList(GUI_SuppressMessages);
+}
+
+void UIExtraDataManager::setSuppressedMessages(const QStringList &list)
+{
+    setExtraDataStringList(GUI_SuppressMessages, list);
+}
+
+QStringList UIExtraDataManager::messagesWithInvertedOption()
+{
+    return extraDataStringList(GUI_InvertMessageOption);
+}
+
+#if !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG)
+QString UIExtraDataManager::preventBetaBuildWarningForVersion()
+{
+    return extraDataString(GUI_PreventBetaWarning);
+}
+#endif /* !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG) */
+
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+bool UIExtraDataManager::applicationUpdateEnabled()
+{
+    /* 'True' unless 'restriction' feature allowed: */
+    return !isFeatureAllowed(GUI_PreventApplicationUpdate);
+}
+
+QString UIExtraDataManager::applicationUpdateData()
+{
+    return extraDataString(GUI_UpdateDate);
+}
+
+void UIExtraDataManager::setApplicationUpdateData(const QString &strValue)
+{
+    setExtraDataString(GUI_UpdateDate, strValue);
+}
+
+qulonglong UIExtraDataManager::applicationUpdateCheckCounter()
+{
+    /* Read subsequent update check counter value: */
+    qulonglong uResult = 1;
+    const QString strCheckCount = extraDataString(GUI_UpdateCheckCount);
+    if (!strCheckCount.isEmpty())
+    {
+        bool ok = false;
+        qulonglong uCheckCount = strCheckCount.toULongLong(&ok);
+        if (ok) uResult = uCheckCount;
+    }
+    /* Return update check counter value: */
+    return uResult;
+}
+
+void UIExtraDataManager::incrementApplicationUpdateCheckCounter()
+{
+    /* Increment update check counter value: */
+    setExtraDataString(GUI_UpdateCheckCount, QString::number(applicationUpdateCheckCounter() + 1));
+}
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+
+QList<GlobalSettingsPageType> UIExtraDataManager::restrictedGlobalSettingsPages()
+{
+    /* Prepare result: */
+    QList<GlobalSettingsPageType> result;
+    /* Get restricted global-settings-pages: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedGlobalSettingsPages))
+    {
+        GlobalSettingsPageType value = gpConverter->fromInternalString<GlobalSettingsPageType>(strValue);
+        if (value != GlobalSettingsPageType_Invalid)
+            result << value;
+    }
+    /* Return result: */
+    return result;
+}
+
+QList<MachineSettingsPageType> UIExtraDataManager::restrictedMachineSettingsPages(const QString &strID)
+{
+    /* Prepare result: */
+    QList<MachineSettingsPageType> result;
+    /* Get restricted machine-settings-pages: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedMachineSettingsPages, strID))
+    {
+        MachineSettingsPageType value = gpConverter->fromInternalString<MachineSettingsPageType>(strValue);
+        if (value != MachineSettingsPageType_Invalid)
+            result << value;
+    }
+    /* Return result: */
+    return result;
+}
+
+bool UIExtraDataManager::activateHoveredMachineWindow()
+{
+    /* 'False' unless feature allowed: */
+    return isFeatureAllowed(GUI_ActivateHoveredMachineWindow);
+}
+
+void UIExtraDataManager::setActivateHoveredMachineWindow(bool fActivate)
+{
+    /* 'True' if feature allowed, null-string otherwise: */
+    setExtraDataString(GUI_ActivateHoveredMachineWindow, toFeatureAllowed(fActivate));
+}
+
+QStringList UIExtraDataManager::shortcutOverrides(const QString &strPoolExtraDataID)
+{
+    if (strPoolExtraDataID == GUI_Input_SelectorShortcuts)
+        return extraDataStringList(GUI_Input_SelectorShortcuts);
+    if (strPoolExtraDataID == GUI_Input_MachineShortcuts)
+        return extraDataStringList(GUI_Input_MachineShortcuts);
+    return QStringList();
+}
+
+QString UIExtraDataManager::recentFolderForHardDrives()
+{
+    return extraDataString(GUI_RecentFolderHD);
+}
+
+QString UIExtraDataManager::recentFolderForOpticalDisks()
+{
+    return extraDataString(GUI_RecentFolderCD);
+}
+
+QString UIExtraDataManager::recentFolderForFloppyDisks()
+{
+    return extraDataString(GUI_RecentFolderFD);
+}
+
+void UIExtraDataManager::setRecentFolderForHardDrives(const QString &strValue)
+{
+    setExtraDataString(GUI_RecentFolderHD, strValue);
+}
+
+void UIExtraDataManager::setRecentFolderForOpticalDisks(const QString &strValue)
+{
+    setExtraDataString(GUI_RecentFolderCD, strValue);
+}
+
+void UIExtraDataManager::setRecentFolderForFloppyDisks(const QString &strValue)
+{
+    setExtraDataString(GUI_RecentFolderFD, strValue);
+}
+
+QStringList UIExtraDataManager::recentListOfHardDrives()
+{
+    return extraDataStringList(GUI_RecentListHD);
+}
+
+QStringList UIExtraDataManager::recentListOfOpticalDisks()
+{
+    return extraDataStringList(GUI_RecentListCD);
+}
+
+QStringList UIExtraDataManager::recentListOfFloppyDisks()
+{
+    return extraDataStringList(GUI_RecentListFD);
+}
+
+void UIExtraDataManager::setRecentListOfHardDrives(const QStringList &value)
+{
+    setExtraDataStringList(GUI_RecentListHD, value);
+}
+
+void UIExtraDataManager::setRecentListOfOpticalDisks(const QStringList &value)
+{
+    setExtraDataStringList(GUI_RecentListCD, value);
+}
+
+void UIExtraDataManager::setRecentListOfFloppyDisks(const QStringList &value)
+{
+    setExtraDataStringList(GUI_RecentListFD, value);
+}
+
+QRect UIExtraDataManager::selectorWindowGeometry(QWidget *pWidget)
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_LastSelectorWindowPosition);
+
+    /* Parse loaded data: */
+    int iX = 0, iY = 0, iW = 0, iH = 0;
+    bool fOk = data.size() >= 4;
+    do
+    {
+        if (!fOk) break;
+        iX = data[0].toInt(&fOk);
+        if (!fOk) break;
+        iY = data[1].toInt(&fOk);
+        if (!fOk) break;
+        iW = data[2].toInt(&fOk);
+        if (!fOk) break;
+        iH = data[3].toInt(&fOk);
+    }
+    while (0);
+
+    /* Use geometry (loaded or default): */
+    QRect geometry = fOk ? QRect(iX, iY, iW, iH) : QRect(0, 0, 770, 550);
+
+    /* Take widget into account: */
+    if (pWidget)
+        geometry.setSize(geometry.size().expandedTo(pWidget->minimumSizeHint()));
+
+    /* Get screen-geometry [of screen with point (iX, iY) if possible]: */
+    const QRect screenGeometry = fOk ? QApplication::desktop()->availableGeometry(QPoint(iX, iY)) :
+                                       QApplication::desktop()->availableGeometry();
+
+    /* Make sure resulting geometry is within current bounds: */
+    geometry = geometry.intersected(screenGeometry);
+
+    /* Move default-geometry to screen-geometry' center: */
+    if (!fOk)
+        geometry.moveCenter(screenGeometry.center());
+
+    /* Return result: */
+    return geometry;
+}
+
+bool UIExtraDataManager::selectorWindowShouldBeMaximized()
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_LastSelectorWindowPosition);
+
+    /* Make sure 5th item has required value: */
+    return data.size() == 5 && data[4] == GUI_Geometry_State_Max;
+}
+
+void UIExtraDataManager::setSelectorWindowGeometry(const QRect &geometry, bool fMaximized)
+{
+    /* Serialize passed values: */
+    QStringList data;
+    data << QString::number(geometry.x());
+    data << QString::number(geometry.y());
+    data << QString::number(geometry.width());
+    data << QString::number(geometry.height());
+    if (fMaximized)
+        data << GUI_Geometry_State_Max;
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(GUI_LastSelectorWindowPosition, data);
+}
+
+QList<int> UIExtraDataManager::selectorWindowSplitterHints()
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_SplitterSizes);
+
+    /* Parse loaded data: */
+    QList<int> hints;
+    hints << (data.size() > 0 ? data[0].toInt() : 0);
+    hints << (data.size() > 1 ? data[1].toInt() : 0);
+
+    /* Return hints: */
+    return hints;
+}
+
+void UIExtraDataManager::setSelectorWindowSplitterHints(const QList<int> &hints)
+{
+    /* Parse passed hints: */
+    QStringList data;
+    data << (hints.size() > 0 ? QString::number(hints[0]) : QString());
+    data << (hints.size() > 1 ? QString::number(hints[1]) : QString());
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(GUI_SplitterSizes, data);
+}
+
+bool UIExtraDataManager::selectorWindowToolBarVisible()
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_Toolbar);
+}
+
+void UIExtraDataManager::setSelectorWindowToolBarVisible(bool fVisible)
+{
+    /* 'False' if feature restricted, null-string otherwise: */
+    setExtraDataString(GUI_Toolbar, toFeatureRestricted(!fVisible));
+}
+
+bool UIExtraDataManager::selectorWindowStatusBarVisible()
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_Statusbar);
+}
+
+void UIExtraDataManager::setSelectorWindowStatusBarVisible(bool fVisible)
+{
+    /* 'False' if feature restricted, null-string otherwise: */
+    setExtraDataString(GUI_Statusbar, toFeatureRestricted(!fVisible));
+}
+
+void UIExtraDataManager::clearSelectorWindowGroupsDefinitions()
+{
+    /* Wipe-out each the group definition record: */
+    foreach (const QString &strKey, m_data.value(GlobalID).keys())
+        if (strKey.startsWith(GUI_GroupDefinitions))
+            setExtraDataString(strKey, QString());
+}
+
+QStringList UIExtraDataManager::selectorWindowGroupsDefinitions(const QString &strGroupID)
+{
+    return extraDataStringList(GUI_GroupDefinitions + strGroupID);
+}
+
+void UIExtraDataManager::setSelectorWindowGroupsDefinitions(const QString &strGroupID, const QStringList &definitions)
+{
+    setExtraDataStringList(GUI_GroupDefinitions + strGroupID, definitions);
+}
+
+QString UIExtraDataManager::selectorWindowLastItemChosen()
+{
+    return extraDataString(GUI_LastItemSelected);
+}
+
+void UIExtraDataManager::setSelectorWindowLastItemChosen(const QString &strItemID)
+{
+    setExtraDataString(GUI_LastItemSelected, strItemID);
+}
+
+QMap<DetailsElementType, bool> UIExtraDataManager::selectorWindowDetailsElements()
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_DetailsPageBoxes);
+
+    /* Desearialize passed elements: */
+    QMap<DetailsElementType, bool> elements;
+    foreach (QString strItem, data)
+    {
+        bool fOpened = true;
+        if (strItem.endsWith("Closed", Qt::CaseInsensitive))
+        {
+            fOpened = false;
+            strItem.remove("Closed");
+        }
+        DetailsElementType type = gpConverter->fromInternalString<DetailsElementType>(strItem);
+        if (type != DetailsElementType_Invalid)
+            elements[type] = fOpened;
+    }
+
+    /* Return elements: */
+    return elements;
+}
+
+void UIExtraDataManager::setSelectorWindowDetailsElements(const QMap<DetailsElementType, bool> &elements)
+{
+    /* Prepare corresponding extra-data: */
+    QStringList data;
+
+    /* Searialize passed elements: */
+    foreach (DetailsElementType type, elements.keys())
+    {
+        QString strValue = gpConverter->toInternalString(type);
+        if (!elements[type])
+            strValue += "Closed";
+        data << strValue;
+    }
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(GUI_DetailsPageBoxes, data);
+}
+
+PreviewUpdateIntervalType UIExtraDataManager::selectorWindowPreviewUpdateInterval()
+{
+    return gpConverter->fromInternalString<PreviewUpdateIntervalType>(extraDataString(GUI_PreviewUpdate));
+}
+
+void UIExtraDataManager::setSelectorWindowPreviewUpdateInterval(PreviewUpdateIntervalType interval)
+{
+    setExtraDataString(GUI_PreviewUpdate, gpConverter->toInternalString(interval));
+}
+
+WizardMode UIExtraDataManager::modeForWizardType(WizardType type)
+{
+    /* Some wizard use only 'basic' mode: */
+    if (type == WizardType_FirstRun)
+        return WizardMode_Basic;
+    /* Otherwise get mode from cached extra-data: */
+    return extraDataStringList(GUI_HideDescriptionForWizards).contains(gpConverter->toInternalString(type))
+           ? WizardMode_Expert : WizardMode_Basic;
+}
+
+void UIExtraDataManager::setModeForWizardType(WizardType type, WizardMode mode)
+{
+    /* Get wizard name: */
+    const QString strWizardName = gpConverter->toInternalString(type);
+    /* Get current value: */
+    const QStringList oldValue = extraDataStringList(GUI_HideDescriptionForWizards);
+    QStringList newValue = oldValue;
+    /* Include wizard-name into expert-mode wizard list if necessary: */
+    if (mode == WizardMode_Expert && !newValue.contains(strWizardName))
+        newValue << strWizardName;
+    /* Exclude wizard-name from expert-mode wizard list if necessary: */
+    else if (mode == WizardMode_Basic && newValue.contains(strWizardName))
+        newValue.removeAll(strWizardName);
+    /* Update extra-data if necessary: */
+    if (newValue != oldValue)
+        setExtraDataStringList(GUI_HideDescriptionForWizards, newValue);
+}
+
+bool UIExtraDataManager::showMachineInSelectorChooser(const QString &strID)
+{
+    /* 'True' unless 'restriction' feature allowed: */
+    return !isFeatureAllowed(GUI_HideFromManager, strID);
+}
+
+bool UIExtraDataManager::showMachineInSelectorDetails(const QString &strID)
+{
+    /* 'True' unless 'restriction' feature allowed: */
+    return !isFeatureAllowed(GUI_HideDetails, strID);
+}
+
+bool UIExtraDataManager::machineReconfigurationEnabled(const QString &strID)
+{
+    /* 'True' unless 'restriction' feature allowed: */
+    return !isFeatureAllowed(GUI_PreventReconfiguration, strID);
+}
+
+bool UIExtraDataManager::machineSnapshotOperationsEnabled(const QString &strID)
+{
+    /* 'True' unless 'restriction' feature allowed: */
+    return !isFeatureAllowed(GUI_PreventSnapshotOperations, strID);
+}
+
+bool UIExtraDataManager::machineFirstTimeStarted(const QString &strID)
+{
+    /* 'True' only if feature is allowed: */
+    return isFeatureAllowed(GUI_FirstRun, strID);
+}
+
+void UIExtraDataManager::setMachineFirstTimeStarted(bool fFirstTimeStarted, const QString &strID)
+{
+    /* 'True' if feature allowed, null-string otherwise: */
+    setExtraDataString(GUI_FirstRun, toFeatureAllowed(fFirstTimeStarted), strID);
+}
+
+#ifndef Q_WS_MAC
+QStringList UIExtraDataManager::machineWindowIconNames(const QString &strID)
+{
+    return extraDataStringList(GUI_MachineWindowIcons, strID);
+}
+
+QString UIExtraDataManager::machineWindowNamePostfix(const QString &strID)
+{
+    return extraDataString(GUI_MachineWindowNamePostfix, strID);
+}
+#endif /* !Q_WS_MAC */
+
+QRect UIExtraDataManager::machineWindowGeometry(UIVisualStateType visualStateType, ulong uScreenIndex, const QString &strID)
+{
+    /* Choose corresponding key: */
+    QString strKey;
+    switch (visualStateType)
+    {
+        case UIVisualStateType_Normal: strKey = extraDataKeyPerScreen(GUI_LastNormalWindowPosition, uScreenIndex); break;
+        case UIVisualStateType_Scale:  strKey = extraDataKeyPerScreen(GUI_LastScaleWindowPosition, uScreenIndex); break;
+        default: AssertFailedReturn(QRect());
+    }
+
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(strKey, strID);
+
+    /* Parse loaded data: */
+    int iX = 0, iY = 0, iW = 0, iH = 0;
+    bool fOk = data.size() >= 4;
+    do
+    {
+        if (!fOk) break;
+        iX = data[0].toInt(&fOk);
+        if (!fOk) break;
+        iY = data[1].toInt(&fOk);
+        if (!fOk) break;
+        iW = data[2].toInt(&fOk);
+        if (!fOk) break;
+        iH = data[3].toInt(&fOk);
+    }
+    while (0);
+
+    /* Return geometry (loaded or null): */
+    return fOk ? QRect(iX, iY, iW, iH) : QRect();
+}
+
+bool UIExtraDataManager::machineWindowShouldBeMaximized(UIVisualStateType visualStateType, ulong uScreenIndex, const QString &strID)
+{
+    /* Choose corresponding key: */
+    QString strKey;
+    switch (visualStateType)
+    {
+        case UIVisualStateType_Normal: strKey = extraDataKeyPerScreen(GUI_LastNormalWindowPosition, uScreenIndex); break;
+        case UIVisualStateType_Scale:  strKey = extraDataKeyPerScreen(GUI_LastScaleWindowPosition, uScreenIndex); break;
+        default: AssertFailedReturn(false);
+    }
+
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(strKey, strID);
+
+    /* Make sure 5th item has required value: */
+    return data.size() == 5 && data[4] == GUI_Geometry_State_Max;
+}
+
+void UIExtraDataManager::setMachineWindowGeometry(UIVisualStateType visualStateType, ulong uScreenIndex, const QRect &geometry, bool fMaximized, const QString &strID)
+{
+    /* Choose corresponding key: */
+    QString strKey;
+    switch (visualStateType)
+    {
+        case UIVisualStateType_Normal: strKey = extraDataKeyPerScreen(GUI_LastNormalWindowPosition, uScreenIndex); break;
+        case UIVisualStateType_Scale:  strKey = extraDataKeyPerScreen(GUI_LastScaleWindowPosition, uScreenIndex); break;
+        default: AssertFailedReturnVoid();
+    }
+
+    /* Serialize passed values: */
+    QStringList data;
+    data << QString::number(geometry.x());
+    data << QString::number(geometry.y());
+    data << QString::number(geometry.width());
+    data << QString::number(geometry.height());
+    if (fMaximized)
+        data << GUI_Geometry_State_Max;
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(strKey, data, strID);
+}
+
+#ifndef Q_WS_MAC
+bool UIExtraDataManager::menuBarEnabled(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_MenuBar_Enabled, strID);
+}
+
+void UIExtraDataManager::setMenuBarEnabled(bool fEnabled, const QString &strID)
+{
+    /* 'False' if feature restricted, null-string otherwise: */
+    setExtraDataString(GUI_MenuBar_Enabled, toFeatureRestricted(!fEnabled), strID);
+}
+#endif /* !Q_WS_MAC */
+
+UIExtraDataMetaDefs::MenuType UIExtraDataManager::restrictedRuntimeMenuTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::MenuType result = UIExtraDataMetaDefs::MenuType_Invalid;
+    /* Get restricted runtime-menu-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeMenus, strID))
+    {
+        UIExtraDataMetaDefs::MenuType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::MenuType>(strValue);
+        if (value != UIExtraDataMetaDefs::MenuType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::MenuType>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuTypes(UIExtraDataMetaDefs::MenuType types, const QString &strID)
+{
+    /* We have MenuType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("MenuType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle MenuType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::MenuType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::MenuType enumValue =
+                static_cast<const UIExtraDataMetaDefs::MenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip MenuType_Invalid & MenuType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::MenuType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::MenuType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeMenus, result, strID);
+}
+
+UIExtraDataMetaDefs::MenuApplicationActionType UIExtraDataManager::restrictedRuntimeMenuApplicationActionTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::MenuApplicationActionType result = UIExtraDataMetaDefs::MenuApplicationActionType_Invalid;
+    /* Get restricted runtime-application-menu action-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeApplicationMenuActions, strID))
+    {
+        UIExtraDataMetaDefs::MenuApplicationActionType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::MenuApplicationActionType>(strValue);
+        if (value != UIExtraDataMetaDefs::MenuApplicationActionType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::MenuApplicationActionType>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuApplicationActionTypes(UIExtraDataMetaDefs::MenuApplicationActionType types, const QString &strID)
+{
+    /* We have MenuApplicationActionType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("MenuApplicationActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle MenuApplicationActionType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::MenuApplicationActionType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::MenuApplicationActionType enumValue =
+                static_cast<const UIExtraDataMetaDefs::MenuApplicationActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip MenuApplicationActionType_Invalid & MenuApplicationActionType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeApplicationMenuActions, result, strID);
+}
+
+UIExtraDataMetaDefs::RuntimeMenuMachineActionType UIExtraDataManager::restrictedRuntimeMenuMachineActionTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::RuntimeMenuMachineActionType result = UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid;
+    /* Get restricted runtime-machine-menu action-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeMachineMenuActions, strID))
+    {
+        UIExtraDataMetaDefs::RuntimeMenuMachineActionType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(strValue);
+        /* Since empty value has default restriction, we are supporting special 'Nothing' value: */
+        if (value == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Nothing)
+        {
+            result = UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Nothing;
+            break;
+        }
+        if (value != UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(result | value);
+    }
+    /* Defaults: */
+    if (result == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid)
+    {
+        result = static_cast<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(result | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState);
+        result = static_cast<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(result | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuMachineActionTypes(UIExtraDataMetaDefs::RuntimeMenuMachineActionType types, const QString &strID)
+{
+    /* We have RuntimeMenuMachineActionType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuMachineActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle RuntimeMenuMachineActionType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::RuntimeMenuMachineActionType enumValue =
+                static_cast<const UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip RuntimeMenuMachineActionType_Invalid, RuntimeMenuMachineActionType_Nothing & RuntimeMenuMachineActionType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Nothing ||
+                enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Since empty value has default restriction, we are supporting special 'Nothing' value: */
+    if (result.isEmpty())
+        result << gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Nothing);
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeMachineMenuActions, result, strID);
+}
+
+UIExtraDataMetaDefs::RuntimeMenuViewActionType UIExtraDataManager::restrictedRuntimeMenuViewActionTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::RuntimeMenuViewActionType result = UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid;
+    /* Get restricted runtime-view-menu action-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeViewMenuActions, strID))
+    {
+        UIExtraDataMetaDefs::RuntimeMenuViewActionType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(strValue);
+        if (value != UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuViewActionTypes(UIExtraDataMetaDefs::RuntimeMenuViewActionType types, const QString &strID)
+{
+    /* We have RuntimeMenuViewActionType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuViewActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle RuntimeMenuViewActionType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::RuntimeMenuViewActionType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::RuntimeMenuViewActionType enumValue =
+                static_cast<const UIExtraDataMetaDefs::RuntimeMenuViewActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip RuntimeMenuViewActionType_Invalid & RuntimeMenuViewActionType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeViewMenuActions, result, strID);
+}
+
+UIExtraDataMetaDefs::RuntimeMenuInputActionType UIExtraDataManager::restrictedRuntimeMenuInputActionTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::RuntimeMenuInputActionType result = UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid;
+    /* Get restricted runtime-machine-menu action-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeInputMenuActions, strID))
+    {
+        UIExtraDataMetaDefs::RuntimeMenuInputActionType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::RuntimeMenuInputActionType>(strValue);
+        if (value != UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::RuntimeMenuInputActionType>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuInputActionTypes(UIExtraDataMetaDefs::RuntimeMenuInputActionType types, const QString &strID)
+{
+    /* We have RuntimeMenuInputActionType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuInputActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle RuntimeMenuInputActionType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::RuntimeMenuInputActionType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::RuntimeMenuInputActionType enumValue =
+                static_cast<const UIExtraDataMetaDefs::RuntimeMenuInputActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip RuntimeMenuInputActionType_Invalid & RuntimeMenuInputActionType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeInputMenuActions, result, strID);
+}
+
+UIExtraDataMetaDefs::RuntimeMenuDevicesActionType UIExtraDataManager::restrictedRuntimeMenuDevicesActionTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::RuntimeMenuDevicesActionType result = UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid;
+    /* Get restricted runtime-devices-menu action-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeDevicesMenuActions, strID))
+    {
+        UIExtraDataMetaDefs::RuntimeMenuDevicesActionType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(strValue);
+        /* Since empty value has default restriction, we are supporting special 'Nothing' value: */
+        if (value == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing)
+        {
+            result = UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing;
+            break;
+        }
+        if (value != UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(result | value);
+    }
+    /* Defaults: */
+    if (result == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid)
+    {
+        result = static_cast<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(result | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuDevicesActionTypes(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType types, const QString &strID)
+{
+    /* We have RuntimeMenuDevicesActionType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDevicesActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle RuntimeMenuDevicesActionType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enumValue =
+                static_cast<const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip RuntimeMenuDevicesActionType_Invalid, RuntimeMenuDevicesActionType_Nothing & RuntimeMenuDevicesActionType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing ||
+                enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Since empty value has default restriction, we are supporting special 'Nothing' value: */
+    if (result.isEmpty())
+        result << gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Nothing);
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeDevicesMenuActions, result, strID);
+}
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType UIExtraDataManager::restrictedRuntimeMenuDebuggerActionTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType result = UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid;
+    /* Get restricted runtime-debugger-menu action-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeDebuggerMenuActions, strID))
+    {
+        UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(strValue);
+        if (value != UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuDebuggerActionTypes(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType types, const QString &strID)
+{
+    /* We have RuntimeMenuDebuggerActionType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDebuggerActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle RuntimeMenuDebuggerActionType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enumValue =
+                static_cast<const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip RuntimeMenuDebuggerActionType_Invalid & RuntimeMenuDebuggerActionType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeDebuggerMenuActions, result, strID);
+}
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef Q_WS_MAC
+UIExtraDataMetaDefs::MenuWindowActionType UIExtraDataManager::restrictedRuntimeMenuWindowActionTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::MenuWindowActionType result = UIExtraDataMetaDefs::MenuWindowActionType_Invalid;
+    /* Get restricted runtime-window-menu action-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeWindowMenuActions, strID))
+    {
+        UIExtraDataMetaDefs::MenuWindowActionType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::MenuWindowActionType>(strValue);
+        if (value != UIExtraDataMetaDefs::MenuWindowActionType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::MenuWindowActionType>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuWindowActionTypes(UIExtraDataMetaDefs::MenuWindowActionType types, const QString &strID)
+{
+    /* We have MenuWindowActionType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("MenuWindowActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle MenuWindowActionType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::MenuWindowActionType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::MenuWindowActionType enumValue =
+                static_cast<const UIExtraDataMetaDefs::MenuWindowActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip MenuWindowActionType_Invalid & MenuWindowActionType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::MenuWindowActionType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::MenuWindowActionType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeWindowMenuActions, result, strID);
+}
+#endif /* Q_WS_MAC */
+
+UIExtraDataMetaDefs::MenuHelpActionType UIExtraDataManager::restrictedRuntimeMenuHelpActionTypes(const QString &strID)
+{
+    /* Prepare result: */
+    UIExtraDataMetaDefs::MenuHelpActionType result = UIExtraDataMetaDefs::MenuHelpActionType_Invalid;
+    /* Get restricted runtime-help-menu action-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedRuntimeHelpMenuActions, strID))
+    {
+        UIExtraDataMetaDefs::MenuHelpActionType value = gpConverter->fromInternalString<UIExtraDataMetaDefs::MenuHelpActionType>(strValue);
+        if (value != UIExtraDataMetaDefs::MenuHelpActionType_Invalid)
+            result = static_cast<UIExtraDataMetaDefs::MenuHelpActionType>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedRuntimeMenuHelpActionTypes(UIExtraDataMetaDefs::MenuHelpActionType types, const QString &strID)
+{
+    /* We have MenuHelpActionType enum registered, so we can enumerate it: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+    const int iEnumIndex = smo.indexOfEnumerator("MenuHelpActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+
+    /* Prepare result: */
+    QStringList result;
+    /* Handle MenuHelpActionType_All enum-value: */
+    if (types == UIExtraDataMetaDefs::MenuHelpActionType_All)
+        result << gpConverter->toInternalString(types);
+    else
+    {
+        /* Handle other enum-values: */
+        for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+        {
+            /* Get iterated enum-value: */
+            const UIExtraDataMetaDefs::MenuHelpActionType enumValue =
+                static_cast<const UIExtraDataMetaDefs::MenuHelpActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+            /* Skip MenuHelpActionType_Invalid && MenuHelpActionType_All enum-values: */
+            if (enumValue == UIExtraDataMetaDefs::MenuHelpActionType_Invalid ||
+                enumValue == UIExtraDataMetaDefs::MenuHelpActionType_All)
+                continue;
+            if (types & enumValue)
+                result << gpConverter->toInternalString(enumValue);
+        }
+    }
+    /* Save result: */
+    setExtraDataStringList(GUI_RestrictedRuntimeHelpMenuActions, result, strID);
+}
+
+UIVisualStateType UIExtraDataManager::restrictedVisualStates(const QString &strID)
+{
+    /* Prepare result: */
+    UIVisualStateType result = UIVisualStateType_Invalid;
+    /* Get restricted visual-state-types: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedVisualStates, strID))
+    {
+        UIVisualStateType value = gpConverter->fromInternalString<UIVisualStateType>(strValue);
+        if (value != UIVisualStateType_Invalid)
+            result = static_cast<UIVisualStateType>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+UIVisualStateType UIExtraDataManager::requestedVisualState(const QString &strID)
+{
+    if (isFeatureAllowed(GUI_Fullscreen, strID)) return UIVisualStateType_Fullscreen;
+    if (isFeatureAllowed(GUI_Seamless, strID)) return UIVisualStateType_Seamless;
+    if (isFeatureAllowed(GUI_Scale, strID)) return UIVisualStateType_Scale;
+    return UIVisualStateType_Normal;
+}
+
+void UIExtraDataManager::setRequestedVisualState(UIVisualStateType visualState, const QString &strID)
+{
+    setExtraDataString(GUI_Fullscreen, toFeatureAllowed(visualState == UIVisualStateType_Fullscreen), strID);
+    setExtraDataString(GUI_Seamless, toFeatureAllowed(visualState == UIVisualStateType_Seamless), strID);
+    setExtraDataString(GUI_Scale, toFeatureAllowed(visualState == UIVisualStateType_Scale), strID);
+}
+
+#ifdef Q_WS_X11
+bool UIExtraDataManager::legacyFullscreenModeRequested()
+{
+    /* 'False' unless feature allowed: */
+    return isFeatureAllowed(GUI_Fullscreen_LegacyMode);
+}
+#endif /* Q_WS_X11 */
+
+bool UIExtraDataManager::guestScreenAutoResizeEnabled(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_AutoresizeGuest, strID);
+}
+
+void UIExtraDataManager::setGuestScreenAutoResizeEnabled(bool fEnabled, const QString &strID)
+{
+    /* 'False' if feature restricted, null-string otherwise: */
+    setExtraDataString(GUI_AutoresizeGuest, toFeatureRestricted(!fEnabled), strID);
+}
+
+QSize UIExtraDataManager::lastGuestSizeHint(ulong uScreenIndex, const QString &strID)
+{
+    /* Choose corresponding key: */
+    const QString strKey = extraDataKeyPerScreen(GUI_LastGuestSizeHint, uScreenIndex);
+
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(strKey, strID);
+
+    /* Parse loaded data: */
+    int iW = 0, iH = 0;
+    bool fOk = data.size() == 2;
+    do
+    {
+        if (!fOk) break;
+        iW = data[0].toInt(&fOk);
+        if (!fOk) break;
+        iH = data[1].toInt(&fOk);
+    }
+    while (0);
+
+    /* Return size (loaded or invalid): */
+    return fOk ? QSize(iW, iH) : QSize();
+}
+
+void UIExtraDataManager::setLastGuestSizeHint(ulong uScreenIndex, const QSize &sizeHint, const QString &strID)
+{
+    /* Choose corresponding key: */
+    const QString strKey = extraDataKeyPerScreen(GUI_LastGuestSizeHint, uScreenIndex);
+
+    /* Serialize passed values: */
+    QStringList data;
+    data << QString::number(sizeHint.width());
+    data << QString::number(sizeHint.height());
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(strKey, data, strID);
+}
+
+bool UIExtraDataManager::wasLastGuestSizeHintForFullScreen(ulong uScreenIndex, const QString &strID)
+{
+    /* Choose corresponding key: */
+    const QString strKey = extraDataKeyPerScreen(GUI_LastGuestSizeHintWasFullscreen, uScreenIndex);
+
+    /* 'True' only if feature is allowed: */
+    return isFeatureAllowed(strKey, strID);
+}
+
+void UIExtraDataManager::markLastGuestSizeHintAsFullScreen(ulong uScreenIndex, bool fWas, const QString &strID)
+{
+    /* Choose corresponding key: */
+    const QString strKey = extraDataKeyPerScreen(GUI_LastGuestSizeHintWasFullscreen, uScreenIndex);
+
+    /* 'True' if feature allowed, null-string otherwise: */
+    return setExtraDataString(strKey, toFeatureAllowed(fWas), strID);
+}
+
+int UIExtraDataManager::hostScreenForPassedGuestScreen(int iGuestScreenIndex, const QString &strID)
+{
+    /* Choose corresponding key: */
+    const QString strKey = extraDataKeyPerScreen(GUI_VirtualScreenToHostScreen, iGuestScreenIndex, true);
+
+    /* Get value and convert it to index: */
+    const QString strValue = extraDataString(strKey, strID);
+    bool fOk = false;
+    const int iHostScreenIndex = strValue.toULong(&fOk);
+
+    /* Return corresponding index: */
+    return fOk ? iHostScreenIndex : -1;
+}
+
+void UIExtraDataManager::setHostScreenForPassedGuestScreen(int iGuestScreenIndex, int iHostScreenIndex, const QString &strID)
+{
+    /* Choose corresponding key: */
+    const QString strKey = extraDataKeyPerScreen(GUI_VirtualScreenToHostScreen, iGuestScreenIndex, true);
+
+    /* Save passed index under corresponding value: */
+    setExtraDataString(strKey, iHostScreenIndex != -1 ? QString::number(iHostScreenIndex) : QString(), strID);
+}
+
+bool UIExtraDataManager::autoMountGuestScreensEnabled(const QString &strID)
+{
+    /* Show only if 'allowed' flag is set: */
+    return isFeatureAllowed(GUI_AutomountGuestScreens, strID);
+}
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+bool UIExtraDataManager::useLinearStretch(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_Accelerate2D_StretchLinear, strID);
+}
+
+bool UIExtraDataManager::usePixelFormatYV12(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_Accelerate2D_PixformatYV12, strID);
+}
+
+bool UIExtraDataManager::usePixelFormatUYVY(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_Accelerate2D_PixformatUYVY, strID);
+}
+
+bool UIExtraDataManager::usePixelFormatYUY2(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_Accelerate2D_PixformatYUY2, strID);
+}
+
+bool UIExtraDataManager::usePixelFormatAYUV(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_Accelerate2D_PixformatAYUV, strID);
+}
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+
+bool UIExtraDataManager::useUnscaledHiDPIOutput(const QString &strID)
+{
+    /* 'False' unless feature allowed: */
+    return isFeatureAllowed(GUI_HiDPI_UnscaledOutput, strID);
+}
+
+void UIExtraDataManager::setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput, const QString &strID)
+{
+    /* 'True' if feature allowed, null-string otherwise: */
+    return setExtraDataString(GUI_HiDPI_UnscaledOutput, toFeatureAllowed(fUseUnscaledHiDPIOutput), strID);
+}
+
+HiDPIOptimizationType UIExtraDataManager::hiDPIOptimizationType(const QString &strID)
+{
+    return gpConverter->fromInternalString<HiDPIOptimizationType>(extraDataString(GUI_HiDPI_Optimization, strID));
+}
+
+#ifndef Q_WS_MAC
+bool UIExtraDataManager::miniToolbarEnabled(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_ShowMiniToolBar, strID);
+}
+
+void UIExtraDataManager::setMiniToolbarEnabled(bool fEnabled, const QString &strID)
+{
+    /* 'False' if feature restricted, null-string otherwise: */
+    setExtraDataString(GUI_ShowMiniToolBar, toFeatureRestricted(!fEnabled), strID);
+}
+
+bool UIExtraDataManager::autoHideMiniToolbar(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_MiniToolBarAutoHide, strID);
+}
+
+void UIExtraDataManager::setAutoHideMiniToolbar(bool fAutoHide, const QString &strID)
+{
+    /* 'False' if feature restricted, null-string otherwise: */
+    setExtraDataString(GUI_MiniToolBarAutoHide, toFeatureRestricted(!fAutoHide), strID);
+}
+
+Qt::AlignmentFlag UIExtraDataManager::miniToolbarAlignment(const QString &strID)
+{
+    /* Return Qt::AlignBottom unless MiniToolbarAlignment_Top specified separately: */
+    switch (gpConverter->fromInternalString<MiniToolbarAlignment>(extraDataString(GUI_MiniToolBarAlignment, strID)))
+    {
+        case MiniToolbarAlignment_Top: return Qt::AlignTop;
+        default: break;
+    }
+    return Qt::AlignBottom;
+}
+
+void UIExtraDataManager::setMiniToolbarAlignment(Qt::AlignmentFlag alignment, const QString &strID)
+{
+    /* Remove record unless Qt::AlignTop specified separately: */
+    switch (alignment)
+    {
+        case Qt::AlignTop: setExtraDataString(GUI_MiniToolBarAlignment, gpConverter->toInternalString(MiniToolbarAlignment_Top), strID); return;
+        default: break;
+    }
+    setExtraDataString(GUI_MiniToolBarAlignment, QString(), strID);
+}
+#endif /* Q_WS_MAC */
+
+bool UIExtraDataManager::statusBarEnabled(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_StatusBar_Enabled, strID);
+}
+
+void UIExtraDataManager::setStatusBarEnabled(bool fEnabled, const QString &strID)
+{
+    /* 'False' if feature restricted, null-string otherwise: */
+    setExtraDataString(GUI_StatusBar_Enabled, toFeatureRestricted(!fEnabled), strID);
+}
+
+QList<IndicatorType> UIExtraDataManager::restrictedStatusBarIndicators(const QString &strID)
+{
+    /* Prepare result: */
+    QList<IndicatorType> result;
+    /* Get restricted status-bar indicators: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedStatusBarIndicators, strID))
+    {
+        const IndicatorType value = gpConverter->fromInternalString<IndicatorType>(strValue);
+        if (value != IndicatorType_Invalid && !result.contains(value))
+            result << value;
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setRestrictedStatusBarIndicators(const QList<IndicatorType> &list, const QString &strID)
+{
+    /* Parse passed list: */
+    QStringList data;
+    foreach (const IndicatorType &indicatorType, list)
+        data << gpConverter->toInternalString(indicatorType);
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(GUI_RestrictedStatusBarIndicators, data, strID);
+}
+
+QList<IndicatorType> UIExtraDataManager::statusBarIndicatorOrder(const QString &strID)
+{
+    /* Prepare result: */
+    QList<IndicatorType> result;
+    /* Get status-bar indicator order: */
+    foreach (const QString &strValue, extraDataStringList(GUI_StatusBar_IndicatorOrder, strID))
+    {
+        const IndicatorType value = gpConverter->fromInternalString<IndicatorType>(strValue);
+        if (value != IndicatorType_Invalid && !result.contains(value))
+            result << value;
+    }
+    /* Return result: */
+    return result;
+}
+
+void UIExtraDataManager::setStatusBarIndicatorOrder(const QList<IndicatorType> &list, const QString &strID)
+{
+    /* Parse passed list: */
+    QStringList data;
+    foreach (const IndicatorType &indicatorType, list)
+        data << gpConverter->toInternalString(indicatorType);
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(GUI_StatusBar_IndicatorOrder, data, strID);
+}
+
+#ifdef Q_WS_MAC
+bool UIExtraDataManager::realtimeDockIconUpdateEnabled(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_RealtimeDockIconUpdateEnabled, strID);
+}
+
+void UIExtraDataManager::setRealtimeDockIconUpdateEnabled(bool fEnabled, const QString &strID)
+{
+    /* 'False' if feature restricted, null-string otherwise: */
+    setExtraDataString(GUI_RealtimeDockIconUpdateEnabled, toFeatureRestricted(!fEnabled), strID);
+}
+
+int UIExtraDataManager::realtimeDockIconUpdateMonitor(const QString &strID)
+{
+    return extraDataString(GUI_RealtimeDockIconUpdateMonitor, strID).toInt();
+}
+
+void UIExtraDataManager::setRealtimeDockIconUpdateMonitor(int iIndex, const QString &strID)
+{
+    setExtraDataString(GUI_RealtimeDockIconUpdateMonitor, iIndex ? QString::number(iIndex) : QString(), strID);
+}
+#endif /* Q_WS_MAC */
+
+bool UIExtraDataManager::passCADtoGuest(const QString &strID)
+{
+    /* 'False' unless feature allowed: */
+    return isFeatureAllowed(GUI_PassCAD, strID);
+}
+
+MouseCapturePolicy UIExtraDataManager::mouseCapturePolicy(const QString &strID)
+{
+    return gpConverter->fromInternalString<MouseCapturePolicy>(extraDataString(GUI_MouseCapturePolicy, strID));
+}
+
+GuruMeditationHandlerType UIExtraDataManager::guruMeditationHandlerType(const QString &strID)
+{
+    return gpConverter->fromInternalString<GuruMeditationHandlerType>(extraDataString(GUI_GuruMeditationHandler, strID));
+}
+
+bool UIExtraDataManager::hidLedsSyncState(const QString &strID)
+{
+    /* 'True' unless feature restricted: */
+    return !isFeatureRestricted(GUI_HidLedsSync, strID);
+}
+
+double UIExtraDataManager::scaleFactor(const QString &strID)
+{
+    /* Get corresponding extra-data value: */
+    const QString strValue = extraDataString(GUI_ScaleFactor, strID);
+
+    /* Try to convert loaded data to double: */
+    bool fOk = false;
+    double dValue = strValue.toDouble(&fOk);
+
+    /* Invent the default value: */
+    if (!fOk || !dValue)
+        dValue = 1;
+
+    /* Return value: */
+    return dValue;
+}
+
+void UIExtraDataManager::setScaleFactor(double dScaleFactor, const QString &strID)
+{
+    /* Set corresponding extra-data value: */
+    setExtraDataString(GUI_ScaleFactor, QString::number(dScaleFactor), strID);
+}
+
+ScalingOptimizationType UIExtraDataManager::scalingOptimizationType(const QString &strID)
+{
+    return gpConverter->fromInternalString<ScalingOptimizationType>(extraDataString(GUI_Scaling_Optimization, strID));
+}
+
+QRect UIExtraDataManager::informationWindowGeometry(QWidget *pWidget, QWidget *pParentWidget, const QString &strID)
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_InformationWindowGeometry, strID);
+
+    /* Parse loaded data: */
+    int iX = 0, iY = 0, iW = 0, iH = 0;
+    bool fOk = data.size() >= 4;
+    do
+    {
+        if (!fOk) break;
+        iX = data[0].toInt(&fOk);
+        if (!fOk) break;
+        iY = data[1].toInt(&fOk);
+        if (!fOk) break;
+        iW = data[2].toInt(&fOk);
+        if (!fOk) break;
+        iH = data[3].toInt(&fOk);
+    }
+    while (0);
+
+    /* Use geometry (loaded or default): */
+    QRect geometry = fOk ? QRect(iX, iY, iW, iH) : QRect(0, 0, 600, 450);
+
+    /* Take hint-widget into account: */
+    if (pWidget)
+        geometry.setSize(geometry.size().expandedTo(pWidget->minimumSizeHint()));
+
+    /* Get screen-geometry [of screen with point (iX, iY) if possible]: */
+    const QRect screenGeometry = fOk ? QApplication::desktop()->availableGeometry(QPoint(iX, iY)) :
+                                       QApplication::desktop()->availableGeometry();
+
+    /* Make sure resulting geometry is within current bounds: */
+    geometry = geometry.intersected(screenGeometry);
+
+    /* Move default-geometry to pParentWidget' geometry center: */
+    if (!fOk && pParentWidget)
+        geometry.moveCenter(pParentWidget->geometry().center());
+
+    /* Return result: */
+    return geometry;
+}
+
+bool UIExtraDataManager::informationWindowShouldBeMaximized(const QString &strID)
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_InformationWindowGeometry, strID);
+
+    /* Make sure 5th item has required value: */
+    return data.size() == 5 && data[4] == GUI_Geometry_State_Max;
+}
+
+void UIExtraDataManager::setInformationWindowGeometry(const QRect &geometry, bool fMaximized, const QString &strID)
+{
+    /* Serialize passed values: */
+    QStringList data;
+    data << QString::number(geometry.x());
+    data << QString::number(geometry.y());
+    data << QString::number(geometry.width());
+    data << QString::number(geometry.height());
+    if (fMaximized)
+        data << GUI_Geometry_State_Max;
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(GUI_InformationWindowGeometry, data, strID);
+}
+
+MachineCloseAction UIExtraDataManager::defaultMachineCloseAction(const QString &strID)
+{
+    return gpConverter->fromInternalString<MachineCloseAction>(extraDataString(GUI_DefaultCloseAction, strID));
+}
+
+MachineCloseAction UIExtraDataManager::restrictedMachineCloseActions(const QString &strID)
+{
+    /* Prepare result: */
+    MachineCloseAction result = MachineCloseAction_Invalid;
+    /* Get restricted machine-close-actions: */
+    foreach (const QString &strValue, extraDataStringList(GUI_RestrictedCloseActions, strID))
+    {
+        MachineCloseAction value = gpConverter->fromInternalString<MachineCloseAction>(strValue);
+        if (value != MachineCloseAction_Invalid)
+            result = static_cast<MachineCloseAction>(result | value);
+    }
+    /* Return result: */
+    return result;
+}
+
+MachineCloseAction UIExtraDataManager::lastMachineCloseAction(const QString &strID)
+{
+    return gpConverter->fromInternalString<MachineCloseAction>(extraDataString(GUI_LastCloseAction, strID));
+}
+
+void UIExtraDataManager::setLastMachineCloseAction(MachineCloseAction machineCloseAction, const QString &strID)
+{
+    setExtraDataString(GUI_LastCloseAction, gpConverter->toInternalString(machineCloseAction), strID);
+}
+
+QString UIExtraDataManager::machineCloseHookScript(const QString &strID)
+{
+    return extraDataString(GUI_CloseActionHook, strID);
+}
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+QString UIExtraDataManager::debugFlagValue(const QString &strDebugFlagKey)
+{
+    return extraDataString(strDebugFlagKey).toLower().trimmed();
+}
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef DEBUG
+QRect UIExtraDataManager::extraDataManagerGeometry(QWidget *pWidget)
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_ExtraDataManager_Geometry);
+
+    /* Parse loaded data: */
+    int iX = 0, iY = 0, iW = 0, iH = 0;
+    bool fOk = data.size() >= 4;
+    do
+    {
+        if (!fOk) break;
+        iX = data[0].toInt(&fOk);
+        if (!fOk) break;
+        iY = data[1].toInt(&fOk);
+        if (!fOk) break;
+        iW = data[2].toInt(&fOk);
+        if (!fOk) break;
+        iH = data[3].toInt(&fOk);
+    }
+    while (0);
+
+    /* Use geometry (loaded or default): */
+    QRect geometry = fOk ? QRect(iX, iY, iW, iH) : QRect(0, 0, 800, 600);
+
+    /* Take hint-widget into account: */
+    if (pWidget)
+        geometry.setSize(geometry.size().expandedTo(pWidget->minimumSizeHint()));
+
+    /* Get screen-geometry [of screen with point (iX, iY) if possible]: */
+    const QRect screenGeometry = fOk ? QApplication::desktop()->availableGeometry(QPoint(iX, iY)) :
+                                       QApplication::desktop()->availableGeometry();
+
+    /* Make sure resulting geometry is within current bounds: */
+    geometry = geometry.intersected(screenGeometry);
+
+    /* Move default-geometry to current screen center: */
+    if (!fOk)
+        geometry.moveCenter(screenGeometry.center());
+
+    /* Return result: */
+    return geometry;
+}
+
+bool UIExtraDataManager::extraDataManagerShouldBeMaximized()
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_ExtraDataManager_Geometry);
+
+    /* Make sure 5th item has required value: */
+    return data.size() == 5 && data[4] == GUI_Geometry_State_Max;
+}
+
+void UIExtraDataManager::setExtraDataManagerGeometry(const QRect &geometry, bool fMaximized)
+{
+    /* Serialize passed values: */
+    QStringList data;
+    data << QString::number(geometry.x());
+    data << QString::number(geometry.y());
+    data << QString::number(geometry.width());
+    data << QString::number(geometry.height());
+    if (fMaximized)
+        data << GUI_Geometry_State_Max;
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(GUI_ExtraDataManager_Geometry, data);
+}
+
+QList<int> UIExtraDataManager::extraDataManagerSplitterHints(QWidget *pWidget)
+{
+    /* Get corresponding extra-data: */
+    const QStringList data = extraDataStringList(GUI_ExtraDataManager_SplitterHints);
+
+    /* Parse loaded data: */
+    int iLeft = 0, iRight = 0;
+    bool fOk = data.size() == 2;
+    do
+    {
+        if (!fOk) break;
+        iLeft = data[0].toInt(&fOk);
+        if (!fOk) break;
+        iRight = data[1].toInt(&fOk);
+    }
+    while (0);
+
+    /* Prepare hints (loaded or adviced): */
+    QList<int> hints;
+    if (fOk)
+    {
+        hints << iLeft;
+        hints << iRight;
+    }
+    else
+    {
+        hints << pWidget->width() * .9 * (1.0 / 3);
+        hints << pWidget->width() * .9 * (2.0 / 3);
+    }
+
+    /* Return hints: */
+    return hints;
+}
+
+void UIExtraDataManager::setExtraDataManagerSplitterHints(const QList<int> &hints)
+{
+    /* Parse passed hints: */
+    QStringList data;
+    data << (hints.size() > 0 ? QString::number(hints[0]) : QString());
+    data << (hints.size() > 1 ? QString::number(hints[1]) : QString());
+
+    /* Re-cache corresponding extra-data: */
+    setExtraDataStringList(GUI_ExtraDataManager_SplitterHints, data);
+}
+#endif /* DEBUG */
+
+void UIExtraDataManager::sltExtraDataChange(QString strMachineID, QString strKey, QString strValue)
+{
+    /* Re-cache value only if strMachineID known already: */
+    if (m_data.contains(strMachineID))
+    {
+        if (!strValue.isEmpty())
+            m_data[strMachineID][strKey] = strValue;
+        else
+            m_data[strMachineID].remove(strKey);
+    }
+
+    /* Global extra-data 'change' event: */
+    if (strMachineID == GlobalID)
+    {
+        if (strKey.startsWith("GUI/"))
+        {
+            /* Language changed? */
+            if (strKey == GUI_LanguageId)
+                emit sigLanguageChange(extraDataString(strKey));
+            /* Selector UI shortcut changed? */
+            else if (strKey == GUI_Input_SelectorShortcuts)
+                emit sigSelectorUIShortcutChange();
+            /* Runtime UI shortcut changed? */
+            else if (strKey == GUI_Input_MachineShortcuts)
+                emit sigRuntimeUIShortcutChange();
+        }
+    }
+    /* Machine extra-data 'change' event: */
+    else
+    {
+        /* Current VM only: */
+        if (   vboxGlobal().isVMConsoleProcess()
+            && strMachineID == vboxGlobal().managedVMUuid())
+        {
+            /* HID LEDs sync state changed (allowed if not restricted)? */
+            if (strKey == GUI_HidLedsSync)
+                emit sigHidLedsSyncStateChange(!isFeatureRestricted(strKey, strMachineID));
+#ifdef Q_WS_MAC
+            /* 'Dock icon' appearance changed (allowed if not restricted)? */
+            else if (   strKey == GUI_RealtimeDockIconUpdateEnabled
+                     || strKey == GUI_RealtimeDockIconUpdateMonitor)
+                emit sigDockIconAppearanceChange(!isFeatureRestricted(strKey, strMachineID));
+#endif /* Q_WS_MAC */
+        }
+
+        /* Menu-bar configuration change: */
+        if (
+#ifndef Q_WS_MAC
+            strKey == GUI_MenuBar_Enabled ||
+#endif /* !Q_WS_MAC */
+            strKey == GUI_RestrictedRuntimeMenus ||
+            strKey == GUI_RestrictedRuntimeApplicationMenuActions ||
+            strKey == GUI_RestrictedRuntimeMachineMenuActions ||
+            strKey == GUI_RestrictedRuntimeViewMenuActions ||
+            strKey == GUI_RestrictedRuntimeInputMenuActions ||
+            strKey == GUI_RestrictedRuntimeDevicesMenuActions ||
+#ifdef VBOX_WITH_DEBUGGER_GUI
+            strKey == GUI_RestrictedRuntimeDebuggerMenuActions ||
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+            strKey == GUI_RestrictedRuntimeWindowMenuActions ||
+#endif /* Q_WS_MAC */
+            strKey == GUI_RestrictedRuntimeHelpMenuActions)
+            emit sigMenuBarConfigurationChange(strMachineID);
+        /* Status-bar configuration change: */
+        else if (strKey == GUI_StatusBar_Enabled ||
+                 strKey == GUI_RestrictedStatusBarIndicators ||
+                 strKey == GUI_StatusBar_IndicatorOrder)
+            emit sigStatusBarConfigurationChange(strMachineID);
+        /* Scale-factor change: */
+        else if (strKey == GUI_ScaleFactor)
+            emit sigScaleFactorChange(strMachineID);
+        /* Scaling optimization type change: */
+        else if (strKey == GUI_Scaling_Optimization)
+            emit sigScalingOptimizationTypeChange(strMachineID);
+        /* HiDPI optimization type change: */
+        else if (strKey == GUI_HiDPI_Optimization)
+            emit sigHiDPIOptimizationTypeChange(strMachineID);
+        /* Unscaled HiDPI Output mode change: */
+        else if (strKey == GUI_HiDPI_UnscaledOutput)
+            emit sigUnscaledHiDPIOutputModeChange(strMachineID);
+    }
+
+    /* Notify listeners: */
+    emit sigExtraDataChange(strMachineID, strKey, strValue);
+}
+
+void UIExtraDataManager::prepare()
+{
+    /* Prepare global extra-data map: */
+    prepareGlobalExtraDataMap();
+    /* Prepare extra-data event-handler: */
+    prepareExtraDataEventHandler();
+}
+
+void UIExtraDataManager::prepareGlobalExtraDataMap()
+{
+    /* Get CVirtualBox: */
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+
+    /* Make sure at least empty map is created: */
+    m_data[GlobalID] = ExtraDataMap();
+
+    /* Load global extra-data map: */
+    foreach (const QString &strKey, vbox.GetExtraDataKeys())
+        m_data[GlobalID][strKey] = vbox.GetExtraData(strKey);
+}
+
+void UIExtraDataManager::prepareExtraDataEventHandler()
+{
+    /* Create extra-data event-handler: */
+    m_pHandler = new UIExtraDataEventHandler(this);
+    /* Configure extra-data event-handler: */
+    AssertPtrReturnVoid(m_pHandler);
+    {
+        /* Extra-data change signal: */
+        connect(m_pHandler, SIGNAL(sigExtraDataChange(QString, QString, QString)),
+                this, SLOT(sltExtraDataChange(QString, QString, QString)),
+                Qt::QueuedConnection);
+
+        /* Prepare Main event-listener: */
+        prepareMainEventListener();
+    }
+}
+
+void UIExtraDataManager::prepareMainEventListener()
+{
+    /* Register Main event-listener:  */
+    const CVirtualBox vbox = vboxGlobal().virtualBox();
+    ComObjPtr<UIMainEventListenerImpl> pListener;
+    pListener.createObject();
+    pListener->init(new UIMainEventListener, this);
+    m_listener = CEventListener(pListener);
+    QVector<KVBoxEventType> events;
+    events
+        << KVBoxEventType_OnExtraDataCanChange
+        << KVBoxEventType_OnExtraDataChanged;
+    vbox.GetEventSource().RegisterListener(m_listener, events, TRUE);
+    AssertWrapperOk(vbox);
+
+    /* This is a vetoable event, so we have to respond to the event and have to use a direct connection therefor: */
+    connect(pListener->getWrapped(), SIGNAL(sigExtraDataCanChange(QString, QString, QString, bool&, QString&)),
+            m_pHandler, SLOT(sltPreprocessExtraDataCanChange(QString, QString, QString, bool&, QString&)),
+            Qt::DirectConnection);
+    /* Use a direct connection to the helper class: */
+    connect(pListener->getWrapped(), SIGNAL(sigExtraDataChange(QString, QString, QString)),
+            m_pHandler, SLOT(sltPreprocessExtraDataChange(QString, QString, QString)),
+            Qt::DirectConnection);
+}
+
+#ifdef DEBUG
+void UIExtraDataManager::cleanupWindow()
+{
+    delete m_pWindow;
+}
+#endif /* DEBUG */
+
+void UIExtraDataManager::cleanupMainEventListener()
+{
+    /* Make sure VBoxSVC is available: */
+    if (!vboxGlobal().isVBoxSVCAvailable())
+        return;
+
+    /* Unregister Main event-listener: */
+    const CVirtualBox vbox = vboxGlobal().virtualBox();
+    vbox.GetEventSource().UnregisterListener(m_listener);
+}
+
+void UIExtraDataManager::cleanup()
+{
+#ifdef DEBUG
+    /* Cleanup window: */
+    cleanupWindow();
+#endif /* DEBUG */
+    /* Cleanup Main event-listener: */
+    cleanupMainEventListener();
+}
+
+#ifdef DEBUG
+void UIExtraDataManager::open(QWidget *pCenterWidget)
+{
+    /* If necessary: */
+    if (!m_pWindow)
+    {
+        /* Create window: */
+        m_pWindow = new UIExtraDataManagerWindow;
+        /* Configure window connections: */
+        connect(this, SIGNAL(sigExtraDataMapAcknowledging(QString)),
+                m_pWindow, SLOT(sltExtraDataMapAcknowledging(QString)));
+        connect(this, SIGNAL(sigExtraDataChange(QString, QString, QString)),
+                m_pWindow, SLOT(sltExtraDataChange(QString, QString, QString)));
+    }
+    /* Show and raise window: */
+    m_pWindow->showAndRaise(pCenterWidget);
+}
+#endif /* DEBUG */
+
+bool UIExtraDataManager::isFeatureAllowed(const QString &strKey, const QString &strID /* = GlobalID */)
+{
+    /* Hot-load machine extra-data map if necessary: */
+    if (strID != GlobalID && !m_data.contains(strID))
+        hotloadMachineExtraDataMap(strID);
+
+    /* Read-only access corresponding map: */
+    const ExtraDataMap data = m_data.value(strID);
+
+    /* 'false' if value was not set: */
+    if (!data.contains(strKey))
+        return false;
+
+    /* Check corresponding value: */
+    const QString &strValue = data[strKey];
+    return    strValue.compare("true", Qt::CaseInsensitive) == 0
+           || strValue.compare("yes", Qt::CaseInsensitive) == 0
+           || strValue.compare("on", Qt::CaseInsensitive) == 0
+           || strValue == "1";
+}
+
+bool UIExtraDataManager::isFeatureRestricted(const QString &strKey, const QString &strID /* = GlobalID */)
+{
+    /* Hot-load machine extra-data map if necessary: */
+    if (strID != GlobalID && !m_data.contains(strID))
+        hotloadMachineExtraDataMap(strID);
+
+    /* Read-only access corresponding map: */
+    const ExtraDataMap data = m_data.value(strID);
+
+    /* 'false' if value was not set: */
+    if (!data.contains(strKey))
+        return false;
+
+    /* Check corresponding value: */
+    const QString &strValue = data[strKey];
+    return    strValue.compare("false", Qt::CaseInsensitive) == 0
+           || strValue.compare("no", Qt::CaseInsensitive) == 0
+           || strValue.compare("off", Qt::CaseInsensitive) == 0
+           || strValue == "0";
+}
+
+QString UIExtraDataManager::toFeatureAllowed(bool fAllowed)
+{
+    return fAllowed ? QString("true") : QString();
+}
+
+QString UIExtraDataManager::toFeatureRestricted(bool fRestricted)
+{
+    return fRestricted ? QString("false") : QString();
+}
+
+/* static */
+QString UIExtraDataManager::extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex, bool fSameRuleForPrimary /* = false */)
+{
+    return fSameRuleForPrimary || uScreenIndex ? strBase + QString::number(uScreenIndex) : strBase;
+}
+
+#include "UIExtraDataManager.moc"
+
diff --git a/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
new file mode 100644
index 0000000..c8e88a5
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
@@ -0,0 +1,607 @@
+/* $Id: UIExtraDataManager.h $ */
+/** @file
+ * VBox Qt GUI - UIExtraDataManager class declaration.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIExtraDataManager_h___
+#define ___UIExtraDataManager_h___
+
+/* Qt includes: */
+#include <QObject>
+#include <QMap>
+#ifdef DEBUG
+# include <QPointer>
+#endif /* DEBUG */
+
+/* GUI includes: */
+#include "UIExtraDataDefs.h"
+
+/* COM includes: */
+#include "CEventListener.h"
+
+/* Forward declarations: */
+class UIExtraDataEventHandler;
+#ifdef DEBUG
+class UIExtraDataManagerWindow;
+#endif /* DEBUG */
+
+/* Type definitions: */
+typedef QMap<QString, QString> ExtraDataMap;
+
+/** Singleton QObject extension
+  * providing GUI with corresponding extra-data values,
+  * and notifying it whenever any of those values changed. */
+class UIExtraDataManager : public QObject
+{
+    Q_OBJECT;
+
+    /** Extra-data Manager constructor. */
+    UIExtraDataManager();
+    /** Extra-data Manager destructor. */
+    ~UIExtraDataManager();
+
+signals:
+
+    /** Notifies about extra-data map acknowledging. */
+    void sigExtraDataMapAcknowledging(QString strID);
+
+    /** Notifies about extra-data change. */
+    void sigExtraDataChange(QString strID, QString strKey, QString strValue);
+
+    /** Notifies about GUI language change. */
+    void sigLanguageChange(QString strLanguage);
+
+    /** Notifies about Selector UI keyboard shortcut change. */
+    void sigSelectorUIShortcutChange();
+    /** Notifies about Runtime UI keyboard shortcut change. */
+    void sigRuntimeUIShortcutChange();
+
+    /** Notifies about menu-bar configuration change. */
+    void sigMenuBarConfigurationChange(const QString &strMachineID);
+    /** Notifies about status-bar configuration change. */
+    void sigStatusBarConfigurationChange(const QString &strMachineID);
+
+    /** Notifies about HID LEDs synchronization state change. */
+    void sigHidLedsSyncStateChange(bool fEnabled);
+
+    /** Notifies about the scale-factor change. */
+    void sigScaleFactorChange(const QString &strMachineID);
+
+    /** Notifies about the scaling optimization type change. */
+    void sigScalingOptimizationTypeChange(const QString &strMachineID);
+
+    /** Notifies about the HiDPI optimization type change. */
+    void sigHiDPIOptimizationTypeChange(const QString &strMachineID);
+
+    /** Notifies about unscaled HiDPI output mode change. */
+    void sigUnscaledHiDPIOutputModeChange(const QString &strMachineID);
+
+#ifdef RT_OS_DARWIN
+    /** Mac OS X: Notifies about 'dock icon' appearance change. */
+    void sigDockIconAppearanceChange(bool fEnabled);
+#endif /* RT_OS_DARWIN */
+
+public:
+
+    /** Global extra-data ID. */
+    static const QString GlobalID;
+
+    /** Static Extra-data Manager instance/constructor. */
+    static UIExtraDataManager* instance();
+    /** Static Extra-data Manager destructor. */
+    static void destroy();
+
+#ifdef DEBUG
+    /** Static show and raise API. */
+    static void openWindow(QWidget *pCenterWidget);
+#endif /* DEBUG */
+
+    /** @name General
+      * @{ */
+        /** Returns whether Extra-data Manager cached the map with passed @a strID. */
+        bool contains(const QString &strID) const { return m_data.contains(strID); }
+        /** Returns read-only extra-data map for passed @a strID. */
+        const ExtraDataMap map(const QString &strID) const { return m_data.value(strID); }
+
+        /** Hot-load machine extra-data map. */
+        void hotloadMachineExtraDataMap(const QString &strID);
+
+        /** Returns extra-data value corresponding to passed @a strKey as QString.
+          * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
+        QString extraDataString(const QString &strKey, const QString &strID = GlobalID);
+        /** Defines extra-data value corresponding to passed @a strKey as strValue.
+          * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
+        void setExtraDataString(const QString &strKey, const QString &strValue, const QString &strID = GlobalID);
+
+        /** Returns extra-data value corresponding to passed @a strKey as QStringList.
+          * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
+        QStringList extraDataStringList(const QString &strKey, const QString &strID = GlobalID);
+        /** Defines extra-data value corresponding to passed @a strKey as value.
+          * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
+        void setExtraDataStringList(const QString &strKey, const QStringList &value, const QString &strID = GlobalID);
+    /** @} */
+
+    /** @name Messaging
+      * @{ */
+        /** Returns the list of supressed messages for the Message/Popup center frameworks. */
+        QStringList suppressedMessages();
+        /** Defines the @a list of supressed messages for the Message/Popup center frameworks. */
+        void setSuppressedMessages(const QStringList &list);
+
+        /** Returns the list of messages for the Message/Popup center frameworks with inverted check-box state. */
+        QStringList messagesWithInvertedOption();
+
+#if !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG)
+        /** Returns version for which user wants to prevent BETA build warning. */
+        QString preventBetaBuildWarningForVersion();
+#endif /* !defined(VBOX_BLEEDING_EDGE) && !defined(DEBUG) */
+    /** @} */
+
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    /** @name Application Update
+      * @{ */
+        /** Returns whether Application Update functionality enabled. */
+        bool applicationUpdateEnabled();
+
+        /** Returns Application Update data. */
+        QString applicationUpdateData();
+        /** Defines Application Update data as @a strValue. */
+        void setApplicationUpdateData(const QString &strValue);
+
+        /** Returns Application Update check counter. */
+        qulonglong applicationUpdateCheckCounter();
+        /** Increments Application Update check counter. */
+        void incrementApplicationUpdateCheckCounter();
+    /** @} */
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+
+    /** @name Settings
+      * @{ */
+        /** Returns restricted global settings pages. */
+        QList<GlobalSettingsPageType> restrictedGlobalSettingsPages();
+        /** Returns restricted machine settings pages. */
+        QList<MachineSettingsPageType> restrictedMachineSettingsPages(const QString &strID);
+    /** @} */
+
+    /** @name Settings: Display
+      * @{ */
+        /** Returns whether hovered machine-window should be activated. */
+        bool activateHoveredMachineWindow();
+        /** Defines whether hovered machine-window should be @a fActivated. */
+        void setActivateHoveredMachineWindow(bool fActivate);
+    /** @} */
+
+    /** @name Settings: Keyboard
+      * @{ */
+        /** Returns shortcut overrides for shortcut-pool with @a strPoolExtraDataID. */
+        QStringList shortcutOverrides(const QString &strPoolExtraDataID);
+    /** @} */
+
+    /** @name Settings: Storage
+      * @{ */
+        /** Returns recent folder for hard-drives. */
+        QString recentFolderForHardDrives();
+        /** Returns recent folder for optical-disks. */
+        QString recentFolderForOpticalDisks();
+        /** Returns recent folder for floppy-disks. */
+        QString recentFolderForFloppyDisks();
+        /** Defines recent folder for hard-drives as @a strValue. */
+        void setRecentFolderForHardDrives(const QString &strValue);
+        /** Defines recent folder for optical-disk as @a strValue. */
+        void setRecentFolderForOpticalDisks(const QString &strValue);
+        /** Defines recent folder for floppy-disk as @a strValue. */
+        void setRecentFolderForFloppyDisks(const QString &strValue);
+
+        /** Returns the list of recently used hard-drives. */
+        QStringList recentListOfHardDrives();
+        /** Returns the list of recently used optical-disk. */
+        QStringList recentListOfOpticalDisks();
+        /** Returns the list of recently used floppy-disk. */
+        QStringList recentListOfFloppyDisks();
+        /** Defines the list of recently used hard-drives as @a value. */
+        void setRecentListOfHardDrives(const QStringList &value);
+        /** Defines the list of recently used optical-disks as @a value. */
+        void setRecentListOfOpticalDisks(const QStringList &value);
+        /** Defines the list of recently used floppy-disks as @a value. */
+        void setRecentListOfFloppyDisks(const QStringList &value);
+    /** @} */
+
+    /** @name VirtualBox Manager
+      * @{ */
+        /** Returns selector-window geometry using @a pWidget as the hint. */
+        QRect selectorWindowGeometry(QWidget *pWidget);
+        /** Returns whether selector-window should be maximized. */
+        bool selectorWindowShouldBeMaximized();
+        /** Defines selector-window @a geometry and @a fMaximized state. */
+        void setSelectorWindowGeometry(const QRect &geometry, bool fMaximized);
+
+        /** Returns selector-window splitter hints. */
+        QList<int> selectorWindowSplitterHints();
+        /** Defines selector-window splitter @a hints. */
+        void setSelectorWindowSplitterHints(const QList<int> &hints);
+
+        /** Returns whether selector-window tool-bar visible. */
+        bool selectorWindowToolBarVisible();
+        /** Defines whether selector-window tool-bar @a fVisible. */
+        void setSelectorWindowToolBarVisible(bool fVisible);
+
+        /** Returns whether selector-window status-bar visible. */
+        bool selectorWindowStatusBarVisible();
+        /** Defines whether selector-window status-bar @a fVisible. */
+        void setSelectorWindowStatusBarVisible(bool fVisible);
+
+        /** Clears all the existing selector-window chooser-pane' group definitions. */
+        void clearSelectorWindowGroupsDefinitions();
+        /** Returns selector-window chooser-pane' groups definitions for passed @a strGroupID. */
+        QStringList selectorWindowGroupsDefinitions(const QString &strGroupID);
+        /** Defines selector-window chooser-pane' groups @a definitions for passed @a strGroupID. */
+        void setSelectorWindowGroupsDefinitions(const QString &strGroupID, const QStringList &definitions);
+
+        /** Returns last-item ID of the item chosen in selector-window chooser-pane. */
+        QString selectorWindowLastItemChosen();
+        /** Defines @a lastItemID of the item chosen in selector-window chooser-pane. */
+        void setSelectorWindowLastItemChosen(const QString &strItemID);
+
+        /** Returns selector-window details-pane' elements. */
+        QMap<DetailsElementType, bool> selectorWindowDetailsElements();
+        /** Defines selector-window details-pane' @a elements. */
+        void setSelectorWindowDetailsElements(const QMap<DetailsElementType, bool> &elements);
+
+        /** Returns selector-window details-pane' preview update interval. */
+        PreviewUpdateIntervalType selectorWindowPreviewUpdateInterval();
+        /** Defines selector-window details-pane' preview update @a interval. */
+        void setSelectorWindowPreviewUpdateInterval(PreviewUpdateIntervalType interval);
+    /** @} */
+
+    /** @name Wizards
+      * @{ */
+        /** Returns mode for wizard of passed @a type. */
+        WizardMode modeForWizardType(WizardType type);
+        /** Defines @a mode for wizard of passed @a type. */
+        void setModeForWizardType(WizardType type, WizardMode mode);
+    /** @} */
+
+    /** @name Virtual Machine
+      * @{ */
+        /** Returns whether machine should be shown in selector-window chooser-pane. */
+        bool showMachineInSelectorChooser(const QString &strID);
+        /** Returns whether machine should be shown in selector-window details-pane. */
+        bool showMachineInSelectorDetails(const QString &strID);
+
+        /** Returns whether machine reconfiguration enabled. */
+        bool machineReconfigurationEnabled(const QString &strID);
+        /** Returns whether machine snapshot operations enabled. */
+        bool machineSnapshotOperationsEnabled(const QString &strID);
+
+        /** Returns whether this machine is first time started. */
+        bool machineFirstTimeStarted(const QString &strID);
+        /** Returns whether this machine is fFirstTimeStarted. */
+        void setMachineFirstTimeStarted(bool fFirstTimeStarted, const QString &strID);
+
+#ifndef Q_WS_MAC
+        /** Except Mac OS X: Returns redefined machine-window icon names. */
+        QStringList machineWindowIconNames(const QString &strID);
+        /** Except Mac OS X: Returns redefined machine-window name postfix. */
+        QString machineWindowNamePostfix(const QString &strID);
+#endif /* !Q_WS_MAC */
+
+        /** Returns geometry for machine-window with @a uScreenIndex in @a visualStateType. */
+        QRect machineWindowGeometry(UIVisualStateType visualStateType, ulong uScreenIndex, const QString &strID);
+        /** Returns whether machine-window with @a uScreenIndex in @a visualStateType should be maximized. */
+        bool machineWindowShouldBeMaximized(UIVisualStateType visualStateType, ulong uScreenIndex, const QString &strID);
+        /** Defines @a geometry and @a fMaximized state for machine-window with @a uScreenIndex in @a visualStateType. */
+        void setMachineWindowGeometry(UIVisualStateType visualStateType, ulong uScreenIndex, const QRect &geometry, bool fMaximized, const QString &strID);
+
+#ifndef Q_WS_MAC
+        /** Returns whether Runtime UI menu-bar is enabled. */
+        bool menuBarEnabled(const QString &strID);
+        /** Defines whether Runtime UI menu-bar is @a fEnabled. */
+        void setMenuBarEnabled(bool fEnabled, const QString &strID);
+#endif /* !Q_WS_MAC */
+
+        /** Returns restricted Runtime UI menu types. */
+        UIExtraDataMetaDefs::MenuType restrictedRuntimeMenuTypes(const QString &strID);
+        /** Defines restricted Runtime UI menu types. */
+        void setRestrictedRuntimeMenuTypes(UIExtraDataMetaDefs::MenuType types, const QString &strID);
+
+        /** Returns restricted Runtime UI action types for Application menu. */
+        UIExtraDataMetaDefs::MenuApplicationActionType restrictedRuntimeMenuApplicationActionTypes(const QString &strID);
+        /** Defines restricted Runtime UI action types for Application menu. */
+        void setRestrictedRuntimeMenuApplicationActionTypes(UIExtraDataMetaDefs::MenuApplicationActionType types, const QString &strID);
+
+        /** Returns restricted Runtime UI action types for Machine menu. */
+        UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictedRuntimeMenuMachineActionTypes(const QString &strID);
+        /** Defines restricted Runtime UI action types for Machine menu. */
+        void setRestrictedRuntimeMenuMachineActionTypes(UIExtraDataMetaDefs::RuntimeMenuMachineActionType types, const QString &strID);
+
+        /** Returns restricted Runtime UI action types for View menu. */
+        UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictedRuntimeMenuViewActionTypes(const QString &strID);
+        /** Defines restricted Runtime UI action types for View menu. */
+        void setRestrictedRuntimeMenuViewActionTypes(UIExtraDataMetaDefs::RuntimeMenuViewActionType types, const QString &strID);
+
+        /** Returns restricted Runtime UI action types for Input menu. */
+        UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictedRuntimeMenuInputActionTypes(const QString &strID);
+        /** Defines restricted Runtime UI action types for Input menu. */
+        void setRestrictedRuntimeMenuInputActionTypes(UIExtraDataMetaDefs::RuntimeMenuInputActionType types, const QString &strID);
+
+        /** Returns restricted Runtime UI action types for Devices menu. */
+        UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictedRuntimeMenuDevicesActionTypes(const QString &strID);
+        /** Defines restricted Runtime UI action types for Devices menu. */
+        void setRestrictedRuntimeMenuDevicesActionTypes(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType types, const QString &strID);
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+        /** Returns restricted Runtime UI action types for Debugger menu. */
+        UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictedRuntimeMenuDebuggerActionTypes(const QString &strID);
+        /** Defines restricted Runtime UI action types for Debugger menu. */
+        void setRestrictedRuntimeMenuDebuggerActionTypes(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType types, const QString &strID);
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef Q_WS_MAC
+        /** Mac OS X: Returns restricted Runtime UI action types for Window menu. */
+        UIExtraDataMetaDefs::MenuWindowActionType restrictedRuntimeMenuWindowActionTypes(const QString &strID);
+        /** Mac OS X: Defines restricted Runtime UI action types for Window menu. */
+        void setRestrictedRuntimeMenuWindowActionTypes(UIExtraDataMetaDefs::MenuWindowActionType types, const QString &strID);
+#endif /* Q_WS_MAC */
+
+        /** Returns restricted Runtime UI action types for Help menu. */
+        UIExtraDataMetaDefs::MenuHelpActionType restrictedRuntimeMenuHelpActionTypes(const QString &strID);
+        /** Defines restricted Runtime UI action types for Help menu. */
+        void setRestrictedRuntimeMenuHelpActionTypes(UIExtraDataMetaDefs::MenuHelpActionType types, const QString &strID);
+
+        /** Returns restricted Runtime UI visual-states. */
+        UIVisualStateType restrictedVisualStates(const QString &strID);
+
+        /** Returns requested Runtime UI visual-state. */
+        UIVisualStateType requestedVisualState(const QString &strID);
+        /** Defines requested Runtime UI visual-state as @a visualState. */
+        void setRequestedVisualState(UIVisualStateType visualState, const QString &strID);
+
+#ifdef Q_WS_X11
+        /** Returns whether legacy full-screen mode is requested. */
+        bool legacyFullscreenModeRequested();
+#endif /* Q_WS_X11 */
+
+        /** Returns whether guest-screen auto-resize according machine-window size is enabled. */
+        bool guestScreenAutoResizeEnabled(const QString &strID);
+        /** Defines whether guest-screen auto-resize according machine-window size is @a fEnabled. */
+        void setGuestScreenAutoResizeEnabled(bool fEnabled, const QString &strID);
+
+        /** Returns last guest-screen size-hint for screen with @a uScreenIndex. */
+        QSize lastGuestSizeHint(ulong uScreenIndex, const QString &strID);
+        /** Defines last guest-screen @a sizeHint for screen with @a uScreenIndex. */
+        void setLastGuestSizeHint(ulong uScreenIndex, const QSize &sizeHint, const QString &strID);
+        /** Returns whether guest size-hint was for full or seamless screen with @a uScreenIndex. */
+        bool wasLastGuestSizeHintForFullScreen(ulong uScreenIndex, const QString &strID);
+        /** Defines whether guest size-hint @a fWas for full or seamless screen with @a uScreenIndex. */
+        void markLastGuestSizeHintAsFullScreen(ulong uScreenIndex, bool fWas, const QString &strID);
+
+        /** Returns host-screen index corresponding to passed guest-screen @a iGuestScreenIndex. */
+        int hostScreenForPassedGuestScreen(int iGuestScreenIndex, const QString &strID);
+        /** Defines @a iHostScreenIndex corresponding to passed guest-screen @a iGuestScreenIndex. */
+        void setHostScreenForPassedGuestScreen(int iGuestScreenIndex, int iHostScreenIndex, const QString &strID);
+
+        /** Returns whether automatic mounting/unmounting of guest-screens enabled. */
+        bool autoMountGuestScreensEnabled(const QString &strID);
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+        /** Returns whether 2D acceleration should use linear sretch. */
+        bool useLinearStretch(const QString &strID);
+        /** Returns whether 2D acceleration should use YV12 pixel format. */
+        bool usePixelFormatYV12(const QString &strID);
+        /** Returns whether 2D acceleration should use UYVY pixel format. */
+        bool usePixelFormatUYVY(const QString &strID);
+        /** Returns whether 2D acceleration should use YUY2 pixel format. */
+        bool usePixelFormatYUY2(const QString &strID);
+        /** Returns whether 2D acceleration should use AYUV pixel format. */
+        bool usePixelFormatAYUV(const QString &strID);
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+
+        /** Returns whether Runtime UI should use unscaled HiDPI output. */
+        bool useUnscaledHiDPIOutput(const QString &strID);
+        /** Defines whether Runtime UI should @a fUseUnscaledHiDPIOutput. */
+        void setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput, const QString &strID);
+
+        /** Returns Runtime UI HiDPI optimization type. */
+        HiDPIOptimizationType hiDPIOptimizationType(const QString &strID);
+
+#ifndef Q_WS_MAC
+        /** Returns whether mini-toolbar is enabled for full and seamless screens. */
+        bool miniToolbarEnabled(const QString &strID);
+        /** Defines whether mini-toolbar is @a fEnabled for full and seamless screens. */
+        void setMiniToolbarEnabled(bool fEnabled, const QString &strID);
+
+        /** Returns whether mini-toolbar should auto-hide itself. */
+        bool autoHideMiniToolbar(const QString &strID);
+        /** Defines whether mini-toolbar should @a fAutoHide itself. */
+        void setAutoHideMiniToolbar(bool fAutoHide, const QString &strID);
+
+        /** Returns mini-toolbar alignment. */
+        Qt::AlignmentFlag miniToolbarAlignment(const QString &strID);
+        /** Returns mini-toolbar @a alignment. */
+        void setMiniToolbarAlignment(Qt::AlignmentFlag alignment, const QString &strID);
+#endif /* Q_WS_MAC */
+
+        /** Returns whether Runtime UI status-bar is enabled. */
+        bool statusBarEnabled(const QString &strID);
+        /** Defines whether Runtime UI status-bar is @a fEnabled. */
+        void setStatusBarEnabled(bool fEnabled, const QString &strID);
+
+        /** Returns restricted Runtime UI status-bar indicator list. */
+        QList<IndicatorType> restrictedStatusBarIndicators(const QString &strID);
+        /** Defines restricted Runtime UI status-bar indicator @a list. */
+        void setRestrictedStatusBarIndicators(const QList<IndicatorType> &list, const QString &strID);
+
+        /** Returns Runtime UI status-bar indicator order list. */
+        QList<IndicatorType> statusBarIndicatorOrder(const QString &strID);
+        /** Defines Runtime UI status-bar indicator order @a list. */
+        void setStatusBarIndicatorOrder(const QList<IndicatorType> &list, const QString &strID);
+
+#ifdef Q_WS_MAC
+        /** Mac OS X: Returns whether Dock icon should be updated at runtime. */
+        bool realtimeDockIconUpdateEnabled(const QString &strID);
+        /** Mac OS X: Defines whether Dock icon update should be fEnabled at runtime. */
+        void setRealtimeDockIconUpdateEnabled(bool fEnabled, const QString &strID);
+
+        /** Mac OS X: Returns guest-screen which Dock icon should reflect at runtime. */
+        int realtimeDockIconUpdateMonitor(const QString &strID);
+        /** Mac OS X: Defines guest-screen @a iIndex which Dock icon should reflect at runtime. */
+        void setRealtimeDockIconUpdateMonitor(int iIndex, const QString &strID);
+#endif /* Q_WS_MAC */
+
+        /** Returns whether machine should pass CAD to guest. */
+        bool passCADtoGuest(const QString &strID);
+
+        /** Returns the mouse-capture policy. */
+        MouseCapturePolicy mouseCapturePolicy(const QString &strID);
+
+        /** Returns redefined guru-meditation handler type. */
+        GuruMeditationHandlerType guruMeditationHandlerType(const QString &strID);
+
+        /** Returns whether machine should perform HID LEDs synchronization. */
+        bool hidLedsSyncState(const QString &strID);
+
+        /** Returns the scale-factor. */
+        double scaleFactor(const QString &strID);
+        /** Defines the @a dScaleFactor. */
+        void setScaleFactor(double dScaleFactor, const QString &strID);
+
+        /** Returns the scaling optimization type. */
+        ScalingOptimizationType scalingOptimizationType(const QString &strID);
+    /** @} */
+
+    /** @name Virtual Machine: Information dialog
+      * @{ */
+        /** Returns information-window geometry using @a pWidget and @a pParentWidget as hints. */
+        QRect informationWindowGeometry(QWidget *pWidget, QWidget *pParentWidget, const QString &strID);
+        /** Returns whether information-window should be maximized or not. */
+        bool informationWindowShouldBeMaximized(const QString &strID);
+        /** Defines information-window @a geometry and @a fMaximized state. */
+        void setInformationWindowGeometry(const QRect &geometry, bool fMaximized, const QString &strID);
+    /** @} */
+
+    /** @name Virtual Machine: Close dialog
+      * @{ */
+        /** Returns default machine close action. */
+        MachineCloseAction defaultMachineCloseAction(const QString &strID);
+        /** Returns restricted machine close actions. */
+        MachineCloseAction restrictedMachineCloseActions(const QString &strID);
+
+        /** Returns last machine close action. */
+        MachineCloseAction lastMachineCloseAction(const QString &strID);
+        /** Defines last @a machineCloseAction. */
+        void setLastMachineCloseAction(MachineCloseAction machineCloseAction, const QString &strID);
+
+        /** Returns machine close hook script name as simple string. */
+        QString machineCloseHookScript(const QString &strID);
+    /** @} */
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** @name Virtual Machine: Debug UI
+      * @{ */
+        /** Returns debug flag value for passed @a strDebugFlagKey. */
+        QString debugFlagValue(const QString &strDebugFlagKey);
+    /** @} */
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef DEBUG
+    /** @name VirtualBox: Extra-data Manager window
+      * @{ */
+        /** Returns Extra-data Manager geometry using @a pWidget as hint. */
+        QRect extraDataManagerGeometry(QWidget *pWidget);
+        /** Returns whether Extra-data Manager should be maximized or not. */
+        bool extraDataManagerShouldBeMaximized();
+        /** Defines Extra-data Manager @a geometry and @a fMaximized state. */
+        void setExtraDataManagerGeometry(const QRect &geometry, bool fMaximized);
+
+        /** Returns Extra-data Manager splitter hints using @a pWidget as hint. */
+        QList<int> extraDataManagerSplitterHints(QWidget *pWidget);
+        /** Defines Extra-data Manager splitter @a hints. */
+        void setExtraDataManagerSplitterHints(const QList<int> &hints);
+    /** @} */
+#endif /* DEBUG */
+
+private slots:
+
+    /** Handles 'extra-data change' event: */
+    void sltExtraDataChange(QString strMachineID, QString strKey, QString strValue);
+
+private:
+
+    /** Prepare Extra-data Manager. */
+    void prepare();
+    /** Prepare global extra-data map. */
+    void prepareGlobalExtraDataMap();
+    /** Prepare extra-data event-handler. */
+    void prepareExtraDataEventHandler();
+    /** Prepare Main event-listener. */
+    void prepareMainEventListener();
+#ifdef DEBUG
+    // /** Prepare window. */
+    // void prepareWindow();
+
+    /** Cleanup window. */
+    void cleanupWindow();
+#endif /* DEBUG */
+    /** Cleanup Main event-listener. */
+    void cleanupMainEventListener();
+    // /** Cleanup extra-data event-handler. */
+    // void cleanupExtraDataEventHandler();
+    // /** Cleanup extra-data map. */
+    // void cleanupExtraDataMap();
+    /** Cleanup Extra-data Manager. */
+    void cleanup();
+
+#ifdef DEBUG
+    /** Open window. */
+    void open(QWidget *pCenterWidget);
+#endif /* DEBUG */
+
+    /** Determines whether feature corresponding to passed @a strKey is allowed.
+      * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
+    bool isFeatureAllowed(const QString &strKey, const QString &strID = GlobalID);
+    /** Determines whether feature corresponding to passed @a strKey is restricted.
+      * If valid @a strID is set => applies to machine extra-data, otherwise => to global one. */
+    bool isFeatureRestricted(const QString &strKey, const QString &strID = GlobalID);
+
+    /** Translates bool flag into 'allowed' value. */
+    QString toFeatureAllowed(bool fAllowed);
+    /** Translates bool flag into 'restricted' value. */
+    QString toFeatureRestricted(bool fRestricted);
+
+    /** Returns string consisting of @a strBase appended with @a uScreenIndex for the *non-primary* screen-index.
+      * If @a fSameRuleForPrimary is 'true' same rule will be used for *primary* screen-index. Used for storing per-screen extra-data. */
+    static QString extraDataKeyPerScreen(const QString &strBase, ulong uScreenIndex, bool fSameRuleForPrimary = false);
+
+    /** Singleton Extra-data Manager instance. */
+    static UIExtraDataManager *m_spInstance;
+
+    /** Holds main event-listener instance. */
+    CEventListener m_listener;
+    /** Holds extra-data event-handler instance. */
+    UIExtraDataEventHandler *m_pHandler;
+
+    /** Holds extra-data map instance. */
+    QMap<QString, ExtraDataMap> m_data;
+
+#ifdef DEBUG
+    /** Holds Extra-data Manager window instance. */
+    QPointer<UIExtraDataManagerWindow> m_pWindow;
+#endif /* DEBUG */
+};
+
+/** Singleton Extra-data Manager 'official' name. */
+#define gEDataManager UIExtraDataManager::instance()
+
+#endif /* !___UIExtraDataManager_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/CIShared.h b/src/VBox/Frontends/VirtualBox/src/globals/CIShared.h
index 1908024..e20f06f 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/CIShared.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/CIShared.h
@@ -1,7 +1,6 @@
+/* $Id: CIShared.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Common VirtualBox classes: CIShared class declaration
+ * VBox Qt GUI - Common VirtualBox classes: CIShared class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp b/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp
index 8559538..b7d0fb2 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.cpp
@@ -1,8 +1,6 @@
 /* $Id: COMDefs.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * CInterface implementation
+ * VBox Qt GUI - CInterface implementation.
  */
 
 /*
@@ -17,27 +15,41 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QObject>
-#include <QSocketNotifier>
+# include <QSocketNotifier>
+
+/* GUI includes: */
+# include "COMDefs.h"
 
 /* COM includes: */
-#include "COMDefs.h"
-#include "UIDefs.h"
-#include "CVirtualBoxErrorInfo.h"
+# include "CVirtualBoxErrorInfo.h"
 
-#if !defined (VBOX_WITH_XPCOM)
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#else /* !defined (VBOX_WITH_XPCOM) */
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
+
+/* Other VBox includes: */
+#include <iprt/log.h>
+
+#ifdef VBOX_WITH_XPCOM
 
 /* Other VBox includes: */
-#include <iprt/env.h>
-#include <iprt/err.h>
-#include <iprt/path.h>
-#include <iprt/param.h>
-#include <nsEventQueueUtils.h>
-#include <nsIEventQueue.h>
-#include <nsIExceptionService.h>
+# include <iprt/env.h>
+# include <iprt/err.h>
+# include <iprt/path.h>
+# include <iprt/param.h>
+# include <nsEventQueueUtils.h>
+# include <nsIEventQueue.h>
+# include <nsIExceptionService.h>
 
 /* Mac OS X (Carbon mode) and OS/2 will notify the native queue
    internally in plevent.c. Because moc doesn't seems to respect
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h b/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h
index 483d48d..4f42574 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/COMDefs.h
@@ -1,7 +1,6 @@
+/* $Id: COMDefs.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Various COM definitions and COM wrapper class declarations
+ * VBox Qt GUI - Various COM definitions and COM wrapper class declarations.
  *
  * This header is used in conjunction with the header generated from
  * XIDL expressed interface definitions to provide cross-platform Qt-based
@@ -99,14 +98,6 @@ class XPCOMEventQSocketListener;
 
 #endif /* !defined(VBOX_WITH_XPCOM) */
 
-
-/* VirtualBox interfaces declarations */
-#if !defined(VBOX_WITH_XPCOM)
-    #include <VirtualBox.h>
-#else /* !defined(VBOX_WITH_XPCOM) */
-    #include <VirtualBox_XPCOM.h>
-#endif /* !defined(VBOX_WITH_XPCOM) */
-
 /////////////////////////////////////////////////////////////////////////////
 
 class CVirtualBoxErrorInfo;
@@ -638,14 +629,14 @@ public:
     {
         clear();
         mIface = that.mIface;
-        this->addref(ptr());
+        this->addref((IUnknown*)ptr());
     }
 
     CInterface(I *aIface)
     {
         clear();
         setPtr(aIface);
-        this->addref(aIface);
+        this->addref((IUnknown*)aIface);
     }
 
     virtual ~CInterface()
@@ -698,13 +689,13 @@ public:
 #endif
         /* be aware of self assignment */
         I* amIface = ptr();
-        this->addref(aIface);
-        this->release(amIface);
+        this->addref((IUnknown*)aIface);
+        this->release((IUnknown*)amIface);
         if (aIface)
         {
             amIface = NULL;
             B::mRC = aIface->QueryInterface(COM_IIDOF(I), (void **)&amIface);
-            this->release(aIface);
+            this->release((IUnknown*)aIface);
             setPtr(amIface);
         }
         else
@@ -721,8 +712,8 @@ public:
         Assert(!mDead);
 #endif
         /* be aware of self assignment */
-        this->addref(aIface);
-        this->release(ptr());
+        this->addref((IUnknown*)aIface);
+        this->release((IUnknown*)ptr());
         setPtr(aIface);
         B::mRC = S_OK;
     };
@@ -733,7 +724,7 @@ public:
 #ifdef DEBUG
        Assert(!mDead);
 #endif
-       this->release(ptr());
+       this->release((IUnknown*)ptr());
        setPtr(NULL);
     }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl b/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl
index 1385263..6930cf0 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl
+++ b/src/VBox/Frontends/VirtualBox/src/globals/COMWrappers.xsl
@@ -22,51 +22,14 @@
 <xsl:output method="text"/>
 <xsl:strip-space elements="*"/>
 
+<xsl:include href="../../../../Main/idl/typemap-shared.inc.xsl" />
 
-<!--
- *  Capitalizes the first letter:
--->
-<xsl:template name="capitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    concat(
-      translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
-      substring($str,2)
-    )
-  "/>
-</xsl:template>
 
 <!--
- *  Uncapitalizes the first letter only if the second one is not capital
- *  otherwise leaves the string unchanged:
+ * Keys for more efficiently looking up of types.
 -->
-<xsl:template name="uncapitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:choose>
-    <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
-      <xsl:value-of select="
-        concat(
-          translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
-          substring($str,2)
-        )
-      "/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:value-of select="string($str)"/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-
-<!--
- *  Translates the string to uppercase:
--->
-<xsl:template name="uppercase">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
-  "/>
-</xsl:template>
+<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
 
 
 <!--
@@ -82,7 +45,8 @@
 -->
 <xsl:template name="endFile">
   <xsl:param name="file" />
-  <xsl:value-of select="concat('
// ##### ENDFILE "', $file, '"

')" />
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
+  <xsl:value-of select="concat('// ##### ENDFILE "', $file, '"

')" />
 </xsl:template>
 
 
@@ -213,7 +177,7 @@
     <xsl:text>#ifndef ___COMEnums_h___&#x0A;</xsl:text>
     <xsl:text>#define ___COMEnums_h___&#x0A;&#x0A;</xsl:text>
     <xsl:text>/* GUI includes: */&#x0A;</xsl:text>
-    <xsl:text>#include "COMDefs.h"&#x0A;&#x0A;</xsl:text>
+    <xsl:text>#include "QMetaType"&#x0A;&#x0A;</xsl:text>
 
     <!-- Enumerate all enums: -->
     <xsl:for-each select="enum">
@@ -226,8 +190,8 @@
         <xsl:for-each select="const">
             <xsl:text>    </xsl:text>
             <xsl:value-of select="concat('K',../@name,'_', at name)"/>
-            <xsl:text> = ::</xsl:text>
-            <xsl:value-of select="concat(../@name,'_', at name)"/>
+            <xsl:text> = </xsl:text>
+            <xsl:value-of select="@value"/>
             <xsl:text>,&#x0A;</xsl:text>
         </xsl:for-each>
         <xsl:text>    </xsl:text>
@@ -274,6 +238,12 @@
     <xsl:text> * Source    : src/VBox/Main/idl/VirtualBox.xidl&#x0A;</xsl:text>
     <xsl:text> * Generator : src/VBox/Frontends/VirtualBox/include/COMWrappers.xsl&#x0A;</xsl:text>
     <xsl:text> */&#x0A;&#x0A;</xsl:text>
+    <xsl:text>/* VirtualBox interface declarations: */&#x0A;</xsl:text>
+    <xsl:text>#ifndef VBOX_WITH_XPCOM&#x0A;</xsl:text>
+    <xsl:text># include "VirtualBox.h"&#x0A;</xsl:text>
+    <xsl:text>#else /* !VBOX_WITH_XPCOM */&#x0A;</xsl:text>
+    <xsl:text># include "VirtualBox_XPCOM.h"&#x0A;</xsl:text>
+    <xsl:text>#endif /* VBOX_WITH_XPCOM */&#x0A;&#x0A;</xsl:text>
     <xsl:text>/* COM includes: */&#x0A;</xsl:text>
     <xsl:text>#include "COMEnums.h"&#x0A;</xsl:text>
 
@@ -330,8 +300,14 @@
     </xsl:for-each>
     <xsl:text>&#x0A;</xsl:text>
 
-    <!-- Interface declaration: -->
-    <xsl:text>/* Interface declaration: */&#x0A;</xsl:text>
+    <!-- Interface forward declaration: -->
+    <xsl:text>/* Interface forward declaration: */&#x0A;</xsl:text>
+    <xsl:text>struct I</xsl:text>
+    <xsl:value-of select="substring(@name,2)"/>
+    <xsl:text>;&#x0A;&#x0A;</xsl:text>
+
+    <!-- Interface wrapper declaration: -->
+    <xsl:text>/* Interface wrapper declaration: */&#x0A;</xsl:text>
     <xsl:text>class C</xsl:text>
     <xsl:value-of select="substring(@name,2)"/>
     <xsl:text> : public CInterface<</xsl:text>
@@ -365,7 +341,7 @@
     <xsl:text>/* Let QMetaType know about generated interface: */&#x0A;</xsl:text>
     <xsl:text>Q_DECLARE_METATYPE(</xsl:text>
     <xsl:value-of select="concat('C',substring(@name,2))"/>
-    <xsl:text>)&#x0A;&#x0A;</xsl:text>
+    <xsl:text>);&#x0A;&#x0A;</xsl:text>
 
     <!-- Declare safe-array -->
     <xsl:if test="
@@ -501,7 +477,11 @@
   <!-- default constructor -->
   <xsl:text>    C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
-  <xsl:text>() {}&#x0A;&#x0A;</xsl:text>
+  <xsl:text>();&#x0A;</xsl:text>
+  <!-- default destructor -->
+  <xsl:text>    ~C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>();&#x0A;&#x0A;</xsl:text>
   <!-- constructor taking CWhatever -->
   <xsl:text>    template<class OI, class OB> explicit C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
@@ -521,7 +501,7 @@
   <xsl:value-of select="substring(@name,2)"/>
   <xsl:text>(const C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
-  <xsl:text> & that) : Base(that) {}&#x0A;&#x0A;</xsl:text>
+  <xsl:text> & that);&#x0A;&#x0A;</xsl:text>
   <!-- constructor taking a raw iface pointer -->
   <xsl:text>    template<class OI> explicit C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
@@ -531,7 +511,7 @@
   <xsl:value-of select="substring(@name,2)"/>
   <xsl:text>(</xsl:text>
   <xsl:value-of select="@name"/>
-  <xsl:text> * aIface) : Base(aIface) {}&#x0A;&#x0A;</xsl:text>
+  <xsl:text> * aIface);&#x0A;&#x0A;</xsl:text>
   <!-- assignment taking CWhatever -->
   <xsl:text>    template<class OI, class OB> C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
@@ -552,12 +532,7 @@
   <xsl:value-of select="substring(@name,2)"/>
   <xsl:text> & operator=(const C</xsl:text>
   <xsl:value-of select="substring(@name,2)"/>
-<xsl:text> & that)
-    {
-        Base::operator=(that);
-        return *this;
-    }
-</xsl:text>
+<xsl:text> & that);&#x0A;</xsl:text>
   <xsl:text>&#x0A;</xsl:text>
   <!-- assignment taking a raw iface pointer -->
   <xsl:text>    template<class OI> C</xsl:text>
@@ -574,12 +549,7 @@
   <xsl:value-of select="substring(@name,2)"/>
   <xsl:text> & operator=(</xsl:text>
   <xsl:value-of select="@name"/>
-<xsl:text> * aIface)
-    {
-        Base::operator=(aIface);
-        return *this;
-    }
-</xsl:text>
+<xsl:text> * aIface);&#x0A;</xsl:text>
   <xsl:text>&#x0A;</xsl:text>
 
   <xsl:text>    /* Attributes (properties): */&#x0A;</xsl:text>
@@ -681,7 +651,8 @@
 
   <xsl:text>// </xsl:text>
   <xsl:value-of select="@name"/>
-  <xsl:text> wrapper&#x0A;&#x0A;</xsl:text>
+  <xsl:text> wrapper&#x0A;</xsl:text>
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
 
   <xsl:if test="name()='interface'">
     <xsl:call-template name="defineMembers"/>
@@ -689,6 +660,74 @@
 
 </xsl:template>
 
+<xsl:template name="defineConstructors">
+
+  <!-- default constructor -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>() {}&#x0A;&#x0A;</xsl:text>
+
+  <!-- default destructor -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::~C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>() {}&#x0A;&#x0A;</xsl:text>
+
+  <!-- copy constructor -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>(const C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text> &that) : Base(that) {}&#x0A;&#x0A;</xsl:text>
+
+  <!-- copy constructor taking interface pointer -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>(</xsl:text>
+  <xsl:value-of select="@name"/>
+  <xsl:text> *pIface) : Base(pIface) {}&#x0A;&#x0A;</xsl:text>
+
+  <!-- operator= -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>& </xsl:text>
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::operator=(const C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+<xsl:text> &that)
+{
+    Base::operator=(that);
+    return *this;
+}
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+
+  <!-- operator= taking interface pointer -->
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>& </xsl:text>
+  <xsl:text>C</xsl:text>
+  <xsl:value-of select="substring(@name,2)"/>
+  <xsl:text>::operator=(</xsl:text>
+  <xsl:value-of select="@name"/>
+<xsl:text> *pIface)
+{
+    Base::operator=(pIface);
+    return *this;
+}
+</xsl:text>
+  <xsl:text>&#x0A;</xsl:text>
+
+</xsl:template>
+
 <xsl:template name="defineAttributes">
 
   <xsl:param name="iface"/>
@@ -928,6 +967,9 @@
 </xsl:template>
 
 <xsl:template name="defineMembers">
+  <xsl:call-template name="defineConstructors">
+    <xsl:with-param name="iface" select="."/>
+  </xsl:call-template>
   <xsl:call-template name="defineAttributes">
     <xsl:with-param name="iface" select="."/>
   </xsl:call-template>
@@ -1232,6 +1274,7 @@
   <xsl:text>#ifdef RT_OS_WINDOWS&#x0A;</xsl:text>
   <xsl:text>    Assert(mRC != RPC_E_WRONG_THREAD);&#x0A;</xsl:text>
   <xsl:text>    Assert(mRC != CO_E_NOTINITIALIZED);&#x0A;</xsl:text>
+  <xsl:text>    Assert(mRC != RPC_E_CANTCALLOUT_ININPUTSYNCCALL);&#x0A;</xsl:text>
   <xsl:text>#endif&#x0A;</xsl:text>
 
   <!-- apply 'post-call' hooks -->
@@ -1266,10 +1309,12 @@
 -->
 <xsl:template name="tryComposeFetchErrorInfo">
   <xsl:param name="mode" select="''"/>
+
   <xsl:variable name="ifaceSupportsErrorInfo" select="
     ancestor-or-self::interface[1]/@supportsErrorInfo
   "/>
   <xsl:variable name="librarySupportsErrorInfo" select="ancestor::library/@supportsErrorInfo"/>
+
   <xsl:choose>
     <xsl:when test="$ifaceSupportsErrorInfo">
       <xsl:call-template name="composeFetchErrorInfo">
@@ -1289,6 +1334,7 @@
 <xsl:template name="composeFetchErrorInfo">
   <xsl:param name="supports" select="''"/>
   <xsl:param name="mode" select="''"/>
+
   <xsl:choose>
     <xsl:when test="$mode='getBaseClassName'">
       <xsl:if test="$supports='strict' or $supports='yes'">
@@ -1310,12 +1356,9 @@
 </xsl:template>
 
 <xsl:template name="composeMethodCallParam">
-
   <xsl:param name="isIn" select="@dir='in'"/>
   <xsl:param name="isOut" select="@dir='out' or @dir='return'"/>
 
-  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
-
   <xsl:choose>
     <!-- safearrays -->
     <xsl:when test="@safearray='yes'">
@@ -1352,10 +1395,7 @@
       </xsl:choose>
     </xsl:when>
     <!-- enum types -->
-    <xsl:when test="
-      (ancestor::library/enum[@name=current()/@type]) or
-      (ancestor::library/if[@target=$self_target]/enum[@name=current()/@type])
-    ">
+    <xsl:when test="count(key('G_keyEnumsByName', current()/@type)) > 0">
       <xsl:choose>
         <xsl:when test="$isIn">
           <xsl:text>(</xsl:text>
@@ -1379,12 +1419,7 @@
       </xsl:choose>
     </xsl:when>
     <!-- interface types -->
-    <xsl:when test="
-      @type='$unknown' or
-      ((ancestor::library/interface[@name=current()/@type]) or
-       (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type])
-      )
-    ">
+    <xsl:when test="@type='$unknown' or (count(key('G_keyInterfacesByName', current()/@type)) > 0)">
       <xsl:choose>
         <xsl:when test="$isIn">
           <xsl:text>a</xsl:text>
@@ -1431,8 +1466,6 @@
  *  attribute/parameter type conversion (returns plain Qt type name)
 -->
 <xsl:template match="attribute/@type | param/@type">
-  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
-
   <xsl:choose>
     <!-- modifiers -->
     <xsl:when test="name(current())='type' and ../@mod">
@@ -1521,31 +1554,17 @@
         <xsl:when test=".='uuid'">QUuid</xsl:when>
         <!-- system interface types -->
         <xsl:when test=".='$unknown'">CUnknown</xsl:when>
+        <!-- enum types -->
+        <xsl:when test="count(key('G_keyEnumsByName', current())) > 0">
+          <xsl:value-of select="concat('K',string(.))"/>
+        </xsl:when>
+        <!-- custom interface types -->
+        <xsl:when test="count(key('G_keyInterfacesByName', current())) > 0">
+          <xsl:value-of select="concat('C',substring(.,2))"/>
+        </xsl:when>
+        <!-- other types -->
         <xsl:otherwise>
-          <xsl:choose>
-            <!-- enum types -->
-            <xsl:when test="
-              (ancestor::library/enum[@name=current()]) or
-              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
-            ">
-              <xsl:value-of select="concat('K',string(.))"/>
-            </xsl:when>
-            <!-- custom interface types -->
-            <xsl:when test="
-              ((ancestor::library/interface[@name=current()]) or
-               (ancestor::library/if[@target=$self_target]/interface[@name=current()])
-              )
-            ">
-              <xsl:value-of select="concat('C',substring(.,2))"/>
-            </xsl:when>
-            <!-- other types -->
-            <xsl:otherwise>
-              <xsl:message terminate="yes">
-                <xsl:text>Unknown parameter type: </xsl:text>
-                <xsl:value-of select="."/>
-              </xsl:message>
-            </xsl:otherwise>
-          </xsl:choose>
+          <xsl:message terminate="yes"><xsl:text>Unknown parameter type: </xsl:text><xsl:value-of select="."/></xsl:message>
         </xsl:otherwise>
       </xsl:choose>
       <xsl:if test="../@safearray">
@@ -1562,9 +1581,6 @@
  *  types.
 -->
 <xsl:template match="attribute/@type | param/@type" mode="initializer">
-
-  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
-
   <xsl:choose>
     <!-- safearrays don't need initializers -->
     <xsl:when test="../@safearray">
@@ -1636,17 +1652,10 @@
         <xsl:when test=".='char'"> = 0</xsl:when>
         <xsl:when test=".='string'"> = NULL</xsl:when>
         <xsl:when test=".='wchar'"> = 0</xsl:when>
-        <xsl:otherwise>
-          <xsl:choose>
-            <!-- enum types initialized with 0 -->
-            <xsl:when test="
-              (ancestor::library/enum[@name=current()]) or
-              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
-            ">
-              <xsl:value-of select="concat(' = (K',string(.),') 0')"/>
-            </xsl:when>
-          </xsl:choose>
-        </xsl:otherwise>
+        <!-- enum types initialized with 0 -->
+        <xsl:when test="count(key('G_keyEnumsByName', current())) > 0">
+          <xsl:value-of select="concat(' = (K',string(.),') 0')"/>
+        </xsl:when>
       </xsl:choose>
     </xsl:otherwise>
   </xsl:choose>
@@ -1657,22 +1666,15 @@
  *  attribute/parameter type conversion (for method declaration)
 -->
 <xsl:template match="attribute/@type | param/@type" mode="param">
-
-  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
-
   <xsl:choose>
     <!-- class types -->
     <xsl:when test="
-      .='string' or
-      .='wstring' or
-      ../@safearray='yes' or
-      ((ancestor::library/enum[@name=current()]) or
-       (ancestor::library/if[@target=$self_target]/enum[@name=current()])
-      ) or
-      .='$unknown' or
-      ((ancestor::library/interface[@name=current()]) or
-       (ancestor::library/if[@target=$self_target]/interface[@name=current()])
-      )
+         . = 'string'
+      or . = 'wstring'
+      or . = '$unknown'
+      or ../@safearray = 'yes'
+      or (count(key('G_keyEnumsByName',      current())) > 0)
+      or (count(key('G_keyInterfacesByName', current())) > 0)
     ">
       <xsl:choose>
         <!-- <attribute> context -->
@@ -1725,9 +1727,6 @@
  *  (basically, copied from midl.xsl)
 -->
 <xsl:template match="attribute/@type | param/@type" mode="com">
-
-  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
-
   <xsl:choose>
     <!-- modifiers -->
     <xsl:when test="name(current())='type' and ../@mod">
@@ -1801,31 +1800,20 @@
         <xsl:when test=".='uuid'">GUID</xsl:when>
         <!-- system interface types -->
         <xsl:when test=".='$unknown'">IUnknown *</xsl:when>
+        <!-- enum types -->
+        <xsl:when test="count(key('G_keyEnumsByName', current())) > 0">
+          <xsl:value-of select="."/>
+        </xsl:when>
+        <!-- custom interface types -->
+        <xsl:when test="count(key('G_keyInterfacesByName', current())) > 0">
+          <xsl:value-of select="."/><xsl:text> *</xsl:text>
+        </xsl:when>
+        <!-- other types -->
         <xsl:otherwise>
-          <xsl:choose>
-            <!-- enum types -->
-            <xsl:when test="
-              (ancestor::library/enum[@name=current()]) or
-              (ancestor::library/if[@target=$self_target]/enum[@name=current()])
-            ">
-              <xsl:value-of select="."/>
-            </xsl:when>
-            <!-- custom interface types -->
-            <xsl:when test="
-              ((ancestor::library/interface[@name=current()]) or
-               (ancestor::library/if[@target=$self_target]/interface[@name=current()])
-              )
-            ">
-              <xsl:value-of select="."/><xsl:text> *</xsl:text>
-            </xsl:when>
-            <!-- other types -->
-            <xsl:otherwise>
-              <xsl:message terminate="yes">
-                <xsl:text>Unknown parameter type: </xsl:text>
-                <xsl:value-of select="."/>
-              </xsl:message>
-            </xsl:otherwise>
-          </xsl:choose>
+          <xsl:message terminate="yes">
+            <xsl:text>Unknown parameter type: </xsl:text>
+            <xsl:value-of select="."/>
+          </xsl:message>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:otherwise>
@@ -1845,23 +1833,10 @@
  *                  call.
 -->
 <xsl:template name="hooks">
-
   <xsl:param name="when" select="''"/>
   <xsl:param name="isSetter" select="''"/>
 
-  <xsl:variable name="self_target" select="current()/ancestor::if/@target"/>
-
-  <xsl:variable name="is_iface" select="(
-    ((ancestor::library/interface[@name=current()/@type]) or
-     (ancestor::library/if[@target=$self_target]/interface[@name=current()/@type])
-    )
-  )"/>
-
-  <xsl:variable name="is_enum" select="(
-    (ancestor::library/enum[@name=current()/@type]) or
-    (ancestor::library/if[@target=$self_target]/enum[@name=current()/@type])
-  )"/>
-
+  <xsl:variable name="is_iface" select="count(key('G_keyInterfacesByName', current()/@type)) > 0"/>
   <xsl:variable name="is_out" select="(
       (name()='attribute' and not($isSetter)) or
       (name()='param' and (@dir='out' or @dir='return'))
@@ -1869,6 +1844,7 @@
 
   <xsl:choose>
     <xsl:when test="$when='pre-call'">
+      <xsl:variable name="is_enum" select="count(key('G_keyEnumsByName', current()/@type)) > 0"/>
       <xsl:choose>
         <xsl:when test="@safearray='yes'">
           <!-- declare a SafeArray variable -->
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h b/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h
index 92cc805..d98cfee 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h
@@ -1,8 +1,6 @@
+/* $Id: QIWithRetranslateUI.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of utility classes and functions
- * VirtualBox Qt extensions: QIWithRetranslateUI class declaration
+ * VBox Qt GUI - Qt extensions: QIWithRetranslateUI class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
index 59b03df..aaf903d 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIActionPool.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIActionPool class implementation
+ * VBox Qt GUI - UIActionPool class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,38 +15,92 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Global includes: */
-#include <QHelpEvent>
-#include <QToolTip>
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QHelpEvent>
+# include <QToolTip>
+
+/* GUI includes: */
+# include "UIActionPool.h"
+# include "UIActionPoolSelector.h"
+# include "UIActionPoolRuntime.h"
+# include "UIShortcutPool.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+#  include "UIExtraDataManager.h"
+#  include "UINetworkManager.h"
+#  include "UIUpdateManager.h"
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
 
-/* Local includes: */
-#include "UIActionPool.h"
-#include "UIActionPoolSelector.h"
-#include "UIActionPoolRuntime.h"
-#include "UIIconPool.h"
-#include "UIShortcutPool.h"
-#include "VBoxGlobal.h"
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/* Action activation event: */
+
+
+/** QEvent extension
+  * representing action-activation event. */
 class ActivateActionEvent : public QEvent
 {
 public:
 
+    /** Constructor. */
     ActivateActionEvent(QAction *pAction)
         : QEvent((QEvent::Type)ActivateActionEventType)
         , m_pAction(pAction) {}
+
+    /** Returns the action this event corresponding to. */
     QAction* action() const { return m_pAction; }
 
 private:
 
+    /** Ho0lds the action this event corresponding to. */
     QAction *m_pAction;
 };
 
-/* UIAction stuff: */
+
+UIMenu::UIMenu()
+    : m_fShowToolTip(false)
+#ifdef Q_WS_MAC
+    , m_fConsumable(false)
+    , m_fConsumed(false)
+#endif /* Q_WS_MAC */
+{
+}
+
+bool UIMenu::event(QEvent *pEvent)
+{
+    /* Handle particular event-types: */
+    switch (pEvent->type())
+    {
+        /* Tool-tip request handler: */
+        case QEvent::ToolTip:
+        {
+            /* Get current help-event: */
+            QHelpEvent *pHelpEvent = static_cast<QHelpEvent*>(pEvent);
+            /* Get action which caused help-event: */
+            QAction *pAction = actionAt(pHelpEvent->pos());
+            /* If action present => show action's tool-tip if needed: */
+            if (pAction && m_fShowToolTip)
+                QToolTip::showText(pHelpEvent->globalPos(), pAction->toolTip());
+            break;
+        }
+        default:
+            break;
+    }
+    /* Call to base-class: */
+    return QMenu::event(pEvent);
+}
+
+
 UIAction::UIAction(UIActionPool *pParent, UIActionType type)
     : QAction(pParent)
-    , m_pActionPool(pParent)
     , m_type(type)
+    , m_pActionPool(pParent)
     , m_actionPoolType(pParent->type())
     , m_fShortcutHidden(false)
 {
@@ -57,9 +109,19 @@ UIAction::UIAction(UIActionPool *pParent, UIActionType type)
     setMenuRole(QAction::NoRole);
 }
 
-UIActionState* UIAction::toStateAction()
+UIMenu* UIAction::menu() const
+{
+    return qobject_cast<UIMenu*>(QAction::menu());
+}
+
+UIActionPolymorphic* UIAction::toActionPolymorphic()
 {
-    return qobject_cast<UIActionState*>(this);
+    return qobject_cast<UIActionPolymorphic*>(this);
+}
+
+UIActionPolymorphicMenu* UIAction::toActionPolymorphicMenu()
+{
+    return qobject_cast<UIActionPolymorphicMenu*>(this);
 }
 
 void UIAction::setName(const QString &strName)
@@ -131,202 +193,342 @@ void UIAction::updateText()
     }
 }
 
-/* UIMenu stuff: */
-UIMenu::UIMenu()
-    : m_fShowToolTips(false)
+
+UIActionMenu::UIActionMenu(UIActionPool *pParent,
+                           const QString &strIcon, const QString &strIconDis)
+    : UIAction(pParent, UIActionType_Menu)
 {
+    if (!strIcon.isNull())
+        setIcon(UIIconPool::iconSet(strIcon, strIconDis));
+    prepare();
 }
 
-bool UIMenu::event(QEvent *pEvent)
+UIActionMenu::UIActionMenu(UIActionPool *pParent,
+                           const QIcon &icon)
+    : UIAction(pParent, UIActionType_Menu)
 {
-    /* Handle particular event-types: */
-    switch (pEvent->type())
+    if (!icon.isNull())
+        setIcon(icon);
+    prepare();
+}
+
+void UIActionMenu::setShowToolTip(bool fShowToolTip)
+{
+    qobject_cast<UIMenu*>(menu())->setShowToolTip(fShowToolTip);
+}
+
+void UIActionMenu::prepare()
+{
+    /* Create menu: */
+    setMenu(new UIMenu);
+    AssertPtrReturnVoid(menu());
     {
-        /* Tool-tip request handler: */
-        case QEvent::ToolTip:
-        {
-            /* Get current help-event: */
-            QHelpEvent *pHelpEvent = static_cast<QHelpEvent*>(pEvent);
-            /* Get action which caused help-event: */
-            QAction *pAction = actionAt(pHelpEvent->pos());
-            /* If action present => show action's tool-tip if needed: */
-            if (pAction && m_fShowToolTips)
-                QToolTip::showText(pHelpEvent->globalPos(), pAction->toolTip());
-            break;
-        }
-        default:
-            break;
+        /* Prepare menu: */
+        connect(menu(), SIGNAL(aboutToShow()),
+                parent(), SLOT(sltHandleMenuPrepare()));
     }
-    /* Base-class event-handler: */
-    return QMenu::event(pEvent);
 }
 
-/* UIActionSimple stuff: */
+void UIActionMenu::updateText()
+{
+    setText(nameInMenu());
+}
+
+
 UIActionSimple::UIActionSimple(UIActionPool *pParent,
-                               const QString &strIcon, const QString &strIconDis)
+                               const QString &strIcon /* = QString() */, const QString &strIconDisabled /* = QString() */)
     : UIAction(pParent, UIActionType_Simple)
 {
     if (!strIcon.isNull())
-        setIcon(UIIconPool::iconSet(strIcon, strIconDis));
+        setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
 }
 
 UIActionSimple::UIActionSimple(UIActionPool *pParent,
-                               const QSize &normalSize, const QSize &smallSize,
-                               const QString &strNormalIcon, const QString &strSmallIcon,
-                               const QString &strNormalIconDis, const QString &strSmallIconDis)
+                               const QString &strIconNormal, const QString &strIconSmall,
+                               const QString &strIconNormalDisabled, const QString &strIconSmallDisabled)
     : UIAction(pParent, UIActionType_Simple)
 {
-    setIcon(UIIconPool::iconSetFull(normalSize, smallSize, strNormalIcon, strSmallIcon, strNormalIconDis, strSmallIconDis));
+    setIcon(UIIconPool::iconSetFull(strIconNormal, strIconSmall, strIconNormalDisabled, strIconSmallDisabled));
 }
 
 UIActionSimple::UIActionSimple(UIActionPool *pParent,
                                const QIcon& icon)
     : UIAction(pParent, UIActionType_Simple)
 {
+    setIcon(icon);
+}
+
+
+UIActionToggle::UIActionToggle(UIActionPool *pParent,
+                               const QString &strIcon /* = QString() */, const QString &strIconDisabled /* = QString() */)
+    : UIAction(pParent, UIActionType_Toggle)
+{
+    if (!strIcon.isNull())
+        setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
+    prepare();
+}
+
+UIActionToggle::UIActionToggle(UIActionPool *pParent,
+                               const QString &strIconOn, const QString &strIconOff,
+                               const QString &strIconOnDisabled, const QString &strIconOffDisabled)
+    : UIAction(pParent, UIActionType_Toggle)
+{
+    setIcon(UIIconPool::iconSetOnOff(strIconOn, strIconOff, strIconOnDisabled, strIconOffDisabled));
+    prepare();
+}
+
+UIActionToggle::UIActionToggle(UIActionPool *pParent,
+                               const QIcon &icon)
+    : UIAction(pParent, UIActionType_Toggle)
+{
     if (!icon.isNull())
         setIcon(icon);
+    prepare();
+}
+
+void UIActionToggle::prepare()
+{
+    setCheckable(true);
 }
 
-/* UIActionState stuff: */
-UIActionState::UIActionState(UIActionPool *pParent,
-                             const QString &strIcon, const QString &strIconDis)
-    : UIAction(pParent, UIActionType_State)
+
+UIActionPolymorphic::UIActionPolymorphic(UIActionPool *pParent,
+                                         const QString &strIcon /* = QString() */, const QString &strIconDisabled /* = QString() */)
+    : UIAction(pParent, UIActionType_Polymorphic)
     , m_iState(0)
 {
     if (!strIcon.isNull())
-        setIcon(UIIconPool::iconSet(strIcon, strIconDis));
+        setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
 }
 
-UIActionState::UIActionState(UIActionPool *pParent,
-                             const QSize &normalSize, const QSize &smallSize,
-                             const QString &strNormalIcon, const QString &strSmallIcon,
-                             const QString &strNormalIconDis, const QString &strSmallIconDis)
-    : UIAction(pParent, UIActionType_State)
+UIActionPolymorphic::UIActionPolymorphic(UIActionPool *pParent,
+                                         const QString &strIconNormal, const QString &strIconSmall,
+                                         const QString &strIconNormalDisabled, const QString &strIconSmallDisabled)
+    : UIAction(pParent, UIActionType_Polymorphic)
     , m_iState(0)
 {
-    setIcon(UIIconPool::iconSetFull(normalSize, smallSize, strNormalIcon, strSmallIcon, strNormalIconDis, strSmallIconDis));
+    setIcon(UIIconPool::iconSetFull(strIconNormal, strIconSmall, strIconNormalDisabled, strIconSmallDisabled));
 }
 
-UIActionState::UIActionState(UIActionPool *pParent,
-                             const QIcon& icon)
-    : UIAction(pParent, UIActionType_State)
+UIActionPolymorphic::UIActionPolymorphic(UIActionPool *pParent,
+                                         const QIcon& icon)
+    : UIAction(pParent, UIActionType_Polymorphic)
     , m_iState(0)
 {
     if (!icon.isNull())
         setIcon(icon);
 }
 
-/* UIActionToggle stuff: */
-UIActionToggle::UIActionToggle(UIActionPool *pParent,
-                               const QString &strIcon, const QString &strIconDis)
-    : UIAction(pParent, UIActionType_Toggle)
+
+UIActionPolymorphicMenu::UIActionPolymorphicMenu(UIActionPool *pParent,
+                                                 const QString &strIcon, const QString &strIconDisabled)
+    : UIAction(pParent, UIActionType_PolymorphicMenu)
+    , m_pMenu(0)
+    , m_iState(0)
 {
     if (!strIcon.isNull())
-        setIcon(UIIconPool::iconSet(strIcon, strIconDis));
-    init();
+        setIcon(UIIconPool::iconSet(strIcon, strIconDisabled));
+    prepare();
 }
 
-UIActionToggle::UIActionToggle(UIActionPool *pParent,
-                               const QSize &normalSize, const QSize &smallSize,
-                               const QString &strNormalIcon, const QString &strSmallIcon,
-                               const QString &strNormalIconDis, const QString &strSmallIconDis)
-    : UIAction(pParent, UIActionType_Toggle)
+UIActionPolymorphicMenu::UIActionPolymorphicMenu(UIActionPool *pParent,
+                                                 const QString &strIconNormal, const QString &strIconSmall,
+                                                 const QString &strIconNormalDisabled, const QString &strIconSmallDisabled)
+    : UIAction(pParent, UIActionType_PolymorphicMenu)
+    , m_pMenu(0)
+    , m_iState(0)
 {
-    setIcon(UIIconPool::iconSetFull(normalSize, smallSize, strNormalIcon, strSmallIcon, strNormalIconDis, strSmallIconDis));
-    init();
+    if (!strIconNormal.isNull())
+        setIcon(UIIconPool::iconSetFull(strIconNormal, strIconSmall, strIconNormalDisabled, strIconSmallDisabled));
+    prepare();
 }
 
-UIActionToggle::UIActionToggle(UIActionPool *pParent,
-               const QString &strIconOn, const QString &strIconOff,
-               const QString &strIconOnDis, const QString &strIconOffDis)
-    : UIAction(pParent, UIActionType_Toggle)
+UIActionPolymorphicMenu::UIActionPolymorphicMenu(UIActionPool *pParent,
+                                                 const QIcon &icon)
+    : UIAction(pParent, UIActionType_PolymorphicMenu)
+    , m_pMenu(0)
+    , m_iState(0)
 {
-    setIcon(UIIconPool::iconSetOnOff(strIconOn, strIconOff, strIconOnDis, strIconOffDis));
-    init();
+    if (!icon.isNull())
+        setIcon(icon);
+    prepare();
 }
 
-UIActionToggle::UIActionToggle(UIActionPool *pParent,
-                               const QIcon &icon)
-    : UIAction(pParent, UIActionType_Toggle)
+UIActionPolymorphicMenu::~UIActionPolymorphicMenu()
 {
-    if (!icon.isNull())
-        setIcon(icon);
-    init();
+    /* Hide menu: */
+    hideMenu();
+    /* Delete menu: */
+    delete m_pMenu;
+    m_pMenu = 0;
 }
 
-void UIActionToggle::sltUpdate()
+void UIActionPolymorphicMenu::setShowToolTip(bool fShowToolTip)
 {
-    retranslateUi();
+    qobject_cast<UIMenu*>(menu())->setShowToolTip(fShowToolTip);
 }
 
-void UIActionToggle::init()
+void UIActionPolymorphicMenu::showMenu()
 {
-    setCheckable(true);
-    connect(this, SIGNAL(toggled(bool)), this, SLOT(sltUpdate()));
+    /* Show menu if necessary: */
+    if (!menu())
+        setMenu(m_pMenu);
 }
 
-/* UIActionMenu stuff: */
-UIActionMenu::UIActionMenu(UIActionPool *pParent,
-                           const QString &strIcon, const QString &strIconDis)
-    : UIAction(pParent, UIActionType_Menu)
+void UIActionPolymorphicMenu::hideMenu()
 {
-    if (!strIcon.isNull())
-        setIcon(UIIconPool::iconSet(strIcon, strIconDis));
-    setMenu(new UIMenu);
+    /* Hide menu if necessary: */
+    if (menu())
+        setMenu(0);
 }
 
-UIActionMenu::UIActionMenu(UIActionPool *pParent,
-                           const QIcon &icon)
-    : UIAction(pParent, UIActionType_Menu)
+void UIActionPolymorphicMenu::prepare()
 {
-    if (!icon.isNull())
-        setIcon(icon);
-    setMenu(new UIMenu);
+    /* Create menu: */
+    m_pMenu = new UIMenu;
+    AssertPtrReturnVoid(m_pMenu);
+    {
+        /* Prepare menu: */
+        connect(m_pMenu, SIGNAL(aboutToShow()),
+                parent(), SLOT(sltHandleMenuPrepare()));
+        /* Show menu: */
+        showMenu();
+    }
 }
 
-void UIActionMenu::updateText()
+void UIActionPolymorphicMenu::updateText()
 {
     setText(nameInMenu());
 }
 
 
-class UIActionSimpleLogDialog : public UIActionSimple
+class UIActionMenuApplication : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimpleLogDialog(UIActionPool *pParent)
-        : UIActionSimple(pParent, QSize(32, 32), QSize(16, 16),
-                         ":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png",
-                         ":/vm_show_logs_disabled_32px.png", ":/vm_show_logs_disabled_16px.png")
+    UIActionMenuApplication(UIActionPool *pParent)
+        : UIActionMenu(pParent)
     {
+#ifdef RT_OS_DARWIN
+        menu()->setConsumable(true);
+#endif /* RT_OS_DARWIN */
         retranslateUi();
     }
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Application; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Application); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Application); }
+
+    void retranslateUi()
+    {
+#ifdef RT_OS_DARWIN
+        setName(QApplication::translate("UIActionPool", "&VirtualBox"));
+#else /* !RT_OS_DARWIN */
+        setName(QApplication::translate("UIActionPool", "&File"));
+#endif /* !RT_OS_DARWIN */
+    }
+};
+
+class UIActionSimplePerformClose : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimplePerformClose(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/exit_16px.png")
+    {
+        setMenuRole(QAction::QuitRole);
+    }
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuApplicationActionType_Close; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_Close); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Close); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("ShowVMLog");
+        return QString("Close");
     }
 
-    QKeySequence defaultShortcut(UIActionPoolType actionPoolType) const
+    QKeySequence defaultShortcut(UIActionPoolType) const
     {
-        switch (actionPoolType)
-        {
-            case UIActionPoolType_Selector: return QKeySequence("Ctrl+L");
-            case UIActionPoolType_Runtime: break;
-        }
-        return QKeySequence();
+        return QKeySequence("Q");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Close..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Close the virtual machine"));
+    }
+};
+
+#ifdef RT_OS_DARWIN
+class UIActionMenuWindow : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuWindow(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Window; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Window); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Window); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Window"));
+    }
+};
+
+class UIActionSimpleMinimize : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleMinimize(UIActionPool *pParent)
+        : UIActionSimple(pParent) {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuWindowActionType_Minimize; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuWindowActionType_Minimize); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType_Minimize); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("Minimize");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Show &Log..."));
-        setStatusTip(QApplication::translate("UIActionPool", "Show the log files of the selected virtual machine"));
+        setName(QApplication::translate("UIActionPool", "&Minimize"));
+        setStatusTip(QApplication::translate("UIActionPool", "Minimize active machine-window"));
     }
 };
+#endif /* RT_OS_DARWIN */
 
 class UIActionMenuHelp : public UIActionMenu
 {
@@ -342,6 +544,13 @@ public:
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Help; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Help); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Help); }
+
     void retranslateUi()
     {
         setName(QApplication::translate("UIActionPool", "&Help"));
@@ -355,13 +564,20 @@ class UIActionSimpleContents : public UIActionSimple
 public:
 
     UIActionSimpleContents(UIActionPool *pParent)
-        : UIActionSimple(pParent, UIIconPool::defaultIcon(UIIconPool::DialogHelpIcon))
+        : UIActionSimple(pParent, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_DialogHelp))
     {
         retranslateUi();
     }
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuHelpActionType_Contents; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_Contents); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_Contents); }
+
     QString shortcutExtraDataID() const
     {
         return QString("Help");
@@ -398,6 +614,13 @@ public:
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuHelpActionType_WebSite; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_WebSite); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_WebSite); }
+
     QString shortcutExtraDataID() const
     {
         return QString("Web");
@@ -419,11 +642,19 @@ public:
     UIActionSimpleResetWarnings(UIActionPool *pParent)
         : UIActionSimple(pParent, ":/reset_warnings_16px.png")
     {
+        setMenuRole(QAction::ApplicationSpecificRole);
         retranslateUi();
     }
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuApplicationActionType_ResetWarnings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_ResetWarnings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_ResetWarnings); }
+
     QString shortcutExtraDataID() const
     {
         return QString("ResetWarnings");
@@ -446,11 +677,19 @@ public:
     UIActionSimpleNetworkAccessManager(UIActionPool *pParent)
         : UIActionSimple(pParent, ":/nw_16px.png", ":/nw_disabled_16px.png")
     {
+        setMenuRole(QAction::ApplicationSpecificRole);
         retranslateUi();
     }
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuApplicationActionType_NetworkAccessManager; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_NetworkAccessManager); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_NetworkAccessManager); }
+
     QString shortcutExtraDataID() const
     {
         return QString("NetworkAccessManager");
@@ -478,6 +717,13 @@ public:
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates); }
+
     QString shortcutExtraDataID() const
     {
         return QString("Update");
@@ -506,6 +752,34 @@ public:
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const
+    {
+#ifdef RT_OS_DARWIN
+        return UIExtraDataMetaDefs::MenuApplicationActionType_About;
+#else /* !RT_OS_DARWIN */
+        return UIExtraDataMetaDefs::MenuHelpActionType_About;
+#endif /* !RT_OS_DARWIN */
+    }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const
+    {
+#ifdef RT_OS_DARWIN
+        return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_About);
+#else /* !RT_OS_DARWIN */
+        return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuHelpActionType_About);
+#endif /* !RT_OS_DARWIN */
+    }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const
+    {
+#ifdef RT_OS_DARWIN
+        return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_About);
+#else /* !RT_OS_DARWIN */
+        return actionPool()->isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType_About);
+#endif /* !RT_OS_DARWIN */
+    }
+
     QString shortcutExtraDataID() const
     {
         return QString("About");
@@ -518,112 +792,294 @@ protected:
     }
 };
 
+class UIActionSimplePreferences : public UIActionSimple
+{
+    Q_OBJECT;
 
-/* UIActionPool stuff: */
-UIActionPool* UIActionPool::m_pInstance = 0;
+public:
+
+    UIActionSimplePreferences(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/global_settings_16px.png")
+    {
+        setMenuRole(QAction::PreferencesRole);
+        retranslateUi();
+    }
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuApplicationActionType_Preferences; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuApplicationActionType_Preferences); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType_Preferences); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("Preferences");
+    }
+
+    QKeySequence defaultShortcut(UIActionPoolType) const
+    {
+        switch (actionPool()->type())
+        {
+            case UIActionPoolType_Selector: return QKeySequence("Ctrl+G");
+            case UIActionPoolType_Runtime: break;
+        }
+        return QKeySequence();
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Preferences...", "global settings"));
+        setStatusTip(QApplication::translate("UIActionPool", "Display the global settings window"));
+    }
+};
 
-/* static */
-UIActionPool* UIActionPool::instance()
-{
-    return m_pInstance;
-}
 
 /* static */
-void UIActionPool::create(UIActionPoolType type)
+UIActionPool* UIActionPool::create(UIActionPoolType type)
 {
-    /* Check that instance do NOT exists: */
-    if (m_pInstance)
-        return;
-
-    /* Create instance: */
+    UIActionPool *pActionPool = 0;
     switch (type)
     {
-        case UIActionPoolType_Selector: new UIActionPoolSelector; break;
-        case UIActionPoolType_Runtime: new UIActionPoolRuntime; break;
-        default: break;
+        case UIActionPoolType_Selector: pActionPool = new UIActionPoolSelector; break;
+        case UIActionPoolType_Runtime: pActionPool = new UIActionPoolRuntime; break;
+        default: AssertFailedReturn(0);
     }
-
-    /* Prepare instance: */
-    m_pInstance->prepare();
+    AssertPtrReturn(pActionPool, 0);
+    pActionPool->prepare();
+    return pActionPool;
 }
 
 /* static */
-void UIActionPool::destroy()
+void UIActionPool::destroy(UIActionPool *pActionPool)
 {
-    /* Check that instance exists: */
-    if (!m_pInstance)
-        return;
-
-    /* Cleanup instance: */
-    m_pInstance->cleanup();
-
-    /* Delete instance: */
-    delete m_pInstance;
+    AssertPtrReturnVoid(pActionPool);
+    pActionPool->cleanup();
+    delete pActionPool;
 }
 
 /* static */
 void UIActionPool::createTemporary(UIActionPoolType type)
 {
-    UIActionPool *pHelperPool = 0;
+    UIActionPool *pActionPool = 0;
     switch (type)
     {
-        case UIActionPoolType_Selector: pHelperPool = new UIActionPoolSelector; break;
-        case UIActionPoolType_Runtime: pHelperPool = new UIActionPoolRuntime; break;
-        default: break;
-    }
-    if (pHelperPool)
-    {
-        pHelperPool->prepare();
-        pHelperPool->cleanup();
-        delete pHelperPool;
+        case UIActionPoolType_Selector: pActionPool = new UIActionPoolSelector(true); break;
+        case UIActionPoolType_Runtime: pActionPool = new UIActionPoolRuntime(true); break;
+        default: AssertFailedReturnVoid();
     }
+    AssertPtrReturnVoid(pActionPool);
+    pActionPool->prepare();
+    pActionPool->cleanup();
+    delete pActionPool;
 }
 
-UIActionPool::UIActionPool(UIActionPoolType type)
+UIActionPool::UIActionPool(UIActionPoolType type, bool fTemporary /* = false */)
     : m_type(type)
+    , m_fTemporary(fTemporary)
+{
+}
+
+UIActionPoolRuntime* UIActionPool::toRuntime()
+{
+    return qobject_cast<UIActionPoolRuntime*>(this);
+}
+
+UIActionPoolSelector* UIActionPool::toSelector()
+{
+    return qobject_cast<UIActionPoolSelector*>(this);
+}
+
+bool UIActionPool::isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType type) const
+{
+    foreach (const UIExtraDataMetaDefs::MenuType &restriction, m_restrictedMenus.values())
+        if (restriction & type)
+            return false;
+    return true;
+}
+
+void UIActionPool::setRestrictionForMenuBar(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuType restriction)
+{
+    m_restrictedMenus[level] = restriction;
+    updateMenus();
+}
+
+bool UIActionPool::isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType type) const
+{
+    foreach (const UIExtraDataMetaDefs::MenuApplicationActionType &restriction, m_restrictedActionsMenuApplication.values())
+        if (restriction & type)
+            return false;
+    return true;
+}
+
+void UIActionPool::setRestrictionForMenuApplication(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuApplicationActionType restriction)
+{
+    m_restrictedActionsMenuApplication[level] = restriction;
+    m_invalidations << UIActionIndex_M_Application;
+}
+
+#ifdef Q_WS_MAC
+bool UIActionPool::isAllowedInMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType type) const
+{
+    foreach (const UIExtraDataMetaDefs::MenuWindowActionType &restriction, m_restrictedActionsMenuWindow.values())
+        if (restriction & type)
+            return false;
+    return true;
+}
+
+void UIActionPool::setRestrictionForMenuWindow(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuWindowActionType restriction)
+{
+    m_restrictedActionsMenuWindow[level] = restriction;
+    m_invalidations << UIActionIndex_M_Window;
+}
+#endif /* Q_WS_MAC */
+
+bool UIActionPool::isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType type) const
 {
-    /* Prepare instance: */
-    if (!m_pInstance)
-        m_pInstance = this;
+    foreach (const UIExtraDataMetaDefs::MenuHelpActionType &restriction, m_restrictedActionsMenuHelp.values())
+        if (restriction & type)
+            return false;
+    return true;
 }
 
-UIActionPool::~UIActionPool()
+void UIActionPool::setRestrictionForMenuHelp(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuHelpActionType restriction)
 {
-    /* Cleanup instance: */
-    if (m_pInstance == this)
-        m_pInstance = 0;
+    m_restrictedActionsMenuHelp[level] = restriction;
+    m_invalidations << UIActionIndex_Menu_Help;
+}
+
+void UIActionPool::sltHandleMenuPrepare()
+{
+    /* Make sure menu is valid: */
+    UIMenu *pMenu = qobject_cast<UIMenu*>(sender());
+    AssertPtrReturnVoid(pMenu);
+    /* Make sure action is valid: */
+    UIAction *pAction = qobject_cast<UIAction*>(pMenu->menuAction());
+    AssertPtrReturnVoid(pAction);
+
+    /* Determine action index: */
+    const int iIndex = m_pool.key(pAction);
+
+    /* Update menu if necessary: */
+    updateMenu(iIndex);
+
+    /* Notify listeners about menu prepared: */
+    emit sigNotifyAboutMenuPrepare(iIndex, pMenu);
 }
 
 void UIActionPool::prepare()
 {
-    /* Create actions: */
-    createActions();
-    /* Create menus: */
-    createMenus();
-    /* Apply shortcuts: */
-    sltApplyShortcuts();
+    /* Prepare pool: */
+    preparePool();
+    /* Prepare connections: */
+    prepareConnections();
+    /* Update configuration: */
+    updateConfiguration();
+    /* Update shortcuts: */
+    updateShortcuts();
+}
+
+void UIActionPool::preparePool()
+{
+    /* Create 'Application' actions: */
+    m_pool[UIActionIndex_M_Application] = new UIActionMenuApplication(this);
+#ifdef RT_OS_DARWIN
+    m_pool[UIActionIndex_M_Application_S_About] = new UIActionSimpleAbout(this);
+#endif /* RT_OS_DARWIN */
+    m_pool[UIActionIndex_M_Application_S_Preferences] = new UIActionSimplePreferences(this);
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    m_pool[UIActionIndex_M_Application_S_NetworkAccessManager] = new UIActionSimpleNetworkAccessManager(this);
+    m_pool[UIActionIndex_M_Application_S_CheckForUpdates] = new UIActionSimpleCheckForUpdates(this);
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+    m_pool[UIActionIndex_M_Application_S_ResetWarnings] = new UIActionSimpleResetWarnings(this);
+    m_pool[UIActionIndex_M_Application_S_Close] = new UIActionSimplePerformClose(this);
+
+#ifdef RT_OS_DARWIN
+    /* Create 'Window' actions: */
+    m_pool[UIActionIndex_M_Window] = new UIActionMenuWindow(this);
+    m_pool[UIActionIndex_M_Window_S_Minimize] = new UIActionSimpleMinimize(this);
+#endif /* RT_OS_DARWIN */
+
+    /* Create 'Help' actions: */
+    m_pool[UIActionIndex_Menu_Help] = new UIActionMenuHelp(this);
+    m_pool[UIActionIndex_Simple_Contents] = new UIActionSimpleContents(this);
+    m_pool[UIActionIndex_Simple_WebSite] = new UIActionSimpleWebSite(this);
+#ifndef RT_OS_DARWIN
+    m_pool[UIActionIndex_Simple_About] = new UIActionSimpleAbout(this);
+#endif /* !RT_OS_DARWIN */
+
+    /* Prepare update-handlers for known menus: */
+#ifdef RT_OS_DARWIN
+    m_menuUpdateHandlers[UIActionIndex_M_Application].ptf = &UIActionPool::updateMenuApplication;
+    m_menuUpdateHandlers[UIActionIndex_M_Window].ptf = &UIActionPool::updateMenuWindow;
+#endif /* RT_OS_DARWIN */
+    m_menuUpdateHandlers[UIActionIndex_Menu_Help].ptf = &UIActionPool::updateMenuHelp;
+
+    /* Invalidate all known menus: */
+    m_invalidations.unite(m_menuUpdateHandlers.keys().toSet());
+
+    /* Retranslate finally: */
+    retranslateUi();
+}
+
+void UIActionPool::prepareConnections()
+{
+    /* 'Application' menu connections: */
+#ifdef RT_OS_DARWIN
+    connect(action(UIActionIndex_M_Application_S_About), SIGNAL(triggered()),
+            &msgCenter(), SLOT(sltShowHelpAboutDialog()), Qt::UniqueConnection);
+#endif /* RT_OS_DARWIN */
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    connect(action(UIActionIndex_M_Application_S_NetworkAccessManager), SIGNAL(triggered()),
+            gNetworkManager, SLOT(show()), Qt::UniqueConnection);
+    connect(action(UIActionIndex_M_Application_S_CheckForUpdates), SIGNAL(triggered()),
+            gUpdateManager, SLOT(sltForceCheck()), Qt::UniqueConnection);
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+    connect(action(UIActionIndex_M_Application_S_ResetWarnings), SIGNAL(triggered()),
+            &msgCenter(), SLOT(sltResetSuppressedMessages()), Qt::UniqueConnection);
+
+    /* 'Help' menu connections: */
+    connect(action(UIActionIndex_Simple_Contents), SIGNAL(triggered()),
+            &msgCenter(), SLOT(sltShowHelpHelpDialog()), Qt::UniqueConnection);
+    connect(action(UIActionIndex_Simple_WebSite), SIGNAL(triggered()),
+            &msgCenter(), SLOT(sltShowHelpWebDialog()), Qt::UniqueConnection);
+#ifndef RT_OS_DARWIN
+    connect(action(UIActionIndex_Simple_About), SIGNAL(triggered()),
+            &msgCenter(), SLOT(sltShowHelpAboutDialog()), Qt::UniqueConnection);
+#endif /* !RT_OS_DARWIN */
+}
+
+void UIActionPool::cleanupPool()
+{
+    /* Cleanup pool: */
+    qDeleteAll(m_pool);
 }
 
 void UIActionPool::cleanup()
 {
-    /* Destroy pool: */
-    destroyPool();
+    /* Cleanup pool: */
+    cleanupPool();
+}
+
+void UIActionPool::updateShortcuts()
+{
+    gShortcutPool->applyShortcuts(this);
 }
 
 bool UIActionPool::processHotKey(const QKeySequence &key)
 {
-    /* Get the list of keys: */
-    QList<int> keys = m_pool.keys();
     /* Iterate through the whole list of keys: */
-    for (int i = 0; i < keys.size(); ++i)
+    foreach (const int &iKey, m_pool.keys())
     {
         /* Get current action: */
-        UIAction *pAction = m_pool[keys[i]];
+        UIAction *pAction = m_pool.value(iKey);
         /* Skip menus/separators: */
         if (pAction->type() == UIActionType_Menu)
             continue;
-        /* Get the hot key of the current action: */
-        QString strHotKey = VBoxGlobal::extractKeyFromActionText(pAction->text());
+        /* Get the hot-key of the current action: */
+        const QString strHotKey = gShortcutPool->shortcut(this, pAction).toString();
         if (pAction->isEnabled() && pAction->isVisible() && !strHotKey.isEmpty())
         {
             if (key.matches(QKeySequence(strHotKey)) == QKeySequence::ExactMatch)
@@ -643,45 +1099,154 @@ bool UIActionPool::processHotKey(const QKeySequence &key)
     return false;
 }
 
-void UIActionPool::sltApplyShortcuts()
+void UIActionPool::updateConfiguration()
 {
-    gShortcutPool->applyShortcuts(this);
+    /* Recache common action restrictions: */
+    // Nothing here for now..
+
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    /* Recache update action restrictions: */
+    bool fUpdateAllowed = gEDataManager->applicationUpdateEnabled();
+    if (!fUpdateAllowed)
+    {
+        m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::MenuApplicationActionType)
+            (m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::MenuApplicationActionType_CheckForUpdates);
+    }
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+
+    /* Update menus: */
+    updateMenus();
 }
 
-void UIActionPool::createActions()
+void UIActionPool::updateMenu(int iIndex)
 {
-    /* Various dialog actions: */
-    m_pool[UIActionIndex_Simple_LogDialog] = new UIActionSimpleLogDialog(this);
-    /* 'Help' actions: */
-    m_pool[UIActionIndex_Simple_Contents] = new UIActionSimpleContents(this);
-    m_pool[UIActionIndex_Simple_WebSite] = new UIActionSimpleWebSite(this);
-    m_pool[UIActionIndex_Simple_ResetWarnings] = new UIActionSimpleResetWarnings(this);
+    /* Update if menu with such index is invalidated and there is update-handler: */
+    if (m_invalidations.contains(iIndex) && m_menuUpdateHandlers.contains(iIndex))
+        (this->*(m_menuUpdateHandlers.value(iIndex).ptf))();
+}
+
+void UIActionPool::updateMenuApplication()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndex_M_Application)->menu();
+    AssertPtrReturnVoid(pMenu);
+#ifdef RT_OS_DARWIN
+    AssertReturnVoid(pMenu->isConsumable());
+#endif /* RT_OS_DARWIN */
+    /* Clear contents: */
+#ifdef RT_OS_DARWIN
+    if (!pMenu->isConsumed())
+#endif /* RT_OS_DARWIN */
+        pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+#ifdef RT_OS_DARWIN
+    /* 'About' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_About)) || fSeparator;
+#endif /* RT_OS_DARWIN */
+
+    /* 'Preferences' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_Preferences)) || fSeparator;
+
+#ifndef RT_OS_DARWIN
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+#endif /* !RT_OS_DARWIN */
+
 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    m_pool[UIActionIndex_Simple_NetworkAccessManager] = new UIActionSimpleNetworkAccessManager(this);
-    m_pool[UIActionIndex_Simple_CheckForUpdates] = new UIActionSimpleCheckForUpdates(this);
+    /* 'Network Manager' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_NetworkAccessManager)) || fSeparator;
 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-    m_pool[UIActionIndex_Simple_About] = new UIActionSimpleAbout(this);
+    /* 'Reset Warnings' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_ResetWarnings)) || fSeparator;
+
+#ifndef RT_OS_DARWIN
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+#endif /* !RT_OS_DARWIN */
+
+    /* 'Close' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_M_Application_S_Close)) || fSeparator;
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndex_M_Application);
 }
 
-void UIActionPool::createMenus()
+#ifdef RT_OS_DARWIN
+void UIActionPool::updateMenuWindow()
 {
-    /* On Mac OS X, all QMenu's are consumed by Qt after they are added to another QMenu or a QMenuBar.
-     * This means we have to recreate all QMenus when creating a new QMenuBar.
-     * For simplicity we doing this on all platforms right now. */
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndex_M_Window)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
 
-    /* 'Help' menu: */
-    if (m_pool[UIActionIndex_Menu_Help])
-        delete m_pool[UIActionIndex_Menu_Help];
-    m_pool[UIActionIndex_Menu_Help] = new UIActionMenuHelp(this);
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Minimize' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_M_Window_S_Minimize)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* This menu always remains invalid.. */
 }
+#endif /* RT_OS_DARWIN */
 
-void UIActionPool::destroyPool()
+void UIActionPool::updateMenuHelp()
 {
-    /* Get the list of keys: */
-    QList<int> keys = m_pool.keys();
-    /* Delete all the items of the map: */
-    for (int i = 0; i < keys.size(); ++i)
-        delete m_pool[keys[i]];
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndex_Menu_Help)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator? */
+    bool fSeparator = false;
+
+    /* 'Contents' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_Contents)) || fSeparator;;
+    /* 'Web Site' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_WebSite)) || fSeparator;;
+
+    /* Separator? */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+#ifndef RT_OS_DARWIN
+    /* 'About' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndex_Simple_About)) || fSeparator;;
+#endif /* !RT_OS_DARWIN */
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndex_Menu_Help);
+}
+
+void UIActionPool::retranslateUi()
+{
+    /* Translate all the actions: */
+    foreach (const int iActionPoolKey, m_pool.keys())
+        m_pool[iActionPoolKey]->retranslateUi();
+    /* Update shortcuts: */
+    updateShortcuts();
 }
 
 bool UIActionPool::event(QEvent *pEvent)
@@ -704,5 +1269,86 @@ bool UIActionPool::event(QEvent *pEvent)
     return QObject::event(pEvent);
 }
 
+bool UIActionPool::addAction(UIMenu *pMenu, UIAction *pAction, bool fReallyAdd /* = true */)
+{
+    /* Check if action is allowed: */
+    const bool fIsActionAllowed = pAction->isAllowed();
+
+#ifdef RT_OS_DARWIN
+    /* Check if menu is consumable: */
+    const bool fIsMenuConsumable = pMenu->isConsumable();
+    /* Check if menu is NOT yet consumed: */
+    const bool fIsMenuConsumed = pMenu->isConsumed();
+#endif /* RT_OS_DARWIN */
+
+    /* Make this action visible
+     * depending on clearance state. */
+    pAction->setVisible(fIsActionAllowed);
+
+#ifdef RT_OS_DARWIN
+    /* If menu is consumable: */
+    if (fIsMenuConsumable)
+    {
+        /* Add action only if menu was not yet consumed: */
+        if (!fIsMenuConsumed)
+            pMenu->addAction(pAction);
+    }
+    /* If menu is NOT consumable: */
+    else
+#endif /* RT_OS_DARWIN */
+    {
+        /* Add action only if is allowed: */
+        if (fIsActionAllowed && fReallyAdd)
+            pMenu->addAction(pAction);
+    }
+
+    /* Return if action is allowed: */
+    return fIsActionAllowed;
+}
+
+bool UIActionPool::addMenu(QList<QMenu*> &menuList, UIAction *pAction, bool fReallyAdd /* = true */)
+{
+    /* Check if action is allowed: */
+    const bool fIsActionAllowed = pAction->isAllowed();
+
+    /* Get action's menu: */
+    UIMenu *pMenu = pAction->menu();
+
+#ifdef RT_OS_DARWIN
+    /* Check if menu is consumable: */
+    const bool fIsMenuConsumable = pMenu->isConsumable();
+    /* Check if menu is NOT yet consumed: */
+    const bool fIsMenuConsumed = pMenu->isConsumed();
+#endif /* RT_OS_DARWIN */
+
+    /* Make this action visible
+     * depending on clearance state. */
+    pAction->setVisible(   fIsActionAllowed
+#ifdef RT_OS_DARWIN
+                        && !fIsMenuConsumable
+#endif /* RT_OS_DARWIN */
+                        );
+
+#ifdef RT_OS_DARWIN
+    /* If menu is consumable: */
+    if (fIsMenuConsumable)
+    {
+        /* Add action's menu only if menu was not yet consumed: */
+        if (!fIsMenuConsumed)
+            menuList << pMenu;
+    }
+    /* If menu is NOT consumable: */
+    else
+#endif /* RT_OS_DARWIN */
+    {
+        /* Add action only if is allowed: */
+        if (fIsActionAllowed && fReallyAdd)
+            menuList << pMenu;
+    }
+
+    /* Return if action is allowed: */
+    return fIsActionAllowed;
+}
+
 #include "UIActionPool.moc"
 
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h b/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
index a548700..4335087 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h
@@ -1,11 +1,10 @@
+/* $Id: UIActionPool.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIActionPool class declaration
+ * VBox Qt GUI - UIActionPool class declaration.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,8 +15,8 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIActionPool_h__
-#define __UIActionPool_h__
+#ifndef ___UIActionPool_h___
+#define ___UIActionPool_h___
 
 /* Qt includes: */
 #include <QAction>
@@ -25,87 +24,174 @@
 
 /* GUI includes: */
 #include "QIWithRetranslateUI.h"
+#include "UIExtraDataDefs.h"
 
 /* Forward declarations: */
-class UIActionState;
+class UIActionPolymorphic;
+class UIActionPolymorphicMenu;
 class UIActionPool;
+class UIActionPoolRuntime;
+class UIActionPoolSelector;
+
 
-/* Action pool types: */
+/** Action-pool types. */
 enum UIActionPoolType
 {
     UIActionPoolType_Selector,
     UIActionPoolType_Runtime
 };
 
-/* Action types: */
+/** Action types. */
 enum UIActionType
 {
+    UIActionType_Menu,
     UIActionType_Simple,
-    UIActionType_State,
     UIActionType_Toggle,
-    UIActionType_Menu
+    UIActionType_Polymorphic,
+    UIActionType_PolymorphicMenu
 };
 
-/* Action keys: */
+/** Action indexes. */
 enum UIActionIndex
 {
-    /* Various dialog actions: */
-    UIActionIndex_Simple_LogDialog,
+    /* 'Application' menu actions: */
+    UIActionIndex_M_Application,
+#ifdef RT_OS_DARWIN
+    UIActionIndex_M_Application_S_About,
+#endif /* RT_OS_DARWIN */
+    UIActionIndex_M_Application_S_Preferences,
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    UIActionIndex_M_Application_S_NetworkAccessManager,
+    UIActionIndex_M_Application_S_CheckForUpdates,
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+    UIActionIndex_M_Application_S_ResetWarnings,
+    UIActionIndex_M_Application_S_Close,
+
+#ifdef RT_OS_DARWIN
+    /* 'Window' menu actions: */
+    UIActionIndex_M_Window,
+    UIActionIndex_M_Window_S_Minimize,
+#endif /* RT_OS_DARWIN */
 
     /* 'Help' menu actions: */
     UIActionIndex_Menu_Help,
     UIActionIndex_Simple_Contents,
     UIActionIndex_Simple_WebSite,
-    UIActionIndex_Simple_ResetWarnings,
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    UIActionIndex_Simple_NetworkAccessManager,
-    UIActionIndex_Simple_CheckForUpdates,
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+#ifndef RT_OS_DARWIN
     UIActionIndex_Simple_About,
+#endif /* !RT_OS_DARWIN */
 
     /* Maximum index: */
     UIActionIndex_Max
 };
 
-/* Basic abstract QAction reimplemetation, extending interface: */
+/** Restriction levels. */
+enum UIActionRestrictionLevel
+{
+    UIActionRestrictionLevel_Base,
+    UIActionRestrictionLevel_Session,
+    UIActionRestrictionLevel_Logic
+};
+
+
+/** QMenu extension. */
+class UIMenu : public QMenu
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor. */
+    UIMenu();
+
+    /** Defines whether tool-tip should be shown. */
+    void setShowToolTip(bool fShowToolTips) { m_fShowToolTip = fShowToolTips; }
+
+#ifdef Q_WS_MAC
+    /** Mac OS X: Returns whether this menu is consumable by the menu-bar. */
+    bool isConsumable() const { return m_fConsumable; }
+    /** Mac OS X: Defines whether this menu is @a fConsumable by the menu-bar. */
+    void setConsumable(bool fConsumable) { m_fConsumable = fConsumable; }
+
+    /** Mac OS X: Returns whether this menu is consumed by the menu-bar. */
+    bool isConsumed() const { return m_fConsumed; }
+    /** Mac OS X: Defines whether this menu is @a fConsumed by the menu-bar. */
+    void setConsumed(bool fConsumed) { m_fConsumed = fConsumed; }
+#endif /* Q_WS_MAC */
+
+protected:
+
+    /** General event handler. */
+    virtual bool event(QEvent *pEvent);
+
+private:
+
+    /** Holds whether tool-tip should be shown. */
+    bool m_fShowToolTip;
+
+#ifdef Q_WS_MAC
+    /** Mac OS X: Holds whether this menu can be consumed by the menu-bar. */
+    bool m_fConsumable;
+    /** Mac OS X: Holds whether this menu is consumed by the menu-bar. */
+    bool m_fConsumed;
+#endif /* Q_WS_MAC */
+};
+
+
+/** Abstract QAction extension. */
 class UIAction : public QAction
 {
     Q_OBJECT;
 
 public:
 
-    /* API: RTTI: */
+    /** Returns action type. */
     UIActionType type() const { return m_type; }
 
-    /* API: Parent stuff: */
-    UIActionPool* actionPool() const { return m_pActionPool; }
+    /** Returns menu contained by this action. */
+    UIMenu* menu() const;
 
-    /* API: Update stuff: */
-    virtual void update() {}
+    /** Returns action-pool this action belongs to. */
+    UIActionPool* actionPool() const { return m_pActionPool; }
 
-    /* API: Cast stuff: */
-    UIActionState* toStateAction();
+    /** Casts action to polymorphic-action. */
+    UIActionPolymorphic* toActionPolymorphic();
+    /** Casts action to polymorphic-menu-action. */
+    UIActionPolymorphicMenu* toActionPolymorphicMenu();
 
-    /* API: Name stuff: */
+    /** Returns current action name. */
     const QString& name() const { return m_strName; }
+    /** Defines current action name. */
     void setName(const QString &strName);
 
-    /* API: Shortcut stuff: */
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return 0; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return QString(); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return true; }
+
+    /** Returns extra-data ID to save keyboard shortcut under. */
     virtual QString shortcutExtraDataID() const { return QString(); }
+    /** Returns default keyboard shortcut for this action. */
     virtual QKeySequence defaultShortcut(UIActionPoolType) const { return QKeySequence(); }
+
+    /** Defines current keyboard shortcut for this action. */
     void setShortcut(const QKeySequence &shortcut);
+    /** Make action show keyboard shortcut. */
     void showShortcut();
+    /** Make action hide keyboard shortcut. */
     void hideShortcut();
 
-    /** Calls for action translation handler. */
+    /** Retranslates action. */
     virtual void retranslateUi() = 0;
 
 protected:
 
-    /* Constructor: */
+    /** Constructor. */
     UIAction(UIActionPool *pParent, UIActionType type);
 
-    /* Protected API: Menu stuff: */
+    /** Returns current action name in menu. */
     QString nameInMenu() const;
 
     /** Updates action text accordingly. */
@@ -113,195 +199,335 @@ protected:
 
 private:
 
-    /* Variables: */
-    UIActionPool *m_pActionPool;
+    /** Holds the action type. */
     UIActionType m_type;
+
+    /** Holds the reference to the action-pool this action belongs to. */
+    UIActionPool *m_pActionPool;
+    /** Holds the type of the action-pool this action belongs to. */
     UIActionPoolType m_actionPoolType;
+
+    /** Holds the action name. */
     QString m_strName;
+    /** Holds the action shortcut. */
     QKeySequence m_shortcut;
+    /** Holds whether action shortcut hidden. */
     bool m_fShortcutHidden;
 };
 
-/* Basic QMenu reimplemetation, extending interface: */
-class UIMenu : public QMenu
+
+/** Abstract UIAction extension for 'Menu' action type. */
+class UIActionMenu : public UIAction
 {
     Q_OBJECT;
 
-public:
+protected:
 
-    /* Constructor: */
-    UIMenu();
+    /** Constructor, taking normal icon name and name for disabled analog. */
+    UIActionMenu(UIActionPool *pParent,
+                 const QString &strIcon = QString(), const QString &strIconDis = QString());
+    /** Constructor, taking copy of existing icon. */
+    UIActionMenu(UIActionPool *pParent,
+                 const QIcon &icon);
 
-    /* API: Tool-tip stuff: */
-    void setShowToolTips(bool fShowToolTips) { m_fShowToolTips = fShowToolTips; }
-    bool isToolTipsShown() const { return m_fShowToolTips; }
+    /** Defines whether tool-tip should be shown. */
+    void setShowToolTip(bool fShowToolTip);
 
 private:
 
-    /* Helper: Event stuff: */
-    bool event(QEvent *pEvent);
+    /** Prepare routine. */
+    void prepare();
 
-    /* Variables: */
-    bool m_fShowToolTips;
+    /** Updates action text accordingly. */
+    virtual void updateText();
 };
 
-/* Abstract extention for UIAction, describing 'simple' action type: */
+
+/** Abstract UIAction extension for 'Simple' action type. */
 class UIActionSimple : public UIAction
 {
     Q_OBJECT;
 
 protected:
 
-    /* Constructors: */
+    /** Constructor, taking normal icon name and name for disabled analog. */
     UIActionSimple(UIActionPool *pParent,
-                   const QString &strIcon = QString(), const QString &strIconDis = QString());
+                   const QString &strIcon = QString(), const QString &strIconDisabled = QString());
+    /** Constructor, taking normal, small icon names and names for disabled analogs. */
     UIActionSimple(UIActionPool *pParent,
-                   const QSize &normalSize, const QSize &smallSize,
-                   const QString &strNormalIcon, const QString &strSmallIcon,
-                   const QString &strNormalIconDis = QString(), const QString &strSmallIconDis = QString());
+                   const QString &strIconNormal, const QString &strIconSmall,
+                   const QString &strIconNormalDisabled, const QString &strIconSmallDisabled);
+    /** Constructor, taking copy of existing icon. */
     UIActionSimple(UIActionPool *pParent,
                    const QIcon& icon);
 };
 
-/* Abstract extention for UIAction, describing 'state' action type: */
-class UIActionState : public UIAction
+
+/** Abstract UIAction extension for 'Toggle' action type. */
+class UIActionToggle : public UIAction
+{
+    Q_OBJECT;
+
+protected:
+
+    /** Constructor, taking normal icon name and name for disabled analog. */
+    UIActionToggle(UIActionPool *pParent,
+                   const QString &strIcon = QString(), const QString &strIconDisabled = QString());
+    /** Constructor, taking normal on/off icon names and names for disabled analogs. */
+    UIActionToggle(UIActionPool *pParent,
+                   const QString &strIconOn, const QString &strIconOff,
+                   const QString &strIconOnDisabled, const QString &strIconOffDisabled);
+    /** Constructor, taking copy of existing icon. */
+    UIActionToggle(UIActionPool *pParent,
+                   const QIcon &icon);
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+};
+
+
+/** Abstract UIAction extension for 'Polymorphic' action type. */
+class UIActionPolymorphic : public UIAction
 {
     Q_OBJECT;
 
 public:
 
-    /* API: State stuff: */
+    /** Returns current action state. */
+    int state() const { return m_iState; }
+    /** Defines current action state. */
     void setState(int iState) { m_iState = iState; retranslateUi(); }
 
 protected:
 
-    /* Constructors: */
-    UIActionState(UIActionPool *pParent,
-                  const QString &strIcon = QString(), const QString &strIconDis = QString());
-    UIActionState(UIActionPool *pParent,
-                  const QSize &normalSize, const QSize &smallSize,
-                  const QString &strNormalIcon, const QString &strSmallIcon,
-                  const QString &strNormalIconDis = QString(), const QString &strSmallIconDis = QString());
-    UIActionState(UIActionPool *pParent,
+    /** Constructor, taking normal icon name and name for disabled analog. */
+    UIActionPolymorphic(UIActionPool *pParent,
+                  const QString &strIcon = QString(), const QString &strIconDisabled = QString());
+    /** Constructor, taking normal, small icon names and names for disabled analogs. */
+    UIActionPolymorphic(UIActionPool *pParent,
+                  const QString &strIconNormal, const QString &strIconSmall,
+                  const QString &strIconNormalDisabled, const QString &strIconSmallDisabled);
+    /** Constructor, taking copy of existing icon. */
+    UIActionPolymorphic(UIActionPool *pParent,
                   const QIcon& icon);
 
-    /* Variables: */
+private:
+
+    /** Holds current action state. */
     int m_iState;
 };
 
-/* Abstract extention for UIAction, describing 'toggle' action type: */
-class UIActionToggle : public UIAction
+
+/** Abstract UIAction extension for 'Polymorphic Menu' action type. */
+class UIActionPolymorphicMenu : public UIAction
 {
     Q_OBJECT;
 
-protected:
+public:
 
-    /* Constructors: */
-    UIActionToggle(UIActionPool *pParent,
-                   const QString &strIcon = QString(), const QString &strIconDis = QString());
-    UIActionToggle(UIActionPool *pParent,
-                   const QSize &normalSize, const QSize &smallSize,
-                   const QString &strNormalIcon, const QString &strSmallIcon,
-                   const QString &strNormalIconDis = QString(), const QString &strSmallIconDis = QString());
-    UIActionToggle(UIActionPool *pParent,
-                   const QString &strIconOn, const QString &strIconOff, const QString &strIconOnDis, const QString &strIconOffDis);
-    UIActionToggle(UIActionPool *pParent,
-                   const QIcon &icon);
+    /** Returns current action state. */
+    int state() const { return m_iState; }
+    /** Defines current action state. */
+    void setState(int iState) { m_iState = iState; retranslateUi(); }
 
-    /* API reimplementation: Update stuff: */
-    void update() { sltUpdate(); }
+protected:
 
-private slots:
+    /** Constructor, taking normal icon name and name for disabled analog. */
+    UIActionPolymorphicMenu(UIActionPool *pParent,
+                            const QString &strIcon = QString(), const QString &strIconDis = QString());
+    /** Constructor, taking normal, small icon names and names for disabled analogs. */
+    UIActionPolymorphicMenu(UIActionPool *pParent,
+                            const QString &strIconNormal, const QString &strIconSmall,
+                            const QString &strIconNormalDisabled, const QString &strIconSmallDisabled);
+    /** Constructor, taking copy of existing icon. */
+    UIActionPolymorphicMenu(UIActionPool *pParent,
+                            const QIcon &icon);
 
-    /* Handler: Update stuff: */
-    void sltUpdate();
+    /** Destructor. */
+    ~UIActionPolymorphicMenu();
 
-private:
+    /** Defines whether tool-tip should be shown. */
+    void setShowToolTip(bool fShowToolTip);
 
-    /* Helper: Prepare stuff: */
-    void init();
-};
+    /** Show menu. */
+    void showMenu();
+    /** Hide menu. */
+    void hideMenu();
 
-/* Abstract extention for UIAction, describing 'menu' action type: */
-class UIActionMenu : public UIAction
-{
-    Q_OBJECT;
-
-protected:
+private:
 
-    /* Constructors: */
-    UIActionMenu(UIActionPool *pParent,
-                 const QString &strIcon = QString(), const QString &strIconDis = QString());
-    UIActionMenu(UIActionPool *pParent,
-                 const QIcon &icon);
+    /** Prepare routine. */
+    void prepare();
 
     /** Updates action text accordingly. */
     virtual void updateText();
+
+private:
+
+    /** Holds the menu instance. */
+    UIMenu *m_pMenu;
+    /** Holds current action state. */
+    int m_iState;
 };
 
-/* Singleton action pool: */
+
+/** Abstract QObject extension
+  * representing action-pool interface and factory. */
 class UIActionPool : public QIWithRetranslateUI3<QObject>
 {
     Q_OBJECT;
 
+    /** Pointer to menu update-handler for this class. */
+    typedef void (UIActionPool::*PTFActionPool)();
+    /** Pointer to menu update-handler for Runtime sub-class. */
+    typedef void (UIActionPoolRuntime::*PTFActionPoolRuntime)();
+    /** Union for two defines above. */
+    union PointerToFunction
+    {
+        PTFActionPool ptf;
+        PTFActionPoolRuntime ptfr;
+    };
+
+signals:
+
+    /** Notifies about menu prepare. */
+    void sigNotifyAboutMenuPrepare(int iIndex, QMenu *pMenu);
+
 public:
 
-    /* API: Singleton stuff: */
-    static UIActionPool* instance();
-    static void create(UIActionPoolType type);
-    static void destroy();
+    /** Static factory constructor. */
+    static UIActionPool* create(UIActionPoolType type);
+    /** Static factory destructor. */
+    static void destroy(UIActionPool *pActionPool);
 
-    /* API: Shortcut pool helper stuff: */
+    /** Static factory constructor (temporary),
+      * used to initialize shortcuts-pool from action-pool of passed @a type. */
     static void createTemporary(UIActionPoolType type);
 
-    /* API: RTTI: */
+    /** Cast action-pool to Runtime one. */
+    UIActionPoolRuntime* toRuntime();
+    /** Cast action-pool to Selector one. */
+    UIActionPoolSelector* toSelector();
+
+    /** Returns action-pool type. */
     UIActionPoolType type() const { return m_type; }
 
-    /* API: Action stuff: */
-    UIAction* action(int iIndex) const { return m_pool[iIndex]; }
+    /** Returns the action for the passed @a iIndex. */
+    UIAction* action(int iIndex) const { return m_pool.value(iIndex); }
+    /** Returns all the actions action-pool contains. */
     QList<UIAction*> actions() const { return m_pool.values(); }
 
-    /* API: Shortcuts stuff: */
-    virtual QString shortcutsExtraDataID() const = 0;
+    /** Returns whether the menu with passed @a type is allowed in menu-bar. */
+    bool isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType type) const;
+    /** Defines menu-bar @a restriction for passed @a level. */
+    void setRestrictionForMenuBar(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuType restriction);
+
+    /** Returns whether the action with passed @a type is allowed in the 'Application' menu. */
+    bool isAllowedInMenuApplication(UIExtraDataMetaDefs::MenuApplicationActionType type) const;
+    /** Defines 'Application' menu @a restriction for passed @a level. */
+    void setRestrictionForMenuApplication(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuApplicationActionType restriction);
+
+#ifdef Q_WS_MAC
+    /** Mac OS X: Returns whether the action with passed @a type is allowed in the 'Window' menu. */
+    bool isAllowedInMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType type) const;
+    /** Mac OS X: Defines 'Window' menu @a restriction for passed @a level. */
+    void setRestrictionForMenuWindow(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuWindowActionType restriction);
+#endif /* Q_WS_MAC */
+
+    /** Returns whether the action with passed @a type is allowed in the 'Help' menu. */
+    bool isAllowedInMenuHelp(UIExtraDataMetaDefs::MenuHelpActionType type) const;
+    /** Defines 'Help' menu @a restriction for passed @a level. */
+    void setRestrictionForMenuHelp(UIActionRestrictionLevel level, UIExtraDataMetaDefs::MenuHelpActionType restriction);
+
+    /** Hot-key processing delegate. */
+    bool processHotKey(const QKeySequence &key);
 
-    /* API: Prepare stuff: */
-    void recreateMenus() { createMenus(); }
+    /** Returns extra-data ID to save keyboard shortcuts under. */
+    virtual QString shortcutsExtraDataID() const = 0;
 
-    /* API: Hot-key handling stuff: */
-    bool processHotKey(const QKeySequence &key);
+    /** Returns the list of main menus. */
+    virtual QList<QMenu*> menus() const = 0;
 
 protected slots:
 
-    /* Handler: Shortcuts stuff: */
-    void sltApplyShortcuts();
+    /** Handles menu prepare. */
+    void sltHandleMenuPrepare();
+
+    /** Loads keyboard shortcuts of action-pool into shortcuts-pool. */
+    void sltApplyShortcuts() { updateShortcuts(); }
 
 protected:
 
-    /* Constructor/destructor: */
-    UIActionPool(UIActionPoolType type);
-    ~UIActionPool();
+    /** Constructor of the action-pool of passed @a type. */
+    UIActionPool(UIActionPoolType type, bool fTemporary = false);
 
-    /* Helpers: Prepare/cleanup stuff: */
+    /** Prepare routine. */
     void prepare();
+    /** Prepare pool routine. */
+    virtual void preparePool();
+    /** Prepare connections routine. */
+    virtual void prepareConnections();
+    /** Cleanup connections routine. */
+    virtual void cleanupConnections() {}
+    /** Cleanup pool routine. */
+    virtual void cleanupPool();
+    /** Cleanup routine. */
     void cleanup();
 
-    /* Virtual helpers: Prepare/cleanup stuff: */
-    virtual void createActions();
-    virtual void createMenus();
-    virtual void destroyPool();
-
-    /* Helper: Event stuff: */
-    bool event(QEvent *pEvent);
-
-    /* Instance: */
-    static UIActionPool *m_pInstance;
-    /* Action pool type: */
-    UIActionPoolType m_type;
-    /* Actions pool itself: */
+    /** Update configuration routine. */
+    virtual void updateConfiguration();
+
+    /** Update menu routine. */
+    virtual void updateMenu(int iIndex);
+    /** Update menus routine. */
+    virtual void updateMenus() = 0;
+    /** Update 'Application' menu routine. */
+    virtual void updateMenuApplication();
+#ifdef RT_OS_DARWIN
+    /** Mac OS X: Update 'Window' menu routine. */
+    virtual void updateMenuWindow();
+#endif /* RT_OS_DARWIN */
+    /** Update 'Help' menu routine. */
+    virtual void updateMenuHelp();
+
+    /** Update shortcuts. */
+    virtual void updateShortcuts();
+
+    /** Translation handler. */
+    virtual void retranslateUi();
+
+    /** General event handler. */
+    virtual bool event(QEvent *pEvent);
+
+    /** Adds action into corresponding menu. */
+    bool addAction(UIMenu *pMenu, UIAction *pAction, bool fReallyAdd = true);
+    /** Adds action's menu into corresponding menu list. */
+    bool addMenu(QList<QMenu*> &menuList, UIAction *pAction, bool fReallyAdd = true);
+
+    /** Holds the action-pool type. */
+    const UIActionPoolType m_type;
+    /** Holds whether this action-pool is temporary. */
+    const bool m_fTemporary;
+
+    /** Holds the map of actions. */
     QMap<int, UIAction*> m_pool;
+    /** Holds the map of validation handlers. */
+    QMap<int, PointerToFunction> m_menuUpdateHandlers;
+    /** Holds the set of invalidated action indexes. */
+    QSet<int> m_invalidations;
+
+    /** Holds restricted menu types. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::MenuType> m_restrictedMenus;
+    /** Holds restricted action types of the 'Application' menu. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::MenuApplicationActionType> m_restrictedActionsMenuApplication;
+#ifdef Q_WS_MAC
+    /** Mac OS X: Holds restricted action types of the 'Window' menu. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::MenuWindowActionType> m_restrictedActionsMenuWindow;
+#endif /* Q_WS_MAC */
+    /** Holds restricted action types of the Help menu. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::MenuHelpActionType> m_restrictedActionsMenuHelp;
 };
 
-#define gActionPool UIActionPool::instance()
-
-#endif /* __UIActionPool_h__ */
-
+#endif /* !___UIActionPool_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.cpp
index c20446b..d330bde 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIAnimationFramework.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIAnimationFramework class implementation
+ * VBox Qt GUI - UIAnimationFramework class implementation.
  */
 
 /*
@@ -17,14 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QWidget>
-#include <QStateMachine>
-#include <QPropertyAnimation>
-#include <QSignalTransition>
+# include <QWidget>
+# include <QStateMachine>
+# include <QPropertyAnimation>
+# include <QSignalTransition>
 
 /* GUI includes: */
-#include "UIAnimationFramework.h"
+# include "UIAnimationFramework.h"
+
+/* Other VBox includes: */
+# include "iprt/assert.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static */
 UIAnimation* UIAnimation::installPropertyAnimation(QWidget *pTarget, const char *pszPropertyName,
@@ -68,13 +76,18 @@ UIAnimation::UIAnimation(QWidget *pParent, const char *pszPropertyName,
 
 void UIAnimation::prepare()
 {
+    /* Make sure parent asigned: */
+    AssertPtrReturnVoid(parent());
+
     /* Prepare animation-machine: */
     m_pAnimationMachine = new QStateMachine(this);
     /* Create 'start' state: */
     m_pStateStart = new QState(m_pAnimationMachine);
+    m_pStateStart->assignProperty(parent(), "AnimationState", QString("Start"));
     connect(m_pStateStart, SIGNAL(propertiesAssigned()), this, SIGNAL(sigStateEnteredStart()));
     /* Create 'final' state: */
     m_pStateFinal = new QState(m_pAnimationMachine);
+    m_pStateFinal->assignProperty(parent(), "AnimationState", QString("Final"));
     connect(m_pStateFinal, SIGNAL(propertiesAssigned()), this, SIGNAL(sigStateEnteredFinal()));
 
     /* Prepare 'forward' animation: */
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.h b/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.h
index 8bcd0b5..3026455 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.h
@@ -1,7 +1,6 @@
+/* $Id: UIAnimationFramework.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIAnimationFramework class declaration
+ * VBox Qt GUI - UIAnimationFramework class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
index b3754c4..5567015 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIDefs.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Global definitions and function implementations
+ * VBox Qt GUI - Global definitions.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,144 +15,18 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* GUI includes: */
-#include "UIDefs.h"
-
-/* Global definitions: */
-const char* UIDefs::GUI_RenderMode = "GUI/RenderMode";
-const char* UIDefs::GUI_LanguageId = "GUI/LanguageID";
-const char* UIDefs::GUI_ExtPackName = "Oracle VM VirtualBox Extension Pack";
-const char* UIDefs::GUI_PreventBetaWarning = "GUI/PreventBetaWarning";
-const char* UIDefs::GUI_RecentFolderHD = "GUI/RecentFolderHD";
-const char* UIDefs::GUI_RecentFolderCD = "GUI/RecentFolderCD";
-const char* UIDefs::GUI_RecentFolderFD = "GUI/RecentFolderFD";
-const char* UIDefs::GUI_RecentListHD = "GUI/RecentListHD";
-const char* UIDefs::GUI_RecentListCD = "GUI/RecentListCD";
-const char* UIDefs::GUI_RecentListFD = "GUI/RecentListFD";
-
-/* Selector-window definitions: */
-const char* UIDefs::GUI_Input_SelectorShortcuts = "GUI/Input/SelectorShortcuts";
-const char* UIDefs::GUI_LastSelectorWindowPosition = "GUI/LastWindowPosition";
-const char* UIDefs::GUI_SplitterSizes = "GUI/SplitterSizes";
-const char* UIDefs::GUI_Toolbar = "GUI/Toolbar";
-const char* UIDefs::GUI_Statusbar = "GUI/Statusbar";
-const char* UIDefs::GUI_PreviewUpdate = "GUI/PreviewUpdate";
-const char* UIDefs::GUI_DetailsPageBoxes = "GUI/DetailsPageBoxes";
-const char* UIDefs::GUI_SelectorVMPositions = "GUI/SelectorVMPositions";
-const char* UIDefs::GUI_LastVMSelected = "GUI/LastVMSelected";
-const char* UIDefs::GUI_LastItemSelected = "GUI/LastItemSelected";
-const char* UIDefs::GUI_GroupDefinitions = "GUI/GroupDefinitions";
-const char* UIDefs::GUI_HideFromManager = "GUI/HideFromManager";
-const char* UIDefs::GUI_PreventReconfiguration = "GUI/PreventReconfiguration";
-const char* UIDefs::GUI_PreventSnapshotOperations = "GUI/PreventSnapshotOperations";
-const char* UIDefs::GUI_HideDetails = "GUI/HideDetails";
-
-/* Machine-window definitions: */
-#ifndef Q_WS_MAC
-const char* UIDefs::GUI_MachineWindowIcons = "GUI/MachineWindowIcons";
-const char* UIDefs::GUI_MachineWindowNamePostfix = "GUI/MachineWindowNamePostfix";
-#endif /* !Q_WS_MAC */
-const char* UIDefs::GUI_RestrictedRuntimeMenus = "GUI/RestrictedRuntimeMenus";
-#ifdef Q_WS_MAC
-const char* UIDefs::GUI_RestrictedRuntimeApplicationMenuActions = "GUI/RestrictedRuntimeApplicationMenuActions";
-#endif /* Q_WS_MAC */
-const char* UIDefs::GUI_RestrictedRuntimeMachineMenuActions = "GUI/RestrictedRuntimeMachineMenuActions";
-const char* UIDefs::GUI_RestrictedRuntimeViewMenuActions = "GUI/RestrictedRuntimeViewMenuActions";
-const char* UIDefs::GUI_RestrictedRuntimeDevicesMenuActions = "GUI/RestrictedRuntimeDevicesMenuActions";
-#ifdef VBOX_WITH_DEBUGGER_GUI
-const char* UIDefs::GUI_RestrictedRuntimeDebuggerMenuActions = "GUI/RestrictedRuntimeDebuggerMenuActions";
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-const char* UIDefs::GUI_RestrictedRuntimeHelpMenuActions = "GUI/RestrictedRuntimeHelpMenuActions";
-const char* UIDefs::GUI_RestrictedVisualStates = "GUI/RestrictedVisualStates";
-const char* UIDefs::GUI_Input_MachineShortcuts = "GUI/Input/MachineShortcuts";
-const char* UIDefs::GUI_LastNormalWindowPosition = "GUI/LastNormalWindowPosition";
-const char* UIDefs::GUI_LastScaleWindowPosition = "GUI/LastScaleWindowPosition";
-const char* UIDefs::GUI_LastWindowState_Max = "max";
-const char* UIDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint";
-const char* UIDefs::GUI_LastGuestSizeHintWasFullscreen = "GUI/LastGuestSizeHintWasFullscreen";
-const char* UIDefs::GUI_Fullscreen = "GUI/Fullscreen";
-const char* UIDefs::GUI_Seamless = "GUI/Seamless";
-const char* UIDefs::GUI_Scale = "GUI/Scale";
-#ifdef Q_WS_X11
-const char* UIDefs::GUI_Fullscreen_LegacyMode = "GUI/Fullscreen/LegacyMode";
-#endif /* Q_WS_X11 */
-const char* UIDefs::GUI_VirtualScreenToHostScreen = "GUI/VirtualScreenToHostScreen";
-const char* UIDefs::GUI_AutoresizeGuest = "GUI/AutoresizeGuest";
-const char* UIDefs::GUI_AutomountGuestScreens = "GUI/AutomountGuestScreens";
-const char* UIDefs::GUI_SaveMountedAtRuntime = "GUI/SaveMountedAtRuntime";
-const char* UIDefs::GUI_PassCAD = "GUI/PassCAD";
-const char* UIDefs::GUI_DefaultCloseAction = "GUI/DefaultCloseAction";
-const char* UIDefs::GUI_RestrictedStatusBarIndicators = "GUI/RestrictedStatusBarIndicators";
-const char* UIDefs::GUI_HidLedsSync = "GUI/HidLedsSync";
-const char* UIDefs::GUI_MouseCapturePolicy = "GUI/MouseCapturePolicy";
-const char* UIDefs::GUI_GuruMeditationHandler = "GUI/GuruMeditationHandler";
-const char* UIDefs::GUI_HiDPIOptimization = "GUI/HiDPI/Optimization";
-
-/* Settings dialogs stuff: */
-const char* UIDefs::GUI_RestrictedGlobalSettingsPages = "GUI/RestrictedGlobalSettingsPages";
-const char* UIDefs::GUI_RestrictedMachineSettingsPages = "GUI/RestrictedMachineSettingsPages";
-
-/* Settings dialogs: Display page stuff: */
-const char* UIDefs::GUI_ActivateHoveredMachineWindow = "GUI/ActivateHoveredMachineWindow";
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/* Mini tool-bar definitions: */
-const char* UIDefs::GUI_ShowMiniToolBar = "GUI/ShowMiniToolBar";
-const char* UIDefs::GUI_MiniToolBarAlignment = "GUI/MiniToolBarAlignment";
-const char* UIDefs::GUI_MiniToolBarAutoHide = "GUI/MiniToolBarAutoHide";
-
-/* Close-dialog definitions: */
-const char* UIDefs::GUI_RestrictedCloseActions = "GUI/RestrictedCloseActions";
-const char* UIDefs::GUI_LastCloseAction = "GUI/LastCloseAction";
-const char* UIDefs::GUI_CloseActionHook = "GUI/CloseActionHook";
-
-/* Wizards definitions: */
-const char* UIDefs::GUI_FirstRun = "GUI/FirstRun";
-const char* UIDefs::GUI_HideDescriptionForWizards = "GUI/HideDescriptionForWizards";
-const char* UIDefs::GUI_Export_StorageType = "GUI/Export/StorageType";
-const char* UIDefs::GUI_Export_Username = "GUI/Export/Username";
-const char* UIDefs::GUI_Export_Hostname = "GUI/Export/Hostname";
-const char* UIDefs::GUI_Export_Bucket = "GUI/Export/Bucket";
-
-/* Message-center definitions: */
-const char* UIDefs::GUI_SuppressMessages = "GUI/SuppressMessages";
-const char* UIDefs::GUI_InvertMessageOption = "GUI/InvertMessageOption";
-
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-/* Update manager definitions: */
-const char* UIDefs::GUI_PreventApplicationUpdate = "GUI/PreventApplicationUpdate";
-const char* UIDefs::GUI_UpdateDate = "GUI/UpdateDate";
-const char* UIDefs::GUI_UpdateCheckCount = "GUI/UpdateCheckCount";
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
-/* Information dialog definitions: */
-const char* UIDefs::GUI_InfoDlgState = "GUI/InfoDlgState";
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-/* Debugger GUI declarations: */
-const char* UIDefs::GUI_DbgEnabled = "GUI/Dbg/Enabled";
-const char* UIDefs::GUI_DbgAutoShow = "GUI/Dbg/AutoShow";
-#endif /* VBOX_WITH_DEBUGGER_GUI */
+/* GUI includes: */
+# include "UIDefs.h"
 
-#ifdef Q_WS_X11
-/* License GUI declarations: */
-const char* UIDefs::GUI_LicenseKey = "GUI/LicenseAgreed";
-#endif /* Q_WS_X11 */
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#ifdef Q_WS_MAC
-/* Mac dock declarations: */
-const char* UIDefs::GUI_RealtimeDockIconUpdateEnabled = "GUI/RealtimeDockIconUpdateEnabled";
-const char* UIDefs::GUI_RealtimeDockIconUpdateMonitor = "GUI/RealtimeDockIconUpdateMonitor";
-const char* UIDefs::GUI_PresentationModeEnabled = "GUI/PresentationModeEnabled";
-#endif /* Q_WS_MAC */
 
-#ifdef VBOX_WITH_VIDEOHWACCEL
-/* Video-acceleration declarations: */
-const char* UIDefs::GUI_Accelerate2D_StretchLinear = "GUI/Accelerate2D/StretchLinear";
-const char* UIDefs::GUI_Accelerate2D_PixformatYV12 = "GUI/Accelerate2D/PixformatYV12";
-const char* UIDefs::GUI_Accelerate2D_PixformatUYVY = "GUI/Accelerate2D/PixformatUYVY";
-const char* UIDefs::GUI_Accelerate2D_PixformatYUY2 = "GUI/Accelerate2D/PixformatYUY2";
-const char* UIDefs::GUI_Accelerate2D_PixformatAYUV = "GUI/Accelerate2D/PixformatAYUV";
-#endif /* VBOX_WITH_VIDEOHWACCEL */
+/* Extension-pack definitions: */
+const char* UIDefs::GUI_ExtPackName = "Oracle VM VirtualBox Extension Pack";
 
 /* File extensions definitions: */
 QStringList UIDefs::VBoxFileExts = QStringList() << "xml" << "vbox";
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h b/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
index 532bfae..966d585 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h
@@ -1,9 +1,10 @@
+/* $Id: UIDefs.h $ */
 /** @file
- * VBox Qt GUI - UIDefs namespace and other global declarations.
+ * VBox Qt GUI - Global definitions.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,13 +25,14 @@
 /* COM includes: */
 #include "COMEnums.h"
 
-/* Other VBox defines: */
+#ifndef VBOX_WITH_PRECOMPILED_HEADERS
+/* Define GUI log group.
+ * This define should go *before* VBox/log.h include: */
 #define LOG_GROUP LOG_GROUP_GUI
-
+#endif
 /* Other VBox includes: */
 #include <VBox/log.h>
-#include <iprt/assert.h>
-#include <iprt/alloc.h>
+#include <VBox/com/defs.h>
 
 /* Defines: */
 #define MAC_LEOPARD_STYLE defined(Q_WS_MAC) && (QT_VERSION >= 0x040300)
@@ -49,19 +51,9 @@
 # define SIZEOF_ARRAY(a) (sizeof(a) / sizeof(a[0]))
 #endif /* SIZEOF_ARRAY */
 
-/* Global UI namespace: */
+/** Global namespace. */
 namespace UIDefs
 {
-    /* VM display rendering mode: */
-    enum RenderMode
-    {
-          InvalidRenderMode
-        , QImageMode
-#ifdef VBOX_GUI_USE_QUARTZ2D
-        , Quartz2DMode
-#endif /* VBOX_GUI_USE_QUARTZ2D */
-    };
-
     /* Additional Qt event types: */
     enum UIEventType
     {
@@ -89,151 +81,18 @@ namespace UIDefs
         FormatSize_RoundUp
     };
 
-    /* Global declarations: */
-    extern const char* GUI_RenderMode;
-    extern const char* GUI_LanguageId;
+    /* Extension-pack declarations: */
     extern const char* GUI_ExtPackName;
-    extern const char* GUI_PreventBetaWarning;
-    extern const char* GUI_RecentFolderHD;
-    extern const char* GUI_RecentFolderCD;
-    extern const char* GUI_RecentFolderFD;
-    extern const char* GUI_RecentListHD;
-    extern const char* GUI_RecentListCD;
-    extern const char* GUI_RecentListFD;
-
-    /* Selector-window declarations: */
-    extern const char* GUI_Input_SelectorShortcuts;
-    extern const char* GUI_LastSelectorWindowPosition;
-    extern const char* GUI_SplitterSizes;
-    extern const char* GUI_Toolbar;
-    extern const char* GUI_Statusbar;
-    extern const char* GUI_PreviewUpdate;
-    extern const char* GUI_DetailsPageBoxes;
-    extern const char* GUI_SelectorVMPositions;
-    extern const char* GUI_LastVMSelected;
-    extern const char* GUI_LastItemSelected;
-    extern const char* GUI_GroupDefinitions;
-    extern const char* GUI_HideFromManager;
-    extern const char* GUI_PreventReconfiguration;
-    extern const char* GUI_PreventSnapshotOperations;
-    extern const char* GUI_HideDetails;
-
-    /* Machine-window declarations: */
-#ifndef Q_WS_MAC
-    extern const char* GUI_MachineWindowIcons;
-    extern const char* GUI_MachineWindowNamePostfix;
-#endif /* !Q_WS_MAC */
-    extern const char* GUI_RestrictedRuntimeMenus;
-#ifdef Q_WS_MAC
-    extern const char* GUI_RestrictedRuntimeApplicationMenuActions;
-#endif /* Q_WS_MAC */
-    extern const char* GUI_RestrictedRuntimeMachineMenuActions;
-    extern const char* GUI_RestrictedRuntimeViewMenuActions;
-    extern const char* GUI_RestrictedRuntimeDevicesMenuActions;
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    extern const char* GUI_RestrictedRuntimeDebuggerMenuActions;
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-    extern const char* GUI_RestrictedRuntimeHelpMenuActions;
-    extern const char* GUI_RestrictedVisualStates;
-    extern const char* GUI_Input_MachineShortcuts;
-    extern const char* GUI_LastNormalWindowPosition;
-    extern const char* GUI_LastScaleWindowPosition;
-    extern const char* GUI_LastWindowState_Max;
-    extern const char* GUI_LastGuestSizeHint;
-    extern const char* GUI_LastGuestSizeHintWasFullscreen;
-    extern const char* GUI_Fullscreen;
-    extern const char* GUI_Seamless;
-    extern const char* GUI_Scale;
-#ifdef Q_WS_X11
-    extern const char* GUI_Fullscreen_LegacyMode;
-#endif /* Q_WS_X11 */
-    extern const char* GUI_VirtualScreenToHostScreen;
-    extern const char* GUI_AutoresizeGuest;
-    extern const char* GUI_AutomountGuestScreens;
-    extern const char* GUI_SaveMountedAtRuntime;
-    extern const char* GUI_PassCAD;
-    extern const char* GUI_DefaultCloseAction;
-    extern const char* GUI_RestrictedStatusBarIndicators;
-    extern const char* GUI_HidLedsSync;
-    extern const char* GUI_MouseCapturePolicy;
-    extern const char* GUI_GuruMeditationHandler;
-    extern const char* GUI_HiDPIOptimization;
-
-    /* Settings dialogs stuff: */
-    extern const char* GUI_RestrictedGlobalSettingsPages;
-    extern const char* GUI_RestrictedMachineSettingsPages;
-
-    /* Settings dialogs: Display page stuff: */
-    extern const char* GUI_ActivateHoveredMachineWindow;
-
-    /* Mini tool-bar declarations: */
-    extern const char* GUI_ShowMiniToolBar;
-    extern const char* GUI_MiniToolBarAlignment;
-    extern const char* GUI_MiniToolBarAutoHide;
-
-    /* Close-dialog declarations: */
-    extern const char* GUI_RestrictedCloseActions;
-    extern const char* GUI_LastCloseAction;
-    extern const char* GUI_CloseActionHook;
-
-    /* Wizards declarations: */
-    extern const char* GUI_FirstRun;
-    extern const char* GUI_HideDescriptionForWizards;
-    extern const char* GUI_Export_StorageType;
-    extern const char* GUI_Export_Username;
-    extern const char* GUI_Export_Hostname;
-    extern const char* GUI_Export_Bucket;
-
-    /* Message-center declarations: */
-    extern const char* GUI_SuppressMessages;
-    extern const char* GUI_InvertMessageOption;
-
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    /* Update manager declarations: */
-    extern const char* GUI_PreventApplicationUpdate;
-    extern const char* GUI_UpdateDate;
-    extern const char* GUI_UpdateCheckCount;
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
-    /* Information dialog declarations: */
-    extern const char* GUI_InfoDlgState;
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    /* Debugger GUI declarations: */
-    extern const char* GUI_DbgEnabled;
-    extern const char* GUI_DbgAutoShow;
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-
-#ifdef Q_WS_X11
-    /* License GUI declarations: */
-    extern const char* GUI_LicenseKey;
-#endif /* Q_WS_X11 */
-
-#ifdef Q_WS_MAC
-    /* Mac dock declarations: */
-    extern const char* GUI_RealtimeDockIconUpdateEnabled;
-    extern const char* GUI_RealtimeDockIconUpdateMonitor;
-    extern const char* GUI_PresentationModeEnabled;
-#endif /* Q_WS_MAC */
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    /* Video-acceleration declarations: */
-    extern const char* GUI_Accelerate2D_StretchLinear;
-    extern const char* GUI_Accelerate2D_PixformatYV12;
-    extern const char* GUI_Accelerate2D_PixformatUYVY;
-    extern const char* GUI_Accelerate2D_PixformatYUY2;
-    extern const char* GUI_Accelerate2D_PixformatAYUV;
-#endif /* VBOX_WITH_VIDEOHWACCEL */
 
     /* File extensions declarations: */
     extern QStringList VBoxFileExts;
     extern QStringList VBoxExtPackFileExts;
     extern QStringList OVFFileExts;
 }
-using namespace UIDefs /* globally */;
+using namespace UIDefs /* if header included */;
 
 #ifdef Q_WS_MAC
-/** Known MacOS X releases. */
+/** Mac OS X: Known OS releases. */
 enum MacOSXRelease
 {
     MacOSXRelease_Unknown,
@@ -245,6 +104,19 @@ enum MacOSXRelease
 };
 #endif /* Q_WS_MAC */
 
+/** Common UI: Size suffixes. */
+enum SizeSuffix
+{
+    SizeSuffix_Byte = 0,
+    SizeSuffix_KiloByte,
+    SizeSuffix_MegaByte,
+    SizeSuffix_GigaByte,
+    SizeSuffix_TeraByte,
+    SizeSuffix_PetaByte,
+    SizeSuffix_Max
+};
+
+/** Common UI: Storage-slot struct. */
 struct StorageSlot
 {
     StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
@@ -264,247 +136,4 @@ struct StorageSlot
 };
 Q_DECLARE_METATYPE(StorageSlot);
 
-/* Common UI size suffixes: */
-enum SizeSuffix
-{
-    SizeSuffix_Byte = 0,
-    SizeSuffix_KiloByte,
-    SizeSuffix_MegaByte,
-    SizeSuffix_GigaByte,
-    SizeSuffix_TeraByte,
-    SizeSuffix_PetaByte,
-    SizeSuffix_Max
-};
-
-/* Runtime UI menu types: */
-enum RuntimeMenuType
-{
-    RuntimeMenuType_Invalid = 0,
-    RuntimeMenuType_Machine = RT_BIT(0),
-    RuntimeMenuType_View    = RT_BIT(1),
-    RuntimeMenuType_Devices = RT_BIT(2),
-    RuntimeMenuType_Debug   = RT_BIT(3),
-    RuntimeMenuType_Help    = RT_BIT(4),
-    RuntimeMenuType_All     = 0xFF
-};
-
-#ifdef Q_WS_MAC
-/** Runtime UI: Application menu: Action types. */
-enum RuntimeMenuApplicationActionType
-{
-    RuntimeMenuApplicationActionType_Invalid = 0,
-    RuntimeMenuApplicationActionType_About   = RT_BIT(0),
-    RuntimeMenuApplicationActionType_All     = 0xFFFF
-};
-#endif /* Q_WS_MAC */
-
-/** Runtime UI: Machine menu: Action types. */
-enum RuntimeMenuMachineActionType
-{
-    RuntimeMenuMachineActionType_Invalid           = 0,
-    RuntimeMenuMachineActionType_SettingsDialog    = RT_BIT(0),
-    RuntimeMenuMachineActionType_TakeSnapshot      = RT_BIT(1),
-    RuntimeMenuMachineActionType_TakeScreenshot    = RT_BIT(2),
-    RuntimeMenuMachineActionType_InformationDialog = RT_BIT(3),
-    RuntimeMenuMachineActionType_MouseIntegration  = RT_BIT(4),
-    RuntimeMenuMachineActionType_TypeCAD           = RT_BIT(5),
-#ifdef Q_WS_X11
-    RuntimeMenuMachineActionType_TypeCABS          = RT_BIT(6),
-#endif /* Q_WS_X11 */
-    RuntimeMenuMachineActionType_Pause             = RT_BIT(7),
-    RuntimeMenuMachineActionType_Reset             = RT_BIT(8),
-    RuntimeMenuMachineActionType_SaveState         = RT_BIT(9),
-    RuntimeMenuMachineActionType_Shutdown          = RT_BIT(10),
-    RuntimeMenuMachineActionType_PowerOff          = RT_BIT(11),
-#ifndef Q_WS_MAC
-    RuntimeMenuMachineActionType_Close             = RT_BIT(12),
-#endif /* !Q_WS_MAC */
-    RuntimeMenuMachineActionType_All               = 0xFFFF
-};
-
-/** Runtime UI: View menu: Action types. */
-enum RuntimeMenuViewActionType
-{
-    RuntimeMenuViewActionType_Invalid         = 0,
-    RuntimeMenuViewActionType_Fullscreen      = RT_BIT(0),
-    RuntimeMenuViewActionType_Seamless        = RT_BIT(1),
-    RuntimeMenuViewActionType_Scale           = RT_BIT(2),
-    RuntimeMenuViewActionType_GuestAutoresize = RT_BIT(3),
-    RuntimeMenuViewActionType_AdjustWindow    = RT_BIT(4),
-    RuntimeMenuViewActionType_Multiscreen     = RT_BIT(5),
-    RuntimeMenuViewActionType_All             = 0xFFFF
-};
-
-/** Runtime UI: Devices menu: Action types. */
-enum RuntimeMenuDevicesActionType
-{
-    RuntimeMenuDevicesActionType_Invalid               = 0,
-    RuntimeMenuDevicesActionType_OpticalDevices        = RT_BIT(0),
-    RuntimeMenuDevicesActionType_FloppyDevices         = RT_BIT(1),
-    RuntimeMenuDevicesActionType_USBDevices            = RT_BIT(2),
-    RuntimeMenuDevicesActionType_WebCams               = RT_BIT(3),
-    RuntimeMenuDevicesActionType_SharedClipboard       = RT_BIT(4),
-    RuntimeMenuDevicesActionType_DragAndDrop           = RT_BIT(5),
-    RuntimeMenuDevicesActionType_NetworkSettings       = RT_BIT(6),
-    RuntimeMenuDevicesActionType_SharedFoldersSettings = RT_BIT(7),
-    RuntimeMenuDevicesActionType_VRDEServer            = RT_BIT(8),
-    RuntimeMenuDevicesActionType_VideoCapture          = RT_BIT(9),
-    RuntimeMenuDevicesActionType_InstallGuestTools     = RT_BIT(10),
-    RuntimeMenuDevicesActionType_All                   = 0xFFFF
-};
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-/** Runtime UI: Debugger menu: Action types. */
-enum RuntimeMenuDebuggerActionType
-{
-    RuntimeMenuDebuggerActionType_Invalid     = 0,
-    RuntimeMenuDebuggerActionType_Statistics  = RT_BIT(0),
-    RuntimeMenuDebuggerActionType_CommandLine = RT_BIT(1),
-    RuntimeMenuDebuggerActionType_Logging     = RT_BIT(2),
-    RuntimeMenuDebuggerActionType_LogDialog   = RT_BIT(3),
-    RuntimeMenuDebuggerActionType_All         = 0xFFFF
-};
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-
-/** Runtime UI: Help menu: Action types. */
-enum RuntimeMenuHelpActionType
-{
-    RuntimeMenuHelpActionType_Invalid              = 0,
-    RuntimeMenuHelpActionType_Contents             = RT_BIT(0),
-    RuntimeMenuHelpActionType_WebSite              = RT_BIT(1),
-    RuntimeMenuHelpActionType_ResetWarnings        = RT_BIT(2),
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    RuntimeMenuHelpActionType_NetworkAccessManager = RT_BIT(3),
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#ifndef Q_WS_MAC
-    RuntimeMenuHelpActionType_About                = RT_BIT(4),
-#endif /* !Q_WS_MAC */
-    RuntimeMenuHelpActionType_All                  = 0xFFFF
-};
-
-/* Runtime UI visual-state types: */
-enum UIVisualStateType
-{
-    UIVisualStateType_Invalid    = 0,
-    UIVisualStateType_Normal     = RT_BIT(0),
-    UIVisualStateType_Fullscreen = RT_BIT(1),
-    UIVisualStateType_Seamless   = RT_BIT(2),
-    UIVisualStateType_Scale      = RT_BIT(3),
-    UIVisualStateType_All        = 0xFF
-};
-Q_DECLARE_METATYPE(UIVisualStateType);
-
-/* Details element type: */
-enum DetailsElementType
-{
-    DetailsElementType_General,
-    DetailsElementType_System,
-    DetailsElementType_Preview,
-    DetailsElementType_Display,
-    DetailsElementType_Storage,
-    DetailsElementType_Audio,
-    DetailsElementType_Network,
-    DetailsElementType_Serial,
-#ifdef VBOX_WITH_PARALLEL_PORTS
-    DetailsElementType_Parallel,
-#endif /* VBOX_WITH_PARALLEL_PORTS */
-    DetailsElementType_USB,
-    DetailsElementType_SF,
-    DetailsElementType_Description
-};
-Q_DECLARE_METATYPE(DetailsElementType);
-
-/* Global settings page type: */
-enum GlobalSettingsPageType
-{
-    GlobalSettingsPageType_Invalid,
-    GlobalSettingsPageType_General,
-    GlobalSettingsPageType_Input,
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    GlobalSettingsPageType_Update,
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-    GlobalSettingsPageType_Language,
-    GlobalSettingsPageType_Display,
-    GlobalSettingsPageType_Network,
-    GlobalSettingsPageType_Extensions,
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    GlobalSettingsPageType_Proxy,
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-    GlobalSettingsPageType_Max
-};
-Q_DECLARE_METATYPE(GlobalSettingsPageType);
-
-/* Machine settings page type: */
-enum MachineSettingsPageType
-{
-    MachineSettingsPageType_Invalid,
-    MachineSettingsPageType_General,
-    MachineSettingsPageType_System,
-    MachineSettingsPageType_Display,
-    MachineSettingsPageType_Storage,
-    MachineSettingsPageType_Audio,
-    MachineSettingsPageType_Network,
-    MachineSettingsPageType_Ports,
-    MachineSettingsPageType_Serial,
-    MachineSettingsPageType_Parallel,
-    MachineSettingsPageType_USB,
-    MachineSettingsPageType_SF,
-    MachineSettingsPageType_Max
-};
-Q_DECLARE_METATYPE(MachineSettingsPageType);
-
-/* Indicator type: */
-enum IndicatorType
-{
-    IndicatorType_Invalid,
-    IndicatorType_HardDisks,
-    IndicatorType_OpticalDisks,
-    IndicatorType_FloppyDisks,
-    IndicatorType_Network,
-    IndicatorType_USB,
-    IndicatorType_SharedFolders,
-    IndicatorType_VideoCapture,
-    IndicatorType_Features,
-    IndicatorType_Mouse,
-    IndicatorType_Keyboard,
-    IndicatorType_Max
-};
-Q_DECLARE_METATYPE(IndicatorType);
-
-/* Machine close action: */
-enum MachineCloseAction
-{
-    MachineCloseAction_Invalid                    = 0,
-    MachineCloseAction_SaveState                  = RT_BIT(0),
-    MachineCloseAction_Shutdown                   = RT_BIT(1),
-    MachineCloseAction_PowerOff                   = RT_BIT(2),
-    MachineCloseAction_PowerOff_RestoringSnapshot = RT_BIT(3),
-    MachineCloseAction_All                        = 0xFF
-};
-Q_DECLARE_METATYPE(MachineCloseAction);
-
-/** Mouse capture policy types. */
-enum MouseCapturePolicy
-{
-    MouseCapturePolicy_Default,
-    MouseCapturePolicy_HostComboOnly,
-    MouseCapturePolicy_Disabled
-};
-
-/** Guru Meditation handler types. */
-enum GuruMeditationHandlerType
-{
-    GuruMeditationHandlerType_Default,
-    GuruMeditationHandlerType_PowerOff,
-    GuruMeditationHandlerType_Ignore
-};
-
-/** Runtime UI: HiDPI optimization types. */
-enum HiDPIOptimizationType
-{
-    HiDPIOptimizationType_None,
-    HiDPIOptimizationType_Performance
-};
-
 #endif /* !___UIDefs_h___ */
-
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.cpp
deleted file mode 100644
index 5128b76..0000000
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/* $Id: UIExtraDataEventHandler.cpp $ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIExtraDataEventHandler class implementation
- */
-
-/*
- * Copyright (C) 2010-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-/* Qt includes: */
-#include <QMutex>
-
-/* GUI includes: */
-#include "UIExtraDataEventHandler.h"
-#include "UIMainEventListener.h"
-#include "VBoxGlobal.h"
-#include "VBoxGlobalSettings.h"
-#include "UIActionPool.h"
-
-/* COM includes: */
-#include "COMEnums.h"
-#include "CEventSource.h"
-
-class UIExtraDataEventHandlerPrivate: public QObject
-{
-    Q_OBJECT;
-
-public:
-
-    UIExtraDataEventHandlerPrivate(QObject *pParent = 0)
-        : QObject(pParent)
-    {}
-
-public slots:
-
-    void sltExtraDataCanChange(QString strId, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason)
-    {
-        if (QUuid(strId).isNull())
-        {
-            /* it's a global extra data key someone wants to change */
-            if (strKey.startsWith("GUI/"))
-            {
-                /* Try to set the global setting to check its syntax */
-                VBoxGlobalSettings gs(false /* non-null */);
-                if (gs.setPublicProperty (strKey, strValue))
-                {
-                    /* this is a known GUI property key */
-                    if (!gs)
-                    {
-                        strVetoReason = gs.lastError();
-                        /* disallow the change when there is an error*/
-                        fVeto = true;
-                    }
-                    return;
-                }
-            }
-        }
-    }
-
-    void sltExtraDataChange(QString strId, QString strKey, QString strValue)
-    {
-        if (QUuid(strId).isNull())
-        {
-            if (strKey.startsWith ("GUI/"))
-            {
-                if (strKey == GUI_LanguageId)
-                    emit sigGUILanguageChange(strValue);
-                if (strKey == GUI_Input_SelectorShortcuts && gActionPool->type() == UIActionPoolType_Selector)
-                    emit sigSelectorShortcutsChanged();
-                if (strKey == GUI_Input_MachineShortcuts && gActionPool->type() == UIActionPoolType_Runtime)
-                    emit sigMachineShortcutsChanged();
-#ifdef Q_WS_MAC
-                if (strKey == GUI_PresentationModeEnabled)
-                {
-                    /* Default to true if it is an empty value */
-                    QString testStr = strValue.toLower();
-                    bool f = (testStr.isEmpty() || testStr == "false");
-                    emit sigPresentationModeChange(f);
-                }
-#endif /* Q_WS_MAC */
-
-                m_mutex.lock();
-                vboxGlobal().settings().setPublicProperty(strKey, strValue);
-                m_mutex.unlock();
-                Assert(!!vboxGlobal().settings());
-            }
-        }
-        else if (vboxGlobal().isVMConsoleProcess())
-        {
-            /* Take care about HID LEDs sync */
-            if (strKey == GUI_HidLedsSync)
-            {
-                /* If extra data GUI/HidLedsSync is not present in VM config or set
-                 * to 1 then sync is enabled. Otherwise, it is disabled. */
-
-                /* (temporary disabled by default) */
-                bool f = (strValue == "1") ? true : false;
-                emit sigHidLedsSyncStateChanged(f);
-            }
-
-#ifdef Q_WS_MAC
-            /* Check for the currently running machine */
-            if (strId == vboxGlobal().managedVMUuid())
-            {
-                if (   strKey == GUI_RealtimeDockIconUpdateEnabled
-                    || strKey == GUI_RealtimeDockIconUpdateMonitor)
-                {
-                    bool f = strValue.toLower() == "false" ? false : true;
-                    emit sigDockIconAppearanceChange(f);
-                }
-            }
-#endif /* Q_WS_MAC */
-        }
-    }
-
-signals:
-
-    void sigGUILanguageChange(QString strLang);
-    void sigSelectorShortcutsChanged();
-    void sigMachineShortcutsChanged();
-    void sigHidLedsSyncStateChanged(bool fEnabled);
-#ifdef RT_OS_DARWIN
-    void sigPresentationModeChange(bool fEnabled);
-    void sigDockIconAppearanceChange(bool fEnabled);
-#endif /* RT_OS_DARWIN */
-
-private:
-
-    /** protects #OnExtraDataChange() */
-    QMutex m_mutex;
-};
-
-/* static */
-UIExtraDataEventHandler *UIExtraDataEventHandler::m_pInstance = 0;
-
-/* static */
-UIExtraDataEventHandler* UIExtraDataEventHandler::instance()
-{
-    if (!m_pInstance)
-        m_pInstance = new UIExtraDataEventHandler();
-    return m_pInstance;
-}
-
-/* static */
-void UIExtraDataEventHandler::destroy()
-{
-    if (m_pInstance)
-    {
-        delete m_pInstance;
-        m_pInstance = 0;
-    }
-}
-
-UIExtraDataEventHandler::UIExtraDataEventHandler()
-  : m_pHandler(new UIExtraDataEventHandlerPrivate(this))
-{
-//    RTPrintf("Self add: %RTthrd\n", RTThreadSelf());
-    const CVirtualBox &vbox = vboxGlobal().virtualBox();
-    ComObjPtr<UIMainEventListenerImpl> pListener;
-    pListener.createObject();
-    pListener->init(new UIMainEventListener(), this);
-    m_mainEventListener = CEventListener(pListener);
-    QVector<KVBoxEventType> events;
-    events
-        << KVBoxEventType_OnExtraDataCanChange
-        << KVBoxEventType_OnExtraDataChanged;
-
-    vbox.GetEventSource().RegisterListener(m_mainEventListener, events, TRUE);
-    AssertWrapperOk(vbox);
-
-    /* This is a vetoable event, so we have to respond to the event and have to
-     * use a direct connection therefor. */
-    connect(pListener->getWrapped(), SIGNAL(sigExtraDataCanChange(QString, QString, QString, bool&, QString&)),
-            m_pHandler, SLOT(sltExtraDataCanChange(QString, QString, QString, bool&, QString&)),
-            Qt::DirectConnection);
-
-    /* Use a direct connection to the helper class. */
-    connect(pListener->getWrapped(), SIGNAL(sigExtraDataChange(QString, QString, QString)),
-            m_pHandler, SLOT(sltExtraDataChange(QString, QString, QString)),
-            Qt::DirectConnection);
-
-    /* UI signals */
-    connect(m_pHandler, SIGNAL(sigGUILanguageChange(QString)),
-            this, SIGNAL(sigGUILanguageChange(QString)),
-            Qt::QueuedConnection);
-
-    connect(m_pHandler, SIGNAL(sigSelectorShortcutsChanged()),
-            this, SIGNAL(sigSelectorShortcutsChanged()),
-            Qt::QueuedConnection);
-
-    connect(m_pHandler, SIGNAL(sigMachineShortcutsChanged()),
-            this, SIGNAL(sigMachineShortcutsChanged()),
-            Qt::QueuedConnection);
-
-    connect(m_pHandler, SIGNAL(sigHidLedsSyncStateChanged(bool)),
-            this, SIGNAL(sigHidLedsSyncStateChanged(bool)),
-            Qt::QueuedConnection);
-
-#ifdef Q_WS_MAC
-    connect(m_pHandler, SIGNAL(sigPresentationModeChange(bool)),
-            this, SIGNAL(sigPresentationModeChange(bool)),
-            Qt::QueuedConnection);
-
-    connect(m_pHandler, SIGNAL(sigDockIconAppearanceChange(bool)),
-            this, SIGNAL(sigDockIconAppearanceChange(bool)),
-            Qt::QueuedConnection);
-#endif /* Q_WS_MAC */
-}
-
-UIExtraDataEventHandler::~UIExtraDataEventHandler()
-{
-    const CVirtualBox &vbox = vboxGlobal().virtualBox();
-    vbox.GetEventSource().UnregisterListener(m_mainEventListener);
-}
-
-#include "UIExtraDataEventHandler.moc"
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.h b/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.h
deleted file mode 100644
index 92a035a..0000000
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIExtraDataEventHandler class declaration
- */
-
-/*
- * Copyright (C) 2010-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef __UIExtraDataEventHandler_h__
-#define __UIExtraDataEventHandler_h__
-
-/* COM includes: */
-#include "CEventListener.h"
-
-/* Forward declarations: */
-class UIExtraDataEventHandlerPrivate;
-
-class UIExtraDataEventHandler: public QObject
-{
-    Q_OBJECT;
-
-public:
-    static UIExtraDataEventHandler* instance();
-    static void destroy();
-
-signals:
-    /* Specialized extra data signals */
-    void sigGUILanguageChange(QString strLang);
-    void sigSelectorShortcutsChanged();
-    void sigMachineShortcutsChanged();
-    void sigHidLedsSyncStateChanged(bool fEnabled);
-#ifdef RT_OS_DARWIN
-    void sigPresentationModeChange(bool fEnabled);
-    void sigDockIconAppearanceChange(bool fEnabled);
-#endif /* RT_OS_DARWIN */
-
-private:
-    UIExtraDataEventHandler();
-    ~UIExtraDataEventHandler();
-
-    /* Private member vars */
-    static UIExtraDataEventHandler *m_pInstance;
-    CEventListener m_mainEventListener;
-    UIExtraDataEventHandlerPrivate *m_pHandler;
-};
-
-#define gEDataEvents UIExtraDataEventHandler::instance()
-
-#endif /* !__UIExtraDataEventHandler_h__ */
-
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.cpp
index d9acfc9..0204ea9 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIIconPool.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIIconPool class implementation
+ * VBox Qt GUI - UIIconPool class implementation.
  */
 
 /*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,32 +15,32 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Local includes */
-#include "UIIconPool.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/* Global includes */
-#include <iprt/assert.h>
+/* Qt includes: */
+# include <QApplication>
+# include <QWidget>
+# include <QStyle>
 
-#include <QApplication>
-#include <QWidget>
+/* GUI includes: */
+# include "UIIconPool.h"
 
-/* static */
-QIcon UIIconPool::iconSet(const QPixmap &normal,
-                          const QPixmap &disabled /* = QPixmap() */,
-                          const QPixmap &active /* = QPixmap() */)
-{
-    QIcon iconSet;
+/* Other VBox includes: */
+# include <iprt/assert.h>
 
-    Assert(!normal.isNull());
-    iconSet.addPixmap(normal, QIcon::Normal);
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-    if (!disabled.isNull())
-        iconSet.addPixmap(disabled, QIcon::Disabled);
 
-    if (!active.isNull())
-        iconSet.addPixmap(active, QIcon::Active);
+/* static */
+QPixmap UIIconPool::pixmap(const QString &strName)
+{
+    /* Reuse iconSet API: */
+    QIcon icon = iconSet(strName);
 
-    return iconSet;
+    /* Return pixmap of first available size: */
+    return icon.pixmap(icon.availableSizes().first());
 }
 
 /* static */
@@ -50,95 +48,131 @@ QIcon UIIconPool::iconSet(const QString &strNormal,
                           const QString &strDisabled /* = QString() */,
                           const QString &strActive /* = QString() */)
 {
-    QIcon iconSet;
+    /* Prepare fallback icon: */
+    static QIcon nullIcon;
+
+    /* Prepare icon: */
+    QIcon icon;
 
-    Assert(!strNormal.isEmpty());
-    iconSet.addFile(strNormal, QSize(),
-                    QIcon::Normal);
+    /* Add 'normal' pixmap: */
+    AssertReturn(!strNormal.isEmpty(), nullIcon);
+    addName(icon, strNormal, QIcon::Normal);
+
+    /* Add 'disabled' pixmap (if any): */
     if (!strDisabled.isEmpty())
-        iconSet.addFile(strDisabled, QSize(),
-                        QIcon::Disabled);
+        addName(icon, strDisabled, QIcon::Disabled);
+
+    /* Add 'active' pixmap (if any): */
     if (!strActive.isEmpty())
-        iconSet.addFile(strActive, QSize(),
-                        QIcon::Active);
-    return iconSet;
+        addName(icon, strActive, QIcon::Active);
+
+    /* Return icon: */
+    return icon;
 }
 
 /* static */
 QIcon UIIconPool::iconSetOnOff(const QString &strNormal, const QString strNormalOff,
-                               const QString &strDisabled /* = QString() */,
-                               const QString &strDisabledOff /* = QString() */,
-                               const QString &strActive /* = QString() */,
-                               const QString &strActiveOff /* = QString() */)
+                               const QString &strDisabled /* = QString() */, const QString &strDisabledOff /* = QString() */,
+                               const QString &strActive /* = QString() */, const QString &strActiveOff /* = QString() */)
 {
-    QIcon iconSet;
+    /* Prepare fallback icon: */
+    static QIcon nullIcon;
+
+    /* Prepare icon: */
+    QIcon icon;
 
-    Assert(!strNormal.isEmpty());
-    iconSet.addFile(strNormal, QSize(), QIcon::Normal, QIcon::On);
-    if (!strNormalOff.isEmpty())
-        iconSet.addFile(strNormalOff, QSize(), QIcon::Normal, QIcon::Off);
+    /* Add 'normal' on/off pixmaps: */
+    AssertReturn(!strNormal.isEmpty(), nullIcon);
+    addName(icon, strNormal, QIcon::Normal, QIcon::On);
+    AssertReturn(!strNormalOff.isEmpty(), nullIcon);
+    addName(icon, strNormalOff, QIcon::Normal, QIcon::Off);
 
+    /* Add 'disabled' on/off pixmaps (if any): */
     if (!strDisabled.isEmpty())
-        iconSet.addFile(strDisabled, QSize(), QIcon::Disabled, QIcon::On);
+        addName(icon, strDisabled, QIcon::Disabled, QIcon::On);
     if (!strDisabledOff.isEmpty())
-        iconSet.addFile(strDisabledOff, QSize(), QIcon::Disabled, QIcon::Off);
+        addName(icon, strDisabledOff, QIcon::Disabled, QIcon::Off);
 
+    /* Add 'active' on/off pixmaps (if any): */
     if (!strActive.isEmpty())
-        iconSet.addFile(strActive, QSize(), QIcon::Active, QIcon::On);
+        addName(icon, strActive, QIcon::Active, QIcon::On);
     if (!strActiveOff.isEmpty())
-        iconSet.addFile(strActive, QSize(), QIcon::Active, QIcon::Off);
+        addName(icon, strActiveOff, QIcon::Active, QIcon::Off);
 
-    return iconSet;
+    /* Return icon: */
+    return icon;
 }
 
 /* static */
-QIcon UIIconPool::iconSetFull(const QSize &normalSize, const QSize &smallSize,
-                              const QString &strNormal, const QString &strSmallNormal,
-                              const QString &strDisabled /* = QString() */,
-                              const QString &strSmallDisabled /* = QString() */,
-                              const QString &strActive /* = QString() */,
-                              const QString &strSmallActive /* = QString() */)
+QIcon UIIconPool::iconSetFull(const QString &strNormal, const QString &strSmall,
+                              const QString &strNormalDisabled /* = QString() */, const QString &strSmallDisabled /* = QString() */,
+                              const QString &strNormalActive /* = QString() */, const QString &strSmallActive /* = QString() */)
 {
-    QIcon iconSet;
+    /* Prepare fallback icon: */
+    static QIcon nullIcon;
+
+    /* Prepare icon: */
+    QIcon icon;
 
-    Assert(!strNormal.isEmpty());
-    Assert(!strSmallNormal.isEmpty());
-    iconSet.addFile(strNormal, normalSize, QIcon::Normal);
-    iconSet.addFile(strSmallNormal, smallSize, QIcon::Normal);
+    /* Add 'normal' & 'small normal' pixmaps: */
+    AssertReturn(!strNormal.isEmpty(), nullIcon);
+    addName(icon, strNormal, QIcon::Normal);
+    AssertReturn(!strSmall.isEmpty(), nullIcon);
+    addName(icon, strSmall, QIcon::Normal);
 
+    /* Add 'disabled' & 'small disabled' pixmaps (if any): */
+    if (!strNormalDisabled.isEmpty())
+        addName(icon, strNormalDisabled, QIcon::Disabled);
     if (!strSmallDisabled.isEmpty())
-    {
-        iconSet.addFile(strDisabled, normalSize, QIcon::Disabled);
-        iconSet.addFile(strSmallDisabled, smallSize, QIcon::Disabled);
-    }
+        addName(icon, strSmallDisabled, QIcon::Disabled);
 
+    /* Add 'active' & 'small active' pixmaps (if any): */
+    if (!strNormalActive.isEmpty())
+        addName(icon, strNormalActive, QIcon::Active);
     if (!strSmallActive.isEmpty())
-    {
-        iconSet.addFile(strActive, normalSize, QIcon::Active);
-        iconSet.addFile(strSmallActive, smallSize, QIcon::Active);
-    }
+        addName(icon, strSmallActive, QIcon::Active);
+
+    /* Return icon: */
+    return icon;
+}
+
+/* static */
+QIcon UIIconPool::iconSet(const QPixmap &normal,
+                          const QPixmap &disabled /* = QPixmap() */,
+                          const QPixmap &active /* = QPixmap() */)
+{
+    QIcon iconSet;
+
+    Assert(!normal.isNull());
+    iconSet.addPixmap(normal, QIcon::Normal);
+
+    if (!disabled.isNull())
+        iconSet.addPixmap(disabled, QIcon::Disabled);
+
+    if (!active.isNull())
+        iconSet.addPixmap(active, QIcon::Active);
 
     return iconSet;
 }
 
 /* static */
-QIcon UIIconPool::defaultIcon(UIDefaultIcon def, const QWidget *pWidget /* = 0 */)
+QIcon UIIconPool::defaultIcon(UIDefaultIconType defaultIconType, const QWidget *pWidget /* = 0 */)
 {
     QIcon icon;
     QStyle *pStyle = pWidget ? pWidget->style() : QApplication::style();
-    switch (def)
+    switch (defaultIconType)
     {
-        case MessageBoxInformationIcon:
+        case UIDefaultIconType_MessageBoxInformation:
         {
             icon = pStyle->standardIcon(QStyle::SP_MessageBoxInformation, 0, pWidget);
             break;
         }
-        case MessageBoxQuestionIcon:
+        case UIDefaultIconType_MessageBoxQuestion:
         {
             icon = pStyle->standardIcon(QStyle::SP_MessageBoxQuestion, 0, pWidget);
             break;
         }
-        case MessageBoxWarningIcon:
+        case UIDefaultIconType_MessageBoxWarning:
         {
 #ifdef Q_WS_MAC
             /* At least in Qt 4.3.4/4.4 RC1 SP_MessageBoxWarning is the application
@@ -150,26 +184,26 @@ QIcon UIIconPool::defaultIcon(UIDefaultIcon def, const QWidget *pWidget /* = 0 *
 #endif /* !Q_WS_MAC */
             break;
         }
-        case MessageBoxCriticalIcon:
+        case UIDefaultIconType_MessageBoxCritical:
         {
             icon = pStyle->standardIcon(QStyle::SP_MessageBoxCritical, 0, pWidget);
             break;
         }
-        case DialogCancelIcon:
+        case UIDefaultIconType_DialogCancel:
         {
             icon = pStyle->standardIcon(QStyle::SP_DialogCancelButton, 0, pWidget);
             if (icon.isNull())
                 icon = iconSet(":/cancel_16px.png");
             break;
         }
-        case DialogHelpIcon:
+        case UIDefaultIconType_DialogHelp:
         {
             icon = pStyle->standardIcon(QStyle::SP_DialogHelpButton, 0, pWidget);
             if (icon.isNull())
                 icon = iconSet(":/help_16px.png");
             break;
         }
-        case ArrowBackIcon:
+        case UIDefaultIconType_ArrowBack:
         {
             icon = pStyle->standardIcon(QStyle::SP_ArrowBack, 0, pWidget);
             if (icon.isNull())
@@ -177,7 +211,7 @@ QIcon UIIconPool::defaultIcon(UIDefaultIcon def, const QWidget *pWidget /* = 0 *
                                ":/list_moveup_disabled_16px.png");
             break;
         }
-        case ArrowForwardIcon:
+        case UIDefaultIconType_ArrowForward:
         {
             icon = pStyle->standardIcon(QStyle::SP_ArrowForward, 0, pWidget);
             if (icon.isNull())
@@ -194,3 +228,161 @@ QIcon UIIconPool::defaultIcon(UIDefaultIcon def, const QWidget *pWidget /* = 0 *
     return icon;
 }
 
+/* static */
+void UIIconPool::addName(QIcon &icon, const QString &strName,
+                         QIcon::Mode mode /* = QIcon::Normal */, QIcon::State state /* = QIcon::Off */)
+{
+    /* Prepare pixmap on the basis of passed value: */
+    QPixmap pixmap(strName);
+    /* Add pixmap: */
+    icon.addPixmap(pixmap, mode, state);
+
+#ifdef Q_WS_MAC
+# ifdef VBOX_GUI_WITH_HIDPI
+    /* Test if HiDPI icons are enabled. Works only with a patched version of Qt 4.x
+     * with the changes from https://codereview.qt-project.org/#change,54636 applied. */
+    if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps))
+        return;
+# else /* !VBOX_GUI_WITH_HIDPI */
+    /* Otherwise HiDPI icons are useless: */
+    return;
+# endif /* !VBOX_GUI_WITH_HIDPI */
+#endif /* Q_WS_MAC */
+
+    /* Parse name to prefix and suffix: */
+    QString strPrefix = strName.section('.', 0, -2);
+    QString strSuffix = strName.section('.', -1, -1);
+    /* Prepare HiDPI pixmap on the basis of values above: */
+    QPixmap pixmapHiDPI(strPrefix + "_hidpi." + strSuffix);
+    /* Add HiDPI pixmap (if any): */
+    if (!pixmapHiDPI.isNull())
+        icon.addPixmap(pixmapHiDPI, mode, state);
+}
+
+
+UIIconPoolGeneral::UIIconPoolGeneral()
+{
+    /* Prepare OS type icon-name hash: */
+    m_guestOSTypeIconNames.insert("Other",           ":/os_other.png");
+    m_guestOSTypeIconNames.insert("Other_64",        ":/os_other_64.png");
+    m_guestOSTypeIconNames.insert("DOS",             ":/os_dos.png");
+    m_guestOSTypeIconNames.insert("Netware",         ":/os_netware.png");
+    m_guestOSTypeIconNames.insert("L4",              ":/os_l4.png");
+    m_guestOSTypeIconNames.insert("Windows31",       ":/os_win31.png");
+    m_guestOSTypeIconNames.insert("Windows95",       ":/os_win95.png");
+    m_guestOSTypeIconNames.insert("Windows98",       ":/os_win98.png");
+    m_guestOSTypeIconNames.insert("WindowsMe",       ":/os_winme.png");
+    m_guestOSTypeIconNames.insert("WindowsNT4",      ":/os_winnt4.png");
+    m_guestOSTypeIconNames.insert("Windows2000",     ":/os_win2k.png");
+    m_guestOSTypeIconNames.insert("WindowsXP",       ":/os_winxp.png");
+    m_guestOSTypeIconNames.insert("WindowsXP_64",    ":/os_winxp_64.png");
+    m_guestOSTypeIconNames.insert("Windows2003",     ":/os_win2k3.png");
+    m_guestOSTypeIconNames.insert("Windows2003_64",  ":/os_win2k3_64.png");
+    m_guestOSTypeIconNames.insert("WindowsVista",    ":/os_winvista.png");
+    m_guestOSTypeIconNames.insert("WindowsVista_64", ":/os_winvista_64.png");
+    m_guestOSTypeIconNames.insert("Windows2008",     ":/os_win2k8.png");
+    m_guestOSTypeIconNames.insert("Windows2008_64",  ":/os_win2k8_64.png");
+    m_guestOSTypeIconNames.insert("Windows7",        ":/os_win7.png");
+    m_guestOSTypeIconNames.insert("Windows7_64",     ":/os_win7_64.png");
+    m_guestOSTypeIconNames.insert("Windows8",        ":/os_win8.png");
+    m_guestOSTypeIconNames.insert("Windows8_64",     ":/os_win8_64.png");
+    m_guestOSTypeIconNames.insert("Windows81",       ":/os_win81.png");
+    m_guestOSTypeIconNames.insert("Windows81_64",    ":/os_win81_64.png");
+    m_guestOSTypeIconNames.insert("Windows2012_64",  ":/os_win2k12_64.png");
+    m_guestOSTypeIconNames.insert("Windows10",       ":/os_win10.png");
+    m_guestOSTypeIconNames.insert("Windows10_64",    ":/os_win10_64.png");
+    m_guestOSTypeIconNames.insert("WindowsNT",       ":/os_win_other.png");
+    m_guestOSTypeIconNames.insert("WindowsNT_64",    ":/os_win_other.png"); /// @todo os_win_other_64
+    m_guestOSTypeIconNames.insert("OS2Warp3",        ":/os_os2warp3.png");
+    m_guestOSTypeIconNames.insert("OS2Warp4",        ":/os_os2warp4.png");
+    m_guestOSTypeIconNames.insert("OS2Warp45",       ":/os_os2warp45.png");
+    m_guestOSTypeIconNames.insert("OS2eCS",          ":/os_os2ecs.png");
+    m_guestOSTypeIconNames.insert("OS21x",           ":/os_os2_other.png");
+    m_guestOSTypeIconNames.insert("OS2",             ":/os_os2_other.png");
+    m_guestOSTypeIconNames.insert("Linux22",         ":/os_linux22.png");
+    m_guestOSTypeIconNames.insert("Linux24",         ":/os_linux24.png");
+    m_guestOSTypeIconNames.insert("Linux24_64",      ":/os_linux24_64.png");
+    m_guestOSTypeIconNames.insert("Linux26",         ":/os_linux26.png");
+    m_guestOSTypeIconNames.insert("Linux26_64",      ":/os_linux26_64.png");
+    m_guestOSTypeIconNames.insert("ArchLinux",       ":/os_archlinux.png");
+    m_guestOSTypeIconNames.insert("ArchLinux_64",    ":/os_archlinux_64.png");
+    m_guestOSTypeIconNames.insert("Debian",          ":/os_debian.png");
+    m_guestOSTypeIconNames.insert("Debian_64",       ":/os_debian_64.png");
+    m_guestOSTypeIconNames.insert("OpenSUSE",        ":/os_opensuse.png");
+    m_guestOSTypeIconNames.insert("OpenSUSE_64",     ":/os_opensuse_64.png");
+    m_guestOSTypeIconNames.insert("Fedora",          ":/os_fedora.png");
+    m_guestOSTypeIconNames.insert("Fedora_64",       ":/os_fedora_64.png");
+    m_guestOSTypeIconNames.insert("Gentoo",          ":/os_gentoo.png");
+    m_guestOSTypeIconNames.insert("Gentoo_64",       ":/os_gentoo_64.png");
+    m_guestOSTypeIconNames.insert("Mandriva",        ":/os_mandriva.png");
+    m_guestOSTypeIconNames.insert("Mandriva_64",     ":/os_mandriva_64.png");
+    m_guestOSTypeIconNames.insert("RedHat",          ":/os_redhat.png");
+    m_guestOSTypeIconNames.insert("RedHat_64",       ":/os_redhat_64.png");
+    m_guestOSTypeIconNames.insert("Turbolinux",      ":/os_turbolinux.png");
+    m_guestOSTypeIconNames.insert("Turbolinux_64",   ":/os_turbolinux_64.png");
+    m_guestOSTypeIconNames.insert("Ubuntu",          ":/os_ubuntu.png");
+    m_guestOSTypeIconNames.insert("Ubuntu_64",       ":/os_ubuntu_64.png");
+    m_guestOSTypeIconNames.insert("Xandros",         ":/os_xandros.png");
+    m_guestOSTypeIconNames.insert("Xandros_64",      ":/os_xandros_64.png");
+    m_guestOSTypeIconNames.insert("Oracle",          ":/os_oracle.png");
+    m_guestOSTypeIconNames.insert("Oracle_64",       ":/os_oracle_64.png");
+    m_guestOSTypeIconNames.insert("Linux",           ":/os_linux_other.png");
+    m_guestOSTypeIconNames.insert("Linux_64",        ":/os_linux_other.png"); /// @todo os_linux_other_64
+    m_guestOSTypeIconNames.insert("FreeBSD",         ":/os_freebsd.png");
+    m_guestOSTypeIconNames.insert("FreeBSD_64",      ":/os_freebsd_64.png");
+    m_guestOSTypeIconNames.insert("OpenBSD",         ":/os_openbsd.png");
+    m_guestOSTypeIconNames.insert("OpenBSD_64",      ":/os_openbsd_64.png");
+    m_guestOSTypeIconNames.insert("NetBSD",          ":/os_netbsd.png");
+    m_guestOSTypeIconNames.insert("NetBSD_64",       ":/os_netbsd_64.png");
+    m_guestOSTypeIconNames.insert("Solaris",         ":/os_solaris.png");
+    m_guestOSTypeIconNames.insert("Solaris_64",      ":/os_solaris_64.png");
+    m_guestOSTypeIconNames.insert("OpenSolaris",     ":/os_oraclesolaris.png");
+    m_guestOSTypeIconNames.insert("OpenSolaris_64",  ":/os_oraclesolaris_64.png");
+    m_guestOSTypeIconNames.insert("Solaris11_64",    ":/os_oraclesolaris_64.png");
+    m_guestOSTypeIconNames.insert("QNX",             ":/os_qnx.png");
+    m_guestOSTypeIconNames.insert("MacOS",           ":/os_macosx.png");
+    m_guestOSTypeIconNames.insert("MacOS_64",        ":/os_macosx_64.png");
+    m_guestOSTypeIconNames.insert("MacOS106",        ":/os_macosx.png");
+    m_guestOSTypeIconNames.insert("MacOS106_64",     ":/os_macosx_64.png");
+    m_guestOSTypeIconNames.insert("MacOS107_64",     ":/os_macosx_64.png");
+    m_guestOSTypeIconNames.insert("MacOS108_64",     ":/os_macosx_64.png");
+    m_guestOSTypeIconNames.insert("MacOS109_64",     ":/os_macosx_64.png");
+    m_guestOSTypeIconNames.insert("JRockitVE",       ":/os_jrockitve.png");
+}
+
+QPixmap UIIconPoolGeneral::guestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize /* = 0 */) const
+{
+    /* Prepare fallback pixmap: */
+    static QPixmap nullPixmap;
+
+    /* If we do NOT have that 'guest OS type' icon cached already: */
+    if (!m_guestOSTypeIcons.contains(strOSTypeID))
+    {
+        /* Compose proper icon if we have that 'guest OS type' known: */
+        if (m_guestOSTypeIconNames.contains(strOSTypeID))
+            m_guestOSTypeIcons[strOSTypeID] = iconSet(m_guestOSTypeIconNames[strOSTypeID]);
+        /* Assign fallback icon if we do NOT have that 'guest OS type' known: */
+        else
+            m_guestOSTypeIcons[strOSTypeID] = iconSet(nullPixmap);
+    }
+
+    /* Retrieve corresponding icon: */
+    const QIcon &icon = m_guestOSTypeIcons[strOSTypeID];
+    AssertMsgReturn(!icon.isNull(),
+                    ("Undefined icon for type '%s'.", strOSTypeID.toLatin1().constData()),
+                    nullPixmap);
+
+    /* Retrieve available sizes for that icon: */
+    const QList<QSize> availableSizes = icon.availableSizes();
+    AssertMsgReturn(!availableSizes.isEmpty(),
+                    ("Undefined icon for type '%s'.", strOSTypeID.toLatin1().constData()),
+                    nullPixmap);
+
+    /* Pass up logical size if necessary: */
+    if (pLogicalSize)
+        *pLogicalSize = availableSizes.first();
+
+    /* Return pixmap of first available size: */
+    return icon.pixmap(availableSizes.first());
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.h b/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.h
index 24d0a79..18a945e 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.h
@@ -1,11 +1,10 @@
+/* $Id: UIIconPool.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIIconPool class declarations
+ * VBox Qt GUI - UIIconPool class declaration.
  */
 
 /*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,55 +15,103 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIIconPool_h__
-#define __UIIconPool_h__
+#ifndef ___UIIconPool_h___
+#define ___UIIconPool_h___
 
-/* Global includes */
+/* Qt includes: */
 #include <QIcon>
-#include <QStyle>
+#include <QPixmap>
+#include <QHash>
 
+/** Interface which provides GUI with static API
+  * allowing to dynamically compose icons at runtime. */
 class UIIconPool
 {
 public:
 
-    enum UIDefaultIcon
+    /** Default icon types. */
+    enum UIDefaultIconType
     {
-        MessageBoxInformationIcon,
-        MessageBoxQuestionIcon,
-        MessageBoxWarningIcon,
-        MessageBoxCriticalIcon,
-        DialogCancelIcon,
-        DialogHelpIcon,
-        ArrowBackIcon,
-        ArrowForwardIcon
+        /* Message-box related stuff: */
+        UIDefaultIconType_MessageBoxInformation,
+        UIDefaultIconType_MessageBoxQuestion,
+        UIDefaultIconType_MessageBoxWarning,
+        UIDefaultIconType_MessageBoxCritical,
+        /* Dialog related stuff: */
+        UIDefaultIconType_DialogCancel,
+        UIDefaultIconType_DialogHelp,
+        UIDefaultIconType_ArrowBack,
+        UIDefaultIconType_ArrowForward
     };
 
-    static QIcon iconSet(const QPixmap &normal,
-                         const QPixmap &disabled = QPixmap(),
-                         const QPixmap &active = QPixmap());
+    /** Creates pixmap from passed pixmap @a strName. */
+    static QPixmap pixmap(const QString &strName);
+
+    /** Creates icon from passed pixmap names for
+      * @a strNormal, @a strDisabled and @a strActive icon states. */
     static QIcon iconSet(const QString &strNormal,
                          const QString &strDisabled = QString(),
                          const QString &strActive = QString());
+
+    /** Creates icon from passed pixmap names for
+      * @a strNormal, @a strDisabled, @a strActive icon states and
+      * their analogs for toggled-off case. Used for toggle actions. */
     static QIcon iconSetOnOff(const QString &strNormal, const QString strNormalOff,
-                              const QString &strDisabled = QString(),
-                              const QString &strDisabledOff = QString(),
-                              const QString &strActive = QString(),
-                              const QString &strActiveOff = QString());
-    static QIcon iconSetFull(const QSize &normalSize, const QSize &smallSize,
-                             const QString &strNormal, const QString &strSmallNormal,
-                             const QString &strDisabled = QString(),
-                             const QString &strSmallDisabled = QString(),
-                             const QString &strActive = QString(),
-                             const QString &strSmallActive = QString());
-
-    static QIcon defaultIcon(UIDefaultIcon def, const QWidget *pWidget = 0);
+                              const QString &strDisabled = QString(), const QString &strDisabledOff = QString(),
+                              const QString &strActive = QString(), const QString &strActiveOff = QString());
 
-private:
+    /** Creates icon from passed pixmap names for
+      * @a strNormal, @a strDisabled, @a strActive icon states and
+      * their analogs for small-icon case. Used for setting pages. */
+    static QIcon iconSetFull(const QString &strNormal, const QString &strSmall,
+                             const QString &strNormalDisabled = QString(), const QString &strSmallDisabled = QString(),
+                             const QString &strNormalActive = QString(), const QString &strSmallActive = QString());
+
+    /** Creates icon from passed pixmaps for
+      * @a normal, @a disabled and @a active icon states. */
+    static QIcon iconSet(const QPixmap &normal,
+                         const QPixmap &disabled = QPixmap(),
+                         const QPixmap &active = QPixmap());
+
+    /** Creates icon of passed @a defaultIconType
+      * based on passed @a pWidget style (if any) or application style (otherwise). */
+    static QIcon defaultIcon(UIDefaultIconType defaultIconType, const QWidget *pWidget = 0);
+
+protected:
 
+    /** Icon-pool constructor. */
     UIIconPool() {};
-    UIIconPool(const UIIconPool& /* pool */) {};
-    ~UIIconPool() {};
+
+    /** Icon-pool destructor. */
+    virtual ~UIIconPool() {};
+
+private:
+
+    /** Adds resource named @a strName to passed @a icon
+      * for @a mode (QIcon::Normal by default) and @a state (QIcon::Off by default). */
+    static void addName(QIcon &icon, const QString &strName,
+                        QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off);
 };
 
-#endif /* !__UIIconPool_h__ */
+/** UIIconPool interface extension used as general GUI icon-pool.
+  * Provides GUI with guest OS types pixmap cache. */
+class UIIconPoolGeneral : public UIIconPool
+{
+public:
+
+    /** General icon-pool constructor. */
+    UIIconPoolGeneral();
+
+    /** Returns pixmap corresponding to passed @a strOSTypeID.
+      * In case if non-null @a pLogicalSize pointer provided, it will be updated properly. */
+    QPixmap guestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize = 0) const;
+
+private:
+
+    /** Guest OS type icon-names cache. */
+    QHash<QString, QString> m_guestOSTypeIconNames;
+    /** Guest OS type icons cache. */
+    mutable QHash<QString, QIcon> m_guestOSTypeIcons;
+};
 
+#endif /* !___UIIconPool_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.cpp
index fd0494a..60e673e 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIImageTools.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Implementation of utility classes and functions for image manipulation
+ * VBox Qt GUI - Implementation of utility classes and functions for image manipulation.
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Local include */
-#include "UIImageTools.h"
+# include "UIImageTools.h"
 
 /* Qt includes */
-#include <QPainter>
+# include <QPainter>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* System includes */
 #include <math.h>
 
+
 /* Todo: Think about the naming convention and if the images should be
  * processed in place or return changed copies. Make it more uniform. Add
  * asserts if the bit depth of the given image could not processed. */
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.h b/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.h
index d57f634..e0a99f7 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIImageTools.h
@@ -1,7 +1,6 @@
+/* $Id: UIImageTools.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of utility classes and functions for image manipulation
+ * VBox Qt GUI - Declarations of utility classes and functions for image manipulation.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
index 2cf0150..625d5d7 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMainEventListener.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMainEventListener class implementation
+ * VBox Qt GUI - UIMainEventListener class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,42 +15,45 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIMainEventListener.h"
+# include "UIMainEventListener.h"
 
 /* COM includes: */
-#include "COMEnums.h"
-#include "CVirtualBoxErrorInfo.h"
-#include "CUSBDevice.h"
-#include "CEvent.h"
-#include "CMachineStateChangedEvent.h"
-#include "CMachineDataChangedEvent.h"
-#include "CExtraDataCanChangeEvent.h"
-#include "CExtraDataChangedEvent.h"
-#include "CMachineRegisteredEvent.h"
-#include "CSessionStateChangedEvent.h"
-#include "CSnapshotTakenEvent.h"
-#include "CSnapshotDeletedEvent.h"
-#include "CSnapshotChangedEvent.h"
-#include "CMousePointerShapeChangedEvent.h"
-#include "CMouseCapabilityChangedEvent.h"
-#include "CKeyboardLedsChangedEvent.h"
-#include "CStateChangedEvent.h"
-#include "CNetworkAdapterChangedEvent.h"
-#include "CMediumChangedEvent.h"
-#include "CUSBDeviceStateChangedEvent.h"
-#include "CRuntimeErrorEvent.h"
-#include "CCanShowWindowEvent.h"
-#include "CShowWindowEvent.h"
-#include "CGuestMonitorChangedEvent.h"
+# include "COMEnums.h"
+# include "CEvent.h"
+# include "CVBoxSVCAvailabilityChangedEvent.h"
+# include "CVirtualBoxErrorInfo.h"
+# include "CMachineStateChangedEvent.h"
+# include "CMachineDataChangedEvent.h"
+# include "CMachineRegisteredEvent.h"
+# include "CSessionStateChangedEvent.h"
+# include "CSnapshotTakenEvent.h"
+# include "CSnapshotDeletedEvent.h"
+# include "CSnapshotChangedEvent.h"
+# include "CSnapshotRestoredEvent.h"
+# include "CExtraDataCanChangeEvent.h"
+# include "CExtraDataChangedEvent.h"
+# include "CMousePointerShapeChangedEvent.h"
+# include "CMouseCapabilityChangedEvent.h"
+# include "CKeyboardLedsChangedEvent.h"
+# include "CStateChangedEvent.h"
+# include "CNetworkAdapterChangedEvent.h"
+# include "CMediumChangedEvent.h"
+# include "CUSBDevice.h"
+# include "CUSBDeviceStateChangedEvent.h"
+# include "CGuestMonitorChangedEvent.h"
+# include "CRuntimeErrorEvent.h"
+# include "CCanShowWindowEvent.h"
+# include "CShowWindowEvent.h"
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 UIMainEventListener::UIMainEventListener()
-  : QObject()
 {
-    /* For queued events we have to extra register our enums/interface classes
-     * (Q_DECLARE_METATYPE isn't sufficient).
-     * Todo: Try to move this to a global function, which is auto generated
-     * from xslt. */
+    /* Register meta-types for required enums. */
     qRegisterMetaType<KMachineState>("KMachineState");
     qRegisterMetaType<KSessionState>("KSessionState");
     qRegisterMetaType< QVector<uint8_t> >("QVector<uint8_t>");
@@ -63,28 +64,19 @@ UIMainEventListener::UIMainEventListener()
     qRegisterMetaType<KGuestMonitorChangedEventType>("KGuestMonitorChangedEventType");
 }
 
-HRESULT UIMainEventListener::init(QObject * /* pParent */)
-{
-    return S_OK;
-}
-
-void    UIMainEventListener::uninit()
-{
-}
-
-/**
- * @todo: instead of double wrapping of events into signals maybe it
- * make sense to use passive listeners, and peek up events in main thread.
- */
 STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent *pEvent)
 {
     CEvent event(pEvent);
     // printf("Event received: %d\n", event.GetType());
-    switch(event.GetType())
+    switch (event.GetType())
     {
-        /*
-         * All VirtualBox Events
-         */
+        case KVBoxEventType_OnVBoxSVCAvailabilityChanged:
+        {
+            CVBoxSVCAvailabilityChangedEvent es(pEvent);
+            emit sigVBoxSVCAvailabilityChange(es.GetAvailable());
+            break;
+        }
+
         case KVBoxEventType_OnMachineStateChanged:
         {
             CMachineStateChangedEvent es(pEvent);
@@ -97,26 +89,6 @@ STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent
             emit sigMachineDataChange(es.GetMachineId());
             break;
         }
-        case KVBoxEventType_OnExtraDataCanChange:
-        {
-            CExtraDataCanChangeEvent es(pEvent);
-            /* Has to be done in place to give an answer */
-            bool fVeto = false;
-            QString strReason;
-            emit sigExtraDataCanChange(es.GetMachineId(), es.GetKey(), es.GetValue(), fVeto, strReason);
-            if (fVeto)
-                es.AddVeto(strReason);
-            break;
-        }
-        case KVBoxEventType_OnExtraDataChanged:
-        {
-            CExtraDataChangedEvent es(pEvent);
-            emit sigExtraDataChange(es.GetMachineId(), es.GetKey(), es.GetValue());
-            break;
-        }
-        /* Not used:
-        case KVBoxEventType_OnMediumRegistered:
-         */
         case KVBoxEventType_OnMachineRegistered:
         {
             CMachineRegisteredEvent es(pEvent);
@@ -147,12 +119,33 @@ STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent
             emit sigSnapshotChange(es.GetMachineId(), es.GetSnapshotId());
             break;
         }
-        /* Not used:
-        case KVBoxEventType_OnGuestPropertyChange:
-         */
-        /*
-         * All Console Events
-         */
+        case KVBoxEventType_OnSnapshotRestored:
+        {
+            CSnapshotRestoredEvent es(pEvent);
+            emit sigSnapshotRestore(es.GetMachineId(), es.GetSnapshotId());
+            break;
+        }
+//        case KVBoxEventType_OnMediumRegistered:
+//        case KVBoxEventType_OnGuestPropertyChange:
+
+        case KVBoxEventType_OnExtraDataCanChange:
+        {
+            CExtraDataCanChangeEvent es(pEvent);
+            /* Has to be done in place to give an answer: */
+            bool fVeto = false;
+            QString strReason;
+            emit sigExtraDataCanChange(es.GetMachineId(), es.GetKey(), es.GetValue(), fVeto, strReason);
+            if (fVeto)
+                es.AddVeto(strReason);
+            break;
+        }
+        case KVBoxEventType_OnExtraDataChanged:
+        {
+            CExtraDataChangedEvent es(pEvent);
+            emit sigExtraDataChange(es.GetMachineId(), es.GetKey(), es.GetValue());
+            break;
+        }
+
         case KVBoxEventType_OnMousePointerShapeChanged:
         {
             CMousePointerShapeChangedEvent es(pEvent);
@@ -188,20 +181,12 @@ STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent
             emit sigNetworkAdapterChange(es.GetNetworkAdapter());
             break;
         }
-        /* Not used *
-        case KVBoxEventType_OnSerialPortChanged:
-        case KVBoxEventType_OnParallelPortChanged:
-        case KVBoxEventType_OnStorageControllerChanged:
-         */
         case KVBoxEventType_OnMediumChanged:
         {
             CMediumChangedEvent es(pEvent);
             emit sigMediumChange(es.GetMediumAttachment());
             break;
         }
-        /* Not used *
-        case KVBoxEventType_OnCPUChange:
-         */
         case KVBoxEventType_OnVRDEServerChanged:
         case KVBoxEventType_OnVRDEServerInfoChanged:
         {
@@ -229,6 +214,18 @@ STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent
             emit sigSharedFolderChange();
             break;
         }
+        case KVBoxEventType_OnCPUExecutionCapChanged:
+        {
+            emit sigCPUExecutionCapChange();
+            break;
+        }
+        case KVBoxEventType_OnGuestMonitorChanged:
+        {
+            CGuestMonitorChangedEvent es(pEvent);
+            emit sigGuestMonitorChange(es.GetChangeType(), es.GetScreenId(),
+                                       QRect(es.GetOriginX(), es.GetOriginY(), es.GetWidth(), es.GetHeight()));
+            break;
+        }
         case KVBoxEventType_OnRuntimeError:
         {
             CRuntimeErrorEvent es(pEvent);
@@ -238,35 +235,32 @@ STDMETHODIMP UIMainEventListener::HandleEvent(VBoxEventType_T /* type */, IEvent
         case KVBoxEventType_OnCanShowWindow:
         {
             CCanShowWindowEvent es(pEvent);
-            /* Has to be done in place to give an answer */
+            /* Has to be done in place to give an answer: */
             bool fVeto = false;
             QString strReason;
             emit sigCanShowWindow(fVeto, strReason);
             if (fVeto)
                 es.AddVeto(strReason);
+            else
+                es.AddApproval(strReason);
             break;
         }
         case KVBoxEventType_OnShowWindow:
         {
             CShowWindowEvent es(pEvent);
-            /* Has to be done in place to give an answer */
-            LONG64 winId;
+            /* Has to be done in place to give an answer: */
+            LONG64 winId = es.GetWinId();
+            if (winId != 0)
+                break; /* Already set by some listener. */
             emit sigShowWindow(winId);
             es.SetWinId(winId);
             break;
         }
-        case KVBoxEventType_OnCPUExecutionCapChanged:
-        {
-            emit sigCPUExecutionCapChange();
-            break;
-        }
-        case KVBoxEventType_OnGuestMonitorChanged:
-        {
-            CGuestMonitorChangedEvent es(pEvent);
-            emit sigGuestMonitorChange(es.GetChangeType(), es.GetScreenId(),
-                                       QRect(es.GetOriginX(), es.GetOriginY(), es.GetWidth(), es.GetHeight()));
-            break;
-        }
+//        case KVBoxEventType_OnSerialPortChanged:
+//        case KVBoxEventType_OnParallelPortChanged:
+//        case KVBoxEventType_OnStorageControllerChanged:
+//        case KVBoxEventType_OnCPUChange:
+
         default: break;
     }
     return S_OK;
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h b/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h
index f80690b..937992c 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIMainEventListener.h
@@ -1,11 +1,10 @@
+/* $Id: UIMainEventListener.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMainEventListener class declaration
+ * VBox Qt GUI - UIMainEventListener class declaration.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,8 +15,8 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIMainEventListener_h__
-#define __UIMainEventListener_h__
+#ifndef ___UIMainEventListener_h___
+#define ___UIMainEventListener_h___
 
 /* COM includes: */
 #include "COMEnums.h"
@@ -41,52 +40,88 @@
  * consumer. Qt will create a event for us, place it in the main GUI event
  * queue and deliver it later on. */
 
+/** Main event listener. */
 class UIMainEventListener: public QObject
 {
     Q_OBJECT;
 
-public:
-    UIMainEventListener();
-
-
-    HRESULT init(QObject *pParent);
-    void    uninit();
+signals:
 
-    STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *pEvent);
+    /** Notifies about the VBoxSVC become @a fAvailable. */
+    void sigVBoxSVCAvailabilityChange(bool fAvailable);
 
-signals:
-    /* All VirtualBox Signals */
+    /** Notifies about @a state change event for the machine with @a strId. */
     void sigMachineStateChange(QString strId, KMachineState state);
+    /** Notifies about data change event for the machine with @a strId. */
     void sigMachineDataChange(QString strId);
-    void sigExtraDataCanChange(QString strId, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason); /* use Qt::DirectConnection */
-    void sigExtraDataChange(QString strId, QString strKey, QString strValue);
+    /** Notifies about machine with @a strId was @a fRegistered. */
     void sigMachineRegistered(QString strId, bool fRegistered);
+    /** Notifies about @a state change event for the session of the machine with @a strId. */
     void sigSessionStateChange(QString strId, KSessionState state);
+    /** Notifies about snapshot with @a strSnapshotId was taken for the machine with @a strId. */
     void sigSnapshotTake(QString strId, QString strSnapshotId);
+    /** Notifies about snapshot with @a strSnapshotId was deleted for the machine with @a strId. */
     void sigSnapshotDelete(QString strId, QString strSnapshotId);
+    /** Notifies about snapshot with @a strSnapshotId was changed for the machine with @a strId. */
     void sigSnapshotChange(QString strId, QString strSnapshotId);
-    /* All Console Signals */
+    /** Notifies about snapshot with @a strSnapshotId was restored for the machine with @a strId. */
+    void sigSnapshotRestore(QString strId, QString strSnapshotId);
+
+    /** Notifies about extra-data of the machine with @a strId can be changed for the key @a strKey to value @a strValue. */
+    void sigExtraDataCanChange(QString strId, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason); /* use Qt::DirectConnection */
+    /** Notifies about extra-data of the machine with @a strId changed for the key @a strKey to value @a strValue. */
+    void sigExtraDataChange(QString strId, QString strKey, QString strValue);
+
+    /** Notifies about mouse pointer become @a fVisible and his shape changed to @a fAlpha, @a hotCorner, @a size and @a shape. */
     void sigMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape);
+    /** Notifies about mouse capability change to @a fSupportsAbsolute, @a fSupportsRelative, @a fSupportsMultiTouch and @a fNeedsHostCursor. */
     void sigMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fSupportsMultiTouch, bool fNeedsHostCursor);
+    /** Notifies about keyboard LEDs change for @a fNumLock, @a fCapsLock and @a fScrollLock. */
     void sigKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock);
+    /** Notifies about machine @a state change. */
     void sigStateChange(KMachineState state);
+    /** Notifies about guest additions state change. */
     void sigAdditionsChange();
+    /** Notifies about network @a adapter state change. */
     void sigNetworkAdapterChange(CNetworkAdapter adapter);
+    /** Notifies about storage medium @a attachment state change. */
     void sigMediumChange(CMediumAttachment attachment);
+    /** Notifies about VRDE device state change. */
     void sigVRDEChange();
+    /** Notifies about Video Capture device state change. */
     void sigVideoCaptureChange();
+    /** Notifies about USB controller state change. */
     void sigUSBControllerChange();
+    /** Notifies about USB @a device state change to @a fAttached, holding additional @a error information. */
     void sigUSBDeviceStateChange(CUSBDevice device, bool fAttached, CVirtualBoxErrorInfo error);
+    /** Notifies about shared folder state change. */
     void sigSharedFolderChange();
-    void sigRuntimeError(bool fFatal, QString strId, QString strMessage);
-    void sigCanShowWindow(bool &fVeto, QString &strReason); /* use Qt::DirectConnection */
-    void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */
+    /** Notifies about CPU execution-cap change. */
     void sigCPUExecutionCapChange();
+    /** Notifies about guest-screen configuration change of @a type for @a uScreenId with @a screenGeo. */
     void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
+    /** Notifies about Runtime error with @a strErrorId which is @a fFatal and have @a strMessage. */
+    void sigRuntimeError(bool fFatal, QString strErrorId, QString strMessage);
+    /** Notifies about VM window can be shown, allowing to prevent it by @a fVeto with @a strReason. */
+    void sigCanShowWindow(bool &fVeto, QString &strReason); /* use Qt::DirectConnection */
+    /** Notifies about VM window with specified @a winId should be shown. */
+    void sigShowWindow(LONG64 &winId); /* use Qt::DirectConnection */
+
+public:
+
+    /** Constructor. */
+    UIMainEventListener();
+
+    /** Initialization routine. */
+    HRESULT init(QObject *pParent) { Q_UNUSED(pParent); return S_OK; }
+    /** Deinitialization routine. */
+    void uninit() {}
+
+    /** Main event handler routine. */
+    STDMETHOD(HandleEvent)(VBoxEventType_T enmType, IEvent *pEvent);
 };
 
 /* Wrap the IListener interface around our implementation class. */
 typedef ListenerImpl<UIMainEventListener, QObject*> UIMainEventListenerImpl;
 
-#endif /* !__UIMainEventListener_h__ */
-
+#endif /* !___UIMainEventListener_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
index 6bd7e67..04cda13 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMessageCenter.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMessageCenter class implementation
+ * VBox Qt GUI - UIMessageCenter class implementation.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,63 +15,75 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
-#include <QDesktopWidget>
-#include <QFileInfo>
-#include <QLocale>
-#include <QThread>
-#include <QProcess>
-#ifdef Q_WS_MAC
-# include <QPushButton>
-#endif /* Q_WS_MAC */
+# include <QDir>
+# include <QDesktopWidget>
+# include <QFileInfo>
+# include <QLocale>
+# include <QThread>
+# include <QProcess>
+# ifdef Q_WS_MAC
+#  include <QPushButton>
+# endif /* Q_WS_MAC */
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIConverter.h"
-#include "UIMessageCenter.h"
-#include "UISelectorWindow.h"
-#include "UIProgressDialog.h"
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include "UINetworkManager.h"
-# include "UINetworkManagerDialog.h"
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#include "UIModalWindowManager.h"
-#include "UIMedium.h"
-#ifdef VBOX_OSE
-# include "UIDownloaderUserManual.h"
-#endif /* VBOX_OSE */
-#include "UIMachine.h"
-#include "VBoxAboutDlg.h"
-#include "UIHostComboEditor.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-#endif /* Q_WS_MAC */
-#ifdef Q_WS_WIN
-# include <Htmlhelp.h>
-#endif /* Q_WS_WIN */
+# include "VBoxGlobal.h"
+# include "UIConverter.h"
+# include "UIMessageCenter.h"
+# include "UISelectorWindow.h"
+# include "UIProgressDialog.h"
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+#  include "UINetworkManager.h"
+#  include "UINetworkManagerDialog.h"
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+# include "UIModalWindowManager.h"
+# include "UIExtraDataManager.h"
+# include "UIMedium.h"
+# ifdef VBOX_OSE
+#  include "UIDownloaderUserManual.h"
+# endif /* VBOX_OSE */
+# include "UIMachine.h"
+# include "VBoxAboutDlg.h"
+# include "UIHostComboEditor.h"
+# ifdef Q_WS_MAC
+#  include "VBoxUtils-darwin.h"
+# endif /* Q_WS_MAC */
+# ifdef Q_WS_WIN
+#  include <Htmlhelp.h>
+# endif /* Q_WS_WIN */
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CMachine.h"
-#include "CSystemProperties.h"
-#include "CVirtualBoxErrorInfo.h"
-#include "CMediumAttachment.h"
-#include "CMediumFormat.h"
-#include "CAppliance.h"
-#include "CExtPackManager.h"
-#include "CExtPackFile.h"
-#include "CHostNetworkInterface.h"
-#include "CVRDEServer.h"
-#include "CEmulatedUSB.h"
-#ifdef VBOX_WITH_DRAG_AND_DROP
-# include "CGuest.h"
-#endif /* VBOX_WITH_DRAG_AND_DROP */
+# include "CConsole.h"
+# include "CMachine.h"
+# include "CSystemProperties.h"
+# include "CVirtualBoxErrorInfo.h"
+# include "CMediumAttachment.h"
+# include "CMediumFormat.h"
+# include "CAppliance.h"
+# include "CExtPackManager.h"
+# include "CExtPackFile.h"
+# include "CHostNetworkInterface.h"
+# include "CVRDEServer.h"
+# include "CNetworkAdapter.h"
+# include "CEmulatedUSB.h"
+# ifdef VBOX_WITH_DRAG_AND_DROP
+#  include "CGuest.h"
+#  include "CDnDSource.h"
+#  include "CDnDTarget.h"
+# endif /* VBOX_WITH_DRAG_AND_DROP */
 
 /* Other VBox includes: */
+# include <iprt/param.h>
+# include <iprt/path.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #include <iprt/err.h>
-#include <iprt/param.h>
-#include <iprt/path.h>
+
 
 /* static */
 UIMessageCenter* UIMessageCenter::m_spInstance = 0;
@@ -328,7 +338,7 @@ bool UIMessageCenter::showModalProgressDialog(CProgress &progress,
                                               int cMinDuration /* = 2000 */)
 {
     /* Prepare pixmap: */
-    QPixmap *pPixmap = 0;
+    QPixmap *pPixmap = NULL;
     if (!strImage.isEmpty())
         pPixmap = new QPixmap(strImage);
 
@@ -341,17 +351,22 @@ bool UIMessageCenter::showModalProgressDialog(CProgress &progress,
     pProgressDlg->run(350);
 
     /* Make sure progress-dialog still valid: */
-    if (!pProgressDlg)
-        return false;
+    bool fRc;
+    if (pProgressDlg)
+    {
+        /* Delete progress-dialog: */
+        delete pProgressDlg;
 
-    /* Delete progress-dialog: */
-    delete pProgressDlg;
+        fRc = true;
+    }
+    else
+        fRc = false;
 
     /* Cleanup pixmap: */
     if (pPixmap)
         delete pPixmap;
 
-    return true;
+    return fRc;
 }
 
 #ifdef RT_OS_LINUX
@@ -372,14 +387,14 @@ void UIMessageCenter::cannotStartSelector() const
              "<p>The application will now terminate.</p>"));
 }
 
-void UIMessageCenter::showBETAWarning() const
+void UIMessageCenter::showBetaBuildWarning() const
 {
     alert(0, MessageType_Warning,
           tr("You are running a prerelease version of VirtualBox. "
              "This version is not suitable for production use."));
 }
 
-void UIMessageCenter::showBEBWarning() const
+void UIMessageCenter::showExperimentalBuildWarning() const
 {
     alert(0, MessageType_Warning,
           tr("You are running an EXPERIMENTAL build of VirtualBox. "
@@ -406,12 +421,12 @@ void UIMessageCenter::cannotInitCOM(HRESULT rc) const
           formatErrorInfo(COMErrorInfo(), rc));
 }
 
-void UIMessageCenter::cannotCreateVirtualBox(const CVirtualBox &vbox) const
+void UIMessageCenter::cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const
 {
     error(0, MessageType_Critical,
-          tr("<p>Failed to create the VirtualBox COM object.</p>"
+          tr("<p>Failed to create the VirtualBoxClient COM object.</p>"
              "<p>The application will now terminate.</p>"),
-          formatErrorInfo(vbox));
+          formatErrorInfo(client));
 }
 
 void UIMessageCenter::cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const
@@ -507,6 +522,22 @@ void UIMessageCenter::cannotOpenURL(const QString &strUrl) const
              .arg(strUrl));
 }
 
+void UIMessageCenter::cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue)
+{
+    error(0, MessageType_Error,
+          tr("Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.")
+             .arg(strKey, strValue),
+          formatErrorInfo(vbox));
+}
+
+void UIMessageCenter::cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue)
+{
+    error(0, MessageType_Error,
+          tr("Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.")
+             .arg(strKey, CMachine(machine).GetName(), strValue),
+          formatErrorInfo(machine));
+}
+
 void UIMessageCenter::cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const
 {
     error(0, MessageType_Error,
@@ -665,7 +696,7 @@ void UIMessageCenter::cannotRemoveMachine(const CMachine &machine, const CProgre
 bool UIMessageCenter::warnAboutInaccessibleMedia() const
 {
     return questionBinary(0, MessageType_Warning,
-                          tr("<p>One or more virtual hard disks, CD/DVD or "
+                          tr("<p>One or more virtual hard disks, optical or "
                              "floppy disk image files are not currently accessible. As a result, you will "
                              "not be able to operate virtual machines that use these files until "
                              "they become accessible later.</p>"
@@ -736,20 +767,20 @@ void UIMessageCenter::cannotResumeMachine(const CConsole &console) const
           formatErrorInfo(console));
 }
 
-void UIMessageCenter::cannotDiscardSavedState(const CConsole &console) const
+void UIMessageCenter::cannotDiscardSavedState(const CMachine &machine) const
 {
     error(0, MessageType_Error,
           tr("Failed to discard the saved state of the virtual machine <b>%1</b>.")
-             .arg(CConsole(console).GetMachine().GetName()),
-          formatErrorInfo(console));
+             .arg(machine.GetName()),
+          formatErrorInfo(machine));
 }
 
-void UIMessageCenter::cannotSaveMachineState(const CConsole &console)
+void UIMessageCenter::cannotSaveMachineState(const CMachine &machine)
 {
     error(0, MessageType_Error,
           tr("Failed to save the state of the virtual machine <b>%1</b>.")
-             .arg(CConsole(console).GetMachine().GetName()),
-          formatErrorInfo(console));
+             .arg(machine.GetName()),
+          formatErrorInfo(machine));
 }
 
 void UIMessageCenter::cannotSaveMachineState(const CProgress &progress, const QString &strMachineName)
@@ -793,7 +824,7 @@ int UIMessageCenter::confirmSnapshotRestoring(const QString &strSnapshotName, bo
                                 "if you do not do this the current state will be permanently lost. Do you wish to proceed?</p>")
                                 .arg(strSnapshotName),
                              tr("Create a snapshot of the current machine state"),
-                             !vboxGlobal().virtualBox().GetExtraDataStringList(GUI_InvertMessageOption).contains("confirmSnapshotRestoring"),
+                             !gEDataManager->messagesWithInvertedOption().contains("confirmSnapshotRestoring"),
                              AlertButton_Ok | AlertButtonOption_Default,
                              AlertButton_Cancel | AlertButtonOption_Escape,
                              0 /* 3rd button */,
@@ -836,12 +867,12 @@ bool UIMessageCenter::warnAboutSnapshotRemovalFreeSpace(const QString &strSnapsh
                           tr("Delete"));
 }
 
-void UIMessageCenter::cannotTakeSnapshot(const CConsole &console, const QString &strMachineName, QWidget *pParent /* = 0*/) const
+void UIMessageCenter::cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent /* = 0*/) const
 {
     error(pParent, MessageType_Error,
           tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")
              .arg(strMachineName),
-          formatErrorInfo(console));
+          formatErrorInfo(machine));
 }
 
 void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const
@@ -852,12 +883,12 @@ void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress, const QStrin
           formatErrorInfo(progress));
 }
 
-bool UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const
+bool UIMessageCenter::cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const
 {
     error(0, MessageType_Error,
           tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
              .arg(strSnapshotName, strMachineName),
-          formatErrorInfo(console));
+          formatErrorInfo(machine));
     return false;
 }
 
@@ -870,12 +901,12 @@ bool UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QSt
     return false;
 }
 
-void UIMessageCenter::cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const
+void UIMessageCenter::cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const
 {
     error(0, MessageType_Error,
           tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
              .arg(strSnapshotName, strMachineName),
-          formatErrorInfo(console));
+          formatErrorInfo(machine));
 }
 
 void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const
@@ -886,6 +917,13 @@ void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, const QStr
           formatErrorInfo(progress));
 }
 
+void UIMessageCenter::cannotSaveSettings(const QString strDetails, QWidget *pParent /* = 0 */) const
+{
+    error(pParent, MessageType_Error,
+          tr("Failed to save the settings."),
+          strDetails);
+}
+
 bool UIMessageCenter::confirmNATNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const
 {
     return questionBinary(pParent, MessageType_Question,
@@ -1035,8 +1073,8 @@ int UIMessageCenter::confirmHardDiskAttachmentCreation(const QString &strControl
 int UIMessageCenter::confirmOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent /* = 0*/) const
 {
     return questionTrinary(pParent, MessageType_Question,
-                           tr("<p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p>"
-                              "<p>Would you like to choose a virtual CD/DVD disk to put in the drive "
+                           tr("<p>You are about to add a new optical drive to controller <b>%1</b>.</p>"
+                              "<p>Would you like to choose a virtual optical disk to put in the drive "
                               "or to leave it empty for now?</p>")
                               .arg(strControllerName),
                            0 /* auto-confirm id */,
@@ -1057,8 +1095,8 @@ int UIMessageCenter::confirmFloppyAttachmentCreation(const QString &strControlle
 int UIMessageCenter::confirmRemovingOfLastDVDDevice(QWidget *pParent /* = 0*/) const
 {
     return questionBinary(pParent, MessageType_Info,
-                          tr("<p>Are you sure you want to delete the CD/DVD device?</p>"
-                             "<p>You will not be able to insert any CDs or ISO images "
+                          tr("<p>Are you sure you want to delete the optical drive?</p>"
+                             "<p>You will not be able to insert any optical disks or ISO images "
                              "or install the Guest Additions without it!</p>"),
                           0 /* auto-confirm id */,
                           tr("&Remove", "medium"));
@@ -1079,13 +1117,13 @@ void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType t
         }
         case UIMediumType_DVD:
         {
-            strMessage = tr("Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
+            strMessage = tr("Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
                             .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
             break;
         }
         case UIMediumType_Floppy:
         {
-            strMessage = tr("Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
+            strMessage = tr("Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
                             .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
             break;
         }
@@ -1096,11 +1134,28 @@ void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType t
           strMessage, formatErrorInfo(machine));
 }
 
-void UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent /* = 0*/) const
+bool UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent /* = 0*/) const
 {
     alert(pParent, MessageType_Error,
           tr("The current port forwarding rules are not valid. "
              "None of the host or guest port values may be set to zero."));
+    return false;
+}
+
+bool UIMessageCenter::warnAboutNameShouldBeUnique(QWidget *pParent /* = 0 */) const
+{
+    alert(pParent, MessageType_Error,
+          tr("The current port forwarding rules are not valid. "
+             "Rule names should be unique."));
+    return false;
+}
+
+bool UIMessageCenter::warnAboutRulesConflict(QWidget *pParent /* = 0 */) const
+{
+    alert(pParent, MessageType_Error,
+          tr("The current port forwarding rules are not valid. "
+             "Few rules have same host ports and conflicting IP addresses."));
+    return false;
 }
 
 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent /* = 0*/) const
@@ -1166,8 +1221,18 @@ void UIMessageCenter::cannotChangeMediumType(const CMedium &medium, KMediumType
           formatErrorInfo(medium));
 }
 
-bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, const QString &strUsage, QWidget *pParent /* = 0*/) const
+bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, QWidget *pParent /* = 0*/) const
 {
+    /* Prepare the usage: */
+    QStringList usage;
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    foreach (const QString &strMachineID, medium.curStateMachineIds())
+    {
+        CMachine machine = vbox.FindMachine(strMachineID);
+        if (!vbox.isOk() || machine.isNull())
+            continue;
+        usage << machine.GetName();
+    }
     /* Prepare the message: */
     QString strMessage;
     switch (medium.type())
@@ -1195,7 +1260,7 @@ bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, const QString
     }
     /* Show the question: */
     return questionBinary(pParent, MessageType_Question,
-                          strMessage.arg(medium.location(), strUsage),
+                          strMessage.arg(medium.location(), usage.join(", ")),
                           0 /* auto-confirm id */,
                           tr("Release", "detach medium"));
 }
@@ -1217,7 +1282,7 @@ bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pPar
             for (int i = 0; i < capabilities.size(); ++i)
                 caps |= capabilities[i];
             /* Check capabilities for additional options: */
-            if (caps & MediumFormatCapabilities_File)
+            if (caps & KMediumFormatCapabilities_File)
             {
                 if (medium.state() == KMediumState_Inaccessible)
                     strMessage += tr("<p>As this hard disk is inaccessible its image file"
@@ -1299,13 +1364,13 @@ void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType t
         }
         case UIMediumType_DVD:
         {
-            strMessage = tr("Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
+            strMessage = tr("Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
                             .arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName());
             break;
         }
         case UIMediumType_Floppy:
         {
-            strMessage = tr("Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
+            strMessage = tr("Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
                             .arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName());
             break;
         }
@@ -1616,6 +1681,13 @@ void UIMessageCenter::cannotFindSnapshotByName(const CMachine &machine, const QS
           formatErrorInfo(machine));
 }
 
+void UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent /* = 0 */)
+{
+    error(pParent, MessageType_Error,
+          tr("Bad password or authentication failure."),
+          formatErrorInfo(appliance));
+}
+
 void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const
 {
     /* Prepare auto-confirm id: */
@@ -1734,27 +1806,44 @@ bool UIMessageCenter::remindAboutGuruMeditation(const QString &strLogFolder)
                           tr("Ignore"));
 }
 
-bool UIMessageCenter::warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported) const
+void UIMessageCenter::warnAboutVBoxSVCUnavailable() const
+{
+    alert(0, MessageType_Critical,
+          tr("<p>A critical error has occurred while running the virtual "
+             "machine and the machine execution should be stopped.</p>"
+             ""
+             "<p>For help, please see the Community section on "
+             "<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> "
+             "or your support contract. Please provide the contents of the "
+             "log file <tt>VBox.log</tt>, "
+             "which you can find in the virtual machine log directory, "
+             "as well as a description of what you were doing when this error happened. "
+             ""
+             "Note that you can also access the above file by selecting <b>Show Log</b> "
+             "from the <b>Machine</b> menu of the main VirtualBox window.</p>"
+             ""
+             "<p>Press <b>OK</b> to power off the machine.</p>"),
+          0 /* auto-confirm id */);
+}
+
+bool UIMessageCenter::warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const
 {
     if (fHWVirtExSupported)
         return questionBinary(0, MessageType_Error,
-                              tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is "
-                                 "not operational. Your 64-bit guest will fail to detect a "
-                                 "64-bit CPU and will not be able to boot.</p><p>Please ensure "
-                                 "that you have enabled VT-x/AMD-V properly in the BIOS of your "
-                                 "host computer.</p>"),
+                              tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "
+                                 "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p>"
+                                 "<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),
                               0 /* auto-confirm id */,
                               tr("Close VM"), tr("Continue"));
     else
         return questionBinary(0, MessageType_Error,
                               tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
-                                 "Your 64-bit guest will fail to detect a 64-bit CPU and will "
-                                 "not be able to boot."),
+                                 "Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot."),
                               0 /* auto-confirm id */,
                               tr("Close VM"), tr("Continue"));
 }
 
-bool UIMessageCenter::warnAboutVirtNotEnabledGuestRequired(bool fHWVirtExSupported) const
+bool UIMessageCenter::warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const
 {
     if (fHWVirtExSupported)
         return questionBinary(0, MessageType_Error,
@@ -1952,6 +2041,17 @@ void UIMessageCenter::cannotDetachWebCam(const CEmulatedUSB &dispatcher, const Q
           formatErrorInfo(dispatcher));
 }
 
+void UIMessageCenter::cannotToggleVideoCapture(const CMachine &machine, bool fEnable)
+{
+    /* Get machine-name preserving error-info: */
+    QString strMachineName(CMachine(machine).GetName());
+    error(0, MessageType_Error,
+          fEnable ?
+              tr("Failed to enable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName) :
+              tr("Failed to disable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName),
+          formatErrorInfo(machine));
+}
+
 void UIMessageCenter::cannotToggleVRDEServer(const CVRDEServer &server, const QString &strMachineName, bool fEnable)
 {
     error(0, MessageType_Error,
@@ -1961,15 +2061,13 @@ void UIMessageCenter::cannotToggleVRDEServer(const CVRDEServer &server, const QS
           formatErrorInfo(server));
 }
 
-void UIMessageCenter::cannotToggleVideoCapture(const CMachine &machine, bool fEnable)
+void UIMessageCenter::cannotToggleNetworkAdapterCable(const CNetworkAdapter &adapter, const QString &strMachineName, bool fConnect)
 {
-    /* Get machine-name preserving error-info: */
-    QString strMachineName(CMachine(machine).GetName());
     error(0, MessageType_Error,
-          fEnable ?
-              tr("Failed to enable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName) :
-              tr("Failed to disable video capturing for the virtual machine <b>%1</b>.").arg(strMachineName),
-          formatErrorInfo(machine));
+          fConnect ?
+              tr("Failed to connect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName) :
+              tr("Failed to disconnect the network adapter cable of the virtual machine <b>%1</b>.").arg(strMachineName),
+          formatErrorInfo(adapter));
 }
 
 void UIMessageCenter::remindAboutGuestAdditionsAreNotActive() const
@@ -1987,11 +2085,18 @@ void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName) c
 {
     alert(0, MessageType_Error,
           tr("<p>Could not insert the <b>VirtualBox Guest Additions</b> disk image file into the virtual machine <b>%1</b>, "
-             "as the machine has no CD/DVD drives. Please add a drive using the storage page of the "
+             "as the machine has no optical drives. Please add a drive using the storage page of the "
              "virtual machine settings window.</p>")
              .arg(strMachineName));
 }
 
+void UIMessageCenter::cannotAddDiskEncryptionPassword(const CConsole &console)
+{
+    error(0, MessageType_Error,
+          tr("Bad password or authentication failure."),
+          formatErrorInfo(console));
+}
+
 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
 bool UIMessageCenter::confirmCancelingAllNetworkRequests() const
 {
@@ -2058,7 +2163,7 @@ bool UIMessageCenter::proposeMountGuestAdditions(const QString &strUrl, const QS
                           tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "
                              "from <nobr><a href=\"%1\">%1</a></nobr> "
                              "and saved locally as <nobr><b>%2</b>.</nobr></p>"
-                             "<p>Do you wish to register this disk image file and insert it into the virtual CD/DVD drive?</p>")
+                             "<p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p>")
                              .arg(strUrl, strSrc),
                           0 /* auto-confirm id */,
                           tr("Insert", "additions"));
@@ -2294,17 +2399,38 @@ void UIMessageCenter::warnAboutExtPackInstalled(const QString &strPackName, QWid
 }
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
-void UIMessageCenter::cannotDropData(const CGuest &guest, QWidget *pParent /* = 0*/) const
+void UIMessageCenter::cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
 {
     error(pParent, MessageType_Error,
-          tr("Failed to drop data."),
-          formatErrorInfo(guest));
+          tr("Drag and drop operation from host to guest failed."),
+          formatErrorInfo(dndTarget));
 }
 
-void UIMessageCenter::cannotDropData(const CProgress &progress, QWidget *pParent /* = 0*/) const
+void UIMessageCenter::cannotDropDataToGuest(const CProgress &progress, QWidget *pParent /* = 0 */) const
 {
     error(pParent, MessageType_Error,
-          tr("Failed to drop data."),
+          tr("Drag and drop operation from host to guest failed."),
+          formatErrorInfo(progress));
+}
+
+void UIMessageCenter::cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
+{
+    error(pParent, MessageType_Error,
+          tr("Unable to cancel host to guest drag and drop operation."),
+          formatErrorInfo(dndTarget));
+}
+
+void UIMessageCenter::cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent /* = 0 */) const
+{
+    error(pParent, MessageType_Error,
+          tr("Drag and drop operation from guest to host failed."),
+          formatErrorInfo(dndSource));
+}
+
+void UIMessageCenter::cannotDropDataToHost(const CProgress &progress, QWidget *pParent /* = 0 */) const
+{
+    error(pParent, MessageType_Error,
+          tr("Drag and drop operation from guest to host failed."),
           formatErrorInfo(progress));
 }
 #endif /* VBOX_WITH_DRAG_AND_DROP */
@@ -2375,7 +2501,7 @@ QString UIMessageCenter::formatRC(HRESULT rc)
     PCRTCOMERRMSG msg = NULL;
     const char *errMsg = NULL;
 
-    /* first, try as is (only set bit 31 bit for warnings) */
+    /* First, try as is (only set bit 31 bit for warnings): */
     if (SUCCEEDED_WARNING(rc))
         msg = RTErrCOMGet(rc | 0x80000000);
     else
@@ -2384,11 +2510,10 @@ QString UIMessageCenter::formatRC(HRESULT rc)
     if (msg != NULL)
         errMsg = msg->pszDefine;
 
-#if defined (Q_WS_WIN)
-
+#ifdef Q_WS_WIN
     PCRTWINERRMSG winMsg = NULL;
 
-    /* if not found, try again using RTErrWinGet with masked off top 16bit */
+    /* If not found, try again using RTErrWinGet with masked off top 16bit: */
     if (msg == NULL)
     {
         winMsg = RTErrWinGet(rc & 0xFFFF);
@@ -2396,8 +2521,43 @@ QString UIMessageCenter::formatRC(HRESULT rc)
         if (winMsg != NULL)
             errMsg = winMsg->pszDefine;
     }
+#endif /* Q_WS_WIN */
 
-#endif
+    if (errMsg != NULL && *errMsg != '\0')
+        str.sprintf("%s", errMsg);
+
+    return str;
+}
+
+/* static */
+QString UIMessageCenter::formatRCFull(HRESULT rc)
+{
+    QString str;
+
+    PCRTCOMERRMSG msg = NULL;
+    const char *errMsg = NULL;
+
+    /* First, try as is (only set bit 31 bit for warnings): */
+    if (SUCCEEDED_WARNING(rc))
+        msg = RTErrCOMGet(rc | 0x80000000);
+    else
+        msg = RTErrCOMGet(rc);
+
+    if (msg != NULL)
+        errMsg = msg->pszDefine;
+
+#ifdef Q_WS_WIN
+    PCRTWINERRMSG winMsg = NULL;
+
+    /* If not found, try again using RTErrWinGet with masked off top 16bit: */
+    if (msg == NULL)
+    {
+        winMsg = RTErrWinGet(rc & 0xFFFF);
+
+        if (winMsg != NULL)
+            errMsg = winMsg->pszDefine;
+    }
+#endif /* Q_WS_WIN */
 
     if (errMsg != NULL && *errMsg != '\0')
         str.sprintf("%s (0x%08X)", errMsg, rc);
@@ -2423,7 +2583,7 @@ QString UIMessageCenter::formatErrorInfo(const CProgress &progress)
     return QString("<table bgcolor=#EEEEEE border=0 cellspacing=0 cellpadding=0 width=100%>"
                    "<tr><td>%1</td><td><tt>%2</tt></td></tr></table>")
                    .arg(tr("Result Code: ", "error info"))
-                   .arg(formatRC(progress.GetResultCode()))
+                   .arg(formatRCFull(progress.GetResultCode()))
                    .prepend("<!--EOM-->") /* move to details */;
 }
 
@@ -2515,8 +2675,8 @@ void UIMessageCenter::sltShowHelpHelpDialog()
 
 void UIMessageCenter::sltResetSuppressedMessages()
 {
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    vbox.SetExtraData(GUI_SuppressMessages, QString());
+    /* Nullify suppressed message list: */
+    gEDataManager->setSuppressedMessages(QStringList());
 }
 
 void UIMessageCenter::sltShowUserManual(const QString &strLocation)
@@ -2644,7 +2804,7 @@ QString UIMessageCenter::errorInfoToString(const COMErrorInfo &info,
         {
             formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
                 .arg(tr("Result Code: ", "error info"))
-                .arg(formatRC(info.resultCode()));
+                .arg(formatRCFull(info.resultCode()));
         }
 
         if (haveComponent)
@@ -2675,7 +2835,7 @@ QString UIMessageCenter::errorInfoToString(const COMErrorInfo &info,
     {
         formatted += QString("<tr><td>%1</td><td><tt>%2</tt></td></tr>")
             .arg(tr("Callee RC: ", "error info"))
-            .arg(formatRC(wrapperRC));
+            .arg(formatRCFull(wrapperRC));
     }
 
     formatted += "</table>";
@@ -2702,7 +2862,7 @@ int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType type,
     if (!strAutoConfirmId.isEmpty())
     {
         vbox = vboxGlobal().virtualBox();
-        confirmedMessageList = vbox.GetExtraData(GUI_SuppressMessages).split(',');
+        confirmedMessageList = gEDataManager->suppressedMessages();
         if (   confirmedMessageList.contains(strAutoConfirmId)
             || confirmedMessageList.contains("allMessageBoxes")
             || confirmedMessageList.contains("all") )
@@ -2789,7 +2949,7 @@ int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType type,
         if (pMessageBox->flagChecked())
         {
             confirmedMessageList << strAutoConfirmId;
-            vbox.SetExtraData(GUI_SuppressMessages, confirmedMessageList.join(","));
+            gEDataManager->setSuppressedMessages(confirmedMessageList);
         }
     }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h b/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
index 72b9ff2..f158141 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
@@ -1,11 +1,10 @@
+/* $Id: UIMessageCenter.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMessageCenter class declaration
+ * VBox Qt GUI - UIMessageCenter class declaration.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -152,13 +151,13 @@ public:
     void warnAboutWrongUSBMounted() const;
 #endif /* RT_OS_LINUX */
     void cannotStartSelector() const;
-    void showBETAWarning() const;
-    void showBEBWarning() const;
+    void showBetaBuildWarning() const;
+    void showExperimentalBuildWarning() const;
 
     /* API: COM startup warnings: */
     void cannotInitUserHome(const QString &strUserHome) const;
     void cannotInitCOM(HRESULT rc) const;
-    void cannotCreateVirtualBox(const CVirtualBox &vbox) const;
+    void cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const;
 
     /* API: Global warnings: */
     void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const;
@@ -172,6 +171,8 @@ public:
     void cannotOpenSession(const CProgress &progress, const QString &strMachineName) const;
     void cannotGetMediaAccessibility(const UIMedium &medium) const;
     void cannotOpenURL(const QString &strUrl) const;
+    void cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue);
+    void cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue);
 
     /* API: Selector warnings: */
     void cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const;
@@ -190,8 +191,8 @@ public:
     bool confirmPowerOffMachine(const QString &strNames) const;
     void cannotPauseMachine(const CConsole &console) const;
     void cannotResumeMachine(const CConsole &console) const;
-    void cannotDiscardSavedState(const CConsole &console) const;
-    void cannotSaveMachineState(const CConsole &console);
+    void cannotDiscardSavedState(const CMachine &machine) const;
+    void cannotSaveMachineState(const CMachine &machine);
     void cannotSaveMachineState(const CProgress &progress, const QString &strMachineName);
     void cannotACPIShutdownMachine(const CConsole &console) const;
     void cannotPowerDownMachine(const CConsole &console) const;
@@ -202,13 +203,16 @@ public:
     bool confirmSnapshotRemoval(const QString &strSnapshotName) const;
     bool warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, const QString &strTargetImageName,
                                            const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree) const;
-    void cannotTakeSnapshot(const CConsole &console, const QString &strMachineName, QWidget *pParent = 0) const;
+    void cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent = 0) const;
     void cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0) const;
-    bool cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const;
+    bool cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const;
     bool cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const;
-    void cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName, const QString &strMachineName) const;
+    void cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const;
     void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const;
 
+    /* API: Common settings warnings: */
+    void cannotSaveSettings(const QString strDetails, QWidget *pParent = 0) const;
+
     /* API: Global settings warnings: */
     bool confirmNATNetworkRemoval(const QString &strName, QWidget *pParent = 0) const;
     bool confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent = 0) const;
@@ -231,7 +235,9 @@ public:
     int confirmFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const;
     int confirmRemovingOfLastDVDDevice(QWidget *pParent = 0) const;
     void cannotAttachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0);
-    void warnAboutIncorrectPort(QWidget *pParent = 0) const;
+    bool warnAboutIncorrectPort(QWidget *pParent = 0) const;
+    bool warnAboutNameShouldBeUnique(QWidget *pParent = 0) const;
+    bool warnAboutRulesConflict(QWidget *pParent = 0) const;
     bool confirmCancelingPortForwardingDialog(QWidget *pParent = 0) const;
     void cannotCreateSharedFolder(const CMachine &machine, const QString &strName, const QString &strPath, QWidget *pParent = 0);
     void cannotCreateSharedFolder(const CConsole &console, const QString &strName, const QString &strPath, QWidget *pParent = 0);
@@ -241,7 +247,7 @@ public:
 
     /* API: Virtual Medium Manager warnings: */
     void cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent = 0) const;
-    bool confirmMediumRelease(const UIMedium &medium, const QString &strUsage, QWidget *pParent = 0) const;
+    bool confirmMediumRelease(const UIMedium &medium, QWidget *pParent = 0) const;
     bool confirmMediumRemoval(const UIMedium &medium, QWidget *pParent = 0) const;
     int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const;
     void cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0) const;
@@ -273,12 +279,14 @@ public:
     void cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent = 0) const;
     void cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const;
     void cannotFindSnapshotByName(const CMachine &machine, const QString &strMachine, QWidget *pParent = 0) const;
+    void cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent = 0);
 
     /* API: Runtime UI warnings: */
     void showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const;
     bool remindAboutGuruMeditation(const QString &strLogFolder);
-    bool warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported) const;
-    bool warnAboutVirtNotEnabledGuestRequired(bool fHWVirtExSupported) const;
+    void warnAboutVBoxSVCUnavailable() const;
+    bool warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const;
+    bool warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const;
     bool cannotStartWithoutNetworkIf(const QString &strMachineName, const QString &strIfNames) const;
     void cannotStartMachine(const CConsole &console, const QString &strName) const;
     void cannotStartMachine(const CProgress &progress, const QString &strName) const;
@@ -296,10 +304,12 @@ public:
     void cannotDetachUSBDevice(const CVirtualBoxErrorInfo &errorInfo, const QString &strDevice, const QString &strMachineName) const;
     void cannotAttachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const;
     void cannotDetachWebCam(const CEmulatedUSB &dispatcher, const QString &strWebCamName, const QString &strMachineName) const;
-    void cannotToggleVRDEServer(const CVRDEServer &server, const QString &strMachineName, bool fEnable);
     void cannotToggleVideoCapture(const CMachine &machine, bool fEnable);
+    void cannotToggleVRDEServer(const CVRDEServer &server, const QString &strMachineName, bool fEnable);
+    void cannotToggleNetworkAdapterCable(const CNetworkAdapter &adapter, const QString &strMachineName, bool fConnect);
     void remindAboutGuestAdditionsAreNotActive() const;
     void cannotMountGuestAdditions(const QString &strMachineName) const;
+    void cannotAddDiskEncryptionPassword(const CConsole &console);
 
 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     /* API: Network management warnings: */
@@ -338,9 +348,12 @@ public:
     void warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent = 0) const;
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
-    /* API: Drag&drop warnings: */
-    void cannotDropData(const CGuest &guest, QWidget *pParent = 0) const;
-    void cannotDropData(const CProgress &progress, QWidget *pParent = 0) const;
+    /* API: Drag and drop warnings: */
+    void cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const;
+    void cannotDropDataToGuest(const CProgress &progress, QWidget *pParent = 0) const;
+    void cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent = 0) const;
+    void cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent = 0) const;
+    void cannotDropDataToHost(const CProgress &progress, QWidget *pParent = 0) const;
 #endif /* VBOX_WITH_DRAG_AND_DROP */
 
     /* API: License-viewer warnings: */
@@ -354,6 +367,7 @@ public:
 
     /* API: Static helpers: */
     static QString formatRC(HRESULT rc);
+    static QString formatRCFull(HRESULT rc);
     static QString formatErrorInfo(const CProgress &progress);
     static QString formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC = S_OK);
     static QString formatErrorInfo(const CVirtualBoxErrorInfo &info);
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp
index d41fb06..05e8289 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIModalWindowManager.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIModalWindowManager class implementation
+ * VBox Qt GUI - UIModalWindowManager class implementation.
  */
 
 /*
@@ -17,18 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIModalWindowManager.h"
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include "UINetworkManagerDialog.h"
-# include "UINetworkManager.h"
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#include "UISelectorWindow.h"
-#include "UIProgressDialog.h"
-#include "VBoxGlobal.h"
+# include "UIModalWindowManager.h"
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+#  include "UINetworkManagerDialog.h"
+#  include "UINetworkManager.h"
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+# include "UISelectorWindow.h"
+# include "UIProgressDialog.h"
+# include "VBoxGlobal.h"
 
 /* Other VBox includes: */
-#include <VBox/sup.h>
+# include <VBox/sup.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static */
 UIModalWindowManager* UIModalWindowManager::m_spInstance = 0;
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.h b/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.h
index 70cfd17..298d705 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.h
@@ -1,7 +1,6 @@
+/* $Id: UIModalWindowManager.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIModalWindowManager class declaration
+ * VBox Qt GUI - UIModalWindowManager class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
index 852b63c..040e038 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIPopupCenter.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupCenter class implementation
+ * VBox Qt GUI - UIPopupCenter class implementation.
  */
 
 /*
@@ -17,16 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIPopupCenter.h"
-#include "UIPopupStack.h"
-#include "UIMachineWindow.h"
-#include "QIMessageBox.h"
-#include "VBoxGlobal.h"
-#include "UIHostComboEditor.h"
+# include "UIPopupCenter.h"
+# include "UIPopupStack.h"
+# include "UIMachineWindow.h"
+# include "QIMessageBox.h"
+# include "VBoxGlobal.h"
+# include "UIHostComboEditor.h"
+# include "UIExtraDataManager.h"
 
 /* Other VBox includes: */
-#include <VBox/sup.h>
+# include <VBox/sup.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static */
 UIPopupCenter* UIPopupCenter::m_spInstance = 0;
@@ -245,7 +251,7 @@ void UIPopupCenter::showPopupPane(QWidget *pParent, const QString &strPopupPaneI
     /* Check if popup-pane was auto-confirmed before: */
     if ((iButton1 || iButton2) && fProposeAutoConfirmation)
     {
-        QStringList confirmedPopupList = vboxGlobal().virtualBox().GetExtraData(GUI_SuppressMessages).split(',');
+        const QStringList confirmedPopupList = gEDataManager->suppressedMessages();
         if (   confirmedPopupList.contains(strPopupPaneID)
             || confirmedPopupList.contains("allPopupPanes")
             || confirmedPopupList.contains("all") )
@@ -325,14 +331,9 @@ void UIPopupCenter::hidePopupPane(QWidget *pParent, const QString &strPopupPaneI
 
 void UIPopupCenter::sltPopupPaneDone(QString strPopupPaneID, int iResultCode)
 {
-    /* Was the result auto-confirmated? */
+    /* Remember auto-confirmation fact (if necessary): */
     if (iResultCode & AlertOption_AutoConfirmed)
-    {
-        /* Remember auto-confirmation fact: */
-        QStringList confirmedPopupList = vboxGlobal().virtualBox().GetExtraData(GUI_SuppressMessages).split(',');
-        confirmedPopupList << strPopupPaneID;
-        vboxGlobal().virtualBox().SetExtraData(GUI_SuppressMessages, confirmedPopupList.join(","));
-    }
+        gEDataManager->setSuppressedMessages(gEDataManager->suppressedMessages() << strPopupPaneID);
 
     /* Notify listeners: */
     emit sigPopupPaneDone(strPopupPaneID, iResultCode);
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h b/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
index c70c946..7b53a1a 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
@@ -1,7 +1,6 @@
+/* $Id: UIPopupCenter.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupCenter class declaration
+ * VBox Qt GUI - UIPopupCenter class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp
index 7c0054f..48a8871 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIShortcutPool.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIShortcutPool class implementation
+ * VBox Qt GUI - UIShortcutPool class implementation.
  */
 
 /*
@@ -17,10 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIShortcutPool.h"
-#include "UIActionPool.h"
-#include "UIExtraDataEventHandler.h"
+# include "UIShortcutPool.h"
+# include "UIActionPool.h"
+# include "UIExtraDataManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+
 
 void UIShortcut::setDescription(const QString &strDescription)
 {
@@ -223,8 +232,8 @@ void UIShortcutPool::prepare()
 void UIShortcutPool::prepareConnections()
 {
     /* Connect to extra-data signals: */
-    connect(gEDataEvents, SIGNAL(sigSelectorShortcutsChanged()), this, SLOT(sltReloadSelectorShortcuts()));
-    connect(gEDataEvents, SIGNAL(sigMachineShortcutsChanged()), this, SLOT(sltReloadMachineShortcuts()));
+    connect(gEDataManager, SIGNAL(sigSelectorUIShortcutChange()), this, SLOT(sltReloadSelectorShortcuts()));
+    connect(gEDataManager, SIGNAL(sigRuntimeUIShortcutChange()), this, SLOT(sltReloadMachineShortcuts()));
 }
 
 void UIShortcutPool::retranslateUi()
@@ -255,7 +264,7 @@ void UIShortcutPool::loadOverridesFor(const QString &strPoolExtraDataID)
     /* Compose shortcut key template: */
     const QString strShortcutKeyTemplate(m_sstrShortcutKeyTemplate.arg(strPoolExtraDataID));
     /* Iterate over all the overrides: */
-    const QStringList overrides = vboxGlobal().virtualBox().GetExtraDataStringList(strPoolExtraDataID);
+    const QStringList overrides = gEDataManager->shortcutOverrides(strPoolExtraDataID);
     foreach (const QString &strKeyValuePair, overrides)
     {
         /* Make sure override structure is valid: */
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.h b/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.h
index 5d33756..a2af3f5 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.h
@@ -1,7 +1,6 @@
+/* $Id: UIShortcutPool.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIShortcutPool class declaration
+ * VBox Qt GUI - UIShortcutPool class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.cpp b/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.cpp
index b7361fe..51d500f 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.cpp
@@ -15,19 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QThread>
+# include <QThread>
 
 /* GUI includes: */
-#include "COMDefs.h"
-#include "UIThreadPool.h"
-
-/* Other VBox defines: */
-#define LOG_GROUP LOG_GROUP_GUI
+# include "COMDefs.h"
+# include "UIThreadPool.h"
+# include "UIDefs.h"
 
 /* Other VBox includes: */
-#include <VBox/log.h>
-#include <VBox/sup.h>
+#include <iprt/assert.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /**
  * COM capable worker thread for the UIThreadPool.
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.h b/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.h
index 838a912..77d2ca5 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.h
@@ -1,3 +1,4 @@
+/* $Id: UIThreadPool.h $ */
 /** @file
  * VBox Qt GUI - UIThreadPool and UITask class declaration.
  */
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
index c38c9f1..2f77400 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,198 +15,179 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Qt includes: */
-#include <QProgressDialog>
-#include <QLibraryInfo>
-#include <QFileDialog>
-#include <QToolTip>
-#include <QTranslator>
-#include <QDesktopWidget>
-#include <QDesktopServices>
-#include <QMutex>
-#include <QReadLocker>
-#include <QToolButton>
-#include <QProcess>
-#include <QThread>
-#include <QPainter>
-#include <QSettings>
-#include <QTimer>
-#include <QDir>
-#include <QLocale>
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include <QNetworkProxy>
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#include <QSpinBox>
-#include <QStyleOptionSpinBox>
-
-#ifdef Q_WS_WIN
-# include <QEventLoop>
-#endif /* Q_WS_WIN */
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#ifdef Q_WS_X11
-# include <QTextBrowser>
-# include <QScrollBar>
-# include <QX11Info>
-#endif /* Q_WS_X11 */
-
-#ifdef VBOX_GUI_WITH_PIDFILE
-# include <QTextStream>
-#endif /* VBOX_GUI_WITH_PIDFILE */
+/* Qt includes: */
+# include <QFileDialog>
+# include <QToolTip>
+# include <QTranslator>
+# include <QDesktopWidget>
+# include <QDesktopServices>
+# include <QMutex>
+# include <QToolButton>
+# include <QProcess>
+# include <QThread>
+# include <QPainter>
+# include <QTimer>
+# include <QDir>
+# include <QLocale>
+# include <QSpinBox>
+
+# ifdef Q_WS_WIN
+#  include <QEventLoop>
+# endif /* Q_WS_WIN */
+
+# ifdef Q_WS_X11
+#  include <QTextBrowser>
+#  include <QScrollBar>
+#  include <QX11Info>
+# endif /* Q_WS_X11 */
+
+# ifdef VBOX_GUI_WITH_PIDFILE
+#  include <QTextStream>
+# endif /* VBOX_GUI_WITH_PIDFILE */
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "VBoxUtils.h"
-#include "UISelectorWindow.h"
-#include "UIMessageCenter.h"
-#include "UIPopupCenter.h"
-#include "QIMessageBox.h"
-#include "QIDialogButtonBox.h"
-#include "UIIconPool.h"
-#include "UIShortcutPool.h"
-#include "UIActionPoolSelector.h"
-#include "UIActionPoolRuntime.h"
-#include "UIExtraDataEventHandler.h"
-#include "QIFileDialog.h"
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include "UINetworkManager.h"
-# include "UIUpdateManager.h"
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#include "UIMachine.h"
-#include "UISession.h"
-#include "UIConverter.h"
-#include "UIMediumEnumerator.h"
-#include "UIMedium.h"
-
-#ifdef Q_WS_X11
-# include "UIHostComboEditor.h"
-# ifndef VBOX_OSE
+# include "VBoxGlobal.h"
+# include "VBoxUtils.h"
+# include "UISelectorWindow.h"
+# include "UIMessageCenter.h"
+# include "UIPopupCenter.h"
+# include "QIMessageBox.h"
+# include "QIDialogButtonBox.h"
+# include "UIIconPool.h"
+# include "UIShortcutPool.h"
+# include "UIExtraDataManager.h"
+# include "QIFileDialog.h"
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+#  include "UINetworkManager.h"
+#  include "UIUpdateManager.h"
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+# include "UIMachine.h"
+# include "UISession.h"
+# include "UIConverter.h"
+# include "UIMediumEnumerator.h"
+# include "UIMedium.h"
+# include "UIModalWindowManager.h"
+# include "UIIconPool.h"
+# include "UIVirtualBoxEventHandler.h"
+
+# ifdef Q_WS_X11
+#  include "UIHostComboEditor.h"
+#  ifndef VBOX_OSE
 #  include "VBoxLicenseViewer.h"
-# endif /* VBOX_OSE */
-# include "VBoxX11Helper.h"
-#endif /* Q_WS_X11 */
+#  endif /* VBOX_OSE */
+# endif /* Q_WS_X11 */
 
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-# include "UIMachineWindowFullscreen.h"
-# include "UIMachineWindowSeamless.h"
-#endif /* Q_WS_MAC */
+# ifdef Q_WS_MAC
+#  include "VBoxUtils-darwin.h"
+#  include "UIMachineWindowFullscreen.h"
+#  include "UIMachineWindowSeamless.h"
+# endif /* Q_WS_MAC */
 
-#ifdef VBOX_WITH_VIDEOHWACCEL
-# include "VBoxFBOverlay.h"
-#endif /* VBOX_WITH_VIDEOHWACCEL */
+# ifdef VBOX_WITH_VIDEOHWACCEL
+#  include "VBoxFBOverlay.h"
+# endif /* VBOX_WITH_VIDEOHWACCEL */
 
 /* COM includes: */
-#include "CMachine.h"
-#include "CSystemProperties.h"
-#include "CUSBDevice.h"
-#include "CUSBDeviceFilters.h"
-#include "CUSBDeviceFilter.h"
-#include "CBIOSSettings.h"
-#include "CVRDEServer.h"
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
-#include "CAudioAdapter.h"
-#include "CNetworkAdapter.h"
-#include "CSerialPort.h"
-#include "CParallelPort.h"
-#include "CUSBController.h"
-#include "CHostUSBDevice.h"
-#include "CHostVideoInputDevice.h"
-#include "CMediumFormat.h"
-#include "CSharedFolder.h"
-#include "CConsole.h"
-#include "CSnapshot.h"
+# include "CMachine.h"
+# include "CSystemProperties.h"
+# include "CUSBDevice.h"
+# include "CUSBDeviceFilters.h"
+# include "CUSBDeviceFilter.h"
+# include "CBIOSSettings.h"
+# include "CVRDEServer.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
+# include "CAudioAdapter.h"
+# include "CNetworkAdapter.h"
+# include "CSerialPort.h"
+# include "CParallelPort.h"
+# include "CUSBController.h"
+# include "CHostUSBDevice.h"
+# include "CHostVideoInputDevice.h"
+# include "CMediumFormat.h"
+# include "CSharedFolder.h"
+# include "CConsole.h"
+# include "CSnapshot.h"
 
 /* Other VBox includes: */
-#include <iprt/asm.h>
-#include <iprt/ctype.h>
-#include <iprt/err.h>
-#include <iprt/param.h>
-#include <iprt/path.h>
-#include <iprt/env.h>
-#include <iprt/file.h>
-#include <iprt/ldr.h>
-#include <iprt/system.h>
-#include <iprt/stream.h>
+# include <iprt/asm.h>
+# include <iprt/param.h>
+# include <iprt/path.h>
+# include <iprt/env.h>
+# include <iprt/ldr.h>
+# include <iprt/system.h>
+# include <iprt/stream.h>
+# ifdef Q_WS_X11
+#  include <iprt/mem.h>
+# endif /* Q_WS_X11 */
+
+# include <VBox/sup.h>
+# include <VBox/com/Guid.h>
+
+# ifdef Q_WS_WIN
+#  include "shlobj.h"
+# endif /* Q_WS_WIN */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
+
+#include <QLibraryInfo>
+#include <QProgressDialog>
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+# include <QNetworkProxy>
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+#include <QReadLocker>
+#include <QSettings>
+#include <QStyleOptionSpinBox>
 
+#include <VBox/VBoxOGL.h>
 #include <VBox/vd.h>
-#include <VBox/sup.h>
-#include <VBox/com/Guid.h>
-#include <VBox/VBoxOGLTest.h>
 
-#ifdef Q_WS_X11
-#include <iprt/mem.h>
-#endif /* Q_WS_X11 */
+#include <iprt/ctype.h>
+#include <iprt/err.h>
+#include <iprt/file.h>
 
 #ifdef Q_WS_MAC
-#include <sys/utsname.h>
+# include <sys/utsname.h>
 #endif /* Q_WS_MAC */
 
 /* External includes: */
-#include <math.h>
-
-#ifdef Q_WS_WIN
-#include "shlobj.h"
-#endif /* Q_WS_WIN */
+# include <math.h>
 
 #ifdef Q_WS_X11
-#undef BOOL /* typedef CARD8 BOOL in Xmd.h conflicts with #define BOOL PRBool
-             * in COMDefs.h. A better fix would be to isolate X11-specific
-             * stuff by placing XX* helpers below to a separate source file. */
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/extensions/Xinerama.h>
-#define BOOL PRBool
+# undef BOOL /* typedef CARD8 BOOL in Xmd.h conflicts with #define BOOL PRBool
+              * in COMDefs.h. A better fix would be to isolate X11-specific
+              * stuff by placing XX* helpers below to a separate source file. */
+# include <X11/X.h>
+# include <X11/Xmd.h>
+# include <X11/Xlib.h>
+# include <X11/Xatom.h>
+# include <X11/extensions/Xinerama.h>
+
+# define BOOL PRBool
+# include "VBoxX11Helper.h"
 #endif /* Q_WS_X11 */
 
+
 //#define VBOX_WITH_FULL_DETAILS_REPORT /* hidden for now */
 
-//#warning "port me: check this"
-/// @todo bird: Use (U)INT_PTR, (U)LONG_PTR, DWORD_PTR, or (u)intptr_t.
-#if defined(Q_OS_WIN64)
-typedef __int64 Q_LONG;             /* word up to 64 bit signed */
-typedef unsigned __int64 Q_ULONG;   /* word up to 64 bit unsigned */
-#else
-typedef long Q_LONG;                /* word up to 64 bit signed */
-typedef unsigned long Q_ULONG;      /* word up to 64 bit unsigned */
-#endif
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+
 
 // VBoxGlobal
 ////////////////////////////////////////////////////////////////////////////////
 
-/** @internal
- *
- *  Determines the rendering mode from the argument. Sets the appropriate
- *  default rendering mode if the argument is NULL.
- */
-static RenderMode vboxGetRenderMode (const char *aModeStr)
-{
-    RenderMode mode = InvalidRenderMode;
-
-#ifdef VBOX_GUI_USE_QIMAGE
-    mode = QImageMode;
-#else /* !VBOX_GUI_USE_QIMAGE */
-# error "Cannot determine the default render mode!"
-#endif /* !VBOX_GUI_USE_QIMAGE */
-
-    if (aModeStr)
-    {
-        if (0) ;
-#ifdef VBOX_GUI_USE_QIMAGE
-        else if (::strcmp(aModeStr, "image") == 0)
-            mode = QImageMode;
-#endif /* VBOX_GUI_USE_QIMAGE */
-#ifdef VBOX_GUI_USE_QUARTZ2D
-        else if (::strcmp(aModeStr, "quartz2d") == 0)
-            mode = Quartz2DMode;
-#endif /* VBOX_GUI_USE_QUARTZ2D */
-    }
-
-    return mode;
-}
-
 /* static */
 bool VBoxGlobal::m_sfCleanupInProgress = false;
 VBoxGlobal* VBoxGlobal::m_spInstance = 0;
@@ -246,8 +227,9 @@ void VBoxGlobal::destroy()
 
 VBoxGlobal::VBoxGlobal()
     : mValid (false)
+    , m_fVBoxSVCAvailable(true)
     , mSelectorWnd (NULL)
-    , m_pVirtualMachine(0)
+    , m_fSeparateProcess(false)
     , m_pMediumEnumerator(0)
     , mIsKWinManaged (false)
 #if defined(DEBUG_bird)
@@ -265,6 +247,7 @@ VBoxGlobal::VBoxGlobal()
     , mVerString("1.0")
     , m3DAvailable(-1)
     , mSettingsPwSet(false)
+    , m_pIconPool(0)
 {
     /* Assign instance: */
     m_spInstance = this;
@@ -308,17 +291,17 @@ uint VBoxGlobal::qtCTVersion()
 
 QString VBoxGlobal::vboxVersionString() const
 {
-    return mVBox.GetVersion();
+    return m_vbox.GetVersion();
 }
 
 QString VBoxGlobal::vboxVersionStringNormalized() const
 {
-    return mVBox.GetVersionNormalized();
+    return m_vbox.GetVersionNormalized();
 }
 
 bool VBoxGlobal::isBeta() const
 {
-    return mVBox.GetVersion().contains("BETA", Qt::CaseInsensitive);
+    return m_vbox.GetVersion().contains("BETA", Qt::CaseInsensitive);
 }
 
 #ifdef Q_WS_MAC
@@ -355,11 +338,11 @@ MacOSXRelease VBoxGlobal::osRelease()
  */
 bool VBoxGlobal::setSettings (VBoxGlobalSettings &gs)
 {
-    gs.save (mVBox);
+    gs.save(m_vbox);
 
-    if (!mVBox.isOk())
+    if (!m_vbox.isOk())
     {
-        msgCenter().cannotSaveGlobalConfig (mVBox);
+        msgCenter().cannotSaveGlobalConfig(m_vbox);
         return false;
     }
 
@@ -398,63 +381,18 @@ UISelectorWindow &VBoxGlobal::selectorWnd()
     return *mSelectorWnd;
 }
 
-bool VBoxGlobal::startMachine(const QString &strMachineId)
-{
-    /* Some restrictions: */
-    AssertMsg(mValid, ("VBoxGlobal is invalid"));
-    AssertMsg(!m_pVirtualMachine, ("Machine already started"));
-
-    /* Restore current snapshot if asked to do so: */
-    if (mRestoreCurrentSnapshot)
-    {
-        CSession session = vboxGlobal().openSession(strMachineId, KLockType_VM);
-        if (session.isNull())
-            return false;
-
-        CConsole  console  = session.GetConsole();
-        CMachine  machine  = session.GetMachine();
-        CSnapshot snapshot = machine.GetCurrentSnapshot();
-        CProgress progress = console.RestoreSnapshot(snapshot);
-        if (!console.isOk())
-            return msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), machine.GetName());
-
-        /* Show the snapshot-discard progress: */
-        msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_discard_90px.png");
-        if (progress.GetResultCode() != 0)
-            return msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machine.GetName());
-        session.UnlockMachine();
-
-        /* Clear the restore flag so media enum can be started, should be safe now. */
-        mRestoreCurrentSnapshot = false;
-    }
-
-    /* Create VM session: */
-    CSession session = vboxGlobal().openSession(strMachineId, KLockType_VM);
-    if (session.isNull())
-        return false;
-
-    /* Start virtual machine: */
-    UIMachine *pVirtualMachine = new UIMachine(&m_pVirtualMachine, session);
-    Assert(pVirtualMachine == m_pVirtualMachine);
-    Q_UNUSED(pVirtualMachine);
-    return true;
-}
-
-UIMachine* VBoxGlobal::virtualMachine()
+UIMachine* VBoxGlobal::virtualMachine() const
 {
-    return m_pVirtualMachine;
+    return gpMachine;
 }
 
-QWidget* VBoxGlobal::activeMachineWindow()
+QWidget* VBoxGlobal::activeMachineWindow() const
 {
-    /* Null if that is NOT console-process or machine not yet created: */
-    if (!isVMConsoleProcess() || !m_pVirtualMachine)
-        return 0;
-    /* Active machine-window otherwise: */
-    return m_pVirtualMachine->activeWindow();
+    if (isVMConsoleProcess() && gpMachine && gpMachine->activeWindow())
+        return gpMachine->activeWindow();
+    return 0;
 }
 
-
 /**
  * Inner worker that for lazily querying for 3D support.
  *
@@ -665,15 +603,16 @@ QList<CGuestOSType> VBoxGlobal::vmGuestOSTypeList(const QString &aFamilyId) cons
            mTypes[mFamilyIDs.indexOf(aFamilyId)] : QList<CGuestOSType>();
 }
 
-/**
- *  Returns the icon corresponding to the given guest OS type id.
- */
-QPixmap VBoxGlobal::vmGuestOSTypeIcon(const QString &aTypeId) const
+QPixmap VBoxGlobal::vmGuestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize /* = 0 */) const
 {
-    static const QPixmap none;
-    QPixmap *p = mOsTypeIcons.value(aTypeId);
-    AssertMsg(p, ("Icon for type '%s' must be defined.", aTypeId.toLatin1().constData()));
-    return p ? *p : none;
+    /* Prepare fallback pixmap: */
+    static QPixmap nullPixmap;
+
+    /* Make sure general icon-pool initialized: */
+    AssertReturn(m_pIconPool, nullPixmap);
+
+    /* Redirect to general icon-pool: */
+    return m_pIconPool->guestOSTypeIcon(strOSTypeID, pLogicalSize);
 }
 
 /**
@@ -1018,12 +957,12 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
     static const char *sTableTpl =
         "<table border=0 cellspacing=1 cellpadding=0>%1</table>";
     static const char *sSectionHrefTpl =
-        "<tr><td width=22 rowspan=%1 align=left><img src='%2'></td>"
+        "<tr><td width=22 rowspan=%1 align=left><img width=16 height=16 src='%2'></td>"
             "<td colspan=3><b><a href='%3'><nobr>%4</nobr></a></b></td></tr>"
             "%5"
         "<tr><td colspan=3><font size=1> </font></td></tr>";
     static const char *sSectionBoldTpl =
-        "<tr><td width=22 rowspan=%1 align=left><img src='%2'></td>"
+        "<tr><td width=22 rowspan=%1 align=left><img width=16 height=16 src='%2'></td>"
             "<td colspan=3><!-- %3 --><b><nobr>%4</nobr></b></td></tr>"
             "%5"
         "<tr><td colspan=3><font size=1> </font></td></tr>";
@@ -1056,15 +995,17 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
 
     /* System */
     {
+#ifdef VBOX_WITH_FULL_DETAILS_REPORT
         /* BIOS Settings holder */
         CBIOSSettings biosSettings = aMachine.GetBIOSSettings();
+#endif /* VBOX_WITH_FULL_DETAILS_REPORT */
 
         /* System details row count: */
         int iRowCount = 2; /* Memory & CPU details rows initially. */
 
         /* Boot order */
         QString bootOrder;
-        for (ulong i = 1; i <= mVBox.GetSystemProperties().GetMaxBootPosition(); ++ i)
+        for (ulong i = 1; i <= m_vbox.GetSystemProperties().GetMaxBootPosition(); ++ i)
         {
             KDeviceType device = aMachine.GetBootOrder (i);
             if (device == KDeviceType_Null)
@@ -1113,6 +1054,11 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
         if (fVTxAMDVSupported)
             iRowCount += 2; /* VT-x/AMD-V items. */
 
+        /* Paravirtualization Interface: */
+        const QString strParavirtProvider = gpConverter->toString(aMachine.GetParavirtProvider());
+
+        iRowCount += 1; /* Paravirtualization Interface. */
+
         QString item = QString (sSectionItemTpl2).arg (tr ("Base Memory", "details report"),
                                                        tr ("<nobr>%1 MB</nobr>", "details report"))
                        .arg (aMachine.GetMemorySize())
@@ -1134,6 +1080,8 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
                 item += QString (sSectionItemTpl2).arg (tr ("VT-x/AMD-V", "details report"), virt)
                      +  QString (sSectionItemTpl2).arg (tr ("Nested Paging", "details report"), nested);
 
+        item += QString(sSectionItemTpl2).arg(tr("Paravirtualization Interface", "details report"), strParavirtProvider);
+
         report += sectionTpl
                   .arg (2 + iRowCount) /* rows */
                   .arg (":/chipset_16px.png", /* icon */
@@ -1231,8 +1179,8 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
                 const CMediumAttachment &attachment = attachments[j];
                 /* Prepare current storage slot: */
                 StorageSlot attachmentSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice());
-                /* Append 'device slot name' with 'device type name' for CD/DVD devices only: */
-                QString strDeviceType = attachment.GetType() == KDeviceType_DVD ? tr("(CD/DVD)") : QString();
+                /* Append 'device slot name' with 'device type name' for optical devices only: */
+                QString strDeviceType = attachment.GetType() == KDeviceType_DVD ? tr("(Optical Drive)") : QString();
                 if (!strDeviceType.isNull())
                     strDeviceType.prepend(' ');
                 /* Prepare current medium object: */
@@ -1305,7 +1253,7 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
     {
         QString item;
 
-        ulong count = mVBox.GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
+        ulong count = m_vbox.GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
         int rows = 2; /* including section header and footer */
         for (ulong slot = 0; slot < count; slot ++)
         {
@@ -1362,7 +1310,7 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
     {
         QString item;
 
-        ulong count = mVBox.GetSystemProperties().GetSerialPortCount();
+        ulong count = m_vbox.GetSystemProperties().GetSerialPortCount();
         int rows = 2; /* including section header and footer */
         for (ulong slot = 0; slot < count; slot ++)
         {
@@ -1374,6 +1322,7 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
                     toCOMPortName (port.GetIRQ(), port.GetIOBase()) + ", ";
                 if (mode == KPortMode_HostPipe ||
                     mode == KPortMode_HostDevice ||
+                    mode == KPortMode_TCP ||
                     mode == KPortMode_RawFile)
                     data += QString ("%1 (<nobr>%2</nobr>)")
                             .arg (gpConverter->toString (mode))
@@ -1407,7 +1356,7 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
     {
         QString item;
 
-        ulong count = mVBox.GetSystemProperties().GetParallelPortCount();
+        ulong count = m_vbox.GetSystemProperties().GetParallelPortCount();
         int rows = 2; /* including section header and footer */
         for (ulong slot = 0; slot < count; slot ++)
         {
@@ -1450,11 +1399,10 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
         if (   !flts.isNull()
             && aMachine.GetUSBProxyAvailable())
         {
-            /* the USB controller may be unavailable (i.e. in VirtualBox OSE) */
-
-            ULONG cOhciCtls = aMachine.GetUSBControllerCountByType(KUSBControllerType_OHCI);
-
-            if (cOhciCtls)
+            /* The USB controller may be unavailable (i.e. in VirtualBox OSE): */
+            if (aMachine.GetUSBControllers().isEmpty())
+                item = QString(sSectionItemTpl1).arg(tr("Disabled", "details report (USB)"));
+            else
             {
                 CUSBDeviceFilterVector coll = flts.GetDeviceFilters();
                 uint active = 0;
@@ -1467,9 +1415,6 @@ QString VBoxGlobal::detailsReport (const CMachine &aMachine, bool aWithLinks)
                              tr ("%1 (%2 active)", "details report (USB)")
                                  .arg (coll.size()).arg (active));
             }
-            else
-                item = QString (sSectionItemTpl1)
-                       .arg (tr ("Disabled", "details report (USB)"));
 
             report += sectionTpl
                 .arg (2 + 1) /* rows */
@@ -1524,13 +1469,16 @@ CSession VBoxGlobal::openSession(const QString &strId, KLockType lockType /* = K
         }
 
         /* Search for the corresponding machine: */
-        CMachine machine = mVBox.FindMachine(strId);
+        CMachine machine = m_vbox.FindMachine(strId);
         if (machine.isNull())
         {
-            msgCenter().cannotFindMachineById(mVBox, strId);
+            msgCenter().cannotFindMachineById(m_vbox, strId);
             break;
         }
 
+        if (lockType == KLockType_VM)
+            session.SetName("GUI/Qt");
+
         /* Lock found machine to session: */
         machine.LockMachine(session, lockType);
         if (!machine.isOk())
@@ -1633,11 +1581,11 @@ QString VBoxGlobal::openMediumWithFileOpenDialog(UIMediumType mediumType, QWidge
             filters = vboxGlobal().HDDBackends();
             strTitle = tr("Please choose a virtual hard drive file");
             allType = tr("All virtual hard drive files (%1)");
-            strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);
+            strLastFolder = gEDataManager->recentFolderForHardDrives();
             if (strLastFolder.isEmpty())
-                strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);
+                strLastFolder = gEDataManager->recentFolderForOpticalDisks();
             if (strLastFolder.isEmpty())
-                strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);
+                strLastFolder = gEDataManager->recentFolderForFloppyDisks();
             break;
         }
         case UIMediumType_DVD:
@@ -1645,11 +1593,11 @@ QString VBoxGlobal::openMediumWithFileOpenDialog(UIMediumType mediumType, QWidge
             filters = vboxGlobal().DVDBackends();
             strTitle = tr("Please choose a virtual optical disk file");
             allType = tr("All virtual optical disk files (%1)");
-            strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);
+            strLastFolder = gEDataManager->recentFolderForOpticalDisks();
             if (strLastFolder.isEmpty())
-                strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);
+                strLastFolder = gEDataManager->recentFolderForFloppyDisks();
             if (strLastFolder.isEmpty())
-                strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);
+                strLastFolder = gEDataManager->recentFolderForHardDrives();
             break;
         }
         case UIMediumType_Floppy:
@@ -1657,11 +1605,11 @@ QString VBoxGlobal::openMediumWithFileOpenDialog(UIMediumType mediumType, QWidge
             filters = vboxGlobal().FloppyBackends();
             strTitle = tr("Please choose a virtual floppy disk file");
             allType = tr("All virtual floppy disk files (%1)");
-            strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderFD);
+            strLastFolder = gEDataManager->recentFolderForFloppyDisks();
             if (strLastFolder.isEmpty())
-                strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderCD);
+                strLastFolder = gEDataManager->recentFolderForOpticalDisks();
             if (strLastFolder.isEmpty())
-                strLastFolder = virtualBox().GetExtraData(GUI_RecentFolderHD);
+                strLastFolder = gEDataManager->recentFolderForHardDrives();
             break;
         }
         default:
@@ -1701,26 +1649,37 @@ QString VBoxGlobal::openMedium(UIMediumType mediumType, QString strMediumLocatio
     strMediumLocation = QDir::toNativeSeparators(strMediumLocation);
 
     /* Initialize variables: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
+    CVirtualBox vbox = virtualBox();
 
     /* Remember the path of the last chosen medium: */
-    QString strRecentFolderKey = mediumType == UIMediumType_HardDisk ? GUI_RecentFolderHD :
-                                 mediumType == UIMediumType_DVD ? GUI_RecentFolderCD :
-                                 mediumType == UIMediumType_Floppy ? GUI_RecentFolderFD :
-                                 QString();
-    vbox.SetExtraData(strRecentFolderKey, QFileInfo(strMediumLocation).absolutePath());
+    switch (mediumType)
+    {
+        case UIMediumType_HardDisk: gEDataManager->setRecentFolderForHardDrives(QFileInfo(strMediumLocation).absolutePath()); break;
+        case UIMediumType_DVD:      gEDataManager->setRecentFolderForOpticalDisks(QFileInfo(strMediumLocation).absolutePath()); break;
+        case UIMediumType_Floppy:   gEDataManager->setRecentFolderForFloppyDisks(QFileInfo(strMediumLocation).absolutePath()); break;
+        default: break;
+    }
 
     /* Update recently used list: */
-    QString strRecentListKey = mediumType == UIMediumType_HardDisk ? GUI_RecentListHD :
-                               mediumType == UIMediumType_DVD ? GUI_RecentListCD :
-                               mediumType == UIMediumType_Floppy ? GUI_RecentListFD :
-                               QString();
-    QStringList recentMediumList = vbox.GetExtraData(strRecentListKey).split(';');
+    QStringList recentMediumList;
+    switch (mediumType)
+    {
+        case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break;
+        case UIMediumType_DVD:      recentMediumList = gEDataManager->recentListOfOpticalDisks(); break;
+        case UIMediumType_Floppy:   recentMediumList = gEDataManager->recentListOfFloppyDisks(); break;
+        default: break;
+    }
     if (recentMediumList.contains(strMediumLocation))
         recentMediumList.removeAll(strMediumLocation);
     recentMediumList.prepend(strMediumLocation);
     while(recentMediumList.size() > 5) recentMediumList.removeLast();
-    vbox.SetExtraData(strRecentListKey, recentMediumList.join(";"));
+    switch (mediumType)
+    {
+        case UIMediumType_HardDisk: gEDataManager->setRecentListOfHardDrives(recentMediumList); break;
+        case UIMediumType_DVD:      gEDataManager->setRecentListOfOpticalDisks(recentMediumList); break;
+        case UIMediumType_Floppy:   gEDataManager->setRecentListOfFloppyDisks(recentMediumList); break;
+        default: break;
+    }
 
     /* Open corresponding medium: */
     CMedium cmedium = vbox.OpenMedium(strMediumLocation, mediumTypeToGlobal(mediumType), KAccessMode_ReadWrite, false);
@@ -1804,6 +1763,314 @@ QList<QString> VBoxGlobal::mediumIDs() const
     return QList<QString>();
 }
 
+void VBoxGlobal::prepareStorageMenu(QMenu &menu,
+                                    QObject *pListener, const char *pszSlotName,
+                                    const CMachine &machine, const QString &strControllerName, const StorageSlot &storageSlot)
+{
+    /* Current attachment attributes: */
+    const CMediumAttachment currentAttachment = machine.GetMediumAttachment(strControllerName, storageSlot.port, storageSlot.device);
+    const CMedium currentMedium = currentAttachment.GetMedium();
+    const QString strCurrentID = currentMedium.isNull() ? QString() : currentMedium.GetId();
+    const QString strCurrentLocation = currentMedium.isNull() ? QString() : currentMedium.GetLocation();
+
+    /* Other medium-attachments of same machine: */
+    const CMediumAttachmentVector attachments = machine.GetMediumAttachments();
+
+    /* Determine device & medium types: */
+    const UIMediumType mediumType = mediumTypeToLocal(currentAttachment.GetType());
+    AssertMsgReturnVoid(mediumType != UIMediumType_Invalid, ("Incorrect storage medium type!\n"));
+
+
+    /* Prepare open-existing-medium action: */
+    QAction *pActionOpenExistingMedium = menu.addAction(QIcon(":/select_file_16px.png"), QString(), pListener, pszSlotName);
+    pActionOpenExistingMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(), currentAttachment.GetDevice(),
+                                                                          mediumType)));
+    switch (mediumType)
+    {
+        case UIMediumType_HardDisk:
+            pActionOpenExistingMedium->setText(QApplication::translate("UIMachineSettingsStorage", "Choose a virtual hard disk file..."));
+            break;
+        case UIMediumType_DVD:
+            pActionOpenExistingMedium->setText(QApplication::translate("UIMachineSettingsStorage", "Choose a virtual optical disk file..."));
+            break;
+        case UIMediumType_Floppy:
+            pActionOpenExistingMedium->setText(QApplication::translate("UIMachineSettingsStorage", "Choose a virtual floppy disk file..."));
+            break;
+        default:
+            break;
+    }
+
+
+    /* Insert separator: */
+    menu.addSeparator();
+
+
+    /* Get existing-host-drive vector: */
+    CMediumVector mediums;
+    switch (mediumType)
+    {
+        case UIMediumType_DVD:    mediums = vboxGlobal().host().GetDVDDrives(); break;
+        case UIMediumType_Floppy: mediums = vboxGlobal().host().GetFloppyDrives(); break;
+        default: break;
+    }
+    /* Prepare choose-existing-host-drive actions: */
+    foreach (const CMedium &medium, mediums)
+    {
+        /* Make sure host-drive usage is unique: */
+        bool fIsHostDriveUsed = false;
+        foreach (const CMediumAttachment &otherAttachment, attachments)
+        {
+            if (otherAttachment != currentAttachment)
+            {
+                const CMedium &otherMedium = otherAttachment.GetMedium();
+                if (!otherMedium.isNull() && otherMedium.GetId() == medium.GetId())
+                {
+                    fIsHostDriveUsed = true;
+                    break;
+                }
+            }
+        }
+        /* If host-drives usage is unique: */
+        if (!fIsHostDriveUsed)
+        {
+            QAction *pActionChooseHostDrive = menu.addAction(UIMedium(medium, mediumType).name(), pListener, pszSlotName);
+            pActionChooseHostDrive->setCheckable(true);
+            pActionChooseHostDrive->setChecked(!currentMedium.isNull() && medium.GetId() == strCurrentID);
+            pActionChooseHostDrive->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(), currentAttachment.GetDevice(),
+                                                                               mediumType, UIMediumTarget::UIMediumTargetType_WithID, medium.GetId())));
+        }
+    }
+
+
+    /* Get recent-medium list: */
+    QStringList recentMediumList;
+    switch (mediumType)
+    {
+        case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break;
+        case UIMediumType_DVD:      recentMediumList = gEDataManager->recentListOfOpticalDisks(); break;
+        case UIMediumType_Floppy:   recentMediumList = gEDataManager->recentListOfFloppyDisks(); break;
+        default: break;
+    }
+    /* Prepare choose-recent-medium actions: */
+    foreach (const QString &strRecentMediumLocationBase, recentMediumList)
+    {
+        /* Convert separators to native: */
+        const QString strRecentMediumLocation = QDir::toNativeSeparators(strRecentMediumLocationBase);
+        /* Confirm medium presence: */
+        if (!QFile::exists(strRecentMediumLocation))
+            continue;
+        /* Make sure recent-medium usage is unique: */
+        bool fIsRecentMediumUsed = false;
+        foreach (const CMediumAttachment &otherAttachment, attachments)
+        {
+            if (otherAttachment != currentAttachment)
+            {
+                const CMedium &otherMedium = otherAttachment.GetMedium();
+                if (!otherMedium.isNull() && otherMedium.GetLocation() == strRecentMediumLocation)
+                {
+                    fIsRecentMediumUsed = true;
+                    break;
+                }
+            }
+        }
+        /* If recent-medium usage is unique: */
+        if (!fIsRecentMediumUsed)
+        {
+            QAction *pActionChooseRecentMedium = menu.addAction(QFileInfo(strRecentMediumLocation).fileName(), pListener, pszSlotName);
+            pActionChooseRecentMedium->setCheckable(true);
+            pActionChooseRecentMedium->setChecked(!currentMedium.isNull() && strRecentMediumLocation == strCurrentLocation);
+            pActionChooseRecentMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(), currentAttachment.GetDevice(),
+                                                                                  mediumType, UIMediumTarget::UIMediumTargetType_WithLocation, strRecentMediumLocation)));
+            pActionChooseRecentMedium->setToolTip(strRecentMediumLocation);
+        }
+    }
+
+
+    /* Last action for optical/floppy attachments only: */
+    if (mediumType == UIMediumType_DVD || mediumType == UIMediumType_Floppy)
+    {
+        /* Insert separator: */
+        menu.addSeparator();
+
+        /* Prepare unmount-current-medium action: */
+        QAction *pActionUnmountMedium = menu.addAction(QString(), pListener, pszSlotName);
+        pActionUnmountMedium->setEnabled(!currentMedium.isNull());
+        pActionUnmountMedium->setData(QVariant::fromValue(UIMediumTarget(strControllerName, currentAttachment.GetPort(), currentAttachment.GetDevice())));
+        pActionUnmountMedium->setText(QApplication::translate("UIMachineSettingsStorage", "Remove disk from virtual drive"));
+        if (mediumType == UIMediumType_DVD)
+            pActionUnmountMedium->setIcon(UIIconPool::iconSet(":/cd_unmount_16px.png", ":/cd_unmount_disabled_16px.png"));
+        else if (mediumType == UIMediumType_Floppy)
+            pActionUnmountMedium->setIcon(UIIconPool::iconSet(":/fd_unmount_16px.png", ":/fd_unmount_disabled_16px.png"));
+    }
+}
+
+void VBoxGlobal::updateMachineStorage(const CMachine &constMachine, const UIMediumTarget &target)
+{
+    /* Mount (by default): */
+    bool fMount = true;
+    /* Null medium (by default): */
+    CMedium cmedium;
+    /* With null ID (by default): */
+    QString strActualID;
+
+    /* Current mount-target attributes: */
+    const CStorageController currentController = constMachine.GetStorageControllerByName(target.name);
+    const KStorageBus currentStorageBus = currentController.GetBus();
+    const CMediumAttachment currentAttachment = constMachine.GetMediumAttachment(target.name, target.port, target.device);
+    const CMedium currentMedium = currentAttachment.GetMedium();
+    const QString strCurrentID = currentMedium.isNull() ? QString() : currentMedium.GetId();
+    const QString strCurrentLocation = currentMedium.isNull() ? QString() : currentMedium.GetLocation();
+
+    /* Which additional info do we have? */
+    switch (target.type)
+    {
+        /* Do we have an exact ID? */
+        case UIMediumTarget::UIMediumTargetType_WithID:
+        {
+            /* New mount-target attributes: */
+            QString strNewID;
+
+            /* Invoke file-open dialog to choose medium ID: */
+            if (target.mediumType != UIMediumType_Invalid && target.data.isNull())
+            {
+                /* Keyboard can be captured by machine-view.
+                 * So we should clear machine-view focus to let file-open dialog get it.
+                 * That way the keyboard will be released too.. */
+                QWidget *pLastFocusedWidget = 0;
+                if (QApplication::focusWidget())
+                {
+                    pLastFocusedWidget = QApplication::focusWidget();
+                    pLastFocusedWidget->clearFocus();
+                }
+                /* Call for file-open dialog: */
+                const QString strMachineFolder(QFileInfo(constMachine.GetSettingsFilePath()).absolutePath());
+                const QString strMediumID = vboxGlobal().openMediumWithFileOpenDialog(target.mediumType, windowManager().mainWindowShown(),
+                                                                                      strMachineFolder);
+                /* Return focus back: */
+                if (pLastFocusedWidget)
+                    pLastFocusedWidget->setFocus();
+                /* Accept new medium ID: */
+                if (!strMediumID.isNull())
+                    strNewID = strMediumID;
+                /* Else just exit: */
+                else return;
+            }
+            /* Use medium ID which was passed: */
+            else if (!target.data.isNull() && target.data != strCurrentID)
+                strNewID = target.data;
+
+            /* Should we mount or unmount? */
+            fMount = !strNewID.isEmpty();
+
+            /* Prepare target medium: */
+            const UIMedium uimedium = vboxGlobal().medium(strNewID);
+            cmedium = uimedium.medium();
+            strActualID = fMount ? strNewID : strCurrentID;
+            break;
+        }
+        /* Do we have a resent location? */
+        case UIMediumTarget::UIMediumTargetType_WithLocation:
+        {
+            /* Open medium by location and get new medium ID if any: */
+            const QString strNewID = vboxGlobal().openMedium(target.mediumType, target.data);
+            /* Else just exit: */
+            if (strNewID.isEmpty())
+                return;
+
+            /* Should we mount or unmount? */
+            fMount = strNewID != strCurrentID;
+
+            /* Prepare target medium: */
+            const UIMedium uimedium = fMount ? vboxGlobal().medium(strNewID) : UIMedium();
+            cmedium = fMount ? uimedium.medium() : CMedium();
+            strActualID = fMount ? strNewID : strCurrentID;
+            break;
+        }
+    }
+
+    /* Do not unmount hard-drives: */
+    if (target.mediumType == UIMediumType_HardDisk && !fMount)
+        return;
+
+    /* Get editable machine: */
+    CSession session;
+    CMachine machine = constMachine;
+    KSessionState sessionState = machine.GetSessionState();
+    /* Session state unlocked? */
+    if (sessionState == KSessionState_Unlocked)
+    {
+        /* Open own 'write' session: */
+        session = openSession(machine.GetId());
+        AssertReturnVoid(!session.isNull());
+        machine = session.GetMachine();
+    }
+    /* Is it Selector UI call? */
+    else if (!isVMConsoleProcess())
+    {
+        /* Open existing 'shared' session: */
+        session = openExistingSession(machine.GetId());
+        AssertReturnVoid(!session.isNull());
+        machine = session.GetMachine();
+    }
+    /* Else this is Runtime UI call
+     * which has session locked for itself. */
+
+    /* Remount medium to the predefined port/device: */
+    bool fWasMounted = false;
+    /* Hard drive case: */
+    if (target.mediumType == UIMediumType_HardDisk)
+    {
+        /* Detaching: */
+        machine.DetachDevice(target.name, target.port, target.device);
+        fWasMounted = machine.isOk();
+        if (!fWasMounted)
+            msgCenter().cannotDetachDevice(machine, UIMediumType_HardDisk, strCurrentLocation,
+                                           StorageSlot(currentStorageBus, target.port, target.device));
+        else
+        {
+            /* Attaching: */
+            machine.AttachDevice(target.name, target.port, target.device, KDeviceType_HardDisk, cmedium);
+            fWasMounted = machine.isOk();
+            if (!fWasMounted)
+                msgCenter().cannotAttachDevice(machine, UIMediumType_HardDisk, strCurrentLocation,
+                                               StorageSlot(currentStorageBus, target.port, target.device));
+        }
+    }
+    /* Optical/floppy drive case: */
+    else
+    {
+        /* Remounting: */
+        machine.MountMedium(target.name, target.port, target.device, cmedium, false /* force? */);
+        fWasMounted = machine.isOk();
+        if (!fWasMounted)
+        {
+            /* Ask for force remounting: */
+            if (msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(strActualID),
+                                                fMount, true /* retry? */))
+            {
+                /* Force remounting: */
+                machine.MountMedium(target.name, target.port, target.device, cmedium, true /* force? */);
+                fWasMounted = machine.isOk();
+                if (!fWasMounted)
+                    msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(strActualID),
+                                                    fMount, false /* retry? */);
+            }
+        }
+    }
+
+    /* Save settings: */
+    if (fWasMounted)
+    {
+        machine.SaveSettings();
+        if (!machine.isOk())
+            msgCenter().cannotSaveMachineSettings(machine, activeMachineWindow());
+    }
+
+    /* Close session to editable machine if necessary: */
+    if (!session.isNull())
+        session.UnlockMachine();
+}
+
 /**
  *  Native language name of the currently installed translation.
  *  Returns "English" if no translation is installed
@@ -1874,10 +2141,10 @@ void VBoxGlobal::retranslateUi()
 
     mUserDefinedPortName = tr ("User-defined", "serial port");
 
-    mWarningIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon).pixmap (16, 16);
+    mWarningIcon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxWarning).pixmap (16, 16);
     Assert (!mWarningIcon.isNull());
 
-    mErrorIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon).pixmap (16, 16);
+    mErrorIcon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxCritical).pixmap (16, 16);
     Assert (!mErrorIcon.isNull());
 
     /* Re-enumerate uimedium since they contain some translations too: */
@@ -3059,6 +3326,14 @@ bool VBoxGlobal::setFullScreenMonitorX11(QWidget *pWidget, ulong uScreenId)
                                uScreenId, uScreenId, uScreenId, uScreenId,
                                1 /* Source indication (1 = normal application) */);
 }
+
+/* static */
+void VBoxGlobal::setTransientFor(QWidget *pWidget, QWidget *pPropWidget)
+{
+    XSetTransientForHint(pWidget->x11Info().display(),
+                         pWidget->window()->winId(),
+                         pPropWidget->window()->winId());
+}
 #endif /* Q_WS_X11 */
 
 /**
@@ -3113,20 +3388,6 @@ QString VBoxGlobal::insertKeyToActionText(const QString &strText, const QString
         return pattern.arg(strText).arg(QKeySequence(strKey).toString(QKeySequence::NativeText));
 }
 
-/* static */
-QString VBoxGlobal::extractKeyFromActionText (const QString &aText)
-{
-    QString key;
-#ifdef Q_WS_MAC
-    QRegExp re (".* \\(Host\\+(.+)\\)");
-#else
-    QRegExp re (".* \\t\\Host\\+(.+)");
-#endif
-    if (re.exactMatch (aText))
-        key = re.cap (1);
-    return key;
-}
-
 /**
  * Joins two pixmaps horizontally with 2px space between them and returns the
  * result.
@@ -3237,7 +3498,7 @@ QList <QPair <QString, QString> > VBoxGlobal::HDDBackends()
 }
 
 /**
- * Figures out which CD/DVD disk formats are currently supported by VirtualBox.
+ * Figures out which optical disk formats are currently supported by VirtualBox.
  * Returned is a list of pairs with the form
  *   <tt>{"Backend Name", "*.suffix1 .suffix2 ..."}</tt>.
  */
@@ -3333,455 +3594,6 @@ QString VBoxGlobal::fullMediumFormatName(const QString &strBaseMediumFormatName)
     return strBaseMediumFormatName;
 }
 
-/* static */
-bool VBoxGlobal::isApprovedByExtraData(CVirtualBox &vbox, const QString &strExtraDataKey, bool fApprovedByDefault /* = false */)
-{
-    /* Load corresponding extra-data value: */
-    QString strExtraDataValue(vbox.GetExtraData(strExtraDataKey));
-
-    /* 'false' if value was not set: */
-    if (strExtraDataValue.isEmpty())
-        return fApprovedByDefault;
-
-    /* Handle particular values: */
-    return    strExtraDataValue.compare("true", Qt::CaseInsensitive) == 0
-           || strExtraDataValue.compare("yes", Qt::CaseInsensitive) == 0
-           || strExtraDataValue.compare("on", Qt::CaseInsensitive) == 0
-           || strExtraDataValue == "1";
-}
-
-/* static */
-bool VBoxGlobal::isApprovedByExtraData(CMachine &machine, const QString &strExtraDataKey, bool fApprovedByDefault /* = false */)
-{
-    /* Load corresponding extra-data value: */
-    QString strExtraDataValue(machine.GetExtraData(strExtraDataKey));
-
-    /* 'false' if value was not set: */
-    if (strExtraDataValue.isEmpty())
-        return fApprovedByDefault;
-
-    /* Handle particular values: */
-    return    strExtraDataValue.compare("true", Qt::CaseInsensitive) == 0
-           || strExtraDataValue.compare("yes", Qt::CaseInsensitive) == 0
-           || strExtraDataValue.compare("on", Qt::CaseInsensitive) == 0
-           || strExtraDataValue == "1";
-}
-
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-/* static */
-bool VBoxGlobal::shouldWeAllowApplicationUpdate(CVirtualBox &vbox)
-{
-    /* 'true' if disabling is not approved by the extra-data: */
-    return !isApprovedByExtraData(vbox, GUI_PreventApplicationUpdate);
-}
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
-#ifdef Q_WS_X11
-/* static */
-bool VBoxGlobal::legacyFullscreenModeRequested(CVirtualBox vbox)
-{
-    /* 'False' unless feature requested through the extra-data: */
-    return isApprovedByExtraData(vbox, GUI_Fullscreen_LegacyMode);
-}
-#endif /* Q_WS_X11 */
-
-/* static */
-bool VBoxGlobal::shouldWeShowMachine(CMachine &machine)
-{
-    /* 'false' for null machines: */
-    if (machine.isNull())
-        return false;
-
-    /* 'true' for inaccessible machines,
-     * because we can't verify anything in that case: */
-    if (!machine.GetAccessible())
-        return true;
-
-    /* 'true' if hiding is not approved by the extra-data: */
-    return !isApprovedByExtraData(machine, GUI_HideFromManager);
-}
-
-/* static */
-bool VBoxGlobal::shouldWeAllowMachineReconfiguration(CMachine &machine,
-                                                     bool fIncludingMachineGeneralCheck /* = false*/,
-                                                     bool fIncludingMachineStateCheck /* = false*/)
-{
-    /* Should we perform machine general check? */
-    if (fIncludingMachineGeneralCheck)
-    {
-        /* 'false' for null machines: */
-        if (machine.isNull())
-            return false;
-
-        /* 'false' for inaccessible machines,
-         * because we can't configure anything in that case: */
-        if (!machine.GetAccessible())
-            return true;
-    }
-
-    /* Should we perform machine state check? */
-    if (fIncludingMachineStateCheck)
-    {
-        /* 'false' for machines in [stuck] state: */
-        if (machine.GetState() == KMachineState_Stuck)
-            return false;
-    }
-
-    /* 'true' if reconfiguration is not restricted by the extra-data: */
-    return !isApprovedByExtraData(machine, GUI_PreventReconfiguration);
-}
-
-/* static */
-bool VBoxGlobal::shouldWeShowDetails(CMachine &machine,
-                                     bool fIncludingMachineGeneralCheck /* = false*/)
-{
-    /* Should we perform machine general check? */
-    if (fIncludingMachineGeneralCheck)
-    {
-        /* 'false' for null machines: */
-        if (machine.isNull())
-            return false;
-
-        /* 'true' for inaccessible machines,
-         * because we can't verify anything in that case: */
-        if (!machine.GetAccessible())
-            return true;
-    }
-
-    /* 'true' if hiding is not approved by the extra-data: */
-    return !isApprovedByExtraData(machine, GUI_HideDetails);
-}
-
-/* static */
-bool VBoxGlobal::shouldWeAutoMountGuestScreens(CMachine &machine,
-                                               bool fIncludingSanityCheck /* = true*/)
-{
-    if (fIncludingSanityCheck)
-    {
-        /* 'false' for null machines,
-         * there is nothing to start anyway: */
-        if (machine.isNull())
-            return false;
-
-        /* 'false' for inaccessible machines,
-         * we can't start them anyway: */
-        if (!machine.GetAccessible())
-            return false;
-    }
-
-    /* 'true' if guest-screen auto-mounting approved by the extra-data: */
-    return isApprovedByExtraData(machine, GUI_AutomountGuestScreens);
-}
-
-/* static */
-bool VBoxGlobal::shouldWeAllowSnapshotOperations(CMachine &machine,
-                                                 bool fIncludingSanityCheck /* = true*/)
-{
-    if (fIncludingSanityCheck)
-    {
-        /* 'false' for null machines,
-         * we can't operate snapshot in that case: */
-        if (machine.isNull())
-            return false;
-
-        /* 'false' for inaccessible machines,
-         * we can't operate snapshot in that case: */
-        if (!machine.GetAccessible())
-            return false;
-    }
-
-    /* 'true' if snapshot operations are not restricted by the extra-data: */
-    return !isApprovedByExtraData(machine, GUI_PreventSnapshotOperations);
-}
-
-/** Returns default machine close action for passed @a machine. */
-MachineCloseAction VBoxGlobal::defaultMachineCloseAction(CMachine &machine)
-{
-    return gpConverter->fromInternalString<MachineCloseAction>(machine.GetExtraData(GUI_DefaultCloseAction));
-}
-
-/* static */
-RuntimeMenuType VBoxGlobal::restrictedRuntimeMenuTypes(CMachine &machine)
-{
-    /* Prepare result: */
-    RuntimeMenuType result = RuntimeMenuType_Invalid;
-    /* Load restricted runtime-menu-types: */
-    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeMenus));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        RuntimeMenuType value = gpConverter->fromInternalString<RuntimeMenuType>(strValue);
-        if (value != RuntimeMenuType_Invalid)
-            result = static_cast<RuntimeMenuType>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-
-#ifdef Q_WS_MAC
-/* static */
-RuntimeMenuApplicationActionType VBoxGlobal::restrictedRuntimeMenuApplicationActionTypes(CMachine &machine)
-{
-    /* Prepare result: */
-    RuntimeMenuApplicationActionType result = RuntimeMenuApplicationActionType_Invalid;
-    /* Load restricted runtime-application-menu action-types: */
-    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeApplicationMenuActions));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        RuntimeMenuApplicationActionType value = gpConverter->fromInternalString<RuntimeMenuApplicationActionType>(strValue);
-        if (value != RuntimeMenuApplicationActionType_Invalid)
-            result = static_cast<RuntimeMenuApplicationActionType>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-#endif /* Q_WS_MAC */
-
-/* static */
-RuntimeMenuMachineActionType VBoxGlobal::restrictedRuntimeMenuMachineActionTypes(CMachine &machine)
-{
-    /* Prepare result: */
-    RuntimeMenuMachineActionType result = RuntimeMenuMachineActionType_Invalid;
-    /* Load restricted runtime-machine-menu action-types: */
-    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeMachineMenuActions));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        RuntimeMenuMachineActionType value = gpConverter->fromInternalString<RuntimeMenuMachineActionType>(strValue);
-        if (value != RuntimeMenuMachineActionType_Invalid)
-            result = static_cast<RuntimeMenuMachineActionType>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-
-/* static */
-RuntimeMenuViewActionType VBoxGlobal::restrictedRuntimeMenuViewActionTypes(CMachine &machine)
-{
-    /* Prepare result: */
-    RuntimeMenuViewActionType result = RuntimeMenuViewActionType_Invalid;
-    /* Load restricted runtime-view-menu action-types: */
-    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeViewMenuActions));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        RuntimeMenuViewActionType value = gpConverter->fromInternalString<RuntimeMenuViewActionType>(strValue);
-        if (value != RuntimeMenuViewActionType_Invalid)
-            result = static_cast<RuntimeMenuViewActionType>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-
-/* static */
-RuntimeMenuDevicesActionType VBoxGlobal::restrictedRuntimeMenuDevicesActionTypes(CMachine &machine)
-{
-    /* Prepare result: */
-    RuntimeMenuDevicesActionType result = RuntimeMenuDevicesActionType_Invalid;
-    /* Load restricted runtime-devices-menu action-types: */
-    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeDevicesMenuActions));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        RuntimeMenuDevicesActionType value = gpConverter->fromInternalString<RuntimeMenuDevicesActionType>(strValue);
-        if (value != RuntimeMenuDevicesActionType_Invalid)
-            result = static_cast<RuntimeMenuDevicesActionType>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-/* static */
-RuntimeMenuDebuggerActionType VBoxGlobal::restrictedRuntimeMenuDebuggerActionTypes(CMachine &machine)
-{
-    /* Prepare result: */
-    RuntimeMenuDebuggerActionType result = RuntimeMenuDebuggerActionType_Invalid;
-    /* Load restricted runtime-debugger-menu action-types: */
-    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeDebuggerMenuActions));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        RuntimeMenuDebuggerActionType value = gpConverter->fromInternalString<RuntimeMenuDebuggerActionType>(strValue);
-        if (value != RuntimeMenuDebuggerActionType_Invalid)
-            result = static_cast<RuntimeMenuDebuggerActionType>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-
-/* static */
-RuntimeMenuHelpActionType VBoxGlobal::restrictedRuntimeMenuHelpActionTypes(CMachine &machine)
-{
-    /* Prepare result: */
-    RuntimeMenuHelpActionType result = RuntimeMenuHelpActionType_Invalid;
-    /* Load restricted runtime-help-menu action-types: */
-    QString strList(machine.GetExtraData(GUI_RestrictedRuntimeHelpMenuActions));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        RuntimeMenuHelpActionType value = gpConverter->fromInternalString<RuntimeMenuHelpActionType>(strValue);
-        if (value != RuntimeMenuHelpActionType_Invalid)
-            result = static_cast<RuntimeMenuHelpActionType>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-
-/* static */
-UIVisualStateType VBoxGlobal::restrictedVisualStateTypes(CMachine &machine)
-{
-    /* Prepare result: */
-    UIVisualStateType result = UIVisualStateType_Invalid;
-    /* Load restricted visual-state-types: */
-    QString strList(machine.GetExtraData(GUI_RestrictedVisualStates));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        UIVisualStateType value = gpConverter->fromInternalString<UIVisualStateType>(strValue);
-        if (value != UIVisualStateType_Invalid)
-            result = static_cast<UIVisualStateType>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-
-/* static */
-QList<IndicatorType> VBoxGlobal::restrictedStatusBarIndicators(CMachine &machine)
-{
-    /* Prepare result: */
-    QList<IndicatorType> result;
-    /* Load restricted status-bar-indicators: */
-    QString strList(machine.GetExtraData(GUI_RestrictedStatusBarIndicators));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        IndicatorType value = gpConverter->fromInternalString<IndicatorType>(strValue);
-        if (value != IndicatorType_Invalid)
-            result << value;
-    }
-    /* Return result: */
-    return result;
-}
-
-/** Returns merged restricted machine close actions for passed @a machine. */
-MachineCloseAction VBoxGlobal::restrictedMachineCloseActions(CMachine &machine)
-{
-    /* Prepare result: */
-    MachineCloseAction result = MachineCloseAction_Invalid;
-    /* Load restricted machine-close-actions: */
-    QString strList(machine.GetExtraData(GUI_RestrictedCloseActions));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        MachineCloseAction value = gpConverter->fromInternalString<MachineCloseAction>(strValue);
-        if (value != MachineCloseAction_Invalid)
-            result = static_cast<MachineCloseAction>(result | value);
-    }
-    /* Return result: */
-    return result;
-}
-
-/* static */
-QList<GlobalSettingsPageType> VBoxGlobal::restrictedGlobalSettingsPages(CVirtualBox &vbox)
-{
-    /* Prepare result: */
-    QList<GlobalSettingsPageType> result;
-    /* Load restricted global-settings-pages: */
-    QString strList(vbox.GetExtraData(GUI_RestrictedGlobalSettingsPages));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        GlobalSettingsPageType value = gpConverter->fromInternalString<GlobalSettingsPageType>(strValue);
-        if (value != GlobalSettingsPageType_Invalid)
-            result << value;
-    }
-    /* Return result: */
-    return result;
-}
-
-/* static */
-QList<MachineSettingsPageType> VBoxGlobal::restrictedMachineSettingsPages(CMachine &machine)
-{
-    /* Prepare result: */
-    QList<MachineSettingsPageType> result;
-    /* Load restricted machine-settings-pages: */
-    QString strList(machine.GetExtraData(GUI_RestrictedMachineSettingsPages));
-    QStringList list = strList.split(',');
-    /* Convert list into appropriate values: */
-    foreach (const QString &strValue, list)
-    {
-        MachineSettingsPageType value = gpConverter->fromInternalString<MachineSettingsPageType>(strValue);
-        if (value != MachineSettingsPageType_Invalid)
-            result << value;
-    }
-    /* Return result: */
-    return result;
-}
-
-/* static */
-bool VBoxGlobal::activateHoveredMachineWindow(CVirtualBox &vbox)
-{
-    /* 'true' if activating is approved by the extra-data: */
-    return isApprovedByExtraData(vbox, GUI_ActivateHoveredMachineWindow, true);
-}
-
-/* static */
-void VBoxGlobal::setActivateHoveredMachineWindow(CVirtualBox &vbox, bool fActivate)
-{
-    /* "false" if activating is restricted, null-string otherwise: */
-    vbox.SetExtraData(GUI_ActivateHoveredMachineWindow, fActivate ? QString() : QString("false"));
-}
-
-#ifndef Q_WS_MAC
-/* static */
-QStringList VBoxGlobal::machineWindowIconNames(CMachine &machine)
-{
-    /* Return result: */
-    return machine.GetExtraDataStringList(GUI_MachineWindowIcons);
-}
-
-/* static */
-QString VBoxGlobal::machineWindowNamePostfix(CMachine &machine)
-{
-    return machine.GetExtraData(GUI_MachineWindowNamePostfix);
-}
-#endif /* !Q_WS_MAC */
-
-/* static */
-MouseCapturePolicy VBoxGlobal::mouseCapturePolicy(CMachine &machine)
-{
-    /* Return result: */
-    return gpConverter->fromInternalString<MouseCapturePolicy>(machine.GetExtraData(GUI_MouseCapturePolicy));
-}
-
-/* static */
-GuruMeditationHandlerType VBoxGlobal::guruMeditationHandlerType(CMachine &machine)
-{
-    /* Return result: */
-    return gpConverter->fromInternalString<GuruMeditationHandlerType>(machine.GetExtraData(GUI_GuruMeditationHandler));
-}
-
-/* static */
-HiDPIOptimizationType VBoxGlobal::hiDPIOptimizationType(CMachine &machine)
-{
-    /* Return result: */
-    return gpConverter->fromInternalString<HiDPIOptimizationType>(machine.GetExtraData(GUI_HiDPIOptimization));
-}
-
 #ifdef RT_OS_LINUX
 /* static */
 void VBoxGlobal::checkForWrongUSBMounted()
@@ -3964,24 +3776,24 @@ bool VBoxGlobal::eventFilter (QObject *aObject, QEvent *aEvent)
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
 
-bool VBoxGlobal::isDebuggerEnabled(CMachine &aMachine)
+bool VBoxGlobal::isDebuggerEnabled() const
 {
-    return isDebuggerWorker(&mDbgEnabled, aMachine, GUI_DbgEnabled);
+    return isDebuggerWorker(&m_fDbgEnabled, GUI_Dbg_Enabled);
 }
 
-bool VBoxGlobal::isDebuggerAutoShowEnabled(CMachine &aMachine)
+bool VBoxGlobal::isDebuggerAutoShowEnabled() const
 {
-    return isDebuggerWorker(&mDbgAutoShow, aMachine, GUI_DbgAutoShow);
+    return isDebuggerWorker(&m_fDbgAutoShow, GUI_Dbg_AutoShow);
 }
 
-bool VBoxGlobal::isDebuggerAutoShowCommandLineEnabled(CMachine &aMachine)
+bool VBoxGlobal::isDebuggerAutoShowCommandLineEnabled() const
 {
-    return isDebuggerWorker(&mDbgAutoShowCommandLine, aMachine, GUI_DbgAutoShow);
+    return isDebuggerWorker(&m_fDbgAutoShowCommandLine, GUI_Dbg_AutoShow);
 }
 
-bool VBoxGlobal::isDebuggerAutoShowStatisticsEnabled(CMachine &aMachine)
+bool VBoxGlobal::isDebuggerAutoShowStatisticsEnabled() const
 {
-    return isDebuggerWorker(&mDbgAutoShowStatistics, aMachine, GUI_DbgAutoShow);
+    return isDebuggerWorker(&m_fDbgAutoShowStatistics, GUI_Dbg_AutoShow);
 }
 
 #endif /* VBOX_WITH_DEBUGGER_GUI */
@@ -4016,7 +3828,7 @@ bool VBoxGlobal::processArgs()
             const QString& strFile = list.at(i).toLocalFile();
             if (VBoxGlobal::hasAllowedExtension(strFile, VBoxFileExts))
             {
-                CVirtualBox vbox = vboxGlobal().virtualBox();
+                CVirtualBox vbox = virtualBox();
                 CMachine machine = vbox.FindMachine(strFile);
                 if (!machine.isNull())
                 {
@@ -4046,6 +3858,9 @@ void VBoxGlobal::prepare()
     /* Create popup-center: */
     UIPopupCenter::create();
 
+    /* Prepare general icon-pool: */
+    m_pIconPool = new UIIconPoolGeneral;
+
     /* Load translation based on the current locale: */
     loadLanguage();
 
@@ -4069,23 +3884,31 @@ void VBoxGlobal::prepare()
         return;
     }
 
-    mVBox.createInstance (CLSID_VirtualBox);
-    if (!mVBox.isOk())
+    /* Create VirtualBox client instance: */
+    m_client.createInstance(CLSID_VirtualBoxClient);
+    /* And make sure it was created: */
+    if (!m_client.isOk())
     {
-        msgCenter().cannotCreateVirtualBox (mVBox);
+        msgCenter().cannotCreateVirtualBoxClient(m_client);
         return;
     }
-    mHost = virtualBox().GetHost();
-    mHomeFolder = virtualBox().GetHomeFolder();
+    /* Fetch corresponding objects/values: */
+    m_vbox = virtualBoxClient().GetVirtualBox();
+    m_host = virtualBox().GetHost();
+    m_strHomeFolder = virtualBox().GetHomeFolder();
+
+    /* Watch for the VBoxSVC availability changes: */
+    connect(gVBoxEvents, SIGNAL(sigVBoxSVCAvailabilityChange(bool)),
+            this, SLOT(sltHandleVBoxSVCAvailabilityChange(bool)));
 
     /* create default non-null global settings */
     gset = VBoxGlobalSettings (false);
 
     /* try to load global settings */
-    gset.load (mVBox);
-    if (!mVBox.isOk() || !gset)
+    gset.load(m_vbox);
+    if (!m_vbox.isOk() || !gset)
     {
-        msgCenter().cannotLoadGlobalConfig (mVBox, gset.lastError());
+        msgCenter().cannotLoadGlobalConfig(m_vbox, gset.lastError());
         return;
     }
 
@@ -4096,11 +3919,11 @@ void VBoxGlobal::prepare()
 
     retranslateUi();
 
-    connect(gEDataEvents, SIGNAL(sigGUILanguageChange(QString)),
+    connect(gEDataManager, SIGNAL(sigLanguageChange(QString)),
             this, SLOT(sltGUILanguageChange(QString)));
 
     /* Initialize guest OS Type list. */
-    CGuestOSTypeVector coll = mVBox.GetGuestOSTypes();
+    CGuestOSTypeVector coll = m_vbox.GetGuestOSTypes();
     int osTypeCount = coll.size();
     AssertMsg(osTypeCount > 0, ("Number of OS types must not be zero"));
     if (osTypeCount > 0)
@@ -4126,112 +3949,11 @@ void VBoxGlobal::prepare()
         }
     }
 
-    /* Fill in OS type icon dictionary. */
-    static const char * const s_kOSTypeIcons[][2] =
-    {
-        {"Other",           ":/os_other.png"},
-        {"Other_64",        ":/os_other_64.png"},
-        {"DOS",             ":/os_dos.png"},
-        {"Netware",         ":/os_netware.png"},
-        {"L4",              ":/os_l4.png"},
-        {"Windows31",       ":/os_win31.png"},
-        {"Windows95",       ":/os_win95.png"},
-        {"Windows98",       ":/os_win98.png"},
-        {"WindowsMe",       ":/os_winme.png"},
-        {"WindowsNT4",      ":/os_winnt4.png"},
-        {"Windows2000",     ":/os_win2k.png"},
-        {"WindowsXP",       ":/os_winxp.png"},
-        {"WindowsXP_64",    ":/os_winxp_64.png"},
-        {"Windows2003",     ":/os_win2k3.png"},
-        {"Windows2003_64",  ":/os_win2k3_64.png"},
-        {"WindowsVista",    ":/os_winvista.png"},
-        {"WindowsVista_64", ":/os_winvista_64.png"},
-        {"Windows2008",     ":/os_win2k8.png"},
-        {"Windows2008_64",  ":/os_win2k8_64.png"},
-        {"Windows7",        ":/os_win7.png"},
-        {"Windows7_64",     ":/os_win7_64.png"},
-        {"Windows8",        ":/os_win8.png"},
-        {"Windows8_64",     ":/os_win8_64.png"},
-        {"Windows81",       ":/os_win81.png"},
-        {"Windows81_64",    ":/os_win81_64.png"},
-        {"Windows2012_64",  ":/os_win2k12_64.png"},
-        {"Windows10",       ":/os_win10.png"},
-        {"Windows10_64",    ":/os_win10_64.png"},
-        {"WindowsNT",       ":/os_win_other.png"},
-        {"WindowsNT_64",    ":/os_win_other.png"}, /// @todo os_win_other_64.png
-        {"OS2Warp3",        ":/os_os2warp3.png"},
-        {"OS2Warp4",        ":/os_os2warp4.png"},
-        {"OS2Warp45",       ":/os_os2warp45.png"},
-        {"OS2eCS",          ":/os_os2ecs.png"},
-        {"OS2",             ":/os_os2_other.png"},
-        {"Linux22",         ":/os_linux22.png"},
-        {"Linux24",         ":/os_linux24.png"},
-        {"Linux24_64",      ":/os_linux24_64.png"},
-        {"Linux26",         ":/os_linux26.png"},
-        {"Linux26_64",      ":/os_linux26_64.png"},
-        {"ArchLinux",       ":/os_archlinux.png"},
-        {"ArchLinux_64",    ":/os_archlinux_64.png"},
-        {"Debian",          ":/os_debian.png"},
-        {"Debian_64",       ":/os_debian_64.png"},
-        {"OpenSUSE",        ":/os_opensuse.png"},
-        {"OpenSUSE_64",     ":/os_opensuse_64.png"},
-        {"Fedora",          ":/os_fedora.png"},
-        {"Fedora_64",       ":/os_fedora_64.png"},
-        {"Gentoo",          ":/os_gentoo.png"},
-        {"Gentoo_64",       ":/os_gentoo_64.png"},
-        {"Mandriva",        ":/os_mandriva.png"},
-        {"Mandriva_64",     ":/os_mandriva_64.png"},
-        {"RedHat",          ":/os_redhat.png"},
-        {"RedHat_64",       ":/os_redhat_64.png"},
-        {"Turbolinux",      ":/os_turbolinux.png"},
-        {"Turbolinux_64",   ":/os_turbolinux_64.png"},
-        {"Ubuntu",          ":/os_ubuntu.png"},
-        {"Ubuntu_64",       ":/os_ubuntu_64.png"},
-        {"Xandros",         ":/os_xandros.png"},
-        {"Xandros_64",      ":/os_xandros_64.png"},
-        {"Oracle",          ":/os_oracle.png"},
-        {"Oracle_64",       ":/os_oracle_64.png"},
-        {"Linux",           ":/os_linux_other.png"},
-        {"Linux_64",        ":/os_linux_other.png"}, /// @todo os_linux_other_64.png
-        {"FreeBSD",         ":/os_freebsd.png"},
-        {"FreeBSD_64",      ":/os_freebsd_64.png"},
-        {"OpenBSD",         ":/os_openbsd.png"},
-        {"OpenBSD_64",      ":/os_openbsd_64.png"},
-        {"NetBSD",          ":/os_netbsd.png"},
-        {"NetBSD_64",       ":/os_netbsd_64.png"},
-        {"Solaris",         ":/os_solaris.png"},
-        {"Solaris_64",      ":/os_solaris_64.png"},
-        {"OpenSolaris",     ":/os_oraclesolaris.png"},
-        {"OpenSolaris_64",  ":/os_oraclesolaris_64.png"},
-        {"Solaris11_64",    ":/os_oraclesolaris_64.png"},
-        {"QNX",             ":/os_qnx.png"},
-        {"MacOS",           ":/os_macosx.png"},
-        {"MacOS_64",        ":/os_macosx_64.png"},
-        {"MacOS106",        ":/os_macosx.png"},
-        {"MacOS106_64",     ":/os_macosx_64.png"},
-        {"MacOS107_64",     ":/os_macosx_64.png"},
-        {"MacOS108_64",     ":/os_macosx_64.png"},
-        {"MacOS109_64",     ":/os_macosx_64.png"},
-        {"JRockitVE",       ":/os_jrockitve.png"},
-    };
-    for (uint n = 0; n < SIZEOF_ARRAY(s_kOSTypeIcons); ++ n)
-    {
-        mOsTypeIcons.insert(s_kOSTypeIcons[n][0], new QPixmap(s_kOSTypeIcons[n][1]));
-    }
-
-    /* online/offline snapshot icons */
-    mOfflineSnapshotIcon = QPixmap (":/snapshot_offline_16px.png");
-    mOnlineSnapshotIcon = QPixmap (":/snapshot_online_16px.png");
-
     qApp->installEventFilter (this);
 
     /* process command line */
 
-    bool bForceSeamless = false;
-    bool bForceFullscreen = false;
-
-    vm_render_mode_str = RTStrDup (virtualBox()
-            .GetExtraData (GUI_RenderMode).toAscii().constData());
+    UIVisualStateType visualStateType = UIVisualStateType_Invalid;
 
 #ifdef Q_WS_X11
     mIsKWinManaged = X11IsWindowManagerKWin();
@@ -4239,17 +3961,18 @@ void VBoxGlobal::prepare()
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
 # ifdef VBOX_WITH_DEBUGGER_GUI_MENU
-    initDebuggerVar(&mDbgEnabled, "VBOX_GUI_DBG_ENABLED", GUI_DbgEnabled, true);
+    initDebuggerVar(&m_fDbgEnabled, "VBOX_GUI_DBG_ENABLED", GUI_Dbg_Enabled, true);
 # else
-    initDebuggerVar(&mDbgEnabled, "VBOX_GUI_DBG_ENABLED", GUI_DbgEnabled, false);
+    initDebuggerVar(&m_fDbgEnabled, "VBOX_GUI_DBG_ENABLED", GUI_Dbg_Enabled, false);
 # endif
-    initDebuggerVar(&mDbgAutoShow, "VBOX_GUI_DBG_AUTO_SHOW", GUI_DbgAutoShow, false);
-    mDbgAutoShowCommandLine = mDbgAutoShowStatistics = mDbgAutoShow;
+    initDebuggerVar(&m_fDbgAutoShow, "VBOX_GUI_DBG_AUTO_SHOW", GUI_Dbg_AutoShow, false);
+    m_fDbgAutoShowCommandLine = m_fDbgAutoShowStatistics = m_fDbgAutoShow;
     mStartPaused = false;
 #endif
 
     mShowStartVMErrors = true;
     bool startVM = false;
+    bool fSeparateProcess = false;
     QString vmNameOrUuid;
 
     int argc = qApp->argc();
@@ -4269,6 +3992,10 @@ void VBoxGlobal::prepare()
                 startVM = true;
             }
         }
+        else if (!::strcmp (arg, "-separate") || !::strcmp (arg, "--separate"))
+        {
+            fSeparateProcess = true;
+        }
 #ifdef VBOX_GUI_WITH_PIDFILE
         else if (!::strcmp(arg, "-pidfile") || !::strcmp(arg, "--pidfile"))
         {
@@ -4276,23 +4003,16 @@ void VBoxGlobal::prepare()
                 m_strPidfile = QString(qApp->argv()[i]);
         }
 #endif /* VBOX_GUI_WITH_PIDFILE */
-        else if (!::strcmp(arg, "-seamless") || !::strcmp(arg, "--seamless"))
-        {
-            bForceSeamless = true;
-        }
+        /* Visual state type options: */
+        else if (!::strcmp(arg, "-normal") || !::strcmp(arg, "--normal"))
+            visualStateType = UIVisualStateType_Normal;
         else if (!::strcmp(arg, "-fullscreen") || !::strcmp(arg, "--fullscreen"))
-        {
-            bForceFullscreen = true;
-        }
-        else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment"))
-        {
-            ++i;
-        }
-        else if (!::strcmp (arg, "-rmode") || !::strcmp (arg, "--rmode"))
-        {
-            if (++i < argc)
-                vm_render_mode_str = qApp->argv() [i];
-        }
+            visualStateType = UIVisualStateType_Fullscreen;
+        else if (!::strcmp(arg, "-seamless") || !::strcmp(arg, "--seamless"))
+            visualStateType = UIVisualStateType_Seamless;
+        else if (!::strcmp(arg, "-scale") || !::strcmp(arg, "--scale"))
+            visualStateType = UIVisualStateType_Scale;
+        /* Passwords: */
         else if (!::strcmp (arg, "--settingspw"))
         {
             if (++i < argc)
@@ -4335,6 +4055,9 @@ void VBoxGlobal::prepare()
                 }
             }
         }
+        /* Misc options: */
+        else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment"))
+            ++i;
         else if (!::strcmp(arg, "--no-startvm-errormsgbox"))
             mShowStartVMErrors = false;
         else if (!::strcmp(arg, "--aggressive-caching"))
@@ -4343,6 +4066,18 @@ void VBoxGlobal::prepare()
             mAgressiveCaching = false;
         else if (!::strcmp(arg, "--restore-current"))
             mRestoreCurrentSnapshot = true;
+        /* Ad hoc VM reconfig options: */
+        else if (!::strcmp(arg, "--fda"))
+        {
+            if (++i < argc)
+                m_strFloppyImage = qApp->argv()[i];
+        }
+        else if (!::strcmp(arg, "--dvd") || !::strcmp(arg, "--cdrom"))
+        {
+            if (++i < argc)
+                m_strDvdImage = qApp->argv()[i];
+        }
+        /* VMM Options: */
         else if (!::strcmp(arg, "--disable-patm"))
             mDisablePatm = true;
         else if (!::strcmp(arg, "--disable-csam"))
@@ -4361,36 +4096,37 @@ void VBoxGlobal::prepare()
                 mWarpPct = RTStrToUInt32(qApp->argv() [i]);
         }
 #ifdef VBOX_WITH_DEBUGGER_GUI
+        /* Debugger/Debugging options: */
         else if (!::strcmp(arg, "-dbg") || !::strcmp (arg, "--dbg"))
-            setDebuggerVar(&mDbgEnabled, true);
+            setDebuggerVar(&m_fDbgEnabled, true);
         else if (!::strcmp( arg, "-debug") || !::strcmp (arg, "--debug"))
         {
-            setDebuggerVar(&mDbgEnabled, true);
-            setDebuggerVar(&mDbgAutoShow, true);
-            setDebuggerVar(&mDbgAutoShowCommandLine, true);
-            setDebuggerVar(&mDbgAutoShowStatistics, true);
+            setDebuggerVar(&m_fDbgEnabled, true);
+            setDebuggerVar(&m_fDbgAutoShow, true);
+            setDebuggerVar(&m_fDbgAutoShowCommandLine, true);
+            setDebuggerVar(&m_fDbgAutoShowStatistics, true);
             mStartPaused = true;
         }
         else if (!::strcmp(arg, "--debug-command-line"))
         {
-            setDebuggerVar(&mDbgEnabled, true);
-            setDebuggerVar(&mDbgAutoShow, true);
-            setDebuggerVar(&mDbgAutoShowCommandLine, true);
+            setDebuggerVar(&m_fDbgEnabled, true);
+            setDebuggerVar(&m_fDbgAutoShow, true);
+            setDebuggerVar(&m_fDbgAutoShowCommandLine, true);
             mStartPaused = true;
         }
         else if (!::strcmp(arg, "--debug-statistics"))
         {
-            setDebuggerVar(&mDbgEnabled, true);
-            setDebuggerVar(&mDbgAutoShow, true);
-            setDebuggerVar(&mDbgAutoShowStatistics, true);
+            setDebuggerVar(&m_fDbgEnabled, true);
+            setDebuggerVar(&m_fDbgAutoShow, true);
+            setDebuggerVar(&m_fDbgAutoShowStatistics, true);
             mStartPaused = true;
         }
         else if (!::strcmp(arg, "-no-debug") || !::strcmp(arg, "--no-debug"))
         {
-            setDebuggerVar(&mDbgEnabled, false);
-            setDebuggerVar(&mDbgAutoShow, false);
-            setDebuggerVar(&mDbgAutoShowCommandLine, false);
-            setDebuggerVar(&mDbgAutoShowStatistics, false);
+            setDebuggerVar(&m_fDbgEnabled, false);
+            setDebuggerVar(&m_fDbgAutoShow, false);
+            setDebuggerVar(&m_fDbgAutoShowCommandLine, false);
+            setDebuggerVar(&m_fDbgAutoShowStatistics, false);
         }
         /* Not quite debug options, but they're only useful with the debugger bits. */
         else if (!::strcmp(arg, "--start-paused"))
@@ -4404,22 +4140,23 @@ void VBoxGlobal::prepare()
 
     if (startVM)
     {
+        /* m_fSeparateProcess makes sense only if a VM is started. */
+        m_fSeparateProcess = fSeparateProcess;
+
+        /* Search for corresponding VM: */
         QUuid uuid = QUuid(vmNameOrUuid);
+        const CMachine machine = m_vbox.FindMachine(vmNameOrUuid);
         if (!uuid.isNull())
         {
-            vmUuid = vmNameOrUuid;
+            if (machine.isNull() && showStartVMErrors())
+                return msgCenter().cannotFindMachineById(m_vbox, vmNameOrUuid);
         }
         else
         {
-            CMachine m = mVBox.FindMachine (vmNameOrUuid);
-            if (m.isNull())
-            {
-                if (showStartVMErrors())
-                    msgCenter().cannotFindMachineByName (mVBox, vmNameOrUuid);
-                return;
-            }
-            vmUuid = m.GetId();
+            if (machine.isNull() && showStartVMErrors())
+                return msgCenter().cannotFindMachineByName(m_vbox, vmNameOrUuid);
         }
+        vmUuid = machine.GetId();
     }
 
     /* After initializing *vmUuid* we already know if that is VM process or not: */
@@ -4448,32 +4185,24 @@ void VBoxGlobal::prepare()
     }
 
     if (mSettingsPwSet)
-        mVBox.SetSettingsSecret(mSettingsPw);
+        m_vbox.SetSettingsSecret(mSettingsPw);
 
-    if (bForceSeamless && !vmUuid.isEmpty())
-    {
-        mVBox.FindMachine(vmUuid).SetExtraData(GUI_Seamless, "on");
-    }
-    else if (bForceFullscreen && !vmUuid.isEmpty())
-    {
-        mVBox.FindMachine(vmUuid).SetExtraData(GUI_Fullscreen, "on");
-    }
-
-    vm_render_mode = vboxGetRenderMode (vm_render_mode_str);
+    if (visualStateType != UIVisualStateType_Invalid && !vmUuid.isEmpty())
+        gEDataManager->setRequestedVisualState(visualStateType, vmUuid);
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /* setup the debugger gui. */
     if (RTEnvExist("VBOX_GUI_NO_DEBUGGER"))
-        mDbgEnabled = mDbgAutoShow =  mDbgAutoShowCommandLine = mDbgAutoShowStatistics = false;
-    if (mDbgEnabled)
+        m_fDbgEnabled = m_fDbgAutoShow =  m_fDbgAutoShowCommandLine = m_fDbgAutoShowStatistics = false;
+    if (m_fDbgEnabled)
     {
         RTERRINFOSTATIC ErrInfo;
         RTErrInfoInitStatic(&ErrInfo);
-        int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &mhVBoxDbg, RTLDRLOAD_FLAGS_LOCAL, &ErrInfo.Core);
+        int vrc = SUPR3HardenedLdrLoadAppPriv("VBoxDbg", &m_hVBoxDbg, RTLDRLOAD_FLAGS_LOCAL, &ErrInfo.Core);
         if (RT_FAILURE(vrc))
         {
-            mhVBoxDbg = NIL_RTLDRMOD;
-            mDbgAutoShow =  mDbgAutoShowCommandLine = mDbgAutoShowStatistics = false;
+            m_hVBoxDbg = NIL_RTLDRMOD;
+            m_fDbgAutoShow =  m_fDbgAutoShowCommandLine = m_fDbgAutoShowStatistics = false;
             LogRel(("Failed to load VBoxDbg, rc=%Rrc - %s\n", vrc, ErrInfo.Core.pszMsg));
         }
     }
@@ -4513,18 +4242,6 @@ void VBoxGlobal::prepare()
     /* Create shortcut pool: */
     UIShortcutPool::create();
 
-    /* Create action pool: */
-    if (isVMConsoleProcess())
-    {
-        UIActionPool::create(UIActionPoolType_Runtime);
-        UIActionPool::createTemporary(UIActionPoolType_Selector);
-    }
-    else
-    {
-        UIActionPool::create(UIActionPoolType_Selector);
-        UIActionPool::createTemporary(UIActionPoolType_Runtime);
-    }
-
 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER
     /* Create network manager: */
     UINetworkManager::create();
@@ -4548,9 +4265,6 @@ void VBoxGlobal::cleanup()
     UINetworkManager::destroy();
 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
 
-    /* Destroy action pool: */
-    UIActionPool::destroy();
-
     /* Destroy shortcut pool: */
     UIShortcutPool::destroy();
 
@@ -4558,9 +4272,6 @@ void VBoxGlobal::cleanup()
     deletePidfile();
 #endif
 
-    /* Destroy our event handlers */
-    UIExtraDataEventHandler::destroy();
-
     /* Destroy the GUI root windows _BEFORE_ the media-mess, because there is
        code in the GUI that's using the media code an will be racing us! */
     if (mSelectorWnd)
@@ -4568,12 +4279,8 @@ void VBoxGlobal::cleanup()
         delete mSelectorWnd;
         mSelectorWnd = NULL;
     }
-
-    if (m_pVirtualMachine)
-    {
-        delete m_pVirtualMachine;
-        m_pVirtualMachine = NULL;
-    }
+    if (gpMachine)
+        UIMachine::destroy();
 
     /* Cleanup medium-enumerator: */
     m_mediumEnumeratorDtorRwLock.lockForWrite();
@@ -4581,19 +4288,24 @@ void VBoxGlobal::cleanup()
     m_pMediumEnumerator = 0;
     m_mediumEnumeratorDtorRwLock.unlock();
 
+    /* Destroy extra-data manager: */
+    UIExtraDataManager::destroy();
+
     /* Destroy whatever this converter stuff is: */
     UIConverter::cleanup();
 
-    /* Ensure mOsTypeIcons is cleaned up: */
-    qDeleteAll(mOsTypeIcons);
+    /* Cleanup general icon-pool: */
+    delete m_pIconPool;
+    m_pIconPool = 0;
 
     /* ensure CGuestOSType objects are no longer used */
     mFamilyIDs.clear();
     mTypes.clear();
 
     /* the last steps to ensure we don't use COM any more */
-    mHost.detach();
-    mVBox.detach();
+    m_host.detach();
+    m_vbox.detach();
+    m_client.detach();
 
     /* There may be UIMedium(s)EnumeratedEvent instances still in the message
      * queue which reference COM objects. Remove them to release those objects
@@ -4610,6 +4322,19 @@ void VBoxGlobal::cleanup()
     mValid = false;
 }
 
+void VBoxGlobal::sltHandleVBoxSVCAvailabilityChange(bool fAvailable)
+{
+    /* Make sure the VBoxSVC availability changed: */
+    if (m_fVBoxSVCAvailable == fAvailable)
+        return;
+
+    /* Cache the new VBoxSVC availability value: */
+    m_fVBoxSVCAvailable = fAvailable;
+
+    /* Notify listeners about the VBoxSVC availability change: */
+    emit sigVBoxSVCAvailabilityChange();
+}
+
 #ifdef VBOX_WITH_DEBUGGER_GUI
 
 # define VBOXGLOBAL_DBG_CFG_VAR_FALSE       (0)
@@ -4641,7 +4366,7 @@ void VBoxGlobal::initDebuggerVar(int *piDbgCfgVar, const char *pszEnvVar, const
     else if (rc != VERR_ENV_VAR_NOT_FOUND)
         strEnvValue = "veto";
 
-    QString     strExtraValue = mVBox.GetExtraData(pszExtraDataName).toLower().trimmed();
+    QString strExtraValue = m_vbox.GetExtraData(pszExtraDataName).toLower().trimmed();
     if (strExtraValue.isEmpty())
         strExtraValue = QString();
 
@@ -4692,14 +4417,13 @@ void VBoxGlobal::setDebuggerVar(int *piDbgCfgVar, bool fState)
  *
  * @returns true / false.
  * @param   piDbgCfgVar         The debugger config variable to consult.
- * @param   rMachine            Reference to the machine object.
  * @param   pszExtraDataName    The extra data name relating to this variable.
  */
-bool VBoxGlobal::isDebuggerWorker(int *piDbgCfgVar, CMachine &rMachine, const char *pszExtraDataName)
+bool VBoxGlobal::isDebuggerWorker(int *piDbgCfgVar, const char *pszExtraDataName) const
 {
-    if (!(*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_DONE) && !rMachine.isNull())
+    if (!(*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_DONE))
     {
-        QString str = mVBox.GetExtraData(pszExtraDataName).toLower().trimmed();
+        const QString str = gEDataManager->debugFlagValue(pszExtraDataName);
         if (str.contains("veto"))
             *piDbgCfgVar = VBOXGLOBAL_DBG_CFG_VAR_DONE | VBOXGLOBAL_DBG_CFG_VAR_FALSE;
         else if (str.isEmpty() || (*piDbgCfgVar & VBOXGLOBAL_DBG_CFG_VAR_CMD_LINE))
@@ -4841,20 +4565,23 @@ bool VBoxGlobal::switchToMachine(CMachine &machine)
 #endif
 }
 
-bool VBoxGlobal::launchMachine(CMachine &machine, bool fHeadless /* = false */)
+bool VBoxGlobal::launchMachine(CMachine &machine, LaunchMode enmLaunchMode /* = LaunchMode_Default */)
 {
-    /* Switch to machine window(s) if possible: */
-    if (   machine.GetSessionState() == KSessionState_Locked /* precondition for CanShowConsoleWindow() */
-        && machine.CanShowConsoleWindow())
-        return VBoxGlobal::switchToMachine(machine);
-
-    /* Make sure machine-state is one of required: */
-    KMachineState state = machine.GetState(); NOREF(state);
-    AssertMsg(   state == KMachineState_PoweredOff
-              || state == KMachineState_Saved
-              || state == KMachineState_Teleported
-              || state == KMachineState_Aborted
-              , ("Machine must be PoweredOff/Saved/Teleported/Aborted (%d)", state));
+    if (enmLaunchMode != LaunchMode_Separate)
+    {
+        /* Switch to machine window(s) if possible: */
+        if (   machine.GetSessionState() == KSessionState_Locked /* precondition for CanShowConsoleWindow() */
+            && machine.CanShowConsoleWindow())
+            return VBoxGlobal::switchToMachine(machine);
+
+        /* Make sure machine-state is one of required: */
+        KMachineState state = machine.GetState(); NOREF(state);
+        AssertMsg(   state == KMachineState_PoweredOff
+                  || state == KMachineState_Saved
+                  || state == KMachineState_Teleported
+                  || state == KMachineState_Aborted
+                  , ("Machine must be PoweredOff/Saved/Teleported/Aborted (%d)", state));
+    }
 
     /* Create empty session instance: */
     CSession session;
@@ -4880,20 +4607,39 @@ bool VBoxGlobal::launchMachine(CMachine &machine, bool fHeadless /* = false */)
     if (pXauth)
         strEnv.append(QString("XAUTHORITY=%1\n").arg(pXauth));
 #endif /* Q_WS_X11 */
-    const QString strType = fHeadless ? "headless" : "";
+    QString strType;
+    switch (enmLaunchMode)
+    {
+        case LaunchMode_Default:  strType = ""; break;
+        case LaunchMode_Separate: strType = vboxGlobal().isSeparateProcess() ? "headless" : "separate"; break;
+        case LaunchMode_Headless: strType = "headless"; break;
+    }
 
     /* Prepare "VM spawning" progress: */
     CProgress progress = machine.LaunchVMProcess(session, strType, strEnv);
     if (!machine.isOk())
     {
+        /* If the VM is started separately and the VM process is already running, then it is OK. */
+        if (enmLaunchMode == LaunchMode_Separate)
+        {
+            KMachineState state = machine.GetState();
+            if (   state >= KMachineState_FirstOnline
+                && state <= KMachineState_LastOnline)
+            {
+                /* Already running. */
+                return true;
+            }
+        }
+
         msgCenter().cannotOpenSession(machine);
         return false;
     }
 
     /* Postpone showing "VM spawning" progress.
      * Hope 1 minute will be enough to spawn any running VM silently,
-     * otherwise we better show the progress... */
-    int iSpawningDuration = 60000;
+     * otherwise we better show the progress...
+     * If starting separately, then show the progress now. */
+    int iSpawningDuration = enmLaunchMode == LaunchMode_Separate ? 0 : 60000;
     msgCenter().showModalProgressDialog(progress, machine.GetName(),
                                         ":/progress_start_90px.png", 0, iSpawningDuration);
     if (!progress.isOk() || progress.GetResultCode() != 0)
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
index b2c86ca..708efba 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
@@ -1,9 +1,10 @@
+/* $Id: VBoxGlobal.h $ */
 /** @file
  * VBox Qt GUI - VBoxGlobal class declaration.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -37,6 +38,7 @@
 /* COM includes: */
 #include "VBox/com/Guid.h"
 #include "CHost.h"
+#include "CVirtualBoxClient.h"
 #include "CVirtualBox.h"
 #include "CSession.h"
 #include "CGuestOSType.h"
@@ -53,6 +55,7 @@ class CHostVideoInputDevice;
 class QSpinBox;
 class UIMediumEnumerator;
 class UIMedium;
+class UIIconPoolGeneral;
 
 // VBoxGlobal class
 ////////////////////////////////////////////////////////////////////////////////
@@ -66,6 +69,14 @@ class VBoxGlobal : public QObject
 
 public:
 
+    /** VM launch modes. */
+    enum LaunchMode
+    {
+        LaunchMode_Default,
+        LaunchMode_Headless,
+        LaunchMode_Separate
+    };
+
     /* Static API: Create/destroy stuff: */
     static VBoxGlobal* instance();
     static void create();
@@ -85,23 +96,34 @@ public:
     QString versionString() const { return mVerString; }
     bool isBeta() const;
 
+    /** Returns whether GUI is separate (from VM) process. */
+    bool isSeparateProcess() const { return m_fSeparateProcess; }
+
 #ifdef Q_WS_MAC
     static MacOSXRelease osRelease();
 #endif /* Q_WS_MAC */
 
-    CVirtualBox virtualBox() const { return mVBox; }
-    CHost host() const { return mHost; }
-    QString homeFolder() const { return mHomeFolder; }
+    /** Returns the copy of VirtualBox client wrapper. */
+    CVirtualBoxClient virtualBoxClient() const { return m_client; }
+    /** Returns the copy of VirtualBox object wrapper. */
+    CVirtualBox virtualBox() const { return m_vbox; }
+    /** Returns the copy of VirtualBox host-object wrapper. */
+    CHost host() const { return m_host; }
+    /** Returns the symbolic VirtualBox home-folder representation. */
+    QString homeFolder() const { return m_strHomeFolder; }
+
+    /** Returns the VBoxSVC availability value. */
+    bool isVBoxSVCAvailable() const { return m_fVBoxSVCAvailable; }
 
     VBoxGlobalSettings &settings() { return gset; }
     bool setSettings (VBoxGlobalSettings &gs);
 
     UISelectorWindow &selectorWnd();
 
-    /* VM stuff: */
-    bool startMachine(const QString &strMachineId);
-    UIMachine* virtualMachine();
-    QWidget* activeMachineWindow();
+    /** Returns current virtual machine. */
+    UIMachine* virtualMachine() const;
+    /** Returns currently active virtual machine window. */
+    QWidget* activeMachineWindow() const;
 
     bool is3DAvailableWorker() const;
     bool is3DAvailable() const { if (m3DAvailable < 0) return is3DAvailableWorker(); return m3DAvailable != 0; }
@@ -118,18 +140,26 @@ public:
     bool processArgs();
 
     bool switchToMachine(CMachine &machine);
-    bool launchMachine(CMachine &machine, bool fHeadless = false);
+
+    bool launchMachine(CMachine &machine, LaunchMode enmLaunchMode = LaunchMode_Default);
 
     bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
     bool showStartVMErrors() const { return mShowStartVMErrors; }
     QString managedVMUuid() const { return vmUuid; }
     QList<QUrl> &argUrlList() { return m_ArgUrlList; }
 
-    RenderMode vmRenderMode() const { return vm_render_mode; }
-    const char *vmRenderModeStr() const { return vm_render_mode_str; }
     bool isKWinManaged() const { return mIsKWinManaged; }
 
+    /** Returns whether we should restore current snapshot before VM started. */
     bool shouldRestoreCurrentSnapshot() const { return mRestoreCurrentSnapshot; }
+    /** Defines whether we should fRestore current snapshot before VM started. */
+    void setShouldRestoreCurrentSnapshot(bool fRestore) { mRestoreCurrentSnapshot = fRestore; }
+
+    bool hasFloppyImageToMount() const    { return !m_strFloppyImage.isEmpty(); }
+    bool hasDvdImageToMount() const       { return !m_strDvdImage.isEmpty(); }
+    QString const &getFloppyImage() const { return m_strFloppyImage; }
+    QString const &getDvdImage() const    { return m_strDvdImage; }
+
     bool isPatmDisabled() const { return mDisablePatm; }
     bool isCsamDisabled() const { return mDisableCsam; }
     bool isSupervisorCodeExecedRecompiled() const { return mRecompileSupervisor; }
@@ -139,26 +169,25 @@ public:
     uint32_t getWarpPct()       const { return mWarpPct; }
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
-    bool isDebuggerEnabled(CMachine &aMachine);
-    bool isDebuggerAutoShowEnabled(CMachine &aMachine);
-    bool isDebuggerAutoShowCommandLineEnabled(CMachine &aMachine);
-    bool isDebuggerAutoShowStatisticsEnabled(CMachine &aMachine);
-    RTLDRMOD getDebuggerModule() const { return mhVBoxDbg; }
+    bool isDebuggerEnabled() const;
+    bool isDebuggerAutoShowEnabled() const;
+    bool isDebuggerAutoShowCommandLineEnabled() const;
+    bool isDebuggerAutoShowStatisticsEnabled() const;
 
-    bool isStartPausedEnabled() const { return mStartPaused; }
-#else
-    bool isDebuggerAutoShowEnabled(CMachine & /*aMachine*/) const { return false; }
-    bool isDebuggerAutoShowCommandLineEnabled(CMachine & /*aMachine*/) const { return false; }
-    bool isDebuggerAutoShowStatisticsEnabled(CMachine & /*aMachine*/) const { return false; }
+    RTLDRMOD getDebuggerModule() const { return m_hVBoxDbg; }
 
-    bool isStartPausedEnabled() const { return false; }
-#endif
+    bool isStartPausedEnabled() const { return mStartPaused; }
+#endif /* VBOX_WITH_DEBUGGER_GUI */
 
     /* VBox enum to/from string/icon/color convertors */
 
     QList <CGuestOSType> vmGuestOSFamilyList() const;
     QList <CGuestOSType> vmGuestOSTypeList (const QString &aFamilyId) const;
-    QPixmap vmGuestOSTypeIcon (const QString &aTypeId) const;
+
+    /** Returns pixmap corresponding to passed @a strOSTypeID.
+      * In case if non-null @a pLogicalSize pointer provided, it will be updated properly. */
+    QPixmap vmGuestOSTypeIcon(const QString &strOSTypeID, QSize *pLogicalSize = 0) const;
+
     CGuestOSType vmGuestOSType (const QString &aTypeId,
                                 const QString &aFamilyId = QString::null) const;
     QString vmGuestOSTypeDescription (const QString &aTypeId) const;
@@ -209,11 +238,6 @@ public:
     QString toLPTPortName (ulong aIRQ, ulong aIOBase) const;
     bool toLPTPortNumbers (const QString &aName, ulong &aIRQ, ulong &aIOBase) const;
 
-    QPixmap snapshotIcon (bool online) const
-    {
-        return online ? mOnlineSnapshotIcon : mOfflineSnapshotIcon;
-    }
-
     static bool hasAllowedExtension(const QString &strExt, const QStringList &extList)
     {
         for (int i = 0; i < extList.size(); ++i)
@@ -264,6 +288,19 @@ public:
     UIMedium medium(const QString &strMediumID) const;
     QList<QString> mediumIDs() const;
 
+    /** Prepares storage menu according passed parameters.
+      * @param menu              QMenu being prepared.
+      * @param pListener         Listener QObject, this menu being prepared for.
+      * @param pszSlotName       SLOT in the @a pListener above, this menu will be handled with.
+      * @param machine           CMachine object, this menu being prepared for.
+      * @param strControllerName The name of the CStorageController in the @a machine above.
+      * @param storageSlot       The StorageSlot of the CStorageController called @a strControllerName above. */
+    void prepareStorageMenu(QMenu &menu,
+                            QObject *pListener, const char *pszSlotName,
+                            const CMachine &machine, const QString &strControllerName, const StorageSlot &storageSlot);
+    /** Updates @a constMachine storage with data described by @a target. */
+    void updateMachineStorage(const CMachine &constMachine, const UIMediumTarget &target);
+
     /* various helpers */
 
     QString languageName() const;
@@ -317,12 +354,13 @@ public:
     static bool supportsFullScreenMonitorsProtocolX11();
     /** X11: Performs mapping of the passed @a pWidget to host-screen with passed @a uScreenId. */
     static bool setFullScreenMonitorX11(QWidget *pWidget, ulong uScreenId);
+    /** X11: Ensures @a pPropWidget become transient for the @a pWidget. */
+    static void setTransientFor(QWidget *pWidget, QWidget *pPropWidget);
 #endif /* Q_WS_X11 */
 
     static QString removeAccelMark (const QString &aText);
 
     static QString insertKeyToActionText (const QString &aText, const QString &aKey);
-    static QString extractKeyFromActionText (const QString &aText);
 
     static QPixmap joinPixmaps (const QPixmap &aPM1, const QPixmap &aPM2);
 
@@ -353,54 +391,6 @@ public:
     /* Returns full medium-format name for the given base medium-format name: */
     static QString fullMediumFormatName(const QString &strBaseMediumFormatName);
 
-    /* Extra-data settings stuff: */
-    static bool isApprovedByExtraData(CVirtualBox &vbox, const QString &strExtraDataKey, bool fApprovedByDefault = false);
-    static bool isApprovedByExtraData(CMachine &machine, const QString &strExtraDataKey, bool fApprovedByDefault = false);
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    static bool shouldWeAllowApplicationUpdate(CVirtualBox &vbox);
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#ifdef Q_WS_X11
-    static bool legacyFullscreenModeRequested(CVirtualBox vbox);
-#endif /* Q_WS_X11 */
-    static bool shouldWeShowMachine(CMachine &machine);
-    static bool shouldWeAllowMachineReconfiguration(CMachine &machine,
-                                                    bool fIncludingMachineGeneralCheck = false,
-                                                    bool fIncludingMachineStateCheck = false);
-    static bool shouldWeShowDetails(CMachine &machine,
-                                    bool fIncludingMachineGeneralCheck = false);
-    static bool shouldWeAutoMountGuestScreens(CMachine &machine, bool fIncludingSanityCheck = true);
-    static bool shouldWeAllowSnapshotOperations(CMachine &machine, bool fIncludingSanityCheck = true);
-    static MachineCloseAction defaultMachineCloseAction(CMachine &machine);
-    static RuntimeMenuType restrictedRuntimeMenuTypes(CMachine &machine);
-#ifdef Q_WS_MAC
-    static RuntimeMenuApplicationActionType restrictedRuntimeMenuApplicationActionTypes(CMachine &machine);
-#endif /* Q_WS_MAC */
-    static RuntimeMenuMachineActionType restrictedRuntimeMenuMachineActionTypes(CMachine &machine);
-    static RuntimeMenuViewActionType restrictedRuntimeMenuViewActionTypes(CMachine &machine);
-    static RuntimeMenuDevicesActionType restrictedRuntimeMenuDevicesActionTypes(CMachine &machine);
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    static RuntimeMenuDebuggerActionType restrictedRuntimeMenuDebuggerActionTypes(CMachine &machine);
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-    static RuntimeMenuHelpActionType restrictedRuntimeMenuHelpActionTypes(CMachine &machine);
-    static UIVisualStateType restrictedVisualStateTypes(CMachine &machine);
-    static QList<IndicatorType> restrictedStatusBarIndicators(CMachine &machine);
-    static MachineCloseAction restrictedMachineCloseActions(CMachine &machine);
-    static QList<GlobalSettingsPageType> restrictedGlobalSettingsPages(CVirtualBox &vbox);
-    static QList<MachineSettingsPageType> restrictedMachineSettingsPages(CMachine &machine);
-    static bool activateHoveredMachineWindow(CVirtualBox &vbox);
-    static void setActivateHoveredMachineWindow(CVirtualBox &vbox, bool fActivate);
-#ifndef Q_WS_MAC
-    /** Except Mac OS X: Loads redefined machine-window icon names. */
-    static QStringList machineWindowIconNames(CMachine &machine);
-    /** Except Mac OS X: Loads redefined machine-window name postfix. */
-    static QString machineWindowNamePostfix(CMachine &machine);
-#endif /* !Q_WS_MAC */
-    /** Loads redefined mouse-capture policy type. */
-    static MouseCapturePolicy mouseCapturePolicy(CMachine &machine);
-    /** Loads redefined guru-meditation handler type. */
-    static GuruMeditationHandlerType guruMeditationHandlerType(CMachine &machine);
-    /** Loads Runtime UI HiDPI optimization type. */
-    static HiDPIOptimizationType hiDPIOptimizationType(CMachine &machine);
 
 #ifdef RT_OS_LINUX
     static void checkForWrongUSBMounted();
@@ -414,6 +404,9 @@ public:
 
 signals:
 
+    /** Notifies listeners about the VBoxSVC availability change. */
+    void sigVBoxSVCAvailabilityChange();
+
     /* Notifiers: Medium-processing stuff: */
     void sigMediumCreated(const QString &strMediumID);
     void sigMediumDeleted(const QString &strMediumID);
@@ -436,6 +429,9 @@ protected slots:
     void prepare();
     void cleanup();
 
+    /** Handles the VBoxSVC availability change. */
+    void sltHandleVBoxSVCAvailabilityChange(bool fAvailable);
+
 protected:
 
     bool eventFilter (QObject *, QEvent *);
@@ -449,19 +445,29 @@ private:
 #ifdef VBOX_WITH_DEBUGGER_GUI
     void initDebuggerVar(int *piDbgCfgVar, const char *pszEnvVar, const char *pszExtraDataName, bool fDefault = false);
     void setDebuggerVar(int *piDbgCfgVar, bool fState);
-    bool isDebuggerWorker(int *piDbgCfgVar, CMachine &rMachine, const char *pszExtraDataName);
+    bool isDebuggerWorker(int *piDbgCfgVar, const char *pszExtraDataName) const;
 #endif
 
     bool mValid;
 
-    CVirtualBox mVBox;
-    CHost mHost;
-    QString mHomeFolder;
+    /** Holds the instance of VirtualBox client wrapper. */
+    CVirtualBoxClient m_client;
+    /** Holds the copy of VirtualBox object wrapper. */
+    CVirtualBox m_vbox;
+    /** Holds the copy of VirtualBox host-object wrapper. */
+    CHost m_host;
+    /** Holds the symbolic VirtualBox home-folder representation. */
+    QString m_strHomeFolder;
+
+    /** Holds the VBoxSVC availability value. */
+    bool m_fVBoxSVCAvailable;
 
     VBoxGlobalSettings gset;
 
     UISelectorWindow *mSelectorWnd;
-    UIMachine *m_pVirtualMachine;
+
+    /** Holds whether GUI is separate (from VM) process. */
+    bool m_fSeparateProcess;
 
     QString vmUuid;
     QList<QUrl> m_ArgUrlList;
@@ -473,14 +479,21 @@ private:
     UIMediumEnumerator *m_pMediumEnumerator;
     mutable QReadWriteLock m_mediumEnumeratorDtorRwLock;
 
-    RenderMode vm_render_mode;
-    const char * vm_render_mode_str;
     bool mIsKWinManaged;
 
     /** The --aggressive-caching / --no-aggressive-caching option. */
     bool mAgressiveCaching;
     /** The --restore-current option. */
     bool mRestoreCurrentSnapshot;
+    /** @name Ad-hoc VM reconfiguration.
+     * @{ */
+    /** Floppy image. */
+    QString m_strFloppyImage;
+    /** DVD image. */
+    QString m_strDvdImage;
+    /** @} */
+    /** @name VMM options
+     * @{ */
     /** The --disable-patm option. */
     bool mDisablePatm;
     /** The --disable-csam option. */
@@ -493,21 +506,22 @@ private:
     bool mExecuteAllInIem;
     /** The --warp-factor option value. */
     uint32_t mWarpPct;
+    /** @} */
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /** Whether the debugger should be accessible or not.
-     * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED, --debug or the env.var.
-     * VBOX_GUI_DBG_AUTO_SHOW to enable. */
-    int mDbgEnabled;
+     * Use --dbg, the env.var. VBOX_GUI_DBG_ENABLED,
+     *     --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
+    mutable int m_fDbgEnabled;
     /** Whether to show the debugger automatically with the console.
      * Use --debug or the env.var. VBOX_GUI_DBG_AUTO_SHOW to enable. */
-    int mDbgAutoShow;
-    /** Whether to show the command line window when mDbgAutoShow is set. */
-    int mDbgAutoShowCommandLine;
-    /** Whether to show the statistics window when mDbgAutoShow is set. */
-    int mDbgAutoShowStatistics;
+    mutable int m_fDbgAutoShow;
+    /** Whether to show the command line window when m_fDbgAutoShow is set. */
+    mutable int m_fDbgAutoShowCommandLine;
+    /** Whether to show the statistics window when m_fDbgAutoShow is set. */
+    mutable int m_fDbgAutoShowStatistics;
     /** VBoxDbg module handle. */
-    RTLDRMOD mhVBoxDbg;
+    RTLDRMOD m_hVBoxDbg;
 
     /** Whether to start the VM in paused state or not. */
     bool mStartPaused;
@@ -524,9 +538,6 @@ private:
 
     QList <QString> mFamilyIDs;
     QList <QList <CGuestOSType> > mTypes;
-    QHash <QString, QPixmap *> mOsTypeIcons;
-
-    QPixmap mOfflineSnapshotIcon, mOnlineSnapshotIcon;
 
     QString mDiskTypes_Differencing;
 
@@ -543,6 +554,9 @@ private:
     char mSettingsPw[256];
     bool mSettingsPwSet;
 
+    /** General icon-pool. */
+    UIIconPoolGeneral *m_pIconPool;
+
     /* API: Instance stuff: */
     static bool m_sfCleanupInProgress;
     static VBoxGlobal* m_spInstance;
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h b/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h
index f4b9958..6e933d8 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxUtils.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of utility classes and functions
+ * VBox Qt GUI - Declarations of utility classes and functions.
  */
 
 /*
@@ -26,6 +25,30 @@
 #include <QWidget>
 #include <QTextBrowser>
 
+/** QObject reimplementation,
+  * providing passed QObject with property assignation routine. */
+class QObjectPropertySetter : public QObject
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor. */
+    QObjectPropertySetter(QObject *pParent, const QString &strName)
+        : QObject(pParent), m_strName(strName) {}
+
+private slots:
+
+    /** Assigns property value. */
+    void sltAssignProperty(const QString &strValue)
+        { parent()->setProperty(m_strName.toAscii().constData(), strValue); }
+
+private:
+
+    /** Holds property name. */
+    const QString m_strName;
+};
+
 /**
  *  Simple class that filters out all key presses and releases
  *  got while the Alt key is pressed. For some very strange reason,
@@ -97,7 +120,7 @@ class QRichTextEdit : public QTextEdit
 
 public:
 
-    QRichTextEdit (QWidget *aParent) : QTextEdit (aParent) {}
+    QRichTextEdit (QWidget *aParent = 0) : QTextEdit (aParent) {}
 
     void setViewportMargins (int aLeft, int aTop, int aRight, int aBottom)
     {
diff --git a/src/VBox/Frontends/VirtualBox/src/globals/VBoxVersion.h b/src/VBox/Frontends/VirtualBox/src/globals/VBoxVersion.h
index 5d132e7..332b8e5 100644
--- a/src/VBox/Frontends/VirtualBox/src/globals/VBoxVersion.h
+++ b/src/VBox/Frontends/VirtualBox/src/globals/VBoxVersion.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxVersion.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxVersion class declaration
+ * VBox Qt GUI - VBoxVersion class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp b/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp
index b464da9..99531bb 100644
--- a/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/hardenedmain.cpp
@@ -1,10 +1,10 @@
 /* $Id: hardenedmain.cpp $ */
 /** @file
- * VirtualBox - Hardened main().
+ * VBox Qt GUI - Hardened main().
  */
 
 /*
- * Copyright (C) 2008-2010 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,26 +15,54 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#include <string.h>
 #include <VBox/sup.h>
 
 
+/**
+ * No CRT on windows, so cook our own strcmp.
+ *
+ * @returns See man strcmp.
+ * @param   psz1                The first string.
+ * @param   psz2                The second string.
+ */
+static int MyStrCmp(const char *psz1, const char *psz2)
+{
+    for (;;)
+    {
+        char ch1 = *psz1++;
+        char ch2 = *psz2++;
+        if (ch1 != ch2)
+            return ch1 < ch2 ? -1 : 1;
+        if (!ch1)
+            return 0;
+    }
+}
+
+
 int main(int argc, char **argv, char **envp)
 {
-    /*
-     * First check whether we're about to start a VM.
-     */
-    uint32_t fFlags = SUPSECMAIN_FLAGS_DONT_OPEN_DEV;
-    for (int i = 1; i < argc; i++)
+    /* First check whether we're about to start a VM: */
+    bool fStartVM = false;
+    /* In separate process: */
+    bool fSeparateProcess = false;
+    for (int i = 1; i < argc && !(fStartVM && fSeparateProcess); ++i)
+    {
         /* NOTE: the check here must match the corresponding check for the
          * options to start a VM in main.cpp and VBoxGlobal.cpp exactly,
          * otherwise there will be weird error messages. */
-        if (   !::strcmp(argv[i], "--startvm")
-            || !::strcmp(argv[i], "-startvm"))
+        if (   !MyStrCmp(argv[i], "--startvm")
+            || !MyStrCmp(argv[i], "-startvm"))
+        {
+            fStartVM = true;
+        }
+        else if (   !MyStrCmp(argv[i], "--separate")
+                 || !MyStrCmp(argv[i], "-separate"))
         {
-            fFlags &= ~SUPSECMAIN_FLAGS_DONT_OPEN_DEV;
-            break;
+            fSeparateProcess = true;
         }
+    }
+
+    uint32_t fFlags = (fStartVM && !fSeparateProcess) ? 0 : SUPSECMAIN_FLAGS_DONT_OPEN_DEV;
 
     return SUPR3HardenedMain("VirtualBox", fFlags | SUPSECMAIN_FLAGS_TRUSTED_ERROR, argc, argv, envp);
 }
diff --git a/src/VBox/Frontends/VirtualBox/src/main.cpp b/src/VBox/Frontends/VirtualBox/src/main.cpp
index e60abc0..17f6413 100644
--- a/src/VBox/Frontends/VirtualBox/src/main.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/main.cpp
@@ -1,12 +1,10 @@
 /* $Id: main.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * The main() function
+ * VBox Qt GUI - The main() function.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,45 +16,50 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-#include "precomp.h"
-#ifdef Q_WS_MAC
-# include "UICocoaApplication.h"
-#endif /* Q_WS_MAC */
+# include <precomp.h>
+# ifdef Q_WS_MAC
+#  include "UICocoaApplication.h"
+# endif /* Q_WS_MAC */
 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UISelectorWindow.h"
-#include "VBoxUtils.h"
-#include "UIModalWindowManager.h"
-#ifdef Q_WS_MAC
-# include "UICocoaApplication.h"
-#endif
 
-#ifdef Q_WS_X11
-#include <QFontDatabase>
-#include <iprt/env.h>
-#endif
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UISelectorWindow.h"
+# include "UIMachine.h"
+# include "VBoxUtils.h"
+# include "UIModalWindowManager.h"
+# include "UIExtraDataManager.h"
+# ifdef Q_WS_MAC
+#  include "UICocoaApplication.h"
+# endif
+
+# ifdef Q_WS_X11
+#  include <iprt/env.h>
+# endif
+
+# include <QMessageBox>
+# include <QLocale>
+# include <QTranslator>
+
+# include <iprt/buildconfig.h>
+# include <iprt/initterm.h>
+# include <iprt/process.h>
+# include <iprt/stream.h>
+# include <VBox/version.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <VBox/err.h>
 
 #include <QCleanlooksStyle>
 #include <QPlastiqueStyle>
-#include <QMessageBox>
-#include <QLocale>
-#include <QTranslator>
 
 #ifdef Q_WS_X11
+# include <QFontDatabase>
 # include <X11/Xlib.h>
 # include <dlfcn.h>
 #endif
 
-#include <iprt/buildconfig.h>
-#include <iprt/err.h>
-#include <iprt/initterm.h>
-#include <iprt/process.h>
-#include <iprt/stream.h>
-#include <VBox/err.h>
-#include <VBox/version.h>
-#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
 #ifdef VBOX_WITH_HARDENING
 # include <VBox/sup.h>
 #endif
@@ -67,6 +70,7 @@
 
 #include <cstdio>
 
+
 /* XXX Temporarily. Don't rely on the user to hack the Makefile himself! */
 QString g_QStrHintLinuxNoMemory = QApplication::tr(
   "This error means that the kernel driver was either not able to "
@@ -222,37 +226,22 @@ static void QtMessageOutput (QtMsgType type, const char *msg)
  */
 static void showHelp()
 {
-    QString mode = "", dflt = "";
-#ifdef VBOX_GUI_USE_QIMAGE
-    if (!mode.isEmpty())
-        mode += "|";
-    mode += "image";
-#endif /* VBOX_GUI_USE_QIMAGE */
-#ifdef VBOX_GUI_USE_QUARTZ2D
-    if (!mode.isEmpty())
-        mode += "|";
-    mode += "quartz2d";
-#endif /* VBOX_GUI_USE_QUARTZ2D */
-#if defined(Q_WS_MAC) && defined(VBOX_GUI_USE_QUARTZ2D)
-    dflt = "quartz2d";
-#elif defined(VBOX_GUI_USE_QIMAGE)
-    dflt = "image";
-#else
-# error "Cannot determine the default render mode!"
-#endif
-
     RTPrintf(VBOX_PRODUCT " Manager %s\n"
             "(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
             "All rights reserved.\n"
             "\n"
             "Usage:\n"
             "  --startvm <vmname|UUID>    start a VM by specifying its UUID or name\n"
-            "  --seamless                 switch to seamless mode during startup\n"
+            "  --separate                 start a separate VM process\n"
+            "  --normal                   keep normal (windowed) mode during startup\n"
             "  --fullscreen               switch to fullscreen mode during startup\n"
-            "  --rmode %-18s select different render mode (default is %s)\n"
+            "  --seamless                 switch to seamless mode during startup\n"
+            "  --scale                    switch to scale mode during startup\n"
             "  --no-startvm-errormsgbox   do not show a message box for VM start errors\n"
             "  --restore-current          restore the current snapshot before starting\n"
             "  --no-aggressive-caching    delays caching media info in VM processes\n"
+            "  --fda <image|none>         Mount the specified floppy image\n"
+            "  --dvd <image|none>         Mount the specified DVD image\n"
 # ifdef VBOX_GUI_WITH_PIDFILE
             "  --pidfile <file>           create a pidfile file when a VM is up and running\n"
 # endif
@@ -286,9 +275,7 @@ static void showHelp()
             "  VBOX_GUI_NO_DEBUGGER       disable the GUI debug menu and debug windows\n"
 # endif
             "\n",
-            RTBldCfgVersion(),
-            mode.toLatin1().constData(),
-            dflt.toLatin1().constData());
+            RTBldCfgVersion());
     /** @todo Show this as a dialog on windows. */
 }
 
@@ -318,7 +305,7 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/)
 #ifdef Q_WS_X11
     if (!VBoxXInitThreads())
         return 1;
-#endif
+#endif /* Q_WS_X11 */
 
     /* Simulate try-catch block: */
     do
@@ -364,9 +351,13 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/)
 #endif
 
 #ifdef Q_WS_MAC
-        /* Mavericks font fix: */
-        if (VBoxGlobal::osRelease() == MacOSXRelease_Mavericks)
-            QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
+        /* Font fixes: */
+        switch (VBoxGlobal::osRelease())
+        {
+            case MacOSXRelease_Mavericks: QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande"); break;
+            case MacOSXRelease_Yosemite:  QFont::insertSubstitution(".Helvetica Neue DeskInterface", "Helvetica Neue"); break;
+            default: break;
+        }
 # ifdef QT_MAC_USE_COCOA
         /* Instantiate our NSApplication derivative before QApplication
          * forces NSApplication to be instantiated. */
@@ -377,45 +368,16 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/)
         /* Install Qt console message handler: */
         qInstallMsgHandler(QtMessageOutput);
 
-#ifdef Q_WS_X11
-        /* Qt has a complex algorithm for selecting the right visual which
-         * doesn't always seem to work. So we naively choose a visual - the
-         * default one - ourselves and pass that to Qt. This means that we
-         * also have to open the display ourselves.
-         * We check the Qt parameter list and handle Qt's -display argument
-         * ourselves, since we open the display connection. We also check the
-         * to see if the user has passed Qt's -visual parameter, and if so we
-         * assume that the user wants Qt to handle visual selection after all,
-         * and don't supply a visual. */
-        char *pszDisplay = NULL;
-        bool useDefaultVisual = true;
-        for (int i = 0; i < argc; ++i)
-        {
-            if (!::strcmp(argv[i], "-display") && (i + 1 < argc))
-            /* What if it isn't? Rely on QApplication to complain? */
-            {
-                pszDisplay = argv[i + 1];
-                ++i;
-            }
-            else if (!::strcmp(argv[i], "-visual"))
-                useDefaultVisual = false;
-        }
-        Display *pDisplay = XOpenDisplay(pszDisplay);
-        if (!pDisplay)
-        {
-            RTPrintf(pszDisplay ? "Failed to open the X11 display \"%s\"!\n"
-                                : "Failed to open the X11 display!\n",
-                     pszDisplay);
-            break;
-        }
-        Visual *pVisual =   useDefaultVisual
-                          ? DefaultVisual(pDisplay, DefaultScreen(pDisplay))
-                          : NULL;
-        /* Now create the application object: */
-        QApplication a(pDisplay, argc, argv, (Qt::HANDLE)pVisual);
-#else /* Q_WS_X11 */
+        /* Create application: */
         QApplication a(argc, argv);
-#endif /* Q_WS_X11 */
+
+#ifdef Q_WS_MAC
+# ifdef VBOX_GUI_WITH_HIDPI
+        /* Enable HiDPI icons. For this we require a patched version of Qt 4.x with
+         * the changes from https://codereview.qt-project.org/#change,54636 applied. */
+        qApp->setAttribute(Qt::AA_UseHighDpiPixmaps);
+# endif /* VBOX_GUI_WITH_HIDPI */
+#endif /* Q_WS_MAC */
 
 #ifdef Q_OS_SOLARIS
         /* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */
@@ -468,7 +430,7 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/)
                                               .arg(VBoxGlobal::qtRTVersionString());
             QMessageBox::critical(0, QApplication::tr("Incompatible Qt Library Error"),
                                   strMsg, QMessageBox::Abort, 0);
-            qFatal("%s", strMsg.toAscii().constData());
+            qFatal("%s", strMsg.toUtf8().constData());
             break;
         }
 #endif /* Q_WS_X11 */
@@ -502,7 +464,7 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/)
             if (vboxGlobal().isVMConsoleProcess())
             {
                 /* Make sure VM is started: */
-                if (!vboxGlobal().startMachine(vboxGlobal().managedVMUuid()))
+                if (!UIMachine::startMachine(vboxGlobal().managedVMUuid()))
                     break;
 
                 /* Start application: */
@@ -519,18 +481,14 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/)
                 }
 
 #ifdef VBOX_BLEEDING_EDGE
-                msgCenter().showBEBWarning();
+                msgCenter().showExperimentalBuildWarning();
 #else /* VBOX_BLEEDING_EDGE */
 # ifndef DEBUG
                 /* Check for BETA version: */
-                QString vboxVersion(vboxGlobal().virtualBox().GetVersion());
-                if (vboxVersion.contains("BETA"))
-                {
-                    /* Allow to prevent this message: */
-                    QString str = vboxGlobal().virtualBox().GetExtraData(GUI_PreventBetaWarning);
-                    if (str != vboxVersion)
-                        msgCenter().showBETAWarning();
-                }
+                const QString vboxVersion(vboxGlobal().virtualBox().GetVersion());
+                if (   vboxVersion.contains("BETA")
+                    && gEDataManager->preventBetaBuildWarningForVersion() != vboxVersion)
+                    msgCenter().showBetaBuildWarning();
 # endif /* !DEBUG */
 #endif /* !VBOX_BLEEDING_EDGE*/
 
@@ -563,15 +521,17 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/)
 
 int main(int argc, char **argv, char **envp)
 {
-    /* Initialize VBox Runtime.
-     * Initialize the SUPLib as well only if we are really about to start a VM.
-     * Don't do this if we are only starting the selector window. */
-    bool fInitSUPLib = false;
 #ifdef Q_WS_X11
     if (!VBoxXInitThreads())
         return 1;
-#endif
-    for (int i = 1; i < argc; ++i)
+#endif /* Q_WS_X11 */
+
+    /* Initialize VBox Runtime.
+     * Initialize the SUPLib as well only if we are really about to start a VM.
+     * Don't do this if we are only starting the selector window or a separate VM process. */
+    bool fStartVM = false;
+    bool fSeparateProcess = false;
+    for (int i = 1; i < argc && !(fStartVM && fSeparateProcess); ++i)
     {
         /* NOTE: the check here must match the corresponding check for the
          * options to start a VM in hardenedmain.cpp and VBoxGlobal.cpp exactly,
@@ -579,11 +539,18 @@ int main(int argc, char **argv, char **envp)
         if (   !::strcmp(argv[i], "--startvm")
             || !::strcmp(argv[i], "-startvm"))
         {
-            fInitSUPLib = true;
-            break;
+            fStartVM = true;
+        }
+        else if (   !::strcmp(argv[i], "--separate")
+                 || !::strcmp(argv[i], "-separate"))
+        {
+            fSeparateProcess = true;
         }
     }
-    int rc = RTR3InitExe(argc, &argv, fInitSUPLib ? RTR3INIT_FLAGS_SUPLIB : 0);
+
+    uint32_t fFlags = fStartVM && !fSeparateProcess ? RTR3INIT_FLAGS_SUPLIB : 0;
+
+    int rc = RTR3InitExe(argc, &argv, fFlags);
 
     /* Initialization failed: */
     if (RT_FAILURE(rc))
@@ -591,6 +558,8 @@ int main(int argc, char **argv, char **envp)
         /* We have to create QApplication anyway
          * just to show the only one error-message: */
         QApplication a(argc, &argv[0]);
+        Q_UNUSED(a);
+
 #ifdef Q_OS_SOLARIS
         /* Use plastique look&feel for Solaris instead of the default motif (Qt 4.7.x): */
         QApplication::setStyle(new QPlastiqueStyle);
@@ -709,7 +678,7 @@ extern "C" DECLEXPORT(void) TrustedError(const char *pszWhere, SUPINITOP enmWhat
 
     QMessageBox::critical(0 /* parent */, strTitle, strText,
                           QMessageBox::Abort /* 1st button */, 0 /* 2nd button */);
-    qFatal("%s", strText.toAscii().constData());
+    qFatal("%s", strText.toUtf8().constData());
 }
 
 #endif /* VBOX_WITH_HARDENING */
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
index e8362e8..dd41783 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMedium.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMedium class implementation
+ * VBox Qt GUI - UIMedium class implementation.
  */
 
 /*
- * Copyright (C) 2009-2013 Oracle Corporation
+ * Copyright (C) 2009-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,22 +16,20 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
 /* Qt includes: */
-#include <QDir>
-
+# include <QDir>
 /* GUI includes: */
-#include "UIMedium.h"
-#include "VBoxGlobal.h"
-#include "UIConverter.h"
-#include "UIMessageCenter.h"
-
+# include "UIMedium.h"
+# include "VBoxGlobal.h"
+# include "UIConverter.h"
+# include "UIMessageCenter.h"
+# include "UIExtraDataManager.h"
+# include "UIIconPool.h"
 /* COM includes: */
-#include "CMachine.h"
-#include "CSnapshot.h"
-
+# include "CMachine.h"
+# include "CSnapshot.h"
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 QString UIMedium::m_sstrNullID = QUuid().toString().remove('{').remove('}');
@@ -42,28 +38,26 @@ QString UIMedium::m_sstrRow = QString("<tr><td>%1</td></tr>");
 
 UIMedium::UIMedium()
     : m_type(UIMediumType_Invalid)
+    , m_medium(CMedium())
     , m_state(KMediumState_NotCreated)
 {
     refresh();
-//    printf("UIMedium: New NULL medium created.\n");
 }
 
 UIMedium::UIMedium(const CMedium &medium, UIMediumType type)
-    : m_medium(medium)
-    , m_type(type)
+    : m_type(type)
+    , m_medium(medium)
     , m_state(KMediumState_NotCreated)
 {
     refresh();
-//    printf("UIMedium: New medium with ID={%s} created.\n", id().toAscii().constData());
 }
 
 UIMedium::UIMedium(const CMedium &medium, UIMediumType type, KMediumState state)
-    : m_medium(medium)
-    , m_type(type)
+    : m_type(type)
+    , m_medium(medium)
     , m_state(state)
 {
     refresh();
-//    printf("UIMedium: New medium with ID={%s} created (with known state).\n", id().toAscii().constData());
 }
 
 UIMedium::UIMedium(const UIMedium &other)
@@ -73,64 +67,55 @@ UIMedium::UIMedium(const UIMedium &other)
 
 UIMedium& UIMedium::operator=(const UIMedium &other)
 {
-    m_medium = other.medium();
     m_type = other.type();
+
+    m_medium = other.medium();
+
     m_state = other.state();
-    m_strLastAccessError = other.lastAccessError();
     m_result = other.result();
+    m_strLastAccessError = other.lastAccessError();
 
-    m_strKey = other.key();
     m_strId = other.id();
+    m_strRootId = other.rootID();
+    m_strParentId = other.parentID();
+
+    m_strKey = other.key();
+
     m_strName = other.name();
     m_strLocation = other.location();
 
     m_strSize = other.size();
     m_strLogicalSize = other.logicalSize();
 
-    m_strHardDiskFormat = other.hardDiskFormat();
     m_strHardDiskType = other.hardDiskType();
-
+    m_strHardDiskFormat = other.hardDiskFormat();
     m_strStorageDetails = other.storageDetails();
+    m_strEncryptionPasswordID = other.encryptionPasswordID();
 
     m_strUsage = other.usage();
     m_strToolTip = other.tip();
+    m_machineIds = other.machineIds();
+    m_curStateMachineIds = other.curStateMachineIds();
+
+    m_noDiffs = other.cache();
 
     m_fHidden = other.m_fHidden;
-    m_fAttachedToHiddenMachinesOnly = other.m_fAttachedToHiddenMachinesOnly;
+    m_fUsedByHiddenMachinesOnly = other.m_fUsedByHiddenMachinesOnly;
     m_fReadOnly = other.isReadOnly();
     m_fUsedInSnapshots = other.isUsedInSnapshots();
     m_fHostDrive = other.isHostDrive();
-
-    m_machineIds = other.machineIds();
-    m_curStateMachineIds = other.curStateMachineIds();
-
-    m_strParentID = other.parentID();
-    m_strRootID = other.rootID();
-
-    m_noDiffs = other.cache();
+    m_fEncrypted = other.isEncrypted();
 
     return *this;
 }
 
-/**
- * Queries the medium state. Call this and then read the state field instead
- * of calling GetState() on medium directly as it will properly handle the
- * situation when GetState() itself fails by setting state to Inaccessible
- * and memorizing the error info describing why GetState() failed.
- *
- * As the last step, this method calls #refresh() to refresh all precomposed
- * strings.
- *
- * @note This method blocks for the duration of the state check. Since this
- *       check may take quite a while (e.g. for a medium located on a
- *       network share), the calling thread must not be the UI thread. You
- *       have been warned.
- */
 void UIMedium::blockAndQueryState()
 {
+    /* Ignore for NULL medium: */
     if (m_medium.isNull())
         return;
 
+    /* Acquire actual medium state: */
     m_state = m_medium.RefreshState();
 
     /* Save the result to distinguish between
@@ -144,143 +129,186 @@ void UIMedium::blockAndQueryState()
     else
         m_strLastAccessError = m_medium.GetLastAccessError();
 
+    /* Refresh finally: */
     refresh();
 }
 
-/**
- * Refreshes the precomposed strings containing such media parameters as
- * location, size by querying the respective data from the associated
- * media object.
- *
- * Note that some string such as #size() are meaningless if the media state is
- * KMediumState_NotCreated (i.e. the medium has not yet been checked for
- * accessibility).
- */
 void UIMedium::refresh()
 {
-    /* Flags are 'false' by default: */
-    m_fHidden = false;
-    m_fAttachedToHiddenMachinesOnly = false;
-    m_fReadOnly = false;
-    m_fUsedInSnapshots = false;
-    m_fHostDrive = false;
+    /* Reset ID parameters: */
+    m_strId = nullID();
+    m_strRootId = nullID();
+    m_strParentId = nullID();
 
-    /* Detect basic parameters... */
+    /* Reset cache parameters: */
+    //m_strKey = nullID();
 
-    m_strId = m_medium.isNull() ? nullID() : m_medium.GetId();
+    /* Reset name/location/size parameters: */
+    m_strName = VBoxGlobal::tr("Empty", "medium");
+    m_strLocation = m_strSize = m_strLogicalSize = QString("--");
 
-    if (m_strKey.isNull() && !m_strId.isNull())
-        m_strKey = m_strId;
+    /* Reset hard drive related parameters: */
+    m_strHardDiskType = QString();
+    m_strHardDiskFormat = QString();
+    m_strStorageDetails = QString();
+    m_strEncryptionPasswordID = QString();
 
-    m_fHostDrive = m_medium.isNull() ? false : m_medium.GetHostDrive();
+    /* Reset data parameters: */
+    m_strUsage = QString();
+    m_strToolTip = QString();
+    m_machineIds.clear();
+    m_curStateMachineIds.clear();
 
-    if (m_medium.isNull())
-        m_strName = VBoxGlobal::tr("Empty", "medium");
-    else if (!m_fHostDrive)
-        m_strName = m_medium.GetName();
-    else if (m_medium.GetDescription().isEmpty())
-        m_strName = VBoxGlobal::tr("Host Drive '%1'", "medium").arg(QDir::toNativeSeparators(m_medium.GetLocation()));
-    else
-        m_strName = VBoxGlobal::tr("Host Drive %1 (%2)", "medium").arg(m_medium.GetDescription(), m_medium.GetName());
+    /* Reset m_noDiffs: */
+    m_noDiffs.isSet = false;
 
-    m_strLocation = m_medium.isNull() || m_fHostDrive ? QString("--") :
-                    QDir::toNativeSeparators(m_medium.GetLocation());
+    /* Reset flags: */
+    m_fHidden = false;
+    m_fUsedByHiddenMachinesOnly = false;
+    m_fReadOnly = false;
+    m_fUsedInSnapshots = false;
+    m_fHostDrive = false;
+    m_fEncrypted = false;
 
-    QString tmp;
+    /* For non NULL medium: */
     if (!m_medium.isNull())
-        tmp = m_medium.GetProperty("Special/GUI/Hints");
-    if (!tmp.isEmpty())
     {
-        QStringList tmpList(tmp.split(','));
-        if (tmpList.contains("Hide", Qt::CaseInsensitive))
-            m_fHidden = true;
-    }
+        /* Refresh medium ID: */
+        m_strId = m_medium.GetId();
+        /* Refresh root medium ID: */
+        m_strRootId = m_strId;
+
+        /* Init medium key if necessary: */
+        if (m_strKey.isNull())
+            m_strKey = m_strId;
+
+        /* Check whether this is host-drive medium: */
+        m_fHostDrive = m_medium.GetHostDrive();
+
+        /* Refresh medium name: */
+        if (!m_fHostDrive)
+            m_strName = m_medium.GetName();
+        else if (m_medium.GetDescription().isEmpty())
+            m_strName = VBoxGlobal::tr("Host Drive '%1'", "medium").arg(QDir::toNativeSeparators(m_medium.GetLocation()));
+        else
+            m_strName = VBoxGlobal::tr("Host Drive %1 (%2)", "medium").arg(m_medium.GetDescription(), m_medium.GetName());
+        /* Refresh medium location: */
+        if (!m_fHostDrive)
+            m_strLocation = QDir::toNativeSeparators(m_medium.GetLocation());
 
-    /* Initialize parent/root IDs: */
-    m_strParentID = nullID();
-    m_strRootID = m_strId;
-    if (m_type == UIMediumType_HardDisk)
-    {
-        m_strHardDiskFormat = m_medium.GetFormat();
-        m_strHardDiskType = vboxGlobal().mediumTypeString(m_medium);
+        /* Refresh medium size and logical size: */
+        if (!m_fHostDrive)
+        {
+            /* Only for created and accessible mediums: */
+            if (m_state != KMediumState_Inaccessible && m_state != KMediumState_NotCreated)
+            {
+                m_strSize = vboxGlobal().formatSize(m_medium.GetSize());
+                if (m_type == UIMediumType_HardDisk)
+                    m_strLogicalSize = vboxGlobal().formatSize(m_medium.GetLogicalSize());
+                else
+                    m_strLogicalSize = m_strSize;
+            }
+        }
 
-        QVector<KMediumVariant> mediumVariants = m_medium.GetVariant();
-        qlonglong mediumVariant = 0;
-        for (int i = 0; i < mediumVariants.size(); ++i)
-            mediumVariant |= mediumVariants[i];
+        /* For hard drive medium: */
+        if (m_type == UIMediumType_HardDisk)
+        {
+            /* Refresh hard drive disk type: */
+            m_strHardDiskType = vboxGlobal().mediumTypeString(m_medium);
+            /* Refresh hard drive format: */
+            m_strHardDiskFormat = m_medium.GetFormat();
+
+            /* Refresh hard drive storage details: */
+            qlonglong iMediumVariant = 0;
+            foreach (const KMediumVariant &enmVariant, m_medium.GetVariant())
+                iMediumVariant |= enmVariant;
+            m_strStorageDetails = gpConverter->toString((KMediumVariant)iMediumVariant);
+
+            /* Check whether this is read-only hard drive: */
+            m_fReadOnly = m_medium.GetReadOnly();
+
+            /* Refresh parent hard drive ID: */
+            CMedium parentMedium = m_medium.GetParent();
+            if (!parentMedium.isNull())
+                m_strParentId = parentMedium.GetId();
+
+            /* Only for created and accessible mediums: */
+            if (m_state != KMediumState_Inaccessible && m_state != KMediumState_NotCreated)
+            {
+                /* Refresh root hard drive ID: */
+                while (!parentMedium.isNull())
+                {
+                    m_strRootId = parentMedium.GetId();
+                    parentMedium = parentMedium.GetParent();
+                }
 
-        m_strStorageDetails = gpConverter->toString((KMediumVariant)mediumVariant);
-        m_fReadOnly = m_medium.GetReadOnly();
+                /* Refresh encryption attributes: */
+                if (m_strRootId != m_strId)
+                {
+                    m_strEncryptionPasswordID = root().encryptionPasswordID();
+                    m_fEncrypted = root().isEncrypted();
+                }
+                else
+                {
+                    QString strCipher;
+                    CMedium medium(m_medium);
+                    const QString strEncryptionPasswordID = medium.GetEncryptionSettings(strCipher);
+                    if (medium.isOk())
+                    {
+                        m_strEncryptionPasswordID = strEncryptionPasswordID;
+                        m_fEncrypted = true;
+                    }
+                }
+            }
+        }
 
-        /* Adjust parent/root IDs: */
-        CMedium parentMedium = m_medium.GetParent();
-        if (!parentMedium.isNull())
-            m_strParentID = parentMedium.GetId();
-        while (!parentMedium.isNull())
+        /* Check whether this is hidden medium: */
+        QString strHints = m_medium.GetProperty("Special/GUI/Hints");
+        if (!strHints.isEmpty())
         {
-            m_strRootID = parentMedium.GetId();
-            parentMedium = parentMedium.GetParent();
+            QStringList hints(strHints.split(','));
+            if (hints.contains("Hide", Qt::CaseInsensitive))
+                m_fHidden = true;
         }
-    }
-    else
-    {
-        m_strHardDiskFormat = QString();
-        m_strHardDiskType = QString();
-        m_fReadOnly = false;
-    }
-
-    /* Detect sizes */
-    if (m_state != KMediumState_Inaccessible && m_state != KMediumState_NotCreated && !m_fHostDrive)
-    {
-        m_strSize = vboxGlobal().formatSize(m_medium.GetSize());
-        if (m_type == UIMediumType_HardDisk)
-            m_strLogicalSize = vboxGlobal().formatSize(m_medium.GetLogicalSize());
-        else
-            m_strLogicalSize = m_strSize;
-    }
-    else
-    {
-        m_strSize = m_strLogicalSize = QString("--");
-    }
 
-    /* Detect usage */
-    m_strUsage = QString();
-    if (!m_medium.isNull())
-    {
+        /* Refresh usage data: */
         m_curStateMachineIds.clear();
         m_machineIds = m_medium.GetMachineIds().toList();
         if (m_machineIds.size() > 0)
         {
-            /* We assume this flag is 'true' if at least one machine present: */
-            m_fAttachedToHiddenMachinesOnly = true;
-
-            QString strUsage;
-
+            /* Get CVirtualBox object: */
             CVirtualBox vbox = vboxGlobal().virtualBox();
 
+            /* By default we assuming that this medium is attached
+             * to 'hidden' machines only, if at least one machine present: */
+            m_fUsedByHiddenMachinesOnly = true;
+
+            /* Prepare machine usage: */
+            QString strMachineUsage;
+            /* Walk through all the machines this medium attached to: */
             foreach (const QString &strMachineID, m_machineIds)
             {
+                /* Look for the corresponding machine: */
                 CMachine machine = vbox.FindMachine(strMachineID);
 
-                /* UIMedium object can wrap newly created CMedium object which belongs to
-                 * not yet registered machine, like while creating VM clone.
-                 * We can skip such a machines in usage string.
-                 * CVirtualBox::FindMachine() will return null machine for such case. */
+                /* UIMedium object can wrap newly created CMedium object
+                 * which belongs to not yet registered machine, like while creating VM clone.
+                 * We can skip such a machines in usage string. */
                 if (machine.isNull())
                 {
-                    /* We can't decide for that medium yet,
-                     * assume this flag is 'false' for now: */
-                    m_fAttachedToHiddenMachinesOnly = false;
+                    /* Since we can't precisely check 'hidden' status for that machine in such case,
+                     * we have to assume that medium attached not only to 'hidden' machines: */
+                    m_fUsedByHiddenMachinesOnly = false;
                     continue;
                 }
 
-                /* Finally, we are checking if current machine overrides this flag: */
-                if (m_fAttachedToHiddenMachinesOnly && vboxGlobal().shouldWeShowMachine(machine))
-                    m_fAttachedToHiddenMachinesOnly = false;
-
-                QString strName = machine.GetName();
-                QString strSnapshots;
+                /* Finally we can precisely check if current machine is 'hidden': */
+                if (gEDataManager->showMachineInSelectorChooser(strMachineID))
+                    m_fUsedByHiddenMachinesOnly = false;
 
+                /* Prepare snapshot usage: */
+                QString strSnapshotUsage;
+                /* Walk through all the snapshots this medium attached to: */
                 foreach (const QString &strSnapshotID, m_medium.GetSnapshotIds(strMachineID))
                 {
                     if (strSnapshotID == strMachineID)
@@ -292,48 +320,46 @@ void UIMedium::refresh()
                         continue;
                     }
 
+                    /* Look for the corresponding snapshot: */
                     CSnapshot snapshot = machine.FindSnapshot(strSnapshotID);
-                    if (!snapshot.isNull()) // can be NULL while takeSnaphot is in progress
-                    {
-                        if (!strSnapshots.isNull())
-                            strSnapshots += ", ";
-                        strSnapshots += snapshot.GetName();
-                    }
-                }
-
-                if (!strUsage.isNull())
-                    strUsage += ", ";
 
-                strUsage += strName;
+                    /* Snapshot can be NULL while takeSnaphot is in progress: */
+                    if (snapshot.isNull())
+                        continue;
 
-                if (!strSnapshots.isNull())
-                {
-                    strUsage += QString(" (%2)").arg(strSnapshots);
+                    /* Refresh snapshot usage flag: */
                     m_fUsedInSnapshots = true;
+
+                    /* Append snapshot usage: */
+                    if (!strSnapshotUsage.isNull())
+                        strSnapshotUsage += ", ";
+                    strSnapshotUsage += snapshot.GetName();
                 }
-                else
-                    m_fUsedInSnapshots = false;
+
+                /* Append machine usage: */
+                if (!strMachineUsage.isNull())
+                    strMachineUsage += ", ";
+                strMachineUsage += machine.GetName();
+
+                /* Append snapshot usage: */
+                if (!strSnapshotUsage.isNull())
+                    strMachineUsage += QString(" (%2)").arg(strSnapshotUsage);
             }
 
-            if (!strUsage.isEmpty())
-                m_strUsage = strUsage;
+            /* Append machine usage: */
+            if (!strMachineUsage.isEmpty())
+                m_strUsage += strMachineUsage;
         }
-    }
 
-    /* Compose the tooltip */
-    if (!m_medium.isNull())
-    {
+        /* Refresh tool-tip: */
         m_strToolTip = m_sstrRow.arg(QString("<p style=white-space:pre><b>%1</b></p>").arg(m_fHostDrive ? m_strName : m_strLocation));
-
         if (m_type == UIMediumType_HardDisk)
         {
             m_strToolTip += m_sstrRow.arg(VBoxGlobal::tr("<p style=white-space:pre>Type (Format):  %1 (%2)</p>", "medium")
                                                          .arg(m_strHardDiskType).arg(m_strHardDiskFormat));
         }
-
         m_strToolTip += m_sstrRow.arg(VBoxGlobal::tr("<p>Attached to:  %1</p>", "image")
                                                      .arg(m_strUsage.isNull() ? VBoxGlobal::tr("<i>Not Attached</i>", "image") : m_strUsage));
-
         switch (m_state)
         {
             case KMediumState_NotCreated:
@@ -345,7 +371,7 @@ void UIMedium::refresh()
             {
                 if (m_result.isOk())
                 {
-                    /* Not Accessible */
+                    /* Not Accessible: */
                     m_strToolTip += m_sstrRow.arg("<hr>") + m_sstrRow.arg(VBoxGlobal::highlight(m_strLastAccessError, true /* aToolTip */));
                 }
                 else
@@ -360,47 +386,20 @@ void UIMedium::refresh()
                 break;
         }
     }
-
-    /* Reset m_noDiffs */
-    m_noDiffs.isSet = false;
 }
 
 void UIMedium::updateParentID()
 {
-    m_strParentID = nullID();
+    m_strParentId = nullID();
     if (m_type == UIMediumType_HardDisk)
     {
         CMedium parentMedium = m_medium.GetParent();
         if (!parentMedium.isNull())
-            m_strParentID = parentMedium.GetId();
+            m_strParentId = parentMedium.GetId();
     }
 }
 
-UIMedium UIMedium::parent() const
-{
-    /* Redirect call to VBoxGlobal: */
-    return vboxGlobal().medium(m_strParentID);
-}
-
-UIMedium UIMedium::root() const
-{
-    /* Redirect call to VBoxGlobal: */
-    return vboxGlobal().medium(m_strRootID);
-}
-
-/**
- * Returns generated tooltip for this medium.
- *
- * In "don't show diffs" mode (where the attributes of the base hard disk are
- * shown instead of the attributes of the differencing hard disk), extra
- * information will be added to the tooltip to give the user a hint that the
- * medium is actually a differencing hard disk.
- *
- * @param fNoDiffs  @c true to enable user-friendly "don't show diffs" mode.
- * @param fCheckRO  @c true to perform the #readOnly() check and add a notice
- *                  accordingly.
- */
-QString UIMedium::toolTip (bool fNoDiffs /* = false */, bool fCheckRO /* = false */, bool fNullAllowed /* = false */) const
+QString UIMedium::toolTip(bool fNoDiffs /* = false */, bool fCheckRO /* = false */, bool fNullAllowed /* = false */) const
 {
     QString strTip;
 
@@ -419,27 +418,13 @@ QString UIMedium::toolTip (bool fNoDiffs /* = false */, bool fCheckRO /* = false
 
         if (fCheckRO && m_fReadOnly)
             strTip += m_sstrRow.arg("<hr>") +
-                      m_sstrRow.arg(VBoxGlobal::tr("Attaching this hard disk will be performed indirectly using "
-                                                   "a newly created differencing hard disk.", "medium"));
+                      m_sstrRow.arg(VBoxGlobal::tr("Attaching this hard drive will be performed indirectly using "
+                                                   "a newly created differencing hard drive.", "medium"));
     }
 
     return m_sstrTable.arg(strTip);
 }
 
-/**
- * Returns an icon corresponding to the media state. Distinguishes between
- * the Inaccessible state and the situation when querying the state itself
- * failed.
- *
- * In "don't show diffs" mode (where the attributes of the base hard disk are
- * shown instead of the attributes of the differencing hard disk), the most
- * worst media state on the given hard disk chain will be used to select the
- * media icon.
- *
- * @param fNoDiffs  @c true to enable user-friendly "don't show diffs" mode.
- * @param fCheckRO  @c true to perform the #readOnly() check and change the icon
- *                  accordingly.
- */
 QPixmap UIMedium::icon(bool fNoDiffs /* = false */, bool fCheckRO /* = false */) const
 {
     QPixmap pixmap;
@@ -448,49 +433,28 @@ QPixmap UIMedium::icon(bool fNoDiffs /* = false */, bool fCheckRO /* = false */)
         pixmap = result(fNoDiffs).isOk() ? vboxGlobal().warningIcon() : vboxGlobal().errorIcon();
 
     if (fCheckRO && m_fReadOnly)
-        pixmap = VBoxGlobal::joinPixmaps(pixmap, QPixmap(":/hd_new_16px.png"));
+    {
+        QIcon icon = UIIconPool::iconSet(":/hd_new_16px.png");
+        pixmap = VBoxGlobal::joinPixmaps(pixmap, icon.pixmap(icon.availableSizes().first()));
+    }
 
     return pixmap;
 }
 
-/**
- * Returns the details of this medium as a single-line string
- *
- * For hard disks, the details include the location, type and the logical size
- * of the hard disk. Note that if @a fNoDiffs is @c true, these properties are
- * queried on the root hard disk of the given hard disk because the primary
- * purpose of the returned string is to be human readable (so that seeing a
- * complex diff hard disk name is usually not desirable).
- *
- * For other media types, the location and the actual size are returned.
- * Arguments @a fPredictDiff and @a aNoRoot are ignored in this case.
- *
- * @param fNoDiffs      @c true to enable user-friendly "don't show diffs" mode.
- * @param fPredictDiff  @c true to mark the hard disk as differencing if
- *                      attaching it would create a differencing hard disk (not
- *                      used when @a aNoRoot is true).
- * @param fUseHTML      @c true to allow for emphasizing using bold and italics.
- *
- * @note Use #detailsHTML() instead of passing @c true for @a fUseHTML.
- *
- * @note The media object may become uninitialized by a third party while this
- *       method is reading its properties. In this case, the method will return
- *       an empty string.
- */
 QString UIMedium::details(bool fNoDiffs /* = false */,
                           bool fPredictDiff /* = false */,
                           bool fUseHTML /* = false */) const
 {
     // @todo the below check is rough; if m_medium becomes uninitialized, any
     // of getters called afterwards will also fail. The same relates to the
-    // root hard disk object (that will be the hard disk itself in case of
+    // root hard drive object (that will be the hard drive itself in case of
     // non-differencing disks). However, this check was added to fix a
-    // particular use case: when the hard disk is a differencing hard disk and
+    // particular use case: when the hard drive is a differencing hard drive and
     // it happens to be discarded (and uninitialized) after this method is
     // called but before we read all its properties (yes, it's possible!), the
     // root object will be null and calling methods on it will assert in the
     // debug builds. This check seems to be enough as a quick solution (fresh
-    // hard disk attachments will be re-read by a machine state change signal
+    // hard drive attachments will be re-read by a machine state change signal
     // after the discard operation is finished, so the user will eventually see
     // correct data), but in order to solve the problem properly we need to use
     // exceptions everywhere (or check the result after every method call). See
@@ -527,6 +491,10 @@ QString UIMedium::details(bool fNoDiffs /* = false */,
         {
             strDetails = QString("%1, ").arg(rootMedium.m_strHardDiskType);
         }
+
+        /* Add encryption status: */
+        if (m_fEncrypted)
+            strDetails += QString("%1, ").arg(VBoxGlobal::tr("Encrypted", "medium"));
     }
 
     // @todo prepend the details with the warning/error icon when not accessible
@@ -578,11 +546,18 @@ bool UIMedium::isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium)
     return false;
 }
 
-/**
- * Checks if m_noDiffs is filled in and does it if not.
- *
- * @param fNoDiffs  @if false, this method immediately returns.
- */
+UIMedium UIMedium::root() const
+{
+    /* Redirect call to VBoxGlobal: */
+    return vboxGlobal().medium(m_strRootId);
+}
+
+UIMedium UIMedium::parent() const
+{
+    /* Redirect call to VBoxGlobal: */
+    return vboxGlobal().medium(m_strParentId);
+}
+
 void UIMedium::checkNoDiffs(bool fNoDiffs)
 {
     if (!fNoDiffs || m_noDiffs.isSet)
@@ -598,10 +573,9 @@ void UIMedium::checkNoDiffs(bool fNoDiffs)
             m_noDiffs.state = parentMedium.m_state;
 
             if (m_noDiffs.toolTip.isNull())
-                m_noDiffs.toolTip = m_sstrRow.arg(VBoxGlobal::tr("Some of the files in this hard disk chain "
-                                                                 "are inaccessible. Please use the Virtual Media "
-                                                                 "Manager in <b>Show Differencing Hard Disks</b> "
-                                                                 "mode to inspect these files.", "medium"));
+                m_noDiffs.toolTip = m_sstrRow.arg(VBoxGlobal::tr("Some of the files in this hard drive chain "
+                                                                 "are inaccessible. Please use the Virtual Medium "
+                                                                 "Manager to inspect these files.", "medium"));
 
             if (!parentMedium.m_result.isOk())
             {
@@ -615,8 +589,8 @@ void UIMedium::checkNoDiffs(bool fNoDiffs)
     {
         m_noDiffs.toolTip = root().tip() +
                             m_sstrRow.arg("<hr>") +
-                            m_sstrRow.arg(VBoxGlobal::tr("This base hard disk is indirectly attached using "
-                                                         "the following differencing hard disk:", "medium")) +
+                            m_sstrRow.arg(VBoxGlobal::tr("This base hard drive is indirectly attached using "
+                                                         "the following differencing hard drive:", "medium")) +
                             m_strToolTip + m_noDiffs.toolTip;
     }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h
index 1ed6688..2fd5bf2 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMedium.h
@@ -1,11 +1,10 @@
+/* $Id: UIMedium.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMedium class declaration
+ * VBox Qt GUI - UIMedium class declaration.
  */
 
 /*
- * Copyright (C) 2009-2013 Oracle Corporation
+ * Copyright (C) 2009-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,8 +15,8 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIMedium_h__
-#define __UIMedium_h__
+#ifndef ___UIMedium_h___
+#define ___UIMedium_h___
 
 /* Qt includes: */
 #include <QMap>
@@ -33,12 +32,15 @@
 /* Other VBox includes: */
 #include "iprt/cpp/utils.h"
 
-/**
- * Cache used to override some attributes in the user-friendly "don't show diffs" mode.
- */
+/** Storage medium cache used to
+  * override some UIMedium attributes in the
+  * user-friendly "don't show diffs" mode. */
 struct NoDiffsCache
 {
+    /** Constructor. */
     NoDiffsCache() : isSet(false), state(KMediumState_NotCreated) {}
+
+    /** Operator= reimplementation. */
     NoDiffsCache& operator=(const NoDiffsCache &other)
     {
         isSet = other.isSet;
@@ -48,233 +50,331 @@ struct NoDiffsCache
         return *this;
     }
 
+    /** Holds whether the cache is set. */
     bool isSet : 1;
 
+    /** Holds overriden medium state. */
     KMediumState state;
+    /** Holds overriden medium acquiring result. */
     COMResult result;
+    /** Holds overriden medium tool-tip. */
     QString toolTip;
 };
 
-/**
- * Media descriptor for the GUI.
- *
- * Maintains the results of the last state (accessibility) check and precomposes
- * string parameters such as location, size which can be used in various GUI
- * controls.
- *
- * Many getter methods take the boolean @a aNoDiffs argument. Unless explicitly
- * stated otherwise, this argument, when set to @c true, will cause the
- * corresponding property of this object's root medium to be returned instead of
- * its own one. This is useful when hard disk media is represented in the
- * user-friendly "don't show diffs" mode. For non-hard disk media, the value of
- * this argument is irrelevant because the root object for such medium is
- * the medium itself.
- *
- * Note that this class "abuses" the KMediumState_NotCreated state value to
- * indicate that the accessibility check of the given medium (see
- * #blockAndQueryState()) has not been done yet and therefore some parameters
- * such as #size() are meaningless because they can be read only from the
- * accessible medium. The real KMediumState_NotCreated state is not necessary
- * because this class is only used with created (existing) media.
- */
+/** Storage medium descriptor wrapping CMedium wrapper for IMedium interface.
+  *
+  * Maintains the results of the last CMedium state (accessibility) check and precomposes
+  * string parameters such as name, location and size which can be used for various GUI tasks.
+  *
+  * Many getter methods take the boolean @a fNoDiffs argument.
+  * Unless explicitly stated otherwise, this argument, when set to @c true,
+  * will cause the corresponding property of this object's root medium to be returned instead
+  * of its own one. This is useful when hard drive medium is reflected in the user-friendly
+  * "don't show diffs" mode. For non-hard drive mediums, the value of this argument is irrelevant
+  * because the root object for such medium is the medium itself.
+  *
+  * Note that this class "abuses" the KMediumState_NotCreated state value to indicate that the
+  * accessibility check of the given medium (see #blockAndQueryState()) has not been done yet
+  * and therefore some parameters such as #size() are meaningless because they can be read only
+  * from the accessible medium. The real KMediumState_NotCreated state is not necessary because
+  * this class is only used with created (existing) mediums. */
 class UIMedium
 {
 public:
 
-    /* Default (NULL) constructor:
-     * Creates NULL uimedium which is not associated with any medium. */
+    /** Default constructor.
+      * Creates NULL UIMedium which is not associated with any CMedium. */
     UIMedium();
 
-    /* Lazy wrapping constructor:
-     * Creates a uimedium associated with the given medium. */
+    /** Lazy wrapping constructor.
+      * Creates the UIMedium associated with the given @a medium of the given @a type. */
     UIMedium(const CMedium &medium, UIMediumType type);
 
-    /* Wrapping constructor with known medium state:
-     * Similar to previous one but sets the uimedium state to passed one.
-     * Suitable when the medium-state is known such as right after medium creation. */
+    /** Wrapping constructor with known medium state.
+      * Similarly to the previous one it creates the UIMedium associated with the
+      * given @a medium of the given @a type but sets the UIMedium @a state to passed one.
+      * Suitable when the medium state is known such as right after the medium creation. */
     UIMedium(const CMedium &medium, UIMediumType type, KMediumState state);
 
-    /* Copy-constructor: */
+    /** Copy constructor.
+      * Creates the UIMedium on the basis of the passed @a other one. */
     UIMedium(const UIMedium &other);
 
-    /* API: Operator=: */
+    /** Operator= reimplementation. */
     UIMedium& operator=(const UIMedium &other);
 
+    /** Queries the actual medium state.
+      * @note This method blocks for the duration of the state check.
+      *       Since this check may take quite a while,
+      *       the calling thread must not be the UI thread. */
     void blockAndQueryState();
+
+    /** Refreshes the precomposed user-readable strings.
+      * @note Note that some string such as #size() are meaningless if the medium state is
+      *       KMediumState_NotCreated (i.e. the medium has not yet been checked for accessibility). */
     void refresh();
 
-    bool isHidden() const { return m_fHidden | m_fAttachedToHiddenMachinesOnly; }
+    /** Returns the type of UIMedium object. */
+    UIMediumType type() const { return m_type; }
 
-    const CMedium &medium() const { return m_medium; }
+    /** Returns the CMedium wrapped by this UIMedium object. */
+    const CMedium& medium() const { return m_medium; }
 
-    UIMediumType type() const { return m_type; }
+    /** Returns @c true if CMedium wrapped by this UIMedium object is a NULL object. */
+    bool isNull() const { return m_medium.isNull(); }
 
-    /**
-     * Media state. In "don't show diffs" mode, this is the worst state (in
-     * terms of inaccessibility) detected on the given hard disk chain.
-     *
-     * @param fNoDiffs  @c true to enable user-friendly "don't show diffs" mode.
-     */
+    /** Returns the medium state.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the worst state
+      *        (in terms of inaccessibility) detected on the given hard drive chain. */
     KMediumState state(bool fNoDiffs = false) const
     {
-        unconst (this)->checkNoDiffs(fNoDiffs);
+        unconst(this)->checkNoDiffs(fNoDiffs);
         return fNoDiffs ? m_noDiffs.state : m_state;
     }
 
-    QString lastAccessError() const { return m_strLastAccessError; }
-
-    /**
-     * Result of the last blockAndQueryState() call. Will indicate an error and
-     * contain a proper error info if the last state check fails. In "don't show
-     * diffs" mode, this is the worst result (in terms of inaccessibility)
-     * detected on the given hard disk chain.
-     *
-     * @param fNoDiffs  @c true to enable user-friendly "don't show diffs" mode.
-     */
-    const COMResult &result(bool fNoDiffs = false) const
+    /** Returns the result of the last blockAndQueryState() call.
+      * Indicates an error and contain a proper error info if the last state check fails.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the worst result
+      *        (in terms of inaccessibility) detected on the given hard drive chain. */
+    const COMResult& result(bool fNoDiffs = false) const
     {
         unconst(this)->checkNoDiffs(fNoDiffs);
         return fNoDiffs ? m_noDiffs.result : m_result;
     }
 
+    /** Returns the error result of the last blockAndQueryState() call. */
+    QString lastAccessError() const { return m_strLastAccessError; }
+
+    /** Returns the medium ID. */
+    QString id() const { return m_strId; }
+
+    /** Returns the medium root ID. */
+    QString rootID() const { return m_strRootId; }
+    /** Returns the medium parent ID. */
+    QString parentID() const { return m_strParentId; }
+
+    /** Updates medium parent. */
+    void updateParentID();
+
+    /** Returns the medium cache key. */
     QString key() const { return m_strKey; }
+    /** Defines the medium cache @a strKey. */
     void setKey(const QString &strKey) { m_strKey = strKey; }
 
-    QString id() const { return m_strId; }
+    /** Returns the medium name.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the name of root in the given hard drive chain. */
     QString name(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strName : m_strName; }
+    /** Returns the medium location.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the location of root in the given hard drive chain. */
     QString location(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strLocation : m_strLocation; }
 
+    /** Returns the medium size.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the size of root in the given hard drive chain. */
     QString size(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strSize : m_strSize; }
+    /** Returns the logical medium size.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the logical size of root in the given hard drive chain. */
     QString logicalSize(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strLogicalSize : m_strLogicalSize; }
 
-    QString hardDiskFormat(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strHardDiskFormat : m_strHardDiskFormat; }
+    /** Returns the hard drive medium disk type.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the disk type of root in the given hard drive chain. */
     QString hardDiskType(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strHardDiskType : m_strHardDiskType; }
+    /** Returns the hard drive medium disk format.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the disk format of root in the given hard drive chain. */
+    QString hardDiskFormat(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strHardDiskFormat : m_strHardDiskFormat; }
 
+    /** Returns the hard drive medium storage details. */
     QString storageDetails() const { return m_strStorageDetails; }
+    /** Returns the hard drive medium encryption password ID. */
+    QString encryptionPasswordID() const { return m_strEncryptionPasswordID; }
 
+    /** Returns the medium usage data.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @note  In "don't show diffs" mode, this method returns the usage data of root in the given hard drive chain. */
     QString usage(bool fNoDiffs = false) const { return fNoDiffs ? root().m_strUsage : m_strUsage; }
+
+    /** Returns the short version of medium tool-tip. */
     QString tip() const { return m_strToolTip; }
 
-    const NoDiffsCache& cache() const { return m_noDiffs; }
+    /** Returns the full version of medium tool-tip.
+      * @param fNoDiffs     @c true to enable user-friendly "don't show diffs" mode.
+      * @param fCheckRO     @c true to perform the #readOnly() check and add a notice accordingly.
+      * @param fNullAllowed @c true to allow NULL medium description to be mentioned in the tool-tip.
+      * @note  In "don't show diffs" mode (where the attributes of the base hard drive are shown instead
+      *        of the attributes of the differencing hard drive), extra information will be added to the
+      *        tooltip to give the user a hint that the medium is actually a differencing hard drive. */
+    QString toolTip(bool fNoDiffs = false, bool fCheckRO = false, bool fNullAllowed = false) const;
 
-    /**
-     * Returns @c true if this medium is read-only (either because it is
-     * Immutable or because it has child hard disks). Read-only media can only
-     * be attached indirectly.
-     */
-    bool isReadOnly() const { return m_fReadOnly; }
+    /** Shortcut to <tt>#toolTip(fNoDiffs, true, fNullAllowed)</tt>. */
+    QString toolTipCheckRO(bool fNoDiffs = false, bool fNullAllowed = false) const { return toolTip(fNoDiffs, true, fNullAllowed); }
 
-    /**
-     * Returns @c true if this medium is attached to any VM (in the current
-     * state or in a snapshot) in which case #usage() will contain a string with
-     * comma-separated VM names (with snapshot names, if any, in parenthesis).
-     */
-    bool isUsed() const { return !m_strUsage.isNull(); }
+    /** Returns an icon corresponding to the medium state.
+      * Distinguishes between the Inaccessible state and the situation when querying the state itself failed.
+      * @param fNoDiffs @c true to enable user-friendly "don't show diffs" mode.
+      * @param fCheckRO @c true to perform the #readOnly() check and change the icon accordingly.
+      * @note  In "don't show diffs" mode (where the attributes of the base hard drive are shown instead
+      *        of the attributes of the differencing hard drive), the most worst medium state on the given
+      *        hard drive chain will be used to select the medium icon. */
+    QPixmap icon(bool fNoDiffs = false, bool fCheckRO = false) const;
 
-    /**
-     * Returns @c true if this medium is attached to any VM in any snapshot.
-     */
-    bool isUsedInSnapshots() const { return m_fUsedInSnapshots; }
+    /** Shortcut to <tt>#icon(fNoDiffs, true)</tt>. */
+    QPixmap iconCheckRO(bool fNoDiffs = false) const { return icon(fNoDiffs, true); }
 
-    /**
-     * Returns @c true if this medium corresponds to real host drive.
-     */
-    bool isHostDrive() const { return m_fHostDrive; }
+    /** Returns the details of this medium as a single-line string.
+      * @param fNoDiffs     @c true to enable user-friendly "don't show diffs" mode.
+      * @param fPredictDiff @c true to mark the hard drive as differencing if attaching
+      *                             it would create a differencing hard drive.
+      * @param fUseHTML     @c true to allow for emphasizing using bold and italics.
+      * @note  For hard drives, the details include the location, type and the logical size of the hard drive.
+      *        Note that if @a fNoDiffs is @c true, these properties are queried on the root hard drive of the
+      *        given hard drive because the primary purpose of the returned string is to be human readable
+      *        (so that seeing a complex diff hard drive name is usually not desirable).
+      * @note  For other medium types, the location and the actual size are returned.
+      *        Arguments @a fPredictDiff and @a fNoDiffs are ignored in this case.
+      * @note  Use #detailsHTML() instead of passing @c true for @a fUseHTML.
+      * @note  The medium object may become uninitialized by a third party while this method is reading its properties.
+      *        In this case, the method will return an empty string. */
+    QString details(bool fNoDiffs = false, bool fPredictDiff = false, bool fUseHTML = false) const;
 
-    /**
-     * Returns a vector of IDs of all machines this medium is attached to.
-     */
-    const QList <QString> &machineIds() const { return m_machineIds; }
+    /** Shortcut to <tt>#details(fNoDiffs, fPredictDiff, true)</tt>. */
+    QString detailsHTML(bool fNoDiffs = false, bool fPredictDiff = false) const { return details(fNoDiffs, fPredictDiff, true); }
 
-    /**
-     * Returns @c true if this medium is attached to the given machine in the current state.
-     */
-    bool isAttachedInCurStateTo(const QString &strMachineId) const { return m_curStateMachineIds.indexOf(strMachineId) >= 0; }
+    /** Returns the medium cache for "don't show diffs" mode. */
+    const NoDiffsCache& cache() const { return m_noDiffs; }
 
-    /**
-     * Returns a vector of IDs of all machines this medium is attached
-     * to in their current state (i.e. excluding snapshots).
-     */
-    const QList <QString> &curStateMachineIds() const { return m_curStateMachineIds; }
+    /** Returns whether this medium is hidden.
+      * @note The medium is considered 'hidden' if it has corresponding
+      *       medium property or is connected to 'hidden' VMs only. */
+    bool isHidden() const { return m_fHidden | m_fUsedByHiddenMachinesOnly; }
 
-    /* API: Parent/Root stuff: */
-    void updateParentID();
-    QString parentID() const { return m_strParentID; }
-    QString rootID() const { return m_strRootID; }
-    UIMedium parent() const;
-    UIMedium root() const;
+    /** Returns whether this medium is read-only
+      * (either because it is Immutable or because it has child hard drives).
+      * @note Read-only medium can only be attached indirectly. */
+    bool isReadOnly() const { return m_fReadOnly; }
 
-    QString toolTip(bool fNoDiffs = false, bool fCheckRO = false, bool fNullAllowed = false) const;
-    QPixmap icon(bool fNoDiffs = false, bool fCheckRO = false) const;
+    /** Returns whether this medium is attached to any VM in any snapshot. */
+    bool isUsedInSnapshots() const { return m_fUsedInSnapshots; }
 
-    /** Shortcut to <tt>#toolTip(fNoDiffs, true)</tt>. */
-    QString toolTipCheckRO(bool fNoDiffs = false, bool fNullAllowed = false) const { return toolTip(fNoDiffs, true, fNullAllowed); }
+    /** Returns whether this medium corresponds to real host drive. */
+    bool isHostDrive() const { return m_fHostDrive; }
 
-    /** Shortcut to <tt>#icon(fNoDiffs, true)</tt>. */
-    QPixmap iconCheckRO(bool fNoDiffs = false) const { return icon(fNoDiffs, true); }
+    /** Returns whether this medium is encrypted. */
+    bool isEncrypted() const { return m_fEncrypted; }
 
-    QString details(bool fNoDiffs = false, bool fPredictDiff = false, bool aUseHTML = false) const;
+    /** Returns whether this medium is attached to any VM (in the current state or in a snapshot) in which case
+      * #usage() will contain a string with comma-separated VM names (with snapshot names, if any, in parenthesis). */
+    bool isUsed() const { return !m_strUsage.isNull(); }
 
-    /** Shortcut to <tt>#details(fNoDiffs, fPredictDiff, true)</tt>. */
-    QString detailsHTML(bool fNoDiffs = false, bool fPredictDiff = false) const { return details(fNoDiffs, fPredictDiff, true); }
+    /** Returns whether this medium is attached to the given machine in the current state. */
+    bool isAttachedInCurStateTo(const QString &strMachineId) const { return m_curStateMachineIds.indexOf(strMachineId) >= 0; }
 
-    /** Returns @c true if this media descriptor is a null object. */
-    bool isNull() const { return m_medium.isNull(); }
+    /** Returns a vector of IDs of all machines this medium is attached to. */
+    const QList<QString>& machineIds() const { return m_machineIds; }
+    /** Returns a vector of IDs of all machines this medium is attached to
+      * in their current state (i.e. excluding snapshots). */
+    const QList<QString>& curStateMachineIds() const { return m_curStateMachineIds; }
 
-    /* Static API: Null medium ID: */
+    /** Returns NULL medium ID. */
     static QString nullID();
 
-    /** Determines if passed @a medium attached to hidden machines only. */
+    /** Determines if passed @a medium is attached to hidden machines only. */
     static bool isMediumAttachedToHiddenMachinesOnly(const UIMedium &medium);
 
 private:
 
-    void checkNoDiffs(bool fNoDiffs);
+    /** Returns medium root. */
+    UIMedium root() const;
+    /** Returns medium parent. */
+    UIMedium parent() const;
 
-    CMedium m_medium;
+    /** Checks if m_noDiffs is filled in and does it if not.
+      * @param fNoDiffs @if false, this method immediately returns. */
+    void checkNoDiffs(bool fNoDiffs);
 
+    /** Holds the type of UIMedium object. */
     UIMediumType m_type;
 
+    /** Holds the CMedium wrapped by this UIMedium object. */
+    CMedium m_medium;
+
+    /** Holds the medium state. */
     KMediumState m_state;
-    QString m_strLastAccessError;
+    /** Holds the result of the last blockAndQueryState() call. */
     COMResult m_result;
+    /** Holds the error result of the last blockAndQueryState() call. */
+    QString m_strLastAccessError;
 
-    QString m_strKey;
+    /** Holds the medium ID. */
     QString m_strId;
+    /** Holds the medium root ID. */
+    QString m_strRootId;
+    /** Holds the medium parent ID. */
+    QString m_strParentId;
+
+    /** Holds the medium cache key. */
+    QString m_strKey;
+
+    /** Holds the medium name. */
     QString m_strName;
+    /** Holds the medium location. */
     QString m_strLocation;
 
+    /** Holds the medium size. */
     QString m_strSize;
+    /** Holds the medium logical size. */
     QString m_strLogicalSize;
 
-    QString m_strHardDiskFormat;
+    /** Holds the hard drive medium disk type. */
     QString m_strHardDiskType;
-
+    /** Holds the hard drive medium disk format. */
+    QString m_strHardDiskFormat;
+    /** Holds the hard drive medium storage details. */
     QString m_strStorageDetails;
+    /** Holds the hard drive medium encryption password ID. */
+    QString m_strEncryptionPasswordID;
 
+    /** Holds the medium usage. */
     QString m_strUsage;
+    /** Holds the medium tool-tip. */
     QString m_strToolTip;
-
-    bool m_fHidden                       : 1;
-    bool m_fAttachedToHiddenMachinesOnly : 1;
-    bool m_fReadOnly                     : 1;
-    bool m_fUsedInSnapshots              : 1;
-    bool m_fHostDrive                    : 1;
-
+    /** Holds the vector of IDs of all machines this medium is attached to. */
     QList<QString> m_machineIds;
+    /** Hodls the vector of IDs of all machines this medium is attached to
+      * in their current state (i.e. excluding snapshots). */
     QList<QString> m_curStateMachineIds;
 
-    QString m_strParentID;
-    QString m_strRootID;
-
+    /** Holds the medium cache for "don't show diffs" mode. */
     NoDiffsCache m_noDiffs;
 
+    /** Holds whether this medium is 'hidden' by the corresponding medium property. */
+    bool m_fHidden                   : 1;
+    /** Holds whether this medium is 'hidden' because it's used by 'hidden' VMs only. */
+    bool m_fUsedByHiddenMachinesOnly : 1;
+    /** Holds whether this medium is read-only. */
+    bool m_fReadOnly                 : 1;
+    /** Holds whether this medium is attached to any VM in any snapshot. */
+    bool m_fUsedInSnapshots          : 1;
+    /** Holds whether this medium corresponds to real host drive. */
+    bool m_fHostDrive                : 1;
+    /** Holds whether this medium is encrypted. */
+    bool m_fEncrypted                : 1;
+
+    /** Holds the NULL medium ID. */
     static QString m_sstrNullID;
+    /** Holds the medium tool-tip table template. */
     static QString m_sstrTable;
+    /** Holds the medium tool-tip table row template. */
     static QString m_sstrRow;
 };
 Q_DECLARE_METATYPE(UIMedium);
 
 typedef QMap<QString, UIMedium> UIMediumMap;
 
-#endif /* __UIMedium_h__ */
+#endif /* !___UIMedium_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.cpp
index e3f65f9..bf66a3b 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMediumDefs.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMedium related implementations
+ * VBox Qt GUI - UIMedium related implementations.
  */
 
 /*
@@ -17,8 +15,15 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIMediumDefs.h"
+# include "UIMediumDefs.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Convert global medium type (KDeviceType) to local (UIMediumType): */
 UIMediumType UIMediumDefs::mediumTypeToLocal(KDeviceType globalType)
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h
index 31d3e62..750364b 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h
@@ -1,11 +1,10 @@
+/* $Id: UIMediumDefs.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMedium related declarations
+ * VBox Qt GUI - UIMedium related declarations.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,16 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIMediumDefs_h__
-#define __UIMediumDefs_h__
+#ifndef ___UIMediumDefs_h___
+#define ___UIMediumDefs_h___
 
 /* COM includes: */
 #include "COMEnums.h"
 
-/* UIMediumDefs namespace: */
+/* Other VBox includes: */
+#include <VBox/com/defs.h>
+
+/** UIMediumDefs namespace. */
 namespace UIMediumDefs
 {
-    /* UIMedium types: */
+    /** UIMedium types. */
     enum UIMediumType
     {
         UIMediumType_Invalid,
@@ -35,18 +37,48 @@ namespace UIMediumDefs
         UIMediumType_All
     };
 
-    /* Convert global medium type (KDeviceType) to local (UIMediumType): */
+    /** Converts global medium type (KDeviceType) to local (UIMediumType). */
     UIMediumType mediumTypeToLocal(KDeviceType globalType);
 
-    /* Convert local medium type (UIMediumType) to global (KDeviceType): */
+    /** Convert local medium type (UIMediumType) to global (KDeviceType). */
     KDeviceType mediumTypeToGlobal(UIMediumType localType);
 }
-
 /* Using this namespace globally: */
 using namespace UIMediumDefs;
 
-/* Let QMetaType know about UIMediumType: */
-Q_DECLARE_METATYPE(UIMediumType);
+/** Medium-target. */
+struct UIMediumTarget
+{
+    /** Medium-target types. */
+    enum UIMediumTargetType { UIMediumTargetType_WithID, UIMediumTargetType_WithLocation };
 
-#endif /* __UIMediumDefs_h__ */
+    /** Medium-target constructor. */
+    UIMediumTarget(const QString &strName = QString(), LONG iPort = 0, LONG iDevice = 0,
+                   UIMediumType aMediumType = UIMediumType_Invalid,
+                   UIMediumTargetType aType = UIMediumTargetType_WithID, const QString &strData = QString())
+        : name(strName), port(iPort), device(iDevice)
+        , mediumType(aMediumType)
+        , type(aType), data(strData)
+    {}
+
+    /** Determines controller name. */
+    QString name;
+    /** Determines controller port. */
+    LONG port;
+    /** Determines controller device. */
+    LONG device;
+
+    /** Determines medium-target medium-type. */
+    UIMediumType mediumType;
+
+    /** Determines medium-target type. */
+    UIMediumTargetType type;
+    /** Depending on medium-target type holds <i>ID</i> or <i>location</i>. */
+    QString data;
+};
+
+/* Let QMetaType know about our types: */
+Q_DECLARE_METATYPE(UIMediumType);
+Q_DECLARE_METATYPE(UIMediumTarget);
 
+#endif /* !___UIMediumDefs_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
index 3a6645a..258f995 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp
@@ -15,20 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QSet>
+# include <QSet>
 
 /* GUI includes: */
-#include "UIMediumEnumerator.h"
-#include "UIThreadPool.h"
-#include "UIVirtualBoxEventHandler.h"
-#include "VBoxGlobal.h"
+# include "UIMediumEnumerator.h"
+# include "UIThreadPool.h"
+# include "UIVirtualBoxEventHandler.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "COMEnums.h"
-#include "CMachine.h"
-#include "CSnapshot.h"
-#include "CMediumAttachment.h"
+# include "COMEnums.h"
+# include "CMachine.h"
+# include "CSnapshot.h"
+# include "CMediumAttachment.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 
 /* GUI task prototype: Medium enumeration.
@@ -73,6 +80,7 @@ UIMediumEnumerator::UIMediumEnumerator(ulong uWorkerCount /* = 3*/, ulong uWorke
     connect(gVBoxEvents, SIGNAL(sigSnapshotTake(QString, QString)), this, SLOT(sltHandleMachineUpdate(QString)));
     connect(gVBoxEvents, SIGNAL(sigSnapshotDelete(QString, QString)), this, SLOT(sltHandleSnapshotDeleted(QString, QString)));
     connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltHandleMachineUpdate(QString)));
+    connect(gVBoxEvents, SIGNAL(sigSnapshotRestore(QString, QString)), this, SLOT(sltHandleSnapshotDeleted(QString, QString)));
     connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), this, SLOT(sltHandleMachineRegistration(QString, bool)));
 
     /* Prepare thread-pool: */
@@ -188,23 +196,21 @@ void UIMediumEnumerator::sltHandleMachineUpdate(QString strMachineID)
     LogRel(("UIMediumEnumerator:  New usage: %s\n",
             currentCMediumIDs.isEmpty() ? "<empty>" : currentCMediumIDs.join(", ").toAscii().constData()));
 
-    /* Determine excluded/included mediums: */
-    QSet<QString> oldSet = previousUIMediumIDs.toSet();
-    QSet<QString> newSet = currentCMediumIDs.toSet();
-    QSet<QString> excludedSet = oldSet - newSet;
-    QSet<QString> includedSet = newSet - oldSet;
-    QStringList excludedList = excludedSet.toList();
-    QStringList includedList = includedSet.toList();
-    if (!excludedList.isEmpty())
-        LogRel(("UIMediumEnumerator:  Items excluded from usage: %s\n", excludedList.join(", ").toAscii().constData()));
-    if (!includedList.isEmpty())
-        LogRel(("UIMediumEnumerator:  Items included into usage: %s\n", includedList.join(", ").toAscii().constData()));
+    /* Determine excluded mediums: */
+    const QSet<QString> previousSet = previousUIMediumIDs.toSet();
+    const QSet<QString> currentSet = currentCMediumIDs.toSet();
+    const QSet<QString> excludedSet = previousSet - currentSet;
+    const QStringList excludedUIMediumIDs = excludedSet.toList();
+    if (!excludedUIMediumIDs.isEmpty())
+        LogRel(("UIMediumEnumerator:  Items excluded from usage: %s\n", excludedUIMediumIDs.join(", ").toAscii().constData()));
+    if (!currentCMediumIDs.isEmpty())
+        LogRel(("UIMediumEnumerator:  Items currently in usage: %s\n", currentCMediumIDs.join(", ").toAscii().constData()));
 
     /* Update cache for excluded UIMediums: */
-    recacheFromCachedUsage(excludedList);
+    recacheFromCachedUsage(excludedUIMediumIDs);
 
-    /* Update cache for included CMediums: */
-    recacheFromActualUsage(currentCMediums, includedList);
+    /* Update cache for current CMediums: */
+    recacheFromActualUsage(currentCMediums, currentCMediumIDs);
 
     LogRel(("UIMediumEnumerator: Machine (or snapshot) event processed, ID = %s\n",
             strMachineID.toAscii().constData()));
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
index 072fd26..483cbf5 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h
@@ -1,3 +1,4 @@
+/* $Id: UIMediumEnumerator.h $ */
 /** @file
  * VBox Qt GUI - UIMediumEnumerator class declaration.
  */
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
index 6f0eb09..6103e8e 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMediumManager.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMediumManager class implementation
+ * VBox Qt GUI - UIMediumManager class implementation.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,33 +16,37 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QLabel>
-#include <QProgressBar>
-#include <QMenuBar>
-#include <QHeaderView>
-#include <QPushButton>
-#include <QTimer>
+# include <QFrame>
+# include <QLabel>
+# include <QMenuBar>
+# include <QHeaderView>
+# include <QPushButton>
+# include <QProgressBar>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMediumManager.h"
-#include "UIWizardCloneVD.h"
-#include "UIMessageCenter.h"
-#include "UIToolBar.h"
-#include "QILabel.h"
-#include "UIIconPool.h"
-#include "UIMediumTypeChangeDialog.h"
-#include "UIMedium.h"
+# include "VBoxGlobal.h"
+# include "UIMediumManager.h"
+# include "UIWizardCloneVD.h"
+# include "UIMessageCenter.h"
+# include "QITabWidget.h"
+# include "QITreeWidget.h"
+# include "QILabel.h"
+# include "QIDialogButtonBox.h"
+# include "UIToolBar.h"
+# include "UIIconPool.h"
+# include "UIMediumTypeChangeDialog.h"
+# include "UIMedium.h"
 
 /* COM includes: */
-#include "COMEnums.h"
-#include "CMediumFormat.h"
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
+# include "COMEnums.h"
+# include "CMachine.h"
+# include "CMediumFormat.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
 
 # ifdef Q_WS_MAC
 #  include "UIWindowMenuManager.h"
@@ -53,69 +55,104 @@
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 
-/* Medium-item: */
+/** QTreeWidgetItem extension representing Medium Manager item. */
 class UIMediumItem : public QTreeWidgetItem
 {
 public:
 
-    /* Medium-item type: */
+    /** UIMediumItem type for rtti needs. */
     enum { Type = QTreeWidgetItem::UserType + 1 };
 
-    /* Constructor: Top-level item: */
+    /** Constructor for top-level item. */
     UIMediumItem(const UIMedium &medium, QTreeWidget *pParent)
         : QTreeWidgetItem(pParent, Type)
         , m_medium(medium)
     { refresh(); }
 
-    /* Constructor: Child item: */
+    /** Constructor for child item. */
     UIMediumItem(const UIMedium &medium, UIMediumItem *pParent)
         : QTreeWidgetItem(pParent, Type)
         , m_medium(medium)
     { refresh(); }
 
-    /* API: Refresh stuff: */
+    /** Copy UIMedium wrapped by <i>this</i> item. */
+    virtual bool copy() = 0;
+    /** Modify UIMedium wrapped by <i>this</i> item. */
+    virtual bool modify() = 0;
+    /** Remove UIMedium wrapped by <i>this</i> item. */
+    virtual bool remove() = 0;
+    /** Release UIMedium wrapped by <i>this</i> item. */
+    virtual bool release()
+    {
+        /* Refresh: */
+        refreshAll();
+
+        /* Make sure medium was not released yet: */
+        if (medium().curStateMachineIds().isEmpty())
+            return true;
+
+        /* Confirm release: */
+        if (!msgCenter().confirmMediumRelease(medium(), treeWidget()))
+            return false;
+
+        /* Release: */
+        foreach (const QString &strMachineID, medium().curStateMachineIds())
+            if (!releaseFrom(strMachineID))
+                return false;
+
+        /* True by default: */
+        return true;
+    }
+
+    /** Refresh item fully. */
     void refreshAll()
     {
         m_medium.refresh();
         refresh();
     }
 
-    /* API: Medium stuff: */
+    /** Returns UIMedium wrapped by <i>this</i> item. */
     const UIMedium& medium() const { return m_medium; }
+    /** Defines UIMedium wrapped by <i>this</i> item. */
     void setMedium(const UIMedium &medium)
     {
         m_medium = medium;
         refresh();
     }
 
-    /* API: Medium-type stuff: */
+    /** Returns UIMediumType of the wrapped UIMedium. */
     UIMediumType mediumType() const { return m_medium.type(); }
 
-    /* API: State stuff: */
+    /** Returns KMediumState of the wrapped UIMedium. */
     KMediumState state() const { return m_medium.state(); }
 
-    /* API: ID stuff: */
+    /** Returns QString <i>ID</i> of the wrapped UIMedium. */
     QString id() const { return m_medium.id(); }
 
-    /* API: Location stuff: */
+    /** Returns QString <i>location</i> of the wrapped UIMedium. */
     QString location() const { return m_medium.location(); }
 
-    /* API: Hard-disk stuff: */
+    /** Returns QString <i>hard-disk format</i> of the wrapped UIMedium. */
     QString hardDiskFormat() const { return m_medium.hardDiskFormat(); }
+    /** Returns QString <i>hard-disk type</i> of the wrapped UIMedium. */
     QString hardDiskType() const { return m_medium.hardDiskType(); }
 
-    /* API: Details stuff: */
+    /** Returns QString <i>storage details</i> of the wrapped UIMedium. */
     QString details() const { return m_medium.storageDetails(); }
+    /** Returns QString <i>encryption password ID</i> of the wrapped UIMedium. */
+    QString encryptionPasswordID() const { return m_medium.encryptionPasswordID(); }
 
-    /* API: Tool-tip stuff: */
+    /** Returns QString <i>tool-tip</i> of the wrapped UIMedium. */
     QString toolTip() const { return m_medium.toolTip(); }
 
-    /* API: Usage stuff: */
+    /** Returns QString <i>usage</i> of the wrapped UIMedium. */
     QString usage() const { return m_medium.usage(); }
+    /** Returns whether wrapped UIMedium is used or not. */
     bool isUsed() const { return m_medium.isUsed(); }
+    /** Returns whether wrapped UIMedium is used in snapshots or not. */
     bool isUsedInSnapshots() const { return m_medium.isUsedInSnapshots(); }
 
-    /* API: Sorting stuff: */
+    /** Operator< reimplementation used for sorting purposes. */
     bool operator<(const QTreeWidgetItem &other) const
     {
         int column = treeWidget()->sortColumn();
@@ -124,9 +161,14 @@ public:
         return thisValue && thatValue ? thisValue < thatValue : QTreeWidgetItem::operator<(other);
     }
 
+protected:
+
+    /** Release UIMedium wrapped by <i>this</i> item from virtual @a machine. */
+    virtual bool releaseFrom(CMachine machine) = 0;
+
 private:
 
-    /* Helper: Refresh stuff: */
+    /** Refresh item information such as icon, text and tool-tip. */
     void refresh()
     {
         /* Fill-in columns: */
@@ -140,22 +182,396 @@ private:
             setToolTip(i, strToolTip);
     }
 
-    /* Variables: */
+    /** Release UIMedium wrapped by <i>this</i> item from virtual machine with @a strMachineID. */
+    bool releaseFrom(const QString &strMachineID)
+    {
+        /* Open session: */
+        CSession session = vboxGlobal().openSession(strMachineID);
+        if (session.isNull())
+            return false;
+
+        /* Get machine: */
+        CMachine machine = session.GetMachine();
+
+        /* Prepare result: */
+        bool fSuccess = false;
+
+        /* Release medium from machine: */
+        if (releaseFrom(machine))
+        {
+            /* Save machine settings: */
+            machine.SaveSettings();
+            if (!machine.isOk())
+                msgCenter().cannotSaveMachineSettings(machine, treeWidget());
+            else
+                fSuccess = true;
+        }
+
+        /* Close session: */
+        session.UnlockMachine();
+
+        /* Return result: */
+        return fSuccess;
+    }
+
+    /** UIMedium wrapped by <i>this</i> item. */
     UIMedium m_medium;
 };
 
 
-/** Functor allowing to check if passed UIMediumItem is suitable by ID. */
+/** UIMediumItem extension representing hard-disk item. */
+class UIMediumItemHD : public UIMediumItem
+{
+public:
+
+    /** Constructor for top-level item. */
+    UIMediumItemHD(const UIMedium &medium, QTreeWidget *pParent)
+        : UIMediumItem(medium, pParent)
+    {}
+
+    /** Constructor for child item. */
+    UIMediumItemHD(const UIMedium &medium, UIMediumItem *pParent)
+        : UIMediumItem(medium, pParent)
+    {}
+
+protected:
+
+    /** Copy UIMedium wrapped by <i>this</i> item. */
+    bool copy()
+    {
+        /* Show Clone VD wizard: */
+        UISafePointerWizard pWizard = new UIWizardCloneVD(treeWidget(), medium().medium());
+        pWizard->prepare();
+        pWizard->exec();
+
+        /* Delete if still exists: */
+        if (pWizard)
+            delete pWizard;
+
+        /* True by default: */
+        return true;
+    }
+
+    /** Modify UIMedium wrapped by <i>this</i> item. */
+    bool modify()
+    {
+        /* False by default: */
+        bool fResult = false;
+
+        /* Show Modify VD dialog: */
+        UISafePointerDialog pDialog = new UIMediumTypeChangeDialog(treeWidget(), id());
+        if (pDialog->exec() == QDialog::Accepted)
+        {
+            /* Update medium-item: */
+            refreshAll();
+            /* Change to passed: */
+            fResult = true;
+        }
+
+        /* Delete if still exists: */
+        if (pDialog)
+            delete pDialog;
+
+        /* Return result: */
+        return fResult;
+    }
+
+    /** Remove UIMedium wrapped by <i>this</i> item. */
+    bool remove()
+    {
+        /* Confirm medium removal: */
+        if (!msgCenter().confirmMediumRemoval(medium(), treeWidget()))
+            return false;
+
+        /* Remember some of hard-disk attributes: */
+        CMedium hardDisk = medium().medium();
+        QString strMediumID = id();
+
+        /* Propose to remove medium storage: */
+        if (!maybeRemoveStorage())
+            return false;
+
+        /* Close hard-disk: */
+        hardDisk.Close();
+        if (!hardDisk.isOk())
+        {
+            msgCenter().cannotCloseMedium(medium(), hardDisk, treeWidget());
+            return false;
+        }
+
+        /* Remove UIMedium finally: */
+        vboxGlobal().deleteMedium(strMediumID);
+
+        /* True by default: */
+        return true;
+    }
+
+    /** Release UIMedium wrapped by <i>this</i> item from virtual @a machine. */
+    bool releaseFrom(CMachine machine)
+    {
+        /* Enumerate attachments: */
+        CMediumAttachmentVector attachments = machine.GetMediumAttachments();
+        foreach (const CMediumAttachment &attachment, attachments)
+        {
+            /* Skip non-hard-disks: */
+            if (attachment.GetType() != KDeviceType_HardDisk)
+                continue;
+
+            /* Skip unrelated hard-disks: */
+            if (attachment.GetMedium().GetId() != id())
+                continue;
+
+            /* Remember controller: */
+            CStorageController controller = machine.GetStorageControllerByName(attachment.GetController());
+
+            /* Try to detach device: */
+            machine.DetachDevice(attachment.GetController(), attachment.GetPort(), attachment.GetDevice());
+            if (!machine.isOk())
+            {
+                /* Return failure: */
+                msgCenter().cannotDetachDevice(machine, UIMediumType_HardDisk, location(),
+                                               StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()),
+                                               treeWidget());
+                return false;
+            }
+
+            /* Return success: */
+            return true;
+        }
+
+        /* False by default: */
+        return false;
+    }
+
+private:
+
+    /** Proposes user to remove CMedium storage wrapped by <i>this</i> item. */
+    bool maybeRemoveStorage()
+    {
+        /* Remember some of hard-disk attributes: */
+        CMedium hardDisk = medium().medium();
+        QString strLocation = location();
+
+        /* We don't want to try to delete inaccessible storage as it will most likely fail.
+         * Note that UIMessageCenter::confirmMediumRemoval() is aware of that and
+         * will give a corresponding hint. Therefore, once the code is changed below,
+         * the hint should be re-checked for validity. */
+        bool fDeleteStorage = false;
+        qulonglong uCapability = 0;
+        QVector<KMediumFormatCapabilities> capabilities = hardDisk.GetMediumFormat().GetCapabilities();
+        foreach (KMediumFormatCapabilities capability, capabilities)
+            uCapability |= capability;
+        if (state() != KMediumState_Inaccessible && uCapability & KMediumFormatCapabilities_File)
+        {
+            int rc = msgCenter().confirmDeleteHardDiskStorage(strLocation, treeWidget());
+            if (rc == AlertButton_Cancel)
+                return false;
+            fDeleteStorage = rc == AlertButton_Choice1;
+        }
+
+        /* If user wish to delete storage: */
+        if (fDeleteStorage)
+        {
+            /* Prepare delete storage progress: */
+            CProgress progress = hardDisk.DeleteStorage();
+            if (!hardDisk.isOk())
+            {
+                msgCenter().cannotDeleteHardDiskStorage(hardDisk, strLocation, treeWidget());
+                return false;
+            }
+            /* Show delete storage progress: */
+            msgCenter().showModalProgressDialog(progress, UIMediumManager::tr("Removing medium..."),
+                                                ":/progress_media_delete_90px.png", treeWidget());
+            if (!progress.isOk() || progress.GetResultCode() != 0)
+            {
+                msgCenter().cannotDeleteHardDiskStorage(progress, strLocation, treeWidget());
+                return false;
+            }
+        }
+
+        /* True by default: */
+        return true;
+    }
+};
+
+/** UIMediumItem extension representing optical-disk item. */
+class UIMediumItemCD : public UIMediumItem
+{
+public:
+
+    /** Constructor for top-level item. */
+    UIMediumItemCD(const UIMedium &medium, QTreeWidget *pParent)
+        : UIMediumItem(medium, pParent)
+    {}
+
+protected:
+
+    /** Copy UIMedium wrapped by <i>this</i> item. */
+    bool copy()
+    {
+        AssertMsgFailedReturn(("That functionality in not supported!\n"), false);
+    }
+
+    /** Modify UIMedium wrapped by <i>this</i> item. */
+    bool modify()
+    {
+        AssertMsgFailedReturn(("That functionality in not supported!\n"), false);
+    }
+
+    /** Remove UIMedium wrapped by <i>this</i> item. */
+    bool remove()
+    {
+        /* Confirm medium removal: */
+        if (!msgCenter().confirmMediumRemoval(medium(), treeWidget()))
+            return false;
+
+        /* Remember some of optical-disk attributes: */
+        CMedium image = medium().medium();
+        QString strMediumID = id();
+
+        /* Close optical-disk: */
+        image.Close();
+        if (!image.isOk())
+        {
+            msgCenter().cannotCloseMedium(medium(), image, treeWidget());
+            return false;
+        }
+
+        /* Remove UIMedium finally: */
+        vboxGlobal().deleteMedium(strMediumID);
+
+        /* True by default: */
+        return true;
+    }
+
+    /** Release UIMedium wrapped by <i>this</i> item from virtual @a machine. */
+    bool releaseFrom(CMachine machine)
+    {
+        /* Enumerate attachments: */
+        CMediumAttachmentVector attachments = machine.GetMediumAttachments();
+        foreach (const CMediumAttachment &attachment, attachments)
+        {
+            /* Skip non-optical-disks: */
+            if (attachment.GetType() != KDeviceType_DVD)
+                continue;
+
+            /* Skip unrelated optical-disks: */
+            if (attachment.GetMedium().GetId() != id())
+                continue;
+
+            /* Try to unmount device: */
+            machine.MountMedium(attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), CMedium(), false /* force */);
+            if (!machine.isOk())
+            {
+                /* Return failure: */
+                msgCenter().cannotRemountMedium(machine, medium(), false /* mount? */, false /* retry? */, treeWidget());
+                return false;
+            }
+
+            /* Return success: */
+            return true;
+        }
+
+        /* Return failure: */
+        return false;
+    }
+};
+
+/** UIMediumItem extension representing floppy-disk item. */
+class UIMediumItemFD : public UIMediumItem
+{
+public:
+
+    /** Constructor for top-level item. */
+    UIMediumItemFD(const UIMedium &medium, QTreeWidget *pParent)
+        : UIMediumItem(medium, pParent)
+    {}
+
+protected:
+
+    /** Copy UIMedium wrapped by <i>this</i> item. */
+    bool copy()
+    {
+        AssertMsgFailedReturn(("That functionality in not supported!\n"), false);
+    }
+
+    /** Modify UIMedium wrapped by <i>this</i> item. */
+    bool modify()
+    {
+        AssertMsgFailedReturn(("That functionality in not supported!\n"), false);
+    }
+
+    /** Remove UIMedium wrapped by <i>this</i> item. */
+    bool remove()
+    {
+        /* Confirm medium removal: */
+        if (!msgCenter().confirmMediumRemoval(medium(), treeWidget()))
+            return false;
+
+        /* Remember some of floppy-disk attributes: */
+        CMedium image = medium().medium();
+        QString strMediumID = id();
+
+        /* Close floppy-disk: */
+        image.Close();
+        if (!image.isOk())
+        {
+            msgCenter().cannotCloseMedium(medium(), image, treeWidget());
+            return false;
+        }
+
+        /* Remove UIMedium finally: */
+        vboxGlobal().deleteMedium(strMediumID);
+
+        /* True by default: */
+        return true;
+    }
+
+    /** Release UIMedium wrapped by <i>this</i> item from virtual @a machine. */
+    bool releaseFrom(CMachine machine)
+    {
+        /* Enumerate attachments: */
+        CMediumAttachmentVector attachments = machine.GetMediumAttachments();
+        foreach (const CMediumAttachment &attachment, attachments)
+        {
+            /* Skip non-floppy-disks: */
+            if (attachment.GetType() != KDeviceType_Floppy)
+                continue;
+
+            /* Skip unrelated floppy-disks: */
+            if (attachment.GetMedium().GetId() != id())
+                continue;
+
+            /* Try to unmount device: */
+            machine.MountMedium(attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), CMedium(), false /* force */);
+            if (!machine.isOk())
+            {
+                /* Return failure: */
+                msgCenter().cannotRemountMedium(machine, medium(), false /* mount? */, false /* retry? */, treeWidget());
+                return false;
+            }
+
+            /* Return success: */
+            return true;
+        }
+
+        /* Return failure: */
+        return false;
+    }
+};
+
+
+/** Functor allowing to check if passed UIMediumItem is suitable by @a strID. */
 class CheckIfSuitableByID : public CheckIfSuitableBy
 {
 public:
-    /** Constructor. */
+    /** Constructor accepting @a strID to compare with. */
     CheckIfSuitableByID(const QString &strID) : m_strID(strID) {}
 
 private:
-    /** Determines whether passed UIMediumItem is suitable by ID. */
+    /** Determines whether passed UIMediumItem is suitable by @a strID. */
     bool isItSuitable(UIMediumItem *pItem) const { return pItem->id() == m_strID; }
-    /** Holds the ID to compare to. */
+    /** Holds the @a strID to compare to. */
     QString m_strID;
 };
 
@@ -163,7 +579,7 @@ private:
 class CheckIfSuitableByState : public CheckIfSuitableBy
 {
 public:
-    /** Constructor. */
+    /** Constructor accepting @a state to compare with. */
     CheckIfSuitableByState(KMediumState state) : m_state(state) {}
 
 private:
@@ -174,32 +590,35 @@ private:
 };
 
 
-/* Medium manager progress-bar: */
+/** Medium manager progress-bar.
+  * Reflects medium-enumeration progress, stays hidden otherwise. */
 class UIEnumerationProgressBar : public QWidget
 {
     Q_OBJECT;
 
 public:
 
-    /* Constructor: */
-    UIEnumerationProgressBar(QWidget *pParent)
+    /** Constructor on the basis of passed @a pParent. */
+    UIEnumerationProgressBar(QWidget *pParent = 0)
         : QWidget(pParent)
     {
         /* Prepare: */
         prepare();
     }
 
-    /* API: Text stuff: */
-    void setText(const QString &strText) { mText->setText(strText); }
+    /** Defines progress-bar label-text. */
+    void setText(const QString &strText) { m_pLabel->setText(strText); }
 
-    /* API: Value stuff: */
+    /** Returns progress-bar current-value. */
     int value() const { return m_pProgressBar->value(); }
+    /** Defines progress-bar current-value. */
     void setValue(int iValue) { m_pProgressBar->setValue(iValue); }
+    /** Defines progress-bar maximum-value. */
     void setMaximum(int iValue) { m_pProgressBar->setMaximum(iValue); }
 
 private:
 
-    /* Helper: Prepare stuff: */
+    /** Prepares progress-bar content. */
     void prepare()
     {
         /* Create layout: */
@@ -208,7 +627,7 @@ private:
             /* Configure layout: */
             pLayout->setContentsMargins(0, 0, 0, 0);
             /* Create label: */
-            mText = new QLabel;
+            m_pLabel = new QLabel;
             /* Create progress-bar: */
             m_pProgressBar = new QProgressBar;
             {
@@ -216,13 +635,14 @@ private:
                 m_pProgressBar->setTextVisible(false);
             }
             /* Add widgets into layout: */
-            pLayout->addWidget(mText);
+            pLayout->addWidget(m_pLabel);
             pLayout->addWidget(m_pProgressBar);
         }
     }
 
-    /* Widgets: */
-    QLabel *mText;
+    /** Progress-bar label. */
+    QLabel *m_pLabel;
+    /** Progress-bar itself. */
     QProgressBar *m_pProgressBar;
 };
 
@@ -231,16 +651,27 @@ private:
 UIMediumManager* UIMediumManager::m_spInstance = 0;
 UIMediumManager* UIMediumManager::instance() { return m_spInstance; }
 
-UIMediumManager::UIMediumManager(QWidget *pCenterWidget, bool fRefresh /* = true*/)
-    : QIWithRetranslateUI2<QIMainDialog>(0, Qt::Dialog)
-    , m_pCenterWidget(pCenterWidget)
+UIMediumManager::UIMediumManager(QWidget *pCenterWidget, bool fRefresh /* = true */)
+    : QIWithRetranslateUI<QMainWindow>(0)
+    , m_pPseudoParentWidget(pCenterWidget)
     , m_fRefresh(fRefresh)
+    , m_fPreventChangeCurrentItem(false)
+    , m_pTabWidget(0)
+    , m_iTabCount(3)
     , m_fInaccessibleHD(false)
     , m_fInaccessibleCD(false)
     , m_fInaccessibleFD(false)
     , m_iconHD(UIIconPool::iconSet(":/hd_16px.png", ":/hd_disabled_16px.png"))
     , m_iconCD(UIIconPool::iconSet(":/cd_16px.png", ":/cd_disabled_16px.png"))
     , m_iconFD(UIIconPool::iconSet(":/fd_16px.png", ":/fd_disabled_16px.png"))
+    , m_pToolBar(0)
+    , m_pContextMenu(0)
+    , m_pMenu(0)
+    , m_pActionCopy(0), m_pActionModify(0)
+    , m_pActionRemove(0), m_pActionRelease(0)
+    , m_pActionRefresh(0)
+    , m_pButtonBox(0)
+    , m_pProgressBar(0)
 {
     /* Prepare: */
     prepare();
@@ -256,9 +687,9 @@ UIMediumManager::~UIMediumManager()
 }
 
 /* static */
-void UIMediumManager::showModeless(QWidget *pCenterWidget /* = 0*/, bool fRefresh /* = true*/)
+void UIMediumManager::showModeless(QWidget *pCenterWidget /* = 0 */, bool fRefresh /* = true */)
 {
-    /* Prepare instance if not prepared: */
+    /* Create instance if not yet created: */
     if (!m_spInstance)
         m_spInstance = new UIMediumManager(pCenterWidget, fRefresh);
 
@@ -268,18 +699,13 @@ void UIMediumManager::showModeless(QWidget *pCenterWidget /* = 0*/, bool fRefres
     m_spInstance->activateWindow();
 }
 
-void UIMediumManager::refreshAll()
-{
-    vboxGlobal().startMediumEnumeration();
-}
-
 void UIMediumManager::sltHandleMediumCreated(const QString &strMediumID)
 {
     /* Search for corresponding medium: */
     UIMedium medium = vboxGlobal().medium(strMediumID);
 
     /* Ignore non-interesting mediums: */
-    if ((medium.isNull()) || (medium.isHostDrive()))
+    if (medium.isNull() || medium.isHostDrive())
         return;
 
     /* Ignore mediums (and their children) which are
@@ -287,125 +713,61 @@ void UIMediumManager::sltHandleMediumCreated(const QString &strMediumID)
     if (UIMedium::isMediumAttachedToHiddenMachinesOnly(medium))
         return;
 
-    /* Prepare medium-item: */
-    UIMediumItem *pMediumItem = 0;
-    switch (medium.type())
-    {
-        case UIMediumType_HardDisk:
-        {
-            pMediumItem = createHardDiskItem(mTwHD, medium);
-            AssertReturnVoid(pMediumItem);
-            if (pMediumItem->id() == m_strSelectedIdHD)
-            {
-                setCurrentItem(mTwHD, pMediumItem);
-                m_strSelectedIdHD = QString();
-            }
-            break;
-        }
-        case UIMediumType_DVD:
-        {
-            pMediumItem = new UIMediumItem(medium, mTwCD);
-            AssertReturnVoid(pMediumItem);
-            if (pMediumItem->id() == m_strSelectedIdCD)
-            {
-                setCurrentItem(mTwCD, pMediumItem);
-                m_strSelectedIdCD = QString();
-            }
-            break;
-        }
-        case UIMediumType_Floppy:
-        {
-            pMediumItem = new UIMediumItem(medium, mTwFD);
-            AssertReturnVoid(pMediumItem);
-            if (pMediumItem->id() == m_strSelectedIdFD)
-            {
-                setCurrentItem(mTwFD, pMediumItem);
-                m_strSelectedIdFD = QString();
-            }
-            break;
-        }
-        default: AssertFailed();
-    }
-    AssertPtrReturnVoid(pMediumItem);
+    /* Create medium-item for corresponding medium: */
+    UIMediumItem *pMediumItem = createMediumItem(medium);
 
-    /* Update tab-icons: */
-    updateTabIcons(pMediumItem, ItemAction_Added);
+    /* Make sure medium-item was created: */
+    if (!pMediumItem)
+        return;
 
-    /* If the media enumeration process is not started we have to select the
-     * newly added item as the current one for the case of new image was added or created */
-    if (!vboxGlobal().isMediumEnumerationInProgress())
+    /* If medium-item change allowed and
+     * 1. medium-enumeration is not currently in progress or
+     * 2. if there is no currently medium-item selected
+     * we have to choose newly added medium-item as current one: */
+    if (   !m_fPreventChangeCurrentItem
+        && (   !vboxGlobal().isMediumEnumerationInProgress()
+            || !mediumItem(medium.type())))
         setCurrentItem(treeWidget(medium.type()), pMediumItem);
-
-    /* Update stuff if that was current-item added: */
-    if (pMediumItem == currentTreeWidget()->currentItem())
-        sltHandleCurrentItemChanged(pMediumItem);
 }
 
 void UIMediumManager::sltHandleMediumDeleted(const QString &strMediumID)
 {
-    /* Get tree/item: */
-    QList<UIMediumType> types;
-    types << UIMediumType_HardDisk << UIMediumType_DVD << UIMediumType_Floppy;
-    QTreeWidget *pTree = 0;
-    UIMediumItem *pMediumItem = 0;
-    foreach (UIMediumType type, types)
-    {
-        pTree = treeWidget(type);
-        pMediumItem = searchItem(pTree, CheckIfSuitableByID(strMediumID));
-        if (pMediumItem)
-            break;
-    }
-    if (!pMediumItem)
-        return;
-
-    /* Update tab-icons: */
-    updateTabIcons(pMediumItem, ItemAction_Removed);
-
-    /* We need to silently delete item without selecting
-     * the new one because of complex selection mechanism
-     * which could provoke a segfault choosing the new
-     * one item during last item deletion routine. So blocking
-     * the tree-view for the time of item removing. */
-    pTree->blockSignals(true);
-    delete pMediumItem;
-    pTree->blockSignals(false);
-
-    /* Set new current-item: */
-    setCurrentItem(pTree, pTree->currentItem());
+    /* Make sure corresponding medium-item deleted: */
+    deleteMediumItem(strMediumID);
 }
 
 void UIMediumManager::sltHandleMediumEnumerationStart()
 {
+    /* Disable 'refresh' action: */
+    if (m_pActionRefresh)
+        m_pActionRefresh->setEnabled(false);
+
+    /* Reset and show progress-bar: */
+    if (m_pProgressBar)
+    {
+        m_pProgressBar->setMaximum(vboxGlobal().mediumIDs().size());
+        m_pProgressBar->setValue(0);
+        m_pProgressBar->show();
+    }
+
     /* Reset inaccessibility flags: */
     m_fInaccessibleHD =
         m_fInaccessibleCD =
             m_fInaccessibleFD = false;
 
-    /* Load default tab-widget icons: */
-    mTabWidget->setTabIcon(HDTab, m_iconHD);
-    mTabWidget->setTabIcon(CDTab, m_iconCD);
-    mTabWidget->setTabIcon(FDTab, m_iconFD);
-
-    /* Repopulate all medium-items: */
-    QList<QString> mediumIDs = vboxGlobal().mediumIDs();
-    prepareToRefresh(mediumIDs.size());
-    foreach (const QString &strMediumID, mediumIDs)
-        sltHandleMediumCreated(strMediumID);
+    /* Reset tab-widget icons: */
+    if (m_pTabWidget)
+    {
+        m_pTabWidget->setTabIcon(tabIndex(UIMediumType_HardDisk), m_iconHD);
+        m_pTabWidget->setTabIcon(tabIndex(UIMediumType_DVD), m_iconCD);
+        m_pTabWidget->setTabIcon(tabIndex(UIMediumType_Floppy), m_iconFD);
+    }
 
-    /* Select the first item to be the current one
-     * if the previous saved item was not selected yet. */
-    if (!mTwHD->currentItem())
-        if (QTreeWidgetItem *pItem = mTwHD->topLevelItem(0))
-            setCurrentItem(mTwHD, pItem);
-    if (!mTwCD->currentItem())
-        if (QTreeWidgetItem *pItem = mTwCD->topLevelItem(0))
-            setCurrentItem(mTwCD, pItem);
-    if (!mTwFD->currentItem())
-        if (QTreeWidgetItem *pItem = mTwFD->topLevelItem(0))
-            setCurrentItem(mTwFD, pItem);
+    /* Repopulate tree-widgets content: */
+    repopulateTreeWidgets();
 
-    /* Update current tab: */
-    sltHandleCurrentTabChanged();
+    /* Re-fetch all current medium-items: */
+    refetchCurrentMediumItems();
 }
 
 void UIMediumManager::sltHandleMediumEnumerated(const QString &strMediumID)
@@ -414,7 +776,7 @@ void UIMediumManager::sltHandleMediumEnumerated(const QString &strMediumID)
     UIMedium medium = vboxGlobal().medium(strMediumID);
 
     /* Ignore non-interesting mediums: */
-    if ((medium.isNull()) || (medium.isHostDrive()))
+    if (medium.isNull() || medium.isHostDrive())
         return;
 
     /* Ignore mediums (and their children) which are
@@ -422,358 +784,166 @@ void UIMediumManager::sltHandleMediumEnumerated(const QString &strMediumID)
     if (UIMedium::isMediumAttachedToHiddenMachinesOnly(medium))
         return;
 
-    /* Search for corresponding medium-item: */
-    UIMediumItem *pMediumItem = 0;
-    switch (medium.type())
-    {
-        case UIMediumType_HardDisk: pMediumItem = searchItem(mTwHD, CheckIfSuitableByID(medium.id())); break;
-        case UIMediumType_DVD:      pMediumItem = searchItem(mTwCD, CheckIfSuitableByID(medium.id())); break;
-        case UIMediumType_Floppy:   pMediumItem = searchItem(mTwFD, CheckIfSuitableByID(medium.id())); break;
-        default: AssertFailed();
-    }
-
-    /* If medium-item was not found it's time to create it: */
-    if (!pMediumItem)
-        return sltHandleMediumCreated(strMediumID);
-
-    /* Update medium-item: */
-    pMediumItem->setMedium(medium);
-
-    /* Update tab-icons: */
-    updateTabIcons(pMediumItem, ItemAction_Updated);
-
-    /* Update stuff if that was current-item updated: */
-    if (pMediumItem == currentTreeWidget()->currentItem())
-        sltHandleCurrentItemChanged(pMediumItem);
+    /* Update medium-item for corresponding medium: */
+    updateMediumItem(medium);
 
     /* Advance progress-bar: */
-    m_pProgressBar->setValue(m_pProgressBar->value() + 1);
+    if (m_pProgressBar)
+        m_pProgressBar->setValue(m_pProgressBar->value() + 1);
 }
 
 void UIMediumManager::sltHandleMediumEnumerationFinish()
 {
     /* Hide progress-bar: */
-    m_pProgressBar->hide();
+    if (m_pProgressBar)
+        m_pProgressBar->hide();
 
     /* Enable 'refresh' action: */
-    m_pActionRefresh->setEnabled(true);
+    if (m_pActionRefresh)
+        m_pActionRefresh->setEnabled(true);
 
-    /* Unset 'busy' cursor: */
-    unsetCursor();
-
-    /* Update current tab: */
-    sltHandleCurrentTabChanged();
+    /* Re-fetch all current medium-items: */
+    refetchCurrentMediumItems();
 }
 
 void UIMediumManager::sltCopyMedium()
 {
-    /* Get current-item: */
-    UIMediumItem *pMediumItem = toMediumItem(currentTreeWidget()->currentItem());
-
-    /* Show Clone VD wizard: */
-    UISafePointerWizard pWizard = new UIWizardCloneVD(this, pMediumItem->medium().medium());
-    pWizard->prepare();
-    pWizard->exec();
+    /* Get current medium-item: */
+    UIMediumItem *pMediumItem = currentMediumItem();
+    AssertMsgReturnVoid(pMediumItem, ("Current item must not be null"));
+    AssertReturnVoid(!pMediumItem->id().isNull());
 
-    /* Delete if still exists: */
-    if (pWizard)
-        delete pWizard;
+    /* Copy current medium-item: */
+    pMediumItem->copy();
 }
 
 void UIMediumManager::sltModifyMedium()
 {
-    /* Get current-item: */
-    UIMediumItem *pMediumItem = toMediumItem(currentTreeWidget()->currentItem());
+    /* Get current medium-item: */
+    UIMediumItem *pMediumItem = currentMediumItem();
+    AssertMsgReturnVoid(pMediumItem, ("Current item must not be null"));
+    AssertReturnVoid(!pMediumItem->id().isNull());
 
-    /* Show Modify VD dialog: */
-    UISafePointerDialog pDialog = new UIMediumTypeChangeDialog(this, pMediumItem->id());
-    if (pDialog->exec() == QDialog::Accepted)
-    {
-        /* Safe spot because if dialog is deleted inside ::exec() =>
-         * returned result will be QDialog::Rejected. */
-        pMediumItem->refreshAll();
-        m_pTypePane->setText(pMediumItem->hardDiskType());
-    }
+    /* Modify current medium-item: */
+    bool fResult = pMediumItem->modify();
 
-    /* Delete if still exists: */
-    if (pDialog)
-        delete pDialog;
+    /* Update HD information-panes: */
+    if (fResult)
+        updateInformationFieldsHD();
 }
 
 void UIMediumManager::sltRemoveMedium()
 {
     /* Get current medium-item: */
-    UIMediumItem *pMediumItem = toMediumItem(currentTreeWidget()->currentItem());
+    UIMediumItem *pMediumItem = currentMediumItem();
     AssertMsgReturnVoid(pMediumItem, ("Current item must not be null"));
+    AssertReturnVoid(!pMediumItem->id().isNull());
 
-    /* Remember ID/type as they may get lost after the closure/deletion: */
-    QString strMediumID = pMediumItem->id();
-    AssertReturnVoid(!strMediumID.isNull());
-    UIMediumType type = pMediumItem->mediumType();
+    /* Remove current medium-item: */
+    pMediumItem->remove();
+}
 
-    /* Confirm medium removal: */
-    if (!msgCenter().confirmMediumRemoval(pMediumItem->medium(), this))
-        return;
+void UIMediumManager::sltReleaseMedium()
+{
+    /* Get current medium-item: */
+    UIMediumItem *pMediumItem = currentMediumItem();
+    AssertMsgReturnVoid(pMediumItem, ("Current item must not be null"));
+    AssertReturnVoid(!pMediumItem->id().isNull());
 
-    /* Prepare result: */
-    COMResult result;
-    switch (type)
-    {
-        case UIMediumType_HardDisk:
-        {
-            /* We don't want to try to delete inaccessible storage as it will most likely fail.
-             * Note that UIMessageCenter::confirmMediumRemoval() is aware of that and
-             * will give a corresponding hint. Therefore, once the code is changed below,
-             * the hint should be re-checked for validity. */
-            bool fDeleteStorage = false;
-            qulonglong uCapability = 0;
-            QVector<KMediumFormatCapabilities> capabilities = pMediumItem->medium().medium().GetMediumFormat().GetCapabilities();
-            foreach (KMediumFormatCapabilities capability, capabilities)
-                uCapability |= capability;
-            if (pMediumItem->state() != KMediumState_Inaccessible &&
-                uCapability & MediumFormatCapabilities_File)
-            {
-                int rc = msgCenter().confirmDeleteHardDiskStorage(pMediumItem->location(), this);
-                if (rc == AlertButton_Cancel)
-                    return;
-                fDeleteStorage = rc == AlertButton_Choice1;
-            }
-
-            /* Get hard-disk: */
-            CMedium hardDisk = pMediumItem->medium().medium();
-
-            if (fDeleteStorage)
-            {
-                /* Remember hard-disk attributes: */
-                QString strLocation = hardDisk.GetLocation();
-                /* Prepare delete storage progress: */
-                CProgress progress = hardDisk.DeleteStorage();
-                if (hardDisk.isOk())
-                {
-                    /* Show delete storage progress: */
-                    msgCenter().showModalProgressDialog(progress, windowTitle(), ":/progress_media_delete_90px.png", this);
-                    if (!progress.isOk() || progress.GetResultCode() != 0)
-                    {
-                        msgCenter().cannotDeleteHardDiskStorage(progress, strLocation, this);
-                        return;
-                    }
-                }
-                else
-                {
-                    msgCenter().cannotDeleteHardDiskStorage(hardDisk, strLocation, this);
-                    return;
-                }
-            }
-
-            /* Close hard-disk: */
-            hardDisk.Close();
-            result = hardDisk;
-            break;
-        }
-        case UIMediumType_DVD:
-        {
-            /* Get optical-disk: */
-            CMedium image = pMediumItem->medium().medium();
-            /* Close optical-disk: */
-            image.Close();
-            result = image;
-            break;
-        }
-        case UIMediumType_Floppy:
-        {
-            /* Get floppy-disk: */
-            CMedium image = pMediumItem->medium().medium();
-            /* Close floppy-disk: */
-            image.Close();
-            result = image;
-            break;
-        }
-        default: AssertFailedReturnVoid();
-    }
+    /* Remove current medium-item: */
+    bool fResult = pMediumItem->release();
 
-    /* Verify result: */
-    if (result.isOk())
-        vboxGlobal().deleteMedium(strMediumID);
-    else
-        msgCenter().cannotCloseMedium(pMediumItem->medium(), result, this);
+    /* Refetch currently chosen medium-item: */
+    if (fResult)
+        refetchCurrentChosenMediumItem();
 }
 
-void UIMediumManager::sltReleaseMedium()
+void UIMediumManager::sltRefreshAll()
 {
-    /* Get current medium-item: */
-    UIMediumItem *pMediumItem = toMediumItem(currentTreeWidget()->currentItem());
-    AssertMsgReturnVoid(pMediumItem, ("Current item must not be null"));
-    AssertReturnVoid(!pMediumItem->id().isNull());
-
-    /* Refresh attached VM id list: */
-    pMediumItem->refreshAll();
-    const QList<QString> machineIds(pMediumItem->medium().curStateMachineIds());
-    /* If the machine id list is empty: */
-    if (machineIds.isEmpty())
-    {
-        /* This may happen if medium was already released by a third party,
-         * update the details and silently return. */
-        sltHandleCurrentItemChanged(pMediumItem);
-        return;
-    }
-
-    /* Gather usage list: */
-    QStringList usage;
-    foreach (const QString &strMachineId, machineIds)
-    {
-        CMachine machine = m_vbox.FindMachine(strMachineId);
-        if (!m_vbox.isOk())
-            continue;
-        usage << machine.GetName();
-    }
-    AssertReturnVoid(!usage.isEmpty());
-
-    /* Confirm release: */
-    if (!msgCenter().confirmMediumRelease(pMediumItem->medium(), usage.join(", "), this))
-        return;
-
-    /* Release: */
-    foreach (const QString &strMachineId, machineIds)
-        if (!releaseMediumFrom(pMediumItem->medium(), strMachineId))
-            break;
+    /* Start medium-enumeration: */
+    vboxGlobal().startMediumEnumeration();
 }
 
 void UIMediumManager::sltHandleCurrentTabChanged()
 {
-    /* Get current-tree: */
-    QTreeWidget *pTree = currentTreeWidget();
+    /* Get current tree-widget: */
+    QTreeWidget *pTreeWidget = currentTreeWidget();
+    if (pTreeWidget)
+    {
+        /* If another tree-widget was focused before,
+         * move focus to current tree-widget: */
+        if (qobject_cast<QTreeWidget*>(focusWidget()))
+            pTreeWidget->setFocus();
+    }
 
-    /* If other tree was focused previously, moving focus to new tree: */
-    if (qobject_cast<QTreeWidget*>(focusWidget()))
-        pTree->setFocus();
+    /* Update action icons: */
+    updateActionIcons();
 
-    /* Update current tree-item: */
-    sltHandleCurrentItemChanged(pTree->currentItem());
+    /* Re-fetch currently chosen medium-item: */
+    refetchCurrentChosenMediumItem();
 }
 
-void UIMediumManager::sltHandleCurrentItemChanged(QTreeWidgetItem *pItem,
-                                                  QTreeWidgetItem *pPrevItem /* = 0 */)
+void UIMediumManager::sltHandleCurrentItemChanged()
 {
-    /* Get medium-item: */
-    UIMediumItem *pMediumItem = toMediumItem(pItem);
-
-    /* We have to make sure some item is always selected: */
-    if (!pMediumItem && pPrevItem)
-    {
-        /* If the new item is 0, set the old item again. */
-        UIMediumItem *pPrevMediumItem = toMediumItem(pPrevItem);
-        setCurrentItem(currentTreeWidget(), pPrevMediumItem);
-    }
-
-    if (pMediumItem)
-    {
-        /* Set the file for the proxy icon: */
-        setFileForProxyIcon(pMediumItem->location());
-        /* Ensures current item visible every time we are switching page: */
-        pMediumItem->treeWidget()->scrollToItem(pMediumItem, QAbstractItemView::EnsureVisible);
-    }
-
-    /* Update action availability: */
-    bool fNotInEnumeration = !vboxGlobal().isMediumEnumerationInProgress();
-    bool fActionEnabledCopy    = currentTreeWidgetType() == UIMediumType_HardDisk &&
-                                 fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Copy);
-    bool fActionEnabledModify  = currentTreeWidgetType() == UIMediumType_HardDisk &&
-                                 fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Modify);
-    bool fActionEnabledRemove  = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Remove);
-    bool fActionEnabledRelease = pMediumItem && checkMediumFor(pMediumItem, Action_Release);
-    m_pActionCopy->setEnabled(fActionEnabledCopy);
-    m_pActionModify->setEnabled(fActionEnabledModify);
-    m_pActionRemove->setEnabled(fActionEnabledRemove);
-    m_pActionRelease->setEnabled(fActionEnabledRelease);
-
-    /* Update information-panes: */
-    if (pMediumItem)
-    {
-        QString strDetails = pMediumItem->details();
-        QString strUsage = pMediumItem->usage().isNull() ?
-                           formatPaneText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Attached</i>"), false) :
-                           formatPaneText(pMediumItem->usage());
-        if (pMediumItem->treeWidget() == mTwHD)
-        {
-            m_pTypePane->setText(pMediumItem->hardDiskType());
-            m_pLocationPane->setText(formatPaneText(pMediumItem->location(), true, "end"));
-            m_pFormatPane->setText(pMediumItem->hardDiskFormat());
-            m_pDetailsPane->setText(strDetails);
-            m_pUsagePane->setText(strUsage);
-        }
-        else if (pMediumItem->treeWidget() == mTwCD)
-        {
-            mIpCD1->setText(formatPaneText(pMediumItem->location(), true, "end"));
-            mIpCD2->setText(strUsage);
-        }
-        else if (pMediumItem->treeWidget() == mTwFD)
-        {
-            mIpFD1->setText(formatPaneText(pMediumItem->location(), true, "end"));
-            mIpFD2->setText(strUsage);
-        }
-    }
-    else
-        clearInfoPanes();
+    /* Get sender() tree-widget: */
+    QTreeWidget *pTreeWidget = qobject_cast<QTreeWidget*>(sender());
+    AssertMsgReturnVoid(pTreeWidget, ("This slot should be called by tree-widget only!\n"));
 
-    /* Enable/disable information-pane containers: */
-    mHDContainer->setEnabled(pMediumItem);
-    mCDContainer->setEnabled(pMediumItem);
-    mFDContainer->setEnabled(pMediumItem);
+    /* Re-fetch current medium-item of required type: */
+    refetchCurrentMediumItem(mediumType(pTreeWidget));
 }
 
 void UIMediumManager::sltHandleDoubleClick()
 {
-    /* Call for modify-action if hard-disk double-clicked: */
-    if (currentTreeWidgetType() == UIMediumType_HardDisk)
-        sltModifyMedium();
+    /* Skip for non-hard-drives: */
+    if (currentMediumType() != UIMediumType_HardDisk)
+        return;
+
+    /* Call for modify-action: */
+    sltModifyMedium();
 }
 
 void UIMediumManager::sltHandleContextMenuCall(const QPoint &position)
 {
-    /* Get surrent widget/item: */
-    QTreeWidget *pTree = currentTreeWidget();
-    QTreeWidgetItem *pItem = pTree->itemAt(position);
-    if (pItem)
-    {
-        /* Make sure the item is selected and current: */
-        setCurrentItem(pTree, pItem);
-        /* Show context menu: */
-        m_pContextMenu->exec(pTree->viewport()->mapToGlobal(position));
-    }
-}
+    /* Get current tree-widget: */
+    QTreeWidget *pTreeWidget = currentTreeWidget();
+    AssertPtrReturnVoid(pTreeWidget);
 
-void UIMediumManager::sltMakeRequestForTableAdjustment()
-{
-    /* We have to perform tables adjustment only after all the [auto]resize
-     * events processed for every column of corresponding table. */
-    QTimer::singleShot(0, this, SLOT(sltPerformTablesAdjustment()));
+    /* Make sure underlaying item was found: */
+    QTreeWidgetItem *pItem = pTreeWidget->itemAt(position);
+    if (!pItem)
+        return;
+
+    /* Make sure that item is current one: */
+    setCurrentItem(pTreeWidget, pItem);
+
+    /* Show item context menu: */
+    if (m_pContextMenu)
+        m_pContextMenu->exec(pTreeWidget->viewport()->mapToGlobal(position));
 }
 
 void UIMediumManager::sltPerformTablesAdjustment()
 {
     /* Get all the tree-widgets: */
-    QList<QITreeWidget*> trees;
-    trees << mTwHD;
-    trees << mTwCD;
-    trees << mTwFD;
+    const QList<QTreeWidget*> trees = m_trees.values();
 
     /* Calculate deduction for every header: */
     QList<int> deductions;
-    foreach (QITreeWidget *pTree, trees)
+    foreach (QTreeWidget *pTreeWidget, trees)
     {
         int iDeduction = 0;
-        for (int iHeaderIndex = 1; iHeaderIndex < pTree->header()->count(); ++iHeaderIndex)
-            iDeduction += pTree->header()->sectionSize(iHeaderIndex);
+        for (int iHeaderIndex = 1; iHeaderIndex < pTreeWidget->header()->count(); ++iHeaderIndex)
+            iDeduction += pTreeWidget->header()->sectionSize(iHeaderIndex);
         deductions << iDeduction;
     }
 
     /* Adjust the table's first column: */
     for (int iTreeIndex = 0; iTreeIndex < trees.size(); ++iTreeIndex)
     {
-        QITreeWidget *pTree = trees[iTreeIndex];
-        int iSize0 = pTree->viewport()->width() - deductions[iTreeIndex];
-        if (pTree->header()->sectionSize(0) != iSize0)
-            pTree->header()->resizeSection(0, iSize0);
+        QTreeWidget *pTreeWidget = trees[iTreeIndex];
+        int iSize0 = pTreeWidget->viewport()->width() - deductions[iTreeIndex];
+        if (pTreeWidget->header()->sectionSize(0) != iSize0)
+            pTreeWidget->header()->resizeSection(0, iSize0);
     }
 }
 
@@ -781,24 +951,6 @@ void UIMediumManager::prepare()
 {
     /* Prepare this: */
     prepareThis();
-    /* Prepare actions: */
-    prepareActions();
-    /* Prepare menu-bar: */
-    prepareMenuBar();
-    /* Prepare tool-bar: */
-    prepareToolBar();
-    /* Prepare context-menu: */
-    prepareContextMenu();
-    /* Prepare tab-widget: */
-    preapreTabWidget();
-    /* Prepare tree-widgets: */
-    prepareTreeWidgets();
-    /* Prepare information-panes: */
-    prepareInformationPanes();
-    /* Prepare button-box: */
-    prepareButtonBox();
-    /* Prepare progress-bar: */
-    prepareProgressBar();
 
     /* Translate dialog: */
     retranslateUi();
@@ -809,34 +961,52 @@ void UIMediumManager::prepare()
     prepareMacWindowMenu();
 #endif /* Q_WS_MAC */
 
-    /* Center according passed widget: */
-    centerAccording(m_pCenterWidget);
+    /* Center according pseudo-parent widget: */
+    VBoxGlobal::centerWidget(this, m_pPseudoParentWidget, false);
+
+    /* Initialize information-panes: */
+    updateInformationFields(UIMediumType_All);
+
+    /* Start medium-enumeration (if necessary): */
+    if (m_fRefresh && !vboxGlobal().isMediumEnumerationInProgress())
+        vboxGlobal().startMediumEnumeration();
+    /* Emulate medium-enumeration otherwise: */
+    else
+    {
+        /* Start medium-enumeration: */
+        sltHandleMediumEnumerationStart();
 
-    /* Populate content for tree-widgets: */
-    populateTreeWidgets();
+        /* Finish medium-enumeration (if necessary): */
+        if (!vboxGlobal().isMediumEnumerationInProgress())
+            sltHandleMediumEnumerationFinish();
+    }
 }
 
 void UIMediumManager::prepareThis()
 {
+    /* Initial size: */
+    resize(620, 460);
+
     /* Dialog should delete itself on 'close': */
     setAttribute(Qt::WA_DeleteOnClose);
-
     /* And no need to count it as important for application.
      * This way it will NOT be taken into account
      * when other top-level windows will be closed: */
     setAttribute(Qt::WA_QuitOnClose, false);
 
     /* Apply window icons: */
-    setWindowIcon(UIIconPool::iconSetFull(QSize(32, 32), QSize(16, 16),
-                                          ":/diskimage_32px.png", ":/diskimage_16px.png"));
-
-    /* Apply UI decorations: */
-    Ui::UIMediumManager::setupUi(this);
+    setWindowIcon(UIIconPool::iconSetFull(":/diskimage_32px.png", ":/diskimage_16px.png"));
 
-    /* Prepare some global stuff: */
-    m_vbox = vboxGlobal().virtualBox();
-    Assert(!m_vbox.isNull());
+    /* Prepare connections: */
+    prepareConnections();
+    /* Prepare actions: */
+    prepareActions();
+    /* Prepare central-widget: */
+    prepareCentralWidget();
+}
 
+void UIMediumManager::prepareConnections()
+{
     /* Configure medium-processing connections: */
     connect(&vboxGlobal(), SIGNAL(sigMediumCreated(const QString&)),
             this, SLOT(sltHandleMediumCreated(const QString&)));
@@ -856,66 +1026,65 @@ void UIMediumManager::prepareActions()
 {
     /* Create copy-action: */
     m_pActionCopy = new QAction(this);
+    AssertPtrReturnVoid(m_pActionCopy);
     {
         /* Configure copy-action: */
         m_pActionCopy->setShortcut(QKeySequence("Ctrl+O"));
-        m_pActionCopy->setIcon(UIIconPool::iconSetFull(QSize(22, 22), QSize(16, 16),
-                                                       ":/hd_add_22px.png", ":/hd_add_16px.png",
-                                                       ":/hd_add_disabled_22px.png", ":/hd_add_disabled_16px.png"));
         connect(m_pActionCopy, SIGNAL(triggered()), this, SLOT(sltCopyMedium()));
     }
 
     /* Create modify-action: */
     m_pActionModify = new QAction(this);
+    AssertPtrReturnVoid(m_pActionModify);
     {
         /* Configure modify-action: */
         m_pActionModify->setShortcut(QKeySequence("Ctrl+Space"));
-        m_pActionModify->setIcon(UIIconPool::iconSetFull(QSize(22, 22), QSize(16, 16),
-                                                         ":/hd_new_22px.png", ":/hd_new_16px.png",
-                                                         ":/hd_new_disabled_22px.png", ":/hd_new_disabled_16px.png"));
         connect(m_pActionModify, SIGNAL(triggered()), this, SLOT(sltModifyMedium()));
     }
 
     /* Create remove-action: */
     m_pActionRemove  = new QAction(this);
+    AssertPtrReturnVoid(m_pActionRemove);
     {
         /* Configure remove-action: */
         m_pActionRemove->setShortcut(QKeySequence(QKeySequence::Delete));
-        m_pActionRemove->setIcon(UIIconPool::iconSetFull(QSize(22, 22), QSize(16, 16),
-                                                         ":/hd_remove_22px.png", ":/hd_remove_16px.png",
-                                                         ":/hd_remove_disabled_22px.png", ":/hd_remove_disabled_16px.png"));
         connect(m_pActionRemove, SIGNAL(triggered()), this, SLOT(sltRemoveMedium()));
     }
 
     /* Create release-action: */
     m_pActionRelease = new QAction(this);
+    AssertPtrReturnVoid(m_pActionRelease);
     {
         /* Configure release-action: */
         m_pActionRelease->setShortcut(QKeySequence("Ctrl+L"));
-        m_pActionRelease->setIcon(UIIconPool::iconSetFull(QSize(22, 22), QSize(16, 16),
-                                                          ":/hd_release_22px.png", ":/hd_release_16px.png",
-                                                          ":/hd_release_disabled_22px.png", ":/hd_release_disabled_16px.png"));
         connect(m_pActionRelease, SIGNAL(triggered()), this, SLOT(sltReleaseMedium()));
     }
 
     /* Create refresh-action: */
     m_pActionRefresh = new QAction(this);
+    AssertPtrReturnVoid(m_pActionRefresh);
     {
         /* Configure refresh-action: */
         m_pActionRefresh->setShortcut(QKeySequence(QKeySequence::Refresh));
-        m_pActionRefresh->setIcon(UIIconPool::iconSetFull(QSize(22, 22), QSize(16, 16),
-                                                          ":/refresh_22px.png", ":/refresh_16px.png",
-                                                          ":/refresh_disabled_22px.png", ":/refresh_disabled_16px.png"));
-        connect(m_pActionRefresh, SIGNAL(triggered()), this, SLOT(refreshAll()));
+        connect(m_pActionRefresh, SIGNAL(triggered()), this, SLOT(sltRefreshAll()));
     }
+
+    /* Update action icons: */
+    updateActionIcons();
+
+    /* Prepare menu-bar: */
+    prepareMenuBar();
+    /* Prepare context-menu: */
+    prepareContextMenu();
 }
 
 void UIMediumManager::prepareMenuBar()
 {
-    /* Create actions-menu for menu-bar: */
+    /* Create menu-bar-menu: */
     m_pMenu = menuBar()->addMenu(QString());
+    AssertPtrReturnVoid(m_pMenu);
     {
-        /* Configure menu-bar menu: */
+        /* Configure menu-bar-menu: */
         m_pMenu->addAction(m_pActionCopy);
         m_pMenu->addAction(m_pActionModify);
         m_pMenu->addAction(m_pActionRemove);
@@ -924,28 +1093,67 @@ void UIMediumManager::prepareMenuBar()
     }
 }
 
+void UIMediumManager::prepareContextMenu()
+{
+    /* Create context-menu: */
+    m_pContextMenu = new QMenu(this);
+    AssertPtrReturnVoid(m_pContextMenu);
+    {
+        /* Configure contex-menu: */
+        m_pContextMenu->addAction(m_pActionCopy);
+        m_pContextMenu->addAction(m_pActionModify);
+        m_pContextMenu->addAction(m_pActionRemove);
+        m_pContextMenu->addAction(m_pActionRelease);
+    }
+}
+
+void UIMediumManager::prepareCentralWidget()
+{
+    /* Create central-widget: */
+    setCentralWidget(new QWidget);
+    AssertPtrReturnVoid(centralWidget());
+    {
+        /* Create main-layout: */
+        new QVBoxLayout(centralWidget());
+        AssertPtrReturnVoid(centralWidget()->layout());
+        {
+            /* Prepare tool-bar: */
+            prepareToolBar();
+            /* Prepare tab-widget: */
+            prepareTabWidget();
+            /* Prepare button-box: */
+            prepareButtonBox();
+        }
+    }
+}
+
 void UIMediumManager::prepareToolBar()
 {
     /* Create tool-bar: */
     m_pToolBar = new UIToolBar(this);
+    AssertPtrReturnVoid(m_pToolBar);
     {
         /* Configure tool-bar: */
         m_pToolBar->setIconSize(QSize(22, 22));
         m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
         m_pToolBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
         /* Add tool-bar actions: */
-        m_pToolBar->addAction(m_pActionCopy);
-        m_pToolBar->addAction(m_pActionModify);
-        m_pToolBar->addAction(m_pActionRemove);
-        m_pToolBar->addAction(m_pActionRelease);
-        m_pToolBar->addAction(m_pActionRefresh);
+        if (m_pActionCopy)
+            m_pToolBar->addAction(m_pActionCopy);
+        if (m_pActionModify)
+            m_pToolBar->addAction(m_pActionModify);
+        if (m_pActionRemove)
+            m_pToolBar->addAction(m_pActionRemove);
+        if (m_pActionRelease)
+            m_pToolBar->addAction(m_pActionRelease);
+        if (m_pActionRefresh)
+            m_pToolBar->addAction(m_pActionRefresh);
         /* Integrate tool-bar into dialog: */
         QVBoxLayout *pMainLayout = qobject_cast<QVBoxLayout*>(centralWidget()->layout());
-        Assert(pMainLayout);
 #if MAC_LEOPARD_STYLE
         /* Enable unified tool-bars on Mac OS X. Available on Qt >= 4.3: */
         addToolBar(m_pToolBar);
-        m_pToolBar->setMacToolbar();
+        m_pToolBar->enableMacToolbar();
         /* No spacing/margin on the Mac: */
         pMainLayout->setContentsMargins(0, 0, 0, 0);
         pMainLayout->insertSpacing(0, 10);
@@ -955,153 +1163,166 @@ void UIMediumManager::prepareToolBar()
         /* Set spacing/margin like in the selector window: */
         pMainLayout->setSpacing(5);
         pMainLayout->setContentsMargins(5, 5, 5, 5);
-#endif /* MAC_LEOPARD_STYLE */
-    }
-}
-
-void UIMediumManager::prepareContextMenu()
-{
-    /* Create context-menu: */
-    m_pContextMenu = new QMenu(this);
-    {
-        /* Configure contex-menu: */
-        m_pContextMenu->addAction(m_pActionCopy);
-        m_pContextMenu->addAction(m_pActionModify);
-        m_pContextMenu->addAction(m_pActionRemove);
-        m_pContextMenu->addAction(m_pActionRelease);
-    }
-}
-
-void UIMediumManager::preapreTabWidget()
-{
-    /* Tab-widget created in .ui file. */
-    {
-        /* Setup tab-widget: */
-        mTabWidget->setFocusPolicy(Qt::TabFocus);
-        mTabWidget->setTabIcon(HDTab, m_iconHD);
-        mTabWidget->setTabIcon(CDTab, m_iconCD);
-        mTabWidget->setTabIcon(FDTab, m_iconFD);
-        connect(mTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandleCurrentTabChanged()));
+#endif /* !MAC_LEOPARD_STYLE */
     }
 }
 
-void UIMediumManager::prepareTreeWidgets()
-{
-    /* Prepare tree-widget HD: */
-    prepareTreeWidgetHD();
-    /* Prepare tree-widget CD: */
-    prepareTreeWidgetCD();
-    /* Prepare tree-widget FD: */
-    prepareTreeWidgetFD();
-
-    /* Focus current tree: */
-    currentTreeWidget()->setFocus();
-}
-
-void UIMediumManager::prepareTreeWidgetHD()
+void UIMediumManager::prepareTabWidget()
 {
-    /* HD tree-widget created in .ui file. */
+    /* Create tab-widget: */
+    m_pTabWidget = new QITabWidget;
+    AssertPtrReturnVoid(m_pTabWidget);
     {
-        /* Setup HD tree-widget: */
-        mTwHD->setColumnCount(3);
-        mTwHD->sortItems(0, Qt::AscendingOrder);
-        mTwHD->header()->setResizeMode(0, QHeaderView::Fixed);
-        mTwHD->header()->setResizeMode(1, QHeaderView::ResizeToContents);
-        mTwHD->header()->setResizeMode(2, QHeaderView::ResizeToContents);
-        mTwHD->header()->setStretchLastSection(false);
-        mTwHD->setSortingEnabled(true);
-        connect(mTwHD, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
-                this, SLOT(sltHandleCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
-        connect(mTwHD, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
-                this, SLOT(sltHandleDoubleClick()));
-        connect(mTwHD, SIGNAL(customContextMenuRequested(const QPoint&)),
-                this, SLOT(sltHandleContextMenuCall(const QPoint&)));
-        connect(mTwHD, SIGNAL(resized(const QSize&, const QSize&)),
-                this, SLOT(sltMakeRequestForTableAdjustment()));
-        connect(mTwHD->header(), SIGNAL(sectionResized(int, int, int)),
-                this, SLOT(sltMakeRequestForTableAdjustment()));
+        /* Create tabs: */
+        for (int i = 0; i < m_iTabCount; ++i)
+            prepareTab(mediumType(i));
+        /* Configure tab-widget: */
+        m_pTabWidget->setFocusPolicy(Qt::TabFocus);
+        m_pTabWidget->setTabIcon(tabIndex(UIMediumType_HardDisk), m_iconHD);
+        m_pTabWidget->setTabIcon(tabIndex(UIMediumType_DVD), m_iconCD);
+        m_pTabWidget->setTabIcon(tabIndex(UIMediumType_Floppy), m_iconFD);
+        connect(m_pTabWidget, SIGNAL(currentChanged(int)), this, SLOT(sltHandleCurrentTabChanged()));
+        /* Add tab-widget into central layout: */
+        centralWidget()->layout()->addWidget(m_pTabWidget);
+        /* Focus current tree-widget: */
+        if (currentTreeWidget())
+            currentTreeWidget()->setFocus();
+        /* Update other widgets according chosen tab: */
+        sltHandleCurrentTabChanged();
     }
 }
 
-void UIMediumManager::prepareTreeWidgetCD()
+void UIMediumManager::prepareTab(UIMediumType type)
 {
-    /* CD tree-widget created in .ui file. */
+    /* Create tab: */
+    m_pTabWidget->addTab(new QWidget, QString());
+    QWidget *pTab = tab(type);
+    AssertPtrReturnVoid(pTab);
     {
-        /* Setup CD tree-widget: */
-        mTwCD->setColumnCount(2);
-        mTwCD->sortItems(0, Qt::AscendingOrder);
-        mTwCD->header()->setResizeMode(0, QHeaderView::Fixed);
-        mTwCD->header()->setResizeMode(1, QHeaderView::ResizeToContents);
-        mTwCD->header()->setStretchLastSection(false);
-        mTwCD->setSortingEnabled(true);
-        connect(mTwCD, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
-                this, SLOT(sltHandleCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
-        connect(mTwCD, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
-                this, SLOT(sltHandleDoubleClick()));
-        connect(mTwCD, SIGNAL(customContextMenuRequested(const QPoint&)),
-                this, SLOT(sltHandleContextMenuCall(const QPoint&)));
-        connect(mTwCD, SIGNAL(resized(const QSize&, const QSize&)),
-                this, SLOT(sltMakeRequestForTableAdjustment()));
-        connect(mTwCD->header(), SIGNAL(sectionResized(int, int, int)),
-                this, SLOT(sltMakeRequestForTableAdjustment()));
+        /* Create tab layout: */
+        new QVBoxLayout(pTab);
+        AssertPtrReturnVoid(pTab->layout());
+        {
+            /* Prepare tree-widget: */
+            prepareTreeWidget(type, type == UIMediumType_HardDisk ? 3 : 2);
+            /* Prepare information-container: */
+            prepareInformationContainer(type, type == UIMediumType_HardDisk ? 7 : 3);
+        }
     }
 }
 
-void UIMediumManager::prepareTreeWidgetFD()
+void UIMediumManager::prepareTreeWidget(UIMediumType type, int iColumns)
 {
-    /* FD tree-widget created in .ui file. */
+    /* Create tree-widget: */
+    m_trees.insert(tabIndex(type), new QITreeWidget);
+    QTreeWidget *pTreeWidget = treeWidget(type);
+    AssertPtrReturnVoid(pTreeWidget);
     {
-        /* Setup FD tree-widget: */
-        mTwFD->setColumnCount(2);
-        mTwFD->sortItems(0, Qt::AscendingOrder);
-        mTwFD->header()->setResizeMode(0, QHeaderView::Fixed);
-        mTwFD->header()->setResizeMode(1, QHeaderView::ResizeToContents);
-        mTwFD->header()->setStretchLastSection(false);
-        mTwFD->setSortingEnabled(true);
-        connect(mTwFD, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
-                this, SLOT(sltHandleCurrentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
-        connect(mTwFD, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
+        /* Configure tree-widget: */
+        pTreeWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+        pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
+        pTreeWidget->setAlternatingRowColors(true);
+        pTreeWidget->setAllColumnsShowFocus(true);
+        pTreeWidget->setAcceptDrops(true);
+        pTreeWidget->setColumnCount(iColumns);
+        pTreeWidget->sortItems(0, Qt::AscendingOrder);
+        if (iColumns > 0)
+            pTreeWidget->header()->setResizeMode(0, QHeaderView::Fixed);
+        if (iColumns > 1)
+            pTreeWidget->header()->setResizeMode(1, QHeaderView::ResizeToContents);
+        if (iColumns > 2)
+            pTreeWidget->header()->setResizeMode(2, QHeaderView::ResizeToContents);
+        pTreeWidget->header()->setStretchLastSection(false);
+        pTreeWidget->setSortingEnabled(true);
+        connect(pTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
+                this, SLOT(sltHandleCurrentItemChanged()));
+        connect(pTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
                 this, SLOT(sltHandleDoubleClick()));
-        connect(mTwFD, SIGNAL(customContextMenuRequested(const QPoint&)),
+        connect(pTreeWidget, SIGNAL(customContextMenuRequested(const QPoint&)),
                 this, SLOT(sltHandleContextMenuCall(const QPoint&)));
-        connect(mTwFD, SIGNAL(resized(const QSize&, const QSize&)),
-                this, SLOT(sltMakeRequestForTableAdjustment()));
-        connect(mTwFD->header(), SIGNAL(sectionResized(int, int, int)),
-                this, SLOT(sltMakeRequestForTableAdjustment()));
+        connect(pTreeWidget, SIGNAL(resized(const QSize&, const QSize&)),
+                this, SLOT(sltPerformTablesAdjustment()), Qt::QueuedConnection);
+        connect(pTreeWidget->header(), SIGNAL(sectionResized(int, int, int)),
+                this, SLOT(sltPerformTablesAdjustment()), Qt::QueuedConnection);
+        /* Add tree-widget into tab layout: */
+        tab(type)->layout()->addWidget(pTreeWidget);
     }
 }
 
-void UIMediumManager::prepareInformationPanes()
+void UIMediumManager::prepareInformationContainer(UIMediumType type, int iFields)
 {
-    /* Information-panes created in .ui file. */
+    /* Create information-container: */
+    int iIndex = tabIndex(type);
+    m_containers.insert(iIndex, new QFrame);
+    QFrame *pInformationContainer = infoContainer(type);
+    AssertPtrReturnVoid(pInformationContainer);
     {
-        /* Configure information-panes: */
-        QList<QILabel*> panes = findChildren<QILabel*>();
-        foreach (QILabel *pPane, panes)
-            pPane->setFullSizeSelection(true);
+        /* Configure information-container: */
+        pInformationContainer->setFrameShape(QFrame::Box);
+        pInformationContainer->setFrameShadow(QFrame::Sunken);
+        /* Create information-container layout: */
+        new QGridLayout(pInformationContainer);
+        QGridLayout *pInformationContainerLayout = qobject_cast<QGridLayout*>(pInformationContainer->layout());
+        AssertPtrReturnVoid(pInformationContainerLayout);
+        {
+            /* Configure information-container layout: */
+            pInformationContainerLayout->setVerticalSpacing(0);
+            pInformationContainerLayout->setContentsMargins(5, 5, 5, 5);
+            pInformationContainerLayout->setColumnStretch(1, 1);
+            /* Create information-container labels & fields: */
+            for (int i = 0; i < iFields; ++i)
+            {
+                /* Create information-label: */
+                m_labels[iIndex] << new QLabel;
+                QLabel *pLabel = infoLabel(type, i);
+                AssertPtrReturnVoid(pLabel);
+                /* Create information-field: */
+                m_fields[iIndex] << new QILabel;
+                QILabel *pField = infoField(type, i);
+                AssertPtrReturnVoid(pField);
+                {
+                    /* Configure information-field: */
+                    pField->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
+                    pField->setFullSizeSelection(true);
+                }
+                /* Add information-container labels & fields into container layout: */
+                pInformationContainerLayout->addWidget(pLabel, i, 0);
+                pInformationContainerLayout->addWidget(pField, i, 1);
+            }
+        }
+        /* Add information-container into tab layout: */
+        tab(type)->layout()->addWidget(pInformationContainer);
     }
 }
 
 void UIMediumManager::prepareButtonBox()
 {
-    /* Button-box created in .ui file. */
+    /* Create button-box: */
+    m_pButtonBox = new QIDialogButtonBox;
+    AssertPtrReturnVoid(m_pButtonBox);
     {
         /* Configure button-box: */
-        mButtonBox->button(QDialogButtonBox::Ok)->setDefault(true);
-        connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
-        connect(mButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog()));
+        m_pButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Close);
+        m_pButtonBox->button(QDialogButtonBox::Close)->setShortcut(Qt::Key_Escape);
+        connect(m_pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog()));
+        connect(m_pButtonBox, SIGNAL(rejected()), this, SLOT(close()));
+        /* Add button-box into central layout: */
+        centralWidget()->layout()->addWidget(m_pButtonBox);
+        /* Prepare progress-bar: */
+        prepareProgressBar();
     }
 }
 
 void UIMediumManager::prepareProgressBar()
 {
     /* Create progress-bar: */
-    m_pProgressBar = new UIEnumerationProgressBar(this);
+    m_pProgressBar = new UIEnumerationProgressBar;
+    AssertPtrReturnVoid(m_pProgressBar);
     {
-        /* Hidden by default: */
+        /* Configure progress-bar: */
         m_pProgressBar->hide();
-        /* Integrate to the button-box: */
-        mButtonBox->addExtraWidget(m_pProgressBar);
+        /* Add progress-bar into button-box layout: */
+        m_pButtonBox->addExtraWidget(m_pProgressBar);
     }
 }
 
@@ -1114,445 +1335,190 @@ void UIMediumManager::prepareMacWindowMenu()
 }
 #endif /* Q_WS_MAC */
 
-void UIMediumManager::populateTreeWidgets()
+void UIMediumManager::repopulateTreeWidgets()
 {
-    /* If refresh was requested and enumeration was not yet started: */
-    if (m_fRefresh && !vboxGlobal().isMediumEnumerationInProgress())
+    /* Remember current medium-items: */
+    if (UIMediumItem *pMediumItem = mediumItem(UIMediumType_HardDisk))
+        m_strCurrentIdHD = pMediumItem->id();
+    if (UIMediumItem *pMediumItem = mediumItem(UIMediumType_DVD))
+        m_strCurrentIdCD = pMediumItem->id();
+    if (UIMediumItem *pMediumItem = mediumItem(UIMediumType_Floppy))
+        m_strCurrentIdFD = pMediumItem->id();
+
+    /* Clear tree-widgets: */
+    QTreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk);
+    if (pTreeWidgetHD)
     {
-        /* Just start medium-enumeration: */
-        vboxGlobal().startMediumEnumeration();
+        setCurrentItem(pTreeWidgetHD, 0);
+        pTreeWidgetHD->clear();
     }
-    /* If refresh was not requested or enumeration already started: */
-    else
+    QTreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD);
+    if (pTreeWidgetCD)
     {
-        /* Emulate (possible partial) medium-enumeration: */
-        QList<QString> mediumIDs = vboxGlobal().mediumIDs();
-        prepareToRefresh(mediumIDs.size());
-        foreach (const QString &strMediumID, mediumIDs)
-        {
-            /* Get corresponding medium: */
-            const UIMedium medium = vboxGlobal().medium(strMediumID);
-            /* Create corresponding medium-item: */
-            sltHandleMediumCreated(strMediumID);
-            /* Advance progress-bar only for created mediums: */
-            if (medium.state() != KMediumState_NotCreated)
-                m_pProgressBar->setValue(m_pProgressBar->value() + 1);
-        }
-        /* Finally, emulate enumeration finish,
-         * if enumeration already finished or wasn't started: */
-        if (!vboxGlobal().isMediumEnumerationInProgress())
-            sltHandleMediumEnumerationFinish();
+        setCurrentItem(pTreeWidgetCD, 0);
+        pTreeWidgetCD->clear();
+    }
+    QTreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy);
+    if (pTreeWidgetFD)
+    {
+        setCurrentItem(pTreeWidgetFD, 0);
+        pTreeWidgetFD->clear();
     }
 
-    /* For a newly opened dialog, select the first item: */
-    if (!mTwHD->currentItem())
-        if (QTreeWidgetItem *pItem = mTwHD->topLevelItem(0))
-            setCurrentItem(mTwHD, pItem);
-    if (!mTwCD->currentItem())
-        if (QTreeWidgetItem *pItem = mTwCD->topLevelItem(0))
-            setCurrentItem(mTwCD, pItem);
-    if (!mTwFD->currentItem())
-        if (QTreeWidgetItem *pItem = mTwFD->topLevelItem(0))
-            setCurrentItem(mTwFD, pItem);
+    /* Create medium-items (do not change current one): */
+    m_fPreventChangeCurrentItem = true;
+    foreach (const QString &strMediumID, vboxGlobal().mediumIDs())
+        sltHandleMediumCreated(strMediumID);
+    m_fPreventChangeCurrentItem = false;
+
+    /* Select first item as current one if nothing selected: */
+    if (pTreeWidgetHD && !mediumItem(UIMediumType_HardDisk))
+        if (QTreeWidgetItem *pItem = pTreeWidgetHD->topLevelItem(0))
+            setCurrentItem(pTreeWidgetHD, pItem);
+    if (pTreeWidgetCD && !mediumItem(UIMediumType_DVD))
+        if (QTreeWidgetItem *pItem = pTreeWidgetCD->topLevelItem(0))
+            setCurrentItem(pTreeWidgetCD, pItem);
+    if (pTreeWidgetFD && !mediumItem(UIMediumType_Floppy))
+        if (QTreeWidgetItem *pItem = pTreeWidgetFD->topLevelItem(0))
+            setCurrentItem(pTreeWidgetFD, pItem);
 }
 
-#ifdef Q_WS_MAC
-void UIMediumManager::cleanupMacWindowMenu()
+void UIMediumManager::refetchCurrentMediumItem(UIMediumType type)
 {
-    /* Destroy window-menu of menu-bar: */
-    UIWindowMenuManager::instance()->removeWindow(this);
-    UIWindowMenuManager::instance()->destroyMenu(this);
-}
-#endif /* Q_WS_MAC */
+    /* Get corresponding medium-item: */
+    UIMediumItem *pMediumItem = mediumItem(type);
 
-void UIMediumManager::cleanup()
-{
 #ifdef Q_WS_MAC
-    /* Cleanup Mac window-menu: */
-    cleanupMacWindowMenu();
+    /* Set the file for the proxy icon: */
+    if (pMediumItem == currentMediumItem())
+        setWindowFilePath(pMediumItem ? pMediumItem->location() : QString());
 #endif /* Q_WS_MAC */
-}
 
-void UIMediumManager::retranslateUi()
-{
-    /* Translate uic generated strings: */
-    Ui::UIMediumManager::retranslateUi(this);
-
-    /* Menu: */
-    m_pMenu->setTitle(QApplication::translate("VBoxMediaManagerDlg", "&Actions"));
-    /* Action names: */
-    m_pActionCopy->setText(QApplication::translate("VBoxMediaManagerDlg", "&Copy..."));
-    m_pActionModify->setText(QApplication::translate("VBoxMediaManagerDlg", "&Modify..."));
-    m_pActionRemove->setText(QApplication::translate("VBoxMediaManagerDlg", "R&emove"));
-    m_pActionRelease->setText(QApplication::translate("VBoxMediaManagerDlg", "Re&lease"));
-    m_pActionRefresh->setText(QApplication::translate("VBoxMediaManagerDlg", "Re&fresh"));
-    /* Action tool-tips: */
-    m_pActionCopy->setToolTip(m_pActionCopy->text().remove('&') + QString(" (%1)").arg(m_pActionCopy->shortcut().toString()));
-    m_pActionModify->setToolTip(m_pActionModify->text().remove('&') + QString(" (%1)").arg(m_pActionModify->shortcut().toString()));
-    m_pActionRemove->setToolTip(m_pActionRemove->text().remove('&') + QString(" (%1)").arg(m_pActionRemove->shortcut().toString()));
-    m_pActionRelease->setToolTip(m_pActionRelease->text().remove('&') + QString(" (%1)").arg(m_pActionRelease->shortcut().toString()));
-    m_pActionRefresh->setToolTip(m_pActionRefresh->text().remove('&') + QString(" (%1)").arg(m_pActionRefresh->shortcut().toString()));
-    /* Action status-tips: */
-    m_pActionCopy->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Copy an existing disk image file"));
-    m_pActionModify->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Modify the attributes of the selected disk image file"));
-    m_pActionRemove->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Remove the selected disk image file"));
-    m_pActionRelease->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Release the selected disk image file by detaching it from the machines"));
-    m_pActionRefresh->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Refresh the list of disk image files"));
-
-    /* Tool-bar: */
-#ifdef Q_WS_MAC
-# ifdef QT_MAC_USE_COCOA
-    /* There is a bug in Qt Cocoa which result in showing a "more arrow" when
-       the necessary size of the toolbar is increased. Also for some languages
-       the with doesn't match if the text increase. So manually adjust the size
-       after changing the text. */
-    m_pToolBar->updateLayout();
-# endif /* QT_MAC_USE_COCOA */
-#endif /* Q_WS_MAC */
+    /* Make sure current medium-item visible: */
+    if (pMediumItem)
+        treeWidget(type)->scrollToItem(pMediumItem, QAbstractItemView::EnsureVisible);
 
-    // TODO: Just rename translation context in .nls files!
-    /* Translations moved from VBoxMediaManagerDlg.ui file to keep old translation context: */
-    setWindowTitle(QApplication::translate("VBoxMediaManagerDlg", "Virtual Media Manager"));
-    mTabWidget->setTabText(0, tr("&Hard drives"));
-    mTwHD->headerItem()->setText(0, QApplication::translate("VBoxMediaManagerDlg", "Name"));
-    mTwHD->headerItem()->setText(1, QApplication::translate("VBoxMediaManagerDlg", "Virtual Size"));
-    mTwHD->headerItem()->setText(2, QApplication::translate("VBoxMediaManagerDlg", "Actual Size"));
-    m_pTypeLabel->setText(QApplication::translate("VBoxMediaManagerDlg", "Type:"));
-    m_pLocationLabel->setText(QApplication::translate("VBoxMediaManagerDlg", "Location:"));
-    m_pFormatLabel->setText(QApplication::translate("VBoxMediaManagerDlg", "Format:"));
-    m_pDetailsLabel->setText(QApplication::translate("VBoxMediaManagerDlg", "Storage details:"));
-    m_pUsageLabel->setText(QApplication::translate("VBoxMediaManagerDlg", "Attached to:"));
-    mTabWidget->setTabText(1, tr("&Optical disks"));
-    mTwCD->headerItem()->setText(0, QApplication::translate("VBoxMediaManagerDlg", "Name"));
-    mTwCD->headerItem()->setText(1, QApplication::translate("VBoxMediaManagerDlg", "Size"));
-    mLbCD1->setText(QApplication::translate("VBoxMediaManagerDlg", "Location:"));
-    mLbCD2->setText(QApplication::translate("VBoxMediaManagerDlg", "Attached to:"));
-    mTabWidget->setTabText(2, tr("&Floppy disks"));
-    mTwFD->headerItem()->setText(0, QApplication::translate("VBoxMediaManagerDlg", "Name"));
-    mTwFD->headerItem()->setText(1, QApplication::translate("VBoxMediaManagerDlg", "Size"));
-    mLbFD1->setText(QApplication::translate("VBoxMediaManagerDlg", "Location:"));
-    mLbFD2->setText(QApplication::translate("VBoxMediaManagerDlg", "Attached to:"));
-
-    /* Progress-bar: */
-    m_pProgressBar->setText(QApplication::translate("VBoxMediaManagerDlg", "Checking accessibility"));
-#ifdef Q_WS_MAC
-    /* Make sure that the widgets aren't jumping around
-     * while the progress-bar get visible. */
-    m_pProgressBar->adjustSize();
-    int h = m_pProgressBar->height();
-    mButtonBox->setMinimumHeight(h + 12);
-#endif /* Q_WS_MAC */
+    /* Update actions: */
+    updateActions();
 
-    /* Button-box: */
-    mButtonBox->button(QDialogButtonBox::Ok)->setText(tr("C&lose"));
+    /* Update corresponding information-panes: */
+    updateInformationFields(type);
+}
 
-    /* Full refresh if there is at least one item present: */
-    if (mTwHD->topLevelItemCount() || mTwCD->topLevelItemCount() || mTwFD->topLevelItemCount())
-        refreshAll();
+void UIMediumManager::refetchCurrentChosenMediumItem()
+{
+    refetchCurrentMediumItem(currentMediumType());
 }
 
-bool UIMediumManager::releaseMediumFrom(const UIMedium &medium, const QString &strMachineId)
+void UIMediumManager::refetchCurrentMediumItems()
 {
-    /* Open session: */
-    CSession session = vboxGlobal().openSession(strMachineId);
-    if (session.isNull())
-        return false;
+    refetchCurrentMediumItem(UIMediumType_HardDisk);
+    refetchCurrentMediumItem(UIMediumType_DVD);
+    refetchCurrentMediumItem(UIMediumType_Floppy);
+}
 
-    /* Get machine: */
-    CMachine machine = session.GetMachine();
+void UIMediumManager::updateActions()
+{
+    /* Get current medium-item: */
+    UIMediumItem *pMediumItem = currentMediumItem();
 
-    /* Prepare result: */
-    bool fSuccess = true;
+    /* Calculate actions accessibility: */
+    bool fNotInEnumeration = !vboxGlobal().isMediumEnumerationInProgress();
 
-    /* Depending on medium-type: */
-    switch (medium.type())
+    /* Apply actions accessibility: */
+    if (m_pActionCopy)
     {
-        case UIMediumType_HardDisk: fSuccess = releaseHardDiskFrom(medium, machine); break;
-        case UIMediumType_DVD:      fSuccess = releaseOpticalDiskFrom(medium, machine); break;
-        case UIMediumType_Floppy:   fSuccess = releaseFloppyDiskFrom(medium, machine); break;
-        default: AssertMsgFailed(("Medium-type unknown: %d\n", medium.type())); break;
+        bool fActionEnabledCopy = currentMediumType() == UIMediumType_HardDisk &&
+                                  fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Copy);
+        m_pActionCopy->setEnabled(fActionEnabledCopy);
     }
-
-    /* If medium was released: */
-    if (fSuccess)
+    if (m_pActionModify)
     {
-        /* Save machine settings: */
-        machine.SaveSettings();
-        if (!machine.isOk())
-        {
-            msgCenter().cannotSaveMachineSettings(machine, this);
-            fSuccess = false;
-        }
+        bool fActionEnabledModify = currentMediumType() == UIMediumType_HardDisk &&
+                                    fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Modify);
+        m_pActionModify->setEnabled(fActionEnabledModify);
     }
-
-    /* Close session: */
-    session.UnlockMachine();
-
-    /* Return result: */
-    return fSuccess;
-}
-
-bool UIMediumManager::releaseHardDiskFrom(const UIMedium &medium, CMachine &machine)
-{
-    /* Enumerate attachments: */
-    CMediumAttachmentVector attachments = machine.GetMediumAttachments();
-    foreach (const CMediumAttachment &attachment, attachments)
+    if (m_pActionRemove)
     {
-        /* Skip non-hard-disks: */
-        if (attachment.GetType() != KDeviceType_HardDisk)
-            continue;
-
-        /* Skip unrelated hard-disks: */
-        if (attachment.GetMedium().GetId() != medium.id())
-            continue;
-
-        /* Try detaching device: */
-        machine.DetachDevice(attachment.GetController(), attachment.GetPort(), attachment.GetDevice());
-        if (machine.isOk())
-        {
-            /* Return success: */
-            return true;
-        }
-        else
-        {
-            /* Show error: */
-            CStorageController controller = machine.GetStorageControllerByName(attachment.GetController());
-            msgCenter().cannotDetachDevice(machine, UIMediumType_HardDisk, medium.location(),
-                                           StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()), this);
-            /* Return failure: */
-            return false;
-        }
+        bool fActionEnabledRemove = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Remove);
+        m_pActionRemove->setEnabled(fActionEnabledRemove);
     }
-    /* Return failure: */
-    return false;
-}
-
-bool UIMediumManager::releaseOpticalDiskFrom(const UIMedium &medium, CMachine &machine)
-{
-    /* Enumerate attachments: */
-    CMediumAttachmentVector attachments = machine.GetMediumAttachments();
-    foreach (const CMediumAttachment &attachment, attachments)
+    if (m_pActionRelease)
     {
-        /* Skip non-optical-disks: */
-        if (attachment.GetType() != KDeviceType_DVD)
-            continue;
-
-        /* Skip unrelated optical-disks: */
-        if (attachment.GetMedium().GetId() != medium.id())
-            continue;
-
-        /* Try device unmounting: */
-        machine.MountMedium(attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), CMedium(), false /* force */);
-        if (machine.isOk())
-        {
-            /* Return success: */
-            return true;
-        }
-        else
-        {
-            /* Show error: */
-            msgCenter().cannotRemountMedium(machine, medium, false /* mount? */, false /* retry? */, this);
-            /* Return failure: */
-            return false;
-        }
+        bool fActionEnabledRelease = fNotInEnumeration && pMediumItem && checkMediumFor(pMediumItem, Action_Release);
+        m_pActionRelease->setEnabled(fActionEnabledRelease);
     }
-    /* Return failure: */
-    return false;
 }
 
-bool UIMediumManager::releaseFloppyDiskFrom(const UIMedium &medium, CMachine &machine)
+void UIMediumManager::updateActionIcons()
 {
-    /* Enumerate attachments: */
-    CMediumAttachmentVector attachments = machine.GetMediumAttachments();
-    foreach (const CMediumAttachment &attachment, attachments)
+    QString strPrefix = "hd";
+    if (m_pTabWidget)
     {
-        /* Skip non-floppy-disks: */
-        if (attachment.GetType() != KDeviceType_Floppy)
-            continue;
-
-        /* Skip unrelated floppy-disks: */
-        if (attachment.GetMedium().GetId() != medium.id())
-            continue;
-
-        /* Try device unmounting: */
-        machine.MountMedium(attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), CMedium(), false /* force */);
-        if (machine.isOk())
-        {
-            /* Return success: */
-            return true;
-        }
-        else
+        switch (currentMediumType())
         {
-            /* Show error: */
-            msgCenter().cannotRemountMedium(machine, medium, false /* mount? */, false /* retry? */, this);
-            /* Return failure: */
-            return false;
+            case UIMediumType_HardDisk: strPrefix = "hd"; break;
+            case UIMediumType_DVD:      strPrefix = "cd"; break;
+            case UIMediumType_Floppy:   strPrefix = "fd"; break;
+            default: break;
         }
     }
-    /* Return failure: */
-    return false;
+    if (m_pActionCopy)
+        m_pActionCopy->setIcon(UIIconPool::iconSetFull(QString(":/%1_copy_22px.png").arg(strPrefix),
+                                                       QString(":/%1_copy_16px.png").arg(strPrefix),
+                                                       QString(":/%1_copy_disabled_22px.png").arg(strPrefix),
+                                                       QString(":/%1_copy_disabled_16px.png").arg(strPrefix)));
+    if (m_pActionModify)
+        m_pActionModify->setIcon(UIIconPool::iconSetFull(QString(":/%1_modify_22px.png").arg(strPrefix),
+                                                         QString(":/%1_modify_16px.png").arg(strPrefix),
+                                                         QString(":/%1_modify_disabled_22px.png").arg(strPrefix),
+                                                         QString(":/%1_modify_disabled_16px.png").arg(strPrefix)));
+    if (m_pActionRemove)
+        m_pActionRemove->setIcon(UIIconPool::iconSetFull(QString(":/%1_remove_22px.png").arg(strPrefix),
+                                                         QString(":/%1_remove_16px.png").arg(strPrefix),
+                                                         QString(":/%1_remove_disabled_22px.png").arg(strPrefix),
+                                                         QString(":/%1_remove_disabled_16px.png").arg(strPrefix)));
+    if (m_pActionRelease)
+        m_pActionRelease->setIcon(UIIconPool::iconSetFull(QString(":/%1_release_22px.png").arg(strPrefix),
+                                                          QString(":/%1_release_16px.png").arg(strPrefix),
+                                                          QString(":/%1_release_disabled_22px.png").arg(strPrefix),
+                                                          QString(":/%1_release_disabled_16px.png").arg(strPrefix)));
+    if (m_pActionRefresh && m_pActionRefresh->icon().isNull())
+        m_pActionRefresh->setIcon(UIIconPool::iconSetFull(":/refresh_22px.png", ":/refresh_16px.png",
+                                                          ":/refresh_disabled_22px.png", ":/refresh_disabled_16px.png"));
 }
 
-QTreeWidget* UIMediumManager::treeWidget(UIMediumType type) const
+void UIMediumManager::updateTabIcons(UIMediumItem *pMediumItem, Action action)
 {
-    /* Return corresponding tree-widget: */
-    switch (type)
-    {
-        case UIMediumType_HardDisk: return mTwHD;
-        case UIMediumType_DVD:      return mTwCD;
-        case UIMediumType_Floppy:   return mTwFD;
-        default: AssertMsgFailed(("Medium-type unknown: %d\n", type)); break;
-    }
-    /* Null by default: */
-    return 0;
-}
+    /* Make sure medium-item is valid: */
+    AssertReturnVoid(pMediumItem);
 
-UIMediumType UIMediumManager::currentTreeWidgetType() const
-{
-    /* Return corresponding medium-type: */
-    switch (mTabWidget->currentIndex())
-    {
-        case HDTab: return UIMediumType_HardDisk;
-        case CDTab: return UIMediumType_DVD;
-        case FDTab: return UIMediumType_Floppy;
-        default: AssertMsgFailed(("Page-type unknown: %d\n", mTabWidget->currentIndex())); break;
-    }
-    /* Invalid by default: */
-    return UIMediumType_Invalid;
-}
-
-QTreeWidget* UIMediumManager::currentTreeWidget() const
-{
-    return treeWidget(currentTreeWidgetType());
-}
-
-void UIMediumManager::setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem)
-{
-    if (pTree && pItem)
-    {
-        pItem->setSelected(true);
-        pTree->setCurrentItem(pItem);
-        pTree->scrollToItem(pItem, QAbstractItemView::EnsureVisible);
-        sltHandleCurrentItemChanged(pItem);
-    }
-    else
-        sltHandleCurrentTabChanged();
-}
-
-UIMediumItem* UIMediumManager::toMediumItem(QTreeWidgetItem *pItem) const
-{
-    /* Return UIMediumItem based on QTreeWidgetItem if it is valid: */
-    if (pItem && pItem->type() == UIMediumItem::Type)
-        return static_cast<UIMediumItem*>(pItem);
-    /* Null by default: */
-    return 0;
-}
-
-UIMediumItem* UIMediumManager::searchItem(QTreeWidget *pTree, const CheckIfSuitableBy &functor) const
-{
-    /* Make sure argument is valid: */
-    if (!pTree)
-        return 0;
-
-    /* Return wrapper: */
-    return searchItem(pTree->invisibleRootItem(), functor);
-}
-
-UIMediumItem* UIMediumManager::searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &functor) const
-{
-    /* Make sure argument is valid: */
-    if (!pParentItem)
-        return 0;
-
-    /* Verify passed item if it is of 'medium' type too: */
-    if (UIMediumItem *pMediumParentItem = toMediumItem(pParentItem))
-        if (functor.isItSuitable(pMediumParentItem))
-            return pMediumParentItem;
-
-    /* Iterate other all the children: */
-    for (int iChildIndex = 0; iChildIndex < pParentItem->childCount(); ++iChildIndex)
-        if (UIMediumItem *pMediumChildItem = toMediumItem(pParentItem->child(iChildIndex)))
-            if (UIMediumItem *pRequiredMediumChildItem = searchItem(pMediumChildItem, functor))
-                return pRequiredMediumChildItem;
-
-    /* Null by default: */
-    return 0;
-}
-
-UIMediumItem* UIMediumManager::createHardDiskItem(QTreeWidget *pTree, const UIMedium &medium) const
-{
-    /* Make sure passed medium is valid: */
-    AssertReturn(!medium.medium().isNull(), 0);
-
-    /* Search for medium-item: */
-    UIMediumItem *pMediumItem = searchItem(pTree, CheckIfSuitableByID(medium.id()));
-
-    /* If medium-item do not exists: */
-    if (!pMediumItem)
-    {
-        /* If medium have a parent: */
-        if (medium.parentID() != UIMedium::nullID())
-        {
-            /* Try to find parent medium-item: */
-            UIMediumItem *pParentMediumItem = searchItem(pTree, CheckIfSuitableByID(medium.parentID()));
-            /* If parent medium-item was not found: */
-            if (!pParentMediumItem)
-            {
-                /* Make sure such corresponding parent medium is already cached! */
-                UIMedium parentMedium = vboxGlobal().medium(medium.parentID());
-                if (parentMedium.isNull())
-                    AssertMsgFailed(("Parent medium with ID={%s} was not found!\n", medium.parentID().toAscii().constData()));
-                /* Try to create parent medium-item: */
-                else
-                    pParentMediumItem = createHardDiskItem(pTree, parentMedium);
-            }
-            /* If parent medium-item was found: */
-            if (pParentMediumItem)
-                pMediumItem = new UIMediumItem(medium, pParentMediumItem);
-        }
-        /* Else just create item as top-level one: */
-        if (!pMediumItem)
-            pMediumItem = new UIMediumItem(medium, pTree);
-    }
-
-    /* Return medium-item: */
-    return pMediumItem;
-}
-
-void UIMediumManager::updateTabIcons(UIMediumItem *pMediumItem, ItemAction action)
-{
-    /* Make sure medium-item is valid: */
-    AssertReturnVoid(pMediumItem);
-
-    /* Prepare data for tab: */
-    int iTab = -1;
-    const QIcon *pIcon = 0;
-    bool *pfInaccessible = 0;
-    switch (pMediumItem->mediumType())
+    /* Prepare data for tab: */
+    const QIcon *pIcon = 0;
+    bool *pfInaccessible = 0;
+    const UIMediumType mediumType = pMediumItem->mediumType();
+    switch (mediumType)
     {
         case UIMediumType_HardDisk:
-            iTab = HDTab;
             pIcon = &m_iconHD;
             pfInaccessible = &m_fInaccessibleHD;
             break;
         case UIMediumType_DVD:
-            iTab = CDTab;
             pIcon = &m_iconCD;
             pfInaccessible = &m_fInaccessibleCD;
             break;
         case UIMediumType_Floppy:
-            iTab = FDTab;
             pIcon = &m_iconFD;
             pfInaccessible = &m_fInaccessibleFD;
             break;
         default:
             AssertFailed();
     }
-    AssertReturnVoid(iTab != -1 && pIcon && pfInaccessible);
+    AssertReturnVoid(pIcon && pfInaccessible);
 
     switch (action)
     {
-        case ItemAction_Added:
+        case Action_Add:
         {
             /* Does it change the overall state? */
             if (*pfInaccessible || pMediumItem->state() != KMediumState_Inaccessible)
@@ -1560,16 +1526,17 @@ void UIMediumManager::updateTabIcons(UIMediumItem *pMediumItem, ItemAction actio
 
             *pfInaccessible = true;
 
-            mTabWidget->setTabIcon(iTab, vboxGlobal().warningIcon());
+            if (m_pTabWidget)
+                m_pTabWidget->setTabIcon(tabIndex(mediumType), vboxGlobal().warningIcon());
 
             break;
         }
-        case ItemAction_Updated:
-        case ItemAction_Removed:
+        case Action_Edit:
+        case Action_Remove:
         {
             bool fCheckRest = false;
 
-            if (action == ItemAction_Updated)
+            if (action == Action_Edit)
             {
                 /* Does it change the overall state? */
                 if ((*pfInaccessible && pMediumItem->state() == KMediumState_Inaccessible) ||
@@ -1588,21 +1555,727 @@ void UIMediumManager::updateTabIcons(UIMediumItem *pMediumItem, ItemAction actio
             if (fCheckRest)
             {
                 /* Find the first KMediumState_Inaccessible item to be in charge: */
-                UIMediumItem *pInaccessibleMediumItem =
-                    searchItem(pMediumItem->treeWidget(), CheckIfSuitableByState(KMediumState_Inaccessible));
+                CheckIfSuitableByState lookForState(KMediumState_Inaccessible);
+                CheckIfSuitableByID ignoreID(pMediumItem->id());
+                UIMediumItem *pInaccessibleMediumItem = searchItem(pMediumItem->treeWidget(), lookForState, &ignoreID);
                 *pfInaccessible = !!pInaccessibleMediumItem;
             }
 
-            if (*pfInaccessible)
-                mTabWidget->setTabIcon(iTab, vboxGlobal().warningIcon());
-            else
-                mTabWidget->setTabIcon(iTab, *pIcon);
+            if (m_pTabWidget)
+            {
+                if (*pfInaccessible)
+                    m_pTabWidget->setTabIcon(tabIndex(mediumType), vboxGlobal().warningIcon());
+                else
+                    m_pTabWidget->setTabIcon(tabIndex(mediumType), *pIcon);
+            }
 
             break;
         }
     }
 }
 
+void UIMediumManager::updateInformationFields(UIMediumType type /* = UIMediumType_Invalid */)
+{
+    /* Make sure type is valid: */
+    if (type == UIMediumType_Invalid)
+        type = currentMediumType();
+
+    /* Depending on required type: */
+    switch (type)
+    {
+        case UIMediumType_HardDisk: updateInformationFieldsHD(); break;
+        case UIMediumType_DVD:      updateInformationFieldsCD(); break;
+        case UIMediumType_Floppy:   updateInformationFieldsFD(); break;
+        case UIMediumType_All:
+            updateInformationFieldsHD();
+            updateInformationFieldsCD();
+            updateInformationFieldsFD();
+            break;
+        default: break;
+    }
+}
+
+void UIMediumManager::updateInformationFieldsHD()
+{
+    /* Get current hard-drive medium-item: */
+    UIMediumItem *pCurrentItem = mediumItem(UIMediumType_HardDisk);
+
+    /* If current item is not set: */
+    if (!pCurrentItem)
+    {
+        /* Just clear information panes: */
+        for (int i = 0; i < m_fields[tabIndex(UIMediumType_HardDisk)].size(); ++i)
+            infoField(UIMediumType_HardDisk, i)->clear();
+    }
+    /* If current item is set: */
+    else
+    {
+        /* Acquire required details: */
+        const QString strDetails = pCurrentItem->details();
+        const QString strUsage = pCurrentItem->usage().isNull() ?
+                                 formatFieldText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Attached</i>"), false) :
+                                 formatFieldText(pCurrentItem->usage());
+        const QString strEncryptionPasswordID = pCurrentItem->encryptionPasswordID().isNull() ?
+                                                formatFieldText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Encrypted</i>"), false) :
+                                                formatFieldText(pCurrentItem->encryptionPasswordID());
+        const QString strID = pCurrentItem->id();
+        if (infoField(UIMediumType_HardDisk, 0))
+            infoField(UIMediumType_HardDisk, 0)->setText(pCurrentItem->hardDiskType());
+        if (infoField(UIMediumType_HardDisk, 1))
+            infoField(UIMediumType_HardDisk, 1)->setText(formatFieldText(pCurrentItem->location(), true, "end"));
+        if (infoField(UIMediumType_HardDisk, 2))
+            infoField(UIMediumType_HardDisk, 2)->setText(pCurrentItem->hardDiskFormat());
+        if (infoField(UIMediumType_HardDisk, 3))
+            infoField(UIMediumType_HardDisk, 3)->setText(strDetails);
+        if (infoField(UIMediumType_HardDisk, 4))
+            infoField(UIMediumType_HardDisk, 4)->setText(strUsage);
+        if (infoField(UIMediumType_HardDisk, 5))
+            infoField(UIMediumType_HardDisk, 5)->setText(strEncryptionPasswordID);
+        if (infoField(UIMediumType_HardDisk, 6))
+            infoField(UIMediumType_HardDisk, 6)->setText(strID);
+    }
+
+    /* Enable/disable information-panes container: */
+    if (infoContainer(UIMediumType_HardDisk))
+        infoContainer(UIMediumType_HardDisk)->setEnabled(pCurrentItem);
+}
+
+void UIMediumManager::updateInformationFieldsCD()
+{
+    /* Get current optical medium-item: */
+    UIMediumItem *pCurrentItem = mediumItem(UIMediumType_DVD);
+
+    /* If current item is not set: */
+    if (!pCurrentItem)
+    {
+        /* Just clear information panes: */
+        for (int i = 0; i < m_fields[tabIndex(UIMediumType_DVD)].size(); ++i)
+            infoField(UIMediumType_DVD, i)->clear();
+    }
+    /* If current item is set: */
+    else
+    {
+        /* Update required details: */
+        QString strUsage = pCurrentItem->usage().isNull() ?
+                           formatFieldText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Attached</i>"), false) :
+                           formatFieldText(pCurrentItem->usage());
+        const QString strID = pCurrentItem->id();
+        if (infoField(UIMediumType_DVD, 0))
+            infoField(UIMediumType_DVD, 0)->setText(formatFieldText(pCurrentItem->location(), true, "end"));
+        if (infoField(UIMediumType_DVD, 1))
+            infoField(UIMediumType_DVD, 1)->setText(strUsage);
+        if (infoField(UIMediumType_DVD, 2))
+            infoField(UIMediumType_DVD, 2)->setText(strID);
+    }
+
+    /* Enable/disable information-panes container: */
+    if (infoContainer(UIMediumType_DVD))
+        infoContainer(UIMediumType_DVD)->setEnabled(pCurrentItem);
+}
+
+void UIMediumManager::updateInformationFieldsFD()
+{
+    /* Get current floppy medium-item: */
+    UIMediumItem *pCurrentItem = mediumItem(UIMediumType_Floppy);
+
+    /* If current item is not set: */
+    if (!pCurrentItem)
+    {
+        /* Just clear information panes: */
+        for (int i = 0; i < m_fields[tabIndex(UIMediumType_Floppy)].size(); ++i)
+            infoField(UIMediumType_Floppy, i)->clear();
+    }
+    /* If current item is set: */
+    else
+    {
+        /* Update required details: */
+        QString strUsage = pCurrentItem->usage().isNull() ?
+                           formatFieldText(QApplication::translate("VBoxMediaManagerDlg", "<i>Not Attached</i>"), false) :
+                           formatFieldText(pCurrentItem->usage());
+        const QString strID = pCurrentItem->id();
+        if (infoField(UIMediumType_Floppy, 0))
+            infoField(UIMediumType_Floppy, 0)->setText(formatFieldText(pCurrentItem->location(), true, "end"));
+        if (infoField(UIMediumType_Floppy, 1))
+            infoField(UIMediumType_Floppy, 1)->setText(strUsage);
+        if (infoField(UIMediumType_Floppy, 2))
+            infoField(UIMediumType_Floppy, 2)->setText(strID);
+    }
+
+    /* Enable/disable information-panes container: */
+    if (infoContainer(UIMediumType_Floppy))
+        infoContainer(UIMediumType_Floppy)->setEnabled(pCurrentItem);
+}
+
+#ifdef Q_WS_MAC
+void UIMediumManager::cleanupMacWindowMenu()
+{
+    /* Destroy window-menu of menu-bar: */
+    UIWindowMenuManager::instance()->removeWindow(this);
+    UIWindowMenuManager::instance()->destroyMenu(this);
+}
+#endif /* Q_WS_MAC */
+
+void UIMediumManager::cleanup()
+{
+#ifdef Q_WS_MAC
+    /* Cleanup Mac window-menu: */
+    cleanupMacWindowMenu();
+#endif /* Q_WS_MAC */
+}
+
+void UIMediumManager::retranslateUi()
+{
+    // TODO: Rename translation context in .nls files!
+    /* Most of these translations were moved from VBoxMediaManagerDlg.ui file
+     * to keep old translation context.. */
+
+    /* Translate window title: */
+    setWindowTitle(QApplication::translate("VBoxMediaManagerDlg", "Virtual Media Manager"));
+
+    /* Translate menu: */
+    if (m_pMenu)
+        m_pMenu->setTitle(QApplication::translate("VBoxMediaManagerDlg", "&Actions"));
+
+    /* Translate actions: */
+    if (m_pActionCopy)
+    {
+        m_pActionCopy->setText(QApplication::translate("VBoxMediaManagerDlg", "&Copy..."));
+        m_pActionCopy->setToolTip(m_pActionCopy->text().remove('&') + QString(" (%1)").arg(m_pActionCopy->shortcut().toString()));
+        m_pActionCopy->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Copy an existing disk image file"));
+    }
+    if (m_pActionModify)
+    {
+        m_pActionModify->setText(QApplication::translate("VBoxMediaManagerDlg", "&Modify..."));
+        m_pActionModify->setToolTip(m_pActionModify->text().remove('&') + QString(" (%1)").arg(m_pActionModify->shortcut().toString()));
+        m_pActionModify->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Modify the attributes of the selected disk image file"));
+    }
+    if (m_pActionRemove)
+    {
+        m_pActionRemove->setText(QApplication::translate("VBoxMediaManagerDlg", "R&emove"));
+        m_pActionRemove->setToolTip(m_pActionRemove->text().remove('&') + QString(" (%1)").arg(m_pActionRemove->shortcut().toString()));
+        m_pActionRemove->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Remove the selected disk image file"));
+    }
+    if (m_pActionRelease)
+    {
+        m_pActionRelease->setText(QApplication::translate("VBoxMediaManagerDlg", "Re&lease"));
+        m_pActionRelease->setToolTip(m_pActionRelease->text().remove('&') + QString(" (%1)").arg(m_pActionRelease->shortcut().toString()));
+        m_pActionRelease->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Release the selected disk image file by detaching it from the machines"));
+    }
+    if (m_pActionRefresh)
+    {
+        m_pActionRefresh->setText(QApplication::translate("VBoxMediaManagerDlg", "Re&fresh"));
+        m_pActionRefresh->setToolTip(m_pActionRefresh->text().remove('&') + QString(" (%1)").arg(m_pActionRefresh->shortcut().toString()));
+        m_pActionRefresh->setStatusTip(QApplication::translate("VBoxMediaManagerDlg", "Refresh the list of disk image files"));
+    }
+
+    /* Translate tool-bar: */
+#ifdef Q_WS_MAC
+# ifdef QT_MAC_USE_COCOA
+    /* There is a bug in Qt Cocoa which result in showing a "more arrow" when
+       the necessary size of the toolbar is increased. Also for some languages
+       the with doesn't match if the text increase. So manually adjust the size
+       after changing the text. */
+    if (m_pToolBar)
+        m_pToolBar->updateLayout();
+# endif /* QT_MAC_USE_COCOA */
+#endif /* Q_WS_MAC */
+
+    /* Translate tab-widget: */
+    if (m_pTabWidget)
+    {
+        m_pTabWidget->setTabText(tabIndex(UIMediumType_HardDisk), tr("&Hard drives"));
+        m_pTabWidget->setTabText(tabIndex(UIMediumType_DVD), tr("&Optical disks"));
+        m_pTabWidget->setTabText(tabIndex(UIMediumType_Floppy), tr("&Floppy disks"));
+    }
+
+    /* Translate HD tree-widget: */
+    QTreeWidget *pTreeWidgetHD = treeWidget(UIMediumType_HardDisk);
+    if (pTreeWidgetHD)
+    {
+        pTreeWidgetHD->headerItem()->setText(0, QApplication::translate("VBoxMediaManagerDlg", "Name"));
+        pTreeWidgetHD->headerItem()->setText(1, QApplication::translate("VBoxMediaManagerDlg", "Virtual Size"));
+        pTreeWidgetHD->headerItem()->setText(2, QApplication::translate("VBoxMediaManagerDlg", "Actual Size"));
+    }
+
+    /* Translate HD information-labels: */
+    if (infoLabel(UIMediumType_HardDisk, 0))
+        infoLabel(UIMediumType_HardDisk, 0)->setText(QApplication::translate("VBoxMediaManagerDlg", "Type:"));
+    if (infoLabel(UIMediumType_HardDisk, 1))
+        infoLabel(UIMediumType_HardDisk, 1)->setText(QApplication::translate("VBoxMediaManagerDlg", "Location:"));
+    if (infoLabel(UIMediumType_HardDisk, 2))
+        infoLabel(UIMediumType_HardDisk, 2)->setText(QApplication::translate("VBoxMediaManagerDlg", "Format:"));
+    if (infoLabel(UIMediumType_HardDisk, 3))
+        infoLabel(UIMediumType_HardDisk, 3)->setText(QApplication::translate("VBoxMediaManagerDlg", "Storage details:"));
+    if (infoLabel(UIMediumType_HardDisk, 4))
+        infoLabel(UIMediumType_HardDisk, 4)->setText(QApplication::translate("VBoxMediaManagerDlg", "Attached to:"));
+    if (infoLabel(UIMediumType_HardDisk, 5))
+        infoLabel(UIMediumType_HardDisk, 5)->setText(QApplication::translate("VBoxMediaManagerDlg", "Encrypted with key:"));
+    if (infoLabel(UIMediumType_HardDisk, 6))
+        infoLabel(UIMediumType_HardDisk, 6)->setText(QApplication::translate("VBoxMediaManagerDlg", "UUID:"));
+
+    /* Translate CD tree-widget: */
+    QTreeWidget *pTreeWidgetCD = treeWidget(UIMediumType_DVD);
+    if (pTreeWidgetCD)
+    {
+        pTreeWidgetCD->headerItem()->setText(0, QApplication::translate("VBoxMediaManagerDlg", "Name"));
+        pTreeWidgetCD->headerItem()->setText(1, QApplication::translate("VBoxMediaManagerDlg", "Size"));
+    }
+
+    /* Translate CD information-labels: */
+    if (infoLabel(UIMediumType_DVD, 0))
+        infoLabel(UIMediumType_DVD, 0)->setText(QApplication::translate("VBoxMediaManagerDlg", "Location:"));
+    if (infoLabel(UIMediumType_DVD, 1))
+        infoLabel(UIMediumType_DVD, 1)->setText(QApplication::translate("VBoxMediaManagerDlg", "Attached to:"));
+    if (infoLabel(UIMediumType_DVD, 2))
+        infoLabel(UIMediumType_DVD, 2)->setText(QApplication::translate("VBoxMediaManagerDlg", "UUID:"));
+
+    /* Translate FD tree-widget: */
+    QTreeWidget *pTreeWidgetFD = treeWidget(UIMediumType_Floppy);
+    if (pTreeWidgetFD)
+    {
+        pTreeWidgetFD->headerItem()->setText(0, QApplication::translate("VBoxMediaManagerDlg", "Name"));
+        pTreeWidgetFD->headerItem()->setText(1, QApplication::translate("VBoxMediaManagerDlg", "Size"));
+    }
+
+    /* Translate FD information-labels: */
+    if (infoLabel(UIMediumType_Floppy, 0))
+        infoLabel(UIMediumType_Floppy, 0)->setText(QApplication::translate("VBoxMediaManagerDlg", "Location:"));
+    if (infoLabel(UIMediumType_Floppy, 1))
+        infoLabel(UIMediumType_Floppy, 1)->setText(QApplication::translate("VBoxMediaManagerDlg", "Attached to:"));
+    if (infoLabel(UIMediumType_Floppy, 2))
+        infoLabel(UIMediumType_Floppy, 2)->setText(QApplication::translate("VBoxMediaManagerDlg", "UUID:"));
+
+    /* Translate progress-bar: */
+    if (m_pProgressBar)
+    {
+        m_pProgressBar->setText(QApplication::translate("VBoxMediaManagerDlg", "Checking accessibility"));
+#ifdef Q_WS_MAC
+        /* Make sure that the widgets aren't jumping around
+         * while the progress-bar get visible. */
+        m_pProgressBar->adjustSize();
+        int h = m_pProgressBar->height();
+        if (m_pButtonBox)
+            m_pButtonBox->setMinimumHeight(h + 12);
+#endif /* Q_WS_MAC */
+    }
+
+    /* Full refresh if there is at least one item present: */
+    if (   (pTreeWidgetHD && pTreeWidgetHD->topLevelItemCount())
+        || (pTreeWidgetCD && pTreeWidgetCD->topLevelItemCount())
+        || (pTreeWidgetFD && pTreeWidgetFD->topLevelItemCount()))
+        sltRefreshAll();
+}
+
+UIMediumItem* UIMediumManager::createMediumItem(const UIMedium &medium)
+{
+    /* Get medium type: */
+    UIMediumType type = medium.type();
+
+    /* Create medium-item: */
+    UIMediumItem *pMediumItem = 0;
+    switch (type)
+    {
+        /* Of hard-drive type: */
+        case UIMediumType_HardDisk:
+        {
+            /* Make sure corresponding tree-widget exists: */
+            QTreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk);
+            if (pTreeWidget)
+            {
+                /* Recursively create hard-drive item: */
+                pMediumItem = createHardDiskItem(medium);
+                /* Make sure item was created: */
+                if (!pMediumItem)
+                    break;
+                if (pMediumItem->id() == m_strCurrentIdHD)
+                {
+                    setCurrentItem(pTreeWidget, pMediumItem);
+                    m_strCurrentIdHD = QString();
+                }
+            }
+            break;
+        }
+        /* Of optical-image type: */
+        case UIMediumType_DVD:
+        {
+            /* Make sure corresponding tree-widget exists: */
+            QTreeWidget *pTreeWidget = treeWidget(UIMediumType_DVD);
+            if (pTreeWidget)
+            {
+                /* Create optical-disk item: */
+                pMediumItem = new UIMediumItemCD(medium, pTreeWidget);
+                /* Make sure item was created: */
+                if (!pMediumItem)
+                    break;
+                LogRel2(("UIMediumManager: Optical medium-item with ID={%s} created.\n", medium.id().toAscii().constData()));
+                if (pMediumItem->id() == m_strCurrentIdCD)
+                {
+                    setCurrentItem(pTreeWidget, pMediumItem);
+                    m_strCurrentIdCD = QString();
+                }
+            }
+            break;
+        }
+        /* Of floppy-image type: */
+        case UIMediumType_Floppy:
+        {
+            /* Make sure corresponding tree-widget exists: */
+            QTreeWidget *pTreeWidget = treeWidget(UIMediumType_Floppy);
+            if (pTreeWidget)
+            {
+                /* Create floppy-disk item: */
+                pMediumItem = new UIMediumItemFD(medium, pTreeWidget);
+                /* Make sure item was created: */
+                if (!pMediumItem)
+                    break;
+                LogRel2(("UIMediumManager: Floppy medium-item with ID={%s} created.\n", medium.id().toAscii().constData()));
+                if (pMediumItem->id() == m_strCurrentIdFD)
+                {
+                    setCurrentItem(pTreeWidget, pMediumItem);
+                    m_strCurrentIdFD = QString();
+                }
+            }
+            break;
+        }
+        default: AssertMsgFailed(("Medium-type unknown: %d\n", type)); break;
+    }
+
+    /* Make sure item was created: */
+    if (!pMediumItem)
+        return 0;
+
+    /* Update tab-icons: */
+    updateTabIcons(pMediumItem, Action_Add);
+
+    /* Re-fetch medium-item if it is current one created: */
+    if (pMediumItem == mediumItem(type))
+        refetchCurrentMediumItem(type);
+
+    /* Return created medium-item: */
+    return pMediumItem;
+}
+
+UIMediumItem* UIMediumManager::createHardDiskItem(const UIMedium &medium)
+{
+    /* Make sure passed medium is valid: */
+    AssertReturn(!medium.medium().isNull(), 0);
+
+    /* Make sure corresponding tree-widget exists: */
+    QTreeWidget *pTreeWidget = treeWidget(UIMediumType_HardDisk);
+    if (pTreeWidget)
+    {
+        /* Search for existing medium-item: */
+        UIMediumItem *pMediumItem = searchItem(pTreeWidget, CheckIfSuitableByID(medium.id()));
+
+        /* If medium-item do not exists: */
+        if (!pMediumItem)
+        {
+            /* If medium have a parent: */
+            if (medium.parentID() != UIMedium::nullID())
+            {
+                /* Try to find parent medium-item: */
+                UIMediumItem *pParentMediumItem = searchItem(pTreeWidget, CheckIfSuitableByID(medium.parentID()));
+                /* If parent medium-item was not found: */
+                if (!pParentMediumItem)
+                {
+                    /* Make sure corresponding parent medium is already cached! */
+                    UIMedium parentMedium = vboxGlobal().medium(medium.parentID());
+                    if (parentMedium.isNull())
+                        AssertMsgFailed(("Parent medium with ID={%s} was not found!\n", medium.parentID().toAscii().constData()));
+                    /* Try to create parent medium-item: */
+                    else
+                        pParentMediumItem = createHardDiskItem(parentMedium);
+                }
+                /* If parent medium-item was found: */
+                if (pParentMediumItem)
+                {
+                    pMediumItem = new UIMediumItemHD(medium, pParentMediumItem);
+                    LogRel2(("UIMediumManager: Child hard-drive medium-item with ID={%s} created.\n", medium.id().toAscii().constData()));
+                }
+            }
+            /* Else just create item as top-level one: */
+            if (!pMediumItem)
+            {
+                pMediumItem = new UIMediumItemHD(medium, pTreeWidget);
+                LogRel2(("UIMediumManager: Root hard-drive medium-item with ID={%s} created.\n", medium.id().toAscii().constData()));
+            }
+        }
+
+        /* Return created medium-item: */
+        return pMediumItem;
+    }
+
+    /* Return null by default: */
+    return 0;
+}
+
+void UIMediumManager::updateMediumItem(const UIMedium &medium)
+{
+    /* Get medium type: */
+    UIMediumType type = medium.type();
+
+    /* Search for existing medium-item: */
+    UIMediumItem *pMediumItem = searchItem(treeWidget(type), CheckIfSuitableByID(medium.id()));
+
+    /* Create item if doesn't exists: */
+    if (!pMediumItem)
+        pMediumItem = createMediumItem(medium);
+
+    /* Make sure item was created: */
+    if (!pMediumItem)
+        return;
+
+    /* Update medium-item: */
+    pMediumItem->setMedium(medium);
+    LogRel2(("UIMediumManager: Medium-item with ID={%s} updated.\n", medium.id().toAscii().constData()));
+
+    /* Update tab-icons: */
+    updateTabIcons(pMediumItem, Action_Edit);
+
+    /* Re-fetch medium-item if it is current one updated: */
+    if (pMediumItem == mediumItem(type))
+        refetchCurrentMediumItem(type);
+}
+
+void UIMediumManager::deleteMediumItem(const QString &strMediumID)
+{
+    /* Search for corresponding tree-widget: */
+    QList<UIMediumType> types;
+    types << UIMediumType_HardDisk << UIMediumType_DVD << UIMediumType_Floppy;
+    QTreeWidget *pTreeWidget = 0;
+    UIMediumItem *pMediumItem = 0;
+    foreach (UIMediumType type, types)
+    {
+        /* Get iterated tree-widget: */
+        pTreeWidget = treeWidget(type);
+        /* Search for existing medium-item: */
+        pMediumItem = searchItem(pTreeWidget, CheckIfSuitableByID(strMediumID));
+        if (pMediumItem)
+            break;
+    }
+
+    /* Make sure item was found: */
+    if (!pMediumItem)
+        return;
+
+    /* Update tab-icons: */
+    updateTabIcons(pMediumItem, Action_Remove);
+
+    /* Delete medium-item: */
+    delete pMediumItem;
+    LogRel2(("UIMediumManager: Medium-item with ID={%s} deleted.\n", strMediumID.toAscii().constData()));
+
+    /* If there is no current medium-item now selected
+     * we have to choose first-available medium-item as current one: */
+    if (!pTreeWidget->currentItem())
+        setCurrentItem(pTreeWidget, pTreeWidget->topLevelItem(0));
+}
+
+QWidget* UIMediumManager::tab(UIMediumType type) const
+{
+    /* Determine tab index for passed medium type: */
+    int iIndex = tabIndex(type);
+
+    /* Return tab for known tab index: */
+    if (iIndex >= 0 && iIndex < m_iTabCount)
+        return iIndex < m_pTabWidget->count() ? m_pTabWidget->widget(iIndex) : 0;
+
+    /* Null by default: */
+    return 0;
+}
+
+QTreeWidget* UIMediumManager::treeWidget(UIMediumType type) const
+{
+    /* Determine tab index for passed medium type: */
+    int iIndex = tabIndex(type);
+
+    /* Return tree-widget for known tab index: */
+    if (iIndex >= 0 && iIndex < m_iTabCount)
+        return m_trees.value(iIndex, 0);
+
+    /* Null by default: */
+    return 0;
+}
+
+UIMediumItem* UIMediumManager::mediumItem(UIMediumType type) const
+{
+    /* Get corresponding tree-widget: */
+    QTreeWidget *pTreeWidget = treeWidget(type);
+    /* Return corresponding medium-item: */
+    return pTreeWidget ? toMediumItem(pTreeWidget->currentItem()) : 0;
+}
+
+QFrame* UIMediumManager::infoContainer(UIMediumType type) const
+{
+    /* Determine tab index for passed medium type: */
+    int iIndex = tabIndex(type);
+
+    /* Return information-container for known tab index: */
+    if (iIndex >= 0 && iIndex < m_iTabCount)
+        return m_containers.value(iIndex, 0);
+
+    /* Null by default: */
+    return 0;
+}
+
+QLabel* UIMediumManager::infoLabel(UIMediumType type, int iLabelIndex) const
+{
+    /* Determine tab index for passed medium type: */
+    int iIndex = tabIndex(type);
+
+    /* Look for corresponding information-label list for known tab index: */
+    if (iIndex >= 0 && iIndex < m_iTabCount)
+    {
+        const QList<QLabel*> labels = m_labels.value(iIndex, QList<QLabel*>());
+
+        /* Return information-label for known index: */
+        return labels.value(iLabelIndex, 0);
+    }
+
+    /* Null by default: */
+    return 0;
+}
+
+QILabel* UIMediumManager::infoField(UIMediumType type, int iFieldIndex) const
+{
+    /* Determine tab index for passed medium type: */
+    int iIndex = tabIndex(type);
+
+    /* Look for corresponding information-field list for known tab index: */
+    if (iIndex >= 0 && iIndex < m_iTabCount)
+    {
+        const QList<QILabel*> fields = m_fields.value(iIndex, QList<QILabel*>());
+
+        /* Return information-field for known index: */
+        return fields.value(iFieldIndex, 0);
+    }
+
+    /* Null by default: */
+    return 0;
+}
+
+UIMediumType UIMediumManager::mediumType(QTreeWidget *pTreeWidget) const
+{
+    /* Determine tab index of passed tree-widget: */
+    int iIndex = m_trees.key(pTreeWidget, -1);
+
+    /* Return medium type for known tab index: */
+    if (iIndex >= 0 && iIndex < m_iTabCount)
+        return mediumType(iIndex);
+
+    /* Invalid by default: */
+    AssertFailedReturn(UIMediumType_Invalid);
+}
+
+UIMediumType UIMediumManager::currentMediumType() const
+{
+    /* Invalid if tab-widget doesn't exists: */
+    if (!m_pTabWidget)
+        return UIMediumType_Invalid;
+
+    /* Return current medium type: */
+    return mediumType(m_pTabWidget->currentIndex());
+}
+
+QTreeWidget* UIMediumManager::currentTreeWidget() const
+{
+    /* Return current tree-widget: */
+    return treeWidget(currentMediumType());
+}
+
+UIMediumItem* UIMediumManager::currentMediumItem() const
+{
+    /* Return current medium-item: */
+    return mediumItem(currentMediumType());
+}
+
+void UIMediumManager::setCurrentItem(QTreeWidget *pTreeWidget, QTreeWidgetItem *pItem)
+{
+    /* Make sure passed tree-widget is valid: */
+    AssertPtrReturnVoid(pTreeWidget);
+
+    /* Make passed item current for passed tree-widget: */
+    pTreeWidget->setCurrentItem(pItem);
+
+    /* If non NULL item was passed: */
+    if (pItem)
+    {
+        /* Make sure it's also selected, and visible: */
+        pItem->setSelected(true);
+        pTreeWidget->scrollToItem(pItem, QAbstractItemView::EnsureVisible);
+    }
+
+    /* Re-fetch currently chosen medium-item: */
+    refetchCurrentChosenMediumItem();
+}
+
+/* static */
+int UIMediumManager::tabIndex(UIMediumType type)
+{
+    /* Return tab index corresponding to known medium type: */
+    switch (type)
+    {
+        case UIMediumType_HardDisk: return 0;
+        case UIMediumType_DVD:      return 1;
+        case UIMediumType_Floppy:   return 2;
+        default: break;
+    }
+
+    /* -1 by default: */
+    return -1;
+}
+
+/* static */
+UIMediumType UIMediumManager::mediumType(int iIndex)
+{
+    /* Return medium type corresponding to known tab index: */
+    switch (iIndex)
+    {
+        case 0: return UIMediumType_HardDisk;
+        case 1: return UIMediumType_DVD;
+        case 2: return UIMediumType_Floppy;
+        default: break;
+    }
+
+    /* Invalid by default: */
+    return UIMediumType_Invalid;
+}
+
+/* static */
+UIMediumItem* UIMediumManager::searchItem(QTreeWidget *pTreeWidget, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException)
+{
+    /* Make sure argument is valid: */
+    if (!pTreeWidget)
+        return 0;
+
+    /* Return wrapper: */
+    return searchItem(pTreeWidget->invisibleRootItem(), condition, pException);
+}
+
+/* static */
+UIMediumItem* UIMediumManager::searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException)
+{
+    /* Make sure argument is valid: */
+    if (!pParentItem)
+        return 0;
+
+    /* Verify passed item if it is of 'medium' type too: */
+    if (UIMediumItem *pMediumParentItem = toMediumItem(pParentItem))
+        if (   condition.isItSuitable(pMediumParentItem)
+            && (!pException || !pException->isItSuitable(pMediumParentItem)))
+            return pMediumParentItem;
+
+    /* Iterate other all the children: */
+    for (int iChildIndex = 0; iChildIndex < pParentItem->childCount(); ++iChildIndex)
+        if (UIMediumItem *pMediumChildItem = toMediumItem(pParentItem->child(iChildIndex)))
+            if (UIMediumItem *pRequiredMediumChildItem = searchItem(pMediumChildItem, condition, pException))
+                return pRequiredMediumChildItem;
+
+    /* Null by default: */
+    return 0;
+}
+
+/* static */
 bool UIMediumManager::checkMediumFor(UIMediumItem *pItem, Action action)
 {
     /* Make sure passed ID is valid: */
@@ -1651,62 +2324,16 @@ bool UIMediumManager::checkMediumFor(UIMediumItem *pItem, Action action)
     AssertFailedReturn(false);
 }
 
-void UIMediumManager::clearInfoPanes()
-{
-    m_pTypePane->clear(); m_pLocationPane->clear(); m_pFormatPane->clear(); m_pDetailsPane->clear(); m_pUsagePane->clear();
-    mIpCD1->clear(); mIpCD2->clear();
-    mIpFD1->clear(); mIpFD2->clear();
-}
-
-void UIMediumManager::prepareToRefresh(int iTotal)
+/* static */
+UIMediumItem* UIMediumManager::toMediumItem(QTreeWidgetItem *pItem)
 {
-    /* Info panel clearing: */
-    clearInfoPanes();
-
-    /* Prepare progressbar: */
-    if (m_pProgressBar)
-    {
-        m_pProgressBar->setMaximum(iTotal);
-        m_pProgressBar->setValue(0);
-        m_pProgressBar->setVisible(true);
-    }
-
-    /* Enable refresh action: */
-    m_pActionRefresh->setEnabled(false);
-
-    /* Set busy cursor: */
-    setCursor(QCursor(Qt::BusyCursor));
-
-    /* Store the current list selections: */
-    UIMediumItem *pMediumItem = 0;
-    pMediumItem = toMediumItem(mTwHD->currentItem());
-    if (m_strSelectedIdHD.isNull())
-        m_strSelectedIdHD = pMediumItem ? pMediumItem->id() : QString();
-    pMediumItem = toMediumItem(mTwCD->currentItem());
-    if (m_strSelectedIdCD.isNull())
-        m_strSelectedIdCD = pMediumItem ? pMediumItem->id() : QString();
-    pMediumItem = toMediumItem(mTwFD->currentItem());
-    if (m_strSelectedIdFD.isNull())
-        m_strSelectedIdFD = pMediumItem ? pMediumItem->id() : QString();
-
-    /* Finally, clear all the lists...
-     * Qt4 has interesting bug here. It sends the currentChanged (cur, prev)
-     * signal during list clearing with 'cur' set to null and 'prev' pointing
-     * to already excluded element if this element is not topLevelItem
-     * (has parent). Cause the Hard Disk list has such elements there is
-     * seg-fault when trying to make 'prev' element the current due to 'cur'
-     * is null and at least one element have to be selected (by policy).
-     * So just blocking any signals outgoing from the list during clearing. */
-    mTwHD->blockSignals(true);
-    mTwHD->clear();
-    mTwHD->blockSignals(false);
-    mTwCD->clear();
-    mTwFD->clear();
+    /* Cast passed QTreeWidgetItem to UIMediumItem if possible: */
+    return pItem && pItem->type() == UIMediumItem::Type ? static_cast<UIMediumItem*>(pItem) : 0;
 }
 
 /* static */
-QString UIMediumManager::formatPaneText(const QString &strText, bool fCompact /* = true */,
-                                        const QString &strElipsis /* = "middle" */)
+QString UIMediumManager::formatFieldText(const QString &strText, bool fCompact /* = true */,
+                                         const QString &strElipsis /* = "middle" */)
 {
     QString compactString = QString("<compact elipsis=\"%1\">").arg(strElipsis);
     QString strInfo = QString("<nobr>%1%2%3</nobr>")
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
index 1047a33..91590b2 100644
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.h
@@ -1,11 +1,10 @@
+/* $Id: UIMediumManager.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMediumManager class declaration
+ * VBox Qt GUI - UIMediumManager class declaration.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,177 +15,292 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIMediumManager_h__
-#define __UIMediumManager_h__
+#ifndef ___UIMediumManager_h___
+#define ___UIMediumManager_h___
+
+/* Qt includes: */
+#include <QMainWindow>
 
 /* GUI includes: */
-#include "UIMediumManager.gen.h"
 #include "QIWithRetranslateUI.h"
-#include "QIMainDialog.h"
 #include "UIMediumDefs.h"
 
-/* COM includes: */
-#include "COMEnums.h"
-#include "CMachine.h"
-#include "CVirtualBox.h"
-
 /* Forward declarations: */
-class UIToolBar;
+class UIMedium;
 class UIMediumItem;
+class UIToolBar;
 class UIEnumerationProgressBar;
-class UIMedium;
+class QTabWidget;
+class QTreeWidget;
+class QTreeWidgetItem;
+class QFrame;
+class QLabel;
+class QILabel;
+class QIDialogButtonBox;
 
 /** Functor interface allowing to check if passed UIMediumItem is suitable. */
 class CheckIfSuitableBy
 {
 public:
-    /** Determines whether passed UIMediumItem is suitable. */
+    /** Determines whether passed @a pItem is suitable. */
     virtual bool isItSuitable(UIMediumItem *pItem) const = 0;
 };
 
-/* Medium Manager Dialog: */
-class UIMediumManager : public QIWithRetranslateUI2<QIMainDialog>, public Ui::UIMediumManager
+/** Medium Manager dialog. */
+class UIMediumManager : public QIWithRetranslateUI<QMainWindow>
 {
     Q_OBJECT;
 
-    /* Enumerators: */
-    enum TabIndex { HDTab = 0, CDTab, FDTab };
-    enum ItemAction { ItemAction_Added, ItemAction_Updated, ItemAction_Removed };
-    enum Action { Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
+    /** Item action enumerator. */
+    enum Action { Action_Add, Action_Edit, Action_Copy, Action_Modify, Action_Remove, Action_Release };
 
-    /* Constructor/destructor: */
+    /** Constructor for UIMediumManager dialog. */
     UIMediumManager(QWidget *pCenterWidget, bool fRefresh = true);
+    /** Destructor for UIMediumManager dialog. */
     ~UIMediumManager();
 
 public:
 
-    /* Static API: Singleton stuff: */
+    /** Returns UIMediumManager singleton instance. */
     static UIMediumManager* instance();
+    /** Shows UIMediumManager singleton instance, creates new if necessary. */
     static void showModeless(QWidget *pCenterWidget, bool fRefresh = true);
 
-public slots:
-
-    /* Handler: Refresh stuff: */
-    void refreshAll();
-
 private slots:
 
-    /* Handlers: Medium-processing stuff: */
+    /** Handles VBoxGlobal::sigMediumCreated signal. */
     void sltHandleMediumCreated(const QString &strMediumID);
+    /** Handles VBoxGlobal::sigMediumDeleted signal. */
     void sltHandleMediumDeleted(const QString &strMediumID);
 
-    /* Handlers: Medium-enumeration stuff: */
+    /** Handles VBoxGlobal::sigMediumEnumerationStarted signal. */
     void sltHandleMediumEnumerationStart();
+    /** Handles VBoxGlobal::sigMediumEnumerated signal. */
     void sltHandleMediumEnumerated(const QString &strMediumID);
+    /** Handles VBoxGlobal::sigMediumEnumerationFinished signal. */
     void sltHandleMediumEnumerationFinish();
 
-    /* Handlers: Medium-modification stuff: */
+    /** Handles UIMediumManager::m_pActionCopy action triggering. */
     void sltCopyMedium();
+    /** Handles UIMediumManager::m_pActionModify action triggering. */
     void sltModifyMedium();
+    /** Handles UIMediumManager::m_pActionRemove action triggering. */
     void sltRemoveMedium();
+    /** Handles UIMediumManager::m_pActionRelease action triggering. */
     void sltReleaseMedium();
+    /** Handles UIMediumManager::m_pActionRefresh action triggering. */
+    void sltRefreshAll();
 
-    /* Handlers: Navigation stuff: */
+    /** Handles tab change case. */
     void sltHandleCurrentTabChanged();
-    void sltHandleCurrentItemChanged(QTreeWidgetItem *pItem, QTreeWidgetItem *pPrevItem = 0);
+    /** Handles item change case. */
+    void sltHandleCurrentItemChanged();
+    /** Handles item double-click case. */
     void sltHandleDoubleClick();
+    /** Handles item context-menu-call case. */
     void sltHandleContextMenuCall(const QPoint &position);
 
-    /* Handlers: Geometry stuff:  */
-    void sltMakeRequestForTableAdjustment();
+    /** Adjusts tree-widgets according content. */
     void sltPerformTablesAdjustment();
 
 private:
 
-    /* Helpers: Prepare stuff: */
+    /** General prepare wrapper. */
     void prepare();
+    /** Prepare dialog. */
     void prepareThis();
+    /** Prepare connections. */
+    void prepareConnections();
+    /** Prepare actions. */
     void prepareActions();
+    /** Prepare menu-bar. */
     void prepareMenuBar();
-    void prepareToolBar();
+    /** Prepare context-menu. */
     void prepareContextMenu();
-    void preapreTabWidget();
-    void prepareTreeWidgets();
-    void prepareTreeWidgetHD();
-    void prepareTreeWidgetCD();
-    void prepareTreeWidgetFD();
-    void prepareInformationPanes();
+    /** Prepare central-widget. */
+    void prepareCentralWidget();
+    /** Prepare tool-bar. */
+    void prepareToolBar();
+    /** Prepare tab-widget. */
+    void prepareTabWidget();
+    /** Prepare tab-widget's tab. */
+    void prepareTab(UIMediumType type);
+    /** Prepare tab-widget's tree-widget. */
+    void prepareTreeWidget(UIMediumType type, int iColumns);
+    /** Prepare tab-widget's information-container. */
+    void prepareInformationContainer(UIMediumType type, int iFields);
+    /** Prepare button-box. */
     void prepareButtonBox();
+    /** Prepare progress-bar. */
     void prepareProgressBar();
 #ifdef Q_WS_MAC
+    /** Mac OS X: Prepare <i>Window</i> menu. */
     void prepareMacWindowMenu();
 #endif /* Q_WS_MAC */
 
-    /* Helper: Populate stuff: */
-    void populateTreeWidgets();
+    /** Repopulates tree-widgets content. */
+    void repopulateTreeWidgets();
+
+    /** Updates details according latest changes in current item of passed @a type. */
+    void refetchCurrentMediumItem(UIMediumType type);
+    /** Updates details according latest changes in current item of chosen type. */
+    void refetchCurrentChosenMediumItem();
+    /** Updates details according latest changes in all current items. */
+    void refetchCurrentMediumItems();
+
+    /** Update actions according currently chosen item. */
+    void updateActions();
+    /** Update action icons according currently chosen tab. */
+    void updateActionIcons();
+    /** Update tab icons according last @a action happened with @a pItem. */
+    void updateTabIcons(UIMediumItem *pItem, Action action);
+    /** Update information fields of passed medium @a type. */
+    void updateInformationFields(UIMediumType type = UIMediumType_Invalid);
+    /** Update information fields for hard-drive tab. */
+    void updateInformationFieldsHD();
+    /** Update information fields for optical-disk tab. */
+    void updateInformationFieldsCD();
+    /** Update information fields for floppy-disk tab. */
+    void updateInformationFieldsFD();
 
-    /* Helpers: Cleanup stuff: */
 #ifdef Q_WS_MAC
+    /** Mac OS X: Cleanup <i>Window</i> menu. */
     void cleanupMacWindowMenu();
 #endif /* Q_WS_MAC */
+    /** General cleanup wrapper. */
     void cleanup();
 
-    /* Handler: Translation stuff: */
+    /** Translates dialog content. */
     void retranslateUi();
 
-    /* Helpers: Medium-modification stuff: */
-    bool releaseMediumFrom(const UIMedium &medium, const QString &strMachineId);
-    bool releaseHardDiskFrom(const UIMedium &medium, CMachine &machine);
-    bool releaseOpticalDiskFrom(const UIMedium &medium, CMachine &machine);
-    bool releaseFloppyDiskFrom(const UIMedium &medium, CMachine &machine);
-
-    /* Internal API: Tree-widget access stuff: */
+    /** Creates UIMediumItem for corresponding @a medium. */
+    UIMediumItem* createMediumItem(const UIMedium &medium);
+    /** Creates UIMediumItemHD for corresponding @a medium. */
+    UIMediumItem* createHardDiskItem(const UIMedium &medium);
+    /** Updates UIMediumItem for corresponding @a medium. */
+    void updateMediumItem(const UIMedium &medium);
+    /** Deletes UIMediumItem for corresponding @a strMediumID. */
+    void deleteMediumItem(const QString &strMediumID);
+
+    /** Returns tab for passed medium @a type. */
+    QWidget* tab(UIMediumType type) const;
+    /** Returns tree-widget for passed medium @a type. */
     QTreeWidget* treeWidget(UIMediumType type) const;
-    UIMediumType currentTreeWidgetType() const;
+    /** Returns item for passed medium @a type. */
+    UIMediumItem* mediumItem(UIMediumType type) const;
+    /** Returns information-container for passed medium @a type. */
+    QFrame* infoContainer(UIMediumType type) const;
+    /** Returns information-label for passed medium @a type and @a iLabelIndex. */
+    QLabel* infoLabel(UIMediumType type, int iLabelIndex) const;
+    /** Returns information-field for passed medium @a type and @a iFieldIndex. */
+    QILabel* infoField(UIMediumType type, int iFieldIndex) const;
+
+    /** Returns medium type for passed @a pTreeWidget. */
+    UIMediumType mediumType(QTreeWidget *pTreeWidget) const;
+
+    /** Returns current medium type. */
+    UIMediumType currentMediumType() const;
+    /** Returns current tree-widget. */
     QTreeWidget* currentTreeWidget() const;
-    void setCurrentItem(QTreeWidget *pTree, QTreeWidgetItem *pItem);
-    UIMediumItem* toMediumItem(QTreeWidgetItem *pItem) const;
-    UIMediumItem* searchItem(QTreeWidget *pTree, const CheckIfSuitableBy &functor) const;
-    UIMediumItem* searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &functor) const;
-    UIMediumItem* createHardDiskItem(QTreeWidget *pTree, const UIMedium &medium) const;
+    /** Returns current item. */
+    UIMediumItem* currentMediumItem() const;
+
+    /** Defines current item for passed @a pTreeWidget as @a pItem. */
+    void setCurrentItem(QTreeWidget *pTreeWidget, QTreeWidgetItem *pItem);
 
-    /* Internal API: Tab-widget access stuff: */
-    void updateTabIcons(UIMediumItem *pItem, ItemAction action);
+    /** Returns tab index for passed UIMediumType. */
+    static int tabIndex(UIMediumType type);
+    /** Returns UIMediumType for passed tab index. */
+    static UIMediumType mediumType(int iIndex);
 
-    /* Helpers: Other stuff: */
-    bool checkMediumFor(UIMediumItem *pItem, Action action);
-    void clearInfoPanes();
-    void prepareToRefresh(int iTotal = 0);
+    /** Performs search for the @a pTree child which corresponds to the @a condition but not @a pException. */
+    static UIMediumItem* searchItem(QTreeWidget *pTree, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
+    /** Performs search for the @a pParentItem child which corresponds to the @a condition but not @a pException. */
+    static UIMediumItem* searchItem(QTreeWidgetItem *pParentItem, const CheckIfSuitableBy &condition, CheckIfSuitableBy *pException = 0);
 
-    /* Static helper: Formatting stuff: */
-    static QString formatPaneText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle");
+    /** Checks if @a action can be used for @a pItem. */
+    static bool checkMediumFor(UIMediumItem *pItem, Action action);
 
-    /* Variable: Singleton instance: */
+    /** Casts passed QTreeWidgetItem @a pItem to UIMediumItem if possible. */
+    static UIMediumItem* toMediumItem(QTreeWidgetItem *pItem);
+
+    /** Format information-field content. */
+    static QString formatFieldText(const QString &strText, bool fCompact = true, const QString &strElipsis = "middle");
+
+    /** UIMediumManager singleton instance. */
     static UIMediumManager *m_spInstance;
 
-    /* Variables: General stuff: */
-    CVirtualBox m_vbox;
-    QWidget *m_pCenterWidget;
+    /** @name General variables.
+     * @{ */
+    /** Widget to center UIMediumManager according. */
+    QWidget *m_pPseudoParentWidget;
+    /** Holds whether UIMediumManager should be refreshed on invoke. */
     bool m_fRefresh;
-
-    /* Variables: Tab-widget stuff: */
+    /** Holds whether UIMediumManager should preserve current item change. */
+    bool m_fPreventChangeCurrentItem;
+    /** @} */
+
+    /** @name Tab-widget variables.
+     * @{ */
+    /** Tab-widget itself. */
+    QTabWidget *m_pTabWidget;
+    /** Tab-widget tab-count. */
+    const int m_iTabCount;
+    /** Tree-widgets. */
+    QMap<int, QTreeWidget*> m_trees;
+    /** Information-containers. */
+    QMap<int, QFrame*> m_containers;
+    /** Information-container labels. */
+    QMap<int, QList<QLabel*> > m_labels;
+    /** Information-container fields. */
+    QMap<int, QList<QILabel*> > m_fields;
+    /** Holds whether hard-drive tab-widget have inaccessible item. */
     bool m_fInaccessibleHD;
+    /** Holds whether optical-disk tab-widget have inaccessible item. */
     bool m_fInaccessibleCD;
+    /** Holds whether floppy-disk tab-widget have inaccessible item. */
     bool m_fInaccessibleFD;
+    /** Holds cached hard-drive tab-widget icon. */
     const QIcon m_iconHD;
+    /** Holds cached optical-disk tab-widget icon. */
     const QIcon m_iconCD;
+    /** Holds cached floppy-disk tab-widget icon. */
     const QIcon m_iconFD;
-    QString m_strSelectedIdHD;
-    QString m_strSelectedIdCD;
-    QString m_strSelectedIdFD;
-
-    /* Variables: Menu & Toolbar stuff: */
+    /** Holds current hard-drive tree-view item ID. */
+    QString m_strCurrentIdHD;
+    /** Holds current optical-disk tree-view item ID. */
+    QString m_strCurrentIdCD;
+    /** Holds current floppy-disk tree-view item ID. */
+    QString m_strCurrentIdFD;
+    /** @} */
+
+    /** @name Tool-bar and menu variables.
+     * @{ */
+    /** Tool-bar widget. */
     UIToolBar *m_pToolBar;
-    QMenu     *m_pContextMenu;
-    QMenu     *m_pMenu;
-    QAction   *m_pActionCopy;
-    QAction   *m_pActionModify;
-    QAction   *m_pActionRemove;
-    QAction   *m_pActionRelease;
-    QAction   *m_pActionRefresh;
-
-    /* Variable: Progress-bar stuff: */
+    /** Context menu object. */
+    QMenu *m_pContextMenu;
+    /** Menu-bar menu object. */
+    QMenu *m_pMenu;
+    /** Action to <i>copy</i> current item. */
+    QAction *m_pActionCopy;
+    /** Action to <i>modify</i> current item. */
+    QAction *m_pActionModify;
+    /** Action to <i>remove</i> current item. */
+    QAction *m_pActionRemove;
+    /** Action to <i>release</i> current item. */
+    QAction *m_pActionRelease;
+    /** Action to <i>refresh</i> current item. */
+    QAction *m_pActionRefresh;
+    /** @} */
+
+    /** @name Button-box variables.
+     * @{ */
+    /** Dialog button-box. */
+    QIDialogButtonBox *m_pButtonBox;
+    /** Progress-bar widget. */
     UIEnumerationProgressBar *m_pProgressBar;
+    /** @} */
 };
 
-#endif /* __UIMediumManager_h__ */
+#endif /* !___UIMediumManager_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.ui b/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.ui
deleted file mode 100644
index c30fd45..0000000
--- a/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.ui
+++ /dev/null
@@ -1,321 +0,0 @@
-<ui version="4.0" >
- <comment>
- VBox frontends: Qt4 GUI ("VirtualBox"):
-
- Copyright (C) 2006-2012 Oracle Corporation
-
- This file is part of VirtualBox Open Source Edition (OSE), as
- available from http://www.virtualbox.org. This file is free software;
- you can redistribute it and/or modify it under the terms of the GNU
- General Public License (GPL) as published by the Free Software
- Foundation, in version 2 as it comes in the "COPYING" file of the
- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- </comment>
- <class>UIMediumManager</class>
- <widget class="QMainWindow" name="UIMediumManager" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>620</width>
-    <height>460</height>
-   </rect>
-  </property>
-  <property name="minimumSize" >
-   <size>
-    <width>280</width>
-    <height>190</height>
-   </size>
-  </property>
-  <widget class="QWidget" name="mCentralWidget" >
-   <layout class="QVBoxLayout" >
-    <item>
-     <widget class="QITabWidget" name="mTabWidget" >
-      <property name="sizePolicy" >
-       <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-       </sizepolicy>
-      </property>
-      <widget class="QWidget" name="mTabHD" >
-       <layout class="QVBoxLayout" >
-        <item>
-         <widget class="QITreeWidget" name="mTwHD" >
-          <property name="contextMenuPolicy" >
-           <enum>Qt::CustomContextMenu</enum>
-          </property>
-          <property name="acceptDrops" >
-           <bool>true</bool>
-          </property>
-          <property name="horizontalScrollBarPolicy" >
-           <enum>Qt::ScrollBarAlwaysOff</enum>
-          </property>
-          <property name="alternatingRowColors" >
-           <bool>true</bool>
-          </property>
-          <property name="allColumnsShowFocus" >
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QFrame" name="mHDContainer" >
-          <property name="frameShape" >
-           <enum>QFrame::Box</enum>
-          </property>
-          <property name="frameShadow" >
-           <enum>QFrame::Sunken</enum>
-          </property>
-          <layout class="QGridLayout" >
-           <property name="verticalSpacing" >
-            <number>0</number>
-           </property>
-           <property name="margin" >
-            <number>5</number>
-           </property>
-           <item row="0" column="0" >
-            <widget class="QLabel" name="m_pTypeLabel" />
-           </item>
-           <item row="0" column="1" >
-            <widget class="QILabel" name="m_pTypePane">
-             <property name="sizePolicy">
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding">
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="0" >
-            <widget class="QLabel" name="m_pLocationLabel" />
-           </item>
-           <item row="1" column="1" >
-            <widget class="QILabel" name="m_pLocationPane" >
-             <property name="sizePolicy" >
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-           <item row="2" column="0" >
-            <widget class="QLabel" name="m_pFormatLabel" />
-           </item>
-           <item row="2" column="1" >
-            <widget class="QILabel" name="m_pFormatPane" >
-             <property name="sizePolicy" >
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-           <item row="3" column="0" >
-            <widget class="QLabel" name="m_pDetailsLabel" />
-           </item>
-           <item row="3" column="1" >
-            <widget class="QILabel" name="m_pDetailsPane" >
-             <property name="sizePolicy" >
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-           <item row="4" column="0" >
-            <widget class="QLabel" name="m_pUsageLabel" />
-           </item>
-           <item row="4" column="1" >
-            <widget class="QILabel" name="m_pUsagePane" >
-             <property name="sizePolicy" >
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-      <widget class="QWidget" name="mTabCD" >
-       <layout class="QVBoxLayout" >
-        <item>
-             <widget class="QITreeWidget" name="mTwCD" >
-          <property name="contextMenuPolicy" >
-           <enum>Qt::CustomContextMenu</enum>
-          </property>
-          <property name="acceptDrops" >
-           <bool>true</bool>
-          </property>
-          <property name="horizontalScrollBarPolicy" >
-           <enum>Qt::ScrollBarAlwaysOff</enum>
-          </property>
-          <property name="alternatingRowColors" >
-           <bool>true</bool>
-          </property>
-          <property name="allColumnsShowFocus" >
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QFrame" name="mCDContainer" >
-          <property name="frameShape" >
-           <enum>QFrame::Box</enum>
-          </property>
-          <property name="frameShadow" >
-           <enum>QFrame::Sunken</enum>
-          </property>
-          <layout class="QGridLayout" >
-           <property name="verticalSpacing" >
-            <number>0</number>
-           </property>
-           <property name="margin" >
-            <number>5</number>
-           </property>
-           <item row="0" column="0" >
-            <widget class="QLabel" name="mLbCD1" />
-           </item>
-           <item row="0" column="1" >
-            <widget class="QILabel" name="mIpCD1" >
-             <property name="sizePolicy" >
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="0" >
-            <widget class="QLabel" name="mLbCD2" />
-           </item>
-           <item row="1" column="1" >
-            <widget class="QILabel" name="mIpCD2" >
-             <property name="sizePolicy" >
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-      <widget class="QWidget" name="mTabFD" >
-       <layout class="QVBoxLayout" >
-        <item>
-         <widget class="QITreeWidget" name="mTwFD" >
-          <property name="contextMenuPolicy" >
-           <enum>Qt::CustomContextMenu</enum>
-          </property>
-          <property name="acceptDrops" >
-           <bool>true</bool>
-          </property>
-          <property name="horizontalScrollBarPolicy" >
-           <enum>Qt::ScrollBarAlwaysOff</enum>
-          </property>
-          <property name="alternatingRowColors" >
-           <bool>true</bool>
-          </property>
-          <property name="allColumnsShowFocus" >
-           <bool>true</bool>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QFrame" name="mFDContainer" >
-          <property name="frameShape" >
-           <enum>QFrame::Box</enum>
-          </property>
-          <property name="frameShadow" >
-           <enum>QFrame::Sunken</enum>
-          </property>
-          <layout class="QGridLayout" >
-           <property name="horizontalSpacing" >
-            <number>6</number>
-           </property>
-           <property name="verticalSpacing" >
-            <number>0</number>
-           </property>
-           <property name="margin" >
-            <number>5</number>
-           </property>
-           <item row="0" column="0" >
-            <widget class="QLabel" name="mLbFD1" />
-           </item>
-           <item row="0" column="1" >
-            <widget class="QILabel" name="mIpFD1" >
-             <property name="sizePolicy" >
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-           <item row="1" column="0" >
-            <widget class="QLabel" name="mLbFD2" />
-           </item>
-           <item row="1" column="1" >
-            <widget class="QILabel" name="mIpFD2" >
-             <property name="sizePolicy" >
-              <sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
-               <horstretch>0</horstretch>
-               <verstretch>0</verstretch>
-              </sizepolicy>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </widget>
-        </item>
-       </layout>
-      </widget>
-     </widget>
-    </item>
-    <item>
-     <widget class="QIDialogButtonBox" name="mButtonBox" >
-      <property name="standardButtons" >
-       <set>QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
-      </property>
-     </widget>
-    </item>
-   </layout>
-  </widget>
-  <widget class="QStatusBar" name="mStatusBar" />
- </widget>
- <customwidgets>
-  <customwidget>
-   <class>QIDialogButtonBox</class>
-   <extends>QDialogButtonBox</extends>
-   <header>QIDialogButtonBox.h</header>
-  </customwidget>
-  <customwidget>
-   <class>QITreeWidget</class>
-   <extends>QTreeWidget</extends>
-   <header>QITreeWidget.h</header>
-  </customwidget>
-  <customwidget>
-   <class>QILabel</class>
-   <extends>QLabel</extends>
-   <header>QILabel.h</header>
-  </customwidget>
-  <customwidget>
-   <class>QITabWidget</class>
-   <extends>QTabWidget</extends>
-   <header>QITabWidget.h</header>
-  </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.cpp b/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.cpp
index 620849a..5e22680 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIDownloader.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDownloader class implementation
+ * VBox Qt GUI - UIDownloader class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include <UINetworkReply.h>
-#include "UIDownloader.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "VBoxUtils.h"
+# include <UINetworkReply.h>
+# include "UIDownloader.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "VBoxUtils.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Starting routine: */
 void UIDownloader::start()
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.h b/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.h
index f1bf989..854047f 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIDownloader.h
@@ -1,7 +1,6 @@
+/* $Id: UIDownloader.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDownloader class declaration
+ * VBox Qt GUI - UIDownloader class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp
index c7cdba9..1334ed6 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIDownloaderAdditions.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDownloaderAdditions class implementation
+ * VBox Qt GUI - UIDownloaderAdditions class implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QDir>
-#include <QFile>
+# include <QDir>
+# include <QFile>
 
 /* Local includes: */
-#include "UIDownloaderAdditions.h"
-#include "UINetworkReply.h"
-#include "QIFileDialog.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIModalWindowManager.h"
+# include "UIDownloaderAdditions.h"
+# include "UINetworkReply.h"
+# include "QIFileDialog.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIModalWindowManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static */
 UIDownloaderAdditions* UIDownloaderAdditions::m_spInstance = 0;
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.h b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.h
index db83d4f..9d1454c 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.h
@@ -1,7 +1,6 @@
+/* $Id: UIDownloaderAdditions.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDownloaderAdditions class declaration
+ * VBox Qt GUI - UIDownloaderAdditions class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp
index a9a230e..0cb95f3 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIDownloaderExtensionPack.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDownloaderExtensionPack class implementation
+ * VBox Qt GUI - UIDownloaderExtensionPack class implementation.
  */
 
 /*
@@ -17,18 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QDir>
-#include <QFile>
-#include <iprt/sha.h>
+# include <QDir>
+# include <QFile>
 
 /* Local includes: */
-#include "UIDownloaderExtensionPack.h"
-#include "UINetworkReply.h"
-#include "QIFileDialog.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIModalWindowManager.h"
+# include "UIDownloaderExtensionPack.h"
+# include "UINetworkReply.h"
+# include "QIFileDialog.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIModalWindowManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <iprt/sha.h>
+
 
 /* static */
 UIDownloaderExtensionPack* UIDownloaderExtensionPack::m_spInstance = 0;
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.h b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.h
index a93fc6c..1b91c61 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.h
@@ -1,7 +1,6 @@
+/* $Id: UIDownloaderExtensionPack.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDownloaderExtensionPack class declaration
+ * VBox Qt GUI - UIDownloaderExtensionPack class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.cpp b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.cpp
index 1394f98..d5e17c6 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIDownloaderUserManual.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDownloaderUserManual class implementation
+ * VBox Qt GUI - UIDownloaderUserManual class implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QDir>
-#include <QFile>
+# include <QDir>
+# include <QFile>
 
 /* Local includes: */
-#include "UIDownloaderUserManual.h"
-#include "UINetworkReply.h"
-#include "QIFileDialog.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIModalWindowManager.h"
+# include "UIDownloaderUserManual.h"
+# include "UINetworkReply.h"
+# include "QIFileDialog.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIModalWindowManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static */
 UIDownloaderUserManual* UIDownloaderUserManual::m_spInstance = 0;
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.h b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.h
index 968df61..fc182cf 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.h
@@ -1,7 +1,6 @@
+/* $Id: UIDownloaderUserManual.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDownloaderUserManual class declaration
+ * VBox Qt GUI - UIDownloaderUserManual class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkCustomer.cpp b/src/VBox/Frontends/VirtualBox/src/net/UINetworkCustomer.cpp
index 4d9bb1f..597949f 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkCustomer.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkCustomer.cpp
@@ -1,8 +1,6 @@
 /* $Id: UINetworkCustomer.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkCustomer class implementation
+ * VBox Qt GUI - UINetworkCustomer class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Global includes: */
-#include <QNetworkRequest>
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QNetworkRequest>
 
 /* Local includes: */
-#include "UINetworkCustomer.h"
-#include "UINetworkManager.h"
+# include "UINetworkCustomer.h"
+# include "UINetworkManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UINetworkCustomer::UINetworkCustomer()
     : QObject(0)
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkCustomer.h b/src/VBox/Frontends/VirtualBox/src/net/UINetworkCustomer.h
index 9e94e8d..d3b3707 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkCustomer.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkCustomer.h
@@ -1,7 +1,6 @@
+/* $Id: UINetworkCustomer.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UINetworkCustomer class declaration
+ * VBox Qt GUI - UINetworkCustomer class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkDefs.h b/src/VBox/Frontends/VirtualBox/src/net/UINetworkDefs.h
index 17097f6..bb5099c 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkDefs.h
@@ -1,7 +1,6 @@
+/* $Id: UINetworkDefs.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * Network routine related declarations
+ * VBox Qt GUI - Network routine related declarations.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.cpp b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.cpp
index 0b751b4..7a6358b 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.cpp
@@ -1,8 +1,6 @@
 /* $Id: UINetworkManager.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkManager stuff implementation
+ * VBox Qt GUI - UINetworkManager stuff implementation.
  */
 
 /*
@@ -17,16 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QWidget>
+# include <QWidget>
 
 /* Local includes: */
-#include "UINetworkManager.h"
-#include "UINetworkManagerDialog.h"
-#include "UINetworkManagerIndicator.h"
-#include "UINetworkRequest.h"
-#include "UINetworkCustomer.h"
-#include "VBoxGlobal.h"
+# include "UINetworkManager.h"
+# include "UINetworkManagerDialog.h"
+# include "UINetworkManagerIndicator.h"
+# include "UINetworkRequest.h"
+# include "UINetworkCustomer.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UINetworkManager* UINetworkManager::m_pInstance = 0;
 
@@ -114,7 +119,7 @@ void UINetworkManager::prepare()
     if (!vboxGlobal().isVMConsoleProcess())
     {
         m_pNetworkManagerIndicator = new UINetworkManagerIndicator;
-        connect(m_pNetworkManagerIndicator, SIGNAL(mouseDoubleClicked(QIStateIndicator *, QMouseEvent *)), this, SLOT(show()));
+        connect(m_pNetworkManagerIndicator, SIGNAL(sigMouseDoubleClick(QIStatusBarIndicator*, QMouseEvent*)), this, SLOT(show()));
     }
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h
index 0b22fdf..91903ba 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h
@@ -1,7 +1,6 @@
+/* $Id: UINetworkManager.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkManager stuff declaration
+ * VBox Qt GUI - UINetworkManager stuff declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.cpp b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.cpp
index 5eef076..d2b1704 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.cpp
@@ -1,8 +1,6 @@
 /* $Id: UINetworkManagerDialog.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkManagerDialog stuff implementation
+ * VBox Qt GUI - UINetworkManagerDialog stuff implementation.
  */
 
 /*
@@ -17,24 +15,31 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QVBoxLayout>
-#include <QLabel>
-#include <QPushButton>
-#include <QStatusBar>
-#include <QKeyEvent>
+# include <QVBoxLayout>
+# include <QLabel>
+# include <QPushButton>
+# include <QStatusBar>
+# include <QKeyEvent>
 
 /* Local includes: */
-#include "UINetworkManagerDialog.h"
-#include "UINetworkManager.h"
-#include "UINetworkRequest.h"
-#include "UINetworkRequestWidget.h"
-#include "UINetworkCustomer.h"
-#include "UIIconPool.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIModalWindowManager.h"
-#include "QIDialogButtonBox.h"
+# include "UINetworkManagerDialog.h"
+# include "UINetworkManager.h"
+# include "UINetworkRequest.h"
+# include "UINetworkRequestWidget.h"
+# include "UINetworkCustomer.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIModalWindowManager.h"
+# include "QIDialogButtonBox.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 void UINetworkManagerDialog::showNormal()
 {
@@ -51,7 +56,7 @@ void UINetworkManagerDialog::showNormal()
 UINetworkManagerDialog::UINetworkManagerDialog()
 {
     /* Apply window icons: */
-    setWindowIcon(UIIconPool::iconSetFull(QSize (32, 32), QSize (16, 16), ":/nw_32px.png", ":/nw_16px.png"));
+    setWindowIcon(UIIconPool::iconSetFull(":/nw_32px.png", ":/nw_16px.png"));
 
     /* Do not count that window as important for application,
      * it will NOT be taken into account when other top-level windows will be closed: */
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.h b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.h
index 9296a1d..683473b 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.h
@@ -1,7 +1,6 @@
+/* $Id: UINetworkManagerDialog.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkManagerDialog stuff declaration
+ * VBox Qt GUI - UINetworkManagerDialog stuff declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.cpp b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.cpp
index 35d8a2b..2ebde6b 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.cpp
@@ -1,8 +1,6 @@
 /* $Id: UINetworkManagerIndicator.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkManagerIndicator stuff implementation
+ * VBox Qt GUI - UINetworkManagerIndicator stuff implementation.
  */
 
 /*
@@ -17,10 +15,17 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Local includes: */
-#include "UINetworkManagerIndicator.h"
-#include "UINetworkRequest.h"
-#include "VBoxGlobal.h"
+# include "UINetworkManagerIndicator.h"
+# include "UINetworkRequest.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UINetworkManagerIndicator::UINetworkManagerIndicator()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.h b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.h
index b2110ac..163c637 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerIndicator.h
@@ -1,7 +1,6 @@
+/* $Id: UINetworkManagerIndicator.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkManagerIndicator stuff declaration
+ * VBox Qt GUI - UINetworkManagerIndicator stuff declaration.
  */
 
 /*
@@ -24,7 +23,7 @@
 #include <QUuid>
 
 /* Local includes: */
-#include "QIStateIndicator.h"
+#include "QIStatusBarIndicator.h"
 
 /* Forward declarations: */
 class UINetworkRequest;
@@ -38,10 +37,15 @@ enum UINetworkManagerIndicatorState
 };
 
 /* Network-manager status-bar indicator: */
-class UINetworkManagerIndicator : public QIStateIndicator
+class UINetworkManagerIndicator : public QIStateStatusBarIndicator
 {
     Q_OBJECT;
 
+public:
+
+    /** Update routine. */
+    void updateAppearance();
+
 protected:
 
     /* Allow creation of UINetworkManagerIndicator to UINetworkManager: */
@@ -88,7 +92,6 @@ private:
 
     /* Update stuff: */
     void recalculateIndicatorState();
-    void updateAppearance();
 
     /* Variables: */
     QVector<QUuid> m_ids;
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp b/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp
index 9c33dc1..df6ccd7 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp
@@ -1,8 +1,6 @@
 /* $Id: UINetworkReply.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkReply stuff implementation
+ * VBox Qt GUI - UINetworkReply stuff implementation.
  */
 
 /*
@@ -17,24 +15,32 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
-#include <QFile>
-#include <QThread>
-#include <QRegExp>
+# include <QDir>
+# include <QFile>
+# include <QThread>
+# include <QRegExp>
 
 /* GUI includes: */
-#include "UINetworkReply.h"
-#include "UINetworkManager.h"
-#include "VBoxGlobal.h"
-#include "VBoxUtils.h"
+# include "UINetworkReply.h"
+# include "UINetworkManager.h"
+# include "VBoxGlobal.h"
+# include "VBoxUtils.h"
 
 /* Other VBox includes; */
-#include <iprt/initterm.h>
+# include <iprt/initterm.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #include <iprt/http.h>
 #include <iprt/err.h>
 #include <iprt/zip.h>
 
+
 /* Our network-reply thread: */
 class UINetworkReplyPrivateThread : public QThread
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.h b/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.h
index 9222810..4375c8c 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.h
@@ -1,7 +1,6 @@
+/* $Id: UINetworkReply.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkReply stuff declaration
+ * VBox Qt GUI - UINetworkReply stuff declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.cpp b/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.cpp
index 3c6b194..c20edf5 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.cpp
@@ -1,8 +1,6 @@
 /* $Id: UINetworkRequest.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkRequest stuff implementation
+ * VBox Qt GUI - UINetworkRequest stuff implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QNetworkReply>
+# include <QNetworkReply>
 
 /* GUI includes: */
-#include "UINetworkRequest.h"
-#include "UINetworkRequestWidget.h"
-#include "UINetworkManager.h"
-#include "UINetworkManagerDialog.h"
-#include "UINetworkManagerIndicator.h"
-#include "UINetworkCustomer.h"
-#include "VBoxGlobal.h"
+# include "UINetworkRequest.h"
+# include "UINetworkRequestWidget.h"
+# include "UINetworkManager.h"
+# include "UINetworkManagerDialog.h"
+# include "UINetworkManagerIndicator.h"
+# include "UINetworkCustomer.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Constructor: */
 UINetworkRequest::UINetworkRequest(const QNetworkRequest &request, UINetworkRequestType type, const QString &strDescription,
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h b/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h
index fba7109..062f9e9 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h
@@ -1,7 +1,6 @@
+/* $Id: UINetworkRequest.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkRequest stuff declaration
+ * VBox Qt GUI - UINetworkRequest stuff declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.cpp b/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.cpp
index dd4b206..e412f2c 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.cpp
@@ -1,8 +1,6 @@
 /* $Id: UINetworkRequestWidget.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkRequestWidget stuff implementation
+ * VBox Qt GUI - UINetworkRequestWidget stuff implementation.
  */
 
 /*
@@ -17,19 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QTimer>
-#include <QGridLayout>
-#include <QProgressBar>
+# include <QTimer>
+# include <QGridLayout>
+# include <QProgressBar>
 
 /* Local includes: */
-#include "UINetworkRequestWidget.h"
-#include "UINetworkRequest.h"
-#include "UINetworkManager.h"
-#include "UINetworkManagerDialog.h"
-#include "UIIconPool.h"
-#include "QIToolButton.h"
-#include "QIRichTextLabel.h"
+# include "UINetworkRequestWidget.h"
+# include "UINetworkRequest.h"
+# include "UINetworkManager.h"
+# include "UINetworkManagerDialog.h"
+# include "UIIconPool.h"
+# include "QIToolButton.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UINetworkRequestWidget::UINetworkRequestWidget(UINetworkManagerDialog *pParent, UINetworkRequest *pNetworkRequest)
     : QIWithRetranslateUI<UIPopupBox>(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.h b/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.h
index bce4e5a..c16216c 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequestWidget.h
@@ -1,7 +1,6 @@
+/* $Id: UINetworkRequestWidget.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINetworkRequestWidget stuff declaration
+ * VBox Qt GUI - UINetworkRequestWidget stuff declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.cpp b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.cpp
index 35c9f4e..b9a2b91 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIUpdateDefs.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * Update routine related implementations
+ * VBox Qt GUI - Update routine related implementations.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QCoreApplication>
-#include <QStringList>
+# include <QCoreApplication>
+# include <QStringList>
 
 /* Local includes: */
-#include "UIUpdateDefs.h"
-#include "VBoxGlobal.h"
+# include "UIUpdateDefs.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static: */
 VBoxUpdateDayList VBoxUpdateData::m_dayList = VBoxUpdateDayList();
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.h b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.h
index e8805fe..5bf8a91 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateDefs.h
@@ -1,7 +1,6 @@
+/* $Id: UIUpdateDefs.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * Update routine related declarations
+ * VBox Qt GUI - Update routine related declarations.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
index bd31443..ed945c3 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIUpdateManager.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIUpdateManager class implementation
+ * VBox Qt GUI - UIUpdateManager class implementation.
  */
 
 /*
@@ -17,33 +15,41 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QTimer>
-#include <QDir>
-#include <QPointer>
-#include <VBox/version.h>
+# include <QTimer>
+# include <QDir>
+# include <QPointer>
+# include <VBox/version.h>
 
 /* GUI includes: */
-#include "UIUpdateDefs.h"
-#include "UIUpdateManager.h"
-#include "UINetworkManager.h"
-#include "UINetworkCustomer.h"
-#include "UINetworkRequest.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIModalWindowManager.h"
-#include "VBoxUtils.h"
-#include "UIDownloaderExtensionPack.h"
-#include "UIGlobalSettingsExtension.h"
-#include "QIProcess.h"
+# include "UIUpdateDefs.h"
+# include "UIUpdateManager.h"
+# include "UINetworkManager.h"
+# include "UINetworkCustomer.h"
+# include "UINetworkRequest.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIExtraDataManager.h"
+# include "UIModalWindowManager.h"
+# include "VBoxUtils.h"
+# include "UIDownloaderExtensionPack.h"
+# include "UIGlobalSettingsExtension.h"
+# include "QIProcess.h"
 
 /* COM includes: */
-#include "CExtPack.h"
-#include "CExtPackManager.h"
+# include "CExtPack.h"
+# include "CExtPackManager.h"
 
 /* Other VBox includes: */
-#include <iprt/path.h>
-#include <iprt/system.h>
+# include <iprt/path.h>
+# include <iprt/system.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Forward declarations: */
 class UIUpdateStep;
@@ -160,16 +166,6 @@ private:
     /* Prepare network request: */
     void prepareNetworkRequest()
     {
-        /* Calculate the count of checks left: */
-        int cCount = 1;
-        QString strCount = vboxGlobal().virtualBox().GetExtraData(GUI_UpdateCheckCount);
-        if (!strCount.isEmpty())
-        {
-            bool ok = false;
-            int c = strCount.toLongLong(&ok);
-            if (ok) cCount = c;
-        }
-
         /* Compose query: */
         QUrl url(m_url);
         url.addQueryItem("platform", vboxGlobal().virtualBox().GetPackageType());
@@ -188,8 +184,8 @@ private:
             url.addQueryItem("version", QString("%1_%2").arg(vboxGlobal().virtualBox().GetVersion())
                                                         .arg(vboxGlobal().virtualBox().GetRevision()));
         }
-        url.addQueryItem("count", QString::number(cCount));
-        url.addQueryItem("branch", VBoxUpdateData(vboxGlobal().virtualBox().GetExtraData(GUI_UpdateDate)).branchName());
+        url.addQueryItem("count", QString::number(gEDataManager->applicationUpdateCheckCounter()));
+        url.addQueryItem("branch", VBoxUpdateData(gEDataManager->applicationUpdateData()).branchName());
         QString strUserAgent(QString("VirtualBox %1 <%2>").arg(vboxGlobal().virtualBox().GetVersion()).arg(platformInfo()));
 
         /* Send GET request: */
@@ -225,16 +221,8 @@ private:
                 msgCenter().showUpdateNotFound();
         }
 
-        /* Save left count of checks: */
-        int cCount = 1;
-        QString strCount = vboxGlobal().virtualBox().GetExtraData(GUI_UpdateCheckCount);
-        if (!strCount.isEmpty())
-        {
-            bool ok = false;
-            int c = strCount.toLongLong(&ok);
-            if (ok) cCount = c;
-        }
-        vboxGlobal().virtualBox().SetExtraData(GUI_UpdateCheckCount, QString("%1").arg((qulonglong)cCount + 1));
+        /* Increment update check counter: */
+        gEDataManager->incrementApplicationUpdateCheckCounter();
 
         /* Notify about step completion: */
         emit sigStepComplete();
@@ -458,9 +446,7 @@ UIUpdateManager::UIUpdateManager()
 
 #ifdef VBOX_WITH_UPDATE_REQUEST
     /* Ask updater to check for the first time: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    if (VBoxGlobal::shouldWeAllowApplicationUpdate(vbox) &&
-        !vboxGlobal().isVMConsoleProcess())
+    if (gEDataManager->applicationUpdateEnabled() && !vboxGlobal().isVMConsoleProcess())
         QTimer::singleShot(0, this, SLOT(sltCheckIfUpdateIsNecessary()));
 #endif /* VBOX_WITH_UPDATE_REQUEST */
 }
@@ -490,7 +476,7 @@ void UIUpdateManager::sltCheckIfUpdateIsNecessary(bool fForceCall /* = false */)
     m_fIsRunning = true;
 
     /* Load/decode curent update data: */
-    VBoxUpdateData currentData(vboxGlobal().virtualBox().GetExtraData(GUI_UpdateDate));
+    VBoxUpdateData currentData(gEDataManager->applicationUpdateData());
 
     /* If update is really necessary: */
     if (fForceCall || currentData.isNeedToCheck())
@@ -508,10 +494,10 @@ void UIUpdateManager::sltCheckIfUpdateIsNecessary(bool fForceCall /* = false */)
 void UIUpdateManager::sltHandleUpdateFinishing()
 {
     /* Load/decode curent update data: */
-    VBoxUpdateData currentData(vboxGlobal().virtualBox().GetExtraData(GUI_UpdateDate));
+    VBoxUpdateData currentData(gEDataManager->applicationUpdateData());
     /* Encode/save new update data: */
     VBoxUpdateData newData(currentData.periodIndex(), currentData.branchIndex());
-    vboxGlobal().virtualBox().SetExtraData(GUI_UpdateDate, newData.data());
+    gEDataManager->setApplicationUpdateData(newData.data());
 
 #ifdef VBOX_WITH_UPDATE_REQUEST
     /* Ask updater to check for the next time: */
diff --git a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.h b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.h
index 0ecb008..cd031b4 100644
--- a/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.h
@@ -1,7 +1,6 @@
+/* $Id: UIUpdateManager.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIUpdateManager class declaration
+ * VBox Qt GUI - UIUpdateManager class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/objects/UIRichTextString.cpp b/src/VBox/Frontends/VirtualBox/src/objects/UIRichTextString.cpp
new file mode 100644
index 0000000..be86bf5
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/objects/UIRichTextString.cpp
@@ -0,0 +1,233 @@
+/* $Id: UIRichTextString.cpp $ */
+/** @file
+ * VBox Qt GUI - UIRichTextString class implementation.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QApplication>
+# include <QPalette>
+
+/* GUI includes: */
+# include "UIRichTextString.h"
+
+/* Other VBox includes: */
+# include "iprt/assert.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+const QString UIRichTextString::m_sstrAny = QString("[\\s\\S]*");
+const QMap<UIRichTextString::Type, QString> UIRichTextString::m_sPatterns = populatePatterns();
+const QMap<UIRichTextString::Type, bool> UIRichTextString::m_sPatternHasMeta = populatePatternHasMeta();
+
+UIRichTextString::UIRichTextString(Type type /* = Type_None */)
+    : m_type(type)
+    , m_strString(QString())
+    , m_strStringMeta(QString())
+{
+}
+
+UIRichTextString::UIRichTextString(const QString &strString, Type type /* = Type_None */, const QString &strStringMeta /* = QString() */)
+    : m_type(type)
+    , m_strString(strString)
+    , m_strStringMeta(strStringMeta)
+{
+    //printf("Creating new UIRichTextString with string=\"%s\" and string-meta=\"%s\"\n",
+    //       m_strString.toAscii().constData(), m_strStringMeta.toAscii().constData());
+    parse();
+}
+
+UIRichTextString::~UIRichTextString()
+{
+    /* Erase the map: */
+    qDeleteAll(m_strings.begin(), m_strings.end());
+    m_strings.clear();
+}
+
+QString UIRichTextString::toString() const
+{
+    /* Add own string first: */
+    QString strString = m_strString;
+
+    /* Add all the strings of children finally: */
+    foreach (const int &iPosition, m_strings.keys())
+        strString.insert(iPosition, m_strings.value(iPosition)->toString());
+
+    /* Return result: */
+    return strString;
+}
+
+QList<QTextLayout::FormatRange> UIRichTextString::formatRanges(int iShift /* = 0 */) const
+{
+    /* Prepare format range list: */
+    QList<QTextLayout::FormatRange> ranges;
+
+    /* Add own format range first: */
+    QTextLayout::FormatRange range;
+    range.start = iShift;
+    range.length = toString().size();
+    range.format = textCharFormat(m_type);
+    /* Enable anchor if present: */
+    if (!m_strAnchor.isNull())
+    {
+        range.format.setAnchorHref(m_strAnchor);
+        /* Highlight anchor if hovered: */
+        if (range.format.anchorHref() == m_strHoveredAnchor)
+            range.format.setForeground(qApp->palette().color(QPalette::Link));
+    }
+    ranges.append(range);
+
+    /* Add all the format ranges of children finally: */
+    foreach (const int &iPosition, m_strings.keys())
+        ranges.append(m_strings.value(iPosition)->formatRanges(iShift + iPosition));
+
+    /* Return result: */
+    return ranges;
+}
+
+void UIRichTextString::setHoveredAnchor(const QString &strHoveredAnchor)
+{
+    /* Define own hovered anchor first: */
+    m_strHoveredAnchor = strHoveredAnchor;
+
+    /* Propagate hovered anchor to children finally: */
+    foreach (const int &iPosition, m_strings.keys())
+        m_strings.value(iPosition)->setHoveredAnchor(m_strHoveredAnchor);
+}
+
+void UIRichTextString::parse()
+{
+    /* Assign the meta to anchor directly for now,
+     * will do a separate parsing when there will
+     * be more than one type of meta: */
+    if (!m_strStringMeta.isNull())
+        m_strAnchor = m_strStringMeta;
+
+    /* Parse the passed QString with all the known patterns: */
+    foreach (const Type &enmPattern, m_sPatterns.keys())
+    {
+        /* Get the current pattern: */
+        const QString strPattern = m_sPatterns.value(enmPattern);
+
+        /* Recursively parse the string: */
+        int iMaxLevel = 0;
+        do
+        {
+            /* Search for the maximum level of the current pattern: */
+            iMaxLevel = searchForMaxLevel(m_strString, strPattern, strPattern);
+            //printf(" Maximum level for the pattern \"%s\" is %d.\n",
+            //       strPattern.toAscii().constData(), iMaxLevel);
+            /* If current pattern of at least level 1 is found: */
+            if (iMaxLevel > 0)
+            {
+                /* Compose full pattern of the corresponding level: */
+                const QString strFullPattern = composeFullPattern(strPattern, strPattern, iMaxLevel);
+                //printf("  Full pattern: %s\n", strFullPattern.toAscii().constData());
+                QRegExp regExp(strFullPattern);
+                regExp.setMinimal(true);
+                const int iPosition = regExp.indexIn(m_strString);
+                AssertReturnVoid(iPosition != -1);
+                if (iPosition != -1)
+                {
+                    /* Cut the found string: */
+                    m_strString.remove(iPosition, regExp.cap(0).size());
+                    /* And paste that string as our child: */
+                    const bool fPatterHasMeta = m_sPatternHasMeta.value(enmPattern);
+                    const QString strSubString = !fPatterHasMeta ? regExp.cap(1) : regExp.cap(2);
+                    const QString strSubMeta   = !fPatterHasMeta ? QString()     : regExp.cap(1);
+                    m_strings.insert(iPosition, new UIRichTextString(strSubString, enmPattern, strSubMeta));
+                }
+            }
+        }
+        while (iMaxLevel > 0);
+    }
+}
+
+/* static */
+QMap<UIRichTextString::Type, QString> UIRichTextString::populatePatterns()
+{
+    QMap<Type, QString> patterns;
+    patterns.insert(Type_Anchor, QString("<a href=([^>]+)>(%1)</a>"));
+    patterns.insert(Type_Bold,   QString("<b>(%1)</b>"));
+    patterns.insert(Type_Italic, QString("<i>(%1)</i>"));
+    return patterns;
+}
+
+/* static */
+QMap<UIRichTextString::Type, bool> UIRichTextString::populatePatternHasMeta()
+{
+    QMap<Type, bool> patternHasMeta;
+    patternHasMeta.insert(Type_Anchor, true);
+    patternHasMeta.insert(Type_Bold,   false);
+    patternHasMeta.insert(Type_Italic, false);
+    return patternHasMeta;
+}
+
+/* static */
+int UIRichTextString::searchForMaxLevel(const QString &strString, const QString &strPattern,
+                                        const QString &strCurrentPattern, int iCurrentLevel /* = 0 */)
+{
+    QRegExp regExp(strCurrentPattern.arg(m_sstrAny));
+    regExp.setMinimal(true);
+    if (regExp.indexIn(strString) != -1)
+        return searchForMaxLevel(strString, strPattern,
+                                 strCurrentPattern.arg(m_sstrAny + strPattern + m_sstrAny),
+                                 iCurrentLevel + 1);
+    return iCurrentLevel;
+}
+
+/* static */
+QString UIRichTextString::composeFullPattern(const QString &strPattern,
+                                             const QString &strCurrentPattern, int iCurrentLevel)
+{
+    if (iCurrentLevel > 1)
+        return composeFullPattern(strPattern,
+                                  strCurrentPattern.arg(m_sstrAny + strPattern + m_sstrAny),
+                                  iCurrentLevel - 1);
+    return strCurrentPattern.arg(m_sstrAny);
+}
+
+/* static */
+QTextCharFormat UIRichTextString::textCharFormat(Type type)
+{
+    QTextCharFormat format;
+    switch (type)
+    {
+        case Type_Anchor:
+        {
+            format.setAnchor(true);
+            break;
+        }
+        case Type_Bold:
+        {
+            QFont font = format.font();
+            font.setBold(true);
+            format.setFont(font);
+            break;
+        }
+        case Type_Italic:
+        {
+            QFont font = format.font();
+            font.setItalic(true);
+            format.setFont(font);
+            break;
+        }
+    }
+    return format;
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/objects/UIRichTextString.h b/src/VBox/Frontends/VirtualBox/src/objects/UIRichTextString.h
new file mode 100644
index 0000000..4b6ebae
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/objects/UIRichTextString.h
@@ -0,0 +1,114 @@
+/* $Id: UIRichTextString.h $ */
+/** @file
+ * VBox Qt GUI - UIRichTextString class declaration.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIRichTextString_h___
+#define ___UIRichTextString_h___
+
+/* Qt includes: */
+#include <QTextLayout>
+
+/** Rich text string implementation which parses the passed QString
+  * and holds it as the tree of the formatted rich text blocks. */
+class UIRichTextString
+{
+public:
+
+    /** Rich text block types. */
+    enum Type
+    {
+        Type_None,
+        Type_Anchor,
+        Type_Bold,
+        Type_Italic,
+    };
+
+    /** Default (empty) constructor. */
+    UIRichTextString(Type type = Type_None);
+
+    /** Constructor taking passed QString.
+      * @param strString     holds the string being parsed and held as the tree of rich text blocks,
+      * @param type          holds the type of <i>this</i> rich text block,
+      * @param strStringMeta holds the string containing meta data describing <i>this</i> rich text block. */
+    UIRichTextString(const QString &strString, Type type = Type_None, const QString &strStringMeta = QString());
+
+    /** Destructor. */
+    ~UIRichTextString();
+
+    /** Returns the QString representation. */
+    QString toString() const;
+
+    /** Returns the list of existing format ranges appropriate for QTextLayout.
+      * @param iShift holds the shift of <i>this</i> rich text block accordig to it's root. */
+    QList<QTextLayout::FormatRange> formatRanges(int iShift = 0) const;
+
+    /** Defines the anchor to highlight in <i>this</i> rich text block and in it's children. */
+    void setHoveredAnchor(const QString &strHoveredAnchor);
+
+private:
+
+    /** Parses the string. */
+    void parse();
+
+    /** Used to populate const static map of known patterns.
+      * @note Keep it sync with the method below - #populatePatternHasMeta(). */
+    static QMap<Type, QString> populatePatterns();
+    /** Used to populate const static map of meta flags for the known patterns.
+      * @note Keep it sync with the method above - #populatePatterns(). */
+    static QMap<Type, bool> populatePatternHasMeta();
+
+    /** Recursively searching for the maximum level of the passed pattern.
+      * @param strString         holds the string to check for the current (recursively advanced) pattern in,
+      * @param strPattern        holds the etalon pattern to recursively advance the current pattern with,
+      * @param strCurrentPattern holds the current (recursively advanced) pattern to check for the presence of,
+      * @param iCurrentLevel     holds the current level of the recursively advanced pattern. */
+    static int searchForMaxLevel(const QString &strString, const QString &strPattern,
+                                 const QString &strCurrentPattern, int iCurrentLevel = 0);
+
+    /** Recursively composing the pattern of the maximum level.
+      * @param strPattern        holds the etalon pattern to recursively update the current pattern with,
+      * @param strCurrentPattern holds the current (recursively advanced) pattern,
+      * @param iCurrentLevel     holds the amount of the levels left to recursively advance current pattern. */
+    static QString composeFullPattern(const QString &strPattern,
+                                      const QString &strCurrentPattern, int iCurrentLevel);
+
+    /** Composes the QTextCharFormat correpoding to passed @a type. */
+    static QTextCharFormat textCharFormat(Type type);
+
+    /** Holds the type of <i>this</i> rich text block. */
+    Type m_type;
+    /** Holds the string of <i>this</i> rich text block. */
+    QString m_strString;
+    /** Holds the string meta data of <i>this</i> rich text block. */
+    QString m_strStringMeta;
+    /** Holds the children of <i>this</i> rich text block. */
+    QMap<int, UIRichTextString*> m_strings;
+
+    /** Holds the anchor of <i>this</i> rich text block. */
+    QString m_strAnchor;
+    /** Holds the anchor to highlight in <i>this</i> rich text block and in it's children. */
+    QString m_strHoveredAnchor;
+
+    /** Holds the <i>any</i> string pattern. */
+    static const QString m_sstrAny;
+    /** Holds the map of known patterns. */
+    static const QMap<Type, QString> m_sPatterns;
+    /** Holds the map of meta flags for the known patterns. */
+    static const QMap<Type, bool> m_sPatternHasMeta;
+};
+
+#endif /* !___UIRichTextString_h___ */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/UIDesktopServices.h b/src/VBox/Frontends/VirtualBox/src/platform/UIDesktopServices.h
index 575d2e6..d12b6a6 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/UIDesktopServices.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/UIDesktopServices.h
@@ -1,7 +1,6 @@
+/* $Id: UIDesktopServices.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Desktop Services.
+ * VBox Qt GUI - Desktop Services..
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/CocoaEventHelper.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/CocoaEventHelper.h
index d86432f..6c8574a 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/CocoaEventHelper.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/CocoaEventHelper.h
@@ -1,8 +1,7 @@
+/* $Id: CocoaEventHelper.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of utility functions for handling Darwin Cocoa specific event
- * handling tasks
+ * VBox Qt GUI - Declarations of utility functions for handling Darwin Cocoa
+ * specific event handling tasks.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/CocoaEventHelper.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/CocoaEventHelper.mm
index 9b86ac3..0720cd2 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/CocoaEventHelper.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/CocoaEventHelper.mm
@@ -1,9 +1,6 @@
 /* $Id: CocoaEventHelper.mm $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of utility functions for handling Darwin Cocoa specific event
- * handling tasks
+ * VBox Qt GUI - Declarations of utility functions for handling Darwin Cocoa specific event handling tasks.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.h
index 1965c1f..06cb979 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/DarwinKeyboard.h
@@ -1,5 +1,6 @@
+/* $Id:  $ */
 /** @file
- * Common GUI Library - Darwin Keyboard routines.
+ * VBox Qt GUI - Common GUI Library - Darwin Keyboard routines.
  *
  * @todo Move this up somewhere so that the two SDL GUIs can use this code too.
  */
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/DockIconPreview.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/DockIconPreview.h
index c4ffaef..1ca4681 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/DockIconPreview.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/DockIconPreview.h
@@ -1,8 +1,6 @@
 /* $Id: DockIconPreview.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDockIconPreview class declaration
+ * VBox Qt GUI - UIDockIconPreview class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.cpp b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.cpp
index 8517b22..dff7977 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.cpp
@@ -1,6 +1,6 @@
 /* $Id: UIAbstractDockIconPreview.cpp $ */
 /** @file
- * Qt GUI - Realtime Dock Icon Preview
+ * VBox Qt GUI - Realtime Dock Icon Preview
  */
 
 /*
@@ -15,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* VBox includes */
-#include "UIAbstractDockIconPreview.h"
-#include "UIFrameBuffer.h"
-#include "UIMachineLogic.h"
-#include "UIMachineView.h"
-#include "UISession.h"
+# include "UIAbstractDockIconPreview.h"
+# include "UIFrameBuffer.h"
+# include "UIMachineLogic.h"
+# include "UIMachineView.h"
+# include "UISession.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIAbstractDockIconPreview::UIAbstractDockIconPreview(UISession * /* pSession */, const QPixmap& /* overlayImage */)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.h
index 12ca44d..c4cbf3d 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIAbstractDockIconPreview.h
@@ -1,8 +1,6 @@
 /* $Id: UIAbstractDockIconPreview.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Abstract class for the dock icon preview
+ * VBox Qt GUI - Abstract class for the dock icon preview.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h
index 3cb743a..37eaa98 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h
@@ -1,5 +1,6 @@
+/* $Id: UICocoaApplication.h $ */
 /** @file
- * UICocoaApplication - C++ interface to NSApplication for handling -sendEvent.
+ * VBox Qt GUI - UICocoaApplication - C++ interface to NSApplication for handling -sendEvent.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm
index f64fc20..e2e251f 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm
@@ -1,6 +1,6 @@
 /* $Id: UICocoaApplication.mm $ */
 /** @file
- * UICocoaApplication - C++ interface to NSApplication for handling -sendEvent.
+ * VBox Qt GUI - UICocoaApplication - C++ interface to NSApplication for handling -sendEvent.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaDockIconPreview.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaDockIconPreview.h
index 45745a6..205a8e6 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaDockIconPreview.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaDockIconPreview.h
@@ -1,8 +1,6 @@
 /* $Id: UICocoaDockIconPreview.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UICocoaDockIconPreview class declaration
+ * VBox Qt GUI - UICocoaDockIconPreview class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaDockIconPreview.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaDockIconPreview.mm
index 152e5d1..f1639df 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaDockIconPreview.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaDockIconPreview.mm
@@ -1,8 +1,6 @@
 /* $Id: UICocoaDockIconPreview.mm $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Cocoa helper for the dock icon preview
+ * VBox Qt GUI - Cocoa helper for the dock icon preview.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.h
index 31185a0..30ce95d 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.h
@@ -1,7 +1,6 @@
+/* $Id: UICocoaSpecialControls.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxCocoaSpecialControls class declaration
+ * VBox Qt GUI - VBoxCocoaSpecialControls class declaration.
  */
 
 /*
@@ -24,27 +23,14 @@
 
 /* Qt includes */
 #include <QWidget>
-
-/* Qt forward includes */
-class QMacCocoaViewContainer;
+#include <QMacCocoaViewContainer>
 
 /* Add typedefs for Cocoa types */
 ADD_COCOA_NATIVE_REF(NSButton);
 ADD_COCOA_NATIVE_REF(NSSegmentedControl);
 ADD_COCOA_NATIVE_REF(NSSearchField);
 
-class UICocoaWrapper: public QWidget
-{
-public:
-    UICocoaWrapper(QWidget *pParent = 0);
-
-protected:
-    virtual void resizeEvent(QResizeEvent *pEvent);
-
-    QMacCocoaViewContainer *m_pContainer;
-};
-
-class UICocoaButton: public UICocoaWrapper
+class UICocoaButton: public QMacCocoaViewContainer
 {
     Q_OBJECT
 
@@ -56,7 +42,7 @@ public:
         ResetButton
     };
 
-    UICocoaButton(CocoaButtonType aType, QWidget *pParent = 0);
+    UICocoaButton(QWidget *pParent, CocoaButtonType type);
     ~UICocoaButton();
 
     QSize sizeHint() const;
@@ -70,11 +56,10 @@ signals:
     void clicked(bool fChecked = false);
 
 private:
-    /* Private member vars */
-    NativeNSButtonRef m_pNativeRef;
+    NativeNSButtonRef nativeRef() const { return static_cast<NativeNSButtonRef>(cocoaView()); }
 };
 
-class UICocoaSegmentedButton: public UICocoaWrapper
+class UICocoaSegmentedButton: public QMacCocoaViewContainer
 {
     Q_OBJECT
 
@@ -85,7 +70,7 @@ public:
         TexturedRoundedSegment
     };
 
-    UICocoaSegmentedButton(int count, CocoaSegmentType type = RoundRectSegment, QWidget *pParent = 0);
+    UICocoaSegmentedButton(QWidget *pParent, int count, CocoaSegmentType type = RoundRectSegment);
     ~UICocoaSegmentedButton();
 
     QSize sizeHint() const;
@@ -102,16 +87,15 @@ signals:
     void clicked(int iSegment, bool fChecked = false);
 
 private:
-    /* Private member vars */
-    NativeNSSegmentedControlRef m_pNativeRef;
+    NativeNSSegmentedControlRef nativeRef() const { return static_cast<NativeNSSegmentedControlRef>(cocoaView()); }
 };
 
-class UICocoaSearchField: public UICocoaWrapper
+class UICocoaSearchField: public QMacCocoaViewContainer
 {
     Q_OBJECT
 
 public:
-    UICocoaSearchField(QWidget* pParent = 0);
+    UICocoaSearchField(QWidget* pParent);
     ~UICocoaSearchField();
 
     QSize sizeHint() const;
@@ -130,8 +114,7 @@ signals:
     void textChanged(const QString& strText);
 
 private:
-    /* Private member vars */
-    NativeNSSearchFieldRef m_pNativeRef;
+    NativeNSSearchFieldRef nativeRef() const { return static_cast<NativeNSSearchFieldRef>(cocoaView()); }
 };
 
 #endif /* ___darwin_UICocoaSpecialControls_h__ */
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm
index 878f016..de05921 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaSpecialControls.mm
@@ -1,8 +1,6 @@
 /* $Id: UICocoaSpecialControls.mm $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UICocoaSpecialControls implementation
+ * VBox Qt GUI - UICocoaSpecialControls implementation.
  */
 
 /*
@@ -235,74 +233,75 @@ NSRect darwinCenterRectVerticalTo(NSRect aRect, const NSRect& aToRect)
 /*
  * Public classes
  */
-UICocoaWrapper::UICocoaWrapper(QWidget *pParent /* = 0 */)
-    : QWidget(pParent)
-    , m_pContainer(0)
-{
-}
-
-void UICocoaWrapper::resizeEvent(QResizeEvent *pEvent)
+UICocoaButton::UICocoaButton(QWidget *pParent, CocoaButtonType type)
+    : QMacCocoaViewContainer(0, pParent)
 {
-    if (m_pContainer)
-        m_pContainer->resize(pEvent->size());
-    QWidget::resizeEvent(pEvent);
-}
+    /* Prepare auto-release pool: */
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-UICocoaButton::UICocoaButton(CocoaButtonType aType, QWidget *pParent /* = 0 */)
-  : UICocoaWrapper(pParent)
-{
+    /* Prepare native button reference: */
+    NativeNSButtonRef pNativeRef;
     NSRect initFrame;
 
-    switch (aType)
+    /* Configure button: */
+    switch (type)
     {
         case HelpButton:
         {
-            m_pNativeRef = [[NSButton alloc] init];
-            [m_pNativeRef setTitle: @""];
-            [m_pNativeRef setBezelStyle: NSHelpButtonBezelStyle];
-            [m_pNativeRef setBordered: YES];
-            [m_pNativeRef setAlignment: NSCenterTextAlignment];
-            [m_pNativeRef sizeToFit];
-            initFrame = [m_pNativeRef frame];
+            pNativeRef = [[NSButton alloc] init];
+            [pNativeRef setTitle: @""];
+            [pNativeRef setBezelStyle: NSHelpButtonBezelStyle];
+            [pNativeRef setBordered: YES];
+            [pNativeRef setAlignment: NSCenterTextAlignment];
+            [pNativeRef sizeToFit];
+            initFrame = [pNativeRef frame];
             initFrame.size.width += 12; /* Margin */
-            [m_pNativeRef setFrame:initFrame];
+            [pNativeRef setFrame:initFrame];
             break;
         };
         case CancelButton:
         {
-            m_pNativeRef = [[NSButton alloc] initWithFrame: NSMakeRect(0, 0, 13, 13)];
-            [m_pNativeRef setTitle: @""];
-            [m_pNativeRef setBezelStyle:NSShadowlessSquareBezelStyle];
-            [m_pNativeRef setButtonType:NSMomentaryChangeButton];
-            [m_pNativeRef setImage: [NSImage imageNamed: NSImageNameStopProgressFreestandingTemplate]];
-            [m_pNativeRef setBordered: NO];
-            [[m_pNativeRef cell] setImageScaling: NSImageScaleProportionallyDown];
-            initFrame = [m_pNativeRef frame];
+            pNativeRef = [[NSButton alloc] initWithFrame: NSMakeRect(0, 0, 13, 13)];
+            [pNativeRef setTitle: @""];
+            [pNativeRef setBezelStyle:NSShadowlessSquareBezelStyle];
+            [pNativeRef setButtonType:NSMomentaryChangeButton];
+            [pNativeRef setImage: [NSImage imageNamed: NSImageNameStopProgressFreestandingTemplate]];
+            [pNativeRef setBordered: NO];
+            [[pNativeRef cell] setImageScaling: NSImageScaleProportionallyDown];
+            initFrame = [pNativeRef frame];
             break;
         }
         case ResetButton:
         {
-            m_pNativeRef = [[NSButton alloc] initWithFrame: NSMakeRect(0, 0, 13, 13)];
-            [m_pNativeRef setTitle: @""];
-            [m_pNativeRef setBezelStyle:NSShadowlessSquareBezelStyle];
-            [m_pNativeRef setButtonType:NSMomentaryChangeButton];
-            [m_pNativeRef setImage: [NSImage imageNamed: NSImageNameRefreshFreestandingTemplate]];
-            [m_pNativeRef setBordered: NO];
-            [[m_pNativeRef cell] setImageScaling: NSImageScaleProportionallyDown];
-            initFrame = [m_pNativeRef frame];
+            pNativeRef = [[NSButton alloc] initWithFrame: NSMakeRect(0, 0, 13, 13)];
+            [pNativeRef setTitle: @""];
+            [pNativeRef setBezelStyle:NSShadowlessSquareBezelStyle];
+            [pNativeRef setButtonType:NSMomentaryChangeButton];
+            [pNativeRef setImage: [NSImage imageNamed: NSImageNameRefreshFreestandingTemplate]];
+            [pNativeRef setBordered: NO];
+            [[pNativeRef cell] setImageScaling: NSImageScaleProportionallyDown];
+            initFrame = [pNativeRef frame];
             break;
         }
     }
 
+    /* Install click listener: */
     UIButtonTargetPrivate *bt = [[UIButtonTargetPrivate alloc] initWithObjectAndLionTrouble:this];
-    [m_pNativeRef setTarget:bt];
-    [m_pNativeRef setAction:@selector(clicked:)];
+    [pNativeRef setTarget:bt];
+    [pNativeRef setAction:@selector(clicked:)];
+
+    /* Put the button to the QCocoaViewContainer: */
+    setCocoaView(pNativeRef);
+    /* Release our reference, since our super class
+     * takes ownership and we don't need it anymore. */
+    [pNativeRef release];
 
-    /* Create the container widget and attach the native view. */
-    m_pContainer = new QMacCocoaViewContainer(m_pNativeRef, this);
-    /* Finally resize the widget */
+    /* Finally resize the widget: */
     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     setFixedSize(NSWidth(initFrame), NSHeight(initFrame));
+
+    /* Cleanup auto-release pool: */
+    [pool release];
 }
 
 UICocoaButton::~UICocoaButton()
@@ -311,7 +310,7 @@ UICocoaButton::~UICocoaButton()
 
 QSize UICocoaButton::sizeHint() const
 {
-    NSRect frame = [m_pNativeRef frame];
+    NSRect frame = [nativeRef() frame];
     return QSize(frame.size.width, frame.size.height);
 }
 
@@ -319,12 +318,12 @@ void UICocoaButton::setText(const QString& strText)
 {
     QString s(strText);
     /* Set it for accessibility reasons as alternative title */
-    [m_pNativeRef setAlternateTitle: ::darwinQStringToNSString(s.remove('&'))];
+    [nativeRef() setAlternateTitle: ::darwinQStringToNSString(s.remove('&'))];
 }
 
 void UICocoaButton::setToolTip(const QString& strTip)
 {
-    [m_pNativeRef setToolTip: ::darwinQStringToNSString(strTip)];
+    [nativeRef() setToolTip: ::darwinQStringToNSString(strTip)];
 }
 
 void UICocoaButton::onClicked()
@@ -332,43 +331,59 @@ void UICocoaButton::onClicked()
     emit clicked(false);
 }
 
-UICocoaSegmentedButton::UICocoaSegmentedButton(int count, CocoaSegmentType type /* = RoundRectSegment */, QWidget *pParent /* = 0 */)
-  : UICocoaWrapper(pParent)
+UICocoaSegmentedButton::UICocoaSegmentedButton(QWidget *pParent, int count, CocoaSegmentType type /* = RoundRectSegment */)
+    : QMacCocoaViewContainer(0, pParent)
 {
+    /* Prepare auto-release pool: */
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+    /* Prepare native segmented-button reference: */
+    NativeNSSegmentedControlRef pNativeRef;
     NSRect initFrame;
 
-    m_pNativeRef = [[NSSegmentedControl alloc] init];
-    [m_pNativeRef setSegmentCount:count];
+    /* Configure segmented-button: */
+    pNativeRef = [[NSSegmentedControl alloc] init];
+    [pNativeRef setSegmentCount:count];
     switch (type)
     {
         case RoundRectSegment:
         {
-            [[m_pNativeRef cell] setTrackingMode: NSSegmentSwitchTrackingMomentary];
-            [m_pNativeRef setFont: [NSFont controlContentFontOfSize:
+            [pNativeRef setSegmentStyle: NSSegmentStyleRoundRect];
+            [pNativeRef setFont: [NSFont controlContentFontOfSize:
                 [NSFont systemFontSizeForControlSize: NSSmallControlSize]]];
-            [m_pNativeRef setSegmentStyle:NSSegmentStyleRoundRect];
+            [[pNativeRef cell] setTrackingMode: NSSegmentSwitchTrackingMomentary];
             break;
         }
         case TexturedRoundedSegment:
         {
-            [m_pNativeRef setSegmentStyle:NSSegmentStyleTexturedRounded];
-            [m_pNativeRef setFont: [NSFont controlContentFontOfSize:
+            [pNativeRef setSegmentStyle: NSSegmentStyleTexturedRounded];
+            [pNativeRef setFont: [NSFont controlContentFontOfSize:
                 [NSFont systemFontSizeForControlSize: NSSmallControlSize]]];
             break;
         }
     }
-    [m_pNativeRef sizeToFit];
 
+    /* Calculate corresponding size: */
+    [pNativeRef sizeToFit];
+    initFrame = [pNativeRef frame];
+
+    /* Install click listener: */
     UISegmentedButtonTargetPrivate *bt = [[UISegmentedButtonTargetPrivate alloc] initWithObject1:this];
-    [m_pNativeRef setTarget:bt];
-    [m_pNativeRef setAction:@selector(segControlClicked:)];
+    [pNativeRef setTarget:bt];
+    [pNativeRef setAction:@selector(segControlClicked:)];
+
+    /* Put the button to the QCocoaViewContainer: */
+    setCocoaView(pNativeRef);
+    /* Release our reference, since our super class
+     * takes ownership and we don't need it anymore. */
+    [pNativeRef release];
 
-    initFrame = [m_pNativeRef frame];
-    /* Create the container widget and attach the native view. */
-    m_pContainer = new QMacCocoaViewContainer(m_pNativeRef, this);
-    /* Finally resize the widget */
+    /* Finally resize the widget: */
     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     setFixedSize(NSWidth(initFrame), NSHeight(initFrame));
+
+    /* Cleanup auto-release pool: */
+    [pool release];
 }
 
 UICocoaSegmentedButton::~UICocoaSegmentedButton()
@@ -377,44 +392,44 @@ UICocoaSegmentedButton::~UICocoaSegmentedButton()
 
 QSize UICocoaSegmentedButton::sizeHint() const
 {
-    NSRect frame = [m_pNativeRef frame];
+    NSRect frame = [nativeRef() frame];
     return QSize(frame.size.width, frame.size.height);
 }
 
 void UICocoaSegmentedButton::setTitle(int iSegment, const QString &strTitle)
 {
     QString s(strTitle);
-    [m_pNativeRef setLabel: ::darwinQStringToNSString(s.remove('&')) forSegment: iSegment];
-    [m_pNativeRef sizeToFit];
-    NSRect frame = [m_pNativeRef frame];
+    [nativeRef() setLabel: ::darwinQStringToNSString(s.remove('&')) forSegment: iSegment];
+    [nativeRef() sizeToFit];
+    NSRect frame = [nativeRef() frame];
     setFixedSize(NSWidth(frame), NSHeight(frame));
 }
 
 void UICocoaSegmentedButton::setToolTip(int iSegment, const QString &strTip)
 {
-    [[m_pNativeRef cell] setToolTip: ::darwinQStringToNSString(strTip) forSegment: iSegment];
+    [[nativeRef() cell] setToolTip: ::darwinQStringToNSString(strTip) forSegment: iSegment];
 }
 
 void UICocoaSegmentedButton::setIcon(int iSegment, const QIcon& icon)
 {
-    QImage image = toGray(icon.pixmap(icon.actualSize(QSize(13, 13))).toImage());
+    QImage image = toGray(icon.pixmap(icon.availableSizes().first()).toImage());
 
     NSImage *pNSimage = [::darwinToNSImageRef(&image) autorelease];
-    [m_pNativeRef setImage: pNSimage forSegment: iSegment];
-    [m_pNativeRef sizeToFit];
-    NSRect frame = [m_pNativeRef frame];
+    [nativeRef() setImage: pNSimage forSegment: iSegment];
+    [nativeRef() sizeToFit];
+    NSRect frame = [nativeRef() frame];
     setFixedSize(NSWidth(frame), NSHeight(frame));
 }
 
 void UICocoaSegmentedButton::setEnabled(int iSegment, bool fEnabled)
 {
-    [[m_pNativeRef cell] setEnabled: fEnabled forSegment: iSegment];
+    [[nativeRef() cell] setEnabled: fEnabled forSegment: iSegment];
 }
 
 void UICocoaSegmentedButton::animateClick(int iSegment)
 {
-    [m_pNativeRef setSelectedSegment: iSegment];
-    [[m_pNativeRef cell] performClick: m_pNativeRef];
+    [nativeRef() setSelectedSegment: iSegment];
+    [[nativeRef() cell] performClick: nativeRef()];
 }
 
 void UICocoaSegmentedButton::onClicked(int iSegment)
@@ -422,32 +437,44 @@ void UICocoaSegmentedButton::onClicked(int iSegment)
     emit clicked(iSegment, false);
 }
 
-UICocoaSearchField::UICocoaSearchField(QWidget *pParent /* = 0 */)
-  : UICocoaWrapper(pParent)
+UICocoaSearchField::UICocoaSearchField(QWidget *pParent)
+    : QMacCocoaViewContainer(0, pParent)
 {
+    /* Prepare auto-release pool: */
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+    /* Prepare native search-field reference: */
+    NativeNSSearchFieldRef pNativeRef;
     NSRect initFrame;
 
-    m_pNativeRef = [[UISearchFieldPrivate alloc] initWithObject2: this];
-    [m_pNativeRef setFont: [NSFont controlContentFontOfSize:
+    /* Configure search-field: */
+    pNativeRef = [[UISearchFieldPrivate alloc] initWithObject2: this];
+    [pNativeRef setFont: [NSFont controlContentFontOfSize:
         [NSFont systemFontSizeForControlSize: NSMiniControlSize]]];
-    [[m_pNativeRef cell] setControlSize: NSMiniControlSize];
-    [m_pNativeRef sizeToFit];
-    initFrame = [m_pNativeRef frame];
+    [[pNativeRef cell] setControlSize: NSMiniControlSize];
+    [pNativeRef sizeToFit];
+    initFrame = [pNativeRef frame];
     initFrame.size.width = 180;
-    [m_pNativeRef setFrame: initFrame];
+    [pNativeRef setFrame: initFrame];
 
-    /* Use our own delegate */
+    /* Use our own delegate: */
     UISearchFieldDelegatePrivate *sfd = [[UISearchFieldDelegatePrivate alloc] init];
-    [m_pNativeRef setDelegate: sfd];
+    [pNativeRef setDelegate: sfd];
 
-    /* Create the container widget and attach the native view. */
-    m_pContainer = new QMacCocoaViewContainer(m_pNativeRef, this);
+    /* Put the button to the QCocoaViewContainer: */
+    setCocoaView(pNativeRef);
+    /* Release our reference, since our super class
+     * takes ownership and we don't need it anymore. */
+    [pNativeRef release];
 
-    /* Finally resize the widget */
+    /* Finally resize the widget: */
     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     setMinimumWidth(NSWidth(initFrame));
     setFixedHeight(NSHeight(initFrame));
     setFocusPolicy(Qt::StrongFocus);
+
+    /* Cleanup auto-release pool: */
+    [pool release];
 }
 
 UICocoaSearchField::~UICocoaSearchField()
@@ -456,38 +483,38 @@ UICocoaSearchField::~UICocoaSearchField()
 
 QSize UICocoaSearchField::sizeHint() const
 {
-    NSRect frame = [m_pNativeRef frame];
+    NSRect frame = [nativeRef() frame];
     return QSize(frame.size.width, frame.size.height);
 }
 
 QString UICocoaSearchField::text() const
 {
-    return ::darwinNSStringToQString([m_pNativeRef stringValue]);
+    return ::darwinNSStringToQString([nativeRef() stringValue]);
 }
 
 void UICocoaSearchField::insert(const QString &strText)
 {
-    [[m_pNativeRef currentEditor] setString: [[m_pNativeRef stringValue] stringByAppendingString: ::darwinQStringToNSString(strText)]];
+    [[nativeRef() currentEditor] setString: [[nativeRef() stringValue] stringByAppendingString: ::darwinQStringToNSString(strText)]];
 }
 
 void UICocoaSearchField::setToolTip(const QString &strTip)
 {
-    [m_pNativeRef setToolTip: ::darwinQStringToNSString(strTip)];
+    [nativeRef() setToolTip: ::darwinQStringToNSString(strTip)];
 }
 
 void UICocoaSearchField::selectAll()
 {
-    [m_pNativeRef selectText: m_pNativeRef];
+    [nativeRef() selectText: nativeRef()];
 }
 
 void UICocoaSearchField::markError()
 {
-    [[m_pNativeRef cell] setBackgroundColor: [[NSColor redColor] colorWithAlphaComponent: 0.3]];
+    [[nativeRef() cell] setBackgroundColor: [[NSColor redColor] colorWithAlphaComponent: 0.3]];
 }
 
 void UICocoaSearchField::unmarkError()
 {
-    [[m_pNativeRef cell] setBackgroundColor: nil];
+    [[nativeRef() cell] setBackgroundColor: nil];
 }
 
 void UICocoaSearchField::onTextChanged(const QString &strText)
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin.cpp b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin.cpp
index 75041bd..2662a2f 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIDesktopServices_darwin.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Qt GUI - Utility Classes and Functions specific to darwin.
+ * VBox Qt GUI - Qt GUI - Utility Classes and Functions specific to darwin..
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin_cocoa.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin_cocoa.mm
index ec4d1e6..805a4aa 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin_cocoa.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin_cocoa.mm
@@ -1,8 +1,6 @@
 /* $Id: UIDesktopServices_darwin_cocoa.mm $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Qt GUI - Utility Classes and Functions specific to darwin.
+ * VBox Qt GUI - Qt GUI - Utility Classes and Functions specific to darwin.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin_p.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin_p.h
index 44be195..9c5263a 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin_p.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIDesktopServices_darwin_p.h
@@ -1,7 +1,6 @@
+/* $Id: UIDesktopServices_darwin_p.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Qt GUI - Utility Classes and Functions specific to darwin.
+ * VBox Qt GUI - Qt GUI - Utility Classes and Functions specific to darwin..
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp
index 5ee0d5d..80d6fb1 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWindowMenuManager.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIWindowMenuManager class implementation
+ * VBox Qt GUI - UIWindowMenuManager class implementation.
  */
 
 /*
@@ -15,20 +13,21 @@
  * Foundation, in version 2 as it comes in the "COPYING" file of the
  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- * available from hm_regWindowsp://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Local includes */
-#include "UIWindowMenuManager.h"
+# include "UIWindowMenuManager.h"
 
 /* Global includes */
-#include <QApplication>
-#include <QMenu>
+# include <QApplication>
+# include <QMenu>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 class UIMenuHelper: public QObject
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.h
index f19abbc..0815d67 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.h
@@ -1,7 +1,6 @@
+/* $Id: UIWindowMenuManager.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIWindowMenuManager class declaration
+ * VBox Qt GUI - UIWindowMenuManager class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxCocoaHelper.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxCocoaHelper.h
index 459fc5d..28c16da 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxCocoaHelper.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxCocoaHelper.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxCocoaHelper.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxCocoa Helper
+ * VBox Qt GUI - VBoxCocoa Helper.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxIChatTheaterWrapper.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxIChatTheaterWrapper.h
index 7b2c999..ec58898 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxIChatTheaterWrapper.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxIChatTheaterWrapper.h
@@ -1,6 +1,6 @@
 /* $Id: VBoxIChatTheaterWrapper.h $ */
 /** @file
- * Qt GUI - iChat Theater cocoa wrapper.
+ * VBox Qt GUI - iChat Theater cocoa wrapper.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxIChatTheaterWrapper.m b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxIChatTheaterWrapper.m
index bf485a4..b11c74b 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxIChatTheaterWrapper.m
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxIChatTheaterWrapper.m
@@ -1,6 +1,6 @@
 /* $Id: VBoxIChatTheaterWrapper.m $ */
 /** @file
- * Qt GUI - iChat Theater cocoa wrapper.
+ * VBox Qt GUI - iChat Theater cocoa wrapper.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
index c75eae6..08396ed 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin-cocoa.mm
@@ -1,9 +1,6 @@
 /* $Id: VBoxUtils-darwin-cocoa.mm $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of utility classes and functions for handling Darwin Cocoa
- * specific tasks
+ * VBox Qt GUI -  Declarations of utility classes and functions for handling Darwin Cocoa specific tasks.
  */
 
 /*
@@ -69,10 +66,19 @@ NativeNSImageRef darwinToNSImageRef(const CGImageRef pImage)
 
 NativeNSImageRef darwinToNSImageRef(const QImage *pImage)
 {
-   CGImageRef pCGImage = ::darwinToCGImageRef(pImage);
-   NativeNSImageRef pNSImage = ::darwinToNSImageRef(pCGImage);
-   CGImageRelease(pCGImage);
-   return pNSImage;
+    /* Create CGImage on the basis of passed QImage: */
+    CGImageRef pCGImage = ::darwinToCGImageRef(pImage);
+    NativeNSImageRef pNSImage = ::darwinToNSImageRef(pCGImage);
+    CGImageRelease(pCGImage);
+#ifdef VBOX_GUI_WITH_HIDPI
+    /* Apply device pixel ratio: */
+    double dScaleFactor = pImage->devicePixelRatio();
+    NSSize imageSize = { (CGFloat)pImage->width() / dScaleFactor,
+                         (CGFloat)pImage->height() / dScaleFactor };
+    [pNSImage setSize:imageSize];
+#endif /* VBOX_GUI_WITH_HIDPI */
+    /* Return result: */
+    return pNSImage;
 }
 
 NativeNSImageRef darwinToNSImageRef(const QPixmap *pPixmap)
@@ -176,6 +182,14 @@ void darwinSetShowsWindowTransparentImpl(NativeNSWindowRef pWindow, bool fEnable
     }
 }
 
+void darwinSetWindowHasShadow(NativeNSWindowRef pWindow, bool fEnabled)
+{
+    if (fEnabled)
+        [pWindow setHasShadow :YES];
+    else
+        [pWindow setHasShadow :NO];
+}
+
 void darwinMinaturizeWindow(NativeNSWindowRef pWindow)
 {
 //    [[NSApplication sharedApplication] miniaturizeAll];
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
index 615ad92..584c7bd 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.cpp
@@ -1,6 +1,6 @@
 /* $Id: VBoxUtils-darwin.cpp $ */
 /** @file
- * Qt GUI - Utility Classes and Functions specific to Darwin.
+ * VBox Qt GUI - Utility Classes and Functions specific to Darwin.
  */
 
 /*
@@ -83,6 +83,11 @@ void darwinSetShowsWindowTransparent(QWidget *pWidget, bool fEnabled)
     ::darwinSetShowsWindowTransparentImpl(::darwinToNativeWindow(pWidget), fEnabled);
 }
 
+void darwinSetWindowHasShadow(QWidget *pWidget, bool fEnabled)
+{
+    ::darwinSetWindowHasShadow(::darwinToNativeWindow(pWidget), fEnabled);
+}
+
 void darwinWindowAnimateResize(QWidget *pWidget, const QRect &aTarget)
 {
     ::darwinWindowAnimateResizeImpl(::darwinToNativeWindow(pWidget), aTarget.x(), aTarget.y(), aTarget.width(), aTarget.height());
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
index 8bbda94..8cf73b9 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/VBoxUtils-darwin.h
@@ -1,8 +1,6 @@
+/* $Id: VBoxUtils-darwin.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of utility classes and functions for handling Darwin specific
- * tasks
+ * VBox Qt GUI - Declarations of utility classes and functions for handling Darwin specific tasks.
  */
 
 /*
@@ -61,6 +59,7 @@ void darwinSetShowsResizeIndicatorImpl(NativeNSWindowRef pWindow, bool fEnabled)
 void darwinSetHidesAllTitleButtonsImpl(NativeNSWindowRef pWindow);
 void darwinLabelWindow(NativeNSWindowRef pWindow, NativeNSImageRef pImage, bool fCenter);
 void darwinSetShowsWindowTransparentImpl(NativeNSWindowRef pWindow, bool fEnabled);
+void darwinSetWindowHasShadow(NativeNSWindowRef pWindow, bool fEnabled);
 void darwinSetMouseCoalescingEnabled(bool fEnabled);
 
 void darwintest(NativeNSWindowRef pWindow);
@@ -229,6 +228,7 @@ void darwinLabelWindow(QWidget *pWidget, QPixmap *pPixmap, bool fCenter);
 void darwinSetShowsResizeIndicator(QWidget *pWidget, bool fEnabled);
 void darwinSetHidesAllTitleButtons(QWidget *pWidget);
 void darwinSetShowsWindowTransparent(QWidget *pWidget, bool fEnabled);
+void darwinSetWindowHasShadow(QWidget *pWidget, bool fEnabled);
 void darwinSetDockIconMenu(QMenu *pMenu);
 void darwinDisableIconsInMenus(void);
 
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/tstDarwinKeyboard.cpp b/src/VBox/Frontends/VirtualBox/src/platform/darwin/tstDarwinKeyboard.cpp
index 85e7d56..3e13284 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/tstDarwinKeyboard.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/tstDarwinKeyboard.cpp
@@ -1,6 +1,6 @@
 /* $Id: tstDarwinKeyboard.cpp $ */
 /** @file
- * Common GUI Library - Testcase - Darwin Keyboard routines.
+ * VBox Qt GUI Testcase - Common GUI Library - Darwin Keyboard routines.
  *
  * @todo Move this up somewhere so that the two SDL GUIs can use parts of this code too (-HID crap).
  */
@@ -21,13 +21,20 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
-#include <iprt/initterm.h>
-#include <iprt/stream.h>
-#include <iprt/string.h>
-#include <iprt/time.h>
-#include <iprt/assert.h>
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+# include <iprt/initterm.h>
+# include <iprt/stream.h>
+# include <iprt/string.h>
+# include <iprt/time.h>
+# include <iprt/assert.h>
+
+# include "DarwinKeyboard.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#include "DarwinKeyboard.h"
 
 int main(int argc, char **argv)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/vmstarter.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/vmstarter.mm
index f755566..cf2868f 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/vmstarter.mm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/vmstarter.mm
@@ -1,9 +1,6 @@
 /* $Id: vmstarter.mm $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Helper application for starting vbox the right way when the user double
- * clicks on a file type association.
+ * VBox Qt GUI -  Helper application for starting vbox the right way when the user double clicks on a file type association.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.asm b/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.asm
index c7ea932..08eac2f 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.asm
+++ b/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.asm
@@ -1,8 +1,6 @@
 ; $Id: VBoxHlp.asm $
 ;; @file
-;
-; VBox frontends: Qt GUI ("VirtualBox"):
-; Implementation of OS/2-specific helpers that require to reside in a DLL
+; VBox Qt GUI - Implementation of OS/2-specific helpers that require to reside in a DLL.
 ;
 ; This stub is used to avoid linking the helper DLL to the C runtime.
 ;
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.cpp b/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.cpp
index 4ef084d..2a343fe 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.cpp
@@ -1,7 +1,6 @@
 /* $Id: VBoxHlp.cpp $ */
 /** @file
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Implementation of OS/2-specific helpers that require to reside in a DLL
+ * VBox Qt GUI - Implementation of OS/2-specific helpers that require to reside in a DLL
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.h b/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.h
index 709b7e1..4237951 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/os2/VBoxHlp.h
@@ -1,6 +1,6 @@
+/* $Id: VBoxHlp.h $ */
 /** @file
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declaration of OS/2-specific helpers that require to reside in a DLL
+ * VBox Qt GUI - Declaration of OS/2-specific helpers that require to reside in a DLL.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/win/UIDesktopServices_win.cpp b/src/VBox/Frontends/VirtualBox/src/platform/win/UIDesktopServices_win.cpp
index 7f14234..41d1da1 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/win/UIDesktopServices_win.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/win/UIDesktopServices_win.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIDesktopServices_win.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Qt GUI - Utility Classes and Functions specific to Windows.
+ * VBox Qt GUI - Qt GUI - Utility Classes and Functions specific to Windows..
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* VBox includes */
-#include "UIDesktopServices.h"
+# include "UIDesktopServices.h"
 
 /* Qt includes */
-#include <QDir>
-#include <QCoreApplication>
+# include <QDir>
+# include <QCoreApplication>
 
 /* System includes */
-#include <shlobj.h>
+# include <shlobj.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 bool UIDesktopServices::createMachineShortcut(const QString & /* strSrcFile */, const QString &strDstPath, const QString &strName, const QString &strUuid)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.cpp b/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.cpp
index 50ee3ae..bf53f12 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxUtils-win.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Utility classes and functions for handling Win specific tasks
+ * VBox Qt GUI - Utility classes and functions for handling Win specific tasks.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.h b/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.h
index d82660f..7738211 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxUtils-win.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of utility classes and functions for handling Win specific tasks
+ * VBox Qt GUI - Declarations of utility classes and functions for handling Win specific tasks.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/win/VirtualBox.rc b/src/VBox/Frontends/VirtualBox/src/platform/win/VirtualBox.rc
index 72d71da..37da93a 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/win/VirtualBox.rc
+++ b/src/VBox/Frontends/VirtualBox/src/platform/win/VirtualBox.rc
@@ -1,6 +1,6 @@
 /* $Id: VirtualBox.rc $ */
 /** @file
- * Windows resource file for VirtualBox.exe.
+ * VBox Qt GUI - Windows resource file for VirtualBox.exe.
  */
 
 /*
@@ -19,42 +19,35 @@
 #include <VBox/version.h>
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
-  FILEFLAGS        VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
-#else
-  FILEFLAGS        0 // final version
-#endif
-  FILEOS           VOS_NT_WINDOWS32
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
 #ifdef VBOXR3_HARDENED_DLL
-  FILETYPE         VFT_APP
+  FILETYPE         VBOX_RC_TYPE_APP
 #else
-  FILETYPE         VFT_DLL
+  FILETYPE         VBOX_RC_TYPE_DLL
 #endif
-  FILESUBTYPE      0   // not used
+  FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Manager\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-#ifdef VBOXR3_HARDENED_DLL
-      VALUE "InternalName",     "VirtualBox\0"
-#else
       VALUE "InternalName",     "VirtualBox\0"
-#endif
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOXR3_HARDENED_DLL
       VALUE "OriginalFilename", "VirtualBox.dll\0"
 #else
       VALUE "OriginalFilename", "VirtualBox.exe\0"
 #endif
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/win/VirtualBoxHardened.rc b/src/VBox/Frontends/VirtualBox/src/platform/win/VirtualBoxHardened.rc
index 0e52a05..ef7c144 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/win/VirtualBoxHardened.rc
+++ b/src/VBox/Frontends/VirtualBox/src/platform/win/VirtualBoxHardened.rc
@@ -1,6 +1,6 @@
 /* $Id: VirtualBoxHardened.rc $ */
 /** @file
- * Windows resource file for the Hardened VirtualBox.exe.
+ * VBox Qt GUI - Windows resource file for the Hardened VirtualBox.exe.
  */
 
 /*
@@ -20,30 +20,27 @@
 
 #if 0 /* Causes more DLLs to be loaded, don't enable it! */
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
-  FILEFLAGS        VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
-#else
-  FILEFLAGS        0 // final version
-#endif
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_APP
-  FILESUBTYPE      0   // not used
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_APP
+  FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
     BEGIN
-      VALUE "CompanyName",     VBOX_RC_COMPANY_NAME
       VALUE "FileDescription", "VirtualBox Manager\0"
-      VALUE "FileVersion",     VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",    "VirtualBox\0"
-      VALUE "LegalCopyright",  VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename","VirtualBox.exe\0"
-      VALUE "ProductName",     VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",  VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.cpp b/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.cpp
index c16bdf8..6db4a90 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.cpp
@@ -1,8 +1,6 @@
 /* $Id: WinKeyboard.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Windows keyboard handling.
+ * VBox Qt GUI - Windows keyboard handling..
  */
 
 /*
@@ -18,13 +16,14 @@
  */
 
 #define LOG_GROUP LOG_GROUP_GUI
- 
+
 #include "WinKeyboard.h"
 #include <iprt/assert.h>
 #include <VBox/log.h>
 
 #include <stdio.h>
 
+
 /* Beautification of log output */
 #define VBOX_BOOL_TO_STR_STATE(x)   (x) ? "ON" : "OFF"
 #define VBOX_CONTROL_TO_STR_NAME(x) ((x == VK_CAPITAL) ? "CAPS" : (x == VK_SCROLL ? "SCROLL" : ((x == VK_NUMLOCK) ? "NUM" : "UNKNOWN")))
@@ -181,7 +180,7 @@ void WinHidDevicesBroadcastLeds(bool fNumLockOn, bool fCapsLockOn, bool fScrollL
   * early (it exits on the first iteration for my German layout). If there is
   * no AltGr key in the layout then it will run right through, but that should
   * hopefully not happen very often.
-  * 
+  *
   * In theory we could do this once and cache the result, but that involves
   * tracking layout switches to invalidate the cache, and I don't think that the
   * added complexity is worth the price. */
@@ -272,9 +271,9 @@ bool WinAltGrMonitor::isCurrentEventDefinitelyFake(unsigned iDownScanCode,
     if (!PeekMessage(&peekMsg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE))
         return false;
 
-	if (messageTime != peekMsg.time)
-	    return false;
-	if (   fKeyDown
+        if (messageTime != peekMsg.time)
+            return false;
+        if (   fKeyDown
         && (peekMsg.message != WM_KEYDOWN && peekMsg.message != WM_SYSKEYDOWN))
         return false;
     if (   !fKeyDown
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.h b/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.h
index 0e35d89..87c6f04 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.h
@@ -1,8 +1,6 @@
 /* $Id: WinKeyboard.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Windows keyboard handling.
+ * VBox Qt GUI - Windows keyboard handling..
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/x11/UIDesktopServices_x11.cpp b/src/VBox/Frontends/VirtualBox/src/platform/x11/UIDesktopServices_x11.cpp
index 6aa8200..768bc64 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/x11/UIDesktopServices_x11.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/x11/UIDesktopServices_x11.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIDesktopServices_x11.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Qt GUI - Utility Classes and Functions specific to X11.
+ * VBox Qt GUI - Qt GUI - Utility Classes and Functions specific to X11..
  */
 
 /*
@@ -17,16 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* VBox includes */
-#include "UIDesktopServices.h"
+# include "UIDesktopServices.h"
 
 /* Qt includes */
-#include <QCoreApplication>
-#include <QDesktopServices>
-#include <QDir>
-#include <QFile>
-#include <QTextStream>
-#include <QUrl>
+# include <QCoreApplication>
+# include <QDesktopServices>
+# include <QDir>
+# include <QFile>
+# include <QTextStream>
+# include <QUrl>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 bool UIDesktopServices::createMachineShortcut(const QString & /* strSrcFile */, const QString &strDstPath, const QString &strName, const QString &strUuid)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.cpp b/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.cpp
index 1740e88..8f2956d 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxX11Helper.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * X11 helpers.
+ * VBox Qt GUI - X11 helpers..
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.h b/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.h
index aa2e135..c0d892a 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/x11/VBoxX11Helper.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxX11Helper.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBox X11 helper functions
+ * VBox Qt GUI - VBox X11 helper functions.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/x11/XKeyboard-new.cpp b/src/VBox/Frontends/VirtualBox/src/platform/x11/XKeyboard-new.cpp
index 2670c13..4e561a8 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/x11/XKeyboard-new.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/platform/x11/XKeyboard-new.cpp
@@ -1,8 +1,6 @@
 /* $Id: XKeyboard-new.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Implementation of Linux-specific keyboard functions
+ * VBox Qt GUI - Implementation of Linux-specific keyboard functions.
  */
 
 /*
@@ -28,6 +26,7 @@
 #include <VBox/log.h>
 #include <VBox/VBoxKeyboard.h>
 
+
 /* VBoxKeyboard uses the deprecated XKeycodeToKeysym(3) API, but uses it safely.
  */
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
diff --git a/src/VBox/Frontends/VirtualBox/src/platform/x11/XKeyboard.h b/src/VBox/Frontends/VirtualBox/src/platform/x11/XKeyboard.h
index b5ad5e2..2f54f04 100644
--- a/src/VBox/Frontends/VirtualBox/src/platform/x11/XKeyboard.h
+++ b/src/VBox/Frontends/VirtualBox/src/platform/x11/XKeyboard.h
@@ -1,7 +1,6 @@
+/* $Id: XKeyboard.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Declarations of Linux-specific keyboard functions
+ * VBox Qt GUI - Declarations of Linux-specific keyboard functions.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/precomp.cpp b/src/VBox/Frontends/VirtualBox/src/precomp.cpp
new file mode 100644
index 0000000..564bd1c
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/precomp.cpp
@@ -0,0 +1,4 @@
+/* $Id: precomp.cpp $ */
+
+#include "precomp.h"
+
diff --git a/src/VBox/Frontends/VirtualBox/src/precomp.h b/src/VBox/Frontends/VirtualBox/src/precomp.h
index 098d425..d777862 100644
--- a/src/VBox/Frontends/VirtualBox/src/precomp.h
+++ b/src/VBox/Frontends/VirtualBox/src/precomp.h
@@ -1,10 +1,10 @@
 /* $Id: precomp.h $*/
 /** @file
- * Header used if VBOX_WITH_PRECOMPILED_HEADERS is active.
+ * VBox Qt GUI - Header used if VBOX_WITH_PRECOMPILED_HEADERS is active.
  */
 
 /*
- * Copyright (C) 2009-2013 Oracle Corporation
+ * Copyright (C) 2009-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,24 +15,40 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-//#include <Q3PopupMenu>
+/* To get usage counts for the include files run the following from the src directory:
+  ( for inc in $(sed -e '/^# *include/!d' -e 's/^# *include *.//' -e 's/[">].*''//' precomp.h);
+    do
+        echo $( grep -rE "^ *# *include *.$inc." --exclude=precomp.h . | wc -l ) \
+            "/" $( grep -rE "^ *# *include *.$inc." --exclude="*.h" . | wc -l ) \
+            "- $inc";
+    done ) | sort -n
+ */
+
+
+#define LOG_GROUP LOG_GROUP_GUI
+
+/*
+ * Qt
+ */
+#include <QAbstractButton>
+#include <QAbstractItemDelegate>
 #include <QAbstractItemView>
-#include <QAbstractListModel>
 #include <QAbstractScrollArea>
+#include <QAbstractTableModel>
 #include <QAction>
-#include <QActionGroup>
 #include <QApplication>
-#include <QBasicTimer>
 #include <QBitmap>
 #include <QBoxLayout>
+#include <QButtonGroup>
 #include <QCheckBox>
-#include <QCleanlooksStyle>
+//#include <QCleanlooksStyle> - only used once
 #include <QClipboard>
 #include <QCloseEvent>
 #include <QColor>
 #include <QComboBox>
-#include <QCompleter>
+//#include <QCommonStyle> -  only used once
 #include <QContextMenuEvent>
+#include <QCoreApplication>
 #include <QCursor>
 #include <QDate>
 #include <QDateTime>
@@ -41,8 +57,7 @@
 #include <QDialog>
 #include <QDialogButtonBox>
 #include <QDir>
-#include <QDragEnterEvent>
-#include <QDropEvent>
+#include <QDrag>
 #include <QEvent>
 #include <QEventLoop>
 #include <QFile>
@@ -50,59 +65,85 @@
 #include <QFileIconProvider>
 #include <QFileInfo>
 #include <QFocusEvent>
-#include <QFontDatabase>
+//#include <QFontDatabase> - only used once
+//#include <QFontMetrics> - only used once
 #include <QFrame>
-#include <QGLContext>
+//#include <QGLContext> - only used once
 #include <QGLWidget>
-#include <QGlobalStatic>
+//#include <QGraphicsLinearLayout> - only used once
+//#include <QGraphicsProxyWidget> - only used once
+#include <QGraphicsScene>
+#include <QGraphicsSceneContextMenuEvent>
+#include <QGraphicsSceneDragDropEvent>
+//#include <QGraphicsSceneHoverEvent> - only used once
+#include <QGraphicsSceneMouseEvent>
+#include <QGraphicsView>
+#include <QGraphicsWidget>
+#include <QGridLayout>
+#include <QGroupBox>
 #include <QHBoxLayout>
 #include <QHash>
 #include <QHeaderView>
 #include <QHelpEvent>
-#include <QHostAddress>
-#include <QHttp>
-#include <QHttpResponseHeader>
+//#include <QHostAddress> - only used once
+#include <QIcon>
 #include <QImage>
+//#include <QImageWriter> - only used once
+#include <QIntValidator>
 #include <QItemDelegate>
 #include <QItemEditorFactory>
 #include <QKeyEvent>
 #include <QLabel>
 #include <QLayout>
 #include <QLibrary>
-#include <QLibraryInfo>
+//#include <QLibraryInfo> - only used once
 #include <QLineEdit>
-#include <QLinkedList>
 #include <QList>
 #include <QListView>
+#include <QListWidget>
 #include <QLocale>
 #ifdef Q_WS_MAC
-# include <QMacCocoaViewContainer>
+//# include <QMacCocoaViewContainer> - only used once / only used in Objective C++
 #endif
 #include <QMainWindow>
 #include <QMap>
+#include <QMdiArea>
+#include <QMdiSubWindow>
 #include <QMenu>
 #include <QMenuBar>
-#include <QMenuItem>
 #include <QMessageBox>
-#include <QMetaProperty>
+#include <QMetaEnum>
+//#include <QMetaProperty> - only used once
 #include <QMetaType>
 #include <QMimeData>
 #include <QMouseEvent>
-#include <QMoveEvent>
+//#include <QMouseEventTransition> - only used once
 #include <QMutex>
+#include <QNetworkAccessManager>
+//#include <QNetworkProxy> - only used once
+#include <QNetworkReply>
+#include <QNetworkRequest>
 #include <QObject>
 #include <QPaintEvent>
 #include <QPainter>
+#include <QPair>
+//#include <QParallelAnimationGroup> - only used once
 #include <QPixmap>
-#include <QPlastiqueStyle>
+#include <QPixmapCache>
+//#include <QPlastiqueStyle> - only used once
+#include <QPoint>
 #include <QPointer>
-#include <QPolygon>
-#include <QPrintDialog>
-#include <QPrinter>
+//#include <QPrintDialog> - only used once
+//#include <QPrinter> - only used once
 #include <QProcess>
 #include <QProgressBar>
-#include <QProgressDialog>
+//#include <QProgressDialog> - only used once
+#include <QPropertyAnimation>
 #include <QPushButton>
+#include <QQueue>
+#include <QRadioButton>
+//#include <QReadLocker> - only used once
+#include <QReadWriteLock>
 #include <QRect>
 #include <QRegExp>
 #include <QRegExpValidator>
@@ -110,28 +151,39 @@
 #include <QResizeEvent>
 #include <QScrollArea>
 #include <QScrollBar>
-#include <QSettings>
+#include <QSet>
+//#include <QSettings> - only used once
+//#include <QShortcut> - only used once
 #include <QSignalMapper>
-#include <QSizeGrip>
+#include <QSignalTransition>
+//#include <QSizeGrip> - only used once
 #include <QSlider>
-#include <QSocketNotifier>
+//#include <QSocketNotifier> - only used once
 #include <QSortFilterProxyModel>
+#include <QSpacerItem>
 #include <QSpinBox>
 #include <QSplitter>
+//#include <QStackedLayout> - only used once.
 #include <QStackedWidget>
+//#include <QStandardItemModel> - only used once
+#include <QStateMachine>
 #include <QStatusBar>
 #include <QString>
+#include <QStringList>
 #include <QStyle>
 #include <QStyleOption>
 #include <QStyleOptionFocusRect>
-#include <QStyleOptionFrame>
-#include <QStyleOptionSlider>
+//#include <QStyleOptionFrame> - only used once
+#include <QStyleOptionGraphicsItem>
+//#include <QStyleOptionSlider> - only used once
+//#include <QStyleOptionSpinBox> - only used once
 #include <QStylePainter>
-#include <QSystemTrayIcon>
+#include <QStyledItemDelegate>
 #include <QTabWidget>
 #include <QTableView>
 #include <QTextBrowser>
 #include <QTextEdit>
+//#include <QTextLayout> - only used once
 #include <QTextStream>
 #include <QThread>
 #include <QTime>
@@ -139,6 +191,8 @@
 #include <QToolBar>
 #include <QToolButton>
 #include <QToolTip>
+//#include <QTouchEvent> - only used once
+#include <QTransform>
 #include <QTranslator>
 #include <QTreeView>
 #include <QTreeWidget>
@@ -149,178 +203,487 @@
 #include <QVarLengthArray>
 #include <QVariant>
 #include <QVector>
+#include <QWaitCondition>
 #include <QWidget>
 #include <QWindowsStyle>
-#include <QWindowsVistaStyle>
+//#include <QWindowsVistaStyle> - only used once
+#include <QWizard>
+#include <QWizardPage>
 #ifdef Q_WS_X11
 # include <QX11Info>
 #endif
+//#include <QXmlStreamReader> - only used once
+//#include <QXmlStreamWriter> - only used once
+#include <QtGlobal>
+
+
+/*
+ * System specific headers.
+ */
+#ifdef Q_WS_WIN
+# include <shlobj.h>
+# include <Windows.h>
+#endif
+
+
+/*
+ * IPRT
+ */
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/buildconfig.h>
+#include <iprt/cdefs.h>
+#include <iprt/cidr.h>
+#include <iprt/cpp/utils.h>
+#include <iprt/critsect.h>
+//#include <iprt/ctype.h> - only used once
+#include <iprt/env.h>
+//#include <iprt/err.h> - don't include err.h!
+//#include <iprt/file.h> - only used once
+//#include <iprt/http.h> - only used once
+#include <iprt/initterm.h>
+#include <iprt/ldr.h>
+#include <iprt/list.h>
+#include <iprt/log.h>
+#include <iprt/mem.h>
+//#include <iprt/memcache.h> - only used once
+#include <iprt/param.h>
+#include <iprt/path.h>
+#include <iprt/process.h>
+#include <iprt/semaphore.h>
+//#include <iprt/sha.h> - only used once
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/system.h>
+#include <iprt/thread.h>
+#include <iprt/time.h>
+#include <iprt/types.h>
+//#include <iprt/uri.h> - only used once
+//#include <iprt/zip.h> - only used once
+
+
+/*
+ * VirtualBox COM API
+ */
+#ifdef VBOX_WITH_XPCOM
+# include <VirtualBox_XPCOM.h>
+#else
+# include <VirtualBox.h>
+#endif
+
+/*
+ * VBox headers.
+ */
+#include <VBox/cdefs.h>
+#include <VBox/types.h>
+#include <VBox/VBoxCocoa.h>
+#include <VBox/VBoxGL2D.h>
+//#include <VBox/VBoxKeyboard.h> - includes X11/X.h which causes trouble.
+//#include <VBox/VBoxOGL.h> - only used once
+//#include <VBox/VBoxVideo.h> - only used twice
+#ifdef VBOX_WITH_VIDEOHWACCEL
+//# include <VBox/VBoxVideo3D.h> - only used once
+#endif
+#include <VBox/com/Guid.h>
+#include <VBox/com/array.h>
+#include <VBox/com/assert.h>
+#include <VBox/com/com.h>
+#include <VBox/com/listeners.h>
+#include <VBox/dbggui.h>
+//#include <VBox/err.h> - don't include err.h!
+#include <VBox/log.h>
+#include <VBox/sup.h>
+//#include <VBox/vd.h> - only used once
+#include <VBox/version.h>
+#ifdef VBOX_WITH_VIDEOHWACCEL
+//# include <VBox/vmm/ssm.h> - only used once
+#endif
+
 
-#include "QIAbstractWizard.h"
+/*
+ * VirtualBox Qt GUI - QI* headers.
+ */
 #include "QIAdvancedSlider.h"
+//#include "QIAdvancedToolBar.h" - only used once / not used at all
 #include "QIArrowButtonPress.h"
 #include "QIArrowButtonSwitch.h"
 #include "QIArrowSplitter.h"
 #include "QIDialog.h"
 #include "QIDialogButtonBox.h"
 #include "QIFileDialog.h"
-#if 0
-#include "QIHotKeyEdit.h"
-#endif
+#include "QIGraphicsWidget.h"
 #include "QILabel.h"
 #include "QILabelSeparator.h"
 #include "QILineEdit.h"
-#include "QIListView.h"
+//#include "QIListView.h" - only used once / not used at all
 #include "QIMainDialog.h"
+#include "QIMenu.h"
 #include "QIMessageBox.h"
+#include "QIProcess.h"
+#include "QIRichTextLabel.h"
 #include "QIRichToolButton.h"
 #include "QISplitter.h"
-#include "QIStateIndicator.h"
 #include "QIStatusBar.h"
+#include "QIStatusBarIndicator.h"
+#include "QITabWidget.h"
+#include "QITableView.h"
 #include "QIToolButton.h"
 #include "QITreeView.h"
 #include "QITreeWidget.h"
 #include "QIWidgetValidator.h"
 #include "QIWithRetranslateUI.h"
 
-//expensive: #include "AbstractDockIconPreview.h"
-#include "CIShared.h"
+
+/*
+ * VirtualBox Qt GUI - COM headers & Wrappers (later).
+ */
+/* Note! X.h and Xlib.h shall not be included as they may redefine None and
+         Status respectively, both are user in VBox enums.  Don't bother
+         undefining them, just prevent their inclusion! */
 #include "COMDefs.h"
-#ifdef Q_WS_MAC
-# include "DarwinKeyboard.h"
-# include "DockIconPreview.h"
+#include "COMEnums.h"
+
+#include "CAppliance.h"
+#include "CAudioAdapter.h"
+#include "CBIOSSettings.h"
+//#include "CCanShowWindowEvent.h" - only used once
+#include "CConsole.h"
+//#include "CDHCPServer.h" - only used once
+#include "CDisplay.h"
+#include "CDisplaySourceBitmap.h"
+#include "CDnDSource.h"
+#include "CDnDTarget.h"
+#include "CEmulatedUSB.h"
+//#include "CEvent.h" - only used once
+#include "CEventListener.h"
+#include "CEventSource.h"
+#include "CExtPack.h"
+#include "CExtPackFile.h"
+#include "CExtPackManager.h"
+//#include "CExtraDataCanChangeEvent.h" - only used once
+//#include "CExtraDataChangedEvent.h" - only used once
+//#include "CFramebuffer.h" - only used once
+#include "CGuest.h"
+//#include "CGuestDnDSource.h" - only used once
+//#include "CGuestDnDTarget.h" - only used once
+//#include "CGuestMonitorChangedEvent.h" - only used once
+#include "CGuestOSType.h"
+#include "CHost.h"
+#include "CHostNetworkInterface.h"
+#include "CHostUSBDevice.h"
+//#include "CHostUSBDeviceFilter.h" - only used once
+#include "CHostVideoInputDevice.h"
+#include "CIShared.h"
+#include "CKeyboard.h"
+//#include "CKeyboardLedsChangedEvent.h" - only used once
+#include "CMachine.h"
+//#include "CMachineDataChangedEvent.h" - only used once
+#include "CMachineDebugger.h"
+//#include "CMachineRegisteredEvent.h" - only used once
+//#include "CMachineStateChangedEvent.h" - only used once
+#include "CMedium.h"
+#include "CMediumAttachment.h"
+//#include "CMediumChangedEvent.h" - only used once
+#include "CMediumFormat.h"
+//#include "CMouse.h" - only used once
+//#include "CMouseCapabilityChangedEvent.h" - only used once
+//#include "CMousePointerShapeChangedEvent.h" - only used once
+//#include "CNATEngine.h" - only used once
+#include "CNATNetwork.h"
+#include "CNetworkAdapter.h"
+//#include "CNetworkAdapterChangedEvent.h" - only used once
+#include "CParallelPort.h"
+#include "CProgress.h"
+//#include "CRuntimeErrorEvent.h" - only used once
+#include "CSerialPort.h"
+#include "CSession.h"
+//#include "CSessionStateChangedEvent.h" - only used once
+#include "CSharedFolder.h"
+//#include "CShowWindowEvent.h" - only used once
+#include "CSnapshot.h"
+//#include "CSnapshotChangedEvent.h" - only used once
+//#include "CSnapshotDeletedEvent.h" - only used once
+//#include "CSnapshotTakenEvent.h" - only used once
+//#include "CStateChangedEvent.h" - only used once
+#include "CStorageController.h"
+#include "CSystemProperties.h"
+#include "CUSBController.h"
+#include "CUSBDevice.h"
+#include "CUSBDeviceFilter.h"
+#include "CUSBDeviceFilters.h"
+//#include "CUSBDeviceStateChangedEvent.h" - only used once
+//#include "CVFSExplorer.h" - only used once
+#include "CVRDEServer.h"
+//#include "CVRDEServerInfo.h" - only used once
+#include "CVirtualBox.h"
+#include "CVirtualBoxErrorInfo.h"
+#include "CVirtualSystemDescription.h"
+
+
+/*
+ * VirtualBox Qt GUI - UI headers.
+ */
+#include "UIMessageCenter.h"
+#include "UINetworkReply.h"
+#ifdef RT_OS_DARWIN
+# include "UIAbstractDockIconPreview.h"
 #endif
-#include "VBoxAboutDlg.h"
+#include "UIActionPool.h"
+#include "UIActionPoolRuntime.h"
+#include "UIActionPoolSelector.h"
+#include "UIAnimationFramework.h"
 #include "UIApplianceEditorWidget.h"
-#include "VBoxCloseVMDlg.h"
-#ifdef Q_WS_MAC
-# include "VBoxCocoaHelper.h"
-# include "VBoxCocoaSpecialControls.h"
+#include "UIApplianceExportEditorWidget.h"
+#include "UIApplianceImportEditorWidget.h"
+#include "UIBar.h"
+#include "UIBootTable.h"
+#ifdef RT_OS_DARWIN
+# include "UICocoaApplication.h"
+# include "UICocoaDockIconPreview.h"
+# include "UICocoaSpecialControls.h"
 #endif
+#include "UIConsoleEventHandler.h"
+#include "UIConverter.h"
+#include "UIConverterBackend.h"
 #include "UIDefs.h"
-#include "VBoxDownloaderWgt.h"
-#include "UIApplianceExportEditorWidget.h"
-#include "VBoxExportApplianceWzd.h"
-#include "VBoxFBOverlay.h"
-#include "VBoxFBOverlayCommon.h"
-#include "VBoxFilePathSelectorWidget.h"
-#include "VBoxFrameBuffer.h"
+#include "UIDesktopServices.h"
+#ifdef RT_OS_DARWIN
+# include "UIDesktopServices_darwin_p.h"
+#endif
+#include "UIDnDDrag.h"
+#ifdef RT_OS_WINDOWS
+# include "UIDnDDataObject_win.h"
+# include "UIDnDDropSource_win.h"
+# include "UIDnDEnumFormat_win.h"
+#endif
+#include "UIDnDHandler.h"
+#include "UIDnDMIMEData.h"
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+# include "UIDownloader.h"
+# include "UIDownloaderAdditions.h"
+# include "UIDownloaderExtensionPack.h"
+# include "UIDownloaderUserManual.h"
+#endif
+#include "UIExtraDataDefs.h"
+#include "UIExtraDataManager.h"
+#include "UIFilmContainer.h"
+#include "UIFrameBuffer.h"
+#include "UIGChooser.h"
+#include "UIGChooserHandlerKeyboard.h"
+#include "UIGChooserHandlerMouse.h"
+#include "UIGChooserItem.h"
+#include "UIGChooserItemGroup.h"
+#include "UIGChooserItemMachine.h"
+#include "UIGChooserModel.h"
+#include "UIGChooserView.h"
+#include "UIGDetails.h"
+#include "UIGDetailsElement.h"
+#include "UIGDetailsElements.h"
+#include "UIGDetailsGroup.h"
+#include "UIGDetailsItem.h"
+#include "UIGDetailsModel.h"
+#include "UIGDetailsSet.h"
+#include "UIGDetailsView.h"
+#include "UIGMachinePreview.h"
+#include "UIGlobalSettingsDisplay.h"
+#include "UIGlobalSettingsExtension.h"
 #include "UIGlobalSettingsGeneral.h"
 #include "UIGlobalSettingsInput.h"
 #include "UIGlobalSettingsLanguage.h"
 #include "UIGlobalSettingsNetwork.h"
-#include "UIGlobalSettingsNetworkDetails.h"
-#include "UIGlobalSettingsUpdate.h"
-#include "VBoxGlobal.h"
-#include "VBoxGlobalSettings.h"
-#include "VBoxGuestRAMSlider.h"
-#ifdef Q_WS_MAC
-# include "VBoxIChatTheaterWrapper.h"
+#include "UIGlobalSettingsNetworkDetailsHost.h"
+#include "UIGlobalSettingsNetworkDetailsNAT.h"
+#include "UIGlobalSettingsPortForwardingDlg.h"
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+# include "UIGlobalSettingsProxy.h"
+# include "UIGlobalSettingsUpdate.h"
 #endif
-#include "UIApplianceImportEditorWidget.h"
-#include "VBoxImportApplianceWzd.h"
-#include "VBoxLicenseViewer.h"
+#include "UIGraphicsButton.h"
+#include "UIGraphicsRotatorButton.h"
+#include "UIGraphicsTextPane.h"
+#include "UIGraphicsToolBar.h"
+#include "UIGraphicsZoomButton.h"
+#include "UIHostComboEditor.h"
+#include "UIHotKeyEditor.h"
+#include "UIIconPool.h"
+#include "UIImageTools.h"
+#include "UIIndicatorsPool.h"
+#include "UIKeyboardHandler.h"
+#include "UIKeyboardHandlerFullscreen.h"
+#include "UIKeyboardHandlerNormal.h"
+#include "UIKeyboardHandlerScale.h"
+#include "UIKeyboardHandlerSeamless.h"
 #include "UILineTextEdit.h"
-//#include "VBoxMediaComboBox.h"
-#include "VBoxMediaManagerDlg.h"
-//#include "VBoxMedium.h"               /* Expensive? Or what? */
-#include "UIMiniToolBar.h"
-#include "VBoxNewHDWzd.h"
-#include "VBoxNewVMWzd.h"
-#include "VBoxOSTypeSelectorButton.h"
-#include "UINameAndSystemEditor.h"
-#include "UIMessageCenter.h"
-#include "VBoxProgressDialog.h"
-#include "UISelectorWindow.h"
-#include "UISettingsDialog.h"
-#include "UISettingsDialogSpecific.h"
-#include "UISettingsPage.h"
-#include "VBoxSettingsSelector.h"
-#include "VBoxSnapshotDetailsDlg.h"
-#include "VBoxSnapshotsWgt.h"
-#include "VBoxSpecialControls.h"
-#include "VBoxTakeSnapshotDlg.h"
-#include "UIToolBar.h"
-#include "VBoxUpdateDlg.h"
-#include "VBoxUtils-darwin.h"
-#include "VBoxUtils.h"
-#include "VBoxVMFirstRunWzd.h"
-#include "VBoxVMInformationDlg.h"
-#include "UIVMLogViewer.h"
+#include "UIMachine.h"
+#include "UIMachineDefs.h"
+#include "UIMachineLogic.h"
+#include "UIMachineLogicFullscreen.h"
+#include "UIMachineLogicNormal.h"
+#include "UIMachineLogicScale.h"
+#include "UIMachineLogicSeamless.h"
 #include "UIMachineSettingsAudio.h"
 #include "UIMachineSettingsDisplay.h"
 #include "UIMachineSettingsGeneral.h"
-#include "UIMachineSettingsStorage.h"
+#include "UIMachineSettingsInterface.h"
 #include "UIMachineSettingsNetwork.h"
 #include "UIMachineSettingsParallel.h"
+#include "UIMachineSettingsPortForwardingDlg.h"
 #include "UIMachineSettingsSF.h"
 #include "UIMachineSettingsSFDetails.h"
 #include "UIMachineSettingsSerial.h"
+#include "UIMachineSettingsStorage.h"
 #include "UIMachineSettingsSystem.h"
 #include "UIMachineSettingsUSB.h"
 #include "UIMachineSettingsUSBFilterDetails.h"
-
-#ifdef Q_WS_X11
-# undef BOOL /* typedef CARD8 BOOL in Xmd.h conflicts with #define BOOL PRBool
-              * in COMDefs.h. A better fix would be to isolate X11-specific
-              * stuff by placing XX* helpers below to a separate source file. */
-RT_C_DECLS_BEGIN                        /* rhel3 build hack */
-/** @todo stuff might be missing here... */
-# include <X11/X.h>
-# include <X11/Xmd.h>
-# include <X11/Xlib.h>
-# include <X11/Xatom.h>
-# include <X11/extensions/dpms.h>
-RT_C_DECLS_END                          /* rhel3 build hack */
-# define BOOL PRBool
-# include "VBoxX11Helper.h"
-# include "XKeyboard.h"
-#endif
-
-#ifdef Q_WS_MAC
-# include <ApplicationServices/ApplicationServices.h>
+#include "UIMachineView.h"
+#include "UIMachineViewFullscreen.h"
+#include "UIMachineViewNormal.h"
+#include "UIMachineViewScale.h"
+#include "UIMachineViewSeamless.h"
+#include "UIMachineWindow.h"
+#include "UIMachineWindowFullscreen.h"
+#include "UIMachineWindowNormal.h"
+#include "UIMachineWindowScale.h"
+#include "UIMachineWindowSeamless.h"
+#include "UIMainEventListener.h"
+#include "UIMedium.h"
+#include "UIMediumDefs.h"
+#include "UIMediumEnumerator.h"
+#include "UIMediumManager.h"
+#include "UIMediumTypeChangeDialog.h"
+#include "UIMenuBar.h"
+#include "UIMenuBarEditorWindow.h"
+#include "UIMessageCenter.h"
+#include "UIMiniToolBar.h"
+#include "UIModalWindowManager.h"
+#include "UIMouseHandler.h"
+#include "UIMultiScreenLayout.h"
+#include "UINameAndSystemEditor.h"
+#include "UINetworkCustomer.h"
+#include "UINetworkDefs.h"
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+# include "UINetworkManager.h"
+# include "UINetworkManagerDialog.h"
+# include "UINetworkManagerIndicator.h"
 #endif
-
-#if defined (Q_WS_WIN)
-# include <shlobj.h>
+#include "UINetworkReply.h"
+#include "UINetworkRequest.h"
+#include "UINetworkRequestWidget.h"
+#include "UIPopupBox.h"
+#include "UIPopupCenter.h"
+#include "UIPopupPane.h"
+#include "UIPopupPaneButtonPane.h"
+#include "UIPopupPaneTextPane.h"
+#include "UIPopupStack.h"
+#include "UIPopupStackViewport.h"
+#include "UIPortForwardingTable.h"
+#include "UIProgressDialog.h"
+#include "UISelectorWindow.h"
+#include "UISession.h"
+#include "UISettingsDefs.h"
+#include "UISettingsDialog.h"
+#include "UISettingsDialogSpecific.h"
+#include "UISettingsPage.h"
+#include "UIShortcutPool.h"
+#include "UISlidingToolBar.h"
+#include "UISpacerWidgets.h"
+#include "UISpecialControls.h"
+#include "UIStatusBarEditorWindow.h"
+#include "UIThreadPool.h"
+#include "UIToolBar.h"
+#include "UIUpdateDefs.h"
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+# include "UIUpdateManager.h"
 #endif
+#include "UIVMCloseDialog.h"
+#include "UIVMDesktop.h"
+#include "UIVMInfoDialog.h"
+#include "UIVMItem.h"
+#include "UIVMLogViewer.h"
+#include "UIVirtualBoxEventHandler.h"
+#include "UIWarningPane.h"
+#include "UIWindowMenuManager.h"
+#include "UIWizard.h"
+#include "UIWizardCloneVD.h"
+#include "UIWizardCloneVDPageBasic1.h"
+#include "UIWizardCloneVDPageBasic2.h"
+#include "UIWizardCloneVDPageBasic3.h"
+#include "UIWizardCloneVDPageBasic4.h"
+#include "UIWizardCloneVDPageExpert.h"
+#include "UIWizardCloneVM.h"
+#include "UIWizardCloneVMPageBasic1.h"
+#include "UIWizardCloneVMPageBasic2.h"
+#include "UIWizardCloneVMPageBasic3.h"
+#include "UIWizardCloneVMPageExpert.h"
+#include "UIWizardExportApp.h"
+#include "UIWizardExportAppDefs.h"
+#include "UIWizardExportAppPageBasic1.h"
+#include "UIWizardExportAppPageBasic2.h"
+#include "UIWizardExportAppPageBasic3.h"
+#include "UIWizardExportAppPageBasic4.h"
+#include "UIWizardExportAppPageExpert.h"
+#include "UIWizardFirstRun.h"
+#include "UIWizardFirstRunPageBasic.h"
+#include "UIWizardImportApp.h"
+#include "UIWizardImportAppDefs.h"
+#include "UIWizardImportAppPageBasic1.h"
+#include "UIWizardImportAppPageBasic2.h"
+#include "UIWizardImportAppPageExpert.h"
+#include "UIWizardNewVD.h"
+#include "UIWizardNewVDPageBasic1.h"
+#include "UIWizardNewVDPageBasic2.h"
+#include "UIWizardNewVDPageBasic3.h"
+#include "UIWizardNewVDPageExpert.h"
+#include "UIWizardNewVM.h"
+#include "UIWizardNewVMPageBasic1.h"
+#include "UIWizardNewVMPageBasic2.h"
+#include "UIWizardNewVMPageBasic3.h"
+#include "UIWizardNewVMPageExpert.h"
+#include "UIWizardPage.h"
 
-#include <math.h>
-
-#include <iprt/asm.h>
-#include <iprt/assert.h>
-#include <iprt/buildconfig.h>
-#include <iprt/env.h>
-#include <iprt/err.h>
-#include <iprt/file.h>
-#include <iprt/initterm.h>
-#include <iprt/ldr.h>
-#include <iprt/log.h>
-#include <iprt/mem.h>
-#include <iprt/param.h>
-#include <iprt/path.h>
-#include <iprt/process.h>
-#include <iprt/semaphore.h>
-#include <iprt/stream.h>
-#include <iprt/system.h>
-#include <iprt/time.h>
-#include <iprt/thread.h>
 
-#include <VBox/err.h>
-#include <VBox/param.h>
-#include <VBox/sup.h>
-#include <VBox/com/Guid.h>              /* ...a bit expensive... */
-#include <VBox/VMMDev.h>                /** @todo @bugref{4084} */
-#include <VBox/VBoxHDD.h>
-#include <VBox/VBoxGL2D.h>
-#ifdef VBOX_WITH_VIDEOHWACCEL
-# include <VBox/VBoxVideo.h>
-# include <VBox/vmm/ssm.h>
+/*
+ * VirtualBox Qt GUI - VBox* headers.
+ */
+#include "VBoxAboutDlg.h"
+//#include "VBoxCocoaHelper.h"
+//#include "VBoxCocoaSpecialControls.h"
+#include "VBoxFBOverlay.h"
+#include "VBoxFBOverlayCommon.h"
+#include "VBoxFilePathSelectorWidget.h"
+#include "VBoxGlobal.h"
+#include "VBoxGlobalSettings.h"
+#include "VBoxGuestRAMSlider.h"
+//#include "VBoxIChatTheaterWrapper.h"
+#include "VBoxLicenseViewer.h"
+#include "VBoxMediaComboBox.h"
+#include "VBoxOSTypeSelectorButton.h"
+#include "VBoxSettingsSelector.h"
+#include "VBoxSnapshotDetailsDlg.h"
+#include "VBoxSnapshotsWgt.h"
+#include "VBoxTakeSnapshotDlg.h"
+#ifdef RT_OS_DARWIN
+# include "VBoxUtils-darwin.h"
+#endif
+#ifdef RT_OS_WINDOWS
+# include "VBoxUtils-win.h"
 #endif
+/* Note! X.h shall not be included as it defines KeyPress and KeyRelease that
+         are used as enum constants in VBoxUtils.h.  Don't bother undefining
+         the redefinitions, just prevent the inclusion of the header! */
+#include "VBoxUtils.h"
+#include "VBoxVersion.h"
+#ifdef Q_WS_X11
+# include "VBoxX11Helper.h"
+#endif
+
 
+/*
+ * Final tweaks.
+ */
 #ifdef Q_WS_MAC
 # if MAC_LEOPARD_STYLE /* This is defined by UIDefs.h and must come after it was included */
-#  include <qmacstyle_mac.h>
+//#  include <qmacstyle_mac.h> - only used once
 # endif
 #endif
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
index 1fc0c3b..3ff9a59 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIActionPoolRuntime.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIActionPoolRuntime class implementation
+ * VBox Qt GUI - UIActionPoolRuntime class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,10 +15,31 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Local includes: */
-#include "UIActionPoolRuntime.h"
-#include "UIShortcutPool.h"
-#include "VBoxGlobal.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* GUI includes: */
+# include "UIActionPoolRuntime.h"
+# include "UIMultiScreenLayout.h"
+# include "UIExtraDataManager.h"
+# include "UIShortcutPool.h"
+# include "UIFrameBuffer.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
+# include "UISession.h"
+# include "VBoxGlobal.h"
+
+/* COM includes: */
+# include "CExtPack.h"
+# include "CExtPackManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+
 
 class UIActionMenuMachineRuntime : public UIActionMenu
 {
@@ -29,13 +48,17 @@ class UIActionMenuMachineRuntime : public UIActionMenu
 public:
 
     UIActionMenuMachineRuntime(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
+        : UIActionMenu(pParent) {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Machine; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Machine); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Machine); }
+
     void retranslateUi()
     {
         setName(QApplication::translate("UIActionPool", "&Machine"));
@@ -49,13 +72,17 @@ class UIActionSimpleShowSettingsDialog : public UIActionSimple
 public:
 
     UIActionSimpleShowSettingsDialog(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_settings_16px.png", ":/vm_settings_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_settings_16px.png", ":/vm_settings_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog); }
+
     QString shortcutExtraDataID() const
     {
         return QString("SettingsDialog");
@@ -80,13 +107,17 @@ class UIActionSimplePerformTakeSnapshot : public UIActionSimple
 public:
 
     UIActionSimplePerformTakeSnapshot(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/snapshot_take_16px.png", ":/snapshot_take_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/snapshot_take_16px.png", ":/snapshot_take_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot); }
+
     QString shortcutExtraDataID() const
     {
         return QString("TakeSnapshot");
@@ -104,37 +135,6 @@ protected:
     }
 };
 
-class UIActionSimplePerformTakeScreenshot : public UIActionSimple
-{
-    Q_OBJECT;
-
-public:
-
-    UIActionSimplePerformTakeScreenshot(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/screenshot_take_16px.png", ":/screenshot_take_disabled_16px.png")
-    {
-        retranslateUi();
-    }
-
-protected:
-
-    QString shortcutExtraDataID() const
-    {
-        return QString("TakeScreenshot");
-    }
-
-    QKeySequence defaultShortcut(UIActionPoolType) const
-    {
-        return QKeySequence("E");
-    }
-
-    void retranslateUi()
-    {
-        setName(QApplication::translate("UIActionPool", "Take Screensh&ot..."));
-        setStatusTip(QApplication::translate("UIActionPool", "Take a screenshot of the virtual machine"));
-    }
-};
-
 class UIActionSimpleShowInformationDialog : public UIActionSimple
 {
     Q_OBJECT;
@@ -142,13 +142,17 @@ class UIActionSimpleShowInformationDialog : public UIActionSimple
 public:
 
     UIActionSimpleShowInformationDialog(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/session_info_16px.png", ":/session_info_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/session_info_16px.png", ":/session_info_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_InformationDialog); }
+
     QString shortcutExtraDataID() const
     {
         return QString("InformationDialog");
@@ -166,120 +170,6 @@ protected:
     }
 };
 
-class UIActionMenuMouseIntegration : public UIActionMenu
-{
-    Q_OBJECT;
-
-public:
-
-    UIActionMenuMouseIntegration(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
-
-protected:
-
-    void retranslateUi() {}
-};
-
-class UIActionToggleMouseIntegration : public UIActionToggle
-{
-    Q_OBJECT;
-
-public:
-
-    UIActionToggleMouseIntegration(UIActionPool *pParent)
-        : UIActionToggle(pParent,
-                         ":/mouse_can_seamless_on_16px.png", ":/mouse_can_seamless_16px.png",
-                         ":/mouse_can_seamless_on_disabled_16px.png", ":/mouse_can_seamless_disabled_16px.png")
-    {
-        retranslateUi();
-    }
-
-protected:
-
-    QString shortcutExtraDataID() const
-    {
-        return QString("MouseIntegration");
-    }
-
-    QKeySequence defaultShortcut(UIActionPoolType) const
-    {
-        return QKeySequence("I");
-    }
-
-    void retranslateUi()
-    {
-        setName(QApplication::translate("UIActionPool", "Disable &Mouse Integration"));
-        setStatusTip(QApplication::translate("UIActionPool", "Temporarily disable host mouse pointer integration"));
-    }
-};
-
-class UIActionSimplePerformTypeCAD : public UIActionSimple
-{
-    Q_OBJECT;
-
-public:
-
-    UIActionSimplePerformTypeCAD(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/hostkey_16px.png", ":/hostkey_disabled_16px.png")
-    {
-        retranslateUi();
-    }
-
-protected:
-
-    QString shortcutExtraDataID() const
-    {
-        return QString("TypeCAD");
-    }
-
-    QKeySequence defaultShortcut(UIActionPoolType) const
-    {
-        return QKeySequence("Del");
-    }
-
-    void retranslateUi()
-    {
-        setName(QApplication::translate("UIActionPool", "&Insert Ctrl-Alt-Del"));
-        setStatusTip(QApplication::translate("UIActionPool", "Send the Ctrl-Alt-Del sequence to the virtual machine"));
-    }
-};
-
-#ifdef Q_WS_X11
-class UIActionSimplePerformTypeCABS : public UIActionSimple
-{
-    Q_OBJECT;
-
-public:
-
-    UIActionSimplePerformTypeCABS(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/hostkey_16px.png", ":/hostkey_disabled_16px.png")
-    {
-        retranslateUi();
-    }
-
-protected:
-
-    QString shortcutExtraDataID() const
-    {
-        return QString("TypeCABS");
-    }
-
-    QKeySequence defaultShortcut(UIActionPoolType) const
-    {
-        return QKeySequence("Backspace");
-    }
-
-    void retranslateUi()
-    {
-        setName(QApplication::translate("UIActionPool", "Ins&ert Ctrl-Alt-Backspace"));
-        setStatusTip(QApplication::translate("UIActionPool", "Send the Ctrl-Alt-Backspace sequence to the virtual machine"));
-    }
-};
-#endif /* Q_WS_X11 */
-
 class UIActionTogglePause : public UIActionToggle
 {
     Q_OBJECT;
@@ -289,13 +179,17 @@ public:
     UIActionTogglePause(UIActionPool *pParent)
         : UIActionToggle(pParent,
                          ":/vm_pause_on_16px.png", ":/vm_pause_16px.png",
-                         ":/vm_pause_on_disabled_16px.png", ":/vm_pause_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/vm_pause_on_disabled_16px.png", ":/vm_pause_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Pause); }
+
     QString shortcutExtraDataID() const
     {
         return QString("Pause");
@@ -320,13 +214,17 @@ class UIActionSimplePerformReset : public UIActionSimple
 public:
 
     UIActionSimplePerformReset(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_reset_16px.png", ":/vm_reset_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_reset_16px.png", ":/vm_reset_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Reset); }
+
     QString shortcutExtraDataID() const
     {
         return QString("Reset");
@@ -351,13 +249,17 @@ class UIActionSimplePerformSaveState : public UIActionSimple
 public:
 
     UIActionSimplePerformSaveState(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_save_state_16px.png", ":/vm_save_state_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_save_state_16px.png", ":/vm_save_state_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SaveState); }
+
     QString shortcutExtraDataID() const
     {
         return QString("SaveState");
@@ -377,13 +279,17 @@ class UIActionSimplePerformShutdown : public UIActionSimple
 public:
 
     UIActionSimplePerformShutdown(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_shutdown_16px.png", ":/vm_shutdown_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_shutdown_16px.png", ":/vm_shutdown_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Shutdown); }
+
     QString shortcutExtraDataID() const
     {
         return QString("Shutdown");
@@ -412,13 +318,17 @@ class UIActionSimplePerformPowerOff : public UIActionSimple
 public:
 
     UIActionSimplePerformPowerOff(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_poweroff_16px.png", ":/vm_poweroff_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_poweroff_16px.png", ":/vm_poweroff_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType_PowerOff); }
+
     QString shortcutExtraDataID() const
     {
         return QString("PowerOff");
@@ -431,56 +341,49 @@ protected:
     }
 };
 
-class UIActionSimplePerformClose : public UIActionSimple
+class UIActionMenuView : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimplePerformClose(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/exit_16px.png")
-    {
-        setMenuRole(QAction::QuitRole);
-        retranslateUi();
-    }
+    UIActionMenuView(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
 
 protected:
 
-    QString shortcutExtraDataID() const
-    {
-        return QString("Close");
-    }
-
-    QKeySequence defaultShortcut(UIActionPoolType) const
-    {
-        return QKeySequence("Q");
-    }
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_View; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_View); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_View); }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Close..."));
-        setStatusTip(QApplication::translate("UIActionPool", "Close the virtual machine"));
+        setName(QApplication::translate("UIActionPool", "&View"));
     }
 };
 
-class UIActionMenuView : public UIActionMenu
+class UIActionMenuViewPopup : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuView(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
+    UIActionMenuViewPopup(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
 
 protected:
 
-    void retranslateUi()
-    {
-        setName(QApplication::translate("UIActionPool", "&View"));
-    }
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_View; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_View); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_View); }
+
+    void retranslateUi() {}
 };
 
 class UIActionToggleFullscreenMode : public UIActionToggle
@@ -492,13 +395,17 @@ public:
     UIActionToggleFullscreenMode(UIActionPool *pParent)
         : UIActionToggle(pParent,
                          ":/fullscreen_on_16px.png", ":/fullscreen_16px.png",
-                         ":/fullscreen_on_disabled_16px.png", ":/fullscreen_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/fullscreen_on_disabled_16px.png", ":/fullscreen_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen); }
+
     QString shortcutExtraDataID() const
     {
         return QString("FullscreenMode");
@@ -511,8 +418,8 @@ protected:
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Switch to &Fullscreen"));
-        setStatusTip(QApplication::translate("UIActionPool", "Switch between normal and fullscreen mode"));
+        setName(QApplication::translate("UIActionPool", "&Full-screen Mode"));
+        setStatusTip(QApplication::translate("UIActionPool", "Switch between normal and full-screen mode"));
     }
 };
 
@@ -525,13 +432,17 @@ public:
     UIActionToggleSeamlessMode(UIActionPool *pParent)
         : UIActionToggle(pParent,
                          ":/seamless_on_16px.png", ":/seamless_16px.png",
-                         ":/seamless_on_disabled_16px.png", ":/seamless_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/seamless_on_disabled_16px.png", ":/seamless_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless); }
+
     QString shortcutExtraDataID() const
     {
         return QString("SeamlessMode");
@@ -544,7 +455,7 @@ protected:
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Switch to Seam&less Mode"));
+        setName(QApplication::translate("UIActionPool", "Seam&less Mode"));
         setStatusTip(QApplication::translate("UIActionPool", "Switch between normal and seamless desktop integration mode"));
     }
 };
@@ -558,13 +469,17 @@ public:
     UIActionToggleScaleMode(UIActionPool *pParent)
         : UIActionToggle(pParent,
                          ":/scale_on_16px.png", ":/scale_16px.png",
-                         ":/scale_on_disabled_16px.png", ":/scale_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/scale_on_disabled_16px.png", ":/scale_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale); }
+
     QString shortcutExtraDataID() const
     {
         return QString("ScaleMode");
@@ -577,7 +492,7 @@ protected:
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Switch to &Scaled Mode"));
+        setName(QApplication::translate("UIActionPool", "S&caled Mode"));
         setStatusTip(QApplication::translate("UIActionPool", "Switch between normal and scaled mode"));
     }
 };
@@ -591,13 +506,17 @@ public:
     UIActionToggleGuestAutoresize(UIActionPool *pParent)
         : UIActionToggle(pParent,
                          ":/auto_resize_on_on_16px.png", ":/auto_resize_on_16px.png",
-                         ":/auto_resize_on_on_disabled_16px.png", ":/auto_resize_on_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/auto_resize_on_on_disabled_16px.png", ":/auto_resize_on_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize); }
+
     QString shortcutExtraDataID() const
     {
         return QString("GuestAutoresize");
@@ -622,13 +541,17 @@ class UIActionSimplePerformWindowAdjust : public UIActionSimple
 public:
 
     UIActionSimplePerformWindowAdjust(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/adjust_win_size_16px.png", ":/adjust_win_size_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/adjust_win_size_16px.png", ":/adjust_win_size_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow); }
+
     QString shortcutExtraDataID() const
     {
         return QString("WindowAdjust");
@@ -646,706 +569,2392 @@ protected:
     }
 };
 
-class UIActionMenuDevices : public UIActionMenu
+class UIActionSimplePerformTakeScreenshot : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuDevices(UIActionPool *pParent)
-        : UIActionMenu(pParent)
+    UIActionSimplePerformTakeScreenshot(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/screenshot_take_16px.png", ":/screenshot_take_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_TakeScreenshot); }
+
+    QString shortcutExtraDataID() const
     {
-        retranslateUi();
+        return QString("TakeScreenshot");
     }
 
-protected:
+    QKeySequence defaultShortcut(UIActionPoolType) const
+    {
+        return QKeySequence("E");
+    }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Devices"));
+        setName(QApplication::translate("UIActionPool", "Take Screensh&ot..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Take a screenshot of the virtual machine"));
     }
 };
 
-class UIActionMenuOpticalDevices : public UIActionMenu
+class UIActionMenuVideoCapture : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuOpticalDevices(UIActionPool *pParent)
-        : UIActionMenu(pParent, ":/cd_16px.png", ":/cd_disabled_16px.png")
-    {
-        qobject_cast<UIMenu*>(menu())->setShowToolTips(true);
-        retranslateUi();
-    }
+    UIActionMenuVideoCapture(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCapture; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCapture); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCapture); }
+
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&CD/DVD Devices"));
+        setName(QApplication::translate("UIActionPool", "&Video Capture"));
     }
 };
 
-class UIActionMenuFloppyDevices : public UIActionMenu
+class UIActionSimpleShowVideoCaptureSettingsDialog : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuFloppyDevices(UIActionPool *pParent)
-        : UIActionMenu(pParent, ":/fd_16px.png", ":/fd_disabled_16px.png")
-    {
-        qobject_cast<UIMenu*>(menu())->setShowToolTips(true);
-        retranslateUi();
-    }
+    UIActionSimpleShowVideoCaptureSettingsDialog(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/video_capture_settings_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("VideoCaptureSettingsDialog");
+    }
+
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Floppy Devices"));
+        setName(QApplication::translate("UIActionPool", "&Video Capture Settings..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Configure video capture settings"));
     }
 };
 
-class UIActionMenuUSBDevices : public UIActionMenu
+class UIActionToggleVideoCapture : public UIActionToggle
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuUSBDevices(UIActionPool *pParent)
-        : UIActionMenu(pParent, ":/usb_16px.png", ":/usb_disabled_16px.png")
-    {
-        qobject_cast<UIMenu*>(menu())->setShowToolTips(true);
-        retranslateUi();
-    }
+    UIActionToggleVideoCapture(UIActionPool *pParent)
+        : UIActionToggle(pParent,
+                         ":/video_capture_on_16px.png", ":/video_capture_16px.png",
+                         ":/video_capture_on_disabled_16px.png", ":/video_capture_disabled_16px.png") {}
 
 protected:
 
-    void retranslateUi()
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StartVideoCapture); }
+
+    QString shortcutExtraDataID() const
     {
-        setName(QApplication::translate("UIActionPool", "&USB Devices"));
+        return QString("VideoCapture");
     }
-};
-
-class UIActionMenuWebCams : public UIActionMenu
-{
-    Q_OBJECT;
-
-public:
-
-    UIActionMenuWebCams(UIActionPool *pParent)
-        : UIActionMenu(pParent, ":/web_camera_16px.png", ":/web_camera_disabled_16px.png")
-    {
-        qobject_cast<UIMenu*>(menu())->setShowToolTips(true);
-        retranslateUi();
-    }
-
-protected:
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Webcams"));
+        setName(QApplication::translate("UIActionPool", "&Video Capture"));
+        setStatusTip(QApplication::translate("UIActionPool", "Toggle video capture"));
     }
 };
 
-class UIActionMenuSharedClipboard : public UIActionMenu
+class UIActionToggleVRDEServer : public UIActionToggle
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuSharedClipboard(UIActionPool *pParent)
-        : UIActionMenu(pParent, ":/shared_clipboard_16px.png", ":/shared_clipboard_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+    UIActionToggleVRDEServer(UIActionPool *pParent)
+        : UIActionToggle(pParent,
+                         ":/vrdp_on_16px.png", ":/vrdp_16px.png",
+                         ":/vrdp_on_disabled_16px.png", ":/vrdp_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("VRDPServer");
+    }
+
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Shared &Clipboard"));
+        setName(QApplication::translate("UIActionPool", "R&emote Display"));
+        setStatusTip(QApplication::translate("UIActionPool", "Toggle remote desktop (RDP) connections to this machine"));
     }
 };
 
-class UIActionMenuDragAndDrop : public UIActionMenu
+class UIActionMenuMenuBar : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuDragAndDrop(UIActionPool *pParent)
-        : UIActionMenu(pParent, ":/drag_drop_16px.png", ":/drag_drop_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+    UIActionMenuMenuBar(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/menubar_16px.png", ":/menubar_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar); }
+
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Drag'n'Drop"));
+        setName(QApplication::translate("UIActionPool", "&Menu Bar"));
     }
 };
 
-class UIActionMenuNetworkAdapters : public UIActionMenu
+class UIActionSimpleShowMenuBarSettingsWindow : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuNetworkAdapters(UIActionPool *pParent)
-        : UIActionMenu(pParent, ":/nw_16px.png", ":/nw_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+    UIActionSimpleShowMenuBarSettingsWindow(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/menubar_settings_16px.png", ":/menubar_settings_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBarSettings); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("MenuBarSettings");
+    }
+
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Network"));
+        setName(QApplication::translate("UIActionPool", "&Menu Bar Settings..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Opens window to configure menu-bar"));
     }
 };
 
-class UIActionSimpleShowNetworkSettingsDialog : public UIActionSimple
+#ifndef RT_OS_DARWIN
+class UIActionToggleMenuBar : public UIActionToggle
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimpleShowNetworkSettingsDialog(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/nw_settings_16px.png", ":/nw_settings_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+    UIActionToggleMenuBar(UIActionPool *pParent)
+        : UIActionToggle(pParent, ":/menubar_on_16px.png", ":/menubar_16px.png",
+                                  ":/menubar_on_disabled_16px.png", ":/menubar_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleMenuBar); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("NetworkSettingsDialog");
+        return QString("ToggleMenuBar");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Network Settings..."));
-        setStatusTip(QApplication::translate("UIActionPool", "Change the settings of network adapters"));
+        setName(QApplication::translate("UIActionPool", "Show Menu &Bar"));
+        setStatusTip(QApplication::translate("UIActionPool", "Toggle menu-bar visibility for this machine"));
     }
 };
+#endif /* !RT_OS_DARWIN */
 
-class UIActionMenuSharedFolders : public UIActionMenu
+class UIActionMenuStatusBar : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuSharedFolders(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
+    UIActionMenuStatusBar(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/statusbar_16px.png", ":/statusbar_disabled_16px.png") {}
 
 protected:
 
-    void retranslateUi() {}
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Status Bar"));
+    }
 };
 
-class UIActionSimpleShowSharedFoldersSettingsDialog : public UIActionSimple
+class UIActionSimpleShowStatusBarSettingsWindow : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimpleShowSharedFoldersSettingsDialog(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/sf_settings_16px.png", ":/sf_settings_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+    UIActionSimpleShowStatusBarSettingsWindow(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/statusbar_settings_16px.png", ":/statusbar_settings_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBarSettings); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("SharedFoldersSettingsDialog");
+        return QString("StatusBarSettings");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Shared Folders Settings..."));
-        setStatusTip(QApplication::translate("UIActionPool", "Create or modify shared folders"));
+        setName(QApplication::translate("UIActionPool", "&Status Bar Settings..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Opens window to configure status-bar"));
     }
 };
 
-class UIActionToggleVRDEServer : public UIActionToggle
+class UIActionToggleStatusBar : public UIActionToggle
 {
     Q_OBJECT;
 
 public:
 
-    UIActionToggleVRDEServer(UIActionPool *pParent)
-        : UIActionToggle(pParent,
-                         ":/vrdp_on_16px.png", ":/vrdp_16px.png",
-                         ":/vrdp_on_disabled_16px.png", ":/vrdp_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+    UIActionToggleStatusBar(UIActionPool *pParent)
+        : UIActionToggle(pParent, ":/statusbar_on_16px.png", ":/statusbar_16px.png",
+                                  ":/statusbar_on_disabled_16px.png", ":/statusbar_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ToggleStatusBar); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("VRDPServer");
+        return QString("ToggleStatusBar");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "R&emote Display"));
-        setStatusTip(QApplication::translate("UIActionPool", "Toggle remote desktop (RDP) connections to this machine"));
+        setName(QApplication::translate("UIActionPool", "Show Status &Bar"));
+        setStatusTip(QApplication::translate("UIActionPool", "Toggle status-bar visibility for this machine"));
     }
 };
 
-class UIActionMenuVideoCapture : public UIActionMenu
+class UIActionMenuScaleFactor : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuVideoCapture(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
+    UIActionMenuScaleFactor(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/scale_factor_16px.png", ":/scale_factor_disabled_16px.png") {}
 
 protected:
 
-    void retranslateUi() {}
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "S&cale Factor"));
+    }
 };
 
-class UIActionToggleVideoCapture : public UIActionToggle
+class UIActionMenuInput : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionToggleVideoCapture(UIActionPool *pParent)
-        : UIActionToggle(pParent,
-                         ":/video_capture_on_16px.png", ":/video_capture_16px.png",
-                         ":/video_capture_on_disabled_16px.png", ":/video_capture_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+    UIActionMenuInput(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
 
 protected:
 
-    QString shortcutExtraDataID() const
-    {
-        return QString("VideoCapture");
-    }
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Input; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Input); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Input); }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Video Capture"));
-        setStatusTip(QApplication::translate("UIActionPool", "Toggle video capture"));
+        setName(QApplication::translate("UIActionPool", "&Input"));
     }
 };
 
-class UIActionSimpleShowVideoCaptureSettingsDialog : public UIActionSimple
+class UIActionMenuKeyboard : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimpleShowVideoCaptureSettingsDialog(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/video_capture_settings_16px.png")
+    UIActionMenuKeyboard(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/keyboard_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Keyboard); }
+
+    void retranslateUi()
     {
-        retranslateUi();
+        setName(QApplication::translate("UIActionPool", "&Keyboard"));
     }
+};
+
+class UIActionSimpleKeyboardSettings : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleKeyboardSettings(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/keyboard_settings_16px.png", ":/keyboard_settings_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("VideoCaptureSettingsDialog");
+        return QString("KeyboardSettings");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Video Capture Settings..."));
-        setStatusTip(QApplication::translate("UIActionPool", "Configure video capture settings"));
+        setName(QApplication::translate("UIActionPool", "&Keyboard Settings..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Display the global settings window to configure shortcuts"));
     }
 };
 
-class UIActionSimplePerformInstallGuestTools : public UIActionSimple
+class UIActionSimplePerformTypeCAD : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimplePerformInstallGuestTools(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/guesttools_16px.png", ":/guesttools_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+    UIActionSimplePerformTypeCAD(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/hostkey_16px.png", ":/hostkey_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCAD); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("InstallGuestAdditions");
+        return QString("TypeCAD");
     }
 
     QKeySequence defaultShortcut(UIActionPoolType) const
     {
-        return QKeySequence("D");
+        return QKeySequence("Del");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Insert Guest Additions CD image..."));
-        setStatusTip(QApplication::translate("UIActionPool", "Insert the Guest Additions disk file into the virtual drive"));
+        setName(QApplication::translate("UIActionPool", "&Insert %1").arg("Ctrl-Alt-Del"));
+        setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Ctrl-Alt-Del"));
     }
 };
 
-#ifdef VBOX_WITH_DEBUGGER_GUI
-class UIActionMenuDebug : public UIActionMenu
+#ifdef Q_WS_X11
+class UIActionSimplePerformTypeCABS : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuDebug(UIActionPool *pParent)
-        : UIActionMenu(pParent)
+    UIActionSimplePerformTypeCABS(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/hostkey_16px.png", ":/hostkey_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCABS); }
+
+    QString shortcutExtraDataID() const
     {
-        retranslateUi();
+        return QString("TypeCABS");
     }
 
-protected:
+    QKeySequence defaultShortcut(UIActionPoolType) const
+    {
+        return QKeySequence("Backspace");
+    }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "De&bug"));
+        setName(QApplication::translate("UIActionPool", "&Insert %1").arg("Ctrl-Alt-Backspace"));
+        setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Ctrl-Alt-Backspace"));
     }
 };
+#endif /* Q_WS_X11 */
 
-class UIActionSimpleShowStatistics : public UIActionSimple
+class UIActionSimplePerformTypeCtrlBreak : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimpleShowStatistics(UIActionPool *pParent)
-        : UIActionSimple(pParent)
-    {
-        retranslateUi();
-    }
+    UIActionSimplePerformTypeCtrlBreak(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/hostkey_16px.png", ":/hostkey_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeCtrlBreak); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("StatisticWindow");
+        return QString("TypeCtrlBreak");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Statistics...", "debug action"));
+        setName(QApplication::translate("UIActionPool", "&Insert %1").arg("Ctrl-Break"));
+        setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Ctrl-Break"));
     }
 };
 
-class UIActionSimpleShowCommandLine : public UIActionSimple
+class UIActionSimplePerformTypeInsert : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimpleShowCommandLine(UIActionPool *pParent)
-        : UIActionSimple(pParent)
-    {
-        retranslateUi();
-    }
+    UIActionSimplePerformTypeInsert(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/hostkey_16px.png", ":/hostkey_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_TypeInsert); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("CommandLineWindow");
+        return QString("TypeInsert");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Command Line...", "debug action"));
+        setName(QApplication::translate("UIActionPool", "&Insert %1").arg("Insert"));
+        setStatusTip(QApplication::translate("UIActionPool", "Send the %1 sequence to the virtual machine").arg("Insert"));
     }
 };
 
-class UIActionToggleLogging : public UIActionToggle
+class UIActionMenuMouse : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionToggleLogging(UIActionPool *pParent)
-        : UIActionToggle(pParent)
+    UIActionMenuMouse(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_Mouse); }
+
+    void retranslateUi()
     {
-        retranslateUi();
+        setName(QApplication::translate("UIActionPool", "&Mouse"));
     }
+};
+
+class UIActionToggleMouseIntegration : public UIActionToggle
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionToggleMouseIntegration(UIActionPool *pParent)
+        : UIActionToggle(pParent,
+                         ":/mouse_can_seamless_on_16px.png", ":/mouse_can_seamless_16px.png",
+                         ":/mouse_can_seamless_on_disabled_16px.png", ":/mouse_can_seamless_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType_MouseIntegration); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("Logging");
+        return QString("MouseIntegration");
+    }
+
+    QKeySequence defaultShortcut(UIActionPoolType) const
+    {
+        return QKeySequence("I");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Logging...", "debug action"));
+        setName(QApplication::translate("UIActionPool", "&Mouse Integration"));
+        setStatusTip(QApplication::translate("UIActionPool", "Enable host mouse pointer integration"));
     }
 };
-#endif /* VBOX_WITH_DEBUGGER_GUI */
 
-#ifdef RT_OS_DARWIN
-class UIActionMenuDock : public UIActionMenu
+class UIActionMenuDevices : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuDock(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
+    UIActionMenuDevices(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
 
 protected:
 
-    void retranslateUi() {}
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Devices; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Devices); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Devices); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Devices"));
+    }
 };
 
-class UIActionMenuDockSettings : public UIActionMenu
+class UIActionMenuHardDrives : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionMenuDockSettings(UIActionPool *pParent)
-        : UIActionMenu(pParent)
+    UIActionMenuHardDrives(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/hd_16px.png", ":/hd_disabled_16px.png")
     {
-        retranslateUi();
+        setShowToolTip(true);
     }
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrives); }
+
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Dock Icon"));
+        setName(QApplication::translate("UIActionPool", "&Hard Drives"));
     }
 };
 
-class UIActionToggleDockPreviewMonitor : public UIActionToggle
+class UIActionSimpleShowHardDrivesSettingsDialog : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionToggleDockPreviewMonitor(UIActionPool *pParent)
-        : UIActionToggle(pParent)
-    {
-        retranslateUi();
-    }
+    UIActionSimpleShowHardDrivesSettingsDialog(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/hd_settings_16px.png", ":/hd_settings_disabled_16px.png") {}
 
 protected:
 
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings); }
+
     QString shortcutExtraDataID() const
     {
-        return QString("DockPreviewMonitor");
+        return QString("HardDriveSettingsDialog");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Show Monitor Preview"));
+        setName(QApplication::translate("UIActionPool", "&Hard Drive Settings..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Change the settings of hard drives"));
     }
 };
 
-class UIActionToggleDockDisableMonitor : public UIActionToggle
+class UIActionMenuOpticalDevices : public UIActionMenu
 {
     Q_OBJECT;
 
 public:
 
-    UIActionToggleDockDisableMonitor(UIActionPool *pParent)
-        : UIActionToggle(pParent)
+    UIActionMenuOpticalDevices(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/cd_16px.png", ":/cd_disabled_16px.png")
     {
-        retranslateUi();
+        setShowToolTip(true);
     }
 
 protected:
 
-    QString shortcutExtraDataID() const
-    {
-        return QString("DockDisableMonitor");
-    }
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices); }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "Show Application Icon"));
+        setName(QApplication::translate("UIActionPool", "&Optical Drives"));
     }
 };
-#endif /* Q_WS_MAC */
 
-
-UIActionPoolRuntime::UIActionPoolRuntime()
-    : UIActionPool(UIActionPoolType_Runtime)
+class UIActionMenuFloppyDevices : public UIActionMenu
 {
-    /* Prepare connections: */
-    connect(gShortcutPool, SIGNAL(sigMachineShortcutsReloaded()), this, SLOT(sltApplyShortcuts()));
-}
+    Q_OBJECT;
 
-void UIActionPoolRuntime::retranslateUi()
-{
-    /* Translate all the actions: */
-    foreach (const int iActionPoolKey, m_pool.keys())
-        m_pool[iActionPoolKey]->retranslateUi();
-    /* Re-apply Runtime UI shortcuts: */
-    sltApplyShortcuts();
-    /* Temporary create Selector UI pool to do the same: */
-    UIActionPool::createTemporary(UIActionPoolType_Selector);
-}
+public:
 
-QString UIActionPoolRuntime::shortcutsExtraDataID() const
-{
-    return GUI_Input_MachineShortcuts;
-}
+    UIActionMenuFloppyDevices(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/fd_16px.png", ":/fd_disabled_16px.png")
+    {
+        setShowToolTip(true);
+    }
 
-void UIActionPoolRuntime::createActions()
-{
-    /* Global actions creation: */
-    UIActionPool::createActions();
+protected:
 
-    /* 'Machine' actions: */
-    m_pool[UIActionIndexRuntime_Simple_SettingsDialog] = new UIActionSimpleShowSettingsDialog(this);
-    m_pool[UIActionIndexRuntime_Simple_TakeSnapshot] = new UIActionSimplePerformTakeSnapshot(this);
-    m_pool[UIActionIndexRuntime_Simple_TakeScreenshot] = new UIActionSimplePerformTakeScreenshot(this);
-    m_pool[UIActionIndexRuntime_Simple_InformationDialog] = new UIActionSimpleShowInformationDialog(this);
-    m_pool[UIActionIndexRuntime_Toggle_MouseIntegration] = new UIActionToggleMouseIntegration(this);
-    m_pool[UIActionIndexRuntime_Simple_TypeCAD] = new UIActionSimplePerformTypeCAD(this);
-#ifdef Q_WS_X11
-    m_pool[UIActionIndexRuntime_Simple_TypeCABS] = new UIActionSimplePerformTypeCABS(this);
-#endif /* Q_WS_X11 */
-    m_pool[UIActionIndexRuntime_Toggle_Pause] = new UIActionTogglePause(this);
-    m_pool[UIActionIndexRuntime_Simple_Reset] = new UIActionSimplePerformReset(this);
-    m_pool[UIActionIndexRuntime_Simple_SaveState] = new UIActionSimplePerformSaveState(this);
-    m_pool[UIActionIndexRuntime_Simple_Shutdown] = new UIActionSimplePerformShutdown(this);
-    m_pool[UIActionIndexRuntime_Simple_PowerOff] = new UIActionSimplePerformPowerOff(this);
-    m_pool[UIActionIndexRuntime_Simple_Close] = new UIActionSimplePerformClose(this);
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices); }
 
-    /* 'View' actions: */
-    m_pool[UIActionIndexRuntime_Toggle_Fullscreen] = new UIActionToggleFullscreenMode(this);
-    m_pool[UIActionIndexRuntime_Toggle_Seamless] = new UIActionToggleSeamlessMode(this);
-    m_pool[UIActionIndexRuntime_Toggle_Scale] = new UIActionToggleScaleMode(this);
-    m_pool[UIActionIndexRuntime_Toggle_GuestAutoresize] = new UIActionToggleGuestAutoresize(this);
-    m_pool[UIActionIndexRuntime_Simple_AdjustWindow] = new UIActionSimplePerformWindowAdjust(this);
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Floppy Drives"));
+    }
+};
+
+class UIActionMenuNetworkAdapters : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuNetworkAdapters(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/nw_16px.png", ":/nw_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "Network"));
+    }
+};
+
+class UIActionSimpleShowNetworkSettingsDialog : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleShowNetworkSettingsDialog(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/nw_settings_16px.png", ":/nw_settings_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("NetworkSettingsDialog");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Network Settings..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Change the settings of network adapters"));
+    }
+};
+
+class UIActionMenuUSBDevices : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuUSBDevices(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/usb_16px.png", ":/usb_disabled_16px.png")
+    {
+        setShowToolTip(true);
+    }
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&USB"));
+    }
+};
+
+class UIActionSimpleShowUSBDevicesSettingsDialog : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleShowUSBDevicesSettingsDialog(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/usb_settings_16px.png", ":/usb_settings_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("USBDevicesSettingsDialog");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&USB Settings..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Change the settings of USB devices"));
+    }
+};
+
+class UIActionMenuWebCams : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuWebCams(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/web_camera_16px.png", ":/web_camera_disabled_16px.png")
+    {
+        setShowToolTip(true);
+    }
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Webcams"));
+    }
+};
+
+class UIActionMenuSharedClipboard : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuSharedClipboard(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/shared_clipboard_16px.png", ":/shared_clipboard_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedClipboard); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "Shared &Clipboard"));
+    }
+};
+
+class UIActionMenuDragAndDrop : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuDragAndDrop(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/drag_drop_16px.png", ":/drag_drop_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_DragAndDrop); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "Drag and Drop"));
+    }
+};
+
+class UIActionMenuSharedFolders : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuSharedFolders(UIActionPool *pParent)
+        : UIActionMenu(pParent, ":/sf_16px.png", ":/sf_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFolders); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Shared Folders"));
+    }
+};
+
+class UIActionSimpleShowSharedFoldersSettingsDialog : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleShowSharedFoldersSettingsDialog(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/sf_settings_16px.png", ":/sf_settings_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("SharedFoldersSettingsDialog");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Shared Folders Settings..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Create or modify shared folders"));
+    }
+};
+
+class UIActionSimplePerformInstallGuestTools : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimplePerformInstallGuestTools(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/guesttools_16px.png", ":/guesttools_disabled_16px.png") {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_InstallGuestTools); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("InstallGuestAdditions");
+    }
+
+    QKeySequence defaultShortcut(UIActionPoolType) const
+    {
+        return QKeySequence("D");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Insert Guest Additions CD image..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Insert the Guest Additions disk file into the virtual drive"));
+    }
+};
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+class UIActionMenuDebug : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuDebug(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::MenuType_Debug; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::MenuType_Debug); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->isAllowedInMenuBar(UIExtraDataMetaDefs::MenuType_Debug); }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "De&bug"));
+    }
+};
+
+class UIActionSimpleShowStatistics : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleShowStatistics(UIActionPool *pParent)
+        : UIActionSimple(pParent) {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Statistics); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("StatisticWindow");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Statistics...", "debug action"));
+    }
+};
+
+class UIActionSimpleShowCommandLine : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleShowCommandLine(UIActionPool *pParent)
+        : UIActionSimple(pParent) {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_CommandLine); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("CommandLineWindow");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Command Line...", "debug action"));
+    }
+};
+
+class UIActionToggleLogging : public UIActionToggle
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionToggleLogging(UIActionPool *pParent)
+        : UIActionToggle(pParent) {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Logging); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("Logging");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Logging", "debug action"));
+    }
+};
+
+class UIActionSimpleShowLogDialog : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleShowLogDialog(UIActionPool *pParent)
+        : UIActionSimple(pParent) {}
+
+protected:
+
+    /** Returns action extra-data ID. */
+    virtual int extraDataID() const { return UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog; }
+    /** Returns action extra-data key. */
+    virtual QString extraDataKey() const { return gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog); }
+    /** Returns whether action is allowed. */
+    virtual bool isAllowed() const { return actionPool()->toRuntime()->isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_LogDialog); }
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("LogWindow");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "Show &Log...", "debug action"));
+    }
+};
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef RT_OS_DARWIN
+class UIActionMenuDock : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuDock(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
+
+protected:
+
+    void retranslateUi() {}
+};
+
+class UIActionMenuDockSettings : public UIActionMenu
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionMenuDockSettings(UIActionPool *pParent)
+        : UIActionMenu(pParent) {}
+
+protected:
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "Dock Icon"));
+    }
+};
+
+class UIActionToggleDockPreviewMonitor : public UIActionToggle
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionToggleDockPreviewMonitor(UIActionPool *pParent)
+        : UIActionToggle(pParent) {}
+
+protected:
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("DockPreviewMonitor");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "Show Monitor Preview"));
+    }
+};
+
+class UIActionToggleDockDisableMonitor : public UIActionToggle
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionToggleDockDisableMonitor(UIActionPool *pParent)
+        : UIActionToggle(pParent) {}
+
+protected:
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("DockDisableMonitor");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "Show Application Icon"));
+    }
+};
+#endif /* Q_WS_MAC */
+
+
+UIActionPoolRuntime::UIActionPoolRuntime(bool fTemporary /* = false */)
+    : UIActionPool(UIActionPoolType_Runtime, fTemporary)
+    , m_pSession(0)
+    , m_pMultiScreenLayout(0)
+{
+}
+
+void UIActionPoolRuntime::setSession(UISession *pSession)
+{
+    m_pSession = pSession;
+    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
+}
+
+void UIActionPoolRuntime::setMultiScreenLayout(UIMultiScreenLayout *pMultiScreenLayout)
+{
+    /* Disconnect old stuff: */
+    if (m_pMultiScreenLayout)
+    {
+        disconnect(this, SIGNAL(sigNotifyAboutTriggeringViewScreenRemap(int, int)),
+                   m_pMultiScreenLayout, SLOT(sltHandleScreenLayoutChange(int, int)));
+        disconnect(m_pMultiScreenLayout, SIGNAL(sigScreenLayoutUpdate()),
+                   this, SLOT(sltHandleScreenLayoutUpdate()));
+    }
+
+    /* Assign new multi-screen layout: */
+    m_pMultiScreenLayout = pMultiScreenLayout;
+
+    /* Connect new stuff: */
+    if (m_pMultiScreenLayout)
+    {
+        connect(this, SIGNAL(sigNotifyAboutTriggeringViewScreenRemap(int, int)),
+                m_pMultiScreenLayout, SLOT(sltHandleScreenLayoutChange(int, int)));
+        connect(m_pMultiScreenLayout, SIGNAL(sigScreenLayoutUpdate()),
+                this, SLOT(sltHandleScreenLayoutUpdate()));
+    }
+
+    /* Invalidate View menu: */
+    m_invalidations << UIActionIndexRT_M_View;
+}
+
+bool UIActionPoolRuntime::isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType type) const
+{
+    foreach (const UIExtraDataMetaDefs::RuntimeMenuMachineActionType &restriction, m_restrictedActionsMenuMachine.values())
+        if (restriction & type)
+            return false;
+    return true;
+}
+
+void UIActionPoolRuntime::setRestrictionForMenuMachine(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuMachineActionType restriction)
+{
+    m_restrictedActionsMenuMachine[level] = restriction;
+    m_invalidations << UIActionIndexRT_M_Machine;
+}
+
+bool UIActionPoolRuntime::isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType type) const
+{
+    foreach (const UIExtraDataMetaDefs::RuntimeMenuViewActionType &restriction, m_restrictedActionsMenuView.values())
+        if (restriction & type)
+            return false;
+    return true;
+}
+
+void UIActionPoolRuntime::setRestrictionForMenuView(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuViewActionType restriction)
+{
+    m_restrictedActionsMenuView[level] = restriction;
+    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
+}
+
+bool UIActionPoolRuntime::isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType type) const
+{
+    foreach (const UIExtraDataMetaDefs::RuntimeMenuInputActionType &restriction, m_restrictedActionsMenuInput.values())
+        if (restriction & type)
+            return false;
+    return true;
+}
+
+void UIActionPoolRuntime::setRestrictionForMenuInput(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuInputActionType restriction)
+{
+    m_restrictedActionsMenuInput[level] = restriction;
+    m_invalidations << UIActionIndexRT_M_Input;
+}
+
+bool UIActionPoolRuntime::isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType type) const
+{
+    foreach (const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType &restriction, m_restrictedActionsMenuDevices.values())
+        if (restriction & type)
+            return false;
+    return true;
+}
+
+void UIActionPoolRuntime::setRestrictionForMenuDevices(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restriction)
+{
+    m_restrictedActionsMenuDevices[level] = restriction;
+    m_invalidations << UIActionIndexRT_M_Devices;
+}
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+bool UIActionPoolRuntime::isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType type) const
+{
+    foreach (const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType &restriction, m_restrictedActionsMenuDebug.values())
+        if (restriction & type)
+            return false;
+    return true;
+}
+
+void UIActionPoolRuntime::setRestrictionForMenuDebugger(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restriction)
+{
+    m_restrictedActionsMenuDebug[level] = restriction;
+    m_invalidations << UIActionIndexRT_M_Debug;
+}
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+void UIActionPoolRuntime::sltHandleConfigurationChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (vboxGlobal().managedVMUuid() != strMachineID)
+        return;
+
+    /* Update configuration: */
+    updateConfiguration();
+}
+
+void UIActionPoolRuntime::sltHandleActionTriggerViewScaleFactor(QAction *pAction)
+{
+    /* Make sure sender is valid: */
+    AssertPtrReturnVoid(pAction);
+
+    /* Change scale-factor directly: */
+    const double dScaleFactor = pAction->property("Requested Scale Factor").toDouble();
+    gEDataManager->setScaleFactor(dScaleFactor, vboxGlobal().managedVMUuid());
+}
+
+void UIActionPoolRuntime::sltPrepareMenuViewScreen()
+{
+    /* Make sure sender is valid: */
+    QMenu *pMenu = qobject_cast<QMenu*>(sender());
+    AssertPtrReturnVoid(pMenu);
+
+    /* Call to corresponding handler: */
+    updateMenuViewScreen(pMenu);
+}
+
+void UIActionPoolRuntime::sltPrepareMenuViewMultiscreen()
+{
+    /* Make sure sender is valid: */
+    QMenu *pMenu = qobject_cast<QMenu*>(sender());
+    AssertPtrReturnVoid(pMenu);
+
+    /* Call to corresponding handler: */
+    updateMenuViewMultiscreen(pMenu);
+}
+
+void UIActionPoolRuntime::sltHandleActionTriggerViewScreenToggle()
+{
+    /* Make sure sender is valid: */
+    QAction *pAction = qobject_cast<QAction*>(sender());
+    AssertPtrReturnVoid(pAction);
+
+    /* Send request to enable/disable guest-screen: */
+    const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
+    const bool fScreenEnabled = pAction->isChecked();
+    emit sigNotifyAboutTriggeringViewScreenToggle(iGuestScreenIndex, fScreenEnabled);
+}
+
+void UIActionPoolRuntime::sltHandleActionTriggerViewScreenResize(QAction *pAction)
+{
+    /* Make sure sender is valid: */
+    AssertPtrReturnVoid(pAction);
+
+    /* Send request to resize guest-screen to required size: */
+    const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
+    const QSize size = pAction->property("Requested Size").toSize();
+    emit sigNotifyAboutTriggeringViewScreenResize(iGuestScreenIndex, size);
+}
+
+void UIActionPoolRuntime::sltHandleActionTriggerViewScreenRemap(QAction *pAction)
+{
+    /* Make sure sender is valid: */
+    AssertPtrReturnVoid(pAction);
+
+    /* Send request to remap guest-screen to required host-screen: */
+    const int iGuestScreenIndex = pAction->property("Guest Screen Index").toInt();
+    const int iHostScreenIndex = pAction->property("Host Screen Index").toInt();
+    emit sigNotifyAboutTriggeringViewScreenRemap(iGuestScreenIndex, iHostScreenIndex);
+}
+
+void UIActionPoolRuntime::sltHandleScreenLayoutUpdate()
+{
+    /* Invalidate View menu: */
+    m_invalidations << UIActionIndexRT_M_View;
+}
+
+void UIActionPoolRuntime::preparePool()
+{
+    /* 'Machine' actions: */
+    m_pool[UIActionIndexRT_M_Machine] = new UIActionMenuMachineRuntime(this);
+    m_pool[UIActionIndexRT_M_Machine_S_Settings] = new UIActionSimpleShowSettingsDialog(this);
+    m_pool[UIActionIndexRT_M_Machine_S_TakeSnapshot] = new UIActionSimplePerformTakeSnapshot(this);
+    m_pool[UIActionIndexRT_M_Machine_S_ShowInformation] = new UIActionSimpleShowInformationDialog(this);
+    m_pool[UIActionIndexRT_M_Machine_T_Pause] = new UIActionTogglePause(this);
+    m_pool[UIActionIndexRT_M_Machine_S_Reset] = new UIActionSimplePerformReset(this);
+    m_pool[UIActionIndexRT_M_Machine_S_SaveState] = new UIActionSimplePerformSaveState(this);
+    m_pool[UIActionIndexRT_M_Machine_S_Shutdown] = new UIActionSimplePerformShutdown(this);
+    m_pool[UIActionIndexRT_M_Machine_S_PowerOff] = new UIActionSimplePerformPowerOff(this);
+
+    /* 'View' actions: */
+    m_pool[UIActionIndexRT_M_View] = new UIActionMenuView(this);
+    m_pool[UIActionIndexRT_M_ViewPopup] = new UIActionMenuViewPopup(this);
+    m_pool[UIActionIndexRT_M_View_T_Fullscreen] = new UIActionToggleFullscreenMode(this);
+    m_pool[UIActionIndexRT_M_View_T_Seamless] = new UIActionToggleSeamlessMode(this);
+    m_pool[UIActionIndexRT_M_View_T_Scale] = new UIActionToggleScaleMode(this);
+    m_pool[UIActionIndexRT_M_View_T_GuestAutoresize] = new UIActionToggleGuestAutoresize(this);
+    m_pool[UIActionIndexRT_M_View_S_AdjustWindow] = new UIActionSimplePerformWindowAdjust(this);
+    m_pool[UIActionIndexRT_M_View_S_TakeScreenshot] = new UIActionSimplePerformTakeScreenshot(this);
+    m_pool[UIActionIndexRT_M_View_M_VideoCapture] = new UIActionMenuVideoCapture(this);
+    m_pool[UIActionIndexRT_M_View_M_VideoCapture_S_Settings] = new UIActionSimpleShowVideoCaptureSettingsDialog(this);
+    m_pool[UIActionIndexRT_M_View_M_VideoCapture_T_Start] = new UIActionToggleVideoCapture(this);
+    m_pool[UIActionIndexRT_M_View_T_VRDEServer] = new UIActionToggleVRDEServer(this);
+    m_pool[UIActionIndexRT_M_View_M_MenuBar] = new UIActionMenuMenuBar(this);
+    m_pool[UIActionIndexRT_M_View_M_MenuBar_S_Settings] = new UIActionSimpleShowMenuBarSettingsWindow(this);
+#ifndef RT_OS_DARWIN
+    m_pool[UIActionIndexRT_M_View_M_MenuBar_T_Visibility] = new UIActionToggleMenuBar(this);
+#endif /* !RT_OS_DARWIN */
+    m_pool[UIActionIndexRT_M_View_M_StatusBar] = new UIActionMenuStatusBar(this);
+    m_pool[UIActionIndexRT_M_View_M_StatusBar_S_Settings] = new UIActionSimpleShowStatusBarSettingsWindow(this);
+    m_pool[UIActionIndexRT_M_View_M_StatusBar_T_Visibility] = new UIActionToggleStatusBar(this);
+    m_pool[UIActionIndexRT_M_View_M_ScaleFactor] = new UIActionMenuScaleFactor(this);
+
+    /* 'Input' actions: */
+    m_pool[UIActionIndexRT_M_Input] = new UIActionMenuInput(this);
+    m_pool[UIActionIndexRT_M_Input_M_Keyboard] = new UIActionMenuKeyboard(this);
+    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_Settings] = new UIActionSimpleKeyboardSettings(this);
+    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeCAD] = new UIActionSimplePerformTypeCAD(this);
+#ifdef Q_WS_X11
+    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeCABS] = new UIActionSimplePerformTypeCABS(this);
+#endif /* Q_WS_X11 */
+    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak] = new UIActionSimplePerformTypeCtrlBreak(this);
+    m_pool[UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert] = new UIActionSimplePerformTypeInsert(this);
+    m_pool[UIActionIndexRT_M_Input_M_Mouse] = new UIActionMenuMouse(this);
+    m_pool[UIActionIndexRT_M_Input_M_Mouse_T_Integration] = new UIActionToggleMouseIntegration(this);
 
     /* 'Devices' actions: */
-    m_pool[UIActionIndexRuntime_Simple_NetworkSettings] = new UIActionSimpleShowNetworkSettingsDialog(this);
-    m_pool[UIActionIndexRuntime_Simple_SharedFoldersSettings] = new UIActionSimpleShowSharedFoldersSettingsDialog(this);
-    m_pool[UIActionIndexRuntime_Toggle_VRDEServer] = new UIActionToggleVRDEServer(this);
-    m_pool[UIActionIndexRuntime_Toggle_VideoCapture] = new UIActionToggleVideoCapture(this);
-    m_pool[UIActionIndexRuntime_Simple_VideoCaptureSettings] = new UIActionSimpleShowVideoCaptureSettingsDialog(this);
-    m_pool[UIActionIndexRuntime_Simple_InstallGuestTools] = new UIActionSimplePerformInstallGuestTools(this);
+    m_pool[UIActionIndexRT_M_Devices] = new UIActionMenuDevices(this);
+    m_pool[UIActionIndexRT_M_Devices_M_HardDrives] = new UIActionMenuHardDrives(this);
+    m_pool[UIActionIndexRT_M_Devices_M_HardDrives_S_Settings] = new UIActionSimpleShowHardDrivesSettingsDialog(this);
+    m_pool[UIActionIndexRT_M_Devices_M_OpticalDevices] = new UIActionMenuOpticalDevices(this);
+    m_pool[UIActionIndexRT_M_Devices_M_FloppyDevices] = new UIActionMenuFloppyDevices(this);
+    m_pool[UIActionIndexRT_M_Devices_M_Network] = new UIActionMenuNetworkAdapters(this);
+    m_pool[UIActionIndexRT_M_Devices_M_Network_S_Settings] = new UIActionSimpleShowNetworkSettingsDialog(this);
+    m_pool[UIActionIndexRT_M_Devices_M_USBDevices] = new UIActionMenuUSBDevices(this);
+    m_pool[UIActionIndexRT_M_Devices_M_USBDevices_S_Settings] = new UIActionSimpleShowUSBDevicesSettingsDialog(this);
+    m_pool[UIActionIndexRT_M_Devices_M_WebCams] = new UIActionMenuWebCams(this);
+    m_pool[UIActionIndexRT_M_Devices_M_SharedClipboard] = new UIActionMenuSharedClipboard(this);
+    m_pool[UIActionIndexRT_M_Devices_M_DragAndDrop] = new UIActionMenuDragAndDrop(this);
+    m_pool[UIActionIndexRT_M_Devices_M_SharedFolders] = new UIActionMenuSharedFolders(this);
+    m_pool[UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings] = new UIActionSimpleShowSharedFoldersSettingsDialog(this);
+    m_pool[UIActionIndexRT_M_Devices_S_InstallGuestTools] = new UIActionSimplePerformInstallGuestTools(this);
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /* 'Debug' actions: */
-    m_pool[UIActionIndexRuntime_Simple_Statistics] = new UIActionSimpleShowStatistics(this);
-    m_pool[UIActionIndexRuntime_Simple_CommandLine] = new UIActionSimpleShowCommandLine(this);
-    m_pool[UIActionIndexRuntime_Toggle_Logging] = new UIActionToggleLogging(this);
+    m_pool[UIActionIndexRT_M_Debug] = new UIActionMenuDebug(this);
+    m_pool[UIActionIndexRT_M_Debug_S_ShowStatistics] = new UIActionSimpleShowStatistics(this);
+    m_pool[UIActionIndexRT_M_Debug_S_ShowCommandLine] = new UIActionSimpleShowCommandLine(this);
+    m_pool[UIActionIndexRT_M_Debug_T_Logging] = new UIActionToggleLogging(this);
+    m_pool[UIActionIndexRT_M_Debug_S_ShowLogDialog] = new UIActionSimpleShowLogDialog(this);
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
 #ifdef Q_WS_MAC
     /* 'Dock' actions: */
-    m_pool[UIActionIndexRuntime_Toggle_DockPreviewMonitor] = new UIActionToggleDockPreviewMonitor(this);
-    m_pool[UIActionIndexRuntime_Toggle_DockDisableMonitor] = new UIActionToggleDockDisableMonitor(this);
+    m_pool[UIActionIndexRT_M_Dock] = new UIActionMenuDock(this);
+    m_pool[UIActionIndexRT_M_Dock_M_DockSettings] = new UIActionMenuDockSettings(this);
+    m_pool[UIActionIndexRT_M_Dock_M_DockSettings_T_PreviewMonitor] = new UIActionToggleDockPreviewMonitor(this);
+    m_pool[UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor] = new UIActionToggleDockDisableMonitor(this);
+#endif /* Q_WS_MAC */
+
+    /* Prepare update-handlers for known menus: */
+    m_menuUpdateHandlers[UIActionIndexRT_M_Machine].ptfr =                 &UIActionPoolRuntime::updateMenuMachine;
+    m_menuUpdateHandlers[UIActionIndexRT_M_View].ptfr =                    &UIActionPoolRuntime::updateMenuView;
+    m_menuUpdateHandlers[UIActionIndexRT_M_ViewPopup].ptfr =               &UIActionPoolRuntime::updateMenuViewPopup;
+    m_menuUpdateHandlers[UIActionIndexRT_M_View_M_VideoCapture].ptfr =     &UIActionPoolRuntime::updateMenuViewVideoCapture;
+    m_menuUpdateHandlers[UIActionIndexRT_M_View_M_MenuBar].ptfr =          &UIActionPoolRuntime::updateMenuViewMenuBar;
+    m_menuUpdateHandlers[UIActionIndexRT_M_View_M_StatusBar].ptfr =        &UIActionPoolRuntime::updateMenuViewStatusBar;
+    m_menuUpdateHandlers[UIActionIndexRT_M_View_M_ScaleFactor].ptfr =      &UIActionPoolRuntime::updateMenuViewScaleFactor;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Input].ptfr =                   &UIActionPoolRuntime::updateMenuInput;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Input_M_Keyboard].ptfr =        &UIActionPoolRuntime::updateMenuInputKeyboard;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Input_M_Mouse].ptfr =           &UIActionPoolRuntime::updateMenuInputMouse;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices].ptfr =                 &UIActionPoolRuntime::updateMenuDevices;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_HardDrives].ptfr =    &UIActionPoolRuntime::updateMenuDevicesHardDrives;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_Network].ptfr =       &UIActionPoolRuntime::updateMenuDevicesNetwork;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_USBDevices].ptfr =    &UIActionPoolRuntime::updateMenuDevicesUSBDevices;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_SharedFolders].ptfr = &UIActionPoolRuntime::updateMenuDevicesSharedFolders;
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    m_menuUpdateHandlers[UIActionIndexRT_M_Debug].ptfr =                   &UIActionPoolRuntime::updateMenuDebug;
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+    /* Call to base-class: */
+    UIActionPool::preparePool();
+}
+
+void UIActionPoolRuntime::prepareConnections()
+{
+    /* Prepare connections: */
+    connect(gShortcutPool, SIGNAL(sigMachineShortcutsReloaded()), this, SLOT(sltApplyShortcuts()));
+    connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
+            this, SLOT(sltHandleConfigurationChange(const QString&)));
+
+    /* Call to base-class: */
+    UIActionPool::prepareConnections();
+}
+
+void UIActionPoolRuntime::updateConfiguration()
+{
+    /* Get machine ID: */
+    const QString strMachineID = vboxGlobal().managedVMUuid();
+    if (strMachineID.isNull())
+        return;
+
+    /* Recache common action restrictions: */
+    m_restrictedMenus[UIActionRestrictionLevel_Base] =                  gEDataManager->restrictedRuntimeMenuTypes(strMachineID);
+    m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(strMachineID);
+    m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] =     gEDataManager->restrictedRuntimeMenuMachineActionTypes(strMachineID);
+    m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] =        gEDataManager->restrictedRuntimeMenuViewActionTypes(strMachineID);
+    m_restrictedActionsMenuInput[UIActionRestrictionLevel_Base] =       gEDataManager->restrictedRuntimeMenuInputActionTypes(strMachineID);
+    m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] =     gEDataManager->restrictedRuntimeMenuDevicesActionTypes(strMachineID);
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    m_restrictedActionsMenuDebug[UIActionRestrictionLevel_Base] =       gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(strMachineID);
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+    m_restrictedActionsMenuWindow[UIActionRestrictionLevel_Base] =      gEDataManager->restrictedRuntimeMenuWindowActionTypes(strMachineID);
 #endif /* Q_WS_MAC */
+    m_restrictedActionsMenuHelp[UIActionRestrictionLevel_Base] =        gEDataManager->restrictedRuntimeMenuHelpActionTypes(strMachineID);
+
+    /* Recache visual state action restrictions: */
+    UIVisualStateType restrictedVisualStates = gEDataManager->restrictedVisualStates(strMachineID);
+    {
+        if (restrictedVisualStates & UIVisualStateType_Fullscreen)
+            m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
+                (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_Fullscreen);
+        if (restrictedVisualStates & UIVisualStateType_Seamless)
+            m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
+                (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_Seamless);
+        if (restrictedVisualStates & UIVisualStateType_Scale)
+            m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
+                (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_Scale);
+    }
+
+    /* Recache reconfiguration action restrictions: */
+    bool fReconfigurationAllowed = gEDataManager->machineReconfigurationEnabled(strMachineID);
+    if (!fReconfigurationAllowed)
+    {
+        m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)
+            (m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_SettingsDialog);
+        m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
+            (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VideoCaptureSettings);
+        m_restrictedActionsMenuInput[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuInputActionType)
+            (m_restrictedActionsMenuInput[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuInputActionType_KeyboardSettings);
+        m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
+            (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_HardDrivesSettings);
+        m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
+            (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_NetworkSettings);
+        m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
+            (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevicesSettings);
+        m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)
+            (m_restrictedActionsMenuDevices[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_SharedFoldersSettings);
+    }
+
+    /* Recache snapshot related action restrictions: */
+    bool fSnapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(strMachineID);
+    if (!fSnapshotOperationsAllowed)
+    {
+        m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)
+            (m_restrictedActionsMenuMachine[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuMachineActionType_TakeSnapshot);
+    }
+
+    /* Recache extension-pack related action restrictions: */
+    CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
+    bool fExtensionPackOperationsAllowed = !extPack.isNull() && extPack.GetUsable();
+    if (!fExtensionPackOperationsAllowed)
+    {
+        m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
+            (m_restrictedActionsMenuView[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer);
+    }
+
+    /* Recache close related action restrictions: */
+    MachineCloseAction restrictedCloseActions = gEDataManager->restrictedMachineCloseActions(strMachineID);
+    bool fAllCloseActionsRestricted =    (!vboxGlobal().isSeparateProcess() || (restrictedCloseActions & MachineCloseAction_Detach))
+                                      && (restrictedCloseActions & MachineCloseAction_SaveState)
+                                      && (restrictedCloseActions & MachineCloseAction_Shutdown)
+                                      && (restrictedCloseActions & MachineCloseAction_PowerOff);
+                                      // Close VM Dialog hides PowerOff_RestoringSnapshot implicitly if PowerOff is hidden..
+                                      // && (m_restrictedCloseActions & MachineCloseAction_PowerOff_RestoringSnapshot);
+    if (fAllCloseActionsRestricted)
+    {
+        m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] = (UIExtraDataMetaDefs::MenuApplicationActionType)
+            (m_restrictedActionsMenuApplication[UIActionRestrictionLevel_Base] | UIExtraDataMetaDefs::MenuApplicationActionType_Close);
+    }
+
+    /* Call to base-class: */
+    UIActionPool::updateConfiguration();
 }
 
-void UIActionPoolRuntime::createMenus()
+void UIActionPoolRuntime::updateMenu(int iIndex)
 {
-    /* Global menus creation: */
-    UIActionPool::createMenus();
+    /* Call to base-class: */
+    if (iIndex < UIActionIndex_Max)
+        UIActionPool::updateMenu(iIndex);
 
-    /* On Mac OS X, all QMenu's are consumed by Qt after they are added to another QMenu or a QMenuBar.
-     * This means we have to recreate all QMenus when creating a new QMenuBar.
-     * For simplicity we doing this on all platforms right now. */
+    /* If menu with such index is invalidated and there is update-handler: */
+    if (m_invalidations.contains(iIndex) && m_menuUpdateHandlers.contains(iIndex))
+        (this->*(m_menuUpdateHandlers.value(iIndex).ptfr))();
+}
+
+void UIActionPoolRuntime::updateMenus()
+{
+    /* Clear menu list: */
+    m_mainMenus.clear();
 
-    /* Recreate 'close' item as well.
-     * This makes sure it is removed also from the Application menu: */
-    if (m_pool[UIActionIndexRuntime_Simple_Close])
-        delete m_pool[UIActionIndexRuntime_Simple_Close];
-    m_pool[UIActionIndexRuntime_Simple_Close] = new UIActionSimplePerformClose(this);
+    /* 'Application' menu: */
+    addMenu(m_mainMenus, action(UIActionIndex_M_Application));
+    updateMenuApplication();
 
     /* 'Machine' menu: */
-    if (m_pool[UIActionIndexRuntime_Menu_Machine])
-        delete m_pool[UIActionIndexRuntime_Menu_Machine];
-    m_pool[UIActionIndexRuntime_Menu_Machine] = new UIActionMenuMachineRuntime(this);
-    if (m_pool[UIActionIndexRuntime_Menu_MouseIntegration])
-        delete m_pool[UIActionIndexRuntime_Menu_MouseIntegration];
-    m_pool[UIActionIndexRuntime_Menu_MouseIntegration] = new UIActionMenuMouseIntegration(this);
+    addMenu(m_mainMenus, action(UIActionIndexRT_M_Machine));
+    updateMenuMachine();
 
     /* 'View' menu: */
-    if (m_pool[UIActionIndexRuntime_Menu_View])
-        delete m_pool[UIActionIndexRuntime_Menu_View];
-    m_pool[UIActionIndexRuntime_Menu_View] = new UIActionMenuView(this);
+    addMenu(m_mainMenus, action(UIActionIndexRT_M_View));
+    updateMenuView();
+    /* 'View' popup menu: */
+    addMenu(m_mainMenus, action(UIActionIndexRT_M_ViewPopup), false);
+    updateMenuViewPopup();
+
+    /* 'Input' menu: */
+    addMenu(m_mainMenus, action(UIActionIndexRT_M_Input));
+    updateMenuInput();
 
     /* 'Devices' menu: */
-    if (m_pool[UIActionIndexRuntime_Menu_Devices])
-        delete m_pool[UIActionIndexRuntime_Menu_Devices];
-    m_pool[UIActionIndexRuntime_Menu_Devices] = new UIActionMenuDevices(this);
-    if (m_pool[UIActionIndexRuntime_Menu_OpticalDevices])
-        delete m_pool[UIActionIndexRuntime_Menu_OpticalDevices];
-    m_pool[UIActionIndexRuntime_Menu_OpticalDevices] = new UIActionMenuOpticalDevices(this);
-    if (m_pool[UIActionIndexRuntime_Menu_FloppyDevices])
-        delete m_pool[UIActionIndexRuntime_Menu_FloppyDevices];
-    m_pool[UIActionIndexRuntime_Menu_FloppyDevices] = new UIActionMenuFloppyDevices(this);
-    if (m_pool[UIActionIndexRuntime_Menu_USBDevices])
-        delete m_pool[UIActionIndexRuntime_Menu_USBDevices];
-    m_pool[UIActionIndexRuntime_Menu_USBDevices] = new UIActionMenuUSBDevices(this);
-    if (m_pool[UIActionIndexRuntime_Menu_WebCams])
-        delete m_pool[UIActionIndexRuntime_Menu_WebCams];
-    m_pool[UIActionIndexRuntime_Menu_WebCams] = new UIActionMenuWebCams(this);
-    if (m_pool[UIActionIndexRuntime_Menu_SharedClipboard])
-        delete m_pool[UIActionIndexRuntime_Menu_SharedClipboard];
-    m_pool[UIActionIndexRuntime_Menu_SharedClipboard] = new UIActionMenuSharedClipboard(this);
-    if (m_pool[UIActionIndexRuntime_Menu_DragAndDrop])
-        delete m_pool[UIActionIndexRuntime_Menu_DragAndDrop];
-    m_pool[UIActionIndexRuntime_Menu_DragAndDrop] = new UIActionMenuDragAndDrop(this);
-    if (m_pool[UIActionIndexRuntime_Menu_Network])
-        delete m_pool[UIActionIndexRuntime_Menu_Network];
-    m_pool[UIActionIndexRuntime_Menu_Network] = new UIActionMenuNetworkAdapters(this);
-    if (m_pool[UIActionIndexRuntime_Menu_SharedFolders])
-        delete m_pool[UIActionIndexRuntime_Menu_SharedFolders];
-    m_pool[UIActionIndexRuntime_Menu_SharedFolders] = new UIActionMenuSharedFolders(this);
-    if (m_pool[UIActionIndexRuntime_Menu_VideoCapture])
-        delete m_pool[UIActionIndexRuntime_Menu_VideoCapture];
-    m_pool[UIActionIndexRuntime_Menu_VideoCapture] = new UIActionMenuVideoCapture(this);
+    addMenu(m_mainMenus, action(UIActionIndexRT_M_Devices));
+    updateMenuDevices();
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /* 'Debug' menu: */
-    if (m_pool[UIActionIndexRuntime_Menu_Debug])
-        delete m_pool[UIActionIndexRuntime_Menu_Debug];
-    m_pool[UIActionIndexRuntime_Menu_Debug] = new UIActionMenuDebug(this);
+    addMenu(m_mainMenus, action(UIActionIndexRT_M_Debug), vboxGlobal().isDebuggerEnabled());
+    updateMenuDebug();
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
-#ifdef Q_WS_MAC
-    /* 'Dock' menu: */
-    if (m_pool[UIActionIndexRuntime_Menu_Dock])
-        delete m_pool[UIActionIndexRuntime_Menu_Dock];
-    m_pool[UIActionIndexRuntime_Menu_Dock] = new UIActionMenuDock(this);
-    if (m_pool[UIActionIndexRuntime_Menu_DockSettings])
-        delete m_pool[UIActionIndexRuntime_Menu_DockSettings];
-    m_pool[UIActionIndexRuntime_Menu_DockSettings] = new UIActionMenuDockSettings(this);
-#endif /* Q_WS_MAC */
+#ifdef RT_OS_DARWIN
+    /* 'Window' menu: */
+    addMenu(m_mainMenus, action(UIActionIndex_M_Window));
+    updateMenuWindow();
+#endif /* RT_OS_DARWIN */
+
+    /* 'Help' menu: */
+    addMenu(m_mainMenus, action(UIActionIndex_Menu_Help));
+    updateMenuHelp();
+}
+
+void UIActionPoolRuntime::updateMenuMachine()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Machine)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Settings Dialog' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Settings)) || fSeparator;
+    /* 'Take Snapshot' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_TakeSnapshot)) || fSeparator;
+    /* 'Information Dialog' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_ShowInformation)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Pause' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_T_Pause)) || fSeparator;
+    /* 'Reset' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Reset)) || fSeparator;
+    /* 'SaveState' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_SaveState)) || fSeparator;
+    /* 'Shutdown' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_Shutdown)) || fSeparator;
+    /* 'PowerOff' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Machine_S_PowerOff)) || fSeparator;
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_Machine);
+}
+
+void UIActionPoolRuntime::updateMenuView()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_View)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Fullscreen' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Fullscreen)) || fSeparator;
+    /* 'Seamless' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Seamless)) || fSeparator;
+    /* 'Scale' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_Scale)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Adjust Window' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_AdjustWindow)) || fSeparator;
+    /* 'Guest Autoresize' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_GuestAutoresize)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Take Screenshot' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_TakeScreenshot)) || fSeparator;
+    /* 'Video Capture' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_VideoCapture), false) || fSeparator;
+    updateMenuViewVideoCapture();
+    /* 'Video Capture Start' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_VideoCapture_T_Start)) || fSeparator;
+    /* 'VRDE Server' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_VRDEServer)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Menu Bar' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar)) || fSeparator;
+    updateMenuViewMenuBar();
+    /* 'Status Bar' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar)) || fSeparator;
+    updateMenuViewStatusBar();
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Scale Factor' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_ScaleFactor)) || fSeparator;
+    updateMenuViewScaleFactor();
+
+    /* Do we have to show resize or multiscreen menu? */
+    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
+    const bool fAllowToShowActionMultiscreen = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen);
+    if (fAllowToShowActionResize && uisession())
+    {
+        for (int iGuestScreenIndex = 0; iGuestScreenIndex < uisession()->frameBuffers().size(); ++iGuestScreenIndex)
+        {
+            /* Add 'Virtual Screen %1' menu: */
+            QMenu *pSubMenu = pMenu->addMenu(UIIconPool::iconSet(":/virtual_screen_16px.png",
+                                                                 ":/virtual_screen_disabled_16px.png"),
+                                             QApplication::translate("UIMultiScreenLayout",
+                                                                     "Virtual Screen %1").arg(iGuestScreenIndex + 1));
+            pSubMenu->setProperty("Guest Screen Index", iGuestScreenIndex);
+            connect(pSubMenu, SIGNAL(aboutToShow()), this, SLOT(sltPrepareMenuViewScreen()));
+        }
+    }
+    else if (fAllowToShowActionMultiscreen && multiScreenLayout())
+    {
+        /* Only for multi-screen host case: */
+        if (uisession()->hostScreens().size() > 1)
+        {
+            for (int iGuestScreenIndex = 0; iGuestScreenIndex < uisession()->frameBuffers().size(); ++iGuestScreenIndex)
+            {
+                /* Add 'Virtual Screen %1' menu: */
+                QMenu *pSubMenu = pMenu->addMenu(UIIconPool::iconSet(":/virtual_screen_16px.png",
+                                                                     ":/virtual_screen_disabled_16px.png"),
+                                                 QApplication::translate("UIMultiScreenLayout",
+                                                                         "Virtual Screen %1").arg(iGuestScreenIndex + 1));
+                pSubMenu->setProperty("Guest Screen Index", iGuestScreenIndex);
+                connect(pSubMenu, SIGNAL(aboutToShow()), this, SLOT(sltPrepareMenuViewMultiscreen()));
+            }
+        }
+    }
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_View);
+}
+
+void UIActionPoolRuntime::updateMenuViewPopup()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_ViewPopup)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Adjust Window' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_S_AdjustWindow)) || fSeparator;
+    /* 'Guest Autoresize' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_T_GuestAutoresize)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Scale Factor' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_ScaleFactor)) || fSeparator;
+    updateMenuViewScaleFactor();
+
+    /* Do we have to show resize menu? */
+    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
+    if (fAllowToShowActionResize && uisession())
+    {
+        for (int iGuestScreenIndex = 0; iGuestScreenIndex < uisession()->frameBuffers().size(); ++iGuestScreenIndex)
+        {
+            /* Add 'Virtual Screen %1' menu: */
+            QMenu *pSubMenu = pMenu->addMenu(UIIconPool::iconSet(":/virtual_screen_16px.png",
+                                                                 ":/virtual_screen_disabled_16px.png"),
+                                             QApplication::translate("UIMultiScreenLayout",
+                                                                     "Virtual Screen %1").arg(iGuestScreenIndex + 1));
+            pSubMenu->setProperty("Guest Screen Index", iGuestScreenIndex);
+            connect(pSubMenu, SIGNAL(aboutToShow()), this, SLOT(sltPrepareMenuViewScreen()));
+        }
+    }
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_ViewPopup);
+}
+
+void UIActionPoolRuntime::updateMenuViewVideoCapture()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_View_M_VideoCapture)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Video Capture Settings' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_VideoCapture_S_Settings)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Start Video Capture' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_View_M_VideoCapture_T_Start)) || fSeparator;
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_View_M_VideoCapture);
+}
+
+void UIActionPoolRuntime::updateMenuViewMenuBar()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_View_M_MenuBar)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* 'Menu Bar Settings' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar_S_Settings));
+#ifndef Q_WS_MAC
+    /* 'Toggle Menu Bar' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility));
+#endif /* !Q_WS_MAC */
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_View_M_MenuBar);
+}
+
+void UIActionPoolRuntime::updateMenuViewStatusBar()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_View_M_StatusBar)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* 'Status Bar Settings' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar_S_Settings));
+    /* 'Toggle Status Bar' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility));
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_View_M_StatusBar);
+}
+
+void UIActionPoolRuntime::updateMenuViewScaleFactor()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_View_M_ScaleFactor)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Get corresponding scale-factor: */
+    const double dCurrentScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
+
+    /* Prepare new contents: */
+    const QList<double> factors = QList<double>()
+                                  << 1.0
+                                  << 1.1
+                                  << 1.25
+                                  << 1.5
+                                  << 1.75
+                                  << 2.0;
+
+    /* Create exclusive 'scale-factor' action-group: */
+    QActionGroup *pActionGroup = new QActionGroup(pMenu);
+    AssertPtrReturnVoid(pActionGroup);
+    {
+        /* Configure exclusive 'scale-factor' action-group: */
+        pActionGroup->setExclusive(true);
+        /* For every available scale-factor: */
+        foreach (const double &dScaleFactor, factors)
+        {
+            /* Create exclusive 'scale-factor' action: */
+            QAction *pAction = pActionGroup->addAction(tr("%1%", "scale-factor")
+                                                          .arg(dScaleFactor * 100));
+            AssertPtrReturnVoid(pAction);
+            {
+                /* Configure exclusive 'scale-factor' action: */
+                pAction->setProperty("Requested Scale Factor", dScaleFactor);
+                pAction->setCheckable(true);
+                if (dScaleFactor == dCurrentScaleFactor)
+                    pAction->setChecked(true);
+            }
+        }
+        /* Insert group actions into menu: */
+        pMenu->addActions(pActionGroup->actions());
+        /* Install listener for exclusive action-group: */
+        connect(pActionGroup, SIGNAL(triggered(QAction*)),
+                this, SLOT(sltHandleActionTriggerViewScaleFactor(QAction*)));
+    }
+}
+
+void UIActionPoolRuntime::updateMenuViewScreen(QMenu *pMenu)
+{
+    /* Make sure UI session defined: */
+    AssertPtrReturnVoid(uisession());
+
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Prepare new contents: */
+    const QList<QSize> sizes = QList<QSize>()
+                               << QSize(640, 480)
+                               << QSize(800, 600)
+                               << QSize(1024, 768)
+                               << QSize(1280, 720)
+                               << QSize(1280, 800)
+                               << QSize(1366, 768)
+                               << QSize(1440, 900)
+                               << QSize(1600, 900)
+                               << QSize(1680, 1050)
+                               << QSize(1920, 1080)
+                               << QSize(1920, 1200);
+
+    /* Get corresponding screen index and frame-buffer size: */
+    const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();
+    const UIFrameBuffer* pFrameBuffer = uisession()->frameBuffer(iGuestScreenIndex);
+    const QSize screenSize = QSize(pFrameBuffer->width(), pFrameBuffer->height());
+    const bool fScreenEnabled = uisession()->isScreenVisible(iGuestScreenIndex);
+
+    /* For non-primary screens: */
+    if (iGuestScreenIndex > 0)
+    {
+        /* Create 'toggle' action: */
+        QAction *pToggleAction = pMenu->addAction(UIActionPoolRuntime::tr("Enable", "Virtual Screen"),
+                                                  this, SLOT(sltHandleActionTriggerViewScreenToggle()));
+        AssertPtrReturnVoid(pToggleAction);
+        {
+            /* Configure 'toggle' action: */
+            pToggleAction->setEnabled(uisession()->isGuestSupportsGraphics());
+            pToggleAction->setProperty("Guest Screen Index", iGuestScreenIndex);
+            pToggleAction->setCheckable(true);
+            pToggleAction->setChecked(fScreenEnabled);
+            /* Add separator: */
+            pMenu->addSeparator();
+        }
+    }
+
+    /* Create exclusive 'resize' action-group: */
+    QActionGroup *pActionGroup = new QActionGroup(pMenu);
+    AssertPtrReturnVoid(pActionGroup);
+    {
+        /* Configure exclusive 'resize' action-group: */
+        pActionGroup->setExclusive(true);
+        /* For every available size: */
+        foreach (const QSize &size, sizes)
+        {
+            /* Create exclusive 'resize' action: */
+            QAction *pAction = pActionGroup->addAction(UIActionPoolRuntime::tr("Resize to %1x%2", "Virtual Screen")
+                                                                               .arg(size.width()).arg(size.height()));
+            AssertPtrReturnVoid(pAction);
+            {
+                /* Configure exclusive 'resize' action: */
+                pAction->setEnabled(uisession()->isGuestSupportsGraphics() && fScreenEnabled);
+                pAction->setProperty("Guest Screen Index", iGuestScreenIndex);
+                pAction->setProperty("Requested Size", size);
+                pAction->setCheckable(true);
+                if (screenSize.width() == size.width() &&
+                    screenSize.height() == size.height())
+                    pAction->setChecked(true);
+            }
+        }
+        /* Insert group actions into menu: */
+        pMenu->addActions(pActionGroup->actions());
+        /* Install listener for exclusive action-group: */
+        connect(pActionGroup, SIGNAL(triggered(QAction*)),
+                this, SLOT(sltHandleActionTriggerViewScreenResize(QAction*)));
+    }
+}
+
+void UIActionPoolRuntime::updateMenuViewMultiscreen(QMenu *pMenu)
+{
+    /* Make sure UI session defined: */
+    AssertPtrReturnVoid(multiScreenLayout());
+
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Get corresponding screen index and size: */
+    const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();
+
+    /* Create exclusive action-group: */
+    QActionGroup *pActionGroup = new QActionGroup(pMenu);
+    AssertPtrReturnVoid(pActionGroup);
+    {
+        /* Configure exclusive action-group: */
+        pActionGroup->setExclusive(true);
+        for (int iHostScreenIndex = 0; iHostScreenIndex < uisession()->hostScreens().size(); ++iHostScreenIndex)
+        {
+            QAction *pAction = pActionGroup->addAction(UIMultiScreenLayout::tr("Use Host Screen %1")
+                                                                               .arg(iHostScreenIndex + 1));
+            AssertPtrReturnVoid(pAction);
+            {
+                pAction->setCheckable(true);
+                pAction->setProperty("Guest Screen Index", iGuestScreenIndex);
+                pAction->setProperty("Host Screen Index", iHostScreenIndex);
+                if (multiScreenLayout()->hasHostScreenForGuestScreen(iGuestScreenIndex) &&
+                    multiScreenLayout()->hostScreenForGuestScreen(iGuestScreenIndex) == iHostScreenIndex)
+                    pAction->setChecked(true);
+            }
+        }
+        /* Insert group actions into menu: */
+        pMenu->addActions(pActionGroup->actions());
+        /* Install listener for exclusive action-group: */
+        connect(pActionGroup, SIGNAL(triggered(QAction*)),
+                this, SLOT(sltHandleActionTriggerViewScreenRemap(QAction*)));
+    }
+}
+
+void UIActionPoolRuntime::updateMenuInput()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Input)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Keyboard' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard)) || fSeparator;
+    updateMenuInputKeyboard();
+    /* 'Mouse' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Mouse), false) || fSeparator;
+    updateMenuInputMouse();
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Mouse Integration' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)) || fSeparator;
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_Input);
+}
+
+void UIActionPoolRuntime::updateMenuInputKeyboard()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Input_M_Keyboard)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Keyboard Settings' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_Settings)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Type CAD' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCAD)) || fSeparator;
+#ifdef Q_WS_X11
+    /* 'Type CABS' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCABS)) || fSeparator;
+#endif /* Q_WS_X11 */
+    /* 'Type Ctrl-Break' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak)) || fSeparator;
+    /* 'Type Insert' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert)) || fSeparator;
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_Input_M_Keyboard);
+}
+
+void UIActionPoolRuntime::updateMenuInputMouse()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Input_M_Mouse)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* 'Machine Integration' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_Input_M_Mouse_T_Integration));
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_Input_M_Mouse);
+}
+
+void UIActionPoolRuntime::updateMenuDevices()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Devices)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Hard Drives' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_HardDrives)) || fSeparator;
+    updateMenuDevicesHardDrives();
+    /* 'Optical Devices' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_OpticalDevices)) || fSeparator;
+    /* 'Floppy Devices' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_FloppyDevices)) || fSeparator;
+    /* 'Network' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Network)) || fSeparator;
+    updateMenuDevicesNetwork();
+    /* 'USB Devices' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_USBDevices)) || fSeparator;
+    updateMenuDevicesUSBDevices();
+    /* 'Web Cams' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_WebCams)) || fSeparator;
+    /* 'Shared Folders' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders)) || fSeparator;
+    updateMenuDevicesSharedFolders();
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* 'Shared Clipboard' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedClipboard)) || fSeparator;
+    /* 'Drag&Drop' submenu: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_DragAndDrop)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* Install Guest Tools action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_S_InstallGuestTools)) || fSeparator;
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_Devices);
+}
+
+void UIActionPoolRuntime::updateMenuDevicesHardDrives()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_HardDrives)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* 'Hard Drives Settings' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_HardDrives_S_Settings));
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_Devices_M_HardDrives);
+}
+
+void UIActionPoolRuntime::updateMenuDevicesNetwork()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_Network)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'Network Settings' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_Network_S_Settings)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* This menu always remains invalid.. */
+}
+
+void UIActionPoolRuntime::updateMenuDevicesUSBDevices()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_USBDevices)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Separator: */
+    bool fSeparator = false;
+
+    /* 'USB Devices Settings' action: */
+    fSeparator = addAction(pMenu, action(UIActionIndexRT_M_Devices_M_USBDevices_S_Settings)) || fSeparator;
+
+    /* Separator: */
+    if (fSeparator)
+    {
+        pMenu->addSeparator();
+        fSeparator = false;
+    }
+
+    /* This menu always remains invalid.. */
+}
+
+void UIActionPoolRuntime::updateMenuDevicesSharedFolders()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Devices_M_SharedFolders)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* 'Shared Folders Settings' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings));
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_Devices_M_SharedFolders);
+}
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+void UIActionPoolRuntime::updateMenuDebug()
+{
+    /* Get corresponding menu: */
+    UIMenu *pMenu = action(UIActionIndexRT_M_Debug)->menu();
+    AssertPtrReturnVoid(pMenu);
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* 'Statistics' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowStatistics));
+    /* 'Command Line' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowCommandLine));
+    /* 'Logging' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_Debug_T_Logging));
+    /* 'Log Dialog' action: */
+    addAction(pMenu, action(UIActionIndexRT_M_Debug_S_ShowLogDialog));
+
+    /* Mark menu as valid: */
+    m_invalidations.remove(UIActionIndexRT_M_Debug);
+}
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+void UIActionPoolRuntime::retranslateUi()
+{
+    /* Call to base-class: */
+    UIActionPool::retranslateUi();
+    /* Create temporary Selector UI pool to do the same: */
+    if (!m_fTemporary)
+        UIActionPool::createTemporary(UIActionPoolType_Selector);
+}
+
+QString UIActionPoolRuntime::shortcutsExtraDataID() const
+{
+    return GUI_Input_MachineShortcuts;
 }
 
 #include "UIActionPoolRuntime.moc"
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
index c88ffcd..4475bb2 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
@@ -1,11 +1,10 @@
+/* $Id: UIActionPoolRuntime.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIActionPoolRuntime class declaration
+ * VBox Qt GUI - UIActionPoolRuntime class declaration.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,103 +15,286 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIActionPoolRuntime_h__
-#define __UIActionPoolRuntime_h__
+#ifndef ___UIActionPoolRuntime_h___
+#define ___UIActionPoolRuntime_h___
+
+/* Qt includes: */
+#include <QMap>
+#include <QList>
 
-/* Local includes: */
+/* GUI includes: */
 #include "UIActionPool.h"
+#include "UIExtraDataDefs.h"
+
+/* Forward declarations: */
+class UISession;
+class UIMultiScreenLayout;
 
-/* Action keys: */
-enum UIActionIndexRuntime
+/** Runtime action-pool index enum.
+  * Naming convention is following:
+  * 1. Every menu index prepended with 'M',
+  * 2. Every simple-action index prepended with 'S',
+  * 3. Every toggle-action index presended with 'T',
+  * 4. Every polymorphic-action index presended with 'P',
+  * 5. Every sub-index contains full parent-index name. */
+enum UIActionIndexRT
 {
     /* 'Machine' menu actions: */
-    UIActionIndexRuntime_Menu_Machine = UIActionIndex_Max + 1,
-    UIActionIndexRuntime_Simple_SettingsDialog,
-    UIActionIndexRuntime_Simple_TakeSnapshot,
-    UIActionIndexRuntime_Simple_TakeScreenshot,
-    UIActionIndexRuntime_Simple_InformationDialog,
-    UIActionIndexRuntime_Menu_MouseIntegration,
-    UIActionIndexRuntime_Toggle_MouseIntegration,
-    UIActionIndexRuntime_Simple_TypeCAD,
-#ifdef Q_WS_X11
-    UIActionIndexRuntime_Simple_TypeCABS,
-#endif /* Q_WS_X11 */
-    UIActionIndexRuntime_Toggle_Pause,
-    UIActionIndexRuntime_Simple_Reset,
-    UIActionIndexRuntime_Simple_SaveState,
-    UIActionIndexRuntime_Simple_Shutdown,
-    UIActionIndexRuntime_Simple_PowerOff,
-    UIActionIndexRuntime_Simple_Close,
+    UIActionIndexRT_M_Machine = UIActionIndex_Max + 1,
+    UIActionIndexRT_M_Machine_S_Settings,
+    UIActionIndexRT_M_Machine_S_TakeSnapshot,
+    UIActionIndexRT_M_Machine_S_ShowInformation,
+    UIActionIndexRT_M_Machine_T_Pause,
+    UIActionIndexRT_M_Machine_S_Reset,
+    UIActionIndexRT_M_Machine_S_SaveState,
+    UIActionIndexRT_M_Machine_S_Shutdown,
+    UIActionIndexRT_M_Machine_S_PowerOff,
 
     /* 'View' menu actions: */
-    UIActionIndexRuntime_Menu_View,
-    UIActionIndexRuntime_Toggle_Fullscreen,
-    UIActionIndexRuntime_Toggle_Seamless,
-    UIActionIndexRuntime_Toggle_Scale,
-    UIActionIndexRuntime_Toggle_GuestAutoresize,
-    UIActionIndexRuntime_Simple_AdjustWindow,
+    UIActionIndexRT_M_View,
+    UIActionIndexRT_M_ViewPopup,
+    UIActionIndexRT_M_View_T_Fullscreen,
+    UIActionIndexRT_M_View_T_Seamless,
+    UIActionIndexRT_M_View_T_Scale,
+    UIActionIndexRT_M_View_S_AdjustWindow,
+    UIActionIndexRT_M_View_T_GuestAutoresize,
+    UIActionIndexRT_M_View_S_TakeScreenshot,
+    UIActionIndexRT_M_View_M_VideoCapture,
+    UIActionIndexRT_M_View_M_VideoCapture_S_Settings,
+    UIActionIndexRT_M_View_M_VideoCapture_T_Start,
+    UIActionIndexRT_M_View_T_VRDEServer,
+    UIActionIndexRT_M_View_M_MenuBar,
+    UIActionIndexRT_M_View_M_MenuBar_S_Settings,
+#ifndef RT_OS_DARWIN
+    UIActionIndexRT_M_View_M_MenuBar_T_Visibility,
+#endif /* !RT_OS_DARWIN */
+    UIActionIndexRT_M_View_M_StatusBar,
+    UIActionIndexRT_M_View_M_StatusBar_S_Settings,
+    UIActionIndexRT_M_View_M_StatusBar_T_Visibility,
+    UIActionIndexRT_M_View_M_ScaleFactor,
+
+    /* 'Input' menu actions: */
+    UIActionIndexRT_M_Input,
+    UIActionIndexRT_M_Input_M_Keyboard,
+    UIActionIndexRT_M_Input_M_Keyboard_S_Settings,
+    UIActionIndexRT_M_Input_M_Keyboard_S_TypeCAD,
+#ifdef Q_WS_X11
+    UIActionIndexRT_M_Input_M_Keyboard_S_TypeCABS,
+#endif /* Q_WS_X11 */
+    UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak,
+    UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert,
+    UIActionIndexRT_M_Input_M_Mouse,
+    UIActionIndexRT_M_Input_M_Mouse_T_Integration,
 
     /* 'Devices' menu actions: */
-    UIActionIndexRuntime_Menu_Devices,
-    UIActionIndexRuntime_Menu_OpticalDevices,
-    UIActionIndexRuntime_Menu_FloppyDevices,
-    UIActionIndexRuntime_Menu_USBDevices,
-    UIActionIndexRuntime_Menu_WebCams,
-    UIActionIndexRuntime_Menu_SharedClipboard,
-    UIActionIndexRuntime_Menu_DragAndDrop,
-    UIActionIndexRuntime_Menu_Network,
-    UIActionIndexRuntime_Simple_NetworkSettings,
-    UIActionIndexRuntime_Menu_SharedFolders,
-    UIActionIndexRuntime_Simple_SharedFoldersSettings,
-    UIActionIndexRuntime_Toggle_VRDEServer,
-    UIActionIndexRuntime_Menu_VideoCapture,
-    UIActionIndexRuntime_Toggle_VideoCapture,
-    UIActionIndexRuntime_Simple_VideoCaptureSettings,
-    UIActionIndexRuntime_Simple_InstallGuestTools,
+    UIActionIndexRT_M_Devices,
+    UIActionIndexRT_M_Devices_M_HardDrives,
+    UIActionIndexRT_M_Devices_M_HardDrives_S_Settings,
+    UIActionIndexRT_M_Devices_M_OpticalDevices,
+    UIActionIndexRT_M_Devices_M_FloppyDevices,
+    UIActionIndexRT_M_Devices_M_Network,
+    UIActionIndexRT_M_Devices_M_Network_S_Settings,
+    UIActionIndexRT_M_Devices_M_USBDevices,
+    UIActionIndexRT_M_Devices_M_USBDevices_S_Settings,
+    UIActionIndexRT_M_Devices_M_WebCams,
+    UIActionIndexRT_M_Devices_M_SharedClipboard,
+    UIActionIndexRT_M_Devices_M_DragAndDrop,
+    UIActionIndexRT_M_Devices_M_SharedFolders,
+    UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings,
+    UIActionIndexRT_M_Devices_S_InstallGuestTools,
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /* 'Debugger' menu actions: */
-    UIActionIndexRuntime_Menu_Debug,
-    UIActionIndexRuntime_Simple_Statistics,
-    UIActionIndexRuntime_Simple_CommandLine,
-    UIActionIndexRuntime_Toggle_Logging,
+    UIActionIndexRT_M_Debug,
+    UIActionIndexRT_M_Debug_S_ShowStatistics,
+    UIActionIndexRT_M_Debug_S_ShowCommandLine,
+    UIActionIndexRT_M_Debug_T_Logging,
+    UIActionIndexRT_M_Debug_S_ShowLogDialog,
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
 #ifdef Q_WS_MAC
     /* 'Dock' menu actions: */
-    UIActionIndexRuntime_Menu_Dock,
-    UIActionIndexRuntime_Menu_DockSettings,
-    UIActionIndexRuntime_Toggle_DockPreviewMonitor,
-    UIActionIndexRuntime_Toggle_DockDisableMonitor,
+    UIActionIndexRT_M_Dock,
+    UIActionIndexRT_M_Dock_M_DockSettings,
+    UIActionIndexRT_M_Dock_M_DockSettings_T_PreviewMonitor,
+    UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor,
 #endif /* Q_WS_MAC */
 
     /* Maximum index: */
-    UIActionIndexRuntime_Max
+    UIActionIndexRT_Max
 };
 
-/* Singleton runtime action pool: */
+/** UIActionPool extension
+  * representing action-pool singleton for Runtime UI. */
 class UIActionPoolRuntime : public UIActionPool
 {
     Q_OBJECT;
 
-private:
+signals:
+
+    /** Notifies about 'View' : 'Virtual Screen #' menu : 'Toggle' action trigger. */
+    void sigNotifyAboutTriggeringViewScreenToggle(int iGuestScreenIndex, bool fEnabled);
+    /** Notifies about 'View' : 'Virtual Screen #' menu : 'Resize' action trigger. */
+    void sigNotifyAboutTriggeringViewScreenResize(int iGuestScreenIndex, const QSize &size);
+    /** Notifies about 'View' : 'Virtual Screen #' menu : 'Remap' action trigger. */
+    void sigNotifyAboutTriggeringViewScreenRemap(int iGuestScreenIndex, int iHostScreenIndex);
+
+public:
+
+    /** Defines UI session object reference.
+      * @note For menus which uses it to build contents. */
+    void setSession(UISession *pSession);
+    /** Returns UI session object reference. */
+    UISession* uisession() const { return m_pSession; }
+
+    /** Defines UI multi-screen layout object reference.
+      * @note For menus which uses it to build contents. */
+    void setMultiScreenLayout(UIMultiScreenLayout *pMultiScreenLayout);
+    /** Returns UI multi-screen layout object reference. */
+    UIMultiScreenLayout* multiScreenLayout() const { return m_pMultiScreenLayout; }
+
+    /** Returns whether the action with passed @a type is allowed in the 'Machine' menu. */
+    bool isAllowedInMenuMachine(UIExtraDataMetaDefs::RuntimeMenuMachineActionType type) const;
+    /** Defines 'Machine' menu @a restriction for passed @a level. */
+    void setRestrictionForMenuMachine(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuMachineActionType restriction);
+
+    /** Returns whether the action with passed @a type is allowed in the 'View' menu. */
+    bool isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType type) const;
+    /** Defines 'View' menu @a restriction for passed @a level. */
+    void setRestrictionForMenuView(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuViewActionType restriction);
+
+    /** Returns whether the action with passed @a type is allowed in the 'Input' menu. */
+    bool isAllowedInMenuInput(UIExtraDataMetaDefs::RuntimeMenuInputActionType type) const;
+    /** Defines 'Input' menu @a restriction for passed @a level. */
+    void setRestrictionForMenuInput(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuInputActionType restriction);
+
+    /** Returns whether the action with passed @a type is allowed in the 'Devices' menu. */
+    bool isAllowedInMenuDevices(UIExtraDataMetaDefs::RuntimeMenuDevicesActionType type) const;
+    /** Defines 'Devices' menu @a restriction for passed @a level. */
+    void setRestrictionForMenuDevices(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restriction);
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** Returns whether the action with passed @a type is allowed in the 'Debug' menu. */
+    bool isAllowedInMenuDebug(UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType type) const;
+    /** Defines 'Debug' menu @a restriction for passed @a level. */
+    void setRestrictionForMenuDebugger(UIActionRestrictionLevel level, UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restriction);
+#endif /* VBOX_WITH_DEBUGGER_GUI */
 
-    /* Constructor: */
-    UIActionPoolRuntime();
+protected slots:
+
+    /** Handles configuration-change. */
+    void sltHandleConfigurationChange(const QString &strMachineID);
+
+    /** Handles 'View' : 'Scale Factor' menu : @a pAction trigger. */
+    void sltHandleActionTriggerViewScaleFactor(QAction *pAction);
+
+    /** Prepare 'View' : 'Virtual Screen #' menu routine (Normal, Scale). */
+    void sltPrepareMenuViewScreen();
+    /** Prepare 'View' : 'Virtual Screen #' menu routine (Fullscreen, Seamless). */
+    void sltPrepareMenuViewMultiscreen();
+
+    /** Handles 'View' : 'Virtual Screen #' menu : 'Toggle' action trigger. */
+    void sltHandleActionTriggerViewScreenToggle();
+    /** Handles 'View' : 'Virtual Screen #' menu : 'Resize' @a pAction trigger. */
+    void sltHandleActionTriggerViewScreenResize(QAction *pAction);
+    /** Handles 'View' : 'Virtual Screen #' menu : 'Remap' @a pAction trigger. */
+    void sltHandleActionTriggerViewScreenRemap(QAction *pAction);
+
+    /** Handles screen-layout update. */
+    void sltHandleScreenLayoutUpdate();
+
+protected:
+
+    /** Constructor,
+      * @param fTemporary is used to determine whether this action-pool is temporary,
+      *                   which can be created to re-initialize shortcuts-pool. */
+    UIActionPoolRuntime(bool fTemporary = false);
+
+    /** Prepare pool routine. */
+    virtual void preparePool();
+    /** Prepare connections routine. */
+    virtual void prepareConnections();
+
+    /** Update configuration routine. */
+    virtual void updateConfiguration();
+
+    /** Update menu routine. */
+    void updateMenu(int iIndex);
+    /** Update menus routine. */
+    void updateMenus();
+    /** Update 'Machine' menu routine. */
+    void updateMenuMachine();
+    /** Update 'View' menu routine. */
+    void updateMenuView();
+    /** Update 'View' : 'Popup' menu routine. */
+    void updateMenuViewPopup();
+    /** Update 'View' : 'Video Capture' menu routine. */
+    void updateMenuViewVideoCapture();
+    /** Update 'View' : 'Menu Bar' menu routine. */
+    void updateMenuViewMenuBar();
+    /** Update 'View' : 'Status Bar' menu routine. */
+    void updateMenuViewStatusBar();
+    /** Update 'View' : 'Scale Factor' menu routine. */
+    void updateMenuViewScaleFactor();
+    /** Update 'View' : 'Virtual Screen #' @a pMenu routine (Normal, Scale). */
+    void updateMenuViewScreen(QMenu *pMenu);
+    /** Update 'View' : 'Virtual Screen #' @a pMenu routine (Fullscreen, Seamless). */
+    void updateMenuViewMultiscreen(QMenu *pMenu);
+    /** Update 'Input' menu routine. */
+    void updateMenuInput();
+    /** Update 'Input' : 'Keyboard' menu routine. */
+    void updateMenuInputKeyboard();
+    /** Update 'Input' : 'Mouse' menu routine. */
+    void updateMenuInputMouse();
+    /** Update 'Devices' menu routine. */
+    void updateMenuDevices();
+    /** Update 'Devices' : 'Hard Drives' menu routine. */
+    void updateMenuDevicesHardDrives();
+    /** Update 'Devices' : 'Network' menu routine. */
+    void updateMenuDevicesNetwork();
+    /** Update 'Devices' : 'USB' menu routine. */
+    void updateMenuDevicesUSBDevices();
+    /** Update 'Devices' : 'Shared Folders' menu routine. */
+    void updateMenuDevicesSharedFolders();
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** Update 'Debug' menu routine. */
+    void updateMenuDebug();
+#endif /* VBOX_WITH_DEBUGGER_GUI */
 
     /** Translation handler. */
-    void retranslateUi();
+    virtual void retranslateUi();
+
+    /** Returns extra-data ID to save keyboard shortcuts under. */
+    virtual QString shortcutsExtraDataID() const;
+
+    /** Returns the list of Runtime UI main menus. */
+    virtual QList<QMenu*> menus() const { return m_mainMenus; }
+
+private:
 
-    /* Helper: Shortcuts stuff: */
-    QString shortcutsExtraDataID() const;
+    /** Holds the UI session object reference. */
+    UISession *m_pSession;
+    /** Holds the UI multi-screen layout object reference. */
+    UIMultiScreenLayout *m_pMultiScreenLayout;
 
-    /* Helpers: Prepare stuff: */
-    void createActions();
-    void createMenus();
+    /** Holds the list of Runtime UI main menus. */
+    QList<QMenu*> m_mainMenus;
 
-    /* Friend zone: */
+    /** Holds restricted action types of the Machine menu. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::RuntimeMenuMachineActionType> m_restrictedActionsMenuMachine;
+    /** Holds restricted action types of the View menu. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::RuntimeMenuViewActionType> m_restrictedActionsMenuView;
+    /** Holds restricted action types of the Input menu. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::RuntimeMenuInputActionType> m_restrictedActionsMenuInput;
+    /** Holds restricted action types of the Devices menu. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::RuntimeMenuDevicesActionType> m_restrictedActionsMenuDevices;
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** Holds restricted action types of the Debugger menu. */
+    QMap<UIActionRestrictionLevel, UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType> m_restrictedActionsMenuDebug;
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+    /* Enable factory in base-class: */
     friend class UIActionPool;
 };
 
-#endif // __UIActionPoolRuntime_h__
-
+#endif /* !___UIActionPoolRuntime_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp
new file mode 100644
index 0000000..b4b6736
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.cpp
@@ -0,0 +1,623 @@
+/* $Id: UIAddDiskEncryptionPasswordDialog.cpp $ */
+/** @file
+ * VBox Qt GUI - UIAddDiskEncryptionPasswordDialog class implementation.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QVBoxLayout>
+# include <QLabel>
+# include <QLineEdit>
+# include <QTableView>
+# include <QHeaderView>
+# include <QPushButton>
+# include <QItemEditorFactory>
+# include <QAbstractTableModel>
+# include <QStandardItemEditorCreator>
+
+/* GUI includes: */
+# include "UIMedium.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
+# include "QIDialogButtonBox.h"
+# include "QIWithRetranslateUI.h"
+# include "QIStyledItemDelegate.h"
+# include "UIAddDiskEncryptionPasswordDialog.h"
+
+/* Other VBox includes: */
+# include <iprt/assert.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/** UIEncryptionDataTable field indexes. */
+enum UIEncryptionDataTableSection
+{
+    UIEncryptionDataTableSection_Status,
+    UIEncryptionDataTableSection_Id,
+    UIEncryptionDataTableSection_Password,
+    UIEncryptionDataTableSection_Max
+};
+
+/** QLineEdit reimplementation used as
+  * the embedded password editor for the UIEncryptionDataTable. */
+class UIPasswordEditor : public QLineEdit
+{
+    Q_OBJECT;
+
+    /** Holds the current password of the editor. */
+    Q_PROPERTY(QString password READ password WRITE setPassword USER true);
+
+signals:
+
+    /** Notifies listeners about data should be committed. */
+    void sigCommitData(QWidget *pThis);
+
+    /** Notifies listeners about Enter/Return key triggering. */
+    void sigEnterKeyTriggered();
+
+public:
+
+    /** Constructor.
+      * @param pParent being passed to the base-class. */
+    UIPasswordEditor(QWidget *pParent);
+
+private slots:
+
+    /** Handles @s strPassword changes. */
+    void sltPasswordChanged(const QString &strPassword);
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Key press @a pEvent handler. */
+    void keyPressEvent(QKeyEvent *pEvent);
+
+    /** Property: Returns the current password of the editor. */
+    QString password() const { return QLineEdit::text(); }
+    /** Property: Defines the current @a strPassword of the editor. */
+    void setPassword(const QString &strPassword) { QLineEdit::setText(strPassword); }
+};
+
+/** QAbstractTableModel reimplementation used as
+  * the data representation model for the UIEncryptionDataTable. */
+class UIEncryptionDataModel : public QAbstractTableModel
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor.
+      * @param pParent          being passed to the base-class,
+      * @param encryptedMediums contains the lists of medium ids (values) encrypted with passwords with ids (keys). */
+    UIEncryptionDataModel(QObject *pParent, const EncryptedMediumMap &encryptedMediums);
+
+    /** Returns the shallow copy of the encryption password map instance. */
+    EncryptionPasswordMap encryptionPasswords() const { return m_encryptionPasswords; }
+
+    /** Returns whether the model is valid. */
+    bool isValid() const;
+
+    /** Returns the row count, taking optional @a parent instead of root if necessary. */
+    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+    /** Returns the column count, taking optional @a parent instead of root if necessary. */
+    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+    /** Returns the @a index flags. */
+    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+
+    /** Returns the header data for the @a iSection, @a orientation and @a iRole. */
+    virtual QVariant headerData(int iSection, Qt::Orientation orientation, int iRole) const;
+
+    /** Returns the @a index data for the @a iRole. */
+    virtual QVariant data(const QModelIndex &index, int iRole = Qt::DisplayRole) const;
+    /** Defines the @a index data for the @a iRole as @a value. */
+    virtual bool setData(const QModelIndex &index, const QVariant &value, int iRole = Qt::EditRole);
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Returns whether passed @a strPassword is valid for medium with passed @a strMediumId. */
+    bool isPasswordValid(const QString strMediumId, const QString strPassword);
+
+    /** Holds the encrypted medium map reference. */
+    const EncryptedMediumMap &m_encryptedMediums;
+
+    /** Holds the encryption password map instance. */
+    EncryptionPasswordMap m_encryptionPasswords;
+    /** Holds the encryption password status map instance. */
+    EncryptionPasswordStatusMap m_encryptionPasswordStatus;
+};
+
+/** QTableView reimplementation used to
+  * allow the UIAddDiskEncryptionPasswordDialog to enter
+  * disk encryption passwords for particular password ids. */
+class UIEncryptionDataTable : public QTableView
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listeners about data change. */
+    void sigDataChanged();
+
+    /** Notifies listeners about editor's Enter/Return key triggering. */
+    void sigEditorEnterKeyTriggered();
+
+public:
+
+    /** Constructor.
+      * @param pParent being passed to the base-class. */
+    UIEncryptionDataTable(const EncryptedMediumMap &encryptedMediums);
+
+    /** Returns the shallow copy of the encryption password map
+      * acquired from the UIEncryptionDataModel instance. */
+    EncryptionPasswordMap encryptionPasswords() const;
+
+    /** Returns whether the table is valid. */
+    bool isValid() const;
+
+    /** Initiates the editor for the first index available. */
+    void editFirstIndex();
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Holds the encrypted medium map reference. */
+    const EncryptedMediumMap &m_encryptedMediums;
+
+    /** Holds the encryption-data model instance. */
+    UIEncryptionDataModel *m_pModelEncryptionData;
+};
+
+UIPasswordEditor::UIPasswordEditor(QWidget *pParent)
+    : QLineEdit(pParent)
+{
+    /* Prepare: */
+    prepare();
+}
+
+void UIPasswordEditor::sltPasswordChanged(const QString &strPassword)
+{
+    Q_UNUSED(strPassword);
+    /* Commit data to the listener: */
+    emit sigCommitData(this);
+}
+
+void UIPasswordEditor::prepare()
+{
+    /* Set echo mode: */
+    setEchoMode(QLineEdit::Password);
+    /* Listen for the text changes: */
+    connect(this, SIGNAL(textChanged(const QString&)),
+            this, SLOT(sltPasswordChanged(const QString&)));
+}
+
+void UIPasswordEditor::keyPressEvent(QKeyEvent *pEvent)
+{
+    /* Call to base-class: */
+    QLineEdit::keyPressEvent(pEvent);
+
+    /* Broadcast Enter/Return key press: */
+    switch (pEvent->key())
+    {
+        case Qt::Key_Enter:
+        case Qt::Key_Return:
+            emit sigEnterKeyTriggered();
+            break;
+        default:
+            break;
+    }
+}
+
+UIEncryptionDataModel::UIEncryptionDataModel(QObject *pParent, const EncryptedMediumMap &encryptedMediums)
+    : QAbstractTableModel(pParent)
+    , m_encryptedMediums(encryptedMediums)
+{
+    /* Prepare: */
+    prepare();
+}
+
+bool UIEncryptionDataModel::isValid() const
+{
+    /* Check whether the model contains invalid passwords: */
+    foreach (const bool &fValue, m_encryptionPasswordStatus.values())
+        if (!fValue)
+            return false;
+    /* Valid by default: */
+    return true;
+}
+
+int UIEncryptionDataModel::rowCount(const QModelIndex &parent /* = QModelIndex() */) const
+{
+    Q_UNUSED(parent);
+    return m_encryptionPasswords.size();
+}
+
+int UIEncryptionDataModel::columnCount(const QModelIndex &parent /* = QModelIndex() */) const
+{
+    Q_UNUSED(parent);
+    return UIEncryptionDataTableSection_Max;
+}
+
+Qt::ItemFlags UIEncryptionDataModel::flags(const QModelIndex &index) const
+{
+    /* Check index validness: */
+    if (!index.isValid())
+        return Qt::NoItemFlags;
+    /* Depending on column index: */
+    switch (index.column())
+    {
+        case UIEncryptionDataTableSection_Status:   return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+        case UIEncryptionDataTableSection_Id:       return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+        case UIEncryptionDataTableSection_Password: return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
+        default: break;
+    }
+    /* No flags by default: */
+    return Qt::NoItemFlags;
+}
+
+QVariant UIEncryptionDataModel::headerData(int iSection, Qt::Orientation orientation, int iRole) const
+{
+    /* Check argument validness: */
+    if (iRole != Qt::DisplayRole || orientation != Qt::Horizontal)
+        return QVariant();
+    /* Depending on column index: */
+    switch (iSection)
+    {
+        case UIEncryptionDataTableSection_Status:   return tr("Status", "password table field");
+        case UIEncryptionDataTableSection_Id:       return tr("ID", "password table field");
+        case UIEncryptionDataTableSection_Password: return tr("Password", "password table field");
+        default: break;
+    }
+    /* Null value by default: */
+    return QVariant();
+}
+
+QVariant UIEncryptionDataModel::data(const QModelIndex &index, int iRole /* = Qt::DisplayRole */) const
+{
+    /* Check index validness: */
+    if (!index.isValid())
+        return QVariant();
+    /* Depending on role: */
+    switch (iRole)
+    {
+        case Qt::DecorationRole:
+        {
+            /* Depending on column index: */
+            switch (index.column())
+            {
+                case UIEncryptionDataTableSection_Status:
+                    return m_encryptionPasswordStatus.value(m_encryptionPasswordStatus.keys().at(index.row())) ?
+                           UIIconPool::iconSet(":/status_check_16px.png") : UIIconPool::iconSet(":/status_error_16px.png");
+                default:
+                    return QVariant();
+            }
+            break;
+        }
+        case Qt::DisplayRole:
+        {
+            /* Depending on column index: */
+            switch (index.column())
+            {
+                case UIEncryptionDataTableSection_Id:
+                    return m_encryptionPasswords.keys().at(index.row());
+                case UIEncryptionDataTableSection_Password:
+                    return QString().fill('*', m_encryptionPasswords.value(m_encryptionPasswords.keys().at(index.row())).size());
+                default:
+                    return QVariant();
+            }
+            break;
+        }
+        case Qt::EditRole:
+        {
+            /* Depending on column index: */
+            switch (index.column())
+            {
+                case UIEncryptionDataTableSection_Password:
+                    return m_encryptionPasswords.value(m_encryptionPasswords.keys().at(index.row()));
+                default:
+                    return QVariant();
+            }
+            break;
+        }
+        case Qt::ToolTipRole:
+        {
+            /* We are generating tool-tip here and not in retranslateUi() because of the tricky plural form handling,
+             * but be quiet, it's safe enough because the tool-tip being re-acquired every time on mouse-hovering. */
+            const QStringList encryptedMediums = m_encryptedMediums.values(m_encryptionPasswords.keys().at(index.row()));
+            return tr("<nobr>Used by the following %n hard drive(s):</nobr><br>%1",
+                      "This text is never used with n == 0. "
+                      "Feel free to drop the %n where possible, "
+                      "we only included it because of problems with Qt Linguist "
+                      "(but the user can see how many hard drives are in the tool-tip "
+                      "and doesn't need to be told).",
+                      encryptedMediums.size())
+                      .arg(encryptedMediums.join("<br>"));
+        }
+        default:
+            break;
+    }
+    /* Null value by default: */
+    return QVariant();
+}
+
+bool UIEncryptionDataModel::setData(const QModelIndex &index, const QVariant &value, int iRole /* = Qt::EditRole */)
+{
+    /* Check index validness: */
+    if (!index.isValid())
+        return false;
+    /* Check argument validness: */
+    if (iRole != Qt::EditRole)
+        return false;
+    /* Depending on column index: */
+    switch (index.column())
+    {
+        case UIEncryptionDataTableSection_Password:
+        {
+            /* Update password: */
+            const int iRow = index.row();
+            const QString strPassword = value.toString();
+            const QString strKey = m_encryptionPasswords.keys().at(iRow);
+            m_encryptionPasswords[strKey] = strPassword;
+            /* Update password status: */
+            const QString strMediumId = m_encryptedMediums.values(strKey).first();
+            const bool fPasswordStatus = isPasswordValid(strMediumId, strPassword);
+            m_encryptionPasswordStatus[strKey] = fPasswordStatus;
+            /* Initiate explicit password status update: */
+            const QModelIndex statusIndex = createIndex(iRow, UIEncryptionDataTableSection_Status);
+            emit dataChanged(statusIndex, statusIndex);
+            break;
+        }
+        default:
+            break;
+    }
+    /* Nothing to set by default: */
+    return false;
+}
+
+void UIEncryptionDataModel::prepare()
+{
+    /* Populate the map of passwords and statuses. */
+    foreach (const QString &strPasswordId, m_encryptedMediums.keys())
+    {
+        m_encryptionPasswords.insert(strPasswordId, QString());
+        m_encryptionPasswordStatus.insert(strPasswordId, false);
+    }
+}
+
+bool UIEncryptionDataModel::isPasswordValid(const QString strMediumId, const QString strPassword)
+{
+    /* Look for the medium with passed ID: */
+    const UIMedium uimedium = vboxGlobal().medium(strMediumId);
+    if (!uimedium.isNull())
+    {
+        /* Check wrapped medium for validity: */
+        const CMedium medium = uimedium.medium();
+        if (!medium.isNull())
+        {
+            /* Check whether the password is suitable for that medium. */
+            medium.CheckEncryptionPassword(strPassword);
+            return medium.isOk();
+        }
+    }
+    /* False by default: */
+    return false;
+}
+
+UIEncryptionDataTable::UIEncryptionDataTable(const EncryptedMediumMap &encryptedMediums)
+    : m_encryptedMediums(encryptedMediums)
+    , m_pModelEncryptionData(0)
+{
+    /* Prepare: */
+    prepare();
+}
+
+EncryptionPasswordMap UIEncryptionDataTable::encryptionPasswords() const
+{
+    AssertPtrReturn(m_pModelEncryptionData, EncryptionPasswordMap());
+    return m_pModelEncryptionData->encryptionPasswords();
+}
+
+bool UIEncryptionDataTable::isValid() const
+{
+    AssertPtrReturn(m_pModelEncryptionData, false);
+    return m_pModelEncryptionData->isValid();
+}
+
+void UIEncryptionDataTable::editFirstIndex()
+{
+    AssertPtrReturnVoid(m_pModelEncryptionData);
+    /* Compose the password field index of the first available table record: */
+    const QModelIndex index = m_pModelEncryptionData->index(0, UIEncryptionDataTableSection_Password);
+    /* Navigate table to the corresponding index: */
+    setCurrentIndex(index);
+    /* Compose the fake mouse-event which will trigger the embedded editor: */
+    QMouseEvent event(QEvent::MouseButtonPress, QPoint(), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
+    /* Initiate the embedded editor for the corresponding index: */
+    edit(index, QAbstractItemView::SelectedClicked, &event);
+}
+
+void UIEncryptionDataTable::prepare()
+{
+    /* Create encryption-data model: */
+    m_pModelEncryptionData = new UIEncryptionDataModel(this, m_encryptedMediums);
+    AssertPtrReturnVoid(m_pModelEncryptionData);
+    {
+        /* Assign configured model to table: */
+        setModel(m_pModelEncryptionData);
+        /* Configure encryption-data model: */
+        connect(m_pModelEncryptionData, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
+                this, SIGNAL(sigDataChanged()));
+    }
+
+    /* Create item delegate: */
+    QIStyledItemDelegate *pStyledItemDelegate = new QIStyledItemDelegate(this);
+    AssertPtrReturnVoid(pStyledItemDelegate);
+    {
+        /* Create item editor factory: */
+        QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
+        AssertPtrReturnVoid(pNewItemEditorFactory);
+        {
+            /* Create item editor creator: */
+            QStandardItemEditorCreator<UIPasswordEditor> *pQStringItemEditorCreator = new QStandardItemEditorCreator<UIPasswordEditor>();
+            AssertPtrReturnVoid(pQStringItemEditorCreator);
+            {
+                /* Register UIPasswordEditor as the QString editor: */
+                pNewItemEditorFactory->registerEditor(QVariant::String, pQStringItemEditorCreator);
+            }
+            /* Assign configured item editor factory to table delegate: */
+            pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
+        }
+        /* Assign configured item delegate to table: */
+        delete itemDelegate();
+        setItemDelegate(pStyledItemDelegate);
+        /* Configure item delegate: */
+        pStyledItemDelegate->setWatchForEditorEnterKeyTriggering(true);
+        connect(pStyledItemDelegate, SIGNAL(sigEditorEnterKeyTriggered()),
+                this, SIGNAL(sigEditorEnterKeyTriggered()));
+    }
+
+    /* Configure table: */
+    setTabKeyNavigation(false);
+    setContextMenuPolicy(Qt::CustomContextMenu);
+    setSelectionBehavior(QAbstractItemView::SelectRows);
+    setSelectionMode(QAbstractItemView::SingleSelection);
+    setEditTriggers(QAbstractItemView::CurrentChanged | QAbstractItemView::SelectedClicked);
+
+    /* Configure headers: */
+    verticalHeader()->hide();
+    verticalHeader()->setDefaultSectionSize((int)(verticalHeader()->minimumSectionSize() * 1.33));
+    horizontalHeader()->setStretchLastSection(false);
+    horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Status, QHeaderView::ResizeToContents);
+    horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Id, QHeaderView::Interactive);
+    horizontalHeader()->setResizeMode(UIEncryptionDataTableSection_Password, QHeaderView::Stretch);
+}
+
+UIAddDiskEncryptionPasswordDialog::UIAddDiskEncryptionPasswordDialog(QWidget *pParent,
+                                                                     const QString &strMachineName,
+                                                                     const EncryptedMediumMap &encryptedMediums)
+    : QIWithRetranslateUI<QDialog>(pParent)
+    , m_strMachineName(strMachineName)
+    , m_encryptedMediums(encryptedMediums)
+    , m_pLabelDescription(0)
+    , m_pTableEncryptionData(0)
+    , m_pButtonBox(0)
+{
+    /* Prepare: */
+    prepare();
+    /* Translate: */
+    retranslateUi();
+    /* Validate: */
+    revalidate();
+}
+
+EncryptionPasswordMap UIAddDiskEncryptionPasswordDialog::encryptionPasswords() const
+{
+    AssertPtrReturn(m_pTableEncryptionData, EncryptionPasswordMap());
+    return m_pTableEncryptionData->encryptionPasswords();
+}
+
+void UIAddDiskEncryptionPasswordDialog::sltEditorEnterKeyTriggered()
+{
+    if (m_pButtonBox->button(QDialogButtonBox::Ok)->isEnabled())
+        accept();
+}
+
+void UIAddDiskEncryptionPasswordDialog::prepare()
+{
+    /* Configure self: */
+    setWindowModality(Qt::WindowModal);
+
+    /* Create main-layout: */
+    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
+    AssertPtrReturnVoid(pMainLayout);
+    {
+        /* Create input-layout: */
+        QVBoxLayout *pInputLayout = new QVBoxLayout;
+        AssertPtrReturnVoid(pInputLayout);
+        {
+            /* Create description label: */
+            m_pLabelDescription = new QLabel;
+            AssertPtrReturnVoid(m_pLabelDescription);
+            {
+                /* Add label into layout: */
+                pInputLayout->addWidget(m_pLabelDescription);
+            }
+            /* Create encryption-data table: */
+            m_pTableEncryptionData = new UIEncryptionDataTable(m_encryptedMediums);
+            AssertPtrReturnVoid(m_pTableEncryptionData);
+            {
+                /* Configure encryption-data table: */
+                connect(m_pTableEncryptionData, SIGNAL(sigDataChanged()),
+                        this, SLOT(sltDataChanged()));
+                connect(m_pTableEncryptionData, SIGNAL(sigEditorEnterKeyTriggered()),
+                        this, SLOT(sltEditorEnterKeyTriggered()));
+                m_pTableEncryptionData->setFocus();
+                m_pTableEncryptionData->editFirstIndex();
+                /* Add label into layout: */
+                pInputLayout->addWidget(m_pTableEncryptionData);
+            }
+            /* Add layout into parent: */
+            pMainLayout->addLayout(pInputLayout);
+        }
+        /* Create button-box: */
+        m_pButtonBox = new QIDialogButtonBox;
+        AssertPtrReturnVoid(m_pButtonBox);
+        {
+            /* Configure button-box: */
+            m_pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+            connect(m_pButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
+            connect(m_pButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
+            /* Add button-box into layout: */
+            pMainLayout->addWidget(m_pButtonBox);
+        }
+    }
+}
+
+void UIAddDiskEncryptionPasswordDialog::retranslateUi()
+{
+    /* Translate the dialog title: */
+    setWindowTitle(tr("%1 - Disk Encryption").arg(m_strMachineName));
+
+    /* Translate the description label: */
+    AssertPtrReturnVoid(m_pLabelDescription);
+    m_pLabelDescription->setText(tr("This virtual machine is password protected. "
+                                    "Please enter the %n encryption password(s) below.",
+                                    "This text is never used with n == 0. "
+                                    "Feel free to drop the %n where possible, "
+                                    "we only included it because of problems with Qt Linguist "
+                                    "(but the user can see how many passwords are in the list "
+                                    "and doesn't need to be told).",
+                                    m_encryptedMediums.size()));
+}
+
+void UIAddDiskEncryptionPasswordDialog::revalidate()
+{
+    /* Validate: */
+    AssertPtrReturnVoid(m_pButtonBox);
+    m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_pTableEncryptionData->isValid());
+}
+
+#include "UIAddDiskEncryptionPasswordDialog.moc"
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h
new file mode 100644
index 0000000..3ffccb4
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIAddDiskEncryptionPasswordDialog.h
@@ -0,0 +1,90 @@
+/* $Id: UIAddDiskEncryptionPasswordDialog.h $ */
+/** @file
+ * VBox Qt GUI - UIAddDiskEncryptionPasswordDialog class declaration.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIAddDiskEncryptionPasswordDialog_h___
+#define ___UIAddDiskEncryptionPasswordDialog_h___
+
+/* Qt includes: */
+#include <QDialog>
+#include <QMultiMap>
+#include <QMap>
+
+/* GUI includes: */
+#include "QIWithRetranslateUI.h"
+
+/* Forward declarations: */
+class UIEncryptionDataTable;
+class QIDialogButtonBox;
+class QLabel;
+
+/* Type definitions: */
+typedef QMultiMap<QString, QString> EncryptedMediumMap;
+typedef QMap<QString, QString> EncryptionPasswordMap;
+typedef QMap<QString, bool> EncryptionPasswordStatusMap;
+
+/** QDialog reimplementation used to
+  * allow the user to enter disk encryption passwords for particular password ids. */
+class UIAddDiskEncryptionPasswordDialog : public QIWithRetranslateUI<QDialog>
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor.
+      * @param pParent          being passed to the base-class,
+      * @param strMachineName   holds the name of the machine we show this dialog for,
+      * @param encryptedMediums contains the lists of medium ids (values) encrypted with passwords with ids (keys). */
+    UIAddDiskEncryptionPasswordDialog(QWidget *pParent, const QString &strMachineName, const EncryptedMediumMap &encryptedMediums);
+
+    /** Returns the shallow copy of the encryption password map
+      * acquired from the UIEncryptionDataTable instance. */
+    EncryptionPasswordMap encryptionPasswords() const;
+
+private slots:
+
+    /** Handles the data change. */
+    void sltDataChanged() { revalidate(); }
+
+    /** Handles editor's Enter/Return key triggering. */
+    void sltEditorEnterKeyTriggered();
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Translation routine. */
+    void retranslateUi();
+
+    /** Validation routine. */
+    void revalidate();
+
+    /** Holds the name of the machine we show this dialog for. */
+    const QString m_strMachineName;
+
+    /** Holds the encrypted medium map reference. */
+    const EncryptedMediumMap &m_encryptedMediums;
+
+    /** Holds the description label instance. */
+    QLabel *m_pLabelDescription;
+    /** Holds the encryption-data table instance. */
+    UIEncryptionDataTable *m_pTableEncryptionData;
+    /** Holds the button-box instance. */
+    QIDialogButtonBox *m_pButtonBox;
+};
+
+#endif /* !___UIAddDiskEncryptionPasswordDialog_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
index a0c3b84..7cb4f83 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIConsoleEventHandler.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIConsoleEventHandler class implementation
+ * VBox Qt GUI - UIConsoleEventHandler class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,50 +15,100 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIConsoleEventHandler.h"
-#include "UIMainEventListener.h"
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-#endif /* Q_WS_MAC */
+# include "UIConsoleEventHandler.h"
+# include "UIMainEventListener.h"
+# include "VBoxGlobal.h"
+# include "UISession.h"
+# ifdef Q_WS_MAC
+#  include "VBoxUtils.h"
+# endif /* Q_WS_MAC */
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CEventSource.h"
+# include "CConsole.h"
+# include "CEventSource.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static */
-UIConsoleEventHandler *UIConsoleEventHandler::m_pInstance = 0;
+UIConsoleEventHandler *UIConsoleEventHandler::m_spInstance = 0;
 
 /* static */
-UIConsoleEventHandler* UIConsoleEventHandler::instance(UISession *pSession /* = 0 */)
+void UIConsoleEventHandler::create(UISession *pSession)
 {
-    if (!m_pInstance)
-        m_pInstance = new UIConsoleEventHandler(pSession);
-    return m_pInstance;
+    if (!m_spInstance)
+    {
+        m_spInstance = new UIConsoleEventHandler(pSession);
+        m_spInstance->prepare();
+    }
 }
 
 /* static */
 void UIConsoleEventHandler::destroy()
 {
-    if (m_pInstance)
+    if (m_spInstance)
     {
-        delete m_pInstance;
-        m_pInstance = 0;
+        m_spInstance->cleanup();
+        delete m_spInstance;
+        m_spInstance = 0;
     }
 }
 
+void UIConsoleEventHandler::sltCanShowWindow(bool & /* fVeto */, QString & /* strReason */)
+{
+    /* No veto, so nothing for us to do. */
+}
+
+void UIConsoleEventHandler::sltShowWindow(LONG64 &winId)
+{
+#ifdef Q_WS_MAC
+        /* Let's try the simple approach first - grab the focus.
+         * Getting a window out of the dock (minimized or whatever it's called)
+         * needs to be done on the GUI thread, so post it a note: */
+        winId = 0;
+        if (::darwinSetFrontMostProcess())
+            emit sigShowWindow();
+        else
+        {
+            /* It failed for some reason, send the other process our PSN so it can try.
+             * (This is just a precaution should Mac OS X start imposing the same sensible
+             * focus stealing restrictions that other window managers implement). */
+            winId = ::darwinGetCurrentProcessId();
+        }
+#else /* Q_WS_MAC */
+        /* Return the ID of the top-level console window. */
+        winId = (ULONG64)m_pSession->winId();
+#endif /* !Q_WS_MAC */
+}
+
 UIConsoleEventHandler::UIConsoleEventHandler(UISession *pSession)
-  : m_pSession(pSession)
+    : m_pSession(pSession)
 {
-    Assert(pSession);
+}
 
-//    RTPrintf("Self add: %RTthrd\n", RTThreadSelf());
+void UIConsoleEventHandler::prepare()
+{
+    /* Make sure session is passed: */
+    AssertPtrReturnVoid(m_pSession);
+
+    /* Create Main-event listener instance: */
     ComObjPtr<UIMainEventListenerImpl> pListener;
     pListener.createObject();
-    pListener->init(new UIMainEventListener(), this);
+    pListener->init(new UIMainEventListener, this);
     m_mainEventListener = CEventListener(pListener);
+
+    /* Get console: */
+    const CConsole console = m_pSession->session().GetConsole();
+    AssertReturnVoid(!console.isNull() && console.isOk());
+    /* Get event-source: */
+    CEventSource eventSource = console.GetEventSource();
+    AssertReturnVoid(!eventSource.isNull() && eventSource.isOk());
+    /* Register listener for expected event-types: */
     QVector<KVBoxEventType> events;
     events
         << KVBoxEventType_OnMousePointerShapeChanged
@@ -76,63 +124,57 @@ UIConsoleEventHandler::UIConsoleEventHandler(UISession *pSession)
         << KVBoxEventType_OnUSBControllerChanged
         << KVBoxEventType_OnUSBDeviceStateChanged
         << KVBoxEventType_OnSharedFolderChanged
+        << KVBoxEventType_OnCPUExecutionCapChanged
+        << KVBoxEventType_OnGuestMonitorChanged
         << KVBoxEventType_OnRuntimeError
         << KVBoxEventType_OnCanShowWindow
-        << KVBoxEventType_OnShowWindow
-        << KVBoxEventType_OnCPUExecutionCapChanged
-        << KVBoxEventType_OnGuestMonitorChanged;
+        << KVBoxEventType_OnShowWindow;
+    eventSource.RegisterListener(m_mainEventListener, events, TRUE);
 
-    const CConsole &console = m_pSession->session().GetConsole();
-    console.GetEventSource().RegisterListener(m_mainEventListener, events, TRUE);
-    AssertWrapperOk(console);
 
+    /* Prepare connections: */
     connect(pListener->getWrapped(), SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)),
             this, SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigMouseCapabilityChange(bool, bool, bool, bool)),
             this, SIGNAL(sigMouseCapabilityChange(bool, bool, bool, bool)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)),
             this, SIGNAL(sigKeyboardLedsChangeEvent(bool, bool, bool)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigStateChange(KMachineState)),
             this, SIGNAL(sigStateChange(KMachineState)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigAdditionsChange()),
             this, SIGNAL(sigAdditionsChange()),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)),
             this, SIGNAL(sigNetworkAdapterChange(CNetworkAdapter)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigMediumChange(CMediumAttachment)),
             this, SIGNAL(sigMediumChange(CMediumAttachment)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigVRDEChange()),
             this, SIGNAL(sigVRDEChange()),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigVideoCaptureChange()),
             this, SIGNAL(sigVideoCaptureChange()),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigUSBControllerChange()),
             this, SIGNAL(sigUSBControllerChange()),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)),
             this, SIGNAL(sigUSBDeviceStateChange(CUSBDevice, bool, CVirtualBoxErrorInfo)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigSharedFolderChange()),
             this, SIGNAL(sigSharedFolderChange()),
             Qt::QueuedConnection);
+    connect(pListener->getWrapped(), SIGNAL(sigCPUExecutionCapChange()),
+            this, SIGNAL(sigCPUExecutionCapChange()),
+            Qt::QueuedConnection);
+    connect(pListener->getWrapped(), SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
+            this, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
+            Qt::QueuedConnection);
 
     connect(pListener->getWrapped(), SIGNAL(sigRuntimeError(bool, QString, QString)),
             this, SIGNAL(sigRuntimeError(bool, QString, QString)),
@@ -143,53 +185,23 @@ UIConsoleEventHandler::UIConsoleEventHandler(UISession *pSession)
     connect(pListener->getWrapped(), SIGNAL(sigCanShowWindow(bool&, QString&)),
             this, SLOT(sltCanShowWindow(bool&, QString&)),
             Qt::DirectConnection);
-
     /* This returns a winId, so we have to respond to the event and have to use
      * a direct connection therefor. */
     connect(pListener->getWrapped(), SIGNAL(sigShowWindow(LONG64&)),
             this, SLOT(sltShowWindow(LONG64&)),
             Qt::DirectConnection);
-
-    connect(pListener->getWrapped(), SIGNAL(sigCPUExecutionCapChange()),
-            this, SIGNAL(sigCPUExecutionCapChange()),
-            Qt::QueuedConnection);
-
-    connect(pListener->getWrapped(), SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
-            this, SIGNAL(sigGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)),
-            Qt::QueuedConnection);
-}
-
-UIConsoleEventHandler::~UIConsoleEventHandler()
-{
-    const CConsole &console = m_pSession->session().GetConsole();
-    console.GetEventSource().UnregisterListener(m_mainEventListener);
-    AssertWrapperOk(console);
-}
-
-void UIConsoleEventHandler::sltCanShowWindow(bool & /* fVeto */, QString & /* strReason */)
-{
-    /* No veto, so nothing for us to do. */
 }
 
-void UIConsoleEventHandler::sltShowWindow(LONG64 &winId)
+void UIConsoleEventHandler::cleanup()
 {
-#ifdef Q_WS_MAC
-        /* Let's try the simple approach first - grab the focus.
-         * Getting a window out of the dock (minimized or whatever it's called)
-         * needs to be done on the GUI thread, so post it a note: */
-        winId = 0;
-        if (::darwinSetFrontMostProcess())
-            emit sigShowWindow();
-        else
-        {
-            /* It failed for some reason, send the other process our PSN so it can try.
-             * (This is just a precaution should Mac OS X start imposing the same sensible
-             * focus stealing restrictions that other window managers implement). */
-            winId = ::darwinGetCurrentProcessId();
-        }
-#else /* Q_WS_MAC */
-        /* Return the ID of the top-level console window. */
-        winId = (ULONG64)m_pSession->winId();
-#endif /* !Q_WS_MAC */
+    /* Get console: */
+    const CConsole console = m_pSession->session().GetConsole();
+    if (console.isNull() || !console.isOk())
+        return;
+    /* Get event-source: */
+    CEventSource eventSource = console.GetEventSource();
+    AssertReturnVoid(!eventSource.isNull() || eventSource.isOk());
+    /* Unregister listener: */
+    eventSource.UnregisterListener(m_mainEventListener);
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h
index 8617741..8dae9b3 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIConsoleEventHandler.h
@@ -1,11 +1,10 @@
+/* $Id: UIConsoleEventHandler.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIConsoleEventHandler class declaration
+ * VBox Qt GUI - UIConsoleEventHandler class declaration.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,13 +15,13 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIConsoleEventHandler_h__
-#define __UIConsoleEventHandler_h__
+#ifndef ___UIConsoleEventHandler_h___
+#define ___UIConsoleEventHandler_h___
 
 /* COM includes: */
 #include "COMEnums.h"
-#include "CVirtualBoxErrorInfo.h"
 #include "CEventListener.h"
+#include "CVirtualBoxErrorInfo.h"
 #include "CMediumAttachment.h"
 #include "CNetworkAdapter.h"
 #include "CUSBDevice.h"
@@ -30,48 +29,84 @@
 /* Forward declarations: */
 class UISession;
 
+/** Active event handler singleton for the CConsole event-source. */
 class UIConsoleEventHandler: public QObject
 {
     Q_OBJECT;
 
-public:
-    static UIConsoleEventHandler* instance(UISession *pSession = 0);
-    static void destroy();
-
 signals:
+
+    /** Notifies about mouse pointer become @a fVisible and his shape changed to @a fAlpha, @a hotCorner, @a size and @a shape. */
     void sigMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape);
+    /** Notifies about mouse capability change to @a fSupportsAbsolute, @a fSupportsRelative, @a fSupportsMultiTouch and @a fNeedsHostCursor. */
     void sigMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fSupportsMultiTouch, bool fNeedsHostCursor);
+    /** Notifies about keyboard LEDs change for @a fNumLock, @a fCapsLock and @a fScrollLock. */
     void sigKeyboardLedsChangeEvent(bool fNumLock, bool fCapsLock, bool fScrollLock);
+    /** Notifies about machine @a state change. */
     void sigStateChange(KMachineState state);
+    /** Notifies about guest additions state change. */
     void sigAdditionsChange();
+    /** Notifies about network @a adapter state change. */
     void sigNetworkAdapterChange(CNetworkAdapter adapter);
+    /** Notifies about storage medium @a attachment state change. */
     void sigMediumChange(CMediumAttachment attachment);
+    /** Notifies about VRDE device state change. */
     void sigVRDEChange();
+    /** Notifies about Video Capture device state change. */
     void sigVideoCaptureChange();
+    /** Notifies about USB controller state change. */
     void sigUSBControllerChange();
+    /** Notifies about USB @a device state change to @a fAttached, holding additional @a error information. */
     void sigUSBDeviceStateChange(CUSBDevice device, bool fAttached, CVirtualBoxErrorInfo error);
+    /** Notifies about shared folder state change. */
     void sigSharedFolderChange();
-    void sigRuntimeError(bool fFatal, QString strId, QString strMessage);
+    /** Notifies about CPU execution-cap change. */
+    void sigCPUExecutionCapChange();
+    /** Notifies about guest-screen configuration change of @a type for @a uScreenId with @a screenGeo. */
+    void sigGuestMonitorChange(KGuestMonitorChangedEventType type, ulong uScreenId, QRect screenGeo);
+    /** Notifies about Runtime error with @a strErrorId which is @a fFatal and have @a strMessage. */
+    void sigRuntimeError(bool fFatal, QString strErrorId, QString strMessage);
 #ifdef RT_OS_DARWIN
+    /** Notifies about VM window should be shown. */
     void sigShowWindow();
 #endif /* RT_OS_DARWIN */
-    void sigCPUExecutionCapChange();
-    void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
+
+public:
+
+    /** Static instance wrapper. */
+    static UIConsoleEventHandler* instance() { return m_spInstance; }
+    /** Static instance constructor. */
+    static void create(UISession *pSession);
+    /** Static instance destructor. */
+    static void destroy();
 
 private slots:
+
+    /** Returns whether VM window can be shown. */
     void sltCanShowWindow(bool &fVeto, QString &strReason);
+    /** Shows VM window if possible. */
     void sltShowWindow(LONG64 &winId);
 
 private:
+
+    /** Constructor: */
     UIConsoleEventHandler(UISession *pSession);
-    ~UIConsoleEventHandler();
 
-    static UIConsoleEventHandler *m_pInstance;
+    /** Prepare routine. */
+    void prepare();
+    /** Cleanup routine. */
+    void cleanup();
+
+    /** Holds the static instance. */
+    static UIConsoleEventHandler *m_spInstance;
+
+    /** Holds the UI session reference. */
     UISession *m_pSession;
+
+    /** Holds the main event listener instance. */
     CEventListener m_mainEventListener;
 };
 
 #define gConsoleEvents UIConsoleEventHandler::instance()
 
-#endif /* !__UIConsoleEventHandler_h__ */
-
+#endif /* !___UIConsoleEventHandler_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.cpp
new file mode 100644
index 0000000..6bb4f17
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.cpp
@@ -0,0 +1,744 @@
+/* $Id: UIDnDDataObject_win.cpp $ */
+/** @file
+ * VBox Qt GUI - UIDnDDrag class implementation. This class implements the
+ * IDataObject interface.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef LOG_GROUP
+# undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+#include <windows.h>
+#include <new> /* For bad_alloc. */
+#include <shlobj.h>
+
+#include <iprt/path.h>
+#include <iprt/semaphore.h>
+#include <iprt/string.h>
+#include <iprt/mem.h>
+#include <iprt/uri.h>
+
+#include <QStringList>
+
+#include "UIDnDHandler.h"
+#include "UIDnDDataObject_win.h"
+#include "UIDnDEnumFormat_win.h"
+
+
+UIDnDDataObject::UIDnDDataObject(UIDnDHandler *pDnDHandler, const QStringList &lstFormats)
+    : m_pDnDHandler(pDnDHandler)
+    , mStatus(Uninitialized)
+    , mRefCount(1)
+    , mcFormats(0)
+    , mpFormatEtc(NULL)
+    , mpStgMedium(NULL)
+    , mpvData(NULL)
+    , mcbData(0)
+{
+    HRESULT hr;
+
+    ULONG cMaxFormats = 16; /* Maximum number of registered formats. */
+    ULONG cRegisteredFormats = 0;
+
+    try
+    {
+        mpFormatEtc = new FORMATETC[cMaxFormats];
+        RT_BZERO(mpFormatEtc, sizeof(FORMATETC) * cMaxFormats);
+        mpStgMedium = new STGMEDIUM[cMaxFormats];
+        RT_BZERO(mpStgMedium, sizeof(STGMEDIUM) * cMaxFormats);
+
+        for (int i = 0;
+             (   i < lstFormats.size()
+              && i < cMaxFormats); i++)
+        {
+            const QString &strFormat = lstFormats.at(i);
+            if (mlstFormats.contains(strFormat))
+                continue;
+
+            /* URI data ("text/uri-list"). */
+            if (strFormat.contains("text/uri-list", Qt::CaseInsensitive))
+            {
+                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_TEXT);
+                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
+                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_UNICODETEXT);
+                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
+                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_HDROP);
+                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
+
+                mlstFormats << strFormat;
+            }
+            /* Plain text ("text/plain"). */
+            else if (strFormat.contains("text/plain", Qt::CaseInsensitive))
+            {
+                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_TEXT);
+                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
+                RegisterFormat(&mpFormatEtc[cRegisteredFormats], CF_UNICODETEXT);
+                mpStgMedium[cRegisteredFormats++].tymed = TYMED_HGLOBAL;
+
+                mlstFormats << strFormat;
+            }
+        }
+
+        LogRel3(("DnD: Total registered native formats: %RU32 (for %d formats from guest)\n",
+                 cRegisteredFormats, lstFormats.size()));
+        hr = S_OK;
+    }
+    catch (std::bad_alloc &)
+    {
+        hr = E_OUTOFMEMORY;
+    }
+
+    if (SUCCEEDED(hr))
+    {
+        int rc2 = RTSemEventCreate(&mSemEvent);
+        AssertRC(rc2);
+
+        /*
+         * Other (not so common) formats.
+         */
+#if 0
+        /* IStream. */
+        RegisterFormat(&mpFormatEtc[cFormats++],
+                       RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR));
+        RegisterFormat(&mpFormatEtc[cFormats++],
+                       RegisterClipboardFormat(CFSTR_FILECONTENTS),
+                       TYMED_ISTREAM, 0 /* lIndex */);
+
+        /* Required for e.g. Windows Media Player. */
+        RegisterFormat(&mpFormatEtc[cFormats++],
+                       RegisterClipboardFormat(CFSTR_FILENAME));
+        RegisterFormat(&mpFormatEtc[cFormats++],
+                       RegisterClipboardFormat(CFSTR_FILENAMEW));
+        RegisterFormat(&mpFormatEtc[cFormats++],
+                       RegisterClipboardFormat(CFSTR_SHELLIDLIST));
+        RegisterFormat(&mpFormatEtc[cFormats++],
+                       RegisterClipboardFormat(CFSTR_SHELLIDLISTOFFSET));
+#endif
+        mcFormats = cRegisteredFormats;
+
+        /* Put the object in the "dropped" state already. We don't need
+         * to handle the other states here at the moment. */
+        mStatus = Dropped;
+    }
+
+    LogFlowFunc(("hr=%Rhrc\n", hr));
+}
+
+UIDnDDataObject::~UIDnDDataObject(void)
+{
+    if (mpFormatEtc)
+        delete[] mpFormatEtc;
+
+    if (mpStgMedium)
+        delete[] mpStgMedium;
+
+    if (mpvData)
+        RTMemFree(mpvData);
+
+    LogFlowFunc(("mRefCount=%RI32\n", mRefCount));
+}
+
+/*
+ * IUnknown methods.
+ */
+
+STDMETHODIMP_(ULONG) UIDnDDataObject::AddRef(void)
+{
+    return InterlockedIncrement(&mRefCount);
+}
+
+STDMETHODIMP_(ULONG) UIDnDDataObject::Release(void)
+{
+    LONG lCount = InterlockedDecrement(&mRefCount);
+    if (lCount == 0)
+    {
+        delete this;
+        return 0;
+    }
+
+    return lCount;
+}
+
+STDMETHODIMP UIDnDDataObject::QueryInterface(REFIID iid, void **ppvObject)
+{
+    AssertPtrReturn(ppvObject, E_INVALIDARG);
+
+    if (   iid == IID_IDataObject
+        || iid == IID_IUnknown)
+    {
+        AddRef();
+        *ppvObject = this;
+        return S_OK;
+    }
+
+    *ppvObject = 0;
+    return E_NOINTERFACE;
+}
+
+/**
+ * Retrieves the data stored in this object and store the result in
+ * pMedium.
+ *
+ * @return  IPRT status code.
+ * @return  HRESULT
+ * @param   pFormatEtc
+ * @param   pMedium
+ */
+STDMETHODIMP UIDnDDataObject::GetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium)
+{
+    AssertPtrReturn(pFormatEtc, DV_E_FORMATETC);
+    AssertPtrReturn(pMedium, DV_E_FORMATETC);
+
+    LogFlowFunc(("pFormatEtc=%p, pMedium=%p\n", pFormatEtc, pMedium));
+
+    ULONG lIndex;
+    if (!LookupFormatEtc(pFormatEtc, &lIndex)) /* Format supported? */
+        return DV_E_FORMATETC;
+    if (lIndex >= mcFormats) /* Paranoia. */
+        return DV_E_FORMATETC;
+
+    FORMATETC *pThisFormat = &mpFormatEtc[lIndex];
+    AssertPtr(pThisFormat);
+
+    STGMEDIUM *pThisMedium = &mpStgMedium[lIndex];
+    AssertPtr(pThisMedium);
+
+    HRESULT hr = DV_E_FORMATETC;
+
+    LogFlowFunc(("mStatus=%ld\n", mStatus));
+    if (mStatus == Dropping)
+    {
+        LogRel3(("DnD: Dropping\n"));
+        LogFlowFunc(("Waiting for event ...\n"));
+        int rc2 = RTSemEventWait(mSemEvent, RT_INDEFINITE_WAIT);
+        LogFlowFunc(("rc=%Rrc, mStatus=%ld\n", rc2, mStatus));
+    }
+
+    if (mStatus == Dropped)
+    {
+        LogRel3(("DnD: Dropped\n"));
+        LogRel3(("DnD: cfFormat=%RI16, sFormat=%s, tyMed=%RU32, dwAspect=%RU32\n",
+                 pThisFormat->cfFormat, UIDnDDataObject::ClipboardFormatToString(pFormatEtc->cfFormat),
+                 pThisFormat->tymed, pThisFormat->dwAspect));
+        LogRel3(("DnD: Got strFormat=%s, pvData=%p, cbData=%RU32\n",
+                 mstrFormat.toAscii().constData(), mpvData, mcbData));
+
+        QVariant::Type vaType;
+        QString strMIMEType;
+        if (    (pFormatEtc->tymed & TYMED_HGLOBAL)
+             && (pFormatEtc->dwAspect == DVASPECT_CONTENT)
+             && (   pFormatEtc->cfFormat == CF_TEXT
+                 || pFormatEtc->cfFormat == CF_UNICODETEXT)
+           )
+        {
+            strMIMEType = "text/plain"; /** @todo Indicate UTF8 encoding? */
+            vaType = QVariant::String;
+        }
+        else if (   (pFormatEtc->tymed & TYMED_HGLOBAL)
+                 && (pFormatEtc->dwAspect == DVASPECT_CONTENT)
+                 && (pFormatEtc->cfFormat == CF_HDROP))
+        {
+            strMIMEType = "text/uri-list";
+            vaType = QVariant::StringList;
+        }
+#if 0 /* More formats; not needed right now. */
+        else if (   (pFormatEtc->tymed & TYMED_ISTREAM)
+                && (pFormatEtc->dwAspect == DVASPECT_CONTENT)
+                && (pFormatEtc->cfFormat == CF_FILECONTENTS))
+        {
+
+        }
+        else if  (   (pFormatEtc->tymed & TYMED_HGLOBAL)
+                  && (pFormatEtc->dwAspect == DVASPECT_CONTENT)
+                  && (pFormatEtc->cfFormat == CF_FILEDESCRIPTOR))
+        {
+
+        }
+        else if (   (pFormatEtc->tymed & TYMED_HGLOBAL)
+                 && (pFormatEtc->cfFormat == CF_PREFERREDDROPEFFECT))
+        {
+            HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT, sizeof(DWORD));
+            DWORD *pdwEffect = (DWORD *)GlobalLock(hData);
+            AssertPtr(pdwEffect);
+            *pdwEffect = DROPEFFECT_COPY;
+            GlobalUnlock(hData);
+
+            pMedium->hGlobal = hData;
+            pMedium->tymed = TYMED_HGLOBAL;
+        }
+#endif
+        LogRel3(("DnD: strMIMEType=%s, vaType=%ld\n", strMIMEType.toAscii().constData(), vaType));
+
+        int rc;
+        if (!mVaData.isValid())
+        {
+            /* Note:  We're usig Qt::MoveAction because this speed up the whole operation
+             *        significantly: Instead of copying the data from the temporary location to
+             *        the final destination we just move it.
+             *
+             * Note2: The Qt::MoveAction *only* affects the behavior on the host! The desired
+             *        action for the guest (e.g. moving a file from guest to host) is not affected
+             *        by this setting. */
+            rc = m_pDnDHandler->retrieveData(Qt::MoveAction,
+                                             strMIMEType, vaType, mVaData);
+        }
+        else
+            rc = VINF_SUCCESS; /* Data already retrieved. */
+
+        if (RT_SUCCESS(rc))
+        {
+            if (   strMIMEType.startsWith("text/uri-list")
+                       /* One item. */
+                && (   mVaData.canConvert(QVariant::String)
+                       /* Multiple items. */
+                    || mVaData.canConvert(QVariant::StringList))
+               )
+            {
+                QStringList lstFilesURI = mVaData.toStringList();
+                QStringList lstFiles;
+                for (size_t i = 0; i < lstFilesURI.size(); i++)
+                {
+                    /* Extract path from URI. */
+                    char *pszPath = RTUriPath(lstFilesURI.at(i).toAscii().constData());
+                    if (   pszPath
+                        && strlen(pszPath) > 1)
+                    {
+                        pszPath++; /** @todo Skip first '/' (part of URI). Correct? */
+                        pszPath = RTPathChangeToDosSlashes(pszPath, false /* fForce */);
+                        lstFiles.append(pszPath);
+                    }
+                }
+
+                size_t cFiles = lstFiles.size();
+                Assert(cFiles);
+#ifdef DEBUG
+                LogFlowFunc(("Files (%zu)\n", cFiles));
+                for (size_t i = 0; i < cFiles; i++)
+                    LogFlowFunc(("\tFile: %s\n", lstFiles.at(i).toAscii().constData()));
+#endif
+                size_t cchFiles = 0; /* Number of ASCII characters. */
+                for (size_t i = 0; i < cFiles; i++)
+                {
+                    cchFiles += strlen(lstFiles.at(i).toAscii().constData());
+                    cchFiles += 1; /* Terminating '\0'. */
+                }
+
+                size_t cbBuf = sizeof(DROPFILES) + ((cchFiles + 1) * sizeof(RTUTF16));
+                DROPFILES *pDropFiles = (DROPFILES *)RTMemAllocZ(cbBuf);
+                if (pDropFiles)
+                {
+                    pDropFiles->pFiles = sizeof(DROPFILES);
+                    pDropFiles->fWide = 1; /* We use unicode. Always. */
+
+                    uint8_t *pCurFile = (uint8_t *)pDropFiles + pDropFiles->pFiles;
+                    AssertPtr(pCurFile);
+
+                    for (size_t i = 0; i < cFiles; i++)
+                    {
+                        size_t cchCurFile;
+                        PRTUTF16 pwszFile;
+                        rc = RTStrToUtf16(lstFiles.at(i).toAscii().constData(), &pwszFile);
+                        if (RT_SUCCESS(rc))
+                        {
+                            cchCurFile = RTUtf16Len(pwszFile);
+                            Assert(cchCurFile);
+                            memcpy(pCurFile, pwszFile, cchCurFile * sizeof(RTUTF16));
+                            RTUtf16Free(pwszFile);
+                        }
+                        else
+                            break;
+
+                        pCurFile += cchCurFile * sizeof(RTUTF16);
+
+                        /* Terminate current file name. */
+                        *pCurFile = L'\0';
+                        pCurFile += sizeof(RTUTF16);
+                    }
+
+                    if (RT_SUCCESS(rc))
+                    {
+                        *pCurFile = L'\0'; /* Final list terminator. */
+
+                        pMedium->tymed = TYMED_HGLOBAL;
+                        pMedium->pUnkForRelease = NULL;
+                        pMedium->hGlobal = GlobalAlloc(  GMEM_ZEROINIT
+                                                       | GMEM_MOVEABLE
+                                                       | GMEM_DDESHARE, cbBuf);
+                        if (pMedium->hGlobal)
+                        {
+                            LPVOID pvMem = GlobalLock(pMedium->hGlobal);
+                            if (pvMem)
+                            {
+                                memcpy(pvMem, pDropFiles, cbBuf);
+                                GlobalUnlock(pMedium->hGlobal);
+
+                                hr = S_OK;
+                            }
+                            else
+                                rc = VERR_ACCESS_DENIED;
+                        }
+                        else
+                            rc = VERR_NO_MEMORY;
+                    }
+
+                    RTMemFree(pDropFiles);
+                }
+            }
+            else if (   strMIMEType.startsWith("text/plain")
+                     && mVaData.canConvert(QVariant::String))
+            {
+                bool fUnicode = pFormatEtc->cfFormat == CF_UNICODETEXT;
+                int cbCh = fUnicode
+                         ? sizeof(WCHAR) : sizeof(char);
+
+                QString strText = mVaData.toString();
+                size_t cbSrc = strText.length() * cbCh;
+                Assert(cbSrc);
+                LPCVOID pvSrc = fUnicode
+                              ? (void *)strText.unicode()
+                              : (void *)strText.toAscii().constData();
+                AssertPtr(pvSrc);
+
+                LogFlowFunc(("pvSrc=0x%p, cbSrc=%zu, cbch=%d, fUnicode=%RTbool\n",
+                             pvSrc, cbSrc, cbCh, fUnicode));
+
+                pMedium->tymed = TYMED_HGLOBAL;
+                pMedium->pUnkForRelease = NULL;
+                pMedium->hGlobal = GlobalAlloc(  GMEM_ZEROINIT
+                                               | GMEM_MOVEABLE
+                                               | GMEM_DDESHARE,
+                                               cbSrc);
+                if (pMedium->hGlobal)
+                {
+                    LPVOID pvDst = GlobalLock(pMedium->hGlobal);
+                    if (pvDst)
+                    {
+                        memcpy(pvDst, pvSrc, cbSrc);
+                        GlobalUnlock(pMedium->hGlobal);
+                    }
+                    else
+                        rc = VERR_ACCESS_DENIED;
+
+                    hr = S_OK;
+                }
+                else
+                    hr  = VERR_NO_MEMORY;
+            }
+            else
+                LogFlowFunc(("MIME type=%s not supported\n",
+                             strMIMEType.toAscii().constData()));
+
+            LogFlowFunc(("Handling formats ended with rc=%Rrc\n", rc));
+        }
+    }
+
+    /*
+     * Fallback in error case.
+     */
+    if (FAILED(hr))
+    {
+        LogFlowFunc(("Error hr=%Rhrc while handling data, copying raw medium data ...\n", hr));
+
+        switch (pThisMedium->tymed)
+        {
+
+        case TYMED_HGLOBAL:
+            pMedium->hGlobal = (HGLOBAL)OleDuplicateData(pThisMedium->hGlobal,
+                                                         pThisFormat->cfFormat,
+                                                         0 /* Flags */);
+            break;
+
+        default:
+            break;
+        }
+
+        pMedium->tymed          = pFormatEtc->tymed;
+        pMedium->pUnkForRelease = NULL;
+    }
+
+    LogFlowFunc(("Returning hr=%Rhrc\n", hr));
+    return hr;
+}
+
+/**
+ * Only required for IStream / IStorage interfaces.
+ *
+ * @return  IPRT status code.
+ * @return  HRESULT
+ * @param   pFormatEtc
+ * @param   pMedium
+ */
+STDMETHODIMP UIDnDDataObject::GetDataHere(FORMATETC *pFormatEtc, STGMEDIUM *pMedium)
+{
+    LogFlowFunc(("\n"));
+    return DATA_E_FORMATETC;
+}
+
+/**
+ * Query if this objects supports a specific format.
+ *
+ * @return  IPRT status code.
+ * @return  HRESULT
+ * @param   pFormatEtc
+ */
+STDMETHODIMP UIDnDDataObject::QueryGetData(FORMATETC *pFormatEtc)
+{
+    return (LookupFormatEtc(pFormatEtc, NULL /* puIndex */)) ? S_OK : DV_E_FORMATETC;
+}
+
+STDMETHODIMP UIDnDDataObject::GetCanonicalFormatEtc(FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut)
+{
+    LogFlowFunc(("\n"));
+
+    /* Set this to NULL in any case. */
+    pFormatEtcOut->ptd = NULL;
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP UIDnDDataObject::SetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease)
+{
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP UIDnDDataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc)
+{
+    LogFlowFunc(("dwDirection=%RI32, mcFormats=%RI32, mpFormatEtc=%p\n",
+                 dwDirection, mcFormats, mpFormatEtc));
+
+    HRESULT hr;
+    if (dwDirection == DATADIR_GET)
+    {
+        hr = UIDnDEnumFormatEtc::CreateEnumFormatEtc(mcFormats, mpFormatEtc, ppEnumFormatEtc);
+    }
+    else
+        hr = E_NOTIMPL;
+
+    LogFlowFunc(("hr=%Rhrc\n", hr));
+    return hr;
+}
+
+STDMETHODIMP UIDnDDataObject::DAdvise(FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
+{
+    return OLE_E_ADVISENOTSUPPORTED;
+}
+
+STDMETHODIMP UIDnDDataObject::DUnadvise(DWORD dwConnection)
+{
+    return OLE_E_ADVISENOTSUPPORTED;
+}
+
+STDMETHODIMP UIDnDDataObject::EnumDAdvise(IEnumSTATDATA **ppEnumAdvise)
+{
+    return OLE_E_ADVISENOTSUPPORTED;
+}
+
+/*
+ * Own stuff.
+ */
+
+int UIDnDDataObject::Abort(void)
+{
+    LogFlowFunc(("Aborting ...\n"));
+    mStatus = Aborted;
+    return RTSemEventSignal(mSemEvent);
+}
+
+/* static */
+const char* UIDnDDataObject::ClipboardFormatToString(CLIPFORMAT fmt)
+{
+    WCHAR wszFormat[128];
+    if (GetClipboardFormatNameW(fmt, wszFormat, sizeof(wszFormat) / sizeof(WCHAR)))
+        LogFlowFunc(("wFormat=%RI16, szName=%ls\n", fmt, wszFormat));
+
+    switch (fmt)
+    {
+
+    case 1:
+        return "CF_TEXT";
+    case 2:
+        return "CF_BITMAP";
+    case 3:
+        return "CF_METAFILEPICT";
+    case 4:
+        return "CF_SYLK";
+    case 5:
+        return "CF_DIF";
+    case 6:
+        return "CF_TIFF";
+    case 7:
+        return "CF_OEMTEXT";
+    case 8:
+        return "CF_DIB";
+    case 9:
+        return "CF_PALETTE";
+    case 10:
+        return "CF_PENDATA";
+    case 11:
+        return "CF_RIFF";
+    case 12:
+        return "CF_WAVE";
+    case 13:
+        return "CF_UNICODETEXT";
+    case 14:
+        return "CF_ENHMETAFILE";
+    case 15:
+        return "CF_HDROP";
+    case 16:
+        return "CF_LOCALE";
+    case 17:
+        return "CF_DIBV5";
+    case 18:
+        return "CF_MAX";
+    case 49158:
+        return "FileName";
+    case 49159:
+        return "FileNameW";
+    case 49161:
+        return "DATAOBJECT";
+    case 49171:
+        return "Ole Private Data";
+    case 49314:
+        return "Shell Object Offsets";
+    case 49316:
+        return "File Contents";
+    case 49317:
+        return "File Group Descriptor";
+    case 49323:
+        return "Preferred Drop Effect";
+    case 49380:
+        return "Shell Object Offsets";
+    case 49382:
+        return "FileContents";
+    case 49383:
+        return "FileGroupDescriptor";
+    case 49389:
+        return "Preferred DropEffect";
+    case 49268:
+        return "Shell IDList Array";
+    case 49619:
+        return "RenPrivateFileAttachments";
+    default:
+        break;
+    }
+
+    return "unknown";
+}
+
+bool UIDnDDataObject::LookupFormatEtc(FORMATETC *pFormatEtc, ULONG *puIndex)
+{
+    AssertReturn(pFormatEtc, false);
+    /* puIndex is optional. */
+
+    for (ULONG i = 0; i < mcFormats; i++)
+    {
+        if(    (pFormatEtc->tymed & mpFormatEtc[i].tymed)
+            && pFormatEtc->cfFormat == mpFormatEtc[i].cfFormat
+            && pFormatEtc->dwAspect == mpFormatEtc[i].dwAspect)
+        {
+            LogRel3(("DnD: Format found: tyMed=%RI32, cfFormat=%RI16, sFormats=%s, dwAspect=%RI32, ulIndex=%RU32\n",
+                     pFormatEtc->tymed, pFormatEtc->cfFormat, UIDnDDataObject::ClipboardFormatToString(mpFormatEtc[i].cfFormat),
+                     pFormatEtc->dwAspect, i));
+
+            if (puIndex)
+                *puIndex = i;
+            return true;
+        }
+    }
+
+    LogRel3(("DnD: Format NOT found: tyMed=%RI32, cfFormat=%RI16, sFormats=%s, dwAspect=%RI32\n",
+             pFormatEtc->tymed, pFormatEtc->cfFormat, UIDnDDataObject::ClipboardFormatToString(pFormatEtc->cfFormat),
+             pFormatEtc->dwAspect));
+
+    return false;
+}
+
+/* static */
+HGLOBAL UIDnDDataObject::MemDup(HGLOBAL hMemSource)
+{
+    DWORD dwLen    = GlobalSize(hMemSource);
+    AssertReturn(dwLen, NULL);
+    PVOID pvSource = GlobalLock(hMemSource);
+    if (pvSource)
+    {
+        PVOID pvDest = GlobalAlloc(GMEM_FIXED, dwLen);
+        if (pvDest)
+            memcpy(pvDest, pvSource, dwLen);
+
+        GlobalUnlock(hMemSource);
+        return pvDest;
+    }
+
+    return NULL;
+}
+
+void UIDnDDataObject::RegisterFormat(FORMATETC *pFormatEtc, CLIPFORMAT clipFormat,
+                                     TYMED tyMed, LONG lIndex, DWORD dwAspect,
+                                     DVTARGETDEVICE *pTargetDevice)
+{
+    AssertPtr(pFormatEtc);
+
+    pFormatEtc->cfFormat = clipFormat;
+    pFormatEtc->tymed    = tyMed;
+    pFormatEtc->lindex   = lIndex;
+    pFormatEtc->dwAspect = dwAspect;
+    pFormatEtc->ptd      = pTargetDevice;
+
+    LogFlowFunc(("Registered format=%ld, sFormat=%s\n",
+                 pFormatEtc->cfFormat, UIDnDDataObject::ClipboardFormatToString(pFormatEtc->cfFormat)));
+}
+
+void UIDnDDataObject::SetStatus(Status status)
+{
+    LogFlowFunc(("Setting status to %ld\n", status));
+    mStatus = status;
+}
+
+int UIDnDDataObject::Signal(const QString &strFormat,
+                            const void *pvData, uint32_t cbData)
+{
+    LogFlowFunc(("Signalling ...\n"));
+
+    int rc;
+
+    mStatus = Dropped;
+    mstrFormat = strFormat;
+    if (cbData)
+    {
+        mpvData = RTMemAlloc(cbData);
+        if (mpvData)
+        {
+            memcpy(mpvData, pvData, cbData);
+            mcbData = cbData;
+            rc = VINF_SUCCESS;
+        }
+        else
+            rc = VERR_NO_MEMORY;
+    }
+    else
+        rc = VINF_SUCCESS;
+
+    if (RT_FAILURE(rc))
+        mStatus = Aborted;
+
+    /* Signal in any case. */
+    int rc2 = RTSemEventSignal(mSemEvent);
+    if (RT_SUCCESS(rc))
+        rc = rc2;
+
+    return rc;
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.h
new file mode 100644
index 0000000..6a500f1
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDataObject_win.h
@@ -0,0 +1,107 @@
+/* $Id: UIDnDDataObject_win.h $ */
+/** @file
+ * VBox Qt GUI - UIDnDDataObject class declaration.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIDnDDataObject_win_h___
+#define ___UIDnDDataObject_win_h___
+
+#include <iprt/critsect.h>
+
+#include <QString>
+#include <QStringList>
+#include <QVariant>
+
+/* COM includes: */
+#include "COMEnums.h"
+#include "CDndSource.h"
+#include "CSession.h"
+
+/* Forward declarations: */
+class UIDnDHandler;
+
+class UIDnDDataObject : public IDataObject
+{
+public:
+
+    enum Status
+    {
+        Uninitialized = 0,
+        Initialized,
+        Dropping,
+        Dropped,
+        Aborted
+    };
+
+public:
+
+    UIDnDDataObject(UIDnDHandler *pDnDHandler, const QStringList &lstFormats);
+    virtual ~UIDnDDataObject(void);
+
+public: /* IUnknown methods. */
+
+    STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
+    STDMETHOD_(ULONG, AddRef)(void);
+    STDMETHOD_(ULONG, Release)(void);
+
+public: /* IDataObject methods. */
+
+    STDMETHOD(GetData)(FORMATETC *pFormatEtc, STGMEDIUM *pMedium);
+    STDMETHOD(GetDataHere)(FORMATETC *pFormatEtc, STGMEDIUM *pMedium);
+    STDMETHOD(QueryGetData)(FORMATETC *pFormatEtc);
+    STDMETHOD(GetCanonicalFormatEtc)(FORMATETC *pFormatEct,  FORMATETC *pFormatEtcOut);
+    STDMETHOD(SetData)(FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease);
+    STDMETHOD(EnumFormatEtc)(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc);
+    STDMETHOD(DAdvise)(FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection);
+    STDMETHOD(DUnadvise)(DWORD dwConnection);
+    STDMETHOD(EnumDAdvise)(IEnumSTATDATA **ppEnumAdvise);
+
+public:
+
+    static const char* ClipboardFormatToString(CLIPFORMAT fmt);
+
+    int Abort(void);
+    void SetStatus(Status status);
+    int Signal(const QString &strFormat, const void *pvData, uint32_t cbData);
+
+protected:
+
+    bool LookupFormatEtc(FORMATETC *pFormatEtc, ULONG *puIndex);
+    static HGLOBAL MemDup(HGLOBAL hMemSource);
+    void RegisterFormat(FORMATETC *pFormatEtc, CLIPFORMAT clipFormat, TYMED tyMed = TYMED_HGLOBAL,
+                        LONG lindex = -1, DWORD dwAspect = DVASPECT_CONTENT, DVTARGETDEVICE *pTargetDevice = NULL);
+
+    UIDnDHandler   *m_pDnDHandler;
+
+    Status          mStatus;
+    LONG            mRefCount;
+    /** Number of native formats registered. This can be a different number than supplied with mlstFormats. */
+    ULONG           mcFormats;
+    FORMATETC      *mpFormatEtc;
+    STGMEDIUM      *mpStgMedium;
+    RTSEMEVENT      mSemEvent;
+    QStringList     mlstFormats;
+    QString         mstrFormat;
+    /** The retrieved data as a QVariant. Needed for buffering in case a second format needs the same data,
+     *  e.g. CF_TEXT and CF_UNICODETEXT. */
+    QVariant        mVaData;
+    /** The retrieved data as a raw buffer. */
+    void           *mpvData;
+    /** Raw buffer size (in bytes). */
+    uint32_t        mcbData;
+};
+
+#endif /* ___UIDnDDataObject_win_h___ */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDropSource_win.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDropSource_win.cpp
new file mode 100644
index 0000000..f7f8e2d
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDropSource_win.cpp
@@ -0,0 +1,148 @@
+/* $Id: UIDnDDropSource_win.cpp $ */
+/** @file
+ * VBox Qt GUI - UIDnDDropSource class implementation for Windows. This implements
+ * the IDropSource interface.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#undef LOG_GROUP
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+#include <iprt/assert.h>
+#include <iprt/thread.h>
+
+#include <windows.h>
+#include <new> /* For bad_alloc. */
+
+#include "UIDnDDropSource_win.h"
+
+
+
+UIDnDDropSource::UIDnDDropSource(QWidget *pParent)
+    : mRefCount(1),
+      mpParent(pParent),
+      mdwCurEffect(0),
+      muCurAction(Qt::IgnoreAction)
+{
+    LogFlowFunc(("pParent=0x%p\n", mpParent));
+}
+
+UIDnDDropSource::~UIDnDDropSource(void)
+{
+    LogFlowFunc(("mRefCount=%RI32\n", mRefCount));
+}
+
+/*
+ * IUnknown methods.
+ */
+
+STDMETHODIMP_(ULONG) UIDnDDropSource::AddRef(void)
+{
+    return InterlockedIncrement(&mRefCount);
+}
+
+STDMETHODIMP_(ULONG) UIDnDDropSource::Release(void)
+{
+    LONG lCount = InterlockedDecrement(&mRefCount);
+    if (lCount == 0)
+    {
+        delete this;
+        return 0;
+    }
+
+    return lCount;
+}
+
+STDMETHODIMP UIDnDDropSource::QueryInterface(REFIID iid, void **ppvObject)
+{
+    AssertPtrReturn(ppvObject, E_INVALIDARG);
+
+    if (   iid == IID_IDropSource
+        || iid == IID_IUnknown)
+    {
+        AddRef();
+        *ppvObject = this;
+        return S_OK;
+    }
+
+    *ppvObject = 0;
+    return E_NOINTERFACE;
+}
+
+/*
+ * IDropSource methods.
+ */
+
+/**
+ * The system informs us about whether we should continue the drag'n drop
+ * operation or not, depending on the sent key states.
+ *
+ * @return  HRESULT
+ */
+STDMETHODIMP UIDnDDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD dwKeyState)
+{
+#ifndef DEBUG_andy
+    LogFlowFunc(("fEscapePressed=%RTbool, dwKeyState=0x%x, mdwCurEffect=%RI32, muCurAction=%RU32\n",
+                 fEscapePressed, dwKeyState, mdwCurEffect, muCurAction));
+#endif
+
+    /* ESC pressed? Bail out. */
+    if (fEscapePressed)
+    {
+        mdwCurEffect = 0;
+        muCurAction = Qt::IgnoreAction;
+
+        return DRAGDROP_S_CANCEL;
+    }
+
+    bool fDropContent = false;
+
+    /* Left mouse button released? Start "drop" action. */
+    if ((dwKeyState & MK_LBUTTON) == 0)
+        return DRAGDROP_S_DROP;
+
+    /* No change, just continue. */
+    return S_OK;
+}
+
+/**
+ * The drop target gives our source feedback about whether
+ * it can handle our data or not.
+ *
+ * @return  HRESULT
+ */
+STDMETHODIMP UIDnDDropSource::GiveFeedback(DWORD dwEffect)
+{
+     Qt::DropActions dropActions = Qt::IgnoreAction;
+
+#ifndef DEBUG_andy
+    LogFlowFunc(("dwEffect=0x%x\n", dwEffect));
+#endif
+    if (dwEffect)
+    {
+        if (dwEffect & DROPEFFECT_COPY)
+            dropActions |= Qt::CopyAction;
+        if (dwEffect & DROPEFFECT_MOVE)
+            dropActions |= Qt::MoveAction;
+        if (dwEffect & DROPEFFECT_LINK)
+            dropActions |= Qt::LinkAction;
+    }
+
+    mdwCurEffect = dwEffect;
+    muCurAction = dropActions;
+
+    return DRAGDROP_S_USEDEFAULTCURSORS;
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDropSource_win.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDropSource_win.h
new file mode 100644
index 0000000..a99af97
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDDropSource_win.h
@@ -0,0 +1,55 @@
+/* $Id: UIDnDDropSource_win.h $ */
+/** @file
+ * VBox Qt GUI - UIDnDDropSource class declaration.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIDnDDropSource_win_h___
+#define ___UIDnDDropSource_win_h___
+
+/* COM includes: */
+#include "COMEnums.h"
+
+class UIDnDDropSource : public IDropSource
+{
+public:
+
+    UIDnDDropSource(QWidget *pParent);
+    virtual ~UIDnDDropSource(void);
+
+public:
+
+    uint32_t GetCurrentAction(void) { return muCurAction; }
+
+public: /* IUnknown methods. */
+
+    STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
+    STDMETHOD_(ULONG, AddRef)(void);
+    STDMETHOD_(ULONG, Release)(void);
+
+public: /* IDropSource methods. */
+
+    STDMETHOD(QueryContinueDrag)(BOOL fEscapePressed, DWORD dwKeyState);
+    STDMETHOD(GiveFeedback)(DWORD dwEffect);
+
+protected:
+
+    LONG             mRefCount;
+    QWidget         *mpParent;
+    DWORD            mdwCurEffect;
+    Qt::DropActions  muCurAction;
+};
+
+#endif /* ___UIDnDDropSource_win_h___ */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDEnumFormat_win.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDEnumFormat_win.cpp
new file mode 100644
index 0000000..cd38e0b
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDEnumFormat_win.cpp
@@ -0,0 +1,191 @@
+/* $Id: UIDnDEnumFormat_win.cpp $ */
+/** @file
+ * VBox Qt GUI -  UIDnDEnumFormat class implementation. This class implements the
+ * IEnumFORMATETC ("Format et cetera") interface.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+#include <Windows.h>
+#include <new> /* For bad_alloc. */
+
+#include "UIDnDEnumFormat_win.h"
+#include "UIDnDDataObject_win.h"
+
+
+UIDnDEnumFormatEtc::UIDnDEnumFormatEtc(FORMATETC *pFormatEtc, ULONG cFormats)
+    : m_lRefCount(1),
+      m_nIndex(0)
+{
+    HRESULT hr;
+
+    try
+    {
+        LogFlowFunc(("pFormatEtc=%p, cFormats=%RU32\n", pFormatEtc, cFormats));
+        if (cFormats)
+            m_pFormatEtc  = new FORMATETC[cFormats];
+
+        for (ULONG i = 0; i < cFormats; i++)
+        {
+            LogFlowFunc(("Format %RU32: cfFormat=%RI16, sFormat=%s, tyMed=%RU32, dwAspect=%RU32\n",
+                         i, pFormatEtc[i].cfFormat, UIDnDDataObject::ClipboardFormatToString(pFormatEtc[i].cfFormat),
+                         pFormatEtc[i].tymed, pFormatEtc[i].dwAspect));
+            UIDnDEnumFormatEtc::CopyFormat(&m_pFormatEtc[i], &pFormatEtc[i]);
+        }
+
+        m_nNumFormats = cFormats;
+        hr = S_OK;
+    }
+    catch (std::bad_alloc &)
+    {
+        hr = E_OUTOFMEMORY;
+    }
+
+    LogFlowFunc(("hr=%Rhrc\n", hr));
+}
+
+UIDnDEnumFormatEtc::~UIDnDEnumFormatEtc(void)
+{
+    if (m_pFormatEtc)
+    {
+        for (ULONG i = 0; i < m_nNumFormats; i++)
+        {
+            if(m_pFormatEtc[i].ptd)
+                CoTaskMemFree(m_pFormatEtc[i].ptd);
+        }
+
+        delete[] m_pFormatEtc;
+        m_pFormatEtc = NULL;
+    }
+
+    LogFlowFunc(("m_lRefCount=%RI32\n", m_lRefCount));
+}
+
+/*
+ * IUnknown methods.
+ */
+
+STDMETHODIMP_(ULONG) UIDnDEnumFormatEtc::AddRef(void)
+{
+    return InterlockedIncrement(&m_lRefCount);
+}
+
+STDMETHODIMP_(ULONG) UIDnDEnumFormatEtc::Release(void)
+{
+    LONG lCount = InterlockedDecrement(&m_lRefCount);
+    if (lCount == 0)
+    {
+        delete this;
+        return 0;
+    }
+
+    return lCount;
+}
+
+STDMETHODIMP UIDnDEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject)
+{
+    if (   iid == IID_IEnumFORMATETC
+        || iid == IID_IUnknown)
+    {
+        AddRef();
+        *ppvObject = this;
+        return S_OK;
+    }
+
+    *ppvObject = 0;
+    return E_NOINTERFACE;
+}
+
+STDMETHODIMP UIDnDEnumFormatEtc::Next(ULONG cFormats, FORMATETC *pFormatEtc, ULONG *pcFetched)
+{
+    ULONG ulCopied  = 0;
+
+    if(cFormats == 0 || pFormatEtc == 0)
+        return E_INVALIDARG;
+
+    while (   m_nIndex < m_nNumFormats
+           && ulCopied < cFormats)
+    {
+        UIDnDEnumFormatEtc::CopyFormat(&pFormatEtc[ulCopied],
+                                         &m_pFormatEtc[m_nIndex]);
+        ulCopied++;
+        m_nIndex++;
+    }
+
+    if (pcFetched)
+        *pcFetched = ulCopied;
+
+    return (ulCopied == cFormats) ? S_OK : S_FALSE;
+}
+
+STDMETHODIMP UIDnDEnumFormatEtc::Skip(ULONG cFormats)
+{
+    m_nIndex += cFormats;
+    return (m_nIndex <= m_nNumFormats) ? S_OK : S_FALSE;
+}
+
+STDMETHODIMP UIDnDEnumFormatEtc::Reset(void)
+{
+    m_nIndex = 0;
+    return S_OK;
+}
+
+STDMETHODIMP UIDnDEnumFormatEtc::Clone(IEnumFORMATETC **ppEnumFormatEtc)
+{
+    HRESULT hResult =
+        CreateEnumFormatEtc(m_nNumFormats, m_pFormatEtc, ppEnumFormatEtc);
+
+    if (hResult == S_OK)
+        ((UIDnDEnumFormatEtc *) *ppEnumFormatEtc)->m_nIndex = m_nIndex;
+
+    return hResult;
+}
+
+/* static */
+void UIDnDEnumFormatEtc::CopyFormat(FORMATETC *pDest, FORMATETC *pSource)
+{
+    AssertPtrReturnVoid(pDest);
+    AssertPtrReturnVoid(pSource);
+
+    *pDest = *pSource;
+
+    if (pSource->ptd)
+    {
+        pDest->ptd = (DVTARGETDEVICE*)CoTaskMemAlloc(sizeof(DVTARGETDEVICE));
+        *(pDest->ptd) = *(pSource->ptd);
+    }
+}
+
+/* static */
+HRESULT UIDnDEnumFormatEtc::CreateEnumFormatEtc(UINT nNumFormats, FORMATETC *pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc)
+{
+    AssertPtrReturn(pFormatEtc, E_INVALIDARG);
+    AssertPtrReturn(ppEnumFormatEtc, E_INVALIDARG);
+
+    HRESULT hr;
+    try
+    {
+        *ppEnumFormatEtc = new UIDnDEnumFormatEtc(pFormatEtc, nNumFormats);
+        hr = S_OK;
+    }
+    catch(std::bad_alloc &)
+    {
+        hr = E_OUTOFMEMORY;
+    }
+
+    return hr;
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDEnumFormat_win.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDEnumFormat_win.h
new file mode 100644
index 0000000..446a2ea
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDEnumFormat_win.h
@@ -0,0 +1,54 @@
+/* $Id: UIDnDEnumFormat_win.h $ */
+/** @file
+ * VBox Qt GUI - UIDnDEnumFormat class declaration.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIDnDEnumFormat_win_h___
+#define ___UIDnDEnumFormat_win_h___
+
+
+class UIDnDEnumFormatEtc : public IEnumFORMATETC
+{
+public:
+
+    UIDnDEnumFormatEtc(FORMATETC *pFormatEtc, ULONG cFormats);
+    virtual ~UIDnDEnumFormatEtc(void);
+
+public:
+
+    STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject);
+    STDMETHOD_(ULONG, AddRef)(void);
+    STDMETHOD_(ULONG, Release)(void);
+
+    STDMETHOD(Next)(ULONG cFormats, FORMATETC *pFormatEtc, ULONG *pcFetched);
+    STDMETHOD(Skip)(ULONG cFormats);
+    STDMETHOD(Reset)(void);
+    STDMETHOD(Clone)(IEnumFORMATETC ** ppEnumFormatEtc);
+
+public:
+
+    static void CopyFormat(FORMATETC *pFormatDest, FORMATETC *pFormatSource);
+    static HRESULT CreateEnumFormatEtc(UINT cFormats, FORMATETC *pFormatEtc, IEnumFORMATETC **ppEnumFormatEtc);
+
+private:
+
+    LONG        m_lRefCount;
+    ULONG       m_nIndex;
+    ULONG       m_nNumFormats;
+    FORMATETC * m_pFormatEtc;
+};
+
+#endif /* ___UIDnDEnumFormat_win_h___ */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp
index 6cce248..0888f10 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIDnDHandler.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDnDHandler class implementation
+ * VBox Qt GUI - UIDnDHandler class implementation.
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,331 +15,581 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
 #include <QApplication>
 #include <QKeyEvent>
-#include <QMimeData>
 #include <QStringList>
 #include <QTimer>
+#include <QUrl>
+
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
 
 /* GUI includes: */
-#include "UIDnDHandler.h"
+# include "UIDnDHandler.h"
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+# include "CDnDSource.h"
+# ifdef RT_OS_WINDOWS
+#  include "UIDnDDataObject_win.h"
+#  include "UIDnDDropSource_win.h"
+# endif
+# include "UIDnDMIMEData.h"
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
 #include "UIMessageCenter.h"
+#include "UISession.h"
 
 /* COM includes: */
-#include "CSession.h"
-#include "CConsole.h"
-#include "CGuest.h"
-
-UIDnDHandler *UIDnDHandler::m_pInstance = 0;
+# include "CConsole.h"
+# include "CGuest.h"
+# include "CGuestDnDSource.h"
+# include "CGuestDnDTarget.h"
+# include "CSession.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+
+UIDnDHandler::UIDnDHandler(UISession *pSession, QWidget *pParent)
+    : m_pSession(pSession)
+    , m_pParent(pParent)
+    , m_enmMode(DNDMODE_UNKNOWN)
+    , m_fIsPending(false)
+#ifndef RT_OS_WINDOWS
+    , m_pMIMEData(NULL)
+#endif
+{
+    AssertPtr(pSession);
+    m_dndSource = static_cast<CDnDSource>(pSession->guest().GetDnDSource());
+    m_dndTarget = static_cast<CDnDTarget>(pSession->guest().GetDnDTarget());
+}
 
-UIDnDHandler::UIDnDHandler()
+UIDnDHandler::~UIDnDHandler(void)
 {
 }
 
 /*
- * Host -> Guest
+ * Frontend -> Target.
  */
 
-Qt::DropAction UIDnDHandler::dragHGEnter(CGuest &guest, ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData, QWidget * /* pParent = 0 */)
+Qt::DropAction UIDnDHandler::dragEnter(ulong screenID, int x, int y,
+                                       Qt::DropAction proposedAction, Qt::DropActions possibleActions,
+                                       const QMimeData *pMimeData)
 {
+    LogFlowFunc(("enmMode=%RU32, screenID=%RU32, x=%d, y=%d, action=%ld\n",
+                 m_enmMode, screenID, x, y, toVBoxDnDAction(proposedAction)));
+
+    if (   m_enmMode != DNDMODE_UNKNOWN
+        && m_enmMode != DNDMODE_HOSTTOGUEST)
+        return Qt::IgnoreAction;
+
     /* Ask the guest for starting a DnD event. */
-    KDragAndDropAction result = guest.DragHGEnter(screenId,
-                                                  x,
-                                                  y,
-                                                  toVBoxDnDAction(proposedAction),
-                                                  toVBoxDnDActions(possibleActions),
-                                                  pMimeData->formats().toVector());
+    KDnDAction result = m_dndTarget.Enter(screenID,
+                                          x,
+                                          y,
+                                          toVBoxDnDAction(proposedAction),
+                                          toVBoxDnDActions(possibleActions),
+                                          pMimeData->formats().toVector());
+    if (m_dndTarget.isOk())
+        m_enmMode = DNDMODE_HOSTTOGUEST;
+
     /* Set the DnD action returned by the guest. */
     return toQtDnDAction(result);
 }
 
-Qt::DropAction UIDnDHandler::dragHGMove(CGuest &guest, ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData, QWidget * /* pParent = 0 */)
+Qt::DropAction UIDnDHandler::dragMove(ulong screenID, int x, int y,
+                                      Qt::DropAction proposedAction, Qt::DropActions possibleActions,
+                                      const QMimeData *pMimeData)
 {
-    /* Ask the guest for starting a DnD event. */
-    KDragAndDropAction result = guest.DragHGMove(screenId,
-                                                 x,
-                                                 y,
-                                                 toVBoxDnDAction(proposedAction),
-                                                 toVBoxDnDActions(possibleActions),
-                                                 pMimeData->formats().toVector());
+    LogFlowFunc(("enmMode=%RU32, screenID=%RU32, x=%d, y=%d, action=%ld\n",
+                 m_enmMode, screenID, x, y, toVBoxDnDAction(proposedAction)));
+
+    if (m_enmMode != DNDMODE_HOSTTOGUEST)
+        return Qt::IgnoreAction;
+
+    /* Notify the guest that the mouse has been moved while doing
+     * a drag'n drop operation. */
+    KDnDAction result = m_dndTarget.Move(screenID,
+                                         x,
+                                         y,
+                                         toVBoxDnDAction(proposedAction),
+                                         toVBoxDnDActions(possibleActions),
+                                         pMimeData->formats().toVector());
     /* Set the DnD action returned by the guest. */
     return toQtDnDAction(result);
 }
 
-Qt::DropAction UIDnDHandler::dragHGDrop(CGuest &guest, ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData, QWidget *pParent /* = 0 */)
+Qt::DropAction UIDnDHandler::dragDrop(ulong screenID, int x, int y,
+                                      Qt::DropAction proposedAction, Qt::DropActions possibleActions,
+                                      const QMimeData *pMimeData)
 {
+    LogFlowFunc(("enmMode=%RU32, screenID=%RU32, x=%d, y=%d, action=%ld\n",
+                 m_enmMode, screenID, x, y, toVBoxDnDAction(proposedAction)));
+
+    if (m_enmMode != DNDMODE_HOSTTOGUEST)
+        return Qt::IgnoreAction;
+
     /* The format the guest requests. */
     QString format;
     /* Ask the guest for dropping data. */
-    KDragAndDropAction result = guest.DragHGDrop(screenId,
-                                                 x,
-                                                 y,
-                                                 toVBoxDnDAction(proposedAction),
-                                                 toVBoxDnDActions(possibleActions),
-                                                 pMimeData->formats().toVector(), format);
+    KDnDAction result = m_dndTarget.Drop(screenID,
+                                         x,
+                                         y,
+                                         toVBoxDnDAction(proposedAction),
+                                         toVBoxDnDActions(possibleActions),
+                                         pMimeData->formats().toVector(), format);
+
     /* Has the guest accepted the drop event? */
-    if (result != KDragAndDropAction_Ignore)
+    if (   m_dndTarget.isOk()
+        && result != KDnDAction_Ignore)
     {
-        /* Get the actually data */
+        /* Get the actual MIME data in the requested format. */
+        AssertPtr(pMimeData);
         const QByteArray &d = pMimeData->data(format);
         if (   !d.isEmpty()
             && !format.isEmpty())
         {
-            /* We need the data in the vector format. */
+            /* Convert the actual MIME data to a vector (needed for the COM wrapper). */
             QVector<uint8_t> dv(d.size());
             memcpy(dv.data(), d.constData(), d.size());
 
-            CProgress progress = guest.DragHGPutData(screenId, format, dv);
-            if (guest.isOk())
+            CProgress progress = m_dndTarget.SendData(screenID, format, dv);
+
+            if (m_dndTarget.isOk())
             {
-                msgCenter().showModalProgressDialog(progress, tr("Dropping data ..."), ":/progress_dnd_hg_90px.png", pParent);
-                if (!progress.GetCanceled() && (!progress.isOk() || progress.GetResultCode() != 0))
+                LogFlowFunc(("Transferring data to guest ...\n"));
+
+                msgCenter().showModalProgressDialog(progress,
+                                                    tr("Dropping data ..."), ":/progress_dnd_hg_90px.png",
+                                                    m_pParent);
+
+                LogFlowFunc(("Transfer fCompleted=%RTbool, fCanceled=%RTbool, hr=%Rhrc\n",
+                             progress.GetCompleted(), progress.GetCanceled(), progress.GetResultCode()));
+
+                BOOL fCanceled = progress.GetCanceled();
+                if (   !fCanceled
+                    && (   !progress.isOk()
+                        ||  progress.GetResultCode() != 0))
                 {
-                    msgCenter().cannotDropData(progress, pParent);
-                    result = KDragAndDropAction_Ignore;
+                    msgCenter().cannotDropDataToGuest(progress, m_pParent);
+                    result = KDnDAction_Ignore;
                 }
             }
             else
             {
-                msgCenter().cannotDropData(guest, pParent);
-                result = KDragAndDropAction_Ignore;
+                msgCenter().cannotDropDataToGuest(m_dndTarget, m_pParent);
+                result = KDnDAction_Ignore;
             }
         }
     }
 
+    /*
+     * Since the mouse button has been release this in any case marks 
+     * the end of the current transfer direction. So reset the current 
+     * mode as well here. 
+     */ 
+    m_enmMode = DNDMODE_UNKNOWN;
+
     return toQtDnDAction(result);
 }
 
-void UIDnDHandler::dragHGLeave(CGuest &guest, ulong screenId, QWidget * /* pParent = 0 */)
+void UIDnDHandler::dragLeave(ulong screenID)
 {
-    guest.DragHGLeave(screenId);
+    LogFlowFunc(("enmMode=%RU32, screenID=%RU32\n", m_enmMode, screenID));
+
+    if (m_enmMode == DNDMODE_HOSTTOGUEST)
+    {
+        m_dndTarget.Leave(screenID);
+        m_enmMode = DNDMODE_UNKNOWN;
+    }
 }
 
 /*
- * Guest -> Host
+ * Source -> Frontend.
  */
 
-class UIDnDMimeData: public QMimeData
+int UIDnDHandler::dragStart(const QStringList &lstFormats,
+                            Qt::DropAction defAction, Qt::DropActions actions)
 {
-    Q_OBJECT;
+    int rc = VINF_SUCCESS;
 
-    enum State
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+
+    m_lstFormats = lstFormats;
+    m_defAction  = defAction;
+    m_actions    = actions;
+
+    LogFlowFunc(("m_defAction=0x%x\n", m_defAction));
+    LogFlowFunc(("Number of formats: %d\n", m_lstFormats.size()));
+# ifdef DEBUG
+    for (int i = 0; i < m_lstFormats.size(); i++)
+        LogFlowFunc(("\tFormat %d: %s\n", i, m_lstFormats.at(i).toAscii().constData()));
+# endif
+
+# ifdef RT_OS_WINDOWS
+
+    UIDnDDropSource *pDropSource = new UIDnDDropSource(m_pParent);
+    if (!pDropSource)
+        return VERR_NO_MEMORY;
+    UIDnDDataObject *pDataObject = new UIDnDDataObject(this, m_lstFormats);
+    if (!pDataObject)
+        return VERR_NO_MEMORY;
+
+    DWORD dwOKEffects = DROPEFFECT_NONE;
+    if (m_actions)
     {
-        Dragging,
-        Dropped,
-        Finished,
-        Canceled
-    };
-
-public:
-    UIDnDMimeData(CSession &session, QStringList formats, Qt::DropAction defAction, Qt::DropActions actions, QWidget *pParent)
-      : m_pParent(pParent)
-      , m_session(session)
-      , m_formats(formats)
-      , m_defAction(defAction)
-      , m_actions(actions)
-      , m_fState(Dragging)
+        if (m_actions & Qt::CopyAction)
+            dwOKEffects |= DROPEFFECT_COPY;
+        if (m_actions & Qt::MoveAction)
+            dwOKEffects |= DROPEFFECT_MOVE;
+        if (m_actions & Qt::LinkAction)
+            dwOKEffects |= DROPEFFECT_LINK;
+    }
+
+    DWORD dwEffect;
+    LogRel3(("DnD: dwOKEffects=0x%x\n", dwOKEffects));
+    HRESULT hr = ::DoDragDrop(pDataObject, pDropSource, dwOKEffects, &dwEffect);
+    LogRel3(("DnD: DoDragDrop ended with hr=%Rhrc, dwEffect=%RI32\n", hr, dwEffect));
+
+    if (pDropSource)
+        pDropSource->Release();
+    if (pDataObject)
+        pDataObject->Release();
+
+# else /* !RT_OS_WINDOWS */
+
+    QDrag *pDrag = new QDrag(m_pParent);
+    if (!pDrag)
+        return VERR_NO_MEMORY;
+
+    /* Note: pMData is transferred to the QDrag object, so no need for deletion. */
+    m_pMIMEData = new UIDnDMIMEData(this, m_lstFormats, m_defAction, m_actions);
+    if (!m_pMIMEData)
+    {
+        delete pDrag;
+        return VERR_NO_MEMORY;
+    }
+
+    /* Inform the MIME data object of any changes in the current action. */
+    connect(pDrag, SIGNAL(actionChanged(Qt::DropAction)),
+            m_pMIMEData, SLOT(sltDropActionChanged(Qt::DropAction)));
+
+    /*
+     * Set MIME data object and start the (modal) drag'n drop operation on the host.
+     * This does not block Qt's event loop, however (on Windows it would).
+     */
+    pDrag->setMimeData(m_pMIMEData);
+    Qt::DropAction dropAction = pDrag->exec(m_actions, m_defAction);
+    LogRel3(("DnD: Ended with dropAction=%ld\n", UIDnDHandler::toVBoxDnDAction(dropAction)));
+
+    /* Note: The UIDnDMimeData object will not be not accessible here anymore,
+     *       since QDrag had its ownership and deleted it after the (blocking)
+     *       QDrag::exec() call. */
+
+    /* pDrag will be cleaned up by Qt automatically. */
+
+# endif /* !RT_OS_WINDOWS */
+
+#else /* VBOX_WITH_DRAG_AND_DROP_GH */
+
+    rc = VERR_NOT_SUPPORTED;
+
+#endif
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int UIDnDHandler::dragIsPending(ulong screenID)
+{
+    int rc;
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+
+    LogFlowFunc(("enmMode=%RU32, m_fIsPending=%RTbool, screenID=%RU32\n", m_enmMode, m_fIsPending, screenID));
+
+    {
+        QMutexLocker AutoReadLock(&m_ReadLock);
+
+        if (   m_enmMode != DNDMODE_UNKNOWN
+            && m_enmMode != DNDMODE_GUESTTOHOST) /* Wrong mode set? */
+            return VINF_SUCCESS;
+
+        if (m_fIsPending) /* Pendig operation is in progress. */
+            return VINF_SUCCESS;
+    }
+
+    QMutexLocker AutoWriteLock(&m_ReadLock);
+    m_fIsPending = true;
+    AutoWriteLock.unlock();
+
+    /**
+     * How this works: Source is asking the target if there is any DnD
+     * operation pending, when the mouse leaves the guest window. On
+     * return there is some info about a running DnD operation
+     * (or defaultAction is KDnDAction_Ignore if not). With
+     * this information we create a Qt QDrag object with our own QMimeType
+     * implementation and call exec.
+     *
+     * Note: This function *blocks* until the actual drag'n drop operation
+     *       has been finished (successfully or not)!
+     */
+    CGuest guest = m_pSession->guest();
+
+    QVector<QString> vecFmtGuest;
+    QVector<KDnDAction> vecActions;
+    KDnDAction defaultAction = m_dndSource.DragIsPending(screenID, vecFmtGuest, vecActions);
+    LogFlowFunc(("defaultAction=%d, numFormats=%d\n", defaultAction, vecFmtGuest.size()));
+
+    QStringList lstFmtNative;
+    if (defaultAction != KDnDAction_Ignore)
     {
-        /* This is unbelievable hacky, but I didn't found another way. Stupid
-         * Qt QDrag interface is so less verbose, that we in principle know
-         * nothing about what happens when the user drag something around. It
-         * is possible that the target request data (s. retrieveData) while the
-         * mouse button is still pressed. This isn't something we can support,
-         * cause it would mean transferring the data from the guest while the
-         * mouse is still moving (thing of a 2GB file ...). So the idea is to
-         * detect the mouse release event and only after this happened, allow
-         * data to be retrieved. Unfortunately the QDrag object eats all events
-         * while a drag is going on (see QDragManager in the Qt src's). So what
-         * we do, is installing an event filter after the QDrag::exec is called
-         * to be last in the event filter queue and therefore called before the
-         * one installed by the QDrag object.
+        /**
+         * Do guest -> host format conversion, if needed.
+         * On X11 this already maps to the Xdnd protocol.
+         ** @todo What about the MacOS Carbon Drag Manager? Needs testing.
          *
-         * Todo: test this on all supported platforms (X11 works) */
-        QTimer::singleShot(0, this, SLOT(sltInstallEventFilter()));
+         * See: https://www.iana.org/assignments/media-types/media-types.xhtml
+         */
+        LogRel3(("DnD: Number of guest formats: %d\n", vecFmtGuest.size()));
+        for (int i = 0; i < vecFmtGuest.size(); i++)
+        {
+            const QString &strFmtGuest = vecFmtGuest.at(i);
+            LogRel3(("\tFormat %d: %s\n", i, strFmtGuest.toAscii().constData()));
+# ifdef RT_OS_WINDOWS
+            /* CF_TEXT -> Regular text. */
+            if (   strFmtGuest.contains("text/plain", Qt::CaseInsensitive)
+                && !lstFmtNative.contains("text/plain"))
+            {
+                lstFmtNative << "text/plain";
+            }
+            /* CF_HDROP -> URI list. */
+            else if (   strFmtGuest.contains("text/uri-list", Qt::CaseInsensitive)
+                     && !lstFmtNative.contains("text/uri-list"))
+            {
+                lstFmtNative << "text/uri-list";
+            }
+# else /* RT_OS_WINDOWS */
+
+            /* On non-Windows just do a 1:1 mapping. */
+            lstFmtNative << strFmtGuest;
+#  ifdef RT_OS_MACOS
+            /** @todo Does the 1:1 format mapping apply on OS X? Needs testing! */
+#  endif
+
+# endif /* !RT_OS_WINDOWS */
+        }
+
+        LogRel3(("DnD: Number of native formats: %d\n", lstFmtNative.size()));
+        for (int i = 0; i < lstFmtNative.size(); i++)
+            LogRel3(("\tFormat %d: %s\n", i, lstFmtNative.at(i).toAscii().constData()));
+    }
+
+    if (!lstFmtNative.isEmpty())
+    {
+        rc = dragStart(lstFmtNative,
+                       toQtDnDAction(defaultAction), toQtDnDActions(vecActions));
     }
+    else /* No format data from the guest arrived yet. */
+        rc = VERR_NO_DATA;
 
-    virtual QStringList formats() const { return m_formats; }
-    virtual bool hasFormat(const QString &mimeType) const { return m_formats.contains(mimeType); }
+    AutoWriteLock.relock();
+    m_fIsPending = false;
+    AutoWriteLock.unlock();
 
-public slots:
-    void sltActionChanged(Qt::DropAction action) { m_defAction = action; }
+#else /* !VBOX_WITH_DRAG_AND_DROP_GH */
 
-protected:
-    virtual QVariant retrieveData(const QString &mimeType, QVariant::Type type) const
+    NOREF(screenID);
+
+    rc = VERR_NOT_SUPPORTED;
+
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/**
+ * Called by UIDnDMIMEData (Linux, OS X, Solaris) or UIDnDDataObject (Windows)
+ * to start retrieving the actual data from the guest. This function will block
+ * and show a modal progress dialog until the data transfer is complete.
+ *
+ * @return IPRT return code.
+ * @param dropAction            Drop action to perform.
+ * @param strMimeType           MIME data type.
+ * @param vaType                Qt's variant type of the MIME data.
+ * @param vaData                The actual MIME data.
+ * @param pParent               Pointer to parent widget.
+ */
+int UIDnDHandler::retrieveData(      Qt::DropAction  dropAction,
+                               const QString        &strMimeType,
+                                     QVariant::Type  vaType,
+                                     QVariant       &vaData)
+{
+    LogFlowFunc(("Retrieving data as type=%s (variant type=%ld)\n",
+                 strMimeType.toAscii().constData(), vaType));
+
+    int rc = VINF_SUCCESS;
+
+    /* Start getting the data from the source. Request and transfer data
+     * from the source and display a modal progress dialog while doing this. */
+    Assert(!m_dndSource.isNull());
+    CProgress progress = m_dndSource.Drop(strMimeType,
+                                          UIDnDHandler::toVBoxDnDAction(dropAction));
+    if (m_dndSource.isOk())
     {
-        /* Mouse button released? */
-        if (m_fState != Dropped)
-            return m_data;
-
-        /* Supported types. See below in the switch statement. */
-        if (!(   type == QVariant::String
-              || type == QVariant::ByteArray))
-            return QVariant();
-
-        CGuest guest = m_session.GetConsole().GetGuest();
-        /* No, start getting the data from the guest. First inform the guest we
-         * want the data in the specified mime-type. */
-        CProgress progress = guest.DragGHDropped(mimeType, UIDnDHandler::toVBoxDnDAction(m_defAction));
-        if (guest.isOk())
+        msgCenter().showModalProgressDialog(progress,
+                                            tr("Retrieving data ..."), ":/progress_dnd_gh_90px.png",
+                                            m_pParent);
+
+        LogFlowFunc(("fCanceled=%RTbool, fCompleted=%RTbool, isOk=%RTbool, hrc=%Rhrc\n",
+                     progress.GetCanceled(), progress.GetCompleted(), progress.isOk(), progress.GetResultCode()));
+
+        if (!progress.GetCanceled())
         {
-            msgCenter().showModalProgressDialog(progress, tr("Dropping data ..."), ":/progress_dnd_gh_90px.png", m_pParent);
-            if (!progress.GetCanceled())
+            rc =   (   progress.isOk()
+                    && progress.GetResultCode() == 0)
+                 ? VINF_SUCCESS : VERR_GENERAL_FAILURE; /** @todo Fudge; do a GetResultCode() to rc translation. */
+
+            if (RT_SUCCESS(rc))
             {
-                if (progress.isOk() && progress.GetResultCode() == 0)
+                /* After we successfully retrieved data from the source we query it from Main. */
+                QVector<uint8_t> vecData = m_dndSource.ReceiveData();
+                if (!vecData.isEmpty())
                 {
-                    /* After the data is successfully arrived from the guest, we query it from Main. */
-                    QVector<uint8_t> data = guest.DragGHGetData();
-                    if (!data.isEmpty())
+                    switch (vaType)
                     {
-                        /* Todo: not sure what to add here more: needs more testing. */
-                        switch (type)
+                        case QVariant::String:
                         {
-                            case QVariant::String:
-                            {
-                                m_data = QVariant(QString(reinterpret_cast<const char*>(data.data())));
-                                break;
-                            }
-                            case QVariant::ByteArray:
-                            {
-                                QByteArray ba(reinterpret_cast<const char*>(data.constData()), data.size());
-                                m_data = QVariant(ba);
-                                break;
-                            }
-                            default: break;
+                            vaData = QVariant(QString(reinterpret_cast<const char*>(vecData.constData())));
+                            break;
                         }
+
+                        case QVariant::ByteArray:
+                        {
+                            QByteArray ba(reinterpret_cast<const char*>(vecData.constData()), vecData.size());
+                            vaData = QVariant(ba);
+                            break;
+                        }
+
+                        case QVariant::StringList:
+                        {
+                            QString strData = QString(reinterpret_cast<const char*>(vecData.constData()));
+                            QStringList lstString = strData.split("\r\n", QString::SkipEmptyParts);
+
+                            vaData = QVariant(lstString);
+                            break;
+                        }
+
+                        default:
+                            rc = VERR_NOT_SUPPORTED;
+                            break;
                     }
-                    m_fState = Finished;
                 }
                 else
-                    msgCenter().cannotDropData(progress, m_pParent);
+                    rc = VERR_NO_DATA;
             }
             else
-                m_fState = Canceled;
+                msgCenter().cannotDropDataToHost(progress, m_pParent);
         }
-        else
-            msgCenter().cannotDropData(guest, m_pParent);
-        return m_data;
+        else /* Don't pop up a message. */
+            rc = VERR_CANCELLED;
     }
-
-    bool eventFilter(QObject * /* pObject */, QEvent *pEvent)
+    else
     {
-        switch (pEvent->type())
-        {
-            case QEvent::MouseButtonRelease: m_fState = Dropped; break;
-            case QEvent::KeyPress:
-            {
-                if (static_cast<QKeyEvent*>(pEvent)->key() == Qt::Key_Escape)
-                    m_fState = Canceled;
-                break;
-            }
-        }
-
-        /* Propagate the event further. */
-        return false;
+        msgCenter().cannotDropDataToHost(m_dndSource, m_pParent);
+        rc = VERR_GENERAL_FAILURE; /** @todo Fudge; do a GetResultCode() to rc translation. */
     }
 
-private slots:
-    void sltInstallEventFilter() { qApp->installEventFilter(this); }
-
-private:
-    /* Private members. */
-    QWidget          *m_pParent;
-    CSession          m_session;
-    QStringList       m_formats;
-    Qt::DropAction    m_defAction;
-    Qt::DropActions   m_actions;
-    mutable State     m_fState;
-    mutable QVariant  m_data;
-};
-
-void UIDnDHandler::dragGHPending(CSession &session, ulong screenId, QWidget *pParent /* = 0 */)
-{
-    /* How does this work: Host is asking the guest if there is any DnD
-     * operation pending, when the mouse leaves the guest window
-     * (DragGHPending). On return there is some info about a running DnD
-     * operation (or defaultAction is KDragAndDropAction_Ignore if not). With
-     * this information we create a Qt QDrag object with our own QMimeType
-     * implementation and call exec. Please note, this *blocks* until the DnD
-     * operation has finished. */
-    CGuest guest = session.GetConsole().GetGuest();
-    QVector<QString> formats;
-    QVector<KDragAndDropAction> actions;
-    KDragAndDropAction defaultAction = guest.DragGHPending(screenId, formats, actions);
-
-    if (    defaultAction != KDragAndDropAction_Ignore
-        && !formats.isEmpty())
-    {
-        QDrag *pDrag = new QDrag(pParent);
-        /* pMData is transfered to the QDrag object, so no need for deletion. */
-        UIDnDMimeData *pMData = new UIDnDMimeData(session, formats.toList(), toQtDnDAction(defaultAction), toQtDnDActions(actions), pParent);
-        /* Inform the mime data object of any changes in the current action. */
-        connect(pDrag, SIGNAL(actionChanged(Qt::DropAction)),
-                pMData, SLOT(sltActionChanged(Qt::DropAction)));
-        pDrag->setMimeData(pMData);
-        /* Fire it up. */
-        pDrag->exec(toQtDnDActions(actions), toQtDnDAction(defaultAction));
-    }
+    LogFlowFuncLeaveRC(rc);
+    return rc;
 }
 
 /*
  * Drag and Drop helper methods
  */
 
-KDragAndDropAction UIDnDHandler::toVBoxDnDAction(Qt::DropAction action)
+/* static */
+KDnDAction UIDnDHandler::toVBoxDnDAction(Qt::DropAction action)
 {
     if (action == Qt::CopyAction)
-        return KDragAndDropAction_Copy;
+        return KDnDAction_Copy;
     if (action == Qt::MoveAction)
-        return KDragAndDropAction_Move;
+        return KDnDAction_Move;
     if (action == Qt::LinkAction)
-        return KDragAndDropAction_Link;
+        return KDnDAction_Link;
 
-    return KDragAndDropAction_Ignore;
+    return KDnDAction_Ignore;
 }
 
-QVector<KDragAndDropAction> UIDnDHandler::toVBoxDnDActions(Qt::DropActions actions)
+/* static */
+QVector<KDnDAction> UIDnDHandler::toVBoxDnDActions(Qt::DropActions actions)
 {
-    QVector<KDragAndDropAction> vbActions;
+    QVector<KDnDAction> vbActions;
     if (actions.testFlag(Qt::IgnoreAction))
-        vbActions << KDragAndDropAction_Ignore;
+        vbActions << KDnDAction_Ignore;
     if (actions.testFlag(Qt::CopyAction))
-        vbActions << KDragAndDropAction_Copy;
+        vbActions << KDnDAction_Copy;
     if (actions.testFlag(Qt::MoveAction))
-        vbActions << KDragAndDropAction_Move;
+        vbActions << KDnDAction_Move;
     if (actions.testFlag(Qt::LinkAction))
-        vbActions << KDragAndDropAction_Link;
+        vbActions << KDnDAction_Link;
 
     return vbActions;
 }
 
-Qt::DropAction UIDnDHandler::toQtDnDAction(KDragAndDropAction action)
+/* static */
+Qt::DropAction UIDnDHandler::toQtDnDAction(KDnDAction action)
 {
-    if (action == KDragAndDropAction_Copy)
-        return Qt::CopyAction;
-    if (action == KDragAndDropAction_Move)
-        return Qt::MoveAction;
-    if (action == KDragAndDropAction_Link)
-        return Qt::LinkAction;
-
-    return Qt::IgnoreAction;
+    Qt::DropAction dropAct = Qt::IgnoreAction;
+    if (action == KDnDAction_Copy)
+        dropAct = Qt::CopyAction;
+    if (action == KDnDAction_Move)
+        dropAct = Qt::MoveAction;
+    if (action == KDnDAction_Link)
+        dropAct = Qt::LinkAction;
+
+    LogFlowFunc(("dropAct=0x%x\n", dropAct));
+    return dropAct;
 }
 
-Qt::DropActions UIDnDHandler::toQtDnDActions(const QVector<KDragAndDropAction> &actions)
+/* static */
+Qt::DropActions UIDnDHandler::toQtDnDActions(const QVector<KDnDAction> &vecActions)
 {
-    Qt::DropActions a = 0;
-    for (int i = 0; i < actions.size(); ++i)
+    Qt::DropActions dropActs = Qt::IgnoreAction;
+    for (int i = 0; i < vecActions.size(); i++)
     {
-        switch (actions.at(i))
+        switch (vecActions.at(i))
         {
-            case KDragAndDropAction_Ignore: a |= Qt::IgnoreAction; break;
-            case KDragAndDropAction_Copy:   a |= Qt::CopyAction; break;
-            case KDragAndDropAction_Move:   a |= Qt::MoveAction; break;
-            case KDragAndDropAction_Link:   a |= Qt::LinkAction; break;
+            case KDnDAction_Ignore:
+                dropActs |= Qt::IgnoreAction;
+                break;
+            case KDnDAction_Copy:
+                dropActs |= Qt::CopyAction;
+                break;
+            case KDnDAction_Move:
+                dropActs |= Qt::MoveAction;
+                break;
+            case KDnDAction_Link:
+                dropActs |= Qt::LinkAction;
+                break;
+            default:
+                break;
         }
     }
-    return a;
-}
 
-#include "UIDnDHandler.moc"
+    LogFlowFunc(("dropActions=0x%x\n", int(dropActs)));
+    return dropActs;
+}
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.h
index 0a34bf5..a3b84fc 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.h
@@ -1,11 +1,10 @@
+/* $Id: UIDnDHandler.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIDnDHandler class declaration
+ * VBox Qt GUI - UIDnDHandler class declaration..
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,52 +18,96 @@
 #ifndef ___UIDnDHandler_h___
 #define ___UIDnDHandler_h___
 
+/* Qt includes: */
+#include <QMimeData>
+#include <QMutex>
+#include <QStringList>
+
 /* COM includes: */
 #include "COMEnums.h"
+#include "CDnDTarget.h"
+#include "CDnDSource.h"
 
 /* Forward declarations: */
 class QMimeData;
-class CSession;
-class CGuest;
 
-/* Todo: check for making this a full static class when possible. */
+class UIDnDMIMEData;
+class UISession;
+
 class UIDnDHandler: public QObject
 {
+    Q_OBJECT;
+
 public:
-    /* Singleton */
-    static UIDnDHandler* instance()
+
+    UIDnDHandler(UISession *pSession, QWidget *pParent);
+    virtual ~UIDnDHandler(void);
+
+    /**
+     * Current operation mode.
+     */
+    typedef enum DNDMODE
     {
-        if (!m_pInstance)
-            m_pInstance = new UIDnDHandler();
-        return m_pInstance;
-    }
-    static void destroy() { delete m_pInstance; m_pInstance = 0; }
-
-    /* Host -> Guest */
-    Qt::DropAction dragHGEnter(CGuest &guest, ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData, QWidget *pParent = 0);
-    Qt::DropAction dragHGMove (CGuest &guest, ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData, QWidget *pParent = 0);
-    Qt::DropAction dragHGDrop (CGuest &guest, ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData, QWidget *pParent = 0);
-    void           dragHGLeave(CGuest &guest, ulong screenId, QWidget *pParent = 0);
-
-    /* Guest -> Host */
-    void           dragGHPending(CSession &session, ulong screenId, QWidget *pParent = 0);
-
-private:
-    static UIDnDHandler *m_pInstance;
-
-    UIDnDHandler();
-    ~UIDnDHandler() {}
-
-    /* Private helpers */
-    static KDragAndDropAction          toVBoxDnDAction(Qt::DropAction action);
-    static QVector<KDragAndDropAction> toVBoxDnDActions(Qt::DropActions actions);
-    static Qt::DropAction              toQtDnDAction(KDragAndDropAction action);
-    static Qt::DropActions             toQtDnDActions(const QVector<KDragAndDropAction> &actions);
-
-    friend class UIDnDMimeData;
-};
+        /** Unknown mode. */
+        DNDMODE_UNKNOWN     = 0,
+        /** Host to guest. */
+        DNDMODE_HOSTTOGUEST = 1,
+        /** Guest to host. */
+        DNDMODE_GUESTTOHOST = 2,
+        /** @todo Implement guest to guest. */
+        /** The usual 32-bit type blow up. */
+        DNDMODE_32BIT_HACK = 0x7fffffff
+    } DNDMODE;
+
+    /* Frontend -> Target. */
+    Qt::DropAction             dragEnter(ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData);
+    Qt::DropAction             dragMove (ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData);
+    Qt::DropAction             dragDrop (ulong screenId, int x, int y, Qt::DropAction proposedAction, Qt::DropActions possibleActions, const QMimeData *pMimeData);
+    void                       dragLeave(ulong screenId);
 
-#define gDnD UIDnDHandler::instance()
+    /* Source -> Frontend. */
+    int                        dragIsPending(ulong screenId);
+    int                        dragStart(const QStringList &lstFormats, Qt::DropAction defAction, Qt::DropActions actions);
+    int                        retrieveData(Qt::DropAction  dropAction, const QString &strMimeType, QVariant::Type vaType, QVariant &vaData);
 
+public:
+
+    static KDnDAction          toVBoxDnDAction(Qt::DropAction action);
+    static QVector<KDnDAction> toVBoxDnDActions(Qt::DropActions actions);
+    static Qt::DropAction      toQtDnDAction(KDnDAction action);
+    static Qt::DropActions     toQtDnDActions(const QVector<KDnDAction> &vecActions);
+
+protected:
+
+    /** Pointer to UI session. */
+    UISession        *m_pSession;
+    /** Pointer to parent widget. */
+    QWidget          *m_pParent;
+
+    /** Drag and drop source instance. */
+    CDnDSource        m_dndSource;
+    /** Drag and drop target instance. */
+    CDnDTarget        m_dndTarget;
+    /** Current transfer direction. */
+    DNDMODE           m_enmMode;
+    /** Flag indicating if a drag operation is pending currently. */
+    bool              m_fIsPending;
+    QMutex            m_ReadLock;
+    QMutex            m_WriteLock;
+
+    /** List of formats supported by the source. */
+    QStringList       m_lstFormats;
+    /** Default drop action from the source. */
+    Qt::DropAction    m_defAction;
+    /** List of allowed drop actions from the source. */
+    Qt::DropActions   m_actions;
+
+#ifndef RT_OS_WINDOWS
+    /** Pointer to MIMEData instance used for handling
+     *  own MIME times on non-Windows host OSes. */
+    UIDnDMIMEData    *m_pMIMEData;
+    friend class UIDnDMIMEData;
+#endif
+};
 #endif /* ___UIDnDHandler_h___ */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.cpp
new file mode 100644
index 0000000..e7282c2
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.cpp
@@ -0,0 +1,320 @@
+/* $Id: UIDnDMIMEData.cpp $ */
+/** @file
+ * VBox Qt GUI - UIDnDMIMEData class implementation.
+ */
+
+/*
+ * Copyright (C) 2011-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QApplication>
+# include <QFileInfo>
+# include <QKeyEvent>
+# include <QMimeData>
+# include <QStringList>
+# include <QTimer>
+# include <QUrl>
+
+/* GUI includes: */
+# include "UIDnDMIMEData.h"
+# include "UIMessageCenter.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#undef LOG_GROUP
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+
+UIDnDMIMEData::UIDnDMIMEData(UIDnDHandler *pDnDHandler,
+                             QStringList lstFormats, Qt::DropAction defAction, Qt::DropActions actions)
+    : m_pDnDHandler(pDnDHandler)
+    , m_lstFormats(lstFormats)
+    , m_defAction(defAction)
+    , m_actions(actions)
+    , m_enmState(Dragging)
+    , m_vaData(QVariant::Invalid)
+{
+    LogFlowThisFuncEnter();
+
+#ifdef DEBUG
+    LogFlowFunc(("Number of formats: %d\n", lstFormats.size()));
+    for (int i = 0; i < lstFormats.size(); i++)
+        LogFlowFunc(("\tFormat %d: %s\n", i, lstFormats.at(i).toAscii().constData()));
+#endif
+
+     /**
+     * This is unbelievable hacky, but I didn't find another way. Stupid
+     * Qt QDrag interface is so less verbose, that we in principle know
+     * nothing about what happens when the user drag something around. It
+     * is possible that the target on the host requests data
+     * (@sa retrieveData) while the mouse button still is pressed. This
+     * isn't something we should support, because it would mean transferring
+     * the data from the guest while the mouse is still moving (think of
+     * transferring a 2GB file from the guest to the host ...). So the idea is
+     * to detect the mouse release event and only after this happened, allow
+     * data to be retrieved. Unfortunately the QDrag object eats all events
+     * while a drag is going on (see QDragManager in the Qt src's).
+     *
+     * So what we now are going to do is installing an event filter after the
+     * QDrag::exec is called, so that this event filter then would be
+     * the last in the event filter queue and therefore called before the
+     * one installed by the QDrag object (which then in turn would
+     * munch all events).
+     *
+     ** @todo Test this on all supported platforms (X11 works).
+     *
+     * Note: On Windows the above hack is not needed because as soon as Qt calls
+     *       OLE's DoDragDrop routine internally (via QtDrag::exec), no mouse
+     *       events will come through anymore. At this point DoDragDrop is modal
+     *       and will take care of all the input handling. */
+#ifndef RT_OS_WINDOWS
+    /* Install the event filter in a deferred way. */
+    QTimer::singleShot(0, this, SLOT(sltInstallEventFilter()));
+#endif
+}
+
+QStringList UIDnDMIMEData::formats(void) const
+{
+    return m_lstFormats;
+}
+
+bool UIDnDMIMEData::hasFormat(const QString &strMIMEType) const
+{
+    bool fRc = m_lstFormats.contains(strMIMEType);
+    LogFlowFunc(("%s: %RTbool (QtMimeData: %RTbool)\n",
+                 strMIMEType.toStdString().c_str(), fRc, QMimeData::hasFormat(strMIMEType)));
+    return fRc;
+}
+
+/**
+ * Called by Qt's drag'n drop operation (QDrag) for retrieving the actual drag'n drop
+ * data in case of a successful drag'n drop operation.
+ *
+ * @param strMIMEType           MIME type string.
+ * @param vaType                Variant containing the actual data based on the the MIME type.
+ *
+ * @return QVariant
+ */
+QVariant UIDnDMIMEData::retrieveData(const QString &strMIMEType, QVariant::Type vaType) const
+{
+    LogFlowFunc(("state=%RU32, mimeType=%s, type=%d (%s)\n", m_enmState, strMIMEType.toStdString().c_str(),
+                 vaType, QVariant::typeToName(vaType)));
+
+    bool fCanDrop = true;
+
+#ifdef RT_OS_WINDOWS
+    /* On Windows this function will be called several times by Qt's
+     * OLE-specific internals to figure out which data formats we have
+     * to offer. So just assume we can drop data here for a start.* */
+    fCanDrop = true;
+#else
+    /* On non-Windows our state gets updated via an own event filter
+     * (see UIDnDMimeData::eventFilter). This filter will update the current
+     * operation state for us (based on the mouse buttons). */
+    if (m_enmState != Dropped)
+        fCanDrop = false;
+#endif
+
+    /* Do we support the requested MIME type? */
+    if (   fCanDrop
+        && !m_lstFormats.contains(strMIMEType))
+    {
+        LogRel3(("DnD: Unsupported MIME type=%s\n", strMIMEType.toStdString().c_str()));
+        fCanDrop = false;
+    }
+
+    /* Supported types. See below in the switch statement. */
+    if (   fCanDrop
+        && !(
+             /* Plain text. */
+                vaType == QVariant::String
+             /* Binary data. */
+             || vaType == QVariant::ByteArray
+             /* URI list. */
+             || vaType == QVariant::List))
+    {
+        LogRel3(("DnD: Unsupported data type=%d (%s)\n", vaType, QVariant::typeToName(vaType)));
+        fCanDrop = false;
+    }
+
+    LogRel3(("DnD: State=%ld, fCanDrop=%RTbool\n", m_enmState, fCanDrop));
+
+    if (!fCanDrop)
+    {
+        LogFlowFunc(("Skipping request, state=%RU32 ...\n", m_enmState));
+        return QMimeData::retrieveData(strMIMEType, vaType);
+    }
+
+    /* Note: The const_cast is used because this function needs to be const (otherwise
+     *       Qt won't call it), but we need the stuff in an unconst'ed way. */
+    int rc = const_cast<UIDnDMIMEData *>(this)->retrieveDataInternal(strMIMEType, vaType);
+
+    LogFlowFunc(("Returning rc=%Rrc, state=%RU32\n", rc, m_enmState));
+    return m_vaData;
+}
+
+#ifndef RT_OS_WINDOWS
+bool UIDnDMIMEData::eventFilter(QObject *pObject, QEvent *pEvent)
+{
+    bool fRemoveFilter = false;
+
+    if (pEvent)
+    {
+        switch (pEvent->type())
+        {
+            case QEvent::MouseMove:
+            {
+                QMouseEvent *pMouseEvent = (QMouseEvent*)(pEvent);
+                AssertPtr(pMouseEvent);
+                LogFlowFunc(("MouseMove: x=%d, y=%d\n", pMouseEvent->globalX(), pMouseEvent->globalY()));
+
+                break;
+            }
+
+            case QEvent::MouseButtonRelease:
+            {
+                LogFlowFunc(("MouseButtonRelease\n"));
+                m_enmState = Dropped;
+
+                fRemoveFilter = true;
+                break;
+            }
+
+            case QEvent::KeyPress:
+            {
+                /* ESC pressed? */
+                if (static_cast<QKeyEvent*>(pEvent)->key() == Qt::Key_Escape)
+                {
+                    LogRel2(("DnD: ESC pressed, cancelling drag and drop operation\n"));
+                    m_enmState = Canceled;
+
+                    fRemoveFilter = true;
+                }
+                break;
+            }
+
+            default:
+                break;
+        }
+    }
+
+    if (fRemoveFilter)
+    {
+        LogFlowFunc(("Removing event filter ...\n"));
+        AssertPtr(qApp);
+        qApp->removeEventFilter(this);
+    }
+
+    /* Do normal processing by Qt. */
+    return QObject::eventFilter(pObject, pEvent);
+}
+#endif /* !RT_OS_WINDOWS */
+
+int UIDnDMIMEData::setData(const QString &mimeType)
+{
+    LogFlowFunc(("mimeType=%s, dataType=%s\n",
+                 mimeType.toAscii().constData(), m_vaData.typeName()));
+
+    int rc = VINF_SUCCESS;
+
+    switch (m_vaData.type())
+    {
+        case QVariant::String: /* Plain text. */
+        {
+            QMimeData::setText(m_vaData.toString());
+            break;
+        }
+
+        case QVariant::ByteArray: /* Raw byte data. */
+        {
+            QMimeData::setData(mimeType, m_vaData.toByteArray());
+            break;
+        }
+
+        case QVariant::StringList: /* URI. */
+        {
+            QList<QVariant> lstData = m_vaData.toList();
+            QList<QUrl> lstURL;
+            for (int i = 0; i < lstData.size(); i++)
+            {
+                QFileInfo fileInfo(lstData.at(i).toString());
+
+                LogFlowFunc(("\tURL: %s (fExists=%RTbool, fIsDir=%RTbool, cb=%RU64)\n",
+                             fileInfo.absoluteFilePath().constData(), fileInfo.exists(),
+                             fileInfo.isDir(), fileInfo.size()));
+
+                lstURL << QUrl::fromLocalFile(fileInfo.absoluteFilePath());
+            }
+            LogFlowFunc(("Number of URLs: %d\n",  lstURL.size()));
+
+            if (RT_SUCCESS(rc))
+                QMimeData::setUrls(lstURL);
+            break;
+        }
+
+        default:
+            rc = VERR_NOT_SUPPORTED;
+            break;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int UIDnDMIMEData::retrieveDataInternal(const QString &strMIMEType, QVariant::Type vaType)
+{
+    LogFlowFunc(("state=%RU32, mimeType=%s, type=%d (%s)\n", m_enmState,
+                  strMIMEType.toStdString().c_str(), vaType, QVariant::typeToName(vaType)));
+
+    AssertPtr(m_pDnDHandler);
+    int rc = m_pDnDHandler->retrieveData(m_defAction, strMIMEType, vaType, m_vaData);
+    if (RT_SUCCESS(rc))
+    {
+        /* Nothing to do here yet. */
+    }
+    else if (rc == VERR_CANCELLED)
+        m_enmState = Canceled;
+    else
+        m_enmState = Error;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/**
+ * Issued by the QDrag object as soon as the current drop action has changed.
+ *
+ * @param dropAction            New drop action to use.
+ */
+void UIDnDMIMEData::sltDropActionChanged(Qt::DropAction dropAction)
+{
+    LogFlowFunc(("dropAction=0x%x\n", dropAction));
+    m_defAction = dropAction;
+}
+
+#ifndef RT_OS_WINDOWS
+/**
+ * Issued by ourselves to install the event filter.
+ */
+void UIDnDMIMEData::sltInstallEventFilter(void)
+{
+    LogFlowFunc(("Installing event filter ...\n"));
+    AssertPtr(qApp);
+    qApp->installEventFilter(this);
+}
+#endif
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.h
new file mode 100644
index 0000000..778a423
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDMIMEData.h
@@ -0,0 +1,108 @@
+/* $Id: UIDnDMIMEData.h $ */
+/** @file
+ * VBox Qt GUI - UIDnDMIMEData class declaration.
+ */
+
+/*
+ * Copyright (C) 2011-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIDnDMIMEData_h___
+#define ___UIDnDMIMEData_h___
+
+/* Qt includes: */
+#include <QMimeData>
+
+/* COM includes: */
+#include "COMEnums.h"
+#include "CConsole.h"
+#include "CDnDSource.h"
+#include "CGuest.h"
+#include "CSession.h"
+
+#include "UIDnDHandler.h"
+
+/** @todo Subclass QWindowsMime / QMacPasteboardMime
+ *  to register own/more MIME types. */
+
+/**
+ * Own implementation of QMimeData for starting and
+ * handling all guest-to-host transfers.
+ */
+class UIDnDMIMEData: public QMimeData
+{
+    Q_OBJECT;
+
+    enum State
+    {
+        /** Host is in dragging state, without
+         *  having retrieved the metadata from the guest yet. */
+        Dragging = 0,
+        /** There has been a "dropped" action which indicates
+         *  that the guest can continue sending more data (if any)
+         *  over to the host, based on the (MIME) metadata. */
+        Dropped,
+        /** The operation has been canceled. */
+        Canceled,
+        /** An error occurred. */
+        Error,
+        /** The usual 32-bit type blow up. */
+        State_32BIT_Hack = 0x7fffffff
+    };
+
+public:
+
+    UIDnDMIMEData(UIDnDHandler *pDnDHandler, QStringList formats, Qt::DropAction defAction, Qt::DropActions actions);
+
+public:
+
+    int setData(const QString &mimeType);
+
+public slots:
+
+    void sltDropActionChanged(Qt::DropAction dropAction);
+
+protected:
+    /** @name Overridden functions of QMimeData.
+     * @{ */
+    virtual QStringList formats(void) const;
+
+    virtual bool hasFormat(const QString &mimeType) const;
+
+    virtual QVariant retrieveData(const QString &mimeType, QVariant::Type type) const;
+
+#ifndef RT_OS_WINDOWS
+    bool eventFilter(QObject *pObject, QEvent *pEvent);
+#endif
+    /** @}  */
+
+    int retrieveDataInternal(const QString &strMIMEType, QVariant::Type vaType);
+
+protected slots:
+
+#ifndef RT_OS_WINDOWS
+    void sltInstallEventFilter(void);
+#endif
+
+protected:
+
+    UIDnDHandler     *m_pDnDHandler;
+
+    QStringList       m_lstFormats;
+    Qt::DropAction    m_defAction;
+    Qt::DropActions   m_actions;
+
+    mutable State     m_enmState;
+    mutable QVariant  m_vaData;
+};
+
+#endif /* ___UIDnDMIMEData_h___ */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
index e21bcc5..cbe3b11 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,49 +16,547 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
+/* Qt includes: */
+# include <QImage>
+# include <QRegion>
+# include <QPainter>
+# include <QTransform>
 /* GUI includes: */
-# include "UIMachineView.h"
 # include "UIFrameBuffer.h"
-# include "UIMessageCenter.h"
+# include "UISession.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindow.h"
+# include "UIMachineView.h"
+# include "UIPopupCenter.h"
+# include "UIExtraDataManager.h"
 # include "VBoxGlobal.h"
-# ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
+# ifdef VBOX_WITH_MASKED_SEAMLESS
 #  include "UIMachineWindow.h"
-# endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
-
-/* Other VBox includes: */
-# include <VBox/VBoxVideo3D.h>
-
+# endif /* VBOX_WITH_MASKED_SEAMLESS */
+# ifdef VBOX_WITH_VIDEOHWACCEL
+#  include "VBoxFBOverlay.h"
+# endif /* VBOX_WITH_VIDEOHWACCEL */
+/* COM includes: */
+# include "CConsole.h"
+# include "CDisplay.h"
+# include "CFramebuffer.h"
+# include "CDisplaySourceBitmap.h"
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-#if defined (Q_OS_WIN32)
-static CComModule _Module;
-#else
-NS_DECL_CLASSINFO (UIFrameBuffer)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI (UIFrameBuffer, IFramebuffer)
-#endif
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
+
+/* Other VBox includes: */
+#include <iprt/critsect.h>
+#include <VBox/VBoxVideo3D.h>
 
 #ifdef Q_WS_X11
+/* X11 includes: */
 # include <QX11Info>
 # include <X11/Xlib.h>
 #endif /* Q_WS_X11 */
 
-UIFrameBuffer::UIFrameBuffer(UIMachineView *pMachineView)
-    : m_pMachineView(pMachineView)
-    , m_width(0), m_height(0)
-    , m_fIsMarkedAsUnused(false)
-    , m_fIsAutoEnabled(false)
+
+/** IFramebuffer implementation used to maintain VM display video memory. */
+class ATL_NO_VTABLE UIFrameBufferPrivate : public QObject,
+                                           public CComObjectRootEx<CComMultiThreadModel>,
+                                           VBOX_SCRIPTABLE_IMPL(IFramebuffer)
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listener about guest-screen resolution changes. */
+    void sigNotifyChange(int iWidth, int iHeight);
+    /** Notifies listener about guest-screen updates. */
+    void sigNotifyUpdate(int iX, int iY, int iWidth, int iHeight);
+    /** Notifies listener about guest-screen visible-region changes. */
+    void sigSetVisibleRegion(QRegion region);
+    /** Notifies listener about guest 3D capability changes. */
+    void sigNotifyAbout3DOverlayVisibilityChange(bool fVisible);
+
+public:
+
+    /** Frame-buffer constructor. */
+    UIFrameBufferPrivate();
+    /** Frame-buffer destructor. */
+    ~UIFrameBufferPrivate();
+
+    /** Frame-buffer initialization.
+      * @param pMachineView defines machine-view this frame-buffer is bounded to. */
+    virtual HRESULT init(UIMachineView *pMachineView);
+
+    /** Assigns machine-view frame-buffer will be bounded to.
+      * @param pMachineView defines machine-view this frame-buffer is bounded to. */
+    virtual void setView(UIMachineView *pMachineView);
+
+    /** Returns the copy of the IDisplay wrapper. */
+    CDisplay display() const { return m_display; }
+    /** Attach frame-buffer to IDisplay. */
+    void attach();
+    /** Detach frame-buffer from IDisplay. */
+    void detach();
+
+    /** Returns frame-buffer data address. */
+    uchar *address() { return m_image.bits(); }
+    /** Returns frame-buffer width. */
+    ulong width() const { return m_iWidth; }
+    /** Returns frame-buffer height. */
+    ulong height() const { return m_iHeight; }
+    /** Returns frame-buffer bits-per-pixel value. */
+    ulong bitsPerPixel() const { return m_image.depth(); }
+    /** Returns frame-buffer bytes-per-line value. */
+    ulong bytesPerLine() const { return m_image.bytesPerLine(); }
+    /** Returns default frame-buffer pixel-format. */
+    ulong pixelFormat() const { return KBitmapFormat_BGR; }
+    /** Returns the visual-state this frame-buffer is used for. */
+    UIVisualStateType visualState() const { return m_pMachineView ? m_pMachineView->visualStateType() : UIVisualStateType_Invalid; }
+
+    /** Defines whether frame-buffer is <b>unused</b>.
+      * @note Refer to m_fUnused for more information.
+      * @note Calls to this and any other EMT callback are synchronized (from GUI side). */
+    void setMarkAsUnused(bool fUnused);
+
+    /** Returns whether frame-buffer is <b>auto-enabled</b>.
+      * @note Refer to m_fAutoEnabled for more information. */
+    bool isAutoEnabled() const { return m_fAutoEnabled; }
+    /** Defines whether frame-buffer is <b>auto-enabled</b>.
+      * @note Refer to m_fAutoEnabled for more information. */
+    void setAutoEnabled(bool fAutoEnabled) { m_fAutoEnabled = fAutoEnabled; }
+
+    /** Returns the frame-buffer's scaled-size. */
+    QSize scaledSize() const { return m_scaledSize; }
+    /** Defines host-to-guest scale ratio as @a size. */
+    void setScaledSize(const QSize &size = QSize()) { m_scaledSize = size; }
+    /** Returns x-origin of the host (scaled) content corresponding to x-origin of guest (actual) content. */
+    inline int convertGuestXTo(int x) const { return m_scaledSize.isValid() ? qRound((double)m_scaledSize.width() / m_iWidth * x) : x; }
+    /** Returns y-origin of the host (scaled) content corresponding to y-origin of guest (actual) content. */
+    inline int convertGuestYTo(int y) const { return m_scaledSize.isValid() ? qRound((double)m_scaledSize.height() / m_iHeight * y) : y; }
+    /** Returns x-origin of the guest (actual) content corresponding to x-origin of host (scaled) content. */
+    inline int convertHostXTo(int x) const  { return m_scaledSize.isValid() ? qRound((double)m_iWidth / m_scaledSize.width() * x) : x; }
+    /** Returns y-origin of the guest (actual) content corresponding to y-origin of host (scaled) content. */
+    inline int convertHostYTo(int y) const  { return m_scaledSize.isValid() ? qRound((double)m_iHeight / m_scaledSize.height() * y) : y; }
+
+    /** Returns the scale-factor used by the frame-buffer. */
+    double scaleFactor() const { return m_dScaleFactor; }
+    /** Define the scale-factor used by the frame-buffer. */
+    void setScaleFactor(double dScaleFactor) { m_dScaleFactor = dScaleFactor; }
+
+    /** Returns backing-scale-factor used by HiDPI frame-buffer. */
+    double backingScaleFactor() const { return m_dBackingScaleFactor; }
+    /** Defines backing-scale-factor used by HiDPI frame-buffer. */
+    void setBackingScaleFactor(double dBackingScaleFactor) { m_dBackingScaleFactor = dBackingScaleFactor; }
+
+    /** Returns whether frame-buffer should use unscaled HiDPI output. */
+    bool useUnscaledHiDPIOutput() const { return m_fUseUnscaledHiDPIOutput; }
+    /** Defines whether frame-buffer should use unscaled HiDPI output. */
+    void setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput) { m_fUseUnscaledHiDPIOutput = fUseUnscaledHiDPIOutput; }
+
+    /** Returns frame-buffer scaling optimization type. */
+    ScalingOptimizationType scalingOptimizationType() const { return m_enmScalingOptimizationType; }
+    /** Defines frame-buffer scaling optimization type: */
+    void setScalingOptimizationType(ScalingOptimizationType type) { m_enmScalingOptimizationType = type; }
+
+    /** Returns HiDPI frame-buffer optimization type. */
+    HiDPIOptimizationType hiDPIOptimizationType() const { return m_hiDPIOptimizationType; }
+    /** Defines HiDPI frame-buffer optimization type: */
+    void setHiDPIOptimizationType(HiDPIOptimizationType type) { m_hiDPIOptimizationType = type; }
+
+    DECLARE_NOT_AGGREGATABLE(UIFrameBufferPrivate)
+
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    BEGIN_COM_MAP(UIFrameBufferPrivate)
+        COM_INTERFACE_ENTRY(IFramebuffer)
+        COM_INTERFACE_ENTRY2(IDispatch,IFramebuffer)
+        COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
+    END_COM_MAP()
+
+    HRESULT FinalConstruct();
+    void FinalRelease();
+
+    STDMETHOD(COMGETTER(Width))(ULONG *puWidth);
+    STDMETHOD(COMGETTER(Height))(ULONG *puHeight);
+    STDMETHOD(COMGETTER(BitsPerPixel))(ULONG *puBitsPerPixel);
+    STDMETHOD(COMGETTER(BytesPerLine))(ULONG *puBytesPerLine);
+    STDMETHOD(COMGETTER(PixelFormat))(BitmapFormat_T *puPixelFormat);
+    STDMETHOD(COMGETTER(HeightReduction))(ULONG *puHeightReduction);
+    STDMETHOD(COMGETTER(Overlay))(IFramebufferOverlay **ppOverlay);
+    STDMETHOD(COMGETTER(WinId))(LONG64 *pWinId);
+    STDMETHOD(COMGETTER(Capabilities))(ComSafeArrayOut(FramebufferCapabilities_T, aCapabilities));
+
+    /** EMT callback: Notifies frame-buffer about guest-screen size change.
+      * @param        uScreenId Guest screen number.
+      * @param        uX        Horizontal origin of the update rectangle, in pixels.
+      * @param        uY        Vertical origin of the update rectangle, in pixels.
+      * @param        uWidth    Width of the guest display, in pixels.
+      * @param        uHeight   Height of the guest display, in pixels.
+      * @note         Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
+      * @note         Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */
+    STDMETHOD(NotifyChange)(ULONG uScreenId, ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight);
+
+    /** EMT callback: Notifies frame-buffer about guest-screen update.
+      * @param        uX      Horizontal origin of the update rectangle, in pixels.
+      * @param        uY      Vertical origin of the update rectangle, in pixels.
+      * @param        uWidth  Width of the update rectangle, in pixels.
+      * @param        uHeight Height of the update rectangle, in pixels.
+      * @note         Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
+      * @note         Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */
+    STDMETHOD(NotifyUpdate)(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight);
+
+    /** EMT callback: Notifies frame-buffer about guest-screen update.
+      * @param        uX      Horizontal origin of the update rectangle, in pixels.
+      * @param        uY      Vertical origin of the update rectangle, in pixels.
+      * @param        uWidth  Width of the update rectangle, in pixels.
+      * @param        uHeight Height of the update rectangle, in pixels.
+      * @param        image   Brings image container which can be used to copy data from.
+      * @note         Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
+      * @note         Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */
+    STDMETHOD(NotifyUpdateImage)(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight, ComSafeArrayIn(BYTE, image));
+
+    /** EMT callback: Returns whether the frame-buffer implementation is willing to support a given video-mode.
+      * @param        uWidth      Width of the guest display, in pixels.
+      * @param        uHeight     Height of the guest display, in pixels.
+      * @param        uBPP        Color depth, bits per pixel.
+      * @param        pfSupported Is frame-buffer able/willing to render the video mode or not.
+      * @note         Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
+      * @note         Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */
+    STDMETHOD(VideoModeSupported)(ULONG uWidth, ULONG uHeight, ULONG uBPP, BOOL *pbSupported);
+
+    /** EMT callback which is not used in current implementation. */
+    STDMETHOD(GetVisibleRegion)(BYTE *pRectangles, ULONG uCount, ULONG *puCountCopied);
+    /** EMT callback: Suggests new visible-region to this frame-buffer.
+      * @param        pRectangles Pointer to the RTRECT array.
+      * @param        uCount      Number of RTRECT elements in the rectangles array.
+      * @note         Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
+      * @note         Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */
+    STDMETHOD(SetVisibleRegion)(BYTE *pRectangles, ULONG uCount);
+
+    /** EMT callback which is not used in current implementation. */
+    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
+
+    /** EMT callback: Notifies frame-buffer about 3D backend event.
+      * @param        uType Event type. Currently only VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA is supported.
+      * @param        aData Event-specific data, depends on the supplied event type.
+      * @note         Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
+      * @note         Calls to this and #setMarkAsUnused method are synchronized (from GUI side). */
+    STDMETHOD(Notify3DEvent)(ULONG uType, ComSafeArrayIn(BYTE, data));
+
+    /** Locks frame-buffer access. */
+    void lock() const { RTCritSectEnter(&m_critSect); }
+    /** Unlocks frame-buffer access. */
+    void unlock() const { RTCritSectLeave(&m_critSect); }
+
+    /** Handles frame-buffer notify-change-event. */
+    virtual void handleNotifyChange(int iWidth, int iHeight);
+    /** Handles frame-buffer paint-event. */
+    virtual void handlePaintEvent(QPaintEvent *pEvent);
+    /** Handles frame-buffer set-visible-region-event. */
+    virtual void handleSetVisibleRegion(const QRegion &region);
+
+    /** Performs frame-buffer resizing. */
+    virtual void performResize(int iWidth, int iHeight);
+    /** Performs frame-buffer rescaling. */
+    virtual void performRescale();
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    /** Performs Video HW Acceleration command. */
+    virtual void doProcessVHWACommand(QEvent*) {}
+    /** Handles viewport resize-event. */
+    virtual void viewportResized(QResizeEvent*) {}
+    /** Handles viewport scroll-event. */
+    virtual void viewportScrolled(int, int) {}
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+
+protected:
+
+    /** Prepare connections routine. */
+    void prepareConnections();
+    /** Cleanup connections routine. */
+    void cleanupConnections();
+
+    /** Updates coordinate-system: */
+    void updateCoordinateSystem();
+
+    /** Default paint routine. */
+    void paintDefault(QPaintEvent *pEvent);
+    /** Paint routine for seamless mode. */
+    void paintSeamless(QPaintEvent *pEvent);
+
+    /** Returns the transformation mode corresponding to the passed ScalingOptimizationType. */
+    static Qt::TransformationMode transformationMode(ScalingOptimizationType type);
+
+    /** Erases corresponding @a rect with @a painter. */
+    static void eraseImageRect(QPainter &painter, const QRect &rect,
+                               bool fUseUnscaledHiDPIOutput,
+                               HiDPIOptimizationType hiDPIOptimizationType,
+                               double dBackingScaleFactor);
+    /** Draws corresponding @a rect of passed @a image with @a painter. */
+    static void drawImageRect(QPainter &painter, const QImage &image, const QRect &rect,
+                              int iContentsShiftX, int iContentsShiftY,
+                              bool fUseUnscaledHiDPIOutput,
+                              HiDPIOptimizationType hiDPIOptimizationType,
+                              double dBackingScaleFactor);
+
+    /** Holds the screen-id. */
+    ulong m_uScreenId;
+
+    /** Holds the QImage buffer. */
+    QImage m_image;
+    /** Holds frame-buffer width. */
+    int m_iWidth;
+    /** Holds frame-buffer height. */
+    int m_iHeight;
+
+    /** Holds the copy of the IDisplay wrapper. */
+    CDisplay m_display;
+    /** Source bitmap from IDisplay. */
+    CDisplaySourceBitmap m_sourceBitmap;
+    /** Source bitmap from IDisplay (acquired but not yet applied). */
+    CDisplaySourceBitmap m_pendingSourceBitmap;
+    /** Holds whether there is a pending source bitmap which must be applied. */
+    bool m_fPendingSourceBitmap;
+
+    /** Holds machine-view this frame-buffer is bounded to. */
+    UIMachineView *m_pMachineView;
+    /** Holds window ID this frame-buffer referring to. */
+    int64_t m_iWinId;
+
+    /** Reflects whether screen-updates are allowed. */
+    bool m_fUpdatesAllowed;
+
+    /** Defines whether frame-buffer is <b>unused</b>.
+      * <b>Unused</b> status determines whether frame-buffer should ignore EMT events or not. */
+    bool m_fUnused;
+
+    /** Defines whether frame-buffer is <b>auto-enabled</b>.
+      * <b>Auto-enabled</b> status means that guest-screen corresponding to this frame-buffer
+      * was automatically enabled by the multi-screen layout (auto-mount guest-screen) functionality,
+      * so have potentially incorrect size-hint posted into guest event queue.
+      * Machine-view will try to automatically adjust guest-screen size as soon as possible. */
+    bool m_fAutoEnabled;
+
+    /** RTCRITSECT object to protect frame-buffer access. */
+    mutable RTCRITSECT m_critSect;
+
+    /** @name Scale-factor related variables.
+     * @{ */
+    /** Holds the scale-factor used by the scaled-size. */
+    double m_dScaleFactor;
+    /** Holds the scaling optimization type used by the scaling mechanism. */
+    ScalingOptimizationType m_enmScalingOptimizationType;
+    /** Holds the coordinate-system for the scale-factor above. */
+    QTransform m_transform;
+    /** Holds the frame-buffer's scaled-size. */
+    QSize m_scaledSize;
+    /** @} */
+
+    /** @name Seamless mode related variables.
+     * @{ */
+    /* To avoid a seamless flicker which caused by the latency between
+     * the initial visible-region arriving from EMT thread
+     * and actual visible-region appliance on GUI thread
+     * it was decided to use two visible-region instances: */
+    /** Sync visible-region which being updated synchronously by locking EMT thread.
+      * Used for immediate manual clipping of the painting operations. */
+    QRegion m_syncVisibleRegion;
+    /** Async visible-region which being updated asynchronously by posting async-event from EMT to GUI thread,
+      * Used to update viewport parts for visible-region changes,
+      * because NotifyUpdate doesn't take into account these changes. */
+    QRegion m_asyncVisibleRegion;
+    /** When the frame-buffer is being resized, visible region is saved here.
+      * The saved region is applied when updates are enabled again. */
+    QRegion m_pendingSyncVisibleRegion;
+    /** @} */
+
+    /** @name HiDPI screens related variables.
+     * @{ */
+    /** Holds backing-scale-factor used by HiDPI frame-buffer. */
+    double m_dBackingScaleFactor;
+    /** Holds whether frame-buffer should use unscaled HiDPI output. */
+    bool m_fUseUnscaledHiDPIOutput;
+    /** Holds HiDPI frame-buffer optimization type. */
+    HiDPIOptimizationType m_hiDPIOptimizationType;
+    /** @} */
+
+private:
+
 #ifdef Q_OS_WIN
-    , m_iRefCnt(0)
+     CComPtr <IUnknown> m_pUnkMarshaler;
 #endif /* Q_OS_WIN */
-    , m_hiDPIOptimizationType(HiDPIOptimizationType_None)
+     /** Identifier returned by AttachFramebuffer. Used in DetachFramebuffer. */
+     QString m_strFramebufferId;
+};
+
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+/** UIFrameBufferPrivate reimplementation used to maintain VM display video memory
+  *                      for the case when 2D Video Acceleration is enabled. */
+class VBoxOverlayFrameBuffer : public UIFrameBufferPrivate
+{
+    Q_OBJECT;
+
+public:
+
+    VBoxOverlayFrameBuffer()
+    {
+    }
+
+    virtual HRESULT init(UIMachineView *pView)
+    {
+        mpView = pView;
+        UIFrameBufferPrivate::init(mpView);
+        mOverlay.init(mpView->viewport(), mpView, &(mpView->session()), mpView->screenId()),
+        /* sync with frame-buffer */
+        mOverlay.onResizeEventPostprocess (VBoxFBSizeInfo(this), QPoint(mpView->contentsX(), mpView->contentsY()));
+        return S_OK;
+    }
+
+    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
+    {
+        int rc;
+        UIFrameBufferPrivate::lock();
+        /* Make sure frame-buffer is used: */
+        if (m_fUnused)
+        {
+            LogRel2(("GUI: ProcessVHWACommand: Postponed!\n"));
+            /* Unlock access to frame-buffer: */
+            UIFrameBufferPrivate::unlock();
+            /* tell client to pend ProcessVHWACommand */
+            return E_ACCESSDENIED;
+        }
+        rc = mOverlay.onVHWACommand ((struct VBOXVHWACMD*)pCommand);
+        UIFrameBufferPrivate::unlock();
+        if (rc == VINF_CALLBACK_RETURN)
+            return S_OK;
+        else if (RT_SUCCESS(rc))
+            return S_FALSE;
+        else if (rc == VERR_INVALID_STATE)
+            return E_ACCESSDENIED;
+        return E_FAIL;
+    }
+
+    void doProcessVHWACommand (QEvent * pEvent)
+    {
+        mOverlay.onVHWACommandEvent (pEvent);
+    }
+
+    STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
+                             ULONG aW, ULONG aH)
+    {
+        HRESULT hr = S_OK;
+        UIFrameBufferPrivate::lock();
+        /* Make sure frame-buffer is used: */
+        if (m_fUnused)
+        {
+            LogRel2(("GUI: NotifyUpdate: Ignored!\n"));
+            mOverlay.onNotifyUpdateIgnore (aX, aY, aW, aH);
+            /* Unlock access to frame-buffer: */
+            UIFrameBufferPrivate::unlock();
+            /*can we actually ignore the notify update?*/
+            /* Ignore NotifyUpdate: */
+            return E_FAIL;
+        }
+
+        if (!mOverlay.onNotifyUpdate (aX, aY, aW, aH))
+            hr = UIFrameBufferPrivate::NotifyUpdate (aX, aY, aW, aH);
+        UIFrameBufferPrivate::unlock();
+        return hr;
+    }
+
+    void performResize(int iWidth, int iHeight)
+    {
+        UIFrameBufferPrivate::performResize(iWidth, iHeight);
+        mOverlay.onResizeEventPostprocess(VBoxFBSizeInfo(this),
+                QPoint(mpView->contentsX(), mpView->contentsY()));
+    }
+
+    void performRescale()
+    {
+        UIFrameBufferPrivate::performRescale();
+        mOverlay.onResizeEventPostprocess(VBoxFBSizeInfo(this),
+                QPoint(mpView->contentsX(), mpView->contentsY()));
+    }
+
+    void viewportResized (QResizeEvent * re)
+    {
+        mOverlay.onViewportResized (re);
+        UIFrameBufferPrivate::viewportResized (re);
+    }
+
+    void viewportScrolled (int dx, int dy)
+    {
+        mOverlay.onViewportScrolled (QPoint(mpView->contentsX(), mpView->contentsY()));
+        UIFrameBufferPrivate::viewportScrolled (dx, dy);
+    }
+
+    void setView(UIMachineView * pView)
+    {
+        /* lock to ensure we do not collide with the EMT thread passing commands to us */
+        UIFrameBufferPrivate::lock();
+        UIFrameBufferPrivate::setView(pView);
+        mpView = pView;
+        mOverlay.updateAttachment(pView ? pView->viewport() : NULL, pView);
+        UIFrameBufferPrivate::unlock();
+    }
+
+private:
+
+    VBoxQGLOverlay mOverlay;
+    UIMachineView *mpView;
+};
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+
+
+/* COM stuff: */
+#ifdef Q_WS_WIN
+static CComModule _Module;
+#else /* !Q_WS_WIN */
+NS_DECL_CLASSINFO(UIFrameBufferPrivate)
+NS_IMPL_THREADSAFE_ISUPPORTS1_CI(UIFrameBufferPrivate, IFramebuffer)
+#endif /* !Q_WS_WIN */
+
+
+UIFrameBufferPrivate::UIFrameBufferPrivate()
+    : m_uScreenId(0)
+    , m_iWidth(0), m_iHeight(0)
+    , m_fPendingSourceBitmap(false)
+    , m_pMachineView(NULL)
+    , m_iWinId(0)
+    , m_fUpdatesAllowed(false)
+    , m_fUnused(false)
+    , m_fAutoEnabled(false)
+    , m_dScaleFactor(1.0)
+    , m_enmScalingOptimizationType(ScalingOptimizationType_None)
     , m_dBackingScaleFactor(1.0)
+    , m_fUseUnscaledHiDPIOutput(false)
+    , m_hiDPIOptimizationType(HiDPIOptimizationType_None)
 {
+    /* Update coordinate-system: */
+    updateCoordinateSystem();
+}
+
+HRESULT UIFrameBufferPrivate::init(UIMachineView *pMachineView)
+{
+    LogRel2(("GUI: UIFrameBufferPrivate::init %p\n", this));
+
     /* Assign mahine-view: */
-    AssertMsg(m_pMachineView, ("UIMachineView must not be NULL\n"));
-    m_WinId = (m_pMachineView && m_pMachineView->viewport()) ? (LONG64)m_pMachineView->viewport()->winId() : 0;
+    m_pMachineView = pMachineView;
+
+    /* Assign index: */
+    m_uScreenId = m_pMachineView->screenId();
+
+    /* Cache window ID: */
+    m_iWinId = (m_pMachineView && m_pMachineView->viewport()) ? (LONG64)m_pMachineView->viewport()->winId() : 0;
+
+    /* Assign display: */
+    m_display = m_pMachineView->uisession()->display();
 
     /* Initialize critical-section: */
     int rc = RTCritSectInit(&m_critSect);
@@ -67,10 +565,21 @@ UIFrameBuffer::UIFrameBuffer(UIMachineView *pMachineView)
     /* Connect handlers: */
     if (m_pMachineView)
         prepareConnections();
+
+    /* Resize/rescale frame-buffer to the default size: */
+    performResize(640, 480);
+    performRescale();
+
+#ifdef Q_OS_WIN
+    CoCreateFreeThreadedMarshaler(this, &m_pUnkMarshaler.p);
+#endif /* Q_OS_WIN */
+    return S_OK;
 }
 
-UIFrameBuffer::~UIFrameBuffer()
+UIFrameBufferPrivate::~UIFrameBufferPrivate()
 {
+    LogRel2(("GUI: UIFrameBufferPrivate::~UIFrameBufferPrivate %p\n", this));
+
     /* Disconnect handlers: */
     if (m_pMachineView)
         cleanupConnections();
@@ -79,53 +588,60 @@ UIFrameBuffer::~UIFrameBuffer()
     RTCritSectDelete(&m_critSect);
 }
 
-/**
- * Sets the framebuffer <b>unused</b> status.
- * @param fIsMarkAsUnused determines whether framebuffer should ignore EMT events or not.
- * @note  Call to this (and any EMT callback) method is synchronized between calling threads (from GUI side).
- */
-void UIFrameBuffer::setMarkAsUnused(bool fIsMarkAsUnused)
+void UIFrameBufferPrivate::setView(UIMachineView *pMachineView)
 {
-    lock();
-    m_fIsMarkedAsUnused = fIsMarkAsUnused;
-    unlock();
+    /* Disconnect old handlers: */
+    if (m_pMachineView)
+        cleanupConnections();
+
+    /* Reassign machine-view: */
+    m_pMachineView = pMachineView;
+    /* Recache window ID: */
+    m_iWinId = (m_pMachineView && m_pMachineView->viewport()) ? (LONG64)m_pMachineView->viewport()->winId() : 0;
+
+#ifdef Q_WS_X11
+    /* Sync Qt and X11 Server (see xTracker #7547). */
+    XSync(QX11Info::display(), false);
+#endif
+
+    /* Connect new handlers: */
+    if (m_pMachineView)
+        prepareConnections();
 }
 
-/**
- * Returns the framebuffer <b>auto-enabled</b> status.
- * @returns @c true if guest-screen corresponding to this framebuffer was automatically enabled by
-            the auto-mount guest-screen auto-pilot, @c false otherwise.
- * @note    <i>Auto-enabled</i> status means the framebuffer was automatically enabled by the multi-screen layout
- *          and so have potentially incorrect guest size hint posted into guest event queue. Machine-view will try to
- *          automatically adjust guest-screen size as soon as possible.
- */
-bool UIFrameBuffer::isAutoEnabled() const
+void UIFrameBufferPrivate::attach()
 {
-    return m_fIsAutoEnabled;
+    m_strFramebufferId = display().AttachFramebuffer(m_uScreenId, CFramebuffer(this));
 }
 
-/**
- * Sets the framebuffer <b>auto-enabled</b> status.
- * @param fIsAutoEnabled determines whether guest-screen corresponding to this framebuffer
- *        was automatically enabled by the auto-mount guest-screen auto-pilot.
- * @note  <i>Auto-enabled</i> status means the framebuffer was automatically enabled by the multi-screen layout
- *        and so have potentially incorrect guest size hint posted into guest event queue. Machine-view will try to
- *        automatically adjust guest-screen size as soon as possible.
- */
-void UIFrameBuffer::setAutoEnabled(bool fIsAutoEnabled)
+void UIFrameBufferPrivate::detach()
 {
-    m_fIsAutoEnabled = fIsAutoEnabled;
+    CFramebuffer frameBuffer = display().QueryFramebuffer(m_uScreenId);
+    if (!frameBuffer.isNull())
+    {
+        display().DetachFramebuffer(m_uScreenId, m_strFramebufferId);
+        m_strFramebufferId.clear();
+    }
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(Address) (BYTE **ppAddress)
+void UIFrameBufferPrivate::setMarkAsUnused(bool fUnused)
 {
-    if (!ppAddress)
-        return E_POINTER;
-    *ppAddress = address();
-    return S_OK;
+    lock();
+    m_fUnused = fUnused;
+    unlock();
+}
+
+HRESULT UIFrameBufferPrivate::FinalConstruct()
+{
+    return 0;
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(Width) (ULONG *puWidth)
+void UIFrameBufferPrivate::FinalRelease()
+{
+    return;
+}
+
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(Width)(ULONG *puWidth)
 {
     if (!puWidth)
         return E_POINTER;
@@ -133,7 +649,7 @@ STDMETHODIMP UIFrameBuffer::COMGETTER(Width) (ULONG *puWidth)
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(Height) (ULONG *puHeight)
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(Height)(ULONG *puHeight)
 {
     if (!puHeight)
         return E_POINTER;
@@ -141,7 +657,7 @@ STDMETHODIMP UIFrameBuffer::COMGETTER(Height) (ULONG *puHeight)
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(BitsPerPixel) (ULONG *puBitsPerPixel)
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(BitsPerPixel)(ULONG *puBitsPerPixel)
 {
     if (!puBitsPerPixel)
         return E_POINTER;
@@ -149,7 +665,7 @@ STDMETHODIMP UIFrameBuffer::COMGETTER(BitsPerPixel) (ULONG *puBitsPerPixel)
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(BytesPerLine) (ULONG *puBytesPerLine)
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(BytesPerLine)(ULONG *puBytesPerLine)
 {
     if (!puBytesPerLine)
         return E_POINTER;
@@ -157,23 +673,15 @@ STDMETHODIMP UIFrameBuffer::COMGETTER(BytesPerLine) (ULONG *puBytesPerLine)
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(PixelFormat) (ULONG *puPixelFormat)
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(PixelFormat)(BitmapFormat_T *puPixelFormat)
 {
     if (!puPixelFormat)
         return E_POINTER;
-    *puPixelFormat = pixelFormat();
-    return S_OK;
-}
-
-STDMETHODIMP UIFrameBuffer::COMGETTER(UsesGuestVRAM) (BOOL *pbUsesGuestVRAM)
-{
-    if (!pbUsesGuestVRAM)
-        return E_POINTER;
-    *pbUsesGuestVRAM = usesGuestVRAM();
+    *puPixelFormat = (BitmapFormat_T)pixelFormat();
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(HeightReduction) (ULONG *puHeightReduction)
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(HeightReduction)(ULONG *puHeightReduction)
 {
     if (!puHeightReduction)
         return E_POINTER;
@@ -181,143 +689,112 @@ STDMETHODIMP UIFrameBuffer::COMGETTER(HeightReduction) (ULONG *puHeightReduction
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(Overlay) (IFramebufferOverlay **ppOverlay)
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(Overlay)(IFramebufferOverlay **ppOverlay)
 {
     if (!ppOverlay)
         return E_POINTER;
-    /* not yet implemented */
     *ppOverlay = 0;
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::COMGETTER(WinId) (LONG64 *pWinId)
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(WinId)(LONG64 *pWinId)
 {
     if (!pWinId)
         return E_POINTER;
-    *pWinId = m_WinId;
+    *pWinId = m_iWinId;
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::Lock()
+STDMETHODIMP UIFrameBufferPrivate::COMGETTER(Capabilities)(ComSafeArrayOut(FramebufferCapabilities_T, enmCapabilities))
 {
-    this->lock();
-    return S_OK;
-}
+    if (ComSafeArrayOutIsNull(enmCapabilities))
+        return E_POINTER;
 
-STDMETHODIMP UIFrameBuffer::Unlock()
-{
-    this->unlock();
+    com::SafeArray<FramebufferCapabilities_T> caps;
+    if (vboxGlobal().isSeparateProcess())
+    {
+       caps.resize(1);
+       caps[0] = FramebufferCapabilities_UpdateImage;
+    }
+    else
+    {
+       caps.resize(2);
+       caps[0] = FramebufferCapabilities_VHWA;
+       caps[1] = FramebufferCapabilities_VisibleRegion;
+    }
+
+    caps.detachTo(ComSafeArrayOutArg(enmCapabilities));
     return S_OK;
 }
 
-/**
- * EMT callback: Requests a size and pixel format change.
- * @param uScreenId     Guest screen number. Must be used in the corresponding call to CDisplay::ResizeCompleted if this call is made.
- * @param uPixelFormat  Pixel format of the memory buffer pointed to by @a pVRAM.
- * @param pVRAM         Pointer to the virtual video card's VRAM (may be <i>null</i>).
- * @param uBitsPerPixel Color depth, bits per pixel.
- * @param uBytesPerLine Size of one scan line, in bytes.
- * @param uWidth        Width of the guest display, in pixels.
- * @param uHeight       Height of the guest display, in pixels.
- * @param pfFinished    Can the VM start using the new frame buffer immediately after this method returns or it should wait for CDisplay::ResizeCompleted.
- * @note  Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
- * @note  Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side).
- */
-STDMETHODIMP UIFrameBuffer::RequestResize(ULONG uScreenId, ULONG uPixelFormat,
-                                          BYTE *pVRAM, ULONG uBitsPerPixel, ULONG uBytesPerLine,
-                                          ULONG uWidth, ULONG uHeight,
-                                          BOOL *pfFinished)
+STDMETHODIMP UIFrameBufferPrivate::NotifyChange(ULONG uScreenId, ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight)
 {
-    /* Make sure result pointer is valid: */
-    if (!pfFinished)
-    {
-        LogRel(("UIFrameBuffer::RequestResize: "
-                "Screen=%lu, Format=%lu, "
-                "BitsPerPixel=%lu, BytesPerLine=%lu, "
-                "Size=%lux%lu, Invalid pfFinished pointer!\n",
-                (unsigned long)uScreenId, (unsigned long)uPixelFormat,
-                (unsigned long)uBitsPerPixel, (unsigned long)uBytesPerLine,
-                (unsigned long)uWidth, (unsigned long)uHeight));
-
-        return E_POINTER;
-    }
+    CDisplaySourceBitmap sourceBitmap;
+    if (!vboxGlobal().isSeparateProcess())
+        display().QuerySourceBitmap(uScreenId, sourceBitmap);
 
     /* Lock access to frame-buffer: */
     lock();
 
     /* Make sure frame-buffer is used: */
-    if (m_fIsMarkedAsUnused)
-    {
-        LogRel(("UIFrameBuffer::RequestResize: "
-                "Screen=%lu, Format=%lu, "
-                "BitsPerPixel=%lu, BytesPerLine=%lu, "
-                "Size=%lux%lu, Ignored!\n",
-                (unsigned long)uScreenId, (unsigned long)uPixelFormat,
-                (unsigned long)uBitsPerPixel, (unsigned long)uBytesPerLine,
+    if (m_fUnused)
+    {
+        LogRel(("GUI: UIFrameBufferPrivate::NotifyChange: Screen=%lu, Origin=%lux%lu, Size=%lux%lu, Ignored!\n",
+                (unsigned long)uScreenId,
+                (unsigned long)uX, (unsigned long)uY,
                 (unsigned long)uWidth, (unsigned long)uHeight));
 
-        /* Mark request as finished.
-         * It is required to report to the VM thread that we finished resizing and rely on the
-         * later synchronisation when the new view is attached. */
-        *pfFinished = TRUE;
-
         /* Unlock access to frame-buffer: */
         unlock();
 
-        /* Ignore RequestResize: */
+        /* Ignore NotifyChange: */
         return E_FAIL;
     }
 
-    /* Mark request as not-yet-finished: */
-    *pfFinished = FALSE;
+    /* Disable screen updates: */
+    m_fUpdatesAllowed = false;
+
+    /* While updates are disabled, visible region will be saved:  */
+    m_pendingSyncVisibleRegion = QRegion();
+
+    if (!vboxGlobal().isSeparateProcess())
+    {
+       /* Acquire new pending bitmap: */
+       m_pendingSourceBitmap = sourceBitmap;
+       m_fPendingSourceBitmap = true;
+    }
 
     /* Widget resize is NOT thread-safe and *probably* never will be,
      * We have to notify machine-view with the async-signal to perform resize operation. */
-    LogRel(("UIFrameBuffer::RequestResize: "
-            "Screen=%lu, Format=%lu, "
-            "BitsPerPixel=%lu, BytesPerLine=%lu, "
-            "Size=%lux%lu, Sending to async-handler..\n",
-            (unsigned long)uScreenId, (unsigned long)uPixelFormat,
-            (unsigned long)uBitsPerPixel, (unsigned long)uBytesPerLine,
+    LogRel(("GUI: UIFrameBufferPrivate::NotifyChange: Screen=%lu, Origin=%lux%lu, Size=%lux%lu, Sending to async-handler\n",
+            (unsigned long)uScreenId,
+            (unsigned long)uX, (unsigned long)uY,
             (unsigned long)uWidth, (unsigned long)uHeight));
-    emit sigRequestResize(uPixelFormat, pVRAM, uBitsPerPixel, uBytesPerLine, uWidth, uHeight);
+    emit sigNotifyChange(uWidth, uHeight);
 
     /* Unlock access to frame-buffer: */
     unlock();
 
-    /* Confirm RequestResize: */
+    /* Give up control token to other thread: */
+    RTThreadYield();
+
+    /* Confirm NotifyChange: */
     return S_OK;
 }
 
-/**
- * EMT callback: Informs about an update.
- * @param uX      Horizontal origin of the update rectangle, in pixels.
- * @param uY      Vertical origin of the update rectangle, in pixels.
- * @param uWidth  Width of the update rectangle, in pixels.
- * @param uHeight Height of the update rectangle, in pixels.
- * @note  Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
- * @note  Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side).
- */
-STDMETHODIMP UIFrameBuffer::NotifyUpdate(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight)
+STDMETHODIMP UIFrameBufferPrivate::NotifyUpdate(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight)
 {
-    /* Retina screens with physical-to-logical scaling requires
-     * odd/even pixel updates to be taken into account,
-     * otherwise we have artifacts on the borders of incoming rectangle. */
-    uX = qMax(0, (int)uX - 1);
-    uY = qMax(0, (int)uY - 1);
-    uWidth = qMin((int)m_width, (int)uWidth + 2);
-    uHeight = qMin((int)m_height, (int)uHeight + 2);
-
     /* Lock access to frame-buffer: */
     lock();
 
     /* Make sure frame-buffer is used: */
-    if (m_fIsMarkedAsUnused)
+    if (m_fUnused)
     {
-        LogRel2(("UIFrameBuffer::NotifyUpdate: Origin=%lux%lu, Size=%lux%lu, Ignored!\n",
+#ifndef DEBUG_andy
+        LogRel2(("GUI: UIFrameBufferPrivate::NotifyUpdate: Origin=%lux%lu, Size=%lux%lu, Ignored!\n",
                  (unsigned long)uX, (unsigned long)uY,
                  (unsigned long)uWidth, (unsigned long)uHeight));
-
+#endif
         /* Unlock access to frame-buffer: */
         unlock();
 
@@ -325,11 +802,13 @@ STDMETHODIMP UIFrameBuffer::NotifyUpdate(ULONG uX, ULONG uY, ULONG uWidth, ULONG
         return E_FAIL;
     }
 
+#ifndef DEBUG_andy
     /* Widget update is NOT thread-safe and *seems* never will be,
      * We have to notify machine-view with the async-signal to perform update operation. */
-    LogRel2(("UIFrameBuffer::NotifyUpdate: Origin=%lux%lu, Size=%lux%lu, Sending to async-handler..\n",
+    LogRel2(("GUI: UIFrameBufferPrivate::NotifyUpdate: Origin=%lux%lu, Size=%lux%lu, Sending to async-handler\n",
              (unsigned long)uX, (unsigned long)uY,
              (unsigned long)uWidth, (unsigned long)uHeight));
+#endif
     emit sigNotifyUpdate(uX, uY, uWidth, uHeight);
 
     /* Unlock access to frame-buffer: */
@@ -339,21 +818,66 @@ STDMETHODIMP UIFrameBuffer::NotifyUpdate(ULONG uX, ULONG uY, ULONG uWidth, ULONG
     return S_OK;
 }
 
-/**
- * EMT callback: Returns whether the framebuffer implementation is willing to support a given video mode.
- * @param uWidth      Width of the guest display, in pixels.
- * @param uHeight     Height of the guest display, in pixels.
- * @param uBPP        Color depth, bits per pixel.
- * @param pfSupported Is framebuffer able/willing to render the video mode or not.
- * @note  Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
- * @note  Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side).
- */
-STDMETHODIMP UIFrameBuffer::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULONG uBPP, BOOL *pfSupported)
+STDMETHODIMP UIFrameBufferPrivate::NotifyUpdateImage(ULONG uX, ULONG uY,
+                                                     ULONG uWidth, ULONG uHeight,
+                                                     ComSafeArrayIn(BYTE, image))
+{
+    /* Wrapping received data: */
+    com::SafeArray<BYTE> imageData(ComSafeArrayInArg(image));
+
+    /* Lock access to frame-buffer: */
+    lock();
+
+    /* Make sure frame-buffer is used: */
+    if (m_fUnused)
+    {
+        LogRel2(("GUI: UIFrameBufferPrivate::NotifyUpdateImage: Origin=%lux%lu, Size=%lux%lu, Ignored!\n",
+                 (unsigned long)uX, (unsigned long)uY,
+                 (unsigned long)uWidth, (unsigned long)uHeight));
+
+        /* Unlock access to frame-buffer: */
+        unlock();
+
+        /* Ignore NotifyUpdate: */
+        return E_FAIL;
+    }
+    /* Directly update m_image if update fits: */
+    if (   m_fUpdatesAllowed
+        && uX + uWidth <= (ULONG)m_image.width()
+        && uY + uHeight <= (ULONG)m_image.height())
+    {
+        /* Copy to m_image: */
+        uchar *pu8Dst = m_image.bits() + uY * m_image.bytesPerLine() + uX * 4;
+        uchar *pu8Src = imageData.raw();
+        ULONG h;
+        for (h = 0; h < uHeight; ++h)
+        {
+            memcpy(pu8Dst, pu8Src, uWidth * 4);
+            pu8Dst += m_image.bytesPerLine();
+            pu8Src += uWidth * 4;
+        }
+
+        /* Widget update is NOT thread-safe and *seems* never will be,
+         * We have to notify machine-view with the async-signal to perform update operation. */
+        LogRel2(("GUI: UIFrameBufferPrivate::NotifyUpdateImage: Origin=%lux%lu, Size=%lux%lu, Sending to async-handler\n",
+                 (unsigned long)uX, (unsigned long)uY,
+                 (unsigned long)uWidth, (unsigned long)uHeight));
+        emit sigNotifyUpdate(uX, uY, uWidth, uHeight);
+    }
+
+    /* Unlock access to frame-buffer: */
+    unlock();
+
+    /* Confirm NotifyUpdateImage: */
+    return S_OK;
+}
+
+STDMETHODIMP UIFrameBufferPrivate::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULONG uBPP, BOOL *pfSupported)
 {
     /* Make sure result pointer is valid: */
     if (!pfSupported)
     {
-        LogRel2(("UIFrameBuffer::IsVideoModeSupported: Mode: BPP=%lu, Size=%lux%lu, Invalid pfSupported pointer!\n",
+        LogRel2(("GUI: UIFrameBufferPrivate::IsVideoModeSupported: Mode: BPP=%lu, Size=%lux%lu, Invalid pfSupported pointer!\n",
                  (unsigned long)uBPP, (unsigned long)uWidth, (unsigned long)uHeight));
 
         return E_POINTER;
@@ -363,9 +887,9 @@ STDMETHODIMP UIFrameBuffer::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULON
     lock();
 
     /* Make sure frame-buffer is used: */
-    if (m_fIsMarkedAsUnused)
+    if (m_fUnused)
     {
-        LogRel2(("UIFrameBuffer::IsVideoModeSupported: Mode: BPP=%lu, Size=%lux%lu, Ignored!\n",
+        LogRel2(("GUI: UIFrameBufferPrivate::IsVideoModeSupported: Mode: BPP=%lu, Size=%lux%lu, Ignored!\n",
                  (unsigned long)uBPP, (unsigned long)uWidth, (unsigned long)uHeight));
 
         /* Unlock access to frame-buffer: */
@@ -386,7 +910,7 @@ STDMETHODIMP UIFrameBuffer::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULON
         && (uHeight > (ULONG)screenSize.height())
         && (uHeight > (ULONG)height()))
         *pfSupported = FALSE;
-    LogRel2(("UIFrameBuffer::IsVideoModeSupported: Mode: BPP=%lu, Size=%lux%lu, Supported=%s\n",
+    LogRel2(("GUI: UIFrameBufferPrivate::IsVideoModeSupported: Mode: BPP=%lu, Size=%lux%lu, Supported=%s\n",
              (unsigned long)uBPP, (unsigned long)uWidth, (unsigned long)uHeight, *pfSupported ? "TRUE" : "FALSE"));
 
     /* Unlock access to frame-buffer: */
@@ -396,7 +920,7 @@ STDMETHODIMP UIFrameBuffer::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULON
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::GetVisibleRegion(BYTE *pRectangles, ULONG uCount, ULONG *puCountCopied)
+STDMETHODIMP UIFrameBufferPrivate::GetVisibleRegion(BYTE *pRectangles, ULONG uCount, ULONG *puCountCopied)
 {
     PRTRECT rects = (PRTRECT)pRectangles;
 
@@ -409,19 +933,12 @@ STDMETHODIMP UIFrameBuffer::GetVisibleRegion(BYTE *pRectangles, ULONG uCount, UL
     return S_OK;
 }
 
-/**
- * EMT callback: Suggests a new visible region to this framebuffer.
- * @param pRectangles Pointer to the RTRECT array.
- * @param uCount      Number of RTRECT elements in the rectangles array.
- * @note  Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
- * @note  Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side).
- */
-STDMETHODIMP UIFrameBuffer::SetVisibleRegion(BYTE *pRectangles, ULONG uCount)
+STDMETHODIMP UIFrameBufferPrivate::SetVisibleRegion(BYTE *pRectangles, ULONG uCount)
 {
     /* Make sure rectangles were passed: */
     if (!pRectangles)
     {
-        LogRel2(("UIFrameBuffer::SetVisibleRegion: Rectangle count=%lu, Invalid pRectangles pointer!\n",
+        LogRel2(("GUI: UIFrameBufferPrivate::SetVisibleRegion: Rectangle count=%lu, Invalid pRectangles pointer!\n",
                  (unsigned long)uCount));
 
         return E_POINTER;
@@ -431,9 +948,9 @@ STDMETHODIMP UIFrameBuffer::SetVisibleRegion(BYTE *pRectangles, ULONG uCount)
     lock();
 
     /* Make sure frame-buffer is used: */
-    if (m_fIsMarkedAsUnused)
+    if (m_fUnused)
     {
-        LogRel2(("UIFrameBuffer::SetVisibleRegion: Rectangle count=%lu, Ignored!\n",
+        LogRel2(("GUI: UIFrameBufferPrivate::SetVisibleRegion: Rectangle count=%lu, Ignored!\n",
                  (unsigned long)uCount));
 
         /* Unlock access to frame-buffer: */
@@ -446,7 +963,7 @@ STDMETHODIMP UIFrameBuffer::SetVisibleRegion(BYTE *pRectangles, ULONG uCount)
     /* Compose region: */
     QRegion region;
     PRTRECT rects = (PRTRECT)pRectangles;
-    for (ULONG ind = 0; ind < uCount; ++ind)
+    for (ULONG uIndex = 0; uIndex < uCount; ++uIndex)
     {
         /* Get current rectangle: */
         QRect rect;
@@ -459,13 +976,26 @@ STDMETHODIMP UIFrameBuffer::SetVisibleRegion(BYTE *pRectangles, ULONG uCount)
         region += rect;
         ++rects;
     }
+    /* Tune according scale-factor: */
+    if (scaleFactor() != 1.0 || backingScaleFactor() > 1.0)
+        region = m_transform.map(region);
 
-    /* We are directly updating synchronous visible-region: */
-    m_syncVisibleRegion = region;
-    /* And send async-signal to update asynchronous one: */
-    LogRel2(("UIFrameBuffer::SetVisibleRegion: Rectangle count=%lu, Sending to async-handler..\n",
-             (unsigned long)uCount));
-    emit sigSetVisibleRegion(region);
+    if (m_fUpdatesAllowed)
+    {
+        /* We are directly updating synchronous visible-region: */
+        m_syncVisibleRegion = region;
+        /* And send async-signal to update asynchronous one: */
+        LogRel2(("GUI: UIFrameBufferPrivate::SetVisibleRegion: Rectangle count=%lu, Sending to async-handler\n",
+                 (unsigned long)uCount));
+        emit sigSetVisibleRegion(region);
+    }
+    else
+    {
+        /* Save the region. */
+        m_pendingSyncVisibleRegion = region;
+        LogRel2(("GUI: UIFrameBufferPrivate::SetVisibleRegion: Rectangle count=%lu, Saved\n",
+                 (unsigned long)uCount));
+    }
 
     /* Unlock access to frame-buffer: */
     unlock();
@@ -474,28 +1004,21 @@ STDMETHODIMP UIFrameBuffer::SetVisibleRegion(BYTE *pRectangles, ULONG uCount)
     return S_OK;
 }
 
-STDMETHODIMP UIFrameBuffer::ProcessVHWACommand(BYTE *pCommand)
+STDMETHODIMP UIFrameBufferPrivate::ProcessVHWACommand(BYTE *pCommand)
 {
     Q_UNUSED(pCommand);
     return E_NOTIMPL;
 }
 
-/**
- * EMT callback: Notifies framebuffer about 3D backend event.
- * @param uType Event type. Currently only VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA is supported.
- * @param pData Event-specific data, depends on the supplied event type.
- * @note  Any EMT callback is subsequent. No any other EMT callback can be called until this one processed.
- * @note  Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side).
- */
-STDMETHODIMP UIFrameBuffer::Notify3DEvent(ULONG uType, BYTE *pData)
+STDMETHODIMP UIFrameBufferPrivate::Notify3DEvent(ULONG uType, ComSafeArrayIn(BYTE, data))
 {
     /* Lock access to frame-buffer: */
     lock();
 
     /* Make sure frame-buffer is used: */
-    if (m_fIsMarkedAsUnused)
+    if (m_fUnused)
     {
-        LogRel2(("UIFrameBuffer::Notify3DEvent: Ignored!\n"));
+        LogRel2(("GUI: UIFrameBufferPrivate::Notify3DEvent: Ignored!\n"));
 
         /* Unlock access to frame-buffer: */
         unlock();
@@ -504,16 +1027,18 @@ STDMETHODIMP UIFrameBuffer::Notify3DEvent(ULONG uType, BYTE *pData)
         return E_FAIL;
     }
 
+    // com::SafeArray<BYTE> eventData(ComSafeArrayInArg(data));
     switch (uType)
     {
-        case VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA:
+        case VBOX3D_NOTIFY_EVENT_TYPE_3DDATA_VISIBLE:
+        case VBOX3D_NOTIFY_EVENT_TYPE_3DDATA_HIDDEN:
         {
             /* Notify machine-view with the async-signal
              * about 3D overlay visibility change: */
-            BOOL fVisible = !!pData;
-            LogRel2(("UIFrameBuffer::Notify3DEvent: Sending to async-handler: "
-                     "(VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA = %s)\n",
-                     fVisible ? "TRUE" : "FALSE"));
+            BOOL fVisible = uType == VBOX3D_NOTIFY_EVENT_TYPE_3DDATA_VISIBLE;
+            LogRel2(("GUI: UIFrameBufferPrivate::Notify3DEvent: Sending to async-handler: "
+                     "(VBOX3D_NOTIFY_EVENT_TYPE_3DDATA_%s)\n",
+                     fVisible ? "VISIBLE" : "HIDDEN"));
             emit sigNotifyAbout3DOverlayVisibilityChange(fVisible);
 
             /* Unlock access to frame-buffer: */
@@ -525,7 +1050,7 @@ STDMETHODIMP UIFrameBuffer::Notify3DEvent(ULONG uType, BYTE *pData)
 
         case VBOX3D_NOTIFY_EVENT_TYPE_TEST_FUNCTIONAL:
         {
-            HRESULT hr = m_fIsMarkedAsUnused ? E_FAIL : S_OK;
+            HRESULT hr = m_fUnused ? E_FAIL : S_OK;
             unlock();
             return hr;
         }
@@ -541,7 +1066,81 @@ STDMETHODIMP UIFrameBuffer::Notify3DEvent(ULONG uType, BYTE *pData)
     return E_INVALIDARG;
 }
 
-void UIFrameBuffer::applyVisibleRegion(const QRegion &region)
+void UIFrameBufferPrivate::handleNotifyChange(int iWidth, int iHeight)
+{
+    LogRel(("GUI: UIFrameBufferPrivate::handleNotifyChange: Size=%dx%d\n", iWidth, iHeight));
+
+    /* Make sure machine-view is assigned: */
+    AssertPtrReturnVoid(m_pMachineView);
+
+    /* Lock access to frame-buffer: */
+    lock();
+
+    /* If there is NO pending source-bitmap: */
+    if (!vboxGlobal().isSeparateProcess() && !m_fPendingSourceBitmap)
+    {
+        /* Do nothing, change-event already processed: */
+        LogRel2(("GUI: UIFrameBufferPrivate::handleNotifyChange: Already processed.\n"));
+        /* Unlock access to frame-buffer: */
+        unlock();
+        /* Return immediately: */
+        return;
+    }
+
+    /* Release the current bitmap and keep the pending one: */
+    m_sourceBitmap = m_pendingSourceBitmap;
+    m_pendingSourceBitmap = 0;
+    m_fPendingSourceBitmap = false;
+
+    /* Unlock access to frame-buffer: */
+    unlock();
+
+    /* Perform frame-buffer resize: */
+    performResize(iWidth, iHeight);
+}
+
+void UIFrameBufferPrivate::handlePaintEvent(QPaintEvent *pEvent)
+{
+#ifndef DEBUG_andy
+    LogRel2(("GUI: UIFrameBufferPrivate::handlePaintEvent: Origin=%lux%lu, Size=%dx%d\n",
+             pEvent->rect().x(), pEvent->rect().y(),
+             pEvent->rect().width(), pEvent->rect().height()));
+#endif
+
+    /* On mode switch the enqueued paint-event may still come
+     * while the machine-view is already null (before the new machine-view set),
+     * ignore paint-event in that case. */
+    if (!m_pMachineView)
+        return;
+
+    /* Lock access to frame-buffer: */
+    lock();
+
+    /* But if updates disabled: */
+    if (!m_fUpdatesAllowed)
+    {
+        /* Unlock access to frame-buffer: */
+        unlock();
+        /* And return immediately: */
+        return;
+    }
+
+    /* Depending on visual-state type: */
+    switch (m_pMachineView->machineLogic()->visualStateType())
+    {
+        case UIVisualStateType_Seamless:
+            paintSeamless(pEvent);
+            break;
+        default:
+            paintDefault(pEvent);
+            break;
+    }
+
+    /* Unlock access to frame-buffer: */
+    unlock();
+}
+
+void UIFrameBufferPrivate::handleSetVisibleRegion(const QRegion &region)
 {
     /* Make sure async visible-region has changed: */
     if (m_asyncVisibleRegion == region)
@@ -555,66 +1154,143 @@ void UIFrameBuffer::applyVisibleRegion(const QRegion &region)
     /* Remember last visible region: */
     m_asyncVisibleRegion = region;
 
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
+#ifdef VBOX_WITH_MASKED_SEAMLESS
     /* We have to use async visible-region to apply to [Q]Widget [set]Mask: */
     m_pMachineView->machineWindow()->setMask(m_asyncVisibleRegion);
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+#endif /* VBOX_WITH_MASKED_SEAMLESS */
 }
 
-#ifdef VBOX_WITH_VIDEOHWACCEL
-void UIFrameBuffer::doProcessVHWACommand(QEvent *pEvent)
+void UIFrameBufferPrivate::performResize(int iWidth, int iHeight)
 {
-    Q_UNUSED(pEvent);
-    /* should never be here */
-    AssertBreakpoint();
-}
-#endif /* VBOX_WITH_VIDEOHWACCEL */
+    LogRel(("GUI: UIFrameBufferPrivate::performResize: Size=%dx%d\n", iWidth, iHeight));
 
-void UIFrameBuffer::setView(UIMachineView * pView)
-{
-    /* Disconnect handlers: */
-    if (m_pMachineView)
-        cleanupConnections();
+    /* Make sure machine-view is assigned: */
+    AssertPtrReturnVoid(m_pMachineView);
 
-    /* Reassign machine-view: */
-    m_pMachineView = pView;
-    m_WinId = (m_pMachineView && m_pMachineView->viewport()) ? (LONG64)m_pMachineView->viewport()->winId() : 0;
+    /* Invalidate visible-region (if necessary): */
+    if (m_pMachineView->machineLogic()->visualStateType() == UIVisualStateType_Seamless &&
+        (m_iWidth != iWidth || m_iHeight != iHeight))
+    {
+        lock();
+        m_syncVisibleRegion = QRegion();
+        m_asyncVisibleRegion = QRegion();
+        unlock();
+    }
 
-#ifdef Q_WS_X11
-    /* Sync Qt and X11 Server. Notify server about newly
-     * created winId (see xTracker #7547). */
-    XSync(QX11Info::display(), false);
-#endif
+    /* If source-bitmap invalid: */
+    if (m_sourceBitmap.isNull())
+    {
+        LogRel(("GUI: UIFrameBufferPrivate::performResize: "
+                "Using fallback buffer since no source-bitmap is provided\n"));
 
-    /* Connect handlers: */
-    if (m_pMachineView)
-        prepareConnections();
-}
+        /* Remember new size came from hint: */
+        m_iWidth = iWidth;
+        m_iHeight = iHeight;
 
-void UIFrameBuffer::setHiDPIOptimizationType(HiDPIOptimizationType optimizationType)
-{
-    /* Make sure 'HiDPI optimization type' changed: */
-    if (m_hiDPIOptimizationType == optimizationType)
-        return;
+        /* And recreate fallback buffer: */
+        m_image = QImage(m_iWidth, m_iHeight, QImage::Format_RGB32);
+        m_image.fill(0);
+    }
+    /* If source-bitmap valid: */
+    else
+    {
+        LogRel(("GUI: UIFrameBufferPrivate::performResize: "
+                "Directly using source-bitmap content\n"));
+
+        /* Acquire source-bitmap attributes: */
+        BYTE *pAddress = NULL;
+        ULONG ulWidth = 0;
+        ULONG ulHeight = 0;
+        ULONG ulBitsPerPixel = 0;
+        ULONG ulBytesPerLine = 0;
+        KBitmapFormat bitmapFormat = KBitmapFormat_Opaque;
+        m_sourceBitmap.QueryBitmapInfo(pAddress,
+                                       ulWidth,
+                                       ulHeight,
+                                       ulBitsPerPixel,
+                                       ulBytesPerLine,
+                                       bitmapFormat);
+        Assert(ulBitsPerPixel == 32);
+
+        /* Remember new actual size: */
+        m_iWidth = (int)ulWidth;
+        m_iHeight = (int)ulHeight;
+
+        /* Recreate QImage on the basis of source-bitmap content: */
+        m_image = QImage(pAddress, m_iWidth, m_iHeight, ulBytesPerLine, QImage::Format_RGB32);
+
+        /* Check whether guest color depth differs from the bitmap color depth: */
+        ULONG ulGuestBitsPerPixel = 0;
+        LONG xOrigin = 0;
+        LONG yOrigin = 0;
+        KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
+        display().GetScreenResolution(m_uScreenId, ulWidth, ulHeight, ulGuestBitsPerPixel, xOrigin, yOrigin, monitorStatus);
+
+        /* Remind user if necessary, ignore text and VGA modes: */
+        /* This check (supports graphics) is not quite right due to past mistakes
+         * in the Guest Additions protocol, but in practice it should be fine. */
+        if (   ulGuestBitsPerPixel != ulBitsPerPixel
+            && ulGuestBitsPerPixel != 0
+            && m_pMachineView->uisession()->isGuestSupportsGraphics())
+            popupCenter().remindAboutWrongColorDepth(m_pMachineView->machineWindow(),
+                                                     ulGuestBitsPerPixel, ulBitsPerPixel);
+        else
+            popupCenter().forgetAboutWrongColorDepth(m_pMachineView->machineWindow());
+    }
+
+    lock();
+
+    /* Enable screen updates: */
+    m_fUpdatesAllowed = true;
+
+    if (!m_pendingSyncVisibleRegion.isEmpty())
+    {
+        /* Directly update synchronous visible-region: */
+        m_syncVisibleRegion = m_pendingSyncVisibleRegion;
+        m_pendingSyncVisibleRegion = QRegion();
+
+        /* And send async-signal to update asynchronous one: */
+        LogRel2(("GUI: UIFrameBufferPrivate::performResize: Rectangle count=%lu, Sending to async-handler\n",
+                 (unsigned long)m_syncVisibleRegion.rectCount()));
+        emit sigSetVisibleRegion(m_syncVisibleRegion);
+    }
 
-    /* Update 'HiDPI optimization type': */
-    m_hiDPIOptimizationType = optimizationType;
+    /* Make sure that the current screen image is immediately displayed: */
+    m_pMachineView->viewport()->update();
+
+    unlock();
 }
 
-void UIFrameBuffer::setBackingScaleFactor(double dBackingScaleFactor)
+void UIFrameBufferPrivate::performRescale()
 {
-    /* Make sure 'backing scale factor' changed: */
-    if (m_dBackingScaleFactor == dBackingScaleFactor)
-        return;
+//    printf("UIFrameBufferPrivate::performRescale\n");
+
+    /* Make sure machine-view is assigned: */
+    AssertPtrReturnVoid(m_pMachineView);
 
-    /* Update 'backing scale factor': */
-    m_dBackingScaleFactor = dBackingScaleFactor;
+    /* Depending on current visual state: */
+    switch (m_pMachineView->machineLogic()->visualStateType())
+    {
+        case UIVisualStateType_Scale:
+            m_scaledSize = m_scaledSize.width() == m_iWidth && m_scaledSize.height() == m_iHeight ? QSize() : m_scaledSize;
+            break;
+        default:
+            m_scaledSize = scaleFactor() == 1.0 ? QSize() : QSize((int)(m_iWidth * scaleFactor()), (int)(m_iHeight * scaleFactor()));
+            break;
+    }
+
+    /* Update coordinate-system: */
+    updateCoordinateSystem();
+
+//    printf("UIFrameBufferPrivate::performRescale: Complete: Scale-factor=%f, Scaled-size=%dx%d\n",
+//           scaleFactor(), scaledSize().width(), scaledSize().height());
 }
 
-void UIFrameBuffer::prepareConnections()
+void UIFrameBufferPrivate::prepareConnections()
 {
-    connect(this, SIGNAL(sigRequestResize(int, uchar*, int, int, int, int)),
-            m_pMachineView, SLOT(sltHandleRequestResize(int, uchar*, int, int, int, int)),
+    /* Attach EMT connections: */
+    connect(this, SIGNAL(sigNotifyChange(int, int)),
+            m_pMachineView, SLOT(sltHandleNotifyChange(int, int)),
             Qt::QueuedConnection);
     connect(this, SIGNAL(sigNotifyUpdate(int, int, int, int)),
             m_pMachineView, SLOT(sltHandleNotifyUpdate(int, int, int, int)),
@@ -627,10 +1303,11 @@ void UIFrameBuffer::prepareConnections()
             Qt::QueuedConnection);
 }
 
-void UIFrameBuffer::cleanupConnections()
+void UIFrameBufferPrivate::cleanupConnections()
 {
-    disconnect(this, SIGNAL(sigRequestResize(int, uchar*, int, int, int, int)),
-               m_pMachineView, SLOT(sltHandleRequestResize(int, uchar*, int, int, int, int)));
+    /* Detach EMT connections: */
+    disconnect(this, SIGNAL(sigNotifyChange(int, int)),
+               m_pMachineView, SLOT(sltHandleNotifyChange(int, int)));
     disconnect(this, SIGNAL(sigNotifyUpdate(int, int, int, int)),
                m_pMachineView, SLOT(sltHandleNotifyUpdate(int, int, int, int)));
     disconnect(this, SIGNAL(sigSetVisibleRegion(QRegion)),
@@ -639,3 +1316,448 @@ void UIFrameBuffer::cleanupConnections()
                m_pMachineView, SLOT(sltHandle3DOverlayVisibilityChange(bool)));
 }
 
+void UIFrameBufferPrivate::updateCoordinateSystem()
+{
+    /* Reset to default: */
+    m_transform = QTransform();
+
+    /* Apply the scale-factor if necessary: */
+    if (scaleFactor() != 1.0)
+        m_transform = m_transform.scale(scaleFactor(), scaleFactor());
+
+    /* Apply the backing-scale-factor if necessary: */
+    if (useUnscaledHiDPIOutput() && backingScaleFactor() > 1.0)
+        m_transform = m_transform.scale(1.0 / backingScaleFactor(), 1.0 / backingScaleFactor());
+}
+
+void UIFrameBufferPrivate::paintDefault(QPaintEvent *pEvent)
+{
+    /* Scaled image is NULL by default: */
+    QImage scaledImage;
+    /* But if scaled-factor is set and current image is NOT null: */
+    if (m_scaledSize.isValid() && !m_image.isNull())
+    {
+        /* We are doing a deep copy of the image to make sure it will not be
+         * detached during scale process, otherwise we can get a frozen frame-buffer. */
+        scaledImage = m_image.copy();
+        /* And scaling the image to predefined scaled-factor: */
+        scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio,
+                                         transformationMode(scalingOptimizationType()));
+    }
+    /* Finally we are choosing image to paint from: */
+    const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage;
+
+    /* Prepare the 'paint' rectangle: */
+    QRect paintRect = pEvent->rect();
+
+    /* Take the backing-scale-factor into account: */
+    if (useUnscaledHiDPIOutput() && backingScaleFactor() > 1.0)
+    {
+        paintRect.moveTo(paintRect.topLeft() * backingScaleFactor());
+        paintRect.setSize(paintRect.size() * backingScaleFactor());
+    }
+
+    /* Make sure paint-rectangle is within the image boundary: */
+    paintRect = paintRect.intersected(sourceImage.rect());
+    if (paintRect.isEmpty())
+        return;
+
+    /* Create painter: */
+    QPainter painter(m_pMachineView->viewport());
+
+    /* Draw image rectangle: */
+    drawImageRect(painter, sourceImage, paintRect,
+                  m_pMachineView->contentsX(), m_pMachineView->contentsY(),
+                  useUnscaledHiDPIOutput(), hiDPIOptimizationType(), backingScaleFactor());
+}
+
+void UIFrameBufferPrivate::paintSeamless(QPaintEvent *pEvent)
+{
+    /* Scaled image is NULL by default: */
+    QImage scaledImage;
+    /* But if scaled-factor is set and current image is NOT null: */
+    if (m_scaledSize.isValid() && !m_image.isNull())
+    {
+        /* We are doing a deep copy of the image to make sure it will not be
+         * detached during scale process, otherwise we can get a frozen frame-buffer. */
+        scaledImage = m_image.copy();
+        /* And scaling the image to predefined scaled-factor: */
+        scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio,
+                                         transformationMode(scalingOptimizationType()));
+    }
+    /* Finally we are choosing image to paint from: */
+    const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage;
+
+    /* Prepare the 'paint' rectangle: */
+    QRect paintRect = pEvent->rect();
+
+    /* Prepare seamless regions to erase/paint: */
+    lock();
+    const QRegion eraseRegion = QRegion(paintRect) - m_syncVisibleRegion;
+    const QRegion paintRegion = QRegion(paintRect) & m_syncVisibleRegion;
+    unlock();
+
+    /* Take the backing-scale-factor into account: */
+    if (useUnscaledHiDPIOutput() && backingScaleFactor() > 1.0)
+    {
+        paintRect.moveTo(paintRect.topLeft() * backingScaleFactor());
+        paintRect.setSize(paintRect.size() * backingScaleFactor());
+    }
+
+    /* Make sure paint-rectangle is within the image boundary: */
+    paintRect = paintRect.intersected(sourceImage.rect());
+    if (paintRect.isEmpty())
+        return;
+
+    /* Create painter: */
+    QPainter painter(m_pMachineView->viewport());
+
+    /* Apply painter clipping for erasing: */
+    painter.setClipRegion(eraseRegion);
+    /* Set composition-mode to erase: */
+    painter.setCompositionMode(QPainter::CompositionMode_Clear);
+    /* Erase rectangle: */
+    eraseImageRect(painter, paintRect,
+                   useUnscaledHiDPIOutput(), hiDPIOptimizationType(), backingScaleFactor());
+
+    /* Apply painter clipping for painting: */
+    painter.setClipRegion(paintRegion);
+    /* Set composition-mode to paint: */
+    painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
+#if defined(VBOX_WITH_TRANSLUCENT_SEAMLESS)
+# if defined(Q_WS_WIN) || defined(Q_WS_X11)
+    /* Replace translucent background with black one: */
+    painter.setCompositionMode(QPainter::CompositionMode_Source);
+    painter.fillRect(paintRect, QColor(Qt::black));
+    painter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
+# endif /* Q_WS_WIN || Q_WS_X11 */
+#endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS */
+    /* Paint rectangle: */
+    drawImageRect(painter, sourceImage, paintRect,
+                  m_pMachineView->contentsX(), m_pMachineView->contentsY(),
+                  useUnscaledHiDPIOutput(), hiDPIOptimizationType(), backingScaleFactor());
+}
+
+/* static */
+Qt::TransformationMode UIFrameBufferPrivate::transformationMode(ScalingOptimizationType type)
+{
+    switch (type)
+    {
+        case ScalingOptimizationType_Performance: return Qt::FastTransformation;
+        default: break;
+    }
+    return Qt::SmoothTransformation;
+}
+
+/* static */
+void UIFrameBufferPrivate::eraseImageRect(QPainter &painter, const QRect &rect,
+                                          bool fUseUnscaledHiDPIOutput,
+                                          HiDPIOptimizationType hiDPIOptimizationType,
+                                          double dBackingScaleFactor)
+{
+    /* Prepare sub-pixmap: */
+    QPixmap subPixmap = QPixmap(rect.width(), rect.height());
+
+    /* If HiDPI 'backing-scale-factor' defined: */
+    if (dBackingScaleFactor > 1.0)
+    {
+        /* Should we
+         * perform logical HiDPI scaling and optimize it for performance? */
+        if (!fUseUnscaledHiDPIOutput && hiDPIOptimizationType == HiDPIOptimizationType_Performance)
+        {
+            /* Adjust sub-pixmap: */
+            subPixmap = QPixmap((int)(rect.width() * dBackingScaleFactor),
+                                (int)(rect.height() * dBackingScaleFactor));
+        }
+
+#ifdef Q_WS_MAC
+# ifdef VBOX_GUI_WITH_HIDPI
+        /* Should we
+         * do not perform logical HiDPI scaling or
+         * perform logical HiDPI scaling and optimize it for performance? */
+        if (fUseUnscaledHiDPIOutput || hiDPIOptimizationType == HiDPIOptimizationType_Performance)
+        {
+            /* Mark sub-pixmap as HiDPI: */
+            subPixmap.setDevicePixelRatio(dBackingScaleFactor);
+        }
+# endif /* VBOX_GUI_WITH_HIDPI */
+#endif /* Q_WS_MAC */
+    }
+
+    /* Which point we should draw corresponding sub-pixmap? */
+    QPointF paintPoint = rect.topLeft();
+
+    /* Take the backing-scale-factor into account: */
+    if (fUseUnscaledHiDPIOutput && dBackingScaleFactor > 1.0)
+        paintPoint /= dBackingScaleFactor;
+
+    /* Draw sub-pixmap: */
+    painter.drawPixmap(paintPoint, subPixmap);
+}
+
+/* static */
+void UIFrameBufferPrivate::drawImageRect(QPainter &painter, const QImage &image, const QRect &rect,
+                                         int iContentsShiftX, int iContentsShiftY,
+                                         bool fUseUnscaledHiDPIOutput,
+                                         HiDPIOptimizationType hiDPIOptimizationType,
+                                         double dBackingScaleFactor)
+{
+    /* Calculate offset: */
+    size_t offset = (rect.x() + iContentsShiftX) * image.depth() / 8 +
+                    (rect.y() + iContentsShiftY) * image.bytesPerLine();
+
+    /* Restrain boundaries: */
+    int iSubImageWidth = qMin(rect.width(), image.width() - rect.x() - iContentsShiftX);
+    int iSubImageHeight = qMin(rect.height(), image.height() - rect.y() - iContentsShiftY);
+
+    /* Create sub-image (no copy involved): */
+    QImage subImage = QImage(image.bits() + offset,
+                             iSubImageWidth, iSubImageHeight,
+                             image.bytesPerLine(), image.format());
+
+    /* Create sub-pixmap on the basis of sub-image above (1st copy involved): */
+    QPixmap subPixmap = QPixmap::fromImage(subImage);
+
+    /* If HiDPI 'backing-scale-factor' defined: */
+    if (dBackingScaleFactor > 1.0)
+    {
+        /* Should we
+         * perform logical HiDPI scaling and optimize it for performance? */
+        if (!fUseUnscaledHiDPIOutput && hiDPIOptimizationType == HiDPIOptimizationType_Performance)
+        {
+            /* Fast scale sub-pixmap (2nd copy involved): */
+            subPixmap = subPixmap.scaled(subPixmap.size() * dBackingScaleFactor,
+                                         Qt::IgnoreAspectRatio, Qt::FastTransformation);
+        }
+
+#ifdef Q_WS_MAC
+# ifdef VBOX_GUI_WITH_HIDPI
+        /* Should we
+         * do not perform logical HiDPI scaling or
+         * perform logical HiDPI scaling and optimize it for performance? */
+        if (fUseUnscaledHiDPIOutput || hiDPIOptimizationType == HiDPIOptimizationType_Performance)
+        {
+            /* Mark sub-pixmap as HiDPI: */
+            subPixmap.setDevicePixelRatio(dBackingScaleFactor);
+        }
+# endif /* VBOX_GUI_WITH_HIDPI */
+#endif /* Q_WS_MAC */
+    }
+
+    /* Which point we should draw corresponding sub-pixmap? */
+    QPointF paintPoint = rect.topLeft();
+
+    /* Take the backing-scale-factor into account: */
+    if (fUseUnscaledHiDPIOutput && dBackingScaleFactor > 1.0)
+        paintPoint /= dBackingScaleFactor;
+
+    /* Draw sub-pixmap: */
+    painter.drawPixmap(paintPoint, subPixmap);
+}
+
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+UIFrameBuffer::UIFrameBuffer(bool m_fAccelerate2DVideo)
+{
+    if (m_fAccelerate2DVideo)
+    {
+        ComObjPtr<VBoxOverlayFrameBuffer> pFrameBuffer;
+        pFrameBuffer.createObject();
+        m_pFrameBuffer = pFrameBuffer;
+    }
+    else
+    {
+        m_pFrameBuffer.createObject();
+    }
+}
+#else /* !VBOX_WITH_VIDEOHWACCEL */
+UIFrameBuffer::UIFrameBuffer()
+{
+    m_pFrameBuffer.createObject();
+}
+#endif /* !VBOX_WITH_VIDEOHWACCEL */
+
+UIFrameBuffer::~UIFrameBuffer()
+{
+    m_pFrameBuffer.setNull();
+}
+
+HRESULT UIFrameBuffer::init(UIMachineView *pMachineView)
+{
+    return m_pFrameBuffer->init(pMachineView);
+}
+
+void UIFrameBuffer::attach()
+{
+    m_pFrameBuffer->attach();
+}
+
+void UIFrameBuffer::detach()
+{
+    m_pFrameBuffer->detach();
+}
+
+uchar* UIFrameBuffer::address()
+{
+    return m_pFrameBuffer->address();
+}
+
+ulong UIFrameBuffer::width() const
+{
+    return m_pFrameBuffer->width();
+}
+
+ulong UIFrameBuffer::height() const
+{
+    return m_pFrameBuffer->height();
+}
+
+ulong UIFrameBuffer::bitsPerPixel() const
+{
+    return m_pFrameBuffer->bitsPerPixel();
+}
+
+ulong UIFrameBuffer::bytesPerLine() const
+{
+    return m_pFrameBuffer->bytesPerLine();
+}
+
+UIVisualStateType UIFrameBuffer::visualState() const
+{
+    return m_pFrameBuffer->visualState();
+}
+
+void UIFrameBuffer::setView(UIMachineView *pMachineView)
+{
+    m_pFrameBuffer->setView(pMachineView);
+}
+
+void UIFrameBuffer::setMarkAsUnused(bool fUnused)
+{
+    m_pFrameBuffer->setMarkAsUnused(fUnused);
+}
+
+bool UIFrameBuffer::isAutoEnabled() const
+{
+    return m_pFrameBuffer->isAutoEnabled();
+}
+
+void UIFrameBuffer::setAutoEnabled(bool fAutoEnabled)
+{
+    m_pFrameBuffer->setAutoEnabled(fAutoEnabled);
+}
+
+QSize UIFrameBuffer::scaledSize() const
+{
+    return m_pFrameBuffer->scaledSize();
+}
+
+void UIFrameBuffer::setScaledSize(const QSize &size /* = QSize() */)
+{
+    m_pFrameBuffer->setScaledSize(size);
+}
+
+int UIFrameBuffer::convertHostXTo(int iX) const
+{
+    return m_pFrameBuffer->convertHostXTo(iX);
+}
+
+int UIFrameBuffer::convertHostYTo(int iY) const
+{
+    return m_pFrameBuffer->convertHostXTo(iY);
+}
+
+double UIFrameBuffer::scaleFactor() const
+{
+    return m_pFrameBuffer->scaleFactor();
+}
+
+void UIFrameBuffer::setScaleFactor(double dScaleFactor)
+{
+    m_pFrameBuffer->setScaleFactor(dScaleFactor);
+}
+
+double UIFrameBuffer::backingScaleFactor() const
+{
+    return m_pFrameBuffer->backingScaleFactor();
+}
+
+void UIFrameBuffer::setBackingScaleFactor(double dBackingScaleFactor)
+{
+    m_pFrameBuffer->setBackingScaleFactor(dBackingScaleFactor);
+}
+
+bool UIFrameBuffer::useUnscaledHiDPIOutput() const
+{
+    return m_pFrameBuffer->useUnscaledHiDPIOutput();
+}
+
+void UIFrameBuffer::setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput)
+{
+    m_pFrameBuffer->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);
+}
+
+ScalingOptimizationType UIFrameBuffer::scalingOptimizationType() const
+{
+    return m_pFrameBuffer->scalingOptimizationType();
+}
+
+void UIFrameBuffer::setScalingOptimizationType(ScalingOptimizationType type)
+{
+    m_pFrameBuffer->setScalingOptimizationType(type);
+}
+
+HiDPIOptimizationType UIFrameBuffer::hiDPIOptimizationType() const
+{
+    return m_pFrameBuffer->hiDPIOptimizationType();
+}
+
+void UIFrameBuffer::setHiDPIOptimizationType(HiDPIOptimizationType type)
+{
+    m_pFrameBuffer->setHiDPIOptimizationType(type);
+}
+
+void UIFrameBuffer::handleNotifyChange(int iWidth, int iHeight)
+{
+    m_pFrameBuffer->handleNotifyChange(iWidth, iHeight);
+}
+
+void UIFrameBuffer::handlePaintEvent(QPaintEvent *pEvent)
+{
+    m_pFrameBuffer->handlePaintEvent(pEvent);
+}
+
+void UIFrameBuffer::handleSetVisibleRegion(const QRegion &region)
+{
+    m_pFrameBuffer->handleSetVisibleRegion(region);
+}
+
+void UIFrameBuffer::performResize(int iWidth, int iHeight)
+{
+    m_pFrameBuffer->performResize(iWidth, iHeight);
+}
+
+void UIFrameBuffer::performRescale()
+{
+    m_pFrameBuffer->performRescale();
+}
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+void UIFrameBuffer::doProcessVHWACommand(QEvent *pEvent)
+{
+    m_pFrameBuffer->doProcessVHWACommand(pEvent);
+}
+
+void UIFrameBuffer::viewportResized(QResizeEvent *pEvent)
+{
+    m_pFrameBuffer->viewportResized(pEvent);
+}
+
+void UIFrameBuffer::viewportScrolled(int iX, int iY)
+{
+    m_pFrameBuffer->viewportScrolled(iX, iY);
+}
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+
+#include "UIFrameBuffer.moc"
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
index 384c793..f38e503 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
@@ -1,9 +1,10 @@
+/* $Id: UIFrameBuffer.h $ */
 /** @file
  * VBox Qt GUI - UIFrameBuffer class declaration.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,245 +19,137 @@
 #define ___UIFrameBuffer_h___
 
 /* Qt includes: */
-#include <QRegion>
-#include <QPaintEvent>
+#include <QSize>
 
 /* GUI includes: */
-#include "UIDefs.h"
-
-/* COM includes: */
-#include "CFramebuffer.h"
+#include "UIExtraDataDefs.h"
 
 /* Other VBox includes: */
-#include <iprt/critsect.h>
+#include <VBox/com/ptr.h>
 
 /* Forward declarations: */
+class UIFrameBufferPrivate;
 class UIMachineView;
+class QResizeEvent;
+class QPaintEvent;
+class QRegion;
 
-/**
- *  Frame buffer resize event.
- */
-class UIResizeEvent : public QEvent
-{
-public:
-
-    UIResizeEvent(ulong uPixelFormat, uchar *pVRAM,
-                  ulong uBitsPerPixel, ulong uBytesPerLine,
-                  ulong uWidth, ulong uHeight)
-        : QEvent((QEvent::Type)ResizeEventType)
-        , m_uPixelFormat(uPixelFormat), m_pVRAM(pVRAM), m_uBitsPerPixel(uBitsPerPixel)
-        , m_uBytesPerLine(uBytesPerLine), m_uWidth(uWidth), m_uHeight(uHeight) {}
-    ulong pixelFormat() { return m_uPixelFormat; }
-    uchar *VRAM() { return m_pVRAM; }
-    ulong bitsPerPixel() { return m_uBitsPerPixel; }
-    ulong bytesPerLine() { return m_uBytesPerLine; }
-    ulong width() { return m_uWidth; }
-    ulong height() { return m_uHeight; }
-
-private:
-
-    ulong m_uPixelFormat;
-    uchar *m_pVRAM;
-    ulong m_uBitsPerPixel;
-    ulong m_uBytesPerLine;
-    ulong m_uWidth;
-    ulong m_uHeight;
-};
-
-/**
- *  Common IFramebuffer implementation for all methods used by GUI to maintain
- *  the VM display video memory.
- *
- *  Note that although this class can be called from multiple threads
- *  (in particular, the GUI thread and EMT) it doesn't protect access to every
- *  data field using its mutex lock. This is because all synchronization between
- *  the GUI and the EMT thread is supposed to be done using the
- *  IFramebuffer::NotifyUpdate() and IFramebuffer::RequestResize() methods
- *  (in particular, the \a aFinished parameter of these methods is responsible
- *  for the synchronization). These methods are always called on EMT and
- *  therefore always follow one another but never in parallel.
- *
- *  Using this object's mutex lock (exposed also in IFramebuffer::Lock() and
- *  IFramebuffer::Unlock() implementations) usually makes sense only if some
- *  third-party thread (i.e. other than GUI or EMT) needs to make sure that
- *  *no* VM display update or resize event can occur while it is accessing
- *  IFramebuffer properties or the underlying display memory storage area.
- *
- *  See IFramebuffer documentation for more info.
- */
-class UIFrameBuffer : public QObject, VBOX_SCRIPTABLE_IMPL(IFramebuffer)
+/** IFramebuffer implementation used to maintain VM display video memory. */
+class UIFrameBuffer : public QObject
 {
     Q_OBJECT;
 
-signals:
-
-    /* Notifiers: EMT<->GUI interthread stuff: */
-    void sigRequestResize(int iPixelFormat, uchar *pVRAM,
-                          int iBitsPerPixel, int iBytesPerLine,
-                          int iWidth, int iHeight);
-    void sigNotifyUpdate(int iX, int iY, int iWidth, int iHeight);
-    void sigSetVisibleRegion(QRegion region);
-    void sigNotifyAbout3DOverlayVisibilityChange(bool fVisible);
-
 public:
 
-    UIFrameBuffer(UIMachineView *aView);
-    virtual ~UIFrameBuffer();
-
-    /* API: [Un]used status stuff: */
-    void setMarkAsUnused(bool fIsMarkAsUnused);
-
-    /* API: Auto-enabled stuff: */
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    /** Frame-buffer constructor.
+      * @param m_fAccelerate2DVideo defines whether we should use VBoxOverlayFrameBuffer
+      *                             instead of the default one. */
+    UIFrameBuffer(bool m_fAccelerate2DVideo);
+#else /* !VBOX_WITH_VIDEOHWACCEL */
+    /** Frame-buffer constructor. */
+    UIFrameBuffer();
+#endif /* !VBOX_WITH_VIDEOHWACCEL */
+
+    /** Frame-buffer destructor. */
+    ~UIFrameBuffer();
+
+    /** Frame-buffer initialization.
+      * @param pMachineView defines machine-view this frame-buffer is bounded to. */
+    HRESULT init(UIMachineView *pMachineView);
+
+    /** Assigns machine-view frame-buffer will be bounded to.
+      * @param pMachineView defines machine-view this frame-buffer is bounded to. */
+    void setView(UIMachineView *pMachineView);
+
+    /** Attach frame-buffer to the Display. */
+    void attach();
+    /** Detach frame-buffer from the Display. */
+    void detach();
+
+    /** Returns frame-buffer data address. */
+    uchar* address();
+    /** Returns frame-buffer width. */
+    ulong width() const;
+    /** Returns frame-buffer height. */
+    ulong height() const;
+    /** Returns frame-buffer bits-per-pixel value. */
+    ulong bitsPerPixel() const;
+    /** Returns frame-buffer bytes-per-line value. */
+    ulong bytesPerLine() const;
+    /** Returns the visual-state this frame-buffer is used for. */
+    UIVisualStateType visualState() const;
+
+    /** Defines whether frame-buffer is <b>unused</b>.
+      * @note Calls to this and any other EMT callback are synchronized (from GUI side). */
+    void setMarkAsUnused(bool fUnused);
+
+    /** Returns whether frame-buffer is <b>auto-enabled</b>.
+      * @note Refer to m_fAutoEnabled for more information. */
     bool isAutoEnabled() const;
-    void setAutoEnabled(bool fIsAutoEnabled);
-
-    NS_DECL_ISUPPORTS
-
-#ifdef Q_OS_WIN
-    STDMETHOD_(ULONG, AddRef)()
-    {
-        return ::InterlockedIncrement(&m_iRefCnt);
-    }
-
-    STDMETHOD_(ULONG, Release)()
-    {
-        long cnt = ::InterlockedDecrement(&m_iRefCnt);
-        if (cnt == 0)
-            delete this;
-        return cnt;
-    }
-#endif /* Q_OS_WIN */
-
-    VBOX_SCRIPTABLE_DISPATCH_IMPL(IFramebuffer)
-
-    /* IFramebuffer COM methods */
-    STDMETHOD(COMGETTER(Address)) (BYTE **ppAddress);
-    STDMETHOD(COMGETTER(Width)) (ULONG *puWidth);
-    STDMETHOD(COMGETTER(Height)) (ULONG *puHeight);
-    STDMETHOD(COMGETTER(BitsPerPixel)) (ULONG *puBitsPerPixel);
-    STDMETHOD(COMGETTER(BytesPerLine)) (ULONG *puBytesPerLine);
-    STDMETHOD(COMGETTER(PixelFormat)) (ULONG *puPixelFormat);
-    STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *pbUsesGuestVRAM);
-    STDMETHOD(COMGETTER(HeightReduction)) (ULONG *puHeightReduction);
-    STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **ppOverlay);
-    STDMETHOD(COMGETTER(WinId)) (LONG64 *pWinId);
-
-    STDMETHOD(Lock)();
-    STDMETHOD(Unlock)();
-
-    STDMETHOD(RequestResize) (ULONG uScreenId, ULONG uPixelFormat,
-                              BYTE *pVRAM, ULONG uBitsPerPixel, ULONG uBytesPerLine,
-                              ULONG uWidth, ULONG uHeight,
-                              BOOL *pbFinished);
-
-    STDMETHOD(NotifyUpdate) (ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight);
-
-    STDMETHOD(VideoModeSupported) (ULONG uWidth, ULONG uHeight, ULONG uBPP,
-                                   BOOL *pbSupported);
-
-    STDMETHOD(GetVisibleRegion)(BYTE *pRectangles, ULONG uCount, ULONG *puCountCopied);
-    STDMETHOD(SetVisibleRegion)(BYTE *pRectangles, ULONG uCount);
-
-    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand);
-
-    STDMETHOD(Notify3DEvent)(ULONG uType, BYTE *pData);
-
-    ulong width() { return m_width; }
-    ulong height() { return m_height; }
-
-    inline int convertGuestXTo(int x) const { return m_scaledSize.isValid() ? qRound((double)m_scaledSize.width() / m_width * x) : x; }
-    inline int convertGuestYTo(int y) const { return m_scaledSize.isValid() ? qRound((double)m_scaledSize.height() / m_height * y) : y; }
-    inline int convertHostXTo(int x) const  { return m_scaledSize.isValid() ? qRound((double)m_width / m_scaledSize.width() * x) : x; }
-    inline int convertHostYTo(int y) const  { return m_scaledSize.isValid() ? qRound((double)m_height / m_scaledSize.height() * y) : y; }
-
-    virtual QSize scaledSize() const { return m_scaledSize; }
-    virtual void setScaledSize(const QSize &size = QSize()) { m_scaledSize = size; }
-
-    virtual ulong pixelFormat()
-    {
-        return FramebufferPixelFormat_FOURCC_RGB;
-    }
-
-    virtual bool usesGuestVRAM()
-    {
-        return false;
-    }
-
-    void lock() const { RTCritSectEnter(&m_critSect); }
-    void unlock() const { RTCritSectLeave(&m_critSect); }
-
-    virtual uchar *address() = 0;
-    virtual ulong bitsPerPixel() = 0;
-    virtual ulong bytesPerLine() = 0;
+    /** Defines whether frame-buffer is <b>auto-enabled</b>.
+      * @note Refer to m_fAutoEnabled for more information. */
+    void setAutoEnabled(bool fAutoEnabled);
+
+    /** Returns the frame-buffer's scaled-size. */
+    QSize scaledSize() const;
+    /** Defines host-to-guest scale ratio as @a size. */
+    void setScaledSize(const QSize &size = QSize());
+    /** Returns x-origin of the guest (actual) content corresponding to x-origin of host (scaled) content. */
+    int convertHostXTo(int iX) const;
+    /** Returns y-origin of the guest (actual) content corresponding to y-origin of host (scaled) content. */
+    int convertHostYTo(int iY) const;
+
+    /** Returns the scale-factor used by the frame-buffer. */
+    double scaleFactor() const;
+    /** Define the scale-factor used by the frame-buffer. */
+    void setScaleFactor(double dScaleFactor);
+
+    /** Returns backing-scale-factor used by HiDPI frame-buffer. */
+    double backingScaleFactor() const;
+    /** Defines backing-scale-factor used by HiDPI frame-buffer. */
+    void setBackingScaleFactor(double dBackingScaleFactor);
 
-    /* API: Event-delegate stuff: */
-    virtual void moveEvent(QMoveEvent* /*pEvent*/) {}
-    virtual void resizeEvent(UIResizeEvent *pEvent) = 0;
-    virtual void paintEvent(QPaintEvent *pEvent) = 0;
-    virtual void applyVisibleRegion(const QRegion &region);
+    /** Returns whether frame-buffer should use unscaled HiDPI output. */
+    bool useUnscaledHiDPIOutput() const;
+    /** Defines whether frame-buffer should use unscaled HiDPI output. */
+    void setUseUnscaledHiDPIOutput(bool fUseUnscaledHiDPIOutput);
+
+    /** Returns the frame-buffer scaling optimization type. */
+    ScalingOptimizationType scalingOptimizationType() const;
+    /** Defines the frame-buffer scaling optimization type. */
+    void setScalingOptimizationType(ScalingOptimizationType type);
+
+    /** Returns HiDPI frame-buffer optimization type. */
+    HiDPIOptimizationType hiDPIOptimizationType() const;
+    /** Defines HiDPI frame-buffer optimization type: */
+    void setHiDPIOptimizationType(HiDPIOptimizationType type);
+
+    /** Handles frame-buffer notify-change-event. */
+    void handleNotifyChange(int iWidth, int iHeight);
+    /** Handles frame-buffer paint-event. */
+    void handlePaintEvent(QPaintEvent *pEvent);
+    /** Handles frame-buffer set-visible-region-event. */
+    void handleSetVisibleRegion(const QRegion &region);
+
+    /** Performs frame-buffer resizing. */
+    void performResize(int iWidth, int iHeight);
+    /** Performs frame-buffer rescaling. */
+    void performRescale();
 
 #ifdef VBOX_WITH_VIDEOHWACCEL
-    /* this method is called from the GUI thread
-     * to perform the actual Video HW Acceleration command processing
-     * the event is framebuffer implementation specific */
-    virtual void doProcessVHWACommand(QEvent * pEvent);
-
-    virtual void viewportResized(QResizeEvent * /* pEvent */) {}
-
-    virtual void viewportScrolled(int /* iX */, int /* iY */) {}
+    /** Performs Video HW Acceleration command. */
+    void doProcessVHWACommand(QEvent *pEvent);
+    /** Handles viewport resize-event. */
+    void viewportResized(QResizeEvent *pEvent);
+    /** Handles viewport scroll-event. */
+    void viewportScrolled(int iX, int iY);
 #endif /* VBOX_WITH_VIDEOHWACCEL */
 
-    virtual void setView(UIMachineView * pView);
-
-    /** Return HiDPI frame-buffer optimization type. */
-    HiDPIOptimizationType hiDPIOptimizationType() const { return m_hiDPIOptimizationType; }
-    /** Define HiDPI frame-buffer optimization type: */
-    void setHiDPIOptimizationType(HiDPIOptimizationType optimizationType);
-
-    /** Return backing scale factor used by HiDPI frame-buffer. */
-    double backingScaleFactor() const { return m_dBackingScaleFactor; }
-    /** Define backing scale factor used by HiDPI frame-buffer. */
-    void setBackingScaleFactor(double dBackingScaleFactor);
-
-protected:
-
-    UIMachineView *m_pMachineView;
-    mutable RTCRITSECT m_critSect;
-    ulong m_width;
-    ulong m_height;
-    QSize m_scaledSize;
-    int64_t m_WinId;
-    bool m_fIsMarkedAsUnused;
-    bool m_fIsAutoEnabled;
-
-    /* To avoid a seamless flicker,
-     * which caused by the latency between the
-     * initial visible-region arriving from EMT thread
-     * and actual visible-region application on GUI thread
-     * it was decided to use two visible-region instances:
-     * 1. 'Sync-one' which being updated synchronously by locking EMT thread,
-     *               and used for immediate manual clipping of the painting operations.
-     * 2. 'Async-one' which updated asynchronously by posting async-event from EMT to GUI thread,
-                      which is used to update viewport parts for visible-region changes,
-                      because NotifyUpdate doesn't take into account these changes. */
-    QRegion m_syncVisibleRegion;
-    QRegion m_asyncVisibleRegion;
-
 private:
 
-    /* Helpers: Prepare/cleanup stuff: */
-    void prepareConnections();
-    void cleanupConnections();
-
-#ifdef Q_OS_WIN
-    long m_iRefCnt;
-#endif /* Q_OS_WIN */
-
-    /** Holds HiDPI frame-buffer optimization type. */
-    HiDPIOptimizationType m_hiDPIOptimizationType;
-
-    /** Holds backing scale factor used by HiDPI frame-buffer. */
-    double m_dBackingScaleFactor;
+    /** Holds the frame-buffer private instance. */
+    ComObjPtr<UIFrameBufferPrivate> m_pFrameBuffer;
 };
 
-#endif // !___UIFrameBuffer_h___
+#endif /* !___UIFrameBuffer_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
deleted file mode 100644
index ee69e82..0000000
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
+++ /dev/null
@@ -1,389 +0,0 @@
-/* $Id: UIFrameBufferQImage.cpp $ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIFrameBufferQImage class implementation
- */
-
-/*
- * Copyright (C) 2010-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifdef VBOX_GUI_USE_QIMAGE
-
-#ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
-#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
-/* Qt includes: */
-# include <QPainter>
-# include <QApplication>
-
-/* GUI includes: */
-# include "UIFrameBufferQImage.h"
-# include "UIPopupCenter.h"
-# include "VBoxGlobal.h"
-# include "UISession.h"
-# include "UIMachineLogic.h"
-# include "UIMachineWindow.h"
-# include "UIMachineView.h"
-
-/* COM includes: */
-#include "COMEnums.h"
-#include "CMachine.h"
-#include "CConsole.h"
-
-#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
-UIFrameBufferQImage::UIFrameBufferQImage(UIMachineView *pMachineView)
-    : UIFrameBuffer(pMachineView)
-{
-    /* Initialize the framebuffer: */
-    UIResizeEvent event(FramebufferPixelFormat_Opaque, NULL, 0, 0, 640, 480);
-    resizeEvent(&event);
-}
-
-void UIFrameBufferQImage::resizeEvent(UIResizeEvent *pEvent)
-{
-    LogRel(("UIFrameBufferQImage::resizeEvent: "
-            "Format=%lu, BitsPerPixel=%lu, BytesPerLine=%lu, Size=%lux%lu\n",
-            (unsigned long)pEvent->pixelFormat(),
-            (unsigned long)pEvent->bitsPerPixel(),
-            (unsigned long)pEvent->bytesPerLine(),
-            (unsigned long)pEvent->width(),
-            (unsigned long)pEvent->height()));
-
-    /* Invalidate visible-region if necessary: */
-    if (m_pMachineView->machineLogic()->visualStateType() == UIVisualStateType_Seamless &&
-        (m_width != pEvent->width() || m_height != pEvent->height()))
-    {
-        lock();
-        m_syncVisibleRegion = QRegion();
-        m_asyncVisibleRegion = QRegion();
-        unlock();
-    }
-
-    /* Remember new width/height: */
-    m_width = pEvent->width();
-    m_height = pEvent->height();
-
-    /* Check if we support the pixel format and can use the guest VRAM directly: */
-    bool bRemind = false;
-    bool bFallback = false;
-    ulong bitsPerLine = pEvent->bytesPerLine() * 8;
-    if (pEvent->pixelFormat() == FramebufferPixelFormat_FOURCC_RGB)
-    {
-        QImage::Format format;
-        switch (pEvent->bitsPerPixel())
-        {
-            /* 32-, 8- and 1-bpp are the only depths supported by QImage: */
-            case 32:
-                format = QImage::Format_RGB32;
-                break;
-            case 8:
-                format = QImage::Format_Indexed8;
-                bRemind = true;
-                break;
-            case 1:
-                format = QImage::Format_Mono;
-                bRemind = true;
-                break;
-            default:
-                format = QImage::Format_Invalid;
-                bRemind = true;
-                bFallback = true;
-                break;
-        }
-
-        if (!bFallback)
-        {
-            /* QImage only supports 32-bit aligned scan lines... */
-            Assert((pEvent->bytesPerLine() & 3) == 0);
-            bFallback = ((pEvent->bytesPerLine() & 3) != 0);
-        }
-        if (!bFallback)
-        {
-            /* ...and the scan lines ought to be a whole number of pixels. */
-            Assert((bitsPerLine & (pEvent->bitsPerPixel() - 1)) == 0);
-            bFallback = ((bitsPerLine & (pEvent->bitsPerPixel() - 1)) != 0);
-        }
-        if (!bFallback)
-        {
-            /* Make sure constraints are also passed: */
-            Assert(bitsPerLine / pEvent->bitsPerPixel() >= m_width);
-            bFallback = RT_BOOL(bitsPerLine / pEvent->bitsPerPixel() < m_width);
-        }
-        if (!bFallback)
-        {
-            /* Finally compose image using VRAM directly: */
-            LogRel(("UIFrameBufferQImage::resizeEvent: Resizing to directly use VGA device content..\n"));
-            m_img = QImage((uchar *)pEvent->VRAM(), m_width, m_height, bitsPerLine / 8, format);
-            m_uPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
-            m_bUsesGuestVRAM = true;
-        }
-    }
-    else
-        bFallback = true;
-
-    /* Fallback if requested: */
-    if (bFallback)
-    {
-        LogRel(("UIFrameBufferQImage::resizeEvent: Resizing to FALLBACK buffer due to format is invalid..\n"));
-        goFallback();
-    }
-
-    /* Remind if requested: */
-    /* This check (supports graphics) is not quite right due to past mistakes
-     * in the Guest Additions protocol, but in practice it should be fine. */
-    if (bRemind && m_pMachineView->uisession()->isGuestSupportsGraphics())
-        popupCenter().remindAboutWrongColorDepth(m_pMachineView->machineWindow(),
-                                                      pEvent->bitsPerPixel(), 32);
-    else
-        popupCenter().forgetAboutWrongColorDepth(m_pMachineView->machineWindow());
-}
-
-void UIFrameBufferQImage::paintEvent(QPaintEvent *pEvent)
-{
-    LogRel2(("UIFrameBufferQImage::paintEvent: "
-             "Origin=%lux%lu, Size=%lux%lu\n",
-             (unsigned long)pEvent->rect().x(),
-             (unsigned long)pEvent->rect().y(),
-             (unsigned long)pEvent->rect().width(),
-             (unsigned long)pEvent->rect().height()));
-
-    /* On mode switch the enqueued paint event may still come
-     * while the view is already null (before the new view gets set),
-     * ignore paint event in that case. */
-    if (!m_pMachineView)
-        return;
-
-    /* If the machine is NOT in 'running', 'paused' or 'saving' state,
-     * the link between the framebuffer and the video memory is broken.
-     * We should go fallback in that case.
-     * We should acquire actual machine-state to exclude
-     * situations when the state was changed already but
-     * GUI didn't received event about that or didn't processed it yet. */
-    KMachineState machineState = m_pMachineView->uisession()->session().GetConsole().GetState();
-    if (   m_bUsesGuestVRAM
-        /* running */
-        && machineState != KMachineState_Running
-        && machineState != KMachineState_Teleporting
-        && machineState != KMachineState_LiveSnapshotting
-        && machineState != KMachineState_DeletingSnapshotOnline
-        /* paused */
-        && machineState != KMachineState_Paused
-        && machineState != KMachineState_TeleportingPausedVM
-        /* saving */
-        && machineState != KMachineState_Saving
-        /* guru */
-        && machineState != KMachineState_Stuck
-        )
-    {
-        LogRel2(("UIFrameBufferQImage::paintEvent: "
-                 "Going fallback due to machine-state become invalid: "
-                 "%d.\n", (int)machineState));
-        goFallback();
-    }
-
-    /* Depending on visual-state type: */
-    switch (m_pMachineView->machineLogic()->visualStateType())
-    {
-        case UIVisualStateType_Seamless:
-            paintSeamless(pEvent);
-            break;
-        case UIVisualStateType_Scale:
-            paintScale(pEvent);
-            break;
-        default:
-            paintDefault(pEvent);
-            break;
-    }
-}
-
-void UIFrameBufferQImage::paintDefault(QPaintEvent *pEvent)
-{
-    /* Get rectangle to paint: */
-    QRect paintRect = pEvent->rect().intersected(m_img.rect()).intersected(m_pMachineView->viewport()->geometry());
-    if (paintRect.isEmpty())
-        return;
-
-    /* Create painter: */
-    QPainter painter(m_pMachineView->viewport());
-
-    /* Draw image rectangle: */
-    drawImageRect(painter, m_img, paintRect,
-                  m_pMachineView->contentsX(), m_pMachineView->contentsY(),
-                  hiDPIOptimizationType(), backingScaleFactor());
-}
-
-void UIFrameBufferQImage::paintSeamless(QPaintEvent *pEvent)
-{
-    /* Get rectangle to paint: */
-    QRect paintRect = pEvent->rect().intersected(m_img.rect()).intersected(m_pMachineView->viewport()->geometry());
-    if (paintRect.isEmpty())
-        return;
-
-    /* Create painter: */
-    QPainter painter(m_pMachineView->viewport());
-
-    /* Determine the region to erase: */
-    lock();
-    QRegion regionToErase = (QRegion)paintRect - m_syncVisibleRegion;
-    unlock();
-    if (!regionToErase.isEmpty())
-    {
-        /* Optimize composition-mode: */
-        painter.setCompositionMode(QPainter::CompositionMode_Clear);
-        /* Erase required region, slowly, rectangle-by-rectangle: */
-        foreach (const QRect &rect, regionToErase.rects())
-            painter.eraseRect(rect);
-        /* Restore composition-mode: */
-        painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
-    }
-
-    /* Determine the region to paint: */
-    lock();
-    QRegion regionToPaint = (QRegion)paintRect & m_syncVisibleRegion;
-    unlock();
-    if (!regionToPaint.isEmpty())
-    {
-        /* Paint required region, slowly, rectangle-by-rectangle: */
-        foreach (const QRect &rect, regionToPaint.rects())
-        {
-#if defined(VBOX_WITH_TRANSLUCENT_SEAMLESS) && defined(Q_WS_WIN)
-            /* Replace translucent background with black one,
-             * that is necessary for window with Qt::WA_TranslucentBackground: */
-            painter.setCompositionMode(QPainter::CompositionMode_Source);
-            painter.fillRect(rect, QColor(Qt::black));
-            painter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
-#endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS && Q_WS_WIN */
-
-            /* Draw image rectangle: */
-            drawImageRect(painter, m_img, rect,
-                          m_pMachineView->contentsX(), m_pMachineView->contentsY(),
-                          hiDPIOptimizationType(), backingScaleFactor());
-        }
-    }
-}
-
-void UIFrameBufferQImage::paintScale(QPaintEvent *pEvent)
-{
-    /* Scaled image is NULL by default: */
-    QImage scaledImage;
-    /* But if scaled-factor is set and current image is NOT null: */
-    if (m_scaledSize.isValid() && !m_img.isNull())
-    {
-        /* We are doing a deep copy of the image to make sure it will not be
-         * detached during scale process, otherwise we can get a frozen frame-buffer. */
-        scaledImage = m_img.copy();
-        /* And scaling the image to predefined scaled-factor: */
-        scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-    }
-    /* Finally we are choosing image to paint from: */
-    QImage &sourceImage = scaledImage.isNull() ? m_img : scaledImage;
-
-    /* Get rectangle to paint: */
-    QRect paintRect = pEvent->rect().intersected(sourceImage.rect()).intersected(m_pMachineView->viewport()->geometry());
-    if (paintRect.isEmpty())
-        return;
-
-    /* Create painter: */
-    QPainter painter(m_pMachineView->viewport());
-
-    /* Draw image rectangle: */
-    drawImageRect(painter, sourceImage, paintRect,
-                  m_pMachineView->contentsX(), m_pMachineView->contentsY(),
-                  hiDPIOptimizationType(), backingScaleFactor());
-}
-
-/* static */
-void UIFrameBufferQImage::drawImageRect(QPainter &painter, const QImage &image, const QRect &rect,
-                                        int iContentsShiftX, int iContentsShiftY,
-                                        HiDPIOptimizationType hiDPIOptimizationType,
-                                        double dBackingScaleFactor)
-{
-    /* Calculate offset: */
-    size_t offset = (rect.x() + iContentsShiftX) * image.depth() / 8 +
-                    (rect.y() + iContentsShiftY) * image.bytesPerLine();
-
-    /* Restrain boundaries: */
-    int iSubImageWidth = qMin(rect.width(), image.width() - rect.x() - iContentsShiftX);
-    int iSubImageHeight = qMin(rect.height(), image.height() - rect.y() - iContentsShiftY);
-
-    /* Create sub-image (no copy involved): */
-    QImage subImage = QImage(image.bits() + offset,
-                             iSubImageWidth, iSubImageHeight,
-                             image.bytesPerLine(), image.format());
-
-#ifndef QIMAGE_FRAMEBUFFER_WITH_DIRECT_OUTPUT
-    /* Create sub-pixmap on the basis of sub-image above (1st copy involved): */
-    QPixmap subPixmap = QPixmap::fromImage(subImage);
-
-    /* If HiDPI 'backing scale factor' defined: */
-    if (dBackingScaleFactor > 1.0)
-    {
-        /* Should we optimize HiDPI output for performance? */
-        if (hiDPIOptimizationType == HiDPIOptimizationType_Performance)
-        {
-            /* Fast scale sub-pixmap (2nd copy involved): */
-            subPixmap = subPixmap.scaled(subPixmap.size() * dBackingScaleFactor,
-                                         Qt::IgnoreAspectRatio, Qt::FastTransformation);
-# ifdef Q_WS_MAC
-#  ifdef VBOX_GUI_WITH_HIDPI
-            /* Mark sub-pixmap as HiDPI: */
-            subPixmap.setDevicePixelRatio(dBackingScaleFactor);
-#  endif /* VBOX_GUI_WITH_HIDPI */
-# endif /* Q_WS_MAC */
-        }
-    }
-
-    /* Draw sub-pixmap: */
-    painter.drawPixmap(rect.x(), rect.y(), subPixmap);
-#else /* QIMAGE_FRAMEBUFFER_WITH_DIRECT_OUTPUT */
-    /* If HiDPI 'backing scale factor' defined: */
-    if (dBackingScaleFactor > 1.0)
-    {
-        /* Should we optimize HiDPI output for performance? */
-        if (hiDPIOptimizationType == HiDPIOptimizationType_Performance)
-        {
-            /* Create fast-scaled-sub-image (1st copy involved): */
-            QImage scaledSubImage = subImage.scaled(subImage.size() * dBackingScaleFactor,
-                                                    Qt::IgnoreAspectRatio, Qt::FastTransformation);
-# ifdef Q_WS_MAC
-#  ifdef VBOX_GUI_WITH_HIDPI
-            /* Mark sub-pixmap as HiDPI: */
-            scaledSubImage.setDevicePixelRatio(dBackingScaleFactor);
-#  endif /* VBOX_GUI_WITH_HIDPI */
-# endif /* Q_WS_MAC */
-            /* Directly draw scaled-sub-image: */
-            painter.drawImage(rect.x(), rect.y(), scaledSubImage);
-            return;
-        }
-    }
-    /* Directly draw sub-image: */
-    painter.drawImage(rect.x(), rect.y(), subImage);
-#endif /* QIMAGE_FRAMEBUFFER_WITH_DIRECT_OUTPUT */
-}
-
-void UIFrameBufferQImage::goFallback()
-{
-    /* We calling for fallback when we:
-     * 1. don't support either the pixel format or the color depth;
-     * 2. or the machine is in the state which breaks link between
-     *    the framebuffer and the actual video-memory: */
-    m_img = QImage(m_width, m_height, QImage::Format_RGB32);
-    m_img.fill(0);
-    m_uPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
-    m_bUsesGuestVRAM = false;
-}
-
-#endif /* VBOX_GUI_USE_QIMAGE */
-
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.h
deleted file mode 100644
index a696320..0000000
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIFrameBufferQImage class declarations
- */
-
-/*
- * Copyright (C) 2010-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifdef VBOX_GUI_USE_QIMAGE
-
-#ifndef ___UIFrameBufferQImage_h___
-#define ___UIFrameBufferQImage_h___
-
-/* Qt includes: */
-#include <QImage>
-#include <QPixmap>
-
-/* GUI includes: */
-#include "UIFrameBuffer.h"
-
-/* QImage frame-buffer prototype: */
-class UIFrameBufferQImage : public UIFrameBuffer
-{
-public:
-
-    /* Constructor: */
-    UIFrameBufferQImage(UIMachineView *pMachineView);
-
-    /* API: Frame-buffer stuff: */
-    ulong pixelFormat() { return m_uPixelFormat; }
-    bool usesGuestVRAM() { return m_bUsesGuestVRAM; }
-    uchar *address() { return m_img.bits(); }
-    ulong bitsPerPixel() { return m_img.depth(); }
-    ulong bytesPerLine() { return m_img.bytesPerLine(); }
-
-    /* API: Event-delegate stuff: */
-    void resizeEvent(UIResizeEvent *pEvent);
-    void paintEvent(QPaintEvent *pEvent);
-
-private:
-
-    /* Helpers: Visual-mode paint stuff: */
-    void paintDefault(QPaintEvent *pEvent);
-    void paintSeamless(QPaintEvent *pEvent);
-    void paintScale(QPaintEvent *pEvent);
-
-    /** Draws corresponding @a rect of passed @a image with @a painter. */
-    static void drawImageRect(QPainter &painter, const QImage &image, const QRect &rect,
-                              int iContentsShiftX, int iContentsShiftY,
-                              HiDPIOptimizationType hiDPIOptimizationType,
-                              double dBackingScaleFactor);
-
-    /* Helper: Fallback stuff: */
-    void goFallback();
-
-    /* Variables: */
-    QImage m_img;
-    ulong m_uPixelFormat;
-    bool m_bUsesGuestVRAM;
-};
-
-#endif /* !___UIFrameBufferQImage_h___ */
-
-#endif /* VBOX_GUI_USE_QIMAGE */
-
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp
deleted file mode 100644
index bfb437a..0000000
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp
+++ /dev/null
@@ -1,528 +0,0 @@
-/* $Id: UIFrameBufferQuartz2D.cpp $ */
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIFrameBufferQuartz2D class implementation
- */
-
-/*
- * Copyright (C) 2006-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifdef VBOX_GUI_USE_QUARTZ2D
-
-#ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
-#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
-/* Qt includes: */
-# include <QApplication>
-
-/* GUI includes: */
-# include "UIFrameBufferQuartz2D.h"
-# include "VBoxUtils.h"
-# include "UIPopupCenter.h"
-# include "UISession.h"
-# include "UIMachineLogic.h"
-# include "UIMachineWindow.h"
-# include "UIMachineView.h"
-
-/* COM includes: */
-# include "COMEnums.h"
-
-/* Other VBox includes: */
-# include <iprt/asm.h>
-#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
-
-/** @class UIFrameBufferQuartz2D
- *
- *  The UIFrameBufferQuartz2D class is a class that implements the IFrameBuffer
- *  interface and uses Apples Quartz2D to store and render VM display data.
- */
-
-UIFrameBufferQuartz2D::UIFrameBufferQuartz2D(UIMachineView *pMachineView)
-    : UIFrameBuffer(pMachineView)
-    , m_fUsesGuestVRAM(false)
-    , m_pDataAddress(NULL)
-    , m_pBitmapData(NULL)
-    , m_uPixelFormat(FramebufferPixelFormat_FOURCC_RGB)
-    , m_image(NULL)
-    , mRegion(NULL)
-    , mRegionUnused(NULL)
-{
-    Log (("Quartz2D: Creating\n"));
-
-    UIResizeEvent event(FramebufferPixelFormat_Opaque,
-                        NULL, 0, 0, 640, 480);
-    resizeEvent (&event);
-}
-
-UIFrameBufferQuartz2D::~UIFrameBufferQuartz2D()
-{
-    Log (("Quartz2D: Deleting\n"));
-    clean(false);
-}
-
-STDMETHODIMP UIFrameBufferQuartz2D::SetVisibleRegion(BYTE *pRectangles, ULONG aCount)
-{
-    LogRel2(("UIFrameBufferQuartz2D::SetVisibleRegion: Rectangle count=%lu\n",
-             (unsigned long)aCount));
-
-    /* Make sure rectangles were passed: */
-    if (!pRectangles)
-    {
-        LogRel2(("UIFrameBufferQuartz2D::SetVisibleRegion: Invalid pRectangles pointer!\n"));
-
-        return E_POINTER;
-    }
-
-    /* Lock access to frame-buffer: */
-    lock();
-
-    /* Make sure frame-buffer is used: */
-    if (m_fIsMarkedAsUnused)
-    {
-        LogRel2(("UIFrameBufferQuartz2D::SetVisibleRegion: Ignored!\n"));
-
-        /* Unlock access to frame-buffer: */
-        unlock();
-
-        /* Ignore SetVisibleRegion: */
-        return E_FAIL;
-    }
-
-    /** @todo r=bird: Is this thread safe? If I remember the code flow correctly, the
-     * GUI thread could be happily jogging along paintEvent now on another cpu core.
-     * This function is called on the EMT (emulation thread). Which means, blocking
-     * execution waiting for a lock is out of the question. A quick solution using
-     * ASMAtomic(Cmp)XchgPtr and a struct { cAllocated; cRects; aRects[1]; }
-     * *mRegion, *mUnusedRegion; should suffice (and permit you to reuse allocations). */
-    RegionRects *rgnRcts = ASMAtomicXchgPtrT(&mRegionUnused, NULL, RegionRects *);
-    if (rgnRcts && rgnRcts->allocated < aCount)
-    {
-        RTMemFree (rgnRcts);
-        rgnRcts = NULL;
-    }
-    if (!rgnRcts)
-    {
-        ULONG allocated = RT_ALIGN_32(aCount + 1, 32);
-        allocated = RT_MAX (128, allocated);
-        rgnRcts = (RegionRects *)RTMemAlloc(RT_OFFSETOF(RegionRects, rcts[allocated]));
-        if (!rgnRcts)
-        {
-            /* Unlock access to frame-buffer: */
-            unlock();
-
-            return E_OUTOFMEMORY;
-        }
-        rgnRcts->allocated = allocated;
-    }
-    rgnRcts->used = 0;
-
-    /* Compose region: */
-    QRegion reg;
-    PRTRECT rects = (PRTRECT)pRectangles;
-    QRect vmScreenRect(0, 0, width(), height());
-    for (ULONG ind = 0; ind < aCount; ++ ind)
-    {
-        /* Get current rectangle: */
-        QRect rect;
-        rect.setLeft(rects->xLeft);
-        rect.setTop(rects->yTop);
-        /* Which is inclusive: */
-        rect.setRight(rects->xRight - 1);
-        rect.setBottom(rects->yBottom - 1);
-
-        /* The rect should intersect with the vm screen. */
-        rect = vmScreenRect.intersect(rect);
-        ++rects;
-        /* Make sure only valid rects are distributed: */
-        if (rect.isValid() &&
-           rect.width() > 0 && rect.height() > 0)
-            reg += rect;
-        else
-            continue;
-
-        /* That is some *magic* added by Knut in r27807: */
-        CGRect *cgRct = &rgnRcts->rcts[rgnRcts->used];
-        cgRct->origin.x = rect.x();
-        cgRct->origin.y = height() - rect.y() - rect.height();
-        cgRct->size.width = rect.width();
-        cgRct->size.height = rect.height();
-        rgnRcts->used++;
-    }
-
-    RegionRects *pOld = ASMAtomicXchgPtrT(&mRegion, rgnRcts, RegionRects *);
-    if (    pOld
-        &&  !ASMAtomicCmpXchgPtr(&mRegionUnused, pOld, NULL))
-        RTMemFree(pOld);
-
-    /* Send async signal to update asynchronous visible-region: */
-    LogRel2(("UIFrameBufferQuartz2D::SetVisibleRegion: Sending to async-handler...\n"));
-    emit sigSetVisibleRegion(reg);
-
-    /* Unlock access to frame-buffer: */
-    unlock();
-
-    /* Confirm SetVisibleRegion: */
-    return S_OK;
-}
-
-void UIFrameBufferQuartz2D::resizeEvent(UIResizeEvent *aEvent)
-{
-#if 0
-    printf ("fmt=%lu, vram=%X, bpp=%lu, bpl=%lu, width=%lu, height=%lu\n",
-           aEvent->pixelFormat(), (unsigned int)aEvent->VRAM(),
-           aEvent->bitsPerPixel(), aEvent->bytesPerLine(),
-           aEvent->width(), aEvent->height());
-#endif
-    /* Clean out old stuff */
-    clean(m_width == aEvent->width()
-            && m_height == aEvent->height());
-
-    m_width = aEvent->width();
-    m_height = aEvent->height();
-
-    bool remind = false;
-
-    /* We need a color space in any case */
-    CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
-    /* Check if we support the pixel format/colordepth and can use the guest VRAM directly.
-     * Mac OS X supports 16 bit also but not in the 565 mode. So we could use
-     * 32 bit only. */
-    if (   aEvent->pixelFormat() == FramebufferPixelFormat_FOURCC_RGB
-        && aEvent->bitsPerPixel() == 32)
-    {
-        m_fUsesGuestVRAM = true;
-//        printf ("VRAM\n");
-        /* Create the image copy of the framebuffer */
-        CGDataProviderRef dp = CGDataProviderCreateWithData(NULL, aEvent->VRAM(), aEvent->bytesPerLine() * m_height, NULL);
-        m_image = CGImageCreate(m_width, m_height, 8, aEvent->bitsPerPixel(), aEvent->bytesPerLine(), cs,
-                                kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little, dp, 0, false,
-                                kCGRenderingIntentDefault);
-        m_pDataAddress = aEvent->VRAM();
-        CGDataProviderRelease (dp);
-    }
-    else
-    {
-        m_fUsesGuestVRAM = false;
-        remind = true;
-//        printf ("No VRAM\n");
-        /* Create the memory we need for our image copy
-         * Read somewhere that an alignment of 16 is
-         * best for optimal performance. So why not. */
-//        int bitmapBytesPerRow = RT_ALIGN (m_width * 4, 16);
-        int bitmapBytesPerRow = m_width * 4;
-        int bitmapByteCount = (bitmapBytesPerRow * m_height);
-        m_pBitmapData = RTMemAllocZ(bitmapByteCount);
-        CGDataProviderRef dp = CGDataProviderCreateWithData(NULL, m_pBitmapData, bitmapByteCount, NULL);
-        m_image = CGImageCreate(m_width, m_height, 8, 32, bitmapBytesPerRow, cs,
-                                kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Little, dp, 0, false,
-                                kCGRenderingIntentDefault);
-        m_pDataAddress = static_cast<uchar*>(m_pBitmapData);
-        CGDataProviderRelease(dp);
-    }
-    CGColorSpaceRelease(cs);
-#ifdef VBOX_WITH_ICHAT_THEATER
-    setImageRef(m_image);
-#endif
-
-    /* This check (supports graphics) is not quite right due to past mistakes
-     * in the Guest Additions protocol, but in practice it should be fine. */
-    if (remind && m_pMachineView->uisession()->isGuestSupportsGraphics())
-        popupCenter().remindAboutWrongColorDepth(m_pMachineView->machineWindow(),
-                                                      aEvent->bitsPerPixel(), 32);
-    else
-        popupCenter().forgetAboutWrongColorDepth(m_pMachineView->machineWindow());
-}
-
-void UIFrameBufferQuartz2D::paintEvent(QPaintEvent *aEvent)
-{
-    /* If the machine is NOT in 'running' state,
-     * the link between framebuffer and video memory
-     * is broken, we should go fallback now... */
-    if (m_fUsesGuestVRAM &&
-        !m_pMachineView->uisession()->isRunning() &&
-        !m_pMachineView->uisession()->isPaused() &&
-        /* Online snapshotting: */
-        m_pMachineView->uisession()->machineState() != KMachineState_Saving)
-    {
-        /* Simulate fallback through fake resize-event: */
-        UIResizeEvent event(FramebufferPixelFormat_Opaque, NULL, 0, 0, 640, 480);
-        resizeEvent(&event);
-    }
-
-    /* For debugging /Developer/Applications/Performance Tools/Quartz
-     * Debug.app is a nice tool to see which parts of the screen are
-     * updated.*/
-    Assert(m_image);
-
-    QWidget* viewport = m_pMachineView->viewport();
-    Assert(VALID_PTR(viewport));
-    /* Get the dimensions of the viewport */
-    CGRect viewRect = ::darwinToCGRect(viewport->geometry());
-    /* Get the context of this window from Qt */
-    CGContextRef ctx = ::darwinToCGContextRef(viewport);
-    Assert(VALID_PTR(ctx));
-
-    /* Flip the context */
-    CGContextTranslateCTM(ctx, 0, viewRect.size.height);
-    CGContextScaleCTM(ctx, 1.0, -1.0);
-
-    /* We handle the seamless mode as a special case. */
-    if (m_pMachineView->machineLogic()->visualStateType() == UIVisualStateType_Seamless)
-    {
-        /* Determine current visible region: */
-        RegionRects *pRgnRcts = ASMAtomicXchgPtrT(&mRegion, NULL, RegionRects*);
-
-        /* Prepare cleanup-region: */
-        QRegion cleanupRegion(aEvent->rect());
-        /* Filter out visible-rectangles;
-         * That way we erase *only* invisible-rectangles of paint-region: */
-        if (pRgnRcts && pRgnRcts->used > 0)
-        {
-            /* Slowly, step-by-step filter our visible-rectangles: */
-            CGRect *pCgVisibleRect = pRgnRcts->rcts;
-            for (ULONG uVisibleRectIndex = 0; uVisibleRectIndex < pRgnRcts->used; ++uVisibleRectIndex)
-            {
-                /* Prepare Qt visible-rectangle, flipping received CG visible-rectangle: */
-                CGRect cgVisibleRectFlippedToQt = ::darwinFlipCGRect(*pCgVisibleRect, viewRect.size.height);
-                QRect visibleRect(cgVisibleRectFlippedToQt.origin.x, cgVisibleRectFlippedToQt.origin.y,
-                                  cgVisibleRectFlippedToQt.size.width, cgVisibleRectFlippedToQt.size.height);
-                /* Filter that rectangle out: */
-                cleanupRegion -= visibleRect;
-                ++pCgVisibleRect;
-            }
-        }
-        /* Erase cleanup-region: */
-        if (!cleanupRegion.isEmpty())
-        {
-            /* Slowly, step-by-step erase cleanup-rectangles: */
-            foreach (const QRect &cleanupRect, cleanupRegion.rects())
-            {
-                CGRect cgCleanupRect = ::darwinToCGRect(cleanupRect);
-                CGContextClearRect(ctx, ::darwinFlipCGRect(cgCleanupRect, viewRect.size.height));
-            }
-        }
-
-        /* Prepare painting path/clipping: */
-        if (pRgnRcts)
-        {
-            /* If visible region is determined: */
-            if (pRgnRcts->used > 0)
-            {
-                /* Add the clipping rects all at once (they are defined in SetVisibleRegion): */
-                CGContextBeginPath(ctx);
-                CGContextAddRects(ctx, pRgnRcts->rcts, pRgnRcts->used);
-                /* Now convert the path to a clipping path: */
-                CGContextClip(ctx);
-            }
-
-            /* Put back the visible region, free if we cannot (2+ SetVisibleRegion calls): */
-            if (   !ASMAtomicCmpXchgPtr(&mRegion, pRgnRcts, NULL)
-                && !ASMAtomicCmpXchgPtr(&mRegionUnused, pRgnRcts, NULL))
-            {
-                RTMemFree(pRgnRcts);
-                pRgnRcts = NULL;
-            }
-        }
-
-        /* If visible region is still determined: */
-        if (pRgnRcts && pRgnRcts->used > 0)
-        {
-            /* Create a subimage of the current view in the size
-             * of the bounding box of the current paint event: */
-            CGRect cgPaintRect = ::darwinToCGRect(aEvent->rect());
-            CGImageRef subImage;
-            if (!m_pMachineView->pauseShot().isNull())
-            {
-                CGImageRef pauseImg = ::darwinToCGImageRef(&m_pMachineView->pauseShot());
-                subImage = CGImageCreateWithImageInRect(pauseImg, cgPaintRect);
-                CGImageRelease(pauseImg);
-            }
-            else
-            {
-#ifdef RT_ARCH_AMD64
-                /* Not sure who to blame, but it seems on 64bit there goes
-                 * something terrible wrong (on a second monitor) when directly
-                 * using CGImageCreateWithImageInRect without making a copy. We saw
-                 * something like this already with the scale mode. */
-                CGImageRef tmpImage = CGImageCreateWithImageInRect(m_image, cgPaintRect);
-                subImage = CGImageCreateCopy(tmpImage);
-                CGImageRelease(tmpImage);
-#else /* RT_ARCH_AMD64 */
-                subImage = CGImageCreateWithImageInRect(m_image, CGRectMake(m_pMachineView->contentsX(), m_pMachineView->contentsY(), m_pMachineView->visibleWidth(), m_pMachineView->visibleHeight()));
-#endif /* !RT_ARCH_AMD64 */
-            }
-            Assert(VALID_PTR(subImage));
-
-            /* In any case clip the drawing to the view window: */
-            CGContextClipToRect(ctx, viewRect);
-            /* At this point draw the real vm image: */
-            CGContextDrawImage(ctx, ::darwinFlipCGRect(cgPaintRect, viewRect.size.height), subImage);
-
-            /* Release the subimage: */
-            CGImageRelease(subImage);
-        }
-    }
-    else if (   m_pMachineView->machineLogic()->visualStateType() == UIVisualStateType_Scale
-             && m_scaledSize.isValid())
-    {
-        /* Here we paint if we didn't care about any masks */
-
-        /* Create a subimage of the current view in the size
-         * of the bounding box of the current paint event */
-        CGRect ir = ::darwinToCGRect(aEvent->rect());
-        CGRect is = CGRectMake(CGRectGetMinX(ir), CGRectGetMinY(ir), CGRectGetWidth(ir), CGRectGetHeight(ir));
-
-        double iw = 1.0;
-        double ih = 1.0;
-        CGImageRef subImage = 0;
-        if (!m_pMachineView->pauseShot().isNull())
-        {
-            /* The pause image is already scaled. Maybe we should change that,
-             * to have a more uniform behavior and the different
-             * implementations use there own scaling algorithm. */
-            CGImageRef pauseImg = ::darwinToCGImageRef(&m_pMachineView->pauseShot());
-            subImage = CGImageCreateWithImageInRect(pauseImg, is);
-            CGImageRelease(pauseImg);
-        }
-        else
-        {
-            /* Scale all values needed for the image drawing. */
-            iw = (double)CGImageGetWidth(m_image) / m_scaledSize.width();
-            ih = (double)CGImageGetHeight(m_image) / m_scaledSize.height();
-            /* We make sure the image is always bigger than requested to
-             * compensate rounding errors. */
-            /* Round down */
-            is.origin.x = (int)(is.origin.x * iw);
-            is.origin.y = (int)(is.origin.y * ih);
-            /* Round up */
-            is.size.width = (int)(is.size.width * iw) + 2;
-            is.size.height = (int)(is.size.height * ih) + 2;
-            /* Make sure the size is within the image boundaries */
-            CGRect is1 = CGRectIntersection(is, CGRectMake(0, 0, CGImageGetWidth(m_image), CGImageGetHeight(m_image)));
-            /* Cause we probably changed the rectangle to update in the origin
-             * coordinate system, we have to recalculate the update rectangle
-             * for the screen coordinates as well. Please note that this has to
-             * be in double precision. */
-            ir.origin.x = is1.origin.x / iw;
-            ir.origin.y = is1.origin.y / ih;
-            ir.size.width = is1.size.width / iw;
-            ir.size.height = is1.size.height / ih;
-            /* Create the sub image. Note: The copy step is necessary otherwise
-             * strange things happens especially on Snow Leopard. No idea why. */
-            CGImageRef tmpImage = CGImageCreateWithImageInRect(m_image, is1);
-            subImage = CGImageCreateCopy(tmpImage);
-            CGImageRelease(tmpImage);
-        }
-        if (subImage)
-        {
-            /* For more performance we set a clipping path of the regions given
-             * by this paint event. */
-            QVector<QRect> a = aEvent->region().rects();
-            if (!a.isEmpty())
-            {
-                CGContextBeginPath(ctx);
-                /* Add all region rects to the current context as path components */
-                for (int i = 0; i < a.size(); ++i)
-                    CGContextAddRect(ctx, ::darwinFlipCGRect(::darwinToCGRect(a.at(i)), CGRectGetHeight(viewRect)));
-                /* Now convert the path to a clipping path. */
-                CGContextClip(ctx);
-            }
-            /* In any case clip the drawing to the view window */
-            CGContextClipToRect(ctx, viewRect);
-            /* Turn the high interpolation quality on. */
-            CGContextSetInterpolationQuality(ctx, kCGInterpolationHigh);
-            /* Draw the image. */
-            CGContextDrawImage(ctx, ::darwinFlipCGRect(ir, CGRectGetHeight(viewRect)), subImage);
-            CGImageRelease(subImage);
-        }
-    }
-    else
-    {
-        /* Here we paint if we didn't care about any masks */
-
-        /* Create a subimage of the current view in the size
-         * of the bounding box of the current paint event */
-        QRect ir = aEvent->rect();
-        QRect is = QRect(ir.x() + m_pMachineView->contentsX(), ir.y() + m_pMachineView->contentsY(), ir.width(), ir.height());
-        CGImageRef subImage = 0;
-        if (!m_pMachineView->pauseShot().isNull())
-        {
-            CGImageRef pauseImg = ::darwinToCGImageRef(&m_pMachineView->pauseShot());
-            subImage = CGImageCreateWithImageInRect(pauseImg, ::darwinToCGRect(is));
-            CGImageRelease(pauseImg);
-        }
-        else
-        {
-#ifdef RT_ARCH_AMD64
-            /* Not sure who to blame, but it seems on 64bit there goes
-             * something terrible wrong (on a second monitor) when directly
-             * using CGImageCreateWithImageInRect without making a copy. We saw
-             * something like this already with the scale mode. */
-            CGImageRef tmpImage = CGImageCreateWithImageInRect(m_image, ::darwinToCGRect(is));
-            subImage = CGImageCreateCopy(tmpImage);
-            CGImageRelease(tmpImage);
-#else
-            subImage = CGImageCreateWithImageInRect(m_image, ::darwinToCGRect(is));
-#endif
-        }
-        if (subImage)
-        {
-            /* Ok, for more performance we set a clipping path of the
-             * regions given by this paint event. */
-            QVector<QRect> a = aEvent->region().rects();
-            if (!a.isEmpty())
-            {
-                CGContextBeginPath (ctx);
-                /* Add all region rects to the current context as path components */
-                for (int i = 0; i < a.size(); ++i)
-                    CGContextAddRect(ctx, ::darwinFlipCGRect(::darwinToCGRect(a[i]), viewRect.size.height));
-                /* Now convert the path to a clipping path. */
-                CGContextClip(ctx);
-            }
-
-            /* In any case clip the drawing to the view window */
-            CGContextClipToRect(ctx, viewRect);
-
-            /* At this point draw the real vm image */
-            CGContextDrawImage(ctx, ::darwinFlipCGRect(::darwinToCGRect(ir), viewRect.size.height), subImage);
-            CGImageRelease(subImage);
-        }
-    }
-}
-
-void UIFrameBufferQuartz2D::clean(bool fPreserveRegions)
-{
-    if (m_image)
-    {
-        CGImageRelease(m_image);
-        m_image = NULL;
-    }
-    if (m_pBitmapData)
-    {
-        RTMemFree(m_pBitmapData);
-        m_pBitmapData = NULL;
-    }
-    if (!fPreserveRegions && mRegion)
-    {
-        RTMemFree((void *)mRegion);
-        mRegion = NULL;
-    }
-    if (!fPreserveRegions && mRegionUnused)
-    {
-        RTMemFree((void *)mRegionUnused);
-        mRegionUnused = NULL;
-    }
-}
-
-#endif /* VBOX_GUI_USE_QUARTZ2D */
-
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.h
deleted file mode 100644
index b54761a..0000000
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIFrameBufferQuartz2D class declarations
- */
-
-/*
- * Copyright (C) 2010-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifdef VBOX_GUI_USE_QUARTZ2D
-
-#ifndef ___UIFrameBufferQuartz2D_h___
-#define ___UIFrameBufferQuartz2D_h___
-
-#include <QtGlobal>
-
-#include "UIFrameBuffer.h"
-
-#include <ApplicationServices/ApplicationServices.h>
-
-/* Local forward declarations */
-class UIMachineLogic;
-
-class UIFrameBufferQuartz2D : public UIFrameBuffer
-{
-public:
-
-    UIFrameBufferQuartz2D(UIMachineView *pMachineView);
-    virtual ~UIFrameBufferQuartz2D();
-
-    STDMETHOD(SetVisibleRegion)(BYTE *pRectangles, ULONG uCount);
-
-    uchar* address() { return m_pDataAddress; }
-    ulong bitsPerPixel() { return CGImageGetBitsPerPixel(m_image); }
-    ulong bytesPerLine() { return CGImageGetBytesPerRow(m_image); }
-    ulong pixelFormat() { return m_uPixelFormat; };
-    bool usesGuestVRAM() { return m_pBitmapData == NULL; }
-
-    const CGImageRef imageRef() const { return m_image; }
-
-    void resizeEvent(UIResizeEvent *pEvent);
-    void paintEvent(QPaintEvent *pEvent);
-
-private:
-
-    void clean(bool fPreserveRegions);
-
-    bool m_fUsesGuestVRAM;
-    uchar *m_pDataAddress;
-    void *m_pBitmapData;
-    ulong m_uPixelFormat;
-    CGImageRef m_image;
-    typedef struct
-    {
-        /** The size of this structure expressed in rcts entries. */
-        ULONG allocated;
-        /** The number of entries in the rcts array. */
-        ULONG used;
-        /** Variable sized array of the rectangle that makes up the region. */
-        CGRect rcts[1];
-    } RegionRects;
-    /** The current valid region, all access is by atomic cmpxchg or atomic xchg.
-     *
-     * The protocol for updating and using this has to take into account that
-     * the producer (SetVisibleRegion) and consumer (paintEvent) are running
-     * on different threads. Therefore the producer will create a new RegionRects
-     * structure before atomically replace the existing one. While the consumer
-     * will read the value by atomically replace it by NULL, and then when its
-     * done try restore it by cmpxchg. If the producer has already put a new
-     * region there, it will be discarded (see mRegionUnused).
-     */
-    RegionRects * volatile mRegion;
-    /** For keeping the unused region and thus avoid some RTMemAlloc/RTMemFree calls.
-     * This is operated with atomic cmpxchg and atomic xchg. */
-    RegionRects * volatile mRegionUnused;
-};
-
-#endif /* !___UIFrameBufferQuartz2D_h___ */
-
-#endif /* VBOX_GUI_USE_QUARTZ2D */
-
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
index a832f43..d55c280 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIIndicatorsPool.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIIndicatorsPool class implementation
+ * VBox Qt GUI - UIIndicatorsPool class implementation.
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,144 +15,196 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QTimer>
-#include <QPainter>
+# include <QTimer>
+# include <QPainter>
+# include <QHBoxLayout>
 
 /* GUI includes: */
-#include "UIIndicatorsPool.h"
-#include "VBoxGlobal.h"
-#include "UIMachineDefs.h"
-#include "UIConverter.h"
-#include "UIAnimationFramework.h"
-#include "UIMedium.h"
+# include "UIIndicatorsPool.h"
+# include "QIWithRetranslateUI.h"
+# include "UIExtraDataManager.h"
+# include "UIMachineDefs.h"
+# include "UIConverter.h"
+# include "UIAnimationFramework.h"
+# include "UISession.h"
+# include "UIMedium.h"
+# include "UIIconPool.h"
+# include "UIHostComboEditor.h"
+# include "QIStatusBarIndicator.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CMachine.h"
-#include "CSystemProperties.h"
-#include "CMachineDebugger.h"
-#include "CGuest.h"
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
-#include "CNetworkAdapter.h"
-#include "CUSBController.h"
-#include "CUSBDeviceFilters.h"
-#include "CUSBDevice.h"
-#include "CSharedFolder.h"
-#include "CVRDEServer.h"
+# include "CConsole.h"
+# include "CMachine.h"
+# include "CSystemProperties.h"
+# include "CMachineDebugger.h"
+# include "CGuest.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
+# include "CNetworkAdapter.h"
+# include "CUSBController.h"
+# include "CUSBDeviceFilters.h"
+# include "CUSBDevice.h"
+# include "CSharedFolder.h"
+# include "CVRDEServer.h"
 
 /* Other VBox includes: */
-#include <iprt/time.h>
+# include <iprt/time.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-class UIIndicatorHardDisks : public QIStateIndicator
+
+
+/** QIStateStatusBarIndicator extension for Runtime UI. */
+class UISessionStateStatusBarIndicator : public QIWithRetranslateUI<QIStateStatusBarIndicator>
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorHardDisks(CSession &session)
-      : m_session(session)
-    {
-        setStateIcon(KDeviceActivity_Idle, QPixmap(":/hd_16px.png"));
-        setStateIcon(KDeviceActivity_Reading, QPixmap(":/hd_read_16px.png"));
-        setStateIcon(KDeviceActivity_Writing, QPixmap(":/hd_write_16px.png"));
-        setStateIcon(KDeviceActivity_Null, QPixmap(":/hd_disabled_16px.png"));
+    /** Constructor which remembers passed @a session object. */
+    UISessionStateStatusBarIndicator(UISession *pSession) : m_pSession(pSession) {}
+
+    /** Abstract update routine. */
+    virtual void updateAppearance() = 0;
+
+protected:
+
+    /** Holds the session UI reference. */
+    UISession *m_pSession;
+};
 
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Hard-drive indicator. */
+class UIIndicatorHardDrive : public UISessionStateStatusBarIndicator
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorHardDrive(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
+    {
+        /* Assign state-icons: */
+        setStateIcon(KDeviceActivity_Idle,    UIIconPool::iconSet(":/hd_16px.png"));
+        setStateIcon(KDeviceActivity_Reading, UIIconPool::iconSet(":/hd_read_16px.png"));
+        setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/hd_write_16px.png"));
+        setStateIcon(KDeviceActivity_Null,    UIIconPool::iconSet(":/hd_disabled_16px.png"));
+        /* Translate finally: */
         retranslateUi();
     }
 
+private:
+
+    /** Retranslation routine. */
     void retranslateUi()
     {
         updateAppearance();
     }
 
+    /** Update routine. */
     void updateAppearance()
     {
-        const CMachine &machine = m_session.GetMachine();
+        /* Get machine: */
+        const CMachine machine = m_pSession->machine();
 
-        QString strToolTip = QApplication::translate("UIIndicatorsPool", "<p style='white-space:pre'><nobr>Indicates the activity "
+        /* Prepare tool-tip: */
+        QString strToolTip = QApplication::translate("UIIndicatorsPool",
+                                                     "<p style='white-space:pre'><nobr>Indicates the activity "
                                                      "of the virtual hard disks:</nobr>%1</p>", "HDD tooltip");
-
         QString strFullData;
-        bool fAttachmentsPresent = false;
 
-        const CStorageControllerVector &controllers = machine.GetStorageControllers();
-        foreach (const CStorageController &controller, controllers)
+        /* Enumerate all the controllers: */
+        bool fAttachmentsPresent = false;
+        foreach (const CStorageController &controller, machine.GetStorageControllers())
         {
             QString strAttData;
-            const CMediumAttachmentVector &attachments = machine.GetMediumAttachmentsOfController(controller.GetName());
-            foreach (const CMediumAttachment &attachment, attachments)
+            /* Enumerate all the attachments: */
+            foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName()))
             {
+                /* Skip unrelated attachments: */
                 if (attachment.GetType() != KDeviceType_HardDisk)
                     continue;
+                /* Append attachment data: */
                 strAttData += QString("<br> <nobr>%1: %2</nobr>")
                     .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
                     .arg(UIMedium(attachment.GetMedium(), UIMediumType_HardDisk).location());
                 fAttachmentsPresent = true;
             }
+            /* Append controller data: */
             if (!strAttData.isNull())
                 strFullData += QString("<br><nobr><b>%1</b></nobr>").arg(controller.GetName()) + strAttData;
         }
 
-        /* For now we will hide that LED at all if there are no attachments! */
+        /* Hide indicator if there are no attachments: */
         if (!fAttachmentsPresent)
-            setHidden(true);
-        //if (!fAttachmentsPresent)
-        //    strFullData += QApplication::translate("UIIndicatorsPool", "<br><nobr><b>No hard disks attached</b></nobr>", "HDD tooltip");
+            hide();
 
+        /* Update tool-tip: */
         setToolTip(strToolTip.arg(strFullData));
+        /* Update indicator state: */
         setState(fAttachmentsPresent ? KDeviceActivity_Idle : KDeviceActivity_Null);
     }
-
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
 };
 
-class UIIndicatorOpticalDisks : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Optical-drive indicator. */
+class UIIndicatorOpticalDisks : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorOpticalDisks(CSession &session)
-      : m_session(session)
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorOpticalDisks(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
     {
-        setStateIcon(KDeviceActivity_Idle, QPixmap(":/cd_16px.png"));
-        setStateIcon(KDeviceActivity_Reading, QPixmap(":/cd_read_16px.png"));
-        setStateIcon(KDeviceActivity_Writing, QPixmap(":/cd_write_16px.png"));
-        setStateIcon(KDeviceActivity_Null, QPixmap(":/cd_disabled_16px.png"));
-
+        /* Assign state-icons: */
+        setStateIcon(KDeviceActivity_Idle,    UIIconPool::iconSet(":/cd_16px.png"));
+        setStateIcon(KDeviceActivity_Reading, UIIconPool::iconSet(":/cd_read_16px.png"));
+        setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/cd_write_16px.png"));
+        setStateIcon(KDeviceActivity_Null,    UIIconPool::iconSet(":/cd_disabled_16px.png"));
+        /* Translate finally: */
         retranslateUi();
     }
 
+private:
+
+    /** Retranslation routine. */
     void retranslateUi()
     {
         updateAppearance();
     }
 
+    /** Update routine. */
     void updateAppearance()
     {
-        const CMachine &machine = m_session.GetMachine();
-
-        QString strToolTip = QApplication::translate("UIIndicatorsPool", "<p style='white-space:pre'><nobr>Indicates the activity "
-                                                     "of the CD/DVD devices:</nobr>%1</p>", "CD/DVD tooltip");
+        /* Get machine: */
+        const CMachine machine = m_pSession->machine();
 
+        /* Prepare tool-tip: */
+        QString strToolTip = QApplication::translate("UIIndicatorsPool",
+                                                     "<p style='white-space:pre'><nobr>Indicates the activity "
+                                                     "of the optical drives:</nobr>%1</p>", "CD tooltip");
         QString strFullData;
+
+        /* Enumerate all the controllers: */
         bool fAttachmentsPresent = false;
         bool fAttachmentsMounted = false;
-
-        const CStorageControllerVector &controllers = machine.GetStorageControllers();
-        foreach (const CStorageController &controller, controllers)
+        foreach (const CStorageController &controller, machine.GetStorageControllers())
         {
             QString strAttData;
-            const CMediumAttachmentVector &attachments = machine.GetMediumAttachmentsOfController(controller.GetName());
-            foreach (const CMediumAttachment &attachment, attachments)
+            /* Enumerate all the attachments: */
+            foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName()))
             {
+                /* Skip unrelated attachments: */
                 if (attachment.GetType() != KDeviceType_DVD)
                     continue;
+                /* Append attachment data: */
                 UIMedium vboxMedium(attachment.GetMedium(), UIMediumType_DVD);
                 strAttData += QString("<br> <nobr>%1: %2</nobr>")
                     .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
@@ -163,68 +213,75 @@ public:
                 if (!vboxMedium.isNull())
                     fAttachmentsMounted = true;
             }
+            /* Append controller data: */
             if (!strAttData.isNull())
                 strFullData += QString("<br><nobr><b>%1</b></nobr>").arg(controller.GetName()) + strAttData;
         }
 
-        /* For now we will hide that LED at all if there are no attachments! */
+        /* Hide indicator if there are no attachments: */
         if (!fAttachmentsPresent)
-            setHidden(true);
-        //if (!fAttachmentsPresent)
-        //    strFullData = QApplication::translate("UIIndicatorsPool", "<br><nobr><b>No CD/DVD devices attached</b></nobr>", "CD/DVD tooltip");
+            hide();
 
+        /* Update tool-tip: */
         setToolTip(strToolTip.arg(strFullData));
+        /* Update indicator state: */
         setState(fAttachmentsMounted ? KDeviceActivity_Idle : KDeviceActivity_Null);
     }
-
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
 };
 
-class UIIndicatorFloppyDisks : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Floppy-drive indicator. */
+class UIIndicatorFloppyDisks : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorFloppyDisks(CSession &session)
-      : m_session(session)
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorFloppyDisks(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
     {
-        setStateIcon(KDeviceActivity_Idle, QPixmap(":/fd_16px.png"));
-        setStateIcon(KDeviceActivity_Reading, QPixmap(":/fd_read_16px.png"));
-        setStateIcon(KDeviceActivity_Writing, QPixmap(":/fd_write_16px.png"));
-        setStateIcon(KDeviceActivity_Null, QPixmap(":/fd_disabled_16px.png"));
-
+        /* Assign state-icons: */
+        setStateIcon(KDeviceActivity_Idle,    UIIconPool::iconSet(":/fd_16px.png"));
+        setStateIcon(KDeviceActivity_Reading, UIIconPool::iconSet(":/fd_read_16px.png"));
+        setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/fd_write_16px.png"));
+        setStateIcon(KDeviceActivity_Null,    UIIconPool::iconSet(":/fd_disabled_16px.png"));
+        /* Translate finally: */
         retranslateUi();
     }
 
+private:
+
+    /** Retranslation routine. */
     void retranslateUi()
     {
         updateAppearance();
     }
 
+    /** Update routine. */
     void updateAppearance()
     {
-        const CMachine &machine = m_session.GetMachine();
-
-        QString strToolTip = QApplication::translate("UIIndicatorsPool", "<p style='white-space:pre'><nobr>Indicates the activity "
-                                                     "of the floppy devices:</nobr>%1</p>", "FD tooltip");
+        /* Get machine: */
+        const CMachine machine = m_pSession->machine();
 
+        /* Prepare tool-tip: */
+        QString strToolTip = QApplication::translate("UIIndicatorsPool",
+                                                     "<p style='white-space:pre'><nobr>Indicates the activity "
+                                                     "of the floppy drives:</nobr>%1</p>", "FD tooltip");
         QString strFullData;
+
+        /* Enumerate all the controllers: */
         bool fAttachmentsPresent = false;
         bool fAttachmentsMounted = false;
-
-        const CStorageControllerVector &controllers = machine.GetStorageControllers();
-        foreach (const CStorageController &controller, controllers)
+        foreach (const CStorageController &controller, machine.GetStorageControllers())
         {
             QString strAttData;
-            const CMediumAttachmentVector &attachments = machine.GetMediumAttachmentsOfController(controller.GetName());
-            foreach (const CMediumAttachment &attachment, attachments)
+            /* Enumerate all the attachments: */
+            foreach (const CMediumAttachment &attachment, machine.GetMediumAttachmentsOfController(controller.GetName()))
             {
+                /* Skip unrelated attachments: */
                 if (attachment.GetType() != KDeviceType_Floppy)
                     continue;
+                /* Append attachment data: */
                 UIMedium vboxMedium(attachment.GetMedium(), UIMediumType_Floppy);
                 strAttData += QString("<br> <nobr>%1: %2</nobr>")
                     .arg(gpConverter->toString(StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice())))
@@ -233,75 +290,112 @@ public:
                 if (!vboxMedium.isNull())
                     fAttachmentsMounted = true;
             }
+            /* Append controller data: */
             if (!strAttData.isNull())
                 strFullData += QString("<br><nobr><b>%1</b></nobr>").arg(controller.GetName()) + strAttData;
         }
 
-        /* For now we will hide that LED at all if there are no attachments! */
+        /* Hide indicator if there are no attachments: */
         if (!fAttachmentsPresent)
-            setHidden(true);
-        //if (!fAttachmentsPresent)
-        //    strFullData = QApplication::translate("UIIndicatorsPool", "<br><nobr><b>No floppy devices attached</b></nobr>", "FD tooltip");
+            hide();
 
+        /* Update tool-tip: */
         setToolTip(strToolTip.arg(strFullData));
+        /* Update indicator state: */
         setState(fAttachmentsMounted ? KDeviceActivity_Idle : KDeviceActivity_Null);
     }
-
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
 };
 
-class UIIndicatorNetwork : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Network indicator. */
+class UIIndicatorNetwork : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorNetwork(CSession &session)
-      : m_session(session)
-      , m_pUpdateTimer(new QTimer(this))
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorNetwork(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
+        , m_pTimerAutoUpdate(0)
+        , m_cMaxNetworkAdapters(0)
     {
-        setStateIcon(KDeviceActivity_Idle, QPixmap(":/nw_16px.png"));
-        setStateIcon(KDeviceActivity_Reading, QPixmap(":/nw_read_16px.png"));
-        setStateIcon(KDeviceActivity_Writing, QPixmap(":/nw_write_16px.png"));
-        setStateIcon(KDeviceActivity_Null, QPixmap(":/nw_disabled_16px.png"));
+        /* Assign state-icons: */
+        setStateIcon(KDeviceActivity_Idle,    UIIconPool::iconSet(":/nw_16px.png"));
+        setStateIcon(KDeviceActivity_Reading, UIIconPool::iconSet(":/nw_read_16px.png"));
+        setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/nw_write_16px.png"));
+        setStateIcon(KDeviceActivity_Null,    UIIconPool::iconSet(":/nw_disabled_16px.png"));
+        /* Configure machine state-change listener: */
+        connect(m_pSession, SIGNAL(sigMachineStateChange()),
+                this, SLOT(sltHandleMachineStateChange()));
+        /* Fetch maximum network adapters count: */
+        const CVirtualBox vbox = vboxGlobal().virtualBox();
+        const CMachine machine = m_pSession->machine();
+        m_cMaxNetworkAdapters = vbox.GetSystemProperties().GetMaxNetworkAdapters(machine.GetChipsetType());
+        /* Create auto-update timer: */
+        m_pTimerAutoUpdate = new QTimer(this);
+        if (m_pTimerAutoUpdate)
+        {
+            /* Configure auto-update timer: */
+            connect(m_pTimerAutoUpdate, SIGNAL(timeout()), SLOT(sltUpdateNetworkIPs()));
+            /* Start timer immediately if machine is running: */
+            sltHandleMachineStateChange();
+        }
+        /* Translate finally: */
+        retranslateUi();
+    }
 
-        connect(m_pUpdateTimer, SIGNAL(timeout()), SLOT(sltUpdateNetworkIPs()));
-        m_pUpdateTimer->start(5000);
+private slots:
 
-        retranslateUi();
+    /** Updates auto-update timer depending on machine state. */
+    void sltHandleMachineStateChange()
+    {
+        if (m_pSession->machineState() == KMachineState_Running)
+        {
+            /* Start auto-update timer otherwise: */
+            m_pTimerAutoUpdate->start(5000);
+            return;
+        }
+        /* Stop auto-update timer otherwise: */
+        m_pTimerAutoUpdate->stop();
+    }
+
+    /** Updates network IP addresses. */
+    void sltUpdateNetworkIPs()
+    {
+        updateAppearance();
     }
 
+private:
+
+    /** Retranslation routine. */
     void retranslateUi()
     {
         updateAppearance();
     }
 
+    /** Update routine. */
     void updateAppearance()
     {
-        const CMachine &machine = m_session.GetMachine();
-        QString strFullData;
-
-        ulong uMaxCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
+        /* Get machine: */
+        const CMachine machine = m_pSession->machine();
 
+        /* Prepare tool-tip: */
         QString strToolTip = QApplication::translate("UIIndicatorsPool",
-                                 "<p style='white-space:pre'><nobr>Indicates the activity of the "
-                                 "network interfaces:</nobr>%1</p>", "Network adapters tooltip");
+                                                     "<p style='white-space:pre'><nobr>Indicates the activity of the "
+                                                     "network interfaces:</nobr>%1</p>", "Network adapters tooltip");
+        QString strFullData;
 
+        /* Gather adapter properties: */
         RTTIMESPEC time;
         uint64_t u64Now = RTTimeSpecGetNano(RTTimeNow(&time));
-
         QString strFlags, strCount;
         LONG64 iTimestamp;
         machine.GetGuestProperty("/VirtualBox/GuestInfo/Net/Count", strCount, iTimestamp, strFlags);
         bool fPropsValid = (u64Now - iTimestamp < UINT64_C(60000000000)); /* timeout beacon */
-
         QStringList ipList, macList;
         if (fPropsValid)
         {
-            int cAdapters = RT_MIN(strCount.toInt(), (int)uMaxCount);
+            const int cAdapters = RT_MIN(strCount.toInt(), (int)m_cMaxNetworkAdapters);
             for (int i = 0; i < cAdapters; ++i)
             {
                 ipList << machine.GetGuestPropertyValue(QString("/VirtualBox/GuestInfo/Net/%1/V4/IP").arg(i));
@@ -309,264 +403,309 @@ public:
             }
         }
 
-        ulong uEnabled = 0;
-        for (ulong uSlot = 0; uSlot < uMaxCount; ++uSlot)
+        /* Enumerate up to m_cMaxNetworkAdapters adapters: */
+        bool fAdaptersPresent = false;
+        bool fCablesDisconnected = true;
+        for (ulong uSlot = 0; uSlot < m_cMaxNetworkAdapters; ++uSlot)
         {
             const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);
-            if (adapter.GetEnabled())
+            if (machine.isOk() && !adapter.isNull() && adapter.GetEnabled())
             {
+                fAdaptersPresent = true;
                 QString strGuestIp;
                 if (fPropsValid)
                 {
-                    QString strGuestMac = adapter.GetMACAddress();
+                    const QString strGuestMac = adapter.GetMACAddress();
                     int iIp = macList.indexOf(strGuestMac);
                     if (iIp >= 0)
                         strGuestIp = ipList[iIp];
                 }
+                /* Check if the adapter's cable is connected: */
+                const bool fCableConnected = adapter.GetCableConnected();
+                if (fCablesDisconnected && fCableConnected)
+                    fCablesDisconnected = false;
+                /* Append adapter data: */
                 strFullData += QApplication::translate("UIIndicatorsPool",
-                               "<br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr>", "Network adapters tooltip")
+                    "<br><nobr><b>Adapter %1 (%2)</b>: %3 cable %4</nobr>", "Network adapters tooltip")
                     .arg(uSlot + 1)
                     .arg(gpConverter->toString(adapter.GetAttachmentType()))
                     .arg(strGuestIp.isEmpty() ? "" : "IP " + strGuestIp + ", ")
-                    .arg(adapter.GetCableConnected() ?
+                    .arg(fCableConnected ?
                          QApplication::translate("UIIndicatorsPool", "connected", "Network adapters tooltip") :
                          QApplication::translate("UIIndicatorsPool", "disconnected", "Network adapters tooltip"));
-                ++uEnabled;
             }
         }
-
-        setState(uEnabled > 0 ? KDeviceActivity_Idle : KDeviceActivity_Null);
-        if (!uEnabled)
-            setHidden(true);
-
+        /* Handle 'no-adapters' case: */
         if (strFullData.isNull())
             strFullData = QApplication::translate("UIIndicatorsPool",
                               "<br><nobr><b>All network adapters are disabled</b></nobr>", "Network adapters tooltip");
 
-        setToolTip(strToolTip.arg(strFullData));
-    }
-protected slots:
+        /* Hide indicator if there are no enabled adapters: */
+        if (!fAdaptersPresent)
+            hide();
 
-    void sltUpdateNetworkIPs()
-    {
-        updateAppearance();
+        /* Update icon for the 'Null' state: */
+        if (fAdaptersPresent && fCablesDisconnected)
+            setStateIcon(KDeviceActivity_Null, UIIconPool::iconSet(":/nw_disconnected_16px.png"));
+
+        /* Update tool-tip: */
+        setToolTip(strToolTip.arg(strFullData));
+        /* Update indicator state: */
+        setState(fAdaptersPresent && !fCablesDisconnected ? KDeviceActivity_Idle : KDeviceActivity_Null);
     }
 
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
-    QTimer *m_pUpdateTimer;
+    /** Holds the auto-update timer instance. */
+    QTimer *m_pTimerAutoUpdate;
+    /** Holds the maximum amount of the network adapters. */
+    ulong m_cMaxNetworkAdapters;
 };
 
-class UIIndicatorUSB : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: USB indicator. */
+class UIIndicatorUSB : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorUSB(CSession &session)
-      : m_session(session)
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorUSB(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
     {
-        setStateIcon(KDeviceActivity_Idle, QPixmap(":/usb_16px.png"));
-        setStateIcon(KDeviceActivity_Reading, QPixmap(":/usb_read_16px.png"));
-        setStateIcon(KDeviceActivity_Writing, QPixmap(":/usb_write_16px.png"));
-        setStateIcon(KDeviceActivity_Null, QPixmap(":/usb_disabled_16px.png"));
-
+        /* Assign state-icons: */
+        setStateIcon(KDeviceActivity_Idle,    UIIconPool::iconSet(":/usb_16px.png"));
+        setStateIcon(KDeviceActivity_Reading, UIIconPool::iconSet(":/usb_read_16px.png"));
+        setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/usb_write_16px.png"));
+        setStateIcon(KDeviceActivity_Null,    UIIconPool::iconSet(":/usb_disabled_16px.png"));
+        /* Translate finally: */
         retranslateUi();
     }
 
+private:
+
+    /** Retranslation routine. */
     void retranslateUi()
     {
         updateAppearance();
     }
 
+    /** Update routine. */
     void updateAppearance()
     {
-        const CMachine &machine = m_session.GetMachine();
+        /* Get machine: */
+        const CMachine machine = m_pSession->machine();
 
-        QString strToolTip = QApplication::translate("UIIndicatorsPool", "<p style='white-space:pre'><nobr>Indicates the activity of "
-                                "the attached USB devices:</nobr>%1</p>", "USB device tooltip");
+        /* Prepare tool-tip: */
+        QString strToolTip = QApplication::translate("UIIndicatorsPool",
+                                                     "<p style='white-space:pre'><nobr>Indicates the activity of "
+                                                     "the attached USB devices:</nobr>%1</p>", "USB device tooltip");
         QString strFullData;
 
-
-        /*
-         * Check whether there is at least one OHCI USB controllers with
-         * an available proxy.
-         */
-        const CUSBDeviceFilters &filters = machine.GetUSBDeviceFilters();
-        ULONG cOhciCtls = machine.GetUSBControllerCountByType(KUSBControllerType_OHCI);
-        bool fUSBEnabled = !filters.isNull() && cOhciCtls && machine.GetUSBProxyAvailable();
-
-        setState(fUSBEnabled ? KDeviceActivity_Idle : KDeviceActivity_Null);
+        /* Check whether there is at least one USB controller with an available proxy. */
+        bool fUSBEnabled =    !machine.GetUSBDeviceFilters().isNull()
+                           && !machine.GetUSBControllers().isEmpty()
+                           && machine.GetUSBProxyAvailable();
         if (fUSBEnabled)
         {
-            const CConsole &console = m_session.GetConsole();
-
-            const CUSBDeviceVector &devsvec = console.GetUSBDevices();
-            for (int i = 0; i < devsvec.size(); ++ i)
-            {
-                CUSBDevice usb = devsvec[i];
-                strFullData += QString("<br><b><nobr>%1</nobr></b>").arg(vboxGlobal().details(usb));
-            }
+            /* Enumerate all the USB devices: */
+            const CConsole console = m_pSession->console();
+            foreach (const CUSBDevice &usbDevice, console.GetUSBDevices())
+                strFullData += QString("<br><b><nobr>%1</nobr></b>").arg(vboxGlobal().details(usbDevice));
+            /* Handle 'no-usb-devices' case: */
             if (strFullData.isNull())
                 strFullData = QApplication::translate("UIIndicatorsPool", "<br><nobr><b>No USB devices attached</b></nobr>", "USB device tooltip");
         }
-        else
-            strFullData = QApplication::translate("UIIndicatorsPool", "<br><nobr><b>USB Controller is disabled</b></nobr>", "USB device tooltip");
 
+        /* Hide indicator if there are USB controllers: */
+        if (!fUSBEnabled)
+            hide();
+
+        /* Update tool-tip: */
         setToolTip(strToolTip.arg(strFullData));
+        /* Update indicator state: */
+        setState(fUSBEnabled ? KDeviceActivity_Idle : KDeviceActivity_Null);
     }
-
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
 };
 
-class UIIndicatorSharedFolders : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Shared-folders indicator. */
+class UIIndicatorSharedFolders : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorSharedFolders(CSession &session)
-      : m_session(session)
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorSharedFolders(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
     {
-        setStateIcon(KDeviceActivity_Idle, QPixmap(":/sf_16px.png"));
-        setStateIcon(KDeviceActivity_Reading, QPixmap(":/sf_read_16px.png"));
-        setStateIcon(KDeviceActivity_Writing, QPixmap(":/sf_write_16px.png"));
-        setStateIcon(KDeviceActivity_Null, QPixmap(":/sf_disabled_16px.png"));
-
+        /* Assign state-icons: */
+        setStateIcon(KDeviceActivity_Idle,    UIIconPool::iconSet(":/sf_16px.png"));
+        setStateIcon(KDeviceActivity_Reading, UIIconPool::iconSet(":/sf_read_16px.png"));
+        setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/sf_write_16px.png"));
+        setStateIcon(KDeviceActivity_Null,    UIIconPool::iconSet(":/sf_disabled_16px.png"));
+        /* Translate finally: */
         retranslateUi();
     }
 
+private:
+
+    /** Retranslation routine. */
     void retranslateUi()
     {
         updateAppearance();
     }
 
+    /** Update routine. */
     void updateAppearance()
     {
-        const CMachine &machine = m_session.GetMachine();
-        const CConsole &console = m_session.GetConsole();
-
-        QString strToolTip = QApplication::translate("UIIndicatorsPool", "<p style='white-space:pre'><nobr>Indicates the activity of "
-                                "the machine's shared folders:</nobr>%1</p>", "Shared folders tooltip");
+        /* Get objects: */
+        const CMachine machine = m_pSession->machine();
+        const CConsole console = m_pSession->console();
+        const CGuest guest = m_pSession->guest();
 
+        /* Prepare tool-tip: */
+        QString strToolTip = QApplication::translate("UIIndicatorsPool",
+                                                     "<p style='white-space:pre'><nobr>Indicates the activity of "
+                                                     "the machine's shared folders:</nobr>%1</p>", "Shared folders tooltip");
         QString strFullData;
-        QMap<QString, QString> sfs;
 
-        /* Permanent folders */
-        const CSharedFolderVector &psfvec = machine.GetSharedFolders();
-
-        for (int i = 0; i < psfvec.size(); ++ i)
-        {
-            const CSharedFolder &sf = psfvec[i];
+        /* Enumerate all the folders: */
+        QMap<QString, QString> sfs;
+        foreach (const CSharedFolder &sf, machine.GetSharedFolders())
             sfs.insert(sf.GetName(), sf.GetHostPath());
-        }
-
-        /* Transient folders */
-        const CSharedFolderVector &tsfvec = console.GetSharedFolders();
-
-        for (int i = 0; i < tsfvec.size(); ++ i)
-        {
-            const CSharedFolder &sf = tsfvec[i];
+        foreach (const CSharedFolder &sf, console.GetSharedFolders())
             sfs.insert(sf.GetName(), sf.GetHostPath());
-        }
 
-        for (QMap<QString, QString>::const_iterator it = sfs.constBegin(); it != sfs.constEnd(); ++ it)
+        /* Append attachment data: */
+        for (QMap<QString, QString>::const_iterator it = sfs.constBegin(); it != sfs.constEnd(); ++it)
         {
-            /* Select slashes depending on the OS type */
-            if (VBoxGlobal::isDOSType(console.GetGuest().GetOSTypeId()))
+            /* Select slashes depending on the OS type: */
+            if (VBoxGlobal::isDOSType(guest.GetOSTypeId()))
                 strFullData += QString("<br><nobr><b>\\\\vboxsvr\\%1 </b></nobr><nobr>%2</nobr>")
                                        .arg(it.key(), it.value());
             else
                 strFullData += QString("<br><nobr><b>%1 </b></nobr><nobr>%2</nobr>")
                                        .arg(it.key(), it.value());
         }
-
-        if (sfs.count() == 0)
+        /* Handle 'no-folders' case: */
+        if (sfs.isEmpty())
             strFullData = QApplication::translate("UIIndicatorsPool", "<br><nobr><b>No shared folders</b></nobr>", "Shared folders tooltip");
 
-        setState(!sfs.isEmpty() ? KDeviceActivity_Idle : KDeviceActivity_Null);
+        /* Update tool-tip: */
         setToolTip(strToolTip.arg(strFullData));
+        /* Update indicator state: */
+        setState(!sfs.isEmpty() ? KDeviceActivity_Idle : KDeviceActivity_Null);
     }
+};
 
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Display indicator. */
+class UIIndicatorDisplay : public UISessionStateStatusBarIndicator
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorDisplay(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
+    {
+        /* Assign state-icons: */
+        setStateIcon(KDeviceActivity_Null,    UIIconPool::iconSet(":/display_software_16px.png"));
+        setStateIcon(KDeviceActivity_Idle,    UIIconPool::iconSet(":/display_hardware_16px.png"));
+        setStateIcon(KDeviceActivity_Writing, UIIconPool::iconSet(":/display_hardware_write_16px.png"));
+        /* Translate finally: */
+        retranslateUi();
+    }
+
+private:
+
+    /** Retranslation routine. */
+    void retranslateUi()
+    {
+        updateAppearance();
+    }
+
+    /** Update routine. */
+    void updateAppearance()
+    {
+        /* Get machine: */
+        const CMachine machine = m_pSession->machine();
+
+        /* Prepare tool-tip: */
+        QString strToolTip = QApplication::translate("UIIndicatorsPool",
+                                                     "<p style='white-space:pre'>"
+                                                     "<nobr>Indicates the activity of the display:</nobr>%1</p>");
+        QString strFullData;
+
+        /* Video Memory: */
+        const ULONG uVRAMSize = machine.GetVRAMSize();
+        const QString strVRAMSize = VBoxGlobal::tr("<nobr>%1 MB</nobr>", "details report").arg(uVRAMSize);
+        strFullData += QString("<br><nobr><b>%1:</b> %2</nobr>")
+                               .arg(VBoxGlobal::tr("Video Memory", "details report"), strVRAMSize);
+
+        /* Monitor Count: */
+        const ULONG uMonitorCount = machine.GetMonitorCount();
+        if (uMonitorCount > 1)
+        {
+            const QString strMonitorCount = QString::number(uMonitorCount);
+            strFullData += QString("<br><nobr><b>%1:</b> %2</nobr>")
+                                   .arg(VBoxGlobal::tr("Screens", "details report"), strMonitorCount);
+        }
+
+        /* 3D acceleration: */
+        const bool fAcceleration3D = machine.GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable();
+        if (fAcceleration3D)
+        {
+            const QString strAcceleration3D = fAcceleration3D
+                ? VBoxGlobal::tr("Enabled", "details report (3D Acceleration)")
+                : VBoxGlobal::tr("Disabled", "details report (3D Acceleration)");
+            strFullData += QString("<br><nobr><b>%1:</b> %2</nobr>")
+                                   .arg(VBoxGlobal::tr("3D Acceleration", "details report"), strAcceleration3D);
+        }
+
+        /* Update tool-tip: */
+        setToolTip(strToolTip.arg(strFullData));
+        /* Set initial indicator state: */
+        setState(fAcceleration3D ? KDeviceActivity_Idle : KDeviceActivity_Null);
+    }
 };
 
-class UIIndicatorVideoCapture : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Video-capture indicator. */
+class UIIndicatorVideoCapture : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
     Q_PROPERTY(double rotationAngleStart READ rotationAngleStart);
     Q_PROPERTY(double rotationAngleFinal READ rotationAngleFinal);
     Q_PROPERTY(double rotationAngle READ rotationAngle WRITE setRotationAngle);
 
-public:
-
-    /* State enumerator: */
+    /** Video-capture states. */
     enum UIIndicatorStateVideoCapture
     {
         UIIndicatorStateVideoCapture_Disabled = 0,
         UIIndicatorStateVideoCapture_Enabled  = 1
     };
 
-    /* Constructor: */
-    UIIndicatorVideoCapture(CSession &session)
-        : m_session(session)
+public:
+
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorVideoCapture(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
         , m_pAnimation(0)
         , m_dRotationAngle(0)
     {
-        /* Assign state icons: */
-        setStateIcon(UIIndicatorStateVideoCapture_Disabled, QPixmap(":/video_capture_16px.png"));
-        setStateIcon(UIIndicatorStateVideoCapture_Enabled, QPixmap(":/movie_reel_16px.png"));
-
-        /* Prepare *enabled* state animation: */
+        /* Assign state-icons: */
+        setStateIcon(UIIndicatorStateVideoCapture_Disabled, UIIconPool::iconSet(":/video_capture_16px.png"));
+        setStateIcon(UIIndicatorStateVideoCapture_Enabled,  UIIconPool::iconSet(":/movie_reel_16px.png"));
+        /* Create *enabled* state animation: */
         m_pAnimation = UIAnimationLoop::installAnimationLoop(this, "rotationAngle",
                                                                    "rotationAngleStart", "rotationAngleFinal",
                                                                    1000);
-
         /* Translate finally: */
         retranslateUi();
     }
 
-    /* API: Update stuff: */
-    void updateAppearance()
-    {
-        /* Get machine: */
-        CMachine machine = m_session.GetMachine();
-
-        /* Update LED state: */
-        setState(machine.GetVideoCaptureEnabled());
+private slots:
 
-        /* Update LED tool-tip: */
-        QString strToolTip = QApplication::translate("UIIndicatorsPool", "<nobr>Indicates video capturing activity:</nobr><br>%1");
-        switch (state())
-        {
-            case UIIndicatorStateVideoCapture_Disabled:
-            {
-                strToolTip = strToolTip.arg(QApplication::translate("UIIndicatorsPool", "<nobr><b>Video capture disabled</b></nobr>"));
-                break;
-            }
-            case UIIndicatorStateVideoCapture_Enabled:
-            {
-                strToolTip = strToolTip.arg(QApplication::translate("UIIndicatorsPool", "<nobr><b>Video capture file:</b> %1</nobr>"));
-                strToolTip = strToolTip.arg(machine.GetVideoCaptureFile());
-                break;
-            }
-            default:
-                break;
-        }
-        setToolTip(strToolTip);
-    }
-
-public slots:
-
-    /* Handler: State stuff: */
+    /** Handles state change. */
     void setState(int iState)
     {
         /* Update animation state: */
@@ -582,20 +721,19 @@ public slots:
             default:
                 break;
         }
-
         /* Call to base-class: */
-        QIStateIndicator::setState(iState);
+        QIStateStatusBarIndicator::setState(iState);
     }
 
-protected:
+private:
 
-    /* Handler: Translate stuff: */
+    /** Retranslation routine. */
     void retranslateUi()
     {
         updateAppearance();
     }
 
-    /* Handler: Paint stuff: */
+    /** Paint-event handler. */
     void paintEvent(QPaintEvent*)
     {
         /* Create new painter: */
@@ -617,66 +755,107 @@ protected:
         drawContents(&painter);
     }
 
-    /* Properties: Rotation stuff: */
+    /** Update routine. */
+    void updateAppearance()
+    {
+        /* Get machine: */
+        const CMachine machine = m_pSession->machine();
+
+        /* Prepare tool-tip: */
+        QString strToolTip = QApplication::translate("UIIndicatorsPool", "<nobr>Indicates video capturing activity:</nobr><br>%1");
+        switch (state())
+        {
+            case UIIndicatorStateVideoCapture_Disabled:
+            {
+                strToolTip = strToolTip.arg(QApplication::translate("UIIndicatorsPool", "<nobr><b>Video capture disabled</b></nobr>"));
+                break;
+            }
+            case UIIndicatorStateVideoCapture_Enabled:
+            {
+                strToolTip = strToolTip.arg(QApplication::translate("UIIndicatorsPool", "<nobr><b>Video capture file:</b> %1</nobr>"));
+                strToolTip = strToolTip.arg(machine.GetVideoCaptureFile());
+                break;
+            }
+            default:
+                break;
+        }
+
+        /* Update tool-tip: */
+        setToolTip(strToolTip);
+        /* Update indicator state: */
+        setState(machine.GetVideoCaptureEnabled());
+    }
+
+    /** Returns rotation start angle. */
     double rotationAngleStart() const { return 0; }
+    /** Returns rotation finish angle. */
     double rotationAngleFinal() const { return 360; }
+    /** Returns current rotation angle. */
     double rotationAngle() const { return m_dRotationAngle; }
+    /** Defines current rotation angle. */
     void setRotationAngle(double dRotationAngle) { m_dRotationAngle = dRotationAngle; update(); }
 
-    /* For compatibility reason we do it here,
-     * later this should be moved to QIStateIndicator. */
-    CSession &m_session;
+    /** Holds the rotation animation instance. */
     UIAnimationLoop *m_pAnimation;
+    /** Holds current rotation angle. */
     double m_dRotationAngle;
 };
 
-class UIIndicatorFeatures : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Features indicator. */
+class UIIndicatorFeatures : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorFeatures(CSession &session)
-      : m_session(session)
+    /** Constructor, passes @a pSession to the UISessionStateStatusBarIndicator constructor. */
+    UIIndicatorFeatures(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
     {
-        setStateIcon(0, QPixmap(":/vtx_amdv_disabled_16px.png"));
-        setStateIcon(1, QPixmap(":/vtx_amdv_16px.png"));
-
+        /* Assign state-icons: */
+        setStateIcon(0, UIIconPool::iconSet(":/vtx_amdv_disabled_16px.png"));
+        setStateIcon(1, UIIconPool::iconSet(":/vtx_amdv_16px.png"));
+        /* Translate finally: */
         retranslateUi();
     }
 
+private:
+
+    /** Retranslation routine. */
     void retranslateUi()
     {
         updateAppearance();
     }
 
+    /** Update routine. */
     void updateAppearance()
     {
-        const CConsole &console = m_session.GetConsole();
-        if (console.isNull())
-            return;
-
-        const CMachineDebugger &debugger = console.GetDebugger();
-        if (debugger.isNull())
-            return;
+        /* Get objects: */
+        const CMachine machine = m_pSession->machine();
+        const CMachineDebugger debugger = m_pSession->debugger();
 
+        /* VT-x/AMD-V feature: */
         bool bVirtEnabled = debugger.GetHWVirtExEnabled();
         QString virtualization = bVirtEnabled ?
-            VBoxGlobal::tr("Enabled", "details report (VT-x/AMD-V)") :
-            VBoxGlobal::tr("Disabled", "details report (VT-x/AMD-V)");
+            VBoxGlobal::tr("Active", "details report (VT-x/AMD-V)") :
+            VBoxGlobal::tr("Inactive", "details report (VT-x/AMD-V)");
 
+        /* Nested Paging feature: */
         bool bNestEnabled = debugger.GetHWVirtExNestedPagingEnabled();
         QString nestedPaging = bNestEnabled ?
-            VBoxGlobal::tr("Enabled", "details report (Nested Paging)") :
-            VBoxGlobal::tr("Disabled", "details report (Nested Paging)");
+            VBoxGlobal::tr("Active", "details report (Nested Paging)") :
+            VBoxGlobal::tr("Inactive", "details report (Nested Paging)");
 
+        /* Unrestricted Execution feature: */
         bool bUXEnabled = debugger.GetHWVirtExUXEnabled();
         QString unrestrictExec = bUXEnabled ?
-            VBoxGlobal::tr("Enabled", "details report (Unrestricted Execution)") :
-            VBoxGlobal::tr("Disabled", "details report (Unrestricted Execution)");
+            VBoxGlobal::tr("Active", "details report (Unrestricted Execution)") :
+            VBoxGlobal::tr("Inactive", "details report (Unrestricted Execution)");
 
-        QString strCPUExecCap = QString::number(console.GetMachine().GetCPUExecutionCap());
+        /* CPU Execution Cap feature: */
+        QString strCPUExecCap = QString::number(machine.GetCPUExecutionCap());
 
+        /* Prepare tool-tip: */
         QString tip(QApplication::translate("UIIndicatorsPool",
                                             "Additional feature status:"
                                             "<br><nobr><b>%1:</b> %2</nobr>"
@@ -689,105 +868,161 @@ public:
                     .arg(VBoxGlobal::tr("Unrestricted Execution"), unrestrictExec)
                     .arg(VBoxGlobal::tr("Execution Cap", "details report"), strCPUExecCap));
 
-        int cpuCount = console.GetMachine().GetCPUCount();
+        /* CPU count: */
+        int cpuCount = machine.GetCPUCount();
         if (cpuCount > 1)
             tip += QApplication::translate("UIIndicatorsPool", "<br><nobr><b>%1:</b> %2</nobr>", "Virtualization Stuff LED")
                       .arg(VBoxGlobal::tr("Processor(s)", "details report")).arg(cpuCount);
 
+        /* Update tool-tip: */
         setToolTip(tip);
+        /* Update indicator state: */
         setState(bVirtEnabled);
     }
-
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
 };
 
-class UIIndicatorMouse : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Mouse indicator. */
+class UIIndicatorMouse : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorMouse(CSession &session)
-      : m_session(session)
+    /** Constructor, using @a pSession for state-update routine. */
+    UIIndicatorMouse(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
     {
-        setStateIcon(0, QPixmap(":/mouse_disabled_16px.png"));
-        setStateIcon(1, QPixmap(":/mouse_16px.png"));
-        setStateIcon(2, QPixmap(":/mouse_seamless_16px.png"));
-        setStateIcon(3, QPixmap(":/mouse_can_seamless_16px.png"));
-        setStateIcon(4, QPixmap(":/mouse_can_seamless_uncaptured_16px.png"));
-
+        /* Assign state-icons: */
+        setStateIcon(0, UIIconPool::iconSet(":/mouse_disabled_16px.png"));
+        setStateIcon(1, UIIconPool::iconSet(":/mouse_16px.png"));
+        setStateIcon(2, UIIconPool::iconSet(":/mouse_seamless_16px.png"));
+        setStateIcon(3, UIIconPool::iconSet(":/mouse_can_seamless_16px.png"));
+        setStateIcon(4, UIIconPool::iconSet(":/mouse_can_seamless_uncaptured_16px.png"));
+        /* Configure connection: */
+        connect(pSession, SIGNAL(sigMouseStateChange(int)), this, SLOT(setState(int)));
+        setState(pSession->mouseState());
+        /* Translate finally: */
         retranslateUi();
     }
 
-    void retranslateUi()
-    {
-        setToolTip(QApplication::translate("UIIndicatorsPool", "Indicates whether the host mouse pointer is captured by the guest OS:<br>"
-                      "<nobr><img src=:/mouse_disabled_16px.png/>  pointer is not captured</nobr><br>"
-                      "<nobr><img src=:/mouse_16px.png/>  pointer is captured</nobr><br>"
-                      "<nobr><img src=:/mouse_seamless_16px.png/>  mouse integration (MI) is On</nobr><br>"
-                      "<nobr><img src=:/mouse_can_seamless_16px.png/>  MI is Off, pointer is captured</nobr><br>"
-                      "<nobr><img src=:/mouse_can_seamless_uncaptured_16px.png/>  MI is Off, pointer is not captured</nobr><br>"
-                      "Note that the mouse integration feature requires Guest Additions to be installed in the guest OS."));
-    }
-
-public slots:
+private slots:
 
+    /** Handles state change. */
     void setState(int iState)
     {
         if ((iState & UIMouseStateType_MouseAbsoluteDisabled) &&
             (iState & UIMouseStateType_MouseAbsolute) &&
             !(iState & UIMouseStateType_MouseCaptured))
         {
-            QIStateIndicator::setState(4);
+            QIStateStatusBarIndicator::setState(4);
         }
         else
         {
-            QIStateIndicator::setState(iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured));
+            QIStateStatusBarIndicator::setState(iState & (UIMouseStateType_MouseAbsolute | UIMouseStateType_MouseCaptured));
         }
     }
 
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
+private:
+
+    /** Retranslation routine. */
+    void retranslateUi()
+    {
+        setToolTip(QApplication::translate("UIIndicatorsPool",
+                   "Indicates whether the host mouse pointer is captured by the guest OS:<br>"
+                   "<nobr><img src=:/mouse_disabled_16px.png/>  pointer is not captured</nobr><br>"
+                   "<nobr><img src=:/mouse_16px.png/>  pointer is captured</nobr><br>"
+                   "<nobr><img src=:/mouse_seamless_16px.png/>  mouse integration (MI) is On</nobr><br>"
+                   "<nobr><img src=:/mouse_can_seamless_16px.png/>  MI is Off, pointer is captured</nobr><br>"
+                   "<nobr><img src=:/mouse_can_seamless_uncaptured_16px.png/>  MI is Off, pointer is not captured</nobr><br>"
+                   "Note that the mouse integration feature requires Guest Additions to be installed in the guest OS."));
+    }
+
+    /** Update routine. */
+    void updateAppearance() {}
 };
 
-class UIIndicatorKeyboard : public QIStateIndicator
+/** UISessionStateStatusBarIndicator extension for Runtime UI: Keyboard indicator. */
+class UIIndicatorKeyboard : public UISessionStateStatusBarIndicator
 {
     Q_OBJECT;
 
 public:
 
-    UIIndicatorKeyboard(CSession &session)
-      : m_session(session)
+    /** Constructor, using @a pSession for state-update routine. */
+    UIIndicatorKeyboard(UISession *pSession)
+        : UISessionStateStatusBarIndicator(pSession)
     {
-        setStateIcon(0, QPixmap(":/hostkey_16px.png"));
-        setStateIcon(1, QPixmap(":/hostkey_captured_16px.png"));
-        setStateIcon(2, QPixmap(":/hostkey_pressed_16px.png"));
-        setStateIcon(3, QPixmap(":/hostkey_captured_pressed_16px.png"));
-
+        /* Assign state-icons: */
+        setStateIcon(0, UIIconPool::iconSet(":/hostkey_16px.png"));
+        setStateIcon(1, UIIconPool::iconSet(":/hostkey_captured_16px.png"));
+        setStateIcon(2, UIIconPool::iconSet(":/hostkey_pressed_16px.png"));
+        setStateIcon(3, UIIconPool::iconSet(":/hostkey_captured_pressed_16px.png"));
+        /* Configure connection: */
+        connect(pSession, SIGNAL(sigKeyboardStateChange(int)), this, SLOT(setState(int)));
+        setState(pSession->keyboardState());
+        /* Translate finally: */
         retranslateUi();
     }
 
+private:
+
+    /** Retranslation routine. */
     void retranslateUi()
     {
-        setToolTip(QApplication::translate("UIIndicatorsPool", "Indicates whether the keyboard is captured by the guest OS "
-                      "(<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>)."));
+        setToolTip(QApplication::translate("UIIndicatorsPool",
+                   "Indicates whether the keyboard is captured by the guest OS "
+                   "(<img src=:/hostkey_captured_16px.png/>) or not (<img src=:/hostkey_16px.png/>)."));
     }
 
-protected:
-    /* For compatibility reason we do it here, later this should be moved to
-     * QIStateIndicator. */
-    CSession &m_session;
+    /** Update routine. */
+    void updateAppearance() {}
 };
 
-UIIndicatorsPool::UIIndicatorsPool(CSession &session, QObject *pParent)
-    : QObject(pParent)
-    , m_session(session)
-    , m_pool(IndicatorType_Max)
+/** QITextStatusBarIndicator extension for Runtime UI: Keyboard-extension indicator. */
+class UIIndicatorKeyboardExtension : public QIWithRetranslateUI<QITextStatusBarIndicator>
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor. */
+    UIIndicatorKeyboardExtension()
+    {
+        /* Make sure host-combination label will be updated: */
+        connect(&vboxGlobal().settings(), SIGNAL(propertyChanged(const char *, const char *)),
+                this, SLOT(sltUpdateAppearance()));
+        /* Translate finally: */
+        retranslateUi();
+    }
+
+public slots:
+
+    /** Update routine. */
+    void sltUpdateAppearance()
+    {
+        setText(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo()));
+    }
+
+private:
+
+    /** Retranslation routine. */
+    void retranslateUi()
+    {
+        sltUpdateAppearance();
+        setToolTip(QApplication::translate("UIMachineWindowNormal",
+                                           "Shows the currently assigned Host key.<br>"
+                                           "This key, when pressed alone, toggles the keyboard and mouse "
+                                           "capture state. It can also be used in combination with other keys "
+                                           "to quickly perform actions from the main menu."));
+    }
+};
+
+
+UIIndicatorsPool::UIIndicatorsPool(UISession *pSession, QWidget *pParent /* = 0 */)
+    : QWidget(pParent)
+    , m_pSession(pSession)
+    , m_fEnabled(false)
+    , m_pTimerAutoUpdate(0)
 {
     /* Prepare: */
     prepare();
@@ -799,53 +1034,317 @@ UIIndicatorsPool::~UIIndicatorsPool()
     cleanup();
 }
 
-QIStateIndicator* UIIndicatorsPool::indicator(IndicatorType index)
+void UIIndicatorsPool::updateAppearance(IndicatorType indicatorType)
+{
+    /* Skip missed indicators: */
+    if (!m_pool.contains(indicatorType))
+        return;
+
+    /* Get indicator: */
+    QIStatusBarIndicator *pIndicator = m_pool.value(indicatorType);
+
+    /* Assert indicators with NO appearance: */
+    UISessionStateStatusBarIndicator *pSessionStateIndicator =
+        qobject_cast<UISessionStateStatusBarIndicator*>(pIndicator);
+    AssertPtrReturnVoid(pSessionStateIndicator);
+
+    /* Update indicator appearance: */
+    pSessionStateIndicator->updateAppearance();
+}
+
+void UIIndicatorsPool::setAutoUpdateIndicatorStates(bool fEnabled)
+{
+    /* Make sure auto-update timer exists: */
+    AssertPtrReturnVoid(m_pTimerAutoUpdate);
+
+    /* Start/stop timer: */
+    if (fEnabled)
+        m_pTimerAutoUpdate->start(100);
+    else
+        m_pTimerAutoUpdate->stop();
+}
+
+void UIIndicatorsPool::sltHandleConfigurationChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (vboxGlobal().managedVMUuid() != strMachineID)
+        return;
+
+    /* Update pool: */
+    updatePool();
+}
+
+void UIIndicatorsPool::sltAutoUpdateIndicatorStates()
+{
+    /* We should update states for following indicators: */
+    QVector<KDeviceType> deviceTypes;
+    if (m_pool.contains(IndicatorType_HardDisks))
+        deviceTypes.append(KDeviceType_HardDisk);
+    if (m_pool.contains(IndicatorType_OpticalDisks))
+        deviceTypes.append(KDeviceType_DVD);
+    if (m_pool.contains(IndicatorType_FloppyDisks))
+        deviceTypes.append(KDeviceType_Floppy);
+    if (m_pool.contains(IndicatorType_USB))
+        deviceTypes.append(KDeviceType_USB);
+    if (m_pool.contains(IndicatorType_Network))
+        deviceTypes.append(KDeviceType_Network);
+    if (m_pool.contains(IndicatorType_SharedFolders))
+        deviceTypes.append(KDeviceType_SharedFolder);
+    if (m_pool.contains(IndicatorType_Display))
+        deviceTypes.append(KDeviceType_Graphics3D);
+
+    /* Acquire current states from the console: */
+    CConsole console = m_pSession->console();
+    if (console.isNull() || !console.isOk())
+        return;
+    const QVector<KDeviceActivity> states = console.GetDeviceActivity(deviceTypes);
+    AssertReturnVoid(console.isOk());
+
+    /* Update indicators with the acquired states: */
+    for (int iIndicator = 0; iIndicator < states.size(); ++iIndicator)
+    {
+        QIStatusBarIndicator *pIndicator = 0;
+        switch (deviceTypes[iIndicator])
+        {
+            case KDeviceType_HardDisk:     pIndicator = m_pool.value(IndicatorType_HardDisks); break;
+            case KDeviceType_DVD:          pIndicator = m_pool.value(IndicatorType_OpticalDisks); break;
+            case KDeviceType_Floppy:       pIndicator = m_pool.value(IndicatorType_FloppyDisks); break;
+            case KDeviceType_USB:          pIndicator = m_pool.value(IndicatorType_USB); break;
+            case KDeviceType_Network:      pIndicator = m_pool.value(IndicatorType_Network); break;
+            case KDeviceType_SharedFolder: pIndicator = m_pool.value(IndicatorType_SharedFolders); break;
+            case KDeviceType_Graphics3D:   pIndicator = m_pool.value(IndicatorType_Display); break;
+            default: AssertFailed(); break;
+        }
+        if (pIndicator)
+            updateIndicatorStateForDevice(pIndicator, states[iIndicator]);
+    }
+}
+
+void UIIndicatorsPool::sltContextMenuRequest(QIStatusBarIndicator *pIndicator, QContextMenuEvent *pEvent)
 {
-    /* Just return what already exists: */
-    return m_pool[index];
+    /* If that is one of pool indicators: */
+    foreach (IndicatorType indicatorType, m_pool.keys())
+        if (m_pool[indicatorType] == pIndicator)
+        {
+            /* Notify listener: */
+            emit sigContextMenuRequest(indicatorType, pEvent->globalPos());
+            return;
+        }
 }
 
 void UIIndicatorsPool::prepare()
 {
-    /* Get the list of restricted indicators: */
-    CMachine machine = m_session.GetMachine();
-    QList<IndicatorType> restrictedIndicators = vboxGlobal().restrictedStatusBarIndicators(machine);
+    /* Prepare connections: */
+    prepareConnections();
+    /* Prepare contents: */
+    prepareContents();
+    /* Prepare auto-update timer: */
+    prepareUpdateTimer();
+}
 
-    /* Populate indicator-pool: */
-    for (int iIndex = 0; iIndex < IndicatorType_Max; ++iIndex)
+void UIIndicatorsPool::prepareConnections()
+{
+    /* Listen for the status-bar configuration changes: */
+    connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange(const QString&)),
+            this, SLOT(sltHandleConfigurationChange(const QString&)));
+}
+
+void UIIndicatorsPool::prepareContents()
+{
+    /* Create main-layout: */
+    m_pMainLayout = new QHBoxLayout(this);
+    AssertPtrReturnVoid(m_pMainLayout);
     {
-        /* Make sure indicator presence is permitted: */
-        IndicatorType index = static_cast<IndicatorType>(iIndex);
-        if (restrictedIndicators.contains(index))
+        /* Configure main-layout: */
+        m_pMainLayout->setContentsMargins(0, 0, 0, 0);
+        m_pMainLayout->setSpacing(5);
+        /* Update pool: */
+        updatePool();
+    }
+}
+
+void UIIndicatorsPool::prepareUpdateTimer()
+{
+    /* Create auto-update timer: */
+    m_pTimerAutoUpdate = new QTimer(this);
+    AssertPtrReturnVoid(m_pTimerAutoUpdate);
+    {
+        /* Configure auto-update timer: */
+        connect(m_pTimerAutoUpdate, SIGNAL(timeout()),
+                this, SLOT(sltAutoUpdateIndicatorStates()));
+        setAutoUpdateIndicatorStates(true);
+    }
+}
+
+void UIIndicatorsPool::updatePool()
+{
+    /* Acquire status-bar availability: */
+    m_fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid());
+    /* If status-bar is not enabled: */
+    if (!m_fEnabled)
+    {
+        /* Remove all indicators: */
+        while (!m_pool.isEmpty())
+        {
+            const IndicatorType firstType = m_pool.keys().first();
+            delete m_pool.value(firstType);
+            m_pool.remove(firstType);
+        }
+        /* And return: */
+        return;
+    }
+
+    /* Acquire status-bar restrictions: */
+    m_restrictions = gEDataManager->restrictedStatusBarIndicators(vboxGlobal().managedVMUuid());
+    /* Remove restricted indicators: */
+    foreach (const IndicatorType &indicatorType, m_restrictions)
+    {
+        if (m_pool.contains(indicatorType))
+        {
+            delete m_pool.value(indicatorType);
+            m_pool.remove(indicatorType);
+        }
+    }
+
+    /* Acquire status-bar order: */
+    m_order = gEDataManager->statusBarIndicatorOrder(vboxGlobal().managedVMUuid());
+    /* Make sure the order is complete taking restrictions into account: */
+    for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType)
+    {
+        /* Get iterated type: */
+        IndicatorType type = (IndicatorType)iType;
+        /* Skip invalid type: */
+        if (type == IndicatorType_Invalid)
             continue;
+        /* Take restriction/presence into account: */
+        bool fRestricted = m_restrictions.contains(type);
+        bool fPresent = m_order.contains(type);
+        if (fRestricted && fPresent)
+            m_order.removeAll(type);
+        else if (!fRestricted && !fPresent)
+            m_order << type;
+    }
 
-        /* Prepare indicator: */
-        switch (index)
+    /* Add/Update allowed indicators: */
+    foreach (const IndicatorType &indicatorType, m_order)
+    {
+        /* Indicator exists: */
+        if (m_pool.contains(indicatorType))
         {
-            case IndicatorType_HardDisks:     m_pool[index] = new UIIndicatorHardDisks(m_session); break;
-            case IndicatorType_OpticalDisks:  m_pool[index] = new UIIndicatorOpticalDisks(m_session); break;
-            case IndicatorType_FloppyDisks:   m_pool[index] = new UIIndicatorFloppyDisks(m_session); break;
-            case IndicatorType_Network:       m_pool[index] = new UIIndicatorNetwork(m_session); break;
-            case IndicatorType_USB:           m_pool[index] = new UIIndicatorUSB(m_session); break;
-            case IndicatorType_SharedFolders: m_pool[index] = new UIIndicatorSharedFolders(m_session); break;
-            case IndicatorType_VideoCapture:  m_pool[index] = new UIIndicatorVideoCapture(m_session); break;
-            case IndicatorType_Features:      m_pool[index] = new UIIndicatorFeatures(m_session); break;
-            case IndicatorType_Mouse:         m_pool[index] = new UIIndicatorMouse(m_session); break;
-            case IndicatorType_Keyboard:      m_pool[index] = new UIIndicatorKeyboard(m_session); break;
-            default: break;
+            /* Get indicator: */
+            QIStatusBarIndicator *pIndicator = m_pool.value(indicatorType);
+            /* Make sure it have valid position: */
+            const int iWantedIndex = indicatorPosition(indicatorType);
+            const int iActualIndex = m_pMainLayout->indexOf(pIndicator);
+            if (iActualIndex != iWantedIndex)
+            {
+                /* Re-inject indicator into main-layout at proper position: */
+                m_pMainLayout->removeWidget(pIndicator);
+                m_pMainLayout->insertWidget(iWantedIndex, pIndicator);
+            }
         }
+        /* Indicator missed: */
+        else
+        {
+            /* Create indicator: */
+            switch (indicatorType)
+            {
+                case IndicatorType_HardDisks:         m_pool[indicatorType] = new UIIndicatorHardDrive(m_pSession);     break;
+                case IndicatorType_OpticalDisks:      m_pool[indicatorType] = new UIIndicatorOpticalDisks(m_pSession);  break;
+                case IndicatorType_FloppyDisks:       m_pool[indicatorType] = new UIIndicatorFloppyDisks(m_pSession);   break;
+                case IndicatorType_Network:           m_pool[indicatorType] = new UIIndicatorNetwork(m_pSession);       break;
+                case IndicatorType_USB:               m_pool[indicatorType] = new UIIndicatorUSB(m_pSession);           break;
+                case IndicatorType_SharedFolders:     m_pool[indicatorType] = new UIIndicatorSharedFolders(m_pSession); break;
+                case IndicatorType_Display:           m_pool[indicatorType] = new UIIndicatorDisplay(m_pSession);       break;
+                case IndicatorType_VideoCapture:      m_pool[indicatorType] = new UIIndicatorVideoCapture(m_pSession);  break;
+                case IndicatorType_Features:          m_pool[indicatorType] = new UIIndicatorFeatures(m_pSession);      break;
+                case IndicatorType_Mouse:             m_pool[indicatorType] = new UIIndicatorMouse(m_pSession);         break;
+                case IndicatorType_Keyboard:          m_pool[indicatorType] = new UIIndicatorKeyboard(m_pSession);      break;
+                case IndicatorType_KeyboardExtension: m_pool[indicatorType] = new UIIndicatorKeyboardExtension;         break;
+                default: break;
+            }
+            /* Configure indicator: */
+            connect(m_pool.value(indicatorType), SIGNAL(sigContextMenuRequest(QIStatusBarIndicator*, QContextMenuEvent*)),
+                    this, SLOT(sltContextMenuRequest(QIStatusBarIndicator*, QContextMenuEvent*)));
+            /* Insert indicator into main-layout at proper position: */
+            m_pMainLayout->insertWidget(indicatorPosition(indicatorType), m_pool.value(indicatorType));
+        }
+    }
+}
+
+void UIIndicatorsPool::cleanupUpdateTimer()
+{
+    /* Destroy auto-update timer: */
+    AssertPtrReturnVoid(m_pTimerAutoUpdate);
+    {
+        m_pTimerAutoUpdate->stop();
+        delete m_pTimerAutoUpdate;
+        m_pTimerAutoUpdate = 0;
+    }
+}
+
+void UIIndicatorsPool::cleanupContents()
+{
+    /* Cleanup indicators: */
+    while (!m_pool.isEmpty())
+    {
+        const IndicatorType firstType = m_pool.keys().first();
+        delete m_pool.value(firstType);
+        m_pool.remove(firstType);
     }
 }
 
 void UIIndicatorsPool::cleanup()
 {
-    /* Wipe-out indicator-pool: */
-    for (int iIndex = 0; iIndex < IndicatorType_Max; ++iIndex)
+    /* Cleanup auto-update timer: */
+    cleanupUpdateTimer();
+    /* Cleanup indicators: */
+    cleanupContents();
+}
+
+void UIIndicatorsPool::contextMenuEvent(QContextMenuEvent *pEvent)
+{
+    /* Do not pass-through context menu events,
+     * otherwise they will raise the underlying status-bar context-menu. */
+    pEvent->accept();
+}
+
+int UIIndicatorsPool::indicatorPosition(IndicatorType indicatorType) const
+{
+    int iPosition = 0;
+    foreach (const IndicatorType &iteratedIndicatorType, m_order)
+        if (iteratedIndicatorType == indicatorType)
+            return iPosition;
+        else
+            ++iPosition;
+    return iPosition;
+}
+
+void UIIndicatorsPool::updateIndicatorStateForDevice(QIStatusBarIndicator *pIndicator, KDeviceActivity state)
+{
+    /* Assert indicators with NO state: */
+    QIStateStatusBarIndicator *pStateIndicator = qobject_cast<QIStateStatusBarIndicator*>(pIndicator);
+    AssertPtrReturnVoid(pStateIndicator);
+
+    /* Skip indicators with NULL state: */
+    if (pStateIndicator->state() == KDeviceActivity_Null)
+        return;
+
+    /* Paused VM have all indicator states set to IDLE: */
+    if (m_pSession->isPaused())
     {
-        /* Wipe-out indicator: */
-        delete m_pool[iIndex];
-        m_pool[iIndex] = 0;
+        /* If current state differs from IDLE => set the IDLE one:  */
+        if (pStateIndicator->state() != KDeviceActivity_Idle)
+            pStateIndicator->setState(KDeviceActivity_Idle);
+    }
+    else
+    {
+        /* If current state differs from actual => set the actual one: */
+        const int iState = (int)state;
+        if (pStateIndicator->state() != iState)
+            pStateIndicator->setState(iState);
     }
 }
 
 #include "UIIndicatorsPool.moc"
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h
index 39bdf4f..d565b5e 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h
@@ -1,11 +1,10 @@
+/* $Id: UIIndicatorsPool.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIIndicatorsPool class declaration
+ * VBox Qt GUI - UIIndicatorsPool class declaration.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,40 +15,109 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIIndicatorsPool_h__
-#define __UIIndicatorsPool_h__
+#ifndef ___UIIndicatorsPool_h___
+#define ___UIIndicatorsPool_h___
+
+/* Qt includes: */
+#include <QWidget>
+#include <QList>
+#include <QMap>
 
 /* GUI includes: */
-#include "QIStateIndicator.h"
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
+
+/* COM includes: */
+#include "COMEnums.h"
 
 /* Forward declarations: */
+class UISession;
 class CSession;
+class QIStatusBarIndicator;
+class QHBoxLayout;
+class QTimer;
 
-/* Indicator pool interface/prototype: */
-class UIIndicatorsPool : public QObject
+/** QWidget extension
+  * providing Runtime UI with status-bar indicators. */
+class UIIndicatorsPool : public QWidget
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies about context menu request.
+      * @param indicatorType reflects which type of indicator it is,
+      * @param position      reflects contex-menu position. */
+    void sigContextMenuRequest(IndicatorType indicatorType, const QPoint &position);
+
 public:
 
-    /* Constructor/destructor: */
-    UIIndicatorsPool(CSession &session, QObject *pParent);
+    /** Constructor, passes @a pParent to the QWidget constructor.
+      * @param pSession is used to retrieve appearance information. */
+    UIIndicatorsPool(UISession *pSession, QWidget *pParent = 0);
+    /** Destructor. */
     ~UIIndicatorsPool();
 
-    /* API indicator access stuff: */
-    QIStateIndicator* indicator(IndicatorType index);
+    /** Updates appearance for passed @a indicatorType. */
+    void updateAppearance(IndicatorType indicatorType);
+
+    /** Defines whether indicator-states auto-update is @a fEnabled. */
+    void setAutoUpdateIndicatorStates(bool fEnabled);
+
+private slots:
+
+    /** Handles configuration change. */
+    void sltHandleConfigurationChange(const QString &strMachineID);
+
+    /** Handles indicator-states auto-update. */
+    void sltAutoUpdateIndicatorStates();
+
+    /** Handles context-menu request. */
+    void sltContextMenuRequest(QIStatusBarIndicator *pIndicator, QContextMenuEvent *pEvent);
 
 private:
 
-    /* Helpers: Prepare/cleanup stuff: */
+    /** Prepare routine. */
     void prepare();
+    /** Prepare connections routine: */
+    void prepareConnections();
+    /** Prepare contents routine. */
+    void prepareContents();
+    /** Prepare update-timer routine: */
+    void prepareUpdateTimer();
+
+    /** Update pool routine. */
+    void updatePool();
+
+    /** Cleanup update-timer routine: */
+    void cleanupUpdateTimer();
+    /** Cleanup contents routine. */
+    void cleanupContents();
+    /** Cleanup routine. */
     void cleanup();
 
-    /* Variables: */
-    CSession &m_session;
-    QVector<QIStateIndicator*> m_pool;
-};
+    /** Context-menu event handler. */
+    void contextMenuEvent(QContextMenuEvent *pEvent);
+
+    /** Returns position for passed @a indicatorType. */
+    int indicatorPosition(IndicatorType indicatorType) const;
 
-#endif // __UIIndicatorsPool_h__
+    /** Updates passed @a pIndicator with current @a state value. */
+    void updateIndicatorStateForDevice(QIStatusBarIndicator *pIndicator, KDeviceActivity state);
+
+    /** Holds the UI session reference. */
+    UISession *m_pSession;
+    /** Holds whether status-bar is enabled. */
+    bool m_fEnabled;
+    /** Holds the cached restrictions. */
+    QList<IndicatorType> m_restrictions;
+    /** Holds the cached order. */
+    QList<IndicatorType> m_order;
+    /** Holds cached indicator instances. */
+    QMap<IndicatorType, QIStatusBarIndicator*> m_pool;
+    /** Holds the main-layout instance. */
+    QHBoxLayout *m_pMainLayout;
+    /** Holds the auto-update timer instance. */
+    QTimer *m_pTimerAutoUpdate;
+};
 
+#endif /* !___UIIndicatorsPool_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
index e3baca5..07cf789 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIKeyboardHandler.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandler class implementation
+ * VBox Qt GUI - UIKeyboardHandler class implementation.
  */
 
 /*
@@ -17,27 +15,37 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QKeyEvent>
-#ifdef Q_WS_X11
-# include <QX11Info>
-#endif /* Q_WS_X11 */
+# include <QKeyEvent>
+# ifdef Q_WS_X11
+#  include <QX11Info>
+# endif /* Q_WS_X11 */
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIPopupCenter.h"
-#include "UIActionPool.h"
-#include "UIKeyboardHandlerNormal.h"
-#include "UIKeyboardHandlerFullscreen.h"
-#include "UIKeyboardHandlerSeamless.h"
-#include "UIKeyboardHandlerScale.h"
-#include "UIMouseHandler.h"
-#include "UISession.h"
-#include "UIMachineLogic.h"
-#include "UIMachineWindow.h"
-#include "UIMachineView.h"
-#include "UIHostComboEditor.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIPopupCenter.h"
+# include "UIActionPool.h"
+# include "UIKeyboardHandlerNormal.h"
+# include "UIKeyboardHandlerFullscreen.h"
+# include "UIKeyboardHandlerSeamless.h"
+# include "UIKeyboardHandlerScale.h"
+# include "UIMouseHandler.h"
+# include "UISession.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindow.h"
+# include "UIMachineView.h"
+# include "UIHostComboEditor.h"
+# include "UIExtraDataManager.h"
+
+/* COM includes: */
+# include "CConsole.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Other VBox includes: */
 #ifdef Q_WS_X11
@@ -66,9 +74,6 @@ const int XKeyRelease = KeyRelease;
 #ifdef Q_WS_WIN
 # include "WinKeyboard.h"
 #endif /* Q_WS_WIN */
- 
-/* COM includes: */
-#include "CConsole.h"
 
 /* Enums representing different keyboard-states: */
 enum { KeyExtended = 0x01, KeyPressed = 0x02, KeyPause = 0x04, KeyPrint = 0x08 };
@@ -177,7 +182,7 @@ static Bool checkForX11FocusEventsWorker(Display *pDisplay, XEvent *pEvent,
 {
     NOREF(pDisplay);
     struct CHECKFORX11FOCUSEVENTSDATA *pStruct;
-    
+
     pStruct = (struct CHECKFORX11FOCUSEVENTSDATA *)pArg;
     if (   pEvent->xany.type == XFocusIn
         || pEvent->xany.type == XFocusOut)
@@ -266,7 +271,7 @@ void UIKeyboardHandler::captureKeyboard(ulong uScreenId)
 #endif
 
         /* Notify all the listeners: */
-        emit keyboardStateChanged(keyboardState());
+        emit sigStateChange(state());
     }
 }
 
@@ -321,13 +326,12 @@ void UIKeyboardHandler::releaseKeyboard()
         m_iKeyboardCaptureViewIndex = -1;
 
         /* Notify all the listeners: */
-        emit keyboardStateChanged(keyboardState());
+        emit sigStateChange(state());
     }
 }
 
 void UIKeyboardHandler::releaseAllPressedKeys(bool aReleaseHostKey /* = true */)
 {
-    CKeyboard keyboard = session().GetConsole().GetKeyboard();
     bool fSentRESEND = false;
 
     /* Send a dummy scan code (RESEND) to prevent the guest OS from recognizing
@@ -341,22 +345,22 @@ void UIKeyboardHandler::releaseAllPressedKeys(bool aReleaseHostKey /* = true */)
         {
             if (!fSentRESEND)
             {
-                keyboard.PutScancode (0xFE);
+                keyboard().PutScancode(0xFE);
                 fSentRESEND = true;
             }
-            keyboard.PutScancode(i | 0x80);
+            keyboard().PutScancode(i | 0x80);
         }
         else if (m_pressedKeys[i] & IsExtKeyPressed)
         {
             if (!fSentRESEND)
             {
-                keyboard.PutScancode(0xFE);
+                keyboard().PutScancode(0xFE);
                 fSentRESEND = true;
             }
             QVector <LONG> codes(2);
             codes[0] = 0xE0;
             codes[1] = i | 0x80;
-            keyboard.PutScancodes(codes);
+            keyboard().PutScancodes(codes);
         }
         m_pressedKeys[i] = 0;
     }
@@ -378,11 +382,12 @@ void UIKeyboardHandler::releaseAllPressedKeys(bool aReleaseHostKey /* = true */)
         (aReleaseHostKey ? 0 : hostComboModifierMask);
 #endif
 
-    emit keyboardStateChanged(keyboardState());
+    /* Notify all the listeners: */
+    emit sigStateChange(state());
 }
 
 /* Current keyboard state: */
-int UIKeyboardHandler::keyboardState() const
+int UIKeyboardHandler::state() const
 {
     return (m_fIsKeyboardCaptured ? UIViewStateType_KeyboardCaptured : 0) |
            (m_bIsHostComboPressed ? UIViewStateType_HostKeyPressed : 0);
@@ -455,10 +460,6 @@ bool UIKeyboardHandler::winEventFilter(MSG *pMsg, ulong uScreenId)
             /* If present - why not just assert this? */
             if (m_pAltGrMonitor)
             {
-                /* Get the VM keyboard: */
-                CKeyboard keyboard = session().GetConsole().GetKeyboard();
-                Assert(!keyboard.isNull());
-
                 /* Bail out if we are sure that this is a fake left control. */
                 if (m_pAltGrMonitor->isCurrentEventDefinitelyFake(scan, flags & KeyPressed, flags & KeyExtended))
                 {
@@ -469,7 +470,7 @@ bool UIKeyboardHandler::winEventFilter(MSG *pMsg, ulong uScreenId)
                 m_pAltGrMonitor->updateStateFromKeyEvent(scan, flags & KeyPressed, flags & KeyExtended);
                 /* And release left Ctrl key early (if required): */
                 if (m_pAltGrMonitor->isLeftControlReleaseNeeded())
-                    keyboard.PutScancode(0x1D | 0x80);
+                    keyboard().PutScancode(0x1D | 0x80);
             }
 
             /* Check for special Korean keys. Based on the keyboard layout selected
@@ -622,7 +623,7 @@ bool UIKeyboardHandler::x11EventFilter(XEvent *pEvent, ulong uScreenId)
             unsigned scan = handleXKeyEvent(pEvent);
 
             /* Scancodes 0x00 (no valid translation) and 0x80 are ignored: */
-            if (!scan & 0x7F)
+            if (!(scan & 0x7F))
             {
                 fResult = true;
                 break;
@@ -755,7 +756,7 @@ UIKeyboardHandler::UIKeyboardHandler(UIMachineLogic *pMachineLogic)
     , m_bIsHostComboPressed(false)
     , m_bIsHostComboAlone(false)
     , m_bIsHostComboProcessed(false)
-    , m_fPassCAD(false)
+    , m_fPassCADtoGuest(false)
     , m_fDebuggerActive(false)
 #if defined(Q_WS_WIN)
     , m_bIsHostkeyInCapture(false)
@@ -799,7 +800,7 @@ void UIKeyboardHandler::prepareCommon()
     /* Pressed keys: */
     ::memset(m_pressedKeys, 0, sizeof(m_pressedKeys));
 
-    m_cMonitors = uisession()->session().GetMachine().GetMonitorCount();
+    m_cMonitors = uisession()->machine().GetMonitorCount();
 }
 
 void UIKeyboardHandler::loadSettings()
@@ -812,10 +813,8 @@ void UIKeyboardHandler::loadSettings()
 
     /* Extra data settings: */
     {
-        /* CAD settings: */
-        QString passCAD = session().GetConsole().GetMachine().GetExtraData(GUI_PassCAD);
-        if (!passCAD.isEmpty() && passCAD != "false" && passCAD != "no")
-            m_fPassCAD = true;
+        /* CAD setting: */
+        m_fPassCADtoGuest = gEDataManager->passCADtoGuest(vboxGlobal().managedVMUuid());
     }
 }
 
@@ -846,16 +845,21 @@ UIMachineLogic* UIKeyboardHandler::machineLogic() const
     return m_pMachineLogic;
 }
 
+/* Action-pool getter: */
+UIActionPool* UIKeyboardHandler::actionPool() const
+{
+    return machineLogic()->actionPool();
+}
+
 /* UI Session getter: */
 UISession* UIKeyboardHandler::uisession() const
 {
     return machineLogic()->uisession();
 }
 
-/* Main Session getter: */
-CSession& UIKeyboardHandler::session() const
+CKeyboard& UIKeyboardHandler::keyboard() const
 {
-    return uisession()->session();
+    return uisession()->keyboard();
 }
 
 /* Event handler for prepared listener(s): */
@@ -1005,11 +1009,10 @@ bool UIKeyboardHandler::eventFilter(QObject *pWatchedObject, QEvent *pEvent)
                             combo[2] = 0x57 + (pKeyEvent->key() - Qt::Key_F11); /* F11-F12 down */
                             combo[3] = 0xd7 + (pKeyEvent->key() - Qt::Key_F11); /* F11-F12 up   */
                         }
-                        CKeyboard keyboard = session().GetConsole().GetKeyboard();
-                        keyboard.PutScancodes(combo);
+                        keyboard().PutScancodes(combo);
                     }
                     /* Process hot keys not processed in keyEvent() (as in case of non-alphanumeric keys): */
-                    gActionPool->processHotKey(QKeySequence(pKeyEvent->key()));
+                    actionPool()->processHotKey(QKeySequence(pKeyEvent->key()));
                 }
                 else if (!m_bIsHostComboPressed && pEvent->type() == QEvent::KeyRelease)
                 {
@@ -1053,7 +1056,7 @@ bool UIKeyboardHandler::winLowKeyboardEvent(UINT msg, const KBDLLHOOKSTRUCT &eve
     if (   (event.flags & 0x80) /* released */
         && (   (   UIHostCombo::toKeyCodeList(m_globalSettings.hostCombo()).contains(event.vkCode)
                 && !m_bIsHostkeyInCapture)
-            ||    (  m_pressedKeys[event.scanCode]
+            ||    (  m_pressedKeys[event.scanCode & 0x7F]
                    & (IsKbdCaptured | what_pressed))
                == what_pressed))
         return false;
@@ -1242,8 +1245,8 @@ bool UIKeyboardHandler::darwinKeyboardEvent(const void *pvCocoaEvent, EventRef i
  */
 bool UIKeyboardHandler::keyEventCADHandled(uint8_t uScan)
 {
-    /* Check if it's C-A-D and GUI/PassCAD is not true: */
-    if (!m_fPassCAD &&
+    /* Check if it's C-A-D and GUI/PassCAD is not set/allowed: */
+    if (!m_fPassCADtoGuest &&
         uScan == 0x53 /* Del */ &&
         ((m_pressedKeys[0x38] & IsKeyPressed) /* Alt */ ||
          (m_pressedKeys[0x38] & IsExtKeyPressed)) &&
@@ -1399,8 +1402,8 @@ void UIKeyboardHandler::keyEventHandleHostComboRelease(ulong uScreenId)
 #endif /* Q_WS_X11 */
                         if (m_fIsKeyboardCaptured)
                         {
-                            if (uisession()->mouseCapturePolicy() == MouseCapturePolicy_Default ||
-                                uisession()->mouseCapturePolicy() == MouseCapturePolicy_HostComboOnly)
+                            const MouseCapturePolicy mcp = gEDataManager->mouseCapturePolicy(vboxGlobal().managedVMUuid());
+                            if (mcp == MouseCapturePolicy_Default || mcp == MouseCapturePolicy_HostComboOnly)
                                 machineLogic()->mouseHandler()->captureMouse(uScreenId);
                         }
                         else
@@ -1543,28 +1546,24 @@ bool UIKeyboardHandler::keyEvent(int iKey, uint8_t uScan, int fFlags, ulong uScr
         }
     }
 
-    /* Notify all listeners: */
-    emit keyboardStateChanged(keyboardState());
+    /* Notify all the listeners: */
+    emit sigStateChange(state());
 
     /* If the VM is NOT paused: */
     if (!uisession()->isPaused())
     {
-        /* Get the VM keyboard: */
-        CKeyboard keyboard = session().GetConsole().GetKeyboard();
-        Assert(!keyboard.isNull());
-
         /* If there are scan-codes to send: */
         if (uCodesCount)
         {
             /* Send prepared scan-codes to the guest: */
             std::vector<LONG> scancodes(pCodes, &pCodes[uCodesCount]);
-            keyboard.PutScancodes(QVector<LONG>::fromStdVector(scancodes));
+            keyboard().PutScancodes(QVector<LONG>::fromStdVector(scancodes));
         }
 
         /* If full host-key sequence was just finalized: */
         if (isHostComboStateChanged && m_bIsHostComboPressed)
         {
-            keyEventReleaseHostComboKeys(keyboard);
+            keyEventReleaseHostComboKeys(keyboard());
         }
     }
 
@@ -1590,7 +1589,7 @@ bool UIKeyboardHandler::processHotKey(int iHotKey, wchar_t *pHotKey)
         if (!ToUnicodeEx(iHotKey, 0, keys, &symbol, 1, 0, pList[i]) == 1)
             symbol = 0;
         if (symbol)
-            fWasProcessed = gActionPool->processHotKey(QKeySequence((Qt::UNICODE_ACCEL + QChar(symbol).toUpper().unicode())));
+            fWasProcessed = actionPool()->processHotKey(QKeySequence((Qt::UNICODE_ACCEL + QChar(symbol).toUpper().unicode())));
     }
     delete[] pList;
 #endif /* Q_WS_WIN */
@@ -1603,12 +1602,12 @@ bool UIKeyboardHandler::processHotKey(int iHotKey, wchar_t *pHotKey)
     {
         KeySym ks = wrapXkbKeycodeToKeysym(pDisplay, keyCode, i, 0);
         char symbol = 0;
-        if (!XkbTranslateKeySym(pDisplay, &ks, 0, &symbol, 1, NULL) == 1)
+        if (XkbTranslateKeySym(pDisplay, &ks, 0, &symbol, 1, NULL) == 0)
             symbol = 0;
         if (symbol)
         {
             QChar qtSymbol = QString::fromLocal8Bit(&symbol, 1)[0];
-            fWasProcessed = gActionPool->processHotKey(QKeySequence((Qt::UNICODE_ACCEL + qtSymbol.toUpper().unicode())));
+            fWasProcessed = actionPool()->processHotKey(QKeySequence((Qt::UNICODE_ACCEL + qtSymbol.toUpper().unicode())));
         }
     }
 #endif /* Q_WS_X11 */
@@ -1616,7 +1615,7 @@ bool UIKeyboardHandler::processHotKey(int iHotKey, wchar_t *pHotKey)
 #ifdef Q_WS_MAC
     Q_UNUSED(iHotKey);
     if (pHotKey && pHotKey[0] && !pHotKey[1])
-        fWasProcessed = gActionPool->processHotKey(QKeySequence(Qt::UNICODE_ACCEL + QChar(pHotKey[0]).toUpper().unicode()));
+        fWasProcessed = actionPool()->processHotKey(QKeySequence(Qt::UNICODE_ACCEL + QChar(pHotKey[0]).toUpper().unicode()));
 #endif /* Q_WS_MAC */
 
     /* Grab the key from the Qt if it was processed, or pass it to the Qt otherwise
@@ -1715,7 +1714,6 @@ void UIKeyboardHandler::saveKeyStates()
 void UIKeyboardHandler::sendChangedKeyStates()
 {
     QVector <LONG> codes(2);
-    CKeyboard keyboard = session().GetConsole().GetKeyboard();
     for (uint i = 0; i < SIZEOF_ARRAY(m_pressedKeys); ++ i)
     {
         uint8_t os = m_pressedKeysCopy[i];
@@ -1725,7 +1723,7 @@ void UIKeyboardHandler::sendChangedKeyStates()
             codes[0] = i;
             if (!(ns & IsKeyPressed))
                 codes[0] |= 0x80;
-            keyboard.PutScancode(codes[0]);
+            keyboard().PutScancode(codes[0]);
         }
         else if ((os & IsExtKeyPressed) != (ns & IsExtKeyPressed))
         {
@@ -1733,7 +1731,7 @@ void UIKeyboardHandler::sendChangedKeyStates()
             codes[1] = i;
             if (!(ns & IsExtKeyPressed))
                 codes[1] |= 0x80;
-            keyboard.PutScancodes(codes);
+            keyboard().PutScancodes(codes);
         }
     }
 }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
index d231642..139d2af 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.h
@@ -1,7 +1,6 @@
+/* $Id: UIKeyboardHandler.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandler class declaration
+ * VBox Qt GUI - UIKeyboardHandler class declaration.
  */
 
 /*
@@ -24,19 +23,20 @@
 #include <QMap>
 
 /* GUI includes: */
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
 #ifdef Q_WS_MAC
 # include <CoreFoundation/CFBase.h>
 # include <Carbon/Carbon.h>
 #endif /* Q_WS_MAC */
 
 /* COM includes: */
+#include "COMEnums.h"
 #include "CKeyboard.h"
 
 /* Forward declarations: */
 class QWidget;
-class CSession;
 class UISession;
+class UIActionPool;
 class UIMachineLogic;
 class UIMachineWindow;
 class UIMachineView;
@@ -46,12 +46,18 @@ class WinAltGrMonitor;
 #elif defined(Q_WS_X11)
 typedef union  _XEvent XEvent;
 #endif /* Q_WS_X11 */
+class CKeyboard;
 
 /* Delegate to control VM keyboard functionality: */
 class UIKeyboardHandler : public QObject
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies listeners about state-change. */
+    void sigStateChange(int iState);
+
 public:
 
     /* Factory functions to create/destroy keyboard-handler: */
@@ -71,7 +77,7 @@ public:
     void releaseAllPressedKeys(bool aReleaseHostKey = true);
 
     /* Current keyboard state: */
-    int keyboardState() const;
+    int state() const;
 
     /* Some getters required by side-code: */
     bool isHostKeyPressed() const { return m_bIsHostComboPressed; }
@@ -95,11 +101,6 @@ public:
     bool x11EventFilter(XEvent *pEvent, ulong uScreenId);
 #endif
 
-signals:
-
-    /* Notifies listeners about keyboard state-change: */
-    void keyboardStateChanged(int iNewState);
-
 protected slots:
 
     /* Machine state-change handler: */
@@ -121,8 +122,11 @@ protected:
 
     /* Common getters: */
     UIMachineLogic* machineLogic() const;
+    UIActionPool* actionPool() const;
     UISession* uisession() const;
-    CSession& session() const;
+
+    /** Returns the console's keyboard reference. */
+    CKeyboard& keyboard() const;
 
     /* Event handler for registered machine-view(s): */
     bool eventFilter(QObject *pWatchedObject, QEvent *pEvent);
@@ -178,7 +182,7 @@ protected:
     bool m_bIsHostComboPressed : 1;
     bool m_bIsHostComboAlone : 1;
     bool m_bIsHostComboProcessed : 1;
-    bool m_fPassCAD : 1;
+    bool m_fPassCADtoGuest : 1;
     /** Whether the debugger is active.
      * Currently only affects auto capturing. */
     bool m_fDebuggerActive : 1;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
index 0e24a86..3d67eb3 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,278 +15,296 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Local includes: */
-#include "VBoxGlobal.h"
-#include "UIMachine.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogic.h"
-#include "UIMachineWindow.h"
-
-/* Visual state interface: */
-class UIVisualState : public QObject
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* GUI includes: */
+# include "VBoxGlobal.h"
+# include "UIExtraDataManager.h"
+# include "UIMachine.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindow.h"
+# include "UIMessageCenter.h"
+
+/* COM includes: */
+# include "CMachine.h"
+# include "CSession.h"
+# include "CConsole.h"
+# include "CSnapshot.h"
+# include "CProgress.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* static */
+UIMachine* UIMachine::m_spInstance = 0;
+
+/* static */
+bool UIMachine::startMachine(const QString &strID)
 {
-    Q_OBJECT;
+    /* Some restrictions: */
+    AssertMsgReturn(vboxGlobal().isValid(), ("VBoxGlobal is invalid.."), false);
+    AssertMsgReturn(!vboxGlobal().virtualMachine(), ("Machine already started.."), false);
+
+    /* Restore current snapshot if requested: */
+    if (vboxGlobal().shouldRestoreCurrentSnapshot())
+    {
+        /* Create temporary session: */
+        CSession session = vboxGlobal().openSession(strID, KLockType_VM);
+        if (session.isNull())
+            return false;
+
+        /* Which VM we operate on? */
+        CMachine machine = session.GetMachine();
+        /* Which snapshot we are restoring? */
+        CSnapshot snapshot = machine.GetCurrentSnapshot();
+
+        /* Prepare restore-snapshot progress: */
+        CProgress progress = machine.RestoreSnapshot(snapshot);
+        if (!machine.isOk())
+            return msgCenter().cannotRestoreSnapshot(machine, snapshot.GetName(), machine.GetName());
+
+        /* Show the snapshot-discarding progress: */
+        msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_discard_90px.png");
+        if (progress.GetResultCode() != 0)
+            return msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machine.GetName());
+
+        /* Unlock session finally: */
+        session.UnlockMachine();
+
+        /* Clear snapshot-restoring request: */
+        vboxGlobal().setShouldRestoreCurrentSnapshot(false);
+    }
+
+    /* For separate process we should launch VM before UI: */
+    if (vboxGlobal().isSeparateProcess())
+    {
+        /* Get corresponding machine: */
+        CMachine machine = vboxGlobal().virtualBox().FindMachine(vboxGlobal().managedVMUuid());
+        AssertMsgReturn(!machine.isNull(), ("VBoxGlobal::managedVMUuid() should have filter that case before!\n"), false);
 
-public:
+        /* Try to launch corresponding machine: */
+        if (!vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Separate))
+            return false;
+    }
+
+    /* Try to create machine UI: */
+    return create();
+}
 
-    /* Constructor: */
-    UIVisualState(QObject *pParent, UISession *pSession, UIVisualStateType type)
-        : QObject(pParent)
-        , m_type(type)
-        , m_pSession(pSession)
-        , m_pMachineLogic(0)
+/* static */
+bool UIMachine::create()
+{
+    /* Make sure machine is null pointer: */
+    AssertReturn(m_spInstance == 0, false);
+
+    /* Create machine UI: */
+    new UIMachine;
+    /* Make sure it's prepared: */
+    if (!m_spInstance->prepare())
     {
+        /* Destroy machine UI otherwise: */
+        destroy();
+        /* False in that case: */
+        return false;
     }
+    /* True by default: */
+    return true;
+}
+
+/* static */
+void UIMachine::destroy()
+{
+    /* Make sure machine is valid pointer: */
+    AssertReturnVoid(m_spInstance != 0);
+
+    /* Cleanup machine UI: */
+    m_spInstance->cleanup();
+    /* Destroy machine UI: */
+    delete m_spInstance;
+    m_spInstance = 0;
+}
+
+QWidget* UIMachine::activeWindow() const
+{
+    if (machineLogic() &&  machineLogic()->activeMachineWindow())
+        return machineLogic()->activeMachineWindow();
+    return 0;
+}
+
+void UIMachine::asyncChangeVisualState(UIVisualStateType visualState)
+{
+    emit sigRequestAsyncVisualStateChange(visualState);
+}
+
+void UIMachine::sltChangeVisualState(UIVisualStateType visualState)
+{
+    /* Create new machine-logic: */
+    UIMachineLogic *pMachineLogic = UIMachineLogic::create(this, m_pSession, visualState);
 
-    /* Destructor: */
-    ~UIVisualState()
+    /* First we have to check if the selected machine-logic is available at all.
+     * Only then we delete the old machine-logic and switch to the new one. */
+    if (pMachineLogic->checkAvailability())
     {
-        /* Cleanup/delete machine logic if exists: */
+        /* Delete previous machine-logic if exists: */
         if (m_pMachineLogic)
         {
-            /* Cleanup the logic object: */
             m_pMachineLogic->cleanup();
-            /* Destroy the logic object: */
             UIMachineLogic::destroy(m_pMachineLogic);
         }
-    }
-
-    /* Visual state type getter: */
-    UIVisualStateType visualStateType() const { return m_type; }
 
-    /* Machine logic getter: */
-    UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
+        /* Set the new machine-logic as current one: */
+        m_pMachineLogic = pMachineLogic;
+        m_pMachineLogic->prepare();
 
-    /* Method to prepare change one visual state to another: */
-    bool prepareChange()
+        /* Remember new visual state: */
+        m_visualState = visualState;
+    }
+    else
     {
-        m_pMachineLogic = UIMachineLogic::create(this, m_pSession, visualStateType());
-        return m_pMachineLogic->checkAvailability();
+        /* Delete temporary created machine-logic: */
+        pMachineLogic->cleanup();
+        UIMachineLogic::destroy(pMachineLogic);
     }
 
-    /* Method to change one visual state to another: */
-    void change()
+    /* Make sure machine-logic exists: */
+    if (!m_pMachineLogic)
     {
-        /* Prepare the logic object: */
-        m_pMachineLogic->prepare();
+        /* Reset initial visual state  to normal: */
+        m_initialVisualState = UIVisualStateType_Normal;
+        /* Enter initial visual state again: */
+        enterInitialVisualState();
     }
+}
 
-protected:
-
-    /* Variables: */
-    UIVisualStateType m_type;
-    UISession *m_pSession;
-    UIMachineLogic *m_pMachineLogic;
-};
-
-UIMachine::UIMachine(UIMachine **ppSelf, const CSession &session)
+UIMachine::UIMachine()
     : QObject(0)
-    , m_ppThis(ppSelf)
-    , initialStateType(UIVisualStateType_Normal)
-    , m_session(session)
     , m_pSession(0)
-    , m_pVisualState(0)
-    , m_allowedVisualStateTypes(UIVisualStateType_Invalid)
+    , m_allowedVisualStates(UIVisualStateType_Invalid)
+    , m_initialVisualState(UIVisualStateType_Normal)
+    , m_visualState(UIVisualStateType_Invalid)
+    , m_pMachineLogic(0)
 {
-    /* Store self pointer: */
-    if (m_ppThis)
-        *m_ppThis = this;
-
-    /* Create UI session: */
-    m_pSession = new UISession(this, m_session);
-
-    /* Preventing application from closing in case of window(s) closed: */
-    qApp->setQuitOnLastWindowClosed(false);
-
-    /* Cache medium data only if really necessary: */
-    vboxGlobal().startMediumEnumeration(false /* force start */);
-
-    /* Load machine settings: */
-    loadMachineSettings();
-
-    /* Prepare async visual-state change handler: */
-    qRegisterMetaType<UIVisualStateType>();
-    connect(this, SIGNAL(sigRequestAsyncVisualStateChange(UIVisualStateType)),
-            this, SLOT(sltChangeVisualState(UIVisualStateType)),
-            Qt::QueuedConnection);
-
-    /* Enter default (normal) state */
-    enterInitialVisualState();
+    m_spInstance = this;
 }
 
 UIMachine::~UIMachine()
 {
-    /* Save machine settings: */
-    saveMachineSettings();
+    m_spInstance = 0;
+}
+
+bool UIMachine::prepare()
+{
+    /* Try to prepare session UI: */
+    if (!prepareSession())
+        return false;
 
-    /* Delete visual state: */
-    delete m_pVisualState;
-    m_pVisualState = 0;
+    /* Prevent application from closing when all window(s) closed: */
+    qApp->setQuitOnLastWindowClosed(false);
 
-    /* Delete UI session: */
-    delete m_pSession;
-    m_pSession = 0;
+    /* Cache medium data if necessary: */
+    vboxGlobal().startMediumEnumeration(false /* force start */);
 
-    /* Free session finally: */
-    m_session.UnlockMachine();
-    m_session.detach();
+    /* Prepare machine-logic: */
+    prepareMachineLogic();
 
-    /* Clear self pointer: */
-    *m_ppThis = 0;
+    /* Try to initialize session UI: */
+    if (!uisession()->initialize())
+        return false;
 
-    /* Quit application: */
-    QApplication::quit();
+    /* True by default: */
+    return true;
 }
 
-QWidget* UIMachine::activeWindow() const
+bool UIMachine::prepareSession()
 {
-    /* Null if machine-logic not yet created: */
-    if (!machineLogic())
-        return 0;
-    /* Active machine-window otherwise: */
-    return machineLogic()->activeMachineWindow();
-}
+    /* Try to create session UI: */
+    if (!UISession::create(m_pSession, this))
+        return false;
 
-void UIMachine::asyncChangeVisualState(UIVisualStateType visualStateType)
-{
-    emit sigRequestAsyncVisualStateChange(visualStateType);
+    /* True by default: */
+    return true;
 }
 
-void UIMachine::sltChangeVisualState(UIVisualStateType newVisualStateType)
+void UIMachine::prepareMachineLogic()
 {
-    /* Create new state: */
-    UIVisualState *pNewVisualState = new UIVisualState(this, m_pSession, newVisualStateType);
+    /* Prepare async visual state type change handler: */
+    qRegisterMetaType<UIVisualStateType>();
+    connect(this, SIGNAL(sigRequestAsyncVisualStateChange(UIVisualStateType)),
+            this, SLOT(sltChangeVisualState(UIVisualStateType)),
+            Qt::QueuedConnection);
 
-    /* First we have to check if the selected mode is available at all.
-     * Only then we delete the old mode and switch to the new mode. */
-    if (pNewVisualState->prepareChange())
-    {
-        /* Delete previous state: */
-        delete m_pVisualState;
+    /* Load restricted visual states: */
+    UIVisualStateType restrictedVisualStates = gEDataManager->restrictedVisualStates(vboxGlobal().managedVMUuid());
+    /* Acquire allowed visual states: */
+    m_allowedVisualStates = static_cast<UIVisualStateType>(UIVisualStateType_All ^ restrictedVisualStates);
 
-        /* Set the new mode as current mode: */
-        m_pVisualState = pNewVisualState;
-        m_pVisualState->change();
-    }
-    else
+    /* Load requested visual state: */
+    UIVisualStateType requestedVisualState = gEDataManager->requestedVisualState(vboxGlobal().managedVMUuid());
+    /* Check if requested visual state is allowed: */
+    if (isVisualStateAllowed(requestedVisualState))
     {
-        /* Discard the temporary created new state: */
-        delete pNewVisualState;
-
-        /* If there is no state currently created => we have to exit: */
-        if (!m_pVisualState)
-            deleteLater();
+        switch (requestedVisualState)
+        {
+            /* Direct transition to scale/fullscreen mode allowed: */
+            case UIVisualStateType_Scale:      m_initialVisualState = UIVisualStateType_Scale; break;
+            case UIVisualStateType_Fullscreen: m_initialVisualState = UIVisualStateType_Fullscreen; break;
+            /* While to seamless is not, so we have to make request to do transition later: */
+            case UIVisualStateType_Seamless:   uisession()->setRequestedVisualState(UIVisualStateType_Seamless); break;
+            default: break;
+        }
     }
+
+    /* Enter initial visual state: */
+    enterInitialVisualState();
 }
 
-void UIMachine::enterInitialVisualState()
+void UIMachine::cleanupMachineLogic()
 {
-    sltChangeVisualState(initialStateType);
+    /* Session UI can have requested visual state: */
+    if (uisession())
+    {
+        /* Get requested visual state: */
+        UIVisualStateType requestedVisualState = uisession()->requestedVisualState();
+        /* Or current visual state if requested is invalid: */
+        if (requestedVisualState == UIVisualStateType_Invalid)
+            requestedVisualState = m_visualState;
+
+        /* Save requested visual state: */
+        gEDataManager->setRequestedVisualState(requestedVisualState, vboxGlobal().managedVMUuid());
+    }
+
+    /* Destroy machine-logic if exists: */
+    if (machineLogic())
+    {
+        m_pMachineLogic->cleanup();
+        UIMachineLogic::destroy(m_pMachineLogic);
+    }
 }
 
-UIMachineLogic* UIMachine::machineLogic() const
+void UIMachine::cleanupSession()
 {
-    if (m_pVisualState && m_pVisualState->machineLogic())
-        return m_pVisualState->machineLogic();
-    return 0;
+    /* Destroy session UI if exists: */
+    if (uisession())
+        UISession::destroy(m_pSession);
 }
 
-void UIMachine::loadMachineSettings()
+void UIMachine::cleanup()
 {
-    /* Load machine settings: */
-    CMachine machine = uisession()->session().GetMachine();
-    UIVisualStateType restrictedVisualStateTypes = VBoxGlobal::restrictedVisualStateTypes(machine);
-    m_allowedVisualStateTypes = static_cast<UIVisualStateType>(UIVisualStateType_All ^ restrictedVisualStateTypes);
-
-    /* Load extra-data settings: */
-    {
-        /* Machine while saving own settings will save "on" only for current
-         * visual representation mode if its differs from normal mode of course.
-         * But user can alter extra data manually in machine xml file and set there
-         * more than one visual representation mode flags. Shame on such user!
-         * There is no reason to enter in more than one visual representation mode
-         * at machine start, so we are choosing first of requested modes: */
-        bool fIsSomeExtendedModeChosen = false;
-
-        if (!fIsSomeExtendedModeChosen)
-        {
-            /* Test 'scale' flag: */
-            QString strScaleSettings = machine.GetExtraData(GUI_Scale);
-            if (strScaleSettings == "on" && isVisualStateAllowedScale())
-            {
-                fIsSomeExtendedModeChosen = true;
-                /* We can enter scale mode initially: */
-                initialStateType = UIVisualStateType_Scale;
-            }
-        }
+    /* Cleanup machine-logic: */
+    cleanupMachineLogic();
 
-        if (!fIsSomeExtendedModeChosen)
-        {
-            /* Test 'seamless' flag: */
-            QString strSeamlessSettings = machine.GetExtraData(GUI_Seamless);
-            if (strSeamlessSettings == "on" && isVisualStateAllowedSeamless())
-            {
-                fIsSomeExtendedModeChosen = true;
-                /* We can't enter seamless mode initially,
-                 * so we should ask ui-session for that: */
-                uisession()->setRequestedVisualState(UIVisualStateType_Seamless);
-            }
-        }
+    /* Cleanup session UI: */
+    cleanupSession();
 
-        if (!fIsSomeExtendedModeChosen)
-        {
-            /* Test 'fullscreen' flag: */
-            QString strFullscreenSettings = machine.GetExtraData(GUI_Fullscreen);
-            if (strFullscreenSettings == "on" && isVisualStateAllowedFullscreen())
-            {
-                fIsSomeExtendedModeChosen = true;
-                /* We can enter fullscreen mode initially: */
-                initialStateType = UIVisualStateType_Fullscreen;
-            }
-        }
-    }
+    /* Quit application: */
+    QApplication::quit();
 }
 
-void UIMachine::saveMachineSettings()
+void UIMachine::enterInitialVisualState()
 {
-    /* Save machine settings: */
-    CMachine machine = uisession()->session().GetMachine();
-
-    /* Save extra-data settings: */
-    {
-        /* Prepare extra-data values: */
-        QString strFullscreenRequested;
-        QString strSeamlessRequested;
-        QString strScaleRequested;
-        /* Check if some state was requested: */
-        if (uisession()->requestedVisualState() != UIVisualStateType_Invalid)
-        {
-            switch (uisession()->requestedVisualState())
-            {
-                case UIVisualStateType_Fullscreen: strFullscreenRequested = "on"; break;
-                case UIVisualStateType_Seamless: strSeamlessRequested = "on"; break;
-                case UIVisualStateType_Scale: strScaleRequested = "on"; break;
-                default: break;
-            }
-        }
-        /* Check if some state still exists: */
-        else if (m_pVisualState)
-        {
-            switch (m_pVisualState->visualStateType())
-            {
-                case UIVisualStateType_Fullscreen: strFullscreenRequested = "on"; break;
-                case UIVisualStateType_Seamless: strSeamlessRequested = "on"; break;
-                case UIVisualStateType_Scale: strScaleRequested = "on"; break;
-                default: break;
-            }
-        }
-        /* Rewrite extra-data values: */
-        machine.SetExtraData(GUI_Fullscreen, strFullscreenRequested);
-        machine.SetExtraData(GUI_Seamless, strSeamlessRequested);
-        machine.SetExtraData(GUI_Scale, strScaleRequested);
-    }
+    sltChangeVisualState(m_initialVisualState);
 }
 
-#include "UIMachine.moc"
-
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
index c8b9628..167bea9 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
@@ -1,9 +1,10 @@
+/* $Id: UIMachine.h $ */
 /** @file
  * VBox Qt GUI - UIMachine class declaration.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -21,19 +22,19 @@
 #include <QObject>
 
 /* GUI includes: */
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
 #include "UIMachineDefs.h"
 
 /* COM includes: */
 #include "COMEnums.h"
-#include "CSession.h"
 
 /* Forward declarations: */
 class QWidget;
 class UISession;
-class UIVisualState;
 class UIMachineLogic;
 
+/** Singleton QObject extension
+  * used as virtual machine (VM) singleton instance. */
 class UIMachine : public QObject
 {
     Q_OBJECT;
@@ -45,52 +46,74 @@ signals:
 
 public:
 
-    /* Virtual Machine constructor/destructor: */
-    UIMachine(UIMachine **ppSelf, const CSession &session);
-    virtual ~UIMachine();
-
-    /* Public getters: */
-    QWidget* activeWindow() const;
+    /** Static factory to start machine with passed @a strID.
+      * @return true if machine was started, false otherwise. */
+    static bool startMachine(const QString &strID);
+    /** Static constructor. */
+    static bool create();
+    /** Static destructor. */
+    static void destroy();
+    /** Static instance. */
+    static UIMachine* instance() { return m_spInstance; }
+
+    /** Returns session UI instance. */
     UISession *uisession() const { return m_pSession; }
+    /** Returns machine-logic instance. */
+    UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
+    /** Returns active machine-window reference (if possible). */
+    QWidget* activeWindow() const;
 
-    /* API: Visual-state stuff: */
-    bool isVisualStateAllowedFullscreen() const { return m_allowedVisualStateTypes & UIVisualStateType_Fullscreen; }
-    bool isVisualStateAllowedSeamless() const { return m_allowedVisualStateTypes & UIVisualStateType_Seamless; }
-    bool isVisualStateAllowedScale() const { return m_allowedVisualStateTypes & UIVisualStateType_Scale; }
+    /** Returns whether requested visual @a state allowed. */
+    bool isVisualStateAllowed(UIVisualStateType state) const { return m_allowedVisualStates & state; }
 
     /** Requests async visual-state change. */
     void asyncChangeVisualState(UIVisualStateType visualStateType);
 
 private slots:
 
-    /* Visual state-change handler: */
+    /** Visual state-change handler. */
     void sltChangeVisualState(UIVisualStateType visualStateType);
 
 private:
 
-    /* Move VM to default (normal) state: */
+    /** Constructor. */
+    UIMachine();
+    /** Destructor. */
+    ~UIMachine();
+
+    /** Prepare routine. */
+    bool prepare();
+    /** Prepare routine: Session stuff. */
+    bool prepareSession();
+    /** Prepare routine: Machine-logic stuff. */
+    void prepareMachineLogic();
+
+    /** Cleanup routine: Machine-logic stuff. */
+    void cleanupMachineLogic();
+    /** Cleanup routine: Session stuff. */
+    void cleanupSession();
+    /** Cleanup routine. */
+    void cleanup();
+
+    /** Moves VM to initial state. */
     void enterInitialVisualState();
 
-    /* Private getters: */
-    UIMachineLogic* machineLogic() const;
-
-    /* Prepare helpers: */
-    void loadMachineSettings();
+    /** Static instance. */
+    static UIMachine* m_spInstance;
 
-    /* Cleanup helpers: */
-    void saveMachineSettings();
-
-    /* Private variables: */
-    UIMachine **m_ppThis;
-    UIVisualStateType initialStateType;
-    CSession m_session;
+    /** Holds the session UI instance. */
     UISession *m_pSession;
-    UIVisualState *m_pVisualState;
-    UIVisualStateType m_allowedVisualStateTypes;
 
-    /* Friend classes: */
-    friend class UISession;
+    /** Holds allowed visual states. */
+    UIVisualStateType m_allowedVisualStates;
+    /** Holds initial visual state. */
+    UIVisualStateType m_initialVisualState;
+    /** Holds current visual state. */
+    UIVisualStateType m_visualState;
+    /** Holds current machine-logic. */
+    UIMachineLogic *m_pMachineLogic;
 };
 
-#endif /* !___UIMachine_h___ */
+#define gpMachine UIMachine::instance()
 
+#endif /* !___UIMachine_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h
index eaceeb4..95507d9 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineDefs.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Defines for Virtual Machine classes
+ * VBox Qt GUI - Defines for Virtual Machine classes.
  */
 
 /*
@@ -27,16 +26,19 @@ enum UIVisualElement
 {
     UIVisualElement_WindowTitle           = RT_BIT(0),
     UIVisualElement_MouseIntegrationStuff = RT_BIT(1),
-    UIVisualElement_PauseStuff            = RT_BIT(2),
+    UIVisualElement_IndicatorPoolStuff    = RT_BIT(2),
     UIVisualElement_HDStuff               = RT_BIT(3),
     UIVisualElement_CDStuff               = RT_BIT(4),
     UIVisualElement_FDStuff               = RT_BIT(5),
     UIVisualElement_NetworkStuff          = RT_BIT(6),
     UIVisualElement_USBStuff              = RT_BIT(7),
     UIVisualElement_SharedFolderStuff     = RT_BIT(8),
-    UIVisualElement_VideoCapture          = RT_BIT(9),
-    UIVisualElement_FeaturesStuff         = RT_BIT(10),
-    UIVisualElement_MiniToolBar           = RT_BIT(11),
+    UIVisualElement_Display               = RT_BIT(9),
+    UIVisualElement_VideoCapture          = RT_BIT(10),
+    UIVisualElement_FeaturesStuff         = RT_BIT(11),
+#ifndef Q_WS_MAC
+    UIVisualElement_MiniToolBar           = RT_BIT(12),
+#endif /* !Q_WS_MAC */
     UIVisualElement_AllStuff              = 0xFFFF
 };
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
index 3351ec1..f7dfa60 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,117 +15,106 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QDir>
-#include <QFileInfo>
-#include <QImageWriter>
-#include <QPainter>
-#include <QTimer>
-#include <QDateTime>
-#ifdef Q_WS_MAC
-# include <QMenuBar>
-#endif /* Q_WS_MAC */
+# include <QDesktopWidget>
+# include <QDir>
+# include <QFileInfo>
+# include <QPainter>
+# include <QTimer>
+# include <QDateTime>
+# include <QImageWriter>
+# ifdef Q_WS_MAC
+#  include <QMenuBar>
+# endif /* Q_WS_MAC */
+# ifdef Q_WS_X11
+#  include <QX11Info>
+# endif /* Q_WS_X11 */
 
 /* GUI includes: */
-#include "QIFileDialog.h"
-#include "UIActionPoolRuntime.h"
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include "UINetworkManager.h"
-# include "UIDownloaderAdditions.h"
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#include "UIIconPool.h"
-#include "UIKeyboardHandler.h"
-#include "UIMouseHandler.h"
-#include "UIMachineLogic.h"
-#include "UIMachineLogicFullscreen.h"
-#include "UIMachineLogicNormal.h"
-#include "UIMachineLogicSeamless.h"
-#include "UIMachineLogicScale.h"
-#include "UIMachineView.h"
-#include "UIMachineWindow.h"
-#include "UISession.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIPopupCenter.h"
-#include "VBoxTakeSnapshotDlg.h"
-#include "VBoxVMInformationDlg.h"
-#include "UISettingsDialogSpecific.h"
-#include "UIVMLogViewer.h"
-#include "UIConverter.h"
-#include "UIModalWindowManager.h"
-#include "UIMedium.h"
-#include "UIExtraDataEventHandler.h"
-#ifdef Q_WS_MAC
-# include "DockIconPreview.h"
-# include "UIExtraDataEventHandler.h"
-#endif /* Q_WS_MAC */
+# include "QIFileDialog.h"
+# include "UIActionPoolRuntime.h"
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+#  include "UINetworkManager.h"
+#  include "UIDownloaderAdditions.h"
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+# include "UIIconPool.h"
+# include "UIKeyboardHandler.h"
+# include "UIMouseHandler.h"
+# include "UIMachineLogic.h"
+# include "UIMachineLogicFullscreen.h"
+# include "UIMachineLogicNormal.h"
+# include "UIMachineLogicSeamless.h"
+# include "UIMachineLogicScale.h"
+# include "UIFrameBuffer.h"
+# include "UIMachineView.h"
+# include "UIMachineWindow.h"
+# include "UISession.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIPopupCenter.h"
+# include "VBoxTakeSnapshotDlg.h"
+# include "UIVMInfoDialog.h"
+# include "UISettingsDialogSpecific.h"
+# include "UIVMLogViewer.h"
+# include "UIConverter.h"
+# include "UIModalWindowManager.h"
+# include "UIMedium.h"
+# include "UIExtraDataManager.h"
+# include "UIAddDiskEncryptionPasswordDialog.h"
+# ifdef Q_WS_MAC
+#  include "DockIconPreview.h"
+#  include "UIExtraDataManager.h"
+# endif /* Q_WS_MAC */
 
 /* COM includes: */
-#include "CVirtualBoxErrorInfo.h"
-#include "CMachineDebugger.h"
-#include "CSnapshot.h"
-#include "CDisplay.h"
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
-#include "CHostUSBDevice.h"
-#include "CUSBDevice.h"
-#include "CVRDEServer.h"
-#include "CSystemProperties.h"
-#include "CHostVideoInputDevice.h"
-#include "CEmulatedUSB.h"
-#include "CNetworkAdapter.h"
-#ifdef Q_WS_MAC
-# include "CGuest.h"
-#endif /* Q_WS_MAC */
+# include "CVirtualBoxErrorInfo.h"
+# include "CMachineDebugger.h"
+# include "CSnapshot.h"
+# include "CDisplay.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
+# include "CHostUSBDevice.h"
+# include "CUSBDevice.h"
+# include "CVRDEServer.h"
+# include "CSystemProperties.h"
+# include "CHostVideoInputDevice.h"
+# include "CEmulatedUSB.h"
+# include "CNetworkAdapter.h"
+# ifdef Q_WS_MAC
+#  include "CGuest.h"
+# endif /* Q_WS_MAC */
 
 /* Other VBox includes: */
-#include <iprt/path.h>
-#ifdef VBOX_WITH_DEBUGGER_GUI
-# include <iprt/ldr.h>
-#endif /* VBOX_WITH_DEBUGGER_GUI */
+# include <iprt/path.h>
+# include <iprt/thread.h>
+# ifdef VBOX_WITH_DEBUGGER_GUI
+#  include <VBox/dbggui.h>
+#  include <iprt/ldr.h>
+# endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
+
 #ifdef Q_WS_MAC
 # include "DarwinKeyboard.h"
-#endif
+#endif /* Q_WS_MAC */
 #ifdef Q_WS_WIN
 # include "WinKeyboard.h"
-#endif
-
-/* External includes: */
+#endif /* Q_WS_WIN */
 #ifdef Q_WS_X11
 # include <XKeyboard.h>
-# include <QX11Info>
 #endif /* Q_WS_X11 */
 
-struct MediumTarget
-{
-    MediumTarget() : name(QString("")), port(0), device(0), id(QString()), type(UIMediumType_Invalid) {}
-    MediumTarget(const QString &strName, LONG iPort, LONG iDevice)
-        : name(strName), port(iPort), device(iDevice), id(QString()), type(UIMediumType_Invalid) {}
-    MediumTarget(const QString &strName, LONG iPort, LONG iDevice, const QString &strId)
-        : name(strName), port(iPort), device(iDevice), id(strId), type(UIMediumType_Invalid) {}
-    MediumTarget(const QString &strName, LONG iPort, LONG iDevice, UIMediumType eType)
-        : name(strName), port(iPort), device(iDevice), id(QString()), type(eType) {}
-    QString name;
-    LONG port;
-    LONG device;
-    QString id;
-    UIMediumType type;
-};
-Q_DECLARE_METATYPE(MediumTarget);
-
-struct RecentMediumTarget
-{
-    RecentMediumTarget() : name(QString("")), port(0), device(0), location(QString()), type(UIMediumType_Invalid) {}
-    RecentMediumTarget(const QString &strName, LONG iPort, LONG iDevice, const QString &strLocation, UIMediumType eType)
-        : name(strName), port(iPort), device(iDevice), location(strLocation), type(eType) {}
-    QString name;
-    LONG port;
-    LONG device;
-    QString location;
-    UIMediumType type;
-};
-Q_DECLARE_METATYPE(RecentMediumTarget);
 
 struct USBTarget
 {
@@ -200,30 +189,26 @@ void UIMachineLogic::prepare()
     /* Prepare handlers: */
     prepareHandlers();
 
-    /* Prepare machine window(s): */
-    prepareMachineWindows();
-
     /* Prepare menu: */
     prepareMenu();
 
+    /* Prepare machine window(s): */
+    prepareMachineWindows();
+
 #ifdef Q_WS_MAC
     /* Prepare dock: */
     prepareDock();
 #endif /* Q_WS_MAC */
 
-    /* Power up machine: */
-    uisession()->powerUp();
-
-    /* Initialization: */
-    sltMachineStateChanged();
-    sltAdditionsStateChanged();
-    sltMouseCapabilityChanged();
-    sltSwitchKeyboardLedsToGuestLeds();
-
+#if 0 /* To early! The debugger needs a VM handle to work. So, must be done after power on.  Moved to initializePostPowerUp. */
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /* Prepare debugger: */
     prepareDebugger();
 #endif /* VBOX_WITH_DEBUGGER_GUI */
+#endif
+
+    /* Load settings: */
+    loadSettings();
 
     /* Retranslate logic part: */
     retranslateUi();
@@ -231,8 +216,8 @@ void UIMachineLogic::prepare()
 
 void UIMachineLogic::cleanup()
 {
-    /* Deinitialization: */
-    sltSwitchKeyboardLedsToPreviousLeds();
+    /* Save settings: */
+    saveSettings();
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /* Cleanup debugger: */
@@ -259,11 +244,66 @@ void UIMachineLogic::cleanup()
     cleanupActionGroups();
 }
 
+void UIMachineLogic::initializePostPowerUp()
+{
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    prepareDebugger();
+#endif
+    sltMachineStateChanged();
+    sltAdditionsStateChanged();
+    sltMouseCapabilityChanged();
+}
+
+UIActionPool* UIMachineLogic::actionPool() const
+{
+    return uisession()->actionPool();
+}
+
 CSession& UIMachineLogic::session() const
 {
     return uisession()->session();
 }
 
+CMachine& UIMachineLogic::machine() const
+{
+    return uisession()->machine();
+}
+
+CConsole& UIMachineLogic::console() const
+{
+    return uisession()->console();
+}
+
+CDisplay& UIMachineLogic::display() const
+{
+    return uisession()->display();
+}
+
+CGuest& UIMachineLogic::guest() const
+{
+    return uisession()->guest();
+}
+
+CMouse& UIMachineLogic::mouse() const
+{
+    return uisession()->mouse();
+}
+
+CKeyboard& UIMachineLogic::keyboard() const
+{
+    return uisession()->keyboard();
+}
+
+CMachineDebugger& UIMachineLogic::debugger() const
+{
+    return uisession()->debugger();
+}
+
+const QString& UIMachineLogic::machineName() const
+{
+    return uisession()->machineName();
+}
+
 UIMachineWindow* UIMachineLogic::mainMachineWindow() const
 {
     /* Null if machine-window(s) not yet created: */
@@ -362,8 +402,7 @@ void UIMachineLogic::saveState()
 void UIMachineLogic::shutdown()
 {
     /* Warn the user about ACPI is not available if so: */
-    CConsole console = session().GetConsole();
-    if (!console.GetGuestEnteredACPIMode())
+    if (!console().GetGuestEnteredACPIMode())
         return popupCenter().cannotSendACPIToMachine(activeMachineWindow());
 
     /* Shutdown: */
@@ -400,6 +439,22 @@ void UIMachineLogic::notifyAbout3DOverlayVisibilityChange(bool fVisible)
         popupCenter().setPopupStackType(activeMachineWindow(), fVisible ? UIPopupStackType_Separate : UIPopupStackType_Embedded);
         popupCenter().showPopupStack(activeMachineWindow());
     }
+
+    /* Notify other listeners: */
+    emit sigNotifyAbout3DOverlayVisibilityChange(fVisible);
+}
+
+void UIMachineLogic::sltHandleVBoxSVCAvailabilityChange()
+{
+    /* Do nothing if VBoxSVC still availabile: */
+    if (vboxGlobal().isVBoxSVCAvailable())
+        return;
+
+    /* Warn user about that: */
+    msgCenter().warnAboutVBoxSVCUnavailable();
+
+    /* Power VM off: */
+    powerOff(false);
 }
 
 void UIMachineLogic::sltChangeVisualStateToNormal()
@@ -443,11 +498,11 @@ void UIMachineLogic::sltMachineStateChanged()
             /* Prevent machine-view from resizing: */
             uisession()->setGuestResizeIgnored(true);
             /* Get log-folder: */
-            QString strLogFolder = session().GetMachine().GetLogFolder();
+            QString strLogFolder = machine().GetLogFolder();
             /* Take the screenshot for debugging purposes: */
             takeScreenshot(strLogFolder + "/VBox.png", "png");
             /* How should we handle Guru Meditation? */
-            switch (uisession()->guruMeditationHandlerType())
+            switch (gEDataManager->guruMeditationHandlerType(vboxGlobal().managedVMUuid()))
             {
                 /* Ask how to proceed; Power off VM if proposal accepted: */
                 case GuruMeditationHandlerType_Default:
@@ -472,7 +527,7 @@ void UIMachineLogic::sltMachineStateChanged()
         case KMachineState_Paused:
         case KMachineState_TeleportingPausedVM:
         {
-            QAction *pPauseAction = gActionPool->action(UIActionIndexRuntime_Toggle_Pause);
+            QAction *pPauseAction = actionPool()->action(UIActionIndexRT_M_Machine_T_Pause);
             if (!pPauseAction->isChecked())
             {
                 /* Was paused from CSession side: */
@@ -486,7 +541,7 @@ void UIMachineLogic::sltMachineStateChanged()
         case KMachineState_Teleporting:
         case KMachineState_LiveSnapshotting:
         {
-            QAction *pPauseAction = gActionPool->action(UIActionIndexRuntime_Toggle_Pause);
+            QAction *pPauseAction = actionPool()->action(UIActionIndexRT_M_Machine_T_Pause);
             if (pPauseAction->isChecked())
             {
                 /* Was resumed from CSession side: */
@@ -506,7 +561,27 @@ void UIMachineLogic::sltMachineStateChanged()
             {
                 /* VM has been powered off, saved, teleported or aborted.
                  * We must close Runtime UI: */
+                if (vboxGlobal().isSeparateProcess())
+                {
+                    /* Hack: The VM process is terminating, so wait a bit to make sure that
+                     * the session is unlocked and the GUI process can save extradata
+                     * in UIMachine::cleanupMachineLogic.
+                     */
+                    /** @todo Probably should wait for the session state change event. */
+                    KSessionState sessionState = uisession()->session().GetState();
+                    int c = 0;
+                    while (   sessionState == KSessionState_Locked
+                           || sessionState == KSessionState_Unlocking)
+                    {
+                         if (++c > 50) break;
+
+                         RTThreadSleep(100);
+                         sessionState = uisession()->session().GetState();
+                    }
+                }
+
                 uisession()->closeRuntimeUI();
+                return;
             }
             break;
         }
@@ -534,8 +609,9 @@ void UIMachineLogic::sltMachineStateChanged()
 void UIMachineLogic::sltAdditionsStateChanged()
 {
     /* Update action states: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setEnabled(uisession()->isGuestSupportsGraphics());
-    gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->setEnabled(uisession()->isVisualStateAllowedSeamless() && uisession()->isGuestSupportsSeamless());
+    actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->setEnabled(uisession()->isGuestSupportsGraphics());
+    actionPool()->action(UIActionIndexRT_M_View_T_Seamless)->setEnabled(uisession()->isVisualStateAllowed(UIVisualStateType_Seamless) &&
+                                                                          uisession()->isGuestSupportsSeamless());
 }
 
 void UIMachineLogic::sltMouseCapabilityChanged()
@@ -550,15 +626,15 @@ void UIMachineLogic::sltMouseCapabilityChanged()
     Q_UNUSED(fIsMouseSupportsMultiTouch);
 
     /* Update action state: */
-    QAction *pAction = gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration);
+    QAction *pAction = actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration);
     pAction->setEnabled(fIsMouseSupportsAbsolute && fIsMouseSupportsRelative && !fIsMouseHostCursorNeeded);
     if (fIsMouseHostCursorNeeded)
-        pAction->setChecked(false);
+        pAction->setChecked(true);
 }
 
 void UIMachineLogic::sltHidLedsSyncStateChanged(bool fEnabled)
 {
-    m_isHidLedsSyncEnabled = fEnabled;
+    m_fIsHidLedsSyncEnabled = fEnabled;
 }
 
 void UIMachineLogic::sltKeyboardLedsChanged()
@@ -595,15 +671,20 @@ void UIMachineLogic::sltUSBDeviceStateChange(const CUSBDevice &device, bool fIsA
     if (!error.isNull())
     {
         if (fIsAttached)
-            msgCenter().cannotAttachUSBDevice(error, vboxGlobal().details(device), session().GetMachine().GetName());
+            msgCenter().cannotAttachUSBDevice(error, vboxGlobal().details(device), machineName());
         else
-            msgCenter().cannotDetachUSBDevice(error, vboxGlobal().details(device), session().GetMachine().GetName());
+            msgCenter().cannotDetachUSBDevice(error, vboxGlobal().details(device), machineName());
     }
 }
 
 void UIMachineLogic::sltRuntimeError(bool fIsFatal, const QString &strErrorId, const QString &strMessage)
 {
-    msgCenter().showRuntimeError(session().GetConsole(), fIsFatal, strErrorId, strMessage);
+    /* Preprocess known runtime error types: */
+    if (strErrorId == "DrvVD_DEKMISSING")
+        return askUserForTheDiskEncryptionPasswords();
+
+    /* Show runtime error: */
+    msgCenter().showRuntimeError(console(), fIsFatal, strErrorId, strMessage);
 }
 
 #ifdef Q_WS_MAC
@@ -679,35 +760,14 @@ UIMachineLogic::UIMachineLogic(QObject *pParent, UISession *pSession, UIVisualSt
     , m_pDbgGuiVT(0)
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 #ifdef Q_WS_MAC
-    , m_pMenuBar(0)
     , m_fIsDockIconEnabled(true)
     , m_pDockIconPreview(0)
     , m_pDockPreviewSelectMonitorGroup(0)
     , m_DockIconPreviewMonitor(0)
 #endif /* Q_WS_MAC */
     , m_pHostLedsState(NULL)
-    , m_isHidLedsSyncEnabled(false)
+    , m_fIsHidLedsSyncEnabled(false)
 {
-    /* Setup HID LEDs synchronization. */
-#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
-    /* Read initial extradata value. */
-    QString strHidLedsSyncSettings = session().GetMachine().GetExtraData(GUI_HidLedsSync);
-
-    /* If extra data GUI/HidLedsSync is not present in VM config or set
-     * to 1 then sync is enabled. Otherwise, it is disabled. */
-
-    /* (temporary disabled by default) */
-    if (strHidLedsSyncSettings == "1")
-        m_isHidLedsSyncEnabled = true;
-    else
-        m_isHidLedsSyncEnabled = false;
-
-    /* Subscribe to GUI_HidLedsSync extradata changes in order to
-     * be able to enable or disable feature dynamically. */
-    connect(gEDataEvents, SIGNAL(sigHidLedsSyncStateChanged(bool)), this, SLOT(sltHidLedsSyncStateChanged(bool)));
-#else
-    m_isHidLedsSyncEnabled = false;
-#endif
 }
 
 void UIMachineLogic::setMachineWindowsCreated(bool fIsWindowsCreated)
@@ -746,12 +806,20 @@ void UIMachineLogic::addMachineWindow(UIMachineWindow *pMachineWindow)
 
 void UIMachineLogic::setKeyboardHandler(UIKeyboardHandler *pKeyboardHandler)
 {
+    /* Set new handler: */
     m_pKeyboardHandler = pKeyboardHandler;
+    /* Connect to session: */
+    connect(m_pKeyboardHandler, SIGNAL(sigStateChange(int)),
+            uisession(), SLOT(setKeyboardState(int)));
 }
 
 void UIMachineLogic::setMouseHandler(UIMouseHandler *pMouseHandler)
 {
+    /* Set new handler: */
     m_pMouseHandler = pMouseHandler;
+    /* Connect to session: */
+    connect(m_pMouseHandler, SIGNAL(sigStateChange(int)),
+            uisession(), SLOT(setMouseState(int)));
 }
 
 void UIMachineLogic::retranslateUi()
@@ -776,7 +844,7 @@ void UIMachineLogic::retranslateUi()
     if (m_pDragAndDropActions)
     {
         foreach (QAction *pAction, m_pDragAndDropActions->actions())
-            pAction->setText(gpConverter->toString(pAction->data().value<KDragAndDropMode>()));
+            pAction->setText(gpConverter->toString(pAction->data().value<KDnDMode>()));
     }
 }
 
@@ -816,8 +884,12 @@ void UIMachineLogic::prepareRequiredFeatures()
 
 void UIMachineLogic::prepareSessionConnections()
 {
+    /* We should watch for the VBoxSVC availability changes: */
+    connect(&vboxGlobal(), SIGNAL(sigVBoxSVCAvailabilityChange()),
+            this, SLOT(sltHandleVBoxSVCAvailabilityChange()));
+
     /* We should check for entering/exiting requested modes: */
-    connect(uisession(), SIGNAL(sigStarted()), this, SLOT(sltCheckForRequestedVisualStateType()));
+    connect(uisession(), SIGNAL(sigInitialized()), this, SLOT(sltCheckForRequestedVisualStateType()));
     connect(uisession(), SIGNAL(sigAdditionsStateChange()), this, SLOT(sltCheckForRequestedVisualStateType()));
 
     /* Machine state-change updater: */
@@ -853,17 +925,13 @@ void UIMachineLogic::prepareSessionConnections()
     connect(uisession(), SIGNAL(sigHostScreenCountChange()), this, SLOT(sltHostScreenCountChange()));
     connect(uisession(), SIGNAL(sigHostScreenGeometryChange()), this, SLOT(sltHostScreenGeometryChange()));
     connect(uisession(), SIGNAL(sigHostScreenAvailableAreaChange()), this, SLOT(sltHostScreenAvailableAreaChange()));
+
+    /* Frame-buffer connections: */
+    connect(this, SIGNAL(sigFrameBufferResize()), uisession(), SIGNAL(sigFrameBufferResize()));
 }
 
 void UIMachineLogic::prepareActionGroups()
 {
-#ifdef Q_WS_MAC
-    /* On Mac OS X, all QMenu's are consumed by Qt after they are added to
-     * another QMenu or a QMenuBar. This means we have to recreate all QMenus
-     * when creating a new QMenuBar. */
-    gActionPool->recreateMenus();
-#endif /* Q_WS_MAC */
-
     /* Create group for all actions that are enabled only when the VM is running.
      * Note that only actions whose enabled state depends exclusively on the
      * execution state of the VM are added to this group. */
@@ -883,180 +951,224 @@ void UIMachineLogic::prepareActionGroups()
     m_pRunningOrPausedOrStackedActions->setExclusive(false);
 
     /* Move actions into running actions group: */
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_Reset));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_Shutdown));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_Seamless));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_Scale));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCAD));
 #ifdef Q_WS_X11
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS));
-#endif
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Reset));
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Shutdown));
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen));
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless));
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Scale));
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize));
-    m_pRunningActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCABS));
+#endif /* Q_WS_X11 */
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak));
+    m_pRunningActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert));
 
     /* Move actions into running-n-paused actions group: */
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SaveState));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_MouseIntegration));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Pause));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_USBDevices));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_WebCams));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_Network));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_SharedFolders));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureSettings));
-    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_SaveState));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_Settings));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_TakeSnapshot));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_ShowInformation));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_T_Pause));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_S_Settings));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings));
+#ifndef Q_WS_MAC
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility));
+#endif /* !Q_WS_MAC */
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_View_M_ScaleFactor));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_Settings));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Mouse));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives_S_Settings));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_Network));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_Network_S_Settings));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices_S_Settings));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_WebCams));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedClipboard));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_DragAndDrop));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools));
+#ifdef Q_WS_MAC
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndex_M_Window));
+    m_pRunningOrPausedActions->addAction(actionPool()->action(UIActionIndex_M_Window_S_Minimize));
+#endif /* Q_WS_MAC */
 
     /* Move actions into running-n-paused-n-stucked actions group: */
-    m_pRunningOrPausedOrStackedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_PowerOff));
+    m_pRunningOrPausedOrStackedActions->addAction(actionPool()->action(UIActionIndexRT_M_Machine_S_PowerOff));
 }
 
 void UIMachineLogic::prepareActionConnections()
 {
-    /* "Machine" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog), SIGNAL(triggered()),
+    /* 'Application' actions connection: */
+    connect(actionPool()->action(UIActionIndex_M_Application_S_Preferences), SIGNAL(triggered()),
+            this, SLOT(sltShowGlobalPreferences()), Qt::UniqueConnection);
+    connect(actionPool()->action(UIActionIndex_M_Application_S_Close), SIGNAL(triggered()),
+            this, SLOT(sltClose()), Qt::QueuedConnection);
+
+    /* 'Machine' actions connections: */
+    connect(actionPool()->action(UIActionIndexRT_M_Machine_S_Settings), SIGNAL(triggered()),
             this, SLOT(sltOpenVMSettingsDialog()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_Machine_S_TakeSnapshot), SIGNAL(triggered()),
             this, SLOT(sltTakeSnapshot()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot), SIGNAL(triggered()),
-            this, SLOT(sltTakeScreenshot()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_Machine_S_ShowInformation), SIGNAL(triggered()),
             this, SLOT(sltShowInformationDialog()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration), SIGNAL(toggled(bool)),
-            this, SLOT(sltToggleMouseIntegration(bool)));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD), SIGNAL(triggered()),
-            this, SLOT(sltTypeCAD()));
-#ifdef Q_WS_X11
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS), SIGNAL(triggered()),
-            this, SLOT(sltTypeCABS()));
-#endif
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Pause), SIGNAL(toggled(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_Machine_T_Pause), SIGNAL(toggled(bool)),
             this, SLOT(sltPause(bool)));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_Reset), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_Machine_S_Reset), SIGNAL(triggered()),
             this, SLOT(sltReset()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_SaveState), SIGNAL(triggered()),
-            this, SLOT(sltSaveState()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_Shutdown), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_Machine_S_SaveState), SIGNAL(triggered()),
+            this, SLOT(sltSaveState()), Qt::QueuedConnection);
+    connect(actionPool()->action(UIActionIndexRT_M_Machine_S_Shutdown), SIGNAL(triggered()),
             this, SLOT(sltShutdown()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_PowerOff), SIGNAL(triggered()),
-            this, SLOT(sltPowerOff()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_Close), SIGNAL(triggered()),
-            this, SLOT(sltClose()));
+    connect(actionPool()->action(UIActionIndexRT_M_Machine_S_PowerOff), SIGNAL(triggered()),
+            this, SLOT(sltPowerOff()), Qt::QueuedConnection);
 
-    /* "View" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize), SIGNAL(toggled(bool)),
+    /* 'View' actions connections: */
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize), SIGNAL(toggled(bool)),
             this, SLOT(sltToggleGuestAutoresize(bool)));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow), SIGNAL(triggered()),
             this, SLOT(sltAdjustWindow()));
-
-    /* "Devices" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareStorageMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareStorageMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareUSBMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareWebCamMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareSharedClipboardMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareDragAndDropMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareNetworkMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings), SIGNAL(triggered()),
-            this, SLOT(sltOpenNetworkAdaptersDialog()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings), SIGNAL(triggered()),
-            this, SLOT(sltOpenSharedFoldersDialog()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer), SIGNAL(toggled(bool)),
-            this, SLOT(sltToggleVRDE(bool)));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture), SIGNAL(toggled(bool)),
-            this, SLOT(sltToggleVideoCapture(bool)));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureSettings), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot), SIGNAL(triggered()),
+            this, SLOT(sltTakeScreenshot()));
+    connect(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_S_Settings), SIGNAL(triggered()),
             this, SLOT(sltOpenVideoCaptureOptions()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start), SIGNAL(toggled(bool)),
+            this, SLOT(sltToggleVideoCapture(bool)));
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer), SIGNAL(toggled(bool)),
+            this, SLOT(sltToggleVRDE(bool)));
+
+    /* 'Input' actions connections: */
+    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_Settings), SIGNAL(triggered()),
+            this, SLOT(sltShowKeyboardSettings()));
+    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCAD), SIGNAL(triggered()),
+            this, SLOT(sltTypeCAD()));
+#ifdef Q_WS_X11
+    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCABS), SIGNAL(triggered()),
+            this, SLOT(sltTypeCABS()));
+#endif /* Q_WS_X11 */
+    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeCtrlBreak), SIGNAL(triggered()),
+            this, SLOT(sltTypeCtrlBreak()));
+    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard_S_TypeInsert), SIGNAL(triggered()),
+            this, SLOT(sltTypeInsert()));
+    connect(actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration), SIGNAL(toggled(bool)),
+            this, SLOT(sltToggleMouseIntegration(bool)));
+
+    /* 'Devices' actions connections: */
+    connect(actionPool(), SIGNAL(sigNotifyAboutMenuPrepare(int, QMenu*)), this, SLOT(sltHandleMenuPrepare(int, QMenu*)));
+    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives_S_Settings), SIGNAL(triggered()),
+            this, SLOT(sltOpenStorageSettingsDialog()));
+    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_Network_S_Settings), SIGNAL(triggered()),
+            this, SLOT(sltOpenNetworkSettingsDialog()));
+    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices_S_Settings), SIGNAL(triggered()),
+            this, SLOT(sltOpenUSBDevicesSettingsDialog()));
+    connect(actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders_S_Settings), SIGNAL(triggered()),
+            this, SLOT(sltOpenSharedFoldersSettingsDialog()));
+    connect(actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools), SIGNAL(triggered()),
             this, SLOT(sltInstallGuestAdditions()));
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
-    /* "Debug" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_Debug)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareDebugMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_Statistics), SIGNAL(triggered()),
+    /* 'Debug' actions connections: */
+    connect(actionPool()->action(UIActionIndexRT_M_Debug_S_ShowStatistics), SIGNAL(triggered()),
             this, SLOT(sltShowDebugStatistics()));
-    connect(gActionPool->action(UIActionIndexRuntime_Simple_CommandLine), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_Debug_S_ShowCommandLine), SIGNAL(triggered()),
             this, SLOT(sltShowDebugCommandLine()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Logging), SIGNAL(toggled(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_Debug_T_Logging), SIGNAL(toggled(bool)),
             this, SLOT(sltLoggingToggled(bool)));
-    connect(gActionPool->action(UIActionIndex_Simple_LogDialog), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexRT_M_Debug_S_ShowLogDialog), SIGNAL(triggered()),
             this, SLOT(sltShowLogDialog()));
-#endif
-}
-
-void UIMachineLogic::prepareHandlers()
-{
-    /* Create keyboard-handler: */
-    setKeyboardHandler(UIKeyboardHandler::create(this, visualStateType()));
+#endif /* VBOX_WITH_DEBUGGER_GUI */
 
-    /* Create mouse-handler: */
-    setMouseHandler(UIMouseHandler::create(this, visualStateType()));
+#ifdef Q_WS_MAC
+    /* 'Window' action connections: */
+    connect(actionPool()->action(UIActionIndex_M_Window_S_Minimize), SIGNAL(triggered()),
+            this, SLOT(sltMinimizeActiveMachineWindow()));
+#endif /* Q_WS_MAC */
 }
 
-void UIMachineLogic::prepareMenu()
+void UIMachineLogic::prepareHandlers()
 {
+    /* Prepare menu update-handlers: */
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_OpticalDevices] =  &UIMachineLogic::updateMenuDevicesStorage;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_FloppyDevices] =   &UIMachineLogic::updateMenuDevicesStorage;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_Network] =         &UIMachineLogic::updateMenuDevicesNetwork;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_USBDevices] =      &UIMachineLogic::updateMenuDevicesUSB;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_WebCams] =         &UIMachineLogic::updateMenuDevicesWebCams;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_SharedClipboard] = &UIMachineLogic::updateMenuDevicesSharedClipboard;
+    m_menuUpdateHandlers[UIActionIndexRT_M_Devices_M_DragAndDrop] =     &UIMachineLogic::updateMenuDevicesDragAndDrop;
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    m_menuUpdateHandlers[UIActionIndexRT_M_Debug] =                     &UIMachineLogic::updateMenuDebug;
+#endif /* VBOX_WITH_DEBUGGER_GUI */
 #ifdef Q_WS_MAC
-    /* Prepare native menu-bar: */
-    CMachine machine = session().GetMachine();
-    RuntimeMenuType restrictedMenus = VBoxGlobal::restrictedRuntimeMenuTypes(machine);
-    RuntimeMenuType allowedMenus = static_cast<RuntimeMenuType>(RuntimeMenuType_All ^ restrictedMenus);
-    m_pMenuBar = uisession()->newMenuBar(allowedMenus);
+    m_menuUpdateHandlers[UIActionIndex_M_Window] =                      &UIMachineLogic::updateMenuWindow;
 #endif /* Q_WS_MAC */
+
+    /* Create keyboard/mouse handlers: */
+    setKeyboardHandler(UIKeyboardHandler::create(this, visualStateType()));
+    setMouseHandler(UIMouseHandler::create(this, visualStateType()));
+    /* Update UI session values with current: */
+    uisession()->setKeyboardState(keyboardHandler()->state());
+    uisession()->setMouseState(mouseHandler()->state());
 }
 
 #ifdef Q_WS_MAC
 void UIMachineLogic::prepareDock()
 {
-    QMenu *pDockMenu = gActionPool->action(UIActionIndexRuntime_Menu_Dock)->menu();
+    QMenu *pDockMenu = actionPool()->action(UIActionIndexRT_M_Dock)->menu();
 
-    /* Add all VM menu entries to the dock menu. Leave out close and stuff like
-     * this. */
-    QList<QAction*> actions = gActionPool->action(UIActionIndexRuntime_Menu_Machine)->menu()->actions();
+    /* Add all the 'Machine' menu entries to the 'Dock' menu: */
+    QList<QAction*> actions = actionPool()->action(UIActionIndexRT_M_Machine)->menu()->actions();
     for (int i=0; i < actions.size(); ++i)
-        if (actions.at(i)->menuRole() == QAction::NoRole)
-            pDockMenu->addAction(actions.at(i));
+    {
+        /* Check if we really have correct action: */
+        UIAction *pAction = qobject_cast<UIAction*>(actions.at(i));
+        /* Skip incorrect actions: */
+        if (!pAction)
+            continue;
+        /* Skip actions which have 'role' (to prevent consuming): */
+        if (pAction->menuRole() != QAction::NoRole)
+            continue;
+        /* Skip actions which have menu (to prevent consuming): */
+        if (qobject_cast<UIActionMenu*>(pAction))
+            continue;
+        pDockMenu->addAction(actions.at(i));
+    }
     pDockMenu->addSeparator();
 
-    QMenu *pDockSettingsMenu = gActionPool->action(UIActionIndexRuntime_Menu_DockSettings)->menu();
+    QMenu *pDockSettingsMenu = actionPool()->action(UIActionIndexRT_M_Dock_M_DockSettings)->menu();
     QActionGroup *pDockPreviewModeGroup = new QActionGroup(this);
-    QAction *pDockDisablePreview = gActionPool->action(UIActionIndexRuntime_Toggle_DockDisableMonitor);
+    QAction *pDockDisablePreview = actionPool()->action(UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor);
     pDockPreviewModeGroup->addAction(pDockDisablePreview);
-    QAction *pDockEnablePreviewMonitor = gActionPool->action(UIActionIndexRuntime_Toggle_DockPreviewMonitor);
+    QAction *pDockEnablePreviewMonitor = actionPool()->action(UIActionIndexRT_M_Dock_M_DockSettings_T_PreviewMonitor);
     pDockPreviewModeGroup->addAction(pDockEnablePreviewMonitor);
     pDockSettingsMenu->addActions(pDockPreviewModeGroup->actions());
 
     connect(pDockPreviewModeGroup, SIGNAL(triggered(QAction*)),
             this, SLOT(sltDockPreviewModeChanged(QAction*)));
-    connect(gEDataEvents, SIGNAL(sigDockIconAppearanceChange(bool)),
+    connect(gEDataManager, SIGNAL(sigDockIconAppearanceChange(bool)),
             this, SLOT(sltChangeDockIconUpdate(bool)));
 
     /* Monitor selection if there are more than one monitor */
-    int cGuestScreens = uisession()->session().GetMachine().GetMonitorCount();
+    int cGuestScreens = machine().GetMonitorCount();
     if (cGuestScreens > 1)
     {
         pDockSettingsMenu->addSeparator();
-        m_DockIconPreviewMonitor = qMin(session().GetMachine().GetExtraData(GUI_RealtimeDockIconUpdateMonitor).toInt(), cGuestScreens - 1);
+        m_DockIconPreviewMonitor = qMin(gEDataManager->realtimeDockIconUpdateMonitor(vboxGlobal().managedVMUuid()),
+                                        cGuestScreens - 1);
         m_pDockPreviewSelectMonitorGroup = new QActionGroup(this);
         for (int i = 0; i < cGuestScreens; ++i)
         {
@@ -1077,13 +1189,12 @@ void UIMachineLogic::prepareDock()
     ::darwinSetDockIconMenu(pDockMenu);
 
     /* Now the dock icon preview */
-    QString osTypeId = session().GetConsole().GetGuest().GetOSTypeId();
+    QString osTypeId = guest().GetOSTypeId();
     m_pDockIconPreview = new UIDockIconPreview(uisession(), vboxGlobal().vmGuestOSTypeIcon(osTypeId));
 
-    QString strTest = session().GetMachine().GetExtraData(GUI_RealtimeDockIconUpdateEnabled).toLower();
-    /* Default to true if it is an empty value */
-    bool f = (strTest.isEmpty() || strTest == "true");
-    if (f)
+    /* Should the dock-icon be updated at runtime? */
+    bool fEnabled = gEDataManager->realtimeDockIconUpdateEnabled(vboxGlobal().managedVMUuid());
+    if (fEnabled)
         pDockEnablePreviewMonitor->setChecked(true);
     else
     {
@@ -1091,9 +1202,7 @@ void UIMachineLogic::prepareDock()
         if(m_pDockPreviewSelectMonitorGroup)
             m_pDockPreviewSelectMonitorGroup->setEnabled(false);
     }
-
-    /* Default to true if it is an empty value */
-    setDockIconPreviewEnabled(f);
+    setDockIconPreviewEnabled(fEnabled);
     updateDockOverlay();
 }
 #endif /* Q_WS_MAC */
@@ -1101,27 +1210,34 @@ void UIMachineLogic::prepareDock()
 #ifdef VBOX_WITH_DEBUGGER_GUI
 void UIMachineLogic::prepareDebugger()
 {
-    CMachine machine = uisession()->session().GetMachine();
-    if (!machine.isNull() && vboxGlobal().isDebuggerAutoShowEnabled(machine))
+    if (vboxGlobal().isDebuggerAutoShowEnabled())
     {
-        /* console in upper left corner of the desktop. */
-//        QRect rct (0, 0, 0, 0);
-//        QDesktopWidget *desktop = QApplication::desktop();
-//        if (desktop)
-//            rct = desktop->availableGeometry(pos());
-//        move (QPoint (rct.x(), rct.y()));
-
-        if (vboxGlobal().isDebuggerAutoShowStatisticsEnabled(machine))
+        if (vboxGlobal().isDebuggerAutoShowStatisticsEnabled())
             sltShowDebugStatistics();
-        if (vboxGlobal().isDebuggerAutoShowCommandLineEnabled(machine))
+        if (vboxGlobal().isDebuggerAutoShowCommandLineEnabled())
             sltShowDebugCommandLine();
-
-        if (!vboxGlobal().isStartPausedEnabled())
-            sltPause(false);
     }
 }
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
+void UIMachineLogic::loadSettings()
+{
+#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
+    /* Read cached extra-data value: */
+    m_fIsHidLedsSyncEnabled = gEDataManager->hidLedsSyncState(vboxGlobal().managedVMUuid());
+    /* Subscribe to extra-data changes to be able to enable/disable feature dynamically: */
+    connect(gEDataManager, SIGNAL(sigHidLedsSyncStateChange(bool)), this, SLOT(sltHidLedsSyncStateChanged(bool)));
+#endif /* Q_WS_MAC || Q_WS_WIN */
+    /* HID LEDs sync initialization: */
+    sltSwitchKeyboardLedsToGuestLeds();
+}
+
+void UIMachineLogic::saveSettings()
+{
+    /* HID LEDs sync deinitialization: */
+    sltSwitchKeyboardLedsToPreviousLeds();
+}
+
 #ifdef VBOX_WITH_DEBUGGER_GUI
 void UIMachineLogic::cleanupDebugger()
 {
@@ -1141,14 +1257,6 @@ void UIMachineLogic::cleanupDock()
 }
 #endif /* Q_WS_MAC */
 
-void UIMachineLogic::cleanupMenu()
-{
-#ifdef Q_WS_MAC
-    delete m_pMenuBar;
-    m_pMenuBar = 0;
-#endif /* Q_WS_MAC */
-}
-
 void UIMachineLogic::cleanupHandlers()
 {
     /* Cleanup mouse-handler: */
@@ -1158,10 +1266,6 @@ void UIMachineLogic::cleanupHandlers()
     UIKeyboardHandler::destroy(keyboardHandler());
 }
 
-void UIMachineLogic::cleanupActionGroups()
-{
-}
-
 bool UIMachineLogic::eventFilter(QObject *pWatched, QEvent *pEvent)
 {
     /* Handle machine-window events: */
@@ -1212,249 +1316,164 @@ bool UIMachineLogic::eventFilter(QObject *pWatched, QEvent *pEvent)
     return QIWithRetranslateUI3<QObject>::eventFilter(pWatched, pEvent);
 }
 
-void UIMachineLogic::sltToggleGuestAutoresize(bool fEnabled)
+void UIMachineLogic::sltHandleMenuPrepare(int iIndex, QMenu *pMenu)
 {
-    /* Do not process if window(s) missed! */
-    if (!isMachineWindowsCreated())
-        return;
-
-    /* Toggle guest-autoresize feature for all view(s)! */
-    foreach(UIMachineWindow *pMachineWindow, machineWindows())
-        pMachineWindow->machineView()->setGuestAutoresizeEnabled(fEnabled);
+    /* Update if there is update-handler: */
+    if (m_menuUpdateHandlers.contains(iIndex))
+        (this->*(m_menuUpdateHandlers.value(iIndex)))(pMenu);
 }
 
-void UIMachineLogic::sltAdjustWindow()
+void UIMachineLogic::sltShowKeyboardSettings()
 {
     /* Do not process if window(s) missed! */
     if (!isMachineWindowsCreated())
         return;
 
-    /* Adjust all window(s)! */
-    foreach(UIMachineWindow *pMachineWindow, machineWindows())
-    {
-        /* Exit maximized window state if actual: */
-        if (pMachineWindow->isMaximized())
-            pMachineWindow->showNormal();
-
-        /* Normalize window geometry: */
-        pMachineWindow->normalizeGeometry(true /* adjust position */);
-    }
+    /* Open Global Preferences: Input page: */
+    showGlobalPreferences("#input", "m_pMachineTable");
 }
 
-void UIMachineLogic::sltToggleMouseIntegration(bool fOff)
+void UIMachineLogic::sltToggleMouseIntegration(bool fEnabled)
 {
     /* Do not process if window(s) missed! */
     if (!isMachineWindowsCreated())
         return;
 
     /* Disable/Enable mouse-integration for all view(s): */
-    mouseHandler()->setMouseIntegrationEnabled(!fOff);
+    mouseHandler()->setMouseIntegrationEnabled(fEnabled);
 }
 
 void UIMachineLogic::sltTypeCAD()
 {
-    CKeyboard keyboard = session().GetConsole().GetKeyboard();
-    Assert(!keyboard.isNull());
-    keyboard.PutCAD();
-    AssertWrapperOk(keyboard);
+    keyboard().PutCAD();
+    AssertWrapperOk(keyboard());
 }
 
 #ifdef Q_WS_X11
 void UIMachineLogic::sltTypeCABS()
 {
-    CKeyboard keyboard = session().GetConsole().GetKeyboard();
-    Assert(!keyboard.isNull());
-    static QVector<LONG> aSequence(6);
-    aSequence[0] = 0x1d; /* Ctrl down */
-    aSequence[1] = 0x38; /* Alt down */
-    aSequence[2] = 0x0E; /* Backspace down */
-    aSequence[3] = 0x8E; /* Backspace up */
-    aSequence[4] = 0xb8; /* Alt up */
-    aSequence[5] = 0x9d; /* Ctrl up */
-    keyboard.PutScancodes(aSequence);
-    AssertWrapperOk(keyboard);
+    static QVector<LONG> sequence(6);
+    sequence[0] = 0x1d;        /* Ctrl down */
+    sequence[1] = 0x38;        /* Alt down */
+    sequence[2] = 0x0E;        /* Backspace down */
+    sequence[3] = 0x0E | 0x80; /* Backspace up */
+    sequence[4] = 0x38 | 0x80; /* Alt up */
+    sequence[5] = 0x1d | 0x80; /* Ctrl up */
+    keyboard().PutScancodes(sequence);
+    AssertWrapperOk(keyboard());
 }
 #endif /* Q_WS_X11 */
 
+void UIMachineLogic::sltTypeCtrlBreak()
+{
+    static QVector<LONG> sequence(4);
+    sequence[0] = 0x1d;        /* Ctrl down */
+    sequence[1] = 0x46;        /* Break down */
+    sequence[2] = 0x46 | 0x80; /* Break up */
+    sequence[3] = 0x1d | 0x80; /* Ctrl up */
+    keyboard().PutScancodes(sequence);
+    AssertWrapperOk(keyboard());
+}
+
+void UIMachineLogic::sltTypeInsert()
+{
+    static QVector<LONG> sequence(4);
+    sequence[0] = 0xE0;        /* Extended flag */
+    sequence[1] = 0x52;        /* Insert down */
+    sequence[2] = 0xE0;        /* Extended flag */
+    sequence[3] = 0x52 | 0x80; /* Insert up */
+    keyboard().PutScancodes(sequence);
+    AssertWrapperOk(keyboard());
+}
+
 void UIMachineLogic::sltTakeSnapshot()
 {
     /* Do not process if window(s) missed! */
     if (!isMachineWindowsCreated())
         return;
 
-    /* Remember the paused state: */
-    bool fWasPaused = uisession()->isPaused();
-    if (!fWasPaused)
-    {
-        /* Suspend the VM and ignore the close event if failed to do so.
-         * pause() will show the error message to the user. */
-        if (!uisession()->pause())
-            return;
-    }
-
-    /* Get current machine: */
-    CMachine machine = session().GetMachine();
-
     /* Create take-snapshot dialog: */
     QWidget *pDlgParent = windowManager().realParentWindow(activeMachineWindow());
-    QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, machine);
+    QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, machine());
     windowManager().registerNewParent(pDlg, pDlgParent);
 
     /* Assign corresponding icon: */
-    QString strTypeId = machine.GetOSTypeId();
+    QString strTypeId = machine().GetOSTypeId();
     pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(strTypeId));
 
     /* Search for the max available filter index: */
     QString strNameTemplate = QApplication::translate("UIMachineLogic", "Snapshot %1");
-    int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine, machine.FindSnapshot(QString()), strNameTemplate);
+    int iMaxSnapshotIndex = searchMaxSnapshotIndex(machine(), machine().FindSnapshot(QString()), strNameTemplate);
     pDlg->mLeName->setText(strNameTemplate.arg(++ iMaxSnapshotIndex));
 
     /* Exec the dialog: */
     bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;
 
-    /* Is the dialog still valid? */
-    if (pDlg)
-    {
-        /* Acquire variables: */
-        QString strSnapshotName = pDlg->mLeName->text().trimmed();
-        QString strSnapshotDescription = pDlg->mTeDescription->toPlainText();
+    /* Make sure dialog still valid: */
+    if (!pDlg)
+        return;
 
-        /* Destroy dialog early: */
-        delete pDlg;
+    /* Acquire variables: */
+    QString strSnapshotName = pDlg->mLeName->text().trimmed();
+    QString strSnapshotDescription = pDlg->mTeDescription->toPlainText();
 
-        /* Was the dialog accepted? */
-        if (fDialogAccepted)
-        {
-            /* Prepare the take-snapshot progress: */
-            CConsole console = session().GetConsole();
-            CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription);
-            if (console.isOk())
-            {
-                /* Show the take-snapshot progress: */
-                msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_create_90px.png");
-                if (!progress.isOk() || progress.GetResultCode() != 0)
-                    msgCenter().cannotTakeSnapshot(progress, machine.GetName());
-            }
-            else
-                msgCenter().cannotTakeSnapshot(console, machine.GetName());
-        }
-    }
+    /* Destroy dialog early: */
+    delete pDlg;
 
-    /* Restore the running state if needed: */
-    if (!fWasPaused)
+    /* Was the dialog accepted? */
+    if (fDialogAccepted)
     {
-        /* Make sure machine-state-change callback is processed: */
-        QApplication::sendPostedEvents(uisession(), UIConsoleEventType_StateChange);
-        /* Unpause VM: */
-        uisession()->unpause();
+        /* Prepare the take-snapshot progress: */
+        CProgress progress = machine().TakeSnapshot(strSnapshotName, strSnapshotDescription, true);
+        if (machine().isOk())
+        {
+            /* Show the take-snapshot progress: */
+            const bool fStillValid = msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_snapshot_create_90px.png");
+            if (!fStillValid)
+                return;
+            if (!progress.isOk() || progress.GetResultCode() != 0)
+                msgCenter().cannotTakeSnapshot(progress, machineName());
+        }
+        else
+            msgCenter().cannotTakeSnapshot(machine(), machineName());
     }
 }
 
-void UIMachineLogic::sltTakeScreenshot()
+void UIMachineLogic::sltShowInformationDialog()
 {
     /* Do not process if window(s) missed! */
     if (!isMachineWindowsCreated())
         return;
 
-    /* Which image formats for writing does this Qt version know of? */
-    QList<QByteArray> formats = QImageWriter::supportedImageFormats();
-    QStringList filters;
-    /* Build a filters list out of it. */
-    for (int i = 0; i < formats.size(); ++i)
-    {
-        const QString &s = formats.at(i) + " (*." + formats.at(i).toLower() + ")";
-        /* Check there isn't an entry already (even if it just uses another capitalization) */
-        if (filters.indexOf(QRegExp(QRegExp::escape(s), Qt::CaseInsensitive)) == -1)
-            filters << s;
-    }
-    /* Try to select some common defaults. */
-    QString strFilter;
-    int i = filters.indexOf(QRegExp(".*png.*", Qt::CaseInsensitive));
-    if (i == -1)
-    {
-        i = filters.indexOf(QRegExp(".*jpe+g.*", Qt::CaseInsensitive));
-        if (i == -1)
-            i = filters.indexOf(QRegExp(".*bmp.*", Qt::CaseInsensitive));
-    }
-    if (i != -1)
+    /* Invoke VM information dialog: */
+    UIVMInfoDialog::invoke(mainMachineWindow());
+}
+
+void UIMachineLogic::sltReset()
+{
+    /* Confirm/Reset current console: */
+    if (msgCenter().confirmResetMachine(machineName()))
+        console().Reset();
+
+    /* TODO_NEW_CORE: On reset the additional screens didn't get a display
+       update. Emulate this for now until it get fixed. */
+    ulong uMonitorCount = machine().GetMonitorCount();
+    for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId)
+        machineWindows().at(uScreenId)->update();
+}
+
+void UIMachineLogic::sltPause(bool fOn)
+{
+    uisession()->setPause(fOn);
+}
+
+void UIMachineLogic::sltSaveState()
+{
+    /* Make sure machine is in one of the allowed states: */
+    if (!uisession()->isRunning() && !uisession()->isPaused())
     {
-        filters.prepend(filters.takeAt(i));
-        strFilter = filters.first();
-    }
-
-#ifdef Q_WS_WIN
-    /* Due to Qt bug, modal QFileDialog appeared above the active machine-window
-     * does not retreive the focus from the currently focused machine-view,
-     * as the result guest keyboard remains captured, so we should
-     * clear the focus from this machine-view initially: */
-    if (activeMachineWindow())
-        activeMachineWindow()->machineView()->clearFocus();
-#endif /* Q_WS_WIN */
-
-    /* Request the filename from the user. */
-    const CMachine &machine = session().GetMachine();
-    QFileInfo fi(machine.GetSettingsFilePath());
-    QString strAbsolutePath(fi.absolutePath());
-    QString strCompleteBaseName(fi.completeBaseName());
-    QString strStart = QDir(strAbsolutePath).absoluteFilePath(strCompleteBaseName);
-    QString strFilename = QIFileDialog::getSaveFileName(strStart,
-                                                        filters.join(";;"),
-                                                        activeMachineWindow(),
-                                                        tr("Select a filename for the screenshot ..."),
-                                                        &strFilter,
-                                                        true /* resolve symlinks */,
-                                                        true /* confirm overwrite */);
-
-#ifdef Q_WS_WIN
-    /* Due to Qt bug, modal QFileDialog appeared above the active machine-window
-     * does not retreive the focus from the currently focused machine-view,
-     * as the result guest keyboard remains captured, so we already
-     * cleared the focus from this machine-view and should return
-     * that focus finally: */
-    if (activeMachineWindow())
-        activeMachineWindow()->machineView()->setFocus();
-#endif /* Q_WS_WIN */
-
-    /* Do the screenshot. */
-    if (!strFilename.isEmpty())
-        takeScreenshot(strFilename, strFilter.split(" ").value(0, "png"));
-}
-
-void UIMachineLogic::sltShowInformationDialog()
-{
-    /* Do not process if window(s) missed! */
-    if (!isMachineWindowsCreated())
-        return;
-
-    VBoxVMInformationDlg::createInformationDlg(mainMachineWindow());
-}
-
-void UIMachineLogic::sltReset()
-{
-    /* Confirm/Reset current console: */
-    CMachine machine = session().GetMachine();
-    if (msgCenter().confirmResetMachine(machine.GetName()))
-        session().GetConsole().Reset();
-
-    /* TODO_NEW_CORE: On reset the additional screens didn't get a display
-       update. Emulate this for now until it get fixed. */
-    ulong uMonitorCount = machine.GetMonitorCount();
-    for (ulong uScreenId = 1; uScreenId < uMonitorCount; ++uScreenId)
-        machineWindows().at(uScreenId)->update();
-}
-
-void UIMachineLogic::sltPause(bool fOn)
-{
-    uisession()->setPause(fOn);
-}
-
-void UIMachineLogic::sltSaveState()
-{
-    /* Make sure machine is in one of the allowed states: */
-    if (!uisession()->isRunning() && !uisession()->isPaused())
-    {
-        AssertMsgFailed(("Invalid machine-state. Action should be prohibited!"));
-        return;
+        AssertMsgFailed(("Invalid machine-state. Action should be prohibited!"));
+        return;
     }
 
     saveState();
@@ -1481,7 +1500,7 @@ void UIMachineLogic::sltPowerOff()
         return;
     }
 
-    powerOff(session().GetMachine().GetSnapshotCount() > 0);
+    powerOff(machine().GetSnapshotCount() > 0);
 }
 
 void UIMachineLogic::sltClose()
@@ -1514,492 +1533,245 @@ void UIMachineLogic::sltClose()
     activeMachineWindow()->close();
 }
 
-void UIMachineLogic::sltOpenVMSettingsDialog(const QString &strCategory /* = QString() */,
-                                             const QString &strControl /* = QString()*/)
+void UIMachineLogic::sltToggleGuestAutoresize(bool fEnabled)
 {
     /* Do not process if window(s) missed! */
     if (!isMachineWindowsCreated())
         return;
 
-    /* Create VM settings window on the heap!
-     * Its necessary to allow QObject hierarchy cleanup to delete this dialog if necessary: */
-    QPointer<UISettingsDialogMachine> pDialog = new UISettingsDialogMachine(activeMachineWindow(),
-                                                                            session().GetMachine().GetId(),
-                                                                            strCategory, strControl);
-    /* Executing VM settings window.
-     * This blocking function calls for the internal event-loop to process all further events,
-     * including event which can delete the dialog itself. */
-    pDialog->execute();
-    /* Delete dialog if its still valid: */
-    if (pDialog)
-        delete pDialog;
+    /* Toggle guest-autoresize feature for all view(s)! */
+    foreach(UIMachineWindow *pMachineWindow, machineWindows())
+        pMachineWindow->machineView()->setGuestAutoresizeEnabled(fEnabled);
 }
 
-void UIMachineLogic::sltOpenNetworkAdaptersDialog()
+void UIMachineLogic::sltAdjustWindow()
 {
-    /* Open VM settings : Network page: */
-    sltOpenVMSettingsDialog("#network");
-}
+    /* Do not process if window(s) missed! */
+    if (!isMachineWindowsCreated())
+        return;
 
-void UIMachineLogic::sltOpenSharedFoldersDialog()
-{
-    /* Do not process if additions are not loaded! */
-    if (!uisession()->isGuestAdditionsActive())
-        msgCenter().remindAboutGuestAdditionsAreNotActive();
+    /* Adjust all window(s)! */
+    foreach(UIMachineWindow *pMachineWindow, machineWindows())
+    {
+        /* Exit maximized window state if actual: */
+        if (pMachineWindow->isMaximized())
+            pMachineWindow->showNormal();
 
-    /* Open VM settings : Shared folders page: */
-    sltOpenVMSettingsDialog("#sharedFolders");
+        /* Normalize window geometry: */
+        pMachineWindow->normalizeGeometry(true /* adjust position */);
+    }
 }
 
-void UIMachineLogic::sltPrepareStorageMenu()
+void UIMachineLogic::sltTakeScreenshot()
 {
-    /* Get the sender() menu: */
-    QMenu *pMenu = qobject_cast<QMenu*>(sender());
-    AssertMsg(pMenu, ("This slot should only be called on hovering storage menu!\n"));
-    pMenu->clear();
+    /* Do not process if window(s) missed! */
+    if (!isMachineWindowsCreated())
+        return;
 
-    /* Short way to common storage menus: */
-    QMenu *pOpticalDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->menu();
-    QMenu *pFloppyDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices)->menu();
-
-    /* Determine medium & device types: */
-    UIMediumType mediumType = pMenu == pOpticalDevicesMenu ? UIMediumType_DVD :
-                                      pMenu == pFloppyDevicesMenu  ? UIMediumType_Floppy :
-                                                                     UIMediumType_Invalid;
-    KDeviceType deviceType = mediumTypeToGlobal(mediumType);
-    AssertMsg(mediumType != UIMediumType_Invalid, ("Incorrect storage medium type!\n"));
-    AssertMsg(deviceType != KDeviceType_Null, ("Incorrect storage device type!\n"));
-
-    /* Fill attachments menu: */
-    const CMachine &machine = session().GetMachine();
-    const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
-    for (int iAttachmentIndex = 0; iAttachmentIndex < attachments.size(); ++iAttachmentIndex)
+    /* Which image formats for writing does this Qt version know of? */
+    QList<QByteArray> formats = QImageWriter::supportedImageFormats();
+    QStringList filters;
+    /* Build a filters list out of it. */
+    for (int i = 0; i < formats.size(); ++i)
     {
-        /* Current attachment: */
-        const CMediumAttachment &attachment = attachments[iAttachmentIndex];
-        /* Current controller: */
-        const CStorageController &controller = machine.GetStorageControllerByName(attachment.GetController());
-        /* If controller present and device type correct: */
-        if (!controller.isNull() && (attachment.GetType() == deviceType))
-        {
-            /* Current attachment attributes: */
-            const CMedium &currentMedium = attachment.GetMedium();
-            QString strCurrentId = currentMedium.isNull() ? QString::null : currentMedium.GetId();
-            QString strCurrentLocation = currentMedium.isNull() ? QString::null : currentMedium.GetLocation();
-
-            /* Attachment menu item: */
-            QMenu *pAttachmentMenu = 0;
-            if (pMenu->menuAction()->data().toInt() > 1)
-            {
-                pAttachmentMenu = new QMenu(pMenu);
-                pAttachmentMenu->setTitle(QString("%1 (%2)").arg(controller.GetName())
-                                          .arg(gpConverter->toString(StorageSlot(controller.GetBus(),
-                                                                                 attachment.GetPort(),
-                                                                                 attachment.GetDevice()))));
-                switch (controller.GetBus())
-                {
-                    case KStorageBus_IDE:
-                        pAttachmentMenu->setIcon(QIcon(":/ide_16px.png")); break;
-                    case KStorageBus_SATA:
-                        pAttachmentMenu->setIcon(QIcon(":/sata_16px.png")); break;
-                    case KStorageBus_SCSI:
-                        pAttachmentMenu->setIcon(QIcon(":/scsi_16px.png")); break;
-                    case KStorageBus_Floppy:
-                        pAttachmentMenu->setIcon(QIcon(":/floppy_16px.png")); break;
-                    default:
-                        break;
-                }
-                pMenu->addMenu(pAttachmentMenu);
-            }
-            else pAttachmentMenu = pMenu;
-
-            /* Prepare choose-existing-medium action: */
-            QAction *pChooseExistingMediumAction = pAttachmentMenu->addAction(QIcon(":/select_file_16px.png"), QString(),
-                                                                              this, SLOT(sltMountStorageMedium()));
-            pChooseExistingMediumAction->setData(QVariant::fromValue(MediumTarget(controller.GetName(), attachment.GetPort(),
-                                                                                  attachment.GetDevice(), mediumType)));
-
-            /* Prepare choose-particular-medium actions: */
-            CMediumVector mediums;
-            QString strRecentMediumAddress;
-            switch (mediumType)
-            {
-                case UIMediumType_DVD:
-                    mediums = vboxGlobal().host().GetDVDDrives();
-                    strRecentMediumAddress = GUI_RecentListCD;
-                    break;
-                case UIMediumType_Floppy:
-                    mediums = vboxGlobal().host().GetFloppyDrives();
-                    strRecentMediumAddress = GUI_RecentListFD;
-                    break;
-                default:
-                    break;
-            }
-
-            /* Prepare choose-host-drive actions: */
-            for (int iHostDriveIndex = 0; iHostDriveIndex < mediums.size(); ++iHostDriveIndex)
-            {
-                const CMedium &medium = mediums[iHostDriveIndex];
-                bool fIsHostDriveUsed = false;
-                for (int iOtherAttachmentIndex = 0; iOtherAttachmentIndex < attachments.size(); ++iOtherAttachmentIndex)
-                {
-                    const CMediumAttachment &otherAttachment = attachments[iOtherAttachmentIndex];
-                    if (otherAttachment != attachment)
-                    {
-                        const CMedium &otherMedium = otherAttachment.GetMedium();
-                        if (!otherMedium.isNull() && otherMedium.GetId() == medium.GetId())
-                        {
-                            fIsHostDriveUsed = true;
-                            break;
-                        }
-                    }
-                }
-                if (!fIsHostDriveUsed)
-                {
-                    QAction *pChooseHostDriveAction = pAttachmentMenu->addAction(UIMedium(medium, mediumType).name(),
-                                                                                 this, SLOT(sltMountStorageMedium()));
-                    pChooseHostDriveAction->setCheckable(true);
-                    pChooseHostDriveAction->setChecked(!currentMedium.isNull() && medium.GetId() == strCurrentId);
-                    pChooseHostDriveAction->setData(QVariant::fromValue(MediumTarget(controller.GetName(), attachment.GetPort(),
-                                                                                     attachment.GetDevice(), medium.GetId())));
-                }
-            }
-
-            /* Prepare choose-recent-medium actions: */
-            QStringList recentMediumList = vboxGlobal().virtualBox().GetExtraData(strRecentMediumAddress).split(';');
-            /* For every list-item: */
-            for (int i = 0; i < recentMediumList.size(); ++i)
-            {
-                QString strRecentMediumLocation = QDir::toNativeSeparators(recentMediumList[i]);
-                if (QFile::exists(strRecentMediumLocation))
-                {
-                    bool fIsRecentMediumUsed = false;
-                    for (int iOtherAttachmentIndex = 0; iOtherAttachmentIndex < attachments.size(); ++iOtherAttachmentIndex)
-                    {
-                        const CMediumAttachment &otherAttachment = attachments[iOtherAttachmentIndex];
-                        if (otherAttachment != attachment)
-                        {
-                            const CMedium &otherMedium = otherAttachment.GetMedium();
-                            if (!otherMedium.isNull() && otherMedium.GetLocation() == strRecentMediumLocation)
-                            {
-                                fIsRecentMediumUsed = true;
-                                break;
-                            }
-                        }
-                    }
-                    if (!fIsRecentMediumUsed)
-                    {
-                        QAction *pChooseRecentMediumAction = pAttachmentMenu->addAction(QFileInfo(strRecentMediumLocation).fileName(),
-                                                                                        this, SLOT(sltMountRecentStorageMedium()));
-                        pChooseRecentMediumAction->setCheckable(true);
-                        pChooseRecentMediumAction->setChecked(!currentMedium.isNull() && strRecentMediumLocation == strCurrentLocation);
-                        pChooseRecentMediumAction->setData(QVariant::fromValue(RecentMediumTarget(controller.GetName(), attachment.GetPort(),
-                                                                                                  attachment.GetDevice(), strRecentMediumLocation, mediumType)));
-                        pChooseRecentMediumAction->setToolTip(strRecentMediumLocation);
+        const QString &s = formats.at(i) + " (*." + formats.at(i).toLower() + ")";
+        /* Check there isn't an entry already (even if it just uses another capitalization) */
+        if (filters.indexOf(QRegExp(QRegExp::escape(s), Qt::CaseInsensitive)) == -1)
+            filters << s;
+    }
+    /* Try to select some common defaults. */
+    QString strFilter;
+    int i = filters.indexOf(QRegExp(".*png.*", Qt::CaseInsensitive));
+    if (i == -1)
+    {
+        i = filters.indexOf(QRegExp(".*jpe+g.*", Qt::CaseInsensitive));
+        if (i == -1)
+            i = filters.indexOf(QRegExp(".*bmp.*", Qt::CaseInsensitive));
+    }
+    if (i != -1)
+    {
+        filters.prepend(filters.takeAt(i));
+        strFilter = filters.first();
+    }
 
-                    }
-                }
-            }
+#ifdef Q_WS_WIN
+    /* Due to Qt bug, modal QFileDialog appeared above the active machine-window
+     * does not retreive the focus from the currently focused machine-view,
+     * as the result guest keyboard remains captured, so we should
+     * clear the focus from this machine-view initially: */
+    if (activeMachineWindow())
+        activeMachineWindow()->machineView()->clearFocus();
+#endif /* Q_WS_WIN */
 
-            /* Insert separator: */
-            pAttachmentMenu->addSeparator();
+    /* Request the filename from the user. */
+    QFileInfo fi(machine().GetSettingsFilePath());
+    QString strAbsolutePath(fi.absolutePath());
+    QString strCompleteBaseName(fi.completeBaseName());
+    QString strStart = QDir(strAbsolutePath).absoluteFilePath(strCompleteBaseName);
+    QString strFilename = QIFileDialog::getSaveFileName(strStart,
+                                                        filters.join(";;"),
+                                                        activeMachineWindow(),
+                                                        tr("Select a filename for the screenshot ..."),
+                                                        &strFilter,
+                                                        true /* resolve symlinks */,
+                                                        true /* confirm overwrite */);
 
-            /* Unmount Medium action: */
-            QAction *unmountMediumAction = new QAction(pAttachmentMenu);
-            unmountMediumAction->setEnabled(!currentMedium.isNull());
-            unmountMediumAction->setData(QVariant::fromValue(MediumTarget(controller.GetName(),
-                                                                          attachment.GetPort(),
-                                                                          attachment.GetDevice())));
-            connect(unmountMediumAction, SIGNAL(triggered(bool)), this, SLOT(sltMountStorageMedium()));
-            pAttachmentMenu->addAction(unmountMediumAction);
+#ifdef Q_WS_WIN
+    /* Due to Qt bug, modal QFileDialog appeared above the active machine-window
+     * does not retreive the focus from the currently focused machine-view,
+     * as the result guest keyboard remains captured, so we already
+     * cleared the focus from this machine-view and should return
+     * that focus finally: */
+    if (activeMachineWindow())
+        activeMachineWindow()->machineView()->setFocus();
+#endif /* Q_WS_WIN */
 
-            /* Switch CD/FD naming */
-            switch (mediumType)
-            {
-                case UIMediumType_DVD:
-                    pChooseExistingMediumAction->setText(QApplication::translate("UIMachineSettingsStorage", "Choose a virtual CD/DVD disk file..."));
-                    unmountMediumAction->setText(QApplication::translate("UIMachineSettingsStorage", "Remove disk from virtual drive"));
-                    unmountMediumAction->setIcon(UIIconPool::iconSet(":/cd_unmount_16px.png",
-                                                                     ":/cd_unmount_dis_16px.png"));
-                    break;
-                case UIMediumType_Floppy:
-                    pChooseExistingMediumAction->setText(QApplication::translate("UIMachineSettingsStorage", "Choose a virtual floppy disk file..."));
-                    unmountMediumAction->setText(QApplication::translate("UIMachineSettingsStorage", "Remove disk from virtual drive"));
-                    unmountMediumAction->setIcon(UIIconPool::iconSet(":/fd_unmount_16px.png",
-                                                                     ":/fd_unmount_dis_16px.png"));
-                    break;
-                default:
-                    break;
-            }
-        }
-    }
+    /* Do the screenshot. */
+    if (!strFilename.isEmpty())
+        takeScreenshot(strFilename, strFilter.split(" ").value(0, "png"));
 }
 
-void UIMachineLogic::sltMountStorageMedium()
+void UIMachineLogic::sltOpenVideoCaptureOptions()
 {
-    /* Get sender action: */
-    QAction *action = qobject_cast<QAction*>(sender());
-    AssertMsg(action, ("This slot should only be called on selecting storage menu item!\n"));
-
-    /* Get current machine: */
-    CMachine machine = session().GetMachine();
-
-    /* Get mount-target: */
-    MediumTarget target = action->data().value<MediumTarget>();
-
-    /* Current mount-target attributes: */
-    CMediumAttachment currentAttachment = machine.GetMediumAttachment(target.name, target.port, target.device);
-    CMedium currentMedium = currentAttachment.GetMedium();
-    QString currentId = currentMedium.isNull() ? QString("") : currentMedium.GetId();
-
-    /* New mount-target attributes: */
-    QString newId = QString("");
-    bool fSelectWithMediaManager = target.type != UIMediumType_Invalid;
-
-    /* Open Virtual Media Manager to select image id: */
-    if (fSelectWithMediaManager)
-    {
-        /* Search for already used images: */
-        QStringList usedImages;
-        foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments())
-        {
-            CMedium medium = attachment.GetMedium();
-            if (attachment != currentAttachment && !medium.isNull() && !medium.GetHostDrive())
-                usedImages << medium.GetId();
-        }
-        /* To that moment application focus already returned to machine-view,
-         * so the keyboard already captured too.
-         * We should clear application focus from machine-view now
-         * to let file-open dialog get it. That way the keyboard will be released too: */
-        if (QApplication::focusWidget())
-            QApplication::focusWidget()->clearFocus();
-        /* Call for file-open window: */
-        QString strMachineFolder(QFileInfo(machine.GetSettingsFilePath()).absolutePath());
-        QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(target.type, activeMachineWindow(),
-                                                                        strMachineFolder);
-        activeMachineWindow()->machineView()->setFocus();
-        if (!strMediumId.isNull())
-            newId = strMediumId;
-        else return;
-    }
-    /* Use medium which was sent: */
-    else if (!target.id.isNull() && target.id != currentId)
-        newId = target.id;
+    /* Open VM settings : Display page : Video Capture tab: */
+    sltOpenVMSettingsDialog("#display", "m_pCheckboxVideoCapture");
+}
 
-    bool fMount = !newId.isEmpty();
+void UIMachineLogic::sltToggleVideoCapture(bool fEnabled)
+{
+    /* Do not process if window(s) missed! */
+    if (!isMachineWindowsCreated())
+        return;
 
-    UIMedium vmedium = vboxGlobal().medium(newId);
-    CMedium medium = vmedium.medium();              // @todo r=dj can this be cached somewhere?
+    /* Make sure something had changed: */
+    if (machine().GetVideoCaptureEnabled() == static_cast<BOOL>(fEnabled))
+        return;
 
-    /* Remount medium to the predefined port/device: */
-    bool fWasMounted = false;
-    machine.MountMedium(target.name, target.port, target.device, medium, false /* force */);
-    if (machine.isOk())
-        fWasMounted = true;
-    else
+    /* Update Video Capture state: */
+    machine().SetVideoCaptureEnabled(fEnabled);
+    if (!machine().isOk())
     {
-        /* Ask for force remounting: */
-        if (msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(fMount ? newId : currentId),
-                                            fMount, true /* retry? */, activeMachineWindow()))
-        {
-            /* Force remount medium to the predefined port/device: */
-            machine.MountMedium(target.name, target.port, target.device, medium, true /* force */);
-            if (machine.isOk())
-                fWasMounted = true;
-            else
-                msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(fMount ? newId : currentId),
-                                                fMount, false /* retry? */, activeMachineWindow());
-        }
+        /* Make sure action is updated: */
+        uisession()->updateStatusVideoCapture();
+        /* Notify about the error: */
+        return msgCenter().cannotToggleVideoCapture(machine(), fEnabled);
     }
 
-    /* Save medium mounted at runtime */
-    if (fWasMounted && !uisession()->isIgnoreRuntimeMediumsChanging())
+    /* Save machine-settings: */
+    machine().SaveSettings();
+    if (!machine().isOk())
     {
-        machine.SaveSettings();
-        if (!machine.isOk())
-            msgCenter().cannotSaveMachineSettings(machine, activeMachineWindow());
+        /* Make sure action is updated: */
+        uisession()->updateStatusVideoCapture();
+        /* Notify about the error: */
+        return msgCenter().cannotSaveMachineSettings(machine());
     }
 }
 
-void UIMachineLogic::sltMountRecentStorageMedium()
+void UIMachineLogic::sltToggleVRDE(bool fEnabled)
 {
-    /* Get sender action: */
-    QAction *pSender = qobject_cast<QAction*>(sender());
-    AssertMsg(pSender, ("This slot should only be called on selecting storage menu item!\n"));
+    /* Do not process if window(s) missed! */
+    if (!isMachineWindowsCreated())
+        return;
 
-    /* Get mount-target: */
-    RecentMediumTarget target = pSender->data().value<RecentMediumTarget>();
+    /* Access VRDE server: */
+    CVRDEServer server = machine().GetVRDEServer();
+    AssertMsgReturnVoid(machine().isOk() && !server.isNull(),
+                        ("VRDE server should NOT be null!\n"));
 
-    /* Get new medium id: */
-    QString strNewId = vboxGlobal().openMedium(target.type, target.location);
+    /* Make sure something had changed: */
+    if (server.GetEnabled() == static_cast<BOOL>(fEnabled))
+        return;
 
-    if (!strNewId.isEmpty())
+    /* Update VRDE server state: */
+    server.SetEnabled(fEnabled);
+    if (!server.isOk())
     {
-        /* Get current machine: */
-        CMachine machine = session().GetMachine();
-
-        /* Get current medium id: */
-        const CMediumAttachment &currentAttachment = machine.GetMediumAttachment(target.name, target.port, target.device);
-        CMedium currentMedium = currentAttachment.GetMedium();
-        QString strCurrentId = currentMedium.isNull() ? QString("") : currentMedium.GetId();
-
-        /* Should we mount or unmount? */
-        bool fMount = strNewId != strCurrentId;
-
-        /* Prepare target medium: */
-        const UIMedium &vboxMedium = fMount ? vboxGlobal().medium(strNewId) : UIMedium();
-        const CMedium &comMedium = fMount ? vboxMedium.medium() : CMedium();
-
-        /* 'Mounted' flag: */
-        bool fWasMounted = false;
-
-        /* Try to mount medium to the predefined port/device: */
-        machine.MountMedium(target.name, target.port, target.device, comMedium, false /* force? */);
-        if (machine.isOk())
-            fWasMounted = true;
-        else
-        {
-            /* Ask for force remounting: */
-            if (msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(fMount ? strNewId : strCurrentId),
-                                                fMount, true /* retry? */, activeMachineWindow()))
-            {
-                /* Force remount medium to the predefined port/device: */
-                machine.MountMedium(target.name, target.port, target.device, comMedium, true /* force? */);
-                if (machine.isOk())
-                    fWasMounted = true;
-                else
-                    msgCenter().cannotRemountMedium(machine, vboxGlobal().medium(fMount ? strNewId : strCurrentId),
-                                                    fMount, false /* retry? */, activeMachineWindow());
-            }
-        }
+        /* Make sure action is updated: */
+        uisession()->updateStatusVRDE();
+        /* Notify about the error: */
+        return msgCenter().cannotToggleVRDEServer(server, machineName(), fEnabled);
+    }
 
-        /* Save medium mounted at runtime if necessary: */
-        if (fWasMounted && !uisession()->isIgnoreRuntimeMediumsChanging())
-        {
-            machine.SaveSettings();
-            if (!machine.isOk())
-                msgCenter().cannotSaveMachineSettings(machine, activeMachineWindow());
-        }
+    /* Save machine-settings: */
+    machine().SaveSettings();
+    if (!machine().isOk())
+    {
+        /* Make sure action is updated: */
+        uisession()->updateStatusVRDE();
+        /* Notify about the error: */
+        return msgCenter().cannotSaveMachineSettings(machine());
     }
 }
 
-void UIMachineLogic::sltPrepareUSBMenu()
+void UIMachineLogic::sltOpenVMSettingsDialog(const QString &strCategory /* = QString() */,
+                                             const QString &strControl /* = QString()*/)
 {
-    /* Get and check the sender menu object: */
-    QMenu *pMenu = qobject_cast<QMenu*>(sender());
-    QMenu *pUSBDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->menu();
-    AssertMsg(pMenu == pUSBDevicesMenu, ("This slot should only be called on hovering USB menu!\n"));
-    Q_UNUSED(pUSBDevicesMenu);
-
-    /* Clear menu initially: */
-    pMenu->clear();
-
-    /* Get current host: */
-    CHost host = vboxGlobal().host();
-
-    /* Get host USB device list: */
-    CHostUSBDeviceVector devices = host.GetUSBDevices();
+    /* Do not process if window(s) missed! */
+    if (!isMachineWindowsCreated())
+        return;
 
-    /* Fill USB device menu: */
-    bool fIsUSBListEmpty = devices.size() == 0;
-    /* If device list is empty: */
-    if (fIsUSBListEmpty)
-    {
-        /* Add only one - "empty" action: */
-        QAction *pEmptyMenuAction = new QAction(pMenu);
-        pEmptyMenuAction->setEnabled(false);
-        pEmptyMenuAction->setText(tr("No USB Devices Connected"));
-        pEmptyMenuAction->setToolTip(tr("No supported devices connected to the host PC"));
-        pEmptyMenuAction->setIcon(UIIconPool::iconSet(":/vm_delete_16px.png", ":/vm_delete_disabled_16px.png")); // TODO: Change icon!
-        pMenu->addAction(pEmptyMenuAction);
-    }
-    /* If device list is NOT empty: */
-    else
-    {
-        /* Populate menu with host USB devices: */
-        for (int i = 0; i < devices.size(); ++i)
-        {
-            /* Get current host USB device: */
-            const CHostUSBDevice& hostDevice = devices[i];
-            /* Get USB device from current host USB device: */
-            CUSBDevice device(hostDevice);
+    /* Create VM settings window on the heap!
+     * Its necessary to allow QObject hierarchy cleanup to delete this dialog if necessary: */
+    QPointer<UISettingsDialogMachine> pDialog = new UISettingsDialogMachine(activeMachineWindow(),
+                                                                            machine().GetId(),
+                                                                            strCategory, strControl);
+    /* Executing VM settings window.
+     * This blocking function calls for the internal event-loop to process all further events,
+     * including event which can delete the dialog itself. */
+    pDialog->execute();
+    /* Delete dialog if its still valid: */
+    if (pDialog)
+        delete pDialog;
 
-            /* Create USB device action: */
-            QAction *pAttachUSBAction = new QAction(vboxGlobal().details(device), pMenu);
-            pAttachUSBAction->setCheckable(true);
-            connect(pAttachUSBAction, SIGNAL(triggered(bool)), this, SLOT(sltAttachUSBDevice()));
-            pMenu->addAction(pAttachUSBAction);
+    /* We can't rely on MediumChange events as they are not yet properly implemented within Main.
+     * We can't watch for MachineData change events as well as they are of broadcast type
+     * and console event-handler do not processing broadcast events.
+     * But we still want to be updated after possible medium changes at least if they were
+     * originated from our side. */
+    foreach (UIMachineWindow *pMachineWindow, machineWindows())
+        pMachineWindow->updateAppearanceOf(UIVisualElement_HDStuff | UIVisualElement_CDStuff | UIVisualElement_FDStuff);
+}
 
-            /* Check if that USB device was already attached to this session: */
-            CConsole console = session().GetConsole();
-            CUSBDevice attachedDevice = console.FindUSBDeviceById(device.GetId());
-            pAttachUSBAction->setChecked(!attachedDevice.isNull());
-            pAttachUSBAction->setEnabled(hostDevice.GetState() != KUSBDeviceState_Unavailable);
+void UIMachineLogic::sltOpenStorageSettingsDialog()
+{
+    /* Machine settings: Storage page: */
+    sltOpenVMSettingsDialog("#storage");
+}
 
-            /* Set USB attach data: */
-            pAttachUSBAction->setData(QVariant::fromValue(USBTarget(!pAttachUSBAction->isChecked(), device.GetId())));
-            pAttachUSBAction->setToolTip(vboxGlobal().toolTip(device));
-        }
-    }
+void UIMachineLogic::sltOpenNetworkSettingsDialog()
+{
+    /* Open VM settings : Network page: */
+    sltOpenVMSettingsDialog("#network");
 }
 
-/**
- * Prepares menu content when user hovers <b>Webcam</b> submenu of the <b>Devices</b> menu.
- * @note If host currently have no webcams attached there will be just one dummy action
- *       called <i>No Webcams Connected</i>. Otherwise there will be actions corresponding
- *       to existing webcams allowing user to attach/detach them within the guest.
- * @note In order to enumerate webcams GUI assigns #WebCamTarget object as internal data
- *       for each the enumerated webcam menu action. Corresponding #sltAttachWebCamDevice
- *       slot will be called on action triggering. It will parse assigned #WebCamTarget data.
- */
-void UIMachineLogic::sltPrepareWebCamMenu()
+void UIMachineLogic::sltOpenUSBDevicesSettingsDialog()
 {
-    /* Get and check the sender menu object: */
-    QMenu *pMenu = qobject_cast<QMenu*>(sender());
-    QMenu *pWebCamMenu = gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->menu();
-    AssertReturnVoid(pMenu == pWebCamMenu); Q_UNUSED(pWebCamMenu);
+    /* Machine settings: Storage page: */
+    sltOpenVMSettingsDialog("#usb");
+}
 
-    /* Clear menu initially: */
-    pMenu->clear();
+void UIMachineLogic::sltOpenSharedFoldersSettingsDialog()
+{
+    /* Do not process if additions are not loaded! */
+    if (!uisession()->isGuestAdditionsActive())
+        msgCenter().remindAboutGuestAdditionsAreNotActive();
 
-    /* Get current host: */
-    const CHost &host = vboxGlobal().host();
+    /* Open VM settings : Shared folders page: */
+    sltOpenVMSettingsDialog("#sharedFolders");
+}
 
-    /* Get host webcams list: */
-    const CHostVideoInputDeviceVector &webcams = host.GetVideoInputDevices();
+void UIMachineLogic::sltMountStorageMedium()
+{
+    /* Sender action: */
+    QAction *pAction = qobject_cast<QAction*>(sender());
+    AssertMsgReturnVoid(pAction, ("This slot should only be called by menu action!\n"));
 
-    /* If webcam list is empty: */
-    if (webcams.isEmpty())
-    {
-        /* Add only one - "empty" action: */
-        QAction *pEmptyMenuAction = new QAction(pMenu);
-        pEmptyMenuAction->setEnabled(false);
-        pEmptyMenuAction->setText(tr("No Webcams Connected"));
-        pEmptyMenuAction->setToolTip(tr("No supported webcams connected to the host PC"));
-        pEmptyMenuAction->setIcon(UIIconPool::iconSet(":/vm_delete_16px.png", ":/vm_delete_disabled_16px.png")); // TODO: Change icon!
-        pMenu->addAction(pEmptyMenuAction);
-    }
-    /* If webcam list is NOT empty: */
-    else
-    {
-        /* Populate menu with host webcams: */
-        const QVector<QString> &attachedWebcamPaths = session().GetConsole().GetEmulatedUSB().GetWebcams();
-        foreach (const CHostVideoInputDevice &webcam, webcams)
-        {
-            /* Get webcam data: */
-            const QString &strWebcamName = webcam.GetName();
-            const QString &strWebcamPath = webcam.GetPath();
+    /* Current mount-target: */
+    const UIMediumTarget target = pAction->data().value<UIMediumTarget>();
 
-            /* Create/configure webcam action: */
-            QAction *pAttachWebcamAction = new QAction(strWebcamName, pMenu);
-            pAttachWebcamAction->setToolTip(vboxGlobal().toolTip(webcam));
-            pAttachWebcamAction->setCheckable(true);
-            pAttachWebcamAction->setChecked(attachedWebcamPaths.contains(strWebcamPath));
-            pAttachWebcamAction->setData(QVariant::fromValue(WebCamTarget(!pAttachWebcamAction->isChecked(), strWebcamName, strWebcamPath)));
-            connect(pAttachWebcamAction, SIGNAL(triggered(bool)), this, SLOT(sltAttachWebCamDevice()));
-            pMenu->addAction(pAttachWebcamAction);
-        }
-    }
+    /* Update current machine mount-target: */
+    vboxGlobal().updateMachineStorage(machine(), target);
 }
 
 void UIMachineLogic::sltAttachUSBDevice()
@@ -2011,16 +1783,13 @@ void UIMachineLogic::sltAttachUSBDevice()
     /* Get operation target: */
     USBTarget target = pAction->data().value<USBTarget>();
 
-    /* Get current console: */
-    CConsole console = session().GetConsole();
-
     /* Attach USB device: */
     if (target.attach)
     {
         /* Try to attach corresponding device: */
-        console.AttachUSBDevice(target.id);
+        console().AttachUSBDevice(target.id, QString(""));
         /* Check if console is OK: */
-        if (!console.isOk())
+        if (!console().isOk())
         {
             /* Get current host: */
             CHost host = vboxGlobal().host();
@@ -2029,31 +1798,25 @@ void UIMachineLogic::sltAttachUSBDevice()
             /* Get USB device from host USB device: */
             CUSBDevice device(hostDevice);
             /* Show a message about procedure failure: */
-            msgCenter().cannotAttachUSBDevice(console, vboxGlobal().details(device));
+            msgCenter().cannotAttachUSBDevice(console(), vboxGlobal().details(device));
         }
     }
     /* Detach USB device: */
     else
     {
         /* Search the console for the corresponding USB device: */
-        CUSBDevice device = console.FindUSBDeviceById(target.id);
+        CUSBDevice device = console().FindUSBDeviceById(target.id);
         /* Try to detach corresponding device: */
-        console.DetachUSBDevice(target.id);
+        console().DetachUSBDevice(target.id);
         /* Check if console is OK: */
-        if (!console.isOk())
+        if (!console().isOk())
         {
             /* Show a message about procedure failure: */
-            msgCenter().cannotDetachUSBDevice(console, vboxGlobal().details(device));
+            msgCenter().cannotDetachUSBDevice(console(), vboxGlobal().details(device));
         }
     }
 }
 
-/**
- * Attaches/detaches webcam within the guest.
- * @note In order to attach/detach webcams #sltPrepareWebCamMenu assigns #WebCamTarget object
- *       as internal data for each the enumerated webcam menu action. Corresponding data
- *       will be parsed here resulting in device attaching/detaching.
- */
 void UIMachineLogic::sltAttachWebCamDevice()
 {
     /* Get and check sender action object: */
@@ -2064,8 +1827,7 @@ void UIMachineLogic::sltAttachWebCamDevice()
     WebCamTarget target = pAction->data().value<WebCamTarget>();
 
     /* Get current emulated USB: */
-    const CConsole &console = session().GetConsole();
-    CEmulatedUSB dispatcher = console.GetEmulatedUSB();
+    CEmulatedUSB dispatcher = console().GetEmulatedUSB();
 
     /* Attach webcam device: */
     if (target.attach)
@@ -2074,7 +1836,7 @@ void UIMachineLogic::sltAttachWebCamDevice()
         dispatcher.WebcamAttach(target.path, "");
         /* Check if dispatcher is OK: */
         if (!dispatcher.isOk())
-            msgCenter().cannotAttachWebCam(dispatcher, target.name, console.GetMachine().GetName());
+            msgCenter().cannotAttachWebCam(dispatcher, target.name, machineName());
     }
     /* Detach webcam device: */
     else
@@ -2083,254 +1845,49 @@ void UIMachineLogic::sltAttachWebCamDevice()
         dispatcher.WebcamDetach(target.path);
         /* Check if dispatcher is OK: */
         if (!dispatcher.isOk())
-            msgCenter().cannotDetachWebCam(dispatcher, target.name, console.GetMachine().GetName());
-    }
-}
-
-void UIMachineLogic::sltPrepareSharedClipboardMenu()
-{
-    /* Get and check the sender menu object: */
-    QMenu *pMenu = qobject_cast<QMenu*>(sender());
-    QMenu *pSharedClipboardMenu = gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard)->menu();
-    AssertMsg(pMenu == pSharedClipboardMenu, ("This slot should only be called on hovering Shared Clipboard menu!\n"));
-    Q_UNUSED(pSharedClipboardMenu);
-
-    /* First run: */
-    if (!m_pSharedClipboardActions)
-    {
-        m_pSharedClipboardActions = new QActionGroup(this);
-        for (int i = KClipboardMode_Disabled; i < KClipboardMode_Max; ++i)
-        {
-            KClipboardMode mode = (KClipboardMode)i;
-            QAction *pAction = new QAction(gpConverter->toString(mode), m_pSharedClipboardActions);
-            pMenu->addAction(pAction);
-            pAction->setData(QVariant::fromValue(mode));
-            pAction->setCheckable(true);
-            pAction->setChecked(session().GetMachine().GetClipboardMode() == mode);
-        }
-        connect(m_pSharedClipboardActions, SIGNAL(triggered(QAction*)),
-                this, SLOT(sltChangeSharedClipboardType(QAction*)));
+            msgCenter().cannotDetachWebCam(dispatcher, target.name, machineName());
     }
-    /* Subsequent runs: */
-    else
-        foreach (QAction *pAction, m_pSharedClipboardActions->actions())
-            if (pAction->data().value<KClipboardMode>() == session().GetMachine().GetClipboardMode())
-                pAction->setChecked(true);
 }
 
 void UIMachineLogic::sltChangeSharedClipboardType(QAction *pAction)
 {
     /* Assign new mode (without save): */
     KClipboardMode mode = pAction->data().value<KClipboardMode>();
-    session().GetMachine().SetClipboardMode(mode);
-}
-
-void UIMachineLogic::sltPrepareDragAndDropMenu()
-{
-    /* Get and check the sender menu object: */
-    QMenu *pMenu = qobject_cast<QMenu*>(sender());
-    QMenu *pDragAndDropMenu = gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop)->menu();
-    AssertMsg(pMenu == pDragAndDropMenu, ("This slot should only be called on hovering Drag'n'drop menu!\n"));
-    Q_UNUSED(pDragAndDropMenu);
-
-    /* First run: */
-    if (!m_pDragAndDropActions)
-    {
-        m_pDragAndDropActions = new QActionGroup(this);
-        for (int i = KDragAndDropMode_Disabled; i < KDragAndDropMode_Max; ++i)
-        {
-            KDragAndDropMode mode = (KDragAndDropMode)i;
-            QAction *pAction = new QAction(gpConverter->toString(mode), m_pDragAndDropActions);
-            pMenu->addAction(pAction);
-            pAction->setData(QVariant::fromValue(mode));
-            pAction->setCheckable(true);
-            pAction->setChecked(session().GetMachine().GetDragAndDropMode() == mode);
-        }
-        connect(m_pDragAndDropActions, SIGNAL(triggered(QAction*)),
-                this, SLOT(sltChangeDragAndDropType(QAction*)));
-    }
-    /* Subsequent runs: */
-    else
-        foreach (QAction *pAction, m_pDragAndDropActions->actions())
-            if (pAction->data().value<KDragAndDropMode>() == session().GetMachine().GetDragAndDropMode())
-                pAction->setChecked(true);
+    machine().SetClipboardMode(mode);
 }
 
-/** Prepares menu content when user hovers <b>Network</b> submenu of the <b>Devices</b> menu. */
-void UIMachineLogic::sltPrepareNetworkMenu()
-{
-    /* Get and check 'the sender' menu object: */
-    QMenu *pMenu = qobject_cast<QMenu*>(sender());
-    QMenu *pNetworkMenu = gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu();
-    AssertReturnVoid(pMenu == pNetworkMenu);
-    Q_UNUSED(pNetworkMenu);
-
-    /* Get and check current machine: */
-    const CMachine &machine = session().GetMachine();
-    AssertReturnVoid(!machine.isNull());
-
-    /* Determine how many adapters we should display: */
-    KChipsetType chipsetType = machine.GetChipsetType();
-    ULONG uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType));
-
-    /* Enumerate existing network adapters: */
-    QMap<int, bool> adapterData;
-    for (ULONG uSlot = 0; uSlot < uCount; ++uSlot)
-    {
-        /* Get and check iterated adapter: */
-        const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);
-        AssertReturnVoid(machine.isOk());
-        Assert(!adapter.isNull());
-        if (adapter.isNull())
-            continue;
-
-        /* Remember adapter data if it is enabled: */
-        if (adapter.GetEnabled())
-            adapterData.insert((int)uSlot, (bool)adapter.GetCableConnected());
-    }
-    AssertReturnVoid(!adapterData.isEmpty());
-
-    /* Delete all "temporary" actions: */
-    QList<QAction*> actions = pMenu->actions();
-    foreach (QAction *pAction, actions)
-        if (pAction->property("temporary").toBool())
-            delete pAction;
-
-    /* Add new "temporary" actions: */
-    foreach (int iSlot, adapterData.keys())
-    {
-        QAction *pAction = pMenu->addAction(QIcon(adapterData[iSlot] ? ":/connect_16px.png": ":/disconnect_16px.png"),
-                                            adapterData.size() == 1 ? tr("Connect Network Adapter") : tr("Connect Network Adapter %1").arg(iSlot + 1),
-                                            this, SLOT(sltToggleNetworkAdapterConnection()));
-        pAction->setProperty("temporary", true);
-        pAction->setProperty("slot", iSlot);
-        pAction->setCheckable(true);
-        pAction->setChecked(adapterData[iSlot]);
-    }
-}
-
-/** Toggles network adapter's <i>Cable Connected</i> state. */
 void UIMachineLogic::sltToggleNetworkAdapterConnection()
 {
-    /* Get and check 'the sender' action object: */
-    QAction *pAction = qobject_cast<QAction*>(sender());
-    AssertReturnVoid(pAction);
-
-    /* Get and check current machine: */
-    CMachine machine = session().GetMachine();
-    AssertReturnVoid(!machine.isNull());
-
-    /* Get operation target: */
-    CNetworkAdapter adapter = machine.GetNetworkAdapter((ULONG)pAction->property("slot").toInt());
-    AssertReturnVoid(machine.isOk() && !adapter.isNull());
-
-    /* Connect/disconnect cable to/from target: */
-    adapter.SetCableConnected(!adapter.GetCableConnected());
-    machine.SaveSettings();
-    if (!machine.isOk())
-        msgCenter().cannotSaveMachineSettings(machine);
-}
-
-void UIMachineLogic::sltChangeDragAndDropType(QAction *pAction)
-{
-    /* Assign new mode (without save): */
-    KDragAndDropMode mode = pAction->data().value<KDragAndDropMode>();
-    session().GetMachine().SetDragAndDropMode(mode);
-}
-
-void UIMachineLogic::sltToggleVRDE(bool fEnabled)
-{
     /* Do not process if window(s) missed! */
     if (!isMachineWindowsCreated())
         return;
 
-    /* Access VRDE server: */
-    CMachine machine = session().GetMachine();
-    CVRDEServer server = machine.GetVRDEServer();
-    AssertMsg(!server.isNull(), ("VRDE server should NOT be null!\n"));
-    if (!machine.isOk() || server.isNull())
-        return;
-
-    /* Make sure something had changed: */
-    if (server.GetEnabled() == static_cast<BOOL>(fEnabled))
-        return;
-
-    /* Server is OK? */
-    if (server.isOk())
-    {
-        /* Update VRDE server state: */
-        server.SetEnabled(fEnabled);
-        /* Server still OK? */
-        if (server.isOk())
-        {
-            /* Save machine-settings: */
-            machine.SaveSettings();
-            /* Machine still OK? */
-            if (!machine.isOk())
-            {
-                /* Notify about the error: */
-                msgCenter().cannotSaveMachineSettings(machine);
-                /* Make sure action is updated! */
-                uisession()->updateStatusVRDE();
-            }
-        }
-        else
-        {
-            /* Notify about the error: */
-            msgCenter().cannotToggleVRDEServer(server, machine.GetName(), fEnabled);
-            /* Make sure action is updated! */
-            uisession()->updateStatusVRDE();
-        }
-    }
-}
-
-void UIMachineLogic::sltToggleVideoCapture(bool fEnabled)
-{
-    /* Do not process if window(s) missed! */
-    if (!isMachineWindowsCreated())
-        return;
-
-    /* Access machine: */
-    CMachine machine = session().GetMachine();
-    AssertMsg(!machine.isNull(), ("Machine should NOT be null!\n"));
-    if (machine.isNull())
-        return;
-
-    /* Make sure something had changed: */
-    if (machine.GetVideoCaptureEnabled() == static_cast<BOOL>(fEnabled))
-        return;
-
-    /* Update Video Capture state: */
-    AssertMsg(machine.isOk(), ("Machine should be OK!\n"));
-    machine.SetVideoCaptureEnabled(fEnabled);
-    /* Machine is not OK? */
-    if (!machine.isOk())
-    {
-        /* Notify about the error: */
-        msgCenter().cannotToggleVideoCapture(machine, fEnabled);
-        /* Make sure action is updated! */
-        uisession()->updateStatusVideoCapture();
-    }
-    /* Machine is OK? */
-    else
-    {
-        /* Save machine-settings: */
-        machine.SaveSettings();
-        /* Machine is not OK? */
-        if (!machine.isOk())
-        {
-            /* Notify about the error: */
-            msgCenter().cannotSaveMachineSettings(machine);
-            /* Make sure action is updated! */
-            uisession()->updateStatusVideoCapture();
-        }
-    }
+    /* Get and check 'the sender' action object: */
+    QAction *pAction = qobject_cast<QAction*>(sender());
+    AssertMsgReturnVoid(pAction, ("Sender action should NOT be null!\n"));
+
+    /* Get operation target: */
+    CNetworkAdapter adapter = machine().GetNetworkAdapter((ULONG)pAction->property("slot").toInt());
+    AssertMsgReturnVoid(machine().isOk() && !adapter.isNull(),
+                        ("Network adapter should NOT be null!\n"));
+
+    /* Connect/disconnect cable to/from target: */
+    const bool fConnect = !adapter.GetCableConnected();
+    adapter.SetCableConnected(fConnect);
+    if (!adapter.isOk())
+        return msgCenter().cannotToggleNetworkAdapterCable(adapter, machineName(), fConnect);
+
+    /* Save machine-settings: */
+    machine().SaveSettings();
+    if (!machine().isOk())
+        return msgCenter().cannotSaveMachineSettings(machine());
 }
 
-void UIMachineLogic::sltOpenVideoCaptureOptions()
+void UIMachineLogic::sltChangeDragAndDropType(QAction *pAction)
 {
-    /* Open VM settings : Display page : Video Capture tab: */
-    sltOpenVMSettingsDialog("#display", "m_pCheckboxVideoCapture");
+    /* Assign new mode (without save): */
+    KDnDMode mode = pAction->data().value<KDnDMode>();
+    machine().SetDnDMode(mode);
 }
 
 void UIMachineLogic::sltInstallGuestAdditions()
@@ -2380,27 +1937,6 @@ void UIMachineLogic::sltInstallGuestAdditions()
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
 
-void UIMachineLogic::sltPrepareDebugMenu()
-{
-    /* The "Logging" item. */
-    bool fEnabled = false;
-    bool fChecked = false;
-    CConsole console = session().GetConsole();
-    if (console.isOk())
-    {
-        CMachineDebugger cdebugger = console.GetDebugger();
-        if (console.isOk())
-        {
-            fEnabled = true;
-            fChecked = cdebugger.GetLogEnabled() != FALSE;
-        }
-    }
-    if (fEnabled != gActionPool->action(UIActionIndexRuntime_Toggle_Logging)->isEnabled())
-        gActionPool->action(UIActionIndexRuntime_Toggle_Logging)->setEnabled(fEnabled);
-    if (fChecked != gActionPool->action(UIActionIndexRuntime_Toggle_Logging)->isChecked())
-        gActionPool->action(UIActionIndexRuntime_Toggle_Logging)->setChecked(fChecked);
-}
-
 void UIMachineLogic::sltShowDebugStatistics()
 {
     if (dbgCreated())
@@ -2422,47 +1958,59 @@ void UIMachineLogic::sltShowDebugCommandLine()
 void UIMachineLogic::sltLoggingToggled(bool fState)
 {
     NOREF(fState);
-    CConsole console = session().GetConsole();
-    if (console.isOk())
-    {
-        CMachineDebugger cdebugger = console.GetDebugger();
-        if (console.isOk())
-            cdebugger.SetLogEnabled(fState);
-    }
+    if (!debugger().isNull() && debugger().isOk())
+        debugger().SetLogEnabled(fState);
 }
 
 void UIMachineLogic::sltShowLogDialog()
 {
     /* Show VM Log Viewer: */
-    UIVMLogViewer::showLogViewerFor(activeMachineWindow(), session().GetMachine());
+    UIVMLogViewer::showLogViewerFor(activeMachineWindow(), machine());
 }
 
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
 #ifdef Q_WS_MAC
-void UIMachineLogic::sltDockPreviewModeChanged(QAction *pAction)
+void UIMachineLogic::sltMinimizeActiveMachineWindow()
 {
-    CMachine machine = session().GetMachine();
-    if (!machine.isNull())
-    {
-        bool fEnabled = true;
-        if (pAction == gActionPool->action(UIActionIndexRuntime_Toggle_DockDisableMonitor))
-            fEnabled = false;
+    /* Minimize active machine-window: */
+    AssertPtrReturnVoid(activeMachineWindow());
+    activeMachineWindow()->showMinimized();
+}
 
-        machine.SetExtraData(GUI_RealtimeDockIconUpdateEnabled, fEnabled ? "true" : "false");
-        updateDockOverlay();
+void UIMachineLogic::sltSwitchToMachineWindow()
+{
+    /* Acquire appropriate sender action: */
+    const QAction *pSender = qobject_cast<QAction*>(sender());
+    AssertReturnVoid(pSender);
+    {
+        /* Determine sender action index: */
+        const int iIndex = pSender->data().toInt();
+        AssertReturnVoid(iIndex >= 0 && iIndex < machineWindows().size());
+        {
+            /* Raise appropriate machine-window: */
+            UIMachineWindow *pMachineWindow = machineWindows().at(iIndex);
+            AssertPtrReturnVoid(pMachineWindow);
+            {
+                pMachineWindow->show();
+                pMachineWindow->raise();
+                pMachineWindow->activateWindow();
+            }
+        }
     }
 }
 
+void UIMachineLogic::sltDockPreviewModeChanged(QAction *pAction)
+{
+    bool fEnabled = pAction != actionPool()->action(UIActionIndexRT_M_Dock_M_DockSettings_T_DisableMonitor);
+    gEDataManager->setRealtimeDockIconUpdateEnabled(fEnabled, vboxGlobal().managedVMUuid());
+    updateDockOverlay();
+}
+
 void UIMachineLogic::sltDockPreviewMonitorChanged(QAction *pAction)
 {
-    CMachine machine = session().GetMachine();
-    if (!machine.isNull())
-    {
-        int monitor = pAction->data().toInt();
-        machine.SetExtraData(GUI_RealtimeDockIconUpdateMonitor, QString::number(monitor));
-        updateDockOverlay();
-    }
+    gEDataManager->setRealtimeDockIconUpdateMonitor(pAction->data().toInt(), vboxGlobal().managedVMUuid());
+    updateDockOverlay();
 }
 
 void UIMachineLogic::sltChangeDockIconUpdate(bool fEnabled)
@@ -2473,8 +2021,8 @@ void UIMachineLogic::sltChangeDockIconUpdate(bool fEnabled)
         if (m_pDockPreviewSelectMonitorGroup)
         {
             m_pDockPreviewSelectMonitorGroup->setEnabled(fEnabled);
-            CMachine machine = session().GetMachine();
-            m_DockIconPreviewMonitor = qMin(machine.GetExtraData(GUI_RealtimeDockIconUpdateMonitor).toInt(), (int)machine.GetMonitorCount() - 1);
+            m_DockIconPreviewMonitor = qMin(gEDataManager->realtimeDockIconUpdateMonitor(vboxGlobal().managedVMUuid()),
+                                            (int)machine().GetMonitorCount() - 1);
         }
         /* Resize the dock icon in the case the preview monitor has changed. */
         QSize size = machineWindows().at(m_DockIconPreviewMonitor)->machineView()->size();
@@ -2490,7 +2038,7 @@ void UIMachineLogic::sltSwitchKeyboardLedsToGuestLeds()
 //    QString strDt = QDateTime::currentDateTime().toString("HH:mm:ss:zzz");
 //    printf("%s: UIMachineLogic: sltSwitchKeyboardLedsToGuestLeds called, machine name is {%s}\n",
 //           strDt.toAscii().constData(),
-//           session().GetMachine().GetName().toAscii().constData());
+//           machineName().toAscii().constData());
 
     /* Here we have to store host LED lock states. */
 
@@ -2521,7 +2069,7 @@ void UIMachineLogic::sltSwitchKeyboardLedsToPreviousLeds()
 //    QString strDt = QDateTime::currentDateTime().toString("HH:mm:ss:zzz");
 //    printf("%s: UIMachineLogic: sltSwitchKeyboardLedsToPreviousLeds called, machine name is {%s}\n",
 //           strDt.toAscii().constData(),
-//           session().GetMachine().GetName().toAscii().constData());
+//           machineName().toAscii().constData());
 
     if (!isHidLedsSyncEnabled())
         return;
@@ -2530,7 +2078,7 @@ void UIMachineLogic::sltSwitchKeyboardLedsToPreviousLeds()
     if (m_pHostLedsState)
     {
 #if defined(Q_WS_MAC)
-    	DarwinHidDevicesApplyAndReleaseLedsState(m_pHostLedsState);
+        DarwinHidDevicesApplyAndReleaseLedsState(m_pHostLedsState);
 #elif defined(Q_WS_WIN)
         keyboardHandler()->winSkipKeyboardEvents(true);
         WinHidDevicesApplyAndReleaseLedsState(m_pHostLedsState);
@@ -2539,7 +2087,383 @@ void UIMachineLogic::sltSwitchKeyboardLedsToPreviousLeds()
         LogRelFlow(("UIMachineLogic::sltSwitchKeyboardLedsToPreviousLeds: restore host LED lock states does not supported on this platform.\n"));
 #endif
         m_pHostLedsState = NULL;
-	}
+    }
+}
+
+void UIMachineLogic::sltShowGlobalPreferences()
+{
+    /* Do not process if window(s) missed! */
+    if (!isMachineWindowsCreated())
+        return;
+
+    /* Just show Global Preferences: */
+    showGlobalPreferences();
+}
+
+void UIMachineLogic::updateMenuDevicesStorage(QMenu *pMenu)
+{
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Determine device-type: */
+    const QMenu *pOpticalDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices)->menu();
+    const QMenu *pFloppyDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices)->menu();
+    const KDeviceType deviceType = pMenu == pOpticalDevicesMenu ? KDeviceType_DVD :
+                                   pMenu == pFloppyDevicesMenu  ? KDeviceType_Floppy :
+                                                                  KDeviceType_Null;
+    AssertMsgReturnVoid(deviceType != KDeviceType_Null, ("Incorrect storage device-type!\n"));
+
+    /* Prepare/fill all storage menus: */
+    foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())
+    {
+        /* Current controller: */
+        const CStorageController controller = machine().GetStorageControllerByName(attachment.GetController());
+        /* If controller present and device-type correct: */
+        if (!controller.isNull() && attachment.GetType() == deviceType)
+        {
+            /* Current controller/attachment attributes: */
+            const QString strControllerName = controller.GetName();
+            const StorageSlot storageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice());
+
+            /* Prepare current storage menu: */
+            QMenu *pStorageMenu = 0;
+            /* If it will be more than one storage menu: */
+            if (pMenu->menuAction()->data().toInt() > 1)
+            {
+                /* We have to create sub-menu for each of them: */
+                pStorageMenu = new QMenu(QString("%1 (%2)").arg(strControllerName).arg(gpConverter->toString(storageSlot)), pMenu);
+                switch (controller.GetBus())
+                {
+                    case KStorageBus_IDE:    pStorageMenu->setIcon(QIcon(":/ide_16px.png")); break;
+                    case KStorageBus_SATA:   pStorageMenu->setIcon(QIcon(":/sata_16px.png")); break;
+                    case KStorageBus_SCSI:   pStorageMenu->setIcon(QIcon(":/scsi_16px.png")); break;
+                    case KStorageBus_Floppy: pStorageMenu->setIcon(QIcon(":/floppy_16px.png")); break;
+                    case KStorageBus_SAS:    pStorageMenu->setIcon(QIcon(":/sata_16px.png")); break;
+                    case KStorageBus_USB:    pStorageMenu->setIcon(QIcon(":/usb_16px.png")); break;
+                    default: break;
+                }
+                pMenu->addMenu(pStorageMenu);
+            }
+            /* Otherwise just use existing one: */
+            else pStorageMenu = pMenu;
+
+            /* Fill current storage menu: */
+            vboxGlobal().prepareStorageMenu(*pStorageMenu,
+                                            this, SLOT(sltMountStorageMedium()),
+                                            machine(), strControllerName, storageSlot);
+        }
+    }
+}
+
+void UIMachineLogic::updateMenuDevicesNetwork(QMenu *pMenu)
+{
+    /* Determine how many adapters we should display: */
+    const KChipsetType chipsetType = machine().GetChipsetType();
+    const ULONG uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType));
+
+    /* Enumerate existing network adapters: */
+    QMap<int, bool> adapterData;
+    for (ULONG uSlot = 0; uSlot < uCount; ++uSlot)
+    {
+        /* Get and check iterated adapter: */
+        const CNetworkAdapter adapter = machine().GetNetworkAdapter(uSlot);
+        AssertReturnVoid(machine().isOk() && !adapter.isNull());
+
+        /* Skip disabled adapters: */
+        if (!adapter.GetEnabled())
+            continue;
+
+        /* Remember adapter data: */
+        adapterData.insert((int)uSlot, (bool)adapter.GetCableConnected());
+    }
+
+    /* Make sure at least one adapter was enabled: */
+    if (adapterData.isEmpty())
+        return;
+
+    /* Add new actions: */
+    foreach (int iSlot, adapterData.keys())
+    {
+        QAction *pAction = pMenu->addAction(UIIconPool::iconSet(adapterData[iSlot] ? ":/connect_16px.png": ":/disconnect_16px.png"),
+                                            adapterData.size() == 1 ? tr("Connect Network Adapter") : tr("Connect Network Adapter %1").arg(iSlot + 1),
+                                            this, SLOT(sltToggleNetworkAdapterConnection()));
+        pAction->setProperty("slot", iSlot);
+        pAction->setCheckable(true);
+        pAction->setChecked(adapterData[iSlot]);
+    }
+}
+
+void UIMachineLogic::updateMenuDevicesUSB(QMenu *pMenu)
+{
+    /* Get current host: */
+    const CHost host = vboxGlobal().host();
+    /* Get host USB device list: */
+    const CHostUSBDeviceVector devices = host.GetUSBDevices();
+
+    /* If device list is empty: */
+    if (devices.isEmpty())
+    {
+        /* Add only one - "empty" action: */
+        QAction *pEmptyMenuAction = pMenu->addAction(UIIconPool::iconSet(":/usb_unavailable_16px.png",
+                                                                         ":/usb_unavailable_disabled_16px.png"),
+                                                     tr("No USB Devices Connected"));
+        pEmptyMenuAction->setToolTip(tr("No supported devices connected to the host PC"));
+        pEmptyMenuAction->setEnabled(false);
+    }
+    /* If device list is NOT empty: */
+    else
+    {
+        /* Populate menu with host USB devices: */
+        foreach (const CHostUSBDevice& hostDevice, devices)
+        {
+            /* Get USB device from current host USB device: */
+            const CUSBDevice device(hostDevice);
+
+            /* Create USB device action: */
+            QAction *pAttachUSBAction = pMenu->addAction(vboxGlobal().details(device),
+                                                         this, SLOT(sltAttachUSBDevice()));
+            pAttachUSBAction->setToolTip(vboxGlobal().toolTip(device));
+            pAttachUSBAction->setCheckable(true);
+
+            /* Check if that USB device was already attached to this session: */
+            const CUSBDevice attachedDevice = console().FindUSBDeviceById(device.GetId());
+            pAttachUSBAction->setChecked(!attachedDevice.isNull());
+            pAttachUSBAction->setEnabled(hostDevice.GetState() != KUSBDeviceState_Unavailable);
+
+            /* Set USB attach data: */
+            pAttachUSBAction->setData(QVariant::fromValue(USBTarget(!pAttachUSBAction->isChecked(), device.GetId())));
+        }
+    }
+}
+
+void UIMachineLogic::updateMenuDevicesWebCams(QMenu *pMenu)
+{
+    /* Clear contents: */
+    pMenu->clear();
+
+    /* Get current host: */
+    const CHost host = vboxGlobal().host();
+    /* Get host webcam list: */
+    const CHostVideoInputDeviceVector webcams = host.GetVideoInputDevices();
+
+    /* If webcam list is empty: */
+    if (webcams.isEmpty())
+    {
+        /* Add only one - "empty" action: */
+        QAction *pEmptyMenuAction = pMenu->addAction(UIIconPool::iconSet(":/web_camera_unavailable_16px.png",
+                                                                         ":/web_camera_unavailable_disabled_16px.png"),
+                                                     tr("No Webcams Connected"));
+        pEmptyMenuAction->setToolTip(tr("No supported webcams connected to the host PC"));
+        pEmptyMenuAction->setEnabled(false);
+    }
+    /* If webcam list is NOT empty: */
+    else
+    {
+        /* Populate menu with host webcams: */
+        const QVector<QString> attachedWebcamPaths = console().GetEmulatedUSB().GetWebcams();
+        foreach (const CHostVideoInputDevice &webcam, webcams)
+        {
+            /* Get webcam data: */
+            const QString strWebcamName = webcam.GetName();
+            const QString strWebcamPath = webcam.GetPath();
+
+            /* Create/configure webcam action: */
+            QAction *pAttachWebcamAction = pMenu->addAction(strWebcamName,
+                                                            this, SLOT(sltAttachWebCamDevice()));
+            pAttachWebcamAction->setToolTip(vboxGlobal().toolTip(webcam));
+            pAttachWebcamAction->setCheckable(true);
+
+            /* Check if that webcam was already attached to this session: */
+            pAttachWebcamAction->setChecked(attachedWebcamPaths.contains(strWebcamPath));
+
+            /* Set USB attach data: */
+            pAttachWebcamAction->setData(QVariant::fromValue(WebCamTarget(!pAttachWebcamAction->isChecked(), strWebcamName, strWebcamPath)));
+        }
+    }
+}
+
+void UIMachineLogic::updateMenuDevicesSharedClipboard(QMenu *pMenu)
+{
+    /* First run: */
+    if (!m_pSharedClipboardActions)
+    {
+        m_pSharedClipboardActions = new QActionGroup(this);
+        for (int i = KClipboardMode_Disabled; i < KClipboardMode_Max; ++i)
+        {
+            KClipboardMode mode = (KClipboardMode)i;
+            QAction *pAction = new QAction(gpConverter->toString(mode), m_pSharedClipboardActions);
+            pMenu->addAction(pAction);
+            pAction->setData(QVariant::fromValue(mode));
+            pAction->setCheckable(true);
+            pAction->setChecked(machine().GetClipboardMode() == mode);
+        }
+        connect(m_pSharedClipboardActions, SIGNAL(triggered(QAction*)),
+                this, SLOT(sltChangeSharedClipboardType(QAction*)));
+    }
+    /* Subsequent runs: */
+    else
+        foreach (QAction *pAction, m_pSharedClipboardActions->actions())
+            if (pAction->data().value<KClipboardMode>() == machine().GetClipboardMode())
+                pAction->setChecked(true);
+}
+
+void UIMachineLogic::updateMenuDevicesDragAndDrop(QMenu *pMenu)
+{
+    /* First run: */
+    if (!m_pDragAndDropActions)
+    {
+        m_pDragAndDropActions = new QActionGroup(this);
+        for (int i = KDnDMode_Disabled; i < KDnDMode_Max; ++i)
+        {
+            KDnDMode mode = (KDnDMode)i;
+            QAction *pAction = new QAction(gpConverter->toString(mode), m_pDragAndDropActions);
+            pMenu->addAction(pAction);
+            pAction->setData(QVariant::fromValue(mode));
+            pAction->setCheckable(true);
+            pAction->setChecked(machine().GetDnDMode() == mode);
+        }
+        connect(m_pDragAndDropActions, SIGNAL(triggered(QAction*)),
+                this, SLOT(sltChangeDragAndDropType(QAction*)));
+    }
+    /* Subsequent runs: */
+    else
+        foreach (QAction *pAction, m_pDragAndDropActions->actions())
+            if (pAction->data().value<KDnDMode>() == machine().GetDnDMode())
+                pAction->setChecked(true);
+}
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+void UIMachineLogic::updateMenuDebug(QMenu*)
+{
+    /* The "Logging" item. */
+    bool fEnabled = false;
+    bool fChecked = false;
+    if (!debugger().isNull() && debugger().isOk())
+    {
+        fEnabled = true;
+        fChecked = debugger().GetLogEnabled() != FALSE;
+    }
+    if (fEnabled != actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->isEnabled())
+        actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->setEnabled(fEnabled);
+    if (fChecked != actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->isChecked())
+        actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->setChecked(fChecked);
+}
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef Q_WS_MAC
+void UIMachineLogic::updateMenuWindow(QMenu *pMenu)
+{
+    /* Make sure 'Switch' action(s) are allowed: */
+    AssertPtrReturnVoid(actionPool());
+    if (actionPool()->isAllowedInMenuWindow(UIExtraDataMetaDefs::MenuWindowActionType_Switch))
+    {
+        /* Append menu with actions to switch to machine-window(s): */
+        foreach (UIMachineWindow *pMachineWindow, machineWindows())
+        {
+            /* Create machine-window action: */
+            AssertPtrReturnVoid(pMachineWindow);
+            QAction *pMachineWindowAction = pMenu->addAction(pMachineWindow->windowTitle(),
+                                                             this, SLOT(sltSwitchToMachineWindow()));
+            AssertPtrReturnVoid(pMachineWindowAction);
+            {
+                pMachineWindowAction->setCheckable(true);
+                pMachineWindowAction->setChecked(activeMachineWindow() == pMachineWindow);
+                pMachineWindowAction->setData((int)pMachineWindow->screenId());
+            }
+        }
+    }
+}
+#endif /* Q_WS_MAC */
+
+void UIMachineLogic::showGlobalPreferences(const QString &strCategory /* = QString() */, const QString &strControl /* = QString() */)
+{
+    /* Do not process if window(s) missed! */
+    if (!isMachineWindowsCreated())
+        return;
+
+    /* Check that we do NOT handling that already: */
+    if (actionPool()->action(UIActionIndex_M_Application_S_Preferences)->data().toBool())
+        return;
+    /* Remember that we handling that already: */
+    actionPool()->action(UIActionIndex_M_Application_S_Preferences)->setData(true);
+
+    /* Create and execute global settings window: */
+    QPointer<UISettingsDialogGlobal> pDialog = new UISettingsDialogGlobal(activeMachineWindow(),
+                                                                          strCategory, strControl);
+    pDialog->execute();
+    if (pDialog)
+        delete pDialog;
+
+    /* Remember that we do NOT handling that already: */
+    actionPool()->action(UIActionIndex_M_Application_S_Preferences)->setData(false);
+}
+
+void UIMachineLogic::askUserForTheDiskEncryptionPasswords()
+{
+    /* Prepare the map of the encrypted mediums: */
+    EncryptedMediumMap encryptedMediums;
+    foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())
+    {
+        /* Acquire hard-drive attachments only: */
+        if (attachment.GetType() == KDeviceType_HardDisk)
+        {
+            /* Get the attachment medium base: */
+            const CMedium medium = attachment.GetMedium();
+            /* Update the map with this medium if it's encrypted: */
+            QString strCipher;
+            const QString strPasswordId = medium.GetEncryptionSettings(strCipher);
+            if (medium.isOk())
+                encryptedMediums.insert(strPasswordId, medium.GetId());
+        }
+    }
+
+    /* Ask for the disk encryption passwords if necessary: */
+    EncryptionPasswordMap encryptionPasswords;
+    if (!encryptedMediums.isEmpty())
+    {
+        /* Create the dialog for acquiring encryption passwords: */
+        QWidget *pDlgParent = windowManager().realParentWindow(activeMachineWindow());
+        QPointer<UIAddDiskEncryptionPasswordDialog> pDlg =
+             new UIAddDiskEncryptionPasswordDialog(pDlgParent,
+                                                   machineName(),
+                                                   encryptedMediums);
+        /* Execute the dialog: */
+        if (pDlg->exec() == QDialog::Accepted)
+        {
+            /* Acquire the passwords provided: */
+            encryptionPasswords = pDlg->encryptionPasswords();
+
+            /* Delete the dialog: */
+            delete pDlg;
+
+            /* Make sure the passwords were really provided: */
+            AssertReturnVoid(!encryptionPasswords.isEmpty());
+
+            /* Apply the disk encryption passwords: */
+            foreach (const QString &strKey, encryptionPasswords.keys())
+            {
+                console().AddDiskEncryptionPassword(strKey, encryptionPasswords.value(strKey), false);
+                if (!console().isOk())
+                    msgCenter().cannotAddDiskEncryptionPassword(console());
+            }
+        }
+        else
+        {
+            /* Any modal dialog can be destroyed in own event-loop
+             * as a part of VM power-off procedure which closes GUI.
+             * So we have to check if the dialog still valid.. */
+
+            /* If dialog still valid: */
+            if (pDlg)
+            {
+                /* Delete the dialog: */
+                delete pDlg;
+
+                /* Propose the user to close VM: */
+                QMetaObject::invokeMethod(this, "sltClose", Qt::QueuedConnection);
+            }
+        }
+    }
 }
 
 int UIMachineLogic::searchMaxSnapshotIndex(const CMachine &machine,
@@ -2568,9 +2492,7 @@ int UIMachineLogic::searchMaxSnapshotIndex(const CMachine &machine,
 void UIMachineLogic::takeScreenshot(const QString &strFile, const QString &strFormat /* = "png" */) const
 {
     /* Get console: */
-    const CConsole &console = session().GetConsole();
-    CDisplay display = console.GetDisplay();
-    const int cGuestScreens = uisession()->session().GetMachine().GetMonitorCount();
+    const int cGuestScreens = machine().GetMonitorCount();
     QList<QImage> images;
     ULONG uMaxWidth  = 0;
     ULONG uMaxHeight = 0;
@@ -2583,11 +2505,12 @@ void UIMachineLogic::takeScreenshot(const QString &strFile, const QString &strFo
         ULONG bpp    = 0;
         LONG xOrigin = 0;
         LONG yOrigin = 0;
-        display.GetScreenResolution(i, width, height, bpp, xOrigin, yOrigin);
+        KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
+        display().GetScreenResolution(i, width, height, bpp, xOrigin, yOrigin, monitorStatus);
         uMaxWidth  += width;
         uMaxHeight  = RT_MAX(uMaxHeight, height);
         QImage shot = QImage(width, height, QImage::Format_RGB32);
-        display.TakeScreenShot(i, shot.bits(), shot.width(), shot.height());
+        display().TakeScreenShot(i, shot.bits(), shot.width(), shot.height(), KBitmapFormat_BGR0);
         images << shot;
     }
     /* Create a image which will hold all sub images vertically. */
@@ -2632,7 +2555,7 @@ bool UIMachineLogic::dbgCreated()
                 || m_pDbgGuiVT->u32EndVersion == m_pDbgGuiVT->u32Version)
             {
                 m_pDbgGuiVT->pfnSetParent(m_pDbgGui, activeMachineWindow());
-                m_pDbgGuiVT->pfnSetMenu(m_pDbgGui, gActionPool->action(UIActionIndexRuntime_Menu_Debug));
+                m_pDbgGuiVT->pfnSetMenu(m_pDbgGui, actionPool()->action(UIActionIndexRT_M_Debug));
                 dbgAdjustRelativePos();
                 return true;
             }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
index 324186c..ad7acfc 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
@@ -1,3 +1,4 @@
+/* $Id: UIMachineLogic.h $ */
 /** @file
  * VBox Qt GUI - UIMachineLogic class declaration.
  */
@@ -18,11 +19,8 @@
 #define ___UIMachineLogic_h___
 
 /* GUI includes: */
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
 #include <QIWithRetranslateUI.h>
-#ifdef VBOX_WITH_DEBUGGER_GUI
-# include <VBox/dbggui.h>
-#endif /* VBOX_WITH_DEBUGGER_GUI */
 
 /* COM includes: */
 #include "COMEnums.h"
@@ -31,6 +29,7 @@
 class QAction;
 class QActionGroup;
 class UISession;
+class UIActionPool;
 class UIKeyboardHandler;
 class UIMouseHandler;
 class UIMachineWindow;
@@ -38,18 +37,37 @@ class UIMachineView;
 class UIDockIconPreview;
 class CSession;
 class CMachine;
+class CConsole;
+class CDisplay;
+class CGuest;
+class CMouse;
+class CKeyboard;
+class CMachineDebugger;
 class CSnapshot;
 class CUSBDevice;
 class CVirtualBoxErrorInfo;
-#ifdef Q_WS_MAC
-class QMenuBar;
-#endif /* Q_WS_MAC */
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+typedef struct DBGGUIVT const *PCDBGGUIVT;
+typedef struct DBGGUI *PDBGGUI;
+#endif /* VBOX_WITH_DEBUGGER_GUI */
 
 /* Machine logic interface: */
 class UIMachineLogic : public QIWithRetranslateUI3<QObject>
 {
     Q_OBJECT;
 
+    /** Pointer to menu update-handler for this class: */
+    typedef void (UIMachineLogic::*MenuUpdateHandler)(QMenu *pMenu);
+
+signals:
+
+    /** Notifies about frame-buffer resize. */
+    void sigFrameBufferResize();
+
+    /** Notifies listeners about 3D overlay visibility change. */
+    void sigNotifyAbout3DOverlayVisibilityChange(bool fVisible);
+
 public:
 
     /* Factory functions to create/destroy required logic sub-child: */
@@ -66,9 +84,32 @@ public:
     virtual void prepare();
     virtual void cleanup();
 
+    void initializePostPowerUp();
+
     /* Main getters/setters: */
     UISession* uisession() const { return m_pSession; }
+    UIActionPool* actionPool() const;
+
+    /** Returns the session reference. */
     CSession& session() const;
+    /** Returns the session's machine reference. */
+    CMachine& machine() const;
+    /** Returns the session's console reference. */
+    CConsole& console() const;
+    /** Returns the console's display reference. */
+    CDisplay& display() const;
+    /** Returns the console's guest reference. */
+    CGuest& guest() const;
+    /** Returns the console's mouse reference. */
+    CMouse& mouse() const;
+    /** Returns the console's keyboard reference. */
+    CKeyboard& keyboard() const;
+    /** Returns the console's debugger reference. */
+    CMachineDebugger& debugger() const;
+
+    /** Returns the machine name. */
+    const QString& machineName() const;
+
     UIVisualStateType visualStateType() const { return m_visualStateType; }
     const QList<UIMachineWindow*>& machineWindows() const { return m_machineWindowsList; }
     UIKeyboardHandler* keyboardHandler() const { return m_pKeyboardHandler; }
@@ -87,7 +128,7 @@ public:
     virtual void adjustMachineWindowsGeometry();
 
     /* Wrapper to open Machine settings / Network page: */
-    void openNetworkAdaptersDialog() { sltOpenNetworkAdaptersDialog(); }
+    void openNetworkSettingsDialog() { sltOpenNetworkSettingsDialog(); }
 
 #ifdef Q_WS_MAC
     void updateDockIcon();
@@ -103,11 +144,14 @@ public:
     /* API: 3D overlay visibility stuff: */
     virtual void notifyAbout3DOverlayVisibilityChange(bool fVisible);
 
-    /** Performs HID LEDs sync. */
-    bool isHidLedsSyncEnabled() { return m_isHidLedsSyncEnabled; };
+    /** Returns whether VM should perform HID LEDs synchronization. */
+    bool isHidLedsSyncEnabled() const { return m_fIsHidLedsSyncEnabled; }
 
 protected slots:
 
+    /** Handles the VBoxSVC availability change. */
+    void sltHandleVBoxSVCAvailabilityChange();
+
     /** Checks if some visual-state type was requested. */
     virtual void sltCheckForRequestedVisualStateType() {}
 
@@ -168,27 +212,29 @@ protected:
     virtual void prepareOtherConnections() {}
     virtual void prepareHandlers();
     virtual void prepareMachineWindows() = 0;
-    virtual void prepareMenu();
+    virtual void prepareMenu() {}
 #ifdef Q_WS_MAC
     virtual void prepareDock();
 #endif /* Q_WS_MAC */
 #ifdef VBOX_WITH_DEBUGGER_GUI
     virtual void prepareDebugger();
 #endif /* VBOX_WITH_DEBUGGER_GUI */
+    virtual void loadSettings();
 
     /* Cleanup helpers: */
+    virtual void saveSettings();
 #ifdef VBOX_WITH_DEBUGGER_GUI
     virtual void cleanupDebugger();
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 #ifdef Q_WS_MAC
     virtual void cleanupDock();
 #endif /* Q_WS_MAC */
-    virtual void cleanupMenu();
+    virtual void cleanupMenu() {}
     virtual void cleanupMachineWindows() = 0;
     virtual void cleanupHandlers();
     //virtual void cleanupOtherConnections() {}
     virtual void cleanupActionConnections() {}
-    virtual void cleanupActionGroups();
+    virtual void cleanupActionGroups() {}
     //virtual void cleanupSessionConnections() {}
     //virtual void cleanupRequiredFeatures() {}
 
@@ -197,16 +243,19 @@ protected:
 
 private slots:
 
+    /** Handle menu prepare. */
+    void sltHandleMenuPrepare(int iIndex, QMenu *pMenu);
+
     /* "Machine" menu functionality: */
-    void sltToggleGuestAutoresize(bool fEnabled);
-    void sltAdjustWindow();
-    void sltToggleMouseIntegration(bool fDisabled);
+    void sltShowKeyboardSettings();
+    void sltToggleMouseIntegration(bool fEnabled);
     void sltTypeCAD();
 #ifdef Q_WS_X11
     void sltTypeCABS();
 #endif /* Q_WS_X11 */
+    void sltTypeCtrlBreak();
+    void sltTypeInsert();
     void sltTakeSnapshot();
-    void sltTakeScreenshot();
     void sltShowInformationDialog();
     void sltReset();
     void sltPause(bool fOn);
@@ -215,31 +264,30 @@ private slots:
     void sltPowerOff();
     void sltClose();
 
+    /* "View" menu functionality: */
+    void sltToggleGuestAutoresize(bool fEnabled);
+    void sltAdjustWindow();
+    void sltTakeScreenshot();
+    void sltOpenVideoCaptureOptions();
+    void sltToggleVideoCapture(bool fEnabled);
+    void sltToggleVRDE(bool fEnabled);
+
     /* "Device" menu functionality: */
     void sltOpenVMSettingsDialog(const QString &strCategory = QString(), const QString &strControl = QString());
-    void sltOpenNetworkAdaptersDialog();
-    void sltOpenSharedFoldersDialog();
-    void sltPrepareStorageMenu();
+    void sltOpenStorageSettingsDialog();
+    void sltOpenNetworkSettingsDialog();
+    void sltOpenUSBDevicesSettingsDialog();
+    void sltOpenSharedFoldersSettingsDialog();
     void sltMountStorageMedium();
-    void sltMountRecentStorageMedium();
-    void sltPrepareUSBMenu();
-    void sltPrepareWebCamMenu();
     void sltAttachUSBDevice();
     void sltAttachWebCamDevice();
-    void sltPrepareSharedClipboardMenu();
     void sltChangeSharedClipboardType(QAction *pAction);
-    void sltPrepareDragAndDropMenu();
-    void sltPrepareNetworkMenu();
     void sltToggleNetworkAdapterConnection();
     void sltChangeDragAndDropType(QAction *pAction);
-    void sltToggleVRDE(bool fEnabled);
-    void sltToggleVideoCapture(bool fEnabled);
-    void sltOpenVideoCaptureOptions();
     void sltInstallGuestAdditions();
 
 #ifdef VBOX_WITH_DEBUGGER_GUI
     /* "Debug" menu functionality: */
-    void sltPrepareDebugMenu();
     void sltShowDebugStatistics();
     void sltShowDebugCommandLine();
     void sltLoggingToggled(bool);
@@ -247,6 +295,11 @@ private slots:
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
 #ifdef RT_OS_DARWIN /* Something is *really* broken in regards of the moc here */
+    /* "Window" menu functionality: */
+    void sltMinimizeActiveMachineWindow();
+    void sltSwitchToMachineWindow();
+
+    /* "Dock" menu functionality: */
     void sltDockPreviewModeChanged(QAction *pAction);
     void sltDockPreviewMonitorChanged(QAction *pAction);
     void sltChangeDockIconUpdate(bool fEnabled);
@@ -257,8 +310,38 @@ private slots:
     void sltSwitchKeyboardLedsToGuestLeds();
     void sltSwitchKeyboardLedsToPreviousLeds();
 
+    /** Show Global Preferences. */
+    void sltShowGlobalPreferences();
+
 private:
 
+    /** Update 'Devices' : 'Optical/Floppy Devices' menu routine. */
+    void updateMenuDevicesStorage(QMenu *pMenu);
+    /** Update 'Devices' : 'Network' menu routine. */
+    void updateMenuDevicesNetwork(QMenu *pMenu);
+    /** Update 'Devices' : 'USB Devices' menu routine. */
+    void updateMenuDevicesUSB(QMenu *pMenu);
+    /** Update 'Devices' : 'Web Cams' menu routine. */
+    void updateMenuDevicesWebCams(QMenu *pMenu);
+    /** Update 'Devices' : 'Shared Clipboard' menu routine. */
+    void updateMenuDevicesSharedClipboard(QMenu *pMenu);
+    /** Update 'Devices' : 'Drag and Drop' menu routine. */
+    void updateMenuDevicesDragAndDrop(QMenu *pMenu);
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** Update 'Debug' menu routine. */
+    void updateMenuDebug(QMenu *pMenu);
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+    /** Update 'Window' menu routine. */
+    void updateMenuWindow(QMenu *pMenu);
+#endif /* Q_WS_MAC */
+
+    /** Show Global Preferences on the page defined by @a strCategory and tab defined by @a strControl. */
+    void showGlobalPreferences(const QString &strCategory = QString(), const QString &strControl = QString());
+
+    /** Asks user for the disks encryption passwords. */
+    void askUserForTheDiskEncryptionPasswords();
+
     /* Helpers: */
     static int searchMaxSnapshotIndex(const CMachine &machine, const CSnapshot &snapshot, const QString &strNameTemplate);
     void takeScreenshot(const QString &strFile, const QString &strFormat /* = "png" */) const;
@@ -276,6 +359,9 @@ private:
     QActionGroup *m_pSharedClipboardActions;
     QActionGroup *m_pDragAndDropActions;
 
+    /** Holds the map of menu update-handlers. */
+    QMap<int, MenuUpdateHandler> m_menuUpdateHandlers;
+
     bool m_fIsWindowsCreated : 1;
 
     /** Holds whether VM is in 'manual-override' mode
@@ -295,7 +381,6 @@ private:
 #endif /* VBOX_WITH_DEBUGGER_GUI */
 
 #ifdef Q_WS_MAC
-    QMenuBar *m_pMenuBar;
     bool m_fIsDockIconEnabled;
     UIDockIconPreview *m_pDockIconPreview;
     QActionGroup *m_pDockPreviewSelectMonitorGroup;
@@ -303,7 +388,9 @@ private:
 #endif /* Q_WS_MAC */
 
     void *m_pHostLedsState;
-    bool m_isHidLedsSyncEnabled;
+
+    /** Holds whether VM should perform HID LEDs synchronization. */
+    bool m_fIsHidLedsSyncEnabled;
 
     /* Friend classes: */
     friend class UIMachineWindow;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
deleted file mode 100644
index e3603ae..0000000
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
+++ /dev/null
@@ -1,634 +0,0 @@
-/* $Id: UIMachineMenuBar.cpp $ */
-/** @file
- * VBox Qt GUI - UIMachineMenuBar class implementation.
- */
-
-/*
- * Copyright (C) 2010-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-/* Qt includes: */
-#include <QMenuBar>
-#include <QPainter>
-#include <QPaintEvent>
-#include <QPixmapCache>
-
-/* GUI includes: */
-#include "UIMachineMenuBar.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIImageTools.h"
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include "UINetworkManager.h"
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
-/* COM includes: */
-#include "CMachine.h"
-
-
-/**
- * QMenu sub-class with extended functionality.
- * Allows to highlight first menu item for popped up menu.
- */
-class QIMenu : public QMenu
-{
-    Q_OBJECT;
-
-public:
-
-    /** Constructor. */
-    QIMenu() : QMenu(0) {}
-
-private slots:
-
-    /** Highlights first menu action for popped up menu. */
-    void sltHighlightFirstAction()
-    {
-#ifdef Q_WS_WIN
-        activateWindow();
-#endif /* Q_WS_WIN */
-        QMenu::focusNextChild();
-    }
-};
-
-
-/**
- * QMenuBar sub-class with extended functionality.
- * Reflects BETA label when necessary.
- */
-class UIMenuBar: public QMenuBar
-{
-    Q_OBJECT;
-
-public:
-
-    /** Constructor. */
-    UIMenuBar(QWidget *pParent = 0)
-        : QMenuBar(pParent)
-        , m_fShowBetaLabel(false)
-    {
-        /* Check for beta versions: */
-        if (vboxGlobal().isBeta())
-            m_fShowBetaLabel = true;
-    }
-
-protected:
-
-    /** Paint-event reimplementation. */
-    void paintEvent(QPaintEvent *pEvent)
-    {
-        QMenuBar::paintEvent(pEvent);
-        if (m_fShowBetaLabel)
-        {
-            QPixmap betaLabel;
-            const QString key("vbox:betaLabel");
-            if (!QPixmapCache::find(key, betaLabel))
-            {
-                betaLabel = ::betaLabel();
-                QPixmapCache::insert(key, betaLabel);
-            }
-            QSize s = size();
-            QPainter painter(this);
-            painter.setClipRect(pEvent->rect());
-            painter.drawPixmap(s.width() - betaLabel.width() - 10, (height() - betaLabel.height()) / 2, betaLabel);
-        }
-    }
-
-private:
-
-    /** Reflects whether we should show BETA label or not. */
-    bool m_fShowBetaLabel;
-};
-
-
-UIMachineMenuBar::UIMachineMenuBar(UISession *pSession)
-    : m_pSession(pSession)
-{
-}
-
-QMenu* UIMachineMenuBar::createMenu(RuntimeMenuType fOptions /* = RuntimeMenuType_All */)
-{
-    /* Create empty menu: */
-    QMenu *pMenu = new QIMenu;
-
-    /* Fill menu with prepared items: */
-    foreach (QMenu *pSubMenu, prepareSubMenus(fOptions))
-        pMenu->addMenu(pSubMenu);
-
-    /* Return filled menu: */
-    return pMenu;
-}
-
-QMenuBar* UIMachineMenuBar::createMenuBar(RuntimeMenuType fOptions /* = RuntimeMenuType_All */)
-{
-    /* Create empty menubar: */
-    QMenuBar *pMenuBar = new UIMenuBar;
-
-    /* Fill menubar with prepared items: */
-    foreach (QMenu *pSubMenu, prepareSubMenus(fOptions))
-        pMenuBar->addMenu(pSubMenu);
-
-    /* Return filled menubar: */
-    return pMenuBar;
-}
-
-QList<QMenu*> UIMachineMenuBar::prepareSubMenus(RuntimeMenuType fOptions /* = RuntimeMenuType_All */)
-{
-    /* Create empty submenu list: */
-    QList<QMenu*> preparedSubMenus;
-
-    /* Machine submenu: */
-    if (fOptions & RuntimeMenuType_Machine)
-    {
-        QMenu *pMenuMachine = gActionPool->action(UIActionIndexRuntime_Menu_Machine)->menu();
-        prepareMenuMachine(pMenuMachine);
-        preparedSubMenus << pMenuMachine;
-    }
-
-    /* View submenu: */
-    if (fOptions & RuntimeMenuType_View)
-    {
-        QMenu *pMenuView = gActionPool->action(UIActionIndexRuntime_Menu_View)->menu();
-        prepareMenuView(pMenuView);
-        preparedSubMenus << pMenuView;
-    }
-
-    /* Devices submenu: */
-    if (fOptions & RuntimeMenuType_Devices)
-    {
-        QMenu *pMenuDevices = gActionPool->action(UIActionIndexRuntime_Menu_Devices)->menu();
-        prepareMenuDevices(pMenuDevices);
-        preparedSubMenus << pMenuDevices;
-    }
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    /* Debug submenu: */
-    if (fOptions & RuntimeMenuType_Debug)
-    {
-        CMachine machine = m_pSession->session().GetMachine();
-        if (vboxGlobal().isDebuggerEnabled(machine))
-        {
-            QMenu *pMenuDebug = gActionPool->action(UIActionIndexRuntime_Menu_Debug)->menu();
-            prepareMenuDebug(pMenuDebug);
-            preparedSubMenus << pMenuDebug;
-        }
-    }
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-
-    /* Help submenu: */
-    if (fOptions & RuntimeMenuType_Help)
-    {
-        QMenu *pMenuHelp = gActionPool->action(UIActionIndex_Menu_Help)->menu();
-        prepareMenuHelp(pMenuHelp);
-        preparedSubMenus << pMenuHelp;
-    }
-
-    /* Return a list of prepared submenus: */
-    return preparedSubMenus;
-}
-
-void UIMachineMenuBar::prepareMenuMachine(QMenu *pMenu)
-{
-    /* Do not prepare if ready: */
-    if (!pMenu->isEmpty())
-        return;
-
-
-    /* Separator #1? */
-    bool fSeparator1 = false;
-
-    /* Settings Dialog action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_SettingsDialog)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog)->setEnabled(false);
-    /* Take Snapshot action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TakeSnapshot &&
-        m_pSession->isSnapshotOperationsAllowed())
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_TakeSnapshot)->setEnabled(false);
-    /* Take Screenshot action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TakeScreenshot)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_TakeScreenshot)->setEnabled(false);
-    /* Information Dialog action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_InformationDialog)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_InformationDialog)->setEnabled(false);
-
-    /* Separator #1: */
-    if (fSeparator1)
-        pMenu->addSeparator();
-
-
-    /* Separator #2? */
-    bool fSeparator2 = false;
-
-    /* Mouse Integration action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_MouseIntegration)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
-        fSeparator2 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration)->setEnabled(false);
-
-    /* Separator #2: */
-    if (fSeparator2)
-        pMenu->addSeparator();
-
-
-    /* Separator #3? */
-    bool fSeparator3 = false;
-
-    /* Type CAD action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TypeCAD)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD));
-        fSeparator3 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_TypeCAD)->setEnabled(false);
-#ifdef Q_WS_X11
-    /* Type CABS action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_TypeCABS)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS));
-        fSeparator3 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_TypeCABS)->setEnabled(false);
-#endif /* Q_WS_X11 */
-
-    /* Separator #3: */
-    if (fSeparator3)
-        pMenu->addSeparator();
-
-
-    /* Separator #4? */
-    bool fSeparator4 = false;
-
-    /* Pause action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Pause)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Pause));
-        fSeparator4 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Toggle_Pause)->setEnabled(false);
-    /* Reset action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Reset)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Reset));
-        fSeparator4 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_Reset)->setEnabled(false);
-    /* SaveState action: */
-    if (!(m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_SaveState))
-        gActionPool->action(UIActionIndexRuntime_Simple_SaveState)->setEnabled(false);
-    /* Shutdown action: */
-    if (m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_Shutdown)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Shutdown));
-        fSeparator4 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_Shutdown)->setEnabled(false);
-    /* PowerOff action: */
-    if (!(m_pSession->allowedActionsMenuMachine() & RuntimeMenuMachineActionType_PowerOff))
-        gActionPool->action(UIActionIndexRuntime_Simple_PowerOff)->setEnabled(false);
-
-#ifndef Q_WS_MAC
-    /* Separator #3: */
-    if (fSeparator4)
-        pMenu->addSeparator();
-#endif /* !Q_WS_MAC */
-
-
-    /* Close action: */
-    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Close));
-    if (m_pSession->isAllCloseActionsRestricted())
-        gActionPool->action(UIActionIndexRuntime_Simple_Close)->setEnabled(false);
-}
-
-void UIMachineMenuBar::prepareMenuView(QMenu *pMenu)
-{
-    /* Do not prepare if ready: */
-    if (!pMenu->isEmpty())
-        return;
-
-
-    /* Mode flags: */
-    bool fIsAllowedFullscreen = m_pSession->isVisualStateAllowedFullscreen() &&
-                                (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Fullscreen);
-    bool fIsAllowedSeamless = m_pSession->isVisualStateAllowedSeamless() &&
-                              (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Seamless);
-    bool fIsAllowedScale = m_pSession->isVisualStateAllowedScale() &&
-                           (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_Scale);
-
-    /* Fullscreen action: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen)->setEnabled(fIsAllowedFullscreen);
-    if (fIsAllowedFullscreen)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen));
-
-    /* Seamless action: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->setEnabled(fIsAllowedSeamless);
-    if (fIsAllowedSeamless)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless));
-
-    /* Scale action: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_Scale)->setEnabled(fIsAllowedScale);
-    if (fIsAllowedScale)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Scale));
-
-    /* Mode separator: */
-    if (fIsAllowedFullscreen || fIsAllowedSeamless || fIsAllowedScale)
-        pMenu->addSeparator();
-
-
-    /* Guest Autoresize action: */
-    if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_GuestAutoresize)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize));
-    else
-        gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setEnabled(false);
-
-    /* Adjust Window action: */
-    if (m_pSession->allowedActionsMenuView() & RuntimeMenuViewActionType_AdjustWindow)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow));
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setEnabled(false);
-}
-
-void UIMachineMenuBar::prepareMenuDevices(QMenu *pMenu)
-{
-    /* Do not prepare if ready: */
-    if (!pMenu->isEmpty())
-        return;
-
-
-    /* Separator #1? */
-    bool fSeparator1 = false;
-
-    /* Optical Devices submenu: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_OpticalDevices)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->setEnabled(false);
-    /* Floppy Devices submenu: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_FloppyDevices)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices)->setEnabled(false);
-    /* USB Devices submenu: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_USBDevices)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_USBDevices));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->setEnabled(false);
-    /* Web Cams submenu: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_WebCams)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_WebCams));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->setEnabled(false);
-    /* Shared Clipboard submenu: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_SharedClipboard)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Menu_SharedClipboard)->setEnabled(false);
-    /* Drag&Drop submenu: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_DragAndDrop)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Menu_DragAndDrop)->setEnabled(false);
-    /* Network submenu: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_NetworkSettings)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Menu_Network));
-        gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu()->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings));
-        fSeparator1 = true;
-    }
-    else
-    {
-        gActionPool->action(UIActionIndexRuntime_Menu_Network)->setEnabled(false);
-        gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings)->setEnabled(false);
-    }
-    /* Shared Folders Settings action: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_SharedFoldersSettings)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings)->setEnabled(false);
-
-    /* Separator #1: */
-    if (fSeparator1)
-        pMenu->addSeparator();
-
-
-    /* Separator #2? */
-    bool fSeparator2 = false;
-
-    /* VRDE Server action: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_VRDEServer)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer));
-        if (!m_pSession->isExtensionPackUsable())
-            gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer)->setEnabled(false);
-        fSeparator2 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer)->setEnabled(false);
-    /* Video Capture action: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_VideoCapture)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
-        fSeparator2 = true;
-    }
-    else
-        gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture)->setEnabled(false);
-
-    /* Separator #2: */
-    if (fSeparator2)
-        pMenu->addSeparator();
-
-
-    /* Install Guest Tools action: */
-    if (m_pSession->allowedActionsMenuDevices() & RuntimeMenuDevicesActionType_InstallGuestTools)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools));
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools)->setEnabled(false);
-}
-
-#ifdef VBOX_WITH_DEBUGGER_GUI
-void UIMachineMenuBar::prepareMenuDebug(QMenu *pMenu)
-{
-    /* Do not prepare if ready: */
-    if (!pMenu->isEmpty())
-        return;
-
-    /* Statistics action: */
-    if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_Statistics)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_Statistics));
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_Statistics)->setEnabled(false);
-    /* Command Line action: */
-    if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_CommandLine)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_CommandLine));
-    else
-        gActionPool->action(UIActionIndexRuntime_Simple_CommandLine)->setEnabled(false);
-    /* Logging action: */
-    if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_Logging)
-        pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_Logging));
-    else
-        gActionPool->action(UIActionIndexRuntime_Toggle_Logging)->setEnabled(false);
-    /* Log Dialog action: */
-    if (m_pSession->allowedActionsMenuDebugger() & RuntimeMenuDebuggerActionType_LogDialog)
-        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_LogDialog));
-    else
-        gActionPool->action(UIActionIndex_Simple_LogDialog)->setEnabled(false);
-}
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-
-void UIMachineMenuBar::prepareMenuHelp(QMenu *pMenu)
-{
-    /* Do not prepare if ready: */
-    if (!pMenu->isEmpty())
-        return;
-
-
-    /* Separator #1? */
-    bool fSeparator1 = false;
-
-    /* Contents action: */
-    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_Contents)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_Contents));
-        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_Contents), SIGNAL(triggered()),
-                            &msgCenter(), SLOT(sltShowHelpHelpDialog()));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(UIActionIndex_Simple_Contents)->setEnabled(false);
-    /* Web Site action: */
-    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_WebSite)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_WebSite));
-        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_WebSite), SIGNAL(triggered()),
-                            &msgCenter(), SLOT(sltShowHelpWebDialog()));
-        fSeparator1 = true;
-    }
-    else
-        gActionPool->action(RuntimeMenuHelpActionType_WebSite)->setEnabled(false);
-
-    /* Separator #1: */
-    if (fSeparator1)
-        pMenu->addSeparator();
-
-
-    /* Separator #2? */
-    bool fSeparator2 = false;
-
-    /* Reset Warnings action: */
-    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_ResetWarnings)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_ResetWarnings));
-        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_ResetWarnings), SIGNAL(triggered()),
-                            &msgCenter(), SLOT(sltResetSuppressedMessages()));
-        fSeparator2 = true;
-    }
-    else
-        gActionPool->action(UIActionIndex_Simple_ResetWarnings)->setEnabled(false);
-
-    /* Separator #2: */
-    if (fSeparator2)
-        pMenu->addSeparator();
-
-
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# ifndef Q_WS_MAC
-    /* Separator #3? */
-    bool fSeparator3 = false;
-# endif /* !Q_WS_MAC */
-
-    /* Reset Warnings action: */
-    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_NetworkAccessManager)
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager));
-        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_NetworkAccessManager), SIGNAL(triggered()),
-                            gNetworkManager, SLOT(show()));
-# ifndef Q_WS_MAC
-        fSeparator3 = true;
-# endif /* !Q_WS_MAC */
-    }
-    else
-        gActionPool->action(UIActionIndex_Simple_NetworkAccessManager)->setEnabled(false);
-
-# ifndef Q_WS_MAC
-    /* Separator #3: */
-    if (fSeparator3)
-        pMenu->addSeparator();
-# endif /* !Q_WS_MAC */
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
-
-    /* About action: */
-#ifdef Q_WS_MAC
-    if (m_pSession->allowedActionsMenuApplication() & RuntimeMenuApplicationActionType_About)
-#else /* !Q_WS_MAC */
-    if (m_pSession->allowedActionsMenuHelp() & RuntimeMenuHelpActionType_About)
-#endif /* Q_WS_MAC */
-    {
-        pMenu->addAction(gActionPool->action(UIActionIndex_Simple_About));
-        VBoxGlobal::connect(gActionPool->action(UIActionIndex_Simple_About), SIGNAL(triggered()),
-                            &msgCenter(), SLOT(sltShowHelpAboutDialog()));
-    }
-    else
-        gActionPool->action(UIActionIndex_Simple_About)->setEnabled(false);
-}
-
-#include "UIMachineMenuBar.moc"
-
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h
deleted file mode 100644
index f3e671b..0000000
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/** @file
- * VBox Qt GUI - UIMachineMenuBar class declaration.
- */
-
-/*
- * Copyright (C) 2010-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef ___UIMachineMenuBar_h___
-#define ___UIMachineMenuBar_h___
-
-/* Qt includes: */
-#include <QList>
-
-/* GUI includes: */
-#include "UIDefs.h"
-
-/* Forward declarations: */
-class QMenu;
-class QMenuBar;
-class UISession;
-
-/**
- * Menubar factory for virtual machine (Runtime UI).
- * Provides client with the new menu/menubar whenever it necessary.
- */
-class UIMachineMenuBar
-{
-public:
-
-    /** Constructor. Stores UI session pointer for further needs. */
-    UIMachineMenuBar(UISession *pSession);
-
-    /** Provides client with new menu. */
-    QMenu* createMenu(RuntimeMenuType fOptions = RuntimeMenuType_All);
-    /** Provides client with new menubar. */
-    QMenuBar* createMenuBar(RuntimeMenuType fOptions = RuntimeMenuType_All);
-
-private:
-
-    /** Populates all the sub-menus client need. */
-    QList<QMenu*> prepareSubMenus(RuntimeMenuType fOptions = RuntimeMenuType_All);
-    /** Populates <b>Machine</b> sub-menu. */
-    void prepareMenuMachine(QMenu *pMenu);
-    /** Populates <b>View</b> sub-menu. */
-    void prepareMenuView(QMenu *pMenu);
-    /** Populates <b>Devices</b> sub-menu. */
-    void prepareMenuDevices(QMenu *pMenu);
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    /** Populates <b>Debug</b> sub-menu. */
-    void prepareMenuDebug(QMenu *pMenu);
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-    /** Populates <b>Help</b> sub-menu. */
-    void prepareMenuHelp(QMenu *pMenu);
-
-    /** Contains pointer to parent UI session. */
-    UISession *m_pSession;
-};
-
-#endif /* !___UIMachineMenuBar_h___ */
-
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
index bc488c1..6d49429 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMachineView.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineView class implementation
+ * VBox Qt GUI - UIMachineView class implementation.
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,54 +15,67 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QMainWindow>
-#include <QTimer>
-#include <QPainter>
-#include <QScrollBar>
-#include <QMainWindow>
-#include <VBox/VBoxVideo.h>
-#include <iprt/asm.h>
-#ifdef Q_WS_X11
-# include <QX11Info>
-#endif /* Q_WS_X11 */
+# include <QDesktopWidget>
+# include <QMainWindow>
+# include <QTimer>
+# include <QPainter>
+# include <QScrollBar>
+# include <QMainWindow>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIFrameBuffer.h"
-#include "UIFrameBufferQImage.h"
-#ifdef VBOX_GUI_USE_QUARTZ2D
-# include "UIFrameBufferQuartz2D.h"
-#endif /* VBOX_GUI_USE_QUARTZ2D */
-#include "VBoxFBOverlay.h"
-#include "UISession.h"
-#include "UIKeyboardHandler.h"
-#include "UIMouseHandler.h"
-#include "UIMachineLogic.h"
-#include "UIMachineWindow.h"
-#include "UIMachineViewNormal.h"
-#include "UIMachineViewFullscreen.h"
-#include "UIMachineViewSeamless.h"
-#include "UIMachineViewScale.h"
-
-#ifdef VBOX_WITH_DRAG_AND_DROP
-# include "UIDnDHandler.h"
-#endif /* VBOX_WITH_DRAG_AND_DROP */
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIFrameBuffer.h"
+# include "VBoxFBOverlay.h"
+# include "UISession.h"
+# include "UIKeyboardHandler.h"
+# include "UIMouseHandler.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindow.h"
+# include "UIMachineViewNormal.h"
+# include "UIMachineViewFullscreen.h"
+# include "UIMachineViewSeamless.h"
+# include "UIMachineViewScale.h"
+# include "UIExtraDataManager.h"
+# ifdef VBOX_WITH_DRAG_AND_DROP
+#  include "UIDnDHandler.h"
+# endif /* VBOX_WITH_DRAG_AND_DROP */
+
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
 
 /* COM includes: */
-#include "CSession.h"
-#include "CConsole.h"
-#include "CDisplay.h"
-#include "CFramebuffer.h"
-#ifdef VBOX_WITH_DRAG_AND_DROP
-# include "CGuest.h"
-#endif /* VBOX_WITH_DRAG_AND_DROP */
+# include "CSession.h"
+# include "CConsole.h"
+# include "CDisplay.h"
+# include "CFramebuffer.h"
+# ifdef VBOX_WITH_DRAG_AND_DROP
+#  include "CDnDSource.h"
+#  include "CDnDTarget.h"
+#  include "CGuest.h"
+#  include "CGuestDnDSource.h"
+#  include "CGuestDnDTarget.h"
+# endif /* VBOX_WITH_DRAG_AND_DROP */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Other VBox includes: */
+#include <iprt/asm.h>
+#include <VBox/VBoxOGL.h>
+#include <VBox/VBoxVideo.h>
+
 #ifdef Q_WS_X11
 # include <X11/XKBlib.h>
+# include <QX11Info>
 # ifdef KeyPress
 const int XFocusOut = FocusOut;
 const int XFocusIn = FocusIn;
@@ -85,27 +96,11 @@ const int XKeyRelease = KeyRelease;
 # include <Carbon/Carbon.h>
 #endif /* Q_WS_MAC */
 
-class UIViewport: public QWidget
-{
-public:
-
-    UIViewport(QWidget *pParent = 0) : QWidget(pParent)
-    {
-        /* No need for background drawing: */
-        setAttribute(Qt::WA_OpaquePaintEvent);
-        /* Enable multi-touch support: */
-        setAttribute(Qt::WA_AcceptTouchEvents);
-    }
+/* Other includes: */
+#include <math.h>
 
-    QPaintEngine *paintEngine() const
-    {
-        if (testAttribute(Qt::WA_PaintOnScreen))
-            return NULL;
-        else
-            return QWidget::paintEngine();
-    }
-};
 
+/* static */
 UIMachineView* UIMachineView::create(  UIMachineWindow *pMachineWindow
                                      , ulong uScreenId
                                      , UIVisualStateType visualStateType
@@ -168,9 +163,9 @@ UIMachineView* UIMachineView::create(  UIMachineWindow *pMachineWindow
     /* Initialization: */
     pMachineView->sltMachineStateChanged();
     /** @todo Can we move the call to sltAdditionsStateChanged() from the
-     * subclass constructors here too?  It is called for Normal and Seamless,
-     * but not for Fullscreen and Scale.  However for Scale it is a no op.,
-     * so it would not hurt.  Would it hurt for Fullscreen? */
+     *        subclass constructors here too?  It is called for Normal and Seamless,
+     *        but not for Fullscreen and Scale.  However for Scale it is a no op.,
+     *        so it would not hurt.  Would it hurt for fullscreen? */
 
     /* Set a preliminary maximum size: */
     pMachineView->setMaxGuestSize();
@@ -178,11 +173,42 @@ UIMachineView* UIMachineView::create(  UIMachineWindow *pMachineWindow
     return pMachineView;
 }
 
+/* static */
 void UIMachineView::destroy(UIMachineView *pMachineView)
 {
+    if (!pMachineView)
+        return;
+
+#ifdef VBOX_WITH_DRAG_AND_DROP
+    if (pMachineView->m_pDnDHandler)
+        delete pMachineView->m_pDnDHandler;
+#endif
     delete pMachineView;
 }
 
+void UIMachineView::applyMachineViewScaleFactor()
+{
+    /* Take the scale-factor related attributes into account: */
+    const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
+    const bool fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid());
+    frameBuffer()->setScaleFactor(dScaleFactor);
+    frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);
+    /* Propagate the scale-factor related attributes to 3D service if necessary: */
+    if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
+    {
+        display().NotifyScaleFactorChange(m_uScreenId,
+                                          (uint32_t)(dScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+                                          (uint32_t)(dScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
+        display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
+    }
+
+    /* Perform frame-buffer rescaling: */
+    frameBuffer()->performRescale();
+
+    // TODO: How to make it work?
+    display().ViewportChanged(screenId(), contentsX(), contentsY(), visibleWidth(), visibleHeight());
+}
+
 double UIMachineView::aspectRatio() const
 {
     return frameBuffer() ? (double)(frameBuffer()->width()) / frameBuffer()->height() : 0;
@@ -190,35 +216,35 @@ double UIMachineView::aspectRatio() const
 
 void UIMachineView::sltPerformGuestResize(const QSize &toSize)
 {
-    /* Get the current machine: */
-    CMachine machine = session().GetMachine();
-
     /* If this slot is invoked directly then use the passed size otherwise get
      * the available size for the guest display. We assume here that centralWidget()
      * contains this view only and gives it all available space: */
-    QSize newSize(toSize.isValid() ? toSize : machineWindow()->centralWidget()->size());
-    AssertMsg(newSize.isValid(), ("Size should be valid!\n"));
+    QSize size(toSize.isValid() ? toSize : machineWindow()->centralWidget()->size());
+    AssertMsg(size.isValid(), ("Size should be valid!\n"));
+
+    /* Take the scale-factor(s) into account: */
+    size = scaledBackward(size);
 
     /* Expand current limitations: */
-    setMaxGuestSize(newSize);
+    setMaxGuestSize(size);
 
     /* Send new size-hint to the guest: */
-    LogRel(("UIMachineView::sltPerformGuestResize: "
+    LogRel(("GUI: UIMachineView::sltPerformGuestResize: "
             "Sending guest size-hint to screen %d as %dx%d\n",
-            (int)screenId(), newSize.width(), newSize.height()));
-    session().GetConsole().GetDisplay().SetVideoModeHint(screenId(),
-                                                         uisession()->isScreenVisible(screenId()),
-                                                         false, 0, 0, newSize.width(), newSize.height(), 0);
-    /* And track whether we have had a "normal" resize since the last
-     * fullscreen resize hint was sent: */
-    QString strKey = makeExtraDataKeyPerMonitor(GUI_LastGuestSizeHintWasFullscreen);
-    machine.SetExtraData(strKey, isFullscreenOrSeamless() ? "true" : "");
+            (int)screenId(), size.width(), size.height()));
+    display().SetVideoModeHint(screenId(),
+                               uisession()->isScreenVisible(screenId()),
+                               false, 0, 0, size.width(), size.height(), 0);
+
+    /* And track whether we have a "normal" or "fullscreen"/"seamless" size-hint sent: */
+    gEDataManager->markLastGuestSizeHintAsFullScreen(m_uScreenId, isFullscreenOrSeamless(), vboxGlobal().managedVMUuid());
 }
 
-void UIMachineView::sltHandleRequestResize(int iPixelFormat, uchar *pVRAM,
-                                           int iBitsPerPixel, int iBytesPerLine,
-                                           int iWidth, int iHeight)
+void UIMachineView::sltHandleNotifyChange(int iWidth, int iHeight)
 {
+    LogRel(("GUI: UIMachineView::sltHandleNotifyChange: Screen=%d, Size=%dx%d\n",
+            (unsigned long)m_uScreenId, iWidth, iHeight));
+
     // TODO: Move to appropriate place!
     /* Some situations require frame-buffer resize-events to be ignored at all,
      * leaving machine-window, machine-view and frame-buffer sizes preserved: */
@@ -228,71 +254,114 @@ void UIMachineView::sltHandleRequestResize(int iPixelFormat, uchar *pVRAM,
     /* If machine-window is visible: */
     if (uisession()->isScreenVisible(m_uScreenId))
     {
-        // TODO: Move to appropriate place!
-        /* Adjust 'scale' mode for current machine-view size: */
-        if (visualStateType() == UIVisualStateType_Scale)
-            frameBuffer()->setScaledSize(size());
-
-        /* Is there a proposal for frame-buffer resize? */
-        bool fResizeProposed = (ulong)iWidth != frameBuffer()->width() ||
-                               (ulong)iHeight != frameBuffer()->height();
+        /* Get old frame-buffer size: */
+        const QSize frameBufferSizeOld = QSize(frameBuffer()->width(),
+                                               frameBuffer()->height());
 
         /* Perform frame-buffer mode-change: */
-        UIResizeEvent resizeEvent(iPixelFormat, pVRAM, iBitsPerPixel, iBytesPerLine, iWidth, iHeight);
-        frameBuffer()->resizeEvent(&resizeEvent);
+        frameBuffer()->handleNotifyChange(iWidth, iHeight);
+
+        /* Get new frame-buffer size: */
+        const QSize frameBufferSizeNew = QSize(frameBuffer()->width(),
+                                               frameBuffer()->height());
 
-        /* Was framebuffer actually resized? */
-        if (fResizeProposed)
+        /* For 'scale' mode: */
+        if (visualStateType() == UIVisualStateType_Scale)
         {
-            /* Scale-mode doesn't need this.. */
-            if (visualStateType() != UIVisualStateType_Scale)
-            {
-                /* Adjust maximum-size restriction for machine-view: */
-                setMaximumSize(sizeHint());
+            /* Assign new frame-buffer logical-size: */
+            frameBuffer()->setScaledSize(size());
+        }
+        /* For other than 'scale' mode: */
+        else
+        {
+            /* Adjust maximum-size restriction for machine-view: */
+            setMaximumSize(sizeHint());
 
-                /* Disable the resize hint override hack: */
-                m_sizeHintOverride = QSize(-1, -1);
+            /* Disable the resize hint override hack: */
+            m_sizeHintOverride = QSize(-1, -1);
 
-                /* Force machine-window update own layout: */
-                QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
+            /* Force machine-window update own layout: */
+            QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
 
-                /* Update machine-view sliders: */
-                updateSliders();
+            /* Update machine-view sliders: */
+            updateSliders();
 
-                /* By some reason Win host forgets to update machine-window central-widget
-                 * after main-layout was updated, let's do it for all the hosts: */
-                machineWindow()->centralWidget()->update();
+            /* By some reason Win host forgets to update machine-window central-widget
+             * after main-layout was updated, let's do it for all the hosts: */
+            machineWindow()->centralWidget()->update();
 
-                /* Normalize machine-window geometry: */
-                if (visualStateType() == UIVisualStateType_Normal)
-                    machineWindow()->normalizeGeometry(true /* adjust position */);
-            }
+            /* Normalize 'normal' machine-window geometry if necessary: */
+            if (visualStateType() == UIVisualStateType_Normal &&
+                frameBufferSizeNew != frameBufferSizeOld)
+                machineWindow()->normalizeGeometry(true /* adjust position */);
+        }
+
+        /* Perform frame-buffer rescaling: */
+        frameBuffer()->performRescale();
 
 #ifdef Q_WS_MAC
-            /* Update MacOS X dock icon size: */
-            machineLogic()->updateDockIconSize(screenId(), iWidth, iHeight);
+        /* Update MacOS X dock icon size: */
+        machineLogic()->updateDockIconSize(screenId(), iWidth, iHeight);
 #endif /* Q_WS_MAC */
-        }
     }
 
-    /* Report to the VM thread that we finished resizing: */
-    session().GetConsole().GetDisplay().ResizeCompleted(screenId());
+    /* Notify frame-buffer resize: */
+    emit sigFrameBufferResize();
 
-    /* Emit a signal about guest was resized: */
-    emit resizeHintDone();
+    /* Ask for just required guest display update (it will also update
+     * the viewport through IFramebuffer::NotifyUpdate): */
+    display().InvalidateAndUpdateScreen(m_uScreenId);
 
-    LogRelFlow(("UIMachineView::ResizeHandled: "
-                "Screen=%d, Format=%d, "
-                "BitsPerPixel=%d, BytesPerLine=%d, "
-                "Size=%dx%d.\n",
-                (unsigned long)m_uScreenId, iPixelFormat,
-                iBitsPerPixel, iBytesPerLine, iWidth, iHeight));
+    LogRelFlow(("GUI: UIMachineView::sltHandleNotifyChange: Complete for Screen=%d, Size=%dx%d\n",
+                (unsigned long)m_uScreenId, iWidth, iHeight));
 }
 
 void UIMachineView::sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight)
 {
+    /* Prepare corresponding viewport part: */
+    QRect rect(iX, iY, iWidth, iHeight);
+
+    /* Take the scaling into account: */
+    const double dScaleFactor = frameBuffer()->scaleFactor();
+    const QSize scaledSize = frameBuffer()->scaledSize();
+    if (scaledSize.isValid())
+    {
+        /* Calculate corresponding scale-factors: */
+        const double xScaleFactor = visualStateType() == UIVisualStateType_Scale ?
+                                    (double)scaledSize.width()  / frameBuffer()->width()  : dScaleFactor;
+        const double yScaleFactor = visualStateType() == UIVisualStateType_Scale ?
+                                    (double)scaledSize.height() / frameBuffer()->height() : dScaleFactor;
+        /* Adjust corresponding viewport part: */
+        rect.moveTo(floor((double)rect.x() * xScaleFactor) - 1,
+                    floor((double)rect.y() * yScaleFactor) - 1);
+        rect.setSize(QSize(ceil((double)rect.width()  * xScaleFactor) + 2,
+                           ceil((double)rect.height() * yScaleFactor) + 2));
+    }
+
+    /* Shift has to be scaled by the backing-scale-factor
+     * but not scaled by the scale-factor. */
+    rect.translate(-contentsX(), -contentsY());
+
+#ifdef Q_WS_MAC
+    /* Take the backing-scale-factor into account: */
+    if (frameBuffer()->useUnscaledHiDPIOutput())
+    {
+        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
+        if (dBackingScaleFactor > 1.0)
+        {
+            rect.moveTo(floor((double)rect.x() / dBackingScaleFactor) - 1,
+                        floor((double)rect.y() / dBackingScaleFactor) - 1);
+            rect.setSize(QSize(ceil((double)rect.width()  / dBackingScaleFactor) + 2,
+                               ceil((double)rect.height() / dBackingScaleFactor) + 2));
+        }
+    }
+#endif /* Q_WS_MAC */
+
+    /* Limit the resulting part by the viewport rectangle: */
+    rect &= viewport()->rect();
+
     /* Update corresponding viewport part: */
-    viewport()->update(iX - contentsX(), iY - contentsY(), iWidth, iHeight);
+    viewport()->update(rect);
 }
 
 void UIMachineView::sltHandleSetVisibleRegion(QRegion region)
@@ -311,6 +380,90 @@ void UIMachineView::sltDesktopResized()
     setMaxGuestSize();
 }
 
+void UIMachineView::sltHandleScaleFactorChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (strMachineID != vboxGlobal().managedVMUuid())
+        return;
+
+    /* Take the scale-factor into account: */
+    const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
+    frameBuffer()->setScaleFactor(dScaleFactor);
+    /* Propagate the scale-factor to 3D service if necessary: */
+    if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
+    {
+        display().NotifyScaleFactorChange(m_uScreenId,
+                                          (uint32_t)(dScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+                                          (uint32_t)(dScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
+    }
+
+    /* Handle scale attributes change: */
+    handleScaleChange();
+    /* Adjust guest-screen size: */
+    adjustGuestScreenSize();
+
+    /* Update scaled pause pixmap, if necessary: */
+    updateScaledPausePixmap();
+    viewport()->update();
+
+    // TODO: How to make it work?
+    display().ViewportChanged(screenId(), contentsX(), contentsY(), visibleWidth(), visibleHeight());
+}
+
+void UIMachineView::sltHandleScalingOptimizationChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (strMachineID != vboxGlobal().managedVMUuid())
+        return;
+
+    /* Take the scaling-optimization type into account: */
+    frameBuffer()->setScalingOptimizationType(gEDataManager->scalingOptimizationType(vboxGlobal().managedVMUuid()));
+
+    /* Update viewport: */
+    viewport()->update();
+}
+
+void UIMachineView::sltHandleHiDPIOptimizationChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (strMachineID != vboxGlobal().managedVMUuid())
+        return;
+
+    /* Take the HiDPI-optimization type into account: */
+    frameBuffer()->setHiDPIOptimizationType(gEDataManager->hiDPIOptimizationType(vboxGlobal().managedVMUuid()));
+
+    /* Update viewport: */
+    viewport()->update();
+}
+
+void UIMachineView::sltHandleUnscaledHiDPIOutputModeChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (strMachineID != vboxGlobal().managedVMUuid())
+        return;
+
+    /* Take the unscaled HiDPI output mode into account: */
+    const bool fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid());
+    frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);
+    /* Propagate the unscaled HiDPI output mode to 3D service if necessary: */
+    if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
+    {
+        display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
+    }
+
+    /* Handle scale attributes change: */
+    handleScaleChange();
+    /* Adjust guest-screen size: */
+    adjustGuestScreenSize();
+
+    /* Update scaled pause pixmap, if necessary: */
+    updateScaledPausePixmap();
+    viewport()->update();
+
+    // TODO: How to make it work?
+    display().ViewportChanged(screenId(), contentsX(), contentsY(), visibleWidth(), visibleHeight());
+}
+
 void UIMachineView::sltMachineStateChanged()
 {
     /* Get machine state: */
@@ -324,8 +477,9 @@ void UIMachineView::sltMachineStateChanged()
                 && (   state           != KMachineState_TeleportingPausedVM
                     || m_previousState != KMachineState_Teleporting))
             {
-                takePauseShotLive();
-                /* Fully repaint to pick up m_pauseShot: */
+                /* Take live pause-pixmap: */
+                takePausePixmapLive();
+                /* Fully repaint to pick up pause-pixmap: */
                 viewport()->update();
             }
             break;
@@ -335,8 +489,9 @@ void UIMachineView::sltMachineStateChanged()
             /* Only works with the primary screen currently. */
             if (screenId() == 0)
             {
-                takePauseShotSnapshot();
-                /* Fully repaint to pick up m_pauseShot: */
+                /* Take snapshot pause-pixmap: */
+                takePausePixmapSnapshot();
+                /* Fully repaint to pick up pause-pixmap: */
                 viewport()->update();
             }
             break;
@@ -349,18 +504,16 @@ void UIMachineView::sltMachineStateChanged()
             {
                 if (m_pFrameBuffer)
                 {
-                    /* Reset the pixmap to free memory: */
-                    resetPauseShot();
+                    /* Reset pause-pixmap: */
+                    resetPausePixmap();
                     /* Ask for full guest display update (it will also update
                      * the viewport through IFramebuffer::NotifyUpdate): */
-                    if (m_previousState == KMachineState_Paused ||
-                        m_previousState == KMachineState_TeleportingPausedVM)
-                    {
-                        CDisplay dsp = session().GetConsole().GetDisplay();
-                        dsp.InvalidateAndUpdate();
-                    }
+                    display().InvalidateAndUpdate();
                 }
             }
+            /* Reapply machine-view scale-factor if necessary: */
+            if (m_pFrameBuffer)
+                applyMachineViewScaleFactor();
             break;
         }
         default:
@@ -404,140 +557,115 @@ UIMachineView::~UIMachineView()
 void UIMachineView::prepareViewport()
 {
     /* Prepare viewport: */
-    setViewport(new UIViewport);
+    AssertPtrReturnVoid(viewport());
+    {
+        /* Enable manual painting: */
+        viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
+        /* Enable multi-touch support: */
+        viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
+    }
 }
 
 void UIMachineView::prepareFrameBuffer()
 {
-    /* Prepare frame-buffer depending on render-mode: */
-    switch (vboxGlobal().vmRenderMode())
+    /* Check whether we already have corresponding frame-buffer: */
+    UIFrameBuffer *pFrameBuffer = uisession()->frameBuffer(screenId());
+
+    /* If we do: */
+    if (pFrameBuffer)
     {
-#ifdef VBOX_GUI_USE_QIMAGE
-        case QImageMode:
-        {
-            UIFrameBuffer *pFrameBuffer = uisession()->frameBuffer(screenId());
-            if (pFrameBuffer)
-            {
-                pFrameBuffer->setView(this);
-                /* Mark framebuffer as used again: */
-                LogRelFlow(("UIMachineView::prepareFrameBuffer: Start EMT callbacks accepting for screen: %d.\n", screenId()));
-                pFrameBuffer->setMarkAsUnused(false);
-            }
-            else
-            {
-# ifdef VBOX_WITH_VIDEOHWACCEL
-                if (m_fAccelerate2DVideo)
-                {
-                    /** these two additional template args is a workaround to
-                     * this [VBox|UI] duplication
-                     * @todo: they are to be removed once VBox stuff is gone */
-                    pFrameBuffer = new VBoxOverlayFrameBuffer<UIFrameBufferQImage, UIMachineView, UIResizeEvent>(this, &session(), (uint32_t)screenId());
-                }
-                else
-                    pFrameBuffer = new UIFrameBufferQImage(this);
-# else /* VBOX_WITH_VIDEOHWACCEL */
-                pFrameBuffer = new UIFrameBufferQImage(this);
-# endif /* !VBOX_WITH_VIDEOHWACCEL */
-                pFrameBuffer->setHiDPIOptimizationType(uisession()->hiDPIOptimizationType());
-                uisession()->setFrameBuffer(screenId(), pFrameBuffer);
-            }
-            m_pFrameBuffer = pFrameBuffer;
-            break;
-        }
-#endif /* VBOX_GUI_USE_QIMAGE */
+        /* Assign it's view: */
+        pFrameBuffer->setView(this);
+        /* Mark frame-buffer as used again: */
+        LogRelFlow(("GUI: UIMachineView::prepareFrameBuffer: Start EMT callbacks accepting for screen: %d\n", screenId()));
+        pFrameBuffer->setMarkAsUnused(false);
+        /* And remember our choice: */
+        m_pFrameBuffer = pFrameBuffer;
+    }
+    /* If we do not: */
+    else
+    {
+#ifdef VBOX_WITH_VIDEOHWACCEL
+        /* Create new frame-buffer: */
+        m_pFrameBuffer = new UIFrameBuffer(m_fAccelerate2DVideo);
+        m_pFrameBuffer->init(this);
+#else /* VBOX_WITH_VIDEOHWACCEL */
+        /* Create new frame-buffer: */
+        m_pFrameBuffer = new UIFrameBuffer;
+        m_pFrameBuffer->init(this);
+#endif /* !VBOX_WITH_VIDEOHWACCEL */
 
-#ifdef VBOX_GUI_USE_QUARTZ2D
-        case Quartz2DMode:
-        {
-            /* Indicate that we are doing all drawing stuff ourself: */
-            viewport()->setAttribute(Qt::WA_PaintOnScreen);
-            UIFrameBuffer *pFrameBuffer = uisession()->frameBuffer(screenId());
-            if (pFrameBuffer)
-            {
-                pFrameBuffer->setView(this);
-                /* Mark framebuffer as used again: */
-                LogRelFlow(("UIMachineView::prepareFrameBuffer: Start EMT callbacks accepting for screen: %d.\n", screenId()));
-                pFrameBuffer->setMarkAsUnused(false);
-            }
-            else
-            {
-# ifdef VBOX_WITH_VIDEOHWACCEL
-                if (m_fAccelerate2DVideo)
-                {
-                    /** these two additional template args is a workaround to
-                     * this [VBox|UI] duplication
-                     * @todo: they are to be removed once VBox stuff is gone */
-                    pFrameBuffer = new VBoxOverlayFrameBuffer<UIFrameBufferQuartz2D, UIMachineView, UIResizeEvent>(this, &session(), (uint32_t)screenId());
-                }
-                else
-                    pFrameBuffer = new UIFrameBufferQuartz2D(this);
-# else /* VBOX_WITH_VIDEOHWACCEL */
-                pFrameBuffer = new UIFrameBufferQuartz2D(this);
-# endif /* !VBOX_WITH_VIDEOHWACCEL */
-                uisession()->setFrameBuffer(screenId(), pFrameBuffer);
-            }
-            m_pFrameBuffer = pFrameBuffer;
-            break;
-        }
-#endif /* VBOX_GUI_USE_QUARTZ2D */
+        /* Take HiDPI optimization type into account: */
+        m_pFrameBuffer->setHiDPIOptimizationType(gEDataManager->hiDPIOptimizationType(vboxGlobal().managedVMUuid()));
 
-        default:
-            AssertReleaseMsgFailed(("Render mode must be valid: %d\n", vboxGlobal().vmRenderMode()));
-            LogRel(("Invalid render mode: %d\n", vboxGlobal().vmRenderMode()));
-            qApp->exit(1);
-            break;
-    }
+        /* Take scaling optimization type into account: */
+        m_pFrameBuffer->setScalingOptimizationType(gEDataManager->scalingOptimizationType(vboxGlobal().managedVMUuid()));
 
-    /* If frame-buffer was prepared: */
-    if (m_pFrameBuffer)
-    {
-        /* Prepare display: */
-        CDisplay display = session().GetConsole().GetDisplay();
-        Assert(!display.isNull());
-        CFramebuffer fb(NULL);
-        LONG XOrigin, YOrigin;
-        /* Check if the framebuffer is already assigned;
-         * in this case we do not need to re-assign it neither do we need to AddRef. */
-        display.GetFramebuffer(m_uScreenId, fb, XOrigin, YOrigin);
-        if (fb.raw() != m_pFrameBuffer) /* <-this will evaluate to true iff no framebuffer is yet assigned */
+#ifdef Q_WS_MAC
+        /* Take backing scale-factor into account: */
+        m_pFrameBuffer->setBackingScaleFactor(darwinBackingScaleFactor(machineWindow()));
+#endif /* Q_WS_MAC */
+
+        /* Take the scale-factor related attributes into account: */
+        const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
+        const bool fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid());
+        m_pFrameBuffer->setScaleFactor(dScaleFactor);
+        m_pFrameBuffer->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);
+        /* Propagate the scale-factor related attributes to 3D service if necessary: */
+        if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
         {
-            m_pFrameBuffer->AddRef();
+            display().NotifyScaleFactorChange(m_uScreenId,
+                                              (uint32_t)(dScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+                                              (uint32_t)(dScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
+            display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
         }
-        /* Always perform SetFramebuffer to ensure 3D gets notified: */
-        display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer));
+
+        /* Perform frame-buffer rescaling: */
+        m_pFrameBuffer->performRescale();
+
+        /* Associate uisession with frame-buffer finally: */
+        uisession()->setFrameBuffer(screenId(), m_pFrameBuffer);
     }
 
+    /* Make sure frame-buffer was prepared: */
+    AssertReturnVoid(m_pFrameBuffer);
+
+    /* Reattach to IDisplay: */
+    m_pFrameBuffer->detach();
+    m_pFrameBuffer->attach();
+
+    /* Calculate frame-buffer size: */
     QSize size;
+    {
 #ifdef Q_WS_X11
-    /* Processing pseudo resize-event to synchronize frame-buffer with stored
-     * framebuffer size. On X11 this will be additional done when the machine
-     * state was 'saved'. */
-    if (session().GetMachine().GetState() == KMachineState_Saved)
-        size = guestSizeHint();
+        /* Processing pseudo resize-event to synchronize frame-buffer with stored framebuffer size.
+         * On X11 this will be additional done when the machine state was 'saved'. */
+        if (machine().GetState() == KMachineState_Saved)
+            size = guestSizeHint();
 #endif /* Q_WS_X11 */
-    /* If there is a preview image saved, we will resize the framebuffer to the
-     * size of that image. */
-    ULONG buffer = 0, width = 0, height = 0;
-    CMachine machine = session().GetMachine();
-    machine.QuerySavedScreenshotPNGSize(0, buffer, width, height);
-    if (buffer > 0)
-    {
-        /* Init with the screenshot size */
-        size = QSize(width, height);
-        /* Try to get the real guest dimensions from the save state */
-        ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
-        BOOL fEnabled = true;
-        machine.QuerySavedGuestScreenInfo(0, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
-        if (   guestWidth  > 0
-            && guestHeight > 0)
-            size = QSize(guestWidth, guestHeight);
-    }
-    /* If we have a valid size, resize the framebuffer. */
-    if (   size.width() > 0
-        && size.height() > 0)
-    {
-        UIResizeEvent event(FramebufferPixelFormat_Opaque, NULL, 0, 0, size.width(), size.height());
-        frameBuffer()->resizeEvent(&event);
+
+        /* If there is a preview image saved,
+         * we will resize the framebuffer to the size of that image: */
+        ULONG uWidth = 0, uHeight = 0;
+        QVector<KBitmapFormat> formats = machine().QuerySavedScreenshotInfo(0, uWidth, uHeight);
+        if (formats.size() > 0)
+        {
+            /* Init with the screenshot size: */
+            size = QSize(uWidth, uHeight);
+            /* Try to get the real guest dimensions from the save-state: */
+            ULONG uGuestOriginX = 0, uGuestOriginY = 0, uGuestWidth = 0, uGuestHeight = 0;
+            BOOL fEnabled = true;
+            machine().QuerySavedGuestScreenInfo(m_uScreenId, uGuestOriginX, uGuestOriginY, uGuestWidth, uGuestHeight, fEnabled);
+            if (uGuestWidth  > 0 && uGuestHeight > 0)
+                size = QSize(uGuestWidth, uGuestHeight);
+        }
+
+        /* If we have a valid size, resize/rescale the frame-buffer. */
+        if (size.width() > 0 && size.height() > 0)
+        {
+            frameBuffer()->performResize(size.width(), size.height());
+            frameBuffer()->performRescale();
+        }
     }
 }
 
@@ -555,8 +683,12 @@ void UIMachineView::prepareCommon()
     setFocusPolicy(Qt::WheelFocus);
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
-    /* Enable Drag & Drop. */
+    /* Enable drag & drop. */
     setAcceptDrops(true);
+
+    /* Create the drag and drop handler instance.
+     * At the moment we only support one instance per machine window. */
+    m_pDnDHandler = new UIDnDHandler(uisession(), this /* pParent */);
 #endif /* VBOX_WITH_DRAG_AND_DROP */
 }
 
@@ -581,6 +713,18 @@ void UIMachineView::prepareConnections()
     /* Desktop resolution change (e.g. monitor hotplug): */
     connect(QApplication::desktop(), SIGNAL(resized(int)), this,
             SLOT(sltDesktopResized()));
+    /* Scale-factor change: */
+    connect(gEDataManager, SIGNAL(sigScaleFactorChange(const QString&)),
+            this, SLOT(sltHandleScaleFactorChange(const QString&)));
+    /* Scaling-optimization change: */
+    connect(gEDataManager, SIGNAL(sigScalingOptimizationTypeChange(const QString&)),
+            this, SLOT(sltHandleScalingOptimizationChange(const QString&)));
+    /* HiDPI-optimization change: */
+    connect(gEDataManager, SIGNAL(sigHiDPIOptimizationTypeChange(const QString&)),
+            this, SLOT(sltHandleHiDPIOptimizationChange(const QString&)));
+    /* Unscaled HiDPI output mode change: */
+    connect(gEDataManager, SIGNAL(sigUnscaledHiDPIOutputModeChange(const QString&)),
+            this, SLOT(sltHandleUnscaledHiDPIOutputModeChange(const QString&)));
 }
 
 void UIMachineView::prepareConsoleConnections()
@@ -617,7 +761,7 @@ void UIMachineView::cleanupFrameBuffer()
     AssertReturnVoid(m_pFrameBuffer == uisession()->frameBuffer(screenId()));
 
     /* Mark framebuffer as unused: */
-    LogRelFlow(("UIMachineView::cleanupFrameBuffer: Stop EMT callbacks accepting for screen: %d.\n", screenId()));
+    LogRelFlow(("GUI: UIMachineView::cleanupFrameBuffer: Stop EMT callbacks accepting for screen: %d\n", screenId()));
     m_pFrameBuffer->setMarkAsUnused(true);
 
     /* Process pending framebuffer events: */
@@ -630,52 +774,76 @@ void UIMachineView::cleanupFrameBuffer()
 
     /* Temporarily detach the framebuffer from IDisplay before detaching
      * from view in order to respect the thread synchonisation logic (see UIFrameBuffer.h).
-     * Note: VBOX_WITH_CROGL additionally requires us to call SetFramebuffer
+     * Note: VBOX_WITH_CROGL additionally requires us to call DetachFramebuffer
      * to ensure 3D gets notified of view being destroyed... */
-    CDisplay display = session().GetConsole().GetDisplay();
-    display.SetFramebuffer(m_uScreenId, CFramebuffer(NULL));
+    if (console().isOk() && !display().isNull())
+        m_pFrameBuffer->detach();
 
     /* Detach framebuffer from view: */
     m_pFrameBuffer->setView(NULL);
+}
 
-    /* Attach frambuffer back to IDisplay: */
-    display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer));
+UISession* UIMachineView::uisession() const
+{
+    return machineWindow()->uisession();
 }
 
-UIMachineLogic* UIMachineView::machineLogic() const
+CSession& UIMachineView::session() const
 {
-    return machineWindow()->machineLogic();
+    return uisession()->session();
 }
 
-UISession* UIMachineView::uisession() const
+CMachine& UIMachineView::machine() const
 {
-    return machineLogic()->uisession();
+    return uisession()->machine();
 }
 
-CSession& UIMachineView::session()
+CConsole& UIMachineView::console() const
 {
-    return uisession()->session();
+    return uisession()->console();
+}
+
+CDisplay& UIMachineView::display() const
+{
+    return uisession()->display();
+}
+
+CGuest& UIMachineView::guest() const
+{
+    return uisession()->guest();
+}
+
+UIActionPool* UIMachineView::actionPool() const
+{
+    return machineWindow()->actionPool();
+}
+
+UIMachineLogic* UIMachineView::machineLogic() const
+{
+    return machineWindow()->machineLogic();
 }
 
 QSize UIMachineView::sizeHint() const
 {
     if (m_sizeHintOverride.isValid())
         return m_sizeHintOverride;
-#ifdef VBOX_WITH_DEBUGGER
+
+    /* Get frame-buffer size-hint: */
+    QSize size(m_pFrameBuffer->width(), m_pFrameBuffer->height());
+
+    /* Take the scale-factor(s) into account: */
+    size = scaledForward(size);
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
     // TODO: Fix all DEBUGGER stuff!
     /* HACK ALERT! Really ugly workaround for the resizing to 9x1 done by DevVGA if provoked before power on. */
-    QSize fb(m_pFrameBuffer->width(), m_pFrameBuffer->height());
-    if (fb.width() < 16 || fb.height() < 16)
-    {
-        CMachine machine = uisession()->session().GetMachine();
-        if (   vboxGlobal().isStartPausedEnabled()
-            || vboxGlobal().isDebuggerAutoShowEnabled(machine))
-        fb = QSize(640, 480);
-    }
-    return QSize(fb.width() + frameWidth() * 2, fb.height() + frameWidth() * 2);
-#else /* VBOX_WITH_DEBUGGER */
-    return QSize(m_pFrameBuffer->width() + frameWidth() * 2, m_pFrameBuffer->height() + frameWidth() * 2);
-#endif /* !VBOX_WITH_DEBUGGER */
+    if (size.width() < 16 || size.height() < 16)
+        if (vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled())
+            size = QSize(640, 480);
+#endif /* !VBOX_WITH_DEBUGGER_GUI */
+
+    /* Return the resulting size-hint: */
+    return QSize(size.width() + frameWidth() * 2, size.height() + frameWidth() * 2);
 }
 
 int UIMachineView::contentsX() const
@@ -739,102 +907,249 @@ QSize UIMachineView::maxGuestSize()
 
 QSize UIMachineView::guestSizeHint()
 {
-    /* Result: */
-    QSize sizeHint;
+    /* Load guest-screen size-hint: */
+    QSize size = gEDataManager->lastGuestSizeHint(m_uScreenId, vboxGlobal().managedVMUuid());
 
-    /* Get current machine: */
-    CMachine machine = session().GetMachine();
+    /* Invent the default if necessary: */
+    if (!size.isValid())
+        size = QSize(800, 600);
 
-    /* Load machine view hint: */
-    QString strKey = makeExtraDataKeyPerMonitor(GUI_LastGuestSizeHint);
-    QString strValue = machine.GetExtraData(strKey);
+    /* Take the scale-factor(s) into account: */
+    size = scaledForward(size);
 
-    bool ok = true;
-    int width = 0, height = 0;
-    if (ok)
-        width = strValue.section(',', 0, 0).toInt(&ok);
-    if (ok)
-        height = strValue.section(',', 1, 1).toInt(&ok);
+    /* Return size: */
+    return size;
+}
 
-    if (ok /* If previous parameters were read correctly! */)
-    {
-        /* Compose guest size hint from loaded values: */
-        sizeHint = QSize(width, height);
-    }
-    else
+void UIMachineView::handleScaleChange()
+{
+    LogRel(("GUI: UIMachineView::handleScaleChange: Screen=%d\n",
+            (unsigned long)m_uScreenId));
+
+    /* If machine-window is visible: */
+    if (uisession()->isScreenVisible(m_uScreenId))
     {
-        /* Compose guest size hint from default attributes: */
-        sizeHint = QSize(800, 600);
+        /* For 'scale' mode: */
+        if (visualStateType() == UIVisualStateType_Scale)
+        {
+            /* Assign new frame-buffer logical-size: */
+            frameBuffer()->setScaledSize(size());
+        }
+        /* For other than 'scale' mode: */
+        else
+        {
+            /* Adjust maximum-size restriction for machine-view: */
+            setMaximumSize(sizeHint());
+
+            /* Disable the resize hint override hack: */
+            m_sizeHintOverride = QSize(-1, -1);
+
+            /* Force machine-window update own layout: */
+            QCoreApplication::sendPostedEvents(0, QEvent::LayoutRequest);
+
+            /* Update machine-view sliders: */
+            updateSliders();
+
+            /* By some reason Win host forgets to update machine-window central-widget
+             * after main-layout was updated, let's do it for all the hosts: */
+            machineWindow()->centralWidget()->update();
+
+            /* Normalize 'normal' machine-window geometry: */
+            if (visualStateType() == UIVisualStateType_Normal)
+                machineWindow()->normalizeGeometry(true /* adjust position */);
+        }
+
+        /* Perform frame-buffer rescaling: */
+        frameBuffer()->performRescale();
     }
 
-    /* Return result: */
-    return sizeHint;
+    LogRelFlow(("GUI: UIMachineView::handleScaleChange: Complete for Screen=%d\n",
+                (unsigned long)m_uScreenId));
 }
 
-void UIMachineView::storeGuestSizeHint(const QSize &sizeHint)
+void UIMachineView::storeGuestSizeHint(const QSize &size)
 {
-    /* Get current machine: */
-    CMachine machine = session().GetMachine();
-
-    /* Save machine view hint: */
-    LogRel(("UIMachineView::storeGuestSizeHint: "
+    /* Save guest-screen size-hint: */
+    LogRel(("GUI: UIMachineView::storeGuestSizeHint: "
             "Storing guest size-hint for screen %d as %dx%d\n",
-            (int)screenId(), sizeHint.width(), sizeHint.height()));
-    QString strKey = makeExtraDataKeyPerMonitor(GUI_LastGuestSizeHint);
-    QString strValue = QString("%1,%2").arg(sizeHint.width()).arg(sizeHint.height());
-    machine.SetExtraData(strKey, strValue);
+            (int)screenId(), size.width(), size.height()));
+    gEDataManager->setLastGuestSizeHint(m_uScreenId, size, vboxGlobal().managedVMUuid());
 }
 
-void UIMachineView::takePauseShotLive()
+void UIMachineView::resetPausePixmap()
 {
-    /* Take a screen snapshot. Note that TakeScreenShot() always needs a 32bpp image: */
-    QImage shot = QImage(m_pFrameBuffer->width(), m_pFrameBuffer->height(), QImage::Format_RGB32);
-    /* If TakeScreenShot fails or returns no image, just show a black image. */
-    shot.fill(0);
-    CDisplay dsp = session().GetConsole().GetDisplay();
-    dsp.TakeScreenShot(screenId(), shot.bits(), shot.width(), shot.height());
-    /* TakeScreenShot() may fail if, e.g. the Paused notification was delivered
-     * after the machine execution was resumed. It's not fatal: */
-    if (dsp.isOk())
-        dimImage(shot);
-    m_pauseShot = QPixmap::fromImage(shot);
+    /* Reset pixmap(s): */
+    m_pausePixmap = QPixmap();
+    m_pausePixmapScaled = QPixmap();
 }
 
-void UIMachineView::takePauseShotSnapshot()
+void UIMachineView::takePausePixmapLive()
 {
-    CMachine machine = session().GetMachine();
-    ULONG width = 0, height = 0;
-    QVector<BYTE> screenData = machine.ReadSavedScreenshotPNGToArray(0, width, height);
-    if (screenData.size() != 0)
+    /* Prepare a screen-shot: */
+    QImage screenShot = QImage(m_pFrameBuffer->width(), m_pFrameBuffer->height(), QImage::Format_RGB32);
+    /* Which will be a 'black image' by default. */
+    screenShot.fill(0);
+
+    /* For separate process: */
+    if (vboxGlobal().isSeparateProcess())
+    {
+        /* Take screen-data to array: */
+        const QVector<BYTE> screenData = display().TakeScreenShotToArray(screenId(), screenShot.width(), screenShot.height(), KBitmapFormat_BGR0);
+        /* And copy that data to screen-shot if it is Ok: */
+        if (display().isOk() && !screenData.isEmpty())
+            memcpy(screenShot.bits(), screenData.data(), screenShot.width() * screenShot.height() * 4);
+    }
+    /* For the same process: */
+    else
     {
-        ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
-        BOOL fEnabled = true;
-        machine.QuerySavedGuestScreenInfo(0, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
-        QImage shot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(guestWidth > 0 ? QSize(guestWidth, guestHeight) : guestSizeHint());
-        dimImage(shot);
-        m_pauseShot = QPixmap::fromImage(shot);
+        /* Take the screen-shot directly: */
+        display().TakeScreenShot(screenId(), screenShot.bits(), screenShot.width(), screenShot.height(), KBitmapFormat_BGR0);
     }
+
+    /* Dim screen-shot if it is Ok: */
+    if (display().isOk() && !screenShot.isNull())
+        dimImage(screenShot);
+
+    /* Finally copy the screen-shot to pause-pixmap: */
+    m_pausePixmap = QPixmap::fromImage(screenShot);
+#ifdef Q_WS_MAC
+# ifdef VBOX_GUI_WITH_HIDPI
+    /* Adjust-backing-scale-factor if necessary: */
+    const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
+    if (dBackingScaleFactor > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
+        m_pausePixmap.setDevicePixelRatio(dBackingScaleFactor);
+# endif /* VBOX_GUI_WITH_HIDPI */
+#endif /* Q_WS_MAC */
+
+    /* Update scaled pause pixmap: */
+    updateScaledPausePixmap();
+}
+
+void UIMachineView::takePausePixmapSnapshot()
+{
+    /* Acquire the screen-data from the saved-state: */
+    ULONG uWidth = 0, uHeight = 0;
+    const QVector<BYTE> screenData = machine().ReadSavedScreenshotToArray(0, KBitmapFormat_PNG, uWidth, uHeight);
+
+    /* Make sure there is saved-state screen-data: */
+    if (screenData.isEmpty())
+        return;
+
+    /* Acquire the screen-data properties from the saved-state: */
+    ULONG uGuestOriginX = 0, uGuestOriginY = 0, uGuestWidth = 0, uGuestHeight = 0;
+    BOOL fEnabled = true;
+    machine().QuerySavedGuestScreenInfo(m_uScreenId, uGuestOriginX, uGuestOriginY, uGuestWidth, uGuestHeight, fEnabled);
+
+    /* Create a screen-shot on the basis of the screen-data we have in saved-state: */
+    QImage screenShot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(uGuestWidth > 0 ? QSize(uGuestWidth, uGuestHeight) : guestSizeHint());
+
+    /* Dim screen-shot if it is Ok: */
+    if (machine().isOk() && !screenShot.isNull())
+        dimImage(screenShot);
+
+    /* Finally copy the screen-shot to pause-pixmap: */
+    m_pausePixmap = QPixmap::fromImage(screenShot);
+#ifdef Q_WS_MAC
+# ifdef VBOX_GUI_WITH_HIDPI
+    /* Adjust-backing-scale-factor if necessary: */
+    const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
+    if (dBackingScaleFactor > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
+        m_pausePixmap.setDevicePixelRatio(dBackingScaleFactor);
+# endif /* VBOX_GUI_WITH_HIDPI */
+#endif /* Q_WS_MAC */
+
+    /* Update scaled pause pixmap: */
+    updateScaledPausePixmap();
+}
+
+void UIMachineView::updateScaledPausePixmap()
+{
+    /* Make sure pause pixmap is not null: */
+    if (pausePixmap().isNull())
+        return;
+
+    /* Make sure scaled-size is not null: */
+    const QSize scaledSize = frameBuffer()->scaledSize();
+    if (!scaledSize.isValid())
+        return;
+
+    /* Update pause pixmap finally: */
+    m_pausePixmapScaled = pausePixmap().scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+#ifdef Q_WS_MAC
+# ifdef VBOX_GUI_WITH_HIDPI
+    /* Adjust-backing-scale-factor if necessary: */
+    const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
+    if (dBackingScaleFactor > 1.0 && frameBuffer()->useUnscaledHiDPIOutput())
+        m_pausePixmapScaled.setDevicePixelRatio(dBackingScaleFactor);
+# endif /* VBOX_GUI_WITH_HIDPI */
+#endif /* Q_WS_MAC */
 }
 
 void UIMachineView::updateSliders()
 {
-    QSize p = viewport()->size();
-    QSize m = maximumViewportSize();
+    /* Get current viewport size: */
+    QSize curViewportSize = viewport()->size();
+    /* Get maximum viewport size: */
+    const QSize maxViewportSize = maximumViewportSize();
+    /* Get current frame-buffer size: */
+    QSize frameBufferSize = QSize(frameBuffer()->width(), frameBuffer()->height());
+
+    /* Take the scale-factor(s) into account: */
+    frameBufferSize = scaledForward(frameBufferSize);
+
+    /* If maximum viewport size can cover whole frame-buffer => no scroll-bars required: */
+    if (maxViewportSize.expandedTo(frameBufferSize) == maxViewportSize)
+        curViewportSize = maxViewportSize;
 
-    QSize v = QSize(frameBuffer()->width(), frameBuffer()->height());
-    /* No scroll bars needed: */
-    if (m.expandedTo(v) == m)
-        p = m;
+    /* What length we want scroll-bars of? */
+    int xRange = frameBufferSize.width()  - curViewportSize.width();
+    int yRange = frameBufferSize.height() - curViewportSize.height();
+
+#ifdef Q_WS_MAC
+    /* Due to Qt 4.x doesn't supports HiDPI directly
+     * we should take the backing-scale-factor into account.
+     * See also viewportToContents()... */
+    if (frameBuffer()->useUnscaledHiDPIOutput())
+    {
+        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
+        if (dBackingScaleFactor > 1.0)
+        {
+            xRange *= dBackingScaleFactor;
+            yRange *= dBackingScaleFactor;
+        }
+    }
+#endif /* Q_WS_MAC */
 
-    horizontalScrollBar()->setRange(0, v.width() - p.width());
-    verticalScrollBar()->setRange(0, v.height() - p.height());
-    horizontalScrollBar()->setPageStep(p.width());
-    verticalScrollBar()->setPageStep(p.height());
+    /* Configure scroll-bars: */
+    horizontalScrollBar()->setRange(0, xRange);
+    verticalScrollBar()->setRange(0, yRange);
+    horizontalScrollBar()->setPageStep(curViewportSize.width());
+    verticalScrollBar()->setPageStep(curViewportSize.height());
 }
 
 QPoint UIMachineView::viewportToContents(const QPoint &vp) const
 {
-    return QPoint(vp.x() + contentsX(), vp.y() + contentsY());
+    /* Get physical contents shifts of scroll-bars: */
+    int iContentsX = contentsX();
+    int iContentsY = contentsY();
+
+#ifdef Q_WS_MAC
+    /* Due to Qt 4.x doesn't supports HiDPI directly
+     * we should take the backing-scale-factor into account.
+     * See also updateSliders()... */
+    if (frameBuffer()->useUnscaledHiDPIOutput())
+    {
+        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
+        if (dBackingScaleFactor > 1.0)
+        {
+            iContentsX /= dBackingScaleFactor;
+            iContentsY /= dBackingScaleFactor;
+        }
+    }
+#endif /* Q_WS_MAC */
+
+    /* Return point shifted according scroll-bars: */
+    return QPoint(vp.x() + iContentsX, vp.y() + iContentsY);
 }
 
 void UIMachineView::scrollBy(int dx, int dy)
@@ -886,11 +1201,9 @@ void UIMachineView::scrollContentsBy(int dx, int dy)
 #endif /* VBOX_WITH_VIDEOHWACCEL */
     QAbstractScrollArea::scrollContentsBy(dx, dy);
 
-    session().GetConsole().GetDisplay().ViewportChanged(screenId(),
-                            contentsX(),
-                            contentsY(),
-                            visibleWidth(),
-                            visibleHeight());
+    display().ViewportChanged(screenId(),
+                              contentsX(), contentsY(),
+                              visibleWidth(), visibleHeight());
 }
 
 
@@ -902,46 +1215,31 @@ void UIMachineView::updateDockIcon()
 
 CGImageRef UIMachineView::vmContentImage()
 {
-    if (!m_pauseShot.isNull())
-    {
-        CGImageRef pauseImg = ::darwinToCGImageRef(&m_pauseShot);
-        /* Use the pause image as background */
-        return pauseImg;
-    }
-    else
-    {
-# ifdef VBOX_GUI_USE_QUARTZ2D
-        if (vboxGlobal().vmRenderMode() == Quartz2DMode)
-        {
-            /* If the render mode is Quartz2D we could use the CGImageRef
-             * of the framebuffer for the dock icon creation. This saves
-             * some conversion time. */
-            CGImageRef image = static_cast<UIFrameBufferQuartz2D*>(m_pFrameBuffer)->imageRef();
-            CGImageRetain(image); /* Retain it, cause the consumer will release it. */
-            return image;
-        }
-# endif /* VBOX_GUI_USE_QUARTZ2D */
-        /* In image mode we have to create the image ref out of the
-         * framebuffer */
-        return frameBuffertoCGImageRef(m_pFrameBuffer);
-    }
-    return 0;
+    /* Use pause-image if exists: */
+    if (!pausePixmap().isNull())
+        return darwinToCGImageRef(&pausePixmap());
+
+    /* Create the image ref out of the frame-buffer: */
+    return frameBuffertoCGImageRef(m_pFrameBuffer);
 }
 
 CGImageRef UIMachineView::frameBuffertoCGImageRef(UIFrameBuffer *pFrameBuffer)
 {
+    CGImageRef ir = 0;
     CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
-    Assert(cs);
-    /* Create the image copy of the framebuffer */
-    CGDataProviderRef dp = CGDataProviderCreateWithData(pFrameBuffer, pFrameBuffer->address(), pFrameBuffer->bitsPerPixel() / 8 * pFrameBuffer->width() * pFrameBuffer->height(), NULL);
-    Assert(dp);
-    CGImageRef ir = CGImageCreate(pFrameBuffer->width(), pFrameBuffer->height(), 8, 32, pFrameBuffer->bytesPerLine(), cs,
-                                  kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host, dp, 0, false,
-                                  kCGRenderingIntentDefault);
-    Assert(ir);
-    CGDataProviderRelease(dp);
-    CGColorSpaceRelease(cs);
-
+    if (cs)
+    {
+        /* Create the image copy of the framebuffer */
+        CGDataProviderRef dp = CGDataProviderCreateWithData(pFrameBuffer, pFrameBuffer->address(), pFrameBuffer->bitsPerPixel() / 8 * pFrameBuffer->width() * pFrameBuffer->height(), NULL);
+        if (dp)
+        {
+            ir = CGImageCreate(pFrameBuffer->width(), pFrameBuffer->height(), 8, 32, pFrameBuffer->bytesPerLine(), cs,
+                               kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host, dp, 0, false,
+                               kCGRenderingIntentDefault);
+            CGDataProviderRelease(dp);
+        }
+        CGColorSpaceRelease(cs);
+    }
     return ir;
 }
 #endif /* Q_WS_MAC */
@@ -957,12 +1255,6 @@ bool UIMachineView::isFullscreenOrSeamless() const
            || visualStateType() == UIVisualStateType_Seamless;
 }
 
-QString UIMachineView::makeExtraDataKeyPerMonitor(QString base) const
-{
-    return m_uScreenId == 0 ? QString("%1").arg(base)
-                            : QString("%1%2").arg(base).arg(m_uScreenId);
-}
-
 bool UIMachineView::event(QEvent *pEvent)
 {
     switch (pEvent->type())
@@ -1010,11 +1302,9 @@ bool UIMachineView::eventFilter(QObject *pWatched, QEvent *pEvent)
                 if (m_pFrameBuffer)
                     m_pFrameBuffer->viewportResized(pResizeEvent);
 #endif /* VBOX_WITH_VIDEOHWACCEL */
-                session().GetConsole().GetDisplay().ViewportChanged(screenId(),
-                        contentsX(),
-                        contentsY(),
-                        visibleWidth(),
-                        visibleHeight());
+                display().ViewportChanged(screenId(),
+                                          contentsX(), contentsY(),
+                                          visibleWidth(), visibleHeight());
                 break;
             }
             default:
@@ -1031,11 +1321,9 @@ bool UIMachineView::eventFilter(QObject *pWatched, QEvent *pEvent)
                 /* In some cases viewport resize-events can provoke the
                  * machine-view position changes inside the machine-window.
                  * We have to notify interested listeners like 3D service. */
-                session().GetConsole().GetDisplay().ViewportChanged(screenId(),
-                        contentsX(),
-                        contentsY(),
-                        visibleWidth(),
-                        visibleHeight());
+                display().ViewportChanged(screenId(),
+                                          contentsX(), contentsY(),
+                                          visibleWidth(), visibleHeight());
                 break;
             }
             default:
@@ -1066,9 +1354,13 @@ bool UIMachineView::eventFilter(QObject *pWatched, QEvent *pEvent)
 #ifdef Q_WS_MAC
             case QEvent::Move:
             {
-                /* Update backing scale factor for underlying frame-buffer: */
                 if (m_pFrameBuffer)
+                {
+                    /* Update backing-scale-factor for underlying frame-buffer: */
                     m_pFrameBuffer->setBackingScaleFactor(darwinBackingScaleFactor(machineWindow()));
+                    /* Perform frame-buffer rescaling: */
+                    m_pFrameBuffer->performRescale();
+                }
                 break;
             }
 #endif /* Q_WS_MAC */
@@ -1093,61 +1385,49 @@ void UIMachineView::moveEvent(QMoveEvent *pEvent)
 
 void UIMachineView::paintEvent(QPaintEvent *pPaintEvent)
 {
-    if (m_pauseShot.isNull())
+    /* Use pause-image if exists: */
+    if (!pausePixmap().isNull())
     {
-        /* Delegate the paint function to the VBoxFrameBuffer interface: */
-        if (m_pFrameBuffer)
-            m_pFrameBuffer->paintEvent(pPaintEvent);
+        /* We have a snapshot for the paused state: */
+        QRect rect = pPaintEvent->rect().intersect(viewport()->rect());
+        QPainter painter(viewport());
+        /* Take the scale-factor into account: */
+        if (frameBuffer()->scaleFactor() == 1.0 && !frameBuffer()->scaledSize().isValid())
+            painter.drawPixmap(rect.topLeft(), pausePixmap());
+        else
+            painter.drawPixmap(rect.topLeft(), pausePixmapScaled());
 #ifdef Q_WS_MAC
-        /* Update the dock icon if we are in the running state */
-        if (uisession()->isRunning())
-            updateDockIcon();
+        /* Update the dock icon: */
+        updateDockIcon();
 #endif /* Q_WS_MAC */
         return;
     }
 
-#ifdef VBOX_GUI_USE_QUARTZ2D
-    if (vboxGlobal().vmRenderMode() == Quartz2DMode && m_pFrameBuffer)
-    {
-        m_pFrameBuffer->paintEvent(pPaintEvent);
-        updateDockIcon();
-    }
-    else
-#endif /* VBOX_GUI_USE_QUARTZ2D */
-    {
-        /* We have a snapshot for the paused state: */
-        QRect r = pPaintEvent->rect().intersect(viewport()->rect());
-        /* We have to disable paint on screen if we are using the regular painter: */
-        bool paintOnScreen = viewport()->testAttribute(Qt::WA_PaintOnScreen);
-        viewport()->setAttribute(Qt::WA_PaintOnScreen, false);
-        QPainter pnt(viewport());
-        pnt.drawPixmap(r, m_pauseShot, QRect(r.x() + contentsX(), r.y() + contentsY(), r.width(), r.height()));
-        /* Restore the attribute to its previous state: */
-        viewport()->setAttribute(Qt::WA_PaintOnScreen, paintOnScreen);
+    /* Delegate the paint function to the UIFrameBuffer interface: */
+    if (m_pFrameBuffer)
+        m_pFrameBuffer->handlePaintEvent(pPaintEvent);
 #ifdef Q_WS_MAC
+    /* Update the dock icon if we are in the running state: */
+    if (uisession()->isRunning())
         updateDockIcon();
 #endif /* Q_WS_MAC */
-    }
 }
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
-
 void UIMachineView::dragEnterEvent(QDragEnterEvent *pEvent)
 {
-    /* The guest object to talk to. */
-    CGuest guest = session().GetConsole().GetGuest();
+    AssertPtrReturnVoid(pEvent);
 
-    /* Get mouse-pointer location */
+    /* Get mouse-pointer location. */
     const QPoint &cpnt = viewportToContents(pEvent->pos());
 
-    /* Ask the guest for starting a DnD event. */
-    Qt::DropAction result = gDnD->dragHGEnter(guest,
-                                              screenId(),
-                                              frameBuffer()->convertHostXTo(cpnt.x()),
-                                              frameBuffer()->convertHostYTo(cpnt.y()),
-                                              pEvent->proposedAction(),
-                                              pEvent->possibleActions(),
-                                              pEvent->mimeData(), this);
+    /* Ask the target for starting a DnD event. */
+    Qt::DropAction result = m_pDnDHandler->dragEnter(screenId(),
+                                                     frameBuffer()->convertHostXTo(cpnt.x()),
+                                                     frameBuffer()->convertHostYTo(cpnt.y()),
+                                                     pEvent->proposedAction(),
+                                                     pEvent->possibleActions(),
+                                                     pEvent->mimeData());
 
     /* Set the DnD action returned by the guest. */
     pEvent->setDropAction(result);
@@ -1156,20 +1436,18 @@ void UIMachineView::dragEnterEvent(QDragEnterEvent *pEvent)
 
 void UIMachineView::dragMoveEvent(QDragMoveEvent *pEvent)
 {
-    /* The guest object to talk to. */
-    CGuest guest = session().GetConsole().GetGuest();
+    AssertPtrReturnVoid(pEvent);
 
-    /* Get mouse-pointer location */
+    /* Get mouse-pointer location. */
     const QPoint &cpnt = viewportToContents(pEvent->pos());
 
     /* Ask the guest for moving the drop cursor. */
-    Qt::DropAction result = gDnD->dragHGMove(guest,
-                                             screenId(),
-                                             frameBuffer()->convertHostXTo(cpnt.x()),
-                                             frameBuffer()->convertHostYTo(cpnt.y()),
-                                             pEvent->proposedAction(),
-                                             pEvent->possibleActions(),
-                                             pEvent->mimeData(), this);
+    Qt::DropAction result = m_pDnDHandler->dragMove(screenId(),
+                                                    frameBuffer()->convertHostXTo(cpnt.x()),
+                                                    frameBuffer()->convertHostYTo(cpnt.y()),
+                                                    pEvent->proposedAction(),
+                                                    pEvent->possibleActions(),
+                                                    pEvent->mimeData());
 
     /* Set the DnD action returned by the guest. */
     pEvent->setDropAction(result);
@@ -1178,56 +1456,51 @@ void UIMachineView::dragMoveEvent(QDragMoveEvent *pEvent)
 
 void UIMachineView::dragLeaveEvent(QDragLeaveEvent *pEvent)
 {
-    /* The guest object to talk to. */
-    CGuest guest = session().GetConsole().GetGuest();
+    AssertPtrReturnVoid(pEvent);
+
+    m_pDnDHandler->dragLeave(screenId());
 
-    /* Ask the guest for stopping this DnD event. */
-    gDnD->dragHGLeave(guest, screenId(), this);
     pEvent->accept();
 }
 
+void UIMachineView::dragIsPending(void)
+{
+    /** @todo Add guest->guest DnD functionality here by getting
+     *        the source of guest B (when copying from B to A). */
+    m_pDnDHandler->dragIsPending(screenId());
+}
+
 void UIMachineView::dropEvent(QDropEvent *pEvent)
 {
-    /* The guest object to talk to. */
-    CGuest guest = session().GetConsole().GetGuest();
+    AssertPtrReturnVoid(pEvent);
 
-    /* Get mouse-pointer location */
+    /* Get mouse-pointer location. */
     const QPoint &cpnt = viewportToContents(pEvent->pos());
 
     /* Ask the guest for dropping data. */
-    Qt::DropAction result = gDnD->dragHGDrop(guest,
-                                             screenId(),
-                                             frameBuffer()->convertHostXTo(cpnt.x()),
-                                             frameBuffer()->convertHostYTo(cpnt.y()),
-                                             pEvent->proposedAction(),
-                                             pEvent->possibleActions(),
-                                             pEvent->mimeData(), this);
+    Qt::DropAction result = m_pDnDHandler->dragDrop(screenId(),
+                                                    frameBuffer()->convertHostXTo(cpnt.x()),
+                                                    frameBuffer()->convertHostYTo(cpnt.y()),
+                                                    pEvent->proposedAction(),
+                                                    pEvent->possibleActions(),
+                                                    pEvent->mimeData());
 
     /* Set the DnD action returned by the guest. */
     pEvent->setDropAction(result);
     pEvent->accept();
 }
-
-void UIMachineView::handleGHDnd()
-{
-    /* The guest object to talk to. */
-    CGuest guest = session().GetConsole().GetGuest();
-
-    /* Check for a pending DnD event within the guest and if so, handle all the
-     * magic. */
-    gDnD->dragGHPending(session(), screenId(), this);
-}
-
 #endif /* VBOX_WITH_DRAG_AND_DROP */
 
 #if defined(Q_WS_WIN)
 
 bool UIMachineView::winEvent(MSG *pMsg, long* /* piResult */)
 {
-    /* Check if some system event should be filtered-out.
-     * Returning 'true' means filtering-out,
-     * Returning 'false' means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default: */
+    AssertPtrReturn(pMsg, false);
+
+    /* Check if some system event should be filtered out.
+     * Returning @c true means filtering-out,
+     * Returning @c false means passing event to Qt. */
+    bool fResult = false; /* Pass to Qt by default. */
     switch (pMsg->message)
     {
         case WM_KEYDOWN:
@@ -1235,16 +1508,25 @@ bool UIMachineView::winEvent(MSG *pMsg, long* /* piResult */)
         case WM_SYSKEYDOWN:
         case WM_SYSKEYUP:
         {
-            /* Filter using keyboard-filter: */
-            bool fKeyboardFilteringResult = machineLogic()->keyboardHandler()->winEventFilter(pMsg, screenId());
-            /* Keyboard filter rules the result: */
+            /* Can't do COM inter-process calls from a SendMessage handler,
+             * see http://support.microsoft.com/kb/131056 */
+            if (vboxGlobal().isSeparateProcess() && InSendMessage())
+            {
+                PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);
+                fResult = true;
+                break;
+            }
+            /* Filter using keyboard filter? */
+            bool fKeyboardFilteringResult =
+                machineLogic()->keyboardHandler()->winEventFilter(pMsg, screenId());
+            /* Keyboard filter rules the result? */
             fResult = fKeyboardFilteringResult;
             break;
         }
         default:
             break;
     }
-    /* Return result: */
+
     return fResult;
 }
 
@@ -1252,10 +1534,12 @@ bool UIMachineView::winEvent(MSG *pMsg, long* /* piResult */)
 
 bool UIMachineView::x11Event(XEvent *pEvent)
 {
-    /* Check if some system event should be filtered-out.
-     * Returning 'true' means filtering-out,
-     * Returning 'false' means passing event to Qt. */
-    bool fResult = false; /* Pass to Qt by default: */
+    AssertPtrReturn(pEvent, false);
+
+    /* Check if some system event should be filtered out.
+     * Returning @c true means filtering-out,
+     * Returning @c false means passing event to Qt. */
+    bool fResult = false; /* Pass to Qt by default. */
     switch (pEvent->type)
     {
         case XFocusOut:
@@ -1263,20 +1547,64 @@ bool UIMachineView::x11Event(XEvent *pEvent)
         case XKeyPress:
         case XKeyRelease:
         {
-            /* Filter using keyboard-filter: */
-            bool fKeyboardFilteringResult = machineLogic()->keyboardHandler()->x11EventFilter(pEvent, screenId());
-            /* Filter using mouse-filter: */
-            bool fMouseFilteringResult = machineLogic()->mouseHandler()->x11EventFilter(pEvent, screenId());
-            /* If at least one of filters wants to filter event out then the result is 'true': */
+            /* Filter using keyboard-filter? */
+            bool fKeyboardFilteringResult =
+                machineLogic()->keyboardHandler()->x11EventFilter(pEvent, screenId());
+            /* Filter using mouse-filter? */
+            bool fMouseFilteringResult =
+                machineLogic()->mouseHandler()->x11EventFilter(pEvent, screenId());
+            /* If at least one of filters wants to filter event out then the result is true. */
             fResult = fKeyboardFilteringResult || fMouseFilteringResult;
             break;
         }
         default:
             break;
     }
-    /* Return result: */
+
     return fResult;
 }
 
-#endif
+#endif /* Q_WS_X11 */
+
+QSize UIMachineView::scaledForward(QSize size) const
+{
+    /* Take the scale-factor into account: */
+    const double dScaleFactor = frameBuffer()->scaleFactor();
+    if (dScaleFactor != 1.0)
+        size = QSize(size.width() * dScaleFactor, size.height() * dScaleFactor);
+
+#ifdef Q_WS_MAC
+    /* Take the backing-scale-factor into account: */
+    if (frameBuffer()->useUnscaledHiDPIOutput())
+    {
+        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
+        if (dBackingScaleFactor > 1.0)
+            size = QSize(size.width() / dBackingScaleFactor, size.height() / dBackingScaleFactor);
+    }
+#endif /* Q_WS_MAC */
+
+    /* Return result: */
+    return size;
+}
+
+QSize UIMachineView::scaledBackward(QSize size) const
+{
+#ifdef Q_WS_MAC
+    /* Take the backing-scale-factor into account: */
+    if (frameBuffer()->useUnscaledHiDPIOutput())
+    {
+        const double dBackingScaleFactor = frameBuffer()->backingScaleFactor();
+        if (dBackingScaleFactor > 1.0)
+            size = QSize(size.width() * dBackingScaleFactor, size.height() * dBackingScaleFactor);
+    }
+#endif /* Q_WS_MAC */
+
+    /* Take the scale-factor into account: */
+    const double dScaleFactor = frameBuffer()->scaleFactor();
+    if (dScaleFactor != 1.0)
+        size = QSize(size.width() / dScaleFactor, size.height() / dScaleFactor);
+
+    /* Return result: */
+    return size;
+}
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
index f3385fc..3f1e9b4 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineView.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineView class declaration
+ * VBox Qt GUI - UIMachineView class declaration.
  */
 
 /*
@@ -24,7 +23,10 @@
 #include <QEventLoop>
 
 /* GUI includes: */
-#include "UIDefs.h"
+#ifdef VBOX_WITH_DRAG_AND_DROP
+# include "UIDnDHandler.h"
+#endif
+#include "UIExtraDataDefs.h"
 #include "UIMachineDefs.h"
 #ifdef Q_WS_MAC
 # include <CoreFoundation/CFBase.h>
@@ -33,17 +35,33 @@
 /* COM includes: */
 #include "COMEnums.h"
 
+/* Other VBox includes: */
+#include "VBox/com/ptr.h"
+
 /* Forward declarations: */
 class UISession;
+class UIActionPool;
 class UIMachineLogic;
 class UIMachineWindow;
 class UIFrameBuffer;
+#ifdef VBOX_WITH_DRAG_AND_DROP
+ class CDnDTarget;
+#endif
 class CSession;
+class CMachine;
+class CConsole;
+class CDisplay;
+class CGuest;
 
 class UIMachineView : public QAbstractScrollArea
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies about frame-buffer resize. */
+    void sigFrameBufferResize();
+
 public:
 
     /** Policy for determining which guest resolutions we wish to
@@ -79,23 +97,19 @@ public:
       * @note Reimplemented in sub-classes. Base implementation does nothing. */
     virtual void adjustGuestScreenSize() {}
 
+    /** Applies machine-view scale-factor. */
+    virtual void applyMachineViewScaleFactor();
+
     /* Framebuffer aspect ratio: */
     double aspectRatio() const;
 
-signals:
-
-    /* Utility signals: */
-    void resizeHintDone();
-
 protected slots:
 
     /* Slot to perform guest resize: */
     void sltPerformGuestResize(const QSize &aSize = QSize());
 
-    /* Handler: Frame-buffer RequestResize stuff: */
-    virtual void sltHandleRequestResize(int iPixelFormat, uchar *pVRAM,
-                                int iBitsPerPixel, int iBytesPerLine,
-                                int iWidth, int iHeight);
+    /* Handler: Frame-buffer NotifyChange stuff: */
+    virtual void sltHandleNotifyChange(int iWidth, int iHeight);
 
     /* Handler: Frame-buffer NotifyUpdate stuff: */
     virtual void sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight);
@@ -109,6 +123,18 @@ protected slots:
     /* Watch dog for desktop resizes: */
     void sltDesktopResized();
 
+    /** Handles the scale-factor change. */
+    void sltHandleScaleFactorChange(const QString &strMachineID);
+
+    /** Handles the scaling-optimization change. */
+    void sltHandleScalingOptimizationChange(const QString &strMachineID);
+
+    /** Handles the HiDPI-optimization change. */
+    void sltHandleHiDPIOptimizationChange(const QString &strMachineID);
+
+    /** Handles the unscaled HiDPI output mode change. */
+    void sltHandleUnscaledHiDPIOutputModeChange(const QString &strMachineID);
+
     /* Console callback handlers: */
     virtual void sltMachineStateChanged();
 
@@ -141,11 +167,24 @@ protected:
     virtual void cleanupFrameBuffer();
     //virtual void cleanupViewport();
 
+    /** Returns the session UI reference. */
+    UISession* uisession() const;
+
+    /** Returns the session reference. */
+    CSession& session() const;
+    /** Returns the session's machine reference. */
+    CMachine& machine() const;
+    /** Returns the session's console reference. */
+    CConsole& console() const;
+    /** Returns the display's display reference. */
+    CDisplay& display() const;
+    /** Returns the console's guest reference. */
+    CGuest& guest() const;
+
     /* Protected getters: */
     UIMachineWindow* machineWindow() const { return m_pMachineWindow; }
+    UIActionPool* actionPool() const;
     UIMachineLogic* machineLogic() const;
-    UISession* uisession() const;
-    CSession& session();
     QSize sizeHint() const;
     int contentsX() const;
     int contentsY() const;
@@ -155,7 +194,6 @@ protected:
     int visibleHeight() const;
     ulong screenId() const { return m_uScreenId; }
     UIFrameBuffer* frameBuffer() const { return m_pFrameBuffer; }
-    const QPixmap& pauseShot() const { return m_pauseShot; }
     /** Atomically store the maximum guest resolution which we currently wish
      * to handle for @a maxGuestSize() to read.  Should be called if anything
      * happens (e.g. a screen hotplug) which might cause the value to change.
@@ -170,15 +208,27 @@ protected:
      */
     QSize guestSizeHint();
 
+    /** Handles machine-view scale changes. */
+    void handleScaleChange();
+
     /* Protected setters: */
     /** Store a guest size hint value to extra data, called on switching to
      * fullscreen. */
-    void storeGuestSizeHint(const QSize &sizeHint);
+    void storeGuestSizeHint(const QSize &size);
+
+    /** Returns the pause-pixmap: */
+    const QPixmap& pausePixmap() const { return m_pausePixmap; }
+    /** Returns the scaled pause-pixmap: */
+    const QPixmap& pausePixmapScaled() const { return m_pausePixmapScaled; }
+    /** Resets the pause-pixmap. */
+    void resetPausePixmap();
+    /** Acquires live pause-pixmap. */
+    void takePausePixmapLive();
+    /** Acquires snapshot pause-pixmap. */
+    void takePausePixmapSnapshot();
+    /** Updates the scaled pause-pixmap. */
+    void updateScaledPausePixmap();
 
-    /* Protected helpers: */
-    virtual void takePauseShotLive();
-    virtual void takePauseShotSnapshot();
-    virtual void resetPauseShot() { m_pauseShot = QPixmap(); }
     /** The available area on the current screen for application windows. */
     virtual QRect workingArea() const = 0;
     /** Calculate how big the guest desktop can be while still fitting on one
@@ -198,9 +248,6 @@ protected:
     UIVisualStateType visualStateType() const;
     /** Is this a fullscreen-type view? */
     bool isFullscreenOrSeamless() const;
-    /** Return a string consisting of @a base with a suffix for the active
-     * virtual monitor.  Used for storing monitor-specific extra data. */
-    QString makeExtraDataKeyPerMonitor(QString base) const;
 
     /* Cross-platforms event processors: */
     bool event(QEvent *pEvent);
@@ -210,12 +257,44 @@ protected:
     void paintEvent(QPaintEvent *pEvent);
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
+    /**
+     * Host -> Guest: Issued when the host cursor enters the guest (VM) window.
+     *                The guest will receive the relative cursor coordinates of the
+     *                appropriate screen ID.
+     *
+     * @param pEvent                Related enter event.
+     */
     void dragEnterEvent(QDragEnterEvent *pEvent);
+
+    /**
+     * Host -> Guest: Issued when the host cursor moves inside (over) the guest (VM) window.
+     *                The guest will receive the relative cursor coordinates of the
+     *                appropriate screen ID.
+     *
+     * @param pEvent                Related move event.
+     */
     void dragLeaveEvent(QDragLeaveEvent *pEvent);
+
+    /**
+     * Host -> Guest: Issued when the host cursor leaves the guest (VM) window again.
+     *                This will ask the guest to stop any further drag'n drop operation.
+     *
+     * @param pEvent                Related leave event.
+     */
     void dragMoveEvent(QDragMoveEvent *pEvent);
-    void dropEvent(QDropEvent *pEvent);
 
-    void handleGHDnd();
+    /**
+     * Guest -> Host: Checks for a pending drag and drop event within the guest
+     *                and (optionally) starts a drag and drop operation on the host.
+     */
+    void dragIsPending(void);
+
+    /**
+     * Host -> Guest: Issued when the host drops data into the guest (VM) window.
+     *
+     * @param pEvent                Related drop event.
+     */
+    void dropEvent(QDropEvent *pEvent);
 #endif /* VBOX_WITH_DRAG_AND_DROP */
 
     /* Platform specific event processors: */
@@ -225,6 +304,11 @@ protected:
     bool x11Event(XEvent *event);
 #endif
 
+    /** Scales passed size forward. */
+    QSize scaledForward(QSize size) const;
+    /** Scales passed size backward. */
+    QSize scaledBackward(QSize size) const;
+
     /* Protected members: */
     UIMachineWindow *m_pMachineWindow;
     ulong m_uScreenId;
@@ -255,18 +339,23 @@ protected:
     bool m_fAccelerate2DVideo : 1;
 #endif /* VBOX_WITH_VIDEOHWACCEL */
 
-    QPixmap m_pauseShot;
+    /** Holds the pause-pixmap. */
+    QPixmap m_pausePixmap;
+    /** Holds the scaled pause-pixmap. */
+    QPixmap m_pausePixmapScaled;
+
+#ifdef VBOX_WITH_DRAG_AND_DROP
+    /** Pointer to drag and drop handler instance. */
+    UIDnDHandler *m_pDnDHandler;
+#endif
 
     /* Friend classes: */
     friend class UIKeyboardHandler;
     friend class UIMouseHandler;
     friend class UIMachineLogic;
     friend class UIFrameBuffer;
-    friend class UIFrameBufferQImage;
-#ifdef VBOX_GUI_USE_QUARTZ2D
-    friend class UIFrameBufferQuartz2D;
-#endif /* VBOX_GUI_USE_QUARTZ2D */
-    template<class, class, class> friend class VBoxOverlayFrameBuffer;
+    friend class UIFrameBufferPrivate;
+    friend class VBoxOverlayFrameBuffer;
 };
 
 /* This maintenance class is a part of future roll-back mechanism.
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
index ce28562..858b2eb 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineWindow.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindow class implementation
+ * VBox Qt GUI - UIMachineWindow class implementation.
  */
 
 /*
@@ -17,37 +15,44 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QCloseEvent>
-#include <QTimer>
-#include <QProcess>
+# include <QCloseEvent>
+# include <QTimer>
+# include <QProcess>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIKeyboardHandler.h"
-#include "UIMachineWindow.h"
-#include "UIMachineLogic.h"
-#include "UIMachineView.h"
-#include "UIMachineWindowNormal.h"
-#include "UIMachineWindowFullscreen.h"
-#include "UIMachineWindowSeamless.h"
-#include "UIMachineWindowScale.h"
-#include "UIMouseHandler.h"
-#include "UISession.h"
-#include "UIVMCloseDialog.h"
-#include "UIConverter.h"
-#include "UIModalWindowManager.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIKeyboardHandler.h"
+# include "UIMachineWindow.h"
+# include "UIMachineLogic.h"
+# include "UIMachineView.h"
+# include "UIMachineWindowNormal.h"
+# include "UIMachineWindowFullscreen.h"
+# include "UIMachineWindowSeamless.h"
+# include "UIMachineWindowScale.h"
+# include "UIMouseHandler.h"
+# include "UISession.h"
+# include "UIVMCloseDialog.h"
+# include "UIConverter.h"
+# include "UIModalWindowManager.h"
+# include "UIExtraDataManager.h"
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CSnapshot.h"
+# include "CConsole.h"
+# include "CSnapshot.h"
 
 /* Other VBox includes: */
-#include <VBox/version.h>
-#ifdef VBOX_BLEEDING_EDGE
-# include <iprt/buildconfig.h>
-#endif /* VBOX_BLEEDING_EDGE */
+# include <VBox/version.h>
+# ifdef VBOX_BLEEDING_EDGE
+#  include <iprt/buildconfig.h>
+# endif /* VBOX_BLEEDING_EDGE */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* External includes: */
 #ifdef Q_WS_X11
@@ -121,11 +126,11 @@ void UIMachineWindow::prepare()
     /* Retranslate window: */
     retranslateUi();
 
+    /* Show (must be done before updating the appearance): */
+    showInNecessaryMode();
+
     /* Update all the elements: */
     updateAppearanceOf(UIVisualElement_AllStuff);
-
-    /* Show: */
-    showInNecessaryMode();
 }
 
 void UIMachineWindow::cleanup()
@@ -188,6 +193,11 @@ UIMachineWindow::UIMachineWindow(UIMachineLogic *pMachineLogic, ulong uScreenId)
 #endif /* !Q_WS_MAC */
 }
 
+UIActionPool* UIMachineWindow::actionPool() const
+{
+    return machineLogic()->actionPool();
+}
+
 UISession* UIMachineWindow::uisession() const
 {
     return machineLogic()->uisession();
@@ -198,25 +208,34 @@ CSession& UIMachineWindow::session() const
     return uisession()->session();
 }
 
-CMachine UIMachineWindow::machine() const
+CMachine& UIMachineWindow::machine() const
 {
-    return session().GetMachine();
+    return uisession()->machine();
+}
+
+CConsole& UIMachineWindow::console() const
+{
+    return uisession()->console();
+}
+
+const QString& UIMachineWindow::machineName() const
+{
+    return uisession()->machineName();
 }
 
 void UIMachineWindow::adjustMachineViewSize()
 {
-    /* By default, the only thing we need is to
-     * adjust guest-screen size if necessary: */
+    /* We need to adjust guest-screen size if necessary: */
     machineView()->adjustGuestScreenSize();
 }
 
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
+#ifdef VBOX_WITH_MASKED_SEAMLESS
 void UIMachineWindow::setMask(const QRegion &region)
 {
     /* Call to base-class: */
     QMainWindow::setMask(region);
 }
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+#endif /* VBOX_WITH_MASKED_SEAMLESS */
 
 void UIMachineWindow::retranslateUi()
 {
@@ -255,24 +274,30 @@ bool UIMachineWindow::x11Event(XEvent *pEvent)
 }
 #endif /* Q_WS_X11 */
 
-void UIMachineWindow::closeEvent(QCloseEvent *pEvent)
+void UIMachineWindow::showEvent(QShowEvent *pShowEvent)
+{
+    /* Call to base class: */
+    QMainWindow::showEvent(pShowEvent);
+
+    /* Update appearance for indicator-pool: */
+    updateAppearanceOf(UIVisualElement_IndicatorPoolStuff);
+}
+
+void UIMachineWindow::closeEvent(QCloseEvent *pCloseEvent)
 {
     /* Always ignore close-event first: */
-    pEvent->ignore();
+    pCloseEvent->ignore();
 
     /* Make sure machine is in one of the allowed states: */
     if (!uisession()->isRunning() && !uisession()->isPaused() && !uisession()->isStuck())
         return;
 
-    /* Get machine: */
-    CMachine m = machine();
-
     /* If there is a close hook script defined: */
-    QString strScript = m.GetExtraData(GUI_CloseActionHook);
+    const QString strScript = gEDataManager->machineCloseHookScript(vboxGlobal().managedVMUuid());
     if (!strScript.isEmpty())
     {
         /* Execute asynchronously and leave: */
-        QProcess::startDetached(strScript, QStringList() << m.GetId());
+        QProcess::startDetached(strScript, QStringList() << machine().GetId());
         return;
     }
 
@@ -287,8 +312,9 @@ void UIMachineWindow::closeEvent(QCloseEvent *pEvent)
     {
         switch (defaultCloseAction)
         {
-            /* If VM is stuck, and the default close-action is 'save-state' or 'shutdown',
+            /* If VM is stuck, and the default close-action is 'detach', 'save-state' or 'shutdown',
              * we should ask the user about what to do: */
+            case MachineCloseAction_Detach:
             case MachineCloseAction_SaveState:
             case MachineCloseAction_Shutdown:
                 closeAction = uisession()->isStuck() ? MachineCloseAction_Invalid : defaultCloseAction;
@@ -305,16 +331,45 @@ void UIMachineWindow::closeEvent(QCloseEvent *pEvent)
     {
         /* Prepare close-dialog: */
         QWidget *pParentDlg = windowManager().realParentWindow(this);
-        QPointer<UIVMCloseDialog> pCloseDlg = new UIVMCloseDialog(pParentDlg, m,
-                                                                  session().GetConsole().GetGuestEnteredACPIMode(),
+        QPointer<UIVMCloseDialog> pCloseDlg = new UIVMCloseDialog(pParentDlg, machine(),
+                                                                  console().GetGuestEnteredACPIMode(),
                                                                   restrictedCloseActions);
 
         /* Make sure close-dialog is valid: */
         if (pCloseDlg->isValid())
         {
-            /* If VM is not paused and not stuck, we should pause it first: */
-            bool fWasPaused = uisession()->isPaused() || uisession()->isStuck();
-            if (fWasPaused || uisession()->pause())
+            /* We are going to show close-dialog: */
+            bool fShowCloseDialog = true;
+            /* Check if VM is paused or stuck: */
+            const bool fWasPaused = uisession()->isPaused();
+            const bool fIsStuck = uisession()->isStuck();
+            /* If VM is NOT paused and NOT stuck: */
+            if (!fWasPaused && !fIsStuck)
+            {
+                /* We should pause it first: */
+                const bool fIsPaused = uisession()->pause();
+                /* If we were unable to pause VM: */
+                if (!fIsPaused)
+                {
+                    /* If that is NOT the separate VM process UI: */
+                    if (!vboxGlobal().isSeparateProcess())
+                    {
+                        /* We are not going to show close-dialog: */
+                        fShowCloseDialog = false;
+                    }
+                    /* If that is the separate VM process UI: */
+                    else
+                    {
+                        /* We are going to show close-dialog only
+                         * if headless frontend stopped/killed already: */
+                        CMachine machine = uisession()->machine();
+                        KMachineState machineState = machine.GetState();
+                        fShowCloseDialog = !machine.isOk() || machineState == KMachineState_Null;
+                    }
+                }
+            }
+            /* If we are going to show close-dialog: */
+            if (fShowCloseDialog)
             {
                 /* Show close-dialog to let the user make the choice: */
                 windowManager().registerNewParent(pCloseDlg, pParentDlg);
@@ -328,6 +383,7 @@ void UIMachineWindow::closeEvent(QCloseEvent *pEvent)
                  * we should resume it if user canceled dialog or chosen shutdown: */
                 if (!fWasPaused && uisession()->isPaused() &&
                     (closeAction == MachineCloseAction_Invalid ||
+                     closeAction == MachineCloseAction_Detach ||
                      closeAction == MachineCloseAction_Shutdown))
                 {
                     /* If we unable to resume VM, cancel closing: */
@@ -349,6 +405,12 @@ void UIMachineWindow::closeEvent(QCloseEvent *pEvent)
     /* Depending on chosen result: */
     switch (closeAction)
     {
+        case MachineCloseAction_Detach:
+        {
+            /* Just close Runtime UI: */
+            uisession()->closeRuntimeUI();
+            break;
+        }
         case MachineCloseAction_SaveState:
         {
             /* Save VM state: */
@@ -421,6 +483,9 @@ void UIMachineWindow::prepareMachineView()
 #endif /* VBOX_WITH_VIDEOHWACCEL */
                                            );
 
+    /* Listen for frame-buffer resize: */
+    connect(m_pMachineView, SIGNAL(sigFrameBufferResize()), this, SIGNAL(sigFrameBufferResize()));
+
     /* Add machine-view into main-layout: */
     m_pMainLayout->addWidget(m_pMachineView, 1, 1, viewAlignment(visualStateType));
 
@@ -458,18 +523,16 @@ void UIMachineWindow::updateAppearanceOf(int iElement)
     /* Update window title: */
     if (iElement & UIVisualElement_WindowTitle)
     {
-        /* Get machine: */
-        const CMachine &m = machine();
         /* Get machine state: */
         KMachineState state = uisession()->machineState();
         /* Prepare full name: */
         QString strSnapshotName;
-        if (m.GetSnapshotCount() > 0)
+        if (machine().GetSnapshotCount() > 0)
         {
-            CSnapshot snapshot = m.GetCurrentSnapshot();
+            CSnapshot snapshot = machine().GetCurrentSnapshot();
             strSnapshotName = " (" + snapshot.GetName() + ")";
         }
-        QString strMachineName = m.GetName() + strSnapshotName;
+        QString strMachineName = machineName() + strSnapshotName;
         if (state != KMachineState_Null)
             strMachineName += " [" + gpConverter->toString(state) + "]";
         /* Unusual on the Mac. */
@@ -477,7 +540,7 @@ void UIMachineWindow::updateAppearanceOf(int iElement)
         const QString strUserProductName = uisession()->machineWindowNamePostfix();
         strMachineName += " - " + (strUserProductName.isEmpty() ? defaultWindowTitle() : strUserProductName);
 #endif /* !Q_WS_MAC */
-        if (m.GetMonitorCount() > 1)
+        if (machine().GetMonitorCount() > 1)
             strMachineName += QString(" : %1").arg(m_uScreenId + 1);
         setWindowTitle(strMachineName);
     }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
index dffc9ea..921c359 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineWindow.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindow class declaration
+ * VBox Qt GUI - UIMachineWindow class declaration.
  */
 
 /*
@@ -24,7 +23,7 @@
 
 /* GUI includes: */
 #include "QIWithRetranslateUI.h"
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
 
 /* COM includes: */
 #include "COMEnums.h"
@@ -38,12 +37,18 @@ class CSession;
 class UISession;
 class UIMachineLogic;
 class UIMachineView;
+class UIActionPool;
 
 /* Machine-window interface: */
 class UIMachineWindow : public QIWithRetranslateUI2<QMainWindow>
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies about frame-buffer resize. */
+    void sigFrameBufferResize();
+
 public:
 
     /* Factory functions to create/destroy machine-window: */
@@ -58,9 +63,18 @@ public:
     ulong screenId() const { return m_uScreenId; }
     UIMachineView* machineView() const { return m_pMachineView; }
     UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
+    UIActionPool* actionPool() const;
     UISession* uisession() const;
+
+    /** Returns the session reference. */
     CSession& session() const;
-    CMachine machine() const;
+    /** Returns the session's machine reference. */
+    CMachine& machine() const;
+    /** Returns the session's console reference. */
+    CConsole& console() const;
+
+    /** Returns the machine name. */
+    const QString& machineName() const;
 
     /** Adjusts machine-window size to correspond current machine-view size.
       * @param fAdjustPosition determines whether is it necessary to adjust position too.
@@ -70,10 +84,10 @@ public:
     /** Adjusts machine-view size to correspond current machine-window size. */
     virtual void adjustMachineViewSize();
 
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
+#ifdef VBOX_WITH_MASKED_SEAMLESS
     /* Virtual caller for base class setMask: */
     virtual void setMask(const QRegion &region);
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+#endif /* VBOX_WITH_MASKED_SEAMLESS */
 
 protected slots:
 
@@ -93,9 +107,15 @@ protected:
 
     /* Event handlers: */
 #ifdef Q_WS_X11
+    /** X11: Native event handler. */
     bool x11Event(XEvent *pEvent);
 #endif /* Q_WS_X11 */
-    void closeEvent(QCloseEvent *pEvent);
+
+    /** Show event handler. */
+    void showEvent(QShowEvent *pShowEvent);
+
+    /** Close event handler. */
+    void closeEvent(QCloseEvent *pCloseEvent);
 
 #ifdef Q_WS_MAC
     /** Mac OS X: Handles native notifications.
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
new file mode 100644
index 0000000..f852053
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.cpp
@@ -0,0 +1,1037 @@
+/* $Id: UIMenuBarEditorWindow.cpp $ */
+/** @file
+ * VBox Qt GUI - UIMenuBarEditorWindow class implementation.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QHBoxLayout>
+# include <QPaintEvent>
+# include <QMetaEnum>
+# include <QMenuBar>
+# include <QPainter>
+# include <QMenu>
+# ifndef Q_WS_MAC
+#  include <QCheckBox>
+# endif /* !Q_WS_MAC */
+
+/* GUI includes: */
+# include "UIMenuBarEditorWindow.h"
+# include "UIActionPoolRuntime.h"
+# include "UIExtraDataManager.h"
+# include "UIMachineWindow.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
+# include "UIToolBar.h"
+# include "QIToolButton.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+UIMenuBarEditorWidget::UIMenuBarEditorWidget(QWidget *pParent,
+                                             bool fStartedFromVMSettings /* = true */,
+                                             const QString &strMachineID /* = QString() */,
+                                             UIActionPool *pActionPool /* = 0 */)
+    : QIWithRetranslateUI2<QWidget>(pParent)
+    , m_fPrepared(false)
+    , m_fStartedFromVMSettings(fStartedFromVMSettings)
+    , m_strMachineID(strMachineID)
+    , m_pActionPool(pActionPool)
+    , m_pMainLayout(0)
+    , m_pToolBar(0)
+    , m_pButtonClose(0)
+#ifndef Q_WS_MAC
+    , m_pCheckBoxEnable(0)
+#endif /* !Q_WS_MAC */
+{
+    /* Prepare: */
+    prepare();
+}
+
+void UIMenuBarEditorWidget::setMachineID(const QString &strMachineID)
+{
+    /* Remember new machine ID: */
+    m_strMachineID = strMachineID;
+    /* Prepare: */
+    prepare();
+}
+
+void UIMenuBarEditorWidget::setActionPool(UIActionPool *pActionPool)
+{
+    /* Remember new action-pool: */
+    m_pActionPool = pActionPool;
+    /* Prepare: */
+    prepare();
+}
+
+void UIMenuBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (machineID() != strMachineID)
+        return;
+
+#ifndef Q_WS_MAC
+    /* Update enable-checkbox: */
+    updateEnableCheckbox();
+#endif /* !Q_WS_MAC */
+
+    /* Update menus: */
+    updateMenus();
+}
+
+#ifndef RT_OS_DARWIN
+void UIMenuBarEditorWidget::sltHandleMenuBarEnableToggle(bool fEnabled)
+{
+    /* Toggle enable-checkbox if necessary: */
+    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
+    {
+        /* Check whether this value is really changed: */
+        const bool fMenuBarEnabled = gEDataManager->menuBarEnabled(machineID());
+        if (fMenuBarEnabled != fEnabled)
+        {
+            /* Set new value: */
+            gEDataManager->setMenuBarEnabled(fEnabled, machineID());
+        }
+    }
+}
+#endif /* !RT_OS_DARWIN */
+
+void UIMenuBarEditorWidget::sltHandleMenuBarMenuClick()
+{
+    /* Make sure sender is valid: */
+    QAction *pAction = qobject_cast<QAction*>(sender());
+    AssertPtrReturnVoid(pAction);
+
+    /* Depending on triggered action class: */
+    switch (pAction->property("class").toInt())
+    {
+        case UIExtraDataMetaDefs::MenuType_All:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::MenuType type =
+                static_cast<UIExtraDataMetaDefs::MenuType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::MenuType restrictions = gEDataManager->restrictedRuntimeMenuTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::MenuType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuTypes(restrictions, machineID());
+            break;
+        }
+        case UIExtraDataMetaDefs::MenuType_Application:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::MenuApplicationActionType type =
+                static_cast<UIExtraDataMetaDefs::MenuApplicationActionType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::MenuApplicationActionType restrictions = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::MenuApplicationActionType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuApplicationActionTypes(restrictions, machineID());
+            break;
+        }
+        case UIExtraDataMetaDefs::MenuType_Machine:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::RuntimeMenuMachineActionType type =
+                static_cast<UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictions = gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::RuntimeMenuMachineActionType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuMachineActionTypes(restrictions, machineID());
+            break;
+        }
+        case UIExtraDataMetaDefs::MenuType_View:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::RuntimeMenuViewActionType type =
+                static_cast<UIExtraDataMetaDefs::RuntimeMenuViewActionType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictions = gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuViewActionTypes(restrictions, machineID());
+            break;
+        }
+        case UIExtraDataMetaDefs::MenuType_Input:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::RuntimeMenuInputActionType type =
+                static_cast<UIExtraDataMetaDefs::RuntimeMenuInputActionType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictions = gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::RuntimeMenuInputActionType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuInputActionTypes(restrictions, machineID());
+            break;
+        }
+        case UIExtraDataMetaDefs::MenuType_Devices:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType type =
+                static_cast<UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictions = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuDevicesActionTypes(restrictions, machineID());
+            break;
+        }
+#ifdef VBOX_WITH_DEBUGGER_GUI
+        case UIExtraDataMetaDefs::MenuType_Debug:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType type =
+                static_cast<UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictions = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuDebuggerActionTypes(restrictions, machineID());
+            break;
+        }
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+        case UIExtraDataMetaDefs::MenuType_Window:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::MenuWindowActionType type =
+                static_cast<UIExtraDataMetaDefs::MenuWindowActionType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::MenuWindowActionType restrictions = gEDataManager->restrictedRuntimeMenuWindowActionTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::MenuWindowActionType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuWindowActionTypes(restrictions, machineID());
+            break;
+        }
+#endif /* Q_WS_MAC */
+        case UIExtraDataMetaDefs::MenuType_Help:
+        {
+            /* Get sender type: */
+            const UIExtraDataMetaDefs::MenuHelpActionType type =
+                static_cast<UIExtraDataMetaDefs::MenuHelpActionType>(pAction->property("type").toInt());
+            /* Load current menu-bar restrictions: */
+            UIExtraDataMetaDefs::MenuHelpActionType restrictions = gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID());
+            /* Invert restriction for sender type: */
+            restrictions = (UIExtraDataMetaDefs::MenuHelpActionType)(restrictions ^ type);
+            /* Save updated menu-bar restrictions: */
+            gEDataManager->setRestrictedRuntimeMenuHelpActionTypes(restrictions, machineID());
+            break;
+        }
+        default: break;
+    }
+}
+
+void UIMenuBarEditorWidget::prepare()
+{
+    /* Do nothing if already prepared: */
+    if (m_fPrepared)
+        return;
+
+    /* Do not prepare if machine ID or action-pool is not set: */
+    if (m_strMachineID.isEmpty() || !m_pActionPool)
+        return;
+
+    /* Create main-layout: */
+    m_pMainLayout = new QHBoxLayout(this);
+    AssertPtrReturnVoid(m_pMainLayout);
+    {
+        /* Configure main-layout: */
+        int iLeft, iTop, iRight, iBottom;
+        m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom);
+        /* Standard margins should not be too big: */
+        iLeft   = qMin(iLeft,   10);
+        iTop    = qMin(iTop,    10);
+        iRight  = qMin(iRight,  10);
+        iBottom = qMin(iBottom, 10);
+        /* Top margin should be smaller for the common case: */
+        if (iTop >= 5)
+            iTop -= 5;
+#ifndef Q_WS_MAC
+        /* Right margin should be bigger for the settings case: */
+        if (m_fStartedFromVMSettings)
+            iRight += 5;
+#endif /* !Q_WS_MAC */
+        /* Apply margins/spacing finally: */
+        m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom);
+        m_pMainLayout->setSpacing(0);
+        /* Create tool-bar: */
+        m_pToolBar = new UIToolBar;
+        AssertPtrReturnVoid(m_pToolBar);
+        {
+            /* Prepare menus: */
+            prepareMenus();
+            /* Add tool-bar into main-layout: */
+            m_pMainLayout->addWidget(m_pToolBar);
+        }
+        /* Insert stretch: */
+        m_pMainLayout->addStretch();
+        /* Create close-button if necessary: */
+        if (!m_fStartedFromVMSettings)
+        {
+            m_pButtonClose = new QIToolButton;
+            AssertPtrReturnVoid(m_pButtonClose);
+            {
+                /* Configure close-button: */
+                m_pButtonClose->setFocusPolicy(Qt::StrongFocus);
+                m_pButtonClose->setShortcut(Qt::Key_Escape);
+                m_pButtonClose->setIcon(UIIconPool::iconSet(":/ok_16px.png"));
+                connect(m_pButtonClose, SIGNAL(clicked(bool)), this, SIGNAL(sigCancelClicked()));
+                /* Add close-button into main-layout: */
+                m_pMainLayout->addWidget(m_pButtonClose);
+            }
+        }
+#ifndef Q_WS_MAC
+        /* Create enable-checkbox if necessary: */
+        else
+        {
+            m_pCheckBoxEnable = new QCheckBox;
+            AssertPtrReturnVoid(m_pCheckBoxEnable);
+            {
+                /* Configure enable-checkbox: */
+                m_pCheckBoxEnable->setFocusPolicy(Qt::StrongFocus);
+                connect(m_pCheckBoxEnable, SIGNAL(toggled(bool)), this, SLOT(sltHandleMenuBarEnableToggle(bool)));
+                /* Add enable-checkbox into main-layout: */
+                m_pMainLayout->addWidget(m_pCheckBoxEnable);
+                /* Update enable-checkbox: */
+                updateEnableCheckbox();
+            }
+        }
+#endif /* !Q_WS_MAC */
+    }
+
+    /* Mark as prepared: */
+    m_fPrepared = true;
+
+    /* Translate contents: */
+    retranslateUi();
+}
+
+void UIMenuBarEditorWidget::prepareMenus()
+{
+    /* Create menus: */
+    prepareMenuApplication();
+    prepareMenuMachine();
+    prepareMenuView();
+    prepareMenuInput();
+    prepareMenuDevices();
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    prepareMenuDebug();
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+    prepareMenuWindow();
+#endif /* Q_WS_MAC */
+    prepareMenuHelp();
+
+    /* Listen for the menu-bar configuration changes: */
+    connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
+            this, SLOT(sltHandleConfigurationChange(const QString&)));
+
+    /* Update menus: */
+    updateMenus();
+}
+
+#ifdef Q_WS_MAC
+QMenu* UIMenuBarEditorWidget::prepareNamedMenu(const QString &strName)
+{
+    /* Create named menu: */
+    QMenu *pNamedMenu = new QMenu(strName, m_pToolBar);
+    AssertPtrReturn(pNamedMenu, 0);
+    {
+        /* Configure named menu: */
+        pNamedMenu->setProperty("class", UIExtraDataMetaDefs::MenuType_Application);
+        /* Get named menu action: */
+        QAction *pNamedMenuAction = pNamedMenu->menuAction();
+        AssertPtrReturn(pNamedMenuAction, 0);
+        {
+            /* Add menu action into tool-bar: */
+            m_pToolBar->addAction(pNamedMenuAction);
+            /* Get named menu tool-button: */
+            QToolButton *pNamedMenuToolButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pNamedMenuAction));
+            AssertPtrReturn(pNamedMenuToolButton, 0);
+            {
+                /* Configure named menu tool-button: */
+                pNamedMenuToolButton->setPopupMode(QToolButton::MenuButtonPopup);
+                pNamedMenuToolButton->setAutoRaise(true);
+                /* Create spacing after named menu tool-button: */
+                QWidget *pSpacing = new QWidget;
+                AssertPtrReturn(pSpacing, 0);
+                {
+                    /* Configure spacing: */
+                    pSpacing->setFixedSize(5, 1);
+                    /* Add spacing into tool-bar: */
+                    m_pToolBar->addWidget(pSpacing);
+                }
+            }
+        }
+    }
+    /* Return named menu: */
+    return pNamedMenu;
+}
+#endif /* Q_WS_MAC */
+
+QMenu* UIMenuBarEditorWidget::prepareCopiedMenu(const UIAction *pAction)
+{
+    /* Create copied menu: */
+    QMenu *pCopiedMenu = new QMenu(pAction->name(), m_pToolBar);
+    AssertPtrReturn(pCopiedMenu, 0);
+    {
+        /* Configure copied menu: */
+        pCopiedMenu->setProperty("class", pAction->extraDataID());
+        /* Get copied menu action: */
+        QAction *pCopiedMenuAction = pCopiedMenu->menuAction();
+        AssertPtrReturn(pCopiedMenuAction, 0);
+        {
+            /* Configure copied menu action: */
+            pCopiedMenuAction->setCheckable(true);
+            pCopiedMenuAction->setProperty("class", UIExtraDataMetaDefs::MenuType_All);
+            pCopiedMenuAction->setProperty("type", pAction->extraDataID());
+            connect(pCopiedMenuAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
+            m_actions.insert(pAction->extraDataKey(), pCopiedMenuAction);
+            /* Add menu action into tool-bar: */
+            m_pToolBar->addAction(pCopiedMenuAction);
+            /* Get copied menu tool-button: */
+            QToolButton *pCopiedMenuToolButton = qobject_cast<QToolButton*>(m_pToolBar->widgetForAction(pCopiedMenuAction));
+            AssertPtrReturn(pCopiedMenuToolButton, 0);
+            {
+                /* Configure copied menu tool-button: */
+                pCopiedMenuToolButton->setPopupMode(QToolButton::MenuButtonPopup);
+                pCopiedMenuToolButton->setAutoRaise(true);
+                /* Create spacing after copied menu tool-button: */
+                QWidget *pSpacing = new QWidget;
+                AssertPtrReturn(pSpacing, 0);
+                {
+                    /* Configure spacing: */
+                    pSpacing->setFixedSize(5, 1);
+                    /* Add spacing into tool-bar: */
+                    m_pToolBar->addWidget(pSpacing);
+                }
+            }
+        }
+    }
+    /* Return copied menu: */
+    return pCopiedMenu;
+}
+
+#if 0
+QMenu* UIMenuBarEditorWidget::prepareCopiedSubMenu(QMenu *pMenu, const UIAction *pAction)
+{
+    /* Create copied sub-menu: */
+    QMenu *pCopiedMenu = pMenu->addMenu(pAction->name());
+    AssertPtrReturn(pCopiedMenu, 0);
+    {
+        /* Configure copied sub-menu: */
+        pCopiedMenu->setProperty("class", pMenu->property("class"));
+        /* Get copied sub-menu action: */
+        QAction *pCopiedMenuAction = pCopiedMenu->menuAction();
+        AssertPtrReturn(pCopiedMenuAction, 0);
+        {
+            /* Configure copied sub-menu: */
+            pCopiedMenuAction->setCheckable(true);
+            pCopiedMenuAction->setProperty("class", pCopiedMenu->property("class"));
+            pCopiedMenuAction->setProperty("type", pAction->extraDataID());
+            connect(pCopiedMenuAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
+            m_actions.insert(pAction->extraDataKey(), pCopiedMenuAction);
+        }
+    }
+    /* Return copied sub-menu: */
+    return pCopiedMenu;
+}
+#endif
+
+QAction* UIMenuBarEditorWidget::prepareNamedAction(QMenu *pMenu, const QString &strName,
+                                                   int iExtraDataID, const QString &strExtraDataID)
+{
+    /* Create copied action: */
+    QAction *pCopiedAction = pMenu->addAction(strName);
+    AssertPtrReturn(pCopiedAction, 0);
+    {
+        /* Configure copied action: */
+        pCopiedAction->setCheckable(true);
+        pCopiedAction->setProperty("class", pMenu->property("class"));
+        pCopiedAction->setProperty("type", iExtraDataID);
+        connect(pCopiedAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
+        m_actions.insert(strExtraDataID, pCopiedAction);
+    }
+    /* Return copied action: */
+    return pCopiedAction;
+}
+
+QAction* UIMenuBarEditorWidget::prepareCopiedAction(QMenu *pMenu, const UIAction *pAction)
+{
+    /* Create copied action: */
+    QAction *pCopiedAction = pMenu->addAction(pAction->name());
+    AssertPtrReturn(pCopiedAction, 0);
+    {
+        /* Configure copied action: */
+        pCopiedAction->setCheckable(true);
+        pCopiedAction->setProperty("class", pMenu->property("class"));
+        pCopiedAction->setProperty("type", pAction->extraDataID());
+        connect(pCopiedAction, SIGNAL(triggered(bool)), this, SLOT(sltHandleMenuBarMenuClick()));
+        m_actions.insert(pAction->extraDataKey(), pCopiedAction);
+    }
+    /* Return copied action: */
+    return pCopiedAction;
+}
+
+void UIMenuBarEditorWidget::prepareMenuApplication()
+{
+    /* Copy menu: */
+#ifdef Q_WS_MAC
+    QMenu *pMenu = prepareNamedMenu("Application");
+#else /* !Q_WS_MAC */
+    QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_M_Application));
+#endif /* !Q_WS_MAC */
+    AssertPtrReturnVoid(pMenu);
+    {
+#ifdef Q_WS_MAC
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_About));
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_NetworkAccessManager));
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_ResetWarnings));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_Preferences));
+#else /* !Q_WS_MAC */
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_Preferences));
+        pMenu->addSeparator();
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_NetworkAccessManager));
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Application_S_ResetWarnings));
+#endif /* !Q_WS_MAC */
+    }
+}
+
+void UIMenuBarEditorWidget::prepareMenuMachine()
+{
+    /* Copy menu: */
+    QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Machine));
+    AssertPtrReturnVoid(pMenu);
+    {
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Settings));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_TakeSnapshot));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_ShowInformation));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_T_Pause));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Reset));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_SaveState));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_Shutdown));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Machine_S_PowerOff));
+    }
+}
+
+void UIMenuBarEditorWidget::prepareMenuView()
+{
+    /* Copy menu: */
+    QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_View));
+    AssertPtrReturnVoid(pMenu);
+    {
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_Seamless));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_Scale));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_AdjustWindow));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_S_TakeScreenshot));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_MenuBar));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_StatusBar));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_View_M_ScaleFactor));
+        prepareNamedAction(pMenu, tr("Virtual Screen Resize"),
+                           UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize,
+                           gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize));
+        prepareNamedAction(pMenu, tr("Virtual Screen Mapping"),
+                           UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen,
+                           gpConverter->toInternalString(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen));
+    }
+}
+
+void UIMenuBarEditorWidget::prepareMenuInput()
+{
+    /* Copy menu: */
+    QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Input));
+    AssertPtrReturnVoid(pMenu);
+    {
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration));
+    }
+}
+
+void UIMenuBarEditorWidget::prepareMenuDevices()
+{
+    /* Copy menu: */
+    QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Devices));
+    AssertPtrReturnVoid(pMenu);
+    {
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_Network));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_WebCams));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_SharedClipboard));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_M_DragAndDrop));
+        pMenu->addSeparator();
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Devices_S_InstallGuestTools));
+    }
+}
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+void UIMenuBarEditorWidget::prepareMenuDebug()
+{
+    /* Copy menu: */
+    QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndexRT_M_Debug));
+    AssertPtrReturnVoid(pMenu);
+    {
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Debug_S_ShowStatistics));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Debug_S_ShowCommandLine));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Debug_T_Logging));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndexRT_M_Debug_S_ShowLogDialog));
+    }
+}
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef Q_WS_MAC
+void UIMenuBarEditorWidget::prepareMenuWindow()
+{
+    /* Copy menu: */
+    QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_M_Window));
+    AssertPtrReturnVoid(pMenu);
+    {
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_M_Window_S_Minimize));
+        pMenu->addSeparator();
+        prepareNamedAction(pMenu, tr("Switch"),
+                           UIExtraDataMetaDefs::MenuWindowActionType_Switch,
+                           gpConverter->toInternalString(UIExtraDataMetaDefs::MenuWindowActionType_Switch));
+    }
+}
+#endif /* Q_WS_MAC */
+
+void UIMenuBarEditorWidget::prepareMenuHelp()
+{
+    /* Copy menu: */
+    QMenu *pMenu = prepareCopiedMenu(actionPool()->action(UIActionIndex_Menu_Help));
+    AssertPtrReturnVoid(pMenu);
+    {
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_Contents));
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_WebSite));
+        pMenu->addSeparator();
+#ifndef Q_WS_MAC
+        prepareCopiedAction(pMenu, actionPool()->action(UIActionIndex_Simple_About));
+#endif /* !Q_WS_MAC */
+    }
+}
+
+#ifndef Q_WS_MAC
+void UIMenuBarEditorWidget::updateEnableCheckbox()
+{
+    /* Update enable-checkbox if necessary: */
+    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
+    {
+        m_pCheckBoxEnable->blockSignals(true);
+        m_pCheckBoxEnable->setChecked(gEDataManager->menuBarEnabled(machineID()));
+        m_pCheckBoxEnable->blockSignals(false);
+    }
+}
+#endif /* !Q_WS_MAC */
+
+void UIMenuBarEditorWidget::updateMenus()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::MenuType restrictionsMenuBar = gEDataManager->restrictedRuntimeMenuTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::MenuType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("MenuType");
+    const QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::MenuType enumValue =
+            static_cast<const UIExtraDataMetaDefs::MenuType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip MenuType_Invalid & MenuType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::MenuType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::MenuType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuBar & enumValue));
+    }
+
+    /* Update known menu-bar menus: */
+    updateMenuApplication();
+    updateMenuMachine();
+    updateMenuView();
+    updateMenuInput();
+    updateMenuDevices();
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    updateMenuDebug();
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+    updateMenuWindow();
+#endif /* Q_WS_MAC */
+    updateMenuHelp();
+}
+
+void UIMenuBarEditorWidget::updateMenuApplication()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::MenuApplicationActionType restrictionsMenuApplication = gEDataManager->restrictedRuntimeMenuApplicationActionTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::MenuApplicationActionType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("MenuApplicationActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::MenuApplicationActionType enumValue =
+            static_cast<const UIExtraDataMetaDefs::MenuApplicationActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip MenuApplicationActionType_Invalid & MenuApplicationActionType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::MenuApplicationActionType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuApplication & enumValue));
+    }
+}
+
+void UIMenuBarEditorWidget::updateMenuMachine()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::RuntimeMenuMachineActionType restrictionsMenuMachine = gEDataManager->restrictedRuntimeMenuMachineActionTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::RuntimeMenuMachineActionType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuMachineActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::RuntimeMenuMachineActionType enumValue =
+            static_cast<const UIExtraDataMetaDefs::RuntimeMenuMachineActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip RuntimeMenuMachineActionType_Invalid & RuntimeMenuMachineActionType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::RuntimeMenuMachineActionType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuMachine & enumValue));
+    }
+}
+
+void UIMenuBarEditorWidget::updateMenuView()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionsMenuView = gEDataManager->restrictedRuntimeMenuViewActionTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::RuntimeMenuViewActionType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuViewActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::RuntimeMenuViewActionType enumValue =
+            static_cast<const UIExtraDataMetaDefs::RuntimeMenuViewActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip RuntimeMenuViewActionType_Invalid & RuntimeMenuViewActionType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::RuntimeMenuViewActionType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuView & enumValue));
+    }
+}
+
+void UIMenuBarEditorWidget::updateMenuInput()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::RuntimeMenuInputActionType restrictionsMenuInput = gEDataManager->restrictedRuntimeMenuInputActionTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::RuntimeMenuInputActionType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuInputActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::RuntimeMenuInputActionType enumValue =
+            static_cast<const UIExtraDataMetaDefs::RuntimeMenuInputActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip RuntimeMenuInputActionType_Invalid & RuntimeMenuInputActionType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::RuntimeMenuInputActionType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuInput & enumValue));
+    }
+}
+
+void UIMenuBarEditorWidget::updateMenuDevices()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionsMenuDevices = gEDataManager->restrictedRuntimeMenuDevicesActionTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDevicesActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType enumValue =
+            static_cast<const UIExtraDataMetaDefs::RuntimeMenuDevicesActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip RuntimeMenuDevicesActionType_Invalid & RuntimeMenuDevicesActionType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuDevices & enumValue));
+    }
+}
+
+#ifdef VBOX_WITH_DEBUGGER_GUI
+void UIMenuBarEditorWidget::updateMenuDebug()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType restrictionsMenuDebug = gEDataManager->restrictedRuntimeMenuDebuggerActionTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("RuntimeMenuDebuggerActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType enumValue =
+            static_cast<const UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip RuntimeMenuDebuggerActionType_Invalid & RuntimeMenuDebuggerActionType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::RuntimeMenuDebuggerActionType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuDebug & enumValue));
+    }
+}
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+
+#ifdef Q_WS_MAC
+void UIMenuBarEditorWidget::updateMenuWindow()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::MenuWindowActionType restrictionsMenuWindow = gEDataManager->restrictedRuntimeMenuWindowActionTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::MenuWindowActionType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("MenuWindowActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::MenuWindowActionType enumValue =
+            static_cast<const UIExtraDataMetaDefs::MenuWindowActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip MenuWindowActionType_Invalid & MenuWindowActionType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::MenuWindowActionType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::MenuWindowActionType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuWindow & enumValue));
+    }
+}
+#endif /* Q_WS_MAC */
+
+void UIMenuBarEditorWidget::updateMenuHelp()
+{
+    /* Recache menu-bar configuration: */
+    const UIExtraDataMetaDefs::MenuHelpActionType restrictionsMenuHelp = gEDataManager->restrictedRuntimeMenuHelpActionTypes(machineID());
+    /* Get static meta-object: */
+    const QMetaObject &smo = UIExtraDataMetaDefs::staticMetaObject;
+
+    /* We have UIExtraDataMetaDefs::MenuHelpActionType enum registered, so we can enumerate it: */
+    const int iEnumIndex = smo.indexOfEnumerator("MenuHelpActionType");
+    QMetaEnum metaEnum = smo.enumerator(iEnumIndex);
+    /* Handle other enum-values: */
+    for (int iKeyIndex = 0; iKeyIndex < metaEnum.keyCount(); ++iKeyIndex)
+    {
+        /* Get iterated enum-value: */
+        const UIExtraDataMetaDefs::MenuHelpActionType enumValue =
+            static_cast<const UIExtraDataMetaDefs::MenuHelpActionType>(metaEnum.keyToValue(metaEnum.key(iKeyIndex)));
+        /* Skip MenuHelpActionType_Invalid & MenuHelpActionType_All enum-value: */
+        if (enumValue == UIExtraDataMetaDefs::MenuHelpActionType_Invalid ||
+            enumValue == UIExtraDataMetaDefs::MenuHelpActionType_All)
+            continue;
+        /* Which key required action registered under? */
+        const QString strKey = gpConverter->toInternalString(enumValue);
+        if (!m_actions.contains(strKey))
+            continue;
+        /* Update action 'checked' state: */
+        m_actions.value(strKey)->setChecked(!(restrictionsMenuHelp & enumValue));
+    }
+}
+
+void UIMenuBarEditorWidget::retranslateUi()
+{
+    /* Translate close-button if necessary: */
+    if (!m_fStartedFromVMSettings && m_pButtonClose)
+        m_pButtonClose->setToolTip(tr("Close"));
+#ifndef Q_WS_MAC
+    /* Translate enable-checkbox if necessary: */
+    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
+        m_pCheckBoxEnable->setToolTip(tr("Enable Menu Bar"));
+#endif /* !Q_WS_MAC */
+}
+
+void UIMenuBarEditorWidget::paintEvent(QPaintEvent*)
+{
+    /* Prepare painter: */
+    QPainter painter(this);
+
+    /* Prepare palette colors: */
+    const QPalette pal = palette();
+    QColor color0 = pal.color(QPalette::Window);
+    QColor color1 = pal.color(QPalette::Window).lighter(110);
+    color1.setAlpha(0);
+    QColor color2 = pal.color(QPalette::Window).darker(200);
+#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+    QColor color3 = pal.color(QPalette::Window).darker(120);
+#endif /* Q_WS_WIN || Q_WS_X11 */
+
+    /* Left corner: */
+    QRadialGradient grad1(QPointF(5, height() - 5), 5);
+    {
+        grad1.setColorAt(0, color2);
+        grad1.setColorAt(1, color1);
+    }
+    /* Right corner: */
+    QRadialGradient grad2(QPointF(width() - 5, height() - 5), 5);
+    {
+        grad2.setColorAt(0, color2);
+        grad2.setColorAt(1, color1);
+    }
+    /* Bottom line: */
+    QLinearGradient grad3(QPointF(5, height()), QPointF(5, height() - 5));
+    {
+        grad3.setColorAt(0, color1);
+        grad3.setColorAt(1, color2);
+    }
+    /* Left line: */
+    QLinearGradient grad4(QPointF(0, height() - 5), QPointF(5, height() - 5));
+    {
+        grad4.setColorAt(0, color1);
+        grad4.setColorAt(1, color2);
+    }
+    /* Right line: */
+    QLinearGradient grad5(QPointF(width(), height() - 5), QPointF(width() - 5, height() - 5));
+    {
+        grad5.setColorAt(0, color1);
+        grad5.setColorAt(1, color2);
+    }
+
+    /* Paint shape/shadow: */
+    painter.fillRect(QRect(5, 0, width() - 5 * 2, height() - 5), color0); // background
+    painter.fillRect(QRect(0,           height() - 5, 5, 5), grad1); // left corner
+    painter.fillRect(QRect(width() - 5, height() - 5, 5, 5), grad2); // right corner
+    painter.fillRect(QRect(5, height() - 5, width() - 5 * 2, 5), grad3); // bottom line
+    painter.fillRect(QRect(0,           0, 5, height() - 5), grad4); // left line
+    painter.fillRect(QRect(width() - 5, 0, 5, height() - 5), grad5); // right line
+
+#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+    /* Paint frames: */
+    painter.save();
+    painter.setPen(color3);
+    painter.drawLine(QLine(QPoint(5 + 1, 0),                                  QPoint(5 + 1, height() - 1 - 5 - 1)));
+    painter.drawLine(QLine(QPoint(5 + 1, height() - 1 - 5 - 1),               QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1)));
+    painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, height() - 1 - 5 - 1), QPoint(width() - 1 - 5 - 1, 0)));
+    if (m_fStartedFromVMSettings)
+        painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, 0), QPoint(5 + 1, 0)));
+    painter.restore();
+#endif /* Q_WS_WIN || Q_WS_X11 */
+}
+
+
+UIMenuBarEditorWindow::UIMenuBarEditorWindow(UIMachineWindow *pParent, UIActionPool *pActionPool)
+#ifndef Q_WS_MAC
+    : UISlidingToolBar(pParent, pParent->menuBar(), new UIMenuBarEditorWidget(0, false, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
+#else /* Q_WS_MAC */
+    : UISlidingToolBar(pParent, 0, new UIMenuBarEditorWidget(0, false, vboxGlobal().managedVMUuid(), pActionPool), UISlidingToolBar::Position_Top)
+#endif /* Q_WS_MAC */
+{
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.h
new file mode 100644
index 0000000..1edf4ce
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMenuBarEditorWindow.h
@@ -0,0 +1,205 @@
+/* $Id: UIMenuBarEditorWindow.h $ */
+/** @file
+ * VBox Qt GUI - UIMenuBarEditorWindow class declaration.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIMenuBarEditorWindow_h___
+#define ___UIMenuBarEditorWindow_h___
+
+/* Qt includes: */
+#include <QMap>
+
+/* GUI includes: */
+#include "UISlidingToolBar.h"
+#include "QIWithRetranslateUI.h"
+
+/* Forward declarations: */
+class UIMachineWindow;
+class UIActionPool;
+class UIToolBar;
+class UIAction;
+class QIToolButton;
+#ifndef Q_WS_MAC
+class QCheckBox;
+#endif /* !Q_WS_MAC */
+class QHBoxLayout;
+class QAction;
+class QMenu;
+
+/** UISlidingToolBar wrapper
+  * providing user with possibility to edit menu-bar layout. */
+class UIMenuBarEditorWindow : public UISlidingToolBar
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pParent to the UISlidingToolBar constructor.
+      * @param pActionPool brings the action-pool reference for internal use. */
+    UIMenuBarEditorWindow(UIMachineWindow *pParent, UIActionPool *pActionPool);
+};
+
+/** QWidget reimplementation
+  * used as menu-bar editor widget. */
+class UIMenuBarEditorWidget : public QIWithRetranslateUI2<QWidget>
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies about Cancel button click. */
+    void sigCancelClicked();
+
+public:
+
+    /** Constructor.
+      * @param pParent                is passed to QWidget constructor,
+      * @param fStartedFromVMSettings determines whether 'this' is a part of VM settings,
+      * @param strMachineID           brings the machine ID to be used by the editor,
+      * @param pActionPool            brings the action-pool to be used by the editor. */
+    UIMenuBarEditorWidget(QWidget *pParent,
+                          bool fStartedFromVMSettings = true,
+                          const QString &strMachineID = QString(),
+                          UIActionPool *pActionPool = 0);
+
+    /** Returns the machine ID instance. */
+    const QString& machineID() const { return m_strMachineID; }
+    /** Defines the @a strMachineID instance. */
+    void setMachineID(const QString &strMachineID);
+
+    /** Returns the action-pool reference. */
+    const UIActionPool* actionPool() const { return m_pActionPool; }
+    /** Defines the @a pActionPool reference. */
+    void setActionPool(UIActionPool *pActionPool);
+
+private slots:
+
+    /** Handles configuration change. */
+    void sltHandleConfigurationChange(const QString &strMachineID);
+
+#ifndef RT_OS_DARWIN
+    /** Non Mac OS X: Handles menu-bar enable toggle. */
+    void sltHandleMenuBarEnableToggle(bool fEnabled);
+#endif /* !RT_OS_DARWIN */
+    /** Handles menu-bar menu click. */
+    void sltHandleMenuBarMenuClick();
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+#ifdef Q_WS_MAC
+    /** Prepare named menu routine. */
+    QMenu* prepareNamedMenu(const QString &strName);
+#endif /* Q_WS_MAC */
+    /** Prepare copied menu routine. */
+    QMenu* prepareCopiedMenu(const UIAction *pAction);
+#if 0
+    /** Prepare copied sub-menu routine. */
+    QMenu* prepareCopiedSubMenu(QMenu *pMenu, const UIAction *pAction);
+#endif
+    /** Prepare named action routine. */
+    QAction* prepareNamedAction(QMenu *pMenu, const QString &strName,
+                                int iExtraDataID, const QString &strExtraDataID);
+    /** Prepare copied action routine. */
+    QAction* prepareCopiedAction(QMenu *pMenu, const UIAction *pAction);
+
+    /** Prepare menus routine. */
+    void prepareMenus();
+    /** Prepare 'Application' menu routine. */
+    void prepareMenuApplication();
+    /** Prepare 'Machine' menu routine. */
+    void prepareMenuMachine();
+    /** Prepare 'View' menu routine. */
+    void prepareMenuView();
+    /** Prepare 'Input' menu routine. */
+    void prepareMenuInput();
+    /** Prepare 'Devices' menu routine. */
+    void prepareMenuDevices();
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** Prepare 'Debug' menu routine. */
+    void prepareMenuDebug();
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+    /** Mac OS X: Prepare 'Window' menu routine. */
+    void prepareMenuWindow();
+#endif /* Q_WS_MAC */
+    /** Prepare 'Help' menu routine. */
+    void prepareMenuHelp();
+
+#ifndef Q_WS_MAC
+    /** Non Mac OS X: Update enable-checkbox routine. */
+    void updateEnableCheckbox();
+#endif /* !Q_WS_MAC */
+    /** Update menus routine. */
+    void updateMenus();
+    /** Update 'Application' menu routine. */
+    void updateMenuApplication();
+    /** Update 'Machine' menu routine. */
+    void updateMenuMachine();
+    /** Update 'View' menu routine. */
+    void updateMenuView();
+    /** Update 'Input' menu routine. */
+    void updateMenuInput();
+    /** Update 'Devices' menu routine. */
+    void updateMenuDevices();
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    /** Update 'Debug' menu routine. */
+    void updateMenuDebug();
+#endif /* VBOX_WITH_DEBUGGER_GUI */
+#ifdef Q_WS_MAC
+    /** Mac OS X: Update 'Window' menu routine. */
+    void updateMenuWindow();
+#endif /* Q_WS_MAC */
+    /** Update 'Help' menu routine. */
+    void updateMenuHelp();
+
+    /** Retranslation routine. */
+    virtual void retranslateUi();
+
+    /** Paint event handler. */
+    virtual void paintEvent(QPaintEvent *pEvent);
+
+    /** @name General
+      * @{ */
+        /** Holds whether 'this' is prepared. */
+        bool m_fPrepared;
+        /** Holds whether 'this' is a part of VM settings. */
+        bool m_fStartedFromVMSettings;
+        /** Holds the machine ID instance. */
+        QString m_strMachineID;
+        /** Holds the action-pool reference. */
+        const UIActionPool *m_pActionPool;
+    /** @} */
+
+    /** @name Contents
+      * @{ */
+        /** Holds the main-layout instance. */
+        QHBoxLayout *m_pMainLayout;
+        /** Holds the tool-bar instance. */
+        UIToolBar *m_pToolBar;
+        /** Holds the close-button instance. */
+        QIToolButton *m_pButtonClose;
+#ifndef Q_WS_MAC
+        /** Non Mac OS X: Holds the enable-checkbox instance. */
+        QCheckBox *m_pCheckBoxEnable;
+#endif /* !Q_WS_MAC */
+        /** Holds tool-bar action references. */
+        QMap<QString, QAction*> m_actions;
+    /** @} */
+};
+
+#endif /* !___UIMenuBarEditorWindow_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
index e1b6b7c..f005fd4 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMouseHandler.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMouseHandler class implementation
+ * VBox Qt GUI - UIMouseHandler class implementation.
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,27 +15,48 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QMouseEvent>
-#include <QTouchEvent>
-#include <QTimer>
+# include <QDesktopWidget>
+# include <QMouseEvent>
+# include <QTimer>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIPopupCenter.h"
-#include "UIKeyboardHandler.h"
-#include "UIMouseHandler.h"
-#include "UISession.h"
-#include "UIMachineLogic.h"
-#include "UIMachineWindow.h"
-#include "UIMachineView.h"
-#include "UIFrameBuffer.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIPopupCenter.h"
+# include "UIKeyboardHandler.h"
+# include "UIMouseHandler.h"
+# include "UISession.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindow.h"
+# include "UIMachineView.h"
+# include "UIFrameBuffer.h"
+# include "UIExtraDataManager.h"
+
+# ifdef Q_WS_WIN
+#  include "VBoxUtils-win.h"
+# endif /* Q_WS_WIN */
+
+# ifdef Q_WS_MAC
+#  include "VBoxUtils-darwin.h"
+# endif /* Q_WS_MAC */
+
+/* COM includes: */
+# include "CConsole.h"
+# include "CDisplay.h"
+
+# include <iprt/time.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QTouchEvent>
+
+#include "CMouse.h"
 
-#ifdef Q_WS_WIN
-# include "VBoxUtils-win.h"
-#endif /* Q_WS_WIN */
 
 #ifdef Q_WS_X11
 # include <X11/XKBlib.h>
@@ -53,17 +72,6 @@ const int XKeyRelease = KeyRelease;
 # endif /* KeyPress */
 #endif /* Q_WS_X11 */
 
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-#endif /* Q_WS_MAC */
-
-/* COM includes: */
-#include "CConsole.h"
-#include "CMouse.h"
-#include "CFramebuffer.h"
-#include "CDisplay.h"
-
-#include <iprt/time.h>
 
 /* Factory function to create mouse-handler: */
 UIMouseHandler* UIMouseHandler::create(UIMachineLogic *pMachineLogic,
@@ -114,8 +122,8 @@ void UIMouseHandler::prepareListener(ulong uIndex, UIMachineWindow *pMachineWind
         m_views.insert(uIndex, pMachineWindow->machineView());
         /* Install event-filter for machine-view: */
         m_views[uIndex]->installEventFilter(this);
-        /* Make machine-view notify mouse-handler about resizeHintDone(): */
-        connect(m_views[uIndex], SIGNAL(resizeHintDone()), this, SLOT(sltMousePointerShapeChanged()));
+        /* Make machine-view notify mouse-handler about frame-buffer resize: */
+        connect(m_views[uIndex], SIGNAL(sigFrameBufferResize()), this, SLOT(sltMousePointerShapeChanged()));
     }
 
     /* If that viewport is NOT registered yet: */
@@ -198,11 +206,10 @@ void UIMouseHandler::captureMouse(ulong uScreenId)
 #endif /* !Q_WS_MAC */
 
         /* Switch guest mouse to the relative mode: */
-        CMouse mouse = session().GetConsole().GetMouse();
-        mouse.PutMouseEvent(0, 0, 0, 0, 0);
+        mouse().PutMouseEvent(0, 0, 0, 0, 0);
 
-        /* Emit signal if required: */
-        emit mouseStateChanged(mouseState());
+        /* Notify all the listeners: */
+        emit sigStateChange(state());
     }
 }
 
@@ -233,8 +240,8 @@ void UIMouseHandler::releaseMouse()
         /* Reset mouse-capture index: */
         m_iMouseCaptureViewIndex = -1;
 
-        /* Emit signal if required: */
-        emit mouseStateChanged(mouseState());
+        /* Notify all the listeners: */
+        emit sigStateChange(state());
     }
 }
 
@@ -253,7 +260,7 @@ void UIMouseHandler::setMouseIntegrationEnabled(bool fEnabled)
 }
 
 /* Current mouse state: */
-int UIMouseHandler::mouseState() const
+int UIMouseHandler::state() const
 {
     return (uisession()->isMouseCaptured() ? UIMouseStateType_MouseCaptured : 0) |
            (uisession()->isMouseSupportsAbsolute() ? UIMouseStateType_MouseAbsolute : 0) |
@@ -294,9 +301,9 @@ bool UIMouseHandler::x11EventFilter(XEvent *pEvent, ulong /* uScreenId */)
 void UIMouseHandler::sltMachineStateChanged()
 {
     /* Get machine state: */
-    KMachineState state = uisession()->machineState();
+    KMachineState machineState = uisession()->machineState();
     /* Handle particular machine states: */
-    switch (state)
+    switch (machineState)
     {
         case KMachineState_Paused:
         case KMachineState_TeleportingPausedVM:
@@ -313,13 +320,12 @@ void UIMouseHandler::sltMachineStateChanged()
     /* Recall reminder about paused VM input
      * if we are not in paused VM state already: */
     if (machineLogic()->activeMachineWindow() &&
-        state != KMachineState_Paused &&
-        state != KMachineState_TeleportingPausedVM)
+        machineState != KMachineState_Paused &&
+        machineState != KMachineState_TeleportingPausedVM)
         popupCenter().forgetAboutPausedVMInput(machineLogic()->activeMachineWindow());
 
-    // TODO: Is it really required?
-    /* Notify all listeners: */
-    emit mouseStateChanged(mouseState());
+    /* Notify all the listeners: */
+    emit sigStateChange(state());
 }
 
 /* Mouse capability-change handler: */
@@ -331,8 +337,7 @@ void UIMouseHandler::sltMouseCapabilityChanged()
         /* Release the mouse: */
         releaseMouse();
         /* Also we should switch guest mouse to the absolute mode: */
-        CMouse mouse = session().GetConsole().GetMouse();
-        mouse.PutMouseEventAbsolute(-1, -1, 0, 0, 0);
+        mouse().PutMouseEventAbsolute(-1, -1, 0, 0, 0);
     }
 #if 0 /* current team's decision is NOT to capture mouse on mouse-absolute mode loosing! */
     /* If mouse-integration deactivated or mouse doesn't supports absolute pointing: */
@@ -361,8 +366,7 @@ void UIMouseHandler::sltMouseCapabilityChanged()
     else
     {
         /* Switch guest mouse to the relative mode: */
-        CMouse mouse = session().GetConsole().GetMouse();
-        mouse.PutMouseEvent(0, 0, 0, 0, 0);
+        mouse().PutMouseEvent(0, 0, 0, 0, 0);
     }
 #endif
 
@@ -376,8 +380,8 @@ void UIMouseHandler::sltMouseCapabilityChanged()
                                                       uisession()->isMouseSupportsAbsolute());
     }
 
-    /* Notify all listeners: */
-    emit mouseStateChanged(mouseState());
+    /* Notify all the listeners: */
+    emit sigStateChange(state());
 }
 
 /* Mouse pointer-shape-change handler: */
@@ -456,7 +460,7 @@ UIMouseHandler::UIMouseHandler(UIMachineLogic *pMachineLogic)
 
     /* Mouse pointer shape state-change updaters: */
     connect(uisession(), SIGNAL(sigMousePointerShapeChange()), this, SLOT(sltMousePointerShapeChanged()));
-    connect(this, SIGNAL(mouseStateChanged(int)), this, SLOT(sltMousePointerShapeChanged()));
+    connect(this, SIGNAL(sigStateChange(int)), this, SLOT(sltMousePointerShapeChanged()));
 
     /* Initialize: */
     sltMachineStateChanged();
@@ -481,10 +485,14 @@ UISession* UIMouseHandler::uisession() const
     return machineLogic()->uisession();
 }
 
-/* Main Session getter: */
-CSession& UIMouseHandler::session() const
+CDisplay& UIMouseHandler::display() const
 {
-    return uisession()->session();
+    return uisession()->display();
+}
+
+CMouse& UIMouseHandler::mouse() const
+{
+    return uisession()->mouse();
 }
 
 /* Event handler for registered machine-view(s): */
@@ -606,7 +614,7 @@ bool UIMouseHandler::eventFilter(QObject *pWatched, QEvent *pEvent)
                         pWatchedWidget->window()->activateWindow();
 #endif /* Q_WS_X11 */
                     /* Check if we should activate window under cursor: */
-                    if (uisession()->activateHoveredMachineWindow() &&
+                    if (gEDataManager->activateHoveredMachineWindow() &&
                         !uisession()->isMouseCaptured() &&
                         QApplication::activeWindow() &&
                         m_windows.values().contains(QApplication::activeWindow()) &&
@@ -623,14 +631,7 @@ bool UIMouseHandler::eventFilter(QObject *pWatched, QEvent *pEvent)
                         m_pHoveredWindow = 0;
                     }
 
-                    m_iLastMouseWheelDelta = 0;
-                    /* Old Qt versions had a bug where mouse-buttons coming with the event were not quite valid.
-                     * For now we will be asking the QApplication for the valid button combination instead. */
-                    if (mouseEvent(pOldMouseEvent->type(), uScreenId,
-                                   pOldMouseEvent->pos(), pOldMouseEvent->globalPos(),
-                                   QApplication::mouseButtons(), 0, Qt::Horizontal))
-                        return true;
-                    break;
+                    /* This event should be also processed using next 'case': */
                 }
                 case QEvent::MouseButtonPress:
                 case QEvent::MouseButtonDblClick:
@@ -843,10 +844,9 @@ bool UIMouseHandler::mouseEvent(int iEventType, ulong uScreenId,
         /* Send pending WM_PAINT events: */
         ::UpdateWindow(m_viewports[uScreenId]->winId());
 #endif
-        CMouse mouse = session().GetConsole().GetMouse();
-        mouse.PutMouseEvent(globalPos.x() - m_lastMousePos.x(),
-                            globalPos.y() - m_lastMousePos.y(),
-                            iWheelVertical, iWheelHorizontal, iMouseButtonsState);
+        mouse().PutMouseEvent(globalPos.x() - m_lastMousePos.x(),
+                              globalPos.y() - m_lastMousePos.y(),
+                              iWheelVertical, iWheelHorizontal, iMouseButtonsState);
 
 #ifdef Q_WS_WIN
         /* Bringing mouse to the opposite side to simulate the endless moving: */
@@ -927,14 +927,32 @@ bool UIMouseHandler::mouseEvent(int iEventType, ulong uScreenId,
             /* Get mouse-pointer location: */
             QPoint cpnt = m_views[uScreenId]->viewportToContents(relativePos);
 
-            /* Determine scaling: */
-            UIFrameBuffer *pFrameBuffer = m_views[uScreenId]->frameBuffer();
-            QSize scaledSize = pFrameBuffer->scaledSize();
-            double xRatio = scaledSize.isValid() ? (double)pFrameBuffer->width() / (double)scaledSize.width() : 1;
-            double yRatio = scaledSize.isValid() ? (double)pFrameBuffer->height() / (double)scaledSize.height() : 1;
-            /* Set scaling if scale-factor is present: */
-            cpnt.setX((int)(cpnt.x() * xRatio));
-            cpnt.setY((int)(cpnt.y() * yRatio));
+            /* Take the scale-factor(s) into account: */
+            const UIFrameBuffer *pFrameBuffer = m_views[uScreenId]->frameBuffer();
+            if (pFrameBuffer)
+            {
+                const QSize scaledSize = pFrameBuffer->scaledSize();
+                if (scaledSize.isValid())
+                {
+                    const double xScaleFactor = (double)scaledSize.width()  / pFrameBuffer->width();
+                    const double yScaleFactor = (double)scaledSize.height() / pFrameBuffer->height();
+                    cpnt.setX((int)(cpnt.x() / xScaleFactor));
+                    cpnt.setY((int)(cpnt.y() / yScaleFactor));
+                }
+            }
+
+#ifdef Q_WS_MAC
+            /* Take the backing-scale-factor into account: */
+            if (pFrameBuffer->useUnscaledHiDPIOutput())
+            {
+                const double dBackingScaleFactor = pFrameBuffer->backingScaleFactor();
+                if (dBackingScaleFactor > 1.0)
+                {
+                    cpnt.setX((int)(cpnt.x() * dBackingScaleFactor));
+                    cpnt.setY((int)(cpnt.y() * dBackingScaleFactor));
+                }
+            }
+#endif /* Q_WS_MAC */
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
 # ifdef VBOX_WITH_DRAG_AND_DROP_GH
@@ -943,11 +961,12 @@ bool UIMouseHandler::mouseEvent(int iEventType, ulong uScreenId,
                 || cpnt.y() < 0
                 || cpnt.y() > iCh - 1)
             {
-                if ((mouseButtons.testFlag(Qt::LeftButton)))
+                bool fHandleDnDPending
+                    = RT_BOOL(mouseButtons.testFlag(Qt::LeftButton));
+                if (fHandleDnDPending)
                 {
-                    m_views[uScreenId]->handleGHDnd();
-
-                    return false;
+                    m_views[uScreenId]->dragIsPending();
+                    return true;
                 }
             }
 # endif
@@ -960,16 +979,16 @@ bool UIMouseHandler::mouseEvent(int iEventType, ulong uScreenId,
             else if (cpnt.y() > iCh - 1) cpnt.setY(iCh - 1);
 
             /* Determine shifting: */
-            CFramebuffer framebuffer;
             LONG xShift = 0, yShift = 0;
-            session().GetConsole().GetDisplay().GetFramebuffer(uScreenId, framebuffer, xShift, yShift);
+            ULONG dummy;
+            KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
+            display().GetScreenResolution(uScreenId, dummy, dummy, dummy, xShift, yShift, monitorStatus);
             /* Set shifting: */
             cpnt.setX(cpnt.x() + xShift);
             cpnt.setY(cpnt.y() + yShift);
 
             /* Post absolute mouse-event into guest: */
-            CMouse mouse = session().GetConsole().GetMouse();
-            mouse.PutMouseEventAbsolute(cpnt.x() + 1, cpnt.y() + 1, iWheelVertical, iWheelHorizontal, iMouseButtonsState);
+            mouse().PutMouseEventAbsolute(cpnt.x() + 1, cpnt.y() + 1, iWheelVertical, iWheelHorizontal, iMouseButtonsState);
             return true;
         }
         else
@@ -999,7 +1018,8 @@ bool UIMouseHandler::mouseEvent(int iEventType, ulong uScreenId,
                         qApp->processEvents();
 #endif /* Q_WS_X11 */
                         machineLogic()->keyboardHandler()->captureKeyboard(uScreenId);
-                        if (uisession()->mouseCapturePolicy() == MouseCapturePolicy_Default)
+                        const MouseCapturePolicy mcp = gEDataManager->mouseCapturePolicy(vboxGlobal().managedVMUuid());
+                        if (mcp == MouseCapturePolicy_Default)
                             captureMouse(uScreenId);
                     }
                 }
@@ -1020,14 +1040,12 @@ bool UIMouseHandler::multiTouchEvent(QTouchEvent *pTouchEvent, ulong uScreenId)
     if (!m_views.contains(uScreenId) || !m_viewports.contains(uScreenId))
         return true;
 
-    /* Get mouse: */
-    CMouse mouse = session().GetConsole().GetMouse();
-
     QVector<LONG64> contacts(pTouchEvent->touchPoints().size());
 
-    CFramebuffer framebuffer;
     LONG xShift = 0, yShift = 0;
-    session().GetConsole().GetDisplay().GetFramebuffer(uScreenId, framebuffer, xShift, yShift);
+    ULONG dummy;
+    KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
+    display().GetScreenResolution(uScreenId, dummy, dummy, dummy, xShift, yShift, monitorStatus);
 
     /* Pass all multi-touch events into guest: */
     int iTouchPointIndex = 0;
@@ -1063,9 +1081,9 @@ bool UIMouseHandler::multiTouchEvent(QTouchEvent *pTouchEvent, ulong uScreenId)
         ++iTouchPointIndex;
     }
 
-    mouse.PutEventMultiTouch(pTouchEvent->touchPoints().size(),
-                             contacts,
-                             (ULONG)RTTimeMilliTS());
+    mouse().PutEventMultiTouch(pTouchEvent->touchPoints().size(),
+                               contacts,
+                               (ULONG)RTTimeMilliTS());
 
     /* Eat by default? */
     return true;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
index b659a58..89f9179 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h
@@ -1,7 +1,6 @@
+/* $Id: UIMouseHandler.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMouseHandler class declaration
+ * VBox Qt GUI - UIMouseHandler class declaration.
  */
 
 /*
@@ -27,7 +26,7 @@
 #include <QPointer>
 
 /* GUI includes: */
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
 
 /* Forward declarations: */
 class QWidget;
@@ -39,13 +38,19 @@ class UIMachineView;
 #ifdef Q_WS_X11
 typedef union  _XEvent XEvent;
 #endif /* Q_WS_X11 */
-class CSession;
+class CDisplay;
+class CMouse;
 
 /* Delegate to control VM mouse functionality: */
 class UIMouseHandler : public QObject
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies listeners about state-change. */
+    void sigStateChange(int iState);
+
 public:
 
     /* Factory functions to create/destroy mouse-handler: */
@@ -64,17 +69,12 @@ public:
     void setMouseIntegrationEnabled(bool fEnabled);
 
     /* Current mouse state: */
-    int mouseState() const;
+    int state() const;
 
 #ifdef Q_WS_X11
     bool x11EventFilter(XEvent *pEvent, ulong uScreenId);
 #endif /* Q_WS_X11 */
 
-signals:
-
-    /* Notifies listeners about mouse state-change: */
-    void mouseStateChanged(int iNewState);
-
 protected slots:
 
     /* Machine state-change handler: */
@@ -98,7 +98,11 @@ protected:
     /* Getters: */
     UIMachineLogic* machineLogic() const;
     UISession* uisession() const;
-    CSession& session() const;
+
+    /** Returns the console's display reference. */
+    CDisplay& display() const;
+    /** Returns the console's mouse reference. */
+    CMouse& mouse() const;
 
     /* Event handler for registered machine-view(s): */
     bool eventFilter(QObject *pWatched, QEvent *pEvent);
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
index 06df0b8..874a6e6 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMultiScreenLayout.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMultiScreenLayout class implementation
+ * VBox Qt GUI - UIMultiScreenLayout class implementation.
  */
 
 /*
@@ -17,51 +15,44 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QMenu>
+# include <QApplication>
+# include <QDesktopWidget>
+# include <QMenu>
 
 /* GUI includes: */
-#include "UIDefs.h"
-#include "UIMultiScreenLayout.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogic.h"
-#include "UIFrameBuffer.h"
-#include "UISession.h"
-#include "UIMessageCenter.h"
-#include "VBoxGlobal.h"
+# include "UIDefs.h"
+# include "UIMultiScreenLayout.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogic.h"
+# include "UIFrameBuffer.h"
+# include "UISession.h"
+# include "UIMessageCenter.h"
+# include "UIExtraDataManager.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "COMEnums.h"
-#include "CSession.h"
-#include "CConsole.h"
-#include "CMachine.h"
-#include "CDisplay.h"
+# include "COMEnums.h"
+# include "CSession.h"
+# include "CConsole.h"
+# include "CMachine.h"
+# include "CDisplay.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMultiScreenLayout::UIMultiScreenLayout(UIMachineLogic *pMachineLogic)
     : m_pMachineLogic(pMachineLogic)
-    , m_pViewMenu(0)
 {
     /* Calculate host/guest screen count: */
     calculateHostMonitorCount();
     calculateGuestScreenCount();
 }
 
-UIMultiScreenLayout::~UIMultiScreenLayout()
-{
-    /* Cleanup view-menu: */
-    cleanupViewMenu();
-}
-
-void UIMultiScreenLayout::setViewMenu(QMenu *pViewMenu)
-{
-    /* Assign view-menu: */
-    m_pViewMenu = pViewMenu;
-    /* Prepare view-menu: */
-    prepareViewMenu();
-}
-
 void UIMultiScreenLayout::update()
 {
     LogRelFlow(("UIMultiScreenLayout::update: Started...\n"));
@@ -77,9 +68,8 @@ void UIMultiScreenLayout::update()
     /* Load all combinations stored in the settings file.
      * We have to make sure they are valid, which means there have to be unique combinations
      * and all guests screens need there own host screen. */
-    CMachine machine = m_pMachineLogic->session().GetMachine();
     CDisplay display = m_pMachineLogic->session().GetConsole().GetDisplay();
-    bool fShouldWeAutoMountGuestScreens = VBoxGlobal::shouldWeAutoMountGuestScreens(machine, false);
+    bool fShouldWeAutoMountGuestScreens = gEDataManager->autoMountGuestScreensEnabled(vboxGlobal().managedVMUuid());
     LogRel(("UIMultiScreenLayout::update: GUI/AutomountGuestScreens is %s.\n", fShouldWeAutoMountGuestScreens ? "enabled" : "disabled"));
     QDesktopWidget *pDW = QApplication::desktop();
     foreach (int iGuestScreen, m_guestScreens)
@@ -91,34 +81,28 @@ void UIMultiScreenLayout::update()
         if (!fValid)
         {
             /* If the user ever selected a combination in the view menu, we have the following entry: */
-            QString strTest = machine.GetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iGuestScreen));
-            bool fOk;
-            /* Check is this value can be converted: */
-            iHostScreen = strTest.toInt(&fOk);
+            iHostScreen = gEDataManager->hostScreenForPassedGuestScreen(iGuestScreen, vboxGlobal().managedVMUuid());
             /* Revalidate: */
-            fValid =    fOk /* Valid data */
-                     && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
+            fValid =    iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
                      && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */
         }
 
         if (!fValid)
         {
             /* Check the position of the guest window in normal mode.
-             * This makes sure that on first use the window opens on the same screen as the normal window was before.
-             * This even works with multi-screen. The user just have to move all the normal windows to the target screens
-             * and they will magically open there in seamless/fullscreen also. */
-            QString strTest1 = machine.GetExtraData(GUI_LastNormalWindowPosition + (iGuestScreen > 0 ? QString::number(iGuestScreen): ""));
-            QRegExp posParser("(-?\\d+),(-?\\d+),(-?\\d+),(-?\\d+)");
-            if (posParser.exactMatch(strTest1))
+             * This makes sure that on first use fullscreen/seamless window opens on the same host-screen as the normal window was before.
+             * This even works with multi-screen. The user just have to move all the normal windows to the target host-screens
+             * and they will magically open there in fullscreen/seamless also. */
+            QRect geo = gEDataManager->machineWindowGeometry(UIVisualStateType_Normal, iGuestScreen, vboxGlobal().managedVMUuid());
+            /* If geometry is valid: */
+            if (!geo.isNull())
             {
-                /* If parsing was successfully, convert it to a position: */
-                bool fOk1, fOk2;
-                QPoint p(posParser.cap(1).toInt(&fOk1), posParser.cap(2).toInt(&fOk2));
-                /* Check to which screen the position belongs: */
-                iHostScreen = pDW->screenNumber(p);
+                /* Get top-left corner position: */
+                QPoint topLeftPosition(geo.topLeft());
+                /* Check which host-screen the position belongs to: */
+                iHostScreen = pDW->screenNumber(topLeftPosition);
                 /* Revalidate: */
-                fValid =    fOk1 && fOk2 /* Valid data */
-                         && iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
+                fValid =    iHostScreen >= 0 && iHostScreen < m_cHostScreens /* In the host screen bounds? */
                          && m_screenMap.key(iHostScreen, -1) == -1; /* Not taken already? */
             }
         }
@@ -183,8 +167,8 @@ void UIMultiScreenLayout::update()
         }
     }
 
-    /* Update menu actions: */
-    updateMenuActions(false);
+    /* Notifies about layout update: */
+    emit sigScreenLayoutUpdate();
 
     LogRelFlow(("UIMultiScreenLayout::update: Finished!\n"));
 }
@@ -196,8 +180,6 @@ void UIMultiScreenLayout::rebuild()
     /* Recalculate host/guest screen count: */
     calculateHostMonitorCount();
     calculateGuestScreenCount();
-    /* Update view-menu: */
-    prepareViewMenu();
     /* Update layout: */
     update();
 
@@ -229,31 +211,8 @@ quint64 UIMultiScreenLayout::memoryRequirements() const
     return memoryRequirements(m_screenMap);
 }
 
-bool UIMultiScreenLayout::isHostTaskbarCovert() const
+void UIMultiScreenLayout::sltHandleScreenLayoutChange(int iRequestedGuestScreen, int iRequestedHostScreen)
 {
-    /* Check for all screens which are in use if they have some
-     * taskbar/menubar/dock on it. Its done by comparing the available with the
-     * screen geometry. Only if they are the same for all screens, there are no
-     * host area covert. This is a little bit ugly, but there seems no other
-     * way to find out if we are on a screen where the taskbar/dock or whatever
-     * is present. */
-    QDesktopWidget *pDW = QApplication::desktop();
-    for (int i = 0; i < m_screenMap.size(); ++i)
-    {
-        int hostScreen = m_screenMap.value(i);
-        if (pDW->availableGeometry(hostScreen) != pDW->screenGeometry(hostScreen))
-            return true;
-    }
-    return false;
-}
-
-void UIMultiScreenLayout::sltScreenLayoutChanged(QAction *pAction)
-{
-    /* Parse incoming information: */
-    int a = pAction->data().toInt();
-    int iRequestedGuestScreen = RT_LOWORD(a);
-    int iRequestedHostScreen = RT_HIWORD(a);
-
     /* Search for the virtual screen which is currently displayed on the
      * requested host screen. When there is one found, we swap both. */
     QMap<int,int> tmpMap(m_screenMap);
@@ -287,10 +246,12 @@ void UIMultiScreenLayout::sltScreenLayoutChanged(QAction *pAction)
 
     /* Swap the maps: */
     m_screenMap = tmpMap;
-    /* Update menu actions: */
-    updateMenuActions(true);
-    /* Inform the observer: */
-    emit sigScreenLayoutChanged();
+
+    /* Save guest-to-host mapping: */
+    saveScreenMapping();
+
+    /* Notifies about layout change: */
+    emit sigScreenLayoutChange();
 }
 
 void UIMultiScreenLayout::calculateHostMonitorCount()
@@ -312,84 +273,12 @@ void UIMultiScreenLayout::calculateGuestScreenCount()
             m_disabledGuestScreens << iGuestScreen;
 }
 
-void UIMultiScreenLayout::prepareViewMenu()
+void UIMultiScreenLayout::saveScreenMapping()
 {
-    /* Make sure view-menu was set: */
-    if (!m_pViewMenu)
-        return;
-
-    /* Cleanup menu first: */
-    cleanupViewMenu();
-
-    /* If we do have more than one host/guest screen: */
-    if (m_cHostScreens > 1 || m_guestScreens.size() > 1)
+    foreach (const int &iGuestScreen, m_guestScreens)
     {
-        m_pViewMenu->addSeparator();
-        foreach (int iGuestScreen, m_guestScreens)
-        {
-            m_screenMenuList << m_pViewMenu->addMenu(tr("Virtual Screen %1").arg(iGuestScreen + 1));
-            m_screenMenuList.last()->menuAction()->setData(true);
-            QActionGroup *pScreenGroup = new QActionGroup(m_screenMenuList.last());
-            pScreenGroup->setExclusive(true);
-            connect(pScreenGroup, SIGNAL(triggered(QAction*)), this, SLOT(sltScreenLayoutChanged(QAction*)));
-            for (int a = 0; a < m_cHostScreens; ++a)
-            {
-                QAction *pAction = pScreenGroup->addAction(tr("Use Host Screen %1").arg(a + 1));
-                pAction->setCheckable(true);
-                pAction->setData(RT_MAKE_U32(iGuestScreen, a));
-            }
-            m_screenMenuList.last()->addActions(pScreenGroup->actions());
-        }
-    }
-
-    /* Update menu actions: */
-    updateMenuActions(false);
-}
-
-void UIMultiScreenLayout::cleanupViewMenu()
-{
-    /* Make sure view-menu was set: */
-    if (!m_pViewMenu)
-        return;
-
-    /* Cleanup view-menu actions: */
-    while (!m_screenMenuList.isEmpty())
-        delete m_screenMenuList.takeFirst();
-}
-
-void UIMultiScreenLayout::updateMenuActions(bool fWithSave)
-{
-    /* Make sure view-menu was set: */
-    if (!m_pViewMenu)
-        return;
-
-    /* Get the list of all view-menu actions: */
-    QList<QAction*> viewMenuActions = gActionPool->action(UIActionIndexRuntime_Menu_View)->menu()->actions();
-    /* Get the list of all view related actions: */
-    QList<QAction*> viewActions;
-    for (int i = 0; i < viewMenuActions.size(); ++i)
-        if (viewMenuActions[i]->data().toBool())
-            viewActions << viewMenuActions[i];
-    /* Update view actions: */
-    CMachine machine = m_pMachineLogic->session().GetMachine();
-    for (int iViewAction = 0; iViewAction < viewActions.size(); ++iViewAction)
-    {
-        int iGuestScreen = m_guestScreens[iViewAction];
-        int iHostScreen = m_screenMap.value(iGuestScreen, -1);
-        if (fWithSave)
-        {
-            QString strHostScreen(iHostScreen != -1 ? QString::number(iHostScreen) : QString());
-            machine.SetExtraData(QString("%1%2").arg(GUI_VirtualScreenToHostScreen).arg(iViewAction), strHostScreen);
-        }
-        QList<QAction*> screenActions = viewActions.at(iViewAction)->menu()->actions();
-        /* Update screen actions: */
-        for (int j = 0; j < screenActions.size(); ++j)
-        {
-            QAction *pTmpAction = screenActions.at(j);
-            pTmpAction->blockSignals(true);
-            pTmpAction->setChecked(RT_HIWORD(pTmpAction->data().toInt()) == iHostScreen);
-            pTmpAction->blockSignals(false);
-        }
+        const int iHostScreen = m_screenMap.value(iGuestScreen, -1);
+        gEDataManager->setHostScreenForPassedGuestScreen(iGuestScreen, iHostScreen, vboxGlobal().managedVMUuid());
     }
 }
 
@@ -409,7 +298,8 @@ quint64 UIMultiScreenLayout::memoryRequirements(const QMap<int, int> &screenLayo
             screen = QApplication::desktop()->availableGeometry(screenLayout.value(iGuestScreen, 0));
         else
             screen = QApplication::desktop()->screenGeometry(screenLayout.value(iGuestScreen, 0));
-        display.GetScreenResolution(iGuestScreen, width, height, guestBpp, xOrigin, yOrigin);
+        KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
+        display.GetScreenResolution(iGuestScreen, width, height, guestBpp, xOrigin, yOrigin, monitorStatus);
         usedBits += screen.width() * /* display width */
                     screen.height() * /* display height */
                     guestBpp + /* guest bits per pixel */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
index bcf9fbc..719c399 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
@@ -1,7 +1,6 @@
+/* $Id: UIMultiScreenLayout.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMultiScreenLayout class declaration
+ * VBox Qt GUI - UIMultiScreenLayout class declaration.
  */
 
 /*
@@ -35,17 +34,15 @@ class UIMultiScreenLayout : public QObject
 
 signals:
 
-    /* Notifier: Layout change stuff: */
-    void sigScreenLayoutChanged();
+    /** Notifies about layout update. */
+    void sigScreenLayoutUpdate();
+    /** Notifies about layout change. */
+    void sigScreenLayoutChange();
 
 public:
 
     /* Constructor/destructor: */
     UIMultiScreenLayout(UIMachineLogic *pMachineLogic);
-    ~UIMultiScreenLayout();
-
-    /* API: View-menu stuff: */
-    void setViewMenu(QMenu *pViewMenu);
 
     /* API: Update stuff: */
     void update();
@@ -57,25 +54,20 @@ public:
     int hostScreenForGuestScreen(int iScreenId) const;
     bool hasHostScreenForGuestScreen(int iScreenId) const;
     quint64 memoryRequirements() const;
-    bool isHostTaskbarCovert() const;
 
 private slots:
 
     /* Handler: Screen change stuff: */
-    void sltScreenLayoutChanged(QAction *pAction);
+    void sltHandleScreenLayoutChange(int iRequestedGuestScreen, int iRequestedHostScreen);
 
 private:
 
     /* Helpers: Prepare stuff: */
     void calculateHostMonitorCount();
     void calculateGuestScreenCount();
-    void prepareViewMenu();
-
-    /* Helper: Cleanup stuff: */
-    void cleanupViewMenu();
 
     /* Other helpers: */
-    void updateMenuActions(bool fWithSave);
+    void saveScreenMapping();
     quint64 memoryRequirements(const QMap<int, int> &screenLayout) const;
 
     /* Variables: */
@@ -84,7 +76,6 @@ private:
     QList<int> m_disabledGuestScreens;
     int m_cHostScreens;
     QMap<int, int> m_screenMap;
-    QMenu *m_pViewMenu;
     QList<QMenu*> m_screenMenuList;
 };
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
index 1566e8e..1711b7d 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,35 +15,61 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QWidget>
-#ifdef Q_WS_MAC
-# include <QTimer>
-#endif /* Q_WS_MAC */
+# include <QApplication>
+# include <QDesktopWidget>
+# include <QWidget>
+# ifdef Q_WS_MAC
+#  include <QTimer>
+# endif /* Q_WS_MAC */
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIMachine.h"
-#include "UIMedium.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogic.h"
-#include "UIMachineView.h"
-#include "UIMachineWindow.h"
-#include "UIMachineMenuBar.h"
-#include "UIMessageCenter.h"
-#include "UIPopupCenter.h"
-#include "UIWizardFirstRun.h"
-#include "UIConsoleEventHandler.h"
-#include "UIFrameBuffer.h"
-#ifdef VBOX_WITH_VIDEOHWACCEL
-# include "VBoxFBOverlay.h"
-#endif /* VBOX_WITH_VIDEOHWACCEL */
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-#endif /* Q_WS_MAC */
+# include "VBoxGlobal.h"
+# include "UIExtraDataManager.h"
+# include "UISession.h"
+# include "UIMachine.h"
+# include "UIMedium.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogic.h"
+# include "UIMachineView.h"
+# include "UIMachineWindow.h"
+# include "UIMessageCenter.h"
+# include "UIPopupCenter.h"
+# include "UIWizardFirstRun.h"
+# include "UIConsoleEventHandler.h"
+# include "UIFrameBuffer.h"
+# include "UISettingsDialogSpecific.h"
+# ifdef VBOX_WITH_VIDEOHWACCEL
+#  include "VBoxFBOverlay.h"
+# endif /* VBOX_WITH_VIDEOHWACCEL */
+# ifdef Q_WS_MAC
+#  include "UIMenuBar.h"
+#  include "VBoxUtils-darwin.h"
+# endif /* Q_WS_MAC */
+
+# ifdef VBOX_GUI_WITH_KEYS_RESET_HANDLER
+#  include "UIKeyboardHandler.h"
+#  include <signal.h>
+# endif /* VBOX_GUI_WITH_KEYS_RESET_HANDLER */
+
+/* COM includes: */
+# include "CSystemProperties.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
+# include "CNetworkAdapter.h"
+# include "CHostNetworkInterface.h"
+# include "CVRDEServer.h"
+# include "CUSBController.h"
+# include "CUSBDeviceFilters.h"
+# include "CHostVideoInputDevice.h"
+# include "CSnapshot.h"
+# include "CMedium.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 #ifdef Q_WS_X11
 # include <QX11Info>
@@ -55,31 +81,6 @@
 #endif /* Q_WS_X11 */
 
 #ifdef VBOX_GUI_WITH_KEYS_RESET_HANDLER
-# include "UIKeyboardHandler.h"
-# include <signal.h>
-#endif /* VBOX_GUI_WITH_KEYS_RESET_HANDLER */
-
-/* COM includes: */
-#include "CConsole.h"
-#include "CSystemProperties.h"
-#include "CMachineDebugger.h"
-#include "CGuest.h"
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
-#include "CDisplay.h"
-#include "CFramebuffer.h"
-#include "CNetworkAdapter.h"
-#include "CHostNetworkInterface.h"
-#include "CVRDEServer.h"
-#include "CUSBController.h"
-#include "CUSBDeviceFilters.h"
-#include "CHostVideoInputDevice.h"
-#include "CSnapshot.h"
-#include "CMedium.h"
-#include "CExtPack.h"
-#include "CExtPackManager.h"
-
-#ifdef VBOX_GUI_WITH_KEYS_RESET_HANDLER
 static void signalHandlerSIGUSR1(int sig, siginfo_t *, void *);
 #endif
 
@@ -103,13 +104,13 @@ void cgDisplayReconfigurationCallback(CGDirectDisplayID display, CGDisplayChange
 
     /* Handle 'display-add' case: */
     if (flags & kCGDisplayAddFlag)
-        LogRelFlow(("UISession::cgDisplayReconfigurationCallback: Display added.\n"));
+        LogRelFlow(("GUI: UISession::cgDisplayReconfigurationCallback: Display added.\n"));
     /* Handle 'display-remove' case: */
     else if (flags & kCGDisplayRemoveFlag)
-        LogRelFlow(("UISession::cgDisplayReconfigurationCallback: Display removed.\n"));
+        LogRelFlow(("GUI: UISession::cgDisplayReconfigurationCallback: Display removed.\n"));
     /* Handle 'mode-set' case: */
     else if (flags & kCGDisplaySetModeFlag)
-        LogRelFlow(("UISession::cgDisplayReconfigurationCallback: Display mode changed.\n"));
+        LogRelFlow(("GUI: UISession::cgDisplayReconfigurationCallback: Display mode changed.\n"));
 
     /* Ask handler to process our callback: */
     if (flags & iHandledFlags)
@@ -120,278 +121,208 @@ void cgDisplayReconfigurationCallback(CGDirectDisplayID display, CGDisplayChange
 }
 #endif /* Q_WS_MAC */
 
-UISession::UISession(UIMachine *pMachine, CSession &sessionReference)
-    : QObject(pMachine)
-    /* Base variables: */
-    , m_pMachine(pMachine)
-    , m_session(sessionReference)
-    /* Common variables: */
-    , m_pMenuPool(0)
-    , m_machineStatePrevious(KMachineState_Null)
-    , m_machineState(session().GetMachine().GetState())
-#ifndef Q_WS_MAC
-    , m_pMachineWindowIcon(0)
-#endif /* !Q_WS_MAC */
-    , m_mouseCapturePolicy(MouseCapturePolicy_Default)
-    , m_guruMeditationHandlerType(GuruMeditationHandlerType_Default)
-    , m_hiDPIOptimizationType(HiDPIOptimizationType_None)
-    , m_fActivateHoveredMachineWindow(false)
-    , m_fIsExtensionPackUsable(false)
-    , m_requestedVisualStateType(UIVisualStateType_Invalid)
-#ifdef Q_WS_WIN
-    , m_alphaCursor(0)
-#endif /* Q_WS_WIN */
-#ifdef Q_WS_MAC
-    , m_pWatchdogDisplayChange(0)
-#endif /* Q_WS_MAC */
-    , m_defaultCloseAction(MachineCloseAction_Invalid)
-    , m_restrictedCloseActions(MachineCloseAction_Invalid)
-    , m_fAllCloseActionsRestricted(false)
-    , m_fSnapshotOperationsAllowed(true)
-    /* Common flags: */
-    , m_fIsStarted(false)
-    , m_fIsFirstTimeStarted(false)
-    , m_fIsIgnoreRuntimeMediumsChanging(false)
-    , m_fIsGuestResizeIgnored(false)
-    , m_fIsAutoCaptureDisabled(false)
-    , m_fReconfigurable(false)
-    /* Guest additions flags: */
-    , m_ulGuestAdditionsRunLevel(0)
-    , m_fIsGuestSupportsGraphics(false)
-    , m_fIsGuestSupportsSeamless(false)
-    /* Mouse flags: */
-    , m_fNumLock(false)
-    , m_fCapsLock(false)
-    , m_fScrollLock(false)
-    , m_uNumLockAdaptionCnt(2)
-    , m_uCapsLockAdaptionCnt(2)
-    /* Mouse flags: */
-    , m_fIsMouseSupportsAbsolute(false)
-    , m_fIsMouseSupportsRelative(false)
-    , m_fIsMouseSupportsMultiTouch(false)
-    , m_fIsMouseHostCursorNeeded(false)
-    , m_fIsMouseCaptured(false)
-    , m_fIsMouseIntegrated(true)
-    , m_fIsValidPointerShapePresent(false)
-    , m_fIsHidingHostPointer(true)
+/* static */
+bool UISession::create(UISession *&pSession, UIMachine *pMachine)
 {
-    /* Prepare connections: */
-    prepareConnections();
-
-    /* Prepare console event-handlers: */
-    prepareConsoleEventHandlers();
-
-    /* Prepare screens: */
-    prepareScreens();
-
-    /* Prepare framebuffers: */
-    prepareFramebuffers();
-
-    /* Prepare main-menu: */
-    prepareMenuPool();
-
-    /* Load settings: */
-    loadSessionSettings();
+    /* Make sure null pointer passed: */
+    AssertReturn(pSession == 0, false);
 
-#ifdef VBOX_GUI_WITH_KEYS_RESET_HANDLER
-    struct sigaction sa;
-    sa.sa_sigaction = &signalHandlerSIGUSR1;
-    sigemptyset(&sa.sa_mask);
-    sa.sa_flags = SA_RESTART | SA_SIGINFO;
-    sigaction(SIGUSR1, &sa, NULL);
-#endif /* VBOX_GUI_WITH_KEYS_RESET_HANDLER */
+    /* Create session UI: */
+    pSession = new UISession(pMachine);
+    /* Make sure it's prepared: */
+    if (!pSession->prepare())
+    {
+        /* Destroy session UI otherwise: */
+        destroy(pSession);
+        /* False in that case: */
+        return false;
+    }
+    /* True by default: */
+    return true;
 }
 
-UISession::~UISession()
+/* static */
+void UISession::destroy(UISession *&pSession)
 {
-    /* Save settings: */
-    saveSessionSettings();
-
-    /* Cleanup main-menu: */
-    cleanupMenuPool();
-
-    /* Cleanup framebuffers: */
-    cleanupFramebuffers();
-
-    /* Cleanup console event-handlers: */
-    cleanupConsoleEventHandlers();
-
-#ifdef Q_WS_WIN
-    /* Destroy alpha cursor: */
-    if (m_alphaCursor)
-        DestroyIcon(m_alphaCursor);
-#endif /* Q_WS_WIN */
+    /* Make sure valid pointer passed: */
+    AssertReturnVoid(pSession != 0);
+
+    /* Cleanup session UI: */
+    pSession->cleanup();
+    /* Destroy session: */
+    delete pSession;
+    pSession = 0;
 }
 
-void UISession::powerUp()
+bool UISession::initialize()
 {
-    /* Do nothing if we had started already: */
-    if (isRunning() || isPaused())
-        return;
-
-    /* Prepare powerup: */
-    bool fPrepared = preparePowerUp();
-    if (!fPrepared)
-        return;
+    /* Preprocess initialization: */
+    if (!preprocessInitialization())
+        return false;
 
-    /* Enable 'manual-override',
-     * preventing automatic Runtime UI closing
-     * and visual representation mode changes: */
-    if (machineLogic())
-        machineLogic()->setManualOverrideMode(true);
+    /* Notify user about mouse&keyboard auto-capturing: */
+    if (vboxGlobal().settings().autoCapture())
+        popupCenter().remindAboutAutoCapture(machineLogic()->activeMachineWindow());
 
-    /* Get current machine/console: */
-    CMachine machine = session().GetMachine();
-    CConsole console = session().GetConsole();
+    /* Check if we are in teleportation waiting mode.
+     * In that case no first run wizard is necessary. */
+    m_machineState = machine().GetState();
+    if (   isFirstTimeStarted()
+        && !((   m_machineState == KMachineState_PoweredOff
+              || m_machineState == KMachineState_Aborted
+              || m_machineState == KMachineState_Teleported)
+             && machine().GetTeleporterEnabled()))
+    {
+        UISafePointerWizard pWizard = new UIWizardFirstRun(mainMachineWindow(), machine());
+        pWizard->prepare();
+        pWizard->exec();
+        if (pWizard)
+            delete pWizard;
+    }
 
     /* Apply debug settings from the command line. */
-    CMachineDebugger debugger = console.GetDebugger();
-    if (debugger.isOk())
+    if (!debugger().isNull() && debugger().isOk())
     {
         if (vboxGlobal().isPatmDisabled())
-            debugger.SetPATMEnabled(false);
+            debugger().SetPATMEnabled(false);
         if (vboxGlobal().isCsamDisabled())
-            debugger.SetCSAMEnabled(false);
+            debugger().SetCSAMEnabled(false);
         if (vboxGlobal().isSupervisorCodeExecedRecompiled())
-            debugger.SetRecompileSupervisor(true);
+            debugger().SetRecompileSupervisor(true);
         if (vboxGlobal().isUserCodeExecedRecompiled())
-            debugger.SetRecompileUser(true);
+            debugger().SetRecompileUser(true);
         if (vboxGlobal().areWeToExecuteAllInIem())
-            debugger.SetExecuteAllInIEM(true);
+            debugger().SetExecuteAllInIEM(true);
         if (!vboxGlobal().isDefaultWarpPct())
-            debugger.SetVirtualTimeRate(vboxGlobal().getWarpPct());
+            debugger().SetVirtualTimeRate(vboxGlobal().getWarpPct());
+    }
+
+    /* Apply ad-hoc reconfigurations from the command line: */
+    if (vboxGlobal().hasFloppyImageToMount())
+        mountAdHocImage(KDeviceType_Floppy, UIMediumType_Floppy, vboxGlobal().getFloppyImage());
+    if (vboxGlobal().hasDvdImageToMount())
+        mountAdHocImage(KDeviceType_DVD, UIMediumType_DVD, vboxGlobal().getDvdImage());
+
+    /* Power UP if this is NOT separate process: */
+    if (!vboxGlobal().isSeparateProcess())
+        if (!powerUp())
+            return false;
+
+    /* Check if we missed a really quick termination after successful startup: */
+    if (isTurnedOff())
+        return false;
+
+    /* Postprocess initialization: */
+    if (!postprocessInitialization())
+        return false;
+
+    /* Fetch corresponding states: */
+    if (vboxGlobal().isSeparateProcess())
+    {
+        m_fIsMouseSupportsAbsolute = mouse().GetAbsoluteSupported();
+        m_fIsMouseSupportsRelative = mouse().GetRelativeSupported();
+        m_fIsMouseSupportsMultiTouch = mouse().GetMultiTouchSupported();
+        m_fIsMouseHostCursorNeeded = mouse().GetNeedsHostCursor();
+        sltAdditionsChange();
     }
+    machineLogic()->initializePostPowerUp();
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+    /* Log whether 2D video acceleration is enabled: */
+    LogRel(("GUI: 2D video acceleration is %s.\n",
+           machine().GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable()
+           ? "enabled" : "disabled"));
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+
+/* Log whether HID LEDs sync is enabled: */
+#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
+    LogRel(("GUI: HID LEDs sync is %s.\n",
+            uimachine()->machineLogic()->isHidLedsSyncEnabled()
+            ? "enabled" : "disabled"));
+#else /* !Q_WS_MAC && !Q_WS_WIN */
+    LogRel(("GUI: HID LEDs sync is not supported on this platform.\n"));
+#endif /* !Q_WS_MAC && !Q_WS_WIN */
+
+#ifdef VBOX_GUI_WITH_PIDFILE
+    vboxGlobal().createPidfile();
+#endif /* VBOX_GUI_WITH_PIDFILE */
+
+    /* Warn listeners about we are initialized: */
+    emit sigInitialized();
 
+    /* True by default: */
+    return true;
+}
+
+bool UISession::powerUp()
+{
     /* Power UP machine: */
-    CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled(machine) ?
-                         console.PowerUpPaused() : console.PowerUp();
+#ifdef VBOX_WITH_DEBUGGER_GUI
+    CProgress progress = vboxGlobal().isStartPausedEnabled() || vboxGlobal().isDebuggerAutoShowEnabled() ?
+                         console().PowerUpPaused() : console().PowerUp();
+#else /* !VBOX_WITH_DEBUGGER_GUI */
+    CProgress progress = console().PowerUp();
+#endif /* !VBOX_WITH_DEBUGGER_GUI */
 
     /* Check for immediate failure: */
-    if (!console.isOk())
+    if (!console().isOk() || progress.isNull())
     {
         if (vboxGlobal().showStartVMErrors())
-            msgCenter().cannotStartMachine(console, machine.GetName());
-        closeRuntimeUI();
-        return;
+            msgCenter().cannotStartMachine(console(), machineName());
+        return false;
     }
 
+    /* Enable 'manual-override',
+     * preventing automatic Runtime UI closing
+     * and visual representation mode changes: */
+    if (machineLogic())
+        machineLogic()->setManualOverrideMode(true);
+
     /* Show "Starting/Restoring" progress dialog: */
     if (isSaved())
     {
-        msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_state_restore_90px.png", 0, 0);
+        msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_state_restore_90px.png", 0, 0);
         /* After restoring from 'saved' state, machine-window(s) geometry should be adjusted: */
         machineLogic()->adjustMachineWindowsGeometry();
     }
     else
-        msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_start_90px.png");
+        msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_start_90px.png");
 
-    /* Check for a progress failure: */
+    /* Check for progress failure: */
     if (!progress.isOk() || progress.GetResultCode() != 0)
     {
         if (vboxGlobal().showStartVMErrors())
-            msgCenter().cannotStartMachine(progress, machine.GetName());
-        closeRuntimeUI();
-        return;
-    }
-
-    /* Check if we missed a really quick termination after successful startup, and process it if we did: */
-    if (isTurnedOff())
-    {
-        closeRuntimeUI();
-        return;
-    }
-
-    /* Check if the required virtualization features are active. We get this
-     * info only when the session is active. */
-    bool fIs64BitsGuest = vboxGlobal().virtualBox().GetGuestOSType(console.GetGuest().GetOSTypeId()).GetIs64Bit();
-    bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType(console.GetGuest().GetOSTypeId()).GetRecommendedVirtEx();
-    AssertMsg(!fIs64BitsGuest || fRecommendVirtEx, ("Virtualization support missed for 64bit guest!\n"));
-    bool fIsVirtEnabled = console.GetDebugger().GetHWVirtExEnabled();
-    if (fRecommendVirtEx && !fIsVirtEnabled)
-    {
-        bool fShouldWeClose;
-
-        bool fVTxAMDVSupported = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx);
-
-        QApplication::processEvents();
-        setPause(true);
-
-        if (fIs64BitsGuest)
-            fShouldWeClose = msgCenter().warnAboutVirtNotEnabled64BitsGuest(fVTxAMDVSupported);
-        else
-            fShouldWeClose = msgCenter().warnAboutVirtNotEnabledGuestRequired(fVTxAMDVSupported);
-
-        if (fShouldWeClose)
-        {
-            /* At this point the console is powered up. So we have to close
-             * this session again. */
-            CProgress progress = console.PowerDown();
-            if (console.isOk())
-            {
-                /* Show the power down progress dialog */
-                msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_poweroff_90px.png");
-                if (!progress.isOk() || progress.GetResultCode() != 0)
-                    msgCenter().cannotPowerDownMachine(progress, machine.GetName());
-            }
-            else
-                msgCenter().cannotPowerDownMachine(console);
-            closeRuntimeUI();
-            return;
-        }
-
-        setPause(false);
+            msgCenter().cannotStartMachine(progress, machineName());
+        return false;
     }
 
-#ifdef VBOX_WITH_VIDEOHWACCEL
-    LogRel(("2D video acceleration is %s.\n",
-           machine.GetAccelerate2DVideoEnabled() && VBoxGlobal::isAcceleration2DVideoAvailable()
-                 ? "enabled"
-                 : "disabled"));
-#endif
-
-/* Check if HID LEDs sync is enabled and add a log message about it. */
-#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
-    if(uimachine()->machineLogic()->isHidLedsSyncEnabled())
-        LogRel(("HID LEDs sync is enabled.\n"));
-    else
-        LogRel(("HID LEDs sync is disabled.\n"));
-#else
-    LogRel(("HID LEDs sync is not supported on this platform.\n"));
-#endif
-
-#ifdef VBOX_GUI_WITH_PIDFILE
-    vboxGlobal().createPidfile();
-#endif
-
     /* Disable 'manual-override' finally: */
     if (machineLogic())
         machineLogic()->setManualOverrideMode(false);
 
-    /* Warn listeners about machine was started: */
-    emit sigStarted();
+    /* True by default: */
+    return true;
 }
 
 bool UISession::saveState()
 {
     /* Prepare the saving progress: */
-    CMachine machine = m_session.GetMachine();
-    CConsole console = m_session.GetConsole();
-    CProgress progress = console.SaveState();
-    if (console.isOk())
+    CProgress progress = machine().SaveState();
+    if (machine().isOk())
     {
         /* Show the saving progress: */
-        msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_state_save_90px.png");
+        msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_state_save_90px.png");
         if (!progress.isOk() || progress.GetResultCode() != 0)
         {
             /* Failed in progress: */
-            msgCenter().cannotSaveMachineState(progress, machine.GetName());
+            msgCenter().cannotSaveMachineState(progress, machineName());
             return false;
         }
     }
     else
     {
         /* Failed in console: */
-        msgCenter().cannotSaveMachineState(console);
+        msgCenter().cannotSaveMachineState(machine());
         return false;
     }
     /* Passed: */
@@ -401,12 +332,11 @@ bool UISession::saveState()
 bool UISession::shutdown()
 {
     /* Send ACPI shutdown signal if possible: */
-    CConsole console = m_session.GetConsole();
-    console.PowerButton();
-    if (!console.isOk())
+    console().PowerButton();
+    if (!console().isOk())
     {
         /* Failed in console: */
-        msgCenter().cannotACPIShutdownMachine(console);
+        msgCenter().cannotACPIShutdownMachine(console());
         return false;
     }
     /* Passed: */
@@ -416,105 +346,135 @@ bool UISession::shutdown()
 bool UISession::powerOff(bool fIncludingDiscard, bool &fServerCrashed)
 {
     /* Prepare the power-off progress: */
-    CMachine machine = m_session.GetMachine();
-    CConsole console = m_session.GetConsole();
-    CProgress progress = console.PowerDown();
-    if (console.isOk())
+    CProgress progress = console().PowerDown();
+    if (console().isOk())
     {
         /* Show the power-off progress: */
-        msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_poweroff_90px.png");
+        msgCenter().showModalProgressDialog(progress, machineName(), ":/progress_poweroff_90px.png");
         if (progress.isOk() && progress.GetResultCode() == 0)
         {
             /* Discard the current state if requested: */
             if (fIncludingDiscard)
-            {
-                /* Prepare the snapshot-discard progress: */
-                CSnapshot snapshot = machine.GetCurrentSnapshot();
-                CProgress progress = console.RestoreSnapshot(snapshot);
-                if (!console.isOk())
-                    return msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), machine.GetName());
-
-                /* Show the snapshot-discard progress: */
-                msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_snapshot_discard_90px.png");
-                if (progress.GetResultCode() != 0)
-                    return msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), machine.GetName());
-            }
+                return restoreCurrentSnapshot();
         }
         else
         {
             /* Failed in progress: */
-            msgCenter().cannotPowerDownMachine(progress, machine.GetName());
+            msgCenter().cannotPowerDownMachine(progress, machineName());
             return false;
         }
     }
     else
     {
-        /* Failed in console: */
-        COMResult res(console);
-        /* This can happen if VBoxSVC is not running: */
-        if (FAILED_DEAD_INTERFACE(res.rc()))
-            fServerCrashed = true;
-        else
-            msgCenter().cannotPowerDownMachine(console);
-        return false;
+        /* Check the machine state, it might be already gone: */
+        if (!console().isNull())
+        {
+           /* Failed in console: */
+           COMResult res(console());
+           /* This can happen if VBoxSVC is not running: */
+           if (FAILED_DEAD_INTERFACE(res.rc()))
+               fServerCrashed = true;
+           else
+               msgCenter().cannotPowerDownMachine(console());
+           return false;
+        }
     }
     /* Passed: */
     return true;
 }
 
-void UISession::closeRuntimeUI()
+bool UISession::restoreCurrentSnapshot()
 {
-    /* Start corresponding slot asynchronously: */
-    emit sigCloseRuntimeUI();
-}
+    /* Prepare result: */
+    bool fResult = false;
 
-UIMachineLogic* UISession::machineLogic() const
-{
-    return uimachine()->machineLogic();
-}
+    /* Simulate try-catch block: */
+    do
+    {
+        /* Search for corresponding VM: */
+        CVirtualBox vbox = vboxGlobal().virtualBox();
+        const QString strMachineID = vboxGlobal().managedVMUuid();
+        const CMachine mach = vbox.FindMachine(strMachineID);
+        if (!vbox.isOk() || mach.isNull())
+        {
+            /* Unable to find VM: */
+            msgCenter().cannotFindMachineById(vbox, strMachineID);
+            break;
+        }
 
-QWidget* UISession::mainMachineWindow() const
-{
-    return machineLogic()->mainMachineWindow();
-}
+        /* Open a direct session to modify that VM: */
+        CSession sess = vboxGlobal().openSession(vboxGlobal().managedVMUuid(),
+                                                 vboxGlobal().isSeparateProcess()
+                                                 ? KLockType_Write : KLockType_Shared);
+        if (sess.isNull())
+        {
+            /* Unable to open session: */
+            break;
+        }
 
-QMenu* UISession::newMenu(RuntimeMenuType fOptions /* = RuntimeMenuType_ALL */)
-{
-    /* Create new menu: */
-    QMenu *pMenu = m_pMenuPool->createMenu(fOptions);
+        /* Simulate try-catch block: */
+        do
+        {
+            /* Acquire machine for this session: */
+            CMachine machine = sess.GetMachine();
+            if (machine.isNull())
+            {
+                /* Unable to acquire machine: */
+                break;
+            }
+
+            /* Prepare the snapshot-discard progress: */
+            const CSnapshot snap = machine.GetCurrentSnapshot();
+            CProgress prog = machine.RestoreSnapshot(snap);
+            if (!machine.isOk() || prog.isNull())
+            {
+                /* Unable to restore snapshot: */
+                msgCenter().cannotRestoreSnapshot(machine, snap.GetName(), machineName());
+                break;
+            }
 
-    /* Re-init menu pool for the case menu were recreated: */
-    reinitMenuPool();
+            /* Show the snapshot-discard progress: */
+            msgCenter().showModalProgressDialog(prog, machine.GetName(), ":/progress_snapshot_discard_90px.png");
+            if (prog.GetResultCode() != 0)
+            {
+                /* Unable to restore snapshot: */
+                msgCenter().cannotRestoreSnapshot(prog, snap.GetName(), machine.GetName());
+                break;
+            }
 
-    /* Return newly created menu: */
-    return pMenu;
-}
+            /* Success: */
+            fResult = true;
+        }
+        while (0);
 
-QMenuBar* UISession::newMenuBar(RuntimeMenuType fOptions /* = RuntimeMenuType_ALL */)
-{
-    /* Create new menubar: */
-    QMenuBar *pMenuBar = m_pMenuPool->createMenuBar(fOptions);
+        /* Unlock machine finally: */
+        sess.UnlockMachine();
+    }
+    while (0);
 
-    /* Re-init menu pool for the case menu were recreated: */
-    reinitMenuPool();
+    /* Return result: */
+    return fResult;
+}
 
-    /* Return newly created menubar: */
-    return pMenuBar;
+void UISession::closeRuntimeUI()
+{
+    /* Start corresponding slot asynchronously: */
+    emit sigCloseRuntimeUI();
 }
 
-bool UISession::isVisualStateAllowedFullscreen() const
+UIMachineLogic* UISession::machineLogic() const
 {
-    return m_pMachine->isVisualStateAllowedFullscreen();
+    return uimachine() ? uimachine()->machineLogic() : 0;
 }
 
-bool UISession::isVisualStateAllowedSeamless() const
+QWidget* UISession::mainMachineWindow() const
 {
-    return m_pMachine->isVisualStateAllowedSeamless();
+    return machineLogic() ? machineLogic()->mainMachineWindow() : 0;
 }
 
-bool UISession::isVisualStateAllowedScale() const
+bool UISession::isVisualStateAllowed(UIVisualStateType state) const
 {
-    return m_pMachine->isVisualStateAllowedScale();
+    return m_pMachine->isVisualStateAllowed(state);
 }
 
 void UISession::changeVisualState(UIVisualStateType visualStateType)
@@ -524,20 +484,18 @@ void UISession::changeVisualState(UIVisualStateType visualStateType)
 
 bool UISession::setPause(bool fOn)
 {
-    CConsole console = session().GetConsole();
-
     if (fOn)
-        console.Pause();
+        console().Pause();
     else
-        console.Resume();
+        console().Resume();
 
-    bool ok = console.isOk();
+    bool ok = console().isOk();
     if (!ok)
     {
         if (fOn)
-            msgCenter().cannotPauseMachine(console);
+            msgCenter().cannotPauseMachine(console());
         else
-            msgCenter().cannotResumeMachine(console);
+            msgCenter().cannotResumeMachine(console());
     }
 
     return ok;
@@ -545,24 +503,19 @@ bool UISession::setPause(bool fOn)
 
 void UISession::sltInstallGuestAdditionsFrom(const QString &strSource)
 {
-    CMachine machine = session().GetMachine();
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-
-    /*
-     * Flag indicating whether we want to do the usual .ISO mounting or not.
-     * First try updating the Guest Additions directly without mounting the .ISO.
-     */
+    /* This flag indicates whether we want to do the usual .ISO mounting or not.
+     * First try updating the Guest Additions directly without mounting the .ISO. */
     bool fDoMount = false;
+
     /* Auto-update in GUI currently is disabled. */
 #ifndef VBOX_WITH_ADDITIONS_AUTOUPDATE_UI
     fDoMount = true;
-#else
-    CGuest guest = session().GetConsole().GetGuest();
+#else /* VBOX_WITH_ADDITIONS_AUTOUPDATE_UI */
     QVector<KAdditionsUpdateFlag> aFlagsUpdate;
     QVector<QString> aArgs;
-    CProgress progressInstall = guest.UpdateGuestAdditions(strSource,
-                                                           aArgs, aFlagsUpdate);
-    bool fResult = guest.isOk();
+    CProgress progressInstall = guest().UpdateGuestAdditions(strSource,
+                                                             aArgs, aFlagsUpdate);
+    bool fResult = guest().isOk();
     if (fResult)
     {
         msgCenter().showModalProgressDialog(progressInstall, tr("Updating Guest Additions"),
@@ -592,79 +545,74 @@ void UISession::sltInstallGuestAdditionsFrom(const QString &strSource)
     }
 #endif /* VBOX_WITH_ADDITIONS_AUTOUPDATE_UI */
 
-    if (fDoMount) /* Fallback to only mounting the .ISO file. */
-    {
-        QString strUuid;
-        CMedium image = vbox.OpenMedium(strSource, KDeviceType_DVD, KAccessMode_ReadWrite, false /* fForceNewUuid */);
-        if (image.isNull())
-        {
-            image = vbox.OpenMedium(strSource, KDeviceType_DVD, KAccessMode_ReadWrite, false /* fForceNewUuid */);
-            if (vbox.isOk())
-                strUuid = image.GetId();
-        }
-        else
-            strUuid = image.GetId();
+    /* Do we still want mounting? */
+    if (!fDoMount)
+        return;
 
-        if (!vbox.isOk())
-        {
-            msgCenter().cannotOpenMedium(vbox, UIMediumType_DVD, strSource, mainMachineWindow());
-            return;
-        }
+    /* Open corresponding medium: */
+    QString strMediumID;
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    CMedium image = vbox.OpenMedium(strSource, KDeviceType_DVD, KAccessMode_ReadWrite, false /* fForceNewUuid */);
+    if (vbox.isOk() && !image.isNull())
+        strMediumID = image.GetId();
+    else
+    {
+        msgCenter().cannotOpenMedium(vbox, UIMediumType_DVD, strSource, mainMachineWindow());
+        return;
+    }
 
-        AssertMsg(!strUuid.isNull(), ("Guest Additions image UUID should be valid!\n"));
+    /* Make sure GA medium ID is valid: */
+    AssertReturnVoid(!strMediumID.isNull());
 
-        QString strCntName;
-        LONG iCntPort = -1, iCntDevice = -1;
-        /* Searching for the first suitable slot */
+    /* Searching for the first suitable controller/slot: */
+    QString strControllerName;
+    LONG iCntPort = -1, iCntDevice = -1;
+    foreach (const CStorageController &controller, machine().GetStorageControllers())
+    {
+        foreach (const CMediumAttachment &attachment, machine().GetMediumAttachmentsOfController(controller.GetName()))
         {
-            CStorageControllerVector controllers = machine.GetStorageControllers();
-            int i = 0;
-            while (i < controllers.size() && strCntName.isNull())
+            if (attachment.GetType() == KDeviceType_DVD)
             {
-                CStorageController controller = controllers[i];
-                CMediumAttachmentVector attachments = machine.GetMediumAttachmentsOfController(controller.GetName());
-                int j = 0;
-                while (j < attachments.size() && strCntName.isNull())
-                {
-                    CMediumAttachment attachment = attachments[j];
-                    if (attachment.GetType() == KDeviceType_DVD)
-                    {
-                        strCntName = controller.GetName();
-                        iCntPort = attachment.GetPort();
-                        iCntDevice = attachment.GetDevice();
-                    }
-                    ++ j;
-                }
-                ++ i;
+                strControllerName = controller.GetName();
+                iCntPort = attachment.GetPort();
+                iCntDevice = attachment.GetDevice();
+                break;
             }
         }
+        if (!strControllerName.isNull())
+            break;
+    }
 
-        if (!strCntName.isNull())
-        {
-            /* Create new UIMedium: */
-            UIMedium medium(image, UIMediumType_DVD, KMediumState_Created);
+    /* Make sure suitable controller/slot were found: */
+    if (strControllerName.isNull())
+    {
+        msgCenter().cannotMountGuestAdditions(machineName());
+        return;
+    }
 
-            /* Inform VBoxGlobal about it: */
-            vboxGlobal().createMedium(medium);
+    /* Try to find UIMedium among cached: */
+    UIMedium medium = vboxGlobal().medium(strMediumID);
+    if (medium.isNull())
+    {
+        /* Create new one if necessary: */
+        medium = UIMedium(image, UIMediumType_DVD, KMediumState_Created);
+        vboxGlobal().createMedium(medium);
+    }
 
-            /* Mount medium to the predefined port/device: */
-            machine.MountMedium(strCntName, iCntPort, iCntDevice, medium.medium(), false /* force */);
-            if (!machine.isOk())
-            {
-                /* Ask for force mounting: */
-                if (msgCenter().cannotRemountMedium(machine, medium, true /* mount? */,
-                                                    true /* retry? */, mainMachineWindow()))
-                {
-                    /* Force mount medium to the predefined port/device: */
-                    machine.MountMedium(strCntName, iCntPort, iCntDevice, medium.medium(), true /* force */);
-                    if (!machine.isOk())
-                        msgCenter().cannotRemountMedium(machine, medium, true /* mount? */,
-                                                        false /* retry? */, mainMachineWindow());
-                }
-            }
+    /* Mount medium to corresponding controller/slot: */
+    machine().MountMedium(strControllerName, iCntPort, iCntDevice, medium.medium(), false /* force */);
+    if (!machine().isOk())
+    {
+        /* Ask for force mounting: */
+        if (msgCenter().cannotRemountMedium(machine(), medium, true /* mount? */,
+                                            true /* retry? */, mainMachineWindow()))
+        {
+            /* Force mount medium to the predefined port/device: */
+            machine().MountMedium(strControllerName, iCntPort, iCntDevice, medium.medium(), true /* force */);
+            if (!machine().isOk())
+                msgCenter().cannotRemountMedium(machine(), medium, true /* mount? */,
+                                                false /* retry? */, mainMachineWindow());
         }
-        else
-            msgCenter().cannotMountGuestAdditions(machine.GetName());
     }
 }
 
@@ -685,15 +633,27 @@ void UISession::sltCloseRuntimeUI()
          * and unlock his event-loop if any: */
         if (!pWidget->isHidden())
             pWidget->hide();
-        /* Restart this slot asynchronously: */
+        /* Restart this slot: */
         emit sigCloseRuntimeUI();
         return;
     }
 
     /* Finally close the Runtime UI: */
-    m_pMachine->deleteLater();
+    UIMachine::destroy();
 }
 
+#ifdef RT_OS_DARWIN
+void UISession::sltHandleMenuBarConfigurationChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (vboxGlobal().managedVMUuid() != strMachineID)
+        return;
+
+    /* Update Mac OS X menu-bar: */
+    updateMenu();
+}
+#endif /* RT_OS_DARWIN */
+
 void UISession::sltMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape)
 {
     /* In case of shape data is present: */
@@ -721,7 +681,7 @@ void UISession::sltMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint ho
 
 void UISession::sltMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fSupportsMultiTouch, bool fNeedsHostCursor)
 {
-    LogRelFlow(("UISession::sltMouseCapabilityChange: "
+    LogRelFlow(("GUI: UISession::sltMouseCapabilityChange: "
                 "Supports absolute: %s, Supports relative: %s, "
                 "Supports multi-touch: %s, Needs host cursor: %s\n",
                 fSupportsAbsolute ? "TRUE" : "FALSE", fSupportsRelative ? "TRUE" : "FALSE",
@@ -785,9 +745,6 @@ void UISession::sltStateChange(KMachineState state)
         m_machineStatePrevious = m_machineState;
         m_machineState = state;
 
-        /* Update session settings: */
-        updateSessionSettings();
-
         /* Notify listeners about machine state changed: */
         emit sigMachineStateChange();
     }
@@ -795,26 +752,27 @@ void UISession::sltStateChange(KMachineState state)
 
 void UISession::sltVRDEChange()
 {
-    /* Get machine: */
-    const CMachine machine = session().GetMachine();
-    /* Get VRDE server: */
-    const CVRDEServer &server = machine.GetVRDEServer();
-    bool fIsVRDEServerAvailable = !server.isNull();
-    /* Show/Hide VRDE action depending on VRDE server availability status: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer)->setVisible(fIsVRDEServerAvailable);
-    /* Check/Uncheck VRDE action depending on VRDE server activity status: */
-    if (fIsVRDEServerAvailable)
-        gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer)->setChecked(server.GetEnabled());
+    /* Make sure VRDE server is present: */
+    const CVRDEServer server = machine().GetVRDEServer();
+    AssertMsgReturnVoid(machine().isOk() && !server.isNull(),
+                        ("VRDE server should NOT be null!\n"));
+
+    /* Check/Uncheck VRDE Server action depending on feature status: */
+    actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(true);
+    actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->setChecked(server.GetEnabled());
+    actionPool()->action(UIActionIndexRT_M_View_T_VRDEServer)->blockSignals(false);
+
     /* Notify listeners about VRDE change: */
     emit sigVRDEChange();
 }
 
 void UISession::sltVideoCaptureChange()
 {
-    /* Get machine: */
-    const CMachine machine = session().GetMachine();
     /* Check/Uncheck Video Capture action depending on feature status: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture)->setChecked(machine.GetVideoCaptureEnabled());
+    actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start)->blockSignals(true);
+    actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start)->setChecked(machine().GetVideoCaptureEnabled());
+    actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture_T_Start)->blockSignals(false);
+
     /* Notify listeners about Video Capture change: */
     emit sigVideoCaptureChange();
 }
@@ -850,7 +808,7 @@ void UISession::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType,
  */
 void UISession::sltHandleHostDisplayAboutToChange()
 {
-    LogRelFlow(("UISession::sltHandleHostDisplayAboutToChange()\n"));
+    LogRelFlow(("GUI: UISession::sltHandleHostDisplayAboutToChange()\n"));
 
     if (m_pWatchdogDisplayChange->isActive())
         m_pWatchdogDisplayChange->stop();
@@ -865,16 +823,14 @@ void UISession::sltHandleHostDisplayAboutToChange()
  */
 void UISession::sltCheckIfHostDisplayChanged()
 {
-    LogRelFlow(("UISession::sltCheckIfHostDisplayChanged()\n"));
+    LogRelFlow(("GUI: UISession::sltCheckIfHostDisplayChanged()\n"));
 
     /* Acquire desktop wrapper: */
     QDesktopWidget *pDesktop = QApplication::desktop();
 
     /* Check if display count changed: */
-    if (pDesktop->screenCount() != m_screens.size())
+    if (pDesktop->screenCount() != m_hostScreens.size())
     {
-        /* Recache display data: */
-        recacheDisplayData();
         /* Reset watchdog: */
         m_pWatchdogDisplayChange->setProperty("tryNumber", 0);
         /* Notify listeners about screen-count changed: */
@@ -885,10 +841,8 @@ void UISession::sltCheckIfHostDisplayChanged()
         /* Check if at least one display geometry changed: */
         for (int iScreenIndex = 0; iScreenIndex < pDesktop->screenCount(); ++iScreenIndex)
         {
-            if (pDesktop->screenGeometry(iScreenIndex) != m_screens.at(iScreenIndex))
+            if (pDesktop->screenGeometry(iScreenIndex) != m_hostScreens.at(iScreenIndex))
             {
-                /* Recache display data: */
-                recacheDisplayData();
                 /* Reset watchdog: */
                 m_pWatchdogDisplayChange->setProperty("tryNumber", 0);
                 /* Notify listeners about screen-geometry changed: */
@@ -915,62 +869,331 @@ void UISession::sltCheckIfHostDisplayChanged()
 
 void UISession::sltHandleHostScreenCountChange()
 {
-    LogRelFlow(("UISession: Host-screen count changed.\n"));
+    LogRelFlow(("GUI: UISession: Host-screen count changed.\n"));
+
+    /* Recache display data: */
+    updateHostScreenData();
 
     /* Notify current machine-logic: */
     emit sigHostScreenCountChange();
 }
 
-void UISession::sltHandleHostScreenGeometryChange()
-{
-    LogRelFlow(("UISession: Host-screen geometry changed.\n"));
+void UISession::sltHandleHostScreenGeometryChange()
+{
+    LogRelFlow(("GUI: UISession: Host-screen geometry changed.\n"));
+
+    /* Recache display data: */
+    updateHostScreenData();
+
+    /* Notify current machine-logic: */
+    emit sigHostScreenGeometryChange();
+}
+
+void UISession::sltHandleHostScreenAvailableAreaChange()
+{
+    LogRelFlow(("GUI: UISession: Host-screen available-area changed.\n"));
+
+    /* Notify current machine-logic: */
+    emit sigHostScreenAvailableAreaChange();
+}
+
+void UISession::sltAdditionsChange()
+{
+    /* Variable flags: */
+    ULONG ulGuestAdditionsRunLevel = guest().GetAdditionsRunLevel();
+    LONG64 lLastUpdatedIgnored;
+    bool fIsGuestSupportsGraphics = guest().GetFacilityStatus(KAdditionsFacilityType_Graphics, lLastUpdatedIgnored)
+                                    == KAdditionsFacilityStatus_Active;
+    bool fIsGuestSupportsSeamless = guest().GetFacilityStatus(KAdditionsFacilityType_Seamless, lLastUpdatedIgnored)
+                                    == KAdditionsFacilityStatus_Active;
+    /* Check if something had changed: */
+    if (m_ulGuestAdditionsRunLevel != ulGuestAdditionsRunLevel ||
+        m_fIsGuestSupportsGraphics != fIsGuestSupportsGraphics ||
+        m_fIsGuestSupportsSeamless != fIsGuestSupportsSeamless)
+    {
+        /* Store new data: */
+        m_ulGuestAdditionsRunLevel = ulGuestAdditionsRunLevel;
+        m_fIsGuestSupportsGraphics = fIsGuestSupportsGraphics;
+        m_fIsGuestSupportsSeamless = fIsGuestSupportsSeamless;
+
+        /* Notify listeners about guest additions state really changed: */
+        emit sigAdditionsStateActualChange();
+    }
+
+    /* Notify listeners about guest additions state event came: */
+    emit sigAdditionsStateChange();
+}
+
+UISession::UISession(UIMachine *pMachine)
+    : QObject(pMachine)
+    /* Base variables: */
+    , m_pMachine(pMachine)
+    , m_pActionPool(0)
+#ifdef Q_WS_MAC
+    , m_pMenuBar(0)
+#endif /* Q_WS_MAC */
+    /* Common variables: */
+    , m_machineStatePrevious(KMachineState_Null)
+    , m_machineState(KMachineState_Null)
+#ifndef Q_WS_MAC
+    , m_pMachineWindowIcon(0)
+#endif /* !Q_WS_MAC */
+    , m_requestedVisualStateType(UIVisualStateType_Invalid)
+#ifdef Q_WS_WIN
+    , m_alphaCursor(0)
+#endif /* Q_WS_WIN */
+#ifdef Q_WS_MAC
+    , m_pWatchdogDisplayChange(0)
+#endif /* Q_WS_MAC */
+    , m_defaultCloseAction(MachineCloseAction_Invalid)
+    , m_restrictedCloseActions(MachineCloseAction_Invalid)
+    , m_fAllCloseActionsRestricted(false)
+    /* Common flags: */
+    , m_fInitialized(false)
+    , m_fIsFirstTimeStarted(false)
+    , m_fIsGuestResizeIgnored(false)
+    , m_fIsAutoCaptureDisabled(false)
+    /* Guest additions flags: */
+    , m_ulGuestAdditionsRunLevel(0)
+    , m_fIsGuestSupportsGraphics(false)
+    , m_fIsGuestSupportsSeamless(false)
+    /* Mouse flags: */
+    , m_fNumLock(false)
+    , m_fCapsLock(false)
+    , m_fScrollLock(false)
+    , m_uNumLockAdaptionCnt(2)
+    , m_uCapsLockAdaptionCnt(2)
+    /* Mouse flags: */
+    , m_fIsMouseSupportsAbsolute(false)
+    , m_fIsMouseSupportsRelative(false)
+    , m_fIsMouseSupportsMultiTouch(false)
+    , m_fIsMouseHostCursorNeeded(false)
+    , m_fIsMouseCaptured(false)
+    , m_fIsMouseIntegrated(true)
+    , m_fIsValidPointerShapePresent(false)
+    , m_fIsHidingHostPointer(true)
+{
+}
+
+UISession::~UISession()
+{
+}
+
+bool UISession::prepare()
+{
+    /* Prepare session: */
+    if (!prepareSession())
+        return false;
+
+    /* Prepare actions: */
+    prepareActions();
+
+    /* Prepare connections: */
+    prepareConnections();
+
+    /* Prepare console event-handlers: */
+    prepareConsoleEventHandlers();
+
+    /* Prepare screens: */
+    prepareScreens();
+
+    /* Prepare framebuffers: */
+    prepareFramebuffers();
+
+    /* Load settings: */
+    loadSessionSettings();
+
+#ifdef VBOX_GUI_WITH_KEYS_RESET_HANDLER
+    struct sigaction sa;
+    sa.sa_sigaction = &signalHandlerSIGUSR1;
+    sigemptyset(&sa.sa_mask);
+    sa.sa_flags = SA_RESTART | SA_SIGINFO;
+    sigaction(SIGUSR1, &sa, NULL);
+#endif /* VBOX_GUI_WITH_KEYS_RESET_HANDLER */
+
+    /* True by default: */
+    return true;
+}
+
+bool UISession::prepareSession()
+{
+    /* Open session: */
+    m_session = vboxGlobal().openSession(vboxGlobal().managedVMUuid(),
+                                         vboxGlobal().isSeparateProcess()
+                                         ? KLockType_Shared : KLockType_VM);
+    if (m_session.isNull())
+        return false;
+
+    /* Get machine: */
+    m_machine = m_session.GetMachine();
+    if (m_machine.isNull())
+        return false;
+
+    /* Get console: */
+    m_console = m_session.GetConsole();
+    if (m_console.isNull())
+        return false;
+
+    /* Get display: */
+    m_display = m_console.GetDisplay();
+    if (m_display.isNull())
+        return false;
+
+    /* Get guest: */
+    m_guest = m_console.GetGuest();
+    if (m_guest.isNull())
+        return false;
+
+    /* Get mouse: */
+    m_mouse = m_console.GetMouse();
+    if (m_mouse.isNull())
+        return false;
+
+    /* Get keyboard: */
+    m_keyboard = m_console.GetKeyboard();
+    if (m_keyboard.isNull())
+        return false;
+
+    /* Get debugger: */
+    m_debugger = m_console.GetDebugger();
+    if (m_debugger.isNull())
+        return false;
+
+    /* Update machine-name: */
+    m_strMachineName = machine().GetName();
+
+    /* Update machine-state: */
+    m_machineState = machine().GetState();
+
+    /* True by default: */
+    return true;
+}
+
+void UISession::prepareActions()
+{
+    /* Create action-pool: */
+    m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime);
+    AssertPtrReturnVoid(actionPool());
+    {
+        /* Configure action-pool: */
+        actionPool()->toRuntime()->setSession(this);
+
+        /* Get host: */
+        const CHost host = vboxGlobal().host();
+        UIExtraDataMetaDefs::RuntimeMenuViewActionType restrictionForView = UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid;
+        UIExtraDataMetaDefs::RuntimeMenuDevicesActionType restrictionForDevices = UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Invalid;
+
+        /* VRDE server stuff: */
+        {
+            /* Initialize 'View' menu: */
+            const CVRDEServer server = machine().GetVRDEServer();
+            if (server.isNull())
+                restrictionForView = (UIExtraDataMetaDefs::RuntimeMenuViewActionType)(restrictionForView | UIExtraDataMetaDefs::RuntimeMenuViewActionType_VRDEServer);
+        }
+
+        /* Storage stuff: */
+        {
+            /* Initialize CD/FD menus: */
+            int iDevicesCountCD = 0;
+            int iDevicesCountFD = 0;
+            foreach (const CMediumAttachment &attachment, machine().GetMediumAttachments())
+            {
+                if (attachment.GetType() == KDeviceType_DVD)
+                    ++iDevicesCountCD;
+                if (attachment.GetType() == KDeviceType_Floppy)
+                    ++iDevicesCountFD;
+            }
+            QAction *pOpticalDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices);
+            QAction *pFloppyDevicesMenu = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices);
+            pOpticalDevicesMenu->setData(iDevicesCountCD);
+            pFloppyDevicesMenu->setData(iDevicesCountFD);
+            if (!iDevicesCountCD)
+                restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_OpticalDevices);
+            if (!iDevicesCountFD)
+                restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_FloppyDevices);
+        }
+
+        /* Network stuff: */
+        {
+            /* Initialize Network menu: */
+            bool fAtLeastOneAdapterActive = false;
+            const KChipsetType chipsetType = machine().GetChipsetType();
+            ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(chipsetType);
+            for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot)
+            {
+                const CNetworkAdapter &adapter = machine().GetNetworkAdapter(uSlot);
+                if (adapter.GetEnabled())
+                {
+                    fAtLeastOneAdapterActive = true;
+                    break;
+                }
+            }
+            if (!fAtLeastOneAdapterActive)
+                restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_Network);
+        }
 
-    /* Notify current machine-logic: */
-    emit sigHostScreenGeometryChange();
-}
+        /* USB stuff: */
+        {
+            /* Check whether there is at least one USB controller with an available proxy. */
+            const bool fUSBEnabled =    !machine().GetUSBDeviceFilters().isNull()
+                                     && !machine().GetUSBControllers().isEmpty()
+                                     && machine().GetUSBProxyAvailable();
+            if (!fUSBEnabled)
+                restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_USBDevices);
+        }
 
-void UISession::sltHandleHostScreenAvailableAreaChange()
-{
-    LogRelFlow(("UISession: Host-screen available-area changed.\n"));
+        /* WebCams stuff: */
+        {
+            /* Check whether there is an accessible video input devices pool: */
+            host.GetVideoInputDevices();
+            const bool fWebCamsEnabled = host.isOk() && !machine().GetUSBControllers().isEmpty();
+            if (!fWebCamsEnabled)
+                restrictionForDevices = (UIExtraDataMetaDefs::RuntimeMenuDevicesActionType)(restrictionForDevices | UIExtraDataMetaDefs::RuntimeMenuDevicesActionType_WebCams);
+        }
 
-    /* Notify current machine-logic: */
-    emit sigHostScreenAvailableAreaChange();
+        /* Apply cumulative restriction for 'View' menu: */
+        actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Session, restrictionForView);
+        /* Apply cumulative restriction for 'Devices' menu: */
+        actionPool()->toRuntime()->setRestrictionForMenuDevices(UIActionRestrictionLevel_Session, restrictionForDevices);
+
+#ifdef Q_WS_MAC
+        /* Create Mac OS X menu-bar: */
+        m_pMenuBar = new UIMenuBar;
+        AssertPtrReturnVoid(m_pMenuBar);
+        {
+            /* Configure Mac OS X menu-bar: */
+            connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
+                    this, SLOT(sltHandleMenuBarConfigurationChange(const QString&)));
+            /* Update Mac OS X menu-bar: */
+            updateMenu();
+        }
+#endif /* Q_WS_MAC */
+    }
 }
 
-void UISession::sltAdditionsChange()
+void UISession::prepareConnections()
 {
-    /* Get our guest: */
-    CGuest guest = session().GetConsole().GetGuest();
-
-    /* Variable flags: */
-    ULONG ulGuestAdditionsRunLevel = guest.GetAdditionsRunLevel();
-    LONG64 lLastUpdatedIgnored;
-    bool fIsGuestSupportsGraphics = guest.GetFacilityStatus(KAdditionsFacilityType_Graphics, lLastUpdatedIgnored)
-                                    == KAdditionsFacilityStatus_Active;
-    bool fIsGuestSupportsSeamless = guest.GetFacilityStatus(KAdditionsFacilityType_Seamless, lLastUpdatedIgnored)
-                                    == KAdditionsFacilityStatus_Active;
-    /* Check if something had changed: */
-    if (m_ulGuestAdditionsRunLevel != ulGuestAdditionsRunLevel ||
-        m_fIsGuestSupportsGraphics != fIsGuestSupportsGraphics ||
-        m_fIsGuestSupportsSeamless != fIsGuestSupportsSeamless)
-    {
-        /* Store new data: */
-        m_ulGuestAdditionsRunLevel = ulGuestAdditionsRunLevel;
-        m_fIsGuestSupportsGraphics = fIsGuestSupportsGraphics;
-        m_fIsGuestSupportsSeamless = fIsGuestSupportsSeamless;
-
-        /* Notify listeners about guest additions state really changed: */
-        emit sigAdditionsStateActualChange();
-    }
+    connect(this, SIGNAL(sigInitialized()), this, SLOT(sltMarkInitialized()));
+    connect(this, SIGNAL(sigCloseRuntimeUI()), this, SLOT(sltCloseRuntimeUI()));
 
-    /* Notify listeners about guest additions state event came: */
-    emit sigAdditionsStateChange();
+#ifdef Q_WS_MAC
+    /* Install native display reconfiguration callback: */
+    CGDisplayRegisterReconfigurationCallback(cgDisplayReconfigurationCallback, this);
+#else /* !Q_WS_MAC */
+    /* Install Qt display reconfiguration callbacks: */
+    connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)),
+            this, SLOT(sltHandleHostScreenCountChange()));
+    connect(QApplication::desktop(), SIGNAL(resized(int)),
+            this, SLOT(sltHandleHostScreenGeometryChange()));
+    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
+            this, SLOT(sltHandleHostScreenAvailableAreaChange()));
+#endif /* !Q_WS_MAC */
 }
 
 void UISession::prepareConsoleEventHandlers()
 {
-    /* Initialize console event-handler: */
-    UIConsoleEventHandler::instance(this);
+    /* Create console event-handler: */
+    UIConsoleEventHandler::create(this);
 
     /* Add console event connections: */
     connect(gConsoleEvents, SIGNAL(sigMousePointerShapeChange(bool, bool, QPoint, QSize, QVector<uint8_t>)),
@@ -1024,30 +1247,12 @@ void UISession::prepareConsoleEventHandlers()
             this, SLOT(sltGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)));
 }
 
-void UISession::prepareConnections()
-{
-    connect(this, SIGNAL(sigStarted()), this, SLOT(sltMarkStarted()));
-    connect(this, SIGNAL(sigCloseRuntimeUI()), this, SLOT(sltCloseRuntimeUI()));
-
-#ifdef Q_WS_MAC
-    /* Install native display reconfiguration callback: */
-    CGDisplayRegisterReconfigurationCallback(cgDisplayReconfigurationCallback, this);
-#else /* !Q_WS_MAC */
-    /* Install Qt display reconfiguration callbacks: */
-    connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)),
-            this, SLOT(sltHandleHostScreenCountChange()));
-    connect(QApplication::desktop(), SIGNAL(resized(int)),
-            this, SLOT(sltHandleHostScreenGeometryChange()));
-    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
-            this, SLOT(sltHandleHostScreenAvailableAreaChange()));
-#endif /* !Q_WS_MAC */
-}
-
 void UISession::prepareScreens()
 {
-#ifdef Q_WS_MAC
     /* Recache display data: */
-    recacheDisplayData();
+    updateHostScreenData();
+
+#ifdef Q_WS_MAC
     /* Prepare display-change watchdog: */
     m_pWatchdogDisplayChange = new QTimer(this);
     {
@@ -1058,11 +1263,8 @@ void UISession::prepareScreens()
     }
 #endif /* Q_WS_MAC */
 
-    /* Get machine: */
-    CMachine machine = m_session.GetMachine();
-
     /* Prepare initial screen visibility status: */
-    m_monitorVisibilityVector.resize(machine.GetMonitorCount());
+    m_monitorVisibilityVector.resize(machine().GetMonitorCount());
     m_monitorVisibilityVector.fill(false);
     m_monitorVisibilityVector[0] = true;
 
@@ -1070,12 +1272,31 @@ void UISession::prepareScreens()
     if (isSaved())
     {
         /* Update screen visibility status from saved-state: */
-        for (int i = 0; i < m_monitorVisibilityVector.size(); ++i)
+        for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
         {
             BOOL fEnabled = true;
-            ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
-            machine.QuerySavedGuestScreenInfo(i, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
-            m_monitorVisibilityVector[i] = fEnabled;
+            ULONG uGuestOriginX = 0, uGuestOriginY = 0, uGuestWidth = 0, uGuestHeight = 0;
+            machine().QuerySavedGuestScreenInfo(iScreenIndex,
+                                                uGuestOriginX, uGuestOriginY,
+                                                uGuestWidth, uGuestHeight, fEnabled);
+            m_monitorVisibilityVector[iScreenIndex] = fEnabled;
+        }
+        /* And make sure at least one of them is visible (primary if others are hidden): */
+        if (countOfVisibleWindows() < 1)
+            m_monitorVisibilityVector[0] = true;
+    }
+    else if (vboxGlobal().isSeparateProcess())
+    {
+        /* Update screen visibility status from display directly: */
+        for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
+        {
+            KGuestMonitorStatus enmStatus = KGuestMonitorStatus_Disabled;
+            ULONG uGuestWidth = 0, uGuestHeight = 0, uBpp = 0;
+            LONG iGuestOriginX = 0, iGuestOriginY = 0;
+            display().GetScreenResolution(iScreenIndex,
+                                          uGuestWidth, uGuestHeight, uBpp,
+                                          iGuestOriginX, iGuestOriginY, enmStatus);
+            m_monitorVisibilityVector[iScreenIndex] = (enmStatus == KGuestMonitorStatus_Enabled);
         }
         /* And make sure at least one of them is visible (primary if others are hidden): */
         if (countOfVisibleWindows() < 1)
@@ -1086,141 +1307,92 @@ void UISession::prepareScreens()
 void UISession::prepareFramebuffers()
 {
     /* Each framebuffer will be really prepared on first UIMachineView creation: */
-    m_frameBufferVector.resize(m_session.GetMachine().GetMonitorCount());
-}
-
-void UISession::prepareMenuPool()
-{
-    m_pMenuPool = new UIMachineMenuBar(this);
+    m_frameBufferVector.resize(machine().GetMonitorCount());
 }
 
 void UISession::loadSessionSettings()
 {
-    /* Get vbox instance: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    /* Get uisession machine: */
-    CMachine machine = session().GetConsole().GetMachine();
-
     /* Load extra-data settings: */
     {
-        /* Extension pack stuff: */
-        CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
-        m_fIsExtensionPackUsable = !extPack.isNull() && extPack.GetUsable();
-
-        /* Runtime menu settings: */
-#ifdef Q_WS_MAC
-        m_allowedActionsMenuApplication = (RuntimeMenuApplicationActionType)
-                                          (vboxGlobal().restrictedRuntimeMenuApplicationActionTypes(machine) ^
-                                           RuntimeMenuApplicationActionType_All);
-#endif /* Q_WS_MAC */
-        m_allowedActionsMenuMachine     = (RuntimeMenuMachineActionType)
-                                          (vboxGlobal().restrictedRuntimeMenuMachineActionTypes(machine) ^
-                                           RuntimeMenuMachineActionType_All);
-        m_allowedActionsMenuView        = (RuntimeMenuViewActionType)
-                                          (vboxGlobal().restrictedRuntimeMenuViewActionTypes(machine) ^
-                                           RuntimeMenuViewActionType_All);
-        m_allowedActionsMenuDevices     = (RuntimeMenuDevicesActionType)
-                                          (vboxGlobal().restrictedRuntimeMenuDevicesActionTypes(machine) ^
-                                           RuntimeMenuDevicesActionType_All);
-#ifdef VBOX_WITH_DEBUGGER_GUI
-        m_allowedActionsMenuDebugger    = (RuntimeMenuDebuggerActionType)
-                                          (vboxGlobal().restrictedRuntimeMenuDebuggerActionTypes(machine) ^
-                                           RuntimeMenuDebuggerActionType_All);
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-        m_allowedActionsMenuHelp        = (RuntimeMenuHelpActionType)
-                                          (vboxGlobal().restrictedRuntimeMenuHelpActionTypes(machine) ^
-                                           RuntimeMenuHelpActionType_All);
-
-        /* Temporary: */
-        QString strSettings;
+        /* Get machine ID: */
+        const QString strMachineID = vboxGlobal().managedVMUuid();
 
 #ifndef Q_WS_MAC
         /* Load/prepare user's machine-window icon: */
         QIcon icon;
-        foreach (const QString &strIconName, VBoxGlobal::machineWindowIconNames(machine))
+        foreach (const QString &strIconName, gEDataManager->machineWindowIconNames(strMachineID))
             if (!strIconName.isEmpty())
                 icon.addFile(strIconName);
         if (!icon.isNull())
             m_pMachineWindowIcon = new QIcon(icon);
 
         /* Load user's machine-window name postfix: */
-        m_strMachineWindowNamePostfix = VBoxGlobal::machineWindowNamePostfix(machine);
+        m_strMachineWindowNamePostfix = gEDataManager->machineWindowNamePostfix(strMachineID);
 #endif /* !Q_WS_MAC */
 
-        /* Determine mouse-capture policy: */
-        m_mouseCapturePolicy = VBoxGlobal::mouseCapturePolicy(machine);
-
-        /* Determine Guru Meditation handler type: */
-        m_guruMeditationHandlerType = VBoxGlobal::guruMeditationHandlerType(machine);
-
-        /* Determine HiDPI optimization type: */
-        m_hiDPIOptimizationType = VBoxGlobal::hiDPIOptimizationType(machine);
-
-        /* Determine whether hovered machine-window should be activated: */
-        m_fActivateHoveredMachineWindow = VBoxGlobal::activateHoveredMachineWindow(vbox);
-
         /* Is there should be First RUN Wizard? */
-        strSettings = machine.GetExtraData(GUI_FirstRun);
-        if (strSettings == "yes")
-            m_fIsFirstTimeStarted = true;
-
-        /* Ignore mediums mounted at runtime? */
-        strSettings = machine.GetExtraData(GUI_SaveMountedAtRuntime);
-        if (strSettings == "no")
-            m_fIsIgnoreRuntimeMediumsChanging = true;
+        m_fIsFirstTimeStarted = gEDataManager->machineFirstTimeStarted(strMachineID);
 
         /* Should guest autoresize? */
-        strSettings = machine.GetExtraData(GUI_AutoresizeGuest);
-        QAction *pGuestAutoresizeSwitch = gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize);
-        pGuestAutoresizeSwitch->setChecked(strSettings != "off");
+        QAction *pGuestAutoresizeSwitch = actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize);
+        pGuestAutoresizeSwitch->setChecked(gEDataManager->guestScreenAutoResizeEnabled(strMachineID));
+
+#ifndef Q_WS_MAC
+        /* Menu-bar options: */
+        {
+            const bool fEnabledGlobally = !vboxGlobal().settings().isFeatureActive("noMenuBar");
+            const bool fEnabledForMachine = gEDataManager->menuBarEnabled(strMachineID);
+            const bool fEnabled = fEnabledGlobally && fEnabledForMachine;
+            QAction *pActionMenuBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings);
+            pActionMenuBarSettings->setEnabled(fEnabled);
+            QAction *pActionMenuBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility);
+            pActionMenuBarSwitch->blockSignals(true);
+            pActionMenuBarSwitch->setChecked(fEnabled);
+            pActionMenuBarSwitch->blockSignals(false);
+        }
+#endif /* !Q_WS_MAC */
 
-        /* Should we allow reconfiguration? */
-        m_fReconfigurable = VBoxGlobal::shouldWeAllowMachineReconfiguration(machine);
-        updateSessionSettings();
+        /* Status-bar options: */
+        {
+            const bool fEnabledGlobally = !vboxGlobal().settings().isFeatureActive("noStatusBar");
+            const bool fEnabledForMachine = gEDataManager->statusBarEnabled(strMachineID);
+            const bool fEnabled = fEnabledGlobally && fEnabledForMachine;
+            QAction *pActionStatusBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings);
+            pActionStatusBarSettings->setEnabled(fEnabled);
+            QAction *pActionStatusBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility);
+            pActionStatusBarSwitch->blockSignals(true);
+            pActionStatusBarSwitch->setChecked(fEnabled);
+            pActionStatusBarSwitch->blockSignals(false);
+        }
+
+        /* Input options: */
+        actionPool()->action(UIActionIndexRT_M_Input_M_Mouse_T_Integration)->setChecked(isMouseIntegrated());
 
         /* What is the default close action and the restricted are? */
-        m_defaultCloseAction = vboxGlobal().defaultMachineCloseAction(machine);
-        m_restrictedCloseActions = vboxGlobal().restrictedMachineCloseActions(machine);
-        m_fAllCloseActionsRestricted =  (m_restrictedCloseActions & MachineCloseAction_SaveState)
+        m_defaultCloseAction = gEDataManager->defaultMachineCloseAction(strMachineID);
+        m_restrictedCloseActions = gEDataManager->restrictedMachineCloseActions(strMachineID);
+        m_fAllCloseActionsRestricted =  (!vboxGlobal().isSeparateProcess() || (m_restrictedCloseActions & MachineCloseAction_Detach))
+                                     && (m_restrictedCloseActions & MachineCloseAction_SaveState)
                                      && (m_restrictedCloseActions & MachineCloseAction_Shutdown)
                                      && (m_restrictedCloseActions & MachineCloseAction_PowerOff);
                                      // Close VM Dialog hides PowerOff_RestoringSnapshot implicitly if PowerOff is hidden..
                                      // && (m_restrictedCloseActions & MachineCloseAction_PowerOff_RestoringSnapshot);
-
-        /* Should we allow snapshot operations? */
-        m_fSnapshotOperationsAllowed = vboxGlobal().shouldWeAllowSnapshotOperations(machine);
-
-#if 0 /* Disabled for now! */
-# ifdef Q_WS_WIN
-        /* Disable host screen-saver if requested: */
-        if (vboxGlobal().settings().hostScreenSaverDisabled())
-            SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, false, 0, 0);
-# endif /* Q_WS_WIN */
-#endif
     }
 }
 
 void UISession::saveSessionSettings()
 {
-    /* Get uisession machine: */
-    CMachine machine = session().GetConsole().GetMachine();
-
     /* Save extra-data settings: */
     {
-        /* Disable First RUN Wizard for the since now: */
-        machine.SetExtraData(GUI_FirstRun, QString());
+        /* Disable First RUN Wizard: */
+        gEDataManager->setMachineFirstTimeStarted(false, vboxGlobal().managedVMUuid());
 
         /* Remember if guest should autoresize: */
-        machine.SetExtraData(GUI_AutoresizeGuest,
-                             gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->isChecked() ?
-                             QString() : "off");
-
-#if 0 /* Disabled for now! */
-# ifdef Q_WS_WIN
-        /* Restore screen-saver activity to system default: */
-        SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, true, 0, 0);
-# endif /* Q_WS_WIN */
-#endif
+        if (actionPool())
+        {
+            const QAction *pGuestAutoresizeSwitch = actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize);
+            gEDataManager->setGuestScreenAutoResizeEnabled(pGuestAutoresizeSwitch->isChecked(), vboxGlobal().managedVMUuid());
+        }
 
 #ifndef Q_WS_MAC
         /* Cleanup user's machine-window icon: */
@@ -1230,27 +1402,20 @@ void UISession::saveSessionSettings()
     }
 }
 
-void UISession::cleanupMenuPool()
-{
-    delete m_pMenuPool;
-    m_pMenuPool = 0;
-}
-
 void UISession::cleanupFramebuffers()
 {
     /* Cleanup framebuffers finally: */
     for (int i = m_frameBufferVector.size() - 1; i >= 0; --i)
     {
-        UIFrameBuffer *pFb = m_frameBufferVector[i];
-        if (pFb)
+        UIFrameBuffer *pFrameBuffer = m_frameBufferVector[i];
+        if (pFrameBuffer)
         {
             /* Mark framebuffer as unused: */
-            pFb->setMarkAsUnused(true);
+            pFrameBuffer->setMarkAsUnused(true);
             /* Detach framebuffer from Display: */
-            CDisplay display = session().GetConsole().GetDisplay();
-            display.SetFramebuffer(i, CFramebuffer(NULL));
-            /* Release framebuffer reference: */
-            pFb->Release();
+            pFrameBuffer->detach();
+            /* Delete framebuffer reference: */
+            delete pFrameBuffer;
         }
     }
     m_frameBufferVector.clear();
@@ -1258,8 +1423,9 @@ void UISession::cleanupFramebuffers()
 
 void UISession::cleanupConsoleEventHandlers()
 {
-    /* Destroy console event-handler: */
-    UIConsoleEventHandler::destroy();
+    /* Destroy console event-handler if necessary: */
+    if (gConsoleEvents)
+        UIConsoleEventHandler::destroy();
 }
 
 void UISession::cleanupConnections()
@@ -1270,14 +1436,99 @@ void UISession::cleanupConnections()
 #endif /* Q_WS_MAC */
 }
 
-void UISession::updateSessionSettings()
+void UISession::cleanupActions()
+{
+#ifdef Q_WS_MAC
+    /* Destroy Mac OS X menu-bar: */
+    delete m_pMenuBar;
+    m_pMenuBar = 0;
+#endif /* Q_WS_MAC */
+
+    /* Destroy action-pool if necessary: */
+    if (actionPool())
+        UIActionPool::destroy(actionPool());
+}
+
+void UISession::cleanupSession()
+{
+    /* Detach debugger: */
+    if (!m_debugger.isNull())
+        m_debugger.detach();
+
+    /* Detach keyboard: */
+    if (!m_keyboard.isNull())
+        m_keyboard.detach();
+
+    /* Detach mouse: */
+    if (!m_mouse.isNull())
+        m_mouse.detach();
+
+    /* Detach guest: */
+    if (!m_guest.isNull())
+        m_guest.detach();
+
+    /* Detach display: */
+    if (!m_display.isNull())
+        m_display.detach();
+
+    /* Detach console: */
+    if (!m_console.isNull())
+        m_console.detach();
+
+    /* Detach machine: */
+    if (!m_machine.isNull())
+        m_machine.detach();
+
+    /* Close session: */
+    if (!m_session.isNull() && vboxGlobal().isVBoxSVCAvailable())
+    {
+        m_session.UnlockMachine();
+        m_session.detach();
+    }
+}
+
+void UISession::cleanup()
+{
+#ifdef Q_WS_WIN
+    /* Destroy alpha cursor: */
+    if (m_alphaCursor)
+        DestroyIcon(m_alphaCursor);
+#endif /* Q_WS_WIN */
+
+    /* Save settings: */
+    saveSessionSettings();
+
+    /* Cleanup framebuffers: */
+    cleanupFramebuffers();
+
+    /* Cleanup console event-handlers: */
+    cleanupConsoleEventHandlers();
+
+    /* Cleanup connections: */
+    cleanupConnections();
+
+    /* Cleanup actions: */
+    cleanupActions();
+
+    /* Cleanup session: */
+    cleanupSession();
+}
+
+#ifdef Q_WS_MAC
+void UISession::updateMenu()
 {
-    bool fAllowReconfiguration = m_machineState != KMachineState_Stuck && m_fReconfigurable;
-    gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog)->setEnabled(fAllowReconfiguration);
-    gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings)->setEnabled(fAllowReconfiguration);
-    gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureSettings)->setEnabled(fAllowReconfiguration);
-    gActionPool->action(UIActionIndexRuntime_Simple_NetworkSettings)->setEnabled(fAllowReconfiguration);
+    /* Rebuild Mac OS X menu-bar: */
+    m_pMenuBar->clear();
+    foreach (QMenu *pMenu, actionPool()->menus())
+    {
+        UIMenu *pMenuUI = qobject_cast<UIMenu*>(pMenu);
+        if (!pMenuUI->isConsumable() || !pMenuUI->isConsumed())
+            m_pMenuBar->addMenu(pMenuUI);
+        if (pMenuUI->isConsumable() && !pMenuUI->isConsumed())
+            pMenuUI->setConsumed(true);
+    }
 }
+#endif /* Q_WS_MAC */
 
 WId UISession::winId() const
 {
@@ -1519,103 +1770,9 @@ void UISession::setPointerShape(const uchar *pShapeData, bool fHasAlpha,
 #endif
 }
 
-void UISession::reinitMenuPool()
-{
-    /* Get host: */
-    const CHost &host = vboxGlobal().host();
-
-    /* Get uisession machine: */
-    const CMachine &machine = session().GetConsole().GetMachine();
-
-    /* Storage stuff: */
-    {
-        /* Initialize CD/FD menus: */
-        int iDevicesCountCD = 0;
-        int iDevicesCountFD = 0;
-        const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
-        for (int i = 0; i < attachments.size(); ++i)
-        {
-            const CMediumAttachment &attachment = attachments[i];
-            if (attachment.GetType() == KDeviceType_DVD)
-                ++iDevicesCountCD;
-            if (attachment.GetType() == KDeviceType_Floppy)
-                ++iDevicesCountFD;
-        }
-        QAction *pOpticalDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices);
-        QAction *pFloppyDevicesMenu = gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices);
-        pOpticalDevicesMenu->setData(iDevicesCountCD);
-        pOpticalDevicesMenu->setVisible(iDevicesCountCD);
-        pFloppyDevicesMenu->setData(iDevicesCountFD);
-        pFloppyDevicesMenu->setVisible(iDevicesCountFD);
-    }
-
-    /* Network stuff: */
-    {
-        bool fAtLeastOneAdapterActive = false;
-        ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
-        for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot)
-        {
-            const CNetworkAdapter &adapter = machine.GetNetworkAdapter(uSlot);
-            if (adapter.GetEnabled())
-            {
-                fAtLeastOneAdapterActive = true;
-                break;
-            }
-        }
-
-        /* Show/Hide Network sub-menu depending on overall adapters activity status: */
-        gActionPool->action(UIActionIndexRuntime_Menu_Network)->setVisible(fAtLeastOneAdapterActive);
-    }
-
-    /* USB stuff: */
-    {
-        /* Check whether there is at least one OHCI USB controllers with an available proxy. */
-        const CUSBDeviceFilters &filters = machine.GetUSBDeviceFilters();
-        ULONG cOhciCtls = machine.GetUSBControllerCountByType(KUSBControllerType_OHCI);
-        bool fUSBEnabled = !filters.isNull() && cOhciCtls && machine.GetUSBProxyAvailable();
-
-        /* Show/Hide USB menu depending on controller availability, activity and USB-proxy presence: */
-        gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->setVisible(fUSBEnabled);
-    }
-
-    /* WebCams stuff: */
-    {
-        /* Check whether there is an accessible video input devices pool: */
-        const CHostVideoInputDeviceVector &webcams = host.GetVideoInputDevices(); Q_UNUSED(webcams);
-        ULONG cOhciCtls = machine.GetUSBControllerCountByType(KUSBControllerType_OHCI);
-        bool fWebCamsEnabled = host.isOk() && cOhciCtls;
-
-        /* Show/Hide WebCams menu depending on ExtPack availability: */
-        gActionPool->action(UIActionIndexRuntime_Menu_WebCams)->setVisible(fWebCamsEnabled);
-    }
-}
-
-bool UISession::preparePowerUp()
+bool UISession::preprocessInitialization()
 {
-    /* Notify user about mouse&keyboard auto-capturing: */
-    if (vboxGlobal().settings().autoCapture())
-        popupCenter().remindAboutAutoCapture(machineLogic()->activeMachineWindow());
-
-    /* Shows First Run wizard if necessary: */
-    const CMachine &machine = session().GetMachine();
-    /* Check if we are in teleportation waiting mode.
-     * In that case no first run wizard is necessary. */
-    m_machineState = machine.GetState();
-    if (   isFirstTimeStarted()
-        && !((   m_machineState == KMachineState_PoweredOff
-              || m_machineState == KMachineState_Aborted
-              || m_machineState == KMachineState_Teleported)
-             && machine.GetTeleporterEnabled()))
-    {
-        UISafePointerWizard pWizard = new UIWizardFirstRun(mainMachineWindow(), session().GetMachine());
-        pWizard->prepare();
-        pWizard->exec();
-        if (pWizard)
-            delete pWizard;
-    }
-
 #ifdef VBOX_WITH_NETFLT
-
     /* Skip further checks if VM in saved state */
     if (isSaved())
         return true;
@@ -1636,10 +1793,10 @@ bool UISession::preparePowerUp()
         availableInterfaceNames << iface.GetShortName();
     }
 
-    ulong cCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(machine.GetChipsetType());
+    ulong cCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(machine().GetChipsetType());
     for (ulong uAdapterIndex = 0; uAdapterIndex < cCount; ++uAdapterIndex)
     {
-        CNetworkAdapter na = machine.GetNetworkAdapter(uAdapterIndex);
+        CNetworkAdapter na = machine().GetNetworkAdapter(uAdapterIndex);
 
         if (na.GetEnabled())
         {
@@ -1669,17 +1826,107 @@ bool UISession::preparePowerUp()
     /* Check if non-existent interfaces found */
     if (!failedInterfaceNames.isEmpty())
     {
-        if (msgCenter().UIMessageCenter::cannotStartWithoutNetworkIf(machine.GetName(), failedInterfaceNames.join(", ")))
-            machineLogic()->openNetworkAdaptersDialog();
+        if (msgCenter().cannotStartWithoutNetworkIf(machineName(), failedInterfaceNames.join(", ")))
+            machineLogic()->openNetworkSettingsDialog();
         else
+            return false;
+    }
+#endif /* VBOX_WITH_NETFLT */
+
+    /* True by default: */
+    return true;
+}
+
+bool UISession::mountAdHocImage(KDeviceType enmDeviceType, UIMediumType enmMediumType, const QString &strImage)
+{
+    /* The 'none' image name means ejecting what ever is in the drive,
+     * so leave the image variables null. */
+    CVirtualBox vbox = vboxGlobal().virtualBox();
+    UIMedium uiImage;
+    if (strImage != "none")
+    {
+        /* Open the image: */
+        CVirtualBox vbox = vboxGlobal().virtualBox();
+        CMedium vboxImage = vbox.OpenMedium(strImage, enmDeviceType, KAccessMode_ReadWrite, false /* fForceNewUuid */);
+        if (!vbox.isOk() || vboxImage.isNull())
         {
-            closeRuntimeUI();
+            msgCenter().cannotOpenMedium(vbox, enmMediumType, strImage);
             return false;
         }
+
+        /* Work the cache and use the cached image if possible: */
+        uiImage = vboxGlobal().medium(vboxImage.GetId());
+        if (uiImage.isNull())
+        {
+            uiImage = UIMedium(vboxImage, enmMediumType, KMediumState_Created);
+            vboxGlobal().createMedium(uiImage);
+        }
     }
+    if (vbox.isOk())
+    {
+        /* Find suitable storage controller: */
+        foreach (const CStorageController &controller, machine().GetStorageControllers())
+        {
+            foreach (const CMediumAttachment &attachment, machine().GetMediumAttachmentsOfController(controller.GetName()))
+            {
+                if (attachment.GetType() == enmDeviceType)
+                {
+                    /* Mount the image: */
+                    machine().MountMedium(controller.GetName(), attachment.GetPort(), attachment.GetDevice(), uiImage.medium(), true /* force */);
+                    if (machine().isOk())
+                        return true;
+                    msgCenter().cannotRemountMedium(machine(), uiImage, !uiImage.isNull() /* mount */, false /* retry */);
+                    return false;
+                }
+            }
+        }
+        msgCenter().cannotRemountMedium(machine(), uiImage, !uiImage.isNull() /* mount */, false /* retry */);
+    }
+    else
+        msgCenter().cannotOpenMedium(vbox, enmMediumType, strImage);
+    return false;
+}
 
-#endif
+bool UISession::postprocessInitialization()
+{
+    /* Check if the required virtualization features are active. We get this info only when the session is active. */
+    const bool fIs64BitsGuest = vboxGlobal().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetIs64Bit();
+    const bool fRecommendVirtEx = vboxGlobal().virtualBox().GetGuestOSType(guest().GetOSTypeId()).GetRecommendedVirtEx();
+    AssertMsg(!fIs64BitsGuest || fRecommendVirtEx, ("Virtualization support missed for 64bit guest!\n"));
+    const bool fIsVirtActive = debugger().GetHWVirtExEnabled();
+    if (fRecommendVirtEx && !fIsVirtActive)
+    {
+        /* Check whether vt-x / amd-v supported: */
+        bool fVTxAMDVSupported = vboxGlobal().host().GetProcessorFeature(KProcessorFeature_HWVirtEx);
+
+        /* Pause VM: */
+        setPause(true);
+
+        /* Ask the user about further actions: */
+        bool fShouldWeClose;
+        if (fIs64BitsGuest)
+            fShouldWeClose = msgCenter().warnAboutVirtExInactiveFor64BitsGuest(fVTxAMDVSupported);
+        else
+            fShouldWeClose = msgCenter().warnAboutVirtExInactiveForRecommendedGuest(fVTxAMDVSupported);
+
+        /* If user asked to close VM: */
+        if (fShouldWeClose)
+        {
+            /* Enable 'manual-override',
+             * preventing automatic Runtime UI closing: */
+            if (machineLogic())
+                machineLogic()->setManualOverrideMode(true);
+            /* Power off VM: */
+            bool fServerCrashed = false;
+            powerOff(false, fServerCrashed);
+            return false;
+        }
+
+        /* Resume VM: */
+        setPause(false);
+    }
 
+    /* True by default: */
     return true;
 }
 
@@ -1718,17 +1965,13 @@ void UISession::setFrameBuffer(ulong uScreenId, UIFrameBuffer* pFrameBuffer)
         m_frameBufferVector[(int)uScreenId] = pFrameBuffer;
 }
 
-#ifdef Q_WS_MAC
-/** MacOS X: Recaches display-configuration data. */
-void UISession::recacheDisplayData()
+void UISession::updateHostScreenData()
 {
-    /* Recache display data: */
-    m_screens.clear();
+    m_hostScreens.clear();
     QDesktopWidget *pDesktop = QApplication::desktop();
     for (int iScreenIndex = 0; iScreenIndex < pDesktop->screenCount(); ++iScreenIndex)
-        m_screens << pDesktop->screenGeometry(iScreenIndex);
+        m_hostScreens << pDesktop->screenGeometry(iScreenIndex);
 }
-#endif /* Q_WS_MAC */
 
 #ifdef VBOX_GUI_WITH_KEYS_RESET_HANDLER
 /**
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
index 496f9b8..da03715 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
@@ -1,3 +1,4 @@
+/* $Id: UISession.h $ */
 /** @file
  * VBox Qt GUI - UISession class declaration.
  */
@@ -24,23 +25,32 @@
 #include <QMap>
 
 /* GUI includes: */
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
+#include "UIMediumDefs.h"
 
 /* COM includes: */
 #include "COMEnums.h"
+#include "CSession.h"
+#include "CMachine.h"
+#include "CConsole.h"
+#include "CDisplay.h"
+#include "CGuest.h"
+#include "CMouse.h"
+#include "CKeyboard.h"
+#include "CMachineDebugger.h"
 
 /* Forward declarations: */
 class QMenu;
-class QMenuBar;
 class UIFrameBuffer;
 class UIMachine;
 class UIMachineLogic;
-class UIMachineMenuBar;
-class CSession;
+class UIActionPool;
 class CUSBDevice;
 class CNetworkAdapter;
 class CMediumAttachment;
-#ifndef Q_WS_MAC
+#ifdef Q_WS_MAC
+class QMenuBar;
+#else /* !Q_WS_MAC */
 class QIcon;
 #endif /* !Q_WS_MAC */
 
@@ -75,25 +85,45 @@ class UISession : public QObject
 
 public:
 
-    /* Machine uisession constructor/destructor: */
-    UISession(UIMachine *pMachine, CSession &session);
-    virtual ~UISession();
+    /** Factory constructor. */
+    static bool create(UISession *&pSession, UIMachine *pMachine);
+    /** Factory destructor. */
+    static void destroy(UISession *&pSession);
 
     /* API: Runtime UI stuff: */
-    void powerUp();
+    bool initialize();
+    bool powerUp();
     bool saveState();
     bool shutdown();
     bool powerOff(bool fIncludingDiscard, bool &fServerCrashed);
+    bool restoreCurrentSnapshot();
     void closeRuntimeUI();
 
-    /* Common getters: */
+    /** Returns the session instance. */
     CSession& session() { return m_session; }
+    /** Returns the session's machine instance. */
+    CMachine& machine() { return m_machine; }
+    /** Returns the session's console instance. */
+    CConsole& console() { return m_console; }
+    /** Returns the console's display instance. */
+    CDisplay& display() { return m_display; }
+    /** Returns the console's guest instance. */
+    CGuest& guest() { return m_guest; }
+    /** Returns the console's mouse instance. */
+    CMouse& mouse() { return m_mouse; }
+    /** Returns the console's keyboard instance. */
+    CKeyboard& keyboard() { return m_keyboard; }
+    /** Returns the console's debugger instance. */
+    CMachineDebugger& debugger() { return m_debugger; }
+
+    /** Returns the machine name. */
+    const QString& machineName() const { return m_strMachineName; }
+
+    UIActionPool* actionPool() const { return m_pActionPool; }
     KMachineState machineStatePrevious() const { return m_machineStatePrevious; }
     KMachineState machineState() const { return m_machineState; }
     UIMachineLogic* machineLogic() const;
     QWidget* mainMachineWindow() const;
-    QMenu* newMenu(RuntimeMenuType fOptions = RuntimeMenuType_All);
-    QMenuBar* newMenuBar(RuntimeMenuType fOptions = RuntimeMenuType_All);
     QCursor cursor() const { return m_cursor; }
 
 #ifndef Q_WS_MAC
@@ -106,42 +136,10 @@ public:
     /** @} */
 #endif /* !Q_WS_MAC */
 
-    /** @name Runtime workflow stuff.
-     ** @{ */
-    /** Returns the mouse-capture policy. */
-    MouseCapturePolicy mouseCapturePolicy() const { return m_mouseCapturePolicy; }
-    /** Returns Guru Meditation handler type. */
-    GuruMeditationHandlerType guruMeditationHandlerType() const { return m_guruMeditationHandlerType; }
-    /** Returns HiDPI optimization type. */
-    HiDPIOptimizationType hiDPIOptimizationType() const { return m_hiDPIOptimizationType; }
-    /** Returns whether hovered machine-window should be activated. */
-    bool activateHoveredMachineWindow() const { return m_fActivateHoveredMachineWindow; }
-    /** @} */
-
-    /** @name Extension Pack stuff.
-     ** @{ */
-    /** Determines whether extension pack installed and usable. */
-    bool isExtensionPackUsable() const { return m_fIsExtensionPackUsable; }
-    /** @} */
-
-    /** @name Runtime menus configuration stuff.
+    /** @name Host-screen configuration variables.
      ** @{ */
-#ifdef Q_WS_MAC
-    /** Determines Application menu allowed actions. */
-    RuntimeMenuApplicationActionType allowedActionsMenuApplication() const { return m_allowedActionsMenuApplication; }
-#endif /* Q_WS_MAC */
-    /** Determines Machine menu allowed actions. */
-    RuntimeMenuMachineActionType allowedActionsMenuMachine() const { return m_allowedActionsMenuMachine; }
-    /** Determines View menu allowed actions. */
-    RuntimeMenuViewActionType allowedActionsMenuView() const { return m_allowedActionsMenuView; }
-    /** Determines Devices menu allowed actions. */
-    RuntimeMenuDevicesActionType allowedActionsMenuDevices() const { return m_allowedActionsMenuDevices; }
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    /** Determines Debugger menu allowed actions. */
-    RuntimeMenuDebuggerActionType allowedActionsMenuDebugger() const { return m_allowedActionsMenuDebugger; }
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-    /** Determines Help menu allowed actions. */
-    RuntimeMenuHelpActionType allowedActionsMenuHelp() const { return m_allowedActionsMenuHelp; }
+    /** Returns the list of host-screen geometries we currently have. */
+    QList<QRect> hostScreens() const { return m_hostScreens; }
     /** @} */
 
     /** @name Application Close configuration stuff.
@@ -154,16 +152,8 @@ public:
     bool isAllCloseActionsRestricted() const { return m_fAllCloseActionsRestricted; }
     /** @} */
 
-    /** @name Snapshot Operations configuration stuff.
-     * @{ */
-    /** Returns whether we should allow snapshot operations. */
-    bool isSnapshotOperationsAllowed() const { return m_fSnapshotOperationsAllowed; }
-    /** @} */
-
-    /* API: Visual-state stuff: */
-    bool isVisualStateAllowedFullscreen() const;
-    bool isVisualStateAllowedSeamless() const;
-    bool isVisualStateAllowedScale() const;
+    /** Returns whether visual @a state is allowed. */
+    bool isVisualStateAllowed(UIVisualStateType state) const;
     /** Requests visual-state change. */
     void changeVisualState(UIVisualStateType visualStateType);
     /** Requests visual-state to be entered when possible. */
@@ -184,20 +174,21 @@ public:
     bool isStuck() const { return machineState() == KMachineState_Stuck; }
     bool wasPaused() const { return machineStatePrevious() == KMachineState_Paused ||
                                     machineStatePrevious() == KMachineState_TeleportingPausedVM; }
-    bool isStarted() const { return m_fIsStarted; }
+    bool isInitialized() const { return m_fInitialized; }
     bool isFirstTimeStarted() const { return m_fIsFirstTimeStarted; }
-    bool isIgnoreRuntimeMediumsChanging() const { return m_fIsIgnoreRuntimeMediumsChanging; }
     bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; }
     bool isAutoCaptureDisabled() const { return m_fIsAutoCaptureDisabled; }
 
     /* Guest additions state getters: */
-    bool isGuestAdditionsActive() const { return (m_ulGuestAdditionsRunLevel > AdditionsRunLevelType_None); }
+    bool isGuestAdditionsActive() const { return (m_ulGuestAdditionsRunLevel > KAdditionsRunLevelType_None); }
     bool isGuestSupportsGraphics() const { return m_fIsGuestSupportsGraphics; }
     /* The double check below is correct, even though it is an implementation
      * detail of the Additions which the GUI should not ideally have to know. */
     bool isGuestSupportsSeamless() const { return isGuestSupportsGraphics() && m_fIsGuestSupportsSeamless; }
 
     /* Keyboard getters: */
+    /** Returns keyboard-state. */
+    int keyboardState() const { return m_iKeyboardState; }
     bool isNumLock() const { return m_fNumLock; }
     bool isCapsLock() const { return m_fCapsLock; }
     bool isScrollLock() const { return m_fScrollLock; }
@@ -205,6 +196,8 @@ public:
     uint capsLockAdaptionCnt() const { return m_uCapsLockAdaptionCnt; }
 
     /* Mouse getters: */
+    /** Returns mouse-state. */
+    int mouseState() const { return m_iMouseState; }
     bool isMouseSupportsAbsolute() const { return m_fIsMouseSupportsAbsolute; }
     bool isMouseSupportsRelative() const { return m_fIsMouseSupportsRelative; }
     bool isMouseSupportsMultiTouch() const { return m_fIsMouseSupportsMultiTouch; }
@@ -240,9 +233,12 @@ public:
     /* Sets framebuffer for the given screen-number;
      * Ignores (asserts) if screen-number attribute is out of bounds: */
     void setFrameBuffer(ulong uScreenId, UIFrameBuffer* pFrameBuffer);
+    /** Returns existing frame-buffer vector. */
+    const QVector<UIFrameBuffer*>& frameBuffers() const { return m_frameBufferVector; }
 
-    /* Temporary API: */
+    /** Updates VRDE Server action state. */
     void updateStatusVRDE() { sltVRDEChange(); }
+    /** Updates Video Capture action state. */
     void updateStatusVideoCapture() { sltVideoCaptureChange(); }
 
 signals:
@@ -250,7 +246,14 @@ signals:
     /* Notifier: Close Runtime UI stuff: */
     void sigCloseRuntimeUI();
 
+    /** Notifies about frame-buffer resize. */
+    void sigFrameBufferResize();
+
     /* Console callback signals: */
+    /** Notifies listeners about keyboard state-change. */
+    void sigKeyboardStateChange(int iState);
+    /** Notifies listeners about mouse state-change. */
+    void sigMouseStateChange(int iState);
     void sigMousePointerShapeChange();
     void sigMouseCapabilityChange();
     void sigKeyboardLedsChange();
@@ -279,20 +282,31 @@ signals:
     void sigHostScreenAvailableAreaChange();
 
     /* Session signals: */
-    void sigStarted();
+    void sigInitialized();
 
 public slots:
 
     void sltInstallGuestAdditionsFrom(const QString &strSource);
 
+    /** Defines @a iKeyboardState. */
+    void setKeyboardState(int iKeyboardState) { m_iKeyboardState = iKeyboardState; emit sigKeyboardStateChange(m_iKeyboardState); }
+
+    /** Defines @a iMouseState. */
+    void setMouseState(int iMouseState) { m_iMouseState = iMouseState; emit sigMouseStateChange(m_iMouseState); }
+
 private slots:
 
     /** Marks machine started. */
-    void sltMarkStarted() { m_fIsStarted = true; }
+    void sltMarkInitialized() { m_fInitialized = true; }
 
     /* Handler: Close Runtime UI stuff: */
     void sltCloseRuntimeUI();
 
+#ifdef RT_OS_DARWIN
+    /** Mac OS X: Handles menu-bar configuration-change. */
+    void sltHandleMenuBarConfigurationChange(const QString &strMachineID);
+#endif /* RT_OS_DARWIN */
+
     /* Console events slots */
     void sltMousePointerShapeChange(bool fVisible, bool fAlpha, QPoint hotCorner, QSize size, QVector<uint8_t> shape);
     void sltMouseCapabilityChange(bool fSupportsAbsolute, bool fSupportsRelative, bool fSupportsMultiTouch, bool fNeedsHostCursor);
@@ -318,45 +332,80 @@ private slots:
 
 private:
 
+    /** Constructor. */
+    UISession(UIMachine *pMachine);
+    /** Destructor. */
+    ~UISession();
+
     /* Private getters: */
     UIMachine* uimachine() const { return m_pMachine; }
 
     /* Prepare helpers: */
+    bool prepare();
+    bool prepareSession();
+    void prepareActions();
     void prepareConnections();
     void prepareConsoleEventHandlers();
     void prepareScreens();
     void prepareFramebuffers();
-    void prepareMenuPool();
     void loadSessionSettings();
 
     /* Cleanup helpers: */
     void saveSessionSettings();
-    void cleanupMenuPool();
     void cleanupFramebuffers();
     //void cleanupScreens() {}
     void cleanupConsoleEventHandlers();
     void cleanupConnections();
+    void cleanupActions();
+    void cleanupSession();
+    void cleanup();
 
-    /* Update helpers: */
-    void updateSessionSettings();
+#ifdef Q_WS_MAC
+    /** Mac OS X: Updates menu-bar content. */
+    void updateMenu();
+#endif /* Q_WS_MAC */
 
     /* Common helpers: */
     WId winId() const;
     void setPointerShape(const uchar *pShapeData, bool fHasAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight);
-    void reinitMenuPool();
-    bool preparePowerUp();
+    bool preprocessInitialization();
+    bool mountAdHocImage(KDeviceType enmDeviceType, UIMediumType enmMediumType, const QString &strImage);
+    bool postprocessInitialization();
     int countOfVisibleWindows();
 
-#ifdef Q_WS_MAC
-    /* Helper: Display reconfiguration stuff: */
-    void recacheDisplayData();
-#endif /* Q_WS_MAC */
+    /** Update host-screen data. */
+    void updateHostScreenData();
 
     /* Private variables: */
     UIMachine *m_pMachine;
-    CSession &m_session;
 
-    UIMachineMenuBar *m_pMenuPool;
+    /** Holds the session instance. */
+    CSession m_session;
+    /** Holds the session's machine instance. */
+    CMachine m_machine;
+    /** Holds the session's console instance. */
+    CConsole m_console;
+    /** Holds the console's display instance. */
+    CDisplay m_display;
+    /** Holds the console's guest instance. */
+    CGuest m_guest;
+    /** Holds the console's mouse instance. */
+    CMouse m_mouse;
+    /** Holds the console's keyboard instance. */
+    CKeyboard m_keyboard;
+    /** Holds the console's debugger instance. */
+    CMachineDebugger m_debugger;
+
+    /** Holds the machine name. */
+    QString m_strMachineName;
+
+    /** Holds the action-pool instance. */
+    UIActionPool *m_pActionPool;
+
+#ifdef Q_WS_MAC
+    /** Holds the menu-bar instance. */
+    QMenuBar *m_pMenuBar;
+#endif /* Q_WS_MAC */
 
     /* Screen visibility vector: */
     QVector<bool> m_monitorVisibilityVector;
@@ -379,44 +428,6 @@ private:
     /** @} */
 #endif /* !Q_WS_MAC */
 
-    /** @name Runtime workflow variables.
-     ** @{ */
-    /** Holds the mouse-capture policy. */
-    MouseCapturePolicy m_mouseCapturePolicy;
-    /** Holds Guru Meditation handler type. */
-    GuruMeditationHandlerType m_guruMeditationHandlerType;
-    /** Holds HiDPI optimization type. */
-    HiDPIOptimizationType m_hiDPIOptimizationType;
-    /** Holds whether hovered machine-window should be activated. */
-    bool m_fActivateHoveredMachineWindow;
-    /** @} */
-
-    /** @name Extension Pack variables.
-     ** @{ */
-    /** Determines whether extension pack installed and usable. */
-    bool m_fIsExtensionPackUsable;
-    /** @} */
-
-    /** @name Runtime menus configuration variables.
-     ** @{ */
-#ifdef Q_WS_MAC
-    /** Determines Application menu allowed actions. */
-    RuntimeMenuApplicationActionType m_allowedActionsMenuApplication;
-#endif /* Q_WS_MAC */
-    /** Determines Machine menu allowed actions. */
-    RuntimeMenuMachineActionType m_allowedActionsMenuMachine;
-    /** Determines View menu allowed actions. */
-    RuntimeMenuViewActionType m_allowedActionsMenuView;
-    /** Determines Devices menu allowed actions. */
-    RuntimeMenuDevicesActionType m_allowedActionsMenuDevices;
-#ifdef VBOX_WITH_DEBUGGER_GUI
-    /** Determines Debugger menu allowed actions. */
-    RuntimeMenuDebuggerActionType m_allowedActionsMenuDebugger;
-#endif /* VBOX_WITH_DEBUGGER_GUI */
-    /** Determines Help menu allowed actions. */
-    RuntimeMenuHelpActionType m_allowedActionsMenuHelp;
-    /** @} */
-
     /** @name Visual-state configuration variables.
      ** @{ */
     /** Determines which visual-state should be entered when possible. */
@@ -427,15 +438,15 @@ private:
     HCURSOR m_alphaCursor;
 #endif
 
-#ifdef Q_WS_MAC
-    /** @name MacOS X: Display reconfiguration variables.
+    /** @name Host-screen configuration variables.
      * @{ */
-    /** MacOS X: Watchdog timer looking for display reconfiguration. */
+    /** Holds the list of host-screen geometries we currently have. */
+    QList<QRect> m_hostScreens;
+#ifdef Q_WS_MAC
+    /** Mac OS X: Watchdog timer looking for display reconfiguration. */
     QTimer *m_pWatchdogDisplayChange;
-    /** MacOS X: A list of display geometries we currently have. */
-    QList<QRect> m_screens;
-    /** @} */
 #endif /* Q_WS_MAC */
+    /** @} */
 
     /** @name Application Close configuration variables.
      * @{ */
@@ -447,19 +458,11 @@ private:
     bool m_fAllCloseActionsRestricted;
     /** @} */
 
-    /** @name Snapshot Operations configuration variables.
-     * @{ */
-    /** Determines whether we should allow snapshot operations. */
-    bool m_fSnapshotOperationsAllowed;
-    /** @} */
-
     /* Common flags: */
-    bool m_fIsStarted : 1;
+    bool m_fInitialized : 1;
     bool m_fIsFirstTimeStarted : 1;
-    bool m_fIsIgnoreRuntimeMediumsChanging : 1;
     bool m_fIsGuestResizeIgnored : 1;
     bool m_fIsAutoCaptureDisabled : 1;
-    bool m_fReconfigurable : 1;
 
     /* Guest additions flags: */
     ULONG m_ulGuestAdditionsRunLevel;
@@ -467,6 +470,8 @@ private:
     bool  m_fIsGuestSupportsSeamless : 1;
 
     /* Keyboard flags: */
+    /** Holds the keyboard-state. */
+    int m_iKeyboardState;
     bool m_fNumLock : 1;
     bool m_fCapsLock : 1;
     bool m_fScrollLock : 1;
@@ -474,6 +479,8 @@ private:
     uint m_uCapsLockAdaptionCnt;
 
     /* Mouse flags: */
+    /** Holds the mouse-state. */
+    int m_iMouseState;
     bool m_fIsMouseSupportsAbsolute : 1;
     bool m_fIsMouseSupportsRelative : 1;
     bool m_fIsMouseSupportsMultiTouch: 1;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.cpp
new file mode 100644
index 0000000..9bf630e
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.cpp
@@ -0,0 +1,321 @@
+/* $Id: UISlidingToolBar.cpp $ */
+/** @file
+ * VBox Qt GUI - UISlidingToolBar class implementation.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QMdiSubWindow>
+# include <QHBoxLayout>
+# include <QMdiArea>
+# ifdef Q_WS_X11
+#  include <QX11Info>
+# endif /* Q_WS_X11 */
+
+/* GUI includes: */
+# include "UISlidingToolBar.h"
+# include "UIAnimationFramework.h"
+# include "UIMachineWindow.h"
+# ifdef Q_WS_MAC
+#  include "VBoxUtils-darwin.h"
+# endif /* Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+UISlidingToolBar::UISlidingToolBar(QWidget *pParentWidget, QWidget *pIndentWidget, QWidget *pChildWidget, Position position)
+    : QWidget(pParentWidget, Qt::Tool | Qt::FramelessWindowHint)
+    , m_position(position)
+    , m_parentRect(pParentWidget ? pParentWidget->geometry() : QRect())
+    , m_indentRect(pIndentWidget ? pIndentWidget->geometry() : QRect())
+    , m_pAnimation(0)
+    , m_fExpanded(false)
+    , m_pMainLayout(0)
+    , m_pMdiArea(0)
+    , m_pWidget(pChildWidget)
+    , m_pEmbeddedWidget(0)
+{
+    /* Prepare: */
+    prepare();
+}
+
+void UISlidingToolBar::sltParentGeometryChanged(const QRect &parentRect)
+{
+    /* Update rectangle: */
+    m_parentRect = parentRect;
+    /* Adjust geometry: */
+    adjustGeometry();
+    /* Update animation: */
+    updateAnimation();
+}
+
+void UISlidingToolBar::prepare()
+{
+    /* Do not count that window as important for application,
+     * it will NOT be taken into account when other top-level windows will be closed: */
+    setAttribute(Qt::WA_QuitOnClose, false);
+    /* Delete window when closed: */
+    setAttribute(Qt::WA_DeleteOnClose);
+
+#if   defined(Q_WS_MAC) || defined(Q_WS_WIN)
+    /* Make sure we have no background
+     * until the first one paint-event: */
+    setAttribute(Qt::WA_NoSystemBackground);
+    /* Use Qt API to enable translucency: */
+    setAttribute(Qt::WA_TranslucentBackground);
+#elif defined(Q_WS_X11)
+    if (QX11Info::isCompositingManagerRunning())
+    {
+        /* Use Qt API to enable translucency: */
+        setAttribute(Qt::WA_TranslucentBackground);
+    }
+#endif /* Q_WS_X11 */
+
+    /* Prepare contents: */
+    prepareContents();
+    /* Prepare geometry: */
+    prepareGeometry();
+    /* Prepare animation: */
+    prepareAnimation();
+}
+
+void UISlidingToolBar::prepareContents()
+{
+    /* Create main-layout: */
+    m_pMainLayout = new QHBoxLayout(this);
+    AssertPtrReturnVoid(m_pMainLayout);
+    {
+        /* Configure main-layout: */
+        m_pMainLayout->setContentsMargins(0, 0, 0, 0);
+        m_pMainLayout->setSpacing(0);
+        /* Create mdi-area: */
+        m_pMdiArea = new QMdiArea;
+        AssertPtrReturnVoid(m_pMdiArea);
+        {
+            /* Configure mdi-area: */
+            m_pMdiArea->setAcceptDrops(true);
+            m_pMdiArea->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
+            QPalette pal1 = m_pMdiArea->palette();
+            pal1.setColor(QPalette::Window, QColor(Qt::transparent));
+            m_pMdiArea->setPalette(pal1);
+            m_pMdiArea->setBackground(QColor(Qt::transparent));
+            /* Make sure valid child-widget passed: */
+            AssertPtrReturnVoid(m_pWidget);
+            {
+                /* Configure child-widget: */
+                QPalette pal2 = m_pWidget->palette();
+                pal2.setColor(QPalette::Window, palette().color(QPalette::Window));
+                m_pWidget->setPalette(pal2);
+                connect(m_pWidget, SIGNAL(sigCancelClicked()), this, SLOT(close()));
+                /* Add child-widget into mdi-area: */
+                m_pEmbeddedWidget = m_pMdiArea->addSubWindow(m_pWidget, Qt::Window | Qt::FramelessWindowHint);
+                AssertPtrReturnVoid(m_pEmbeddedWidget);
+            }
+            /* Add mdi-area into main-layout: */
+            m_pMainLayout->addWidget(m_pMdiArea);
+        }
+    }
+}
+
+void UISlidingToolBar::prepareGeometry()
+{
+    /* Prepare geometry based on parent and mdi-sub-window size-hints,
+     * But move mdi-sub-window to initial position: */
+    const QSize sh = m_pEmbeddedWidget->sizeHint();
+    switch (m_position)
+    {
+        case Position_Top:
+        {
+            setGeometry(m_parentRect.x(), m_parentRect.y()                         + m_indentRect.height(),
+                        qMax(m_parentRect.width(), sh.width()), sh.height());
+            m_pEmbeddedWidget->setGeometry(0, -sh.height(), qMax(width(), sh.width()), sh.height());
+            break;
+        }
+        case Position_Bottom:
+        {
+            setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(),
+                        qMax(m_parentRect.width(), sh.width()), sh.height());
+            m_pEmbeddedWidget->setGeometry(0,  sh.height(), qMax(width(), sh.width()), sh.height());
+            break;
+        }
+    }
+
+#ifdef Q_WS_X11
+    if (!QX11Info::isCompositingManagerRunning())
+    {
+        /* Use Xshape otherwise: */
+        setMask(m_pEmbeddedWidget->geometry());
+    }
+#endif /* Q_WS_X11 */
+
+#ifdef Q_WS_WIN
+    /* Raise tool-window for proper z-order. */
+    raise();
+#endif /* Q_WS_WIN */
+
+    /* Activate window after it was shown: */
+    connect(this, SIGNAL(sigShown()), this,
+            SLOT(sltActivateWindow()), Qt::QueuedConnection);
+    /* Update window geometry after parent geometry changed: */
+    connect(parent(), SIGNAL(sigGeometryChange(const QRect&)),
+            this, SLOT(sltParentGeometryChanged(const QRect&)));
+}
+
+void UISlidingToolBar::prepareAnimation()
+{
+    /* Prepare mdi-sub-window geometry animation itself: */
+    connect(this, SIGNAL(sigShown()), this, SIGNAL(sigExpand()), Qt::QueuedConnection);
+    m_pAnimation = UIAnimation::installPropertyAnimation(this,
+                                                         "widgetGeometry",
+                                                         "startWidgetGeometry", "finalWidgetGeometry",
+                                                         SIGNAL(sigExpand()), SIGNAL(sigCollapse()));
+    connect(m_pAnimation, SIGNAL(sigStateEnteredStart()), this, SLOT(sltMarkAsCollapsed()));
+    connect(m_pAnimation, SIGNAL(sigStateEnteredFinal()), this, SLOT(sltMarkAsExpanded()));
+    /* Update geometry animation: */
+    updateAnimation();
+}
+
+void UISlidingToolBar::adjustGeometry()
+{
+    /* Adjust geometry based on parent and mdi-sub-window size-hints: */
+    const QSize sh = m_pEmbeddedWidget->sizeHint();
+    switch (m_position)
+    {
+        case Position_Top:
+        {
+            setGeometry(m_parentRect.x(), m_parentRect.y()                         + m_indentRect.height(),
+                        qMax(m_parentRect.width(), sh.width()), sh.height());
+            break;
+        }
+        case Position_Bottom:
+        {
+            setGeometry(m_parentRect.x(), m_parentRect.y() + m_parentRect.height() - m_indentRect.height() - sh.height(),
+                        qMax(m_parentRect.width(), sh.width()), sh.height());
+            break;
+        }
+    }
+    /* And move mdi-sub-window to corresponding position: */
+    m_pEmbeddedWidget->setGeometry(0, 0, qMax(width(), sh.width()), sh.height());
+
+#ifdef Q_WS_X11
+    if (!QX11Info::isCompositingManagerRunning())
+    {
+        /* Use Xshape otherwise: */
+        setMask(m_pEmbeddedWidget->geometry());
+    }
+#endif /* Q_WS_X11 */
+
+#ifdef Q_WS_WIN
+    /* Raise tool-window for proper z-order. */
+    raise();
+#endif /* Q_WS_WIN */
+}
+
+void UISlidingToolBar::updateAnimation()
+{
+    /* Skip if no animation created: */
+    if (!m_pAnimation)
+        return;
+
+    /* Recalculate mdi-sub-window geometry animation boundaries based on size-hint: */
+    const QSize sh = m_pEmbeddedWidget->sizeHint();
+    switch (m_position)
+    {
+        case Position_Top:    m_startWidgetGeometry = QRect(0, -sh.height(), qMax(width(), sh.width()), sh.height()); break;
+        case Position_Bottom: m_startWidgetGeometry = QRect(0,  sh.height(), qMax(width(), sh.width()), sh.height()); break;
+    }
+    m_finalWidgetGeometry = QRect(0, 0, qMax(width(), sh.width()), sh.height());
+    m_pAnimation->update();
+}
+
+void UISlidingToolBar::showEvent(QShowEvent*)
+{
+    /* If window isn't expanded: */
+    if (!m_fExpanded)
+    {
+        /* Start expand animation: */
+        emit sigShown();
+    }
+}
+
+void UISlidingToolBar::closeEvent(QCloseEvent *pEvent)
+{
+    /* If window isn't expanded: */
+    if (!m_fExpanded)
+    {
+        /* Ignore close-event: */
+        pEvent->ignore();
+        return;
+    }
+
+    /* If animation state is Final: */
+    const QString strAnimationState = property("AnimationState").toString();
+    bool fAnimationComplete = strAnimationState == "Final";
+    if (fAnimationComplete)
+    {
+        /* Ignore close-event: */
+        pEvent->ignore();
+        /* And start collapse animation: */
+        emit sigCollapse();
+    }
+}
+
+#ifdef Q_WS_MAC
+bool UISlidingToolBar::event(QEvent *pEvent)
+{
+    /* Depending on event-type: */
+    switch (pEvent->type())
+    {
+        case QEvent::Resize:
+        case QEvent::WindowActivate:
+        {
+            /* By some strange reason
+             * cocoa resets NSWindow::setHasShadow option
+             * for frameless windows on every window resize/activation.
+             * So we have to make sure window still has no shadows. */
+            darwinSetWindowHasShadow(this, false);
+            break;
+        }
+        default:
+            break;
+    }
+    /* Call to base-class: */
+    return QWidget::event(pEvent);
+}
+#endif /* Q_WS_MAC */
+
+void UISlidingToolBar::setWidgetGeometry(const QRect &rect)
+{
+    /* Apply mdi-sub-window geometry: */
+    m_pEmbeddedWidget->setGeometry(rect);
+
+#ifdef Q_WS_X11
+    if (!QX11Info::isCompositingManagerRunning())
+    {
+        /* Use Xshape otherwise: */
+        setMask(m_pEmbeddedWidget->geometry());
+    }
+#endif /* Q_WS_X11 */
+}
+
+QRect UISlidingToolBar::widgetGeometry() const
+{
+    /* Return mdi-sub-window geometry: */
+    return m_pEmbeddedWidget->geometry();
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.h b/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.h
new file mode 100644
index 0000000..9c6f186
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UISlidingToolBar.h
@@ -0,0 +1,145 @@
+/* $Id: UISlidingToolBar.h $ */
+/** @file
+ * VBox Qt GUI - UISlidingToolBar class declaration.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UISlidingToolBar_h___
+#define ___UISlidingToolBar_h___
+
+/* Qt includes: */
+#include <QWidget>
+
+/* Forward declarations: */
+class QMdiArea;
+class QMdiSubWindow;
+class QHBoxLayout;
+class UIAnimation;
+
+/** QWidget reimplementation
+  * providing GUI with slideable tool-bar. */
+class UISlidingToolBar : public QWidget
+{
+    Q_OBJECT;
+    Q_PROPERTY(QRect widgetGeometry READ widgetGeometry WRITE setWidgetGeometry);
+    Q_PROPERTY(QRect startWidgetGeometry READ startWidgetGeometry);
+    Q_PROPERTY(QRect finalWidgetGeometry READ finalWidgetGeometry);
+
+signals:
+
+    /** Notifies about window shown. */
+    void sigShown();
+    /** Commands window to expand. */
+    void sigExpand();
+    /** Commands window to collapse. */
+    void sigCollapse();
+
+public:
+
+    /** Possible positions. */
+    enum Position
+    {
+        Position_Top,
+        Position_Bottom
+    };
+
+    /** Constructor, passes @a pParentWidget to the QWidget constructor.
+      * @param pParentWidget is used to get parent-widget geoemtry,
+      * @param pIndentWidget is used to get indent-widget geometry,
+      * @param pChildWidget  brings child-widget to be injected into tool-bar. */
+    UISlidingToolBar(QWidget *pParentWidget, QWidget *pIndentWidget, QWidget *pChildWidget, Position position);
+
+private slots:
+
+    /** Performs window activation. */
+    void sltActivateWindow() { activateWindow(); }
+
+    /** Marks window as expanded. */
+    void sltMarkAsExpanded() { m_fExpanded = true; }
+    /** Marks window as collapsed. */
+    void sltMarkAsCollapsed() { close(); m_fExpanded = false; }
+
+    /** Handles parent geometry change. */
+    void sltParentGeometryChanged(const QRect &parentRect);
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+    /** Prepare contents routine. */
+    void prepareContents();
+    /** Prepare geometry routine. */
+    void prepareGeometry();
+    /** Prepare animation routine. */
+    void prepareAnimation();
+
+    /** Update geometry. */
+    void adjustGeometry();
+    /** Updates animation. */
+    void updateAnimation();
+
+    /** Show event handler. */
+    virtual void showEvent(QShowEvent *pEvent);
+    /** Close event handler. */
+    virtual void closeEvent(QCloseEvent *pEvent);
+#ifdef Q_WS_MAC
+    /** Common event handler. */
+    virtual bool event(QEvent *pEvent);
+#endif /* Q_WS_MAC */
+
+    /** Defines mdi-sub-window geometry. */
+    void setWidgetGeometry(const QRect &rect);
+    /** Returns mdi-sub-window geometry. */
+    QRect widgetGeometry() const;
+    /** Returns mdi-sub-window start-geometry. */
+    QRect startWidgetGeometry() const { return m_startWidgetGeometry; }
+    /** Returns mdi-sub-window final-geometry. */
+    QRect finalWidgetGeometry() const { return m_finalWidgetGeometry; }
+
+    /** @name Geometry
+      * @{ */
+        /** Holds the tool-bar position. */
+        const Position m_position;
+        /** Holds the cached parent-widget geometry. */
+        QRect m_parentRect;
+        /** Holds the cached indent-widget geometry. */
+        QRect m_indentRect;
+    /** @} */
+
+    /** @name Geometry: Animation
+      * @{ */
+        /** Holds the expand/collapse animation instance. */
+        UIAnimation *m_pAnimation;
+        /** Holds whether window is expanded. */
+        bool m_fExpanded;
+        /** Holds mdi-sub-window start-geometry. */
+        QRect m_startWidgetGeometry;
+        /** Holds mdi-sub-window final-geometry. */
+        QRect m_finalWidgetGeometry;
+    /** @} */
+
+    /** @name Contents
+      * @{ */
+        /** Holds the main-layout instance. */
+        QHBoxLayout *m_pMainLayout;
+        /** Holds the mdi-area instance. */
+        QMdiArea *m_pMdiArea;
+        /** Holds the child-widget reference. */
+        QWidget *m_pWidget;
+        /** Holds the child-widget wrapper instance. */
+        QMdiSubWindow *m_pEmbeddedWidget;
+    /** @} */
+};
+
+#endif /* !___UISlidingToolBar_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp
new file mode 100644
index 0000000..64e8548
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp
@@ -0,0 +1,720 @@
+/* $Id: UIStatusBarEditorWindow.cpp $ */
+/** @file
+ * VBox Qt GUI - UIStatusBarEditorWindow class implementation.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QStylePainter>
+# include <QStyleOption>
+# include <QHBoxLayout>
+# include <QPaintEvent>
+# include <QMouseEvent>
+# include <QStatusBar>
+# include <QCheckBox>
+# include <QPainter>
+# include <QPixmap>
+# include <QDrag>
+
+/* GUI includes: */
+# include "UIStatusBarEditorWindow.h"
+# include "UIExtraDataManager.h"
+# include "UIMachineWindow.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
+# include "QIToolButton.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+
+/** QWidget extension
+  * used as status-bar editor button. */
+class UIStatusBarEditorButton : public QIWithRetranslateUI<QWidget>
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies about click. */
+    void sigClick();
+
+    /** Notifies about drag-object destruction. */
+    void sigDragObjectDestroy();
+
+public:
+
+    /** Holds the mime-type for the D&D system. */
+    static const QString MimeType;
+
+    /** Constructor for the button of passed @a type. */
+    UIStatusBarEditorButton(IndicatorType type);
+
+    /** Returns button type. */
+    IndicatorType type() const { return m_type; }
+
+    /** Returns button size-hint. */
+    QSize sizeHint() const { return m_size; }
+
+    /** Defines whether button is @a fChecked. */
+    void setChecked(bool fChecked);
+
+private:
+
+    /** Retranslation routine. */
+    virtual void retranslateUi();
+
+    /** Paint-event handler. */
+    virtual void paintEvent(QPaintEvent *pEvent);
+
+    /** Mouse-press event handler. */
+    virtual void mousePressEvent(QMouseEvent *pEvent);
+    /** Mouse-release event handler. */
+    virtual void mouseReleaseEvent(QMouseEvent *pEvent);
+    /** Mouse-enter event handler. */
+    virtual void enterEvent(QEvent *pEvent);
+    /** Mouse-leave event handler. */
+    virtual void leaveEvent(QEvent *pEvent);
+    /** Mouse-move event handler. */
+    virtual void mouseMoveEvent(QMouseEvent *pEvent);
+
+    /** Holds the button type. */
+    IndicatorType m_type;
+    /** Holds the button size. */
+    QSize m_size;
+    /** Holds the button pixmap. */
+    QPixmap m_pixmap;
+    /** Holds the button pixmap size. */
+    QSize m_pixmapSize;
+    /** Holds whether button is checked. */
+    bool m_fChecked;
+    /** Holds whether button is hovered. */
+    bool m_fHovered;
+    /** Holds the last mouse-press position. */
+    QPoint m_mousePressPosition;
+};
+
+
+/* static */
+const QString UIStatusBarEditorButton::MimeType = QString("application/virtualbox;value=IndicatorType");
+
+UIStatusBarEditorButton::UIStatusBarEditorButton(IndicatorType type)
+    : m_type(type)
+    , m_fChecked(false)
+    , m_fHovered(false)
+{
+    /* Track mouse events: */
+    setMouseTracking(true);
+
+    /* Prepare icon for assigned type: */
+    const QIcon icon = gpConverter->toIcon(m_type);
+    m_pixmapSize = icon.availableSizes().first();
+    m_pixmap = icon.pixmap(m_pixmapSize);
+
+    /* Cache button size-hint: */
+    QStyleOptionButton option;
+    option.initFrom(this);
+    const QRect minRect = QApplication::style()->subElementRect(QStyle::SE_CheckBoxIndicator, &option);
+    m_size = m_pixmapSize.expandedTo(minRect.size());
+
+    /* Translate finally: */
+    retranslateUi();
+}
+
+void UIStatusBarEditorButton::setChecked(bool fChecked)
+{
+    /* Update 'checked' state: */
+    m_fChecked = fChecked;
+    /* Update: */
+    update();
+}
+
+void UIStatusBarEditorButton::retranslateUi()
+{
+    /* Translate tool-tip: */
+    setToolTip(tr("<nobr><b>Click</b> to toggle indicator presence.</nobr><br>"
+                  "<nobr><b>Drag&Drop</b> to change indicator position.</nobr>"));
+}
+
+void UIStatusBarEditorButton::paintEvent(QPaintEvent*)
+{
+    /* Create style-painter: */
+    QStylePainter painter(this);
+    /* Prepare option set for check-box: */
+    QStyleOptionButton option;
+    option.initFrom(this);
+    /* Use the size of 'this': */
+    option.rect = QRect(0, 0, width(), height());
+    /* But do not use hover bit of 'this' since
+     * we already have another hovered-state representation: */
+    if (option.state & QStyle::State_MouseOver)
+        option.state &= ~QStyle::State_MouseOver;
+    /* Remember checked-state: */
+    if (m_fChecked)
+        option.state |= QStyle::State_On;
+    /* Draw check-box for hovered-state: */
+    if (m_fHovered)
+        painter.drawControl(QStyle::CE_CheckBox, option);
+    /* Draw pixmap for unhovered-state: */
+    else
+    {
+        QRect pixmapRect = QRect(QPoint(0, 0), m_pixmapSize);
+        pixmapRect.moveCenter(option.rect.center());
+        painter.drawItemPixmap(pixmapRect, Qt::AlignCenter, m_pixmap);
+    }
+}
+
+void UIStatusBarEditorButton::mousePressEvent(QMouseEvent *pEvent)
+{
+    /* We are interested in left button only: */
+    if (pEvent->button() != Qt::LeftButton)
+        return;
+
+    /* Remember mouse-press position: */
+    m_mousePressPosition = pEvent->globalPos();
+}
+
+void UIStatusBarEditorButton::mouseReleaseEvent(QMouseEvent *pEvent)
+{
+    /* We are interested in left button only: */
+    if (pEvent->button() != Qt::LeftButton)
+        return;
+
+    /* Forget mouse-press position: */
+    m_mousePressPosition = QPoint();
+
+    /* Notify about click: */
+    emit sigClick();
+}
+
+void UIStatusBarEditorButton::enterEvent(QEvent*)
+{
+    /* Make sure button isn't hovered: */
+    if (m_fHovered)
+        return;
+
+    /* Invert hovered state: */
+    m_fHovered = true;
+    /* Update: */
+    update();
+}
+
+void UIStatusBarEditorButton::leaveEvent(QEvent*)
+{
+    /* Make sure button is hovered: */
+    if (!m_fHovered)
+        return;
+
+    /* Invert hovered state: */
+    m_fHovered = false;
+    /* Update: */
+    update();
+}
+
+void UIStatusBarEditorButton::mouseMoveEvent(QMouseEvent *pEvent)
+{
+    /* Make sure item isn't already dragged: */
+    if (m_mousePressPosition.isNull())
+        return QWidget::mouseMoveEvent(pEvent);
+
+    /* Make sure item is really dragged: */
+    if (QLineF(pEvent->globalPos(), m_mousePressPosition).length() <
+        QApplication::startDragDistance())
+        return QWidget::mouseMoveEvent(pEvent);
+
+    /* Revoke hovered state: */
+    m_fHovered = false;
+    /* Update: */
+    update();
+
+    /* Initialize dragging: */
+    m_mousePressPosition = QPoint();
+    QDrag *pDrag = new QDrag(this);
+    connect(pDrag, SIGNAL(destroyed(QObject*)), this, SIGNAL(sigDragObjectDestroy()));
+    QMimeData *pMimeData = new QMimeData;
+    pMimeData->setData(MimeType, gpConverter->toInternalString(m_type).toLatin1());
+    pDrag->setMimeData(pMimeData);
+    pDrag->setPixmap(m_pixmap);
+    pDrag->exec();
+}
+
+
+UIStatusBarEditorWidget::UIStatusBarEditorWidget(QWidget *pParent,
+                                                 bool fStartedFromVMSettings /* = true */,
+                                                 const QString &strMachineID /* = QString() */)
+    : QIWithRetranslateUI2<QWidget>(pParent)
+    , m_fPrepared(false)
+    , m_fStartedFromVMSettings(fStartedFromVMSettings)
+    , m_strMachineID(strMachineID)
+    , m_pMainLayout(0), m_pButtonLayout(0)
+    , m_pButtonClose(0)
+    , m_pCheckBoxEnable(0)
+    , m_pButtonDropToken(0)
+    , m_fDropAfterTokenButton(true)
+{
+    /* Prepare: */
+    prepare();
+}
+
+void UIStatusBarEditorWidget::setMachineID(const QString &strMachineID)
+{
+    /* Remember new machine ID: */
+    m_strMachineID = strMachineID;
+    /* Prepare: */
+    prepare();
+}
+
+void UIStatusBarEditorWidget::sltHandleConfigurationChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (machineID() != strMachineID)
+        return;
+
+    /* Update enable-checkbox: */
+    updateEnableCheckbox();
+
+    /* Update status buttons: */
+    updateStatusButtons();
+}
+
+void UIStatusBarEditorWidget::sltHandleStatusBarEnableToggle(bool fEnabled)
+{
+    /* Toggle enable-checkbox if necessary: */
+    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
+    {
+        /* Check whether this value is really changed: */
+        const bool fStatusBarEnabled = gEDataManager->statusBarEnabled(machineID());
+        if (fStatusBarEnabled != fEnabled)
+        {
+            /* Set new value: */
+            gEDataManager->setStatusBarEnabled(fEnabled, machineID());
+        }
+    }
+}
+
+void UIStatusBarEditorWidget::sltHandleButtonClick()
+{
+    /* Make sure sender is valid: */
+    UIStatusBarEditorButton *pButton = qobject_cast<UIStatusBarEditorButton*>(sender());
+    AssertPtrReturnVoid(pButton);
+
+    /* Get sender type: */
+    const IndicatorType type = pButton->type();
+
+    /* Load current status-bar indicator restrictions: */
+    QList<IndicatorType> restrictions =
+        gEDataManager->restrictedStatusBarIndicators(machineID());
+
+    /* Invert restriction for sender type: */
+    if (restrictions.contains(type))
+        restrictions.removeAll(type);
+    else
+        restrictions.append(type);
+
+    /* Save updated status-bar indicator restrictions: */
+    gEDataManager->setRestrictedStatusBarIndicators(restrictions, machineID());
+}
+
+void UIStatusBarEditorWidget::sltHandleDragObjectDestroy()
+{
+    /* Reset token: */
+    m_pButtonDropToken = 0;
+    m_fDropAfterTokenButton = true;
+    /* Update: */
+    update();
+}
+
+void UIStatusBarEditorWidget::prepare()
+{
+    /* Do nothing if already prepared: */
+    if (m_fPrepared)
+        return;
+
+    /* Do not prepare if machine ID is not set: */
+    if (m_strMachineID.isEmpty())
+        return;
+
+    /* Track D&D events: */
+    setAcceptDrops(true);
+
+    /* Create main-layout: */
+    m_pMainLayout = new QHBoxLayout(this);
+    AssertPtrReturnVoid(m_pMainLayout);
+    {
+        /* Configure main-layout: */
+        int iLeft, iTop, iRight, iBottom;
+        m_pMainLayout->getContentsMargins(&iLeft, &iTop, &iRight, &iBottom);
+        /* Standard margins should not be too big: */
+        iLeft   = qMin(iLeft,   10);
+        iTop    = qMin(iTop,    10);
+        iRight  = qMin(iRight,  10);
+        iBottom = qMin(iBottom, 10);
+        /* Bottom margin should be smaller for the common case: */
+        if (iBottom >= 5)
+            iBottom -= 5;
+        /* Left margin should be bigger for the settings case: */
+        if (m_fStartedFromVMSettings)
+            iLeft += 5;
+        /* Apply margins/spacing finally: */
+        m_pMainLayout->setContentsMargins(iLeft, iTop, iRight, iBottom);
+        m_pMainLayout->setSpacing(0);
+        /* Create close-button if necessary: */
+        if (!m_fStartedFromVMSettings)
+        {
+            m_pButtonClose = new QIToolButton;
+            AssertPtrReturnVoid(m_pButtonClose);
+            {
+                /* Configure close-button: */
+                m_pButtonClose->setFocusPolicy(Qt::StrongFocus);
+                m_pButtonClose->setShortcut(Qt::Key_Escape);
+                m_pButtonClose->setIcon(UIIconPool::iconSet(":/ok_16px.png"));
+                connect(m_pButtonClose, SIGNAL(clicked(bool)), this, SIGNAL(sigCancelClicked()));
+                /* Add close-button into main-layout: */
+                m_pMainLayout->addWidget(m_pButtonClose);
+            }
+        }
+        /* Create enable-checkbox if necessary: */
+        else
+        {
+            m_pCheckBoxEnable = new QCheckBox;
+            AssertPtrReturnVoid(m_pCheckBoxEnable);
+            {
+                /* Configure enable-checkbox: */
+                m_pCheckBoxEnable->setFocusPolicy(Qt::StrongFocus);
+                connect(m_pCheckBoxEnable, SIGNAL(toggled(bool)), this, SLOT(sltHandleStatusBarEnableToggle(bool)));
+                /* Add enable-checkbox into main-layout: */
+                m_pMainLayout->addWidget(m_pCheckBoxEnable);
+                /* Update enable-checkbox: */
+                updateEnableCheckbox();
+            }
+        }
+        /* Insert stretch: */
+        m_pMainLayout->addStretch();
+        /* Create button-layout: */
+        m_pButtonLayout = new QHBoxLayout;
+        AssertPtrReturnVoid(m_pButtonLayout);
+        {
+            /* Configure button-layout: */
+            m_pButtonLayout->setContentsMargins(0, 0, 0, 0);
+            m_pButtonLayout->setSpacing(5);
+            /* Add button-layout into main-layout: */
+            m_pMainLayout->addLayout(m_pButtonLayout);
+        }
+        /* Prepare status buttons: */
+        prepareStatusButtons();
+    }
+
+    /* Mark as prepared: */
+    m_fPrepared = true;
+
+    /* Translate contents: */
+    retranslateUi();
+}
+
+void UIStatusBarEditorWidget::prepareStatusButtons()
+{
+    /* Create status buttons: */
+    for (int i = IndicatorType_Invalid; i < IndicatorType_Max; ++i)
+    {
+        /* Get current type: */
+        const IndicatorType type = (IndicatorType)i;
+        /* Skip inappropriate types: */
+        if (type == IndicatorType_Invalid || type == IndicatorType_KeyboardExtension)
+            continue;
+        /* Create status button: */
+        prepareStatusButton(type);
+    }
+
+    /* Listen for the status-bar configuration changes: */
+    connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange(const QString&)),
+            this, SLOT(sltHandleConfigurationChange(const QString&)));
+
+    /* Update status buttons: */
+    updateStatusButtons();
+}
+
+void UIStatusBarEditorWidget::prepareStatusButton(IndicatorType type)
+{
+    /* Create status button: */
+    UIStatusBarEditorButton *pButton = new UIStatusBarEditorButton(type);
+    AssertPtrReturnVoid(pButton);
+    {
+        /* Configure status button: */
+        connect(pButton, SIGNAL(sigClick()), this, SLOT(sltHandleButtonClick()));
+        connect(pButton, SIGNAL(sigDragObjectDestroy()), this, SLOT(sltHandleDragObjectDestroy()));
+        /* Add status button into button-layout: */
+        m_pButtonLayout->addWidget(pButton);
+        /* Insert status button into map: */
+        m_buttons.insert(type, pButton);
+    }
+}
+
+void UIStatusBarEditorWidget::updateEnableCheckbox()
+{
+    /* Update enable-checkbox if necessary: */
+    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
+    {
+        m_pCheckBoxEnable->blockSignals(true);
+        m_pCheckBoxEnable->setChecked(gEDataManager->statusBarEnabled(machineID()));
+        m_pCheckBoxEnable->blockSignals(false);
+    }
+}
+
+void UIStatusBarEditorWidget::updateStatusButtons()
+{
+    /* Recache status-bar configuration: */
+    m_restrictions = gEDataManager->restrictedStatusBarIndicators(machineID());
+    m_order = gEDataManager->statusBarIndicatorOrder(machineID());
+    for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType)
+        if (iType != IndicatorType_Invalid && iType != IndicatorType_KeyboardExtension &&
+            !m_order.contains((IndicatorType)iType))
+            m_order << (IndicatorType)iType;
+
+    /* Update configuration for all the status buttons: */
+    foreach (const IndicatorType &type, m_order)
+    {
+        /* Get button: */
+        UIStatusBarEditorButton *pButton = m_buttons.value(type);
+        /* Update button 'checked' state: */
+        pButton->setChecked(!m_restrictions.contains(type));
+        /* Make sure it have valid position: */
+        const int iWantedIndex = position(type);
+        const int iActualIndex = m_pButtonLayout->indexOf(pButton);
+        if (iActualIndex != iWantedIndex)
+        {
+            /* Re-inject button into main-layout at proper position: */
+            m_pButtonLayout->removeWidget(pButton);
+            m_pButtonLayout->insertWidget(iWantedIndex, pButton);
+        }
+    }
+}
+
+void UIStatusBarEditorWidget::retranslateUi()
+{
+    /* Translate close-button if necessary: */
+    if (!m_fStartedFromVMSettings && m_pButtonClose)
+        m_pButtonClose->setToolTip(tr("Close"));
+    /* Translate enable-checkbox if necessary: */
+    if (m_fStartedFromVMSettings && m_pCheckBoxEnable)
+        m_pCheckBoxEnable->setToolTip(tr("Enable Status Bar"));
+}
+
+void UIStatusBarEditorWidget::paintEvent(QPaintEvent*)
+{
+    /* Prepare painter: */
+    QPainter painter(this);
+
+    /* Prepare palette colors: */
+    const QPalette pal = palette();
+    QColor color0 = pal.color(QPalette::Window);
+    QColor color1 = pal.color(QPalette::Window).lighter(110);
+    color1.setAlpha(0);
+    QColor color2 = pal.color(QPalette::Window).darker(200);
+#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+    QColor color3 = pal.color(QPalette::Window).darker(120);
+#endif /* Q_WS_WIN || Q_WS_X11 */
+
+    /* Left corner: */
+    QRadialGradient grad1(QPointF(5, 5), 5);
+    {
+        grad1.setColorAt(0, color2);
+        grad1.setColorAt(1, color1);
+    }
+    /* Right corner: */
+    QRadialGradient grad2(QPointF(width() - 5, 5), 5);
+    {
+        grad2.setColorAt(0, color2);
+        grad2.setColorAt(1, color1);
+    }
+    /* Top line: */
+    QLinearGradient grad3(QPointF(5, 0), QPointF(5, 5));
+    {
+        grad3.setColorAt(0, color1);
+        grad3.setColorAt(1, color2);
+    }
+    /* Left line: */
+    QLinearGradient grad4(QPointF(0, 5), QPointF(5, 5));
+    {
+        grad4.setColorAt(0, color1);
+        grad4.setColorAt(1, color2);
+    }
+    /* Right line: */
+    QLinearGradient grad5(QPointF(width(), 5), QPointF(width() - 5, 5));
+    {
+        grad5.setColorAt(0, color1);
+        grad5.setColorAt(1, color2);
+    }
+
+    /* Paint shape/shadow: */
+    painter.fillRect(QRect(5, 5, width() - 5 * 2, height() - 5), color0); // background
+    painter.fillRect(QRect(0,           0, 5, 5), grad1); // left corner
+    painter.fillRect(QRect(width() - 5, 0, 5, 5), grad2); // right corner
+    painter.fillRect(QRect(5, 0, width() - 5 * 2, 5), grad3); // bottom line
+    painter.fillRect(QRect(0,           5, 5, height() - 5), grad4); // left line
+    painter.fillRect(QRect(width() - 5, 5, 5, height() - 5), grad5); // right line
+
+#if defined(Q_WS_WIN) || defined(Q_WS_X11)
+    /* Paint frames: */
+    painter.save();
+    painter.setPen(color3);
+    painter.drawLine(QLine(QPoint(5 + 1, 5 + 1),                      QPoint(width() - 1 - 5 - 1, 5 + 1)));
+    painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, 5 + 1),        QPoint(width() - 1 - 5 - 1, height() - 1)));
+    painter.drawLine(QLine(QPoint(width() - 1 - 5 - 1, height() - 1), QPoint(5 + 1, height() - 1)));
+    painter.drawLine(QLine(QPoint(5 + 1, height() - 1),               QPoint(5 + 1, 5 + 1)));
+    painter.restore();
+#endif /* Q_WS_WIN || Q_WS_X11 */
+
+    /* Paint drop token: */
+    if (m_pButtonDropToken)
+    {
+        QStyleOption option;
+        option.state |= QStyle::State_Horizontal;
+        const QRect geo = m_pButtonDropToken->geometry();
+        option.rect = !m_fDropAfterTokenButton ?
+                      QRect(geo.topLeft() - QPoint(5, 5),
+                            geo.bottomLeft() + QPoint(0, 5)) :
+                      QRect(geo.topRight() - QPoint(0, 5),
+                            geo.bottomRight() + QPoint(5, 5));
+        QApplication::style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator,
+                                             &option, &painter);
+    }
+}
+
+void UIStatusBarEditorWidget::dragEnterEvent(QDragEnterEvent *pEvent)
+{
+    /* Make sure event is valid: */
+    AssertPtrReturnVoid(pEvent);
+    /* And mime-data is set: */
+    const QMimeData *pMimeData = pEvent->mimeData();
+    AssertPtrReturnVoid(pMimeData);
+    /* Make sure mime-data format is valid: */
+    if (!pMimeData->hasFormat(UIStatusBarEditorButton::MimeType))
+        return;
+
+    /* Accept drag-enter event: */
+    pEvent->acceptProposedAction();
+}
+
+void UIStatusBarEditorWidget::dragMoveEvent(QDragMoveEvent *pEvent)
+{
+    /* Make sure event is valid: */
+    AssertPtrReturnVoid(pEvent);
+    /* And mime-data is set: */
+    const QMimeData *pMimeData = pEvent->mimeData();
+    AssertPtrReturnVoid(pMimeData);
+    /* Make sure mime-data format is valid: */
+    if (!pMimeData->hasFormat(UIStatusBarEditorButton::MimeType))
+        return;
+
+    /* Reset token: */
+    m_pButtonDropToken = 0;
+    m_fDropAfterTokenButton = true;
+
+    /* Get event position: */
+    const QPoint pos = pEvent->pos();
+    /* Search for most suitable button: */
+    foreach (const IndicatorType &type, m_order)
+    {
+        m_pButtonDropToken = m_buttons.value(type);
+        const QRect geo = m_pButtonDropToken->geometry();
+        if (pos.x() < geo.center().x())
+        {
+            m_fDropAfterTokenButton = false;
+            break;
+        }
+    }
+    /* Update: */
+    update();
+}
+
+void UIStatusBarEditorWidget::dragLeaveEvent(QDragLeaveEvent*)
+{
+    /* Reset token: */
+    m_pButtonDropToken = 0;
+    m_fDropAfterTokenButton = true;
+    /* Update: */
+    update();
+}
+
+void UIStatusBarEditorWidget::dropEvent(QDropEvent *pEvent)
+{
+    /* Make sure event is valid: */
+    AssertPtrReturnVoid(pEvent);
+    /* And mime-data is set: */
+    const QMimeData *pMimeData = pEvent->mimeData();
+    AssertPtrReturnVoid(pMimeData);
+    /* Make sure mime-data format is valid: */
+    if (!pMimeData->hasFormat(UIStatusBarEditorButton::MimeType))
+        return;
+
+    /* Make sure token-button set: */
+    if (!m_pButtonDropToken)
+        return;
+
+    /* Determine type of token-button: */
+    const IndicatorType tokenType = m_pButtonDropToken->type();
+    /* Determine type of dropped-button: */
+    const QString strDroppedType =
+        QString::fromLatin1(pMimeData->data(UIStatusBarEditorButton::MimeType));
+    const IndicatorType droppedType =
+        gpConverter->fromInternalString<IndicatorType>(strDroppedType);
+
+    /* Make sure these types are different: */
+    if (droppedType == tokenType)
+        return;
+
+    /* Load current status-bar indicator order and make sure it's complete: */
+    QList<IndicatorType> order =
+        gEDataManager->statusBarIndicatorOrder(machineID());
+    for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType)
+        if (iType != IndicatorType_Invalid && iType != IndicatorType_KeyboardExtension &&
+            !order.contains((IndicatorType)iType))
+            order << (IndicatorType)iType;
+
+    /* Remove type of dropped-button: */
+    order.removeAll(droppedType);
+    /* Insert type of dropped-button into position of token-button: */
+    int iPosition = order.indexOf(tokenType);
+    if (m_fDropAfterTokenButton)
+        ++iPosition;
+    order.insert(iPosition, droppedType);
+
+    /* Save updated status-bar indicator order: */
+    gEDataManager->setStatusBarIndicatorOrder(order, machineID());
+}
+
+int UIStatusBarEditorWidget::position(IndicatorType type) const
+{
+    int iPosition = 0;
+    foreach (const IndicatorType &iteratedType, m_order)
+        if (iteratedType == type)
+            return iPosition;
+        else
+            ++iPosition;
+    return iPosition;
+}
+
+
+UIStatusBarEditorWindow::UIStatusBarEditorWindow(UIMachineWindow *pParent)
+    : UISlidingToolBar(pParent, pParent->statusBar(), new UIStatusBarEditorWidget(0, false, vboxGlobal().managedVMUuid()), UISlidingToolBar::Position_Bottom)
+{
+}
+
+#include "UIStatusBarEditorWindow.moc"
+
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h
new file mode 100644
index 0000000..1c3ab5e
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.h
@@ -0,0 +1,161 @@
+/* $Id: UIStatusBarEditorWindow.h $ */
+/** @file
+ * VBox Qt GUI - UIStatusBarEditorWindow class declaration.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIStatusBarEditorWindow_h___
+#define ___UIStatusBarEditorWindow_h___
+
+/* Qt includes: */
+#include <QMap>
+#include <QList>
+
+/* GUI includes: */
+#include "UIExtraDataDefs.h"
+#include "UISlidingToolBar.h"
+#include "QIWithRetranslateUI.h"
+
+/* Forward declarations: */
+class UIStatusBarEditorButton;
+class UIMachineWindow;
+class QIToolButton;
+class QHBoxLayout;
+class QCheckBox;
+
+/** UISlidingToolBar wrapper
+  * providing user with possibility to edit status-bar layout. */
+class UIStatusBarEditorWindow : public UISlidingToolBar
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pParent to the UISlidingToolBar constructor. */
+    UIStatusBarEditorWindow(UIMachineWindow *pParent);
+};
+
+/** QWidget reimplementation
+  * used as status-bar editor widget. */
+class UIStatusBarEditorWidget : public QIWithRetranslateUI2<QWidget>
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies about Cancel button click. */
+    void sigCancelClicked();
+
+public:
+
+    /** Constructor,
+      * @param pParent                is passed to QWidget constructor,
+      * @param fStartedFromVMSettings determines whether 'this' is a part of VM settings,
+      * @param strMachineID           brings the machine ID to be used by the editor. */
+    UIStatusBarEditorWidget(QWidget *pParent,
+                            bool fStartedFromVMSettings = true,
+                            const QString &strMachineID = QString());
+
+    /** Returns the machine ID instance. */
+    const QString& machineID() const { return m_strMachineID; }
+    /** Defines the @a strMachineID instance. */
+    void setMachineID(const QString &strMachineID);
+
+private slots:
+
+    /** Handles configuration change. */
+    void sltHandleConfigurationChange(const QString &strMachineID);
+
+    /** Handles status-bar enable toggle. */
+    void sltHandleStatusBarEnableToggle(bool fEnabled);
+    /** Handles button click. */
+    void sltHandleButtonClick();
+
+    /** Handles drag object destroy. */
+    void sltHandleDragObjectDestroy();
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+    /** Prepare status buttons routine. */
+    void prepareStatusButtons();
+    /** Prepare status button routine. */
+    void prepareStatusButton(IndicatorType type);
+
+    /** Update enable-checkbox routine. */
+    void updateEnableCheckbox();
+    /** Update status buttons routine. */
+    void updateStatusButtons();
+
+    /** Retranslation routine. */
+    virtual void retranslateUi();
+
+    /** Paint event handler. */
+    virtual void paintEvent(QPaintEvent *pEvent);
+
+    /** Drag-enter event handler. */
+    virtual void dragEnterEvent(QDragEnterEvent *pEvent);
+    /** Drag-move event handler. */
+    virtual void dragMoveEvent(QDragMoveEvent *pEvent);
+    /** Drag-leave event handler. */
+    virtual void dragLeaveEvent(QDragLeaveEvent *pEvent);
+    /** Drop event handler. */
+    virtual void dropEvent(QDropEvent *pEvent);
+
+    /** Returns position for passed @a type. */
+    int position(IndicatorType type) const;
+
+    /** @name General
+      * @{ */
+        /** Holds whether 'this' is prepared. */
+        bool m_fPrepared;
+        /** Holds whether 'this' is a part of VM settings. */
+        bool m_fStartedFromVMSettings;
+        /** Holds the machine ID instance. */
+        QString m_strMachineID;
+    /** @} */
+
+    /** @name Contents
+      * @{ */
+        /** Holds the main-layout instance. */
+        QHBoxLayout *m_pMainLayout;
+        /** Holds the button-layout instance. */
+        QHBoxLayout *m_pButtonLayout;
+        /** Holds the close-button instance. */
+        QIToolButton *m_pButtonClose;
+        /** Holds the enable-checkbox instance. */
+        QCheckBox *m_pCheckBoxEnable;
+        /** Holds status-bar buttons. */
+        QMap<IndicatorType, UIStatusBarEditorButton*> m_buttons;
+    /** @} */
+
+    /** @name Contents: Restrictions
+      * @{ */
+        /** Holds the cached status-bar button restrictions. */
+        QList<IndicatorType> m_restrictions;
+    /** @} */
+
+    /** @name Contents: Order
+      * @{ */
+        /** Holds the cached status-bar button order. */
+        QList<IndicatorType> m_order;
+        /** Holds the token-button to drop dragged-button nearby. */
+        UIStatusBarEditorButton *m_pButtonDropToken;
+        /** Holds whether dragged-button should be dropped <b>after</b> the token-button. */
+        bool m_fDropAfterTokenButton;
+    /** @} */
+};
+
+#endif /* !___UIStatusBarEditorWindow_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
index 62ebfe1..ef65584 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIVMCloseDialog.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIVMCloseDialog class implementation
+ * VBox Qt GUI - UIVMCloseDialog class implementation.
  */
 
 /*
@@ -18,7 +16,7 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
@@ -32,10 +30,11 @@
 
 /* GUI includes: */
 # include "UIVMCloseDialog.h"
+# include "UIExtraDataManager.h"
 # include "UIMessageCenter.h"
+# include "UIConverter.h"
 # include "VBoxGlobal.h"
 # include "QIDialogButtonBox.h"
-# include "UIConverter.h"
 
 /* COM includes: */
 # include "CMachine.h"
@@ -45,9 +44,15 @@
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 UIVMCloseDialog::UIVMCloseDialog(QWidget *pParent, CMachine &machine,
                                  bool fIsACPIEnabled, MachineCloseAction restictedCloseActions)
     : QIWithRetranslateUI<QIDialog>(pParent)
+    , m_pIcon(0), m_pLabel(0)
+    , m_pDetachIcon(0), m_pDetachRadio(0)
+    , m_pSaveIcon(0), m_pSaveRadio(0)
+    , m_pShutdownIcon(0), m_pShutdownRadio(0)
+    , m_pPowerOffIcon(0), m_pPowerOffRadio(0), m_pDiscardCheckBox(0)
     , m_machine(machine)
     , m_restictedCloseActions(restictedCloseActions)
     , m_fIsACPIEnabled(fIsACPIEnabled)
@@ -73,7 +78,9 @@ void UIVMCloseDialog::sltUpdateWidgetAvailability()
 void UIVMCloseDialog::accept()
 {
     /* Calculate result: */
-    if (m_pSaveRadio->isChecked())
+    if (m_pDetachRadio->isChecked())
+        setResult(MachineCloseAction_Detach);
+    else if (m_pSaveRadio->isChecked())
         setResult(MachineCloseAction_SaveState);
     else if (m_pShutdownRadio->isChecked())
         setResult(MachineCloseAction_Shutdown);
@@ -91,7 +98,7 @@ void UIVMCloseDialog::accept()
     if (newCloseAction == MachineCloseAction_PowerOff &&
         m_lastCloseAction == MachineCloseAction_Shutdown && !m_fIsACPIEnabled)
         newCloseAction = MachineCloseAction_Shutdown;
-    m_machine.SetExtraData(GUI_LastCloseAction, gpConverter->toInternalString(newCloseAction));
+    gEDataManager->setLastMachineCloseAction(newCloseAction, vboxGlobal().managedVMUuid());
 
     /* Hide the dialog: */
     hide();
@@ -107,6 +114,18 @@ void UIVMCloseDialog::setPixmap(const QPixmap &pixmap)
     m_pIcon->setPixmap(pixmap);
 }
 
+void UIVMCloseDialog::setDetachButtonEnabled(bool fEnabled)
+{
+    m_pDetachIcon->setEnabled(fEnabled);
+    m_pDetachRadio->setEnabled(fEnabled);
+}
+
+void UIVMCloseDialog::setDetachButtonVisible(bool fVisible)
+{
+    m_pDetachIcon->setVisible(fVisible);
+    m_pDetachRadio->setVisible(fVisible);
+}
+
 void UIVMCloseDialog::setSaveButtonEnabled(bool fEnabled)
 {
     m_pSaveIcon->setEnabled(fEnabled);
@@ -180,6 +199,20 @@ void UIVMCloseDialog::prepare()
                 /* Prepare 'choice' layout: */
                 QGridLayout *pChoiceLayout = new QGridLayout;
                 {
+                    /* Prepare 'detach' icon: */
+                    m_pDetachIcon = new QLabel(this);
+                    {
+                        /* Configure icon: */
+                        m_pDetachIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+                        m_pDetachIcon->setPixmap(QPixmap(":/vm_create_shortcut_16px.png"));
+                    }
+                    /* Prepare 'detach' radio-button: */
+                    m_pDetachRadio = new QRadioButton(this);
+                    {
+                        /* Configure button: */
+                        m_pDetachRadio->installEventFilter(this);
+                        connect(m_pDetachRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability()));
+                    }
                     /* Prepare 'save' icon: */
                     m_pSaveIcon = new QLabel(this);
                     {
@@ -231,13 +264,15 @@ void UIVMCloseDialog::prepare()
                     pChoiceLayout->setSpacing(6);
 #endif /* !Q_WS_MAC */
                     pChoiceLayout->setContentsMargins(0, 0, 0, 0);
-                    pChoiceLayout->addWidget(m_pSaveIcon, 0, 0);
-                    pChoiceLayout->addWidget(m_pSaveRadio, 0, 1);
-                    pChoiceLayout->addWidget(m_pShutdownIcon, 1, 0);
-                    pChoiceLayout->addWidget(m_pShutdownRadio, 1, 1);
-                    pChoiceLayout->addWidget(m_pPowerOffIcon, 2, 0);
-                    pChoiceLayout->addWidget(m_pPowerOffRadio, 2, 1);
-                    pChoiceLayout->addWidget(m_pDiscardCheckBox, 3, 1);
+                    pChoiceLayout->addWidget(m_pDetachIcon, 0, 0);
+                    pChoiceLayout->addWidget(m_pDetachRadio, 0, 1);
+                    pChoiceLayout->addWidget(m_pSaveIcon, 1, 0);
+                    pChoiceLayout->addWidget(m_pSaveRadio, 1, 1);
+                    pChoiceLayout->addWidget(m_pShutdownIcon, 2, 0);
+                    pChoiceLayout->addWidget(m_pShutdownRadio, 2, 1);
+                    pChoiceLayout->addWidget(m_pPowerOffIcon, 3, 0);
+                    pChoiceLayout->addWidget(m_pPowerOffRadio, 3, 1);
+                    pChoiceLayout->addWidget(m_pDiscardCheckBox, 4, 1);
                 }
                 /* Configure layout: */
 #ifdef Q_WS_MAC
@@ -285,18 +320,27 @@ void UIVMCloseDialog::configure()
     setPixmap(vboxGlobal().vmGuestOSTypeIcon(m_machine.GetOSTypeId()));
 
     /* Check which close-actions are resticted: */
+    bool fIsDetachAllowed = vboxGlobal().isSeparateProcess() && !(m_restictedCloseActions & MachineCloseAction_Detach);
     bool fIsStateSavingAllowed = !(m_restictedCloseActions & MachineCloseAction_SaveState);
     bool fIsACPIShutdownAllowed = !(m_restictedCloseActions & MachineCloseAction_Shutdown);
     bool fIsPowerOffAllowed = !(m_restictedCloseActions & MachineCloseAction_PowerOff);
     bool fIsPowerOffAndRestoreAllowed = fIsPowerOffAllowed && !(m_restictedCloseActions & MachineCloseAction_PowerOff_RestoringSnapshot);
 
+    /* Make 'Detach' button visible/hidden depending on restriction: */
+    setDetachButtonVisible(fIsDetachAllowed);
+    /* Make 'Detach' button enabled/disabled depending on machine-state: */
+    setDetachButtonEnabled(machineState != KMachineState_Stuck);
+
     /* Make 'Save state' button visible/hidden depending on restriction: */
     setSaveButtonVisible(fIsStateSavingAllowed);
     /* Make 'Save state' button enabled/disabled depending on machine-state: */
     setSaveButtonEnabled(machineState != KMachineState_Stuck);
-    /* Make 'Shutdown button' visible/hidden depending on restriction: */
+
+    /* Make 'Shutdown' button visible/hidden depending on restriction: */
     setShutdownButtonVisible(fIsACPIShutdownAllowed);
+    /* Make 'Shutdown' button enabled/disabled depending on console and machine-state: */
     setShutdownButtonEnabled(m_fIsACPIEnabled && machineState != KMachineState_Stuck);
+
     /* Make 'Power off' button visible/hidden depending on restriction: */
     setPowerOffButtonVisible(fIsPowerOffAllowed);
     /* Make the Restore Snapshot checkbox visible/hidden depending on snapshot count & restrictions: */
@@ -308,8 +352,12 @@ void UIVMCloseDialog::configure()
     /* Check which radio-button should be initially chosen: */
     QRadioButton *pRadioButtonToChoose = 0;
     /* If choosing 'last choice' is possible: */
-    m_lastCloseAction = gpConverter->fromInternalString<MachineCloseAction>(m_machine.GetExtraData(GUI_LastCloseAction));
-    if (m_lastCloseAction == MachineCloseAction_SaveState && fIsStateSavingAllowed)
+    m_lastCloseAction = gEDataManager->lastMachineCloseAction(vboxGlobal().managedVMUuid());
+    if (m_lastCloseAction == MachineCloseAction_Detach && fIsDetachAllowed)
+    {
+        pRadioButtonToChoose = m_pDetachRadio;
+    }
+    else if (m_lastCloseAction == MachineCloseAction_SaveState && fIsStateSavingAllowed)
     {
         pRadioButtonToChoose = m_pSaveRadio;
     }
@@ -329,7 +377,9 @@ void UIVMCloseDialog::configure()
     /* Else 'default choice' will be used: */
     else
     {
-        if (fIsStateSavingAllowed)
+        if (fIsDetachAllowed)
+            pRadioButtonToChoose = m_pDetachRadio;
+        else if (fIsStateSavingAllowed)
             pRadioButtonToChoose = m_pSaveRadio;
         else if (fIsACPIShutdownAllowed && m_fIsACPIEnabled)
             pRadioButtonToChoose = m_pShutdownRadio;
@@ -357,6 +407,9 @@ void UIVMCloseDialog::retranslateUi()
     m_pLabel->setText(tr("You want to:"));
 
     /* Translate radio-buttons: */
+    m_pDetachRadio->setText(tr("&Continue running in the background"));
+    m_pDetachRadio->setWhatsThis(tr("<p>Close the virtual machine windows but keep the virtual machine running.</p>"
+                                    "<p>You can use the VirtualBox Manager to return to running the virtual machine in a window.</p>"));
     m_pSaveRadio->setText(tr("&Save the machine state"));
     m_pSaveRadio->setWhatsThis(tr("<p>Saves the current execution state of the virtual machine to the physical hard disk of the host PC.</p>"
                                   "<p>Next time this machine is started, it will be restored from the saved state and continue execution "
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h b/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h
index 2bc0038..61a5a4e 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h
@@ -1,7 +1,6 @@
+/* $Id: UIVMCloseDialog.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIVMCloseDialog class declaration
+ * VBox Qt GUI - UIVMCloseDialog class declaration.
  */
 
 /*
@@ -22,10 +21,9 @@
 /* GUI includes: */
 #include "QIWithRetranslateUI.h"
 #include "QIDialog.h"
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
 
 /* Forward declarations: */
-enum MachineCloseAction;
 class CMachine;
 class QLabel;
 class QRadioButton;
@@ -58,6 +56,9 @@ private:
     /* API: Pixmap stuff: */
     void setPixmap(const QPixmap &pixmap);
 
+    /* API: Detach-button stuff: */
+    void setDetachButtonEnabled(bool fEnabled);
+    void setDetachButtonVisible(bool fVisible);
     /* API: Save-button stuff: */
     void setSaveButtonEnabled(bool fEnabled);
     void setSaveButtonVisible(bool fVisible);
@@ -86,6 +87,8 @@ private:
     /* Widgets: */
     QLabel *m_pIcon;
     QLabel *m_pLabel;
+    QLabel *m_pDetachIcon;
+    QRadioButton *m_pDetachRadio;
     QLabel *m_pSaveIcon;
     QRadioButton *m_pSaveRadio;
     QLabel *m_pShutdownIcon;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.cpp
index f680c2e..96afba8 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIKeyboardHandlerFullscreen.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandlerFullscreen class implementation
+ * VBox Qt GUI - UIKeyboardHandlerFullscreen class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,28 +15,34 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Global includes */
-#include <QKeyEvent>
-#include <QTimer>
-#include <QWidget>
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QKeyEvent>
+# include <QTimer>
+
+/* GUI includes: */
+# include "UIKeyboardHandlerFullscreen.h"
+# include "UIMachineLogic.h"
+# include "UIShortcutPool.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
-/* Local includes */
-#include "UIKeyboardHandlerFullscreen.h"
-#include "UIMachineWindow.h"
-#include "UIShortcutPool.h"
+/* Namespaces: */
+using namespace UIExtraDataDefs;
 
-/* Fullscreen keyboard-handler constructor: */
 UIKeyboardHandlerFullscreen::UIKeyboardHandlerFullscreen(UIMachineLogic* pMachineLogic)
     : UIKeyboardHandler(pMachineLogic)
 {
 }
 
-/* Fullscreen keyboard-handler destructor: */
 UIKeyboardHandlerFullscreen::~UIKeyboardHandlerFullscreen()
 {
 }
 
-/* Event handler for prepared listener(s): */
 bool UIKeyboardHandlerFullscreen::eventFilter(QObject *pWatchedObject, QEvent *pEvent)
 {
     /* Check if pWatchedObject object is view: */
@@ -58,7 +62,7 @@ bool UIKeyboardHandlerFullscreen::eventFilter(QObject *pWatchedObject, QEvent *p
                 if (isHostKeyPressed() && pKeyEvent->key() == gShortcutPool->shortcut(GUI_Input_MachineShortcuts, QString("PopupMenu")).sequence())
                 {
                     /* Post request to show popup-menu: */
-                    QTimer::singleShot(0, m_windows[uScreenId], SLOT(sltPopupMainMenu()));
+                    QTimer::singleShot(0, m_pMachineLogic, SLOT(sltInvokePopupMenu()));
                     /* Filter-out this event: */
                     return true;
                 }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.h b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.h
index ba51873..714bc54 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIKeyboardHandlerFullscreen.h
@@ -1,11 +1,10 @@
+/* $Id: UIKeyboardHandlerFullscreen.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandlerFullscreen class declaration
+ * VBox Qt GUI - UIKeyboardHandlerFullscreen class declaration.
  */
 
 /*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,27 +18,29 @@
 #ifndef ___UIKeyboardHandlerFullscreen_h___
 #define ___UIKeyboardHandlerFullscreen_h___
 
-/* Local includes */
+/* GUI includes: */
 #include "UIKeyboardHandler.h"
 
+/** UIKeyboardHandler reimplementation
+  * providing machine-logic with PopupMenu keyboard handler. */
 class UIKeyboardHandlerFullscreen : public UIKeyboardHandler
 {
     Q_OBJECT;
 
 protected:
 
-    /* Fullscreen keyboard-handler constructor/destructor: */
+    /** Fullscreen keyboard-handler constructor. */
     UIKeyboardHandlerFullscreen(UIMachineLogic *pMachineLogic);
+    /** Fullscreen keyboard-handler destructor. */
     virtual ~UIKeyboardHandlerFullscreen();
 
 private:
 
-    /* Event handlers: */
+    /** General event-filter. */
     bool eventFilter(QObject *pWatched, QEvent *pEvent);
 
-    /* Friend classes: */
+    /* Friend class: */
     friend class UIKeyboardHandler;
 };
 
-#endif // !___UIKeyboardHandlerFullscreen_h___
-
+#endif /* !___UIKeyboardHandlerFullscreen_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
index 0d6cc3e..ef68d96 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
@@ -15,52 +15,61 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
+# include <QDesktopWidget>
+# include <QTimer>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogicFullscreen.h"
-#include "UIMachineWindowFullscreen.h"
-#include "UIMultiScreenLayout.h"
-#ifdef Q_WS_MAC
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogicFullscreen.h"
+# include "UIMachineWindowFullscreen.h"
+# include "UIMultiScreenLayout.h"
+# include "UIShortcutPool.h"
 # include "UIMachineView.h"
-# include "UIExtraDataEventHandler.h"
-# include "UICocoaApplication.h"
-# include "VBoxUtils.h"
-# include "UIFrameBuffer.h"
-# include <Carbon/Carbon.h>
-#endif /* Q_WS_MAC */
+# include "QIMenu.h"
+# ifdef Q_WS_MAC
+#  include "UICocoaApplication.h"
+#  include "UIExtraDataManager.h"
+#  include "VBoxUtils.h"
+#  include "UIFrameBuffer.h"
+#  include <Carbon/Carbon.h>
+# endif /* Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineLogicFullscreen::UIMachineLogicFullscreen(QObject *pParent, UISession *pSession)
     : UIMachineLogic(pParent, pSession, UIVisualStateType_Fullscreen)
+    , m_pPopupMenu(0)
 #ifdef Q_WS_MAC
     , m_fScreensHaveSeparateSpaces(darwinScreensHaveSeparateSpaces())
-    , m_fadeToken(kCGDisplayFadeReservationInvalidToken)
 #endif /* Q_WS_MAC */
 {
     /* Create multiscreen layout: */
     m_pScreenLayout = new UIMultiScreenLayout(this);
+    actionPool()->toRuntime()->setMultiScreenLayout(m_pScreenLayout);
 }
 
 UIMachineLogicFullscreen::~UIMachineLogicFullscreen()
 {
     /* Delete multiscreen layout: */
+    actionPool()->toRuntime()->setMultiScreenLayout(0);
     delete m_pScreenLayout;
 }
 
 bool UIMachineLogicFullscreen::checkAvailability()
 {
-    /* Temporary get a machine object: */
-    const CMachine &machine = uisession()->session().GetMachine();
-
     /* Check if there is enough physical memory to enter fullscreen: */
     if (uisession()->isGuestSupportsGraphics())
     {
-        quint64 availBits = machine.GetVRAMSize() /* VRAM */ * _1M /* MiB to bytes */ * 8 /* to bits */;
+        quint64 availBits = machine().GetVRAMSize() /* VRAM */ * _1M /* MiB to bytes */ * 8 /* to bits */;
         quint64 usedBits = m_pScreenLayout->memoryRequirements();
         if (availBits < usedBits)
         {
@@ -69,20 +78,28 @@ bool UIMachineLogicFullscreen::checkAvailability()
         }
     }
 
-    /* Take the toggle hot key from the menu item.
-     * Since VBoxGlobal::extractKeyFromActionText gets exactly
-     * the linked key without the 'Host+' part we are adding it here. */
-    QString hotKey = QString("Host+%1")
-        .arg(VBoxGlobal::extractKeyFromActionText(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen)->text()));
-    Assert(!hotKey.isEmpty());
-
     /* Show the info message. */
-    if (!msgCenter().confirmGoingFullscreen(hotKey))
+    const UIShortcut &shortcut =
+            gShortcutPool->shortcut(actionPool()->shortcutsExtraDataID(),
+                                    actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen)->shortcutExtraDataID());
+    const QString strHotKey = QString("Host+%1").arg(shortcut.toString());
+    if (!msgCenter().confirmGoingFullscreen(strHotKey))
         return false;
 
     return true;
 }
 
+Qt::WindowFlags UIMachineLogicFullscreen::windowFlags(ulong uScreenId) const
+{
+    Q_UNUSED(uScreenId);
+#ifdef Q_WS_MAC
+    return vboxGlobal().osRelease() <= MacOSXRelease_Lion ? Qt::FramelessWindowHint :
+           uScreenId == 0 || screensHaveSeparateSpaces() ? Qt::Window : Qt::FramelessWindowHint;
+#else /* !Q_WS_MAC */
+    return Qt::FramelessWindowHint;
+#endif /* !Q_WS_MAC */
+}
+
 void UIMachineLogicFullscreen::adjustMachineWindowsGeometry()
 {
     LogRel(("UIMachineLogicFullscreen::adjustMachineWindowsGeometry\n"));
@@ -129,9 +146,6 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenWillEnter()
     LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenWillEnter: "
             "Machine-window #%d will enter native fullscreen.\n",
             (int)pMachineWindow->screenId()));
-
-    /* Fade to black: */
-    fadeToBlack();
 }
 
 void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidEnter()
@@ -150,9 +164,6 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidEnter()
     m_fullscreenMachineWindows.insert(pMachineWindow);
     AssertReturnVoid(m_fullscreenMachineWindows.contains(pMachineWindow));
 
-    /* Fade to normal: */
-    fadeToNormal();
-
     /* Rebuild multi-screen layout: */
     m_pScreenLayout->rebuild();
     /* Revalidate native fullscreen: */
@@ -170,9 +181,6 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenWillExit()
     LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenWillExit: "
             "Machine-window #%d will exit native fullscreen.\n",
             (int)pMachineWindow->screenId()));
-
-    /* Fade to black: */
-    fadeToBlack();
 }
 
 void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit()
@@ -236,9 +244,6 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit()
                 type = UIVisualStateType_Normal;
             uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
             uisession()->changeVisualState(type);
-
-            /* Fade to normal: */
-            fadeToNormal();
         }
     }
 }
@@ -276,8 +281,8 @@ void UIMachineLogicFullscreen::sltHandleNativeFullscreenFailToEnter()
         /* Ask session to change 'fullscreen' mode to 'normal': */
         uisession()->setRequestedVisualState(UIVisualStateType_Normal);
 
-        /* If session started already => push mode-change directly: */
-        if (uisession()->isStarted())
+        /* If session already initialized => push mode-change directly: */
+        if (uisession()->isInitialized())
             sltCheckForRequestedVisualStateType();
     }
 }
@@ -377,12 +382,15 @@ void UIMachineLogicFullscreen::sltMachineStateChanged()
     }
 }
 
-#ifdef Q_WS_MAC
-void UIMachineLogicFullscreen::sltChangePresentationMode(bool /* fEnabled */)
+void UIMachineLogicFullscreen::sltInvokePopupMenu()
 {
-    setPresentationModeEnabled(true);
+    /* Popup main-menu if present: */
+    if (m_pPopupMenu && !m_pPopupMenu->isEmpty())
+    {
+        m_pPopupMenu->popup(activeMachineWindow()->geometry().center());
+        QTimer::singleShot(0, m_pPopupMenu, SLOT(sltHighlightFirstAction()));
+    }
 }
-#endif /* Q_WS_MAC */
 
 void UIMachineLogicFullscreen::sltScreenLayoutChanged()
 {
@@ -395,8 +403,6 @@ void UIMachineLogicFullscreen::sltScreenLayoutChanged()
         /* Make sure all machine-window(s) have proper geometry: */
         foreach (UIMachineWindow *pMachineWindow, machineWindows())
             pMachineWindow->showInNecessaryMode();
-        /* Update 'presentation mode': */
-        setPresentationModeEnabled(true);
     }
     /* Revalidate native fullscreen for ML and next: */
     else revalidateNativeFullScreen();
@@ -455,17 +461,26 @@ void UIMachineLogicFullscreen::prepareActionGroups()
     /* Call to base-class: */
     UIMachineLogic::prepareActionGroups();
 
-    /* Adjust-window action isn't allowed in fullscreen: */
-    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(false);
+    /* Restrict 'Adjust Window', 'Status Bar' and 'Resize' actions for 'View' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic,
+                                                         (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
+                                                         (UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize));
+#ifdef Q_WS_MAC
+    /* Restrict 'Window' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuBar(UIActionRestrictionLevel_Logic,
+                                                        UIExtraDataMetaDefs::MenuType_Window);
+#endif /* Q_WS_MAC */
 
     /* Take care of view-action toggle state: */
-    UIAction *pActionFullscreen = gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen);
+    UIAction *pActionFullscreen = actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen);
     if (!pActionFullscreen->isChecked())
     {
         pActionFullscreen->blockSignals(true);
         pActionFullscreen->setChecked(true);
         pActionFullscreen->blockSignals(false);
-        pActionFullscreen->update();
     }
 }
 
@@ -474,26 +489,15 @@ void UIMachineLogicFullscreen::prepareActionConnections()
     /* Call to base-class: */
     UIMachineLogic::prepareActionConnections();
 
-    /* "View" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
+    /* Prepare 'View' actions connections: */
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToNormal()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToSeamless()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToScale()));
 }
 
-#ifdef Q_WS_MAC
-void UIMachineLogicFullscreen::prepareOtherConnections()
-{
-    /* Make sure 'presentation mode' preference handling
-     * is updated at runtime for Lion and previous: */
-    if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
-        connect(gEDataEvents, SIGNAL(sigPresentationModeChange(bool)),
-                this, SLOT(sltChangePresentationMode(bool)));
-}
-#endif /* Q_WS_MAC */
-
 void UIMachineLogicFullscreen::prepareMachineWindows()
 {
     /* Do not create machine-window(s) if they created already: */
@@ -514,30 +518,26 @@ void UIMachineLogicFullscreen::prepareMachineWindows()
     /* We have to make sure that we are getting the front most process.
      * This is necessary for Qt versions > 4.3.3: */
     darwinSetFrontMostProcess();
-
-    /* Fade to black: */
-    fadeToBlack();
 #endif /* Q_WS_MAC */
 
     /* Update the multi-screen layout: */
     m_pScreenLayout->update();
 
     /* Create machine-window(s): */
-    for (uint cScreenId = 0; cScreenId < session().GetMachine().GetMonitorCount(); ++cScreenId)
+    for (uint cScreenId = 0; cScreenId < machine().GetMonitorCount(); ++cScreenId)
         addMachineWindow(UIMachineWindow::create(this, cScreenId));
 
+    /* Listen for frame-buffer resize: */
+    foreach (UIMachineWindow *pMachineWindow, machineWindows())
+        connect(pMachineWindow, SIGNAL(sigFrameBufferResize()),
+                this, SIGNAL(sigFrameBufferResize()));
+    emit sigFrameBufferResize();
+
     /* Connect multi-screen layout change handler: */
-    connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChanged()),
+    connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChange()),
             this, SLOT(sltScreenLayoutChanged()));
 
 #ifdef Q_WS_MAC
-    /* Activate 'presentation mode': */
-    setPresentationModeEnabled(true);
-
-    /* For Lion and previous fade to normal: */
-    if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
-        fadeToNormal();
-
     /* For ML and next: */
     if (vboxGlobal().osRelease() > MacOSXRelease_Lion)
     {
@@ -577,12 +577,21 @@ void UIMachineLogicFullscreen::prepareMachineWindows()
 
 void UIMachineLogicFullscreen::prepareMenu()
 {
-    /* Call to base-class: */
-    UIMachineLogic::prepareMenu();
+    /* Prepare popup-menu: */
+    m_pPopupMenu = new QIMenu;
+    AssertPtrReturnVoid(m_pPopupMenu);
+    {
+        /* Prepare popup-menu: */
+        foreach (QMenu *pMenu, actionPool()->menus())
+            m_pPopupMenu->addMenu(pMenu);
+    }
+}
 
-    /* Finally update view-menu, if necessary: */
-    if (uisession()->allowedActionsMenuView() & RuntimeMenuViewActionType_Multiscreen)
-        m_pScreenLayout->setViewMenu(gActionPool->action(UIActionIndexRuntime_Menu_View)->menu());
+void UIMachineLogicFullscreen::cleanupMenu()
+{
+    /* Cleanup popup-menu: */
+    delete m_pPopupMenu;
+    m_pPopupMenu = 0;
 }
 
 void UIMachineLogicFullscreen::cleanupMachineWindows()
@@ -599,10 +608,6 @@ void UIMachineLogicFullscreen::cleanupMachineWindows()
         UICocoaApplication::instance()->unregisterFromNotificationOfWorkspace("NSWorkspaceDidActivateApplicationNotification", this);
         UICocoaApplication::instance()->unregisterFromNotificationOfWorkspace("NSWorkspaceActiveSpaceDidChangeNotification", this);
     }
-
-    /* For Lion and previous fade to black: */
-    if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
-        fadeToBlack();
 #endif/* Q_WS_MAC */
 
     /* Mark machine-window(s) destroyed: */
@@ -611,24 +616,16 @@ void UIMachineLogicFullscreen::cleanupMachineWindows()
     /* Destroy machine-window(s): */
     foreach (UIMachineWindow *pMachineWindow, machineWindows())
         UIMachineWindow::destroy(pMachineWindow);
-
-#ifdef Q_WS_MAC
-    /* Deactivate 'presentation mode': */
-    setPresentationModeEnabled(false);
-
-    /* Fade to normal: */
-    fadeToNormal();
-#endif/* Q_WS_MAC */
 }
 
 void UIMachineLogicFullscreen::cleanupActionConnections()
 {
     /* "View" actions disconnections: */
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToNormal()));
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToSeamless()));
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToScale()));
 
     /* Call to base-class: */
@@ -638,82 +635,28 @@ void UIMachineLogicFullscreen::cleanupActionConnections()
 void UIMachineLogicFullscreen::cleanupActionGroups()
 {
     /* Take care of view-action toggle state: */
-    UIAction *pActionFullscreen = gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen);
+    UIAction *pActionFullscreen = actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen);
     if (pActionFullscreen->isChecked())
     {
         pActionFullscreen->blockSignals(true);
         pActionFullscreen->setChecked(false);
         pActionFullscreen->blockSignals(false);
-        pActionFullscreen->update();
     }
 
-    /* Reenable adjust-window action: */
-    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(true);
+    /* Allow 'Adjust Window', 'Status Bar' and 'Resize' actions for 'View' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic,
+                                                         UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid);
+#ifdef Q_WS_MAC
+    /* Allow 'Window' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuBar(UIActionRestrictionLevel_Logic,
+                                                        UIExtraDataMetaDefs::MenuType_Invalid);
+#endif /* Q_WS_MAC */
 
     /* Call to base-class: */
     UIMachineLogic::cleanupActionGroups();
 }
 
 #ifdef Q_WS_MAC
-void UIMachineLogicFullscreen::setPresentationModeEnabled(bool fEnabled)
-{
-    /* Should we enable it? */
-    if (fEnabled)
-    {
-        /* For Lion and previous: */
-        if (vboxGlobal().osRelease() <= MacOSXRelease_Lion)
-        {
-            /* Check if we have screen which contains the Dock or the Menubar (which hasn't to be the same),
-             * only than the 'presentation mode' have to be changed. */
-            if (m_pScreenLayout->isHostTaskbarCovert())
-            {
-                /* Load 'presentation mode' preference: */
-                QString strPresentationMode = vboxGlobal().virtualBox().GetExtraData(GUI_PresentationModeEnabled).toLower();
-                /* Default to 'false' if it is an empty value: */
-                if (strPresentationMode.isEmpty() || strPresentationMode == "false")
-                    SetSystemUIMode(kUIModeAllHidden, 0);
-                else
-                    SetSystemUIMode(kUIModeAllSuppressed, 0);
-            }
-        }
-        /* For ML and next: */
-        else
-        {
-            /* I am not sure we have to check anything here.
-             * Without 'presentation mode' native fullscreen works pretty bad,
-             * so we have to enable it anyway: */
-            SetSystemUIMode(kUIModeAllSuppressed, 0);
-        }
-    }
-    /* Should we disable it? */
-    else SetSystemUIMode(kUIModeNormal, 0);
-}
-
-void UIMachineLogicFullscreen::fadeToBlack()
-{
-    /* Make sure fade-token invalid: */
-    if (m_fadeToken != kCGDisplayFadeReservationInvalidToken)
-        return;
-
-    /* Acquire fade-token: */
-    LogRel(("UIMachineLogicFullscreen::fadeToBlack\n"));
-    CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &m_fadeToken);
-    CGDisplayFade(m_fadeToken, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, true);
-}
-
-void UIMachineLogicFullscreen::fadeToNormal()
-{
-    /* Make sure fade-token valid: */
-    if (m_fadeToken == kCGDisplayFadeReservationInvalidToken)
-        return;
-
-    /* Release fade-token: */
-    LogRel(("UIMachineLogicFullscreen::fadeToNormal\n"));
-    CGDisplayFade(m_fadeToken, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, false);
-    CGReleaseDisplayFadeReservation(m_fadeToken);
-    m_fadeToken = kCGDisplayFadeReservationInvalidToken;
-}
-
 void UIMachineLogicFullscreen::revalidateNativeFullScreen(UIMachineWindow *pMachineWindow)
 {
     /* Make sure that is full-screen machine-window: */
@@ -745,8 +688,6 @@ void UIMachineLogicFullscreen::revalidateNativeFullScreen(UIMachineWindow *pMach
             LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
                     "Ask transient machine-window #%d to hide.\n", (int)uScreenID));
 
-            /* Make sure mini-toolbar hidden: */
-            pMachineWindowFullscreen->setMiniToolbarVisible(false);
             /* Make sure window hidden: */
             pMachineWindow->hide();
         }
@@ -758,8 +699,6 @@ void UIMachineLogicFullscreen::revalidateNativeFullScreen(UIMachineWindow *pMach
 
             /* Make sure window have proper geometry and shown: */
             pMachineWindow->showInNecessaryMode();
-            /* Make sure mini-toolbar shown: */
-            pMachineWindowFullscreen->setMiniToolbarVisible(true);
         }
     }
     /* Validate window which can be fullscreen: */
@@ -777,14 +716,6 @@ void UIMachineLogicFullscreen::revalidateNativeFullScreen(UIMachineWindow *pMach
                 LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
                         "Ask machine-window #%d to enter native fullscreen.\n", (int)uScreenID));
 
-                /* Fade to black: */
-                fadeToBlack();
-
-                /* Update 'presentation mode': */
-                setPresentationModeEnabled(true);
-
-                /* Make sure mini-toolbar hidden: */
-                pMachineWindowFullscreen->setMiniToolbarVisible(false);
                 /* Make sure window have proper geometry and shown: */
                 pMachineWindow->showInNecessaryMode();
 
@@ -798,13 +729,8 @@ void UIMachineLogicFullscreen::revalidateNativeFullScreen(UIMachineWindow *pMach
                 LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
                         "Ask machine-window #%d to hide.\n", (int)uScreenID));
 
-                /* Make sure mini-toolbar hidden: */
-                pMachineWindowFullscreen->setMiniToolbarVisible(false);
                 /* Make sure window hidden: */
                 pMachineWindow->hide();
-
-                /* Fade to normal: */
-                fadeToNormal();
             }
         }
         /* Validate window which is in fullscreen: */
@@ -827,14 +753,9 @@ void UIMachineLogicFullscreen::revalidateNativeFullScreen(UIMachineWindow *pMach
                 LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
                         "Ask machine-window #%d to exit native fullscreen.\n", (int)uScreenID));
 
-                /* Fade to black: */
-                fadeToBlack();
-
                 /* Mark window as invalidated: */
                 m_invalidFullscreenMachineWindows << pMachineWindow;
 
-                /* Make sure mini-toolbar hidden: */
-                pMachineWindowFullscreen->setMiniToolbarVisible(false);
                 /* Ask window to exit 'fullscreen' mode: */
                 emit sigNotifyAboutNativeFullscreenShouldBeExited(pMachineWindow);
                 return;
@@ -847,15 +768,10 @@ void UIMachineLogicFullscreen::revalidateNativeFullScreen(UIMachineWindow *pMach
                 LogRel(("UIMachineLogicFullscreen::revalidateNativeFullScreen: "
                         "Ask machine-window #%d to adjust guest geometry.\n", (int)uScreenID));
 
-                /* Make sure mini-toolbar shown: */
-                pMachineWindowFullscreen->setMiniToolbarVisible(true);
                 /* Just adjust machine-view size if necessary: */
                 pMachineWindow->adjustMachineViewSize();
                 return;
             }
-
-            /* Make sure mini-toolbar shown: */
-            pMachineWindowFullscreen->setMiniToolbarVisible(true);
         }
     }
 }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
index 2d63a95..d09560f 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
@@ -1,3 +1,4 @@
+/* $Id: UIMachineLogicFullscreen.h $ */
 /** @file
  * VBox Qt GUI - UIMachineLogicFullscreen class declaration.
  */
@@ -59,7 +60,7 @@ protected:
     bool checkAvailability();
 
     /** Returns machine-window flags for 'Fullscreen' machine-logic and passed @a uScreenId. */
-    virtual Qt::WindowFlags windowFlags(ulong uScreenId) const { Q_UNUSED(uScreenId); return Qt::FramelessWindowHint; }
+    virtual Qt::WindowFlags windowFlags(ulong uScreenId) const;
 
     /** Adjusts machine-window geometry if necessary for 'Fullscreen'. */
     virtual void adjustMachineWindowsGeometry();
@@ -96,9 +97,8 @@ private slots:
     /* Handler: Console callback stuff: */
     void sltMachineStateChanged();
 
-#ifdef RT_OS_DARWIN
-    void sltChangePresentationMode(bool fEnabled);
-#endif /* RT_OS_DARWIN */
+    /** Invokes popup-menu. */
+    void sltInvokePopupMenu();
 
     /** Updates machine-window(s) location/size on screen-layout changes. */
     void sltScreenLayoutChanged();
@@ -115,29 +115,16 @@ private:
     /* Prepare helpers: */
     void prepareActionGroups();
     void prepareActionConnections();
-#ifdef Q_WS_MAC
-    void prepareOtherConnections();
-#endif /* Q_WS_MAC */
     void prepareMachineWindows();
     void prepareMenu();
 
     /* Cleanup helpers: */
-    //void cleanupMenu() {}
+    void cleanupMenu();
     void cleanupMachineWindows();
-#ifdef Q_WS_MAC
-    //void cleanupOtherConnections() {}
-#endif /* Q_WS_MAC */
     void cleanupActionConnections();
     void cleanupActionGroups();
 
 #ifdef Q_WS_MAC
-    void setPresentationModeEnabled(bool fEnabled);
-
-    /** Mac OS X: Performs fade to black if possible. */
-    void fadeToBlack();
-    /** Mac OS X: Performs fade to normal if possible. */
-    void fadeToNormal();
-
     /** Mac OS X: Revalidates 'fullscreen' mode for @a pMachineWindow. */
     void revalidateNativeFullScreen(UIMachineWindow *pMachineWindow);
     /** Mac OS X: Revalidates 'fullscreen' mode for all windows. */
@@ -154,6 +141,9 @@ private:
     void nativeHandlerForActiveSpaceChange(const QMap<QString, QString> &userInfo);
 #endif /* Q_WS_MAC */
 
+    /** Holds the popup-menu instance. */
+    QMenu *m_pPopupMenu;
+
     /* Variables: */
     UIMultiScreenLayout *m_pScreenLayout;
 
@@ -161,9 +151,6 @@ private:
     /** Mac OS X: Holds whether screens have separate spaces. */
     const bool m_fScreensHaveSeparateSpaces;
 
-    /** Mac OS X: Fade token. */
-    CGDisplayFadeReservationToken m_fadeToken;
-
     /** Mac OS X: Contains machine-window(s) marked as 'fullscreen'. */
     QSet<UIMachineWindow*> m_fullscreenMachineWindows;
     /** Mac OS X: Contains machine-window(s) marked as 'invalid fullscreen'. */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
index 037fe10..fdafac0 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineViewFullscreen.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineViewFullscreen class implementation
+ * VBox Qt GUI - UIMachineViewFullscreen class implementation.
  */
 
 /*
@@ -17,26 +15,35 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Global includes */
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QMainWindow>
-#include <QTimer>
-#ifdef Q_WS_MAC
-#include <QMenuBar>
-#endif
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QApplication>
+# include <QDesktopWidget>
+# include <QMainWindow>
+# include <QTimer>
+# ifdef Q_WS_MAC
+#  include <QMenuBar>
+# endif /* Q_WS_MAC */
+
+/* GUI includes: */
+# include "VBoxGlobal.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogicFullscreen.h"
+# include "UIMachineWindow.h"
+# include "UIMachineViewFullscreen.h"
+# include "UIFrameBuffer.h"
+# include "UIExtraDataManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #ifdef Q_WS_X11
-#include <limits.h>
-#endif
+# include <limits.h>
+#endif /* Q_WS_X11 */
 
-/* Local includes */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogicFullscreen.h"
-#include "UIMachineWindow.h"
-#include "UIMachineViewFullscreen.h"
-#include "UIFrameBuffer.h"
 
 UIMachineViewFullscreen::UIMachineViewFullscreen(  UIMachineWindow *pMachineWindow
                                                  , ulong uScreenId
@@ -50,7 +57,7 @@ UIMachineViewFullscreen::UIMachineViewFullscreen(  UIMachineWindow *pMachineWind
                     , bAccelerate2DVideo
 #endif
                     )
-    , m_bIsGuestAutoresizeEnabled(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->isChecked())
+    , m_bIsGuestAutoresizeEnabled(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked())
 {
 }
 
@@ -137,10 +144,15 @@ void UIMachineViewFullscreen::setGuestAutoresizeEnabled(bool fEnabled)
 
 void UIMachineViewFullscreen::adjustGuestScreenSize()
 {
+    /* Acquire working-area size: */
+    const QSize workingAreaSize = workingArea().size();
+    /* Acquire frame-buffer size: */
+    QSize frameBufferSize(frameBuffer()->width(), frameBuffer()->height());
+    /* Take the scale-factor(s) into account: */
+    frameBufferSize = scaledForward(frameBufferSize);
     /* Check if we should adjust guest-screen to new size: */
     if (frameBuffer()->isAutoEnabled() ||
-        (int)frameBuffer()->width() != workingArea().size().width() ||
-        (int)frameBuffer()->height() != workingArea().size().height())
+        frameBufferSize != workingAreaSize)
         if (m_bIsGuestAutoresizeEnabled &&
             uisession()->isGuestSupportsGraphics() &&
             uisession()->isScreenVisible(screenId()))
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h
index ff12727..2040348 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineViewFullscreen.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineViewFullscreen class declaration
+ * VBox Qt GUI - UIMachineViewFullscreen class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
index c1a5630..af8f571 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineWindowFullscreen.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindowFullscreen class implementation
+ * VBox Qt GUI - UIMachineWindowFullscreen class implementation.
  */
 
 /*
@@ -17,33 +15,42 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QMenu>
-#include <QTimer>
+# include <QDesktopWidget>
+# include <QMenu>
+# include <QTimer>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogicFullscreen.h"
-#include "UIMachineWindowFullscreen.h"
-#include "UIMachineView.h"
-#include "UIFrameBuffer.h"
-#include "UIMachineDefs.h"
-#include "UIMiniToolBar.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-# include "UICocoaApplication.h"
-#endif /* Q_WS_MAC */
+# include "VBoxGlobal.h"
+# include "UIExtraDataManager.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogicFullscreen.h"
+# include "UIMachineWindowFullscreen.h"
+# include "UIMachineView.h"
+# include "UIFrameBuffer.h"
+# include "UIMachineDefs.h"
+# include "UIMiniToolBar.h"
+# ifdef Q_WS_MAC
+#  include "VBoxUtils-darwin.h"
+#  include "UICocoaApplication.h"
+# endif /* Q_WS_MAC */
 
 /* COM includes: */
-#include "CSnapshot.h"
+# include "CSnapshot.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineWindowFullscreen::UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId)
     : UIMachineWindow(pMachineLogic, uScreenId)
-    , m_pMainMenu(0)
+#ifndef Q_WS_MAC
     , m_pMiniToolBar(0)
+#endif /* !Q_WS_MAC */
 #ifdef Q_WS_MAC
     , m_fIsInFullscreenTransition(false)
 #endif /* Q_WS_MAC */
@@ -102,17 +109,9 @@ void UIMachineWindowFullscreen::handleNativeNotification(const QString &strNativ
         emit sigNotifyAboutNativeFullscreenFailToEnter();
     }
 }
-
-void UIMachineWindowFullscreen::setMiniToolbarVisible(bool fVisible)
-{
-    /* Make sure mini-toolbar exists: */
-    if (!m_pMiniToolBar)
-        return;
-    /* Set mini-toolbar visibility to passed one: */
-    m_pMiniToolBar->setVisible(fVisible);
-}
 #endif /* Q_WS_MAC */
 
+#ifndef Q_WS_MAC
 void UIMachineWindowFullscreen::sltMachineStateChanged()
 {
     /* Call to base-class: */
@@ -121,16 +120,7 @@ void UIMachineWindowFullscreen::sltMachineStateChanged()
     /* Update mini-toolbar: */
     updateAppearanceOf(UIVisualElement_MiniToolBar);
 }
-
-void UIMachineWindowFullscreen::sltPopupMainMenu()
-{
-    /* Popup main-menu if present: */
-    if (m_pMainMenu && !m_pMainMenu->isEmpty())
-    {
-        m_pMainMenu->popup(geometry().center());
-        QTimer::singleShot(0, m_pMainMenu, SLOT(sltHighlightFirstAction()));
-    }
-}
+#endif /* !Q_WS_MAC */
 
 #ifdef Q_WS_MAC
 void UIMachineWindowFullscreen::sltEnterNativeFullscreen(UIMachineWindow *pMachineWindow)
@@ -142,16 +132,13 @@ void UIMachineWindowFullscreen::sltEnterNativeFullscreen(UIMachineWindow *pMachi
     if (pMachineWindow && pMachineWindow != this)
         return;
 
-    /* Make sure this window should be shown at all: */
-    if (!uisession()->isScreenVisible(m_uScreenId))
-        return;
-
     /* Make sure this window has fullscreen logic: */
     UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
     AssertPtrReturnVoid(pFullscreenLogic);
 
-    /* Make sure this window mapped to some host-screen: */
-    if (!pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
+    /* Make sure this window should be shown and mapped to host-screen: */
+    if (!uisession()->isScreenVisible(m_uScreenId) ||
+        !pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
         return;
 
     /* Mark window 'transitioned to fullscreen': */
@@ -192,25 +179,13 @@ void UIMachineWindowFullscreen::sltRevokeFocus()
     if (!isVisible())
         return;
 
-#ifndef RT_OS_DARWIN
+#if   defined(Q_WS_WIN)
     /* Revoke stolen focus: */
     m_pMachineView->setFocus();
-#else /* RT_OS_DARWIN */
+#elif defined(Q_WS_MAC) || defined(Q_WS_X11)
     /* Revoke stolen activation: */
     activateWindow();
-#endif /* RT_OS_DARWIN */
-}
-
-void UIMachineWindowFullscreen::prepareMenu()
-{
-    /* Call to base-class: */
-    UIMachineWindow::prepareMenu();
-
-    /* Prepare menu: */
-    CMachine machine = session().GetMachine();
-    RuntimeMenuType restrictedMenus = VBoxGlobal::restrictedRuntimeMenuTypes(machine);
-    RuntimeMenuType allowedMenus = static_cast<RuntimeMenuType>(RuntimeMenuType_All ^ restrictedMenus);
-    m_pMainMenu = uisession()->newMenu(allowedMenus);
+#endif /* Q_WS_MAC || Q_WS_X11 */
 }
 
 void UIMachineWindowFullscreen::prepareVisualState()
@@ -225,8 +200,10 @@ void UIMachineWindowFullscreen::prepareVisualState()
     centralWidget()->setAutoFillBackground(true);
     setAutoFillBackground(true);
 
+#ifndef Q_WS_MAC
     /* Prepare mini-toolbar: */
     prepareMiniToolbar();
+#endif /* !Q_WS_MAC */
 
 #ifdef Q_WS_MAC
     /* Native fullscreen stuff on ML and next: */
@@ -256,47 +233,30 @@ void UIMachineWindowFullscreen::prepareVisualState()
 #endif /* Q_WS_MAC */
 }
 
+#ifndef Q_WS_MAC
 void UIMachineWindowFullscreen::prepareMiniToolbar()
 {
-    /* Get machine: */
-    CMachine m = machine();
-
-    /* Make sure mini-toolbar is necessary: */
-    bool fIsActive = m.GetExtraData(GUI_ShowMiniToolBar) != "no";
-    if (!fIsActive)
+    /* Make sure mini-toolbar is not restricted: */
+    if (!gEDataManager->miniToolbarEnabled(vboxGlobal().managedVMUuid()))
         return;
 
-    /* Get the mini-toolbar alignment: */
-    bool fIsAtTop = m.GetExtraData(GUI_MiniToolBarAlignment) == "top";
-    /* Get the mini-toolbar auto-hide feature availability: */
-    bool fIsAutoHide = m.GetExtraData(GUI_MiniToolBarAutoHide) != "off";
     /* Create mini-toolbar: */
     m_pMiniToolBar = new UIRuntimeMiniToolBar(this,
                                               GeometryType_Full,
-                                              fIsAtTop ? Qt::AlignTop : Qt::AlignBottom,
-                                              fIsAutoHide);
-    QList<QMenu*> menus;
-    RuntimeMenuType restrictedMenus = VBoxGlobal::restrictedRuntimeMenuTypes(m);
-    RuntimeMenuType allowedMenus = static_cast<RuntimeMenuType>(RuntimeMenuType_All ^ restrictedMenus);
-    QList<QAction*> actions = uisession()->newMenu(allowedMenus)->actions();
-    for (int i=0; i < actions.size(); ++i)
-        menus << actions.at(i)->menu();
-    m_pMiniToolBar->addMenus(menus);
-#ifdef RT_OS_DARWIN
-    connect(machineLogic(), SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)),
-            m_pMiniToolBar, SLOT(sltHandle3DOverlayVisibilityChange(bool)));
-#endif /* RT_OS_DARWIN */
-#ifndef RT_OS_DARWIN
+                                              gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()),
+                                              gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid()));
+    m_pMiniToolBar->addMenus(actionPool()->menus());
     connect(m_pMiniToolBar, SIGNAL(sigMinimizeAction()), this, SLOT(showMinimized()));
-#endif /* !RT_OS_DARWIN */
     connect(m_pMiniToolBar, SIGNAL(sigExitAction()),
-            gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SLOT(trigger()));
+            actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SLOT(trigger()));
     connect(m_pMiniToolBar, SIGNAL(sigCloseAction()),
-            gActionPool->action(UIActionIndexRuntime_Simple_Close), SLOT(trigger()));
+            actionPool()->action(UIActionIndex_M_Application_S_Close), SLOT(trigger()));
     connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutFocusStolen()),
             this, SLOT(sltRevokeFocus()), Qt::QueuedConnection);
 }
+#endif /* !Q_WS_MAC */
 
+#ifndef Q_WS_MAC
 void UIMachineWindowFullscreen::cleanupMiniToolbar()
 {
     /* Make sure mini-toolbar was created: */
@@ -304,11 +264,12 @@ void UIMachineWindowFullscreen::cleanupMiniToolbar()
         return;
 
     /* Save mini-toolbar settings: */
-    machine().SetExtraData(GUI_MiniToolBarAutoHide, m_pMiniToolBar->autoHide() ? QString() : "off");
+    gEDataManager->setAutoHideMiniToolbar(m_pMiniToolBar->autoHide(), vboxGlobal().managedVMUuid());
     /* Delete mini-toolbar: */
     delete m_pMiniToolBar;
     m_pMiniToolBar = 0;
 }
+#endif /* !Q_WS_MAC */
 
 void UIMachineWindowFullscreen::cleanupVisualState()
 {
@@ -325,23 +286,15 @@ void UIMachineWindowFullscreen::cleanupVisualState()
     }
 #endif /* Q_WS_MAC */
 
+#ifndef Q_WS_MAC
     /* Cleanup mini-toolbar: */
     cleanupMiniToolbar();
+#endif /* !Q_WS_MAC */
 
     /* Call to base-class: */
     UIMachineWindow::cleanupVisualState();
 }
 
-void UIMachineWindowFullscreen::cleanupMenu()
-{
-    /* Cleanup menu: */
-    delete m_pMainMenu;
-    m_pMainMenu = 0;
-
-    /* Call to base-class: */
-    UIMachineWindow::cleanupMenu();
-}
-
 void UIMachineWindowFullscreen::placeOnScreen()
 {
     /* Get corresponding screen: */
@@ -366,9 +319,14 @@ void UIMachineWindowFullscreen::placeOnScreen()
         resize(workingArea.size());
     else
     {
-        /* Load frame-buffer size first: */
-        UIFrameBuffer *pFrameBuffer = uisession()->frameBuffer(m_uScreenId);
-        QRect geo = QRect(QPoint(0, 0), QSize(pFrameBuffer->width(), pFrameBuffer->height()).boundedTo(workingArea.size()));
+        /* Load normal geometry first of all: */
+        QRect geo = gEDataManager->machineWindowGeometry(UIVisualStateType_Normal, m_uScreenId, vboxGlobal().managedVMUuid());
+        /* If normal geometry is null => use frame-buffer size: */
+        if (geo.isNull())
+        {
+            const UIFrameBuffer *pFrameBuffer = uisession()->frameBuffer(m_uScreenId);
+            geo = QRect(QPoint(0, 0), QSize(pFrameBuffer->width(), pFrameBuffer->height()).boundedTo(workingArea.size()));
+        }
         /* If frame-buffer size is null => use default size: */
         if (geo.isNull())
             geo = QRect(QPoint(0, 0), QSize(800, 600).boundedTo(workingArea.size()));
@@ -397,13 +355,14 @@ void UIMachineWindowFullscreen::showInNecessaryMode()
     if (!uisession()->isScreenVisible(m_uScreenId) ||
         !pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId))
     {
-        /* Hide mini-toolbar: */
-        if (   m_pMiniToolBar
-#ifdef Q_WS_MAC
-            && !fSupportsNativeFullScreen
-#endif /* Q_WS_MAC */
-            )
+#ifndef Q_WS_MAC
+        /* If there is mini-toolbar: */
+        if (m_pMiniToolBar)
+        {
+            /* Just hide mini-toolbar: */
             m_pMiniToolBar->hide();
+        }
+#endif /* !Q_WS_MAC */
         /* Hide window: */
         hide();
         return;
@@ -418,7 +377,7 @@ void UIMachineWindowFullscreen::showInNecessaryMode()
      * which we do not test, so this is 'best effort' code. With window managers which
      * support the _NET_WM_FULLSCREEN_MONITORS protocol this would interfere unreliable. */
     const bool fSupportsNativeFullScreen = VBoxGlobal::supportsFullScreenMonitorsProtocolX11() &&
-                                           !VBoxGlobal::legacyFullscreenModeRequested(vboxGlobal().virtualBox());
+                                           !gEDataManager->legacyFullscreenModeRequested();
     if (!fSupportsNativeFullScreen)
         placeOnScreen();
 #else /* !Q_WS_X11 */
@@ -458,13 +417,30 @@ void UIMachineWindowFullscreen::showInNecessaryMode()
     /* Adjust machine-view size if necessary: */
     adjustMachineViewSize();
 
-    /* Show mini-toolbar: */
-    if (   m_pMiniToolBar
-#ifdef Q_WS_MAC
-        && !fSupportsNativeFullScreen
-#endif /* Q_WS_MAC */
-        )
+#ifndef Q_WS_MAC
+    /* If there is mini-toolbar: */
+    if (m_pMiniToolBar)
+    {
+# if   defined(Q_WS_WIN)
+        /* Just show mini-toolbar: */
         m_pMiniToolBar->show();
+# elif defined(Q_WS_X11)
+        /* Allow mini-toolbar to be located on full-screen area: */
+        m_pMiniToolBar->showFullScreen();
+        /* On modern window managers: */
+        if (fSupportsNativeFullScreen)
+        {
+            /* We also can map mini-toolbar directly on corresponding machine-window: */
+            VBoxGlobal::setFullScreenMonitorX11(m_pMiniToolBar, pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId));
+        }
+        /* Make sure mini-toolbar is always on top of machine-window: */
+        VBoxGlobal::setTransientFor(m_pMiniToolBar, this);
+# endif /* Q_WS_X11 */
+    }
+#endif /* !Q_WS_MAC */
+
+    /* Make sure machine-view have focus: */
+    m_pMachineView->setFocus();
 }
 
 void UIMachineWindowFullscreen::adjustMachineViewSize()
@@ -472,21 +448,32 @@ void UIMachineWindowFullscreen::adjustMachineViewSize()
     /* Call to base-class: */
     UIMachineWindow::adjustMachineViewSize();
 
+#ifndef Q_WS_MAC
     /* If mini-toolbar present: */
     if (m_pMiniToolBar)
     {
         /* Make sure this window has fullscreen logic: */
-        UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
+        const UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic());
         AssertPtrReturnVoid(pFullscreenLogic);
 
         /* Which host-screen should that machine-window located on? */
         const int iHostScreen = pFullscreenLogic->hostScreenForGuestScreen(m_uScreenId);
 
+#ifndef Q_WS_X11
         /* Move mini-toolbar into appropriate place: */
         m_pMiniToolBar->adjustGeometry(iHostScreen);
+#else /* Q_WS_X11 */
+        /* On modern WMs we are mapping mini-toolbar to corresponding host-screen directly. */
+        const bool fSupportsNativeFullScreen = VBoxGlobal::supportsFullScreenMonitorsProtocolX11() &&
+                                               !gEDataManager->legacyFullscreenModeRequested();
+        /* Adjust mini-toolbar and move into appropriate place if necessary: */
+        m_pMiniToolBar->adjustGeometry(fSupportsNativeFullScreen ? -1 : iHostScreen);
+#endif /* Q_WS_X11 */
     }
+#endif /* !Q_WS_MAC */
 }
 
+#ifndef Q_WS_MAC
 void UIMachineWindowFullscreen::updateAppearanceOf(int iElement)
 {
     /* Call to base-class: */
@@ -497,18 +484,17 @@ void UIMachineWindowFullscreen::updateAppearanceOf(int iElement)
     {
         if (m_pMiniToolBar)
         {
-            /* Get machine: */
-            const CMachine &m = machine();
             /* Get snapshot(s): */
             QString strSnapshotName;
-            if (m.GetSnapshotCount() > 0)
+            if (machine().GetSnapshotCount() > 0)
             {
-                CSnapshot snapshot = m.GetCurrentSnapshot();
+                CSnapshot snapshot = machine().GetCurrentSnapshot();
                 strSnapshotName = " (" + snapshot.GetName() + ")";
             }
             /* Update mini-toolbar text: */
-            m_pMiniToolBar->setText(m.GetName() + strSnapshotName);
+            m_pMiniToolBar->setText(machineName() + strSnapshotName);
         }
     }
 }
+#endif /* !Q_WS_MAC */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
index 87e7336..b046e0f 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineWindowFullscreen.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindowFullscreen class declaration
+ * VBox Qt GUI - UIMachineWindowFullscreen class declaration.
  */
 
 /*
@@ -22,8 +21,10 @@
 /* Local includes: */
 #include "UIMachineWindow.h"
 
+#ifndef Q_WS_MAC
 /* Forward declarations: */
 class UIRuntimeMiniToolBar;
+#endif /* !Q_WS_MAC */
 
 /* Fullscreen machine-window implementation: */
 class UIMachineWindowFullscreen : public UIMachineWindow
@@ -54,17 +55,14 @@ protected:
     void handleNativeNotification(const QString &strNativeNotificationName);
     /** Mac OS X: Returns whether window is in 'fullscreen' transition. */
     bool isInFullscreenTransition() const { return m_fIsInFullscreenTransition; }
-    /** Mac OS X: Defines whether mini-toolbar should be @a fVisible. */
-    void setMiniToolbarVisible(bool fVisible);
 #endif /* Q_WS_MAC */
 
 private slots:
 
+#ifndef Q_WS_MAC
     /* Session event-handlers: */
     void sltMachineStateChanged();
-
-    /* Popup main-menu: */
-    void sltPopupMainMenu();
+#endif /* !Q_WS_MAC */
 
 #ifdef RT_OS_DARWIN
     /** Mac OS X: Commands @a pMachineWindow to enter native 'fullscreen' mode if possible. */
@@ -79,14 +77,16 @@ private slots:
 private:
 
     /* Prepare helpers: */
-    void prepareMenu();
     void prepareVisualState();
+#ifndef Q_WS_MAC
     void prepareMiniToolbar();
+#endif /* !Q_WS_MAC */
 
     /* Cleanup helpers: */
+#ifndef Q_WS_MAC
     void cleanupMiniToolbar();
+#endif /* !Q_WS_MAC */
     void cleanupVisualState();
-    void cleanupMenu();
 
     /* Show stuff: */
     void placeOnScreen();
@@ -95,12 +95,15 @@ private:
     /** Adjusts machine-view size to correspond current machine-window size. */
     virtual void adjustMachineViewSize();
 
-    /* Update stuff: */
+#ifndef Q_WS_MAC
+    /* Update routines: */
     void updateAppearanceOf(int iElement);
+#endif /* !Q_WS_MAC */
 
-    /* Widgets: */
-    QMenu *m_pMainMenu;
+#ifndef Q_WS_MAC
+    /** Holds the mini-toolbar instance. */
     UIRuntimeMiniToolBar *m_pMiniToolBar;
+#endif /* !Q_WS_MAC */
 
 #ifdef Q_WS_MAC
     /** Mac OS X: Reflects whether window is in 'fullscreen' transition. */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIKeyboardHandlerNormal.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIKeyboardHandlerNormal.cpp
index cfc54a1..94ba448 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIKeyboardHandlerNormal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIKeyboardHandlerNormal.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIKeyboardHandlerNormal.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandlerNormal class implementation
+ * VBox Qt GUI - UIKeyboardHandlerNormal class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,28 +15,44 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Global includes */
-#include <QMainWindow>
-#include <QMenuBar>
-#include <QKeyEvent>
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# ifndef Q_WS_MAC
+#  include <QMainWindow>
+#  include <QMenuBar>
+#  include <QKeyEvent>
+#  include <QTimer>
+# endif /* !Q_WS_MAC */
+
+/* GUI includes: */
+# include "UIKeyboardHandlerNormal.h"
+# ifndef Q_WS_MAC
+#  include "UIMachineLogic.h"
+#  include "UIMachineWindow.h"
+#  include "UIShortcutPool.h"
+# endif /* !Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-/* Local includes */
-#include "UIKeyboardHandlerNormal.h"
-#include "UIMachineWindow.h"
-#include "UIShortcutPool.h"
 
-/* Fullscreen keyboard-handler constructor: */
+/* Namespaces: */
+#ifndef Q_WS_MAC
+using namespace UIExtraDataDefs;
+#endif /* !Q_WS_MAC */
+
 UIKeyboardHandlerNormal::UIKeyboardHandlerNormal(UIMachineLogic* pMachineLogic)
     : UIKeyboardHandler(pMachineLogic)
 {
 }
 
-/* Fullscreen keyboard-handler destructor: */
 UIKeyboardHandlerNormal::~UIKeyboardHandlerNormal()
 {
 }
 
-/* Event handler for prepared listener(s): */
+#ifndef Q_WS_MAC
 bool UIKeyboardHandlerNormal::eventFilter(QObject *pWatchedObject, QEvent *pEvent)
 {
     /* Check if pWatchedObject object is view: */
@@ -50,7 +64,6 @@ bool UIKeyboardHandlerNormal::eventFilter(QObject *pWatchedObject, QEvent *pEven
         /* Handle view events: */
         switch (pEvent->type())
         {
-#ifndef Q_WS_MAC
             /* We don't want this on the Mac, cause there the menu-bar isn't within the
              * window and popping up a menu there looks really ugly. */
             case QEvent::KeyPress:
@@ -65,28 +78,36 @@ bool UIKeyboardHandlerNormal::eventFilter(QObject *pWatchedObject, QEvent *pEven
                     /* If menu-bar is present and have actions: */
                     if (pMenuBar && !pMenuBar->actions().isEmpty())
                     {
-                        /* If 'active' action is NOT chosen: */
-                        if (!pMenuBar->activeAction())
-                            /* Set first menu-bar action as 'active': */
-                            pMenuBar->setActiveAction(pMenuBar->actions()[0]);
-                        /* If 'active' action is chosen: */
-                        if (pMenuBar->activeAction())
+                        /* Is menu-bar visible? */
+                        if (pMenuBar->isVisible())
                         {
-                            /* Activate 'active' menu-bar action: */
-                            pMenuBar->activeAction()->activate(QAction::Trigger);
+                            /* If 'active' action is NOT chosen: */
+                            if (!pMenuBar->activeAction())
+                                /* Set first menu-bar action as 'active': */
+                                pMenuBar->setActiveAction(pMenuBar->actions()[0]);
+                            /* If 'active' action is chosen: */
+                            if (pMenuBar->activeAction())
+                            {
+                                /* Activate 'active' menu-bar action: */
+                                pMenuBar->activeAction()->activate(QAction::Trigger);
 #ifdef Q_WS_WIN
-                            /* Windows host needs separate 'focus set'
-                             * to let menubar operate while popped up: */
-                            pMenuBar->setFocus();
+                                /* Windows host needs separate 'focus set'
+                                 * to let menubar operate while popped up: */
+                                pMenuBar->setFocus();
 #endif /* Q_WS_WIN */
-                            /* Filter-out this event: */
-                            return true;
+                            }
+                        }
+                        else
+                        {
+                            /* Post request to show popup-menu: */
+                            QTimer::singleShot(0, m_pMachineLogic, SLOT(sltInvokePopupMenu()));
                         }
+                        /* Filter-out this event: */
+                        return true;
                     }
                 }
                 break;
             }
-#endif /* !Q_WS_MAC */
             default:
                 break;
         }
@@ -95,4 +116,5 @@ bool UIKeyboardHandlerNormal::eventFilter(QObject *pWatchedObject, QEvent *pEven
     /* Else just propagate to base-class: */
     return UIKeyboardHandler::eventFilter(pWatchedObject, pEvent);
 }
+#endif /* !Q_WS_MAC */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIKeyboardHandlerNormal.h b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIKeyboardHandlerNormal.h
index 5d238e6..b97c750 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIKeyboardHandlerNormal.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIKeyboardHandlerNormal.h
@@ -1,11 +1,10 @@
+/* $Id: UIKeyboardHandlerNormal.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandlerNormal class declaration
+ * VBox Qt GUI - UIKeyboardHandlerNormal class declaration.
  */
 
 /*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,27 +18,31 @@
 #ifndef ___UIKeyboardHandlerNormal_h___
 #define ___UIKeyboardHandlerNormal_h___
 
-/* Local includes */
+/* GUI includes: */
 #include "UIKeyboardHandler.h"
 
+/** UIKeyboardHandler reimplementation
+  * providing machine-logic with PopupMenu keyboard handler. */
 class UIKeyboardHandlerNormal : public UIKeyboardHandler
 {
     Q_OBJECT;
 
 protected:
 
-    /* Fullscreen keyboard-handler constructor/destructor: */
+    /** Normal keyboard-handler constructor. */
     UIKeyboardHandlerNormal(UIMachineLogic *pMachineLogic);
+    /** Normal keyboard-handler destructor. */
     virtual ~UIKeyboardHandlerNormal();
 
 private:
 
-    /* Event handlers: */
+#ifndef Q_WS_MAC
+    /** General event-filter. */
     bool eventFilter(QObject *pWatched, QEvent *pEvent);
+#endif /* !Q_WS_MAC */
 
-    /* Friend classes: */
+    /* Friend class: */
     friend class UIKeyboardHandler;
 };
 
-#endif // !___UIKeyboardHandlerNormal_h___
-
+#endif /* !___UIKeyboardHandlerNormal_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
index 416cf73..da44278 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp
@@ -15,22 +15,44 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QMenu>
+# ifndef Q_WS_MAC
+#  include <QTimer>
+# endif /* !Q_WS_MAC */
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogicNormal.h"
-#include "UIMachineWindow.h"
-#ifdef Q_WS_MAC
-#include "VBoxUtils.h"
-#endif /* Q_WS_MAC */
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogicNormal.h"
+# include "UIMachineWindow.h"
+# include "UIMenuBarEditorWindow.h"
+# include "UIStatusBarEditorWindow.h"
+# include "UIExtraDataManager.h"
+# include "UIFrameBuffer.h"
+# ifndef Q_WS_MAC
+#  include "QIMenu.h"
+# else  /* Q_WS_MAC */
+#  include "VBoxUtils.h"
+# endif /* Q_WS_MAC */
+
+/* COM includes: */
+# include "CConsole.h"
+# include "CDisplay.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineLogicNormal::UIMachineLogicNormal(QObject *pParent, UISession *pSession)
     : UIMachineLogic(pParent, pSession, UIVisualStateType_Normal)
+#ifndef Q_WS_MAC
+    , m_pPopupMenu(0)
+#endif /* !Q_WS_MAC */
 {
 }
 
@@ -42,7 +64,7 @@ bool UIMachineLogicNormal::checkAvailability()
 
 void UIMachineLogicNormal::sltCheckForRequestedVisualStateType()
 {
-    LogRel(("UIMachineLogicNormal::sltCheckForRequestedVisualStateType: Requested-state=%d, Machine-state=%d\n",
+    LogRel(("GUI: UIMachineLogicNormal::sltCheckForRequestedVisualStateType: Requested-state=%d, Machine-state=%d\n",
             uisession()->requestedVisualState(), uisession()->machineState()));
 
     /* Do not try to change visual-state type if machine was not started yet: */
@@ -62,13 +84,13 @@ void UIMachineLogicNormal::sltCheckForRequestedVisualStateType()
             /* And supported: */
             if (uisession()->isGuestSupportsSeamless())
             {
-                LogRel(("UIMachineLogicNormal::sltCheckForRequestedVisualStateType: "
+                LogRel(("GUI: UIMachineLogicNormal::sltCheckForRequestedVisualStateType: "
                         "Going 'seamless' as requested...\n"));
                 uisession()->setRequestedVisualState(UIVisualStateType_Invalid);
                 uisession()->changeVisualState(UIVisualStateType_Seamless);
             }
             else
-                LogRel(("UIMachineLogicNormal::sltCheckForRequestedVisualStateType: "
+                LogRel(("GUI: UIMachineLogicNormal::sltCheckForRequestedVisualStateType: "
                         "Rejecting 'seamless' as is it not yet supported...\n"));
             break;
         }
@@ -77,29 +99,151 @@ void UIMachineLogicNormal::sltCheckForRequestedVisualStateType()
     }
 }
 
-void UIMachineLogicNormal::sltPrepareSharedFoldersMenu()
+#ifndef RT_OS_DARWIN
+void UIMachineLogicNormal::sltInvokePopupMenu()
+{
+    /* Popup main-menu if present: */
+    if (m_pPopupMenu && !m_pPopupMenu->isEmpty())
+    {
+        m_pPopupMenu->popup(activeMachineWindow()->geometry().center());
+        QTimer::singleShot(0, m_pPopupMenu, SLOT(sltHighlightFirstAction()));
+    }
+}
+#endif /* RT_OS_DARWIN */
+
+void UIMachineLogicNormal::sltOpenMenuBarSettings()
+{
+    /* Do not process if window(s) missed! */
+    AssertReturnVoid(isMachineWindowsCreated());
+
+#ifndef Q_WS_MAC
+    /* Make sure menu-bar is enabled: */
+    const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->isChecked();
+    AssertReturnVoid(fEnabled);
+#endif /* !Q_WS_MAC */
+
+    /* Prevent user from opening another one editor or toggle menu-bar: */
+    actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)->setEnabled(false);
+#ifndef Q_WS_MAC
+    actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->setEnabled(false);
+#endif /* !Q_WS_MAC */
+    /* Create menu-bar editor: */
+    UIMenuBarEditorWindow *pMenuBarEditor = new UIMenuBarEditorWindow(activeMachineWindow(), actionPool());
+    AssertPtrReturnVoid(pMenuBarEditor);
+    {
+        /* Configure menu-bar editor: */
+        connect(pMenuBarEditor, SIGNAL(destroyed(QObject*)),
+                this, SLOT(sltMenuBarSettingsClosed()));
+#ifdef Q_WS_MAC
+        connect(this, SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)),
+                pMenuBarEditor, SLOT(sltActivateWindow()));
+#endif /* Q_WS_MAC */
+        /* Show window: */
+        pMenuBarEditor->show();
+    }
+}
+
+void UIMachineLogicNormal::sltMenuBarSettingsClosed()
 {
-    QMenu *menu = qobject_cast<QMenu*>(sender());
-    AssertMsg(menu, ("This slot should be called only on Shared Folders menu show!\n"));
-    menu->clear();
-    menu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersSettings));
+#ifndef Q_WS_MAC
+    /* Make sure menu-bar is enabled: */
+    const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->isChecked();
+    AssertReturnVoid(fEnabled);
+#endif /* !Q_WS_MAC */
+
+    /* Allow user to open editor and toggle menu-bar again: */
+    actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings)->setEnabled(true);
+#ifndef Q_WS_MAC
+    actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->setEnabled(true);
+#endif /* !Q_WS_MAC */
 }
 
-void UIMachineLogicNormal::sltPrepareVideoCaptureMenu()
+#ifndef RT_OS_DARWIN
+void UIMachineLogicNormal::sltToggleMenuBar()
 {
-    QMenu *pMenu = qobject_cast<QMenu*>(sender());
-    AssertMsg(pMenu, ("This slot should be called only on Video Capture menu show!\n"));
-    pMenu->clear();
-    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureSettings));
-    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
+    /* Do not process if window(s) missed! */
+    AssertReturnVoid(isMachineWindowsCreated());
+
+    /* Invert menu-bar availability option: */
+    const bool fEnabled = gEDataManager->menuBarEnabled(vboxGlobal().managedVMUuid());
+    gEDataManager->setMenuBarEnabled(!fEnabled, vboxGlobal().managedVMUuid());
 }
+#endif /* !RT_OS_DARWIN */
 
-void UIMachineLogicNormal::sltPrepareMouseIntegrationMenu()
+void UIMachineLogicNormal::sltOpenStatusBarSettings()
 {
-    QMenu *menu = qobject_cast<QMenu*>(sender());
-    AssertMsg(menu, ("This slot should be called only on Mouse Integration Menu show!\n"));
-    menu->clear();
-    menu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration));
+    /* Do not process if window(s) missed! */
+    AssertReturnVoid(isMachineWindowsCreated());
+
+    /* Make sure status-bar is enabled: */
+    const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->isChecked();
+    AssertReturnVoid(fEnabled);
+
+    /* Prevent user from opening another one editor or toggle status-bar: */
+    actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)->setEnabled(false);
+    actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->setEnabled(false);
+    /* Create status-bar editor: */
+    UIStatusBarEditorWindow *pStatusBarEditor = new UIStatusBarEditorWindow(activeMachineWindow());
+    AssertPtrReturnVoid(pStatusBarEditor);
+    {
+        /* Configure status-bar editor: */
+        connect(pStatusBarEditor, SIGNAL(destroyed(QObject*)),
+                this, SLOT(sltStatusBarSettingsClosed()));
+#ifdef Q_WS_MAC
+        connect(this, SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)),
+                pStatusBarEditor, SLOT(sltActivateWindow()));
+#endif /* Q_WS_MAC */
+        /* Show window: */
+        pStatusBarEditor->show();
+    }
+}
+
+void UIMachineLogicNormal::sltStatusBarSettingsClosed()
+{
+    /* Make sure status-bar is enabled: */
+    const bool fEnabled = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->isChecked();
+    AssertReturnVoid(fEnabled);
+
+    /* Allow user to open editor and toggle status-bar again: */
+    actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings)->setEnabled(true);
+    actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->setEnabled(true);
+}
+
+void UIMachineLogicNormal::sltToggleStatusBar()
+{
+    /* Do not process if window(s) missed! */
+    AssertReturnVoid(isMachineWindowsCreated());
+
+    /* Invert status-bar availability option: */
+    const bool fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid());
+    gEDataManager->setStatusBarEnabled(!fEnabled, vboxGlobal().managedVMUuid());
+}
+
+void UIMachineLogicNormal::sltHandleActionTriggerViewScreenToggle(int iIndex, bool fEnabled)
+{
+    /* Enable/disable guest keeping current size: */
+    ULONG uWidth, uHeight, uBitsPerPixel;
+    LONG uOriginX, uOriginY;
+    KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
+    display().GetScreenResolution(iIndex, uWidth, uHeight, uBitsPerPixel, uOriginX, uOriginY, monitorStatus);
+    if (!fEnabled)
+        display().SetVideoModeHint(iIndex, false, false, 0, 0, 0, 0, 0);
+    else
+    {
+        /* Defaults: */
+        if (!uWidth)
+            uWidth = 800;
+        if (!uHeight)
+            uHeight = 600;
+        display().SetVideoModeHint(iIndex, true, false, 0, 0, uWidth, uHeight, 32);
+    }
+}
+
+void UIMachineLogicNormal::sltHandleActionTriggerViewScreenResize(int iIndex, const QSize &size)
+{
+    /* Resize guest to required size: */
+    display().SetVideoModeHint(iIndex, uisession()->isScreenVisible(iIndex),
+                             false, 0, 0, size.width(), size.height(), 0);
 }
 
 void UIMachineLogicNormal::prepareActionConnections()
@@ -107,21 +251,27 @@ void UIMachineLogicNormal::prepareActionConnections()
     /* Call to base-class: */
     UIMachineLogic::prepareActionConnections();
 
-    /* "View" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
+    /* Prepare 'View' actions connections: */
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToFullscreen()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToSeamless()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToScale()));
-
-    /* "Device" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_SharedFolders)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareSharedFoldersMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareVideoCaptureMenu()));
-    connect(gActionPool->action(UIActionIndexRuntime_Menu_MouseIntegration)->menu(), SIGNAL(aboutToShow()),
-            this, SLOT(sltPrepareMouseIntegrationMenu()));
+    connect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings), SIGNAL(triggered(bool)),
+            this, SLOT(sltOpenMenuBarSettings()));
+#ifndef Q_WS_MAC
+    connect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility), SIGNAL(triggered(bool)),
+            this, SLOT(sltToggleMenuBar()));
+#endif /* !Q_WS_MAC */
+    connect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings), SIGNAL(triggered(bool)),
+            this, SLOT(sltOpenStatusBarSettings()));
+    connect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility), SIGNAL(triggered(bool)),
+            this, SLOT(sltToggleStatusBar()));
+    connect(actionPool(), SIGNAL(sigNotifyAboutTriggeringViewScreenToggle(int, bool)),
+            this, SLOT(sltHandleActionTriggerViewScreenToggle(int, bool)));
+    connect(actionPool(), SIGNAL(sigNotifyAboutTriggeringViewScreenResize(int, const QSize&)),
+            this, SLOT(sltHandleActionTriggerViewScreenResize(int, const QSize&)));
 }
 
 void UIMachineLogicNormal::prepareMachineWindows()
@@ -137,7 +287,7 @@ void UIMachineLogicNormal::prepareMachineWindows()
 #endif /* Q_WS_MAC */
 
     /* Get monitors count: */
-    ulong uMonitorCount = session().GetMachine().GetMonitorCount();
+    ulong uMonitorCount = machine().GetMonitorCount();
     /* Create machine window(s): */
     for (ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)
         addMachineWindow(UIMachineWindow::create(this, uScreenId));
@@ -145,10 +295,39 @@ void UIMachineLogicNormal::prepareMachineWindows()
     for (ulong uScreenId = uMonitorCount; uScreenId > 0; -- uScreenId)
         machineWindows()[uScreenId - 1]->raise();
 
+    /* Listen for frame-buffer resize: */
+    foreach (UIMachineWindow *pMachineWindow, machineWindows())
+        connect(pMachineWindow, SIGNAL(sigFrameBufferResize()),
+                this, SIGNAL(sigFrameBufferResize()));
+    emit sigFrameBufferResize();
+
     /* Mark machine-window(s) created: */
     setMachineWindowsCreated(true);
 }
 
+#ifndef Q_WS_MAC
+void UIMachineLogicNormal::prepareMenu()
+{
+    /* Prepare popup-menu: */
+    m_pPopupMenu = new QIMenu;
+    AssertPtrReturnVoid(m_pPopupMenu);
+    {
+        /* Prepare popup-menu: */
+        foreach (QMenu *pMenu, actionPool()->menus())
+            m_pPopupMenu->addMenu(pMenu);
+    }
+}
+#endif /* !Q_WS_MAC */
+
+#ifndef Q_WS_MAC
+void UIMachineLogicNormal::cleanupMenu()
+{
+    /* Cleanup popup-menu: */
+    delete m_pPopupMenu;
+    m_pPopupMenu = 0;
+}
+#endif /* !Q_WS_MAC */
+
 void UIMachineLogicNormal::cleanupMachineWindows()
 {
     /* Do not destroy machine-window(s) if they destroyed already: */
@@ -166,12 +345,22 @@ void UIMachineLogicNormal::cleanupMachineWindows()
 void UIMachineLogicNormal::cleanupActionConnections()
 {
     /* "View" actions disconnections: */
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToFullscreen()));
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToSeamless()));
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToScale()));
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings), SIGNAL(triggered(bool)),
+               this, SLOT(sltOpenMenuBarSettings()));
+#ifndef Q_WS_MAC
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility), SIGNAL(triggered(bool)),
+               this, SLOT(sltToggleMenuBar()));
+#endif /* !Q_WS_MAC */
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings), SIGNAL(triggered(bool)),
+               this, SLOT(sltOpenStatusBarSettings()));
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility), SIGNAL(triggered(bool)),
+               this, SLOT(sltToggleStatusBar()));
 
     /* Call to base-class: */
     UIMachineLogic::cleanupActionConnections();
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
index 6f356c7..850b83a 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
@@ -1,3 +1,4 @@
+/* $Id: UIMachineLogicNormal.h $ */
 /** @file
  * VBox Qt GUI - UIMachineLogicNormal class declaration.
  */
@@ -41,21 +42,53 @@ private slots:
     /** Checks if some visual-state type was requested. */
     void sltCheckForRequestedVisualStateType();
 
-    /* Windowed mode functionality: */
-    void sltPrepareSharedFoldersMenu();
-    void sltPrepareVideoCaptureMenu();
-    void sltPrepareMouseIntegrationMenu();
+#ifndef RT_OS_DARWIN
+    /** Invokes popup-menu. */
+    void sltInvokePopupMenu();
+#endif /* RT_OS_DARWIN */
+
+    /** Opens menu-bar editor.*/
+    void sltOpenMenuBarSettings();
+    /** Handles menu-bar editor closing.*/
+    void sltMenuBarSettingsClosed();
+#ifndef RT_OS_DARWIN
+    /** Toggles menu-bar presence.*/
+    void sltToggleMenuBar();
+#endif /* !RT_OS_DARWIN */
+
+    /** Opens status-bar editor.*/
+    void sltOpenStatusBarSettings();
+    /** Handles status-bar editor closing.*/
+    void sltStatusBarSettingsClosed();
+    /** Toggles status-bar presence.*/
+    void sltToggleStatusBar();
+
+    /** Handles guest-screen toggle requests. */
+    void sltHandleActionTriggerViewScreenToggle(int iIndex, bool fEnabled);
+    /** Handles guest-screen resize requests. */
+    void sltHandleActionTriggerViewScreenResize(int iIndex, const QSize &size);
 
 private:
 
     /* Prepare helpers: */
     void prepareActionConnections();
     void prepareMachineWindows();
+#ifndef Q_WS_MAC
+    void prepareMenu();
+#endif /* !Q_WS_MAC */
 
     /* Cleanup helpers: */
+#ifndef Q_WS_MAC
+    void cleanupMenu();
+#endif /* !Q_WS_MAC */
     void cleanupMachineWindows();
     void cleanupActionConnections();
 
+#ifndef Q_WS_MAC
+    /** Holds the popup-menu instance. */
+    QMenu *m_pPopupMenu;
+#endif /* !Q_WS_MAC */
+
     /* Friend classes: */
     friend class UIMachineLogic;
 };
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
index e64e864..276a786 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineViewNormal.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineViewNormal class implementation
+ * VBox Qt GUI - UIMachineViewNormal class implementation.
  */
 
 /*
@@ -17,22 +15,30 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Global includes */
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QMainWindow>
-#include <QMenuBar>
-#include <QScrollBar>
-#include <QTimer>
-
-/* Local includes */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogic.h"
-#include "UIMachineWindow.h"
-#include "UIMachineViewNormal.h"
-#include "UIFrameBuffer.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QApplication>
+# include <QDesktopWidget>
+# include <QMainWindow>
+# include <QMenuBar>
+# include <QScrollBar>
+# include <QTimer>
+
+/* GUI includes: */
+# include "VBoxGlobal.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindow.h"
+# include "UIMachineViewNormal.h"
+# include "UIExtraDataManager.h"
+# include "UIFrameBuffer.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineViewNormal::UIMachineViewNormal(  UIMachineWindow *pMachineWindow
                                          , ulong uScreenId
@@ -46,7 +52,7 @@ UIMachineViewNormal::UIMachineViewNormal(  UIMachineWindow *pMachineWindow
                     , bAccelerate2DVideo
 #endif
                     )
-    , m_bIsGuestAutoresizeEnabled(gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->isChecked())
+    , m_bIsGuestAutoresizeEnabled(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked())
 {
     /* Resend the last resize hint if necessary: */
     maybeResendSizeHint();
@@ -86,26 +92,6 @@ bool UIMachineViewNormal::eventFilter(QObject *pWatched, QEvent *pEvent)
         }
     }
 
-#ifdef Q_WS_WIN
-    else if (pWatched != 0 && pWatched == machineWindow()->menuBar())
-    {
-        /* Due to windows host uses separate 'focus set' to let menubar to
-         * operate while popped up (see UIMachineViewNormal::event() for details),
-         * it also requires backward processing: */
-        switch (pEvent->type())
-        {
-            /* If menubar gets the focus while not popped up => give it back: */
-            case QEvent::FocusIn:
-            {
-                if (!QApplication::activePopupWidget())
-                    setFocus();
-            }
-            default:
-                break;
-        }
-    }
-#endif /* Q_WS_WIN */
-
     return UIMachineView::eventFilter(pWatched, pEvent);
 }
 
@@ -162,14 +148,8 @@ void UIMachineViewNormal::maybeResendSizeHint()
 {
     if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
     {
-        /* Get the current machine: */
-        CMachine machine = session().GetMachine();
-
-        /* We send a guest size hint if needed to reverse a transition
-         * to fullscreen or seamless. */
-        QString strKey = makeExtraDataKeyPerMonitor(GUI_LastGuestSizeHintWasFullscreen);
-        QString strHintSent = machine.GetExtraData(strKey);
-        if (!strHintSent.isEmpty())
+        /* Send guest-screen size-hint if needed to reverse a transition to fullscreen or seamless: */
+        if (gEDataManager->wasLastGuestSizeHintForFullScreen(m_uScreenId, vboxGlobal().managedVMUuid()))
         {
             const QSize sizeHint = guestSizeHint();
             LogRel(("UIMachineViewNormal::maybeResendSizeHint: "
@@ -187,10 +167,14 @@ void UIMachineViewNormal::maybeResendSizeHint()
 
 void UIMachineViewNormal::adjustGuestScreenSize()
 {
-    /* Check if we should adjust guest-screen to new size: */
+    /* Acquire central-widget size: */
     const QSize centralWidgetSize = machineWindow()->centralWidget()->size();
-    if ((int)frameBuffer()->width() != centralWidgetSize.width() ||
-        (int)frameBuffer()->height() != centralWidgetSize.height())
+    /* Acquire frame-buffer size: */
+    QSize frameBufferSize(frameBuffer()->width(), frameBuffer()->height());
+    /* Take the scale-factor(s) into account: */
+    frameBufferSize = scaledForward(frameBufferSize);
+    /* Check if we should adjust guest-screen to new size: */
+    if (frameBufferSize != centralWidgetSize)
         if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
             sltPerformGuestResize(centralWidgetSize);
 }
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h
index aa2ab61..d06a937 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineViewNormal.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineViewNormal class declaration
+ * VBox Qt GUI - UIMachineViewNormal class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
index 8ba24cc..09213b9 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineWindowNormal.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindowNormal class implementation
+ * VBox Qt GUI - UIMachineWindowNormal class implementation.
  */
 
 /*
@@ -17,42 +15,50 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QMenuBar>
-#include <QTimer>
-#include <QContextMenuEvent>
-#include <QResizeEvent>
+# include <QDesktopWidget>
+# include <QMenuBar>
+# include <QTimer>
+# include <QContextMenuEvent>
+# include <QResizeEvent>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIIndicatorsPool.h"
-#include "UIKeyboardHandler.h"
-#include "UIMouseHandler.h"
-#include "UIMachineLogic.h"
-#include "UIMachineWindowNormal.h"
-#include "UIMachineView.h"
-#include "QIStatusBar.h"
-#include "QIStateIndicator.h"
-#include "UIHostComboEditor.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-# include "UIImageTools.h"
-#endif /* Q_WS_MAC */
+# include "VBoxGlobal.h"
+# include "UIMachineWindowNormal.h"
+# include "UIActionPoolRuntime.h"
+# include "UIExtraDataManager.h"
+# include "UIIndicatorsPool.h"
+# include "UIKeyboardHandler.h"
+# include "UIMouseHandler.h"
+# include "UIMachineLogic.h"
+# include "UIMachineView.h"
+# include "UIIconPool.h"
+# include "UISession.h"
+# include "QIStatusBar.h"
+# include "QIStatusBarIndicator.h"
+# ifndef Q_WS_MAC
+#  include "UIMenuBar.h"
+# else  /* Q_WS_MAC */
+#  include "VBoxUtils.h"
+#  include "UIImageTools.h"
+# endif /* Q_WS_MAC */
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CMediumAttachment.h"
-#include "CUSBController.h"
-#include "CUSBDeviceFilters.h"
+# include "CConsole.h"
+# include "CMediumAttachment.h"
+# include "CUSBController.h"
+# include "CUSBDeviceFilters.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineWindowNormal::UIMachineWindowNormal(UIMachineLogic *pMachineLogic, ulong uScreenId)
     : UIMachineWindow(pMachineLogic, uScreenId)
-    , m_pIndicatorsPool(new UIIndicatorsPool(pMachineLogic->uisession()->session(), this))
-    , m_pNameHostkey(0)
-    , m_pIdleTimer(0)
+    , m_pIndicatorsPool(0)
 {
 }
 
@@ -61,8 +67,8 @@ void UIMachineWindowNormal::sltMachineStateChanged()
     /* Call to base-class: */
     UIMachineWindow::sltMachineStateChanged();
 
-    /* Update pause and virtualization stuff: */
-    updateAppearanceOf(UIVisualElement_PauseStuff | UIVisualElement_FeaturesStuff);
+    /* Update indicator-pool and virtualization stuff: */
+    updateAppearanceOf(UIVisualElement_IndicatorPoolStuff | UIVisualElement_FeaturesStuff);
 }
 
 void UIMachineWindowNormal::sltMediumChange(const CMediumAttachment &attachment)
@@ -113,74 +119,93 @@ void UIMachineWindowNormal::sltCPUExecutionCapChange()
     updateAppearanceOf(UIVisualElement_FeaturesStuff);
 }
 
-void UIMachineWindowNormal::sltUpdateIndicators()
+#ifndef RT_OS_DARWIN
+void UIMachineWindowNormal::sltHandleMenuBarConfigurationChange(const QString &strMachineID)
 {
-    /* Update indicators: */
-    if (indicatorsPool()->indicator(IndicatorType_HardDisks))
-        updateIndicatorState(indicatorsPool()->indicator(IndicatorType_HardDisks), KDeviceType_HardDisk);
-    if (indicatorsPool()->indicator(IndicatorType_OpticalDisks))
-        updateIndicatorState(indicatorsPool()->indicator(IndicatorType_OpticalDisks), KDeviceType_DVD);
-    if (indicatorsPool()->indicator(IndicatorType_FloppyDisks))
-        updateIndicatorState(indicatorsPool()->indicator(IndicatorType_FloppyDisks), KDeviceType_Floppy);
-    if (indicatorsPool()->indicator(IndicatorType_USB))
-        updateIndicatorState(indicatorsPool()->indicator(IndicatorType_USB), KDeviceType_USB);
-    if (indicatorsPool()->indicator(IndicatorType_Network))
-        updateIndicatorState(indicatorsPool()->indicator(IndicatorType_Network), KDeviceType_Network);
-    if (indicatorsPool()->indicator(IndicatorType_SharedFolders))
-        updateIndicatorState(indicatorsPool()->indicator(IndicatorType_SharedFolders), KDeviceType_SharedFolder);
+    /* Skip unrelated machine IDs: */
+    if (vboxGlobal().managedVMUuid() != strMachineID)
+        return;
+
+    /* Check whether menu-bar is enabled: */
+    const bool fEnabled = gEDataManager->menuBarEnabled(vboxGlobal().managedVMUuid());
+    /* Update settings action 'enable' state: */
+    QAction *pActionMenuBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_S_Settings);
+    pActionMenuBarSettings->setEnabled(fEnabled);
+    /* Update switch action 'checked' state: */
+    QAction *pActionMenuBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility);
+    pActionMenuBarSwitch->blockSignals(true);
+    pActionMenuBarSwitch->setChecked(fEnabled);
+    pActionMenuBarSwitch->blockSignals(false);
+
+    /* Update menu-bar visibility: */
+    menuBar()->setVisible(pActionMenuBarSwitch->isChecked());
+    /* Update menu-bar: */
+    updateMenu();
+
+    /* Normalize geometry without moving: */
+    normalizeGeometry(false /* adjust position */);
 }
 
-void UIMachineWindowNormal::sltShowIndicatorsContextMenu(QIStateIndicator *pIndicator, QContextMenuEvent *pEvent)
+void UIMachineWindowNormal::sltHandleMenuBarContextMenuRequest(const QPoint &position)
 {
-    /* Show optical-disks LED context menu: */
-    if (pIndicator == indicatorsPool()->indicator(IndicatorType_OpticalDisks))
-    {
-        if (gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->isEnabled())
-            gActionPool->action(UIActionIndexRuntime_Menu_OpticalDevices)->menu()->exec(pEvent->globalPos());
-    }
-    /* Show floppy-disks LED context menu: */
-    else if (pIndicator == indicatorsPool()->indicator(IndicatorType_FloppyDisks))
-    {
-        if (gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices)->isEnabled())
-            gActionPool->action(UIActionIndexRuntime_Menu_FloppyDevices)->menu()->exec(pEvent->globalPos());
-    }
-    /* Show usb LED context menu: */
-    else if (pIndicator == indicatorsPool()->indicator(IndicatorType_USB))
-    {
-        if (gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->isEnabled())
-            gActionPool->action(UIActionIndexRuntime_Menu_USBDevices)->menu()->exec(pEvent->globalPos());
-    }
-    /* Show network LED context menu: */
-    else if (pIndicator == indicatorsPool()->indicator(IndicatorType_Network))
-    {
-        if (gActionPool->action(UIActionIndexRuntime_Menu_Network)->isEnabled())
-            gActionPool->action(UIActionIndexRuntime_Menu_Network)->menu()->exec(pEvent->globalPos());
-    }
-    /* Show shared-folders LED context menu: */
-    else if (pIndicator == indicatorsPool()->indicator(IndicatorType_SharedFolders))
-    {
-        if (gActionPool->action(UIActionIndexRuntime_Menu_SharedFolders)->isEnabled())
-            gActionPool->action(UIActionIndexRuntime_Menu_SharedFolders)->menu()->exec(pEvent->globalPos());
-    }
-    /* Show video-capture LED context menu: */
-    else if (pIndicator == indicatorsPool()->indicator(IndicatorType_VideoCapture))
-    {
-        if (gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture)->isEnabled())
-            gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture)->menu()->exec(pEvent->globalPos());
-    }
-    /* Show mouse LED context menu: */
-    else if (pIndicator == indicatorsPool()->indicator(IndicatorType_Mouse))
-    {
-        if (gActionPool->action(UIActionIndexRuntime_Menu_MouseIntegration)->isEnabled())
-            gActionPool->action(UIActionIndexRuntime_Menu_MouseIntegration)->menu()->exec(pEvent->globalPos());
-    }
+    /* Raise action's context-menu: */
+    actionPool()->action(UIActionIndexRT_M_View_M_MenuBar)->menu()->exec(menuBar()->mapToGlobal(position));
+}
+#endif /* !RT_OS_DARWIN */
+
+void UIMachineWindowNormal::sltHandleStatusBarConfigurationChange(const QString &strMachineID)
+{
+    /* Skip unrelated machine IDs: */
+    if (vboxGlobal().managedVMUuid() != strMachineID)
+        return;
+
+    /* Check whether status-bar is enabled: */
+    const bool fEnabled = gEDataManager->statusBarEnabled(vboxGlobal().managedVMUuid());
+    /* Update settings action 'enable' state: */
+    QAction *pActionStatusBarSettings = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_S_Settings);
+    pActionStatusBarSettings->setEnabled(fEnabled);
+    /* Update switch action 'checked' state: */
+    QAction *pActionStatusBarSwitch = actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility);
+    pActionStatusBarSwitch->blockSignals(true);
+    pActionStatusBarSwitch->setChecked(fEnabled);
+    pActionStatusBarSwitch->blockSignals(false);
+
+    /* Update status-bar visibility: */
+    statusBar()->setVisible(pActionStatusBarSwitch->isChecked());
+    /* Update status-bar indicators-pool: */
+    m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible() && uisession()->isRunning());
+
+    /* Normalize geometry without moving: */
+    normalizeGeometry(false /* adjust position */);
+}
+
+void UIMachineWindowNormal::sltHandleStatusBarContextMenuRequest(const QPoint &position)
+{
+    /* Raise action's context-menu: */
+    actionPool()->action(UIActionIndexRT_M_View_M_StatusBar)->menu()->exec(statusBar()->mapToGlobal(position));
 }
 
-void UIMachineWindowNormal::sltProcessGlobalSettingChange(const char * /* aPublicName */, const char * /* aName */)
+void UIMachineWindowNormal::sltHandleIndicatorContextMenuRequest(IndicatorType indicatorType, const QPoint &position)
 {
-    /* Update host-combination status-bar label: */
-    if (m_pNameHostkey)
-        m_pNameHostkey->setText(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo()));
+    /* Determine action depending on indicator-type: */
+    UIAction *pAction = 0;
+    switch (indicatorType)
+    {
+        case IndicatorType_HardDisks:     pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_HardDrives);     break;
+        case IndicatorType_OpticalDisks:  pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_OpticalDevices); break;
+        case IndicatorType_FloppyDisks:   pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_FloppyDevices);  break;
+        case IndicatorType_Network:       pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_Network);        break;
+        case IndicatorType_USB:           pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_USBDevices);     break;
+        case IndicatorType_SharedFolders: pAction = actionPool()->action(UIActionIndexRT_M_Devices_M_SharedFolders);  break;
+        case IndicatorType_Display:       pAction = actionPool()->action(UIActionIndexRT_M_ViewPopup);                break;
+        case IndicatorType_VideoCapture:  pAction = actionPool()->action(UIActionIndexRT_M_View_M_VideoCapture);      break;
+        case IndicatorType_Mouse:         pAction = actionPool()->action(UIActionIndexRT_M_Input_M_Mouse);            break;
+        case IndicatorType_Keyboard:      pAction = actionPool()->action(UIActionIndexRT_M_Input_M_Keyboard);         break;
+        default: break;
+    }
+    /* Raise action's context-menu: */
+    if (pAction && pAction->isEnabled())
+        pAction->menu()->exec(position);
 }
 
 void UIMachineWindowNormal::prepareSessionConnections()
@@ -217,142 +242,53 @@ void UIMachineWindowNormal::prepareSessionConnections()
             this, SLOT(sltCPUExecutionCapChange()));
 }
 
+#ifndef Q_WS_MAC
 void UIMachineWindowNormal::prepareMenu()
 {
-    /* Call to base-class: */
-    UIMachineWindow::prepareMenu();
-
-#ifndef Q_WS_MAC
-    /* Prepare application menu-bar: */
-    CMachine machine = session().GetMachine();
-    RuntimeMenuType restrictedMenus = VBoxGlobal::restrictedRuntimeMenuTypes(machine);
-    RuntimeMenuType allowedMenus = static_cast<RuntimeMenuType>(RuntimeMenuType_All ^ restrictedMenus);
-    setMenuBar(uisession()->newMenuBar(allowedMenus));
-#endif /* !Q_WS_MAC */
+    /* Create menu-bar: */
+    setMenuBar(new UIMenuBar);
+    AssertPtrReturnVoid(menuBar());
+    {
+        /* Configure menu-bar: */
+        menuBar()->setContextMenuPolicy(Qt::CustomContextMenu);
+        connect(menuBar(), SIGNAL(customContextMenuRequested(const QPoint&)),
+                this, SLOT(sltHandleMenuBarContextMenuRequest(const QPoint&)));
+        connect(gEDataManager, SIGNAL(sigMenuBarConfigurationChange(const QString&)),
+                this, SLOT(sltHandleMenuBarConfigurationChange(const QString&)));
+        /* Update menu-bar: */
+        updateMenu();
+    }
 }
+#endif /* !Q_WS_MAC */
 
 void UIMachineWindowNormal::prepareStatusBar()
 {
     /* Call to base-class: */
     UIMachineWindow::prepareStatusBar();
 
-    /* Setup: */
-    setStatusBar(new QIStatusBar(this));
-    QWidget *pIndicatorBox = new QWidget;
-    QHBoxLayout *pIndicatorBoxHLayout = new QHBoxLayout(pIndicatorBox);
-    pIndicatorBoxHLayout->setContentsMargins(0, 0, 0, 0);
-    pIndicatorBoxHLayout->setSpacing(5);
-    bool fAtLeastOneAddedToLeftSection = false;
-
-    /* Hard Disks: */
-    if (QIStateIndicator *pLedHardDisks = indicatorsPool()->indicator(IndicatorType_HardDisks))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedHardDisks);
-        fAtLeastOneAddedToLeftSection = true;
-    }
-
-    /* Optical Disks: */
-    if (QIStateIndicator *pLedOpticalDisks = indicatorsPool()->indicator(IndicatorType_OpticalDisks))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedOpticalDisks);
-        connect(pLedOpticalDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
-                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
-        fAtLeastOneAddedToLeftSection = true;
-    }
-
-    /* Floppy Disks: */
-    if (QIStateIndicator *pLedFloppyDisks = indicatorsPool()->indicator(IndicatorType_FloppyDisks))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedFloppyDisks);
-        connect(pLedFloppyDisks, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
-                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
-        fAtLeastOneAddedToLeftSection = true;
-    }
-
-    /* USB: */
-    if (QIStateIndicator *pLedUSB = indicatorsPool()->indicator(IndicatorType_USB))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedUSB);
-        connect(pLedUSB, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
-                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
-        fAtLeastOneAddedToLeftSection = true;
-    }
-
-    /* Network: */
-    if (QIStateIndicator *pLedNetwork = indicatorsPool()->indicator(IndicatorType_Network))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedNetwork);
-        connect(pLedNetwork, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
-                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
-        fAtLeastOneAddedToLeftSection = true;
-    }
-
-    /* Shared Folders: */
-    if (QIStateIndicator *pLedSharedFolders = indicatorsPool()->indicator(IndicatorType_SharedFolders))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedSharedFolders);
-        connect(pLedSharedFolders, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
-                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
-        fAtLeastOneAddedToLeftSection = true;
-    }
-
-    /* Video Capture: */
-    if (QIStateIndicator *pLedVideoCapture = indicatorsPool()->indicator(IndicatorType_VideoCapture))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedVideoCapture);
-        connect(pLedVideoCapture, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
-                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
-        fAtLeastOneAddedToLeftSection = true;
-    }
-
-    /* Features: */
-    if (QIStateIndicator *pLedFeatures = indicatorsPool()->indicator(IndicatorType_Features))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedFeatures);
-        fAtLeastOneAddedToLeftSection = true;
-    }
-
-    /* Separator: */
-    if (fAtLeastOneAddedToLeftSection)
-    {
-        QFrame *pSeparator = new QFrame;
-        pSeparator->setFrameStyle(QFrame::VLine | QFrame::Sunken);
-        pIndicatorBoxHLayout->addWidget(pSeparator);
-    }
-
-    /* Mouse: */
-    if (QIStateIndicator *pLedMouse = indicatorsPool()->indicator(IndicatorType_Mouse))
-    {
-        pIndicatorBoxHLayout->addWidget(pLedMouse);
-        connect(pLedMouse, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
-                this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
-    }
-
-    /* Keyboard: */
-    if (QIStateIndicator *pLedKeyboard = indicatorsPool()->indicator(IndicatorType_Keyboard))
+    /* Create status-bar: */
+    setStatusBar(new QIStatusBar);
+    AssertPtrReturnVoid(statusBar());
     {
-        if (QWidget *pContainerWidgetHostkey = new QWidget)
+        /* Configure status-bar: */
+        statusBar()->setContextMenuPolicy(Qt::CustomContextMenu);
+        connect(statusBar(), SIGNAL(customContextMenuRequested(const QPoint&)),
+                this, SLOT(sltHandleStatusBarContextMenuRequest(const QPoint&)));
+        /* Create indicator-pool: */
+        m_pIndicatorsPool = new UIIndicatorsPool(machineLogic()->uisession());
+        AssertPtrReturnVoid(m_pIndicatorsPool);
         {
-            if (QHBoxLayout *pContainerLayoutHostkey = new QHBoxLayout(pContainerWidgetHostkey))
-            {
-                pContainerLayoutHostkey->setContentsMargins(0, 0, 0, 0);
-                pContainerLayoutHostkey->setSpacing(3);
-                m_pNameHostkey = new QLabel(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo()));
-                pContainerLayoutHostkey->addWidget(pLedKeyboard);
-                pContainerLayoutHostkey->addWidget(m_pNameHostkey);
-            }
-            pIndicatorBoxHLayout->addWidget(pContainerWidgetHostkey);
+            /* Configure indicator-pool: */
+            connect(m_pIndicatorsPool, SIGNAL(sigContextMenuRequest(IndicatorType, const QPoint&)),
+                    this, SLOT(sltHandleIndicatorContextMenuRequest(IndicatorType, const QPoint&)));
+            /* Add indicator-pool into status-bar: */
+            statusBar()->addPermanentWidget(m_pIndicatorsPool, 0);
         }
+        /* Post-configure status-bar: */
+        connect(gEDataManager, SIGNAL(sigStatusBarConfigurationChange(const QString&)),
+                this, SLOT(sltHandleStatusBarConfigurationChange(const QString&)));
     }
 
-    /* Add to status-bar: */
-    statusBar()->addPermanentWidget(pIndicatorBox, 0);
-
-    /* Create & start timer to update LEDs: */
-    m_pIdleTimer = new QTimer(this);
-    connect(m_pIdleTimer, SIGNAL(timeout()), this, SLOT(sltUpdateIndicators()));
-    m_pIdleTimer->start(100);
-
 #ifdef Q_WS_MAC
     /* For the status-bar on Cocoa: */
     setUnifiedTitleAndToolBarOnMac(true);
@@ -373,10 +309,6 @@ void UIMachineWindowNormal::prepareVisualState()
     setAutoFillBackground(true);
 #endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
 
-    /* Make sure host-combination LED will be updated: */
-    connect(&vboxGlobal().settings(), SIGNAL(propertyChanged(const char *, const char *)),
-            this, SLOT(sltProcessGlobalSettingChange(const char *, const char *)));
-
 #ifdef Q_WS_MAC
     /* Beta label? */
     if (vboxGlobal().isBeta())
@@ -387,122 +319,65 @@ void UIMachineWindowNormal::prepareVisualState()
 #endif /* Q_WS_MAC */
 }
 
-void UIMachineWindowNormal::prepareHandlers()
-{
-    /* Call to base-class: */
-    UIMachineWindow::prepareHandlers();
-
-    /* Connect keyboard state-change handler: */
-    if (indicatorsPool()->indicator(IndicatorType_Keyboard))
-        connect(machineLogic()->keyboardHandler(), SIGNAL(keyboardStateChanged(int)),
-                indicatorsPool()->indicator(IndicatorType_Keyboard), SLOT(setState(int)));
-    /* Connect mouse state-change handler: */
-    if (indicatorsPool()->indicator(IndicatorType_Mouse))
-        connect(machineLogic()->mouseHandler(), SIGNAL(mouseStateChanged(int)),
-                indicatorsPool()->indicator(IndicatorType_Mouse), SLOT(setState(int)));
-    /* Early initialize created connections: */
-    if (indicatorsPool()->indicator(IndicatorType_Keyboard))
-        indicatorsPool()->indicator(IndicatorType_Keyboard)->setState(machineLogic()->keyboardHandler()->keyboardState());
-    if (indicatorsPool()->indicator(IndicatorType_Mouse))
-        indicatorsPool()->indicator(IndicatorType_Mouse)->setState(machineLogic()->mouseHandler()->mouseState());
-}
-
 void UIMachineWindowNormal::loadSettings()
 {
     /* Call to base-class: */
     UIMachineWindow::loadSettings();
 
-    /* Get machine: */
-    CMachine m = machine();
-
-    /* Load global settings: */
+    /* Load GUI customizations: */
     {
-        VBoxGlobalSettings settings = vboxGlobal().settings();
 #ifndef Q_WS_MAC
-        menuBar()->setHidden(settings.isFeatureActive("noMenuBar"));
+        /* Update menu-bar visibility: */
+        menuBar()->setVisible(actionPool()->action(UIActionIndexRT_M_View_M_MenuBar_T_Visibility)->isChecked());
 #endif /* !Q_WS_MAC */
-        statusBar()->setHidden(settings.isFeatureActive("noStatusBar"));
-        if (statusBar()->isHidden())
-            m_pIdleTimer->stop();
+        /* Update status-bar visibility: */
+        statusBar()->setVisible(actionPool()->action(UIActionIndexRT_M_View_M_StatusBar_T_Visibility)->isChecked());
+        m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible() && uisession()->isRunning());
     }
 
-    /* Load availability settings: */
+    /* Load window geometry: */
     {
-        /* USB Stuff: */
-        if (indicatorsPool()->indicator(IndicatorType_USB))
-        {
-            const CUSBDeviceFilters &filters = m.GetUSBDeviceFilters();
-            ULONG cOhciCtls = m.GetUSBControllerCountByType(KUSBControllerType_OHCI);
-            bool fUSBEnabled = !filters.isNull() && cOhciCtls && m.GetUSBProxyAvailable();
-
-            if (!fUSBEnabled)
-            {
-                /* Hide USB menu: */
-                indicatorsPool()->indicator(IndicatorType_USB)->setHidden(true);
-            }
-            else
-            {
-                /* Toggle USB LED: */
-                indicatorsPool()->indicator(IndicatorType_USB)->setState(KDeviceActivity_Idle);
-            }
-        }
-    }
+        /* Load extra-data: */
+        QRect geo = gEDataManager->machineWindowGeometry(machineLogic()->visualStateType(),
+                                                         m_uScreenId, vboxGlobal().managedVMUuid());
 
-    /* Load extra-data settings: */
-    {
-        /* Load window position settings: */
-        QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(GUI_LastNormalWindowPosition) :
-                                     QString("%1%2").arg(GUI_LastNormalWindowPosition).arg(m_uScreenId);
-        QStringList strPositionSettings = m.GetExtraDataStringList(strPositionAddress);
-        bool ok = !strPositionSettings.isEmpty(), max = false;
-        int x = 0, y = 0, w = 0, h = 0;
-        if (ok && strPositionSettings.size() > 0)
-            x = strPositionSettings[0].toInt(&ok);
-        else ok = false;
-        if (ok && strPositionSettings.size() > 1)
-            y = strPositionSettings[1].toInt(&ok);
-        else ok = false;
-        if (ok && strPositionSettings.size() > 2)
-            w = strPositionSettings[2].toInt(&ok);
-        else ok = false;
-        if (ok && strPositionSettings.size() > 3)
-            h = strPositionSettings[3].toInt(&ok);
-        else ok = false;
-        if (ok && strPositionSettings.size() > 4)
-            max = strPositionSettings[4] == GUI_LastWindowState_Max;
-        QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) :
-                        QApplication::desktop()->availableGeometry(this);
-
-        /* If previous parameters were read correctly: */
-        if (ok)
+        /* If we do have proper geometry: */
+        if (!geo.isNull())
         {
-            /* If previous machine state is SAVED: */
-            if (m.GetState() == KMachineState_Saved)
+            /* If previous machine-state was SAVED: */
+            if (machine().GetState() == KMachineState_Saved)
             {
-                /* Restore window size and position: */
-                m_normalGeometry = QRect(x, y, w, h);
+                /* Restore window geometry: */
+                m_normalGeometry = geo;
                 setGeometry(m_normalGeometry);
             }
-            /* If previous machine state was not SAVED: */
+            /* If previous machine-state was NOT SAVED: */
             else
             {
                 /* Restore only window position: */
-                m_normalGeometry = QRect(x, y, width(), height());
+                m_normalGeometry = QRect(geo.x(), geo.y(), width(), height());
                 setGeometry(m_normalGeometry);
-                /* Normalize to the optimal size: */
+                /* And normalize to the optimal-size: */
                 normalizeGeometry(false /* adjust position */);
             }
-            /* Maximize if needed: */
-            if (max)
+
+            /* Maximize (if necessary): */
+            if (gEDataManager->machineWindowShouldBeMaximized(machineLogic()->visualStateType(),
+                                                              m_uScreenId, vboxGlobal().managedVMUuid()))
                 setWindowState(windowState() | Qt::WindowMaximized);
         }
+        /* If we do NOT have proper geometry: */
         else
         {
+            /* Get available geometry, for screen with (x,y) coords if possible: */
+            QRect availableGeo = !geo.isNull() ? QApplication::desktop()->availableGeometry(QPoint(geo.x(), geo.y())) :
+                                                 QApplication::desktop()->availableGeometry(this);
+
             /* Normalize to the optimal size: */
             normalizeGeometry(true /* adjust position */);
-            /* Move newly created window to the screen center: */
+            /* Move newly created window to the screen-center: */
             m_normalGeometry = geometry();
-            m_normalGeometry.moveCenter(ar.center());
+            m_normalGeometry.moveCenter(availableGeo.center());
             setGeometry(m_normalGeometry);
         }
 
@@ -517,52 +392,17 @@ void UIMachineWindowNormal::loadSettings()
 
 void UIMachineWindowNormal::saveSettings()
 {
-    /* Get machine: */
-    CMachine m = machine();
-
-    /* Save extra-data settings: */
+    /* Save window geometry: */
     {
-        QString strWindowPosition = QString("%1,%2,%3,%4")
-                                    .arg(m_normalGeometry.x()).arg(m_normalGeometry.y())
-                                    .arg(m_normalGeometry.width()).arg(m_normalGeometry.height());
-        if (isMaximizedChecked())
-            strWindowPosition += QString(",%1").arg(GUI_LastWindowState_Max);
-        QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(GUI_LastNormalWindowPosition) :
-                                     QString("%1%2").arg(GUI_LastNormalWindowPosition).arg(m_uScreenId);
-        m.SetExtraData(strPositionAddress, strWindowPosition);
+        gEDataManager->setMachineWindowGeometry(machineLogic()->visualStateType(),
+                                                m_uScreenId, m_normalGeometry,
+                                                isMaximizedChecked(), vboxGlobal().managedVMUuid());
     }
 
     /* Call to base-class: */
     UIMachineWindow::saveSettings();
 }
 
-void UIMachineWindowNormal::cleanupStatusBar()
-{
-    /* Stop LED-update timer: */
-    m_pIdleTimer->stop();
-    m_pIdleTimer->disconnect(SIGNAL(timeout()), this, SLOT(sltUpdateIndicators()));
-
-    /* Call to base-class: */
-    UIMachineWindow::cleanupStatusBar();
-}
-
-void UIMachineWindowNormal::retranslateUi()
-{
-    /* Call to base-class: */
-    UIMachineWindow::retranslateUi();
-
-    /* Translate host-combo LED: */
-    if (m_pNameHostkey)
-    {
-        m_pNameHostkey->setToolTip(
-            QApplication::translate("UIMachineWindowNormal", "Shows the currently assigned Host key.<br>"
-               "This key, when pressed alone, toggles the keyboard and mouse "
-               "capture state. It can also be used in combination with other keys "
-               "to quickly perform actions from the main menu."));
-        m_pNameHostkey->setText(UIHostCombo::toReadableString(vboxGlobal().settings().hostCombo()));
-    }
-}
-
 bool UIMachineWindowNormal::event(QEvent *pEvent)
 {
     switch (pEvent->type())
@@ -578,6 +418,7 @@ bool UIMachineWindowNormal::event(QEvent *pEvent)
                 updateDbgWindows();
 #endif /* VBOX_WITH_DEBUGGER_GUI */
             }
+            emit sigGeometryChange(geometry());
             break;
         }
         case QEvent::Move:
@@ -590,8 +431,12 @@ bool UIMachineWindowNormal::event(QEvent *pEvent)
                 updateDbgWindows();
 #endif /* VBOX_WITH_DEBUGGER_GUI */
             }
+            emit sigGeometryChange(geometry());
             break;
         }
+        case QEvent::WindowActivate:
+            emit sigGeometryChange(geometry());
+            break;
         default:
             break;
     }
@@ -610,6 +455,9 @@ void UIMachineWindowNormal::showInNecessaryMode()
 
     /* Show in normal mode: */
     show();
+
+    /* Make sure machine-view have focus: */
+    m_pMachineView->setFocus();
 }
 
 /**
@@ -663,43 +511,37 @@ void UIMachineWindowNormal::updateAppearanceOf(int iElement)
     UIMachineWindow::updateAppearanceOf(iElement);
 
     /* Update machine window content: */
-    if (iElement & UIVisualElement_PauseStuff)
-    {
-        if (!statusBar()->isHidden())
-        {
-            if (uisession()->isPaused() && m_pIdleTimer->isActive())
-                m_pIdleTimer->stop();
-            else if (uisession()->isRunning() && !m_pIdleTimer->isActive())
-                m_pIdleTimer->start(100);
-            sltUpdateIndicators();
-        }
-    }
-    if ((iElement & UIVisualElement_HDStuff) &&
-        indicatorsPool()->indicator(IndicatorType_HardDisks))
-        indicatorsPool()->indicator(IndicatorType_HardDisks)->updateAppearance();
-    if ((iElement & UIVisualElement_CDStuff) &&
-        indicatorsPool()->indicator(IndicatorType_OpticalDisks))
-        indicatorsPool()->indicator(IndicatorType_OpticalDisks)->updateAppearance();
-    if ((iElement & UIVisualElement_FDStuff) &&
-        indicatorsPool()->indicator(IndicatorType_FloppyDisks))
-        indicatorsPool()->indicator(IndicatorType_FloppyDisks)->updateAppearance();
-    if ((iElement & UIVisualElement_NetworkStuff) &&
-        indicatorsPool()->indicator(IndicatorType_Network))
-        indicatorsPool()->indicator(IndicatorType_Network)->updateAppearance();
-    if ((iElement & UIVisualElement_USBStuff) &&
-        indicatorsPool()->indicator(IndicatorType_USB) &&
-        !indicatorsPool()->indicator(IndicatorType_USB)->isHidden())
-        indicatorsPool()->indicator(IndicatorType_USB)->updateAppearance();
-    if ((iElement & UIVisualElement_SharedFolderStuff) &&
-        indicatorsPool()->indicator(IndicatorType_SharedFolders))
-        indicatorsPool()->indicator(IndicatorType_SharedFolders)->updateAppearance();
-    if ((iElement & UIVisualElement_VideoCapture) &&
-        indicatorsPool()->indicator(IndicatorType_VideoCapture))
-        indicatorsPool()->indicator(IndicatorType_VideoCapture)->updateAppearance();
-    if ((iElement & UIVisualElement_FeaturesStuff) &&
-        indicatorsPool()->indicator(IndicatorType_Features))
-        indicatorsPool()->indicator(IndicatorType_Features)->updateAppearance();
+    if (iElement & UIVisualElement_IndicatorPoolStuff)
+        m_pIndicatorsPool->setAutoUpdateIndicatorStates(statusBar()->isVisible() && uisession()->isRunning());
+    if (iElement & UIVisualElement_HDStuff)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_HardDisks);
+    if (iElement & UIVisualElement_CDStuff)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_OpticalDisks);
+    if (iElement & UIVisualElement_FDStuff)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_FloppyDisks);
+    if (iElement & UIVisualElement_NetworkStuff)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_Network);
+    if (iElement & UIVisualElement_USBStuff)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_USB);
+    if (iElement & UIVisualElement_SharedFolderStuff)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_SharedFolders);
+    if (iElement & UIVisualElement_Display)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_Display);
+    if (iElement & UIVisualElement_VideoCapture)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_VideoCapture);
+    if (iElement & UIVisualElement_FeaturesStuff)
+        m_pIndicatorsPool->updateAppearance(IndicatorType_Features);
+}
+
+#ifndef Q_WS_MAC
+void UIMachineWindowNormal::updateMenu()
+{
+    /* Rebuild menu-bar: */
+    menuBar()->clear();
+    foreach (QMenu *pMenu, actionPool()->menus())
+        menuBar()->addMenu(pMenu);
 }
+#endif /* !Q_WS_MAC */
 
 bool UIMachineWindowNormal::isMaximizedChecked()
 {
@@ -712,27 +554,3 @@ bool UIMachineWindowNormal::isMaximizedChecked()
 #endif /* !Q_WS_MAC */
 }
 
-void UIMachineWindowNormal::updateIndicatorState(QIStateIndicator *pIndicator, KDeviceType deviceType)
-{
-    /* Do NOT update indicators with NULL state: */
-    if (pIndicator->state() == KDeviceActivity_Null)
-        return;
-
-    /* Paused VM have all indicator states set to IDLE: */
-    bool fPaused = uisession()->isPaused();
-    if (fPaused)
-    {
-        /* If state differs from IDLE => set IDLE one:  */
-        if (pIndicator->state() != KDeviceActivity_Idle)
-            pIndicator->setState(KDeviceActivity_Idle);
-    }
-    else
-    {
-        /* Get current indicator state: */
-        int state = session().GetConsole().GetDeviceActivity(deviceType);
-        /* If state differs => set new one:  */
-        if (pIndicator->state() != state)
-            pIndicator->setState(state);
-    }
-}
-
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
index 235618a..e2975a5 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineWindowNormal.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindowNormal class declaration
+ * VBox Qt GUI - UIMachineWindowNormal class declaration.
  */
 
 /*
@@ -19,22 +18,23 @@
 #ifndef __UIMachineWindowNormal_h__
 #define __UIMachineWindowNormal_h__
 
-/* Global includes: */
-#include <QLabel>
-
 /* Local includes: */
 #include "UIMachineWindow.h"
 
 /* Forward declarations: */
 class CMediumAttachment;
 class UIIndicatorsPool;
-class QIStateIndicator;
 
 /* Normal machine-window implementation: */
 class UIMachineWindowNormal : public UIMachineWindow
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies about geometry change. */
+    void sigGeometryChange(const QRect &rect);
+
 protected:
 
     /* Constructor: */
@@ -57,32 +57,40 @@ private slots:
     void sltVideoCaptureChange();
     void sltCPUExecutionCapChange();
 
-    /* LED connections: */
-    void sltUpdateIndicators();
-    void sltShowIndicatorsContextMenu(QIStateIndicator *pIndicator, QContextMenuEvent *pEvent);
-    void sltProcessGlobalSettingChange(const char *aPublicName, const char *aName);
+#ifndef RT_OS_DARWIN
+    /** Handles menu-bar configuration-change. */
+    void sltHandleMenuBarConfigurationChange(const QString &strMachineID);
+    /** Handles menu-bar context-menu-request. */
+    void sltHandleMenuBarContextMenuRequest(const QPoint &position);
+#endif /* !RT_OS_DARWIN */
+
+    /** Handles status-bar configuration-change. */
+    void sltHandleStatusBarConfigurationChange(const QString &strMachineID);
+    /** Handles status-bar context-menu-request. */
+    void sltHandleStatusBarContextMenuRequest(const QPoint &position);
+    /** Handles status-bar indicator context-menu-request. */
+    void sltHandleIndicatorContextMenuRequest(IndicatorType indicatorType, const QPoint &position);
 
 private:
 
     /* Prepare helpers: */
     void prepareSessionConnections();
+#ifndef Q_WS_MAC
     void prepareMenu();
+#endif /* !Q_WS_MAC */
     void prepareStatusBar();
     void prepareVisualState();
-    void prepareHandlers();
     void loadSettings();
 
     /* Cleanup helpers: */
     void saveSettings();
-    //void cleanupHandlers() {}
     //coid cleanupVisualState() {}
-    void cleanupStatusBar();
+    //void cleanupStatusBar() {}
+#ifndef Q_WS_MAC
     //void cleanupMenu() {}
+#endif /* !Q_WS_MAC */
     //void cleanupConsoleConnections() {}
 
-    /* Translate stuff: */
-    void retranslateUi();
-
     /* Show stuff: */
     void showInNecessaryMode();
 
@@ -92,20 +100,21 @@ private:
     /* Update stuff: */
     void updateAppearanceOf(int aElement);
 
+#ifndef Q_WS_MAC
+    /** Updates menu-bar content. */
+    void updateMenu();
+#endif /* !Q_WS_MAC */
+
     /* Event handler: */
     bool event(QEvent *pEvent);
 
     /* Helpers: */
-    UIIndicatorsPool* indicatorsPool() { return m_pIndicatorsPool; }
     bool isMaximizedChecked();
-    void updateIndicatorState(QIStateIndicator *pIndicator, KDeviceType deviceType);
 
-    /* Widgets: */
+    /** Holds the indicator-pool instance. */
     UIIndicatorsPool *m_pIndicatorsPool;
-    QLabel *m_pNameHostkey;
 
-    /* Variables: */
-    QTimer *m_pIdleTimer;
+    /** Holds current window geometry. */
     QRect m_normalGeometry;
 
     /* Factory support: */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.cpp
index 35fca9b..3e055d2 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIKeyboardHandlerScale.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandlerScale class implementation
+ * VBox Qt GUI - UIKeyboardHandlerScale class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,28 +15,41 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Global includes */
-#include <QKeyEvent>
-#include <QTimer>
-#include <QWidget>
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# ifndef Q_WS_MAC
+#  include <QKeyEvent>
+#  include <QTimer>
+# endif /* !Q_WS_MAC */
+
+/* GUI includes: */
+# include "UIKeyboardHandlerScale.h"
+# ifndef Q_WS_MAC
+#  include "UIMachineLogic.h"
+#  include "UIShortcutPool.h"
+# endif /* !Q_WS_MAC */
 
-/* Local includes */
-#include "UIKeyboardHandlerScale.h"
-#include "UIMachineWindow.h"
-#include "UIShortcutPool.h"
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+#ifndef Q_WS_MAC
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+#endif /* !Q_WS_MAC */
 
-/* Fullscreen keyboard-handler constructor: */
 UIKeyboardHandlerScale::UIKeyboardHandlerScale(UIMachineLogic* pMachineLogic)
     : UIKeyboardHandler(pMachineLogic)
 {
 }
 
-/* Fullscreen keyboard-handler destructor: */
 UIKeyboardHandlerScale::~UIKeyboardHandlerScale()
 {
 }
 
-/* Event handler for prepared listener(s): */
+#ifndef Q_WS_MAC
 bool UIKeyboardHandlerScale::eventFilter(QObject *pWatchedObject, QEvent *pEvent)
 {
     /* Check if pWatchedObject object is view: */
@@ -50,9 +61,6 @@ bool UIKeyboardHandlerScale::eventFilter(QObject *pWatchedObject, QEvent *pEvent
         /* Handle view events: */
         switch (pEvent->type())
         {
-#ifndef Q_WS_MAC
-            /* We don't want this on the Mac, cause there the menu bar isn't within the window
-             * and popping up a menu there looks really ugly. */
             case QEvent::KeyPress:
             {
                 /* Get key-event: */
@@ -61,13 +69,12 @@ bool UIKeyboardHandlerScale::eventFilter(QObject *pWatchedObject, QEvent *pEvent
                 if (isHostKeyPressed() && pKeyEvent->key() == gShortcutPool->shortcut(GUI_Input_MachineShortcuts, QString("PopupMenu")).sequence())
                 {
                     /* Post request to show popup-menu: */
-                    QTimer::singleShot(0, m_windows[uScreenId], SLOT(sltPopupMainMenu()));
+                    QTimer::singleShot(0, m_pMachineLogic, SLOT(sltInvokePopupMenu()));
                     /* Filter-out this event: */
                     return true;
                 }
                 break;
             }
-#endif /* !Q_WS_MAC */
             default:
                 break;
         }
@@ -76,4 +83,5 @@ bool UIKeyboardHandlerScale::eventFilter(QObject *pWatchedObject, QEvent *pEvent
     /* Else just propagate to base-class: */
     return UIKeyboardHandler::eventFilter(pWatchedObject, pEvent);
 }
+#endif /* !Q_WS_MAC */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.h b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.h
index fabaf89..515ccea 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.h
@@ -1,11 +1,10 @@
+/* $Id: UIKeyboardHandlerScale.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandlerScale class declaration
+ * VBox Qt GUI - UIKeyboardHandlerScale class declaration.
  */
 
 /*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,27 +18,31 @@
 #ifndef ___UIKeyboardHandlerScale_h___
 #define ___UIKeyboardHandlerScale_h___
 
-/* Local includes */
+/* GUI includes: */
 #include "UIKeyboardHandler.h"
 
+/** UIKeyboardHandler reimplementation
+  * providing machine-logic with PopupMenu keyboard handler. */
 class UIKeyboardHandlerScale : public UIKeyboardHandler
 {
     Q_OBJECT;
 
 protected:
 
-    /* Fullscreen keyboard-handler constructor/destructor: */
+    /** Scale keyboard-handler constructor. */
     UIKeyboardHandlerScale(UIMachineLogic *pMachineLogic);
+    /** Scale keyboard-handler destructor. */
     virtual ~UIKeyboardHandlerScale();
 
 private:
 
-    /* Event handlers: */
+#ifndef Q_WS_MAC
+    /** General event-filter. */
     bool eventFilter(QObject *pWatched, QEvent *pEvent);
+#endif /* !Q_WS_MAC */
 
-    /* Friend classes: */
+    /* Friend class: */
     friend class UIKeyboardHandler;
 };
 
-#endif // !___UIKeyboardHandlerScale_h___
-
+#endif /* !___UIKeyboardHandlerScale_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp
index 832e111..8518e9e 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.cpp
@@ -15,56 +15,87 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# ifndef Q_WS_MAC
+#  include <QTimer>
+# endif /* !Q_WS_MAC */
+
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogicScale.h"
-#include "UIMachineWindow.h"
-#ifdef Q_WS_MAC
-#include "VBoxUtils.h"
-#endif /* Q_WS_MAC */
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogicScale.h"
+# include "UIMachineWindow.h"
+# include "UIShortcutPool.h"
+# ifndef Q_WS_MAC
+#  include "QIMenu.h"
+# else  /* Q_WS_MAC */
+#  include "VBoxUtils.h"
+# endif /* Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineLogicScale::UIMachineLogicScale(QObject *pParent, UISession *pSession)
     : UIMachineLogic(pParent, pSession, UIVisualStateType_Scale)
+#ifndef Q_WS_MAC
+    , m_pPopupMenu(0)
+#endif /* !Q_WS_MAC */
 {
 }
 
 bool UIMachineLogicScale::checkAvailability()
 {
-    /* Take the toggle hot key from the menu item.
-     * Since VBoxGlobal::extractKeyFromActionText gets exactly
-     * the linked key without the 'Host+' part we are adding it here. */
-    QString strHotKey = QString("Host+%1")
-        .arg(VBoxGlobal::extractKeyFromActionText(gActionPool->action(UIActionIndexRuntime_Toggle_Scale)->text()));
-    Assert(!strHotKey.isEmpty());
-
     /* Show the info message. */
+    const UIShortcut &shortcut =
+            gShortcutPool->shortcut(actionPool()->shortcutsExtraDataID(),
+                                    actionPool()->action(UIActionIndexRT_M_View_T_Scale)->shortcutExtraDataID());
+    const QString strHotKey = QString("Host+%1").arg(shortcut.toString());
     if (!msgCenter().confirmGoingScale(strHotKey))
         return false;
 
     return true;
 }
 
+#ifndef Q_WS_MAC
+void UIMachineLogicScale::sltInvokePopupMenu()
+{
+    /* Popup main-menu if present: */
+    if (m_pPopupMenu && !m_pPopupMenu->isEmpty())
+    {
+        m_pPopupMenu->popup(activeMachineWindow()->geometry().center());
+        QTimer::singleShot(0, m_pPopupMenu, SLOT(sltHighlightFirstAction()));
+    }
+}
+#endif /* !Q_WS_MAC */
+
 void UIMachineLogicScale::prepareActionGroups()
 {
     /* Call to base-class: */
     UIMachineLogic::prepareActionGroups();
 
-    /* Guest auto-resize isn't allowed in scale-mode: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setVisible(false);
-    /* Adjust-window isn't allowed in scale-mode: */
-    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(false);
+    /* Restrict 'Adjust Window', 'Guest Autoresize', 'Status Bar' and 'Resize' actions for 'View' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic,
+                                                         (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
+                                                         (UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_ScaleFactor));
 
     /* Take care of view-action toggle state: */
-    UIAction *pActionScale = gActionPool->action(UIActionIndexRuntime_Toggle_Scale);
+    UIAction *pActionScale = actionPool()->action(UIActionIndexRT_M_View_T_Scale);
     if (!pActionScale->isChecked())
     {
         pActionScale->blockSignals(true);
         pActionScale->setChecked(true);
         pActionScale->blockSignals(false);
-        pActionScale->update();
     }
 }
 
@@ -73,12 +104,12 @@ void UIMachineLogicScale::prepareActionConnections()
     /* Call to base-class: */
     UIMachineLogic::prepareActionConnections();
 
-    /* "View" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
+    /* Prepare 'View' actions connections: */
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToNormal()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToFullscreen()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToSeamless()));
 }
 
@@ -95,7 +126,7 @@ void UIMachineLogicScale::prepareMachineWindows()
 #endif /* Q_WS_MAC */
 
     /* Get monitors count: */
-    ulong uMonitorCount = session().GetMachine().GetMonitorCount();
+    ulong uMonitorCount = machine().GetMonitorCount();
     /* Create machine window(s): */
     for (ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)
         addMachineWindow(UIMachineWindow::create(this, uScreenId));
@@ -103,10 +134,39 @@ void UIMachineLogicScale::prepareMachineWindows()
     for (ulong uScreenId = uMonitorCount; uScreenId > 0; -- uScreenId)
         machineWindows()[uScreenId - 1]->raise();
 
+    /* Listen for frame-buffer resize: */
+    foreach (UIMachineWindow *pMachineWindow, machineWindows())
+        connect(pMachineWindow, SIGNAL(sigFrameBufferResize()),
+                this, SIGNAL(sigFrameBufferResize()));
+    emit sigFrameBufferResize();
+
     /* Mark machine-window(s) created: */
     setMachineWindowsCreated(true);
 }
 
+#ifndef Q_WS_MAC
+void UIMachineLogicScale::prepareMenu()
+{
+    /* Prepare popup-menu: */
+    m_pPopupMenu = new QIMenu;
+    AssertPtrReturnVoid(m_pPopupMenu);
+    {
+        /* Prepare popup-menu: */
+        foreach (QMenu *pMenu, actionPool()->menus())
+            m_pPopupMenu->addMenu(pMenu);
+    }
+}
+#endif /* !Q_WS_MAC */
+
+#ifndef Q_WS_MAC
+void UIMachineLogicScale::cleanupMenu()
+{
+    /* Cleanup popup-menu: */
+    delete m_pPopupMenu;
+    m_pPopupMenu = 0;
+}
+#endif /* !Q_WS_MAC */
+
 void UIMachineLogicScale::cleanupMachineWindows()
 {
     /* Do not destroy machine-window(s) if they destroyed already: */
@@ -124,11 +184,11 @@ void UIMachineLogicScale::cleanupMachineWindows()
 void UIMachineLogicScale::cleanupActionConnections()
 {
     /* "View" actions disconnections: */
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToNormal()));
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToFullscreen()));
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToSeamless()));
 
     /* Call to base-class: */
@@ -139,19 +199,17 @@ void UIMachineLogicScale::cleanupActionConnections()
 void UIMachineLogicScale::cleanupActionGroups()
 {
     /* Take care of view-action toggle state: */
-    UIAction *pActionScale = gActionPool->action(UIActionIndexRuntime_Toggle_Scale);
+    UIAction *pActionScale = actionPool()->action(UIActionIndexRT_M_View_T_Scale);
     if (pActionScale->isChecked())
     {
         pActionScale->blockSignals(true);
         pActionScale->setChecked(false);
         pActionScale->blockSignals(false);
-        pActionScale->update();
     }
 
-    /* Reenable guest-autoresize action: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setVisible(true);
-    /* Reenable adjust-window action: */
-    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(true);
+    /* Allow 'Adjust Window', 'Guest Autoresize', 'Status Bar' and 'Resize' actions for 'View' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic,
+                                                         UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid);
 
     /* Call to base-class: */
     UIMachineLogic::cleanupActionGroups();
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.h b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.h
index be87ef0..c1ccdea 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineLogicScale.h
@@ -1,3 +1,4 @@
+/* $Id: UIMachineLogicScale.h $ */
 /** @file
  * VBox Qt GUI - UIMachineLogicScale class declaration.
  */
@@ -36,18 +37,36 @@ protected:
     /** Returns machine-window flags for 'Scale' machine-logic and passed @a uScreenId. */
     virtual Qt::WindowFlags windowFlags(ulong uScreenId) const { Q_UNUSED(uScreenId); return Qt::Window; }
 
+#ifndef RT_OS_DARWIN
+private slots:
+
+    /** Invokes popup-menu. */
+    void sltInvokePopupMenu();
+#endif /* !RT_OS_DARWIN */
+
 private:
 
     /* Prepare helpers: */
     void prepareActionGroups();
     void prepareActionConnections();
     void prepareMachineWindows();
+#ifndef RT_OS_DARWIN
+    void prepareMenu();
+#endif /* !RT_OS_DARWIN */
 
     /* Cleanup helpers: */
+#ifndef RT_OS_DARWIN
+    void cleanupMenu();
+#endif /* !RT_OS_DARWIN */
     void cleanupMachineWindows();
     void cleanupActionConnections();
     void cleanupActionGroups();
 
+#ifndef RT_OS_DARWIN
+    /** Holds the popup-menu instance. */
+    QMenu *m_pPopupMenu;
+#endif /* !RT_OS_DARWIN */
+
     /* Friend classes: */
     friend class UIMachineLogic;
 };
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
index ba09891..ca6b101 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineViewScale.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineViewScale class implementation
+ * VBox Qt GUI - UIMachineViewScale class implementation.
  */
 
 /*
@@ -17,26 +15,33 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QMainWindow>
-#include <QTimer>
+# include <QDesktopWidget>
+# include <QMainWindow>
+# include <QTimer>
 
 /* GUI includes */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIMachineLogic.h"
-#include "UIMachineWindow.h"
-#include "UIMachineViewScale.h"
-#include "UIFrameBuffer.h"
-#include "UIFrameBufferQImage.h"
-#ifdef VBOX_GUI_USE_QUARTZ2D
-# include "UIFrameBufferQuartz2D.h"
-#endif /* VBOX_GUI_USE_QUARTZ2D */
+# include "VBoxGlobal.h"
+# include "UISession.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindow.h"
+# include "UIMachineViewScale.h"
+# include "UIExtraDataManager.h"
+# include "UIFrameBuffer.h"
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CDisplay.h"
+# include "CConsole.h"
+# include "CDisplay.h"
+
+/* Other VBox includes: */
+#include <VBox/VBoxOGL.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineViewScale::UIMachineViewScale(  UIMachineWindow *pMachineWindow
                                        , ulong uScreenId
@@ -50,7 +55,6 @@ UIMachineViewScale::UIMachineViewScale(  UIMachineWindow *pMachineWindow
                     , bAccelerate2DVideo
 #endif
                     )
-    , m_pPauseImage(0)
 {
     /* Resend the last resize hint if necessary: */
     maybeResendSizeHint();
@@ -61,75 +65,33 @@ UIMachineViewScale::~UIMachineViewScale()
     /* Save machine view settings: */
     saveMachineViewSettings();
 
-    /* Disable scaling: */
-    frameBuffer()->setScaledSize(QSize());
-
     /* Cleanup frame buffer: */
     cleanupFrameBuffer();
 }
 
-void UIMachineViewScale::takePauseShotLive()
-{
-    /* Take a screen snapshot. Note that TakeScreenShot() always needs a 32bpp image: */
-    QImage shot = QImage(m_pFrameBuffer->width(), m_pFrameBuffer->height(), QImage::Format_RGB32);
-    /* If TakeScreenShot fails or returns no image, just show a black image. */
-    shot.fill(0);
-    CDisplay dsp = session().GetConsole().GetDisplay();
-    dsp.TakeScreenShot(screenId(), shot.bits(), shot.width(), shot.height());
-    m_pPauseImage = new QImage(shot);
-    scalePauseShot();
-}
-
-void UIMachineViewScale::takePauseShotSnapshot()
-{
-    CMachine machine = session().GetMachine();
-    ULONG width = 0, height = 0;
-    QVector<BYTE> screenData = machine.ReadSavedScreenshotPNGToArray(0, width, height);
-    if (screenData.size() != 0)
-    {
-        ULONG guestOriginX = 0, guestOriginY = 0, guestWidth = 0, guestHeight = 0;
-        BOOL fEnabled = true;
-        machine.QuerySavedGuestScreenInfo(0, guestOriginX, guestOriginY, guestWidth, guestHeight, fEnabled);
-        QImage shot = QImage::fromData(screenData.data(), screenData.size(), "PNG").scaled(guestWidth > 0 ? QSize(guestWidth, guestHeight) : guestSizeHint());
-        m_pPauseImage = new QImage(shot);
-        scalePauseShot();
-    }
-}
-
-void UIMachineViewScale::resetPauseShot()
+void UIMachineViewScale::sltPerformGuestScale()
 {
-    /* Call the base class */
-    UIMachineView::resetPauseShot();
+    /* Adjust frame-buffer scaled-size: */
+    frameBuffer()->setScaledSize(size());
+    frameBuffer()->performRescale();
 
-    if (m_pPauseImage)
-    {
-        delete m_pPauseImage;
-        m_pPauseImage = 0;
-    }
-}
-
-void UIMachineViewScale::scalePauseShot()
-{
-    if (m_pPauseImage)
+    /* If scaled-size is valid: */
+    const QSize scaledSize = frameBuffer()->scaledSize();
+    if (scaledSize.isValid())
     {
-        QSize scaledSize = frameBuffer()->scaledSize();
-        if (scaledSize.isValid())
+        /* Propagate scale-factor to 3D service if necessary: */
+        if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
         {
-            QImage tmpImg = m_pPauseImage->scaled(scaledSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-            dimImage(tmpImg);
-            m_pauseShot = QPixmap::fromImage(tmpImg);
+            const double xScaleFactor = (double)scaledSize.width()  / frameBuffer()->width();
+            const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height();
+            display().NotifyScaleFactorChange(m_uScreenId,
+                                              (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+                                              (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
         }
     }
-}
 
-void UIMachineViewScale::sltPerformGuestScale()
-{
-    /* Check if scale is requested: */
-    /* Set new frame-buffer scale-factor: */
-    frameBuffer()->setScaledSize(viewport()->size());
-
-    /* Scale the pause image if necessary */
-    scalePauseShot();
+    /* Scale the pause-pixmap: */
+    updateScaledPausePixmap();
 
     /* Update viewport: */
     viewport()->repaint();
@@ -138,25 +100,6 @@ void UIMachineViewScale::sltPerformGuestScale()
     updateSliders();
 }
 
-void UIMachineViewScale::sltHandleNotifyUpdate(int iX, int iY, int iW, int iH)
-{
-    /* Initialize variables for scale mode: */
-    QSize scaledSize = frameBuffer()->scaledSize();
-    double xRatio = (double)scaledSize.width() / frameBuffer()->width();
-    double yRatio = (double)scaledSize.height() / frameBuffer()->height();
-    AssertMsg(contentsX() == 0, ("This can't be, else notify Dsen!\n"));
-    AssertMsg(contentsY() == 0, ("This can't be, else notify Dsen!\n"));
-
-    /* Update corresponding viewport part,
-     * But make sure we update always a bigger rectangle than requested to
-     * catch all rounding errors. (use 1 time the ratio factor and
-     * round down on top/left, but round up for the width/height) */
-    viewport()->update((int)(iX * xRatio) - ((int)xRatio) - 1,
-                       (int)(iY * yRatio) - ((int)yRatio) - 1,
-                       (int)(iW * xRatio) + ((int)xRatio + 2) * 2,
-                       (int)(iH * yRatio) + ((int)yRatio + 2) * 2);
-}
-
 bool UIMachineViewScale::eventFilter(QObject *pWatched, QEvent *pEvent)
 {
     if (pWatched != 0 && pWatched == viewport())
@@ -184,18 +127,45 @@ void UIMachineViewScale::saveMachineViewSettings()
         storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
 }
 
+void UIMachineViewScale::applyMachineViewScaleFactor()
+{
+    /* If scaled-size is valid: */
+    const QSize scaledSize = frameBuffer()->scaledSize();
+    if (scaledSize.isValid())
+    {
+        /* Propagate scale-factor to 3D service if necessary: */
+        if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
+        {
+            const double xScaleFactor = (double)scaledSize.width()  / frameBuffer()->width();
+            const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height();
+            display().NotifyScaleFactorChange(m_uScreenId,
+                                              (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+                                              (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
+        }
+    }
+
+    /* Take unscaled HiDPI output mode into account: */
+    const bool fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid());
+    frameBuffer()->setUseUnscaledHiDPIOutput(fUseUnscaledHiDPIOutput);
+    /* Propagate unscaled-hidpi-output feature to 3D service if necessary: */
+    if (machine().GetAccelerate3DEnabled() && vboxGlobal().is3DAvailable())
+    {
+        display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
+    }
+
+    /* Perform frame-buffer rescaling: */
+    frameBuffer()->performRescale();
+
+    // TODO: How to make it work?
+    display().ViewportChanged(screenId(), contentsX(), contentsY(), visibleWidth(), visibleHeight());
+}
+
 void UIMachineViewScale::maybeResendSizeHint()
 {
     if (uisession()->isGuestSupportsGraphics())
     {
-        /* Get the current machine: */
-        CMachine machine = session().GetMachine();
-
-        /* We send a guest size hint if needed to reverse a transition
-         * to fullscreen or seamless. */
-        QString strKey = makeExtraDataKeyPerMonitor(GUI_LastGuestSizeHintWasFullscreen);
-        QString strHintSent = machine.GetExtraData(strKey);
-        if (!strHintSent.isEmpty())
+        /* Send guest-screen size-hint if needed to reverse a transition to fullscreen or seamless: */
+        if (gEDataManager->wasLastGuestSizeHintForFullScreen(m_uScreenId, vboxGlobal().managedVMUuid()))
         {
             const QSize sizeHint = guestSizeHint();
             LogRel(("UIMachineViewScale::maybeResendSizeHint: "
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h
index 7776231..01365d6 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineViewScale.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineViewScale class declaration
+ * VBox Qt GUI - UIMachineViewScale class declaration.
  */
 
 /*
@@ -38,19 +37,11 @@ protected:
     /* Scale machine-view destructor: */
     virtual ~UIMachineViewScale();
 
-    virtual void takePauseShotLive();
-    virtual void takePauseShotSnapshot();
-    virtual void resetPauseShot();
-    void scalePauseShot();
-
 private slots:
 
     /* Slot to perform guest resize: */
     void sltPerformGuestScale();
 
-    /* Handler: Frame-buffer NotifyUpdate stuff: */
-    void sltHandleNotifyUpdate(int iX, int iY, int iW, int iH);
-
 private:
 
     /* Event handlers: */
@@ -62,6 +53,9 @@ private:
     /* Cleanup helpers: */
     void saveMachineViewSettings();
 
+    /** Applies machine-view scale-factor. */
+    void applyMachineViewScaleFactor();
+
     /** Resends guest size-hint if necessary. */
     void maybeResendSizeHint();
 
@@ -71,9 +65,6 @@ private:
     QSize calculateMaxGuestSize() const;
     void updateSliders();
 
-    /* Private members: */
-    QImage *m_pPauseImage;
-
     /* Friend classes: */
     friend class UIMachineView;
 };
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
index 891cd4e..cff4ea8 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineWindowScale.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindowScale class implementation
+ * VBox Qt GUI - UIMachineWindowScale class implementation.
  */
 
 /*
@@ -17,42 +15,37 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QMenu>
-#include <QTimer>
-#include <QSpacerItem>
-#include <QResizeEvent>
+# include <QDesktopWidget>
+# include <QMenu>
+# include <QTimer>
+# include <QSpacerItem>
+# include <QResizeEvent>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIMachineLogic.h"
-#include "UIMachineWindowScale.h"
-#ifdef Q_WS_WIN
+# include "VBoxGlobal.h"
+# include "UIExtraDataManager.h"
+# include "UISession.h"
+# include "UIMachineLogic.h"
+# include "UIMachineWindowScale.h"
 # include "UIMachineView.h"
-#endif /* Q_WS_WIN */
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-# include "UIImageTools.h"
-#endif /* Q_WS_MAC */
+# ifdef Q_WS_MAC
+#  include "VBoxUtils.h"
+#  include "UIImageTools.h"
+# endif /* Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineWindowScale::UIMachineWindowScale(UIMachineLogic *pMachineLogic, ulong uScreenId)
     : UIMachineWindow(pMachineLogic, uScreenId)
-    , m_pMainMenu(0)
 {
 }
 
-void UIMachineWindowScale::sltPopupMainMenu()
-{
-    /* Popup main-menu if present: */
-    if (m_pMainMenu && !m_pMainMenu->isEmpty())
-    {
-        m_pMainMenu->popup(geometry().center());
-        QTimer::singleShot(0, m_pMainMenu, SLOT(sltHighlightFirstAction()));
-    }
-}
-
 void UIMachineWindowScale::prepareMainLayout()
 {
     /* Call to base-class: */
@@ -65,26 +58,12 @@ void UIMachineWindowScale::prepareMainLayout()
     m_pRightSpacer->changeSize(0, 0, QSizePolicy::Fixed, QSizePolicy::Fixed);
 }
 
-void UIMachineWindowScale::prepareMenu()
-{
-    /* Call to base-class: */
-    UIMachineWindow::prepareMenu();
-
-    /* Prepare menu: */
-    CMachine machine = session().GetMachine();
-    RuntimeMenuType restrictedMenus = VBoxGlobal::restrictedRuntimeMenuTypes(machine);
-    RuntimeMenuType allowedMenus = static_cast<RuntimeMenuType>(RuntimeMenuType_All ^ restrictedMenus);
-    m_pMainMenu = uisession()->newMenu(allowedMenus);
-}
-
 #ifdef Q_WS_MAC
 void UIMachineWindowScale::prepareVisualState()
 {
     /* Call to base-class: */
     UIMachineWindow::prepareVisualState();
 
-    /* Install the resize delegate for keeping the aspect ratio. */
-    ::darwinInstallResizeDelegate(this);
     /* Beta label? */
     if (vboxGlobal().isBeta())
     {
@@ -99,54 +78,36 @@ void UIMachineWindowScale::loadSettings()
     /* Call to base-class: */
     UIMachineWindow::loadSettings();
 
-    /* Load scale window settings: */
-    CMachine m = machine();
-
     /* Load extra-data settings: */
     {
-        QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(GUI_LastScaleWindowPosition) :
-                                     QString("%1%2").arg(GUI_LastScaleWindowPosition).arg(m_uScreenId);
-        QStringList strPositionSettings = m.GetExtraDataStringList(strPositionAddress);
+        /* Load extra-data: */
+        QRect geo = gEDataManager->machineWindowGeometry(machineLogic()->visualStateType(),
+                                                         m_uScreenId, vboxGlobal().managedVMUuid());
 
-        bool ok = !strPositionSettings.isEmpty(), max = false;
-        int x = 0, y = 0, w = 0, h = 0;
-
-        if (ok && strPositionSettings.size() > 0)
-            x = strPositionSettings[0].toInt(&ok);
-        else ok = false;
-        if (ok && strPositionSettings.size() > 1)
-            y = strPositionSettings[1].toInt(&ok);
-        else ok = false;
-        if (ok && strPositionSettings.size() > 2)
-            w = strPositionSettings[2].toInt(&ok);
-        else ok = false;
-        if (ok && strPositionSettings.size() > 3)
-            h = strPositionSettings[3].toInt(&ok);
-        else ok = false;
-        if (ok && strPositionSettings.size() > 4)
-            max = strPositionSettings[4] == GUI_LastWindowState_Max;
-
-        QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) :
-                        QApplication::desktop()->availableGeometry(this);
-
-        /* If previous parameters were read correctly: */
-        if (ok)
+        /* If we do have proper geometry: */
+        if (!geo.isNull())
         {
-            /* Restore window size and position: */
-            m_normalGeometry = QRect(x, y, w, h);
+            /* Restore window geometry: */
+            m_normalGeometry = geo;
             setGeometry(m_normalGeometry);
-            /* Maximize if needed: */
-            if (max)
+
+            /* Maximize (if necessary): */
+            if (gEDataManager->machineWindowShouldBeMaximized(machineLogic()->visualStateType(),
+                                                              m_uScreenId, vboxGlobal().managedVMUuid()))
                 setWindowState(windowState() | Qt::WindowMaximized);
         }
+        /* If we do NOT have proper geometry: */
         else
         {
+            /* Get available geometry, for screen with (x,y) coords if possible: */
+            QRect availableGeo = !geo.isNull() ? QApplication::desktop()->availableGeometry(QPoint(geo.x(), geo.y())) :
+                                                 QApplication::desktop()->availableGeometry(this);
+
             /* Resize to default size: */
             resize(640, 480);
-            qApp->processEvents();
-            /* Move newly created window to the screen center: */
+            /* Move newly created window to the screen-center: */
             m_normalGeometry = geometry();
-            m_normalGeometry.moveCenter(ar.center());
+            m_normalGeometry.moveCenter(availableGeo.center());
             setGeometry(m_normalGeometry);
         }
     }
@@ -154,46 +115,17 @@ void UIMachineWindowScale::loadSettings()
 
 void UIMachineWindowScale::saveSettings()
 {
-    /* Get machine: */
-    CMachine m = machine();
-
-    /* Save extra-data settings: */
+    /* Save window geometry: */
     {
-        QString strWindowPosition = QString("%1,%2,%3,%4")
-                                    .arg(m_normalGeometry.x()).arg(m_normalGeometry.y())
-                                    .arg(m_normalGeometry.width()).arg(m_normalGeometry.height());
-        if (isMaximizedChecked())
-            strWindowPosition += QString(",%1").arg(GUI_LastWindowState_Max);
-        QString strPositionAddress = m_uScreenId == 0 ? QString("%1").arg(GUI_LastScaleWindowPosition) :
-                                     QString("%1%2").arg(GUI_LastScaleWindowPosition).arg(m_uScreenId);
-        m.SetExtraData(strPositionAddress, strWindowPosition);
+        gEDataManager->setMachineWindowGeometry(machineLogic()->visualStateType(),
+                                                m_uScreenId, m_normalGeometry,
+                                                isMaximizedChecked(), vboxGlobal().managedVMUuid());
     }
 
     /* Call to base-class: */
     UIMachineWindow::saveSettings();
 }
 
-#ifdef Q_WS_MAC
-void UIMachineWindowScale::cleanupVisualState()
-{
-    /* Uninstall the resize delegate for keeping the aspect ratio. */
-    ::darwinUninstallResizeDelegate(this);
-
-    /* Call to base-class: */
-    UIMachineWindow::cleanupVisualState();
-}
-#endif /* Q_WS_MAC */
-
-void UIMachineWindowScale::cleanupMenu()
-{
-    /* Cleanup menu: */
-    delete m_pMainMenu;
-    m_pMainMenu = 0;
-
-    /* Call to base-class: */
-    UIMachineWindow::cleanupMenu();
-}
-
 void UIMachineWindowScale::showInNecessaryMode()
 {
     /* Make sure this window should be shown at all: */
@@ -206,6 +138,9 @@ void UIMachineWindowScale::showInNecessaryMode()
 
     /* Show in normal mode: */
     show();
+
+    /* Make sure machine-view have focus: */
+    m_pMachineView->setFocus();
 }
 
 bool UIMachineWindowScale::event(QEvent *pEvent)
@@ -250,7 +185,8 @@ bool UIMachineWindowScale::winEvent(MSG *pMessage, long *pResult)
      * 1. machine view exists and 2. event-type is WM_SIZING and 3. shift key is NOT pressed: */
     if (machineView() && pMessage->message == WM_SIZING && !(QApplication::keyboardModifiers() & Qt::ShiftModifier))
     {
-        if (double dAspectRatio = machineView()->aspectRatio())
+        double dAspectRatio = machineView()->aspectRatio();
+        if (dAspectRatio)
         {
             RECT *pRect = reinterpret_cast<RECT*>(pMessage->lParam);
             switch (pMessage->wParam)
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h
index c42a2e1..59b97b7 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineWindowScale.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindowScale class declaration
+ * VBox Qt GUI - UIMachineWindowScale class declaration.
  */
 
 /*
@@ -32,16 +31,10 @@ protected:
     /* Constructor: */
     UIMachineWindowScale(UIMachineLogic *pMachineLogic, ulong uScreenId);
 
-private slots:
-
-    /* Popup main-menu: */
-    void sltPopupMainMenu();
-
 private:
 
     /* Prepare helpers: */
     void prepareMainLayout();
-    void prepareMenu();
 #ifdef Q_WS_MAC
     void prepareVisualState();
 #endif /* Q_WS_MAC */
@@ -50,9 +43,8 @@ private:
     /* Cleanup helpers: */
     void saveSettings();
 #ifdef Q_WS_MAC
-    void cleanupVisualState();
+    //void cleanupVisualState() {}
 #endif /* Q_WS_MAC */
-    void cleanupMenu();
     //void cleanupMainLayout() {}
 
     /* Show stuff: */
@@ -67,9 +59,6 @@ private:
     /* Helpers: */
     bool isMaximizedChecked();
 
-    /* Widgets: */
-    QMenu *m_pMainMenu;
-
     /* Variables: */
     QRect m_normalGeometry;
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIKeyboardHandlerSeamless.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIKeyboardHandlerSeamless.cpp
index f5da6bb..6419c79 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIKeyboardHandlerSeamless.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIKeyboardHandlerSeamless.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIKeyboardHandlerSeamless.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandlerSeamless class implementation
+ * VBox Qt GUI - UIKeyboardHandlerSeamless class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,28 +15,41 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Global includes */
-#include <QKeyEvent>
-#include <QTimer>
-#include <QWidget>
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+# ifndef Q_WS_MAC
+/* Qt includes: */
+#  include <QKeyEvent>
+#  include <QTimer>
+# endif /* !Q_WS_MAC */
+
+/* GUI includes: */
+# include "UIKeyboardHandlerSeamless.h"
+# ifndef Q_WS_MAC
+#  include "UIMachineLogic.h"
+#  include "UIShortcutPool.h"
+# endif /* !Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
-/* Local includes */
-#include "UIKeyboardHandlerSeamless.h"
-#include "UIMachineWindow.h"
-#include "UIShortcutPool.h"
+#ifndef Q_WS_MAC
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+#endif /* !Q_WS_MAC */
 
-/* Fullscreen keyboard-handler constructor: */
 UIKeyboardHandlerSeamless::UIKeyboardHandlerSeamless(UIMachineLogic* pMachineLogic)
     : UIKeyboardHandler(pMachineLogic)
 {
 }
 
-/* Fullscreen keyboard-handler destructor: */
 UIKeyboardHandlerSeamless::~UIKeyboardHandlerSeamless()
 {
 }
 
-/* Event handler for prepared listener(s): */
+#ifndef Q_WS_MAC
 bool UIKeyboardHandlerSeamless::eventFilter(QObject *pWatchedObject, QEvent *pEvent)
 {
     /* Check if pWatchedObject object is view: */
@@ -58,7 +69,7 @@ bool UIKeyboardHandlerSeamless::eventFilter(QObject *pWatchedObject, QEvent *pEv
                 if (isHostKeyPressed() && pKeyEvent->key() == gShortcutPool->shortcut(GUI_Input_MachineShortcuts, QString("PopupMenu")).sequence())
                 {
                     /* Post request to show popup-menu: */
-                    QTimer::singleShot(0, m_windows[uScreenId], SLOT(sltPopupMainMenu()));
+                    QTimer::singleShot(0, m_pMachineLogic, SLOT(sltInvokePopupMenu()));
                     /* Filter-out this event: */
                     return true;
                 }
@@ -72,4 +83,5 @@ bool UIKeyboardHandlerSeamless::eventFilter(QObject *pWatchedObject, QEvent *pEv
     /* Else just propagate to base-class: */
     return UIKeyboardHandler::eventFilter(pWatchedObject, pEvent);
 }
+#endif /* !Q_WS_MAC */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIKeyboardHandlerSeamless.h b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIKeyboardHandlerSeamless.h
index b2541ff..a7fb5cd 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIKeyboardHandlerSeamless.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIKeyboardHandlerSeamless.h
@@ -1,11 +1,10 @@
+/* $Id: UIKeyboardHandlerSeamless.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIKeyboardHandlerSeamless class declaration
+ * VBox Qt GUI - UIKeyboardHandlerSeamless class declaration.
  */
 
 /*
- * Copyright (C) 2010 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,27 +18,31 @@
 #ifndef ___UIKeyboardHandlerSeamless_h___
 #define ___UIKeyboardHandlerSeamless_h___
 
-/* Local includes */
+/* GUI includes: */
 #include "UIKeyboardHandler.h"
 
+/** UIKeyboardHandler reimplementation
+  * providing machine-logic with PopupMenu keyboard handler. */
 class UIKeyboardHandlerSeamless : public UIKeyboardHandler
 {
     Q_OBJECT;
 
 protected:
 
-    /* Fullscreen keyboard-handler constructor/destructor: */
+    /** Seamless keyboard-handler constructor. */
     UIKeyboardHandlerSeamless(UIMachineLogic *pMachineLogic);
+    /** Seamless keyboard-handler destructor. */
     virtual ~UIKeyboardHandlerSeamless();
 
 private:
 
-    /* Event handlers: */
+#ifndef Q_WS_MAC
+    /** General event-filter. */
     bool eventFilter(QObject *pWatched, QEvent *pEvent);
+#endif /* !Q_WS_MAC */
 
-    /* Friend classes: */
+    /* Friend class: */
     friend class UIKeyboardHandler;
 };
 
-#endif // !___UIKeyboardHandlerSeamless_h___
-
+#endif /* !___UIKeyboardHandlerSeamless_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
index fe98642..5b72b26 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
@@ -15,44 +15,59 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
+# include <QDesktopWidget>
+# ifndef Q_WS_MAC
+#  include <QTimer>
+# endif /* !Q_WS_MAC */
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIPopupCenter.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogicSeamless.h"
-#include "UIMachineWindowSeamless.h"
-#include "UIMultiScreenLayout.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-#endif /* Q_WS_MAC */
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIPopupCenter.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogicSeamless.h"
+# include "UIMachineWindowSeamless.h"
+# include "UIMultiScreenLayout.h"
+# include "UIShortcutPool.h"
+# ifndef Q_WS_MAC
+#  include "QIMenu.h"
+# else  /* Q_WS_MAC */
+#  include "VBoxUtils.h"
+# endif /* Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineLogicSeamless::UIMachineLogicSeamless(QObject *pParent, UISession *pSession)
     : UIMachineLogic(pParent, pSession, UIVisualStateType_Seamless)
+#ifndef Q_WS_MAC
+    , m_pPopupMenu(0)
+#endif /* !Q_WS_MAC */
 {
     /* Create multiscreen layout: */
     m_pScreenLayout = new UIMultiScreenLayout(this);
+    actionPool()->toRuntime()->setMultiScreenLayout(m_pScreenLayout);
 }
 
 UIMachineLogicSeamless::~UIMachineLogicSeamless()
 {
     /* Delete multiscreen layout: */
+    actionPool()->toRuntime()->setMultiScreenLayout(0);
     delete m_pScreenLayout;
 }
 
 bool UIMachineLogicSeamless::checkAvailability()
 {
-    /* Temporary get a machine object: */
-    const CMachine &machine = uisession()->session().GetMachine();
-
     /* Check if there is enough physical memory to enter seamless: */
     if (uisession()->isGuestSupportsSeamless())
     {
-        quint64 availBits = machine.GetVRAMSize() /* VRAM */ * _1M /* MiB to bytes */ * 8 /* to bits */;
+        quint64 availBits = machine().GetVRAMSize() /* VRAM */ * _1M /* MiB to bytes */ * 8 /* to bits */;
         quint64 usedBits = m_pScreenLayout->memoryRequirements();
         if (availBits < usedBits)
         {
@@ -62,15 +77,12 @@ bool UIMachineLogicSeamless::checkAvailability()
         }
     }
 
-    /* Take the toggle hot key from the menu item.
-     * Since VBoxGlobal::extractKeyFromActionText gets exactly
-     * the linked key without the 'Host+' part we are adding it here. */
-    QString hotKey = QString("Host+%1")
-        .arg(VBoxGlobal::extractKeyFromActionText(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless)->text()));
-    Assert(!hotKey.isEmpty());
-
     /* Show the info message. */
-    if (!msgCenter().confirmGoingSeamless(hotKey))
+    const UIShortcut &shortcut =
+            gShortcutPool->shortcut(actionPool()->shortcutsExtraDataID(),
+                                    actionPool()->action(UIActionIndexRT_M_View_T_Seamless)->shortcutExtraDataID());
+    const QString strHotKey = QString("Host+%1").arg(shortcut.toString());
+    if (!msgCenter().confirmGoingSeamless(strHotKey))
         return false;
 
     return true;
@@ -152,6 +164,18 @@ void UIMachineLogicSeamless::sltMachineStateChanged()
     }
 }
 
+#ifndef Q_WS_MAC
+void UIMachineLogicSeamless::sltInvokePopupMenu()
+{
+    /* Popup main-menu if present: */
+    if (m_pPopupMenu && !m_pPopupMenu->isEmpty())
+    {
+        m_pPopupMenu->popup(activeMachineWindow()->geometry().center());
+        QTimer::singleShot(0, m_pPopupMenu, SLOT(sltHighlightFirstAction()));
+    }
+}
+#endif /* !Q_WS_MAC */
+
 void UIMachineLogicSeamless::sltScreenLayoutChanged()
 {
     LogRel(("UIMachineLogicSeamless::sltScreenLayoutChanged: Multi-screen layout changed.\n"));
@@ -188,21 +212,27 @@ void UIMachineLogicSeamless::prepareActionGroups()
     /* Call to base-class: */
     UIMachineLogic::prepareActionGroups();
 
-    /* Guest auto-resize isn't allowed in seamless: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setVisible(false);
-    /* Adjust-window isn't allowed in seamless: */
-    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(false);
-    /* Disable mouse-integration isn't allowed in seamless: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration)->setVisible(false);
+    /* Restrict 'Adjust Window', 'Guest Autoresize', 'Status Bar' and 'Resize' actions for 'View' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic,
+                                                         (UIExtraDataMetaDefs::RuntimeMenuViewActionType)
+                                                         (UIExtraDataMetaDefs::RuntimeMenuViewActionType_AdjustWindow |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_GuestAutoresize |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_MenuBar |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_StatusBar |
+                                                          UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize));
+#ifdef Q_WS_MAC
+    /* Restrict 'Window' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuBar(UIActionRestrictionLevel_Logic,
+                                                        UIExtraDataMetaDefs::MenuType_Window);
+#endif /* Q_WS_MAC */
 
     /* Take care of view-action toggle state: */
-    UIAction *pActionSeamless = gActionPool->action(UIActionIndexRuntime_Toggle_Seamless);
+    UIAction *pActionSeamless = actionPool()->action(UIActionIndexRT_M_View_T_Seamless);
     if (!pActionSeamless->isChecked())
     {
         pActionSeamless->blockSignals(true);
         pActionSeamless->setChecked(true);
         pActionSeamless->blockSignals(false);
-        pActionSeamless->update();
     }
 }
 
@@ -211,12 +241,12 @@ void UIMachineLogicSeamless::prepareActionConnections()
     /* Call to base-class: */
     UIMachineLogic::prepareActionConnections();
 
-    /* "View" actions connections: */
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
+    /* Prepare 'View' actions connections: */
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToNormal()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToFullscreen()));
-    connect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
+    connect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)),
             this, SLOT(sltChangeVisualStateToScale()));
 }
 
@@ -236,26 +266,45 @@ void UIMachineLogicSeamless::prepareMachineWindows()
     m_pScreenLayout->update();
 
     /* Create machine-window(s): */
-    for (uint cScreenId = 0; cScreenId < session().GetMachine().GetMonitorCount(); ++cScreenId)
+    for (uint cScreenId = 0; cScreenId < machine().GetMonitorCount(); ++cScreenId)
         addMachineWindow(UIMachineWindow::create(this, cScreenId));
 
+    /* Listen for frame-buffer resize: */
+    foreach (UIMachineWindow *pMachineWindow, machineWindows())
+        connect(pMachineWindow, SIGNAL(sigFrameBufferResize()),
+                this, SIGNAL(sigFrameBufferResize()));
+    emit sigFrameBufferResize();
+
     /* Connect multi-screen layout change handler: */
-    connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChanged()),
+    connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChange()),
             this, SLOT(sltScreenLayoutChanged()));
 
     /* Mark machine-window(s) created: */
     setMachineWindowsCreated(true);
 }
 
+#ifndef Q_WS_MAC
 void UIMachineLogicSeamless::prepareMenu()
 {
-    /* Call to base-class: */
-    UIMachineLogic::prepareMenu();
+    /* Prepare popup-menu: */
+    m_pPopupMenu = new QIMenu;
+    AssertPtrReturnVoid(m_pPopupMenu);
+    {
+        /* Prepare popup-menu: */
+        foreach (QMenu *pMenu, actionPool()->menus())
+            m_pPopupMenu->addMenu(pMenu);
+    }
+}
+#endif /* !Q_WS_MAC */
 
-    /* Finally update view-menu, if necessary: */
-    if (uisession()->allowedActionsMenuView() & RuntimeMenuViewActionType_Multiscreen)
-        m_pScreenLayout->setViewMenu(gActionPool->action(UIActionIndexRuntime_Menu_View)->menu());
+#ifndef Q_WS_MAC
+void UIMachineLogicSeamless::cleanupMenu()
+{
+    /* Cleanup popup-menu: */
+    delete m_pPopupMenu;
+    m_pPopupMenu = 0;
 }
+#endif /* !Q_WS_MAC */
 
 void UIMachineLogicSeamless::cleanupMachineWindows()
 {
@@ -274,11 +323,11 @@ void UIMachineLogicSeamless::cleanupMachineWindows()
 void UIMachineLogicSeamless::cleanupActionConnections()
 {
     /* "View" actions disconnections: */
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToNormal()));
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Fullscreen), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Fullscreen), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToFullscreen()));
-    disconnect(gActionPool->action(UIActionIndexRuntime_Toggle_Scale), SIGNAL(triggered(bool)),
+    disconnect(actionPool()->action(UIActionIndexRT_M_View_T_Scale), SIGNAL(triggered(bool)),
                this, SLOT(sltChangeVisualStateToScale()));
 
     /* Call to base-class: */
@@ -288,21 +337,22 @@ void UIMachineLogicSeamless::cleanupActionConnections()
 void UIMachineLogicSeamless::cleanupActionGroups()
 {
     /* Take care of view-action toggle state: */
-    UIAction *pActionSeamless = gActionPool->action(UIActionIndexRuntime_Toggle_Seamless);
+    UIAction *pActionSeamless = actionPool()->action(UIActionIndexRT_M_View_T_Seamless);
     if (pActionSeamless->isChecked())
     {
         pActionSeamless->blockSignals(true);
         pActionSeamless->setChecked(false);
         pActionSeamless->blockSignals(false);
-        pActionSeamless->update();
     }
 
-    /* Reenable guest-autoresize action: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_GuestAutoresize)->setVisible(true);
-    /* Reenable adjust-window action: */
-    gActionPool->action(UIActionIndexRuntime_Simple_AdjustWindow)->setVisible(true);
-    /* Reenable mouse-integration action: */
-    gActionPool->action(UIActionIndexRuntime_Toggle_MouseIntegration)->setVisible(true);
+    /* Allow 'Adjust Window', 'Guest Autoresize', 'Status Bar' and 'Resize' actions for 'View' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuView(UIActionRestrictionLevel_Logic,
+                                                         UIExtraDataMetaDefs::RuntimeMenuViewActionType_Invalid);
+#ifdef Q_WS_MAC
+    /* Allow 'Window' menu: */
+    actionPool()->toRuntime()->setRestrictionForMenuBar(UIActionRestrictionLevel_Logic,
+                                                        UIExtraDataMetaDefs::MenuType_Invalid);
+#endif /* Q_WS_MAC */
 
     /* Call to base-class: */
     UIMachineLogic::cleanupActionGroups();
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h
index 6904add..fee9979 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h
@@ -1,3 +1,4 @@
+/* $Id: UIMachineLogicSeamless.h $ */
 /** @file
  * VBox Qt GUI - UIMachineLogicSeamless class declaration.
  */
@@ -66,16 +67,25 @@ private slots:
     /** Handles host-screen count change. */
     virtual void sltHostScreenCountChange();
 
+#ifndef RT_OS_DARWIN
+    /** Invokes popup-menu. */
+    void sltInvokePopupMenu();
+#endif /* !RT_OS_DARWIN */
+
 private:
 
     /* Prepare helpers: */
     void prepareActionGroups();
     void prepareActionConnections();
     void prepareMachineWindows();
+#ifndef Q_WS_MAC
     void prepareMenu();
+#endif /* !Q_WS_MAC */
 
     /* Cleanup helpers: */
-    //void cleanupMenu() {}
+#ifndef Q_WS_MAC
+    void cleanupMenu();
+#endif /* !Q_WS_MAC */
     void cleanupMachineWindows();
     void cleanupActionConnections();
     void cleanupActionGroups();
@@ -83,6 +93,11 @@ private:
     /* Variables: */
     UIMultiScreenLayout *m_pScreenLayout;
 
+#ifndef RT_OS_DARWIN
+    /** Holds the popup-menu instance. */
+    QMenu *m_pPopupMenu;
+#endif /* !RT_OS_DARWIN */
+
     /* Friend classes: */
     friend class UIMachineLogic;
     friend class UIMachineWindowSeamless;
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
index 56b516c..33f0735 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineViewSeamless.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineViewSeamless class implementation
+ * VBox Qt GUI - UIMachineViewSeamless class implementation.
  */
 
 /*
@@ -17,32 +15,41 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QMainWindow>
-#include <QTimer>
-#ifdef Q_WS_MAC
-#include <QMenuBar>
-#endif /* Q_WS_MAC */
+# include <QApplication>
+# include <QDesktopWidget>
+# include <QMainWindow>
+# include <QTimer>
+# ifdef Q_WS_MAC
+#  include <QMenuBar>
+# endif /* Q_WS_MAC */
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIMachineLogicSeamless.h"
-#include "UIMachineWindow.h"
-#include "UIMachineViewSeamless.h"
-#include "UIFrameBuffer.h"
+# include "VBoxGlobal.h"
+# include "UISession.h"
+# include "UIMachineLogicSeamless.h"
+# include "UIMachineWindow.h"
+# include "UIMachineViewSeamless.h"
+# include "UIFrameBuffer.h"
+# include "UIExtraDataManager.h"
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CDisplay.h"
+# include "CConsole.h"
+# include "CDisplay.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* External includes: */
 #ifdef Q_WS_X11
-#include <limits.h>
+# include <limits.h>
 #endif /* Q_WS_X11 */
 
+
+
 UIMachineViewSeamless::UIMachineViewSeamless(  UIMachineWindow *pMachineWindow
                                              , ulong uScreenId
 #ifdef VBOX_WITH_VIDEOHWACCEL
@@ -77,7 +84,7 @@ void UIMachineViewSeamless::sltAdditionsStateChanged()
 void UIMachineViewSeamless::sltHandleSetVisibleRegion(QRegion region)
 {
     /* Apply new seamless-region: */
-    m_pFrameBuffer->applyVisibleRegion(region);
+    m_pFrameBuffer->handleSetVisibleRegion(region);
 }
 
 bool UIMachineViewSeamless::eventFilter(QObject *pWatched, QEvent *pEvent)
@@ -142,23 +149,27 @@ void UIMachineViewSeamless::prepareConsoleConnections()
 void UIMachineViewSeamless::prepareSeamless()
 {
     /* Set seamless feature flag to the guest: */
-    session().GetConsole().GetDisplay().SetSeamlessMode(true);
+    display().SetSeamlessMode(true);
 }
 
 void UIMachineViewSeamless::cleanupSeamless()
 {
-    /* If machine still running: */
+    /* Reset seamless feature flag if possible: */
     if (uisession()->isRunning())
-        /* Reset seamless feature flag of the guest: */
-        session().GetConsole().GetDisplay().SetSeamlessMode(false);
+        display().SetSeamlessMode(false);
 }
 
 void UIMachineViewSeamless::adjustGuestScreenSize()
 {
+    /* Acquire working-area size: */
+    const QSize workingAreaSize = workingArea().size();
+    /* Acquire frame-buffer size: */
+    QSize frameBufferSize(frameBuffer()->width(), frameBuffer()->height());
+    /* Take the scale-factor(s) into account: */
+    frameBufferSize = scaledForward(frameBufferSize);
     /* Check if we should adjust guest-screen to new size: */
     if (frameBuffer()->isAutoEnabled() ||
-        (int)frameBuffer()->width() != workingArea().size().width() ||
-        (int)frameBuffer()->height() != workingArea().size().height())
+        frameBufferSize != workingAreaSize)
         if (uisession()->isGuestSupportsGraphics() &&
             uisession()->isScreenVisible(screenId()))
         {
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
index c9726f6..b8f54b0 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineViewSeamless.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineViewSeamless class declaration
+ * VBox Qt GUI - UIMachineViewSeamless class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
index 339767a..378ff29 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineWindowSeamless.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindowSeamless class implementation
+ * VBox Qt GUI - UIMachineWindowSeamless class implementation.
  */
 
 /*
@@ -17,32 +15,38 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QMenu>
-#include <QTimer>
+# include <QDesktopWidget>
+# include <QMenu>
+# include <QTimer>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UISession.h"
-#include "UIActionPoolRuntime.h"
-#include "UIMachineLogicSeamless.h"
-#include "UIMachineWindowSeamless.h"
-#include "UIMachineView.h"
-#ifndef Q_WS_MAC
-# include "UIMachineDefs.h"
-# include "UIMiniToolBar.h"
-#endif /* !Q_WS_MAC */
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-#endif /* Q_WS_MAC */
+# include "VBoxGlobal.h"
+# include "UIExtraDataManager.h"
+# include "UISession.h"
+# include "UIActionPoolRuntime.h"
+# include "UIMachineLogicSeamless.h"
+# include "UIMachineWindowSeamless.h"
+# include "UIMachineView.h"
+# ifndef Q_WS_MAC
+#  include "UIMachineDefs.h"
+#  include "UIMiniToolBar.h"
+# else  /* Q_WS_MAC*/
+#  include "VBoxUtils.h"
+# endif /* Q_WS_MAC */
 
 /* COM includes: */
-#include "CSnapshot.h"
+# include "CSnapshot.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineWindowSeamless::UIMachineWindowSeamless(UIMachineLogic *pMachineLogic, ulong uScreenId)
     : UIMachineWindow(pMachineLogic, uScreenId)
-    , m_pMainMenu(0)
 #ifndef Q_WS_MAC
     , m_pMiniToolBar(0)
 #endif /* !Q_WS_MAC */
@@ -60,52 +64,19 @@ void UIMachineWindowSeamless::sltMachineStateChanged()
 }
 #endif /* !Q_WS_MAC */
 
-void UIMachineWindowSeamless::sltPopupMainMenu()
-{
-    /* Popup main-menu if present: */
-    if (m_pMainMenu && !m_pMainMenu->isEmpty())
-    {
-        m_pMainMenu->popup(geometry().center());
-        QTimer::singleShot(0, m_pMainMenu, SLOT(sltHighlightFirstAction()));
-    }
-}
-
 void UIMachineWindowSeamless::sltRevokeFocus()
 {
     /* Make sure window is visible: */
     if (!isVisible())
         return;
 
+#if   defined(Q_WS_WIN)
     /* Revoke stolen focus: */
     m_pMachineView->setFocus();
-}
-
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
-# ifdef Q_WS_X11
-void UIMachineWindowSeamless::sltUpdateMiniToolbarMask(const QRect &geo)
-{
-    /* Make sure mini-toolbar exists: */
-    AssertPtrReturnVoid(m_pMiniToolBar);
-
-    /* Remember mini-toolbar mask: */
-    m_maskMiniToolbar = geo;
-
-    /* Re-assign guest mask. */
-    setMask(m_maskGuest);
-}
-# endif /* Q_WS_X11 */
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
-
-void UIMachineWindowSeamless::prepareMenu()
-{
-    /* Call to base-class: */
-    UIMachineWindow::prepareMenu();
-
-    /* Prepare menu: */
-    CMachine machine = session().GetMachine();
-    RuntimeMenuType restrictedMenus = VBoxGlobal::restrictedRuntimeMenuTypes(machine);
-    RuntimeMenuType allowedMenus = static_cast<RuntimeMenuType>(RuntimeMenuType_All ^ restrictedMenus);
-    m_pMainMenu = uisession()->newMenu(allowedMenus);
+#elif defined(Q_WS_MAC) || defined(Q_WS_X11)
+    /* Revoke stolen activation: */
+    activateWindow();
+#endif /* Q_WS_MAC || Q_WS_X11 */
 }
 
 void UIMachineWindowSeamless::prepareVisualState()
@@ -128,15 +99,16 @@ void UIMachineWindowSeamless::prepareVisualState()
     /* Using Qt API to enable translucent background:
      * - Under Win host Qt conflicts with 3D stuff (black seamless regions).
      * - Under Mac host Qt doesn't allows to disable window-shadows
-     *   until version 4.8, but minimum supported version is 4.7.1 for now.
-     * - Under x11 host Qt has it broken with KDE 4.9 (black background): */
+     *   until version 4.8, but minimum supported version is 4.7.1 for now. */
     setAttribute(Qt::WA_TranslucentBackground);
 # endif /* !Q_WS_MAC */
-#else /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+#endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS */
+
+#ifdef VBOX_WITH_MASKED_SEAMLESS
     /* Make sure we have no background
      * until the first one set-region-event: */
     setMask(m_maskGuest);
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+#endif /* VBOX_WITH_MASKED_SEAMLESS */
 
 #ifndef Q_WS_MAC
     /* Prepare mini-toolbar: */
@@ -147,43 +119,24 @@ void UIMachineWindowSeamless::prepareVisualState()
 #ifndef Q_WS_MAC
 void UIMachineWindowSeamless::prepareMiniToolbar()
 {
-    /* Get machine: */
-    CMachine m = machine();
-
-    /* Make sure mini-toolbar is necessary: */
-    bool fIsActive = m.GetExtraData(GUI_ShowMiniToolBar) != "no";
-    if (!fIsActive)
+    /* Make sure mini-toolbar is not restricted: */
+    if (!gEDataManager->miniToolbarEnabled(vboxGlobal().managedVMUuid()))
         return;
 
-    /* Get the mini-toolbar alignment: */
-    bool fIsAtTop = m.GetExtraData(GUI_MiniToolBarAlignment) == "top";
-    /* Get the mini-toolbar auto-hide feature availability: */
-    bool fIsAutoHide = m.GetExtraData(GUI_MiniToolBarAutoHide) != "off";
     /* Create mini-toolbar: */
     m_pMiniToolBar = new UIRuntimeMiniToolBar(this,
                                               GeometryType_Available,
-                                              fIsAtTop ? Qt::AlignTop : Qt::AlignBottom,
-                                              fIsAutoHide);
+                                              gEDataManager->miniToolbarAlignment(vboxGlobal().managedVMUuid()),
+                                              gEDataManager->autoHideMiniToolbar(vboxGlobal().managedVMUuid()));
     m_pMiniToolBar->show();
-    QList<QMenu*> menus;
-    RuntimeMenuType restrictedMenus = VBoxGlobal::restrictedRuntimeMenuTypes(m);
-    RuntimeMenuType allowedMenus = static_cast<RuntimeMenuType>(RuntimeMenuType_All ^ restrictedMenus);
-    QList<QAction*> actions = uisession()->newMenu(allowedMenus)->actions();
-    for (int i=0; i < actions.size(); ++i)
-        menus << actions.at(i)->menu();
-    m_pMiniToolBar->addMenus(menus);
+    m_pMiniToolBar->addMenus(actionPool()->menus());
     connect(m_pMiniToolBar, SIGNAL(sigMinimizeAction()), this, SLOT(showMinimized()));
     connect(m_pMiniToolBar, SIGNAL(sigExitAction()),
-            gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SLOT(trigger()));
+            actionPool()->action(UIActionIndexRT_M_View_T_Seamless), SLOT(trigger()));
     connect(m_pMiniToolBar, SIGNAL(sigCloseAction()),
-            gActionPool->action(UIActionIndexRuntime_Simple_Close), SLOT(trigger()));
-    connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutFocusStolen()), this, SLOT(sltRevokeFocus()));
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
-# ifdef Q_WS_X11
-    connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutGeometryChange(const QRect&)),
-            this, SLOT(sltUpdateMiniToolbarMask(const QRect&)));
-# endif /* Q_WS_X11 */
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+            actionPool()->action(UIActionIndex_M_Application_S_Close), SLOT(trigger()));
+    connect(m_pMiniToolBar, SIGNAL(sigNotifyAboutFocusStolen()),
+            this, SLOT(sltRevokeFocus()), Qt::QueuedConnection);
 }
 #endif /* !Q_WS_MAC */
 
@@ -195,7 +148,7 @@ void UIMachineWindowSeamless::cleanupMiniToolbar()
         return;
 
     /* Save mini-toolbar settings: */
-    machine().SetExtraData(GUI_MiniToolBarAutoHide, m_pMiniToolBar->autoHide() ? QString() : "off");
+    gEDataManager->setAutoHideMiniToolbar(m_pMiniToolBar->autoHide(), vboxGlobal().managedVMUuid());
     /* Delete mini-toolbar: */
     delete m_pMiniToolBar;
     m_pMiniToolBar = 0;
@@ -213,21 +166,11 @@ void UIMachineWindowSeamless::cleanupVisualState()
     UIMachineWindow::cleanupVisualState();
 }
 
-void UIMachineWindowSeamless::cleanupMenu()
-{
-    /* Cleanup menu: */
-    delete m_pMainMenu;
-    m_pMainMenu = 0;
-
-    /* Call to base-class: */
-    UIMachineWindow::cleanupMenu();
-}
-
 void UIMachineWindowSeamless::placeOnScreen()
 {
     /* Get corresponding screen: */
     int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
-    /* And corresponding working area: */
+    /* Calculate working area: */
     QRect workingArea = QApplication::desktop()->availableGeometry(iScreen);
 
     /* Move to the appropriate position: */
@@ -248,9 +191,12 @@ void UIMachineWindowSeamless::showInNecessaryMode()
         !pSeamlessLogic->hasHostScreenForGuestScreen(m_uScreenId))
     {
 #ifndef Q_WS_MAC
-        /* Hide mini-toolbar: */
+        /* If there is mini-toolbar: */
         if (m_pMiniToolBar)
+        {
+            /* Just hide mini-toolbar: */
             m_pMiniToolBar->hide();
+        }
 #endif /* !Q_WS_MAC */
         /* Hide window: */
         hide();
@@ -271,10 +217,23 @@ void UIMachineWindowSeamless::showInNecessaryMode()
     adjustMachineViewSize();
 
 #ifndef Q_WS_MAC
-    /* Show mini-toolbar: */
+    /* If there is mini-toolbar: */
     if (m_pMiniToolBar)
+    {
+# if   defined(Q_WS_WIN)
+        /* Just show mini-toolbar: */
         m_pMiniToolBar->show();
+# elif defined(Q_WS_X11)
+        /* Allow mini-toolbar to be located on full-screen area: */
+        m_pMiniToolBar->showMaximized();
+        /* Make sure mini-toolbar is always on top of machine-window: */
+        VBoxGlobal::setTransientFor(m_pMiniToolBar, this);
+# endif /* Q_WS_X11 */
+    }
 #endif /* !Q_WS_MAC */
+
+    /* Make sure machine-view have focus: */
+    m_pMachineView->setFocus();
 }
 
 void UIMachineWindowSeamless::adjustMachineViewSize()
@@ -310,25 +269,26 @@ void UIMachineWindowSeamless::updateAppearanceOf(int iElement)
     {
         if (m_pMiniToolBar)
         {
-            /* Get machine: */
-            const CMachine &m = machine();
             /* Get snapshot(s): */
             QString strSnapshotName;
-            if (m.GetSnapshotCount() > 0)
+            if (machine().GetSnapshotCount() > 0)
             {
-                CSnapshot snapshot = m.GetCurrentSnapshot();
+                CSnapshot snapshot = machine().GetCurrentSnapshot();
                 strSnapshotName = " (" + snapshot.GetName() + ")";
             }
             /* Update mini-toolbar text: */
-            m_pMiniToolBar->setText(m.GetName() + strSnapshotName);
+            m_pMiniToolBar->setText(machineName() + strSnapshotName);
         }
     }
 }
 #endif /* !Q_WS_MAC */
 
 #if defined(VBOX_WITH_TRANSLUCENT_SEAMLESS) && defined(Q_WS_WIN)
-void UIMachineWindowSeamless::showEvent(QShowEvent*)
+void UIMachineWindowSeamless::showEvent(QShowEvent *pShowEvent)
 {
+    /* Call to base class: */
+    UIMachineWindow::showEvent(pShowEvent);
+
     /* Following workaround allows to fix the next Qt BUG:
      * https://bugreports.qt-project.org/browse/QTBUG-17548
      * https://bugreports.qt-project.org/browse/QTBUG-30974
@@ -338,7 +298,7 @@ void UIMachineWindowSeamless::showEvent(QShowEvent*)
 }
 #endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS && Q_WS_WIN */
 
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
+#ifdef VBOX_WITH_MASKED_SEAMLESS
 void UIMachineWindowSeamless::setMask(const QRegion &maskGuest)
 {
     /* Remember new guest mask: */
@@ -351,12 +311,6 @@ void UIMachineWindowSeamless::setMask(const QRegion &maskGuest)
     if (m_pLeftSpacer->geometry().width() || m_pTopSpacer->geometry().height())
         maskFull.translate(m_pLeftSpacer->geometry().width(), m_pTopSpacer->geometry().height());
 
-# ifdef Q_WS_X11
-    /* Take into account mini-toolbar mask if necessary: */
-    if (m_pMiniToolBar)
-        maskFull += m_maskMiniToolbar;
-# endif /* Q_WS_X11 */
-
     /* Seamless-window for empty full mask should be empty too,
      * but the QWidget::setMask() wrapper doesn't allow this.
      * Instead, we see a full guest-screen of available-geometry size.
@@ -377,5 +331,5 @@ void UIMachineWindowSeamless::setMask(const QRegion &maskGuest)
         m_pMachineView->viewport()->update(toUpdate);
     }
 }
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+#endif /* VBOX_WITH_MASKED_SEAMLESS */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
index 5e15568..947eb1f 100644
--- a/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineWindowSeamless.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMachineWindowSeamless class declaration
+ * VBox Qt GUI - UIMachineWindowSeamless class declaration.
  */
 
 /*
@@ -22,8 +21,10 @@
 /* Local includes: */
 #include "UIMachineWindow.h"
 
+#ifndef Q_WS_MAC
 /* Forward declarations: */
 class UIRuntimeMiniToolBar;
+#endif /* !Q_WS_MAC */
 
 /* Seamless machine-window implementation: */
 class UIMachineWindowSeamless : public UIMachineWindow
@@ -42,23 +43,12 @@ private slots:
     void sltMachineStateChanged();
 #endif /* !Q_WS_MAC */
 
-    /* Popup main menu: */
-    void sltPopupMainMenu();
-
     /** Revokes keyboard-focus. */
     void sltRevokeFocus();
 
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
-# ifdef Q_WS_X11
-    /** Assigns mini-toolbar seamless mask. */
-    void sltUpdateMiniToolbarMask(const QRect &geo);
-# endif /* Q_WS_X11 */
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
-
 private:
 
     /* Prepare helpers: */
-    void prepareMenu();
     void prepareVisualState();
 #ifndef Q_WS_MAC
     void prepareMiniToolbar();
@@ -69,7 +59,6 @@ private:
     void cleanupMiniToolbar();
 #endif /* !Q_WS_MAC */
     void cleanupVisualState();
-    void cleanupMenu();
 
     /* Show stuff: */
     void placeOnScreen();
@@ -88,27 +77,22 @@ private:
     void showEvent(QShowEvent *pEvent);
 #endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS && Q_WS_WIN */
 
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
+#ifdef VBOX_WITH_MASKED_SEAMLESS
     /** Assigns guest seamless mask. */
     void setMask(const QRegion &maskGuest);
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+#endif /* VBOX_WITH_MASKED_SEAMLESS */
 
-    /* Widgets: */
-    QMenu *m_pMainMenu;
 #ifndef Q_WS_MAC
+    /** Holds the mini-toolbar instance. */
     UIRuntimeMiniToolBar *m_pMiniToolBar;
 #endif /* !Q_WS_MAC */
 
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
+#ifdef VBOX_WITH_MASKED_SEAMLESS
     /** Holds the full seamless mask. */
     QRegion m_maskFull;
     /** Holds the guest seamless mask. */
     QRegion m_maskGuest;
-# ifdef Q_WS_X11
-    /** Holds the mini-toolbar seamless mask. */
-    QRect m_maskMiniToolbar;
-# endif /* Q_WS_X11 */
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
+#endif /* VBOX_WITH_MASKED_SEAMLESS */
 
     /* Factory support: */
     friend class UIMachineWindow;
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp b/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
index b57123b..d14c171 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIActionPoolSelector.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIActionPoolSelector class implementation
+ * VBox Qt GUI - UIActionPoolSelector class implementation.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,10 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Local includes: */
-#include "UIActionPoolSelector.h"
-#include "UIShortcutPool.h"
-#include "UIDefs.h"
+# include "UIActionPoolSelector.h"
+# include "UIExtraDataDefs.h"
+# include "UIShortcutPool.h"
+# include "UIDefs.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+
 
 class UIActionMenuFile : public UIActionMenu
 {
@@ -29,10 +39,7 @@ class UIActionMenuFile : public UIActionMenu
 public:
 
     UIActionMenuFile(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
+        : UIActionMenu(pParent) {}
 
 protected:
 
@@ -53,10 +60,7 @@ class UIActionSimpleMediumManagerDialog : public UIActionSimple
 public:
 
     UIActionSimpleMediumManagerDialog(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/diskimage_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/diskimage_16px.png") {}
 
 protected:
 
@@ -84,10 +88,7 @@ class UIActionSimpleImportApplianceWizard : public UIActionSimple
 public:
 
     UIActionSimpleImportApplianceWizard(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/import_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/import_16px.png") {}
 
 protected:
 
@@ -115,10 +116,7 @@ class UIActionSimpleExportApplianceWizard : public UIActionSimple
 public:
 
     UIActionSimpleExportApplianceWizard(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/export_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/export_16px.png") {}
 
 protected:
 
@@ -139,37 +137,35 @@ protected:
     }
 };
 
-class UIActionSimplePreferencesDialog : public UIActionSimple
+#ifdef DEBUG
+class UIActionSimpleExtraDataManagerWindow : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimplePreferencesDialog(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/global_settings_16px.png")
-    {
-        setMenuRole(QAction::PreferencesRole);
-        retranslateUi();
-    }
+    UIActionSimpleExtraDataManagerWindow(UIActionPool *pParent)
+        : UIActionSimple(pParent, ":/edataman_16px.png") {}
 
 protected:
 
     QString shortcutExtraDataID() const
     {
-        return QString("Preferences");
+        return QString("ExtraDataManager");
     }
 
     QKeySequence defaultShortcut(UIActionPoolType) const
     {
-        return QKeySequence("Ctrl+G");
+        return QKeySequence("Ctrl+X");
     }
 
     void retranslateUi()
     {
-        setName(QApplication::translate("UIActionPool", "&Preferences...", "global settings"));
-        setStatusTip(QApplication::translate("UIActionPool", "Display the global settings window"));
+        setName(QApplication::translate("UIActionPool", "E&xtra Data Manager..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Display the Extra Data Manager window"));
     }
 };
+#endif /* DEBUG */
 
 class UIActionSimpleExit : public UIActionSimple
 {
@@ -181,7 +177,6 @@ public:
         : UIActionSimple(pParent, ":/exit_16px.png")
     {
         setMenuRole(QAction::QuitRole);
-        retranslateUi();
     }
 
 protected:
@@ -211,10 +206,7 @@ class UIActionMenuGroup : public UIActionMenu
 public:
 
     UIActionMenuGroup(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
+        : UIActionMenu(pParent) {}
 
 protected:
 
@@ -231,10 +223,7 @@ class UIActionSimpleGroupNew : public UIActionSimple
 public:
 
     UIActionSimpleGroupNew(UIActionPool *pParent)
-        : UIActionSimple(pParent, QSize(32, 32), QSize(16, 16), ":/vm_new_32px.png", ":/vm_new_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_new_32px.png", ":/vm_new_16px.png") {}
 
 protected:
 
@@ -264,10 +253,7 @@ class UIActionSimpleGroupAdd : public UIActionSimple
 public:
 
     UIActionSimpleGroupAdd(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_add_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_add_16px.png") {}
 
 protected:
 
@@ -295,10 +281,7 @@ class UIActionSimpleGroupRename : public UIActionSimple
 public:
 
     UIActionSimpleGroupRename(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_group_name_16px.png", ":/vm_group_name_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_group_name_16px.png", ":/vm_group_name_disabled_16px.png") {}
 
 protected:
 
@@ -326,10 +309,7 @@ class UIActionSimpleGroupRemove : public UIActionSimple
 public:
 
     UIActionSimpleGroupRemove(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_group_remove_16px.png", ":/vm_group_remove_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_group_remove_16px.png", ":/vm_group_remove_disabled_16px.png") {}
 
 protected:
 
@@ -357,10 +337,7 @@ class UIActionSimpleGroupSort : public UIActionSimple
 public:
 
     UIActionSimpleGroupSort(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/sort_16px.png", ":/sort_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/sort_16px.png", ":/sort_disabled_16px.png") {}
 
 protected:
 
@@ -384,10 +361,7 @@ class UIActionMenuMachineSelector : public UIActionMenu
 public:
 
     UIActionMenuMachineSelector(UIActionPool *pParent)
-        : UIActionMenu(pParent)
-    {
-        retranslateUi();
-    }
+        : UIActionMenu(pParent) {}
 
 protected:
 
@@ -404,10 +378,7 @@ class UIActionSimpleMachineNew : public UIActionSimple
 public:
 
     UIActionSimpleMachineNew(UIActionPool *pParent)
-        : UIActionSimple(pParent, QSize(32, 32), QSize(16, 16), ":/vm_new_32px.png", ":/vm_new_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_new_32px.png", ":/vm_new_16px.png") {}
 
 protected:
 
@@ -437,10 +408,7 @@ class UIActionSimpleMachineAdd : public UIActionSimple
 public:
 
     UIActionSimpleMachineAdd(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_add_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_add_16px.png") {}
 
 protected:
 
@@ -468,10 +436,7 @@ class UIActionSimpleMachineAddGroup : public UIActionSimple
 public:
 
     UIActionSimpleMachineAddGroup(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_group_create_16px.png", ":/vm_group_create_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_group_create_16px.png", ":/vm_group_create_disabled_16px.png") {}
 
 protected:
 
@@ -499,12 +464,9 @@ class UIActionSimpleMachineSettings : public UIActionSimple
 public:
 
     UIActionSimpleMachineSettings(UIActionPool *pParent)
-        : UIActionSimple(pParent, QSize(32, 32), QSize(16, 16),
+        : UIActionSimple(pParent,
                          ":/vm_settings_32px.png", ":/vm_settings_16px.png",
-                         ":/vm_settings_disabled_32px.png", ":/vm_settings_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/vm_settings_disabled_32px.png", ":/vm_settings_disabled_16px.png") {}
 
 protected:
 
@@ -534,10 +496,7 @@ class UIActionSimpleMachineClone : public UIActionSimple
 public:
 
     UIActionSimpleMachineClone(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_clone_16px.png", ":/vm_clone_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_clone_16px.png", ":/vm_clone_disabled_16px.png") {}
 
 protected:
 
@@ -565,12 +524,9 @@ class UIActionSimpleMachineRemove : public UIActionSimple
 public:
 
     UIActionSimpleMachineRemove(UIActionPool *pParent)
-        : UIActionSimple(pParent, QSize(32, 32), QSize(16, 16),
+        : UIActionSimple(pParent,
                          ":/vm_delete_32px.png", ":/vm_delete_16px.png",
-                         ":/vm_delete_disabled_32px.png", ":/vm_delete_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/vm_delete_disabled_32px.png", ":/vm_delete_disabled_16px.png") {}
 
 protected:
 
@@ -592,19 +548,16 @@ protected:
 };
 
 
-class UIActionStateCommonStartOrShow : public UIActionState
+class UIActionStateCommonStartOrShow : public UIActionPolymorphicMenu
 {
     Q_OBJECT;
 
 public:
 
     UIActionStateCommonStartOrShow(UIActionPool *pParent)
-        : UIActionState(pParent, QSize(32, 32), QSize(16, 16),
-                        ":/vm_start_32px.png", ":/vm_start_16px.png",
-                        ":/vm_start_disabled_32px.png", ":/vm_start_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionPolymorphicMenu(pParent,
+                                  ":/vm_start_32px.png", ":/vm_start_16px.png",
+                                  ":/vm_start_disabled_32px.png", ":/vm_start_disabled_16px.png") {}
 
 protected:
 
@@ -615,10 +568,11 @@ protected:
 
     void retranslateUi()
     {
-        switch (m_iState)
+        switch (state())
         {
             case 0:
             {
+                showMenu();
                 setName(QApplication::translate("UIActionPool", "S&tart"));
                 setStatusTip(QApplication::translate("UIActionPool", "Start the selected virtual machines"));
                 setToolTip(text().remove('&').remove('.') +
@@ -627,6 +581,7 @@ protected:
             }
             case 1:
             {
+                hideMenu();
                 setName(QApplication::translate("UIActionPool", "S&how"));
                 setStatusTip(QApplication::translate("UIActionPool", "Switch to the windows of the selected virtual machines"));
                 setToolTip(text().remove('&').remove('.') +
@@ -639,6 +594,81 @@ protected:
     }
 };
 
+class UIActionSimpleStartNormal : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleStartNormal(UIActionPool *pParent)
+        : UIActionSimple(pParent,
+                         ":/vm_start_32px.png", ":/vm_start_16px.png",
+                         ":/vm_start_disabled_32px.png", ":/vm_start_disabled_16px.png") {}
+
+protected:
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("StartVMNormal");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Normal Start"));
+        setStatusTip(QApplication::translate("UIActionPool", "Start the selected virtual machines"));
+    }
+};
+
+class UIActionSimpleStartHeadless : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleStartHeadless(UIActionPool *pParent)
+        : UIActionSimple(pParent,
+                         ":/vm_start_32px.png", ":/vm_start_16px.png",
+                         ":/vm_start_disabled_32px.png", ":/vm_start_disabled_16px.png") {}
+
+protected:
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("StartVMHeadless");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Headless Start"));
+        setStatusTip(QApplication::translate("UIActionPool", "Start the selected virtual machines in the background"));
+    }
+};
+
+class UIActionSimpleStartDetachable : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleStartDetachable(UIActionPool *pParent)
+        : UIActionSimple(pParent,
+                         ":/vm_start_32px.png", ":/vm_start_16px.png",
+                         ":/vm_start_disabled_32px.png", ":/vm_start_disabled_16px.png") {}
+
+protected:
+
+    QString shortcutExtraDataID() const
+    {
+        return QString("StartVMDetachable");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "&Detachable Start"));
+        setStatusTip(QApplication::translate("UIActionPool", "Start the selected virtual machines with the option of continuing them in the background"));
+    }
+};
+
 class UIActionToggleCommonPauseAndResume : public UIActionToggle
 {
     Q_OBJECT;
@@ -646,12 +676,9 @@ class UIActionToggleCommonPauseAndResume : public UIActionToggle
 public:
 
     UIActionToggleCommonPauseAndResume(UIActionPool *pParent)
-        : UIActionToggle(pParent, QSize(32, 32), QSize(16, 16),
+        : UIActionToggle(pParent,
                          ":/vm_pause_32px.png", ":/vm_pause_16px.png",
-                         ":/vm_pause_disabled_32px.png", ":/vm_pause_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/vm_pause_disabled_32px.png", ":/vm_pause_disabled_16px.png") {}
 
 protected:
 
@@ -679,10 +706,7 @@ class UIActionSimpleCommonReset : public UIActionSimple
 public:
 
     UIActionSimpleCommonReset(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_reset_16px.png", ":/vm_reset_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_reset_16px.png", ":/vm_reset_disabled_16px.png") {}
 
 protected:
 
@@ -710,12 +734,9 @@ class UIActionSimpleCommonDiscard : public UIActionSimple
 public:
 
     UIActionSimpleCommonDiscard(UIActionPool *pParent)
-        : UIActionSimple(pParent, QSize(32, 32), QSize(16, 16),
+        : UIActionSimple(pParent,
                          ":/vm_discard_32px.png", ":/vm_discard_16px.png",
-                         ":/vm_discard_disabled_32px.png", ":/vm_discard_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+                         ":/vm_discard_disabled_32px.png", ":/vm_discard_disabled_16px.png") {}
 
 protected:
 
@@ -739,16 +760,16 @@ protected:
     }
 };
 
-class UIActionSimpleCommonRefresh : public UIActionSimple
+class UIActionSimpleCommonShowLogDialog : public UIActionSimple
 {
     Q_OBJECT;
 
 public:
 
-    UIActionSimpleCommonRefresh(UIActionPool *pParent)
-        : UIActionSimple(pParent, QSize(32, 32), QSize(16, 16),
-                         ":/refresh_32px.png", ":/refresh_16px.png",
-                         ":/refresh_disabled_32px.png", ":/refresh_disabled_16px.png")
+    UIActionSimpleCommonShowLogDialog(UIActionPool *pParent)
+        : UIActionSimple(pParent,
+                         ":/vm_show_logs_32px.png", ":/vm_show_logs_16px.png",
+                         ":/vm_show_logs_disabled_32px.png", ":/vm_show_logs_disabled_16px.png")
     {
         retranslateUi();
     }
@@ -757,6 +778,36 @@ protected:
 
     QString shortcutExtraDataID() const
     {
+        return QString("ShowVMLog");
+    }
+
+    QKeySequence defaultShortcut(UIActionPoolType) const
+    {
+        return QKeySequence("Ctrl+L");
+    }
+
+    void retranslateUi()
+    {
+        setName(QApplication::translate("UIActionPool", "Show &Log..."));
+        setStatusTip(QApplication::translate("UIActionPool", "Show the log files of the selected virtual machine"));
+    }
+};
+
+class UIActionSimpleCommonRefresh : public UIActionSimple
+{
+    Q_OBJECT;
+
+public:
+
+    UIActionSimpleCommonRefresh(UIActionPool *pParent)
+        : UIActionSimple(pParent,
+                         ":/refresh_32px.png", ":/refresh_16px.png",
+                         ":/refresh_disabled_32px.png", ":/refresh_disabled_16px.png") {}
+
+protected:
+
+    QString shortcutExtraDataID() const
+    {
         return QString("RefreshVM");
     }
 
@@ -774,10 +825,7 @@ class UIActionSimpleCommonShowInFileManager : public UIActionSimple
 public:
 
     UIActionSimpleCommonShowInFileManager(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_open_filemanager_16px.png", ":/vm_open_filemanager_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_open_filemanager_16px.png", ":/vm_open_filemanager_disabled_16px.png") {}
 
 protected:
 
@@ -808,10 +856,7 @@ class UIActionSimpleCommonCreateShortcut : public UIActionSimple
 public:
 
     UIActionSimpleCommonCreateShortcut(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png") {}
 
 protected:
 
@@ -839,10 +884,7 @@ class UIActionSimpleMachineSortParent : public UIActionSimple
 public:
 
     UIActionSimpleMachineSortParent(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/sort_16px.png", ":/sort_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/sort_16px.png", ":/sort_disabled_16px.png") {}
 
 protected:
 
@@ -866,10 +908,7 @@ class UIActionMenuClose : public UIActionMenu
 public:
 
     UIActionMenuClose(UIActionPool *pParent)
-        : UIActionMenu(pParent, ":/exit_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionMenu(pParent, ":/exit_16px.png") {}
 
 protected:
 
@@ -886,10 +925,7 @@ class UIActionSimpleSave : public UIActionSimple
 public:
 
     UIActionSimpleSave(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_save_state_16px.png", ":/vm_save_state_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_save_state_16px.png", ":/vm_save_state_disabled_16px.png") {}
 
 protected:
 
@@ -917,10 +953,7 @@ class UIActionSimpleACPIShutdown : public UIActionSimple
 public:
 
     UIActionSimpleACPIShutdown(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_shutdown_16px.png", ":/vm_shutdown_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_shutdown_16px.png", ":/vm_shutdown_disabled_16px.png") {}
 
 protected:
 
@@ -948,10 +981,7 @@ class UIActionSimplePowerOff : public UIActionSimple
 public:
 
     UIActionSimplePowerOff(UIActionPool *pParent)
-        : UIActionSimple(pParent, ":/vm_poweroff_16px.png", ":/vm_poweroff_disabled_16px.png")
-    {
-        retranslateUi();
-    }
+        : UIActionSimple(pParent, ":/vm_poweroff_16px.png", ":/vm_poweroff_disabled_16px.png") {}
 
 protected:
 
@@ -973,88 +1003,102 @@ protected:
 };
 
 
-UIActionPoolSelector::UIActionPoolSelector()
-    : UIActionPool(UIActionPoolType_Selector)
+UIActionPoolSelector::UIActionPoolSelector(bool fTemporary /* = false */)
+    : UIActionPool(UIActionPoolType_Selector, fTemporary)
 {
-    /* Prepare connections: */
-    connect(gShortcutPool, SIGNAL(sigSelectorShortcutsReloaded()), this, SLOT(sltApplyShortcuts()));
-}
-
-void UIActionPoolSelector::retranslateUi()
-{
-    /* Translate all the actions: */
-    foreach (const int iActionPoolKey, m_pool.keys())
-        m_pool[iActionPoolKey]->retranslateUi();
-    /* Re-apply Selector UI shortcuts: */
-    sltApplyShortcuts();
-    /* Temporary create Runtime UI pool to do the same: */
-    UIActionPool::createTemporary(UIActionPoolType_Runtime);
 }
 
-QString UIActionPoolSelector::shortcutsExtraDataID() const
-{
-    return GUI_Input_SelectorShortcuts;
-}
-
-void UIActionPoolSelector::createActions()
+void UIActionPoolSelector::preparePool()
 {
-    /* Global actions creation: */
-    UIActionPool::createActions();
-
     /* 'File' actions: */
-    m_pool[UIActionIndexSelector_Simple_File_MediumManagerDialog] = new UIActionSimpleMediumManagerDialog(this);
-    m_pool[UIActionIndexSelector_Simple_File_ImportApplianceWizard] = new UIActionSimpleImportApplianceWizard(this);
-    m_pool[UIActionIndexSelector_Simple_File_ExportApplianceWizard] = new UIActionSimpleExportApplianceWizard(this);
-    m_pool[UIActionIndexSelector_Simple_File_PreferencesDialog] = new UIActionSimplePreferencesDialog(this);
-    m_pool[UIActionIndexSelector_Simple_File_Exit] = new UIActionSimpleExit(this);
+    m_pool[UIActionIndexST_M_File] = new UIActionMenuFile(this);
+    m_pool[UIActionIndexST_M_File_S_ShowMediumManager] = new UIActionSimpleMediumManagerDialog(this);
+    m_pool[UIActionIndexST_M_File_S_ImportAppliance] = new UIActionSimpleImportApplianceWizard(this);
+    m_pool[UIActionIndexST_M_File_S_ExportAppliance] = new UIActionSimpleExportApplianceWizard(this);
+#ifdef DEBUG
+    m_pool[UIActionIndexST_M_File_S_ShowExtraDataManager] = new UIActionSimpleExtraDataManagerWindow(this);
+#endif /* DEBUG */
+    m_pool[UIActionIndexST_M_File_S_Close] = new UIActionSimpleExit(this);
 
     /* 'Group' actions: */
-    m_pool[UIActionIndexSelector_Simple_Group_New] = new UIActionSimpleGroupNew(this);
-    m_pool[UIActionIndexSelector_Simple_Group_Add] = new UIActionSimpleGroupAdd(this);
-    m_pool[UIActionIndexSelector_Simple_Group_Rename] = new UIActionSimpleGroupRename(this);
-    m_pool[UIActionIndexSelector_Simple_Group_Remove] = new UIActionSimpleGroupRemove(this);
-    m_pool[UIActionIndexSelector_Simple_Group_Sort] = new UIActionSimpleGroupSort(this);
-    m_pool[UIActionIndexSelector_Simple_Group_Close_Save] = new UIActionSimpleSave(this);
-    m_pool[UIActionIndexSelector_Simple_Group_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this);
-    m_pool[UIActionIndexSelector_Simple_Group_Close_PowerOff] = new UIActionSimplePowerOff(this);
+    m_pool[UIActionIndexST_M_Group] = new UIActionMenuGroup(this);
+    m_pool[UIActionIndexST_M_Group_S_New] = new UIActionSimpleGroupNew(this);
+    m_pool[UIActionIndexST_M_Group_S_Add] = new UIActionSimpleGroupAdd(this);
+    m_pool[UIActionIndexST_M_Group_S_Rename] = new UIActionSimpleGroupRename(this);
+    m_pool[UIActionIndexST_M_Group_S_Remove] = new UIActionSimpleGroupRemove(this);
+    m_pool[UIActionIndexST_M_Group_M_StartOrShow] = new UIActionStateCommonStartOrShow(this);
+    m_pool[UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal] = new UIActionSimpleStartNormal(this);
+    m_pool[UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless] = new UIActionSimpleStartHeadless(this);
+    m_pool[UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable] = new UIActionSimpleStartDetachable(this);
+    m_pool[UIActionIndexST_M_Group_T_Pause] = new UIActionToggleCommonPauseAndResume(this);
+    m_pool[UIActionIndexST_M_Group_S_Reset] = new UIActionSimpleCommonReset(this);
+    m_pool[UIActionIndexST_M_Group_M_Close] = new UIActionMenuClose(this);
+    m_pool[UIActionIndexST_M_Group_M_Close_S_SaveState] = new UIActionSimpleSave(this);
+    m_pool[UIActionIndexST_M_Group_M_Close_S_Shutdown] = new UIActionSimpleACPIShutdown(this);
+    m_pool[UIActionIndexST_M_Group_M_Close_S_PowerOff] = new UIActionSimplePowerOff(this);
+    m_pool[UIActionIndexST_M_Group_S_Discard] = new UIActionSimpleCommonDiscard(this);
+    m_pool[UIActionIndexST_M_Group_S_ShowLogDialog] = new UIActionSimpleCommonShowLogDialog(this);
+    m_pool[UIActionIndexST_M_Group_S_Refresh] = new UIActionSimpleCommonRefresh(this);
+    m_pool[UIActionIndexST_M_Group_S_ShowInFileManager] = new UIActionSimpleCommonShowInFileManager(this);
+    m_pool[UIActionIndexST_M_Group_S_CreateShortcut] = new UIActionSimpleCommonCreateShortcut(this);
+    m_pool[UIActionIndexST_M_Group_S_Sort] = new UIActionSimpleGroupSort(this);
 
     /* 'Machine' actions: */
-    m_pool[UIActionIndexSelector_Simple_Machine_New] = new UIActionSimpleMachineNew(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_Add] = new UIActionSimpleMachineAdd(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_Settings] = new UIActionSimpleMachineSettings(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_Clone] = new UIActionSimpleMachineClone(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_Remove] = new UIActionSimpleMachineRemove(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_AddGroup] = new UIActionSimpleMachineAddGroup(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_SortParent] = new UIActionSimpleMachineSortParent(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_Close_Save] = new UIActionSimpleSave(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown] = new UIActionSimpleACPIShutdown(this);
-    m_pool[UIActionIndexSelector_Simple_Machine_Close_PowerOff] = new UIActionSimplePowerOff(this);
-
-    /* Common actions: */
-    m_pool[UIActionIndexSelector_State_Common_StartOrShow] = new UIActionStateCommonStartOrShow(this);
-    m_pool[UIActionIndexSelector_Toggle_Common_PauseAndResume] = new UIActionToggleCommonPauseAndResume(this);
-    m_pool[UIActionIndexSelector_Simple_Common_Reset] = new UIActionSimpleCommonReset(this);
-    m_pool[UIActionIndexSelector_Simple_Common_Discard] = new UIActionSimpleCommonDiscard(this);
-    m_pool[UIActionIndexSelector_Simple_Common_Refresh] = new UIActionSimpleCommonRefresh(this);
-    m_pool[UIActionIndexSelector_Simple_Common_ShowInFileManager] = new UIActionSimpleCommonShowInFileManager(this);
-    m_pool[UIActionIndexSelector_Simple_Common_CreateShortcut] = new UIActionSimpleCommonCreateShortcut(this);
+    m_pool[UIActionIndexST_M_Machine] = new UIActionMenuMachineSelector(this);
+    m_pool[UIActionIndexST_M_Machine_S_New] = new UIActionSimpleMachineNew(this);
+    m_pool[UIActionIndexST_M_Machine_S_Add] = new UIActionSimpleMachineAdd(this);
+    m_pool[UIActionIndexST_M_Machine_S_Settings] = new UIActionSimpleMachineSettings(this);
+    m_pool[UIActionIndexST_M_Machine_S_Clone] = new UIActionSimpleMachineClone(this);
+    m_pool[UIActionIndexST_M_Machine_S_Remove] = new UIActionSimpleMachineRemove(this);
+    m_pool[UIActionIndexST_M_Machine_S_AddGroup] = new UIActionSimpleMachineAddGroup(this);
+    m_pool[UIActionIndexST_M_Machine_M_StartOrShow] = new UIActionStateCommonStartOrShow(this);
+    m_pool[UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal] = new UIActionSimpleStartNormal(this);
+    m_pool[UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless] = new UIActionSimpleStartHeadless(this);
+    m_pool[UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable] = new UIActionSimpleStartDetachable(this);
+    m_pool[UIActionIndexST_M_Machine_T_Pause] = new UIActionToggleCommonPauseAndResume(this);
+    m_pool[UIActionIndexST_M_Machine_S_Reset] = new UIActionSimpleCommonReset(this);
+    m_pool[UIActionIndexST_M_Machine_M_Close] = new UIActionMenuClose(this);
+    m_pool[UIActionIndexST_M_Machine_M_Close_S_SaveState] = new UIActionSimpleSave(this);
+    m_pool[UIActionIndexST_M_Machine_M_Close_S_Shutdown] = new UIActionSimpleACPIShutdown(this);
+    m_pool[UIActionIndexST_M_Machine_M_Close_S_PowerOff] = new UIActionSimplePowerOff(this);
+    m_pool[UIActionIndexST_M_Machine_S_Discard] = new UIActionSimpleCommonDiscard(this);
+    m_pool[UIActionIndexST_M_Machine_S_ShowLogDialog] = new UIActionSimpleCommonShowLogDialog(this);
+    m_pool[UIActionIndexST_M_Machine_S_Refresh] = new UIActionSimpleCommonRefresh(this);
+    m_pool[UIActionIndexST_M_Machine_S_ShowInFileManager] = new UIActionSimpleCommonShowInFileManager(this);
+    m_pool[UIActionIndexST_M_Machine_S_CreateShortcut] = new UIActionSimpleCommonCreateShortcut(this);
+    m_pool[UIActionIndexST_M_Machine_S_SortParent] = new UIActionSimpleMachineSortParent(this);
+
+    /* Call to base-class: */
+    UIActionPool::preparePool();
 }
 
-void UIActionPoolSelector::createMenus()
+void UIActionPoolSelector::prepareConnections()
 {
-    /* Global menus creation: */
-    UIActionPool::createMenus();
+    /* Prepare connections: */
+    connect(gShortcutPool, SIGNAL(sigSelectorShortcutsReloaded()), this, SLOT(sltApplyShortcuts()));
+
+    /* Call to base-class: */
+    UIActionPool::prepareConnections();
+}
 
-    /* 'File' menu: */
-    m_pool[UIActionIndexSelector_Menu_File] = new UIActionMenuFile(this);
+void UIActionPoolSelector::updateMenus()
+{
+    /* 'Help' menu: */
+    updateMenuHelp();
+}
 
-    /* 'Group' menu: */
-    m_pool[UIActionIndexSelector_Menu_Group] = new UIActionMenuGroup(this);
-    m_pool[UIActionIndexSelector_Menu_Group_Close] = new UIActionMenuClose(this);
+void UIActionPoolSelector::retranslateUi()
+{
+    /* Call to base-class: */
+    UIActionPool::retranslateUi();
+    /* Create temporary Runtime UI pool to do the same: */
+    if (!m_fTemporary)
+        UIActionPool::createTemporary(UIActionPoolType_Runtime);
+}
 
-    /* 'Machine' menu: */
-    m_pool[UIActionIndexSelector_Menu_Machine] = new UIActionMenuMachineSelector(this);
-    m_pool[UIActionIndexSelector_Menu_Machine_Close] = new UIActionMenuClose(this);
+QString UIActionPoolSelector::shortcutsExtraDataID() const
+{
+    return GUI_Input_SelectorShortcuts;
 }
 
 #include "UIActionPoolSelector.moc"
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h b/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h
index 6319d91..ae0f5a5 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UIActionPoolSelector.h
@@ -1,11 +1,10 @@
+/* $Id: UIActionPoolSelector.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIActionPoolSelector class declaration
+ * VBox Qt GUI - UIActionPoolSelector class declaration.
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,85 +15,117 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIActionPoolSelector_h__
-#define __UIActionPoolSelector_h__
+#ifndef ___UIActionPoolSelector_h___
+#define ___UIActionPoolSelector_h___
 
-/* Local includes: */
+/* GUI includes: */
 #include "UIActionPool.h"
 
-/* Action keys: */
-enum UIActionIndexSelector
+/** Runtime action-pool index enum.
+  * Naming convention is following:
+  * 1. Every menu index prepended with 'M',
+  * 2. Every simple-action index prepended with 'S',
+  * 3. Every toggle-action index presended with 'T',
+  * 4. Every polymorphic-action index presended with 'P',
+  * 5. Every sub-index contains full parent-index name. */
+enum UIActionIndexST
 {
     /* 'File' menu actions: */
-    UIActionIndexSelector_Menu_File = UIActionIndex_Max + 1,
-    UIActionIndexSelector_Simple_File_MediumManagerDialog,
-    UIActionIndexSelector_Simple_File_ImportApplianceWizard,
-    UIActionIndexSelector_Simple_File_ExportApplianceWizard,
-    UIActionIndexSelector_Simple_File_PreferencesDialog,
-    UIActionIndexSelector_Simple_File_Exit,
+    UIActionIndexST_M_File = UIActionIndex_Max + 1,
+    UIActionIndexST_M_File_S_ShowMediumManager,
+    UIActionIndexST_M_File_S_ImportAppliance,
+    UIActionIndexST_M_File_S_ExportAppliance,
+#ifdef DEBUG
+    UIActionIndexST_M_File_S_ShowExtraDataManager,
+#endif /* DEBUG */
+    UIActionIndexST_M_File_S_Close,
 
     /* 'Group' menu actions: */
-    UIActionIndexSelector_Menu_Group,
-    UIActionIndexSelector_Simple_Group_New,
-    UIActionIndexSelector_Simple_Group_Add,
-    UIActionIndexSelector_Simple_Group_Rename,
-    UIActionIndexSelector_Simple_Group_Remove,
-    UIActionIndexSelector_Simple_Group_Sort,
-    UIActionIndexSelector_Menu_Group_Close,
-    UIActionIndexSelector_Simple_Group_Close_Save,
-    UIActionIndexSelector_Simple_Group_Close_ACPIShutdown,
-    UIActionIndexSelector_Simple_Group_Close_PowerOff,
+    UIActionIndexST_M_Group,
+    UIActionIndexST_M_Group_S_New,
+    UIActionIndexST_M_Group_S_Add,
+    UIActionIndexST_M_Group_S_Rename,
+    UIActionIndexST_M_Group_S_Remove,
+    UIActionIndexST_M_Group_M_StartOrShow,
+    UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal,
+    UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless,
+    UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable,
+    UIActionIndexST_M_Group_T_Pause,
+    UIActionIndexST_M_Group_S_Reset,
+    UIActionIndexST_M_Group_M_Close,
+    UIActionIndexST_M_Group_M_Close_S_SaveState,
+    UIActionIndexST_M_Group_M_Close_S_Shutdown,
+    UIActionIndexST_M_Group_M_Close_S_PowerOff,
+    UIActionIndexST_M_Group_S_Discard,
+    UIActionIndexST_M_Group_S_ShowLogDialog,
+    UIActionIndexST_M_Group_S_Refresh,
+    UIActionIndexST_M_Group_S_ShowInFileManager,
+    UIActionIndexST_M_Group_S_CreateShortcut,
+    UIActionIndexST_M_Group_S_Sort,
 
     /* 'Machine' menu actions: */
-    UIActionIndexSelector_Menu_Machine,
-    UIActionIndexSelector_Simple_Machine_New,
-    UIActionIndexSelector_Simple_Machine_Add,
-    UIActionIndexSelector_Simple_Machine_Settings,
-    UIActionIndexSelector_Simple_Machine_Clone,
-    UIActionIndexSelector_Simple_Machine_Remove,
-    UIActionIndexSelector_Simple_Machine_AddGroup,
-    UIActionIndexSelector_Simple_Machine_SortParent,
-    UIActionIndexSelector_Menu_Machine_Close,
-    UIActionIndexSelector_Simple_Machine_Close_Save,
-    UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown,
-    UIActionIndexSelector_Simple_Machine_Close_PowerOff,
-
-    /* Common 'Group' / 'Machine' menu actions: */
-    UIActionIndexSelector_State_Common_StartOrShow,
-    UIActionIndexSelector_Toggle_Common_PauseAndResume,
-    UIActionIndexSelector_Simple_Common_Reset,
-    UIActionIndexSelector_Simple_Common_Discard,
-    UIActionIndexSelector_Simple_Common_Refresh,
-    UIActionIndexSelector_Simple_Common_ShowInFileManager,
-    UIActionIndexSelector_Simple_Common_CreateShortcut,
+    UIActionIndexST_M_Machine,
+    UIActionIndexST_M_Machine_S_New,
+    UIActionIndexST_M_Machine_S_Add,
+    UIActionIndexST_M_Machine_S_Settings,
+    UIActionIndexST_M_Machine_S_Clone,
+    UIActionIndexST_M_Machine_S_Remove,
+    UIActionIndexST_M_Machine_S_AddGroup,
+    UIActionIndexST_M_Machine_M_StartOrShow,
+    UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal,
+    UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless,
+    UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable,
+    UIActionIndexST_M_Machine_T_Pause,
+    UIActionIndexST_M_Machine_S_Reset,
+    UIActionIndexST_M_Machine_M_Close,
+    UIActionIndexST_M_Machine_M_Close_S_SaveState,
+    UIActionIndexST_M_Machine_M_Close_S_Shutdown,
+    UIActionIndexST_M_Machine_M_Close_S_PowerOff,
+    UIActionIndexST_M_Machine_S_Discard,
+    UIActionIndexST_M_Machine_S_ShowLogDialog,
+    UIActionIndexST_M_Machine_S_Refresh,
+    UIActionIndexST_M_Machine_S_ShowInFileManager,
+    UIActionIndexST_M_Machine_S_CreateShortcut,
+    UIActionIndexST_M_Machine_S_SortParent,
 
     /* Maximum index: */
-    UIActionIndexSelector_Max
+    UIActionIndexST_Max
 };
 
-/* Singleton runtime action pool: */
+/** UIActionPool extension
+  * representing action-pool singleton for Selector UI. */
 class UIActionPoolSelector : public UIActionPool
 {
     Q_OBJECT;
 
-private:
+protected:
+
+    /** Constructor,
+      * @param fTemporary is used to determine whether this action-pool is temporary,
+      *                   which can be created to re-initialize shortcuts-pool. */
+    UIActionPoolSelector(bool fTemporary = false);
+
+    /** Prepare pool routine. */
+    virtual void preparePool();
+    /** Prepare connections routine. */
+    virtual void prepareConnections();
 
-    /* Constructor: */
-    UIActionPoolSelector();
+    /** Update menus routine. */
+    virtual void updateMenus();
 
     /** Translation handler. */
-    void retranslateUi();
+    virtual void retranslateUi();
 
-    /* Helper: Shortcuts stuff: */
-    QString shortcutsExtraDataID() const;
+    /** Returns extra-data ID to save keyboard shortcuts under. */
+    virtual QString shortcutsExtraDataID() const;
 
-    /* Helpers: Prepare stuff: */
-    void createActions();
-    void createMenus();
+    /** Returns the list of Selector UI main menus. */
+    virtual QList<QMenu*> menus() const { return QList<QMenu*>(); }
 
-    /* Friend zone: */
+private:
+
+    /* Enable factory in base-class: */
     friend class UIActionPool;
 };
 
-#endif // __UIActionPoolSelector_h__
-
+#endif /* !___UIActionPoolSelector_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp b/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
index 346733d..46f5bf4 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
@@ -1,12 +1,10 @@
 /* $Id: UISelectorWindow.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UISelectorWindow class implementation
+ * VBox Qt GUI - UISelectorWindow class implementation.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,69 +16,73 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QDesktopWidget>
-#include <QDesktopServices>
-#include <QMenuBar>
-#include <QResizeEvent>
-#include <QStackedWidget>
-#include <QTimer>
+# include <QDesktopServices>
+# include <QMenuBar>
+# include <QStatusBar>
+# include <QResizeEvent>
+# include <QStackedWidget>
+# include <QToolButton>
+# include <QTimer>
 
 /* Local includes: */
-#include "QISplitter.h"
-#include "QIFileDialog.h"
-#include "UIBar.h"
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include "UINetworkManager.h"
-# include "UINetworkManagerIndicator.h"
-# include "UIUpdateManager.h"
-# include "UIDownloaderUserManual.h"
-# include "UIDownloaderExtensionPack.h"
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#include "UIIconPool.h"
-#include "UIWizardCloneVM.h"
-#include "UIWizardExportApp.h"
-#include "UIWizardImportApp.h"
-#include "UIVMDesktop.h"
-#include "UIVirtualBoxEventHandler.h"
-#include "UIMediumManager.h"
-#include "UIMedium.h"
-#include "UIMessageCenter.h"
-#include "UISelectorWindow.h"
-#include "UISettingsDialogSpecific.h"
-#include "UIToolBar.h"
-#include "UIVMLogViewer.h"
-#include "UIDesktopServices.h"
-#include "UIGlobalSettingsExtension.h"
-#include "UIActionPoolSelector.h"
-#include "UIGChooser.h"
-#include "UIGDetails.h"
-#include "UIVMItem.h"
-#include "VBoxGlobal.h"
-
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-# include "UIWindowMenuManager.h"
-# include "UIImageTools.h"
-#endif /* Q_WS_MAC */
+# include "QISplitter.h"
+# include "QIFileDialog.h"
+# include "UIBar.h"
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+#  include "UINetworkManager.h"
+#  include "UINetworkManagerIndicator.h"
+#  include "UIUpdateManager.h"
+#  include "UIDownloaderUserManual.h"
+#  include "UIDownloaderExtensionPack.h"
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+# include "UIIconPool.h"
+# include "UIWizardCloneVM.h"
+# include "UIWizardExportApp.h"
+# include "UIWizardImportApp.h"
+# include "UIVMDesktop.h"
+# include "UIVirtualBoxEventHandler.h"
+# include "UIMediumManager.h"
+# include "UIMedium.h"
+# include "UIMessageCenter.h"
+# include "UISelectorWindow.h"
+# include "UISettingsDialogSpecific.h"
+# include "UIToolBar.h"
+# include "UIVMLogViewer.h"
+# include "UIDesktopServices.h"
+# include "UIGlobalSettingsExtension.h"
+# include "UIActionPoolSelector.h"
+# include "UIGChooser.h"
+# include "UIGDetails.h"
+# include "UIVMItem.h"
+# include "UIExtraDataManager.h"
+# include "VBoxGlobal.h"
+
+# ifdef Q_WS_MAC
+#  include "VBoxUtils.h"
+#  include "UIWindowMenuManager.h"
+#  include "UIImageTools.h"
+# endif /* Q_WS_MAC */
 
 /* Other VBox stuff: */
-#include <iprt/buildconfig.h>
-#include <VBox/version.h>
-#ifdef Q_WS_X11
-# include <iprt/env.h>
-#endif /* Q_WS_X11 */
+# include <iprt/buildconfig.h>
+# include <VBox/version.h>
+# ifdef Q_WS_X11
+#  include <iprt/env.h>
+# endif /* Q_WS_X11 */
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 UISelectorWindow::UISelectorWindow(UISelectorWindow **ppSelf, QWidget *pParent,
                                    Qt::WindowFlags flags /* = Qt::Window */)
     : QIWithRetranslateUI2<QMainWindow>(pParent, flags)
     , m_fPolished(false)
     , m_fWarningAboutInaccessibleMediumShown(false)
+    , m_pActionPool(0)
     , m_pSplitter(0)
 #ifndef Q_WS_MAC
     , m_pBar(0)
@@ -119,7 +121,7 @@ UISelectorWindow::UISelectorWindow(UISelectorWindow **ppSelf, QWidget *pParent,
     /* Enable unified toolbars on Mac OS X. Available on Qt >= 4.3.
      * We do this after setting the window pos/size, cause Qt sometimes
      * includes the toolbar height in the content height. */
-    mVMToolBar->setMacToolbar();
+    mVMToolBar->enableMacToolbar();
 # endif /* MAC_LEOPARD_STYLE */
 
     UIWindowMenuManager::instance()->addWindow(this);
@@ -140,8 +142,16 @@ UISelectorWindow::~UISelectorWindow()
     /* Destroy event handlers: */
     UIVirtualBoxEventHandler::destroy();
 
+#ifdef Q_WS_MAC
+    UIWindowMenuManager::destroy();
+#endif /* Q_WS_MAC */
+
     /* Save settings: */
     saveSettings();
+
+    /* Cleanup: */
+    cleanupConnections();
+    cleanupMenuBar();
 }
 
 void UISelectorWindow::sltStateChanged(QString)
@@ -213,22 +223,19 @@ void UISelectorWindow::sltHandleMediumEnumerationFinish()
 
 void UISelectorWindow::sltShowSelectorContextMenu(const QPoint &pos)
 {
-    /* Load toolbar/statusbar availability settings: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    QString strToolbar = vbox.GetExtraData(GUI_Toolbar);
-    QString strStatusbar = vbox.GetExtraData(GUI_Statusbar);
-    bool fToolbar = strToolbar.isEmpty() || strToolbar == "true";
-    bool fStatusbar = strStatusbar.isEmpty() || strStatusbar == "true";
-
     /* Populate toolbar/statusbar acctions: */
     QList<QAction*> actions;
     QAction *pShowToolBar = new QAction(tr("Show Toolbar"), 0);
     pShowToolBar->setCheckable(true);
-    pShowToolBar->setChecked(fToolbar);
+#ifdef Q_WS_MAC
+    pShowToolBar->setChecked(mVMToolBar->isVisible());
+#else /* Q_WS_MAC */
+    pShowToolBar->setChecked(m_pBar->isVisible());
+#endif /* !Q_WS_MAC */
     actions << pShowToolBar;
     QAction *pShowStatusBar = new QAction(tr("Show Statusbar"), 0);
     pShowStatusBar->setCheckable(true);
-    pShowStatusBar->setChecked(fStatusbar);
+    pShowStatusBar->setChecked(statusBar()->isVisible());
     actions << pShowStatusBar;
 
     QPoint gpos = pos;
@@ -245,7 +252,6 @@ void UISelectorWindow::sltShowSelectorContextMenu(const QPoint &pos)
 #else /* Q_WS_MAC */
             m_pBar->show();
 #endif /* !Q_WS_MAC */
-            vbox.SetExtraData(GUI_Toolbar, "true");
         }
         else
         {
@@ -254,21 +260,14 @@ void UISelectorWindow::sltShowSelectorContextMenu(const QPoint &pos)
 #else /* Q_WS_MAC */
             m_pBar->hide();
 #endif /* !Q_WS_MAC */
-            vbox.SetExtraData(GUI_Toolbar, "false");
         }
     }
     else if (pResult == pShowStatusBar)
     {
         if (pResult->isChecked())
-        {
             statusBar()->show();
-            vbox.SetExtraData(GUI_Statusbar, "true");
-        }
         else
-        {
             statusBar()->hide();
-            vbox.SetExtraData(GUI_Statusbar, "false");
-        }
     }
 }
 
@@ -312,13 +311,20 @@ void UISelectorWindow::sltShowExportApplianceWizard()
         delete pWizard;
 }
 
+#ifdef DEBUG
+void UISelectorWindow::sltOpenExtraDataManagerWindow()
+{
+    gEDataManager->openWindow(this);
+}
+#endif /* DEBUG */
+
 void UISelectorWindow::sltShowPreferencesDialog()
 {
     /* Check that we do NOT handling that already: */
-    if (m_pPreferencesDialogAction->data().toBool())
+    if (actionPool()->action(UIActionIndex_M_Application_S_Preferences)->data().toBool())
         return;
     /* Remember that we handling that already: */
-    m_pPreferencesDialogAction->setData(true);
+    actionPool()->action(UIActionIndex_M_Application_S_Preferences)->setData(true);
 
     /* Don't show the inaccessible warning
      * if the user tries to open global settings: */
@@ -329,7 +335,7 @@ void UISelectorWindow::sltShowPreferencesDialog()
     dialog.execute();
 
     /* Remember that we do NOT handling that already: */
-    m_pPreferencesDialogAction->setData(false);
+    actionPool()->action(UIActionIndex_M_Application_S_Preferences)->setData(false);
 }
 
 void UISelectorWindow::sltPerformExit()
@@ -388,10 +394,10 @@ void UISelectorWindow::sltShowMachineSettingsDialog(const QString &strCategoryRe
                                                     const QString &strId /* = QString() */)
 {
     /* Check that we do NOT handling that already: */
-    if (m_pAction_Machine_Settings->data().toBool())
+    if (actionPool()->action(UIActionIndexST_M_Machine_S_Settings)->data().toBool())
         return;
     /* Remember that we handling that already: */
-    m_pAction_Machine_Settings->setData(true);
+    actionPool()->action(UIActionIndexST_M_Machine_S_Settings)->setData(true);
 
     /* Process href from VM details / description: */
     if (!strCategoryRef.isEmpty() && strCategoryRef[0] != '#')
@@ -425,7 +431,7 @@ void UISelectorWindow::sltShowMachineSettingsDialog(const QString &strCategoryRe
     dialog.execute();
 
     /* Remember that we do NOT handling that already: */
-    m_pAction_Machine_Settings->setData(false);
+    actionPool()->action(UIActionIndexST_M_Machine_S_Settings)->setData(false);
 }
 
 void UISelectorWindow::sltShowCloneMachineWizard()
@@ -452,12 +458,72 @@ void UISelectorWindow::sltPerformStartOrShowAction()
     foreach (UIVMItem *pItem, items)
     {
         /* Check if current item could be started/showed: */
-        if (!isActionEnabled(UIActionIndexSelector_State_Common_StartOrShow, QList<UIVMItem*>() << pItem))
+        if (!isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem))
             continue;
 
         /* Launch/show current VM: */
         CMachine machine = pItem->machine();
-        vboxGlobal().launchMachine(machine, qApp->keyboardModifiers() == Qt::ShiftModifier);
+        vboxGlobal().launchMachine(machine,
+                                   UIVMItem::isItemRunningHeadless(pItem)         ? VBoxGlobal::LaunchMode_Separate :
+                                   qApp->keyboardModifiers() == Qt::ShiftModifier ? VBoxGlobal::LaunchMode_Headless :
+                                                                                    VBoxGlobal::LaunchMode_Default);
+    }
+}
+
+void UISelectorWindow::sltPerformStartNormal()
+{
+    /* Get selected items: */
+    QList<UIVMItem*> items = currentItems();
+    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
+
+    /* For every selected item: */
+    foreach (UIVMItem *pItem, items)
+    {
+        /* Check if current item could be started/showed: */
+        if (!isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem))
+            continue;
+
+        /* Launch/show current VM: */
+        CMachine machine = pItem->machine();
+        vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Default);
+    }
+}
+
+void UISelectorWindow::sltPerformStartHeadless()
+{
+    /* Get selected items: */
+    QList<UIVMItem*> items = currentItems();
+    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
+
+    /* For every selected item: */
+    foreach (UIVMItem *pItem, items)
+    {
+        /* Check if current item could be started/showed: */
+        if (!isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem))
+            continue;
+
+        /* Launch/show current VM: */
+        CMachine machine = pItem->machine();
+        vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Headless);
+    }
+}
+
+void UISelectorWindow::sltPerformStartDetachable()
+{
+    /* Get selected items: */
+    QList<UIVMItem*> items = currentItems();
+    AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
+
+    /* For every selected item: */
+    foreach (UIVMItem *pItem, items)
+    {
+        /* Check if current item could be started/showed: */
+        if (!isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, QList<UIVMItem*>() << pItem))
+            continue;
+
+        /* Launch/show current VM: */
+        CMachine machine = pItem->machine();
+        vboxGlobal().launchMachine(machine, VBoxGlobal::LaunchMode_Separate);
     }
 }
 
@@ -471,7 +537,7 @@ void UISelectorWindow::sltPerformDiscardAction()
     QStringList machineNames;
     QList<UIVMItem*> itemsToDiscard;
     foreach (UIVMItem *pItem, items)
-        if (isActionEnabled(UIActionIndexSelector_Simple_Common_Discard, QList<UIVMItem*>() << pItem))
+        if (isActionEnabled(UIActionIndexST_M_Group_S_Discard, QList<UIVMItem*>() << pItem))
         {
             machineNames << pItem->name();
             itemsToDiscard << pItem;
@@ -490,11 +556,11 @@ void UISelectorWindow::sltPerformDiscardAction()
         if (session.isNull())
             return;
 
-        /* Get session console: */
-        CConsole console = session.GetConsole();
-        console.DiscardSavedState(true);
-        if (!console.isOk())
-            msgCenter().cannotDiscardSavedState(console);
+        /* Get session machine: */
+        CMachine machine = session.GetMachine();
+        machine.DiscardSavedState(true);
+        if (!machine.isOk())
+            msgCenter().cannotDiscardSavedState(machine);
 
         /* Unlock machine finally: */
         session.UnlockMachine();
@@ -514,7 +580,7 @@ void UISelectorWindow::sltPerformPauseResumeAction(bool fPause)
         KMachineState state = pItem->machineState();
 
         /* Check if current item could be paused/resumed: */
-        if (!isActionEnabled(UIActionIndexSelector_Toggle_Common_PauseAndResume, QList<UIVMItem*>() << pItem))
+        if (!isActionEnabled(UIActionIndexST_M_Group_T_Pause, QList<UIVMItem*>() << pItem))
             continue;
 
         /* Check if current item already paused: */
@@ -566,7 +632,7 @@ void UISelectorWindow::sltPerformResetAction()
     QStringList machineNames;
     QList<UIVMItem*> itemsToReset;
     foreach (UIVMItem *pItem, items)
-        if (isActionEnabled(UIActionIndexSelector_Simple_Common_Reset, QList<UIVMItem*>() << pItem))
+        if (isActionEnabled(UIActionIndexST_M_Group_S_Reset, QList<UIVMItem*>() << pItem))
         {
             machineNames << pItem->name();
             itemsToReset << pItem;
@@ -605,7 +671,7 @@ void UISelectorWindow::sltPerformSaveAction()
     foreach (UIVMItem *pItem, items)
     {
         /* Check if current item could be saved: */
-        if (!isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_Save, QList<UIVMItem*>() << pItem))
+        if (!isActionEnabled(UIActionIndexST_M_Machine_M_Close_S_SaveState, QList<UIVMItem*>() << pItem))
             continue;
 
         /* Open a session to modify VM state: */
@@ -615,22 +681,23 @@ void UISelectorWindow::sltPerformSaveAction()
 
         /* Get session console: */
         CConsole console = session.GetConsole();
+        /* Get session machine: */
+        CMachine machine = session.GetMachine();
         /* Pause VM first: */
         console.Pause();
         if (console.isOk())
         {
             /* Prepare machine state saving: */
-            CProgress progress = console.SaveState();
-            if (console.isOk())
+            CProgress progress = machine.SaveState();
+            if (machine.isOk())
             {
                 /* Show machine state saving progress: */
-                CMachine machine = session.GetMachine();
                 msgCenter().showModalProgressDialog(progress, machine.GetName(), ":/progress_state_save_90px.png");
                 if (!progress.isOk() || progress.GetResultCode() != 0)
                     msgCenter().cannotSaveMachineState(progress, machine.GetName());
             }
             else
-                msgCenter().cannotSaveMachineState(console);
+                msgCenter().cannotSaveMachineState(machine);
         }
         else
             msgCenter().cannotPauseMachine(console);
@@ -650,7 +717,7 @@ void UISelectorWindow::sltPerformACPIShutdownAction()
     QStringList machineNames;
     QList<UIVMItem*> itemsToShutdown;
     foreach (UIVMItem *pItem, items)
-        if (isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, QList<UIVMItem*>() << pItem))
+        if (isActionEnabled(UIActionIndexST_M_Machine_M_Close_S_Shutdown, QList<UIVMItem*>() << pItem))
         {
             machineNames << pItem->name();
             itemsToShutdown << pItem;
@@ -691,7 +758,7 @@ void UISelectorWindow::sltPerformPowerOffAction()
     QStringList machineNames;
     QList<UIVMItem*> itemsToPowerOff;
     foreach (UIVMItem *pItem, items)
-        if (isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, QList<UIVMItem*>() << pItem))
+        if (isActionEnabled(UIActionIndexST_M_Machine_M_Close_S_PowerOff, QList<UIVMItem*>() << pItem))
         {
             machineNames << pItem->name();
             itemsToPowerOff << pItem;
@@ -740,7 +807,7 @@ void UISelectorWindow::sltShowLogDialog()
     foreach (UIVMItem *pItem, items)
     {
         /* Check if log could be show for the current item: */
-        if (!isActionEnabled(UIActionIndex_Simple_LogDialog, QList<UIVMItem*>() << pItem))
+        if (!isActionEnabled(UIActionIndexST_M_Group_S_ShowLogDialog, QList<UIVMItem*>() << pItem))
             continue;
 
         /* Show VM Log Viewer: */
@@ -758,7 +825,7 @@ void UISelectorWindow::sltShowMachineInFileManager()
     foreach (UIVMItem *pItem, items)
     {
         /* Check if that item could be shown in file-browser: */
-        if (!isActionEnabled(UIActionIndexSelector_Simple_Common_ShowInFileManager, QList<UIVMItem*>() << pItem))
+        if (!isActionEnabled(UIActionIndexST_M_Group_S_ShowInFileManager, QList<UIVMItem*>() << pItem))
             continue;
 
         /* Show VM in filebrowser: */
@@ -776,7 +843,7 @@ void UISelectorWindow::sltPerformCreateShortcutAction()
     foreach (UIVMItem *pItem, items)
     {
         /* Check if shortcuts could be created for this item: */
-        if (!isActionEnabled(UIActionIndexSelector_Simple_Common_CreateShortcut, QList<UIVMItem*>() << pItem))
+        if (!isActionEnabled(UIActionIndexST_M_Group_S_CreateShortcut, QList<UIVMItem*>() << pItem))
             continue;
 
         /* Create shortcut for this VM: */
@@ -793,15 +860,16 @@ void UISelectorWindow::sltGroupCloseMenuAboutToShow()
     QList<UIVMItem*> items = currentItems();
     AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
 
-    m_pGroupACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown, items));
+    actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Shutdown)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_Close_S_Shutdown, items));
 }
+
 void UISelectorWindow::sltMachineCloseMenuAboutToShow()
 {
     /* Get selected items: */
     QList<UIVMItem*> items = currentItems();
     AssertMsgReturnVoid(!items.isEmpty(), ("At least one item should be selected!\n"));
 
-    m_pMachineACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items));
+    actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Shutdown)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Close_S_Shutdown, items));
 }
 
 void UISelectorWindow::sltCurrentVMItemChanged(bool fRefreshDetails, bool fRefreshSnapshots, bool)
@@ -953,7 +1021,7 @@ void UISelectorWindow::retranslateUi()
              +  QString(RTBldCfgVersion())
              +  QString(" r")
              +  QString(RTBldCfgRevisionStr())
-             +  QString(" - "VBOX_BLEEDING_EDGE);
+             +  QString(" - " VBOX_BLEEDING_EDGE);
 #endif /* VBOX_BLEEDING_EDGE */
     setWindowTitle(strTitle);
 
@@ -974,15 +1042,13 @@ bool UISelectorWindow::event(QEvent *pEvent)
     /* Which event do we have? */
     switch (pEvent->type())
     {
-        /* By handling every Resize and Move we keep track of the normal
-         * (non-minimized and non-maximized) window geometry. Shame on Qt
-         * that it doesn't provide this geometry in its public APIs. */
+        /* Handle every Resize and Move we keep track of the geometry. */
         case QEvent::Resize:
         {
             if (isVisible() && (windowState() & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen)) == 0)
             {
                 QResizeEvent *pResizeEvent = static_cast<QResizeEvent*>(pEvent);
-                m_normalGeo.setSize(pResizeEvent->size());
+                m_geometry.setSize(pResizeEvent->size());
             }
             break;
         }
@@ -992,9 +1058,9 @@ bool UISelectorWindow::event(QEvent *pEvent)
             {
 #ifdef Q_WS_MAC
                 QMoveEvent *pMoveEvent = static_cast<QMoveEvent*>(pEvent);
-                m_normalGeo.moveTo(pMoveEvent->pos());
+                m_geometry.moveTo(pMoveEvent->pos());
 #else /* Q_WS_MAC */
-                m_normalGeo.moveTo(geometry().x(), geometry().y());
+                m_geometry.moveTo(geometry().x(), geometry().y());
 #endif /* !Q_WS_MAC */
             }
             break;
@@ -1016,14 +1082,6 @@ bool UISelectorWindow::event(QEvent *pEvent)
             return false;
             break;
         }
-        case QEvent::ToolBarChange:
-        {
-            CVirtualBox vbox = vboxGlobal().virtualBox();
-            /* We have to invert the isVisible check one time, cause this event
-             * is sent *before* the real toggle is done. Really intuitive Trolls. */
-            vbox.SetExtraData(GUI_Toolbar, !::darwinIsToolbarVisible(mVMToolBar) ? "true" : "false");
-            break;
-        }
 #endif /* Q_WS_MAC */
         default:
             break;
@@ -1100,44 +1158,39 @@ void UISelectorWindow::prepareIcon()
 
 void UISelectorWindow::prepareMenuBar()
 {
+    /* Create action-pool: */
+    m_pActionPool = UIActionPool::create(UIActionPoolType_Selector);
+
     /* Prepare File-menu: */
-    m_pFileMenu = gActionPool->action(UIActionIndexSelector_Menu_File)->menu();
-    prepareMenuFile(m_pFileMenu);
-    menuBar()->addMenu(m_pFileMenu);
+    prepareMenuFile(actionPool()->action(UIActionIndexST_M_File)->menu());
+    menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_File)->menu());
+
+    /* Prepare 'Group' / 'Start or Show' menu: */
+    prepareMenuGroupStartOrShow(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow)->menu());
+
+    /* Prepare 'Machine' / 'Start or Show' menu: */
+    prepareMenuMachineStartOrShow(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)->menu());
 
     /* Prepare 'Group' / 'Close' menu: */
-    m_pGroupCloseMenuAction = gActionPool->action(UIActionIndexSelector_Menu_Group_Close);
-    m_pGroupCloseMenu = m_pGroupCloseMenuAction->menu();
-    prepareMenuGroupClose(m_pGroupCloseMenu);
+    prepareMenuGroupClose(actionPool()->action(UIActionIndexST_M_Group_M_Close)->menu());
 
     /* Prepare 'Machine' / 'Close' menu: */
-    m_pMachineCloseMenuAction = gActionPool->action(UIActionIndexSelector_Menu_Machine_Close);
-    m_pMachineCloseMenu = m_pMachineCloseMenuAction->menu();
-    prepareMenuMachineClose(m_pMachineCloseMenu);
-
-    /* Create actions for 'Group' and 'Machine' menus: */
-    prepareCommonActions();
-    prepareGroupActions();
-    prepareMachineActions();
+    prepareMenuMachineClose(actionPool()->action(UIActionIndexST_M_Machine_M_Close)->menu());
 
     /* Prepare Group-menu: */
-    m_pGroupMenu = gActionPool->action(UIActionIndexSelector_Menu_Group)->menu();
-    prepareMenuGroup(m_pGroupMenu);
-    m_pGroupMenuAction = menuBar()->addMenu(m_pGroupMenu);
+    prepareMenuGroup(actionPool()->action(UIActionIndexST_M_Group)->menu());
+    m_pGroupMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Group)->menu());
 
     /* Prepare Machine-menu: */
-    m_pMachineMenu = gActionPool->action(UIActionIndexSelector_Menu_Machine)->menu();
-    prepareMenuMachine(m_pMachineMenu);
-    m_pMachineMenuAction = menuBar()->addMenu(m_pMachineMenu);
+    prepareMenuMachine(actionPool()->action(UIActionIndexST_M_Machine)->menu());
+    m_pMachineMenuAction = menuBar()->addMenu(actionPool()->action(UIActionIndexST_M_Machine)->menu());
 
 #ifdef Q_WS_MAC
     menuBar()->addMenu(UIWindowMenuManager::instance(this)->createMenu(this));
 #endif /* Q_WS_MAC */
 
     /* Prepare Help-menu: */
-    m_pHelpMenu = gActionPool->action(UIActionIndex_Menu_Help)->menu();
-    prepareMenuHelp(m_pHelpMenu);
-    menuBar()->addMenu(m_pHelpMenu);
+    menuBar()->addMenu(actionPool()->action(UIActionIndex_Menu_Help)->menu());
 
     /* Setup menubar policy: */
     menuBar()->setContextMenuPolicy(Qt::CustomContextMenu);
@@ -1150,54 +1203,29 @@ void UISelectorWindow::prepareMenuFile(QMenu *pMenu)
         return;
 
     /* Populate File-menu: */
-    m_pMediumManagerDialogAction = gActionPool->action(UIActionIndexSelector_Simple_File_MediumManagerDialog);
-    pMenu->addAction(m_pMediumManagerDialogAction);
-    m_pImportApplianceWizardAction = gActionPool->action(UIActionIndexSelector_Simple_File_ImportApplianceWizard);
-    pMenu->addAction(m_pImportApplianceWizardAction);
-    m_pExportApplianceWizardAction = gActionPool->action(UIActionIndexSelector_Simple_File_ExportApplianceWizard);
-    pMenu->addAction(m_pExportApplianceWizardAction);
-#ifndef Q_WS_MAC
-    pMenu->addSeparator();
+#ifdef Q_WS_MAC
+    pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_About));
+    pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences));
 #endif /* Q_WS_MAC */
-    m_pPreferencesDialogAction = gActionPool->action(UIActionIndexSelector_Simple_File_PreferencesDialog);
-    pMenu->addAction(m_pPreferencesDialogAction);
-#ifndef Q_WS_MAC
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ImportAppliance));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance));
     pMenu->addSeparator();
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowMediumManager));
+#ifdef DEBUG
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_ShowExtraDataManager));
+#endif /* DEBUG */
+#ifndef Q_WS_MAC
+    pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences));
 #endif /* Q_WS_MAC */
-    m_pExitAction = gActionPool->action(UIActionIndexSelector_Simple_File_Exit);
-    pMenu->addAction(m_pExitAction);
-}
-
-void UISelectorWindow::prepareCommonActions()
-{
-    m_pAction_Common_StartOrShow       = gActionPool->action(UIActionIndexSelector_State_Common_StartOrShow)->toStateAction();
-    m_pAction_Common_PauseAndResume    = gActionPool->action(UIActionIndexSelector_Toggle_Common_PauseAndResume);
-    m_pAction_Common_Reset             = gActionPool->action(UIActionIndexSelector_Simple_Common_Reset);
-    m_pAction_Common_Discard           = gActionPool->action(UIActionIndexSelector_Simple_Common_Discard);
-    m_pAction_Common_Refresh           = gActionPool->action(UIActionIndexSelector_Simple_Common_Refresh);
-    m_pAction_Common_ShowInFileManager = gActionPool->action(UIActionIndexSelector_Simple_Common_ShowInFileManager);
-    m_pAction_Common_CreateShortcut    = gActionPool->action(UIActionIndexSelector_Simple_Common_CreateShortcut);
-}
-
-void UISelectorWindow::prepareGroupActions()
-{
-    m_pAction_Group_New    = gActionPool->action(UIActionIndexSelector_Simple_Group_New);
-    m_pAction_Group_Add    = gActionPool->action(UIActionIndexSelector_Simple_Group_Add);
-    m_pAction_Group_Rename = gActionPool->action(UIActionIndexSelector_Simple_Group_Rename);
-    m_pAction_Group_Remove = gActionPool->action(UIActionIndexSelector_Simple_Group_Remove);
-    m_pAction_Group_Sort   = gActionPool->action(UIActionIndexSelector_Simple_Group_Sort);
-}
-
-void UISelectorWindow::prepareMachineActions()
-{
-    m_pAction_Machine_New        = gActionPool->action(UIActionIndexSelector_Simple_Machine_New);
-    m_pAction_Machine_Add        = gActionPool->action(UIActionIndexSelector_Simple_Machine_Add);
-    m_pAction_Machine_Settings   = gActionPool->action(UIActionIndexSelector_Simple_Machine_Settings);
-    m_pAction_Machine_Clone      = gActionPool->action(UIActionIndexSelector_Simple_Machine_Clone);
-    m_pAction_Machine_Remove     = gActionPool->action(UIActionIndexSelector_Simple_Machine_Remove);
-    m_pAction_Machine_AddGroup   = gActionPool->action(UIActionIndexSelector_Simple_Machine_AddGroup);
-    m_pAction_Machine_LogDialog  = gActionPool->action(UIActionIndex_Simple_LogDialog);
-    m_pAction_Machine_SortParent = gActionPool->action(UIActionIndexSelector_Simple_Machine_SortParent);
+    pMenu->addSeparator();
+#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+    pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_NetworkAccessManager));
+    pMenu->addAction(actionPool()->action(UIActionIndex_M_Application_S_CheckForUpdates));
+# ifndef Q_WS_MAC
+    pMenu->addSeparator();
+# endif /* Q_WS_MAC */
+#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_File_S_Close));
 }
 
 void UISelectorWindow::prepareMenuGroup(QMenu *pMenu)
@@ -1207,31 +1235,40 @@ void UISelectorWindow::prepareMenuGroup(QMenu *pMenu)
         return;
 
     /* Populate Machine-menu: */
-    pMenu->addAction(m_pAction_Group_New);
-    pMenu->addAction(m_pAction_Group_Add);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_New));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Add));
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Group_Rename);
-    pMenu->addAction(m_pAction_Group_Remove);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Rename));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Remove));
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Common_StartOrShow);
-    pMenu->addAction(m_pAction_Common_PauseAndResume);
-    pMenu->addAction(m_pAction_Common_Reset);
-    pMenu->addMenu(m_pGroupCloseMenu);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_T_Pause));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Reset));
+    pMenu->addMenu(actionPool()->action(UIActionIndexST_M_Group_M_Close)->menu());
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Common_Discard);
-    pMenu->addAction(m_pAction_Common_Refresh);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Discard));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Refresh));
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Common_ShowInFileManager);
-    pMenu->addAction(m_pAction_Common_CreateShortcut);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut));
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Group_Sort);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Sort));
 
     /* Remember action list: */
-    m_groupActions << m_pAction_Group_New
-                   << m_pAction_Group_Add
-                   << m_pAction_Group_Rename
-                   << m_pAction_Group_Remove
-                   << m_pAction_Group_Sort;
+    m_groupActions << actionPool()->action(UIActionIndexST_M_Group_S_New)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_Add)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_Rename)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_Remove)
+                   << actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow)
+                   << actionPool()->action(UIActionIndexST_M_Group_T_Pause)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_Reset)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_Discard)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_Refresh)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut)
+                   << actionPool()->action(UIActionIndexST_M_Group_S_Sort);
 }
 
 void UISelectorWindow::prepareMenuMachine(QMenu *pMenu)
@@ -1241,108 +1278,111 @@ void UISelectorWindow::prepareMenuMachine(QMenu *pMenu)
         return;
 
     /* Populate Machine-menu: */
-    pMenu->addAction(m_pAction_Machine_New);
-    pMenu->addAction(m_pAction_Machine_Add);
-    pMenu->addAction(m_pAction_Machine_Settings);
-    pMenu->addAction(m_pAction_Machine_Clone);
-    pMenu->addAction(m_pAction_Machine_Remove);
-    pMenu->addAction(m_pAction_Machine_AddGroup);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_New));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Add));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Clone));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup));
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Common_StartOrShow);
-    pMenu->addAction(m_pAction_Common_PauseAndResume);
-    pMenu->addAction(m_pAction_Common_Reset);
-    pMenu->addMenu(m_pMachineCloseMenu);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_T_Pause));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Reset));
+    pMenu->addMenu(actionPool()->action(UIActionIndexST_M_Machine_M_Close)->menu());
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Common_Discard);
-    pMenu->addAction(m_pAction_Machine_LogDialog);
-    pMenu->addAction(m_pAction_Common_Refresh);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Discard));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh));
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Common_ShowInFileManager);
-    pMenu->addAction(m_pAction_Common_CreateShortcut);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut));
     pMenu->addSeparator();
-    pMenu->addAction(m_pAction_Machine_SortParent);
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_SortParent));
+
+    /* Remember action list: */
+    m_machineActions << actionPool()->action(UIActionIndexST_M_Machine_S_New)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_Add)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_Settings)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_Clone)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_Remove)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)
+                     << actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)
+                     << actionPool()->action(UIActionIndexST_M_Machine_T_Pause)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_Reset)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_Discard)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_Refresh)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut)
+                     << actionPool()->action(UIActionIndexST_M_Machine_S_SortParent);
+}
+
+void UISelectorWindow::prepareMenuGroupStartOrShow(QMenu *pMenu)
+{
+    /* Do not touch if filled already: */
+    if (!pMenu->isEmpty())
+        return;
+
+    /* Populate 'Group' / 'Start or Show' menu: */
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable));
 
     /* Remember action list: */
-    m_machineActions << m_pAction_Machine_New
-                     << m_pAction_Machine_Add
-                     << m_pAction_Machine_Settings
-                     << m_pAction_Machine_Clone
-                     << m_pAction_Machine_Remove
-                     << m_pAction_Machine_AddGroup
-                     << m_pAction_Machine_LogDialog
-                     << m_pAction_Machine_SortParent;
+    m_groupActions << actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal)
+                   << actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless)
+                   << actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable);
 }
 
-void UISelectorWindow::prepareMenuGroupClose(QMenu *pMenu)
+void UISelectorWindow::prepareMenuMachineStartOrShow(QMenu *pMenu)
 {
     /* Do not touch if filled already: */
     if (!pMenu->isEmpty())
         return;
 
-    /* Populate 'Group' / 'Close' menu: */
-    m_pGroupSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_Save);
-    pMenu->addAction(m_pGroupSaveAction);
-    m_pGroupACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown);
-    pMenu->addAction(m_pGroupACPIShutdownAction);
-    m_pGroupPowerOffAction = gActionPool->action(UIActionIndexSelector_Simple_Group_Close_PowerOff);
-    pMenu->addAction(m_pGroupPowerOffAction);
+    /* Populate 'Machine' / 'Start or Show' menu: */
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable));
 
     /* Remember action list: */
-    m_groupActions << m_pGroupSaveAction
-                   << m_pGroupACPIShutdownAction
-                   << m_pGroupPowerOffAction;
+    m_machineActions << actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal)
+                     << actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless)
+                     << actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable);
 }
 
-void UISelectorWindow::prepareMenuMachineClose(QMenu *pMenu)
+void UISelectorWindow::prepareMenuGroupClose(QMenu *pMenu)
 {
     /* Do not touch if filled already: */
     if (!pMenu->isEmpty())
         return;
 
-    /* Populate 'Machine' / 'Close' menu: */
-    m_pMachineSaveAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_Save);
-    pMenu->addAction(m_pMachineSaveAction);
-    m_pMachineACPIShutdownAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown);
-    pMenu->addAction(m_pMachineACPIShutdownAction);
-    m_pMachinePowerOffAction = gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff);
-    pMenu->addAction(m_pMachinePowerOffAction);
+    /* Populate 'Group' / 'Close' menu: */
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_SaveState));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Shutdown));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_PowerOff));
 
     /* Remember action list: */
-    m_machineActions << m_pMachineSaveAction
-                     << m_pMachineACPIShutdownAction
-                     << m_pMachinePowerOffAction;
+    m_groupActions << actionPool()->action(UIActionIndexST_M_Group_M_Close_S_SaveState)
+                   << actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Shutdown)
+                   << actionPool()->action(UIActionIndexST_M_Group_M_Close_S_PowerOff);
 }
 
-void UISelectorWindow::prepareMenuHelp(QMenu *pMenu)
+void UISelectorWindow::prepareMenuMachineClose(QMenu *pMenu)
 {
     /* Do not touch if filled already: */
     if (!pMenu->isEmpty())
         return;
 
-    /* Populate Help-menu: */
-    m_pHelpAction = gActionPool->action(UIActionIndex_Simple_Contents);
-    pMenu->addAction(m_pHelpAction);
-    m_pWebAction = gActionPool->action(UIActionIndex_Simple_WebSite);
-    pMenu->addAction(m_pWebAction);
-    pMenu->addSeparator();
-    m_pResetWarningsAction = gActionPool->action(UIActionIndex_Simple_ResetWarnings);
-    pMenu->addAction(m_pResetWarningsAction);
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    pMenu->addSeparator();
-    m_pNetworkAccessManager = gActionPool->action(UIActionIndex_Simple_NetworkAccessManager);
-    pMenu->addAction(m_pNetworkAccessManager);
-    m_pUpdateAction = gActionPool->action(UIActionIndex_Simple_CheckForUpdates);
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    if (VBoxGlobal::shouldWeAllowApplicationUpdate(vbox))
-        pMenu->addAction(m_pUpdateAction);
-    else
-        m_pUpdateAction->setEnabled(false);
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#ifndef Q_WS_MAC
-    pMenu->addSeparator();
-#endif /* !Q_WS_MAC */
-    m_pAboutAction = gActionPool->action(UIActionIndex_Simple_About);
-    pMenu->addAction(m_pAboutAction);
+    /* Populate 'Machine' / 'Close' menu: */
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_SaveState));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Shutdown));
+    pMenu->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff));
+
+    /* Remember action list: */
+    m_machineActions << actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_SaveState)
+                     << actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Shutdown)
+                     << actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff);
 }
 
 void UISelectorWindow::prepareStatusBar()
@@ -1352,7 +1392,7 @@ void UISelectorWindow::prepareStatusBar()
     statusBar()->setContextMenuPolicy(Qt::CustomContextMenu);
 
     /* Add network-manager indicator: */
-    QIStateIndicator *pIndicator = gNetworkManager->indicator();
+    UINetworkManagerIndicator *pIndicator = gNetworkManager->indicator();
     statusBar()->addPermanentWidget(pIndicator);
     pIndicator->updateAppearance();
 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
@@ -1371,10 +1411,10 @@ void UISelectorWindow::prepareWidgets()
     mVMToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
     mVMToolBar->setIconSize(QSize(32, 32));
     mVMToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
-    mVMToolBar->addAction(m_pAction_Machine_New);
-    mVMToolBar->addAction(m_pAction_Machine_Settings);
-    mVMToolBar->addAction(m_pAction_Common_StartOrShow);
-    mVMToolBar->addAction(m_pAction_Common_Discard);
+    mVMToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_New));
+    mVMToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings));
+    mVMToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Discard));
+    mVMToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow));
 
     /* Prepare graphics VM list: */
     m_pChooser = new UIGChooser(this);
@@ -1388,7 +1428,7 @@ void UISelectorWindow::prepareWidgets()
                                  m_pDetails->palette().color(QPalette::Active, QPalette::Window));
 
     /* Prepare details and snapshots tabs: */
-    m_pVMDesktop = new UIVMDesktop(mVMToolBar, m_pAction_Common_Refresh, this);
+    m_pVMDesktop = new UIVMDesktop(mVMToolBar, actionPool()->action(UIActionIndexST_M_Group_S_Refresh), this);
 
     /* Crate container: */
     m_pContainer = new QStackedWidget(this);
@@ -1432,50 +1472,58 @@ void UISelectorWindow::prepareConnections()
     connect(menuBar(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(sltShowSelectorContextMenu(const QPoint&)));
 
     /* 'File' menu connections: */
-    connect(m_pMediumManagerDialogAction, SIGNAL(triggered()), this, SLOT(sltShowMediumManager()));
-    connect(m_pImportApplianceWizardAction, SIGNAL(triggered()), this, SLOT(sltShowImportApplianceWizard()));
-    connect(m_pExportApplianceWizardAction, SIGNAL(triggered()), this, SLOT(sltShowExportApplianceWizard()));
-    connect(m_pPreferencesDialogAction, SIGNAL(triggered()), this, SLOT(sltShowPreferencesDialog()));
-    connect(m_pExitAction, SIGNAL(triggered()), this, SLOT(sltPerformExit()));
-
-    /* 'Group'/'Machine' menu common connections: */
-    connect(m_pAction_Common_StartOrShow, SIGNAL(triggered()), this, SLOT(sltPerformStartOrShowAction()));
-    connect(m_pAction_Common_PauseAndResume, SIGNAL(toggled(bool)), this, SLOT(sltPerformPauseResumeAction(bool)));
-    connect(m_pAction_Common_Reset, SIGNAL(triggered()), this, SLOT(sltPerformResetAction()));
-    connect(m_pAction_Common_Discard, SIGNAL(triggered()), this, SLOT(sltPerformDiscardAction()));
-    connect(m_pAction_Common_ShowInFileManager, SIGNAL(triggered()), this, SLOT(sltShowMachineInFileManager()));
-    connect(m_pAction_Common_CreateShortcut, SIGNAL(triggered()), this, SLOT(sltPerformCreateShortcutAction()));
+    connect(actionPool()->action(UIActionIndexST_M_File_S_ShowMediumManager), SIGNAL(triggered()), this, SLOT(sltShowMediumManager()));
+    connect(actionPool()->action(UIActionIndexST_M_File_S_ImportAppliance), SIGNAL(triggered()), this, SLOT(sltShowImportApplianceWizard()));
+    connect(actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance), SIGNAL(triggered()), this, SLOT(sltShowExportApplianceWizard()));
+#ifdef DEBUG
+    connect(actionPool()->action(UIActionIndexST_M_File_S_ShowExtraDataManager), SIGNAL(triggered()), this, SLOT(sltOpenExtraDataManagerWindow()));
+#endif /* DEBUG */
+    connect(actionPool()->action(UIActionIndex_M_Application_S_Preferences), SIGNAL(triggered()), this, SLOT(sltShowPreferencesDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_File_S_Close), SIGNAL(triggered()), this, SLOT(sltPerformExit()));
 
     /* 'Group' menu connections: */
-    connect(m_pAction_Group_Add, SIGNAL(triggered()), this, SLOT(sltShowAddMachineDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_Add), SIGNAL(triggered()), this, SLOT(sltShowAddMachineDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow), SIGNAL(triggered()), this, SLOT(sltPerformStartOrShowAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_T_Pause), SIGNAL(toggled(bool)), this, SLOT(sltPerformPauseResumeAction(bool)));
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_Reset), SIGNAL(triggered()), this, SLOT(sltPerformResetAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_Discard), SIGNAL(triggered()), this, SLOT(sltPerformDiscardAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog), SIGNAL(triggered()), this, SLOT(sltShowLogDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager), SIGNAL(triggered()), this, SLOT(sltShowMachineInFileManager()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut), SIGNAL(triggered()), this, SLOT(sltPerformCreateShortcutAction()));
 
     /* 'Machine' menu connections: */
-    connect(m_pAction_Machine_Add, SIGNAL(triggered()), this, SLOT(sltShowAddMachineDialog()));
-    connect(m_pAction_Machine_Settings, SIGNAL(triggered()), this, SLOT(sltShowMachineSettingsDialog()));
-    connect(m_pAction_Machine_Clone, SIGNAL(triggered()), this, SLOT(sltShowCloneMachineWizard()));
-    connect(m_pAction_Machine_LogDialog, SIGNAL(triggered()), this, SLOT(sltShowLogDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Add), SIGNAL(triggered()), this, SLOT(sltShowAddMachineDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Settings), SIGNAL(triggered()), this, SLOT(sltShowMachineSettingsDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Clone), SIGNAL(triggered()), this, SLOT(sltShowCloneMachineWizard()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow), SIGNAL(triggered()), this, SLOT(sltPerformStartOrShowAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_T_Pause), SIGNAL(toggled(bool)), this, SLOT(sltPerformPauseResumeAction(bool)));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Reset), SIGNAL(triggered()), this, SLOT(sltPerformResetAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Discard), SIGNAL(triggered()), this, SLOT(sltPerformDiscardAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog), SIGNAL(triggered()), this, SLOT(sltShowLogDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager), SIGNAL(triggered()), this, SLOT(sltShowMachineInFileManager()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut), SIGNAL(triggered()), this, SLOT(sltPerformCreateShortcutAction()));
+
+    /* 'Group/Start or Show' menu connections: */
+    connect(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal), SIGNAL(triggered()), this, SLOT(sltPerformStartNormal()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless), SIGNAL(triggered()), this, SLOT(sltPerformStartHeadless()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable), SIGNAL(triggered()), this, SLOT(sltPerformStartDetachable()));
+
+    /* 'Machine/Start or Show' menu connections: */
+    connect(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal), SIGNAL(triggered()), this, SLOT(sltPerformStartNormal()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless), SIGNAL(triggered()), this, SLOT(sltPerformStartHeadless()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable), SIGNAL(triggered()), this, SLOT(sltPerformStartDetachable()));
 
     /* 'Group/Close' menu connections: */
-    connect(m_pGroupCloseMenu, SIGNAL(aboutToShow()), this, SLOT(sltGroupCloseMenuAboutToShow()));
-    connect(m_pGroupSaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction()));
-    connect(m_pGroupACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction()));
-    connect(m_pGroupPowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_M_Close)->menu(), SIGNAL(aboutToShow()), this, SLOT(sltGroupCloseMenuAboutToShow()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_SaveState), SIGNAL(triggered()), this, SLOT(sltPerformSaveAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Shutdown), SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Group_M_Close_S_PowerOff), SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction()));
 
     /* 'Machine/Close' menu connections: */
-    connect(m_pMachineCloseMenu, SIGNAL(aboutToShow()), this, SLOT(sltMachineCloseMenuAboutToShow()));
-    connect(m_pMachineSaveAction, SIGNAL(triggered()), this, SLOT(sltPerformSaveAction()));
-    connect(m_pMachineACPIShutdownAction, SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction()));
-    connect(m_pMachinePowerOffAction, SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction()));
-
-    /* 'Help' menu connections: */
-    connect(m_pHelpAction, SIGNAL(triggered()), &msgCenter(), SLOT(sltShowHelpHelpDialog()));
-    connect(m_pWebAction, SIGNAL(triggered()), &msgCenter(), SLOT(sltShowHelpWebDialog()));
-    connect(m_pResetWarningsAction, SIGNAL(triggered()), &msgCenter(), SLOT(sltResetSuppressedMessages()));
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-    connect(m_pNetworkAccessManager, SIGNAL(triggered()), gNetworkManager, SLOT(show()));
-    connect(m_pUpdateAction, SIGNAL(triggered()), gUpdateManager, SLOT(sltForceCheck()));
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-    connect(m_pAboutAction, SIGNAL(triggered()), &msgCenter(), SLOT(sltShowHelpAboutDialog()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_M_Close)->menu(), SIGNAL(aboutToShow()), this, SLOT(sltMachineCloseMenuAboutToShow()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_SaveState), SIGNAL(triggered()), this, SLOT(sltPerformSaveAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Shutdown), SIGNAL(triggered()), this, SLOT(sltPerformACPIShutdownAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff), SIGNAL(triggered()), this, SLOT(sltPerformPowerOffAction()));
 
     /* Status-bar connections: */
     connect(statusBar(), SIGNAL(customContextMenuRequested(const QPoint&)),
@@ -1508,115 +1556,98 @@ void UISelectorWindow::prepareConnections()
     connect(gVBoxEvents, SIGNAL(sigSnapshotTake(QString, QString)), this, SLOT(sltSnapshotChanged(QString)));
     connect(gVBoxEvents, SIGNAL(sigSnapshotDelete(QString, QString)), this, SLOT(sltSnapshotChanged(QString)));
     connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltSnapshotChanged(QString)));
+    connect(gVBoxEvents, SIGNAL(sigSnapshotRestore(QString, QString)), this, SLOT(sltSnapshotChanged(QString)));
 }
 
 void UISelectorWindow::loadSettings()
 {
-    /* Get VBox object: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-
-    /* Restore window position: */
+    /* Restore window geometry: */
     {
-        /* Loading geometry: */
-        QString strWinPos = vbox.GetExtraData(GUI_LastSelectorWindowPosition);
-        LogRelFlow(("UISelectorWindow: Loading geometry settings: {%s}\n", strWinPos.toAscii().constData()));
-
-        bool ok = false, max = false;
-        int x = 0, y = 0, w = 0, h = 0;
-        x = strWinPos.section(',', 0, 0).toInt(&ok);
-        if (ok)
-            y = strWinPos.section(',', 1, 1).toInt(&ok);
-        if (ok)
-            w = strWinPos.section(',', 2, 2).toInt(&ok);
-        if (ok)
-            h = strWinPos.section(',', 3, 3).toInt(&ok);
-        if (ok)
-            max = strWinPos.section(',', 4, 4) == GUI_LastWindowState_Max;
-
-        QRect ar = ok ? QApplication::desktop()->availableGeometry(QPoint(x, y)) :
-                        QApplication::desktop()->availableGeometry(this);
-
-        if (ok /* previous parameters were read correctly */
-            && (y > 0) && (y < ar.bottom()) /* check vertical bounds */
-            && (x + w > ar.left()) && (x < ar.right()) /* & horizontal bounds */)
-        {
-            /* Apply loaded geometry: */
-            m_normalGeo.moveTo(x, y);
-            m_normalGeo.setSize(QSize(w, h).expandedTo(minimumSizeHint()).boundedTo(ar.size()));
+        /* Load geometry: */
+        m_geometry = gEDataManager->selectorWindowGeometry(this);
 #ifdef Q_WS_MAC
-            move(m_normalGeo.topLeft());
-            resize(m_normalGeo.size());
+        move(m_geometry.topLeft());
+        resize(m_geometry.size());
 #else /* Q_WS_MAC */
-            setGeometry(m_normalGeo);
+        setGeometry(m_geometry);
 #endif /* !Q_WS_MAC */
-            LogRelFlow(("UISelectorWindow: Geometry set to: %dx%d @ %dx%d.\n",
-                        m_normalGeo.x(), m_normalGeo.y(), m_normalGeo.width(), m_normalGeo.height()));
-            if (max) /* maximize if needed */
-                showMaximized();
-        }
-        else
-        {
-            /* Apply default geometry: */
-            m_normalGeo.setSize(QSize(770, 550).expandedTo(minimumSizeHint()).boundedTo(ar.size()));
-            m_normalGeo.moveCenter(ar.center());
-            setGeometry(m_normalGeo);
-            LogRelFlow(("UISelectorWindow: Geometry set to default because something was wrong: "
-                        "(loaded correctly = '%s', x = %d, y = %d, w = %d, h = %d)!\n",
-                        ok ? "true" : "false", x, y, w, h));
-        }
+        LogRel(("UISelectorWindow: Geometry loaded to: %dx%d @ %dx%d.\n",
+                m_geometry.x(), m_geometry.y(), m_geometry.width(), m_geometry.height()));
+
+        /* Maximize (if necessary): */
+        if (gEDataManager->selectorWindowShouldBeMaximized())
+            showMaximized();
     }
 
     /* Restore splitter handle position: */
     {
-        QList<int> sizes = vbox.GetExtraDataIntList(GUI_SplitterSizes);
-
-        if (sizes.size() == 2)
-            m_pSplitter->setSizes(sizes);
+        /* Read splitter hints: */
+        QList<int> sizes = gEDataManager->selectorWindowSplitterHints();
+        /* If both hints are zero, we have the 'default' case: */
+        if (sizes[0] == 0 && sizes[1] == 0)
+        {
+            /* Propose some 'default' based on current dialog width: */
+            sizes[0] = (double)width()     / 3 * .9;
+            sizes[1] = (double)width() * 2 / 3 * .9;
+        }
+        /* Pass hints to the splitter: */
+        m_pSplitter->setSizes(sizes);
     }
 
     /* Restore toolbar and statusbar visibility: */
     {
-        QString strToolbar = vbox.GetExtraData(GUI_Toolbar);
-        QString strStatusbar = vbox.GetExtraData(GUI_Statusbar);
-
 #ifdef Q_WS_MAC
-        mVMToolBar->setVisible(strToolbar.isEmpty() || strToolbar == "true");
+        mVMToolBar->setHidden(!gEDataManager->selectorWindowToolBarVisible());
 #else /* Q_WS_MAC */
-        m_pBar->setVisible(strToolbar.isEmpty() || strToolbar == "true");
+        m_pBar->setHidden(!gEDataManager->selectorWindowToolBarVisible());
 #endif /* !Q_WS_MAC */
-        statusBar()->setVisible(strStatusbar.isEmpty() || strStatusbar == "true");
+        statusBar()->setHidden(!gEDataManager->selectorWindowStatusBarVisible());
     }
 }
 
 void UISelectorWindow::saveSettings()
 {
-    /* Get VBox object: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-
-    /* Save window position: */
+    /* Save toolbar and statusbar visibility: */
     {
-        QRect save(m_normalGeo);
-        LogRelFlow(("UISelectorWindow: Saving geometry as %dx%d @ %dx%d.\n",
-                    save.x(), save.y(), save.width(), save.height()));
-        QString strWinPos = QString("%1,%2,%3,%4").arg(save.x()).arg(save.y()).arg(save.width()).arg(save.height());
 #ifdef Q_WS_MAC
-        UIWindowMenuManager::destroy();
-        ::darwinUnregisterForUnifiedToolbarContextMenuEvents(this);
-        if (::darwinIsWindowMaximized(this))
+        gEDataManager->setSelectorWindowToolBarVisible(!mVMToolBar->isHidden());
 #else /* Q_WS_MAC */
-        if (isMaximized())
+        gEDataManager->setSelectorWindowToolBarVisible(!m_pBar->isHidden());
 #endif /* !Q_WS_MAC */
-            strWinPos += QString(",%1").arg(GUI_LastWindowState_Max);
-
-        vbox.SetExtraData(GUI_LastSelectorWindowPosition, strWinPos);
+        gEDataManager->setSelectorWindowStatusBarVisible(!statusBar()->isHidden());
     }
 
     /* Save splitter handle position: */
     {
-        vbox.SetExtraDataIntList(GUI_SplitterSizes, m_pSplitter->sizes());
+        gEDataManager->setSelectorWindowSplitterHints(m_pSplitter->sizes());
+    }
+
+    /* Save window geometry: */
+    {
+#ifdef Q_WS_MAC
+        gEDataManager->setSelectorWindowGeometry(m_geometry, ::darwinIsWindowMaximized(this));
+#else /* Q_WS_MAC */
+        gEDataManager->setSelectorWindowGeometry(m_geometry, isMaximized());
+#endif /* !Q_WS_MAC */
+        LogRel(("UISelectorWindow: Geometry saved as: %dx%d @ %dx%d.\n",
+                m_geometry.x(), m_geometry.y(), m_geometry.width(), m_geometry.height()));
     }
 }
 
+void UISelectorWindow::cleanupConnections()
+{
+#ifdef Q_WS_MAC
+    /* Tool-bar connections: */
+    ::darwinUnregisterForUnifiedToolbarContextMenuEvents(this);
+#endif /* Q_WS_MAC */
+}
+
+void UISelectorWindow::cleanupMenuBar()
+{
+    /* Destroy action-pool: */
+    UIActionPool::destroy(m_pActionPool);
+}
+
 UIVMItem* UISelectorWindow::currentItem() const
 {
     return m_pChooser->currentItem();
@@ -1634,44 +1665,72 @@ void UISelectorWindow::updateActionsAppearance()
     QList<UIVMItem*> items = currentItems();
 
     /* Enable/disable group actions: */
-    m_pAction_Group_Rename->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Rename, items));
-    m_pAction_Group_Remove->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Remove, items));
-    m_pAction_Group_Sort->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Sort, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_Rename)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_Rename, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_Remove)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_Remove, items));
+    actionPool()->action(UIActionIndexST_M_Group_T_Pause)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_T_Pause, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_Reset)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_Reset, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_Discard)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_Discard, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_ShowLogDialog, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_Refresh)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_Refresh, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_ShowInFileManager, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_CreateShortcut, items));
+    actionPool()->action(UIActionIndexST_M_Group_S_Sort)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_S_Sort, items));
 
     /* Enable/disable machine actions: */
-    m_pAction_Machine_Settings->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Settings, items));
-    m_pAction_Machine_Clone->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Clone, items));
-    m_pAction_Machine_Remove->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Remove, items));
-    m_pAction_Machine_AddGroup->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_AddGroup, items));
-    m_pAction_Machine_LogDialog->setEnabled(isActionEnabled(UIActionIndex_Simple_LogDialog, items));
-    m_pAction_Machine_SortParent->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_SortParent, items));
-
-    /* Enable/disable common actions: */
-    m_pAction_Common_StartOrShow->setEnabled(isActionEnabled(UIActionIndexSelector_State_Common_StartOrShow, items));
-    m_pAction_Common_PauseAndResume->setEnabled(isActionEnabled(UIActionIndexSelector_Toggle_Common_PauseAndResume, items));
-    m_pAction_Common_Reset->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Common_Reset, items));
-    m_pAction_Common_Discard->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Common_Discard, items));
-    m_pAction_Common_Refresh->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Common_Refresh, items));
-    m_pAction_Common_ShowInFileManager->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Common_ShowInFileManager, items));
-    m_pAction_Common_CreateShortcut->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Common_CreateShortcut, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_Settings)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Settings, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_Clone)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Clone, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_Remove)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Remove, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_AddGroup, items));
+    actionPool()->action(UIActionIndexST_M_Machine_T_Pause)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_T_Pause, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_Reset)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Reset, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_Discard)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Discard, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_ShowLogDialog, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_Refresh)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_Refresh, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_ShowInFileManager, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_CreateShortcut, items));
+    actionPool()->action(UIActionIndexST_M_Machine_S_SortParent)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_S_SortParent, items));
+
+    /* Enable/disable group-start-or-show actions: */
+    actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow, items));
+    actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal, items));
+    actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless, items));
+    actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable, items));
+
+    /* Enable/disable machine-start-or-show actions: */
+    actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_StartOrShow, items));
+    actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal, items));
+    actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless, items));
+    actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable, items));
 
     /* Enable/disable group-close actions: */
-    m_pGroupCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Group_Close, items));
-    m_pGroupSaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_Save, items));
-    m_pGroupACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_ACPIShutdown, items));
-    m_pGroupPowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Group_Close_PowerOff, items));
+    actionPool()->action(UIActionIndexST_M_Group_M_Close)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_Close, items));
+    actionPool()->action(UIActionIndexST_M_Group_M_Close_S_SaveState)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_Close_S_SaveState, items));
+    actionPool()->action(UIActionIndexST_M_Group_M_Close_S_Shutdown)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_Close_S_Shutdown, items));
+    actionPool()->action(UIActionIndexST_M_Group_M_Close_S_PowerOff)->setEnabled(isActionEnabled(UIActionIndexST_M_Group_M_Close_S_PowerOff, items));
 
     /* Enable/disable machine-close actions: */
-    m_pMachineCloseMenuAction->setEnabled(isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items));
-    m_pMachineSaveAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_Save, items));
-    m_pMachineACPIShutdownAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown, items));
-    m_pMachinePowerOffAction->setEnabled(isActionEnabled(UIActionIndexSelector_Simple_Machine_Close_PowerOff, items));
+    actionPool()->action(UIActionIndexST_M_Machine_M_Close)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Close, items));
+    actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_SaveState)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Close_S_SaveState, items));
+    actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_Shutdown)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Close_S_Shutdown, items));
+    actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff)->setEnabled(isActionEnabled(UIActionIndexST_M_Machine_M_Close_S_PowerOff, items));
 
     /* Start/Show action is deremined by 1st item: */
     if (pItem && pItem->accessible())
-        m_pAction_Common_StartOrShow->setState(UIVMItem::isItemPoweredOff(pItem) ? 0 : 1);
+    {
+        actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow)->toActionPolymorphicMenu()->setState(UIVMItem::isItemPoweredOff(pItem) ? 0 : 1);
+        actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)->toActionPolymorphicMenu()->setState(UIVMItem::isItemPoweredOff(pItem) ? 0 : 1);
+        QToolButton *pButton = qobject_cast<QToolButton*>(mVMToolBar->widgetForAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)));
+        if (pButton)
+            pButton->setPopupMode(UIVMItem::isItemPoweredOff(pItem) ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup);
+    }
     else
-        m_pAction_Common_StartOrShow->setState(0);
+    {
+        actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow)->toActionPolymorphicMenu()->setState(0);
+        actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)->toActionPolymorphicMenu()->setState(0);
+        QToolButton *pButton = qobject_cast<QToolButton*>(mVMToolBar->widgetForAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)));
+        if (pButton)
+            pButton->setPopupMode(UIVMItem::isItemPoweredOff(pItem) ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup);
+    }
 
     /* Pause/Resume action is deremined by 1st started item: */
     UIVMItem *pFirstStartedAction = 0;
@@ -1679,10 +1738,10 @@ void UISelectorWindow::updateActionsAppearance()
         if (UIVMItem::isItemStarted(pSelectedItem))
             pFirstStartedAction = pSelectedItem;
     /* Update the Pause/Resume action appearance: */
-    m_pAction_Common_PauseAndResume->blockSignals(true);
-    m_pAction_Common_PauseAndResume->setChecked(pFirstStartedAction && UIVMItem::isItemPaused(pFirstStartedAction));
-    m_pAction_Common_PauseAndResume->update();
-    m_pAction_Common_PauseAndResume->blockSignals(false);
+    actionPool()->action(UIActionIndexST_M_Group_T_Pause)->blockSignals(true);
+    actionPool()->action(UIActionIndexST_M_Group_T_Pause)->setChecked(pFirstStartedAction && UIVMItem::isItemPaused(pFirstStartedAction));
+    actionPool()->action(UIActionIndexST_M_Group_T_Pause)->retranslateUi();
+    actionPool()->action(UIActionIndexST_M_Group_T_Pause)->blockSignals(false);
 
 #ifdef QT_MAC_USE_COCOA
     /* There is a bug in Qt Cocoa which result in showing a "more arrow" when
@@ -1705,98 +1764,112 @@ bool UISelectorWindow::isActionEnabled(int iActionIndex, const QList<UIVMItem*>
     /* For known action types: */
     switch (iActionIndex)
     {
-        case UIActionIndexSelector_Simple_Group_Rename:
-        case UIActionIndexSelector_Simple_Group_Remove:
+        case UIActionIndexST_M_Group_S_Rename:
+        case UIActionIndexST_M_Group_S_Remove:
         {
             return !m_pChooser->isGroupSavingInProgress() &&
                    isItemsPoweredOff(items);
         }
-        case UIActionIndexSelector_Simple_Group_Sort:
+        case UIActionIndexST_M_Group_S_Sort:
         {
             return !m_pChooser->isGroupSavingInProgress() &&
                    m_pChooser->isSingleGroupSelected();
         }
-        case UIActionIndexSelector_Simple_Machine_Settings:
+        case UIActionIndexST_M_Machine_S_Settings:
         {
             return !m_pChooser->isGroupSavingInProgress() &&
                    items.size() == 1 &&
-                   pItem->reconfigurable();
+                   pItem->configurationAccessLevel() != ConfigurationAccessLevel_Null;
         }
-        case UIActionIndexSelector_Simple_Machine_Clone:
+        case UIActionIndexST_M_Machine_S_Clone:
         {
             return !m_pChooser->isGroupSavingInProgress() &&
                    items.size() == 1 &&
                    UIVMItem::isItemEditable(pItem);
         }
-        case UIActionIndexSelector_Simple_Machine_Remove:
+        case UIActionIndexST_M_Machine_S_Remove:
         {
             return !m_pChooser->isGroupSavingInProgress() &&
                    isAtLeastOneItemRemovable(items);
         }
-        case UIActionIndexSelector_Simple_Machine_AddGroup:
+        case UIActionIndexST_M_Machine_S_AddGroup:
         {
             return !m_pChooser->isGroupSavingInProgress() &&
                    !m_pChooser->isAllItemsOfOneGroupSelected() &&
                    isItemsPoweredOff(items);
         }
-        case UIActionIndexSelector_State_Common_StartOrShow:
+        case UIActionIndexST_M_Group_M_StartOrShow:
+        case UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal:
+        case UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless:
+        case UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable:
+        case UIActionIndexST_M_Machine_M_StartOrShow:
+        case UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal:
+        case UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless:
+        case UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable:
         {
             return !m_pChooser->isGroupSavingInProgress() &&
                    isAtLeastOneItemCanBeStartedOrShowed(items);
         }
-        case UIActionIndexSelector_Simple_Common_Discard:
+        case UIActionIndexST_M_Group_S_Discard:
+        case UIActionIndexST_M_Machine_S_Discard:
         {
             return !m_pChooser->isGroupSavingInProgress() &&
                    isAtLeastOneItemDiscardable(items);
         }
-        case UIActionIndexSelector_Toggle_Common_PauseAndResume:
+        case UIActionIndexST_M_Group_S_ShowLogDialog:
+        case UIActionIndexST_M_Machine_S_ShowLogDialog:
+        {
+            return isAtLeastOneItemAccessible(items);
+        }
+        case UIActionIndexST_M_Group_T_Pause:
+        case UIActionIndexST_M_Machine_T_Pause:
         {
             return isAtLeastOneItemStarted(items);
         }
-        case UIActionIndexSelector_Simple_Common_Reset:
+        case UIActionIndexST_M_Group_S_Reset:
+        case UIActionIndexST_M_Machine_S_Reset:
         {
             return isAtLeastOneItemRunning(items);
         }
-        case UIActionIndexSelector_Simple_Common_Refresh:
+        case UIActionIndexST_M_Group_S_Refresh:
+        case UIActionIndexST_M_Machine_S_Refresh:
         {
             return isAtLeastOneItemInaccessible(items);
         }
-        case UIActionIndex_Simple_LogDialog:
-        {
-            return items.size() == 1 && pItem->accessible();
-        }
-        case UIActionIndexSelector_Simple_Common_ShowInFileManager:
+        case UIActionIndexST_M_Group_S_ShowInFileManager:
+        case UIActionIndexST_M_Machine_S_ShowInFileManager:
         {
             return isAtLeastOneItemAccessible(items);
         }
-        case UIActionIndexSelector_Simple_Machine_SortParent:
+        case UIActionIndexST_M_Machine_S_SortParent:
         {
             return !m_pChooser->isGroupSavingInProgress();
         }
-        case UIActionIndexSelector_Simple_Common_CreateShortcut:
+        case UIActionIndexST_M_Group_S_CreateShortcut:
+        case UIActionIndexST_M_Machine_S_CreateShortcut:
         {
             return isAtLeastOneItemSupportsShortcuts(items);
         }
-        case UIActionIndexSelector_Menu_Group_Close:
-        case UIActionIndexSelector_Menu_Machine_Close:
+        case UIActionIndexST_M_Group_M_Close:
+        case UIActionIndexST_M_Machine_M_Close:
         {
             return isAtLeastOneItemStarted(items);
         }
-        case UIActionIndexSelector_Simple_Group_Close_Save:
-        case UIActionIndexSelector_Simple_Machine_Close_Save:
+        case UIActionIndexST_M_Group_M_Close_S_SaveState:
+        case UIActionIndexST_M_Machine_M_Close_S_SaveState:
         {
-            return isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items);
+            return isActionEnabled(UIActionIndexST_M_Machine_M_Close, items);
         }
-        case UIActionIndexSelector_Simple_Group_Close_ACPIShutdown:
-        case UIActionIndexSelector_Simple_Machine_Close_ACPIShutdown:
+        case UIActionIndexST_M_Group_M_Close_S_Shutdown:
+        case UIActionIndexST_M_Machine_M_Close_S_Shutdown:
         {
-            return isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items) &&
+            return isActionEnabled(UIActionIndexST_M_Machine_M_Close, items) &&
                    isAtLeastOneItemAbleToShutdown(items);
         }
-        case UIActionIndexSelector_Simple_Group_Close_PowerOff:
-        case UIActionIndexSelector_Simple_Machine_Close_PowerOff:
+        case UIActionIndexST_M_Group_M_Close_S_PowerOff:
+        case UIActionIndexST_M_Machine_M_Close_S_PowerOff:
         {
-            return isActionEnabled(UIActionIndexSelector_Menu_Machine_Close, items);
+            return isActionEnabled(UIActionIndexST_M_Machine_M_Close, items);
         }
         default:
             break;
@@ -1896,7 +1969,7 @@ bool UISelectorWindow::isAtLeastOneItemCanBeStartedOrShowed(const QList<UIVMItem
     foreach (UIVMItem *pItem, items)
     {
         if ((UIVMItem::isItemPoweredOff(pItem) && UIVMItem::isItemEditable(pItem)) ||
-            (UIVMItem::isItemStarted(pItem) && pItem->canSwitchTo()))
+            (UIVMItem::isItemStarted(pItem) && (pItem->canSwitchTo() || UIVMItem::isItemRunningHeadless(pItem))))
             return true;
     }
     return false;
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h b/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
index c908768..d04f321 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
@@ -1,7 +1,6 @@
+/* $Id: UISelectorWindow.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UISelectorWindow class declaration
+ * VBox Qt GUI - UISelectorWindow class declaration.
  */
 
 /*
@@ -30,13 +29,14 @@
 class QISplitter;
 class QMenu;
 class UIAction;
-class UIActionState;
+class UIActionPolymorphic;
 class UIMainBar;
 class UIToolBar;
 class UIVMDesktop;
 class UIVMItem;
 class UIGChooser;
 class UIGDetails;
+class UIActionPool;
 class QStackedWidget;
 
 /* VM selector window class: */
@@ -52,6 +52,9 @@ public:
                      Qt::WindowFlags flags = Qt::Window);
     ~UISelectorWindow();
 
+    /** Returns the action-pool instance. */
+    UIActionPool* actionPool() const { return m_pActionPool; }
+
 private slots:
 
     /* Handlers: Global-event stuff: */
@@ -71,6 +74,9 @@ private slots:
     void sltShowMediumManager();
     void sltShowImportApplianceWizard(const QString &strFileName = QString());
     void sltShowExportApplianceWizard();
+#ifdef DEBUG
+    void sltOpenExtraDataManagerWindow();
+#endif /* DEBUG */
     void sltShowPreferencesDialog();
     void sltPerformExit();
 
@@ -81,6 +87,9 @@ private slots:
                                       const QString &strId = QString());
     void sltShowCloneMachineWizard();
     void sltPerformStartOrShowAction();
+    void sltPerformStartNormal();
+    void sltPerformStartHeadless();
+    void sltPerformStartDetachable();
     void sltPerformDiscardAction();
     void sltPerformPauseResumeAction(bool fPause);
     void sltPerformResetAction();
@@ -117,19 +126,19 @@ private:
     void prepareIcon();
     void prepareMenuBar();
     void prepareMenuFile(QMenu *pMenu);
-    void prepareCommonActions();
-    void prepareGroupActions();
-    void prepareMachineActions();
     void prepareMenuGroup(QMenu *pMenu);
     void prepareMenuMachine(QMenu *pMenu);
+    void prepareMenuGroupStartOrShow(QMenu *pMenu);
+    void prepareMenuMachineStartOrShow(QMenu *pMenu);
     void prepareMenuGroupClose(QMenu *pMenu);
     void prepareMenuMachineClose(QMenu *pMenu);
-    void prepareMenuHelp(QMenu *pMenu);
     void prepareStatusBar();
     void prepareWidgets();
     void prepareConnections();
     void loadSettings();
     void saveSettings();
+    void cleanupConnections();
+    void cleanupMenuBar();
 
     /* Helpers: Current item stuff: */
     UIVMItem* currentItem() const;
@@ -155,6 +164,9 @@ private:
     bool m_fPolished : 1;
     bool m_fWarningAboutInaccessibleMediumShown : 1;
 
+    /** Holds the action-pool instance. */
+    UIActionPool *m_pActionPool;
+
     /* Central splitter window: */
     QISplitter *m_pSplitter;
 
@@ -174,69 +186,16 @@ private:
     /* VM details widget: */
     UIVMDesktop *m_pVMDesktop;
 
-    /* 'File' menu action pointers: */
-    QMenu *m_pFileMenu;
-    UIAction *m_pMediumManagerDialogAction;
-    UIAction *m_pImportApplianceWizardAction;
-    UIAction *m_pExportApplianceWizardAction;
-    UIAction *m_pPreferencesDialogAction;
-    UIAction *m_pExitAction;
-
-    /* Common Group/Machine actions: */
-    UIActionState *m_pAction_Common_StartOrShow;
-    UIAction *m_pAction_Common_PauseAndResume;
-    UIAction *m_pAction_Common_Reset;
-    UIAction *m_pAction_Common_Discard;
-    UIAction *m_pAction_Common_Refresh;
-    UIAction *m_pAction_Common_ShowInFileManager;
-    UIAction *m_pAction_Common_CreateShortcut;
-
     /* 'Group' menu action pointers: */
     QList<UIAction*> m_groupActions;
     QAction *m_pGroupMenuAction;
-    QMenu *m_pGroupMenu;
-    UIAction *m_pAction_Group_New;
-    UIAction *m_pAction_Group_Add;
-    UIAction *m_pAction_Group_Rename;
-    UIAction *m_pAction_Group_Remove;
-    UIAction *m_pAction_Group_Sort;
-    /* 'Group / Close' menu action pointers: */
-    UIAction *m_pGroupCloseMenuAction;
-    QMenu *m_pGroupCloseMenu;
-    UIAction *m_pGroupSaveAction;
-    UIAction *m_pGroupACPIShutdownAction;
-    UIAction *m_pGroupPowerOffAction;
 
     /* 'Machine' menu action pointers: */
     QList<UIAction*> m_machineActions;
     QAction *m_pMachineMenuAction;
-    QMenu *m_pMachineMenu;
-    UIAction *m_pAction_Machine_New;
-    UIAction *m_pAction_Machine_Add;
-    UIAction *m_pAction_Machine_Settings;
-    UIAction *m_pAction_Machine_Clone;
-    UIAction *m_pAction_Machine_Remove;
-    UIAction *m_pAction_Machine_AddGroup;
-    UIAction *m_pAction_Machine_LogDialog;
-    UIAction *m_pAction_Machine_SortParent;
-    /* 'Machine / Close' menu action pointers: */
-    UIAction *m_pMachineCloseMenuAction;
-    QMenu *m_pMachineCloseMenu;
-    UIAction *m_pMachineSaveAction;
-    UIAction *m_pMachineACPIShutdownAction;
-    UIAction *m_pMachinePowerOffAction;
-
-    /* 'Help' menu action pointers: */
-    QMenu *m_pHelpMenu;
-    UIAction *m_pHelpAction;
-    UIAction *m_pWebAction;
-    UIAction *m_pResetWarningsAction;
-    UIAction *m_pNetworkAccessManager;
-    UIAction *m_pUpdateAction;
-    UIAction *m_pAboutAction;
 
     /* Other variables: */
-    QRect m_normalGeo;
+    QRect m_geometry;
 };
 
 #endif // __UISelectorWindow_h__
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp b/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
index 438ed51..e0a048e 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIVMDesktop.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIVMDesktop class implementation
+ * VBox Qt GUI - UIVMDesktop class implementation.
  */
 
 /*
@@ -17,28 +15,36 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QLabel>
-#include <QStackedLayout>
-#include <QStackedWidget>
-#include <QToolButton>
-#ifdef Q_WS_MAC
-# include <QTimer>
-#endif /* Q_WS_MAC */
+# include <QLabel>
+# include <QStackedWidget>
+# include <QToolButton>
+# ifdef Q_WS_MAC
+#  include <QTimer>
+# endif /* Q_WS_MAC */
 
 /* GUI includes */
-#include "UIBar.h"
-#include "UIIconPool.h"
-#include "UISpacerWidgets.h"
-#include "UISpecialControls.h"
-#include "UIVMDesktop.h"
-#include "UIVMItem.h"
-#include "UIToolBar.h"
-#include "VBoxSnapshotsWgt.h"
-#include "VBoxUtils.h"
+# include "UIBar.h"
+# include "UIIconPool.h"
+# include "UISpacerWidgets.h"
+# include "UISpecialControls.h"
+# include "UIVMDesktop.h"
+# include "UIVMItem.h"
+# include "UIToolBar.h"
+# include "VBoxSnapshotsWgt.h"
+# include "VBoxUtils.h"
 
 /* Other VBox includes: */
-#include <iprt/assert.h>
+# include <iprt/assert.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QStackedLayout>
+
 
 //#ifdef Q_WS_MAC
 # define USE_TOOLBAR
@@ -226,11 +232,28 @@ enum
 UIVMDesktop::UIVMDesktop(UIToolBar *pToolBar, QAction *pRefreshAction, QWidget *pParent)
     : QIWithRetranslateUI<QWidget>(pParent)
 {
-    /* Prepare buttons: */
-    m_pHeaderBtn = new UITexturedSegmentedButton(2);
-    m_pHeaderBtn->setIcon(Dtls, UIIconPool::iconSet(":/vm_settings_16px.png"));
-    m_pHeaderBtn->setIcon(Snap, UIIconPool::iconSet(":/snapshot_take_16px.png",
-                                                    ":/snapshot_take_disabled_16px.png"));
+    /* Create container: */
+    QWidget *pContainer = new QWidget;
+    {
+        /* Create layout: */
+        QHBoxLayout *pLayout = new QHBoxLayout(pContainer);
+        {
+            /* Configure layout: */
+            pLayout->setContentsMargins(0, 0, 0, 0);
+            /* Create segmented-button: */
+            m_pHeaderBtn = new UITexturedSegmentedButton(pContainer, 2);
+            {
+                /* Configure segmented-button: */
+                m_pHeaderBtn->setIcon(Dtls, UIIconPool::iconSet(":/vm_settings_16px.png",
+                                                                ":/vm_settings_disabled_16px.png"));
+                m_pHeaderBtn->setIcon(Snap, UIIconPool::iconSet(":/snapshot_take_16px.png",
+                                                                ":/snapshot_take_disabled_16px.png"));
+                /* Add segmented-buttons into layout: */
+                pLayout->addWidget(m_pHeaderBtn);
+            }
+        }
+    }
+
 #ifdef Q_WS_MAC
     /* Cocoa stuff should be async...
      * Do not ask me why but otherwise
@@ -250,7 +273,7 @@ UIVMDesktop::UIVMDesktop(UIToolBar *pToolBar, QAction *pRefreshAction, QWidget *
     if (pToolBar)
     {
         pToolBar->addWidget(new UIHorizontalSpacerWidget(this));
-        pToolBar->addWidget(m_pHeaderBtn);
+        pToolBar->addWidget(pContainer);
         QWidget *pSpace = new QWidget(this);
         /* We need a little bit more space for the beta label. */
         if (vboxGlobal().isBeta())
@@ -268,7 +291,7 @@ UIVMDesktop::UIVMDesktop(UIToolBar *pToolBar, QAction *pRefreshAction, QWidget *
 #endif /* !USE_TOOLBAR */
     {
         UIBar *pBar = new UIBar(this);
-        pBar->setContentWidget(m_pHeaderBtn);
+        pBar->setContentWidget(pContainer);
         pMainLayout->addWidget(pBar);
     }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.h b/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.h
index fe4cc0a..3b3924b 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.h
@@ -1,3 +1,4 @@
+/* $Id: UIVMDesktop.h $ */
 /** @file
  *
  * VBox frontends: Qt GUI ("VirtualBox"):
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp b/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp
index ae0746f..1908cd1 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIVMItem.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIVMItem class implementation
+ * VBox Qt GUI - UIVMItem class implementation.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,26 +16,28 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QFileInfo>
-#include <QIcon>
+# include <QFileInfo>
+# include <QIcon>
 
 /* GUI includes: */
-#include "UIVMItem.h"
-#include "VBoxGlobal.h"
-#include "UIConverter.h"
-#ifdef Q_WS_MAC
-# include <ApplicationServices/ApplicationServices.h>
-#endif /* Q_WS_MAC */
+# include "UIVMItem.h"
+# include "VBoxGlobal.h"
+# include "UIConverter.h"
+# include "UIExtraDataManager.h"
+# ifdef Q_WS_MAC
+#  include <ApplicationServices/ApplicationServices.h>
+# endif /* Q_WS_MAC */
 
 /* COM includes: */
-#include "CSnapshot.h"
+# include "CSnapshot.h"
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 // Helpers
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -152,10 +152,10 @@ UIVMItem::~UIVMItem()
 // public members
 ////////////////////////////////////////////////////////////////////////////////
 
-QIcon UIVMItem::osIcon() const
+QPixmap UIVMItem::osPixmap(QSize *pLogicalSize /* = 0 */) const
 {
-    return m_fAccessible ? vboxGlobal().vmGuestOSTypeIcon(m_strOSTypeId) :
-                           QPixmap(":/os_other.png");
+    return m_fAccessible ? vboxGlobal().vmGuestOSTypeIcon(m_strOSTypeId, pLogicalSize) :
+                           vboxGlobal().vmGuestOSTypeIcon("Other", pLogicalSize);
 }
 
 QString UIVMItem::machineStateName() const
@@ -166,8 +166,8 @@ QString UIVMItem::machineStateName() const
 
 QIcon UIVMItem::machineStateIcon() const
 {
-    return m_fAccessible ? gpConverter->toPixmap(m_machineState) :
-                           QPixmap(":/state_aborted_16px.png");
+    return m_fAccessible ? gpConverter->toIcon(m_machineState) :
+                           gpConverter->toIcon(KMachineState_Aborted);
 }
 
 QString UIVMItem::sessionStateName() const
@@ -256,12 +256,15 @@ bool UIVMItem::recache()
 #endif
         }
 
-        /* Should we allow reconfiguration for this item? */
-        m_fReconfigurable = m_machineState != KMachineState_Stuck &&
-                            VBoxGlobal::shouldWeAllowMachineReconfiguration(m_machine);
+        /* Determine configuration access level: */
+        m_configurationAccessLevel = ::configurationAccessLevel(m_sessionState, m_machineState);
+        /* Also take restrictions into account: */
+        if (   m_configurationAccessLevel != ConfigurationAccessLevel_Null
+            && !gEDataManager->machineReconfigurationEnabled(m_strId))
+            m_configurationAccessLevel = ConfigurationAccessLevel_Null;
 
         /* Should we show details for this item? */
-        m_fHasDetails = VBoxGlobal::shouldWeShowDetails(m_machine);
+        m_fHasDetails = gEDataManager->showMachineInSelectorDetails(m_strId);
     }
     else
     {
@@ -286,8 +289,8 @@ bool UIVMItem::recache()
         mWinId = (WId) ~0;
 #endif
 
-        /* Should we allow reconfiguration for this item? */
-        m_fReconfigurable = false;
+        /* Set configuration access level to NULL: */
+        m_configurationAccessLevel = ConfigurationAccessLevel_Null;
 
         /* Should we show details for this item? */
         m_fHasDetails = true;
@@ -430,29 +433,28 @@ bool UIVMItem::switchTo()
 /* static */
 bool UIVMItem::isItemEditable(UIVMItem *pItem)
 {
-    return pItem->accessible() &&
+    return pItem &&
+           pItem->accessible() &&
            pItem->sessionState() == KSessionState_Unlocked;
 }
 
 /* static */
 bool UIVMItem::isItemSaved(UIVMItem *pItem)
 {
-    if (pItem->accessible() &&
-        pItem->machineState() == KMachineState_Saved)
-        return true;
-    return false;
+    return pItem &&
+           pItem->accessible() &&
+           pItem->machineState() == KMachineState_Saved;
 }
 
 /* static */
 bool UIVMItem::isItemPoweredOff(UIVMItem *pItem)
 {
-    if (pItem->accessible() &&
-        (pItem->machineState() == KMachineState_PoweredOff ||
-         pItem->machineState() == KMachineState_Saved ||
-         pItem->machineState() == KMachineState_Teleported ||
-         pItem->machineState() == KMachineState_Aborted))
-        return true;
-    return false;
+    return pItem &&
+           pItem->accessible() &&
+           (pItem->machineState() == KMachineState_PoweredOff ||
+            pItem->machineState() == KMachineState_Saved ||
+            pItem->machineState() == KMachineState_Teleported ||
+            pItem->machineState() == KMachineState_Aborted);
 }
 
 /* static */
@@ -464,32 +466,48 @@ bool UIVMItem::isItemStarted(UIVMItem *pItem)
 /* static */
 bool UIVMItem::isItemRunning(UIVMItem *pItem)
 {
-    if (pItem->accessible() &&
-        (pItem->machineState() == KMachineState_Running ||
-         pItem->machineState() == KMachineState_Teleporting ||
-         pItem->machineState() == KMachineState_LiveSnapshotting))
-        return true;
-    return false;
+    return pItem &&
+           pItem->accessible() &&
+           (pItem->machineState() == KMachineState_Running ||
+            pItem->machineState() == KMachineState_Teleporting ||
+            pItem->machineState() == KMachineState_LiveSnapshotting);
 }
 
 /* static */
-bool UIVMItem::isItemPaused(UIVMItem *pItem)
+bool UIVMItem::isItemRunningHeadless(UIVMItem *pItem)
 {
-    if (pItem->accessible() &&
-        (pItem->machineState() == KMachineState_Paused ||
-         pItem->machineState() == KMachineState_TeleportingPausedVM))
-        return true;
+    if (isItemRunning(pItem))
+    {
+        /* Open session to determine which frontend VM is started with: */
+        CSession session = vboxGlobal().openExistingSession(pItem->id());
+        if (!session.isNull())
+        {
+            /* Acquire the session name: */
+            const QString strSessionName = session.GetMachine().GetSessionName();
+            /* Close the session early: */
+            session.UnlockMachine();
+            /* Check whether we are in 'headless' session: */
+            return strSessionName == "headless";
+        }
+    }
     return false;
+}
 
+/* static */
+bool UIVMItem::isItemPaused(UIVMItem *pItem)
+{
+    return pItem &&
+           pItem->accessible() &&
+           (pItem->machineState() == KMachineState_Paused ||
+            pItem->machineState() == KMachineState_TeleportingPausedVM);
 }
 
 /* static */
 bool UIVMItem::isItemStuck(UIVMItem *pItem)
 {
-    if (pItem->accessible() &&
-        pItem->machineState() == KMachineState_Stuck)
-        return true;
-    return false;
+    return pItem &&
+           pItem->accessible() &&
+           pItem->machineState() == KMachineState_Stuck;
 }
 
 QString UIVMItemMimeData::m_type = "application/org.virtualbox.gui.vmselector.uivmitem";
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h b/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h
index 2fe7e40..28920c9 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UIVMItem.h
@@ -1,7 +1,6 @@
+/* $Id: UIVMItem.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIVMItem class declarations
+ * VBox Qt GUI - UIVMItem class declarations.
  */
 
 /*
@@ -23,11 +22,17 @@
 #include <QDateTime>
 #include <QMimeData>
 
+/* GUI includes: */
+#include "UISettingsDefs.h"
+
 /* COM includes: */
 #include "COMEnums.h"
 #include "CVirtualBoxErrorInfo.h"
 #include "CMachine.h"
 
+/* Using declarations: */
+using namespace UISettingsDefs;
+
 class UIVMItem
 {
 public:
@@ -38,7 +43,7 @@ public:
     CMachine machine() const { return m_machine; }
 
     QString name() const { return m_strName; }
-    QIcon osIcon() const;
+    QPixmap osPixmap(QSize *pLogicalSize = 0) const;
     QString osTypeId() const { return m_strOSTypeId; }
     QString id() const { return m_strId; }
 
@@ -64,14 +69,17 @@ public:
     bool canSwitchTo() const;
     bool switchTo();
 
-    bool reconfigurable() const { return m_fReconfigurable; }
     bool hasDetails() const { return m_fHasDetails; }
 
+    /** Returns configuration access level. */
+    ConfigurationAccessLevel configurationAccessLevel() const { return m_configurationAccessLevel; }
+
     static bool isItemEditable(UIVMItem *pItem);
     static bool isItemSaved(UIVMItem *pItem);
     static bool isItemPoweredOff(UIVMItem *pItem);
     static bool isItemStarted(UIVMItem *pItem);
     static bool isItemRunning(UIVMItem *pItem);
+    static bool isItemRunningHeadless(UIVMItem *pItem);
     static bool isItemPaused(UIVMItem *pItem);
     static bool isItemStuck(UIVMItem *pItem);
 
@@ -97,8 +105,10 @@ private:
 
     ULONG m_pid;
 
-    bool m_fReconfigurable;
     bool m_fHasDetails;
+
+    /** Holds configuration access level. */
+    ConfigurationAccessLevel m_configurationAccessLevel;
 };
 
 /* Make the pointer of this class public to the QVariant framework */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp b/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp
index ca488a9..a13757c 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIVirtualBoxEventHandler.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIVirtualBoxEventHandler class implementation
+ * VBox Qt GUI - UIVirtualBoxEventHandler class implementation.
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIVirtualBoxEventHandler.h"
-#include "UIMainEventListener.h"
-#include "VBoxGlobal.h"
+# include "UIVirtualBoxEventHandler.h"
+# include "UIMainEventListener.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "CEventSource.h"
+# include "CEventSource.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static */
 UIVirtualBoxEventHandler *UIVirtualBoxEventHandler::m_pInstance = 0;
@@ -32,7 +37,7 @@ UIVirtualBoxEventHandler *UIVirtualBoxEventHandler::m_pInstance = 0;
 UIVirtualBoxEventHandler* UIVirtualBoxEventHandler::instance()
 {
     if (!m_pInstance)
-        m_pInstance = new UIVirtualBoxEventHandler();
+        m_pInstance = new UIVirtualBoxEventHandler;
     return m_pInstance;
 }
 
@@ -48,56 +53,93 @@ void UIVirtualBoxEventHandler::destroy()
 
 UIVirtualBoxEventHandler::UIVirtualBoxEventHandler()
 {
-//    RTPrintf("Self add: %RTthrd\n", RTThreadSelf());
-    const CVirtualBox &vbox = vboxGlobal().virtualBox();
+    /* Create Main-event listener instance: */
     ComObjPtr<UIMainEventListenerImpl> pListener;
     pListener.createObject();
-    pListener->init(new UIMainEventListener(), this);
+    pListener->init(new UIMainEventListener, this);
     m_mainEventListener = CEventListener(pListener);
-    QVector<KVBoxEventType> events;
-    events
+
+    /* Get VirtualBoxClient: */
+    const CVirtualBoxClient vboxClient = vboxGlobal().virtualBoxClient();
+    AssertWrapperOk(vboxClient);
+    /* Get event-source: */
+    CEventSource eventSourceVirtualBoxClient = vboxClient.GetEventSource();
+    AssertWrapperOk(eventSourceVirtualBoxClient);
+    /* Register listener for expected event-types: */
+    QVector<KVBoxEventType> vboxClientEvents;
+    vboxClientEvents
+        << KVBoxEventType_OnVBoxSVCAvailabilityChanged;
+    eventSourceVirtualBoxClient.RegisterListener(m_mainEventListener, vboxClientEvents, TRUE);
+    AssertWrapperOk(eventSourceVirtualBoxClient);
+
+    /* Get VirtualBox: */
+    const CVirtualBox vbox = vboxGlobal().virtualBox();
+    AssertWrapperOk(vbox);
+    /* Get event-source: */
+    CEventSource eventSourceVirtualBox = vbox.GetEventSource();
+    AssertWrapperOk(eventSourceVirtualBox);
+    /* Register listener for expected event-types: */
+    QVector<KVBoxEventType> vboxEvents;
+    vboxEvents
         << KVBoxEventType_OnMachineStateChanged
         << KVBoxEventType_OnMachineDataChanged
         << KVBoxEventType_OnMachineRegistered
         << KVBoxEventType_OnSessionStateChanged
         << KVBoxEventType_OnSnapshotTaken
         << KVBoxEventType_OnSnapshotDeleted
-        << KVBoxEventType_OnSnapshotChanged;
-
-    vbox.GetEventSource().RegisterListener(m_mainEventListener, events, TRUE);
-    AssertWrapperOk(vbox);
-
+        << KVBoxEventType_OnSnapshotChanged
+        << KVBoxEventType_OnSnapshotRestored;
+    eventSourceVirtualBox.RegisterListener(m_mainEventListener, vboxEvents, TRUE);
+    AssertWrapperOk(eventSourceVirtualBox);
+
+    /* Prepare connections: */
+    connect(pListener->getWrapped(), SIGNAL(sigVBoxSVCAvailabilityChange(bool)),
+            this, SIGNAL(sigVBoxSVCAvailabilityChange(bool)),
+            Qt::QueuedConnection);
     connect(pListener->getWrapped(), SIGNAL(sigMachineStateChange(QString, KMachineState)),
             this, SIGNAL(sigMachineStateChange(QString, KMachineState)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigMachineDataChange(QString)),
             this, SIGNAL(sigMachineDataChange(QString)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigMachineRegistered(QString, bool)),
             this, SIGNAL(sigMachineRegistered(QString, bool)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigSessionStateChange(QString, KSessionState)),
             this, SIGNAL(sigSessionStateChange(QString, KSessionState)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigSnapshotTake(QString, QString)),
             this, SIGNAL(sigSnapshotTake(QString, QString)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigSnapshotDelete(QString, QString)),
             this, SIGNAL(sigSnapshotDelete(QString, QString)),
             Qt::QueuedConnection);
-
     connect(pListener->getWrapped(), SIGNAL(sigSnapshotChange(QString, QString)),
             this, SIGNAL(sigSnapshotChange(QString, QString)),
             Qt::QueuedConnection);
+    connect(pListener->getWrapped(), SIGNAL(sigSnapshotRestore(QString, QString)),
+            this, SIGNAL(sigSnapshotRestore(QString, QString)),
+            Qt::QueuedConnection);
 }
 
 UIVirtualBoxEventHandler::~UIVirtualBoxEventHandler()
 {
-    const CVirtualBox &vbox = vboxGlobal().virtualBox();
-    vbox.GetEventSource().UnregisterListener(m_mainEventListener);
+    /* Get VirtualBox: */
+    const CVirtualBox vbox = vboxGlobal().virtualBox();
+    AssertWrapperOk(vbox);
+    /* Get event-source: */
+    CEventSource eventSourceVirtualBox = vbox.GetEventSource();
+    AssertWrapperOk(eventSourceVirtualBox);
+    /* Unregister listener: */
+    eventSourceVirtualBox.UnregisterListener(m_mainEventListener);
+
+    /* Get VirtualBoxClient: */
+    const CVirtualBoxClient vboxClient = vboxGlobal().virtualBoxClient();
+    AssertWrapperOk(vboxClient);
+    /* Get event-source: */
+    CEventSource eventSourceVirtualBoxClient = vboxClient.GetEventSource();
+    AssertWrapperOk(eventSourceVirtualBoxClient);
+    /* Unregister listener: */
+    eventSourceVirtualBoxClient.UnregisterListener(m_mainEventListener);
 }
+
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.h b/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.h
index 742aac9..ed31176 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/UIVirtualBoxEventHandler.h
@@ -1,11 +1,10 @@
+/* $Id: UIVirtualBoxEventHandler.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIVirtualBoxEventHandler class declaration
+ * VBox Qt GUI - UIVirtualBoxEventHandler class declaration.
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,41 +15,60 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIVirtualBoxEventHandler_h__
-#define __UIVirtualBoxEventHandler_h__
+#ifndef ___UIVirtualBoxEventHandler_h___
+#define ___UIVirtualBoxEventHandler_h___
 
 /* COM includes: */
 #include "COMEnums.h"
 #include "CEventListener.h"
 
-class UIVirtualBoxEventHandler: public QObject
+/** Active event handler singleton for the CVirtualBoxClient and CVirtualBox event-sources. */
+class UIVirtualBoxEventHandler : public QObject
 {
     Q_OBJECT;
 
-public:
-    static UIVirtualBoxEventHandler* instance();
-    static void destroy();
-
 signals:
-    /* VirtualBox main signals */
+
+    /** Notifies about the VBoxSVC become @a fAvailable. */
+    void sigVBoxSVCAvailabilityChange(bool fAvailable);
+
+    /** Notifies about @a state change event for the machine with @a strId. */
     void sigMachineStateChange(QString strId, KMachineState state);
+    /** Notifies about data change event for the machine with @a strId. */
     void sigMachineDataChange(QString strId);
+    /** Notifies about machine with @a strId was @a fRegistered. */
     void sigMachineRegistered(QString strId, bool fRegistered);
+    /** Notifies about @a state change event for the session of the machine with @a strId. */
     void sigSessionStateChange(QString strId, KSessionState state);
+    /** Notifies about snapshot with @a strSnapshotId was taken for the machine with @a strId. */
     void sigSnapshotTake(QString strId, QString strSnapshotId);
+    /** Notifies about snapshot with @a strSnapshotId was deleted for the machine with @a strId. */
     void sigSnapshotDelete(QString strId, QString strSnapshotId);
+    /** Notifies about snapshot with @a strSnapshotId was changed for the machine with @a strId. */
     void sigSnapshotChange(QString strId, QString strSnapshotId);
+    /** Notifies about snapshot with @a strSnapshotId was restored for the machine with @a strId. */
+    void sigSnapshotRestore(QString strId, QString strSnapshotId);
+
+public:
+
+    /** Returns singleton instance created by the factory. */
+    static UIVirtualBoxEventHandler* instance();
+    /** Destroys singleton instance created by the factory. */
+    static void destroy();
 
 private:
+
+    /** Constructor. */
     UIVirtualBoxEventHandler();
+    /** Destructor. */
     ~UIVirtualBoxEventHandler();
 
-    /* Private member vars */
+    /** Holds the static singleton instance. */
     static UIVirtualBoxEventHandler *m_pInstance;
+    /** Holds the COM event-listener instance. */
     CEventListener m_mainEventListener;
 };
 
 #define gVBoxEvents UIVirtualBoxEventHandler::instance()
 
-#endif /* !__UIVirtualBoxEventHandler_h__ */
-
+#endif /* !___UIVirtualBoxEventHandler_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp b/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
index 9bb7327..8e9144e 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
@@ -1,12 +1,10 @@
 /* $Id: VBoxSnapshotsWgt.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxSnapshotsWgt class implementation
+ * VBox Qt GUI - VBoxSnapshotsWgt class implementation.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,35 +16,37 @@
  */
 
 #ifdef VBOX_WITH_PRECOMPILED_HEADERS
-# include "precomp.h"
+# include <precomp.h>
 #else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QDateTime>
-#include <QHeaderView>
-#include <QMenu>
-#include <QScrollBar>
-#include <QWindowsStyle>
-#include <QPointer>
-#include <QApplication>
+# include <QDateTime>
+# include <QHeaderView>
+# include <QMenu>
+# include <QScrollBar>
+# include <QWindowsStyle>
+# include <QPointer>
+# include <QApplication>
 
 /* GUI includes: */
-#include "UIIconPool.h"
-#include "UIMessageCenter.h"
-#include "VBoxSnapshotDetailsDlg.h"
-#include "VBoxSnapshotsWgt.h"
-#include "VBoxTakeSnapshotDlg.h"
-#include "UIWizardCloneVM.h"
-#include "UIToolBar.h"
-#include "UIVirtualBoxEventHandler.h"
-#include "UIConverter.h"
-#include "UIModalWindowManager.h"
+# include "UIIconPool.h"
+# include "UIMessageCenter.h"
+# include "VBoxSnapshotDetailsDlg.h"
+# include "VBoxSnapshotsWgt.h"
+# include "VBoxTakeSnapshotDlg.h"
+# include "UIWizardCloneVM.h"
+# include "UIToolBar.h"
+# include "UIVirtualBoxEventHandler.h"
+# include "UIConverter.h"
+# include "UIModalWindowManager.h"
+# include "UIExtraDataManager.h"
 
 /* COM includes: */
-#include "CConsole.h"
+# include "CConsole.h"
 
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
+
 /**
  *  QTreeWidgetItem subclass for snapshots items
  */
@@ -57,24 +57,27 @@ public:
     enum { ItemType = QTreeWidgetItem::UserType + 1 };
 
     /* Normal snapshot item (child of tree-widget) */
-    SnapshotWgtItem (QTreeWidget *aTreeWidget, const CSnapshot &aSnapshot)
+    SnapshotWgtItem (VBoxSnapshotsWgt *pSnapshotWidget, QTreeWidget *aTreeWidget, const CSnapshot &aSnapshot)
         : QTreeWidgetItem (aTreeWidget, ItemType)
+        , m_pSnapshotWidget(pSnapshotWidget)
         , mIsCurrentState (false)
         , mSnapshot (aSnapshot)
     {
     }
 
     /* Normal snapshot item (child of tree-widget-item) */
-    SnapshotWgtItem (QTreeWidgetItem *aRootItem, const CSnapshot &aSnapshot)
+    SnapshotWgtItem (VBoxSnapshotsWgt *pSnapshotWidget, QTreeWidgetItem *aRootItem, const CSnapshot &aSnapshot)
         : QTreeWidgetItem (aRootItem, ItemType)
+        , m_pSnapshotWidget(pSnapshotWidget)
         , mIsCurrentState (false)
         , mSnapshot (aSnapshot)
     {
     }
 
     /* Current state item (child of tree-widget) */
-    SnapshotWgtItem (QTreeWidget *aTreeWidget, const CMachine &aMachine)
+    SnapshotWgtItem (VBoxSnapshotsWgt *pSnapshotWidget, QTreeWidget *aTreeWidget, const CMachine &aMachine)
         : QTreeWidgetItem (aTreeWidget, ItemType)
+        , m_pSnapshotWidget(pSnapshotWidget)
         , mIsCurrentState (true)
         , mMachine (aMachine)
     {
@@ -82,8 +85,9 @@ public:
     }
 
     /* Current state item (child of tree-widget-item) */
-    SnapshotWgtItem (QTreeWidgetItem *aRootItem, const CMachine &aMachine)
+    SnapshotWgtItem (VBoxSnapshotsWgt *pSnapshotWidget, QTreeWidgetItem *aRootItem, const CMachine &aMachine)
         : QTreeWidgetItem (aRootItem, ItemType)
+        , m_pSnapshotWidget(pSnapshotWidget)
         , mIsCurrentState (true)
         , mMachine (aMachine)
     {
@@ -98,6 +102,19 @@ public:
                 return mIsCurrentState ? QTreeWidgetItem::data (aColumn, aRole) : QVariant (QString ("%1%2")
                                          .arg (QTreeWidgetItem::data (aColumn, Qt::DisplayRole).toString())
                                          .arg (QTreeWidgetItem::data (aColumn, Qt::UserRole).toString()));
+            case Qt::SizeHintRole:
+            {
+                /* Determine the icon metric: */
+                const QStyle *pStyle = QApplication::style();
+                const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
+                /* Determine the minimum size-hint for this tree-widget-item: */
+                const QSize baseSizeHint = QTreeWidgetItem::data(aColumn, aRole).toSize();
+                /* Determine the effective height-hint for this tree-widget-item: */
+                const int iEffectiveHeightHint = qMax(baseSizeHint.height(),
+                                                      iIconMetric + 2 * 2 /* margins */);
+                /* Return size-hint for this tree-widget-item: */
+                return QSize(baseSizeHint.width(), iEffectiveHeightHint);
+            }
             default:
                 break;
         }
@@ -169,7 +186,7 @@ public:
             mId = mSnapshot.GetId();
             setText (0, mSnapshot.GetName());
             mOnline = mSnapshot.GetOnline();
-            setIcon (0, vboxGlobal().snapshotIcon (mOnline));
+            setIcon(0, m_pSnapshotWidget->snapshotItemIcon(mOnline));
             mDesc = mSnapshot.GetDescription();
             mTimestamp.setTime_t (mSnapshot.GetTimeStamp() / 1000);
             mCurStateModified = false;
@@ -191,7 +208,7 @@ public:
         if (mMachine.isNull())
             return;
 
-        setIcon (0, gpConverter->toPixmap (aState));
+        setIcon(0, gpConverter->toIcon(aState));
         mMachineState = aState;
         mTimestamp.setTime_t (mMachine.GetLastStateChange() / 1000);
     }
@@ -294,6 +311,9 @@ private:
         setToolTip (0, toolTip);
     }
 
+    /** Holds pointer to snapshot-widget 'this' item belongs to. */
+    QPointer<VBoxSnapshotsWgt> m_pSnapshotWidget;
+
     bool mIsCurrentState;
 
     CSnapshot mSnapshot;
@@ -364,9 +384,12 @@ VBoxSnapshotsWgt::VBoxSnapshotsWgt (QWidget *aParent)
     connect (mTreeWidget, SIGNAL (destroyed (QObject *)), treeWidgetStyle, SLOT (deleteLater()));
 // #endif
 
+    /* Cache pixmaps: */
+    m_offlineSnapshotIcon = UIIconPool::iconSet(":/snapshot_offline_16px.png");
+    m_onlineSnapshotIcon = UIIconPool::iconSet(":/snapshot_online_16px.png");
+
     /* ToolBar creation */
     UIToolBar *toolBar = new UIToolBar (this);
-    toolBar->setUsesTextLabel (false);
     toolBar->setIconSize (QSize (22, 22));
     toolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
 
@@ -382,23 +405,18 @@ VBoxSnapshotsWgt::VBoxSnapshotsWgt (QWidget *aParent)
 
     /* Setup actions */
     mRestoreSnapshotAction->setIcon(UIIconPool::iconSetFull(
-        QSize (22, 22), QSize (16, 16),
         ":/snapshot_restore_22px.png", ":/snapshot_restore_16px.png",
         ":/snapshot_restore_disabled_22px.png", ":/snapshot_restore_disabled_16px.png"));
     mDeleteSnapshotAction->setIcon(UIIconPool::iconSetFull(
-        QSize (22, 22), QSize (16, 16),
         ":/snapshot_delete_22px.png", ":/snapshot_delete_16px.png",
         ":/snapshot_delete_disabled_22px.png", ":/snapshot_delete_disabled_16px.png"));
     mShowSnapshotDetailsAction->setIcon(UIIconPool::iconSetFull(
-        QSize (22, 22), QSize (16, 16),
         ":/snapshot_show_details_22px.png", ":/snapshot_show_details_16px.png",
         ":/snapshot_show_details_disabled_22px.png", ":/snapshot_details_show_disabled_16px.png"));
     mTakeSnapshotAction->setIcon(UIIconPool::iconSetFull(
-        QSize (22, 22), QSize (16, 16),
         ":/snapshot_take_22px.png", ":/snapshot_take_16px.png",
         ":/snapshot_take_disabled_22px.png", ":/snapshot_take_disabled_16px.png"));
     mCloneSnapshotAction->setIcon(UIIconPool::iconSetFull(
-        QSize (22, 22), QSize (16, 16),
         ":/vm_clone_22px.png", ":/vm_clone_16px.png",
         ":/vm_clone_disabled_22px.png", ":/vm_clone_disabled_16px.png"));
 
@@ -452,7 +470,7 @@ void VBoxSnapshotsWgt::setMachine (const CMachine &aMachine)
     {
         mMachineId = aMachine.GetId();
         mSessionState = aMachine.GetSessionState();
-        m_fShapshotOperationsAllowed = vboxGlobal().shouldWeAllowSnapshotOperations(mMachine);
+        m_fShapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(mMachineId);
     }
 
     refreshAll();
@@ -635,16 +653,16 @@ void VBoxSnapshotsWgt::sltRestoreSnapshot(bool fSuppressNonCriticalWarnings /* =
         return;
 
     /* Restore chosen snapshot: */
-    CConsole console = session.GetConsole();
-    CProgress progress = console.RestoreSnapshot(snapshot);
-    if (console.isOk())
+    CMachine machine = session.GetMachine();
+    CProgress progress = machine.RestoreSnapshot(snapshot);
+    if (machine.isOk())
     {
         msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_restore_90px.png");
         if (progress.GetResultCode() != 0)
             msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), mMachine.GetName());
     }
     else
-        msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), mMachine.GetName());
+        msgCenter().cannotRestoreSnapshot(machine, snapshot.GetName(), mMachine.GetName());
 
     /* Unlock machine finally: */
     session.UnlockMachine();
@@ -682,9 +700,10 @@ void VBoxSnapshotsWgt::sltDeleteSnapshot()
     if (session.isNull())
         return;
 
-    CConsole console = session.GetConsole();
-    CProgress progress = console.DeleteSnapshot (snapId);
-    if (console.isOk())
+    /* Remove chosen snapshot: */
+    CMachine machine = session.GetMachine();
+    CProgress progress = machine.DeleteSnapshot(snapId);
+    if (machine.isOk())
     {
         /* Show the progress dialog */
         msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_discard_90px.png");
@@ -693,7 +712,7 @@ void VBoxSnapshotsWgt::sltDeleteSnapshot()
             msgCenter().cannotRemoveSnapshot(progress,  snapshot.GetName(), mMachine.GetName());
     }
     else
-        msgCenter().cannotRemoveSnapshot(console,  snapshot.GetName(), mMachine.GetName());
+        msgCenter().cannotRemoveSnapshot(machine,  snapshot.GetName(), mMachine.GetName());
 
     session.UnlockMachine();
 }
@@ -823,103 +842,71 @@ bool VBoxSnapshotsWgt::takeSnapshot()
 
     if (fIsValid)
     {
-        /* Get corresponding console object also: */
-        CConsole console = session.GetConsole();
-        /* Remember runtime state: */
-        bool fAtRuntime = mMachine.GetState() == KMachineState_Running;
-        /* Remember paused state: */
-        bool fWasPaused = mMachine.GetState() == KMachineState_Paused ||
-                          mMachine.GetState() == KMachineState_TeleportingPausedVM;
-
-        /* Pause VM if necessary: */
-        if (fIsValid && fAtRuntime && !fWasPaused)
+        /* Get corresponding machine object also: */
+        CMachine machine = session.GetMachine();
+
+        /* Create take-snapshot dialog: */
+        QWidget *pDlgParent = windowManager().realParentWindow(this);
+        QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, mMachine);
+        windowManager().registerNewParent(pDlg, pDlgParent);
+
+        /* Assign corresponding icon: */
+        pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(mMachine.GetOSTypeId()));
+
+        /* Search for the max available snapshot index: */
+        int iMaxSnapShotIndex = 0;
+        QString snapShotName = tr("Snapshot %1");
+        QRegExp regExp(QString("^") + snapShotName.arg("([0-9]+)") + QString("$"));
+        QTreeWidgetItemIterator iterator(mTreeWidget);
+        while (*iterator)
         {
-            /* Pausing VM: */
-            console.Pause();
-            if (!console.isOk())
-            {
-                msgCenter().cannotPauseMachine(console);
-                fIsValid = false;
-            }
+            QString snapShot = static_cast<SnapshotWgtItem*>(*iterator)->text(0);
+            int pos = regExp.indexIn(snapShot);
+            if (pos != -1)
+                iMaxSnapShotIndex = regExp.cap(1).toInt() > iMaxSnapShotIndex ? regExp.cap(1).toInt() : iMaxSnapShotIndex;
+            ++iterator;
         }
+        pDlg->mLeName->setText(snapShotName.arg(iMaxSnapShotIndex + 1));
+
+        /* Exec the dialog: */
+        bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;
 
-        if (fIsValid)
+        /* Is the dialog still valid? */
+        if (pDlg)
         {
-            /* Create take-snapshot dialog: */
-            QWidget *pDlgParent = windowManager().realParentWindow(this);
-            QPointer<VBoxTakeSnapshotDlg> pDlg = new VBoxTakeSnapshotDlg(pDlgParent, mMachine);
-            windowManager().registerNewParent(pDlg, pDlgParent);
-
-            /* Assign corresponding icon: */
-            pDlg->mLbIcon->setPixmap(vboxGlobal().vmGuestOSTypeIcon(mMachine.GetOSTypeId()));
-
-            /* Search for the max available snapshot index: */
-            int iMaxSnapShotIndex = 0;
-            QString snapShotName = tr("Snapshot %1");
-            QRegExp regExp(QString("^") + snapShotName.arg("([0-9]+)") + QString("$"));
-            QTreeWidgetItemIterator iterator(mTreeWidget);
-            while (*iterator)
-            {
-                QString snapShot = static_cast<SnapshotWgtItem*>(*iterator)->text(0);
-                int pos = regExp.indexIn(snapShot);
-                if (pos != -1)
-                    iMaxSnapShotIndex = regExp.cap(1).toInt() > iMaxSnapShotIndex ? regExp.cap(1).toInt() : iMaxSnapShotIndex;
-                ++iterator;
-            }
-            pDlg->mLeName->setText(snapShotName.arg(iMaxSnapShotIndex + 1));
+            /* Acquire variables: */
+            QString strSnapshotName = pDlg->mLeName->text().trimmed();
+            QString strSnapshotDescription = pDlg->mTeDescription->toPlainText();
 
-            /* Exec the dialog: */
-            bool fDialogAccepted = pDlg->exec() == QDialog::Accepted;
+            /* Destroy dialog early: */
+            delete pDlg;
 
-            /* Is the dialog still valid? */
-            if (pDlg)
+            /* Was the dialog accepted? */
+            if (fDialogAccepted)
             {
-                /* Acquire variables: */
-                QString strSnapshotName = pDlg->mLeName->text().trimmed();
-                QString strSnapshotDescription = pDlg->mTeDescription->toPlainText();
-
-                /* Destroy dialog early: */
-                delete pDlg;
-
-                /* Was the dialog accepted? */
-                if (fDialogAccepted)
+                /* Prepare the take-snapshot progress: */
+                CProgress progress = machine.TakeSnapshot(strSnapshotName, strSnapshotDescription, true);
+                if (machine.isOk())
                 {
-                    /* Prepare the take-snapshot progress: */
-                    CProgress progress = console.TakeSnapshot(strSnapshotName, strSnapshotDescription);
-                    if (console.isOk())
-                    {
-                        /* Show the take-snapshot progress: */
-                        msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_create_90px.png");
-                        if (!progress.isOk() || progress.GetResultCode() != 0)
-                        {
-                            msgCenter().cannotTakeSnapshot(progress, mMachine.GetName());
-                            fIsValid = false;
-                        }
-                    }
-                    else
+                    /* Show the take-snapshot progress: */
+                    msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_create_90px.png");
+                    if (!progress.isOk() || progress.GetResultCode() != 0)
                     {
-                        msgCenter().cannotTakeSnapshot(console, mMachine.GetName());
+                        msgCenter().cannotTakeSnapshot(progress, mMachine.GetName());
                         fIsValid = false;
                     }
                 }
                 else
+                {
+                    msgCenter().cannotTakeSnapshot(machine, mMachine.GetName());
                     fIsValid = false;
+                }
             }
             else
                 fIsValid = false;
         }
-
-        /* Resume VM if necessary: */
-        if (fIsValid && fAtRuntime && !fWasPaused)
-        {
-            /* Resuming VM: */
-            console.Resume();
-            if (!console.isOk())
-            {
-                msgCenter().cannotResumeMachine(console);
-                fIsValid = false;
-            }
-        }
+        else
+            fIsValid = false;
 
         /* Unlock machine finally: */
         session.UnlockMachine();
@@ -960,7 +947,7 @@ void VBoxSnapshotsWgt::refreshAll()
         Assert (mCurSnapshotItem);
 
         /* Add the "current state" item */
-        SnapshotWgtItem *csi = new SnapshotWgtItem (mCurSnapshotItem, mMachine);
+        SnapshotWgtItem *csi = new SnapshotWgtItem(this, mCurSnapshotItem, mMachine);
         csi->setBold (true);
         csi->recache();
 
@@ -979,7 +966,7 @@ void VBoxSnapshotsWgt::refreshAll()
         mCurSnapshotItem = 0;
 
         /* Add the "current state" item */
-        SnapshotWgtItem *csi = new SnapshotWgtItem (mTreeWidget, mMachine);
+        SnapshotWgtItem *csi = new SnapshotWgtItem(this, mTreeWidget, mMachine);
         csi->setBold (true);
         csi->recache();
 
@@ -1017,8 +1004,8 @@ SnapshotWgtItem *VBoxSnapshotsWgt::curStateItem()
 
 void VBoxSnapshotsWgt::populateSnapshots (const CSnapshot &aSnapshot, QTreeWidgetItem *aItem)
 {
-    SnapshotWgtItem *item = aItem ? new SnapshotWgtItem (aItem, aSnapshot) :
-                                    new SnapshotWgtItem (mTreeWidget, aSnapshot);
+    SnapshotWgtItem *item = aItem ? new SnapshotWgtItem(this, aItem, aSnapshot) :
+                                    new SnapshotWgtItem(this, mTreeWidget, aSnapshot);
     item->recache();
 
     CSnapshot curSnapshot = mMachine.GetCurrentSnapshot();
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.h b/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.h
index 6ed3fb1..3b303b9 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxSnapshotsWgt.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxSnapshotsWgt class declaration
+ * VBox Qt GUI - VBoxSnapshotsWgt class declaration.
  */
 
 /*
@@ -21,6 +20,7 @@
 
 /* Qt includes: */
 #include <QTimer>
+#include <QIcon>
 
 /* GUI includes: */
 #include "VBoxSnapshotsWgt.gen.h"
@@ -53,6 +53,9 @@ public:
 
     void setMachine (const CMachine &aMachine);
 
+    /** Returns cached snapshot-item icon depending on @a fOnline flag. */
+    const QIcon& snapshotItemIcon(bool fOnline) { return !fOnline ? m_offlineSnapshotIcon : m_onlineSnapshotIcon; }
+
 protected:
 
     void retranslateUi();
@@ -111,7 +114,11 @@ private:
     QTimer          mAgeUpdateTimer;
 
     bool            m_fShapshotOperationsAllowed;
+
+    /** Pointer to cached snapshot-item pixmap for 'offline' state. */
+    QIcon           m_offlineSnapshotIcon;
+    /** Pointer to cached snapshot-item pixmap for 'online' state. */
+    QIcon           m_onlineSnapshotIcon;
 };
 
 #endif // __VBoxSnapshotsWgt_h__
-
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.cpp
index 59330da..fa009a0 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGChooser.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooser class implementation
+ * VBox Qt GUI - UIGChooser class implementation.
  */
 
 /*
@@ -17,18 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QStatusBar>
+# include <QVBoxLayout>
+# include <QStatusBar>
 
 /* GUI includes: */
-#include "UIGChooser.h"
-#include "UIGChooserModel.h"
-#include "UIGChooserView.h"
-#include "VBoxGlobal.h"
+# include "UIGChooser.h"
+# include "UIGChooserModel.h"
+# include "UIGChooserView.h"
+# include "UISelectorWindow.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
-UIGChooser::UIGChooser(QWidget *pParent)
+UIGChooser::UIGChooser(UISelectorWindow *pParent)
     : QWidget(pParent)
+    , m_pSelectorWindow(pParent)
     , m_pMainLayout(0)
     , m_pChooserModel(0)
     , m_pChooserView(0)
@@ -59,6 +66,11 @@ UIGChooser::~UIGChooser()
     save();
 }
 
+UIActionPool* UIGChooser::actionPool() const
+{
+    return selector()->actionPool();
+}
+
 UIVMItem* UIGChooser::currentItem() const
 {
     return m_pChooserModel->currentMachineItem();
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.h
index 4103c95..e45eb8e 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.h
@@ -1,7 +1,6 @@
+/* $Id: UIGChooser.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooser class declaration
+ * VBox Qt GUI - UIGChooser class declaration.
  */
 
 /*
@@ -28,6 +27,8 @@
 /* Forward declartions: */
 class UIVMItem;
 class QVBoxLayout;
+class UISelectorWindow;
+class UIActionPool;
 class UIGChooserModel;
 class UIGChooserView;
 class QStatusBar;
@@ -55,9 +56,14 @@ signals:
 public:
 
     /* Constructor/destructor: */
-    UIGChooser(QWidget *pParent);
+    UIGChooser(UISelectorWindow *pParent);
     ~UIGChooser();
 
+    /** Returns the selector-window reference. */
+    UISelectorWindow* selector() const { return m_pSelectorWindow; }
+    /** Returns the action-pool reference. */
+    UIActionPool* actionPool() const;
+
     /* API: Current-item stuff: */
     UIVMItem* currentItem() const;
     QList<UIVMItem*> currentItems() const;
@@ -83,6 +89,9 @@ private:
     /* Helper: Cleanup stuff: */
     void save();
 
+    /** Holds the selector-window reference. */
+    UISelectorWindow* m_pSelectorWindow;
+
     /* Variables: */
     QVBoxLayout *m_pMainLayout;
     UIGChooserModel *m_pChooserModel;
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerKeyboard.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerKeyboard.cpp
index ed62078..ee3d36f 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerKeyboard.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerKeyboard.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGChooserHandlerKeyboard.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserHandlerKeyboard class implementation
+ * VBox Qt GUI - UIGChooserHandlerKeyboard class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QKeyEvent>
+# include <QKeyEvent>
 
 /* GUI incluedes: */
-#include "UIGChooserHandlerKeyboard.h"
-#include "UIGChooserModel.h"
-#include "UIGChooserItemGroup.h"
+# include "UIGChooserHandlerKeyboard.h"
+# include "UIGChooserModel.h"
+# include "UIGChooserItemGroup.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGChooserHandlerKeyboard::UIGChooserHandlerKeyboard(UIGChooserModel *pParent)
     : QObject(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerKeyboard.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerKeyboard.h
index 8a517d8..f6e0469 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerKeyboard.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerKeyboard.h
@@ -1,7 +1,6 @@
+/* $Id: UIGChooserHandlerKeyboard.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserHandlerKeyboard class declaration
+ * VBox Qt GUI - UIGChooserHandlerKeyboard class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.cpp
index b7f5ea2..13fc721 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGChooserHandlerMouse.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserHandlerMouse class implementation
+ * VBox Qt GUI - UIGChooserHandlerMouse class implementation.
  */
 
 /*
@@ -17,14 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QGraphicsSceneMouseEvent>
+# include <QGraphicsSceneMouseEvent>
 
 /* GUI incluedes: */
-#include "UIGChooserHandlerMouse.h"
-#include "UIGChooserModel.h"
-#include "UIGChooserItemGroup.h"
-#include "UIGChooserItemMachine.h"
+# include "UIGChooserHandlerMouse.h"
+# include "UIGChooserModel.h"
+# include "UIGChooserItemGroup.h"
+# include "UIGChooserItemMachine.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGChooserHandlerMouse::UIGChooserHandlerMouse(UIGChooserModel *pParent)
     : QObject(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.h
index ddac404..74bf2a0 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserHandlerMouse.h
@@ -1,7 +1,6 @@
+/* $Id: UIGChooserHandlerMouse.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserHandlerMouse class declaration
+ * VBox Qt GUI - UIGChooserHandlerMouse class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp
index cb2f3b9..19a51dc 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGChooserItem.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserItem class definition
+ * VBox Qt GUI - UIGChooserItem class definition.
  */
 
 /*
@@ -17,22 +15,29 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QStyle>
-#include <QPainter>
-#include <QGraphicsScene>
-#include <QStyleOptionFocusRect>
-#include <QGraphicsSceneMouseEvent>
-#include <QStateMachine>
-#include <QPropertyAnimation>
-#include <QSignalTransition>
+# include <QApplication>
+# include <QStyle>
+# include <QPainter>
+# include <QGraphicsScene>
+# include <QStyleOptionFocusRect>
+# include <QGraphicsSceneMouseEvent>
+# include <QStateMachine>
+# include <QPropertyAnimation>
+# include <QSignalTransition>
 
 /* GUI includes: */
-#include "UIGChooserItem.h"
-#include "UIGChooserModel.h"
-#include "UIGChooserItemGroup.h"
-#include "UIGChooserItemMachine.h"
+# include "UIGChooserItem.h"
+# include "UIGChooserModel.h"
+# include "UIGChooserItemGroup.h"
+# include "UIGChooserItemMachine.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGChooserItem::UIGChooserItem(UIGChooserItem *pParent, bool fTemporary)
     : m_fRoot(!pParent)
@@ -114,6 +119,11 @@ UIGChooserModel* UIGChooserItem::model() const
     return pModel;
 }
 
+UIActionPool* UIGChooserItem::actionPool() const
+{
+    return model()->actionPool();
+}
+
 UIGChooserItem* UIGChooserItem::parentItem() const
 {
     return m_pParent;
@@ -353,9 +363,9 @@ void UIGChooserItem::paintFrameRect(QPainter *pPainter, const QRect &rect, bool
 }
 
 /* static */
-void UIGChooserItem::paintPixmap(QPainter *pPainter, const QRect &rect, const QPixmap &pixmap)
+void UIGChooserItem::paintPixmap(QPainter *pPainter, const QPoint &point, const QPixmap &pixmap)
 {
-    pPainter->drawPixmap(rect, pixmap);
+    pPainter->drawPixmap(point, pixmap);
 }
 
 /* static */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.h
index dfb1dfc..a60fb38 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.h
@@ -1,7 +1,6 @@
+/* $Id: UIGChooserItem.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserItem class declaration
+ * VBox Qt GUI - UIGChooserItem class declaration.
  */
 
 /*
@@ -30,6 +29,7 @@
 #include <iprt/cdefs.h>
 
 /* Forward declaration: */
+class UIActionPool;
 class UIGChooserModel;
 class UIGChooserItemGroup;
 class UIGChooserItemMachine;
@@ -87,6 +87,9 @@ public:
     /* API: Model stuff: */
     UIGChooserModel* model() const;
 
+    /** Returns the action-pool reference. */
+    UIActionPool* actionPool() const;
+
     /* API: Parent stuff: */
     UIGChooserItem* parentItem() const;
 
@@ -161,7 +164,7 @@ protected:
     /* Static paint stuff: */
     static void configurePainterShape(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, int iRadius);
     static void paintFrameRect(QPainter *pPainter, const QRect &rect, bool fIsSelected, int iRadius);
-    static void paintPixmap(QPainter *pPainter, const QRect &rect, const QPixmap &pixmap);
+    static void paintPixmap(QPainter *pPainter, const QPoint &point, const QPixmap &pixmap);
     static void paintText(QPainter *pPainter, QPoint point,
                           const QFont &font, QPaintDevice *pPaintDevice,
                           const QString &strText);
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
index 564fec3..143828d 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGChooserItemGroup.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserItemGroup class implementation
+ * VBox Qt GUI - UIGChooserItemGroup class implementation.
  */
 
 /*
@@ -17,23 +15,31 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QPainter>
-#include <QStyleOptionGraphicsItem>
-#include <QGraphicsSceneDragDropEvent>
-#include <QLineEdit>
-#include <QGraphicsProxyWidget>
-#include <QGraphicsScene>
-#include <QHBoxLayout>
-#include <QMenu>
+# include <QPainter>
+# include <QStyleOptionGraphicsItem>
+# include <QGraphicsSceneDragDropEvent>
+# include <QLineEdit>
+# include <QGraphicsScene>
+# include <QHBoxLayout>
+# include <QMenu>
 
 /* GUI includes: */
-#include "UIGChooserItemGroup.h"
-#include "UIGChooserItemMachine.h"
-#include "UIGChooserModel.h"
-#include "UIIconPool.h"
-#include "UIGraphicsRotatorButton.h"
-#include "UIGChooserView.h"
+# include "UIGChooserItemGroup.h"
+# include "UIGChooserItemMachine.h"
+# include "UIGChooserModel.h"
+# include "UIIconPool.h"
+# include "UIGraphicsRotatorButton.h"
+# include "UIGChooserView.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QGraphicsProxyWidget>
+
 
 /* static */
 QString UIGChooserItemGroup::className() { return "UIGChooserItemGroup"; }
@@ -1734,8 +1740,8 @@ void UIGChooserItemGroup::paintHeader(QPainter *pPainter, const QRect &rect)
                                   iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m_pixmapSizeMachines.height()) / 2;
             paintPixmap(/* Painter: */
                         pPainter,
-                        /* Rectangle to paint in: */
-                        QRect(QPoint(iMachinePixmapX, iMachinePixmapY), m_pixmapSizeMachines),
+                        /* Point to paint in: */
+                        QPoint(iMachinePixmapX, iMachinePixmapY),
                         /* Pixmap to paint: */
                         m_machinesPixmap);
         }
@@ -1764,8 +1770,8 @@ void UIGChooserItemGroup::paintHeader(QPainter *pPainter, const QRect &rect)
                                 iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m_pixmapSizeGroups.height()) / 2;
             paintPixmap(/* Painter: */
                         pPainter,
-                        /* Rectangle to paint in: */
-                        QRect(QPoint(iGroupPixmapX, iGroupPixmapY), m_pixmapSizeGroups),
+                        /* Point to paint in: */
+                        QPoint(iGroupPixmapX, iGroupPixmapY),
                         /* Pixmap to paint: */
                         m_groupsPixmap);
         }
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h
index 55e4545..afd5b63 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h
@@ -1,7 +1,6 @@
+/* $Id: UIGChooserItemGroup.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserItemGroup class declaration
+ * VBox Qt GUI - UIGChooserItemGroup class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
index 75837dc..ec7804c 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGChooserItemMachine.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserItemMachine class implementation
+ * VBox Qt GUI - UIGChooserItemMachine class implementation.
  */
 
 /*
@@ -17,25 +15,32 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QPainter>
-#include <QStyleOptionGraphicsItem>
-#include <QGraphicsSceneMouseEvent>
+# include <QPainter>
+# include <QStyleOptionGraphicsItem>
+# include <QGraphicsSceneMouseEvent>
 
 /* GUI includes: */
-#include "UIGChooserItemMachine.h"
-#include "UIGChooserItemGroup.h"
-#include "UIGChooserModel.h"
-#include "UIGraphicsToolBar.h"
-#include "UIGraphicsZoomButton.h"
-#include "VBoxGlobal.h"
-#include "UIIconPool.h"
-#include "UIActionPoolSelector.h"
-#include "UIImageTools.h"
+# include "UIGChooserItemMachine.h"
+# include "UIGChooserItemGroup.h"
+# include "UIGChooserModel.h"
+# include "UIGraphicsToolBar.h"
+# include "UIGraphicsZoomButton.h"
+# include "VBoxGlobal.h"
+# include "UIIconPool.h"
+# include "UIActionPoolSelector.h"
+# include "UIImageTools.h"
 
 /* COM includes: */
-#include "COMEnums.h"
-#include "CMachine.h"
+# include "COMEnums.h"
+# include "CMachine.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* static */
 QString UIGChooserItemMachine::className() { return "UIGChooserItemMachine"; }
@@ -215,13 +220,12 @@ void UIGChooserItemMachine::updatePixmaps()
 void UIGChooserItemMachine::updatePixmap()
 {
     /* Get new pixmap and pixmap-size: */
-    QIcon icon = osIcon();
-    QSize iconSize = icon.availableSizes().first();
-    QPixmap pixmap = icon.pixmap(iconSize);
+    QSize pixmapSize;
+    QPixmap pixmap = osPixmap(&pixmapSize);
     /* Update linked values: */
-    if (m_pixmapSize != iconSize)
+    if (m_pixmapSize != pixmapSize)
     {
-        m_pixmapSize = iconSize;
+        m_pixmapSize = pixmapSize;
         updateFirstRowMaximumWidth();
         updateGeometry();
     }
@@ -235,13 +239,14 @@ void UIGChooserItemMachine::updatePixmap()
 void UIGChooserItemMachine::updateStatePixmap()
 {
     /* Get new state-pixmap and state-pixmap size: */
-    QIcon stateIcon = machineStateIcon();
-    QSize stateIconSize = stateIcon.availableSizes().first();
-    QPixmap statePixmap = stateIcon.pixmap(stateIconSize);
+    const QIcon stateIcon = machineStateIcon();
+    AssertReturnVoid(!stateIcon.isNull());
+    const QSize statePixmapSize = stateIcon.availableSizes().first();
+    const QPixmap statePixmap = stateIcon.pixmap(statePixmapSize);
     /* Update linked values: */
-    if (m_statePixmapSize != stateIconSize)
+    if (m_statePixmapSize != statePixmapSize)
     {
-        m_statePixmapSize = stateIconSize;
+        m_statePixmapSize = statePixmapSize;
         updateGeometry();
     }
     if (m_statePixmap.toImage() != statePixmap.toImage())
@@ -951,8 +956,8 @@ void UIGChooserItemMachine::paintMachineInfo(QPainter *pPainter, const QStyleOpt
         /* Paint pixmap: */
         paintPixmap(/* Painter: */
                     pPainter,
-                    /* Rectangle to paint in: */
-                    QRect(QPoint(iMachinePixmapX, iMachinePixmapY), m_pixmapSize),
+                    /* Point to paint in: */
+                    QPoint(iMachinePixmapX, iMachinePixmapY),
                     /* Pixmap to paint: */
                     m_pixmap);
     }
@@ -1028,8 +1033,8 @@ void UIGChooserItemMachine::paintMachineInfo(QPainter *pPainter, const QStyleOpt
                 /* Paint state pixmap: */
                 paintPixmap(/* Painter: */
                             pPainter,
-                            /* Rectangle to paint in: */
-                            QRect(QPoint(iMachineStatePixmapX, iMachineStatePixmapY), m_statePixmapSize),
+                            /* Point to paint in: */
+                            QPoint(iMachineStatePixmapX, iMachineStatePixmapY),
                             /* Pixmap to paint: */
                             m_statePixmap);
             }
@@ -1141,16 +1146,16 @@ void UIGChooserItemMachine::prepare()
     m_pToolBar->insertItem(m_pCloseButton, 1, 1);
 
     connect(m_pSettingsButton, SIGNAL(sigButtonClicked()),
-            gActionPool->action(UIActionIndexSelector_Simple_Machine_Settings), SLOT(trigger()),
+            actionPool()->action(UIActionIndexST_M_Machine_S_Settings), SLOT(trigger()),
             Qt::QueuedConnection);
     connect(m_pStartButton, SIGNAL(sigButtonClicked()),
-            gActionPool->action(UIActionIndexSelector_State_Common_StartOrShow), SLOT(trigger()),
+            actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow), SLOT(trigger()),
             Qt::QueuedConnection);
     connect(m_pPauseButton, SIGNAL(sigButtonClicked()),
-            gActionPool->action(UIActionIndexSelector_Toggle_Common_PauseAndResume), SLOT(trigger()),
+            actionPool()->action(UIActionIndexST_M_Machine_T_Pause), SLOT(trigger()),
             Qt::QueuedConnection);
     connect(m_pCloseButton, SIGNAL(sigButtonClicked()),
-            gActionPool->action(UIActionIndexSelector_Simple_Machine_Close_PowerOff), SLOT(trigger()),
+            actionPool()->action(UIActionIndexST_M_Machine_M_Close_S_PowerOff), SLOT(trigger()),
             Qt::QueuedConnection);
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.h
index 5ba484f..d7b39b9 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.h
@@ -1,7 +1,6 @@
+/* $Id: UIGChooserItemMachine.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserItemMachine class declaration
+ * VBox Qt GUI - UIGChooserItemMachine class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
index 15a92f3..15095a9 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGChooserModel.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserModel class implementation
+ * VBox Qt GUI - UIGChooserModel class implementation.
  */
 
 /*
@@ -17,41 +15,52 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QGraphicsScene>
-#include <QGraphicsView>
-#include <QRegExp>
-#include <QGraphicsSceneMouseEvent>
-#include <QGraphicsSceneContextMenuEvent>
-#include <QPropertyAnimation>
-#include <QParallelAnimationGroup>
-#include <QScrollBar>
-#include <QTimer>
+# include <QGraphicsScene>
+# include <QGraphicsView>
+# include <QRegExp>
+# include <QGraphicsSceneMouseEvent>
+# include <QGraphicsSceneContextMenuEvent>
+# include <QPropertyAnimation>
+# include <QScrollBar>
+# include <QTimer>
 
 /* GUI includes: */
-#include "UIGChooserModel.h"
-#include "UIGChooserItemGroup.h"
-#include "UIGChooserItemMachine.h"
-#include "UIDefs.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIActionPoolSelector.h"
-#include "UIGChooserHandlerMouse.h"
-#include "UIGChooserHandlerKeyboard.h"
-#include "UIWizardNewVM.h"
-#include "UISelectorWindow.h"
-#include "UIVirtualBoxEventHandler.h"
+# include "UIGChooser.h"
+# include "UIGChooserModel.h"
+# include "UIGChooserItemGroup.h"
+# include "UIGChooserItemMachine.h"
+# include "UIExtraDataDefs.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIExtraDataManager.h"
+# include "UIActionPoolSelector.h"
+# include "UIGChooserHandlerMouse.h"
+# include "UIGChooserHandlerKeyboard.h"
+# include "UIWizardNewVM.h"
+# include "UISelectorWindow.h"
+# include "UIVirtualBoxEventHandler.h"
 
 /* COM includes: */
-#include "CVirtualBox.h"
-#include "CMachine.h"
-#include "CMedium.h"
+# include "CVirtualBox.h"
+# include "CMachine.h"
+# include "CMedium.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QParallelAnimationGroup>
+
 
 /* Type defs: */
 typedef QSet<QString> UIStringSet;
 
-UIGChooserModel::UIGChooserModel(QObject *pParent)
+UIGChooserModel::UIGChooserModel(UIGChooser *pParent)
     : QObject(pParent)
+    , m_pChooser(pParent)
     , m_pScene(0)
     , m_fSliding(false)
     , m_pLeftRoot(0)
@@ -133,6 +142,11 @@ void UIGChooserModel::cleanup()
     makeSureGroupOrdersSaveIsFinished();
 }
 
+UIActionPool* UIGChooserModel::actionPool() const
+{
+    return chooser()->actionPool();
+}
+
 QGraphicsScene* UIGChooserModel::scene() const
 {
     return m_pScene;
@@ -528,7 +542,7 @@ QString UIGChooserModel::uniqueGroupName(UIGChooserItem *pRoot)
 
 void UIGChooserModel::activateMachineItem()
 {
-    gActionPool->action(UIActionIndexSelector_State_Common_StartOrShow)->activate(QAction::Trigger);
+    actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow)->activate(QAction::Trigger);
 }
 
 void UIGChooserModel::setCurrentDragObject(QDrag *pDragObject)
@@ -545,18 +559,59 @@ void UIGChooserModel::lookFor(const QString &strLookupSymbol)
 {
     /* Restart timer to reset lookup-string: */
     m_pLookupTimer->start();
-    /* Look for item which is starting from the lookup-string: */
-    UIGChooserItem *pItem = mainRoot()->searchForItem(m_strLookupString + strLookupSymbol,
-                                                      UIGChooserItemSearchFlag_Machine |
-                                                      UIGChooserItemSearchFlag_Group);
-    /* If item found: */
+
+    /* Prepare item: */
+    UIGChooserItem *pItem = 0;
+
+    /* We are starting to look from the current position: */
+    int iCurrentIndex = navigationList().indexOf(currentItem());
+
+    /* Are we looking for the 1. same symbol or for the 2. composed word? */
+    const QString strLookupString = m_strLookupString.isEmpty() || m_strLookupString == strLookupSymbol ?
+                                    strLookupSymbol : m_strLookupString + strLookupSymbol;
+    /* Are we looking from the 1. subsequent position or from the 2. same one? */
+    const int     iFirstIndex     = m_strLookupString.isEmpty() || m_strLookupString == strLookupSymbol ?
+                                    iCurrentIndex + 1 : iCurrentIndex;
+
+    /* If first position feats the bounds: */
+    if (iFirstIndex < navigationList().size())
+    {
+        /* We have to look starting from the first position: */
+        for (int iIndex = iFirstIndex; iIndex < navigationList().size(); ++iIndex)
+        {
+            UIGChooserItem *pIteratedItem = navigationList().at(iIndex);
+            if (pIteratedItem->name().startsWith(strLookupString, Qt::CaseInsensitive))
+            {
+                pItem = pIteratedItem;
+                break;
+            }
+        }
+    }
+
+    /* If the item was not found: */
+    if (!pItem && iFirstIndex > 0)
+    {
+        /* We have to try to look from the beginning of the list: */
+        for (int iIndex = 0; iIndex < iFirstIndex; ++iIndex)
+        {
+            UIGChooserItem *pIteratedItem = navigationList().at(iIndex);
+            if (pIteratedItem->name().startsWith(strLookupString, Qt::CaseInsensitive))
+            {
+                pItem = pIteratedItem;
+                break;
+            }
+        }
+    }
+
+    /* If that item was found: */
     if (pItem)
     {
         /* Choose it: */
         pItem->makeSureItsVisible();
         setCurrentItem(pItem);
         /* Append lookup symbol: */
-        m_strLookupString += strLookupSymbol;
+        if (m_strLookupString != strLookupSymbol)
+            m_strLookupString += strLookupSymbol;
     }
 }
 
@@ -596,7 +651,7 @@ void UIGChooserModel::sltMachineRegistered(QString strId, bool fRegistered)
         /* Search for corresponding machine: */
         CMachine machine = vboxGlobal().virtualBox().FindMachine(strId);
         /* Should we show this machine? */
-        if (VBoxGlobal::shouldWeShowMachine(machine))
+        if (gEDataManager->showMachineInSelectorChooser(strId))
         {
             /* Add new machine-item: */
             addMachineIntoTheTree(machine, true);
@@ -697,7 +752,7 @@ void UIGChooserModel::sltSlidingComplete()
 void UIGChooserModel::sltEditGroupName()
 {
     /* Check if action is enabled: */
-    if (!gActionPool->action(UIActionIndexSelector_Simple_Group_Rename)->isEnabled())
+    if (!actionPool()->action(UIActionIndexST_M_Group_S_Rename)->isEnabled())
         return;
 
     /* Only for single selected group: */
@@ -711,7 +766,7 @@ void UIGChooserModel::sltEditGroupName()
 void UIGChooserModel::sltSortGroup()
 {
     /* Check if action is enabled: */
-    if (!gActionPool->action(UIActionIndexSelector_Simple_Group_Sort)->isEnabled())
+    if (!actionPool()->action(UIActionIndexST_M_Group_S_Sort)->isEnabled())
         return;
 
     /* Only for single selected group: */
@@ -725,7 +780,7 @@ void UIGChooserModel::sltSortGroup()
 void UIGChooserModel::sltUngroupSelectedGroup()
 {
     /* Check if action is enabled: */
-    if (!gActionPool->action(UIActionIndexSelector_Simple_Group_Remove)->isEnabled())
+    if (!actionPool()->action(UIActionIndexST_M_Group_S_Remove)->isEnabled())
         return;
 
     /* Make sure focus item is of group type! */
@@ -801,7 +856,7 @@ void UIGChooserModel::sltUngroupSelectedGroup()
 void UIGChooserModel::sltCreateNewMachine()
 {
     /* Check if action is enabled: */
-    if (!gActionPool->action(UIActionIndexSelector_Simple_Machine_New)->isEnabled())
+    if (!actionPool()->action(UIActionIndexST_M_Machine_S_New)->isEnabled())
         return;
 
     /* Choose the parent: */
@@ -825,7 +880,7 @@ void UIGChooserModel::sltCreateNewMachine()
 void UIGChooserModel::sltGroupSelectedMachines()
 {
     /* Check if action is enabled: */
-    if (!gActionPool->action(UIActionIndexSelector_Simple_Machine_AddGroup)->isEnabled())
+    if (!actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup)->isEnabled())
         return;
 
     /* Create new group in the current root: */
@@ -882,7 +937,7 @@ void UIGChooserModel::sltReloadMachine(const QString &strId)
 
     /* Show machine if we should: */
     CMachine machine = vboxGlobal().virtualBox().FindMachine(strId);
-    if (VBoxGlobal::shouldWeShowMachine(machine))
+    if (gEDataManager->showMachineInSelectorChooser(strId))
         addMachineIntoTheTree(machine);
 
     /* And update model: */
@@ -900,7 +955,7 @@ void UIGChooserModel::sltReloadMachine(const QString &strId)
 void UIGChooserModel::sltSortParentGroup()
 {
     /* Check if action is enabled: */
-    if (!gActionPool->action(UIActionIndexSelector_Simple_Machine_SortParent)->isEnabled())
+    if (!actionPool()->action(UIActionIndexST_M_Machine_S_SortParent)->isEnabled())
         return;
 
     /* Only if some item selected: */
@@ -914,7 +969,7 @@ void UIGChooserModel::sltSortParentGroup()
 void UIGChooserModel::sltPerformRefreshAction()
 {
     /* Check if action is enabled: */
-    if (!gActionPool->action(UIActionIndexSelector_Simple_Common_Refresh)->isEnabled())
+    if (!actionPool()->action(UIActionIndexST_M_Group_S_Refresh)->isEnabled())
         return;
 
     /* Gather list of current unique inaccessible machine-items: */
@@ -955,7 +1010,7 @@ void UIGChooserModel::sltPerformRefreshAction()
 void UIGChooserModel::sltRemoveSelectedMachine()
 {
     /* Check if action is enabled: */
-    if (!gActionPool->action(UIActionIndexSelector_Simple_Machine_Remove)->isEnabled())
+    if (!actionPool()->action(UIActionIndexST_M_Machine_S_Remove)->isEnabled())
         return;
 
     /* Enumerate all the selected machine-items: */
@@ -1124,66 +1179,69 @@ void UIGChooserModel::prepareContextMenu()
 {
     /* Context menu for group(s): */
     m_pContextMenuGroup = new QMenu;
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Group_New));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Group_Add));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_New));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Add));
     m_pContextMenuGroup->addSeparator();
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Group_Rename));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Group_Remove));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Rename));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Remove));
     m_pContextMenuGroup->addSeparator();
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_State_Common_StartOrShow));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Toggle_Common_PauseAndResume));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Reset));
-    m_pContextMenuGroup->addMenu(gActionPool->action(UIActionIndexSelector_Menu_Group_Close)->menu());
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_M_StartOrShow));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_T_Pause));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Reset));
+    m_pContextMenuGroup->addMenu(actionPool()->action(UIActionIndexST_M_Group_M_Close)->menu());
     m_pContextMenuGroup->addSeparator();
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Discard));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Refresh));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Discard));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_ShowLogDialog));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Refresh));
     m_pContextMenuGroup->addSeparator();
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_ShowInFileManager));
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_CreateShortcut));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_ShowInFileManager));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_CreateShortcut));
     m_pContextMenuGroup->addSeparator();
-    m_pContextMenuGroup->addAction(gActionPool->action(UIActionIndexSelector_Simple_Group_Sort));
+    m_pContextMenuGroup->addAction(actionPool()->action(UIActionIndexST_M_Group_S_Sort));
 
     /* Context menu for machine(s): */
     m_pContextMenuMachine = new QMenu;
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Settings));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Clone));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_Remove));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_AddGroup));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Settings));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Clone));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Remove));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup));
     m_pContextMenuMachine->addSeparator();
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_State_Common_StartOrShow));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Toggle_Common_PauseAndResume));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Reset));
-    m_pContextMenuMachine->addMenu(gActionPool->action(UIActionIndexSelector_Menu_Machine_Close)->menu());
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_M_StartOrShow));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_T_Pause));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Reset));
+    m_pContextMenuMachine->addMenu(actionPool()->action(UIActionIndexST_M_Machine_M_Close)->menu());
     m_pContextMenuMachine->addSeparator();
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Discard));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndex_Simple_LogDialog));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_Refresh));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Discard));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ShowLogDialog));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh));
     m_pContextMenuMachine->addSeparator();
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_ShowInFileManager));
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Common_CreateShortcut));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_ShowInFileManager));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_CreateShortcut));
     m_pContextMenuMachine->addSeparator();
-    m_pContextMenuMachine->addAction(gActionPool->action(UIActionIndexSelector_Simple_Machine_SortParent));
+    m_pContextMenuMachine->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_SortParent));
 
     connect(m_pContextMenuGroup, SIGNAL(hovered(QAction*)), this, SLOT(sltActionHovered(QAction*)));
     connect(m_pContextMenuMachine, SIGNAL(hovered(QAction*)), this, SLOT(sltActionHovered(QAction*)));
 
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Group_New), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_New), SIGNAL(triggered()),
             this, SLOT(sltCreateNewMachine()));
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_New), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_New), SIGNAL(triggered()),
             this, SLOT(sltCreateNewMachine()));
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Group_Rename), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_Rename), SIGNAL(triggered()),
             this, SLOT(sltEditGroupName()));
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Group_Remove), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_Remove), SIGNAL(triggered()),
             this, SLOT(sltUngroupSelectedGroup()));
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_Remove), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Remove), SIGNAL(triggered()),
             this, SLOT(sltRemoveSelectedMachine()));
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_AddGroup), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_AddGroup), SIGNAL(triggered()),
             this, SLOT(sltGroupSelectedMachines()));
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Common_Refresh), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_Refresh), SIGNAL(triggered()),
+            this, SLOT(sltPerformRefreshAction()));
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_Refresh), SIGNAL(triggered()),
             this, SLOT(sltPerformRefreshAction()));
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Machine_SortParent), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Machine_S_SortParent), SIGNAL(triggered()),
             this, SLOT(sltSortParentGroup()));
-    connect(gActionPool->action(UIActionIndexSelector_Simple_Group_Sort), SIGNAL(triggered()),
+    connect(actionPool()->action(UIActionIndexST_M_Group_S_Sort), SIGNAL(triggered()),
             this, SLOT(sltSortGroup()));
 
     connect(this, SIGNAL(sigStartGroupSaving()), this, SLOT(sltGroupSavingStart()), Qt::QueuedConnection);
@@ -1224,12 +1282,14 @@ void UIGChooserModel::prepareConnections()
             this, SLOT(sltSnapshotChanged(QString, QString)));
     connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)),
             this, SLOT(sltSnapshotChanged(QString, QString)));
+    connect(gVBoxEvents, SIGNAL(sigSnapshotRestore(QString, QString)),
+            this, SLOT(sltSnapshotChanged(QString, QString)));
 }
 
 void UIGChooserModel::loadLastSelectedItem()
 {
     /* Load last selected item (choose first if unable to load): */
-    setCurrentItem(vboxGlobal().virtualBox().GetExtraData(GUI_LastItemSelected));
+    setCurrentItem(gEDataManager->selectorWindowLastItemChosen());
     if (!currentItem() && !navigationList().isEmpty())
         setCurrentItem(navigationList().first());
 }
@@ -1237,8 +1297,7 @@ void UIGChooserModel::loadLastSelectedItem()
 void UIGChooserModel::saveLastSelectedItem()
 {
     /* Save last selected item: */
-    vboxGlobal().virtualBox().SetExtraData(GUI_LastItemSelected,
-                                           currentItem() ? currentItem()->definition() : QString());
+    gEDataManager->setSelectorWindowLastItemChosen(currentItem() ? currentItem()->definition() : QString());
 }
 
 void UIGChooserModel::cleanupHandlers()
@@ -1610,8 +1669,11 @@ void UIGChooserModel::loadGroupTree()
     /* Add all the approved machines we have into the group-tree: */
     LogRelFlow(("UIGChooserModel: Loading VMs...\n"));
     foreach (CMachine machine, vboxGlobal().virtualBox().GetMachines())
-        if (VBoxGlobal::shouldWeShowMachine(machine))
+    {
+        const QString strMachineID = machine.GetId();
+        if (!strMachineID.isEmpty() && gEDataManager->showMachineInSelectorChooser(strMachineID))
             addMachineIntoTheTree(machine);
+    }
     LogRelFlow(("UIGChooserModel: VMs loaded.\n"));
 }
 
@@ -1703,10 +1765,8 @@ UIGChooserItem* UIGChooserModel::getGroupItem(const QString &strName, UIGChooser
 
 bool UIGChooserModel::shouldBeGroupOpened(UIGChooserItem *pParentItem, const QString &strName)
 {
-    /* Prepare extra-data key for the parent-item: */
-    QString strExtraDataKey = UIDefs::GUI_GroupDefinitions + pParentItem->fullName();
     /* Read group definitions: */
-    QStringList definitions = vboxGlobal().virtualBox().GetExtraDataStringList(strExtraDataKey);
+    const QStringList definitions = gEDataManager->selectorWindowGroupsDefinitions(pParentItem->fullName());
     /* Return 'false' if no definitions found: */
     if (definitions.isEmpty())
         return false;
@@ -1715,10 +1775,8 @@ bool UIGChooserModel::shouldBeGroupOpened(UIGChooserItem *pParentItem, const QSt
     QString strDefinitionTemplate = QString("g(\\S)*=%1").arg(strName);
     QRegExp definitionRegExp(strDefinitionTemplate);
     /* For each the group definition: */
-    for (int i = 0; i < definitions.size(); ++i)
+    foreach (const QString &strDefinition, definitions)
     {
-        /* Get current definition: */
-        const QString &strDefinition = definitions[i];
         /* Check if this is required definition: */
         if (definitionRegExp.indexIn(strDefinition) == 0)
         {
@@ -1774,10 +1832,8 @@ int UIGChooserModel::getDesiredPosition(UIGChooserItem *pParentItem, UIGChooserI
 
 int UIGChooserModel::positionFromDefinitions(UIGChooserItem *pParentItem, UIGChooserItemType type, const QString &strName)
 {
-    /* Prepare extra-data key for the parent-item: */
-    QString strExtraDataKey = UIDefs::GUI_GroupDefinitions + pParentItem->fullName();
     /* Read group definitions: */
-    QStringList definitions = vboxGlobal().virtualBox().GetExtraDataStringList(strExtraDataKey);
+    const QStringList definitions = gEDataManager->selectorWindowGroupsDefinitions(pParentItem->fullName());
     /* Return 'false' if no definitions found: */
     if (definitions.isEmpty())
         return -1;
@@ -1802,10 +1858,8 @@ int UIGChooserModel::positionFromDefinitions(UIGChooserItem *pParentItem, UIGCho
 
     /* For each the definition: */
     int iDefinitionIndex = -1;
-    for (int i = 0; i < definitions.size(); ++i)
+    foreach (const QString &strDefinition, definitions)
     {
-        /* Get current definition: */
-        QString strDefinition = definitions[i];
         /* Check if this definition is of required type: */
         if (definitionRegExpShort.indexIn(strDefinition) == 0)
         {
@@ -1883,7 +1937,7 @@ void UIGChooserModel::gatherGroupOrders(QMap<QString, QStringList> &groups,
                                         UIGChooserItem *pParentItem)
 {
     /* Prepare extra-data key for current group: */
-    QString strExtraDataKey = UIDefs::GUI_GroupDefinitions + pParentItem->fullName();
+    const QString strExtraDataKey = pParentItem->fullName();
     /* Iterate over all the group-items: */
     foreach (UIGChooserItem *pItem, pParentItem->items(UIGChooserItemType_Group))
     {
@@ -2090,15 +2144,11 @@ void UIGroupOrderSaveThread::run()
     /* COM prepare: */
     COMBase::InitializeCOM(false);
 
-    /* Clear all the extra-data records related to group-definitions: */
-    const QVector<QString> extraDataKeys = vboxGlobal().virtualBox().GetExtraDataKeys();
-    foreach (const QString &strKey, extraDataKeys)
-        if (strKey.startsWith(UIDefs::GUI_GroupDefinitions))
-            vboxGlobal().virtualBox().SetExtraData(strKey, QString());
-
+    /* Clear all the extra-data records related to group definitions: */
+    gEDataManager->clearSelectorWindowGroupsDefinitions();
     /* For every particular group definition: */
     foreach (const QString &strId, m_groups.keys())
-        vboxGlobal().virtualBox().SetExtraDataStringList(strId, m_groups[strId]);
+        gEDataManager->setSelectorWindowGroupsDefinitions(strId, m_groups[strId]);
 
     /* Notify listeners about completeness: */
     emit sigComplete();
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
index 80503db..13e90b5 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.h
@@ -1,7 +1,6 @@
+/* $Id: UIGChooserModel.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserModel class declaration
+ * VBox Qt GUI - UIGChooserModel class declaration.
  */
 
 /*
@@ -42,6 +41,8 @@ class QGraphicsSceneContextMenuEvent;
 class QTimer;
 class QPaintDevice;
 class UIVMItem;
+class UIGChooser;
+class UIActionPool;
 class UIGChooserHandlerMouse;
 class UIGChooserHandlerKeyboard;
 class CMachine;
@@ -86,13 +87,18 @@ signals:
 public:
 
     /* Constructor/destructor: */
-    UIGChooserModel(QObject *pParent);
+    UIGChooserModel(UIGChooser *pParent);
     ~UIGChooserModel();
 
     /* API: Prepare/cleanup stuff: */
     void prepare();
     void cleanup();
 
+    /** Returns the chooser reference. */
+    UIGChooser* chooser() const { return m_pChooser; }
+    /** Returns the action-pool reference. */
+    UIActionPool* actionPool() const;
+
     /* API: Scene stuff: */
     QGraphicsScene* scene() const;
     QPaintDevice* paintDevice() const;
@@ -271,6 +277,9 @@ private:
     void makeSureGroupDefinitionsSaveIsFinished();
     void makeSureGroupOrdersSaveIsFinished();
 
+    /** Holds the chooser reference. */
+    UIGChooser *m_pChooser;
+
     /* Variables: */
     QGraphicsScene *m_pScene;
 
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.cpp
index 1ece3a9..55f702c 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGChooserView.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserView class implementation
+ * VBox Qt GUI - UIGChooserView class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QScrollBar>
+# include <QScrollBar>
 
 /* GUI includes: */
-#include "UIGChooserView.h"
-#include "UIGChooserItem.h"
+# include "UIGChooserView.h"
+# include "UIGChooserItem.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGChooserView::UIGChooserView(QWidget *pParent)
     : QGraphicsView(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.h
index 7022e9d..e0f78af 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.h
@@ -1,7 +1,6 @@
+/* $Id: UIGChooserView.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGChooserView class declaration
+ * VBox Qt GUI - UIGChooserView class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.cpp
index 8fefe4e..d41a925 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGDetails.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetails class implementation
+ * VBox Qt GUI - UIGDetails class implementation.
  */
 
 /*
@@ -17,14 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QVBoxLayout>
+# include <QApplication>
+# include <QVBoxLayout>
 
 /* GUI includes: */
-#include "UIGDetails.h"
-#include "UIGDetailsModel.h"
-#include "UIGDetailsView.h"
+# include "UIGDetails.h"
+# include "UIGDetailsModel.h"
+# include "UIGDetailsView.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGDetails::UIGDetails(QWidget *pParent)
     : QWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.h
index 3231504..3cb2f93 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.h
@@ -1,7 +1,6 @@
+/* $Id: UIGDetails.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetails class declaration
+ * VBox Qt GUI - UIGDetails class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp
index 1aa1fde..382c948 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGDetailsElement.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsElement class implementation
+ * VBox Qt GUI - UIGDetailsElement class implementation.
  */
 
 /*
@@ -17,22 +15,31 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QGraphicsView>
-#include <QStateMachine>
-#include <QPropertyAnimation>
-#include <QSignalTransition>
-#include <QTextLayout>
-#include <QStyleOptionGraphicsItem>
-#include <QGraphicsSceneMouseEvent>
+# include <QGraphicsView>
+# include <QStateMachine>
+# include <QPropertyAnimation>
+# include <QSignalTransition>
+# include <QStyleOptionGraphicsItem>
+# include <QGraphicsSceneMouseEvent>
 
 /* GUI includes: */
-#include "UIGDetailsElement.h"
-#include "UIGDetailsSet.h"
-#include "UIGDetailsModel.h"
-#include "UIGraphicsRotatorButton.h"
-#include "UIIconPool.h"
-#include "UIConverter.h"
+# include "UIGDetailsElement.h"
+# include "UIGDetailsSet.h"
+# include "UIGDetailsModel.h"
+# include "UIGraphicsRotatorButton.h"
+# include "UIGraphicsTextPane.h"
+# include "UIActionPool.h"
+# include "UIIconPool.h"
+# include "UIConverter.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGDetailsElement::UIGDetailsElement(UIGDetailsSet *pParent, DetailsElementType type, bool fOpened)
     : UIGDetailsItem(pParent)
@@ -41,12 +48,11 @@ UIGDetailsElement::UIGDetailsElement(UIGDetailsSet *pParent, DetailsElementType
     , m_iCornerRadius(10)
     , m_iMinimumHeaderWidth(0)
     , m_iMinimumHeaderHeight(0)
-    , m_iMinimumTextWidth(0)
-    , m_iMinimumTextHeight(0)
-    , m_fClosed(!fOpened)
     , m_pButton(0)
+    , m_fClosed(!fOpened)
     , m_iAdditionalHeight(0)
     , m_fAnimationRunning(false)
+    , m_pTextPane(0)
     , m_fHovered(false)
     , m_fNameHovered(false)
     , m_pHighlightMachine(0)
@@ -61,6 +67,8 @@ UIGDetailsElement::UIGDetailsElement(UIGDetailsSet *pParent, DetailsElementType
     prepareElement();
     /* Prepare button: */
     prepareButton();
+    /* Prepare text-pane: */
+    prepareTextPane();
 
     /* Setup size-policy: */
     setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
@@ -92,6 +100,11 @@ void UIGDetailsElement::updateAppearance()
     /* Reset name hover state: */
     m_fNameHovered = false;
     updateNameHoverLink();
+
+    /* Update anchor role restrictions: */
+    ConfigurationAccessLevel cal = m_pSet->configurationAccessLevel();
+    m_pTextPane->setAnchorRoleRestricted("#mount", cal == ConfigurationAccessLevel_Null);
+    m_pTextPane->setAnchorRoleRestricted("#attach", cal != ConfigurationAccessLevel_Full);
 }
 
 void UIGDetailsElement::markAnimationFinished()
@@ -131,6 +144,54 @@ void UIGDetailsElement::sltElementToggleFinish(bool fToggled)
     emit sigToggleElementFinished();
 }
 
+void UIGDetailsElement::sltHandleAnchorClicked(const QString &strAnchor)
+{
+    /* Current anchor role: */
+    const QString strRole = strAnchor.section(',', 0, 0);
+    const QString strData = strAnchor.section(',', 1);
+
+    /* Handle known anchor roles: */
+    if (   strRole == "#mount"  // Optical and floppy attachments..
+        || strRole == "#attach" // Hard-drive attachments..
+        )
+    {
+        /* Prepare storage-menu: */
+        UIMenu menu;
+        menu.setShowToolTip(true);
+
+        /* Storage-controller name: */
+        QString strControllerName = strData.section(',', 0, 0);
+        /* Storage-slot: */
+        StorageSlot storageSlot = gpConverter->fromString<StorageSlot>(strData.section(',', 1));
+
+        /* Fill storage-menu: */
+        vboxGlobal().prepareStorageMenu(menu, this, SLOT(sltMountStorageMedium()),
+                                        machine(), strControllerName, storageSlot);
+
+        /* Exec menu: */
+        menu.exec(QCursor::pos());
+    }
+}
+
+void UIGDetailsElement::sltMountStorageMedium()
+{
+    /* Sender action: */
+    QAction *pAction = qobject_cast<QAction*>(sender());
+    AssertMsgReturnVoid(pAction, ("This slot should only be called by menu action!\n"));
+
+    /* Current mount-target: */
+    const UIMediumTarget target = pAction->data().value<UIMediumTarget>();
+
+    /* Update current machine mount-target: */
+    vboxGlobal().updateMachineStorage(machine(), target);
+}
+
+void UIGDetailsElement::resizeEvent(QGraphicsSceneResizeEvent*)
+{
+    /* Update layout: */
+    updateLayout();
+}
+
 QVariant UIGDetailsElement::data(int iKey) const
 {
     /* Provide other members with required data: */
@@ -164,141 +225,24 @@ void UIGDetailsElement::updateMinimumHeaderHeight()
     m_iMinimumHeaderHeight = qMax(m_iMinimumHeaderHeight, m_buttonSize.height());
 }
 
-void UIGDetailsElement::updateMinimumTextWidth()
-{
-    /* Prepare variables: */
-    int iSpacing = data(ElementData_Spacing).toInt();
-    int iMinimumTextColumnWidth = data(ElementData_MinimumTextColumnWidth).toInt();
-    QFontMetrics fm(m_textFont, model()->paintDevice());
-
-    /* Search for the maximum line widths: */
-    int iMaximumLeftLineWidth = 0;
-    int iMaximumRightLineWidth = 0;
-    bool fSingleColumnText = true;
-    foreach (const UITextTableLine line, m_text)
-    {
-        bool fRightColumnPresent = !line.second.isEmpty();
-        if (fRightColumnPresent)
-            fSingleColumnText = false;
-        QString strLeftLine = fRightColumnPresent ? line.first + ":" : line.first;
-        QString strRightLine = line.second;
-        iMaximumLeftLineWidth = qMax(iMaximumLeftLineWidth, fm.width(strLeftLine));
-        iMaximumRightLineWidth = qMax(iMaximumRightLineWidth, fm.width(strRightLine));
-    }
-    iMaximumLeftLineWidth += 1;
-    iMaximumRightLineWidth += 1;
-
-    /* Calculate minimum-text-width: */
-    int iMinimumTextWidth = 0;
-    if (fSingleColumnText)
-    {
-        /* Take into account only left column: */
-        int iMinimumLeftColumnWidth = qMin(iMaximumLeftLineWidth, iMinimumTextColumnWidth);
-        iMinimumTextWidth = iMinimumLeftColumnWidth;
-    }
-    else
-    {
-        /* Take into account both columns, but wrap only right one: */
-        int iMinimumLeftColumnWidth = iMaximumLeftLineWidth;
-        int iMinimumRightColumnWidth = qMin(iMaximumRightLineWidth, iMinimumTextColumnWidth);
-        iMinimumTextWidth = iMinimumLeftColumnWidth + iSpacing + iMinimumRightColumnWidth;
-    }
-
-    /* Is there something changed? */
-    if (m_iMinimumTextWidth != iMinimumTextWidth)
-    {
-        /* Remember new value: */
-        m_iMinimumTextWidth = iMinimumTextWidth;
-        /* Recursively update size-hint: */
-        updateGeometry();
-    }
-}
-
-void UIGDetailsElement::updateMinimumTextHeight()
+void UIGDetailsElement::setIcon(const QIcon &icon)
 {
-    /* Prepare variables: */
-    int iMargin = data(ElementData_Margin).toInt();
-    int iSpacing = data(ElementData_Spacing).toInt();
-    int iMinimumTextColumnWidth = data(ElementData_MinimumTextColumnWidth).toInt();
-    int iMaximumTextWidth = (int)geometry().width() - 3 * iMargin - iSpacing;
-    QPaintDevice *pPaintDevice = model()->paintDevice();
-    QFontMetrics fm(m_textFont, pPaintDevice);
-
-    /* Search for the maximum line widths: */
-    int iMaximumLeftLineWidth = 0;
-    int iMaximumRightLineWidth = 0;
-    bool fSingleColumnText = true;
-    foreach (const UITextTableLine line, m_text)
-    {
-        bool fRightColumnPresent = !line.second.isEmpty();
-        if (fRightColumnPresent)
-            fSingleColumnText = false;
-        QString strFirstLine = fRightColumnPresent ? line.first + ":" : line.first;
-        QString strSecondLine = line.second;
-        iMaximumLeftLineWidth = qMax(iMaximumLeftLineWidth, fm.width(strFirstLine));
-        iMaximumRightLineWidth = qMax(iMaximumRightLineWidth, fm.width(strSecondLine));
-    }
-    iMaximumLeftLineWidth += 1;
-    iMaximumRightLineWidth += 1;
-
-    /* Calculate column widths: */
-    int iLeftColumnWidth = 0;
-    int iRightColumnWidth = 0;
-    if (fSingleColumnText)
+    /* Cache icon: */
+    if (icon.isNull())
     {
-        /* Take into account only left column: */
-        iLeftColumnWidth = qMax(iMinimumTextColumnWidth, iMaximumTextWidth);
+        /* No icon provided: */
+        m_pixmapSize = QSize();
+        m_pixmap = QPixmap();
     }
     else
     {
-        /* Take into account both columns, but wrap only right one: */
-        iLeftColumnWidth = iMaximumLeftLineWidth;
-        iRightColumnWidth = iMaximumTextWidth - iLeftColumnWidth;
-    }
-
-    /* Calculate minimum-text-height: */
-    int iMinimumTextHeight = 0;
-    foreach (const UITextTableLine line, m_text)
-    {
-        /* First layout: */
-        int iLeftColumnHeight = 0;
-        if (!line.first.isEmpty())
-        {
-            bool fRightColumnPresent = !line.second.isEmpty();
-            QTextLayout *pTextLayout = prepareTextLayout(m_textFont, pPaintDevice,
-                                                         fRightColumnPresent ? line.first + ":" : line.first,
-                                                         iLeftColumnWidth, iLeftColumnHeight);
-            delete pTextLayout;
-        }
-
-        /* Second layout: */
-        int iRightColumnHeight = 0;
-        if (!line.second.isEmpty())
-        {
-            QTextLayout *pTextLayout = prepareTextLayout(m_textFont, pPaintDevice, line.second,
-                                                         iRightColumnWidth, iRightColumnHeight);
-            delete pTextLayout;
-        }
-
-        /* Append summary text height: */
-        iMinimumTextHeight += qMax(iLeftColumnHeight, iRightColumnHeight);
-    }
-
-    /* Is there something changed? */
-    if (m_iMinimumTextHeight != iMinimumTextHeight)
-    {
-        /* Remember new value: */
-        m_iMinimumTextHeight = iMinimumTextHeight;
-        /* Recursively update size-hint: */
-        updateGeometry();
+        /* Determine default the icon size: */
+        const QStyle *pStyle = QApplication::style();
+        const int iIconMetric = pStyle->pixelMetric(QStyle::PM_SmallIconSize);
+        m_pixmapSize = QSize(iIconMetric, iIconMetric);
+        /* Acquire the icon of the corresponding size: */
+        m_pixmap = icon.pixmap(m_pixmapSize);
     }
-}
-
-void UIGDetailsElement::setIcon(const QIcon &icon)
-{
-    /* Cache icon: */
-    m_pixmapSize = icon.isNull() ? QSize(0, 0) : icon.availableSizes().first();
-    m_pixmap = icon.pixmap(m_pixmapSize);
 
     /* Update linked values: */
     updateMinimumHeaderWidth();
@@ -317,31 +261,16 @@ void UIGDetailsElement::setName(const QString &strName)
     updateMinimumHeaderHeight();
 }
 
-void UIGDetailsElement::setText(const UITextTable &text)
+const UITextTable& UIGDetailsElement::text() const
 {
-    /* Clear first: */
-    m_text.clear();
-    /* For each the line of the passed table: */
-    foreach (const UITextTableLine &line, text)
-    {
-        /* Get lines: */
-        QString strLeftLine = line.first;
-        QString strRightLine = line.second;
-        /* If 2nd line is empty: */
-        if (strRightLine.isEmpty())
-        {
-            /* Parse the 1st one: */
-            QStringList subLines = strLeftLine.split(QRegExp("\\n"));
-            foreach (const QString &strSubLine, subLines)
-                m_text << UITextTableLine(strSubLine, QString());
-        }
-        else
-            m_text << UITextTableLine(strLeftLine, strRightLine);
-    }
+    /* Retrieve text from text-pane: */
+    return m_pTextPane->text();
+}
 
-    /* Update linked values: */
-    updateMinimumTextWidth();
-    updateMinimumTextHeight();
+void UIGDetailsElement::setText(const UITextTable &text)
+{
+    /* Pass text to text-pane: */
+    m_pTextPane->setText(text);
 }
 
 const CMachine& UIGDetailsElement::machine()
@@ -356,7 +285,7 @@ int UIGDetailsElement::minimumWidthHint() const
     int iMinimumWidthHint = 0;
 
     /* Maximum width: */
-    iMinimumWidthHint = qMax(m_iMinimumHeaderWidth, m_iMinimumTextWidth);
+    iMinimumWidthHint = qMax(m_iMinimumHeaderWidth, (int)m_pTextPane->minimumSizeHint().width());
 
     /* And 4 margins: 2 left and 2 right: */
     iMinimumWidthHint += 4 * iMargin;
@@ -381,8 +310,8 @@ int UIGDetailsElement::minimumHeightHint(bool fClosed) const
     if (!fClosed)
     {
         /* Add text height: */
-        if (!m_text.isEmpty())
-            iMinimumHeightHint += 2 * iMargin + m_iMinimumTextHeight;
+        if (!m_pTextPane->isEmpty())
+            iMinimumHeightHint += 2 * iMargin + (int)m_pTextPane->minimumSizeHint().height();
     }
 
     /* Additional height during animation: */
@@ -403,14 +332,35 @@ void UIGDetailsElement::updateLayout()
     /* Prepare variables: */
     QSize size = geometry().size().toSize();
     int iMargin = data(ElementData_Margin).toInt();
-    int iButtonWidth = m_buttonSize.width();
-    int iButtonHeight = m_buttonSize.height();
 
     /* Layout button: */
+    int iButtonWidth = m_buttonSize.width();
+    int iButtonHeight = m_buttonSize.height();
     int iButtonX = size.width() - 2 * iMargin - iButtonWidth;
     int iButtonY = iButtonHeight == m_iMinimumHeaderHeight ? iMargin :
                    iMargin + (m_iMinimumHeaderHeight - iButtonHeight) / 2;
     m_pButton->setPos(iButtonX, iButtonY);
+
+    /* If closed: */
+    if (closed())
+    {
+        /* Hide text-pane if still visible: */
+        if (m_pTextPane->isVisible())
+            m_pTextPane->hide();
+    }
+    /* If opened: */
+    else
+    {
+        /* Layout text-pane: */
+        int iTextPaneX = 2 * iMargin;
+        int iTextPaneY = iMargin + m_iMinimumHeaderHeight + 2 * iMargin;
+        m_pTextPane->setPos(iTextPaneX, iTextPaneY);
+        m_pTextPane->resize(size.width() - 4 * iMargin,
+                            size.height() - 4 * iMargin - m_iMinimumHeaderHeight);
+        /* Show text-pane if still invisible and animation finished: */
+        if (!m_pTextPane->isVisible() && !isAnimationRunning())
+            m_pTextPane->show();
+    }
 }
 
 void UIGDetailsElement::setAdditionalHeight(int iAdditionalHeight)
@@ -503,6 +453,14 @@ void UIGDetailsElement::prepareButton()
     m_buttonSize = m_pButton->minimumSizeHint().toSize();
 }
 
+void UIGDetailsElement::prepareTextPane()
+{
+    /* Create text-pane: */
+    m_pTextPane = new UIGraphicsTextPane(this, model()->paintDevice());
+    connect(m_pTextPane, SIGNAL(sigGeometryChanged()), this, SLOT(sltUpdateGeometry()));
+    connect(m_pTextPane, SIGNAL(sigAnchorClicked(const QString&)), this, SLOT(sltHandleAnchorClicked(const QString&)));
+}
+
 void UIGDetailsElement::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget*)
 {
     /* Update button visibility: */
@@ -539,21 +497,20 @@ void UIGDetailsElement::paintElementInfo(QPainter *pPainter, const QStyleOptionG
     QPalette pal = palette();
     QColor buttonTextColor = pal.color(QPalette::Active, QPalette::ButtonText);
     QColor linkTextColor = pal.color(QPalette::Active, QPalette::Link);
-    QColor baseTextColor = pal.color(QPalette::Active, QPalette::Text);
 
     /* Paint pixmap: */
-    int iMachinePixmapX = 2 * iMargin;
-    int iMachinePixmapY = iPixmapHeight == iMaximumHeight ?
+    int iElementPixmapX = 2 * iMargin;
+    int iElementPixmapY = iPixmapHeight == iMaximumHeight ?
                           iMargin : iMargin + (iMaximumHeight - iPixmapHeight) / 2;
     paintPixmap(/* Painter: */
                 pPainter,
                 /* Rectangle to paint in: */
-                QRect(QPoint(iMachinePixmapX, iMachinePixmapY), m_pixmapSize),
+                QRect(QPoint(iElementPixmapX, iElementPixmapY), m_pixmapSize),
                 /* Pixmap to paint: */
                 m_pixmap);
 
     /* Paint name: */
-    int iMachineNameX = iMachinePixmapX +
+    int iMachineNameX = iElementPixmapX +
                         m_pixmapSize.width() +
                         iSpacing;
     int iMachineNameY = iNameHeight == iMaximumHeight ?
@@ -570,88 +527,6 @@ void UIGDetailsElement::paintElementInfo(QPainter *pPainter, const QStyleOptionG
               m_strName,
               /* Name hovered? */
               m_fNameHovered ? linkTextColor : buttonTextColor);
-
-    /* Paint text: */
-    if (!m_fClosed && !m_text.isEmpty() && !m_fAnimationRunning)
-    {
-        /* Prepare painter: */
-        pPainter->save();
-        pPainter->setPen(baseTextColor);
-
-        /* Prepare variables: */
-        int iMinimumTextColumnWidth = data(ElementData_MinimumTextColumnWidth).toInt();
-        int iMaximumTextWidth = geometry().width() - 3 * iMargin - iSpacing;
-        QPaintDevice *pPaintDevice = model()->paintDevice();
-        QFontMetrics fm(m_textFont, pPaintDevice);
-
-        /* Search for the maximum line widths: */
-        int iMaximumLeftLineWidth = 0;
-        int iMaximumRightLineWidth = 0;
-        bool fSingleColumnText = true;
-        foreach (const UITextTableLine line, m_text)
-        {
-            bool fRightColumnPresent = !line.second.isEmpty();
-            if (fRightColumnPresent)
-                fSingleColumnText = false;
-            QString strFirstLine = fRightColumnPresent ? line.first + ":" : line.first;
-            QString strSecondLine = line.second;
-            iMaximumLeftLineWidth = qMax(iMaximumLeftLineWidth, fm.width(strFirstLine));
-            iMaximumRightLineWidth = qMax(iMaximumRightLineWidth, fm.width(strSecondLine));
-        }
-        iMaximumLeftLineWidth += 1;
-        iMaximumRightLineWidth += 1;
-
-        /* Calculate column widths: */
-        int iLeftColumnWidth = 0;
-        int iRightColumnWidth = 0;
-        if (fSingleColumnText)
-        {
-            /* Take into account only left column: */
-            iLeftColumnWidth = qMax(iMinimumTextColumnWidth, iMaximumTextWidth);
-        }
-        else
-        {
-            /* Take into account both columns, but wrap only right one: */
-            iLeftColumnWidth = iMaximumLeftLineWidth;
-            iRightColumnWidth = iMaximumTextWidth - iLeftColumnWidth;
-        }
-
-        /* Where to paint? */
-        int iMachineTextX = iMachinePixmapX;
-        int iMachineTextY = iMargin + m_iMinimumHeaderHeight + 2 * iMargin;
-
-        /* For each the line: */
-        foreach (const UITextTableLine line, m_text)
-        {
-            /* First layout: */
-            int iLeftColumnHeight = 0;
-            if (!line.first.isEmpty())
-            {
-                bool fRightColumnPresent = !line.second.isEmpty();
-                QTextLayout *pTextLayout = prepareTextLayout(m_textFont, pPaintDevice,
-                                                             fRightColumnPresent ? line.first + ":" : line.first,
-                                                             iLeftColumnWidth, iLeftColumnHeight);
-                pTextLayout->draw(pPainter, QPointF(iMachineTextX, iMachineTextY));
-                delete pTextLayout;
-            }
-
-            /* Second layout: */
-            int iRightColumnHeight = 0;
-            if (!line.second.isEmpty())
-            {
-                QTextLayout *pTextLayout = prepareTextLayout(m_textFont, pPaintDevice,
-                                                             line.second, iRightColumnWidth, iRightColumnHeight);
-                pTextLayout->draw(pPainter, QPointF(iMachineTextX + iLeftColumnWidth + iSpacing, iMachineTextY));
-                delete pTextLayout;
-            }
-
-            /* Indent Y: */
-            iMachineTextY += qMax(iLeftColumnHeight, iRightColumnHeight);
-        }
-
-        /* Restore painter: */
-        pPainter->restore();
-    }
 }
 
 void UIGDetailsElement::paintBackground(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption)
@@ -746,7 +621,7 @@ void UIGDetailsElement::mousePressEvent(QGraphicsSceneMouseEvent *pEvent)
     pEvent->accept();
     QString strCategory;
     if (m_type >= DetailsElementType_General &&
-        m_type <= DetailsElementType_SF)
+        m_type < DetailsElementType_Description)
         strCategory = QString("#%1").arg(gpConverter->toInternalString(m_type));
     else if (m_type == DetailsElementType_Description)
         strCategory = QString("#%1%%mTeDescription").arg(gpConverter->toInternalString(m_type));
@@ -781,14 +656,15 @@ void UIGDetailsElement::handleHoverEvent(QGraphicsSceneHoverEvent *pEvent)
     int iMargin = data(ElementData_Margin).toInt();
     int iSpacing = data(ElementData_Spacing).toInt();
     int iNameHeight = m_nameSize.height();
-    int iMachineNameX = 2 * iMargin + m_pixmapSize.width() + iSpacing;
-    int iMachineNameY = iNameHeight == m_iMinimumHeaderHeight ?
+    int iElementNameX = 2 * iMargin + m_pixmapSize.width() + iSpacing;
+    int iElementNameY = iNameHeight == m_iMinimumHeaderHeight ?
                         iMargin : iMargin + (m_iMinimumHeaderHeight - iNameHeight) / 2;
 
     /* Simulate hyperlink hovering: */
     QPoint point = pEvent->pos().toPoint();
-    bool fNameHovered = QRect(QPoint(iMachineNameX, iMachineNameY), m_nameSize).contains(point);
-    if (m_pSet->elementNameHoverable() && m_fNameHovered != fNameHovered)
+    bool fNameHovered = QRect(QPoint(iElementNameX, iElementNameY), m_nameSize).contains(point);
+    if (   m_pSet->configurationAccessLevel() != ConfigurationAccessLevel_Null
+        && m_fNameHovered != fNameHovered)
     {
         m_fNameHovered = fNameHovered;
         updateNameHoverLink();
@@ -804,61 +680,6 @@ void UIGDetailsElement::updateNameHoverLink()
     update();
 }
 
-/* static  */
-QTextLayout* UIGDetailsElement::prepareTextLayout(const QFont &font, QPaintDevice *pPaintDevice,
-                                                  const QString &strText, int iWidth, int &iHeight)
-{
-    /* Prepare variables: */
-    QFontMetrics fm(font, pPaintDevice);
-    int iLeading = fm.leading();
-
-    /* Only bold sub-strings are currently handled: */
-    QString strModifiedText(strText);
-    QRegExp boldRegExp("<b>([\\s\\S]+)</b>");
-    QList<QTextLayout::FormatRange> formatRangeList;
-    while (boldRegExp.indexIn(strModifiedText) != -1)
-    {
-        /* Prepare format: */
-        QTextLayout::FormatRange formatRange;
-        QFont font = formatRange.format.font();
-        font.setBold(true);
-        formatRange.format.setFont(font);
-        formatRange.start = boldRegExp.pos(0);
-        formatRange.length = boldRegExp.cap(1).size();
-        /* Add format range to list: */
-        formatRangeList << formatRange;
-        /* Replace sub-string: */
-        strModifiedText.replace(boldRegExp.cap(0), boldRegExp.cap(1));
-    }
-
-    /* Create layout; */
-    QTextLayout *pTextLayout = new QTextLayout(strModifiedText, font, pPaintDevice);
-    pTextLayout->setAdditionalFormats(formatRangeList);
-
-    /* Configure layout: */
-    QTextOption textOption;
-    textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
-    pTextLayout->setTextOption(textOption);
-
-    /* Build layout: */
-    pTextLayout->beginLayout();
-    while (1)
-    {
-        QTextLine line = pTextLayout->createLine();
-        if (!line.isValid())
-            break;
-
-        line.setLineWidth(iWidth);
-        iHeight += iLeading;
-        line.setPosition(QPointF(0, iHeight));
-        iHeight += line.height();
-    }
-    pTextLayout->endLayout();
-
-    /* Return layout: */
-    return pTextLayout;
-}
-
 void UIGDetailsElement::updateAnimationParameters()
 {
     /* Recalculate animation parameters: */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h
index 52e88f1..091f927 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h
@@ -1,7 +1,6 @@
+/* $Id: UIGDetailsElement.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsElement class declaration
+ * VBox Qt GUI - UIGDetailsElement class declaration.
  */
 
 /*
@@ -24,12 +23,13 @@
 
 /* GUI includes: */
 #include "UIGDetailsItem.h"
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
 
 /* Forward declarations: */
 class UIGDetailsSet;
 class CMachine;
 class UIGraphicsRotatorButton;
+class UIGraphicsTextPane;
 class QTextLayout;
 class QStateMachine;
 class QPropertyAnimation;
@@ -37,7 +37,6 @@ class QPropertyAnimation;
 /* Typedefs: */
 typedef QPair<QString, QString> UITextTableLine;
 typedef QList<UITextTableLine> UITextTable;
-Q_DECLARE_METATYPE(UITextTable);
 
 /* Details element
  * for graphics details model/view architecture: */
@@ -92,6 +91,15 @@ protected slots:
     void sltElementToggleStart();
     void sltElementToggleFinish(bool fToggled);
 
+    /** Handles children geometry changes. */
+    void sltUpdateGeometry() { updateGeometry(); }
+
+    /** Handles children anchor clicks. */
+    void sltHandleAnchorClicked(const QString &strAnchor);
+
+    /** Handles mount storage medium requests. */
+    void sltMountStorageMedium();
+
 protected:
 
     /* Data enumerator: */
@@ -103,14 +111,15 @@ protected:
         ElementData_MinimumTextColumnWidth
     };
 
+    /** This event handler is delivered after the widget has been resized. */
+    void resizeEvent(QGraphicsSceneResizeEvent *pEvent);
+
     /* Data provider: */
     QVariant data(int iKey) const;
 
     /* Helpers: Update stuff: */
     void updateMinimumHeaderWidth();
     void updateMinimumHeaderHeight();
-    void updateMinimumTextWidth();
-    void updateMinimumTextHeight();
 
     /* API: Icon stuff: */
     void setIcon(const QIcon &icon);
@@ -119,7 +128,7 @@ protected:
     void setName(const QString &strName);
 
     /* API: Text stuff: */
-    UITextTable text() const { return m_text; }
+    const UITextTable& text() const;
     void setText(const UITextTable &text);
 
     /* API: Machine stuff: */
@@ -155,6 +164,7 @@ private:
     /* Helpers: Prepare stuff: */
     void prepareElement();
     void prepareButton();
+    void prepareTextPane();
 
     /* Helpers: Paint stuff: */
     void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget = 0);
@@ -173,10 +183,6 @@ private:
     void handleHoverEvent(QGraphicsSceneHoverEvent *pEvent);
     void updateNameHoverLink();
 
-    /* Helper: Layout stuff: */
-    static QTextLayout* prepareTextLayout(const QFont &font, QPaintDevice *pPaintDevice,
-                                          const QString &strText, int iWidth, int &iHeight);
-
     /* Helper: Animation stuff: */
     void updateAnimationParameters();
 
@@ -185,7 +191,6 @@ private:
     DetailsElementType m_type;
     QPixmap m_pixmap;
     QString m_strName;
-    UITextTable m_text;
     int m_iCornerRadius;
     QFont m_nameFont;
     QFont m_textFont;
@@ -194,15 +199,16 @@ private:
     QSize m_buttonSize;
     int m_iMinimumHeaderWidth;
     int m_iMinimumHeaderHeight;
-    int m_iMinimumTextWidth;
-    int m_iMinimumTextHeight;
 
-    /* Variables: Toggle stuff: */
-    bool m_fClosed;
+    /* Variables: Toggle-button stuff: */
     UIGraphicsRotatorButton *m_pButton;
+    bool m_fClosed;
     int m_iAdditionalHeight;
     bool m_fAnimationRunning;
 
+    /* Variables: Text-pane stuff: */
+    UIGraphicsTextPane *m_pTextPane;
+
     /* Variables: Hover stuff: */
     bool m_fHovered;
     bool m_fNameHovered;
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
index 3fd47dc..9be3f9f 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,34 +15,44 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QGraphicsLinearLayout>
-#include <QTimer>
-#include <QDir>
+# include <QTimer>
+# include <QDir>
 
 /* GUI includes: */
-#include "UIGDetailsElements.h"
-#include "UIGDetailsModel.h"
-#include "UIGMachinePreview.h"
-#include "UIGraphicsRotatorButton.h"
-#include "VBoxGlobal.h"
-#include "UIIconPool.h"
-#include "UIConverter.h"
+# include "UIGDetailsElements.h"
+# include "UIGDetailsModel.h"
+# include "UIGMachinePreview.h"
+# include "UIGraphicsRotatorButton.h"
+# include "VBoxGlobal.h"
+# include "UIIconPool.h"
+# include "UIConverter.h"
+# include "UIGraphicsTextPane.h"
+# include "UIMessageCenter.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
-#include "CVRDEServer.h"
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
-#include "CAudioAdapter.h"
-#include "CNetworkAdapter.h"
-#include "CSerialPort.h"
-#include "CParallelPort.h"
-#include "CUSBController.h"
-#include "CUSBDeviceFilters.h"
-#include "CUSBDeviceFilter.h"
-#include "CSharedFolder.h"
-#include "CMedium.h"
+# include "CSystemProperties.h"
+# include "CVRDEServer.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
+# include "CAudioAdapter.h"
+# include "CNetworkAdapter.h"
+# include "CSerialPort.h"
+# include "CParallelPort.h"
+# include "CUSBController.h"
+# include "CUSBDeviceFilters.h"
+# include "CUSBDeviceFilter.h"
+# include "CSharedFolder.h"
+# include "CMedium.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QGraphicsLinearLayout>
+
 
 /* Constructor: */
 UIGDetailsUpdateThread::UIGDetailsUpdateThread(const CMachine &machine)
@@ -185,6 +195,8 @@ UIGDetailsElementPreview::UIGDetailsElementPreview(UIGDetailsSet *pParent, bool
 
     /* Create preview: */
     m_pPreview = new UIGMachinePreview(this);
+    connect(m_pPreview, SIGNAL(sigSizeHintChanged()),
+            this, SLOT(sltPreviewSizeHintChanged()));
     pLayout->addItem(m_pPreview);
     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
 
@@ -192,6 +204,14 @@ UIGDetailsElementPreview::UIGDetailsElementPreview(UIGDetailsSet *pParent, bool
     retranslateUi();
 }
 
+void UIGDetailsElementPreview::sltPreviewSizeHintChanged()
+{
+    /* Recursively update size-hints: */
+    updateGeometry();
+    /* Update whole model layout: */
+    model()->updateLayout();
+}
+
 void UIGDetailsElementPreview::retranslateUi()
 {
     setName(gpConverter->toString(DetailsElementType_Preview));
@@ -330,6 +350,13 @@ void UIGDetailsUpdateThreadSystem::run()
             }
             if (machine().GetCPUProperty(KCPUPropertyType_PAE))
                 acceleration << QApplication::translate("UIGDetails", "PAE/NX", "details (system)");
+            switch (machine().GetEffectiveParavirtProvider())
+            {
+                case KParavirtProvider_Minimal: acceleration << QApplication::translate("UIGDetails", "Minimal Paravirtualization", "details (system)"); break;
+                case KParavirtProvider_HyperV:  acceleration << QApplication::translate("UIGDetails", "Hyper-V Paravirtualization", "details (system)"); break;
+                case KParavirtProvider_KVM:     acceleration << QApplication::translate("UIGDetails", "KVM Paravirtualization", "details (system)"); break;
+                default: break;
+            }
             if (!acceleration.isEmpty())
                 m_text << UITextTableLine(QApplication::translate("UIGDetails", "Acceleration", "details (system)"),
                                           acceleration.join(", "));
@@ -383,31 +410,65 @@ void UIGDetailsUpdateThreadDisplay::run()
         /* Gather information: */
         if (machine().GetAccessible())
         {
+            /* Damn GetExtraData should be const already :( */
+            CMachine localMachine = machine();
+
             /* Video memory: */
             m_text << UITextTableLine(QApplication::translate("UIGDetails", "Video Memory", "details (display)"),
-                                      QApplication::translate("UIGDetails", "%1 MB", "details").arg(machine().GetVRAMSize()));
+                                      QApplication::translate("UIGDetails", "%1 MB", "details").arg(localMachine.GetVRAMSize()));
 
             /* Screen count: */
-            int cGuestScreens = machine().GetMonitorCount();
+            int cGuestScreens = localMachine.GetMonitorCount();
             if (cGuestScreens > 1)
                 m_text << UITextTableLine(QApplication::translate("UIGDetails", "Screens", "details (display)"),
                                           QString::number(cGuestScreens));
 
+            /* Get scale-factor value: */
+            const QString strScaleFactor = localMachine.GetExtraData(UIExtraDataDefs::GUI_ScaleFactor);
+            {
+                /* Try to convert loaded data to double: */
+                bool fOk = false;
+                double dValue = strScaleFactor.toDouble(&fOk);
+                /* Invent the default value: */
+                if (!fOk || !dValue)
+                    dValue = 1.0;
+                /* Append information: */
+                if (dValue != 1.0)
+                    m_text << UITextTableLine(QApplication::translate("UIGDetails", "Scale-factor", "details (display)"),
+                                              QString::number(dValue, 'f', 2));
+            }
+
+#ifdef Q_WS_MAC
+            /* Get 'Unscaled HiDPI Video Output' mode value: */
+            const QString strUnscaledHiDPIMode = localMachine.GetExtraData(UIExtraDataDefs::GUI_HiDPI_UnscaledOutput);
+            {
+                /* Try to convert loaded data to bool: */
+                const bool fEnabled  = strUnscaledHiDPIMode.compare("true", Qt::CaseInsensitive) == 0 ||
+                                       strUnscaledHiDPIMode.compare("yes", Qt::CaseInsensitive) == 0 ||
+                                       strUnscaledHiDPIMode.compare("on", Qt::CaseInsensitive) == 0 ||
+                                       strUnscaledHiDPIMode == "1";
+                /* Append information: */
+                if (fEnabled)
+                    m_text << UITextTableLine(QApplication::translate("UIGDetails", "Unscaled HiDPI Video Output", "details (display)"),
+                                              QApplication::translate("UIGDetails", "Enabled", "details (display/Unscaled HiDPI Video Output)"));
+            }
+#endif /* Q_WS_MAC */
+
             QStringList acceleration;
 #ifdef VBOX_WITH_VIDEOHWACCEL
             /* 2D acceleration: */
-            if (machine().GetAccelerate2DVideoEnabled())
+            if (localMachine.GetAccelerate2DVideoEnabled())
                 acceleration << QApplication::translate("UIGDetails", "2D Video", "details (display)");
 #endif /* VBOX_WITH_VIDEOHWACCEL */
             /* 3D acceleration: */
-            if (machine().GetAccelerate3DEnabled())
+            if (localMachine.GetAccelerate3DEnabled())
                 acceleration << QApplication::translate("UIGDetails", "3D", "details (display)");
             if (!acceleration.isEmpty())
                 m_text << UITextTableLine(QApplication::translate("UIGDetails", "Acceleration", "details (display)"),
                                           acceleration.join(", "));
 
             /* VRDE info: */
-            CVRDEServer srv = machine().GetVRDEServer();
+            CVRDEServer srv = localMachine.GetVRDEServer();
             if (!srv.isNull())
             {
                 if (srv.GetEnabled())
@@ -419,14 +480,14 @@ void UIGDetailsUpdateThreadDisplay::run()
             }
 
             /* Video Capture info: */
-            if (machine().GetVideoCaptureEnabled())
+            if (localMachine.GetVideoCaptureEnabled())
             {
                 m_text << UITextTableLine(QApplication::translate("UIGDetails", "Video Capture File", "details (display/video capture)"),
-                                          machine().GetVideoCaptureFile());
+                                          localMachine.GetVideoCaptureFile());
                 m_text << UITextTableLine(QApplication::translate("UIGDetails", "Video Capture Attributes", "details (display/video capture)"),
                                           QApplication::translate("UIGDetails", "Frame Size: %1x%2, Frame Rate: %3fps, Bit Rate: %4kbps")
-                                             .arg(machine().GetVideoCaptureWidth()).arg(machine().GetVideoCaptureHeight())
-                                             .arg(machine().GetVideoCaptureFPS()).arg(machine().GetVideoCaptureRate()));
+                                             .arg(localMachine.GetVideoCaptureWidth()).arg(localMachine.GetVideoCaptureHeight())
+                                             .arg(localMachine.GetVideoCaptureFPS()).arg(localMachine.GetVideoCaptureRate()));
             }
             else
             {
@@ -496,6 +557,11 @@ void UIGDetailsUpdateThreadStorage::run()
                 {
                     /* Prepare current storage slot: */
                     StorageSlot attachmentSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice());
+                    AssertMsg(controller.isOk(),
+                              ("Unable to acquire controller data: %s\n",
+                               msgCenter().formatRC(controller.lastRC()).toAscii().constData()));
+                    if (!controller.isOk())
+                        continue;
                     /* Prepare attachment information: */
                     QString strAttachmentInfo = vboxGlobal().details(attachment.GetMedium(), false, false);
                     /* That temporary hack makes sure 'Inaccessible' word is always bold: */
@@ -504,14 +570,28 @@ void UIGDetailsUpdateThreadStorage::run()
                         QString strBoldInaccessibleString(QString("<b>%1</b>").arg(strInaccessibleString));
                         strAttachmentInfo.replace(strInaccessibleString, strBoldInaccessibleString);
                     } // hack
-                    /* Append 'device slot name' with 'device type name' for CD/DVD devices only: */
-                    QString strDeviceType = attachment.GetType() == KDeviceType_DVD ?
-                                QApplication::translate("UIGDetails", "[CD/DVD]", "details (storage)") : QString();
+                    /* Append 'device slot name' with 'device type name' for optical devices only: */
+                    KDeviceType deviceType = attachment.GetType();
+                    QString strDeviceType = deviceType == KDeviceType_DVD ?
+                                QApplication::translate("UIGDetails", "[Optical Drive]", "details (storage)") : QString();
                     if (!strDeviceType.isNull())
                         strDeviceType.append(' ');
                     /* Insert that attachment information into the map: */
                     if (!strAttachmentInfo.isNull())
-                        attachmentsMap.insert(attachmentSlot, strDeviceType + strAttachmentInfo);
+                    {
+                        /* Configure hovering anchors: */
+                        const QString strAnchorType = deviceType == KDeviceType_DVD || deviceType == KDeviceType_Floppy ? QString("mount") :
+                                                      deviceType == KDeviceType_HardDisk ? QString("attach") : QString();
+                        const CMedium medium = attachment.GetMedium();
+                        const QString strMediumLocation = medium.isNull() ? QString() : medium.GetLocation();
+                        attachmentsMap.insert(attachmentSlot,
+                                              QString("<a href=#%1,%2,%3,%4>%5</a>")
+                                                      .arg(strAnchorType,
+                                                           controller.GetName(),
+                                                           gpConverter->toString(attachmentSlot),
+                                                           strMediumLocation,
+                                                           strDeviceType + strAttachmentInfo));
+                    }
                 }
                 /* Iterate over the sorted map: */
                 QList<StorageSlot> storageSlots = attachmentsMap.keys();
@@ -767,7 +847,8 @@ void UIGDetailsUpdateThreadSerial::run()
                 {
                     KPortMode mode = port.GetHostMode();
                     QString data = vboxGlobal().toCOMPortName(port.GetIRQ(), port.GetIOBase()) + ", ";
-                    if (mode == KPortMode_HostPipe || mode == KPortMode_HostDevice || mode == KPortMode_RawFile)
+                    if (mode == KPortMode_HostPipe || mode == KPortMode_HostDevice ||
+                        mode == KPortMode_RawFile || mode == KPortMode_TCP)
                         data += QString("%1 (%2)").arg(gpConverter->toString(mode)).arg(QDir::toNativeSeparators(port.GetPath()));
                     else
                         data += gpConverter->toString(mode);
@@ -896,9 +977,17 @@ void UIGDetailsUpdateThreadUSB::run()
             const CUSBDeviceFilters &filters = machine().GetUSBDeviceFilters();
             if (!filters.isNull() && machine().GetUSBProxyAvailable())
             {
-                const CUSBDeviceFilters &flts = machine().GetUSBDeviceFilters();
-                if (!flts.isNull() && machine().GetUSBControllerCountByType(KUSBControllerType_OHCI))
+                const CUSBDeviceFilters flts = machine().GetUSBDeviceFilters();
+                const CUSBControllerVector controllers = machine().GetUSBControllers();
+                if (!flts.isNull() && !controllers.isEmpty())
                 {
+                    /* USB Controllers info: */
+                    QStringList controllerList;
+                    foreach (const CUSBController &controller, controllers)
+                        controllerList << gpConverter->toString(controller.GetType());
+                    m_text << UITextTableLine(QApplication::translate("UIGDetails", "USB Controller", "details (usb)"),
+                                              controllerList.join(", "));
+                    /* USB Device Filters info: */
                     const CUSBDeviceFilterVector &coll = flts.GetDeviceFilters();
                     uint uActive = 0;
                     for (int i = 0; i < coll.size(); ++i)
@@ -999,6 +1088,125 @@ UIGDetailsUpdateThread* UIGDetailsElementSF::createUpdateThread()
 }
 
 
+UIGDetailsUpdateThreadUI::UIGDetailsUpdateThreadUI(const CMachine &machine)
+    : UIGDetailsUpdateThread(machine)
+{
+}
+
+void UIGDetailsUpdateThreadUI::run()
+{
+    COMBase::InitializeCOM(false);
+
+    if (!machine().isNull())
+    {
+        /* Prepare table: */
+        UITextTable m_text;
+
+        /* Gather information: */
+        if (machine().GetAccessible())
+        {
+            /* Damn GetExtraData should be const already :( */
+            CMachine localMachine = machine();
+
+#ifndef Q_WS_MAC
+            /* Get menu-bar availability status: */
+            const QString strMenubarEnabled = localMachine.GetExtraData(UIExtraDataDefs::GUI_MenuBar_Enabled);
+            {
+                /* Try to convert loaded data to bool: */
+                const bool fEnabled = !(strMenubarEnabled.compare("false", Qt::CaseInsensitive) == 0 ||
+                                        strMenubarEnabled.compare("no", Qt::CaseInsensitive) == 0 ||
+                                        strMenubarEnabled.compare("off", Qt::CaseInsensitive) == 0 ||
+                                        strMenubarEnabled == "0");
+                /* Append information: */
+                m_text << UITextTableLine(QApplication::translate("UIGDetails", "Menu-bar", "details (user interface)"),
+                                          fEnabled ? QApplication::translate("UIGDetails", "Enabled", "details (user interface/menu-bar)") :
+                                                     QApplication::translate("UIGDetails", "Disabled", "details (user interface/menu-bar)"));
+            }
+#endif /* !Q_WS_MAC */
+
+            /* Get status-bar availability status: */
+            const QString strStatusbarEnabled = localMachine.GetExtraData(UIExtraDataDefs::GUI_StatusBar_Enabled);
+            {
+                /* Try to convert loaded data to bool: */
+                const bool fEnabled = !(strStatusbarEnabled.compare("false", Qt::CaseInsensitive) == 0 ||
+                                        strStatusbarEnabled.compare("no", Qt::CaseInsensitive) == 0 ||
+                                        strStatusbarEnabled.compare("off", Qt::CaseInsensitive) == 0 ||
+                                        strStatusbarEnabled == "0");
+                /* Append information: */
+                m_text << UITextTableLine(QApplication::translate("UIGDetails", "Status-bar", "details (user interface)"),
+                                          fEnabled ? QApplication::translate("UIGDetails", "Enabled", "details (user interface/status-bar)") :
+                                                     QApplication::translate("UIGDetails", "Disabled", "details (user interface/status-bar)"));
+            }
+
+#ifndef Q_WS_MAC
+            /* Get mini-toolbar availability status: */
+            const QString strMiniToolbarEnabled = localMachine.GetExtraData(UIExtraDataDefs::GUI_ShowMiniToolBar);
+            {
+                /* Try to convert loaded data to bool: */
+                const bool fEnabled = !(strMiniToolbarEnabled.compare("false", Qt::CaseInsensitive) == 0 ||
+                                        strMiniToolbarEnabled.compare("no", Qt::CaseInsensitive) == 0 ||
+                                        strMiniToolbarEnabled.compare("off", Qt::CaseInsensitive) == 0 ||
+                                        strMiniToolbarEnabled == "0");
+                /* Append information: */
+                if (fEnabled)
+                {
+                    /* Get mini-toolbar position: */
+                    const QString &strMiniToolbarPosition = localMachine.GetExtraData(UIExtraDataDefs::GUI_MiniToolBarAlignment);
+                    {
+                        /* Try to convert loaded data to alignment: */
+                        switch (gpConverter->fromInternalString<MiniToolbarAlignment>(strMiniToolbarPosition))
+                        {
+                            /* Append information: */
+                            case MiniToolbarAlignment_Top:
+                                m_text << UITextTableLine(QApplication::translate("UIGDetails", "Mini-toolbar Position", "details (user interface)"),
+                                                          QApplication::translate("UIGDetails", "Top", "details (user interface/mini-toolbar position)"));
+                                break;
+                            /* Append information: */
+                            case MiniToolbarAlignment_Bottom:
+                                m_text << UITextTableLine(QApplication::translate("UIGDetails", "Mini-toolbar Position", "details (user interface)"),
+                                                          QApplication::translate("UIGDetails", "Bottom", "details (user interface/mini-toolbar position)"));
+                                break;
+                        }
+                    }
+                }
+                /* Append information: */
+                else
+                    m_text << UITextTableLine(QApplication::translate("UIGDetails", "Mini-toolbar", "details (user interface)"),
+                                              QApplication::translate("UIGDetails", "Disabled", "details (user interface/mini-toolbar)"));
+            }
+#endif /* !Q_WS_MAC */
+        }
+        else
+            m_text << UITextTableLine(QApplication::translate("UIGDetails", "Information Inaccessible", "details"), QString());
+
+        /* Send information into GUI thread: */
+        emit sigComplete(m_text);
+    }
+
+    COMBase::CleanupCOM();
+}
+
+UIGDetailsElementUI::UIGDetailsElementUI(UIGDetailsSet *pParent, bool fOpened)
+    : UIGDetailsElementInterface(pParent, DetailsElementType_UI, fOpened)
+{
+    /* Icon: */
+    setIcon(UIIconPool::iconSet(":/interface_16px.png"));
+
+    /* Translate: */
+    retranslateUi();
+}
+
+void UIGDetailsElementUI::retranslateUi()
+{
+    setName(gpConverter->toString(DetailsElementType_UI));
+}
+
+UIGDetailsUpdateThread* UIGDetailsElementUI::createUpdateThread()
+{
+    return new UIGDetailsUpdateThreadUI(machine());
+}
+
+
 UIGDetailsUpdateThreadDescription::UIGDetailsUpdateThreadDescription(const CMachine &machine)
     : UIGDetailsUpdateThread(machine)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h
index 81dea6a..0e140db 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElements.h
@@ -1,7 +1,6 @@
+/* $Id: UIGDetailsElements.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsElements class declaration
+ * VBox Qt GUI - UIGDetailsElements class declaration.
  */
 
 /*
@@ -136,6 +135,11 @@ public:
     /* Constructor: */
     UIGDetailsElementPreview(UIGDetailsSet *pParent, bool fOpened);
 
+private slots:
+
+    /** Handles preview size-hint changes. */
+    void sltPreviewSizeHintChanged();
+
 private:
 
     /* Helper: Translate stuff: */
@@ -481,6 +485,42 @@ private:
 };
 
 
+/* Thread 'UI': */
+class UIGDetailsUpdateThreadUI : public UIGDetailsUpdateThread
+{
+    Q_OBJECT;
+
+public:
+
+    /* Constructor: */
+    UIGDetailsUpdateThreadUI(const CMachine &machine);
+
+private:
+
+    /* Helpers: Prepare stuff: */
+    void run();
+};
+
+/* Element 'UI': */
+class UIGDetailsElementUI : public UIGDetailsElementInterface
+{
+    Q_OBJECT;
+
+public:
+
+    /* Constructor: */
+    UIGDetailsElementUI(UIGDetailsSet *pParent, bool fOpened);
+
+private:
+
+    /* Helper: Translate stuff: */
+    void retranslateUi();
+
+    /* Helper: Update stuff: */
+    UIGDetailsUpdateThread* createUpdateThread();
+};
+
+
 /* Thread 'Description': */
 class UIGDetailsUpdateThreadDescription : public UIGDetailsUpdateThread
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.cpp
index 723c848..ce12b1c 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGDetailsGroup.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsGroup class implementation
+ * VBox Qt GUI - UIGDetailsGroup class implementation.
  */
 
 /*
@@ -17,16 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt include: */
-#include <QGraphicsScene>
+# include <QGraphicsScene>
 
 /* GUI includes: */
-#include "UIGDetailsGroup.h"
-#include "UIGDetailsSet.h"
-#include "UIGDetailsModel.h"
-#include "UIConverter.h"
-#include "VBoxGlobal.h"
-#include "UIVMItem.h"
+# include "UIGDetailsGroup.h"
+# include "UIGDetailsSet.h"
+# include "UIGDetailsModel.h"
+# include "UIExtraDataManager.h"
+# include "VBoxGlobal.h"
+# include "UIVMItem.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGDetailsGroup::UIGDetailsGroup(QGraphicsScene *pParent)
     : UIGDetailsItem(0)
@@ -65,9 +70,6 @@ void UIGDetailsGroup::buildGroup(const QList<UIVMItem*> &machineItems)
 
 void UIGDetailsGroup::rebuildGroup()
 {
-    /* Load settings: */
-    loadSettings();
-
     /* Cleanup build-step: */
     delete m_pBuildStep;
     m_pBuildStep = 0;
@@ -110,7 +112,7 @@ void UIGDetailsGroup::sltBuildStep(QString strStepId, int iStepNumber)
         m_pBuildStep = new UIBuildStep(this, pSet, strStepId, iStepNumber + 1);
 
         /* Build set: */
-        pSet->buildSet(m_machineItems[iStepNumber], m_machineItems.size() == 1, m_settings);
+        pSet->buildSet(m_machineItems[iStepNumber], m_machineItems.size() == 1, model()->settings());
     }
     else
     {
@@ -192,28 +194,6 @@ void UIGDetailsGroup::prepareConnections()
             model(), SIGNAL(sigRootItemMinimumHeightHintChanged(int)));
 }
 
-void UIGDetailsGroup::loadSettings()
-{
-    /* Load settings: */
-    m_settings = vboxGlobal().virtualBox().GetExtraDataStringList(GUI_DetailsPageBoxes);
-    /* If settings are empty: */
-    if (m_settings.isEmpty())
-    {
-        /* Propose the defaults: */
-        m_settings << gpConverter->toInternalString(DetailsElementType_General);
-        m_settings << gpConverter->toInternalString(DetailsElementType_Preview);
-        m_settings << gpConverter->toInternalString(DetailsElementType_System);
-        m_settings << gpConverter->toInternalString(DetailsElementType_Display);
-        m_settings << gpConverter->toInternalString(DetailsElementType_Storage);
-        m_settings << gpConverter->toInternalString(DetailsElementType_Audio);
-        m_settings << gpConverter->toInternalString(DetailsElementType_Network);
-        m_settings << gpConverter->toInternalString(DetailsElementType_USB);
-        m_settings << gpConverter->toInternalString(DetailsElementType_SF);
-        m_settings << gpConverter->toInternalString(DetailsElementType_Description);
-        vboxGlobal().virtualBox().SetExtraDataStringList(GUI_DetailsPageBoxes, m_settings);
-    }
-}
-
 void UIGDetailsGroup::updateGeometry()
 {
     /* Call to base class: */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.h
index 59279b0..c1bf8d6 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsGroup.h
@@ -1,7 +1,6 @@
+/* $Id: UIGDetailsGroup.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsGroup class declaration
+ * VBox Qt GUI - UIGDetailsGroup class declaration.
  */
 
 /*
@@ -80,7 +79,6 @@ private:
 
     /* Helpers: Prepare stuff: */
     void prepareConnections();
-    void loadSettings();
 
     /* Helpers: Layout stuff: */
     void updateGeometry();
@@ -95,7 +93,6 @@ private:
     QList<UIVMItem*> m_machineItems;
     UIBuildStep *m_pBuildStep;
     QString m_strGroupId;
-    QStringList m_settings;
 
     /* Friends: */
     friend class UIGDetailsModel;
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.cpp
index dab9e84..4f0e22c 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGDetailsItem.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsItem class definition
+ * VBox Qt GUI - UIGDetailsItem class definition.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QPainter>
-#include <QGraphicsScene>
-#include <QStyleOptionGraphicsItem>
+# include <QApplication>
+# include <QPainter>
+# include <QGraphicsScene>
+# include <QStyleOptionGraphicsItem>
 
 /* GUI includes: */
-#include "UIGDetailsGroup.h"
-#include "UIGDetailsSet.h"
-#include "UIGDetailsElement.h"
-#include "UIGDetailsModel.h"
+# include "UIGDetailsGroup.h"
+# include "UIGDetailsSet.h"
+# include "UIGDetailsElement.h"
+# include "UIGDetailsModel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGDetailsItem::UIGDetailsItem(UIGDetailsItem *pParent)
     : QIWithRetranslateUI4<QIGraphicsWidget>(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.h
index 65f5925..9422d39 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.h
@@ -1,7 +1,6 @@
+/* $Id: UIGDetailsItem.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsItem class declaration
+ * VBox Qt GUI - UIGDetailsItem class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.cpp
index 9724400..859a38b 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGDetailsModel.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsModel class implementation
+ * VBox Qt GUI - UIGDetailsModel class implementation.
  */
 
 /*
@@ -17,17 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QGraphicsScene>
-#include <QGraphicsSceneContextMenuEvent>
-#include <QGraphicsView>
+# include <QGraphicsScene>
+# include <QGraphicsSceneContextMenuEvent>
+# include <QGraphicsView>
 
 /* GUI includes: */
-#include "UIGDetailsModel.h"
-#include "UIGDetailsGroup.h"
-#include "UIGDetailsElement.h"
-#include "VBoxGlobal.h"
-#include "UIConverter.h"
+# include "UIGDetailsModel.h"
+# include "UIGDetailsGroup.h"
+# include "UIGDetailsElement.h"
+# include "UIExtraDataManager.h"
+# include "VBoxGlobal.h"
+# include "UIConverter.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGDetailsModel::UIGDetailsModel(QObject *pParent)
     : QObject(pParent)
@@ -41,12 +47,18 @@ UIGDetailsModel::UIGDetailsModel(QObject *pParent)
     /* Prepare root: */
     prepareRoot();
 
+    /* Load settings: */
+    loadSettings();
+
     /* Register meta-type: */
     qRegisterMetaType<DetailsElementType>();
 }
 
 UIGDetailsModel::~UIGDetailsModel()
 {
+    /* Save settings: */
+    saveSettings();
+
     /* Cleanup root: */
     cleanupRoot();
 
@@ -155,43 +167,24 @@ void UIGDetailsModel::sltToggleAnimationFinished(DetailsElementType type, bool f
     /* Update layout: */
     updateLayout();
 
-    /* Update details settings: */
-    QStringList detailsSettings = vboxGlobal().virtualBox().GetExtraDataStringList(GUI_DetailsPageBoxes);
-    QString strOldElementName = gpConverter->toInternalString(type);
-    QString strNewElementName = strOldElementName;
-    if (fToggled)
-        strOldElementName += "Closed";
-    else
-        strNewElementName += "Closed";
-    int iIndex = detailsSettings.indexOf(strOldElementName);
-    if (iIndex != -1)
-    {
-        detailsSettings[iIndex] = strNewElementName;
-        vboxGlobal().virtualBox().SetExtraDataStringList(GUI_DetailsPageBoxes, detailsSettings);
-    }
+    /* Update element open/close status: */
+    if (m_settings.contains(type))
+        m_settings[type] = fToggled;
 }
 
 void UIGDetailsModel::sltElementTypeToggled()
 {
     /* Which item was toggled? */
     QAction *pAction = qobject_cast<QAction*>(sender());
-    DetailsElementType elementType = pAction->data().value<DetailsElementType>();
-    QString strElementTypeOpened = gpConverter->toInternalString(elementType);
-    QString strElementTypeClosed = strElementTypeOpened + "Closed";
-    QStringList detailsSettings = vboxGlobal().virtualBox().GetExtraDataStringList(GUI_DetailsPageBoxes);
-    /* Update details settings: */
-    bool fElementExists = detailsSettings.contains(strElementTypeOpened) ||
-                          detailsSettings.contains(strElementTypeClosed);
-    if (fElementExists)
-    {
-        detailsSettings.removeAll(strElementTypeOpened);
-        detailsSettings.removeAll(strElementTypeClosed);
-    }
+    DetailsElementType type = pAction->data().value<DetailsElementType>();
+
+    /* Toggle element visibility status: */
+    if (m_settings.contains(type))
+        m_settings.remove(type);
     else
-    {
-        detailsSettings.append(strElementTypeOpened);
-    }
-    vboxGlobal().virtualBox().SetExtraDataStringList(GUI_DetailsPageBoxes, detailsSettings);
+        m_settings[type] = true;
+
+    /* Rebuild group: */
     m_pRoot->rebuildGroup();
 }
 
@@ -231,6 +224,33 @@ void UIGDetailsModel::prepareRoot()
     m_pRoot = new UIGDetailsGroup(scene());
 }
 
+void UIGDetailsModel::loadSettings()
+{
+    /* Load settings: */
+    m_settings = gEDataManager->selectorWindowDetailsElements();
+    /* If settings are empty: */
+    if (m_settings.isEmpty())
+    {
+        /* Propose the defaults: */
+        m_settings[DetailsElementType_General] = true;
+        m_settings[DetailsElementType_Preview] = true;
+        m_settings[DetailsElementType_System] = true;
+        m_settings[DetailsElementType_Display] = true;
+        m_settings[DetailsElementType_Storage] = true;
+        m_settings[DetailsElementType_Audio] = true;
+        m_settings[DetailsElementType_Network] = true;
+        m_settings[DetailsElementType_USB] = true;
+        m_settings[DetailsElementType_SF] = true;
+        m_settings[DetailsElementType_Description] = true;
+    }
+}
+
+void UIGDetailsModel::saveSettings()
+{
+    /* Save settings: */
+    gEDataManager->setSelectorWindowDetailsElements(m_settings);
+}
+
 void UIGDetailsModel::cleanupRoot()
 {
     delete m_pRoot;
@@ -266,15 +286,13 @@ bool UIGDetailsModel::processContextMenuEvent(QGraphicsSceneContextMenuEvent *pE
 
     /* Prepare context-menu: */
     QMenu contextMenu;
-    QStringList detailsSettings = vboxGlobal().virtualBox().GetExtraDataStringList(GUI_DetailsPageBoxes);
+    /* Enumerate elements settings: */
     for (int iType = DetailsElementType_General; iType <= DetailsElementType_Description; ++iType)
     {
         DetailsElementType currentElementType = (DetailsElementType)iType;
         QAction *pAction = contextMenu.addAction(gpConverter->toString(currentElementType), this, SLOT(sltElementTypeToggled()));
         pAction->setCheckable(true);
-        QString strTypeIdOpened = gpConverter->toInternalString(currentElementType);
-        QString strTypeIdClosed = strTypeIdOpened + "Closed";
-        pAction->setChecked(detailsSettings.contains(strTypeIdOpened) || detailsSettings.contains(strTypeIdClosed));
+        pAction->setChecked(m_settings.contains(currentElementType));
         pAction->setData(QVariant::fromValue(currentElementType));
     }
     /* Exec context-menu: */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.h
index 12b82e3..a615e1c 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsModel.h
@@ -1,7 +1,6 @@
+/* $Id: UIGDetailsModel.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsModel class declaration
+ * VBox Qt GUI - UIGDetailsModel class declaration.
  */
 
 /*
@@ -26,7 +25,7 @@
 #include <QSet>
 
 /* GUI includes: */
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
 
 /* COM includes: */
 #include "COMEnums.h"
@@ -72,6 +71,9 @@ public:
     /* API: Current-item(s) stuff: */
     void setItems(const QList<UIVMItem*> &items);
 
+    /** Returns the details settings. */
+    const QMap<DetailsElementType, bool>& settings() const { return m_settings; }
+
 private slots:
 
     /* Handler: Details-view stuff: */
@@ -102,8 +104,10 @@ private:
     /* Helpers: Prepare stuff: */
     void prepareScene();
     void prepareRoot();
+    void loadSettings();
 
     /* Helpers: Cleanup stuff: */
+    void saveSettings();
     void cleanupRoot();
     void cleanupScene();
 
@@ -117,6 +121,8 @@ private:
     QGraphicsScene *m_pScene;
     UIGDetailsGroup *m_pRoot;
     UIGDetailsElementAnimationCallback *m_pAnimationCallback;
+    /** Holds the details settings. */
+    QMap<DetailsElementType, bool> m_settings;
 };
 
 /* Details-element animation callback: */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp
index cc83d46..da7ef57 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGDetailsSet.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsSet class implementation
+ * VBox Qt GUI - UIGDetailsSet class implementation.
  */
 
 /*
@@ -17,23 +15,30 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIGDetailsSet.h"
-#include "UIGDetailsModel.h"
-#include "UIGDetailsElements.h"
-#include "UIVMItem.h"
-#include "UIConverter.h"
-#include "UIVirtualBoxEventHandler.h"
-#include "VBoxGlobal.h"
+# include "UIGDetailsSet.h"
+# include "UIGDetailsModel.h"
+# include "UIGDetailsElements.h"
+# include "UIVMItem.h"
+# include "UIVirtualBoxEventHandler.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "CUSBController.h"
-#include "CUSBDeviceFilters.h"
+# include "CUSBController.h"
+# include "CUSBDeviceFilters.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGDetailsSet::UIGDetailsSet(UIGDetailsItem *pParent)
     : UIGDetailsItem(pParent)
-    , m_fElementNameHoverable(false)
+    , m_pMachineItem(0)
     , m_fHasDetails(false)
+    , m_configurationAccessLevel(ConfigurationAccessLevel_Null)
     , m_fFullSet(true)
     , m_pBuildStep(0)
     , m_iLastStepNumber(-1)
@@ -57,12 +62,12 @@ UIGDetailsSet::~UIGDetailsSet()
     parentItem()->removeItem(this);
 }
 
-void UIGDetailsSet::buildSet(UIVMItem *pMachineItem, bool fFullSet, const QStringList &settings)
+void UIGDetailsSet::buildSet(UIVMItem *pMachineItem, bool fFullSet, const QMap<DetailsElementType, bool> &settings)
 {
     /* Remember passed arguments: */
-    m_machine = pMachineItem->machine();
-    m_fElementNameHoverable = pMachineItem->reconfigurable();
-    m_fHasDetails = pMachineItem->hasDetails();
+    m_pMachineItem = pMachineItem;
+    m_machine = m_pMachineItem->machine();
+    m_fHasDetails = m_pMachineItem->hasDetails();
     m_fFullSet = fFullSet;
     m_settings = settings;
 
@@ -98,12 +103,7 @@ void UIGDetailsSet::buildSet(UIVMItem *pMachineItem, bool fFullSet, const QStrin
     /* Fetch USB controller restrictions: */
     const CUSBDeviceFilters &filters = m_machine.GetUSBDeviceFilters();
     if (filters.isNull() || !m_machine.GetUSBProxyAvailable())
-    {
-        QString strElementTypeOpened = gpConverter->toInternalString(DetailsElementType_USB);
-        QString strElementTypeClosed = strElementTypeOpened + "Closed";
-        m_settings.removeAll(strElementTypeOpened);
-        m_settings.removeAll(strElementTypeClosed);
-    }
+        m_settings.remove(DetailsElementType_USB);
 
     /* Start building set: */
     rebuildSet();
@@ -124,12 +124,10 @@ void UIGDetailsSet::sltBuildStep(QString strStepId, int iStepNumber)
     {
         /* Load details settings: */
         DetailsElementType elementType = (DetailsElementType)iStepNumber;
-        QString strElementTypeOpened = gpConverter->toInternalString(elementType);
-        QString strElementTypeClosed = strElementTypeOpened + "Closed";
         /* Should the element be visible? */
-        bool fVisible = m_settings.contains(strElementTypeOpened) || m_settings.contains(strElementTypeClosed);
+        bool fVisible = m_settings.contains(elementType);
         /* Should the element be opened? */
-        bool fOpen = m_settings.contains(strElementTypeOpened);
+        bool fOpen = fVisible && m_settings[elementType];
 
         /* Check if element is present already: */
         UIGDetailsElement *pElement = element(elementType);
@@ -345,6 +343,7 @@ void UIGDetailsSet::prepareConnections()
     connect(gVBoxEvents, SIGNAL(sigSnapshotTake(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
     connect(gVBoxEvents, SIGNAL(sigSnapshotDelete(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
     connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
+    connect(gVBoxEvents, SIGNAL(sigSnapshotRestore(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
 
     /* Meidum-enumeration connections: */
     connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationStarted()), this, SLOT(sltUpdateAppearance()));
@@ -385,6 +384,7 @@ int UIGDetailsSet::minimumWidthHint() const
 #endif /* VBOX_WITH_PARALLEL_PORTS */
             case DetailsElementType_USB:
             case DetailsElementType_SF:
+            case DetailsElementType_UI:
             case DetailsElementType_Description:
             {
                 iMinimumWidthHint = qMax(iMinimumWidthHint, pItem->minimumWidthHint());
@@ -444,6 +444,7 @@ int UIGDetailsSet::minimumHeightHint() const
 #endif /* VBOX_WITH_PARALLEL_PORTS */
             case DetailsElementType_USB:
             case DetailsElementType_SF:
+            case DetailsElementType_UI:
             case DetailsElementType_Description:
             {
                 iMinimumHeightHint += (pItem->minimumHeightHint() + iSpacing);
@@ -498,6 +499,7 @@ void UIGDetailsSet::updateLayout()
 #endif /* VBOX_WITH_PARALLEL_PORTS */
             case DetailsElementType_USB:
             case DetailsElementType_SF:
+            case DetailsElementType_UI:
             case DetailsElementType_Description:
             {
                 /* Move element: */
@@ -514,8 +516,6 @@ void UIGDetailsSet::updateLayout()
                 {
                     /* Resize element to required width: */
                     pElement->resize(iWidth, pElement->geometry().height());
-                    /* Update minimum-height-hint: */
-                    pElement->updateMinimumTextHeight();
                 }
                 /* Acquire required height: */
                 int iHeight = pElement->minimumHeightHint();
@@ -556,6 +556,9 @@ void UIGDetailsSet::rebuildSet()
     if (!m_fHasDetails)
         return;
 
+    /* Recache properties: */
+    m_configurationAccessLevel = m_pMachineItem->configurationAccessLevel();
+
     /* Cleanup build-step: */
     delete m_pBuildStep;
     m_pBuildStep = 0;
@@ -585,6 +588,7 @@ UIGDetailsElement* UIGDetailsSet::createElement(DetailsElementType elementType,
 #endif /* VBOX_WITH_PARALLEL_PORTS */
         case DetailsElementType_USB:         return new UIGDetailsElementUSB(this, fOpen);
         case DetailsElementType_SF:          return new UIGDetailsElementSF(this, fOpen);
+        case DetailsElementType_UI:          return new UIGDetailsElementUI(this, fOpen);
         case DetailsElementType_Description: return new UIGDetailsElementDescription(this, fOpen);
     }
     return 0;
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h
index ce63496..35e5562 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsSet.h
@@ -1,7 +1,6 @@
+/* $Id: UIGDetailsSet.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsSet class declaration
+ * VBox Qt GUI - UIGDetailsSet class declaration.
  */
 
 /*
@@ -21,7 +20,8 @@
 
 /* GUI includes: */
 #include "UIGDetailsItem.h"
-#include "UIDefs.h"
+#include "UIExtraDataDefs.h"
+#include "UISettingsDefs.h"
 
 /* COM includes: */
 #include "COMEnums.h"
@@ -30,6 +30,9 @@
 /* Forward declarations: */
 class UIVMItem;
 
+/* Using declarations: */
+using namespace UISettingsDefs;
+
 /* Details set
  * for graphics details model/view architecture: */
 class UIGDetailsSet : public UIGDetailsItem
@@ -47,13 +50,15 @@ public:
     ~UIGDetailsSet();
 
     /* API: Build stuff: */
-    void buildSet(UIVMItem *pMachineItem, bool fFullSet, const QStringList &settings);
+    void buildSet(UIVMItem *pMachineItem, bool fFullSet, const QMap<DetailsElementType, bool> &settings);
 
     /* API: Machine stuff: */
     const CMachine& machine() const { return m_machine; }
-    bool elementNameHoverable() const { return m_fElementNameHoverable; }
     bool hasDetails() const { return m_fHasDetails; }
 
+    /** Returns configuration access level. */
+    ConfigurationAccessLevel configurationAccessLevel() const { return m_configurationAccessLevel; }
+
 private slots:
 
     /* Handler: Build stuff: */
@@ -100,18 +105,23 @@ private:
     void rebuildSet();
     UIGDetailsElement* createElement(DetailsElementType elementType, bool fOpen);
 
+    /** Machine-item this set built for. */
+    UIVMItem *m_pMachineItem;
+
     /* Main variables: */
     CMachine m_machine;
     QMap<int, UIGDetailsItem*> m_elements;
-    bool m_fElementNameHoverable;
     bool m_fHasDetails;
 
+    /** Holds configuration access level. */
+    ConfigurationAccessLevel m_configurationAccessLevel;
+
     /* Prepare variables: */
     bool m_fFullSet;
     UIBuildStep *m_pBuildStep;
     int m_iLastStepNumber;
     QString m_strSetId;
-    QStringList m_settings;
+    QMap<DetailsElementType, bool> m_settings;
 };
 
 #endif /* __UIGDetailsSet_h__ */
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.cpp
index a7abec2..5716c32 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGDetailsView.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsView class implementation
+ * VBox Qt GUI - UIGDetailsView class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QScrollBar>
+# include <QApplication>
+# include <QScrollBar>
 
 /* GUI includes: */
-#include "UIGDetailsView.h"
+# include "UIGDetailsView.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGDetailsView::UIGDetailsView(QWidget *pParent)
     : QGraphicsView(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.h
index 56f0dc0..f0957b1 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.h
@@ -1,7 +1,6 @@
+/* $Id: UIGDetailsView.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGDetailsView class declaration
+ * VBox Qt GUI - UIGDetailsView class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
index 5ca88b2..fe7dbb2 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGMachinePreview.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGMachinePreview class implementation
+ * VBox Qt GUI - UIGMachinePreview class implementation.
  */
 
 /*
@@ -17,75 +15,89 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QGraphicsSceneContextMenuEvent>
-#include <QMenu>
-#include <QPainter>
-#include <QTimer>
+# include <QGraphicsSceneContextMenuEvent>
+# include <QMenu>
+# include <QPainter>
+# include <QTimer>
 
 /* GUI includes: */
-#include "UIGMachinePreview.h"
-#include "UIVirtualBoxEventHandler.h"
-#include "UIImageTools.h"
-#include "VBoxGlobal.h"
+# include "UIGMachinePreview.h"
+# include "UIVirtualBoxEventHandler.h"
+# include "UIExtraDataManager.h"
+# include "UIImageTools.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CDisplay.h"
+# include "CConsole.h"
+# include "CDisplay.h"
 
-UpdateIntervalMap CreateUpdateIntervalMap()
-{
-    UpdateIntervalMap map;
-    map[UpdateInterval_Disabled] = "disabled";
-    map[UpdateInterval_500ms]    = "500";
-    map[UpdateInterval_1000ms]   = "1000";
-    map[UpdateInterval_2000ms]   = "2000";
-    map[UpdateInterval_5000ms]   = "5000";
-    map[UpdateInterval_10000ms]  = "10000";
-    return map;
-}
-UpdateIntervalMap UIGMachinePreview::m_intervals = CreateUpdateIntervalMap();
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
 
 UIGMachinePreview::UIGMachinePreview(QIGraphicsWidget *pParent)
     : QIWithRetranslateUI4<QIGraphicsWidget>(pParent)
     , m_pUpdateTimer(new QTimer(this))
     , m_pUpdateTimerMenu(0)
     , m_iMargin(0)
-    , m_pbgEmptyImage(0)
-    , m_pbgFullImage(0)
+    , m_preset(AspectRatioPreset_16x9)
     , m_pPreviewImg(0)
 {
-    /* Setup contents: */
-    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-
     /* Create session instance: */
     m_session.createInstance(CLSID_Session);
 
-    /* Create bg images: */
-    m_pbgEmptyImage = new QPixmap(":/preview_empty_228x168px.png");
-    m_pbgFullImage = new QPixmap(":/preview_full_228x168px.png");
+    /* Cache aspect-ratio preset settings: */
+    const QIcon empty16x10 = UIIconPool::iconSet(":/preview_empty_16to10_242x167px.png");
+    const QIcon empty16x9 = UIIconPool::iconSet(":/preview_empty_16to9_242x155px.png");
+    const QIcon empty4x3 = UIIconPool::iconSet(":/preview_empty_4to3_242x192px.png");
+    const QIcon full16x10 = UIIconPool::iconSet(":/preview_full_16to10_242x167px.png");
+    const QIcon full16x9 = UIIconPool::iconSet(":/preview_full_16to9_242x155px.png");
+    const QIcon full4x3 = UIIconPool::iconSet(":/preview_full_4to3_242x192px.png");
+    m_sizes.insert(AspectRatioPreset_16x10, empty16x10.availableSizes().first());
+    m_sizes.insert(AspectRatioPreset_16x9, empty16x9.availableSizes().first());
+    m_sizes.insert(AspectRatioPreset_4x3, empty4x3.availableSizes().first());
+    m_ratios.insert(AspectRatioPreset_16x10, (double)16/10);
+    m_ratios.insert(AspectRatioPreset_16x9, (double)16/9);
+    m_ratios.insert(AspectRatioPreset_4x3, (double)4/3);
+    m_emptyPixmaps.insert(AspectRatioPreset_16x10, new QPixmap(empty16x10.pixmap(m_sizes.value(AspectRatioPreset_16x10))));
+    m_emptyPixmaps.insert(AspectRatioPreset_16x9, new QPixmap(empty16x9.pixmap(m_sizes.value(AspectRatioPreset_16x9))));
+    m_emptyPixmaps.insert(AspectRatioPreset_4x3, new QPixmap(empty4x3.pixmap(m_sizes.value(AspectRatioPreset_4x3))));
+    m_fullPixmaps.insert(AspectRatioPreset_16x10, new QPixmap(full16x10.pixmap(m_sizes.value(AspectRatioPreset_16x10))));
+    m_fullPixmaps.insert(AspectRatioPreset_16x9, new QPixmap(full16x9.pixmap(m_sizes.value(AspectRatioPreset_16x9))));
+    m_fullPixmaps.insert(AspectRatioPreset_4x3, new QPixmap(full4x3.pixmap(m_sizes.value(AspectRatioPreset_4x3))));
+
+    /* Setup contents (depends on presets above!): */
+    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
 
     /* Create the context menu: */
     m_pUpdateTimerMenu = new QMenu;
     QActionGroup *pUpdateTimeG = new QActionGroup(this);
     pUpdateTimeG->setExclusive(true);
-    for(int i = 0; i < UpdateInterval_Max; ++i)
+    for(int i = 0; i < PreviewUpdateIntervalType_Max; ++i)
     {
         QAction *pUpdateTime = new QAction(pUpdateTimeG);
         pUpdateTime->setData(i);
         pUpdateTime->setCheckable(true);
         pUpdateTimeG->addAction(pUpdateTime);
         m_pUpdateTimerMenu->addAction(pUpdateTime);
-        m_actions[static_cast<UpdateInterval>(i)] = pUpdateTime;
+        m_actions[static_cast<PreviewUpdateIntervalType>(i)] = pUpdateTime;
     }
-    m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(UpdateInterval_500ms)]);
+    m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<PreviewUpdateIntervalType>(PreviewUpdateIntervalType_500ms)]);
 
-    /* Load preview update interval: */
-    QString strInterval = vboxGlobal().virtualBox().GetExtraData(GUI_PreviewUpdate);
-    /* Parse loaded value: */
-    UpdateInterval interval = m_intervals.key(strInterval, UpdateInterval_1000ms);
     /* Initialize with the new update interval: */
-    setUpdateInterval(interval, false);
+    setUpdateInterval(gEDataManager->selectorWindowPreviewUpdateInterval(), false);
 
     /* Setup connections: */
     connect(m_pUpdateTimer, SIGNAL(timeout()), this, SLOT(sltRecreatePreview()));
@@ -101,10 +113,24 @@ UIGMachinePreview::~UIGMachinePreview()
     /* Close any open session: */
     if (m_session.GetState() == KSessionState_Locked)
         m_session.UnlockMachine();
-    delete m_pbgEmptyImage;
-    delete m_pbgFullImage;
+
+    /* Destroy background images: */
+    foreach (const AspectRatioPreset &preset, m_emptyPixmaps.keys())
+    {
+        delete m_emptyPixmaps.value(preset);
+        m_emptyPixmaps.remove(preset);
+    }
+    foreach (const AspectRatioPreset &preset, m_fullPixmaps.keys())
+    {
+        delete m_fullPixmaps.value(preset);
+        m_fullPixmaps.remove(preset);
+    }
+
+    /* Destroy preview image: */
     if (m_pPreviewImg)
         delete m_pPreviewImg;
+
+    /* Destroy update timer: */
     if (m_pUpdateTimerMenu)
         delete m_pUpdateTimerMenu;
 }
@@ -144,99 +170,152 @@ void UIGMachinePreview::sltMachineStateChange(QString strId)
 
 void UIGMachinePreview::sltRecreatePreview()
 {
-    /* Only do this if we are visible: */
+    /* Skip invisible preview: */
     if (!isVisible())
         return;
 
-    /* Cleanup preview first: */
+    /* Cleanup previous image: */
     if (m_pPreviewImg)
     {
         delete m_pPreviewImg;
         m_pPreviewImg = 0;
     }
 
-    /* Fetch the latest machine-state: */
-    KMachineState machineState = m_machine.isNull() ? KMachineState_Null : m_machine.GetState();
+    /* Fetch actual machine-state: */
+    const KMachineState machineState = m_machine.isNull() ? KMachineState_Null : m_machine.GetState();
 
     /* We are creating preview only for assigned and accessible VMs: */
     if (!m_machine.isNull() && machineState != KMachineState_Null &&
         m_vRect.width() > 0 && m_vRect.height() > 0)
     {
-        QImage image(size().toSize(), QImage::Format_ARGB32);
-        image.fill(Qt::transparent);
-        QPainter painter(&image);
-        bool fDone = false;
+        /* Prepare image: */
+        QImage image;
+
+        /* Use 10x9 as the aspect-ratio preset by default: */
+        AspectRatioPreset preset = AspectRatioPreset_16x9;
 
-        /* Preview enabled? */
+        /* Preview update enabled? */
         if (m_pUpdateTimer->interval() > 0)
         {
-            /* Use the image which may be included in the save state. */
-            if (machineState == KMachineState_Saved || machineState == KMachineState_Restoring)
+            /* Depending on machine state: */
+            switch (machineState)
             {
-                ULONG width = 0, height = 0;
-                QVector<BYTE> screenData = m_machine.ReadSavedScreenshotPNGToArray(0, width, height);
-                if (screenData.size() != 0)
+                /* If machine is in SAVED/RESTORING state: */
+                case KMachineState_Saved:
+                case KMachineState_Restoring:
                 {
-                    QImage shot = QImage::fromData(screenData.data(), screenData.size(), "PNG")
-                                  .scaled(m_vRect.size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-                    dimImage(shot);
-                    painter.drawImage(m_vRect.x(), m_vRect.y(), shot);
-                    fDone = true;
+                    /* Use the screenshot from saved-state if possible: */
+                    ULONG uGuestWidth = 0, uGuestHeight = 0;
+                    QVector<BYTE> screenData = m_machine.ReadSavedScreenshotToArray(0, KBitmapFormat_PNG, uGuestWidth, uGuestHeight);
+
+                    /* Make sure screen-data is OK: */
+                    if (!m_machine.isOk() || screenData.isEmpty())
+                        break;
+
+                    /* Calculate aspect-ratio: */
+                    double dAspectRatio = (double)uGuestWidth / uGuestHeight;
+                    /* Look for the best aspect-ratio preset: */
+                    preset = bestAspectRatioPreset(dAspectRatio, m_ratios);
+
+                    /* Create image based on shallow copy or screenshot data,
+                     * scale image down if necessary to the size possible to reflect: */
+                    image = QImage::fromData(screenData.data(), screenData.size(), "PNG")
+                            .scaled(imageAspectRatioSize(m_vRect.size(), QSize(uGuestWidth, uGuestHeight)),
+                                    Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+                    /* And detach that copy to make it deep: */
+                    image.detach();
+                    /* Dim image to give it required look: */
+                    dimImage(image);
+                    break;
                 }
-            }
-            /* Use the current VM output. */
-            else if (machineState == KMachineState_Running || machineState == KMachineState_Paused)
-            {
-                if (m_session.GetState() == KSessionState_Locked)
+                /* If machine is in RUNNING/PAUSED state: */
+                case KMachineState_Running:
+                case KMachineState_Paused:
                 {
-                    CVirtualBox vbox = vboxGlobal().virtualBox();
-                    if (vbox.isOk())
+                    /* Make sure session state is Locked: */
+                    if (m_session.GetState() != KSessionState_Locked)
+                        break;
+
+                    /* Make sure console is OK: */
+                    CConsole console = m_session.GetConsole();
+                    if (!m_session.isOk() || console.isNull())
+                        break;
+                    /* Make sure display is OK: */
+                    CDisplay display = console.GetDisplay();
+                    if (!console.isOk() || display.isNull())
+                        break;
+
+                    /* Calculate aspect-ratio: */
+                    LONG iOriginX, iOriginY;
+                    ULONG uGuestWidth, uGuestHeight, uBpp;
+                    KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
+                    display.GetScreenResolution(0, uGuestWidth, uGuestHeight, uBpp, iOriginX, iOriginY, monitorStatus);
+                    if (uGuestWidth == 0 || uGuestHeight == 0)
+                    {
+                        AssertMsgFailed(("Acquired guest screen resolution is %dx%d\n",
+                                         uGuestWidth, uGuestHeight));
+                        break;
+                    }
+
+                    double dAspectRatio = (double)uGuestWidth / uGuestHeight;
+                    /* Look for the best aspect-ratio preset preset: */
+                    preset = bestAspectRatioPreset(dAspectRatio, m_ratios);
+
+                    /* Calculate size corresponding to aspect-ratio: */
+                    const QSize size = imageAspectRatioSize(m_vRect.size(), QSize(uGuestWidth, uGuestHeight));
+
+                    /* Use direct VM content: */
+                    QVector<BYTE> screenData = display.TakeScreenShotToArray(0, size.width(), size.height(), KBitmapFormat_BGR0);
+
+                    /* Make sure screen-data is OK: */
+                    if (!display.isOk() || screenData.isEmpty())
+                        break;
+
+                    /* Make sure screen-data size is valid: */
+                    const int iExpectedSize = size.width() * size.height() * 4;
+                    const int iActualSize = screenData.size();
+                    if (iActualSize != iExpectedSize)
                     {
-                        const CConsole& console = m_session.GetConsole();
-                        if (!console.isNull())
-                        {
-                            CDisplay display = console.GetDisplay();
-                            /* Todo: correct aspect radio */
-//                            ULONG w, h, bpp;
-//                            LONG xOrigin, yOrigin;
-//                            display.GetScreenResolution(0, w, h, bpp, xOrigin, yOrigin);
-//                            QImage shot = QImage(w, h, QImage::Format_RGB32);
-//                            shot.fill(Qt::black);
-//                            display.TakeScreenShot(0, shot.bits(), shot.width(), shot.height());
-                            QVector<BYTE> screenData = display.TakeScreenShotToArray(0, m_vRect.width(), m_vRect.height());
-                            if (display.isOk() && screenData.size() != 0)
-                            {
-                                /* Unfortunately we have to reorder the pixel
-                                 * data, cause the VBox API returns RGBA data,
-                                 * which is not a format QImage understand.
-                                 * Todo: check for 32bit alignment, for both
-                                 * the data and the scanlines. Maybe we need to
-                                 * copy the data in any case. */
-                                uint32_t *d = (uint32_t*)screenData.data();
-                                for (int i = 0; i < screenData.size() / 4; ++i)
-                                {
-                                    uint32_t e = d[i];
-                                    d[i] = RT_MAKE_U32_FROM_U8(RT_BYTE3(e), RT_BYTE2(e), RT_BYTE1(e), RT_BYTE4(e));
-                                }
-
-                                QImage shot = QImage((uchar*)d, m_vRect.width(), m_vRect.height(), QImage::Format_RGB32);
-
-                                if (machineState == KMachineState_Paused)
-                                    dimImage(shot);
-                                painter.drawImage(m_vRect.x(), m_vRect.y(), shot);
-                                fDone = true;
-                            }
-                        }
+                        AssertMsgFailed(("Invalid screen-data size '%d', should be '%d'!\n", iActualSize, iExpectedSize));
+                        break;
                     }
+
+                    /* Create image based on shallow copy of acquired data: */
+                    QImage tempImage(screenData.data(), size.width(), size.height(), QImage::Format_RGB32);
+                    image = tempImage;
+                    /* And detach that copy to make it deep: */
+                    image.detach();
+                    /* Dim image to give it required look for PAUSED state: */
+                    if (machineState == KMachineState_Paused)
+                        dimImage(image);
+                    break;
                 }
+                default:
+                    break;
             }
         }
 
-        if (fDone)
+        /* If image initialized: */
+        if (!image.isNull())
+        {
+            /* Shallow copy that image: */
             m_pPreviewImg = new QImage(image);
+            /* And detach that copy to make it deep: */
+            m_pPreviewImg->detach();
+        }
+
+        /* If preset changed: */
+        if (m_preset != preset)
+        {
+            /* Save new preset: */
+            m_preset = preset;
+            /* And update geometry: */
+            updateGeometry();
+            emit sigSizeHintChanged();
+        }
     }
 
-    /* Redraw preview in any case! */
+    /* Redraw preview in any case: */
     update();
 }
 
@@ -264,7 +343,7 @@ void UIGMachinePreview::contextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent)
     QAction *pReturn = m_pUpdateTimerMenu->exec(pEvent->screenPos(), 0);
     if (pReturn)
     {
-        UpdateInterval interval = static_cast<UpdateInterval>(pReturn->data().toInt());
+        PreviewUpdateIntervalType interval = static_cast<PreviewUpdateIntervalType>(pReturn->data().toInt());
         setUpdateInterval(interval, true);
         restart();
     }
@@ -272,19 +351,28 @@ void UIGMachinePreview::contextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent)
 
 void UIGMachinePreview::retranslateUi()
 {
-    m_actions.value(UpdateInterval_Disabled)->setText(tr("Update disabled"));
-    m_actions.value(UpdateInterval_500ms)->setText(tr("Every 0.5 s"));
-    m_actions.value(UpdateInterval_1000ms)->setText(tr("Every 1 s"));
-    m_actions.value(UpdateInterval_2000ms)->setText(tr("Every 2 s"));
-    m_actions.value(UpdateInterval_5000ms)->setText(tr("Every 5 s"));
-    m_actions.value(UpdateInterval_10000ms)->setText(tr("Every 10 s"));
+    m_actions.value(PreviewUpdateIntervalType_Disabled)->setText(tr("Update disabled"));
+    m_actions.value(PreviewUpdateIntervalType_500ms)->setText(tr("Every 0.5 s"));
+    m_actions.value(PreviewUpdateIntervalType_1000ms)->setText(tr("Every 1 s"));
+    m_actions.value(PreviewUpdateIntervalType_2000ms)->setText(tr("Every 2 s"));
+    m_actions.value(PreviewUpdateIntervalType_5000ms)->setText(tr("Every 5 s"));
+    m_actions.value(PreviewUpdateIntervalType_10000ms)->setText(tr("Every 10 s"));
 }
 
 QSizeF UIGMachinePreview::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const
 {
     if (which == Qt::MinimumSize)
-        return QSize(228 /* pixmap width */ + 2 * m_iMargin,
-                     168 /* pixmap height */ + 2 * m_iMargin);
+    {
+        AssertReturn(m_emptyPixmaps.contains(m_preset),
+                     QIGraphicsWidget::sizeHint(which, constraint));
+        QSize size = m_sizes.value(m_preset);
+        if (m_iMargin != 0)
+        {
+            size.setWidth(size.width() - 2 * m_iMargin);
+            size.setHeight(size.height() - 2 * m_iMargin);
+        }
+        return size;
+    }
     return QIGraphicsWidget::sizeHint(which, constraint);
 }
 
@@ -298,16 +386,19 @@ void UIGMachinePreview::paint(QPainter *pPainter, const QStyleOptionGraphicsItem
     /* If there is a preview image available: */
     if (m_pPreviewImg)
     {
-        /* Draw empty background: */
-        pPainter->drawPixmap(cr.x() + m_iMargin, cr.y() + m_iMargin, *m_pbgEmptyImage);
-
-        /* Draw that image: */
-        pPainter->drawImage(0, 0, *m_pPreviewImg);
+        /* Draw empty monitor frame: */
+        pPainter->drawPixmap(cr.x() + m_iMargin, cr.y() + m_iMargin, *m_emptyPixmaps.value(m_preset));
+
+        /* Move image to viewport center: */
+        QRect imageRect(QPoint(0, 0), m_pPreviewImg->size());
+        imageRect.moveCenter(m_vRect.center());
+        /* Draw preview image: */
+        pPainter->drawImage(imageRect.topLeft(), *m_pPreviewImg);
     }
     else
     {
-        /* Draw full background: */
-        pPainter->drawPixmap(cr.x() + m_iMargin, cr.y() + m_iMargin, *m_pbgFullImage);
+        /* Draw full monitor frame: */
+        pPainter->drawPixmap(cr.x() + m_iMargin, cr.y() + m_iMargin, *m_fullPixmaps.value(m_preset));
 
         /* Paint preview name: */
         QFont font = pPainter->font();
@@ -331,58 +422,40 @@ void UIGMachinePreview::paint(QPainter *pPainter, const QStyleOptionGraphicsItem
     }
 }
 
-void UIGMachinePreview::setUpdateInterval(UpdateInterval interval, bool fSave)
+void UIGMachinePreview::setUpdateInterval(PreviewUpdateIntervalType interval, bool fSave)
 {
     switch (interval)
     {
-        case UpdateInterval_Disabled:
+        case PreviewUpdateIntervalType_Disabled:
         {
-            m_pUpdateTimer->setInterval(0);
+            /* Stop the timer: */
             m_pUpdateTimer->stop();
-            m_actions[interval]->setChecked(true);
-            break;
-        }
-        case UpdateInterval_500ms:
-        {
-            m_pUpdateTimer->setInterval(500);
-            m_actions[interval]->setChecked(true);
-            break;
+            /* And continue with other cases: */
         }
-        case UpdateInterval_1000ms:
+        case PreviewUpdateIntervalType_500ms:
+        case PreviewUpdateIntervalType_1000ms:
+        case PreviewUpdateIntervalType_2000ms:
+        case PreviewUpdateIntervalType_5000ms:
+        case PreviewUpdateIntervalType_10000ms:
         {
-            m_pUpdateTimer->setInterval(1000);
+            /* Set the timer interval: */
+            m_pUpdateTimer->setInterval(gpConverter->toInternalInteger(interval));
+            /* Check corresponding action: */
             m_actions[interval]->setChecked(true);
             break;
         }
-        case UpdateInterval_2000ms:
-        {
-            m_pUpdateTimer->setInterval(2000);
-            m_actions[interval]->setChecked(true);
+        case PreviewUpdateIntervalType_Max:
             break;
-        }
-        case UpdateInterval_5000ms:
-        {
-            m_pUpdateTimer->setInterval(5000);
-            m_actions[interval]->setChecked(true);
-            break;
-        }
-        case UpdateInterval_10000ms:
-        {
-            m_pUpdateTimer->setInterval(10000);
-            m_actions[interval]->setChecked(true);
-            break;
-        }
-        case UpdateInterval_Max: break;
     }
-    if (fSave && m_intervals.contains(interval))
-        vboxGlobal().virtualBox().SetExtraData(GUI_PreviewUpdate, m_intervals[interval]);
+    if (fSave)
+        gEDataManager->setSelectorWindowPreviewUpdateInterval(interval);
 }
 
 void UIGMachinePreview::recalculatePreviewRectangle()
 {
     /* Contents rectangle: */
     QRect cr = contentsRect().toRect();
-    m_vRect = cr.adjusted(21 + m_iMargin, 17 + m_iMargin, -21 - m_iMargin, -20 - m_iMargin);
+    m_vRect = cr.adjusted(21 + m_iMargin, 21 + m_iMargin, -21 - m_iMargin, -21 - m_iMargin);
 }
 
 void UIGMachinePreview::restart()
@@ -417,3 +490,66 @@ void UIGMachinePreview::stop()
     m_pUpdateTimer->stop();
 }
 
+/* static */
+UIGMachinePreview::AspectRatioPreset UIGMachinePreview::bestAspectRatioPreset(const double dAspectRatio,
+                                                                              const QMap<AspectRatioPreset, double> &ratios)
+{
+    /* Use 16x9 preset as the 'best' by 'default': */
+    AspectRatioPreset bestPreset = AspectRatioPreset_16x9;
+    /* Calculate minimum diff based on 'default' preset: */
+    double dMinimumDiff = qAbs(dAspectRatio - ratios.value(bestPreset));
+    /* Now look for the 'best' aspect-ratio preset among existing: */
+    for (AspectRatioPreset currentPreset = AspectRatioPreset_16x10;
+         currentPreset <= AspectRatioPreset_4x3;
+         currentPreset = (AspectRatioPreset)(currentPreset + 1))
+    {
+        /* Calculate current diff based on 'current' preset: */
+        const double dDiff = qAbs(dAspectRatio - ratios.value(currentPreset));
+        /* If new 'best' preset found: */
+        if (dDiff < dMinimumDiff)
+        {
+            /* Remember new diff: */
+            dMinimumDiff = dDiff;
+            /* And new preset: */
+            bestPreset = currentPreset;
+        }
+    }
+    /* Return 'best' preset: */
+    return bestPreset;
+}
+
+/* static */
+QSize UIGMachinePreview::imageAspectRatioSize(const QSize &hostSize, const QSize &guestSize)
+{
+    /* Make sure host-size and guest-size are valid: */
+    AssertReturn(!hostSize.isNull(), QSize());
+    AssertReturn(!guestSize.isNull(), hostSize);
+
+    /* Calculate host/guest aspect-ratio: */
+    const double dHostAspectRatio = (double)hostSize.width() / hostSize.height();
+    const double dGuestAspectRatio = (double)guestSize.width() / guestSize.height();
+    int iWidth = 0, iHeight = 0;
+    /* Guest-screen more thin by vertical than host-screen: */
+    if (dGuestAspectRatio >= dHostAspectRatio)
+    {
+        /* Get host width: */
+        iWidth = hostSize.width();
+        /* And calculate height based on guest aspect ratio: */
+        iHeight = (double)iWidth / dGuestAspectRatio;
+        /* But no more than host height: */
+        iHeight = qMin(iHeight, hostSize.height());
+    }
+    /* Host-screen more thin by vertical than guest-screen: */
+    else
+    {
+        /* Get host height: */
+        iHeight = hostSize.height();
+        /* And calculate width based on guest aspect ratio: */
+        iWidth = (double)iHeight * dGuestAspectRatio;
+        /* But no more than host width: */
+        iWidth = qMin(iWidth, hostSize.width());
+    }
+    /* Return actual size: */
+    return QSize(iWidth, iHeight);
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h
index 138e234..ee66346 100644
--- a/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h
+++ b/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGMachinePreview.h
@@ -1,7 +1,6 @@
+/* $Id: UIGMachinePreview.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGMachinePreview class declaration
+ * VBox Qt GUI - UIGMachinePreview class declaration.
  */
 
 /*
@@ -23,8 +22,9 @@
 #include <QHash>
 
 /* GUI includes: */
-#include "UIGDetailsItem.h"
 #include "QIWithRetranslateUI.h"
+#include "UIGDetailsItem.h"
+#include "UIExtraDataDefs.h"
 
 /* COM includes: */
 #include "COMEnums.h"
@@ -38,24 +38,16 @@ class QPixmap;
 class QMenu;
 class QTimer;
 
-/* Update interval type: */
-enum UpdateInterval
-{
-    UpdateInterval_Disabled,
-    UpdateInterval_500ms,
-    UpdateInterval_1000ms,
-    UpdateInterval_2000ms,
-    UpdateInterval_5000ms,
-    UpdateInterval_10000ms,
-    UpdateInterval_Max
-};
-typedef QMap<UpdateInterval, QString> UpdateIntervalMap;
-
 /* Preview window class: */
 class UIGMachinePreview : public QIWithRetranslateUI4<QIGraphicsWidget>
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies about size-hint changes. */
+    void sigSizeHintChanged();
+
 public:
 
     /* Graphics-item type: */
@@ -80,6 +72,14 @@ private slots:
 
 private:
 
+    /** Aspect ratio presets. */
+    enum AspectRatioPreset
+    {
+        AspectRatioPreset_16x10,
+        AspectRatioPreset_16x9,
+        AspectRatioPreset_4x3,
+    };
+
     /* Helpers: Event handlers: */
     void resizeEvent(QGraphicsSceneResizeEvent *pEvent);
     void showEvent(QShowEvent *pEvent);
@@ -96,24 +96,31 @@ private:
     void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget = 0);
 
     /* Helpers: Update stuff: */
-    void setUpdateInterval(UpdateInterval interval, bool fSave);
+    void setUpdateInterval(PreviewUpdateIntervalType interval, bool fSave);
     void recalculatePreviewRectangle();
     void restart();
     void stop();
 
+    /** Looks for the best aspect-ratio preset for the passed @a dAspectRatio among all the passed @a ratios. */
+    static AspectRatioPreset bestAspectRatioPreset(const double dAspectRatio, const QMap<AspectRatioPreset, double> &ratios);
+    /** Calculates image size suitable to passed @a hostSize and @a guestSize. */
+    static QSize imageAspectRatioSize(const QSize &hostSize, const QSize &guestSize);
+
     /* Variables: */
     CSession m_session;
     CMachine m_machine;
     QTimer *m_pUpdateTimer;
     QMenu *m_pUpdateTimerMenu;
-    QHash<UpdateInterval, QAction*> m_actions;
+    QHash<PreviewUpdateIntervalType, QAction*> m_actions;
     const int m_iMargin;
     QRect m_vRect;
-    QPixmap *m_pbgEmptyImage;
-    QPixmap *m_pbgFullImage;
+    AspectRatioPreset m_preset;
+    QMap<AspectRatioPreset, QSize> m_sizes;
+    QMap<AspectRatioPreset, double> m_ratios;
+    QMap<AspectRatioPreset, QPixmap*> m_emptyPixmaps;
+    QMap<AspectRatioPreset, QPixmap*> m_fullPixmaps;
     QImage *m_pPreviewImg;
     QString m_strPreviewName;
-    static UpdateIntervalMap m_intervals;
 };
 
 #endif /* !__UIGMachinePreview_h__ */
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.cpp b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.cpp
index be10c16..b55a625 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.cpp
@@ -1,12 +1,10 @@
 /* $Id: UISettingsDefs.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UISettingsDefs implementation
+ * VBox Qt GUI - UISettingsDefs implementation
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,34 +15,33 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* VBox includes: */
-#include "UISettingsDefs.h"
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* GUI includes: */
+# include "UISettingsDefs.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Using declarations: */
 using namespace UISettingsDefs;
 
-/* Machine state => Settings dialog type converter: */
-SettingsDialogType UISettingsDefs::determineSettingsDialogType(KSessionState sessionState, KMachineState machineState)
+ConfigurationAccessLevel UISettingsDefs::configurationAccessLevel(KSessionState sessionState, KMachineState machineState)
 {
-    SettingsDialogType result = SettingsDialogType_Wrong;
+    /* Depending on passed arguments: */
     switch (machineState)
     {
         case KMachineState_PoweredOff:
         case KMachineState_Teleported:
-        case KMachineState_Aborted:
-            result = sessionState == KSessionState_Unlocked ? SettingsDialogType_Offline :
-                                                              SettingsDialogType_Online;
-            break;
-        case KMachineState_Saved:
-            result = SettingsDialogType_Saved;
-            break;
+        case KMachineState_Aborted:    return sessionState == KSessionState_Unlocked ? ConfigurationAccessLevel_Full : ConfigurationAccessLevel_Null;
+        case KMachineState_Saved:      return ConfigurationAccessLevel_Saved;
         case KMachineState_Running:
-        case KMachineState_Paused:
-            result = SettingsDialogType_Online;
-            break;
-        default:
-            break;
+        case KMachineState_Paused:     return ConfigurationAccessLevel_Runtime;
+        default: break;
     }
-    return result;
+    /* Null by default: */
+    return ConfigurationAccessLevel_Null;
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.h b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.h
index 78ce195..cf6027d 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDefs.h
@@ -1,11 +1,10 @@
+/* $Id: UISettingsDefs.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * Header with definitions and functions related to settings window
+ * VBox Qt GUI - Header with definitions and functions related to settings configuration.
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,8 +15,8 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UISettingsDefs_h__
-#define __UISettingsDefs_h__
+#ifndef ___UISettingsDefs_h___
+#define ___UISettingsDefs_h___
 
 /* Qt includes: */
 #include <QPair>
@@ -26,20 +25,20 @@
 /* COM includes: */
 #include "COMEnums.h"
 
-/* Settings dialog namespace: */
+/** Settings configuration namespace: */
 namespace UISettingsDefs
 {
-    /* Settings dialog types: */
-    enum SettingsDialogType
+    /** Configuration access levels: */
+    enum ConfigurationAccessLevel
     {
-        SettingsDialogType_Wrong,
-        SettingsDialogType_Offline,
-        SettingsDialogType_Saved,
-        SettingsDialogType_Online
+        ConfigurationAccessLevel_Null,
+        ConfigurationAccessLevel_Saved,
+        ConfigurationAccessLevel_Runtime,
+        ConfigurationAccessLevel_Full
     };
 
-    /* Machine state => Settings dialog type converter: */
-    SettingsDialogType determineSettingsDialogType(KSessionState sessionState, KMachineState machineState);
+    /** Determines configuration access level for passed @a sessionState and @a machineState. */
+    ConfigurationAccessLevel configurationAccessLevel(KSessionState sessionState, KMachineState machineState);
 }
 
 /* Template to operate settings cache item: */
@@ -163,5 +162,4 @@ private:
     UISettingsCacheChildMap m_children;
 };
 
-#endif /* __UISettingsDefs_h__ */
-
+#endif /* !___UISettingsDefs_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
index 69ad3f1..988ef3b 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
@@ -1,8 +1,6 @@
 /* $Id: UISettingsDialog.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UISettingsDialog class implementation
+ * VBox Qt GUI - UISettingsDialog class implementation.
  */
 
 /*
@@ -17,31 +15,42 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes */
-#include <QProgressBar>
-#include <QPushButton>
-#include <QStackedWidget>
-#include <QTimer>
-#include <QCloseEvent>
+# include <QProgressBar>
+# include <QPushButton>
+# include <QStackedWidget>
+# include <QTimer>
+# include <QCloseEvent>
 
 /* Local includes */
-#include "UISettingsDialog.h"
-#include "UIWarningPane.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIPopupCenter.h"
-#include "QIWidgetValidator.h"
-#include "VBoxSettingsSelector.h"
-#include "UISettingsPage.h"
-#include "UIToolBar.h"
-#include "UIIconPool.h"
-#include "UIConverter.h"
+# include "UISettingsDialog.h"
+# include "UIWarningPane.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIPopupCenter.h"
+# include "QIWidgetValidator.h"
+# include "VBoxSettingsSelector.h"
+# include "UIModalWindowManager.h"
+# include "UISettingsSerializer.h"
+# include "UISettingsPage.h"
+# include "UIToolBar.h"
+# include "UIIconPool.h"
+# include "UIConverter.h"
+# ifdef Q_WS_MAC
+#  include "VBoxUtils.h"
+# endif
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #ifdef Q_WS_MAC
-# include "VBoxUtils.h"
 # if MAC_LEOPARD_STYLE
 #  define VBOX_GUI_WITH_TOOLBAR_SETTINGS
-# endif /* MAC_LEOPARD_STYLE */
-#endif /* Q_WS_MAC */
+# endif
+#endif
 
 /* Settings Dialog Constructor: */
 UISettingsDialog::UISettingsDialog(QWidget *pParent)
@@ -51,11 +60,11 @@ UISettingsDialog::UISettingsDialog(QWidget *pParent)
     , m_pSelector(0)
     , m_pStack(0)
     /* Common variables: */
-    , m_dialogType(SettingsDialogType_Wrong)
+    , m_configurationAccessLevel(ConfigurationAccessLevel_Null)
     , m_fPolished(false)
-    /* Loading/saving stuff: */
-    , m_fLoaded(false)
-    , m_fSaved(false)
+    /* Serialization stuff: */
+    , m_pSerializeProcess(0)
+    , m_fSerializationIsInProgress(false)
     /* Status-bar stuff: */
     , m_pStatusBar(0)
     /* Process-bar stuff: */
@@ -84,7 +93,7 @@ UISettingsDialog::UISettingsDialog(QWidget *pParent)
     m_pLbTitle->hide();
     /* Create modern tool-bar selector: */
     m_pSelector = new VBoxSettingsToolBarSelector(this);
-    static_cast<UIToolBar*>(m_pSelector->widget())->setMacToolbar();
+    static_cast<UIToolBar*>(m_pSelector->widget())->enableMacToolbar();
     addToolBar(qobject_cast<QToolBar*>(m_pSelector->widget()));
     /* No title in this mode, we change the title of the window: */
     pMainLayout->setColumnMinimumWidth(0, 0);
@@ -111,6 +120,8 @@ UISettingsDialog::UISettingsDialog(QWidget *pParent)
 
     /* Prepare process-bar: */
     m_pProcessBar = new QProgressBar;
+    m_pProcessBar->setMaximum(100);
+    m_pProcessBar->setMinimum(0);
 
     /* Prepare warning-pane: */
     m_pWarningPane = new UIWarningPane;
@@ -139,8 +150,16 @@ UISettingsDialog::UISettingsDialog(QWidget *pParent)
 
 UISettingsDialog::~UISettingsDialog()
 {
+    /* Delete serializer if exists: */
+    if (serializeProcess())
+    {
+        delete m_pSerializeProcess;
+        m_pSerializeProcess = 0;
+    }
+
     /* Recall popup-pane if any: */
     popupCenter().recall(m_pStack, "SettingsDialogWarning");
+
     /* Delete selector early! */
     delete m_pSelector;
 }
@@ -148,14 +167,19 @@ UISettingsDialog::~UISettingsDialog()
 void UISettingsDialog::execute()
 {
     /* Load data: */
-    loadData();
+    loadOwnData();
 
-    /* Execute dialog and wait for completion: */
-    if (exec() != QDialog::Accepted)
-        return;
+    /* Execute dialog: */
+    exec();
+}
 
+void UISettingsDialog::accept()
+{
     /* Save data: */
-    saveData();
+    saveOwnData();
+
+    /* Call to base-class: */
+    QIWithRetranslateUI<QIMainDialog>::accept();
 }
 
 void UISettingsDialog::sltCategoryChanged(int cId)
@@ -187,12 +211,28 @@ void UISettingsDialog::sltCategoryChanged(int cId)
 
 void UISettingsDialog::sltMarkLoaded()
 {
-    m_fLoaded = true;
+    /* Delete serializer if exists: */
+    if (serializeProcess())
+    {
+        delete m_pSerializeProcess;
+        m_pSerializeProcess = 0;
+    }
+
+    /* Mark serialization finished: */
+    m_fSerializationIsInProgress = false;
 }
 
 void UISettingsDialog::sltMarkSaved()
 {
-    m_fSaved = true;
+    /* Delete serializer if exists: */
+    if (serializeProcess())
+    {
+        delete m_pSerializeProcess;
+        m_pSerializeProcess = 0;
+    }
+
+    /* Mark serialization finished: */
+    m_fSerializationIsInProgress = false;
 }
 
 void UISettingsDialog::sltHandleProcessStarted()
@@ -201,9 +241,9 @@ void UISettingsDialog::sltHandleProcessStarted()
     m_pStatusBar->setCurrentWidget(m_pProcessBar);
 }
 
-void UISettingsDialog::sltHandlePageProcessed()
+void UISettingsDialog::sltHandleProcessProgressChange(int iValue)
 {
-    m_pProcessBar->setValue(m_pProcessBar->value() + 1);
+    m_pProcessBar->setValue(iValue);
     if (m_pProcessBar->value() == m_pProcessBar->maximum())
     {
         if (!m_fValid || !m_fSilent)
@@ -213,14 +253,61 @@ void UISettingsDialog::sltHandlePageProcessed()
     }
 }
 
-void UISettingsDialog::loadData()
+void UISettingsDialog::loadData(QVariant &data)
 {
-    m_fLoaded = false;
+    /* Mark serialization started: */
+    m_fSerializationIsInProgress = true;
+
+    /* Create settings loader: */
+    m_pSerializeProcess = new UISettingsSerializer(this, UISettingsSerializer::Load,
+                                                   data, m_pSelector->settingPages());
+    AssertPtrReturnVoid(m_pSerializeProcess);
+    {
+        /* Configure settings loader: */
+        connect(m_pSerializeProcess, SIGNAL(sigNotifyAboutProcessStarted()), this, SLOT(sltHandleProcessStarted()));
+        connect(m_pSerializeProcess, SIGNAL(sigNotifyAboutProcessProgressChanged(int)), this, SLOT(sltHandleProcessProgressChange(int)));
+        connect(m_pSerializeProcess, SIGNAL(sigNotifyAboutProcessFinished()), this, SLOT(sltMarkLoaded()));
+
+        /* Raise current page priority: */
+        m_pSerializeProcess->raisePriorityOfPage(m_pSelector->currentId());
+
+        /* Start settings loader: */
+        m_pSerializeProcess->start();
+
+        /* Upload data finally: */
+        data = m_pSerializeProcess->data();
+    }
 }
 
-void UISettingsDialog::saveData()
+void UISettingsDialog::saveData(QVariant &data)
 {
-    m_fSaved = false;
+    /* Mark serialization started: */
+    m_fSerializationIsInProgress = true;
+
+    /* Create the 'settings saver': */
+    QPointer<UISettingsSerializerProgress> pDlgSerializeProgress =
+        new UISettingsSerializerProgress(this, UISettingsSerializer::Save,
+                                         data, m_pSelector->settingPages());
+    AssertPtrReturnVoid(static_cast<UISettingsSerializerProgress*>(pDlgSerializeProgress));
+    {
+        /* Make the 'settings saver' temporary parent for all sub-dialogs: */
+        windowManager().registerNewParent(pDlgSerializeProgress, windowManager().realParentWindow(this));
+
+        /* Execute the 'settings saver': */
+        pDlgSerializeProgress->exec();
+
+        /* Any modal dialog can be destroyed in own event-loop
+         * as a part of application termination procedure..
+         * We have to check if the dialog still valid. */
+        if (pDlgSerializeProgress)
+        {
+            /* Upload 'settings saver' data: */
+            data = pDlgSerializeProgress->data();
+
+            /* Delete the 'settings saver': */
+            delete pDlgSerializeProgress;
+        }
+    }
 }
 
 void UISettingsDialog::retranslateUi()
@@ -245,44 +332,34 @@ void UISettingsDialog::retranslateUi()
     revalidate();
 }
 
-void UISettingsDialog::setDialogType(SettingsDialogType settingsDialogType)
+void UISettingsDialog::setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel)
 {
-    /* Remember new dialog-type: */
-    m_dialogType = settingsDialogType;
+    /* Make sure something changed: */
+    if (m_configurationAccessLevel == newConfigurationAccessLevel)
+        return;
 
-    /* Propagate it to settings-page(s): */
-    foreach (UISettingsPage *pPage, m_pSelector->settingPages())
-        pPage->setDialogType(dialogType());
-}
+    /* Apply new configuration access level: */
+    m_configurationAccessLevel = newConfigurationAccessLevel;
 
-QString UISettingsDialog::titleExtension() const
-{
-#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
-    return m_pSelector->itemText(m_pSelector->currentId());
-#else
-    return tr("Settings");
-#endif
+    /* And propagate it to settings-page(s): */
+    foreach (UISettingsPage *pPage, m_pSelector->settingPages())
+        pPage->setConfigurationAccessLevel(configurationAccessLevel());
 }
 
 void UISettingsDialog::addItem(const QString &strBigIcon,
-                               const QString &strBigIconDisabled,
+                               const QString &strMediumIcon,
                                const QString &strSmallIcon,
-                               const QString &strSmallIconDisabled,
                                int cId,
                                const QString &strLink,
                                UISettingsPage *pSettingsPage /* = 0 */,
                                int iParentId /* = -1 */)
 {
     /* Add new selector item: */
-    if (QWidget *pPage = m_pSelector->addItem(strBigIcon, strBigIconDisabled,
-                                              strSmallIcon, strSmallIconDisabled,
+    if (QWidget *pPage = m_pSelector->addItem(strBigIcon, strMediumIcon, strSmallIcon,
                                               cId, strLink, pSettingsPage, iParentId))
     {
         /* Add stack-widget page if created: */
         m_pages[cId] = m_pStack->addWidget(pPage);
-        /* Update process-bar: */
-        m_pProcessBar->setMinimum(0);
-        m_pProcessBar->setMaximum(m_pStack->count());
     }
     /* Assign validator if necessary: */
     if (pSettingsPage)
@@ -452,7 +529,7 @@ void UISettingsDialog::sltUpdateWhatsThis(bool fGotFocus /* = false */)
 
 void UISettingsDialog::reject()
 {
-    if (m_fLoaded)
+    if (!isSerializationInProgress())
         QIMainDialog::reject();
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
index f2a4a86..c2b01db 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
@@ -1,7 +1,6 @@
+/* $Id: UISettingsDialog.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UISettingsDialog class declaration
+ * VBox Qt GUI - UISettingsDialog class declaration.
  */
 
 /*
@@ -33,6 +32,7 @@ class QTimer;
 class UIWarningPane;
 class VBoxSettingsSelector;
 class UISettingsPage;
+class UISettingsSerializer;
 
 /* Using declarations: */
 using namespace UISettingsDefs;
@@ -53,6 +53,9 @@ public:
 
 protected slots:
 
+    /** Hides the modal dialog and sets the result code to Accepted. */
+    virtual void accept();
+
     /* Category-change slot: */
     virtual void sltCategoryChanged(int cId);
 
@@ -63,28 +66,42 @@ protected slots:
 
     /* Handlers for process bar: */
     void sltHandleProcessStarted();
-    void sltHandlePageProcessed();
+    void sltHandleProcessProgressChange(int iValue);
 
 protected:
 
-    /* Save/load API: */
-    virtual void loadData();
-    virtual void saveData();
+    /** Returns the serialize process instance. */
+    UISettingsSerializer* serializeProcess() const { return m_pSerializeProcess; }
+    /** Returns whether the serialization is in progress. */
+    bool isSerializationInProgress() const { return m_fSerializationIsInProgress; }
+
+    /** Loads the @a data. */
+    void loadData(QVariant &data);
+    /** Wrapper for the method above.
+      * Loads the data from the corresponding source. */
+    virtual void loadOwnData() = 0;
+
+    /** Saves the @a data. */
+    void saveData(QVariant &data);
+    /** Wrapper for the method above.
+      * Saves the data to the corresponding source. */
+    virtual void saveOwnData() = 0;
 
     /* UI translator: */
     virtual void retranslateUi();
 
-    /* Dialog type: */
-    SettingsDialogType dialogType() { return m_dialogType; }
-    void setDialogType(SettingsDialogType settingsDialogType);
-    /* Dialog title: */
+    /** Returns configuration access level. */
+    ConfigurationAccessLevel configurationAccessLevel() { return m_configurationAccessLevel; }
+    /** Defines configuration access level. */
+    void setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel);
+
+    /** Returns the dialog title extension. */
+    virtual QString titleExtension() const = 0;
+    /** Returns the dialog title. */
     virtual QString title() const = 0;
-    /* Dialog title extension: */
-    virtual QString titleExtension() const;
 
     /* Add settings page: */
-    void addItem(const QString &strBigIcon, const QString &strBigIconDisabled,
-                 const QString &strSmallIcon, const QString &strSmallIconDisabled,
+    void addItem(const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,
                  int cId, const QString &strLink,
                  UISettingsPage* pSettingsPage = 0, int iParentId = -1);
 
@@ -119,13 +136,16 @@ private:
     /* Helper: Validation stuff: */
     void assignValidator(UISettingsPage *pPage);
 
+    /** Holds configuration access level. */
+    ConfigurationAccessLevel m_configurationAccessLevel;
+
     /* Global Flags: */
-    SettingsDialogType m_dialogType;
     bool m_fPolished;
 
-    /* Loading/saving stuff: */
-    bool m_fLoaded;
-    bool m_fSaved;
+    /** Holds the serialize process instance. */
+    UISettingsSerializer *m_pSerializeProcess;
+    /** Holds whether the serialization is in progress. */
+    bool m_fSerializationIsInProgress;
 
     /* Status bar widget: */
     QStackedWidget *m_pStatusBar;
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
index 3017278..c17de8f 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
@@ -1,8 +1,6 @@
 /* $Id: UISettingsDialogSpecific.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UISettingsDialogSpecific class implementation
+ * VBox Qt GUI - UISettingsDialogSpecific class implementation.
  */
 
 /*
@@ -17,304 +15,60 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Qt includes: */
-#include <QStackedWidget>
-#include <QThread>
-#include <QMutex>
-#include <QWaitCondition>
-#include <QTimer>
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* GUI includes: */
-#include "UISettingsDialogSpecific.h"
-#include "UISettingsDefs.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "QIWidgetValidator.h"
-#include "VBoxSettingsSelector.h"
-#include "UIVirtualBoxEventHandler.h"
-
-#include "UIGlobalSettingsGeneral.h"
-#include "UIGlobalSettingsInput.h"
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include "UIGlobalSettingsUpdate.h"
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-#include "UIGlobalSettingsLanguage.h"
-#include "UIGlobalSettingsDisplay.h"
-#include "UIGlobalSettingsNetwork.h"
-#include "UIGlobalSettingsExtension.h"
-#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
-# include "UIGlobalSettingsProxy.h"
-#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
-
-#include "UIMachineSettingsGeneral.h"
-#include "UIMachineSettingsSystem.h"
-#include "UIMachineSettingsDisplay.h"
-#include "UIMachineSettingsStorage.h"
-#include "UIMachineSettingsAudio.h"
-#include "UIMachineSettingsNetwork.h"
-#include "UIMachineSettingsSerial.h"
-#include "UIMachineSettingsParallel.h"
-#include "UIMachineSettingsUSB.h"
-#include "UIMachineSettingsSF.h"
+# include "UISettingsDialogSpecific.h"
+# include "UISettingsSerializer.h"
+# include "UISettingsDefs.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIExtraDataManager.h"
+# include "QIWidgetValidator.h"
+# include "VBoxSettingsSelector.h"
+# include "UIVirtualBoxEventHandler.h"
+
+# include "UIGlobalSettingsGeneral.h"
+# include "UIGlobalSettingsInput.h"
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+#  include "UIGlobalSettingsUpdate.h"
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+# include "UIGlobalSettingsLanguage.h"
+# include "UIGlobalSettingsDisplay.h"
+# include "UIGlobalSettingsNetwork.h"
+# include "UIGlobalSettingsExtension.h"
+# ifdef VBOX_GUI_WITH_NETWORK_MANAGER
+#  include "UIGlobalSettingsProxy.h"
+# endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
+
+# include "UIMachineSettingsGeneral.h"
+# include "UIMachineSettingsSystem.h"
+# include "UIMachineSettingsDisplay.h"
+# include "UIMachineSettingsStorage.h"
+# include "UIMachineSettingsAudio.h"
+# include "UIMachineSettingsNetwork.h"
+# include "UIMachineSettingsSerial.h"
+# include "UIMachineSettingsParallel.h"
+# include "UIMachineSettingsUSB.h"
+# include "UIMachineSettingsSF.h"
+# include "UIMachineSettingsInterface.h"
 
 /* COM includes: */
-#include "CUSBController.h"
-
-#if 0 /* Global USB filters are DISABLED now: */
-# define ENABLE_GLOBAL_USB
-#endif /* Global USB filters are DISABLED now: */
-
-/* Settings page list: */
-typedef QList<UISettingsPage*> UISettingsPageList;
-typedef QMap<int, UISettingsPage*> UISettingsPageMap;
-
-/* Serializer direction: */
-enum UISettingsSerializeDirection
-{
-    UISettingsSerializeDirection_Load,
-    UISettingsSerializeDirection_Save
-};
-
-/* QThread reimplementation for loading/saving settings in async mode: */
-class UISettingsSerializer : public QThread
-{
-    Q_OBJECT;
-
-signals:
-
-    /* Signal to notify main GUI thread about process has been started: */
-    void sigNotifyAboutProcessStarted();
-
-    /* Signal to notify main GUI thread about some page was processed: */
-    void sigNotifyAboutPageProcessed(int iPageId);
-
-    /* Signal to notify main GUI thread about all pages were processed: */
-    void sigNotifyAboutPagesProcessed();
-
-public:
-
-    /* Settings serializer instance: */
-    static UISettingsSerializer* instance() { return m_pInstance; }
-
-    /* Settings serializer constructor: */
-    UISettingsSerializer(QObject *pParent, const QVariant &data, UISettingsSerializeDirection direction)
-        : QThread(pParent)
-        , m_direction(direction)
-        , m_data(data)
-        , m_fSavingComplete(m_direction == UISettingsSerializeDirection_Load)
-        , m_fAllowToDestroySerializer(m_direction == UISettingsSerializeDirection_Load)
-        , m_iIdOfHighPriorityPage(-1)
-    {
-        /* Set instance: */
-        m_pInstance = this;
-
-        /* Connecting this signals: */
-        connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), this, SLOT(sltHandleProcessedPage(int)), Qt::QueuedConnection);
-        connect(this, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltHandleProcessedPages()), Qt::QueuedConnection);
-        connect(this, SIGNAL(finished()), this, SLOT(sltDestroySerializer()), Qt::QueuedConnection);
-        /* Connecting parent signals: */
-        connect(this, SIGNAL(sigNotifyAboutProcessStarted()), parent(), SLOT(sltHandleProcessStarted()), Qt::QueuedConnection);
-        connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), parent(), SLOT(sltHandlePageProcessed()), Qt::QueuedConnection);
-    }
-
-    /* Settings serializer destructor: */
-    ~UISettingsSerializer()
-    {
-        /* If serializer is being destructed by it's parent,
-         * thread could still be running, we have to wait
-         * for it to be finished! */
-        if (isRunning())
-            wait();
-
-        /* Clear instance: */
-        m_pInstance = 0;
-    }
-
-    /* Set pages list: */
-    void setPageList(const UISettingsPageList &pageList)
-    {
-        for (int iPageIndex = 0; iPageIndex < pageList.size(); ++iPageIndex)
-        {
-            UISettingsPage *pPage = pageList[iPageIndex];
-            m_pages.insert(pPage->id(), pPage);
-        }
-    }
-
-    /* Raise priority of page: */
-    void raisePriorityOfPage(int iPageId)
-    {
-        /* If that page is not present or was processed already: */
-        if (!m_pages.contains(iPageId) || m_pages[iPageId]->processed())
-        {
-            /* We just ignoring that request: */
-            return;
-        }
-        else
-        {
-            /* Else remember which page we should be processed next: */
-            m_iIdOfHighPriorityPage = iPageId;
-        }
-    }
-
-    /* Return current m_data content: */
-    QVariant& data() { return m_data; }
-
-public slots:
-
-    void start(Priority priority = InheritPriority)
-    {
-        /* Notify listeners about we are starting: */
-        emit sigNotifyAboutProcessStarted();
-
-        /* If serializer saves settings: */
-        if (m_direction == UISettingsSerializeDirection_Save)
-        {
-            /* We should update internal page cache first: */
-            for (int iPageIndex = 0; iPageIndex < m_pages.values().size(); ++iPageIndex)
-                m_pages.values()[iPageIndex]->putToCache();
-        }
-
-        /* Start async serializing thread: */
-        QThread::start(priority);
+# include "CUSBController.h"
 
-        /* If serializer saves settings: */
-        if (m_direction == UISettingsSerializeDirection_Save)
-        {
-            /* We should block calling thread until all pages will be saved: */
-            while (!m_fSavingComplete)
-            {
-                /* Lock mutex initially: */
-                m_mutex.lock();
-                /* Perform idle-processing every 100ms,
-                 * and waiting for direct wake up signal: */
-                m_condition.wait(&m_mutex, 100);
-                /* Process queued signals posted to GUI thread: */
-                qApp->processEvents();
-                /* Unlock mutex finally: */
-                m_mutex.unlock();
-            }
-            m_fAllowToDestroySerializer = true;
-        }
-    }
-
-protected slots:
-
-    /* Slot to handle the fact of some page was processed: */
-    void sltHandleProcessedPage(int iPageId)
-    {
-        /* If serializer loads settings: */
-        if (m_direction == UISettingsSerializeDirection_Load)
-        {
-            /* If such page present we should fetch internal page cache: */
-            if (m_pages.contains(iPageId))
-            {
-                UISettingsPage *pSettingsPage = m_pages[iPageId];
-                pSettingsPage->setValidatorBlocked(true);
-                pSettingsPage->getFromCache();
-                pSettingsPage->setValidatorBlocked(false);
-            }
-        }
-    }
-
-    /* Slot to handle the fact of all pages were processed: */
-    void sltHandleProcessedPages()
-    {
-        /* If serializer saves settings: */
-        if (m_direction == UISettingsSerializeDirection_Save)
-        {
-            /* We should flag GUI thread to unlock itself: */
-            if (!m_fSavingComplete)
-                m_fSavingComplete = true;
-        }
-        /* If serializer loads settings: */
-        else
-        {
-            /* We have to do initial validation finally: */
-            foreach (UISettingsPage *pPage, m_pages.values())
-                pPage->revalidate();
-        }
-    }
-
-    /* Slot to destroy serializer: */
-    void sltDestroySerializer()
-    {
-        /* If not yet all events were processed,
-         * we should postpone destruction for now: */
-        if (!m_fAllowToDestroySerializer)
-            QTimer::singleShot(0, this, SLOT(sltDestroySerializer()));
-        else
-            deleteLater();
-    }
-
-protected:
-
-    /* Settings processor: */
-    void run()
-    {
-        /* Initialize COM for other thread: */
-        COMBase::InitializeCOM(false);
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
-        /* Mark all the pages initially as NOT processed: */
-        QList<UISettingsPage*> pageList = m_pages.values();
-        for (int iPageNumber = 0; iPageNumber < pageList.size(); ++iPageNumber)
-            pageList[iPageNumber]->setProcessed(false);
+#ifdef Q_WS_MAC
+# if MAC_LEOPARD_STYLE
+#  define VBOX_GUI_WITH_TOOLBAR_SETTINGS
+# endif
+#endif
 
-        /* Iterate over the all left settings pages: */
-        UISettingsPageMap pages(m_pages);
-        while (!pages.empty())
-        {
-            /* Get required page pointer, protect map by mutex while getting pointer: */
-            UISettingsPage *pPage = m_iIdOfHighPriorityPage != -1 && pages.contains(m_iIdOfHighPriorityPage) ?
-                                    pages[m_iIdOfHighPriorityPage] : *pages.begin();
-            /* Reset request of high priority: */
-            if (m_iIdOfHighPriorityPage != -1)
-                m_iIdOfHighPriorityPage = -1;
-            /* Process this page if its enabled: */
-            if (pPage->isEnabled())
-            {
-                if (m_direction == UISettingsSerializeDirection_Load)
-                    pPage->loadToCacheFrom(m_data);
-                if (m_direction == UISettingsSerializeDirection_Save)
-                    pPage->saveFromCacheTo(m_data);
-            }
-            /* Remember what page was processed: */
-            pPage->setProcessed(true);
-            /* Remove processed page from our map: */
-            pages.remove(pPage->id());
-            /* Notify listeners about page was processed: */
-            emit sigNotifyAboutPageProcessed(pPage->id());
-            /* If serializer saves settings => wake up GUI thread: */
-            if (m_direction == UISettingsSerializeDirection_Save)
-                m_condition.wakeAll();
-            /* Break further processing if page had failed: */
-            if (pPage->failed())
-                break;
-        }
-        /* Notify listeners about all pages were processed: */
-        emit sigNotifyAboutPagesProcessed();
-        /* If serializer saves settings => wake up GUI thread: */
-        if (m_direction == UISettingsSerializeDirection_Save)
-            m_condition.wakeAll();
-
-        /* Deinitialize COM for other thread: */
-        COMBase::CleanupCOM();
-    }
-
-    /* Variables: */
-    UISettingsSerializeDirection m_direction;
-    QVariant m_data;
-    UISettingsPageMap m_pages;
-    bool m_fSavingComplete;
-    bool m_fAllowToDestroySerializer;
-    int m_iIdOfHighPriorityPage;
-    QMutex m_mutex;
-    QWaitCondition m_condition;
-    static UISettingsSerializer *m_pInstance;
-};
-
-UISettingsSerializer* UISettingsSerializer::m_pInstance = 0;
-
-UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
+UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent,
+                                               const QString &strCategory /* = QString() */,
+                                               const QString &strControl /* = QString() */)
     : UISettingsDialog(pParent)
 {
     /* Window icon: */
@@ -322,12 +76,8 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
     setWindowIcon(QIcon(":/global_settings_16px.png"));
 #endif /* !Q_WS_MAC */
 
-    /* Assign default dialog type: */
-    setDialogType(SettingsDialogType_Offline);
-
     /* Creating settings pages: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-    QList<GlobalSettingsPageType> restrictedGlobalSettingsPages = vboxGlobal().restrictedGlobalSettingsPages(vbox);
+    QList<GlobalSettingsPageType> restrictedGlobalSettingsPages = gEDataManager->restrictedGlobalSettingsPages();
     for (int iPageIndex = GlobalSettingsPageType_General; iPageIndex < GlobalSettingsPageType_Max; ++iPageIndex)
     {
         /* Make sure page was not restricted: */
@@ -344,8 +94,7 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 case GlobalSettingsPageType_General:
                 {
                     pSettingsPage = new UIGlobalSettingsGeneral;
-                    addItem(":/machine_32px.png", ":/machine_disabled_32px.png",
-                            ":/machine_16px.png", ":/machine_disabled_16px.png",
+                    addItem(":/machine_32px.png", ":/machine_24px.png", ":/machine_16px.png",
                             iPageIndex, "#general", pSettingsPage);
                     break;
                 }
@@ -353,8 +102,7 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 case GlobalSettingsPageType_Input:
                 {
                     pSettingsPage = new UIGlobalSettingsInput;
-                    addItem(":/hostkey_32px.png", ":/hostkey_disabled_32px.png",
-                            ":/hostkey_16px.png", ":/hostkey_disabled_16px.png",
+                    addItem(":/keyboard_32px.png", ":/keyboard_24px.png", ":/keyboard_16px.png",
                             iPageIndex, "#input", pSettingsPage);
                     break;
                 }
@@ -363,8 +111,7 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 case GlobalSettingsPageType_Update:
                 {
                     pSettingsPage = new UIGlobalSettingsUpdate;
-                    addItem(":/refresh_32px.png", ":/refresh_disabled_32px.png",
-                            ":/refresh_16px.png", ":/refresh_disabled_16px.png",
+                    addItem(":/refresh_32px.png", ":/refresh_24px.png", ":/refresh_16px.png",
                             iPageIndex, "#update", pSettingsPage);
                     break;
                 }
@@ -373,8 +120,7 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 case GlobalSettingsPageType_Language:
                 {
                     pSettingsPage = new UIGlobalSettingsLanguage;
-                    addItem(":/site_32px.png", ":/site_disabled_32px.png",
-                            ":/site_16px.png", ":/site_disabled_16px.png",
+                    addItem(":/site_32px.png", ":/site_24px.png", ":/site_16px.png",
                             iPageIndex, "#language", pSettingsPage);
                     break;
                 }
@@ -382,8 +128,7 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 case GlobalSettingsPageType_Display:
                 {
                     pSettingsPage = new UIGlobalSettingsDisplay;
-                    addItem(":/vrdp_32px.png", ":/vrdp_disabled_32px.png",
-                            ":/vrdp_16px.png", ":/vrdp_disabled_16px.png",
+                    addItem(":/vrdp_32px.png", ":/vrdp_24px.png", ":/vrdp_16px.png",
                             iPageIndex, "#display", pSettingsPage);
                     break;
                 }
@@ -391,8 +136,7 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 case GlobalSettingsPageType_Network:
                 {
                     pSettingsPage = new UIGlobalSettingsNetwork;
-                    addItem(":/nw_32px.png", ":/nw_disabled_32px.png",
-                            ":/nw_16px.png", ":/nw_disabled_16px.png",
+                    addItem(":/nw_32px.png", ":/nw_24px.png", ":/nw_16px.png",
                             iPageIndex, "#network", pSettingsPage);
                     break;
                 }
@@ -400,8 +144,7 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 case GlobalSettingsPageType_Extensions:
                 {
                     pSettingsPage = new UIGlobalSettingsExtension;
-                    addItem(":/extension_pack_32px.png", ":/extension_pack_disabled_32px.png",
-                            ":/extension_pack_16px.png", ":/extension_pack_disabled_16px.png",
+                    addItem(":/extension_pack_32px.png", ":/extension_pack_24px.png", ":/extension_pack_16px.png",
                             iPageIndex, "#extensions", pSettingsPage);
                     break;
                 }
@@ -410,8 +153,7 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 case GlobalSettingsPageType_Proxy:
                 {
                     pSettingsPage = new UIGlobalSettingsProxy;
-                    addItem(":/proxy_32px.png", ":/proxy_disabled_32px.png",
-                            ":/proxy_16px.png", ":/proxy_disabled_16px.png",
+                    addItem(":/proxy_32px.png", ":/proxy_24px.png", ":/proxy_16px.png",
                             iPageIndex, "#proxy", pSettingsPage);
                     break;
                 }
@@ -419,65 +161,79 @@ UISettingsDialogGlobal::UISettingsDialogGlobal(QWidget *pParent)
                 default:
                     break;
             }
-            if (pSettingsPage)
-                pSettingsPage->setDialogType(dialogType());
         }
     }
 
+    /* Assign default (full) configuration access level: */
+    setConfigurationAccessLevel(ConfigurationAccessLevel_Full);
+
     /* Retranslate UI: */
     retranslateUi();
 
-    /* Choose first item by default: */
-    m_pSelector->selectById(GlobalSettingsPageType_General);
-}
-
-UISettingsDialogGlobal::~UISettingsDialogGlobal()
-{
-    /* Delete serializer early if exists: */
-    if (UISettingsSerializer::instance())
-        delete UISettingsSerializer::instance();
+    /* Setup settings window: */
+    if (!strCategory.isNull())
+    {
+        m_pSelector->selectByLink(strCategory);
+        /* Search for a widget with the given name: */
+        if (!strControl.isNull())
+        {
+            if (QWidget *pWidget = m_pStack->findChild<QWidget*>(strControl))
+            {
+                QList<QWidget*> parents;
+                QWidget *pParentWidget = pWidget;
+                while ((pParentWidget = pParentWidget->parentWidget()) != 0)
+                {
+                    if (QTabWidget *pTabWidget = qobject_cast<QTabWidget*>(pParentWidget))
+                    {
+                        /* The tab contents widget is two steps down
+                         * (QTabWidget -> QStackedWidget -> QWidget): */
+                        QWidget *pTabPage = parents[parents.count() - 1];
+                        if (pTabPage)
+                            pTabPage = parents[parents.count() - 2];
+                        if (pTabPage)
+                            pTabWidget->setCurrentWidget(pTabPage);
+                    }
+                    parents.append(pParentWidget);
+                }
+                pWidget->setFocus();
+            }
+        }
+    }
+    /* First item as default: */
+    else
+        m_pSelector->selectById(GlobalSettingsPageType_General);
 }
 
-void UISettingsDialogGlobal::loadData()
+void UISettingsDialogGlobal::loadOwnData()
 {
-    /* Call for base-class: */
-    UISettingsDialog::loadData();
-
+    /* Get properties and settings: */
+    CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
+    VBoxGlobalSettings settings = vboxGlobal().settings();
     /* Prepare global data: */
     qRegisterMetaType<UISettingsDataGlobal>();
-    UISettingsDataGlobal data(vboxGlobal().virtualBox().GetSystemProperties(), vboxGlobal().settings());
-    /* Create global settings loader,
-     * it will load global settings & delete itself in the appropriate time: */
-    UISettingsSerializer *pGlobalSettingsLoader = new UISettingsSerializer(this, QVariant::fromValue(data), UISettingsSerializeDirection_Load);
-    connect(pGlobalSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkLoaded()));
-    /* Set pages to be loaded: */
-    pGlobalSettingsLoader->setPageList(m_pSelector->settingPages());
-    /* Start loader: */
-    pGlobalSettingsLoader->start();
+    UISettingsDataGlobal data(properties, settings);
+    QVariant varData = QVariant::fromValue(data);
+
+    /* Call to base-class: */
+    UISettingsDialog::loadData(varData);
 }
 
-void UISettingsDialogGlobal::saveData()
+void UISettingsDialogGlobal::saveOwnData()
 {
-    /* Call for base-class: */
-    UISettingsDialog::saveData();
-
     /* Get properties and settings: */
     CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties();
     VBoxGlobalSettings settings = vboxGlobal().settings();
     /* Prepare global data: */
     qRegisterMetaType<UISettingsDataGlobal>();
     UISettingsDataGlobal data(properties, settings);
-    /* Create global settings saver,
-     * it will save global settings & delete itself in the appropriate time: */
-    UISettingsSerializer *pGlobalSettingsSaver = new UISettingsSerializer(this, QVariant::fromValue(data), UISettingsSerializeDirection_Save);
-    /* Set pages to be saved: */
-    pGlobalSettingsSaver->setPageList(m_pSelector->settingPages());
-    /* Start saver: */
-    pGlobalSettingsSaver->start();
+    QVariant varData = QVariant::fromValue(data);
+
+    /* Call to base-class: */
+    UISettingsDialog::saveData(varData);
 
     /* Get updated properties & settings: */
-    CSystemProperties newProperties = pGlobalSettingsSaver->data().value<UISettingsDataGlobal>().m_properties;
-    VBoxGlobalSettings newSettings = pGlobalSettingsSaver->data().value<UISettingsDataGlobal>().m_settings;
+    CSystemProperties newProperties = varData.value<UISettingsDataGlobal>().m_properties;
+    VBoxGlobalSettings newSettings = varData.value<UISettingsDataGlobal>().m_settings;
     /* If properties are not OK => show the error: */
     if (!newProperties.isOk())
         msgCenter().cannotSetSystemProperties(newProperties, this);
@@ -485,7 +241,7 @@ void UISettingsDialogGlobal::saveData()
     else if (!(newSettings == settings))
         vboxGlobal().setSettings(newSettings);
 
-    /* Mark page processed: */
+    /* Mark as saved: */
     sltMarkSaved();
 }
 
@@ -529,6 +285,15 @@ void UISettingsDialogGlobal::retranslateUi()
     setWindowTitle(title());
 }
 
+QString UISettingsDialogGlobal::titleExtension() const
+{
+#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
+    return m_pSelector->itemText(m_pSelector->currentId());
+#else /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */
+    return tr("Preferences");
+#endif /* !VBOX_GUI_WITH_TOOLBAR_SETTINGS */
+}
+
 QString UISettingsDialogGlobal::title() const
 {
     return tr("VirtualBox - %1").arg(titleExtension());
@@ -566,16 +331,22 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
     /* Allow to reset first-run flag just when medium enumeration was finished: */
     connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltAllowResetFirstRunFlag()));
 
+    /* Make sure settings window will be updated on session/machine state/data changes: */
+    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)),
+            this, SLOT(sltSessionStateChanged(QString, KSessionState)));
+    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
+            this, SLOT(sltMachineStateChanged(QString, KMachineState)));
+    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)),
+            this, SLOT(sltMachineDataChanged(QString)));
+
     /* Get corresponding machine (required to determine dialog type and page availability): */
     m_machine = vboxGlobal().virtualBox().FindMachine(m_strMachineId);
     AssertMsg(!m_machine.isNull(), ("Can't find corresponding machine!\n"));
     m_sessionState = m_machine.GetSessionState();
     m_machineState = m_machine.GetState();
-    /* Recalculate current dialog-type: */
-    updateDialogType();
 
     /* Creating settings pages: */
-    QList<MachineSettingsPageType> restrictedMachineSettingsPages = vboxGlobal().restrictedMachineSettingsPages(m_machine);
+    QList<MachineSettingsPageType> restrictedMachineSettingsPages = gEDataManager->restrictedMachineSettingsPages(m_strMachineId);
     for (int iPageIndex = MachineSettingsPageType_General; iPageIndex < MachineSettingsPageType_Max; ++iPageIndex)
     {
         /* Make sure page was not restricted: */
@@ -592,8 +363,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_General:
                 {
                     pSettingsPage = new UIMachineSettingsGeneral;
-                    addItem(":/machine_32px.png", ":/machine_disabled_32px.png",
-                            ":/machine_16px.png", ":/machine_disabled_16px.png",
+                    addItem(":/machine_32px.png", ":/machine_24px.png", ":/machine_16px.png",
                             iPageIndex, "#general", pSettingsPage);
                     break;
                 }
@@ -601,8 +371,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_System:
                 {
                     pSettingsPage = new UIMachineSettingsSystem;
-                    addItem(":/chipset_32px.png", ":/chipset_disabled_32px.png",
-                            ":/chipset_16px.png", ":/chipset_disabled_16px.png",
+                    addItem(":/chipset_32px.png", ":/chipset_24px.png", ":/chipset_16px.png",
                             iPageIndex, "#system", pSettingsPage);
                     break;
                 }
@@ -610,8 +379,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_Display:
                 {
                     pSettingsPage = new UIMachineSettingsDisplay;
-                    addItem(":/vrdp_32px.png", ":/vrdp_disabled_32px.png",
-                            ":/vrdp_16px.png", ":/vrdp_disabled_16px.png",
+                    addItem(":/vrdp_32px.png", ":/vrdp_24px.png", ":/vrdp_16px.png",
                             iPageIndex, "#display", pSettingsPage);
                     break;
                 }
@@ -620,8 +388,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 {
                     pSettingsPage = new UIMachineSettingsStorage;
                     connect(pSettingsPage, SIGNAL(storageChanged()), this, SLOT(sltResetFirstRunFlag()));
-                    addItem(":/hd_32px.png", ":/hd_disabled_32px.png",
-                            ":/hd_16px.png", ":/hd_disabled_16px.png",
+                    addItem(":/hd_32px.png", ":/hd_24px.png", ":/hd_16px.png",
                             iPageIndex, "#storage", pSettingsPage);
                     break;
                 }
@@ -629,8 +396,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_Audio:
                 {
                     pSettingsPage = new UIMachineSettingsAudio;
-                    addItem(":/sound_32px.png", ":/sound_disabled_32px.png",
-                            ":/sound_16px.png", ":/sound_disabled_16px.png",
+                    addItem(":/sound_32px.png", ":/sound_24px.png", ":/sound_16px.png",
                             iPageIndex, "#audio", pSettingsPage);
                     break;
                 }
@@ -638,16 +404,14 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_Network:
                 {
                     pSettingsPage = new UIMachineSettingsNetworkPage;
-                    addItem(":/nw_32px.png", ":/nw_disabled_32px.png",
-                            ":/nw_16px.png", ":/nw_disabled_16px.png",
+                    addItem(":/nw_32px.png", ":/nw_24px.png", ":/nw_16px.png",
                             iPageIndex, "#network", pSettingsPage);
                     break;
                 }
                 /* Ports page: */
                 case MachineSettingsPageType_Ports:
                 {
-                    addItem(":/serial_port_32px.png", ":/serial_port_disabled_32px.png",
-                            ":/serial_port_16px.png", ":/serial_port_disabled_16px.png",
+                    addItem(":/serial_port_32px.png", ":/serial_port_24px.png", ":/serial_port_16px.png",
                             iPageIndex, "#ports");
                     break;
                 }
@@ -655,8 +419,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_Serial:
                 {
                     pSettingsPage = new UIMachineSettingsSerialPage;
-                    addItem(":/serial_port_32px.png", ":/serial_port_disabled_32px.png",
-                            ":/serial_port_16px.png", ":/serial_port_disabled_16px.png",
+                    addItem(":/serial_port_32px.png", ":/serial_port_24px.png", ":/serial_port_16px.png",
                             iPageIndex, "#serialPorts", pSettingsPage, MachineSettingsPageType_Ports);
                     break;
                 }
@@ -664,8 +427,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_Parallel:
                 {
                     pSettingsPage = new UIMachineSettingsParallelPage;
-                    addItem(":/parallel_port_32px.png", ":/parallel_port_disabled_32px.png",
-                            ":/parallel_port_16px.png", ":/parallel_port_disabled_16px.png",
+                    addItem(":/parallel_port_32px.png", ":/parallel_port_24px.png", ":/parallel_port_16px.png",
                             iPageIndex, "#parallelPorts", pSettingsPage, MachineSettingsPageType_Ports);
                     break;
                 }
@@ -673,8 +435,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_USB:
                 {
                     pSettingsPage = new UIMachineSettingsUSB;
-                    addItem(":/usb_32px.png", ":/usb_disabled_32px.png",
-                            ":/usb_16px.png", ":/usb_disabled_16px.png",
+                    addItem(":/usb_32px.png", ":/usb_24px.png", ":/usb_16px.png",
                             iPageIndex, "#usb", pSettingsPage, MachineSettingsPageType_Ports);
                     break;
                 }
@@ -682,19 +443,27 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
                 case MachineSettingsPageType_SF:
                 {
                     pSettingsPage = new UIMachineSettingsSF;
-                    addItem(":/sf_32px.png", ":/sf_disabled_32px.png",
-                            ":/sf_16px.png", ":/sf_disabled_16px.png",
+                    addItem(":/sf_32px.png", ":/sf_24px.png", ":/sf_16px.png",
                             iPageIndex, "#sharedFolders", pSettingsPage);
                     break;
                 }
+                /* Interface page: */
+                case MachineSettingsPageType_Interface:
+                {
+                    pSettingsPage = new UIMachineSettingsInterface(m_machine.GetId());
+                    addItem(":/interface_32px.png", ":/interface_24px.png", ":/interface_16px.png",
+                            iPageIndex, "#userInterface", pSettingsPage);
+                    break;
+                }
                 default:
                     break;
             }
-            if (pSettingsPage)
-                pSettingsPage->setDialogType(dialogType());
         }
     }
 
+    /* Recalculate configuration access level: */
+    updateConfigurationAccessLevel();
+
     /* Retranslate UI: */
     retranslateUi();
 
@@ -705,7 +474,7 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
         /* Search for a widget with the given name: */
         if (!strControl.isNull())
         {
-            if (QWidget *pWidget = m_pStack->currentWidget()->findChild<QWidget*>(strControl))
+            if (QWidget *pWidget = m_pStack->findChild<QWidget*>(strControl))
             {
                 QList<QWidget*> parents;
                 QWidget *pParentWidget = pWidget;
@@ -732,94 +501,60 @@ UISettingsDialogMachine::UISettingsDialogMachine(QWidget *pParent, const QString
         m_pSelector->selectById(MachineSettingsPageType_General);
 }
 
-UISettingsDialogMachine::~UISettingsDialogMachine()
-{
-    /* Delete serializer early if exists: */
-    if (UISettingsSerializer::instance())
-        delete UISettingsSerializer::instance();
-}
-
-void UISettingsDialogMachine::loadData()
+void UISettingsDialogMachine::loadOwnData()
 {
     /* Check that session is NOT created: */
     if (!m_session.isNull())
         return;
 
-    /* Call for base-class: */
-    UISettingsDialog::loadData();
-
-    /* Disconnect global VBox events from this dialog: */
-    gVBoxEvents->disconnect(this);
-
     /* Prepare session: */
-    m_session = dialogType() == SettingsDialogType_Wrong ? CSession() : vboxGlobal().openExistingSession(m_strMachineId);
+    m_session = configurationAccessLevel() == ConfigurationAccessLevel_Null ? CSession() :
+                configurationAccessLevel() == ConfigurationAccessLevel_Full ? vboxGlobal().openSession(m_strMachineId) :
+                                                                              vboxGlobal().openExistingSession(m_strMachineId);
     /* Check that session was created: */
     if (m_session.isNull())
         return;
 
-    /* Get machine from session: */
+    /* Get machine and console: */
     m_machine = m_session.GetMachine();
-    /* Get console from session: */
-    m_console = dialogType() == SettingsDialogType_Offline ? CConsole() : m_session.GetConsole();
-
+    m_console = configurationAccessLevel() == ConfigurationAccessLevel_Full ? CConsole() : m_session.GetConsole();
     /* Prepare machine data: */
     qRegisterMetaType<UISettingsDataMachine>();
     UISettingsDataMachine data(m_machine, m_console);
-    /* Create machine settings loader,
-     * it will load machine settings & delete itself in the appropriate time: */
-    UISettingsSerializer *pMachineSettingsLoader = new UISettingsSerializer(this, QVariant::fromValue(data), UISettingsSerializeDirection_Load);
-    connect(pMachineSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkLoaded()));
-    connect(pMachineSettingsLoader, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltSetFirstRunFlag()));
-    /* Set pages to be loaded: */
-    pMachineSettingsLoader->setPageList(m_pSelector->settingPages());
-    /* Ask to raise required page priority: */
-    pMachineSettingsLoader->raisePriorityOfPage(m_pSelector->currentId());
-    /* Start page loader: */
-    pMachineSettingsLoader->start();
+    QVariant varData = QVariant::fromValue(data);
+
+    /* Call to base-class: */
+    UISettingsDialog::loadData(varData);
 }
 
-void UISettingsDialogMachine::saveData()
+void UISettingsDialogMachine::saveOwnData()
 {
     /* Check that session is NOT created: */
     if (!m_session.isNull())
         return;
 
-    /* Call for base-class: */
-    UISettingsDialog::saveData();
-
-    /* Disconnect global VBox events from this dialog: */
-    gVBoxEvents->disconnect(this);
-
     /* Prepare session: */
-    if (dialogType() == SettingsDialogType_Wrong)
-        m_session = CSession();
-    else if (dialogType() != SettingsDialogType_Offline)
-        m_session = vboxGlobal().openExistingSession(m_strMachineId);
-    else
-        m_session = vboxGlobal().openSession(m_strMachineId);
+    m_session = configurationAccessLevel() == ConfigurationAccessLevel_Null ? CSession() :
+                configurationAccessLevel() == ConfigurationAccessLevel_Full ? vboxGlobal().openSession(m_strMachineId) :
+                                                                              vboxGlobal().openExistingSession(m_strMachineId);
     /* Check that session was created: */
     if (m_session.isNull())
         return;
 
-    /* Get machine from session: */
+    /* Get machine and console: */
     m_machine = m_session.GetMachine();
-    /* Get console from session: */
-    m_console = dialogType() == SettingsDialogType_Offline ? CConsole() : m_session.GetConsole();
-
+    m_console = configurationAccessLevel() == ConfigurationAccessLevel_Full ? CConsole() : m_session.GetConsole();
     /* Prepare machine data: */
     qRegisterMetaType<UISettingsDataMachine>();
     UISettingsDataMachine data(m_machine, m_console);
-    /* Create machine settings saver,
-     * it will save machine settings & delete itself in the appropriate time: */
-    UISettingsSerializer *pMachineSettingsSaver = new UISettingsSerializer(this, QVariant::fromValue(data), UISettingsSerializeDirection_Save);
-    /* Set pages to be saved: */
-    pMachineSettingsSaver->setPageList(m_pSelector->settingPages());
-    /* Start saver: */
-    pMachineSettingsSaver->start();
+    QVariant varData = QVariant::fromValue(data);
+
+    /* Call to base-class: */
+    UISettingsDialog::saveData(varData);
 
     /* Get updated machine: */
-    m_machine = pMachineSettingsSaver->data().value<UISettingsDataMachine>().m_machine;
-    /* If machine is ok => perform final operations: */
+    m_machine = varData.value<UISettingsDataMachine>().m_machine;
+    /* If machine is OK => perform final operations: */
     if (m_machine.isOk())
     {
         /* Guest OS type & VT-x/AMD-V option correlation auto-fix: */
@@ -842,28 +577,23 @@ void UISettingsDialogMachine::saveData()
         }
 #endif /* VBOX_WITH_VIDEOHWACCEL */
 
-        /* Enable OHCI controller if HID is enabled: */
-        if (pSystemPage && pSystemPage->isHIDEnabled())
-        {
-            ULONG cOhciCtls = m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI);
-            if (!cOhciCtls)
-                m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
-        }
+        /* Enable OHCI controller if HID is enabled but no USB controllers present: */
+        if (pSystemPage && pSystemPage->isHIDEnabled() && m_machine.GetUSBControllers().isEmpty())
+            m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
 
-        /* Clear the "GUI_FirstRun" extra data key in case if
-         * the boot order or disk configuration were changed: */
+        /* Disable First RUN Wizard: */
         if (m_fResetFirstRunFlag)
-            m_machine.SetExtraData(GUI_FirstRun, QString::null);
+            gEDataManager->setMachineFirstTimeStarted(false, m_strMachineId);
 
         /* Save settings finally: */
         m_machine.SaveSettings();
     }
 
-    /* If machine is NOT ok => show the error message: */
+    /* If machine is NOT OK => show the error message: */
     if (!m_machine.isOk())
         msgCenter().cannotSaveMachineSettings(m_machine, this);
 
-    /* Mark page processed: */
+    /* Mark as saved: */
     sltMarkSaved();
 }
 
@@ -913,6 +643,9 @@ void UISettingsDialogMachine::retranslateUi()
     /* SFolders page: */
     m_pSelector->setItemText(MachineSettingsPageType_SF, tr("Shared Folders"));
 
+    /* Interface page: */
+    m_pSelector->setItemText(MachineSettingsPageType_Interface, tr("User Interface"));
+
     /* Polish the selector: */
     m_pSelector->polish();
 
@@ -923,6 +656,15 @@ void UISettingsDialogMachine::retranslateUi()
     setWindowTitle(title());
 }
 
+QString UISettingsDialogMachine::titleExtension() const
+{
+#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
+    return m_pSelector->itemText(m_pSelector->currentId());
+#else /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */
+    return tr("Settings");
+#endif /* !VBOX_GUI_WITH_TOOLBAR_SETTINGS */
+}
+
 QString UISettingsDialogMachine::title() const
 {
     QString strDialogTitle;
@@ -970,7 +712,7 @@ void UISettingsDialogMachine::recorrelate(UISettingsPage *pSettingsPage)
             UIMachineSettingsUSB *pUsbPage = qobject_cast<UIMachineSettingsUSB*>(pSettingsPage);
             UIMachineSettingsSystem *pSystemPage = qobject_cast<UIMachineSettingsSystem*>(m_pSelector->idToPage(MachineSettingsPageType_System));
             if (pUsbPage && pSystemPage)
-                pSystemPage->setOHCIEnabled(pUsbPage->isOHCIEnabled());
+                pSystemPage->setUSBEnabled(pUsbPage->isUSBEnabled());
             break;
         }
         default:
@@ -983,6 +725,9 @@ void UISettingsDialogMachine::sltMarkLoaded()
     /* Call for base-class: */
     UISettingsDialog::sltMarkLoaded();
 
+    /* No need to reset 'first run' flag: */
+    m_fResetFirstRunFlag = false;
+
     /* Unlock the session if exists: */
     if (!m_session.isNull())
     {
@@ -991,14 +736,6 @@ void UISettingsDialogMachine::sltMarkLoaded()
         m_machine = CMachine();
         m_console = CConsole();
     }
-
-    /* Make sure settings window will be updated on machine state/data changes: */
-    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)),
-            this, SLOT(sltSessionStateChanged(QString, KSessionState)));
-    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
-            this, SLOT(sltMachineStateChanged(QString, KMachineState)));
-    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)),
-            this, SLOT(sltMachineDataChanged(QString)));
 }
 
 void UISettingsDialogMachine::sltMarkSaved()
@@ -1018,6 +755,10 @@ void UISettingsDialogMachine::sltMarkSaved()
 
 void UISettingsDialogMachine::sltSessionStateChanged(QString strMachineId, KSessionState sessionState)
 {
+    /* Ignore if serialization is in progress: */
+    if (isSerializationInProgress())
+        return;
+
     /* Ignore if thats NOT our VM: */
     if (strMachineId != m_strMachineId)
         return;
@@ -1029,12 +770,16 @@ void UISettingsDialogMachine::sltSessionStateChanged(QString strMachineId, KSess
     /* Update current session state: */
     m_sessionState = sessionState;
 
-    /* Update dialog-type if necessary: */
-    updateDialogType();
+    /* Recalculate configuration access level: */
+    updateConfigurationAccessLevel();
 }
 
 void UISettingsDialogMachine::sltMachineStateChanged(QString strMachineId, KMachineState machineState)
 {
+    /* Ignore if serialization is in progress: */
+    if (isSerializationInProgress())
+        return;
+
     /* Ignore if thats NOT our VM: */
     if (strMachineId != m_strMachineId)
         return;
@@ -1046,12 +791,16 @@ void UISettingsDialogMachine::sltMachineStateChanged(QString strMachineId, KMach
     /* Update current machine state: */
     m_machineState = machineState;
 
-    /* Update dialog-type if necessary: */
-    updateDialogType();
+    /* Recalculate configuration access level: */
+    updateConfigurationAccessLevel();
 }
 
 void UISettingsDialogMachine::sltMachineDataChanged(QString strMachineId)
 {
+    /* Ignore if serialization is in progress: */
+    if (isSerializationInProgress())
+        return;
+
     /* Ignore if thats NOT our VM: */
     if (strMachineId != m_strMachineId)
         return;
@@ -1061,13 +810,13 @@ void UISettingsDialogMachine::sltMachineDataChanged(QString strMachineId)
         return;
 
     /* Reload data: */
-    loadData();
+    loadOwnData();
 }
 
 void UISettingsDialogMachine::sltCategoryChanged(int cId)
 {
-    if (UISettingsSerializer::instance())
-        UISettingsSerializer::instance()->raisePriorityOfPage(cId);
+    if (serializeProcess())
+        serializeProcess()->raisePriorityOfPage(cId);
 
     UISettingsDialog::sltCategoryChanged(cId);
 }
@@ -1077,11 +826,6 @@ void UISettingsDialogMachine::sltAllowResetFirstRunFlag()
     m_fAllowResetFirstRunFlag = true;
 }
 
-void UISettingsDialogMachine::sltSetFirstRunFlag()
-{
-    m_fResetFirstRunFlag = false;
-}
-
 void UISettingsDialogMachine::sltResetFirstRunFlag()
 {
     if (m_fAllowResetFirstRunFlag)
@@ -1123,7 +867,7 @@ bool UISettingsDialogMachine::isPageAvailable(int iPageId)
             /* Show the machine error message if any: */
             if (   !m_machine.isReallyOk()
                 && controllerColl.size() > 0
-                && m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI))
+                && !m_machine.GetUSBControllers().isEmpty())
                 msgCenter().warnAboutUnaccessibleUSB(m_machine, parentWidget());
             break;
         }
@@ -1145,25 +889,23 @@ bool UISettingsDialogMachine::isSettingsChanged()
     return fIsSettingsChanged;
 }
 
-void UISettingsDialogMachine::updateDialogType()
+void UISettingsDialogMachine::updateConfigurationAccessLevel()
 {
-    /* Get new dialog type: */
-    SettingsDialogType newDialogType = determineSettingsDialogType(m_sessionState, m_machineState);
+    /* Determine new configuration access level: */
+    ConfigurationAccessLevel newConfigurationAccessLevel = ::configurationAccessLevel(m_sessionState, m_machineState);
 
-    /* Ignore if dialog type was NOT actually changed: */
-    if (dialogType() == newDialogType)
+    /* Make sure someting changed: */
+    if (configurationAccessLevel() == newConfigurationAccessLevel)
         return;
 
-    /* Should we show a warning about leaving 'offline' state? */
-    bool fShouldWe = dialogType() == SettingsDialogType_Offline;
+    /* Should we warn a user about access level decrease? */
+    bool fShouldWeWarn = configurationAccessLevel() == ConfigurationAccessLevel_Full;
 
-    /* Update current dialog type: */
-    setDialogType(newDialogType);
+    /* Apply new configuration access level: */
+    setConfigurationAccessLevel(newConfigurationAccessLevel);
 
-    /* Show a warning about leaving 'offline' state if we should: */
-    if (isSettingsChanged() && fShouldWe)
+    /* Show a warning about access level decrease if we should: */
+    if (isSettingsChanged() && fShouldWeWarn)
         msgCenter().warnAboutStateChange(this);
 }
 
-# include "UISettingsDialogSpecific.moc"
-
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
index 205c2e9..d86b6a8 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
@@ -1,7 +1,6 @@
+/* $Id: UISettingsDialogSpecific.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UISettingsDialogSpecific class declaration
+ * VBox Qt GUI - UISettingsDialogSpecific class declaration.
  */
 
 /*
@@ -35,16 +34,22 @@ class UISettingsDialogGlobal : public UISettingsDialog
 
 public:
 
-    UISettingsDialogGlobal(QWidget *pParent);
-    ~UISettingsDialogGlobal();
+    UISettingsDialogGlobal(QWidget *pParent,
+                           const QString &strCategory = QString(),
+                           const QString &strControl = QString());
 
 protected:
 
-    void loadData();
-    void saveData();
+    /** Loads the data from the corresponding source. */
+    void loadOwnData();
+    /** Saves the data to the corresponding source. */
+    void saveOwnData();
 
     void retranslateUi();
 
+    /** Returns the dialog title extension. */
+    QString titleExtension() const;
+    /** Returns the dialog title. */
     QString title() const;
 
 private:
@@ -61,15 +66,19 @@ public:
 
     UISettingsDialogMachine(QWidget *pParent, const QString &strMachineId,
                             const QString &strCategory, const QString &strControl);
-    ~UISettingsDialogMachine();
 
 protected:
 
-    void loadData();
-    void saveData();
+    /** Loads the data from the corresponding source. */
+    void loadOwnData();
+    /** Saves the data to the corresponding source. */
+    void saveOwnData();
 
     void retranslateUi();
 
+    /** Returns the dialog title extension. */
+    QString titleExtension() const;
+    /** Returns the dialog title. */
     QString title() const;
 
     void recorrelate(UISettingsPage *pSettingsPage);
@@ -83,14 +92,15 @@ private slots:
     void sltMachineDataChanged(QString strMachineId);
     void sltCategoryChanged(int cId);
     void sltAllowResetFirstRunFlag();
-    void sltSetFirstRunFlag();
     void sltResetFirstRunFlag();
 
 private:
 
     bool isPageAvailable(int iPageId);
     bool isSettingsChanged();
-    void updateDialogType();
+
+    /* Recalculates configuration access level. */
+    void updateConfigurationAccessLevel();
 
     QString m_strMachineId;
     KSessionState m_sessionState;
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp
index bbf131e..91873c5 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp
@@ -1,8 +1,6 @@
 /* $Id: UISettingsPage.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UISettingsPage class implementation
+ * VBox Qt GUI - UISettingsPage class implementation.
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIConverter.h"
-#include "UISettingsPage.h"
-#include "QIWidgetValidator.h"
+# include "UIConverter.h"
+# include "UISettingsPage.h"
+# include "QIWidgetValidator.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Settings page constructor, hidden: */
 UISettingsPage::UISettingsPage(UISettingsPageType pageType)
     : m_pageType(pageType)
-    , m_dialogType(SettingsDialogType_Wrong)
+    , m_configurationAccessLevel(ConfigurationAccessLevel_Null)
     , m_cId(-1)
     , m_fProcessed(false)
     , m_fFailed(false)
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
index 960612f..f79c420 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
@@ -1,7 +1,6 @@
+/* $Id: UISettingsPage.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UISettingsPage class declaration
+ * VBox Qt GUI - UISettingsPage class declaration.
  */
 
 /*
@@ -25,8 +24,8 @@
 
 /* GUI includes: */
 #include "QIWithRetranslateUI.h"
-#include "UIDefs.h"
 #include "UISettingsDefs.h"
+#include "UIExtraDataDefs.h"
 #include "VBoxGlobalSettings.h"
 
 /* COM includes: */
@@ -79,6 +78,20 @@ class UISettingsPage : public QIWithRetranslateUI<QWidget>
 {
     Q_OBJECT;
 
+signals:
+
+    /** Notifies listeners about particular operation progress change.
+      * @param iOperations  holds the number of operations CProgress have,
+      * @param strOperation holds the description of the current CProgress operation,
+      * @param iOperation   holds the index of the current CProgress operation,
+      * @param iPercent     holds the percentage of the current CProgress operation. */
+    void sigOperationProgressChange(ulong iOperations, QString strOperation,
+                                    ulong iOperation, ulong iPercent);
+
+    /** Notifies listeners about particular COM error.
+      * @param strErrorInfo holds the details of the error happened. */
+    void sigOperationProgressError(QString strErrorInfo);
+
 public:
 
     /* Load data to cache from corresponding external object(s),
@@ -107,12 +120,12 @@ public:
     /* Settings page type stuff: */
     UISettingsPageType pageType() const { return m_pageType; }
 
-    /* Settings dialog type stuff: */
-    SettingsDialogType dialogType() const { return m_dialogType; }
-    virtual void setDialogType(SettingsDialogType settingsDialogType) { m_dialogType = settingsDialogType; polishPage(); }
-    bool isMachineOffline() const { return dialogType() == SettingsDialogType_Offline; }
-    bool isMachineSaved() const { return dialogType() == SettingsDialogType_Saved; }
-    bool isMachineOnline() const { return dialogType() == SettingsDialogType_Online; }
+    /* Configuration access level stuff: */
+    ConfigurationAccessLevel configurationAccessLevel() const { return m_configurationAccessLevel; }
+    virtual void setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel) { m_configurationAccessLevel = newConfigurationAccessLevel; polishPage(); }
+    bool isMachineOffline() const { return configurationAccessLevel() == ConfigurationAccessLevel_Full; }
+    bool isMachineSaved() const { return configurationAccessLevel() == ConfigurationAccessLevel_Saved; }
+    bool isMachineOnline() const { return configurationAccessLevel() == ConfigurationAccessLevel_Runtime; }
     bool isMachineInValidMode() const { return isMachineOffline() || isMachineSaved() || isMachineOnline(); }
 
     /* Page changed: */
@@ -153,7 +166,7 @@ private:
 
     /* Variables: */
     UISettingsPageType m_pageType;
-    SettingsDialogType m_dialogType;
+    ConfigurationAccessLevel m_configurationAccessLevel;
     int m_cId;
     bool m_fProcessed;
     bool m_fFailed;
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp
new file mode 100644
index 0000000..e846685
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp
@@ -0,0 +1,388 @@
+/* $Id: UISettingsSerializer.cpp $ */
+/** @file
+ * VBox Qt GUI - UISettingsSerializer class implementation.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+/* Qt includes: */
+# include <QTimer>
+# include <QLabel>
+# include <QHBoxLayout>
+# include <QVBoxLayout>
+# include <QProgressBar>
+/* GUI includes: */
+# include "UISettingsSerializer.h"
+# include "UIMessageCenter.h"
+# include "UISettingsPage.h"
+# include "UIIconPool.h"
+# include "QILabel.h"
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+UISettingsSerializer::UISettingsSerializer(QObject *pParent, SerializationDirection direction,
+                                           const QVariant &data, const UISettingsPageList &pages)
+    : QThread(pParent)
+    , m_direction(direction)
+    , m_data(data)
+    , m_fSavingComplete(m_direction == Load)
+    , m_iIdOfHighPriorityPage(-1)
+{
+    /* Copy the page(s) from incoming list to our map: */
+    foreach (UISettingsPage *pPage, pages)
+        m_pages.insert(pPage->id(), pPage);
+
+    /* Handling internal signals, they are also redirected in their handlers: */
+    connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), this, SLOT(sltHandleProcessedPage(int)), Qt::QueuedConnection);
+    connect(this, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltHandleProcessedPages()), Qt::QueuedConnection);
+
+    /* Redirecting unhandled internal signals: */
+    connect(this, SIGNAL(finished()), this, SIGNAL(sigNotifyAboutProcessFinished()), Qt::QueuedConnection);
+}
+
+UISettingsSerializer::~UISettingsSerializer()
+{
+    /* If serializer is being destructed by it's parent,
+     * thread could still be running, we have to wait
+     * for it to be finished! */
+    if (isRunning())
+        wait();
+}
+
+void UISettingsSerializer::raisePriorityOfPage(int iPageId)
+{
+    /* If that page is present and was not processed already =>
+     * we should remember which page should be processed next: */
+    if (m_pages.contains(iPageId) && !(m_pages[iPageId]->processed()))
+        m_iIdOfHighPriorityPage = iPageId;
+}
+
+void UISettingsSerializer::start(Priority priority /* = InheritPriority */)
+{
+    /* Notify listeners about we are starting: */
+    emit sigNotifyAboutProcessStarted();
+
+    /* If serializer saves settings: */
+    if (m_direction == Save)
+    {
+        /* We should update internal page cache first: */
+        foreach (UISettingsPage *pPage, m_pages.values())
+            pPage->putToCache();
+    }
+
+    /* Start async serializing thread: */
+    QThread::start(priority);
+}
+
+void UISettingsSerializer::sltHandleProcessedPage(int iPageId)
+{
+    /* Make sure such page present: */
+    AssertReturnVoid(m_pages.contains(iPageId));
+
+    /* Get the page being processed: */
+    UISettingsPage *pSettingsPage = m_pages.value(iPageId);
+
+    /* If serializer loads settings: */
+    if (m_direction == Load)
+    {
+        /* We should fetch internal page cache: */
+        pSettingsPage->setValidatorBlocked(true);
+        pSettingsPage->getFromCache();
+        pSettingsPage->setValidatorBlocked(false);
+    }
+
+    /* Add processed page into corresponding map: */
+    m_pagesDone.insert(iPageId, pSettingsPage);
+
+    /* Notify listeners about process reached n%: */
+    const int iValue = 100 * m_pagesDone.size() / m_pages.size();
+    emit sigNotifyAboutProcessProgressChanged(iValue);
+}
+
+void UISettingsSerializer::sltHandleProcessedPages()
+{
+    /* If serializer saves settings: */
+    if (m_direction == Save)
+    {
+        /* We should flag GUI thread to unlock itself: */
+        if (!m_fSavingComplete)
+            m_fSavingComplete = true;
+    }
+    /* If serializer loads settings: */
+    else
+    {
+        /* We have to do initial validation finally: */
+        foreach (UISettingsPage *pPage, m_pages.values())
+            pPage->revalidate();
+    }
+
+    /* Notify listeners about process reached 100%: */
+    emit sigNotifyAboutProcessProgressChanged(100);
+}
+
+void UISettingsSerializer::run()
+{
+    /* Initialize COM for other thread: */
+    COMBase::InitializeCOM(false);
+
+    /* Mark all the pages initially as NOT processed: */
+    foreach (UISettingsPage *pPage, m_pages.values())
+        pPage->setProcessed(false);
+
+    /* Iterate over the all left settings pages: */
+    UISettingsPageMap pages(m_pages);
+    while (!pages.empty())
+    {
+        /* Get required page pointer, protect map by mutex while getting pointer: */
+        UISettingsPage *pPage = m_iIdOfHighPriorityPage != -1 && pages.contains(m_iIdOfHighPriorityPage) ?
+                                pages.value(m_iIdOfHighPriorityPage) : *pages.begin();
+        /* Reset request of high priority: */
+        if (m_iIdOfHighPriorityPage != -1)
+            m_iIdOfHighPriorityPage = -1;
+        /* Process this page if its enabled: */
+        connect(pPage, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
+                this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)));
+        connect(pPage, SIGNAL(sigOperationProgressError(QString)),
+                this, SIGNAL(sigOperationProgressError(QString)));
+        if (pPage->isEnabled())
+        {
+            if (m_direction == Load)
+                pPage->loadToCacheFrom(m_data);
+            if (m_direction == Save)
+                pPage->saveFromCacheTo(m_data);
+        }
+        /* Remember what page was processed: */
+        disconnect(pPage, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
+                   this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)));
+        disconnect(pPage, SIGNAL(sigOperationProgressError(QString)),
+                   this, SIGNAL(sigOperationProgressError(QString)));
+        pPage->setProcessed(true);
+        /* Remove processed page from our map: */
+        pages.remove(pPage->id());
+        /* Notify listeners about page was processed: */
+        emit sigNotifyAboutPageProcessed(pPage->id());
+        /* If serializer saves settings => wake up GUI thread: */
+        if (m_direction == Save)
+            m_condition.wakeAll();
+        /* Break further processing if page had failed: */
+        if (pPage->failed())
+            break;
+    }
+    /* Notify listeners about all pages were processed: */
+    emit sigNotifyAboutPagesProcessed();
+    /* If serializer saves settings => wake up GUI thread: */
+    if (m_direction == Save)
+        m_condition.wakeAll();
+
+    /* Deinitialize COM for other thread: */
+    COMBase::CleanupCOM();
+}
+
+QString UISettingsSerializerProgress::m_strProgressDescriptionTemplate = QString("<compact elipsis=\"middle\">%1 (%2/%3)</compact>");
+
+UISettingsSerializerProgress::UISettingsSerializerProgress(QWidget *pParent, UISettingsSerializer::SerializationDirection direction,
+                                                           const QVariant &data, const UISettingsPageList &pages)
+    : QIWithRetranslateUI<QIDialog>(pParent)
+    , m_direction(direction)
+    , m_data(data)
+    , m_pages(pages)
+    , m_pSerializer(0)
+    , m_pLabelOperationProgress(0)
+    , m_pBarOperationProgress(0)
+    , m_pLabelSubOperationProgress(0)
+    , m_pBarSubOperationProgress(0)
+{
+    /* Prepare: */
+    prepare();
+    /* Translate: */
+    retranslateUi();
+}
+
+int UISettingsSerializerProgress::exec()
+{
+    /* Ask for process start: */
+    emit sigAskForProcessStart();
+
+    /* Call to base-class: */
+    return QIWithRetranslateUI<QIDialog>::exec();
+}
+
+QVariant& UISettingsSerializerProgress::data()
+{
+    AssertPtrReturn(m_pSerializer, m_data);
+    return m_pSerializer->data();
+}
+
+void UISettingsSerializerProgress::prepare()
+{
+    /* Configure self: */
+    setWindowModality(Qt::WindowModal);
+    setWindowTitle(parentWidget()->windowTitle());
+    connect(this, SIGNAL(sigAskForProcessStart()),
+            this, SLOT(sltStartProcess()), Qt::QueuedConnection);
+
+    /* Create serializer: */
+    m_pSerializer = new UISettingsSerializer(this, m_direction, m_data, m_pages);
+    AssertPtrReturnVoid(m_pSerializer);
+    {
+        /* Install progress handler: */
+        connect(m_pSerializer, SIGNAL(sigNotifyAboutProcessProgressChanged(int)),
+                this, SLOT(sltHandleProcessProgressChange(int)));
+        connect(m_pSerializer, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
+                this, SLOT(sltHandleOperationProgressChange(ulong, QString, ulong, ulong)));
+        connect(m_pSerializer, SIGNAL(sigOperationProgressError(QString)),
+                this, SLOT(sltHandleOperationProgressError(QString)));
+    }
+
+    /* Create layout: */
+    QVBoxLayout *pLayout = new QVBoxLayout(this);
+    AssertPtrReturnVoid(pLayout);
+    {
+        /* Create top layout: */
+        QHBoxLayout *pLayoutTop = new QHBoxLayout;
+        AssertPtrReturnVoid(pLayoutTop);
+        {
+            /* Create pixmap layout: */
+            QVBoxLayout *pLayoutPixmap = new QVBoxLayout;
+            AssertPtrReturnVoid(pLayoutPixmap);
+            {
+                /* Create pixmap label: */
+                QLabel *pLabelPixmap = new QLabel;
+                AssertPtrReturnVoid(pLabelPixmap);
+                {
+                    /* Configure label: */
+                    const QIcon icon = UIIconPool::iconSet(":/progress_settings_90px.png");
+                    pLabelPixmap->setPixmap(icon.pixmap(icon.availableSizes().first()));
+                    /* Add label into layout: */
+                    pLayoutPixmap->addWidget(pLabelPixmap);
+                }
+                /* Add stretch: */
+                pLayoutPixmap->addStretch();
+                /* Add layout into parent: */
+                pLayoutTop->addLayout(pLayoutPixmap);
+            }
+            /* Create progress layout: */
+            QVBoxLayout *pLayoutProgress = new QVBoxLayout;
+            AssertPtrReturnVoid(pLayoutProgress);
+            {
+                /* Create operation progress label: */
+                m_pLabelOperationProgress = new QLabel;
+                AssertPtrReturnVoid(m_pLabelOperationProgress);
+                {
+                    /* Add label into layout: */
+                    pLayoutProgress->addWidget(m_pLabelOperationProgress);
+                }
+                /* Create operation progress bar: */
+                m_pBarOperationProgress = new QProgressBar;
+                AssertPtrReturnVoid(m_pBarOperationProgress);
+                {
+                    /* Configure progress bar: */
+                    m_pBarOperationProgress->setMinimumWidth(300);
+                    m_pBarOperationProgress->setMaximum(100);
+                    m_pBarOperationProgress->setMinimum(0);
+                    m_pBarOperationProgress->setValue(0);
+                    /* Add bar into layout: */
+                    pLayoutProgress->addWidget(m_pBarOperationProgress);
+                }
+                /* Create sub-operation progress label: */
+                m_pLabelSubOperationProgress = new QILabel;
+                AssertPtrReturnVoid(m_pLabelSubOperationProgress);
+                {
+                    /* Configure label: */
+                    m_pLabelSubOperationProgress->hide();
+                    m_pLabelSubOperationProgress->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed));
+                    /* Add label into layout: */
+                    pLayoutProgress->addWidget(m_pLabelSubOperationProgress);
+                }
+                /* Create sub-operation progress bar: */
+                m_pBarSubOperationProgress = new QProgressBar;
+                AssertPtrReturnVoid(m_pBarSubOperationProgress);
+                {
+                    /* Configure progress bar: */
+                    m_pBarSubOperationProgress->hide();
+                    m_pBarSubOperationProgress->setMinimumWidth(300);
+                    m_pBarSubOperationProgress->setMaximum(100);
+                    m_pBarSubOperationProgress->setMinimum(0);
+                    m_pBarSubOperationProgress->setValue(0);
+                    /* Add bar into layout: */
+                    pLayoutProgress->addWidget(m_pBarSubOperationProgress);
+                }
+                /* Add stretch: */
+                pLayoutProgress->addStretch();
+                /* Add layout into parent: */
+                pLayoutTop->addLayout(pLayoutProgress);
+            }
+            /* Add layout into parent: */
+            pLayout->addLayout(pLayoutTop);
+        }
+    }
+}
+
+void UISettingsSerializerProgress::retranslateUi()
+{
+    /* Translate operation progress label: */
+    AssertPtrReturnVoid(m_pLabelOperationProgress);
+    switch (m_pSerializer->direction())
+    {
+        case UISettingsSerializer::Load: m_pLabelOperationProgress->setText(tr("Loading Settings...")); break;
+        case UISettingsSerializer::Save: m_pLabelOperationProgress->setText(tr("Saving Settings...")); break;
+    }
+}
+
+void UISettingsSerializerProgress::closeEvent(QCloseEvent *pEvent)
+{
+    /* No need to close the dialog: */
+    pEvent->ignore();
+}
+
+void UISettingsSerializerProgress::reject()
+{
+    /* No need to reject the dialog. */
+}
+
+void UISettingsSerializerProgress::sltStartProcess()
+{
+    /* Start the serializer: */
+    m_pSerializer->start();
+}
+
+void UISettingsSerializerProgress::sltHandleProcessProgressChange(int iValue)
+{
+    /* Update the operation progress-bar with incoming value: */
+    AssertPtrReturnVoid(m_pBarOperationProgress);
+    m_pBarOperationProgress->setValue(iValue);
+    /* Hide the progress-dialog upon reaching the 100% progress: */
+    if (iValue == m_pBarOperationProgress->maximum())
+        hide();
+}
+
+void UISettingsSerializerProgress::sltHandleOperationProgressChange(ulong iOperations, QString strOperation,
+                                                                    ulong iOperation, ulong iPercent)
+{
+    /* Update the sub-operation progress label and bar: */
+    AssertPtrReturnVoid(m_pLabelSubOperationProgress);
+    AssertPtrReturnVoid(m_pBarSubOperationProgress);
+    m_pLabelSubOperationProgress->show();
+    m_pBarSubOperationProgress->show();
+    m_pLabelSubOperationProgress->setText(m_strProgressDescriptionTemplate.arg(strOperation).arg(iOperation).arg(iOperations));
+    m_pBarSubOperationProgress->setValue(iPercent);
+}
+
+void UISettingsSerializerProgress::sltHandleOperationProgressError(QString strErrorInfo)
+{
+    /* Show the error message: */
+    msgCenter().cannotSaveSettings(strErrorInfo, this);
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h
new file mode 100644
index 0000000..a120cd1
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h
@@ -0,0 +1,229 @@
+/* $Id: UISettingsSerializer.h $ */
+/** @file
+ * VBox Qt GUI - UISettingsSerializer class declaration.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UISettingsSerializer_h___
+#define ___UISettingsSerializer_h___
+
+/* Qt includes: */
+#include <QThread>
+#include <QVariant>
+#include <QWaitCondition>
+#include <QMutex>
+#include <QList>
+#include <QMap>
+
+/* GUI includes: */
+#include "QIWithRetranslateUI.h"
+#include "QIDialog.h"
+
+/* Forward declarations: */
+class UISettingsPage;
+class QProgressBar;
+class QILabel;
+class QLabel;
+
+/* Type definitions: */
+typedef QList<UISettingsPage*> UISettingsPageList;
+typedef QMap<int, UISettingsPage*> UISettingsPageMap;
+
+/** QThread reimplementation used for
+  * loading/saving settings in async mode. */
+class UISettingsSerializer : public QThread
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listeners about process has been started. */
+    void sigNotifyAboutProcessStarted();
+    /** Notifies listeners about process reached @a iValue. */
+    void sigNotifyAboutProcessProgressChanged(int iValue);
+    /** Notifies listeners about process has been finished. */
+    void sigNotifyAboutProcessFinished();
+
+    /** Notifies GUI thread about some page was processed. */
+    void sigNotifyAboutPageProcessed(int iPageId);
+    /** Notifies GUI thread about all pages were processed. */
+    void sigNotifyAboutPagesProcessed();
+
+    /** Notifies listeners about particular operation progress change.
+      * @param iOperations  holds the number of operations CProgress have,
+      * @param strOperation holds the description of the current CProgress operation,
+      * @param iOperation   holds the index of the current CProgress operation,
+      * @param iPercent     holds the percentage of the current CProgress operation. */
+    void sigOperationProgressChange(ulong iOperations, QString strOperation,
+                                    ulong iOperation, ulong iPercent);
+
+    /** Notifies listeners about particular COM error.
+      * @param strErrorInfo holds the details of the error happened. */
+    void sigOperationProgressError(QString strErrorInfo);
+
+public:
+
+    /** Serialization directions. */
+    enum SerializationDirection { Load, Save };
+
+    /** Constructor.
+      * @param pParent   being passed to the base-class,
+      * @param direction determines the load/save direction,
+      * @param data      contains the wrapper(s) to load/save the data from/to,
+      * @param pages     contains the page(s) to load/save the data to/from. */
+    UISettingsSerializer(QObject *pParent, SerializationDirection direction,
+                         const QVariant &data, const UISettingsPageList &pages);
+
+    /** Destructor. */
+    ~UISettingsSerializer();
+
+    /** Returns the load/save direction. */
+    SerializationDirection direction() const { return m_direction; }
+
+    /** Returns the instance of wrapper(s) to load/save the data from/to. */
+    QVariant& data() { return m_data; }
+
+    /** Returns the count of the page(s) to load/save the data to/from. */
+    int pageCount() const { return m_pages.size(); }
+
+    /** Raises the priority of page with @a iPageId. */
+    void raisePriorityOfPage(int iPageId);
+
+public slots:
+
+    /** Starts the process of data loading with passed @a priority. */
+    void start(Priority priority = InheritPriority);
+
+protected slots:
+
+    /** Handles the fact of page with @a iPageId was processed. */
+    void sltHandleProcessedPage(int iPageId);
+
+    /** Handles the fact of all pages were processed. */
+    void sltHandleProcessedPages();
+
+protected:
+
+    /** Worker-thread serialization rutine. */
+    void run();
+
+    /** Holds the load/save direction. */
+    const SerializationDirection m_direction;
+
+    /** Holds the wrapper(s) to load/save the data from/to. */
+    QVariant m_data;
+    /** Holds the page(s) to load/save the data to/from. */
+    UISettingsPageMap m_pages;
+    /** Holds the page(s) to load/save the data to/from for which that task was done. */
+    UISettingsPageMap m_pagesDone;
+
+    /** Holds whether the save was complete. */
+    bool m_fSavingComplete;
+    /** Holds the ID of the high priority page. */
+    int m_iIdOfHighPriorityPage;
+    /** Holds the synchronization mutex. */
+    QMutex m_mutex;
+    /** Holds the synchronization condition. */
+    QWaitCondition m_condition;
+};
+
+/** QIDialog reimplementation used to
+  * reflect the settings serialization operation. */
+class UISettingsSerializerProgress : public QIWithRetranslateUI<QIDialog>
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Asks itself for process start. */
+    void sigAskForProcessStart();
+
+public:
+
+    /** Constructor.
+      * @param pParent   being passed to the base-class,
+      * @param direction determines the load/save direction,
+      * @param data      contains the wrapper(s) to load/save the data from/to,
+      * @param pages     contains the page(s) to load/save the data to/from. */
+    UISettingsSerializerProgress(QWidget *pParent, UISettingsSerializer::SerializationDirection direction,
+                                 const QVariant &data, const UISettingsPageList &pages);
+
+    /** Executes the dialog. */
+    int exec();
+
+    /** Returns the instance of wrapper(s) to load/save the data from/to. */
+    QVariant& data();
+
+protected:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Translate routine: */
+    void retranslateUi();
+
+    /** Close event-handler called with the given window system @a pEvent. */
+    virtual void closeEvent(QCloseEvent *pEvent);
+
+private slots:
+
+    /** Hides the modal dialog and sets the result code to <i>Rejected</i>. */
+    virtual void reject();
+
+    /** Starts the process. */
+    void sltStartProcess();
+
+    /** Handles process progress change to @a iValue. */
+    void sltHandleProcessProgressChange(int iValue);
+
+    /** Handles particular operation progress change.
+      * @param iOperations  holds the number of operations CProgress have,
+      * @param strOperation holds the description of the current CProgress operation,
+      * @param iOperation   holds the index of the current CProgress operation,
+      * @param iPercent     holds the percentage of the current CProgress operation. */
+    void sltHandleOperationProgressChange(ulong iOperations, QString strOperation,
+                                          ulong iOperation, ulong iPercent);
+
+    /** Handles particular COM error.
+      * @param strErrorInfo holds the details of the error happened. */
+    void sltHandleOperationProgressError(QString strErrorInfo);
+
+private:
+
+    /** Holds the load/save direction. */
+    const UISettingsSerializer::SerializationDirection m_direction;
+
+    /** Holds the wrapper(s) to load/save the data from/to. */
+    QVariant m_data;
+    /** Holds the page(s) to load/save the data to/from. */
+    UISettingsPageList m_pages;
+
+    /** Holds the pointer to the thread loading/saving settings in async mode. */
+    UISettingsSerializer *m_pSerializer;
+
+    /** Holds the operation progress label. */
+    QLabel *m_pLabelOperationProgress;
+    /** Holds the operation progress bar. */
+    QProgressBar *m_pBarOperationProgress;
+
+    /** Holds the sub-operation progress label. */
+    QILabel *m_pLabelSubOperationProgress;
+    /** Holds the sub-operation progress bar. */
+    QProgressBar *m_pBarSubOperationProgress;
+
+    /** Holds the template for the sub-operation progress label. */
+    static QString m_strProgressDescriptionTemplate;
+};
+
+#endif /* !___UISettingsSerializer_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp b/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp
index 81f8305..10e9084 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxSettingsSelector.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxSettingsSelector class implementation
+ * VBox Qt GUI - VBoxSettingsSelector class implementation.
  */
 
 /*
@@ -17,18 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes */
-#include <QHeaderView>
-#include <QTabWidget>
-#include <QLayout>
-#include <QAction>
+# include <QHeaderView>
+# include <QTabWidget>
+# include <QLayout>
+# include <QAction>
 
 /* Local includes */
-#include "VBoxSettingsSelector.h"
-#include "UISettingsPage.h"
-#include "UIToolBar.h"
-#include "QITreeWidget.h"
-#include "QITabWidget.h"
+# include "VBoxSettingsSelector.h"
+# include "UISettingsPage.h"
+# include "UIToolBar.h"
+# include "QITreeWidget.h"
+# include "QITabWidget.h"
+# include "UIIconPool.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 enum
 {
@@ -189,6 +195,7 @@ VBoxSettingsTreeViewSelector::VBoxSettingsTreeViewSelector (QWidget *aParent /*
     mTwSelector->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
     mTwSelector->setRootIsDecorated (false);
     mTwSelector->setUniformRowHeights (true);
+    mTwSelector->setIconSize(QSize(24, 24));
     /* Add the columns */
     mTwSelector->headerItem()->setText (treeWidget_Category, "Category");
     mTwSelector->headerItem()->setText (treeWidget_Id, "[id]");
@@ -207,10 +214,9 @@ QWidget *VBoxSettingsTreeViewSelector::widget() const
     return mTwSelector;
 }
 
-QWidget *VBoxSettingsTreeViewSelector::addItem (const QString & /* aBigIcon */,
-                                                const QString & /* aBigIconDisabled */,
-                                                const QString &aSmallIcon,
-                                                const QString &aSmallIconDisabled,
+QWidget *VBoxSettingsTreeViewSelector::addItem (const QString & /* strBigIcon */,
+                                                const QString &strMediumIcon ,
+                                                const QString & /* strSmallIcon */,
                                                 int aId,
                                                 const QString &aLink,
                                                 UISettingsPage* aPage /* = NULL */,
@@ -219,9 +225,7 @@ QWidget *VBoxSettingsTreeViewSelector::addItem (const QString & /* aBigIcon */,
     QWidget *result = NULL;
     if (aPage != NULL)
     {
-        QIcon icon (aSmallIcon);
-        if (aSmallIconDisabled.isEmpty())
-            icon.addFile (aSmallIconDisabled, QSize(), QIcon::Disabled);
+        QIcon icon = UIIconPool::iconSet(strMediumIcon);
 
         SelectorItem *item = new SelectorItem (icon, "", aId, aLink, aPage, aParentId);
         mItemList.append (item);
@@ -287,7 +291,7 @@ void VBoxSettingsTreeViewSelector::polish()
 {
     /* Get recommended size hint: */
     int iItemWidth = static_cast<QAbstractItemView*>(mTwSelector)->sizeHintForColumn(treeWidget_Category);
-    int iItemHeight = qMax(16 /* icon height */, mTwSelector->fontMetrics().height() /* text height */);
+    int iItemHeight = qMax(24 /* icon height */, mTwSelector->fontMetrics().height() /* text height */);
     /* Add some margin to every item in the tree: */
     iItemHeight += 4 /* margin itself */ * 2 /* margin count */;
     /* Set final size hint for items: */
@@ -379,7 +383,7 @@ VBoxSettingsToolBarSelector::VBoxSettingsToolBarSelector (QWidget *aParent /* =
 {
     /* Init the toolbar */
     mTbSelector = new UIToolBar (aParent);
-    mTbSelector->setUsesTextLabel (true);
+    mTbSelector->setUseTextLabels (true);
     mTbSelector->setIconSize (QSize (32, 32));
 #ifdef Q_WS_MAC
     mTbSelector->setShowToolBarButton (false);
@@ -401,18 +405,15 @@ QWidget *VBoxSettingsToolBarSelector::widget() const
     return mTbSelector;
 }
 
-QWidget *VBoxSettingsToolBarSelector::addItem (const QString &aBigIcon,
-                                               const QString &aBigIconDisabled,
-                                               const QString &aSmallIcon,
-                                               const QString &aSmallIconDisabled,
+QWidget *VBoxSettingsToolBarSelector::addItem (const QString &strBigIcon,
+                                               const QString & /* strMediumIcon */,
+                                               const QString &strSmallIcon,
                                                int aId,
                                                const QString &aLink,
                                                UISettingsPage* aPage /* = NULL */,
                                                int aParentId /* = -1 */)
 {
-    QIcon icon (aBigIcon);
-    if (!aBigIconDisabled.isEmpty())
-        icon.addFile (aBigIconDisabled, QSize(), QIcon::Disabled);
+    QIcon icon = UIIconPool::iconSet(strBigIcon);
 
     QWidget *result = NULL;
     SelectorActionItem *item = new SelectorActionItem (icon, "", aId, aLink, aPage, aParentId, this);
@@ -433,6 +434,7 @@ QWidget *VBoxSettingsToolBarSelector::addItem (const QString &aBigIcon,
         mActionGroup->addAction (item->action());
         mTbSelector->addAction (item->action());
         QITabWidget *tabWidget= new QITabWidget();
+        tabWidget->setIconSize(QSize(16, 16));
         tabWidget->setContentsMargins (0, 0, 0, 0);
 //        connect (tabWidget, SIGNAL (currentChanged (int)),
 //                 this, SLOT (settingsGroupChanged (int)));
@@ -447,9 +449,7 @@ QWidget *VBoxSettingsToolBarSelector::addItem (const QString &aBigIcon,
             QTabWidget *tabWidget = parent->tabWidget();
             aPage->setContentsMargins (9, 5, 9, 9);
             aPage->layout()->setContentsMargins(0, 0, 0, 0);
-            QIcon icon1 (aSmallIcon);
-            if (!aSmallIconDisabled.isEmpty())
-                icon1.addFile (aSmallIconDisabled, QSize(), QIcon::Disabled);
+            QIcon icon1 = UIIconPool::iconSet(strSmallIcon);
             if (tabWidget)
                 tabWidget->addTab (aPage, icon1, "");
         }
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.h b/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.h
index da2f5cd..bddf24b 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/VBoxSettingsSelector.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxSettingsSelector.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxSettingsSelector class declaration
+ * VBox Qt GUI - VBoxSettingsSelector class declaration.
  */
 
 /*
@@ -47,7 +46,8 @@ public:
 
     virtual QWidget *widget() const = 0;
 
-    virtual QWidget *addItem (const QString &aBigIcon, const QString &aBigIconDisabled, const QString &aSmallIcon, const QString &aSmallIconDisabled, int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1) = 0;
+    virtual QWidget *addItem (const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,
+                              int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1) = 0;
 
     virtual void setItemText (int aId, const QString &aText);
     virtual QString itemText (int aId) const = 0;
@@ -96,7 +96,8 @@ public:
 
     virtual QWidget *widget() const;
 
-    virtual QWidget *addItem (const QString &aBigIcon, const QString &aBigIconDisabled, const QString &aSmallIcon, const QString &aSmallIconDisabled, int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1);
+    virtual QWidget *addItem (const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,
+                              int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1);
     virtual void setItemText (int aId, const QString &aText);
     virtual QString itemText (int aId) const;
 
@@ -136,7 +137,8 @@ public:
 
     virtual QWidget *widget() const;
 
-    virtual QWidget *addItem (const QString &aBigIcon, const QString &aBigIconDisabled, const QString &aSmallIcon, const QString &aSmallIconDisabled, int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1);
+    virtual QWidget *addItem (const QString &strBigIcon, const QString &strMediumIcon, const QString &strSmallIcon,
+                              int aId, const QString &aLink, UISettingsPage* aPage = NULL, int aParentId = -1);
     virtual void setItemText (int aId, const QString &aText);
     virtual QString itemText (int aId) const;
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
index 7da5891..c5e03d3 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsDisplay.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsDisplay class implementation
+ * VBox Qt GUI - UIGlobalSettingsDisplay class implementation.
  */
 
 /*
@@ -17,9 +15,16 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIGlobalSettingsDisplay.h"
-#include "VBoxGlobal.h"
+# include "UIGlobalSettingsDisplay.h"
+# include "UIExtraDataManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Display page constructor: */
 UIGlobalSettingsDisplay::UIGlobalSettingsDisplay()
@@ -50,12 +55,9 @@ void UIGlobalSettingsDisplay::loadToCacheFrom(QVariant &data)
     /* Fetch data to properties & settings: */
     UISettingsPageGlobal::fetchData(data);
 
-    /* Get VBox instance: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-
     /* Load to cache: */
     m_cache.m_strMaxGuestResolution = m_settings.maxGuestRes();
-    m_cache.m_fActivateHoveredMachineWindow = VBoxGlobal::activateHoveredMachineWindow(vbox);
+    m_cache.m_fActivateHoveredMachineWindow = gEDataManager->activateHoveredMachineWindow();
 
     /* Upload properties & settings to data: */
     UISettingsPageGlobal::uploadData(data);
@@ -125,12 +127,9 @@ void UIGlobalSettingsDisplay::saveFromCacheTo(QVariant &data)
     /* Fetch data to properties & settings: */
     UISettingsPageGlobal::fetchData(data);
 
-    /* Get VBox instance: */
-    CVirtualBox vbox = vboxGlobal().virtualBox();
-
     /* Save from cache: */
     m_settings.setMaxGuestRes(m_cache.m_strMaxGuestResolution);
-    VBoxGlobal::setActivateHoveredMachineWindow(vbox, m_cache.m_fActivateHoveredMachineWindow);
+    gEDataManager->setActivateHoveredMachineWindow(m_cache.m_fActivateHoveredMachineWindow);
 
     /* Upload properties & settings to data: */
     UISettingsPageGlobal::uploadData(data);
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h
index a5d7383..5f7e1f6 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h
@@ -1,7 +1,6 @@
+/* $Id: UIGlobalSettingsDisplay.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsDisplay class declaration
+ * VBox Qt GUI - UIGlobalSettingsDisplay class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
index a1a3fe7..91ac035 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsExtension.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsExtension class implementation
+ * VBox Qt GUI - UIGlobalSettingsExtension class implementation.
  */
 
 /*
@@ -17,21 +15,28 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHeaderView>
+# include <QHeaderView>
 
 /* GUI includes: */
-#include "UIGlobalSettingsExtension.h"
-#include "UIIconPool.h"
-#include "QIFileDialog.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "VBoxLicenseViewer.h"
+# include "UIGlobalSettingsExtension.h"
+# include "UIIconPool.h"
+# include "QIFileDialog.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "VBoxLicenseViewer.h"
 
 /* COM includes: */
-#include "CExtPackManager.h"
-#include "CExtPack.h"
-#include "CExtPackFile.h"
+# include "CExtPackManager.h"
+# include "CExtPack.h"
+# include "CExtPackFile.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Extension package item: */
 class UIExtensionPackageItem : public QTreeWidgetItem
@@ -101,7 +106,6 @@ UIGlobalSettingsExtension::UIGlobalSettingsExtension()
             this, SLOT(sltShowContextMenu(const QPoint&)));
 
     /* Setup tool-bar: */
-    m_pPackagesToolbar->setUsesTextLabel(false);
     m_pPackagesToolbar->setIconSize(QSize(16, 16));
     m_pPackagesToolbar->setOrientation(Qt::Vertical);
     m_pActionAdd = m_pPackagesToolbar->addAction(UIIconPool::iconSet(":/extension_pack_install_16px.png",
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.h
index aa60770..7ca13c4 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.h
@@ -1,7 +1,6 @@
+/* $Id: UIGlobalSettingsExtension.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsExtension class declaration
+ * VBox Qt GUI - UIGlobalSettingsExtension class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
index 4c5f9eb..5d8596d 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsGeneral.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsGeneral class implementation
+ * VBox Qt GUI - UIGlobalSettingsGeneral class implementation.
  */
 
 /*
@@ -17,22 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
+# include <QDir>
 
 /* GUI includes: */
-#include "UIGlobalSettingsGeneral.h"
-#include "VBoxGlobal.h"
+# include "UIGlobalSettingsGeneral.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGlobalSettingsGeneral::UIGlobalSettingsGeneral()
 {
     /* Apply UI decorations: */
     Ui::UIGlobalSettingsGeneral::setupUi(this);
 
-#ifndef Q_WS_MAC
-    m_pLabelPresentationMode->hide();
-    m_pCheckBoxPresentationMode->hide();
-#endif /* !Q_WS_MAC */
     /* Hide checkbox for now: */
     m_pLabelHostScreenSaver->hide();
     m_pCheckBoxHostScreenSaver->hide();
@@ -56,9 +57,6 @@ void UIGlobalSettingsGeneral::loadToCacheFrom(QVariant &data)
     /* Load to cache: */
     m_cache.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder();
     m_cache.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary();
-#ifdef Q_WS_MAC
-    m_cache.m_fPresentationModeEnabled = m_settings.presentationModeEnabled();
-#endif /* Q_WS_MAC */
     m_cache.m_fHostScreenSaverDisabled = m_settings.hostScreenSaverDisabled();
 
     /* Upload properties & settings to data: */
@@ -72,9 +70,6 @@ void UIGlobalSettingsGeneral::getFromCache()
     /* Fetch from cache: */
     m_pSelectorMachineFolder->setPath(m_cache.m_strDefaultMachineFolder);
     m_pSelectorVRDPLibName->setPath(m_cache.m_strVRDEAuthLibrary);
-#ifdef Q_WS_MAC
-    m_pCheckBoxPresentationMode->setChecked(m_cache.m_fPresentationModeEnabled);
-#endif /* Q_WS_MAC */
     m_pCheckBoxHostScreenSaver->setChecked(m_cache.m_fHostScreenSaverDisabled);
 }
 
@@ -85,9 +80,6 @@ void UIGlobalSettingsGeneral::putToCache()
     /* Upload to cache: */
     m_cache.m_strDefaultMachineFolder = m_pSelectorMachineFolder->path();
     m_cache.m_strVRDEAuthLibrary = m_pSelectorVRDPLibName->path();
-#ifdef Q_WS_MAC
-    m_cache.m_fPresentationModeEnabled = m_pCheckBoxPresentationMode->isChecked();
-#endif /* Q_WS_MAC */
     m_cache.m_fHostScreenSaverDisabled = m_pCheckBoxHostScreenSaver->isChecked();
 }
 
@@ -103,9 +95,6 @@ void UIGlobalSettingsGeneral::saveFromCacheTo(QVariant &data)
         m_properties.SetDefaultMachineFolder(m_cache.m_strDefaultMachineFolder);
     if (m_properties.isOk() && m_pSelectorVRDPLibName->isModified())
         m_properties.SetVRDEAuthLibrary(m_cache.m_strVRDEAuthLibrary);
-#ifdef Q_WS_MAC
-    m_settings.setPresentationModeEnabled(m_cache.m_fPresentationModeEnabled);
-#endif /* Q_WS_MAC */
     m_settings.setHostScreenSaverDisabled(m_cache.m_fHostScreenSaverDisabled);
 
     /* Upload properties & settings to data: */
@@ -117,8 +106,7 @@ void UIGlobalSettingsGeneral::setOrderAfter(QWidget *pWidget)
     /* Configure navigation: */
     setTabOrder(pWidget, m_pSelectorMachineFolder);
     setTabOrder(m_pSelectorMachineFolder, m_pSelectorVRDPLibName);
-    setTabOrder(m_pSelectorVRDPLibName, m_pCheckBoxPresentationMode);
-    setTabOrder(m_pCheckBoxPresentationMode, m_pCheckBoxHostScreenSaver);
+    setTabOrder(m_pSelectorVRDPLibName, m_pCheckBoxHostScreenSaver);
 }
 
 void UIGlobalSettingsGeneral::retranslateUi()
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
index dfce7ac..bf00550 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
@@ -1,7 +1,6 @@
+/* $Id: UIGlobalSettingsGeneral.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsGeneral class declaration
+ * VBox Qt GUI - UIGlobalSettingsGeneral class declaration.
  */
 
 /*
@@ -28,9 +27,6 @@ struct UISettingsCacheGlobalGeneral
 {
     QString m_strDefaultMachineFolder;
     QString m_strVRDEAuthLibrary;
-#ifdef Q_WS_MAC
-    bool m_fPresentationModeEnabled;
-#endif /* Q_WS_MAC */
     bool m_fHostScreenSaverDisabled;
 };
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.ui b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.ui
index 54ca27a..7e8b0cf 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.ui
@@ -71,29 +71,6 @@
     </widget>
    </item>
    <item row="2" column="0">
-    <widget class="QLabel" name="m_pLabelPresentationMode">
-     <property name="text">
-      <string>&Dock and Menubar:</string>
-     </property>
-     <property name="alignment">
-      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-     </property>
-     <property name="buddy">
-      <cstring>m_pCheckBoxPresentationMode</cstring>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="1">
-    <widget class="QCheckBox" name="m_pCheckBoxPresentationMode">
-     <property name="text">
-      <string>Auto-Show in Fullscreen</string>
-     </property>
-     <property name="whatsThis">
-      <string>When checked, the host dock and menu bar will be shown when the virtual machine is in fullscreen mode.</string>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0">
     <widget class="QLabel" name="m_pLabelHostScreenSaver">
      <property name="text">
       <string>&Host Screensaver:</string>
@@ -106,7 +83,7 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="1">
+   <item row="2" column="1">
     <widget class="QCheckBox" name="m_pCheckBoxHostScreenSaver">
      <property name="whatsThis">
       <string>When checked, the host screensaver will be disabled whenever a virtual machine is running.</string>
@@ -116,7 +93,7 @@
      </property>
     </widget>
    </item>
-   <item row="4" column="0" colspan="3">
+   <item row="3" column="0" colspan="3">
     <spacer>
      <property name="orientation">
       <enum>Qt::Vertical</enum>
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
index 9c880b5..fc9173c 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsInput.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsInput class implementation
+ * VBox Qt GUI - UIGlobalSettingsInput class implementation.
  */
 
 /*
@@ -17,21 +15,33 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QShortcut>
-#include <QHeaderView>
-#include <QAbstractItemDelegate>
-#include <QStyledItemDelegate>
-#include <QItemEditorFactory>
-#include <QTabWidget>
+# include <QHeaderView>
+# include <QAbstractItemDelegate>
+# include <QItemEditorFactory>
+# include <QTabWidget>
 
 /* GUI includes: */
-#include "QIWidgetValidator.h"
-#include "UIGlobalSettingsInput.h"
-#include "UIShortcutPool.h"
-#include "UIHotKeyEditor.h"
-#include "UIHostComboEditor.h"
-#include "VBoxGlobalSettings.h"
+# include "QIWidgetValidator.h"
+# include "QIStyledItemDelegate.h"
+# include "UIGlobalSettingsInput.h"
+# include "UIShortcutPool.h"
+# include "UIHotKeyEditor.h"
+# include "UIHostComboEditor.h"
+# include "VBoxGlobalSettings.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QShortcut>
+
+
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+
 
 /* Input page constructor: */
 UIGlobalSettingsInput::UIGlobalSettingsInput()
@@ -52,11 +62,15 @@ UIGlobalSettingsInput::UIGlobalSettingsInput()
     m_pTabWidget->insertTab(UIHotKeyTableIndex_Selector, pSelectorTab, QString());
     m_pSelectorFilterEditor = new QLineEdit(pSelectorTab);
     m_pSelectorModel = new UIHotKeyTableModel(this, UIActionPoolType_Selector);
-    m_pSelectorTable = new UIHotKeyTable(pSelectorTab, m_pSelectorModel);
+    m_pSelectorTable = new UIHotKeyTable(pSelectorTab, m_pSelectorModel, "m_pSelectorTable");
     connect(m_pSelectorFilterEditor, SIGNAL(textChanged(const QString &)),
             m_pSelectorModel, SLOT(sltHandleFilterTextChange(const QString &)));
     QVBoxLayout *pSelectorLayout = new QVBoxLayout(pSelectorTab);
+#ifndef Q_WS_WIN
+    /* On Windows host that looks ugly, but
+     * On Mac OS X and X11 that deserves it's place. */
     pSelectorLayout->setContentsMargins(0, 0, 0, 0);
+#endif /* !Q_WS_WIN */
     pSelectorLayout->setSpacing(1);
     pSelectorLayout->addWidget(m_pSelectorFilterEditor);
     pSelectorLayout->addWidget(m_pSelectorTable);
@@ -68,11 +82,15 @@ UIGlobalSettingsInput::UIGlobalSettingsInput()
     m_pTabWidget->insertTab(UIHotKeyTableIndex_Machine, pMachineTab, QString());
     m_pMachineFilterEditor = new QLineEdit(pMachineTab);
     m_pMachineModel = new UIHotKeyTableModel(this, UIActionPoolType_Runtime);
-    m_pMachineTable = new UIHotKeyTable(pMachineTab, m_pMachineModel);
+    m_pMachineTable = new UIHotKeyTable(pMachineTab, m_pMachineModel, "m_pMachineTable");
     connect(m_pMachineFilterEditor, SIGNAL(textChanged(const QString &)),
             m_pMachineModel, SLOT(sltHandleFilterTextChange(const QString &)));
     QVBoxLayout *pMachineLayout = new QVBoxLayout(pMachineTab);
+#ifndef Q_WS_WIN
+    /* On Windows host that looks ugly, but
+     * On Mac OS X and X11 that deserves it's place. */
     pMachineLayout->setContentsMargins(0, 0, 0, 0);
+#endif /* !Q_WS_WIN */
     pMachineLayout->setSpacing(1);
     pMachineLayout->addWidget(m_pMachineFilterEditor);
     pMachineLayout->addWidget(m_pMachineTable);
@@ -533,39 +551,12 @@ void UIHotKeyTableModel::applyFilter()
 }
 
 
-/** Own QStyledItemDelegate implementation. */
-class UIStyledItemDelegate : public QStyledItemDelegate
-{
-    Q_OBJECT;
-
-public:
-
-    /** Constructor. */
-    UIStyledItemDelegate(QObject *pParent) : QStyledItemDelegate(pParent) {}
-
-private:
-
-    /** Returns the widget used to edit the item specified by @a index for editing.
-      * The @a pParent widget and style @a option are used to control how the editor widget appears.
-      * Besides Qt description copy-pasted above we are installing the hook to redirect editor's sigCommitData signal. */
-    QWidget* createEditor(QWidget *pParent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
-};
-
-QWidget* UIStyledItemDelegate::createEditor(QWidget *pParent, const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
-    /* Call to base-class to get actual editor created: */
-    QWidget *pEditor = QStyledItemDelegate::createEditor(pParent, option, index);
-    /* All the stuff we actually need from UIStyledItemDelegate is to redirect this one signal: */
-    if (qobject_cast<UIHotKeyEditor*>(pEditor) || qobject_cast<UIHostComboEditor*>(pEditor))
-        connect(pEditor, SIGNAL(sigCommitData(QWidget*)), this, SIGNAL(commitData(QWidget*)));
-    /* Return actual editor: */
-    return pEditor;
-}
-
-
-UIHotKeyTable::UIHotKeyTable(QWidget *pParent, UIHotKeyTableModel *pModel)
+UIHotKeyTable::UIHotKeyTable(QWidget *pParent, UIHotKeyTableModel *pModel, const QString &strObjectName)
     : QTableView(pParent)
 {
+    /* Set object name: */
+    setObjectName(strObjectName);
+
     /* Connect model: */
     setModel(pModel);
     connect(pModel, SIGNAL(sigShortcutsLoaded()), this, SLOT(sltHandleShortcutsLoaded()));
@@ -586,7 +577,7 @@ UIHotKeyTable::UIHotKeyTable(QWidget *pParent, UIHotKeyTableModel *pModel)
 
     /* Reinstall delegate: */
     delete itemDelegate();
-    UIStyledItemDelegate *pStyledItemDelegate = new UIStyledItemDelegate(this);
+    QIStyledItemDelegate *pStyledItemDelegate = new QIStyledItemDelegate(this);
     setItemDelegate(pStyledItemDelegate);
 
     /* Create new item editor factory: */
@@ -616,5 +607,3 @@ void UIHotKeyTable::sltHandleShortcutsLoaded()
     setSortingEnabled(true);
 }
 
-#include "UIGlobalSettingsInput.moc"
-
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
index 6899da2..6c2a84f 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
@@ -1,7 +1,6 @@
+/* $Id: UIGlobalSettingsInput.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsInput class declaration
+ * VBox Qt GUI - UIGlobalSettingsInput class declaration.
  */
 
 /*
@@ -241,7 +240,7 @@ class UIHotKeyTable : public QTableView
 public:
 
     /* Constructor: */
-    UIHotKeyTable(QWidget *pParent, UIHotKeyTableModel *pModel);
+    UIHotKeyTable(QWidget *pParent, UIHotKeyTableModel *pModel, const QString &strObjectName);
 
 private slots:
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.ui b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.ui
index 9ab9796..5deb837 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.ui
@@ -15,9 +15,6 @@
  <class>UIGlobalSettingsInput</class>
  <widget class="QWidget" name="UIGlobalSettingsInput">
   <layout class="QGridLayout" name="m_pMainLayout">
-   <property name="margin">
-    <number>0</number>
-   </property>
    <item row="1" column="0">
     <widget class="QCheckBox" name="m_pEnableAutoGrabCheckbox">
      <property name="whatsThis">
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp
index e3c1995..64c683d 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsLanguage.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsLanguage class implementation
+ * VBox Qt GUI - UIGlobalSettingsLanguage class implementation.
  */
 
 /*
@@ -17,22 +15,30 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
-#include <QHeaderView>
-#include <QPainter>
-#include <QTranslator>
+# include <QDir>
+# include <QHeaderView>
+# include <QPainter>
+# include <QTranslator>
 
 /* GUI includes: */
-#include "UIGlobalSettingsLanguage.h"
-#include "VBoxGlobalSettings.h"
-#include "VBoxGlobal.h"
+# include "UIGlobalSettingsLanguage.h"
+# include "VBoxGlobalSettings.h"
+# include "VBoxGlobal.h"
 
 /* Other VBox includes: */
+# include <iprt/param.h>
+# include <iprt/path.h>
+# include <VBox/version.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #include <iprt/err.h>
-#include <iprt/param.h>
-#include <iprt/path.h>
-#include <VBox/version.h>
+
 
 extern const char *gVBoxLangSubDir;
 extern const char *gVBoxLangFileBase;
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h
index 76f0b11..0f44d55 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h
@@ -1,7 +1,6 @@
+/* $Id: UIGlobalSettingsLanguage.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsLanguage class declaration
+ * VBox Qt GUI - UIGlobalSettingsLanguage class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
index 2dc720b..c91947d 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsNetwork.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsNetwork class implementation
+ * VBox Qt GUI - UIGlobalSettingsNetwork class implementation.
  */
 
 /*
@@ -17,26 +15,35 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHeaderView>
-#include <QHostAddress>
+# include <QHeaderView>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIIconPool.h"
-#include "UIConverter.h"
-#include "UIMessageCenter.h"
-#include "UIGlobalSettingsNetwork.h"
-#include "UIGlobalSettingsNetworkDetailsNAT.h"
-#include "UIGlobalSettingsNetworkDetailsHost.h"
+# include "VBoxGlobal.h"
+# include "UIIconPool.h"
+# include "UIConverter.h"
+# include "UIMessageCenter.h"
+# include "UIGlobalSettingsNetwork.h"
+# include "UIGlobalSettingsNetworkDetailsNAT.h"
+# include "UIGlobalSettingsNetworkDetailsHost.h"
 
 /* COM includes: */
-#include "CNATNetwork.h"
-#include "CHostNetworkInterface.h"
-#include "CDHCPServer.h"
+# include "CNATNetwork.h"
+# include "CHostNetworkInterface.h"
 
 /* Other VBox includes: */
-#include "iprt/cidr.h"
+# include <iprt/cidr.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QHostAddress>
+
+#include "CDHCPServer.h"
+
 
 
 /* Global settings / Network page / NAT network item: */
@@ -450,7 +457,6 @@ UIGlobalSettingsNetwork::UIGlobalSettingsNetwork()
 
     /* Prepare NAT network toolbar: */
     {
-        m_pToolbarNetworkNAT->setUsesTextLabel(false);
         m_pToolbarNetworkNAT->setIconSize(QSize(16, 16));
         m_pToolbarNetworkNAT->setOrientation(Qt::Vertical);
         m_pToolbarNetworkNAT->addAction(m_pActionAddNetworkNAT);
@@ -459,7 +465,6 @@ UIGlobalSettingsNetwork::UIGlobalSettingsNetwork()
     }
     /* Prepare Host network toolbar: */
     {
-        m_pToolbarNetworkHost->setUsesTextLabel(false);
         m_pToolbarNetworkHost->setIconSize(QSize(16, 16));
         m_pToolbarNetworkHost->setOrientation(Qt::Vertical);
         m_pToolbarNetworkHost->addAction(m_pActionAddNetworkHost);
@@ -467,6 +472,13 @@ UIGlobalSettingsNetwork::UIGlobalSettingsNetwork()
         m_pToolbarNetworkHost->addAction(m_pActionEditNetworkHost);
     }
 
+#ifndef Q_WS_WIN
+    /* On Windows host that looks ugly, but
+     * On Mac OS X and X11 that deserves it's place. */
+    m_pLayoutNAT->setContentsMargins(0, 0, 0, 0);
+    m_pLayoutHostOnly->setContentsMargins(0, 0, 0, 0);
+#endif /* !Q_WS_WIN */
+
     /* Apply language settings: */
     retranslateUi();
 }
@@ -775,7 +787,7 @@ void UIGlobalSettingsNetwork::sltAddNetworkHost()
     CProgress progress = host.CreateHostOnlyNetworkInterface(iface);
     if (!host.isOk())
         return msgCenter().cannotCreateHostInterface(host, this);
-    msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/nw_32px.png", this, 0); // TODO: Change icon!
+    msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/progress_network_interface_90px.png", this, 0);
     if (!progress.isOk() || progress.GetResultCode() != 0)
         return msgCenter().cannotCreateHostInterface(progress, this);
 
@@ -827,7 +839,7 @@ void UIGlobalSettingsNetwork::sltDelNetworkHost()
     CProgress progress = host.RemoveHostOnlyNetworkInterface(iface.GetId());
     if (!host.isOk())
         return msgCenter().cannotRemoveHostInterface(host, strInterfaceName, this);
-    msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/nw_32px.png", this, 0); // TODO: Change icon!
+    msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/progress_network_interface_90px.png", this, 0);
     if (!progress.isOk() || progress.GetResultCode() != 0)
         return msgCenter().cannotRemoveHostInterface(progress, strInterfaceName, this);
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h
index f7dcae2..8a8c8c0 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.h
@@ -1,7 +1,6 @@
+/* $Id:  $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsNetwork class declaration
+ * VBox Qt GUI - UIGlobalSettingsNetwork class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.ui b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.ui
index 429497b..9435234 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.ui
@@ -21,10 +21,7 @@
       <attribute name="title">
        <string>&NAT Networks</string>
       </attribute>
-      <layout class="QHBoxLayout">
-       <property name="margin">
-        <number>0</number>
-       </property>
+      <layout class="QHBoxLayout" name="m_pLayoutNAT">
        <property name="spacing">
         <number>3</number>
        </property>
@@ -59,10 +56,7 @@
       <attribute name="title">
        <string>&Host-only Networks</string>
       </attribute>
-      <layout class="QHBoxLayout">
-       <property name="margin">
-        <number>0</number>
-       </property>
+      <layout class="QHBoxLayout" name="m_pLayoutHostOnly">
        <property name="spacing">
         <number>3</number>
        </property>
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp
index adc953e..9bde833 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsNetworkDetailsHost.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsNetworkDetailsHost class implementation
+ * VBox Qt GUI - UIGlobalSettingsNetworkDetailsHost class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QRegExpValidator>
+# include <QRegExpValidator>
 
 /* GUI includes: */
-#include "UIGlobalSettingsNetwork.h"
-#include "UIGlobalSettingsNetworkDetailsHost.h"
+# include "UIGlobalSettingsNetwork.h"
+# include "UIGlobalSettingsNetworkDetailsHost.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGlobalSettingsNetworkDetailsHost::UIGlobalSettingsNetworkDetailsHost(QWidget *pParent, UIDataNetworkHost &data)
     : QIWithRetranslateUI2<QIDialog>(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.h
index 2eccbaa..351485e 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsHost.h
@@ -1,7 +1,6 @@
+/* $Id:  $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsNetworkDetailsHost class declaration
+ * VBox Qt GUI - UIGlobalSettingsNetworkDetailsHost class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.cpp
index 60e5de7..a4d0975 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsNetworkDetailsNAT.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsNetworkDetailsNAT class implementation
+ * VBox Qt GUI - UIGlobalSettingsNetworkDetailsNAT class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QRegExpValidator>
+# include <QRegExpValidator>
 
 /* GUI includes: */
-#include "UIGlobalSettingsNetwork.h"
-#include "UIGlobalSettingsNetworkDetailsNAT.h"
-#include "UIGlobalSettingsPortForwardingDlg.h"
+# include "UIGlobalSettingsNetwork.h"
+# include "UIGlobalSettingsNetworkDetailsNAT.h"
+# include "UIGlobalSettingsPortForwardingDlg.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGlobalSettingsNetworkDetailsNAT::UIGlobalSettingsNetworkDetailsNAT(QWidget *pParent, UIDataNetworkNAT &data)
     : QIWithRetranslateUI2<QIDialog>(pParent)
@@ -62,8 +67,11 @@ void UIGlobalSettingsNetworkDetailsNAT::retranslateUi()
     Ui::UIGlobalSettingsNetworkDetailsNAT::retranslateUi(this);
 }
 
-void UIGlobalSettingsNetworkDetailsNAT::polishEvent(QShowEvent*)
+void UIGlobalSettingsNetworkDetailsNAT::polishEvent(QShowEvent *pEvent)
 {
+    /* Call to base-class: */
+    QIWithRetranslateUI2<QIDialog>::polishEvent(pEvent);
+
     /* Update availability: */
     m_pCheckboxAdvertiseDefaultIPv6Route->setEnabled(m_pCheckboxSupportsIPv6->isChecked());
     m_pContainerOptions->setEnabled(m_pCheckboxNetwork->isChecked());
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h
index bcd1218..85a1524 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetworkDetailsNAT.h
@@ -1,7 +1,6 @@
+/* $Id:  $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsNetworkDetailsNAT class declaration
+ * VBox Qt GUI - UIGlobalSettingsNetworkDetailsNAT class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp
index aaaeced..5ca658f 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsPortForwardingDlg.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsPortForwardingDlg class implementation
+ * VBox Qt GUI - UIGlobalSettingsPortForwardingDlg class implementation.
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QPushButton>
-#include <QTabWidget>
+# include <QVBoxLayout>
+# include <QPushButton>
+# include <QTabWidget>
 
 /* GUI includes: */
-#include "UIGlobalSettingsPortForwardingDlg.h"
-#include "UIIconPool.h"
-#include "QIDialogButtonBox.h"
+# include "UIGlobalSettingsPortForwardingDlg.h"
+# include "UIIconPool.h"
+# include "QIDialogButtonBox.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGlobalSettingsPortForwardingDlg::UIGlobalSettingsPortForwardingDlg(QWidget *pParent,
                                                                      const UIPortForwardingDataList &ipv4rules,
@@ -36,7 +41,7 @@ UIGlobalSettingsPortForwardingDlg::UIGlobalSettingsPortForwardingDlg(QWidget *pP
     , m_pButtonBox(0)
 {
     /* Set dialog icon: */
-    setWindowIcon(UIIconPool::iconSetFull(QSize(32, 32), QSize(16, 16), ":/nw_32px.png", ":/nw_16px.png"));
+    setWindowIcon(UIIconPool::iconSetFull(":/nw_32px.png", ":/nw_16px.png"));
 
     /* Create layout: */
     QVBoxLayout *pMainLayout = new QVBoxLayout(this);
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.h
index 321c8ed..ebc9a23 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.h
@@ -1,7 +1,6 @@
+/* $Id: UIGlobalSettingsPortForwardingDlg.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsPortForwardingDlg class declaration
+ * VBox Qt GUI - UIMachineSettingsPortForwardingDlg class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
index 696e7d4..da75e7c 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsProxy.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsProxy class implementation
+ * VBox Qt GUI - UIGlobalSettingsProxy class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes */
-#include <QRegExpValidator>
+# include <QRegExpValidator>
 
 /* Local includes */
-#include "QIWidgetValidator.h"
-#include "UIGlobalSettingsProxy.h"
-#include "VBoxUtils.h"
+# include "QIWidgetValidator.h"
+# include "UIGlobalSettingsProxy.h"
+# include "VBoxUtils.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* General page constructor: */
 UIGlobalSettingsProxy::UIGlobalSettingsProxy()
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
index de97420..ef072ba 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
@@ -1,7 +1,6 @@
+/* $Id: UIGlobalSettingsProxy.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsProxy class declaration
+ * VBox Qt GUI - UIGlobalSettingsProxy class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp
index 5303c8c..d2a1b5b 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGlobalSettingsUpdate.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsUpdate class implementation
+ * VBox Qt GUI - UIGlobalSettingsUpdate class implementation.
  */
 
 /*
@@ -17,9 +15,17 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIGlobalSettingsUpdate.h"
-#include "VBoxGlobal.h"
+# include "UIGlobalSettingsUpdate.h"
+# include "UIExtraDataManager.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGlobalSettingsUpdate::UIGlobalSettingsUpdate()
     : m_pLastChosenRadio(0)
@@ -47,7 +53,7 @@ void UIGlobalSettingsUpdate::loadToCacheFrom(QVariant &data)
     UISettingsPageGlobal::fetchData(data);
 
     /* Fill internal variables with corresponding values: */
-    VBoxUpdateData updateData(vboxGlobal().virtualBox().GetExtraData(GUI_UpdateDate));
+    VBoxUpdateData updateData(gEDataManager->applicationUpdateData());
     m_cache.m_fCheckEnabled = !updateData.isNoNeedToCheck();
     m_cache.m_periodIndex = updateData.periodIndex();
     m_cache.m_branchIndex = updateData.branchIndex();
@@ -102,7 +108,7 @@ void UIGlobalSettingsUpdate::saveFromCacheTo(QVariant &data)
 
     /* Gather corresponding values from internal variables: */
     VBoxUpdateData newData(m_cache.m_periodIndex, m_cache.m_branchIndex);
-    vboxGlobal().virtualBox().SetExtraData(GUI_UpdateDate, newData.data());
+    gEDataManager->setApplicationUpdateData(newData.data());
 
     /* Upload properties & settings to data: */
     UISettingsPageGlobal::uploadData(data);
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h
index 62c392a..137e100 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h
@@ -1,7 +1,6 @@
+/* $Id: UIGlobalSettingsUpdate.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIGlobalSettingsUpdate class declaration
+ * VBox Qt GUI - UIGlobalSettingsUpdate class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
index 50cf2df..1260385 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsAudio.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsAudio class implementation
+ * VBox Qt GUI - UIMachineSettingsAudio class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIMachineSettingsAudio.h"
-#include "UIConverter.h"
+# include "UIMachineSettingsAudio.h"
+# include "UIConverter.h"
 
 /* COM includes: */
-#include "CAudioAdapter.h"
+# include "CAudioAdapter.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineSettingsAudio::UIMachineSettingsAudio()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
index e1d986b..1c199cd 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsAudio.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsAudio.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsAudio class declaration
+ * VBox Qt GUI - UIMachineSettingsAudio class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
index f7ac883..2e7240d 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMachineSettingsDisplay.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsDisplay class implementation
+ * VBox Qt GUI - UIMachineSettingsDisplay class implementation.
  */
 
 /*
- * Copyright (C) 2008-2013 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,20 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDesktopWidget>
+# include <QDesktopWidget>
 
 /* GUI includes: */
-#include "QIWidgetValidator.h"
-#include "UIMachineSettingsDisplay.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIConverter.h"
+# include "QIWidgetValidator.h"
+# include "UIMachineSettingsDisplay.h"
+# include "UIExtraDataManager.h"
+# include "UIConverter.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "CVRDEServer.h"
-#include "CExtPackManager.h"
-#include "CExtPack.h"
+# include "CVRDEServer.h"
+# include "CExtPackManager.h"
+# include "CExtPack.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 UIMachineSettingsDisplay::UIMachineSettingsDisplay()
     : m_iMinVRAM(0)
@@ -95,9 +99,13 @@ void UIMachineSettingsDisplay::loadToCacheFrom(QVariant &data)
     /* Prepare display data: */
     UIDataSettingsMachineDisplay displayData;
 
-    /* Cache Video data: */
+    /* Cache Screen data: */
     displayData.m_iCurrentVRAM = m_machine.GetVRAMSize();
     displayData.m_cGuestScreenCount = m_machine.GetMonitorCount();
+    displayData.m_dScaleFactor = gEDataManager->scaleFactor(m_machine.GetId());
+#ifdef Q_WS_MAC
+    displayData.m_fUseUnscaledHiDPIOutput = gEDataManager->useUnscaledHiDPIOutput(m_machine.GetId());
+#endif /* Q_WS_MAC */
     displayData.m_f3dAccelerationEnabled = m_machine.GetAccelerate3DEnabled();
 #ifdef VBOX_WITH_VIDEOHWACCEL
     displayData.m_f2dAccelerationEnabled = m_machine.GetAccelerate2DVideoEnabled();
@@ -143,8 +151,12 @@ void UIMachineSettingsDisplay::getFromCache()
     /* Get display data from cache: */
     const UIDataSettingsMachineDisplay &displayData = m_cache.base();
 
-    /* Load Video data to page: */
+    /* Load Screen data to page: */
     m_pEditorVideoScreenCount->setValue(displayData.m_cGuestScreenCount);
+    m_pEditorGuestScreenScale->setValue(displayData.m_dScaleFactor * 100);
+#ifdef Q_WS_MAC
+    m_pCheckBoxUnscaledHiDPIOutput->setChecked(displayData.m_fUseUnscaledHiDPIOutput);
+#endif /* Q_WS_MAC */
     m_pCheckbox3D->setChecked(displayData.m_f3dAccelerationEnabled);
 #ifdef VBOX_WITH_VIDEOHWACCEL
     m_pCheckbox2DVideo->setChecked(displayData.m_f2dAccelerationEnabled);
@@ -184,12 +196,16 @@ void UIMachineSettingsDisplay::getFromCache()
  * this task SHOULD be performed in GUI thread only: */
 void UIMachineSettingsDisplay::putToCache()
 {
-    /* Prepare audio data: */
+    /* Prepare display data: */
     UIDataSettingsMachineDisplay displayData = m_cache.base();
 
-    /* Gather Video data from page: */
+    /* Gather Screen data from page: */
     displayData.m_iCurrentVRAM = m_pEditorVideoMemorySize->value();
     displayData.m_cGuestScreenCount = m_pEditorVideoScreenCount->value();
+    displayData.m_dScaleFactor = (double)m_pEditorGuestScreenScale->value() / 100;
+#ifdef Q_WS_MAC
+    displayData.m_fUseUnscaledHiDPIOutput = m_pCheckBoxUnscaledHiDPIOutput->isChecked();
+#endif /* Q_WS_MAC */
     displayData.m_f3dAccelerationEnabled = m_pCheckbox3D->isChecked();
 #ifdef VBOX_WITH_VIDEOHWACCEL
     displayData.m_f2dAccelerationEnabled = m_pCheckbox2DVideo->isChecked();
@@ -232,10 +248,9 @@ void UIMachineSettingsDisplay::saveFromCacheTo(QVariant &data)
         /* Get display data from cache: */
         const UIDataSettingsMachineDisplay &displayData = m_cache.data();
 
-        /* Make sure machine is 'offline': */
+        /* Store Screen data: */
         if (isMachineOffline())
         {
-            /* Store Video data: */
             m_machine.SetVRAMSize(displayData.m_iCurrentVRAM);
             m_machine.SetMonitorCount(displayData.m_cGuestScreenCount);
             m_machine.SetAccelerate3DEnabled(displayData.m_f3dAccelerationEnabled);
@@ -243,6 +258,13 @@ void UIMachineSettingsDisplay::saveFromCacheTo(QVariant &data)
             m_machine.SetAccelerate2DVideoEnabled(displayData.m_f2dAccelerationEnabled);
 #endif /* VBOX_WITH_VIDEOHWACCEL */
         }
+        if (isMachineInValidMode())
+        {
+            gEDataManager->setScaleFactor(displayData.m_dScaleFactor, m_machine.GetId());
+#ifdef Q_WS_MAC
+            gEDataManager->setUseUnscaledHiDPIOutput(displayData.m_fUseUnscaledHiDPIOutput, m_machine.GetId());
+#endif /* Q_WS_MAC */
+        }
 
         /* Check if Remote Display server still valid: */
         CVRDEServer remoteDisplayServer = m_machine.GetVRDEServer();
@@ -310,7 +332,7 @@ bool UIMachineSettingsDisplay::validate(QList<UIValidationMessage> &messages)
     /* Pass by default: */
     bool fPass = true;
 
-    /* Video tab: */
+    /* Screen tab: */
     {
         /* Prepare message: */
         UIValidationMessage message;
@@ -362,7 +384,7 @@ bool UIMachineSettingsDisplay::validate(QList<UIValidationMessage> &messages)
                 {
                     message.second << tr("The virtual machine is set up to use hardware graphics acceleration "
                                          "and the operating system hint is set to Windows Vista or later. "
-                                         "For best performance you should set the machine's video memory to at least b>%1</b>.")
+                                         "For best performance you should set the machine's video memory to at least <b>%1</b>.")
                                          .arg(vboxGlobal().formatSize(uNeedBytes, 0, FormatSize_RoundUp));
                 }
             }
@@ -391,11 +413,12 @@ bool UIMachineSettingsDisplay::validate(QList<UIValidationMessage> &messages)
         message.first = VBoxGlobal::removeAccelMark(m_pTabWidget->tabText(1));
 
 #ifdef VBOX_WITH_EXTPACK
+        /* VRDE Extension Pack presence test: */
         CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
         if (m_pCheckboxRemoteDisplay->isChecked() && (extPack.isNull() || !extPack.GetUsable()))
         {
             message.second << tr("Remote Display is currently enabled for this virtual machine. "
-                                 "However, this requires the <b>%1</b> to be installed. "
+                                 "However, this requires the <i>%1</i> to be installed. "
                                  "Please install the Extension Pack from the VirtualBox download site as "
                                  "otherwise your VM will be started with Remote Display disabled.")
                                  .arg(GUI_ExtPackName);
@@ -427,13 +450,16 @@ bool UIMachineSettingsDisplay::validate(QList<UIValidationMessage> &messages)
 
 void UIMachineSettingsDisplay::setOrderAfter(QWidget *pWidget)
 {
-    /* Video tab-order */
+    /* Screen tab-order: */
     setTabOrder(pWidget, m_pTabWidget->focusProxy());
     setTabOrder(m_pTabWidget->focusProxy(), m_pSliderVideoMemorySize);
     setTabOrder(m_pSliderVideoMemorySize, m_pEditorVideoMemorySize);
     setTabOrder(m_pEditorVideoMemorySize, m_pSliderVideoScreenCount);
     setTabOrder(m_pSliderVideoScreenCount, m_pEditorVideoScreenCount);
-    setTabOrder(m_pEditorVideoScreenCount, m_pCheckbox3D);
+    setTabOrder(m_pEditorVideoScreenCount, m_pSliderGuestScreenScale);
+    setTabOrder(m_pSliderGuestScreenScale, m_pEditorGuestScreenScale);
+    setTabOrder(m_pEditorGuestScreenScale, m_pCheckBoxUnscaledHiDPIOutput);
+    setTabOrder(m_pCheckBoxUnscaledHiDPIOutput, m_pCheckbox3D);
 #ifdef VBOX_WITH_VIDEOHWACCEL
     setTabOrder(m_pCheckbox3D, m_pCheckbox2DVideo);
     setTabOrder(m_pCheckbox2DVideo, m_pCheckboxRemoteDisplay);
@@ -461,10 +487,10 @@ void UIMachineSettingsDisplay::setOrderAfter(QWidget *pWidget)
 
 void UIMachineSettingsDisplay::retranslateUi()
 {
-    /* Translate uic generated strings */
+    /* Translate uic generated strings: */
     Ui::UIMachineSettingsDisplay::retranslateUi(this);
 
-    /* Video stuff: */
+    /* Screen stuff: */
     CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
     m_pLabelVideoMemorySizeMin->setText(tr("<qt>%1 MB</qt>").arg(m_iMinVRAM));
     m_pLabelVideoMemorySizeMax->setText(tr("<qt>%1 MB</qt>").arg(m_iMaxVRAMVisible));
@@ -485,6 +511,8 @@ void UIMachineSettingsDisplay::retranslateUi()
     m_pLabelVideoCaptureQualityMed->setText(tr("medium", "quality"));
     m_pLabelVideoCaptureQualityMax->setText(tr("high", "quality"));
     m_pLabelVideoCaptureBitRateUnits->setText(tr("kbps"));
+
+    updateVideoCaptureSizeHint();
 }
 
 void UIMachineSettingsDisplay::polishPage()
@@ -492,11 +520,37 @@ void UIMachineSettingsDisplay::polishPage()
     /* Get system data from cache: */
     const UIDataSettingsMachineDisplay &displayData = m_cache.base();
 
-    /* Video tab: */
-    m_pContainerVideo->setEnabled(isMachineOffline());
+    /* Screen tab: */
+    m_pLabelVideoMemorySize->setEnabled(isMachineOffline());
+    m_pSliderVideoMemorySize->setEnabled(isMachineOffline());
+    m_pLabelVideoMemorySizeMin->setEnabled(isMachineOffline());
+    m_pLabelVideoMemorySizeMax->setEnabled(isMachineOffline());
+    m_pEditorVideoMemorySize->setEnabled(isMachineOffline());
+    m_pLabelVideoMemoryUnit->setEnabled(isMachineOffline());
+    m_pLabelVideoScreenCount->setEnabled(isMachineOffline());
+    m_pSliderVideoScreenCount->setEnabled(isMachineOffline());
+    m_pLabelVideoScreenCountMin->setEnabled(isMachineOffline());
+    m_pLabelVideoScreenCountMax->setEnabled(isMachineOffline());
+    m_pEditorVideoScreenCount->setEnabled(isMachineOffline());
+    m_pLabelGuestScreenScale->setEnabled(isMachineInValidMode());
+    m_pSliderGuestScreenScale->setEnabled(isMachineInValidMode());
+    m_pLabelGuestScreenScaleMin->setEnabled(isMachineInValidMode());
+    m_pLabelGuestScreenScaleMax->setEnabled(isMachineInValidMode());
+    m_pEditorGuestScreenScale->setEnabled(isMachineInValidMode());
+#ifdef Q_WS_MAC
+    m_pLabelHiDPI->setEnabled(isMachineInValidMode());
+    m_pCheckBoxUnscaledHiDPIOutput->setEnabled(isMachineInValidMode());
+#else /* !Q_WS_MAC */
+    m_pLabelHiDPI->hide();
+    m_pCheckBoxUnscaledHiDPIOutput->hide();
+#endif /* !Q_WS_MAC */
+    m_pLabelVideoOptions->setEnabled(isMachineOffline());
+    m_pCheckbox3D->setEnabled(isMachineOffline());
 #ifdef VBOX_WITH_VIDEOHWACCEL
-    m_pCheckbox2DVideo->setEnabled(VBoxGlobal::isAcceleration2DVideoAvailable());
-#endif /* VBOX_WITH_VIDEOHWACCEL */
+    m_pCheckbox2DVideo->setEnabled(isMachineOffline() && VBoxGlobal::isAcceleration2DVideoAvailable());
+#else /* !VBOX_WITH_VIDEOHWACCEL */
+    m_pCheckbox2DVideo->hide();
+#endif /* !VBOX_WITH_VIDEOHWACCEL */
 
     /* Remote Display tab: */
     m_pTabWidget->setTabEnabled(1, displayData.m_fRemoteDisplayServerSupported);
@@ -566,6 +620,22 @@ void UIMachineSettingsDisplay::sltHandleVideoScreenCountEditorChange()
     revalidate();
 }
 
+void UIMachineSettingsDisplay::sltHandleGuestScreenScaleSliderChange()
+{
+    /* Apply proposed scale-factor: */
+    m_pEditorGuestScreenScale->blockSignals(true);
+    m_pEditorGuestScreenScale->setValue(m_pSliderGuestScreenScale->value());
+    m_pEditorGuestScreenScale->blockSignals(false);
+}
+
+void UIMachineSettingsDisplay::sltHandleGuestScreenScaleEditorChange()
+{
+    /* Apply proposed scale-factor: */
+    m_pSliderGuestScreenScale->blockSignals(true);
+    m_pSliderGuestScreenScale->setValue(m_pEditorGuestScreenScale->value());
+    m_pSliderGuestScreenScale->blockSignals(false);
+}
+
 void UIMachineSettingsDisplay::sltHandleVideoCaptureCheckboxToggle()
 {
     /* Video Capture options should be enabled only if:
@@ -597,6 +667,7 @@ void UIMachineSettingsDisplay::sltHandleVideoCaptureCheckboxToggle()
     m_pLabelVideoCaptureBitRateUnits->setEnabled(fIsVideoCaptureOptionsEnabled);
 
     m_pLabelVideoCaptureScreens->setEnabled(fIsVideoCaptureScreenOptionEnabled);
+    m_pLabelVideoCaptureSizeHint->setEnabled(fIsVideoCaptureScreenOptionEnabled);
     m_pScrollerVideoCaptureScreens->setEnabled(fIsVideoCaptureScreenOptionEnabled);
 }
 
@@ -660,6 +731,7 @@ void UIMachineSettingsDisplay::sltHandleVideoCaptureQualitySliderChange()
                                                             m_pEditorVideoCaptureFrameRate->value(),
                                                             m_pSliderVideoCaptureQuality->value()));
     m_pEditorVideoCaptureBitRate->blockSignals(false);
+    updateVideoCaptureSizeHint();
 }
 
 void UIMachineSettingsDisplay::sltHandleVideoCaptureBitRateEditorChange()
@@ -671,6 +743,7 @@ void UIMachineSettingsDisplay::sltHandleVideoCaptureBitRateEditorChange()
                                                             m_pEditorVideoCaptureFrameRate->value(),
                                                             m_pEditorVideoCaptureBitRate->value()));
     m_pSliderVideoCaptureQuality->blockSignals(false);
+    updateVideoCaptureSizeHint();
 }
 
 void UIMachineSettingsDisplay::prepare()
@@ -679,7 +752,7 @@ void UIMachineSettingsDisplay::prepare()
     Ui::UIMachineSettingsDisplay::setupUi(this);
 
     /* Prepare tabs: */
-    prepareVideoTab();
+    prepareScreenTab();
     prepareRemoteDisplayTab();
     prepareVideoCaptureTab();
 
@@ -690,7 +763,7 @@ void UIMachineSettingsDisplay::prepare()
     retranslateUi();
 }
 
-void UIMachineSettingsDisplay::prepareVideoTab()
+void UIMachineSettingsDisplay::prepareScreenTab()
 {
     /* Prepare memory-size slider: */
     CSystemProperties sys = vboxGlobal().virtualBox().GetSystemProperties();
@@ -732,10 +805,20 @@ void UIMachineSettingsDisplay::prepareVideoTab()
     m_pEditorVideoScreenCount->setMaximum(cMaxGuestScreens);
     connect(m_pEditorVideoScreenCount, SIGNAL(valueChanged(int)), this, SLOT(sltHandleVideoScreenCountEditorChange()));
 
-#ifndef VBOX_WITH_VIDEOHWACCEL
-    /* Hide check-box if not supported: */
-    m_pCheckbox2DVideo->setVisible(false);
-#endif /* VBOX_WITH_VIDEOHWACCEL */
+    /* Prepare scale-factor slider: */
+    m_pSliderGuestScreenScale->setMinimum(100);
+    m_pSliderGuestScreenScale->setMaximum(200);
+    m_pSliderGuestScreenScale->setPageStep(10);
+    m_pSliderGuestScreenScale->setSingleStep(1);
+    m_pSliderGuestScreenScale->setTickInterval(10);
+    m_pSliderGuestScreenScale->setSnappingEnabled(true);
+    connect(m_pSliderGuestScreenScale, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenScaleSliderChange()));
+
+    /* Prepare scale-factor editor: */
+    m_pEditorGuestScreenScale->setMinimum(100);
+    m_pEditorGuestScreenScale->setMaximum(200);
+    vboxGlobal().setMinimumWidthAccordingSymbolCount(m_pEditorGuestScreenScale, 5);
+    connect(m_pEditorGuestScreenScale, SIGNAL(valueChanged(int)), this, SLOT(sltHandleGuestScreenScaleEditorChange()));
 }
 
 void UIMachineSettingsDisplay::prepareRemoteDisplayTab()
@@ -940,6 +1023,11 @@ void UIMachineSettingsDisplay::updateVideoCaptureScreenCount()
     m_pScrollerVideoCaptureScreens->setValue(screens);
 }
 
+void UIMachineSettingsDisplay::updateVideoCaptureSizeHint()
+{
+    m_pLabelVideoCaptureSizeHint->setText(tr("<i>About %1MB per 5 minute video</i>").arg(m_pEditorVideoCaptureBitRate->value() * 300 / 8 / 1024));
+}
+
 /* static */
 void UIMachineSettingsDisplay::lookForCorrespondingPreset(QComboBox *pWhere, const QVariant &whichData)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
index 81b0154..8b3ccc3 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h
@@ -1,11 +1,10 @@
+/* $Id: UIMachineSettingsDisplay.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsDisplay class declaration
+ * VBox Qt GUI - UIMachineSettingsDisplay class declaration.
  */
 
 /*
- * Copyright (C) 2008-2013 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -26,6 +25,9 @@
 /* COM includes: */
 #include "CGuestOSType.h"
 
+/* Forward declarations: */
+class UIActionPool;
+
 /* Machine settings / Display page / Data: */
 struct UIDataSettingsMachineDisplay
 {
@@ -33,6 +35,10 @@ struct UIDataSettingsMachineDisplay
     UIDataSettingsMachineDisplay()
         : m_iCurrentVRAM(0)
         , m_cGuestScreenCount(0)
+        , m_dScaleFactor(1.0)
+#ifdef Q_WS_MAC
+        , m_fUseUnscaledHiDPIOutput(false)
+#endif /* Q_WS_MAC */
         , m_f3dAccelerationEnabled(false)
 #ifdef VBOX_WITH_VIDEOHWACCEL
         , m_f2dAccelerationEnabled(false)
@@ -57,6 +63,10 @@ struct UIDataSettingsMachineDisplay
     {
         return (m_iCurrentVRAM == other.m_iCurrentVRAM) &&
                (m_cGuestScreenCount == other.m_cGuestScreenCount) &&
+               (m_dScaleFactor == other.m_dScaleFactor) &&
+#ifdef Q_WS_MAC
+               (m_fUseUnscaledHiDPIOutput == other.m_fUseUnscaledHiDPIOutput) &&
+#endif /* Q_WS_MAC */
                (m_f3dAccelerationEnabled == other.m_f3dAccelerationEnabled) &&
 #ifdef VBOX_WITH_VIDEOHWACCEL
                (m_f2dAccelerationEnabled == other.m_f2dAccelerationEnabled) &&
@@ -83,6 +93,10 @@ struct UIDataSettingsMachineDisplay
     /* Variables: Video stuff: */
     int m_iCurrentVRAM;
     int m_cGuestScreenCount;
+    double m_dScaleFactor;
+#ifdef Q_WS_MAC
+    bool m_fUseUnscaledHiDPIOutput;
+#endif /* Q_WS_MAC */
     bool m_f3dAccelerationEnabled;
 #ifdef VBOX_WITH_VIDEOHWACCEL
     bool m_f2dAccelerationEnabled;
@@ -116,7 +130,7 @@ class UIMachineSettingsDisplay : public UISettingsPageMachine,
 
 public:
 
-    /* Constructor: */
+    /** Constructor. */
     UIMachineSettingsDisplay();
 
     /* API: Correlation stuff: */
@@ -158,11 +172,13 @@ protected:
 
 private slots:
 
-    /* Handlers: Video stuff: */
+    /* Handlers: Screen stuff: */
     void sltHandleVideoMemorySizeSliderChange();
     void sltHandleVideoMemorySizeEditorChange();
     void sltHandleVideoScreenCountSliderChange();
     void sltHandleVideoScreenCountEditorChange();
+    void sltHandleGuestScreenScaleSliderChange();
+    void sltHandleGuestScreenScaleEditorChange();
 
     /* Handlers: Video Capture stuff: */
     void sltHandleVideoCaptureCheckboxToggle();
@@ -176,11 +192,15 @@ private slots:
 
 private:
 
-    /* Helpers: Prepare stuff: */
+    /** Prepare routine. */
     void prepare();
-    void prepareVideoTab();
+    /** Prepare routine: Screen tab. */
+    void prepareScreenTab();
+    /** Prepare routine: Remote Display tab. */
     void prepareRemoteDisplayTab();
+    /** Prepare routine: Video Capture tab. */
     void prepareVideoCaptureTab();
+    /** Prepare routine: Validation. */
     void prepareValidation();
 
     /* Helpers: Video stuff: */
@@ -191,6 +211,7 @@ private:
     /* Helpers: Video Capture stuff: */
     void lookForCorrespondingSizePreset();
     void updateVideoCaptureScreenCount();
+    void updateVideoCaptureSizeHint();
     static void lookForCorrespondingPreset(QComboBox *pWhere, const QVariant &whichData);
     static int calculateBitRate(int iFrameWidth, int iFrameHeight, int iFrameRate, int iQuality);
     static int calculateQuality(int iFrameWidth, int iFrameHeight, int iFrameRate, int iBitRate);
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui
index af9b74f..2f6af32 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.ui
@@ -2,7 +2,7 @@
  <comment>
  VBox frontends: Qt4 GUI ("VirtualBox"):
 
- Copyright (C) 2008-2013 Oracle Corporation
+ Copyright (C) 2008-2014 Oracle Corporation
 
  This file is part of VirtualBox Open Source Edition (OSE), as
  available from http://www.virtualbox.org. This file is free software;
@@ -27,7 +27,7 @@
     <widget class="QITabWidget" name="m_pTabWidget">
      <widget class="QWidget" name="m_pTabVideo">
       <attribute name="title">
-       <string>&Video</string>
+       <string>&Screen</string>
       </attribute>
       <layout class="QVBoxLayout" name="m_pLayoutTabVideo">
        <item>
@@ -153,16 +153,106 @@
            </widget>
           </item>
           <item row="4" column="0">
+           <widget class="QLabel" name="m_pLabelGuestScreenScale">
+            <property name="text">
+             <string>Scale Factor:</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item row="4" column="1" rowspan="2">
+           <layout class="QGridLayout" name="m_pLayoutGuestScreenScaleSlider">
+            <property name="spacing">
+             <number>0</number>
+            </property>
+            <item row="0" column="0" colspan="3">
+             <widget class="QIAdvancedSlider" name="m_pSliderGuestScreenScale">
+              <property name="whatsThis">
+               <string>Controls the guest screen scale factor.</string>
+              </property>
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="0">
+             <widget class="QLabel" name="m_pLabelGuestScreenScaleMin">
+              <property name="text">
+               <string>100%</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="1">
+             <spacer name="m_pSpacerGuestScreenScale">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>0</width>
+                <height>0</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item row="1" column="2">
+             <widget class="QLabel" name="m_pLabelGuestScreenScaleMax">
+              <property name="text">
+               <string>200%</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="4" column="2">
+           <widget class="QSpinBox" name="m_pEditorGuestScreenScale">
+            <property name="whatsThis">
+             <string>Controls the guest screen scale factor.</string>
+            </property>
+            <property name="suffix">
+             <string>%</string>
+            </property>
+           </widget>
+          </item>
+          <item row="6" column="0">
+           <widget class="QLabel" name="m_pLabelHiDPI">
+            <property name="text">
+             <string>HiDPI:</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item row="6" column="1" colspan="2">
+           <widget class="QCheckBox" name="m_pCheckBoxUnscaledHiDPIOutput">
+            <property name="sizePolicy">
+             <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="whatsThis">
+             <string>When checked, guest screen contents will not be scaled up to compensate for high host screen resolutions.</string>
+            </property>
+            <property name="text">
+             <string>Use &Unscaled HiDPI Output</string>
+            </property>
+           </widget>
+          </item>
+          <item row="7" column="0">
            <widget class="QLabel" name="m_pLabelVideoOptions">
             <property name="text">
-             <string>Extended Features:</string>
+             <string>Acceleration:</string>
             </property>
             <property name="alignment">
              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
             </property>
            </widget>
           </item>
-          <item row="4" column="1" colspan="2">
+          <item row="7" column="1" colspan="2">
            <widget class="QCheckBox" name="m_pCheckbox3D">
             <property name="sizePolicy">
              <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -178,7 +268,7 @@
             </property>
            </widget>
           </item>
-          <item row="5" column="1" colspan="2">
+          <item row="8" column="1" colspan="2">
            <widget class="QCheckBox" name="m_pCheckbox2DVideo">
             <property name="sizePolicy">
              <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -600,7 +690,10 @@
              <item row="4" column="3">
               <widget class="QLabel" name="m_pLabelVideoCaptureBitRateUnits"/>
              </item>
-             <item row="6" column="0">
+             <item row="6" column="1">
+              <widget class="QLabel" name="m_pLabelVideoCaptureSizeHint"/>
+             </item>
+             <item row="7" column="0">
               <widget class="QLabel" name="m_pLabelVideoCaptureScreens">
                <property name="text">
                 <string>&Screens:</string>
@@ -613,7 +706,7 @@
                </property>
               </widget>
              </item>
-             <item row="6" column="1" colspan="3">
+             <item row="7" column="1" colspan="3">
               <widget class="UIFilmContainer" name="m_pScrollerVideoCaptureScreens">
                <property name="whatsThis">
                 <string></string>
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
index 923e334..3fd42d3 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMachineSettingsGeneral.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsGeneral class implementation
+ * VBox Qt GUI - UIMachineSettingsGeneral class implementation.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,53 +15,58 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 /* Qt includes: */
-#include <QDir>
-#include <QLineEdit>
-
+# include <QDir>
+# include <QLineEdit>
 /* GUI includes: */
-#include "UIMachineSettingsGeneral.h"
-#include "UIMessageCenter.h"
-#include "QIWidgetValidator.h"
-#include "UIConverter.h"
+# include "QIWidgetValidator.h"
+# include "UIMachineSettingsGeneral.h"
+# include "UIModalWindowManager.h"
+# include "UIProgressDialog.h"
+# include "UIMessageCenter.h"
+# include "UIConverter.h"
+/* COM includes: */
+# include "CMedium.h"
+# include "CExtPack.h"
+# include "CExtPackManager.h"
+# include "CMediumAttachment.h"
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 UIMachineSettingsGeneral::UIMachineSettingsGeneral()
     : m_fHWVirtExEnabled(false)
+    , m_fEncryptionCipherChanged(false)
+    , m_fEncryptionPasswordChanged(false)
 {
-    /* Apply UI decorations */
-    Ui::UIMachineSettingsGeneral::setupUi (this);
-
-    /* Setup validators */
-    m_pNameAndSystemEditor->nameEditor()->setValidator(new QRegExpValidator(QRegExp(".+"), this));
-
-    /* Shared Clipboard mode */
-    mCbClipboard->addItem (""); /* KClipboardMode_Disabled */
-    mCbClipboard->addItem (""); /* KClipboardMode_HostToGuest */
-    mCbClipboard->addItem (""); /* KClipboardMode_GuestToHost */
-    mCbClipboard->addItem (""); /* KClipboardMode_Bidirectional */
-
-    /* Drag'n'drop mode */
-    mCbDragAndDrop->addItem (""); /* KDragAndDropMode_Disabled */
-    mCbDragAndDrop->addItem (""); /* KDragAndDropMode_HostToGuest */
-    mCbDragAndDrop->addItem (""); /* KDragAndDropMode_GuestToHost */
-    mCbDragAndDrop->addItem (""); /* KDragAndDropMode_Bidirectional */
-
-#ifdef Q_WS_MAC
-    mTeDescription->setMinimumHeight (150);
-#endif /* Q_WS_MAC */
-
-    /* Prepare validation: */
-    prepareValidation();
+    /* Prepare: */
+    prepare();
 
-    /* Applying language settings */
+    /* Translate: */
     retranslateUi();
 }
 
 CGuestOSType UIMachineSettingsGeneral::guestOSType() const
 {
+    AssertPtrReturn(m_pNameAndSystemEditor, CGuestOSType());
     return m_pNameAndSystemEditor->type();
 }
 
+bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const
+{
+    AssertPtrReturn(m_pNameAndSystemEditor, false);
+    return m_pNameAndSystemEditor->type().GetIs64Bit();
+}
+
+#ifdef VBOX_WITH_VIDEOHWACCEL
+bool UIMachineSettingsGeneral::isWindowsOSTypeSelected() const
+{
+    AssertPtrReturn(m_pNameAndSystemEditor, false);
+    return m_pNameAndSystemEditor->type().GetFamilyId() == "Windows";
+}
+#endif /* VBOX_WITH_VIDEOHWACCEL */
+
 void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled)
 {
     /* Make sure hardware virtualization extension has changed: */
@@ -77,20 +80,6 @@ void UIMachineSettingsGeneral::setHWVirtExEnabled(bool fEnabled)
     revalidate();
 }
 
-bool UIMachineSettingsGeneral::is64BitOSTypeSelected() const
-{
-    return m_pNameAndSystemEditor->type().GetIs64Bit();
-}
-
-#ifdef VBOX_WITH_VIDEOHWACCEL
-bool UIMachineSettingsGeneral::isWindowsOSTypeSelected() const
-{
-    return m_pNameAndSystemEditor->type().GetFamilyId() == "Windows";
-}
-#endif /* VBOX_WITH_VIDEOHWACCEL */
-
-/* Load data to cache from corresponding external object(s),
- * this task COULD be performed in other than GUI thread: */
 void UIMachineSettingsGeneral::loadToCacheFrom(QVariant &data)
 {
     /* Fetch data to machine: */
@@ -102,21 +91,56 @@ void UIMachineSettingsGeneral::loadToCacheFrom(QVariant &data)
     /* Prepare general data: */
     UIDataSettingsMachineGeneral generalData;
 
-    /* Gather general data: */
+    /* 'Basic' tab data: */
     generalData.m_strName = m_machine.GetName();
     generalData.m_strGuestOsTypeId = m_machine.GetOSTypeId();
-    QString strSaveMountedAtRuntime = m_machine.GetExtraData(GUI_SaveMountedAtRuntime);
-    generalData.m_fSaveMountedAtRuntime = strSaveMountedAtRuntime != "no";
-    QString strShowMiniToolBar = m_machine.GetExtraData(GUI_ShowMiniToolBar);
-    generalData.m_fShowMiniToolBar = strShowMiniToolBar != "no";
-    QString strMiniToolBarAlignment = m_machine.GetExtraData(GUI_MiniToolBarAlignment);
-    generalData.m_fMiniToolBarAtTop = strMiniToolBarAlignment == "top";
+
+    /* 'Advanced' tab data: */
     generalData.m_strSnapshotsFolder = m_machine.GetSnapshotFolder();
     generalData.m_strSnapshotsHomeDir = QFileInfo(m_machine.GetSettingsFilePath()).absolutePath();
     generalData.m_clipboardMode = m_machine.GetClipboardMode();
-    generalData.m_dragAndDropMode = m_machine.GetDragAndDropMode();
+    generalData.m_dndMode = m_machine.GetDnDMode();
+
+    /* 'Description' tab data: */
     generalData.m_strDescription = m_machine.GetDescription();
 
+    /* 'Encryption' tab data: */
+    QString strCipher;
+    bool fEncryptionCipherCommon = true;
+    /* Prepare the map of the encrypted mediums: */
+    EncryptedMediumMap encryptedMediums;
+    foreach (const CMediumAttachment &attachment, m_machine.GetMediumAttachments())
+    {
+        /* Acquire hard-drive attachments only: */
+        if (attachment.GetType() == KDeviceType_HardDisk)
+        {
+            /* Get the attachment medium base: */
+            const CMedium medium = attachment.GetMedium();
+            /* Check medium encryption attributes: */
+            QString strCurrentCipher;
+            const QString strCurrentPasswordId = medium.GetEncryptionSettings(strCurrentCipher);
+            if (medium.isOk())
+            {
+                encryptedMediums.insert(strCurrentPasswordId, medium.GetId());
+                if (strCurrentCipher != strCipher)
+                {
+                    if (strCipher.isNull())
+                        strCipher = strCurrentCipher;
+                    else
+                        fEncryptionCipherCommon = false;
+                }
+            }
+        }
+    }
+    generalData.m_fEncryptionEnabled = !encryptedMediums.isEmpty();
+    generalData.m_fEncryptionCipherChanged = false;
+    generalData.m_fEncryptionPasswordChanged = false;
+    if (fEncryptionCipherCommon)
+        generalData.m_iEncryptionCipherIndex = m_encryptionCiphers.indexOf(strCipher);
+    if (generalData.m_iEncryptionCipherIndex == -1)
+        generalData.m_iEncryptionCipherIndex = 0;
+    generalData.m_encryptedMediums = encryptedMediums;
+
     /* Cache general data: */
     m_cache.cacheInitialData(generalData);
 
@@ -124,25 +148,37 @@ void UIMachineSettingsGeneral::loadToCacheFrom(QVariant &data)
     UISettingsPageMachine::uploadData(data);
 }
 
-/* Load data to corresponding widgets from cache,
- * this task SHOULD be performed in GUI thread only: */
 void UIMachineSettingsGeneral::getFromCache()
 {
     /* Get general data from cache: */
     const UIDataSettingsMachineGeneral &generalData = m_cache.base();
 
-    /* Load general data to page: */
+    /* 'Basic' tab data: */
+    AssertPtrReturnVoid(m_pNameAndSystemEditor);
     m_pNameAndSystemEditor->setName(generalData.m_strName);
     m_pNameAndSystemEditor->setType(vboxGlobal().vmGuestOSType(generalData.m_strGuestOsTypeId));
-    mCbSaveMounted->setChecked(generalData.m_fSaveMountedAtRuntime);
-    mCbShowToolBar->setChecked(generalData.m_fShowMiniToolBar);
-    mCbToolBarAlignment->setChecked(generalData.m_fMiniToolBarAtTop);
+
+    /* 'Advanced' tab data: */
+    AssertPtrReturnVoid(mPsSnapshot);
+    AssertPtrReturnVoid(mCbClipboard);
+    AssertPtrReturnVoid(mCbDragAndDrop);
     mPsSnapshot->setPath(generalData.m_strSnapshotsFolder);
     mPsSnapshot->setHomeDir(generalData.m_strSnapshotsHomeDir);
     mCbClipboard->setCurrentIndex(generalData.m_clipboardMode);
-    mCbDragAndDrop->setCurrentIndex(generalData.m_dragAndDropMode);
+    mCbDragAndDrop->setCurrentIndex(generalData.m_dndMode);
+
+    /* 'Description' tab data: */
+    AssertPtrReturnVoid(mTeDescription);
     mTeDescription->setPlainText(generalData.m_strDescription);
 
+    /* 'Encryption' tab data: */
+    AssertPtrReturnVoid(m_pCheckBoxEncryption);
+    AssertPtrReturnVoid(m_pComboCipher);
+    m_pCheckBoxEncryption->setChecked(generalData.m_fEncryptionEnabled);
+    m_pComboCipher->setCurrentIndex(generalData.m_iEncryptionCipherIndex);
+    m_fEncryptionCipherChanged = generalData.m_fEncryptionCipherChanged;
+    m_fEncryptionPasswordChanged = generalData.m_fEncryptionPasswordChanged;
+
     /* Polish page finally: */
     polishPage();
 
@@ -150,31 +186,65 @@ void UIMachineSettingsGeneral::getFromCache()
     revalidate();
 }
 
-/* Save data from corresponding widgets to cache,
- * this task SHOULD be performed in GUI thread only: */
 void UIMachineSettingsGeneral::putToCache()
 {
     /* Prepare general data: */
     UIDataSettingsMachineGeneral generalData = m_cache.base();
 
-    /* Gather general data: */
+    /* 'Basic' tab data: */
+    AssertPtrReturnVoid(m_pNameAndSystemEditor);
     generalData.m_strName = m_pNameAndSystemEditor->name();
     generalData.m_strGuestOsTypeId = m_pNameAndSystemEditor->type().GetId();
-    generalData.m_fSaveMountedAtRuntime = mCbSaveMounted->isChecked();
-    generalData.m_fShowMiniToolBar = mCbShowToolBar->isChecked();
-    generalData.m_fMiniToolBarAtTop = mCbToolBarAlignment->isChecked();
+
+    /* 'Advanced' tab data: */
+    AssertPtrReturnVoid(mPsSnapshot);
+    AssertPtrReturnVoid(mCbClipboard);
+    AssertPtrReturnVoid(mCbDragAndDrop);
     generalData.m_strSnapshotsFolder = mPsSnapshot->path();
     generalData.m_clipboardMode = (KClipboardMode)mCbClipboard->currentIndex();
-    generalData.m_dragAndDropMode = (KDragAndDropMode)mCbDragAndDrop->currentIndex();
+    generalData.m_dndMode = (KDnDMode)mCbDragAndDrop->currentIndex();
+
+    /* 'Description' tab data: */
+    AssertPtrReturnVoid(mTeDescription);
     generalData.m_strDescription = mTeDescription->toPlainText().isEmpty() ?
                                    QString::null : mTeDescription->toPlainText();
 
+    /* 'Encryption' tab data: */
+    AssertPtrReturnVoid(m_pCheckBoxEncryption);
+    AssertPtrReturnVoid(m_pComboCipher);
+    AssertPtrReturnVoid(m_pEditorEncryptionPassword);
+    generalData.m_fEncryptionEnabled = m_pCheckBoxEncryption->isChecked();
+    generalData.m_fEncryptionCipherChanged = m_fEncryptionCipherChanged;
+    generalData.m_fEncryptionPasswordChanged = m_fEncryptionPasswordChanged;
+    generalData.m_iEncryptionCipherIndex = m_pComboCipher->currentIndex();
+    generalData.m_strEncryptionPassword = m_pEditorEncryptionPassword->text();
+    /* If encryption status, cipher or password is changed: */
+    if (generalData.m_fEncryptionEnabled != m_cache.base().m_fEncryptionEnabled ||
+        generalData.m_fEncryptionCipherChanged != m_cache.base().m_fEncryptionCipherChanged ||
+        generalData.m_fEncryptionPasswordChanged != m_cache.base().m_fEncryptionPasswordChanged)
+    {
+        /* Ask for the disk encryption passwords if necessary: */
+        if (!m_cache.base().m_encryptedMediums.isEmpty())
+        {
+            /* Create corresponding dialog: */
+            QWidget *pDlgParent = windowManager().realParentWindow(window());
+            QPointer<UIAddDiskEncryptionPasswordDialog> pDlg =
+                 new UIAddDiskEncryptionPasswordDialog(pDlgParent,
+                                                       generalData.m_strName,
+                                                       generalData.m_encryptedMediums);
+            /* Execute it and acquire the result: */
+            if (pDlg->exec() == QDialog::Accepted)
+                generalData.m_encryptionPasswords = pDlg->encryptionPasswords();
+            /* Delete dialog if still valid: */
+            if (pDlg)
+                delete pDlg;
+        }
+    }
+
     /* Cache general data: */
     m_cache.cacheCurrentData(generalData);
 }
 
-/* Save data from cache to corresponding external object(s),
- * this task COULD be performed in other than GUI thread: */
 void UIMachineSettingsGeneral::saveFromCacheTo(QVariant &data)
 {
     /* Fetch data to machine: */
@@ -186,36 +256,102 @@ void UIMachineSettingsGeneral::saveFromCacheTo(QVariant &data)
         /* Get general data from cache: */
         const UIDataSettingsMachineGeneral &generalData = m_cache.data();
 
-        /* Store general data: */
         if (isMachineInValidMode())
         {
-            /* Advanced tab: */
-            m_machine.SetClipboardMode(generalData.m_clipboardMode);
-            m_machine.SetDragAndDropMode(generalData.m_dragAndDropMode);
-            m_machine.SetExtraData(GUI_SaveMountedAtRuntime, generalData.m_fSaveMountedAtRuntime ? "yes" : "no");
-            m_machine.SetExtraData(GUI_ShowMiniToolBar, generalData.m_fShowMiniToolBar ? "yes" : "no");
-            m_machine.SetExtraData(GUI_MiniToolBarAlignment, generalData.m_fMiniToolBarAtTop ? "top" : "bottom");
-            /* Description tab: */
-            m_machine.SetDescription(generalData.m_strDescription);
+            /* 'Advanced' tab data: */
+            if (generalData.m_clipboardMode != m_cache.base().m_clipboardMode)
+                m_machine.SetClipboardMode(generalData.m_clipboardMode);
+            if (generalData.m_dndMode != m_cache.base().m_dndMode)
+                m_machine.SetDnDMode(generalData.m_dndMode);
+
+            /* 'Description' tab: */
+            if (generalData.m_strDescription != m_cache.base().m_strDescription)
+                m_machine.SetDescription(generalData.m_strDescription);
         }
+
         if (isMachineOffline())
         {
-            /* Basic tab: Must update long mode CPU feature bit when os type changes. */
+            /* 'Basic' tab data: Must update long mode CPU feature bit when os type changes. */
             if (generalData.m_strGuestOsTypeId != m_cache.base().m_strGuestOsTypeId)
             {
                 m_machine.SetOSTypeId(generalData.m_strGuestOsTypeId);
-
                 CVirtualBox vbox = vboxGlobal().virtualBox();
                 CGuestOSType newType = vbox.GetGuestOSType(generalData.m_strGuestOsTypeId);
                 m_machine.SetCPUProperty(KCPUPropertyType_LongMode, newType.GetIs64Bit());
             }
 
-            /* Advanced tab: */
-            m_machine.SetSnapshotFolder(generalData.m_strSnapshotsFolder);
-            /* Basic (again) tab: */
-            /* VM name must be last as otherwise its VM rename magic can collide with other settings in the config,
+            /* 'Advanced' tab data: */
+            if (generalData.m_strSnapshotsFolder != m_cache.base().m_strSnapshotsFolder)
+                m_machine.SetSnapshotFolder(generalData.m_strSnapshotsFolder);
+
+            /* 'Basic' (again) tab data: */
+            /* VM name must be last as otherwise its VM rename magic
+             * can collide with other settings in the config,
              * especially with the snapshot folder: */
-            m_machine.SetName(generalData.m_strName);
+            if (generalData.m_strName != m_cache.base().m_strName)
+                m_machine.SetName(generalData.m_strName);
+
+            /* Encryption tab data: */
+            if (generalData.m_fEncryptionEnabled != m_cache.base().m_fEncryptionEnabled ||
+                generalData.m_fEncryptionCipherChanged != m_cache.base().m_fEncryptionCipherChanged ||
+                generalData.m_fEncryptionPasswordChanged != m_cache.base().m_fEncryptionPasswordChanged)
+            {
+                /* Cipher attribute changed? */
+                QString strNewCipher;
+                if (generalData.m_fEncryptionCipherChanged)
+                {
+                    strNewCipher = generalData.m_fEncryptionEnabled ?
+                                   m_encryptionCiphers.at(generalData.m_iEncryptionCipherIndex) : QString();
+                }
+                /* Password attribute changed? */
+                QString strNewPassword;
+                QString strNewPasswordId;
+                if (generalData.m_fEncryptionPasswordChanged)
+                {
+                    strNewPassword = generalData.m_fEncryptionEnabled ?
+                                     generalData.m_strEncryptionPassword : QString();
+                    strNewPasswordId = generalData.m_fEncryptionEnabled ?
+                                       m_machine.GetName() : QString();
+                }
+
+                /* Get the maps of encrypted mediums and their passwords: */
+                const EncryptedMediumMap &encryptedMedium = generalData.m_encryptedMediums;
+                const EncryptionPasswordMap &encryptionPasswords = generalData.m_encryptionPasswords;
+                /* Enumerate attachments: */
+                foreach (const CMediumAttachment &attachment, m_machine.GetMediumAttachments())
+                {
+                    /* Enumerate hard-drives only: */
+                    if (attachment.GetType() == KDeviceType_HardDisk)
+                    {
+                        /* Get corresponding medium: */
+                        CMedium medium = attachment.GetMedium();
+
+                        /* Check if old password exists/provided: */
+                        QString strOldPasswordId = encryptedMedium.key(medium.GetId());
+                        QString strOldPassword = encryptionPasswords.value(strOldPasswordId);
+
+                        /* Update encryption: */
+                        CProgress cprogress = medium.ChangeEncryption(strOldPassword,
+                                                                      strNewCipher,
+                                                                      strNewPassword,
+                                                                      strNewPasswordId);
+                        if (!medium.isOk())
+                        {
+                            QMetaObject::invokeMethod(this, "sigOperationProgressError", Qt::BlockingQueuedConnection,
+                                                      Q_ARG(QString, UIMessageCenter::formatErrorInfo(medium)));
+                            continue;
+                        }
+                        UIProgress uiprogress(cprogress);
+                        connect(&uiprogress, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)),
+                                this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)),
+                                Qt::QueuedConnection);
+                        connect(&uiprogress, SIGNAL(sigProgressError(QString)),
+                                this, SIGNAL(sigOperationProgressError(QString)),
+                                Qt::BlockingQueuedConnection);
+                        uiprogress.run(350);
+                    }
+                }
+            }
         }
     }
 
@@ -230,9 +366,13 @@ bool UIMachineSettingsGeneral::validate(QList<UIValidationMessage> &messages)
 
     /* Prepare message: */
     UIValidationMessage message;
+
+    /* 'Basic' tab validations: */
     message.first = VBoxGlobal::removeAccelMark(mTwGeneral->tabText(0));
+    message.second.clear();
 
     /* VM name validation: */
+    AssertPtrReturn(m_pNameAndSystemEditor, false);
     if (m_pNameAndSystemEditor->name().trimmed().isEmpty())
     {
         message.second << tr("No name specified for the virtual machine.");
@@ -251,74 +391,242 @@ bool UIMachineSettingsGeneral::validate(QList<UIValidationMessage> &messages)
     if (!message.second.isEmpty())
         messages << message;
 
+    /* 'Encryption' tab validations: */
+    message.first = VBoxGlobal::removeAccelMark(mTwGeneral->tabText(3));
+    message.second.clear();
+
+    /* Encryption validation: */
+    AssertPtrReturn(m_pCheckBoxEncryption, false);
+    if (m_pCheckBoxEncryption->isChecked())
+    {
+#ifdef VBOX_WITH_EXTPACK
+        /* Encryption Extension Pack presence test: */
+        const CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
+        if (extPack.isNull() || !extPack.GetUsable())
+        {
+            message.second << tr("You are trying to encrypt this virtual machine. "
+                                 "However, this requires the <i>%1</i> to be installed. "
+                                 "Please install the Extension Pack from the VirtualBox download site.")
+                                 .arg(GUI_ExtPackName);
+            fPass = false;
+        }
+#endif /* VBOX_WITH_EXTPACK */
+
+        /* Cipher should be chosen if once changed: */
+        AssertPtrReturn(m_pComboCipher, false);
+        if (!m_cache.base().m_fEncryptionEnabled ||
+            m_fEncryptionCipherChanged)
+        {
+            if (m_pComboCipher->currentIndex() == 0)
+                message.second << tr("Encryption cipher type not specified.");
+            fPass = false;
+        }
+
+        /* Password should be entered and confirmed if once changed: */
+        AssertPtrReturn(m_pEditorEncryptionPassword, false);
+        AssertPtrReturn(m_pEditorEncryptionPasswordConfirm, false);
+        if (!m_cache.base().m_fEncryptionEnabled ||
+            m_fEncryptionPasswordChanged)
+        {
+            if (m_pEditorEncryptionPassword->text().isEmpty())
+                message.second << tr("Encryption password empty.");
+            else
+            if (m_pEditorEncryptionPassword->text() !=
+                m_pEditorEncryptionPasswordConfirm->text())
+                message.second << tr("Encryption passwords do not match.");
+            fPass = false;
+        }
+    }
+
+    /* Serialize message: */
+    if (!message.second.isEmpty())
+        messages << message;
+
     /* Return result: */
     return fPass;
 }
 
-void UIMachineSettingsGeneral::setOrderAfter (QWidget *aWidget)
+void UIMachineSettingsGeneral::setOrderAfter(QWidget *pWidget)
 {
-    /* Basic tab-order */
-    setTabOrder (aWidget, mTwGeneral->focusProxy());
-    setTabOrder (mTwGeneral->focusProxy(), m_pNameAndSystemEditor);
-
-    /* Advanced tab-order */
-    setTabOrder (m_pNameAndSystemEditor, mPsSnapshot);
-    setTabOrder (mPsSnapshot, mCbClipboard);
-    setTabOrder (mCbClipboard, mCbDragAndDrop);
-    setTabOrder (mCbDragAndDrop, mCbSaveMounted);
-    setTabOrder (mCbSaveMounted, mCbShowToolBar);
-    setTabOrder (mCbShowToolBar, mCbToolBarAlignment);
-
-    /* Description tab-order */
-    setTabOrder (mCbToolBarAlignment, mTeDescription);
+    /* 'Basic' tab: */
+    AssertPtrReturnVoid(pWidget);
+    AssertPtrReturnVoid(mTwGeneral);
+    AssertPtrReturnVoid(mTwGeneral->focusProxy());
+    AssertPtrReturnVoid(m_pNameAndSystemEditor);
+    setTabOrder(pWidget, mTwGeneral->focusProxy());
+    setTabOrder(mTwGeneral->focusProxy(), m_pNameAndSystemEditor);
+
+    /* 'Advanced' tab: */
+    AssertPtrReturnVoid(mPsSnapshot);
+    AssertPtrReturnVoid(mCbClipboard);
+    AssertPtrReturnVoid(mCbDragAndDrop);
+    setTabOrder(m_pNameAndSystemEditor, mPsSnapshot);
+    setTabOrder(mPsSnapshot, mCbClipboard);
+    setTabOrder(mCbClipboard, mCbDragAndDrop);
+
+    /* 'Description' tab: */
+    AssertPtrReturnVoid(mTeDescription);
+    setTabOrder(mCbDragAndDrop, mTeDescription);
 }
 
 void UIMachineSettingsGeneral::retranslateUi()
 {
-    /* Translate uic generated strings */
-    Ui::UIMachineSettingsGeneral::retranslateUi (this);
-
-    /* Path selector */
-    mPsSnapshot->setWhatsThis (tr ("Holds the path where snapshots of this "
-                                   "virtual machine will be stored. Be aware that "
-                                   "snapshots can take quite a lot of disk "
-                                   "space."));
-
-    /* Shared Clipboard mode */
-    mCbClipboard->setItemText (0, gpConverter->toString (KClipboardMode_Disabled));
-    mCbClipboard->setItemText (1, gpConverter->toString (KClipboardMode_HostToGuest));
-    mCbClipboard->setItemText (2, gpConverter->toString (KClipboardMode_GuestToHost));
-    mCbClipboard->setItemText (3, gpConverter->toString (KClipboardMode_Bidirectional));
-
-    /* Drag'n'drop mode */
-    mCbDragAndDrop->setItemText (0, gpConverter->toString (KDragAndDropMode_Disabled));
-    mCbDragAndDrop->setItemText (1, gpConverter->toString (KDragAndDropMode_HostToGuest));
-    mCbDragAndDrop->setItemText (2, gpConverter->toString (KDragAndDropMode_GuestToHost));
-    mCbDragAndDrop->setItemText (3, gpConverter->toString (KDragAndDropMode_Bidirectional));
+    /* Translate uic generated strings: */
+    Ui::UIMachineSettingsGeneral::retranslateUi(this);
+
+    /* Translate path selector: */
+    AssertPtrReturnVoid(mPsSnapshot);
+    mPsSnapshot->setWhatsThis(tr("Holds the path where snapshots of this "
+                                 "virtual machine will be stored. Be aware that "
+                                 "snapshots can take quite a lot of disk space."));
+    /* Translate Shared Clipboard mode combo: */
+    AssertPtrReturnVoid(mCbClipboard);
+    mCbClipboard->setItemText(0, gpConverter->toString(KClipboardMode_Disabled));
+    mCbClipboard->setItemText(1, gpConverter->toString(KClipboardMode_HostToGuest));
+    mCbClipboard->setItemText(2, gpConverter->toString(KClipboardMode_GuestToHost));
+    mCbClipboard->setItemText(3, gpConverter->toString(KClipboardMode_Bidirectional));
+    /* Translate Drag'n'drop mode combo: */
+    AssertPtrReturnVoid(mCbDragAndDrop);
+    mCbDragAndDrop->setItemText(0, gpConverter->toString(KDnDMode_Disabled));
+    mCbDragAndDrop->setItemText(1, gpConverter->toString(KDnDMode_HostToGuest));
+    mCbDragAndDrop->setItemText(2, gpConverter->toString(KDnDMode_GuestToHost));
+    mCbDragAndDrop->setItemText(3, gpConverter->toString(KDnDMode_Bidirectional));
+
+    /* Translate Cipher type combo: */
+    AssertPtrReturnVoid(m_pComboCipher);
+    m_pComboCipher->setItemText(0, tr("Leave Unchanged", "cipher type"));
+}
+
+void UIMachineSettingsGeneral::prepare()
+{
+    /* Apply UI decorations: */
+    Ui::UIMachineSettingsGeneral::setupUi(this);
+
+    /* Prepare tabs: */
+    prepareTabBasic();
+    prepareTabAdvanced();
+    prepareTabDescription();
+    prepareTabEncryption();
+}
+
+void UIMachineSettingsGeneral::prepareTabBasic()
+{
+    /* Name and OS Type widget was created in the .ui file: */
+    AssertPtrReturnVoid(m_pNameAndSystemEditor);
+    {
+        /* Configure Name and OS Type widget: */
+        m_pNameAndSystemEditor->nameEditor()->setValidator(new QRegExpValidator(QRegExp(".+"), this));
+        connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(revalidate()));
+        connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), this, SLOT(revalidate()));
+    }
+}
+
+void UIMachineSettingsGeneral::prepareTabAdvanced()
+{
+    /* Shared Clipboard mode combo was created in the .ui file: */
+    AssertPtrReturnVoid(mCbClipboard);
+    {
+        /* Configure Shared Clipboard mode combo: */
+        mCbClipboard->addItem(""); /* KClipboardMode_Disabled */
+        mCbClipboard->addItem(""); /* KClipboardMode_HostToGuest */
+        mCbClipboard->addItem(""); /* KClipboardMode_GuestToHost */
+        mCbClipboard->addItem(""); /* KClipboardMode_Bidirectional */
+    }
+    /* Drag&drop mode combo was created in the .ui file: */
+    AssertPtrReturnVoid(mCbDragAndDrop);
+    {
+        /* Configure Drag&drop mode combo: */
+        mCbDragAndDrop->addItem(""); /* KDnDMode_Disabled */
+        mCbDragAndDrop->addItem(""); /* KDnDMode_HostToGuest */
+        mCbDragAndDrop->addItem(""); /* KDnDMode_GuestToHost */
+        mCbDragAndDrop->addItem(""); /* KDnDMode_Bidirectional */
+    }
 }
 
-void UIMachineSettingsGeneral::prepareValidation()
+void UIMachineSettingsGeneral::prepareTabDescription()
 {
-    /* Prepare validation: */
-    connect(m_pNameAndSystemEditor, SIGNAL(sigOsTypeChanged()), this, SLOT(revalidate()));
-    connect(m_pNameAndSystemEditor, SIGNAL(sigNameChanged(const QString&)), this, SLOT(revalidate()));
+    /* Description text editor was created in the .ui file: */
+    AssertPtrReturnVoid(mTeDescription);
+    {
+        /* Configure Description text editor: */
+#ifdef Q_WS_MAC
+        mTeDescription->setMinimumHeight(150);
+#endif /* Q_WS_MAC */
+    }
+}
+
+void UIMachineSettingsGeneral::prepareTabEncryption()
+{
+    /* Encryption check-box was created in the .ui file: */
+    AssertPtrReturnVoid(m_pCheckBoxEncryption);
+    {
+        /* Configure Encryption check-box: */
+        connect(m_pCheckBoxEncryption, SIGNAL(toggled(bool)),
+                this, SLOT(revalidate()));
+    }
+    /* Encryption Cipher combo was created in the .ui file: */
+    AssertPtrReturnVoid(m_pComboCipher);
+    {
+        /* Configure Encryption Cipher combo: */
+        m_encryptionCiphers << QString()
+                            << "AES-XTS256-PLAIN64"
+                            << "AES-XTS128-PLAIN64";
+        m_pComboCipher->addItems(m_encryptionCiphers);
+        connect(m_pComboCipher, SIGNAL(currentIndexChanged(int)),
+                this, SLOT(sltMarkEncryptionCipherChanged()));
+        connect(m_pComboCipher, SIGNAL(currentIndexChanged(int)),
+                this, SLOT(revalidate()));
+    }
+    /* Encryption Password editor was created in the .ui file: */
+    AssertPtrReturnVoid(m_pEditorEncryptionPassword);
+    {
+        /* Configure Encryption Password editor: */
+        m_pEditorEncryptionPassword->setEchoMode(QLineEdit::Password);
+        connect(m_pEditorEncryptionPassword, SIGNAL(textEdited(const QString&)),
+                this, SLOT(sltMarkEncryptionPasswordChanged()));
+        connect(m_pEditorEncryptionPassword, SIGNAL(textEdited(const QString&)),
+                this, SLOT(revalidate()));
+    }
+    /* Encryption Password Confirmation editor was created in the .ui file: */
+    AssertPtrReturnVoid(m_pEditorEncryptionPasswordConfirm);
+    {
+        /* Configure Encryption Password Confirmation editor: */
+        m_pEditorEncryptionPasswordConfirm->setEchoMode(QLineEdit::Password);
+        connect(m_pEditorEncryptionPasswordConfirm, SIGNAL(textEdited(const QString&)),
+                this, SLOT(sltMarkEncryptionPasswordChanged()));
+        connect(m_pEditorEncryptionPasswordConfirm, SIGNAL(textEdited(const QString&)),
+                this, SLOT(revalidate()));
+    }
 }
 
 void UIMachineSettingsGeneral::polishPage()
 {
-    /* Basic tab: */
+    /* 'Basic' tab: */
+    AssertPtrReturnVoid(m_pNameAndSystemEditor);
     m_pNameAndSystemEditor->setEnabled(isMachineOffline());
-    /* Advanced tab: */
+
+    /* 'Advanced' tab: */
+    AssertPtrReturnVoid(mLbSnapshot);
+    AssertPtrReturnVoid(mPsSnapshot);
+    AssertPtrReturnVoid(mLbClipboard);
+    AssertPtrReturnVoid(mCbClipboard);
+    AssertPtrReturnVoid(mLbDragAndDrop);
+    AssertPtrReturnVoid(mCbDragAndDrop);
     mLbSnapshot->setEnabled(isMachineOffline());
     mPsSnapshot->setEnabled(isMachineOffline());
     mLbClipboard->setEnabled(isMachineInValidMode());
     mCbClipboard->setEnabled(isMachineInValidMode());
     mLbDragAndDrop->setEnabled(isMachineInValidMode());
     mCbDragAndDrop->setEnabled(isMachineInValidMode());
-    mLbMedia->setEnabled(isMachineInValidMode());
-    mCbSaveMounted->setEnabled(isMachineInValidMode());
-    mLbToolBar->setEnabled(isMachineInValidMode());
-    mCbShowToolBar->setEnabled(isMachineInValidMode());
-    mCbToolBarAlignment->setEnabled(isMachineInValidMode() && mCbShowToolBar->isChecked());
+
+    /* 'Description' tab: */
+    AssertPtrReturnVoid(mTeDescription);
+    mTeDescription->setEnabled(isMachineInValidMode());
+
+    /* 'Encryption' tab: */
+    AssertPtrReturnVoid(m_pCheckBoxEncryption);
+    AssertPtrReturnVoid(m_pWidgetEncryption);
+    m_pCheckBoxEncryption->setEnabled(isMachineOffline());
+    m_pWidgetEncryption->setEnabled(isMachineOffline() && m_pCheckBoxEncryption->isChecked());
 }
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
index 192ab68..5bbe53f 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.h
@@ -1,11 +1,10 @@
+/* $Id: UIMachineSettingsGeneral.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsGeneral class declaration
+ * VBox Qt GUI - UIMachineSettingsGeneral class declaration.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,113 +15,179 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-#ifndef __UIMachineSettingsGeneral_h__
-#define __UIMachineSettingsGeneral_h__
+#ifndef ___UIMachineSettingsGeneral_h___
+#define ___UIMachineSettingsGeneral_h___
 
-/* Local includes: */
+/* GUI includes: */
 #include "UISettingsPage.h"
 #include "UIMachineSettingsGeneral.gen.h"
+#include "UIAddDiskEncryptionPasswordDialog.h"
 
-/* Machine settings / General page / Data: */
+/** Machine settings: General page: Data structure. */
 struct UIDataSettingsMachineGeneral
 {
-    /* Default constructor: */
+    /** Constructor. */
     UIDataSettingsMachineGeneral()
         : m_strName(QString())
         , m_strGuestOsTypeId(QString())
-        , m_fSaveMountedAtRuntime(false)
-        , m_fShowMiniToolBar(false)
-        , m_fMiniToolBarAtTop(false)
         , m_strSnapshotsFolder(QString())
         , m_strSnapshotsHomeDir(QString())
         , m_clipboardMode(KClipboardMode_Disabled)
-        , m_dragAndDropMode(KDragAndDropMode_Disabled)
-        , m_strDescription(QString()) {}
-    /* Functions: */
+        , m_dndMode(KDnDMode_Disabled)
+        , m_strDescription(QString())
+        , m_fEncryptionEnabled(false)
+        , m_fEncryptionCipherChanged(false)
+        , m_fEncryptionPasswordChanged(false)
+        , m_iEncryptionCipherIndex(-1)
+        , m_strEncryptionPassword(QString())
+    {}
+
+    /** Returns whether passed @a other is equal to this. */
     bool equal(const UIDataSettingsMachineGeneral &other) const
     {
         return (m_strName == other.m_strName) &&
                (m_strGuestOsTypeId == other.m_strGuestOsTypeId) &&
-               (m_fSaveMountedAtRuntime == other.m_fSaveMountedAtRuntime) &&
-               (m_fShowMiniToolBar == other.m_fShowMiniToolBar) &&
-               (m_fMiniToolBarAtTop == other.m_fMiniToolBarAtTop) &&
                (m_strSnapshotsFolder == other.m_strSnapshotsFolder) &&
                (m_strSnapshotsHomeDir == other.m_strSnapshotsHomeDir) &&
                (m_clipboardMode == other.m_clipboardMode) &&
-               (m_dragAndDropMode == other.m_dragAndDropMode) &&
-               (m_strDescription == other.m_strDescription);
+               (m_dndMode == other.m_dndMode) &&
+               (m_strDescription == other.m_strDescription) &&
+               (m_fEncryptionEnabled == other.m_fEncryptionEnabled) &&
+               (m_fEncryptionCipherChanged == other.m_fEncryptionCipherChanged) &&
+               (m_fEncryptionPasswordChanged == other.m_fEncryptionPasswordChanged);
     }
-    /* Operators: */
+
+    /** Operator== implementation which returns whether passed @a other is equal to this. */
     bool operator==(const UIDataSettingsMachineGeneral &other) const { return equal(other); }
+    /** Operator!= implementation which returns whether passed @a other is differs from this. */
     bool operator!=(const UIDataSettingsMachineGeneral &other) const { return !equal(other); }
-    /* Variables: */
+
+    /** Holds the VM name. */
     QString m_strName;
+    /** Holds the VM OS type ID. */
     QString m_strGuestOsTypeId;
-    bool m_fSaveMountedAtRuntime;
-    bool m_fShowMiniToolBar;
-    bool m_fMiniToolBarAtTop;
+
+    /** Holds the VM snapshot folder. */
     QString m_strSnapshotsFolder;
+    /** Holds the default VM snapshot folder. */
     QString m_strSnapshotsHomeDir;
+    /** Holds the VM shared clipboard mode. */
     KClipboardMode m_clipboardMode;
-    KDragAndDropMode m_dragAndDropMode;
+    /** Holds the VM drag&drop mode. */
+    KDnDMode m_dndMode;
+
+    /** Holds the VM description. */
     QString m_strDescription;
+
+    /** Holds whether the encryption is enabled. */
+    bool m_fEncryptionEnabled;
+    /** Holds whether the encryption cipher was changed. */
+    bool m_fEncryptionCipherChanged;
+    /** Holds whether the encryption password was changed. */
+    bool m_fEncryptionPasswordChanged;
+    /** Holds the encryption cipher index. */
+    int m_iEncryptionCipherIndex;
+    /** Holds the encryption password. */
+    QString m_strEncryptionPassword;
+    /** Holds the encrypted medium ids. */
+    EncryptedMediumMap m_encryptedMediums;
+    /** Holds the encryption passwords. */
+    EncryptionPasswordMap m_encryptionPasswords;
 };
 typedef UISettingsCache<UIDataSettingsMachineGeneral> UICacheSettingsMachineGeneral;
 
-/* Machine settings / General page: */
+/** Machine settings: General page. */
 class UIMachineSettingsGeneral : public UISettingsPageMachine,
-                              public Ui::UIMachineSettingsGeneral
+                                 public Ui::UIMachineSettingsGeneral
 {
     Q_OBJECT;
 
 public:
 
+    /** Constructor. */
     UIMachineSettingsGeneral();
 
+    /** Returns the VM OS type ID. */
     CGuestOSType guestOSType() const;
-    void setHWVirtExEnabled(bool fEnabled);
+    /** Returns whether 64bit OS type ID is selected. */
     bool is64BitOSTypeSelected() const;
 #ifdef VBOX_WITH_VIDEOHWACCEL
+    /** Returns whether Windows OS type ID is selected. */
     bool isWindowsOSTypeSelected() const;
 #endif /* VBOX_WITH_VIDEOHWACCEL */
 
+    /** Defines whether HW virtualization extension is enabled. */
+    void setHWVirtExEnabled(bool fEnabled);
+
 protected:
 
-    /* Load data to cache from corresponding external object(s),
-     * this task COULD be performed in other than GUI thread: */
+    /** Loads data into the cache from the corresponding external object(s).
+      * @note This task COULD be performed in other than GUI thread. */
     void loadToCacheFrom(QVariant &data);
-    /* Load data to corresponding widgets from cache,
-     * this task SHOULD be performed in GUI thread only: */
+    /** Loads data into the corresponding widgets from the cache,
+      * @note This task SHOULD be performed in GUI thread only! */
     void getFromCache();
 
-    /* Page changed: */
+    /** Returns whether the page was changed: */
     bool changed() const { return m_cache.wasChanged(); }
 
-    /* Save data from corresponding widgets to cache,
-     * this task SHOULD be performed in GUI thread only: */
+    /** Saves the data from the corresponding widgets into the cache,
+      * @note This task SHOULD be performed in GUI thread only! */
     void putToCache();
-    /* Save data from cache to corresponding external object(s),
-     * this task COULD be performed in other than GUI thread: */
+    /** Save data from the cache into the corresponding external object(s).
+      * @note This task COULD be performed in other than GUI thread. */
     void saveFromCacheTo(QVariant &data);
 
-    /* API: Validation stuff: */
+    /** Validation routine. */
     bool validate(QList<UIValidationMessage> &messages);
 
-    void setOrderAfter (QWidget *aWidget);
+    /** Tab-order assignment routine. */
+    void setOrderAfter(QWidget *aWidget);
 
+    /** Translation routine. */
     void retranslateUi();
 
-private:
+private slots:
+
+    /** Marks the encryption cipher as changed. */
+    void sltMarkEncryptionCipherChanged() { m_fEncryptionCipherChanged = true; }
+    /** Marks the encryption cipher and password as changed. */
+    void sltMarkEncryptionPasswordChanged() { m_fEncryptionCipherChanged = true; m_fEncryptionPasswordChanged = true; }
 
-    /* Helper: Prepare stuff: */
-    void prepareValidation();
+private:
 
+    /** Prepare routine. */
+    void prepare();
+    /** Prepare 'Basic' tab routine. */
+    void prepareTabBasic();
+    /** Prepare 'Advanced' tab routine. */
+    void prepareTabAdvanced();
+    /** Prepare 'Description' tab routine. */
+    void prepareTabDescription();
+    /** Prepare 'Encryption' tab routine. */
+    void prepareTabEncryption();
+
+    /** Polish routine. */
     void polishPage();
 
-    /* Cache: */
-    bool m_fHWVirtExEnabled;
+    /** Holds the page cache. */
     UICacheSettingsMachineGeneral m_cache;
-};
 
-#endif // __UIMachineSettingsGeneral_h__
+    /** Holds whether HW virtualization extension is enabled. */
+    bool m_fHWVirtExEnabled;
+
+    /** Holds whether the encryption cipher was changed.
+      * We are holding that argument here because we do not know
+      * the old <i>cipher</i> for sure to compare the new one with. */
+    bool m_fEncryptionCipherChanged;
+    /** Holds whether the encryption password was changed.
+      * We are holding that argument here because we do not know
+      * the old <i>password</i> at all to compare the new one with. */
+    bool m_fEncryptionPasswordChanged;
+
+    /** Holds the hard-coded encryption cipher list.
+      * We are hard-coding it because there is no place we can get it from. */
+    QStringList m_encryptionCiphers;
+};
 
+#endif /* !___UIMachineSettingsGeneral_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.ui
index e64677c..e2f7a82 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.ui
@@ -30,7 +30,7 @@
      </property>
      <widget class="QWidget" name="mTabBasic" >
       <attribute name="title" >
-       <string>&Basic</string>
+       <string>Basi&c</string>
       </attribute>
       <layout class="QVBoxLayout" name="mLtBasic" >
        <property name="spacing" >
@@ -56,7 +56,7 @@
      </widget>
      <widget class="QWidget" name="mTabAdvanced" >
       <attribute name="title" >
-       <string>&Advanced</string>
+       <string>A&dvanced</string>
       </attribute>
       <layout class="QVBoxLayout" name="mLtAdvanced" >
        <property name="spacing" >
@@ -133,7 +133,7 @@
           <item row="2" column="0" >
            <widget class="QLabel" name="mLbDragAndDrop" >
             <property name="text" >
-             <string>&Drag'n'Drop:</string>
+             <string>D&rag'n'Drop:</string>
             </property>
             <property name="alignment" >
              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -169,92 +169,168 @@
             </property>
            </spacer>
           </item>
-          <item row="3" column="0" >
-           <widget class="QLabel" name="mLbMedia" >
-            <property name="text" >
-             <string>Removable Media:</string>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <spacer name="mSpVer3" >
+         <property name="orientation" >
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0" >
+          <size>
+           <width>0</width>
+           <height>0</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="mTabDescription" >
+      <attribute name="title" >
+       <string>D&escription</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="mLtDescription" >
+       <property name="spacing" >
+        <number>0</number>
+       </property>
+       <item>
+        <widget class="QTextEdit" name="mTeDescription" >
+         <property name="whatsThis" >
+          <string>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</string>
+         </property>
+         <property name="acceptRichText" >
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="m_pTabEncryption">
+      <attribute name="title">
+       <string>Enc&ryption</string>
+      </attribute>
+      <layout class="QGridLayout" name="m_pLayoutEncryption">
+       <item row="0" column="0" colspan="2">
+        <widget class="QCheckBox" name="m_pCheckBoxEncryption">
+         <property name="whatsThis">
+          <string>When checked, enables encryption for this virtual machine.</string>
+         </property>
+         <property name="text">
+          <string>En&able Encryption</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <spacer>
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint">
+          <size>
+           <width>20</width>
+           <height>0</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="1" column="1">
+        <widget class="QWidget" name="m_pWidgetEncryption">
+         <property name="sizePolicy">
+          <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+           <horstretch>1</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <layout class="QGridLayout" name="m_pLayoutEncryptionSettings">
+          <property name="leftMargin">
+           <number>0</number>
+          </property>
+          <property name="topMargin">
+           <number>0</number>
+          </property>
+          <property name="rightMargin">
+           <number>0</number>
+          </property>
+          <property name="bottomMargin">
+           <number>0</number>
+          </property>
+          <item row="0" column="0">
+           <widget class="QLabel" name="m_pLabelCipher">
+            <property name="text">
+             <string>Encryption C&ipher:</string>
             </property>
-            <property name="alignment" >
+            <property name="alignment">
              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
             </property>
+            <property name="buddy">
+             <cstring>m_pComboCipher</cstring>
+            </property>
            </widget>
           </item>
-          <item row="3" column="1" >
-           <widget class="QCheckBox" name="mCbSaveMounted" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
+          <item row="0" column="1">
+           <widget class="QComboBox" name="m_pComboCipher">
             <property name="whatsThis" >
-             <string>If checked, any CD/DVD or floppy disks inserted into or removed from the virtual drives while the machine is running will be remembered.</string>
-            </property>
-            <property name="text" >
-             <string>&Remember Runtime Changes</string>
-            </property>
-            <property name="checked" >
-             <bool>true</bool>
+             <string>Holds the cipher to be used for encrypting the virtual machine disks.</string>
             </property>
            </widget>
           </item>
-          <item row="4" column="0" >
-           <widget class="QLabel" name="mLbToolBar" >
-            <property name="text" >
-             <string>Mini ToolBar:</string>
+          <item row="1" column="0">
+           <widget class="QLabel" name="m_pLabelPassword1">
+            <property name="text">
+             <string>E&nter New Password:</string>
             </property>
-            <property name="alignment" >
+            <property name="alignment">
              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
             </property>
+            <property name="buddy">
+             <cstring>m_pEditorEncryptionPassword</cstring>
+            </property>
            </widget>
           </item>
-          <item row="4" column="1" >
-           <widget class="QCheckBox" name="mCbShowToolBar" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
+          <item row="1" column="1">
+           <widget class="QLineEdit" name="m_pEditorEncryptionPassword">
             <property name="whatsThis" >
-             <string>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</string>
-            </property>
-            <property name="text" >
-             <string>Show in &Fullscreen/Seamless</string>
-            </property>
-            <property name="checked" >
-             <bool>true</bool>
+             <string>Holds the password to be assigned to the virtual machine.</string>
             </property>
            </widget>
           </item>
-          <item row="5" column="1" >
-           <widget class="QCheckBox" name="mCbToolBarAlignment" >
-            <property name="sizePolicy" >
-             <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
+          <item row="2" column="0">
+           <widget class="QLabel" name="m_pLabelPassword2">
+            <property name="text">
+             <string>C&onfirm New Password:</string>
             </property>
-            <property name="whatsThis" >
-             <string>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</string>
+            <property name="alignment">
+             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
             </property>
-            <property name="text" >
-             <string>Show at &Top of Screen</string>
+            <property name="buddy">
+             <cstring>m_pEditorEncryptionPasswordConfirm</cstring>
             </property>
-            <property name="checked" >
-             <bool>false</bool>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <widget class="QLineEdit" name="m_pEditorEncryptionPasswordConfirm">
+            <property name="whatsThis" >
+             <string>Confirms the password to be assigned to the virtual machine.</string>
             </property>
            </widget>
           </item>
          </layout>
         </widget>
        </item>
-       <item>
-        <spacer name="mSpVer3" >
-         <property name="orientation" >
+       <item row="2" column="1">
+        <spacer>
+         <property name="orientation">
           <enum>Qt::Vertical</enum>
          </property>
-         <property name="sizeHint" stdset="0" >
+         <property name="sizeType">
+          <enum>QSizePolicy::Expanding</enum>
+         </property>
+         <property name="sizeHint">
           <size>
            <width>0</width>
            <height>0</height>
@@ -264,26 +340,6 @@
        </item>
       </layout>
      </widget>
-     <widget class="QWidget" name="mTabDescription" >
-      <attribute name="title" >
-       <string>&Description</string>
-      </attribute>
-      <layout class="QVBoxLayout" name="mLtDescription" >
-       <property name="spacing" >
-        <number>0</number>
-       </property>
-       <item>
-        <widget class="QTextEdit" name="mTeDescription" >
-         <property name="whatsThis" >
-          <string>Holds the description of the virtual machine. The description field is useful for commenting on configuration details of the installed guest OS.</string>
-         </property>
-         <property name="acceptRichText" >
-          <bool>false</bool>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
     </widget>
    </item>
   </layout>
@@ -309,20 +365,10 @@
  <resources/>
  <connections>
   <connection>
-   <sender>mCbShowToolBar</sender>
+   <sender>m_pCheckBoxEncryption</sender>
    <signal>toggled(bool)</signal>
-   <receiver>mCbToolBarAlignment</receiver>
+   <receiver>m_pWidgetEncryption</receiver>
    <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>195</x>
-     <y>50</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>196</x>
-     <y>72</y>
-    </hint>
-   </hints>
   </connection>
  </connections>
 </ui>
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
new file mode 100644
index 0000000..8a9c8b5
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.cpp
@@ -0,0 +1,188 @@
+/* $Id: UIMachineSettingsInterface.cpp $ */
+/** @file
+ * VBox Qt GUI - UIMachineSettingsInterface class implementation.
+ */
+
+/*
+ * Copyright (C) 2008-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* GUI includes: */
+# include "UIMachineSettingsInterface.h"
+# include "UIExtraDataManager.h"
+# include "UIActionPool.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+UIMachineSettingsInterface::UIMachineSettingsInterface(const QString strMachineID)
+    : m_strMachineID(strMachineID)
+    , m_pActionPool(0)
+{
+    /* Prepare: */
+    prepare();
+}
+
+UIMachineSettingsInterface::~UIMachineSettingsInterface()
+{
+    /* Cleanup: */
+    cleanup();
+}
+
+/* Load data to cache from corresponding external object(s),
+ * this task COULD be performed in other than GUI thread: */
+void UIMachineSettingsInterface::loadToCacheFrom(QVariant &data)
+{
+    /* Fetch data to machine: */
+    UISettingsPageMachine::fetchData(data);
+
+    /* Clear cache initially: */
+    m_cache.clear();
+
+    /* Prepare interface data: */
+    UIDataSettingsMachineInterface interfaceData;
+
+    /* Cache interface data: */
+#ifndef Q_WS_MAC
+    interfaceData.m_fShowMiniToolBar = gEDataManager->miniToolbarEnabled(m_machine.GetId());
+    interfaceData.m_fMiniToolBarAtTop = gEDataManager->miniToolbarAlignment(m_machine.GetId()) == Qt::AlignTop;
+#endif /* !Q_WS_MAC */
+
+    /* Cache interface data: */
+    m_cache.cacheInitialData(interfaceData);
+
+    /* Upload machine to data: */
+    UISettingsPageMachine::uploadData(data);
+}
+
+/* Load data to corresponding widgets from cache,
+ * this task SHOULD be performed in GUI thread only: */
+void UIMachineSettingsInterface::getFromCache()
+{
+    /* Get interface data from cache: */
+    const UIDataSettingsMachineInterface &interfaceData = m_cache.base();
+
+    /* Prepare interface data: */
+#ifndef Q_WS_MAC
+    m_pCheckBoxShowMiniToolBar->setChecked(interfaceData.m_fShowMiniToolBar);
+    m_pComboToolBarAlignment->setChecked(interfaceData.m_fMiniToolBarAtTop);
+#else /* Q_WS_MAC */
+    Q_UNUSED(interfaceData);
+#endif /* Q_WS_MAC */
+
+    /* Polish page finally: */
+    polishPage();
+
+    /* Revalidate: */
+    revalidate();
+}
+
+/* Save data from corresponding widgets to cache,
+ * this task SHOULD be performed in GUI thread only: */
+void UIMachineSettingsInterface::putToCache()
+{
+    /* Prepare interface data: */
+    UIDataSettingsMachineInterface interfaceData = m_cache.base();
+
+    /* Gather interface data from page: */
+#ifndef Q_WS_MAC
+    interfaceData.m_fShowMiniToolBar = m_pCheckBoxShowMiniToolBar->isChecked();
+    interfaceData.m_fMiniToolBarAtTop = m_pComboToolBarAlignment->isChecked();
+#endif /* !Q_WS_MAC */
+
+    /* Cache interface data: */
+    m_cache.cacheCurrentData(interfaceData);
+}
+
+/* Save data from cache to corresponding external object(s),
+ * this task COULD be performed in other than GUI thread: */
+void UIMachineSettingsInterface::saveFromCacheTo(QVariant &data)
+{
+    /* Fetch data to machine: */
+    UISettingsPageMachine::fetchData(data);
+
+    /* Make sure machine is in valid mode & interface data was changed: */
+    if (isMachineInValidMode() && m_cache.wasChanged())
+    {
+        /* Get interface data from cache: */
+        const UIDataSettingsMachineInterface &interfaceData = m_cache.data();
+
+        /* Store interface data: */
+        if (isMachineInValidMode())
+        {
+#ifndef Q_WS_MAC
+            gEDataManager->setMiniToolbarEnabled(interfaceData.m_fShowMiniToolBar, m_machine.GetId());
+            gEDataManager->setMiniToolbarAlignment(interfaceData.m_fMiniToolBarAtTop ? Qt::AlignTop : Qt::AlignBottom, m_machine.GetId());
+#else /* Q_WS_MAC */
+            Q_UNUSED(interfaceData);
+#endif /* Q_WS_MAC */
+        }
+    }
+
+    /* Upload machine to data: */
+    UISettingsPageMachine::uploadData(data);
+}
+
+void UIMachineSettingsInterface::setOrderAfter(QWidget *pWidget)
+{
+    /* Tab-order: */
+    setTabOrder(pWidget, m_pCheckBoxShowMiniToolBar);
+    setTabOrder(m_pCheckBoxShowMiniToolBar, m_pComboToolBarAlignment);
+}
+
+void UIMachineSettingsInterface::retranslateUi()
+{
+    /* Translate uic generated strings: */
+    Ui::UIMachineSettingsInterface::retranslateUi(this);
+}
+
+void UIMachineSettingsInterface::polishPage()
+{
+    /* Polish interface availability: */
+    m_pMenuBarEditor->setEnabled(isMachineInValidMode());
+#ifdef Q_WS_MAC
+    m_pLabelMiniToolBar->hide();
+    m_pCheckBoxShowMiniToolBar->hide();
+    m_pComboToolBarAlignment->hide();
+#else /* !Q_WS_MAC */
+    m_pLabelMiniToolBar->setEnabled(isMachineInValidMode());
+    m_pCheckBoxShowMiniToolBar->setEnabled(isMachineInValidMode());
+    m_pComboToolBarAlignment->setEnabled(isMachineInValidMode() && m_pCheckBoxShowMiniToolBar->isChecked());
+#endif /* !Q_WS_MAC */
+    m_pStatusBarEditor->setEnabled(isMachineInValidMode());
+}
+
+void UIMachineSettingsInterface::prepare()
+{
+    /* Apply UI decorations: */
+    Ui::UIMachineSettingsInterface::setupUi(this);
+
+    /* Create personal action-pool: */
+    m_pActionPool = UIActionPool::create(UIActionPoolType_Runtime);
+    m_pMenuBarEditor->setActionPool(m_pActionPool);
+
+    /* Assign corresponding machine ID: */
+    m_pMenuBarEditor->setMachineID(m_strMachineID);
+    m_pStatusBarEditor->setMachineID(m_strMachineID);
+
+    /* Translate finally: */
+    retranslateUi();
+}
+
+void UIMachineSettingsInterface::cleanup()
+{
+    /* Destroy personal action-pool: */
+    UIActionPool::destroy(m_pActionPool);
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
new file mode 100644
index 0000000..ba86576
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.h
@@ -0,0 +1,121 @@
+/* $Id: UIMachineSettingsInterface.h $ */
+/** @file
+ * VBox Qt GUI - UIMachineSettingsInterface class declaration.
+ */
+
+/*
+ * Copyright (C) 2008-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIMachineSettingsInterface_h___
+#define ___UIMachineSettingsInterface_h___
+
+/* GUI includes: */
+#include "UISettingsPage.h"
+#include "UIMachineSettingsInterface.gen.h"
+
+/* Forward declarations: */
+class UIActionPool;
+
+/* Machine settings / User Interface page / Data: */
+struct UIDataSettingsMachineInterface
+{
+    /* Constructor: */
+    UIDataSettingsMachineInterface()
+#ifndef Q_WS_MAC
+        : m_fShowMiniToolBar(false)
+        , m_fMiniToolBarAtTop(false)
+#endif /* !Q_WS_MAC */
+    {}
+
+    /* Functions: */
+    bool equal(const UIDataSettingsMachineInterface &other) const
+    {
+#ifndef Q_WS_MAC
+        return (m_fShowMiniToolBar == other.m_fShowMiniToolBar) &&
+               (m_fMiniToolBarAtTop == other.m_fMiniToolBarAtTop);
+#else /* Q_WS_MAC */
+        Q_UNUSED(other);
+        return true;
+#endif /* Q_WS_MAC */
+    }
+
+    /* Operators: */
+    bool operator==(const UIDataSettingsMachineInterface &other) const { return equal(other); }
+    bool operator!=(const UIDataSettingsMachineInterface &other) const { return !equal(other); }
+
+    /* Variables: */
+#ifndef Q_WS_MAC
+    bool m_fShowMiniToolBar;
+    bool m_fMiniToolBarAtTop;
+#endif /* !Q_WS_MAC */
+};
+typedef UISettingsCache<UIDataSettingsMachineInterface> UICacheSettingsMachineInterface;
+
+/* Machine settings / User Interface page: */
+class UIMachineSettingsInterface : public UISettingsPageMachine,
+                                   public Ui::UIMachineSettingsInterface
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, early takes @a strMachineID into account for size-hint calculation. */
+    UIMachineSettingsInterface(const QString strMachineID);
+    /** Destructor. */
+    ~UIMachineSettingsInterface();
+
+protected:
+
+    /* API: Cache stuff: */
+    bool changed() const { return m_cache.wasChanged(); }
+
+    /* API: Load data to cache from corresponding external object(s),
+     * this task COULD be performed in other than GUI thread: */
+    void loadToCacheFrom(QVariant &data);
+    /* API: Load data to corresponding widgets from cache,
+     * this task SHOULD be performed in GUI thread only: */
+    void getFromCache();
+
+    /* API: Save data from corresponding widgets to cache,
+     * this task SHOULD be performed in GUI thread only: */
+    void putToCache();
+    /* API: Save data from cache to corresponding external object(s),
+     * this task COULD be performed in other than GUI thread: */
+    void saveFromCacheTo(QVariant &data);
+
+    /* Helper: Navigation stuff: */
+    void setOrderAfter(QWidget *pWidget);
+
+    /* Helper: Translation stuff: */
+    void retranslateUi();
+
+    /* Helper: Polishing stuff: */
+    void polishPage();
+
+private:
+
+    /** Prepare routine. */
+    void prepare();
+
+    /** Cleanup routine. */
+    void cleanup();
+
+    /* Cache: */
+    UICacheSettingsMachineInterface m_cache;
+
+    /** Holds the machine ID copy. */
+    const QString m_strMachineID;
+    /** Holds the action-pool instance. */
+    UIActionPool *m_pActionPool;
+};
+
+#endif // ___UIMachineSettingsInterface_h___
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.ui
new file mode 100644
index 0000000..93c4c73
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsInterface.ui
@@ -0,0 +1,146 @@
+<ui version="4.0">
+ <comment>
+ VBox frontends: Qt4 GUI ("VirtualBox"):
+
+ Copyright (C) 2008-2015 Oracle Corporation
+
+ This file is part of VirtualBox Open Source Edition (OSE), as
+ available from http://www.virtualbox.org. This file is free software;
+ you can redistribute it and/or modify it under the terms of the GNU
+ General Public License (GPL) as published by the Free Software
+ Foundation, in version 2 as it comes in the "COPYING" file of the
+ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ </comment>
+ <class>UIMachineSettingsInterface</class>
+ <widget class="QWidget" name="UIMachineSettingsInterface">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>350</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <layout class="QGridLayout" name="m_pLayoutMain">
+   <item row="0" column="0" colspan="3">
+    <widget class="UIMenuBarEditorWidget" name="m_pMenuBarEditor">
+     <property name="sizePolicy">
+      <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="whatsThis">
+      <string>Allows to modify VM menu-bar contents.</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="m_pLabelMiniToolBar">
+     <property name="text">
+      <string>Mini ToolBar:</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1" colspan="2">
+    <widget class="QCheckBox" name="m_pCheckBoxShowMiniToolBar">
+     <property name="sizePolicy">
+      <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="whatsThis">
+      <string>If checked, show the Mini ToolBar in Fullscreen and Seamless modes.</string>
+     </property>
+     <property name="text">
+      <string>Show in &Fullscreen/Seamless</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1" colspan="2">
+    <widget class="QCheckBox" name="m_pComboToolBarAlignment">
+     <property name="sizePolicy">
+      <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="whatsThis">
+      <string>If checked, show the Mini ToolBar at the top of the screen, rather than in its default position at the bottom of the screen.</string>
+     </property>
+     <property name="text">
+      <string>Show at &Top of Screen</string>
+     </property>
+     <property name="checked">
+      <bool>false</bool>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="3">
+    <spacer name="m_pSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>0</width>
+       <height>0</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="4" column="0" colspan="3">
+    <widget class="UIStatusBarEditorWidget" name="m_pStatusBarEditor">
+     <property name="sizePolicy">
+      <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="whatsThis">
+      <string>Allows to modify VM status-bar contents.</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>UIMenuBarEditorWidget</class>
+   <extends>QWidget</extends>
+   <header>UIMenuBarEditorWindow.h</header>
+  </customwidget>
+  <customwidget>
+   <class>UIStatusBarEditorWidget</class>
+   <extends>QWidget</extends>
+   <header>UIStatusBarEditorWindow.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>m_pCheckBoxShowMiniToolBar</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>m_pComboToolBarAlignment</receiver>
+   <slot>setEnabled(bool)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>195</x>
+     <y>50</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>196</x>
+     <y>72</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
index b14ce64..9430a2f 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsNetwork.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsNetwork class implementation
+ * VBox Qt GUI - UIMachineSettingsNetwork class implementation.
  */
 
 /*
@@ -17,19 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "QIWidgetValidator.h"
-#include "QIArrowButtonSwitch.h"
-#include "UIMachineSettingsNetwork.h"
-#include "QITabWidget.h"
-#include "VBoxGlobal.h"
-#include "UIConverter.h"
+# include "QIWidgetValidator.h"
+# include "QIArrowButtonSwitch.h"
+# include "UIMachineSettingsNetwork.h"
+# include "QITabWidget.h"
+# include "VBoxGlobal.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
 
 /* COM includes: */
-#include "CNetworkAdapter.h"
+# include "CNetworkAdapter.h"
+# include "CHostNetworkInterface.h"
+# include "CNATNetwork.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #include "CNATEngine.h"
-#include "CHostNetworkInterface.h"
-#include "CNATNetwork.h"
 
 /* Other VBox includes: */
 #ifdef VBOX_WITH_VDE
@@ -37,6 +43,7 @@
 # include <VBox/VDEPlug.h>
 #endif /* VBOX_WITH_VDE */
 
+
 /* Empty item extra-code: */
 const char *pEmptyItemCode = "#empty#";
 
@@ -57,13 +64,19 @@ UIMachineSettingsNetwork::UIMachineSettingsNetwork(UIMachineSettingsNetworkPage
     m_pAdapterNameCombo->setInsertPolicy(QComboBox::NoInsert);
     m_pMACEditor->setValidator(new QRegExpValidator(QRegExp("[0-9A-Fa-f]{12}"), this));
     m_pMACEditor->setMinimumWidthByText(QString().fill('0', 12));
+    m_pMACButton->setIcon(UIIconPool::iconSet(":/refresh_16px.png"));
+    m_pAdvancedArrow->setIconSize(QSize(10, 10));
+    m_pAdvancedArrow->setIconForButtonState(QIArrowButtonSwitch::ButtonState_Collapsed,
+                                            UIIconPool::iconSet(":/arrow_right_10px.png"));
+    m_pAdvancedArrow->setIconForButtonState(QIArrowButtonSwitch::ButtonState_Expanded,
+                                            UIIconPool::iconSet(":/arrow_down_10px.png"));
 
     /* Setup connections: */
     connect(m_pEnableAdapterCheckBox, SIGNAL(toggled(bool)), this, SLOT(sltHandleAdapterActivityChange()));
     connect(m_pAttachmentTypeComboBox, SIGNAL(activated(int)), this, SLOT(sltHandleAttachmentTypeChange()));
     connect(m_pAdapterNameCombo, SIGNAL(activated(int)), this, SLOT(sltHandleAlternativeNameChange()));
     connect(m_pAdapterNameCombo, SIGNAL(editTextChanged(const QString&)), this, SLOT(sltHandleAlternativeNameChange()));
-    connect(m_pAdvancedArrow, SIGNAL(clicked()), this, SLOT(sltHandleAdvancedButtonStateChange()));
+    connect(m_pAdvancedArrow, SIGNAL(sigClicked()), this, SLOT(sltHandleAdvancedButtonStateChange()));
     connect(m_pMACButton, SIGNAL(clicked()), this, SLOT(sltGenerateMac()));
     connect(m_pPortForwardingButton, SIGNAL(clicked()), this, SLOT(sltOpenPortForwardingDlg()));
     connect(this, SIGNAL(sigTabUpdated()), m_pParent, SLOT(sltHandleUpdatedTab()));
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
index ac3801d..5065877 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsNetwork.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsNetwork class declaration
+ * VBox Qt GUI - UIMachineSettingsNetwork class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.ui
index 936939f..d4feb2a 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.ui
@@ -217,13 +217,6 @@
         <property name="whatsThis">
          <string>Generates a new random MAC address.</string>
         </property>
-        <property name="icon">
-         <iconset resource="../VirtualBox1.qrc">
-          <normaloff>:/refresh_16px.png</normaloff>:/refresh_16px.png</iconset>
-        </property>
-        <property name="autoRaise">
-         <bool>true</bool>
-        </property>
        </widget>
       </item>
       <item row="6" column="0">
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
index 4f075b7..a1edcda 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsParallel.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsParallel class implementation
+ * VBox Qt GUI - UIMachineSettingsParallel class implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
+# include <QDir>
 
 /* GUI includes: */
-#include "UIMachineSettingsParallel.h"
-#include "QIWidgetValidator.h"
-#include "VBoxGlobal.h"
-#include "QITabWidget.h"
+# include "UIMachineSettingsParallel.h"
+# include "QIWidgetValidator.h"
+# include "VBoxGlobal.h"
+# include "QITabWidget.h"
 
 /* COM includes: */
-#include "CParallelPort.h"
+# include "CParallelPort.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* UIMachineSettingsParallel stuff */
 UIMachineSettingsParallel::UIMachineSettingsParallel(UIMachineSettingsParallelPage *pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h
index 7b519e8..e1b2045 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsParallel.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsParallel.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsParallel class declaration
+ * VBox Qt GUI - UIMachineSettingsParallel class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp
index 6c3b0f8..7bd7379 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsPortForwardingDlg.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsPortForwardingDlg class implementation
+ * VBox Qt GUI - UIMachineSettingsPortForwardingDlg class implementation.
  */
 
 /*
@@ -17,14 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QPushButton>
+# include <QVBoxLayout>
+# include <QPushButton>
 
 /* GUI includes: */
-#include "UIMachineSettingsPortForwardingDlg.h"
-#include "UIIconPool.h"
-#include "QIDialogButtonBox.h"
+# include "UIMachineSettingsPortForwardingDlg.h"
+# include "UIIconPool.h"
+# include "QIDialogButtonBox.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineSettingsPortForwardingDlg::UIMachineSettingsPortForwardingDlg(QWidget *pParent,
                                                                        const UIPortForwardingDataList &rules)
@@ -33,7 +38,7 @@ UIMachineSettingsPortForwardingDlg::UIMachineSettingsPortForwardingDlg(QWidget *
     , m_pButtonBox(0)
 {
     /* Set dialog icon: */
-    setWindowIcon(UIIconPool::iconSetFull(QSize(32, 32), QSize(16, 16), ":/nw_32px.png", ":/nw_16px.png"));
+    setWindowIcon(UIIconPool::iconSetFull(":/nw_32px.png", ":/nw_16px.png"));
 
     /* Create layout: */
     QVBoxLayout *pMainLayout = new QVBoxLayout(this);
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.h
index b4a012e..eb5ee0f 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsPortForwardingDlg.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsPortForwardingDlg class declaration
+ * VBox Qt GUI - UIMachineSettingsPortForwardingDlg class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
index 44067fb..9210046 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsSF.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsSF class implementation
+ * VBox Qt GUI - UIMachineSettingsSF class implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Local includes */
-#include "UIIconPool.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "VBoxUtils.h"
-#include "UIMachineSettingsSF.h"
-#include "UIMachineSettingsSFDetails.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "VBoxUtils.h"
+# include "UIMachineSettingsSF.h"
+# include "UIMachineSettingsSFDetails.h"
 
 /* Global includes */
-#include <QHeaderView>
-#include <QTimer>
+# include <QHeaderView>
+# include <QTimer>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 class SFTreeViewItem : public QTreeWidgetItem
 {
@@ -187,7 +192,6 @@ UIMachineSettingsSF::UIMachineSettingsSF()
                                             ":/sf_remove_disabled_16px.png"));
 
     /* Prepare tool-bar: */
-    m_pFoldersToolBar->setUsesTextLabel(false);
     m_pFoldersToolBar->setIconSize(QSize(16, 16));
     m_pFoldersToolBar->setOrientation(Qt::Vertical);
     m_pFoldersToolBar->addAction(mNewAction);
@@ -658,7 +662,7 @@ bool UIMachineSettingsSF::isSharedFolderTypeSupported(UISharedFolderType sharedF
             fIsSharedFolderTypeSupported = isMachineInValidMode();
             break;
         case ConsoleType:
-            fIsSharedFolderTypeSupported = isMachineSaved() || isMachineOnline();
+            fIsSharedFolderTypeSupported = isMachineOnline();
             break;
         default:
             break;
@@ -853,3 +857,4 @@ bool UIMachineSettingsSF::createSharedFolder(const UICacheSettingsSharedFolder &
     }
     return true;
 }
+
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h
index 1bdc854..439117a 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsSF.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsSF class declaration
+ * VBox Qt GUI - UIMachineSettingsSF class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp
index 25219fd..f682c96 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsSFDetails.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsSFDetails class implementation
+ * VBox Qt GUI - UIMachineSettingsSFDetails class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes */
-#include <QDir>
-#include <QPushButton>
+# include <QDir>
+# include <QPushButton>
 
 /* Other includes */
-#include "UIMachineSettingsSFDetails.h"
-#include "VBoxGlobal.h"
+# include "UIMachineSettingsSFDetails.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineSettingsSFDetails::UIMachineSettingsSFDetails(DialogType type,
                                                        bool fEnableSelector, /* for "permanent" checkbox */
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h
index 5ec3a35..80c1ef0 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsSFDetails.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsSFDetails class declaration
+ * VBox Qt GUI - UIMachineSettingsSFDetails class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.ui
index b3eaf32..3e973c1 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.ui
@@ -22,9 +22,6 @@
     <height>196</height>
    </rect>
   </property>
-  <property name="windowTitle" >
-   <string>Window</string>
-  </property>
   <layout class="QGridLayout" >
    <item row="0" column="0" >
     <widget class="QLabel" name="mLbPath" >
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
index ac3832d..e69579f 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIMachineSettingsSerial.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsSerial class implementation
+ * VBox Qt GUI - UIMachineSettingsSerial class implementation.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,18 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
+# include <QDir>
 
 /* GUI includes: */
-#include "UIMachineSettingsSerial.h"
-#include "QIWidgetValidator.h"
-#include "VBoxGlobal.h"
-#include "QITabWidget.h"
-#include "UIConverter.h"
+# include "UIMachineSettingsSerial.h"
+# include "QIWidgetValidator.h"
+# include "VBoxGlobal.h"
+# include "QITabWidget.h"
+# include "UIConverter.h"
 
 /* COM includes: */
-#include "CSerialPort.h"
+# include "CSerialPort.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* UIMachineSettingsSerial stuff */
 UIMachineSettingsSerial::UIMachineSettingsSerial(UIMachineSettingsSerialPage *pParent)
@@ -57,6 +62,7 @@ UIMachineSettingsSerial::UIMachineSettingsSerial(UIMachineSettingsSerialPage *pP
     mCbMode->addItem (""); /* KPortMode_HostPipe */
     mCbMode->addItem (""); /* KPortMode_HostDevice */
     mCbMode->addItem (""); /* KPortMode_RawFile */
+    mCbMode->addItem (""); /* KPortMode_TCP */
 
     /* Setup connections */
     connect (mGbSerial, SIGNAL (toggled (bool)),
@@ -88,7 +94,8 @@ void UIMachineSettingsSerial::polishTab()
     mLeIOPort->setEnabled(!fStd && m_pParent->isMachineOffline());
     mLbMode->setEnabled(m_pParent->isMachineOffline());
     mCbMode->setEnabled(m_pParent->isMachineOffline());
-    mCbPipe->setEnabled(mode == KPortMode_HostPipe && m_pParent->isMachineOffline());
+    mCbPipe->setEnabled((mode == KPortMode_HostPipe || mode == KPortMode_TCP)
+      && m_pParent->isMachineOffline());
     mLbPath->setEnabled(m_pParent->isMachineOffline());
     mLePath->setEnabled(mode != KPortMode_Disconnected && m_pParent->isMachineOffline());
 }
@@ -107,7 +114,7 @@ void UIMachineSettingsSerial::fetchPortData(const UICacheSettingsMachineSerialPo
     mLeIRQ->setText(QString::number(portData.m_uIRQ));
     mLeIOPort->setText("0x" + QString::number(portData.m_uIOBase, 16).toUpper());
     mCbMode->setCurrentIndex(mCbMode->findText(gpConverter->toString(portData.m_hostMode)));
-    mCbPipe->setChecked(portData.m_fServer);
+    mCbPipe->setChecked(!portData.m_fServer);
     mLePath->setText(portData.m_strPath);
 
     /* Ensure everything is up-to-date */
@@ -123,7 +130,7 @@ void UIMachineSettingsSerial::uploadPortData(UICacheSettingsMachineSerialPort &p
     portData.m_fPortEnabled = mGbSerial->isChecked();
     portData.m_uIRQ = mLeIRQ->text().toULong(NULL, 0);
     portData.m_uIOBase = mLeIOPort->text().toULong (NULL, 0);
-    portData.m_fServer = mCbPipe->isChecked();
+    portData.m_fServer = !mCbPipe->isChecked();
     portData.m_hostMode = gpConverter->fromString<KPortMode>(mCbMode->currentText());
     portData.m_strPath = QDir::toNativeSeparators(mLePath->text());
 
@@ -161,6 +168,7 @@ void UIMachineSettingsSerial::retranslateUi()
 
     mCbNumber->setItemText (mCbNumber->count() - 1, vboxGlobal().toCOMPortName (0, 0));
 
+    mCbMode->setItemText (4, gpConverter->toString (KPortMode_TCP));
     mCbMode->setItemText (3, gpConverter->toString (KPortMode_RawFile));
     mCbMode->setItemText (2, gpConverter->toString (KPortMode_HostDevice));
     mCbMode->setItemText (1, gpConverter->toString (KPortMode_HostPipe));
@@ -199,7 +207,7 @@ void UIMachineSettingsSerial::mCbNumberActivated (const QString &aText)
 void UIMachineSettingsSerial::mCbModeActivated (const QString &aText)
 {
     KPortMode mode = gpConverter->fromString<KPortMode> (aText);
-    mCbPipe->setEnabled (mode == KPortMode_HostPipe);
+    mCbPipe->setEnabled (mode == KPortMode_HostPipe || mode == KPortMode_TCP);
     mLePath->setEnabled (mode != KPortMode_Disconnected);
 
     /* Revalidate: */
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
index 826cbf2..51c7ee9 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsSerial.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsSerial class declaration
+ * VBox Qt GUI - UIMachineSettingsSerial class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.ui
index c87b349..f86baac 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSerial.ui
@@ -2,7 +2,7 @@
  <comment>
  VBox frontends: Qt4 GUI ("VirtualBox"):
 
- Copyright (C) 2008-2012 Oracle Corporation
+ Copyright (C) 2008-2015 Oracle Corporation
 
  This file is part of VirtualBox Open Source Edition (OSE), as
  available from http://www.virtualbox.org. This file is free software;
@@ -173,20 +173,20 @@
         </property>
        </spacer>
       </item>
-      <item row="2" column="1" colspan="2" >
+      <item row="2" column="1" colspan="5" >
        <widget class="QCheckBox" name="mCbPipe" >
         <property name="whatsThis" >
-         <string>If checked, the pipe specified in the <b>Port Path</b> field will be created by the virtual machine when it starts. Otherwise, the virtual machine will assume that the pipe exists and try to use it.</string>
+         <string>If checked, the virtual machine will assume that the pipe or socket specified in the <b>Path/Address</b> field exists and try to use it. Otherwise, the pipe or socket will be created by the virtual machine when it starts.</string>
         </property>
         <property name="text" >
-         <string>&Create Pipe</string>
+         <string>&Connect to existing pipe/socket</string>
         </property>
        </widget>
       </item>
       <item row="3" column="0" >
        <widget class="QLabel" name="mLbPath" >
         <property name="text" >
-         <string>Port/File &Path:</string>
+         <string>&Path/Address:</string>
         </property>
         <property name="alignment" >
          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -199,7 +199,7 @@
       <item row="3" column="1" colspan="6" >
        <widget class="QLineEdit" name="mLePath" >
         <property name="whatsThis" >
-         <string>Holds the path to the serial port's pipe on the host when the port is working in <b>Host Pipe</b> mode, or the host serial device name when the port is working in <b>Host Device</b> mode.</string>
+         <string><p>In <b>Host Pipe</b> mode: Holds the path to the serial port's pipe on the host. Examples: "\\.\pipe\myvbox" or "/tmp/myvbox", for Windows and UNIX-like systems respectively.</p><p>In <b>Host Device</b> mode: Holds the host serial device name. Examples: "COM1" or "/dev/ttyS0".</p><p>In <b>Raw File</b> mode: Holds the file-path on the host system, where the serial output will be dumped.</p><p>In <b>TCP</b> mode: Holds the TCP [...]
         </property>
        </widget>
       </item>
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
index df783a1..2d82b7f 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsStorage.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsStorage class implementation
+ * VBox Qt GUI - UIMachineSettingsStorage class implementation.
  */
 
 /*
@@ -17,30 +15,39 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHeaderView>
-#include <QItemEditorFactory>
-#include <QMetaProperty>
-#include <QMouseEvent>
-#include <QScrollBar>
-#include <QStylePainter>
-#include <QTimer>
-#include <QCommonStyle>
+# include <QHeaderView>
+# include <QItemEditorFactory>
+# include <QMouseEvent>
+# include <QScrollBar>
+# include <QStylePainter>
+# include <QTimer>
 
 /* GUI includes: */
-#include "QIWidgetValidator.h"
-#include "UIIconPool.h"
-#include "UIWizardNewVD.h"
-#include "VBoxGlobal.h"
-#include "QIFileDialog.h"
-#include "UIMessageCenter.h"
-#include "UIMachineSettingsStorage.h"
-#include "UIConverter.h"
-#include "UIMedium.h"
+# include "QIWidgetValidator.h"
+# include "UIIconPool.h"
+# include "UIWizardNewVD.h"
+# include "VBoxGlobal.h"
+# include "QIFileDialog.h"
+# include "UIMessageCenter.h"
+# include "UIMachineSettingsStorage.h"
+# include "UIConverter.h"
+# include "UIMedium.h"
+# include "UIExtraDataManager.h"
 
 /* COM includes: */
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QCommonStyle>
+#include <QMetaProperty>
+
 
 QString compressText (const QString &aText)
 {
@@ -48,85 +55,201 @@ QString compressText (const QString &aText)
 }
 
 
-/* Pixmap Storage */
-QPointer <PixmapPool> PixmapPool::mThis = 0;
+/** UIIconPool interface extension used as Storage Settings page icon-pool. */
+class UIIconPoolStorageSettings : public UIIconPool
+{
+public:
+
+    /** Icon-pool instance access method. */
+    static UIIconPoolStorageSettings* instance();
+    /** Create icon-pool instance. */
+    static void create();
+    /** Destroy icon-pool instance. */
+    static void destroy();
+
+    /** Returns pixmap corresponding to passed @a pixmapType. */
+    QPixmap pixmap(PixmapType pixmapType) const;
+    /** Returns icon (probably merged) corresponding to passed @a pixmapType and @a pixmapDisabledType. */
+    QIcon icon(PixmapType pixmapType, PixmapType pixmapDisabledType = InvalidPixmap) const;
+
+private:
+
+    /** Icon-pool constructor. */
+    UIIconPoolStorageSettings();
+    /** Icon-pool destructor. */
+    ~UIIconPoolStorageSettings();
+
+    /** Icon-pool instance. */
+    static UIIconPoolStorageSettings *m_spInstance;
+    /** Icon-pool names cache. */
+    QMap<PixmapType, QString> m_names;
+    /** Icon-pool icons cache. */
+    mutable QMap<PixmapType, QIcon> m_icons;
+};
+UIIconPoolStorageSettings* iconPool() { return UIIconPoolStorageSettings::instance(); }
+
+/* static */
+UIIconPoolStorageSettings* UIIconPoolStorageSettings::m_spInstance = 0;
+UIIconPoolStorageSettings* UIIconPoolStorageSettings::instance() { return m_spInstance; }
+void UIIconPoolStorageSettings::create() { new UIIconPoolStorageSettings; }
+void UIIconPoolStorageSettings::destroy() { delete m_spInstance; }
 
-PixmapPool* PixmapPool::pool (QObject *aParent)
+QPixmap UIIconPoolStorageSettings::pixmap(PixmapType pixmapType) const
 {
-    if (!mThis)
+    /* Prepare fallback pixmap: */
+    static QPixmap nullPixmap;
+
+    /* If we do NOT have that 'pixmap type' icon cached already: */
+    if (!m_icons.contains(pixmapType))
     {
-        AssertMsg (aParent, ("This object must have parent!\n"));
-        mThis = new PixmapPool (aParent);
+        /* Compose proper icon if we have that 'pixmap type' known: */
+        if (m_names.contains(pixmapType))
+            m_icons[pixmapType] = iconSet(m_names[pixmapType]);
+        /* Assign fallback icon if we do NOT have that 'pixmap type' known: */
+        else
+            m_icons[pixmapType] = iconSet(nullPixmap);
     }
-    else
+
+    /* Retrieve corresponding icon: */
+    const QIcon &icon = m_icons[pixmapType];
+    AssertMsgReturn(!icon.isNull(),
+                    ("Undefined icon for type '%d'.", (int)pixmapType),
+                    nullPixmap);
+
+    /* Retrieve available sizes for that icon: */
+    const QList<QSize> availableSizes = icon.availableSizes();
+    AssertMsgReturn(!availableSizes.isEmpty(),
+                    ("Undefined icon for type '%s'.", (int)pixmapType),
+                    nullPixmap);
+
+    /* Return pixmap of first available size: */
+    return icon.pixmap(availableSizes.first());
+}
+
+QIcon UIIconPoolStorageSettings::icon(PixmapType pixmapType,
+                                      PixmapType pixmapDisabledType /* = InvalidPixmap */) const
+{
+    /* Prepare fallback pixmap: */
+    static QPixmap nullPixmap;
+    /* Prepare fallback icon: */
+    static QIcon nullIcon;
+
+    /* If we do NOT have that 'pixmap type' icon cached already: */
+    if (!m_icons.contains(pixmapType))
     {
-        AssertMsg (!aParent, ("Parent already set!\n"));
+        /* Compose proper icon if we have that 'pixmap type' known: */
+        if (m_names.contains(pixmapType))
+            m_icons[pixmapType] = iconSet(m_names[pixmapType]);
+        /* Assign fallback icon if we do NOT have that 'pixmap type' known: */
+        else
+            m_icons[pixmapType] = iconSet(nullPixmap);
     }
-    return mThis;
-}
-
-PixmapPool::PixmapPool (QObject *aParent)
-    : QObject (aParent)
-    , mPool(MaxIndex)
-{
-    mPool [ControllerAddEn]          = QPixmap (":/controller_add_16px.png");
-    mPool [ControllerAddDis]         = QPixmap (":/controller_add_disabled_16px.png");
-    mPool [ControllerDelEn]          = QPixmap (":/controller_remove_16px.png");
-    mPool [ControllerDelDis]         = QPixmap (":/controller_remove_disabled_16px.png");
-
-    mPool [AttachmentAddEn]          = QPixmap (":/attachment_add_16px.png");
-    mPool [AttachmentAddDis]         = QPixmap (":/attachment_add_disabled_16px.png");
-    mPool [AttachmentDelEn]          = QPixmap (":/attachment_remove_16px.png");
-    mPool [AttachmentDelDis]         = QPixmap (":/attachment_remove_disabled_16px.png");
-
-    mPool [IDEControllerNormal]      = QPixmap (":/ide_16px.png");
-    mPool [IDEControllerExpand]      = QPixmap (":/ide_expand_16px.png");
-    mPool [IDEControllerCollapse]    = QPixmap (":/ide_collapse_16px.png");
-    mPool [SATAControllerNormal]     = QPixmap (":/sata_16px.png");
-    mPool [SATAControllerExpand]     = QPixmap (":/sata_expand_16px.png");
-    mPool [SATAControllerCollapse]   = QPixmap (":/sata_collapse_16px.png");
-    mPool [SCSIControllerNormal]     = QPixmap (":/scsi_16px.png");
-    mPool [SCSIControllerExpand]     = QPixmap (":/scsi_expand_16px.png");
-    mPool [SCSIControllerCollapse]   = QPixmap (":/scsi_collapse_16px.png");
-    mPool [FloppyControllerNormal]   = QPixmap (":/floppy_16px.png");
-    mPool [FloppyControllerExpand]   = QPixmap (":/floppy_expand_16px.png");
-    mPool [FloppyControllerCollapse] = QPixmap (":/floppy_collapse_16px.png");
-
-    mPool [IDEControllerAddEn]       = QPixmap (":/ide_add_16px.png");
-    mPool [IDEControllerAddDis]      = QPixmap (":/ide_add_disabled_16px.png");
-    mPool [SATAControllerAddEn]      = QPixmap (":/sata_add_16px.png");
-    mPool [SATAControllerAddDis]     = QPixmap (":/sata_add_disabled_16px.png");
-    mPool [SCSIControllerAddEn]      = QPixmap (":/scsi_add_16px.png");
-    mPool [SCSIControllerAddDis]     = QPixmap (":/scsi_add_disabled_16px.png");
-    mPool [FloppyControllerAddEn]    = QPixmap (":/floppy_add_16px.png");
-    mPool [FloppyControllerAddDis]   = QPixmap (":/floppy_add_disabled_16px.png");
-
-    mPool [HDAttachmentNormal]       = QPixmap (":/hd_16px.png");
-    mPool [CDAttachmentNormal]       = QPixmap (":/cd_16px.png");
-    mPool [FDAttachmentNormal]       = QPixmap (":/fd_16px.png");
-
-    mPool [HDAttachmentAddEn]        = QPixmap (":/hd_add_16px.png");
-    mPool [HDAttachmentAddDis]       = QPixmap (":/hd_add_disabled_16px.png");
-    mPool [CDAttachmentAddEn]        = QPixmap (":/cd_add_16px.png");
-    mPool [CDAttachmentAddDis]       = QPixmap (":/cd_add_disabled_16px.png");
-    mPool [FDAttachmentAddEn]        = QPixmap (":/fd_add_16px.png");
-    mPool [FDAttachmentAddDis]       = QPixmap (":/fd_add_disabled_16px.png");
-
-    mPool [ChooseExistingEn]         = QPixmap (":/select_file_16px.png");
-    mPool [ChooseExistingDis]        = QPixmap (":/select_file_disabled_16px.png");
-    mPool [HDNewEn]                  = QPixmap (":/hd_new_16px.png");
-    mPool [HDNewDis]                 = QPixmap (":/hd_new_disabled_16px.png");
-    mPool [CDUnmountEnabled]         = QPixmap (":/cd_unmount_16px.png");
-    mPool [CDUnmountDisabled]        = QPixmap (":/cd_unmount_dis_16px.png");
-    mPool [FDUnmountEnabled]         = QPixmap (":/fd_unmount_16px.png");
-    mPool [FDUnmountDisabled]        = QPixmap (":/fd_unmount_dis_16px.png");
-}
-
-QPixmap PixmapPool::pixmap (PixmapType aType) const
-{
-    return aType > InvalidPixmap && aType < MaxIndex ? mPool [aType] : 0;
+
+    /* Retrieve normal icon: */
+    const QIcon &icon = m_icons[pixmapType];
+    AssertMsgReturn(!icon.isNull(),
+                    ("Undefined icon for type '%d'.", (int)pixmapType),
+                    nullIcon);
+
+    /* If 'disabled' icon is invalid => just return 'normal' icon: */
+    if (pixmapDisabledType == InvalidPixmap)
+        return icon;
+
+    /* If we do NOT have that 'pixmap disabled type' icon cached already: */
+    if (!m_icons.contains(pixmapDisabledType))
+    {
+        /* Compose proper icon if we have that 'pixmap disabled type' known: */
+        if (m_names.contains(pixmapDisabledType))
+            m_icons[pixmapDisabledType] = iconSet(m_names[pixmapDisabledType]);
+        /* Assign fallback icon if we do NOT have that 'pixmap disabled type' known: */
+        else
+            m_icons[pixmapDisabledType] = iconSet(nullPixmap);
+    }
+
+    /* Retrieve disabled icon: */
+    const QIcon &iconDisabled = m_icons[pixmapDisabledType];
+    AssertMsgReturn(!iconDisabled.isNull(),
+                    ("Undefined icon for type '%d'.", (int)pixmapDisabledType),
+                    nullIcon);
+
+    /* Return icon composed on the basis of two above: */
+    QIcon resultIcon = icon;
+    foreach (const QSize &size, iconDisabled.availableSizes())
+        resultIcon.addPixmap(iconDisabled.pixmap(size), QIcon::Disabled);
+    return resultIcon;
+}
+
+UIIconPoolStorageSettings::UIIconPoolStorageSettings()
+{
+    /* Connect instance: */
+    m_spInstance = this;
+
+    /* Controller file-names: */
+    m_names.insert(ControllerAddEn,          ":/controller_add_16px.png");
+    m_names.insert(ControllerAddDis,         ":/controller_add_disabled_16px.png");
+    m_names.insert(ControllerDelEn,          ":/controller_remove_16px.png");
+    m_names.insert(ControllerDelDis,         ":/controller_remove_disabled_16px.png");
+    /* Attachment file-names: */
+    m_names.insert(AttachmentAddEn,          ":/attachment_add_16px.png");
+    m_names.insert(AttachmentAddDis,         ":/attachment_add_disabled_16px.png");
+    m_names.insert(AttachmentDelEn,          ":/attachment_remove_16px.png");
+    m_names.insert(AttachmentDelDis,         ":/attachment_remove_disabled_16px.png");
+    /* Specific controller default/expand/collapse file-names: */
+    m_names.insert(IDEControllerNormal,      ":/ide_16px.png");
+    m_names.insert(IDEControllerExpand,      ":/ide_expand_16px.png");
+    m_names.insert(IDEControllerCollapse,    ":/ide_collapse_16px.png");
+    m_names.insert(SATAControllerNormal,     ":/sata_16px.png");
+    m_names.insert(SATAControllerExpand,     ":/sata_expand_16px.png");
+    m_names.insert(SATAControllerCollapse,   ":/sata_collapse_16px.png");
+    m_names.insert(SCSIControllerNormal,     ":/scsi_16px.png");
+    m_names.insert(SCSIControllerExpand,     ":/scsi_expand_16px.png");
+    m_names.insert(SCSIControllerCollapse,   ":/scsi_collapse_16px.png");
+    m_names.insert(USBControllerNormal,      ":/usb_16px.png");
+    m_names.insert(USBControllerExpand,      ":/usb_expand_16px.png");
+    m_names.insert(USBControllerCollapse,    ":/usb_collapse_16px.png");
+    m_names.insert(FloppyControllerNormal,   ":/floppy_16px.png");
+    m_names.insert(FloppyControllerExpand,   ":/floppy_expand_16px.png");
+    m_names.insert(FloppyControllerCollapse, ":/floppy_collapse_16px.png");
+    /* Specific controller add file-names: */
+    m_names.insert(IDEControllerAddEn,       ":/ide_add_16px.png");
+    m_names.insert(IDEControllerAddDis,      ":/ide_add_disabled_16px.png");
+    m_names.insert(SATAControllerAddEn,      ":/sata_add_16px.png");
+    m_names.insert(SATAControllerAddDis,     ":/sata_add_disabled_16px.png");
+    m_names.insert(SCSIControllerAddEn,      ":/scsi_add_16px.png");
+    m_names.insert(SCSIControllerAddDis,     ":/scsi_add_disabled_16px.png");
+    m_names.insert(USBControllerAddEn,       ":/usb_add_16px.png");
+    m_names.insert(USBControllerAddDis,      ":/usb_add_disabled_16px.png");
+    m_names.insert(FloppyControllerAddEn,    ":/floppy_add_16px.png");
+    m_names.insert(FloppyControllerAddDis,   ":/floppy_add_disabled_16px.png");
+    /* Specific attachment file-names: */
+    m_names.insert(HDAttachmentNormal,       ":/hd_16px.png");
+    m_names.insert(CDAttachmentNormal,       ":/cd_16px.png");
+    m_names.insert(FDAttachmentNormal,       ":/fd_16px.png");
+    /* Specific attachment add file-names: */
+    m_names.insert(HDAttachmentAddEn,        ":/hd_add_16px.png");
+    m_names.insert(HDAttachmentAddDis,       ":/hd_add_disabled_16px.png");
+    m_names.insert(CDAttachmentAddEn,        ":/cd_add_16px.png");
+    m_names.insert(CDAttachmentAddDis,       ":/cd_add_disabled_16px.png");
+    m_names.insert(FDAttachmentAddEn,        ":/fd_add_16px.png");
+    m_names.insert(FDAttachmentAddDis,       ":/fd_add_disabled_16px.png");
+    /* Specific attachment custom file-names: */
+    m_names.insert(ChooseExistingEn,         ":/select_file_16px.png");
+    m_names.insert(ChooseExistingDis,        ":/select_file_disabled_16px.png");
+    m_names.insert(HDNewEn,                  ":/hd_new_16px.png");
+    m_names.insert(HDNewDis,                 ":/hd_new_disabled_16px.png");
+    m_names.insert(CDUnmountEnabled,         ":/cd_unmount_16px.png");
+    m_names.insert(CDUnmountDisabled,        ":/cd_unmount_disabled_16px.png");
+    m_names.insert(FDUnmountEnabled,         ":/fd_unmount_16px.png");
+    m_names.insert(FDUnmountDisabled,        ":/fd_unmount_disabled_16px.png");
+}
+
+UIIconPoolStorageSettings::~UIIconPoolStorageSettings()
+{
+    /* Disconnect instance: */
+    m_spInstance = 0;
 }
 
+
 /* Abstract Controller Type */
 AbstractControllerType::AbstractControllerType (KStorageBus aBusType, KStorageControllerType aCtrType)
     : mBusType (aBusType)
@@ -137,28 +260,31 @@ AbstractControllerType::AbstractControllerType (KStorageBus aBusType, KStorageCo
 
     for (int i = 0; i < State_MAX; ++ i)
     {
-        mPixmaps << PixmapPool::InvalidPixmap;
+        mPixmaps << InvalidPixmap;
         switch (mBusType)
         {
             case KStorageBus_IDE:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::IDEControllerNormal + i);
+                mPixmaps [i] = (PixmapType)(IDEControllerNormal + i);
                 break;
             case KStorageBus_SATA:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SATAControllerNormal + i);
+                mPixmaps [i] = (PixmapType)(SATAControllerNormal + i);
                 break;
             case KStorageBus_SCSI:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SCSIControllerNormal + i);
+                mPixmaps [i] = (PixmapType)(SCSIControllerNormal + i);
                 break;
             case KStorageBus_Floppy:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::FloppyControllerNormal + i);
+                mPixmaps [i] = (PixmapType)(FloppyControllerNormal + i);
                 break;
             case KStorageBus_SAS:
-                mPixmaps [i] = (PixmapPool::PixmapType) (PixmapPool::SATAControllerNormal + i);
+                mPixmaps [i] = (PixmapType)(SATAControllerNormal + i);
+                break;
+            case KStorageBus_USB:
+                mPixmaps [i] = (PixmapType)(USBControllerNormal + i);
                 break;
             default:
                 break;
         }
-        AssertMsg (mPixmaps [i] != PixmapPool::InvalidPixmap, ("Item state pixmap was not set!\n"));
+        AssertMsg (mPixmaps [i] != InvalidPixmap, ("Item state pixmap was not set!\n"));
     }
 }
 
@@ -180,7 +306,7 @@ ControllerTypeList AbstractControllerType::ctrTypes() const
     return result;
 }
 
-PixmapPool::PixmapType AbstractControllerType::pixmap (ItemState aState) const
+PixmapType AbstractControllerType::pixmap(ItemState aState) const
 {
     return mPixmaps [aState];
 }
@@ -275,6 +401,23 @@ uint SASControllerType::size() const
     return 1;
 }
 
+/* USB Controller Type */
+USBStorageControllerType::USBStorageControllerType (KStorageControllerType aSubType)
+    : AbstractControllerType (KStorageBus_USB, aSubType)
+{
+}
+
+KStorageControllerType USBStorageControllerType::first() const
+{
+    return KStorageControllerType_USB;
+}
+
+uint USBStorageControllerType::size() const
+{
+    return 1;
+}
+
+
 /* Abstract Item */
 AbstractItem::AbstractItem (AbstractItem *aParent)
     : mParent (aParent)
@@ -415,6 +558,10 @@ ControllerItem::ControllerItem (AbstractItem *aParent, const QString &aName,
         case KStorageBus_SAS:
             mCtrType = new SASControllerType (aControllerType);
             break;
+        case KStorageBus_USB:
+            mCtrType = new USBStorageControllerType (aControllerType);
+            break;
+
         default:
             AssertMsgFailed (("Wrong Controller Type {%d}!\n", aBusType));
             break;
@@ -462,6 +609,11 @@ uint ControllerItem::portCount()
     return mPortCount;
 }
 
+uint ControllerItem::maxPortCount()
+{
+    return (uint)vboxGlobal().virtualBox().GetSystemProperties().GetMaxPortCountForStorageBus(ctrBusType());
+}
+
 bool ControllerItem::ctrUseIoCache() const
 {
     return mUseIoCache;
@@ -556,7 +708,7 @@ QString ControllerItem::tip() const
 
 QPixmap ControllerItem::pixmap (ItemState aState)
 {
-    return PixmapPool::pool()->pixmap (mCtrType->pixmap (aState));
+    return iconPool()->pixmap(mCtrType->pixmap(aState));
 }
 
 void ControllerItem::addChild (AbstractItem *aItem)
@@ -577,6 +729,7 @@ AttachmentItem::AttachmentItem (AbstractItem *aParent, KDeviceType aDeviceType)
     , mAttIsPassthrough (false)
     , mAttIsTempEject (false)
     , mAttIsNonRotational (false)
+    , m_fIsHotPluggable(false)
 {
     /* Check for proper parent type */
     AssertMsg (mParent->rtti() == AbstractItem::Type_ControllerItem, ("Incorrect parent type!\n"));
@@ -640,6 +793,11 @@ bool AttachmentItem::attIsNonRotational() const
     return mAttIsNonRotational;
 }
 
+bool AttachmentItem::attIsHotPluggable() const
+{
+    return m_fIsHotPluggable;
+}
+
 void AttachmentItem::setAttSlot (const StorageSlot &aAttSlot)
 {
     mAttSlot = aAttSlot;
@@ -672,6 +830,11 @@ void AttachmentItem::setAttIsNonRotational (bool aIsAttNonRotational)
     mAttIsNonRotational = aIsAttNonRotational;
 }
 
+void AttachmentItem::setAttIsHotPluggable(bool fIsHotPluggable)
+{
+    m_fIsHotPluggable = fIsHotPluggable;
+}
+
 QString AttachmentItem::attSize() const
 {
     return mAttSize;
@@ -702,6 +865,11 @@ QString AttachmentItem::attUsage() const
     return mAttUsage;
 }
 
+QString AttachmentItem::attEncryptionPasswordID() const
+{
+    return m_strAttEncryptionPasswordID;
+}
+
 void AttachmentItem::cache()
 {
     UIMedium medium = vboxGlobal().medium(mAttMediumId);
@@ -716,6 +884,7 @@ void AttachmentItem::cache()
     mAttSize = medium.size (true);
     mAttLogicalSize = medium.logicalSize (true);
     mAttLocation = medium.location (true);
+    m_strAttEncryptionPasswordID = QString("--");
     if (medium.isNull())
     {
         mAttFormat = QString("--");
@@ -728,6 +897,9 @@ void AttachmentItem::cache()
             {
                 mAttFormat = QString("%1 (%2)").arg(medium.hardDiskType(true)).arg(medium.hardDiskFormat(true));
                 mAttDetails = medium.storageDetails();
+                const QString strAttEncryptionPasswordID = medium.encryptionPasswordID();
+                if (!strAttEncryptionPasswordID.isNull())
+                    m_strAttEncryptionPasswordID = strAttEncryptionPasswordID;
                 break;
             }
             case KDeviceType_DVD:
@@ -789,13 +961,13 @@ QPixmap AttachmentItem::pixmap (ItemState /* aState */)
         switch (mAttDeviceType)
         {
             case KDeviceType_HardDisk:
-                mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentNormal);
+                mAttPixmap = iconPool()->pixmap(HDAttachmentNormal);
                 break;
             case KDeviceType_DVD:
-                mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentNormal);
+                mAttPixmap = iconPool()->pixmap(CDAttachmentNormal);
                 break;
             case KDeviceType_Floppy:
-                mAttPixmap = PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentNormal);
+                mAttPixmap = iconPool()->pixmap(FDAttachmentNormal);
                 break;
             default:
                 break;
@@ -818,7 +990,7 @@ StorageModel::StorageModel (QObject *aParent)
     , mRootItem (new RootItem)
     , mToolTipType (DefaultToolTip)
     , m_chipsetType(KChipsetType_PIIX3)
-    , m_dialogType(SettingsDialogType_Wrong)
+    , m_configurationAccessLevel(ConfigurationAccessLevel_Null)
 {
 }
 
@@ -906,10 +1078,10 @@ QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
                             tip = UIMachineSettingsStorage::tr ("<nobr>Add Hard Disk</nobr>");
                             break;
                         case CDAdderToolTip:
-                            tip = UIMachineSettingsStorage::tr ("<nobr>Add CD/DVD Device</nobr>");
+                            tip = UIMachineSettingsStorage::tr ("<nobr>Add Optical Drive</nobr>");
                             break;
                         case FDAdderToolTip:
-                            tip = UIMachineSettingsStorage::tr ("<nobr>Add Floppy Device</nobr>");
+                            tip = UIMachineSettingsStorage::tr ("<nobr>Add Floppy Drive</nobr>");
                             break;
                         default:
                             break;
@@ -988,34 +1160,40 @@ QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
         }
         case R_IsMoreIDEControllersPossible:
         {
-            return (m_dialogType == SettingsDialogType_Offline) &&
+            return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_IDE) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_IDE));
         }
         case R_IsMoreSATAControllersPossible:
         {
-            return (m_dialogType == SettingsDialogType_Offline) &&
+            return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SATA) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SATA));
         }
         case R_IsMoreSCSIControllersPossible:
         {
-            return (m_dialogType == SettingsDialogType_Offline) &&
+            return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SCSI) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SCSI));
         }
         case R_IsMoreFloppyControllersPossible:
         {
-            return (m_dialogType == SettingsDialogType_Offline) &&
+            return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_Floppy) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_Floppy));
         }
         case R_IsMoreSASControllersPossible:
         {
-            return (m_dialogType == SettingsDialogType_Offline) &&
+            return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
                    (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_SAS) <
                     vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_SAS));
         }
+        case R_IsMoreUSBControllersPossible:
+        {
+            return (m_configurationAccessLevel == ConfigurationAccessLevel_Full) &&
+                   (static_cast<RootItem*>(mRootItem)->childCount(KStorageBus_USB) <
+                    vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), KStorageBus_USB));
+        }
         case R_IsMoreAttachmentsPossible:
         {
             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
@@ -1024,9 +1202,31 @@ QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
                 {
                     ControllerItem *ctr = static_cast <ControllerItem*> (item);
                     CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties();
-                    return (m_dialogType == SettingsDialogType_Offline) &&
-                           ((uint)rowCount(aIndex) < sp.GetMaxPortCountForStorageBus(ctr->ctrBusType()) *
-                                                     sp.GetMaxDevicesPerPortForStorageBus(ctr->ctrBusType()));
+                    const bool fIsMoreAttachmentsPossible = (ULONG)rowCount(aIndex) <
+                                                            (sp.GetMaxPortCountForStorageBus(ctr->ctrBusType()) *
+                                                             sp.GetMaxDevicesPerPortForStorageBus(ctr->ctrBusType()));
+                    if (fIsMoreAttachmentsPossible)
+                    {
+                        switch (m_configurationAccessLevel)
+                        {
+                            case ConfigurationAccessLevel_Full:
+                                return true;
+                            case ConfigurationAccessLevel_Runtime:
+                            {
+                                switch (ctr->ctrBusType())
+                                {
+                                    case KStorageBus_USB:
+                                        return true;
+                                    case KStorageBus_SATA:
+                                        return (uint)rowCount(aIndex) < ctr->portCount();
+                                    default:
+                                        break;
+                                }
+                            }
+                            default:
+                                break;
+                        }
+                    }
                 }
             }
             return false;
@@ -1078,6 +1278,13 @@ QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
                     return static_cast <ControllerItem*> (item)->portCount();
             return 0;
         }
+        case R_CtrMaxPortCount:
+        {
+            if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
+                if (item->rtti() == AbstractItem::Type_ControllerItem)
+                    return static_cast <ControllerItem*> (item)->maxPortCount();
+            return 0;
+        }
         case R_CtrIoCache:
         {
             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
@@ -1145,6 +1352,13 @@ QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
                     return static_cast <AttachmentItem*> (item)->attIsNonRotational();
             return false;
         }
+        case R_AttIsHotPluggable:
+        {
+            if (AbstractItem *item = static_cast<AbstractItem*>(aIndex.internalPointer()))
+                if (item->rtti() == AbstractItem::Type_AttachmentItem)
+                    return static_cast<AttachmentItem*>(item)->attIsHotPluggable();
+            return false;
+        }
         case R_AttSize:
         {
             if (AbstractItem *item = static_cast <AbstractItem*> (aIndex.internalPointer()))
@@ -1187,6 +1401,13 @@ QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
                     return static_cast <AttachmentItem*> (item)->attUsage();
             return QString();
         }
+        case R_AttEncryptionPasswordID:
+        {
+            if (AbstractItem *pItem = static_cast<AbstractItem*>(aIndex.internalPointer()))
+                if (pItem->rtti() == AbstractItem::Type_AttachmentItem)
+                    return static_cast<AttachmentItem*>(pItem)->attEncryptionPasswordID();
+            return QString();
+        }
         case R_Margin:
         {
             return 4;
@@ -1202,40 +1423,40 @@ QVariant StorageModel::data (const QModelIndex &aIndex, int aRole) const
 
         case R_HDPixmapEn:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentNormal);
+            return iconPool()->pixmap(HDAttachmentNormal);
         }
         case R_CDPixmapEn:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentNormal);
+            return iconPool()->pixmap(CDAttachmentNormal);
         }
         case R_FDPixmapEn:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentNormal);
+            return iconPool()->pixmap(FDAttachmentNormal);
         }
 
         case R_HDPixmapAddEn:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddEn);
+            return iconPool()->pixmap(HDAttachmentAddEn);
         }
         case R_HDPixmapAddDis:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddDis);
+            return iconPool()->pixmap(HDAttachmentAddDis);
         }
         case R_CDPixmapAddEn:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddEn);
+            return iconPool()->pixmap(CDAttachmentAddEn);
         }
         case R_CDPixmapAddDis:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddDis);
+            return iconPool()->pixmap(CDAttachmentAddDis);
         }
         case R_FDPixmapAddEn:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddEn);
+            return iconPool()->pixmap(FDAttachmentAddEn);
         }
         case R_FDPixmapAddDis:
         {
-            return PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddDis);
+            return iconPool()->pixmap(FDAttachmentAddDis);
         }
         case R_HDPixmapRect:
         {
@@ -1387,6 +1608,17 @@ bool StorageModel::setData (const QModelIndex &aIndex, const QVariant &aValue, i
                 }
             return false;
         }
+        case R_AttIsHotPluggable:
+        {
+            if (AbstractItem *item = static_cast<AbstractItem*>(aIndex.internalPointer()))
+                if (item->rtti() == AbstractItem::Type_AttachmentItem)
+                {
+                    static_cast<AttachmentItem*>(item)->setAttIsHotPluggable(aValue.toBool());
+                    emit dataChanged(aIndex, aIndex);
+                    return true;
+                }
+            return false;
+        }
         default:
             break;
     }
@@ -1421,6 +1653,7 @@ QModelIndex StorageModel::addAttachment (const QUuid &aCtrId, KDeviceType aDevic
         QModelIndex parentIndex = index (parentPosition, 0, root());
         beginInsertRows (parentIndex, parent->childCount(), parent->childCount());
         AttachmentItem *pItem = new AttachmentItem (parent, aDeviceType);
+        pItem->setAttIsHotPluggable(m_configurationAccessLevel != ConfigurationAccessLevel_Full);
         pItem->setAttMediumId(strMediumId);
         endInsertRows();
         return index (parent->childCount() - 1, 0, parentIndex);
@@ -1533,9 +1766,9 @@ void StorageModel::setChipsetType(KChipsetType type)
     m_chipsetType = type;
 }
 
-void StorageModel::setDialogType(SettingsDialogType dialogType)
+void StorageModel::setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel)
 {
-    m_dialogType = dialogType;
+    m_configurationAccessLevel = newConfigurationAccessLevel;
 }
 
 void StorageModel::clear()
@@ -1551,7 +1784,7 @@ void StorageModel::clear()
 QMap<KStorageBus, int> StorageModel::currentControllerTypes() const
 {
     QMap<KStorageBus, int> currentMap;
-    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType)
+    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_USB; ++iStorageBusType)
     {
         currentMap.insert((KStorageBus)iStorageBusType,
                           static_cast<RootItem*>(mRootItem)->childCount((KStorageBus)iStorageBusType));
@@ -1562,7 +1795,7 @@ QMap<KStorageBus, int> StorageModel::currentControllerTypes() const
 QMap<KStorageBus, int> StorageModel::maximumControllerTypes() const
 {
     QMap<KStorageBus, int> maximumMap;
-    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType)
+    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_USB; ++iStorageBusType)
     {
         maximumMap.insert((KStorageBus)iStorageBusType,
                           vboxGlobal().virtualBox().GetSystemProperties().GetMaxInstancesOfStorageBus(chipsetType(), (KStorageBus)iStorageBusType));
@@ -1721,7 +1954,7 @@ private:
 UIMachineSettingsStorage::UIMachineSettingsStorage()
     : mStorageModel(0)
     , mAddCtrAction(0), mDelCtrAction(0)
-    , mAddIDECtrAction(0), mAddSATACtrAction(0), mAddSCSICtrAction(0), mAddSASCtrAction(0), mAddFloppyCtrAction(0)
+    , mAddIDECtrAction(0), mAddSATACtrAction(0), mAddSCSICtrAction(0), mAddSASCtrAction(0), mAddFloppyCtrAction(0), mAddUSBCtrAction(0)
     , mAddAttAction(0), mDelAttAction(0)
     , mAddHDAttAction(0), mAddCDAttAction(0), mAddFDAttAction(0)
     , m_pMediumIdHolder(new UIMediumIDHolder(this))
@@ -1737,58 +1970,49 @@ UIMachineSettingsStorage::UIMachineSettingsStorage()
      * in a background thread. */
     vboxGlobal().startMediumEnumeration();
 
-    /* Initialize pixmap pool */
-    PixmapPool::pool (this);
+    /* Create icon-pool: */
+    UIIconPoolStorageSettings::create();
 
     /* Controller Actions */
     mAddCtrAction = new QAction (this);
-    mAddCtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::ControllerAddEn),
-                                               PixmapPool::pool()->pixmap (PixmapPool::ControllerAddDis)));
+    mAddCtrAction->setIcon(iconPool()->icon(ControllerAddEn, ControllerAddDis));
 
     mAddIDECtrAction = new QAction (this);
-    mAddIDECtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::IDEControllerAddEn),
-                                                  PixmapPool::pool()->pixmap (PixmapPool::IDEControllerAddDis)));
+    mAddIDECtrAction->setIcon(iconPool()->icon(IDEControllerAddEn, IDEControllerAddDis));
 
     mAddSATACtrAction = new QAction (this);
-    mAddSATACtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddEn),
-                                                   PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddDis)));
+    mAddSATACtrAction->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
 
     mAddSCSICtrAction = new QAction (this);
-    mAddSCSICtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::SCSIControllerAddEn),
-                                                   PixmapPool::pool()->pixmap (PixmapPool::SCSIControllerAddDis)));
+    mAddSCSICtrAction->setIcon(iconPool()->icon(SCSIControllerAddEn, SCSIControllerAddDis));
 
     mAddFloppyCtrAction = new QAction (this);
-    mAddFloppyCtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::FloppyControllerAddEn),
-                                                     PixmapPool::pool()->pixmap (PixmapPool::FloppyControllerAddDis)));
+    mAddFloppyCtrAction->setIcon(iconPool()->icon(FloppyControllerAddEn, FloppyControllerAddDis));
 
     mAddSASCtrAction = new QAction (this);
-    mAddSASCtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddEn),
-                                                  PixmapPool::pool()->pixmap (PixmapPool::SATAControllerAddDis)));
+    mAddSASCtrAction->setIcon(iconPool()->icon(SATAControllerAddEn, SATAControllerAddDis));
+
+    mAddUSBCtrAction = new QAction (this);
+    mAddUSBCtrAction->setIcon(iconPool()->icon(USBControllerAddEn, USBControllerAddDis));
 
     mDelCtrAction = new QAction (this);
-    mDelCtrAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::ControllerDelEn),
-                                               PixmapPool::pool()->pixmap (PixmapPool::ControllerDelDis)));
+    mDelCtrAction->setIcon(iconPool()->icon(ControllerDelEn, ControllerDelDis));
 
     /* Attachment Actions */
     mAddAttAction = new QAction (this);
-    mAddAttAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::AttachmentAddEn),
-                                               PixmapPool::pool()->pixmap (PixmapPool::AttachmentAddDis)));
+    mAddAttAction->setIcon(iconPool()->icon(AttachmentAddEn, AttachmentAddDis));
 
     mAddHDAttAction = new QAction (this);
-    mAddHDAttAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddEn),
-                                                 PixmapPool::pool()->pixmap (PixmapPool::HDAttachmentAddDis)));
+    mAddHDAttAction->setIcon(iconPool()->icon(HDAttachmentAddEn, HDAttachmentAddDis));
 
     mAddCDAttAction = new QAction (this);
-    mAddCDAttAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddEn),
-                                                 PixmapPool::pool()->pixmap (PixmapPool::CDAttachmentAddDis)));
+    mAddCDAttAction->setIcon(iconPool()->icon(CDAttachmentAddEn, CDAttachmentAddDis));
 
     mAddFDAttAction = new QAction (this);
-    mAddFDAttAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddEn),
-                                                 PixmapPool::pool()->pixmap (PixmapPool::FDAttachmentAddDis)));
+    mAddFDAttAction->setIcon(iconPool()->icon(FDAttachmentAddEn, FDAttachmentAddDis));
 
     mDelAttAction = new QAction (this);
-    mDelAttAction->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap (PixmapPool::AttachmentDelEn),
-                                               PixmapPool::pool()->pixmap (PixmapPool::AttachmentDelDis)));
+    mDelAttAction->setIcon(iconPool()->icon(AttachmentDelEn, AttachmentDelDis));
 
     /* Storage Model/View */
     mStorageModel = new StorageModel (mTwStorageTree);
@@ -1829,6 +2053,7 @@ UIMachineSettingsStorage::UIMachineSettingsStorage()
     mLbHDDetailsValue->setFullSizeSelection (true);
     mLbLocationValue->setFullSizeSelection (true);
     mLbUsageValue->setFullSizeSelection (true);
+    m_pLabelEncryptionValue->setFullSizeSelection(true);
 
     /* Setup connections: */
     connect(&vboxGlobal(), SIGNAL(sigMediumEnumerated(const QString&)),
@@ -1841,6 +2066,7 @@ UIMachineSettingsStorage::UIMachineSettingsStorage()
     connect (mAddSCSICtrAction, SIGNAL (triggered (bool)), this, SLOT (addSCSIController()));
     connect (mAddSASCtrAction, SIGNAL (triggered (bool)), this, SLOT (addSASController()));
     connect (mAddFloppyCtrAction, SIGNAL (triggered (bool)), this, SLOT (addFloppyController()));
+    connect (mAddUSBCtrAction, SIGNAL (triggered (bool)), this, SLOT (addUSBController()));
     connect (mDelCtrAction, SIGNAL (triggered (bool)), this, SLOT (delController()));
     connect (mAddAttAction, SIGNAL (triggered (bool)), this, SLOT (addAttachment()));
     connect (mAddHDAttAction, SIGNAL (triggered (bool)), this, SLOT (addHDAttachment()));
@@ -1874,6 +2100,7 @@ UIMachineSettingsStorage::UIMachineSettingsStorage()
     connect (mCbPassthrough, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
     connect (mCbTempEject, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
     connect (mCbNonRotational, SIGNAL (stateChanged (int)), this, SLOT (setInformation()));
+    connect(m_pCheckBoxHotPluggable, SIGNAL(stateChanged(int)), this, SLOT(setInformation()));
 
     /* Applying language settings */
     retranslateUi();
@@ -1883,6 +2110,12 @@ UIMachineSettingsStorage::UIMachineSettingsStorage()
     mSplitter->setSizes (QList<int>() << (int) (0.45 * minimumWidth()) << (int) (0.55 * minimumWidth()));
 }
 
+UIMachineSettingsStorage::~UIMachineSettingsStorage()
+{
+    /* Destroy icon-pool: */
+    UIIconPoolStorageSettings::destroy();
+}
+
 void UIMachineSettingsStorage::setChipsetType(KChipsetType type)
 {
     /* Make sure chipset type has changed: */
@@ -1959,6 +2192,7 @@ void UIMachineSettingsStorage::loadToCacheFrom(QVariant &data)
                     storageAttachmentData.m_fAttachmentPassthrough = attachment.GetPassthrough();
                     storageAttachmentData.m_fAttachmentTempEject = attachment.GetTemporaryEject();
                     storageAttachmentData.m_fAttachmentNonRotational = attachment.GetNonRotational();
+                    storageAttachmentData.m_fAttachmentHotPluggable = attachment.GetHotPluggable();
                     const CMedium cmedium = attachment.GetMedium();
                     storageAttachmentData.m_strAttachmentMediumId = cmedium.isNull() ? UIMedium::nullID() : cmedium.GetId();
                 }
@@ -2019,6 +2253,7 @@ void UIMachineSettingsStorage::getFromCache()
             mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentPassthrough, StorageModel::R_AttIsPassthrough);
             mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentTempEject, StorageModel::R_AttIsTempEject);
             mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentNonRotational, StorageModel::R_AttIsNonRotational);
+            mStorageModel->setData(attachmentIndex, attachmentData.m_fAttachmentHotPluggable, StorageModel::R_AttIsHotPluggable);
         }
     }
     /* Set the first controller as current if present */
@@ -2072,6 +2307,7 @@ void UIMachineSettingsStorage::putToCache()
             attachmentData.m_fAttachmentPassthrough = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsPassthrough).toBool();
             attachmentData.m_fAttachmentTempEject = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsTempEject).toBool();
             attachmentData.m_fAttachmentNonRotational = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsNonRotational).toBool();
+            attachmentData.m_fAttachmentHotPluggable = mStorageModel->data(attachmentIndex, StorageModel::R_AttIsHotPluggable).toBool();
             attachmentData.m_strAttachmentMediumId = mStorageModel->data(attachmentIndex, StorageModel::R_AttMediumId).toString();
 
             /* Recache storage attachment data: */
@@ -2165,7 +2401,7 @@ bool UIMachineSettingsStorage::validate(QList<UIValidationMessage> &messages)
     QStringList excessiveList;
     QMap<KStorageBus, int> currentType = mStorageModel->currentControllerTypes();
     QMap<KStorageBus, int> maximumType = mStorageModel->maximumControllerTypes();
-    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_SAS; ++iStorageBusType)
+    for (int iStorageBusType = KStorageBus_IDE; iStorageBusType <= KStorageBus_USB; ++iStorageBusType)
     {
         if (currentType[(KStorageBus)iStorageBusType] > maximumType[(KStorageBus)iStorageBusType])
         {
@@ -2211,11 +2447,12 @@ void UIMachineSettingsStorage::retranslateUi()
     mAddSCSICtrAction->setText (tr ("Add SCSI Controller"));
     mAddSASCtrAction->setText (tr ("Add SAS Controller"));
     mAddFloppyCtrAction->setText (tr ("Add Floppy Controller"));
+    mAddUSBCtrAction->setText (tr ("Add USB Controller"));
     mDelCtrAction->setText (tr ("Remove Controller"));
     mAddAttAction->setText (tr ("Add Attachment"));
     mAddHDAttAction->setText (tr ("Add Hard Disk"));
-    mAddCDAttAction->setText (tr ("Add CD/DVD Device"));
-    mAddFDAttAction->setText (tr ("Add Floppy Device"));
+    mAddCDAttAction->setText (tr ("Add Optical Drive"));
+    mAddFDAttAction->setText (tr ("Add Floppy Drive"));
     mDelAttAction->setText (tr ("Remove Attachment"));
 
     mAddCtrAction->setWhatsThis (tr ("Adds a new controller to the end of the Storage Tree."));
@@ -2320,6 +2557,7 @@ void UIMachineSettingsStorage::addController()
     menu.addAction (mAddSCSICtrAction);
     menu.addAction (mAddSASCtrAction);
     menu.addAction (mAddFloppyCtrAction);
+    menu.addAction (mAddUSBCtrAction);
     menu.exec (QCursor::pos());
 }
 
@@ -2348,6 +2586,11 @@ void UIMachineSettingsStorage::addSASController()
     addControllerWrapper (generateUniqueName ("SAS"), KStorageBus_SAS, KStorageControllerType_LsiLogicSas);
 }
 
+void UIMachineSettingsStorage::addUSBController()
+{
+    addControllerWrapper (generateUniqueName ("USB"), KStorageBus_USB, KStorageControllerType_USB);
+}
+
 void UIMachineSettingsStorage::delController()
 {
     QModelIndex index = mTwStorageTree->currentIndex();
@@ -2470,9 +2713,11 @@ void UIMachineSettingsStorage::getInformation()
                 mCbType->setCurrentIndex (ctrPos == -1 ? 0 : ctrPos);
 
                 KStorageBus bus = mStorageModel->data (index, StorageModel::R_CtrBusType).value <KStorageBus>();
-                mLbPortCount->setVisible (bus == KStorageBus_SATA);
-                mSbPortCount->setVisible (bus == KStorageBus_SATA);
+                mLbPortCount->setVisible (bus == KStorageBus_SATA || bus == KStorageBus_SAS);
+                mSbPortCount->setVisible (bus == KStorageBus_SATA || bus == KStorageBus_SAS);
                 uint uPortCount = mStorageModel->data (index, StorageModel::R_CtrPortCount).toUInt();
+                uint uMaxPortCount = mStorageModel->data (index, StorageModel::R_CtrMaxPortCount).toUInt();
+                mSbPortCount->setMaximum(uMaxPortCount);
                 mSbPortCount->setValue (uPortCount);
 
                 bool isUseIoCache = mStorageModel->data (index, StorageModel::R_CtrIoCache).toBool();
@@ -2500,22 +2745,22 @@ void UIMachineSettingsStorage::getInformation()
                 {
                     case KDeviceType_HardDisk:
                         mLbMedium->setText(tr("Hard &Disk:"));
-                        mTbOpen->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap(PixmapPool::HDAttachmentNormal)));
+                        mTbOpen->setIcon(iconPool()->icon(HDAttachmentNormal));
                         mTbOpen->setWhatsThis(tr("Choose or create a virtual hard disk file. The virtual machine will see "
                                                  "the data in the file as the contents of the virtual hard disk."));
                         mTbOpen->setToolTip(tr("Set up the virtual hard disk"));
                         break;
                     case KDeviceType_DVD:
-                        mLbMedium->setText(tr("CD/DVD &Drive:"));
-                        mTbOpen->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap(PixmapPool::CDAttachmentNormal)));
-                        mTbOpen->setWhatsThis(tr("Choose a virtual CD/DVD disk or a physical drive to use with the virtual drive. "
+                        mLbMedium->setText(tr("Optical &Drive:"));
+                        mTbOpen->setIcon(iconPool()->icon(CDAttachmentNormal));
+                        mTbOpen->setWhatsThis(tr("Choose a virtual optical disk or a physical drive to use with the virtual drive. "
                                                  "The virtual machine will see a disk inserted into the drive with the data "
                                                  "in the file or on the disk in the physical drive as its contents."));
-                        mTbOpen->setToolTip(tr("Set up the virtual CD/DVD drive"));
+                        mTbOpen->setToolTip(tr("Set up the virtual optical drive"));
                         break;
                     case KDeviceType_Floppy:
                         mLbMedium->setText(tr("Floppy &Drive:"));
-                        mTbOpen->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap(PixmapPool::FDAttachmentNormal)));
+                        mTbOpen->setIcon(iconPool()->icon(FDAttachmentNormal));
                         mTbOpen->setWhatsThis(tr("Choose a virtual floppy disk or a physical drive to use with the virtual drive. "
                                                  "The virtual machine will see a disk inserted into the drive with the data "
                                                  "in the file or on the disk in the physical drive as its contents."));
@@ -2524,10 +2769,20 @@ void UIMachineSettingsStorage::getInformation()
                     default:
                         break;
                 }
+
+                /* Get hot-pluggable state: */
+                bool fIsHotPluggable = mStorageModel->data(index, StorageModel::R_AttIsHotPluggable).toBool();
+
+                /* Fetch device-type, medium-id: */
                 m_pMediumIdHolder->setType(mediumTypeToLocal(device));
                 m_pMediumIdHolder->setId(mStorageModel->data(index, StorageModel::R_AttMediumId).toString());
-                mLbMedium->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));
-                mTbOpen->setEnabled(isMachineOffline() || (isMachineOnline() && device != KDeviceType_HardDisk));
+
+                /* Get/fetch editable state: */
+                bool fIsEditable =    (isMachineOffline())
+                                   || (isMachineOnline() && device != KDeviceType_HardDisk)
+                                   || (isMachineOnline() && device == KDeviceType_HardDisk && fIsHotPluggable);
+                mLbMedium->setEnabled(fIsEditable);
+                mTbOpen->setEnabled(fIsEditable);
 
                 /* Getting Passthrough state */
                 bool isHostDrive = mStorageModel->data (index, StorageModel::R_AttIsHostDrive).toBool();
@@ -2542,6 +2797,10 @@ void UIMachineSettingsStorage::getInformation()
                 mCbNonRotational->setVisible (device == KDeviceType_HardDisk);
                 mCbNonRotational->setChecked (mStorageModel->data (index, StorageModel::R_AttIsNonRotational).toBool());
 
+                /* Fetch hot-pluggable state: */
+                m_pCheckBoxHotPluggable->setVisible((slt.bus == KStorageBus_SATA) || (slt.bus == KStorageBus_USB));
+                m_pCheckBoxHotPluggable->setChecked(fIsHotPluggable);
+
                 /* Update optional widgets visibility */
                 updateAdditionalObjects (device);
 
@@ -2554,6 +2813,7 @@ void UIMachineSettingsStorage::getInformation()
                 mLbHDDetailsValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttDetails).toString()));
                 mLbLocationValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttLocation).toString()));
                 mLbUsageValue->setText (compressText (mStorageModel->data (index, StorageModel::R_AttUsage).toString()));
+                m_pLabelEncryptionValue->setText(compressText(mStorageModel->data(index, StorageModel::R_AttEncryptionPasswordID).toString()));
 
                 /* Showing Attachment Page */
                 mSwRightPane->setCurrentIndex (2);
@@ -2622,6 +2882,10 @@ void UIMachineSettingsStorage::setInformation()
             {
                 mStorageModel->setData (index, mCbNonRotational->isChecked(), StorageModel::R_AttIsNonRotational);
             }
+            else if (sdr == m_pCheckBoxHotPluggable)
+            {
+                mStorageModel->setData(index, m_pCheckBoxHotPluggable->isChecked(), StorageModel::R_AttIsHotPluggable);
+            }
             break;
         }
         default:
@@ -2648,8 +2912,7 @@ void UIMachineSettingsStorage::sltPrepareOpenMediumMenu()
             {
                 /* Add "Create a new virtual hard disk" action: */
                 QAction *pCreateNewHardDisk = pOpenMediumMenu->addAction(tr("Create a new hard disk..."));
-                pCreateNewHardDisk->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap(PixmapPool::HDNewEn),
-                                                                PixmapPool::pool()->pixmap(PixmapPool::HDNewDis)));
+                pCreateNewHardDisk->setIcon(iconPool()->icon(HDNewEn, HDNewDis));
                 connect(pCreateNewHardDisk, SIGNAL(triggered(bool)), this, SLOT(sltCreateNewHardDisk()));
                 /* Add "Choose a virtual hard disk file" action: */
                 addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose a virtual hard disk file..."));
@@ -2659,8 +2922,8 @@ void UIMachineSettingsStorage::sltPrepareOpenMediumMenu()
             }
             case UIMediumType_DVD:
             {
-                /* Add "Choose a virtual CD/DVD disk file" action: */
-                addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose a virtual CD/DVD disk file..."));
+                /* Add "Choose a virtual optical disk file" action: */
+                addChooseExistingMediumAction(pOpenMediumMenu, tr("Choose a virtual optical disk file..."));
                 /* Add "Choose a physical drive" actions: */
                 addChooseHostDriveActions(pOpenMediumMenu);
                 /* Add recent mediums list: */
@@ -2669,8 +2932,7 @@ void UIMachineSettingsStorage::sltPrepareOpenMediumMenu()
                 pOpenMediumMenu->addSeparator();
                 QAction *pEjectCurrentMedium = pOpenMediumMenu->addAction(tr("Remove disk from virtual drive"));
                 pEjectCurrentMedium->setEnabled(!m_pMediumIdHolder->isNull());
-                pEjectCurrentMedium->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap(PixmapPool::CDUnmountEnabled),
-                                                                 PixmapPool::pool()->pixmap(PixmapPool::CDUnmountDisabled)));
+                pEjectCurrentMedium->setIcon(iconPool()->icon(CDUnmountEnabled, CDUnmountDisabled));
                 connect(pEjectCurrentMedium, SIGNAL(triggered(bool)), this, SLOT(sltUnmountDevice()));
                 break;
             }
@@ -2686,8 +2948,7 @@ void UIMachineSettingsStorage::sltPrepareOpenMediumMenu()
                 pOpenMediumMenu->addSeparator();
                 QAction *pEjectCurrentMedium = pOpenMediumMenu->addAction(tr("Remove disk from virtual drive"));
                 pEjectCurrentMedium->setEnabled(!m_pMediumIdHolder->isNull());
-                pEjectCurrentMedium->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap(PixmapPool::FDUnmountEnabled),
-                                                                 PixmapPool::pool()->pixmap(PixmapPool::FDUnmountDisabled)));
+                pEjectCurrentMedium->setIcon(iconPool()->icon(FDUnmountEnabled, FDUnmountDisabled));
                 connect(pEjectCurrentMedium, SIGNAL(triggered(bool)), this, SLOT(sltUnmountDevice()));
                 break;
             }
@@ -2752,25 +3013,36 @@ void UIMachineSettingsStorage::updateActionsState()
     bool isSCSIPossible = mStorageModel->data (index, StorageModel::R_IsMoreSCSIControllersPossible).toBool();
     bool isFloppyPossible = mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool();
     bool isSASPossible = mStorageModel->data (index, StorageModel::R_IsMoreSASControllersPossible).toBool();
+    bool isUSBPossible = mStorageModel->data (index, StorageModel::R_IsMoreUSBControllersPossible).toBool();
 
     bool isController = mStorageModel->data (index, StorageModel::R_IsController).toBool();
     bool isAttachment = mStorageModel->data (index, StorageModel::R_IsAttachment).toBool();
     bool isAttachmentsPossible = mStorageModel->data (index, StorageModel::R_IsMoreAttachmentsPossible).toBool();
+    bool fIsAttachmentHotPluggable = mStorageModel->data(index, StorageModel::R_AttIsHotPluggable).toBool();
 
-    mAddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible || isSASPossible);
+    /* Configure "add controller" actions: */
+    mAddCtrAction->setEnabled (isIDEPossible || isSATAPossible || isSCSIPossible || isFloppyPossible || isSASPossible || isUSBPossible);
     mAddIDECtrAction->setEnabled (isIDEPossible);
     mAddSATACtrAction->setEnabled (isSATAPossible);
     mAddSCSICtrAction->setEnabled (isSCSIPossible);
     mAddFloppyCtrAction->setEnabled (isFloppyPossible);
     mAddSASCtrAction->setEnabled (isSASPossible);
+    mAddUSBCtrAction->setEnabled (isUSBPossible);
 
+    /* Configure "add attachment" actions: */
     mAddAttAction->setEnabled (isController && isAttachmentsPossible);
     mAddHDAttAction->setEnabled (isController && isAttachmentsPossible);
     mAddCDAttAction->setEnabled (isController && isAttachmentsPossible);
     mAddFDAttAction->setEnabled (isController && isAttachmentsPossible);
 
-    mDelCtrAction->setEnabled (isMachineOffline() && isController);
-    mDelAttAction->setEnabled (isMachineOffline() && isAttachment);
+    /* Configure "delete controller" action: */
+    bool fControllerInSuitableState = isMachineOffline();
+    mDelCtrAction->setEnabled(isController && fControllerInSuitableState);
+
+    /* Configure "delete attachment" action: */
+    bool fAttachmentInSuitableState = isMachineOffline() ||
+                                      (isMachineOnline() && fIsAttachmentHotPluggable);
+    mDelAttAction->setEnabled(isAttachment && fAttachmentInSuitableState);
 }
 
 void UIMachineSettingsStorage::onRowInserted (const QModelIndex &aParent, int aPosition)
@@ -3047,6 +3319,9 @@ void UIMachineSettingsStorage::addControllerWrapper (const QString &aName, KStor
         case KStorageBus_Floppy:
             Assert (mStorageModel->data (index, StorageModel::R_IsMoreFloppyControllersPossible).toBool());
             break;
+        case KStorageBus_USB:
+            Assert (mStorageModel->data (index, StorageModel::R_IsMoreUSBControllersPossible).toBool());
+            break;
         default:
             break;
     }
@@ -3139,6 +3414,9 @@ void UIMachineSettingsStorage::updateAdditionalObjects (KDeviceType aType)
 
     mLbHDDetails->setVisible (aType == KDeviceType_HardDisk);
     mLbHDDetailsValue->setVisible (aType == KDeviceType_HardDisk);
+
+    m_pLabelEncryption->setVisible(aType == KDeviceType_HardDisk);
+    m_pLabelEncryptionValue->setVisible(aType == KDeviceType_HardDisk);
 }
 
 QString UIMachineSettingsStorage::generateUniqueName (const QString &aTemplate) const
@@ -3182,8 +3460,7 @@ uint32_t UIMachineSettingsStorage::deviceCount (KDeviceType aType) const
 void UIMachineSettingsStorage::addChooseExistingMediumAction(QMenu *pOpenMediumMenu, const QString &strActionName)
 {
     QAction *pChooseExistingMedium = pOpenMediumMenu->addAction(strActionName);
-    pChooseExistingMedium->setIcon(UIIconPool::iconSet(PixmapPool::pool()->pixmap(PixmapPool::ChooseExistingEn),
-                                                       PixmapPool::pool()->pixmap(PixmapPool::ChooseExistingDis)));
+    pChooseExistingMedium->setIcon(iconPool()->icon(ChooseExistingEn, ChooseExistingDis));
     connect(pChooseExistingMedium, SIGNAL(triggered(bool)), this, SLOT(sltChooseExistingMedium()));
 }
 
@@ -3203,24 +3480,15 @@ void UIMachineSettingsStorage::addChooseHostDriveActions(QMenu *pOpenMediumMenu)
 
 void UIMachineSettingsStorage::addRecentMediumActions(QMenu *pOpenMediumMenu, UIMediumType recentMediumType)
 {
-    /* Compose recent-medium list address: */
-    QString strRecentMediumAddress;
+    /* Get recent-medium list: */
+    QStringList recentMediumList;
     switch (recentMediumType)
     {
-        case UIMediumType_HardDisk:
-            strRecentMediumAddress = GUI_RecentListHD;
-            break;
-        case UIMediumType_DVD:
-            strRecentMediumAddress = GUI_RecentListCD;
-            break;
-        case UIMediumType_Floppy:
-            strRecentMediumAddress = GUI_RecentListFD;
-            break;
-        default:
-            break;
+        case UIMediumType_HardDisk: recentMediumList = gEDataManager->recentListOfHardDrives(); break;
+        case UIMediumType_DVD:      recentMediumList = gEDataManager->recentListOfOpticalDisks(); break;
+        case UIMediumType_Floppy:   recentMediumList = gEDataManager->recentListOfFloppyDisks(); break;
+        default: break;
     }
-    /* Get recent-medium list: */
-    QStringList recentMediumList = vboxGlobal().virtualBox().GetExtraData(strRecentMediumAddress).split(';');
     /* For every list-item: */
     for (int index = 0; index < recentMediumList.size(); ++index)
     {
@@ -3356,7 +3624,7 @@ bool UIMachineSettingsStorage::createStorageController(const UICacheSettingsMach
                 /* Set storage controller attributes: */
                 controller.SetControllerType(controllerType);
                 controller.SetUseHostIOCache(fUseHostIOCache);
-                if (controllerBus == KStorageBus_SATA)
+                if (controllerBus == KStorageBus_SATA || controllerBus == KStorageBus_SAS)
                 {
                     uPortCount = qMax(uPortCount, controller.GetMinPortCount());
                     uPortCount = qMin(uPortCount, controller.GetMaxPortCount());
@@ -3405,7 +3673,7 @@ bool UIMachineSettingsStorage::updateStorageController(const UICacheSettingsMach
             /* Set storage controller attributes: */
             controller.SetControllerType(controllerType);
             controller.SetUseHostIOCache(fUseHostIOCache);
-            if (controllerBus == KStorageBus_SATA)
+            if (controllerBus == KStorageBus_SATA || controllerBus == KStorageBus_SAS)
             {
                 uPortCount = qMax(uPortCount, controller.GetMinPortCount());
                 uPortCount = qMin(uPortCount, controller.GetMaxPortCount());
@@ -3491,6 +3759,7 @@ bool UIMachineSettingsStorage::createStorageAttachment(const UICacheSettingsMach
         bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;
         bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;
         bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational;
+        bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable;
         /* Get GUI medium object: */
         UIMedium vboxMedium = vboxGlobal().medium(strAttachmentMediumId);
         /* Get COM medium object: */
@@ -3511,13 +3780,13 @@ bool UIMachineSettingsStorage::createStorageAttachment(const UICacheSettingsMach
             {
                 if (attachmentDeviceType == KDeviceType_DVD)
                 {
-                    if (fSuccess)
+                    if (fSuccess && isMachineOffline())
                     {
                         m_machine.PassthroughDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentPassthrough);
                         /* Check that machine is OK: */
                         fSuccess = m_machine.isOk();
                     }
-                    if (fSuccess)
+                    if (fSuccess && isMachineInValidMode())
                     {
                         m_machine.TemporaryEjectDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentTempEject);
                         /* Check that machine is OK: */
@@ -3526,9 +3795,21 @@ bool UIMachineSettingsStorage::createStorageAttachment(const UICacheSettingsMach
                 }
                 else if (attachmentDeviceType == KDeviceType_HardDisk)
                 {
-                    m_machine.NonRotationalDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentNonRotational);
-                    /* Check that machine is OK: */
-                    fSuccess = m_machine.isOk();
+                    if (fSuccess && isMachineOffline())
+                    {
+                        m_machine.NonRotationalDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentNonRotational);
+                        /* Check that machine is OK: */
+                        fSuccess = m_machine.isOk();
+                    }
+                }
+                if ((controllerBus == KStorageBus_SATA) || (controllerBus == KStorageBus_USB))
+                {
+                    if (fSuccess && isMachineOffline())
+                    {
+                        m_machine.SetHotPluggableForDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentHotPluggable);
+                        /* Check that machine is OK: */
+                        fSuccess = m_machine.isOk();
+                    }
                 }
             }
             else
@@ -3566,6 +3847,7 @@ bool UIMachineSettingsStorage::updateStorageAttachment(const UICacheSettingsMach
         bool fAttachmentPassthrough = attachmentData.m_fAttachmentPassthrough;
         bool fAttachmentTempEject = attachmentData.m_fAttachmentTempEject;
         bool fAttachmentNonRotational = attachmentData.m_fAttachmentNonRotational;
+        bool fAttachmentHotPluggable = attachmentData.m_fAttachmentHotPluggable;
         KDeviceType attachmentDeviceType = attachmentData.m_attachmentType;
 
         /* Check that storage attachment exists: */
@@ -3609,13 +3891,22 @@ bool UIMachineSettingsStorage::updateStorageAttachment(const UICacheSettingsMach
                         fSuccess = m_machine.isOk();
                     }
                 }
+                if ((controllerBus == KStorageBus_SATA) || (controllerBus == KStorageBus_USB))
+                {
+                    if (fSuccess && isMachineOffline())
+                    {
+                        m_machine.SetHotPluggableForDevice(strControllerName, iAttachmentPort, iAttachmentDevice, fAttachmentHotPluggable);
+                        /* Check that machine is OK: */
+                        fSuccess = m_machine.isOk();
+                    }
+                }
             }
             else
             {
                 /* Show error message: */
                 msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal(attachmentDeviceType),
-                                                 vboxMedium.location(),
-                                                 StorageSlot(controllerBus, iAttachmentPort, iAttachmentDevice), this);
+                                               vboxMedium.location(),
+                                               StorageSlot(controllerBus, iAttachmentPort, iAttachmentDevice), this);
             }
         }
     }
@@ -3655,12 +3946,12 @@ bool UIMachineSettingsStorage::isAttachmentCouldBeUpdated(const UICacheSettingsM
            (currentAttachmentDeviceType == KDeviceType_Floppy || currentAttachmentDeviceType == KDeviceType_DVD);
 }
 
-void UIMachineSettingsStorage::setDialogType(SettingsDialogType settingsDialogType)
+void UIMachineSettingsStorage::setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel)
 {
-    /* Update model 'settings window type': */
-    mStorageModel->setDialogType(settingsDialogType);
-    /* Update 'settings window type' of base class: */
-    UISettingsPageMachine::setDialogType(settingsDialogType);
+    /* Update model 'configuration access level': */
+    mStorageModel->setConfigurationAccessLevel(newConfigurationAccessLevel);
+    /* Update 'configuration access level' of base class: */
+    UISettingsPageMachine::setConfigurationAccessLevel(newConfigurationAccessLevel);
 }
 
 void UIMachineSettingsStorage::polishPage()
@@ -3692,6 +3983,7 @@ void UIMachineSettingsStorage::polishPage()
     mCbPassthrough->setEnabled(isMachineOffline());
     mCbTempEject->setEnabled(isMachineInValidMode());
     mCbNonRotational->setEnabled(isMachineOffline());
+    m_pCheckBoxHotPluggable->setEnabled(isMachineOffline());
     mLsInformation->setEnabled(isMachineInValidMode());
     mLbHDFormat->setEnabled(isMachineInValidMode());
     mLbHDFormatValue->setEnabled(isMachineInValidMode());
@@ -3709,10 +4001,12 @@ void UIMachineSettingsStorage::polishPage()
     mLbLocationValue->setEnabled(isMachineInValidMode());
     mLbUsage->setEnabled(isMachineInValidMode());
     mLbUsageValue->setEnabled(isMachineInValidMode());
+    m_pLabelEncryption->setEnabled(isMachineInValidMode());
+    m_pLabelEncryptionValue->setEnabled(isMachineInValidMode());
 
     /* Update action states: */
     updateActionsState();
 }
 
-#include "UIMachineSettingsStorage.moc"
+# include "UIMachineSettingsStorage.moc"
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
index a22c313..7e5f9f3 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsStorage.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsStorage class declaration
+ * VBox Qt GUI - UIMachineSettingsStorage class declaration.
  */
 
 /*
@@ -47,93 +46,78 @@ Q_DECLARE_METATYPE (SlotsList);
 Q_DECLARE_METATYPE (DeviceTypeList);
 Q_DECLARE_METATYPE (ControllerTypeList);
 
+/** Known item states. */
 enum ItemState
 {
-    State_DefaultItem   = 0,
-    State_CollapsedItem = 1,
-    State_ExpandedItem  = 2,
+    State_DefaultItem,
+    State_CollapsedItem,
+    State_ExpandedItem,
     State_MAX
 };
 
-/* Pixmap Storage Pool */
-class PixmapPool : public QObject
+/** Known pixmap types. */
+enum PixmapType
 {
-    Q_OBJECT;
-
-public:
-
-    enum PixmapType
-    {
-        InvalidPixmap            = -1,
-
-        ControllerAddEn          =  0,
-        ControllerAddDis         =  1,
-        ControllerDelEn          =  2,
-        ControllerDelDis         =  3,
-
-        AttachmentAddEn          =  4,
-        AttachmentAddDis         =  5,
-        AttachmentDelEn          =  6,
-        AttachmentDelDis         =  7,
-
-        IDEControllerNormal      =  8,
-        IDEControllerExpand      =  9,
-        IDEControllerCollapse    = 10,
-        SATAControllerNormal     = 11,
-        SATAControllerExpand     = 12,
-        SATAControllerCollapse   = 13,
-        SCSIControllerNormal     = 14,
-        SCSIControllerExpand     = 15,
-        SCSIControllerCollapse   = 16,
-        FloppyControllerNormal   = 17,
-        FloppyControllerExpand   = 18,
-        FloppyControllerCollapse = 19,
-
-        IDEControllerAddEn       = 20,
-        IDEControllerAddDis      = 21,
-        SATAControllerAddEn      = 22,
-        SATAControllerAddDis     = 23,
-        SCSIControllerAddEn      = 24,
-        SCSIControllerAddDis     = 25,
-        FloppyControllerAddEn    = 26,
-        FloppyControllerAddDis   = 27,
-
-        HDAttachmentNormal       = 28,
-        CDAttachmentNormal       = 29,
-        FDAttachmentNormal       = 30,
-
-        HDAttachmentAddEn        = 31,
-        HDAttachmentAddDis       = 32,
-        CDAttachmentAddEn        = 33,
-        CDAttachmentAddDis       = 34,
-        FDAttachmentAddEn        = 35,
-        FDAttachmentAddDis       = 36,
-
-        ChooseExistingEn         = 37,
-        ChooseExistingDis        = 38,
-        HDNewEn                  = 39,
-        HDNewDis                 = 40,
-        CDUnmountEnabled         = 41,
-        CDUnmountDisabled        = 42,
-        FDUnmountEnabled         = 43,
-        FDUnmountDisabled        = 44,
-
-        MaxIndex
-    };
-
-    static PixmapPool* pool (QObject *aParent = 0);
-
-    QPixmap pixmap (PixmapType aType) const;
-
-protected:
-
-    PixmapPool (QObject *aParent);
-
-    static QPointer <PixmapPool> mThis;
-
-private:
-
-    QVector <QPixmap> mPool;
+    InvalidPixmap,
+
+    ControllerAddEn,
+    ControllerAddDis,
+    ControllerDelEn,
+    ControllerDelDis,
+
+    AttachmentAddEn,
+    AttachmentAddDis,
+    AttachmentDelEn,
+    AttachmentDelDis,
+
+    IDEControllerNormal,
+    IDEControllerExpand,
+    IDEControllerCollapse,
+    SATAControllerNormal,
+    SATAControllerExpand,
+    SATAControllerCollapse,
+    SCSIControllerNormal,
+    SCSIControllerExpand,
+    SCSIControllerCollapse,
+    USBControllerNormal,
+    USBControllerExpand,
+    USBControllerCollapse,
+    FloppyControllerNormal,
+    FloppyControllerExpand,
+    FloppyControllerCollapse,
+
+    IDEControllerAddEn,
+    IDEControllerAddDis,
+    SATAControllerAddEn,
+    SATAControllerAddDis,
+    SCSIControllerAddEn,
+    SCSIControllerAddDis,
+    USBControllerAddEn,
+    USBControllerAddDis,
+    FloppyControllerAddEn,
+    FloppyControllerAddDis,
+
+    HDAttachmentNormal,
+    CDAttachmentNormal,
+    FDAttachmentNormal,
+
+    HDAttachmentAddEn,
+    HDAttachmentAddDis,
+    CDAttachmentAddEn,
+    CDAttachmentAddDis,
+    FDAttachmentAddEn,
+    FDAttachmentAddDis,
+
+    ChooseExistingEn,
+    ChooseExistingDis,
+    HDNewEn,
+    HDNewDis,
+    CDUnmountEnabled,
+    CDUnmountDisabled,
+    FDUnmountEnabled,
+    FDUnmountDisabled,
+
+    MaxIndex
 };
 
 /* Abstract Controller Type */
@@ -147,7 +131,7 @@ public:
     KStorageBus busType() const;
     KStorageControllerType ctrType() const;
     ControllerTypeList ctrTypes() const;
-    PixmapPool::PixmapType pixmap (ItemState aState) const;
+    PixmapType pixmap(ItemState aState) const;
 
     void setCtrType (KStorageControllerType aCtrType);
 
@@ -160,7 +144,7 @@ protected:
 
     KStorageBus mBusType;
     KStorageControllerType mCtrType;
-    QList <PixmapPool::PixmapType> mPixmaps;
+    QList<PixmapType> mPixmaps;
 };
 
 /* IDE Controller Type */
@@ -228,6 +212,19 @@ private:
     uint size() const;
 };
 
+/* USB Controller Type */
+class USBStorageControllerType : public AbstractControllerType
+{
+public:
+
+    USBStorageControllerType (KStorageControllerType aSubType);
+
+private:
+
+    KStorageControllerType first() const;
+    uint size() const;
+};
+
 /* Abstract Item */
 class AbstractItem
 {
@@ -310,6 +307,7 @@ public:
     KStorageControllerType ctrType() const;
     ControllerTypeList ctrTypes() const;
     uint portCount();
+    uint maxPortCount();
     bool ctrUseIoCache() const;
 
     void setCtrName (const QString &aCtrName);
@@ -359,6 +357,7 @@ public:
     bool attIsPassthrough() const;
     bool attIsTempEject() const;
     bool attIsNonRotational() const;
+    bool attIsHotPluggable() const;
 
     void setAttSlot (const StorageSlot &aAttSlot);
     void setAttDevice (KDeviceType aAttDeviceType);
@@ -366,6 +365,7 @@ public:
     void setAttIsPassthrough (bool aPassthrough);
     void setAttIsTempEject (bool aTempEject);
     void setAttIsNonRotational (bool aNonRotational);
+    void setAttIsHotPluggable(bool fIsHotPluggable);
 
     QString attSize() const;
     QString attLogicalSize() const;
@@ -373,6 +373,7 @@ public:
     QString attFormat() const;
     QString attDetails() const;
     QString attUsage() const;
+    QString attEncryptionPasswordID() const;
 
 private:
 
@@ -398,6 +399,7 @@ private:
     bool mAttIsPassthrough;
     bool mAttIsTempEject;
     bool mAttIsNonRotational;
+    bool m_fIsHotPluggable;
 
     QString mAttName;
     QString mAttTip;
@@ -409,6 +411,7 @@ private:
     QString mAttFormat;
     QString mAttDetails;
     QString mAttUsage;
+    QString m_strAttEncryptionPasswordID;
 };
 
 /* Storage Model */
@@ -435,6 +438,7 @@ public:
         R_IsMoreSCSIControllersPossible,
         R_IsMoreFloppyControllersPossible,
         R_IsMoreSASControllersPossible,
+        R_IsMoreUSBControllersPossible,
         R_IsMoreAttachmentsPossible,
 
         R_CtrName,
@@ -443,6 +447,7 @@ public:
         R_CtrDevices,
         R_CtrBusType,
         R_CtrPortCount,
+        R_CtrMaxPortCount,
         R_CtrIoCache,
 
         R_AttSlot,
@@ -454,12 +459,14 @@ public:
         R_AttIsPassthrough,
         R_AttIsTempEject,
         R_AttIsNonRotational,
+        R_AttIsHotPluggable,
         R_AttSize,
         R_AttLogicalSize,
         R_AttLocation,
         R_AttFormat,
         R_AttDetails,
         R_AttUsage,
+        R_AttEncryptionPasswordID,
 
         R_Margin,
         R_Spacing,
@@ -516,7 +523,8 @@ public:
     KChipsetType chipsetType() const;
     void setChipsetType(KChipsetType type);
 
-    void setDialogType(SettingsDialogType settingsDialogType);
+    /** Defines configuration access level. */
+    void setConfigurationAccessLevel(ConfigurationAccessLevel newConfigurationAccessLevel);
 
     void clear();
 
@@ -538,7 +546,9 @@ private:
     ToolTipType mToolTipType;
 
     KChipsetType m_chipsetType;
-    SettingsDialogType m_dialogType;
+
+    /** Holds configuration access level. */
+    ConfigurationAccessLevel m_configurationAccessLevel;
 };
 Q_DECLARE_METATYPE (StorageModel::ToolTipType);
 
@@ -569,7 +579,9 @@ struct UIDataSettingsMachineStorageAttachment
         , m_strAttachmentMediumId(QString())
         , m_fAttachmentPassthrough(false)
         , m_fAttachmentTempEject(false)
-        , m_fAttachmentNonRotational(false) {}
+        , m_fAttachmentNonRotational(false)
+        , m_fAttachmentHotPluggable(false)
+    {}
     /* Functions: */
     bool equal(const UIDataSettingsMachineStorageAttachment &other) const
     {
@@ -579,7 +591,8 @@ struct UIDataSettingsMachineStorageAttachment
                (m_strAttachmentMediumId == other.m_strAttachmentMediumId) &&
                (m_fAttachmentPassthrough == other.m_fAttachmentPassthrough) &&
                (m_fAttachmentTempEject == other.m_fAttachmentTempEject) &&
-               (m_fAttachmentNonRotational == other.m_fAttachmentNonRotational);
+               (m_fAttachmentNonRotational == other.m_fAttachmentNonRotational) &&
+               (m_fAttachmentHotPluggable == other.m_fAttachmentHotPluggable);
     }
     /* Operators: */
     bool operator==(const UIDataSettingsMachineStorageAttachment &other) const { return equal(other); }
@@ -592,6 +605,7 @@ struct UIDataSettingsMachineStorageAttachment
     bool m_fAttachmentPassthrough;
     bool m_fAttachmentTempEject;
     bool m_fAttachmentNonRotational;
+    bool m_fAttachmentHotPluggable;
 };
 typedef UISettingsCache<UIDataSettingsMachineStorageAttachment> UICacheSettingsMachineStorageAttachment;
 
@@ -646,6 +660,7 @@ class UIMachineSettingsStorage : public UISettingsPageMachine,
 public:
 
     UIMachineSettingsStorage();
+    ~UIMachineSettingsStorage();
 
     void setChipsetType(KChipsetType type);
 
@@ -691,6 +706,7 @@ private slots:
     void addSCSIController();
     void addFloppyController();
     void addSASController();
+    void addUSBController();
     void delController();
 
     void addAttachment();
@@ -753,7 +769,9 @@ private:
     bool isControllerCouldBeUpdated(const UICacheSettingsMachineStorageController &controllerCache) const;
     bool isAttachmentCouldBeUpdated(const UICacheSettingsMachineStorageAttachment &attachmentCache) const;
 
-    void setDialogType(SettingsDialogType settingsDialogType);
+    /** Defines configuration access level. */
+    void setConfigurationAccessLevel(ConfigurationAccessLevel configurationAccessLevel);
+
     void polishPage();
 
     QString m_strMachineId;
@@ -769,6 +787,7 @@ private:
     QAction *mAddSCSICtrAction;
     QAction *mAddSASCtrAction;
     QAction *mAddFloppyCtrAction;
+    QAction *mAddUSBCtrAction;
     QAction *mAddAttAction;
     QAction *mDelAttAction;
     QAction *mAddHDAttAction;
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.ui
index ec8eb18..306cb6a 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.ui
@@ -325,60 +325,83 @@
             <property name="text" >
              <string/>
             </property>
-            <property name="autoRaise" >
-             <bool>true</bool>
-            </property>
            </widget>
           </item>
          </layout>
         </item>
-        <item row="2" column="2" >
-         <widget class="QCheckBox" name="mCbPassthrough" >
-          <property name="sizePolicy" >
-           <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="whatsThis" >
-           <string>When checked, allows the guest to send ATAPI commands directly to the host-drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</string>
-          </property>
-          <property name="text" >
-           <string>&Passthrough</string>
-          </property>
-         </widget>
-        </item>
-        <item row="2" column="2" >
-         <widget class="QCheckBox" name="mCbTempEject" >
-          <property name="sizePolicy" >
-           <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="whatsThis" >
-           <string>When checked the virtual disk will not be removed when the guest system ejects it.</string>
-          </property>
-          <property name="text" >
-           <string>&Live CD/DVD</string>
-          </property>
-         </widget>
-        </item>
-        <item row="2" column="2" >
-         <widget class="QCheckBox" name="mCbNonRotational" >
-          <property name="sizePolicy" >
-           <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-           </sizepolicy>
-          </property>
-          <property name="whatsThis" >
-           <string>When checked the guest system will see the virtual disk as a solid state device.</string>
+        <item row="2" column="2">
+         <layout class="QVBoxLayout" name="m_pLayoutAttachmentConfig">
+          <property name="margin">
+           <number>0</number>
           </property>
-          <property name="text" >
-           <string>&Solid-state Drive</string>
+          <property name="spacing">
+           <number>0</number>
           </property>
-         </widget>
+          <item>
+           <widget class="QCheckBox" name="mCbPassthrough">
+            <property name="sizePolicy">
+             <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="whatsThis">
+             <string>When checked, allows the guest to send ATAPI commands directly to the host-drive which makes it possible to use CD/DVD writers connected to the host inside the VM. Note that writing audio CD inside the VM is not yet supported.</string>
+            </property>
+            <property name="text">
+             <string>&Passthrough</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="mCbTempEject">
+            <property name="sizePolicy">
+             <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="whatsThis">
+             <string>When checked the virtual disk will not be removed when the guest system ejects it.</string>
+            </property>
+            <property name="text">
+             <string>&Live CD/DVD</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="mCbNonRotational">
+            <property name="sizePolicy">
+             <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="whatsThis">
+             <string>When checked the guest system will see the virtual disk as a solid state device.</string>
+            </property>
+            <property name="text">
+             <string>&Solid-state Drive</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QCheckBox" name="m_pCheckBoxHotPluggable">
+            <property name="sizePolicy">
+             <sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="whatsThis">
+             <string>When checked the guest system will see the virtual disk as a hot-pluggable device.</string>
+            </property>
+            <property name="text">
+             <string>&Hot-pluggable</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
         </item>
         <item row="3" column="0" colspan="3" >
          <widget class="QILabelSeparator" native="1" name="mLsInformation" >
@@ -547,7 +570,27 @@
           </property>
          </widget>
         </item>
-        <item row="12" column="0" colspan="3" >
+        <item row="12" column="1">
+         <widget class="QLabel" name="m_pLabelEncryption">
+          <property name="text">
+           <string>Encrypted with key:</string>
+          </property>
+          <property name="alignment">
+           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+          </property>
+         </widget>
+        </item>
+        <item row="12" column="2">
+         <widget class="QILabel" name="m_pLabelEncryptionValue">
+          <property name="sizePolicy">
+           <sizepolicy vsizetype="Preferred" hsizetype="Ignored">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+         </widget>
+        </item>
+        <item row="13" column="0" colspan="3" >
          <spacer name="mSp6" >
           <property name="orientation" >
            <enum>Qt::Vertical</enum>
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
index e3b752d..0c585f0 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsSystem.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsSystem class implementation
+ * VBox Qt GUI - UIMachineSettingsSystem class implementation.
  */
 
 /*
@@ -17,26 +15,33 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHeaderView>
+# include <QHeaderView>
 
 /* GUI includes: */
-#include "QIWidgetValidator.h"
-#include "UIIconPool.h"
-#include "VBoxGlobal.h"
-#include "UIMachineSettingsSystem.h"
-#include "UIConverter.h"
+# include "QIWidgetValidator.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
+# include "UIMachineSettingsSystem.h"
+# include "UIConverter.h"
 
 /* COM includes: */
-#include "CBIOSSettings.h"
+# include "CBIOSSettings.h"
 
 /* Other VBox includes: */
-#include <iprt/cdefs.h>
+# include <iprt/cdefs.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineSettingsSystem::UIMachineSettingsSystem()
     : m_uMinGuestCPU(0), m_uMaxGuestCPU(0)
     , m_uMinGuestCPUExecCap(0), m_uMedGuestCPUExecCap(0), m_uMaxGuestCPUExecCap(0)
-    , m_fOHCIEnabled(false)
+    , m_fIsUSBEnabled(false)
 {
     /* Prepare: */
     prepare();
@@ -57,14 +62,14 @@ KChipsetType UIMachineSettingsSystem::chipsetType() const
     return (KChipsetType)m_pComboChipsetType->itemData(m_pComboChipsetType->currentIndex()).toInt();
 }
 
-void UIMachineSettingsSystem::setOHCIEnabled(bool fEnabled)
+void UIMachineSettingsSystem::setUSBEnabled(bool fEnabled)
 {
-    /* Make sure OHCI status has changed: */
-    if (m_fOHCIEnabled == fEnabled)
+    /* Make sure USB status has changed: */
+    if (m_fIsUSBEnabled == fEnabled)
         return;
 
-    /* Update OHCI status value: */
-    m_fOHCIEnabled = fEnabled;
+    /* Update USB status value: */
+    m_fIsUSBEnabled = fEnabled;
 
     /* Revalidate: */
     revalidate();
@@ -128,6 +133,7 @@ void UIMachineSettingsSystem::loadToCacheFrom(QVariant &data)
     systemData.m_fEnabledPAE = m_machine.GetCPUProperty(KCPUPropertyType_PAE);
 
     /* Load acceleration data: */
+    systemData.m_paravirtProvider = m_machine.GetParavirtProvider();
     systemData.m_fEnabledHwVirtEx = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_Enabled);
     systemData.m_fEnabledNestedPaging = m_machine.GetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging);
 
@@ -178,6 +184,8 @@ void UIMachineSettingsSystem::getFromCache()
     m_pCheckBoxPAE->setChecked(systemData.m_fEnabledPAE);
 
     /* Load acceleration data to page: */
+    int iParavirtProviderPosition = m_pComboParavirtProvider->findData(systemData.m_paravirtProvider);
+    m_pComboParavirtProvider->setCurrentIndex(iParavirtProviderPosition == -1 ? 0 : iParavirtProviderPosition);
     m_pCheckBoxVirtualization->setChecked(systemData.m_fEnabledHwVirtEx);
     m_pCheckBoxNestedPaging->setChecked(systemData.m_fEnabledNestedPaging);
 
@@ -221,6 +229,7 @@ void UIMachineSettingsSystem::putToCache()
     systemData.m_fEnabledPAE = m_pCheckBoxPAE->isChecked();
 
     /* Gather acceleration data: */
+    systemData.m_paravirtProvider = (KParavirtProvider)m_pComboParavirtProvider->itemData(m_pComboParavirtProvider->currentIndex()).toInt();
     systemData.m_fEnabledHwVirtEx = m_pCheckBoxVirtualization->checkState() == Qt::Checked || m_pSliderCPUCount->value() > 1;
     systemData.m_fEnabledNestedPaging = m_pCheckBoxNestedPaging->isChecked();
 
@@ -270,6 +279,7 @@ void UIMachineSettingsSystem::saveFromCacheTo(QVariant &data)
             m_machine.SetCPUProperty(KCPUPropertyType_PAE, systemData.m_fEnabledPAE);
 
             /* Acceleration tab: */
+            m_machine.SetParavirtProvider(systemData.m_paravirtProvider);
             m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_Enabled, systemData.m_fEnabledHwVirtEx);
             m_machine.SetHWVirtExProperty(KHWVirtExPropertyType_NestedPaging, systemData.m_fEnabledNestedPaging);
         }
@@ -320,16 +330,16 @@ bool UIMachineSettingsSystem::validate(QList<UIValidationMessage> &messages)
         {
             message.second << tr(
                 "The I/O APIC feature is not currently enabled in the Motherboard section of the System page. "
-                "This is needed in order to support a chip set of type ICH9. "
+                "This is needed in order to support a chip set of type ICH9 you have enabled for this VM. "
                 "It will be done automatically if you confirm your changes.");
         }
 
-        /* HID vs OHCI test: */
-        if (isHIDEnabled() && !m_fOHCIEnabled)
+        /* HID vs USB test: */
+        if (isHIDEnabled() && !m_fIsUSBEnabled)
         {
             message.second << tr(
                 "USB controller emulation is not currently enabled on the USB page. "
-                "This is needed to support an emulated USB input device. "
+                "This is needed to support an emulated USB input device you have enabled for this VM. "
                 "It will be done automatically if you confirm your changes.");
         }
 
@@ -367,7 +377,7 @@ bool UIMachineSettingsSystem::validate(QList<UIValidationMessage> &messages)
         {
             message.second << tr(
                 "The I/O APIC feature is not currently enabled in the Motherboard section of the System page. "
-                "This is needed in order to support more than one virtual processor. "
+                "This is needed in order to support more than one virtual processor you have chosen for this VM. "
                 "It will be done automatically if you confirm your changes.");
         }
 
@@ -376,7 +386,7 @@ bool UIMachineSettingsSystem::validate(QList<UIValidationMessage> &messages)
         {
             message.second << tr(
                 "Hardware virtualization is not currently enabled in the Acceleration section of the System page. "
-                "This is needed in order to support more than one virtual processor. "
+                "This is needed in order to support more than one virtual processor you have chosen for this VM. "
                 "It will be done automatically if you confirm your changes.");
         }
 
@@ -416,9 +426,10 @@ void UIMachineSettingsSystem::setOrderAfter(QWidget *pWidget)
     setTabOrder(m_pSliderCPUCount, m_pEditorCPUCount);
     setTabOrder(m_pEditorCPUCount, m_pSliderCPUExecCap);
     setTabOrder(m_pSliderCPUExecCap, m_pEditorCPUExecCap);
-    setTabOrder(m_pEditorCPUExecCap, m_pCheckBoxPAE);
+    setTabOrder(m_pEditorCPUExecCap, m_pComboParavirtProvider);
 
     /* Configure navigation for 'acceleration' tab: */
+    setTabOrder(m_pComboParavirtProvider, m_pCheckBoxPAE);
     setTabOrder(m_pCheckBoxPAE, m_pCheckBoxVirtualization);
     setTabOrder(m_pCheckBoxVirtualization, m_pCheckBoxNestedPaging);
 }
@@ -444,8 +455,9 @@ void UIMachineSettingsSystem::retranslateUi()
     m_pLabelCPUExecCapMax->setText(tr("<qt>%1%</qt>", "Max CPU execution cap in %").arg(m_uMaxGuestCPUExecCap));
 
     /* Retranslate combo-boxes: */
-    retranslateComboPointingChipsetType();
+    retranslateComboChipsetType();
     retranslateComboPointingHIDType();
+    retranslateComboParavirtProvider();
 }
 
 void UIMachineSettingsSystem::polishPage()
@@ -489,6 +501,8 @@ void UIMachineSettingsSystem::polishPage()
 
     /* Acceleration tab: */
     m_pTabWidgetSystem->setTabEnabled(2, systemData.m_fSupportedHwVirtEx);
+    m_pLabelParavirtProvider->setEnabled(isMachineOffline());
+    m_pComboParavirtProvider->setEnabled(isMachineOffline());
     m_pLabelVirtualization->setEnabled(isMachineOffline());
     m_pCheckBoxVirtualization->setEnabled(isMachineOffline());
     m_pCheckBoxNestedPaging->setEnabled(isMachineOffline() && m_pCheckBoxVirtualization->isChecked());
@@ -580,6 +594,7 @@ void UIMachineSettingsSystem::prepare()
     /* Prepare tabs: */
     prepareTabMotherboard();
     prepareTabProcessor();
+    prepareTabAcceleration();
 
     /* Prepare validation: */
     prepareValidation();
@@ -703,6 +718,17 @@ void UIMachineSettingsSystem::prepareTabProcessor()
     connect(m_pEditorCPUExecCap, SIGNAL(valueChanged(int)), this, SLOT(sltHandleCPUExecCapEditorChange()));
 }
 
+void UIMachineSettingsSystem::prepareTabAcceleration()
+{
+    /* Populate 'paravirt provider' combo: */
+    m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_None), QVariant(KParavirtProvider_None));
+    m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Default), QVariant(KParavirtProvider_Default));
+    m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Legacy), QVariant(KParavirtProvider_Legacy));
+    m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_Minimal), QVariant(KParavirtProvider_Minimal));
+    m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_HyperV), QVariant(KParavirtProvider_HyperV));
+    m_pComboParavirtProvider->addItem(gpConverter->toString(KParavirtProvider_KVM), QVariant(KParavirtProvider_KVM));
+}
+
 void UIMachineSettingsSystem::prepareValidation()
 {
     /* Prepare validation: */
@@ -755,9 +781,9 @@ void UIMachineSettingsSystem::repopulateComboPointingHIDType()
     }
 }
 
-void UIMachineSettingsSystem::retranslateComboPointingChipsetType()
+void UIMachineSettingsSystem::retranslateComboChipsetType()
 {
-    /* For each the element in KPointingHIDType enum: */
+    /* For each the element in KChipsetType enum: */
     for (int iIndex = (int)KChipsetType_Null; iIndex < (int)KChipsetType_Max; ++iIndex)
     {
         /* Cast to the corresponding type: */
@@ -785,6 +811,21 @@ void UIMachineSettingsSystem::retranslateComboPointingHIDType()
     }
 }
 
+void UIMachineSettingsSystem::retranslateComboParavirtProvider()
+{
+    /* For each the element in KParavirtProvider enum: */
+    for (int iIndex = (int)KParavirtProvider_None; iIndex < (int)KParavirtProvider_Max; ++iIndex)
+    {
+        /* Cast to the corresponding type: */
+        KParavirtProvider type = (KParavirtProvider)iIndex;
+        /* Look for the corresponding item: */
+        int iCorrespondingIndex = m_pComboParavirtProvider->findData((int)type);
+        /* Re-translate if corresponding item was found: */
+        if (iCorrespondingIndex != -1)
+            m_pComboParavirtProvider->setItemText(iCorrespondingIndex, gpConverter->toString(type));
+    }
+}
+
 void UIMachineSettingsSystem::adjustBootOrderTWSize()
 {
     /* Adjust boot-table size: */
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
index 4d8dea5..9598893 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsSystem.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsSystem class declaration
+ * VBox Qt GUI - UIMachineSettingsSystem class declaration.
  */
 
 /*
@@ -62,6 +61,7 @@ struct UIDataSettingsMachineSystem
         , m_iCPUExecCap(-1)
         , m_fEnabledPAE(false)
         /* Acceleration data: */
+        , m_paravirtProvider(KParavirtProvider_None)
         , m_fEnabledHwVirtEx(false)
         , m_fEnabledNestedPaging(false)
     {}
@@ -85,6 +85,7 @@ struct UIDataSettingsMachineSystem
                (m_iCPUExecCap == other.m_iCPUExecCap) &&
                (m_fEnabledPAE == other.m_fEnabledPAE) &&
                 /* Acceleration data: */
+               (m_paravirtProvider == other.m_paravirtProvider) &&
                (m_fEnabledHwVirtEx == other.m_fEnabledHwVirtEx) &&
                (m_fEnabledNestedPaging == other.m_fEnabledNestedPaging);
     }
@@ -110,6 +111,7 @@ struct UIDataSettingsMachineSystem
     int m_iCPUExecCap;
     bool m_fEnabledPAE;
     /* Variables: Acceleration data: */
+    KParavirtProvider m_paravirtProvider;
     bool m_fEnabledHwVirtEx;
     bool m_fEnabledNestedPaging;
 };
@@ -130,7 +132,7 @@ public:
     bool isHWVirtExEnabled() const;
     bool isHIDEnabled() const;
     KChipsetType chipsetType() const;
-    void setOHCIEnabled(bool fEnabled);
+    void setUSBEnabled(bool fEnabled);
 
 protected:
 
@@ -184,14 +186,16 @@ private:
     void prepare();
     void prepareTabMotherboard();
     void prepareTabProcessor();
+    void prepareTabAcceleration();
     void prepareValidation();
 
     /* Helper: Pointing HID type combo stuff: */
     void repopulateComboPointingHIDType();
 
     /* Helpers: Translation stuff: */
-    void retranslateComboPointingChipsetType();
+    void retranslateComboChipsetType();
     void retranslateComboPointingHIDType();
+    void retranslateComboParavirtProvider();
 
     /* Helper: Boot-table stuff: */
     void adjustBootOrderTWSize();
@@ -210,7 +214,7 @@ private:
     uint m_uMaxGuestCPUExecCap;
 
     /* Variable: Correlation stuff: */
-    bool m_fOHCIEnabled;
+    bool m_fIsUSBEnabled;
 
     /* Cache: */
     UICacheSettingsMachineSystem m_cache;
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.ui
index a63785d..5d795ac 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.ui
@@ -172,9 +172,6 @@
               <iconset>
                <normaloff>../images/list_moveup_16px.png</normaloff>../images/list_moveup_16px.png</iconset>
              </property>
-             <property name="autoRaise">
-              <bool>true</bool>
-             </property>
             </widget>
            </item>
            <item>
@@ -195,9 +192,6 @@
               <iconset>
                <normaloff>../images/list_movedown_16px.png</normaloff>../images/list_movedown_16px.png</iconset>
              </property>
-             <property name="autoRaise">
-              <bool>true</bool>
-             </property>
             </widget>
            </item>
            <item>
@@ -551,13 +545,59 @@
       </attribute>
       <layout class="QGridLayout">
        <item row="0" column="0">
+        <widget class="QLabel" name="m_pLabelParavirtProvider">
+         <property name="text">
+          <string>&Paravirtualization Interface:</string>
+         </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
+         <property name="buddy">
+          <cstring>m_pComboParavirtProvider</cstring>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <layout class="QHBoxLayout">
+         <item>
+          <widget class="QComboBox" name="m_pComboParavirtProvider">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <property name="whatsThis">
+            <string>Selects the paravirtualization guest interface provider to be used by this virtual machine.</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="m_pSpacerHorizontal7">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="0">
         <widget class="QLabel" name="m_pLabelVirtualization">
          <property name="text">
           <string>Hardware Virtualization:</string>
          </property>
+         <property name="alignment">
+          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         </property>
         </widget>
        </item>
-       <item row="0" column="1">
+       <item row="1" column="1">
         <widget class="QCheckBox" name="m_pCheckBoxVirtualization">
          <property name="sizePolicy">
           <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -573,7 +613,7 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
+       <item row="2" column="1">
         <widget class="QCheckBox" name="m_pCheckBoxNestedPaging">
          <property name="sizePolicy">
           <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -589,7 +629,7 @@
          </property>
         </widget>
        </item>
-       <item row="2" column="0" colspan="2">
+       <item row="3" column="0" colspan="2">
         <spacer name="m_pSpacerVertical4">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
index a8d7e68..c6d2c74 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsUSB.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsUSB class implementation
+ * VBox Qt GUI - UIMachineSettingsUSB class implementation.
  */
 
 /*
@@ -17,31 +15,45 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHeaderView>
-#include <QHelpEvent>
-#include <QToolTip>
+# include <QHeaderView>
+# include <QHelpEvent>
+# include <QToolTip>
 
 /* GUI includes: */
-#include "QIWidgetValidator.h"
-#include "UIIconPool.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIToolBar.h"
-#include "UIMachineSettingsUSB.h"
-#include "UIMachineSettingsUSBFilterDetails.h"
-#include "UIConverter.h"
+# include "QIWidgetValidator.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIToolBar.h"
+# include "UIMachineSettingsUSB.h"
+# include "UIMachineSettingsUSBFilterDetails.h"
+# include "UIConverter.h"
 
 /* COM includes: */
-#include "CConsole.h"
-#include "CUSBController.h"
-#include "CUSBDeviceFilters.h"
-#include "CUSBDevice.h"
-#include "CUSBDeviceFilter.h"
-#include "CHostUSBDevice.h"
-#include "CHostUSBDeviceFilter.h"
-#include "CExtPackManager.h"
-#include "CExtPack.h"
+# include "CConsole.h"
+# include "CUSBController.h"
+# include "CUSBDeviceFilters.h"
+# include "CUSBDevice.h"
+# include "CUSBDeviceFilter.h"
+# include "CHostUSBDevice.h"
+# include "CHostUSBDeviceFilter.h"
+# include "CExtPackManager.h"
+# include "CExtPack.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* VirtualBox interface declarations: */
+#ifndef VBOX_WITH_XPCOM
+# include "VirtualBox.h"
+#else /* !VBOX_WITH_XPCOM */
+# include "VirtualBox_XPCOM.h"
+#endif /* VBOX_WITH_XPCOM */
+
 
 /**
  *  USB popup menu class.
@@ -175,7 +187,6 @@ UIMachineSettingsUSB::UIMachineSettingsUSB()
                                             ":/usb_movedown_disabled_16px.png"));
 
     /* Prepare tool-bar: */
-    m_pFiltersToolBar->setUsesTextLabel(false);
     m_pFiltersToolBar->setIconSize(QSize(16, 16));
     m_pFiltersToolBar->setOrientation(Qt::Vertical);
     m_pFiltersToolBar->addAction(mNewAction);
@@ -227,7 +238,7 @@ UIMachineSettingsUSB::UIMachineSettingsUSB()
 #endif /* VBOX_WITH_EHCI */
 }
 
-bool UIMachineSettingsUSB::isOHCIEnabled() const
+bool UIMachineSettingsUSB::isUSBEnabled() const
 {
     return mGbUSB->isChecked();
 }
@@ -246,8 +257,11 @@ void UIMachineSettingsUSB::loadToCacheFrom(QVariant &data)
     UIDataSettingsMachineUSB usbData;
 
     /* Gather USB values: */
-    usbData.m_fUSBEnabled = m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI) > 0;
-    usbData.m_fEHCIEnabled = m_machine.GetUSBControllerCountByType(KUSBControllerType_EHCI) > 0;
+    usbData.m_fUSBEnabled = !m_machine.GetUSBControllers().isEmpty();
+    usbData.m_USBControllerType = m_machine.GetUSBControllerCountByType(KUSBControllerType_XHCI) > 0 ? KUSBControllerType_XHCI :
+                                  m_machine.GetUSBControllerCountByType(KUSBControllerType_EHCI) > 0 ? KUSBControllerType_EHCI :
+                                  m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI) > 0 ? KUSBControllerType_OHCI :
+                                  KUSBControllerType_Null;
 
     /* Check if controller is valid: */
     const CUSBDeviceFilters &filters = m_machine.GetUSBDeviceFilters();
@@ -300,7 +314,13 @@ void UIMachineSettingsUSB::getFromCache()
     const UIDataSettingsMachineUSB &usbData = m_cache.base();
     /* Load USB data to page: */
     mGbUSB->setChecked(usbData.m_fUSBEnabled);
-    mCbUSB2->setChecked(usbData.m_fEHCIEnabled);
+    switch (usbData.m_USBControllerType)
+    {
+        default:
+        case KUSBControllerType_OHCI: mRbUSB1->setChecked(true); break;
+        case KUSBControllerType_EHCI: mRbUSB2->setChecked(true); break;
+        case KUSBControllerType_XHCI: mRbUSB3->setChecked(true); break;
+    }
 
     /* For each USB filter => load it to the page: */
     for (int iFilterIndex = 0; iFilterIndex < m_cache.childCount(); ++iFilterIndex)
@@ -326,10 +346,20 @@ void UIMachineSettingsUSB::putToCache()
     /* Prepare USB data: */
     UIDataSettingsMachineUSB usbData = m_cache.base();
 
-    /* USB 1.0 (OHCI): */
+    /* Is USB controller enabled? */
     usbData.m_fUSBEnabled = mGbUSB->isChecked();
-    /* USB 2.0 (EHCI): */
-    usbData.m_fEHCIEnabled = mCbUSB2->isChecked();
+    /* Of which type? */
+    if (!usbData.m_fUSBEnabled)
+        usbData.m_USBControllerType = KUSBControllerType_Null;
+    else
+    {
+        if (mRbUSB1->isChecked())
+            usbData.m_USBControllerType = KUSBControllerType_OHCI;
+        else if (mRbUSB2->isChecked())
+            usbData.m_USBControllerType = KUSBControllerType_EHCI;
+        else if (mRbUSB3->isChecked())
+            usbData.m_USBControllerType = KUSBControllerType_XHCI;
+    }
 
     /* Update USB cache: */
     m_cache.cacheCurrentData(usbData);
@@ -360,16 +390,57 @@ void UIMachineSettingsUSB::saveFromCacheTo(QVariant &data)
             {
                 ULONG cOhciCtls = m_machine.GetUSBControllerCountByType(KUSBControllerType_OHCI);
                 ULONG cEhciCtls = m_machine.GetUSBControllerCountByType(KUSBControllerType_EHCI);
+                ULONG cXhciCtls = m_machine.GetUSBControllerCountByType(KUSBControllerType_XHCI);
 
-                if (!cOhciCtls && usbData.m_fUSBEnabled)
-                    m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
-                else if (cOhciCtls && !usbData.m_fUSBEnabled)
-                    m_machine.RemoveUSBController("OHCI");
-
-                if (!cEhciCtls && usbData.m_fEHCIEnabled)
-                    m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI);
-                else if (cEhciCtls && !usbData.m_fEHCIEnabled)
-                    m_machine.RemoveUSBController("EHCI");
+                /* Removing USB controllers: */
+                if (!usbData.m_fUSBEnabled)
+                {
+                    if (cXhciCtls)
+                        m_machine.RemoveUSBController("XHCI");
+                    if (cEhciCtls)
+                        m_machine.RemoveUSBController("EHCI");
+                    if (cOhciCtls)
+                        m_machine.RemoveUSBController("OHCI");
+                }
+                /* Creating/replacing USB controllers: */
+                else
+                {
+                    switch (usbData.m_USBControllerType)
+                    {
+                        case KUSBControllerType_OHCI:
+                        {
+                            if (cEhciCtls)
+                                m_machine.RemoveUSBController("EHCI");
+                            if (cXhciCtls)
+                                m_machine.RemoveUSBController("XHCI");
+                            if (!cOhciCtls)
+                                m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
+                            break;
+                        }
+                        case KUSBControllerType_EHCI:
+                        {
+                            if (cXhciCtls)
+                                m_machine.RemoveUSBController("XHCI");
+                            if (!cOhciCtls)
+                                m_machine.AddUSBController("OHCI", KUSBControllerType_OHCI);
+                            if (!cEhciCtls)
+                                m_machine.AddUSBController("EHCI", KUSBControllerType_EHCI);
+                            break;
+                        }
+                        case KUSBControllerType_XHCI:
+                        {
+                            if (cEhciCtls)
+                                m_machine.RemoveUSBController("EHCI");
+                            if (cOhciCtls)
+                                m_machine.RemoveUSBController("OHCI");
+                            if (!cXhciCtls)
+                                m_machine.AddUSBController("XHCI", KUSBControllerType_XHCI);
+                            break;
+                        }
+                        default:
+                            break;
+                    }
+                }
             }
             /* Store USB filters data: */
             if (isMachineInValidMode())
@@ -429,16 +500,18 @@ bool UIMachineSettingsUSB::validate(QList<UIValidationMessage> &messages)
     bool fPass = true;
 
 #ifdef VBOX_WITH_EXTPACK
-    /* USB 2.0 Extension Pack presence test: */
+    /* USB 2.0/3.0 Extension Pack presence test: */
     CExtPack extPack = vboxGlobal().virtualBox().GetExtensionPackManager().Find(GUI_ExtPackName);
-    if (mGbUSB->isChecked() && mCbUSB2->isChecked() && (extPack.isNull() || !extPack.GetUsable()))
+    if (   mGbUSB->isChecked()
+        && (mRbUSB2->isChecked() || mRbUSB3->isChecked())
+        && (extPack.isNull() || !extPack.GetUsable()))
     {
         /* Prepare message: */
         UIValidationMessage message;
-        message.second << tr("USB 2.0 is currently enabled for this virtual machine. "
-                             "However, this requires the <b>%1</b> to be installed. "
+        message.second << tr("USB 2.0/3.0 is currently enabled for this virtual machine. "
+                             "However, this requires the <i>%1</i> to be installed. "
                              "Please install the Extension Pack from the VirtualBox download site "
-                             "or disable USB 2.0 to be able to start the machine.")
+                             "or disable USB 2.0/3.0 to be able to start the machine.")
                              .arg(GUI_ExtPackName);
         /* Serialize message: */
         if (!message.second.isEmpty())
@@ -453,8 +526,10 @@ bool UIMachineSettingsUSB::validate(QList<UIValidationMessage> &messages)
 void UIMachineSettingsUSB::setOrderAfter (QWidget *aWidget)
 {
     setTabOrder (aWidget, mGbUSB);
-    setTabOrder (mGbUSB, mCbUSB2);
-    setTabOrder (mCbUSB2, mTwFilters);
+    setTabOrder (mGbUSB, mRbUSB1);
+    setTabOrder (mRbUSB1, mRbUSB2);
+    setTabOrder (mRbUSB2, mRbUSB3);
+    setTabOrder (mRbUSB3, mTwFilters);
 }
 
 void UIMachineSettingsUSB::retranslateUi()
@@ -501,7 +576,9 @@ void UIMachineSettingsUSB::usbAdapterToggled(bool fEnabled)
 {
     /* Enable/disable USB children: */
     mUSBChild->setEnabled(isMachineInValidMode() && fEnabled);
-    mCbUSB2->setEnabled(isMachineOffline() && fEnabled);
+    mRbUSB1->setEnabled(isMachineOffline() && fEnabled);
+    mRbUSB2->setEnabled(isMachineOffline() && fEnabled);
+    mRbUSB3->setEnabled(isMachineOffline() && fEnabled);
     if (fEnabled)
     {
         /* If there is no chosen item but there is something to choose => choose it: */
@@ -729,7 +806,9 @@ void UIMachineSettingsUSB::prepareValidation()
 {
     /* Prepare validation: */
     connect(mGbUSB, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
-    connect(mCbUSB2, SIGNAL(stateChanged(int)), this, SLOT(revalidate()));
+    connect(mRbUSB1, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
+    connect(mRbUSB2, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
+    connect(mRbUSB3, SIGNAL(toggled(bool)), this, SLOT(revalidate()));
 }
 
 void UIMachineSettingsUSB::addUSBFilter(const UIDataSettingsMachineUSBFilter &usbFilterData, bool fIsNew)
@@ -797,7 +876,9 @@ void UIMachineSettingsUSB::polishPage()
 {
     mGbUSB->setEnabled(isMachineOffline());
     mUSBChild->setEnabled(isMachineInValidMode() && mGbUSB->isChecked());
-    mCbUSB2->setEnabled(isMachineOffline() && mGbUSB->isChecked());
+    mRbUSB1->setEnabled(isMachineOffline() && mGbUSB->isChecked());
+    mRbUSB2->setEnabled(isMachineOffline() && mGbUSB->isChecked());
+    mRbUSB3->setEnabled(isMachineOffline() && mGbUSB->isChecked());
 }
 
 #include "UIMachineSettingsUSB.moc"
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
index 7328a60..b8c7c9c 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsUSB.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsUSB class declaration
+ * VBox Qt GUI - UIMachineSettingsUSB class declaration.
  */
 
 /*
@@ -87,19 +86,19 @@ struct UIDataSettingsMachineUSB
     /* Default constructor: */
     UIDataSettingsMachineUSB()
         : m_fUSBEnabled(false)
-        , m_fEHCIEnabled(false) {}
+        , m_USBControllerType(KUSBControllerType_Null) {}
     /* Functions: */
     bool equal(const UIDataSettingsMachineUSB &other) const
     {
         return (m_fUSBEnabled == other.m_fUSBEnabled) &&
-               (m_fEHCIEnabled == other.m_fEHCIEnabled);
+               (m_USBControllerType == other.m_USBControllerType);
     }
     /* Operators: */
     bool operator==(const UIDataSettingsMachineUSB &other) const { return equal(other); }
     bool operator!=(const UIDataSettingsMachineUSB &other) const { return !equal(other); }
     /* Variables: */
     bool m_fUSBEnabled;
-    bool m_fEHCIEnabled;
+    KUSBControllerType m_USBControllerType;
 };
 typedef UISettingsCachePool<UIDataSettingsMachineUSB, UICacheSettingsMachineUSBFilter> UICacheSettingsMachineUSB;
 
@@ -120,7 +119,7 @@ public:
 
     UIMachineSettingsUSB();
 
-    bool isOHCIEnabled() const;
+    bool isUSBEnabled() const;
 
 protected:
 
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.ui b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.ui
index 92c5aa6..6f12d2a 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.ui
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.ui
@@ -22,7 +22,7 @@
     <height>328</height>
    </rect>
   </property>
-  <layout class="QGridLayout" >
+  <layout class="QGridLayout" columnstretch="0,1,0">
    <item row="0" column="0" colspan="2" >
     <widget class="QCheckBox" name="mGbUSB" >
      <property name="whatsThis" >
@@ -47,14 +47,14 @@
      <property name="sizeHint" >
       <size>
        <width>20</width>
-       <height>20</height>
+       <height>0</height>
       </size>
      </property>
     </spacer>
    </item>
-   <item row="1" column="1" >
-    <widget class="QWidget" native="1" name="mUSBChild" >
-     <layout class="QGridLayout" >
+   <item row="1" column="1" colspan="2" >
+    <widget class="QWidget" name="mUSBChild" >
+     <layout class="QVBoxLayout" >
       <property name="leftMargin" >
        <number>0</number>
       </property>
@@ -67,17 +67,55 @@
       <property name="bottomMargin" >
        <number>0</number>
       </property>
-      <item row="0" column="0" >
-       <widget class="QCheckBox" name="mCbUSB2" >
-        <property name="whatsThis" >
-         <string>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</string>
-        </property>
-        <property name="text" >
-         <string>Enable USB 2.0 (E&HCI) Controller</string>
-        </property>
+      <item>
+       <widget class="QWidget" native="1" name="mRbContainer" >
+        <layout class="QVBoxLayout">
+         <property name="leftMargin" >
+          <number>0</number>
+         </property>
+         <property name="topMargin" >
+          <number>0</number>
+         </property>
+         <property name="rightMargin" >
+          <number>0</number>
+         </property>
+         <property name="bottomMargin" >
+          <number>0</number>
+         </property>
+         <item>
+          <widget class="QRadioButton" name="mRbUSB1">
+           <property name="whatsThis">
+            <string>When checked, enables the virtual USB OHCI controller of this machine. The USB OHCI controller provides USB 1.0 support.</string>
+           </property>
+           <property name="text">
+            <string>USB &1.1 (OHCI) Controller</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="mRbUSB2">
+           <property name="whatsThis">
+            <string>When checked, enables the virtual USB EHCI controller of this machine. The USB EHCI controller provides USB 2.0 support.</string>
+           </property>
+           <property name="text">
+            <string>USB &2.0 (EHCI) Controller</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QRadioButton" name="mRbUSB3">
+           <property name="whatsThis">
+            <string>When checked, enables the virtual USB xHCI controller of this machine. The USB xHCI controller provides USB 3.0 support.</string>
+           </property>
+           <property name="text">
+            <string>USB &3.0 (xHCI) Controller</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </widget>
       </item>
-      <item row="1" column="0" >
+      <item>
        <widget class="QILabelSeparator" name="mGbUSBFilters" >
         <property name="text" >
          <string>USB Device &Filters</string>
@@ -87,7 +125,7 @@
         </property>
        </widget>
       </item>
-      <item row="2" column="0" >
+      <item>
        <widget class="QWidget" native="1" name="mWtFilterHandler" >
         <layout class="QHBoxLayout" >
          <property name="leftMargin" >
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp
index dfb4cb7..c4cb2db 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIMachineSettingsUSBFilterDetails.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsUSBFilterDetails class implementation
+ * VBox Qt GUI - UIMachineSettingsUSBFilterDetails class implementation.
  */
 
 /*
@@ -17,9 +15,16 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIMachineSettingsUSBFilterDetails.h"
-#include "UIConverter.h"
+# include "UIMachineSettingsUSBFilterDetails.h"
+# include "UIConverter.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIMachineSettingsUSBFilterDetails::UIMachineSettingsUSBFilterDetails(QWidget *pParent /* = 0 */)
     : QIWithRetranslateUI2<QIDialog>(pParent, Qt::Sheet)
diff --git a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.h b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.h
index 8e1f481..0e7743e 100644
--- a/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.h
+++ b/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSBFilterDetails.h
@@ -1,7 +1,6 @@
+/* $Id: UIMachineSettingsUSBFilterDetails.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIMachineSettingsUSBFilterDetails class declaration
+ * VBox Qt GUI - UIMachineSettingsUSBFilterDetails class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
index c898772..baf642f 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIApplianceEditorWidget.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIApplianceEditorWidget class implementation
+ * VBox Qt GUI - UIApplianceEditorWidget class implementation.
  */
 
 /*
@@ -17,26 +15,33 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QItemDelegate>
-#include <QSortFilterProxyModel>
-#include <QHeaderView>
-#include <QLineEdit>
-#include <QTextEdit>
-#include <QSpinBox>
-#include <QComboBox>
-#include <QDir>
+# include <QItemDelegate>
+# include <QSortFilterProxyModel>
+# include <QHeaderView>
+# include <QLineEdit>
+# include <QTextEdit>
+# include <QSpinBox>
+# include <QComboBox>
+# include <QDir>
 
 /* GUI includes: */
-#include "UIApplianceEditorWidget.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "VBoxOSTypeSelectorButton.h"
-#include "UILineTextEdit.h"
-#include "UIConverter.h"
+# include "UIApplianceEditorWidget.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "VBoxOSTypeSelectorButton.h"
+# include "UILineTextEdit.h"
+# include "UIConverter.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // ModelItem
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h
index c5d9fe0..133552c 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h
@@ -1,7 +1,6 @@
+/* $Id: UIApplianceEditorWidget.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIApplianceEditorWidget class declaration
+ * VBox Qt GUI - UIApplianceEditorWidget class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp
index 30b6ec8..75a4dd2 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIApplianceExportEditorWidget.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIApplianceExportEditorWidget class implementation
+ * VBox Qt GUI - UIApplianceExportEditorWidget class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIApplianceExportEditorWidget.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
+# include "UIApplianceExportEditorWidget.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
 
 /* COM includes: */
-#include "CAppliance.h"
+# include "CAppliance.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // ExportSortProxyModel
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.h
index 951f127..2ac0173 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceExportEditorWidget.h
@@ -1,7 +1,6 @@
+/* $Id: UIApplianceExportEditorWidget.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIApplianceExportEditorWidget class declaration
+ * VBox Qt GUI - UIApplianceExportEditorWidget class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp
index 3a0a1cd..85ee7f8 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIApplianceImportEditorWidget.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIApplianceImportEditorWidget class implementation
+ * VBox Qt GUI - UIApplianceImportEditorWidget class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIApplianceImportEditorWidget.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
+# include "UIApplianceImportEditorWidget.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
 
 /* COM includes: */
-#include "CAppliance.h"
+# include "CAppliance.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // ImportSortProxyModel
@@ -66,7 +71,7 @@ bool UIApplianceImportEditorWidget::setFile(const QString& strFile)
             if (fResult)
             {
                 /* Show some progress, so the user know whats going on */
-                msgCenter().showModalProgressDialog(progress, tr("Reading Appliance ..."), ":/sf_32px.png", this);
+                msgCenter().showModalProgressDialog(progress, tr("Reading Appliance ..."), ":/progress_reading_appliance_90px.png", this);
                 if (!progress.isOk() || progress.GetResultCode() != 0)
                     fResult = false;
                 else
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.h
index 59c7777..5c5070e 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.h
@@ -1,7 +1,6 @@
+/* $Id: UIApplianceImportEditorWidget.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIApplianceImportEditorWidget class declaration
+ * VBox Qt GUI - UIApplianceImportEditorWidget class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIBar.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIBar.cpp
index 080f59b..fb9d1cf 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIBar.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIBar.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIBar.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIBar class implementation
+ * VBox Qt GUI - UIBar class implementation.
  */
 
 /*
@@ -17,16 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Local includes */
-#include "UIBar.h"
-#include "UIImageTools.h"
-#include "VBoxGlobal.h"
+# include "UIBar.h"
+# include "UIImageTools.h"
+# include "VBoxGlobal.h"
 
 /* Global includes */
-#include <QPaintEvent>
-#include <QPainter>
-#include <QVBoxLayout>
-#include <QPixmapCache>
+# include <QPaintEvent>
+# include <QPainter>
+# include <QVBoxLayout>
+# include <QPixmapCache>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIBar::UIBar(QWidget *pParent /* = 0 */)
   : QWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIBar.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIBar.h
index e9faa5a..259fd70 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIBar.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIBar.h
@@ -1,7 +1,6 @@
+/* $Id: UIBar.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIBar class declaration
+ * VBox Qt GUI - UIBar class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp
index d10156b..d7c7f36 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIBootTable.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIBootTable class implementation
+ * VBox Qt GUI - UIBootTable class implementation.
  */
 
 /*
@@ -17,12 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global include */
-#include <QScrollBar>
+# include <QScrollBar>
 
 /* Local includes */
-#include "UIBootTable.h"
-#include "UIConverter.h"
+# include "UIBootTable.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIBootTableItem::UIBootTableItem(KDeviceType type)
   : m_type(type)
@@ -30,26 +36,10 @@ UIBootTableItem::UIBootTableItem(KDeviceType type)
     setCheckState(Qt::Unchecked);
     switch(type)
     {
-        case KDeviceType_Floppy:
-        {
-            setIcon(QIcon(":fd_16px.png"));
-            break;
-        }
-        case KDeviceType_DVD:
-        {
-            setIcon(QIcon(":cd_16px.png"));
-            break;
-        }
-        case KDeviceType_HardDisk:
-        {
-            setIcon(QIcon(":hd_16px.png"));
-            break;
-        }
-        case KDeviceType_Network:
-        {
-            setIcon(QIcon(":nw_16px.png"));
-            break;
-        }
+        case KDeviceType_Floppy:   setIcon(UIIconPool::iconSet(":/fd_16px.png")); break;
+        case KDeviceType_DVD:      setIcon(UIIconPool::iconSet(":/cd_16px.png")); break;
+        case KDeviceType_HardDisk: setIcon(UIIconPool::iconSet(":/hd_16px.png")); break;
+        case KDeviceType_Network:  setIcon(UIIconPool::iconSet(":/nw_16px.png")); break;
     }
     retranslateUi();
 }
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.h
index f69012d..0a113ab 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIBootTable.h
@@ -1,7 +1,6 @@
+/* $Id: UIBootTable.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIBootTable class declaration
+ * VBox Qt GUI - UIBootTable class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.cpp
index ed85d17..4cec389 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIFilmContainer.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIFilmContainer class implementation
+ * VBox Qt GUI - UIFilmContainer class implementation.
  */
 
 /*
@@ -17,16 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QScrollArea>
-#include <QScrollBar>
-#include <QCheckBox>
-#include <QPainter>
+# include <QHBoxLayout>
+# include <QVBoxLayout>
+# include <QScrollArea>
+# include <QScrollBar>
+# include <QCheckBox>
+# include <QPainter>
 
 /* GUI includes: */
-#include "UIFilmContainer.h"
+# include "UIFilmContainer.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIFilmContainer::UIFilmContainer(QWidget *pParent /* = 0*/)
     : QWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.h
index 1dacf9f..ecbb623 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.h
@@ -1,7 +1,6 @@
+/* $Id: UIFilmContainer.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIFilmContainer class declaration
+ * VBox Qt GUI - UIFilmContainer class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp
index f324a35..8dd86c2 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIHostComboEditor.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: UIHostComboEditor class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: UIHostComboEditor class implementation.
  */
 
 /*
@@ -17,18 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QStyleOption>
-#include <QStylePainter>
-#include <QKeyEvent>
-#include <QTimer>
+# include <QApplication>
+# include <QStyleOption>
+# include <QStylePainter>
+# include <QKeyEvent>
+# include <QTimer>
 
 /* GUI includes: */
-#include "UIHostComboEditor.h"
-#include "VBoxGlobal.h"
-#include "QIToolButton.h"
-#include "UIIconPool.h"
+# include "UIHostComboEditor.h"
+# include "UIExtraDataDefs.h"
+# include "UIIconPool.h"
+# include "QIToolButton.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 #ifdef Q_WS_WIN
 # undef LOWORD
@@ -60,6 +65,9 @@
 # include <Carbon/Carbon.h>
 #endif /* Q_WS_MAC */
 
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+
 
 #ifdef Q_WS_X11
 namespace UINativeHotKey
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h
index 9813afc..465cc43 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.h
@@ -1,7 +1,6 @@
+/* $Id: UIHostComboEditor.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: UIHostComboEditor class declaration
+ * VBox Qt GUI - VirtualBox Qt extensions: UIHostComboEditor class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.cpp
index 883d738..f4e96a7 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIHotKeyEditor.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: UIHotKeyEditor class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: UIHotKeyEditor class implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QHBoxLayout>
-#include <QLineEdit>
-#include <QKeyEvent>
+# include <QApplication>
+# include <QHBoxLayout>
+# include <QLineEdit>
+# include <QKeyEvent>
 
 /* GUI includes; */
-#include "UIHotKeyEditor.h"
-#include "UIIconPool.h"
-#include "UIHostComboEditor.h"
-#include "QIToolButton.h"
+# include "UIHotKeyEditor.h"
+# include "UIIconPool.h"
+# include "UIHostComboEditor.h"
+# include "QIToolButton.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* A line-edit representing hot-key editor: */
 class UIHotKeyLineEdit : public QLineEdit
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.h
index 88a8e45..d16230e 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.h
@@ -1,7 +1,6 @@
+/* $Id: UIHotKeyEditor.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: UIHotKeyEditor class declaration
+ * VBox Qt GUI - VirtualBox Qt extensions: UIHotKeyEditor class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.cpp
index bc1bb53..35df22a 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.cpp
@@ -1,8 +1,6 @@
 /* $Id: UILineTextEdit.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UILineTextEdit class definitions
+ * VBox Qt GUI - UILineTextEdit class definitions.
  */
 
 /*
@@ -17,18 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* VBox includes */
-#include "VBoxGlobal.h"
-#include "UILineTextEdit.h"
-#include "QIFileDialog.h"
+# include "VBoxGlobal.h"
+# include "UILineTextEdit.h"
+# include "QIFileDialog.h"
 
 /* Qt includes */
-#include <QDialogButtonBox>
-#include <QFile>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QTextEdit>
-#include <QTextStream>
+# include <QDialogButtonBox>
+# include <QFile>
+# include <QLineEdit>
+# include <QPushButton>
+# include <QTextEdit>
+# include <QTextStream>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // UITextEditor
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.h b/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.h
index eac628f..cfe2c36 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UILineTextEdit.h
@@ -1,7 +1,6 @@
+/* $Id: UILineTextEdit.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UILineTextEdit class declaration
+ * VBox Qt GUI - UILineTextEdit class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIMenuBar.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIMenuBar.cpp
new file mode 100644
index 0000000..ae313dc
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIMenuBar.cpp
@@ -0,0 +1,62 @@
+/* $Id: UIMenuBar.cpp $ */
+/** @file
+ * VBox Qt GUI - UIMenuBar class implementation.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QPainter>
+# include <QPaintEvent>
+# include <QPixmapCache>
+
+/* GUI includes: */
+# include "UIMenuBar.h"
+# include "UIImageTools.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+
+UIMenuBar::UIMenuBar(QWidget *pParent /* = 0 */)
+    : QMenuBar(pParent)
+    , m_fShowBetaLabel(false)
+{
+    /* Check for beta versions: */
+    if (vboxGlobal().isBeta())
+        m_fShowBetaLabel = true;
+}
+
+void UIMenuBar::paintEvent(QPaintEvent *pEvent)
+{
+    QMenuBar::paintEvent(pEvent);
+    if (m_fShowBetaLabel)
+    {
+        QPixmap betaLabel;
+        const QString key("vbox:betaLabel");
+        if (!QPixmapCache::find(key, betaLabel))
+        {
+            betaLabel = ::betaLabel();
+            QPixmapCache::insert(key, betaLabel);
+        }
+        QSize s = size();
+        QPainter painter(this);
+        painter.setClipRect(pEvent->rect());
+        painter.drawPixmap(s.width() - betaLabel.width() - 10, (height() - betaLabel.height()) / 2, betaLabel);
+    }
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIMenuBar.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIMenuBar.h
new file mode 100644
index 0000000..f2ab95b
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIMenuBar.h
@@ -0,0 +1,46 @@
+/* $Id: UIMenuBar.h $ */
+/** @file
+ * VBox Qt GUI - UIMenuBar class declaration.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIMenuBar_h___
+#define ___UIMenuBar_h___
+
+/* Qt includes: */
+#include <QMenuBar>
+
+/** QMenuBar extension
+  * which reflects BETA label when necessary. */
+class UIMenuBar: public QMenuBar
+{
+    Q_OBJECT;
+
+public:
+
+    /** Constructor, passes @a pParent to the QMenuBar constructor. */
+    UIMenuBar(QWidget *pParent = 0);
+
+protected:
+
+    /** Paint event handler. */
+    void paintEvent(QPaintEvent *pEvent);
+
+private:
+
+    /** Reflects whether we should show BETA label or not. */
+    bool m_fShowBetaLabel;
+};
+
+#endif /* !___UIMenuBar_h___ */
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
index e008476..93cf82e 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp
@@ -1,9 +1,6 @@
 /* $Id: UIMiniToolBar.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMiniToolBar class implementation.
- * This is the toolbar shown in fullscreen/seamless modes.
+ * VBox Qt GUI - UIMiniToolBar class implementation (fullscreen/seamless).
  */
 
 /*
@@ -18,26 +15,35 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QApplication>
-#include <QTimer>
-#include <QMdiArea>
-#include <QMdiSubWindow>
-#include <QDesktopWidget>
-#include <QLabel>
-#include <QMenu>
-#include <QToolButton>
-#include <QStateMachine>
-#include <QPainter>
+# include <QApplication>
+# include <QTimer>
+# include <QMdiArea>
+# include <QMdiSubWindow>
+# include <QDesktopWidget>
+# include <QLabel>
+# include <QMenu>
+# include <QToolButton>
+# include <QStateMachine>
+# include <QPainter>
+# ifdef Q_WS_X11
+#  include <QX11Info>
+# endif /* Q_WS_X11 */
 
 /* GUI includes: */
-#include "UIMiniToolBar.h"
-#include "UIAnimationFramework.h"
-#include "UIIconPool.h"
-#include "VBoxGlobal.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-#endif /* Q_WS_MAC */
+# include "UIMiniToolBar.h"
+# include "UIAnimationFramework.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
+# ifdef Q_WS_MAC
+#  include "VBoxUtils-darwin.h"
+# endif /* Q_WS_MAC */
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 
 UIRuntimeMiniToolBar::UIRuntimeMiniToolBar(QWidget *pParent,
@@ -45,13 +51,11 @@ UIRuntimeMiniToolBar::UIRuntimeMiniToolBar(QWidget *pParent,
                                            Qt::Alignment alignment,
                                            bool fAutoHide /* = true */)
     : QWidget(pParent,
-#if   defined (Q_WS_WIN)
+#if   defined(Q_WS_WIN)
               Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint
-#elif defined (Q_WS_MAC)
+#elif defined(Q_WS_MAC) || defined(Q_WS_X11)
               Qt::Window | Qt::FramelessWindowHint
-#elif defined (Q_WS_X11)
-              Qt::Widget
-#endif /* RT_OS_DARWIN */
+#endif /* Q_WS_MAC || Q_WS_X11 */
               )
     /* Variables: General stuff: */
     , m_geometryType(geometryType)
@@ -79,6 +83,9 @@ UIRuntimeMiniToolBar::~UIRuntimeMiniToolBar()
 
 void UIRuntimeMiniToolBar::setAlignment(Qt::Alignment alignment)
 {
+    /* Make sure toolbar created: */
+    AssertPtrReturnVoid(m_pToolbar);
+
     /* Make sure alignment really changed: */
     if (m_alignment == alignment)
         return;
@@ -95,6 +102,9 @@ void UIRuntimeMiniToolBar::setAlignment(Qt::Alignment alignment)
 
 void UIRuntimeMiniToolBar::setAutoHide(bool fAutoHide, bool fPropagateToChild /* = true */)
 {
+    /* Make sure toolbar created: */
+    AssertPtrReturnVoid(m_pToolbar);
+
     /* Make sure auto-hide really changed: */
     if (m_fAutoHide == fAutoHide)
         return;
@@ -112,18 +122,25 @@ void UIRuntimeMiniToolBar::setAutoHide(bool fAutoHide, bool fPropagateToChild /*
 
 void UIRuntimeMiniToolBar::setText(const QString &strText)
 {
+    /* Make sure toolbar created: */
+    AssertPtrReturnVoid(m_pToolbar);
+
     /* Propagate to child: */
     m_pToolbar->setText(strText);
 }
 
 void UIRuntimeMiniToolBar::addMenus(const QList<QMenu*> &menus)
 {
+    /* Make sure toolbar created: */
+    AssertPtrReturnVoid(m_pToolbar);
+
     /* Propagate to child: */
     m_pToolbar->addMenus(menus);
 }
 
 void UIRuntimeMiniToolBar::adjustGeometry(int iHostScreen /* = -1 */)
 {
+#ifndef Q_WS_X11
     /* This method could be called before parent-widget
      * become visible, we should skip everything in that case: */
     if (QApplication::desktop()->screenNumber(parentWidget()) == -1)
@@ -147,11 +164,6 @@ void UIRuntimeMiniToolBar::adjustGeometry(int iHostScreen /* = -1 */)
         case GeometryType_Full:      screenRect = QApplication::desktop()->screenGeometry(iHostScreen); break;
         default: break;
     }
-#ifdef Q_WS_X11
-    /* Disregard origin under X11,
-     * because this is widget, not window: */
-    screenRect.moveTopLeft(QPoint(0, 0));
-#endif /* Q_WS_X11 */
     iX = screenRect.x() + screenRect.width() / 2 - width() / 2;
     switch (m_alignment)
     {
@@ -162,10 +174,91 @@ void UIRuntimeMiniToolBar::adjustGeometry(int iHostScreen /* = -1 */)
     move(iX, iY);
 
     /* Recalculate auto-hide animation: */
-    updateAutoHideAnimationBounds();
+    m_shownToolbarPosition = m_pEmbeddedToolbar->pos();
+    switch (m_alignment)
+    {
+        case Qt::AlignTop:
+            m_hiddenToolbarPosition = m_shownToolbarPosition - QPoint(0, m_pEmbeddedToolbar->height() - 3);
+            break;
+        case Qt::AlignBottom:
+            m_hiddenToolbarPosition = m_shownToolbarPosition + QPoint(0, m_pEmbeddedToolbar->height() - 3);
+            break;
+    }
+    m_pAnimation->update();
+
+    /* Update toolbar geometry if necessary: */
+    const QString strAnimationState = property("AnimationState").toString();
+    if (strAnimationState == "Start")
+        m_pEmbeddedToolbar->move(m_hiddenToolbarPosition);
+    else if (strAnimationState == "Final")
+        m_pEmbeddedToolbar->move(m_shownToolbarPosition);
 
     /* Simulate toolbar auto-hiding: */
     simulateToolbarAutoHiding();
+
+#else /* Q_WS_X11 */
+
+    /* This method could be called before parent-widget
+     * become visible, we should skip everything in that case: */
+    if (QApplication::desktop()->screenNumber(parentWidget()) == -1)
+        return;
+
+    /* Determine host-screen number if necessary: */
+    bool fMoveToHostScreen = true;
+    if (iHostScreen == -1)
+    {
+        fMoveToHostScreen = false;
+        iHostScreen = QApplication::desktop()->screenNumber(this);
+    }
+
+    /* Choose window geometry: */
+    QRect screenRect;
+    switch (m_geometryType)
+    {
+        case GeometryType_Available: screenRect = QApplication::desktop()->availableGeometry(iHostScreen); break;
+        case GeometryType_Full:      screenRect = QApplication::desktop()->screenGeometry(iHostScreen); break;
+        default: break;
+    }
+
+    /* Move to corresponding host-screen: */
+    if (fMoveToHostScreen)
+        move(screenRect.topLeft());
+
+    /* Resize embedded-toolbar to minimum size: */
+    m_pEmbeddedToolbar->resize(m_pEmbeddedToolbar->sizeHint());
+
+    /* Calculate embedded-toolbar position: */
+    int iX = 0, iY = 0;
+    iX = screenRect.width() / 2 - m_pEmbeddedToolbar->width() / 2;
+    switch (m_alignment)
+    {
+        case Qt::AlignTop:    iY = 0; break;
+        case Qt::AlignBottom: iY = screenRect.height() - m_pEmbeddedToolbar->height(); break;
+        default: break;
+    }
+
+    /* Update auto-hide animation: */
+    m_shownToolbarPosition = QPoint(iX, iY);
+    switch (m_alignment)
+    {
+        case Qt::AlignTop:    m_hiddenToolbarPosition = m_shownToolbarPosition - QPoint(0, m_pEmbeddedToolbar->height() - 3); break;
+        case Qt::AlignBottom: m_hiddenToolbarPosition = m_shownToolbarPosition + QPoint(0, m_pEmbeddedToolbar->height() - 3); break;
+    }
+    m_pAnimation->update();
+
+    /* Update embedded-toolbar geometry if known: */
+    const QString strAnimationState = property("AnimationState").toString();
+    if (strAnimationState == "Start")
+        m_pEmbeddedToolbar->move(m_hiddenToolbarPosition);
+    else if (strAnimationState == "Final")
+        m_pEmbeddedToolbar->move(m_shownToolbarPosition);
+
+    /* Adjust window mask: */
+    setMask(m_pEmbeddedToolbar->geometry());
+
+    /* Simulate toolbar auto-hiding: */
+    simulateToolbarAutoHiding();
+#endif /* Q_WS_X11 */
 }
 
 void UIRuntimeMiniToolBar::sltHandleToolbarResize()
@@ -202,10 +295,10 @@ void UIRuntimeMiniToolBar::sltHoverLeave()
 
 void UIRuntimeMiniToolBar::prepare()
 {
-#ifdef RT_OS_DARWIN
+#if defined(Q_WS_MAC) || defined (Q_WS_X11)
     /* Install own event filter: */
     installEventFilter(this);
-#endif /* RT_OS_DARWIN */
+#endif /* Q_WS_MAC || Q_WS_X11 */
 
 #if defined(Q_WS_MAC) || defined(Q_WS_WIN)
     /* Make sure we have no background
@@ -223,7 +316,11 @@ void UIRuntimeMiniToolBar::prepare()
      * - Under x11 host Qt has broken XComposite support (black background): */
     setAttribute(Qt::WA_TranslucentBackground);
 # endif /* Q_WS_WIN */
-#endif /* Q_WS_MAC || Q_WS_WIN */
+#elif defined(Q_WS_X11)
+    /* Use Qt API to enable translucency if allowed: */
+    if (QX11Info::isCompositingManagerRunning())
+        setAttribute(Qt::WA_TranslucentBackground);
+#endif /* Q_WS_X11 */
 
     /* Make sure we have no focus: */
     setFocusPolicy(Qt::NoFocus);
@@ -232,7 +329,7 @@ void UIRuntimeMiniToolBar::prepare()
     m_pMdiArea = new QMdiArea;
     {
         /* Allow any MDI area size: */
-        m_pMdiArea->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
+        m_pMdiArea->setMinimumSize(QSize(1, 1));
         /* Configure own background: */
         QPalette pal = m_pMdiArea->palette();
         pal.setColor(QPalette::Window, QColor(Qt::transparent));
@@ -272,7 +369,10 @@ void UIRuntimeMiniToolBar::prepare()
         m_pEmbeddedToolbar = m_pMdiArea->addSubWindow(m_pToolbar, Qt::Window | Qt::FramelessWindowHint);
         /* Make sure we have no focus: */
         m_pEmbeddedToolbar->setFocusPolicy(Qt::NoFocus);
+#ifdef Q_WS_WIN
+        /* Install embedded-toolbar event filter: */
         m_pEmbeddedToolbar->installEventFilter(this);
+#endif /* Q_WS_WIN */
     }
 
     /* Prepare hover-enter/leave timers: */
@@ -303,9 +403,9 @@ void UIRuntimeMiniToolBar::prepare()
 void UIRuntimeMiniToolBar::cleanup()
 {
     /* Stop hover-enter/leave timers: */
-    if (m_pHoverEnterTimer->isActive())
+    if (m_pHoverEnterTimer && m_pHoverEnterTimer->isActive())
         m_pHoverEnterTimer->stop();
-    if (m_pHoverLeaveTimer->isActive())
+    if (m_pHoverLeaveTimer && m_pHoverLeaveTimer->isActive())
         m_pHoverLeaveTimer->stop();
 
     /* Destroy animation before mdi-toolbar: */
@@ -320,28 +420,36 @@ void UIRuntimeMiniToolBar::cleanup()
 void UIRuntimeMiniToolBar::enterEvent(QEvent*)
 {
     /* Stop the hover-leave timer if necessary: */
-    if (m_pHoverLeaveTimer->isActive())
+    if (m_pHoverLeaveTimer && m_pHoverLeaveTimer->isActive())
         m_pHoverLeaveTimer->stop();
 
     /* Start the hover-enter timer: */
-    if (m_fAutoHide)
+    if (m_fAutoHide && m_pHoverEnterTimer)
         m_pHoverEnterTimer->start();
 }
 
 void UIRuntimeMiniToolBar::leaveEvent(QEvent*)
 {
     /* Stop the hover-enter timer if necessary: */
-    if (m_pHoverEnterTimer->isActive())
+    if (m_pHoverEnterTimer && m_pHoverEnterTimer->isActive())
         m_pHoverEnterTimer->stop();
 
     /* Start the hover-leave timer: */
-    if (m_fAutoHide)
+    if (m_fAutoHide && m_pHoverLeaveTimer)
         m_pHoverLeaveTimer->start();
 }
 
+#ifdef Q_WS_X11
+void UIRuntimeMiniToolBar::resizeEvent(QResizeEvent*)
+{
+    /* Adjust mini-toolbar on resize: */
+    adjustGeometry();
+}
+#endif /* Q_WS_X11 */
+
 bool UIRuntimeMiniToolBar::eventFilter(QObject *pWatched, QEvent *pEvent)
 {
-#ifndef RT_OS_DARWIN
+#if   defined(Q_WS_WIN)
     /* Due to Qt bug QMdiArea can
      * 1. steal focus from current application focus-widget
      * 3. and even request focus stealing if QMdiArea hidden yet.
@@ -349,33 +457,17 @@ bool UIRuntimeMiniToolBar::eventFilter(QObject *pWatched, QEvent *pEvent)
     if (pWatched && m_pEmbeddedToolbar && pWatched == m_pEmbeddedToolbar &&
         pEvent->type() == QEvent::FocusIn)
         emit sigNotifyAboutFocusStolen();
-#else /* RT_OS_DARWIN */
-    /* Due to Qt bug on Mac OS X window will be activated
-     * even if has Qt::WA_ShowWithoutActivating attribute. */
+#elif defined(Q_WS_MAC) || defined(Q_WS_X11)
+    /* Detect if we have window activation stolen. */
     if (pWatched == this &&
         pEvent->type() == QEvent::WindowActivate)
         emit sigNotifyAboutFocusStolen();
-#endif /* RT_OS_DARWIN */
+#endif /* Q_WS_MAC || Q_WS_X11 */
+
     /* Call to base-class: */
     return QWidget::eventFilter(pWatched, pEvent);
 }
 
-void UIRuntimeMiniToolBar::updateAutoHideAnimationBounds()
-{
-    /* Update animation: */
-    m_shownToolbarPosition = m_pEmbeddedToolbar->pos();
-    switch (m_alignment)
-    {
-        case Qt::AlignTop:
-            m_hiddenToolbarPosition = m_shownToolbarPosition - QPoint(0, m_pEmbeddedToolbar->height() - 3);
-            break;
-        case Qt::AlignBottom:
-            m_hiddenToolbarPosition = m_shownToolbarPosition + QPoint(0, m_pEmbeddedToolbar->height() - 3);
-            break;
-    }
-    m_pAnimation->update();
-}
-
 void UIRuntimeMiniToolBar::simulateToolbarAutoHiding()
 {
     /* This simulation helps user to notice
@@ -397,17 +489,8 @@ void UIRuntimeMiniToolBar::setToolbarPosition(QPoint point)
     m_pEmbeddedToolbar->move(point);
 
 #ifdef Q_WS_X11
-    /* The setMask functionality is excessive under Win/Mac hosts
-     * because there is a Qt composition works properly,
-     * Mac host has native translucency support,
-     * Win host allows to enable it through Qt::WA_TranslucentBackground: */
+    /* Update window mask: */
     setMask(m_pEmbeddedToolbar->geometry());
-
-# ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
-    /* Notify listeners as well: */
-    const QRect windowGeo = geometry();
-    emit sigNotifyAboutGeometryChange(windowGeo.intersected(m_pEmbeddedToolbar->geometry().translated(windowGeo.topLeft())));
-# endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
 #endif /* Q_WS_X11 */
 }
 
@@ -565,7 +648,12 @@ void UIMiniToolBar::prepare()
     setIconSize(QSize(16, 16));
 
     /* Left margin: */
+#ifdef Q_WS_X11
+    if (QX11Info::isCompositingManagerRunning())
+        m_spacings << widgetForAction(addWidget(new QWidget));
+#else /* !Q_WS_X11 */
     m_spacings << widgetForAction(addWidget(new QWidget));
+#endif /* !Q_WS_X11 */
 
     /* Prepare push-pin: */
     m_pAutoHideAction = new QAction(this);
@@ -617,7 +705,12 @@ void UIMiniToolBar::prepare()
     addAction(m_pCloseAction);
 
     /* Right margin: */
+#ifdef Q_WS_X11
+    if (QX11Info::isCompositingManagerRunning())
+        m_spacings << widgetForAction(addWidget(new QWidget));
+#else /* !Q_WS_X11 */
     m_spacings << widgetForAction(addWidget(new QWidget));
+#endif /* !Q_WS_X11 */
 
     /* Resize to sizehint: */
     resize(sizeHint());
@@ -625,6 +718,11 @@ void UIMiniToolBar::prepare()
 
 void UIMiniToolBar::rebuildShape()
 {
+#ifdef Q_WS_X11
+    if (!QX11Info::isCompositingManagerRunning())
+        return;
+#endif /* Q_WS_X11 */
+
     /* Rebuild shape: */
     QPainterPath shape;
     switch (m_alignment)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
index 1bfa0bb..6e1e885 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.h
@@ -1,8 +1,6 @@
+/* $Id: UIMiniToolBar.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIMiniToolBar class declaration.
- * This is the toolbar shown in fullscreen/seamless modes.
+ * VBox Qt GUI - UIMiniToolBar class declaration (fullscreen/seamless).
  */
 
 /*
@@ -66,13 +64,6 @@ signals:
     /** Notifies listeners about we stole focus. */
     void sigNotifyAboutFocusStolen();
 
-#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
-# ifdef Q_WS_X11
-    /** Notifies about geometry change. */
-    void sigNotifyAboutGeometryChange(const QRect &geo);
-# endif /* Q_WS_X11 */
-#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
-
 public:
 
     /* Constructor/destructor: */
@@ -121,12 +112,16 @@ private:
     void enterEvent(QEvent *pEvent);
     void leaveEvent(QEvent *pEvent);
 
+#ifdef Q_WS_X11
+    /** X11: Resize event handler. */
+    void resizeEvent(QResizeEvent *pEvent);
+#endif /* Q_WS_X11 */
+
     /** Filters @a pEvent if <i>this</i> object has been
       * installed as an event-filter for the @a pWatched. */
     bool eventFilter(QObject *pWatched, QEvent *pEvent);
 
     /* Helper: Hover stuff: */
-    void updateAutoHideAnimationBounds();
     void simulateToolbarAutoHiding();
 
     /* Property: Hover stuff: */
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
index 1735d1f..3efc432 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
@@ -1,8 +1,6 @@
 /* $Id: UINameAndSystemEditor.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINameAndSystemEditor class implementation
+ * VBox Qt GUI - UINameAndSystemEditor class implementation.
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QGridLayout>
-#include <QVBoxLayout>
-#include <QLabel>
-#include <QLineEdit>
-#include <QComboBox>
+# include <QGridLayout>
+# include <QVBoxLayout>
+# include <QLabel>
+# include <QLineEdit>
+# include <QComboBox>
 
 /* Local includes: */
-#include "UINameAndSystemEditor.h"
+# include "UINameAndSystemEditor.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 enum
 {
@@ -156,7 +161,7 @@ CGuestOSType UINameAndSystemEditor::type() const
 
 void UINameAndSystemEditor::retranslateUi()
 {
-    m_pNameLabel->setText(tr("&Name:"));
+    m_pNameLabel->setText(tr("N&ame:"));
     m_pNameEditor->setWhatsThis(tr("Holds the name of the virtual machine."));
     m_pFamilyLabel->setText(tr("&Type:"));
     m_pFamilyCombo->setWhatsThis(tr("Selects the operating system family that "
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h b/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
index 6a698c0..02127d8 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
@@ -1,7 +1,6 @@
+/* $Id: UINameAndSystemEditor.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UINameAndSystemEditor class declaration
+ * VBox Qt GUI - UINameAndSystemEditor class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.cpp
index b6b11a4..6185383 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIPopupBox.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupBox/UIPopupBoxGroup classes implementation
+ * VBox Qt GUI - UIPopupBox/UIPopupBoxGroup classes implementation.
  */
 
 /*
@@ -17,17 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 /* Global includes: */
-#include <QLabel>
-#include <QPaintEvent>
-#include <QPainter>
-#include <QVBoxLayout>
+# include <QLabel>
+# include <QPaintEvent>
+# include <QPainter>
+# include <QVBoxLayout>
 
 /* Local includes: */
-#include "UIPopupBox.h"
-#ifdef Q_WS_MAC
-# include "UIImageTools.h"
-#endif /* Q_WS_MAC */
+# include "UIPopupBox.h"
+# ifdef Q_WS_MAC
+#  include "UIImageTools.h"
+# endif
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 UIPopupBox::UIPopupBox(QWidget *pParent)
   : QWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.h
index db0f013..00285d4 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupBox.h
@@ -1,7 +1,6 @@
+/* $Id: UIPopupBox.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupBox/UIPopupBoxGroup classes declaration
+ * VBox Qt GUI - UIPopupBox/UIPopupBoxGroup classes declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp
index 571fd2b..32fcacc 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIPopupPane.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupPane class implementation
+ * VBox Qt GUI - UIPopupPane class implementation.
  */
 
 /*
@@ -17,15 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 /* Qt includes: */
-#include <QPainter>
+# include <QPainter>
 
 /* GUI includes: */
-#include "UIPopupPane.h"
-#include "UIPopupPaneTextPane.h"
-#include "UIPopupPaneButtonPane.h"
-#include "UIAnimationFramework.h"
-#include "QIMessageBox.h"
+# include "UIPopupPane.h"
+# include "UIPopupPaneTextPane.h"
+# include "UIPopupPaneButtonPane.h"
+# include "UIAnimationFramework.h"
+# include "QIMessageBox.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIPopupPane::UIPopupPane(QWidget *pParent,
                          const QString &strMessage, const QString &strDetails,
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h
index b538fb9..a431f7e 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h
@@ -1,7 +1,6 @@
+/* $Id: UIPopupPane.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupPane class declaration
+ * VBox Qt GUI - UIPopupPane class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.cpp
index c23bfe2..ba375e6 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIPopupPaneButtonPane.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupPaneButtonPane class implementation
+ * VBox Qt GUI - UIPopupPaneButtonPane class implementation.
  */
 
 /*
@@ -17,17 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 /* Qt includes: */
-#include <QApplication>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QKeyEvent>
+# include <QApplication>
+# include <QHBoxLayout>
+# include <QVBoxLayout>
+# include <QKeyEvent>
 
 /* GUI includes: */
-#include "UIPopupPaneButtonPane.h"
-#include "UIIconPool.h"
-#include "QIToolButton.h"
-#include "QIMessageBox.h"
+# include "UIPopupPaneButtonPane.h"
+# include "UIIconPool.h"
+# include "QIToolButton.h"
+# include "QIMessageBox.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIPopupPaneButtonPane::UIPopupPaneButtonPane(QWidget *pParent /* = 0*/)
     : QWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.h
index b89fa23..2ca5859 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneButtonPane.h
@@ -1,7 +1,6 @@
+/* $Id: UIPopupPaneButtonPane.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupPaneButtonPane class declaration
+ * VBox Qt GUI - UIPopupPaneButtonPane class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneTextPane.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneTextPane.cpp
index a412c4a..7b7ec80 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneTextPane.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneTextPane.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIPopupPaneTextPane.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupPaneTextPane class implementation
+ * VBox Qt GUI - UIPopupPaneTextPane class implementation.
  */
 
 /*
@@ -17,13 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 /* Qt includes: */
-#include <QLabel>
-#include <QCheckBox>
+# include <QLabel>
+# include <QCheckBox>
 
 /* GUI includes: */
-#include "UIPopupPaneTextPane.h"
-#include "UIAnimationFramework.h"
+# include "UIPopupPaneTextPane.h"
+# include "UIAnimationFramework.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIPopupPaneTextPane::UIPopupPaneTextPane(QWidget *pParent, const QString &strText, bool fFocused)
     : QWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneTextPane.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneTextPane.h
index 4f234ec..61810c9 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneTextPane.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPaneTextPane.h
@@ -1,7 +1,6 @@
+/* $Id: UIPopupPaneTextPane.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupPaneTextPane class declaration
+ * VBox Qt GUI - UIPopupPaneTextPane class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
index a075451..6e69842 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIPopupStack.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupStack class implementation
+ * VBox Qt GUI - UIPopupStack class implementation.
  */
 
 /*
@@ -17,17 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QScrollArea>
-#include <QEvent>
-#include <QMainWindow>
-#include <QMenuBar>
-#include <QStatusBar>
+# include <QVBoxLayout>
+# include <QScrollArea>
+# include <QEvent>
+# include <QMainWindow>
+# include <QMenuBar>
+# include <QStatusBar>
 
 /* GUI includes: */
-#include "UIPopupStack.h"
-#include "UIPopupStackViewport.h"
+# include "UIPopupStack.h"
+# include "UIPopupStackViewport.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIPopupStack::UIPopupStack(const QString &strID, UIPopupStackOrientation orientation)
     : m_strID(strID)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h
index e4635c1..49e985f 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h
@@ -1,7 +1,6 @@
+/* $Id: UIPopupStack.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupStack class declaration
+ * VBox Qt GUI - UIPopupStack class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStackViewport.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStackViewport.cpp
index ba917d4..9cc23a1 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStackViewport.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStackViewport.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIPopupStackViewport.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupStackViewport class implementation
+ * VBox Qt GUI - UIPopupStackViewport class implementation.
  */
 
 /*
@@ -17,12 +15,18 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 /* GUI includes: */
-#include "UIPopupStackViewport.h"
-#include "UIPopupPane.h"
+# include "UIPopupStackViewport.h"
+# include "UIPopupPane.h"
 
 /* Other VBox includes: */
-#include <VBox/sup.h>
+# include <VBox/sup.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIPopupStackViewport::UIPopupStackViewport()
     : m_iLayoutMargin(1)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStackViewport.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStackViewport.h
index a472a14..c5d0ba4 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStackViewport.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStackViewport.h
@@ -1,7 +1,6 @@
+/* $Id: UIPopupStackViewport.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIPopupStackViewport class declaration
+ * VBox Qt GUI - UIPopupStackViewport class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
index a89204a..5c9feb1 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIPortForwardingTable.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIPortForwardingTable class implementation
+ * VBox Qt GUI - UIPortForwardingTable class implementation.
  */
 
 /*
@@ -17,31 +15,40 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHBoxLayout>
-#include <QMenu>
-#include <QAction>
-#include <QHeaderView>
-#include <QStyledItemDelegate>
-#include <QItemEditorFactory>
-#include <QComboBox>
-#include <QLineEdit>
-#include <QSpinBox>
+# include <QHBoxLayout>
+# include <QMenu>
+# include <QAction>
+# include <QHeaderView>
+# include <QStyledItemDelegate>
+# include <QItemEditorFactory>
+# include <QComboBox>
+# include <QLineEdit>
+# include <QSpinBox>
+# include <QHostAddress>
 
 /* GUI includes: */
-#include "UIPortForwardingTable.h"
-#include "UIMessageCenter.h"
-#include "UIConverter.h"
-#include "UIIconPool.h"
-#include "UIToolBar.h"
-#include "QITableView.h"
+# include "UIPortForwardingTable.h"
+# include "UIMessageCenter.h"
+# include "UIConverter.h"
+# include "UIIconPool.h"
+# include "UIToolBar.h"
+# include "QITableView.h"
+# include "QIStyledItemDelegate.h"
 
 /* Other VBox includes: */
-#include <iprt/cidr.h>
+# include <iprt/cidr.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* External includes: */
 #include <math.h>
 
+
 /* IPv4 validator: */
 class IPv4Validator : public QValidator
 {
@@ -102,6 +109,11 @@ class NameEditor : public QLineEdit
     Q_OBJECT;
     Q_PROPERTY(NameData name READ name WRITE setName USER true);
 
+signals:
+
+    /** Notifies listener about data should be committed. */
+    void sigCommitData(QWidget *pThis);
+
 public:
 
     /* Constructor: */
@@ -110,6 +122,15 @@ public:
         setFrame(false);
         setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
         setValidator(new QRegExpValidator(QRegExp("[^,:]*"), this));
+        connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(sltTextEdited(const QString&)));
+    }
+
+private slots:
+
+    /** Drops the changed data to listener. */
+    void sltTextEdited(const QString&)
+    {
+        emit sigCommitData(this);
     }
 
 private:
@@ -133,6 +154,11 @@ class ProtocolEditor : public QComboBox
     Q_OBJECT;
     Q_PROPERTY(KNATProtocol protocol READ protocol WRITE setProtocol USER true);
 
+signals:
+
+    /** Notifies listener about data should be committed. */
+    void sigCommitData(QWidget *pThis);
+
 public:
 
     /* Constructor: */
@@ -140,6 +166,15 @@ public:
     {
         addItem(gpConverter->toString(KNATProtocol_UDP), QVariant::fromValue(KNATProtocol_UDP));
         addItem(gpConverter->toString(KNATProtocol_TCP), QVariant::fromValue(KNATProtocol_TCP));
+        connect(this, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(sltTextEdited(const QString&)));
+    }
+
+private slots:
+
+    /** Drops the changed data to listener. */
+    void sltTextEdited(const QString&)
+    {
+        emit sigCommitData(this);
     }
 
 private:
@@ -170,6 +205,11 @@ class IPv4Editor : public QLineEdit
     Q_OBJECT;
     Q_PROPERTY(IpData ip READ ip WRITE setIp USER true);
 
+signals:
+
+    /** Notifies listener about data should be committed. */
+    void sigCommitData(QWidget *pThis);
+
 public:
 
     /* Constructor: */
@@ -202,6 +242,11 @@ class IPv6Editor : public QLineEdit
     Q_OBJECT;
     Q_PROPERTY(IpData ip READ ip WRITE setIp USER true);
 
+signals:
+
+    /** Notifies listener about data should be committed. */
+    void sigCommitData(QWidget *pThis);
+
 public:
 
     /* Constructor: */
@@ -234,6 +279,11 @@ class PortEditor : public QSpinBox
     Q_OBJECT;
     Q_PROPERTY(PortData port READ port WRITE setPort USER true);
 
+signals:
+
+    /** Notifies listener about data should be committed. */
+    void sigCommitData(QWidget *pThis);
+
 public:
 
     /* Constructor: */
@@ -241,6 +291,15 @@ public:
     {
         setFrame(false);
         setRange(0, (1 << (8 * sizeof(ushort))) - 1);
+        connect(this, SIGNAL(valueChanged(const QString&)), this, SLOT(sltTextEdited(const QString&)));
+    }
+
+private slots:
+
+    /** Drops the changed data to listener. */
+    void sltTextEdited(const QString&)
+    {
+        emit sigCommitData(this);
     }
 
 private:
@@ -504,7 +563,11 @@ UIPortForwardingTable::UIPortForwardingTable(const UIPortForwardingDataList &rul
     QHBoxLayout *pMainLayout = new QHBoxLayout(this);
     {
         /* Configure layout: */
-        pMainLayout->setMargin(0);
+#ifndef Q_WS_WIN
+        /* On Windows host that looks ugly, but
+         * On Mac OS X and X11 that deserves it's place. */
+        pMainLayout->setContentsMargins(0, 0, 0, 0);
+#endif /* !Q_WS_WIN */
         pMainLayout->setSpacing(3);
         /* Create model: */
         m_pModel = new UIPortForwardingModel(this, rules);
@@ -565,55 +628,53 @@ UIPortForwardingTable::UIPortForwardingTable(const UIPortForwardingDataList &rul
         pMainLayout->addWidget(m_pToolBar);
     }
 
-    /* Register delegates editors: */
-    if (QAbstractItemDelegate *pAbstractItemDelegate = m_pTableView->itemDelegate())
+    /* Reinstall delegate: */
+    delete m_pTableView->itemDelegate();
+    QIStyledItemDelegate *pStyledItemDelegate = new QIStyledItemDelegate(this);
+    m_pTableView->setItemDelegate(pStyledItemDelegate);
+
+    /* Create new item editor factory: */
+    QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
+
+    /* Register name type: */
+    int iNameId = qRegisterMetaType<NameData>();
+    /* Register name editor: */
+    QStandardItemEditorCreator<NameEditor> *pNameEditorItemCreator = new QStandardItemEditorCreator<NameEditor>();
+    /* Link name type & editor: */
+    pNewItemEditorFactory->registerEditor((QVariant::Type)iNameId, pNameEditorItemCreator);
+
+    /* Register protocol type: */
+    int iProtocolId = qRegisterMetaType<KNATProtocol>();
+    /* Register protocol editor: */
+    QStandardItemEditorCreator<ProtocolEditor> *pProtocolEditorItemCreator = new QStandardItemEditorCreator<ProtocolEditor>();
+    /* Link protocol type & editor: */
+    pNewItemEditorFactory->registerEditor((QVariant::Type)iProtocolId, pProtocolEditorItemCreator);
+
+    /* Register ip type: */
+    int iIpId = qRegisterMetaType<IpData>();
+    /* Register ip editor: */
+    if (!fIPv6)
     {
-        if (QStyledItemDelegate *pStyledItemDelegate = qobject_cast<QStyledItemDelegate*>(pAbstractItemDelegate))
-        {
-            /* Create new item editor factory: */
-            QItemEditorFactory *pNewItemEditorFactory = new QItemEditorFactory;
-
-            /* Register name type: */
-            int iNameId = qRegisterMetaType<NameData>();
-            /* Register name editor: */
-            QStandardItemEditorCreator<NameEditor> *pNameEditorItemCreator = new QStandardItemEditorCreator<NameEditor>();
-            /* Link name type & editor: */
-            pNewItemEditorFactory->registerEditor((QVariant::Type)iNameId, pNameEditorItemCreator);
-
-            /* Register protocol type: */
-            int iProtocolId = qRegisterMetaType<KNATProtocol>();
-            /* Register protocol editor: */
-            QStandardItemEditorCreator<ProtocolEditor> *pProtocolEditorItemCreator = new QStandardItemEditorCreator<ProtocolEditor>();
-            /* Link protocol type & editor: */
-            pNewItemEditorFactory->registerEditor((QVariant::Type)iProtocolId, pProtocolEditorItemCreator);
-
-            /* Register ip type: */
-            int iIpId = qRegisterMetaType<IpData>();
-            /* Register ip editor: */
-            if (!fIPv6)
-            {
-                QStandardItemEditorCreator<IPv4Editor> *pIPv4EditorItemCreator = new QStandardItemEditorCreator<IPv4Editor>();
-                /* Link ip type & editor: */
-                pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv4EditorItemCreator);
-            }
-            else
-            {
-                QStandardItemEditorCreator<IPv6Editor> *pIPv6EditorItemCreator = new QStandardItemEditorCreator<IPv6Editor>();
-                /* Link ip type & editor: */
-                pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv6EditorItemCreator);
-            }
+        QStandardItemEditorCreator<IPv4Editor> *pIPv4EditorItemCreator = new QStandardItemEditorCreator<IPv4Editor>();
+        /* Link ip type & editor: */
+        pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv4EditorItemCreator);
+    }
+    else
+    {
+        QStandardItemEditorCreator<IPv6Editor> *pIPv6EditorItemCreator = new QStandardItemEditorCreator<IPv6Editor>();
+        /* Link ip type & editor: */
+        pNewItemEditorFactory->registerEditor((QVariant::Type)iIpId, pIPv6EditorItemCreator);
+    }
 
-            /* Register port type: */
-            int iPortId = qRegisterMetaType<PortData>();
-            /* Register port editor: */
-            QStandardItemEditorCreator<PortEditor> *pPortEditorItemCreator = new QStandardItemEditorCreator<PortEditor>();
-            /* Link port type & editor: */
-            pNewItemEditorFactory->registerEditor((QVariant::Type)iPortId, pPortEditorItemCreator);
+    /* Register port type: */
+    int iPortId = qRegisterMetaType<PortData>();
+    /* Register port editor: */
+    QStandardItemEditorCreator<PortEditor> *pPortEditorItemCreator = new QStandardItemEditorCreator<PortEditor>();
+    /* Link port type & editor: */
+    pNewItemEditorFactory->registerEditor((QVariant::Type)iPortId, pPortEditorItemCreator);
 
-            /* Set newly created item editor factory for table delegate: */
-            pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
-        }
-    }
+    /* Set newly created item editor factory for table delegate: */
+    pStyledItemDelegate->setItemEditorFactory(pNewItemEditorFactory);
 
     /* Retranslate dialog: */
     retranslateUi();
@@ -630,15 +691,35 @@ const UIPortForwardingDataList& UIPortForwardingTable::rules() const
 bool UIPortForwardingTable::validate() const
 {
     /* Validate table: */
+    QSet<QString> usedNames;
+    QMap<int, QString> rules;
     for (int i = 0; i < m_pModel->rowCount(); ++i)
     {
         /* If at aleast one port is 'zero': */
         if (m_pModel->data(m_pModel->index(i, UIPortForwardingModel::UIPortForwardingDataType_HostPort), Qt::EditRole).value<PortData>().value() == 0 ||
             m_pModel->data(m_pModel->index(i, UIPortForwardingModel::UIPortForwardingDataType_GuestPort), Qt::EditRole).value<PortData>().value() == 0)
+            return msgCenter().warnAboutIncorrectPort(window());
+
+        /* Make sure non of the names were previosly used: */
+        const QString strName = m_pModel->data(m_pModel->index(i, UIPortForwardingModel::UIPortForwardingDataType_Name), Qt::EditRole).value<NameData>();
+        if (!usedNames.contains(strName))
+            usedNames << strName;
+        else
+            return msgCenter().warnAboutNameShouldBeUnique(window());
+
+        /* Make sure rules are not in conflict: */
+        const ushort iHostPort = m_pModel->data(m_pModel->index(i, UIPortForwardingModel::UIPortForwardingDataType_HostPort), Qt::EditRole).value<PortData>().value();
+        const QString strHostAddressNew = m_pModel->data(m_pModel->index(i, UIPortForwardingModel::UIPortForwardingDataType_HostIp), Qt::EditRole).value<IpData>();
+        if (rules.contains(iHostPort))
         {
-            msgCenter().warnAboutIncorrectPort(window());
-            return false;
+            const QString strHostAddressOld = rules.value(iHostPort);
+            if (   strHostAddressNew == strHostAddressOld
+                || strHostAddressNew.isEmpty() || QHostAddress(strHostAddressNew).isNull()
+                || strHostAddressOld.isEmpty() || QHostAddress(strHostAddressOld).isNull())
+                return msgCenter().warnAboutRulesConflict(window());
         }
+        else
+            rules[iHostPort] = strHostAddressNew;
     }
     /* True by default: */
     return true;
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h
index ad9f055..e04606c 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h
@@ -1,7 +1,6 @@
+/* $Id: UIPortForwardingTable.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIPortForwardingTable class declaration
+ * VBox Qt GUI - UIPortForwardingTable class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp
index 5bd8ff3..1b721a8 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIProgressDialog.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIProgressDialog class implementation
+ * VBox Qt GUI - UIProgressDialog class implementation.
  */
 
 /*
@@ -17,27 +15,35 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QCloseEvent>
-#include <QEventLoop>
-#include <QProgressBar>
-#include <QTime>
-#include <QTimer>
-#include <QVBoxLayout>
+# include <QCloseEvent>
+# include <QEventLoop>
+# include <QProgressBar>
+# include <QTime>
+# include <QTimer>
+# include <QVBoxLayout>
 
 /* GUI includes: */
-#include "UIProgressDialog.h"
-#include "QIDialogButtonBox.h"
-#include "QILabel.h"
-#include "UISpecialControls.h"
-#include "VBoxGlobal.h"
-#include "UIModalWindowManager.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils-darwin.h"
-#endif /* Q_WS_MAC */
+# include "UIProgressDialog.h"
+# include "UIMessageCenter.h"
+# include "UISpecialControls.h"
+# include "UIModalWindowManager.h"
+# include "QIDialogButtonBox.h"
+# include "QILabel.h"
+# include "VBoxGlobal.h"
+# ifdef Q_WS_MAC
+#  include "VBoxUtils-darwin.h"
+# endif /* Q_WS_MAC */
 
 /* COM includes: */
-#include "CProgress.h"
+# include "CProgress.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 const char *UIProgressDialog::m_spcszOpDescTpl = "%1 ... (%2/%3)";
 
@@ -336,3 +342,77 @@ void UIProgressDialog::handleTimerEvent()
         m_pEtaLbl->setText(m_strCancel);
 }
 
+
+UIProgress::UIProgress(CProgress &progress, QObject *pParent /* = 0 */)
+    : QObject(pParent)
+    , m_progress(progress)
+    , m_cOperations(m_progress.GetOperationCount())
+    , m_fEnded(false)
+{
+}
+
+void UIProgress::run(int iRefreshInterval)
+{
+    /* Make sure the CProgress still valid: */
+    if (!m_progress.isOk())
+        return;
+
+    /* Start the refresh timer: */
+    int id = startTimer(iRefreshInterval);
+
+    /* Create a local event-loop: */
+    {
+        QEventLoop eventLoop;
+        m_pEventLoop = &eventLoop;
+
+        /* Guard ourself for the case
+         * we destroyed ourself in our event-loop: */
+        QPointer<UIProgress> guard = this;
+
+        /* Start the blocking event-loop: */
+        eventLoop.exec();
+
+        /* Are we still valid? */
+        if (guard.isNull())
+            return;
+
+        m_pEventLoop = 0;
+    }
+
+    /* Kill the refresh timer: */
+    killTimer(id);
+}
+
+void UIProgress::timerEvent(QTimerEvent*)
+{
+    /* Make sure the UIProgress still 'running': */
+    if (m_fEnded)
+        return;
+
+    /* If progress had failed or finished: */
+    if (!m_progress.isOk() || m_progress.GetCompleted())
+    {
+        /* Notify listeners about the operation progress error: */
+        if (!m_progress.isOk() || m_progress.GetResultCode() != 0)
+            emit sigProgressError(UIMessageCenter::formatErrorInfo(m_progress));
+
+        /* Exit from the event-loop if there is any: */
+        if (m_pEventLoop)
+            m_pEventLoop->exit();
+
+        /* Mark UIProgress as 'ended': */
+        m_fEnded = true;
+
+        /* Return early: */
+        return;
+    }
+
+    /* If CProgress was not yet canceled: */
+    if (!m_progress.GetCanceled())
+    {
+        /* Notify listeners about the operation progress update: */
+        emit sigProgressChange(m_cOperations, m_progress.GetOperationDescription(),
+                               m_progress.GetOperation() + 1, m_progress.GetPercent());
+    }
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h
index 58388ae..68e4664 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIProgressDialog.h
@@ -1,7 +1,6 @@
+/* $Id: UIProgressDialog.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIProgressDialog class declaration
+ * VBox Qt GUI - UIProgressDialog class declaration.
  */
 
 /*
@@ -101,5 +100,56 @@ private:
     static const char *m_spcszOpDescTpl;
 };
 
+/** QObject reimplementation allowing to effectively track the CProgress object completion
+  * (w/o using CProgress::waitForCompletion() and w/o blocking the calling thread in any other way for too long).
+  * @note The CProgress instance is passed as a non-const reference to the constructor
+  *       (to memorize COM errors if they happen), and therefore must not be destroyed
+  *       before the created UIProgress instance is destroyed.
+  * @todo To be moved to separate files. */
+class UIProgress : public QObject
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listeners about wrapped CProgress change.
+      * @param iOperations  holds the number of operations CProgress have,
+      * @param strOperation holds the description of the current CProgress operation,
+      * @param iOperation   holds the index of the current CProgress operation,
+      * @param iPercent     holds the percentage of the current CProgress operation. */
+    void sigProgressChange(ulong iOperations, QString strOperation,
+                           ulong iOperation, ulong iPercent);
+
+    /** Notifies listeners about particular COM error.
+      * @param strErrorInfo holds the details of the error happened. */
+    void sigProgressError(QString strErrorInfo);
+
+public:
+
+    /** Constructor passing @a pParent to the base-class.
+      * @param progress holds the CProgress to be wrapped. */
+    UIProgress(CProgress &progress, QObject *pParent = 0);
+
+    /** Starts the UIProgress by entering the personal event-loop.
+      * @param iRefreshInterval holds the refresh interval to check
+      *                         for the CProgress updates with. */
+    void run(int iRefreshInterval);
+
+private:
+
+    /** Timer @a pEvent reimplementation. */
+    virtual void timerEvent(QTimerEvent *pEvent);
+
+    /** Holds the wrapped CProgress reference. */
+    CProgress &m_progress;
+    /** Holds the number of operations wrapped CProgress have. */
+    const ulong m_cOperations;
+    /** Holds whether the UIProgress ended. */
+    bool m_fEnded;
+
+    /** Holds the personal event-loop. */
+    QPointer<QEventLoop> m_pEventLoop;
+};
+
 #endif /* __UIProgressDialog_h__ */
 
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UISpacerWidgets.h b/src/VBox/Frontends/VirtualBox/src/widgets/UISpacerWidgets.h
index edd1909..93783d5 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UISpacerWidgets.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UISpacerWidgets.h
@@ -1,7 +1,6 @@
+/* $Id: UISpacerWidgets.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UISpacerWidgets declarations
+ * VBox Qt GUI - UISpacerWidgets declarations.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.cpp
index fe492d4..8521e8a 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.cpp
@@ -1,8 +1,6 @@
 /* $Id: UISpecialControls.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxSpecialButtons implementation
+ * VBox Qt GUI - VBoxSpecialButtons implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* VBox includes */
-#include "UIIconPool.h"
-#include "UISpecialControls.h"
+# include "UIIconPool.h"
+# include "UISpecialControls.h"
 
 /* Global includes */
-#include <QHBoxLayout>
+# include <QHBoxLayout>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 #ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
 
@@ -35,7 +40,7 @@ UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */)
   : QAbstractButton(pParent)
 {
     setShortcut(QKeySequence(Qt::Key_Escape));
-    m_pButton = new UICocoaButton(UICocoaButton::CancelButton, this);
+    m_pButton = new UICocoaButton(this, UICocoaButton::CancelButton);
     connect(m_pButton, SIGNAL(clicked()),
             this, SIGNAL(clicked()));
     setFixedSize(m_pButton->size());
@@ -54,7 +59,7 @@ void UIMiniCancelButton::resizeEvent(QResizeEvent * /* pEvent */)
 UIResetButton::UIResetButton(QWidget *pParent /* = 0 */)
   : QAbstractButton(pParent)
 {
-    m_pButton = new UICocoaButton(UICocoaButton::ResetButton, this);
+    m_pButton = new UICocoaButton(this, UICocoaButton::ResetButton);
     connect(m_pButton, SIGNAL(clicked()),
             this, SIGNAL(clicked()));
     setFixedSize(m_pButton->size());
@@ -74,7 +79,7 @@ UIHelpButton::UIHelpButton(QWidget *pParent /* = 0 */)
   : QPushButton(pParent)
 {
     setShortcut(QKeySequence(QKeySequence::HelpContents));
-    m_pButton = new UICocoaButton(UICocoaButton::HelpButton, this);
+    m_pButton = new UICocoaButton(this, UICocoaButton::HelpButton);
     connect(m_pButton, SIGNAL(clicked()),
             this, SIGNAL(clicked()));
     setFixedSize(m_pButton->size());
@@ -85,13 +90,13 @@ UIHelpButton::UIHelpButton(QWidget *pParent /* = 0 */)
  * A segmented button in the native Cocoa version.
  *
  ********************************************************************************/
-UIRoundRectSegmentedButton::UIRoundRectSegmentedButton(int cCount, QWidget *pParent /* = 0 */)
-  : UICocoaSegmentedButton(cCount, UICocoaSegmentedButton::RoundRectSegment, pParent)
+UIRoundRectSegmentedButton::UIRoundRectSegmentedButton(QWidget *pParent, int cCount)
+  : UICocoaSegmentedButton(pParent, cCount, UICocoaSegmentedButton::RoundRectSegment)
 {
 }
 
-UITexturedSegmentedButton::UITexturedSegmentedButton(int cCount, QWidget *pParent /* = 0 */)
-  : UICocoaSegmentedButton(cCount, UICocoaSegmentedButton::TexturedRoundedSegment, pParent)
+UITexturedSegmentedButton::UITexturedSegmentedButton(QWidget *pParent, int cCount)
+  : UICocoaSegmentedButton(pParent, cCount, UICocoaSegmentedButton::TexturedRoundedSegment)
 {
 }
 
@@ -107,11 +112,13 @@ UISearchField::UISearchField(QWidget *pParent /* = 0 */)
 
 #else /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
 
+# ifndef VBOX_WITH_PRECOMPILED_HEADERS
 /* Qt includes */
-#include <QPainter>
-#include <QBitmap>
-#include <QMouseEvent>
-#include <QSignalMapper>
+#  include <QPainter>
+#  include <QBitmap>
+#  include <QMouseEvent>
+#  include <QSignalMapper>
+# endif
 
 /********************************************************************************
  *
@@ -124,7 +131,7 @@ UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */)
     setAutoRaise(true);
     setFocusPolicy(Qt::TabFocus);
     setShortcut(QKeySequence(Qt::Key_Escape));
-    setIcon(UIIconPool::defaultIcon(UIIconPool::DialogCancelIcon));
+    setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_DialogCancel));
 }
 
 /********************************************************************************
@@ -232,7 +239,7 @@ void UIHelpButton::leaveEvent(QEvent * pEvent)
  * A segmented button for the other OS's.
  *
  ********************************************************************************/
-UIRoundRectSegmentedButton::UIRoundRectSegmentedButton(int aCount, QWidget *pParent /* = 0 */)
+UIRoundRectSegmentedButton::UIRoundRectSegmentedButton(QWidget *pParent, int aCount)
   : QWidget(pParent)
 {
     m_pSignalMapper = new QSignalMapper(this);
@@ -286,8 +293,8 @@ void UIRoundRectSegmentedButton::animateClick(int iSegment)
     m_pButtons.at(iSegment)->animateClick();
 }
 
-UITexturedSegmentedButton::UITexturedSegmentedButton(int cCount, QWidget *pParent /* = 0 */)
-  : UIRoundRectSegmentedButton(cCount, pParent)
+UITexturedSegmentedButton::UITexturedSegmentedButton(QWidget *pParent, int cCount)
+  : UIRoundRectSegmentedButton(pParent, cCount)
 {
     for (int i=0; i < m_pButtons.size(); ++i)
     {
@@ -301,7 +308,7 @@ UITexturedSegmentedButton::UITexturedSegmentedButton(int cCount, QWidget *pParen
  * A search field  for the other OS's.
  *
  ********************************************************************************/
-UISearchField::UISearchField(QWidget *pParent /* = 0 */)
+UISearchField::UISearchField(QWidget *pParent)
   : QLineEdit(pParent)
 {
     m_baseBrush = palette().base();
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.h b/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.h
index c9c7809..ba08842 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.h
@@ -1,7 +1,6 @@
+/* $Id: UISpecialControls.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxSpecialButtons declarations
+ * VBox Qt GUI - VBoxSpecialButtons declarations.
  */
 
 /*
@@ -111,7 +110,7 @@ class UIRoundRectSegmentedButton: public UICocoaSegmentedButton
     Q_OBJECT;
 
 public:
-    UIRoundRectSegmentedButton(int cCount, QWidget *pParent = 0);
+    UIRoundRectSegmentedButton(QWidget *pParent, int cCount);
 };
 
 class UITexturedSegmentedButton: public UICocoaSegmentedButton
@@ -119,7 +118,7 @@ class UITexturedSegmentedButton: public UICocoaSegmentedButton
     Q_OBJECT;
 
 public:
-    UITexturedSegmentedButton(int cCount, QWidget *pParent = 0);
+    UITexturedSegmentedButton(QWidget *pParent, int cCount);
 };
 
 /********************************************************************************
@@ -132,7 +131,7 @@ class UISearchField: public UICocoaSearchField
     Q_OBJECT;
 
 public:
-    UISearchField(QWidget *pParent = 0);
+    UISearchField(QWidget *pParent);
 };
 
 #else /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
@@ -228,7 +227,7 @@ class UIRoundRectSegmentedButton: public QWidget
     Q_OBJECT;
 
 public:
-    UIRoundRectSegmentedButton(int aCount, QWidget *pParent = 0);
+    UIRoundRectSegmentedButton(QWidget *pParent, int aCount);
     ~UIRoundRectSegmentedButton();
 
     void setTitle(int iSegment, const QString &aTitle);
@@ -252,7 +251,7 @@ class UITexturedSegmentedButton: public UIRoundRectSegmentedButton
     Q_OBJECT;
 
 public:
-    UITexturedSegmentedButton(int cCount, QWidget *pParent = 0);
+    UITexturedSegmentedButton(QWidget *pParent, int cCount);
 };
 
 /********************************************************************************
@@ -265,7 +264,7 @@ class UISearchField: public QLineEdit
     Q_OBJECT;
 
 public:
-    UISearchField(QWidget *pParent = 0);
+    UISearchField(QWidget *pParent);
 
     void markError();
     void unmarkError();
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp
index c96da09..0d52b61 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIToolBar.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIToolBar class implementation
+ * VBox Qt GUI - UIToolBar class implementation.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,47 +15,40 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/* Local includes */
-#include "UIToolBar.h"
-#ifdef Q_WS_MAC
-# include "VBoxUtils.h"
-#endif /* Q_WS_MAC */
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 /* Qt includes: */
-#include <QLayout>
-#include <QMainWindow>
-/* Note: These styles are available on _all_ platforms: */
+# include <QLayout>
+# include <QMainWindow>
+# include <QWindowsStyle>
+
+/* GUI includes: */
+# include "UIToolBar.h"
+# ifdef Q_WS_MAC
+#  include "VBoxUtils.h"
+# endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#endif /* Q_WS_MAC */
+
 #include <QCleanlooksStyle>
-#include <QWindowsStyle>
 
-UIToolBar::UIToolBar(QWidget *pParent /* = 0*/)
+
+UIToolBar::UIToolBar(QWidget *pParent /* = 0 */)
     : QToolBar(pParent)
     , m_pMainWindow(qobject_cast<QMainWindow*>(pParent))
 {
-    /* Configure tool-bar: */
-    setFloatable(false);
-    setMovable(false);
-
-    /* Remove that ugly frame panel around the toolbar.
-     * Doing that currently for Cleanlooks & Windows styles. */
-    if (qobject_cast <QCleanlooksStyle*>(QToolBar::style()) ||
-        qobject_cast <QWindowsStyle*>(QToolBar::style()))
-        setStyleSheet("QToolBar { border: 0px none black; }");
-
-    /* Configure layout: */
-    if (layout())
-        layout()->setContentsMargins(0, 0, 0, 0);;
-
-    /* Configure context-menu policy: */
-    setContextMenuPolicy(Qt::NoContextMenu);
+    /* Prepare: */
+    prepare();
 }
 
-void UIToolBar::setUsesTextLabel(bool fEnable)
+void UIToolBar::setUseTextLabels(bool fEnable)
 {
-    Qt::ToolButtonStyle tbs = Qt::ToolButtonTextUnderIcon;
-    if (!fEnable)
-        tbs = Qt::ToolButtonIconOnly;
+    /* Determine tool-button style on the basis of passed flag: */
+    Qt::ToolButtonStyle tbs = fEnable ? Qt::ToolButtonTextUnderIcon : Qt::ToolButtonIconOnly;
 
+    /* Depending on parent, assign this style: */
     if (m_pMainWindow)
         m_pMainWindow->setToolButtonStyle(tbs);
     else
@@ -65,8 +56,9 @@ void UIToolBar::setUsesTextLabel(bool fEnable)
 }
 
 #ifdef Q_WS_MAC
-void UIToolBar::setMacToolbar()
+void UIToolBar::enableMacToolbar()
 {
+    /* Depending on parent, enable unified title/tool-bar: */
     if (m_pMainWindow)
         m_pMainWindow->setUnifiedTitleAndToolBarOnMac(true);
 }
@@ -91,3 +83,23 @@ void UIToolBar::updateLayout()
 }
 #endif /* Q_WS_MAC */
 
+void UIToolBar::prepare()
+{
+    /* Configure tool-bar: */
+    setFloatable(false);
+    setMovable(false);
+
+    /* Remove that ugly frame panel around the toolbar.
+     * Doing that currently for Cleanlooks & Windows styles. */
+    if (qobject_cast <QCleanlooksStyle*>(QToolBar::style()) ||
+        qobject_cast <QWindowsStyle*>(QToolBar::style()))
+        setStyleSheet("QToolBar { border: 0px none black; }");
+
+    /* Configure tool-bar' layout: */
+    if (layout())
+        layout()->setContentsMargins(0, 0, 0, 0);
+
+    /* Configure tool-bar' context-menu policy: */
+    setContextMenuPolicy(Qt::NoContextMenu);
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.h
index 0a32e13..3a5078e 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.h
@@ -1,11 +1,10 @@
+/* $Id: UIToolBar.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIToolBar class declaration
+ * VBox Qt GUI - UIToolBar class declaration.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -25,27 +24,36 @@
 /* Forward declarations: */
 class QMainWindow;
 
-/* UI tool-bar prototype class: */
+/** QToolBar extension
+  * with few settings presets. */
 class UIToolBar : public QToolBar
 {
+    Q_OBJECT;
+
 public:
 
-    /* Constructor: */
+    /** Constructor, passes @a pParent to the QToolBar constructor. */
     UIToolBar(QWidget *pParent = 0);
 
-    /* API: Text-label stuff: */
-    void setUsesTextLabel(bool fEnable);
+    /** Defines whether tool-bar should use text-labels.
+      * Default value if @a false. */
+    void setUseTextLabels(bool fEnable);
 
 #ifdef Q_WS_MAC
-    /* API: Mac toolbar stuff: */
-    void setMacToolbar();
+    /** Mac OS X: Defines whether native tool-bar should be used. */
+    void enableMacToolbar();
+    /** Mac OS X: Defines whether native tool-bar button should be shown. */
     void setShowToolBarButton(bool fShow);
+    /** Mac OS X: Updates native tool-bar layout. */
     void updateLayout();
 #endif /* Q_WS_MAC */
 
 private:
 
-    /* Variables: */
+    /** Prepare routine. */
+    void prepare();
+
+    /** Holds the parent main-window isntance. */
     QMainWindow *m_pMainWindow;
 };
 
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.cpp
index 2c3e423..dc46e49 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWarningPane.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWarningPane class implementation
+ * VBox Qt GUI - UIWarningPane class implementation.
  */
 
 /*
@@ -17,18 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QEvent>
-#include <QTimer>
+# include <QHBoxLayout>
+# include <QLabel>
+# include <QEvent>
+# include <QTimer>
 
 /* GUI includes: */
-#include "UIWarningPane.h"
-#include "QIWidgetValidator.h"
+# include "UIWarningPane.h"
+# include "QIWidgetValidator.h"
 
 /* Other VBox includes: */
-#include <VBox/sup.h>
+# include <VBox/sup.h>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWarningPane::UIWarningPane(QWidget *pParent)
     : QWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.h b/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.h
index 7459b26..eb4370d 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.h
@@ -1,7 +1,6 @@
+/* $Id: UIWarningPane.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWarningPane class declaration
+ * VBox Qt GUI - UIWarningPane class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxFilePathSelectorWidget.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxFilePathSelectorWidget.cpp
index d773c5c..bb28031 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxFilePathSelectorWidget.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxFilePathSelectorWidget.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxFilePathSelectorWidget.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: VBoxFilePathSelectorWidget class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: VBoxFilePathSelectorWidget class implementation.
  */
 
 /*
@@ -17,25 +15,32 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Local includes */
-#include "QIFileDialog.h"
-#include "QIToolButton.h"
-#include "QILabel.h"
-#include "QILineEdit.h"
-#include "UIIconPool.h"
-#include "VBoxFilePathSelectorWidget.h"
-#include "VBoxGlobal.h"
+# include "QIFileDialog.h"
+# include "QIToolButton.h"
+# include "QILabel.h"
+# include "QILineEdit.h"
+# include "UIIconPool.h"
+# include "VBoxFilePathSelectorWidget.h"
+# include "VBoxGlobal.h"
 
 /* Global includes */
-#include <iprt/assert.h>
-#include <QAction>
-#include <QApplication>
-#include <QClipboard>
-#include <QDir>
-#include <QFocusEvent>
-#include <QHBoxLayout>
-#include <QLineEdit>
-#include <QTimer>
+# include <iprt/assert.h>
+# include <QAction>
+# include <QApplication>
+# include <QClipboard>
+# include <QDir>
+# include <QFocusEvent>
+# include <QHBoxLayout>
+# include <QLineEdit>
+# include <QTimer>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // VBoxFilePathSelectorWidget
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxFilePathSelectorWidget.h b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxFilePathSelectorWidget.h
index 99221de..23ad0e0 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxFilePathSelectorWidget.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxFilePathSelectorWidget.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxFilePathSelectorWidget.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: VBoxFilePathSelectorWidget class declaration
+ * VBox Qt GUI - VirtualBox Qt extensions: VBoxFilePathSelectorWidget class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxGuestRAMSlider.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxGuestRAMSlider.cpp
index 92f0263..6e1f6b2 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxGuestRAMSlider.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxGuestRAMSlider.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxGuestRAMSlider.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VirtualBox Qt extensions: VBoxGuestRAMSlider class implementation
+ * VBox Qt GUI - VirtualBox Qt extensions: VBoxGuestRAMSlider class implementation.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "VBoxGuestRAMSlider.h"
-#include "VBoxGlobal.h"
+# include "VBoxGuestRAMSlider.h"
+# include "VBoxGlobal.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 VBoxGuestRAMSlider::VBoxGuestRAMSlider (QWidget *aParent /* = 0 */)
   : QIAdvancedSlider (aParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxGuestRAMSlider.h b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxGuestRAMSlider.h
index b2abb52..8b8a3c0 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxGuestRAMSlider.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxGuestRAMSlider.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxGuestRAMSlider.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * VBoxGuestRAMSlider class declaration
+ * VBox Qt GUI - VBoxGuestRAMSlider class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
index 9376f58..cd2633b 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxMediaComboBox.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxMediaComboBox class implementation
+ * VBox Qt GUI - VBoxMediaComboBox class implementation.
  */
 
 /*
@@ -17,14 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QFileInfo>
-#include <QDir>
-#include <QAbstractItemView>
+# include <QFileInfo>
+# include <QDir>
+# include <QAbstractItemView>
 
 /* GUI includes: */
-#include "VBoxMediaComboBox.h"
-#include "UIMedium.h"
+# include "VBoxMediaComboBox.h"
+# include "UIMedium.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 VBoxMediaComboBox::VBoxMediaComboBox (QWidget *aParent)
     : QComboBox (aParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.h b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.h
index e8f4569..5ab973e 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxMediaComboBox.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxMediaComboBox.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxMediaComboBox class declaration
+ * VBox Qt GUI - VBoxMediaComboBox class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxOSTypeSelectorButton.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxOSTypeSelectorButton.cpp
index d0c3e53..9d3e948 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxOSTypeSelectorButton.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxOSTypeSelectorButton.cpp
@@ -1,8 +1,6 @@
 /* $Id: VBoxOSTypeSelectorButton.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxOSTypeSelectorButton class implementation
+ * VBox Qt GUI - VBoxOSTypeSelectorButton class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* VBox includes */
-#include "VBoxOSTypeSelectorButton.h"
-#include "VBoxGlobal.h"
+# include "VBoxOSTypeSelectorButton.h"
+# include "VBoxGlobal.h"
 
 /* Qt includes */
-#include <QMenu>
-#include <QSignalMapper>
+# include <QMenu>
+# include <QSignalMapper>
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 VBoxOSTypeSelectorButton::VBoxOSTypeSelectorButton (QWidget *aParent)
   : QIWithRetranslateUI <QPushButton> (aParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxOSTypeSelectorButton.h b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxOSTypeSelectorButton.h
index f9e4f6a..9a6e4db 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/VBoxOSTypeSelectorButton.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/VBoxOSTypeSelectorButton.h
@@ -1,7 +1,6 @@
+/* $Id: VBoxOSTypeSelectorButton.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * VBoxOSTypeSelectorButton class declaration
+ * VBox Qt GUI - VBoxOSTypeSelectorButton class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.cpp
index 0ff8731..2168442 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGraphicsButton.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsButton class definition
+ * VBox Qt GUI - UIGraphicsButton class definition.
  */
 
 /*
@@ -17,12 +15,19 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QPainter>
-#include <QGraphicsSceneMouseEvent>
+# include <QPainter>
+# include <QGraphicsSceneMouseEvent>
 
 /* GUI includes: */
-#include "UIGraphicsButton.h"
+# include "UIGraphicsButton.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGraphicsButton::UIGraphicsButton(QIGraphicsWidget *pParent, const QIcon &icon)
     : QIGraphicsWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.h b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.h
index 9673bef..c689a80 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.h
@@ -1,7 +1,6 @@
+/* $Id: UIGraphicsButton.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsButton class declaration
+ * VBox Qt GUI - UIGraphicsButton class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsRotatorButton.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsRotatorButton.cpp
index ea8b7ec..0e19f7a 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsRotatorButton.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsRotatorButton.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGraphicsRotatorButton.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsRotatorButton class definition
+ * VBox Qt GUI - UIGraphicsRotatorButton class definition.
  */
 
 /*
@@ -17,15 +15,23 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QStateMachine>
-#include <QPropertyAnimation>
-#include <QSignalTransition>
-#include <QMouseEventTransition>
+# include <QStateMachine>
+# include <QPropertyAnimation>
+# include <QSignalTransition>
 
 /* GUI includes: */
-#include "UIGraphicsRotatorButton.h"
-#include "UIIconPool.h"
+# include "UIGraphicsRotatorButton.h"
+# include "UIIconPool.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <QMouseEventTransition>
+
 
 UIGraphicsRotatorButton::UIGraphicsRotatorButton(QIGraphicsWidget *pParent,
                                                  const QString &strPropertyName,
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsRotatorButton.h b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsRotatorButton.h
index 3816618..38f6ec0 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsRotatorButton.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsRotatorButton.h
@@ -1,7 +1,6 @@
+/* $Id: UIGraphicsRotatorButton.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsRotatorButton class declaration
+ * VBox Qt GUI - UIGraphicsRotatorButton class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.cpp
new file mode 100644
index 0000000..2311485
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.cpp
@@ -0,0 +1,441 @@
+/* $Id: UIGraphicsTextPane.cpp $ */
+/** @file
+ * VBox Qt GUI - UIGraphicsTextPane class implementation.
+ */
+
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Qt includes: */
+# include <QPainter>
+# include <QTextLayout>
+# include <QApplication>
+# include <QFontMetrics>
+# include <QGraphicsSceneHoverEvent>
+
+/* GUI includes: */
+# include "UIGraphicsTextPane.h"
+# include "UIRichTextString.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+UIGraphicsTextPane::UIGraphicsTextPane(QIGraphicsWidget *pParent, QPaintDevice *pPaintDevice)
+    : QIGraphicsWidget(pParent)
+    , m_pPaintDevice(pPaintDevice)
+    , m_iMargin(0)
+    , m_iSpacing(10)
+    , m_iMinimumTextColumnWidth(100)
+    , m_fMinimumSizeHintInvalidated(true)
+    , m_iMinimumTextWidth(0)
+    , m_iMinimumTextHeight(0)
+    , m_fAnchorCanBeHovered(true)
+{
+    /* We do support hover-events: */
+    setAcceptHoverEvents(true);
+}
+
+UIGraphicsTextPane::~UIGraphicsTextPane()
+{
+    /* Clear text-layouts: */
+    while (!m_leftList.isEmpty()) delete m_leftList.takeLast();
+    while (!m_rightList.isEmpty()) delete m_rightList.takeLast();
+}
+
+void UIGraphicsTextPane::setText(const UITextTable &text)
+{
+    /* Clear text: */
+    m_text.clear();
+
+    /* For each the line of the passed table: */
+    foreach (const UITextTableLine &line, text)
+    {
+        /* Lines: */
+        QString strLeftLine = line.first;
+        QString strRightLine = line.second;
+
+        /* If 2nd line is NOT empty: */
+        if (!strRightLine.isEmpty())
+        {
+            /* Take both lines 'as is': */
+            m_text << UITextTableLine(strLeftLine, strRightLine);
+        }
+        /* If 2nd line is empty: */
+        else
+        {
+            /* Parse the 1st one to sub-lines: */
+            QStringList subLines = strLeftLine.split(QRegExp("\\n"));
+            foreach (const QString &strSubLine, subLines)
+                m_text << UITextTableLine(strSubLine, QString());
+        }
+    }
+
+    /* Update text-layout: */
+    updateTextLayout(true);
+
+    /* Update minimum size-hint: */
+    updateGeometry();
+}
+
+void UIGraphicsTextPane::setAnchorRoleRestricted(const QString &strAnchorRole, bool fRestricted)
+{
+    /* Make sure something changed: */
+    if (   (fRestricted && m_restrictedAnchorRoles.contains(strAnchorRole))
+        || (!fRestricted && !m_restrictedAnchorRoles.contains(strAnchorRole)))
+        return;
+
+    /* Apply new value: */
+    if (fRestricted)
+        m_restrictedAnchorRoles << strAnchorRole;
+    else
+        m_restrictedAnchorRoles.remove(strAnchorRole);
+
+    /* Reset hovered anchor: */
+    m_strHoveredAnchor.clear();
+    updateHoverStuff();
+}
+
+void UIGraphicsTextPane::updateTextLayout(bool fFull /* = false */)
+{
+    /* Prepare variables: */
+    QFontMetrics fm(font(), m_pPaintDevice);
+    int iMaximumTextWidth = (int)size().width() - 2 * m_iMargin - m_iSpacing;
+
+    /* Search for the maximum column widths: */
+    int iMaximumLeftColumnWidth = 0;
+    int iMaximumRightColumnWidth = 0;
+    bool fSingleColumnText = true;
+    foreach (const UITextTableLine &line, m_text)
+    {
+        bool fRightColumnPresent = !line.second.isEmpty();
+        if (fRightColumnPresent)
+            fSingleColumnText = false;
+        QString strLeftLine = fRightColumnPresent ? line.first + ":" : line.first;
+        QString strRightLine = line.second;
+        iMaximumLeftColumnWidth = qMax(iMaximumLeftColumnWidth, fm.width(strLeftLine));
+        iMaximumRightColumnWidth = qMax(iMaximumRightColumnWidth, fm.width(strRightLine));
+    }
+    iMaximumLeftColumnWidth += 1;
+    iMaximumRightColumnWidth += 1;
+
+    /* Calculate text attributes: */
+    int iLeftColumnWidth = 0;
+    int iRightColumnWidth = 0;
+    /* Left column only: */
+    if (fSingleColumnText)
+    {
+        /* Full update? */
+        if (fFull)
+        {
+            /* Minimum width for left column: */
+            int iMinimumLeftColumnWidth = qMin(m_iMinimumTextColumnWidth, iMaximumLeftColumnWidth);
+            /* Minimum width for whole text: */
+            m_iMinimumTextWidth = iMinimumLeftColumnWidth;
+        }
+
+        /* Current width for left column: */
+        iLeftColumnWidth = qMax(m_iMinimumTextColumnWidth, iMaximumTextWidth);
+    }
+    /* Two columns: */
+    else
+    {
+        /* Full update? */
+        if (fFull)
+        {
+            /* Minimum width for left column: */
+            int iMinimumLeftColumnWidth = iMaximumLeftColumnWidth;
+            /* Minimum width for right column: */
+            int iMinimumRightColumnWidth = qMin(m_iMinimumTextColumnWidth, iMaximumRightColumnWidth);
+            /* Minimum width for whole text: */
+            m_iMinimumTextWidth = iMinimumLeftColumnWidth + m_iSpacing + iMinimumRightColumnWidth;
+        }
+
+        /* Current width for left column: */
+        iLeftColumnWidth = iMaximumLeftColumnWidth;
+        /* Current width for right column: */
+        iRightColumnWidth = iMaximumTextWidth - iLeftColumnWidth;
+    }
+
+    /* Clear old text-layouts: */
+    while (!m_leftList.isEmpty()) delete m_leftList.takeLast();
+    while (!m_rightList.isEmpty()) delete m_rightList.takeLast();
+
+    /* Prepare new text-layouts: */
+    int iTextX = m_iMargin;
+    int iTextY = m_iMargin;
+    /* Populate text-layouts: */
+    m_iMinimumTextHeight = 0;
+    foreach (const UITextTableLine &line, m_text)
+    {
+        /* Left layout: */
+        int iLeftColumnHeight = 0;
+        if (!line.first.isEmpty())
+        {
+            bool fRightColumnPresent = !line.second.isEmpty();
+            m_leftList << buildTextLayout(font(), m_pPaintDevice,
+                                          fRightColumnPresent ? line.first + ":" : line.first,
+                                          iLeftColumnWidth, iLeftColumnHeight,
+                                          m_strHoveredAnchor);
+            m_leftList.last()->setPosition(QPointF(iTextX, iTextY));
+        }
+
+        /* Right layout: */
+        int iRightColumnHeight = 0;
+        if (!line.second.isEmpty())
+        {
+            m_rightList << buildTextLayout(font(), m_pPaintDevice,
+                                           line.second,
+                                           iRightColumnWidth, iRightColumnHeight,
+                                           m_strHoveredAnchor);
+            m_rightList.last()->setPosition(QPointF(iTextX + iLeftColumnWidth + m_iSpacing, iTextY));
+        }
+
+        /* Maximum colum height? */
+        int iMaximumColumnHeight = qMax(iLeftColumnHeight, iRightColumnHeight);
+
+        /* Indent Y: */
+        iTextY += iMaximumColumnHeight;
+        /* Append summary text height: */
+        m_iMinimumTextHeight += iMaximumColumnHeight;
+    }
+}
+
+void UIGraphicsTextPane::updateGeometry()
+{
+    /* Discard cached minimum size-hint: */
+    m_fMinimumSizeHintInvalidated = true;
+
+    /* Call to base-class to notify layout if any: */
+    QIGraphicsWidget::updateGeometry();
+
+    /* And notify listeners which are not layouts: */
+    emit sigGeometryChanged();
+}
+
+QSizeF UIGraphicsTextPane::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const
+{
+    /* For minimum size-hint: */
+    if (which == Qt::MinimumSize)
+    {
+        /* If minimum size-hint invalidated: */
+        if (m_fMinimumSizeHintInvalidated)
+        {
+            /* Recache minimum size-hint: */
+            m_minimumSizeHint = QSizeF(2 * m_iMargin + m_iMinimumTextWidth,
+                                       2 * m_iMargin + m_iMinimumTextHeight);
+            m_fMinimumSizeHintInvalidated = false;
+        }
+        /* Return cached minimum size-hint: */
+        return m_minimumSizeHint;
+    }
+    /* Call to base-class for other size-hints: */
+    return QIGraphicsWidget::sizeHint(which, constraint);
+}
+
+void UIGraphicsTextPane::resizeEvent(QGraphicsSceneResizeEvent*)
+{
+    /* Update text-layout: */
+    updateTextLayout();
+
+    /* Update minimum size-hint: */
+    updateGeometry();
+}
+
+void UIGraphicsTextPane::hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent)
+{
+    /* Redirect to common handler: */
+    handleHoverEvent(pEvent);
+}
+
+void UIGraphicsTextPane::hoverMoveEvent(QGraphicsSceneHoverEvent *pEvent)
+{
+    /* Redirect to common handler: */
+    handleHoverEvent(pEvent);
+}
+
+void UIGraphicsTextPane::handleHoverEvent(QGraphicsSceneHoverEvent *pEvent)
+{
+    /* Ignore if anchor can't be hovered: */
+    if (!m_fAnchorCanBeHovered)
+        return;
+
+    /* Prepare variables: */
+    QPoint mousePosition = pEvent->pos().toPoint();
+    QString strHoveredAnchor;
+    QString strHoveredAnchorRole;
+
+    /* Search for hovered-anchor in the left list: */
+    strHoveredAnchor = searchForHoveredAnchor(m_pPaintDevice, m_leftList, mousePosition);
+    strHoveredAnchorRole = strHoveredAnchor.section(',', 0, 0);
+    if (!strHoveredAnchor.isNull() && !m_restrictedAnchorRoles.contains(strHoveredAnchorRole))
+    {
+        m_strHoveredAnchor = strHoveredAnchor;
+        return updateHoverStuff();
+    }
+
+    /* Then search for hovered-anchor in the right one: */
+    strHoveredAnchor = searchForHoveredAnchor(m_pPaintDevice, m_rightList, mousePosition);
+    strHoveredAnchorRole = strHoveredAnchor.section(',', 0, 0);
+    if (!strHoveredAnchor.isNull() && !m_restrictedAnchorRoles.contains(strHoveredAnchorRole))
+    {
+        m_strHoveredAnchor = strHoveredAnchor;
+        return updateHoverStuff();
+    }
+
+    /* Finally clear it for good: */
+    if (!m_strHoveredAnchor.isNull())
+    {
+        m_strHoveredAnchor.clear();
+        return updateHoverStuff();
+    }
+}
+
+void UIGraphicsTextPane::updateHoverStuff()
+{
+    /* Update mouse-cursor: */
+    if (m_strHoveredAnchor.isNull())
+        unsetCursor();
+    else
+        setCursor(Qt::PointingHandCursor);
+
+    /* Update text-layout: */
+    updateTextLayout();
+
+    /* Update tool-tip: */
+    setToolTip(m_strHoveredAnchor.section(',', -1));
+
+    /* Update text-pane: */
+    update();
+}
+
+void UIGraphicsTextPane::mousePressEvent(QGraphicsSceneMouseEvent*)
+{
+    /* Make sure some anchor hovered: */
+    if (m_strHoveredAnchor.isNull())
+        return;
+
+    /* Restrict anchor hovering: */
+    m_fAnchorCanBeHovered = false;
+
+    /* Cache clicked anchor: */
+    QString strClickedAnchor = m_strHoveredAnchor;
+
+    /* Clear hovered anchor: */
+    m_strHoveredAnchor.clear();
+    updateHoverStuff();
+
+    /* Notify listeners about anchor clicked: */
+    emit sigAnchorClicked(strClickedAnchor);
+
+    /* Allow anchor hovering again: */
+    m_fAnchorCanBeHovered = true;
+}
+
+void UIGraphicsTextPane::paint(QPainter *pPainter, const QStyleOptionGraphicsItem*, QWidget*)
+{
+    /* Draw all the text-layouts: */
+    foreach (QTextLayout *pTextLayout, m_leftList)
+        pTextLayout->draw(pPainter, QPoint(0, 0));
+    foreach (QTextLayout *pTextLayout, m_rightList)
+        pTextLayout->draw(pPainter, QPoint(0, 0));
+}
+
+/* static  */
+QTextLayout* UIGraphicsTextPane::buildTextLayout(const QFont &font, QPaintDevice *pPaintDevice,
+                                                 const QString &strText, int iWidth, int &iHeight,
+                                                 const QString &strHoveredAnchor)
+{
+    /* Prepare variables: */
+    QFontMetrics fm(font, pPaintDevice);
+    int iLeading = fm.leading();
+
+    /* Parse incoming string with UIRichTextString capabilities: */
+    //printf("Text: {%s}\n", strText.toAscii().constData());
+    UIRichTextString ms(strText);
+    ms.setHoveredAnchor(strHoveredAnchor);
+
+    /* Create layout; */
+    QTextLayout *pTextLayout = new QTextLayout(ms.toString(), font, pPaintDevice);
+    pTextLayout->setAdditionalFormats(ms.formatRanges());
+
+    /* Configure layout: */
+    QTextOption textOption;
+    textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
+    pTextLayout->setTextOption(textOption);
+
+    /* Build layout: */
+    pTextLayout->beginLayout();
+    while (1)
+    {
+        QTextLine line = pTextLayout->createLine();
+        if (!line.isValid())
+            break;
+
+        line.setLineWidth(iWidth);
+        iHeight += iLeading;
+        line.setPosition(QPointF(0, iHeight));
+        iHeight += line.height();
+    }
+    pTextLayout->endLayout();
+
+    /* Return layout: */
+    return pTextLayout;
+}
+
+/* static */
+QString UIGraphicsTextPane::searchForHoveredAnchor(QPaintDevice *pPaintDevice, const QList<QTextLayout*> &list, const QPoint &mousePosition)
+{
+    /* Analyze passed text-layouts: */
+    foreach (QTextLayout *pTextLayout, list)
+    {
+        /* Prepare variables: */
+        QFontMetrics fm(pTextLayout->font(), pPaintDevice);
+
+        /* Text-layout attributes: */
+        const QPoint layoutPosition = pTextLayout->position().toPoint();
+        const QString strLayoutText = pTextLayout->text();
+
+        /* Enumerate format ranges: */
+        foreach (const QTextLayout::FormatRange &range, pTextLayout->additionalFormats())
+        {
+            /* Skip unrelated formats: */
+            if (!range.format.isAnchor())
+                continue;
+
+            /* Parse 'anchor' format: */
+            const int iStart = range.start;
+            const int iLength = range.length;
+            QRegion formatRegion;
+            for (int iTextPosition = iStart; iTextPosition < iStart + iLength; ++iTextPosition)
+            {
+                QTextLine layoutLine = pTextLayout->lineForTextPosition(iTextPosition);
+                QPoint linePosition = layoutLine.position().toPoint();
+                int iSymbolX = (int)layoutLine.cursorToX(iTextPosition);
+                QRect symbolRect = QRect(layoutPosition.x() + linePosition.x() + iSymbolX,
+                                         layoutPosition.y() + linePosition.y(),
+                                         fm.width(strLayoutText[iTextPosition]) + 1, fm.height());
+                formatRegion += symbolRect;
+            }
+
+            /* Is that something we looking for? */
+            if (formatRegion.contains(mousePosition))
+                return range.format.anchorHref();
+        }
+    }
+
+    /* Null string by default: */
+    return QString();
+}
+
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.h b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.h
new file mode 100644
index 0000000..8c0b526
--- /dev/null
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsTextPane.h
@@ -0,0 +1,133 @@
+/* $Id: UIGraphicsTextPane.h $ */
+/** @file
+ * VBox Qt GUI - UIGraphicsTextPane class declaration.
+ */
+
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___UIGraphicsTextPane_h___
+#define ___UIGraphicsTextPane_h___
+
+/* GUI includes: */
+#include "QIGraphicsWidget.h"
+
+/* Forward declarations: */
+class QTextLayout;
+
+/* Typedefs: */
+typedef QPair<QString, QString> UITextTableLine;
+typedef QList<UITextTableLine> UITextTable;
+Q_DECLARE_METATYPE(UITextTable);
+
+/** QIGraphicsWidget reimplementation to draw QTextLayout content. */
+class UIGraphicsTextPane : public QIGraphicsWidget
+{
+    Q_OBJECT;
+
+signals:
+
+    /** Notifies listeners about size-hint changes. */
+    void sigGeometryChanged();
+
+    /** Notifies listeners about anchor clicked. */
+    void sigAnchorClicked(const QString &strAnchor);
+
+public:
+
+    /** Graphics text-pane constructor. */
+    UIGraphicsTextPane(QIGraphicsWidget *pParent, QPaintDevice *pPaintDevice);
+    /** Graphics text-pane destructor. */
+    ~UIGraphicsTextPane();
+
+    /** Returns whether contained text is empty. */
+    bool isEmpty() const { return m_text.isEmpty(); }
+    /** Returns contained text. */
+    const UITextTable& text() const { return m_text; }
+    /** Defines contained text. */
+    void setText(const UITextTable &text);
+
+    /** Defines whether passed @a strAnchorRole is @a fRestricted. */
+    void setAnchorRoleRestricted(const QString &strAnchorRole, bool fRestricted);
+
+private:
+
+    /** Update text-layout. */
+    void updateTextLayout(bool fFull = false);
+
+    /** Notifies listeners about size-hint changes. */
+    void updateGeometry();
+    /** Returns the size-hint to constrain the content. */
+    QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
+
+    /** This event handler is delivered after the widget has been resized. */
+    void resizeEvent(QGraphicsSceneResizeEvent *pEvent);
+
+    /** This event handler called when mouse hovers widget. */
+    void hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent);
+    /** This event handler called when mouse leaves widget. */
+    void hoverMoveEvent(QGraphicsSceneHoverEvent *pEvent);
+    /** Summarize two hover-event handlers above. */
+    void handleHoverEvent(QGraphicsSceneHoverEvent *pEvent);
+    /** Update hover stuff. */
+    void updateHoverStuff();
+
+    /** This event handler called when mouse press widget. */
+    void mousePressEvent(QGraphicsSceneMouseEvent *pEvent);
+
+    /** Paints the contents in local coordinates. */
+    void paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget = 0);
+
+    /** Builds new text-layout. */
+    static QTextLayout* buildTextLayout(const QFont &font, QPaintDevice *pPaintDevice,
+                                        const QString &strText, int iWidth, int &iHeight,
+                                        const QString &strHoveredAnchor);
+
+    /** Search for hovered anchor in passed text-layout @a list. */
+    static QString searchForHoveredAnchor(QPaintDevice *pPaintDevice, const QList<QTextLayout*> &list, const QPoint &mousePosition);
+
+    /** Paint-device to scale to. */
+    QPaintDevice *m_pPaintDevice;
+
+    /** Margin. */
+    const int m_iMargin;
+    /** Spacing. */
+    const int m_iSpacing;
+    /** Minimum text-column width: */
+    const int m_iMinimumTextColumnWidth;
+
+    /** Minimum size-hint invalidation flag. */
+    mutable bool m_fMinimumSizeHintInvalidated;
+    /** Minimum size-hint cache. */
+    mutable QSizeF m_minimumSizeHint;
+    /** Minimum text-width. */
+    int m_iMinimumTextWidth;
+    /** Minimum text-height. */
+    int m_iMinimumTextHeight;
+
+    /** Contained text. */
+    UITextTable m_text;
+    /** Left text-layout list. */
+    QList<QTextLayout*> m_leftList;
+    /** Right text-layout list. */
+    QList<QTextLayout*> m_rightList;
+
+    /** Holds whether anchor can be hovered. */
+    bool m_fAnchorCanBeHovered;
+    /** Holds restricted anchor roles. */
+    QSet<QString> m_restrictedAnchorRoles;
+    /** Holds currently hovered anchor. */
+    QString m_strHoveredAnchor;
+};
+
+#endif /* !___UIGraphicsTextPane_h___ */
+
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsToolBar.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsToolBar.cpp
index 7c8e843..f6b3b7a 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsToolBar.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsToolBar.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGraphicsToolBar.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsToolBar class definition
+ * VBox Qt GUI - UIGraphicsToolBar class definition.
  */
 
 /*
@@ -17,9 +15,16 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIGraphicsToolBar.h"
-#include "UIGraphicsButton.h"
+# include "UIGraphicsToolBar.h"
+# include "UIGraphicsButton.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGraphicsToolBar::UIGraphicsToolBar(QIGraphicsWidget *pParent, int iRows, int iColumns)
     : QIGraphicsWidget(pParent)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsToolBar.h b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsToolBar.h
index 5e6a905..a86f148 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsToolBar.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsToolBar.h
@@ -1,7 +1,6 @@
+/* $Id: UIGraphicsToolBar.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsToolBar class declaration
+ * VBox Qt GUI - UIGraphicsToolBar class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsZoomButton.cpp b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsZoomButton.cpp
index 0073613..0beea85 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsZoomButton.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsZoomButton.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIGraphicsZoomButton.cpp $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsZoomButton class definition
+ * VBox Qt GUI - UIGraphicsZoomButton class definition.
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QStateMachine>
-#include <QSignalTransition>
-#include <QPropertyAnimation>
-#include <QPainter>
-#include <QStyleOptionGraphicsItem>
+# include <QStateMachine>
+# include <QSignalTransition>
+# include <QPropertyAnimation>
+# include <QPainter>
+# include <QStyleOptionGraphicsItem>
 
 /* GUI includes: */
-#include "UIGraphicsZoomButton.h"
+# include "UIGraphicsZoomButton.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIGraphicsZoomButton::UIGraphicsZoomButton(QIGraphicsWidget *pParent, const QIcon &icon, int iDirection)
     : UIGraphicsButton(pParent, icon)
diff --git a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsZoomButton.h b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsZoomButton.h
index d458e08..416651b 100644
--- a/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsZoomButton.h
+++ b/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsZoomButton.h
@@ -1,7 +1,6 @@
+/* $Id: UIGraphicsZoomButton.h $ */
 /** @file
- *
- * VBox frontends: Qt GUI ("VirtualBox"):
- * UIGraphicsZoomButton class declaration
+ * VBox Qt GUI - UIGraphicsZoomButton class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.cpp
index 7cf2690..2dbed66 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizard.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizard class implementation
+ * VBox Qt GUI - UIWizard class implementation.
  */
 
 /*
@@ -17,16 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QAbstractButton>
-#include <QLayout>
-#include <qmath.h>
+# include <QAbstractButton>
+# include <QLayout>
 
 /* Local includes: */
-#include "UIWizard.h"
-#include "UIWizardPage.h"
-#include "VBoxGlobal.h"
-#include "QIRichTextLabel.h"
+# include "UIWizard.h"
+# include "UIWizardPage.h"
+# include "VBoxGlobal.h"
+# include "QIRichTextLabel.h"
+# include "UIExtraDataManager.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+#include <qmath.h>
+
 
 void UIWizard::sltCurrentIdChanged(int iId)
 {
@@ -36,7 +43,7 @@ void UIWizard::sltCurrentIdChanged(int iId)
     if (iId == 0)
         fIsHideShowDescriptionButtonAvailable = true;
     /* But first-run wizard has no such button anyway: */
-    if (m_type == UIWizardType_FirstRun)
+    if (m_type == WizardType_FirstRun)
         fIsHideShowDescriptionButtonAvailable = false;
     /* Set a flag for hide/show description button finally: */
     setOption(QWizard::HaveCustomButton1, fIsHideShowDescriptionButtonAvailable);
@@ -50,47 +57,25 @@ void UIWizard::sltCustomButtonClicked(int iId)
         /* Cleanup: */
         cleanup();
 
-        /* Compose wizard's name: */
-        QString strWizardName = nameForType(m_type);
-        /* Load mode settings: */
-        QStringList wizards = vboxGlobal().virtualBox().GetExtraDataStringList(GUI_HideDescriptionForWizards);
-
-        /* Switch mode: */
+        /* Toggle mode: */
         switch (m_mode)
         {
-            case UIWizardMode_Basic:
-            {
-                m_mode = UIWizardMode_Expert;
-                if (!wizards.contains(strWizardName))
-                    wizards << strWizardName;
-                break;
-            }
-            case UIWizardMode_Expert:
-            {
-                m_mode = UIWizardMode_Basic;
-                if (wizards.contains(strWizardName))
-                    wizards.removeAll(strWizardName);
-                break;
-            }
-            default:
-            {
-                AssertMsgFailed(("Invalid mode: %d", m_mode));
-                break;
-            }
+            case WizardMode_Basic:  m_mode = WizardMode_Expert; break;
+            case WizardMode_Expert: m_mode = WizardMode_Basic;  break;
+            default: AssertMsgFailed(("Invalid mode: %d", m_mode)); break;
         }
-
-        /* Save mode settings: */
-        vboxGlobal().virtualBox().SetExtraDataStringList(GUI_HideDescriptionForWizards, wizards);
+        /* Save mode: */
+        gEDataManager->setModeForWizardType(m_type, m_mode);
 
         /* Prepare: */
         prepare();
     }
 }
 
-UIWizard::UIWizard(QWidget *pParent, UIWizardType type, UIWizardMode mode)
+UIWizard::UIWizard(QWidget *pParent, WizardType type, WizardMode mode /* = WizardMode_Auto */)
     : QIWithRetranslateUI<QWizard>(pParent)
     , m_type(type)
-    , m_mode(mode == UIWizardMode_Auto ? loadModeForType(m_type) : mode)
+    , m_mode(mode == WizardMode_Auto ? gEDataManager->modeForWizardType(m_type) : mode)
 {
 #ifdef Q_WS_WIN
     /* Hide window icon: */
@@ -120,8 +105,14 @@ void UIWizard::retranslateUi()
     /* Translate basic/expert button: */
     switch (m_mode)
     {
-        case UIWizardMode_Basic: setButtonText(QWizard::CustomButton1, tr("Hide Description")); break;
-        case UIWizardMode_Expert: setButtonText(QWizard::CustomButton1, tr("Show Description")); break;
+        case WizardMode_Basic:
+            setButtonText(QWizard::CustomButton1, tr("&Expert Mode"));
+            button(QWizard::CustomButton1)->setToolTip(tr("Switch to <nobr><b>Expert Mode</b></nobr>, a one-page dialog for experienced users."));
+            break;
+        case WizardMode_Expert:
+            setButtonText(QWizard::CustomButton1, tr("&Guided Mode"));
+            button(QWizard::CustomButton1)->setToolTip(tr("Switch to <nobr><b>Guided Mode</b></nobr>, a step-by-step dialog with detailed explanations."));
+            break;
         default: AssertMsgFailed(("Invalid mode: %d", m_mode)); break;
     }
 }
@@ -188,7 +179,7 @@ void UIWizard::cleanup()
 void UIWizard::resizeToGoldenRatio()
 {
     /* Check if wizard is in basic or expert mode: */
-    if (m_mode == UIWizardMode_Expert)
+    if (m_mode == WizardMode_Expert)
     {
         /* Unfortunately QWizard hides some of useful API in private part,
          * and also have few layouting bugs which could be easy fixed
@@ -404,17 +395,17 @@ double UIWizard::ratio()
 
     switch (m_type)
     {
-        case UIWizardType_CloneVM:
+        case WizardType_CloneVM:
             dRatio -= 0.4;
             break;
-        case UIWizardType_NewVD:
-        case UIWizardType_CloneVD:
+        case WizardType_NewVD:
+        case WizardType_CloneVD:
             dRatio += 0.1;
             break;
-        case UIWizardType_ExportAppliance:
+        case WizardType_ExportAppliance:
             dRatio += 0.3;
             break;
-        case UIWizardType_FirstRun:
+        case WizardType_FirstRun:
             dRatio += 0.3;
             break;
         default:
@@ -441,7 +432,7 @@ int UIWizard::proposedWatermarkHeight()
 
     /* Acquire wizard-layout top-margin: */
     int iTopMargin = 0;
-    if (m_mode == UIWizardMode_Basic)
+    if (m_mode == WizardMode_Basic)
     {
         if (wizardStyle() == QWizard::ModernStyle)
             iTopMargin = pStyle->pixelMetric(QStyle::PM_LayoutTopMargin);
@@ -449,7 +440,7 @@ int UIWizard::proposedWatermarkHeight()
 
     /* Acquire wizard-header height: */
     int iTitleHeight = 0;
-    if (m_mode == UIWizardMode_Basic)
+    if (m_mode == WizardMode_Basic)
     {
         /* We have no direct access to QWizardHeader inside QWizard private data...
          * From Qt sources it seems title font is hardcoded as current font point-size + 4: */
@@ -461,7 +452,7 @@ int UIWizard::proposedWatermarkHeight()
 
     /* Acquire spacing between wizard-header and wizard-page: */
     int iMarginBetweenTitleAndPage = 0;
-    if (m_mode == UIWizardMode_Basic)
+    if (m_mode == WizardMode_Basic)
     {
         /* We have no direct access to margin between QWizardHeader and wizard-pages...
          * From Qt sources it seems its hardcoded as just 7 pixels: */
@@ -526,34 +517,3 @@ void UIWizard::assignWatermarkHelper()
 }
 #endif /* !Q_WS_MAC */
 
-/* static */
-QString UIWizard::nameForType(UIWizardType type)
-{
-    QString strName;
-    switch (type)
-    {
-        case UIWizardType_NewVM: strName = "NewVM"; break;
-        case UIWizardType_CloneVM: strName = "CloneVM"; break;
-        case UIWizardType_ExportAppliance: strName = "ExportAppliance"; break;
-        case UIWizardType_ImportAppliance: strName = "ImportAppliance"; break;
-        case UIWizardType_FirstRun: strName = "FirstRun"; break;
-        case UIWizardType_NewVD: strName = "NewVD"; break;
-        case UIWizardType_CloneVD: strName = "CloneVD"; break;
-    }
-    return strName;
-}
-
-/* static */
-UIWizardMode UIWizard::loadModeForType(UIWizardType type)
-{
-    /* Some wizard use only basic mode: */
-    if (type == UIWizardType_FirstRun)
-        return UIWizardMode_Basic;
-    /* Get mode from extra-data: */
-    QStringList wizards = vboxGlobal().virtualBox().GetExtraDataStringList(GUI_HideDescriptionForWizards);
-    if (wizards.contains(nameForType(type)))
-        return UIWizardMode_Expert;
-    /* Return mode: */
-    return UIWizardMode_Basic;
-}
-
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.h b/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.h
index ff8262f..704e452 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizard.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizard class declaration
+ * VBox Qt GUI - UIWizard class declaration.
  */
 
 /*
@@ -25,30 +24,11 @@
 
 /* Local includes: */
 #include "QIWithRetranslateUI.h"
+#include "UIExtraDataDefs.h"
 
 /* Forward declarations: */
 class UIWizardPage;
 
-/* Wizard type: */
-enum UIWizardType
-{
-    UIWizardType_NewVM,
-    UIWizardType_CloneVM,
-    UIWizardType_ExportAppliance,
-    UIWizardType_ImportAppliance,
-    UIWizardType_FirstRun,
-    UIWizardType_NewVD,
-    UIWizardType_CloneVD
-};
-
-/* Wizard mode: */
-enum UIWizardMode
-{
-    UIWizardMode_Auto,
-    UIWizardMode_Basic,
-    UIWizardMode_Expert
-};
-
 /* QWizard class reimplementation with extended funtionality. */
 class UIWizard : public QIWithRetranslateUI<QWizard>
 {
@@ -57,7 +37,7 @@ class UIWizard : public QIWithRetranslateUI<QWizard>
 public:
 
     /* Mode related stuff: */
-    UIWizardMode mode() { return m_mode; }
+    WizardMode mode() { return m_mode; }
 
     /* Page related methods: */
     virtual void prepare();
@@ -72,7 +52,7 @@ protected slots:
 protected:
 
     /* Constructor: */
-    UIWizard(QWidget *pParent, UIWizardType type, UIWizardMode mode = UIWizardMode_Auto);
+    UIWizard(QWidget *pParent, WizardType type, WizardMode mode = WizardMode_Auto);
 
     /* Translation stuff: */
     void retranslateUi();
@@ -105,12 +85,10 @@ private:
     int proposedWatermarkHeight();
     void assignWatermarkHelper();
 #endif /* !Q_WS_MAC */
-    static QString nameForType(UIWizardType type);
-    static UIWizardMode loadModeForType(UIWizardType type);
 
     /* Variables: */
-    UIWizardType m_type;
-    UIWizardMode m_mode;
+    WizardType m_type;
+    WizardMode m_mode;
 #ifndef Q_WS_MAC
     QString m_strWatermarkName;
 #endif /* !Q_WS_MAC */
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/UIWizardPage.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/UIWizardPage.cpp
index f0c6b63..48acf21 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/UIWizardPage.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/UIWizardPage.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardPage.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardPage class implementation
+ * VBox Qt GUI - UIWizardPage class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QAbstractButton>
+# include <QAbstractButton>
 
 /* Local includes: */
-#include "UIWizardPage.h"
-#include "UIWizard.h"
-#include "VBoxGlobal.h"
+# include "UIWizardPage.h"
+# include "UIWizard.h"
+# include "VBoxGlobal.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizard* UIWizardPageBase::wizardImp()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/UIWizardPage.h b/src/VBox/Frontends/VirtualBox/src/wizards/UIWizardPage.h
index 562920e..73653ac 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/UIWizardPage.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/UIWizardPage.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardPage.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardPage class declaration
+ * VBox Qt GUI - UIWizardPage class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp
index 3bcb5fa..367393c 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIWizardCloneVD.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVD class implementation
+ * VBox Qt GUI - UIWizardCloneVD class implementation.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,24 +15,31 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVariant>
+# include <QVariant>
 
 /* GUI includes: */
-#include "UIWizardCloneVD.h"
-#include "UIWizardCloneVDPageBasic1.h"
-#include "UIWizardCloneVDPageBasic2.h"
-#include "UIWizardCloneVDPageBasic3.h"
-#include "UIWizardCloneVDPageBasic4.h"
-#include "UIWizardCloneVDPageExpert.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
+# include "UIWizardCloneVD.h"
+# include "UIWizardCloneVDPageBasic1.h"
+# include "UIWizardCloneVDPageBasic2.h"
+# include "UIWizardCloneVDPageBasic3.h"
+# include "UIWizardCloneVDPageBasic4.h"
+# include "UIWizardCloneVDPageExpert.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
 
 /* COM includes: */
-#include "CMediumFormat.h"
+# include "CMediumFormat.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVD::UIWizardCloneVD(QWidget *pParent, const CMedium &sourceVirtualDisk)
-    : UIWizard(pParent, UIWizardType_CloneVD)
+    : UIWizard(pParent, WizardType_CloneVD)
     , m_sourceVirtualDisk(sourceVirtualDisk)
 {
 #ifndef Q_WS_MAC
@@ -62,7 +67,7 @@ bool UIWizardCloneVD::copyVirtualDisk()
     CVirtualBox vbox = vboxGlobal().virtualBox();
 
     /* Create new virtual hard-disk: */
-    CMedium virtualDisk = vbox.CreateHardDisk(mediumFormat.GetName(), strMediumPath);
+    CMedium virtualDisk = vbox.CreateMedium(mediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, KDeviceType_HardDisk);
     if (!vbox.isOk())
     {
         msgCenter().cannotCreateHardDiskStorage(vbox, strMediumPath, this);
@@ -120,7 +125,7 @@ void UIWizardCloneVD::prepare()
     /* Create corresponding pages: */
     switch (mode())
     {
-        case UIWizardMode_Basic:
+        case WizardMode_Basic:
         {
             setPage(Page1, new UIWizardCloneVDPageBasic1(m_sourceVirtualDisk));
             setPage(Page2, new UIWizardCloneVDPageBasic2);
@@ -128,7 +133,7 @@ void UIWizardCloneVD::prepare()
             setPage(Page4, new UIWizardCloneVDPageBasic4);
             break;
         }
-        case UIWizardMode_Expert:
+        case WizardMode_Expert:
         {
             setPage(PageExpert, new UIWizardCloneVDPageExpert(m_sourceVirtualDisk));
             break;
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h
index 822087c..5646500 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVD.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVD class declaration
+ * VBox Qt GUI - UIWizardCloneVD class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp
index e81caff..2109dd3 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVDPageBasic1.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageBasic1 class implementation
+ * VBox Qt GUI - UIWizardCloneVDPageBasic1 class implementation.
  */
 
 /*
@@ -17,18 +15,25 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QVBoxLayout>
-#include <QHBoxLayout>
+# include <QVBoxLayout>
+# include <QHBoxLayout>
 
 /* Local includes: */
-#include "UIWizardCloneVDPageBasic1.h"
-#include "UIWizardCloneVD.h"
-#include "UIIconPool.h"
-#include "QIRichTextLabel.h"
-#include "VBoxMediaComboBox.h"
-#include "QIToolButton.h"
-#include "UIMedium.h"
+# include "UIWizardCloneVDPageBasic1.h"
+# include "UIWizardCloneVD.h"
+# include "UIIconPool.h"
+# include "QIRichTextLabel.h"
+# include "VBoxMediaComboBox.h"
+# include "QIToolButton.h"
+# include "UIMedium.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVDPage1::UIWizardCloneVDPage1()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h
index 89a00a7..fae44c6 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic1.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVDPageBasic1.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageBasic1 class declaration
+ * VBox Qt GUI - UIWizardCloneVDPageBasic1 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp
index 9bc7a45..689fa44 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVDPageBasic2.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageBasic2 class implementation
+ * VBox Qt GUI - UIWizardCloneVDPageBasic2 class implementation.
  */
 
 /*
@@ -17,19 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QButtonGroup>
-#include <QRadioButton>
+# include <QVBoxLayout>
+# include <QButtonGroup>
+# include <QRadioButton>
 
 /* GUI includes: */
-#include "UIWizardCloneVDPageBasic2.h"
-#include "UIWizardCloneVD.h"
-#include "VBoxGlobal.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardCloneVDPageBasic2.h"
+# include "UIWizardCloneVD.h"
+# include "VBoxGlobal.h"
+# include "QIRichTextLabel.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVDPage2::UIWizardCloneVDPage2()
 {
@@ -45,8 +50,8 @@ void UIWizardCloneVDPage2::addFormatButton(QWidget *pParent, QVBoxLayout *pForma
     for (int i = 0; i < capabilities.size(); i++)
         uFormatCapabilities |= capabilities[i];
 
-    if (!(uFormatCapabilities & MediumFormatCapabilities_CreateFixed ||
-          uFormatCapabilities & MediumFormatCapabilities_CreateDynamic))
+    if (!(uFormatCapabilities & KMediumFormatCapabilities_CreateFixed ||
+          uFormatCapabilities & KMediumFormatCapabilities_CreateDynamic))
         return;
 
     /* Check that medium format supports creation of virtual hard-disks: */
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h
index 0e10dc4..68a5cd0 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic2.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVDPageBasic2.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageBasic2 class declaration
+ * VBox Qt GUI - UIWizardCloneVDPageBasic2 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp
index a69254b..b89c804 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVDPageBasic3.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageBasic3 class implementation
+ * VBox Qt GUI - UIWizardCloneVDPageBasic3 class implementation.
  */
 
 /*
@@ -17,19 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QButtonGroup>
-#include <QRadioButton>
-#include <QCheckBox>
+# include <QVBoxLayout>
+# include <QButtonGroup>
+# include <QRadioButton>
+# include <QCheckBox>
 
 /* GUI includes: */
-#include "UIWizardCloneVDPageBasic3.h"
-#include "UIWizardCloneVD.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardCloneVDPageBasic3.h"
+# include "UIWizardCloneVD.h"
+# include "QIRichTextLabel.h"
 
 /* COM includes: */
-#include "CMediumFormat.h"
+# include "CMediumFormat.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVDPage3::UIWizardCloneVDPage3()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.h
index dca632c..7e06b74 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic3.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVDPageBasic3.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageBasic3 class declaration
+ * VBox Qt GUI - UIWizardCloneVDPageBasic3 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp
index 4fec7ba..cbc4878 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVDPageBasic4.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageBasic4 class implementation
+ * VBox Qt GUI - UIWizardCloneVDPageBasic4 class implementation.
  */
 
 /*
@@ -17,24 +15,31 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QLineEdit>
+# include <QDir>
+# include <QVBoxLayout>
+# include <QHBoxLayout>
+# include <QLineEdit>
 
 /* GUI includes: */
-#include "UIWizardCloneVDPageBasic4.h"
-#include "UIWizardCloneVD.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIIconPool.h"
-#include "QIFileDialog.h"
-#include "QIRichTextLabel.h"
-#include "QIToolButton.h"
+# include "UIWizardCloneVDPageBasic4.h"
+# include "UIWizardCloneVD.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIIconPool.h"
+# include "QIFileDialog.h"
+# include "QIRichTextLabel.h"
+# include "QIToolButton.h"
 
 /* COM includes: */
-#include "CMediumFormat.h"
+# include "CMediumFormat.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVDPage4::UIWizardCloneVDPage4()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.h
index f8b14bf..778629d 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVDPageBasic4.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageBasic4 class declaration
+ * VBox Qt GUI - UIWizardCloneVDPageBasic4 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp
index 49c8c63..2ef4454 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVDPageExpert.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageExpert class implementation
+ * VBox Qt GUI - UIWizardCloneVDPageExpert class implementation.
  */
 
 /*
@@ -17,26 +15,33 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QGridLayout>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QButtonGroup>
-#include <QGroupBox>
-#include <QRadioButton>
-#include <QCheckBox>
-#include <QLineEdit>
+# include <QGridLayout>
+# include <QVBoxLayout>
+# include <QHBoxLayout>
+# include <QButtonGroup>
+# include <QGroupBox>
+# include <QRadioButton>
+# include <QCheckBox>
+# include <QLineEdit>
 
 /* GUI includes: */
-#include "UIWizardCloneVDPageExpert.h"
-#include "UIWizardCloneVD.h"
-#include "UIMessageCenter.h"
-#include "UIIconPool.h"
-#include "VBoxMediaComboBox.h"
-#include "QIToolButton.h"
+# include "UIWizardCloneVDPageExpert.h"
+# include "UIWizardCloneVD.h"
+# include "UIMessageCenter.h"
+# include "UIIconPool.h"
+# include "VBoxMediaComboBox.h"
+# include "QIToolButton.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVDPageExpert::UIWizardCloneVDPageExpert(const CMedium &sourceVirtualDisk)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.h
index 60635b6..bd9f9e9 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVDPageExpert.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVDPageExpert class declaration
+ * VBox Qt GUI - UIWizardCloneVDPageExpert class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
index 90b33e1..b5195db 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIWizardCloneVM.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVM class implementation
+ * VBox Qt GUI - UIWizardCloneVM class implementation.
  */
 
 /*
- * Copyright (C) 2011-2013 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,20 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIWizardCloneVM.h"
-#include "UIWizardCloneVMPageBasic1.h"
-#include "UIWizardCloneVMPageBasic2.h"
-#include "UIWizardCloneVMPageBasic3.h"
-#include "UIWizardCloneVMPageExpert.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
+# include "UIWizardCloneVM.h"
+# include "UIWizardCloneVMPageBasic1.h"
+# include "UIWizardCloneVMPageBasic2.h"
+# include "UIWizardCloneVMPageBasic3.h"
+# include "UIWizardCloneVMPageExpert.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
 
 /* COM includes: */
-#include "CConsole.h"
+# include "CConsole.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVM::UIWizardCloneVM(QWidget *pParent, const CMachine &machine, CSnapshot snapshot /* = CSnapshot() */)
-    : UIWizard(pParent, UIWizardType_CloneVM)
+    : UIWizard(pParent, WizardType_CloneVM)
     , m_machine(machine)
     , m_snapshot(snapshot)
 {
@@ -52,8 +57,8 @@ bool UIWizardCloneVM::cloneVM()
     /* Should we create linked clone? */
     bool fLinked = field("linkedClone").toBool();
     /* Get clone mode: */
-    KCloneMode cloneMode = (mode() == UIWizardMode_Basic && page(Page3)) ||
-                           (mode() == UIWizardMode_Expert && page(PageExpert)) ?
+    KCloneMode cloneMode = (mode() == WizardMode_Basic && page(Page3)) ||
+                           (mode() == WizardMode_Expert && page(PageExpert)) ?
                            field("cloneMode").value<KCloneMode>() : KCloneMode_MachineState;
 
     /* Get VBox object: */
@@ -73,14 +78,14 @@ bool UIWizardCloneVM::cloneVM()
         if (session.isNull())
             return false;
 
-        /* Prepare console: */
-        CConsole console = session.GetConsole();
+        /* Prepare machine: */
+        CMachine machine = session.GetMachine();
 
         /* Take the snapshot: */
         QString strSnapshotName = tr("Linked Base for %1 and %2").arg(m_machine.GetName()).arg(strName);
-        CProgress progress = console.TakeSnapshot(strSnapshotName, "");
+        CProgress progress = machine.TakeSnapshot(strSnapshotName, "", true);
 
-        if (console.isOk())
+        if (machine.isOk())
         {
             /* Show the "Taking Snapshot" progress dialog: */
             msgCenter().showModalProgressDialog(progress, m_machine.GetName(), ":/progress_snapshot_create_90px.png", this);
@@ -93,7 +98,7 @@ bool UIWizardCloneVM::cloneVM()
         }
         else
         {
-            msgCenter().cannotTakeSnapshot(console, m_machine.GetName(), this);
+            msgCenter().cannotTakeSnapshot(machine, m_machine.GetName(), this);
             return false;
         }
 
@@ -171,7 +176,7 @@ void UIWizardCloneVM::prepare()
     /* Create corresponding pages: */
     switch (mode())
     {
-        case UIWizardMode_Basic:
+        case WizardMode_Basic:
         {
             setPage(Page1, new UIWizardCloneVMPageBasic1(m_machine.GetName()));
             setPage(Page2, new UIWizardCloneVMPageBasic2(m_snapshot.isNull()));
@@ -179,7 +184,7 @@ void UIWizardCloneVM::prepare()
                 setPage(Page3, new UIWizardCloneVMPageBasic3(m_snapshot.isNull() ? false : m_snapshot.GetChildrenCount() > 0));
             break;
         }
-        case UIWizardMode_Expert:
+        case WizardMode_Expert:
         {
             setPage(PageExpert, new UIWizardCloneVMPageExpert(m_machine.GetName(),
                                                               m_snapshot.isNull(),
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.h
index 16e607b..6e7f367 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVM.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVM class declaration
+ * VBox Qt GUI - UIWizardCloneVM class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp
index cf0d586..57fae62 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVMPageBasic1.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVMPageBasic1 class implementation
+ * VBox Qt GUI - UIWizardCloneVMPageBasic1 class implementation.
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QLineEdit>
-#include <QCheckBox>
+# include <QVBoxLayout>
+# include <QLineEdit>
+# include <QCheckBox>
 
 /* GUI includes: */
-#include "UIWizardCloneVMPageBasic1.h"
-#include "UIWizardCloneVM.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardCloneVMPageBasic1.h"
+# include "UIWizardCloneVM.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVMPage1::UIWizardCloneVMPage1(const QString &strOriginalName)
     : m_strOriginalName(strOriginalName)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.h
index 4c7d327..9c81aa6 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic1.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVMPageBasic1.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVMPageBasic1 class declaration
+ * VBox Qt GUI - UIWizardCloneVMPageBasic1 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp
index fdabf5d..90e70e6 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVMPageBasic2.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVMPageBasic2 class implementation
+ * VBox Qt GUI - UIWizardCloneVMPageBasic2 class implementation.
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QRadioButton>
-#include <QButtonGroup>
+# include <QVBoxLayout>
+# include <QRadioButton>
+# include <QButtonGroup>
 
 /* GUI includes: */
-#include "UIWizardCloneVMPageBasic2.h"
-#include "UIWizardCloneVM.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardCloneVMPageBasic2.h"
+# include "UIWizardCloneVM.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVMPage2::UIWizardCloneVMPage2(bool fAdditionalInfo)
     : m_fAdditionalInfo(fAdditionalInfo)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.h
index afadafb..8fb0e92 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic2.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVMPageBasic2.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVMPageBasic2 class declaration
+ * VBox Qt GUI - UIWizardCloneVMPageBasic2 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp
index 12471cc..9f458ca 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic3.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVMPageBasic3.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVMPageBasic3 class implementation
+ * VBox Qt GUI - UIWizardCloneVMPageBasic3 class implementation.
  */
 
 /*
@@ -17,14 +15,21 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QVBoxLayout>
-#include <QRadioButton>
+# include <QVBoxLayout>
+# include <QRadioButton>
 
 /* Local includes: */
-#include "UIWizardCloneVMPageBasic3.h"
-#include "UIWizardCloneVM.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardCloneVMPageBasic3.h"
+# include "UIWizardCloneVM.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVMPage3::UIWizardCloneVMPage3(bool fShowChildsOption)
     : m_fShowChildsOption(fShowChildsOption)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic3.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic3.h
index 3ade2ca..3ff3296 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic3.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageBasic3.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVMPageBasic3.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVMPageBasic3 class declaration
+ * VBox Qt GUI - UIWizardCloneVMPageBasic3 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp
index a88dfcb..5e10e8f 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardCloneVMPageExpert.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVMPageExpert class implementation
+ * VBox Qt GUI - UIWizardCloneVMPageExpert class implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QGridLayout>
-#include <QButtonGroup>
-#include <QGroupBox>
-#include <QLineEdit>
-#include <QCheckBox>
-#include <QRadioButton>
+# include <QGridLayout>
+# include <QButtonGroup>
+# include <QGroupBox>
+# include <QLineEdit>
+# include <QCheckBox>
+# include <QRadioButton>
 
 /* Local includes: */
-#include "UIWizardCloneVMPageExpert.h"
-#include "UIWizardCloneVM.h"
+# include "UIWizardCloneVMPageExpert.h"
+# include "UIWizardCloneVM.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardCloneVMPageExpert::UIWizardCloneVMPageExpert(const QString &strOriginalName, bool fAdditionalInfo, bool fShowChildsOption)
     : UIWizardCloneVMPage1(strOriginalName)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.h b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.h
index 3edfd7e..f13c122 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVMPageExpert.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardCloneVMPageExpert.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardCloneVMPageExpert class declaration
+ * VBox Qt GUI - UIWizardCloneVMPageExpert class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp
index 0dee59e..5a9fec6 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardExportApp.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportApp class implementation
+ * VBox Qt GUI - UIWizardExportApp class implementation.
  */
 
 /*
@@ -17,26 +15,35 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVariant>
-#include <QFileInfo>
+# include <QVariant>
+# include <QFileInfo>
 
 /* GUI includes: */
-#include "UIWizardExportApp.h"
-#include "UIWizardExportAppDefs.h"
-#include "UIWizardExportAppPageBasic1.h"
-#include "UIWizardExportAppPageBasic2.h"
-#include "UIWizardExportAppPageBasic3.h"
-#include "UIWizardExportAppPageBasic4.h"
-#include "UIWizardExportAppPageExpert.h"
-#include "UIMessageCenter.h"
+# include "UIWizardExportApp.h"
+# include "UIWizardExportAppDefs.h"
+# include "UIWizardExportAppPageBasic1.h"
+# include "UIWizardExportAppPageBasic2.h"
+# include "UIWizardExportAppPageBasic3.h"
+# include "UIWizardExportAppPageBasic4.h"
+# include "UIWizardExportAppPageExpert.h"
+# include "UIAddDiskEncryptionPasswordDialog.h"
+# include "UIMessageCenter.h"
 
 /* COM includes: */
-#include "CAppliance.h"
+# include "CAppliance.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #include "CVFSExplorer.h"
 
+
 UIWizardExportApp::UIWizardExportApp(QWidget *pParent, const QStringList &selectedVMNames)
-    : UIWizard(pParent, UIWizardType_ExportAppliance)
+    : UIWizard(pParent, WizardType_ExportAppliance)
     , m_selectedVMNames(selectedVMNames)
 {
 #ifndef Q_WS_MAC
@@ -86,7 +93,7 @@ bool UIWizardExportApp::exportAppliance()
     {
         /* Show some progress, so the user know whats going on: */
         msgCenter().showModalProgressDialog(progress, QApplication::translate("UIWizardExportApp", "Checking files ..."),
-                                            ":/refresh_32px.png", this);
+                                            ":/progress_refresh_90px.png", this);
         if (progress.GetCanceled())
             return false;
         if (!progress.isOk() || progress.GetResultCode() != 0)
@@ -108,7 +115,7 @@ bool UIWizardExportApp::exportAppliance()
         {
             /* Show some progress, so the user know whats going on: */
             msgCenter().showModalProgressDialog(progress1, QApplication::translate("UIWizardExportApp", "Removing files ..."),
-                                                ":/vm_delete_32px.png", this);
+                                                ":/progress_delete_90px.png", this);
             if (progress1.GetCanceled())
                 return false;
             if (!progress1.isOk() || progress1.GetResultCode() != 0)
@@ -120,23 +127,64 @@ bool UIWizardExportApp::exportAppliance()
     }
 
     /* Export the VMs, on success we are finished: */
-    if (exportVMs(*pAppliance))
-    {
-#if 0
-        /* Save attributes to GUI extra data: */
-        StorageType storageType = field("storageType").value<StorageType>();
-        vboxGlobal().virtualBox().SetExtraData(GUI_Export_StorageType, QString::number(storageType));
-        vboxGlobal().virtualBox().SetExtraData(GUI_Export_Username, m_pLeUsername->text());
-        vboxGlobal().virtualBox().SetExtraData(GUI_Export_Hostname, m_pLeHostname->text());
-        vboxGlobal().virtualBox().SetExtraData(GUI_Export_Bucket, m_pLeBucket->text());
-#endif
-        return true;
-    }
-    return false;
+    return exportVMs(*pAppliance);
 }
 
 bool UIWizardExportApp::exportVMs(CAppliance &appliance)
 {
+    /* Get the map of the password IDs: */
+    EncryptedMediumMap encryptedMediums;
+    foreach (const QString &strPasswordId, appliance.GetPasswordIds())
+        foreach (const QString &strMediumId, appliance.GetMediumIdsForPasswordId(strPasswordId))
+            encryptedMediums.insert(strPasswordId, strMediumId);
+
+    /* Ask for the disk encryption passwords if necessary: */
+    if (!encryptedMediums.isEmpty())
+    {
+        /* Create corresponding dialog: */
+        QPointer<UIAddDiskEncryptionPasswordDialog> pDlg =
+             new UIAddDiskEncryptionPasswordDialog(this,
+                                                   window()->windowTitle(),
+                                                   encryptedMediums);
+
+        /* Execute the dialog: */
+        if (pDlg->exec() == QDialog::Accepted)
+        {
+            /* Acquire the passwords provided: */
+            const EncryptionPasswordMap encryptionPasswords = pDlg->encryptionPasswords();
+
+            /* Delete the dialog: */
+            delete pDlg;
+
+            /* Make sure the passwords were really provided: */
+            AssertReturn(!encryptionPasswords.isEmpty(), false);
+
+            /* Provide appliance with passwords if possible: */
+            appliance.AddPasswords(encryptionPasswords.keys().toVector(),
+                                   encryptionPasswords.values().toVector());
+            if (!appliance.isOk())
+            {
+                /* Warn the user about failure: */
+                msgCenter().cannotAddDiskEncryptionPassword(appliance);
+
+                return false;
+            }
+        }
+        else
+        {
+            /* Any modal dialog can be destroyed in own event-loop
+             * as a part of application termination procedure..
+             * We have to check if the dialog still valid. */
+            if (pDlg)
+            {
+                /* Delete the dialog: */
+                delete pDlg;
+            }
+
+            return false;
+        }
+    }
+
     /* Write the appliance: */
     QVector<KExportOptions> options;
     if (field("manifestSelected").toBool())
@@ -212,8 +260,8 @@ void UIWizardExportApp::sltCurrentIdChanged(int iId)
     /* Call to base-class: */
     UIWizard::sltCurrentIdChanged(iId);
     /* Enable 2nd button (Reset to Defaults) for 4th and Expert pages only! */
-    setOption(QWizard::HaveCustomButton2, (mode() == UIWizardMode_Basic && iId == Page4) ||
-                                          (mode() == UIWizardMode_Expert && iId == PageExpert));
+    setOption(QWizard::HaveCustomButton2, (mode() == WizardMode_Basic && iId == Page4) ||
+                                          (mode() == WizardMode_Expert && iId == PageExpert));
 }
 
 void UIWizardExportApp::sltCustomButtonClicked(int iId)
@@ -248,7 +296,7 @@ void UIWizardExportApp::prepare()
     /* Create corresponding pages: */
     switch (mode())
     {
-        case UIWizardMode_Basic:
+        case WizardMode_Basic:
         {
             setPage(Page1, new UIWizardExportAppPageBasic1(m_selectedVMNames));
             setPage(Page2, new UIWizardExportAppPageBasic2);
@@ -256,7 +304,7 @@ void UIWizardExportApp::prepare()
             setPage(Page4, new UIWizardExportAppPageBasic4);
             break;
         }
-        case UIWizardMode_Expert:
+        case WizardMode_Expert:
         {
             setPage(PageExpert, new UIWizardExportAppPageExpert(m_selectedVMNames));
             break;
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.h
index 912f9ae..eb3e677 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardExportApp.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportApp class declaration
+ * VBox Qt GUI - UIWizardExportApp class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h
index 0022285..42b6996 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardExportAppDefs.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppDefs class declaration
+ * VBox Qt GUI - UIWizardExportAppDefs class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp
index 7990567..7b840b7 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardExportAppPageBasic1.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageBasic1 class implementation
+ * VBox Qt GUI - UIWizardExportAppPageBasic1 class implementation.
  */
 
 /*
@@ -17,20 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
+# include <QVBoxLayout>
 
 /* Local includes: */
-#include "UIWizardExportAppPageBasic1.h"
-#include "UIWizardExportApp.h"
-#include "UIWizardExportAppDefs.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "QILabelSeparator.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardExportAppPageBasic1.h"
+# include "UIWizardExportApp.h"
+# include "UIWizardExportAppDefs.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "QILabelSeparator.h"
+# include "QIRichTextLabel.h"
 
 /* COM includes: */
-#include "CMachine.h"
+# include "CMachine.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardExportAppPage1::UIWizardExportAppPage1()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.h
index d677a31..6fc362c 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardExportAppPageBasic1.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageBasic1 class declaration
+ * VBox Qt GUI - UIWizardExportAppPageBasic1 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp
index 2777888..156c860 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardExportAppPageBasic2.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageBasic2 class implementation
+ * VBox Qt GUI - UIWizardExportAppPageBasic2 class implementation.
  */
 
 /*
@@ -17,15 +15,22 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QVBoxLayout>
-#include <QGroupBox>
-#include <QRadioButton>
+# include <QVBoxLayout>
+# include <QGroupBox>
+# include <QRadioButton>
 
 /* Local includes: */
-#include "UIWizardExportAppPageBasic2.h"
-#include "UIWizardExportApp.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardExportAppPageBasic2.h"
+# include "UIWizardExportApp.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardExportAppPage2::UIWizardExportAppPage2()
 {
@@ -33,17 +38,8 @@ UIWizardExportAppPage2::UIWizardExportAppPage2()
 
 void UIWizardExportAppPage2::chooseDefaultStorageType()
 {
-    /* Select default storage type: */
-#if 0
-    /* Load storage-type from GUI extra data: */
-    bool ok;
-    StorageType storageType = StorageType(vboxGlobal().virtualBox().GetExtraData(GUI_Export_StorageType).toInt(&ok));
-    if (ok)
-        setStorageType(storageType);
-#else
     /* Just select first of types: */
     setStorageType(Filesystem);
-#endif
 }
 
 StorageType UIWizardExportAppPage2::storageType() const
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h
index bfc4827..29d9d04 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardExportAppPageBasic2.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageBasic2 class declaration
+ * VBox Qt GUI - UIWizardExportAppPageBasic2 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp
index 771ebf8..3c1fdb0 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardExportAppPageBasic3.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageBasic3 class implementation
+ * VBox Qt GUI - UIWizardExportAppPageBasic3 class implementation.
  */
 
 /*
@@ -17,22 +15,29 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QDir>
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include <QLabel>
-#include <QLineEdit>
-#include <QComboBox>
-#include <QCheckBox>
+# include <QDir>
+# include <QVBoxLayout>
+# include <QGridLayout>
+# include <QLabel>
+# include <QLineEdit>
+# include <QComboBox>
+# include <QCheckBox>
 
 /* Local includes: */
-#include "UIWizardExportAppPageBasic3.h"
-#include "UIWizardExportApp.h"
-#include "UIWizardExportAppDefs.h"
-#include "VBoxGlobal.h"
-#include "VBoxFilePathSelectorWidget.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardExportAppPageBasic3.h"
+# include "UIWizardExportApp.h"
+# include "UIWizardExportAppDefs.h"
+# include "VBoxGlobal.h"
+# include "VBoxFilePathSelectorWidget.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardExportAppPage3::UIWizardExportAppPage3()
 {
@@ -40,15 +45,8 @@ UIWizardExportAppPage3::UIWizardExportAppPage3()
 
 void UIWizardExportAppPage3::chooseDefaultSettings()
 {
-    /* Select default settings: */
-#if 0
-    m_pUsernameEditor->setText(vboxGlobal().virtualBox().GetExtraData(GUI_Export_Username));
-    m_pHostnameEditor->setText(vboxGlobal().virtualBox().GetExtraData(GUI_Export_Hostname));
-    m_pBucketEditor->setText(vboxGlobal().virtualBox().GetExtraData(GUI_Export_Bucket));
-#else
-    /* Choose defalt format: */
+    /* Choose default format: */
     setFormat("ovf-1.0");
-#endif
 }
 
 void UIWizardExportAppPage3::refreshCurrentSettings()
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h
index 09ddb1f..c2feb00 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardExportAppPageBasic3.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageBasic3 class declaration
+ * VBox Qt GUI - UIWizardExportAppPageBasic3 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp
index 484a8c4..316c242 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardExportAppPageBasic4.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageBasic4 class implementation
+ * VBox Qt GUI - UIWizardExportAppPageBasic4 class implementation.
  */
 
 /*
@@ -17,20 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
+# include <QVBoxLayout>
 
 /* GUI includes: */
-#include "UIWizardExportAppPageBasic4.h"
-#include "UIWizardExportApp.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "QILabelSeparator.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardExportAppPageBasic4.h"
+# include "UIWizardExportApp.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "QILabelSeparator.h"
+# include "QIRichTextLabel.h"
 
 /* COM includes: */
-#include "CAppliance.h"
-#include "CMachine.h"
+# include "CAppliance.h"
+# include "CMachine.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardExportAppPage4::UIWizardExportAppPage4()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.h
index c4030e6..eada62f 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardExportAppPageBasic4.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageBasic4 class declaration
+ * VBox Qt GUI - UIWizardExportAppPageBasic4 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp
index 9628b00..06431aa 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardExportAppPageExpert.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageExpert class implementation
+ * VBox Qt GUI - UIWizardExportAppPageExpert class implementation.
  */
 
 /*
@@ -17,24 +15,31 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include <QListWidget>
-#include <QGroupBox>
-#include <QRadioButton>
-#include <QLineEdit>
-#include <QLabel>
-#include <QCheckBox>
-#include <QGroupBox>
+# include <QVBoxLayout>
+# include <QGridLayout>
+# include <QListWidget>
+# include <QGroupBox>
+# include <QRadioButton>
+# include <QLineEdit>
+# include <QLabel>
+# include <QCheckBox>
+# include <QGroupBox>
 
 /* Local includes: */
-#include "UIWizardExportAppPageExpert.h"
-#include "UIWizardExportApp.h"
-#include "UIWizardExportAppDefs.h"
-#include "VBoxGlobal.h"
-#include "VBoxFilePathSelectorWidget.h"
-#include "UIApplianceExportEditorWidget.h"
+# include "UIWizardExportAppPageExpert.h"
+# include "UIWizardExportApp.h"
+# include "UIWizardExportAppDefs.h"
+# include "VBoxGlobal.h"
+# include "VBoxFilePathSelectorWidget.h"
+# include "UIApplianceExportEditorWidget.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardExportAppPageExpert::UIWizardExportAppPageExpert(const QStringList &selectedVMNames)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h
index 646b4c3..96a9437 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardExportAppPageExpert.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardExportAppPageExpert class declaration
+ * VBox Qt GUI - UIWizardExportAppPageExpert class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.cpp
index d269070..e85c1b5 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardFirstRun.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardFirstRun class implementation
+ * VBox Qt GUI - UIWizardFirstRun class implementation.
  */
 
 /*
@@ -17,19 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "UIWizardFirstRun.h"
-#include "UIWizardFirstRunPageBasic.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIMedium.h"
+# include "UIWizardFirstRun.h"
+# include "UIWizardFirstRunPageBasic.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIMedium.h"
 
 /* COM includes: */
-#include "CStorageController.h"
-#include "CMediumAttachment.h"
+# include "CStorageController.h"
+# include "CMediumAttachment.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardFirstRun::UIWizardFirstRun(QWidget *pParent, const CMachine &machine)
-    : UIWizard(pParent, UIWizardType_FirstRun)
+    : UIWizard(pParent, WizardType_FirstRun)
     , m_machine(machine)
     , m_fHardDiskWasSet(isBootHardDiskAttached(m_machine))
 {
@@ -102,12 +107,12 @@ void UIWizardFirstRun::prepare()
     /* Create corresponding pages: */
     switch (mode())
     {
-        case UIWizardMode_Basic:
+        case WizardMode_Basic:
         {
             setPage(Page, new UIWizardFirstRunPageBasic(m_machine.GetId(), m_fHardDiskWasSet));
             break;
         }
-        case UIWizardMode_Expert:
+        case WizardMode_Expert:
         {
             AssertMsgFailed(("First-run wizard has no expert-mode!"));
             break;
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.h b/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.h
index fc8509d..d3d8896 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardFirstRun.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardFirstRun class declaration
+ * VBox Qt GUI - UIWizardFirstRun class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp
index bc81ccc..866054d 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardFirstRunPageBasic.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardFirstRunPageBasic class implementation
+ * VBox Qt GUI - UIWizardFirstRunPageBasic class implementation.
  */
 
 /*
@@ -17,20 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QHBoxLayout>
+# include <QVBoxLayout>
+# include <QHBoxLayout>
 
 /* GUI includes: */
-#include "UIWizardFirstRunPageBasic.h"
-#include "UIWizardFirstRun.h"
-#include "UIIconPool.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "VBoxMediaComboBox.h"
-#include "QIToolButton.h"
-#include "QIRichTextLabel.h"
-#include "UIMedium.h"
+# include "UIWizardFirstRunPageBasic.h"
+# include "UIWizardFirstRun.h"
+# include "UIIconPool.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "VBoxMediaComboBox.h"
+# include "QIToolButton.h"
+# include "QIRichTextLabel.h"
+# include "UIMedium.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardFirstRunPage::UIWizardFirstRunPage(bool fBootHardDiskWasSet)
     : m_fBootHardDiskWasSet(fBootHardDiskWasSet)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.h b/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.h
index da2334a..dd62cdd 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRunPageBasic.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardFirstRunPageBasic.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardFirstRunPageBasic class declaration
+ * VBox Qt GUI - UIWizardFirstRunPageBasic class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp
index e5b9c83..c763f53 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardImportApp.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportApp class implementation
+ * VBox Qt GUI - UIWizardImportApp class implementation.
  */
 
 /*
@@ -17,21 +15,29 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QDialogButtonBox>
+# include <QDialogButtonBox>
+# include <QPushButton>
+# include <QTextStream>
+
+/* Local includes: */
+# include "UIWizardImportApp.h"
+# include "UIWizardImportAppPageBasic1.h"
+# include "UIWizardImportAppPageBasic2.h"
+# include "UIWizardImportAppPageExpert.h"
+# include "VBoxGlobal.h"
+# include "QIDialog.h"
+# include "QIFileDialog.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 #include <QPrintDialog>
 #include <QPrinter>
-#include <QPushButton>
-#include <QTextStream>
 
-/* Local includes: */
-#include "UIWizardImportApp.h"
-#include "UIWizardImportAppPageBasic1.h"
-#include "UIWizardImportAppPageBasic2.h"
-#include "UIWizardImportAppPageExpert.h"
-#include "VBoxGlobal.h"
-#include "QIDialog.h"
-#include "QIFileDialog.h"
 
 /* Import license viewer: */
 class UIImportLicenseViewer : public QIDialog
@@ -135,7 +141,7 @@ private:
 };
 
 UIWizardImportApp::UIWizardImportApp(QWidget *pParent, const QString &strFileName)
-    : UIWizard(pParent, UIWizardType_ImportAppliance)
+    : UIWizard(pParent, WizardType_ImportAppliance)
     , m_strFileName(strFileName)
 {
 #ifndef Q_WS_MAC
@@ -183,8 +189,8 @@ void UIWizardImportApp::sltCurrentIdChanged(int iId)
     /* Call to base-class: */
     UIWizard::sltCurrentIdChanged(iId);
     /* Enable 2nd button (Reset to Defaults) for 2nd and Expert pages only! */
-    setOption(QWizard::HaveCustomButton2, (mode() == UIWizardMode_Basic && iId == Page2) ||
-                                          (mode() == UIWizardMode_Expert && iId == PageExpert));
+    setOption(QWizard::HaveCustomButton2, (mode() == WizardMode_Basic && iId == Page2) ||
+                                          (mode() == WizardMode_Expert && iId == PageExpert));
 }
 
 void UIWizardImportApp::sltCustomButtonClicked(int iId)
@@ -219,14 +225,14 @@ void UIWizardImportApp::prepare()
     /* Create corresponding pages: */
     switch (mode())
     {
-        case UIWizardMode_Basic:
+        case WizardMode_Basic:
         {
             if (m_strFileName.isEmpty())
                 setPage(Page1, new UIWizardImportAppPageBasic1);
             setPage(Page2, new UIWizardImportAppPageBasic2(m_strFileName));
             break;
         }
-        case UIWizardMode_Expert:
+        case WizardMode_Expert:
         {
             setPage(PageExpert, new UIWizardImportAppPageExpert(m_strFileName));
             break;
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.h b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.h
index fb1a7e1..17ad76c 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportApp.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardImportApp.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportApp class declaration
+ * VBox Qt GUI - UIWizardImportApp class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppDefs.h b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppDefs.h
index 3524c11..023cb01 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppDefs.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppDefs.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardImportAppDefs.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportAppDefs class declaration
+ * VBox Qt GUI - UIWizardImportAppDefs class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
index ee8dc0f..5763714 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardImportAppPageBasic1.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportAppPageBasic1 class implementation
+ * VBox Qt GUI - UIWizardImportAppPageBasic1 class implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QFileInfo>
-#include <QVBoxLayout>
+# include <QFileInfo>
+# include <QVBoxLayout>
 
 /* Local includes: */
-#include "UIWizardImportAppPageBasic1.h"
-#include "UIWizardImportAppPageBasic2.h"
-#include "UIWizardImportApp.h"
-#include "VBoxGlobal.h"
-#include "VBoxFilePathSelectorWidget.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardImportAppPageBasic1.h"
+# include "UIWizardImportAppPageBasic2.h"
+# include "UIWizardImportApp.h"
+# include "VBoxGlobal.h"
+# include "VBoxFilePathSelectorWidget.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardImportAppPage1::UIWizardImportAppPage1()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h
index db425bb..d88d2ef 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardImportAppPageBasic1.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportAppPageBasic1 class declaration
+ * VBox Qt GUI - UIWizardImportAppPageBasic1 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp
index b5831f6..4da6622 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardImportAppPageBasic2.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportAppPageBasic2 class implementation
+ * VBox Qt GUI - UIWizardImportAppPageBasic2 class implementation.
  */
 
 /*
@@ -17,13 +15,20 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QVBoxLayout>
+# include <QVBoxLayout>
 
 /* Local includes: */
-#include "UIWizardImportAppPageBasic2.h"
-#include "UIWizardImportApp.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardImportAppPageBasic2.h"
+# include "UIWizardImportApp.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardImportAppPage2::UIWizardImportAppPage2()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.h b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.h
index a46b463..450547e 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardImportAppPageBasic2.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportAppPageBasic2 class declaration
+ * VBox Qt GUI - UIWizardImportAppPageBasic2 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp
index d4e1deb..9d1ff48 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardImportAppPageExpert.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportAppPageExpert class implementation
+ * VBox Qt GUI - UIWizardImportAppPageExpert class implementation.
  */
 
 /*
@@ -17,17 +15,24 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QFileInfo>
-#include <QVBoxLayout>
-#include <QGroupBox>
+# include <QFileInfo>
+# include <QVBoxLayout>
+# include <QGroupBox>
 
 /* Local includes: */
-#include "UIWizardImportAppPageExpert.h"
-#include "UIWizardImportApp.h"
-#include "VBoxGlobal.h"
-#include "VBoxFilePathSelectorWidget.h"
-#include "UIApplianceImportEditorWidget.h"
+# include "UIWizardImportAppPageExpert.h"
+# include "UIWizardImportApp.h"
+# include "VBoxGlobal.h"
+# include "VBoxFilePathSelectorWidget.h"
+# include "UIApplianceImportEditorWidget.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardImportAppPageExpert::UIWizardImportAppPageExpert(const QString &strFileName)
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.h b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.h
index 0bc24e3..d5e34c0 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageExpert.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardImportAppPageExpert.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardImportAppPageExpert class declaration
+ * VBox Qt GUI - UIWizardImportAppPageExpert class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
index 7edfe4d..43e5251 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp
@@ -1,12 +1,10 @@
 /* $Id: UIWizardNewVD.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVD class implementation
+ * VBox Qt GUI - UIWizardNewVD class implementation.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,27 +15,34 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVariant>
+# include <QVariant>
 
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIWizardNewVD.h"
-#include "UIWizardNewVDPageBasic1.h"
-#include "UIWizardNewVDPageBasic2.h"
-#include "UIWizardNewVDPageBasic3.h"
-#include "UIWizardNewVDPageExpert.h"
-#include "UIMessageCenter.h"
-#include "UIMedium.h"
+# include "VBoxGlobal.h"
+# include "UIWizardNewVD.h"
+# include "UIWizardNewVDPageBasic1.h"
+# include "UIWizardNewVDPageBasic2.h"
+# include "UIWizardNewVDPageBasic3.h"
+# include "UIWizardNewVDPageExpert.h"
+# include "UIMessageCenter.h"
+# include "UIMedium.h"
 
 /* COM includes: */
-#include "CMediumFormat.h"
+# include "CMediumFormat.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardNewVD::UIWizardNewVD(QWidget *pParent,
                              const QString &strDefaultName, const QString &strDefaultPath,
                              qulonglong uDefaultSize,
-                             UIWizardMode mode)
-    : UIWizard(pParent, UIWizardType_NewVD, mode)
+                             WizardMode mode)
+    : UIWizard(pParent, WizardType_NewVD, mode)
     , m_strDefaultName(strDefaultName)
     , m_strDefaultPath(strDefaultPath)
     , m_uDefaultSize(uDefaultSize)
@@ -66,7 +71,7 @@ bool UIWizardNewVD::createVirtualDisk()
     CVirtualBox vbox = vboxGlobal().virtualBox();
 
     /* Create new virtual hard-disk: */
-    CMedium virtualDisk = vbox.CreateHardDisk(mediumFormat.GetName(), strMediumPath);
+    CMedium virtualDisk = vbox.CreateMedium(mediumFormat.GetName(), strMediumPath, KAccessMode_ReadWrite, KDeviceType_HardDisk);
     if (!vbox.isOk())
     {
         msgCenter().cannotCreateHardDiskStorage(vbox, strMediumPath, this);
@@ -124,14 +129,14 @@ void UIWizardNewVD::prepare()
     /* Create corresponding pages: */
     switch (mode())
     {
-        case UIWizardMode_Basic:
+        case WizardMode_Basic:
         {
             setPage(Page1, new UIWizardNewVDPageBasic1);
             setPage(Page2, new UIWizardNewVDPageBasic2);
             setPage(Page3, new UIWizardNewVDPageBasic3(m_strDefaultName, m_strDefaultPath, m_uDefaultSize));
             break;
         }
-        case UIWizardMode_Expert:
+        case WizardMode_Expert:
         {
             setPage(PageExpert, new UIWizardNewVDPageExpert(m_strDefaultName, m_strDefaultPath, m_uDefaultSize));
             break;
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h
index e10adbd..85c5ec8 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVD.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVD class declaration
+ * VBox Qt GUI - UIWizardNewVD class declaration.
  */
 
 /*
@@ -51,7 +50,7 @@ public:
     UIWizardNewVD(QWidget *pParent,
                   const QString &strDefaultName, const QString &strDefaultPath,
                   qulonglong uDefaultSize,
-                  UIWizardMode mode = UIWizardMode_Auto);
+                  WizardMode mode = WizardMode_Auto);
 
     /* Pages related stuff: */
     void prepare();
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.cpp
index bd16dcc..2a6fe2a 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVDPageBasic1.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVDPageBasic1 class implementation
+ * VBox Qt GUI - UIWizardNewVDPageBasic1 class implementation.
  */
 
 /*
@@ -17,19 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QButtonGroup>
-#include <QRadioButton>
+# include <QVBoxLayout>
+# include <QButtonGroup>
+# include <QRadioButton>
 
 /* GUI includes: */
-#include "UIWizardNewVDPageBasic1.h"
-#include "UIWizardNewVD.h"
-#include "VBoxGlobal.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardNewVDPageBasic1.h"
+# include "UIWizardNewVD.h"
+# include "VBoxGlobal.h"
+# include "QIRichTextLabel.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardNewVDPage1::UIWizardNewVDPage1()
 {
@@ -44,8 +49,8 @@ void UIWizardNewVDPage1::addFormatButton(QWidget *pParent, QVBoxLayout *pFormatL
     for (int i = 0; i < capabilities.size(); i++)
         uFormatCapabilities |= capabilities[i];
 
-    if (!(uFormatCapabilities & MediumFormatCapabilities_CreateFixed ||
-          uFormatCapabilities & MediumFormatCapabilities_CreateDynamic))
+    if (!(uFormatCapabilities & KMediumFormatCapabilities_CreateFixed ||
+          uFormatCapabilities & KMediumFormatCapabilities_CreateDynamic))
         return;
 
     /* Check that medium format supports creation of virtual hard-disks: */
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.h
index ddd75ca..d59c72c 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic1.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVDPageBasic1.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVDPageBasic1 class declaration
+ * VBox Qt GUI - UIWizardNewVDPageBasic1 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.cpp
index 213ae3f..1c6cd00 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVDPageBasic2.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVDPageBasic2 class implementation
+ * VBox Qt GUI - UIWizardNewVDPageBasic2 class implementation.
  */
 
 /*
@@ -17,19 +15,26 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QVBoxLayout>
-#include <QButtonGroup>
-#include <QRadioButton>
-#include <QCheckBox>
+# include <QVBoxLayout>
+# include <QButtonGroup>
+# include <QRadioButton>
+# include <QCheckBox>
 
 /* GUI includes: */
-#include "UIWizardNewVDPageBasic2.h"
-#include "UIWizardNewVD.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardNewVDPageBasic2.h"
+# include "UIWizardNewVD.h"
+# include "QIRichTextLabel.h"
 
 /* COM includes: */
-#include "CMediumFormat.h"
+# include "CMediumFormat.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardNewVDPage2::UIWizardNewVDPage2()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.h
index 275ccea..2c74bfc 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic2.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVDPageBasic2.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVDPageBasic2 class declaration
+ * VBox Qt GUI - UIWizardNewVDPageBasic2 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp
index ee9baff..234880d 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVDPageBasic3.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVDPageBasic3 class implementation
+ * VBox Qt GUI - UIWizardNewVDPageBasic3 class implementation.
  */
 
 /*
@@ -17,30 +15,37 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
-#include <QRegExpValidator>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QLineEdit>
-#include <QSlider>
-#include <QLabel>
-#include <QSpacerItem>
+# include <QDir>
+# include <QRegExpValidator>
+# include <QVBoxLayout>
+# include <QHBoxLayout>
+# include <QLineEdit>
+# include <QSlider>
+# include <QLabel>
+# include <QSpacerItem>
 
 /* GUI includes: */
-#include "UIWizardNewVDPageBasic3.h"
-#include "UIWizardNewVD.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIIconPool.h"
-#include "QIFileDialog.h"
-#include "QIRichTextLabel.h"
-#include "QIToolButton.h"
-#include "QILineEdit.h"
+# include "UIWizardNewVDPageBasic3.h"
+# include "UIWizardNewVD.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIIconPool.h"
+# include "QIFileDialog.h"
+# include "QIRichTextLabel.h"
+# include "QIToolButton.h"
+# include "QILineEdit.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
-#include "CMediumFormat.h"
+# include "CSystemProperties.h"
+# include "CMediumFormat.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardNewVDPage3::UIWizardNewVDPage3(const QString &strDefaultName, const QString &strDefaultPath)
     : m_strDefaultName(strDefaultName.isEmpty() ? QString("NewVirtualDisk1") : strDefaultName)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h
index 50f6e43..78c3342 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVDPageBasic3.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVDPageBasic3 class declaration
+ * VBox Qt GUI - UIWizardNewVDPageBasic3 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
index 023fced..3c919c0 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVDPageExpert.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVDPageExpert class implementation
+ * VBox Qt GUI - UIWizardNewVDPageExpert class implementation.
  */
 
 /*
@@ -17,30 +15,37 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QGridLayout>
-#include <QVBoxLayout>
-#include <QRegExpValidator>
-#include <QGroupBox>
-#include <QRadioButton>
-#include <QCheckBox>
-#include <QButtonGroup>
-#include <QLineEdit>
-#include <QSlider>
-#include <QLabel>
+# include <QGridLayout>
+# include <QVBoxLayout>
+# include <QRegExpValidator>
+# include <QGroupBox>
+# include <QRadioButton>
+# include <QCheckBox>
+# include <QButtonGroup>
+# include <QLineEdit>
+# include <QSlider>
+# include <QLabel>
 
 /* GUI includes: */
-#include "UIWizardNewVDPageExpert.h"
-#include "UIWizardNewVD.h"
-#include "VBoxGlobal.h"
-#include "UIMessageCenter.h"
-#include "UIIconPool.h"
-#include "QIRichTextLabel.h"
-#include "QIToolButton.h"
-#include "QILineEdit.h"
+# include "UIWizardNewVDPageExpert.h"
+# include "UIWizardNewVD.h"
+# include "VBoxGlobal.h"
+# include "UIMessageCenter.h"
+# include "UIIconPool.h"
+# include "QIRichTextLabel.h"
+# include "QIToolButton.h"
+# include "QILineEdit.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardNewVDPageExpert::UIWizardNewVDPageExpert(const QString &strDefaultName, const QString &strDefaultPath, qulonglong uDefaultSize)
     : UIWizardNewVDPage3(strDefaultName, strDefaultPath)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h
index 6317249..94b7642 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVDPageExpert.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVDPageExpert class declaration
+ * VBox Qt GUI - UIWizardNewVDPageExpert class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
index 834534c..12a8d7a 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVM.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVM class implementation
+ * VBox Qt GUI - UIWizardNewVM class implementation.
  */
 
 /*
@@ -17,25 +15,35 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* GUI includes: */
-#include "VBoxGlobal.h"
-#include "UIWizardNewVM.h"
-#include "UIWizardNewVMPageBasic1.h"
-#include "UIWizardNewVMPageBasic2.h"
-#include "UIWizardNewVMPageBasic3.h"
-#include "UIWizardNewVMPageExpert.h"
-#include "UIMessageCenter.h"
-#include "UIMedium.h"
+# include "VBoxGlobal.h"
+# include "UIWizardNewVM.h"
+# include "UIWizardNewVMPageBasic1.h"
+# include "UIWizardNewVMPageBasic2.h"
+# include "UIWizardNewVMPageBasic3.h"
+# include "UIWizardNewVMPageExpert.h"
+# include "UIMessageCenter.h"
+# include "UIMedium.h"
 
 /* COM includes: */
-#include "CAudioAdapter.h"
-#include "CUSBController.h"
-#include "CUSBDeviceFilters.h"
-#include "CExtPackManager.h"
-#include "CStorageController.h"
+# include "CAudioAdapter.h"
+# include "CUSBController.h"
+# include "CUSBDeviceFilters.h"
+# include "CExtPackManager.h"
+# include "CStorageController.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
+/* Namespaces: */
+using namespace UIExtraDataDefs;
+
 
 UIWizardNewVM::UIWizardNewVM(QWidget *pParent, const QString &strGroup /* = QString() */)
-    : UIWizard(pParent, UIWizardType_NewVM)
+    : UIWizard(pParent, WizardType_NewVM)
     , m_strGroup(strGroup)
     , m_iIDECount(0)
     , m_iSATACount(0)
@@ -74,8 +82,11 @@ bool UIWizardNewVM::createVM()
             return false;
         }
 
-        /* The FirstRun wizard is to be shown only when we don't attach any virtual hard drive or attach a new (empty) one.
-         * Selecting an existing virtual hard drive will cancel the FirstRun wizard. */
+        /* The First RUN Wizard is to be shown:
+         * 1. if we don't attach any virtual hard-drive
+         * 2. or attach a new (empty) one.
+         * Usually we are assigning extra-data values through UIExtraDataManager,
+         * but in that special case VM was not registered yet, so UIExtraDataManager is unaware of it. */
         if (field("virtualDiskId").toString().isNull() || !field("virtualDisk").value<CMedium>().isNull())
             m_machine.SetExtraData(GUI_FirstRun, "yes");
     }
@@ -160,6 +171,9 @@ bool UIWizardNewVM::createVM()
     /* Turn on PAE, if recommended: */
     m_machine.SetCPUProperty(KCPUPropertyType_PAE, type.GetRecommendedPAE());
 
+    /* Set the recommended triple fault behavior: */
+    m_machine.SetCPUProperty(KCPUPropertyType_TripleFaultReset, type.GetRecommendedTFReset());
+
     /* Set recommended firmware type: */
     KFirmwareType fwType = type.GetRecommendedFirmware();
     m_machine.SetFirmwareType(fwType);
@@ -222,7 +236,7 @@ bool UIWizardNewVM::createVM()
                                                    StorageSlot(ctrHDBus, 0, 0), this);
             }
 
-            /* Attach empty CD/DVD ROM Device */
+            /* Attach empty optical drive: */
             machine.AttachDevice(strDVDName, 1, 0, KDeviceType_DVD, CMedium());
             if (!machine.isOk())
                 msgCenter().cannotAttachDevice(machine, UIMediumType_DVD, QString(), StorageSlot(strDVDBus, 1, 0), this);
@@ -282,14 +296,14 @@ void UIWizardNewVM::prepare()
     /* Create corresponding pages: */
     switch (mode())
     {
-        case UIWizardMode_Basic:
+        case WizardMode_Basic:
         {
             setPage(Page1, new UIWizardNewVMPageBasic1(m_strGroup));
             setPage(Page2, new UIWizardNewVMPageBasic2);
             setPage(Page3, new UIWizardNewVMPageBasic3);
             break;
         }
-        case UIWizardMode_Expert:
+        case WizardMode_Expert:
         {
             setPage(PageExpert, new UIWizardNewVMPageExpert(m_strGroup));
             break;
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
index a67036e..729fa95 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVM.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVM class declaration
+ * VBox Qt GUI - UIWizardNewVM class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
index 90cce68..84a68ac 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVMPageBasic1.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVMPageBasic1 class implementation
+ * VBox Qt GUI - UIWizardNewVMPageBasic1 class implementation.
  */
 
 /*
@@ -17,21 +15,28 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QDir>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QLineEdit>
+# include <QDir>
+# include <QVBoxLayout>
+# include <QHBoxLayout>
+# include <QLineEdit>
 
 /* GUI includes: */
-#include "UIWizardNewVMPageBasic1.h"
-#include "UIWizardNewVM.h"
-#include "UIMessageCenter.h"
-#include "UINameAndSystemEditor.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardNewVMPageBasic1.h"
+# include "UIWizardNewVM.h"
+# include "UIMessageCenter.h"
+# include "UINameAndSystemEditor.h"
+# include "QIRichTextLabel.h"
 
 /* COM includes: */
-#include "CSystemProperties.h"
+# include "CSystemProperties.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 /* Defines some patterns to guess the right OS type. Should be in sync with
  * VirtualBox-settings-common.xsd in Main. The list is sorted by priority. The
@@ -87,6 +92,7 @@ static const osTypePattern gs_OSTypePattern[] =
     { QRegExp( "OS[/|!-]{,1}2.*W",          Qt::CaseInsensitive), "OS2Warp3" },
     { QRegExp("(OS[/|!-]{,1}2.*e)|(eCS.*)", Qt::CaseInsensitive), "OS2eCS" },
     { QRegExp( "OS[/|!-]{,1}2",             Qt::CaseInsensitive), "OS2" },
+    { QRegExp( "eComS.*",                   Qt::CaseInsensitive), "OS2eCS" },
 
     /* Other: Must come before Ubuntu/Maverick and before Linux??? */
     { QRegExp("QN", Qt::CaseInsensitive), "QNX" },
@@ -101,12 +107,12 @@ static const osTypePattern gs_OSTypePattern[] =
     { QRegExp( "(mac.*10[.,]{0,1}7)|(os.*x.*10[.,]{0,1}7)|(mac.*ML)|(os.*x.*ML)|(Mount)",       Qt::CaseInsensitive), "MacOS108_64" },
     { QRegExp( "(mac.*10[.,]{0,1}8)|(os.*x.*10[.,]{0,1}8)|(Lion)",                              Qt::CaseInsensitive), "MacOS107_64" },
     { QRegExp( "(mac.*10[.,]{0,1}9)|(os.*x.*10[.,]{0,1}9)|(mac.*mav)|(os.*x.*mav)|(Mavericks)", Qt::CaseInsensitive), "MacOS109_64" },
-    { QRegExp("((Mac)|(Tig)|(Leop)|(os[ ]*x)).*64",                                             Qt::CaseInsensitive), "MacOS_64" },
-    { QRegExp("((Mac)|(Tig)|(Leop)|(os[ ]*x)).*32",                                             Qt::CaseInsensitive), "MacOS" },
+    { QRegExp("((Mac)|(Tig)|(Leop)|(Yose)|(os[ ]*x)).*64",                                      Qt::CaseInsensitive), "MacOS_64" },
+    { QRegExp("((Mac)|(Tig)|(Leop)|(Yose)|(os[ ]*x)).*32",                                      Qt::CaseInsensitive), "MacOS" },
 
     /* Code names for Linux distributions: */
-    { QRegExp("((edgy)|(feisty)|(gutsy)|(hardy)|(intrepid)|(jaunty)|(karmic)|(lucid)|(maverick)|(natty)|(oneiric)|(precise)|(quantal)|(raring)|(saucy)|(trusty)).*64",    Qt::CaseInsensitive), "Ubuntu_64" },
-    { QRegExp("((edgy)|(feisty)|(gutsy)|(hardy)|(intrepid)|(jaunty)|(karmic)|(lucid)|(maverick)|(natty)|(oneiric)|(precise)|(quantal)|(raring)|(saucy)|(trusty)).*32",    Qt::CaseInsensitive), "Ubuntu" },
+    { QRegExp("((edgy)|(feisty)|(gutsy)|(hardy)|(intrepid)|(jaunty)|(karmic)|(lucid)|(maverick)|(natty)|(oneiric)|(precise)|(quantal)|(raring)|(saucy)|(trusty)|(utopic)|(vivid)).*64",    Qt::CaseInsensitive), "Ubuntu_64" },
+    { QRegExp("((edgy)|(feisty)|(gutsy)|(hardy)|(intrepid)|(jaunty)|(karmic)|(lucid)|(maverick)|(natty)|(oneiric)|(precise)|(quantal)|(raring)|(saucy)|(trusty)|(utopic)|(vivid)).*32",    Qt::CaseInsensitive), "Ubuntu" },
     { QRegExp("((sarge)|(etch)|(lenny)|(squeeze)|(wheezy)|(jessie)|(sid)).*64",                                                                          Qt::CaseInsensitive), "Debian_64" },
     { QRegExp("((sarge)|(etch)|(lenny)|(squeeze)|(wheezy)|(jessie)|(sid)).*32",                                                                          Qt::CaseInsensitive), "Debian" },
     { QRegExp("((moonshine)|(werewolf)|(sulphur)|(cambridge)|(leonidas)|(constantine)|(goddard)|(laughlin)|(lovelock)|(verne)|(beefy)|(spherical)).*64", Qt::CaseInsensitive), "Fedora_64" },
@@ -168,8 +174,9 @@ UIWizardNewVMPage1::UIWizardNewVMPage1(const QString &strGroup)
 
 void UIWizardNewVMPage1::onNameChanged(QString strNewName)
 {
-    /* Do not forget about achitecture bits: */
-    strNewName += ARCH_BITS == 64 && m_fSupportsHWVirtEx && m_fSupportsLongMode ? "64" : "32";
+    /* Do not forget about achitecture bits, if not yet specified: */
+    if (!strNewName.contains("32") && !strNewName.contains("64"))
+        strNewName += ARCH_BITS == 64 && m_fSupportsHWVirtEx && m_fSupportsLongMode ? "64" : "32";
 
     /* Search for a matching OS type based on the string the user typed already. */
     for (size_t i = 0; i < RT_ELEMENTS(gs_OSTypePattern); ++i)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
index 547dcd7..ad720b4 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVMPageBasic1.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVMPageBasic1 class declaration
+ * VBox Qt GUI - UIWizardNewVMPageBasic1 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp
index 2688b76..5ead69d 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVMPageBasic2.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVMPageBasic2 class implementation
+ * VBox Qt GUI - UIWizardNewVMPageBasic2 class implementation.
  */
 
 /*
@@ -17,20 +15,27 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Qt includes: */
-#include <QIntValidator>
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include <QSpacerItem>
-#include <QLabel>
-#include <QSpinBox>
+# include <QIntValidator>
+# include <QVBoxLayout>
+# include <QGridLayout>
+# include <QSpacerItem>
+# include <QLabel>
+# include <QSpinBox>
 
 /* GUI includes: */
-#include "UIWizardNewVMPageBasic2.h"
-#include "UIWizardNewVM.h"
-#include "VBoxGlobal.h"
-#include "VBoxGuestRAMSlider.h"
-#include "QIRichTextLabel.h"
+# include "UIWizardNewVMPageBasic2.h"
+# include "UIWizardNewVM.h"
+# include "VBoxGlobal.h"
+# include "VBoxGuestRAMSlider.h"
+# include "QIRichTextLabel.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardNewVMPage2::UIWizardNewVMPage2()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h
index 5fbd650..650319c 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic2.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVMPageBasic2.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVMPageBasic2 class declaration
+ * VBox Qt GUI - UIWizardNewVMPageBasic2 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp
index d53111d..10fda8c 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVMPageBasic3.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVMPageBasic3 class implementation
+ * VBox Qt GUI - UIWizardNewVMPageBasic3 class implementation.
  */
 
 /*
@@ -17,22 +15,28 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QMetaType>
-#include <QVBoxLayout>
-#include <QGridLayout>
-#include <QRadioButton>
+# include <QMetaType>
+# include <QVBoxLayout>
+# include <QGridLayout>
+# include <QRadioButton>
 
 /* Local includes: */
-#include "UIWizardNewVMPageBasic3.h"
-#include "UIWizardNewVM.h"
-#include "UIMessageCenter.h"
-#include "UIIconPool.h"
-#include "VBoxMediaComboBox.h"
-#include "QIToolButton.h"
-#include "UIWizardNewVD.h"
-#include "QIRichTextLabel.h"
-#include "UIMedium.h"
+# include "UIWizardNewVMPageBasic3.h"
+# include "UIWizardNewVM.h"
+# include "UIMessageCenter.h"
+# include "UIIconPool.h"
+# include "VBoxMediaComboBox.h"
+# include "QIToolButton.h"
+# include "UIWizardNewVD.h"
+# include "QIRichTextLabel.h"
+# include "UIMedium.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
 UIWizardNewVMPage3::UIWizardNewVMPage3()
 {
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.h
index 1a275c7..419aa4c 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVMPageBasic3.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVMPageBasic3 class declaration
+ * VBox Qt GUI - UIWizardNewVMPageBasic3 class declaration.
  */
 
 /*
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
index 74a7f78..6988d95 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.cpp
@@ -1,8 +1,6 @@
 /* $Id: UIWizardNewVMPageExpert.cpp $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVMPageExpert class implementation
+ * VBox Qt GUI - UIWizardNewVMPageExpert class implementation.
  */
 
 /*
@@ -17,26 +15,33 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+#ifdef VBOX_WITH_PRECOMPILED_HEADERS
+# include <precomp.h>
+#else  /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 /* Global includes: */
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QGroupBox>
-#include <QGridLayout>
-#include <QSpacerItem>
-#include <QLineEdit>
-#include <QLabel>
-#include <QSpinBox>
-#include <QRadioButton>
+# include <QVBoxLayout>
+# include <QHBoxLayout>
+# include <QGroupBox>
+# include <QGridLayout>
+# include <QSpacerItem>
+# include <QLineEdit>
+# include <QLabel>
+# include <QSpinBox>
+# include <QRadioButton>
 
 /* Local includes: */
-#include "UIWizardNewVMPageExpert.h"
-#include "UIWizardNewVM.h"
-#include "UIIconPool.h"
-#include "UINameAndSystemEditor.h"
-#include "VBoxGuestRAMSlider.h"
-#include "VBoxMediaComboBox.h"
-#include "QIToolButton.h"
-#include "UIMedium.h"
+# include "UIWizardNewVMPageExpert.h"
+# include "UIWizardNewVM.h"
+# include "UIIconPool.h"
+# include "UINameAndSystemEditor.h"
+# include "VBoxGuestRAMSlider.h"
+# include "VBoxMediaComboBox.h"
+# include "QIToolButton.h"
+# include "UIMedium.h"
+
+#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
+
 
 UIWizardNewVMPageExpert::UIWizardNewVMPageExpert(const QString &strGroup)
     : UIWizardNewVMPage1(strGroup)
diff --git a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
index af12ea0..c45dd90 100644
--- a/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
+++ b/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageExpert.h
@@ -1,7 +1,6 @@
+/* $Id: UIWizardNewVMPageExpert.h $ */
 /** @file
- *
- * VBox frontends: Qt4 GUI ("VirtualBox"):
- * UIWizardNewVMPageExpert class declaration
+ * VBox Qt GUI - UIWizardNewVMPageExpert class declaration.
  */
 
 /*
diff --git a/src/VBox/GuestHost/DragAndDrop/DnDDir.cpp b/src/VBox/GuestHost/DragAndDrop/DnDDir.cpp
new file mode 100644
index 0000000..2238580
--- /dev/null
+++ b/src/VBox/GuestHost/DragAndDrop/DnDDir.cpp
@@ -0,0 +1,185 @@
+/* $Id: DnDDir.cpp $ */
+/** @file
+ * DnD: Directory handling.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/******************************************************************************
+ *   Header Files                                                             *
+ ******************************************************************************/
+
+#include <iprt/assert.h>
+#include <iprt/dir.h>
+#include <iprt/path.h>
+#include <iprt/string.h>
+
+#include <VBox/GuestHost/DragAndDrop.h>
+
+int DnDDirDroppedAddFile(PDNDDIRDROPPEDFILES pDir, const char *pszFile)
+{
+    AssertPtrReturn(pDir, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszFile, VERR_INVALID_POINTER);
+
+    if (!pDir->lstFiles.contains(pszFile))
+        pDir->lstFiles.append(pszFile);
+    return VINF_SUCCESS;
+}
+
+int DnDDirDroppedAddDir(PDNDDIRDROPPEDFILES pDir, const char *pszDir)
+{
+    AssertPtrReturn(pDir, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszDir, VERR_INVALID_POINTER);
+
+    if (!pDir->lstDirs.contains(pszDir))
+        pDir->lstDirs.append(pszDir);
+    return VINF_SUCCESS;
+}
+
+int DnDDirDroppedFilesCreateAndOpenEx(const char *pszPath, PDNDDIRDROPPEDFILES pDir)
+{
+    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
+    AssertPtrReturn(pDir, VERR_INVALID_POINTER);
+
+    char pszDropDir[RTPATH_MAX];
+    if (RTStrPrintf(pszDropDir, sizeof(pszDropDir), "%s", pszPath) <= 0)
+        return VERR_NO_MEMORY;
+
+    /** @todo On Windows we also could use the registry to override
+     *        this path, on Posix a dotfile and/or a guest property
+     *        can be used. */
+
+    /* Append our base drop directory. */
+    int rc = RTPathAppend(pszDropDir, sizeof(pszDropDir), "VirtualBox Dropped Files"); /** @todo Make this tag configurable? */
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /* Create it when necessary. */
+    if (!RTDirExists(pszDropDir))
+    {
+        rc = RTDirCreateFullPath(pszDropDir, RTFS_UNIX_IRWXU);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    /* The actually drop directory consist of the current time stamp and a
+     * unique number when necessary. */
+    char pszTime[64];
+    RTTIMESPEC time;
+    if (!RTTimeSpecToString(RTTimeNow(&time), pszTime, sizeof(pszTime)))
+        return VERR_BUFFER_OVERFLOW;
+    rc = DnDPathSanitizeFilename(pszTime, sizeof(pszTime));
+    if (RT_FAILURE(rc))
+        return rc;
+
+    rc = RTPathAppend(pszDropDir, sizeof(pszDropDir), pszTime);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /* Create it (only accessible by the current user) */
+    rc = RTDirCreateUniqueNumbered(pszDropDir, sizeof(pszDropDir), RTFS_UNIX_IRWXU, 3, '-');
+    if (RT_SUCCESS(rc))
+    {
+        PRTDIR phDir;
+        rc = RTDirOpen(&phDir, pszDropDir);
+        if (RT_SUCCESS(rc))
+        {
+            pDir->hDir       = phDir;
+            pDir->strPathAbs = pszDropDir;
+        }
+    }
+
+    return rc;
+}
+
+int DnDDirDroppedFilesCreateAndOpenTemp(PDNDDIRDROPPEDFILES pDir)
+{
+    AssertPtrReturn(pDir, VERR_INVALID_POINTER);
+
+    char szTemp[RTPATH_MAX];
+
+    /*
+     * Get the user's temp directory. Don't use the user's root directory (or
+     * something inside it) because we don't know for how long/if the data will
+     * be kept after the guest OS used it.
+     */
+    int rc = RTPathTemp(szTemp, sizeof(szTemp));
+    if (RT_FAILURE(rc))
+        return rc;
+
+    return DnDDirDroppedFilesCreateAndOpenEx(szTemp, pDir);
+}
+
+int DnDDirDroppedFilesClose(PDNDDIRDROPPEDFILES pDir, bool fRemove)
+{
+    AssertPtrReturn(pDir, VERR_INVALID_POINTER);
+
+    int rc = RTDirClose(pDir->hDir);
+    if (RT_SUCCESS(rc))
+    {
+        pDir->lstDirs.clear();
+        pDir->lstFiles.clear();
+
+        if (fRemove)
+        {
+            /* Try removing the (empty) drop directory in any case. */
+            rc = RTDirRemove(pDir->strPathAbs.c_str());
+            if (RT_SUCCESS(rc)) /* Only clear if successfully removed. */
+                pDir->strPathAbs = "";
+        }
+    }
+
+    return rc;
+}
+
+const char *DnDDirDroppedFilesGetDirAbs(PDNDDIRDROPPEDFILES pDir)
+{
+    AssertPtrReturn(pDir, NULL);
+    return pDir->strPathAbs.c_str();
+}
+
+int DnDDirDroppedFilesRollback(PDNDDIRDROPPEDFILES pDir)
+{
+    AssertPtrReturn(pDir, VERR_INVALID_POINTER);
+
+    if (pDir->strPathAbs.isEmpty())
+        return VINF_SUCCESS;
+
+    int rc = VINF_SUCCESS;
+    int rc2;
+
+    /* Rollback by removing any stuff created.
+     * Note: Only remove empty directories, never ever delete
+     *       anything recursive here! Steam (tm) knows best ... :-) */
+    for (size_t i = 0; i < pDir->lstFiles.size(); i++)
+    {
+        rc2 = RTFileDelete(pDir->lstFiles.at(i).c_str());
+        if (RT_SUCCESS(rc))
+            rc = rc2;
+    }
+
+    for (size_t i = 0; i < pDir->lstDirs.size(); i++)
+    {
+        rc2 = RTDirRemove(pDir->lstDirs.at(i).c_str());
+        if (RT_SUCCESS(rc))
+            rc = rc2;
+    }
+
+    /* Try to remove the empty root dropped files directory as well. */
+    rc2 = RTDirRemove(pDir->strPathAbs.c_str());
+    if (RT_SUCCESS(rc))
+        rc = rc2;
+
+    return rc;
+}
+
diff --git a/src/VBox/GuestHost/DragAndDrop/DnDMIME.cpp b/src/VBox/GuestHost/DragAndDrop/DnDMIME.cpp
new file mode 100644
index 0000000..2606bf4
--- /dev/null
+++ b/src/VBox/GuestHost/DragAndDrop/DnDMIME.cpp
@@ -0,0 +1,41 @@
+/* $Id: DnDMIME.cpp $ */
+/** @file
+ * DnD: Path list class.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/******************************************************************************
+ *   Header Files                                                             *
+ ******************************************************************************/
+
+#include <iprt/string.h>
+
+#include <VBox/GuestHost/DragAndDrop.h>
+
+bool DnDMIMEHasFileURLs(const char *pcszFormat, size_t cchFormatMax)
+{
+    /** @todo "text/uri" also an official variant? */
+    return (   RTStrNICmp(pcszFormat, "text/uri-list", cchFormatMax)             == 0
+            || RTStrNICmp(pcszFormat, "x-special/gnome-icon-list", cchFormatMax) == 0);
+}
+
+bool DnDMIMENeedsDropDir(const char *pcszFormat, size_t cchFormatMax)
+{
+    bool fNeedsDropDir = false;
+    if (!RTStrNICmp(pcszFormat, "text/uri-list", cchFormatMax)) /** @todo Add "x-special/gnome-icon-list"? */
+        fNeedsDropDir = true;
+
+    return fNeedsDropDir;
+}
+
diff --git a/src/VBox/GuestHost/DragAndDrop/DnDPath.cpp b/src/VBox/GuestHost/DragAndDrop/DnDPath.cpp
new file mode 100644
index 0000000..9ea6f92
--- /dev/null
+++ b/src/VBox/GuestHost/DragAndDrop/DnDPath.cpp
@@ -0,0 +1,57 @@
+/* $Id: DnDPath.cpp $ */
+/** @file
+ * DnD: Path handling.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/******************************************************************************
+ *   Header Files                                                             *
+ ******************************************************************************/
+
+#include <iprt/path.h>
+#include <iprt/string.h>
+
+#include <VBox/GuestHost/DragAndDrop.h>
+
+/**
+ * Sanitizes the file name component so that unsupported characters
+ * will be replaced by an underscore ("_").
+ *
+ * @return  IPRT status code.
+ * @param   pszPath             Path to sanitize.
+ * @param   cbPath              Size (in bytes) of path to sanitize.
+ */
+int DnDPathSanitizeFilename(char *pszPath, size_t cbPath)
+{
+    int rc = VINF_SUCCESS;
+#ifdef RT_OS_WINDOWS
+    /* Filter out characters not allowed on Windows platforms, put in by
+       RTTimeSpecToString(). */
+    /** @todo Use something like RTPathSanitize() when available. Later. */
+    RTUNICP aCpSet[] =
+        { ' ', ' ', '(', ')', '-', '.', '0', '9', 'A', 'Z', 'a', 'z', '_', '_',
+          0xa0, 0xd7af, '\0' };
+    ssize_t cReplaced = RTStrPurgeComplementSet(pszPath, aCpSet, '_' /* Replacement */);
+    if (cReplaced < 0)
+        rc = VERR_INVALID_UTF8_ENCODING;
+#endif
+    return rc;
+}
+
+int DnDPathSanitize(char *pszPath, size_t cbPath)
+{
+    /** @todo */
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp b/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp
new file mode 100644
index 0000000..13c9d08
--- /dev/null
+++ b/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp
@@ -0,0 +1,493 @@
+/* $Id: DnDURIList.cpp $ */
+/** @file
+ * DnD: URI list class.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/******************************************************************************
+ *   Header Files                                                             *
+ ******************************************************************************/
+
+#include <iprt/dir.h>
+#include <iprt/file.h>
+#include <iprt/fs.h>
+#include <iprt/path.h>
+#include <iprt/symlink.h>
+#include <iprt/uri.h>
+
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+#include <VBox/GuestHost/DragAndDrop.h>
+
+DnDURIList::DnDURIList(void)
+    : m_cTotal(0)
+    , m_cbTotal(0)
+{
+}
+
+DnDURIList::~DnDURIList(void)
+{
+}
+
+int DnDURIList::addEntry(const char *pcszSource, const char *pcszTarget, uint32_t fFlags)
+{
+    AssertPtrReturn(pcszSource, VERR_INVALID_POINTER);
+    AssertPtrReturn(pcszTarget, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("pcszSource=%s, pcszTarget=%s\n", pcszSource, pcszTarget));
+
+    RTFSOBJINFO objInfo;
+    int rc = RTPathQueryInfo(pcszSource, &objInfo, RTFSOBJATTRADD_NOTHING);
+    if (RT_SUCCESS(rc))
+    {   
+        if (RTFS_IS_FILE(objInfo.Attr.fMode))
+        {
+            LogFlowFunc(("File '%s' -> '%s'\n", pcszSource, pcszTarget));
+
+            m_lstTree.append(DnDURIObject(DnDURIObject::File, pcszSource, pcszTarget, 
+                             objInfo.Attr.fMode, (uint64_t)objInfo.cbObject));
+            m_cTotal++;
+            m_cbTotal += (uint64_t)objInfo.cbObject;
+        }
+        else if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode))
+        {
+            LogFlowFunc(("Directory '%s' -> '%s' \n", pcszSource, pcszTarget));
+
+            m_lstTree.append(DnDURIObject(DnDURIObject::Directory, pcszSource, pcszTarget,
+                             objInfo.Attr.fMode, 0 /* Size */));
+            m_cTotal++;
+        }
+        /* Note: Symlinks already should have been resolved at this point. */
+        else
+            rc = VERR_NOT_SUPPORTED;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int DnDURIList::appendPathRecursive(const char *pcszSrcPath, 
+                                    const char *pcszDstPath, const char *pcszDstBase, size_t cchDstBase, uint32_t fFlags)
+{
+    AssertPtrReturn(pcszSrcPath, VERR_INVALID_POINTER);
+    AssertPtrReturn(pcszDstBase, VERR_INVALID_POINTER);
+    AssertPtrReturn(pcszDstPath, VERR_INVALID_POINTER);
+   
+    LogFlowFunc(("pcszSrcPath=%s, pcszDstPath=%s, pcszDstBase=%s, cchDstBase=%zu\n", 
+                 pcszSrcPath, pcszDstPath, pcszDstBase, cchDstBase));
+
+    RTFSOBJINFO objInfo;
+    int rc = RTPathQueryInfo(pcszSrcPath, &objInfo, RTFSOBJATTRADD_NOTHING);
+    if (RT_SUCCESS(rc))
+    {   
+        if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode))
+        {
+            rc = addEntry(pcszSrcPath, &pcszDstPath[cchDstBase], fFlags);
+
+            PRTDIR hDir;
+            if (RT_SUCCESS(rc))
+                rc = RTDirOpen(&hDir, pcszSrcPath);
+            if (RT_SUCCESS(rc))
+            {   
+                do
+                {
+                    RTDIRENTRY DirEntry;
+                    rc = RTDirRead(hDir, &DirEntry, NULL);
+                    if (RT_FAILURE(rc))
+                    {
+                        if (rc == VERR_NO_MORE_FILES)
+                            rc = VINF_SUCCESS;
+                        break;
+                    }
+
+                    switch (DirEntry.enmType)
+                    {
+                        case RTDIRENTRYTYPE_DIRECTORY:
+                        {
+                            /* Skip "." and ".." entries. */
+                            if (   RTStrCmp(DirEntry.szName, ".")  == 0
+                                || RTStrCmp(DirEntry.szName, "..") == 0)
+                                break;                           
+
+                            char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName);
+                            if (pszSrc)
+                            {
+                                char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName);
+                                if (pszDst)
+                                {
+                                    rc = appendPathRecursive(pszSrc, pszDst, pcszDstBase, cchDstBase, fFlags);
+                                    RTStrFree(pszDst);
+                                }
+                                else
+                                    rc = VERR_NO_MEMORY;
+
+                                RTStrFree(pszSrc);
+                            }
+                            else
+                                rc = VERR_NO_MEMORY;
+                            break;
+                        }
+
+                        case RTDIRENTRYTYPE_FILE:
+                        {
+                            char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName);
+                            if (pszSrc)
+                            {
+                                char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName);
+                                if (pszDst)
+                                {
+                                    rc = addEntry(pszSrc, &pszDst[cchDstBase], fFlags);
+                                    RTStrFree(pszDst);
+                                }
+                                else
+                                    rc = VERR_NO_MEMORY;
+                                RTStrFree(pszSrc);
+                            }
+                            else
+                                rc = VERR_NO_MEMORY;
+                            break;
+                        }
+                        case RTDIRENTRYTYPE_SYMLINK:
+                        {
+                            if (fFlags & DNDURILIST_FLAGS_RESOLVE_SYMLINKS)
+                            {
+                                char *pszSrc = RTPathRealDup(pcszDstBase);
+                                if (pszSrc)
+                                {
+                                    rc = RTPathQueryInfo(pszSrc, &objInfo, RTFSOBJATTRADD_NOTHING);
+                                    if (RT_SUCCESS(rc))
+                                    {
+                                        if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode))
+                                        {
+                                            LogFlowFunc(("Directory entry is symlink to directory\n"));
+                                            rc = appendPathRecursive(pszSrc, pcszDstPath, pcszDstBase, cchDstBase, fFlags); 
+                                        }
+                                        else if (RTFS_IS_FILE(objInfo.Attr.fMode))
+                                        {
+                                            LogFlowFunc(("Directory entry is symlink to file\n"));
+                                            rc = addEntry(pszSrc, &pcszDstPath[cchDstBase], fFlags);
+                                        }
+                                        else
+                                            rc = VERR_NOT_SUPPORTED;
+                                    }
+
+                                    RTStrFree(pszSrc);
+                                }        
+                                else
+                                    rc = VERR_NO_MEMORY;
+                            }
+                            break;
+                        }
+
+                        default:
+                            break;
+                    }
+
+                } while (RT_SUCCESS(rc));
+
+                RTDirClose(hDir);
+            }
+        }
+        else if (RTFS_IS_FILE(objInfo.Attr.fMode))
+        {
+            rc = addEntry(pcszSrcPath, &pcszDstPath[cchDstBase], fFlags);
+        }
+        else if (RTFS_IS_SYMLINK(objInfo.Attr.fMode))
+        {
+            if (fFlags & DNDURILIST_FLAGS_RESOLVE_SYMLINKS)
+            {
+                char *pszSrc = RTPathRealDup(pcszSrcPath);
+                if (pszSrc)
+                {
+                    rc = RTPathQueryInfo(pszSrc, &objInfo, RTFSOBJATTRADD_NOTHING);
+                    if (RT_SUCCESS(rc))
+                    {
+                        if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode))
+                        {
+                            LogFlowFunc(("Symlink to directory\n"));
+                            rc = appendPathRecursive(pszSrc, pcszDstPath, pcszDstBase, cchDstBase, fFlags); 
+                        }
+                        else if (RTFS_IS_FILE(objInfo.Attr.fMode))
+                        {
+                            LogFlowFunc(("Symlink to file\n"));
+                            rc = addEntry(pszSrc, &pcszDstPath[cchDstBase], fFlags);
+                        }
+                        else
+                            rc = VERR_NOT_SUPPORTED;
+                    }
+
+                    RTStrFree(pszSrc);
+                }        
+                else
+                    rc = VERR_NO_MEMORY;          
+            }
+        }
+        else
+            rc = VERR_NOT_SUPPORTED;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int DnDURIList::AppendNativePath(const char *pszPath, uint32_t fFlags)
+{
+    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
+
+    int rc;
+    char *pszPathNative = RTStrDup(pszPath);
+    if (pszPathNative)
+    {
+        RTPathChangeToUnixSlashes(pszPathNative, true /* fForce */);
+
+        char *pszPathURI = RTUriCreate("file" /* pszScheme */, "/" /* pszAuthority */,
+                                       pszPathNative, NULL /* pszQuery */, NULL /* pszFragment */);
+        if (pszPathURI)
+        {
+            rc = AppendURIPath(pszPathURI, fFlags);
+            RTStrFree(pszPathURI);
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
+
+        RTStrFree(pszPathNative);
+    }
+    else
+        rc = VERR_NO_MEMORY;
+
+    return rc;
+}
+
+int DnDURIList::AppendNativePathsFromList(const char *pszNativePaths, size_t cbNativePaths,
+                                          uint32_t fFlags)
+{
+    AssertPtrReturn(pszNativePaths, VERR_INVALID_POINTER);
+    AssertReturn(cbNativePaths, VERR_INVALID_PARAMETER);
+
+    RTCList<RTCString> lstPaths
+        = RTCString(pszNativePaths, cbNativePaths - 1).split("\r\n");
+    return AppendNativePathsFromList(lstPaths, fFlags);
+}
+
+int DnDURIList::AppendNativePathsFromList(const RTCList<RTCString> &lstNativePaths,
+                                          uint32_t fFlags)
+{
+    int rc = VINF_SUCCESS;
+
+    for (size_t i = 0; i < lstNativePaths.size(); i++)
+    {
+        const RTCString &strPath = lstNativePaths.at(i);
+        rc = AppendNativePath(strPath.c_str(), fFlags);
+        if (RT_FAILURE(rc))
+            break;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int DnDURIList::AppendURIPath(const char *pszURI, uint32_t fFlags)
+{
+    AssertPtrReturn(pszURI, VERR_INVALID_POINTER);
+
+    /** @todo Check for string termination?  */
+#ifdef DEBUG_andy
+    LogFlowFunc(("pszPath=%s, fFlags=0x%x\n", pszURI, fFlags));
+#endif
+    int rc = VINF_SUCCESS;
+
+    /* Query the path component of a file URI. If this hasn't a
+     * file scheme NULL is returned. */
+    char *pszSrcPath = RTUriFilePath(pszURI, URI_FILE_FORMAT_AUTO);
+    if (pszSrcPath)
+    {
+        /* Add the path to our internal file list (recursive in
+         * the case of a directory). */
+        size_t cbPathLen = RTPathStripTrailingSlash(pszSrcPath);
+        if (cbPathLen)
+        {
+            char *pszFileName = RTPathFilename(pszSrcPath);
+            if (pszFileName)
+            {
+                Assert(pszFileName >= pszSrcPath);
+                size_t cchDstBase = (fFlags & DNDURILIST_FLAGS_ABSOLUTE_PATHS)
+                                  ? 0 /* Use start of path as root. */
+                                  : pszFileName - pszSrcPath;
+                char *pszDstPath = &pszSrcPath[cchDstBase];
+                m_lstRoot.append(pszDstPath);
+
+                LogFlowFunc(("pszFilePath=%s, pszFileName=%s, pszRoot=%s\n",
+                             pszSrcPath, pszFileName, pszDstPath));
+
+                rc = appendPathRecursive(pszSrcPath, pszSrcPath, pszSrcPath, cchDstBase, fFlags);
+            }
+            else
+                rc = VERR_PATH_NOT_FOUND;
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
+
+        RTStrFree(pszSrcPath);
+    }
+    else
+        rc = VERR_INVALID_PARAMETER;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int DnDURIList::AppendURIPathsFromList(const char *pszURIPaths, size_t cbURIPaths,
+                                       uint32_t fFlags)
+{
+    AssertPtrReturn(pszURIPaths, VERR_INVALID_POINTER);
+    AssertReturn(cbURIPaths, VERR_INVALID_PARAMETER);
+
+    RTCList<RTCString> lstPaths
+        = RTCString(pszURIPaths, cbURIPaths - 1).split("\r\n");
+    return AppendURIPathsFromList(lstPaths, fFlags);
+}
+
+int DnDURIList::AppendURIPathsFromList(const RTCList<RTCString> &lstURI,
+                                       uint32_t fFlags)
+{
+    int rc = VINF_SUCCESS;
+
+    for (size_t i = 0; i < lstURI.size(); i++)
+    {
+        RTCString strURI = lstURI.at(i);
+        rc = AppendURIPath(strURI.c_str(), fFlags);
+
+        if (RT_FAILURE(rc))
+            break;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+void DnDURIList::Clear(void)
+{
+    m_lstRoot.clear();
+    m_lstTree.clear();
+
+    m_cbTotal = 0;
+}
+
+void DnDURIList::RemoveFirst(void)
+{
+    if (m_lstTree.isEmpty())
+        return;
+
+    DnDURIObject &curPath = m_lstTree.first();
+
+    uint64_t cbSize = curPath.GetSize();
+    Assert(m_cbTotal >= cbSize);
+    m_cbTotal -= cbSize; /* Adjust total size. */
+
+    m_lstTree.removeFirst();
+}
+
+int DnDURIList::RootFromURIData(const void *pvData, size_t cbData, uint32_t fFlags)
+{
+    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
+    AssertReturn(cbData, VERR_INVALID_PARAMETER);
+
+    RTCList<RTCString> lstURI =
+        RTCString(static_cast<const char*>(pvData), cbData - 1).split("\r\n");
+    if (lstURI.isEmpty())
+        return VINF_SUCCESS;
+
+    int rc = VINF_SUCCESS;
+
+    for (size_t i = 0; i < lstURI.size(); ++i)
+    {
+        /* Query the path component of a file URI. If this hasn't a
+         * file scheme, NULL is returned. */
+        const char *pszURI = lstURI.at(i).c_str();
+        char *pszFilePath = RTUriFilePath(pszURI,
+                                          URI_FILE_FORMAT_AUTO);
+#ifdef DEBUG_andy
+        LogFlowFunc(("pszURI=%s, pszFilePath=%s\n", pszURI, pszFilePath));
+#endif
+        if (pszFilePath)
+        {
+            rc = DnDPathSanitize(pszFilePath, strlen(pszFilePath));
+            if (RT_SUCCESS(rc))
+            {
+                m_lstRoot.append(pszFilePath);
+                m_cTotal++;
+            }
+
+            RTStrFree(pszFilePath);
+        }
+        else
+            rc = VERR_INVALID_PARAMETER;
+
+        if (RT_FAILURE(rc))
+            break;
+    }
+
+    return rc;
+}
+
+RTCString DnDURIList::RootToString(const RTCString &strPathBase /* = "" */,
+                                   const RTCString &strSeparator /* = "\r\n" */)
+{
+    RTCString strRet;
+    for (size_t i = 0; i < m_lstRoot.size(); i++)
+    {
+        const char *pszCurRoot = m_lstRoot.at(i).c_str();
+#ifdef DEBUG_andy
+        LogFlowFunc(("pszCurRoot=%s\n", pszCurRoot));
+#endif
+        if (strPathBase.isNotEmpty())
+        {
+            char *pszPath = RTPathJoinA(strPathBase.c_str(), pszCurRoot);
+            if (pszPath)
+            {
+                char *pszPathURI = RTUriFileCreate(pszPath);
+                if (pszPathURI)
+                {
+                    strRet += RTCString(pszPathURI) + strSeparator;
+                    LogFlowFunc(("URI: %s\n", strRet.c_str()));
+                    RTStrFree(pszPathURI);
+                }
+                else
+                    break;
+                RTStrFree(pszPath);
+            }
+            else
+                break;
+        }
+        else
+        {
+            char *pszPathURI = RTUriFileCreate(pszCurRoot);
+            if (pszPathURI)
+            {
+                strRet += RTCString(pszPathURI) + strSeparator;
+                LogFlowFunc(("URI: %s\n", strRet.c_str()));
+                RTStrFree(pszPathURI);
+            }
+            else
+                break;
+        }
+    }
+
+    return strRet;
+}
+
diff --git a/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp b/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
new file mode 100644
index 0000000..fde38d9
--- /dev/null
+++ b/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
@@ -0,0 +1,402 @@
+/* $Id: DnDURIObject.cpp $ */
+/** @file
+ * DnD: URI object class. For handling creation/reading/writing to files and directories
+ *      on host or guest side.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/******************************************************************************
+ *   Header Files                                                             *
+ ******************************************************************************/
+
+#include <iprt/dir.h>
+#include <iprt/file.h>
+#include <iprt/fs.h>
+#include <iprt/path.h>
+#include <iprt/uri.h>
+
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+#include <VBox/GuestHost/DragAndDrop.h>
+
+DnDURIObject::DnDURIObject(void)
+    : m_Type(Unknown)
+    , m_fMode(0)
+    , m_cbSize(0)
+    , m_cbProcessed(0)
+{
+    RT_ZERO(u);
+}
+
+DnDURIObject::DnDURIObject(Type type,
+                           const RTCString &strSrcPath /* = 0 */,
+                           const RTCString &strDstPath /* = 0 */,
+                           uint32_t fMode  /* = 0 */, uint64_t cbSize  /* = 0 */)
+    : m_Type(type)
+    , m_strSrcPath(strSrcPath)
+    , m_strTgtPath(strDstPath)
+    , m_fMode(fMode)
+    , m_cbSize(cbSize)
+    , m_cbProcessed(0)
+{
+    switch (m_Type)
+    {
+        case File:
+            u.m_hFile = NULL;
+            break;
+
+        case Directory:
+            break;
+
+        default:
+            break;
+    }
+}
+
+DnDURIObject::~DnDURIObject(void)
+{
+    closeInternal();
+}
+
+void DnDURIObject::closeInternal(void)
+{
+    if (m_Type == File)
+    {
+        if (u.m_hFile)
+        {
+            RTFileClose(u.m_hFile);
+            u.m_hFile = NULL;
+        }
+    }
+}
+
+void DnDURIObject::Close(void)
+{
+    switch (m_Type)
+    {
+        case File:
+        {
+            if (u.m_hFile != NULL)
+            {
+                int rc2 = RTFileClose(u.m_hFile);
+                AssertRC(rc2);
+
+                u.m_hFile = NULL;
+            }
+            break;
+        }
+
+        case Directory:
+            break;
+
+        default:
+            break;
+    }
+}
+
+bool DnDURIObject::IsComplete(void) const
+{
+    bool fComplete;
+
+    switch (m_Type)
+    {
+        case File:
+            Assert(m_cbProcessed <= m_cbSize);
+            fComplete = m_cbProcessed == m_cbSize;
+            break;
+
+        case Directory:
+            fComplete = true;
+            break;
+
+        default:
+            fComplete = true;
+            break;
+    }
+
+    return fComplete;
+}
+
+bool DnDURIObject::IsOpen(void) const
+{
+    bool fIsOpen;
+
+    switch (m_Type)
+    {
+        case File:
+            fIsOpen = u.m_hFile != NULL;
+            break;
+
+        case Directory:
+            fIsOpen = true;
+            break;
+
+        default:
+            fIsOpen = false;
+            break;
+    }
+
+    return fIsOpen;
+}
+
+int DnDURIObject::Open(Dest enmDest, uint64_t fOpen /* = 0 */, uint32_t fMode /* = 0 */)
+{
+    return OpenEx(  enmDest == Source
+                  ? m_strSrcPath : m_strTgtPath
+                  , m_Type, enmDest, fOpen, fMode, 0 /* fFlags */);
+}
+
+int DnDURIObject::OpenEx(const RTCString &strPath, Type enmType, Dest enmDest,
+                         uint64_t fOpen /* = 0 */, uint32_t fMode /* = 0 */, uint32_t fFlags /* = 0 */)
+{
+    int rc = VINF_SUCCESS;
+
+    switch (enmDest)
+    {
+        case Source:
+            m_strSrcPath = strPath;
+            break;
+
+        case Target:
+            m_strTgtPath = strPath;
+            break;
+
+        default:
+            rc = VERR_NOT_IMPLEMENTED;
+            break;
+    }
+
+    if (   RT_SUCCESS(rc)
+        && fOpen) /* Opening mode specified? */
+    {
+        switch (enmType)
+        {
+            case File:
+            {
+                if (!u.m_hFile)
+                {
+                    /* Open files on the source with RTFILE_O_DENY_WRITE to prevent races
+                     * where the OS writes to the file while the destination side transfers
+                     * it over. */
+                    rc = RTFileOpen(&u.m_hFile, strPath.c_str(), fOpen);
+                    LogFlowFunc(("strPath=%s, enmType=%RU32, enmDest=%RU32, rc=%Rrc\n", strPath.c_str(), enmType, enmDest, rc));
+                    if (RT_SUCCESS(rc))
+                        rc = RTFileGetSize(u.m_hFile, &m_cbSize);
+                    if (RT_SUCCESS(rc)
+                        && fMode)
+                    {
+                        rc = RTFileSetMode(u.m_hFile, fMode);
+                    }
+                    if (RT_SUCCESS(rc))
+                    {
+                        LogFlowFunc(("cbSize=%RU64, fMode=%RU32\n", m_cbSize, m_fMode));
+                        m_cbProcessed = 0;
+                    }
+                }
+                else
+                    rc = VINF_SUCCESS;
+
+                break;
+            }
+
+            case Directory:
+                rc = VINF_SUCCESS;
+                break;
+
+            default:
+                rc = VERR_NOT_IMPLEMENTED;
+                break;
+        }
+    }
+
+    if (RT_SUCCESS(rc))
+        m_Type = enmType;
+
+    return rc;
+}
+
+/* static */
+/** @todo Put this into an own class like DnDURIPath : public RTCString? */
+int DnDURIObject::RebaseURIPath(RTCString &strPath,
+                                const RTCString &strBaseOld /* = "" */,
+                                const RTCString &strBaseNew /* = "" */)
+{
+    int rc;
+    const char *pszPath = RTUriPath(strPath.c_str());
+    if (!pszPath)
+        pszPath = strPath.c_str();
+    if (pszPath)
+    {
+        const char *pszPathStart = pszPath;
+        const char *pszBaseOld = strBaseOld.c_str();
+        if (   pszBaseOld
+            && RTPathStartsWith(pszPath, pszBaseOld))
+        {
+            pszPathStart += strlen(pszBaseOld);
+        }
+
+        rc = VINF_SUCCESS;
+
+        if (RT_SUCCESS(rc))
+        {
+            char *pszPathNew = RTPathJoinA(strBaseNew.c_str(), pszPathStart);
+            if (pszPathNew)
+            {
+                char *pszPathURI = RTUriCreate("file" /* pszScheme */, "/" /* pszAuthority */,
+                                               pszPathNew /* pszPath */,
+                                               NULL /* pszQuery */, NULL /* pszFragment */);
+                if (pszPathURI)
+                {
+                    LogFlowFunc(("Rebasing \"%s\" to \"%s\"\n", strPath.c_str(), pszPathURI));
+
+                    strPath = RTCString(pszPathURI) + "\r\n";
+                    RTStrFree(pszPathURI);
+
+                    rc = VINF_SUCCESS;
+                }
+                else
+                    rc = VERR_INVALID_PARAMETER;
+
+                RTStrFree(pszPathNew);
+            }
+            else
+                rc = VERR_NO_MEMORY;
+        }
+    }
+    else
+        rc = VERR_INVALID_PARAMETER;
+
+    return rc;
+}
+
+int DnDURIObject::Read(void *pvBuf, size_t cbBuf, uint32_t *pcbRead)
+{
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    AssertReturn(cbBuf, VERR_INVALID_PARAMETER);
+    /* pcbRead is optional. */
+
+    size_t cbRead = 0;
+
+    int rc;
+    switch (m_Type)
+    {
+        case File:
+        {
+            rc = OpenEx(m_strSrcPath, File, Source,
+                        /* Use some sensible defaults. */
+                        RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, 0 /* fFlags */);
+            if (RT_SUCCESS(rc))
+            {
+                rc = RTFileRead(u.m_hFile, pvBuf, cbBuf, &cbRead);
+                if (RT_SUCCESS(rc))
+                {
+                    m_cbProcessed += cbRead;
+                    Assert(m_cbProcessed <= m_cbSize);
+
+                    /* End of file reached or error occurred? */
+                    if (   m_cbSize
+                        && m_cbProcessed == m_cbSize)
+                    {
+                        rc = VINF_EOF;
+                    }
+                }
+            }
+
+            break;
+        }
+
+        case Directory:
+        {
+            rc = VINF_SUCCESS;
+            break;
+        }
+
+        default:
+            rc = VERR_NOT_IMPLEMENTED;
+            break;
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        if (pcbRead)
+            *pcbRead = (uint32_t)cbRead;
+    }
+
+    LogFlowFunc(("Returning strSourcePath=%s, cbRead=%zu, rc=%Rrc\n", m_strSrcPath.c_str(), cbRead, rc));
+    return rc;
+}
+
+void DnDURIObject::Reset(void)
+{
+    Close();
+
+    m_Type          = Unknown;
+    m_strSrcPath    = "";
+    m_strTgtPath    = "";
+    m_fMode = 0;
+    m_cbSize        = 0;
+    m_cbProcessed   = 0;
+}
+
+int DnDURIObject::Write(const void *pvBuf, size_t cbBuf, uint32_t *pcbWritten)
+{
+    AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+    AssertReturn(cbBuf, VERR_INVALID_PARAMETER);
+    /* pcbWritten is optional. */
+
+    size_t cbWritten = 0;
+
+    int rc;
+    switch (m_Type)
+    {
+        case File:
+        {
+            rc = OpenEx(m_strTgtPath, File, Target,
+                        /* Use some sensible defaults. */
+                        RTFILE_O_OPEN_CREATE | RTFILE_O_DENY_WRITE | RTFILE_O_WRITE, 0 /* fFlags */);
+            if (RT_SUCCESS(rc))
+            {
+                rc = RTFileWrite(u.m_hFile, pvBuf, cbBuf, &cbWritten);
+                if (RT_SUCCESS(rc))
+                    m_cbProcessed += cbWritten;
+            }
+
+            break;
+        }
+
+        case Directory:
+        {
+            rc = VINF_SUCCESS;
+            break;
+        }
+
+        default:
+            rc = VERR_NOT_IMPLEMENTED;
+            break;
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        if (pcbWritten)
+            *pcbWritten = (uint32_t)cbWritten;
+    }
+
+    LogFlowFunc(("Returning strSourcePath=%s, cbWritten=%zu, rc=%Rrc\n", m_strSrcPath.c_str(), cbWritten, rc));
+    return rc;
+}
+
diff --git a/src/VBox/GuestHost/DragAndDrop/Makefile.kmk b/src/VBox/GuestHost/DragAndDrop/Makefile.kmk
new file mode 100644
index 0000000..6c9f982
--- /dev/null
+++ b/src/VBox/GuestHost/DragAndDrop/Makefile.kmk
@@ -0,0 +1,53 @@
+# $Id: Makefile.kmk $
+## @file
+# Sub-Makefile for the shared DnD code for both, host and guest.
+#
+
+#
+# Copyright (C) 2014-2015 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+VBOX_DND_GUESTHOST_FILES := \
+	DnDDir.cpp \
+	DnDMIME.cpp \
+	DnDPath.cpp \
+	DnDURIList.cpp \
+	DnDURIObject.cpp
+
+#
+# DnDGuestR3Lib - For tools on the guest side,
+# e.g. VBoxClient/VBoxTray.
+#
+ifdef VBOX_WITH_ADDITIONS
+ LIBRARIES += VBoxDnDGuestR3Lib
+ VBoxDnDGuestR3Lib_TEMPLATE = VBOXGUESTR3LIB
+ VBoxDnDGuestR3Lib_DEFS     =
+ VBoxDnDGuestR3Lib_SOURCES  = $(VBOX_DND_GUESTHOST_FILES)
+
+# LIBRARIES.win.amd64 += VBoxDnDGuestR3Lib-x86
+# VBoxDnDGuestR3Lib-x86_EXTENDS      := VBoxDnDGuestR3Lib
+# VBoxDnDGuestR3Lib-x86_BLD_TRG_ARCH := x86
+endif
+
+#
+# DnDHostR3Lib - For the host side, e.g. Main
+# and frontends.
+#
+LIBRARIES += VBoxDnDHostR3Lib
+VBoxDnDHostR3Lib_TEMPLATE   = VBOXR3
+VBoxDnDHostR3Lib_DEFS       =
+VBoxDnDHostR3Lib_SOURCES    = $(VBOX_DND_GUESTHOST_FILES)
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp b/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp
index e897239..7c0d101 100644
--- a/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp
+++ b/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp
@@ -57,14 +57,14 @@
  * }
  */
 
-static uint32_t hgsmiHashBegin (void)
+static uint32_t hgsmiHashBegin(void)
 {
     return 0;
 }
 
-static uint32_t hgsmiHashProcess (uint32_t hash,
-                                  const void *pvData,
-                                  size_t cbData)
+static uint32_t hgsmiHashProcess(uint32_t hash,
+                                 const void *pvData,
+                                 size_t cbData)
 {
     const uint8_t *pu8Data = (const uint8_t *)pvData;
 
@@ -78,7 +78,7 @@ static uint32_t hgsmiHashProcess (uint32_t hash,
     return hash;
 }
 
-static uint32_t hgsmiHashEnd (uint32_t hash)
+static uint32_t hgsmiHashEnd(uint32_t hash)
 {
     hash += (hash << 3);
     hash ^= (hash >> 11);
@@ -87,69 +87,30 @@ static uint32_t hgsmiHashEnd (uint32_t hash)
     return hash;
 }
 
-uint32_t HGSMIChecksum (HGSMIOFFSET offBuffer,
-                        const HGSMIBUFFERHEADER *pHeader,
-                        const HGSMIBUFFERTAIL *pTail)
+uint32_t HGSMIChecksum(HGSMIOFFSET offBuffer,
+                       const HGSMIBUFFERHEADER *pHeader,
+                       const HGSMIBUFFERTAIL *pTail)
 {
-    uint32_t u32Checksum = hgsmiHashBegin ();
+    uint32_t u32Checksum = hgsmiHashBegin();
 
-    u32Checksum = hgsmiHashProcess (u32Checksum, &offBuffer, sizeof (offBuffer));
-    u32Checksum = hgsmiHashProcess (u32Checksum, pHeader, sizeof (HGSMIBUFFERHEADER));
-    u32Checksum = hgsmiHashProcess (u32Checksum, pTail, RT_OFFSETOF(HGSMIBUFFERTAIL, u32Checksum));
+    u32Checksum = hgsmiHashProcess(u32Checksum, &offBuffer, sizeof(offBuffer));
+    u32Checksum = hgsmiHashProcess(u32Checksum, pHeader, sizeof(HGSMIBUFFERHEADER));
+    u32Checksum = hgsmiHashProcess(u32Checksum, pTail, RT_OFFSETOF(HGSMIBUFFERTAIL, u32Checksum));
 
-    return hgsmiHashEnd (u32Checksum);
+    return hgsmiHashEnd(u32Checksum);
 }
 
-static HGSMIOFFSET hgsmiBufferInitializeSingle (const HGSMIAREA *pArea,
-                                                HGSMIBUFFERHEADER *pHeader,
-                                                uint32_t u32DataSize,
-                                                uint8_t u8Channel,
-                                                uint16_t u16ChannelInfo)
-{
-    if (   !pArea
-        || !pHeader)
-    {
-        return HGSMIOFFSET_VOID;
-    }
-
-    /* Buffer must be within the area:
-     *   * header data size do not exceed the maximum data size;
-     *   * buffer address is greater than the area base address;
-     *   * buffer address is lower than the maximum allowed for the given data size.
-     */
-    HGSMISIZE cbMaximumDataSize = pArea->offLast - pArea->offBase;
-
-    if (   u32DataSize > cbMaximumDataSize
-        || (uint8_t *)pHeader < pArea->pu8Base
-        || (uint8_t *)pHeader > pArea->pu8Base + cbMaximumDataSize - u32DataSize)
-    {
-        return HGSMIOFFSET_VOID;
-    }
-
-    HGSMIOFFSET offBuffer = HGSMIPointerToOffset (pArea, pHeader);
-
-    pHeader->u8Flags        = HGSMI_BUFFER_HEADER_F_SEQ_SINGLE;
-    pHeader->u32DataSize    = u32DataSize;
-    pHeader->u8Channel      = u8Channel;
-    pHeader->u16ChannelInfo = u16ChannelInfo;
-    memset (pHeader->u.au8Union, 0, sizeof (pHeader->u.au8Union));
-
-    HGSMIBUFFERTAIL *pTail = HGSMIBufferTail (pHeader);
-
-    pTail->u32Reserved = 0;
-    pTail->u32Checksum = HGSMIChecksum (offBuffer, pHeader, pTail);
-
-    return offBuffer;
-}
-
-int HGSMIAreaInitialize (HGSMIAREA *pArea, void *pvBase, HGSMISIZE cbArea, HGSMIOFFSET offBase)
+int HGSMIAreaInitialize(HGSMIAREA *pArea,
+                        void *pvBase,
+                        HGSMISIZE cbArea,
+                        HGSMIOFFSET offBase)
 {
     uint8_t *pu8Base = (uint8_t *)pvBase;
 
     if (  !pArea                                   /* Check that the area: */
-        || cbArea < HGSMIBufferMinimumSize ()      /* Large enough. */
-        || pu8Base + cbArea < pu8Base              /* No address space wrap. */
-        || offBase > UINT32_C(0xFFFFFFFF) - cbArea /* Area within the 32 bit space: offBase + cbMem <= 0xFFFFFFFF */
+        || cbArea < HGSMIBufferMinimumSize()       /* large enough; */
+        || pu8Base + cbArea < pu8Base              /* no address space wrap; */
+        || offBase > UINT32_C(0xFFFFFFFF) - cbArea /* area within the 32 bit space: offBase + cbMem <= 0xFFFFFFFF. */
        )
     {
         return VERR_INVALID_PARAMETER;
@@ -157,206 +118,139 @@ int HGSMIAreaInitialize (HGSMIAREA *pArea, void *pvBase, HGSMISIZE cbArea, HGSMI
 
     pArea->pu8Base = pu8Base;
     pArea->offBase = offBase;
-    pArea->offLast = cbArea - HGSMIBufferMinimumSize () + offBase;
+    pArea->offLast = cbArea - HGSMIBufferMinimumSize() + offBase;
     pArea->cbArea = cbArea;
 
     return VINF_SUCCESS;
 }
 
-void HGSMIAreaClear (HGSMIAREA *pArea)
+void HGSMIAreaClear(HGSMIAREA *pArea)
 {
     if (pArea)
     {
-        memset (pArea, 0, sizeof (HGSMIAREA));
+        RT_ZERO(*pArea);
     }
 }
 
 /* Initialize the memory buffer including its checksum.
  * No changes alloed to the header and the tail after that.
  */
-HGSMIOFFSET HGSMIBufferInitializeSingle (const HGSMIAREA *pArea,
-                                         HGSMIBUFFERHEADER *pHeader,
-                                         HGSMISIZE cbBuffer,
-                                         uint8_t u8Channel,
-                                         uint16_t u16ChannelInfo)
+HGSMIOFFSET HGSMIBufferInitializeSingle(const HGSMIAREA *pArea,
+                                        HGSMIBUFFERHEADER *pHeader,
+                                        HGSMISIZE cbBuffer,
+                                        uint8_t u8Channel,
+                                        uint16_t u16ChannelInfo)
 {
-    if (cbBuffer < HGSMIBufferMinimumSize ())
+    if (   !pArea
+        || !pHeader
+        || cbBuffer < HGSMIBufferMinimumSize())
     {
         return HGSMIOFFSET_VOID;
     }
 
-    return hgsmiBufferInitializeSingle (pArea, pHeader, cbBuffer - HGSMIBufferMinimumSize (), u8Channel, u16ChannelInfo);
-}
-
-void HGSMIHeapSetupUnitialized (HGSMIHEAP *pHeap)
-{
-    pHeap->u.hPtr = NIL_RTHEAPSIMPLE;
-    pHeap->cRefs = 0;
-    pHeap->area.cbArea = 0;
-    pHeap->area.offBase = HGSMIOFFSET_VOID;
-    pHeap->area.offLast = HGSMIOFFSET_VOID;
-    pHeap->area.pu8Base = 0;
-    pHeap->fOffsetBased = false;
-}
-
-bool HGSMIHeapIsItialized (HGSMIHEAP *pHeap)
-{
-    return pHeap->u.hPtr != NIL_RTHEAPSIMPLE;
-}
+    /* Buffer must be within the area:
+     *   * header data size do not exceed the maximum data size;
+     *   * buffer address is greater than the area base address;
+     *   * buffer address is lower than the maximum allowed for the given data size.
+     */
+    HGSMISIZE cbMaximumDataSize = pArea->offLast - pArea->offBase;
+    uint32_t u32DataSize = cbBuffer - HGSMIBufferMinimumSize();
 
-int HGSMIHeapRelocate (HGSMIHEAP *pHeap,
-                       void *pvBase,
-                       uint32_t offHeapHandle,
-                       uintptr_t offDelta,
-                       HGSMISIZE cbArea,
-                       HGSMIOFFSET offBase,
-                       bool fOffsetBased
-                       )
-{
-    if (   !pHeap
-        || !pvBase)
+    if (   u32DataSize > cbMaximumDataSize
+        || (uint8_t *)pHeader < pArea->pu8Base
+        || (uint8_t *)pHeader > pArea->pu8Base + cbMaximumDataSize - u32DataSize)
     {
-        return VERR_INVALID_PARAMETER;
+        return HGSMIOFFSET_VOID;
     }
 
-    int rc = HGSMIAreaInitialize (&pHeap->area, pvBase, cbArea, offBase);
+    HGSMIOFFSET offBuffer = HGSMIPointerToOffset(pArea, pHeader);
 
-    if (RT_SUCCESS (rc))
-    {
-        if (fOffsetBased)
-            pHeap->u.hOff = (RTHEAPOFFSET)((uint8_t *)pvBase + offHeapHandle);
-        else
-        {
-            pHeap->u.hPtr = (RTHEAPSIMPLE)((uint8_t *)pvBase + offHeapHandle);
-            rc = RTHeapSimpleRelocate (pHeap->u.hPtr, offDelta); AssertRC(rc);
-        }
-        if (RT_SUCCESS (rc))
-        {
-            pHeap->cRefs = 0;
-            pHeap->fOffsetBased = fOffsetBased;
-        }
-        else
-        {
-            HGSMIAreaClear (&pHeap->area);
-        }
-    }
+    pHeader->u8Flags        = HGSMI_BUFFER_HEADER_F_SEQ_SINGLE;
+    pHeader->u32DataSize    = u32DataSize;
+    pHeader->u8Channel      = u8Channel;
+    pHeader->u16ChannelInfo = u16ChannelInfo;
+    RT_ZERO(pHeader->u.au8Union);
 
-    return rc;
+    HGSMIBUFFERTAIL *pTail = HGSMIBufferTailFromPtr(pHeader, u32DataSize);
+    pTail->u32Reserved = 0;
+    pTail->u32Checksum = HGSMIChecksum(offBuffer, pHeader, pTail);
+
+    return offBuffer;
 }
 
-int HGSMIHeapSetup (HGSMIHEAP *pHeap,
-                    void *pvBase,
-                    HGSMISIZE cbArea,
-                    HGSMIOFFSET offBase,
-                    bool fOffsetBased)
+int HGSMIHeapSetup(HGSMIHEAP *pHeap,
+                   void *pvBase,
+                   HGSMISIZE cbArea,
+                   HGSMIOFFSET offBase,
+                   const HGSMIENV *pEnv)
 {
-    if (   !pHeap
-        || !pvBase)
-    {
-        return VERR_INVALID_PARAMETER;
-    }
-
-    int rc = HGSMIAreaInitialize (&pHeap->area, pvBase, cbArea, offBase);
+    AssertPtrReturn(pHeap, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pvBase, VERR_INVALID_PARAMETER);
 
-    if (RT_SUCCESS (rc))
+    int rc = HGSMIAreaInitialize(&pHeap->area, pvBase, cbArea, offBase);
+    if (RT_SUCCESS(rc))
     {
-        if (!fOffsetBased)
-            rc = RTHeapSimpleInit (&pHeap->u.hPtr, pvBase, cbArea);
-        else
-            rc = RTHeapOffsetInit (&pHeap->u.hOff, pvBase, cbArea);
-
-        if (RT_SUCCESS (rc))
+        rc = HGSMIMAInit(&pHeap->ma, &pHeap->area, NULL, 0, 0, pEnv);
+        if (RT_FAILURE(rc))
         {
-            pHeap->cRefs = 0;
-            pHeap->fOffsetBased = fOffsetBased;
-        }
-        else
-        {
-            HGSMIAreaClear (&pHeap->area);
+            HGSMIAreaClear(&pHeap->area);
         }
     }
 
     return rc;
 }
 
-void HGSMIHeapDestroy (HGSMIHEAP *pHeap)
+void HGSMIHeapDestroy(HGSMIHEAP *pHeap)
 {
     if (pHeap)
     {
-        Assert(!pHeap->cRefs);
-        pHeap->u.hPtr = NIL_RTHEAPSIMPLE;
-        HGSMIAreaClear (&pHeap->area);
-        pHeap->cRefs = 0;
+        HGSMIMAUninit(&pHeap->ma);
+        RT_ZERO(*pHeap);
     }
 }
 
-void *HGSMIHeapAlloc (HGSMIHEAP *pHeap,
-                      HGSMISIZE cbData,
-                      uint8_t u8Channel,
-                      uint16_t u16ChannelInfo)
+void *HGSMIHeapAlloc(HGSMIHEAP *pHeap,
+                     HGSMISIZE cbData,
+                     uint8_t u8Channel,
+                     uint16_t u16ChannelInfo)
 {
-    if (pHeap->u.hPtr == NIL_RTHEAPSIMPLE)
+    HGSMISIZE cbAlloc = HGSMIBufferRequiredSize(cbData);
+    HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIHeapBufferAlloc(pHeap, cbAlloc);
+    if (pHeader)
     {
-        return NULL;
+        HGSMIOFFSET offBuffer = HGSMIBufferInitializeSingle(HGSMIHeapArea(pHeap), pHeader,
+                                                            cbAlloc, u8Channel, u16ChannelInfo);
+        if (offBuffer == HGSMIOFFSET_VOID)
+        {
+            HGSMIHeapBufferFree(pHeap, pHeader);
+            pHeader = NULL;
+        }
     }
 
-    size_t cbAlloc = HGSMIBufferRequiredSize (cbData);
-
-    HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIHeapBufferAlloc (pHeap, cbAlloc);
-    if (!pHeader)
-        return NULL;
-
-    hgsmiBufferInitializeSingle (&pHeap->area, pHeader, cbData, u8Channel, u16ChannelInfo);
-
-    return HGSMIBufferData (pHeader);
-}
-
-HGSMIOFFSET HGSMIHeapBufferOffset (HGSMIHEAP *pHeap,
-                                   void *pvData)
-{
-    HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData (pvData);
-
-    HGSMIOFFSET offBuffer = HGSMIPointerToOffset (&pHeap->area, pHeader);
-
-    return offBuffer;
+    return pHeader? HGSMIBufferDataFromPtr(pHeader): NULL;
 }
 
-void HGSMIHeapFree (HGSMIHEAP *pHeap,
-                    void *pvData)
+void HGSMIHeapFree(HGSMIHEAP *pHeap,
+                   void *pvData)
 {
-    if (   pvData
-        && pHeap->u.hPtr != NIL_RTHEAPSIMPLE)
+    if (pvData)
     {
-        HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData (pvData);
-
-        HGSMIHeapBufferFree (pHeap, pHeader);
+        HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);
+        HGSMIHeapBufferFree(pHeap, pHeader);
     }
 }
 
-void* HGSMIHeapBufferAlloc (HGSMIHEAP *pHeap, HGSMISIZE cbBuffer)
+void *HGSMIHeapBufferAlloc(HGSMIHEAP *pHeap,
+                           HGSMISIZE cbBuffer)
 {
-    void* pvBuf;
-    if (!pHeap->fOffsetBased)
-        pvBuf = RTHeapSimpleAlloc (pHeap->u.hPtr, cbBuffer, 0);
-    else
-        pvBuf = RTHeapOffsetAlloc (pHeap->u.hOff, cbBuffer, 0);
-
-    if (!pvBuf)
-        return NULL;
-
-    ++pHeap->cRefs;
+    void *pvBuf = HGSMIMAAlloc(&pHeap->ma, cbBuffer);
     return pvBuf;
 }
 
 void HGSMIHeapBufferFree(HGSMIHEAP *pHeap,
-                    void *pvBuf)
+                         void *pvBuf)
 {
-    if (!pHeap->fOffsetBased)
-        RTHeapSimpleFree (pHeap->u.hPtr, pvBuf);
-    else
-        RTHeapOffsetFree (pHeap->u.hOff, pvBuf);
-
-    --pHeap->cRefs;
+    HGSMIMAFree(&pHeap->ma, pvBuf);
 }
 
 typedef struct HGSMIBUFFERCONTEXT
@@ -366,7 +260,12 @@ typedef struct HGSMIBUFFERCONTEXT
     uint32_t cbData;                  /* Size of data  */
 } HGSMIBUFFERCONTEXT;
 
-/* Verify that the given offBuffer points to a valid buffer, which is within the area.
+/** Verify that the given offBuffer points to a valid buffer, which is within the area.
+ * 
+ * @returns VBox status and the buffer information in pBufferContext.
+ * @param pArea          Area which supposed to contain the buffer.
+ * @param offBuffer      The buffer location in the area.
+ * @param pBufferContext Where to write information about the buffer.
  */
 static int hgsmiVerifyBuffer(const HGSMIAREA *pArea,
                              HGSMIOFFSET offBuffer,
@@ -403,7 +302,7 @@ static int hgsmiVerifyBuffer(const HGSMIAREA *pArea,
             /* At least both header and tail structures are in the area. Check the checksum. */
             uint32_t u32Checksum = HGSMIChecksum(offBuffer, &header, &tail);
             LogFlowFunc(("checksum check: u32Checksum = 0x%x pTail->u32Checksum = 0x%x\n",
-                         u32Checksum, pTail->u32Checksum));
+                         u32Checksum, tail.u32Checksum));
             if (u32Checksum == tail.u32Checksum)
             {
                 /* Success. */
@@ -414,7 +313,7 @@ static int hgsmiVerifyBuffer(const HGSMIAREA *pArea,
             else
             {
                 LogFunc(("invalid checksum 0x%x, expected 0x%x!!!\n",
-                         u32Checksum, pTail->u32Checksum));
+                         u32Checksum, tail.u32Checksum));
                 rc = VERR_INVALID_STATE;
                 HGSMI_STRICT_ASSERT_FAILED();
             }
@@ -431,31 +330,6 @@ static int hgsmiVerifyBuffer(const HGSMIAREA *pArea,
     return rc;
 }
 
-/* A wrapper to safely call the handler.
- */
-static int hgsmiChannelHandlerCall(const HGSMICHANNELHANDLER *pHandler,
-                                   const HGSMIBUFFERCONTEXT *pBufferContext)
-{
-    LogFlowFunc(("pHandler %p\n", pHandler));
-
-    int rc;
-
-    if (   pHandler
-        && pHandler->pfnHandler)
-    {
-        rc = pHandler->pfnHandler(pHandler->pvHandler, pBufferContext->pHeader->u16ChannelInfo,
-                                  pBufferContext->pvData, pBufferContext->cbData);
-    }
-    else
-    {
-        /* It is a NOOP case here. */
-        rc = VINF_SUCCESS;
-    }
-
-    LogFlowFunc(("leave rc = %Rrc\n", rc));
-    return rc;
-}
-
 /** Helper to convert HGSMI channel index to the channel structure pointer.
  *
  * @returns Pointer to the channel data.
@@ -483,7 +357,7 @@ HGSMICHANNEL *HGSMIChannelFindById(HGSMICHANNELINFO *pChannelInfo,
  * @param pChannelInfo The channel pool.
  * @param offBuffer    The buffer location in the area.
  */
-int HGSMIBufferProcess(HGSMIAREA *pArea,
+int HGSMIBufferProcess(const HGSMIAREA *pArea,
                        HGSMICHANNELINFO *pChannelInfo,
                        HGSMIOFFSET offBuffer)
 {
@@ -500,10 +374,15 @@ int HGSMIBufferProcess(HGSMIAREA *pArea,
         /* Pass the command to the appropriate handler registered with this instance.
          * Start with the handler list head, which is the preallocated HGSMI setup channel.
          */
-        HGSMICHANNEL *pChannel = HGSMIChannelFindById(pChannelInfo, bufferContext.pHeader->u8Channel);
+        const HGSMICHANNEL *pChannel = HGSMIChannelFindById(pChannelInfo, bufferContext.pHeader->u8Channel);
         if (pChannel)
         {
-            rc = hgsmiChannelHandlerCall(&pChannel->handler, &bufferContext);
+            const HGSMICHANNELHANDLER *pHandler = &pChannel->handler;
+            if (pHandler->pfnHandler)
+            {
+                pHandler->pfnHandler(pHandler->pvHandler, bufferContext.pHeader->u16ChannelInfo,
+                                     bufferContext.pvData, bufferContext.cbData);
+            }
             HGSMI_STRICT_ASSERT(RT_SUCCESS(hgsmiVerifyBuffer(pArea, offBuffer, &bufferContext)));
         }
         else
diff --git a/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp b/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp
new file mode 100644
index 0000000..3878c02
--- /dev/null
+++ b/src/VBox/GuestHost/HGSMI/HGSMIMemAlloc.cpp
@@ -0,0 +1,661 @@
+/* $Id: HGSMIMemAlloc.cpp $ */
+/** @file
+ * VBox Host Guest Shared Memory Interface (HGSMI) - Memory allocator.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*
+ * Memory allocator
+ * ----------------
+ *
+ * Area [0; AreaSize) contains only the data, control structures are separate.
+ * Block sizes are power of 2: 32B, ..., 1MB
+ * Area size can be anything and will be divided initially to largest possible free blocks.
+ *
+ * The entire area is described by a list of 32 bit block descriptors:
+ *  * bits 0..3  - order, which is log2 size of the block - 5: 2^(0+5) ... 2^(15+5) == 32B .. 1MB
+ *  * bit  4     - 1 for free blocks.
+ *  * bits 5..31 - block offset.
+ *
+ * 31 ... 5 | 4 | 3 ... 0
+ *  offset    F   order
+ *
+ * There is a sorted collection of all block descriptors
+ * (key is the block offset, bits 0...4 do not interfere with sorting).
+ * Also there are lists of free blocks for each size for fast allocation.
+ *
+ *
+ * Implementation
+ * --------------
+ *
+ * The blocks collection is a sorted linear list.
+ *
+ * Initially the entire area consists of one or more largest blocks followed by smaller blocks:
+ *  * 100B area - 64B block with descriptor: 0x00000011
+ *                32B block with descriptor: 0x00000030
+ *                4B unused
+ *  * 64K area  - one 64K block with descriptor: 0x0000001C
+ *  * 512K area - one 512K block with descriptor: 0x0000001F
+ *
+ * When allocating a new block:
+ *  * larger free blocks are splitted when there are no smaller free blocks;
+ *  * smaller free blocks are merged if they can build a requested larger block.
+ */
+#include <VBox/HGSMI/HGSMIMemAlloc.h>
+#include <VBox/HGSMI/HGSMI.h>
+
+#include <iprt/err.h>
+#include <iprt/string.h>
+
+
+DECLINLINE(HGSMIOFFSET) hgsmiMADescriptor(HGSMIOFFSET off, bool fFree, HGSMIOFFSET order)
+{
+    return (off & HGSMI_MA_DESC_OFFSET_MASK) |
+           (fFree? HGSMI_MA_DESC_FREE_MASK: 0) |
+           (order & HGSMI_MA_DESC_ORDER_MASK);
+}
+
+static void hgsmiMABlockFree(HGSMIMADATA *pMA, HGSMIMABLOCK *pBlock)
+{
+    pMA->env.pfnFree(pMA->env.pvEnv, pBlock);
+}
+
+static int hgsmiMABlockAlloc(HGSMIMADATA *pMA, HGSMIMABLOCK **ppBlock)
+{
+    int rc = VINF_SUCCESS;
+
+    HGSMIMABLOCK *pBlock = (HGSMIMABLOCK *)pMA->env.pfnAlloc(pMA->env.pvEnv, sizeof(HGSMIMABLOCK));
+    if (pBlock)
+    {
+        RT_ZERO(pBlock->nodeBlock);
+        *ppBlock = pBlock;
+    }
+    else
+    {
+        rc = VERR_NO_MEMORY;
+    }
+
+    return rc;
+}
+
+/* Divide entire area to free blocks. */
+static int hgsmiMAFormat(HGSMIMADATA *pMA)
+{
+    int rc = VINF_SUCCESS;
+
+    /* Initial value, it will be updated in the loop below. */
+    pMA->cbMaxBlock = HGSMI_MA_BLOCK_SIZE_MIN;
+    pMA->cBlocks = 0;
+
+    HGSMISIZE cbBlock = HGSMI_MA_BLOCK_SIZE_MAX;
+    HGSMISIZE cbRemaining = pMA->area.cbArea;
+    HGSMIOFFSET off = 0;
+
+    while (cbBlock >= HGSMI_MA_BLOCK_SIZE_MIN)
+    {
+        /* Build a list of free memory blocks with u32BlockSize. */
+        uint32_t cBlocks = cbRemaining / cbBlock;
+        if (cBlocks > 0)
+        {
+            if (pMA->cbMaxBlock < cbBlock)
+            {
+                pMA->cbMaxBlock = cbBlock;
+            }
+
+            HGSMIOFFSET order = HGSMIMASize2Order(cbBlock);
+
+            uint32_t i;
+            for (i = 0; i < cBlocks; ++i)
+            {
+                /* A new free block. */
+                HGSMIMABLOCK *pBlock;
+                rc = hgsmiMABlockAlloc(pMA, &pBlock);
+                if (RT_FAILURE(rc))
+                {
+                    break;
+                }
+
+                pBlock->descriptor = hgsmiMADescriptor(off, true, order);
+                RTListAppend(&pMA->listBlocks, &pBlock->nodeBlock);
+                ++pMA->cBlocks;
+
+                off += cbBlock;
+                cbRemaining -= cbBlock;
+            }
+        }
+
+        if (RT_FAILURE(rc))
+        {
+            break;
+        }
+
+        cbBlock /= 2;
+    }
+
+    return rc;
+}
+
+static int hgsmiMARebuildFreeLists(HGSMIMADATA *pMA)
+{
+    int rc = VINF_SUCCESS;
+
+    HGSMIMABLOCK *pIter;
+    RTListForEach(&pMA->listBlocks, pIter, HGSMIMABLOCK, nodeBlock)
+    {
+        if (HGSMI_MA_DESC_IS_FREE(pIter->descriptor))
+        {
+            HGSMIOFFSET order = HGSMI_MA_DESC_ORDER(pIter->descriptor);
+            RTListAppend(&pMA->aListFreeBlocks[order], &pIter->nodeFree);
+        }
+    }
+
+    return rc;
+}
+
+static int hgsmiMARestore(HGSMIMADATA *pMA, HGSMIOFFSET *paDescriptors, uint32_t cDescriptors, HGSMISIZE cbMaxBlock)
+{
+    int rc = VINF_SUCCESS;
+
+    pMA->cbMaxBlock = cbMaxBlock;
+    pMA->cBlocks = 0;
+
+    HGSMISIZE cbRemaining = pMA->area.cbArea;
+    HGSMIOFFSET off = 0;
+
+    uint32_t i;
+    for (i = 0; i < cDescriptors; ++i)
+    {
+        /* Verify the descriptor. */
+        HGSMISIZE cbBlock = HGSMIMAOrder2Size(HGSMI_MA_DESC_ORDER(paDescriptors[i]));
+        if (   off != HGSMI_MA_DESC_OFFSET(paDescriptors[i])
+            || cbBlock > cbRemaining
+            || cbBlock > pMA->cbMaxBlock)
+        {
+            rc = VERR_INVALID_PARAMETER;
+            break;
+        }
+
+        /* A new free block. */
+        HGSMIMABLOCK *pBlock;
+        rc = hgsmiMABlockAlloc(pMA, &pBlock);
+        if (RT_FAILURE(rc))
+        {
+            break;
+        }
+
+        pBlock->descriptor = paDescriptors[i];
+        RTListAppend(&pMA->listBlocks, &pBlock->nodeBlock);
+        ++pMA->cBlocks;
+
+        off += cbBlock;
+        cbRemaining -= cbBlock;
+    }
+
+    return rc;
+}
+
+static HGSMIMABLOCK *hgsmiMAGetFreeBlock(HGSMIMADATA *pMA, HGSMIOFFSET order)
+{
+    HGSMIMABLOCK *pBlock = NULL;
+
+    HGSMIOFFSET i;
+    for (i = order; i < RT_ELEMENTS(pMA->aListFreeBlocks); ++i)
+    {
+        pBlock = RTListGetFirst(&pMA->aListFreeBlocks[i], HGSMIMABLOCK, nodeFree);
+        if (pBlock)
+        {
+            break;
+        }
+    }
+
+    if (pBlock)
+    {
+        AssertReturn(HGSMI_MA_DESC_IS_FREE(pBlock->descriptor), NULL);
+
+        /* Where the block starts. */
+        HGSMIOFFSET off = HGSMI_MA_DESC_OFFSET(pBlock->descriptor);
+
+        /* 'i' is the order of the block. */
+        while (i != order)
+        {
+            /* A larger block was found and need to be split to 2 smaller blocks. */
+            HGSMIMABLOCK *pBlock2;
+            int rc = hgsmiMABlockAlloc(pMA, &pBlock2);
+            if (RT_FAILURE(rc))
+            {
+                pBlock = NULL;
+                break;
+            }
+
+            /* Create 2 blocks with descreased order. */
+            --i;
+
+            /* Remove from the free list. */
+            RTListNodeRemove(&pBlock->nodeFree);
+
+            pBlock->descriptor = hgsmiMADescriptor(off, true, i);
+            pBlock2->descriptor = hgsmiMADescriptor(off + HGSMIMAOrder2Size(i), true, i);
+
+            /* Update list of all blocks by inserting pBlock2 after pBlock. */
+            RTListNodeInsertAfter(&pBlock->nodeBlock, &pBlock2->nodeBlock);
+            ++pMA->cBlocks;
+
+            /* Update the free list. */
+            RTListAppend(&pMA->aListFreeBlocks[i], &pBlock->nodeFree);
+            RTListAppend(&pMA->aListFreeBlocks[i], &pBlock2->nodeFree);
+        }
+    }
+
+    return pBlock;
+}
+
+static void hgsmiMAReformatFreeBlocks(HGSMIMADATA *pMA, HGSMIOFFSET maxId,
+                                      HGSMIMABLOCK *pStart, HGSMIMABLOCK *pEnd, HGSMISIZE cbBlocks)
+{
+    int rc = VINF_SUCCESS;
+
+    /*
+     * Blocks starting from pStart until pEnd will be replaced with
+     * another set of blocks.
+     *
+     * The new set will include the block with the required order.
+     * Since the required order is larger than any existing block,
+     * it will replace at least two existing blocks.
+     * The new set will also have minimal possible number of blocks.
+     * Therefore the new set will have at least one block less.
+     * Blocks will be updated in place and remaining blocks will be
+     * deallocated.
+     */
+
+    HGSMISIZE u32BlockSize = HGSMIMAOrder2Size(maxId);
+    HGSMISIZE cbRemaining = cbBlocks;
+    HGSMIOFFSET off = HGSMI_MA_DESC_OFFSET(pStart->descriptor);
+    HGSMIMABLOCK *pBlock = pStart;
+
+    while (u32BlockSize >= HGSMI_MA_BLOCK_SIZE_MIN && cbRemaining)
+    {
+        /* Build a list of free memory blocks with u32BlockSize. */
+        uint32_t cBlocks = cbRemaining / u32BlockSize;
+        if (cBlocks > 0)
+        {
+            HGSMIOFFSET order = HGSMIMASize2Order(u32BlockSize);
+
+            uint32_t i;
+            for (i = 0; i < cBlocks; ++i)
+            {
+                if (pBlock == pEnd)
+                {
+                    /* Should never happen because the new set of blocks is supposed to be smaller. */
+                    AssertFailed();
+                    rc = VERR_OUT_OF_RESOURCES;
+                    break;
+                }
+
+                /* Remove from the free list. */
+                RTListNodeRemove(&pBlock->nodeFree);
+
+                pBlock->descriptor = hgsmiMADescriptor(off, true, order);
+
+                RTListAppend(&pMA->aListFreeBlocks[order], &pBlock->nodeFree);
+
+                off += u32BlockSize;
+                cbRemaining -= u32BlockSize;
+
+                pBlock = RTListGetNext(&pMA->listBlocks, pBlock, HGSMIMABLOCK, nodeBlock);
+            }
+        }
+
+        if (RT_FAILURE(rc))
+        {
+            break;
+        }
+
+        u32BlockSize /= 2;
+    }
+
+    Assert(cbRemaining == 0);
+
+    if (RT_SUCCESS(rc))
+    {
+        /* Remove remaining free blocks from pBlock until pEnd */
+        for (;;)
+        {
+            bool fEnd = (pBlock == pEnd);
+            HGSMIMABLOCK *pNext = RTListGetNext(&pMA->listBlocks, pBlock, HGSMIMABLOCK, nodeBlock);
+
+            RTListNodeRemove(&pBlock->nodeFree);
+            RTListNodeRemove(&pBlock->nodeBlock);
+            --pMA->cBlocks;
+
+            hgsmiMABlockFree(pMA, pBlock);
+
+            if (fEnd)
+            {
+                break;
+            }
+
+            pBlock = pNext;
+        }
+    }
+}
+
+static void hgsmiMAQueryFreeRange(HGSMIMADATA *pMA, HGSMIMABLOCK *pBlock, HGSMISIZE cbRequired,
+                                  HGSMIMABLOCK **ppStart, HGSMIMABLOCK **ppEnd, HGSMISIZE *pcbBlocks)
+{
+    Assert(HGSMI_MA_DESC_IS_FREE(pBlock->descriptor));
+
+    *pcbBlocks = HGSMIMAOrder2Size(HGSMI_MA_DESC_ORDER(pBlock->descriptor));
+    *ppStart = pBlock;
+    *ppEnd = pBlock;
+
+    HGSMIMABLOCK *p;
+    for (;;)
+    {
+        p = RTListGetNext(&pMA->listBlocks, *ppEnd, HGSMIMABLOCK, nodeBlock);
+        if (!p || !HGSMI_MA_DESC_IS_FREE(p->descriptor))
+        {
+            break;
+        }
+        *pcbBlocks += HGSMIMAOrder2Size(HGSMI_MA_DESC_ORDER(p->descriptor));
+        *ppEnd = p;
+
+        if (cbRequired && *pcbBlocks >= cbRequired)
+        {
+            return;
+        }
+    }
+    for (;;)
+    {
+        p = RTListGetPrev(&pMA->listBlocks, *ppStart, HGSMIMABLOCK, nodeBlock);
+        if (!p || !HGSMI_MA_DESC_IS_FREE(p->descriptor))
+        {
+            break;
+        }
+        *pcbBlocks += HGSMIMAOrder2Size(HGSMI_MA_DESC_ORDER(p->descriptor));
+        *ppStart = p;
+
+        if (cbRequired && *pcbBlocks >= cbRequired)
+        {
+            return;
+        }
+    }
+}
+
+static void hgsmiMAMergeFreeBlocks(HGSMIMADATA *pMA, HGSMIOFFSET order)
+{
+    /* Try to create a free block with the order from smaller free blocks. */
+    if (order == 0)
+    {
+        /* No smaller blocks. */
+        return;
+    }
+
+    HGSMISIZE cbRequired = HGSMIMAOrder2Size(order);
+
+    /* Scan all free lists of smaller blocks.
+     *
+     * Get the sequence of free blocks before and after each free block.
+     * If possible, re-split the sequence to get the required block and other free block(s).
+     * If not possible, try the next free block.
+     *
+     * Free blocks are scanned from i to 0 orders.
+     */
+    HGSMIOFFSET i = order - 1;
+    for (;;)
+    {
+        HGSMIMABLOCK *pIter;
+        RTListForEach(&pMA->aListFreeBlocks[i], pIter, HGSMIMABLOCK, nodeFree)
+        {
+            Assert(HGSMI_MA_DESC_ORDER(pIter->descriptor) == i);
+
+            HGSMISIZE cbBlocks;
+            HGSMIMABLOCK *pFreeStart;
+            HGSMIMABLOCK *pFreeEnd;
+            hgsmiMAQueryFreeRange(pMA, pIter, cbRequired, &pFreeStart, &pFreeEnd, &cbBlocks);
+
+            Assert((cbBlocks / HGSMI_MA_BLOCK_SIZE_MIN) * HGSMI_MA_BLOCK_SIZE_MIN == cbBlocks);
+
+            /* Verify whether cbBlocks is enough for the requested block. */
+            if (cbBlocks >= cbRequired)
+            {
+                /* Build new free blocks starting from the requested. */
+                hgsmiMAReformatFreeBlocks(pMA, order, pFreeStart, pFreeEnd, cbBlocks);
+                i = 0; /* Leave the loop. */
+                break;
+            }
+        }
+
+        if (i == 0)
+        {
+            break;
+        }
+
+        --i;
+    }
+}
+
+static HGSMIOFFSET hgsmiMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb)
+{
+    if (cb > pMA->cbMaxBlock)
+    {
+        return HGSMIOFFSET_VOID;
+    }
+
+    if (cb < HGSMI_MA_BLOCK_SIZE_MIN)
+    {
+        cb = HGSMI_MA_BLOCK_SIZE_MIN;
+    }
+
+    HGSMIOFFSET order = HGSMIPopCnt32(cb - 1) - HGSMI_MA_DESC_ORDER_BASE;
+
+    AssertReturn(HGSMIMAOrder2Size(order) >= cb, HGSMIOFFSET_VOID);
+    AssertReturn(order < RT_ELEMENTS(pMA->aListFreeBlocks), HGSMIOFFSET_VOID);
+
+    HGSMIMABLOCK *pBlock = hgsmiMAGetFreeBlock(pMA, order);
+    if (RT_UNLIKELY(pBlock == NULL))
+    {
+        /* No free block with large enough size. Merge smaller free blocks and try again. */
+        hgsmiMAMergeFreeBlocks(pMA, order);
+        pBlock = hgsmiMAGetFreeBlock(pMA, order);
+    }
+
+    if (RT_LIKELY(pBlock != NULL))
+    {
+        RTListNodeRemove(&pBlock->nodeFree);
+        pBlock->descriptor &= ~HGSMI_MA_DESC_FREE_MASK;
+        return HGSMI_MA_DESC_OFFSET(pBlock->descriptor);
+    }
+
+    return HGSMIOFFSET_VOID;
+}
+
+static void hgsmiMAFree(HGSMIMADATA *pMA, HGSMIOFFSET off)
+{
+    if (off == HGSMIOFFSET_VOID)
+    {
+        return;
+    }
+
+    /* Find the block corresponding to the offset. */
+    Assert((off / HGSMI_MA_BLOCK_SIZE_MIN) * HGSMI_MA_BLOCK_SIZE_MIN == off);
+
+    HGSMIMABLOCK *pBlock = HGSMIMASearchOffset(pMA, off);
+    if (pBlock)
+    {
+        if (HGSMI_MA_DESC_OFFSET(pBlock->descriptor) == off)
+        {
+            /* Found the right block, mark it as free. */
+            pBlock->descriptor |= HGSMI_MA_DESC_FREE_MASK;
+            RTListAppend(&pMA->aListFreeBlocks[HGSMI_MA_DESC_ORDER(pBlock->descriptor)], &pBlock->nodeFree);
+            return;
+        }
+    }
+
+    AssertFailed();
+}
+
+int HGSMIMAInit(HGSMIMADATA *pMA, const HGSMIAREA *pArea,
+                HGSMIOFFSET *paDescriptors, uint32_t cDescriptors, HGSMISIZE cbMaxBlock,
+                const HGSMIENV *pEnv)
+{
+    AssertReturn(pArea->cbArea < UINT32_C(0x80000000), VERR_INVALID_PARAMETER);
+    AssertReturn(pArea->cbArea >= HGSMI_MA_BLOCK_SIZE_MIN, VERR_INVALID_PARAMETER);
+
+    RT_ZERO(*pMA);
+
+    HGSMISIZE cb = (pArea->cbArea / HGSMI_MA_BLOCK_SIZE_MIN) * HGSMI_MA_BLOCK_SIZE_MIN;
+
+    int rc = HGSMIAreaInitialize(&pMA->area, pArea->pu8Base, cb, 0);
+    if (RT_SUCCESS(rc))
+    {
+        pMA->env = *pEnv;
+
+        uint32_t i;
+        for (i = 0; i < RT_ELEMENTS(pMA->aListFreeBlocks); ++i)
+        {
+            RTListInit(&pMA->aListFreeBlocks[i]);
+        }
+        RTListInit(&pMA->listBlocks);
+
+        if (cDescriptors)
+        {
+            rc = hgsmiMARestore(pMA, paDescriptors, cDescriptors, cbMaxBlock);
+        }
+        else
+        {
+            rc = hgsmiMAFormat(pMA);
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            rc = hgsmiMARebuildFreeLists(pMA);
+        }
+    }
+
+    return rc;
+}
+
+void HGSMIMAUninit(HGSMIMADATA *pMA)
+{
+    HGSMIMABLOCK *pIter;
+    HGSMIMABLOCK *pNext;
+
+    RTListForEachSafe(&pMA->listBlocks, pIter, pNext, HGSMIMABLOCK, nodeBlock)
+    {
+        RTListNodeRemove(&pIter->nodeBlock);
+        hgsmiMABlockFree(pMA, pIter);
+    }
+
+    RT_ZERO(*pMA);
+}
+
+HGSMIOFFSET HGSMIMAPointerToOffset(const HGSMIMADATA *pMA, const void *pv)
+{
+    if (HGSMIAreaContainsPointer(&pMA->area, pv))
+    {
+        return HGSMIPointerToOffset(&pMA->area, pv);
+    }
+
+    AssertFailed();
+    return HGSMIOFFSET_VOID;
+}
+
+void *HGSMIMAOffsetToPointer(const HGSMIMADATA *pMA, HGSMIOFFSET off)
+{
+    if (HGSMIAreaContainsOffset(&pMA->area, off))
+    {
+        return HGSMIOffsetToPointer(&pMA->area, off);
+    }
+
+    AssertFailed();
+    return NULL;
+}
+
+void *HGSMIMAAlloc(HGSMIMADATA *pMA, HGSMISIZE cb)
+{
+    HGSMIOFFSET off = hgsmiMAAlloc(pMA, cb);
+    return HGSMIMAOffsetToPointer(pMA, off);
+}
+
+void HGSMIMAFree(HGSMIMADATA *pMA, void *pv)
+{
+    HGSMIOFFSET off = HGSMIMAPointerToOffset(pMA, pv);
+    if (off != HGSMIOFFSET_VOID)
+    {
+        hgsmiMAFree(pMA, off);
+    }
+    else
+    {
+        AssertFailed();
+    }
+}
+
+HGSMIMABLOCK *HGSMIMASearchOffset(HGSMIMADATA *pMA, HGSMIOFFSET off)
+{
+    /* Binary search in the block list for the offset. */
+    HGSMIMABLOCK *pStart = RTListGetFirst(&pMA->listBlocks, HGSMIMABLOCK, nodeBlock);
+    HGSMIMABLOCK *pEnd = RTListGetLast(&pMA->listBlocks, HGSMIMABLOCK, nodeBlock);
+    HGSMIMABLOCK *pMiddle;
+
+    uint32_t iStart = 0;
+    uint32_t iEnd = pMA->cBlocks;
+    uint32_t iMiddle;
+
+    for (;;)
+    {
+        pMiddle = pStart;
+        iMiddle = iStart + (iEnd - iStart) / 2;
+        if (iMiddle == iStart)
+        {
+            break;
+        }
+
+        /* Find the block with the iMiddle index. Never go further than pEnd. */
+        uint32_t i;
+        for (i = iStart; i < iMiddle && pMiddle != pEnd; ++i)
+        {
+            pMiddle = RTListNodeGetNext(&pMiddle->nodeBlock, HGSMIMABLOCK, nodeBlock);
+        }
+
+        HGSMIOFFSET offMiddle = HGSMI_MA_DESC_OFFSET(pMiddle->descriptor);
+        if (offMiddle > off)
+        {
+            pEnd = pMiddle;
+            iEnd = iMiddle;
+        }
+        else
+        {
+            pStart = pMiddle;
+            iStart = iMiddle;
+        }
+    }
+
+    return pMiddle;
+}
+
+
+/*
+ * Helper.
+ */
+
+uint32_t HGSMIPopCnt32(uint32_t u32)
+{
+    uint32_t c = 0;
+    if (u32 > 0xFFFF) { c += 16;  u32 >>= 16; }
+    if (u32 > 0xFF)   { c += 8;   u32 >>= 8;  }
+    if (u32 > 0xF)    { c += 4;   u32 >>= 4;  }
+    if (u32 > 0x3)    { c += 2;   u32 >>= 2;  }
+    if (u32 > 0x1)    { c += 1;   u32 >>= 1;  }
+    return c + u32;
+}
diff --git a/src/VBox/GuestHost/HGSMI/Makefile.kmk b/src/VBox/GuestHost/HGSMI/Makefile.kmk
index 292618b..cbff775 100644
--- a/src/VBox/GuestHost/HGSMI/Makefile.kmk
+++ b/src/VBox/GuestHost/HGSMI/Makefile.kmk
@@ -29,7 +29,8 @@ LIBRARIES += HGSMIGuestR0Lib
 HGSMIGuestR0Lib_TEMPLATE     = VBOXGUESTR0LIB
 HGSMIGuestR0Lib_DEFS         =
 HGSMIGuestR0Lib_SOURCES      = \
-	HGSMICommon.cpp
+	HGSMICommon.cpp \
+	HGSMIMemAlloc.cpp
 endif
 
 #
@@ -39,7 +40,8 @@ LIBRARIES += HGSMIHostR3Lib
 HGSMIHostR3Lib_TEMPLATE      = VBOXR3
 HGSMIHostR3Lib_DEFS          =
 HGSMIHostR3Lib_SOURCES       = \
-	HGSMICommon.cpp
+	HGSMICommon.cpp \
+	HGSMIMemAlloc.cpp
 
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/GuestHost/Makefile.kmk b/src/VBox/GuestHost/Makefile.kmk
index 58a7ce0..dd27344 100644
--- a/src/VBox/GuestHost/Makefile.kmk
+++ b/src/VBox/GuestHost/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2008-2012 Oracle Corporation
+# Copyright (C) 2008-2014 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -31,5 +31,9 @@ ifdef VBOX_WITH_HGCM
  include $(PATH_SUB_CURRENT)/SharedClipboard/Makefile.kmk
 endif
 
+ifdef VBOX_WITH_DRAG_AND_DROP
+ include $(PATH_SUB_CURRENT)/DragAndDrop/Makefile.kmk
+endif
+
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/GuestHost/OpenGL/Makefile.kmk b/src/VBox/GuestHost/OpenGL/Makefile.kmk
index 1583084..ddbc933 100644
--- a/src/VBox/GuestHost/OpenGL/Makefile.kmk
+++ b/src/VBox/GuestHost/OpenGL/Makefile.kmk
@@ -122,8 +122,8 @@ VBoxOGLcrutil_LDFLAGS += -Wl,-z,nodelete
 endif
 
 # vc7 hangs during compilation of this file when optimizations are enabled.
-VBoxOGLcrutil_pixel.c_CFLAGS.win.x86     += -Od
-VBoxOGLhostcrutil_pixel.c_CFLAGS.win.x86 += -Od
+#VBoxOGLcrutil_pixel.c_CFLAGS.win.x86     += -Od
+#VBoxOGLhostcrutil_pixel.c_CFLAGS.win.x86 += -Od
 
 if defined(VBOX_WITH_WDDM) && defined(VBOX_WITH_CROGL_ADDITIONS)
 #
@@ -149,8 +149,8 @@ VBoxOGLcrutil-x86_INCS.win    += $(PATH_ROOT)/src/VBox/Additions/WINNT/Graphics/
 VBoxOGLcrutil-x86_LIBS.win    += $(VBOX_PATH_ADDITIONS_LIB)/VBoxDispMpLogger-x86$(VBOX_SUFF_LIB)
 endif
 # vc7 hangs during compilation of this file when optimizations are enabled.
-VBoxOGLcrutil-x86_pixel.c_CFLAGS += -Od
-VBoxOGLcrutil-x86_pixel.c_CFLAGS += -Od
+#VBoxOGLcrutil-x86_pixel.c_CFLAGS += -Od
+#VBoxOGLcrutil-x86_pixel.c_CFLAGS += -Od
 endif
 
 #
diff --git a/src/VBox/GuestHost/OpenGL/error/VBoxOGLerrorspu.rc b/src/VBox/GuestHost/OpenGL/error/VBoxOGLerrorspu.rc
index 8e88cf8..bbb146a 100644
--- a/src/VBox/GuestHost/OpenGL/error/VBoxOGLerrorspu.rc
+++ b/src/VBox/GuestHost/OpenGL/error/VBoxOGLerrorspu.rc
@@ -18,43 +18,43 @@
 #include <windows.h>
 #include <VBox/version.h>
 
-#ifdef IN_GUEST
- #define DESCRIPTION_STR    "VirtualBox crOpenGL ICD\0"
- #ifdef VBOX_WDDM_WOW64
-  #define FILENAME_STR       "VBoxOGLerrorspu-x86"
- #else
-  #define FILENAME_STR       "VBoxOGLerrorspu"
- #endif
- #define PRODUCT_STR        VBOX_PRODUCT " Guest Additions\0"
-#else
- #define DESCRIPTION_STR    "VirtualBox crOpenGL ICD\0"
- #define FILENAME_STR       "VBoxOGLerrorspu"
- #define PRODUCT_STR        VBOX_PRODUCT "\0"
-#endif
-
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
+#ifdef IN_GUEST
+      VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
+# ifdef VBOX_WDDM_WOW64
+      VALUE "InternalName",     "VBoxOGLerrorspu-x86\0"
+      VALUE "OriginalFilename", "VBoxOGLerrorspu-x86.dll\0"
+# else
+      VALUE "InternalName",     "VBoxOGLerrorspu\0"
+      VALUE "OriginalFilename", "VBoxOGLerrorspu.dll\0"
+# endif
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+#else
+      VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
+      VALUE "InternalName",     "VBoxOGLhosterrorspu\0"
+      VALUE "InternalFilename", "VBoxOGLhosterrorspu.dll\0"
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+#endif
+
       VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  DESCRIPTION_STR
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     FILENAME_STR "\0"
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
       VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", FILENAME_STR ".dll\0"
-      VALUE "ProductName",      PRODUCT_STR
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/GuestHost/OpenGL/error/errorspu.rc b/src/VBox/GuestHost/OpenGL/error/errorspu.rc
index ced9633..7ed52b2 100644
--- a/src/VBox/GuestHost/OpenGL/error/errorspu.rc
+++ b/src/VBox/GuestHost/OpenGL/error/errorspu.rc
@@ -21,30 +21,31 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK        0x3fL
-  FILEFLAGS            0x0L
-  FILEOS               0x40004L
-  FILETYPE             0x3L
-  FILESUBTYPE          0x4L
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
+  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DRV
+  FILESUBTYPE      VFT2_DRV_DISPLAY
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0"
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxOGLerrorspu\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOX_WDDM_WOW64
       VALUE "OriginalFilename", "VBoxOGLerrorspu-x86.dll\0"
 #else
       VALUE "OriginalFilename", "VBoxOGLerrorspu.dll\0"
 #endif
-      VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/GuestHost/OpenGL/include/chromium.h b/src/VBox/GuestHost/OpenGL/include/chromium.h
index 816aee9..b436ff2 100644
--- a/src/VBox/GuestHost/OpenGL/include/chromium.h
+++ b/src/VBox/GuestHost/OpenGL/include/chromium.h
@@ -781,7 +781,7 @@ typedef void (APIENTRY *crWindowSizeProc)(GLint window, GLint w, GLint h);
 typedef void (APIENTRY *crWindowPositionProc)(GLint window, GLint x, GLint y);
 typedef void (APIENTRY *crWindowShowProc)( GLint window, GLint flag );
 
-extern GLint APIENTRY crCreateContext(const char *dpyName, GLint visBits);
+extern GLint APIENTRY crCreateContext(char *dpyName, GLint visBits);
 extern void APIENTRY crDestroyContext(GLint context);
 extern void APIENTRY crMakeCurrent(GLint window, GLint context);
 extern GLint APIENTRY crGetCurrentContext(void);
diff --git a/src/VBox/GuestHost/OpenGL/include/cr_dlm.h b/src/VBox/GuestHost/OpenGL/include/cr_dlm.h
deleted file mode 100644
index b595368..0000000
--- a/src/VBox/GuestHost/OpenGL/include/cr_dlm.h
+++ /dev/null
@@ -1,655 +0,0 @@
-#ifndef CR_DLM_H
-
-/* DO NOT EDIT.  This file is auto-generated by dlm_header.py. */
-#define CR_DLM_H
-
-#if defined(WINDOWS)
-#define DLM_APIENTRY
-#else
-#define DLM_APIENTRY
-#endif
-
-#include "chromium.h"
-#include "state/cr_client.h"
-#include "cr_spu.h"
-#include "cr_hash.h"
-#include "cr_threads.h"
-#include "cr_pack.h"
-#ifdef CHROMIUM_THREADSAFE
-#include "cr_threads.h"
-#endif
-
-/* 3D bounding box */
-typedef struct {
-	double xmin, xmax, ymin, ymax, zmin, zmax;
-} CRDLMBounds;
-
-/* Indicates whether we're currently involved in playback or not */
-typedef enum {
-	CRDLM_IMMEDIATE = 0,
-	CRDLM_REPLAY_STATE_FUNCTIONS = 1,
-	CRDLM_REPLAY_ALL_FUNCTIONS = 2
-} CRDLMReplayState;
-
-/* This is enough information to hold an instance of a single function call. */
-typedef struct DLMInstanceList {
-	struct DLMInstanceList *next;
-	struct DLMInstanceList *stateNext;
-	void (*execute)(struct DLMInstanceList *instance, SPUDispatchTable *dispatchTable);
-} DLMInstanceList;
-
-typedef struct {
-	DLMInstanceList *first, *last;
-	int numInstances;
-	DLMInstanceList *stateFirst, *stateLast;
-	CRHashTable *references; /* display lists that this display list calls */
-	CRDLMBounds bbox;
-	GLboolean listSent;
-} DLMListInfo;
-
-typedef struct {
-	/* This holds all the display list information, hashed by list identifier. */
-	CRHashTable *displayLists;
-
-	/* This is a count of the number of contexts/users that are using
-	 * this DLM.
-	 */
-	unsigned int userCount;
-
-#ifdef CHROMIUM_THREADSAFE
-	/* This mutex protects the displayLists hash table from simultaneous
-	 * updates by multiple contexts.
-	 */
-	CRmutex dlMutex;
-	CRtsd tsdKey;
-#endif
-
-	/* Configuration information - see the CRDLMConfig structure below
-	 * for details.
-	 */
-	unsigned int bufferSize;
-} CRDLM;
-
-/* This structure holds thread-specific state.  Each thread can be
- * associated with one (and only one) context; and each context can
- * be associated with one (and only one) DLM.  Making things interesting,
- * though, is that each DLM can be associated with multiple contexts.
- *
- * So the thread-specific data key is associated with each context, not
- * with each DLM.  Two different threads can, through two different
- * contexts that share a single DLM, each have independent state and
- * conditions.
- */
-
-typedef struct {
-	CRDLM *dlm;			/* the DLM associated with this state */
-	unsigned long currentListIdentifier;	/* open display list */
-	DLMListInfo *currentListInfo;	/* open display list data */
-	GLenum currentListMode;		/* GL_COMPILE or GL_COMPILE_AND_EXECUTE */
-	GLuint listBase;
-	CRDLMReplayState replayState;	/* CRDLM_IMMEDIATE, CRDLM_REPLAY_STATE_FUNCTIONS, or CRDLM_REPLAY_ALL_FUNCTIONS */
-
-} CRDLMContextState;
-
-/* These additional structures are for passing information to and from the 
- * CRDLM interface routines.
- */
-typedef struct {
-	/* The size, in bytes, that the packer will initially allocate for
-	 * each new buffer.
-	 */
-#define CRDLM_DEFAULT_BUFFERSIZE (1024*1024)
-	unsigned int bufferSize;	/* this will be allocated for each buffer */
-} CRDLMConfig;
-
-/* Positive values match GL error values.
- * 0 (GL_NO_ERROR) is returned for success
- * Negative values are internal errors.
- * Possible positive values (from GL/gl.h) are:
- * GL_NO_ERROR (0x0)
- * GL_INVALID_ENUM (0x0500)
- * GL_INVALID_VALUE (0x0501)
- * GL_INVALID_OPERATION (0x0502)
- * GL_STACK_OVERFLOW (0x0503)
- * GL_STACK_UNDERFLOW (0x0504)
- * GL_OUT_OF_MEMORY (0x0505)
- */
-typedef int CRDLMError;
-
-/* This error reported if there's no current state. The caller is responsible
- * for appropriately allocating context state with crDLMNewContext(), and
- * for making it current with crDLMMakeCurrent().
- */
-#define CRDLM_ERROR_STATE	(-1)
-
-
-typedef void (*CRDLMErrorCallback)(int line, const char *file, GLenum error, const char *info);
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern CRDLM DLM_APIENTRY * crDLMNewDLM(unsigned int configSize, const CRDLMConfig *config);
-extern CRDLMContextState DLM_APIENTRY * crDLMNewContext(CRDLM *dlm);
-extern void DLM_APIENTRY crDLMFreeContext(CRDLMContextState *state);
-extern void DLM_APIENTRY crDLMUseDLM(CRDLM *dlm);
-extern void DLM_APIENTRY crDLMFreeDLM(CRDLM *dlm);
-extern void DLM_APIENTRY crDLMSetCurrentState(CRDLMContextState *state);
-extern CRDLMContextState DLM_APIENTRY * crDLMGetCurrentState(void);
-extern CRDLMReplayState DLM_APIENTRY crDLMGetReplayState(void);
-extern void DLM_APIENTRY crDLMSetupClientState(SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMRestoreClientState(CRClientState *clientState, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMSendAllDLMLists(CRDLM *dlm, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMSendAllLists(SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMSendDLMList(CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMSendList(unsigned long listIdentifier, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMReplayDLMList(CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMReplayList(unsigned long listIdentifier, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMReplayDLMListState(CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMReplayListState(unsigned long listIdentifier, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMReplayDLMLists(CRDLM *dlm, GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMReplayLists(GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMReplayDLMListsState(CRDLM *dlm, GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable);
-extern void DLM_APIENTRY crDLMReplayListsState(GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable);
-extern CRDLMError DLM_APIENTRY crDLMDeleteListContent(CRDLM *dlm, unsigned long listIdentifier);
-extern int DLM_APIENTRY crDLMGetReferences(CRDLM *dlm, unsigned long listIdentifier, int firstIndex, int sizeofBuffer, unsigned int *buffer);
-extern CRDLMError DLM_APIENTRY crDLMGetDLMBounds(CRDLM *dlm, unsigned long listIdentifier, CRDLMBounds *bounds);
-extern CRDLMError DLM_APIENTRY crDLMGetBounds(unsigned long listIdentifier, CRDLMBounds *bounds);
-extern void DLM_APIENTRY crDLMSetDLMBounds(CRDLM *dlm, unsigned long listIdentifier, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax);
-extern void DLM_APIENTRY crDLMSetBounds(unsigned long listIdentifier, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax);
-extern void DLM_APIENTRY crDLMComputeBoundingBox(unsigned long listId);
-extern GLboolean DLM_APIENTRY crDLMListHasDLMBounds(CRDLM *dlm, unsigned long listIdentifier);
-extern GLboolean DLM_APIENTRY crDLMListHasBounds(unsigned long listIdentifier);
-extern GLuint DLM_APIENTRY crDLMGetCurrentList(void);
-extern GLenum DLM_APIENTRY crDLMGetCurrentMode(void);
-extern void DLM_APIENTRY crDLMErrorFunction(CRDLMErrorCallback callback);
-extern void DLM_APIENTRY crDLMNewList(GLuint listIdentifier, GLenum mode);
-extern void DLM_APIENTRY crDLMEndList(void);
-extern void DLM_APIENTRY crDLMDeleteLists(GLuint firstListIdentifier, GLsizei range);
-extern GLboolean DLM_APIENTRY crDLMIsList(GLuint list);
-extern GLuint DLM_APIENTRY crDLMGenLists(GLsizei range);
-extern void DLM_APIENTRY crDLMListBase(GLuint base);
-
-/* auto-generated compilation functions begin here */
-extern void DLM_APIENTRY crDLMCompileAccum( GLenum op, GLfloat value );
-extern void DLM_APIENTRY crDLMCompileActiveTextureARB( GLenum texture );
-extern void DLM_APIENTRY crDLMCompileAlphaFunc( GLenum func, GLclampf ref );
-extern void DLM_APIENTRY crDLMCompileArrayElement( GLint i, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileBegin( GLenum mode );
-extern void DLM_APIENTRY crDLMCompileBeginQueryARB( GLenum target, GLuint id );
-extern void DLM_APIENTRY crDLMCompileBindProgramARB( GLenum target, GLuint program );
-extern void DLM_APIENTRY crDLMCompileBindProgramNV( GLenum target, GLuint id );
-extern void DLM_APIENTRY crDLMCompileBindTexture( GLenum target, GLuint texture );
-extern void DLM_APIENTRY crDLMCompileBitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileBlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
-extern void DLM_APIENTRY crDLMCompileBlendEquationEXT( GLenum mode );
-extern void DLM_APIENTRY crDLMCompileBlendFunc( GLenum sfactor, GLenum dfactor );
-extern void DLM_APIENTRY crDLMCompileBlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA );
-extern void DLM_APIENTRY crDLMCompileCallList( GLuint list );
-extern void DLM_APIENTRY crDLMCompileCallLists( GLsizei n, GLenum type, const GLvoid * lists );
-extern void DLM_APIENTRY crDLMCompileClear( GLbitfield mask );
-extern void DLM_APIENTRY crDLMCompileClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
-extern void DLM_APIENTRY crDLMCompileClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
-extern void DLM_APIENTRY crDLMCompileClearDepth( GLclampd depth );
-extern void DLM_APIENTRY crDLMCompileClearIndex( GLfloat c );
-extern void DLM_APIENTRY crDLMCompileClearStencil( GLint s );
-extern void DLM_APIENTRY crDLMCompileClipPlane( GLenum plane, const GLdouble * equation );
-extern void DLM_APIENTRY crDLMCompileColor3b( GLbyte red, GLbyte green, GLbyte blue );
-extern void DLM_APIENTRY crDLMCompileColor3bv( const GLbyte * v );
-extern void DLM_APIENTRY crDLMCompileColor3d( GLdouble red, GLdouble green, GLdouble blue );
-extern void DLM_APIENTRY crDLMCompileColor3dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileColor3f( GLfloat red, GLfloat green, GLfloat blue );
-extern void DLM_APIENTRY crDLMCompileColor3fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileColor3i( GLint red, GLint green, GLint blue );
-extern void DLM_APIENTRY crDLMCompileColor3iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileColor3s( GLshort red, GLshort green, GLshort blue );
-extern void DLM_APIENTRY crDLMCompileColor3sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileColor3ub( GLubyte red, GLubyte green, GLubyte blue );
-extern void DLM_APIENTRY crDLMCompileColor3ubv( const GLubyte * v );
-extern void DLM_APIENTRY crDLMCompileColor3ui( GLuint red, GLuint green, GLuint blue );
-extern void DLM_APIENTRY crDLMCompileColor3uiv( const GLuint * v );
-extern void DLM_APIENTRY crDLMCompileColor3us( GLushort red, GLushort green, GLushort blue );
-extern void DLM_APIENTRY crDLMCompileColor3usv( const GLushort * v );
-extern void DLM_APIENTRY crDLMCompileColor4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha );
-extern void DLM_APIENTRY crDLMCompileColor4bv( const GLbyte * v );
-extern void DLM_APIENTRY crDLMCompileColor4d( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha );
-extern void DLM_APIENTRY crDLMCompileColor4dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
-extern void DLM_APIENTRY crDLMCompileColor4fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileColor4i( GLint red, GLint green, GLint blue, GLint alpha );
-extern void DLM_APIENTRY crDLMCompileColor4iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileColor4s( GLshort red, GLshort green, GLshort blue, GLshort alpha );
-extern void DLM_APIENTRY crDLMCompileColor4sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
-extern void DLM_APIENTRY crDLMCompileColor4ubv( const GLubyte * v );
-extern void DLM_APIENTRY crDLMCompileColor4ui( GLuint red, GLuint green, GLuint blue, GLuint alpha );
-extern void DLM_APIENTRY crDLMCompileColor4uiv( const GLuint * v );
-extern void DLM_APIENTRY crDLMCompileColor4us( GLushort red, GLushort green, GLushort blue, GLushort alpha );
-extern void DLM_APIENTRY crDLMCompileColor4usv( const GLushort * v );
-extern void DLM_APIENTRY crDLMCompileColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
-extern void DLM_APIENTRY crDLMCompileColorMaterial( GLenum face, GLenum mode );
-extern void DLM_APIENTRY crDLMCompileCombinerInputNV( GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage );
-extern void DLM_APIENTRY crDLMCompileCombinerOutputNV( GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum );
-extern void DLM_APIENTRY crDLMCompileCombinerParameterfNV( GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompileCombinerParameterfvNV( GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileCombinerParameteriNV( GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompileCombinerParameterivNV( GLenum pname, const GLint * params );
-extern void DLM_APIENTRY crDLMCompileCombinerStageParameterfvNV( GLenum stage, GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileCompressedTexImage1DARB( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imagesize, const GLvoid * data );
-extern void DLM_APIENTRY crDLMCompileCompressedTexImage2DARB( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imagesize, const GLvoid * data );
-extern void DLM_APIENTRY crDLMCompileCompressedTexImage3DARB( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imagesize, const GLvoid * data );
-extern void DLM_APIENTRY crDLMCompileCompressedTexSubImage1DARB( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imagesize, const GLvoid * data );
-extern void DLM_APIENTRY crDLMCompileCompressedTexSubImage2DARB( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imagesize, const GLvoid * data );
-extern void DLM_APIENTRY crDLMCompileCompressedTexSubImage3DARB( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imagesize, const GLvoid * data );
-extern void DLM_APIENTRY crDLMCompileCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type );
-extern void DLM_APIENTRY crDLMCompileCopyTexImage1D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border );
-extern void DLM_APIENTRY crDLMCompileCopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
-extern void DLM_APIENTRY crDLMCompileCopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
-extern void DLM_APIENTRY crDLMCompileCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-extern void DLM_APIENTRY crDLMCompileCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
-extern void DLM_APIENTRY crDLMCompileCullFace( GLenum mode );
-extern void DLM_APIENTRY crDLMCompileDepthFunc( GLenum func );
-extern void DLM_APIENTRY crDLMCompileDepthMask( GLboolean flag );
-extern void DLM_APIENTRY crDLMCompileDepthRange( GLclampd zNear, GLclampd zFar );
-extern void DLM_APIENTRY crDLMCompileDisable( GLenum cap );
-extern void DLM_APIENTRY crDLMCompileDrawArrays( GLenum mode, GLint first, GLsizei count, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileDrawBuffer( GLenum mode );
-extern void DLM_APIENTRY crDLMCompileDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileDrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileDrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileEdgeFlag( GLboolean flag );
-extern void DLM_APIENTRY crDLMCompileEdgeFlagv( const GLboolean * flag );
-extern void DLM_APIENTRY crDLMCompileEnable( GLenum cap );
-extern void DLM_APIENTRY crDLMCompileEnd( void );
-extern void DLM_APIENTRY crDLMCompileEndQueryARB( GLenum target );
-extern void DLM_APIENTRY crDLMCompileEvalCoord1d( GLdouble u );
-extern void DLM_APIENTRY crDLMCompileEvalCoord1dv( const GLdouble * u );
-extern void DLM_APIENTRY crDLMCompileEvalCoord1f( GLfloat u );
-extern void DLM_APIENTRY crDLMCompileEvalCoord1fv( const GLfloat * u );
-extern void DLM_APIENTRY crDLMCompileEvalCoord2d( GLdouble u, GLdouble v );
-extern void DLM_APIENTRY crDLMCompileEvalCoord2dv( const GLdouble * u );
-extern void DLM_APIENTRY crDLMCompileEvalCoord2f( GLfloat u, GLfloat v );
-extern void DLM_APIENTRY crDLMCompileEvalCoord2fv( const GLfloat * u );
-extern void DLM_APIENTRY crDLMCompileEvalMesh1( GLenum mode, GLint i1, GLint i2 );
-extern void DLM_APIENTRY crDLMCompileEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
-extern void DLM_APIENTRY crDLMCompileEvalPoint1( GLint i );
-extern void DLM_APIENTRY crDLMCompileEvalPoint2( GLint i, GLint j );
-extern void DLM_APIENTRY crDLMCompileExecuteProgramNV( GLenum target, GLuint id, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileFinalCombinerInputNV( GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage );
-extern void DLM_APIENTRY crDLMCompileFogCoorddEXT( GLdouble coord );
-extern void DLM_APIENTRY crDLMCompileFogCoorddvEXT( const GLdouble * coord );
-extern void DLM_APIENTRY crDLMCompileFogCoordfEXT( GLfloat coord );
-extern void DLM_APIENTRY crDLMCompileFogCoordfvEXT( const GLfloat * coord );
-extern void DLM_APIENTRY crDLMCompileFogf( GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompileFogfv( GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileFogi( GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompileFogiv( GLenum pname, const GLint * params );
-extern void DLM_APIENTRY crDLMCompileFrontFace( GLenum mode );
-extern void DLM_APIENTRY crDLMCompileFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar );
-extern void DLM_APIENTRY crDLMCompileHint( GLenum target, GLenum mode );
-extern void DLM_APIENTRY crDLMCompileIndexMask( GLuint mask );
-extern void DLM_APIENTRY crDLMCompileIndexd( GLdouble c );
-extern void DLM_APIENTRY crDLMCompileIndexdv( const GLdouble * c );
-extern void DLM_APIENTRY crDLMCompileIndexf( GLfloat c );
-extern void DLM_APIENTRY crDLMCompileIndexfv( const GLfloat * c );
-extern void DLM_APIENTRY crDLMCompileIndexi( GLint c );
-extern void DLM_APIENTRY crDLMCompileIndexiv( const GLint * c );
-extern void DLM_APIENTRY crDLMCompileIndexs( GLshort c );
-extern void DLM_APIENTRY crDLMCompileIndexsv( const GLshort * c );
-extern void DLM_APIENTRY crDLMCompileIndexub( GLubyte c );
-extern void DLM_APIENTRY crDLMCompileIndexubv( const GLubyte * c );
-extern void DLM_APIENTRY crDLMCompileInitNames( void );
-extern void DLM_APIENTRY crDLMCompileLightModelf( GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompileLightModelfv( GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileLightModeli( GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompileLightModeliv( GLenum pname, const GLint * params );
-extern void DLM_APIENTRY crDLMCompileLightf( GLenum light, GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompileLightfv( GLenum light, GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileLighti( GLenum light, GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompileLightiv( GLenum light, GLenum pname, const GLint * params );
-extern void DLM_APIENTRY crDLMCompileLineStipple( GLint factor, GLushort pattern );
-extern void DLM_APIENTRY crDLMCompileLineWidth( GLfloat width );
-extern void DLM_APIENTRY crDLMCompileListBase( GLuint base );
-extern void DLM_APIENTRY crDLMCompileLoadIdentity( void );
-extern void DLM_APIENTRY crDLMCompileLoadMatrixd( const GLdouble * m );
-extern void DLM_APIENTRY crDLMCompileLoadMatrixf( const GLfloat * m );
-extern void DLM_APIENTRY crDLMCompileLoadName( GLuint name );
-extern void DLM_APIENTRY crDLMCompileLoadProgramNV( GLenum target, GLuint id, GLsizei len, const GLubyte * program );
-extern void DLM_APIENTRY crDLMCompileLoadTransposeMatrixdARB( const GLdouble * m );
-extern void DLM_APIENTRY crDLMCompileLoadTransposeMatrixfARB( const GLfloat * m );
-extern void DLM_APIENTRY crDLMCompileLogicOp( GLenum opcode );
-extern void DLM_APIENTRY crDLMCompileMap1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points );
-extern void DLM_APIENTRY crDLMCompileMap1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points );
-extern void DLM_APIENTRY crDLMCompileMap2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points );
-extern void DLM_APIENTRY crDLMCompileMap2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points );
-extern void DLM_APIENTRY crDLMCompileMapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
-extern void DLM_APIENTRY crDLMCompileMapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
-extern void DLM_APIENTRY crDLMCompileMapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 );
-extern void DLM_APIENTRY crDLMCompileMapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 );
-extern void DLM_APIENTRY crDLMCompileMaterialf( GLenum face, GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompileMaterialfv( GLenum face, GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileMateriali( GLenum face, GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompileMaterialiv( GLenum face, GLenum pname, const GLint * params );
-extern void DLM_APIENTRY crDLMCompileMatrixMode( GLenum mode );
-extern void DLM_APIENTRY crDLMCompileMultMatrixd( const GLdouble * m );
-extern void DLM_APIENTRY crDLMCompileMultMatrixf( const GLfloat * m );
-extern void DLM_APIENTRY crDLMCompileMultTransposeMatrixdARB( const GLdouble * m );
-extern void DLM_APIENTRY crDLMCompileMultTransposeMatrixfARB( const GLfloat * m );
-extern void DLM_APIENTRY crDLMCompileMultiDrawArraysEXT( GLenum mode, GLint * first, GLsizei * count, GLsizei primcount, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileMultiDrawElementsEXT( GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord1dARB( GLenum texture, GLdouble s );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord1dvARB( GLenum texture, const GLdouble * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord1fARB( GLenum texture, GLfloat s );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord1fvARB( GLenum texture, const GLfloat * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord1iARB( GLenum texture, GLint s );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord1ivARB( GLenum texture, const GLint * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord1sARB( GLenum texture, GLshort s );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord1svARB( GLenum texture, const GLshort * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord2dARB( GLenum texture, GLdouble s, GLdouble t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord2dvARB( GLenum texture, const GLdouble * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord2fARB( GLenum texture, GLfloat s, GLfloat t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord2fvARB( GLenum texture, const GLfloat * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord2iARB( GLenum texture, GLint s, GLint t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord2ivARB( GLenum texture, const GLint * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord2sARB( GLenum texture, GLshort s, GLshort t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord2svARB( GLenum texture, const GLshort * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord3dARB( GLenum texture, GLdouble s, GLdouble t, GLdouble r );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord3dvARB( GLenum texture, const GLdouble * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord3fARB( GLenum texture, GLfloat s, GLfloat t, GLfloat r );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord3fvARB( GLenum texture, const GLfloat * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord3iARB( GLenum texture, GLint s, GLint t, GLint r );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord3ivARB( GLenum texture, const GLint * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord3sARB( GLenum texture, GLshort s, GLshort t, GLshort r );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord3svARB( GLenum texture, const GLshort * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord4dARB( GLenum texture, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord4dvARB( GLenum texture, const GLdouble * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord4fARB( GLenum texture, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord4fvARB( GLenum texture, const GLfloat * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord4iARB( GLenum texture, GLint s, GLint t, GLint r, GLint q );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord4ivARB( GLenum texture, const GLint * t );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord4sARB( GLenum texture, GLshort s, GLshort t, GLshort r, GLshort q );
-extern void DLM_APIENTRY crDLMCompileMultiTexCoord4svARB( GLenum texture, const GLshort * t );
-extern void DLM_APIENTRY crDLMCompileNormal3b( GLbyte nx, GLbyte ny, GLbyte nz );
-extern void DLM_APIENTRY crDLMCompileNormal3bv( const GLbyte * v );
-extern void DLM_APIENTRY crDLMCompileNormal3d( GLdouble nx, GLdouble ny, GLdouble nz );
-extern void DLM_APIENTRY crDLMCompileNormal3dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
-extern void DLM_APIENTRY crDLMCompileNormal3fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileNormal3i( GLint nx, GLint ny, GLint nz );
-extern void DLM_APIENTRY crDLMCompileNormal3iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileNormal3s( GLshort nx, GLshort ny, GLshort nz );
-extern void DLM_APIENTRY crDLMCompileNormal3sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar );
-extern void DLM_APIENTRY crDLMCompilePassThrough( GLfloat token );
-extern void DLM_APIENTRY crDLMCompilePixelMapfv( GLenum map, GLsizei mapsize, const GLfloat * values );
-extern void DLM_APIENTRY crDLMCompilePixelMapuiv( GLenum map, GLsizei mapsize, const GLuint * values );
-extern void DLM_APIENTRY crDLMCompilePixelMapusv( GLenum map, GLsizei mapsize, const GLushort * values );
-extern void DLM_APIENTRY crDLMCompilePixelTransferf( GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompilePixelTransferi( GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompilePixelZoom( GLfloat xfactor, GLfloat yfactor );
-extern void DLM_APIENTRY crDLMCompilePointParameterfARB( GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompilePointParameterfvARB( GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompilePointParameteri( GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompilePointParameteriv( GLenum pname, const GLint * param );
-extern void DLM_APIENTRY crDLMCompilePointSize( GLfloat size );
-extern void DLM_APIENTRY crDLMCompilePolygonMode( GLenum face, GLenum mode );
-extern void DLM_APIENTRY crDLMCompilePolygonOffset( GLfloat factor, GLfloat units );
-extern void DLM_APIENTRY crDLMCompilePolygonStipple( const GLubyte * mask );
-extern void DLM_APIENTRY crDLMCompilePopAttrib( void );
-extern void DLM_APIENTRY crDLMCompilePopMatrix( void );
-extern void DLM_APIENTRY crDLMCompilePopName( void );
-extern void DLM_APIENTRY crDLMCompilePrioritizeTextures( GLsizei n, const GLuint * textures, const GLclampf * priorities );
-extern void DLM_APIENTRY crDLMCompileProgramEnvParameter4dARB( GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-extern void DLM_APIENTRY crDLMCompileProgramEnvParameter4dvARB( GLenum target, GLuint index, const GLdouble * params );
-extern void DLM_APIENTRY crDLMCompileProgramEnvParameter4fARB( GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-extern void DLM_APIENTRY crDLMCompileProgramEnvParameter4fvARB( GLenum target, GLuint index, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileProgramLocalParameter4dARB( GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-extern void DLM_APIENTRY crDLMCompileProgramLocalParameter4dvARB( GLenum target, GLuint index, const GLdouble * params );
-extern void DLM_APIENTRY crDLMCompileProgramLocalParameter4fARB( GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-extern void DLM_APIENTRY crDLMCompileProgramLocalParameter4fvARB( GLenum target, GLuint index, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileProgramNamedParameter4dNV( GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-extern void DLM_APIENTRY crDLMCompileProgramNamedParameter4dvNV( GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileProgramNamedParameter4fNV( GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-extern void DLM_APIENTRY crDLMCompileProgramNamedParameter4fvNV( GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileProgramParameter4dNV( GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-extern void DLM_APIENTRY crDLMCompileProgramParameter4dvNV( GLenum target, GLuint index, const GLdouble * params );
-extern void DLM_APIENTRY crDLMCompileProgramParameter4fNV( GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-extern void DLM_APIENTRY crDLMCompileProgramParameter4fvNV( GLenum target, GLuint index, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileProgramParameters4dvNV( GLenum target, GLuint index, GLuint num, const GLdouble * params );
-extern void DLM_APIENTRY crDLMCompileProgramParameters4fvNV( GLenum target, GLuint index, GLuint num, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileProgramStringARB( GLenum target, GLenum format, GLsizei len, const GLvoid * string );
-extern void DLM_APIENTRY crDLMCompilePushAttrib( GLbitfield mask );
-extern void DLM_APIENTRY crDLMCompilePushMatrix( void );
-extern void DLM_APIENTRY crDLMCompilePushName( GLuint name );
-extern void DLM_APIENTRY crDLMCompileRasterPos2d( GLdouble x, GLdouble y );
-extern void DLM_APIENTRY crDLMCompileRasterPos2dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos2f( GLfloat x, GLfloat y );
-extern void DLM_APIENTRY crDLMCompileRasterPos2fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos2i( GLint x, GLint y );
-extern void DLM_APIENTRY crDLMCompileRasterPos2iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos2s( GLshort x, GLshort y );
-extern void DLM_APIENTRY crDLMCompileRasterPos2sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos3d( GLdouble x, GLdouble y, GLdouble z );
-extern void DLM_APIENTRY crDLMCompileRasterPos3dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos3f( GLfloat x, GLfloat y, GLfloat z );
-extern void DLM_APIENTRY crDLMCompileRasterPos3fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos3i( GLint x, GLint y, GLint z );
-extern void DLM_APIENTRY crDLMCompileRasterPos3iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos3s( GLshort x, GLshort y, GLshort z );
-extern void DLM_APIENTRY crDLMCompileRasterPos3sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-extern void DLM_APIENTRY crDLMCompileRasterPos4dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-extern void DLM_APIENTRY crDLMCompileRasterPos4fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos4i( GLint x, GLint y, GLint z, GLint w );
-extern void DLM_APIENTRY crDLMCompileRasterPos4iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w );
-extern void DLM_APIENTRY crDLMCompileRasterPos4sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileReadBuffer( GLenum mode );
-extern void DLM_APIENTRY crDLMCompileRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
-extern void DLM_APIENTRY crDLMCompileRectdv( const GLdouble * v1, const GLdouble * v2 );
-extern void DLM_APIENTRY crDLMCompileRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
-extern void DLM_APIENTRY crDLMCompileRectfv( const GLfloat * v1, const GLfloat * v2 );
-extern void DLM_APIENTRY crDLMCompileRecti( GLint x1, GLint y1, GLint x2, GLint y2 );
-extern void DLM_APIENTRY crDLMCompileRectiv( const GLint * v1, const GLint * v2 );
-extern void DLM_APIENTRY crDLMCompileRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
-extern void DLM_APIENTRY crDLMCompileRectsv( const GLshort * v1, const GLshort * v2 );
-extern void DLM_APIENTRY crDLMCompileRequestResidentProgramsNV( GLsizei n, const GLuint * ids );
-extern void DLM_APIENTRY crDLMCompileRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z );
-extern void DLM_APIENTRY crDLMCompileRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
-extern void DLM_APIENTRY crDLMCompileSampleCoverageARB( GLclampf value, GLboolean invert );
-extern void DLM_APIENTRY crDLMCompileScaled( GLdouble x, GLdouble y, GLdouble z );
-extern void DLM_APIENTRY crDLMCompileScalef( GLfloat x, GLfloat y, GLfloat z );
-extern void DLM_APIENTRY crDLMCompileScissor( GLint x, GLint y, GLsizei width, GLsizei height );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3bEXT( GLbyte red, GLbyte green, GLbyte blue );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3bvEXT( const GLbyte * v );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3dEXT( GLdouble red, GLdouble green, GLdouble blue );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3dvEXT( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3fEXT( GLfloat red, GLfloat green, GLfloat blue );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3fvEXT( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3iEXT( GLint red, GLint green, GLint blue );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3ivEXT( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3sEXT( GLshort red, GLshort green, GLshort blue );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3svEXT( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3ubEXT( GLubyte red, GLubyte green, GLubyte blue );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3ubvEXT( const GLubyte * v );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3uiEXT( GLuint red, GLuint green, GLuint blue );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3uivEXT( const GLuint * v );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3usEXT( GLushort red, GLushort green, GLushort blue );
-extern void DLM_APIENTRY crDLMCompileSecondaryColor3usvEXT( const GLushort * v );
-extern void DLM_APIENTRY crDLMCompileSetFenceNV( GLuint fence, GLenum condition );
-extern void DLM_APIENTRY crDLMCompileShadeModel( GLenum mode );
-extern void DLM_APIENTRY crDLMCompileStencilFunc( GLenum func, GLint ref, GLuint mask );
-extern void DLM_APIENTRY crDLMCompileStencilMask( GLuint mask );
-extern void DLM_APIENTRY crDLMCompileStencilOp( GLenum fail, GLenum zfail, GLenum zpass );
-extern void DLM_APIENTRY crDLMCompileTexCoord1d( GLdouble s );
-extern void DLM_APIENTRY crDLMCompileTexCoord1dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord1f( GLfloat s );
-extern void DLM_APIENTRY crDLMCompileTexCoord1fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord1i( GLint s );
-extern void DLM_APIENTRY crDLMCompileTexCoord1iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord1s( GLshort s );
-extern void DLM_APIENTRY crDLMCompileTexCoord1sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord2d( GLdouble s, GLdouble t );
-extern void DLM_APIENTRY crDLMCompileTexCoord2dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord2f( GLfloat s, GLfloat t );
-extern void DLM_APIENTRY crDLMCompileTexCoord2fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord2i( GLint s, GLint t );
-extern void DLM_APIENTRY crDLMCompileTexCoord2iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord2s( GLshort s, GLshort t );
-extern void DLM_APIENTRY crDLMCompileTexCoord2sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord3d( GLdouble s, GLdouble t, GLdouble r );
-extern void DLM_APIENTRY crDLMCompileTexCoord3dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord3f( GLfloat s, GLfloat t, GLfloat r );
-extern void DLM_APIENTRY crDLMCompileTexCoord3fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord3i( GLint s, GLint t, GLint r );
-extern void DLM_APIENTRY crDLMCompileTexCoord3iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord3s( GLshort s, GLshort t, GLshort r );
-extern void DLM_APIENTRY crDLMCompileTexCoord3sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
-extern void DLM_APIENTRY crDLMCompileTexCoord4dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
-extern void DLM_APIENTRY crDLMCompileTexCoord4fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord4i( GLint s, GLint t, GLint r, GLint q );
-extern void DLM_APIENTRY crDLMCompileTexCoord4iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q );
-extern void DLM_APIENTRY crDLMCompileTexCoord4sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileTexEnvf( GLenum target, GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompileTexEnvfv( GLenum target, GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileTexEnvi( GLenum target, GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompileTexEnviv( GLenum target, GLenum pname, const GLint * params );
-extern void DLM_APIENTRY crDLMCompileTexGend( GLenum coord, GLenum pname, GLdouble param );
-extern void DLM_APIENTRY crDLMCompileTexGendv( GLenum coord, GLenum pname, const GLdouble * params );
-extern void DLM_APIENTRY crDLMCompileTexGenf( GLenum coord, GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompileTexGenfv( GLenum coord, GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileTexGeni( GLenum coord, GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompileTexGeniv( GLenum coord, GLenum pname, const GLint * params );
-extern void DLM_APIENTRY crDLMCompileTexImage1D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileTexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileTexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileTexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileTexParameterf( GLenum target, GLenum pname, GLfloat param );
-extern void DLM_APIENTRY crDLMCompileTexParameterfv( GLenum target, GLenum pname, const GLfloat * params );
-extern void DLM_APIENTRY crDLMCompileTexParameteri( GLenum target, GLenum pname, GLint param );
-extern void DLM_APIENTRY crDLMCompileTexParameteriv( GLenum target, GLenum pname, const GLint * params );
-extern void DLM_APIENTRY crDLMCompileTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels, CRClientState *c );
-extern void DLM_APIENTRY crDLMCompileTrackMatrixNV( GLenum target, GLuint address, GLenum matrix, GLenum transform );
-extern void DLM_APIENTRY crDLMCompileTranslated( GLdouble x, GLdouble y, GLdouble z );
-extern void DLM_APIENTRY crDLMCompileTranslatef( GLfloat x, GLfloat y, GLfloat z );
-extern void DLM_APIENTRY crDLMCompileVertex2d( GLdouble x, GLdouble y );
-extern void DLM_APIENTRY crDLMCompileVertex2dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertex2f( GLfloat x, GLfloat y );
-extern void DLM_APIENTRY crDLMCompileVertex2fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertex2i( GLint x, GLint y );
-extern void DLM_APIENTRY crDLMCompileVertex2iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileVertex2s( GLshort x, GLshort y );
-extern void DLM_APIENTRY crDLMCompileVertex2sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertex3d( GLdouble x, GLdouble y, GLdouble z );
-extern void DLM_APIENTRY crDLMCompileVertex3dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertex3f( GLfloat x, GLfloat y, GLfloat z );
-extern void DLM_APIENTRY crDLMCompileVertex3fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertex3i( GLint x, GLint y, GLint z );
-extern void DLM_APIENTRY crDLMCompileVertex3iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileVertex3s( GLshort x, GLshort y, GLshort z );
-extern void DLM_APIENTRY crDLMCompileVertex3sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-extern void DLM_APIENTRY crDLMCompileVertex4dv( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-extern void DLM_APIENTRY crDLMCompileVertex4fv( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertex4i( GLint x, GLint y, GLint z, GLint w );
-extern void DLM_APIENTRY crDLMCompileVertex4iv( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
-extern void DLM_APIENTRY crDLMCompileVertex4sv( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib1dARB( GLuint index, GLdouble x );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib1dvARB( GLuint index, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib1fARB( GLuint index, GLfloat x );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib1fvARB( GLuint index, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib1sARB( GLuint index, GLshort x );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib1svARB( GLuint index, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib2dARB( GLuint index, GLdouble x, GLdouble y );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib2dvARB( GLuint index, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib2fvARB( GLuint index, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib2sARB( GLuint index, GLshort x, GLshort y );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib2svARB( GLuint index, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib3dARB( GLuint index, GLdouble x, GLdouble y, GLdouble z );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib3dvARB( GLuint index, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib3fvARB( GLuint index, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib3sARB( GLuint index, GLshort x, GLshort y, GLshort z );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib3svARB( GLuint index, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4NbvARB( GLuint index, const GLbyte * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4NivARB( GLuint index, const GLint * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4NsvARB( GLuint index, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4NubARB( GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4NubvARB( GLuint index, const GLubyte * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4NuivARB( GLuint index, const GLuint * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4NusvARB( GLuint index, const GLushort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4bvARB( GLuint index, const GLbyte * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4dARB( GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4dvARB( GLuint index, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4fvARB( GLuint index, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4ivARB( GLuint index, const GLint * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4sARB( GLuint index, GLshort x, GLshort y, GLshort z, GLshort w );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4svARB( GLuint index, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4ubvARB( GLuint index, const GLubyte * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4uivARB( GLuint index, const GLuint * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttrib4usvARB( GLuint index, const GLushort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs1dvNV( GLuint index, GLsizei n, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs1fvNV( GLuint index, GLsizei n, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs1svNV( GLuint index, GLsizei n, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs2dvNV( GLuint index, GLsizei n, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs2fvNV( GLuint index, GLsizei n, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs2svNV( GLuint index, GLsizei n, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs3dvNV( GLuint index, GLsizei n, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs3fvNV( GLuint index, GLsizei n, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs3svNV( GLuint index, GLsizei n, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs4dvNV( GLuint index, GLsizei n, const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs4fvNV( GLuint index, GLsizei n, const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs4svNV( GLuint index, GLsizei n, const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileVertexAttribs4ubvNV( GLuint index, GLsizei n, const GLubyte * v );
-extern void DLM_APIENTRY crDLMCompileViewport( GLint x, GLint y, GLsizei width, GLsizei height );
-extern void DLM_APIENTRY crDLMCompileWindowPos2dARB( GLdouble x, GLdouble y );
-extern void DLM_APIENTRY crDLMCompileWindowPos2dvARB( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileWindowPos2fARB( GLfloat x, GLfloat y );
-extern void DLM_APIENTRY crDLMCompileWindowPos2fvARB( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileWindowPos2iARB( GLint x, GLint y );
-extern void DLM_APIENTRY crDLMCompileWindowPos2ivARB( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileWindowPos2sARB( GLshort x, GLshort y );
-extern void DLM_APIENTRY crDLMCompileWindowPos2svARB( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileWindowPos3dARB( GLdouble x, GLdouble y, GLdouble z );
-extern void DLM_APIENTRY crDLMCompileWindowPos3dvARB( const GLdouble * v );
-extern void DLM_APIENTRY crDLMCompileWindowPos3fARB( GLfloat x, GLfloat y, GLfloat z );
-extern void DLM_APIENTRY crDLMCompileWindowPos3fvARB( const GLfloat * v );
-extern void DLM_APIENTRY crDLMCompileWindowPos3iARB( GLint x, GLint y, GLint z );
-extern void DLM_APIENTRY crDLMCompileWindowPos3ivARB( const GLint * v );
-extern void DLM_APIENTRY crDLMCompileWindowPos3sARB( GLshort x, GLshort y, GLshort z );
-extern void DLM_APIENTRY crDLMCompileWindowPos3svARB( const GLshort * v );
-extern void DLM_APIENTRY crDLMCompileZPixCR( GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum ztype, GLint zparm, GLint length, const GLvoid * pixels, CRClientState *c );
-
-/* auto-generated CheckList functions begin here.  There is one for each
- * function that has a dual nature: even when there's an active glNewList,
- * sometimes they are compiled into the display list, and sometimes they
- * are treated like a control function.  The CheckList function will
- * return TRUE if the function should really be compiled into a display
- * list.  The calling SPU is responsible for checking this; but the
- * DLM will also print an error if it detects an invalid use.
- */
-
-int DLM_APIENTRY crDLMCheckListCompressedTexImage1DARB( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLint border, GLsizei imagesize, const GLvoid * data );
-int DLM_APIENTRY crDLMCheckListCompressedTexImage2DARB( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imagesize, const GLvoid * data );
-int DLM_APIENTRY crDLMCheckListCompressedTexImage3DARB( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imagesize, const GLvoid * data );
-int DLM_APIENTRY crDLMCheckListTexImage1D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels );
-int DLM_APIENTRY crDLMCheckListTexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels );
-int DLM_APIENTRY crDLMCheckListTexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels );
-int DLM_APIENTRY crDLMCheckListTexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CR_DLM_H */
diff --git a/src/VBox/GuestHost/OpenGL/include/cr_server.h b/src/VBox/GuestHost/OpenGL/include/cr_server.h
index dcae18a..d44fc74 100644
--- a/src/VBox/GuestHost/OpenGL/include/cr_server.h
+++ b/src/VBox/GuestHost/OpenGL/include/cr_server.h
@@ -131,7 +131,7 @@ struct CR_SERVER_RPW_ENTRY;
 
 typedef DECLCALLBACKPTR(void, PFNCR_SERVER_RPW_DATA) (const struct CR_SERVER_RPW_ENTRY* pEntry, void *pvEntryTexData);
 
-typedef DECLCALLBACKPTR(void, PFNCRSERVERNOTIFYEVENT) (int32_t screenId, uint32_t uEvent, void*pvData);
+typedef DECLCALLBACKPTR(void, PFNCRSERVERNOTIFYEVENT) (int32_t screenId, uint32_t uEvent, void* pvData, uint32_t cbData);
 
 typedef struct CR_SERVER_RPW_ENTRY
 {
@@ -475,8 +475,6 @@ typedef struct {
 
     GLuint currentSerialNo;
 
-    PFNCRSERVERPRESENTFBO pfnPresentFBO;
-
     GLuint                fVisualBitsDefault;
     GLboolean             bUsePBOForReadback;       /*Use PBO's for data readback*/
 
@@ -552,8 +550,6 @@ struct VBVAINFOSCREEN;
 extern DECLEXPORT(int) crVBoxServerNotifyResize(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM);
 extern DECLEXPORT(int32_t) crVBoxServerSetRootVisibleRegion(GLint cRects, const RTRECT *pRects);
 
-extern DECLEXPORT(void) crVBoxServerSetPresentFBOCB(PFNCRSERVERPRESENTFBO pfnPresentFBO);
-
 extern DECLEXPORT(int32_t) crVBoxServerSetOffscreenRendering(GLboolean value);
 
 extern DECLEXPORT(int32_t) crVBoxServerOutputRedirectSet(const CROutputRedirect *pCallbacks);
@@ -564,6 +560,7 @@ extern DECLEXPORT(void) crServerVBoxSetNotifyEventCB(PFNCRSERVERNOTIFYEVENT pfnC
 
 extern DECLEXPORT(void) crVBoxServerCalloutEnable(VBOXCRCMDCTL *pCtl);
 extern DECLEXPORT(void) crVBoxServerCalloutDisable();
+extern DECLEXPORT(void) crServerSetUnscaledHiDPI(bool fEnable);
 
 #ifdef VBOX_WITH_CRHGSMI
 /* We moved all CrHgsmi command processing to crserverlib to keep the logic of dealing with CrHgsmi commands in one place.
diff --git a/src/VBox/GuestHost/OpenGL/include/state/cr_line.h b/src/VBox/GuestHost/OpenGL/include/state/cr_line.h
index 57746af..98a0bd2 100644
--- a/src/VBox/GuestHost/OpenGL/include/state/cr_line.h
+++ b/src/VBox/GuestHost/OpenGL/include/state/cr_line.h
@@ -5,7 +5,7 @@
  */
 
 #ifndef CR_STATE_LINE_H
-#define SR_STATE_LINE_H
+#define CR_STATE_LINE_H
 
 #include "state/cr_statetypes.h"
 
diff --git a/src/VBox/GuestHost/OpenGL/include/state/cr_point.h b/src/VBox/GuestHost/OpenGL/include/state/cr_point.h
index fe3dffe..1db3f7a 100644
--- a/src/VBox/GuestHost/OpenGL/include/state/cr_point.h
+++ b/src/VBox/GuestHost/OpenGL/include/state/cr_point.h
@@ -4,8 +4,8 @@
  * See the file LICENSE.txt for information on redistributing this software.
  */
 
-#ifndef CR_STATE_LINE_H
-#define SR_STATE_LINE_H
+#ifndef CR_STATE_POINT_H
+#define CR_STATE_POINT_H
 
 #include "state/cr_statetypes.h"
 
@@ -59,4 +59,4 @@ DECLEXPORT(void) crStatePointSwitch(CRPointBits *bb, CRbitvalue *bitID,
 }
 #endif
 
-#endif /* CR_STATE_LINE_H */
+#endif /* CR_STATE_POINT_H */
diff --git a/src/VBox/GuestHost/OpenGL/packer/pack_client.c b/src/VBox/GuestHost/OpenGL/packer/pack_client.c
index b3fbcb2..7f06921 100644
--- a/src/VBox/GuestHost/OpenGL/packer/pack_client.c
+++ b/src/VBox/GuestHost/OpenGL/packer/pack_client.c
@@ -34,8 +34,7 @@ static void crPackVertexAttrib(const CRVertexArrays *array, unsigned int attr, G
 #ifdef CR_ARB_vertex_buffer_object
     if (array->a[attr].buffer && array->a[attr].buffer->data)
     {
-        Assert(((GLuint)p) < array->a[attr].buffer->size);
-        Assert(((GLint)p) >= 0);
+        Assert(((uintptr_t)p) < array->a[attr].buffer->size);
         p = (unsigned char *)(array->a[attr].buffer->data) + (unsigned long)p;
     }
 #endif
diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c b/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
index d111e02..af5d77d 100644
--- a/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
+++ b/src/VBox/GuestHost/OpenGL/state_tracker/state_glsl.c
@@ -858,7 +858,7 @@ crStateGLSLProgramCacheUniforms(GLuint program, GLsizei cbData, GLvoid *pData)
     pCurrent += sizeof(GLsizei);
     cbRead = sizeof(GLsizei);
 
-    crDebug("crStateGLSLProgramCacheUniforms: %i active uniforms", pProgram->cUniforms);
+    //crDebug("crStateGLSLProgramCacheUniforms: %i active uniforms", pProgram->cUniforms);
 
     if (pProgram->cUniforms)
     {
@@ -895,7 +895,7 @@ crStateGLSLProgramCacheUniforms(GLuint program, GLsizei cbData, GLvoid *pData)
         pProgram->pUniforms[i].name = crStrndup(pCurrent, cbName);
         pCurrent += cbName;
 
-        crDebug("crStateGLSLProgramCacheUniforms: uniform[%i]=%d, %s", i, pProgram->pUniforms[i].location, pProgram->pUniforms[i].name);
+        //crDebug("crStateGLSLProgramCacheUniforms: uniform[%i]=%d, %s", i, pProgram->pUniforms[i].location, pProgram->pUniforms[i].name);
     }
 
     pProgram->bUniformsSynced = GL_TRUE;
@@ -978,7 +978,7 @@ crStateGLSLProgramCacheAttribs(GLuint program, GLsizei cbData, GLvoid *pData)
     CRASSERT((pCurrent-((char*)pData))==cbRead);
     CRASSERT(cbRead==cbData);
 }
-#else
+#else /* IN_GUEST */
 static GLboolean crStateGLSLProgramCacheOneUniform(GLuint location, GLsizei cbName, GLchar *pName, 
                                                    char **pCurrent, GLsizei *pcbWritten, GLsizei maxcbData)
 {
@@ -990,7 +990,7 @@ static GLboolean crStateGLSLProgramCacheOneUniform(GLuint location, GLsizei cbNa
         return GL_FALSE;
     }
 
-    crDebug("crStateGLSLProgramCacheUniforms: uniform[%i]=%s.", location, pName);
+    //crDebug("crStateGLSLProgramCacheUniforms: uniform[%i]=%s.", location, pName);
 
     ((GLint*)*pCurrent)[0] = location;
     *pCurrent += sizeof(GLint);
diff --git a/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c b/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c
index 277e013..c47b753 100644
--- a/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c
+++ b/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c
@@ -714,30 +714,31 @@ GLboolean crStateEnableDiffOnMakeCurrent(GLboolean fEnable)
 void crStateMakeCurrent( CRContext *ctx )
 {
     CRContext *current = GetCurrentContext();
+    CRContext *pLocalCtx = ctx;
 
-    if (ctx == NULL)
-        ctx = defaultContext;
+    if (pLocalCtx == NULL)
+        pLocalCtx = defaultContext;
 
-    if (current == ctx)
+    if (current == pLocalCtx)
         return; /* no-op */
 
-    CRASSERT(ctx);
+    CRASSERT(pLocalCtx);
 
     if (g_bVBoxEnableDiffOnMakeCurrent && current) {
         /* Check to see if the differencer exists first,
            we may not have one, aka the packspu */
         if (diff_api.AlphaFunc)
-            crStateSwitchContext( current, ctx );
+            crStateSwitchContext( current, pLocalCtx );
     }
 
 #ifdef CHROMIUM_THREADSAFE
-    SetCurrentContext(ctx);
+    SetCurrentContext(pLocalCtx);
 #else
-    __currentContext = ctx;
+    __currentContext = pLocalCtx;
 #endif
 
     /* ensure matrix state is also current */
-    crStateMatrixMode(ctx->transform.matrixMode);
+    crStateMatrixMode(pLocalCtx->transform.matrixMode);
 }
 
 
@@ -747,23 +748,24 @@ void crStateMakeCurrent( CRContext *ctx )
 static void crStateSetCurrentEx( CRContext *ctx, GLboolean fCleanupDefault )
 {
     CRContext *current = GetCurrentContext();
+    CRContext *pLocalCtx = ctx;
 
-    if (ctx == NULL && !fCleanupDefault)
-        ctx = defaultContext;
+    if (pLocalCtx == NULL && !fCleanupDefault)
+        pLocalCtx = defaultContext;
 
-    if (current == ctx)
+    if (current == pLocalCtx)
         return; /* no-op */
 
 #ifdef CHROMIUM_THREADSAFE
-    SetCurrentContext(ctx);
+    SetCurrentContext(pLocalCtx);
 #else
-    __currentContext = ctx;
+    __currentContext = pLocalCtx;
 #endif
 
-    if (ctx)
+    if (pLocalCtx)
     {
         /* ensure matrix state is also current */
-        crStateMatrixMode(ctx->transform.matrixMode);
+        crStateMatrixMode(pLocalCtx->transform.matrixMode);
     }
 }
 
diff --git a/src/VBox/GuestHost/OpenGL/util/VBoxOGLcrutil.rc b/src/VBox/GuestHost/OpenGL/util/VBoxOGLcrutil.rc
index f475a29..6003b6b 100644
--- a/src/VBox/GuestHost/OpenGL/util/VBoxOGLcrutil.rc
+++ b/src/VBox/GuestHost/OpenGL/util/VBoxOGLcrutil.rc
@@ -18,43 +18,42 @@
 #include <windows.h>
 #include <VBox/version.h>
 
-#ifdef IN_GUEST
- #define DESCRIPTION_STR    "VirtualBox crOpenGL ICD\0"
- #ifdef VBOX_WDDM_WOW64
-  #define FILENAME_STR       "VBoxOGLcrutil-x86"
- #else
-  #define FILENAME_STR       "VBoxOGLcrutil.dll"
- #endif
- #define PRODUCT_STR        VBOX_PRODUCT " Guest Additions\0"
-#else
- #define DESCRIPTION_STR    "VirtualBox crOpenGL ICD\0"
- #define FILENAME_STR       "VBoxOGLcrhostutil"
- #define PRODUCT_STR        VBOX_PRODUCT "\0"
-#endif
 
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
+#ifdef IN_GUEST
+      VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
+# ifdef VBOX_WDDM_WOW64
+      VALUE "InternalName",     "VBoxOGLcrutil-x86\0"
+      VALUE "OriginalFilename", "VBoxOGLcrutil-x86.dll\0"
+# else
+      VALUE "InternalName",     "VBoxOGLcrutil\0"
+      VALUE "OriginalFilename", "VBoxOGLcrutil.dll\0"
+# endif
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+#else
+      VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
+      VALUE "InternalName",     "VBoxOGLcrhostutil\0"
+      VALUE "InternalFilename", "VBoxOGLcrhostutil.dll\0"
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+#endif
       VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  DESCRIPTION_STR
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     FILENAME_STR "\0"
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
       VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", FILENAME_STR ".dll\0"
-      VALUE "ProductName",      PRODUCT_STR
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/GuestHost/OpenGL/util/compositor.cpp b/src/VBox/GuestHost/OpenGL/util/compositor.cpp
index 84e2f9a..ed57558 100644
--- a/src/VBox/GuestHost/OpenGL/util/compositor.cpp
+++ b/src/VBox/GuestHost/OpenGL/util/compositor.cpp
@@ -556,26 +556,28 @@ VBOXVREGDECL(int) CrVrScrCompositorEntryRegionsSet(PVBOXVR_SCR_COMPOSITOR pCompo
     }
 
     rc = crVrScrCompositorEntryRegionsSet(pCompositor, pEntry, cRegions, paRegions, &fChanged);
-    if (RT_FAILURE(rc))
-    {
-        WARN(("crVrScrCompositorEntryRegionsSet failed, rc %d", rc));
-        return rc;
-    }
-
-    if (fChanged && CrVrScrCompositorEntryIsUsed(pEntry))
+    if (RT_SUCCESS(rc))
     {
-        rc = crVrScrCompositorEntryEnsureRegionsBounds(pCompositor, pEntry, NULL);
-        if (RT_FAILURE(rc))
+        if (fChanged && CrVrScrCompositorEntryIsUsed(pEntry))
         {
-            WARN(("crVrScrCompositorEntryEnsureRegionsBounds failed, rc %d", rc));
-            return rc;
+            rc = crVrScrCompositorEntryEnsureRegionsBounds(pCompositor, pEntry, NULL);
+            if (RT_SUCCESS(rc))
+            {
+                if (pfChanged)
+                    *pfChanged = fPosChanged || fChanged || fWasInList;
+            }
+            else
+                WARN(("crVrScrCompositorEntryEnsureRegionsBounds failed, rc %d", rc));
         }
+
     }
+    else
+        WARN(("crVrScrCompositorEntryRegionsSet failed, rc %d", rc));
 
-    if (pfChanged)
-        *pfChanged = fPosChanged || fChanged || fWasInList;
+    if (paTranslatedRects)
+        RTMemFree(paTranslatedRects);
 
-    return VINF_SUCCESS;
+    return rc;
 }
 
 VBOXVREGDECL(int) CrVrScrCompositorEntryListIntersect(PVBOXVR_SCR_COMPOSITOR pCompositor, PVBOXVR_SCR_COMPOSITOR_ENTRY pEntry,
diff --git a/src/VBox/GuestHost/OpenGL/util/error.c b/src/VBox/GuestHost/OpenGL/util/error.c
index d384d32..d142f87 100644
--- a/src/VBox/GuestHost/OpenGL/util/error.c
+++ b/src/VBox/GuestHost/OpenGL/util/error.c
@@ -14,18 +14,21 @@
  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
-#if 1
 
 #define LOG_GROUP LOG_GROUP_SHARED_CROPENGL
 
 #include <iprt/string.h>
 #include <iprt/stream.h>
 #include <iprt/initterm.h>
+#include <iprt/asm.h>
 #include <VBox/log.h>
 
 #ifdef RT_OS_WINDOWS
 # include <windows.h>
 # include "cr_environment.h"
+# include "cr_error.h"
+# include "VBox/VBoxGuestLib.h"
+# include "iprt/initterm.h"
 #endif
 
 #include <signal.h>
@@ -93,14 +96,17 @@ DECLEXPORT(void) crError(const char *pszFormat, ...)
     logMessageV("OpenGL Error: ", pszFormat, va);
     va_end(va);
 
+#ifdef DEBUG
+    /* Let's interrupt App execution only on debug builds and return
+     * bad status to upper level on release ones. */
+# ifdef IN_GUEST
+    /* Trigger debugger's breakpoint handler. */
+    ASMBreakpoint();
+# else
     /* Dump core or activate the debugger in debug builds. */
     AssertFailed();
-
-#ifdef IN_GUEST
-    /* Give things a chance to close down. */
-    raise(SIGTERM);
-    exit(1);
-#endif
+# endif
+#endif /* DEBUG */
 }
 
 DECLEXPORT(void) crWarning(const char *pszFormat, ...)
@@ -143,595 +149,7 @@ DECLEXPORT(void) crDebug(const char *pszFormat, ...)
     }
 }
 
-#else
-/* Copyright (c) 2001, Stanford University
- * All rights reserved
- *
- * See the file LICENSE.txt for information on redistributing this software.
- */
-
-#include "cr_environment.h"
-#include "cr_error.h"
-#include "cr_string.h"
-#include "cr_net.h"
-#include "cr_process.h"
-
-#ifdef WINDOWS
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <io.h>
-#include <fcntl.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <signal.h>
-
-#ifndef IN_GUEST
-#define LOG_GROUP LOG_GROUP_SHARED_CROPENGL
-#endif
-#if !defined(IN_GUEST) || defined(CR_DEBUG_BACKDOOR_ENABLE)
-#include <VBox/log.h>
-#endif
-
-#if defined(WINDOWS)
-# define CR_DEBUG_CONSOLE_ENABLE
-
-# include "Shlwapi.h"
-#endif
-
-#if defined(WINDOWS) && defined(IN_GUEST)
-# ifndef CR_DEBUG_BACKDOOR_ENABLE
-#  error "CR_DEBUG_BACKDOOR_ENABLE is expected!"
-# endif
-#else
-# ifdef CR_DEBUG_BACKDOOR_ENABLE
-#  error "CR_DEBUG_BACKDOOR_ENABLE is NOT expected!"
-# endif
-#endif
-
-
-#ifdef CR_DEBUG_BACKDOOR_ENABLE
-# include <VBoxDispMpLogger.h>
-# include <iprt/err.h>
-#endif
-
-
-static char my_hostname[256];
-#ifdef WINDOWS
-static HANDLE my_pid;
-#else
-static int my_pid = 0;
-#endif
-static int canada = 0;
-static int swedish_chef = 0;
-static int australia = 0;
-static int warnings_enabled = 1;
-
-#ifdef DEBUG_misha
-//int g_VBoxFbgFBreakDdi = 0;
-#define DebugBreak() Assert(0)
-#endif
-
-void __getHostInfo( void )
-{
-    char *temp;
-    /* on windows guests we're typically get called in a context of VBoxOGL!DllMain ( which calls VBoxOGLcrutil!crNetInit ),
-     * which may lead to deadlocks..
-     * Avoid it as it is needed for debugging purposes only */
-#if !defined(IN_GUEST) || !defined(RT_OS_WINDOWS)
-    if ( crGetHostname( my_hostname, sizeof( my_hostname ) ) )
-#endif
-    {
-        crStrcpy( my_hostname, "????" );
-    }
-    temp = crStrchr( my_hostname, '.' );
-    if (temp)
-    {
-        *temp = '\0';
-    }
-    my_pid = crGetPID();
-}
-
-static void __crCheckCanada(void)
-{
-    static int first = 1;
-    if (first)
-    {
-        const char *env = crGetenv( "CR_CANADA" );
-        if (env)
-            canada = 1;
-        first = 0;
-    }
-}
-
-static void __crCheckSwedishChef(void)
-{
-    static int first = 1;
-    if (first)
-    {
-        const char *env = crGetenv( "CR_SWEDEN" );
-        if (env)
-            swedish_chef = 1;
-        first = 0;
-    }
-}
-
-static void __crCheckAustralia(void)
-{
-    static int first = 1;
-    if (first)
-    {
-        const char *env = crGetenv( "CR_AUSTRALIA" );
-        const char *env2 = crGetenv( "CR_AUSSIE" );
-        if (env || env2)
-            australia = 1;
-        first = 0;
-    }
-}
-
-static void outputChromiumMessage( FILE *output, char *str )
-{
-    fprintf( output, "%s%s%s%s\n", str,
-            swedish_chef ? " BORK BORK BORK!" : "",
-            canada ? ", eh?" : "",
-            australia ? ", mate!" : ""
-            );
-    fflush( output );
-}
-
-#ifdef WINDOWS
-static void crRedirectIOToConsole()
-{
-    int hConHandle;
-    HANDLE StdHandle;
-    FILE *fp;
-
-    AllocConsole();
-
-    StdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
-    hConHandle = _open_osfhandle((long)StdHandle, _O_TEXT);
-    fp = _fdopen( hConHandle, "w" );
-    *stdout = *fp;
-    *stderr = *fp;
-
-    StdHandle = GetStdHandle(STD_INPUT_HANDLE);
-    hConHandle = _open_osfhandle((long)StdHandle, _O_TEXT);
-    fp = _fdopen( hConHandle, "r" );
-    *stdin = *fp;
-}
-#endif
-
-
-DECLEXPORT(void) crError(const char *format, ... )
-{
-    va_list args;
-    static char txt[8092];
-    int offset;
-#ifdef WINDOWS
-    DWORD err;
-#endif
-
-    __crCheckCanada();
-    __crCheckSwedishChef();
-    __crCheckAustralia();
-    if (!my_hostname[0])
-        __getHostInfo();
-#ifdef WINDOWS
-    if ((err = GetLastError()) != 0 && crGetenv( "CR_WINDOWS_ERRORS" ) != NULL )
-    {
-        static char buf[8092], *temp;
-
-        SetLastError(0);
-        sprintf( buf, "err=%d", err );
-
-        FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                FORMAT_MESSAGE_FROM_SYSTEM |
-                FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, err,
-                MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),
-                (LPTSTR) &temp, 0, NULL );
-        if ( temp )
-        {
-            crStrncpy( buf, temp, sizeof(buf)-1 );
-            buf[sizeof(buf)-1] = 0;
-        }
-
-        temp = buf + crStrlen(buf) - 1;
-        while ( temp > buf && isspace( *temp ) )
-        {
-            *temp = '\0';
-            temp--;
-        }
-
-        offset = sprintf( txt, "\t-----------------------\n\tWindows ERROR: %s\n\t----------------------\nCR Error(%s:%d): ", buf, my_hostname, my_pid );
-    }
-    else
-    {
-        offset = sprintf( txt, "OpenGL Error: ");
-    }
-#else
-    offset = sprintf( txt, "OpenGL Error: " );
-#endif
-    va_start( args, format );
-    vsprintf( txt + offset, format, args );
-#if defined(IN_GUEST)
-    crDebug("%s", txt);
-    outputChromiumMessage( stderr, txt );
-#else
-    LogRel(("%s\n", txt));
-#endif
-#ifdef WINDOWS
-    if (crGetenv( "CR_GUI_ERROR" ) != NULL)
-    {
-        MessageBox( NULL, txt, "Chromium Error", MB_OK );
-    }
-    else
-    {
-#endif
-        va_end( args );
-#ifdef WINDOWS
-    }
-#if !defined(DEBUG_leo) && !defined(DEBUG_ll158262) && !defined(DEBUG_misha)
-    if (crGetenv( "CR_DEBUG_ON_ERROR" ) != NULL)
-#endif
-    {
-        DebugBreak();
-    }
-#endif
-
-#ifdef IN_GUEST
-    /* Give chance for things to close down */
-    raise( SIGTERM );
-
-    exit(1);
-#endif
-}
-
-void crEnableWarnings(int onOff)
-{
-    warnings_enabled = onOff;
-}
-
-#ifdef DEBUG_misha
-# undef crWarning
-#endif
-DECLEXPORT(void) crWarning(const char *format, ... )
-{
-    if (warnings_enabled) {
-        va_list args;
-        static char txt[8092];
-        int offset;
-
-        __crCheckCanada();
-        __crCheckSwedishChef();
-        __crCheckAustralia();
-        if (!my_hostname[0])
-            __getHostInfo();
-        offset = sprintf( txt, "OpenGL Warning: ");
-        va_start( args, format );
-        vsprintf( txt + offset, format, args );
-#if defined(IN_GUEST)
-        crDebug("%s", txt);
-        outputChromiumMessage( stderr, txt );
-#else
-        LogRel(("%s\n", txt));
-#endif
-        va_end( args );
-
-#if defined(WINDOWS) && defined(DEBUG) && !defined(IN_GUEST) && defined(DEBUG_misha)
-        DebugBreak();
-#endif
-    }
-}
-
-DECLEXPORT(void) crInfo(const char *format, ... )
-{
-    va_list args;
-    static char txt[8092];
-    int offset;
-
-    __crCheckCanada();
-    __crCheckSwedishChef();
-    __crCheckAustralia();
-    if (!my_hostname[0])
-        __getHostInfo();
-    offset = sprintf( txt, "OpenGL Info: ");
-    va_start( args, format );
-    vsprintf( txt + offset, format, args );
-#if defined(IN_GUEST)
-    crDebug("%s", txt);
-    outputChromiumMessage( stderr, txt );
-#else
-    LogRel(("%s\n", txt));
-#endif
-    va_end( args );
-}
-
-#ifdef CR_DEBUG_BACKDOOR_ENABLE
-static DECLCALLBACK(void) crDebugBackdoorRt(char* pcszStr)
-{
-    RTLogBackdoorPrintf("%s", pcszStr);
-}
-
-static DECLCALLBACK(void) crDebugBackdoorDispMp(char* pcszStr)
-{
-    VBoxDispMpLoggerLog(pcszStr);
-}
-#endif
-
-
-#if defined(WINDOWS) /* && (!defined(DEBUG_misha) || !defined(IN_GUEST) ) */
-# define CR_DEBUG_DBGPRINT_ENABLE
-#endif
-
-#ifdef CR_DEBUG_DBGPRINT_ENABLE
-static void crDebugDbgPrint(const char *str)
-{
-    OutputDebugString(str);
-    OutputDebugString("\n");
-}
-
-static void crDebugDbgPrintF(const char * szString, ...)
-{
-    char szBuffer[4096] = {0};
-    va_list pArgList;
-    va_start(pArgList, szString);
-    vsprintf( szBuffer, szString, pArgList );
-    va_end(pArgList);
-
-    OutputDebugStringA(szBuffer);
-}
-
-static void crDebugDmlPrint(const char* pszDesc, const char* pszCmd)
-{
-    crDebugDbgPrintF("<?dml?><exec cmd=\"%s\">%s</exec>, ( %s )\n", pszCmd, pszDesc, pszCmd);
-}
-
-
-DECLEXPORT(void) crDbgCmdPrint(const char *description1, const char *description2, const char *cmd, ...)
-{
-    va_list args;
-    char aTxt[8092];
-    char aCmd[8092];
-
-    sprintf( aTxt, "%s%s", description1, description2 );
-
-    va_start( args, cmd );
-
-    vsprintf( aCmd, cmd, args );
-
-    va_end( args );
-
-    crDebugDmlPrint(aTxt, aCmd);
-
-    crDebug("%s: %s", aTxt, aCmd);
-}
-
-DECLEXPORT(void) crDbgCmdSymLoadPrint(const char *modName, const void*pvAddress)
-{
-    static bool fEnable = false;
-    static bool fInitialized = false;
-    const char * pszName;
-    static const char * pszModulePath = NULL;
-
-    if (!fInitialized)
-    {
-#ifndef DEBUG_misha
-        if (crGetenv( "CR_DEBUG_MODULE_ENABLE" ))
-#endif
-        {
-            fEnable = true;
-        }
-
-        fInitialized = true;
-    }
-
-    if (!fEnable)
-        return;
-
-    pszName = PathFindFileNameA(modName);
-
-    if (!pszModulePath)
-        pszModulePath = crGetenv("CR_DEBUG_MODULE_PATH");
-    if (!pszModulePath)
-        pszModulePath = "c:\\Users\\senmk\\Downloads\\Data\\Data";
-
-    crDbgCmdPrint("load modules for ", pszName, ".reload /i /f %s\\%s=%#p", pszModulePath, pszName, pvAddress);
-}
-
-#endif
-
-DECLEXPORT(void) crDebug(const char *format, ... )
-{
-    va_list args;
-    static char txt[8092];
-    int offset;
-#ifdef WINDOWS
-    DWORD err;
-#endif
-    static FILE *output;
-    static int first_time = 1;
-    static int silent = 0;
-#ifdef CR_DEBUG_BACKDOOR_ENABLE
-    typedef DECLCALLBACK(void) FNCRGEDUGBACKDOOR(char* pcszStr);
-    typedef FNCRGEDUGBACKDOOR *PFNCRGEDUGBACKDOOR;
-    static PFNCRGEDUGBACKDOOR pfnLogBackdoor = NULL;
-#endif
-#ifdef CR_DEBUG_DBGPRINT_ENABLE
-    static int dbgPrintEnable = 0;
-#endif
-
-    if (first_time)
-    {
-        const char *fname = crGetenv( "CR_DEBUG_FILE" );
-        const char *fnamePrefix = crGetenv( "CR_DEBUG_FILE_PREFIX" );
-        char str[2048];
-#ifdef CR_DEBUG_CONSOLE_ENABLE
-        int logToConsole = 0;
-#endif
-#ifdef CR_DEBUG_BACKDOOR_ENABLE
-        if (crGetenv( "CR_DEBUG_BACKDOOR" ))
-        {
-            int rc = VBoxDispMpLoggerInit();
-            if (RT_SUCCESS(rc))
-                pfnLogBackdoor = crDebugBackdoorDispMp;
-            else
-                pfnLogBackdoor = crDebugBackdoorRt;
-        }
-#endif
-#ifdef CR_DEBUG_DBGPRINT_ENABLE
-        if (crGetenv( "CR_DEBUG_DBGPRINT" ))
-        {
-            dbgPrintEnable = 1;
-        }
-#endif
-
-        if (!fname && fnamePrefix)
-        {
-            char pname[1024];
-            if (crStrlen(fnamePrefix) < sizeof (str) - sizeof (pname) - 20)
-            {
-                crGetProcName(pname, 1024);
-                sprintf(str,
-#ifdef RT_OS_WINDOWS
-                "%s_%s_%u.txt", fnamePrefix, pname, GetCurrentProcessId()
-#else
-                "%s_%s_%lu.txt", fnamePrefix, pname, crGetPID()
-#endif
-                );
-                fname = &str[0];
-            }
-        }
-
-        first_time = 0;
-        if (fname)
-        {
-            char debugFile[2048], *p;
-            crStrcpy(debugFile, fname);
-            p = crStrstr(debugFile, "%p");
-            if (p) {
-                /* replace %p with process number */
-                unsigned long n = (unsigned long) crGetPID();
-                sprintf(p, "%lu", n);
-            }
-            fname = debugFile;
-            output = fopen( fname, "w" );
-            if (!output)
-            {
-                crError( "Couldn't open debug log %s", fname );
-            }
-        }
-        else
-        {
-#ifdef CR_DEBUG_CONSOLE_ENABLE
-            if (crGetenv( "CR_DEBUG_CONSOLE" ))
-            {
-                crRedirectIOToConsole();
-                logToConsole = 1;
-            }
-#endif
-            output = stderr;
-        }
-
-#if !defined(DEBUG)/* || defined(DEBUG_misha)*/
-        /* Release mode: only emit crDebug messages if CR_DEBUG
-         * or CR_DEBUG_FILE is set.
-         */
-        if (!fname && !crGetenv("CR_DEBUG")
-#ifdef CR_DEBUG_CONSOLE_ENABLE
-                    && !logToConsole
-#endif
-#ifdef CR_DEBUG_BACKDOOR_ENABLE
-                    && !pfnLogBackdoor
-#endif
-#ifdef CR_DEBUG_DBGPRINT_ENABLE
-                    && !dbgPrintEnable
-#endif
-                )
-            silent = 1;
-#endif
-    }
-
-    if (silent)
-        return;
-
-    __crCheckCanada();
-    __crCheckSwedishChef();
-    __crCheckAustralia();
-    if (!my_hostname[0])
-        __getHostInfo();
-
-#ifdef WINDOWS
-    if ((err = GetLastError()) != 0 && crGetenv( "CR_WINDOWS_ERRORS" ) != NULL )
-    {
-        static char buf[8092], *temp;
-
-        SetLastError(0);
-        sprintf( buf, "err=%d", err );
-
-        FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                FORMAT_MESSAGE_FROM_SYSTEM |
-                FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, err,
-                MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT ),
-                (LPTSTR) &temp, 0, NULL );
-        if ( temp )
-        {
-            crStrncpy( buf, temp, sizeof(buf)-1 );
-            buf[sizeof(buf)-1] = 0;
-        }
-
-        temp = buf + crStrlen(buf) - 1;
-        while ( temp > buf && isspace( *temp ) )
-        {
-            *temp = '\0';
-            temp--;
-        }
-
-        offset = sprintf( txt, "\t-----------------------\n\tWindows ERROR: %s\n\t-----------------\nCR Debug(%s:%d): ", buf, my_hostname, my_pid );
-    }
-    else
-    {
-        offset = sprintf( txt, "[0x%x.0x%x] OpenGL Debug: ", GetCurrentProcessId(), crThreadID());
-    }
-#else
-    offset = sprintf( txt, "[0x%lx.0x%lx] OpenGL Debug: ", crGetPID(), crThreadID());
-#endif
-    va_start( args, format );
-    vsprintf( txt + offset, format, args );
-#ifdef CR_DEBUG_BACKDOOR_ENABLE
-    if (pfnLogBackdoor)
-    {
-        pfnLogBackdoor(txt);
-    }
-#endif
-#ifdef CR_DEBUG_DBGPRINT_ENABLE
-    if (dbgPrintEnable)
-    {
-        crDebugDbgPrint(txt);
-    }
-#endif
-#if defined(IN_GUEST)
-    outputChromiumMessage( output, txt );
-#else
-    if (!output
-#ifndef DEBUG_misha
-            || output==stderr
-#endif
-            )
-    {
-        LogRel(("%s\n", txt));
-    }
-    else
-    {
-        LogRel(("%s\n", txt));
-        outputChromiumMessage(output, txt);
-    }
-#endif
-    va_end( args );
-}
-
-#if defined(DEBUG_misha) && defined(RT_OS_WINDOWS)
+#if defined(RT_OS_WINDOWS)
 BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
 {
     (void) lpvReserved;
@@ -740,11 +158,28 @@ BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
     {
         case DLL_PROCESS_ATTACH:
         {
+            int rc;
+            rc = RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE); CRASSERT(rc);
+# ifdef IN_GUEST
+            rc = VbglR3Init();
+# endif
+            LogRel(("crUtill DLL loaded.\n"));
+# if defined(DEBUG_misha)
             char aName[MAX_PATH];
-             GetModuleFileNameA(hDLLInst, aName, RT_ELEMENTS(aName));
-             crDbgCmdSymLoadPrint(aName, hDLLInst);
-            break;
+            GetModuleFileNameA(hDLLInst, aName, RT_ELEMENTS(aName));
+            crDbgCmdSymLoadPrint(aName, hDLLInst);
+# endif
+             break;
         }
+
+        case DLL_PROCESS_DETACH:
+        {
+            LogRel(("crUtill DLL unloaded."));
+# ifdef IN_GUEST
+            VbglR3Term();
+# endif
+        }
+
         default:
             break;
     }
@@ -752,4 +187,3 @@ BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
     return TRUE;
 }
 #endif
-#endif
diff --git a/src/VBox/GuestHost/OpenGL/util/hash.c b/src/VBox/GuestHost/OpenGL/util/hash.c
index 95f3ab6..46c782e 100644
--- a/src/VBox/GuestHost/OpenGL/util/hash.c
+++ b/src/VBox/GuestHost/OpenGL/util/hash.c
@@ -487,14 +487,15 @@ static unsigned int crHash( unsigned long key )
 
 void crHashtableAdd( CRHashTable *h, unsigned long key, void *data )
 {
+    unsigned int index = crHash(key);
     CRHashNode *node = (CRHashNode *) crCalloc( sizeof( CRHashNode ) );
 #ifdef CHROMIUM_THREADSAFE
     crLockMutex(&h->mutex);
 #endif
     node->key = key;
     node->data = data;
-    node->next = h->buckets[crHash( key )];
-    h->buckets[ crHash( key ) ] = node;
+    node->next = h->buckets[index];
+    h->buckets[index] = node;
     h->num_elements++;
     crHashIdPoolAllocId (h->idPool, key);
 #ifdef CHROMIUM_THREADSAFE
diff --git a/src/VBox/GuestHost/OpenGL/util/threads.c b/src/VBox/GuestHost/OpenGL/util/threads.c
index 247c633..10916a0 100644
--- a/src/VBox/GuestHost/OpenGL/util/threads.c
+++ b/src/VBox/GuestHost/OpenGL/util/threads.c
@@ -28,10 +28,10 @@ void crInitTSDF(CRtsd *tsd, void (*destructor)(void *))
     }
     (void) destructor;
 #else
-    if (pthread_key_create(&tsd->key, destructor) != 0) {
-        perror(INIT_TSD_ERROR);
-        crError("crInitTSD failed!");
-    }
+    if (pthread_key_create(&tsd->key, destructor) != 0)
+        crDebug("crServer: failed to allocate TLS key.");
+    else
+        crDebug("crServer: TLS key %d allocated.", tsd->key);
 #endif
     tsd->initMagic = INIT_MAGIC;
 }
@@ -52,10 +52,9 @@ void crFreeTSD(CRtsd *tsd)
     }
 #else
     if (pthread_key_delete(tsd->key) != 0)
-    {
-//        perror(FREE_TSD_ERROR);
-//        crError("crFreeTSD failed!");
-    }
+        crDebug("crServer: failed to delete TLS key %d.", tsd->key);
+    else
+        crDebug("crServer: TLS key %d deleted.", tsd->key);
 #endif
     tsd->initMagic = 0x0;
 }
diff --git a/src/VBox/GuestHost/OpenGL/util/util.rc b/src/VBox/GuestHost/OpenGL/util/util.rc
index 981ec44..6658730 100644
--- a/src/VBox/GuestHost/OpenGL/util/util.rc
+++ b/src/VBox/GuestHost/OpenGL/util/util.rc
@@ -21,30 +21,31 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    0x3fL
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DRV
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
+  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DRV
   FILESUBTYPE      VFT2_DRV_DISPLAY
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0"
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox crOpenGL crutil ICD\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxOGLcrutil\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
 #ifdef VBOX_WDDM_WOW64
       VALUE "OriginalFilename", "VBoxOGLcrutil-x86.dll\0"
 #else
       VALUE "OriginalFilename", "VBoxOGLcrutil.dll\0"
 #endif
-      VALUE "ProductName",      VBOX_PRODUCT " Guest Additions\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_GA_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp b/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp
index d5cd933..5ed9e0b 100644
--- a/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp
+++ b/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp
@@ -622,7 +622,7 @@ void clipPeekEventAndDoXFixesHandling(CLIPBACKEND *pCtx)
  */
 static int clipEventThread(RTTHREAD self, void *pvUser)
 {
-    LogRel(("Shared clipboard: starting shared clipboard thread\n"));
+    LogRel(("Shared clipboard: Starting shared clipboard thread\n"));
 
     CLIPBACKEND *pCtx = (CLIPBACKEND *)pvUser;
 
@@ -633,7 +633,7 @@ static int clipEventThread(RTTHREAD self, void *pvUser)
         clipPeekEventAndDoXFixesHandling(pCtx);
         XtAppProcessEvent(pCtx->appContext, XtIMAll);
     }
-    LogRel(("Shared clipboard: shared clipboard thread terminated successfully\n"));
+    LogRel(("Shared clipboard: Shared clipboard thread terminated successfully\n"));
     return VINF_SUCCESS;
 }
 #endif
@@ -740,7 +740,7 @@ static int clipInit(CLIPBACKEND *pCtx)
     pDisplay = XtOpenDisplay(pCtx->appContext, 0, 0, "VBoxClipboard", 0, 0, &cArgc, &pcArgv);
     if (NULL == pDisplay)
     {
-        LogRel(("Shared clipboard: failed to connect to the X11 clipboard - the window system may not be running.\n"));
+        LogRel(("Shared clipboard: Failed to connect to the X11 clipboard - the window system may not be running.\n"));
         rc = VERR_NOT_SUPPORTED;
     }
 #ifndef TESTCASE
@@ -748,7 +748,7 @@ static int clipInit(CLIPBACKEND *pCtx)
     {
         rc = clipLoadXFixes(pDisplay, pCtx);
         if (RT_FAILURE(rc))
-           LogRel(("Shared clipboard: failed to load the XFIXES extension.\n"));
+           LogRel(("Shared clipboard: Failed to load the XFIXES extension.\n"));
     }
 #endif
     if (RT_SUCCESS(rc))
@@ -759,7 +759,7 @@ static int clipInit(CLIPBACKEND *pCtx)
                                           1, NULL);
         if (NULL == pCtx->widget)
         {
-            LogRel(("Shared clipboard: failed to construct the X11 window for the shared clipboard manager.\n"));
+            LogRel(("Shared clipboard: Failed to construct the X11 window for the shared clipboard manager.\n"));
             rc = VERR_NO_MEMORY;
         }
         else
@@ -792,14 +792,14 @@ static int clipInit(CLIPBACKEND *pCtx)
             && (fcntl(pCtx->wakeupPipeRead, F_SETFL, O_NONBLOCK) != 0))
             rc = RTErrConvertFromErrno(errno);
         if (RT_FAILURE(rc))
-            LogRel(("Shared clipboard: failed to setup the termination mechanism.\n"));
+            LogRel(("Shared clipboard: Failed to setup the termination mechanism.\n"));
     }
     else
         rc = RTErrConvertFromErrno(errno);
     if (RT_FAILURE(rc))
         clipUninit(pCtx);
     if (RT_FAILURE(rc))
-        LogRel(("Shared clipboard: initialisation failed: %Rrc\n", rc));
+        LogRel(("Shared clipboard: Initialisation failed: %Rrc\n", rc));
     return rc;
 }
 
@@ -828,7 +828,7 @@ CLIPBACKEND *ClipConstructX11(VBOXCLIPBOARDCONTEXT *pFrontend, bool fHeadless)
 
     pCtx->fHaveX11 = true;
 
-    LogRel(("Initializing X11 clipboard backend\n"));
+    LogRel(("Shared clipboard: Initializing X11 clipboard backend\n"));
     if (pCtx)
         pCtx->pFrontend = pFrontend;
     return pCtx;
@@ -879,7 +879,7 @@ int ClipStartX11(CLIPBACKEND *pCtx, bool grab)
                             RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "SHCLIP");
         if (RT_FAILURE(rc))
         {
-            LogRel(("Failed to start the shared clipboard thread.\n"));
+            LogRel(("Shared clipboard: Failed to start the shared clipboard thread.\n"));
             clipUninit(pCtx);
         }
     }
diff --git a/src/VBox/HostDrivers/Makefile.kmk b/src/VBox/HostDrivers/Makefile.kmk
index 0fe259d..72fa72b 100644
--- a/src/VBox/HostDrivers/Makefile.kmk
+++ b/src/VBox/HostDrivers/Makefile.kmk
@@ -23,7 +23,7 @@ include $(PATH_SUB_CURRENT)/Support/Makefile.kmk
 
 if  !defined(VBOX_ONLY_DOCS) \
  && !defined(VBOX_ONLY_EXTPACKS) \
- && !defined(VBOX_ONLY_TESTSUITE)
+ && !defined(VBOX_ONLY_VALIDATIONKIT)
  if1of ($(KBUILD_TARGET),win)
   include $(PATH_SUB_CURRENT)/win/Makefile.kmk
  endif
@@ -51,7 +51,7 @@ if  !defined(VBOX_ONLY_DOCS) \
   endif
  endif
 
-endif # !defined(VBOX_ONLY_DOCS) && !defined(VBOX_ONLY_TESTSUITE)
+endif # !defined(VBOX_ONLY_DOCS) && !defined(VBOX_ONLY_VALIDATIONKIT)
 
 # Let kBuild generate the rules.
 include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/HostDrivers/Support/Makefile.kmk b/src/VBox/HostDrivers/Support/Makefile.kmk
index 993628a..e455f46 100644
--- a/src/VBox/HostDrivers/Support/Makefile.kmk
+++ b/src/VBox/HostDrivers/Support/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -43,15 +43,17 @@ ifndef VBOX_ONLY_DOCS
   LIBRARIES += SUPR0
  endif
 endif
+if !defined(VBOX_ONLY_BUILD) && defined(VBOX_WITH_RAW_MODE)
+ LIBRARIES += SUPRC
+endif
 if  !defined(VBOX_ONLY_DOCS) \
  && !defined(VBOX_ONLY_EXTPACKS) \
- && !defined(VBOX_ONLY_TESTSUITE)
+ && !defined(VBOX_ONLY_VALIDATIONKIT)
  ifdef VBOX_WITH_SUPSVC
   PROGRAMS += VBoxSupSvc
  endif
  ifdef VBOX_WITH_VBOXDRV
   LIBRARIES       += SUPR0IdcClient
-  SYSMODS.freebsd += vboxdrv
   SYSMODS.os2     += VBoxDrv
  endif
  INSTALLS.linux   += vboxdrv-mod
@@ -71,7 +73,7 @@ if  !defined(VBOX_ONLY_DOCS) \
  ifeq ($(KBUILD_TARGET),freebsd)
   include $(PATH_SUB_CURRENT)/freebsd/files_vboxdrv
  endif
-endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_TESTSUITE
+endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
 
 #
 # Authenticode related trust anchors and certificates -> .cpp
@@ -148,8 +150,10 @@ SUPR3_DEFS          = \
 SUPR3_INCS         := $(PATH_SUB_CURRENT)
 SUPR3_SOURCES       = \
 	SUPLib.cpp \
+	SUPLibLdr.cpp \
 	SUPLibSem.cpp \
 	SUPLibTracerA.asm \
+	SUPLibAll.cpp \
 	SUPR3HardenedIPRT.cpp \
 	SUPR3HardenedVerify.cpp \
 	$(KBUILD_TARGET)/SUPLib-$(KBUILD_TARGET).cpp \
@@ -447,7 +451,7 @@ if1of ($(VBOX_LDR_FMT), pe lx)
  SUPR0_SOURCES       = $(SUPR0_0_OUTDIR)/SUPR0.def
  SUPR0_CLEAN         = $(SUPR0_0_OUTDIR)/SUPR0.def
 $$(SUPR0_0_OUTDIR)/SUPR0.def: \
-		$(PATH_SUB_CURRENT)/SUPDrv.c \
+		$(PATH_SUB_CURRENT)/SUPDrv.cpp \
 		$(PATH_SUB_CURRENT)/SUPR0-def-$(VBOX_LDR_FMT).sed \
 		| $$(dir $$@)
 	$(SED) \
@@ -458,6 +462,14 @@ endif
 
 
 #
+# SUPRC - The raw-mode context library.
+#
+SUPRC_TEMPLATE := VBoxRc
+SUPRC_DEFS     := IN_SUP_RC IN_RT_RC IN_VMM_RC
+SUPRC_SOURCES  := SUPLibAll.cpp
+
+
+#
 # SUPR0IdcClient - The Ring-0 IDC client driver library.
 #
 SUPR0IdcClient_TEMPLATE = VBoxR0DrvLib
@@ -474,7 +486,7 @@ SUPR0IdcClient_SOURCES = \
 
 if  !defined(VBOX_ONLY_DOCS) \
  && !defined(VBOX_ONLY_EXTPACKS) \
- && !defined(VBOX_ONLY_TESTSUITE)
+ && !defined(VBOX_ONLY_VALIDATIONKIT)
 
 ifeq ($(KBUILD_TARGET),os2)
 
@@ -504,55 +516,18 @@ VBoxDrvLib_INCS      := \
 	$(PATH_ROOT)/src/VBox/Runtime/include
 VBoxDrvLib_SOURCES    = \
 	os2/SUPDrv-os2.cpp \
-	SUPDrv.c \
-	SUPDrvSem.c
+	SUPDrv.cpp \
+	SUPDrvGip.cpp \
+	SUPDrvSem.cpp \
+	SUPLibAll.cpp
 
 endif # os2
-ifeq ($(KBUILD_TARGET),freebsd)
-
-#
-# vboxdrv.ko - The FreeBSD Kernel Module.
-#
-vboxdrv_TEMPLATE      = VBOXR0DRV
-vboxdrv_DEFS          = IN_RT_R0 IN_SUP_R0 SUPDRV_WITH_RELEASE_LOGGER VBOX_SVN_REV=$(VBOX_SVN_REV)
-vboxdrv_INCS         := $(PATH_SUB_CURRENT)
-vboxdrv_LIBS          = $(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
-vboxdrv_SOURCES      := \
-	$(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).c \
-	$(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/SUPDrv-$(KBUILD_TARGET).def \
-	SUPDrv.c \
-	SUPDrvSem.c
-## @todo the SUPDrv-freebsd.def is most probably gonna break it and require build system hacking...
-
-#
-# Targets for installing the freebsd sources.
-#
-vboxdrv-mod_INST    = bin/src/vboxdrv/
-vboxdrv-mod_SOURCES = \
-	$(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
-	$(vboxdrv-mod_0_OUTDIR)/Makefile
-vboxdrv-mod_CLEAN   = \
-	$(vboxdrv-mod_0_OUTDIR)/Makefile
-
-$$(vboxdrv-mod_0_OUTDIR)/Makefile: \
-		$(PATH_SUB_CURRENT)/freebsd/Makefile \
-		$$(if $$(eq $$(Support/freebsd/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
-		| $$(dir $$@)
-	$(call MSG_TOOL,Creating,,$@)
-	$(QUIET)$(RM) -f -- $@
- ifndef VBOX_WITH_HARDENING
-	$(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $<
- else
-	$(QUIET)$(CP) -f $< $@
- endif
-
-endif # freebsd
 
 
 #
 # New VBoxDrv target. TODO: Convert all the above to use this!
 #
-if1of ($(KBUILD_TARGET), darwin linux solaris win)
+if1of ($(KBUILD_TARGET), darwin freebsd linux solaris win)
  ifdef VBOX_WITH_VBOXDRV
   SYSMODS += VBoxDrv
  endif
@@ -613,7 +588,8 @@ if1of ($(KBUILD_TARGET), darwin linux solaris win)
  	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
  	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib
 
- #VBoxDrv_LDFLAGS.darwin    = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
+ #VBoxDrv_LDFLAGS.darwin   = -Wl,-sectcreate,__TEXT,__info_plist,$(VBoxDrv.kext_0_OUTDIR)/Info.plist
+ #VBoxDrv_LDFLAGS.darwin   = -v -Wl,-whyload -Wl,-v -Wl,-whatsloaded
  VBoxDrv_LDFLAGS.solaris += -N misc/ctf
  ifdef VBOX_WITH_NATIVE_DTRACE
   VBoxDrv_LDFLAGS.solaris += -N drv/dtrace
@@ -639,9 +615,11 @@ if1of ($(KBUILD_TARGET), darwin linux solaris win)
  endif
  VBoxDrv_SOURCES          = \
  	SUPDrv.d \
- 	SUPDrv.c \
- 	SUPDrvSem.c \
-  	SUPDrvTracer.cpp
+ 	SUPDrv.cpp \
+ 	SUPDrvGip.cpp \
+ 	SUPDrvSem.cpp \
+  	SUPDrvTracer.cpp \
+	SUPLibAll.cpp
  ifdef VBOX_WITH_NATIVE_DTRACE
   VBoxDrv_SOURCES        += \
   	SUPDrv-dtrace.cpp
@@ -664,24 +642,27 @@ if1of ($(KBUILD_TARGET), darwin)
  # Files necessary to make a darwin kernel extension bundle.
  INSTALLS.darwin += VBoxDrv.kext
  VBoxDrv.kext_INST     = $(INST_VBOXDRV)Contents/
- VBoxDrv.kext_SOURCES  = $(VBoxDrv.kext_0_OUTDIR)/Info.plist
- VBoxDrv.kext_CLEAN    = $(VBoxDrv.kext_0_OUTDIR)/Info.plist
+ VBoxDrv.kext_SOURCES  = $(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist
+ VBoxDrv.kext_CLEAN    = $(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist
+ VBoxDrv.kext_BLDDIRS  = $(VBoxDrv.kext_0_OUTDIR)/Contents/
 
-$$(VBoxDrv.kext_0_OUTDIR)/Info.plist: \
+ $$(VBoxDrv.kext_0_OUTDIR)/Contents/Info.plist: \
 		$(PATH_SUB_CURRENT)/darwin/Info.plist \
 		$(VBOX_VERSION_MK) | $$(dir $$@)
 	$(call MSG_GENERATE,VBoxDrv,$@,$<)
 	$(QUIET)$(RM) -f $@
 	$(QUIET)$(SED) \
-		-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-		-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-		-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-		-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
+		-e 's/@VBOX_VERSION_STRING@/$(if !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_STRING),4.2.51)/g' \
+		-e 's/@VBOX_VERSION_MAJOR@/$(if  !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_MAJOR),4)/g' \
+		-e 's/@VBOX_VERSION_MINOR@/$(if  !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_MINOR),2)/g' \
+		-e 's/@VBOX_VERSION_BUILD@/$(if  !defined(VBOX_MAVERICS_CODE_SIGNING_HACK),$(VBOX_VERSION_BUILD),51)/g' \
 		-e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
 		-e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
 		-e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
 		--output $@ \
 		$<
+
+ $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxDrv)
 endif
 
 
@@ -694,7 +675,7 @@ if1of ($(KBUILD_TARGET), darwin solaris)
 endif
 
 
-if1of ($(KBUILD_TARGET), linux)
+if1of ($(KBUILD_TARGET), linux freebsd)
  #
  # Targets for installing the linux sources.
  #
@@ -703,8 +684,9 @@ if1of ($(KBUILD_TARGET), linux)
  	$(subst $(DQUOTE),,$(FILES_VBOXDRV_NOBIN)) \
  	$(vboxdrv-mod_0_OUTDIR)/Makefile
  vboxdrv-mod_EXEC_SOURCES  = \
- 	$(subst $(DQUOTE),,$(FILES_VBOXDRV_BIN)) \
- 	$(PATH_ROOT)/src/VBox/HostDrivers/linux/do_Module.symvers
+ 	$(subst $(DQUOTE),,$(FILES_VBOXDRV_BIN))
+ vboxdrv-mod_EXEC_SOURCES.linux = \
+ 	$(PATH_ROOT)/src/VBox/HostDrivers/$(KBUILD_TARGET)/do_Module.symvers
  vboxdrv-mod_CLEAN   = \
  	$(vboxdrv-mod_0_OUTDIR)/Makefile \
  	$(PATH_TARGET)/vboxdrv-mod-1.dep \
@@ -712,8 +694,8 @@ if1of ($(KBUILD_TARGET), linux)
  # Scripts needed for building the kernel modules
  includedep $(PATH_TARGET)/vboxdrv-mod-1.dep
  $$(vboxdrv-mod_0_OUTDIR)/Makefile: \
-		$(PATH_SUB_CURRENT)/linux/Makefile \
-		$$(if $$(eq $$(Support/linux/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
+		$(PATH_SUB_CURRENT)/$(KBUILD_TARGET)/Makefile \
+		$$(if $$(eq $$(Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED),$$(VBOX_WITH_HARDENING)),,FORCE) \
 		| $$(dir $$@)
 	$(call MSG_TOOL,Creating,,$@)
  ifndef VBOX_WITH_HARDENING
@@ -721,8 +703,9 @@ if1of ($(KBUILD_TARGET), linux)
  else
 	$(QUIET)$(CP) -f $< $@
  endif
-	%$(QUIET2)$(APPEND) -t '$(PATH_TARGET)/vboxdrv-mod-1.dep' 'Support/linux/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
-endif # real linux
+	%$(QUIET2)$(APPEND) -t '$(PATH_TARGET)/vboxdrv-mod-1.dep' \
+		'Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)'
+endif # linux freebsd
 
 
 ifeq ($(KBUILD_TARGET), win)
@@ -755,6 +738,6 @@ ifeq ($(KBUILD_TARGET), win)
 endif # win
 
 
-endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_TESTSUITE
+endif # !VBOX_ONLY_DOCS && !VBOX_ONLY_EXTPACKS && !VBOX_ONLY_VALIDATIONKIT
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp b/src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp
index 0383968..fcfb3cc 100644
--- a/src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp
+++ b/src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp
@@ -46,7 +46,17 @@
 #ifdef RT_OS_DARWIN
 # include VBOX_PATH_MACOSX_DTRACE_H
 #elif defined(RT_OS_LINUX)
-/* DTrace experiments with the Unbreakable Enterprise Kernel (UEK)
+/* Avoid type and define conflicts. */
+# undef UINT8_MAX
+# undef UINT16_MAX
+# undef UINT32_MAX
+# undef UINT64_MAX
+# undef INT64_MAX
+# undef INT64_MIN
+# define intptr_t dtrace_intptr_t
+
+# if 0
+/* DTrace experiments with the Unbreakable Enterprise Kernel (UEK2)
    (Oracle Linux).
    1. The dtrace.h here is from the dtrace module source, not
       /usr/include/sys/dtrace.h nor /usr/include/dtrace.h.
@@ -57,16 +67,29 @@
       | sed -e 's/^......../0x/' -e 's/ A __crc_/\t/' \
             -e 's/$/\tdrivers\/dtrace\/dtrace\tEXPORT_SYMBOL/' \
       >> Module.symvers
+      Update: Althernative workaround (active), resolve symbols dynamically.
    3. No tracepoints in vboxdrv, vboxnet* or vboxpci yet.  This requires yasm
       and VBoxTpG and build time. */
-# undef UINT8_MAX
-# undef UINT16_MAX
-# undef UINT32_MAX
-# undef UINT64_MAX
-# undef INT64_MAX
-# undef INT64_MIN
-# define intptr_t dtrace_intptr_t
-# include "dtrace.h"
+#  include "dtrace.h"
+# else
+/* DTrace experiments with the Unbreakable Enterprise Kernel (UEKR3)
+   (Oracle Linux).
+   1. To generate the missing entries for the dtrace module in Module.symvers
+      of UEK:
+      nm /lib/modules/....../kernel/drivers/dtrace/dtrace.ko  \
+      | grep _crc_ \
+      | sed -e 's/^......../0x/' -e 's/ A __crc_/\t/' \
+            -e 's/$/\tdrivers\/dtrace\/dtrace\tEXPORT_SYMBOL/' \
+      >> Module.symvers
+      Update: Althernative workaround (active), resolve symbols dynamically.
+   2. No tracepoints in vboxdrv, vboxnet* or vboxpci yet.  This requires yasm
+      and VBoxTpG and build time. */
+#  include <dtrace/provider.h>
+#  include <dtrace/enabling.h> /* Missing from provider.h. */
+#  include <dtrace/arg.h> /* Missing from provider.h. */
+# endif
+# include <linux/kallsyms.h>
+/** Status code fixer (UEK uses linux convension unlike the others). */
 # define FIX_UEK_RC(a_rc) (-(a_rc))
 #else
 # include <sys/dtrace.h>
@@ -191,8 +214,8 @@ typedef VBDTSTACKDATA *PVBDTSTACKDATA;
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
-#ifdef RT_OS_DARWIN
-/** @name DTrace kernel interface used on Darwin
+#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
+/** @name DTrace kernel interface used on Darwin and Linux.
  * @{ */
 static void        (* g_pfnDTraceProbeFire)(dtrace_id_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
 static dtrace_id_t (* g_pfnDTraceProbeCreate)(dtrace_provider_id_t, const char *, const char *, const char *, int, void *);
@@ -1027,10 +1050,11 @@ static SUPDRVTRACERREG g_VBoxDTraceReg =
  */
 const SUPDRVTRACERREG * VBOXCALL supdrvDTraceInit(void)
 {
-#ifdef RT_OS_DARWIN
+#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
     /*
      * Resolve the kernel symbols we need.
      */
+# ifndef RT_OS_LINUX
     RTDBGKRNLINFO hKrnlInfo;
     int rc = RTR0DbgKrnlInfoOpen(&hKrnlInfo, 0);
     if (RT_FAILURE(rc))
@@ -1038,6 +1062,7 @@ const SUPDRVTRACERREG * VBOXCALL supdrvDTraceInit(void)
         SUPR0Printf("supdrvDTraceInit: RTR0DbgKrnlInfoOpen failed with rc=%d.\n", rc);
         return NULL;
     }
+# endif
 
     static const struct
     {
@@ -1052,8 +1077,10 @@ const SUPDRVTRACERREG * VBOXCALL supdrvDTraceInit(void)
         { "dtrace_invalidate",   (PFNRT*)&dtrace_invalidate   },
         { "dtrace_unregister",   (PFNRT*)&dtrace_unregister   },
     };
-    for (unsigned i = 0; i < RT_ELEMENTS(s_aDTraceFunctions); i++)
+    unsigned i;
+    for (i = 0; i < RT_ELEMENTS(s_aDTraceFunctions); i++)
     {
+# ifndef RT_OS_LINUX
         rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, s_aDTraceFunctions[i].pszName,
                                         (void **)s_aDTraceFunctions[i].ppfn);
         if (RT_FAILURE(rc))
@@ -1061,11 +1088,24 @@ const SUPDRVTRACERREG * VBOXCALL supdrvDTraceInit(void)
             SUPR0Printf("supdrvDTraceInit: Failed to resolved '%s' (rc=%Rrc, i=%u).\n", s_aDTraceFunctions[i].pszName, rc, i);
             break;
         }
+# else
+        unsigned long ulAddr = kallsyms_lookup_name(s_aDTraceFunctions[i].pszName);
+        if (!ulAddr)
+        {
+            SUPR0Printf("supdrvDTraceInit: Failed to resolved '%s' (i=%u).\n", s_aDTraceFunctions[i].pszName, i);
+            return NULL;
+        }
+        *s_aDTraceFunctions[i].ppfn = (PFNRT)ulAddr;
+# endif
     }
 
+# ifndef RT_OS_LINUX
     RTR0DbgKrnlInfoRelease(hKrnlInfo);
     if (RT_FAILURE(rc))
         return NULL;
+# else
+    /** @todo grab a reference to the dtrace module... */
+# endif
 #endif
 
     return &g_VBoxDTraceReg;
diff --git a/src/VBox/HostDrivers/Support/SUPDrv.c b/src/VBox/HostDrivers/Support/SUPDrv.c
deleted file mode 100644
index fa575e0..0000000
--- a/src/VBox/HostDrivers/Support/SUPDrv.c
+++ /dev/null
@@ -1,6552 +0,0 @@
-/* $Id: SUPDrv.c $ */
-/** @file
- * VBoxDrv - The VirtualBox Support Driver - Common code.
- */
-
-/*
- * Copyright (C) 2006-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#define LOG_GROUP LOG_GROUP_SUP_DRV
-#define SUPDRV_AGNOSTIC
-#include "SUPDrvInternal.h"
-#ifndef PAGE_SHIFT
-# include <iprt/param.h>
-#endif
-#include <iprt/asm.h>
-#include <iprt/asm-amd64-x86.h>
-#include <iprt/asm-math.h>
-#include <iprt/cpuset.h>
-#include <iprt/handletable.h>
-#include <iprt/mem.h>
-#include <iprt/mp.h>
-#include <iprt/power.h>
-#include <iprt/process.h>
-#include <iprt/semaphore.h>
-#include <iprt/spinlock.h>
-#include <iprt/thread.h>
-#include <iprt/uuid.h>
-#include <iprt/net.h>
-#include <iprt/crc.h>
-#include <iprt/string.h>
-#include <iprt/timer.h>
-#if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
-# include <iprt/rand.h>
-# include <iprt/path.h>
-#endif
-#include <iprt/x86.h>
-
-#include <VBox/param.h>
-#include <VBox/log.h>
-#include <VBox/err.h>
-#include <VBox/vmm/hm_svm.h>
-#include <VBox/vmm/hm_vmx.h>
-
-#if defined(RT_OS_SOLARIS) || defined(RT_OS_DARWIN)
-# include "dtrace/SUPDrv.h"
-#else
-# define VBOXDRV_SESSION_CREATE(pvSession, fUser) do { } while (0)
-# define VBOXDRV_SESSION_CLOSE(pvSession) do { } while (0)
-# define VBOXDRV_IOCTL_ENTRY(pvSession, uIOCtl, pvReqHdr) do { } while (0)
-# define VBOXDRV_IOCTL_RETURN(pvSession, uIOCtl, pvReqHdr, rcRet, rcReq) do { } while (0)
-#endif
-
-/*
- * Logging assignments:
- *      Log     - useful stuff, like failures.
- *      LogFlow - program flow, except the really noisy bits.
- *      Log2    - Cleanup.
- *      Log3    - Loader flow noise.
- *      Log4    - Call VMMR0 flow noise.
- *      Log5    - Native yet-to-be-defined noise.
- *      Log6    - Native ioctl flow noise.
- *
- * Logging requires BUILD_TYPE=debug and possibly changes to the logger
- * instantiation in log-vbox.c(pp).
- */
-
-
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
-/** The frequency by which we recalculate the u32UpdateHz and
- * u32UpdateIntervalNS GIP members. The value must be a power of 2. */
-#define GIP_UPDATEHZ_RECALC_FREQ            0x800
-
-/** @def VBOX_SVN_REV
- * The makefile should define this if it can. */
-#ifndef VBOX_SVN_REV
-# define VBOX_SVN_REV 0
-#endif
-
-#if 0 /* Don't start the GIP timers. Useful when debugging the IPRT timer code. */
-# define DO_NOT_START_GIP
-#endif
-
-
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
-static DECLCALLBACK(int)    supdrvSessionObjHandleRetain(RTHANDLETABLE hHandleTable, void *pvObj, void *pvCtx, void *pvUser);
-static DECLCALLBACK(void)   supdrvSessionObjHandleDelete(RTHANDLETABLE hHandleTable, uint32_t h, void *pvObj, void *pvCtx, void *pvUser);
-static int                  supdrvMemAdd(PSUPDRVMEMREF pMem, PSUPDRVSESSION pSession);
-static int                  supdrvMemRelease(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, SUPDRVMEMREFTYPE eType);
-static int                  supdrvIOCtl_LdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDROPEN pReq);
-static int                  supdrvIOCtl_LdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRLOAD pReq);
-static int                  supdrvIOCtl_LdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRFREE pReq);
-static int                  supdrvIOCtl_LdrLockDown(PSUPDRVDEVEXT pDevExt);
-static int                  supdrvIOCtl_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRGETSYMBOL pReq);
-static int                  supdrvIDC_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQGETSYM pReq);
-static int                  supdrvLdrSetVMMR0EPs(PSUPDRVDEVEXT pDevExt, void *pvVMMR0, void *pvVMMR0EntryInt, void *pvVMMR0EntryFast, void *pvVMMR0EntryEx);
-static void                 supdrvLdrUnsetVMMR0EPs(PSUPDRVDEVEXT pDevExt);
-static int                  supdrvLdrAddUsage(PSUPDRVSESSION pSession, PSUPDRVLDRIMAGE pImage);
-static void                 supdrvLdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
-DECLINLINE(int)             supdrvLdrLock(PSUPDRVDEVEXT pDevExt);
-DECLINLINE(int)             supdrvLdrUnlock(PSUPDRVDEVEXT pDevExt);
-static int                  supdrvIOCtl_CallServiceModule(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPCALLSERVICE pReq);
-static int                  supdrvIOCtl_LoggerSettings(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLOGGERSETTINGS pReq);
-static int                  supdrvGipCreate(PSUPDRVDEVEXT pDevExt);
-static void                 supdrvGipDestroy(PSUPDRVDEVEXT pDevExt);
-static DECLCALLBACK(void)   supdrvGipSyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick);
-static DECLCALLBACK(void)   supdrvGipAsyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick);
-static DECLCALLBACK(void)   supdrvGipMpEvent(RTMPEVENT enmEvent, RTCPUID idCpu, void *pvUser);
-static void                 supdrvGipInit(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, RTHCPHYS HCPhys,
-                                          uint64_t u64NanoTS, unsigned uUpdateHz, unsigned uUpdateIntervalNS, unsigned cCpus);
-static DECLCALLBACK(void)   supdrvGipInitOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2);
-static void                 supdrvGipTerm(PSUPGLOBALINFOPAGE pGip);
-static void                 supdrvGipUpdate(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC, RTCPUID idCpu, uint64_t iTick);
-static void                 supdrvGipUpdatePerCpu(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC,
-                                                  RTCPUID idCpu, uint8_t idApic, uint64_t iTick);
-static void                 supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS);
-static int                  supdrvIOCtl_ResumeSuspendedKbds(void);
-
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
-DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage = NULL;
-
-/** Whether the host system has an invariant TSC or not */
-static bool g_fIsInvariantTsc;
-
-/**
- * Array of the R0 SUP API.
- */
-static SUPFUNC g_aFunctions[] =
-{
-/* SED: START */
-    /* name                                     function */
-        /* Entries with absolute addresses determined at runtime, fixup
-           code makes ugly ASSUMPTIONS about the order here: */
-    { "SUPR0AbsIs64bit",                        (void *)0 },
-    { "SUPR0Abs64bitKernelCS",                  (void *)0 },
-    { "SUPR0Abs64bitKernelSS",                  (void *)0 },
-    { "SUPR0Abs64bitKernelDS",                  (void *)0 },
-    { "SUPR0AbsKernelCS",                       (void *)0 },
-    { "SUPR0AbsKernelSS",                       (void *)0 },
-    { "SUPR0AbsKernelDS",                       (void *)0 },
-    { "SUPR0AbsKernelES",                       (void *)0 },
-    { "SUPR0AbsKernelFS",                       (void *)0 },
-    { "SUPR0AbsKernelGS",                       (void *)0 },
-        /* Normal function pointers: */
-    { "g_pSUPGlobalInfoPage",                   (void *)&g_pSUPGlobalInfoPage },            /* SED: DATA */
-    { "SUPGetGIP",                              (void *)SUPGetGIP },
-    { "SUPR0ComponentDeregisterFactory",        (void *)SUPR0ComponentDeregisterFactory },
-    { "SUPR0ComponentQueryFactory",             (void *)SUPR0ComponentQueryFactory },
-    { "SUPR0ComponentRegisterFactory",          (void *)SUPR0ComponentRegisterFactory },
-    { "SUPR0ContAlloc",                         (void *)SUPR0ContAlloc },
-    { "SUPR0ContFree",                          (void *)SUPR0ContFree },
-    { "SUPR0ChangeCR4",                         (void *)SUPR0ChangeCR4 },
-    { "SUPR0EnableVTx",                         (void *)SUPR0EnableVTx },
-    { "SUPR0SuspendVTxOnCpu",                   (void *)SUPR0SuspendVTxOnCpu },
-    { "SUPR0ResumeVTxOnCpu",                    (void *)SUPR0ResumeVTxOnCpu },
-    { "SUPR0GetPagingMode",                     (void *)SUPR0GetPagingMode },
-    { "SUPR0GetKernelFeatures",                 (void *)SUPR0GetKernelFeatures },
-    { "SUPR0LockMem",                           (void *)SUPR0LockMem },
-    { "SUPR0LowAlloc",                          (void *)SUPR0LowAlloc },
-    { "SUPR0LowFree",                           (void *)SUPR0LowFree },
-    { "SUPR0MemAlloc",                          (void *)SUPR0MemAlloc },
-    { "SUPR0MemFree",                           (void *)SUPR0MemFree },
-    { "SUPR0MemGetPhys",                        (void *)SUPR0MemGetPhys },
-    { "SUPR0ObjAddRef",                         (void *)SUPR0ObjAddRef },
-    { "SUPR0ObjAddRefEx",                       (void *)SUPR0ObjAddRefEx },
-    { "SUPR0ObjRegister",                       (void *)SUPR0ObjRegister },
-    { "SUPR0ObjRelease",                        (void *)SUPR0ObjRelease },
-    { "SUPR0ObjVerifyAccess",                   (void *)SUPR0ObjVerifyAccess },
-    { "SUPR0PageAllocEx",                       (void *)SUPR0PageAllocEx },
-    { "SUPR0PageFree",                          (void *)SUPR0PageFree },
-    { "SUPR0Printf",                            (void *)SUPR0Printf },
-    { "SUPR0TracerDeregisterDrv",               (void *)SUPR0TracerDeregisterDrv },
-    { "SUPR0TracerDeregisterImpl",              (void *)SUPR0TracerDeregisterImpl },
-    { "SUPR0TracerFireProbe",                   (void *)SUPR0TracerFireProbe },
-    { "SUPR0TracerRegisterDrv",                 (void *)SUPR0TracerRegisterDrv },
-    { "SUPR0TracerRegisterImpl",                (void *)SUPR0TracerRegisterImpl },
-    { "SUPR0TracerRegisterModule",              (void *)SUPR0TracerRegisterModule },
-    { "SUPR0TracerUmodProbeFire",               (void *)SUPR0TracerUmodProbeFire },
-    { "SUPR0UnlockMem",                         (void *)SUPR0UnlockMem },
-    { "SUPSemEventClose",                       (void *)SUPSemEventClose },
-    { "SUPSemEventCreate",                      (void *)SUPSemEventCreate },
-    { "SUPSemEventGetResolution",               (void *)SUPSemEventGetResolution },
-    { "SUPSemEventMultiClose",                  (void *)SUPSemEventMultiClose },
-    { "SUPSemEventMultiCreate",                 (void *)SUPSemEventMultiCreate },
-    { "SUPSemEventMultiGetResolution",          (void *)SUPSemEventMultiGetResolution },
-    { "SUPSemEventMultiReset",                  (void *)SUPSemEventMultiReset },
-    { "SUPSemEventMultiSignal",                 (void *)SUPSemEventMultiSignal },
-    { "SUPSemEventMultiWait",                   (void *)SUPSemEventMultiWait },
-    { "SUPSemEventMultiWaitNoResume",           (void *)SUPSemEventMultiWaitNoResume },
-    { "SUPSemEventMultiWaitNsAbsIntr",          (void *)SUPSemEventMultiWaitNsAbsIntr },
-    { "SUPSemEventMultiWaitNsRelIntr",          (void *)SUPSemEventMultiWaitNsRelIntr },
-    { "SUPSemEventSignal",                      (void *)SUPSemEventSignal },
-    { "SUPSemEventWait",                        (void *)SUPSemEventWait },
-    { "SUPSemEventWaitNoResume",                (void *)SUPSemEventWaitNoResume },
-    { "SUPSemEventWaitNsAbsIntr",               (void *)SUPSemEventWaitNsAbsIntr },
-    { "SUPSemEventWaitNsRelIntr",               (void *)SUPSemEventWaitNsRelIntr },
-
-    { "RTAssertAreQuiet",                       (void *)RTAssertAreQuiet },
-    { "RTAssertMayPanic",                       (void *)RTAssertMayPanic },
-    { "RTAssertMsg1",                           (void *)RTAssertMsg1 },
-    { "RTAssertMsg2AddV",                       (void *)RTAssertMsg2AddV },
-    { "RTAssertMsg2V",                          (void *)RTAssertMsg2V },
-    { "RTAssertSetMayPanic",                    (void *)RTAssertSetMayPanic },
-    { "RTAssertSetQuiet",                       (void *)RTAssertSetQuiet },
-    { "RTCrc32",                                (void *)RTCrc32 },
-    { "RTCrc32Finish",                          (void *)RTCrc32Finish },
-    { "RTCrc32Process",                         (void *)RTCrc32Process },
-    { "RTCrc32Start",                           (void *)RTCrc32Start },
-    { "RTErrConvertFromErrno",                  (void *)RTErrConvertFromErrno },
-    { "RTErrConvertToErrno",                    (void *)RTErrConvertToErrno },
-    { "RTHandleTableAllocWithCtx",              (void *)RTHandleTableAllocWithCtx },
-    { "RTHandleTableCreate",                    (void *)RTHandleTableCreate },
-    { "RTHandleTableCreateEx",                  (void *)RTHandleTableCreateEx },
-    { "RTHandleTableDestroy",                   (void *)RTHandleTableDestroy },
-    { "RTHandleTableFreeWithCtx",               (void *)RTHandleTableFreeWithCtx },
-    { "RTHandleTableLookupWithCtx",             (void *)RTHandleTableLookupWithCtx },
-    { "RTLogDefaultInstance",                   (void *)RTLogDefaultInstance },
-    { "RTLogGetDefaultInstance",                (void *)RTLogGetDefaultInstance },
-    { "RTLogLoggerExV",                         (void *)RTLogLoggerExV },
-    { "RTLogPrintfV",                           (void *)RTLogPrintfV },
-    { "RTLogRelDefaultInstance",                (void *)RTLogRelDefaultInstance },
-    { "RTLogSetDefaultInstanceThread",          (void *)RTLogSetDefaultInstanceThread },
-    { "RTMemAllocExTag",                        (void *)RTMemAllocExTag },
-    { "RTMemAllocTag",                          (void *)RTMemAllocTag },
-    { "RTMemAllocVarTag",                       (void *)RTMemAllocVarTag },
-    { "RTMemAllocZTag",                         (void *)RTMemAllocZTag },
-    { "RTMemAllocZVarTag",                      (void *)RTMemAllocZVarTag },
-    { "RTMemDupExTag",                          (void *)RTMemDupExTag },
-    { "RTMemDupTag",                            (void *)RTMemDupTag },
-    { "RTMemFree",                              (void *)RTMemFree },
-    { "RTMemFreeEx",                            (void *)RTMemFreeEx },
-    { "RTMemReallocTag",                        (void *)RTMemReallocTag },
-    { "RTMpCpuId",                              (void *)RTMpCpuId },
-    { "RTMpCpuIdFromSetIndex",                  (void *)RTMpCpuIdFromSetIndex },
-    { "RTMpCpuIdToSetIndex",                    (void *)RTMpCpuIdToSetIndex },
-    { "RTMpGetArraySize",                       (void *)RTMpGetArraySize },
-    { "RTMpGetCount",                           (void *)RTMpGetCount },
-    { "RTMpGetMaxCpuId",                        (void *)RTMpGetMaxCpuId },
-    { "RTMpGetOnlineCount",                     (void *)RTMpGetOnlineCount },
-    { "RTMpGetOnlineSet",                       (void *)RTMpGetOnlineSet },
-    { "RTMpGetSet",                             (void *)RTMpGetSet },
-    { "RTMpIsCpuOnline",                        (void *)RTMpIsCpuOnline },
-    { "RTMpIsCpuPossible",                      (void *)RTMpIsCpuPossible },
-    { "RTMpIsCpuWorkPending",                   (void *)RTMpIsCpuWorkPending },
-    { "RTMpNotificationDeregister",             (void *)RTMpNotificationDeregister },
-    { "RTMpNotificationRegister",               (void *)RTMpNotificationRegister },
-    { "RTMpOnAll",                              (void *)RTMpOnAll },
-    { "RTMpOnOthers",                           (void *)RTMpOnOthers },
-    { "RTMpOnSpecific",                         (void *)RTMpOnSpecific },
-    { "RTMpPokeCpu",                            (void *)RTMpPokeCpu },
-    { "RTNetIPv4AddDataChecksum",               (void *)RTNetIPv4AddDataChecksum },
-    { "RTNetIPv4AddTCPChecksum",                (void *)RTNetIPv4AddTCPChecksum },
-    { "RTNetIPv4AddUDPChecksum",                (void *)RTNetIPv4AddUDPChecksum },
-    { "RTNetIPv4FinalizeChecksum",              (void *)RTNetIPv4FinalizeChecksum },
-    { "RTNetIPv4HdrChecksum",                   (void *)RTNetIPv4HdrChecksum },
-    { "RTNetIPv4IsDHCPValid",                   (void *)RTNetIPv4IsDHCPValid },
-    { "RTNetIPv4IsHdrValid",                    (void *)RTNetIPv4IsHdrValid },
-    { "RTNetIPv4IsTCPSizeValid",                (void *)RTNetIPv4IsTCPSizeValid },
-    { "RTNetIPv4IsTCPValid",                    (void *)RTNetIPv4IsTCPValid },
-    { "RTNetIPv4IsUDPSizeValid",                (void *)RTNetIPv4IsUDPSizeValid },
-    { "RTNetIPv4IsUDPValid",                    (void *)RTNetIPv4IsUDPValid },
-    { "RTNetIPv4PseudoChecksum",                (void *)RTNetIPv4PseudoChecksum },
-    { "RTNetIPv4PseudoChecksumBits",            (void *)RTNetIPv4PseudoChecksumBits },
-    { "RTNetIPv4TCPChecksum",                   (void *)RTNetIPv4TCPChecksum },
-    { "RTNetIPv4UDPChecksum",                   (void *)RTNetIPv4UDPChecksum },
-    { "RTNetIPv6PseudoChecksum",                (void *)RTNetIPv6PseudoChecksum },
-    { "RTNetIPv6PseudoChecksumBits",            (void *)RTNetIPv6PseudoChecksumBits },
-    { "RTNetIPv6PseudoChecksumEx",              (void *)RTNetIPv6PseudoChecksumEx },
-    { "RTNetTCPChecksum",                       (void *)RTNetTCPChecksum },
-    { "RTNetUDPChecksum",                       (void *)RTNetUDPChecksum },
-    { "RTPowerNotificationDeregister",          (void *)RTPowerNotificationDeregister },
-    { "RTPowerNotificationRegister",            (void *)RTPowerNotificationRegister },
-    { "RTProcSelf",                             (void *)RTProcSelf },
-    { "RTR0AssertPanicSystem",                  (void *)RTR0AssertPanicSystem },
-    { "RTR0MemAreKrnlAndUsrDifferent",          (void *)RTR0MemAreKrnlAndUsrDifferent },
-    { "RTR0MemKernelIsValidAddr",               (void *)RTR0MemKernelIsValidAddr },
-    { "RTR0MemKernelCopyFrom",                  (void *)RTR0MemKernelCopyFrom },
-    { "RTR0MemKernelCopyTo",                    (void *)RTR0MemKernelCopyTo },
-    { "RTR0MemObjAddress",                      (void *)RTR0MemObjAddress },
-    { "RTR0MemObjAddressR3",                    (void *)RTR0MemObjAddressR3 },
-    { "RTR0MemObjAllocContTag",                 (void *)RTR0MemObjAllocContTag },
-    { "RTR0MemObjAllocLowTag",                  (void *)RTR0MemObjAllocLowTag },
-    { "RTR0MemObjAllocPageTag",                 (void *)RTR0MemObjAllocPageTag },
-    { "RTR0MemObjAllocPhysExTag",               (void *)RTR0MemObjAllocPhysExTag },
-    { "RTR0MemObjAllocPhysNCTag",               (void *)RTR0MemObjAllocPhysNCTag },
-    { "RTR0MemObjAllocPhysTag",                 (void *)RTR0MemObjAllocPhysTag },
-    { "RTR0MemObjEnterPhysTag",                 (void *)RTR0MemObjEnterPhysTag },
-    { "RTR0MemObjFree",                         (void *)RTR0MemObjFree },
-    { "RTR0MemObjGetPagePhysAddr",              (void *)RTR0MemObjGetPagePhysAddr },
-    { "RTR0MemObjIsMapping",                    (void *)RTR0MemObjIsMapping },
-    { "RTR0MemObjLockUserTag",                  (void *)RTR0MemObjLockUserTag },
-    { "RTR0MemObjMapKernelExTag",               (void *)RTR0MemObjMapKernelExTag },
-    { "RTR0MemObjMapKernelTag",                 (void *)RTR0MemObjMapKernelTag },
-    { "RTR0MemObjMapUserTag",                   (void *)RTR0MemObjMapUserTag },
-    { "RTR0MemObjProtect",                      (void *)RTR0MemObjProtect },
-    { "RTR0MemObjSize",                         (void *)RTR0MemObjSize },
-    { "RTR0MemUserCopyFrom",                    (void *)RTR0MemUserCopyFrom },
-    { "RTR0MemUserCopyTo",                      (void *)RTR0MemUserCopyTo },
-    { "RTR0MemUserIsValidAddr",                 (void *)RTR0MemUserIsValidAddr },
-    { "RTR0ProcHandleSelf",                     (void *)RTR0ProcHandleSelf },
-    { "RTSemEventCreate",                       (void *)RTSemEventCreate },
-    { "RTSemEventDestroy",                      (void *)RTSemEventDestroy },
-    { "RTSemEventGetResolution",                (void *)RTSemEventGetResolution },
-    { "RTSemEventMultiCreate",                  (void *)RTSemEventMultiCreate },
-    { "RTSemEventMultiDestroy",                 (void *)RTSemEventMultiDestroy },
-    { "RTSemEventMultiGetResolution",           (void *)RTSemEventMultiGetResolution },
-    { "RTSemEventMultiReset",                   (void *)RTSemEventMultiReset },
-    { "RTSemEventMultiSignal",                  (void *)RTSemEventMultiSignal },
-    { "RTSemEventMultiWait",                    (void *)RTSemEventMultiWait },
-    { "RTSemEventMultiWaitEx",                  (void *)RTSemEventMultiWaitEx },
-    { "RTSemEventMultiWaitExDebug",             (void *)RTSemEventMultiWaitExDebug },
-    { "RTSemEventMultiWaitNoResume",            (void *)RTSemEventMultiWaitNoResume },
-    { "RTSemEventSignal",                       (void *)RTSemEventSignal },
-    { "RTSemEventWait",                         (void *)RTSemEventWait },
-    { "RTSemEventWaitEx",                       (void *)RTSemEventWaitEx },
-    { "RTSemEventWaitExDebug",                  (void *)RTSemEventWaitExDebug },
-    { "RTSemEventWaitNoResume",                 (void *)RTSemEventWaitNoResume },
-    { "RTSemFastMutexCreate",                   (void *)RTSemFastMutexCreate },
-    { "RTSemFastMutexDestroy",                  (void *)RTSemFastMutexDestroy },
-    { "RTSemFastMutexRelease",                  (void *)RTSemFastMutexRelease },
-    { "RTSemFastMutexRequest",                  (void *)RTSemFastMutexRequest },
-    { "RTSemMutexCreate",                       (void *)RTSemMutexCreate },
-    { "RTSemMutexDestroy",                      (void *)RTSemMutexDestroy },
-    { "RTSemMutexRelease",                      (void *)RTSemMutexRelease },
-    { "RTSemMutexRequest",                      (void *)RTSemMutexRequest },
-    { "RTSemMutexRequestDebug",                 (void *)RTSemMutexRequestDebug },
-    { "RTSemMutexRequestNoResume",              (void *)RTSemMutexRequestNoResume },
-    { "RTSemMutexRequestNoResumeDebug",         (void *)RTSemMutexRequestNoResumeDebug },
-    { "RTSpinlockAcquire",                      (void *)RTSpinlockAcquire },
-    { "RTSpinlockCreate",                       (void *)RTSpinlockCreate },
-    { "RTSpinlockDestroy",                      (void *)RTSpinlockDestroy },
-    { "RTSpinlockRelease",                      (void *)RTSpinlockRelease },
-    { "RTSpinlockReleaseNoInts",                (void *)RTSpinlockReleaseNoInts },
-    { "RTStrCopy",                              (void *)RTStrCopy },
-    { "RTStrDupTag",                            (void *)RTStrDupTag },
-    { "RTStrFormat",                            (void *)RTStrFormat },
-    { "RTStrFormatNumber",                      (void *)RTStrFormatNumber },
-    { "RTStrFormatTypeDeregister",              (void *)RTStrFormatTypeDeregister },
-    { "RTStrFormatTypeRegister",                (void *)RTStrFormatTypeRegister },
-    { "RTStrFormatTypeSetUser",                 (void *)RTStrFormatTypeSetUser },
-    { "RTStrFormatV",                           (void *)RTStrFormatV },
-    { "RTStrFree",                              (void *)RTStrFree },
-    { "RTStrNCmp",                              (void *)RTStrNCmp },
-    { "RTStrPrintf",                            (void *)RTStrPrintf },
-    { "RTStrPrintfEx",                          (void *)RTStrPrintfEx },
-    { "RTStrPrintfExV",                         (void *)RTStrPrintfExV },
-    { "RTStrPrintfV",                           (void *)RTStrPrintfV },
-    { "RTThreadCreate",                         (void *)RTThreadCreate },
-    { "RTThreadCtxHooksAreRegistered",          (void *)RTThreadCtxHooksAreRegistered },
-    { "RTThreadCtxHooksCreate",                 (void *)RTThreadCtxHooksCreate },
-    { "RTThreadCtxHooksDeregister",             (void *)RTThreadCtxHooksDeregister },
-    { "RTThreadCtxHooksRegister",               (void *)RTThreadCtxHooksRegister },
-    { "RTThreadCtxHooksRelease",                (void *)RTThreadCtxHooksRelease },
-    { "RTThreadCtxHooksRetain",                 (void *)RTThreadCtxHooksRetain },
-    { "RTThreadGetName",                        (void *)RTThreadGetName },
-    { "RTThreadGetNative",                      (void *)RTThreadGetNative },
-    { "RTThreadGetType",                        (void *)RTThreadGetType },
-    { "RTThreadIsInInterrupt",                  (void *)RTThreadIsInInterrupt },
-    { "RTThreadNativeSelf",                     (void *)RTThreadNativeSelf },
-    { "RTThreadPreemptDisable",                 (void *)RTThreadPreemptDisable },
-    { "RTThreadPreemptIsEnabled",               (void *)RTThreadPreemptIsEnabled },
-    { "RTThreadPreemptIsPending",               (void *)RTThreadPreemptIsPending },
-    { "RTThreadPreemptIsPendingTrusty",         (void *)RTThreadPreemptIsPendingTrusty },
-    { "RTThreadPreemptIsPossible",              (void *)RTThreadPreemptIsPossible },
-    { "RTThreadPreemptRestore",                 (void *)RTThreadPreemptRestore },
-    { "RTThreadSelf",                           (void *)RTThreadSelf },
-    { "RTThreadSelfName",                       (void *)RTThreadSelfName },
-    { "RTThreadSleep",                          (void *)RTThreadSleep },
-    { "RTThreadUserReset",                      (void *)RTThreadUserReset },
-    { "RTThreadUserSignal",                     (void *)RTThreadUserSignal },
-    { "RTThreadUserWait",                       (void *)RTThreadUserWait },
-    { "RTThreadUserWaitNoResume",               (void *)RTThreadUserWaitNoResume },
-    { "RTThreadWait",                           (void *)RTThreadWait },
-    { "RTThreadWaitNoResume",                   (void *)RTThreadWaitNoResume },
-    { "RTThreadYield",                          (void *)RTThreadYield },
-    { "RTTimeMilliTS",                          (void *)RTTimeMilliTS },
-    { "RTTimeNanoTS",                           (void *)RTTimeNanoTS },
-    { "RTTimeNow",                              (void *)RTTimeNow },
-    { "RTTimerCanDoHighResolution",             (void *)RTTimerCanDoHighResolution },
-    { "RTTimerChangeInterval",                  (void *)RTTimerChangeInterval },
-    { "RTTimerCreate",                          (void *)RTTimerCreate },
-    { "RTTimerCreateEx",                        (void *)RTTimerCreateEx },
-    { "RTTimerDestroy",                         (void *)RTTimerDestroy },
-    { "RTTimerGetSystemGranularity",            (void *)RTTimerGetSystemGranularity },
-    { "RTTimerReleaseSystemGranularity",        (void *)RTTimerReleaseSystemGranularity },
-    { "RTTimerRequestSystemGranularity",        (void *)RTTimerRequestSystemGranularity },
-    { "RTTimerStart",                           (void *)RTTimerStart },
-    { "RTTimerStop",                            (void *)RTTimerStop },
-    { "RTTimeSystemMilliTS",                    (void *)RTTimeSystemMilliTS },
-    { "RTTimeSystemNanoTS",                     (void *)RTTimeSystemNanoTS },
-    { "RTUuidCompare",                          (void *)RTUuidCompare },
-    { "RTUuidCompareStr",                       (void *)RTUuidCompareStr },
-    { "RTUuidFromStr",                          (void *)RTUuidFromStr },
-/* SED: END */
-};
-
-#if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
-/**
- * Drag in the rest of IRPT since we share it with the
- * rest of the kernel modules on darwin.
- */
-PFNRT g_apfnVBoxDrvIPRTDeps[] =
-{
-    /* VBoxNetAdp */
-    (PFNRT)RTRandBytes,
-    /* VBoxUSB */
-    (PFNRT)RTPathStripFilename,
-    NULL
-};
-#endif  /* RT_OS_DARWIN || RT_OS_SOLARIS || RT_OS_SOLARIS */
-
-
-/**
- * Initializes the device extentsion structure.
- *
- * @returns IPRT status code.
- * @param   pDevExt     The device extension to initialize.
- * @param   cbSession   The size of the session structure.  The size of
- *                      SUPDRVSESSION may be smaller when SUPDRV_AGNOSTIC is
- *                      defined because we're skipping the OS specific members
- *                      then.
- */
-int VBOXCALL supdrvInitDevExt(PSUPDRVDEVEXT pDevExt, size_t cbSession)
-{
-    int rc;
-
-#ifdef SUPDRV_WITH_RELEASE_LOGGER
-    /*
-     * Create the release log.
-     */
-    static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
-    PRTLOGGER pRelLogger;
-    rc = RTLogCreate(&pRelLogger, 0 /* fFlags */, "all",
-                     "VBOX_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups, RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER, NULL);
-    if (RT_SUCCESS(rc))
-        RTLogRelSetDefaultInstance(pRelLogger);
-    /** @todo Add native hook for getting logger config parameters and setting
-     *        them. On linux we should use the module parameter stuff... */
-#endif
-
-    /*
-     * Initialize it.
-     */
-    memset(pDevExt, 0, sizeof(*pDevExt)); /* Does not wipe OS specific tail section of the structure. */
-    pDevExt->Spinlock = NIL_RTSPINLOCK;
-    pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
-    pDevExt->hSessionHashTabSpinlock = NIL_RTSPINLOCK;
-    rc = RTSpinlockCreate(&pDevExt->Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "SUPDrvDevExt");
-    if (RT_SUCCESS(rc))
-        rc = RTSpinlockCreate(&pDevExt->hGipSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "SUPDrvGip");
-    if (RT_SUCCESS(rc))
-        rc = RTSpinlockCreate(&pDevExt->hSessionHashTabSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "SUPDrvSession");
-
-    if (RT_SUCCESS(rc))
-#ifdef SUPDRV_USE_MUTEX_FOR_LDR
-        rc = RTSemMutexCreate(&pDevExt->mtxLdr);
-#else
-        rc = RTSemFastMutexCreate(&pDevExt->mtxLdr);
-#endif
-    if (RT_SUCCESS(rc))
-    {
-        rc = RTSemFastMutexCreate(&pDevExt->mtxComponentFactory);
-        if (RT_SUCCESS(rc))
-        {
-#ifdef SUPDRV_USE_MUTEX_FOR_LDR
-            rc = RTSemMutexCreate(&pDevExt->mtxGip);
-#else
-            rc = RTSemFastMutexCreate(&pDevExt->mtxGip);
-#endif
-            if (RT_SUCCESS(rc))
-            {
-                rc = supdrvGipCreate(pDevExt);
-                if (RT_SUCCESS(rc))
-                {
-                    rc = supdrvTracerInit(pDevExt);
-                    if (RT_SUCCESS(rc))
-                    {
-                        pDevExt->pLdrInitImage  = NULL;
-                        pDevExt->hLdrInitThread = NIL_RTNATIVETHREAD;
-                        pDevExt->u32Cookie      = BIRD;  /** @todo make this random? */
-                        pDevExt->cbSession      = (uint32_t)cbSession;
-
-                        /*
-                         * Fixup the absolute symbols.
-                         *
-                         * Because of the table indexing assumptions we'll have a little #ifdef orgy
-                         * here rather than distributing this to OS specific files. At least for now.
-                         */
-#ifdef RT_OS_DARWIN
-# if ARCH_BITS == 32
-                        if (SUPR0GetPagingMode() >= SUPPAGINGMODE_AMD64)
-                        {
-                            g_aFunctions[0].pfn = (void *)1;                    /* SUPR0AbsIs64bit */
-                            g_aFunctions[1].pfn = (void *)0x80;                 /* SUPR0Abs64bitKernelCS - KERNEL64_CS, seg.h */
-                            g_aFunctions[2].pfn = (void *)0x88;                 /* SUPR0Abs64bitKernelSS - KERNEL64_SS, seg.h */
-                            g_aFunctions[3].pfn = (void *)0x88;                 /* SUPR0Abs64bitKernelDS - KERNEL64_SS, seg.h */
-                        }
-                        else
-                            g_aFunctions[0].pfn = g_aFunctions[1].pfn = g_aFunctions[2].pfn = g_aFunctions[4].pfn = (void *)0;
-                        g_aFunctions[4].pfn = (void *)0x08;                     /* SUPR0AbsKernelCS - KERNEL_CS, seg.h */
-                        g_aFunctions[5].pfn = (void *)0x10;                     /* SUPR0AbsKernelSS - KERNEL_DS, seg.h */
-                        g_aFunctions[6].pfn = (void *)0x10;                     /* SUPR0AbsKernelDS - KERNEL_DS, seg.h */
-                        g_aFunctions[7].pfn = (void *)0x10;                     /* SUPR0AbsKernelES - KERNEL_DS, seg.h */
-                        g_aFunctions[8].pfn = (void *)0x10;                     /* SUPR0AbsKernelFS - KERNEL_DS, seg.h */
-                        g_aFunctions[9].pfn = (void *)0x48;                     /* SUPR0AbsKernelGS - CPU_DATA_GS, seg.h */
-# else /* 64-bit darwin: */
-                        g_aFunctions[0].pfn = (void *)1;                        /* SUPR0AbsIs64bit */
-                        g_aFunctions[1].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0Abs64bitKernelCS */
-                        g_aFunctions[2].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0Abs64bitKernelSS */
-                        g_aFunctions[3].pfn = (void *)0;                        /* SUPR0Abs64bitKernelDS */
-                        g_aFunctions[4].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0AbsKernelCS */
-                        g_aFunctions[5].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0AbsKernelSS */
-                        g_aFunctions[6].pfn = (void *)0;                        /* SUPR0AbsKernelDS */
-                        g_aFunctions[7].pfn = (void *)0;                        /* SUPR0AbsKernelES */
-                        g_aFunctions[8].pfn = (void *)0;                        /* SUPR0AbsKernelFS */
-                        g_aFunctions[9].pfn = (void *)0;                        /* SUPR0AbsKernelGS */
-
-# endif
-#else  /* !RT_OS_DARWIN */
-# if ARCH_BITS == 64
-                        g_aFunctions[0].pfn = (void *)1;                        /* SUPR0AbsIs64bit */
-                        g_aFunctions[1].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0Abs64bitKernelCS */
-                        g_aFunctions[2].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0Abs64bitKernelSS */
-                        g_aFunctions[3].pfn = (void *)(uintptr_t)ASMGetDS();    /* SUPR0Abs64bitKernelDS */
-# else
-                        g_aFunctions[0].pfn = g_aFunctions[1].pfn = g_aFunctions[2].pfn = g_aFunctions[4].pfn = (void *)0;
-# endif
-                        g_aFunctions[4].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0AbsKernelCS */
-                        g_aFunctions[5].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0AbsKernelSS */
-                        g_aFunctions[6].pfn = (void *)(uintptr_t)ASMGetDS();    /* SUPR0AbsKernelDS */
-                        g_aFunctions[7].pfn = (void *)(uintptr_t)ASMGetES();    /* SUPR0AbsKernelES */
-                        g_aFunctions[8].pfn = (void *)(uintptr_t)ASMGetFS();    /* SUPR0AbsKernelFS */
-                        g_aFunctions[9].pfn = (void *)(uintptr_t)ASMGetGS();    /* SUPR0AbsKernelGS */
-#endif /* !RT_OS_DARWIN */
-                        return VINF_SUCCESS;
-                    }
-
-                    supdrvGipDestroy(pDevExt);
-                }
-
-#ifdef SUPDRV_USE_MUTEX_FOR_GIP
-                RTSemMutexDestroy(pDevExt->mtxGip);
-                pDevExt->mtxGip = NIL_RTSEMMUTEX;
-#else
-                RTSemFastMutexDestroy(pDevExt->mtxGip);
-                pDevExt->mtxGip = NIL_RTSEMFASTMUTEX;
-#endif
-            }
-            RTSemFastMutexDestroy(pDevExt->mtxComponentFactory);
-            pDevExt->mtxComponentFactory = NIL_RTSEMFASTMUTEX;
-        }
-#ifdef SUPDRV_USE_MUTEX_FOR_LDR
-        RTSemMutexDestroy(pDevExt->mtxLdr);
-        pDevExt->mtxLdr = NIL_RTSEMMUTEX;
-#else
-        RTSemFastMutexDestroy(pDevExt->mtxLdr);
-        pDevExt->mtxLdr = NIL_RTSEMFASTMUTEX;
-#endif
-    }
-
-    RTSpinlockDestroy(pDevExt->Spinlock);
-    pDevExt->Spinlock = NIL_RTSPINLOCK;
-    RTSpinlockDestroy(pDevExt->hGipSpinlock);
-    pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
-    RTSpinlockDestroy(pDevExt->hSessionHashTabSpinlock);
-    pDevExt->hSessionHashTabSpinlock = NIL_RTSPINLOCK;
-
-#ifdef SUPDRV_WITH_RELEASE_LOGGER
-    RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
-    RTLogDestroy(RTLogSetDefaultInstance(NULL));
-#endif
-
-    return rc;
-}
-
-
-/**
- * Delete the device extension (e.g. cleanup members).
- *
- * @param   pDevExt     The device extension to delete.
- */
-void VBOXCALL supdrvDeleteDevExt(PSUPDRVDEVEXT pDevExt)
-{
-    PSUPDRVOBJ          pObj;
-    PSUPDRVUSAGE        pUsage;
-
-    /*
-     * Kill mutexes and spinlocks.
-     */
-#ifdef SUPDRV_USE_MUTEX_FOR_GIP
-    RTSemMutexDestroy(pDevExt->mtxGip);
-    pDevExt->mtxGip = NIL_RTSEMMUTEX;
-#else
-    RTSemFastMutexDestroy(pDevExt->mtxGip);
-    pDevExt->mtxGip = NIL_RTSEMFASTMUTEX;
-#endif
-#ifdef SUPDRV_USE_MUTEX_FOR_LDR
-    RTSemMutexDestroy(pDevExt->mtxLdr);
-    pDevExt->mtxLdr = NIL_RTSEMMUTEX;
-#else
-    RTSemFastMutexDestroy(pDevExt->mtxLdr);
-    pDevExt->mtxLdr = NIL_RTSEMFASTMUTEX;
-#endif
-    RTSpinlockDestroy(pDevExt->Spinlock);
-    pDevExt->Spinlock = NIL_RTSPINLOCK;
-    RTSemFastMutexDestroy(pDevExt->mtxComponentFactory);
-    pDevExt->mtxComponentFactory = NIL_RTSEMFASTMUTEX;
-    RTSpinlockDestroy(pDevExt->hSessionHashTabSpinlock);
-    pDevExt->hSessionHashTabSpinlock = NIL_RTSPINLOCK;
-
-    /*
-     * Free lists.
-     */
-    /* objects. */
-    pObj = pDevExt->pObjs;
-    Assert(!pObj);                      /* (can trigger on forced unloads) */
-    pDevExt->pObjs = NULL;
-    while (pObj)
-    {
-        void *pvFree = pObj;
-        pObj = pObj->pNext;
-        RTMemFree(pvFree);
-    }
-
-    /* usage records. */
-    pUsage = pDevExt->pUsageFree;
-    pDevExt->pUsageFree = NULL;
-    while (pUsage)
-    {
-        void *pvFree = pUsage;
-        pUsage = pUsage->pNext;
-        RTMemFree(pvFree);
-    }
-
-    /* kill the GIP. */
-    supdrvGipDestroy(pDevExt);
-    RTSpinlockDestroy(pDevExt->hGipSpinlock);
-    pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
-
-    supdrvTracerTerm(pDevExt);
-
-#ifdef SUPDRV_WITH_RELEASE_LOGGER
-    /* destroy the loggers. */
-    RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
-    RTLogDestroy(RTLogSetDefaultInstance(NULL));
-#endif
-}
-
-
-/**
- * Create session.
- *
- * @returns IPRT status code.
- * @param   pDevExt         Device extension.
- * @param   fUser           Flag indicating whether this is a user or kernel
- *                          session.
- * @param   fUnrestricted   Unrestricted access (system) or restricted access
- *                          (user)?
- * @param   ppSession       Where to store the pointer to the session data.
- */
-int VBOXCALL supdrvCreateSession(PSUPDRVDEVEXT pDevExt, bool fUser, bool fUnrestricted, PSUPDRVSESSION *ppSession)
-{
-    int             rc;
-    PSUPDRVSESSION  pSession;
-
-    if (!SUP_IS_DEVEXT_VALID(pDevExt))
-        return VERR_INVALID_PARAMETER;
-
-    /*
-     * Allocate memory for the session data.
-     */
-    pSession = *ppSession = (PSUPDRVSESSION)RTMemAllocZ(pDevExt->cbSession);
-    if (pSession)
-    {
-        /* Initialize session data. */
-        rc = RTSpinlockCreate(&pSession->Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, "SUPDrvSession");
-        if (!rc)
-        {
-            rc = RTHandleTableCreateEx(&pSession->hHandleTable,
-                                       RTHANDLETABLE_FLAGS_LOCKED_IRQ_SAFE | RTHANDLETABLE_FLAGS_CONTEXT,
-                                       1 /*uBase*/, 32768 /*cMax*/, supdrvSessionObjHandleRetain, pSession);
-            if (RT_SUCCESS(rc))
-            {
-                Assert(pSession->Spinlock != NIL_RTSPINLOCK);
-                pSession->pDevExt           = pDevExt;
-                pSession->u32Cookie         = BIRD_INV;
-                pSession->fUnrestricted     = fUnrestricted;
-                /*pSession->fInHashTable      = false; */
-                pSession->cRefs             = 1;
-                /*pSession->pCommonNextHash   = NULL;
-                pSession->ppOsSessionPtr    = NULL; */
-                if (fUser)
-                {
-                    pSession->Process       = RTProcSelf();
-                    pSession->R0Process     = RTR0ProcHandleSelf();
-                }
-                else
-                {
-                    pSession->Process       = NIL_RTPROCESS;
-                    pSession->R0Process     = NIL_RTR0PROCESS;
-                }
-                /*pSession->pLdrUsage         = NULL;
-                pSession->pVM               = NULL;
-                pSession->pUsage            = NULL;
-                pSession->pGip              = NULL;
-                pSession->fGipReferenced    = false;
-                pSession->Bundle.cUsed      = 0; */
-                pSession->Uid               = NIL_RTUID;
-                pSession->Gid               = NIL_RTGID;
-                /*pSession->uTracerData       = 0;*/
-                pSession->hTracerCaller     = NIL_RTNATIVETHREAD;
-                RTListInit(&pSession->TpProviders);
-                /*pSession->cTpProviders      = 0;*/
-                /*pSession->cTpProbesFiring   = 0;*/
-                RTListInit(&pSession->TpUmods);
-                /*RT_ZERO(pSession->apTpLookupTable);*/
-
-                VBOXDRV_SESSION_CREATE(pSession, fUser);
-                LogFlow(("Created session %p initial cookie=%#x\n", pSession, pSession->u32Cookie));
-                return VINF_SUCCESS;
-            }
-
-            RTSpinlockDestroy(pSession->Spinlock);
-        }
-        RTMemFree(pSession);
-        *ppSession = NULL;
-        Log(("Failed to create spinlock, rc=%d!\n", rc));
-    }
-    else
-        rc = VERR_NO_MEMORY;
-
-    return rc;
-}
-
-
-/**
- * Cleans up the session in the context of the process to which it belongs, the
- * caller will free the session and the session spinlock.
- *
- * This should normally occur when the session is closed or as the process
- * exits.  Careful reference counting in the OS specfic code makes sure that
- * there cannot be any races between process/handle cleanup callbacks and
- * threads doing I/O control calls.
- *
- * @param   pDevExt     The device extension.
- * @param   pSession    Session data.
- */
-static void supdrvCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
-{
-    int                 rc;
-    PSUPDRVBUNDLE       pBundle;
-    LogFlow(("supdrvCleanupSession: pSession=%p\n", pSession));
-
-    Assert(!pSession->fInHashTable);
-    Assert(!pSession->ppOsSessionPtr);
-    AssertReleaseMsg(pSession->R0Process == RTR0ProcHandleSelf() || pSession->R0Process == NIL_RTR0PROCESS,
-                     ("R0Process=%p cur=%p; Process=%u curpid=%u\n", RTR0ProcHandleSelf(), RTProcSelf()));
-
-    /*
-     * Remove logger instances related to this session.
-     */
-    RTLogSetDefaultInstanceThread(NULL, (uintptr_t)pSession);
-
-    /*
-     * Destroy the handle table.
-     */
-    rc = RTHandleTableDestroy(pSession->hHandleTable, supdrvSessionObjHandleDelete, pSession);
-    AssertRC(rc);
-    pSession->hHandleTable = NIL_RTHANDLETABLE;
-
-    /*
-     * Release object references made in this session.
-     * In theory there should be noone racing us in this session.
-     */
-    Log2(("release objects - start\n"));
-    if (pSession->pUsage)
-    {
-        PSUPDRVUSAGE    pUsage;
-        RTSpinlockAcquire(pDevExt->Spinlock);
-
-        while ((pUsage = pSession->pUsage) != NULL)
-        {
-            PSUPDRVOBJ  pObj = pUsage->pObj;
-            pSession->pUsage = pUsage->pNext;
-
-            AssertMsg(pUsage->cUsage >= 1 && pObj->cUsage >= pUsage->cUsage, ("glob %d; sess %d\n", pObj->cUsage, pUsage->cUsage));
-            if (pUsage->cUsage < pObj->cUsage)
-            {
-                pObj->cUsage -= pUsage->cUsage;
-                RTSpinlockRelease(pDevExt->Spinlock);
-            }
-            else
-            {
-                /* Destroy the object and free the record. */
-                if (pDevExt->pObjs == pObj)
-                    pDevExt->pObjs = pObj->pNext;
-                else
-                {
-                    PSUPDRVOBJ pObjPrev;
-                    for (pObjPrev = pDevExt->pObjs; pObjPrev; pObjPrev = pObjPrev->pNext)
-                        if (pObjPrev->pNext == pObj)
-                        {
-                            pObjPrev->pNext = pObj->pNext;
-                            break;
-                        }
-                    Assert(pObjPrev);
-                }
-                RTSpinlockRelease(pDevExt->Spinlock);
-
-                Log(("supdrvCleanupSession: destroying %p/%d (%p/%p) cpid=%RTproc pid=%RTproc dtor=%p\n",
-                     pObj, pObj->enmType, pObj->pvUser1, pObj->pvUser2, pObj->CreatorProcess, RTProcSelf(), pObj->pfnDestructor));
-                if (pObj->pfnDestructor)
-                    pObj->pfnDestructor(pObj, pObj->pvUser1, pObj->pvUser2);
-                RTMemFree(pObj);
-            }
-
-            /* free it and continue. */
-            RTMemFree(pUsage);
-
-            RTSpinlockAcquire(pDevExt->Spinlock);
-        }
-
-        RTSpinlockRelease(pDevExt->Spinlock);
-        AssertMsg(!pSession->pUsage, ("Some buster reregistered an object during desturction!\n"));
-    }
-    Log2(("release objects - done\n"));
-
-    /*
-     * Do tracer cleanups related to this session.
-     */
-    Log2(("release tracer stuff - start\n"));
-    supdrvTracerCleanupSession(pDevExt, pSession);
-    Log2(("release tracer stuff - end\n"));
-
-    /*
-     * Release memory allocated in the session.
-     *
-     * We do not serialize this as we assume that the application will
-     * not allocated memory while closing the file handle object.
-     */
-    Log2(("freeing memory:\n"));
-    pBundle = &pSession->Bundle;
-    while (pBundle)
-    {
-        PSUPDRVBUNDLE   pToFree;
-        unsigned        i;
-
-        /*
-         * Check and unlock all entries in the bundle.
-         */
-        for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
-        {
-            if (pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ)
-            {
-                Log2(("eType=%d pvR0=%p pvR3=%p cb=%ld\n", pBundle->aMem[i].eType, RTR0MemObjAddress(pBundle->aMem[i].MemObj),
-                      (void *)RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3), (long)RTR0MemObjSize(pBundle->aMem[i].MemObj)));
-                if (pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ)
-                {
-                    rc = RTR0MemObjFree(pBundle->aMem[i].MapObjR3, false);
-                    AssertRC(rc); /** @todo figure out how to handle this. */
-                    pBundle->aMem[i].MapObjR3 = NIL_RTR0MEMOBJ;
-                }
-                rc = RTR0MemObjFree(pBundle->aMem[i].MemObj, true /* fFreeMappings */);
-                AssertRC(rc); /** @todo figure out how to handle this. */
-                pBundle->aMem[i].MemObj = NIL_RTR0MEMOBJ;
-                pBundle->aMem[i].eType = MEMREF_TYPE_UNUSED;
-            }
-        }
-
-        /*
-         * Advance and free previous bundle.
-         */
-        pToFree = pBundle;
-        pBundle = pBundle->pNext;
-
-        pToFree->pNext = NULL;
-        pToFree->cUsed = 0;
-        if (pToFree != &pSession->Bundle)
-            RTMemFree(pToFree);
-    }
-    Log2(("freeing memory - done\n"));
-
-    /*
-     * Deregister component factories.
-     */
-    RTSemFastMutexRequest(pDevExt->mtxComponentFactory);
-    Log2(("deregistering component factories:\n"));
-    if (pDevExt->pComponentFactoryHead)
-    {
-        PSUPDRVFACTORYREG pPrev = NULL;
-        PSUPDRVFACTORYREG pCur = pDevExt->pComponentFactoryHead;
-        while (pCur)
-        {
-            if (pCur->pSession == pSession)
-            {
-                /* unlink it */
-                PSUPDRVFACTORYREG pNext = pCur->pNext;
-                if (pPrev)
-                    pPrev->pNext = pNext;
-                else
-                    pDevExt->pComponentFactoryHead = pNext;
-
-                /* free it */
-                pCur->pNext = NULL;
-                pCur->pSession = NULL;
-                pCur->pFactory = NULL;
-                RTMemFree(pCur);
-
-                /* next */
-                pCur = pNext;
-            }
-            else
-            {
-                /* next */
-                pPrev = pCur;
-                pCur = pCur->pNext;
-            }
-        }
-    }
-    RTSemFastMutexRelease(pDevExt->mtxComponentFactory);
-    Log2(("deregistering component factories - done\n"));
-
-    /*
-     * Loaded images needs to be dereferenced and possibly freed up.
-     */
-    supdrvLdrLock(pDevExt);
-    Log2(("freeing images:\n"));
-    if (pSession->pLdrUsage)
-    {
-        PSUPDRVLDRUSAGE pUsage = pSession->pLdrUsage;
-        pSession->pLdrUsage = NULL;
-        while (pUsage)
-        {
-            void           *pvFree = pUsage;
-            PSUPDRVLDRIMAGE pImage = pUsage->pImage;
-            if (pImage->cUsage > pUsage->cUsage)
-                pImage->cUsage -= pUsage->cUsage;
-            else
-                supdrvLdrFree(pDevExt, pImage);
-            pUsage->pImage = NULL;
-            pUsage = pUsage->pNext;
-            RTMemFree(pvFree);
-        }
-    }
-    supdrvLdrUnlock(pDevExt);
-    Log2(("freeing images - done\n"));
-
-    /*
-     * Unmap the GIP.
-     */
-    Log2(("umapping GIP:\n"));
-    if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ)
-    {
-        SUPR0GipUnmap(pSession);
-        pSession->fGipReferenced = 0;
-    }
-    Log2(("umapping GIP - done\n"));
-}
-
-
-/**
- * Common code for freeing a session when the reference count reaches zero.
- *
- * @param   pDevExt     Device extension.
- * @param   pSession    Session data.
- *                      This data will be freed by this routine.
- */
-static void supdrvDestroySession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
-{
-    VBOXDRV_SESSION_CLOSE(pSession);
-
-    /*
-     * Cleanup the session first.
-     */
-    supdrvCleanupSession(pDevExt, pSession);
-    supdrvOSCleanupSession(pDevExt, pSession);
-
-    /*
-     * Free the rest of the session stuff.
-     */
-    RTSpinlockDestroy(pSession->Spinlock);
-    pSession->Spinlock = NIL_RTSPINLOCK;
-    pSession->pDevExt = NULL;
-    RTMemFree(pSession);
-    LogFlow(("supdrvDestroySession: returns\n"));
-}
-
-
-/**
- * Inserts the session into the global hash table.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_WRONG_ORDER if the session was already inserted (asserted).
- * @retval  VERR_INVALID_PARAMETER if the session handle is invalid or a ring-0
- *          session (asserted).
- * @retval  VERR_DUPLICATE if there is already a session for that pid.
- *
- * @param   pDevExt         The device extension.
- * @param   pSession        The session.
- * @param   ppOsSessionPtr  Pointer to the OS session pointer, if any is
- *                          available and used.  This will set to point to the
- *                          session while under the protection of the session
- *                          hash table spinlock.  It will also be kept in
- *                          PSUPDRVSESSION::ppOsSessionPtr for lookup and
- *                          cleanup use.
- * @param   pvUser          Argument for supdrvOSSessionHashTabInserted.
- */
-int VBOXCALL supdrvSessionHashTabInsert(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVSESSION *ppOsSessionPtr,
-                                        void *pvUser)
-{
-    PSUPDRVSESSION  pCur;
-    unsigned        iHash;
-
-    /*
-     * Validate input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertReturn(pSession->R0Process != NIL_RTR0PROCESS, VERR_INVALID_PARAMETER);
-
-    /*
-     * Calculate the hash table index and acquire the spinlock.
-     */
-    iHash = SUPDRV_SESSION_HASH(pSession->Process);
-
-    RTSpinlockAcquire(pDevExt->hSessionHashTabSpinlock);
-
-    /*
-     * If there are a collisions, we need to carefully check if we got a
-     * duplicate.  There can only be one open session per process.
-     */
-    pCur = pDevExt->apSessionHashTab[iHash];
-    if (pCur)
-    {
-        while (pCur && pCur->Process != pSession->Process)
-            pCur = pCur->pCommonNextHash;
-
-        if (pCur)
-        {
-            RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
-            if (pCur == pSession)
-            {
-                Assert(pSession->fInHashTable);
-                AssertFailed();
-                return VERR_WRONG_ORDER;
-            }
-            Assert(!pSession->fInHashTable);
-            if (pCur->R0Process == pSession->R0Process)
-                return VERR_RESOURCE_IN_USE;
-            return VERR_DUPLICATE;
-        }
-    }
-    Assert(!pSession->fInHashTable);
-    Assert(!pSession->ppOsSessionPtr);
-
-    /*
-     * Insert it, doing a callout to the OS specific code in case it has
-     * anything it wishes to do while we're holding the spinlock.
-     */
-    pSession->pCommonNextHash = pDevExt->apSessionHashTab[iHash];
-    pDevExt->apSessionHashTab[iHash] = pSession;
-    pSession->fInHashTable    = true;
-    ASMAtomicIncS32(&pDevExt->cSessions);
-
-    pSession->ppOsSessionPtr = ppOsSessionPtr;
-    if (ppOsSessionPtr)
-        ASMAtomicWritePtr(ppOsSessionPtr, pSession);
-
-    supdrvOSSessionHashTabInserted(pDevExt, pSession, pvUser);
-
-    /*
-     * Retain a reference for the pointer in the session table.
-     */
-    ASMAtomicIncU32(&pSession->cRefs);
-
-    RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Removes the session from the global hash table.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_NOT_FOUND if the session was already removed (asserted).
- * @retval  VERR_INVALID_PARAMETER if the session handle is invalid or a ring-0
- *          session (asserted).
- *
- * @param   pDevExt     The device extension.
- * @param   pSession    The session. The caller is expected to have a reference
- *                      to this so it won't croak on us when we release the hash
- *                      table reference.
- * @param   pvUser      OS specific context value for the
- *                      supdrvOSSessionHashTabInserted callback.
- */
-int VBOXCALL supdrvSessionHashTabRemove(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser)
-{
-    PSUPDRVSESSION  pCur;
-    unsigned        iHash;
-    int32_t         cRefs;
-
-    /*
-     * Validate input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertReturn(pSession->R0Process != NIL_RTR0PROCESS, VERR_INVALID_PARAMETER);
-
-    /*
-     * Calculate the hash table index and acquire the spinlock.
-     */
-    iHash = SUPDRV_SESSION_HASH(pSession->Process);
-
-    RTSpinlockAcquire(pDevExt->hSessionHashTabSpinlock);
-
-    /*
-     * Unlink it.
-     */
-    pCur = pDevExt->apSessionHashTab[iHash];
-    if (pCur == pSession)
-        pDevExt->apSessionHashTab[iHash] = pSession->pCommonNextHash;
-    else
-    {
-        PSUPDRVSESSION pPrev = pCur;
-        while (pCur && pCur != pSession)
-        {
-            pPrev = pCur;
-            pCur  = pCur->pCommonNextHash;
-        }
-        if (pCur)
-            pPrev->pCommonNextHash = pCur->pCommonNextHash;
-        else
-        {
-            Assert(!pSession->fInHashTable);
-            RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
-            return VERR_NOT_FOUND;
-        }
-    }
-
-    pSession->pCommonNextHash = NULL;
-    pSession->fInHashTable    = false;
-
-    ASMAtomicDecU32(&pDevExt->cSessions);
-
-    /*
-     * Clear OS specific session pointer if available and do the OS callback.
-     */
-    if (pSession->ppOsSessionPtr)
-    {
-        ASMAtomicCmpXchgPtr(pSession->ppOsSessionPtr, NULL, pSession);
-        pSession->ppOsSessionPtr = NULL;
-    }
-
-    supdrvOSSessionHashTabRemoved(pDevExt, pSession, pvUser);
-
-    RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
-
-    /*
-     * Drop the reference the hash table had to the session.  This shouldn't
-     * be the last reference!
-     */
-    cRefs = ASMAtomicDecU32(&pSession->cRefs);
-    Assert(cRefs > 0 && cRefs < _1M);
-    if (cRefs == 0)
-        supdrvDestroySession(pDevExt, pSession);
-
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Looks up the session for the current process in the global hash table or in
- * OS specific pointer.
- *
- * @returns Pointer to the session with a reference that the caller must
- *          release.  If no valid session was found, NULL is returned.
- *
- * @param   pDevExt         The device extension.
- * @param   Process         The process ID.
- * @param   R0Process       The ring-0 process handle.
- * @param   ppOsSessionPtr  The OS session pointer if available.  If not NULL,
- *                          this is used instead of the hash table.  For
- *                          additional safety it must then be equal to the
- *                          SUPDRVSESSION::ppOsSessionPtr member.
- *                          This can be NULL even if the OS has a session
- *                          pointer.
- */
-PSUPDRVSESSION VBOXCALL supdrvSessionHashTabLookup(PSUPDRVDEVEXT pDevExt, RTPROCESS Process, RTR0PROCESS R0Process,
-                                                   PSUPDRVSESSION *ppOsSessionPtr)
-{
-    PSUPDRVSESSION  pCur;
-    unsigned        iHash;
-
-    /*
-     * Validate input.
-     */
-    AssertReturn(R0Process != NIL_RTR0PROCESS, NULL);
-
-    /*
-     * Calculate the hash table index and acquire the spinlock.
-     */
-    iHash = SUPDRV_SESSION_HASH(Process);
-
-    RTSpinlockAcquire(pDevExt->hSessionHashTabSpinlock);
-
-    /*
-     * If an OS session pointer is provided, always use it.
-     */
-    if (ppOsSessionPtr)
-    {
-        pCur = *ppOsSessionPtr;
-        if (   pCur
-            && (   pCur->ppOsSessionPtr != ppOsSessionPtr
-                || pCur->Process        != Process
-                || pCur->R0Process      != R0Process) )
-            pCur = NULL;
-    }
-    else
-    {
-        /*
-         * Otherwise, do the hash table lookup.
-         */
-        pCur = pDevExt->apSessionHashTab[iHash];
-        while (   pCur
-               && (   pCur->Process   != Process
-                   || pCur->R0Process != R0Process) )
-            pCur = pCur->pCommonNextHash;
-    }
-
-    /*
-     * Retain the session.
-     */
-    if (pCur)
-    {
-        uint32_t cRefs = ASMAtomicIncU32(&pCur->cRefs);
-        NOREF(cRefs);
-        Assert(cRefs > 1 && cRefs < _1M);
-    }
-
-    RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
-
-    return pCur;
-}
-
-
-/**
- * Retain a session to make sure it doesn't go away while it is in use.
- *
- * @returns New reference count on success, UINT32_MAX on failure.
- * @param   pSession    Session data.
- */
-uint32_t VBOXCALL supdrvSessionRetain(PSUPDRVSESSION pSession)
-{
-    uint32_t cRefs;
-    AssertPtrReturn(pSession, UINT32_MAX);
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), UINT32_MAX);
-
-    cRefs = ASMAtomicIncU32(&pSession->cRefs);
-    AssertMsg(cRefs > 1 && cRefs < _1M, ("%#x %p\n", cRefs, pSession));
-    return cRefs;
-}
-
-
-/**
- * Releases a given session.
- *
- * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
- * @param   pSession    Session data.
- */
-uint32_t VBOXCALL supdrvSessionRelease(PSUPDRVSESSION pSession)
-{
-    uint32_t cRefs;
-    AssertPtrReturn(pSession, UINT32_MAX);
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), UINT32_MAX);
-
-    cRefs = ASMAtomicDecU32(&pSession->cRefs);
-    AssertMsg(cRefs < _1M, ("%#x %p\n", cRefs, pSession));
-    if (cRefs == 0)
-        supdrvDestroySession(pSession->pDevExt, pSession);
-    return cRefs;
-}
-
-
-/**
- * RTHandleTableDestroy callback used by supdrvCleanupSession.
- *
- * @returns IPRT status code, see SUPR0ObjAddRef.
- * @param   hHandleTable    The handle table handle. Ignored.
- * @param   pvObj           The object pointer.
- * @param   pvCtx           Context, the handle type. Ignored.
- * @param   pvUser          Session pointer.
- */
-static DECLCALLBACK(int) supdrvSessionObjHandleRetain(RTHANDLETABLE hHandleTable, void *pvObj, void *pvCtx, void *pvUser)
-{
-    NOREF(pvCtx);
-    NOREF(hHandleTable);
-    return SUPR0ObjAddRefEx(pvObj, (PSUPDRVSESSION)pvUser, true /*fNoBlocking*/);
-}
-
-
-/**
- * RTHandleTableDestroy callback used by supdrvCleanupSession.
- *
- * @param   hHandleTable    The handle table handle. Ignored.
- * @param   h               The handle value. Ignored.
- * @param   pvObj           The object pointer.
- * @param   pvCtx           Context, the handle type. Ignored.
- * @param   pvUser          Session pointer.
- */
-static DECLCALLBACK(void) supdrvSessionObjHandleDelete(RTHANDLETABLE hHandleTable, uint32_t h, void *pvObj, void *pvCtx, void *pvUser)
-{
-    NOREF(pvCtx);
-    NOREF(h);
-    NOREF(hHandleTable);
-    SUPR0ObjRelease(pvObj, (PSUPDRVSESSION)pvUser);
-}
-
-
-/**
- * Fast path I/O Control worker.
- *
- * @returns VBox status code that should be passed down to ring-3 unchanged.
- * @param   uIOCtl      Function number.
- * @param   idCpu       VMCPU id.
- * @param   pDevExt     Device extention.
- * @param   pSession    Session data.
- */
-int VBOXCALL supdrvIOCtlFast(uintptr_t uIOCtl, VMCPUID idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
-{
-    /*
-     * We check the two prereqs after doing this only to allow the compiler to optimize things better.
-     */
-    if (RT_LIKELY(   RT_VALID_PTR(pSession)
-                  && pSession->pVM
-                  && pDevExt->pfnVMMR0EntryFast))
-    {
-        switch (uIOCtl)
-        {
-            case SUP_IOCTL_FAST_DO_RAW_RUN:
-                pDevExt->pfnVMMR0EntryFast(pSession->pVM, idCpu, SUP_VMMR0_DO_RAW_RUN);
-                break;
-            case SUP_IOCTL_FAST_DO_HM_RUN:
-                pDevExt->pfnVMMR0EntryFast(pSession->pVM, idCpu, SUP_VMMR0_DO_HM_RUN);
-                break;
-            case SUP_IOCTL_FAST_DO_NOP:
-                pDevExt->pfnVMMR0EntryFast(pSession->pVM, idCpu, SUP_VMMR0_DO_NOP);
-                break;
-            default:
-                return VERR_INTERNAL_ERROR;
-        }
-        return VINF_SUCCESS;
-    }
-    return VERR_INTERNAL_ERROR;
-}
-
-
-/**
- * Helper for supdrvIOCtl. Check if pszStr contains any character of pszChars.
- * We would use strpbrk here if this function would be contained in the RedHat kABI white
- * list, see http://www.kerneldrivers.org/RHEL5.
- *
- * @returns  1 if pszStr does contain any character of pszChars, 0 otherwise.
- * @param    pszStr     String to check
- * @param    pszChars   Character set
- */
-static int supdrvCheckInvalidChar(const char *pszStr, const char *pszChars)
-{
-    int chCur;
-    while ((chCur = *pszStr++) != '\0')
-    {
-        int ch;
-        const char *psz = pszChars;
-        while ((ch = *psz++) != '\0')
-            if (ch == chCur)
-                return 1;
-
-    }
-    return 0;
-}
-
-
-
-/**
- * I/O Control inner worker (tracing reasons).
- *
- * @returns IPRT status code.
- * @retval  VERR_INVALID_PARAMETER if the request is invalid.
- *
- * @param   uIOCtl      Function number.
- * @param   pDevExt     Device extention.
- * @param   pSession    Session data.
- * @param   pReqHdr     The request header.
- */
-static int supdrvIOCtlInnerUnrestricted(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr)
-{
-    /*
-     * Validation macros
-     */
-#define REQ_CHECK_SIZES_EX(Name, cbInExpect, cbOutExpect) \
-    do { \
-        if (RT_UNLIKELY(pReqHdr->cbIn != (cbInExpect) || pReqHdr->cbOut != (cbOutExpect))) \
-        { \
-            OSDBGPRINT(( #Name ": Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", \
-                        (long)pReqHdr->cbIn, (long)(cbInExpect), (long)pReqHdr->cbOut, (long)(cbOutExpect))); \
-            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
-        } \
-    } while (0)
-
-#define REQ_CHECK_SIZES(Name) REQ_CHECK_SIZES_EX(Name, Name ## _SIZE_IN, Name ## _SIZE_OUT)
-
-#define REQ_CHECK_SIZE_IN(Name, cbInExpect) \
-    do { \
-        if (RT_UNLIKELY(pReqHdr->cbIn != (cbInExpect))) \
-        { \
-            OSDBGPRINT(( #Name ": Invalid input/output sizes. cbIn=%ld expected %ld.\n", \
-                        (long)pReqHdr->cbIn, (long)(cbInExpect))); \
-            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
-        } \
-    } while (0)
-
-#define REQ_CHECK_SIZE_OUT(Name, cbOutExpect) \
-    do { \
-        if (RT_UNLIKELY(pReqHdr->cbOut != (cbOutExpect))) \
-        { \
-            OSDBGPRINT(( #Name ": Invalid input/output sizes. cbOut=%ld expected %ld.\n", \
-                        (long)pReqHdr->cbOut, (long)(cbOutExpect))); \
-            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
-        } \
-    } while (0)
-
-#define REQ_CHECK_EXPR(Name, expr) \
-    do { \
-        if (RT_UNLIKELY(!(expr))) \
-        { \
-            OSDBGPRINT(( #Name ": %s\n", #expr)); \
-            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
-        } \
-    } while (0)
-
-#define REQ_CHECK_EXPR_FMT(expr, fmt) \
-    do { \
-        if (RT_UNLIKELY(!(expr))) \
-        { \
-            OSDBGPRINT( fmt ); \
-            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
-        } \
-    } while (0)
-
-    /*
-     * The switch.
-     */
-    switch (SUP_CTL_CODE_NO_SIZE(uIOCtl))
-    {
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_COOKIE):
-        {
-            PSUPCOOKIE pReq = (PSUPCOOKIE)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_COOKIE);
-            if (strncmp(pReq->u.In.szMagic, SUPCOOKIE_MAGIC, sizeof(pReq->u.In.szMagic)))
-            {
-                OSDBGPRINT(("SUP_IOCTL_COOKIE: invalid magic %.16s\n", pReq->u.In.szMagic));
-                pReq->Hdr.rc = VERR_INVALID_MAGIC;
-                return 0;
-            }
-
-#if 0
-            /*
-             * Call out to the OS specific code and let it do permission checks on the
-             * client process.
-             */
-            if (!supdrvOSValidateClientProcess(pDevExt, pSession))
-            {
-                pReq->u.Out.u32Cookie         = 0xffffffff;
-                pReq->u.Out.u32SessionCookie  = 0xffffffff;
-                pReq->u.Out.u32SessionVersion = 0xffffffff;
-                pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
-                pReq->u.Out.pSession          = NULL;
-                pReq->u.Out.cFunctions        = 0;
-                pReq->Hdr.rc = VERR_PERMISSION_DENIED;
-                return 0;
-            }
-#endif
-
-            /*
-             * Match the version.
-             * The current logic is very simple, match the major interface version.
-             */
-            if (    pReq->u.In.u32MinVersion > SUPDRV_IOC_VERSION
-                ||  (pReq->u.In.u32MinVersion & 0xffff0000) != (SUPDRV_IOC_VERSION & 0xffff0000))
-            {
-                OSDBGPRINT(("SUP_IOCTL_COOKIE: Version mismatch. Requested: %#x  Min: %#x  Current: %#x\n",
-                            pReq->u.In.u32ReqVersion, pReq->u.In.u32MinVersion, SUPDRV_IOC_VERSION));
-                pReq->u.Out.u32Cookie         = 0xffffffff;
-                pReq->u.Out.u32SessionCookie  = 0xffffffff;
-                pReq->u.Out.u32SessionVersion = 0xffffffff;
-                pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
-                pReq->u.Out.pSession          = NULL;
-                pReq->u.Out.cFunctions        = 0;
-                pReq->Hdr.rc = VERR_VERSION_MISMATCH;
-                return 0;
-            }
-
-            /*
-             * Fill in return data and be gone.
-             * N.B. The first one to change SUPDRV_IOC_VERSION shall makes sure that
-             *      u32SessionVersion <= u32ReqVersion!
-             */
-            /** @todo Somehow validate the client and negotiate a secure cookie... */
-            pReq->u.Out.u32Cookie         = pDevExt->u32Cookie;
-            pReq->u.Out.u32SessionCookie  = pSession->u32Cookie;
-            pReq->u.Out.u32SessionVersion = SUPDRV_IOC_VERSION;
-            pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
-            pReq->u.Out.pSession          = pSession;
-            pReq->u.Out.cFunctions        = sizeof(g_aFunctions) / sizeof(g_aFunctions[0]);
-            pReq->Hdr.rc = VINF_SUCCESS;
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_QUERY_FUNCS(0)):
-        {
-            /* validate */
-            PSUPQUERYFUNCS pReq = (PSUPQUERYFUNCS)pReqHdr;
-            REQ_CHECK_SIZES_EX(SUP_IOCTL_QUERY_FUNCS, SUP_IOCTL_QUERY_FUNCS_SIZE_IN, SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(RT_ELEMENTS(g_aFunctions)));
-
-            /* execute */
-            pReq->u.Out.cFunctions = RT_ELEMENTS(g_aFunctions);
-            memcpy(&pReq->u.Out.aFunctions[0], g_aFunctions, sizeof(g_aFunctions));
-            pReq->Hdr.rc = VINF_SUCCESS;
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_LOCK):
-        {
-            /* validate */
-            PSUPPAGELOCK pReq = (PSUPPAGELOCK)pReqHdr;
-            REQ_CHECK_SIZE_IN(SUP_IOCTL_PAGE_LOCK, SUP_IOCTL_PAGE_LOCK_SIZE_IN);
-            REQ_CHECK_SIZE_OUT(SUP_IOCTL_PAGE_LOCK, SUP_IOCTL_PAGE_LOCK_SIZE_OUT(pReq->u.In.cPages));
-            REQ_CHECK_EXPR(SUP_IOCTL_PAGE_LOCK, pReq->u.In.cPages > 0);
-            REQ_CHECK_EXPR(SUP_IOCTL_PAGE_LOCK, pReq->u.In.pvR3 >= PAGE_SIZE);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0LockMem(pSession, pReq->u.In.pvR3, pReq->u.In.cPages, &pReq->u.Out.aPages[0]);
-            if (RT_FAILURE(pReq->Hdr.rc))
-                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_UNLOCK):
-        {
-            /* validate */
-            PSUPPAGEUNLOCK pReq = (PSUPPAGEUNLOCK)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_PAGE_UNLOCK);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0UnlockMem(pSession, pReq->u.In.pvR3);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CONT_ALLOC):
-        {
-            /* validate */
-            PSUPCONTALLOC pReq = (PSUPCONTALLOC)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_CONT_ALLOC);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0ContAlloc(pSession, pReq->u.In.cPages, &pReq->u.Out.pvR0, &pReq->u.Out.pvR3, &pReq->u.Out.HCPhys);
-            if (RT_FAILURE(pReq->Hdr.rc))
-                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CONT_FREE):
-        {
-            /* validate */
-            PSUPCONTFREE pReq = (PSUPCONTFREE)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_CONT_FREE);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0ContFree(pSession, (RTHCUINTPTR)pReq->u.In.pvR3);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_OPEN):
-        {
-            /* validate */
-            PSUPLDROPEN pReq = (PSUPLDROPEN)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_LDR_OPEN);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageWithTabs > 0);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageWithTabs < 16*_1M);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageBits > 0);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageBits > 0);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageBits < pReq->u.In.cbImageWithTabs);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.szName[0]);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, RTStrEnd(pReq->u.In.szName, sizeof(pReq->u.In.szName)));
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, !supdrvCheckInvalidChar(pReq->u.In.szName, ";:()[]{}/\\|&*%#@!~`\"'"));
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, RTStrEnd(pReq->u.In.szFilename, sizeof(pReq->u.In.szFilename)));
-
-            /* execute */
-            pReq->Hdr.rc = supdrvIOCtl_LdrOpen(pDevExt, pSession, pReq);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_LOAD):
-        {
-            /* validate */
-            PSUPLDRLOAD pReq = (PSUPLDRLOAD)pReqHdr;
-            REQ_CHECK_EXPR(Name, pReq->Hdr.cbIn >= sizeof(*pReq));
-            REQ_CHECK_SIZES_EX(SUP_IOCTL_LDR_LOAD, SUP_IOCTL_LDR_LOAD_SIZE_IN(pReq->u.In.cbImageWithTabs), SUP_IOCTL_LDR_LOAD_SIZE_OUT);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_LOAD, pReq->u.In.cSymbols <= 16384);
-            REQ_CHECK_EXPR_FMT(     !pReq->u.In.cSymbols
-                               ||   (   pReq->u.In.offSymbols < pReq->u.In.cbImageWithTabs
-                                     && pReq->u.In.offSymbols + pReq->u.In.cSymbols * sizeof(SUPLDRSYM) <= pReq->u.In.cbImageWithTabs),
-                               ("SUP_IOCTL_LDR_LOAD: offSymbols=%#lx cSymbols=%#lx cbImageWithTabs=%#lx\n", (long)pReq->u.In.offSymbols,
-                                (long)pReq->u.In.cSymbols, (long)pReq->u.In.cbImageWithTabs));
-            REQ_CHECK_EXPR_FMT(     !pReq->u.In.cbStrTab
-                               ||   (   pReq->u.In.offStrTab < pReq->u.In.cbImageWithTabs
-                                     && pReq->u.In.offStrTab + pReq->u.In.cbStrTab <= pReq->u.In.cbImageWithTabs
-                                     && pReq->u.In.cbStrTab <= pReq->u.In.cbImageWithTabs),
-                               ("SUP_IOCTL_LDR_LOAD: offStrTab=%#lx cbStrTab=%#lx cbImageWithTabs=%#lx\n", (long)pReq->u.In.offStrTab,
-                                (long)pReq->u.In.cbStrTab, (long)pReq->u.In.cbImageWithTabs));
-
-            if (pReq->u.In.cSymbols)
-            {
-                uint32_t i;
-                PSUPLDRSYM paSyms = (PSUPLDRSYM)&pReq->u.In.abImage[pReq->u.In.offSymbols];
-                for (i = 0; i < pReq->u.In.cSymbols; i++)
-                {
-                    REQ_CHECK_EXPR_FMT(paSyms[i].offSymbol < pReq->u.In.cbImageWithTabs,
-                                       ("SUP_IOCTL_LDR_LOAD: sym #%ld: symb off %#lx (max=%#lx)\n", (long)i, (long)paSyms[i].offSymbol, (long)pReq->u.In.cbImageWithTabs));
-                    REQ_CHECK_EXPR_FMT(paSyms[i].offName < pReq->u.In.cbStrTab,
-                                       ("SUP_IOCTL_LDR_LOAD: sym #%ld: name off %#lx (max=%#lx)\n", (long)i, (long)paSyms[i].offName, (long)pReq->u.In.cbImageWithTabs));
-                    REQ_CHECK_EXPR_FMT(RTStrEnd((char const *)&pReq->u.In.abImage[pReq->u.In.offStrTab + paSyms[i].offName],
-                                                pReq->u.In.cbStrTab - paSyms[i].offName),
-                                       ("SUP_IOCTL_LDR_LOAD: sym #%ld: unterminated name! (%#lx / %#lx)\n", (long)i, (long)paSyms[i].offName, (long)pReq->u.In.cbImageWithTabs));
-                }
-            }
-
-            /* execute */
-            pReq->Hdr.rc = supdrvIOCtl_LdrLoad(pDevExt, pSession, pReq);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_FREE):
-        {
-            /* validate */
-            PSUPLDRFREE pReq = (PSUPLDRFREE)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_LDR_FREE);
-
-            /* execute */
-            pReq->Hdr.rc = supdrvIOCtl_LdrFree(pDevExt, pSession, pReq);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_LOCK_DOWN):
-        {
-            /* validate */
-            REQ_CHECK_SIZES(SUP_IOCTL_LDR_LOCK_DOWN);
-
-            /* execute */
-            pReqHdr->rc = supdrvIOCtl_LdrLockDown(pDevExt);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_GET_SYMBOL):
-        {
-            /* validate */
-            PSUPLDRGETSYMBOL pReq = (PSUPLDRGETSYMBOL)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_LDR_GET_SYMBOL);
-            REQ_CHECK_EXPR(SUP_IOCTL_LDR_GET_SYMBOL, RTStrEnd(pReq->u.In.szSymbol, sizeof(pReq->u.In.szSymbol)));
-
-            /* execute */
-            pReq->Hdr.rc = supdrvIOCtl_LdrGetSymbol(pDevExt, pSession, pReq);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CALL_VMMR0(0)):
-        {
-            /* validate */
-            PSUPCALLVMMR0 pReq = (PSUPCALLVMMR0)pReqHdr;
-            Log4(("SUP_IOCTL_CALL_VMMR0: op=%u in=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-                  pReq->u.In.uOperation, pReq->Hdr.cbIn, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-
-            if (pReq->Hdr.cbIn == SUP_IOCTL_CALL_VMMR0_SIZE(0))
-            {
-                REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_VMMR0, SUP_IOCTL_CALL_VMMR0_SIZE_IN(0), SUP_IOCTL_CALL_VMMR0_SIZE_OUT(0));
-
-                /* execute */
-                if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx))
-                    pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.idCpu, pReq->u.In.uOperation, NULL, pReq->u.In.u64Arg, pSession);
-                else
-                    pReq->Hdr.rc = VERR_WRONG_ORDER;
-            }
-            else
-            {
-                PSUPVMMR0REQHDR pVMMReq = (PSUPVMMR0REQHDR)&pReq->abReqPkt[0];
-                REQ_CHECK_EXPR_FMT(pReq->Hdr.cbIn >= SUP_IOCTL_CALL_VMMR0_SIZE(sizeof(SUPVMMR0REQHDR)),
-                                   ("SUP_IOCTL_CALL_VMMR0: cbIn=%#x < %#lx\n", pReq->Hdr.cbIn, SUP_IOCTL_CALL_VMMR0_SIZE(sizeof(SUPVMMR0REQHDR))));
-                REQ_CHECK_EXPR(SUP_IOCTL_CALL_VMMR0, pVMMReq->u32Magic == SUPVMMR0REQHDR_MAGIC);
-                REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_VMMR0, SUP_IOCTL_CALL_VMMR0_SIZE_IN(pVMMReq->cbReq), SUP_IOCTL_CALL_VMMR0_SIZE_OUT(pVMMReq->cbReq));
-
-                /* execute */
-                if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx))
-                    pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.idCpu, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession);
-                else
-                    pReq->Hdr.rc = VERR_WRONG_ORDER;
-            }
-
-            if (    RT_FAILURE(pReq->Hdr.rc)
-                &&  pReq->Hdr.rc != VERR_INTERRUPTED
-                &&  pReq->Hdr.rc != VERR_TIMEOUT)
-                Log(("SUP_IOCTL_CALL_VMMR0: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-                     pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-            else
-                Log4(("SUP_IOCTL_CALL_VMMR0: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-                      pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CALL_VMMR0_BIG):
-        {
-            /* validate */
-            PSUPCALLVMMR0 pReq = (PSUPCALLVMMR0)pReqHdr;
-            PSUPVMMR0REQHDR pVMMReq;
-            Log4(("SUP_IOCTL_CALL_VMMR0_BIG: op=%u in=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-                  pReq->u.In.uOperation, pReq->Hdr.cbIn, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-
-            pVMMReq = (PSUPVMMR0REQHDR)&pReq->abReqPkt[0];
-            REQ_CHECK_EXPR_FMT(pReq->Hdr.cbIn >= SUP_IOCTL_CALL_VMMR0_BIG_SIZE(sizeof(SUPVMMR0REQHDR)),
-                               ("SUP_IOCTL_CALL_VMMR0_BIG: cbIn=%#x < %#lx\n", pReq->Hdr.cbIn, SUP_IOCTL_CALL_VMMR0_BIG_SIZE(sizeof(SUPVMMR0REQHDR))));
-            REQ_CHECK_EXPR(SUP_IOCTL_CALL_VMMR0_BIG, pVMMReq->u32Magic == SUPVMMR0REQHDR_MAGIC);
-            REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_VMMR0_BIG, SUP_IOCTL_CALL_VMMR0_BIG_SIZE_IN(pVMMReq->cbReq), SUP_IOCTL_CALL_VMMR0_BIG_SIZE_OUT(pVMMReq->cbReq));
-
-            /* execute */
-            if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx))
-                pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.idCpu, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession);
-            else
-                pReq->Hdr.rc = VERR_WRONG_ORDER;
-
-            if (    RT_FAILURE(pReq->Hdr.rc)
-                &&  pReq->Hdr.rc != VERR_INTERRUPTED
-                &&  pReq->Hdr.rc != VERR_TIMEOUT)
-                Log(("SUP_IOCTL_CALL_VMMR0_BIG: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-                     pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-            else
-                Log4(("SUP_IOCTL_CALL_VMMR0_BIG: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-                      pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_GET_PAGING_MODE):
-        {
-            /* validate */
-            PSUPGETPAGINGMODE pReq = (PSUPGETPAGINGMODE)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_GET_PAGING_MODE);
-
-            /* execute */
-            pReq->Hdr.rc = VINF_SUCCESS;
-            pReq->u.Out.enmMode = SUPR0GetPagingMode();
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LOW_ALLOC):
-        {
-            /* validate */
-            PSUPLOWALLOC pReq = (PSUPLOWALLOC)pReqHdr;
-            REQ_CHECK_EXPR(SUP_IOCTL_LOW_ALLOC, pReq->Hdr.cbIn <= SUP_IOCTL_LOW_ALLOC_SIZE_IN);
-            REQ_CHECK_SIZES_EX(SUP_IOCTL_LOW_ALLOC, SUP_IOCTL_LOW_ALLOC_SIZE_IN, SUP_IOCTL_LOW_ALLOC_SIZE_OUT(pReq->u.In.cPages));
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0LowAlloc(pSession, pReq->u.In.cPages, &pReq->u.Out.pvR0, &pReq->u.Out.pvR3, &pReq->u.Out.aPages[0]);
-            if (RT_FAILURE(pReq->Hdr.rc))
-                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LOW_FREE):
-        {
-            /* validate */
-            PSUPLOWFREE pReq = (PSUPLOWFREE)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_LOW_FREE);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0LowFree(pSession, (RTHCUINTPTR)pReq->u.In.pvR3);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_GIP_MAP):
-        {
-            /* validate */
-            PSUPGIPMAP pReq = (PSUPGIPMAP)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_GIP_MAP);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0GipMap(pSession, &pReq->u.Out.pGipR3, &pReq->u.Out.HCPhysGip);
-            if (RT_SUCCESS(pReq->Hdr.rc))
-                pReq->u.Out.pGipR0 = pDevExt->pGip;
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_GIP_UNMAP):
-        {
-            /* validate */
-            PSUPGIPUNMAP pReq = (PSUPGIPUNMAP)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_GIP_UNMAP);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0GipUnmap(pSession);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_SET_VM_FOR_FAST):
-        {
-            /* validate */
-            PSUPSETVMFORFAST pReq = (PSUPSETVMFORFAST)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_SET_VM_FOR_FAST);
-            REQ_CHECK_EXPR_FMT(     !pReq->u.In.pVMR0
-                               ||   (   VALID_PTR(pReq->u.In.pVMR0)
-                                     && !((uintptr_t)pReq->u.In.pVMR0 & (PAGE_SIZE - 1))),
-                               ("SUP_IOCTL_SET_VM_FOR_FAST: pVMR0=%p!\n", pReq->u.In.pVMR0));
-            /* execute */
-            pSession->pVM = pReq->u.In.pVMR0;
-            pReq->Hdr.rc = VINF_SUCCESS;
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_ALLOC_EX):
-        {
-            /* validate */
-            PSUPPAGEALLOCEX pReq = (PSUPPAGEALLOCEX)pReqHdr;
-            REQ_CHECK_EXPR(SUP_IOCTL_PAGE_ALLOC_EX, pReq->Hdr.cbIn <= SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN);
-            REQ_CHECK_SIZES_EX(SUP_IOCTL_PAGE_ALLOC_EX, SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN, SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(pReq->u.In.cPages));
-            REQ_CHECK_EXPR_FMT(pReq->u.In.fKernelMapping || pReq->u.In.fUserMapping,
-                               ("SUP_IOCTL_PAGE_ALLOC_EX: No mapping requested!\n"));
-            REQ_CHECK_EXPR_FMT(pReq->u.In.fUserMapping,
-                               ("SUP_IOCTL_PAGE_ALLOC_EX: Must have user mapping!\n"));
-            REQ_CHECK_EXPR_FMT(!pReq->u.In.fReserved0 && !pReq->u.In.fReserved1,
-                               ("SUP_IOCTL_PAGE_ALLOC_EX: fReserved0=%d fReserved1=%d\n", pReq->u.In.fReserved0, pReq->u.In.fReserved1));
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0PageAllocEx(pSession, pReq->u.In.cPages, 0 /* fFlags */,
-                                            pReq->u.In.fUserMapping   ? &pReq->u.Out.pvR3 : NULL,
-                                            pReq->u.In.fKernelMapping ? &pReq->u.Out.pvR0 : NULL,
-                                            &pReq->u.Out.aPages[0]);
-            if (RT_FAILURE(pReq->Hdr.rc))
-                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_MAP_KERNEL):
-        {
-            /* validate */
-            PSUPPAGEMAPKERNEL pReq = (PSUPPAGEMAPKERNEL)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_PAGE_MAP_KERNEL);
-            REQ_CHECK_EXPR_FMT(!pReq->u.In.fFlags, ("SUP_IOCTL_PAGE_MAP_KERNEL: fFlags=%#x! MBZ\n", pReq->u.In.fFlags));
-            REQ_CHECK_EXPR_FMT(!(pReq->u.In.offSub & PAGE_OFFSET_MASK), ("SUP_IOCTL_PAGE_MAP_KERNEL: offSub=%#x\n", pReq->u.In.offSub));
-            REQ_CHECK_EXPR_FMT(pReq->u.In.cbSub && !(pReq->u.In.cbSub & PAGE_OFFSET_MASK),
-                               ("SUP_IOCTL_PAGE_MAP_KERNEL: cbSub=%#x\n", pReq->u.In.cbSub));
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0PageMapKernel(pSession, pReq->u.In.pvR3, pReq->u.In.offSub, pReq->u.In.cbSub,
-                                              pReq->u.In.fFlags, &pReq->u.Out.pvR0);
-            if (RT_FAILURE(pReq->Hdr.rc))
-                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_PROTECT):
-        {
-            /* validate */
-            PSUPPAGEPROTECT pReq = (PSUPPAGEPROTECT)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_PAGE_PROTECT);
-            REQ_CHECK_EXPR_FMT(!(pReq->u.In.fProt & ~(RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC | RTMEM_PROT_NONE)),
-                               ("SUP_IOCTL_PAGE_PROTECT: fProt=%#x!\n", pReq->u.In.fProt));
-            REQ_CHECK_EXPR_FMT(!(pReq->u.In.offSub & PAGE_OFFSET_MASK), ("SUP_IOCTL_PAGE_PROTECT: offSub=%#x\n", pReq->u.In.offSub));
-            REQ_CHECK_EXPR_FMT(pReq->u.In.cbSub && !(pReq->u.In.cbSub & PAGE_OFFSET_MASK),
-                               ("SUP_IOCTL_PAGE_PROTECT: cbSub=%#x\n", pReq->u.In.cbSub));
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0PageProtect(pSession, pReq->u.In.pvR3, pReq->u.In.pvR0, pReq->u.In.offSub, pReq->u.In.cbSub, pReq->u.In.fProt);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_FREE):
-        {
-            /* validate */
-            PSUPPAGEFREE pReq = (PSUPPAGEFREE)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_PAGE_FREE);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0PageFree(pSession, pReq->u.In.pvR3);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CALL_SERVICE(0)):
-        {
-            /* validate */
-            PSUPCALLSERVICE pReq = (PSUPCALLSERVICE)pReqHdr;
-            Log4(("SUP_IOCTL_CALL_SERVICE: op=%u in=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-                  pReq->u.In.uOperation, pReq->Hdr.cbIn, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-
-            if (pReq->Hdr.cbIn == SUP_IOCTL_CALL_SERVICE_SIZE(0))
-                REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_SERVICE, SUP_IOCTL_CALL_SERVICE_SIZE_IN(0), SUP_IOCTL_CALL_SERVICE_SIZE_OUT(0));
-            else
-            {
-                PSUPR0SERVICEREQHDR pSrvReq = (PSUPR0SERVICEREQHDR)&pReq->abReqPkt[0];
-                REQ_CHECK_EXPR_FMT(pReq->Hdr.cbIn >= SUP_IOCTL_CALL_SERVICE_SIZE(sizeof(SUPR0SERVICEREQHDR)),
-                                   ("SUP_IOCTL_CALL_SERVICE: cbIn=%#x < %#lx\n", pReq->Hdr.cbIn, SUP_IOCTL_CALL_SERVICE_SIZE(sizeof(SUPR0SERVICEREQHDR))));
-                REQ_CHECK_EXPR(SUP_IOCTL_CALL_SERVICE, pSrvReq->u32Magic == SUPR0SERVICEREQHDR_MAGIC);
-                REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_SERVICE, SUP_IOCTL_CALL_SERVICE_SIZE_IN(pSrvReq->cbReq), SUP_IOCTL_CALL_SERVICE_SIZE_OUT(pSrvReq->cbReq));
-            }
-            REQ_CHECK_EXPR(SUP_IOCTL_CALL_SERVICE, RTStrEnd(pReq->u.In.szName, sizeof(pReq->u.In.szName)));
-
-            /* execute */
-            pReq->Hdr.rc = supdrvIOCtl_CallServiceModule(pDevExt, pSession, pReq);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LOGGER_SETTINGS(0)):
-        {
-            /* validate */
-            PSUPLOGGERSETTINGS pReq = (PSUPLOGGERSETTINGS)pReqHdr;
-            size_t cbStrTab;
-            REQ_CHECK_SIZE_OUT(SUP_IOCTL_LOGGER_SETTINGS, SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT);
-            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->Hdr.cbIn >= SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(1));
-            cbStrTab = pReq->Hdr.cbIn - SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(0);
-            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offGroups      < cbStrTab);
-            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offFlags       < cbStrTab);
-            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offDestination < cbStrTab);
-            REQ_CHECK_EXPR_FMT(pReq->u.In.szStrings[cbStrTab - 1] == '\0',
-                               ("SUP_IOCTL_LOGGER_SETTINGS: cbIn=%#x cbStrTab=%#zx LastChar=%d\n",
-                                pReq->Hdr.cbIn, cbStrTab, pReq->u.In.szStrings[cbStrTab - 1]));
-            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.fWhich <= SUPLOGGERSETTINGS_WHICH_RELEASE);
-            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.fWhat  <= SUPLOGGERSETTINGS_WHAT_DESTROY);
-
-            /* execute */
-            pReq->Hdr.rc = supdrvIOCtl_LoggerSettings(pDevExt, pSession, pReq);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_SEM_OP2):
-        {
-            /* validate */
-            PSUPSEMOP2 pReq = (PSUPSEMOP2)pReqHdr;
-            REQ_CHECK_SIZES_EX(SUP_IOCTL_SEM_OP2, SUP_IOCTL_SEM_OP2_SIZE_IN, SUP_IOCTL_SEM_OP2_SIZE_OUT);
-            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP2, pReq->u.In.uReserved == 0);
-
-            /* execute */
-            switch (pReq->u.In.uType)
-            {
-                case SUP_SEM_TYPE_EVENT:
-                {
-                    SUPSEMEVENT hEvent = (SUPSEMEVENT)(uintptr_t)pReq->u.In.hSem;
-                    switch (pReq->u.In.uOp)
-                    {
-                        case SUPSEMOP2_WAIT_MS_REL:
-                            pReq->Hdr.rc = SUPSemEventWaitNoResume(pSession, hEvent, pReq->u.In.uArg.cRelMsTimeout);
-                            break;
-                        case SUPSEMOP2_WAIT_NS_ABS:
-                            pReq->Hdr.rc = SUPSemEventWaitNsAbsIntr(pSession, hEvent, pReq->u.In.uArg.uAbsNsTimeout);
-                            break;
-                        case SUPSEMOP2_WAIT_NS_REL:
-                            pReq->Hdr.rc = SUPSemEventWaitNsRelIntr(pSession, hEvent, pReq->u.In.uArg.cRelNsTimeout);
-                            break;
-                        case SUPSEMOP2_SIGNAL:
-                            pReq->Hdr.rc = SUPSemEventSignal(pSession, hEvent);
-                            break;
-                        case SUPSEMOP2_CLOSE:
-                            pReq->Hdr.rc = SUPSemEventClose(pSession, hEvent);
-                            break;
-                        case SUPSEMOP2_RESET:
-                        default:
-                            pReq->Hdr.rc = VERR_INVALID_FUNCTION;
-                            break;
-                    }
-                    break;
-                }
-
-                case SUP_SEM_TYPE_EVENT_MULTI:
-                {
-                    SUPSEMEVENTMULTI hEventMulti = (SUPSEMEVENTMULTI)(uintptr_t)pReq->u.In.hSem;
-                    switch (pReq->u.In.uOp)
-                    {
-                        case SUPSEMOP2_WAIT_MS_REL:
-                            pReq->Hdr.rc = SUPSemEventMultiWaitNoResume(pSession, hEventMulti, pReq->u.In.uArg.cRelMsTimeout);
-                            break;
-                        case SUPSEMOP2_WAIT_NS_ABS:
-                            pReq->Hdr.rc = SUPSemEventMultiWaitNsAbsIntr(pSession, hEventMulti, pReq->u.In.uArg.uAbsNsTimeout);
-                            break;
-                        case SUPSEMOP2_WAIT_NS_REL:
-                            pReq->Hdr.rc = SUPSemEventMultiWaitNsRelIntr(pSession, hEventMulti, pReq->u.In.uArg.cRelNsTimeout);
-                            break;
-                        case SUPSEMOP2_SIGNAL:
-                            pReq->Hdr.rc = SUPSemEventMultiSignal(pSession, hEventMulti);
-                            break;
-                        case SUPSEMOP2_CLOSE:
-                            pReq->Hdr.rc = SUPSemEventMultiClose(pSession, hEventMulti);
-                            break;
-                        case SUPSEMOP2_RESET:
-                            pReq->Hdr.rc = SUPSemEventMultiReset(pSession, hEventMulti);
-                            break;
-                        default:
-                            pReq->Hdr.rc = VERR_INVALID_FUNCTION;
-                            break;
-                    }
-                    break;
-                }
-
-                default:
-                    pReq->Hdr.rc = VERR_INVALID_PARAMETER;
-                    break;
-            }
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_SEM_OP3):
-        {
-            /* validate */
-            PSUPSEMOP3 pReq = (PSUPSEMOP3)pReqHdr;
-            REQ_CHECK_SIZES_EX(SUP_IOCTL_SEM_OP3, SUP_IOCTL_SEM_OP3_SIZE_IN, SUP_IOCTL_SEM_OP3_SIZE_OUT);
-            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, pReq->u.In.u32Reserved == 0 && pReq->u.In.u64Reserved == 0);
-
-            /* execute */
-            switch (pReq->u.In.uType)
-            {
-                case SUP_SEM_TYPE_EVENT:
-                {
-                    SUPSEMEVENT hEvent = (SUPSEMEVENT)(uintptr_t)pReq->u.In.hSem;
-                    switch (pReq->u.In.uOp)
-                    {
-                        case SUPSEMOP3_CREATE:
-                            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, hEvent == NIL_SUPSEMEVENT);
-                            pReq->Hdr.rc = SUPSemEventCreate(pSession, &hEvent);
-                            pReq->u.Out.hSem = (uint32_t)(uintptr_t)hEvent;
-                            break;
-                        case SUPSEMOP3_GET_RESOLUTION:
-                            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, hEvent == NIL_SUPSEMEVENT);
-                            pReq->Hdr.rc = VINF_SUCCESS;
-                            pReq->Hdr.cbOut = sizeof(*pReq);
-                            pReq->u.Out.cNsResolution = SUPSemEventGetResolution(pSession);
-                            break;
-                        default:
-                            pReq->Hdr.rc = VERR_INVALID_FUNCTION;
-                            break;
-                    }
-                    break;
-                }
-
-                case SUP_SEM_TYPE_EVENT_MULTI:
-                {
-                    SUPSEMEVENTMULTI hEventMulti = (SUPSEMEVENTMULTI)(uintptr_t)pReq->u.In.hSem;
-                    switch (pReq->u.In.uOp)
-                    {
-                        case SUPSEMOP3_CREATE:
-                            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, hEventMulti == NIL_SUPSEMEVENTMULTI);
-                            pReq->Hdr.rc = SUPSemEventMultiCreate(pSession, &hEventMulti);
-                            pReq->u.Out.hSem = (uint32_t)(uintptr_t)hEventMulti;
-                            break;
-                        case SUPSEMOP3_GET_RESOLUTION:
-                            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, hEventMulti == NIL_SUPSEMEVENTMULTI);
-                            pReq->Hdr.rc = VINF_SUCCESS;
-                            pReq->u.Out.cNsResolution = SUPSemEventMultiGetResolution(pSession);
-                            break;
-                        default:
-                            pReq->Hdr.rc = VERR_INVALID_FUNCTION;
-                            break;
-                    }
-                    break;
-                }
-
-                default:
-                    pReq->Hdr.rc = VERR_INVALID_PARAMETER;
-                    break;
-            }
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_VT_CAPS):
-        {
-            /* validate */
-            PSUPVTCAPS pReq = (PSUPVTCAPS)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_VT_CAPS);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0QueryVTCaps(pSession, &pReq->u.Out.Caps);
-            if (RT_FAILURE(pReq->Hdr.rc))
-                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_OPEN):
-        {
-            /* validate */
-            PSUPTRACEROPEN pReq = (PSUPTRACEROPEN)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_OPEN);
-
-            /* execute */
-            pReq->Hdr.rc = supdrvIOCtl_TracerOpen(pDevExt, pSession, pReq->u.In.uCookie, pReq->u.In.uArg);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_CLOSE):
-        {
-            /* validate */
-            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_CLOSE);
-
-            /* execute */
-            pReqHdr->rc = supdrvIOCtl_TracerClose(pDevExt, pSession);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_IOCTL):
-        {
-            /* validate */
-            PSUPTRACERIOCTL pReq = (PSUPTRACERIOCTL)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_IOCTL);
-
-            /* execute */
-            pReqHdr->rc = supdrvIOCtl_TracerIOCtl(pDevExt, pSession, pReq->u.In.uCmd, pReq->u.In.uArg, &pReq->u.Out.iRetVal);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_UMOD_REG):
-        {
-            /* validate */
-            PSUPTRACERUMODREG pReq = (PSUPTRACERUMODREG)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_UMOD_REG);
-            if (!RTStrEnd(pReq->u.In.szName, sizeof(pReq->u.In.szName)))
-                return VERR_INVALID_PARAMETER;
-
-            /* execute */
-            pReqHdr->rc = supdrvIOCtl_TracerUmodRegister(pDevExt, pSession,
-                                                         pReq->u.In.R3PtrVtgHdr, pReq->u.In.uVtgHdrAddr,
-                                                         pReq->u.In.R3PtrStrTab, pReq->u.In.cbStrTab,
-                                                         pReq->u.In.szName, pReq->u.In.fFlags);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_UMOD_DEREG):
-        {
-            /* validate */
-            PSUPTRACERUMODDEREG pReq = (PSUPTRACERUMODDEREG)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_UMOD_DEREG);
-
-            /* execute */
-            pReqHdr->rc = supdrvIOCtl_TracerUmodDeregister(pDevExt, pSession, pReq->u.In.pVtgHdr);
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_UMOD_FIRE_PROBE):
-        {
-            /* validate */
-            PSUPTRACERUMODFIREPROBE pReq = (PSUPTRACERUMODFIREPROBE)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_UMOD_FIRE_PROBE);
-
-            supdrvIOCtl_TracerUmodProbeFire(pDevExt, pSession, &pReq->u.In);
-            pReqHdr->rc = VINF_SUCCESS;
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_RESUME_SUSPENDED_KBDS):
-        {
-            /* validate */
-            REQ_CHECK_SIZES(SUP_IOCTL_RESUME_SUSPENDED_KBDS);
-
-            pReqHdr->rc = supdrvIOCtl_ResumeSuspendedKbds();
-            return 0;
-        }
-
-        default:
-            Log(("Unknown IOCTL %#lx\n", (long)uIOCtl));
-            break;
-    }
-    return VERR_GENERAL_FAILURE;
-}
-
-
-/**
- * I/O Control inner worker for the restricted operations.
- *
- * @returns IPRT status code.
- * @retval  VERR_INVALID_PARAMETER if the request is invalid.
- *
- * @param   uIOCtl      Function number.
- * @param   pDevExt     Device extention.
- * @param   pSession    Session data.
- * @param   pReqHdr     The request header.
- */
-static int supdrvIOCtlInnerRestricted(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr)
-{
-    /*
-     * The switch.
-     */
-    switch (SUP_CTL_CODE_NO_SIZE(uIOCtl))
-    {
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_COOKIE):
-        {
-            PSUPCOOKIE pReq = (PSUPCOOKIE)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_COOKIE);
-            if (strncmp(pReq->u.In.szMagic, SUPCOOKIE_MAGIC, sizeof(pReq->u.In.szMagic)))
-            {
-                OSDBGPRINT(("SUP_IOCTL_COOKIE: invalid magic %.16s\n", pReq->u.In.szMagic));
-                pReq->Hdr.rc = VERR_INVALID_MAGIC;
-                return 0;
-            }
-
-            /*
-             * Match the version.
-             * The current logic is very simple, match the major interface version.
-             */
-            if (    pReq->u.In.u32MinVersion > SUPDRV_IOC_VERSION
-                ||  (pReq->u.In.u32MinVersion & 0xffff0000) != (SUPDRV_IOC_VERSION & 0xffff0000))
-            {
-                OSDBGPRINT(("SUP_IOCTL_COOKIE: Version mismatch. Requested: %#x  Min: %#x  Current: %#x\n",
-                            pReq->u.In.u32ReqVersion, pReq->u.In.u32MinVersion, SUPDRV_IOC_VERSION));
-                pReq->u.Out.u32Cookie         = 0xffffffff;
-                pReq->u.Out.u32SessionCookie  = 0xffffffff;
-                pReq->u.Out.u32SessionVersion = 0xffffffff;
-                pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
-                pReq->u.Out.pSession          = NULL;
-                pReq->u.Out.cFunctions        = 0;
-                pReq->Hdr.rc = VERR_VERSION_MISMATCH;
-                return 0;
-            }
-
-            /*
-             * Fill in return data and be gone.
-             * N.B. The first one to change SUPDRV_IOC_VERSION shall makes sure that
-             *      u32SessionVersion <= u32ReqVersion!
-             */
-            /** @todo Somehow validate the client and negotiate a secure cookie... */
-            pReq->u.Out.u32Cookie         = pDevExt->u32Cookie;
-            pReq->u.Out.u32SessionCookie  = pSession->u32Cookie;
-            pReq->u.Out.u32SessionVersion = SUPDRV_IOC_VERSION;
-            pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
-            pReq->u.Out.pSession          = pSession;
-            pReq->u.Out.cFunctions        = 0;
-            pReq->Hdr.rc = VINF_SUCCESS;
-            return 0;
-        }
-
-        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_VT_CAPS):
-        {
-            /* validate */
-            PSUPVTCAPS pReq = (PSUPVTCAPS)pReqHdr;
-            REQ_CHECK_SIZES(SUP_IOCTL_VT_CAPS);
-
-            /* execute */
-            pReq->Hdr.rc = SUPR0QueryVTCaps(pSession, &pReq->u.Out.Caps);
-            if (RT_FAILURE(pReq->Hdr.rc))
-                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
-            return 0;
-        }
-
-        default:
-            Log(("Unknown IOCTL %#lx\n", (long)uIOCtl));
-            break;
-    }
-    return VERR_GENERAL_FAILURE;
-}
-
-
-/**
- * I/O Control worker.
- *
- * @returns IPRT status code.
- * @retval  VERR_INVALID_PARAMETER if the request is invalid.
- *
- * @param   uIOCtl      Function number.
- * @param   pDevExt     Device extention.
- * @param   pSession    Session data.
- * @param   pReqHdr     The request header.
- */
-int VBOXCALL supdrvIOCtl(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr, size_t cbReq)
-{
-    int rc;
-    VBOXDRV_IOCTL_ENTRY(pSession, uIOCtl, pReqHdr);
-
-    /*
-     * Validate the request.
-     */
-    if (RT_UNLIKELY(cbReq < sizeof(*pReqHdr)))
-    {
-        OSDBGPRINT(("vboxdrv: Bad ioctl request size; cbReq=%#lx\n", (long)cbReq));
-        VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
-        return VERR_INVALID_PARAMETER;
-    }
-    if (RT_UNLIKELY(   (pReqHdr->fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC
-                    || pReqHdr->cbIn < sizeof(*pReqHdr)
-                    || pReqHdr->cbIn > cbReq
-                    || pReqHdr->cbOut < sizeof(*pReqHdr)
-                    || pReqHdr->cbOut > cbReq))
-    {
-        OSDBGPRINT(("vboxdrv: Bad ioctl request header; cbIn=%#lx cbOut=%#lx fFlags=%#lx\n",
-                    (long)pReqHdr->cbIn, (long)pReqHdr->cbOut, (long)pReqHdr->fFlags));
-        VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
-        return VERR_INVALID_PARAMETER;
-    }
-    if (RT_UNLIKELY(!RT_VALID_PTR(pSession)))
-    {
-        OSDBGPRINT(("vboxdrv: Invalid pSession valud %p (ioctl=%p)\n", pSession, (void *)uIOCtl));
-        VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
-        return VERR_INVALID_PARAMETER;
-    }
-    if (RT_UNLIKELY(uIOCtl == SUP_IOCTL_COOKIE))
-    {
-        if (pReqHdr->u32Cookie != SUPCOOKIE_INITIAL_COOKIE)
-        {
-            OSDBGPRINT(("SUP_IOCTL_COOKIE: bad cookie %#lx\n", (long)pReqHdr->u32Cookie));
-            VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
-            return VERR_INVALID_PARAMETER;
-        }
-    }
-    else if (RT_UNLIKELY(    pReqHdr->u32Cookie != pDevExt->u32Cookie
-                         ||  pReqHdr->u32SessionCookie != pSession->u32Cookie))
-    {
-        OSDBGPRINT(("vboxdrv: bad cookie %#lx / %#lx.\n", (long)pReqHdr->u32Cookie, (long)pReqHdr->u32SessionCookie));
-        VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
-        return VERR_INVALID_PARAMETER;
-    }
-
-    /*
-     * Hand it to an inner function to avoid lots of unnecessary return tracepoints.
-     */
-    if (pSession->fUnrestricted)
-        rc = supdrvIOCtlInnerUnrestricted(uIOCtl, pDevExt, pSession, pReqHdr);
-    else
-        rc = supdrvIOCtlInnerRestricted(uIOCtl, pDevExt, pSession, pReqHdr);
-
-    VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, pReqHdr->rc, rc);
-    return rc;
-}
-
-
-/**
- * Inter-Driver Communication (IDC) worker.
- *
- * @returns VBox status code.
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_INVALID_PARAMETER if the request is invalid.
- * @retval  VERR_NOT_SUPPORTED if the request isn't supported.
- *
- * @param   uReq        The request (function) code.
- * @param   pDevExt     Device extention.
- * @param   pSession    Session data.
- * @param   pReqHdr     The request header.
- */
-int VBOXCALL supdrvIDC(uintptr_t uReq, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQHDR pReqHdr)
-{
-    /*
-     * The OS specific code has already validated the pSession
-     * pointer, and the request size being greater or equal to
-     * size of the header.
-     *
-     * So, just check that pSession is a kernel context session.
-     */
-    if (RT_UNLIKELY(    pSession
-                    &&  pSession->R0Process != NIL_RTR0PROCESS))
-        return VERR_INVALID_PARAMETER;
-
-/*
- * Validation macro.
- */
-#define REQ_CHECK_IDC_SIZE(Name, cbExpect) \
-    do { \
-        if (RT_UNLIKELY(pReqHdr->cb != (cbExpect))) \
-        { \
-            OSDBGPRINT(( #Name ": Invalid input/output sizes. cb=%ld expected %ld.\n", \
-                        (long)pReqHdr->cb, (long)(cbExpect))); \
-            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
-        } \
-    } while (0)
-
-    switch (uReq)
-    {
-        case SUPDRV_IDC_REQ_CONNECT:
-        {
-            PSUPDRVIDCREQCONNECT pReq = (PSUPDRVIDCREQCONNECT)pReqHdr;
-            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_CONNECT, sizeof(*pReq));
-
-            /*
-             * Validate the cookie and other input.
-             */
-            if (pReq->Hdr.pSession != NULL)
-            {
-                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: Hdr.pSession=%p expected NULL!\n", pReq->Hdr.pSession));
-                return pReqHdr->rc = VERR_INVALID_PARAMETER;
-            }
-            if (pReq->u.In.u32MagicCookie != SUPDRVIDCREQ_CONNECT_MAGIC_COOKIE)
-            {
-                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: u32MagicCookie=%#x expected %#x!\n",
-                            (unsigned)pReq->u.In.u32MagicCookie, (unsigned)SUPDRVIDCREQ_CONNECT_MAGIC_COOKIE));
-                return pReqHdr->rc = VERR_INVALID_PARAMETER;
-            }
-            if (    pReq->u.In.uMinVersion > pReq->u.In.uReqVersion
-                ||  (pReq->u.In.uMinVersion & UINT32_C(0xffff0000)) != (pReq->u.In.uReqVersion & UINT32_C(0xffff0000)))
-            {
-                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: uMinVersion=%#x uMaxVersion=%#x doesn't match!\n",
-                            pReq->u.In.uMinVersion, pReq->u.In.uReqVersion));
-                return pReqHdr->rc = VERR_INVALID_PARAMETER;
-            }
-            if (pSession != NULL)
-            {
-                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: pSession=%p expected NULL!\n", pSession));
-                return pReqHdr->rc = VERR_INVALID_PARAMETER;
-            }
-
-            /*
-             * Match the version.
-             * The current logic is very simple, match the major interface version.
-             */
-            if (    pReq->u.In.uMinVersion > SUPDRV_IDC_VERSION
-                ||  (pReq->u.In.uMinVersion & 0xffff0000) != (SUPDRV_IDC_VERSION & 0xffff0000))
-            {
-                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: Version mismatch. Requested: %#x  Min: %#x  Current: %#x\n",
-                            pReq->u.In.uReqVersion, pReq->u.In.uMinVersion, (unsigned)SUPDRV_IDC_VERSION));
-                pReq->u.Out.pSession        = NULL;
-                pReq->u.Out.uSessionVersion = 0xffffffff;
-                pReq->u.Out.uDriverVersion  = SUPDRV_IDC_VERSION;
-                pReq->u.Out.uDriverRevision = VBOX_SVN_REV;
-                pReq->Hdr.rc = VERR_VERSION_MISMATCH;
-                return VINF_SUCCESS;
-            }
-
-            pReq->u.Out.pSession        = NULL;
-            pReq->u.Out.uSessionVersion = SUPDRV_IDC_VERSION;
-            pReq->u.Out.uDriverVersion  = SUPDRV_IDC_VERSION;
-            pReq->u.Out.uDriverRevision = VBOX_SVN_REV;
-
-            pReq->Hdr.rc = supdrvCreateSession(pDevExt, false /* fUser */, true /*fUnrestricted*/, &pSession);
-            if (RT_FAILURE(pReq->Hdr.rc))
-            {
-                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: failed to create session, rc=%d\n", pReq->Hdr.rc));
-                return VINF_SUCCESS;
-            }
-
-            pReq->u.Out.pSession = pSession;
-            pReq->Hdr.pSession = pSession;
-
-            return VINF_SUCCESS;
-        }
-
-        case SUPDRV_IDC_REQ_DISCONNECT:
-        {
-            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_DISCONNECT, sizeof(*pReqHdr));
-
-            supdrvSessionRelease(pSession);
-            return pReqHdr->rc = VINF_SUCCESS;
-        }
-
-        case SUPDRV_IDC_REQ_GET_SYMBOL:
-        {
-            PSUPDRVIDCREQGETSYM pReq = (PSUPDRVIDCREQGETSYM)pReqHdr;
-            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_GET_SYMBOL, sizeof(*pReq));
-
-            pReq->Hdr.rc = supdrvIDC_LdrGetSymbol(pDevExt, pSession, pReq);
-            return VINF_SUCCESS;
-        }
-
-        case SUPDRV_IDC_REQ_COMPONENT_REGISTER_FACTORY:
-        {
-            PSUPDRVIDCREQCOMPREGFACTORY pReq = (PSUPDRVIDCREQCOMPREGFACTORY)pReqHdr;
-            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_COMPONENT_REGISTER_FACTORY, sizeof(*pReq));
-
-            pReq->Hdr.rc = SUPR0ComponentRegisterFactory(pSession, pReq->u.In.pFactory);
-            return VINF_SUCCESS;
-        }
-
-        case SUPDRV_IDC_REQ_COMPONENT_DEREGISTER_FACTORY:
-        {
-            PSUPDRVIDCREQCOMPDEREGFACTORY pReq = (PSUPDRVIDCREQCOMPDEREGFACTORY)pReqHdr;
-            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_COMPONENT_DEREGISTER_FACTORY, sizeof(*pReq));
-
-            pReq->Hdr.rc = SUPR0ComponentDeregisterFactory(pSession, pReq->u.In.pFactory);
-            return VINF_SUCCESS;
-        }
-
-        default:
-            Log(("Unknown IDC %#lx\n", (long)uReq));
-            break;
-    }
-
-#undef REQ_CHECK_IDC_SIZE
-    return VERR_NOT_SUPPORTED;
-}
-
-
-/**
- * Register a object for reference counting.
- * The object is registered with one reference in the specified session.
- *
- * @returns Unique identifier on success (pointer).
- *          All future reference must use this identifier.
- * @returns NULL on failure.
- * @param   pfnDestructor   The destructore function which will be called when the reference count reaches 0.
- * @param   pvUser1         The first user argument.
- * @param   pvUser2         The second user argument.
- */
-SUPR0DECL(void *) SUPR0ObjRegister(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2)
-{
-    PSUPDRVDEVEXT   pDevExt     = pSession->pDevExt;
-    PSUPDRVOBJ      pObj;
-    PSUPDRVUSAGE    pUsage;
-
-    /*
-     * Validate the input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), NULL);
-    AssertReturn(enmType > SUPDRVOBJTYPE_INVALID && enmType < SUPDRVOBJTYPE_END, NULL);
-    AssertPtrReturn(pfnDestructor, NULL);
-
-    /*
-     * Allocate and initialize the object.
-     */
-    pObj = (PSUPDRVOBJ)RTMemAlloc(sizeof(*pObj));
-    if (!pObj)
-        return NULL;
-    pObj->u32Magic      = SUPDRVOBJ_MAGIC;
-    pObj->enmType       = enmType;
-    pObj->pNext         = NULL;
-    pObj->cUsage        = 1;
-    pObj->pfnDestructor = pfnDestructor;
-    pObj->pvUser1       = pvUser1;
-    pObj->pvUser2       = pvUser2;
-    pObj->CreatorUid    = pSession->Uid;
-    pObj->CreatorGid    = pSession->Gid;
-    pObj->CreatorProcess= pSession->Process;
-    supdrvOSObjInitCreator(pObj, pSession);
-
-    /*
-     * Allocate the usage record.
-     * (We keep freed usage records around to simplify SUPR0ObjAddRefEx().)
-     */
-    RTSpinlockAcquire(pDevExt->Spinlock);
-
-    pUsage = pDevExt->pUsageFree;
-    if (pUsage)
-        pDevExt->pUsageFree = pUsage->pNext;
-    else
-    {
-        RTSpinlockRelease(pDevExt->Spinlock);
-        pUsage = (PSUPDRVUSAGE)RTMemAlloc(sizeof(*pUsage));
-        if (!pUsage)
-        {
-            RTMemFree(pObj);
-            return NULL;
-        }
-        RTSpinlockAcquire(pDevExt->Spinlock);
-    }
-
-    /*
-     * Insert the object and create the session usage record.
-     */
-    /* The object. */
-    pObj->pNext         = pDevExt->pObjs;
-    pDevExt->pObjs      = pObj;
-
-    /* The session record. */
-    pUsage->cUsage      = 1;
-    pUsage->pObj        = pObj;
-    pUsage->pNext       = pSession->pUsage;
-    /* Log2(("SUPR0ObjRegister: pUsage=%p:{.pObj=%p, .pNext=%p}\n", pUsage, pUsage->pObj, pUsage->pNext)); */
-    pSession->pUsage    = pUsage;
-
-    RTSpinlockRelease(pDevExt->Spinlock);
-
-    Log(("SUPR0ObjRegister: returns %p (pvUser1=%p, pvUser=%p)\n", pObj, pvUser1, pvUser2));
-    return pObj;
-}
-
-
-/**
- * Increment the reference counter for the object associating the reference
- * with the specified session.
- *
- * @returns IPRT status code.
- * @param   pvObj           The identifier returned by SUPR0ObjRegister().
- * @param   pSession        The session which is referencing the object.
- *
- * @remarks The caller should not own any spinlocks and must carefully protect
- *          itself against potential race with the destructor so freed memory
- *          isn't accessed here.
- */
-SUPR0DECL(int) SUPR0ObjAddRef(void *pvObj, PSUPDRVSESSION pSession)
-{
-    return SUPR0ObjAddRefEx(pvObj, pSession, false /* fNoBlocking */);
-}
-
-
-/**
- * Increment the reference counter for the object associating the reference
- * with the specified session.
- *
- * @returns IPRT status code.
- * @retval  VERR_TRY_AGAIN if fNoBlocking was set and a new usage record
- *          couldn't be allocated. (If you see this you're not doing the right
- *          thing and it won't ever work reliably.)
- *
- * @param   pvObj           The identifier returned by SUPR0ObjRegister().
- * @param   pSession        The session which is referencing the object.
- * @param   fNoBlocking     Set if it's not OK to block. Never try to make the
- *                          first reference to an object in a session with this
- *                          argument set.
- *
- * @remarks The caller should not own any spinlocks and must carefully protect
- *          itself against potential race with the destructor so freed memory
- *          isn't accessed here.
- */
-SUPR0DECL(int) SUPR0ObjAddRefEx(void *pvObj, PSUPDRVSESSION pSession, bool fNoBlocking)
-{
-    PSUPDRVDEVEXT   pDevExt     = pSession->pDevExt;
-    PSUPDRVOBJ      pObj        = (PSUPDRVOBJ)pvObj;
-    int             rc          = VINF_SUCCESS;
-    PSUPDRVUSAGE    pUsagePre;
-    PSUPDRVUSAGE    pUsage;
-
-    /*
-     * Validate the input.
-     * Be ready for the destruction race (someone might be stuck in the
-     * destructor waiting a lock we own).
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrReturn(pObj, VERR_INVALID_POINTER);
-    AssertMsgReturn(pObj->u32Magic == SUPDRVOBJ_MAGIC || pObj->u32Magic == SUPDRVOBJ_MAGIC_DEAD,
-                    ("Invalid pvObj=%p magic=%#x (expected %#x or %#x)\n", pvObj, pObj->u32Magic, SUPDRVOBJ_MAGIC, SUPDRVOBJ_MAGIC_DEAD),
-                    VERR_INVALID_PARAMETER);
-
-    RTSpinlockAcquire(pDevExt->Spinlock);
-
-    if (RT_UNLIKELY(pObj->u32Magic != SUPDRVOBJ_MAGIC))
-    {
-        RTSpinlockRelease(pDevExt->Spinlock);
-
-        AssertMsgFailed(("pvObj=%p magic=%#x\n", pvObj, pObj->u32Magic));
-        return VERR_WRONG_ORDER;
-    }
-
-    /*
-     * Preallocate the usage record if we can.
-     */
-    pUsagePre = pDevExt->pUsageFree;
-    if (pUsagePre)
-        pDevExt->pUsageFree = pUsagePre->pNext;
-    else if (!fNoBlocking)
-    {
-        RTSpinlockRelease(pDevExt->Spinlock);
-        pUsagePre = (PSUPDRVUSAGE)RTMemAlloc(sizeof(*pUsagePre));
-        if (!pUsagePre)
-            return VERR_NO_MEMORY;
-
-        RTSpinlockAcquire(pDevExt->Spinlock);
-        if (RT_UNLIKELY(pObj->u32Magic != SUPDRVOBJ_MAGIC))
-        {
-            RTSpinlockRelease(pDevExt->Spinlock);
-
-            AssertMsgFailed(("pvObj=%p magic=%#x\n", pvObj, pObj->u32Magic));
-            return VERR_WRONG_ORDER;
-        }
-    }
-
-    /*
-     * Reference the object.
-     */
-    pObj->cUsage++;
-
-    /*
-     * Look for the session record.
-     */
-    for (pUsage = pSession->pUsage; pUsage; pUsage = pUsage->pNext)
-    {
-        /*Log(("SUPR0AddRef: pUsage=%p:{.pObj=%p, .pNext=%p}\n", pUsage, pUsage->pObj, pUsage->pNext));*/
-        if (pUsage->pObj == pObj)
-            break;
-    }
-    if (pUsage)
-        pUsage->cUsage++;
-    else if (pUsagePre)
-    {
-        /* create a new session record. */
-        pUsagePre->cUsage   = 1;
-        pUsagePre->pObj     = pObj;
-        pUsagePre->pNext    = pSession->pUsage;
-        pSession->pUsage    = pUsagePre;
-        /*Log(("SUPR0AddRef: pUsagePre=%p:{.pObj=%p, .pNext=%p}\n", pUsagePre, pUsagePre->pObj, pUsagePre->pNext));*/
-
-        pUsagePre = NULL;
-    }
-    else
-    {
-        pObj->cUsage--;
-        rc = VERR_TRY_AGAIN;
-    }
-
-    /*
-     * Put any unused usage record into the free list..
-     */
-    if (pUsagePre)
-    {
-        pUsagePre->pNext = pDevExt->pUsageFree;
-        pDevExt->pUsageFree = pUsagePre;
-    }
-
-    RTSpinlockRelease(pDevExt->Spinlock);
-
-    return rc;
-}
-
-
-/**
- * Decrement / destroy a reference counter record for an object.
- *
- * The object is uniquely identified by pfnDestructor+pvUser1+pvUser2.
- *
- * @returns IPRT status code.
- * @retval  VINF_SUCCESS if not destroyed.
- * @retval  VINF_OBJECT_DESTROYED if it's destroyed by this release call.
- * @retval  VERR_INVALID_PARAMETER if the object isn't valid. Will assert in
- *          string builds.
- *
- * @param   pvObj           The identifier returned by SUPR0ObjRegister().
- * @param   pSession        The session which is referencing the object.
- */
-SUPR0DECL(int) SUPR0ObjRelease(void *pvObj, PSUPDRVSESSION pSession)
-{
-    PSUPDRVDEVEXT       pDevExt     = pSession->pDevExt;
-    PSUPDRVOBJ          pObj        = (PSUPDRVOBJ)pvObj;
-    int                 rc          = VERR_INVALID_PARAMETER;
-    PSUPDRVUSAGE        pUsage;
-    PSUPDRVUSAGE        pUsagePrev;
-
-    /*
-     * Validate the input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertMsgReturn(VALID_PTR(pObj) && pObj->u32Magic == SUPDRVOBJ_MAGIC,
-                    ("Invalid pvObj=%p magic=%#x (exepcted %#x)\n", pvObj, pObj ? pObj->u32Magic : 0, SUPDRVOBJ_MAGIC),
-                    VERR_INVALID_PARAMETER);
-
-    /*
-     * Acquire the spinlock and look for the usage record.
-     */
-    RTSpinlockAcquire(pDevExt->Spinlock);
-
-    for (pUsagePrev = NULL, pUsage = pSession->pUsage;
-         pUsage;
-         pUsagePrev = pUsage, pUsage = pUsage->pNext)
-    {
-        /*Log2(("SUPR0ObjRelease: pUsage=%p:{.pObj=%p, .pNext=%p}\n", pUsage, pUsage->pObj, pUsage->pNext));*/
-        if (pUsage->pObj == pObj)
-        {
-            rc = VINF_SUCCESS;
-            AssertMsg(pUsage->cUsage >= 1 && pObj->cUsage >= pUsage->cUsage, ("glob %d; sess %d\n", pObj->cUsage, pUsage->cUsage));
-            if (pUsage->cUsage > 1)
-            {
-                pObj->cUsage--;
-                pUsage->cUsage--;
-            }
-            else
-            {
-                /*
-                 * Free the session record.
-                 */
-                if (pUsagePrev)
-                    pUsagePrev->pNext = pUsage->pNext;
-                else
-                    pSession->pUsage = pUsage->pNext;
-                pUsage->pNext = pDevExt->pUsageFree;
-                pDevExt->pUsageFree = pUsage;
-
-                /* What about the object? */
-                if (pObj->cUsage > 1)
-                    pObj->cUsage--;
-                else
-                {
-                    /*
-                     * Object is to be destroyed, unlink it.
-                     */
-                    pObj->u32Magic = SUPDRVOBJ_MAGIC_DEAD;
-                    rc = VINF_OBJECT_DESTROYED;
-                    if (pDevExt->pObjs == pObj)
-                        pDevExt->pObjs = pObj->pNext;
-                    else
-                    {
-                        PSUPDRVOBJ pObjPrev;
-                        for (pObjPrev = pDevExt->pObjs; pObjPrev; pObjPrev = pObjPrev->pNext)
-                            if (pObjPrev->pNext == pObj)
-                            {
-                                pObjPrev->pNext = pObj->pNext;
-                                break;
-                            }
-                        Assert(pObjPrev);
-                    }
-                }
-            }
-            break;
-        }
-    }
-
-    RTSpinlockRelease(pDevExt->Spinlock);
-
-    /*
-     * Call the destructor and free the object if required.
-     */
-    if (rc == VINF_OBJECT_DESTROYED)
-    {
-        Log(("SUPR0ObjRelease: destroying %p/%d (%p/%p) cpid=%RTproc pid=%RTproc dtor=%p\n",
-             pObj, pObj->enmType, pObj->pvUser1, pObj->pvUser2, pObj->CreatorProcess, RTProcSelf(), pObj->pfnDestructor));
-        if (pObj->pfnDestructor)
-            pObj->pfnDestructor(pObj, pObj->pvUser1, pObj->pvUser2);
-        RTMemFree(pObj);
-    }
-
-    AssertMsg(pUsage, ("pvObj=%p\n", pvObj));
-    return rc;
-}
-
-
-/**
- * Verifies that the current process can access the specified object.
- *
- * @returns The following IPRT status code:
- * @retval  VINF_SUCCESS if access was granted.
- * @retval  VERR_PERMISSION_DENIED if denied access.
- * @retval  VERR_INVALID_PARAMETER if invalid parameter.
- *
- * @param   pvObj           The identifier returned by SUPR0ObjRegister().
- * @param   pSession        The session which wishes to access the object.
- * @param   pszObjName      Object string name. This is optional and depends on the object type.
- *
- * @remark  The caller is responsible for making sure the object isn't removed while
- *          we're inside this function. If uncertain about this, just call AddRef before calling us.
- */
-SUPR0DECL(int) SUPR0ObjVerifyAccess(void *pvObj, PSUPDRVSESSION pSession, const char *pszObjName)
-{
-    PSUPDRVOBJ  pObj = (PSUPDRVOBJ)pvObj;
-    int         rc;
-
-    /*
-     * Validate the input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertMsgReturn(VALID_PTR(pObj) && pObj->u32Magic == SUPDRVOBJ_MAGIC,
-                    ("Invalid pvObj=%p magic=%#x (exepcted %#x)\n", pvObj, pObj ? pObj->u32Magic : 0, SUPDRVOBJ_MAGIC),
-                    VERR_INVALID_PARAMETER);
-
-    /*
-     * Check access. (returns true if a decision has been made.)
-     */
-    rc = VERR_INTERNAL_ERROR;
-    if (supdrvOSObjCanAccess(pObj, pSession, pszObjName, &rc))
-        return rc;
-
-    /*
-     * Default policy is to allow the user to access his own
-     * stuff but nothing else.
-     */
-    if (pObj->CreatorUid == pSession->Uid)
-        return VINF_SUCCESS;
-    return VERR_PERMISSION_DENIED;
-}
-
-
-/**
- * Lock pages.
- *
- * @returns IPRT status code.
- * @param   pSession    Session to which the locked memory should be associated.
- * @param   pvR3        Start of the memory range to lock.
- *                      This must be page aligned.
- * @param   cPages      Number of pages to lock.
- * @param   paPages     Where to put the physical addresses of locked memory.
- */
-SUPR0DECL(int) SUPR0LockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages)
-{
-    int             rc;
-    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
-    const size_t    cb = (size_t)cPages << PAGE_SHIFT;
-    LogFlow(("SUPR0LockMem: pSession=%p pvR3=%p cPages=%d paPages=%p\n", pSession, (void *)pvR3, cPages, paPages));
-
-    /*
-     * Verify input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrReturn(paPages, VERR_INVALID_PARAMETER);
-    if (    RT_ALIGN_R3PT(pvR3, PAGE_SIZE, RTR3PTR) != pvR3
-        ||  !pvR3)
-    {
-        Log(("pvR3 (%p) must be page aligned and not NULL!\n", (void *)pvR3));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    /*
-     * Let IPRT do the job.
-     */
-    Mem.eType = MEMREF_TYPE_LOCKED;
-    rc = RTR0MemObjLockUser(&Mem.MemObj, pvR3, cb, RTMEM_PROT_READ | RTMEM_PROT_WRITE, RTR0ProcHandleSelf());
-    if (RT_SUCCESS(rc))
-    {
-        uint32_t iPage = cPages;
-        AssertMsg(RTR0MemObjAddressR3(Mem.MemObj) == pvR3, ("%p == %p\n", RTR0MemObjAddressR3(Mem.MemObj), pvR3));
-        AssertMsg(RTR0MemObjSize(Mem.MemObj) == cb, ("%x == %x\n", RTR0MemObjSize(Mem.MemObj), cb));
-
-        while (iPage-- > 0)
-        {
-            paPages[iPage] = RTR0MemObjGetPagePhysAddr(Mem.MemObj, iPage);
-            if (RT_UNLIKELY(paPages[iPage] == NIL_RTCCPHYS))
-            {
-                AssertMsgFailed(("iPage=%d\n", iPage));
-                rc = VERR_INTERNAL_ERROR;
-                break;
-            }
-        }
-        if (RT_SUCCESS(rc))
-            rc = supdrvMemAdd(&Mem, pSession);
-        if (RT_FAILURE(rc))
-        {
-            int rc2 = RTR0MemObjFree(Mem.MemObj, false);
-            AssertRC(rc2);
-        }
-    }
-
-    return rc;
-}
-
-
-/**
- * Unlocks the memory pointed to by pv.
- *
- * @returns IPRT status code.
- * @param   pSession    Session to which the memory was locked.
- * @param   pvR3        Memory to unlock.
- */
-SUPR0DECL(int) SUPR0UnlockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3)
-{
-    LogFlow(("SUPR0UnlockMem: pSession=%p pvR3=%p\n", pSession, (void *)pvR3));
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    return supdrvMemRelease(pSession, (RTHCUINTPTR)pvR3, MEMREF_TYPE_LOCKED);
-}
-
-
-/**
- * Allocates a chunk of page aligned memory with contiguous and fixed physical
- * backing.
- *
- * @returns IPRT status code.
- * @param   pSession    Session data.
- * @param   cPages      Number of pages to allocate.
- * @param   ppvR0       Where to put the address of Ring-0 mapping the allocated memory.
- * @param   ppvR3       Where to put the address of Ring-3 mapping the allocated memory.
- * @param   pHCPhys     Where to put the physical address of allocated memory.
- */
-SUPR0DECL(int) SUPR0ContAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys)
-{
-    int             rc;
-    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
-    LogFlow(("SUPR0ContAlloc: pSession=%p cPages=%d ppvR0=%p ppvR3=%p pHCPhys=%p\n", pSession, cPages, ppvR0, ppvR3, pHCPhys));
-
-    /*
-     * Validate input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    if (!ppvR3 || !ppvR0 || !pHCPhys)
-    {
-        Log(("Null pointer. All of these should be set: pSession=%p ppvR0=%p ppvR3=%p pHCPhys=%p\n",
-             pSession, ppvR0, ppvR3, pHCPhys));
-        return VERR_INVALID_PARAMETER;
-
-    }
-    if (cPages < 1 || cPages >= 256)
-    {
-        Log(("Illegal request cPages=%d, must be greater than 0 and smaller than 256.\n", cPages));
-        return VERR_PAGE_COUNT_OUT_OF_RANGE;
-    }
-
-    /*
-     * Let IPRT do the job.
-     */
-    rc = RTR0MemObjAllocCont(&Mem.MemObj, cPages << PAGE_SHIFT, true /* executable R0 mapping */);
-    if (RT_SUCCESS(rc))
-    {
-        int rc2;
-        rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0,
-                               RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf());
-        if (RT_SUCCESS(rc))
-        {
-            Mem.eType = MEMREF_TYPE_CONT;
-            rc = supdrvMemAdd(&Mem, pSession);
-            if (!rc)
-            {
-                *ppvR0 = RTR0MemObjAddress(Mem.MemObj);
-                *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3);
-                *pHCPhys = RTR0MemObjGetPagePhysAddr(Mem.MemObj, 0);
-                return 0;
-            }
-
-            rc2 = RTR0MemObjFree(Mem.MapObjR3, false);
-            AssertRC(rc2);
-        }
-        rc2 = RTR0MemObjFree(Mem.MemObj, false);
-        AssertRC(rc2);
-    }
-
-    return rc;
-}
-
-
-/**
- * Frees memory allocated using SUPR0ContAlloc().
- *
- * @returns IPRT status code.
- * @param   pSession    The session to which the memory was allocated.
- * @param   uPtr        Pointer to the memory (ring-3 or ring-0).
- */
-SUPR0DECL(int) SUPR0ContFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr)
-{
-    LogFlow(("SUPR0ContFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr));
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_CONT);
-}
-
-
-/**
- * Allocates a chunk of page aligned memory with fixed physical backing below 4GB.
- *
- * The memory isn't zeroed.
- *
- * @returns IPRT status code.
- * @param   pSession    Session data.
- * @param   cPages      Number of pages to allocate.
- * @param   ppvR0       Where to put the address of Ring-0 mapping of the allocated memory.
- * @param   ppvR3       Where to put the address of Ring-3 mapping of the allocated memory.
- * @param   paPages     Where to put the physical addresses of allocated memory.
- */
-SUPR0DECL(int) SUPR0LowAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS paPages)
-{
-    unsigned        iPage;
-    int             rc;
-    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
-    LogFlow(("SUPR0LowAlloc: pSession=%p cPages=%d ppvR3=%p ppvR0=%p paPages=%p\n", pSession, cPages, ppvR3, ppvR0, paPages));
-
-    /*
-     * Validate input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    if (!ppvR3 || !ppvR0 || !paPages)
-    {
-        Log(("Null pointer. All of these should be set: pSession=%p ppvR3=%p ppvR0=%p paPages=%p\n",
-             pSession, ppvR3, ppvR0, paPages));
-        return VERR_INVALID_PARAMETER;
-
-    }
-    if (cPages < 1 || cPages >= 256)
-    {
-        Log(("Illegal request cPages=%d, must be greater than 0 and smaller than 256.\n", cPages));
-        return VERR_PAGE_COUNT_OUT_OF_RANGE;
-    }
-
-    /*
-     * Let IPRT do the work.
-     */
-    rc = RTR0MemObjAllocLow(&Mem.MemObj, cPages << PAGE_SHIFT, true /* executable ring-0 mapping */);
-    if (RT_SUCCESS(rc))
-    {
-        int rc2;
-        rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0,
-                               RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf());
-        if (RT_SUCCESS(rc))
-        {
-            Mem.eType = MEMREF_TYPE_LOW;
-            rc = supdrvMemAdd(&Mem, pSession);
-            if (!rc)
-            {
-                for (iPage = 0; iPage < cPages; iPage++)
-                {
-                    paPages[iPage] = RTR0MemObjGetPagePhysAddr(Mem.MemObj, iPage);
-                    AssertMsg(!(paPages[iPage] & (PAGE_SIZE - 1)), ("iPage=%d Phys=%RHp\n", paPages[iPage]));
-                }
-                *ppvR0 = RTR0MemObjAddress(Mem.MemObj);
-                *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3);
-                return 0;
-            }
-
-            rc2 = RTR0MemObjFree(Mem.MapObjR3, false);
-            AssertRC(rc2);
-        }
-
-        rc2 = RTR0MemObjFree(Mem.MemObj, false);
-        AssertRC(rc2);
-    }
-
-    return rc;
-}
-
-
-/**
- * Frees memory allocated using SUPR0LowAlloc().
- *
- * @returns IPRT status code.
- * @param   pSession    The session to which the memory was allocated.
- * @param   uPtr        Pointer to the memory (ring-3 or ring-0).
- */
-SUPR0DECL(int) SUPR0LowFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr)
-{
-    LogFlow(("SUPR0LowFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr));
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_LOW);
-}
-
-
-
-/**
- * Allocates a chunk of memory with both R0 and R3 mappings.
- * The memory is fixed and it's possible to query the physical addresses using SUPR0MemGetPhys().
- *
- * @returns IPRT status code.
- * @param   pSession    The session to associated the allocation with.
- * @param   cb          Number of bytes to allocate.
- * @param   ppvR0       Where to store the address of the Ring-0 mapping.
- * @param   ppvR3       Where to store the address of the Ring-3 mapping.
- */
-SUPR0DECL(int) SUPR0MemAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR0PTR ppvR0, PRTR3PTR ppvR3)
-{
-    int             rc;
-    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
-    LogFlow(("SUPR0MemAlloc: pSession=%p cb=%d ppvR0=%p ppvR3=%p\n", pSession, cb, ppvR0, ppvR3));
-
-    /*
-     * Validate input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrReturn(ppvR0, VERR_INVALID_POINTER);
-    AssertPtrReturn(ppvR3, VERR_INVALID_POINTER);
-    if (cb < 1 || cb >= _4M)
-    {
-        Log(("Illegal request cb=%u; must be greater than 0 and smaller than 4MB.\n", cb));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    /*
-     * Let IPRT do the work.
-     */
-    rc = RTR0MemObjAllocPage(&Mem.MemObj, cb, true /* executable ring-0 mapping */);
-    if (RT_SUCCESS(rc))
-    {
-        int rc2;
-        rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0,
-                               RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf());
-        if (RT_SUCCESS(rc))
-        {
-            Mem.eType = MEMREF_TYPE_MEM;
-            rc = supdrvMemAdd(&Mem, pSession);
-            if (!rc)
-            {
-                *ppvR0 = RTR0MemObjAddress(Mem.MemObj);
-                *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3);
-                return VINF_SUCCESS;
-            }
-
-            rc2 = RTR0MemObjFree(Mem.MapObjR3, false);
-            AssertRC(rc2);
-        }
-
-        rc2 = RTR0MemObjFree(Mem.MemObj, false);
-        AssertRC(rc2);
-    }
-
-    return rc;
-}
-
-
-/**
- * Get the physical addresses of memory allocated using SUPR0MemAlloc().
- *
- * @returns IPRT status code.
- * @param   pSession        The session to which the memory was allocated.
- * @param   uPtr            The Ring-0 or Ring-3 address returned by SUPR0MemAlloc().
- * @param   paPages         Where to store the physical addresses.
- */
-SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages) /** @todo switch this bugger to RTHCPHYS */
-{
-    PSUPDRVBUNDLE pBundle;
-    LogFlow(("SUPR0MemGetPhys: pSession=%p uPtr=%p paPages=%p\n", pSession, (void *)uPtr, paPages));
-
-    /*
-     * Validate input.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrReturn(paPages, VERR_INVALID_POINTER);
-    AssertReturn(uPtr, VERR_INVALID_PARAMETER);
-
-    /*
-     * Search for the address.
-     */
-    RTSpinlockAcquire(pSession->Spinlock);
-    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
-    {
-        if (pBundle->cUsed > 0)
-        {
-            unsigned i;
-            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
-            {
-                if (    pBundle->aMem[i].eType == MEMREF_TYPE_MEM
-                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
-                    &&  (   (RTHCUINTPTR)RTR0MemObjAddress(pBundle->aMem[i].MemObj) == uPtr
-                         || (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
-                             && RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == uPtr)
-                        )
-                   )
-                {
-                    const size_t cPages = RTR0MemObjSize(pBundle->aMem[i].MemObj) >> PAGE_SHIFT;
-                    size_t iPage;
-                    for (iPage = 0; iPage < cPages; iPage++)
-                    {
-                        paPages[iPage].Phys = RTR0MemObjGetPagePhysAddr(pBundle->aMem[i].MemObj, iPage);
-                        paPages[iPage].uReserved = 0;
-                    }
-                    RTSpinlockRelease(pSession->Spinlock);
-                    return VINF_SUCCESS;
-                }
-            }
-        }
-    }
-    RTSpinlockRelease(pSession->Spinlock);
-    Log(("Failed to find %p!!!\n", (void *)uPtr));
-    return VERR_INVALID_PARAMETER;
-}
-
-
-/**
- * Free memory allocated by SUPR0MemAlloc().
- *
- * @returns IPRT status code.
- * @param   pSession        The session owning the allocation.
- * @param   uPtr            The Ring-0 or Ring-3 address returned by SUPR0MemAlloc().
- */
-SUPR0DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr)
-{
-    LogFlow(("SUPR0MemFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr));
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_MEM);
-}
-
-
-/**
- * Allocates a chunk of memory with a kernel or/and a user mode mapping.
- *
- * The memory is fixed and it's possible to query the physical addresses using
- * SUPR0MemGetPhys().
- *
- * @returns IPRT status code.
- * @param   pSession    The session to associated the allocation with.
- * @param   cPages      The number of pages to allocate.
- * @param   fFlags      Flags, reserved for the future. Must be zero.
- * @param   ppvR3       Where to store the address of the Ring-3 mapping.
- *                      NULL if no ring-3 mapping.
- * @param   ppvR3       Where to store the address of the Ring-0 mapping.
- *                      NULL if no ring-0 mapping.
- * @param   paPages     Where to store the addresses of the pages. Optional.
- */
-SUPR0DECL(int) SUPR0PageAllocEx(PSUPDRVSESSION pSession, uint32_t cPages, uint32_t fFlags, PRTR3PTR ppvR3, PRTR0PTR ppvR0, PRTHCPHYS paPages)
-{
-    int             rc;
-    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
-    LogFlow(("SUPR0PageAlloc: pSession=%p cb=%d ppvR3=%p\n", pSession, cPages, ppvR3));
-
-    /*
-     * Validate input. The allowed allocation size must be at least equal to the maximum guest VRAM size.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrNullReturn(ppvR3, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(ppvR0, VERR_INVALID_POINTER);
-    AssertReturn(ppvR3 || ppvR0, VERR_INVALID_PARAMETER);
-    AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
-    if (cPages < 1 || cPages > VBOX_MAX_ALLOC_PAGE_COUNT)
-    {
-        Log(("SUPR0PageAlloc: Illegal request cb=%u; must be greater than 0 and smaller than %uMB (VBOX_MAX_ALLOC_PAGE_COUNT pages).\n", cPages, VBOX_MAX_ALLOC_PAGE_COUNT * (_1M / _4K)));
-        return VERR_PAGE_COUNT_OUT_OF_RANGE;
-    }
-
-    /*
-     * Let IPRT do the work.
-     */
-    if (ppvR0)
-        rc = RTR0MemObjAllocPage(&Mem.MemObj, (size_t)cPages * PAGE_SIZE, true /* fExecutable */);
-    else
-        rc = RTR0MemObjAllocPhysNC(&Mem.MemObj, (size_t)cPages * PAGE_SIZE, NIL_RTHCPHYS);
-    if (RT_SUCCESS(rc))
-    {
-        int rc2;
-        if (ppvR3)
-            rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0,
-                                   RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf());
-        else
-            Mem.MapObjR3 = NIL_RTR0MEMOBJ;
-        if (RT_SUCCESS(rc))
-        {
-            Mem.eType = MEMREF_TYPE_PAGE;
-            rc = supdrvMemAdd(&Mem, pSession);
-            if (!rc)
-            {
-                if (ppvR3)
-                    *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3);
-                if (ppvR0)
-                    *ppvR0 = RTR0MemObjAddress(Mem.MemObj);
-                if (paPages)
-                {
-                    uint32_t iPage = cPages;
-                    while (iPage-- > 0)
-                    {
-                        paPages[iPage] = RTR0MemObjGetPagePhysAddr(Mem.MapObjR3, iPage);
-                        Assert(paPages[iPage] != NIL_RTHCPHYS);
-                    }
-                }
-                return VINF_SUCCESS;
-            }
-
-            rc2 = RTR0MemObjFree(Mem.MapObjR3, false);
-            AssertRC(rc2);
-        }
-
-        rc2 = RTR0MemObjFree(Mem.MemObj, false);
-        AssertRC(rc2);
-    }
-    return rc;
-}
-
-
-/**
- * Maps a chunk of memory previously allocated by SUPR0PageAllocEx into kernel
- * space.
- *
- * @returns IPRT status code.
- * @param   pSession    The session to associated the allocation with.
- * @param   pvR3        The ring-3 address returned by SUPR0PageAllocEx.
- * @param   offSub      Where to start mapping. Must be page aligned.
- * @param   cbSub       How much to map. Must be page aligned.
- * @param   fFlags      Flags, MBZ.
- * @param   ppvR0       Where to return the address of the ring-0 mapping on
- *                      success.
- */
-SUPR0DECL(int) SUPR0PageMapKernel(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t offSub, uint32_t cbSub,
-                                  uint32_t fFlags, PRTR0PTR ppvR0)
-{
-    int             rc;
-    PSUPDRVBUNDLE   pBundle;
-    RTR0MEMOBJ      hMemObj = NIL_RTR0MEMOBJ;
-    LogFlow(("SUPR0PageMapKernel: pSession=%p pvR3=%p offSub=%#x cbSub=%#x\n", pSession, pvR3, offSub, cbSub));
-
-    /*
-     * Validate input. The allowed allocation size must be at least equal to the maximum guest VRAM size.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrNullReturn(ppvR0, VERR_INVALID_POINTER);
-    AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
-    AssertReturn(!(offSub & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
-    AssertReturn(!(cbSub & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
-    AssertReturn(cbSub, VERR_INVALID_PARAMETER);
-
-    /*
-     * Find the memory object.
-     */
-    RTSpinlockAcquire(pSession->Spinlock);
-    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
-    {
-        if (pBundle->cUsed > 0)
-        {
-            unsigned i;
-            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
-            {
-                if (    (   pBundle->aMem[i].eType == MEMREF_TYPE_PAGE
-                         && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
-                         && pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
-                         && RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == pvR3)
-                    ||  (   pBundle->aMem[i].eType == MEMREF_TYPE_LOCKED
-                         && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
-                         && pBundle->aMem[i].MapObjR3 == NIL_RTR0MEMOBJ
-                         && RTR0MemObjAddressR3(pBundle->aMem[i].MemObj) == pvR3))
-                {
-                    hMemObj = pBundle->aMem[i].MemObj;
-                    break;
-                }
-            }
-        }
-    }
-    RTSpinlockRelease(pSession->Spinlock);
-
-    rc = VERR_INVALID_PARAMETER;
-    if (hMemObj != NIL_RTR0MEMOBJ)
-    {
-        /*
-         * Do some further input validations before calling IPRT.
-         * (Cleanup is done indirectly by telling RTR0MemObjFree to include mappings.)
-         */
-        size_t cbMemObj = RTR0MemObjSize(hMemObj);
-        if (    offSub < cbMemObj
-            &&  cbSub <= cbMemObj
-            &&  offSub + cbSub <= cbMemObj)
-        {
-            RTR0MEMOBJ hMapObj;
-            rc = RTR0MemObjMapKernelEx(&hMapObj, hMemObj, (void *)-1, 0,
-                                       RTMEM_PROT_READ | RTMEM_PROT_WRITE, offSub, cbSub);
-            if (RT_SUCCESS(rc))
-                *ppvR0 = RTR0MemObjAddress(hMapObj);
-        }
-        else
-            SUPR0Printf("SUPR0PageMapKernel: cbMemObj=%#x offSub=%#x cbSub=%#x\n", cbMemObj, offSub, cbSub);
-
-    }
-    return rc;
-}
-
-
-/**
- * Changes the page level protection of one or more pages previously allocated
- * by SUPR0PageAllocEx.
- *
- * @returns IPRT status code.
- * @param   pSession    The session to associated the allocation with.
- * @param   pvR3        The ring-3 address returned by SUPR0PageAllocEx.
- *                      NIL_RTR3PTR if the ring-3 mapping should be unaffected.
- * @param   pvR0        The ring-0 address returned by SUPR0PageAllocEx.
- *                      NIL_RTR0PTR if the ring-0 mapping should be unaffected.
- * @param   offSub      Where to start changing. Must be page aligned.
- * @param   cbSub       How much to change. Must be page aligned.
- * @param   fProt       The new page level protection, see RTMEM_PROT_*.
- */
-SUPR0DECL(int) SUPR0PageProtect(PSUPDRVSESSION pSession, RTR3PTR pvR3, RTR0PTR pvR0, uint32_t offSub, uint32_t cbSub, uint32_t fProt)
-{
-    int             rc;
-    PSUPDRVBUNDLE   pBundle;
-    RTR0MEMOBJ      hMemObjR0 = NIL_RTR0MEMOBJ;
-    RTR0MEMOBJ      hMemObjR3 = NIL_RTR0MEMOBJ;
-    LogFlow(("SUPR0PageProtect: pSession=%p pvR3=%p pvR0=%p offSub=%#x cbSub=%#x fProt-%#x\n", pSession, pvR3, pvR0, offSub, cbSub, fProt));
-
-    /*
-     * Validate input. The allowed allocation size must be at least equal to the maximum guest VRAM size.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertReturn(!(fProt & ~(RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC | RTMEM_PROT_NONE)), VERR_INVALID_PARAMETER);
-    AssertReturn(!(offSub & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
-    AssertReturn(!(cbSub & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
-    AssertReturn(cbSub, VERR_INVALID_PARAMETER);
-
-    /*
-     * Find the memory object.
-     */
-    RTSpinlockAcquire(pSession->Spinlock);
-    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
-    {
-        if (pBundle->cUsed > 0)
-        {
-            unsigned i;
-            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
-            {
-                if (   pBundle->aMem[i].eType == MEMREF_TYPE_PAGE
-                    && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
-                    && (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
-                        || pvR3 == NIL_RTR3PTR)
-                    && (   pvR0 == NIL_RTR0PTR
-                        || RTR0MemObjAddress(pBundle->aMem[i].MemObj) == pvR0)
-                    && (   pvR3 == NIL_RTR3PTR
-                        || RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == pvR3))
-                {
-                    if (pvR0 != NIL_RTR0PTR)
-                        hMemObjR0 = pBundle->aMem[i].MemObj;
-                    if (pvR3 != NIL_RTR3PTR)
-                        hMemObjR3 = pBundle->aMem[i].MapObjR3;
-                    break;
-                }
-            }
-        }
-    }
-    RTSpinlockRelease(pSession->Spinlock);
-
-    rc = VERR_INVALID_PARAMETER;
-    if (    hMemObjR0 != NIL_RTR0MEMOBJ
-        ||  hMemObjR3 != NIL_RTR0MEMOBJ)
-    {
-        /*
-         * Do some further input validations before calling IPRT.
-         */
-        size_t cbMemObj = hMemObjR0 != NIL_RTR0PTR ? RTR0MemObjSize(hMemObjR0) : RTR0MemObjSize(hMemObjR3);
-        if (    offSub < cbMemObj
-            &&  cbSub <= cbMemObj
-            &&  offSub + cbSub <= cbMemObj)
-        {
-            rc = VINF_SUCCESS;
-            if (hMemObjR3 != NIL_RTR0PTR)
-                rc = RTR0MemObjProtect(hMemObjR3, offSub, cbSub, fProt);
-            if (hMemObjR0 != NIL_RTR0PTR && RT_SUCCESS(rc))
-                rc = RTR0MemObjProtect(hMemObjR0, offSub, cbSub, fProt);
-        }
-        else
-            SUPR0Printf("SUPR0PageMapKernel: cbMemObj=%#x offSub=%#x cbSub=%#x\n", cbMemObj, offSub, cbSub);
-
-    }
-    return rc;
-
-}
-
-
-/**
- * Free memory allocated by SUPR0PageAlloc() and SUPR0PageAllocEx().
- *
- * @returns IPRT status code.
- * @param   pSession        The session owning the allocation.
- * @param   pvR3             The Ring-3 address returned by SUPR0PageAlloc() or
- *                           SUPR0PageAllocEx().
- */
-SUPR0DECL(int) SUPR0PageFree(PSUPDRVSESSION pSession, RTR3PTR pvR3)
-{
-    LogFlow(("SUPR0PageFree: pSession=%p pvR3=%p\n", pSession, (void *)pvR3));
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    return supdrvMemRelease(pSession, (RTHCUINTPTR)pvR3, MEMREF_TYPE_PAGE);
-}
-
-
-/**
- * Gets the paging mode of the current CPU.
- *
- * @returns Paging mode, SUPPAGEINGMODE_INVALID on error.
- */
-SUPR0DECL(SUPPAGINGMODE) SUPR0GetPagingMode(void)
-{
-    SUPPAGINGMODE enmMode;
-
-    RTR0UINTREG cr0 = ASMGetCR0();
-    if ((cr0 & (X86_CR0_PG | X86_CR0_PE)) != (X86_CR0_PG | X86_CR0_PE))
-        enmMode = SUPPAGINGMODE_INVALID;
-    else
-    {
-        RTR0UINTREG cr4 = ASMGetCR4();
-        uint32_t fNXEPlusLMA = 0;
-        if (cr4 & X86_CR4_PAE)
-        {
-            uint32_t fExtFeatures = ASMCpuId_EDX(0x80000001);
-            if (fExtFeatures & (X86_CPUID_EXT_FEATURE_EDX_NX | X86_CPUID_EXT_FEATURE_EDX_LONG_MODE))
-            {
-                uint64_t efer = ASMRdMsr(MSR_K6_EFER);
-                if ((fExtFeatures & X86_CPUID_EXT_FEATURE_EDX_NX)        && (efer & MSR_K6_EFER_NXE))
-                    fNXEPlusLMA |= RT_BIT(0);
-                if ((fExtFeatures & X86_CPUID_EXT_FEATURE_EDX_LONG_MODE) && (efer & MSR_K6_EFER_LMA))
-                    fNXEPlusLMA |= RT_BIT(1);
-            }
-        }
-
-        switch ((cr4 & (X86_CR4_PAE | X86_CR4_PGE)) | fNXEPlusLMA)
-        {
-            case 0:
-                enmMode = SUPPAGINGMODE_32_BIT;
-                break;
-
-            case X86_CR4_PGE:
-                enmMode = SUPPAGINGMODE_32_BIT_GLOBAL;
-                break;
-
-            case X86_CR4_PAE:
-                enmMode = SUPPAGINGMODE_PAE;
-                break;
-
-            case X86_CR4_PAE | RT_BIT(0):
-                enmMode = SUPPAGINGMODE_PAE_NX;
-                break;
-
-            case X86_CR4_PAE | X86_CR4_PGE:
-                enmMode = SUPPAGINGMODE_PAE_GLOBAL;
-                break;
-
-            case X86_CR4_PAE | X86_CR4_PGE | RT_BIT(0):
-                enmMode = SUPPAGINGMODE_PAE_GLOBAL;
-                break;
-
-            case RT_BIT(1) | X86_CR4_PAE:
-                enmMode = SUPPAGINGMODE_AMD64;
-                break;
-
-            case RT_BIT(1) | X86_CR4_PAE | RT_BIT(0):
-                enmMode = SUPPAGINGMODE_AMD64_NX;
-                break;
-
-            case RT_BIT(1) | X86_CR4_PAE | X86_CR4_PGE:
-                enmMode = SUPPAGINGMODE_AMD64_GLOBAL;
-                break;
-
-            case RT_BIT(1) | X86_CR4_PAE | X86_CR4_PGE | RT_BIT(0):
-                enmMode = SUPPAGINGMODE_AMD64_GLOBAL_NX;
-                break;
-
-            default:
-                AssertMsgFailed(("Cannot happen! cr4=%#x fNXEPlusLMA=%d\n", cr4, fNXEPlusLMA));
-                enmMode = SUPPAGINGMODE_INVALID;
-                break;
-        }
-    }
-    return enmMode;
-}
-
-
-/**
- * Change CR4 and take care of the kernel CR4 shadow if applicable.
- *
- * CR4 shadow handling is required for Linux >= 4.0. Calling this function
- * instead of ASMSetCR4() is only necessary for semi-permanent CR4 changes
- * for code with interrupts enabled.
- *
- * @returns the old CR4 value.
- *
- * @param   fOrMask         bits to be set in CR4.
- * @param   fAndMask        bits to be cleard in CR4.
- *
- * @remarks Must be called with preemption/interrupts disabled.
- */
-SUPR0DECL(RTCCUINTREG) SUPR0ChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask)
-{
-#ifdef RT_OS_LINUX
-    return supdrvOSChangeCR4(fOrMask, fAndMask);
-#else
-    RTCCUINTREG uOld = ASMGetCR4();
-    RTCCUINTREG uNew = (uOld & fAndMask) | fOrMask;
-    if (uNew != uOld)
-        ASMSetCR4(uNew);
-    return uOld;
-#endif
-}
-
-
-/**
- * Enables or disabled hardware virtualization extensions using native OS APIs.
- *
- * @returns VBox status code.
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_NOT_SUPPORTED if not supported by the native OS.
- *
- * @param   fEnable         Whether to enable or disable.
- */
-SUPR0DECL(int) SUPR0EnableVTx(bool fEnable)
-{
-#ifdef RT_OS_DARWIN
-    return supdrvOSEnableVTx(fEnable);
-#else
-    return VERR_NOT_SUPPORTED;
-#endif
-}
-
-
-/**
- * Suspends hardware virtualization extensions using the native OS API.
- *
- * This is called prior to entering raw-mode context.
- *
- * @returns @c true if suspended, @c false if not.
- */
-SUPR0DECL(bool) SUPR0SuspendVTxOnCpu(void)
-{
-#ifdef RT_OS_DARWIN
-    return supdrvOSSuspendVTxOnCpu();
-#else
-    return false;
-#endif
-}
-
-
-/**
- * Resumes hardware virtualization extensions using the native OS API.
- *
- * This is called after to entering raw-mode context.
- *
- * @param   fSuspended      The return value of SUPR0SuspendVTxOnCpu.
- */
-SUPR0DECL(void) SUPR0ResumeVTxOnCpu(bool fSuspended)
-{
-#ifdef RT_OS_DARWIN
-    supdrvOSResumeVTxOnCpu(fSuspended);
-#else
-    Assert(!fSuspended);
-#endif
-}
-
-
-/**
- * Queries the AMD-V and VT-x capabilities of the calling CPU.
- *
- * @returns VBox status code.
- * @retval  VERR_VMX_NO_VMX
- * @retval  VERR_VMX_MSR_SMX_VMXON_DISABLED
- * @retval  VERR_VMX_MSR_VMXON_DISABLED
- * @retval  VERR_VMX_MSR_LOCKING_FAILED
- * @retval  VERR_SVM_NO_SVM
- * @retval  VERR_SVM_DISABLED
- * @retval  VERR_UNSUPPORTED_CPU if not identifiable as an AMD, Intel or VIA
- *          (centaur) CPU.
- *
- * @param   pSession        The session handle.
- * @param   pfCaps          Where to store the capabilities.
- */
-SUPR0DECL(int) SUPR0QueryVTCaps(PSUPDRVSESSION pSession, uint32_t *pfCaps)
-{
-    int rc = VERR_UNSUPPORTED_CPU;
-    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrReturn(pfCaps, VERR_INVALID_POINTER);
-
-    *pfCaps = 0;
-    /* We may modify MSRs and re-read them, disable preemption so we make sure we don't migrate CPUs. */
-    RTThreadPreemptDisable(&PreemptState);
-    if (ASMHasCpuId())
-    {
-        uint32_t fFeaturesECX, fFeaturesEDX, uDummy;
-        uint32_t uMaxId, uVendorEBX, uVendorECX, uVendorEDX;
-        uint64_t u64FeatMsr;
-
-        ASMCpuId(0, &uMaxId, &uVendorEBX, &uVendorECX, &uVendorEDX);
-        ASMCpuId(1, &uDummy, &uDummy, &fFeaturesECX, &fFeaturesEDX);
-
-        if (   ASMIsValidStdRange(uMaxId)
-            && (   ASMIsIntelCpuEx(     uVendorEBX, uVendorECX, uVendorEDX)
-                || ASMIsViaCentaurCpuEx(uVendorEBX, uVendorECX, uVendorEDX) )
-           )
-        {
-            if (    (fFeaturesECX & X86_CPUID_FEATURE_ECX_VMX)
-                 && (fFeaturesEDX & X86_CPUID_FEATURE_EDX_MSR)
-                 && (fFeaturesEDX & X86_CPUID_FEATURE_EDX_FXSR)
-               )
-            {
-                /** @todo Unify code with hmR0InitIntelCpu(). */
-                uint64_t   u64FeatMsr     = ASMRdMsr(MSR_IA32_FEATURE_CONTROL);
-                bool const fInSmxMode     = RT_BOOL(ASMGetCR4() & X86_CR4_SMXE);
-                bool       fMsrLocked     = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK);
-                bool       fSmxVmxAllowed = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON);
-                bool       fVmxAllowed    = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON);
-
-                /* Check if the LOCK bit is set but excludes the required VMXON bit. */
-                if (fMsrLocked)
-                {
-                    if (fInSmxMode && !fSmxVmxAllowed)
-                        rc = VERR_VMX_MSR_SMX_VMXON_DISABLED;
-                    else if (!fInSmxMode && !fVmxAllowed)
-                        rc = VERR_VMX_MSR_VMXON_DISABLED;
-                    else
-                        rc = VINF_SUCCESS;
-                }
-                else
-                {
-                    /*
-                     * MSR is not yet locked; we can change it ourselves here.
-                     * Once the lock bit is set, this MSR can no longer be modified.
-                     */
-                    bool fAllowed;
-                    u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_LOCK;
-                    if (fInSmxMode)
-                        u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_SMX_VMXON;
-                    else
-                        u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_VMXON;
-
-                    ASMWrMsr(MSR_IA32_FEATURE_CONTROL, u64FeatMsr);
-
-                    /* Verify. */
-                    u64FeatMsr     = ASMRdMsr(MSR_IA32_FEATURE_CONTROL);
-                    fMsrLocked     = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK);
-                    fSmxVmxAllowed = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON);
-                    fVmxAllowed    = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON);
-                    fAllowed       = fInSmxMode ? fSmxVmxAllowed : fVmxAllowed;
-                    if (fAllowed)
-                        rc = VINF_SUCCESS;
-                    else
-                        rc = VERR_VMX_MSR_LOCKING_FAILED;
-                }
-
-                if (rc == VINF_SUCCESS)
-                {
-                    VMX_CAPABILITY vtCaps;
-
-                    *pfCaps |= SUPVTCAPS_VT_X;
-
-                    vtCaps.u = ASMRdMsr(MSR_IA32_VMX_PROCBASED_CTLS);
-                    if (vtCaps.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_USE_SECONDARY_EXEC_CTRL)
-                    {
-                        vtCaps.u = ASMRdMsr(MSR_IA32_VMX_PROCBASED_CTLS2);
-                        if (vtCaps.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_EPT)
-                            *pfCaps |= SUPVTCAPS_NESTED_PAGING;
-                    }
-                }
-            }
-            else
-                rc = VERR_VMX_NO_VMX;
-        }
-        else if (   ASMIsAmdCpuEx(uVendorEBX, uVendorECX, uVendorEDX)
-                 && ASMIsValidStdRange(uMaxId))
-        {
-            uint32_t fExtFeaturesEcx, uExtMaxId;
-            ASMCpuId(0x80000000, &uExtMaxId, &uDummy, &uDummy, &uDummy);
-            ASMCpuId(0x80000001, &uDummy, &uDummy, &fExtFeaturesEcx, &uDummy);
-            if (   ASMIsValidExtRange(uExtMaxId)
-                && uExtMaxId >= 0x8000000a
-                && (fExtFeaturesEcx & X86_CPUID_AMD_FEATURE_ECX_SVM)
-                && (fFeaturesEDX    & X86_CPUID_FEATURE_EDX_MSR)
-                && (fFeaturesEDX    & X86_CPUID_FEATURE_EDX_FXSR)
-               )
-            {
-                /* Check if SVM is disabled */
-                u64FeatMsr = ASMRdMsr(MSR_K8_VM_CR);
-                if (!(u64FeatMsr & MSR_K8_VM_CR_SVM_DISABLE))
-                {
-                    uint32_t fSvmFeatures;
-                    *pfCaps |= SUPVTCAPS_AMD_V;
-
-                    /* Query AMD-V features. */
-                    ASMCpuId(0x8000000a, &uDummy, &uDummy, &uDummy, &fSvmFeatures);
-                    if (fSvmFeatures & AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING)
-                        *pfCaps |= SUPVTCAPS_NESTED_PAGING;
-
-                    rc = VINF_SUCCESS;
-                }
-                else
-                    rc = VERR_SVM_DISABLED;
-            }
-            else
-                rc = VERR_SVM_NO_SVM;
-        }
-    }
-
-    RTThreadPreemptRestore(&PreemptState);
-    return rc;
-}
-
-
-/**
- * (Re-)initializes the per-cpu structure prior to starting or resuming the GIP
- * updating.
- *
- * @param   pGipCpu          The per CPU structure for this CPU.
- * @param   u64NanoTS        The current time.
- */
-static void supdrvGipReInitCpu(PSUPGIPCPU pGipCpu, uint64_t u64NanoTS)
-{
-    pGipCpu->u64TSC    = ASMReadTSC() - pGipCpu->u32UpdateIntervalTSC;
-    pGipCpu->u64NanoTS = u64NanoTS;
-}
-
-
-/**
- * Set the current TSC and NanoTS value for the CPU.
- *
- * @param   idCpu            The CPU ID. Unused - we have to use the APIC ID.
- * @param   pvUser1          Pointer to the ring-0 GIP mapping.
- * @param   pvUser2          Pointer to the variable holding the current time.
- */
-static DECLCALLBACK(void) supdrvGipReInitCpuCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
-{
-    PSUPGLOBALINFOPAGE  pGip = (PSUPGLOBALINFOPAGE)pvUser1;
-    unsigned            iCpu = pGip->aiCpuFromApicId[ASMGetApicId()];
-
-    if (RT_LIKELY(iCpu < pGip->cCpus && pGip->aCPUs[iCpu].idCpu == idCpu))
-        supdrvGipReInitCpu(&pGip->aCPUs[iCpu], *(uint64_t *)pvUser2);
-
-    NOREF(pvUser2);
-    NOREF(idCpu);
-}
-
-
-/**
- * Increase the timer freqency on hosts where this is possible (NT).
- *
- * The idea is that more interrupts is better for us... Also, it's better than
- * we increase the timer frequence, because we might end up getting inaccuract
- * callbacks if someone else does it.
- *
- * @param   pDevExt   Sets u32SystemTimerGranularityGrant if increased.
- */
-static void supdrvGipRequestHigherTimerFrequencyFromSystem(PSUPDRVDEVEXT pDevExt)
-{
-    if (pDevExt->u32SystemTimerGranularityGrant == 0)
-    {
-        uint32_t u32SystemResolution;
-        if (   RT_SUCCESS_NP(RTTimerRequestSystemGranularity(  976563 /* 1024 HZ */, &u32SystemResolution))
-            || RT_SUCCESS_NP(RTTimerRequestSystemGranularity( 1000000 /* 1000 HZ */, &u32SystemResolution))
-            || RT_SUCCESS_NP(RTTimerRequestSystemGranularity( 1953125 /*  512 HZ */, &u32SystemResolution))
-            || RT_SUCCESS_NP(RTTimerRequestSystemGranularity( 2000000 /*  500 HZ */, &u32SystemResolution))
-           )
-        {
-            Assert(RTTimerGetSystemGranularity() <= u32SystemResolution);
-            pDevExt->u32SystemTimerGranularityGrant = u32SystemResolution;
-        }
-    }
-}
-
-
-/**
- * Undoes supdrvGipRequestHigherTimerFrequencyFromSystem.
- *
- * @param   pDevExt     Clears u32SystemTimerGranularityGrant.
- */
-static void supdrvGipReleaseHigherTimerFrequencyFromSystem(PSUPDRVDEVEXT pDevExt)
-{
-    if (pDevExt->u32SystemTimerGranularityGrant)
-    {
-        int rc2 = RTTimerReleaseSystemGranularity(pDevExt->u32SystemTimerGranularityGrant);
-        AssertRC(rc2);
-        pDevExt->u32SystemTimerGranularityGrant = 0;
-    }
-}
-
-
-/**
- * Maps the GIP into userspace and/or get the physical address of the GIP.
- *
- * @returns IPRT status code.
- * @param   pSession        Session to which the GIP mapping should belong.
- * @param   ppGipR3         Where to store the address of the ring-3 mapping. (optional)
- * @param   pHCPhysGip      Where to store the physical address. (optional)
- *
- * @remark  There is no reference counting on the mapping, so one call to this function
- *          count globally as one reference. One call to SUPR0GipUnmap() is will unmap GIP
- *          and remove the session as a GIP user.
- */
-SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PRTR3PTR ppGipR3, PRTHCPHYS pHCPhysGip)
-{
-    int             rc;
-    PSUPDRVDEVEXT   pDevExt = pSession->pDevExt;
-    RTR3PTR         pGipR3  = NIL_RTR3PTR;
-    RTHCPHYS        HCPhys  = NIL_RTHCPHYS;
-    LogFlow(("SUPR0GipMap: pSession=%p ppGipR3=%p pHCPhysGip=%p\n", pSession, ppGipR3, pHCPhysGip));
-
-    /*
-     * Validate
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrNullReturn(ppGipR3, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(pHCPhysGip, VERR_INVALID_POINTER);
-
-#ifdef SUPDRV_USE_MUTEX_FOR_GIP
-    RTSemMutexRequest(pDevExt->mtxGip, RT_INDEFINITE_WAIT);
-#else
-    RTSemFastMutexRequest(pDevExt->mtxGip);
-#endif
-    if (pDevExt->pGip)
-    {
-        /*
-         * Map it?
-         */
-        rc = VINF_SUCCESS;
-        if (ppGipR3)
-        {
-            if (pSession->GipMapObjR3 == NIL_RTR0MEMOBJ)
-                rc = RTR0MemObjMapUser(&pSession->GipMapObjR3, pDevExt->GipMemObj, (RTR3PTR)-1, 0,
-                                       RTMEM_PROT_READ, RTR0ProcHandleSelf());
-            if (RT_SUCCESS(rc))
-                pGipR3 = RTR0MemObjAddressR3(pSession->GipMapObjR3);
-        }
-
-        /*
-         * Get physical address.
-         */
-        if (pHCPhysGip && RT_SUCCESS(rc))
-            HCPhys = pDevExt->HCPhysGip;
-
-        /*
-         * Reference globally.
-         */
-        if (!pSession->fGipReferenced && RT_SUCCESS(rc))
-        {
-            pSession->fGipReferenced = 1;
-            pDevExt->cGipUsers++;
-            if (pDevExt->cGipUsers == 1)
-            {
-                PSUPGLOBALINFOPAGE pGipR0 = pDevExt->pGip;
-                uint64_t u64NanoTS;
-
-                LogFlow(("SUPR0GipMap: Resumes GIP updating\n"));
-
-                supdrvGipRequestHigherTimerFrequencyFromSystem(pDevExt);
-
-                if (pGipR0->aCPUs[0].u32TransactionId != 2 /* not the first time */)
-                {
-                    unsigned i;
-                    for (i = 0; i < RT_ELEMENTS(pGipR0->aCPUs); i++)
-                        ASMAtomicUoWriteU32(&pGipR0->aCPUs[i].u32TransactionId,
-                                            (pGipR0->aCPUs[i].u32TransactionId + GIP_UPDATEHZ_RECALC_FREQ * 2)
-                                            & ~(GIP_UPDATEHZ_RECALC_FREQ * 2 - 1));
-                    ASMAtomicWriteU64(&pGipR0->u64NanoTSLastUpdateHz, 0);
-                }
-
-                u64NanoTS = RTTimeSystemNanoTS() - pGipR0->u32UpdateIntervalNS;
-                if (   pGipR0->u32Mode == SUPGIPMODE_SYNC_TSC
-                    || RTMpGetOnlineCount() == 1)
-                    supdrvGipReInitCpu(&pGipR0->aCPUs[0], u64NanoTS);
-                else
-                    RTMpOnAll(supdrvGipReInitCpuCallback, pGipR0, &u64NanoTS);
-
-#ifndef DO_NOT_START_GIP
-                rc = RTTimerStart(pDevExt->pGipTimer, 0); AssertRC(rc);
-#endif
-                rc = VINF_SUCCESS;
-            }
-        }
-    }
-    else
-    {
-        rc = VERR_GENERAL_FAILURE;
-        Log(("SUPR0GipMap: GIP is not available!\n"));
-    }
-#ifdef SUPDRV_USE_MUTEX_FOR_GIP
-    RTSemMutexRelease(pDevExt->mtxGip);
-#else
-    RTSemFastMutexRelease(pDevExt->mtxGip);
-#endif
-
-    /*
-     * Write returns.
-     */
-    if (pHCPhysGip)
-        *pHCPhysGip = HCPhys;
-    if (ppGipR3)
-        *ppGipR3 = pGipR3;
-
-#ifdef DEBUG_DARWIN_GIP
-    OSDBGPRINT(("SUPR0GipMap: returns %d *pHCPhysGip=%lx pGipR3=%p\n", rc, (unsigned long)HCPhys, (void *)pGipR3));
-#else
-    LogFlow((   "SUPR0GipMap: returns %d *pHCPhysGip=%lx pGipR3=%p\n", rc, (unsigned long)HCPhys, (void *)pGipR3));
-#endif
-    return rc;
-}
-
-
-/**
- * Unmaps any user mapping of the GIP and terminates all GIP access
- * from this session.
- *
- * @returns IPRT status code.
- * @param   pSession        Session to which the GIP mapping should belong.
- */
-SUPR0DECL(int) SUPR0GipUnmap(PSUPDRVSESSION pSession)
-{
-    int                     rc = VINF_SUCCESS;
-    PSUPDRVDEVEXT           pDevExt = pSession->pDevExt;
-#ifdef DEBUG_DARWIN_GIP
-    OSDBGPRINT(("SUPR0GipUnmap: pSession=%p pGip=%p GipMapObjR3=%p\n",
-                pSession,
-                pSession->GipMapObjR3 != NIL_RTR0MEMOBJ ? RTR0MemObjAddress(pSession->GipMapObjR3) : NULL,
-                pSession->GipMapObjR3));
-#else
-    LogFlow(("SUPR0GipUnmap: pSession=%p\n", pSession));
-#endif
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-
-#ifdef SUPDRV_USE_MUTEX_FOR_GIP
-    RTSemMutexRequest(pDevExt->mtxGip, RT_INDEFINITE_WAIT);
-#else
-    RTSemFastMutexRequest(pDevExt->mtxGip);
-#endif
-
-    /*
-     * Unmap anything?
-     */
-    if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ)
-    {
-        rc = RTR0MemObjFree(pSession->GipMapObjR3, false);
-        AssertRC(rc);
-        if (RT_SUCCESS(rc))
-            pSession->GipMapObjR3 = NIL_RTR0MEMOBJ;
-    }
-
-    /*
-     * Dereference global GIP.
-     */
-    if (pSession->fGipReferenced && !rc)
-    {
-        pSession->fGipReferenced = 0;
-        if (    pDevExt->cGipUsers > 0
-            &&  !--pDevExt->cGipUsers)
-        {
-            LogFlow(("SUPR0GipUnmap: Suspends GIP updating\n"));
-#ifndef DO_NOT_START_GIP
-            rc = RTTimerStop(pDevExt->pGipTimer); AssertRC(rc); rc = VINF_SUCCESS;
-#endif
-            supdrvGipReleaseHigherTimerFrequencyFromSystem(pDevExt);
-        }
-    }
-
-#ifdef SUPDRV_USE_MUTEX_FOR_GIP
-    RTSemMutexRelease(pDevExt->mtxGip);
-#else
-    RTSemFastMutexRelease(pDevExt->mtxGip);
-#endif
-
-    return rc;
-}
-
-
-/**
- * Gets the GIP pointer.
- *
- * @returns Pointer to the GIP or NULL.
- */
-SUPDECL(PSUPGLOBALINFOPAGE) SUPGetGIP(void)
-{
-    return g_pSUPGlobalInfoPage;
-}
-
-
-/**
- * Register a component factory with the support driver.
- *
- * This is currently restricted to kernel sessions only.
- *
- * @returns VBox status code.
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_NO_MEMORY if we're out of memory.
- * @retval  VERR_ALREADY_EXISTS if the factory has already been registered.
- * @retval  VERR_ACCESS_DENIED if it isn't a kernel session.
- * @retval  VERR_INVALID_PARAMETER on invalid parameter.
- * @retval  VERR_INVALID_POINTER on invalid pointer parameter.
- *
- * @param   pSession        The SUPDRV session (must be a ring-0 session).
- * @param   pFactory        Pointer to the component factory registration structure.
- *
- * @remarks This interface is also available via SUPR0IdcComponentRegisterFactory.
- */
-SUPR0DECL(int) SUPR0ComponentRegisterFactory(PSUPDRVSESSION pSession, PCSUPDRVFACTORY pFactory)
-{
-    PSUPDRVFACTORYREG pNewReg;
-    const char *psz;
-    int rc;
-
-    /*
-     * Validate parameters.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertReturn(pSession->R0Process == NIL_RTR0PROCESS, VERR_ACCESS_DENIED);
-    AssertPtrReturn(pFactory, VERR_INVALID_POINTER);
-    AssertPtrReturn(pFactory->pfnQueryFactoryInterface, VERR_INVALID_POINTER);
-    psz = RTStrEnd(pFactory->szName, sizeof(pFactory->szName));
-    AssertReturn(psz, VERR_INVALID_PARAMETER);
-
-    /*
-     * Allocate and initialize a new registration structure.
-     */
-    pNewReg = (PSUPDRVFACTORYREG)RTMemAlloc(sizeof(SUPDRVFACTORYREG));
-    if (pNewReg)
-    {
-        pNewReg->pNext = NULL;
-        pNewReg->pFactory = pFactory;
-        pNewReg->pSession = pSession;
-        pNewReg->cchName = psz - &pFactory->szName[0];
-
-        /*
-         * Add it to the tail of the list after checking for prior registration.
-         */
-        rc = RTSemFastMutexRequest(pSession->pDevExt->mtxComponentFactory);
-        if (RT_SUCCESS(rc))
-        {
-            PSUPDRVFACTORYREG pPrev = NULL;
-            PSUPDRVFACTORYREG pCur = pSession->pDevExt->pComponentFactoryHead;
-            while (pCur && pCur->pFactory != pFactory)
-            {
-                pPrev = pCur;
-                pCur = pCur->pNext;
-            }
-            if (!pCur)
-            {
-                if (pPrev)
-                    pPrev->pNext = pNewReg;
-                else
-                    pSession->pDevExt->pComponentFactoryHead = pNewReg;
-                rc = VINF_SUCCESS;
-            }
-            else
-                rc = VERR_ALREADY_EXISTS;
-
-            RTSemFastMutexRelease(pSession->pDevExt->mtxComponentFactory);
-        }
-
-        if (RT_FAILURE(rc))
-            RTMemFree(pNewReg);
-    }
-    else
-        rc = VERR_NO_MEMORY;
-    return rc;
-}
-
-
-/**
- * Deregister a component factory.
- *
- * @returns VBox status code.
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_NOT_FOUND if the factory wasn't registered.
- * @retval  VERR_ACCESS_DENIED if it isn't a kernel session.
- * @retval  VERR_INVALID_PARAMETER on invalid parameter.
- * @retval  VERR_INVALID_POINTER on invalid pointer parameter.
- *
- * @param   pSession        The SUPDRV session (must be a ring-0 session).
- * @param   pFactory        Pointer to the component factory registration structure
- *                          previously passed SUPR0ComponentRegisterFactory().
- *
- * @remarks This interface is also available via SUPR0IdcComponentDeregisterFactory.
- */
-SUPR0DECL(int) SUPR0ComponentDeregisterFactory(PSUPDRVSESSION pSession, PCSUPDRVFACTORY pFactory)
-{
-    int rc;
-
-    /*
-     * Validate parameters.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertReturn(pSession->R0Process == NIL_RTR0PROCESS, VERR_ACCESS_DENIED);
-    AssertPtrReturn(pFactory, VERR_INVALID_POINTER);
-
-    /*
-     * Take the lock and look for the registration record.
-     */
-    rc = RTSemFastMutexRequest(pSession->pDevExt->mtxComponentFactory);
-    if (RT_SUCCESS(rc))
-    {
-        PSUPDRVFACTORYREG pPrev = NULL;
-        PSUPDRVFACTORYREG pCur = pSession->pDevExt->pComponentFactoryHead;
-        while (pCur && pCur->pFactory != pFactory)
-        {
-            pPrev = pCur;
-            pCur = pCur->pNext;
-        }
-        if (pCur)
-        {
-            if (!pPrev)
-                pSession->pDevExt->pComponentFactoryHead = pCur->pNext;
-            else
-                pPrev->pNext = pCur->pNext;
-
-            pCur->pNext = NULL;
-            pCur->pFactory = NULL;
-            pCur->pSession = NULL;
-            rc = VINF_SUCCESS;
-        }
-        else
-            rc = VERR_NOT_FOUND;
-
-        RTSemFastMutexRelease(pSession->pDevExt->mtxComponentFactory);
-
-        RTMemFree(pCur);
-    }
-    return rc;
-}
-
-
-/**
- * Queries a component factory.
- *
- * @returns VBox status code.
- * @retval  VERR_INVALID_PARAMETER on invalid parameter.
- * @retval  VERR_INVALID_POINTER on invalid pointer parameter.
- * @retval  VERR_SUPDRV_COMPONENT_NOT_FOUND if the component factory wasn't found.
- * @retval  VERR_SUPDRV_INTERFACE_NOT_SUPPORTED if the interface wasn't supported.
- *
- * @param   pSession            The SUPDRV session.
- * @param   pszName             The name of the component factory.
- * @param   pszInterfaceUuid    The UUID of the factory interface (stringified).
- * @param   ppvFactoryIf        Where to store the factory interface.
- */
-SUPR0DECL(int) SUPR0ComponentQueryFactory(PSUPDRVSESSION pSession, const char *pszName, const char *pszInterfaceUuid, void **ppvFactoryIf)
-{
-    const char *pszEnd;
-    size_t cchName;
-    int rc;
-
-    /*
-     * Validate parameters.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-
-    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
-    pszEnd = RTStrEnd(pszName, RT_SIZEOFMEMB(SUPDRVFACTORY, szName));
-    AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
-    cchName = pszEnd - pszName;
-
-    AssertPtrReturn(pszInterfaceUuid, VERR_INVALID_POINTER);
-    pszEnd = RTStrEnd(pszInterfaceUuid, RTUUID_STR_LENGTH);
-    AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
-
-    AssertPtrReturn(ppvFactoryIf, VERR_INVALID_POINTER);
-    *ppvFactoryIf = NULL;
-
-    /*
-     * Take the lock and try all factories by this name.
-     */
-    rc = RTSemFastMutexRequest(pSession->pDevExt->mtxComponentFactory);
-    if (RT_SUCCESS(rc))
-    {
-        PSUPDRVFACTORYREG pCur = pSession->pDevExt->pComponentFactoryHead;
-        rc = VERR_SUPDRV_COMPONENT_NOT_FOUND;
-        while (pCur)
-        {
-            if (    pCur->cchName == cchName
-                &&  !memcmp(pCur->pFactory->szName, pszName, cchName))
-            {
-                void *pvFactory = pCur->pFactory->pfnQueryFactoryInterface(pCur->pFactory, pSession, pszInterfaceUuid);
-                if (pvFactory)
-                {
-                    *ppvFactoryIf = pvFactory;
-                    rc = VINF_SUCCESS;
-                    break;
-                }
-                rc = VERR_SUPDRV_INTERFACE_NOT_SUPPORTED;
-            }
-
-            /* next */
-            pCur = pCur->pNext;
-        }
-
-        RTSemFastMutexRelease(pSession->pDevExt->mtxComponentFactory);
-    }
-    return rc;
-}
-
-
-/**
- * Adds a memory object to the session.
- *
- * @returns IPRT status code.
- * @param   pMem        Memory tracking structure containing the
- *                      information to track.
- * @param   pSession    The session.
- */
-static int supdrvMemAdd(PSUPDRVMEMREF pMem, PSUPDRVSESSION pSession)
-{
-    PSUPDRVBUNDLE pBundle;
-
-    /*
-     * Find free entry and record the allocation.
-     */
-    RTSpinlockAcquire(pSession->Spinlock);
-    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
-    {
-        if (pBundle->cUsed < RT_ELEMENTS(pBundle->aMem))
-        {
-            unsigned i;
-            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
-            {
-                if (pBundle->aMem[i].MemObj == NIL_RTR0MEMOBJ)
-                {
-                    pBundle->cUsed++;
-                    pBundle->aMem[i] = *pMem;
-                    RTSpinlockRelease(pSession->Spinlock);
-                    return VINF_SUCCESS;
-                }
-            }
-            AssertFailed();             /* !!this can't be happening!!! */
-        }
-    }
-    RTSpinlockRelease(pSession->Spinlock);
-
-    /*
-     * Need to allocate a new bundle.
-     * Insert into the last entry in the bundle.
-     */
-    pBundle = (PSUPDRVBUNDLE)RTMemAllocZ(sizeof(*pBundle));
-    if (!pBundle)
-        return VERR_NO_MEMORY;
-
-    /* take last entry. */
-    pBundle->cUsed++;
-    pBundle->aMem[RT_ELEMENTS(pBundle->aMem) - 1] = *pMem;
-
-    /* insert into list. */
-    RTSpinlockAcquire(pSession->Spinlock);
-    pBundle->pNext = pSession->Bundle.pNext;
-    pSession->Bundle.pNext = pBundle;
-    RTSpinlockRelease(pSession->Spinlock);
-
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Releases a memory object referenced by pointer and type.
- *
- * @returns IPRT status code.
- * @param   pSession    Session data.
- * @param   uPtr        Pointer to memory. This is matched against both the R0 and R3 addresses.
- * @param   eType       Memory type.
- */
-static int supdrvMemRelease(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, SUPDRVMEMREFTYPE eType)
-{
-    PSUPDRVBUNDLE pBundle;
-
-    /*
-     * Validate input.
-     */
-    if (!uPtr)
-    {
-        Log(("Illegal address %p\n", (void *)uPtr));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    /*
-     * Search for the address.
-     */
-    RTSpinlockAcquire(pSession->Spinlock);
-    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
-    {
-        if (pBundle->cUsed > 0)
-        {
-            unsigned i;
-            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
-            {
-                if (    pBundle->aMem[i].eType == eType
-                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
-                    &&  (   (RTHCUINTPTR)RTR0MemObjAddress(pBundle->aMem[i].MemObj) == uPtr
-                         || (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
-                             && RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == uPtr))
-                   )
-                {
-                    /* Make a copy of it and release it outside the spinlock. */
-                    SUPDRVMEMREF Mem = pBundle->aMem[i];
-                    pBundle->aMem[i].eType = MEMREF_TYPE_UNUSED;
-                    pBundle->aMem[i].MemObj = NIL_RTR0MEMOBJ;
-                    pBundle->aMem[i].MapObjR3 = NIL_RTR0MEMOBJ;
-                    RTSpinlockRelease(pSession->Spinlock);
-
-                    if (Mem.MapObjR3 != NIL_RTR0MEMOBJ)
-                    {
-                        int rc = RTR0MemObjFree(Mem.MapObjR3, false);
-                        AssertRC(rc); /** @todo figure out how to handle this. */
-                    }
-                    if (Mem.MemObj != NIL_RTR0MEMOBJ)
-                    {
-                        int rc = RTR0MemObjFree(Mem.MemObj, true /* fFreeMappings */);
-                        AssertRC(rc); /** @todo figure out how to handle this. */
-                    }
-                    return VINF_SUCCESS;
-                }
-            }
-        }
-    }
-    RTSpinlockRelease(pSession->Spinlock);
-    Log(("Failed to find %p!!! (eType=%d)\n", (void *)uPtr, eType));
-    return VERR_INVALID_PARAMETER;
-}
-
-
-/**
- * Opens an image. If it's the first time it's opened the call must upload
- * the bits using the supdrvIOCtl_LdrLoad() / SUPDRV_IOCTL_LDR_LOAD function.
- *
- * This is the 1st step of the loading.
- *
- * @returns IPRT status code.
- * @param   pDevExt     Device globals.
- * @param   pSession    Session data.
- * @param   pReq        The open request.
- */
-static int supdrvIOCtl_LdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDROPEN pReq)
-{
-    int             rc;
-    PSUPDRVLDRIMAGE pImage;
-    void           *pv;
-    size_t          cchName = strlen(pReq->u.In.szName); /* (caller checked < 32). */
-    LogFlow(("supdrvIOCtl_LdrOpen: szName=%s cbImageWithTabs=%d\n", pReq->u.In.szName, pReq->u.In.cbImageWithTabs));
-
-    /*
-     * Check if we got an instance of the image already.
-     */
-    supdrvLdrLock(pDevExt);
-    for (pImage = pDevExt->pLdrImages; pImage; pImage = pImage->pNext)
-    {
-        if (    pImage->szName[cchName] == '\0'
-            &&  !memcmp(pImage->szName, pReq->u.In.szName, cchName))
-        {
-            if (RT_LIKELY(pImage->cUsage < UINT32_MAX / 2U))
-            {
-                /** @todo check cbImageBits and cbImageWithTabs here, if they differs that indicates that the images are different. */
-                pImage->cUsage++;
-                pReq->u.Out.pvImageBase   = pImage->pvImage;
-                pReq->u.Out.fNeedsLoading = pImage->uState == SUP_IOCTL_LDR_OPEN;
-                pReq->u.Out.fNativeLoader = pImage->fNative;
-                supdrvLdrAddUsage(pSession, pImage);
-                supdrvLdrUnlock(pDevExt);
-                return VINF_SUCCESS;
-            }
-            supdrvLdrUnlock(pDevExt);
-            Log(("supdrvIOCtl_LdrOpen: To many existing references to '%s'!\n", pReq->u.In.szName));
-            return VERR_INTERNAL_ERROR_3; /** @todo add VERR_TOO_MANY_REFERENCES */
-        }
-    }
-    /* (not found - add it!) */
-
-    /* If the loader interface is locked down, make userland fail early */
-    if (pDevExt->fLdrLockedDown)
-    {
-        supdrvLdrUnlock(pDevExt);
-        Log(("supdrvIOCtl_LdrOpen: Not adding '%s' to image list, loader interface is locked down!\n", pReq->u.In.szName));
-        return VERR_PERMISSION_DENIED;
-    }
-
-    /*
-     * Allocate memory.
-     */
-    Assert(cchName < sizeof(pImage->szName));
-    pv = RTMemAlloc(sizeof(SUPDRVLDRIMAGE));
-    if (!pv)
-    {
-        supdrvLdrUnlock(pDevExt);
-        Log(("supdrvIOCtl_LdrOpen: RTMemAlloc() failed\n"));
-        return /*VERR_NO_MEMORY*/ VERR_INTERNAL_ERROR_2;
-    }
-
-    /*
-     * Setup and link in the LDR stuff.
-     */
-    pImage = (PSUPDRVLDRIMAGE)pv;
-    pImage->pvImage         = NULL;
-    pImage->pvImageAlloc    = NULL;
-    pImage->cbImageWithTabs = pReq->u.In.cbImageWithTabs;
-    pImage->cbImageBits     = pReq->u.In.cbImageBits;
-    pImage->cSymbols        = 0;
-    pImage->paSymbols       = NULL;
-    pImage->pachStrTab      = NULL;
-    pImage->cbStrTab        = 0;
-    pImage->pfnModuleInit   = NULL;
-    pImage->pfnModuleTerm   = NULL;
-    pImage->pfnServiceReqHandler = NULL;
-    pImage->uState          = SUP_IOCTL_LDR_OPEN;
-    pImage->cUsage          = 1;
-    pImage->pDevExt         = pDevExt;
-    memcpy(pImage->szName, pReq->u.In.szName, cchName + 1);
-
-    /*
-     * Try load it using the native loader, if that isn't supported, fall back
-     * on the older method.
-     */
-    pImage->fNative         = true;
-    rc = supdrvOSLdrOpen(pDevExt, pImage, pReq->u.In.szFilename);
-    if (rc == VERR_NOT_SUPPORTED)
-    {
-        pImage->pvImageAlloc = RTMemExecAlloc(pImage->cbImageBits + 31);
-        pImage->pvImage     = RT_ALIGN_P(pImage->pvImageAlloc, 32);
-        pImage->fNative     = false;
-        rc = pImage->pvImageAlloc ? VINF_SUCCESS : VERR_NO_EXEC_MEMORY;
-    }
-    if (RT_FAILURE(rc))
-    {
-        supdrvLdrUnlock(pDevExt);
-        RTMemFree(pImage);
-        Log(("supdrvIOCtl_LdrOpen(%s): failed - %Rrc\n", pReq->u.In.szName, rc));
-        return rc;
-    }
-    Assert(VALID_PTR(pImage->pvImage) || RT_FAILURE(rc));
-
-    /*
-     * Link it.
-     */
-    pImage->pNext           = pDevExt->pLdrImages;
-    pDevExt->pLdrImages     = pImage;
-
-    supdrvLdrAddUsage(pSession, pImage);
-
-    pReq->u.Out.pvImageBase   = pImage->pvImage;
-    pReq->u.Out.fNeedsLoading = true;
-    pReq->u.Out.fNativeLoader = pImage->fNative;
-    supdrvOSLdrNotifyOpened(pDevExt, pImage);
-
-    supdrvLdrUnlock(pDevExt);
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Worker that validates a pointer to an image entrypoint.
- *
- * @returns IPRT status code.
- * @param   pDevExt     The device globals.
- * @param   pImage      The loader image.
- * @param   pv          The pointer into the image.
- * @param   fMayBeNull  Whether it may be NULL.
- * @param   pszWhat     What is this entrypoint? (for logging)
- * @param   pbImageBits The image bits prepared by ring-3.
- *
- * @remarks Will leave the lock on failure.
- */
-static int supdrvLdrValidatePointer(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, void *pv,
-                                    bool fMayBeNull, const uint8_t *pbImageBits, const char *pszWhat)
-{
-    if (!fMayBeNull || pv)
-    {
-        if ((uintptr_t)pv - (uintptr_t)pImage->pvImage >= pImage->cbImageBits)
-        {
-            supdrvLdrUnlock(pDevExt);
-            Log(("Out of range (%p LB %#x): %s=%p\n", pImage->pvImage, pImage->cbImageBits, pszWhat, pv));
-            return VERR_INVALID_PARAMETER;
-        }
-
-        if (pImage->fNative)
-        {
-            int rc = supdrvOSLdrValidatePointer(pDevExt, pImage, pv, pbImageBits);
-            if (RT_FAILURE(rc))
-            {
-                supdrvLdrUnlock(pDevExt);
-                Log(("Bad entry point address: %s=%p (rc=%Rrc)\n", pszWhat, pv, rc));
-                return rc;
-            }
-        }
-    }
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Loads the image bits.
- *
- * This is the 2nd step of the loading.
- *
- * @returns IPRT status code.
- * @param   pDevExt     Device globals.
- * @param   pSession    Session data.
- * @param   pReq        The request.
- */
-static int supdrvIOCtl_LdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRLOAD pReq)
-{
-    PSUPDRVLDRUSAGE pUsage;
-    PSUPDRVLDRIMAGE pImage;
-    int             rc;
-    LogFlow(("supdrvIOCtl_LdrLoad: pvImageBase=%p cbImageWithBits=%d\n", pReq->u.In.pvImageBase, pReq->u.In.cbImageWithTabs));
-
-    /*
-     * Find the ldr image.
-     */
-    supdrvLdrLock(pDevExt);
-    pUsage = pSession->pLdrUsage;
-    while (pUsage && pUsage->pImage->pvImage != pReq->u.In.pvImageBase)
-        pUsage = pUsage->pNext;
-    if (!pUsage)
-    {
-        supdrvLdrUnlock(pDevExt);
-        Log(("SUP_IOCTL_LDR_LOAD: couldn't find image!\n"));
-        return VERR_INVALID_HANDLE;
-    }
-    pImage = pUsage->pImage;
-
-    /*
-     * Validate input.
-     */
-    if (   pImage->cbImageWithTabs != pReq->u.In.cbImageWithTabs
-        || pImage->cbImageBits     != pReq->u.In.cbImageBits)
-    {
-        supdrvLdrUnlock(pDevExt);
-        Log(("SUP_IOCTL_LDR_LOAD: image size mismatch!! %d(prep) != %d(load) or %d != %d\n",
-             pImage->cbImageWithTabs, pReq->u.In.cbImageWithTabs, pImage->cbImageBits, pReq->u.In.cbImageBits));
-        return VERR_INVALID_HANDLE;
-    }
-
-    if (pImage->uState != SUP_IOCTL_LDR_OPEN)
-    {
-        unsigned uState = pImage->uState;
-        supdrvLdrUnlock(pDevExt);
-        if (uState != SUP_IOCTL_LDR_LOAD)
-            AssertMsgFailed(("SUP_IOCTL_LDR_LOAD: invalid image state %d (%#x)!\n", uState, uState));
-        return VERR_ALREADY_LOADED;
-    }
-
-    /* If the loader interface is locked down, don't load new images */
-    if (pDevExt->fLdrLockedDown)
-    {
-        supdrvLdrUnlock(pDevExt);
-        Log(("SUP_IOCTL_LDR_LOAD: Not loading '%s' image bits, loader interface is locked down!\n", pImage->szName));
-        return VERR_PERMISSION_DENIED;
-    }
-
-    switch (pReq->u.In.eEPType)
-    {
-        case SUPLDRLOADEP_NOTHING:
-            break;
-
-        case SUPLDRLOADEP_VMMR0:
-            rc = supdrvLdrValidatePointer(    pDevExt, pImage, pReq->u.In.EP.VMMR0.pvVMMR0,          false, pReq->u.In.abImage, "pvVMMR0");
-            if (RT_SUCCESS(rc))
-                rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.EP.VMMR0.pvVMMR0EntryInt,  false, pReq->u.In.abImage, "pvVMMR0EntryInt");
-            if (RT_SUCCESS(rc))
-                rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.EP.VMMR0.pvVMMR0EntryFast, false, pReq->u.In.abImage, "pvVMMR0EntryFast");
-            if (RT_SUCCESS(rc))
-                rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.EP.VMMR0.pvVMMR0EntryEx,   false, pReq->u.In.abImage, "pvVMMR0EntryEx");
-            if (RT_FAILURE(rc))
-                return rc;
-            break;
-
-        case SUPLDRLOADEP_SERVICE:
-            rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.EP.Service.pfnServiceReq, false, pReq->u.In.abImage, "pfnServiceReq");
-            if (RT_FAILURE(rc))
-                return rc;
-            if (    pReq->u.In.EP.Service.apvReserved[0] != NIL_RTR0PTR
-                ||  pReq->u.In.EP.Service.apvReserved[1] != NIL_RTR0PTR
-                ||  pReq->u.In.EP.Service.apvReserved[2] != NIL_RTR0PTR)
-            {
-                supdrvLdrUnlock(pDevExt);
-                Log(("Out of range (%p LB %#x): apvReserved={%p,%p,%p} MBZ!\n",
-                     pImage->pvImage, pReq->u.In.cbImageWithTabs,
-                     pReq->u.In.EP.Service.apvReserved[0],
-                     pReq->u.In.EP.Service.apvReserved[1],
-                     pReq->u.In.EP.Service.apvReserved[2]));
-                return VERR_INVALID_PARAMETER;
-            }
-            break;
-
-        default:
-            supdrvLdrUnlock(pDevExt);
-            Log(("Invalid eEPType=%d\n", pReq->u.In.eEPType));
-            return VERR_INVALID_PARAMETER;
-    }
-
-    rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.pfnModuleInit, true, pReq->u.In.abImage, "pfnModuleInit");
-    if (RT_FAILURE(rc))
-        return rc;
-    rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.pfnModuleTerm, true, pReq->u.In.abImage, "pfnModuleTerm");
-    if (RT_FAILURE(rc))
-        return rc;
-
-    /*
-     * Allocate and copy the tables.
-     * (No need to do try/except as this is a buffered request.)
-     */
-    pImage->cbStrTab = pReq->u.In.cbStrTab;
-    if (pImage->cbStrTab)
-    {
-        pImage->pachStrTab = (char *)RTMemAlloc(pImage->cbStrTab);
-        if (pImage->pachStrTab)
-            memcpy(pImage->pachStrTab, &pReq->u.In.abImage[pReq->u.In.offStrTab], pImage->cbStrTab);
-        else
-            rc = /*VERR_NO_MEMORY*/ VERR_INTERNAL_ERROR_3;
-    }
-
-    pImage->cSymbols = pReq->u.In.cSymbols;
-    if (RT_SUCCESS(rc) && pImage->cSymbols)
-    {
-        size_t  cbSymbols = pImage->cSymbols * sizeof(SUPLDRSYM);
-        pImage->paSymbols = (PSUPLDRSYM)RTMemAlloc(cbSymbols);
-        if (pImage->paSymbols)
-            memcpy(pImage->paSymbols, &pReq->u.In.abImage[pReq->u.In.offSymbols], cbSymbols);
-        else
-            rc = /*VERR_NO_MEMORY*/ VERR_INTERNAL_ERROR_4;
-    }
-
-    /*
-     * Copy the bits / complete native loading.
-     */
-    if (RT_SUCCESS(rc))
-    {
-        pImage->uState = SUP_IOCTL_LDR_LOAD;
-        pImage->pfnModuleInit = pReq->u.In.pfnModuleInit;
-        pImage->pfnModuleTerm = pReq->u.In.pfnModuleTerm;
-
-        if (pImage->fNative)
-            rc = supdrvOSLdrLoad(pDevExt, pImage, pReq->u.In.abImage, pReq);
-        else
-        {
-            memcpy(pImage->pvImage, &pReq->u.In.abImage[0], pImage->cbImageBits);
-            Log(("vboxdrv: Loaded '%s' at %p\n", pImage->szName, pImage->pvImage));
-        }
-    }
-
-    /*
-     * Update any entry points.
-     */
-    if (RT_SUCCESS(rc))
-    {
-        switch (pReq->u.In.eEPType)
-        {
-            default:
-            case SUPLDRLOADEP_NOTHING:
-                rc = VINF_SUCCESS;
-                break;
-            case SUPLDRLOADEP_VMMR0:
-                rc = supdrvLdrSetVMMR0EPs(pDevExt, pReq->u.In.EP.VMMR0.pvVMMR0, pReq->u.In.EP.VMMR0.pvVMMR0EntryInt,
-                                          pReq->u.In.EP.VMMR0.pvVMMR0EntryFast, pReq->u.In.EP.VMMR0.pvVMMR0EntryEx);
-                break;
-            case SUPLDRLOADEP_SERVICE:
-                pImage->pfnServiceReqHandler = pReq->u.In.EP.Service.pfnServiceReq;
-                rc = VINF_SUCCESS;
-                break;
-        }
-    }
-
-    /*
-     * On success call the module initialization.
-     */
-    LogFlow(("supdrvIOCtl_LdrLoad: pfnModuleInit=%p\n", pImage->pfnModuleInit));
-    if (RT_SUCCESS(rc) && pImage->pfnModuleInit)
-    {
-        Log(("supdrvIOCtl_LdrLoad: calling pfnModuleInit=%p\n", pImage->pfnModuleInit));
-        pDevExt->pLdrInitImage  = pImage;
-        pDevExt->hLdrInitThread = RTThreadNativeSelf();
-        rc = pImage->pfnModuleInit(pImage);
-        pDevExt->pLdrInitImage  = NULL;
-        pDevExt->hLdrInitThread = NIL_RTNATIVETHREAD;
-        if (RT_FAILURE(rc) && pDevExt->pvVMMR0 == pImage->pvImage)
-            supdrvLdrUnsetVMMR0EPs(pDevExt);
-    }
-
-    if (RT_FAILURE(rc))
-    {
-        /* Inform the tracing component in case ModuleInit registered TPs. */
-        supdrvTracerModuleUnloading(pDevExt, pImage);
-
-        pImage->uState              = SUP_IOCTL_LDR_OPEN;
-        pImage->pfnModuleInit       = NULL;
-        pImage->pfnModuleTerm       = NULL;
-        pImage->pfnServiceReqHandler= NULL;
-        pImage->cbStrTab            = 0;
-        RTMemFree(pImage->pachStrTab);
-        pImage->pachStrTab          = NULL;
-        RTMemFree(pImage->paSymbols);
-        pImage->paSymbols           = NULL;
-        pImage->cSymbols            = 0;
-    }
-
-    supdrvLdrUnlock(pDevExt);
-    return rc;
-}
-
-
-/**
- * Frees a previously loaded (prep'ed) image.
- *
- * @returns IPRT status code.
- * @param   pDevExt     Device globals.
- * @param   pSession    Session data.
- * @param   pReq        The request.
- */
-static int supdrvIOCtl_LdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRFREE pReq)
-{
-    int             rc;
-    PSUPDRVLDRUSAGE pUsagePrev;
-    PSUPDRVLDRUSAGE pUsage;
-    PSUPDRVLDRIMAGE pImage;
-    LogFlow(("supdrvIOCtl_LdrFree: pvImageBase=%p\n", pReq->u.In.pvImageBase));
-
-    /*
-     * Find the ldr image.
-     */
-    supdrvLdrLock(pDevExt);
-    pUsagePrev = NULL;
-    pUsage = pSession->pLdrUsage;
-    while (pUsage && pUsage->pImage->pvImage != pReq->u.In.pvImageBase)
-    {
-        pUsagePrev = pUsage;
-        pUsage = pUsage->pNext;
-    }
-    if (!pUsage)
-    {
-        supdrvLdrUnlock(pDevExt);
-        Log(("SUP_IOCTL_LDR_FREE: couldn't find image!\n"));
-        return VERR_INVALID_HANDLE;
-    }
-
-    /*
-     * Check if we can remove anything.
-     */
-    rc = VINF_SUCCESS;
-    pImage = pUsage->pImage;
-    if (pImage->cUsage <= 1 || pUsage->cUsage <= 1)
-    {
-        /*
-         * Check if there are any objects with destructors in the image, if
-         * so leave it for the session cleanup routine so we get a chance to
-         * clean things up in the right order and not leave them all dangling.
-         */
-        RTSpinlockAcquire(pDevExt->Spinlock);
-        if (pImage->cUsage <= 1)
-        {
-            PSUPDRVOBJ pObj;
-            for (pObj = pDevExt->pObjs; pObj; pObj = pObj->pNext)
-                if (RT_UNLIKELY((uintptr_t)pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImageBits))
-                {
-                    rc = VERR_DANGLING_OBJECTS;
-                    break;
-                }
-        }
-        else
-        {
-            PSUPDRVUSAGE pGenUsage;
-            for (pGenUsage = pSession->pUsage; pGenUsage; pGenUsage = pGenUsage->pNext)
-                if (RT_UNLIKELY((uintptr_t)pGenUsage->pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImageBits))
-                {
-                    rc = VERR_DANGLING_OBJECTS;
-                    break;
-                }
-        }
-        RTSpinlockRelease(pDevExt->Spinlock);
-        if (rc == VINF_SUCCESS)
-        {
-            /* unlink it */
-            if (pUsagePrev)
-                pUsagePrev->pNext = pUsage->pNext;
-            else
-                pSession->pLdrUsage = pUsage->pNext;
-
-            /* free it */
-            pUsage->pImage = NULL;
-            pUsage->pNext = NULL;
-            RTMemFree(pUsage);
-
-            /*
-             * Dereference the image.
-             */
-            if (pImage->cUsage <= 1)
-                supdrvLdrFree(pDevExt, pImage);
-            else
-                pImage->cUsage--;
-        }
-        else
-        {
-            Log(("supdrvIOCtl_LdrFree: Dangling objects in %p/%s!\n", pImage->pvImage, pImage->szName));
-            rc = VINF_SUCCESS; /** @todo BRANCH-2.1: remove this after branching. */
-        }
-    }
-    else
-    {
-        /*
-         * Dereference both image and usage.
-         */
-        pImage->cUsage--;
-        pUsage->cUsage--;
-    }
-
-    supdrvLdrUnlock(pDevExt);
-    return rc;
-}
-
-
-/**
- * Lock down the image loader interface.
- *
- * @returns IPRT status code.
- * @param   pDevExt     Device globals.
- */
-static int supdrvIOCtl_LdrLockDown(PSUPDRVDEVEXT pDevExt)
-{
-    LogFlow(("supdrvIOCtl_LdrLockDown:\n"));
-
-    supdrvLdrLock(pDevExt);
-    if (!pDevExt->fLdrLockedDown)
-    {
-        pDevExt->fLdrLockedDown = true;
-        Log(("supdrvIOCtl_LdrLockDown: Image loader interface locked down\n"));
-    }
-    supdrvLdrUnlock(pDevExt);
-
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Gets the address of a symbol in an open image.
- *
- * @returns IPRT status code.
- * @param   pDevExt     Device globals.
- * @param   pSession    Session data.
- * @param   pReq        The request buffer.
- */
-static int supdrvIOCtl_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRGETSYMBOL pReq)
-{
-    PSUPDRVLDRIMAGE pImage;
-    PSUPDRVLDRUSAGE pUsage;
-    uint32_t        i;
-    PSUPLDRSYM      paSyms;
-    const char     *pchStrings;
-    const size_t    cbSymbol = strlen(pReq->u.In.szSymbol) + 1;
-    void           *pvSymbol = NULL;
-    int             rc = VERR_GENERAL_FAILURE;
-    Log3(("supdrvIOCtl_LdrGetSymbol: pvImageBase=%p szSymbol=\"%s\"\n", pReq->u.In.pvImageBase, pReq->u.In.szSymbol));
-
-    /*
-     * Find the ldr image.
-     */
-    supdrvLdrLock(pDevExt);
-    pUsage = pSession->pLdrUsage;
-    while (pUsage && pUsage->pImage->pvImage != pReq->u.In.pvImageBase)
-        pUsage = pUsage->pNext;
-    if (!pUsage)
-    {
-        supdrvLdrUnlock(pDevExt);
-        Log(("SUP_IOCTL_LDR_GET_SYMBOL: couldn't find image!\n"));
-        return VERR_INVALID_HANDLE;
-    }
-    pImage = pUsage->pImage;
-    if (pImage->uState != SUP_IOCTL_LDR_LOAD)
-    {
-        unsigned uState = pImage->uState;
-        supdrvLdrUnlock(pDevExt);
-        Log(("SUP_IOCTL_LDR_GET_SYMBOL: invalid image state %d (%#x)!\n", uState, uState)); NOREF(uState);
-        return VERR_ALREADY_LOADED;
-    }
-
-    /*
-     * Search the symbol strings.
-     *
-     * Note! The int32_t is for native loading on solaris where the data
-     *       and text segments are in very different places.
-     */
-    pchStrings = pImage->pachStrTab;
-    paSyms     = pImage->paSymbols;
-    for (i = 0; i < pImage->cSymbols; i++)
-    {
-        if (    paSyms[i].offName + cbSymbol <= pImage->cbStrTab
-            &&  !memcmp(pchStrings + paSyms[i].offName, pReq->u.In.szSymbol, cbSymbol))
-        {
-            pvSymbol = (uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol;
-            rc = VINF_SUCCESS;
-            break;
-        }
-    }
-    supdrvLdrUnlock(pDevExt);
-    pReq->u.Out.pvSymbol = pvSymbol;
-    return rc;
-}
-
-
-/**
- * Gets the address of a symbol in an open image or the support driver.
- *
- * @returns VINF_SUCCESS on success.
- * @returns
- * @param   pDevExt     Device globals.
- * @param   pSession    Session data.
- * @param   pReq        The request buffer.
- */
-static int supdrvIDC_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQGETSYM pReq)
-{
-    int             rc = VINF_SUCCESS;
-    const char     *pszSymbol = pReq->u.In.pszSymbol;
-    const char     *pszModule = pReq->u.In.pszModule;
-    size_t          cbSymbol;
-    char const     *pszEnd;
-    uint32_t        i;
-
-    /*
-     * Input validation.
-     */
-    AssertPtrReturn(pszSymbol, VERR_INVALID_POINTER);
-    pszEnd = RTStrEnd(pszSymbol, 512);
-    AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
-    cbSymbol = pszEnd - pszSymbol + 1;
-
-    if (pszModule)
-    {
-        AssertPtrReturn(pszModule, VERR_INVALID_POINTER);
-        pszEnd = RTStrEnd(pszModule, 64);
-        AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
-    }
-    Log3(("supdrvIDC_LdrGetSymbol: pszModule=%p:{%s} pszSymbol=%p:{%s}\n", pszModule, pszModule, pszSymbol, pszSymbol));
-
-
-    if (    !pszModule
-        ||  !strcmp(pszModule, "SupDrv"))
-    {
-        /*
-         * Search the support driver export table.
-         */
-        for (i = 0; i < RT_ELEMENTS(g_aFunctions); i++)
-            if (!strcmp(g_aFunctions[i].szName, pszSymbol))
-            {
-                pReq->u.Out.pfnSymbol = g_aFunctions[i].pfn;
-                break;
-            }
-    }
-    else
-    {
-        /*
-         * Find the loader image.
-         */
-        PSUPDRVLDRIMAGE pImage;
-
-        supdrvLdrLock(pDevExt);
-
-        for (pImage = pDevExt->pLdrImages; pImage; pImage = pImage->pNext)
-            if (!strcmp(pImage->szName, pszModule))
-                break;
-        if (pImage && pImage->uState == SUP_IOCTL_LDR_LOAD)
-        {
-            /*
-             * Search the symbol strings.
-             */
-            const char *pchStrings = pImage->pachStrTab;
-            PCSUPLDRSYM paSyms     = pImage->paSymbols;
-            for (i = 0; i < pImage->cSymbols; i++)
-            {
-                if (    paSyms[i].offName + cbSymbol <= pImage->cbStrTab
-                    &&  !memcmp(pchStrings + paSyms[i].offName, pszSymbol, cbSymbol))
-                {
-                    /*
-                     * Found it! Calc the symbol address and add a reference to the module.
-                     */
-                    pReq->u.Out.pfnSymbol = (PFNRT)((uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol);
-                    rc = supdrvLdrAddUsage(pSession, pImage);
-                    break;
-                }
-            }
-        }
-        else
-            rc = pImage ? VERR_WRONG_ORDER : VERR_MODULE_NOT_FOUND;
-
-        supdrvLdrUnlock(pDevExt);
-    }
-    return rc;
-}
-
-
-/**
- * Updates the VMMR0 entry point pointers.
- *
- * @returns IPRT status code.
- * @param   pDevExt             Device globals.
- * @param   pSession            Session data.
- * @param   pVMMR0              VMMR0 image handle.
- * @param   pvVMMR0EntryInt     VMMR0EntryInt address.
- * @param   pvVMMR0EntryFast    VMMR0EntryFast address.
- * @param   pvVMMR0EntryEx      VMMR0EntryEx address.
- * @remark  Caller must own the loader mutex.
- */
-static int supdrvLdrSetVMMR0EPs(PSUPDRVDEVEXT pDevExt, void *pvVMMR0, void *pvVMMR0EntryInt, void *pvVMMR0EntryFast, void *pvVMMR0EntryEx)
-{
-    int rc = VINF_SUCCESS;
-    LogFlow(("supdrvLdrSetR0EP pvVMMR0=%p pvVMMR0EntryInt=%p\n", pvVMMR0, pvVMMR0EntryInt));
-
-
-    /*
-     * Check if not yet set.
-     */
-    if (!pDevExt->pvVMMR0)
-    {
-        pDevExt->pvVMMR0            = pvVMMR0;
-        pDevExt->pfnVMMR0EntryInt   = pvVMMR0EntryInt;
-        pDevExt->pfnVMMR0EntryFast  = pvVMMR0EntryFast;
-        pDevExt->pfnVMMR0EntryEx    = pvVMMR0EntryEx;
-    }
-    else
-    {
-        /*
-         * Return failure or success depending on whether the values match or not.
-         */
-        if (    pDevExt->pvVMMR0 != pvVMMR0
-            ||  (void *)pDevExt->pfnVMMR0EntryInt   != pvVMMR0EntryInt
-            ||  (void *)pDevExt->pfnVMMR0EntryFast  != pvVMMR0EntryFast
-            ||  (void *)pDevExt->pfnVMMR0EntryEx    != pvVMMR0EntryEx)
-        {
-            AssertMsgFailed(("SUP_IOCTL_LDR_SETR0EP: Already set pointing to a different module!\n"));
-            rc = VERR_INVALID_PARAMETER;
-        }
-    }
-    return rc;
-}
-
-
-/**
- * Unsets the VMMR0 entry point installed by supdrvLdrSetR0EP.
- *
- * @param   pDevExt     Device globals.
- */
-static void supdrvLdrUnsetVMMR0EPs(PSUPDRVDEVEXT pDevExt)
-{
-    pDevExt->pvVMMR0            = NULL;
-    pDevExt->pfnVMMR0EntryInt   = NULL;
-    pDevExt->pfnVMMR0EntryFast  = NULL;
-    pDevExt->pfnVMMR0EntryEx    = NULL;
-}
-
-
-/**
- * Adds a usage reference in the specified session of an image.
- *
- * Called while owning the loader semaphore.
- *
- * @returns VINF_SUCCESS on success and VERR_NO_MEMORY on failure.
- * @param   pSession    Session in question.
- * @param   pImage      Image which the session is using.
- */
-static int supdrvLdrAddUsage(PSUPDRVSESSION pSession, PSUPDRVLDRIMAGE pImage)
-{
-    PSUPDRVLDRUSAGE pUsage;
-    LogFlow(("supdrvLdrAddUsage: pImage=%p\n", pImage));
-
-    /*
-     * Referenced it already?
-     */
-    pUsage = pSession->pLdrUsage;
-    while (pUsage)
-    {
-        if (pUsage->pImage == pImage)
-        {
-            pUsage->cUsage++;
-            return VINF_SUCCESS;
-        }
-        pUsage = pUsage->pNext;
-    }
-
-    /*
-     * Allocate new usage record.
-     */
-    pUsage = (PSUPDRVLDRUSAGE)RTMemAlloc(sizeof(*pUsage));
-    AssertReturn(pUsage, /*VERR_NO_MEMORY*/ VERR_INTERNAL_ERROR_5);
-    pUsage->cUsage = 1;
-    pUsage->pImage = pImage;
-    pUsage->pNext  = pSession->pLdrUsage;
-    pSession->pLdrUsage = pUsage;
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Frees a load image.
- *
- * @param   pDevExt     Pointer to device extension.
- * @param   pImage      Pointer to the image we're gonna free.
- *                      This image must exit!
- * @remark  The caller MUST own SUPDRVDEVEXT::mtxLdr!
- */
-static void supdrvLdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
-{
-    PSUPDRVLDRIMAGE pImagePrev;
-    LogFlow(("supdrvLdrFree: pImage=%p\n", pImage));
-
-    /*
-     * Warn if we're releasing images while the image loader interface is
-     * locked down -- we won't be able to reload them!
-     */
-    if (pDevExt->fLdrLockedDown)
-        Log(("supdrvLdrFree: Warning: unloading '%s' image, while loader interface is locked down!\n", pImage->szName));
-
-    /* find it - arg. should've used doubly linked list. */
-    Assert(pDevExt->pLdrImages);
-    pImagePrev = NULL;
-    if (pDevExt->pLdrImages != pImage)
-    {
-        pImagePrev = pDevExt->pLdrImages;
-        while (pImagePrev->pNext != pImage)
-            pImagePrev = pImagePrev->pNext;
-        Assert(pImagePrev->pNext == pImage);
-    }
-
-    /* unlink */
-    if (pImagePrev)
-        pImagePrev->pNext = pImage->pNext;
-    else
-        pDevExt->pLdrImages = pImage->pNext;
-
-    /* check if this is VMMR0.r0 unset its entry point pointers. */
-    if (pDevExt->pvVMMR0 == pImage->pvImage)
-        supdrvLdrUnsetVMMR0EPs(pDevExt);
-
-    /* check for objects with destructors in this image. (Shouldn't happen.) */
-    if (pDevExt->pObjs)
-    {
-        unsigned        cObjs = 0;
-        PSUPDRVOBJ      pObj;
-        RTSpinlockAcquire(pDevExt->Spinlock);
-        for (pObj = pDevExt->pObjs; pObj; pObj = pObj->pNext)
-            if (RT_UNLIKELY((uintptr_t)pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImageBits))
-            {
-                pObj->pfnDestructor = NULL;
-                cObjs++;
-            }
-        RTSpinlockRelease(pDevExt->Spinlock);
-        if (cObjs)
-            OSDBGPRINT(("supdrvLdrFree: Image '%s' has %d dangling objects!\n", pImage->szName, cObjs));
-    }
-
-    /* call termination function if fully loaded. */
-    if (    pImage->pfnModuleTerm
-        &&  pImage->uState == SUP_IOCTL_LDR_LOAD)
-    {
-        LogFlow(("supdrvIOCtl_LdrLoad: calling pfnModuleTerm=%p\n", pImage->pfnModuleTerm));
-        pImage->pfnModuleTerm(pImage);
-    }
-
-    /* Inform the tracing component. */
-    supdrvTracerModuleUnloading(pDevExt, pImage);
-
-    /* do native unload if appropriate. */
-    if (pImage->fNative)
-        supdrvOSLdrUnload(pDevExt, pImage);
-
-    /* free the image */
-    pImage->cUsage  = 0;
-    pImage->pDevExt = NULL;
-    pImage->pNext   = NULL;
-    pImage->uState  = SUP_IOCTL_LDR_FREE;
-    RTMemExecFree(pImage->pvImageAlloc, pImage->cbImageBits + 31);
-    pImage->pvImageAlloc = NULL;
-    RTMemFree(pImage->pachStrTab);
-    pImage->pachStrTab = NULL;
-    RTMemFree(pImage->paSymbols);
-    pImage->paSymbols = NULL;
-    RTMemFree(pImage);
-}
-
-
-/**
- * Acquires the loader lock.
- *
- * @returns IPRT status code.
- * @param   pDevExt         The device extension.
- */
-DECLINLINE(int) supdrvLdrLock(PSUPDRVDEVEXT pDevExt)
-{
-#ifdef SUPDRV_USE_MUTEX_FOR_LDR
-    int rc = RTSemMutexRequest(pDevExt->mtxLdr, RT_INDEFINITE_WAIT);
-#else
-    int rc = RTSemFastMutexRequest(pDevExt->mtxLdr);
-#endif
-    AssertRC(rc);
-    return rc;
-}
-
-
-/**
- * Releases the loader lock.
- *
- * @returns IPRT status code.
- * @param   pDevExt         The device extension.
- */
-DECLINLINE(int) supdrvLdrUnlock(PSUPDRVDEVEXT pDevExt)
-{
-#ifdef SUPDRV_USE_MUTEX_FOR_LDR
-    return RTSemMutexRelease(pDevExt->mtxLdr);
-#else
-    return RTSemFastMutexRelease(pDevExt->mtxLdr);
-#endif
-}
-
-
-/**
- * Implements the service call request.
- *
- * @returns VBox status code.
- * @param   pDevExt         The device extension.
- * @param   pSession        The calling session.
- * @param   pReq            The request packet, valid.
- */
-static int supdrvIOCtl_CallServiceModule(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPCALLSERVICE pReq)
-{
-#if !defined(RT_OS_WINDOWS) || defined(RT_ARCH_AMD64) || defined(DEBUG)
-    int rc;
-
-    /*
-     * Find the module first in the module referenced by the calling session.
-     */
-    rc = supdrvLdrLock(pDevExt);
-    if (RT_SUCCESS(rc))
-    {
-        PFNSUPR0SERVICEREQHANDLER   pfnServiceReqHandler = NULL;
-        PSUPDRVLDRUSAGE             pUsage;
-
-        for (pUsage = pSession->pLdrUsage; pUsage; pUsage = pUsage->pNext)
-            if (    pUsage->pImage->pfnServiceReqHandler
-                &&  !strcmp(pUsage->pImage->szName, pReq->u.In.szName))
-            {
-                pfnServiceReqHandler = pUsage->pImage->pfnServiceReqHandler;
-                break;
-            }
-        supdrvLdrUnlock(pDevExt);
-
-        if (pfnServiceReqHandler)
-        {
-            /*
-             * Call it.
-             */
-            if (pReq->Hdr.cbIn == SUP_IOCTL_CALL_SERVICE_SIZE(0))
-                rc = pfnServiceReqHandler(pSession, pReq->u.In.uOperation, pReq->u.In.u64Arg, NULL);
-            else
-                rc = pfnServiceReqHandler(pSession, pReq->u.In.uOperation, pReq->u.In.u64Arg, (PSUPR0SERVICEREQHDR)&pReq->abReqPkt[0]);
-        }
-        else
-            rc = VERR_SUPDRV_SERVICE_NOT_FOUND;
-    }
-
-    /* log it */
-    if (    RT_FAILURE(rc)
-        &&  rc != VERR_INTERRUPTED
-        &&  rc != VERR_TIMEOUT)
-        Log(("SUP_IOCTL_CALL_SERVICE: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-             rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-    else
-        Log4(("SUP_IOCTL_CALL_SERVICE: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
-              rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
-    return rc;
-#else  /* RT_OS_WINDOWS && !RT_ARCH_AMD64 && !DEBUG */
-    return VERR_NOT_IMPLEMENTED;
-#endif /* RT_OS_WINDOWS && !RT_ARCH_AMD64 && !DEBUG */
-}
-
-
-/**
- * Implements the logger settings request.
- *
- * @returns VBox status code.
- * @param   pDevExt     The device extension.
- * @param   pSession    The caller's session.
- * @param   pReq        The request.
- */
-static int supdrvIOCtl_LoggerSettings(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLOGGERSETTINGS pReq)
-{
-    const char *pszGroup = &pReq->u.In.szStrings[pReq->u.In.offGroups];
-    const char *pszFlags = &pReq->u.In.szStrings[pReq->u.In.offFlags];
-    const char *pszDest  = &pReq->u.In.szStrings[pReq->u.In.offDestination];
-    PRTLOGGER   pLogger  = NULL;
-    int         rc;
-
-    /*
-     * Some further validation.
-     */
-    switch (pReq->u.In.fWhat)
-    {
-        case SUPLOGGERSETTINGS_WHAT_SETTINGS:
-        case SUPLOGGERSETTINGS_WHAT_CREATE:
-            break;
-
-        case SUPLOGGERSETTINGS_WHAT_DESTROY:
-            if (*pszGroup || *pszFlags || *pszDest)
-                return VERR_INVALID_PARAMETER;
-            if (pReq->u.In.fWhich == SUPLOGGERSETTINGS_WHICH_RELEASE)
-                return VERR_ACCESS_DENIED;
-            break;
-
-        default:
-            return VERR_INTERNAL_ERROR;
-    }
-
-    /*
-     * Get the logger.
-     */
-    switch (pReq->u.In.fWhich)
-    {
-        case SUPLOGGERSETTINGS_WHICH_DEBUG:
-            pLogger = RTLogGetDefaultInstance();
-            break;
-
-        case SUPLOGGERSETTINGS_WHICH_RELEASE:
-            pLogger = RTLogRelDefaultInstance();
-            break;
-
-        default:
-            return VERR_INTERNAL_ERROR;
-    }
-
-    /*
-     * Do the job.
-     */
-    switch (pReq->u.In.fWhat)
-    {
-        case SUPLOGGERSETTINGS_WHAT_SETTINGS:
-            if (pLogger)
-            {
-                rc = RTLogFlags(pLogger, pszFlags);
-                if (RT_SUCCESS(rc))
-                    rc = RTLogGroupSettings(pLogger, pszGroup);
-                NOREF(pszDest);
-            }
-            else
-                rc = VERR_NOT_FOUND;
-            break;
-
-        case SUPLOGGERSETTINGS_WHAT_CREATE:
-        {
-            if (pLogger)
-                rc = VERR_ALREADY_EXISTS;
-            else
-            {
-                static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
-
-                rc = RTLogCreate(&pLogger,
-                                 0 /* fFlags */,
-                                 pszGroup,
-                                 pReq->u.In.fWhich == SUPLOGGERSETTINGS_WHICH_DEBUG
-                                 ? "VBOX_LOG"
-                                 : "VBOX_RELEASE_LOG",
-                                 RT_ELEMENTS(s_apszGroups),
-                                 s_apszGroups,
-                                 RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER,
-                                 NULL);
-                if (RT_SUCCESS(rc))
-                {
-                    rc = RTLogFlags(pLogger, pszFlags);
-                    NOREF(pszDest);
-                    if (RT_SUCCESS(rc))
-                    {
-                        switch (pReq->u.In.fWhich)
-                        {
-                            case SUPLOGGERSETTINGS_WHICH_DEBUG:
-                                pLogger = RTLogSetDefaultInstance(pLogger);
-                                break;
-                            case SUPLOGGERSETTINGS_WHICH_RELEASE:
-                                pLogger = RTLogRelSetDefaultInstance(pLogger);
-                                break;
-                        }
-                    }
-                    RTLogDestroy(pLogger);
-                }
-            }
-            break;
-        }
-
-        case SUPLOGGERSETTINGS_WHAT_DESTROY:
-            switch (pReq->u.In.fWhich)
-            {
-                case SUPLOGGERSETTINGS_WHICH_DEBUG:
-                    pLogger = RTLogSetDefaultInstance(NULL);
-                    break;
-                case SUPLOGGERSETTINGS_WHICH_RELEASE:
-                    pLogger = RTLogRelSetDefaultInstance(NULL);
-                    break;
-            }
-            rc = RTLogDestroy(pLogger);
-            break;
-
-        default:
-        {
-            rc = VERR_INTERNAL_ERROR;
-            break;
-        }
-    }
-
-    return rc;
-}
-
-
-/**
- * Determines whether the host system has an invariant TSC.
- *
- * @remarks Once, called use g_fIsInvariantTsc. It is not
- *          expected to change at runtime.
- */
-static void supdrvDetermineInvariantTsc(void)
-{
-    if (ASMHasCpuId())
-    {
-        uint32_t uEax, uEbx, uEcx, uEdx;
-        ASMCpuId(0x80000000, &uEax, &uEbx, &uEcx, &uEdx);
-        if (uEax >= 0x80000007)
-        {
-            ASMCpuId(0x80000007, &uEax, &uEbx, &uEcx, &uEdx);
-            if (uEdx & X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR)
-                g_fIsInvariantTsc = true;
-        }
-    }
-}
-
-
-/**
- * Creates the GIP.
- *
- * @returns VBox status code.
- * @param   pDevExt     Instance data. GIP stuff may be updated.
- */
-static int supdrvGipCreate(PSUPDRVDEVEXT pDevExt)
-{
-    PSUPGLOBALINFOPAGE  pGip;
-    RTHCPHYS            HCPhysGip;
-    uint32_t            u32SystemResolution;
-    uint32_t            u32Interval;
-    unsigned            cCpus;
-    int                 rc;
-
-
-    LogFlow(("supdrvGipCreate:\n"));
-
-    /* assert order */
-    Assert(pDevExt->u32SystemTimerGranularityGrant == 0);
-    Assert(pDevExt->GipMemObj == NIL_RTR0MEMOBJ);
-    Assert(!pDevExt->pGipTimer);
-
-    /*
-     * Check the CPU count.
-     */
-    cCpus = RTMpGetArraySize();
-    if (   cCpus > RTCPUSET_MAX_CPUS
-        || cCpus > 256 /*ApicId is used for the mappings*/)
-    {
-        SUPR0Printf("VBoxDrv: Too many CPUs (%u) for the GIP (max %u)\n", cCpus, RT_MIN(RTCPUSET_MAX_CPUS, 256));
-        return VERR_TOO_MANY_CPUS;
-    }
-
-    /*
-     * Allocate a contiguous set of pages with a default kernel mapping.
-     */
-    rc = RTR0MemObjAllocCont(&pDevExt->GipMemObj, RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs[cCpus]), false /*fExecutable*/);
-    if (RT_FAILURE(rc))
-    {
-        OSDBGPRINT(("supdrvGipCreate: failed to allocate the GIP page. rc=%d\n", rc));
-        return rc;
-    }
-    pGip = (PSUPGLOBALINFOPAGE)RTR0MemObjAddress(pDevExt->GipMemObj); AssertPtr(pGip);
-    HCPhysGip = RTR0MemObjGetPagePhysAddr(pDevExt->GipMemObj, 0); Assert(HCPhysGip != NIL_RTHCPHYS);
-
-    supdrvDetermineInvariantTsc();
-
-    /*
-     * Find a reasonable update interval and initialize the structure.
-     */
-    supdrvGipRequestHigherTimerFrequencyFromSystem(pDevExt);
-    u32Interval = u32SystemResolution = RTTimerGetSystemGranularity();
-    while (u32Interval < 10000000 /* 10 ms */)
-        u32Interval += u32SystemResolution;
-
-    supdrvGipInit(pDevExt, pGip, HCPhysGip, RTTimeSystemNanoTS(), RT_NS_1SEC / u32Interval /*=Hz*/, u32Interval, cCpus);
-
-    /*
-     * Create the timer.
-     * If CPU_ALL isn't supported we'll have to fall back to synchronous mode.
-     */
-    if (pGip->u32Mode == SUPGIPMODE_ASYNC_TSC)
-    {
-        rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, RTTIMER_FLAGS_CPU_ALL, supdrvGipAsyncTimer, pDevExt);
-        if (rc == VERR_NOT_SUPPORTED)
-        {
-            OSDBGPRINT(("supdrvGipCreate: omni timer not supported, falling back to synchronous mode\n"));
-            pGip->u32Mode = SUPGIPMODE_SYNC_TSC;
-        }
-    }
-    if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
-        rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, 0 /* fFlags */, supdrvGipSyncTimer, pDevExt);
-    if (RT_SUCCESS(rc))
-    {
-        rc = RTMpNotificationRegister(supdrvGipMpEvent, pDevExt);
-        if (RT_SUCCESS(rc))
-        {
-            rc = RTMpOnAll(supdrvGipInitOnCpu, pDevExt, pGip);
-            if (RT_SUCCESS(rc))
-            {
-                /*
-                 * We're good.
-                 */
-                Log(("supdrvGipCreate: %u ns interval.\n", u32Interval));
-                supdrvGipReleaseHigherTimerFrequencyFromSystem(pDevExt);
-
-                g_pSUPGlobalInfoPage = pGip;
-                return VINF_SUCCESS;
-            }
-
-            OSDBGPRINT(("supdrvGipCreate: RTMpOnAll failed with rc=%Rrc\n", rc));
-            RTMpNotificationDeregister(supdrvGipMpEvent, pDevExt);
-
-        }
-        else
-            OSDBGPRINT(("supdrvGipCreate: failed to register MP event notfication. rc=%Rrc\n", rc));
-    }
-    else
-    {
-        OSDBGPRINT(("supdrvGipCreate: failed create GIP timer at %u ns interval. rc=%Rrc\n", u32Interval, rc));
-        Assert(!pDevExt->pGipTimer);
-    }
-    supdrvGipDestroy(pDevExt); /* Releases timer frequency increase too. */
-    return rc;
-}
-
-
-/**
- * Terminates the GIP.
- *
- * @param   pDevExt     Instance data. GIP stuff may be updated.
- */
-static void supdrvGipDestroy(PSUPDRVDEVEXT pDevExt)
-{
-    int rc;
-#ifdef DEBUG_DARWIN_GIP
-    OSDBGPRINT(("supdrvGipDestroy: pDevExt=%p pGip=%p pGipTimer=%p GipMemObj=%p\n", pDevExt,
-                pDevExt->GipMemObj != NIL_RTR0MEMOBJ ? RTR0MemObjAddress(pDevExt->GipMemObj) : NULL,
-                pDevExt->pGipTimer, pDevExt->GipMemObj));
-#endif
-
-    /*
-     * Invalid the GIP data.
-     */
-    if (pDevExt->pGip)
-    {
-        supdrvGipTerm(pDevExt->pGip);
-        pDevExt->pGip = NULL;
-    }
-    g_pSUPGlobalInfoPage = NULL;
-
-    /*
-     * Destroy the timer and free the GIP memory object.
-     */
-    if (pDevExt->pGipTimer)
-    {
-        rc = RTTimerDestroy(pDevExt->pGipTimer); AssertRC(rc);
-        pDevExt->pGipTimer = NULL;
-    }
-
-    if (pDevExt->GipMemObj != NIL_RTR0MEMOBJ)
-    {
-        rc = RTR0MemObjFree(pDevExt->GipMemObj, true /* free mappings */); AssertRC(rc);
-        pDevExt->GipMemObj = NIL_RTR0MEMOBJ;
-    }
-
-    /*
-     * Finally, make sure we've release the system timer resolution request
-     * if one actually succeeded and is still pending.
-     */
-    supdrvGipReleaseHigherTimerFrequencyFromSystem(pDevExt);
-}
-
-
-/**
- * Timer callback function sync GIP mode.
- * @param   pTimer      The timer.
- * @param   pvUser      The device extension.
- */
-static DECLCALLBACK(void) supdrvGipSyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick)
-{
-    RTCCUINTREG     fOldFlags;
-    uint64_t        u64TSC;
-    uint64_t        NanoTS;
-    PSUPDRVDEVEXT   pDevExt = (PSUPDRVDEVEXT)pvUser;
-
-    fOldFlags = ASMIntDisableFlags(); /* No interruptions please (real problem on S10). */
-    u64TSC    = ASMReadTSC();
-    NanoTS    = RTTimeSystemNanoTS();
-
-    supdrvGipUpdate(pDevExt, NanoTS, u64TSC, NIL_RTCPUID, iTick);
-
-    ASMSetFlags(fOldFlags);
-}
-
-
-/**
- * Timer callback function for async GIP mode.
- * @param   pTimer      The timer.
- * @param   pvUser      The device extension.
- */
-static DECLCALLBACK(void) supdrvGipAsyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick)
-{
-    RTCCUINTREG     fOldFlags = ASMIntDisableFlags(); /* No interruptions please (real problem on S10). */
-    PSUPDRVDEVEXT   pDevExt   = (PSUPDRVDEVEXT)pvUser;
-    RTCPUID         idCpu     = RTMpCpuId();
-    uint64_t        u64TSC    = ASMReadTSC();
-    uint64_t        NanoTS    = RTTimeSystemNanoTS();
-
-    /** @todo reset the transaction number and whatnot when iTick == 1. */
-    if (pDevExt->idGipMaster == idCpu)
-        supdrvGipUpdate(pDevExt, NanoTS, u64TSC, idCpu, iTick);
-    else
-        supdrvGipUpdatePerCpu(pDevExt, NanoTS, u64TSC, idCpu, ASMGetApicId(), iTick);
-
-    ASMSetFlags(fOldFlags);
-}
-
-
-/**
- * Finds our (@a idCpu) entry, or allocates a new one if not found.
- *
- * @returns Index of the CPU in the cache set.
- * @param   pGip                The GIP.
- * @param   idCpu               The CPU ID.
- */
-static uint32_t supdrvGipCpuIndexFromCpuId(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu)
-{
-    uint32_t i, cTries;
-
-    /*
-     * ASSUMES that CPU IDs are constant.
-     */
-    for (i = 0; i < pGip->cCpus; i++)
-        if (pGip->aCPUs[i].idCpu == idCpu)
-            return i;
-
-    cTries = 0;
-    do
-    {
-        for (i = 0; i < pGip->cCpus; i++)
-        {
-            bool fRc;
-            ASMAtomicCmpXchgSize(&pGip->aCPUs[i].idCpu, idCpu, NIL_RTCPUID, fRc);
-            if (fRc)
-                return i;
-        }
-    } while (cTries++ < 32);
-    AssertReleaseFailed();
-    return i - 1;
-}
-
-
-/**
- * The calling CPU should be accounted as online, update GIP accordingly.
- *
- * This is used by supdrvGipMpEvent as well as the supdrvGipCreate.
- *
- * @param   pDevExt             The device extension.
- * @param   idCpu               The CPU ID.
- */
-static void supdrvGipMpEventOnline(PSUPDRVDEVEXT pDevExt, RTCPUID idCpu)
-{
-    int         iCpuSet = 0;
-    uint16_t    idApic = UINT16_MAX;
-    uint32_t    i = 0;
-    uint64_t    u64NanoTS = 0;
-    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
-
-    AssertPtrReturnVoid(pGip);
-    AssertRelease(idCpu == RTMpCpuId());
-    Assert(pGip->cPossibleCpus == RTMpGetCount());
-
-    /*
-     * Do this behind a spinlock with interrupts disabled as this can fire
-     * on all CPUs simultaneously, see @bugref{6110}.
-     */
-    RTSpinlockAcquire(pDevExt->hGipSpinlock);
-
-    /*
-     * Update the globals.
-     */
-    ASMAtomicWriteU16(&pGip->cPresentCpus,  RTMpGetPresentCount());
-    ASMAtomicWriteU16(&pGip->cOnlineCpus,   RTMpGetOnlineCount());
-    iCpuSet = RTMpCpuIdToSetIndex(idCpu);
-    if (iCpuSet >= 0)
-    {
-        Assert(RTCpuSetIsMemberByIndex(&pGip->PossibleCpuSet, iCpuSet));
-        RTCpuSetAddByIndex(&pGip->OnlineCpuSet, iCpuSet);
-        RTCpuSetAddByIndex(&pGip->PresentCpuSet, iCpuSet);
-    }
-
-    /*
-     * Update the entry.
-     */
-    u64NanoTS = RTTimeSystemNanoTS() - pGip->u32UpdateIntervalNS;
-    i = supdrvGipCpuIndexFromCpuId(pGip, idCpu);
-    supdrvGipInitCpu(pGip, &pGip->aCPUs[i], u64NanoTS);
-    idApic = ASMGetApicId();
-    ASMAtomicWriteU16(&pGip->aCPUs[i].idApic,  idApic);
-    ASMAtomicWriteS16(&pGip->aCPUs[i].iCpuSet, (int16_t)iCpuSet);
-    ASMAtomicWriteSize(&pGip->aCPUs[i].idCpu,  idCpu);
-
-    /*
-     * Update the APIC ID and CPU set index mappings.
-     */
-    ASMAtomicWriteU16(&pGip->aiCpuFromApicId[idApic],     i);
-    ASMAtomicWriteU16(&pGip->aiCpuFromCpuSetIdx[iCpuSet], i);
-
-    /* commit it */
-    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_ONLINE);
-
-    RTSpinlockReleaseNoInts(pDevExt->hGipSpinlock);
-}
-
-
-/**
- * The CPU should be accounted as offline, update the GIP accordingly.
- *
- * This is used by supdrvGipMpEvent.
- *
- * @param   pDevExt             The device extension.
- * @param   idCpu               The CPU ID.
- */
-static void supdrvGipMpEventOffline(PSUPDRVDEVEXT pDevExt, RTCPUID idCpu)
-{
-    int         iCpuSet;
-    unsigned    i;
-
-    PSUPGLOBALINFOPAGE pGip   = pDevExt->pGip;
-
-    AssertPtrReturnVoid(pGip);
-    RTSpinlockAcquire(pDevExt->hGipSpinlock);
-
-    iCpuSet = RTMpCpuIdToSetIndex(idCpu);
-    AssertReturnVoid(iCpuSet >= 0);
-
-    i = pGip->aiCpuFromCpuSetIdx[iCpuSet];
-    AssertReturnVoid(i < pGip->cCpus);
-    AssertReturnVoid(pGip->aCPUs[i].idCpu == idCpu);
-
-    Assert(RTCpuSetIsMemberByIndex(&pGip->PossibleCpuSet, iCpuSet));
-    RTCpuSetDelByIndex(&pGip->OnlineCpuSet, iCpuSet);
-
-    /* commit it */
-    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_OFFLINE);
-
-    RTSpinlockReleaseNoInts(pDevExt->hGipSpinlock);
-}
-
-
-/**
- * Multiprocessor event notification callback.
- *
- * This is used to make sure that the GIP master gets passed on to
- * another CPU.  It also updates the associated CPU data.
- *
- * @param   enmEvent    The event.
- * @param   idCpu       The cpu it applies to.
- * @param   pvUser      Pointer to the device extension.
- *
- * @remarks This function -must- fire on the newly online'd CPU for the
- *          RTMPEVENT_ONLINE case and can fire on any CPU for the
- *          RTMPEVENT_OFFLINE case.
- */
-static DECLCALLBACK(void) supdrvGipMpEvent(RTMPEVENT enmEvent, RTCPUID idCpu, void *pvUser)
-{
-    PSUPDRVDEVEXT       pDevExt = (PSUPDRVDEVEXT)pvUser;
-    PSUPGLOBALINFOPAGE  pGip    = pDevExt->pGip;
-
-    AssertRelease(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-
-    /*
-     * Update the GIP CPU data.
-     */
-    if (pGip)
-    {
-        switch (enmEvent)
-        {
-            case RTMPEVENT_ONLINE:
-                AssertRelease(idCpu == RTMpCpuId());
-                supdrvGipMpEventOnline(pDevExt, idCpu);
-                break;
-            case RTMPEVENT_OFFLINE:
-                supdrvGipMpEventOffline(pDevExt, idCpu);
-                break;
-
-        }
-    }
-
-    /*
-     * Make sure there is a master GIP.
-     */
-    if (enmEvent == RTMPEVENT_OFFLINE)
-    {
-        RTCPUID idGipMaster = ASMAtomicReadU32(&pDevExt->idGipMaster);
-        if (idGipMaster == idCpu)
-        {
-            /*
-             * Find a new GIP master.
-             */
-            bool        fIgnored;
-            unsigned    i;
-            RTCPUID     idNewGipMaster = NIL_RTCPUID;
-            RTCPUSET    OnlineCpus;
-            RTMpGetOnlineSet(&OnlineCpus);
-
-            for (i = 0; i < RTCPUSET_MAX_CPUS; i++)
-            {
-                RTCPUID idCurCpu = RTMpCpuIdFromSetIndex(i);
-                if (    RTCpuSetIsMember(&OnlineCpus, idCurCpu)
-                    &&  idCurCpu != idGipMaster)
-                {
-                    idNewGipMaster = idCurCpu;
-                    break;
-                }
-            }
-
-            Log(("supdrvGipMpEvent: Gip master %#lx -> %#lx\n", (long)idGipMaster, (long)idNewGipMaster));
-            ASMAtomicCmpXchgSize(&pDevExt->idGipMaster, idNewGipMaster, idGipMaster, fIgnored);
-            NOREF(fIgnored);
-        }
-    }
-}
-
-
-/**
- * Callback used by supdrvDetermineAsyncTSC to read the TSC on a CPU.
- *
- * @param   idCpu       Ignored.
- * @param   pvUser1     Where to put the TSC.
- * @param   pvUser2     Ignored.
- */
-static DECLCALLBACK(void) supdrvDetermineAsyncTscWorker(RTCPUID idCpu, void *pvUser1, void *pvUser2)
-{
-#if 1
-    ASMAtomicWriteU64((uint64_t volatile *)pvUser1, ASMReadTSC());
-#else
-    *(uint64_t *)pvUser1 = ASMReadTSC();
-#endif
-}
-
-
-/**
- * Determine if Async GIP mode is required because of TSC drift.
- *
- * When using the default/normal timer code it is essential that the time stamp counter
- * (TSC) runs never backwards, that is, a read operation to the counter should return
- * a bigger value than any previous read operation. This is guaranteed by the latest
- * AMD CPUs and by newer Intel CPUs which never enter the C2 state (P4). In any other
- * case we have to choose the asynchronous timer mode.
- *
- * @param   poffMin     Pointer to the determined difference between different cores.
- * @return  false if the time stamp counters appear to be synchronized, true otherwise.
- */
-static bool supdrvDetermineAsyncTsc(uint64_t *poffMin)
-{
-    /*
-     * Just iterate all the cpus 8 times and make sure that the TSC is
-     * ever increasing. We don't bother taking TSC rollover into account.
-     */
-    int         iEndCpu = RTMpGetArraySize();
-    int         iCpu;
-    int         cLoops = 8;
-    bool        fAsync = false;
-    int         rc = VINF_SUCCESS;
-    uint64_t    offMax = 0;
-    uint64_t    offMin = ~(uint64_t)0;
-    uint64_t    PrevTsc = ASMReadTSC();
-
-    while (cLoops-- > 0)
-    {
-        for (iCpu = 0; iCpu < iEndCpu; iCpu++)
-        {
-            uint64_t CurTsc;
-            rc = RTMpOnSpecific(RTMpCpuIdFromSetIndex(iCpu), supdrvDetermineAsyncTscWorker, &CurTsc, NULL);
-            if (RT_SUCCESS(rc))
-            {
-                if (CurTsc <= PrevTsc)
-                {
-                    fAsync = true;
-                    offMin = offMax = PrevTsc - CurTsc;
-                    Log(("supdrvDetermineAsyncTsc: iCpu=%d cLoops=%d CurTsc=%llx PrevTsc=%llx\n",
-                         iCpu, cLoops, CurTsc, PrevTsc));
-                    break;
-                }
-
-                /* Gather statistics (except the first time). */
-                if (iCpu != 0 || cLoops != 7)
-                {
-                    uint64_t off = CurTsc - PrevTsc;
-                    if (off < offMin)
-                        offMin = off;
-                    if (off > offMax)
-                        offMax = off;
-                    Log2(("%d/%d: off=%llx\n", cLoops, iCpu, off));
-                }
-
-                /* Next */
-                PrevTsc = CurTsc;
-            }
-            else if (rc == VERR_NOT_SUPPORTED)
-                break;
-            else
-                AssertMsg(rc == VERR_CPU_NOT_FOUND || rc == VERR_CPU_OFFLINE, ("%d\n", rc));
-        }
-
-        /* broke out of the loop. */
-        if (iCpu < iEndCpu)
-            break;
-    }
-
-    *poffMin = offMin; /* Almost RTMpOnSpecific profiling. */
-    Log(("supdrvDetermineAsyncTsc: returns %d; iEndCpu=%d rc=%d offMin=%llx offMax=%llx\n",
-         fAsync, iEndCpu, rc, offMin, offMax));
-#if !defined(RT_OS_SOLARIS) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS)
-    OSDBGPRINT(("vboxdrv: fAsync=%d offMin=%#lx offMax=%#lx\n", fAsync, (long)offMin, (long)offMax));
-#endif
-    return fAsync;
-}
-
-
-/**
- * Determine the GIP TSC mode.
- *
- * @returns The most suitable TSC mode.
- * @param   pDevExt     Pointer to the device instance data.
- */
-static SUPGIPMODE supdrvGipDeterminTscMode(PSUPDRVDEVEXT pDevExt)
-{
-    /*
-     * On SMP we're faced with two problems:
-     *      (1) There might be a skew between the CPU, so that cpu0
-     *          returns a TSC that is slightly different from cpu1.
-     *      (2) Power management (and other things) may cause the TSC
-     *          to run at a non-constant speed, and cause the speed
-     *          to be different on the cpus. This will result in (1).
-     *
-     * So, on SMP systems we'll have to select the ASYNC update method
-     * if there are symptoms of these problems.
-     */
-    if (RTMpGetCount() > 1)
-    {
-        uint32_t uEAX, uEBX, uECX, uEDX;
-        uint64_t u64DiffCoresIgnored;
-
-        /* Permit the user and/or the OS specific bits to force async mode. */
-        if (supdrvOSGetForcedAsyncTscMode(pDevExt))
-            return SUPGIPMODE_ASYNC_TSC;
-
-        /* Try check for current differences between the cpus. */
-        if (supdrvDetermineAsyncTsc(&u64DiffCoresIgnored))
-            return SUPGIPMODE_ASYNC_TSC;
-
-        /*
-         * If the CPU supports power management and is an AMD one we
-         * won't trust it unless it has the TscInvariant bit is set.
-         */
-        /* Check for "AuthenticAMD" */
-        ASMCpuId(0, &uEAX, &uEBX, &uECX, &uEDX);
-        if (   uEAX >= 1
-            && ASMIsAmdCpuEx(uEBX, uECX, uEDX))
-        {
-            /* Check for APM support and that TscInvariant is cleared. */
-            ASMCpuId(0x80000000, &uEAX, &uEBX, &uECX, &uEDX);
-            if (uEAX >= 0x80000007)
-            {
-                ASMCpuId(0x80000007, &uEAX, &uEBX, &uECX, &uEDX);
-                if (    !(uEDX & RT_BIT(8))/* TscInvariant */
-                    &&  (uEDX & 0x3e))  /* STC|TM|THERMTRIP|VID|FID. Ignore TS. */
-                    return SUPGIPMODE_ASYNC_TSC;
-            }
-        }
-    }
-    return SUPGIPMODE_SYNC_TSC;
-}
-
-
-/**
- * Initializes per-CPU GIP information.
- *
- * @param   pGip        Pointer to the read-write kernel mapping of the GIP.
- * @param   pCpu        Pointer to which GIP CPU to initalize.
- * @param   u64NanoTS   The current nanosecond timestamp.
- */
-static void supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS)
-{
-    pCpu->u32TransactionId   = 2;
-    pCpu->u64NanoTS          = u64NanoTS;
-    pCpu->u64TSC             = ASMReadTSC();
-
-    ASMAtomicWriteSize(&pCpu->enmState, SUPGIPCPUSTATE_INVALID);
-    ASMAtomicWriteSize(&pCpu->idCpu,    NIL_RTCPUID);
-    ASMAtomicWriteS16(&pCpu->iCpuSet,   -1);
-    ASMAtomicWriteU16(&pCpu->idApic,    UINT16_MAX);
-
-    /*
-     * We don't know the following values until we've executed updates.
-     * So, we'll just pretend it's a 4 GHz CPU and adjust the history it on
-     * the 2nd timer callout.
-     */
-    pCpu->u64CpuHz          = _4G + 1; /* tstGIP-2 depends on this. */
-    pCpu->u32UpdateIntervalTSC
-        = pCpu->au32TSCHistory[0]
-        = pCpu->au32TSCHistory[1]
-        = pCpu->au32TSCHistory[2]
-        = pCpu->au32TSCHistory[3]
-        = pCpu->au32TSCHistory[4]
-        = pCpu->au32TSCHistory[5]
-        = pCpu->au32TSCHistory[6]
-        = pCpu->au32TSCHistory[7]
-        = (uint32_t)(_4G / pGip->u32UpdateHz);
-}
-
-
-/**
- * Initializes the GIP data.
- *
- * @param   pDevExt             Pointer to the device instance data.
- * @param   pGip                Pointer to the read-write kernel mapping of the GIP.
- * @param   HCPhys              The physical address of the GIP.
- * @param   u64NanoTS           The current nanosecond timestamp.
- * @param   uUpdateHz           The update frequency.
- * @param   uUpdateIntervalNS   The update interval in nanoseconds.
- * @param   cCpus               The CPU count.
- */
-static void supdrvGipInit(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, RTHCPHYS HCPhys,
-                          uint64_t u64NanoTS, unsigned uUpdateHz, unsigned uUpdateIntervalNS, unsigned cCpus)
-{
-    size_t const    cbGip = RT_ALIGN_Z(RT_OFFSETOF(SUPGLOBALINFOPAGE, aCPUs[cCpus]), PAGE_SIZE);
-    unsigned        i;
-#ifdef DEBUG_DARWIN_GIP
-    OSDBGPRINT(("supdrvGipInit: pGip=%p HCPhys=%lx u64NanoTS=%llu uUpdateHz=%d cCpus=%u\n", pGip, (long)HCPhys, u64NanoTS, uUpdateHz, cCpus));
-#else
-    LogFlow(("supdrvGipInit: pGip=%p HCPhys=%lx u64NanoTS=%llu uUpdateHz=%d cCpus=%u\n", pGip, (long)HCPhys, u64NanoTS, uUpdateHz, cCpus));
-#endif
-
-    /*
-     * Initialize the structure.
-     */
-    memset(pGip, 0, cbGip);
-    pGip->u32Magic              = SUPGLOBALINFOPAGE_MAGIC;
-    pGip->u32Version            = SUPGLOBALINFOPAGE_VERSION;
-    pGip->u32Mode               = supdrvGipDeterminTscMode(pDevExt);
-    pGip->cCpus                 = (uint16_t)cCpus;
-    pGip->cPages                = (uint16_t)(cbGip / PAGE_SIZE);
-    pGip->u32UpdateHz           = uUpdateHz;
-    pGip->u32UpdateIntervalNS   = uUpdateIntervalNS;
-    pGip->u64NanoTSLastUpdateHz = 0;
-    RTCpuSetEmpty(&pGip->OnlineCpuSet);
-    RTCpuSetEmpty(&pGip->PresentCpuSet);
-    RTMpGetSet(&pGip->PossibleCpuSet);
-    pGip->cOnlineCpus           = RTMpGetOnlineCount();
-    pGip->cPresentCpus          = RTMpGetPresentCount();
-    pGip->cPossibleCpus         = RTMpGetCount();
-    pGip->idCpuMax              = RTMpGetMaxCpuId();
-    for (i = 0; i < RT_ELEMENTS(pGip->aiCpuFromApicId); i++)
-        pGip->aiCpuFromApicId[i]    = 0;
-    for (i = 0; i < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx); i++)
-        pGip->aiCpuFromCpuSetIdx[i] = UINT16_MAX;
-
-    for (i = 0; i < cCpus; i++)
-        supdrvGipInitCpu(pGip, &pGip->aCPUs[i], u64NanoTS);
-
-    /*
-     * Link it to the device extension.
-     */
-    pDevExt->pGip      = pGip;
-    pDevExt->HCPhysGip = HCPhys;
-    pDevExt->cGipUsers = 0;
-}
-
-
-/**
- * On CPU initialization callback for RTMpOnAll.
- *
- * @param   idCpu               The CPU ID.
- * @param   pvUser1             The device extension.
- * @param   pvUser2             The GIP.
- */
-static DECLCALLBACK(void) supdrvGipInitOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
-{
-    /* This is good enough, even though it will update some of the globals a
-       bit to much. */
-    supdrvGipMpEventOnline((PSUPDRVDEVEXT)pvUser1, idCpu);
-}
-
-
-/**
- * Invalidates the GIP data upon termination.
- *
- * @param   pGip        Pointer to the read-write kernel mapping of the GIP.
- */
-static void supdrvGipTerm(PSUPGLOBALINFOPAGE pGip)
-{
-    unsigned i;
-    pGip->u32Magic = 0;
-    for (i = 0; i < RT_ELEMENTS(pGip->aCPUs); i++)
-    {
-        pGip->aCPUs[i].u64NanoTS = 0;
-        pGip->aCPUs[i].u64TSC = 0;
-        pGip->aCPUs[i].iTSCHistoryHead = 0;
-    }
-}
-
-
-/**
- * Worker routine for supdrvGipUpdate and supdrvGipUpdatePerCpu that
- * updates all the per cpu data except the transaction id.
- *
- * @param   pDevExt         The device extension.
- * @param   pGipCpu         Pointer to the per cpu data.
- * @param   u64NanoTS       The current time stamp.
- * @param   u64TSC          The current TSC.
- * @param   iTick           The current timer tick.
- */
-static void supdrvGipDoUpdateCpu(PSUPDRVDEVEXT pDevExt, PSUPGIPCPU pGipCpu, uint64_t u64NanoTS, uint64_t u64TSC, uint64_t iTick)
-{
-    uint64_t    u64TSCDelta;
-    uint32_t    u32UpdateIntervalTSC;
-    uint32_t    u32UpdateIntervalTSCSlack;
-    unsigned    iTSCHistoryHead;
-    uint64_t    u64CpuHz;
-    uint32_t    u32TransactionId;
-
-    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
-    AssertPtrReturnVoid(pGip);
-
-    /* Delta between this and the previous update. */
-    ASMAtomicUoWriteU32(&pGipCpu->u32PrevUpdateIntervalNS, (uint32_t)(u64NanoTS - pGipCpu->u64NanoTS));
-
-    /*
-     * Update the NanoTS.
-     */
-    ASMAtomicWriteU64(&pGipCpu->u64NanoTS, u64NanoTS);
-
-    /*
-     * Calc TSC delta.
-     */
-    u64TSCDelta = u64TSC - pGipCpu->u64TSC;
-    ASMAtomicWriteU64(&pGipCpu->u64TSC, u64TSC);
-
-    if (u64TSCDelta >> 32)
-    {
-        u64TSCDelta = pGipCpu->u32UpdateIntervalTSC;
-        pGipCpu->cErrors++;
-    }
-
-    /*
-     * On the 2nd and 3rd callout, reset the history with the current TSC
-     * interval since the values entered by supdrvGipInit are totally off.
-     * The interval on the 1st callout completely unreliable, the 2nd is a bit
-     * better, while the 3rd should be most reliable.
-     */
-    u32TransactionId = pGipCpu->u32TransactionId;
-    if (RT_UNLIKELY(   (   u32TransactionId == 5
-                        || u32TransactionId == 7)
-                    && (   iTick == 2
-                        || iTick == 3) ))
-    {
-        unsigned i;
-        for (i = 0; i < RT_ELEMENTS(pGipCpu->au32TSCHistory); i++)
-            ASMAtomicUoWriteU32(&pGipCpu->au32TSCHistory[i], (uint32_t)u64TSCDelta);
-    }
-
-    /*
-     * Validate the NanoTS deltas between timer fires with an arbitrary threshold of 0.5%.
-     * Wait until we have at least one full history since the above history reset. The
-     * assumption is that the majority of the previous history values will be tolerable.
-     * See @bugref{6710} comment #67.
-     */
-    if (   u32TransactionId > 23 /* 7 + (8 * 2) */
-        && g_fIsInvariantTsc
-        && pGip->u32Mode == SUPGIPMODE_SYNC_TSC)
-    {
-        uint32_t uNanoTsThreshold = pGip->u32UpdateIntervalNS / 200;
-        if (   pGipCpu->u32PrevUpdateIntervalNS > pGip->u32UpdateIntervalNS + uNanoTsThreshold
-            || pGipCpu->u32PrevUpdateIntervalNS < pGip->u32UpdateIntervalNS - uNanoTsThreshold)
-        {
-            uint32_t u32;
-            u32  = pGipCpu->au32TSCHistory[0];
-            u32 += pGipCpu->au32TSCHistory[1];
-            u32 += pGipCpu->au32TSCHistory[2];
-            u32 += pGipCpu->au32TSCHistory[3];
-            u32 >>= 2;
-            u64TSCDelta  = pGipCpu->au32TSCHistory[4];
-            u64TSCDelta += pGipCpu->au32TSCHistory[5];
-            u64TSCDelta += pGipCpu->au32TSCHistory[6];
-            u64TSCDelta += pGipCpu->au32TSCHistory[7];
-            u64TSCDelta >>= 2;
-            u64TSCDelta += u32;
-            u64TSCDelta >>= 1;
-        }
-    }
-
-    /*
-     * TSC History.
-     */
-    Assert(RT_ELEMENTS(pGipCpu->au32TSCHistory) == 8);
-    iTSCHistoryHead = (pGipCpu->iTSCHistoryHead + 1) & 7;
-    ASMAtomicWriteU32(&pGipCpu->iTSCHistoryHead, iTSCHistoryHead);
-    ASMAtomicWriteU32(&pGipCpu->au32TSCHistory[iTSCHistoryHead], (uint32_t)u64TSCDelta);
-
-    /*
-     * UpdateIntervalTSC = average of last 8,2,1 intervals depending on update HZ.
-     */
-    if (pGip->u32UpdateHz >= 1000)
-    {
-        uint32_t u32;
-        u32  = pGipCpu->au32TSCHistory[0];
-        u32 += pGipCpu->au32TSCHistory[1];
-        u32 += pGipCpu->au32TSCHistory[2];
-        u32 += pGipCpu->au32TSCHistory[3];
-        u32 >>= 2;
-        u32UpdateIntervalTSC  = pGipCpu->au32TSCHistory[4];
-        u32UpdateIntervalTSC += pGipCpu->au32TSCHistory[5];
-        u32UpdateIntervalTSC += pGipCpu->au32TSCHistory[6];
-        u32UpdateIntervalTSC += pGipCpu->au32TSCHistory[7];
-        u32UpdateIntervalTSC >>= 2;
-        u32UpdateIntervalTSC += u32;
-        u32UpdateIntervalTSC >>= 1;
-
-        /* Value chosen for a 2GHz Athlon64 running linux 2.6.10/11, . */
-        u32UpdateIntervalTSCSlack = u32UpdateIntervalTSC >> 14;
-    }
-    else if (pGip->u32UpdateHz >= 90)
-    {
-        u32UpdateIntervalTSC  = (uint32_t)u64TSCDelta;
-        u32UpdateIntervalTSC += pGipCpu->au32TSCHistory[(iTSCHistoryHead - 1) & 7];
-        u32UpdateIntervalTSC >>= 1;
-
-        /* value chosen on a 2GHz thinkpad running windows */
-        u32UpdateIntervalTSCSlack = u32UpdateIntervalTSC >> 7;
-    }
-    else
-    {
-        u32UpdateIntervalTSC  = (uint32_t)u64TSCDelta;
-
-        /* This value hasn't be checked yet.. waiting for OS/2 and 33Hz timers.. :-) */
-        u32UpdateIntervalTSCSlack = u32UpdateIntervalTSC >> 6;
-    }
-    ASMAtomicWriteU32(&pGipCpu->u32UpdateIntervalTSC, u32UpdateIntervalTSC + u32UpdateIntervalTSCSlack);
-
-    /*
-     * CpuHz.
-     */
-    u64CpuHz = ASMMult2xU32RetU64(u32UpdateIntervalTSC, RT_NS_1SEC);
-    u64CpuHz /= pGip->u32UpdateIntervalNS;
-    ASMAtomicWriteU64(&pGipCpu->u64CpuHz, u64CpuHz);
-}
-
-
-/**
- * Updates the GIP.
- *
- * @param   pDevExt         The device extension.
- * @param   u64NanoTS       The current nanosecond timesamp.
- * @param   u64TSC          The current TSC timesamp.
- * @param   idCpu           The CPU ID.
- * @param   iTick           The current timer tick.
- */
-static void supdrvGipUpdate(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC, RTCPUID idCpu, uint64_t iTick)
-{
-    /*
-     * Determine the relevant CPU data.
-     */
-    PSUPGIPCPU pGipCpu;
-    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
-    AssertPtrReturnVoid(pGip);
-
-    if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
-        pGipCpu = &pGip->aCPUs[0];
-    else
-    {
-        unsigned iCpu = pGip->aiCpuFromApicId[ASMGetApicId()];
-        if (RT_UNLIKELY(iCpu >= pGip->cCpus))
-            return;
-        pGipCpu = &pGip->aCPUs[iCpu];
-        if (RT_UNLIKELY(pGipCpu->idCpu != idCpu))
-            return;
-    }
-
-    /*
-     * Start update transaction.
-     */
-    if (!(ASMAtomicIncU32(&pGipCpu->u32TransactionId) & 1))
-    {
-        /* this can happen on win32 if we're taking to long and there are more CPUs around. shouldn't happen though. */
-        AssertMsgFailed(("Invalid transaction id, %#x, not odd!\n", pGipCpu->u32TransactionId));
-        ASMAtomicIncU32(&pGipCpu->u32TransactionId);
-        pGipCpu->cErrors++;
-        return;
-    }
-
-    /*
-     * Recalc the update frequency every 0x800th time.
-     */
-    if (!(pGipCpu->u32TransactionId & (GIP_UPDATEHZ_RECALC_FREQ * 2 - 2)))
-    {
-        if (pGip->u64NanoTSLastUpdateHz)
-        {
-#ifdef RT_ARCH_AMD64 /** @todo fix 64-bit div here to work on x86 linux. */
-            uint64_t u64Delta = u64NanoTS - pGip->u64NanoTSLastUpdateHz;
-            uint32_t u32UpdateHz = (uint32_t)((RT_NS_1SEC_64 * GIP_UPDATEHZ_RECALC_FREQ) / u64Delta);
-            if (u32UpdateHz <= 2000 && u32UpdateHz >= 30)
-            {
-                uint64_t u64Interval = u64Delta / GIP_UPDATEHZ_RECALC_FREQ;
-                ASMAtomicWriteU32(&pGip->u32UpdateHz, u32UpdateHz);
-                ASMAtomicWriteU32(&pGip->u32UpdateIntervalNS, (uint32_t)u64Interval);
-            }
-#endif
-        }
-        ASMAtomicWriteU64(&pGip->u64NanoTSLastUpdateHz, u64NanoTS | 1);
-    }
-
-    /*
-     * Update the data.
-     */
-    supdrvGipDoUpdateCpu(pDevExt, pGipCpu, u64NanoTS, u64TSC, iTick);
-
-    /*
-     * Complete transaction.
-     */
-    ASMAtomicIncU32(&pGipCpu->u32TransactionId);
-}
-
-
-/**
- * Updates the per cpu GIP data for the calling cpu.
- *
- * @param   pDevExt         The device extension.
- * @param   u64NanoTS       The current nanosecond timesamp.
- * @param   u64TSC          The current TSC timesamp.
- * @param   idCpu           The CPU ID.
- * @param   idApic          The APIC id for the CPU index.
- * @param   iTick           The current timer tick.
- */
-static void supdrvGipUpdatePerCpu(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC,
-                                  RTCPUID idCpu, uint8_t idApic, uint64_t iTick)
-{
-    uint32_t iCpu;
-    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
-
-    /*
-     * Avoid a potential race when a CPU online notification doesn't fire on
-     * the onlined CPU but the tick creeps in before the event notification is
-     * run.
-     */
-    if (RT_UNLIKELY(iTick == 1))
-    {
-        iCpu = supdrvGipCpuIndexFromCpuId(pGip, idCpu);
-        if (pGip->aCPUs[iCpu].enmState == SUPGIPCPUSTATE_OFFLINE)
-            supdrvGipMpEventOnline(pDevExt, idCpu);
-    }
-
-    iCpu = pGip->aiCpuFromApicId[idApic];
-    if (RT_LIKELY(iCpu < pGip->cCpus))
-    {
-        PSUPGIPCPU pGipCpu = &pGip->aCPUs[iCpu];
-        if (pGipCpu->idCpu == idCpu)
-        {
-            /*
-             * Start update transaction.
-             */
-            if (!(ASMAtomicIncU32(&pGipCpu->u32TransactionId) & 1))
-            {
-                AssertMsgFailed(("Invalid transaction id, %#x, not odd!\n", pGipCpu->u32TransactionId));
-                ASMAtomicIncU32(&pGipCpu->u32TransactionId);
-                pGipCpu->cErrors++;
-                return;
-            }
-
-            /*
-             * Update the data.
-             */
-            supdrvGipDoUpdateCpu(pDevExt, pGipCpu, u64NanoTS, u64TSC, iTick);
-
-            /*
-             * Complete transaction.
-             */
-            ASMAtomicIncU32(&pGipCpu->u32TransactionId);
-        }
-    }
-}
-
-/**
- * Resume built-in keyboard on MacBook Air and Pro hosts.
- * If there is no built-in keyboard device, return success anyway.
- *
- * @returns 0 on Mac OS X platform, VERR_NOT_IMPLEMENTED on the other ones.
- */
-static int supdrvIOCtl_ResumeSuspendedKbds(void)
-{
-#if defined(RT_OS_DARWIN)
-    return supdrvDarwinResumeSuspendedKbds();
-#else
-    return VERR_NOT_IMPLEMENTED;
-#endif
-}
-
diff --git a/src/VBox/HostDrivers/Support/SUPDrv.cpp b/src/VBox/HostDrivers/Support/SUPDrv.cpp
new file mode 100644
index 0000000..9dcd7e9
--- /dev/null
+++ b/src/VBox/HostDrivers/Support/SUPDrv.cpp
@@ -0,0 +1,5491 @@
+/* $Id: SUPDrv.cpp $ */
+/** @file
+ * VBoxDrv - The VirtualBox Support Driver - Common code.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_SUP_DRV
+#define SUPDRV_AGNOSTIC
+#include "SUPDrvInternal.h"
+#ifndef PAGE_SHIFT
+# include <iprt/param.h>
+#endif
+#include <iprt/asm.h>
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/asm-math.h>
+#include <iprt/cpuset.h>
+#include <iprt/handletable.h>
+#include <iprt/mem.h>
+#include <iprt/mp.h>
+#include <iprt/power.h>
+#include <iprt/process.h>
+#include <iprt/semaphore.h>
+#include <iprt/spinlock.h>
+#include <iprt/thread.h>
+#include <iprt/uuid.h>
+#include <iprt/net.h>
+#include <iprt/crc.h>
+#include <iprt/string.h>
+#include <iprt/timer.h>
+#if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
+# include <iprt/rand.h>
+# include <iprt/path.h>
+#endif
+#include <iprt/uint128.h>
+#include <iprt/x86.h>
+
+#include <VBox/param.h>
+#include <VBox/log.h>
+#include <VBox/err.h>
+#include <VBox/vmm/hm_svm.h>
+#include <VBox/vmm/hm_vmx.h>
+
+#if defined(RT_OS_SOLARIS) || defined(RT_OS_DARWIN)
+# include "dtrace/SUPDrv.h"
+#else
+# define VBOXDRV_SESSION_CREATE(pvSession, fUser) do { } while (0)
+# define VBOXDRV_SESSION_CLOSE(pvSession) do { } while (0)
+# define VBOXDRV_IOCTL_ENTRY(pvSession, uIOCtl, pvReqHdr) do { } while (0)
+# define VBOXDRV_IOCTL_RETURN(pvSession, uIOCtl, pvReqHdr, rcRet, rcReq) do { } while (0)
+#endif
+
+/*
+ * Logging assignments:
+ *      Log     - useful stuff, like failures.
+ *      LogFlow - program flow, except the really noisy bits.
+ *      Log2    - Cleanup.
+ *      Log3    - Loader flow noise.
+ *      Log4    - Call VMMR0 flow noise.
+ *      Log5    - Native yet-to-be-defined noise.
+ *      Log6    - Native ioctl flow noise.
+ *
+ * Logging requires BUILD_TYPE=debug and possibly changes to the logger
+ * instantiation in log-vbox.c(pp).
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** @def VBOX_SVN_REV
+ * The makefile should define this if it can. */
+#ifndef VBOX_SVN_REV
+# define VBOX_SVN_REV 0
+#endif
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static DECLCALLBACK(int)    supdrvSessionObjHandleRetain(RTHANDLETABLE hHandleTable, void *pvObj, void *pvCtx, void *pvUser);
+static DECLCALLBACK(void)   supdrvSessionObjHandleDelete(RTHANDLETABLE hHandleTable, uint32_t h, void *pvObj, void *pvCtx, void *pvUser);
+static int                  supdrvMemAdd(PSUPDRVMEMREF pMem, PSUPDRVSESSION pSession);
+static int                  supdrvMemRelease(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, SUPDRVMEMREFTYPE eType);
+static int                  supdrvIOCtl_LdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDROPEN pReq);
+static int                  supdrvIOCtl_LdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRLOAD pReq);
+static int                  supdrvIOCtl_LdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRFREE pReq);
+static int                  supdrvIOCtl_LdrLockDown(PSUPDRVDEVEXT pDevExt);
+static int                  supdrvIOCtl_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRGETSYMBOL pReq);
+static int                  supdrvIDC_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQGETSYM pReq);
+static int                  supdrvLdrSetVMMR0EPs(PSUPDRVDEVEXT pDevExt, void *pvVMMR0, void *pvVMMR0EntryInt,void *pvVMMR0EntryFast, void *pvVMMR0EntryEx);
+static void                 supdrvLdrUnsetVMMR0EPs(PSUPDRVDEVEXT pDevExt);
+static int                  supdrvLdrAddUsage(PSUPDRVSESSION pSession, PSUPDRVLDRIMAGE pImage);
+static void                 supdrvLdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
+DECLINLINE(int)             supdrvLdrLock(PSUPDRVDEVEXT pDevExt);
+DECLINLINE(int)             supdrvLdrUnlock(PSUPDRVDEVEXT pDevExt);
+static int                  supdrvIOCtl_CallServiceModule(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPCALLSERVICE pReq);
+static int                  supdrvIOCtl_LoggerSettings(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLOGGERSETTINGS pReq);
+static int                  supdrvIOCtl_MsrProber(PSUPDRVDEVEXT pDevExt, PSUPMSRPROBER pReq);
+static int                  supdrvIOCtl_ResumeSuspendedKbds(void);
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/**
+ * Array of the R0 SUP API.
+ *
+ * While making changes to these exports, make sure to update the IOC
+ * minor version (SUPDRV_IOC_VERSION).
+ */
+static SUPFUNC g_aFunctions[] =
+{
+/* SED: START */
+    /* name                                     function */
+        /* Entries with absolute addresses determined at runtime, fixup
+           code makes ugly ASSUMPTIONS about the order here: */
+    { "SUPR0AbsIs64bit",                        (void *)0 },
+    { "SUPR0Abs64bitKernelCS",                  (void *)0 },
+    { "SUPR0Abs64bitKernelSS",                  (void *)0 },
+    { "SUPR0Abs64bitKernelDS",                  (void *)0 },
+    { "SUPR0AbsKernelCS",                       (void *)0 },
+    { "SUPR0AbsKernelSS",                       (void *)0 },
+    { "SUPR0AbsKernelDS",                       (void *)0 },
+    { "SUPR0AbsKernelES",                       (void *)0 },
+    { "SUPR0AbsKernelFS",                       (void *)0 },
+    { "SUPR0AbsKernelGS",                       (void *)0 },
+        /* Normal function pointers: */
+    { "g_pSUPGlobalInfoPage",                   (void *)&g_pSUPGlobalInfoPage },            /* SED: DATA */
+    { "SUPGetGIP",                              (void *)SUPGetGIP },
+    { "SUPReadTscWithDelta",                    (void *)SUPReadTscWithDelta },
+    { "SUPGetTscDeltaSlow",                     (void *)SUPGetTscDeltaSlow },
+    { "SUPGetCpuHzFromGipForAsyncMode",         (void *)SUPGetCpuHzFromGipForAsyncMode },
+    { "SUPR0ComponentDeregisterFactory",        (void *)SUPR0ComponentDeregisterFactory },
+    { "SUPR0ComponentQueryFactory",             (void *)SUPR0ComponentQueryFactory },
+    { "SUPR0ComponentRegisterFactory",          (void *)SUPR0ComponentRegisterFactory },
+    { "SUPR0ContAlloc",                         (void *)SUPR0ContAlloc },
+    { "SUPR0ContFree",                          (void *)SUPR0ContFree },
+    { "SUPR0ChangeCR4",                         (void *)SUPR0ChangeCR4 },
+    { "SUPR0EnableVTx",                         (void *)SUPR0EnableVTx },
+    { "SUPR0SuspendVTxOnCpu",                   (void *)SUPR0SuspendVTxOnCpu },
+    { "SUPR0ResumeVTxOnCpu",                    (void *)SUPR0ResumeVTxOnCpu },
+    { "SUPR0GetKernelFeatures",                 (void *)SUPR0GetKernelFeatures },
+    { "SUPR0GetPagingMode",                     (void *)SUPR0GetPagingMode },
+    { "SUPR0GetSvmUsability",                   (void *)SUPR0GetSvmUsability },
+    { "SUPR0GetVmxUsability",                   (void *)SUPR0GetVmxUsability },
+    { "SUPR0LockMem",                           (void *)SUPR0LockMem },
+    { "SUPR0LowAlloc",                          (void *)SUPR0LowAlloc },
+    { "SUPR0LowFree",                           (void *)SUPR0LowFree },
+    { "SUPR0MemAlloc",                          (void *)SUPR0MemAlloc },
+    { "SUPR0MemFree",                           (void *)SUPR0MemFree },
+    { "SUPR0MemGetPhys",                        (void *)SUPR0MemGetPhys },
+    { "SUPR0ObjAddRef",                         (void *)SUPR0ObjAddRef },
+    { "SUPR0ObjAddRefEx",                       (void *)SUPR0ObjAddRefEx },
+    { "SUPR0ObjRegister",                       (void *)SUPR0ObjRegister },
+    { "SUPR0ObjRelease",                        (void *)SUPR0ObjRelease },
+    { "SUPR0ObjVerifyAccess",                   (void *)SUPR0ObjVerifyAccess },
+    { "SUPR0PageAllocEx",                       (void *)SUPR0PageAllocEx },
+    { "SUPR0PageFree",                          (void *)SUPR0PageFree },
+    { "SUPR0Printf",                            (void *)SUPR0Printf },
+    { "SUPR0TscDeltaMeasureBySetIndex",         (void *)SUPR0TscDeltaMeasureBySetIndex },
+    { "SUPR0TracerDeregisterDrv",               (void *)SUPR0TracerDeregisterDrv },
+    { "SUPR0TracerDeregisterImpl",              (void *)SUPR0TracerDeregisterImpl },
+    { "SUPR0TracerFireProbe",                   (void *)SUPR0TracerFireProbe },
+    { "SUPR0TracerRegisterDrv",                 (void *)SUPR0TracerRegisterDrv },
+    { "SUPR0TracerRegisterImpl",                (void *)SUPR0TracerRegisterImpl },
+    { "SUPR0TracerRegisterModule",              (void *)SUPR0TracerRegisterModule },
+    { "SUPR0TracerUmodProbeFire",               (void *)SUPR0TracerUmodProbeFire },
+    { "SUPR0UnlockMem",                         (void *)SUPR0UnlockMem },
+    { "SUPSemEventClose",                       (void *)SUPSemEventClose },
+    { "SUPSemEventCreate",                      (void *)SUPSemEventCreate },
+    { "SUPSemEventGetResolution",               (void *)SUPSemEventGetResolution },
+    { "SUPSemEventMultiClose",                  (void *)SUPSemEventMultiClose },
+    { "SUPSemEventMultiCreate",                 (void *)SUPSemEventMultiCreate },
+    { "SUPSemEventMultiGetResolution",          (void *)SUPSemEventMultiGetResolution },
+    { "SUPSemEventMultiReset",                  (void *)SUPSemEventMultiReset },
+    { "SUPSemEventMultiSignal",                 (void *)SUPSemEventMultiSignal },
+    { "SUPSemEventMultiWait",                   (void *)SUPSemEventMultiWait },
+    { "SUPSemEventMultiWaitNoResume",           (void *)SUPSemEventMultiWaitNoResume },
+    { "SUPSemEventMultiWaitNsAbsIntr",          (void *)SUPSemEventMultiWaitNsAbsIntr },
+    { "SUPSemEventMultiWaitNsRelIntr",          (void *)SUPSemEventMultiWaitNsRelIntr },
+    { "SUPSemEventSignal",                      (void *)SUPSemEventSignal },
+    { "SUPSemEventWait",                        (void *)SUPSemEventWait },
+    { "SUPSemEventWaitNoResume",                (void *)SUPSemEventWaitNoResume },
+    { "SUPSemEventWaitNsAbsIntr",               (void *)SUPSemEventWaitNsAbsIntr },
+    { "SUPSemEventWaitNsRelIntr",               (void *)SUPSemEventWaitNsRelIntr },
+
+    { "RTAssertAreQuiet",                       (void *)RTAssertAreQuiet },
+    { "RTAssertMayPanic",                       (void *)RTAssertMayPanic },
+    { "RTAssertMsg1",                           (void *)RTAssertMsg1 },
+    { "RTAssertMsg2AddV",                       (void *)RTAssertMsg2AddV },
+    { "RTAssertMsg2V",                          (void *)RTAssertMsg2V },
+    { "RTAssertSetMayPanic",                    (void *)RTAssertSetMayPanic },
+    { "RTAssertSetQuiet",                       (void *)RTAssertSetQuiet },
+    { "RTCrc32",                                (void *)RTCrc32 },
+    { "RTCrc32Finish",                          (void *)RTCrc32Finish },
+    { "RTCrc32Process",                         (void *)RTCrc32Process },
+    { "RTCrc32Start",                           (void *)RTCrc32Start },
+    { "RTErrConvertFromErrno",                  (void *)RTErrConvertFromErrno },
+    { "RTErrConvertToErrno",                    (void *)RTErrConvertToErrno },
+    { "RTHandleTableAllocWithCtx",              (void *)RTHandleTableAllocWithCtx },
+    { "RTHandleTableCreate",                    (void *)RTHandleTableCreate },
+    { "RTHandleTableCreateEx",                  (void *)RTHandleTableCreateEx },
+    { "RTHandleTableDestroy",                   (void *)RTHandleTableDestroy },
+    { "RTHandleTableFreeWithCtx",               (void *)RTHandleTableFreeWithCtx },
+    { "RTHandleTableLookupWithCtx",             (void *)RTHandleTableLookupWithCtx },
+    { "RTLogDefaultInstance",                   (void *)RTLogDefaultInstance },
+    { "RTLogGetDefaultInstance",                (void *)RTLogGetDefaultInstance },
+    { "RTLogLoggerExV",                         (void *)RTLogLoggerExV },
+    { "RTLogPrintfV",                           (void *)RTLogPrintfV },
+    { "RTLogRelDefaultInstance",                (void *)RTLogRelDefaultInstance },
+    { "RTLogSetDefaultInstanceThread",          (void *)RTLogSetDefaultInstanceThread },
+    { "RTMemAllocExTag",                        (void *)RTMemAllocExTag },
+    { "RTMemAllocTag",                          (void *)RTMemAllocTag },
+    { "RTMemAllocVarTag",                       (void *)RTMemAllocVarTag },
+    { "RTMemAllocZTag",                         (void *)RTMemAllocZTag },
+    { "RTMemAllocZVarTag",                      (void *)RTMemAllocZVarTag },
+    { "RTMemDupExTag",                          (void *)RTMemDupExTag },
+    { "RTMemDupTag",                            (void *)RTMemDupTag },
+    { "RTMemFree",                              (void *)RTMemFree },
+    { "RTMemFreeEx",                            (void *)RTMemFreeEx },
+    { "RTMemReallocTag",                        (void *)RTMemReallocTag },
+    { "RTMpCpuId",                              (void *)RTMpCpuId },
+    { "RTMpCpuIdFromSetIndex",                  (void *)RTMpCpuIdFromSetIndex },
+    { "RTMpCpuIdToSetIndex",                    (void *)RTMpCpuIdToSetIndex },
+    { "RTMpCurSetIndex",                        (void *)RTMpCurSetIndex },
+    { "RTMpCurSetIndexAndId",                   (void *)RTMpCurSetIndexAndId },
+    { "RTMpGetArraySize",                       (void *)RTMpGetArraySize },
+    { "RTMpGetCount",                           (void *)RTMpGetCount },
+    { "RTMpGetMaxCpuId",                        (void *)RTMpGetMaxCpuId },
+    { "RTMpGetOnlineCount",                     (void *)RTMpGetOnlineCount },
+    { "RTMpGetOnlineSet",                       (void *)RTMpGetOnlineSet },
+    { "RTMpGetSet",                             (void *)RTMpGetSet },
+    { "RTMpIsCpuOnline",                        (void *)RTMpIsCpuOnline },
+    { "RTMpIsCpuPossible",                      (void *)RTMpIsCpuPossible },
+    { "RTMpIsCpuWorkPending",                   (void *)RTMpIsCpuWorkPending },
+    { "RTMpNotificationDeregister",             (void *)RTMpNotificationDeregister },
+    { "RTMpNotificationRegister",               (void *)RTMpNotificationRegister },
+    { "RTMpOnAll",                              (void *)RTMpOnAll },
+    { "RTMpOnOthers",                           (void *)RTMpOnOthers },
+    { "RTMpOnSpecific",                         (void *)RTMpOnSpecific },
+    { "RTMpPokeCpu",                            (void *)RTMpPokeCpu },
+    { "RTNetIPv4AddDataChecksum",               (void *)RTNetIPv4AddDataChecksum },
+    { "RTNetIPv4AddTCPChecksum",                (void *)RTNetIPv4AddTCPChecksum },
+    { "RTNetIPv4AddUDPChecksum",                (void *)RTNetIPv4AddUDPChecksum },
+    { "RTNetIPv4FinalizeChecksum",              (void *)RTNetIPv4FinalizeChecksum },
+    { "RTNetIPv4HdrChecksum",                   (void *)RTNetIPv4HdrChecksum },
+    { "RTNetIPv4IsDHCPValid",                   (void *)RTNetIPv4IsDHCPValid },
+    { "RTNetIPv4IsHdrValid",                    (void *)RTNetIPv4IsHdrValid },
+    { "RTNetIPv4IsTCPSizeValid",                (void *)RTNetIPv4IsTCPSizeValid },
+    { "RTNetIPv4IsTCPValid",                    (void *)RTNetIPv4IsTCPValid },
+    { "RTNetIPv4IsUDPSizeValid",                (void *)RTNetIPv4IsUDPSizeValid },
+    { "RTNetIPv4IsUDPValid",                    (void *)RTNetIPv4IsUDPValid },
+    { "RTNetIPv4PseudoChecksum",                (void *)RTNetIPv4PseudoChecksum },
+    { "RTNetIPv4PseudoChecksumBits",            (void *)RTNetIPv4PseudoChecksumBits },
+    { "RTNetIPv4TCPChecksum",                   (void *)RTNetIPv4TCPChecksum },
+    { "RTNetIPv4UDPChecksum",                   (void *)RTNetIPv4UDPChecksum },
+    { "RTNetIPv6PseudoChecksum",                (void *)RTNetIPv6PseudoChecksum },
+    { "RTNetIPv6PseudoChecksumBits",            (void *)RTNetIPv6PseudoChecksumBits },
+    { "RTNetIPv6PseudoChecksumEx",              (void *)RTNetIPv6PseudoChecksumEx },
+    { "RTNetTCPChecksum",                       (void *)RTNetTCPChecksum },
+    { "RTNetUDPChecksum",                       (void *)RTNetUDPChecksum },
+    { "RTPowerNotificationDeregister",          (void *)RTPowerNotificationDeregister },
+    { "RTPowerNotificationRegister",            (void *)RTPowerNotificationRegister },
+    { "RTProcSelf",                             (void *)RTProcSelf },
+    { "RTR0AssertPanicSystem",                  (void *)RTR0AssertPanicSystem },
+    { "RTR0MemAreKrnlAndUsrDifferent",          (void *)RTR0MemAreKrnlAndUsrDifferent },
+    { "RTR0MemKernelIsValidAddr",               (void *)RTR0MemKernelIsValidAddr },
+    { "RTR0MemKernelCopyFrom",                  (void *)RTR0MemKernelCopyFrom },
+    { "RTR0MemKernelCopyTo",                    (void *)RTR0MemKernelCopyTo },
+    { "RTR0MemObjAddress",                      (void *)RTR0MemObjAddress },
+    { "RTR0MemObjAddressR3",                    (void *)RTR0MemObjAddressR3 },
+    { "RTR0MemObjAllocContTag",                 (void *)RTR0MemObjAllocContTag },
+    { "RTR0MemObjAllocLowTag",                  (void *)RTR0MemObjAllocLowTag },
+    { "RTR0MemObjAllocPageTag",                 (void *)RTR0MemObjAllocPageTag },
+    { "RTR0MemObjAllocPhysExTag",               (void *)RTR0MemObjAllocPhysExTag },
+    { "RTR0MemObjAllocPhysNCTag",               (void *)RTR0MemObjAllocPhysNCTag },
+    { "RTR0MemObjAllocPhysTag",                 (void *)RTR0MemObjAllocPhysTag },
+    { "RTR0MemObjEnterPhysTag",                 (void *)RTR0MemObjEnterPhysTag },
+    { "RTR0MemObjFree",                         (void *)RTR0MemObjFree },
+    { "RTR0MemObjGetPagePhysAddr",              (void *)RTR0MemObjGetPagePhysAddr },
+    { "RTR0MemObjIsMapping",                    (void *)RTR0MemObjIsMapping },
+    { "RTR0MemObjLockUserTag",                  (void *)RTR0MemObjLockUserTag },
+    { "RTR0MemObjMapKernelExTag",               (void *)RTR0MemObjMapKernelExTag },
+    { "RTR0MemObjMapKernelTag",                 (void *)RTR0MemObjMapKernelTag },
+    { "RTR0MemObjMapUserTag",                   (void *)RTR0MemObjMapUserTag },
+    { "RTR0MemObjProtect",                      (void *)RTR0MemObjProtect },
+    { "RTR0MemObjSize",                         (void *)RTR0MemObjSize },
+    { "RTR0MemUserCopyFrom",                    (void *)RTR0MemUserCopyFrom },
+    { "RTR0MemUserCopyTo",                      (void *)RTR0MemUserCopyTo },
+    { "RTR0MemUserIsValidAddr",                 (void *)RTR0MemUserIsValidAddr },
+    { "RTR0ProcHandleSelf",                     (void *)RTR0ProcHandleSelf },
+    { "RTSemEventCreate",                       (void *)RTSemEventCreate },
+    { "RTSemEventDestroy",                      (void *)RTSemEventDestroy },
+    { "RTSemEventGetResolution",                (void *)RTSemEventGetResolution },
+    { "RTSemEventMultiCreate",                  (void *)RTSemEventMultiCreate },
+    { "RTSemEventMultiDestroy",                 (void *)RTSemEventMultiDestroy },
+    { "RTSemEventMultiGetResolution",           (void *)RTSemEventMultiGetResolution },
+    { "RTSemEventMultiReset",                   (void *)RTSemEventMultiReset },
+    { "RTSemEventMultiSignal",                  (void *)RTSemEventMultiSignal },
+    { "RTSemEventMultiWait",                    (void *)RTSemEventMultiWait },
+    { "RTSemEventMultiWaitEx",                  (void *)RTSemEventMultiWaitEx },
+    { "RTSemEventMultiWaitExDebug",             (void *)RTSemEventMultiWaitExDebug },
+    { "RTSemEventMultiWaitNoResume",            (void *)RTSemEventMultiWaitNoResume },
+    { "RTSemEventSignal",                       (void *)RTSemEventSignal },
+    { "RTSemEventWait",                         (void *)RTSemEventWait },
+    { "RTSemEventWaitEx",                       (void *)RTSemEventWaitEx },
+    { "RTSemEventWaitExDebug",                  (void *)RTSemEventWaitExDebug },
+    { "RTSemEventWaitNoResume",                 (void *)RTSemEventWaitNoResume },
+    { "RTSemFastMutexCreate",                   (void *)RTSemFastMutexCreate },
+    { "RTSemFastMutexDestroy",                  (void *)RTSemFastMutexDestroy },
+    { "RTSemFastMutexRelease",                  (void *)RTSemFastMutexRelease },
+    { "RTSemFastMutexRequest",                  (void *)RTSemFastMutexRequest },
+    { "RTSemMutexCreate",                       (void *)RTSemMutexCreate },
+    { "RTSemMutexDestroy",                      (void *)RTSemMutexDestroy },
+    { "RTSemMutexRelease",                      (void *)RTSemMutexRelease },
+    { "RTSemMutexRequest",                      (void *)RTSemMutexRequest },
+    { "RTSemMutexRequestDebug",                 (void *)RTSemMutexRequestDebug },
+    { "RTSemMutexRequestNoResume",              (void *)RTSemMutexRequestNoResume },
+    { "RTSemMutexRequestNoResumeDebug",         (void *)RTSemMutexRequestNoResumeDebug },
+    { "RTSpinlockAcquire",                      (void *)RTSpinlockAcquire },
+    { "RTSpinlockCreate",                       (void *)RTSpinlockCreate },
+    { "RTSpinlockDestroy",                      (void *)RTSpinlockDestroy },
+    { "RTSpinlockRelease",                      (void *)RTSpinlockRelease },
+    { "RTStrCopy",                              (void *)RTStrCopy },
+    { "RTStrDupTag",                            (void *)RTStrDupTag },
+    { "RTStrFormat",                            (void *)RTStrFormat },
+    { "RTStrFormatNumber",                      (void *)RTStrFormatNumber },
+    { "RTStrFormatTypeDeregister",              (void *)RTStrFormatTypeDeregister },
+    { "RTStrFormatTypeRegister",                (void *)RTStrFormatTypeRegister },
+    { "RTStrFormatTypeSetUser",                 (void *)RTStrFormatTypeSetUser },
+    { "RTStrFormatV",                           (void *)RTStrFormatV },
+    { "RTStrFree",                              (void *)RTStrFree },
+    { "RTStrNCmp",                              (void *)RTStrNCmp },
+    { "RTStrPrintf",                            (void *)RTStrPrintf },
+    { "RTStrPrintfEx",                          (void *)RTStrPrintfEx },
+    { "RTStrPrintfExV",                         (void *)RTStrPrintfExV },
+    { "RTStrPrintfV",                           (void *)RTStrPrintfV },
+    { "RTThreadCreate",                         (void *)RTThreadCreate },
+    { "RTThreadCtxHookIsEnabled",               (void *)RTThreadCtxHookIsEnabled },
+    { "RTThreadCtxHookCreate",                  (void *)RTThreadCtxHookCreate },
+    { "RTThreadCtxHookDestroy",                 (void *)RTThreadCtxHookDestroy },
+    { "RTThreadCtxHookDisable",                 (void *)RTThreadCtxHookDisable },
+    { "RTThreadCtxHookEnable",                  (void *)RTThreadCtxHookEnable },
+    { "RTThreadGetName",                        (void *)RTThreadGetName },
+    { "RTThreadGetNative",                      (void *)RTThreadGetNative },
+    { "RTThreadGetType",                        (void *)RTThreadGetType },
+    { "RTThreadIsInInterrupt",                  (void *)RTThreadIsInInterrupt },
+    { "RTThreadNativeSelf",                     (void *)RTThreadNativeSelf },
+    { "RTThreadPreemptDisable",                 (void *)RTThreadPreemptDisable },
+    { "RTThreadPreemptIsEnabled",               (void *)RTThreadPreemptIsEnabled },
+    { "RTThreadPreemptIsPending",               (void *)RTThreadPreemptIsPending },
+    { "RTThreadPreemptIsPendingTrusty",         (void *)RTThreadPreemptIsPendingTrusty },
+    { "RTThreadPreemptIsPossible",              (void *)RTThreadPreemptIsPossible },
+    { "RTThreadPreemptRestore",                 (void *)RTThreadPreemptRestore },
+    { "RTThreadSelf",                           (void *)RTThreadSelf },
+    { "RTThreadSelfName",                       (void *)RTThreadSelfName },
+    { "RTThreadSleep",                          (void *)RTThreadSleep },
+    { "RTThreadUserReset",                      (void *)RTThreadUserReset },
+    { "RTThreadUserSignal",                     (void *)RTThreadUserSignal },
+    { "RTThreadUserWait",                       (void *)RTThreadUserWait },
+    { "RTThreadUserWaitNoResume",               (void *)RTThreadUserWaitNoResume },
+    { "RTThreadWait",                           (void *)RTThreadWait },
+    { "RTThreadWaitNoResume",                   (void *)RTThreadWaitNoResume },
+    { "RTThreadYield",                          (void *)RTThreadYield },
+    { "RTTimeMilliTS",                          (void *)RTTimeMilliTS },
+    { "RTTimeNanoTS",                           (void *)RTTimeNanoTS },
+    { "RTTimeNow",                              (void *)RTTimeNow },
+    { "RTTimerCanDoHighResolution",             (void *)RTTimerCanDoHighResolution },
+    { "RTTimerChangeInterval",                  (void *)RTTimerChangeInterval },
+    { "RTTimerCreate",                          (void *)RTTimerCreate },
+    { "RTTimerCreateEx",                        (void *)RTTimerCreateEx },
+    { "RTTimerDestroy",                         (void *)RTTimerDestroy },
+    { "RTTimerGetSystemGranularity",            (void *)RTTimerGetSystemGranularity },
+    { "RTTimerReleaseSystemGranularity",        (void *)RTTimerReleaseSystemGranularity },
+    { "RTTimerRequestSystemGranularity",        (void *)RTTimerRequestSystemGranularity },
+    { "RTTimerStart",                           (void *)RTTimerStart },
+    { "RTTimerStop",                            (void *)RTTimerStop },
+    { "RTTimeSystemMilliTS",                    (void *)RTTimeSystemMilliTS },
+    { "RTTimeSystemNanoTS",                     (void *)RTTimeSystemNanoTS },
+    { "RTUuidCompare",                          (void *)RTUuidCompare },
+    { "RTUuidCompareStr",                       (void *)RTUuidCompareStr },
+    { "RTUuidFromStr",                          (void *)RTUuidFromStr },
+/* SED: END */
+};
+
+#if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
+/**
+ * Drag in the rest of IRPT since we share it with the
+ * rest of the kernel modules on darwin.
+ */
+PFNRT g_apfnVBoxDrvIPRTDeps[] =
+{
+    /* VBoxNetAdp */
+    (PFNRT)RTRandBytes,
+    /* VBoxUSB */
+    (PFNRT)RTPathStripFilename,
+    NULL
+};
+#endif  /* RT_OS_DARWIN || RT_OS_SOLARIS || RT_OS_SOLARIS */
+
+
+/**
+ * Initializes the device extentsion structure.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt     The device extension to initialize.
+ * @param   cbSession   The size of the session structure.  The size of
+ *                      SUPDRVSESSION may be smaller when SUPDRV_AGNOSTIC is
+ *                      defined because we're skipping the OS specific members
+ *                      then.
+ */
+int VBOXCALL supdrvInitDevExt(PSUPDRVDEVEXT pDevExt, size_t cbSession)
+{
+    int rc;
+
+#ifdef SUPDRV_WITH_RELEASE_LOGGER
+    /*
+     * Create the release log.
+     */
+    static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
+    PRTLOGGER pRelLogger;
+    rc = RTLogCreate(&pRelLogger, 0 /* fFlags */, "all",
+                     "VBOX_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups, RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER, NULL);
+    if (RT_SUCCESS(rc))
+        RTLogRelSetDefaultInstance(pRelLogger);
+    /** @todo Add native hook for getting logger config parameters and setting
+     *        them. On linux we should use the module parameter stuff... */
+#endif
+
+    /*
+     * Initialize it.
+     */
+    memset(pDevExt, 0, sizeof(*pDevExt)); /* Does not wipe OS specific tail section of the structure. */
+    pDevExt->Spinlock = NIL_RTSPINLOCK;
+    pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
+    pDevExt->hSessionHashTabSpinlock = NIL_RTSPINLOCK;
+#ifdef SUPDRV_USE_MUTEX_FOR_LDR
+    pDevExt->mtxLdr = NIL_RTSEMMUTEX;
+#else
+    pDevExt->mtxLdr = NIL_RTSEMFASTMUTEX;
+#endif
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    pDevExt->mtxGip = NIL_RTSEMMUTEX;
+    pDevExt->mtxTscDelta = NIL_RTSEMMUTEX;
+#else
+    pDevExt->mtxGip = NIL_RTSEMFASTMUTEX;
+    pDevExt->mtxTscDelta = NIL_RTSEMFASTMUTEX;
+#endif
+
+    rc = RTSpinlockCreate(&pDevExt->Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "SUPDrvDevExt");
+    if (RT_SUCCESS(rc))
+        rc = RTSpinlockCreate(&pDevExt->hGipSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "SUPDrvGip");
+    if (RT_SUCCESS(rc))
+        rc = RTSpinlockCreate(&pDevExt->hSessionHashTabSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "SUPDrvSession");
+
+    if (RT_SUCCESS(rc))
+#ifdef SUPDRV_USE_MUTEX_FOR_LDR
+        rc = RTSemMutexCreate(&pDevExt->mtxLdr);
+#else
+        rc = RTSemFastMutexCreate(&pDevExt->mtxLdr);
+#endif
+    if (RT_SUCCESS(rc))
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+        rc = RTSemMutexCreate(&pDevExt->mtxTscDelta);
+#else
+        rc = RTSemFastMutexCreate(&pDevExt->mtxTscDelta);
+#endif
+    if (RT_SUCCESS(rc))
+    {
+        rc = RTSemFastMutexCreate(&pDevExt->mtxComponentFactory);
+        if (RT_SUCCESS(rc))
+        {
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+            rc = RTSemMutexCreate(&pDevExt->mtxGip);
+#else
+            rc = RTSemFastMutexCreate(&pDevExt->mtxGip);
+#endif
+            if (RT_SUCCESS(rc))
+            {
+                rc = supdrvGipCreate(pDevExt);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = supdrvTracerInit(pDevExt);
+                    if (RT_SUCCESS(rc))
+                    {
+                        pDevExt->pLdrInitImage  = NULL;
+                        pDevExt->hLdrInitThread = NIL_RTNATIVETHREAD;
+                        pDevExt->u32Cookie      = BIRD;  /** @todo make this random? */
+                        pDevExt->cbSession      = (uint32_t)cbSession;
+
+                        /*
+                         * Fixup the absolute symbols.
+                         *
+                         * Because of the table indexing assumptions we'll have a little #ifdef orgy
+                         * here rather than distributing this to OS specific files. At least for now.
+                         */
+#ifdef RT_OS_DARWIN
+# if ARCH_BITS == 32
+                        if (SUPR0GetPagingMode() >= SUPPAGINGMODE_AMD64)
+                        {
+                            g_aFunctions[0].pfn = (void *)1;                    /* SUPR0AbsIs64bit */
+                            g_aFunctions[1].pfn = (void *)0x80;                 /* SUPR0Abs64bitKernelCS - KERNEL64_CS, seg.h */
+                            g_aFunctions[2].pfn = (void *)0x88;                 /* SUPR0Abs64bitKernelSS - KERNEL64_SS, seg.h */
+                            g_aFunctions[3].pfn = (void *)0x88;                 /* SUPR0Abs64bitKernelDS - KERNEL64_SS, seg.h */
+                        }
+                        else
+                            g_aFunctions[0].pfn = g_aFunctions[1].pfn = g_aFunctions[2].pfn = g_aFunctions[4].pfn = (void *)0;
+                        g_aFunctions[4].pfn = (void *)0x08;                     /* SUPR0AbsKernelCS - KERNEL_CS, seg.h */
+                        g_aFunctions[5].pfn = (void *)0x10;                     /* SUPR0AbsKernelSS - KERNEL_DS, seg.h */
+                        g_aFunctions[6].pfn = (void *)0x10;                     /* SUPR0AbsKernelDS - KERNEL_DS, seg.h */
+                        g_aFunctions[7].pfn = (void *)0x10;                     /* SUPR0AbsKernelES - KERNEL_DS, seg.h */
+                        g_aFunctions[8].pfn = (void *)0x10;                     /* SUPR0AbsKernelFS - KERNEL_DS, seg.h */
+                        g_aFunctions[9].pfn = (void *)0x48;                     /* SUPR0AbsKernelGS - CPU_DATA_GS, seg.h */
+# else /* 64-bit darwin: */
+                        g_aFunctions[0].pfn = (void *)1;                        /* SUPR0AbsIs64bit */
+                        g_aFunctions[1].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0Abs64bitKernelCS */
+                        g_aFunctions[2].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0Abs64bitKernelSS */
+                        g_aFunctions[3].pfn = (void *)0;                        /* SUPR0Abs64bitKernelDS */
+                        g_aFunctions[4].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0AbsKernelCS */
+                        g_aFunctions[5].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0AbsKernelSS */
+                        g_aFunctions[6].pfn = (void *)0;                        /* SUPR0AbsKernelDS */
+                        g_aFunctions[7].pfn = (void *)0;                        /* SUPR0AbsKernelES */
+                        g_aFunctions[8].pfn = (void *)0;                        /* SUPR0AbsKernelFS */
+                        g_aFunctions[9].pfn = (void *)0;                        /* SUPR0AbsKernelGS */
+
+# endif
+#else  /* !RT_OS_DARWIN */
+# if ARCH_BITS == 64
+                        g_aFunctions[0].pfn = (void *)1;                        /* SUPR0AbsIs64bit */
+                        g_aFunctions[1].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0Abs64bitKernelCS */
+                        g_aFunctions[2].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0Abs64bitKernelSS */
+                        g_aFunctions[3].pfn = (void *)(uintptr_t)ASMGetDS();    /* SUPR0Abs64bitKernelDS */
+# else
+                        g_aFunctions[0].pfn = g_aFunctions[1].pfn = g_aFunctions[2].pfn = g_aFunctions[4].pfn = (void *)0;
+# endif
+                        g_aFunctions[4].pfn = (void *)(uintptr_t)ASMGetCS();    /* SUPR0AbsKernelCS */
+                        g_aFunctions[5].pfn = (void *)(uintptr_t)ASMGetSS();    /* SUPR0AbsKernelSS */
+                        g_aFunctions[6].pfn = (void *)(uintptr_t)ASMGetDS();    /* SUPR0AbsKernelDS */
+                        g_aFunctions[7].pfn = (void *)(uintptr_t)ASMGetES();    /* SUPR0AbsKernelES */
+                        g_aFunctions[8].pfn = (void *)(uintptr_t)ASMGetFS();    /* SUPR0AbsKernelFS */
+                        g_aFunctions[9].pfn = (void *)(uintptr_t)ASMGetGS();    /* SUPR0AbsKernelGS */
+#endif /* !RT_OS_DARWIN */
+                        return VINF_SUCCESS;
+                    }
+
+                    supdrvGipDestroy(pDevExt);
+                }
+
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+                RTSemMutexDestroy(pDevExt->mtxGip);
+                pDevExt->mtxGip = NIL_RTSEMMUTEX;
+#else
+                RTSemFastMutexDestroy(pDevExt->mtxGip);
+                pDevExt->mtxGip = NIL_RTSEMFASTMUTEX;
+#endif
+            }
+            RTSemFastMutexDestroy(pDevExt->mtxComponentFactory);
+            pDevExt->mtxComponentFactory = NIL_RTSEMFASTMUTEX;
+        }
+    }
+
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    RTSemMutexDestroy(pDevExt->mtxTscDelta);
+    pDevExt->mtxTscDelta = NIL_RTSEMMUTEX;
+#else
+    RTSemFastMutexDestroy(pDevExt->mtxTscDelta);
+    pDevExt->mtxTscDelta = NIL_RTSEMFASTMUTEX;
+#endif
+#ifdef SUPDRV_USE_MUTEX_FOR_LDR
+    RTSemMutexDestroy(pDevExt->mtxLdr);
+    pDevExt->mtxLdr = NIL_RTSEMMUTEX;
+#else
+    RTSemFastMutexDestroy(pDevExt->mtxLdr);
+    pDevExt->mtxLdr = NIL_RTSEMFASTMUTEX;
+#endif
+    RTSpinlockDestroy(pDevExt->Spinlock);
+    pDevExt->Spinlock = NIL_RTSPINLOCK;
+    RTSpinlockDestroy(pDevExt->hGipSpinlock);
+    pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
+    RTSpinlockDestroy(pDevExt->hSessionHashTabSpinlock);
+    pDevExt->hSessionHashTabSpinlock = NIL_RTSPINLOCK;
+
+#ifdef SUPDRV_WITH_RELEASE_LOGGER
+    RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
+    RTLogDestroy(RTLogSetDefaultInstance(NULL));
+#endif
+
+    return rc;
+}
+
+
+/**
+ * Delete the device extension (e.g. cleanup members).
+ *
+ * @param   pDevExt     The device extension to delete.
+ */
+void VBOXCALL supdrvDeleteDevExt(PSUPDRVDEVEXT pDevExt)
+{
+    PSUPDRVOBJ          pObj;
+    PSUPDRVUSAGE        pUsage;
+
+    /*
+     * Kill mutexes and spinlocks.
+     */
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    RTSemMutexDestroy(pDevExt->mtxGip);
+    pDevExt->mtxGip = NIL_RTSEMMUTEX;
+    RTSemMutexDestroy(pDevExt->mtxTscDelta);
+    pDevExt->mtxTscDelta = NIL_RTSEMMUTEX;
+#else
+    RTSemFastMutexDestroy(pDevExt->mtxGip);
+    pDevExt->mtxGip = NIL_RTSEMFASTMUTEX;
+    RTSemFastMutexDestroy(pDevExt->mtxTscDelta);
+    pDevExt->mtxTscDelta = NIL_RTSEMFASTMUTEX;
+#endif
+#ifdef SUPDRV_USE_MUTEX_FOR_LDR
+    RTSemMutexDestroy(pDevExt->mtxLdr);
+    pDevExt->mtxLdr = NIL_RTSEMMUTEX;
+#else
+    RTSemFastMutexDestroy(pDevExt->mtxLdr);
+    pDevExt->mtxLdr = NIL_RTSEMFASTMUTEX;
+#endif
+    RTSpinlockDestroy(pDevExt->Spinlock);
+    pDevExt->Spinlock = NIL_RTSPINLOCK;
+    RTSemFastMutexDestroy(pDevExt->mtxComponentFactory);
+    pDevExt->mtxComponentFactory = NIL_RTSEMFASTMUTEX;
+    RTSpinlockDestroy(pDevExt->hSessionHashTabSpinlock);
+    pDevExt->hSessionHashTabSpinlock = NIL_RTSPINLOCK;
+
+    /*
+     * Free lists.
+     */
+    /* objects. */
+    pObj = pDevExt->pObjs;
+    Assert(!pObj);                      /* (can trigger on forced unloads) */
+    pDevExt->pObjs = NULL;
+    while (pObj)
+    {
+        void *pvFree = pObj;
+        pObj = pObj->pNext;
+        RTMemFree(pvFree);
+    }
+
+    /* usage records. */
+    pUsage = pDevExt->pUsageFree;
+    pDevExt->pUsageFree = NULL;
+    while (pUsage)
+    {
+        void *pvFree = pUsage;
+        pUsage = pUsage->pNext;
+        RTMemFree(pvFree);
+    }
+
+    /* kill the GIP. */
+    supdrvGipDestroy(pDevExt);
+    RTSpinlockDestroy(pDevExt->hGipSpinlock);
+    pDevExt->hGipSpinlock = NIL_RTSPINLOCK;
+
+    supdrvTracerTerm(pDevExt);
+
+#ifdef SUPDRV_WITH_RELEASE_LOGGER
+    /* destroy the loggers. */
+    RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
+    RTLogDestroy(RTLogSetDefaultInstance(NULL));
+#endif
+}
+
+
+/**
+ * Create session.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt         Device extension.
+ * @param   fUser           Flag indicating whether this is a user or kernel
+ *                          session.
+ * @param   fUnrestricted   Unrestricted access (system) or restricted access
+ *                          (user)?
+ * @param   ppSession       Where to store the pointer to the session data.
+ */
+int VBOXCALL supdrvCreateSession(PSUPDRVDEVEXT pDevExt, bool fUser, bool fUnrestricted, PSUPDRVSESSION *ppSession)
+{
+    int             rc;
+    PSUPDRVSESSION  pSession;
+
+    if (!SUP_IS_DEVEXT_VALID(pDevExt))
+        return VERR_INVALID_PARAMETER;
+
+    /*
+     * Allocate memory for the session data.
+     */
+    pSession = *ppSession = (PSUPDRVSESSION)RTMemAllocZ(pDevExt->cbSession);
+    if (pSession)
+    {
+        /* Initialize session data. */
+        rc = RTSpinlockCreate(&pSession->Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, "SUPDrvSession");
+        if (!rc)
+        {
+            rc = RTHandleTableCreateEx(&pSession->hHandleTable,
+                                       RTHANDLETABLE_FLAGS_LOCKED_IRQ_SAFE | RTHANDLETABLE_FLAGS_CONTEXT,
+                                       1 /*uBase*/, 32768 /*cMax*/, supdrvSessionObjHandleRetain, pSession);
+            if (RT_SUCCESS(rc))
+            {
+                Assert(pSession->Spinlock != NIL_RTSPINLOCK);
+                pSession->pDevExt           = pDevExt;
+                pSession->u32Cookie         = BIRD_INV;
+                pSession->fUnrestricted     = fUnrestricted;
+                /*pSession->fInHashTable      = false; */
+                pSession->cRefs             = 1;
+                /*pSession->pCommonNextHash   = NULL;
+                pSession->ppOsSessionPtr    = NULL; */
+                if (fUser)
+                {
+                    pSession->Process       = RTProcSelf();
+                    pSession->R0Process     = RTR0ProcHandleSelf();
+                }
+                else
+                {
+                    pSession->Process       = NIL_RTPROCESS;
+                    pSession->R0Process     = NIL_RTR0PROCESS;
+                }
+                /*pSession->pLdrUsage         = NULL;
+                pSession->pVM               = NULL;
+                pSession->pUsage            = NULL;
+                pSession->pGip              = NULL;
+                pSession->fGipReferenced    = false;
+                pSession->Bundle.cUsed      = 0; */
+                pSession->Uid               = NIL_RTUID;
+                pSession->Gid               = NIL_RTGID;
+                /*pSession->uTracerData       = 0;*/
+                pSession->hTracerCaller     = NIL_RTNATIVETHREAD;
+                RTListInit(&pSession->TpProviders);
+                /*pSession->cTpProviders      = 0;*/
+                /*pSession->cTpProbesFiring   = 0;*/
+                RTListInit(&pSession->TpUmods);
+                /*RT_ZERO(pSession->apTpLookupTable);*/
+
+                VBOXDRV_SESSION_CREATE(pSession, fUser);
+                LogFlow(("Created session %p initial cookie=%#x\n", pSession, pSession->u32Cookie));
+                return VINF_SUCCESS;
+            }
+
+            RTSpinlockDestroy(pSession->Spinlock);
+        }
+        RTMemFree(pSession);
+        *ppSession = NULL;
+        Log(("Failed to create spinlock, rc=%d!\n", rc));
+    }
+    else
+        rc = VERR_NO_MEMORY;
+
+    return rc;
+}
+
+
+/**
+ * Cleans up the session in the context of the process to which it belongs, the
+ * caller will free the session and the session spinlock.
+ *
+ * This should normally occur when the session is closed or as the process
+ * exits.  Careful reference counting in the OS specfic code makes sure that
+ * there cannot be any races between process/handle cleanup callbacks and
+ * threads doing I/O control calls.
+ *
+ * @param   pDevExt     The device extension.
+ * @param   pSession    Session data.
+ */
+static void supdrvCleanupSession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
+{
+    int                 rc;
+    PSUPDRVBUNDLE       pBundle;
+    LogFlow(("supdrvCleanupSession: pSession=%p\n", pSession));
+
+    Assert(!pSession->fInHashTable);
+    Assert(!pSession->ppOsSessionPtr);
+    AssertReleaseMsg(pSession->R0Process == RTR0ProcHandleSelf() || pSession->R0Process == NIL_RTR0PROCESS,
+                     ("R0Process=%p cur=%p; Process=%u curpid=%u\n", RTR0ProcHandleSelf(), RTProcSelf()));
+
+    /*
+     * Remove logger instances related to this session.
+     */
+    RTLogSetDefaultInstanceThread(NULL, (uintptr_t)pSession);
+
+    /*
+     * Destroy the handle table.
+     */
+    rc = RTHandleTableDestroy(pSession->hHandleTable, supdrvSessionObjHandleDelete, pSession);
+    AssertRC(rc);
+    pSession->hHandleTable = NIL_RTHANDLETABLE;
+
+    /*
+     * Release object references made in this session.
+     * In theory there should be noone racing us in this session.
+     */
+    Log2(("release objects - start\n"));
+    if (pSession->pUsage)
+    {
+        PSUPDRVUSAGE    pUsage;
+        RTSpinlockAcquire(pDevExt->Spinlock);
+
+        while ((pUsage = pSession->pUsage) != NULL)
+        {
+            PSUPDRVOBJ  pObj = pUsage->pObj;
+            pSession->pUsage = pUsage->pNext;
+
+            AssertMsg(pUsage->cUsage >= 1 && pObj->cUsage >= pUsage->cUsage, ("glob %d; sess %d\n", pObj->cUsage, pUsage->cUsage));
+            if (pUsage->cUsage < pObj->cUsage)
+            {
+                pObj->cUsage -= pUsage->cUsage;
+                RTSpinlockRelease(pDevExt->Spinlock);
+            }
+            else
+            {
+                /* Destroy the object and free the record. */
+                if (pDevExt->pObjs == pObj)
+                    pDevExt->pObjs = pObj->pNext;
+                else
+                {
+                    PSUPDRVOBJ pObjPrev;
+                    for (pObjPrev = pDevExt->pObjs; pObjPrev; pObjPrev = pObjPrev->pNext)
+                        if (pObjPrev->pNext == pObj)
+                        {
+                            pObjPrev->pNext = pObj->pNext;
+                            break;
+                        }
+                    Assert(pObjPrev);
+                }
+                RTSpinlockRelease(pDevExt->Spinlock);
+
+                Log(("supdrvCleanupSession: destroying %p/%d (%p/%p) cpid=%RTproc pid=%RTproc dtor=%p\n",
+                     pObj, pObj->enmType, pObj->pvUser1, pObj->pvUser2, pObj->CreatorProcess, RTProcSelf(), pObj->pfnDestructor));
+                if (pObj->pfnDestructor)
+                    pObj->pfnDestructor(pObj, pObj->pvUser1, pObj->pvUser2);
+                RTMemFree(pObj);
+            }
+
+            /* free it and continue. */
+            RTMemFree(pUsage);
+
+            RTSpinlockAcquire(pDevExt->Spinlock);
+        }
+
+        RTSpinlockRelease(pDevExt->Spinlock);
+        AssertMsg(!pSession->pUsage, ("Some buster reregistered an object during desturction!\n"));
+    }
+    Log2(("release objects - done\n"));
+
+    /*
+     * Do tracer cleanups related to this session.
+     */
+    Log2(("release tracer stuff - start\n"));
+    supdrvTracerCleanupSession(pDevExt, pSession);
+    Log2(("release tracer stuff - end\n"));
+
+    /*
+     * Release memory allocated in the session.
+     *
+     * We do not serialize this as we assume that the application will
+     * not allocated memory while closing the file handle object.
+     */
+    Log2(("freeing memory:\n"));
+    pBundle = &pSession->Bundle;
+    while (pBundle)
+    {
+        PSUPDRVBUNDLE   pToFree;
+        unsigned        i;
+
+        /*
+         * Check and unlock all entries in the bundle.
+         */
+        for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
+        {
+            if (pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ)
+            {
+                Log2(("eType=%d pvR0=%p pvR3=%p cb=%ld\n", pBundle->aMem[i].eType, RTR0MemObjAddress(pBundle->aMem[i].MemObj),
+                      (void *)RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3), (long)RTR0MemObjSize(pBundle->aMem[i].MemObj)));
+                if (pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ)
+                {
+                    rc = RTR0MemObjFree(pBundle->aMem[i].MapObjR3, false);
+                    AssertRC(rc); /** @todo figure out how to handle this. */
+                    pBundle->aMem[i].MapObjR3 = NIL_RTR0MEMOBJ;
+                }
+                rc = RTR0MemObjFree(pBundle->aMem[i].MemObj, true /* fFreeMappings */);
+                AssertRC(rc); /** @todo figure out how to handle this. */
+                pBundle->aMem[i].MemObj = NIL_RTR0MEMOBJ;
+                pBundle->aMem[i].eType = MEMREF_TYPE_UNUSED;
+            }
+        }
+
+        /*
+         * Advance and free previous bundle.
+         */
+        pToFree = pBundle;
+        pBundle = pBundle->pNext;
+
+        pToFree->pNext = NULL;
+        pToFree->cUsed = 0;
+        if (pToFree != &pSession->Bundle)
+            RTMemFree(pToFree);
+    }
+    Log2(("freeing memory - done\n"));
+
+    /*
+     * Deregister component factories.
+     */
+    RTSemFastMutexRequest(pDevExt->mtxComponentFactory);
+    Log2(("deregistering component factories:\n"));
+    if (pDevExt->pComponentFactoryHead)
+    {
+        PSUPDRVFACTORYREG pPrev = NULL;
+        PSUPDRVFACTORYREG pCur = pDevExt->pComponentFactoryHead;
+        while (pCur)
+        {
+            if (pCur->pSession == pSession)
+            {
+                /* unlink it */
+                PSUPDRVFACTORYREG pNext = pCur->pNext;
+                if (pPrev)
+                    pPrev->pNext = pNext;
+                else
+                    pDevExt->pComponentFactoryHead = pNext;
+
+                /* free it */
+                pCur->pNext = NULL;
+                pCur->pSession = NULL;
+                pCur->pFactory = NULL;
+                RTMemFree(pCur);
+
+                /* next */
+                pCur = pNext;
+            }
+            else
+            {
+                /* next */
+                pPrev = pCur;
+                pCur = pCur->pNext;
+            }
+        }
+    }
+    RTSemFastMutexRelease(pDevExt->mtxComponentFactory);
+    Log2(("deregistering component factories - done\n"));
+
+    /*
+     * Loaded images needs to be dereferenced and possibly freed up.
+     */
+    supdrvLdrLock(pDevExt);
+    Log2(("freeing images:\n"));
+    if (pSession->pLdrUsage)
+    {
+        PSUPDRVLDRUSAGE pUsage = pSession->pLdrUsage;
+        pSession->pLdrUsage = NULL;
+        while (pUsage)
+        {
+            void           *pvFree = pUsage;
+            PSUPDRVLDRIMAGE pImage = pUsage->pImage;
+            if (pImage->cUsage > pUsage->cUsage)
+                pImage->cUsage -= pUsage->cUsage;
+            else
+                supdrvLdrFree(pDevExt, pImage);
+            pUsage->pImage = NULL;
+            pUsage = pUsage->pNext;
+            RTMemFree(pvFree);
+        }
+    }
+    supdrvLdrUnlock(pDevExt);
+    Log2(("freeing images - done\n"));
+
+    /*
+     * Unmap the GIP.
+     */
+    Log2(("umapping GIP:\n"));
+    if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ)
+    {
+        SUPR0GipUnmap(pSession);
+        pSession->fGipReferenced = 0;
+    }
+    Log2(("umapping GIP - done\n"));
+}
+
+
+/**
+ * Common code for freeing a session when the reference count reaches zero.
+ *
+ * @param   pDevExt     Device extension.
+ * @param   pSession    Session data.
+ *                      This data will be freed by this routine.
+ */
+static void supdrvDestroySession(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
+{
+    VBOXDRV_SESSION_CLOSE(pSession);
+
+    /*
+     * Cleanup the session first.
+     */
+    supdrvCleanupSession(pDevExt, pSession);
+    supdrvOSCleanupSession(pDevExt, pSession);
+
+    /*
+     * Free the rest of the session stuff.
+     */
+    RTSpinlockDestroy(pSession->Spinlock);
+    pSession->Spinlock = NIL_RTSPINLOCK;
+    pSession->pDevExt = NULL;
+    RTMemFree(pSession);
+    LogFlow(("supdrvDestroySession: returns\n"));
+}
+
+
+/**
+ * Inserts the session into the global hash table.
+ *
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_WRONG_ORDER if the session was already inserted (asserted).
+ * @retval  VERR_INVALID_PARAMETER if the session handle is invalid or a ring-0
+ *          session (asserted).
+ * @retval  VERR_DUPLICATE if there is already a session for that pid.
+ *
+ * @param   pDevExt         The device extension.
+ * @param   pSession        The session.
+ * @param   ppOsSessionPtr  Pointer to the OS session pointer, if any is
+ *                          available and used.  This will set to point to the
+ *                          session while under the protection of the session
+ *                          hash table spinlock.  It will also be kept in
+ *                          PSUPDRVSESSION::ppOsSessionPtr for lookup and
+ *                          cleanup use.
+ * @param   pvUser          Argument for supdrvOSSessionHashTabInserted.
+ */
+int VBOXCALL supdrvSessionHashTabInsert(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVSESSION *ppOsSessionPtr,
+                                        void *pvUser)
+{
+    PSUPDRVSESSION  pCur;
+    unsigned        iHash;
+
+    /*
+     * Validate input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertReturn(pSession->R0Process != NIL_RTR0PROCESS, VERR_INVALID_PARAMETER);
+
+    /*
+     * Calculate the hash table index and acquire the spinlock.
+     */
+    iHash = SUPDRV_SESSION_HASH(pSession->Process);
+
+    RTSpinlockAcquire(pDevExt->hSessionHashTabSpinlock);
+
+    /*
+     * If there are a collisions, we need to carefully check if we got a
+     * duplicate.  There can only be one open session per process.
+     */
+    pCur = pDevExt->apSessionHashTab[iHash];
+    if (pCur)
+    {
+        while (pCur && pCur->Process != pSession->Process)
+            pCur = pCur->pCommonNextHash;
+
+        if (pCur)
+        {
+            RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
+            if (pCur == pSession)
+            {
+                Assert(pSession->fInHashTable);
+                AssertFailed();
+                return VERR_WRONG_ORDER;
+            }
+            Assert(!pSession->fInHashTable);
+            if (pCur->R0Process == pSession->R0Process)
+                return VERR_RESOURCE_IN_USE;
+            return VERR_DUPLICATE;
+        }
+    }
+    Assert(!pSession->fInHashTable);
+    Assert(!pSession->ppOsSessionPtr);
+
+    /*
+     * Insert it, doing a callout to the OS specific code in case it has
+     * anything it wishes to do while we're holding the spinlock.
+     */
+    pSession->pCommonNextHash = pDevExt->apSessionHashTab[iHash];
+    pDevExt->apSessionHashTab[iHash] = pSession;
+    pSession->fInHashTable    = true;
+    ASMAtomicIncS32(&pDevExt->cSessions);
+
+    pSession->ppOsSessionPtr = ppOsSessionPtr;
+    if (ppOsSessionPtr)
+        ASMAtomicWritePtr(ppOsSessionPtr, pSession);
+
+    supdrvOSSessionHashTabInserted(pDevExt, pSession, pvUser);
+
+    /*
+     * Retain a reference for the pointer in the session table.
+     */
+    ASMAtomicIncU32(&pSession->cRefs);
+
+    RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Removes the session from the global hash table.
+ *
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_NOT_FOUND if the session was already removed (asserted).
+ * @retval  VERR_INVALID_PARAMETER if the session handle is invalid or a ring-0
+ *          session (asserted).
+ *
+ * @param   pDevExt     The device extension.
+ * @param   pSession    The session. The caller is expected to have a reference
+ *                      to this so it won't croak on us when we release the hash
+ *                      table reference.
+ * @param   pvUser      OS specific context value for the
+ *                      supdrvOSSessionHashTabInserted callback.
+ */
+int VBOXCALL supdrvSessionHashTabRemove(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, void *pvUser)
+{
+    PSUPDRVSESSION  pCur;
+    unsigned        iHash;
+    int32_t         cRefs;
+
+    /*
+     * Validate input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertReturn(pSession->R0Process != NIL_RTR0PROCESS, VERR_INVALID_PARAMETER);
+
+    /*
+     * Calculate the hash table index and acquire the spinlock.
+     */
+    iHash = SUPDRV_SESSION_HASH(pSession->Process);
+
+    RTSpinlockAcquire(pDevExt->hSessionHashTabSpinlock);
+
+    /*
+     * Unlink it.
+     */
+    pCur = pDevExt->apSessionHashTab[iHash];
+    if (pCur == pSession)
+        pDevExt->apSessionHashTab[iHash] = pSession->pCommonNextHash;
+    else
+    {
+        PSUPDRVSESSION pPrev = pCur;
+        while (pCur && pCur != pSession)
+        {
+            pPrev = pCur;
+            pCur  = pCur->pCommonNextHash;
+        }
+        if (pCur)
+            pPrev->pCommonNextHash = pCur->pCommonNextHash;
+        else
+        {
+            Assert(!pSession->fInHashTable);
+            RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
+            return VERR_NOT_FOUND;
+        }
+    }
+
+    pSession->pCommonNextHash = NULL;
+    pSession->fInHashTable    = false;
+
+    ASMAtomicDecS32(&pDevExt->cSessions);
+
+    /*
+     * Clear OS specific session pointer if available and do the OS callback.
+     */
+    if (pSession->ppOsSessionPtr)
+    {
+        ASMAtomicCmpXchgPtr(pSession->ppOsSessionPtr, NULL, pSession);
+        pSession->ppOsSessionPtr = NULL;
+    }
+
+    supdrvOSSessionHashTabRemoved(pDevExt, pSession, pvUser);
+
+    RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
+
+    /*
+     * Drop the reference the hash table had to the session.  This shouldn't
+     * be the last reference!
+     */
+    cRefs = ASMAtomicDecU32(&pSession->cRefs);
+    Assert(cRefs > 0 && cRefs < _1M);
+    if (cRefs == 0)
+        supdrvDestroySession(pDevExt, pSession);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Looks up the session for the current process in the global hash table or in
+ * OS specific pointer.
+ *
+ * @returns Pointer to the session with a reference that the caller must
+ *          release.  If no valid session was found, NULL is returned.
+ *
+ * @param   pDevExt         The device extension.
+ * @param   Process         The process ID.
+ * @param   R0Process       The ring-0 process handle.
+ * @param   ppOsSessionPtr  The OS session pointer if available.  If not NULL,
+ *                          this is used instead of the hash table.  For
+ *                          additional safety it must then be equal to the
+ *                          SUPDRVSESSION::ppOsSessionPtr member.
+ *                          This can be NULL even if the OS has a session
+ *                          pointer.
+ */
+PSUPDRVSESSION VBOXCALL supdrvSessionHashTabLookup(PSUPDRVDEVEXT pDevExt, RTPROCESS Process, RTR0PROCESS R0Process,
+                                                   PSUPDRVSESSION *ppOsSessionPtr)
+{
+    PSUPDRVSESSION  pCur;
+    unsigned        iHash;
+
+    /*
+     * Validate input.
+     */
+    AssertReturn(R0Process != NIL_RTR0PROCESS, NULL);
+
+    /*
+     * Calculate the hash table index and acquire the spinlock.
+     */
+    iHash = SUPDRV_SESSION_HASH(Process);
+
+    RTSpinlockAcquire(pDevExt->hSessionHashTabSpinlock);
+
+    /*
+     * If an OS session pointer is provided, always use it.
+     */
+    if (ppOsSessionPtr)
+    {
+        pCur = *ppOsSessionPtr;
+        if (   pCur
+            && (   pCur->ppOsSessionPtr != ppOsSessionPtr
+                || pCur->Process        != Process
+                || pCur->R0Process      != R0Process) )
+            pCur = NULL;
+    }
+    else
+    {
+        /*
+         * Otherwise, do the hash table lookup.
+         */
+        pCur = pDevExt->apSessionHashTab[iHash];
+        while (   pCur
+               && (   pCur->Process   != Process
+                   || pCur->R0Process != R0Process) )
+            pCur = pCur->pCommonNextHash;
+    }
+
+    /*
+     * Retain the session.
+     */
+    if (pCur)
+    {
+        uint32_t cRefs = ASMAtomicIncU32(&pCur->cRefs);
+        NOREF(cRefs);
+        Assert(cRefs > 1 && cRefs < _1M);
+    }
+
+    RTSpinlockRelease(pDevExt->hSessionHashTabSpinlock);
+
+    return pCur;
+}
+
+
+/**
+ * Retain a session to make sure it doesn't go away while it is in use.
+ *
+ * @returns New reference count on success, UINT32_MAX on failure.
+ * @param   pSession    Session data.
+ */
+uint32_t VBOXCALL supdrvSessionRetain(PSUPDRVSESSION pSession)
+{
+    uint32_t cRefs;
+    AssertPtrReturn(pSession, UINT32_MAX);
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), UINT32_MAX);
+
+    cRefs = ASMAtomicIncU32(&pSession->cRefs);
+    AssertMsg(cRefs > 1 && cRefs < _1M, ("%#x %p\n", cRefs, pSession));
+    return cRefs;
+}
+
+
+/**
+ * Releases a given session.
+ *
+ * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
+ * @param   pSession    Session data.
+ */
+uint32_t VBOXCALL supdrvSessionRelease(PSUPDRVSESSION pSession)
+{
+    uint32_t cRefs;
+    AssertPtrReturn(pSession, UINT32_MAX);
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), UINT32_MAX);
+
+    cRefs = ASMAtomicDecU32(&pSession->cRefs);
+    AssertMsg(cRefs < _1M, ("%#x %p\n", cRefs, pSession));
+    if (cRefs == 0)
+        supdrvDestroySession(pSession->pDevExt, pSession);
+    return cRefs;
+}
+
+
+/**
+ * RTHandleTableDestroy callback used by supdrvCleanupSession.
+ *
+ * @returns IPRT status code, see SUPR0ObjAddRef.
+ * @param   hHandleTable    The handle table handle. Ignored.
+ * @param   pvObj           The object pointer.
+ * @param   pvCtx           Context, the handle type. Ignored.
+ * @param   pvUser          Session pointer.
+ */
+static DECLCALLBACK(int) supdrvSessionObjHandleRetain(RTHANDLETABLE hHandleTable, void *pvObj, void *pvCtx, void *pvUser)
+{
+    NOREF(pvCtx);
+    NOREF(hHandleTable);
+    return SUPR0ObjAddRefEx(pvObj, (PSUPDRVSESSION)pvUser, true /*fNoBlocking*/);
+}
+
+
+/**
+ * RTHandleTableDestroy callback used by supdrvCleanupSession.
+ *
+ * @param   hHandleTable    The handle table handle. Ignored.
+ * @param   h               The handle value. Ignored.
+ * @param   pvObj           The object pointer.
+ * @param   pvCtx           Context, the handle type. Ignored.
+ * @param   pvUser          Session pointer.
+ */
+static DECLCALLBACK(void) supdrvSessionObjHandleDelete(RTHANDLETABLE hHandleTable, uint32_t h, void *pvObj, void *pvCtx, void *pvUser)
+{
+    NOREF(pvCtx);
+    NOREF(h);
+    NOREF(hHandleTable);
+    SUPR0ObjRelease(pvObj, (PSUPDRVSESSION)pvUser);
+}
+
+
+/**
+ * Fast path I/O Control worker.
+ *
+ * @returns VBox status code that should be passed down to ring-3 unchanged.
+ * @param   uIOCtl      Function number.
+ * @param   idCpu       VMCPU id.
+ * @param   pDevExt     Device extention.
+ * @param   pSession    Session data.
+ */
+int VBOXCALL supdrvIOCtlFast(uintptr_t uIOCtl, VMCPUID idCpu, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession)
+{
+    /*
+     * We check the two prereqs after doing this only to allow the compiler to optimize things better.
+     */
+    if (RT_LIKELY(   RT_VALID_PTR(pSession)
+                  && pSession->pVM
+                  && pDevExt->pfnVMMR0EntryFast))
+    {
+        switch (uIOCtl)
+        {
+            case SUP_IOCTL_FAST_DO_RAW_RUN:
+                pDevExt->pfnVMMR0EntryFast(pSession->pVM, idCpu, SUP_VMMR0_DO_RAW_RUN);
+                break;
+            case SUP_IOCTL_FAST_DO_HM_RUN:
+                pDevExt->pfnVMMR0EntryFast(pSession->pVM, idCpu, SUP_VMMR0_DO_HM_RUN);
+                break;
+            case SUP_IOCTL_FAST_DO_NOP:
+                pDevExt->pfnVMMR0EntryFast(pSession->pVM, idCpu, SUP_VMMR0_DO_NOP);
+                break;
+            default:
+                return VERR_INTERNAL_ERROR;
+        }
+        return VINF_SUCCESS;
+    }
+    return VERR_INTERNAL_ERROR;
+}
+
+
+/**
+ * Helper for supdrvIOCtl used to validate module names passed to SUP_IOCTL_LDR_OPEN.
+ *
+ * Check if pszStr contains any character of pszChars.  We would use strpbrk
+ * here if this function would be contained in the RedHat kABI white list, see
+ * http://www.kerneldrivers.org/RHEL5.
+ *
+ * @returns  true if fine, false if not.
+ * @param    pszName        The module name to check.
+ */
+static bool supdrvIsLdrModuleNameValid(const char *pszName)
+{
+    int chCur;
+    while ((chCur = *pszName++) != '\0')
+    {
+        static const char s_szInvalidChars[] = ";:()[]{}/\\|&*%#@!~`\"'";
+        unsigned offInv = RT_ELEMENTS(s_szInvalidChars);
+        while (offInv-- > 0)
+            if (s_szInvalidChars[offInv] == chCur)
+                return false;
+    }
+    return true;
+}
+
+
+
+/**
+ * I/O Control inner worker (tracing reasons).
+ *
+ * @returns IPRT status code.
+ * @retval  VERR_INVALID_PARAMETER if the request is invalid.
+ *
+ * @param   uIOCtl      Function number.
+ * @param   pDevExt     Device extention.
+ * @param   pSession    Session data.
+ * @param   pReqHdr     The request header.
+ */
+static int supdrvIOCtlInnerUnrestricted(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr)
+{
+    /*
+     * Validation macros
+     */
+#define REQ_CHECK_SIZES_EX(Name, cbInExpect, cbOutExpect) \
+    do { \
+        if (RT_UNLIKELY(pReqHdr->cbIn != (cbInExpect) || pReqHdr->cbOut != (cbOutExpect))) \
+        { \
+            OSDBGPRINT(( #Name ": Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", \
+                        (long)pReqHdr->cbIn, (long)(cbInExpect), (long)pReqHdr->cbOut, (long)(cbOutExpect))); \
+            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
+        } \
+    } while (0)
+
+#define REQ_CHECK_SIZES(Name) REQ_CHECK_SIZES_EX(Name, Name ## _SIZE_IN, Name ## _SIZE_OUT)
+
+#define REQ_CHECK_SIZE_IN(Name, cbInExpect) \
+    do { \
+        if (RT_UNLIKELY(pReqHdr->cbIn != (cbInExpect))) \
+        { \
+            OSDBGPRINT(( #Name ": Invalid input/output sizes. cbIn=%ld expected %ld.\n", \
+                        (long)pReqHdr->cbIn, (long)(cbInExpect))); \
+            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
+        } \
+    } while (0)
+
+#define REQ_CHECK_SIZE_OUT(Name, cbOutExpect) \
+    do { \
+        if (RT_UNLIKELY(pReqHdr->cbOut != (cbOutExpect))) \
+        { \
+            OSDBGPRINT(( #Name ": Invalid input/output sizes. cbOut=%ld expected %ld.\n", \
+                        (long)pReqHdr->cbOut, (long)(cbOutExpect))); \
+            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
+        } \
+    } while (0)
+
+#define REQ_CHECK_EXPR(Name, expr) \
+    do { \
+        if (RT_UNLIKELY(!(expr))) \
+        { \
+            OSDBGPRINT(( #Name ": %s\n", #expr)); \
+            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
+        } \
+    } while (0)
+
+#define REQ_CHECK_EXPR_FMT(expr, fmt) \
+    do { \
+        if (RT_UNLIKELY(!(expr))) \
+        { \
+            OSDBGPRINT( fmt ); \
+            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
+        } \
+    } while (0)
+
+    /*
+     * The switch.
+     */
+    switch (SUP_CTL_CODE_NO_SIZE(uIOCtl))
+    {
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_COOKIE):
+        {
+            PSUPCOOKIE pReq = (PSUPCOOKIE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_COOKIE);
+            if (strncmp(pReq->u.In.szMagic, SUPCOOKIE_MAGIC, sizeof(pReq->u.In.szMagic)))
+            {
+                OSDBGPRINT(("SUP_IOCTL_COOKIE: invalid magic %.16s\n", pReq->u.In.szMagic));
+                pReq->Hdr.rc = VERR_INVALID_MAGIC;
+                return 0;
+            }
+
+#if 0
+            /*
+             * Call out to the OS specific code and let it do permission checks on the
+             * client process.
+             */
+            if (!supdrvOSValidateClientProcess(pDevExt, pSession))
+            {
+                pReq->u.Out.u32Cookie         = 0xffffffff;
+                pReq->u.Out.u32SessionCookie  = 0xffffffff;
+                pReq->u.Out.u32SessionVersion = 0xffffffff;
+                pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
+                pReq->u.Out.pSession          = NULL;
+                pReq->u.Out.cFunctions        = 0;
+                pReq->Hdr.rc = VERR_PERMISSION_DENIED;
+                return 0;
+            }
+#endif
+
+            /*
+             * Match the version.
+             * The current logic is very simple, match the major interface version.
+             */
+            if (    pReq->u.In.u32MinVersion > SUPDRV_IOC_VERSION
+                ||  (pReq->u.In.u32MinVersion & 0xffff0000) != (SUPDRV_IOC_VERSION & 0xffff0000))
+            {
+                OSDBGPRINT(("SUP_IOCTL_COOKIE: Version mismatch. Requested: %#x  Min: %#x  Current: %#x\n",
+                            pReq->u.In.u32ReqVersion, pReq->u.In.u32MinVersion, SUPDRV_IOC_VERSION));
+                pReq->u.Out.u32Cookie         = 0xffffffff;
+                pReq->u.Out.u32SessionCookie  = 0xffffffff;
+                pReq->u.Out.u32SessionVersion = 0xffffffff;
+                pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
+                pReq->u.Out.pSession          = NULL;
+                pReq->u.Out.cFunctions        = 0;
+                pReq->Hdr.rc = VERR_VERSION_MISMATCH;
+                return 0;
+            }
+
+            /*
+             * Fill in return data and be gone.
+             * N.B. The first one to change SUPDRV_IOC_VERSION shall makes sure that
+             *      u32SessionVersion <= u32ReqVersion!
+             */
+            /** @todo Somehow validate the client and negotiate a secure cookie... */
+            pReq->u.Out.u32Cookie         = pDevExt->u32Cookie;
+            pReq->u.Out.u32SessionCookie  = pSession->u32Cookie;
+            pReq->u.Out.u32SessionVersion = SUPDRV_IOC_VERSION;
+            pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
+            pReq->u.Out.pSession          = pSession;
+            pReq->u.Out.cFunctions        = sizeof(g_aFunctions) / sizeof(g_aFunctions[0]);
+            pReq->Hdr.rc = VINF_SUCCESS;
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_QUERY_FUNCS(0)):
+        {
+            /* validate */
+            PSUPQUERYFUNCS pReq = (PSUPQUERYFUNCS)pReqHdr;
+            REQ_CHECK_SIZES_EX(SUP_IOCTL_QUERY_FUNCS, SUP_IOCTL_QUERY_FUNCS_SIZE_IN, SUP_IOCTL_QUERY_FUNCS_SIZE_OUT(RT_ELEMENTS(g_aFunctions)));
+
+            /* execute */
+            pReq->u.Out.cFunctions = RT_ELEMENTS(g_aFunctions);
+            memcpy(&pReq->u.Out.aFunctions[0], g_aFunctions, sizeof(g_aFunctions));
+            pReq->Hdr.rc = VINF_SUCCESS;
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_LOCK):
+        {
+            /* validate */
+            PSUPPAGELOCK pReq = (PSUPPAGELOCK)pReqHdr;
+            REQ_CHECK_SIZE_IN(SUP_IOCTL_PAGE_LOCK, SUP_IOCTL_PAGE_LOCK_SIZE_IN);
+            REQ_CHECK_SIZE_OUT(SUP_IOCTL_PAGE_LOCK, SUP_IOCTL_PAGE_LOCK_SIZE_OUT(pReq->u.In.cPages));
+            REQ_CHECK_EXPR(SUP_IOCTL_PAGE_LOCK, pReq->u.In.cPages > 0);
+            REQ_CHECK_EXPR(SUP_IOCTL_PAGE_LOCK, pReq->u.In.pvR3 >= PAGE_SIZE);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0LockMem(pSession, pReq->u.In.pvR3, pReq->u.In.cPages, &pReq->u.Out.aPages[0]);
+            if (RT_FAILURE(pReq->Hdr.rc))
+                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_UNLOCK):
+        {
+            /* validate */
+            PSUPPAGEUNLOCK pReq = (PSUPPAGEUNLOCK)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_PAGE_UNLOCK);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0UnlockMem(pSession, pReq->u.In.pvR3);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CONT_ALLOC):
+        {
+            /* validate */
+            PSUPCONTALLOC pReq = (PSUPCONTALLOC)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_CONT_ALLOC);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0ContAlloc(pSession, pReq->u.In.cPages, &pReq->u.Out.pvR0, &pReq->u.Out.pvR3, &pReq->u.Out.HCPhys);
+            if (RT_FAILURE(pReq->Hdr.rc))
+                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CONT_FREE):
+        {
+            /* validate */
+            PSUPCONTFREE pReq = (PSUPCONTFREE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_CONT_FREE);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0ContFree(pSession, (RTHCUINTPTR)pReq->u.In.pvR3);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_OPEN):
+        {
+            /* validate */
+            PSUPLDROPEN pReq = (PSUPLDROPEN)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_LDR_OPEN);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageWithTabs > 0);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageWithTabs < 16*_1M);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageBits > 0);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageBits > 0);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.cbImageBits < pReq->u.In.cbImageWithTabs);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, pReq->u.In.szName[0]);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, RTStrEnd(pReq->u.In.szName, sizeof(pReq->u.In.szName)));
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, supdrvIsLdrModuleNameValid(pReq->u.In.szName));
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_OPEN, RTStrEnd(pReq->u.In.szFilename, sizeof(pReq->u.In.szFilename)));
+
+            /* execute */
+            pReq->Hdr.rc = supdrvIOCtl_LdrOpen(pDevExt, pSession, pReq);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_LOAD):
+        {
+            /* validate */
+            PSUPLDRLOAD pReq = (PSUPLDRLOAD)pReqHdr;
+            REQ_CHECK_EXPR(Name, pReq->Hdr.cbIn >= sizeof(*pReq));
+            REQ_CHECK_SIZES_EX(SUP_IOCTL_LDR_LOAD, SUP_IOCTL_LDR_LOAD_SIZE_IN(pReq->u.In.cbImageWithTabs), SUP_IOCTL_LDR_LOAD_SIZE_OUT);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_LOAD, pReq->u.In.cSymbols <= 16384);
+            REQ_CHECK_EXPR_FMT(     !pReq->u.In.cSymbols
+                               ||   (   pReq->u.In.offSymbols < pReq->u.In.cbImageWithTabs
+                                     && pReq->u.In.offSymbols + pReq->u.In.cSymbols * sizeof(SUPLDRSYM) <= pReq->u.In.cbImageWithTabs),
+                               ("SUP_IOCTL_LDR_LOAD: offSymbols=%#lx cSymbols=%#lx cbImageWithTabs=%#lx\n", (long)pReq->u.In.offSymbols,
+                                (long)pReq->u.In.cSymbols, (long)pReq->u.In.cbImageWithTabs));
+            REQ_CHECK_EXPR_FMT(     !pReq->u.In.cbStrTab
+                               ||   (   pReq->u.In.offStrTab < pReq->u.In.cbImageWithTabs
+                                     && pReq->u.In.offStrTab + pReq->u.In.cbStrTab <= pReq->u.In.cbImageWithTabs
+                                     && pReq->u.In.cbStrTab <= pReq->u.In.cbImageWithTabs),
+                               ("SUP_IOCTL_LDR_LOAD: offStrTab=%#lx cbStrTab=%#lx cbImageWithTabs=%#lx\n", (long)pReq->u.In.offStrTab,
+                                (long)pReq->u.In.cbStrTab, (long)pReq->u.In.cbImageWithTabs));
+
+            if (pReq->u.In.cSymbols)
+            {
+                uint32_t i;
+                PSUPLDRSYM paSyms = (PSUPLDRSYM)&pReq->u.In.abImage[pReq->u.In.offSymbols];
+                for (i = 0; i < pReq->u.In.cSymbols; i++)
+                {
+                    REQ_CHECK_EXPR_FMT(paSyms[i].offSymbol < pReq->u.In.cbImageWithTabs,
+                                       ("SUP_IOCTL_LDR_LOAD: sym #%ld: symb off %#lx (max=%#lx)\n", (long)i, (long)paSyms[i].offSymbol, (long)pReq->u.In.cbImageWithTabs));
+                    REQ_CHECK_EXPR_FMT(paSyms[i].offName < pReq->u.In.cbStrTab,
+                                       ("SUP_IOCTL_LDR_LOAD: sym #%ld: name off %#lx (max=%#lx)\n", (long)i, (long)paSyms[i].offName, (long)pReq->u.In.cbImageWithTabs));
+                    REQ_CHECK_EXPR_FMT(RTStrEnd((char const *)&pReq->u.In.abImage[pReq->u.In.offStrTab + paSyms[i].offName],
+                                                pReq->u.In.cbStrTab - paSyms[i].offName),
+                                       ("SUP_IOCTL_LDR_LOAD: sym #%ld: unterminated name! (%#lx / %#lx)\n", (long)i, (long)paSyms[i].offName, (long)pReq->u.In.cbImageWithTabs));
+                }
+            }
+
+            /* execute */
+            pReq->Hdr.rc = supdrvIOCtl_LdrLoad(pDevExt, pSession, pReq);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_FREE):
+        {
+            /* validate */
+            PSUPLDRFREE pReq = (PSUPLDRFREE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_LDR_FREE);
+
+            /* execute */
+            pReq->Hdr.rc = supdrvIOCtl_LdrFree(pDevExt, pSession, pReq);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_LOCK_DOWN):
+        {
+            /* validate */
+            REQ_CHECK_SIZES(SUP_IOCTL_LDR_LOCK_DOWN);
+
+            /* execute */
+            pReqHdr->rc = supdrvIOCtl_LdrLockDown(pDevExt);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LDR_GET_SYMBOL):
+        {
+            /* validate */
+            PSUPLDRGETSYMBOL pReq = (PSUPLDRGETSYMBOL)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_LDR_GET_SYMBOL);
+            REQ_CHECK_EXPR(SUP_IOCTL_LDR_GET_SYMBOL, RTStrEnd(pReq->u.In.szSymbol, sizeof(pReq->u.In.szSymbol)));
+
+            /* execute */
+            pReq->Hdr.rc = supdrvIOCtl_LdrGetSymbol(pDevExt, pSession, pReq);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CALL_VMMR0_NO_SIZE()):
+        {
+            /* validate */
+            PSUPCALLVMMR0 pReq = (PSUPCALLVMMR0)pReqHdr;
+            Log4(("SUP_IOCTL_CALL_VMMR0: op=%u in=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+                  pReq->u.In.uOperation, pReq->Hdr.cbIn, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+
+            if (pReq->Hdr.cbIn == SUP_IOCTL_CALL_VMMR0_SIZE(0))
+            {
+                REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_VMMR0, SUP_IOCTL_CALL_VMMR0_SIZE_IN(0), SUP_IOCTL_CALL_VMMR0_SIZE_OUT(0));
+
+                /* execute */
+                if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx))
+                    pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.idCpu, pReq->u.In.uOperation, NULL, pReq->u.In.u64Arg, pSession);
+                else
+                    pReq->Hdr.rc = VERR_WRONG_ORDER;
+            }
+            else
+            {
+                PSUPVMMR0REQHDR pVMMReq = (PSUPVMMR0REQHDR)&pReq->abReqPkt[0];
+                REQ_CHECK_EXPR_FMT(pReq->Hdr.cbIn >= SUP_IOCTL_CALL_VMMR0_SIZE(sizeof(SUPVMMR0REQHDR)),
+                                   ("SUP_IOCTL_CALL_VMMR0: cbIn=%#x < %#lx\n", pReq->Hdr.cbIn, SUP_IOCTL_CALL_VMMR0_SIZE(sizeof(SUPVMMR0REQHDR))));
+                REQ_CHECK_EXPR(SUP_IOCTL_CALL_VMMR0, pVMMReq->u32Magic == SUPVMMR0REQHDR_MAGIC);
+                REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_VMMR0, SUP_IOCTL_CALL_VMMR0_SIZE_IN(pVMMReq->cbReq), SUP_IOCTL_CALL_VMMR0_SIZE_OUT(pVMMReq->cbReq));
+
+                /* execute */
+                if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx))
+                    pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.idCpu, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession);
+                else
+                    pReq->Hdr.rc = VERR_WRONG_ORDER;
+            }
+
+            if (    RT_FAILURE(pReq->Hdr.rc)
+                &&  pReq->Hdr.rc != VERR_INTERRUPTED
+                &&  pReq->Hdr.rc != VERR_TIMEOUT)
+                Log(("SUP_IOCTL_CALL_VMMR0: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+                     pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+            else
+                Log4(("SUP_IOCTL_CALL_VMMR0: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+                      pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CALL_VMMR0_BIG):
+        {
+            /* validate */
+            PSUPCALLVMMR0 pReq = (PSUPCALLVMMR0)pReqHdr;
+            PSUPVMMR0REQHDR pVMMReq;
+            Log4(("SUP_IOCTL_CALL_VMMR0_BIG: op=%u in=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+                  pReq->u.In.uOperation, pReq->Hdr.cbIn, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+
+            pVMMReq = (PSUPVMMR0REQHDR)&pReq->abReqPkt[0];
+            REQ_CHECK_EXPR_FMT(pReq->Hdr.cbIn >= SUP_IOCTL_CALL_VMMR0_BIG_SIZE(sizeof(SUPVMMR0REQHDR)),
+                               ("SUP_IOCTL_CALL_VMMR0_BIG: cbIn=%#x < %#lx\n", pReq->Hdr.cbIn, SUP_IOCTL_CALL_VMMR0_BIG_SIZE(sizeof(SUPVMMR0REQHDR))));
+            REQ_CHECK_EXPR(SUP_IOCTL_CALL_VMMR0_BIG, pVMMReq->u32Magic == SUPVMMR0REQHDR_MAGIC);
+            REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_VMMR0_BIG, SUP_IOCTL_CALL_VMMR0_BIG_SIZE_IN(pVMMReq->cbReq), SUP_IOCTL_CALL_VMMR0_BIG_SIZE_OUT(pVMMReq->cbReq));
+
+            /* execute */
+            if (RT_LIKELY(pDevExt->pfnVMMR0EntryEx))
+                pReq->Hdr.rc = pDevExt->pfnVMMR0EntryEx(pReq->u.In.pVMR0, pReq->u.In.idCpu, pReq->u.In.uOperation, pVMMReq, pReq->u.In.u64Arg, pSession);
+            else
+                pReq->Hdr.rc = VERR_WRONG_ORDER;
+
+            if (    RT_FAILURE(pReq->Hdr.rc)
+                &&  pReq->Hdr.rc != VERR_INTERRUPTED
+                &&  pReq->Hdr.rc != VERR_TIMEOUT)
+                Log(("SUP_IOCTL_CALL_VMMR0_BIG: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+                     pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+            else
+                Log4(("SUP_IOCTL_CALL_VMMR0_BIG: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+                      pReq->Hdr.rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_GET_PAGING_MODE):
+        {
+            /* validate */
+            PSUPGETPAGINGMODE pReq = (PSUPGETPAGINGMODE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_GET_PAGING_MODE);
+
+            /* execute */
+            pReq->Hdr.rc = VINF_SUCCESS;
+            pReq->u.Out.enmMode = SUPR0GetPagingMode();
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LOW_ALLOC):
+        {
+            /* validate */
+            PSUPLOWALLOC pReq = (PSUPLOWALLOC)pReqHdr;
+            REQ_CHECK_EXPR(SUP_IOCTL_LOW_ALLOC, pReq->Hdr.cbIn <= SUP_IOCTL_LOW_ALLOC_SIZE_IN);
+            REQ_CHECK_SIZES_EX(SUP_IOCTL_LOW_ALLOC, SUP_IOCTL_LOW_ALLOC_SIZE_IN, SUP_IOCTL_LOW_ALLOC_SIZE_OUT(pReq->u.In.cPages));
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0LowAlloc(pSession, pReq->u.In.cPages, &pReq->u.Out.pvR0, &pReq->u.Out.pvR3, &pReq->u.Out.aPages[0]);
+            if (RT_FAILURE(pReq->Hdr.rc))
+                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LOW_FREE):
+        {
+            /* validate */
+            PSUPLOWFREE pReq = (PSUPLOWFREE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_LOW_FREE);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0LowFree(pSession, (RTHCUINTPTR)pReq->u.In.pvR3);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_GIP_MAP):
+        {
+            /* validate */
+            PSUPGIPMAP pReq = (PSUPGIPMAP)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_GIP_MAP);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0GipMap(pSession, &pReq->u.Out.pGipR3, &pReq->u.Out.HCPhysGip);
+            if (RT_SUCCESS(pReq->Hdr.rc))
+                pReq->u.Out.pGipR0 = pDevExt->pGip;
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_GIP_UNMAP):
+        {
+            /* validate */
+            PSUPGIPUNMAP pReq = (PSUPGIPUNMAP)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_GIP_UNMAP);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0GipUnmap(pSession);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_SET_VM_FOR_FAST):
+        {
+            /* validate */
+            PSUPSETVMFORFAST pReq = (PSUPSETVMFORFAST)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_SET_VM_FOR_FAST);
+            REQ_CHECK_EXPR_FMT(     !pReq->u.In.pVMR0
+                               ||   (   VALID_PTR(pReq->u.In.pVMR0)
+                                     && !((uintptr_t)pReq->u.In.pVMR0 & (PAGE_SIZE - 1))),
+                               ("SUP_IOCTL_SET_VM_FOR_FAST: pVMR0=%p!\n", pReq->u.In.pVMR0));
+            /* execute */
+            pSession->pVM = pReq->u.In.pVMR0;
+            pReq->Hdr.rc = VINF_SUCCESS;
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_ALLOC_EX):
+        {
+            /* validate */
+            PSUPPAGEALLOCEX pReq = (PSUPPAGEALLOCEX)pReqHdr;
+            REQ_CHECK_EXPR(SUP_IOCTL_PAGE_ALLOC_EX, pReq->Hdr.cbIn <= SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN);
+            REQ_CHECK_SIZES_EX(SUP_IOCTL_PAGE_ALLOC_EX, SUP_IOCTL_PAGE_ALLOC_EX_SIZE_IN, SUP_IOCTL_PAGE_ALLOC_EX_SIZE_OUT(pReq->u.In.cPages));
+            REQ_CHECK_EXPR_FMT(pReq->u.In.fKernelMapping || pReq->u.In.fUserMapping,
+                               ("SUP_IOCTL_PAGE_ALLOC_EX: No mapping requested!\n"));
+            REQ_CHECK_EXPR_FMT(pReq->u.In.fUserMapping,
+                               ("SUP_IOCTL_PAGE_ALLOC_EX: Must have user mapping!\n"));
+            REQ_CHECK_EXPR_FMT(!pReq->u.In.fReserved0 && !pReq->u.In.fReserved1,
+                               ("SUP_IOCTL_PAGE_ALLOC_EX: fReserved0=%d fReserved1=%d\n", pReq->u.In.fReserved0, pReq->u.In.fReserved1));
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0PageAllocEx(pSession, pReq->u.In.cPages, 0 /* fFlags */,
+                                            pReq->u.In.fUserMapping   ? &pReq->u.Out.pvR3 : NULL,
+                                            pReq->u.In.fKernelMapping ? &pReq->u.Out.pvR0 : NULL,
+                                            &pReq->u.Out.aPages[0]);
+            if (RT_FAILURE(pReq->Hdr.rc))
+                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_MAP_KERNEL):
+        {
+            /* validate */
+            PSUPPAGEMAPKERNEL pReq = (PSUPPAGEMAPKERNEL)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_PAGE_MAP_KERNEL);
+            REQ_CHECK_EXPR_FMT(!pReq->u.In.fFlags, ("SUP_IOCTL_PAGE_MAP_KERNEL: fFlags=%#x! MBZ\n", pReq->u.In.fFlags));
+            REQ_CHECK_EXPR_FMT(!(pReq->u.In.offSub & PAGE_OFFSET_MASK), ("SUP_IOCTL_PAGE_MAP_KERNEL: offSub=%#x\n", pReq->u.In.offSub));
+            REQ_CHECK_EXPR_FMT(pReq->u.In.cbSub && !(pReq->u.In.cbSub & PAGE_OFFSET_MASK),
+                               ("SUP_IOCTL_PAGE_MAP_KERNEL: cbSub=%#x\n", pReq->u.In.cbSub));
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0PageMapKernel(pSession, pReq->u.In.pvR3, pReq->u.In.offSub, pReq->u.In.cbSub,
+                                              pReq->u.In.fFlags, &pReq->u.Out.pvR0);
+            if (RT_FAILURE(pReq->Hdr.rc))
+                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_PROTECT):
+        {
+            /* validate */
+            PSUPPAGEPROTECT pReq = (PSUPPAGEPROTECT)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_PAGE_PROTECT);
+            REQ_CHECK_EXPR_FMT(!(pReq->u.In.fProt & ~(RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC | RTMEM_PROT_NONE)),
+                               ("SUP_IOCTL_PAGE_PROTECT: fProt=%#x!\n", pReq->u.In.fProt));
+            REQ_CHECK_EXPR_FMT(!(pReq->u.In.offSub & PAGE_OFFSET_MASK), ("SUP_IOCTL_PAGE_PROTECT: offSub=%#x\n", pReq->u.In.offSub));
+            REQ_CHECK_EXPR_FMT(pReq->u.In.cbSub && !(pReq->u.In.cbSub & PAGE_OFFSET_MASK),
+                               ("SUP_IOCTL_PAGE_PROTECT: cbSub=%#x\n", pReq->u.In.cbSub));
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0PageProtect(pSession, pReq->u.In.pvR3, pReq->u.In.pvR0, pReq->u.In.offSub, pReq->u.In.cbSub, pReq->u.In.fProt);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_PAGE_FREE):
+        {
+            /* validate */
+            PSUPPAGEFREE pReq = (PSUPPAGEFREE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_PAGE_FREE);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0PageFree(pSession, pReq->u.In.pvR3);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_CALL_SERVICE_NO_SIZE()):
+        {
+            /* validate */
+            PSUPCALLSERVICE pReq = (PSUPCALLSERVICE)pReqHdr;
+            Log4(("SUP_IOCTL_CALL_SERVICE: op=%u in=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+                  pReq->u.In.uOperation, pReq->Hdr.cbIn, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+
+            if (pReq->Hdr.cbIn == SUP_IOCTL_CALL_SERVICE_SIZE(0))
+                REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_SERVICE, SUP_IOCTL_CALL_SERVICE_SIZE_IN(0), SUP_IOCTL_CALL_SERVICE_SIZE_OUT(0));
+            else
+            {
+                PSUPR0SERVICEREQHDR pSrvReq = (PSUPR0SERVICEREQHDR)&pReq->abReqPkt[0];
+                REQ_CHECK_EXPR_FMT(pReq->Hdr.cbIn >= SUP_IOCTL_CALL_SERVICE_SIZE(sizeof(SUPR0SERVICEREQHDR)),
+                                   ("SUP_IOCTL_CALL_SERVICE: cbIn=%#x < %#lx\n", pReq->Hdr.cbIn, SUP_IOCTL_CALL_SERVICE_SIZE(sizeof(SUPR0SERVICEREQHDR))));
+                REQ_CHECK_EXPR(SUP_IOCTL_CALL_SERVICE, pSrvReq->u32Magic == SUPR0SERVICEREQHDR_MAGIC);
+                REQ_CHECK_SIZES_EX(SUP_IOCTL_CALL_SERVICE, SUP_IOCTL_CALL_SERVICE_SIZE_IN(pSrvReq->cbReq), SUP_IOCTL_CALL_SERVICE_SIZE_OUT(pSrvReq->cbReq));
+            }
+            REQ_CHECK_EXPR(SUP_IOCTL_CALL_SERVICE, RTStrEnd(pReq->u.In.szName, sizeof(pReq->u.In.szName)));
+
+            /* execute */
+            pReq->Hdr.rc = supdrvIOCtl_CallServiceModule(pDevExt, pSession, pReq);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_LOGGER_SETTINGS_NO_SIZE()):
+        {
+            /* validate */
+            PSUPLOGGERSETTINGS pReq = (PSUPLOGGERSETTINGS)pReqHdr;
+            size_t cbStrTab;
+            REQ_CHECK_SIZE_OUT(SUP_IOCTL_LOGGER_SETTINGS, SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->Hdr.cbIn >= SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(1));
+            cbStrTab = pReq->Hdr.cbIn - SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(0);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offGroups      < cbStrTab);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offFlags       < cbStrTab);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.offDestination < cbStrTab);
+            REQ_CHECK_EXPR_FMT(pReq->u.In.szStrings[cbStrTab - 1] == '\0',
+                               ("SUP_IOCTL_LOGGER_SETTINGS: cbIn=%#x cbStrTab=%#zx LastChar=%d\n",
+                                pReq->Hdr.cbIn, cbStrTab, pReq->u.In.szStrings[cbStrTab - 1]));
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.fWhich <= SUPLOGGERSETTINGS_WHICH_RELEASE);
+            REQ_CHECK_EXPR(SUP_IOCTL_LOGGER_SETTINGS, pReq->u.In.fWhat  <= SUPLOGGERSETTINGS_WHAT_DESTROY);
+
+            /* execute */
+            pReq->Hdr.rc = supdrvIOCtl_LoggerSettings(pDevExt, pSession, pReq);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_SEM_OP2):
+        {
+            /* validate */
+            PSUPSEMOP2 pReq = (PSUPSEMOP2)pReqHdr;
+            REQ_CHECK_SIZES_EX(SUP_IOCTL_SEM_OP2, SUP_IOCTL_SEM_OP2_SIZE_IN, SUP_IOCTL_SEM_OP2_SIZE_OUT);
+            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP2, pReq->u.In.uReserved == 0);
+
+            /* execute */
+            switch (pReq->u.In.uType)
+            {
+                case SUP_SEM_TYPE_EVENT:
+                {
+                    SUPSEMEVENT hEvent = (SUPSEMEVENT)(uintptr_t)pReq->u.In.hSem;
+                    switch (pReq->u.In.uOp)
+                    {
+                        case SUPSEMOP2_WAIT_MS_REL:
+                            pReq->Hdr.rc = SUPSemEventWaitNoResume(pSession, hEvent, pReq->u.In.uArg.cRelMsTimeout);
+                            break;
+                        case SUPSEMOP2_WAIT_NS_ABS:
+                            pReq->Hdr.rc = SUPSemEventWaitNsAbsIntr(pSession, hEvent, pReq->u.In.uArg.uAbsNsTimeout);
+                            break;
+                        case SUPSEMOP2_WAIT_NS_REL:
+                            pReq->Hdr.rc = SUPSemEventWaitNsRelIntr(pSession, hEvent, pReq->u.In.uArg.cRelNsTimeout);
+                            break;
+                        case SUPSEMOP2_SIGNAL:
+                            pReq->Hdr.rc = SUPSemEventSignal(pSession, hEvent);
+                            break;
+                        case SUPSEMOP2_CLOSE:
+                            pReq->Hdr.rc = SUPSemEventClose(pSession, hEvent);
+                            break;
+                        case SUPSEMOP2_RESET:
+                        default:
+                            pReq->Hdr.rc = VERR_INVALID_FUNCTION;
+                            break;
+                    }
+                    break;
+                }
+
+                case SUP_SEM_TYPE_EVENT_MULTI:
+                {
+                    SUPSEMEVENTMULTI hEventMulti = (SUPSEMEVENTMULTI)(uintptr_t)pReq->u.In.hSem;
+                    switch (pReq->u.In.uOp)
+                    {
+                        case SUPSEMOP2_WAIT_MS_REL:
+                            pReq->Hdr.rc = SUPSemEventMultiWaitNoResume(pSession, hEventMulti, pReq->u.In.uArg.cRelMsTimeout);
+                            break;
+                        case SUPSEMOP2_WAIT_NS_ABS:
+                            pReq->Hdr.rc = SUPSemEventMultiWaitNsAbsIntr(pSession, hEventMulti, pReq->u.In.uArg.uAbsNsTimeout);
+                            break;
+                        case SUPSEMOP2_WAIT_NS_REL:
+                            pReq->Hdr.rc = SUPSemEventMultiWaitNsRelIntr(pSession, hEventMulti, pReq->u.In.uArg.cRelNsTimeout);
+                            break;
+                        case SUPSEMOP2_SIGNAL:
+                            pReq->Hdr.rc = SUPSemEventMultiSignal(pSession, hEventMulti);
+                            break;
+                        case SUPSEMOP2_CLOSE:
+                            pReq->Hdr.rc = SUPSemEventMultiClose(pSession, hEventMulti);
+                            break;
+                        case SUPSEMOP2_RESET:
+                            pReq->Hdr.rc = SUPSemEventMultiReset(pSession, hEventMulti);
+                            break;
+                        default:
+                            pReq->Hdr.rc = VERR_INVALID_FUNCTION;
+                            break;
+                    }
+                    break;
+                }
+
+                default:
+                    pReq->Hdr.rc = VERR_INVALID_PARAMETER;
+                    break;
+            }
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_SEM_OP3):
+        {
+            /* validate */
+            PSUPSEMOP3 pReq = (PSUPSEMOP3)pReqHdr;
+            REQ_CHECK_SIZES_EX(SUP_IOCTL_SEM_OP3, SUP_IOCTL_SEM_OP3_SIZE_IN, SUP_IOCTL_SEM_OP3_SIZE_OUT);
+            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, pReq->u.In.u32Reserved == 0 && pReq->u.In.u64Reserved == 0);
+
+            /* execute */
+            switch (pReq->u.In.uType)
+            {
+                case SUP_SEM_TYPE_EVENT:
+                {
+                    SUPSEMEVENT hEvent = (SUPSEMEVENT)(uintptr_t)pReq->u.In.hSem;
+                    switch (pReq->u.In.uOp)
+                    {
+                        case SUPSEMOP3_CREATE:
+                            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, hEvent == NIL_SUPSEMEVENT);
+                            pReq->Hdr.rc = SUPSemEventCreate(pSession, &hEvent);
+                            pReq->u.Out.hSem = (uint32_t)(uintptr_t)hEvent;
+                            break;
+                        case SUPSEMOP3_GET_RESOLUTION:
+                            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, hEvent == NIL_SUPSEMEVENT);
+                            pReq->Hdr.rc = VINF_SUCCESS;
+                            pReq->Hdr.cbOut = sizeof(*pReq);
+                            pReq->u.Out.cNsResolution = SUPSemEventGetResolution(pSession);
+                            break;
+                        default:
+                            pReq->Hdr.rc = VERR_INVALID_FUNCTION;
+                            break;
+                    }
+                    break;
+                }
+
+                case SUP_SEM_TYPE_EVENT_MULTI:
+                {
+                    SUPSEMEVENTMULTI hEventMulti = (SUPSEMEVENTMULTI)(uintptr_t)pReq->u.In.hSem;
+                    switch (pReq->u.In.uOp)
+                    {
+                        case SUPSEMOP3_CREATE:
+                            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, hEventMulti == NIL_SUPSEMEVENTMULTI);
+                            pReq->Hdr.rc = SUPSemEventMultiCreate(pSession, &hEventMulti);
+                            pReq->u.Out.hSem = (uint32_t)(uintptr_t)hEventMulti;
+                            break;
+                        case SUPSEMOP3_GET_RESOLUTION:
+                            REQ_CHECK_EXPR(SUP_IOCTL_SEM_OP3, hEventMulti == NIL_SUPSEMEVENTMULTI);
+                            pReq->Hdr.rc = VINF_SUCCESS;
+                            pReq->u.Out.cNsResolution = SUPSemEventMultiGetResolution(pSession);
+                            break;
+                        default:
+                            pReq->Hdr.rc = VERR_INVALID_FUNCTION;
+                            break;
+                    }
+                    break;
+                }
+
+                default:
+                    pReq->Hdr.rc = VERR_INVALID_PARAMETER;
+                    break;
+            }
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_VT_CAPS):
+        {
+            /* validate */
+            PSUPVTCAPS pReq = (PSUPVTCAPS)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_VT_CAPS);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0QueryVTCaps(pSession, &pReq->u.Out.Caps);
+            if (RT_FAILURE(pReq->Hdr.rc))
+                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_OPEN):
+        {
+            /* validate */
+            PSUPTRACEROPEN pReq = (PSUPTRACEROPEN)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_OPEN);
+
+            /* execute */
+            pReq->Hdr.rc = supdrvIOCtl_TracerOpen(pDevExt, pSession, pReq->u.In.uCookie, pReq->u.In.uArg);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_CLOSE):
+        {
+            /* validate */
+            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_CLOSE);
+
+            /* execute */
+            pReqHdr->rc = supdrvIOCtl_TracerClose(pDevExt, pSession);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_IOCTL):
+        {
+            /* validate */
+            PSUPTRACERIOCTL pReq = (PSUPTRACERIOCTL)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_IOCTL);
+
+            /* execute */
+            pReqHdr->rc = supdrvIOCtl_TracerIOCtl(pDevExt, pSession, pReq->u.In.uCmd, pReq->u.In.uArg, &pReq->u.Out.iRetVal);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_UMOD_REG):
+        {
+            /* validate */
+            PSUPTRACERUMODREG pReq = (PSUPTRACERUMODREG)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_UMOD_REG);
+            if (!RTStrEnd(pReq->u.In.szName, sizeof(pReq->u.In.szName)))
+                return VERR_INVALID_PARAMETER;
+
+            /* execute */
+            pReqHdr->rc = supdrvIOCtl_TracerUmodRegister(pDevExt, pSession,
+                                                         pReq->u.In.R3PtrVtgHdr, pReq->u.In.uVtgHdrAddr,
+                                                         pReq->u.In.R3PtrStrTab, pReq->u.In.cbStrTab,
+                                                         pReq->u.In.szName, pReq->u.In.fFlags);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_UMOD_DEREG):
+        {
+            /* validate */
+            PSUPTRACERUMODDEREG pReq = (PSUPTRACERUMODDEREG)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_UMOD_DEREG);
+
+            /* execute */
+            pReqHdr->rc = supdrvIOCtl_TracerUmodDeregister(pDevExt, pSession, pReq->u.In.pVtgHdr);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TRACER_UMOD_FIRE_PROBE):
+        {
+            /* validate */
+            PSUPTRACERUMODFIREPROBE pReq = (PSUPTRACERUMODFIREPROBE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_TRACER_UMOD_FIRE_PROBE);
+
+            supdrvIOCtl_TracerUmodProbeFire(pDevExt, pSession, &pReq->u.In);
+            pReqHdr->rc = VINF_SUCCESS;
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_MSR_PROBER):
+        {
+            /* validate */
+            PSUPMSRPROBER pReq = (PSUPMSRPROBER)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_MSR_PROBER);
+            REQ_CHECK_EXPR(SUP_IOCTL_MSR_PROBER,
+                           pReq->u.In.enmOp > SUPMSRPROBEROP_INVALID && pReq->u.In.enmOp < SUPMSRPROBEROP_END);
+
+            pReqHdr->rc = supdrvIOCtl_MsrProber(pDevExt, pReq);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_RESUME_SUSPENDED_KBDS):
+        {
+            /* validate */
+            REQ_CHECK_SIZES(SUP_IOCTL_RESUME_SUSPENDED_KBDS);
+
+            pReqHdr->rc = supdrvIOCtl_ResumeSuspendedKbds();
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TSC_DELTA_MEASURE):
+        {
+            /* validate */
+            PSUPTSCDELTAMEASURE pReq = (PSUPTSCDELTAMEASURE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_TSC_DELTA_MEASURE);
+
+            pReqHdr->rc = supdrvIOCtl_TscDeltaMeasure(pDevExt, pSession, pReq);
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_TSC_READ):
+        {
+            /* validate */
+            PSUPTSCREAD pReq = (PSUPTSCREAD)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_TSC_READ);
+
+            pReqHdr->rc = supdrvIOCtl_TscRead(pDevExt, pSession, pReq);
+            return 0;
+        }
+
+        default:
+            Log(("Unknown IOCTL %#lx\n", (long)uIOCtl));
+            break;
+    }
+    return VERR_GENERAL_FAILURE;
+}
+
+
+/**
+ * I/O Control inner worker for the restricted operations.
+ *
+ * @returns IPRT status code.
+ * @retval  VERR_INVALID_PARAMETER if the request is invalid.
+ *
+ * @param   uIOCtl      Function number.
+ * @param   pDevExt     Device extention.
+ * @param   pSession    Session data.
+ * @param   pReqHdr     The request header.
+ */
+static int supdrvIOCtlInnerRestricted(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr)
+{
+    /*
+     * The switch.
+     */
+    switch (SUP_CTL_CODE_NO_SIZE(uIOCtl))
+    {
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_COOKIE):
+        {
+            PSUPCOOKIE pReq = (PSUPCOOKIE)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_COOKIE);
+            if (strncmp(pReq->u.In.szMagic, SUPCOOKIE_MAGIC, sizeof(pReq->u.In.szMagic)))
+            {
+                OSDBGPRINT(("SUP_IOCTL_COOKIE: invalid magic %.16s\n", pReq->u.In.szMagic));
+                pReq->Hdr.rc = VERR_INVALID_MAGIC;
+                return 0;
+            }
+
+            /*
+             * Match the version.
+             * The current logic is very simple, match the major interface version.
+             */
+            if (    pReq->u.In.u32MinVersion > SUPDRV_IOC_VERSION
+                ||  (pReq->u.In.u32MinVersion & 0xffff0000) != (SUPDRV_IOC_VERSION & 0xffff0000))
+            {
+                OSDBGPRINT(("SUP_IOCTL_COOKIE: Version mismatch. Requested: %#x  Min: %#x  Current: %#x\n",
+                            pReq->u.In.u32ReqVersion, pReq->u.In.u32MinVersion, SUPDRV_IOC_VERSION));
+                pReq->u.Out.u32Cookie         = 0xffffffff;
+                pReq->u.Out.u32SessionCookie  = 0xffffffff;
+                pReq->u.Out.u32SessionVersion = 0xffffffff;
+                pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
+                pReq->u.Out.pSession          = NULL;
+                pReq->u.Out.cFunctions        = 0;
+                pReq->Hdr.rc = VERR_VERSION_MISMATCH;
+                return 0;
+            }
+
+            /*
+             * Fill in return data and be gone.
+             * N.B. The first one to change SUPDRV_IOC_VERSION shall makes sure that
+             *      u32SessionVersion <= u32ReqVersion!
+             */
+            /** @todo Somehow validate the client and negotiate a secure cookie... */
+            pReq->u.Out.u32Cookie         = pDevExt->u32Cookie;
+            pReq->u.Out.u32SessionCookie  = pSession->u32Cookie;
+            pReq->u.Out.u32SessionVersion = SUPDRV_IOC_VERSION;
+            pReq->u.Out.u32DriverVersion  = SUPDRV_IOC_VERSION;
+            pReq->u.Out.pSession          = pSession;
+            pReq->u.Out.cFunctions        = 0;
+            pReq->Hdr.rc = VINF_SUCCESS;
+            return 0;
+        }
+
+        case SUP_CTL_CODE_NO_SIZE(SUP_IOCTL_VT_CAPS):
+        {
+            /* validate */
+            PSUPVTCAPS pReq = (PSUPVTCAPS)pReqHdr;
+            REQ_CHECK_SIZES(SUP_IOCTL_VT_CAPS);
+
+            /* execute */
+            pReq->Hdr.rc = SUPR0QueryVTCaps(pSession, &pReq->u.Out.Caps);
+            if (RT_FAILURE(pReq->Hdr.rc))
+                pReq->Hdr.cbOut = sizeof(pReq->Hdr);
+            return 0;
+        }
+
+        default:
+            Log(("Unknown IOCTL %#lx\n", (long)uIOCtl));
+            break;
+    }
+    return VERR_GENERAL_FAILURE;
+}
+
+
+/**
+ * I/O Control worker.
+ *
+ * @returns IPRT status code.
+ * @retval  VERR_INVALID_PARAMETER if the request is invalid.
+ *
+ * @param   uIOCtl      Function number.
+ * @param   pDevExt     Device extention.
+ * @param   pSession    Session data.
+ * @param   pReqHdr     The request header.
+ */
+int VBOXCALL supdrvIOCtl(uintptr_t uIOCtl, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPREQHDR pReqHdr, size_t cbReq)
+{
+    int rc;
+    VBOXDRV_IOCTL_ENTRY(pSession, uIOCtl, pReqHdr);
+
+    /*
+     * Validate the request.
+     */
+    if (RT_UNLIKELY(cbReq < sizeof(*pReqHdr)))
+    {
+        OSDBGPRINT(("vboxdrv: Bad ioctl request size; cbReq=%#lx\n", (long)cbReq));
+        VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
+        return VERR_INVALID_PARAMETER;
+    }
+    if (RT_UNLIKELY(   (pReqHdr->fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC
+                    || pReqHdr->cbIn < sizeof(*pReqHdr)
+                    || pReqHdr->cbIn > cbReq
+                    || pReqHdr->cbOut < sizeof(*pReqHdr)
+                    || pReqHdr->cbOut > cbReq))
+    {
+        OSDBGPRINT(("vboxdrv: Bad ioctl request header; cbIn=%#lx cbOut=%#lx fFlags=%#lx\n",
+                    (long)pReqHdr->cbIn, (long)pReqHdr->cbOut, (long)pReqHdr->fFlags));
+        VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
+        return VERR_INVALID_PARAMETER;
+    }
+    if (RT_UNLIKELY(!RT_VALID_PTR(pSession)))
+    {
+        OSDBGPRINT(("vboxdrv: Invalid pSession value %p (ioctl=%p)\n", pSession, (void *)uIOCtl));
+        VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
+        return VERR_INVALID_PARAMETER;
+    }
+    if (RT_UNLIKELY(uIOCtl == SUP_IOCTL_COOKIE))
+    {
+        if (pReqHdr->u32Cookie != SUPCOOKIE_INITIAL_COOKIE)
+        {
+            OSDBGPRINT(("SUP_IOCTL_COOKIE: bad cookie %#lx\n", (long)pReqHdr->u32Cookie));
+            VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
+            return VERR_INVALID_PARAMETER;
+        }
+    }
+    else if (RT_UNLIKELY(    pReqHdr->u32Cookie != pDevExt->u32Cookie
+                         ||  pReqHdr->u32SessionCookie != pSession->u32Cookie))
+    {
+        OSDBGPRINT(("vboxdrv: bad cookie %#lx / %#lx.\n", (long)pReqHdr->u32Cookie, (long)pReqHdr->u32SessionCookie));
+        VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, VERR_INVALID_PARAMETER, VINF_SUCCESS);
+        return VERR_INVALID_PARAMETER;
+    }
+
+    /*
+     * Hand it to an inner function to avoid lots of unnecessary return tracepoints.
+     */
+    if (pSession->fUnrestricted)
+        rc = supdrvIOCtlInnerUnrestricted(uIOCtl, pDevExt, pSession, pReqHdr);
+    else
+        rc = supdrvIOCtlInnerRestricted(uIOCtl, pDevExt, pSession, pReqHdr);
+
+    VBOXDRV_IOCTL_RETURN(pSession, uIOCtl, pReqHdr, pReqHdr->rc, rc);
+    return rc;
+}
+
+
+/**
+ * Inter-Driver Communication (IDC) worker.
+ *
+ * @returns VBox status code.
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_INVALID_PARAMETER if the request is invalid.
+ * @retval  VERR_NOT_SUPPORTED if the request isn't supported.
+ *
+ * @param   uReq        The request (function) code.
+ * @param   pDevExt     Device extention.
+ * @param   pSession    Session data.
+ * @param   pReqHdr     The request header.
+ */
+int VBOXCALL supdrvIDC(uintptr_t uReq, PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQHDR pReqHdr)
+{
+    /*
+     * The OS specific code has already validated the pSession
+     * pointer, and the request size being greater or equal to
+     * size of the header.
+     *
+     * So, just check that pSession is a kernel context session.
+     */
+    if (RT_UNLIKELY(    pSession
+                    &&  pSession->R0Process != NIL_RTR0PROCESS))
+        return VERR_INVALID_PARAMETER;
+
+/*
+ * Validation macro.
+ */
+#define REQ_CHECK_IDC_SIZE(Name, cbExpect) \
+    do { \
+        if (RT_UNLIKELY(pReqHdr->cb != (cbExpect))) \
+        { \
+            OSDBGPRINT(( #Name ": Invalid input/output sizes. cb=%ld expected %ld.\n", \
+                        (long)pReqHdr->cb, (long)(cbExpect))); \
+            return pReqHdr->rc = VERR_INVALID_PARAMETER; \
+        } \
+    } while (0)
+
+    switch (uReq)
+    {
+        case SUPDRV_IDC_REQ_CONNECT:
+        {
+            PSUPDRVIDCREQCONNECT pReq = (PSUPDRVIDCREQCONNECT)pReqHdr;
+            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_CONNECT, sizeof(*pReq));
+
+            /*
+             * Validate the cookie and other input.
+             */
+            if (pReq->Hdr.pSession != NULL)
+            {
+                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: Hdr.pSession=%p expected NULL!\n", pReq->Hdr.pSession));
+                return pReqHdr->rc = VERR_INVALID_PARAMETER;
+            }
+            if (pReq->u.In.u32MagicCookie != SUPDRVIDCREQ_CONNECT_MAGIC_COOKIE)
+            {
+                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: u32MagicCookie=%#x expected %#x!\n",
+                            (unsigned)pReq->u.In.u32MagicCookie, (unsigned)SUPDRVIDCREQ_CONNECT_MAGIC_COOKIE));
+                return pReqHdr->rc = VERR_INVALID_PARAMETER;
+            }
+            if (    pReq->u.In.uMinVersion > pReq->u.In.uReqVersion
+                ||  (pReq->u.In.uMinVersion & UINT32_C(0xffff0000)) != (pReq->u.In.uReqVersion & UINT32_C(0xffff0000)))
+            {
+                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: uMinVersion=%#x uMaxVersion=%#x doesn't match!\n",
+                            pReq->u.In.uMinVersion, pReq->u.In.uReqVersion));
+                return pReqHdr->rc = VERR_INVALID_PARAMETER;
+            }
+            if (pSession != NULL)
+            {
+                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: pSession=%p expected NULL!\n", pSession));
+                return pReqHdr->rc = VERR_INVALID_PARAMETER;
+            }
+
+            /*
+             * Match the version.
+             * The current logic is very simple, match the major interface version.
+             */
+            if (    pReq->u.In.uMinVersion > SUPDRV_IDC_VERSION
+                ||  (pReq->u.In.uMinVersion & 0xffff0000) != (SUPDRV_IDC_VERSION & 0xffff0000))
+            {
+                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: Version mismatch. Requested: %#x  Min: %#x  Current: %#x\n",
+                            pReq->u.In.uReqVersion, pReq->u.In.uMinVersion, (unsigned)SUPDRV_IDC_VERSION));
+                pReq->u.Out.pSession        = NULL;
+                pReq->u.Out.uSessionVersion = 0xffffffff;
+                pReq->u.Out.uDriverVersion  = SUPDRV_IDC_VERSION;
+                pReq->u.Out.uDriverRevision = VBOX_SVN_REV;
+                pReq->Hdr.rc = VERR_VERSION_MISMATCH;
+                return VINF_SUCCESS;
+            }
+
+            pReq->u.Out.pSession        = NULL;
+            pReq->u.Out.uSessionVersion = SUPDRV_IDC_VERSION;
+            pReq->u.Out.uDriverVersion  = SUPDRV_IDC_VERSION;
+            pReq->u.Out.uDriverRevision = VBOX_SVN_REV;
+
+            pReq->Hdr.rc = supdrvCreateSession(pDevExt, false /* fUser */, true /*fUnrestricted*/, &pSession);
+            if (RT_FAILURE(pReq->Hdr.rc))
+            {
+                OSDBGPRINT(("SUPDRV_IDC_REQ_CONNECT: failed to create session, rc=%d\n", pReq->Hdr.rc));
+                return VINF_SUCCESS;
+            }
+
+            pReq->u.Out.pSession = pSession;
+            pReq->Hdr.pSession = pSession;
+
+            return VINF_SUCCESS;
+        }
+
+        case SUPDRV_IDC_REQ_DISCONNECT:
+        {
+            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_DISCONNECT, sizeof(*pReqHdr));
+
+            supdrvSessionRelease(pSession);
+            return pReqHdr->rc = VINF_SUCCESS;
+        }
+
+        case SUPDRV_IDC_REQ_GET_SYMBOL:
+        {
+            PSUPDRVIDCREQGETSYM pReq = (PSUPDRVIDCREQGETSYM)pReqHdr;
+            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_GET_SYMBOL, sizeof(*pReq));
+
+            pReq->Hdr.rc = supdrvIDC_LdrGetSymbol(pDevExt, pSession, pReq);
+            return VINF_SUCCESS;
+        }
+
+        case SUPDRV_IDC_REQ_COMPONENT_REGISTER_FACTORY:
+        {
+            PSUPDRVIDCREQCOMPREGFACTORY pReq = (PSUPDRVIDCREQCOMPREGFACTORY)pReqHdr;
+            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_COMPONENT_REGISTER_FACTORY, sizeof(*pReq));
+
+            pReq->Hdr.rc = SUPR0ComponentRegisterFactory(pSession, pReq->u.In.pFactory);
+            return VINF_SUCCESS;
+        }
+
+        case SUPDRV_IDC_REQ_COMPONENT_DEREGISTER_FACTORY:
+        {
+            PSUPDRVIDCREQCOMPDEREGFACTORY pReq = (PSUPDRVIDCREQCOMPDEREGFACTORY)pReqHdr;
+            REQ_CHECK_IDC_SIZE(SUPDRV_IDC_REQ_COMPONENT_DEREGISTER_FACTORY, sizeof(*pReq));
+
+            pReq->Hdr.rc = SUPR0ComponentDeregisterFactory(pSession, pReq->u.In.pFactory);
+            return VINF_SUCCESS;
+        }
+
+        default:
+            Log(("Unknown IDC %#lx\n", (long)uReq));
+            break;
+    }
+
+#undef REQ_CHECK_IDC_SIZE
+    return VERR_NOT_SUPPORTED;
+}
+
+
+/**
+ * Register a object for reference counting.
+ * The object is registered with one reference in the specified session.
+ *
+ * @returns Unique identifier on success (pointer).
+ *          All future reference must use this identifier.
+ * @returns NULL on failure.
+ * @param   pfnDestructor   The destructore function which will be called when the reference count reaches 0.
+ * @param   pvUser1         The first user argument.
+ * @param   pvUser2         The second user argument.
+ */
+SUPR0DECL(void *) SUPR0ObjRegister(PSUPDRVSESSION pSession, SUPDRVOBJTYPE enmType, PFNSUPDRVDESTRUCTOR pfnDestructor, void *pvUser1, void *pvUser2)
+{
+    PSUPDRVDEVEXT   pDevExt     = pSession->pDevExt;
+    PSUPDRVOBJ      pObj;
+    PSUPDRVUSAGE    pUsage;
+
+    /*
+     * Validate the input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), NULL);
+    AssertReturn(enmType > SUPDRVOBJTYPE_INVALID && enmType < SUPDRVOBJTYPE_END, NULL);
+    AssertPtrReturn(pfnDestructor, NULL);
+
+    /*
+     * Allocate and initialize the object.
+     */
+    pObj = (PSUPDRVOBJ)RTMemAlloc(sizeof(*pObj));
+    if (!pObj)
+        return NULL;
+    pObj->u32Magic      = SUPDRVOBJ_MAGIC;
+    pObj->enmType       = enmType;
+    pObj->pNext         = NULL;
+    pObj->cUsage        = 1;
+    pObj->pfnDestructor = pfnDestructor;
+    pObj->pvUser1       = pvUser1;
+    pObj->pvUser2       = pvUser2;
+    pObj->CreatorUid    = pSession->Uid;
+    pObj->CreatorGid    = pSession->Gid;
+    pObj->CreatorProcess= pSession->Process;
+    supdrvOSObjInitCreator(pObj, pSession);
+
+    /*
+     * Allocate the usage record.
+     * (We keep freed usage records around to simplify SUPR0ObjAddRefEx().)
+     */
+    RTSpinlockAcquire(pDevExt->Spinlock);
+
+    pUsage = pDevExt->pUsageFree;
+    if (pUsage)
+        pDevExt->pUsageFree = pUsage->pNext;
+    else
+    {
+        RTSpinlockRelease(pDevExt->Spinlock);
+        pUsage = (PSUPDRVUSAGE)RTMemAlloc(sizeof(*pUsage));
+        if (!pUsage)
+        {
+            RTMemFree(pObj);
+            return NULL;
+        }
+        RTSpinlockAcquire(pDevExt->Spinlock);
+    }
+
+    /*
+     * Insert the object and create the session usage record.
+     */
+    /* The object. */
+    pObj->pNext         = pDevExt->pObjs;
+    pDevExt->pObjs      = pObj;
+
+    /* The session record. */
+    pUsage->cUsage      = 1;
+    pUsage->pObj        = pObj;
+    pUsage->pNext       = pSession->pUsage;
+    /* Log2(("SUPR0ObjRegister: pUsage=%p:{.pObj=%p, .pNext=%p}\n", pUsage, pUsage->pObj, pUsage->pNext)); */
+    pSession->pUsage    = pUsage;
+
+    RTSpinlockRelease(pDevExt->Spinlock);
+
+    Log(("SUPR0ObjRegister: returns %p (pvUser1=%p, pvUser=%p)\n", pObj, pvUser1, pvUser2));
+    return pObj;
+}
+
+
+/**
+ * Increment the reference counter for the object associating the reference
+ * with the specified session.
+ *
+ * @returns IPRT status code.
+ * @param   pvObj           The identifier returned by SUPR0ObjRegister().
+ * @param   pSession        The session which is referencing the object.
+ *
+ * @remarks The caller should not own any spinlocks and must carefully protect
+ *          itself against potential race with the destructor so freed memory
+ *          isn't accessed here.
+ */
+SUPR0DECL(int) SUPR0ObjAddRef(void *pvObj, PSUPDRVSESSION pSession)
+{
+    return SUPR0ObjAddRefEx(pvObj, pSession, false /* fNoBlocking */);
+}
+
+
+/**
+ * Increment the reference counter for the object associating the reference
+ * with the specified session.
+ *
+ * @returns IPRT status code.
+ * @retval  VERR_TRY_AGAIN if fNoBlocking was set and a new usage record
+ *          couldn't be allocated. (If you see this you're not doing the right
+ *          thing and it won't ever work reliably.)
+ *
+ * @param   pvObj           The identifier returned by SUPR0ObjRegister().
+ * @param   pSession        The session which is referencing the object.
+ * @param   fNoBlocking     Set if it's not OK to block. Never try to make the
+ *                          first reference to an object in a session with this
+ *                          argument set.
+ *
+ * @remarks The caller should not own any spinlocks and must carefully protect
+ *          itself against potential race with the destructor so freed memory
+ *          isn't accessed here.
+ */
+SUPR0DECL(int) SUPR0ObjAddRefEx(void *pvObj, PSUPDRVSESSION pSession, bool fNoBlocking)
+{
+    PSUPDRVDEVEXT   pDevExt     = pSession->pDevExt;
+    PSUPDRVOBJ      pObj        = (PSUPDRVOBJ)pvObj;
+    int             rc          = VINF_SUCCESS;
+    PSUPDRVUSAGE    pUsagePre;
+    PSUPDRVUSAGE    pUsage;
+
+    /*
+     * Validate the input.
+     * Be ready for the destruction race (someone might be stuck in the
+     * destructor waiting a lock we own).
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pObj, VERR_INVALID_POINTER);
+    AssertMsgReturn(pObj->u32Magic == SUPDRVOBJ_MAGIC || pObj->u32Magic == SUPDRVOBJ_MAGIC_DEAD,
+                    ("Invalid pvObj=%p magic=%#x (expected %#x or %#x)\n", pvObj, pObj->u32Magic, SUPDRVOBJ_MAGIC, SUPDRVOBJ_MAGIC_DEAD),
+                    VERR_INVALID_PARAMETER);
+
+    RTSpinlockAcquire(pDevExt->Spinlock);
+
+    if (RT_UNLIKELY(pObj->u32Magic != SUPDRVOBJ_MAGIC))
+    {
+        RTSpinlockRelease(pDevExt->Spinlock);
+
+        AssertMsgFailed(("pvObj=%p magic=%#x\n", pvObj, pObj->u32Magic));
+        return VERR_WRONG_ORDER;
+    }
+
+    /*
+     * Preallocate the usage record if we can.
+     */
+    pUsagePre = pDevExt->pUsageFree;
+    if (pUsagePre)
+        pDevExt->pUsageFree = pUsagePre->pNext;
+    else if (!fNoBlocking)
+    {
+        RTSpinlockRelease(pDevExt->Spinlock);
+        pUsagePre = (PSUPDRVUSAGE)RTMemAlloc(sizeof(*pUsagePre));
+        if (!pUsagePre)
+            return VERR_NO_MEMORY;
+
+        RTSpinlockAcquire(pDevExt->Spinlock);
+        if (RT_UNLIKELY(pObj->u32Magic != SUPDRVOBJ_MAGIC))
+        {
+            RTSpinlockRelease(pDevExt->Spinlock);
+
+            AssertMsgFailed(("pvObj=%p magic=%#x\n", pvObj, pObj->u32Magic));
+            return VERR_WRONG_ORDER;
+        }
+    }
+
+    /*
+     * Reference the object.
+     */
+    pObj->cUsage++;
+
+    /*
+     * Look for the session record.
+     */
+    for (pUsage = pSession->pUsage; pUsage; pUsage = pUsage->pNext)
+    {
+        /*Log(("SUPR0AddRef: pUsage=%p:{.pObj=%p, .pNext=%p}\n", pUsage, pUsage->pObj, pUsage->pNext));*/
+        if (pUsage->pObj == pObj)
+            break;
+    }
+    if (pUsage)
+        pUsage->cUsage++;
+    else if (pUsagePre)
+    {
+        /* create a new session record. */
+        pUsagePre->cUsage   = 1;
+        pUsagePre->pObj     = pObj;
+        pUsagePre->pNext    = pSession->pUsage;
+        pSession->pUsage    = pUsagePre;
+        /*Log(("SUPR0AddRef: pUsagePre=%p:{.pObj=%p, .pNext=%p}\n", pUsagePre, pUsagePre->pObj, pUsagePre->pNext));*/
+
+        pUsagePre = NULL;
+    }
+    else
+    {
+        pObj->cUsage--;
+        rc = VERR_TRY_AGAIN;
+    }
+
+    /*
+     * Put any unused usage record into the free list..
+     */
+    if (pUsagePre)
+    {
+        pUsagePre->pNext = pDevExt->pUsageFree;
+        pDevExt->pUsageFree = pUsagePre;
+    }
+
+    RTSpinlockRelease(pDevExt->Spinlock);
+
+    return rc;
+}
+
+
+/**
+ * Decrement / destroy a reference counter record for an object.
+ *
+ * The object is uniquely identified by pfnDestructor+pvUser1+pvUser2.
+ *
+ * @returns IPRT status code.
+ * @retval  VINF_SUCCESS if not destroyed.
+ * @retval  VINF_OBJECT_DESTROYED if it's destroyed by this release call.
+ * @retval  VERR_INVALID_PARAMETER if the object isn't valid. Will assert in
+ *          string builds.
+ *
+ * @param   pvObj           The identifier returned by SUPR0ObjRegister().
+ * @param   pSession        The session which is referencing the object.
+ */
+SUPR0DECL(int) SUPR0ObjRelease(void *pvObj, PSUPDRVSESSION pSession)
+{
+    PSUPDRVDEVEXT       pDevExt     = pSession->pDevExt;
+    PSUPDRVOBJ          pObj        = (PSUPDRVOBJ)pvObj;
+    int                 rc          = VERR_INVALID_PARAMETER;
+    PSUPDRVUSAGE        pUsage;
+    PSUPDRVUSAGE        pUsagePrev;
+
+    /*
+     * Validate the input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(VALID_PTR(pObj)&& pObj->u32Magic == SUPDRVOBJ_MAGIC,
+                    ("Invalid pvObj=%p magic=%#x (expected %#x)\n", pvObj, pObj ? pObj->u32Magic : 0, SUPDRVOBJ_MAGIC),
+                    VERR_INVALID_PARAMETER);
+
+    /*
+     * Acquire the spinlock and look for the usage record.
+     */
+    RTSpinlockAcquire(pDevExt->Spinlock);
+
+    for (pUsagePrev = NULL, pUsage = pSession->pUsage;
+         pUsage;
+         pUsagePrev = pUsage, pUsage = pUsage->pNext)
+    {
+        /*Log2(("SUPR0ObjRelease: pUsage=%p:{.pObj=%p, .pNext=%p}\n", pUsage, pUsage->pObj, pUsage->pNext));*/
+        if (pUsage->pObj == pObj)
+        {
+            rc = VINF_SUCCESS;
+            AssertMsg(pUsage->cUsage >= 1 && pObj->cUsage >= pUsage->cUsage, ("glob %d; sess %d\n", pObj->cUsage, pUsage->cUsage));
+            if (pUsage->cUsage > 1)
+            {
+                pObj->cUsage--;
+                pUsage->cUsage--;
+            }
+            else
+            {
+                /*
+                 * Free the session record.
+                 */
+                if (pUsagePrev)
+                    pUsagePrev->pNext = pUsage->pNext;
+                else
+                    pSession->pUsage = pUsage->pNext;
+                pUsage->pNext = pDevExt->pUsageFree;
+                pDevExt->pUsageFree = pUsage;
+
+                /* What about the object? */
+                if (pObj->cUsage > 1)
+                    pObj->cUsage--;
+                else
+                {
+                    /*
+                     * Object is to be destroyed, unlink it.
+                     */
+                    pObj->u32Magic = SUPDRVOBJ_MAGIC_DEAD;
+                    rc = VINF_OBJECT_DESTROYED;
+                    if (pDevExt->pObjs == pObj)
+                        pDevExt->pObjs = pObj->pNext;
+                    else
+                    {
+                        PSUPDRVOBJ pObjPrev;
+                        for (pObjPrev = pDevExt->pObjs; pObjPrev; pObjPrev = pObjPrev->pNext)
+                            if (pObjPrev->pNext == pObj)
+                            {
+                                pObjPrev->pNext = pObj->pNext;
+                                break;
+                            }
+                        Assert(pObjPrev);
+                    }
+                }
+            }
+            break;
+        }
+    }
+
+    RTSpinlockRelease(pDevExt->Spinlock);
+
+    /*
+     * Call the destructor and free the object if required.
+     */
+    if (rc == VINF_OBJECT_DESTROYED)
+    {
+        Log(("SUPR0ObjRelease: destroying %p/%d (%p/%p) cpid=%RTproc pid=%RTproc dtor=%p\n",
+             pObj, pObj->enmType, pObj->pvUser1, pObj->pvUser2, pObj->CreatorProcess, RTProcSelf(), pObj->pfnDestructor));
+        if (pObj->pfnDestructor)
+            pObj->pfnDestructor(pObj, pObj->pvUser1, pObj->pvUser2);
+        RTMemFree(pObj);
+    }
+
+    AssertMsg(pUsage, ("pvObj=%p\n", pvObj));
+    return rc;
+}
+
+
+/**
+ * Verifies that the current process can access the specified object.
+ *
+ * @returns The following IPRT status code:
+ * @retval  VINF_SUCCESS if access was granted.
+ * @retval  VERR_PERMISSION_DENIED if denied access.
+ * @retval  VERR_INVALID_PARAMETER if invalid parameter.
+ *
+ * @param   pvObj           The identifier returned by SUPR0ObjRegister().
+ * @param   pSession        The session which wishes to access the object.
+ * @param   pszObjName      Object string name. This is optional and depends on the object type.
+ *
+ * @remark  The caller is responsible for making sure the object isn't removed while
+ *          we're inside this function. If uncertain about this, just call AddRef before calling us.
+ */
+SUPR0DECL(int) SUPR0ObjVerifyAccess(void *pvObj, PSUPDRVSESSION pSession, const char *pszObjName)
+{
+    PSUPDRVOBJ  pObj = (PSUPDRVOBJ)pvObj;
+    int         rc;
+
+    /*
+     * Validate the input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(VALID_PTR(pObj) && pObj->u32Magic == SUPDRVOBJ_MAGIC,
+                    ("Invalid pvObj=%p magic=%#x (exepcted %#x)\n", pvObj, pObj ? pObj->u32Magic : 0, SUPDRVOBJ_MAGIC),
+                    VERR_INVALID_PARAMETER);
+
+    /*
+     * Check access. (returns true if a decision has been made.)
+     */
+    rc = VERR_INTERNAL_ERROR;
+    if (supdrvOSObjCanAccess(pObj, pSession, pszObjName, &rc))
+        return rc;
+
+    /*
+     * Default policy is to allow the user to access his own
+     * stuff but nothing else.
+     */
+    if (pObj->CreatorUid == pSession->Uid)
+        return VINF_SUCCESS;
+    return VERR_PERMISSION_DENIED;
+}
+
+
+/**
+ * Lock pages.
+ *
+ * @returns IPRT status code.
+ * @param   pSession    Session to which the locked memory should be associated.
+ * @param   pvR3        Start of the memory range to lock.
+ *                      This must be page aligned.
+ * @param   cPages      Number of pages to lock.
+ * @param   paPages     Where to put the physical addresses of locked memory.
+ */
+SUPR0DECL(int) SUPR0LockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t cPages, PRTHCPHYS paPages)
+{
+    int             rc;
+    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
+    const size_t    cb = (size_t)cPages << PAGE_SHIFT;
+    LogFlow(("SUPR0LockMem: pSession=%p pvR3=%p cPages=%d paPages=%p\n", pSession, (void *)pvR3, cPages, paPages));
+
+    /*
+     * Verify input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrReturn(paPages, VERR_INVALID_PARAMETER);
+    if (    RT_ALIGN_R3PT(pvR3, PAGE_SIZE, RTR3PTR) != pvR3
+        ||  !pvR3)
+    {
+        Log(("pvR3 (%p) must be page aligned and not NULL!\n", (void *)pvR3));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    /*
+     * Let IPRT do the job.
+     */
+    Mem.eType = MEMREF_TYPE_LOCKED;
+    rc = RTR0MemObjLockUser(&Mem.MemObj, pvR3, cb, RTMEM_PROT_READ | RTMEM_PROT_WRITE, RTR0ProcHandleSelf());
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t iPage = cPages;
+        AssertMsg(RTR0MemObjAddressR3(Mem.MemObj) == pvR3, ("%p == %p\n", RTR0MemObjAddressR3(Mem.MemObj), pvR3));
+        AssertMsg(RTR0MemObjSize(Mem.MemObj) == cb, ("%x == %x\n", RTR0MemObjSize(Mem.MemObj), cb));
+
+        while (iPage-- > 0)
+        {
+            paPages[iPage] = RTR0MemObjGetPagePhysAddr(Mem.MemObj, iPage);
+            if (RT_UNLIKELY(paPages[iPage] == NIL_RTCCPHYS))
+            {
+                AssertMsgFailed(("iPage=%d\n", iPage));
+                rc = VERR_INTERNAL_ERROR;
+                break;
+            }
+        }
+        if (RT_SUCCESS(rc))
+            rc = supdrvMemAdd(&Mem, pSession);
+        if (RT_FAILURE(rc))
+        {
+            int rc2 = RTR0MemObjFree(Mem.MemObj, false);
+            AssertRC(rc2);
+        }
+    }
+
+    return rc;
+}
+
+
+/**
+ * Unlocks the memory pointed to by pv.
+ *
+ * @returns IPRT status code.
+ * @param   pSession    Session to which the memory was locked.
+ * @param   pvR3        Memory to unlock.
+ */
+SUPR0DECL(int) SUPR0UnlockMem(PSUPDRVSESSION pSession, RTR3PTR pvR3)
+{
+    LogFlow(("SUPR0UnlockMem: pSession=%p pvR3=%p\n", pSession, (void *)pvR3));
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    return supdrvMemRelease(pSession, (RTHCUINTPTR)pvR3, MEMREF_TYPE_LOCKED);
+}
+
+
+/**
+ * Allocates a chunk of page aligned memory with contiguous and fixed physical
+ * backing.
+ *
+ * @returns IPRT status code.
+ * @param   pSession    Session data.
+ * @param   cPages      Number of pages to allocate.
+ * @param   ppvR0       Where to put the address of Ring-0 mapping the allocated memory.
+ * @param   ppvR3       Where to put the address of Ring-3 mapping the allocated memory.
+ * @param   pHCPhys     Where to put the physical address of allocated memory.
+ */
+SUPR0DECL(int) SUPR0ContAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS pHCPhys)
+{
+    int             rc;
+    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
+    LogFlow(("SUPR0ContAlloc: pSession=%p cPages=%d ppvR0=%p ppvR3=%p pHCPhys=%p\n", pSession, cPages, ppvR0, ppvR3, pHCPhys));
+
+    /*
+     * Validate input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    if (!ppvR3 || !ppvR0 || !pHCPhys)
+    {
+        Log(("Null pointer. All of these should be set: pSession=%p ppvR0=%p ppvR3=%p pHCPhys=%p\n",
+             pSession, ppvR0, ppvR3, pHCPhys));
+        return VERR_INVALID_PARAMETER;
+
+    }
+    if (cPages < 1 || cPages >= 256)
+    {
+        Log(("Illegal request cPages=%d, must be greater than 0 and smaller than 256.\n", cPages));
+        return VERR_PAGE_COUNT_OUT_OF_RANGE;
+    }
+
+    /*
+     * Let IPRT do the job.
+     */
+    rc = RTR0MemObjAllocCont(&Mem.MemObj, cPages << PAGE_SHIFT, true /* executable R0 mapping */);
+    if (RT_SUCCESS(rc))
+    {
+        int rc2;
+        rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0,
+                               RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf());
+        if (RT_SUCCESS(rc))
+        {
+            Mem.eType = MEMREF_TYPE_CONT;
+            rc = supdrvMemAdd(&Mem, pSession);
+            if (!rc)
+            {
+                *ppvR0 = RTR0MemObjAddress(Mem.MemObj);
+                *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3);
+                *pHCPhys = RTR0MemObjGetPagePhysAddr(Mem.MemObj, 0);
+                return 0;
+            }
+
+            rc2 = RTR0MemObjFree(Mem.MapObjR3, false);
+            AssertRC(rc2);
+        }
+        rc2 = RTR0MemObjFree(Mem.MemObj, false);
+        AssertRC(rc2);
+    }
+
+    return rc;
+}
+
+
+/**
+ * Frees memory allocated using SUPR0ContAlloc().
+ *
+ * @returns IPRT status code.
+ * @param   pSession    The session to which the memory was allocated.
+ * @param   uPtr        Pointer to the memory (ring-3 or ring-0).
+ */
+SUPR0DECL(int) SUPR0ContFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr)
+{
+    LogFlow(("SUPR0ContFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr));
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_CONT);
+}
+
+
+/**
+ * Allocates a chunk of page aligned memory with fixed physical backing below 4GB.
+ *
+ * The memory isn't zeroed.
+ *
+ * @returns IPRT status code.
+ * @param   pSession    Session data.
+ * @param   cPages      Number of pages to allocate.
+ * @param   ppvR0       Where to put the address of Ring-0 mapping of the allocated memory.
+ * @param   ppvR3       Where to put the address of Ring-3 mapping of the allocated memory.
+ * @param   paPages     Where to put the physical addresses of allocated memory.
+ */
+SUPR0DECL(int) SUPR0LowAlloc(PSUPDRVSESSION pSession, uint32_t cPages, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PRTHCPHYS paPages)
+{
+    unsigned        iPage;
+    int             rc;
+    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
+    LogFlow(("SUPR0LowAlloc: pSession=%p cPages=%d ppvR3=%p ppvR0=%p paPages=%p\n", pSession, cPages, ppvR3, ppvR0, paPages));
+
+    /*
+     * Validate input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    if (!ppvR3 || !ppvR0 || !paPages)
+    {
+        Log(("Null pointer. All of these should be set: pSession=%p ppvR3=%p ppvR0=%p paPages=%p\n",
+             pSession, ppvR3, ppvR0, paPages));
+        return VERR_INVALID_PARAMETER;
+
+    }
+    if (cPages < 1 || cPages >= 256)
+    {
+        Log(("Illegal request cPages=%d, must be greater than 0 and smaller than 256.\n", cPages));
+        return VERR_PAGE_COUNT_OUT_OF_RANGE;
+    }
+
+    /*
+     * Let IPRT do the work.
+     */
+    rc = RTR0MemObjAllocLow(&Mem.MemObj, cPages << PAGE_SHIFT, true /* executable ring-0 mapping */);
+    if (RT_SUCCESS(rc))
+    {
+        int rc2;
+        rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0,
+                               RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf());
+        if (RT_SUCCESS(rc))
+        {
+            Mem.eType = MEMREF_TYPE_LOW;
+            rc = supdrvMemAdd(&Mem, pSession);
+            if (!rc)
+            {
+                for (iPage = 0; iPage < cPages; iPage++)
+                {
+                    paPages[iPage] = RTR0MemObjGetPagePhysAddr(Mem.MemObj, iPage);
+                    AssertMsg(!(paPages[iPage] & (PAGE_SIZE - 1)), ("iPage=%d Phys=%RHp\n", paPages[iPage]));
+                }
+                *ppvR0 = RTR0MemObjAddress(Mem.MemObj);
+                *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3);
+                return 0;
+            }
+
+            rc2 = RTR0MemObjFree(Mem.MapObjR3, false);
+            AssertRC(rc2);
+        }
+
+        rc2 = RTR0MemObjFree(Mem.MemObj, false);
+        AssertRC(rc2);
+    }
+
+    return rc;
+}
+
+
+/**
+ * Frees memory allocated using SUPR0LowAlloc().
+ *
+ * @returns IPRT status code.
+ * @param   pSession    The session to which the memory was allocated.
+ * @param   uPtr        Pointer to the memory (ring-3 or ring-0).
+ */
+SUPR0DECL(int) SUPR0LowFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr)
+{
+    LogFlow(("SUPR0LowFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr));
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_LOW);
+}
+
+
+
+/**
+ * Allocates a chunk of memory with both R0 and R3 mappings.
+ * The memory is fixed and it's possible to query the physical addresses using SUPR0MemGetPhys().
+ *
+ * @returns IPRT status code.
+ * @param   pSession    The session to associated the allocation with.
+ * @param   cb          Number of bytes to allocate.
+ * @param   ppvR0       Where to store the address of the Ring-0 mapping.
+ * @param   ppvR3       Where to store the address of the Ring-3 mapping.
+ */
+SUPR0DECL(int) SUPR0MemAlloc(PSUPDRVSESSION pSession, uint32_t cb, PRTR0PTR ppvR0, PRTR3PTR ppvR3)
+{
+    int             rc;
+    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
+    LogFlow(("SUPR0MemAlloc: pSession=%p cb=%d ppvR0=%p ppvR3=%p\n", pSession, cb, ppvR0, ppvR3));
+
+    /*
+     * Validate input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrReturn(ppvR0, VERR_INVALID_POINTER);
+    AssertPtrReturn(ppvR3, VERR_INVALID_POINTER);
+    if (cb < 1 || cb >= _4M)
+    {
+        Log(("Illegal request cb=%u; must be greater than 0 and smaller than 4MB.\n", cb));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    /*
+     * Let IPRT do the work.
+     */
+    rc = RTR0MemObjAllocPage(&Mem.MemObj, cb, true /* executable ring-0 mapping */);
+    if (RT_SUCCESS(rc))
+    {
+        int rc2;
+        rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0,
+                               RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf());
+        if (RT_SUCCESS(rc))
+        {
+            Mem.eType = MEMREF_TYPE_MEM;
+            rc = supdrvMemAdd(&Mem, pSession);
+            if (!rc)
+            {
+                *ppvR0 = RTR0MemObjAddress(Mem.MemObj);
+                *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3);
+                return VINF_SUCCESS;
+            }
+
+            rc2 = RTR0MemObjFree(Mem.MapObjR3, false);
+            AssertRC(rc2);
+        }
+
+        rc2 = RTR0MemObjFree(Mem.MemObj, false);
+        AssertRC(rc2);
+    }
+
+    return rc;
+}
+
+
+/**
+ * Get the physical addresses of memory allocated using SUPR0MemAlloc().
+ *
+ * @returns IPRT status code.
+ * @param   pSession        The session to which the memory was allocated.
+ * @param   uPtr            The Ring-0 or Ring-3 address returned by SUPR0MemAlloc().
+ * @param   paPages         Where to store the physical addresses.
+ */
+SUPR0DECL(int) SUPR0MemGetPhys(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, PSUPPAGE paPages) /** @todo switch this bugger to RTHCPHYS */
+{
+    PSUPDRVBUNDLE pBundle;
+    LogFlow(("SUPR0MemGetPhys: pSession=%p uPtr=%p paPages=%p\n", pSession, (void *)uPtr, paPages));
+
+    /*
+     * Validate input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrReturn(paPages, VERR_INVALID_POINTER);
+    AssertReturn(uPtr, VERR_INVALID_PARAMETER);
+
+    /*
+     * Search for the address.
+     */
+    RTSpinlockAcquire(pSession->Spinlock);
+    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
+    {
+        if (pBundle->cUsed > 0)
+        {
+            unsigned i;
+            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
+            {
+                if (    pBundle->aMem[i].eType == MEMREF_TYPE_MEM
+                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
+                    &&  (   (RTHCUINTPTR)RTR0MemObjAddress(pBundle->aMem[i].MemObj) == uPtr
+                         || (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
+                             && RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == uPtr)
+                        )
+                   )
+                {
+                    const size_t cPages = RTR0MemObjSize(pBundle->aMem[i].MemObj) >> PAGE_SHIFT;
+                    size_t iPage;
+                    for (iPage = 0; iPage < cPages; iPage++)
+                    {
+                        paPages[iPage].Phys = RTR0MemObjGetPagePhysAddr(pBundle->aMem[i].MemObj, iPage);
+                        paPages[iPage].uReserved = 0;
+                    }
+                    RTSpinlockRelease(pSession->Spinlock);
+                    return VINF_SUCCESS;
+                }
+            }
+        }
+    }
+    RTSpinlockRelease(pSession->Spinlock);
+    Log(("Failed to find %p!!!\n", (void *)uPtr));
+    return VERR_INVALID_PARAMETER;
+}
+
+
+/**
+ * Free memory allocated by SUPR0MemAlloc().
+ *
+ * @returns IPRT status code.
+ * @param   pSession        The session owning the allocation.
+ * @param   uPtr            The Ring-0 or Ring-3 address returned by SUPR0MemAlloc().
+ */
+SUPR0DECL(int) SUPR0MemFree(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr)
+{
+    LogFlow(("SUPR0MemFree: pSession=%p uPtr=%p\n", pSession, (void *)uPtr));
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    return supdrvMemRelease(pSession, uPtr, MEMREF_TYPE_MEM);
+}
+
+
+/**
+ * Allocates a chunk of memory with a kernel or/and a user mode mapping.
+ *
+ * The memory is fixed and it's possible to query the physical addresses using
+ * SUPR0MemGetPhys().
+ *
+ * @returns IPRT status code.
+ * @param   pSession    The session to associated the allocation with.
+ * @param   cPages      The number of pages to allocate.
+ * @param   fFlags      Flags, reserved for the future. Must be zero.
+ * @param   ppvR3       Where to store the address of the Ring-3 mapping.
+ *                      NULL if no ring-3 mapping.
+ * @param   ppvR3       Where to store the address of the Ring-0 mapping.
+ *                      NULL if no ring-0 mapping.
+ * @param   paPages     Where to store the addresses of the pages. Optional.
+ */
+SUPR0DECL(int) SUPR0PageAllocEx(PSUPDRVSESSION pSession, uint32_t cPages, uint32_t fFlags, PRTR3PTR ppvR3, PRTR0PTR ppvR0, PRTHCPHYS paPages)
+{
+    int             rc;
+    SUPDRVMEMREF    Mem = { NIL_RTR0MEMOBJ, NIL_RTR0MEMOBJ, MEMREF_TYPE_UNUSED };
+    LogFlow(("SUPR0PageAlloc: pSession=%p cb=%d ppvR3=%p\n", pSession, cPages, ppvR3));
+
+    /*
+     * Validate input. The allowed allocation size must be at least equal to the maximum guest VRAM size.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrNullReturn(ppvR3, VERR_INVALID_POINTER);
+    AssertPtrNullReturn(ppvR0, VERR_INVALID_POINTER);
+    AssertReturn(ppvR3 || ppvR0, VERR_INVALID_PARAMETER);
+    AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
+    if (cPages < 1 || cPages > VBOX_MAX_ALLOC_PAGE_COUNT)
+    {
+        Log(("SUPR0PageAlloc: Illegal request cb=%u; must be greater than 0 and smaller than %uMB (VBOX_MAX_ALLOC_PAGE_COUNT pages).\n", cPages, VBOX_MAX_ALLOC_PAGE_COUNT * (_1M / _4K)));
+        return VERR_PAGE_COUNT_OUT_OF_RANGE;
+    }
+
+    /*
+     * Let IPRT do the work.
+     */
+    if (ppvR0)
+        rc = RTR0MemObjAllocPage(&Mem.MemObj, (size_t)cPages * PAGE_SIZE, true /* fExecutable */);
+    else
+        rc = RTR0MemObjAllocPhysNC(&Mem.MemObj, (size_t)cPages * PAGE_SIZE, NIL_RTHCPHYS);
+    if (RT_SUCCESS(rc))
+    {
+        int rc2;
+        if (ppvR3)
+            rc = RTR0MemObjMapUser(&Mem.MapObjR3, Mem.MemObj, (RTR3PTR)-1, 0,
+                                   RTMEM_PROT_EXEC | RTMEM_PROT_WRITE | RTMEM_PROT_READ, RTR0ProcHandleSelf());
+        else
+            Mem.MapObjR3 = NIL_RTR0MEMOBJ;
+        if (RT_SUCCESS(rc))
+        {
+            Mem.eType = MEMREF_TYPE_PAGE;
+            rc = supdrvMemAdd(&Mem, pSession);
+            if (!rc)
+            {
+                if (ppvR3)
+                    *ppvR3 = RTR0MemObjAddressR3(Mem.MapObjR3);
+                if (ppvR0)
+                    *ppvR0 = RTR0MemObjAddress(Mem.MemObj);
+                if (paPages)
+                {
+                    uint32_t iPage = cPages;
+                    while (iPage-- > 0)
+                    {
+                        paPages[iPage] = RTR0MemObjGetPagePhysAddr(Mem.MapObjR3, iPage);
+                        Assert(paPages[iPage] != NIL_RTHCPHYS);
+                    }
+                }
+                return VINF_SUCCESS;
+            }
+
+            rc2 = RTR0MemObjFree(Mem.MapObjR3, false);
+            AssertRC(rc2);
+        }
+
+        rc2 = RTR0MemObjFree(Mem.MemObj, false);
+        AssertRC(rc2);
+    }
+    return rc;
+}
+
+
+/**
+ * Maps a chunk of memory previously allocated by SUPR0PageAllocEx into kernel
+ * space.
+ *
+ * @returns IPRT status code.
+ * @param   pSession    The session to associated the allocation with.
+ * @param   pvR3        The ring-3 address returned by SUPR0PageAllocEx.
+ * @param   offSub      Where to start mapping. Must be page aligned.
+ * @param   cbSub       How much to map. Must be page aligned.
+ * @param   fFlags      Flags, MBZ.
+ * @param   ppvR0       Where to return the address of the ring-0 mapping on
+ *                      success.
+ */
+SUPR0DECL(int) SUPR0PageMapKernel(PSUPDRVSESSION pSession, RTR3PTR pvR3, uint32_t offSub, uint32_t cbSub,
+                                  uint32_t fFlags, PRTR0PTR ppvR0)
+{
+    int             rc;
+    PSUPDRVBUNDLE   pBundle;
+    RTR0MEMOBJ      hMemObj = NIL_RTR0MEMOBJ;
+    LogFlow(("SUPR0PageMapKernel: pSession=%p pvR3=%p offSub=%#x cbSub=%#x\n", pSession, pvR3, offSub, cbSub));
+
+    /*
+     * Validate input. The allowed allocation size must be at least equal to the maximum guest VRAM size.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrNullReturn(ppvR0, VERR_INVALID_POINTER);
+    AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
+    AssertReturn(!(offSub & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
+    AssertReturn(!(cbSub & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
+    AssertReturn(cbSub, VERR_INVALID_PARAMETER);
+
+    /*
+     * Find the memory object.
+     */
+    RTSpinlockAcquire(pSession->Spinlock);
+    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
+    {
+        if (pBundle->cUsed > 0)
+        {
+            unsigned i;
+            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
+            {
+                if (    (   pBundle->aMem[i].eType == MEMREF_TYPE_PAGE
+                         && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
+                         && pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
+                         && RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == pvR3)
+                    ||  (   pBundle->aMem[i].eType == MEMREF_TYPE_LOCKED
+                         && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
+                         && pBundle->aMem[i].MapObjR3 == NIL_RTR0MEMOBJ
+                         && RTR0MemObjAddressR3(pBundle->aMem[i].MemObj) == pvR3))
+                {
+                    hMemObj = pBundle->aMem[i].MemObj;
+                    break;
+                }
+            }
+        }
+    }
+    RTSpinlockRelease(pSession->Spinlock);
+
+    rc = VERR_INVALID_PARAMETER;
+    if (hMemObj != NIL_RTR0MEMOBJ)
+    {
+        /*
+         * Do some further input validations before calling IPRT.
+         * (Cleanup is done indirectly by telling RTR0MemObjFree to include mappings.)
+         */
+        size_t cbMemObj = RTR0MemObjSize(hMemObj);
+        if (    offSub < cbMemObj
+            &&  cbSub <= cbMemObj
+            &&  offSub + cbSub <= cbMemObj)
+        {
+            RTR0MEMOBJ hMapObj;
+            rc = RTR0MemObjMapKernelEx(&hMapObj, hMemObj, (void *)-1, 0,
+                                       RTMEM_PROT_READ | RTMEM_PROT_WRITE, offSub, cbSub);
+            if (RT_SUCCESS(rc))
+                *ppvR0 = RTR0MemObjAddress(hMapObj);
+        }
+        else
+            SUPR0Printf("SUPR0PageMapKernel: cbMemObj=%#x offSub=%#x cbSub=%#x\n", cbMemObj, offSub, cbSub);
+
+    }
+    return rc;
+}
+
+
+/**
+ * Changes the page level protection of one or more pages previously allocated
+ * by SUPR0PageAllocEx.
+ *
+ * @returns IPRT status code.
+ * @param   pSession    The session to associated the allocation with.
+ * @param   pvR3        The ring-3 address returned by SUPR0PageAllocEx.
+ *                      NIL_RTR3PTR if the ring-3 mapping should be unaffected.
+ * @param   pvR0        The ring-0 address returned by SUPR0PageAllocEx.
+ *                      NIL_RTR0PTR if the ring-0 mapping should be unaffected.
+ * @param   offSub      Where to start changing. Must be page aligned.
+ * @param   cbSub       How much to change. Must be page aligned.
+ * @param   fProt       The new page level protection, see RTMEM_PROT_*.
+ */
+SUPR0DECL(int) SUPR0PageProtect(PSUPDRVSESSION pSession, RTR3PTR pvR3, RTR0PTR pvR0, uint32_t offSub, uint32_t cbSub, uint32_t fProt)
+{
+    int             rc;
+    PSUPDRVBUNDLE   pBundle;
+    RTR0MEMOBJ      hMemObjR0 = NIL_RTR0MEMOBJ;
+    RTR0MEMOBJ      hMemObjR3 = NIL_RTR0MEMOBJ;
+    LogFlow(("SUPR0PageProtect: pSession=%p pvR3=%p pvR0=%p offSub=%#x cbSub=%#x fProt-%#x\n", pSession, pvR3, pvR0, offSub, cbSub, fProt));
+
+    /*
+     * Validate input. The allowed allocation size must be at least equal to the maximum guest VRAM size.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertReturn(!(fProt & ~(RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC | RTMEM_PROT_NONE)), VERR_INVALID_PARAMETER);
+    AssertReturn(!(offSub & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
+    AssertReturn(!(cbSub & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
+    AssertReturn(cbSub, VERR_INVALID_PARAMETER);
+
+    /*
+     * Find the memory object.
+     */
+    RTSpinlockAcquire(pSession->Spinlock);
+    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
+    {
+        if (pBundle->cUsed > 0)
+        {
+            unsigned i;
+            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
+            {
+                if (   pBundle->aMem[i].eType == MEMREF_TYPE_PAGE
+                    && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
+                    && (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
+                        || pvR3 == NIL_RTR3PTR)
+                    && (   pvR0 == NIL_RTR0PTR
+                        || RTR0MemObjAddress(pBundle->aMem[i].MemObj) == pvR0)
+                    && (   pvR3 == NIL_RTR3PTR
+                        || RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == pvR3))
+                {
+                    if (pvR0 != NIL_RTR0PTR)
+                        hMemObjR0 = pBundle->aMem[i].MemObj;
+                    if (pvR3 != NIL_RTR3PTR)
+                        hMemObjR3 = pBundle->aMem[i].MapObjR3;
+                    break;
+                }
+            }
+        }
+    }
+    RTSpinlockRelease(pSession->Spinlock);
+
+    rc = VERR_INVALID_PARAMETER;
+    if (    hMemObjR0 != NIL_RTR0MEMOBJ
+        ||  hMemObjR3 != NIL_RTR0MEMOBJ)
+    {
+        /*
+         * Do some further input validations before calling IPRT.
+         */
+        size_t cbMemObj = hMemObjR0 != NIL_RTR0PTR ? RTR0MemObjSize(hMemObjR0) : RTR0MemObjSize(hMemObjR3);
+        if (    offSub < cbMemObj
+            &&  cbSub <= cbMemObj
+            &&  offSub + cbSub <= cbMemObj)
+        {
+            rc = VINF_SUCCESS;
+            if (hMemObjR3 != NIL_RTR0PTR)
+                rc = RTR0MemObjProtect(hMemObjR3, offSub, cbSub, fProt);
+            if (hMemObjR0 != NIL_RTR0PTR && RT_SUCCESS(rc))
+                rc = RTR0MemObjProtect(hMemObjR0, offSub, cbSub, fProt);
+        }
+        else
+            SUPR0Printf("SUPR0PageMapKernel: cbMemObj=%#x offSub=%#x cbSub=%#x\n", cbMemObj, offSub, cbSub);
+
+    }
+    return rc;
+
+}
+
+
+/**
+ * Free memory allocated by SUPR0PageAlloc() and SUPR0PageAllocEx().
+ *
+ * @returns IPRT status code.
+ * @param   pSession        The session owning the allocation.
+ * @param   pvR3             The Ring-3 address returned by SUPR0PageAlloc() or
+ *                           SUPR0PageAllocEx().
+ */
+SUPR0DECL(int) SUPR0PageFree(PSUPDRVSESSION pSession, RTR3PTR pvR3)
+{
+    LogFlow(("SUPR0PageFree: pSession=%p pvR3=%p\n", pSession, (void *)pvR3));
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    return supdrvMemRelease(pSession, (RTHCUINTPTR)pvR3, MEMREF_TYPE_PAGE);
+}
+
+
+/**
+ * Gets the paging mode of the current CPU.
+ *
+ * @returns Paging mode, SUPPAGEINGMODE_INVALID on error.
+ */
+SUPR0DECL(SUPPAGINGMODE) SUPR0GetPagingMode(void)
+{
+    SUPPAGINGMODE enmMode;
+
+    RTR0UINTREG cr0 = ASMGetCR0();
+    if ((cr0 & (X86_CR0_PG | X86_CR0_PE)) != (X86_CR0_PG | X86_CR0_PE))
+        enmMode = SUPPAGINGMODE_INVALID;
+    else
+    {
+        RTR0UINTREG cr4 = ASMGetCR4();
+        uint32_t fNXEPlusLMA = 0;
+        if (cr4 & X86_CR4_PAE)
+        {
+            uint32_t fExtFeatures = ASMCpuId_EDX(0x80000001);
+            if (fExtFeatures & (X86_CPUID_EXT_FEATURE_EDX_NX | X86_CPUID_EXT_FEATURE_EDX_LONG_MODE))
+            {
+                uint64_t efer = ASMRdMsr(MSR_K6_EFER);
+                if ((fExtFeatures & X86_CPUID_EXT_FEATURE_EDX_NX)        && (efer & MSR_K6_EFER_NXE))
+                    fNXEPlusLMA |= RT_BIT(0);
+                if ((fExtFeatures & X86_CPUID_EXT_FEATURE_EDX_LONG_MODE) && (efer & MSR_K6_EFER_LMA))
+                    fNXEPlusLMA |= RT_BIT(1);
+            }
+        }
+
+        switch ((cr4 & (X86_CR4_PAE | X86_CR4_PGE)) | fNXEPlusLMA)
+        {
+            case 0:
+                enmMode = SUPPAGINGMODE_32_BIT;
+                break;
+
+            case X86_CR4_PGE:
+                enmMode = SUPPAGINGMODE_32_BIT_GLOBAL;
+                break;
+
+            case X86_CR4_PAE:
+                enmMode = SUPPAGINGMODE_PAE;
+                break;
+
+            case X86_CR4_PAE | RT_BIT(0):
+                enmMode = SUPPAGINGMODE_PAE_NX;
+                break;
+
+            case X86_CR4_PAE | X86_CR4_PGE:
+                enmMode = SUPPAGINGMODE_PAE_GLOBAL;
+                break;
+
+            case X86_CR4_PAE | X86_CR4_PGE | RT_BIT(0):
+                enmMode = SUPPAGINGMODE_PAE_GLOBAL;
+                break;
+
+            case RT_BIT(1) | X86_CR4_PAE:
+                enmMode = SUPPAGINGMODE_AMD64;
+                break;
+
+            case RT_BIT(1) | X86_CR4_PAE | RT_BIT(0):
+                enmMode = SUPPAGINGMODE_AMD64_NX;
+                break;
+
+            case RT_BIT(1) | X86_CR4_PAE | X86_CR4_PGE:
+                enmMode = SUPPAGINGMODE_AMD64_GLOBAL;
+                break;
+
+            case RT_BIT(1) | X86_CR4_PAE | X86_CR4_PGE | RT_BIT(0):
+                enmMode = SUPPAGINGMODE_AMD64_GLOBAL_NX;
+                break;
+
+            default:
+                AssertMsgFailed(("Cannot happen! cr4=%#x fNXEPlusLMA=%d\n", cr4, fNXEPlusLMA));
+                enmMode = SUPPAGINGMODE_INVALID;
+                break;
+        }
+    }
+    return enmMode;
+}
+
+
+/**
+ * Change CR4 and take care of the kernel CR4 shadow if applicable.
+ *
+ * CR4 shadow handling is required for Linux >= 4.0. Calling this function
+ * instead of ASMSetCR4() is only necessary for semi-permanent CR4 changes
+ * for code with interrupts enabled.
+ *
+ * @returns the old CR4 value.
+ *
+ * @param   fOrMask         bits to be set in CR4.
+ * @param   fAndMask        bits to be cleard in CR4.
+ *
+ * @remarks Must be called with preemption/interrupts disabled.
+ */
+SUPR0DECL(RTCCUINTREG) SUPR0ChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask)
+{
+#ifdef RT_OS_LINUX
+    return supdrvOSChangeCR4(fOrMask, fAndMask);
+#else
+    RTCCUINTREG uOld = ASMGetCR4();
+    RTCCUINTREG uNew = (uOld & fAndMask) | fOrMask;
+    if (uNew != uOld)
+        ASMSetCR4(uNew);
+    return uOld;
+#endif
+}
+
+
+/**
+ * Enables or disabled hardware virtualization extensions using native OS APIs.
+ *
+ * @returns VBox status code.
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_NOT_SUPPORTED if not supported by the native OS.
+ *
+ * @param   fEnable         Whether to enable or disable.
+ */
+SUPR0DECL(int) SUPR0EnableVTx(bool fEnable)
+{
+#ifdef RT_OS_DARWIN
+    return supdrvOSEnableVTx(fEnable);
+#else
+    return VERR_NOT_SUPPORTED;
+#endif
+}
+
+
+/**
+ * Suspends hardware virtualization extensions using the native OS API.
+ *
+ * This is called prior to entering raw-mode context.
+ *
+ * @returns @c true if suspended, @c false if not.
+ */
+SUPR0DECL(bool) SUPR0SuspendVTxOnCpu(void)
+{
+#ifdef RT_OS_DARWIN
+    return supdrvOSSuspendVTxOnCpu();
+#else
+    return false;
+#endif
+}
+
+
+/**
+ * Resumes hardware virtualization extensions using the native OS API.
+ *
+ * This is called after to entering raw-mode context.
+ *
+ * @param   fSuspended      The return value of SUPR0SuspendVTxOnCpu.
+ */
+SUPR0DECL(void) SUPR0ResumeVTxOnCpu(bool fSuspended)
+{
+#ifdef RT_OS_DARWIN
+    supdrvOSResumeVTxOnCpu(fSuspended);
+#else
+    Assert(!fSuspended);
+#endif
+}
+
+
+/**
+ * Checks if Intel VT-x feature is usable on this CPU.
+ *
+ * @returns VBox status code.
+ * @param   fIsSmxModeAmbiguous   Where to write whether the SMX mode causes
+ *                                ambiguity that makes us unsure whether we
+ *                                really can use VT-x or not.
+ *
+ * @remarks Must be called with preemption disabled.
+ */
+SUPR0DECL(int) SUPR0GetVmxUsability(bool *pfIsSmxModeAmbiguous)
+{
+    uint64_t   u64FeatMsr;
+    bool       fMaybeSmxMode;
+    bool       fMsrLocked;
+    bool       fSmxVmxAllowed;
+    bool       fVmxAllowed;
+    bool       fIsSmxModeAmbiguous;
+    int        rc;
+
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+
+    u64FeatMsr          = ASMRdMsr(MSR_IA32_FEATURE_CONTROL);
+    fMaybeSmxMode       = RT_BOOL(ASMGetCR4() & X86_CR4_SMXE);
+    fMsrLocked          = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK);
+    fSmxVmxAllowed      = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON);
+    fVmxAllowed         = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON);
+    fIsSmxModeAmbiguous = false;
+    rc                  = VERR_INTERNAL_ERROR_5;
+
+    /* Check if the LOCK bit is set but excludes the required VMXON bit. */
+    if (fMsrLocked)
+    {
+        if (fVmxAllowed && fSmxVmxAllowed)
+            rc = VINF_SUCCESS;
+        else if (!fVmxAllowed && !fSmxVmxAllowed)
+            rc = VERR_VMX_MSR_ALL_VMXON_DISABLED;
+        else if (!fMaybeSmxMode)
+        {
+            if (fVmxAllowed)
+                rc = VINF_SUCCESS;
+            else
+                rc = VERR_VMX_MSR_VMXON_DISABLED;
+        }
+        else
+        {
+            /*
+             * CR4.SMXE is set but this doesn't mean the CPU is necessarily in SMX mode. We shall assume
+             * that it is -not- and that it is a stupid BIOS/OS setting CR4.SMXE for no good reason.
+             * See @bugref{6873}.
+             */
+            Assert(fMaybeSmxMode == true);
+            fIsSmxModeAmbiguous = true;
+            rc = VINF_SUCCESS;
+        }
+    }
+    else
+    {
+        /*
+         * MSR is not yet locked; we can change it ourselves here.
+         * Once the lock bit is set, this MSR can no longer be modified.
+         *
+         * Set both the VMXON and SMX_VMXON bits as we can't determine SMX mode
+         * accurately. See @bugref{6873}.
+         */
+        u64FeatMsr |= MSR_IA32_FEATURE_CONTROL_LOCK
+                    | MSR_IA32_FEATURE_CONTROL_SMX_VMXON
+                    | MSR_IA32_FEATURE_CONTROL_VMXON;
+        ASMWrMsr(MSR_IA32_FEATURE_CONTROL, u64FeatMsr);
+
+        /* Verify. */
+        u64FeatMsr     = ASMRdMsr(MSR_IA32_FEATURE_CONTROL);
+        fMsrLocked     = RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_LOCK);
+        fSmxVmxAllowed = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_SMX_VMXON);
+        fVmxAllowed    = fMsrLocked && RT_BOOL(u64FeatMsr & MSR_IA32_FEATURE_CONTROL_VMXON);
+        if (fSmxVmxAllowed && fVmxAllowed)
+            rc = VINF_SUCCESS;
+        else
+            rc = VERR_VMX_MSR_LOCKING_FAILED;
+    }
+
+    if (pfIsSmxModeAmbiguous)
+        *pfIsSmxModeAmbiguous = fIsSmxModeAmbiguous;
+
+    return rc;
+}
+
+
+/**
+ * Checks if AMD-V SVM feature is usable on this CPU.
+ *
+ * @returns VBox status code.
+ * @param   fInitSvm    If usable, try to initialize SVM on this CPU.
+ *
+ * @remarks Must be called with preemption disabled.
+ */
+SUPR0DECL(int) SUPR0GetSvmUsability(bool fInitSvm)
+{
+    int      rc;
+    uint64_t fVmCr;
+    uint64_t fEfer;
+
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    fVmCr = ASMRdMsr(MSR_K8_VM_CR);
+    if (!(fVmCr & MSR_K8_VM_CR_SVM_DISABLE))
+    {
+        rc = VINF_SUCCESS;
+        if (fInitSvm)
+        {
+            /* Turn on SVM in the EFER MSR. */
+            fEfer = ASMRdMsr(MSR_K6_EFER);
+            if (fEfer & MSR_K6_EFER_SVME)
+                rc = VERR_SVM_IN_USE;
+            else
+            {
+                ASMWrMsr(MSR_K6_EFER, fEfer | MSR_K6_EFER_SVME);
+
+                /* Paranoia. */
+                fEfer = ASMRdMsr(MSR_K6_EFER);
+                if (fEfer & MSR_K6_EFER_SVME)
+                {
+                    /* Restore previous value. */
+                    ASMWrMsr(MSR_K6_EFER, fEfer & ~MSR_K6_EFER_SVME);
+                }
+                else
+                    rc = VERR_SVM_ILLEGAL_EFER_MSR;
+            }
+        }
+    }
+    else
+        rc = VERR_SVM_DISABLED;
+    return rc;
+}
+
+
+/**
+ * Queries the AMD-V and VT-x capabilities of the calling CPU.
+ *
+ * @returns VBox status code.
+ * @retval  VERR_VMX_NO_VMX
+ * @retval  VERR_VMX_MSR_ALL_VMXON_DISABLED
+ * @retval  VERR_VMX_MSR_VMXON_DISABLED
+ * @retval  VERR_VMX_MSR_LOCKING_FAILED
+ * @retval  VERR_SVM_NO_SVM
+ * @retval  VERR_SVM_DISABLED
+ * @retval  VERR_UNSUPPORTED_CPU if not identifiable as an AMD, Intel or VIA
+ *          (centaur) CPU.
+ *
+ * @param   pSession        The session handle.
+ * @param   pfCaps          Where to store the capabilities.
+ */
+SUPR0DECL(int) SUPR0QueryVTCaps(PSUPDRVSESSION pSession, uint32_t *pfCaps)
+{
+    int  rc = VERR_UNSUPPORTED_CPU;
+    bool fIsSmxModeAmbiguous = false;
+    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pfCaps, VERR_INVALID_POINTER);
+
+    *pfCaps = 0;
+    /* We may modify MSRs and re-read them, disable preemption so we make sure we don't migrate CPUs. */
+    RTThreadPreemptDisable(&PreemptState);
+    if (ASMHasCpuId())
+    {
+        uint32_t fFeaturesECX, fFeaturesEDX, uDummy;
+        uint32_t uMaxId, uVendorEBX, uVendorECX, uVendorEDX;
+
+        ASMCpuId(0, &uMaxId, &uVendorEBX, &uVendorECX, &uVendorEDX);
+        ASMCpuId(1, &uDummy, &uDummy, &fFeaturesECX, &fFeaturesEDX);
+
+        if (   ASMIsValidStdRange(uMaxId)
+            && (   ASMIsIntelCpuEx(     uVendorEBX, uVendorECX, uVendorEDX)
+                || ASMIsViaCentaurCpuEx(uVendorEBX, uVendorECX, uVendorEDX) )
+           )
+        {
+            if (    (fFeaturesECX & X86_CPUID_FEATURE_ECX_VMX)
+                 && (fFeaturesEDX & X86_CPUID_FEATURE_EDX_MSR)
+                 && (fFeaturesEDX & X86_CPUID_FEATURE_EDX_FXSR)
+               )
+            {
+                rc = SUPR0GetVmxUsability(&fIsSmxModeAmbiguous);
+                if (rc == VINF_SUCCESS)
+                {
+                    VMXCAPABILITY vtCaps;
+
+                    *pfCaps |= SUPVTCAPS_VT_X;
+
+                    vtCaps.u = ASMRdMsr(MSR_IA32_VMX_PROCBASED_CTLS);
+                    if (vtCaps.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_USE_SECONDARY_EXEC_CTRL)
+                    {
+                        vtCaps.u = ASMRdMsr(MSR_IA32_VMX_PROCBASED_CTLS2);
+                        if (vtCaps.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_EPT)
+                            *pfCaps |= SUPVTCAPS_NESTED_PAGING;
+                        if (vtCaps.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_UNRESTRICTED_GUEST)
+                            *pfCaps |= SUPVTCAPS_VTX_UNRESTRICTED_GUEST;
+                    }
+                }
+            }
+            else
+                rc = VERR_VMX_NO_VMX;
+        }
+        else if (   ASMIsAmdCpuEx(uVendorEBX, uVendorECX, uVendorEDX)
+                 && ASMIsValidStdRange(uMaxId))
+        {
+            uint32_t fExtFeaturesEcx, uExtMaxId;
+            ASMCpuId(0x80000000, &uExtMaxId, &uDummy, &uDummy, &uDummy);
+            ASMCpuId(0x80000001, &uDummy, &uDummy, &fExtFeaturesEcx, &uDummy);
+
+            /* Check if SVM is available. */
+            if (   ASMIsValidExtRange(uExtMaxId)
+                && uExtMaxId >= 0x8000000a
+                && (fExtFeaturesEcx & X86_CPUID_AMD_FEATURE_ECX_SVM)
+                && (fFeaturesEDX    & X86_CPUID_FEATURE_EDX_MSR)
+                && (fFeaturesEDX    & X86_CPUID_FEATURE_EDX_FXSR)
+               )
+            {
+                rc = SUPR0GetSvmUsability(false /* fInitSvm */);
+                if (RT_SUCCESS(rc))
+                {
+                    uint32_t fSvmFeatures;
+                    *pfCaps |= SUPVTCAPS_AMD_V;
+
+                    /* Query AMD-V features. */
+                    ASMCpuId(0x8000000a, &uDummy, &uDummy, &uDummy, &fSvmFeatures);
+                    if (fSvmFeatures & AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING)
+                        *pfCaps |= SUPVTCAPS_NESTED_PAGING;
+                }
+            }
+            else
+                rc = VERR_SVM_NO_SVM;
+        }
+    }
+
+    RTThreadPreemptRestore(&PreemptState);
+    if (fIsSmxModeAmbiguous)
+        SUPR0Printf(("WARNING! CR4 hints SMX mode but your CPU is too secretive. Proceeding anyway... We wish you good luck!\n"));
+    return rc;
+}
+
+
+/**
+ * Register a component factory with the support driver.
+ *
+ * This is currently restricted to kernel sessions only.
+ *
+ * @returns VBox status code.
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_NO_MEMORY if we're out of memory.
+ * @retval  VERR_ALREADY_EXISTS if the factory has already been registered.
+ * @retval  VERR_ACCESS_DENIED if it isn't a kernel session.
+ * @retval  VERR_INVALID_PARAMETER on invalid parameter.
+ * @retval  VERR_INVALID_POINTER on invalid pointer parameter.
+ *
+ * @param   pSession        The SUPDRV session (must be a ring-0 session).
+ * @param   pFactory        Pointer to the component factory registration structure.
+ *
+ * @remarks This interface is also available via SUPR0IdcComponentRegisterFactory.
+ */
+SUPR0DECL(int) SUPR0ComponentRegisterFactory(PSUPDRVSESSION pSession, PCSUPDRVFACTORY pFactory)
+{
+    PSUPDRVFACTORYREG pNewReg;
+    const char *psz;
+    int rc;
+
+    /*
+     * Validate parameters.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertReturn(pSession->R0Process == NIL_RTR0PROCESS, VERR_ACCESS_DENIED);
+    AssertPtrReturn(pFactory, VERR_INVALID_POINTER);
+    AssertPtrReturn(pFactory->pfnQueryFactoryInterface, VERR_INVALID_POINTER);
+    psz = RTStrEnd(pFactory->szName, sizeof(pFactory->szName));
+    AssertReturn(psz, VERR_INVALID_PARAMETER);
+
+    /*
+     * Allocate and initialize a new registration structure.
+     */
+    pNewReg = (PSUPDRVFACTORYREG)RTMemAlloc(sizeof(SUPDRVFACTORYREG));
+    if (pNewReg)
+    {
+        pNewReg->pNext = NULL;
+        pNewReg->pFactory = pFactory;
+        pNewReg->pSession = pSession;
+        pNewReg->cchName = psz - &pFactory->szName[0];
+
+        /*
+         * Add it to the tail of the list after checking for prior registration.
+         */
+        rc = RTSemFastMutexRequest(pSession->pDevExt->mtxComponentFactory);
+        if (RT_SUCCESS(rc))
+        {
+            PSUPDRVFACTORYREG pPrev = NULL;
+            PSUPDRVFACTORYREG pCur = pSession->pDevExt->pComponentFactoryHead;
+            while (pCur && pCur->pFactory != pFactory)
+            {
+                pPrev = pCur;
+                pCur = pCur->pNext;
+            }
+            if (!pCur)
+            {
+                if (pPrev)
+                    pPrev->pNext = pNewReg;
+                else
+                    pSession->pDevExt->pComponentFactoryHead = pNewReg;
+                rc = VINF_SUCCESS;
+            }
+            else
+                rc = VERR_ALREADY_EXISTS;
+
+            RTSemFastMutexRelease(pSession->pDevExt->mtxComponentFactory);
+        }
+
+        if (RT_FAILURE(rc))
+            RTMemFree(pNewReg);
+    }
+    else
+        rc = VERR_NO_MEMORY;
+    return rc;
+}
+
+
+/**
+ * Deregister a component factory.
+ *
+ * @returns VBox status code.
+ * @retval  VINF_SUCCESS on success.
+ * @retval  VERR_NOT_FOUND if the factory wasn't registered.
+ * @retval  VERR_ACCESS_DENIED if it isn't a kernel session.
+ * @retval  VERR_INVALID_PARAMETER on invalid parameter.
+ * @retval  VERR_INVALID_POINTER on invalid pointer parameter.
+ *
+ * @param   pSession        The SUPDRV session (must be a ring-0 session).
+ * @param   pFactory        Pointer to the component factory registration structure
+ *                          previously passed SUPR0ComponentRegisterFactory().
+ *
+ * @remarks This interface is also available via SUPR0IdcComponentDeregisterFactory.
+ */
+SUPR0DECL(int) SUPR0ComponentDeregisterFactory(PSUPDRVSESSION pSession, PCSUPDRVFACTORY pFactory)
+{
+    int rc;
+
+    /*
+     * Validate parameters.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertReturn(pSession->R0Process == NIL_RTR0PROCESS, VERR_ACCESS_DENIED);
+    AssertPtrReturn(pFactory, VERR_INVALID_POINTER);
+
+    /*
+     * Take the lock and look for the registration record.
+     */
+    rc = RTSemFastMutexRequest(pSession->pDevExt->mtxComponentFactory);
+    if (RT_SUCCESS(rc))
+    {
+        PSUPDRVFACTORYREG pPrev = NULL;
+        PSUPDRVFACTORYREG pCur = pSession->pDevExt->pComponentFactoryHead;
+        while (pCur && pCur->pFactory != pFactory)
+        {
+            pPrev = pCur;
+            pCur = pCur->pNext;
+        }
+        if (pCur)
+        {
+            if (!pPrev)
+                pSession->pDevExt->pComponentFactoryHead = pCur->pNext;
+            else
+                pPrev->pNext = pCur->pNext;
+
+            pCur->pNext = NULL;
+            pCur->pFactory = NULL;
+            pCur->pSession = NULL;
+            rc = VINF_SUCCESS;
+        }
+        else
+            rc = VERR_NOT_FOUND;
+
+        RTSemFastMutexRelease(pSession->pDevExt->mtxComponentFactory);
+
+        RTMemFree(pCur);
+    }
+    return rc;
+}
+
+
+/**
+ * Queries a component factory.
+ *
+ * @returns VBox status code.
+ * @retval  VERR_INVALID_PARAMETER on invalid parameter.
+ * @retval  VERR_INVALID_POINTER on invalid pointer parameter.
+ * @retval  VERR_SUPDRV_COMPONENT_NOT_FOUND if the component factory wasn't found.
+ * @retval  VERR_SUPDRV_INTERFACE_NOT_SUPPORTED if the interface wasn't supported.
+ *
+ * @param   pSession            The SUPDRV session.
+ * @param   pszName             The name of the component factory.
+ * @param   pszInterfaceUuid    The UUID of the factory interface (stringified).
+ * @param   ppvFactoryIf        Where to store the factory interface.
+ */
+SUPR0DECL(int) SUPR0ComponentQueryFactory(PSUPDRVSESSION pSession, const char *pszName, const char *pszInterfaceUuid, void **ppvFactoryIf)
+{
+    const char *pszEnd;
+    size_t cchName;
+    int rc;
+
+    /*
+     * Validate parameters.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+
+    AssertPtrReturn(pszName, VERR_INVALID_POINTER);
+    pszEnd = RTStrEnd(pszName, RT_SIZEOFMEMB(SUPDRVFACTORY, szName));
+    AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
+    cchName = pszEnd - pszName;
+
+    AssertPtrReturn(pszInterfaceUuid, VERR_INVALID_POINTER);
+    pszEnd = RTStrEnd(pszInterfaceUuid, RTUUID_STR_LENGTH);
+    AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
+
+    AssertPtrReturn(ppvFactoryIf, VERR_INVALID_POINTER);
+    *ppvFactoryIf = NULL;
+
+    /*
+     * Take the lock and try all factories by this name.
+     */
+    rc = RTSemFastMutexRequest(pSession->pDevExt->mtxComponentFactory);
+    if (RT_SUCCESS(rc))
+    {
+        PSUPDRVFACTORYREG pCur = pSession->pDevExt->pComponentFactoryHead;
+        rc = VERR_SUPDRV_COMPONENT_NOT_FOUND;
+        while (pCur)
+        {
+            if (    pCur->cchName == cchName
+                &&  !memcmp(pCur->pFactory->szName, pszName, cchName))
+            {
+                void *pvFactory = pCur->pFactory->pfnQueryFactoryInterface(pCur->pFactory, pSession, pszInterfaceUuid);
+                if (pvFactory)
+                {
+                    *ppvFactoryIf = pvFactory;
+                    rc = VINF_SUCCESS;
+                    break;
+                }
+                rc = VERR_SUPDRV_INTERFACE_NOT_SUPPORTED;
+            }
+
+            /* next */
+            pCur = pCur->pNext;
+        }
+
+        RTSemFastMutexRelease(pSession->pDevExt->mtxComponentFactory);
+    }
+    return rc;
+}
+
+
+/**
+ * Adds a memory object to the session.
+ *
+ * @returns IPRT status code.
+ * @param   pMem        Memory tracking structure containing the
+ *                      information to track.
+ * @param   pSession    The session.
+ */
+static int supdrvMemAdd(PSUPDRVMEMREF pMem, PSUPDRVSESSION pSession)
+{
+    PSUPDRVBUNDLE pBundle;
+
+    /*
+     * Find free entry and record the allocation.
+     */
+    RTSpinlockAcquire(pSession->Spinlock);
+    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
+    {
+        if (pBundle->cUsed < RT_ELEMENTS(pBundle->aMem))
+        {
+            unsigned i;
+            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
+            {
+                if (pBundle->aMem[i].MemObj == NIL_RTR0MEMOBJ)
+                {
+                    pBundle->cUsed++;
+                    pBundle->aMem[i] = *pMem;
+                    RTSpinlockRelease(pSession->Spinlock);
+                    return VINF_SUCCESS;
+                }
+            }
+            AssertFailed();             /* !!this can't be happening!!! */
+        }
+    }
+    RTSpinlockRelease(pSession->Spinlock);
+
+    /*
+     * Need to allocate a new bundle.
+     * Insert into the last entry in the bundle.
+     */
+    pBundle = (PSUPDRVBUNDLE)RTMemAllocZ(sizeof(*pBundle));
+    if (!pBundle)
+        return VERR_NO_MEMORY;
+
+    /* take last entry. */
+    pBundle->cUsed++;
+    pBundle->aMem[RT_ELEMENTS(pBundle->aMem) - 1] = *pMem;
+
+    /* insert into list. */
+    RTSpinlockAcquire(pSession->Spinlock);
+    pBundle->pNext = pSession->Bundle.pNext;
+    pSession->Bundle.pNext = pBundle;
+    RTSpinlockRelease(pSession->Spinlock);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Releases a memory object referenced by pointer and type.
+ *
+ * @returns IPRT status code.
+ * @param   pSession    Session data.
+ * @param   uPtr        Pointer to memory. This is matched against both the R0 and R3 addresses.
+ * @param   eType       Memory type.
+ */
+static int supdrvMemRelease(PSUPDRVSESSION pSession, RTHCUINTPTR uPtr, SUPDRVMEMREFTYPE eType)
+{
+    PSUPDRVBUNDLE pBundle;
+
+    /*
+     * Validate input.
+     */
+    if (!uPtr)
+    {
+        Log(("Illegal address %p\n", (void *)uPtr));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    /*
+     * Search for the address.
+     */
+    RTSpinlockAcquire(pSession->Spinlock);
+    for (pBundle = &pSession->Bundle; pBundle; pBundle = pBundle->pNext)
+    {
+        if (pBundle->cUsed > 0)
+        {
+            unsigned i;
+            for (i = 0; i < RT_ELEMENTS(pBundle->aMem); i++)
+            {
+                if (    pBundle->aMem[i].eType == eType
+                    &&  pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ
+                    &&  (   (RTHCUINTPTR)RTR0MemObjAddress(pBundle->aMem[i].MemObj) == uPtr
+                         || (   pBundle->aMem[i].MapObjR3 != NIL_RTR0MEMOBJ
+                             && RTR0MemObjAddressR3(pBundle->aMem[i].MapObjR3) == uPtr))
+                   )
+                {
+                    /* Make a copy of it and release it outside the spinlock. */
+                    SUPDRVMEMREF Mem = pBundle->aMem[i];
+                    pBundle->aMem[i].eType = MEMREF_TYPE_UNUSED;
+                    pBundle->aMem[i].MemObj = NIL_RTR0MEMOBJ;
+                    pBundle->aMem[i].MapObjR3 = NIL_RTR0MEMOBJ;
+                    RTSpinlockRelease(pSession->Spinlock);
+
+                    if (Mem.MapObjR3 != NIL_RTR0MEMOBJ)
+                    {
+                        int rc = RTR0MemObjFree(Mem.MapObjR3, false);
+                        AssertRC(rc); /** @todo figure out how to handle this. */
+                    }
+                    if (Mem.MemObj != NIL_RTR0MEMOBJ)
+                    {
+                        int rc = RTR0MemObjFree(Mem.MemObj, true /* fFreeMappings */);
+                        AssertRC(rc); /** @todo figure out how to handle this. */
+                    }
+                    return VINF_SUCCESS;
+                }
+            }
+        }
+    }
+    RTSpinlockRelease(pSession->Spinlock);
+    Log(("Failed to find %p!!! (eType=%d)\n", (void *)uPtr, eType));
+    return VERR_INVALID_PARAMETER;
+}
+
+
+/**
+ * Opens an image. If it's the first time it's opened the call must upload
+ * the bits using the supdrvIOCtl_LdrLoad() / SUPDRV_IOCTL_LDR_LOAD function.
+ *
+ * This is the 1st step of the loading.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt     Device globals.
+ * @param   pSession    Session data.
+ * @param   pReq        The open request.
+ */
+static int supdrvIOCtl_LdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDROPEN pReq)
+{
+    int             rc;
+    PSUPDRVLDRIMAGE pImage;
+    void           *pv;
+    size_t          cchName = strlen(pReq->u.In.szName); /* (caller checked < 32). */
+    LogFlow(("supdrvIOCtl_LdrOpen: szName=%s cbImageWithTabs=%d\n", pReq->u.In.szName, pReq->u.In.cbImageWithTabs));
+
+    /*
+     * Check if we got an instance of the image already.
+     */
+    supdrvLdrLock(pDevExt);
+    for (pImage = pDevExt->pLdrImages; pImage; pImage = pImage->pNext)
+    {
+        if (    pImage->szName[cchName] == '\0'
+            &&  !memcmp(pImage->szName, pReq->u.In.szName, cchName))
+        {
+            if (RT_LIKELY(pImage->cUsage < UINT32_MAX / 2U))
+            {
+                /** @todo check cbImageBits and cbImageWithTabs here, if they differs that indicates that the images are different. */
+                pImage->cUsage++;
+                pReq->u.Out.pvImageBase   = pImage->pvImage;
+                pReq->u.Out.fNeedsLoading = pImage->uState == SUP_IOCTL_LDR_OPEN;
+                pReq->u.Out.fNativeLoader = pImage->fNative;
+                supdrvLdrAddUsage(pSession, pImage);
+                supdrvLdrUnlock(pDevExt);
+                return VINF_SUCCESS;
+            }
+            supdrvLdrUnlock(pDevExt);
+            Log(("supdrvIOCtl_LdrOpen: To many existing references to '%s'!\n", pReq->u.In.szName));
+            return VERR_INTERNAL_ERROR_3; /** @todo add VERR_TOO_MANY_REFERENCES */
+        }
+    }
+    /* (not found - add it!) */
+
+    /* If the loader interface is locked down, make userland fail early */
+    if (pDevExt->fLdrLockedDown)
+    {
+        supdrvLdrUnlock(pDevExt);
+        Log(("supdrvIOCtl_LdrOpen: Not adding '%s' to image list, loader interface is locked down!\n", pReq->u.In.szName));
+        return VERR_PERMISSION_DENIED;
+    }
+
+    /*
+     * Allocate memory.
+     */
+    Assert(cchName < sizeof(pImage->szName));
+    pv = RTMemAlloc(sizeof(SUPDRVLDRIMAGE));
+    if (!pv)
+    {
+        supdrvLdrUnlock(pDevExt);
+        Log(("supdrvIOCtl_LdrOpen: RTMemAlloc() failed\n"));
+        return /*VERR_NO_MEMORY*/ VERR_INTERNAL_ERROR_2;
+    }
+
+    /*
+     * Setup and link in the LDR stuff.
+     */
+    pImage = (PSUPDRVLDRIMAGE)pv;
+    pImage->pvImage         = NULL;
+    pImage->pvImageAlloc    = NULL;
+    pImage->cbImageWithTabs = pReq->u.In.cbImageWithTabs;
+    pImage->cbImageBits     = pReq->u.In.cbImageBits;
+    pImage->cSymbols        = 0;
+    pImage->paSymbols       = NULL;
+    pImage->pachStrTab      = NULL;
+    pImage->cbStrTab        = 0;
+    pImage->pfnModuleInit   = NULL;
+    pImage->pfnModuleTerm   = NULL;
+    pImage->pfnServiceReqHandler = NULL;
+    pImage->uState          = SUP_IOCTL_LDR_OPEN;
+    pImage->cUsage          = 1;
+    pImage->pDevExt         = pDevExt;
+    memcpy(pImage->szName, pReq->u.In.szName, cchName + 1);
+
+    /*
+     * Try load it using the native loader, if that isn't supported, fall back
+     * on the older method.
+     */
+    pImage->fNative         = true;
+    rc = supdrvOSLdrOpen(pDevExt, pImage, pReq->u.In.szFilename);
+    if (rc == VERR_NOT_SUPPORTED)
+    {
+        pImage->pvImageAlloc = RTMemExecAlloc(pImage->cbImageBits + 31);
+        pImage->pvImage     = RT_ALIGN_P(pImage->pvImageAlloc, 32);
+        pImage->fNative     = false;
+        rc = pImage->pvImageAlloc ? VINF_SUCCESS : VERR_NO_EXEC_MEMORY;
+    }
+    if (RT_FAILURE(rc))
+    {
+        supdrvLdrUnlock(pDevExt);
+        RTMemFree(pImage);
+        Log(("supdrvIOCtl_LdrOpen(%s): failed - %Rrc\n", pReq->u.In.szName, rc));
+        return rc;
+    }
+    Assert(VALID_PTR(pImage->pvImage) || RT_FAILURE(rc));
+
+    /*
+     * Link it.
+     */
+    pImage->pNext           = pDevExt->pLdrImages;
+    pDevExt->pLdrImages     = pImage;
+
+    supdrvLdrAddUsage(pSession, pImage);
+
+    pReq->u.Out.pvImageBase   = pImage->pvImage;
+    pReq->u.Out.fNeedsLoading = true;
+    pReq->u.Out.fNativeLoader = pImage->fNative;
+    supdrvOSLdrNotifyOpened(pDevExt, pImage);
+
+    supdrvLdrUnlock(pDevExt);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Worker that validates a pointer to an image entrypoint.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt     The device globals.
+ * @param   pImage      The loader image.
+ * @param   pv          The pointer into the image.
+ * @param   fMayBeNull  Whether it may be NULL.
+ * @param   pszWhat     What is this entrypoint? (for logging)
+ * @param   pbImageBits The image bits prepared by ring-3.
+ *
+ * @remarks Will leave the lock on failure.
+ */
+static int supdrvLdrValidatePointer(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, void *pv,
+                                    bool fMayBeNull, const uint8_t *pbImageBits, const char *pszWhat)
+{
+    if (!fMayBeNull || pv)
+    {
+        if ((uintptr_t)pv - (uintptr_t)pImage->pvImage >= pImage->cbImageBits)
+        {
+            supdrvLdrUnlock(pDevExt);
+            Log(("Out of range (%p LB %#x): %s=%p\n", pImage->pvImage, pImage->cbImageBits, pszWhat, pv));
+            return VERR_INVALID_PARAMETER;
+        }
+
+        if (pImage->fNative)
+        {
+            int rc = supdrvOSLdrValidatePointer(pDevExt, pImage, pv, pbImageBits);
+            if (RT_FAILURE(rc))
+            {
+                supdrvLdrUnlock(pDevExt);
+                Log(("Bad entry point address: %s=%p (rc=%Rrc)\n", pszWhat, pv, rc));
+                return rc;
+            }
+        }
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Loads the image bits.
+ *
+ * This is the 2nd step of the loading.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt     Device globals.
+ * @param   pSession    Session data.
+ * @param   pReq        The request.
+ */
+static int supdrvIOCtl_LdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRLOAD pReq)
+{
+    PSUPDRVLDRUSAGE pUsage;
+    PSUPDRVLDRIMAGE pImage;
+    int             rc;
+    LogFlow(("supdrvIOCtl_LdrLoad: pvImageBase=%p cbImageWithBits=%d\n", pReq->u.In.pvImageBase, pReq->u.In.cbImageWithTabs));
+
+    /*
+     * Find the ldr image.
+     */
+    supdrvLdrLock(pDevExt);
+    pUsage = pSession->pLdrUsage;
+    while (pUsage && pUsage->pImage->pvImage != pReq->u.In.pvImageBase)
+        pUsage = pUsage->pNext;
+    if (!pUsage)
+    {
+        supdrvLdrUnlock(pDevExt);
+        Log(("SUP_IOCTL_LDR_LOAD: couldn't find image!\n"));
+        return VERR_INVALID_HANDLE;
+    }
+    pImage = pUsage->pImage;
+
+    /*
+     * Validate input.
+     */
+    if (   pImage->cbImageWithTabs != pReq->u.In.cbImageWithTabs
+        || pImage->cbImageBits     != pReq->u.In.cbImageBits)
+    {
+        supdrvLdrUnlock(pDevExt);
+        Log(("SUP_IOCTL_LDR_LOAD: image size mismatch!! %d(prep) != %d(load) or %d != %d\n",
+             pImage->cbImageWithTabs, pReq->u.In.cbImageWithTabs, pImage->cbImageBits, pReq->u.In.cbImageBits));
+        return VERR_INVALID_HANDLE;
+    }
+
+    if (pImage->uState != SUP_IOCTL_LDR_OPEN)
+    {
+        unsigned uState = pImage->uState;
+        supdrvLdrUnlock(pDevExt);
+        if (uState != SUP_IOCTL_LDR_LOAD)
+            AssertMsgFailed(("SUP_IOCTL_LDR_LOAD: invalid image state %d (%#x)!\n", uState, uState));
+        return VERR_ALREADY_LOADED;
+    }
+
+    /* If the loader interface is locked down, don't load new images */
+    if (pDevExt->fLdrLockedDown)
+    {
+        supdrvLdrUnlock(pDevExt);
+        Log(("SUP_IOCTL_LDR_LOAD: Not loading '%s' image bits, loader interface is locked down!\n", pImage->szName));
+        return VERR_PERMISSION_DENIED;
+    }
+
+    switch (pReq->u.In.eEPType)
+    {
+        case SUPLDRLOADEP_NOTHING:
+            break;
+
+        case SUPLDRLOADEP_VMMR0:
+            rc = supdrvLdrValidatePointer(    pDevExt, pImage, pReq->u.In.EP.VMMR0.pvVMMR0,          false, pReq->u.In.abImage, "pvVMMR0");
+            if (RT_SUCCESS(rc))
+                rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.EP.VMMR0.pvVMMR0EntryInt,  false, pReq->u.In.abImage, "pvVMMR0EntryInt");
+            if (RT_SUCCESS(rc))
+                rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.EP.VMMR0.pvVMMR0EntryFast, false, pReq->u.In.abImage, "pvVMMR0EntryFast");
+            if (RT_SUCCESS(rc))
+                rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.EP.VMMR0.pvVMMR0EntryEx,   false, pReq->u.In.abImage, "pvVMMR0EntryEx");
+            if (RT_FAILURE(rc))
+                return rc;
+            break;
+
+        case SUPLDRLOADEP_SERVICE:
+            rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.EP.Service.pfnServiceReq, false, pReq->u.In.abImage, "pfnServiceReq");
+            if (RT_FAILURE(rc))
+                return rc;
+            if (    pReq->u.In.EP.Service.apvReserved[0] != NIL_RTR0PTR
+                ||  pReq->u.In.EP.Service.apvReserved[1] != NIL_RTR0PTR
+                ||  pReq->u.In.EP.Service.apvReserved[2] != NIL_RTR0PTR)
+            {
+                supdrvLdrUnlock(pDevExt);
+                Log(("Out of range (%p LB %#x): apvReserved={%p,%p,%p} MBZ!\n",
+                     pImage->pvImage, pReq->u.In.cbImageWithTabs,
+                     pReq->u.In.EP.Service.apvReserved[0],
+                     pReq->u.In.EP.Service.apvReserved[1],
+                     pReq->u.In.EP.Service.apvReserved[2]));
+                return VERR_INVALID_PARAMETER;
+            }
+            break;
+
+        default:
+            supdrvLdrUnlock(pDevExt);
+            Log(("Invalid eEPType=%d\n", pReq->u.In.eEPType));
+            return VERR_INVALID_PARAMETER;
+    }
+
+    rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.pfnModuleInit, true, pReq->u.In.abImage, "pfnModuleInit");
+    if (RT_FAILURE(rc))
+        return rc;
+    rc = supdrvLdrValidatePointer(pDevExt, pImage, pReq->u.In.pfnModuleTerm, true, pReq->u.In.abImage, "pfnModuleTerm");
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /*
+     * Allocate and copy the tables.
+     * (No need to do try/except as this is a buffered request.)
+     */
+    pImage->cbStrTab = pReq->u.In.cbStrTab;
+    if (pImage->cbStrTab)
+    {
+        pImage->pachStrTab = (char *)RTMemAlloc(pImage->cbStrTab);
+        if (pImage->pachStrTab)
+            memcpy(pImage->pachStrTab, &pReq->u.In.abImage[pReq->u.In.offStrTab], pImage->cbStrTab);
+        else
+            rc = /*VERR_NO_MEMORY*/ VERR_INTERNAL_ERROR_3;
+    }
+
+    pImage->cSymbols = pReq->u.In.cSymbols;
+    if (RT_SUCCESS(rc) && pImage->cSymbols)
+    {
+        size_t  cbSymbols = pImage->cSymbols * sizeof(SUPLDRSYM);
+        pImage->paSymbols = (PSUPLDRSYM)RTMemAlloc(cbSymbols);
+        if (pImage->paSymbols)
+            memcpy(pImage->paSymbols, &pReq->u.In.abImage[pReq->u.In.offSymbols], cbSymbols);
+        else
+            rc = /*VERR_NO_MEMORY*/ VERR_INTERNAL_ERROR_4;
+    }
+
+    /*
+     * Copy the bits / complete native loading.
+     */
+    if (RT_SUCCESS(rc))
+    {
+        pImage->uState = SUP_IOCTL_LDR_LOAD;
+        pImage->pfnModuleInit = (PFNR0MODULEINIT)pReq->u.In.pfnModuleInit;
+        pImage->pfnModuleTerm = (PFNR0MODULETERM)pReq->u.In.pfnModuleTerm;
+
+        if (pImage->fNative)
+            rc = supdrvOSLdrLoad(pDevExt, pImage, pReq->u.In.abImage, pReq);
+        else
+        {
+            memcpy(pImage->pvImage, &pReq->u.In.abImage[0], pImage->cbImageBits);
+            Log(("vboxdrv: Loaded '%s' at %p\n", pImage->szName, pImage->pvImage));
+        }
+    }
+
+    /*
+     * Update any entry points.
+     */
+    if (RT_SUCCESS(rc))
+    {
+        switch (pReq->u.In.eEPType)
+        {
+            default:
+            case SUPLDRLOADEP_NOTHING:
+                rc = VINF_SUCCESS;
+                break;
+            case SUPLDRLOADEP_VMMR0:
+                rc = supdrvLdrSetVMMR0EPs(pDevExt, pReq->u.In.EP.VMMR0.pvVMMR0, pReq->u.In.EP.VMMR0.pvVMMR0EntryInt,
+                                          pReq->u.In.EP.VMMR0.pvVMMR0EntryFast, pReq->u.In.EP.VMMR0.pvVMMR0EntryEx);
+                break;
+            case SUPLDRLOADEP_SERVICE:
+                pImage->pfnServiceReqHandler = (PFNSUPR0SERVICEREQHANDLER)pReq->u.In.EP.Service.pfnServiceReq;
+                rc = VINF_SUCCESS;
+                break;
+        }
+    }
+
+    /*
+     * On success call the module initialization.
+     */
+    LogFlow(("supdrvIOCtl_LdrLoad: pfnModuleInit=%p\n", pImage->pfnModuleInit));
+    if (RT_SUCCESS(rc) && pImage->pfnModuleInit)
+    {
+        Log(("supdrvIOCtl_LdrLoad: calling pfnModuleInit=%p\n", pImage->pfnModuleInit));
+        pDevExt->pLdrInitImage  = pImage;
+        pDevExt->hLdrInitThread = RTThreadNativeSelf();
+        rc = pImage->pfnModuleInit(pImage);
+        pDevExt->pLdrInitImage  = NULL;
+        pDevExt->hLdrInitThread = NIL_RTNATIVETHREAD;
+        if (RT_FAILURE(rc) && pDevExt->pvVMMR0 == pImage->pvImage)
+            supdrvLdrUnsetVMMR0EPs(pDevExt);
+    }
+    SUPR0Printf("vboxdrv: %p %s\n", pImage->pvImage, pImage->szName);
+
+    if (RT_FAILURE(rc))
+    {
+        /* Inform the tracing component in case ModuleInit registered TPs. */
+        supdrvTracerModuleUnloading(pDevExt, pImage);
+
+        pImage->uState              = SUP_IOCTL_LDR_OPEN;
+        pImage->pfnModuleInit       = NULL;
+        pImage->pfnModuleTerm       = NULL;
+        pImage->pfnServiceReqHandler= NULL;
+        pImage->cbStrTab            = 0;
+        RTMemFree(pImage->pachStrTab);
+        pImage->pachStrTab          = NULL;
+        RTMemFree(pImage->paSymbols);
+        pImage->paSymbols           = NULL;
+        pImage->cSymbols            = 0;
+    }
+
+    supdrvLdrUnlock(pDevExt);
+    return rc;
+}
+
+
+/**
+ * Frees a previously loaded (prep'ed) image.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt     Device globals.
+ * @param   pSession    Session data.
+ * @param   pReq        The request.
+ */
+static int supdrvIOCtl_LdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRFREE pReq)
+{
+    int             rc;
+    PSUPDRVLDRUSAGE pUsagePrev;
+    PSUPDRVLDRUSAGE pUsage;
+    PSUPDRVLDRIMAGE pImage;
+    LogFlow(("supdrvIOCtl_LdrFree: pvImageBase=%p\n", pReq->u.In.pvImageBase));
+
+    /*
+     * Find the ldr image.
+     */
+    supdrvLdrLock(pDevExt);
+    pUsagePrev = NULL;
+    pUsage = pSession->pLdrUsage;
+    while (pUsage && pUsage->pImage->pvImage != pReq->u.In.pvImageBase)
+    {
+        pUsagePrev = pUsage;
+        pUsage = pUsage->pNext;
+    }
+    if (!pUsage)
+    {
+        supdrvLdrUnlock(pDevExt);
+        Log(("SUP_IOCTL_LDR_FREE: couldn't find image!\n"));
+        return VERR_INVALID_HANDLE;
+    }
+
+    /*
+     * Check if we can remove anything.
+     */
+    rc = VINF_SUCCESS;
+    pImage = pUsage->pImage;
+    if (pImage->cUsage <= 1 || pUsage->cUsage <= 1)
+    {
+        /*
+         * Check if there are any objects with destructors in the image, if
+         * so leave it for the session cleanup routine so we get a chance to
+         * clean things up in the right order and not leave them all dangling.
+         */
+        RTSpinlockAcquire(pDevExt->Spinlock);
+        if (pImage->cUsage <= 1)
+        {
+            PSUPDRVOBJ pObj;
+            for (pObj = pDevExt->pObjs; pObj; pObj = pObj->pNext)
+                if (RT_UNLIKELY((uintptr_t)pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImageBits))
+                {
+                    rc = VERR_DANGLING_OBJECTS;
+                    break;
+                }
+        }
+        else
+        {
+            PSUPDRVUSAGE pGenUsage;
+            for (pGenUsage = pSession->pUsage; pGenUsage; pGenUsage = pGenUsage->pNext)
+                if (RT_UNLIKELY((uintptr_t)pGenUsage->pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImageBits))
+                {
+                    rc = VERR_DANGLING_OBJECTS;
+                    break;
+                }
+        }
+        RTSpinlockRelease(pDevExt->Spinlock);
+        if (rc == VINF_SUCCESS)
+        {
+            /* unlink it */
+            if (pUsagePrev)
+                pUsagePrev->pNext = pUsage->pNext;
+            else
+                pSession->pLdrUsage = pUsage->pNext;
+
+            /* free it */
+            pUsage->pImage = NULL;
+            pUsage->pNext = NULL;
+            RTMemFree(pUsage);
+
+            /*
+             * Dereference the image.
+             */
+            if (pImage->cUsage <= 1)
+                supdrvLdrFree(pDevExt, pImage);
+            else
+                pImage->cUsage--;
+        }
+        else
+        {
+            Log(("supdrvIOCtl_LdrFree: Dangling objects in %p/%s!\n", pImage->pvImage, pImage->szName));
+            rc = VINF_SUCCESS; /** @todo BRANCH-2.1: remove this after branching. */
+        }
+    }
+    else
+    {
+        /*
+         * Dereference both image and usage.
+         */
+        pImage->cUsage--;
+        pUsage->cUsage--;
+    }
+
+    supdrvLdrUnlock(pDevExt);
+    return rc;
+}
+
+
+/**
+ * Lock down the image loader interface.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt     Device globals.
+ */
+static int supdrvIOCtl_LdrLockDown(PSUPDRVDEVEXT pDevExt)
+{
+    LogFlow(("supdrvIOCtl_LdrLockDown:\n"));
+
+    supdrvLdrLock(pDevExt);
+    if (!pDevExt->fLdrLockedDown)
+    {
+        pDevExt->fLdrLockedDown = true;
+        Log(("supdrvIOCtl_LdrLockDown: Image loader interface locked down\n"));
+    }
+    supdrvLdrUnlock(pDevExt);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Gets the address of a symbol in an open image.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt     Device globals.
+ * @param   pSession    Session data.
+ * @param   pReq        The request buffer.
+ */
+static int supdrvIOCtl_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLDRGETSYMBOL pReq)
+{
+    PSUPDRVLDRIMAGE pImage;
+    PSUPDRVLDRUSAGE pUsage;
+    uint32_t        i;
+    PSUPLDRSYM      paSyms;
+    const char     *pchStrings;
+    const size_t    cbSymbol = strlen(pReq->u.In.szSymbol) + 1;
+    void           *pvSymbol = NULL;
+    int             rc = VERR_GENERAL_FAILURE;
+    Log3(("supdrvIOCtl_LdrGetSymbol: pvImageBase=%p szSymbol=\"%s\"\n", pReq->u.In.pvImageBase, pReq->u.In.szSymbol));
+
+    /*
+     * Find the ldr image.
+     */
+    supdrvLdrLock(pDevExt);
+    pUsage = pSession->pLdrUsage;
+    while (pUsage && pUsage->pImage->pvImage != pReq->u.In.pvImageBase)
+        pUsage = pUsage->pNext;
+    if (!pUsage)
+    {
+        supdrvLdrUnlock(pDevExt);
+        Log(("SUP_IOCTL_LDR_GET_SYMBOL: couldn't find image!\n"));
+        return VERR_INVALID_HANDLE;
+    }
+    pImage = pUsage->pImage;
+    if (pImage->uState != SUP_IOCTL_LDR_LOAD)
+    {
+        unsigned uState = pImage->uState;
+        supdrvLdrUnlock(pDevExt);
+        Log(("SUP_IOCTL_LDR_GET_SYMBOL: invalid image state %d (%#x)!\n", uState, uState)); NOREF(uState);
+        return VERR_ALREADY_LOADED;
+    }
+
+    /*
+     * Search the symbol strings.
+     *
+     * Note! The int32_t is for native loading on solaris where the data
+     *       and text segments are in very different places.
+     */
+    pchStrings = pImage->pachStrTab;
+    paSyms     = pImage->paSymbols;
+    for (i = 0; i < pImage->cSymbols; i++)
+    {
+        if (    paSyms[i].offName + cbSymbol <= pImage->cbStrTab
+            &&  !memcmp(pchStrings + paSyms[i].offName, pReq->u.In.szSymbol, cbSymbol))
+        {
+            pvSymbol = (uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol;
+            rc = VINF_SUCCESS;
+            break;
+        }
+    }
+    supdrvLdrUnlock(pDevExt);
+    pReq->u.Out.pvSymbol = pvSymbol;
+    return rc;
+}
+
+
+/**
+ * Gets the address of a symbol in an open image or the support driver.
+ *
+ * @returns VINF_SUCCESS on success.
+ * @returns
+ * @param   pDevExt     Device globals.
+ * @param   pSession    Session data.
+ * @param   pReq        The request buffer.
+ */
+static int supdrvIDC_LdrGetSymbol(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPDRVIDCREQGETSYM pReq)
+{
+    int             rc = VINF_SUCCESS;
+    const char     *pszSymbol = pReq->u.In.pszSymbol;
+    const char     *pszModule = pReq->u.In.pszModule;
+    size_t          cbSymbol;
+    char const     *pszEnd;
+    uint32_t        i;
+
+    /*
+     * Input validation.
+     */
+    AssertPtrReturn(pszSymbol, VERR_INVALID_POINTER);
+    pszEnd = RTStrEnd(pszSymbol, 512);
+    AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
+    cbSymbol = pszEnd - pszSymbol + 1;
+
+    if (pszModule)
+    {
+        AssertPtrReturn(pszModule, VERR_INVALID_POINTER);
+        pszEnd = RTStrEnd(pszModule, 64);
+        AssertReturn(pszEnd, VERR_INVALID_PARAMETER);
+    }
+    Log3(("supdrvIDC_LdrGetSymbol: pszModule=%p:{%s} pszSymbol=%p:{%s}\n", pszModule, pszModule, pszSymbol, pszSymbol));
+
+
+    if (    !pszModule
+        ||  !strcmp(pszModule, "SupDrv"))
+    {
+        /*
+         * Search the support driver export table.
+         */
+        for (i = 0; i < RT_ELEMENTS(g_aFunctions); i++)
+            if (!strcmp(g_aFunctions[i].szName, pszSymbol))
+            {
+                pReq->u.Out.pfnSymbol = (PFNRT)g_aFunctions[i].pfn;
+                break;
+            }
+    }
+    else
+    {
+        /*
+         * Find the loader image.
+         */
+        PSUPDRVLDRIMAGE pImage;
+
+        supdrvLdrLock(pDevExt);
+
+        for (pImage = pDevExt->pLdrImages; pImage; pImage = pImage->pNext)
+            if (!strcmp(pImage->szName, pszModule))
+                break;
+        if (pImage && pImage->uState == SUP_IOCTL_LDR_LOAD)
+        {
+            /*
+             * Search the symbol strings.
+             */
+            const char *pchStrings = pImage->pachStrTab;
+            PCSUPLDRSYM paSyms     = pImage->paSymbols;
+            for (i = 0; i < pImage->cSymbols; i++)
+            {
+                if (    paSyms[i].offName + cbSymbol <= pImage->cbStrTab
+                    &&  !memcmp(pchStrings + paSyms[i].offName, pszSymbol, cbSymbol))
+                {
+                    /*
+                     * Found it! Calc the symbol address and add a reference to the module.
+                     */
+                    pReq->u.Out.pfnSymbol = (PFNRT)((uint8_t *)pImage->pvImage + (int32_t)paSyms[i].offSymbol);
+                    rc = supdrvLdrAddUsage(pSession, pImage);
+                    break;
+                }
+            }
+        }
+        else
+            rc = pImage ? VERR_WRONG_ORDER : VERR_MODULE_NOT_FOUND;
+
+        supdrvLdrUnlock(pDevExt);
+    }
+    return rc;
+}
+
+
+/**
+ * Updates the VMMR0 entry point pointers.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt             Device globals.
+ * @param   pSession            Session data.
+ * @param   pVMMR0              VMMR0 image handle.
+ * @param   pvVMMR0EntryInt     VMMR0EntryInt address.
+ * @param   pvVMMR0EntryFast    VMMR0EntryFast address.
+ * @param   pvVMMR0EntryEx      VMMR0EntryEx address.
+ * @remark  Caller must own the loader mutex.
+ */
+static int supdrvLdrSetVMMR0EPs(PSUPDRVDEVEXT pDevExt, void *pvVMMR0, void *pvVMMR0EntryInt, void *pvVMMR0EntryFast, void *pvVMMR0EntryEx)
+{
+    int rc = VINF_SUCCESS;
+    LogFlow(("supdrvLdrSetR0EP pvVMMR0=%p pvVMMR0EntryInt=%p\n", pvVMMR0, pvVMMR0EntryInt));
+
+
+    /*
+     * Check if not yet set.
+     */
+    if (!pDevExt->pvVMMR0)
+    {
+        pDevExt->pvVMMR0 = pvVMMR0;
+        *(void **)&pDevExt->pfnVMMR0EntryInt  = pvVMMR0EntryInt;
+        *(void **)&pDevExt->pfnVMMR0EntryFast = pvVMMR0EntryFast;
+        *(void **)&pDevExt->pfnVMMR0EntryEx   = pvVMMR0EntryEx;
+        ASMCompilerBarrier(); /* the above isn't nice, so be careful... */
+    }
+    else
+    {
+        /*
+         * Return failure or success depending on whether the values match or not.
+         */
+        if (    pDevExt->pvVMMR0 != pvVMMR0
+            ||  (void *)pDevExt->pfnVMMR0EntryInt   != pvVMMR0EntryInt
+            ||  (void *)pDevExt->pfnVMMR0EntryFast  != pvVMMR0EntryFast
+            ||  (void *)pDevExt->pfnVMMR0EntryEx    != pvVMMR0EntryEx)
+        {
+            AssertMsgFailed(("SUP_IOCTL_LDR_SETR0EP: Already set pointing to a different module!\n"));
+            rc = VERR_INVALID_PARAMETER;
+        }
+    }
+    return rc;
+}
+
+
+/**
+ * Unsets the VMMR0 entry point installed by supdrvLdrSetR0EP.
+ *
+ * @param   pDevExt     Device globals.
+ */
+static void supdrvLdrUnsetVMMR0EPs(PSUPDRVDEVEXT pDevExt)
+{
+    pDevExt->pvVMMR0            = NULL;
+    pDevExt->pfnVMMR0EntryInt   = NULL;
+    pDevExt->pfnVMMR0EntryFast  = NULL;
+    pDevExt->pfnVMMR0EntryEx    = NULL;
+}
+
+
+/**
+ * Adds a usage reference in the specified session of an image.
+ *
+ * Called while owning the loader semaphore.
+ *
+ * @returns VINF_SUCCESS on success and VERR_NO_MEMORY on failure.
+ * @param   pSession    Session in question.
+ * @param   pImage      Image which the session is using.
+ */
+static int supdrvLdrAddUsage(PSUPDRVSESSION pSession, PSUPDRVLDRIMAGE pImage)
+{
+    PSUPDRVLDRUSAGE pUsage;
+    LogFlow(("supdrvLdrAddUsage: pImage=%p\n", pImage));
+
+    /*
+     * Referenced it already?
+     */
+    pUsage = pSession->pLdrUsage;
+    while (pUsage)
+    {
+        if (pUsage->pImage == pImage)
+        {
+            pUsage->cUsage++;
+            return VINF_SUCCESS;
+        }
+        pUsage = pUsage->pNext;
+    }
+
+    /*
+     * Allocate new usage record.
+     */
+    pUsage = (PSUPDRVLDRUSAGE)RTMemAlloc(sizeof(*pUsage));
+    AssertReturn(pUsage, /*VERR_NO_MEMORY*/ VERR_INTERNAL_ERROR_5);
+    pUsage->cUsage = 1;
+    pUsage->pImage = pImage;
+    pUsage->pNext  = pSession->pLdrUsage;
+    pSession->pLdrUsage = pUsage;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Frees a load image.
+ *
+ * @param   pDevExt     Pointer to device extension.
+ * @param   pImage      Pointer to the image we're gonna free.
+ *                      This image must exit!
+ * @remark  The caller MUST own SUPDRVDEVEXT::mtxLdr!
+ */
+static void supdrvLdrFree(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
+{
+    PSUPDRVLDRIMAGE pImagePrev;
+    LogFlow(("supdrvLdrFree: pImage=%p\n", pImage));
+
+    /*
+     * Warn if we're releasing images while the image loader interface is
+     * locked down -- we won't be able to reload them!
+     */
+    if (pDevExt->fLdrLockedDown)
+        Log(("supdrvLdrFree: Warning: unloading '%s' image, while loader interface is locked down!\n", pImage->szName));
+
+    /* find it - arg. should've used doubly linked list. */
+    Assert(pDevExt->pLdrImages);
+    pImagePrev = NULL;
+    if (pDevExt->pLdrImages != pImage)
+    {
+        pImagePrev = pDevExt->pLdrImages;
+        while (pImagePrev->pNext != pImage)
+            pImagePrev = pImagePrev->pNext;
+        Assert(pImagePrev->pNext == pImage);
+    }
+
+    /* unlink */
+    if (pImagePrev)
+        pImagePrev->pNext = pImage->pNext;
+    else
+        pDevExt->pLdrImages = pImage->pNext;
+
+    /* check if this is VMMR0.r0 unset its entry point pointers. */
+    if (pDevExt->pvVMMR0 == pImage->pvImage)
+        supdrvLdrUnsetVMMR0EPs(pDevExt);
+
+    /* check for objects with destructors in this image. (Shouldn't happen.) */
+    if (pDevExt->pObjs)
+    {
+        unsigned        cObjs = 0;
+        PSUPDRVOBJ      pObj;
+        RTSpinlockAcquire(pDevExt->Spinlock);
+        for (pObj = pDevExt->pObjs; pObj; pObj = pObj->pNext)
+            if (RT_UNLIKELY((uintptr_t)pObj->pfnDestructor - (uintptr_t)pImage->pvImage < pImage->cbImageBits))
+            {
+                pObj->pfnDestructor = NULL;
+                cObjs++;
+            }
+        RTSpinlockRelease(pDevExt->Spinlock);
+        if (cObjs)
+            OSDBGPRINT(("supdrvLdrFree: Image '%s' has %d dangling objects!\n", pImage->szName, cObjs));
+    }
+
+    /* call termination function if fully loaded. */
+    if (    pImage->pfnModuleTerm
+        &&  pImage->uState == SUP_IOCTL_LDR_LOAD)
+    {
+        LogFlow(("supdrvIOCtl_LdrLoad: calling pfnModuleTerm=%p\n", pImage->pfnModuleTerm));
+        pImage->pfnModuleTerm(pImage);
+    }
+
+    /* Inform the tracing component. */
+    supdrvTracerModuleUnloading(pDevExt, pImage);
+
+    /* do native unload if appropriate. */
+    if (pImage->fNative)
+        supdrvOSLdrUnload(pDevExt, pImage);
+
+    /* free the image */
+    pImage->cUsage  = 0;
+    pImage->pDevExt = NULL;
+    pImage->pNext   = NULL;
+    pImage->uState  = SUP_IOCTL_LDR_FREE;
+    RTMemExecFree(pImage->pvImageAlloc, pImage->cbImageBits + 31);
+    pImage->pvImageAlloc = NULL;
+    RTMemFree(pImage->pachStrTab);
+    pImage->pachStrTab = NULL;
+    RTMemFree(pImage->paSymbols);
+    pImage->paSymbols = NULL;
+    RTMemFree(pImage);
+}
+
+
+/**
+ * Acquires the loader lock.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt         The device extension.
+ */
+DECLINLINE(int) supdrvLdrLock(PSUPDRVDEVEXT pDevExt)
+{
+#ifdef SUPDRV_USE_MUTEX_FOR_LDR
+    int rc = RTSemMutexRequest(pDevExt->mtxLdr, RT_INDEFINITE_WAIT);
+#else
+    int rc = RTSemFastMutexRequest(pDevExt->mtxLdr);
+#endif
+    AssertRC(rc);
+    return rc;
+}
+
+
+/**
+ * Releases the loader lock.
+ *
+ * @returns IPRT status code.
+ * @param   pDevExt         The device extension.
+ */
+DECLINLINE(int) supdrvLdrUnlock(PSUPDRVDEVEXT pDevExt)
+{
+#ifdef SUPDRV_USE_MUTEX_FOR_LDR
+    return RTSemMutexRelease(pDevExt->mtxLdr);
+#else
+    return RTSemFastMutexRelease(pDevExt->mtxLdr);
+#endif
+}
+
+
+/**
+ * Implements the service call request.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         The device extension.
+ * @param   pSession        The calling session.
+ * @param   pReq            The request packet, valid.
+ */
+static int supdrvIOCtl_CallServiceModule(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPCALLSERVICE pReq)
+{
+#if !defined(RT_OS_WINDOWS) || defined(RT_ARCH_AMD64) || defined(DEBUG)
+    int rc;
+
+    /*
+     * Find the module first in the module referenced by the calling session.
+     */
+    rc = supdrvLdrLock(pDevExt);
+    if (RT_SUCCESS(rc))
+    {
+        PFNSUPR0SERVICEREQHANDLER   pfnServiceReqHandler = NULL;
+        PSUPDRVLDRUSAGE             pUsage;
+
+        for (pUsage = pSession->pLdrUsage; pUsage; pUsage = pUsage->pNext)
+            if (    pUsage->pImage->pfnServiceReqHandler
+                &&  !strcmp(pUsage->pImage->szName, pReq->u.In.szName))
+            {
+                pfnServiceReqHandler = pUsage->pImage->pfnServiceReqHandler;
+                break;
+            }
+        supdrvLdrUnlock(pDevExt);
+
+        if (pfnServiceReqHandler)
+        {
+            /*
+             * Call it.
+             */
+            if (pReq->Hdr.cbIn == SUP_IOCTL_CALL_SERVICE_SIZE(0))
+                rc = pfnServiceReqHandler(pSession, pReq->u.In.uOperation, pReq->u.In.u64Arg, NULL);
+            else
+                rc = pfnServiceReqHandler(pSession, pReq->u.In.uOperation, pReq->u.In.u64Arg, (PSUPR0SERVICEREQHDR)&pReq->abReqPkt[0]);
+        }
+        else
+            rc = VERR_SUPDRV_SERVICE_NOT_FOUND;
+    }
+
+    /* log it */
+    if (    RT_FAILURE(rc)
+        &&  rc != VERR_INTERRUPTED
+        &&  rc != VERR_TIMEOUT)
+        Log(("SUP_IOCTL_CALL_SERVICE: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+             rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+    else
+        Log4(("SUP_IOCTL_CALL_SERVICE: rc=%Rrc op=%u out=%u arg=%RX64 p/t=%RTproc/%RTthrd\n",
+              rc, pReq->u.In.uOperation, pReq->Hdr.cbOut, pReq->u.In.u64Arg, RTProcSelf(), RTThreadNativeSelf()));
+    return rc;
+#else  /* RT_OS_WINDOWS && !RT_ARCH_AMD64 && !DEBUG */
+    return VERR_NOT_IMPLEMENTED;
+#endif /* RT_OS_WINDOWS && !RT_ARCH_AMD64 && !DEBUG */
+}
+
+
+/**
+ * Implements the logger settings request.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt     The device extension.
+ * @param   pSession    The caller's session.
+ * @param   pReq        The request.
+ */
+static int supdrvIOCtl_LoggerSettings(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPLOGGERSETTINGS pReq)
+{
+    const char *pszGroup = &pReq->u.In.szStrings[pReq->u.In.offGroups];
+    const char *pszFlags = &pReq->u.In.szStrings[pReq->u.In.offFlags];
+    const char *pszDest  = &pReq->u.In.szStrings[pReq->u.In.offDestination];
+    PRTLOGGER   pLogger  = NULL;
+    int         rc;
+
+    /*
+     * Some further validation.
+     */
+    switch (pReq->u.In.fWhat)
+    {
+        case SUPLOGGERSETTINGS_WHAT_SETTINGS:
+        case SUPLOGGERSETTINGS_WHAT_CREATE:
+            break;
+
+        case SUPLOGGERSETTINGS_WHAT_DESTROY:
+            if (*pszGroup || *pszFlags || *pszDest)
+                return VERR_INVALID_PARAMETER;
+            if (pReq->u.In.fWhich == SUPLOGGERSETTINGS_WHICH_RELEASE)
+                return VERR_ACCESS_DENIED;
+            break;
+
+        default:
+            return VERR_INTERNAL_ERROR;
+    }
+
+    /*
+     * Get the logger.
+     */
+    switch (pReq->u.In.fWhich)
+    {
+        case SUPLOGGERSETTINGS_WHICH_DEBUG:
+            pLogger = RTLogGetDefaultInstance();
+            break;
+
+        case SUPLOGGERSETTINGS_WHICH_RELEASE:
+            pLogger = RTLogRelDefaultInstance();
+            break;
+
+        default:
+            return VERR_INTERNAL_ERROR;
+    }
+
+    /*
+     * Do the job.
+     */
+    switch (pReq->u.In.fWhat)
+    {
+        case SUPLOGGERSETTINGS_WHAT_SETTINGS:
+            if (pLogger)
+            {
+                rc = RTLogFlags(pLogger, pszFlags);
+                if (RT_SUCCESS(rc))
+                    rc = RTLogGroupSettings(pLogger, pszGroup);
+                NOREF(pszDest);
+            }
+            else
+                rc = VERR_NOT_FOUND;
+            break;
+
+        case SUPLOGGERSETTINGS_WHAT_CREATE:
+        {
+            if (pLogger)
+                rc = VERR_ALREADY_EXISTS;
+            else
+            {
+                static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
+
+                rc = RTLogCreate(&pLogger,
+                                 0 /* fFlags */,
+                                 pszGroup,
+                                 pReq->u.In.fWhich == SUPLOGGERSETTINGS_WHICH_DEBUG
+                                 ? "VBOX_LOG"
+                                 : "VBOX_RELEASE_LOG",
+                                 RT_ELEMENTS(s_apszGroups),
+                                 s_apszGroups,
+                                 RTLOGDEST_STDOUT | RTLOGDEST_DEBUGGER,
+                                 NULL);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = RTLogFlags(pLogger, pszFlags);
+                    NOREF(pszDest);
+                    if (RT_SUCCESS(rc))
+                    {
+                        switch (pReq->u.In.fWhich)
+                        {
+                            case SUPLOGGERSETTINGS_WHICH_DEBUG:
+                                pLogger = RTLogSetDefaultInstance(pLogger);
+                                break;
+                            case SUPLOGGERSETTINGS_WHICH_RELEASE:
+                                pLogger = RTLogRelSetDefaultInstance(pLogger);
+                                break;
+                        }
+                    }
+                    RTLogDestroy(pLogger);
+                }
+            }
+            break;
+        }
+
+        case SUPLOGGERSETTINGS_WHAT_DESTROY:
+            switch (pReq->u.In.fWhich)
+            {
+                case SUPLOGGERSETTINGS_WHICH_DEBUG:
+                    pLogger = RTLogSetDefaultInstance(NULL);
+                    break;
+                case SUPLOGGERSETTINGS_WHICH_RELEASE:
+                    pLogger = RTLogRelSetDefaultInstance(NULL);
+                    break;
+            }
+            rc = RTLogDestroy(pLogger);
+            break;
+
+        default:
+        {
+            rc = VERR_INTERNAL_ERROR;
+            break;
+        }
+    }
+
+    return rc;
+}
+
+
+/**
+ * Implements the MSR prober operations.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt     The device extension.
+ * @param   pReq        The request.
+ */
+static int supdrvIOCtl_MsrProber(PSUPDRVDEVEXT pDevExt, PSUPMSRPROBER pReq)
+{
+#ifdef SUPDRV_WITH_MSR_PROBER
+    RTCPUID const idCpu = pReq->u.In.idCpu == UINT32_MAX ? NIL_RTCPUID : pReq->u.In.idCpu;
+    int rc;
+
+    switch (pReq->u.In.enmOp)
+    {
+        case SUPMSRPROBEROP_READ:
+        {
+            uint64_t uValue;
+            rc = supdrvOSMsrProberRead(pReq->u.In.uMsr, idCpu, &uValue);
+            if (RT_SUCCESS(rc))
+            {
+                pReq->u.Out.uResults.Read.uValue = uValue;
+                pReq->u.Out.uResults.Read.fGp    = false;
+            }
+            else if (rc == VERR_ACCESS_DENIED)
+            {
+                pReq->u.Out.uResults.Read.uValue = 0;
+                pReq->u.Out.uResults.Read.fGp    = true;
+                rc  = VINF_SUCCESS;
+            }
+            break;
+        }
+
+        case SUPMSRPROBEROP_WRITE:
+            rc = supdrvOSMsrProberWrite(pReq->u.In.uMsr, idCpu, pReq->u.In.uArgs.Write.uToWrite);
+            if (RT_SUCCESS(rc))
+                pReq->u.Out.uResults.Write.fGp   = false;
+            else if (rc == VERR_ACCESS_DENIED)
+            {
+                pReq->u.Out.uResults.Write.fGp   = true;
+                rc  = VINF_SUCCESS;
+            }
+            break;
+
+        case SUPMSRPROBEROP_MODIFY:
+        case SUPMSRPROBEROP_MODIFY_FASTER:
+            rc = supdrvOSMsrProberModify(idCpu, pReq);
+            break;
+
+        default:
+            return VERR_INVALID_FUNCTION;
+    }
+    return rc;
+#else
+    return VERR_NOT_IMPLEMENTED;
+#endif
+}
+
+
+/**
+ * Resume built-in keyboard on MacBook Air and Pro hosts.
+ * If there is no built-in keyboard device, return success anyway.
+ *
+ * @returns 0 on Mac OS X platform, VERR_NOT_IMPLEMENTED on the other ones.
+ */
+static int supdrvIOCtl_ResumeSuspendedKbds(void)
+{
+#if defined(RT_OS_DARWIN)
+    return supdrvDarwinResumeSuspendedKbds();
+#else
+    return VERR_NOT_IMPLEMENTED;
+#endif
+}
+
diff --git a/src/VBox/HostDrivers/Support/SUPDrvGip.cpp b/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
new file mode 100644
index 0000000..2dd3c2a
--- /dev/null
+++ b/src/VBox/HostDrivers/Support/SUPDrvGip.cpp
@@ -0,0 +1,4725 @@
+/* $Id: SUPDrvGip.cpp $ */
+/** @file
+ * VBoxDrv - The VirtualBox Support Driver - Common code for GIP.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_SUP_DRV
+#define SUPDRV_AGNOSTIC
+#include "SUPDrvInternal.h"
+#ifndef PAGE_SHIFT
+# include <iprt/param.h>
+#endif
+#include <iprt/asm.h>
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/asm-math.h>
+#include <iprt/cpuset.h>
+#include <iprt/handletable.h>
+#include <iprt/mem.h>
+#include <iprt/mp.h>
+#include <iprt/power.h>
+#include <iprt/process.h>
+#include <iprt/semaphore.h>
+#include <iprt/spinlock.h>
+#include <iprt/thread.h>
+#include <iprt/uuid.h>
+#include <iprt/net.h>
+#include <iprt/crc.h>
+#include <iprt/string.h>
+#include <iprt/timer.h>
+#if defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
+# include <iprt/rand.h>
+# include <iprt/path.h>
+#endif
+#include <iprt/uint128.h>
+#include <iprt/x86.h>
+
+#include <VBox/param.h>
+#include <VBox/log.h>
+#include <VBox/err.h>
+
+#if defined(RT_OS_SOLARIS) || defined(RT_OS_DARWIN)
+# include "dtrace/SUPDrv.h"
+#else
+/* ... */
+#endif
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** The frequency by which we recalculate the u32UpdateHz and
+ * u32UpdateIntervalNS GIP members. The value must be a power of 2.
+ *
+ * Warning: Bumping this too high might overflow u32UpdateIntervalNS.
+ */
+#define GIP_UPDATEHZ_RECALC_FREQ            0x800
+
+/** A reserved TSC value used for synchronization as well as measurement of
+ *  TSC deltas. */
+#define GIP_TSC_DELTA_RSVD                  UINT64_MAX
+/** The number of TSC delta measurement loops in total (includes primer and
+ *  read-time loops). */
+#define GIP_TSC_DELTA_LOOPS                 96
+/** The number of cache primer loops. */
+#define GIP_TSC_DELTA_PRIMER_LOOPS          4
+/** The number of loops until we keep computing the minumum read time. */
+#define GIP_TSC_DELTA_READ_TIME_LOOPS       24
+
+/** The TSC frequency refinement period in seconds.
+ * The timer fires after 200ms, then every second, this value just says when
+ * to stop it after that. */
+#define GIP_TSC_REFINE_PERIOD_IN_SECS       12
+/** The TSC-delta threshold for the SUPGIPUSETSCDELTA_PRACTICALLY_ZERO rating */
+#define GIP_TSC_DELTA_THRESHOLD_PRACTICALLY_ZERO    32
+/** The TSC-delta threshold for the SUPGIPUSETSCDELTA_ROUGHLY_ZERO rating */
+#define GIP_TSC_DELTA_THRESHOLD_ROUGHLY_ZERO        448
+/** The TSC delta value for the initial GIP master - 0 in regular builds.
+ * To test the delta code this can be set to a non-zero value.  */
+#if 0
+# define GIP_TSC_DELTA_INITIAL_MASTER_VALUE INT64_C(170139095182512) /* 0x00009abd9854acb0 */
+#else
+# define GIP_TSC_DELTA_INITIAL_MASTER_VALUE INT64_C(0)
+#endif
+
+AssertCompile(GIP_TSC_DELTA_PRIMER_LOOPS < GIP_TSC_DELTA_READ_TIME_LOOPS);
+AssertCompile(GIP_TSC_DELTA_PRIMER_LOOPS + GIP_TSC_DELTA_READ_TIME_LOOPS < GIP_TSC_DELTA_LOOPS);
+
+/** @def VBOX_SVN_REV
+ * The makefile should define this if it can. */
+#ifndef VBOX_SVN_REV
+# define VBOX_SVN_REV 0
+#endif
+
+#if 0 /* Don't start the GIP timers. Useful when debugging the IPRT timer code. */
+# define DO_NOT_START_GIP
+#endif
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static DECLCALLBACK(void)   supdrvGipSyncAndInvariantTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick);
+static DECLCALLBACK(void)   supdrvGipAsyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick);
+static void                 supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS, uint64_t uCpuHz);
+static void                 supdrvTscResetSamples(PSUPDRVDEVEXT pDevExt, bool fClearDeltas);
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+static int                  supdrvTscDeltaThreadInit(PSUPDRVDEVEXT pDevExt);
+static void                 supdrvTscDeltaTerm(PSUPDRVDEVEXT pDevExt);
+static void                 supdrvTscDeltaThreadStartMeasurement(PSUPDRVDEVEXT pDevExt, bool fForceAll);
+#else
+static int                  supdrvMeasureInitialTscDeltas(PSUPDRVDEVEXT pDevExt);
+static int                  supdrvMeasureTscDeltaOne(PSUPDRVDEVEXT pDevExt, uint32_t idxWorker);
+#endif
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage = NULL;
+
+
+
+/*
+ *
+ * Misc Common GIP Code
+ * Misc Common GIP Code
+ * Misc Common GIP Code
+ *
+ *
+ */
+
+
+/**
+ * Finds the GIP CPU index corresponding to @a idCpu.
+ *
+ * @returns GIP CPU array index, UINT32_MAX if not found.
+ * @param   pGip                The GIP.
+ * @param   idCpu               The CPU ID.
+ */
+static uint32_t supdrvGipFindCpuIndexForCpuId(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu)
+{
+    uint32_t i;
+    for (i = 0; i < pGip->cCpus; i++)
+        if (pGip->aCPUs[i].idCpu == idCpu)
+            return i;
+    return UINT32_MAX;
+}
+
+
+
+/*
+ *
+ * GIP Mapping and Unmapping Related Code.
+ * GIP Mapping and Unmapping Related Code.
+ * GIP Mapping and Unmapping Related Code.
+ *
+ *
+ */
+
+
+/**
+ * (Re-)initializes the per-cpu structure prior to starting or resuming the GIP
+ * updating.
+ *
+ * @param   pGip             Pointer to the GIP.
+ * @param   pGipCpu          The per CPU structure for this CPU.
+ * @param   u64NanoTS        The current time.
+ */
+static void supdrvGipReInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pGipCpu, uint64_t u64NanoTS)
+{
+    /*
+     * Here we don't really care about applying the TSC delta. The re-initialization of this
+     * value is not relevant especially while (re)starting the GIP as the first few ones will
+     * be ignored anyway, see supdrvGipDoUpdateCpu().
+     */
+    pGipCpu->u64TSC    = ASMReadTSC() - pGipCpu->u32UpdateIntervalTSC;
+    pGipCpu->u64NanoTS = u64NanoTS;
+}
+
+
+/**
+ * Set the current TSC and NanoTS value for the CPU.
+ *
+ * @param   idCpu            The CPU ID. Unused - we have to use the APIC ID.
+ * @param   pvUser1          Pointer to the ring-0 GIP mapping.
+ * @param   pvUser2          Pointer to the variable holding the current time.
+ */
+static DECLCALLBACK(void) supdrvGipReInitCpuCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PSUPGLOBALINFOPAGE  pGip = (PSUPGLOBALINFOPAGE)pvUser1;
+    unsigned            iCpu = pGip->aiCpuFromApicId[ASMGetApicId()];
+
+    if (RT_LIKELY(iCpu < pGip->cCpus && pGip->aCPUs[iCpu].idCpu == idCpu))
+        supdrvGipReInitCpu(pGip, &pGip->aCPUs[iCpu], *(uint64_t *)pvUser2);
+
+    NOREF(pvUser2);
+    NOREF(idCpu);
+}
+
+
+/**
+ * State structure for supdrvGipDetectGetGipCpuCallback.
+ */
+typedef struct SUPDRVGIPDETECTGETCPU
+{
+    /** Bitmap of APIC IDs that has been seen (initialized to zero).
+     *  Used to detect duplicate APIC IDs (paranoia). */
+    uint8_t volatile    bmApicId[256 / 8];
+    /** Mask of supported GIP CPU getter methods (SUPGIPGETCPU_XXX) (all bits set
+     *  initially). The callback clears the methods not detected. */
+    uint32_t volatile   fSupported;
+    /** The first callback detecting any kind of range issues (initialized to
+     * NIL_RTCPUID). */
+    RTCPUID volatile    idCpuProblem;
+} SUPDRVGIPDETECTGETCPU;
+/** Pointer to state structure for supdrvGipDetectGetGipCpuCallback. */
+typedef SUPDRVGIPDETECTGETCPU *PSUPDRVGIPDETECTGETCPU;
+
+
+/**
+ * Checks for alternative ways of getting the CPU ID.
+ *
+ * This also checks the APIC ID, CPU ID and CPU set index values against the
+ * GIP tables.
+ *
+ * @param   idCpu            The CPU ID. Unused - we have to use the APIC ID.
+ * @param   pvUser1          Pointer to the state structure.
+ * @param   pvUser2          Pointer to the GIP.
+ */
+static DECLCALLBACK(void) supdrvGipDetectGetGipCpuCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PSUPDRVGIPDETECTGETCPU  pState = (PSUPDRVGIPDETECTGETCPU)pvUser1;
+    PSUPGLOBALINFOPAGE      pGip   = (PSUPGLOBALINFOPAGE)pvUser2;
+    uint32_t                fSupported = 0;
+    uint16_t                idApic;
+    int                     iCpuSet;
+
+    AssertMsg(idCpu == RTMpCpuId(), ("idCpu=%#x RTMpCpuId()=%#x\n", idCpu, RTMpCpuId())); /* paranoia^3 */
+
+    /*
+     * Check that the CPU ID and CPU set index are interchangable.
+     */
+    iCpuSet = RTMpCpuIdToSetIndex(idCpu);
+    if ((RTCPUID)iCpuSet == idCpu)
+    {
+        AssertCompile(RT_IS_POWER_OF_TWO(RTCPUSET_MAX_CPUS));
+        if (   iCpuSet >= 0
+            && iCpuSet < RTCPUSET_MAX_CPUS
+            && RT_IS_POWER_OF_TWO(RTCPUSET_MAX_CPUS))
+        {
+            /*
+             * Check whether the IDTR.LIMIT contains a CPU number.
+             */
+#ifdef RT_ARCH_X86
+            uint16_t const  cbIdt = sizeof(X86DESC64SYSTEM) * 256;
+#else
+            uint16_t const  cbIdt = sizeof(X86DESCGATE)     * 256;
+#endif
+            RTIDTR          Idtr;
+            ASMGetIDTR(&Idtr);
+            if (Idtr.cbIdt >= cbIdt)
+            {
+                uint32_t uTmp = Idtr.cbIdt - cbIdt;
+                uTmp &= RTCPUSET_MAX_CPUS - 1;
+                if (uTmp == idCpu)
+                {
+                    RTIDTR Idtr2;
+                    ASMGetIDTR(&Idtr2);
+                    if (Idtr2.cbIdt == Idtr.cbIdt)
+                        fSupported |= SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS;
+                }
+            }
+
+            /*
+             * Check whether RDTSCP is an option.
+             */
+            if (ASMHasCpuId())
+            {
+                if (   ASMIsValidExtRange(ASMCpuId_EAX(UINT32_C(0x80000000)))
+                    && (ASMCpuId_EDX(UINT32_C(0x80000001)) & X86_CPUID_EXT_FEATURE_EDX_RDTSCP) )
+                {
+                    uint32_t uAux;
+                    ASMReadTscWithAux(&uAux);
+                    if ((uAux & (RTCPUSET_MAX_CPUS - 1)) == idCpu)
+                    {
+                        ASMNopPause();
+                        ASMReadTscWithAux(&uAux);
+                        if ((uAux & (RTCPUSET_MAX_CPUS - 1)) == idCpu)
+                            fSupported |= SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS;
+                    }
+                }
+            }
+        }
+    }
+
+    /*
+     * Check that the APIC ID is unique.
+     */
+    idApic = ASMGetApicId();
+    if (RT_LIKELY(   idApic < RT_ELEMENTS(pGip->aiCpuFromApicId)
+                  && !ASMAtomicBitTestAndSet(pState->bmApicId, idApic)))
+        fSupported |= SUPGIPGETCPU_APIC_ID;
+    else
+    {
+        AssertCompile(sizeof(pState->bmApicId) * 8 == RT_ELEMENTS(pGip->aiCpuFromApicId));
+        ASMAtomicCmpXchgU32(&pState->idCpuProblem, idCpu, NIL_RTCPUID);
+        LogRel(("supdrvGipDetectGetGipCpuCallback: idCpu=%#x iCpuSet=%d idApic=%#x - duplicate APIC ID.\n",
+                idCpu, iCpuSet, idApic));
+    }
+
+    /*
+     * Check that the iCpuSet is within the expected range.
+     */
+    if (RT_UNLIKELY(   iCpuSet < 0
+                    || (unsigned)iCpuSet >= RTCPUSET_MAX_CPUS
+                    || (unsigned)iCpuSet >= RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+    {
+        ASMAtomicCmpXchgU32(&pState->idCpuProblem, idCpu, NIL_RTCPUID);
+        LogRel(("supdrvGipDetectGetGipCpuCallback: idCpu=%#x iCpuSet=%d idApic=%#x - CPU set index is out of range.\n",
+                idCpu, iCpuSet, idApic));
+    }
+    else
+    {
+        RTCPUID idCpu2 = RTMpCpuIdFromSetIndex(iCpuSet);
+        if (RT_UNLIKELY(idCpu2 != idCpu))
+        {
+            ASMAtomicCmpXchgU32(&pState->idCpuProblem, idCpu, NIL_RTCPUID);
+            LogRel(("supdrvGipDetectGetGipCpuCallback: idCpu=%#x iCpuSet=%d idApic=%#x - CPU id/index roundtrip problem: %#x\n",
+                    idCpu, iCpuSet, idApic, idCpu2));
+        }
+    }
+
+    /*
+     * Update the supported feature mask before we return.
+     */
+    ASMAtomicAndU32(&pState->fSupported, fSupported);
+
+    NOREF(pvUser2);
+}
+
+
+/**
+ * Increase the timer freqency on hosts where this is possible (NT).
+ *
+ * The idea is that more interrupts is better for us... Also, it's better than
+ * we increase the timer frequence, because we might end up getting inaccurate
+ * callbacks if someone else does it.
+ *
+ * @param   pDevExt   Sets u32SystemTimerGranularityGrant if increased.
+ */
+static void supdrvGipRequestHigherTimerFrequencyFromSystem(PSUPDRVDEVEXT pDevExt)
+{
+    if (pDevExt->u32SystemTimerGranularityGrant == 0)
+    {
+        uint32_t u32SystemResolution;
+        if (   RT_SUCCESS_NP(RTTimerRequestSystemGranularity(  976563 /* 1024 HZ */, &u32SystemResolution))
+            || RT_SUCCESS_NP(RTTimerRequestSystemGranularity( 1000000 /* 1000 HZ */, &u32SystemResolution))
+            || RT_SUCCESS_NP(RTTimerRequestSystemGranularity( 1953125 /*  512 HZ */, &u32SystemResolution))
+            || RT_SUCCESS_NP(RTTimerRequestSystemGranularity( 2000000 /*  500 HZ */, &u32SystemResolution))
+           )
+        {
+            Assert(RTTimerGetSystemGranularity() <= u32SystemResolution);
+            pDevExt->u32SystemTimerGranularityGrant = u32SystemResolution;
+        }
+    }
+}
+
+
+/**
+ * Undoes supdrvGipRequestHigherTimerFrequencyFromSystem.
+ *
+ * @param   pDevExt     Clears u32SystemTimerGranularityGrant.
+ */
+static void supdrvGipReleaseHigherTimerFrequencyFromSystem(PSUPDRVDEVEXT pDevExt)
+{
+    if (pDevExt->u32SystemTimerGranularityGrant)
+    {
+        int rc2 = RTTimerReleaseSystemGranularity(pDevExt->u32SystemTimerGranularityGrant);
+        AssertRC(rc2);
+        pDevExt->u32SystemTimerGranularityGrant = 0;
+    }
+}
+
+
+/**
+ * Maps the GIP into userspace and/or get the physical address of the GIP.
+ *
+ * @returns IPRT status code.
+ * @param   pSession        Session to which the GIP mapping should belong.
+ * @param   ppGipR3         Where to store the address of the ring-3 mapping. (optional)
+ * @param   pHCPhysGip      Where to store the physical address. (optional)
+ *
+ * @remark  There is no reference counting on the mapping, so one call to this function
+ *          count globally as one reference. One call to SUPR0GipUnmap() is will unmap GIP
+ *          and remove the session as a GIP user.
+ */
+SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PRTR3PTR ppGipR3, PRTHCPHYS pHCPhysGip)
+{
+    int             rc;
+    PSUPDRVDEVEXT   pDevExt = pSession->pDevExt;
+    RTR3PTR         pGipR3  = NIL_RTR3PTR;
+    RTHCPHYS        HCPhys  = NIL_RTHCPHYS;
+    LogFlow(("SUPR0GipMap: pSession=%p ppGipR3=%p pHCPhysGip=%p\n", pSession, ppGipR3, pHCPhysGip));
+
+    /*
+     * Validate
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrNullReturn(ppGipR3, VERR_INVALID_POINTER);
+    AssertPtrNullReturn(pHCPhysGip, VERR_INVALID_POINTER);
+
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    RTSemMutexRequest(pDevExt->mtxGip, RT_INDEFINITE_WAIT);
+#else
+    RTSemFastMutexRequest(pDevExt->mtxGip);
+#endif
+    if (pDevExt->pGip)
+    {
+        /*
+         * Map it?
+         */
+        rc = VINF_SUCCESS;
+        if (ppGipR3)
+        {
+            if (pSession->GipMapObjR3 == NIL_RTR0MEMOBJ)
+                rc = RTR0MemObjMapUser(&pSession->GipMapObjR3, pDevExt->GipMemObj, (RTR3PTR)-1, 0,
+                                       RTMEM_PROT_READ, RTR0ProcHandleSelf());
+            if (RT_SUCCESS(rc))
+                pGipR3 = RTR0MemObjAddressR3(pSession->GipMapObjR3);
+        }
+
+        /*
+         * Get physical address.
+         */
+        if (pHCPhysGip && RT_SUCCESS(rc))
+            HCPhys = pDevExt->HCPhysGip;
+
+        /*
+         * Reference globally.
+         */
+        if (!pSession->fGipReferenced && RT_SUCCESS(rc))
+        {
+            pSession->fGipReferenced = 1;
+            pDevExt->cGipUsers++;
+            if (pDevExt->cGipUsers == 1)
+            {
+                PSUPGLOBALINFOPAGE pGipR0 = pDevExt->pGip;
+                uint64_t u64NanoTS;
+
+                /*
+                 * GIP starts/resumes updating again.  On windows we bump the
+                 * host timer frequency to make sure we don't get stuck in guest
+                 * mode and to get better timer (and possibly clock) accuracy.
+                 */
+                LogFlow(("SUPR0GipMap: Resumes GIP updating\n"));
+
+                supdrvGipRequestHigherTimerFrequencyFromSystem(pDevExt);
+
+                /*
+                 * document me
+                 */
+                if (pGipR0->aCPUs[0].u32TransactionId != 2 /* not the first time */)
+                {
+                    unsigned i;
+                    for (i = 0; i < pGipR0->cCpus; i++)
+                        ASMAtomicUoWriteU32(&pGipR0->aCPUs[i].u32TransactionId,
+                                            (pGipR0->aCPUs[i].u32TransactionId + GIP_UPDATEHZ_RECALC_FREQ * 2)
+                                            & ~(GIP_UPDATEHZ_RECALC_FREQ * 2 - 1));
+                    ASMAtomicWriteU64(&pGipR0->u64NanoTSLastUpdateHz, 0);
+                }
+
+                /*
+                 * document me
+                 */
+                u64NanoTS = RTTimeSystemNanoTS() - pGipR0->u32UpdateIntervalNS;
+                if (   pGipR0->u32Mode == SUPGIPMODE_INVARIANT_TSC
+                    || pGipR0->u32Mode == SUPGIPMODE_SYNC_TSC
+                    || RTMpGetOnlineCount() == 1)
+                    supdrvGipReInitCpu(pGipR0, &pGipR0->aCPUs[0], u64NanoTS);
+                else
+                    RTMpOnAll(supdrvGipReInitCpuCallback, pGipR0, &u64NanoTS);
+
+                /*
+                 * Detect alternative ways to figure the CPU ID in ring-3 and
+                 * raw-mode context.  Check the sanity of the APIC IDs, CPU IDs,
+                 * and CPU set indexes while we're at it.
+                 */
+                if (RT_SUCCESS(rc))
+                {
+                    SUPDRVGIPDETECTGETCPU DetectState;
+                    RT_BZERO((void *)&DetectState.bmApicId, sizeof(DetectState.bmApicId));
+                    DetectState.fSupported   = UINT32_MAX;
+                    DetectState.idCpuProblem = NIL_RTCPUID;
+                    rc = RTMpOnAll(supdrvGipDetectGetGipCpuCallback, &DetectState, pGipR0);
+                    if (DetectState.idCpuProblem == NIL_RTCPUID)
+                    {
+                        if (   DetectState.fSupported != UINT32_MAX
+                            && DetectState.fSupported != 0)
+                        {
+                            if (pGipR0->fGetGipCpu != DetectState.fSupported)
+                            {
+                                pGipR0->fGetGipCpu = DetectState.fSupported;
+                                LogRel(("SUPR0GipMap: fGetGipCpu=%#x\n", DetectState.fSupported));
+                            }
+                        }
+                        else
+                        {
+                            LogRel(("SUPR0GipMap: No supported ways of getting the APIC ID or CPU number in ring-3! (%#x)\n",
+                                    DetectState.fSupported));
+                            rc = VERR_UNSUPPORTED_CPU;
+                        }
+                    }
+                    else
+                    {
+                        LogRel(("SUPR0GipMap: APIC ID, CPU ID or CPU set index problem detected on CPU #%u (%#x)!\n",
+                                DetectState.idCpuProblem, DetectState.idCpuProblem));
+                        rc = VERR_INVALID_CPU_ID;
+                    }
+                }
+
+                /*
+                 * Start the GIP timer if all is well..
+                 */
+                if (RT_SUCCESS(rc))
+                {
+#ifndef DO_NOT_START_GIP
+                    rc = RTTimerStart(pDevExt->pGipTimer, 0 /* fire ASAP */); AssertRC(rc);
+#endif
+                    rc = VINF_SUCCESS;
+                }
+
+                /*
+                 * Bail out on error.
+                 */
+                if (RT_FAILURE(rc))
+                {
+                    LogRel(("SUPR0GipMap: failed rc=%Rrc\n", rc));
+                    pDevExt->cGipUsers = 0;
+                    pSession->fGipReferenced = 0;
+                    if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ)
+                    {
+                        int rc2 = RTR0MemObjFree(pSession->GipMapObjR3, false); AssertRC(rc2);
+                        if (RT_SUCCESS(rc2))
+                            pSession->GipMapObjR3 = NIL_RTR0MEMOBJ;
+                    }
+                    HCPhys = NIL_RTHCPHYS;
+                    pGipR3 = NIL_RTR3PTR;
+                }
+            }
+        }
+    }
+    else
+    {
+        rc = VERR_GENERAL_FAILURE;
+        Log(("SUPR0GipMap: GIP is not available!\n"));
+    }
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    RTSemMutexRelease(pDevExt->mtxGip);
+#else
+    RTSemFastMutexRelease(pDevExt->mtxGip);
+#endif
+
+    /*
+     * Write returns.
+     */
+    if (pHCPhysGip)
+        *pHCPhysGip = HCPhys;
+    if (ppGipR3)
+        *ppGipR3 = pGipR3;
+
+#ifdef DEBUG_DARWIN_GIP
+    OSDBGPRINT(("SUPR0GipMap: returns %d *pHCPhysGip=%lx pGipR3=%p\n", rc, (unsigned long)HCPhys, (void *)pGipR3));
+#else
+    LogFlow((   "SUPR0GipMap: returns %d *pHCPhysGip=%lx pGipR3=%p\n", rc, (unsigned long)HCPhys, (void *)pGipR3));
+#endif
+    return rc;
+}
+
+
+/**
+ * Unmaps any user mapping of the GIP and terminates all GIP access
+ * from this session.
+ *
+ * @returns IPRT status code.
+ * @param   pSession        Session to which the GIP mapping should belong.
+ */
+SUPR0DECL(int) SUPR0GipUnmap(PSUPDRVSESSION pSession)
+{
+    int                     rc = VINF_SUCCESS;
+    PSUPDRVDEVEXT           pDevExt = pSession->pDevExt;
+#ifdef DEBUG_DARWIN_GIP
+    OSDBGPRINT(("SUPR0GipUnmap: pSession=%p pGip=%p GipMapObjR3=%p\n",
+                pSession,
+                pSession->GipMapObjR3 != NIL_RTR0MEMOBJ ? RTR0MemObjAddress(pSession->GipMapObjR3) : NULL,
+                pSession->GipMapObjR3));
+#else
+    LogFlow(("SUPR0GipUnmap: pSession=%p\n", pSession));
+#endif
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    RTSemMutexRequest(pDevExt->mtxGip, RT_INDEFINITE_WAIT);
+#else
+    RTSemFastMutexRequest(pDevExt->mtxGip);
+#endif
+
+    /*
+     * Unmap anything?
+     */
+    if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ)
+    {
+        rc = RTR0MemObjFree(pSession->GipMapObjR3, false);
+        AssertRC(rc);
+        if (RT_SUCCESS(rc))
+            pSession->GipMapObjR3 = NIL_RTR0MEMOBJ;
+    }
+
+    /*
+     * Dereference global GIP.
+     */
+    if (pSession->fGipReferenced && !rc)
+    {
+        pSession->fGipReferenced = 0;
+        if (    pDevExt->cGipUsers > 0
+            &&  !--pDevExt->cGipUsers)
+        {
+            LogFlow(("SUPR0GipUnmap: Suspends GIP updating\n"));
+#ifndef DO_NOT_START_GIP
+            rc = RTTimerStop(pDevExt->pGipTimer); AssertRC(rc); rc = VINF_SUCCESS;
+#endif
+            supdrvGipReleaseHigherTimerFrequencyFromSystem(pDevExt);
+        }
+    }
+
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    RTSemMutexRelease(pDevExt->mtxGip);
+#else
+    RTSemFastMutexRelease(pDevExt->mtxGip);
+#endif
+
+    return rc;
+}
+
+
+/**
+ * Gets the GIP pointer.
+ *
+ * @returns Pointer to the GIP or NULL.
+ */
+SUPDECL(PSUPGLOBALINFOPAGE) SUPGetGIP(void)
+{
+    return g_pSUPGlobalInfoPage;
+}
+
+
+
+
+
+/*
+ *
+ *
+ * GIP Initialization, Termination and CPU Offline / Online Related Code.
+ * GIP Initialization, Termination and CPU Offline / Online Related Code.
+ * GIP Initialization, Termination and CPU Offline / Online Related Code.
+ *
+ *
+ */
+
+/**
+ * Used by supdrvInitRefineInvariantTscFreqTimer and supdrvGipInitMeasureTscFreq
+ * to update the TSC frequency related GIP variables.
+ *
+ * @param   pGip                The GIP.
+ * @param   nsElapsed           The number of nano seconds elapsed.
+ * @param   cElapsedTscTicks    The corresponding number of TSC ticks.
+ * @param   iTick               The tick number for debugging.
+ */
+static void supdrvGipInitSetCpuFreq(PSUPGLOBALINFOPAGE pGip, uint64_t nsElapsed, uint64_t cElapsedTscTicks, uint32_t iTick)
+{
+    /*
+     * Calculate the frequency.
+     */
+    uint64_t uCpuHz;
+    if (   cElapsedTscTicks < UINT64_MAX / RT_NS_1SEC
+        && nsElapsed < UINT32_MAX)
+        uCpuHz = ASMMultU64ByU32DivByU32(cElapsedTscTicks, RT_NS_1SEC, (uint32_t)nsElapsed);
+    else
+    {
+        RTUINT128U CpuHz, Tmp, Divisor;
+        CpuHz.s.Lo = CpuHz.s.Hi = 0;
+        RTUInt128MulU64ByU64(&Tmp, cElapsedTscTicks, RT_NS_1SEC_64);
+        RTUInt128Div(&CpuHz, &Tmp, RTUInt128AssignU64(&Divisor, nsElapsed));
+        uCpuHz = CpuHz.s.Lo;
+    }
+
+    /*
+     * Update the GIP.
+     */
+    ASMAtomicWriteU64(&pGip->u64CpuHz, uCpuHz);
+    if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
+    {
+        ASMAtomicWriteU64(&pGip->aCPUs[0].u64CpuHz, uCpuHz);
+
+        /* For inspecting the frequency calcs using tstGIP-2, debugger or similar. */
+        if (iTick + 1 < pGip->cCpus)
+            ASMAtomicWriteU64(&pGip->aCPUs[iTick + 1].u64CpuHz, uCpuHz);
+    }
+}
+
+
+/**
+ * Timer callback function for TSC frequency refinement in invariant GIP mode.
+ *
+ * This is started during driver init and fires once
+ * GIP_TSC_REFINE_PERIOD_IN_SECS seconds later.
+ *
+ * @param   pTimer      The timer.
+ * @param   pvUser      Opaque pointer to the device instance data.
+ * @param   iTick       The timer tick.
+ */
+static DECLCALLBACK(void) supdrvInitRefineInvariantTscFreqTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick)
+{
+    PSUPDRVDEVEXT       pDevExt = (PSUPDRVDEVEXT)pvUser;
+    PSUPGLOBALINFOPAGE  pGip = pDevExt->pGip;
+    RTCPUID             idCpu;
+    uint64_t            cNsElapsed;
+    uint64_t            cTscTicksElapsed;
+    uint64_t            nsNow;
+    uint64_t            uTsc;
+    RTCCUINTREG         fEFlags;
+
+    /* Paranoia. */
+    AssertReturnVoid(pGip);
+    AssertReturnVoid(pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC);
+
+    /*
+     * If we got a power event, stop the refinement process.
+     */
+    if (pDevExt->fInvTscRefinePowerEvent)
+    {
+        int rc = RTTimerStop(pTimer); AssertRC(rc);
+        return;
+    }
+
+    /*
+     * Read the TSC and time, noting which CPU we are on.
+     *
+     * Don't bother spinning until RTTimeSystemNanoTS changes, since on
+     * systems where it matters we're in a context where we cannot waste that
+     * much time (DPC watchdog, called from clock interrupt).
+     */
+    fEFlags = ASMIntDisableFlags();
+    uTsc    = ASMReadTSC();
+    nsNow   = RTTimeSystemNanoTS();
+    idCpu   = RTMpCpuId();
+    ASMSetFlags(fEFlags);
+
+    cNsElapsed          = nsNow - pDevExt->nsStartInvarTscRefine;
+    cTscTicksElapsed    = uTsc  - pDevExt->uTscStartInvarTscRefine;
+
+    /*
+     * If the above measurement was taken on a different CPU than the one we
+     * started the process on, cTscTicksElapsed will need to be adjusted with
+     * the TSC deltas of both the CPUs.
+     *
+     * We ASSUME that the delta calculation process takes less time than the
+     * TSC frequency refinement timer.  If it doesn't, we'll complain and
+     * drop the frequency refinement.
+     *
+     * Note! We cannot entirely trust enmUseTscDelta here because it's
+     *       downgraded after each delta calculation.
+     */
+    if (   idCpu != pDevExt->idCpuInvarTscRefine
+        && pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED)
+    {
+        uint32_t iStartCpuSet   = RTMpCpuIdToSetIndex(pDevExt->idCpuInvarTscRefine);
+        uint32_t iStopCpuSet    = RTMpCpuIdToSetIndex(idCpu);
+        uint16_t iStartGipCpu   = iStartCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)
+                                ? pGip->aiCpuFromCpuSetIdx[iStartCpuSet] : UINT16_MAX;
+        uint16_t iStopGipCpu    = iStopCpuSet  < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)
+                                ? pGip->aiCpuFromCpuSetIdx[iStopCpuSet]  : UINT16_MAX;
+        int64_t  iStartTscDelta = iStartGipCpu < pGip->cCpus ? pGip->aCPUs[iStartGipCpu].i64TSCDelta : INT64_MAX;
+        int64_t  iStopTscDelta  = iStopGipCpu  < pGip->cCpus ? pGip->aCPUs[iStopGipCpu].i64TSCDelta  : INT64_MAX;
+        if (RT_LIKELY(iStartTscDelta != INT64_MAX && iStopTscDelta != INT64_MAX))
+        {
+            if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_PRACTICALLY_ZERO)
+            {
+                /* cTscTicksElapsed = (uTsc - iStopTscDelta) - (pDevExt->uTscStartInvarTscRefine - iStartTscDelta); */
+                cTscTicksElapsed += iStartTscDelta - iStopTscDelta;
+            }
+        }
+        /*
+         * Allow 5 times the refinement period to elapse before we give up on the TSC delta
+         * calculations.
+         */
+        else if (cNsElapsed > GIP_TSC_REFINE_PERIOD_IN_SECS * 5 * RT_NS_1SEC_64)
+        {
+            SUPR0Printf("vboxdrv: Failed to refine invariant TSC frequency because deltas are unavailable after %u (%u) seconds\n",
+                        (uint32_t)(cNsElapsed / RT_NS_1SEC), GIP_TSC_REFINE_PERIOD_IN_SECS);
+            SUPR0Printf("vboxdrv: start: %u, %u, %#llx  stop: %u, %u, %#llx\n",
+                        iStartCpuSet, iStartGipCpu, iStartTscDelta, iStopCpuSet, iStopGipCpu, iStopTscDelta);
+            int rc = RTTimerStop(pTimer); AssertRC(rc);
+            return;
+        }
+    }
+
+    /*
+     * Calculate and update the CPU frequency variables in GIP.
+     *
+     * If there is a GIP user already and we've already refined the frequency
+     * a couple of times, don't update it as we want a stable frequency value
+     * for all VMs.
+     */
+    if (   pDevExt->cGipUsers == 0
+        || cNsElapsed < RT_NS_1SEC * 2)
+    {
+        supdrvGipInitSetCpuFreq(pGip, cNsElapsed, cTscTicksElapsed, (uint32_t)iTick);
+
+        /*
+         * Stop the timer once we've reached the defined refinement period.
+         */
+        if (cNsElapsed > GIP_TSC_REFINE_PERIOD_IN_SECS * RT_NS_1SEC_64)
+        {
+            int rc = RTTimerStop(pTimer);
+            AssertRC(rc);
+        }
+    }
+    else
+    {
+        int rc = RTTimerStop(pTimer);
+        AssertRC(rc);
+    }
+}
+
+
+/**
+ * @callback_method_impl{FNRTPOWERNOTIFICATION}
+ */
+static DECLCALLBACK(void) supdrvGipPowerNotificationCallback(RTPOWEREVENT enmEvent, void *pvUser)
+{
+    PSUPDRVDEVEXT      pDevExt = (PSUPDRVDEVEXT)pvUser;
+    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+
+    /*
+     * If the TSC frequency refinement timer is running, we need to cancel it so it
+     * doesn't screw up the frequency after a long suspend.
+     *
+     * Recalculate all TSC-deltas on host resume as it may have changed, seen
+     * on Windows 7 running on the Dell Optiplex Intel Core i5-3570.
+     */
+    if (enmEvent == RTPOWEREVENT_RESUME)
+    {
+        ASMAtomicWriteBool(&pDevExt->fInvTscRefinePowerEvent, true);
+        if (   RT_LIKELY(pGip)
+            && pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED
+            && !supdrvOSAreCpusOfflinedOnSuspend())
+        {
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+            supdrvTscDeltaThreadStartMeasurement(pDevExt, true /* fForceAll */);
+#else
+            RTCpuSetCopy(&pDevExt->TscDeltaCpuSet, &pGip->OnlineCpuSet);
+            supdrvMeasureInitialTscDeltas(pDevExt);
+#endif
+        }
+    }
+    else if (enmEvent == RTPOWEREVENT_SUSPEND)
+        ASMAtomicWriteBool(&pDevExt->fInvTscRefinePowerEvent, true);
+}
+
+
+/**
+ * Start the TSC-frequency refinment timer for the invariant TSC GIP mode.
+ *
+ * We cannot use this in the synchronous and asynchronous tsc GIP modes because
+ * the CPU may change the TSC frequence between now and when the timer fires
+ * (supdrvInitAsyncRefineTscTimer).
+ *
+ * @param   pDevExt         Pointer to the device instance data.
+ * @param   pGip            Pointer to the GIP.
+ */
+static void supdrvGipInitStartTimerForRefiningInvariantTscFreq(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip)
+{
+    uint64_t    u64NanoTS;
+    RTCCUINTREG fEFlags;
+    int         rc;
+
+    /*
+     * Register a power management callback.
+     */
+    pDevExt->fInvTscRefinePowerEvent = false;
+    rc = RTPowerNotificationRegister(supdrvGipPowerNotificationCallback, pDevExt);
+    AssertRC(rc); /* ignore */
+
+    /*
+     * Record the TSC and NanoTS as the starting anchor point for refinement
+     * of the TSC.  We try get as close to a clock tick as possible on systems
+     * which does not provide high resolution time.
+     */
+    u64NanoTS = RTTimeSystemNanoTS();
+    while (RTTimeSystemNanoTS() == u64NanoTS)
+        ASMNopPause();
+
+    fEFlags = ASMIntDisableFlags();
+    pDevExt->uTscStartInvarTscRefine = ASMReadTSC();
+    pDevExt->nsStartInvarTscRefine   = RTTimeSystemNanoTS();
+    pDevExt->idCpuInvarTscRefine     = RTMpCpuId();
+    ASMSetFlags(fEFlags);
+
+    /*
+     * Create a timer that runs on the same CPU so we won't have a depencency
+     * on the TSC-delta and can run in parallel to it. On systems that does not
+     * implement CPU specific timers we'll apply deltas in the timer callback,
+     * just like we do for CPUs going offline.
+     *
+     * The longer the refinement interval the better the accuracy, at least in
+     * theory.  If it's too long though, ring-3 may already be starting its
+     * first VMs before we're done.  On most systems we will be loading the
+     * support driver during boot and VMs won't be started for a while yet,
+     * it is really only a problem during development (especially with
+     * on-demand driver starting on windows).
+     *
+     * To avoid wasting time doing a long supdrvGipInitMeasureTscFreq() call
+     * to calculate the frequency during driver loading, the timer is set
+     * to fire after 200 ms the first time. It will then reschedule itself
+     * to fire every second until GIP_TSC_REFINE_PERIOD_IN_SECS has been
+     * reached or it notices that there is a user land client with GIP
+     * mapped (we want a stable frequency for all VMs).
+     */
+    rc = RTTimerCreateEx(&pDevExt->pInvarTscRefineTimer, RT_NS_1SEC,
+                         RTTIMER_FLAGS_CPU(RTMpCpuIdToSetIndex(pDevExt->idCpuInvarTscRefine)),
+                         supdrvInitRefineInvariantTscFreqTimer, pDevExt);
+    if (RT_SUCCESS(rc))
+    {
+        rc = RTTimerStart(pDevExt->pInvarTscRefineTimer, 2*RT_NS_100MS);
+        if (RT_SUCCESS(rc))
+            return;
+        RTTimerDestroy(pDevExt->pInvarTscRefineTimer);
+    }
+
+    if (rc == VERR_CPU_OFFLINE || rc == VERR_NOT_SUPPORTED)
+    {
+        rc = RTTimerCreateEx(&pDevExt->pInvarTscRefineTimer, RT_NS_1SEC, RTTIMER_FLAGS_CPU_ANY,
+                             supdrvInitRefineInvariantTscFreqTimer, pDevExt);
+        if (RT_SUCCESS(rc))
+        {
+            rc = RTTimerStart(pDevExt->pInvarTscRefineTimer, 2*RT_NS_100MS);
+            if (RT_SUCCESS(rc))
+                return;
+            RTTimerDestroy(pDevExt->pInvarTscRefineTimer);
+        }
+    }
+
+    pDevExt->pInvarTscRefineTimer = NULL;
+    OSDBGPRINT(("vboxdrv: Failed to create or start TSC frequency refinement timer: rc=%Rrc\n", rc));
+}
+
+
+/**
+ * @callback_method_impl{PFNRTMPWORKER,
+ *      RTMpOnSpecific callback for reading TSC and time on the CPU we started
+ *      the measurements on.}
+ */
+DECLCALLBACK(void) supdrvGipInitReadTscAndNanoTsOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    RTCCUINTREG fEFlags   = ASMIntDisableFlags();
+    uint64_t   *puTscStop = (uint64_t *)pvUser1;
+    uint64_t   *pnsStop   = (uint64_t *)pvUser2;
+
+    *puTscStop = ASMReadTSC();
+    *pnsStop   = RTTimeSystemNanoTS();
+
+    ASMSetFlags(fEFlags);
+}
+
+
+/**
+ * Measures the TSC frequency of the system.
+ *
+ * The TSC frequency can vary on systems which are not reported as invariant.
+ * On such systems the object of this function is to find out what the nominal,
+ * maximum TSC frequency under 'normal' CPU operation.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         Pointer to the device instance.
+ * @param   pGip            Pointer to the GIP.
+ * @param   fRough          Set if we're doing the rough calculation that the
+ *                          TSC measuring code needs, where accuracy isn't all
+ *                          that important (too high is better than to low).
+ *                          When clear we try for best accuracy that we can
+ *                          achieve in reasonably short time.
+ */
+static int supdrvGipInitMeasureTscFreq(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, bool fRough)
+{
+    uint32_t nsTimerIncr = RTTimerGetSystemGranularity();
+    int      cTriesLeft = fRough ? 4 : 2;
+    while (cTriesLeft-- > 0)
+    {
+        RTCCUINTREG fEFlags;
+        uint64_t    nsStart;
+        uint64_t    nsStop;
+        uint64_t    uTscStart;
+        uint64_t    uTscStop;
+        RTCPUID     idCpuStart;
+        RTCPUID     idCpuStop;
+
+        /*
+         * Synchronize with the host OS clock tick on systems without high
+         * resolution time API (older Windows version for example).
+         */
+        nsStart = RTTimeSystemNanoTS();
+        while (RTTimeSystemNanoTS() == nsStart)
+            ASMNopPause();
+
+        /*
+         * Read the TSC and current time, noting which CPU we're on.
+         */
+        fEFlags = ASMIntDisableFlags();
+        uTscStart   = ASMReadTSC();
+        nsStart     = RTTimeSystemNanoTS();
+        idCpuStart  = RTMpCpuId();
+        ASMSetFlags(fEFlags);
+
+        /*
+         * Delay for a while.
+         */
+        if (pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC)
+        {
+            /*
+             * Sleep-wait since the TSC frequency is constant, it eases host load.
+             * Shorter interval produces more variance in the frequency (esp. Windows).
+             */
+            uint64_t msElapsed = 0;
+            uint64_t msDelay =   ( ((fRough ? 16 : 200) * RT_NS_1MS + nsTimerIncr - 1) / nsTimerIncr * nsTimerIncr - RT_NS_100US )
+                               / RT_NS_1MS;
+            do
+            {
+                RTThreadSleep((RTMSINTERVAL)(msDelay - msElapsed));
+                nsStop    = RTTimeSystemNanoTS();
+                msElapsed = (nsStop - nsStart) / RT_NS_1MS;
+            } while (msElapsed < msDelay);
+
+            while (RTTimeSystemNanoTS() == nsStop)
+                ASMNopPause();
+        }
+        else
+        {
+            /*
+             * Busy-wait keeping the frequency up.
+             */
+            do
+            {
+                ASMNopPause();
+                nsStop = RTTimeSystemNanoTS();
+            } while (nsStop - nsStart < RT_NS_100MS);
+        }
+
+        /*
+         * Read the TSC and time again.
+         */
+        fEFlags = ASMIntDisableFlags();
+        uTscStop    = ASMReadTSC();
+        nsStop      = RTTimeSystemNanoTS();
+        idCpuStop   = RTMpCpuId();
+        ASMSetFlags(fEFlags);
+
+        /*
+         * If the CPU changes things get a bit complicated and what we
+         * can get away with depends on the GIP mode / TSC reliablity.
+         */
+        if (idCpuStop != idCpuStart)
+        {
+            bool fDoXCall = false;
+
+            /*
+             * Synchronous TSC mode: we're probably fine as it's unlikely
+             * that we were rescheduled because of TSC throttling or power
+             * management reasons, so just go ahead.
+             */
+            if (pGip->u32Mode == SUPGIPMODE_SYNC_TSC)
+            {
+                /* Probably ok, maybe we should retry once?. */
+                Assert(pGip->enmUseTscDelta == SUPGIPUSETSCDELTA_NOT_APPLICABLE);
+            }
+            /*
+             * If we're just doing the rough measurement, do the cross call and
+             * get on with things (we don't have deltas!).
+             */
+            else if (fRough)
+                fDoXCall = true;
+            /*
+             * Invariant TSC mode: It doesn't matter if we have delta available
+             * for both CPUs.  That is not something we can assume at this point.
+             *
+             * Note! We cannot necessarily trust enmUseTscDelta here because it's
+             *       downgraded after each delta calculation and the delta
+             *       calculations may not be complete yet.
+             */
+            else if (pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC)
+            {
+/** @todo This section of code is never reached atm, consider dropping it later on... */
+                if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED)
+                {
+                    uint32_t iStartCpuSet   = RTMpCpuIdToSetIndex(idCpuStart);
+                    uint32_t iStopCpuSet    = RTMpCpuIdToSetIndex(idCpuStop);
+                    uint16_t iStartGipCpu   = iStartCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)
+                                            ? pGip->aiCpuFromCpuSetIdx[iStartCpuSet] : UINT16_MAX;
+                    uint16_t iStopGipCpu    = iStopCpuSet  < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)
+                                            ? pGip->aiCpuFromCpuSetIdx[iStopCpuSet]  : UINT16_MAX;
+                    int64_t  iStartTscDelta = iStartGipCpu < pGip->cCpus ? pGip->aCPUs[iStartGipCpu].i64TSCDelta : INT64_MAX;
+                    int64_t  iStopTscDelta  = iStopGipCpu  < pGip->cCpus ? pGip->aCPUs[iStopGipCpu].i64TSCDelta  : INT64_MAX;
+                    if (RT_LIKELY(iStartTscDelta != INT64_MAX && iStopTscDelta != INT64_MAX))
+                    {
+                        if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_PRACTICALLY_ZERO)
+                        {
+                            uTscStart -= iStartTscDelta;
+                            uTscStop  -= iStopTscDelta;
+                        }
+                    }
+                    /*
+                     * Invalid CPU indexes are not caused by online/offline races, so
+                     * we have to trigger driver load failure if that happens as GIP
+                     * and IPRT assumptions are busted on this system.
+                     */
+                    else if (iStopGipCpu >= pGip->cCpus || iStartGipCpu >= pGip->cCpus)
+                    {
+                        SUPR0Printf("vboxdrv: Unexpected CPU index in supdrvGipInitMeasureTscFreq.\n");
+                        SUPR0Printf("vboxdrv: start: %u, %u, %#llx  stop: %u, %u, %#llx\n",
+                                    iStartCpuSet, iStartGipCpu, iStartTscDelta, iStopCpuSet, iStopGipCpu, iStopTscDelta);
+                        return VERR_INVALID_CPU_INDEX;
+                    }
+                    /*
+                     * No valid deltas.  We retry, if we're on our last retry
+                     * we do the cross call instead just to get a result.  The
+                     * frequency will be refined in a few seconds anyways.
+                     */
+                    else if (cTriesLeft > 0)
+                        continue;
+                    else
+                        fDoXCall = true;
+                }
+            }
+            /*
+             * Asynchronous TSC mode: This is bad as the reason we usually
+             * use this mode is to deal with variable TSC frequencies and
+             * deltas.  So, we need to get the TSC from the same CPU as
+             * started it, we also need to keep that CPU busy.  So, retry
+             * and fall back to the cross call on the last attempt.
+             */
+            else
+            {
+                Assert(pGip->u32Mode == SUPGIPMODE_ASYNC_TSC);
+                if (cTriesLeft > 0)
+                    continue;
+                fDoXCall = true;
+            }
+
+            if (fDoXCall)
+            {
+                /*
+                 * Try read the TSC and timestamp on the start CPU.
+                 */
+                int rc = RTMpOnSpecific(idCpuStart, supdrvGipInitReadTscAndNanoTsOnCpu, &uTscStop, &nsStop);
+                if (RT_FAILURE(rc) && (!fRough || cTriesLeft > 0))
+                    continue;
+            }
+        }
+
+        /*
+         * Calculate the TSC frequency and update it (shared with the refinement timer).
+         */
+        supdrvGipInitSetCpuFreq(pGip, nsStop - nsStart, uTscStop - uTscStart, 0);
+        return VINF_SUCCESS;
+    }
+
+    Assert(!fRough);
+    return VERR_SUPDRV_TSC_FREQ_MEASUREMENT_FAILED;
+}
+
+
+/**
+ * Finds our (@a idCpu) entry, or allocates a new one if not found.
+ *
+ * @returns Index of the CPU in the cache set.
+ * @param   pGip                The GIP.
+ * @param   idCpu               The CPU ID.
+ */
+static uint32_t supdrvGipFindOrAllocCpuIndexForCpuId(PSUPGLOBALINFOPAGE pGip, RTCPUID idCpu)
+{
+    uint32_t i, cTries;
+
+    /*
+     * ASSUMES that CPU IDs are constant.
+     */
+    for (i = 0; i < pGip->cCpus; i++)
+        if (pGip->aCPUs[i].idCpu == idCpu)
+            return i;
+
+    cTries = 0;
+    do
+    {
+        for (i = 0; i < pGip->cCpus; i++)
+        {
+            bool fRc;
+            ASMAtomicCmpXchgSize(&pGip->aCPUs[i].idCpu, idCpu, NIL_RTCPUID, fRc);
+            if (fRc)
+                return i;
+        }
+    } while (cTries++ < 32);
+    AssertReleaseFailed();
+    return i - 1;
+}
+
+
+/**
+ * The calling CPU should be accounted as online, update GIP accordingly.
+ *
+ * This is used by supdrvGipCreate() as well as supdrvGipMpEvent().
+ *
+ * @param   pDevExt             The device extension.
+ * @param   idCpu               The CPU ID.
+ */
+static void supdrvGipMpEventOnlineOrInitOnCpu(PSUPDRVDEVEXT pDevExt, RTCPUID idCpu)
+{
+    int         iCpuSet = 0;
+    uint16_t    idApic = UINT16_MAX;
+    uint32_t    i = 0;
+    uint64_t    u64NanoTS = 0;
+    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+
+    AssertPtrReturnVoid(pGip);
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    AssertRelease(idCpu == RTMpCpuId());
+    Assert(pGip->cPossibleCpus == RTMpGetCount());
+
+    /*
+     * Do this behind a spinlock with interrupts disabled as this can fire
+     * on all CPUs simultaneously, see @bugref{6110}.
+     */
+    RTSpinlockAcquire(pDevExt->hGipSpinlock);
+
+    /*
+     * Update the globals.
+     */
+    ASMAtomicWriteU16(&pGip->cPresentCpus,  RTMpGetPresentCount());
+    ASMAtomicWriteU16(&pGip->cOnlineCpus,   RTMpGetOnlineCount());
+    iCpuSet = RTMpCpuIdToSetIndex(idCpu);
+    if (iCpuSet >= 0)
+    {
+        Assert(RTCpuSetIsMemberByIndex(&pGip->PossibleCpuSet, iCpuSet));
+        RTCpuSetAddByIndex(&pGip->OnlineCpuSet, iCpuSet);
+        RTCpuSetAddByIndex(&pGip->PresentCpuSet, iCpuSet);
+    }
+
+    /*
+     * Update the entry.
+     */
+    u64NanoTS = RTTimeSystemNanoTS() - pGip->u32UpdateIntervalNS;
+    i = supdrvGipFindOrAllocCpuIndexForCpuId(pGip, idCpu);
+
+    supdrvGipInitCpu(pGip, &pGip->aCPUs[i], u64NanoTS, pGip->u64CpuHz);
+
+    idApic = ASMGetApicId();
+    ASMAtomicWriteU16(&pGip->aCPUs[i].idApic,  idApic);
+    ASMAtomicWriteS16(&pGip->aCPUs[i].iCpuSet, (int16_t)iCpuSet);
+    ASMAtomicWriteSize(&pGip->aCPUs[i].idCpu,  idCpu);
+
+    /*
+     * Update the APIC ID and CPU set index mappings.
+     */
+    ASMAtomicWriteU16(&pGip->aiCpuFromApicId[idApic],     i);
+    ASMAtomicWriteU16(&pGip->aiCpuFromCpuSetIdx[iCpuSet], i);
+
+    /* Add this CPU to this set of CPUs we need to calculate the TSC-delta for. */
+    RTCpuSetAddByIndex(&pDevExt->TscDeltaCpuSet, RTMpCpuIdToSetIndex(idCpu));
+
+    /* Update the Mp online/offline counter. */
+    ASMAtomicIncU32(&pDevExt->cMpOnOffEvents);
+
+    /* Commit it. */
+    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_ONLINE);
+
+    RTSpinlockRelease(pDevExt->hGipSpinlock);
+}
+
+
+/**
+ * RTMpOnSpecific callback wrapper for supdrvGipMpEventOnlineOrInitOnCpu().
+ *
+ * @param   idCpu     The CPU ID we are running on.
+ * @param   pvUser1    Opaque pointer to the device instance data.
+ * @param   pvUser2    Not used.
+ */
+static DECLCALLBACK(void) supdrvGipMpEventOnlineCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PSUPDRVDEVEXT pDevExt = (PSUPDRVDEVEXT)pvUser1;
+    NOREF(pvUser2);
+    supdrvGipMpEventOnlineOrInitOnCpu(pDevExt, idCpu);
+}
+
+
+/**
+ * The CPU should be accounted as offline, update the GIP accordingly.
+ *
+ * This is used by supdrvGipMpEvent.
+ *
+ * @param   pDevExt             The device extension.
+ * @param   idCpu               The CPU ID.
+ */
+static void supdrvGipMpEventOffline(PSUPDRVDEVEXT pDevExt, RTCPUID idCpu)
+{
+    PSUPGLOBALINFOPAGE  pGip = pDevExt->pGip;
+    int                 iCpuSet;
+    unsigned            i;
+
+    AssertPtrReturnVoid(pGip);
+    RTSpinlockAcquire(pDevExt->hGipSpinlock);
+
+    iCpuSet = RTMpCpuIdToSetIndex(idCpu);
+    AssertReturnVoid(iCpuSet >= 0);
+
+    i = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    AssertReturnVoid(i < pGip->cCpus);
+    AssertReturnVoid(pGip->aCPUs[i].idCpu == idCpu);
+
+    Assert(RTCpuSetIsMemberByIndex(&pGip->PossibleCpuSet, iCpuSet));
+    RTCpuSetDelByIndex(&pGip->OnlineCpuSet, iCpuSet);
+
+    /* Update the Mp online/offline counter. */
+    ASMAtomicIncU32(&pDevExt->cMpOnOffEvents);
+
+    if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED)
+    {
+        /* Reset the TSC delta, we will recalculate it lazily. */
+        ASMAtomicWriteS64(&pGip->aCPUs[i].i64TSCDelta, INT64_MAX);
+        /* Remove this CPU from the set of CPUs that we have obtained the TSC deltas. */
+        RTCpuSetDelByIndex(&pDevExt->TscDeltaObtainedCpuSet, iCpuSet);
+    }
+
+    /* Commit it. */
+    ASMAtomicWriteSize(&pGip->aCPUs[i].enmState, SUPGIPCPUSTATE_OFFLINE);
+
+    RTSpinlockRelease(pDevExt->hGipSpinlock);
+}
+
+
+/**
+ * Multiprocessor event notification callback.
+ *
+ * This is used to make sure that the GIP master gets passed on to
+ * another CPU.  It also updates the associated CPU data.
+ *
+ * @param   enmEvent    The event.
+ * @param   idCpu       The cpu it applies to.
+ * @param   pvUser      Pointer to the device extension.
+ */
+static DECLCALLBACK(void) supdrvGipMpEvent(RTMPEVENT enmEvent, RTCPUID idCpu, void *pvUser)
+{
+    PSUPDRVDEVEXT       pDevExt = (PSUPDRVDEVEXT)pvUser;
+    PSUPGLOBALINFOPAGE  pGip    = pDevExt->pGip;
+
+    if (pGip)
+    {
+        RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+        switch (enmEvent)
+        {
+            case RTMPEVENT_ONLINE:
+            {
+                RTThreadPreemptDisable(&PreemptState);
+                if (idCpu == RTMpCpuId())
+                {
+                    supdrvGipMpEventOnlineOrInitOnCpu(pDevExt, idCpu);
+                    RTThreadPreemptRestore(&PreemptState);
+                }
+                else
+                {
+                    RTThreadPreemptRestore(&PreemptState);
+                    RTMpOnSpecific(idCpu, supdrvGipMpEventOnlineCallback, pDevExt, NULL /* pvUser2 */);
+                }
+
+                /*
+                 * Recompute TSC-delta for the newly online'd CPU.
+                 */
+                if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED)
+                {
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+                    supdrvTscDeltaThreadStartMeasurement(pDevExt, false /* fForceAll */);
+#else
+                    uint32_t iCpu = supdrvGipFindOrAllocCpuIndexForCpuId(pGip, idCpu);
+                    supdrvMeasureTscDeltaOne(pDevExt, iCpu);
+#endif
+                }
+                break;
+            }
+
+            case RTMPEVENT_OFFLINE:
+                supdrvGipMpEventOffline(pDevExt, idCpu);
+                break;
+        }
+    }
+
+    /*
+     * Make sure there is a master GIP.
+     */
+    if (enmEvent == RTMPEVENT_OFFLINE)
+    {
+        RTCPUID idGipMaster = ASMAtomicReadU32(&pDevExt->idGipMaster);
+        if (idGipMaster == idCpu)
+        {
+            /*
+             * The GIP master is going offline, find a new one.
+             */
+            bool        fIgnored;
+            unsigned    i;
+            RTCPUID     idNewGipMaster = NIL_RTCPUID;
+            RTCPUSET    OnlineCpus;
+            RTMpGetOnlineSet(&OnlineCpus);
+
+            for (i = 0; i < RTCPUSET_MAX_CPUS; i++)
+                if (RTCpuSetIsMemberByIndex(&OnlineCpus, i))
+                {
+                    RTCPUID idCurCpu = RTMpCpuIdFromSetIndex(i);
+                    if (idCurCpu != idGipMaster)
+                    {
+                        idNewGipMaster = idCurCpu;
+                        break;
+                    }
+                }
+
+            Log(("supdrvGipMpEvent: Gip master %#lx -> %#lx\n", (long)idGipMaster, (long)idNewGipMaster));
+            ASMAtomicCmpXchgSize(&pDevExt->idGipMaster, idNewGipMaster, idGipMaster, fIgnored);
+            NOREF(fIgnored);
+        }
+    }
+}
+
+
+/**
+ * On CPU initialization callback for RTMpOnAll.
+ *
+ * @param   idCpu               The CPU ID.
+ * @param   pvUser1             The device extension.
+ * @param   pvUser2             The GIP.
+ */
+static DECLCALLBACK(void) supdrvGipInitOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    /* This is good enough, even though it will update some of the globals a
+       bit to much. */
+    supdrvGipMpEventOnlineOrInitOnCpu((PSUPDRVDEVEXT)pvUser1, idCpu);
+}
+
+
+/**
+ * Callback used by supdrvDetermineAsyncTSC to read the TSC on a CPU.
+ *
+ * @param   idCpu       Ignored.
+ * @param   pvUser1     Where to put the TSC.
+ * @param   pvUser2     Ignored.
+ */
+static DECLCALLBACK(void) supdrvGipInitDetermineAsyncTscWorker(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    Assert(RTMpCpuIdToSetIndex(idCpu) == (intptr_t)pvUser2);
+    ASMAtomicWriteU64((uint64_t volatile *)pvUser1, ASMReadTSC());
+}
+
+
+/**
+ * Determine if Async GIP mode is required because of TSC drift.
+ *
+ * When using the default/normal timer code it is essential that the time stamp counter
+ * (TSC) runs never backwards, that is, a read operation to the counter should return
+ * a bigger value than any previous read operation. This is guaranteed by the latest
+ * AMD CPUs and by newer Intel CPUs which never enter the C2 state (P4). In any other
+ * case we have to choose the asynchronous timer mode.
+ *
+ * @param   poffMin     Pointer to the determined difference between different
+ *                      cores (optional, can be NULL).
+ * @return  false if the time stamp counters appear to be synchronized, true otherwise.
+ */
+static bool supdrvGipInitDetermineAsyncTsc(uint64_t *poffMin)
+{
+    /*
+     * Just iterate all the cpus 8 times and make sure that the TSC is
+     * ever increasing. We don't bother taking TSC rollover into account.
+     */
+    int         iEndCpu = RTMpGetArraySize();
+    int         iCpu;
+    int         cLoops = 8;
+    bool        fAsync = false;
+    int         rc = VINF_SUCCESS;
+    uint64_t    offMax = 0;
+    uint64_t    offMin = ~(uint64_t)0;
+    uint64_t    PrevTsc = ASMReadTSC();
+
+    while (cLoops-- > 0)
+    {
+        for (iCpu = 0; iCpu < iEndCpu; iCpu++)
+        {
+            uint64_t CurTsc;
+            rc = RTMpOnSpecific(RTMpCpuIdFromSetIndex(iCpu), supdrvGipInitDetermineAsyncTscWorker,
+                                &CurTsc, (void *)(uintptr_t)iCpu);
+            if (RT_SUCCESS(rc))
+            {
+                if (CurTsc <= PrevTsc)
+                {
+                    fAsync = true;
+                    offMin = offMax = PrevTsc - CurTsc;
+                    Log(("supdrvGipInitDetermineAsyncTsc: iCpu=%d cLoops=%d CurTsc=%llx PrevTsc=%llx\n",
+                         iCpu, cLoops, CurTsc, PrevTsc));
+                    break;
+                }
+
+                /* Gather statistics (except the first time). */
+                if (iCpu != 0 || cLoops != 7)
+                {
+                    uint64_t off = CurTsc - PrevTsc;
+                    if (off < offMin)
+                        offMin = off;
+                    if (off > offMax)
+                        offMax = off;
+                    Log2(("%d/%d: off=%llx\n", cLoops, iCpu, off));
+                }
+
+                /* Next */
+                PrevTsc = CurTsc;
+            }
+            else if (rc == VERR_NOT_SUPPORTED)
+                break;
+            else
+                AssertMsg(rc == VERR_CPU_NOT_FOUND || rc == VERR_CPU_OFFLINE, ("%d\n", rc));
+        }
+
+        /* broke out of the loop. */
+        if (iCpu < iEndCpu)
+            break;
+    }
+
+    if (poffMin)
+        *poffMin = offMin; /* Almost RTMpOnSpecific profiling. */
+    Log(("supdrvGipInitDetermineAsyncTsc: returns %d; iEndCpu=%d rc=%d offMin=%llx offMax=%llx\n",
+         fAsync, iEndCpu, rc, offMin, offMax));
+#if !defined(RT_OS_SOLARIS) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS)
+    OSDBGPRINT(("vboxdrv: fAsync=%d offMin=%#lx offMax=%#lx\n", fAsync, (long)offMin, (long)offMax));
+#endif
+    return fAsync;
+}
+
+
+/**
+ * supdrvGipInit() worker that determines the GIP TSC mode.
+ *
+ * @returns The most suitable TSC mode.
+ * @param   pDevExt     Pointer to the device instance data.
+ */
+static SUPGIPMODE supdrvGipInitDetermineTscMode(PSUPDRVDEVEXT pDevExt)
+{
+    uint64_t u64DiffCoresIgnored;
+    uint32_t uEAX, uEBX, uECX, uEDX;
+
+    /*
+     * Establish whether the CPU advertises TSC as invariant, we need that in
+     * a couple of places below.
+     */
+    bool fInvariantTsc = false;
+    if (ASMHasCpuId())
+    {
+        uEAX = ASMCpuId_EAX(0x80000000);
+        if (ASMIsValidExtRange(uEAX) && uEAX >= 0x80000007)
+        {
+            uEDX = ASMCpuId_EDX(0x80000007);
+            if (uEDX & X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR)
+                fInvariantTsc = true;
+        }
+    }
+
+    /*
+     * On single CPU systems, we don't need to consider ASYNC mode.
+     */
+    if (RTMpGetCount() <= 1)
+        return fInvariantTsc ? SUPGIPMODE_INVARIANT_TSC : SUPGIPMODE_SYNC_TSC;
+
+    /*
+     * Allow the user and/or OS specific bits to force async mode.
+     */
+    if (supdrvOSGetForcedAsyncTscMode(pDevExt))
+        return SUPGIPMODE_ASYNC_TSC;
+
+    /*
+     * Use invariant mode if the CPU says TSC is invariant.
+     */
+    if (fInvariantTsc)
+        return SUPGIPMODE_INVARIANT_TSC;
+
+    /*
+     * TSC is not invariant and we're on SMP, this presents two problems:
+     *
+     *      (1) There might be a skew between the CPU, so that cpu0
+     *          returns a TSC that is slightly different from cpu1.
+     *          This screw may be due to (2), bad TSC initialization
+     *          or slightly different TSC rates.
+     *
+     *      (2) Power management (and other things) may cause the TSC
+     *          to run at a non-constant speed, and cause the speed
+     *          to be different on the cpus. This will result in (1).
+     *
+     * If any of the above is detected, we will have to use ASYNC mode.
+     */
+    /* (1). Try check for current differences between the cpus. */
+    if (supdrvGipInitDetermineAsyncTsc(&u64DiffCoresIgnored))
+        return SUPGIPMODE_ASYNC_TSC;
+
+    /* (2) If it's an AMD CPU with power management, we won't trust its TSC. */
+    ASMCpuId(0, &uEAX, &uEBX, &uECX, &uEDX);
+    if (   ASMIsValidStdRange(uEAX)
+        && ASMIsAmdCpuEx(uEBX, uECX, uEDX))
+    {
+        /* Check for APM support. */
+        uEAX = ASMCpuId_EAX(0x80000000);
+        if (ASMIsValidExtRange(uEAX) && uEAX >= 0x80000007)
+        {
+            uEDX = ASMCpuId_EDX(0x80000007);
+            if (uEDX & 0x3e)  /* STC|TM|THERMTRIP|VID|FID. Ignore TS. */
+                return SUPGIPMODE_ASYNC_TSC;
+        }
+    }
+
+    return SUPGIPMODE_SYNC_TSC;
+}
+
+
+/**
+ * Initializes per-CPU GIP information.
+ *
+ * @param   pGip        Pointer to the GIP.
+ * @param   pCpu        Pointer to which GIP CPU to initalize.
+ * @param   u64NanoTS   The current nanosecond timestamp.
+ * @param   uCpuHz      The CPU frequency to set, 0 if the caller doesn't know.
+ */
+static void supdrvGipInitCpu(PSUPGLOBALINFOPAGE pGip, PSUPGIPCPU pCpu, uint64_t u64NanoTS, uint64_t uCpuHz)
+{
+    pCpu->u32TransactionId   = 2;
+    pCpu->u64NanoTS          = u64NanoTS;
+    pCpu->u64TSC             = ASMReadTSC();
+    pCpu->u64TSCSample       = GIP_TSC_DELTA_RSVD;
+    pCpu->i64TSCDelta        = pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED ? INT64_MAX : 0;
+
+    ASMAtomicWriteSize(&pCpu->enmState, SUPGIPCPUSTATE_INVALID);
+    ASMAtomicWriteSize(&pCpu->idCpu,    NIL_RTCPUID);
+    ASMAtomicWriteS16(&pCpu->iCpuSet,   -1);
+    ASMAtomicWriteU16(&pCpu->idApic,    UINT16_MAX);
+
+    /*
+     * The first time we're called, we don't have a CPU frequency handy,
+     * so pretend it's a 4 GHz CPU.  On CPUs that are online, we'll get
+     * called again and at that point we have a more plausible CPU frequency
+     * value handy.  The frequency history will also be adjusted again on
+     * the 2nd timer callout (maybe we can skip that now?).
+     */
+    if (!uCpuHz)
+    {
+        pCpu->u64CpuHz             = _4G - 1;
+        pCpu->u32UpdateIntervalTSC = (uint32_t)((_4G - 1) / pGip->u32UpdateHz);
+    }
+    else
+    {
+        pCpu->u64CpuHz             = uCpuHz;
+        pCpu->u32UpdateIntervalTSC = (uint32_t)(uCpuHz / pGip->u32UpdateHz);
+    }
+    pCpu->au32TSCHistory[0]
+        = pCpu->au32TSCHistory[1]
+        = pCpu->au32TSCHistory[2]
+        = pCpu->au32TSCHistory[3]
+        = pCpu->au32TSCHistory[4]
+        = pCpu->au32TSCHistory[5]
+        = pCpu->au32TSCHistory[6]
+        = pCpu->au32TSCHistory[7]
+        = pCpu->u32UpdateIntervalTSC;
+}
+
+
+/**
+ * Initializes the GIP data.
+ *
+ * @param   pDevExt             Pointer to the device instance data.
+ * @param   pGip                Pointer to the read-write kernel mapping of the GIP.
+ * @param   HCPhys              The physical address of the GIP.
+ * @param   u64NanoTS           The current nanosecond timestamp.
+ * @param   uUpdateHz           The update frequency.
+ * @param   uUpdateIntervalNS   The update interval in nanoseconds.
+ * @param   cCpus               The CPU count.
+ */
+static void supdrvGipInit(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip, RTHCPHYS HCPhys,
+                          uint64_t u64NanoTS, unsigned uUpdateHz, unsigned uUpdateIntervalNS, unsigned cCpus)
+{
+    size_t const    cbGip = RT_ALIGN_Z(RT_OFFSETOF(SUPGLOBALINFOPAGE, aCPUs[cCpus]), PAGE_SIZE);
+    unsigned        i;
+#ifdef DEBUG_DARWIN_GIP
+    OSDBGPRINT(("supdrvGipInit: pGip=%p HCPhys=%lx u64NanoTS=%llu uUpdateHz=%d cCpus=%u\n", pGip, (long)HCPhys, u64NanoTS, uUpdateHz, cCpus));
+#else
+    LogFlow(("supdrvGipInit: pGip=%p HCPhys=%lx u64NanoTS=%llu uUpdateHz=%d cCpus=%u\n", pGip, (long)HCPhys, u64NanoTS, uUpdateHz, cCpus));
+#endif
+
+    /*
+     * Initialize the structure.
+     */
+    memset(pGip, 0, cbGip);
+
+    pGip->u32Magic                = SUPGLOBALINFOPAGE_MAGIC;
+    pGip->u32Version              = SUPGLOBALINFOPAGE_VERSION;
+    pGip->u32Mode                 = supdrvGipInitDetermineTscMode(pDevExt);
+    if (   pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC
+        /*|| pGip->u32Mode == SUPGIPMODE_SYNC_TSC */)
+        pGip->enmUseTscDelta      = supdrvOSAreTscDeltasInSync() /* Allow OS override (windows). */
+                                  ? SUPGIPUSETSCDELTA_ZERO_CLAIMED : SUPGIPUSETSCDELTA_PRACTICALLY_ZERO /* downgrade later */;
+    else
+        pGip->enmUseTscDelta      = SUPGIPUSETSCDELTA_NOT_APPLICABLE;
+    pGip->cCpus                   = (uint16_t)cCpus;
+    pGip->cPages                  = (uint16_t)(cbGip / PAGE_SIZE);
+    pGip->u32UpdateHz             = uUpdateHz;
+    pGip->u32UpdateIntervalNS     = uUpdateIntervalNS;
+    pGip->fGetGipCpu              = SUPGIPGETCPU_APIC_ID;
+    RTCpuSetEmpty(&pGip->OnlineCpuSet);
+    RTCpuSetEmpty(&pGip->PresentCpuSet);
+    RTMpGetSet(&pGip->PossibleCpuSet);
+    pGip->cOnlineCpus             = RTMpGetOnlineCount();
+    pGip->cPresentCpus            = RTMpGetPresentCount();
+    pGip->cPossibleCpus           = RTMpGetCount();
+    pGip->idCpuMax                = RTMpGetMaxCpuId();
+    for (i = 0; i < RT_ELEMENTS(pGip->aiCpuFromApicId); i++)
+        pGip->aiCpuFromApicId[i]    = UINT16_MAX;
+    for (i = 0; i < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx); i++)
+        pGip->aiCpuFromCpuSetIdx[i] = UINT16_MAX;
+    for (i = 0; i < cCpus; i++)
+        supdrvGipInitCpu(pGip, &pGip->aCPUs[i], u64NanoTS, 0 /*uCpuHz*/);
+
+    /*
+     * Link it to the device extension.
+     */
+    pDevExt->pGip      = pGip;
+    pDevExt->HCPhysGip = HCPhys;
+    pDevExt->cGipUsers = 0;
+}
+
+
+/**
+ * Creates the GIP.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt     Instance data. GIP stuff may be updated.
+ */
+int VBOXCALL supdrvGipCreate(PSUPDRVDEVEXT pDevExt)
+{
+    PSUPGLOBALINFOPAGE  pGip;
+    RTHCPHYS            HCPhysGip;
+    uint32_t            u32SystemResolution;
+    uint32_t            u32Interval;
+    uint32_t            u32MinInterval;
+    uint32_t            uMod;
+    unsigned            cCpus;
+    int                 rc;
+
+    LogFlow(("supdrvGipCreate:\n"));
+
+    /*
+     * Assert order.
+     */
+    Assert(pDevExt->u32SystemTimerGranularityGrant == 0);
+    Assert(pDevExt->GipMemObj == NIL_RTR0MEMOBJ);
+    Assert(!pDevExt->pGipTimer);
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    Assert(pDevExt->mtxGip != NIL_RTSEMMUTEX);
+    Assert(pDevExt->mtxTscDelta != NIL_RTSEMMUTEX);
+#else
+    Assert(pDevExt->mtxGip != NIL_RTSEMFASTMUTEX);
+    Assert(pDevExt->mtxTscDelta != NIL_RTSEMFASTMUTEX);
+#endif
+
+    /*
+     * Check the CPU count.
+     */
+    cCpus = RTMpGetArraySize();
+    if (   cCpus > RTCPUSET_MAX_CPUS
+        || cCpus > 256 /* ApicId is used for the mappings */)
+    {
+        SUPR0Printf("VBoxDrv: Too many CPUs (%u) for the GIP (max %u)\n", cCpus, RT_MIN(RTCPUSET_MAX_CPUS, 256));
+        return VERR_TOO_MANY_CPUS;
+    }
+
+    /*
+     * Allocate a contiguous set of pages with a default kernel mapping.
+     */
+    rc = RTR0MemObjAllocCont(&pDevExt->GipMemObj, RT_UOFFSETOF(SUPGLOBALINFOPAGE, aCPUs[cCpus]), false /*fExecutable*/);
+    if (RT_FAILURE(rc))
+    {
+        OSDBGPRINT(("supdrvGipCreate: failed to allocate the GIP page. rc=%d\n", rc));
+        return rc;
+    }
+    pGip = (PSUPGLOBALINFOPAGE)RTR0MemObjAddress(pDevExt->GipMemObj); AssertPtr(pGip);
+    HCPhysGip = RTR0MemObjGetPagePhysAddr(pDevExt->GipMemObj, 0); Assert(HCPhysGip != NIL_RTHCPHYS);
+
+    /*
+     * Find a reasonable update interval and initialize the structure.
+     */
+    supdrvGipRequestHigherTimerFrequencyFromSystem(pDevExt);
+    /** @todo figure out why using a 100Ms interval upsets timekeeping in VMs.
+     *        See @bugref{6710}. */
+    u32MinInterval      = RT_NS_10MS;
+    u32SystemResolution = RTTimerGetSystemGranularity();
+    u32Interval         = u32MinInterval;
+    uMod                = u32MinInterval % u32SystemResolution;
+    if (uMod)
+        u32Interval += u32SystemResolution - uMod;
+
+    supdrvGipInit(pDevExt, pGip, HCPhysGip, RTTimeSystemNanoTS(), RT_NS_1SEC / u32Interval /*=Hz*/, u32Interval, cCpus);
+
+    /*
+     * Important sanity check...
+     */
+    if (RT_UNLIKELY(   pGip->enmUseTscDelta == SUPGIPUSETSCDELTA_ZERO_CLAIMED
+                    && pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
+                    && !supdrvOSGetForcedAsyncTscMode(pDevExt)))
+    {
+        OSDBGPRINT(("supdrvGipCreate: Host-OS/user claims the TSC-deltas are zero but we detected async. TSC! Bad.\n"));
+        return VERR_INTERNAL_ERROR_2;
+    }
+
+    /* It doesn't make sense to do TSC-delta detection on systems we detect as async. */
+    AssertReturn(   pGip->u32Mode != SUPGIPMODE_ASYNC_TSC
+                 || pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ZERO_CLAIMED, VERR_INTERNAL_ERROR_3);
+
+    /*
+     * Do the TSC frequency measurements.
+     *
+     * If we're in invariant TSC mode, just to a quick preliminary measurement
+     * that the TSC-delta measurement code can use to yield cross calls.
+     *
+     * If we're in any of the other two modes, neither which require MP init,
+     * notifications or deltas for the job, do the full measurement now so
+     * that supdrvGipInitOnCpu() can populate the TSC interval and history
+     * array with more reasonable values.
+     */
+    if (pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC)
+    {
+        rc = supdrvGipInitMeasureTscFreq(pDevExt, pGip, true /*fRough*/); /* cannot fail */
+        supdrvGipInitStartTimerForRefiningInvariantTscFreq(pDevExt, pGip);
+    }
+    else
+        rc = supdrvGipInitMeasureTscFreq(pDevExt, pGip, false /*fRough*/);
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Start TSC-delta measurement thread before we start getting MP
+         * events that will try kick it into action (includes the
+         * RTMpOnAll/supdrvGipInitOnCpu call below).
+         */
+        RTCpuSetEmpty(&pDevExt->TscDeltaCpuSet);
+        RTCpuSetEmpty(&pDevExt->TscDeltaObtainedCpuSet);
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+        if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED)
+            rc = supdrvTscDeltaThreadInit(pDevExt);
+#endif
+        if (RT_SUCCESS(rc))
+        {
+            rc = RTMpNotificationRegister(supdrvGipMpEvent, pDevExt);
+            if (RT_SUCCESS(rc))
+            {
+                /*
+                 * Do GIP initialization on all online CPUs.  Wake up the
+                 * TSC-delta thread afterwards.
+                 */
+                rc = RTMpOnAll(supdrvGipInitOnCpu, pDevExt, pGip);
+                if (RT_SUCCESS(rc))
+                {
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+                    supdrvTscDeltaThreadStartMeasurement(pDevExt, true /* fForceAll */);
+#else
+                    uint16_t iCpu;
+                    if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED)
+                    {
+                        /*
+                         * Measure the TSC deltas now that we have MP notifications.
+                         */
+                        int cTries = 5;
+                        do
+                        {
+                            rc = supdrvMeasureInitialTscDeltas(pDevExt);
+                            if (   rc != VERR_TRY_AGAIN
+                                && rc != VERR_CPU_OFFLINE)
+                                break;
+                        } while (--cTries > 0);
+                        for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
+                            Log(("supdrvTscDeltaInit: cpu[%u] delta %lld\n", iCpu, pGip->aCPUs[iCpu].i64TSCDelta));
+                    }
+                    else
+                    {
+                        for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
+                            AssertMsg(!pGip->aCPUs[iCpu].i64TSCDelta, ("iCpu=%u %lld mode=%d\n", iCpu, pGip->aCPUs[iCpu].i64TSCDelta, pGip->u32Mode));
+                    }
+                    if (RT_SUCCESS(rc))
+#endif
+                    {
+                        /*
+                         * Create the timer.
+                         * If CPU_ALL isn't supported we'll have to fall back to synchronous mode.
+                         */
+                        if (pGip->u32Mode == SUPGIPMODE_ASYNC_TSC)
+                        {
+                            rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, RTTIMER_FLAGS_CPU_ALL,
+                                                 supdrvGipAsyncTimer, pDevExt);
+                            if (rc == VERR_NOT_SUPPORTED)
+                            {
+                                OSDBGPRINT(("supdrvGipCreate: omni timer not supported, falling back to synchronous mode\n"));
+                                pGip->u32Mode = SUPGIPMODE_SYNC_TSC;
+                            }
+                        }
+                        if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
+                            rc = RTTimerCreateEx(&pDevExt->pGipTimer, u32Interval, 0 /* fFlags */,
+                                                 supdrvGipSyncAndInvariantTimer, pDevExt);
+                        if (RT_SUCCESS(rc))
+                        {
+                            /*
+                             * We're good.
+                             */
+                            Log(("supdrvGipCreate: %u ns interval.\n", u32Interval));
+                            supdrvGipReleaseHigherTimerFrequencyFromSystem(pDevExt);
+
+                            g_pSUPGlobalInfoPage = pGip;
+                            return VINF_SUCCESS;
+                        }
+
+                        OSDBGPRINT(("supdrvGipCreate: failed create GIP timer at %u ns interval. rc=%Rrc\n", u32Interval, rc));
+                        Assert(!pDevExt->pGipTimer);
+                    }
+                }
+                else
+                    OSDBGPRINT(("supdrvGipCreate: RTMpOnAll failed. rc=%Rrc\n", rc));
+            }
+            else
+                OSDBGPRINT(("supdrvGipCreate: failed to register MP event notfication. rc=%Rrc\n", rc));
+        }
+        else
+            OSDBGPRINT(("supdrvGipCreate: supdrvTscDeltaInit failed. rc=%Rrc\n", rc));
+    }
+    else
+        OSDBGPRINT(("supdrvGipCreate: supdrvMeasureInitialTscDeltas failed. rc=%Rrc\n", rc));
+
+    /* Releases timer frequency increase too. */
+    supdrvGipDestroy(pDevExt);
+    return rc;
+}
+
+
+/**
+ * Invalidates the GIP data upon termination.
+ *
+ * @param   pGip        Pointer to the read-write kernel mapping of the GIP.
+ */
+static void supdrvGipTerm(PSUPGLOBALINFOPAGE pGip)
+{
+    unsigned i;
+    pGip->u32Magic = 0;
+    for (i = 0; i < pGip->cCpus; i++)
+    {
+        pGip->aCPUs[i].u64NanoTS = 0;
+        pGip->aCPUs[i].u64TSC = 0;
+        pGip->aCPUs[i].iTSCHistoryHead = 0;
+        pGip->aCPUs[i].u64TSCSample = 0;
+        pGip->aCPUs[i].i64TSCDelta = INT64_MAX;
+    }
+}
+
+
+/**
+ * Terminates the GIP.
+ *
+ * @param   pDevExt     Instance data. GIP stuff may be updated.
+ */
+void VBOXCALL supdrvGipDestroy(PSUPDRVDEVEXT pDevExt)
+{
+    int rc;
+#ifdef DEBUG_DARWIN_GIP
+    OSDBGPRINT(("supdrvGipDestroy: pDevExt=%p pGip=%p pGipTimer=%p GipMemObj=%p\n", pDevExt,
+                pDevExt->GipMemObj != NIL_RTR0MEMOBJ ? RTR0MemObjAddress(pDevExt->GipMemObj) : NULL,
+                pDevExt->pGipTimer, pDevExt->GipMemObj));
+#endif
+
+    /*
+     * Stop receiving MP notifications before tearing anything else down.
+     */
+    RTMpNotificationDeregister(supdrvGipMpEvent, pDevExt);
+
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+    /*
+     * Terminate the TSC-delta measurement thread and resources.
+     */
+    supdrvTscDeltaTerm(pDevExt);
+#endif
+
+    /*
+     * Destroy the TSC-refinement timer.
+     */
+    if (pDevExt->pInvarTscRefineTimer)
+    {
+        RTTimerDestroy(pDevExt->pInvarTscRefineTimer);
+        pDevExt->pInvarTscRefineTimer = NULL;
+    }
+
+    /*
+     * Invalid the GIP data.
+     */
+    if (pDevExt->pGip)
+    {
+        supdrvGipTerm(pDevExt->pGip);
+        pDevExt->pGip = NULL;
+    }
+    g_pSUPGlobalInfoPage = NULL;
+
+    /*
+     * Destroy the timer and free the GIP memory object.
+     */
+    if (pDevExt->pGipTimer)
+    {
+        rc = RTTimerDestroy(pDevExt->pGipTimer); AssertRC(rc);
+        pDevExt->pGipTimer = NULL;
+    }
+
+    if (pDevExt->GipMemObj != NIL_RTR0MEMOBJ)
+    {
+        rc = RTR0MemObjFree(pDevExt->GipMemObj, true /* free mappings */); AssertRC(rc);
+        pDevExt->GipMemObj = NIL_RTR0MEMOBJ;
+    }
+
+    /*
+     * Finally, make sure we've release the system timer resolution request
+     * if one actually succeeded and is still pending.
+     */
+    supdrvGipReleaseHigherTimerFrequencyFromSystem(pDevExt);
+}
+
+
+
+
+/*
+ *
+ *
+ * GIP Update Timer Related Code
+ * GIP Update Timer Related Code
+ * GIP Update Timer Related Code
+ *
+ *
+ */
+
+
+/**
+ * Worker routine for supdrvGipUpdate() and supdrvGipUpdatePerCpu() that
+ * updates all the per cpu data except the transaction id.
+ *
+ * @param   pDevExt         The device extension.
+ * @param   pGipCpu         Pointer to the per cpu data.
+ * @param   u64NanoTS       The current time stamp.
+ * @param   u64TSC          The current TSC.
+ * @param   iTick           The current timer tick.
+ *
+ * @remarks Can be called with interrupts disabled!
+ */
+static void supdrvGipDoUpdateCpu(PSUPDRVDEVEXT pDevExt, PSUPGIPCPU pGipCpu, uint64_t u64NanoTS, uint64_t u64TSC, uint64_t iTick)
+{
+    uint64_t    u64TSCDelta;
+    uint32_t    u32UpdateIntervalTSC;
+    uint32_t    u32UpdateIntervalTSCSlack;
+    unsigned    iTSCHistoryHead;
+    uint64_t    u64CpuHz;
+    uint32_t    u32TransactionId;
+
+    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+    AssertPtrReturnVoid(pGip);
+
+    /* Delta between this and the previous update. */
+    ASMAtomicUoWriteU32(&pGipCpu->u32PrevUpdateIntervalNS, (uint32_t)(u64NanoTS - pGipCpu->u64NanoTS));
+
+    /*
+     * Update the NanoTS.
+     */
+    ASMAtomicWriteU64(&pGipCpu->u64NanoTS, u64NanoTS);
+
+    /*
+     * Calc TSC delta.
+     */
+    u64TSCDelta = u64TSC - pGipCpu->u64TSC;
+    ASMAtomicWriteU64(&pGipCpu->u64TSC, u64TSC);
+
+    /*
+     * We don't need to keep realculating the frequency when it's invariant, so
+     * the remainder of this function is only for the sync and async TSC modes.
+     */
+    if (pGip->u32Mode != SUPGIPMODE_INVARIANT_TSC)
+    {
+        if (u64TSCDelta >> 32)
+        {
+            u64TSCDelta = pGipCpu->u32UpdateIntervalTSC;
+            pGipCpu->cErrors++;
+        }
+
+        /*
+         * On the 2nd and 3rd callout, reset the history with the current TSC
+         * interval since the values entered by supdrvGipInit are totally off.
+         * The interval on the 1st callout completely unreliable, the 2nd is a bit
+         * better, while the 3rd should be most reliable.
+         */
+        /** @todo Could we drop this now that we initializes the history
+         *        with nominal TSC frequency values? */
+        u32TransactionId = pGipCpu->u32TransactionId;
+        if (RT_UNLIKELY(   (   u32TransactionId == 5
+                            || u32TransactionId == 7)
+                        && (   iTick == 2
+                            || iTick == 3) ))
+        {
+            unsigned i;
+            for (i = 0; i < RT_ELEMENTS(pGipCpu->au32TSCHistory); i++)
+                ASMAtomicUoWriteU32(&pGipCpu->au32TSCHistory[i], (uint32_t)u64TSCDelta);
+        }
+
+        /*
+         * Validate the NanoTS deltas between timer fires with an arbitrary threshold of 0.5%.
+         * Wait until we have at least one full history since the above history reset. The
+         * assumption is that the majority of the previous history values will be tolerable.
+         * See @bugref{6710} comment #67.
+         */
+        /** @todo Could we drop the fuding there now that we initializes the history
+         *        with nominal TSC frequency values?  */
+        if (   u32TransactionId > 23 /* 7 + (8 * 2) */
+            && pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
+        {
+            uint32_t uNanoTsThreshold = pGip->u32UpdateIntervalNS / 200;
+            if (   pGipCpu->u32PrevUpdateIntervalNS > pGip->u32UpdateIntervalNS + uNanoTsThreshold
+                || pGipCpu->u32PrevUpdateIntervalNS < pGip->u32UpdateIntervalNS - uNanoTsThreshold)
+            {
+                uint32_t u32;
+                u32  = pGipCpu->au32TSCHistory[0];
+                u32 += pGipCpu->au32TSCHistory[1];
+                u32 += pGipCpu->au32TSCHistory[2];
+                u32 += pGipCpu->au32TSCHistory[3];
+                u32 >>= 2;
+                u64TSCDelta  = pGipCpu->au32TSCHistory[4];
+                u64TSCDelta += pGipCpu->au32TSCHistory[5];
+                u64TSCDelta += pGipCpu->au32TSCHistory[6];
+                u64TSCDelta += pGipCpu->au32TSCHistory[7];
+                u64TSCDelta >>= 2;
+                u64TSCDelta += u32;
+                u64TSCDelta >>= 1;
+            }
+        }
+
+        /*
+         * TSC History.
+         */
+        Assert(RT_ELEMENTS(pGipCpu->au32TSCHistory) == 8);
+        iTSCHistoryHead = (pGipCpu->iTSCHistoryHead + 1) & 7;
+        ASMAtomicWriteU32(&pGipCpu->iTSCHistoryHead, iTSCHistoryHead);
+        ASMAtomicWriteU32(&pGipCpu->au32TSCHistory[iTSCHistoryHead], (uint32_t)u64TSCDelta);
+
+        /*
+         * UpdateIntervalTSC = average of last 8,2,1 intervals depending on update HZ.
+         *
+         * On Windows, we have an occasional (but recurring) sour value that messed up
+         * the history but taking only 1 interval reduces the precision overall.
+         */
+        if (   pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC
+            || pGip->u32UpdateHz >= 1000)
+        {
+            uint32_t u32;
+            u32  = pGipCpu->au32TSCHistory[0];
+            u32 += pGipCpu->au32TSCHistory[1];
+            u32 += pGipCpu->au32TSCHistory[2];
+            u32 += pGipCpu->au32TSCHistory[3];
+            u32 >>= 2;
+            u32UpdateIntervalTSC  = pGipCpu->au32TSCHistory[4];
+            u32UpdateIntervalTSC += pGipCpu->au32TSCHistory[5];
+            u32UpdateIntervalTSC += pGipCpu->au32TSCHistory[6];
+            u32UpdateIntervalTSC += pGipCpu->au32TSCHistory[7];
+            u32UpdateIntervalTSC >>= 2;
+            u32UpdateIntervalTSC += u32;
+            u32UpdateIntervalTSC >>= 1;
+
+            /* Value chosen for a 2GHz Athlon64 running linux 2.6.10/11. */
+            u32UpdateIntervalTSCSlack = u32UpdateIntervalTSC >> 14;
+        }
+        else if (pGip->u32UpdateHz >= 90)
+        {
+            u32UpdateIntervalTSC  = (uint32_t)u64TSCDelta;
+            u32UpdateIntervalTSC += pGipCpu->au32TSCHistory[(iTSCHistoryHead - 1) & 7];
+            u32UpdateIntervalTSC >>= 1;
+
+            /* value chosen on a 2GHz thinkpad running windows */
+            u32UpdateIntervalTSCSlack = u32UpdateIntervalTSC >> 7;
+        }
+        else
+        {
+            u32UpdateIntervalTSC  = (uint32_t)u64TSCDelta;
+
+            /* This value hasn't be checked yet.. waiting for OS/2 and 33Hz timers.. :-) */
+            u32UpdateIntervalTSCSlack = u32UpdateIntervalTSC >> 6;
+        }
+        ASMAtomicWriteU32(&pGipCpu->u32UpdateIntervalTSC, u32UpdateIntervalTSC + u32UpdateIntervalTSCSlack);
+
+        /*
+         * CpuHz.
+         */
+        u64CpuHz = ASMMult2xU32RetU64(u32UpdateIntervalTSC, RT_NS_1SEC);
+        u64CpuHz /= pGip->u32UpdateIntervalNS;
+        ASMAtomicWriteU64(&pGipCpu->u64CpuHz, u64CpuHz);
+    }
+}
+
+
+/**
+ * Updates the GIP.
+ *
+ * @param   pDevExt         The device extension.
+ * @param   u64NanoTS       The current nanosecond timesamp.
+ * @param   u64TSC          The current TSC timesamp.
+ * @param   idCpu           The CPU ID.
+ * @param   iTick           The current timer tick.
+ *
+ * @remarks Can be called with interrupts disabled!
+ */
+static void supdrvGipUpdate(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC, RTCPUID idCpu, uint64_t iTick)
+{
+    /*
+     * Determine the relevant CPU data.
+     */
+    PSUPGIPCPU pGipCpu;
+    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+    AssertPtrReturnVoid(pGip);
+
+    if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
+        pGipCpu = &pGip->aCPUs[0];
+    else
+    {
+        unsigned iCpu = pGip->aiCpuFromApicId[ASMGetApicId()];
+        if (RT_UNLIKELY(iCpu >= pGip->cCpus))
+            return;
+        pGipCpu = &pGip->aCPUs[iCpu];
+        if (RT_UNLIKELY(pGipCpu->idCpu != idCpu))
+            return;
+    }
+
+    /*
+     * Start update transaction.
+     */
+    if (!(ASMAtomicIncU32(&pGipCpu->u32TransactionId) & 1))
+    {
+        /* this can happen on win32 if we're taking to long and there are more CPUs around. shouldn't happen though. */
+        AssertMsgFailed(("Invalid transaction id, %#x, not odd!\n", pGipCpu->u32TransactionId));
+        ASMAtomicIncU32(&pGipCpu->u32TransactionId);
+        pGipCpu->cErrors++;
+        return;
+    }
+
+    /*
+     * Recalc the update frequency every 0x800th time.
+     */
+    if (   pGip->u32Mode != SUPGIPMODE_INVARIANT_TSC   /* cuz we're not recalculating the frequency on invariants hosts. */
+        && !(pGipCpu->u32TransactionId & (GIP_UPDATEHZ_RECALC_FREQ * 2 - 2)))
+    {
+        if (pGip->u64NanoTSLastUpdateHz)
+        {
+#ifdef RT_ARCH_AMD64 /** @todo fix 64-bit div here to work on x86 linux. */
+            uint64_t u64Delta = u64NanoTS - pGip->u64NanoTSLastUpdateHz;
+            uint32_t u32UpdateHz = (uint32_t)((RT_NS_1SEC_64 * GIP_UPDATEHZ_RECALC_FREQ) / u64Delta);
+            if (u32UpdateHz <= 2000 && u32UpdateHz >= 30)
+            {
+                /** @todo r=ramshankar: Changing u32UpdateHz might screw up TSC frequency
+                 *        calculation on non-invariant hosts if it changes the history decision
+                 *        taken in supdrvGipDoUpdateCpu(). */
+                uint64_t u64Interval = u64Delta / GIP_UPDATEHZ_RECALC_FREQ;
+                ASMAtomicWriteU32(&pGip->u32UpdateHz, u32UpdateHz);
+                ASMAtomicWriteU32(&pGip->u32UpdateIntervalNS, (uint32_t)u64Interval);
+            }
+#endif
+        }
+        ASMAtomicWriteU64(&pGip->u64NanoTSLastUpdateHz, u64NanoTS | 1);
+    }
+
+    /*
+     * Update the data.
+     */
+    supdrvGipDoUpdateCpu(pDevExt, pGipCpu, u64NanoTS, u64TSC, iTick);
+
+    /*
+     * Complete transaction.
+     */
+    ASMAtomicIncU32(&pGipCpu->u32TransactionId);
+}
+
+
+/**
+ * Updates the per cpu GIP data for the calling cpu.
+ *
+ * @param   pDevExt         The device extension.
+ * @param   u64NanoTS       The current nanosecond timesamp.
+ * @param   u64TSC          The current TSC timesamp.
+ * @param   idCpu           The CPU ID.
+ * @param   idApic          The APIC id for the CPU index.
+ * @param   iTick           The current timer tick.
+ *
+ * @remarks Can be called with interrupts disabled!
+ */
+static void supdrvGipUpdatePerCpu(PSUPDRVDEVEXT pDevExt, uint64_t u64NanoTS, uint64_t u64TSC,
+                                  RTCPUID idCpu, uint8_t idApic, uint64_t iTick)
+{
+    uint32_t iCpu;
+    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+
+    /*
+     * Avoid a potential race when a CPU online notification doesn't fire on
+     * the onlined CPU but the tick creeps in before the event notification is
+     * run.
+     */
+    if (RT_UNLIKELY(iTick == 1))
+    {
+        iCpu = supdrvGipFindOrAllocCpuIndexForCpuId(pGip, idCpu);
+        if (pGip->aCPUs[iCpu].enmState == SUPGIPCPUSTATE_OFFLINE)
+            supdrvGipMpEventOnlineOrInitOnCpu(pDevExt, idCpu);
+    }
+
+    iCpu = pGip->aiCpuFromApicId[idApic];
+    if (RT_LIKELY(iCpu < pGip->cCpus))
+    {
+        PSUPGIPCPU pGipCpu = &pGip->aCPUs[iCpu];
+        if (pGipCpu->idCpu == idCpu)
+        {
+            /*
+             * Start update transaction.
+             */
+            if (!(ASMAtomicIncU32(&pGipCpu->u32TransactionId) & 1))
+            {
+                AssertMsgFailed(("Invalid transaction id, %#x, not odd!\n", pGipCpu->u32TransactionId));
+                ASMAtomicIncU32(&pGipCpu->u32TransactionId);
+                pGipCpu->cErrors++;
+                return;
+            }
+
+            /*
+             * Update the data.
+             */
+            supdrvGipDoUpdateCpu(pDevExt, pGipCpu, u64NanoTS, u64TSC, iTick);
+
+            /*
+             * Complete transaction.
+             */
+            ASMAtomicIncU32(&pGipCpu->u32TransactionId);
+        }
+    }
+}
+
+
+/**
+ * Timer callback function for the sync and invariant GIP modes.
+ *
+ * @param   pTimer      The timer.
+ * @param   pvUser      Opaque pointer to the device extension.
+ * @param   iTick       The timer tick.
+ */
+static DECLCALLBACK(void) supdrvGipSyncAndInvariantTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick)
+{
+    PSUPDRVDEVEXT      pDevExt   = (PSUPDRVDEVEXT)pvUser;
+    PSUPGLOBALINFOPAGE pGip      = pDevExt->pGip;
+    RTCCUINTREG        fEFlags   = ASMIntDisableFlags(); /* No interruptions please (real problem on S10). */
+    uint64_t           u64TSC    = ASMReadTSC();
+    uint64_t           u64NanoTS = RTTimeSystemNanoTS();
+
+    if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_PRACTICALLY_ZERO)
+    {
+        /*
+         * The calculations in supdrvGipUpdate() is somewhat timing sensitive,
+         * missing timer ticks is not an option for GIP because the GIP users
+         * will end up incrementing the time in 1ns per time getter call until
+         * there is a complete timer update.   So, if the delta has yet to be
+         * calculated, we just pretend it is zero for now (the GIP users
+         * probably won't have it for a wee while either and will do the same).
+         *
+         * We could maybe on some platforms try cross calling a CPU with a
+         * working delta here, but it's not worth the hassle since the
+         * likelyhood of this happening is really low.  On Windows, Linux, and
+         * Solaris timers fire on the CPU they were registered/started on.
+         * Darwin timers doesn't necessarily (they are high priority threads).
+         */
+        uint32_t iCpuSet = RTMpCpuIdToSetIndex(RTMpCpuId());
+        uint16_t iGipCpu = RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx))
+                         ? pGip->aiCpuFromCpuSetIdx[iCpuSet] : UINT16_MAX;
+        Assert(!ASMIntAreEnabled());
+        if (RT_LIKELY(iGipCpu < pGip->cCpus))
+        {
+            int64_t iTscDelta = pGip->aCPUs[iGipCpu].i64TSCDelta;
+            if (iTscDelta != INT64_MAX)
+                u64TSC -= iTscDelta;
+        }
+    }
+
+    supdrvGipUpdate(pDevExt, u64NanoTS, u64TSC, NIL_RTCPUID, iTick);
+
+    ASMSetFlags(fEFlags);
+}
+
+
+/**
+ * Timer callback function for async GIP mode.
+ * @param   pTimer      The timer.
+ * @param   pvUser      Opaque pointer to the device extension.
+ * @param   iTick       The timer tick.
+ */
+static DECLCALLBACK(void) supdrvGipAsyncTimer(PRTTIMER pTimer, void *pvUser, uint64_t iTick)
+{
+    PSUPDRVDEVEXT   pDevExt   = (PSUPDRVDEVEXT)pvUser;
+    RTCCUINTREG     fEFlags   = ASMIntDisableFlags(); /* No interruptions please (real problem on S10). */
+    RTCPUID         idCpu     = RTMpCpuId();
+    uint64_t        u64TSC    = ASMReadTSC();
+    uint64_t        NanoTS    = RTTimeSystemNanoTS();
+
+    /** @todo reset the transaction number and whatnot when iTick == 1. */
+    if (pDevExt->idGipMaster == idCpu)
+        supdrvGipUpdate(pDevExt, NanoTS, u64TSC, idCpu, iTick);
+    else
+        supdrvGipUpdatePerCpu(pDevExt, NanoTS, u64TSC, idCpu, ASMGetApicId(), iTick);
+
+    ASMSetFlags(fEFlags);
+}
+
+
+
+
+/*
+ *
+ *
+ * TSC Delta Measurements And Related Code
+ * TSC Delta Measurements And Related Code
+ * TSC Delta Measurements And Related Code
+ *
+ *
+ */
+
+
+/*
+ * Select TSC delta measurement algorithm.
+ */
+#if 0
+# define GIP_TSC_DELTA_METHOD_1
+#else
+# define GIP_TSC_DELTA_METHOD_2
+#endif
+
+/** For padding variables to keep them away from other cache lines.  Better too
+ * large than too small!
+ * @remarks Current AMD64 and x86 CPUs seems to use 64 bytes.  There are claims
+ *          that NetBurst had 128 byte cache lines while the 486 thru Pentium
+ *          III had 32 bytes cache lines. */
+#define GIP_TSC_DELTA_CACHE_LINE_SIZE           128
+
+
+/**
+ * TSC delta measurment algorithm \#2 result entry.
+ */
+typedef struct SUPDRVTSCDELTAMETHOD2ENTRY
+{
+    uint32_t    iSeqMine;
+    uint32_t    iSeqOther;
+    uint64_t    uTsc;
+} SUPDRVTSCDELTAMETHOD2ENTRY;
+
+/**
+ * TSC delta measurment algorithm \#2 Data.
+ */
+typedef struct SUPDRVTSCDELTAMETHOD2
+{
+    /** Padding to make sure the iCurSeqNo is in its own cache line. */
+    uint64_t                    au64CacheLinePaddingBefore[GIP_TSC_DELTA_CACHE_LINE_SIZE / sizeof(uint64_t)];
+    /** The current sequence number of this worker. */
+    uint32_t volatile           iCurSeqNo;
+    /** Padding to make sure the iCurSeqNo is in its own cache line. */
+    uint32_t                    au64CacheLinePaddingAfter[GIP_TSC_DELTA_CACHE_LINE_SIZE / sizeof(uint32_t) - 1];
+    /** Result table. */
+    SUPDRVTSCDELTAMETHOD2ENTRY  aResults[64];
+} SUPDRVTSCDELTAMETHOD2;
+/** Pointer to the data for TSC delta mesurment algorithm \#2 .*/
+typedef SUPDRVTSCDELTAMETHOD2 *PSUPDRVTSCDELTAMETHOD2;
+
+
+/**
+ * The TSC delta synchronization struct, version 2.
+ *
+ * The syncrhonization variable is completely isolated in its own cache line
+ * (provided our max cache line size estimate is correct).
+ */
+typedef struct SUPTSCDELTASYNC2
+{
+    /** Padding to make sure the uVar1 is in its own cache line. */
+    uint64_t                    au64CacheLinePaddingBefore[GIP_TSC_DELTA_CACHE_LINE_SIZE / sizeof(uint64_t)];
+
+    /** The synchronization variable, holds values GIP_TSC_DELTA_SYNC_*. */
+    volatile uint32_t           uSyncVar;
+    /** Sequence synchronizing variable used for post 'GO' synchronization. */
+    volatile uint32_t           uSyncSeq;
+
+    /** Padding to make sure the uVar1 is in its own cache line. */
+    uint64_t                    au64CacheLinePaddingAfter[GIP_TSC_DELTA_CACHE_LINE_SIZE / sizeof(uint64_t) - 2];
+
+    /** Start RDTSC value.  Put here mainly to save stack space. */
+    uint64_t                    uTscStart;
+    /** Copy of SUPDRVGIPTSCDELTARGS::cMaxTscTicks. */
+    uint64_t                    cMaxTscTicks;
+} SUPTSCDELTASYNC2;
+AssertCompileSize(SUPTSCDELTASYNC2, GIP_TSC_DELTA_CACHE_LINE_SIZE * 2 + sizeof(uint64_t));
+typedef SUPTSCDELTASYNC2 *PSUPTSCDELTASYNC2;
+
+/** Prestart wait. */
+#define GIP_TSC_DELTA_SYNC2_PRESTART_WAIT    UINT32_C(0x0ffe)
+/** Prestart aborted. */
+#define GIP_TSC_DELTA_SYNC2_PRESTART_ABORT   UINT32_C(0x0fff)
+/** Ready (on your mark). */
+#define GIP_TSC_DELTA_SYNC2_READY            UINT32_C(0x1000)
+/** Steady (get set). */
+#define GIP_TSC_DELTA_SYNC2_STEADY           UINT32_C(0x1001)
+/** Go! */
+#define GIP_TSC_DELTA_SYNC2_GO               UINT32_C(0x1002)
+/** Used by the verfication test. */
+#define GIP_TSC_DELTA_SYNC2_GO_GO            UINT32_C(0x1003)
+
+/** We reached the time limit. */
+#define GIP_TSC_DELTA_SYNC2_TIMEOUT          UINT32_C(0x1ffe)
+/** The other party won't touch the sync struct ever again. */
+#define GIP_TSC_DELTA_SYNC2_FINAL            UINT32_C(0x1fff)
+
+
+/**
+ * Argument package/state passed by supdrvMeasureTscDeltaOne() to the RTMpOn
+ * callback worker.
+ * @todo add
+ */
+typedef struct SUPDRVGIPTSCDELTARGS
+{
+    /** The device extension.   */
+    PSUPDRVDEVEXT               pDevExt;
+    /** Pointer to the GIP CPU array entry for the worker. */
+    PSUPGIPCPU                  pWorker;
+    /** Pointer to the GIP CPU array entry for the master. */
+    PSUPGIPCPU                  pMaster;
+    /** The maximum number of ticks to spend in supdrvMeasureTscDeltaCallback.
+     * (This is what we need a rough TSC frequency for.)  */
+    uint64_t                    cMaxTscTicks;
+    /** Used to abort synchronization setup. */
+    bool volatile               fAbortSetup;
+
+    /** Padding to make sure the master variables live in its own cache lines. */
+    uint64_t                    au64CacheLinePaddingBefore[GIP_TSC_DELTA_CACHE_LINE_SIZE / sizeof(uint64_t)];
+
+    /** @name Master
+     * @{ */
+    /** The time the master spent in the MP worker.  */
+    uint64_t                    cElapsedMasterTscTicks;
+    /** The iTry value when stopped at. */
+    uint32_t                    iTry;
+    /** Set if the run timed out.   */
+    bool volatile               fTimedOut;
+    /** Pointer to the master's synchronization struct (on stack). */
+    PSUPTSCDELTASYNC2 volatile  pSyncMaster;
+    /** Master data union. */
+    union
+    {
+        /** Data (master) for delta verification. */
+        struct
+        {
+            /** Verification test TSC values for the master. */
+            uint64_t volatile       auTscs[32];
+        } Verify;
+        /** Data (master) for measurement method \#2. */
+        struct
+        {
+            /** Data and sequence number. */
+            SUPDRVTSCDELTAMETHOD2   Data;
+            /** The lag setting for the next run. */
+            bool                    fLag;
+            /** Number of hits. */
+            uint32_t                cHits;
+        } M2;
+    } uMaster;
+    /** The verifier verdict, VINF_SUCCESS if ok, VERR_OUT_OF_RANGE if not,
+     * VERR_TRY_AGAIN on timeout. */
+    int32_t                     rcVerify;
+#ifdef TSCDELTA_VERIFY_WITH_STATS
+    /** The maximum difference between TSC read during delta verification. */
+    int64_t                     cMaxVerifyTscTicks;
+    /** The minimum difference between two TSC reads during verification. */
+    int64_t                     cMinVerifyTscTicks;
+    /** The bad TSC diff, worker relative to master (= worker - master).
+     * Negative value means the worker is behind the master.  */
+    int64_t                     iVerifyBadTscDiff;
+#endif
+    /** @} */
+
+    /** Padding to make sure the worker variables live is in its own cache line. */
+    uint64_t                    au64CacheLinePaddingBetween[GIP_TSC_DELTA_CACHE_LINE_SIZE / sizeof(uint64_t)];
+
+    /** @name Proletarian
+     * @{ */
+    /** Pointer to the worker's synchronization struct (on stack). */
+    PSUPTSCDELTASYNC2 volatile  pSyncWorker;
+    /** The time the worker spent in the MP worker.  */
+    uint64_t                    cElapsedWorkerTscTicks;
+    /** Worker data union. */
+    union
+    {
+        /** Data (worker) for delta verification. */
+        struct
+        {
+            /** Verification test TSC values for the worker. */
+            uint64_t volatile       auTscs[32];
+        } Verify;
+        /** Data (worker) for measurement method \#2. */
+        struct
+        {
+            /** Data and sequence number. */
+            SUPDRVTSCDELTAMETHOD2   Data;
+            /** The lag setting for the next run (set by master). */
+            bool                    fLag;
+        } M2;
+    } uWorker;
+    /** @} */
+
+    /** Padding to make sure the above is in its own cache line. */
+    uint64_t                    au64CacheLinePaddingAfter[GIP_TSC_DELTA_CACHE_LINE_SIZE / sizeof(uint64_t)];
+} SUPDRVGIPTSCDELTARGS;
+typedef SUPDRVGIPTSCDELTARGS *PSUPDRVGIPTSCDELTARGS;
+
+
+/** @name Macros that implements the basic synchronization steps common to
+ *        the algorithms.
+ *
+ * Must be used from loop as the timeouts are implemented via 'break' statements
+ * at the moment.
+ *
+ * @{
+ */
+#if defined(DEBUG_bird) /* || defined(VBOX_STRICT) */
+# define TSCDELTA_DBG_VARS()            uint32_t iDbgCounter
+# define TSCDELTA_DBG_START_LOOP()      do { iDbgCounter = 0; } while (0)
+# define TSCDELTA_DBG_CHECK_LOOP() \
+    do { iDbgCounter++; if ((iDbgCounter & UINT32_C(0x01ffffff)) == 0) RT_BREAKPOINT(); } while (0)
+#else
+# define TSCDELTA_DBG_VARS()            ((void)0)
+# define TSCDELTA_DBG_START_LOOP()      ((void)0)
+# define TSCDELTA_DBG_CHECK_LOOP()      ((void)0)
+#endif
+#if 0
+# define TSCDELTA_DBG_SYNC_MSG(a_Args)  SUPR0Printf a_Args
+#else
+# define TSCDELTA_DBG_SYNC_MSG(a_Args)  ((void)0)
+#endif
+#if 0
+# define TSCDELTA_DBG_SYNC_MSG2(a_Args) SUPR0Printf a_Args
+#else
+# define TSCDELTA_DBG_SYNC_MSG2(a_Args) ((void)0)
+#endif
+#if 0
+# define TSCDELTA_DBG_SYNC_MSG9(a_Args) SUPR0Printf a_Args
+#else
+# define TSCDELTA_DBG_SYNC_MSG9(a_Args) ((void)0)
+#endif
+
+
+static bool supdrvTscDeltaSync2_Before(PSUPTSCDELTASYNC2 pMySync, PSUPTSCDELTASYNC2 pOtherSync,
+                                       bool fIsMaster, PRTCCUINTREG pfEFlags, PSUPDRVGIPTSCDELTARGS pArgs)
+{
+    uint32_t        iMySeq  = fIsMaster ? 0 : 256;
+    uint32_t const  iMaxSeq = iMySeq + 16;  /* For the last loop, darn linux/freebsd C-ishness. */
+    uint32_t        u32Tmp;
+    uint32_t        iSync2Loops = 0;
+    RTCCUINTREG     fEFlags;
+    TSCDELTA_DBG_VARS();
+
+    *pfEFlags = X86_EFL_IF | X86_EFL_1; /* should shut up most nagging compilers. */
+
+    /*
+     * The master tells the worker to get on it's mark.
+     */
+    if (fIsMaster)
+    {
+        if (RT_LIKELY(ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_STEADY, GIP_TSC_DELTA_SYNC2_READY)))
+        { /* likely*/ }
+        else
+        {
+            TSCDELTA_DBG_SYNC_MSG(("sync/before/%s: #1 uSyncVar=%#x\n", fIsMaster ? "master" : "worker", pOtherSync->uSyncVar));
+            return false;
+        }
+    }
+
+    /*
+     * Wait for the on your mark signal (ack in the master case). We process timeouts here.
+     */
+    ASMAtomicWriteU32(&(pMySync)->uSyncSeq, 0);
+    for (;;)
+    {
+        fEFlags = ASMIntDisableFlags();
+        u32Tmp = ASMAtomicReadU32(&pMySync->uSyncVar);
+        if (u32Tmp == GIP_TSC_DELTA_SYNC2_STEADY)
+            break;
+        ASMSetFlags(fEFlags);
+        ASMNopPause();
+
+        /* Abort? */
+        if (u32Tmp != GIP_TSC_DELTA_SYNC2_READY)
+        {
+            TSCDELTA_DBG_SYNC_MSG(("sync/before/%s: #2 u32Tmp=%#x\n", fIsMaster ? "master" : "worker", u32Tmp));
+            return false;
+        }
+
+        /* Check for timeouts every so often (not every loop in case RDTSC is
+           trapping or something).  Must check the first time around. */
+#if 0 /* For debugging the timeout paths. */
+        static uint32_t volatile xxx;
+#endif
+        if (   (   (iSync2Loops & 0x3ff) == 0
+                && ASMReadTSC() - pMySync->uTscStart > pMySync->cMaxTscTicks)
+#if 0 /* This is crazy, I know, but enable this code and the results are markedly better when enabled on the 1.4GHz AMD (debug). */
+            || (!fIsMaster && (++xxx & 0xf) == 0)
+#endif
+           )
+        {
+            /* Try switch our own state into timeout mode so the master cannot tell us to 'GO',
+               ignore the timeout if we've got the go ahead already (simpler). */
+            if (ASMAtomicCmpXchgU32(&pMySync->uSyncVar, GIP_TSC_DELTA_SYNC2_TIMEOUT, GIP_TSC_DELTA_SYNC2_READY))
+            {
+                TSCDELTA_DBG_SYNC_MSG(("sync/before/%s: timeout\n", fIsMaster ? "master" : "worker"));
+                ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_TIMEOUT, GIP_TSC_DELTA_SYNC2_STEADY);
+                ASMAtomicWriteBool(&pArgs->fTimedOut, true);
+                return false;
+            }
+        }
+        iSync2Loops++;
+    }
+
+    /*
+     * Interrupts are now disabled and will remain disabled until we do
+     * TSCDELTA_MASTER_SYNC_AFTER / TSCDELTA_OTHER_SYNC_AFTER.
+     */
+    *pfEFlags = fEFlags;
+
+    /*
+     * The worker tells the master that it is on its mark and that the master
+     * need to get into position as well.
+     */
+    if (!fIsMaster)
+    {
+        if (RT_LIKELY(ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_STEADY, GIP_TSC_DELTA_SYNC2_READY)))
+        { /* likely */ }
+        else
+        {
+            ASMSetFlags(fEFlags);
+            TSCDELTA_DBG_SYNC_MSG(("sync/before/%s: #3 uSyncVar=%#x\n", fIsMaster ? "master" : "worker", pOtherSync->uSyncVar));
+            return false;
+        }
+    }
+
+    /*
+     * The master sends the 'go' to the worker and wait for ACK.
+     */
+    if (fIsMaster)
+    {
+        if (RT_LIKELY(ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_GO, GIP_TSC_DELTA_SYNC2_STEADY)))
+        { /* likely */ }
+        else
+        {
+            ASMSetFlags(fEFlags);
+            TSCDELTA_DBG_SYNC_MSG(("sync/before/%s: #4 uSyncVar=%#x\n", fIsMaster ? "master" : "worker", pOtherSync->uSyncVar));
+            return false;
+        }
+    }
+
+    /*
+     * Wait for the 'go' signal (ack in the master case).
+     */
+    TSCDELTA_DBG_START_LOOP();
+    for (;;)
+    {
+        u32Tmp = ASMAtomicReadU32(&pMySync->uSyncVar);
+        if (u32Tmp == GIP_TSC_DELTA_SYNC2_GO)
+            break;
+        if (RT_LIKELY(u32Tmp == GIP_TSC_DELTA_SYNC2_STEADY))
+        { /* likely */ }
+        else
+        {
+            ASMSetFlags(fEFlags);
+            TSCDELTA_DBG_SYNC_MSG(("sync/before/%s: #5 u32Tmp=%#x\n", fIsMaster ? "master" : "worker", u32Tmp));
+            return false;
+        }
+
+        TSCDELTA_DBG_CHECK_LOOP();
+        ASMNopPause();
+    }
+
+    /*
+     * The worker acks the 'go' (shouldn't fail).
+     */
+    if (!fIsMaster)
+    {
+        if (RT_LIKELY(ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_GO, GIP_TSC_DELTA_SYNC2_STEADY)))
+        { /* likely */ }
+        else
+        {
+            ASMSetFlags(fEFlags);
+            TSCDELTA_DBG_SYNC_MSG(("sync/before/%s: #6 uSyncVar=%#x\n", fIsMaster ? "master" : "worker", pOtherSync->uSyncVar));
+            return false;
+        }
+    }
+
+    /*
+     * Try enter mostly lockstep execution with it.
+     */
+    for (;;)
+    {
+        uint32_t iOtherSeq1, iOtherSeq2;
+        ASMCompilerBarrier();
+        ASMSerializeInstruction();
+
+        ASMAtomicWriteU32(&pMySync->uSyncSeq, iMySeq);
+        ASMNopPause();
+        iOtherSeq1 = ASMAtomicXchgU32(&pOtherSync->uSyncSeq, iMySeq);
+        ASMNopPause();
+        iOtherSeq2 = ASMAtomicReadU32(&pMySync->uSyncSeq);
+
+        ASMCompilerBarrier();
+        if (iOtherSeq1 == iOtherSeq2)
+            return true;
+
+        /* Did the other guy give up? Should we give up? */
+        if (   iOtherSeq1 == UINT32_MAX
+            || iOtherSeq2 == UINT32_MAX)
+            return true;
+        if (++iMySeq >= iMaxSeq)
+        {
+            ASMAtomicWriteU32(&pMySync->uSyncSeq, UINT32_MAX);
+            return true;
+        }
+        ASMNopPause();
+    }
+}
+
+#define TSCDELTA_MASTER_SYNC_BEFORE(a_pMySync, a_pOtherSync, a_pfEFlags, a_pArgs) \
+    if (RT_LIKELY(supdrvTscDeltaSync2_Before(a_pMySync, a_pOtherSync, true /*fIsMaster*/, a_pfEFlags, a_pArgs))) \
+    { /*likely*/ } \
+    else if (true) \
+    { \
+        TSCDELTA_DBG_SYNC_MSG9(("sync/before/master: #89\n")); \
+        break; \
+    } else do {} while (0)
+#define TSCDELTA_OTHER_SYNC_BEFORE(a_pMySync, a_pOtherSync, a_pfEFlags, a_pArgs) \
+    if (RT_LIKELY(supdrvTscDeltaSync2_Before(a_pMySync, a_pOtherSync, false /*fIsMaster*/, a_pfEFlags, a_pArgs))) \
+    { /*likely*/ } \
+    else if (true) \
+    { \
+        TSCDELTA_DBG_SYNC_MSG9(("sync/before/other: #89\n")); \
+        break; \
+    } else do {} while (0)
+
+
+static bool supdrvTscDeltaSync2_After(PSUPTSCDELTASYNC2 pMySync, PSUPTSCDELTASYNC2 pOtherSync,
+                                      bool fIsMaster, RTCCUINTREG fEFlags)
+{
+    TSCDELTA_DBG_VARS();
+
+    /*
+     * Wait for the 'ready' signal.  In the master's case, this means the
+     * worker has completed its data collection, while in the worker's case it
+     * means the master is done processing the data and it's time for the next
+     * loop iteration (or whatever).
+     */
+    ASMSetFlags(fEFlags);
+    TSCDELTA_DBG_START_LOOP();
+    for (;;)
+    {
+        uint32_t u32Tmp = ASMAtomicReadU32(&pMySync->uSyncVar);
+        if (   u32Tmp == GIP_TSC_DELTA_SYNC2_READY
+            || (u32Tmp == GIP_TSC_DELTA_SYNC2_STEADY && !fIsMaster) /* kicked twice => race */ )
+            return true;
+        ASMNopPause();
+        if (RT_LIKELY(u32Tmp == GIP_TSC_DELTA_SYNC2_GO))
+        { /* likely */}
+        else
+        {
+            TSCDELTA_DBG_SYNC_MSG(("sync/after/other: #1 u32Tmp=%#x\n", u32Tmp));
+            return false; /* shouldn't ever happen! */
+        }
+        TSCDELTA_DBG_CHECK_LOOP();
+        ASMNopPause();
+    }
+}
+
+#define TSCDELTA_MASTER_SYNC_AFTER(a_pMySync, a_pOtherSync, a_fEFlags) \
+    if (RT_LIKELY(supdrvTscDeltaSync2_After(a_pMySync, a_pOtherSync, true /*fIsMaster*/, a_fEFlags))) \
+    { /* likely */ } \
+    else if (true) \
+    { \
+        TSCDELTA_DBG_SYNC_MSG9(("sync/after/master: #97\n")); \
+        break; \
+    } else do {} while (0)
+
+#define TSCDELTA_MASTER_KICK_OTHER_OUT_OF_AFTER(a_pMySync, a_pOtherSync) \
+    /* \
+     * Tell the worker that we're done processing the data and ready for the next round. \
+     */ \
+    if (RT_LIKELY(ASMAtomicCmpXchgU32(&(a_pOtherSync)->uSyncVar, GIP_TSC_DELTA_SYNC2_READY, GIP_TSC_DELTA_SYNC2_GO))) \
+    { /* likely */ } \
+    else if (true)\
+    { \
+        TSCDELTA_DBG_SYNC_MSG(("sync/after/master: #99 uSyncVar=%#x\n", (a_pOtherSync)->uSyncVar)); \
+        break; \
+    } else do {} while (0)
+
+#define TSCDELTA_OTHER_SYNC_AFTER(a_pMySync, a_pOtherSync, a_fEFlags) \
+    if (true) { \
+        /* \
+         * Tell the master that we're done collecting data and wait for the next round to start. \
+         */ \
+        if (RT_LIKELY(ASMAtomicCmpXchgU32(&(a_pOtherSync)->uSyncVar, GIP_TSC_DELTA_SYNC2_READY, GIP_TSC_DELTA_SYNC2_GO))) \
+        { /* likely */ } \
+        else \
+        { \
+            ASMSetFlags(a_fEFlags); \
+            TSCDELTA_DBG_SYNC_MSG(("sync/after/other: #0 uSyncVar=%#x\n", (a_pOtherSync)->uSyncVar)); \
+            break; \
+        } \
+        if (RT_LIKELY(supdrvTscDeltaSync2_After(a_pMySync, a_pOtherSync, false /*fIsMaster*/, a_fEFlags))) \
+        { /* likely */ } \
+        else \
+        { \
+            TSCDELTA_DBG_SYNC_MSG9(("sync/after/other: #98\n")); \
+            break;  \
+        } \
+    } else do {} while (0)
+/** @} */
+
+
+#ifdef GIP_TSC_DELTA_METHOD_1
+/**
+ * TSC delta measurment algorithm \#1 (GIP_TSC_DELTA_METHOD_1).
+ *
+ *
+ * We ignore the first few runs of the loop in order to prime the
+ * cache. Also, we need to be careful about using 'pause' instruction
+ * in critical busy-wait loops in this code - it can cause undesired
+ * behaviour with hyperthreading.
+ *
+ * We try to minimize the measurement error by computing the minimum
+ * read time of the compare statement in the worker by taking TSC
+ * measurements across it.
+ *
+ * It must be noted that the computed minimum read time is mostly to
+ * eliminate huge deltas when the worker is too early and doesn't by
+ * itself help produce more accurate deltas. We allow two times the
+ * computed minimum as an arbibtrary acceptable threshold. Therefore,
+ * it is still possible to get negative deltas where there are none
+ * when the worker is earlier. As long as these occasional negative
+ * deltas are lower than the time it takes to exit guest-context and
+ * the OS to reschedule EMT on a different CPU we won't expose a TSC
+ * that jumped backwards. It is because of the existence of the
+ * negative deltas we don't recompute the delta with the master and
+ * worker interchanged to eliminate the remaining measurement error.
+ *
+ *
+ * @param   pArgs               The argument/state data.
+ * @param   pMySync             My synchronization structure.
+ * @param   pOtherSync          My partner's synchronization structure.
+ * @param   fIsMaster           Set if master, clear if worker.
+ * @param   iTry                The attempt number.
+ */
+static void supdrvTscDeltaMethod1Loop(PSUPDRVGIPTSCDELTARGS pArgs, PSUPTSCDELTASYNC2 pMySync, PSUPTSCDELTASYNC2 pOtherSync,
+                                      bool fIsMaster, uint32_t iTry)
+{
+    PSUPGIPCPU  pGipCpuWorker   = pArgs->pWorker;
+    PSUPGIPCPU  pGipCpuMaster   = pArgs->pMaster;
+    uint64_t    uMinCmpReadTime = UINT64_MAX;
+    unsigned    iLoop;
+    NOREF(iTry);
+
+    for (iLoop = 0; iLoop < GIP_TSC_DELTA_LOOPS; iLoop++)
+    {
+        RTCCUINTREG fEFlags;
+        if (fIsMaster)
+        {
+            /*
+             * The master.
+             */
+            AssertMsg(pGipCpuMaster->u64TSCSample == GIP_TSC_DELTA_RSVD,
+                      ("%#llx idMaster=%#x idWorker=%#x (idGipMaster=%#x)\n",
+                       pGipCpuMaster->u64TSCSample, pGipCpuMaster->idCpu, pGipCpuWorker->idCpu, pArgs->pDevExt->idGipMaster));
+            TSCDELTA_MASTER_SYNC_BEFORE(pMySync, pOtherSync, &fEFlags, pArgs);
+
+            do
+            {
+                ASMSerializeInstruction();
+                ASMAtomicWriteU64(&pGipCpuMaster->u64TSCSample, ASMReadTSC());
+            } while (pGipCpuMaster->u64TSCSample == GIP_TSC_DELTA_RSVD);
+
+            TSCDELTA_MASTER_SYNC_AFTER(pMySync, pOtherSync, fEFlags);
+
+            /* Process the data. */
+            if (iLoop > GIP_TSC_DELTA_PRIMER_LOOPS + GIP_TSC_DELTA_READ_TIME_LOOPS)
+            {
+                if (pGipCpuWorker->u64TSCSample != GIP_TSC_DELTA_RSVD)
+                {
+                    int64_t iDelta = pGipCpuWorker->u64TSCSample
+                                   - (pGipCpuMaster->u64TSCSample - pGipCpuMaster->i64TSCDelta);
+                    if (  iDelta >= GIP_TSC_DELTA_INITIAL_MASTER_VALUE
+                        ? iDelta < pGipCpuWorker->i64TSCDelta
+                        : iDelta > pGipCpuWorker->i64TSCDelta || pGipCpuWorker->i64TSCDelta == INT64_MAX)
+                        pGipCpuWorker->i64TSCDelta = iDelta;
+                }
+            }
+
+            /* Reset our TSC sample and tell the worker to move on. */
+            ASMAtomicWriteU64(&pGipCpuMaster->u64TSCSample, GIP_TSC_DELTA_RSVD);
+            TSCDELTA_MASTER_KICK_OTHER_OUT_OF_AFTER(pMySync, pOtherSync);
+        }
+        else
+        {
+            /*
+             * The worker.
+             */
+            uint64_t uTscWorker;
+            uint64_t uTscWorkerFlushed;
+            uint64_t uCmpReadTime;
+
+            ASMAtomicReadU64(&pGipCpuMaster->u64TSCSample);     /* Warm the cache line. */
+            TSCDELTA_OTHER_SYNC_BEFORE(pMySync, pOtherSync, &fEFlags, pArgs);
+
+            /*
+             * Keep reading the TSC until we notice that the master has read his. Reading
+             * the TSC -after- the master has updated the memory is way too late. We thus
+             * compensate by trying to measure how long it took for the worker to notice
+             * the memory flushed from the master.
+             */
+            do
+            {
+                ASMSerializeInstruction();
+                uTscWorker = ASMReadTSC();
+            } while (pGipCpuMaster->u64TSCSample == GIP_TSC_DELTA_RSVD);
+            ASMSerializeInstruction();
+            uTscWorkerFlushed = ASMReadTSC();
+
+            uCmpReadTime = uTscWorkerFlushed - uTscWorker;
+            if (iLoop > GIP_TSC_DELTA_PRIMER_LOOPS + GIP_TSC_DELTA_READ_TIME_LOOPS)
+            {
+                /* This is totally arbitrary a.k.a I don't like it but I have no better ideas for now. */
+                if (uCmpReadTime < (uMinCmpReadTime << 1))
+                {
+                    ASMAtomicWriteU64(&pGipCpuWorker->u64TSCSample, uTscWorker);
+                    if (uCmpReadTime < uMinCmpReadTime)
+                        uMinCmpReadTime = uCmpReadTime;
+                }
+                else
+                    ASMAtomicWriteU64(&pGipCpuWorker->u64TSCSample, GIP_TSC_DELTA_RSVD);
+            }
+            else if (iLoop > GIP_TSC_DELTA_PRIMER_LOOPS)
+            {
+                if (uCmpReadTime < uMinCmpReadTime)
+                    uMinCmpReadTime = uCmpReadTime;
+            }
+
+            TSCDELTA_OTHER_SYNC_AFTER(pMySync, pOtherSync, fEFlags);
+        }
+    }
+
+    TSCDELTA_DBG_SYNC_MSG9(("sync/method1loop/%s: #92 iLoop=%u MyState=%#x\n", fIsMaster ? "master" : "worker", iLoop,
+                           pMySync->uSyncVar));
+
+    /*
+     * We must reset the worker TSC sample value in case it gets picked as a
+     * GIP master later on (it's trashed above, naturally).
+     */
+    if (!fIsMaster)
+        ASMAtomicWriteU64(&pGipCpuWorker->u64TSCSample, GIP_TSC_DELTA_RSVD);
+}
+#endif /* GIP_TSC_DELTA_METHOD_1 */
+
+
+#ifdef GIP_TSC_DELTA_METHOD_2
+/*
+ * TSC delta measurement algorithm \#2 configuration and code - Experimental!!
+ */
+
+# define GIP_TSC_DELTA_M2_LOOPS             (7 + GIP_TSC_DELTA_M2_PRIMER_LOOPS)
+# define GIP_TSC_DELTA_M2_PRIMER_LOOPS      0
+
+
+static void supdrvTscDeltaMethod2ProcessDataOnMaster(PSUPDRVGIPTSCDELTARGS pArgs, uint32_t iLoop)
+{
+    int64_t     iMasterTscDelta  = pArgs->pMaster->i64TSCDelta;
+    int64_t     iBestDelta       = pArgs->pWorker->i64TSCDelta;
+    uint32_t    idxResult;
+    uint32_t    cHits            = 0;
+
+    /*
+     * Look for matching entries in the master and worker tables.
+     */
+    for (idxResult = 0; idxResult < RT_ELEMENTS(pArgs->uMaster.M2.Data.aResults); idxResult++)
+    {
+        uint32_t idxOther = pArgs->uMaster.M2.Data.aResults[idxResult].iSeqOther;
+        if (idxOther & 1)
+        {
+            idxOther >>= 1;
+            if (idxOther < RT_ELEMENTS(pArgs->uWorker.M2.Data.aResults))
+            {
+                if (pArgs->uWorker.M2.Data.aResults[idxOther].iSeqOther == pArgs->uMaster.M2.Data.aResults[idxResult].iSeqMine)
+                {
+                    int64_t iDelta;
+                    iDelta = pArgs->uWorker.M2.Data.aResults[idxOther].uTsc
+                           - (pArgs->uMaster.M2.Data.aResults[idxResult].uTsc - iMasterTscDelta);
+                    if (  iDelta >= GIP_TSC_DELTA_INITIAL_MASTER_VALUE
+                        ? iDelta < iBestDelta
+                        : iDelta > iBestDelta || iBestDelta == INT64_MAX)
+                        iBestDelta = iDelta;
+                    cHits++;
+                }
+            }
+        }
+    }
+
+    /*
+     * Save the results.
+     */
+    if (cHits > 2)
+        pArgs->pWorker->i64TSCDelta = iBestDelta;
+    pArgs->uMaster.M2.cHits += cHits;
+}
+
+
+/**
+ * The core function of the 2nd TSC delta mesurment algorithm.
+ *
+ * The idea here is that we have the two CPUs execute the exact same code
+ * collecting a largish set of TSC samples.  The code has one data dependency on
+ * the other CPU which intention it is to synchronize the execution as well as
+ * help cross references the two sets of TSC samples (the sequence numbers).
+ *
+ * The @a fLag parameter is used to modify the execution a tiny bit on one or
+ * both of the CPUs.  When @a fLag differs between the CPUs, it is thought that
+ * it will help with making the CPUs enter lock step execution occationally.
+ *
+ */
+static void supdrvTscDeltaMethod2CollectData(PSUPDRVTSCDELTAMETHOD2 pMyData, uint32_t volatile *piOtherSeqNo, bool fLag)
+{
+    SUPDRVTSCDELTAMETHOD2ENTRY *pEntry = &pMyData->aResults[0];
+    uint32_t                    cLeft  = RT_ELEMENTS(pMyData->aResults);
+
+    ASMAtomicWriteU32(&pMyData->iCurSeqNo, 0);
+    ASMSerializeInstruction();
+    while (cLeft-- > 0)
+    {
+        uint64_t uTsc;
+        uint32_t iSeqMine  = ASMAtomicIncU32(&pMyData->iCurSeqNo);
+        uint32_t iSeqOther = ASMAtomicReadU32(piOtherSeqNo);
+        ASMCompilerBarrier();
+        ASMSerializeInstruction(); /* Way better result than with ASMMemoryFenceSSE2() in this position! */
+        uTsc = ASMReadTSC();
+        ASMAtomicIncU32(&pMyData->iCurSeqNo);
+        ASMCompilerBarrier();
+        ASMSerializeInstruction();
+        pEntry->iSeqMine  = iSeqMine;
+        pEntry->iSeqOther = iSeqOther;
+        pEntry->uTsc      = uTsc;
+        pEntry++;
+        ASMSerializeInstruction();
+        if (fLag)
+            ASMNopPause();
+    }
+}
+
+
+/**
+ * TSC delta measurment algorithm \#2 (GIP_TSC_DELTA_METHOD_2).
+ *
+ * See supdrvTscDeltaMethod2CollectData for algorithm details.
+ *
+ * @param   pArgs               The argument/state data.
+ * @param   pMySync             My synchronization structure.
+ * @param   pOtherSync          My partner's synchronization structure.
+ * @param   fIsMaster           Set if master, clear if worker.
+ * @param   iTry                The attempt number.
+ */
+static void supdrvTscDeltaMethod2Loop(PSUPDRVGIPTSCDELTARGS pArgs, PSUPTSCDELTASYNC2 pMySync, PSUPTSCDELTASYNC2 pOtherSync,
+                                      bool fIsMaster, uint32_t iTry)
+{
+    unsigned iLoop;
+
+    for (iLoop = 0; iLoop < GIP_TSC_DELTA_M2_LOOPS; iLoop++)
+    {
+        RTCCUINTREG fEFlags;
+        if (fIsMaster)
+        {
+            /*
+             * Adjust the loop lag fudge.
+             */
+# if GIP_TSC_DELTA_M2_PRIMER_LOOPS > 0
+            if (iLoop < GIP_TSC_DELTA_M2_PRIMER_LOOPS)
+            {
+                /* Lag during the priming to be nice to everyone.. */
+                pArgs->uMaster.M2.fLag = true;
+                pArgs->uWorker.M2.fLag = true;
+            }
+            else
+# endif
+            if (iLoop < (GIP_TSC_DELTA_M2_LOOPS - GIP_TSC_DELTA_M2_PRIMER_LOOPS) / 4)
+            {
+                /* 25 % of the body without lagging. */
+                pArgs->uMaster.M2.fLag = false;
+                pArgs->uWorker.M2.fLag = false;
+            }
+            else if (iLoop < (GIP_TSC_DELTA_M2_LOOPS - GIP_TSC_DELTA_M2_PRIMER_LOOPS) / 4 * 2)
+            {
+                /* 25 % of the body with both lagging. */
+                pArgs->uMaster.M2.fLag = true;
+                pArgs->uWorker.M2.fLag = true;
+            }
+            else
+            {
+                /* 50% of the body with alternating lag. */
+                pArgs->uMaster.M2.fLag = (iLoop & 1) == 0;
+                pArgs->uWorker.M2.fLag= (iLoop & 1) == 1;
+            }
+
+            /*
+             * Sync up with the worker and collect data.
+             */
+            TSCDELTA_MASTER_SYNC_BEFORE(pMySync, pOtherSync, &fEFlags, pArgs);
+            supdrvTscDeltaMethod2CollectData(&pArgs->uMaster.M2.Data, &pArgs->uWorker.M2.Data.iCurSeqNo, pArgs->uMaster.M2.fLag);
+            TSCDELTA_MASTER_SYNC_AFTER(pMySync, pOtherSync, fEFlags);
+
+            /*
+             * Process the data.
+             */
+# if GIP_TSC_DELTA_M2_PRIMER_LOOPS > 0
+            if (iLoop >= GIP_TSC_DELTA_M2_PRIMER_LOOPS)
+# endif
+                supdrvTscDeltaMethod2ProcessDataOnMaster(pArgs, iLoop);
+
+            TSCDELTA_MASTER_KICK_OTHER_OUT_OF_AFTER(pMySync, pOtherSync);
+        }
+        else
+        {
+            /*
+             * The worker.
+             */
+            TSCDELTA_OTHER_SYNC_BEFORE(pMySync, pOtherSync, &fEFlags, pArgs);
+            supdrvTscDeltaMethod2CollectData(&pArgs->uWorker.M2.Data, &pArgs->uMaster.M2.Data.iCurSeqNo, pArgs->uWorker.M2.fLag);
+            TSCDELTA_OTHER_SYNC_AFTER(pMySync, pOtherSync, fEFlags);
+        }
+    }
+}
+
+#endif /* GIP_TSC_DELTA_METHOD_2 */
+
+
+
+static int supdrvTscDeltaVerify(PSUPDRVGIPTSCDELTARGS pArgs, PSUPTSCDELTASYNC2 pMySync,
+                                PSUPTSCDELTASYNC2 pOtherSync, bool fIsMaster, int64_t iWorkerTscDelta)
+{
+    /*PSUPGIPCPU pGipCpuWorker = pArgs->pWorker; - unused */
+    PSUPGIPCPU pGipCpuMaster = pArgs->pMaster;
+    uint32_t   i;
+    TSCDELTA_DBG_VARS();
+
+    for (;;)
+    {
+        RTCCUINTREG fEFlags;
+        AssertCompile((RT_ELEMENTS(pArgs->uMaster.Verify.auTscs) & 1) == 0);
+        AssertCompile(RT_ELEMENTS(pArgs->uMaster.Verify.auTscs) == RT_ELEMENTS(pArgs->uWorker.Verify.auTscs));
+
+        if (fIsMaster)
+        {
+            uint64_t uTscWorker;
+            TSCDELTA_MASTER_SYNC_BEFORE(pMySync, pOtherSync, &fEFlags, pArgs);
+
+            /*
+             * Collect TSC, master goes first.
+             */
+            for (i = 0; i < RT_ELEMENTS(pArgs->uMaster.Verify.auTscs); i += 2)
+            {
+                /* Read, kick & wait #1. */
+                uint64_t register uTsc = ASMReadTSC();
+                ASMAtomicWriteU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_GO_GO);
+                ASMSerializeInstruction();
+                pArgs->uMaster.Verify.auTscs[i] = uTsc;
+                TSCDELTA_DBG_START_LOOP();
+                while (ASMAtomicReadU32(&pMySync->uSyncVar) == GIP_TSC_DELTA_SYNC2_GO)
+                {
+                    TSCDELTA_DBG_CHECK_LOOP();
+                    ASMNopPause();
+                }
+
+                /* Read, kick & wait #2. */
+                uTsc = ASMReadTSC();
+                ASMAtomicWriteU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_GO);
+                ASMSerializeInstruction();
+                pArgs->uMaster.Verify.auTscs[i + 1] = uTsc;
+                TSCDELTA_DBG_START_LOOP();
+                while (ASMAtomicReadU32(&pMySync->uSyncVar) == GIP_TSC_DELTA_SYNC2_GO_GO)
+                {
+                    TSCDELTA_DBG_CHECK_LOOP();
+                    ASMNopPause();
+                }
+            }
+
+            TSCDELTA_MASTER_SYNC_AFTER(pMySync, pOtherSync, fEFlags);
+
+            /*
+             * Process the data.
+             */
+#ifdef TSCDELTA_VERIFY_WITH_STATS
+            pArgs->cMaxVerifyTscTicks = INT64_MIN;
+            pArgs->cMinVerifyTscTicks = INT64_MAX;
+            pArgs->iVerifyBadTscDiff  = 0;
+#endif
+            ASMAtomicWriteS32(&pArgs->rcVerify, VINF_SUCCESS);
+            uTscWorker = 0;
+            for (i = 0; i < RT_ELEMENTS(pArgs->uMaster.Verify.auTscs); i++)
+            {
+                /* Master vs previous worker entry. */
+                uint64_t uTscMaster = pArgs->uMaster.Verify.auTscs[i] - pGipCpuMaster->i64TSCDelta;
+                int64_t  iDiff;
+                if (i > 0)
+                {
+                    iDiff = uTscMaster - uTscWorker;
+#ifdef TSCDELTA_VERIFY_WITH_STATS
+                    if (iDiff > pArgs->cMaxVerifyTscTicks)
+                        pArgs->cMaxVerifyTscTicks = iDiff;
+                    if (iDiff < pArgs->cMinVerifyTscTicks)
+                        pArgs->cMinVerifyTscTicks = iDiff;
+#endif
+                    if (iDiff < 0)
+                    {
+#ifdef TSCDELTA_VERIFY_WITH_STATS
+                        pArgs->iVerifyBadTscDiff = -iDiff;
+#endif
+                        ASMAtomicWriteS32(&pArgs->rcVerify, VERR_OUT_OF_RANGE);
+                        break;
+                    }
+                }
+
+                /* Worker vs master. */
+                uTscWorker = pArgs->uWorker.Verify.auTscs[i] - iWorkerTscDelta;
+                iDiff = uTscWorker - uTscMaster;
+#ifdef TSCDELTA_VERIFY_WITH_STATS
+                if (iDiff > pArgs->cMaxVerifyTscTicks)
+                    pArgs->cMaxVerifyTscTicks = iDiff;
+                if (iDiff < pArgs->cMinVerifyTscTicks)
+                    pArgs->cMinVerifyTscTicks = iDiff;
+#endif
+                if (iDiff < 0)
+                {
+#ifdef TSCDELTA_VERIFY_WITH_STATS
+                    pArgs->iVerifyBadTscDiff = iDiff;
+#endif
+                    ASMAtomicWriteS32(&pArgs->rcVerify, VERR_OUT_OF_RANGE);
+                    break;
+                }
+            }
+
+            /* Done. */
+            TSCDELTA_MASTER_KICK_OTHER_OUT_OF_AFTER(pMySync, pOtherSync);
+        }
+        else
+        {
+            /*
+             * The worker, master leads.
+             */
+            TSCDELTA_OTHER_SYNC_BEFORE(pMySync, pOtherSync, &fEFlags, pArgs);
+
+            for (i = 0; i < RT_ELEMENTS(pArgs->uWorker.Verify.auTscs); i += 2)
+            {
+                uint64_t register uTsc;
+
+                /* Wait, Read and Kick #1. */
+                TSCDELTA_DBG_START_LOOP();
+                while (ASMAtomicReadU32(&pMySync->uSyncVar) == GIP_TSC_DELTA_SYNC2_GO)
+                {
+                    TSCDELTA_DBG_CHECK_LOOP();
+                    ASMNopPause();
+                }
+                uTsc = ASMReadTSC();
+                ASMAtomicWriteU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_GO_GO);
+                ASMSerializeInstruction();
+                pArgs->uWorker.Verify.auTscs[i] = uTsc;
+
+                /* Wait, Read and Kick #2. */
+                TSCDELTA_DBG_START_LOOP();
+                while (ASMAtomicReadU32(&pMySync->uSyncVar) == GIP_TSC_DELTA_SYNC2_GO_GO)
+                {
+                    TSCDELTA_DBG_CHECK_LOOP();
+                    ASMNopPause();
+                }
+                uTsc = ASMReadTSC();
+                ASMAtomicWriteU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_GO);
+                ASMSerializeInstruction();
+                pArgs->uWorker.Verify.auTscs[i + 1] = uTsc;
+            }
+
+            TSCDELTA_OTHER_SYNC_AFTER(pMySync, pOtherSync, fEFlags);
+        }
+        return pArgs->rcVerify;
+    }
+
+    /*
+     * Timed out, please retry.
+     */
+    ASMAtomicWriteS32(&pArgs->rcVerify, VERR_TRY_AGAIN);
+    return VERR_TIMEOUT;
+}
+
+
+
+/**
+ * Handles the special abort procedure during synchronization setup in
+ * supdrvMeasureTscDeltaCallbackUnwrapped().
+ *
+ * @returns 0 (dummy, ignored)
+ * @param   pArgs               Pointer to argument/state data.
+ * @param   pMySync             Pointer to my sync structure.
+ * @param   fIsMaster           Set if we're the master, clear if worker.
+ * @param   fTimeout            Set if it's a timeout.
+ */
+DECL_NO_INLINE(static, int)
+supdrvMeasureTscDeltaCallbackAbortSyncSetup(PSUPDRVGIPTSCDELTARGS pArgs, PSUPTSCDELTASYNC2 pMySync, bool fIsMaster, bool fTimeout)
+{
+    PSUPTSCDELTASYNC2 volatile *ppMySync    = fIsMaster ? &pArgs->pSyncMaster : &pArgs->pSyncWorker;
+    PSUPTSCDELTASYNC2 volatile *ppOtherSync = fIsMaster ? &pArgs->pSyncWorker : &pArgs->pSyncMaster;
+    TSCDELTA_DBG_VARS();
+
+    /*
+     * Clear our sync pointer and make sure the abort flag is set.
+     */
+    ASMAtomicWriteNullPtr(ppMySync);
+    ASMAtomicWriteBool(&pArgs->fAbortSetup, true);
+    if (fTimeout)
+        ASMAtomicWriteBool(&pArgs->fTimedOut, true);
+
+    /*
+     * Make sure the other party is out of there and won't be touching our
+     * sync state again (would cause stack corruption).
+     */
+    TSCDELTA_DBG_START_LOOP();
+    while (ASMAtomicReadPtrT(ppOtherSync, PSUPTSCDELTASYNC2) != NULL)
+    {
+        ASMNopPause();
+        ASMNopPause();
+        ASMNopPause();
+        TSCDELTA_DBG_CHECK_LOOP();
+    }
+
+    return 0;
+}
+
+
+/**
+ * This is used by supdrvMeasureInitialTscDeltas() to read the TSC on two CPUs
+ * and compute the delta between them.
+ *
+ * To reduce code size a good when timeout handling was added, a dummy return
+ * value had to be added (saves 1-3 lines per timeout case), thus this
+ * 'Unwrapped' function and the dummy 0 return value.
+ *
+ * @returns 0 (dummy, ignored)
+ * @param   idCpu       The CPU we are current scheduled on.
+ * @param   pArgs       Pointer to a parameter package.
+ *
+ * @remarks Measuring TSC deltas between the CPUs is tricky because we need to
+ *          read the TSC at exactly the same time on both the master and the
+ *          worker CPUs. Due to DMA, bus arbitration, cache locality,
+ *          contention, SMI, pipelining etc. there is no guaranteed way of
+ *          doing this on x86 CPUs.
+ */
+static int supdrvMeasureTscDeltaCallbackUnwrapped(RTCPUID idCpu, PSUPDRVGIPTSCDELTARGS pArgs)
+{
+    PSUPDRVDEVEXT               pDevExt          = pArgs->pDevExt;
+    PSUPGIPCPU                  pGipCpuWorker    = pArgs->pWorker;
+    PSUPGIPCPU                  pGipCpuMaster    = pArgs->pMaster;
+    bool const                  fIsMaster        = idCpu == pGipCpuMaster->idCpu;
+    uint32_t                    iTry;
+    PSUPTSCDELTASYNC2 volatile *ppMySync         = fIsMaster ? &pArgs->pSyncMaster : &pArgs->pSyncWorker;
+    PSUPTSCDELTASYNC2 volatile *ppOtherSync      = fIsMaster ? &pArgs->pSyncWorker : &pArgs->pSyncMaster;
+    SUPTSCDELTASYNC2            MySync;
+    PSUPTSCDELTASYNC2           pOtherSync;
+    int                         rc;
+    TSCDELTA_DBG_VARS();
+
+    /* A bit of paranoia first. */
+    if (!pGipCpuMaster || !pGipCpuWorker)
+        return 0;
+
+    /*
+     * If the CPU isn't part of the measurement, return immediately.
+     */
+    if (   !fIsMaster
+        && idCpu != pGipCpuWorker->idCpu)
+        return 0;
+
+    /*
+     * Set up my synchronization stuff and wait for the other party to show up.
+     *
+     * We don't wait forever since the other party may be off fishing (offline,
+     * spinning with ints disables, whatever), we must play nice to the rest of
+     * the system as this context generally isn't one in which we will get
+     * preempted and we may hold up a number of lower priority interrupts.
+     */
+    ASMAtomicWriteU32(&MySync.uSyncVar, GIP_TSC_DELTA_SYNC2_PRESTART_WAIT);
+    ASMAtomicWritePtr(ppMySync, &MySync);
+    MySync.uTscStart = ASMReadTSC();
+    MySync.cMaxTscTicks = pArgs->cMaxTscTicks;
+
+    /* Look for the partner, might not be here yet... Special abort considerations. */
+    iTry = 0;
+    TSCDELTA_DBG_START_LOOP();
+    while ((pOtherSync = ASMAtomicReadPtrT(ppOtherSync, PSUPTSCDELTASYNC2)) == NULL)
+    {
+        ASMNopPause();
+        if (   ASMAtomicReadBool(&pArgs->fAbortSetup)
+            || !RTMpIsCpuOnline(fIsMaster ? pGipCpuWorker->idCpu : pGipCpuWorker->idCpu) )
+            return supdrvMeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/);
+        if (   (iTry++ & 0xff) == 0
+            && ASMReadTSC() - MySync.uTscStart > pArgs->cMaxTscTicks)
+            return supdrvMeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, true /*fTimeout*/);
+        TSCDELTA_DBG_CHECK_LOOP();
+        ASMNopPause();
+    }
+
+    /* I found my partner, waiting to be found... Special abort considerations. */
+    if (fIsMaster)
+        if (!ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_READY, GIP_TSC_DELTA_SYNC2_PRESTART_WAIT)) /* parnaoia */
+            return supdrvMeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/);
+
+    iTry = 0;
+    TSCDELTA_DBG_START_LOOP();
+    while (ASMAtomicReadU32(&MySync.uSyncVar) == GIP_TSC_DELTA_SYNC2_PRESTART_WAIT)
+    {
+        ASMNopPause();
+        if (ASMAtomicReadBool(&pArgs->fAbortSetup))
+            return supdrvMeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/);
+        if (   (iTry++ & 0xff) == 0
+            && ASMReadTSC() - MySync.uTscStart > pArgs->cMaxTscTicks)
+        {
+            if (   fIsMaster
+                && !ASMAtomicCmpXchgU32(&MySync.uSyncVar, GIP_TSC_DELTA_SYNC2_PRESTART_ABORT, GIP_TSC_DELTA_SYNC2_PRESTART_WAIT))
+                break; /* race #1: slave has moved on, handle timeout in loop instead. */
+            return supdrvMeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, true /*fTimeout*/);
+        }
+        TSCDELTA_DBG_CHECK_LOOP();
+    }
+
+    if (!fIsMaster)
+        if (!ASMAtomicCmpXchgU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_READY, GIP_TSC_DELTA_SYNC2_PRESTART_WAIT)) /* race #1 */
+            return supdrvMeasureTscDeltaCallbackAbortSyncSetup(pArgs, &MySync, fIsMaster, false /*fTimeout*/);
+
+/** @todo Add a resumable state to pArgs so we don't waste time if we time
+ *        out or something.  Timeouts are legit, any of the two CPUs may get
+ *        interrupted. */
+
+    /*
+     * Start by seeing if we have a zero delta between the two CPUs.
+     * This should normally be the case.
+     */
+    rc = supdrvTscDeltaVerify(pArgs, &MySync, pOtherSync, fIsMaster, GIP_TSC_DELTA_INITIAL_MASTER_VALUE);
+    if (RT_SUCCESS(rc))
+    {
+        if (fIsMaster)
+        {
+            ASMAtomicWriteS64(&pGipCpuWorker->i64TSCDelta, GIP_TSC_DELTA_INITIAL_MASTER_VALUE);
+            RTCpuSetDelByIndex(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->iCpuSet);
+            RTCpuSetAddByIndex(&pDevExt->TscDeltaObtainedCpuSet, pGipCpuWorker->iCpuSet);
+        }
+    }
+    /*
+     * If the verification didn't time out, do regular delta measurements.
+     * We retry this until we get a reasonable value.
+     */
+    else if (rc != VERR_TIMEOUT)
+    {
+        Assert(pGipCpuWorker->i64TSCDelta == INT64_MAX);
+        for (iTry = 0; iTry < 12; iTry++)
+        {
+            /*
+             * Check the state before we start.
+             */
+            uint32_t u32Tmp = ASMAtomicReadU32(&MySync.uSyncVar);
+            if (   u32Tmp != GIP_TSC_DELTA_SYNC2_READY
+                && (fIsMaster || u32Tmp != GIP_TSC_DELTA_SYNC2_STEADY) /* worker may be late prepping for the next round */ )
+            {
+                TSCDELTA_DBG_SYNC_MSG(("sync/loop/%s: #0 iTry=%u MyState=%#x\n", fIsMaster ? "master" : "worker", iTry, u32Tmp));
+                break;
+            }
+
+            /*
+             * Do the measurements.
+             */
+#ifdef GIP_TSC_DELTA_METHOD_1
+            supdrvTscDeltaMethod1Loop(pArgs, &MySync, pOtherSync, fIsMaster, iTry);
+#elif defined(GIP_TSC_DELTA_METHOD_2)
+            supdrvTscDeltaMethod2Loop(pArgs, &MySync, pOtherSync, fIsMaster, iTry);
+#else
+# error "huh??"
+#endif
+
+            /*
+             * Check the state.
+             */
+            u32Tmp = ASMAtomicReadU32(&MySync.uSyncVar);
+            if (   u32Tmp != GIP_TSC_DELTA_SYNC2_READY
+                && (fIsMaster || u32Tmp != GIP_TSC_DELTA_SYNC2_STEADY) /* worker may be late prepping for the next round */ )
+            {
+                if (fIsMaster)
+                    TSCDELTA_DBG_SYNC_MSG(("sync/loop/master: #1 iTry=%u MyState=%#x\n", iTry, u32Tmp));
+                else
+                    TSCDELTA_DBG_SYNC_MSG2(("sync/loop/worker: #1 iTry=%u MyState=%#x\n", iTry, u32Tmp));
+                break;
+            }
+
+            /*
+             * Success? If so, stop trying. Master decides.
+             */
+            if (fIsMaster)
+            {
+                if (pGipCpuWorker->i64TSCDelta != INT64_MAX)
+                {
+                    RTCpuSetDelByIndex(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->iCpuSet);
+                    RTCpuSetAddByIndex(&pDevExt->TscDeltaObtainedCpuSet, pGipCpuWorker->iCpuSet);
+                    TSCDELTA_DBG_SYNC_MSG2(("sync/loop/master: #9 iTry=%u MyState=%#x\n", iTry, MySync.uSyncVar));
+                    break;
+                }
+            }
+        }
+        if (fIsMaster)
+            pArgs->iTry = iTry;
+    }
+
+    /*
+     * End the synchroniziation dance.  We tell the other that we're done,
+     * then wait for the same kind of reply.
+     */
+    ASMAtomicWriteU32(&pOtherSync->uSyncVar, GIP_TSC_DELTA_SYNC2_FINAL);
+    ASMAtomicWriteNullPtr(ppMySync);
+    iTry = 0;
+    TSCDELTA_DBG_START_LOOP();
+    while (ASMAtomicReadU32(&MySync.uSyncVar) != GIP_TSC_DELTA_SYNC2_FINAL)
+    {
+        iTry++;
+        if (   iTry == 0
+            && !RTMpIsCpuOnline(fIsMaster ? pGipCpuWorker->idCpu : pGipCpuWorker->idCpu))
+            break; /* this really shouldn't happen. */
+        TSCDELTA_DBG_CHECK_LOOP();
+        ASMNopPause();
+    }
+
+    /*
+     * Collect some runtime stats.
+     */
+    if (fIsMaster)
+        pArgs->cElapsedMasterTscTicks = ASMReadTSC() - MySync.uTscStart;
+    else
+        pArgs->cElapsedWorkerTscTicks = ASMReadTSC() - MySync.uTscStart;
+    return 0;
+}
+
+/**
+ * Callback used by supdrvMeasureInitialTscDeltas() to read the TSC on two CPUs
+ * and compute the delta between them.
+ *
+ * @param   idCpu       The CPU we are current scheduled on.
+ * @param   pvUser1     Pointer to a parameter package (SUPDRVGIPTSCDELTARGS).
+ * @param   pvUser2     Unused.
+ */
+static DECLCALLBACK(void) supdrvMeasureTscDeltaCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    supdrvMeasureTscDeltaCallbackUnwrapped(idCpu, (PSUPDRVGIPTSCDELTARGS)pvUser1);
+}
+
+
+/**
+ * Measures the TSC delta between the master GIP CPU and one specified worker
+ * CPU.
+ *
+ * @returns VBox status code.
+ * @retval  VERR_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED on pure measurement
+ *          failure.
+ * @param   pDevExt         Pointer to the device instance data.
+ * @param   idxWorker       The index of the worker CPU from the GIP's array of
+ *                          CPUs.
+ *
+ * @remarks This must be called with preemption enabled!
+ */
+static int supdrvMeasureTscDeltaOne(PSUPDRVDEVEXT pDevExt, uint32_t idxWorker)
+{
+    int                 rc;
+    int                 rc2;
+    PSUPGLOBALINFOPAGE  pGip          = pDevExt->pGip;
+    RTCPUID             idMaster      = pDevExt->idGipMaster;
+    PSUPGIPCPU          pGipCpuWorker = &pGip->aCPUs[idxWorker];
+    PSUPGIPCPU          pGipCpuMaster;
+    uint32_t            iGipCpuMaster;
+
+    /* Validate input a bit. */
+    AssertReturn(pGip, VERR_INVALID_PARAMETER);
+    Assert(pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED);
+    Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+
+    /*
+     * Don't attempt measuring the delta for the GIP master.
+     */
+    if (pGipCpuWorker->idCpu == idMaster)
+    {
+        if (pGipCpuWorker->i64TSCDelta == INT64_MAX) /* This shouldn't happen, but just in case. */
+            ASMAtomicWriteS64(&pGipCpuWorker->i64TSCDelta, GIP_TSC_DELTA_INITIAL_MASTER_VALUE);
+        return VINF_SUCCESS;
+    }
+
+    /*
+     * One measurement at at time, at least for now.  We might be using
+     * broadcast IPIs so, so be nice to the rest of the system.
+     */
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    rc = RTSemMutexRequest(pDevExt->mtxTscDelta, RT_INDEFINITE_WAIT);
+#else
+    rc = RTSemFastMutexRequest(pDevExt->mtxTscDelta);
+#endif
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /*
+     * If the CPU has hyper-threading and the APIC IDs of the master and worker are adjacent,
+     * try pick a different master.  (This fudge only works with multi core systems.)
+     * ASSUMES related threads have adjacent APIC IDs.  ASSUMES two threads per core.
+     *
+     * We skip this on AMDs for now as their HTT is different from intel's and
+     * it doesn't seem to have any favorable effect on the results.
+     *
+     * If the master is offline, we need a new master too, so share the code.
+     */
+    iGipCpuMaster = supdrvGipFindCpuIndexForCpuId(pGip, idMaster);
+    AssertReturn(iGipCpuMaster < pGip->cCpus, VERR_INVALID_CPU_ID);
+    pGipCpuMaster = &pGip->aCPUs[iGipCpuMaster];
+    if (   (   (pGipCpuMaster->idApic & ~1) == (pGipCpuWorker->idApic & ~1)
+            && ASMHasCpuId()
+            && ASMIsValidStdRange(ASMCpuId_EAX(0))
+            && (ASMCpuId_EDX(1) & X86_CPUID_FEATURE_EDX_HTT)
+            && !ASMIsAmdCpu()
+            && pGip->cOnlineCpus > 2)
+        || !RTMpIsCpuOnline(idMaster) )
+    {
+        uint32_t i;
+        for (i = 0; i < pGip->cCpus; i++)
+            if (   i != iGipCpuMaster
+                && i != idxWorker
+                && pGip->aCPUs[i].enmState == SUPGIPCPUSTATE_ONLINE
+                && pGip->aCPUs[i].i64TSCDelta != INT64_MAX
+                && pGip->aCPUs[i].idCpu  != NIL_RTCPUID
+                && pGip->aCPUs[i].idCpu  != idMaster              /* paranoia starts here... */
+                && pGip->aCPUs[i].idCpu  != pGipCpuWorker->idCpu
+                && pGip->aCPUs[i].idApic != pGipCpuWorker->idApic
+                && pGip->aCPUs[i].idApic != pGipCpuMaster->idApic
+                && RTMpIsCpuOnline(pGip->aCPUs[i].idCpu))
+            {
+                iGipCpuMaster = i;
+                pGipCpuMaster = &pGip->aCPUs[i];
+                idMaster = pGipCpuMaster->idCpu;
+                break;
+            }
+    }
+
+    if (RTCpuSetIsMemberByIndex(&pGip->OnlineCpuSet, pGipCpuWorker->iCpuSet))
+    {
+        /*
+         * Initialize data package for the RTMpOnPair callback.
+         */
+        PSUPDRVGIPTSCDELTARGS pArgs = (PSUPDRVGIPTSCDELTARGS)RTMemAllocZ(sizeof(*pArgs));
+        if (pArgs)
+        {
+            pArgs->pWorker      = pGipCpuWorker;
+            pArgs->pMaster      = pGipCpuMaster;
+            pArgs->pDevExt      = pDevExt;
+            pArgs->pSyncMaster  = NULL;
+            pArgs->pSyncWorker  = NULL;
+            pArgs->cMaxTscTicks = ASMAtomicReadU64(&pGip->u64CpuHz) / 512; /* 1953 us */
+
+            /*
+             * Do the RTMpOnPair call.  We reset i64TSCDelta first so we
+             * and supdrvMeasureTscDeltaCallback can use it as a success check.
+             */
+            /** @todo Store the i64TSCDelta result in pArgs first?   Perhaps deals with
+             *        that when doing the restart loop reorg.  */
+            ASMAtomicWriteS64(&pGipCpuWorker->i64TSCDelta, INT64_MAX);
+            rc = RTMpOnPair(pGipCpuMaster->idCpu, pGipCpuWorker->idCpu, RTMPON_F_CONCURRENT_EXEC,
+                            supdrvMeasureTscDeltaCallback, pArgs, NULL);
+            if (RT_SUCCESS(rc))
+            {
+#if 0
+                SUPR0Printf("mponpair ticks: %9llu %9llu  max: %9llu  iTry: %u%s\n", pArgs->cElapsedMasterTscTicks,
+                            pArgs->cElapsedWorkerTscTicks, pArgs->cMaxTscTicks, pArgs->iTry,
+                            pArgs->fTimedOut ? " timed out" :"");
+#endif
+#if 0
+                SUPR0Printf("rcVerify=%d iVerifyBadTscDiff=%lld cMinVerifyTscTicks=%lld cMaxVerifyTscTicks=%lld\n",
+                            pArgs->rcVerify, pArgs->iVerifyBadTscDiff, pArgs->cMinVerifyTscTicks, pArgs->cMaxVerifyTscTicks);
+#endif
+                if (RT_LIKELY(pGipCpuWorker->i64TSCDelta != INT64_MAX))
+                {
+                    /*
+                     * Work the TSC delta applicability rating.  It starts
+                     * optimistic in supdrvGipInit, we downgrade it here.
+                     */
+                    SUPGIPUSETSCDELTA enmRating;
+                    if (   pGipCpuWorker->i64TSCDelta >  GIP_TSC_DELTA_THRESHOLD_ROUGHLY_ZERO
+                        || pGipCpuWorker->i64TSCDelta < -GIP_TSC_DELTA_THRESHOLD_ROUGHLY_ZERO)
+                        enmRating = SUPGIPUSETSCDELTA_NOT_ZERO;
+                    else if (   pGipCpuWorker->i64TSCDelta >  GIP_TSC_DELTA_THRESHOLD_PRACTICALLY_ZERO
+                             || pGipCpuWorker->i64TSCDelta < -GIP_TSC_DELTA_THRESHOLD_PRACTICALLY_ZERO)
+                        enmRating = SUPGIPUSETSCDELTA_ROUGHLY_ZERO;
+                    else
+                        enmRating = SUPGIPUSETSCDELTA_PRACTICALLY_ZERO;
+                    if (pGip->enmUseTscDelta < enmRating)
+                    {
+                        AssertCompile(sizeof(pGip->enmUseTscDelta) == sizeof(uint32_t));
+                        ASMAtomicWriteU32((uint32_t volatile *)&pGip->enmUseTscDelta, enmRating);
+                    }
+                }
+                else
+                    rc = VERR_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED;
+            }
+            /** @todo return try-again if we get an offline CPU error.   */
+
+            RTMemFree(pArgs);
+        }
+        else
+            rc = VERR_NO_MEMORY;
+    }
+    else
+        rc = VERR_CPU_OFFLINE;
+
+    /*
+     * We're done now.
+     */
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    rc2 = RTSemMutexRelease(pDevExt->mtxTscDelta); AssertRC(rc2);
+#else
+    rc2 = RTSemFastMutexRelease(pDevExt->mtxTscDelta); AssertRC(rc2);
+#endif
+    return rc;
+}
+
+
+/**
+ * Resets the TSC-delta related TSC samples and optionally the deltas
+ * themselves.
+ *
+ * @param   pDevExt             Pointer to the device instance data.
+ * @param   fResetTscDeltas     Whether the TSC-deltas are also to be reset.
+ *
+ * @remarks This might be called while holding a spinlock!
+ */
+static void supdrvTscResetSamples(PSUPDRVDEVEXT pDevExt, bool fResetTscDeltas)
+{
+    unsigned iCpu;
+    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+    for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
+    {
+        PSUPGIPCPU pGipCpu = &pGip->aCPUs[iCpu];
+        ASMAtomicWriteU64(&pGipCpu->u64TSCSample, GIP_TSC_DELTA_RSVD);
+        if (fResetTscDeltas)
+        {
+            RTCpuSetDelByIndex(&pDevExt->TscDeltaObtainedCpuSet, pGipCpu->iCpuSet);
+            ASMAtomicWriteS64(&pGipCpu->i64TSCDelta, INT64_MAX);
+        }
+    }
+}
+
+
+/**
+ * Picks an online CPU as the master TSC for TSC-delta computations.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         Pointer to the device instance data.
+ * @param   pidxMaster      Where to store the CPU array index of the chosen
+ *                          master. Optional, can be NULL.
+ */
+static int supdrvTscPickMaster(PSUPDRVDEVEXT pDevExt, uint32_t *pidxMaster)
+{
+    /*
+     * Pick the first CPU online as the master TSC and make it the new GIP master based
+     * on the APIC ID.
+     *
+     * Technically we can simply use "idGipMaster" but doing this gives us master as CPU 0
+     * in most cases making it nicer/easier for comparisons. It is safe to update the GIP
+     * master as this point since the sync/async timer isn't created yet.
+     */
+    unsigned iCpu;
+    uint32_t idxMaster = UINT32_MAX;
+    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+    for (iCpu = 0; iCpu < RT_ELEMENTS(pGip->aiCpuFromApicId); iCpu++)
+    {
+        uint16_t idxCpu = pGip->aiCpuFromApicId[iCpu];
+        if (idxCpu != UINT16_MAX)
+        {
+            PSUPGIPCPU pGipCpu = &pGip->aCPUs[idxCpu];
+            if (RTCpuSetIsMemberByIndex(&pGip->OnlineCpuSet, pGipCpu->iCpuSet))
+            {
+                idxMaster = idxCpu;
+                pGipCpu->i64TSCDelta = GIP_TSC_DELTA_INITIAL_MASTER_VALUE;
+                ASMAtomicWriteSize(&pDevExt->idGipMaster, pGipCpu->idCpu);
+                if (pidxMaster)
+                    *pidxMaster = idxMaster;
+                return VINF_SUCCESS;
+            }
+        }
+    }
+    return VERR_CPU_OFFLINE;
+}
+
+
+/**
+ * Performs the initial measurements of the TSC deltas between CPUs.
+ *
+ * This is called by supdrvGipCreate(), supdrvGipPowerNotificationCallback() or
+ * triggered by it if threaded.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt     Pointer to the device instance data.
+ *
+ * @remarks Must be called only after supdrvGipInitOnCpu() as this function uses
+ *          idCpu, GIP's online CPU set which are populated in
+ *          supdrvGipInitOnCpu().
+ */
+static int supdrvMeasureInitialTscDeltas(PSUPDRVDEVEXT pDevExt)
+{
+    PSUPGIPCPU pGipCpuMaster;
+    unsigned   iCpu;
+    unsigned   iOddEven;
+    PSUPGLOBALINFOPAGE pGip   = pDevExt->pGip;
+    uint32_t   idxMaster      = UINT32_MAX;
+    uint32_t   cMpOnOffEvents = ASMAtomicReadU32(&pDevExt->cMpOnOffEvents);
+
+    Assert(pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED);
+    supdrvTscResetSamples(pDevExt, true /* fClearDeltas */);
+    int rc = supdrvTscPickMaster(pDevExt, &idxMaster);
+    if (RT_FAILURE(rc))
+    {
+        SUPR0Printf("Failed to pick a CPU master for TSC-delta measurements rc=%Rrc\n", rc);
+        return rc;
+    }
+    AssertReturn(idxMaster < pGip->cCpus, VERR_INVALID_CPU_INDEX);
+    pGipCpuMaster = &pGip->aCPUs[idxMaster];
+    Assert(pDevExt->idGipMaster == pGipCpuMaster->idCpu);
+
+    /*
+     * If there is only a single CPU online we have nothing to do.
+     */
+    if (pGip->cOnlineCpus <= 1)
+    {
+        AssertReturn(pGip->cOnlineCpus > 0, VERR_INTERNAL_ERROR_5);
+        return VINF_SUCCESS;
+    }
+
+    /*
+     * Loop thru the GIP CPU array and get deltas for each CPU (except the
+     * master).   We do the CPUs with the even numbered APIC IDs first so that
+     * we've got alternative master CPUs to pick from on hyper-threaded systems.
+     */
+    for (iOddEven = 0; iOddEven < 2; iOddEven++)
+    {
+        for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
+        {
+            PSUPGIPCPU pGipCpuWorker = &pGip->aCPUs[iCpu];
+            if (   iCpu != idxMaster
+                && (iOddEven > 0 || (pGipCpuWorker->idApic & 1) == 0)
+                && RTCpuSetIsMemberByIndex(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->iCpuSet))
+            {
+                rc = supdrvMeasureTscDeltaOne(pDevExt, iCpu);
+                if (RT_FAILURE(rc))
+                {
+                    SUPR0Printf("supdrvMeasureTscDeltaOne failed. rc=%d CPU[%u].idCpu=%u Master[%u].idCpu=%u\n", rc, iCpu,
+                                pGipCpuWorker->idCpu, idxMaster, pDevExt->idGipMaster, pGipCpuMaster->idCpu);
+                    break;
+                }
+
+                if (ASMAtomicReadU32(&pDevExt->cMpOnOffEvents) != cMpOnOffEvents)
+                {
+                    SUPR0Printf("One or more CPUs transitioned between online & offline states. I'm confused, retry...\n");
+                    rc = VERR_TRY_AGAIN;
+                    break;
+                }
+            }
+        }
+    }
+
+    return rc;
+}
+
+
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+
+/**
+ * Switches the TSC-delta measurement thread into the butchered state.
+ *
+ * @returns VBox status code.
+ * @param pDevExt           Pointer to the device instance data.
+ * @param fSpinlockHeld     Whether the TSC-delta spinlock is held or not.
+ * @param pszFailed         An error message to log.
+ * @param rcFailed          The error code to exit the thread with.
+ */
+static int supdrvTscDeltaThreadButchered(PSUPDRVDEVEXT pDevExt, bool fSpinlockHeld, const char *pszFailed, int rcFailed)
+{
+    if (!fSpinlockHeld)
+        RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+
+    pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Butchered;
+    RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+    OSDBGPRINT(("supdrvTscDeltaThreadButchered: %s. rc=%Rrc\n", rcFailed));
+    return rcFailed;
+}
+
+
+/**
+ * The TSC-delta measurement thread.
+ *
+ * @returns VBox status code.
+ * @param hThread   The thread handle.
+ * @param pvUser    Opaque pointer to the device instance data.
+ */
+static DECLCALLBACK(int) supdrvTscDeltaThread(RTTHREAD hThread, void *pvUser)
+{
+    PSUPDRVDEVEXT     pDevExt = (PSUPDRVDEVEXT)pvUser;
+    uint32_t          cConsecutiveTimeouts = 0;
+    int               rc = VERR_INTERNAL_ERROR_2;
+    for (;;)
+    {
+        /*
+         * Switch on the current state.
+         */
+        SUPDRVTSCDELTATHREADSTATE enmState;
+        RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+        enmState = pDevExt->enmTscDeltaThreadState;
+        switch (enmState)
+        {
+            case kTscDeltaThreadState_Creating:
+            {
+                pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Listening;
+                rc = RTSemEventSignal(pDevExt->hTscDeltaEvent);
+                if (RT_FAILURE(rc))
+                    return supdrvTscDeltaThreadButchered(pDevExt, true /* fSpinlockHeld */, "RTSemEventSignal", rc);
+                /* fall thru */
+            }
+
+            case kTscDeltaThreadState_Listening:
+            {
+                RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+
+                /* Simple adaptive timeout. */
+                if (cConsecutiveTimeouts++ == 10)
+                {
+                    if (pDevExt->cMsTscDeltaTimeout == 1)           /* 10 ms */
+                        pDevExt->cMsTscDeltaTimeout = 10;
+                    else if (pDevExt->cMsTscDeltaTimeout == 10)     /* +100 ms */
+                        pDevExt->cMsTscDeltaTimeout = 100;
+                    else if (pDevExt->cMsTscDeltaTimeout == 100)    /* +1000 ms */
+                        pDevExt->cMsTscDeltaTimeout = 500;
+                    cConsecutiveTimeouts = 0;
+                }
+                rc = RTThreadUserWait(pDevExt->hTscDeltaThread, pDevExt->cMsTscDeltaTimeout);
+                if (   RT_FAILURE(rc)
+                    && rc != VERR_TIMEOUT)
+                    return supdrvTscDeltaThreadButchered(pDevExt, false /* fSpinlockHeld */, "RTThreadUserWait", rc);
+                RTThreadUserReset(pDevExt->hTscDeltaThread);
+                break;
+            }
+
+            case kTscDeltaThreadState_WaitAndMeasure:
+            {
+                pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Measuring;
+                rc = RTSemEventSignal(pDevExt->hTscDeltaEvent); /* (Safe on windows as long as spinlock isn't IRQ safe.) */
+                if (RT_FAILURE(rc))
+                    return supdrvTscDeltaThreadButchered(pDevExt, true /* fSpinlockHeld */, "RTSemEventSignal", rc);
+                RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+                pDevExt->cMsTscDeltaTimeout = 1;
+                RTThreadSleep(1);
+                /* fall thru */
+            }
+
+            case kTscDeltaThreadState_Measuring:
+            {
+                cConsecutiveTimeouts = 0;
+                if (pDevExt->fTscThreadRecomputeAllDeltas)
+                {
+                    int cTries = 8;
+                    int cMsWaitPerTry = 10;
+                    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+                    Assert(pGip);
+                    do
+                    {
+                        RTCpuSetCopy(&pDevExt->TscDeltaCpuSet, &pGip->OnlineCpuSet);
+                        rc = supdrvMeasureInitialTscDeltas(pDevExt);
+                        if (   RT_SUCCESS(rc)
+                            || (   RT_FAILURE(rc)
+                                && rc != VERR_TRY_AGAIN
+                                && rc != VERR_CPU_OFFLINE))
+                        {
+                            break;
+                        }
+                        RTThreadSleep(cMsWaitPerTry);
+                    } while (cTries-- > 0);
+                    pDevExt->fTscThreadRecomputeAllDeltas = false;
+                }
+                else
+                {
+                    PSUPGLOBALINFOPAGE pGip = pDevExt->pGip;
+                    unsigned iCpu;
+
+                    /* Measure TSC-deltas only for the CPUs that are in the set. */
+                    rc = VINF_SUCCESS;
+                    for (iCpu = 0; iCpu < pGip->cCpus; iCpu++)
+                    {
+                        PSUPGIPCPU pGipCpuWorker = &pGip->aCPUs[iCpu];
+                        if (RTCpuSetIsMemberByIndex(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->iCpuSet))
+                        {
+                            if (pGipCpuWorker->i64TSCDelta == INT64_MAX)
+                            {
+                                int rc2 = supdrvMeasureTscDeltaOne(pDevExt, iCpu);
+                                if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
+                                    rc = rc2;
+                            }
+                            else
+                            {
+                                /*
+                                 * The thread/someone must've called SUPR0TscDeltaMeasureBySetIndex(),
+                                 * mark the delta as fine to get the timer thread off our back.
+                                 */
+                                RTCpuSetDelByIndex(&pDevExt->TscDeltaCpuSet, pGipCpuWorker->iCpuSet);
+                                RTCpuSetAddByIndex(&pDevExt->TscDeltaObtainedCpuSet, pGipCpuWorker->iCpuSet);
+                            }
+                        }
+                    }
+                }
+                RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+                if (pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Measuring)
+                    pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Listening;
+                RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+                Assert(rc != VERR_NOT_AVAILABLE);  /* VERR_NOT_AVAILABLE is used as init value, see supdrvTscDeltaThreadInit(). */
+                ASMAtomicWriteS32(&pDevExt->rcTscDelta, rc);
+                break;
+            }
+
+            case kTscDeltaThreadState_Terminating:
+                pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Destroyed;
+                RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+                return VINF_SUCCESS;
+
+            case kTscDeltaThreadState_Butchered:
+            default:
+                return supdrvTscDeltaThreadButchered(pDevExt, true /* fSpinlockHeld */, "Invalid state", VERR_INVALID_STATE);
+        }
+    }
+
+    return rc;
+}
+
+
+/**
+ * Waits for the TSC-delta measurement thread to respond to a state change.
+ *
+ * @returns VINF_SUCCESS on success, VERR_TIMEOUT if it doesn't respond in time,
+ *          other error code on internal error.
+ *
+ * @param   pThis           Pointer to the grant service instance data.
+ * @param   enmCurState     The current state.
+ * @param   enmNewState     The new state we're waiting for it to enter.
+ */
+static int supdrvTscDeltaThreadWait(PSUPDRVDEVEXT pDevExt, SUPDRVTSCDELTATHREADSTATE enmCurState,
+                                    SUPDRVTSCDELTATHREADSTATE enmNewState)
+{
+    /*
+     * Wait a short while for the expected state transition.
+     */
+    int rc;
+    RTSemEventWait(pDevExt->hTscDeltaEvent, RT_MS_1SEC);
+    RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+    if (pDevExt->enmTscDeltaThreadState == enmNewState)
+    {
+        RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+        rc = VINF_SUCCESS;
+    }
+    else if (pDevExt->enmTscDeltaThreadState == enmCurState)
+    {
+        /*
+         * Wait longer if the state has not yet transitioned to the one we want.
+         */
+        RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+        rc = RTSemEventWait(pDevExt->hTscDeltaEvent, 50 * RT_MS_1SEC);
+        if (   RT_SUCCESS(rc)
+            || rc == VERR_TIMEOUT)
+        {
+            /*
+             * Check the state whether we've succeeded.
+             */
+            SUPDRVTSCDELTATHREADSTATE enmState;
+            RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+            enmState = pDevExt->enmTscDeltaThreadState;
+            RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+            if (enmState == enmNewState)
+                rc = VINF_SUCCESS;
+            else if (enmState == enmCurState)
+            {
+                rc = VERR_TIMEOUT;
+                OSDBGPRINT(("supdrvTscDeltaThreadWait: timed out state transition. enmState=%d enmNewState=%d\n", enmState,
+                            enmNewState));
+            }
+            else
+            {
+                rc = VERR_INTERNAL_ERROR;
+                OSDBGPRINT(("supdrvTscDeltaThreadWait: invalid state transition from %d to %d, expected %d\n", enmCurState,
+                            enmState, enmNewState));
+            }
+        }
+        else
+            OSDBGPRINT(("supdrvTscDeltaThreadWait: RTSemEventWait failed. rc=%Rrc\n", rc));
+    }
+    else
+    {
+        RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+        OSDBGPRINT(("supdrvTscDeltaThreadWait: invalid state transition from %d to %d\n", enmCurState, enmNewState));
+        rc = VERR_INTERNAL_ERROR;
+    }
+
+    return rc;
+}
+
+
+/**
+ * Signals the TSC-delta thread to start measuring TSC-deltas.
+ *
+ * @param   pDevExt     Pointer to the device instance data.
+ * @param   fForceAll   Force re-calculating TSC-deltas on all CPUs.
+ */
+static void supdrvTscDeltaThreadStartMeasurement(PSUPDRVDEVEXT pDevExt, bool fForceAll)
+{
+    if (pDevExt->hTscDeltaThread != NIL_RTTHREAD)
+    {
+        RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+        if (   pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Listening
+            || pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Measuring)
+        {
+            pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_WaitAndMeasure;
+            if (fForceAll)
+                pDevExt->fTscThreadRecomputeAllDeltas = true;
+        }
+        else if (   pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_WaitAndMeasure
+                 && fForceAll)
+            pDevExt->fTscThreadRecomputeAllDeltas = true;
+        RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+        RTThreadUserSignal(pDevExt->hTscDeltaThread);
+    }
+}
+
+
+/**
+ * Terminates the actual thread running supdrvTscDeltaThread().
+ *
+ * This is an internal worker function for supdrvTscDeltaThreadInit() and
+ * supdrvTscDeltaTerm().
+ *
+ * @param   pDevExt   Pointer to the device instance data.
+ */
+static void supdrvTscDeltaThreadTerminate(PSUPDRVDEVEXT pDevExt)
+{
+    int rc;
+    RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+    pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Terminating;
+    RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+    RTThreadUserSignal(pDevExt->hTscDeltaThread);
+    rc = RTThreadWait(pDevExt->hTscDeltaThread, 50 * RT_MS_1SEC, NULL /* prc */);
+    if (RT_FAILURE(rc))
+    {
+        /* Signal a few more times before giving up. */
+        int cTriesLeft = 5;
+        while (--cTriesLeft > 0)
+        {
+            RTThreadUserSignal(pDevExt->hTscDeltaThread);
+            rc = RTThreadWait(pDevExt->hTscDeltaThread, 2 * RT_MS_1SEC, NULL /* prc */);
+            if (rc != VERR_TIMEOUT)
+                break;
+        }
+    }
+}
+
+
+/**
+ * Initializes and spawns the TSC-delta measurement thread.
+ *
+ * A thread is required for servicing re-measurement requests from events like
+ * CPUs coming online, suspend/resume etc. as it cannot be done synchronously
+ * under all contexts on all OSs.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt           Pointer to the device instance data.
+ *
+ * @remarks Must only be called -after- initializing GIP and setting up MP
+ *          notifications!
+ */
+static int supdrvTscDeltaThreadInit(PSUPDRVDEVEXT pDevExt)
+{
+    int rc;
+    Assert(pDevExt->pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED);
+    rc = RTSpinlockCreate(&pDevExt->hTscDeltaSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, "VBoxTscSpnLck");
+    if (RT_SUCCESS(rc))
+    {
+        rc = RTSemEventCreate(&pDevExt->hTscDeltaEvent);
+        if (RT_SUCCESS(rc))
+        {
+            pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_Creating;
+            pDevExt->cMsTscDeltaTimeout = 1;
+            rc = RTThreadCreate(&pDevExt->hTscDeltaThread, supdrvTscDeltaThread, pDevExt, 0 /* cbStack */,
+                                RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "VBoxTscThread");
+            if (RT_SUCCESS(rc))
+            {
+                rc = supdrvTscDeltaThreadWait(pDevExt, kTscDeltaThreadState_Creating, kTscDeltaThreadState_Listening);
+                if (RT_SUCCESS(rc))
+                {
+                    ASMAtomicWriteS32(&pDevExt->rcTscDelta, VERR_NOT_AVAILABLE);
+                    return rc;
+                }
+
+                OSDBGPRINT(("supdrvTscDeltaInit: supdrvTscDeltaThreadWait failed. rc=%Rrc\n", rc));
+                supdrvTscDeltaThreadTerminate(pDevExt);
+            }
+            else
+                OSDBGPRINT(("supdrvTscDeltaInit: RTThreadCreate failed. rc=%Rrc\n", rc));
+            RTSemEventDestroy(pDevExt->hTscDeltaEvent);
+            pDevExt->hTscDeltaEvent = NIL_RTSEMEVENT;
+        }
+        else
+            OSDBGPRINT(("supdrvTscDeltaInit: RTSemEventCreate failed. rc=%Rrc\n", rc));
+        RTSpinlockDestroy(pDevExt->hTscDeltaSpinlock);
+        pDevExt->hTscDeltaSpinlock = NIL_RTSPINLOCK;
+    }
+    else
+        OSDBGPRINT(("supdrvTscDeltaInit: RTSpinlockCreate failed. rc=%Rrc\n", rc));
+
+    return rc;
+}
+
+
+/**
+ * Terminates the TSC-delta measurement thread and cleanup.
+ *
+ * @param   pDevExt         Pointer to the device instance data.
+ */
+static void supdrvTscDeltaTerm(PSUPDRVDEVEXT pDevExt)
+{
+    if (   pDevExt->hTscDeltaSpinlock != NIL_RTSPINLOCK
+        && pDevExt->hTscDeltaEvent != NIL_RTSEMEVENT)
+    {
+        supdrvTscDeltaThreadTerminate(pDevExt);
+    }
+
+    if (pDevExt->hTscDeltaSpinlock != NIL_RTSPINLOCK)
+    {
+        RTSpinlockDestroy(pDevExt->hTscDeltaSpinlock);
+        pDevExt->hTscDeltaSpinlock = NIL_RTSPINLOCK;
+    }
+
+    if (pDevExt->hTscDeltaEvent != NIL_RTSEMEVENT)
+    {
+        RTSemEventDestroy(pDevExt->hTscDeltaEvent);
+        pDevExt->hTscDeltaEvent = NIL_RTSEMEVENT;
+    }
+
+    ASMAtomicWriteS32(&pDevExt->rcTscDelta, VERR_NOT_AVAILABLE);
+}
+
+#endif /* SUPDRV_USE_TSC_DELTA_THREAD */
+
+/**
+ * Measure the TSC delta for the CPU given by its CPU set index.
+ *
+ * @returns VBox status code.
+ * @retval  VERR_INTERRUPTED if interrupted while waiting.
+ * @retval  VERR_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED if we were unable to get a
+ *          measurment.
+ * @retval  VERR_CPU_OFFLINE if the specified CPU is offline.
+ *
+ * @param   pSession        The caller's session.  GIP must've been mapped.
+ * @param   iCpuSet         The CPU set index of the CPU to measure.
+ * @param   fFlags          Flags, SUP_TSCDELTA_MEASURE_F_XXX.
+ * @param   cMsWaitRetry    Number of milliseconds to wait between each retry.
+ * @param   cMsWaitThread   Number of milliseconds to wait for the thread to get
+ *                          ready.
+ * @param   cTries          Number of times to try, pass 0 for the default.
+ */
+SUPR0DECL(int) SUPR0TscDeltaMeasureBySetIndex(PSUPDRVSESSION pSession, uint32_t iCpuSet, uint32_t fFlags,
+                                              RTMSINTERVAL cMsWaitRetry, RTMSINTERVAL cMsWaitThread, uint32_t cTries)
+{
+    PSUPDRVDEVEXT       pDevExt;
+    PSUPGLOBALINFOPAGE  pGip;
+    uint16_t            iGipCpu;
+    int                 rc;
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+    uint64_t            msTsStartWait;
+    uint32_t            iWaitLoop;
+#endif
+
+    /*
+     * Validate and adjust the input.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    if (!pSession->fGipReferenced)
+        return VERR_WRONG_ORDER;
+
+    pDevExt = pSession->pDevExt;
+    AssertReturn(SUP_IS_DEVEXT_VALID(pDevExt), VERR_INVALID_PARAMETER);
+
+    pGip = pDevExt->pGip;
+    AssertPtrReturn(pGip, VERR_INTERNAL_ERROR_2);
+
+    AssertReturn(iCpuSet < RTCPUSET_MAX_CPUS, VERR_INVALID_CPU_INDEX);
+    AssertReturn(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx), VERR_INVALID_CPU_INDEX);
+    iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    AssertReturn(iGipCpu < pGip->cCpus, VERR_INVALID_CPU_INDEX);
+
+    if (fFlags & ~SUP_TSCDELTA_MEASURE_F_VALID_MASK)
+        return VERR_INVALID_FLAGS;
+
+    /*
+     * The request is a noop if the TSC delta isn't being used.
+     */
+    if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ZERO_CLAIMED)
+        return VINF_SUCCESS;
+
+    if (cTries == 0)
+        cTries = 12;
+    else if (cTries > 256)
+        cTries = 256;
+
+    if (cMsWaitRetry == 0)
+        cMsWaitRetry = 2;
+    else if (cMsWaitRetry > 1000)
+        cMsWaitRetry = 1000;
+
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+    /*
+     * Has the TSC already been measured and we're not forced to redo it?
+     */
+    if (   pGip->aCPUs[iGipCpu].i64TSCDelta != INT64_MAX
+        && !(fFlags & SUP_TSCDELTA_MEASURE_F_FORCE))
+        return VINF_SUCCESS;
+
+    /*
+     * Asynchronous request? Forward it to the thread, no waiting.
+     */
+    if (fFlags & SUP_TSCDELTA_MEASURE_F_ASYNC)
+    {
+        /** @todo Async. doesn't implement options like retries, waiting. We'll need
+         *        to pass those options to the thread somehow and implement it in the
+         *        thread. Check if anyone uses/needs fAsync before implementing this. */
+        RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+        RTCpuSetAddByIndex(&pDevExt->TscDeltaCpuSet, iCpuSet);
+        if (   pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Listening
+            || pDevExt->enmTscDeltaThreadState == kTscDeltaThreadState_Measuring)
+        {
+            pDevExt->enmTscDeltaThreadState = kTscDeltaThreadState_WaitAndMeasure;
+            rc = VINF_SUCCESS;
+        }
+        else if (pDevExt->enmTscDeltaThreadState != kTscDeltaThreadState_WaitAndMeasure)
+            rc = VERR_THREAD_IS_DEAD;
+        RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+        RTThreadUserSignal(pDevExt->hTscDeltaThread);
+        return VINF_SUCCESS;
+    }
+
+    /*
+     * If a TSC-delta measurement request is already being serviced by the thread,
+     * wait 'cTries' times if a retry-timeout is provided, otherwise bail as busy.
+     */
+    msTsStartWait = RTTimeSystemMilliTS();
+    for (iWaitLoop = 0;; iWaitLoop++)
+    {
+        uint64_t cMsElapsed;
+        SUPDRVTSCDELTATHREADSTATE enmState;
+        RTSpinlockAcquire(pDevExt->hTscDeltaSpinlock);
+        enmState = pDevExt->enmTscDeltaThreadState;
+        RTSpinlockRelease(pDevExt->hTscDeltaSpinlock);
+
+        if (enmState == kTscDeltaThreadState_Measuring)
+        { /* Must wait, the thread is busy. */ }
+        else if (enmState == kTscDeltaThreadState_WaitAndMeasure)
+        { /* Must wait, this state only says what will happen next. */ }
+        else if (enmState == kTscDeltaThreadState_Terminating)
+        { /* Must wait, this state only says what should happen next. */ }
+        else
+            break; /* All other states, the thread is either idly listening or dead. */
+
+        /* Wait or fail. */
+        if (cMsWaitThread == 0)
+            return VERR_SUPDRV_TSC_DELTA_MEASUREMENT_BUSY;
+        cMsElapsed = RTTimeSystemMilliTS() - msTsStartWait;
+        if (cMsElapsed >= cMsWaitThread)
+            return VERR_SUPDRV_TSC_DELTA_MEASUREMENT_BUSY;
+
+        rc = RTThreadSleep(RT_MIN((RTMSINTERVAL)(cMsWaitThread - cMsElapsed), RT_MIN(iWaitLoop + 1, 10)));
+        if (rc == VERR_INTERRUPTED)
+            return rc;
+    }
+#endif /* SUPDRV_USE_TSC_DELTA_THREAD */
+
+    /*
+     * Try measure the TSC delta the given number of times.
+     */
+    for (;;)
+    {
+        /* Unless we're forced to measure the delta, check whether it's done already. */
+        if (   !(fFlags & SUP_TSCDELTA_MEASURE_F_FORCE)
+            && pGip->aCPUs[iGipCpu].i64TSCDelta != INT64_MAX)
+        {
+            rc = VINF_SUCCESS;
+            break;
+        }
+
+        /* Measure it. */
+        rc = supdrvMeasureTscDeltaOne(pDevExt, iGipCpu);
+        if (rc != VERR_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED)
+        {
+            Assert(pGip->aCPUs[iGipCpu].i64TSCDelta != INT64_MAX || RT_FAILURE_NP(rc));
+            break;
+        }
+
+        /* Retry? */
+        if (cTries <= 1)
+            break;
+        cTries--;
+
+        /* Always delay between retries (be nice to the rest of the system
+           and avoid the BSOD hounds). */
+        rc = RTThreadSleep(cMsWaitRetry);
+        if (rc == VERR_INTERRUPTED)
+            break;
+    }
+
+    return rc;
+}
+
+
+/**
+ * Service a TSC-delta measurement request.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         Pointer to the device instance data.
+ * @param   pSession        The support driver session.
+ * @param   pReq            Pointer to the TSC-delta measurement request.
+ */
+int VBOXCALL supdrvIOCtl_TscDeltaMeasure(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPTSCDELTAMEASURE pReq)
+{
+    uint32_t        cTries;
+    uint32_t        iCpuSet;
+    uint32_t        fFlags;
+    RTMSINTERVAL    cMsWaitRetry;
+
+    /*
+     * Validate and adjust/resolve the input so they can be passed onto SUPR0TscDeltaMeasureBySetIndex.
+     */
+    AssertPtr(pDevExt); AssertPtr(pSession); AssertPtr(pReq); /* paranoia^2 */
+
+    if (pReq->u.In.idCpu == NIL_RTCPUID)
+        return VERR_INVALID_CPU_ID;
+    iCpuSet = RTMpCpuIdToSetIndex(pReq->u.In.idCpu);
+    if (iCpuSet >= RTCPUSET_MAX_CPUS)
+        return VERR_INVALID_CPU_ID;
+
+    cTries = pReq->u.In.cRetries == 0 ? 0 : (uint32_t)pReq->u.In.cRetries + 1;
+
+    cMsWaitRetry = RT_MAX(pReq->u.In.cMsWaitRetry, 5);
+
+    fFlags = 0;
+    if (pReq->u.In.fAsync)
+        fFlags |= SUP_TSCDELTA_MEASURE_F_ASYNC;
+    if (pReq->u.In.fForce)
+        fFlags |= SUP_TSCDELTA_MEASURE_F_FORCE;
+
+    return SUPR0TscDeltaMeasureBySetIndex(pSession, iCpuSet, fFlags, cMsWaitRetry,
+                                          cTries == 0 ? 5 * RT_MS_1SEC : cMsWaitRetry * cTries /*cMsWaitThread*/,
+                                          cTries);
+}
+
+
+/**
+ * Reads TSC with delta applied.
+ *
+ * Will try to resolve delta value INT64_MAX before applying it.  This is the
+ * main purpose of this function, to handle the case where the delta needs to be
+ * determined.
+ *
+ * @returns VBox status code.
+ * @param   pDevExt         Pointer to the device instance data.
+ * @param   pSession        The support driver session.
+ * @param   pReq            Pointer to the TSC-read request.
+ */
+int VBOXCALL supdrvIOCtl_TscRead(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPTSCREAD pReq)
+{
+    PSUPGLOBALINFOPAGE pGip;
+    int rc;
+
+    /*
+     * Validate.  We require the client to have mapped GIP (no asserting on
+     * ring-3 preconditions).
+     */
+    AssertPtr(pDevExt); AssertPtr(pReq); AssertPtr(pSession); /* paranoia^2 */
+    if (pSession->GipMapObjR3 == NIL_RTR0MEMOBJ)
+        return VERR_WRONG_ORDER;
+    pGip = pDevExt->pGip;
+    AssertReturn(pGip, VERR_INTERNAL_ERROR_2);
+
+    /*
+     * We're usually here because we need to apply delta, but we shouldn't be
+     * upset if the GIP is some different mode.
+     */
+    if (pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_ZERO_CLAIMED)
+    {
+        uint32_t cTries = 0;
+        for (;;)
+        {
+            /*
+             * Start by gathering the data, using CLI for disabling preemption
+             * while we do that.
+             */
+            RTCCUINTREG fEFlags = ASMIntDisableFlags();
+            int         iCpuSet = RTMpCpuIdToSetIndex(RTMpCpuId());
+            int         iGipCpu;
+            if (RT_LIKELY(   (unsigned)iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)
+                          && (iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet]) < pGip->cCpus ))
+            {
+                int64_t i64Delta   = pGip->aCPUs[iGipCpu].i64TSCDelta;
+                pReq->u.Out.idApic = pGip->aCPUs[iGipCpu].idApic;
+                pReq->u.Out.u64AdjustedTsc = ASMReadTSC();
+                ASMSetFlags(fEFlags);
+
+                /*
+                 * If we're lucky we've got a delta, but no predicitions here
+                 * as this I/O control is normally only used when the TSC delta
+                 * is set to INT64_MAX.
+                 */
+                if (i64Delta != INT64_MAX)
+                {
+                    pReq->u.Out.u64AdjustedTsc -= i64Delta;
+                    rc = VINF_SUCCESS;
+                    break;
+                }
+
+                /* Give up after a few times. */
+                if (cTries >= 4)
+                {
+                    rc = VWRN_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED;
+                    break;
+                }
+
+                /* Need to measure the delta an try again. */
+                rc = supdrvMeasureTscDeltaOne(pDevExt, iGipCpu);
+                Assert(pGip->aCPUs[iGipCpu].i64TSCDelta != INT64_MAX || RT_FAILURE_NP(rc));
+                /** @todo should probably delay on failure... dpc watchdogs */
+            }
+            else
+            {
+                /* This really shouldn't happen. */
+                AssertMsgFailed(("idCpu=%#x iCpuSet=%#x (%d)\n", RTMpCpuId(), iCpuSet, iCpuSet));
+                pReq->u.Out.idApic = ASMGetApicId();
+                pReq->u.Out.u64AdjustedTsc = ASMReadTSC();
+                ASMSetFlags(fEFlags);
+                rc = VERR_INTERNAL_ERROR_5; /** @todo change to warning. */
+                break;
+            }
+        }
+    }
+    else
+    {
+        /*
+         * No delta to apply. Easy. Deal with preemption the lazy way.
+         */
+        RTCCUINTREG fEFlags = ASMIntDisableFlags();
+        int         iCpuSet = RTMpCpuIdToSetIndex(RTMpCpuId());
+        int         iGipCpu;
+        if (RT_LIKELY(   (unsigned)iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)
+                      && (iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet]) < pGip->cCpus ))
+            pReq->u.Out.idApic = pGip->aCPUs[iGipCpu].idApic;
+        else
+            pReq->u.Out.idApic = ASMGetApicId();
+        pReq->u.Out.u64AdjustedTsc = ASMReadTSC();
+        ASMSetFlags(fEFlags);
+        rc = VINF_SUCCESS;
+    }
+
+    return rc;
+}
+
diff --git a/src/VBox/HostDrivers/Support/SUPDrvIOC.h b/src/VBox/HostDrivers/Support/SUPDrvIOC.h
index 8b1c865..d19bd1d 100644
--- a/src/VBox/HostDrivers/Support/SUPDrvIOC.h
+++ b/src/VBox/HostDrivers/Support/SUPDrvIOC.h
@@ -1,10 +1,10 @@
-/* $Revision: 98806 $ */
+/* $Id: SUPDrvIOC.h $ */
 /** @file
  * VirtualBox Support Driver - IOCtl definitions.
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -118,10 +118,14 @@
 /** Fast path IOCtl: VMMR0_DO_RAW_RUN */
 #define SUP_IOCTL_FAST_DO_RAW_RUN               SUP_CTL_CODE_FAST(64)
 /** Fast path IOCtl: VMMR0_DO_HM_RUN */
-#define SUP_IOCTL_FAST_DO_HM_RUN             SUP_CTL_CODE_FAST(65)
+#define SUP_IOCTL_FAST_DO_HM_RUN                SUP_CTL_CODE_FAST(65)
 /** Just a NOP call for profiling the latency of a fast ioctl call to VMMR0. */
 #define SUP_IOCTL_FAST_DO_NOP                   SUP_CTL_CODE_FAST(66)
 
+#ifdef RT_OS_DARWIN
+/** Cookie used to fend off some unwanted clients to the IOService.  */
+# define SUP_DARWIN_IOSERVICE_COOKIE            0x64726962 /* 'bird' */
+#endif
 
 
 /*******************************************************************************
@@ -208,9 +212,9 @@ typedef SUPREQHDR *PSUPREQHDR;
  *  -# When increment the major number, execute all pending work.
  *
  * @todo Pending work on next major version change:
- *          - Remove RTSpinlockReleaseNoInts.
+ *          - (nothing)
  */
-#define SUPDRV_IOC_VERSION                              0x001a000a
+#define SUPDRV_IOC_VERSION                              0x00220000
 
 /** SUP_IOCTL_COOKIE. */
 typedef struct SUPCOOKIE
@@ -398,9 +402,9 @@ typedef struct SUPLDRLOAD
         struct
         {
             /** The address of module initialization function. Similar to _DLL_InitTerm(hmod, 0). */
-            PFNR0MODULEINIT pfnModuleInit;
+            RTR0PTR pfnModuleInit;
             /** The address of module termination function. Similar to _DLL_InitTerm(hmod, 1). */
-            PFNR0MODULETERM pfnModuleTerm;
+            RTR0PTR pfnModuleTerm;
             /** Special entry points. */
             union
             {
@@ -522,6 +526,7 @@ typedef struct SUPLDRGETSYMBOL
  * @{
  */
 #define SUP_IOCTL_CALL_VMMR0(cbReq)                     SUP_CTL_CODE_SIZE(7, SUP_IOCTL_CALL_VMMR0_SIZE(cbReq))
+#define SUP_IOCTL_CALL_VMMR0_NO_SIZE()                  SUP_CTL_CODE_SIZE(7, 0)
 #define SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)                RT_UOFFSETOF(SUPCALLVMMR0, abReqPkt[cbReq])
 #define SUP_IOCTL_CALL_VMMR0_SIZE_IN(cbReq)             SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
 #define SUP_IOCTL_CALL_VMMR0_SIZE_OUT(cbReq)            SUP_IOCTL_CALL_VMMR0_SIZE(cbReq)
@@ -982,6 +987,7 @@ typedef struct SUPGIPUNMAP
  * @{
  */
 #define SUP_IOCTL_CALL_SERVICE(cbReq)                   SUP_CTL_CODE_SIZE(22, SUP_IOCTL_CALL_SERVICE_SIZE(cbReq))
+#define SUP_IOCTL_CALL_SERVICE_NO_SIZE()                SUP_CTL_CODE_SIZE(22, 0)
 #define SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)              RT_UOFFSETOF(SUPCALLSERVICE, abReqPkt[cbReq])
 #define SUP_IOCTL_CALL_SERVICE_SIZE_IN(cbReq)           SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
 #define SUP_IOCTL_CALL_SERVICE_SIZE_OUT(cbReq)          SUP_IOCTL_CALL_SERVICE_SIZE(cbReq)
@@ -1012,6 +1018,7 @@ typedef struct SUPCALLSERVICE
  * @{
  */
 #define SUP_IOCTL_LOGGER_SETTINGS(cbStrTab)             SUP_CTL_CODE_SIZE(23, SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab))
+#define SUP_IOCTL_LOGGER_SETTINGS_NO_SIZE()             SUP_CTL_CODE_SIZE(23, 0)
 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE(cbStrTab)        RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_IN(cbStrTab)     RT_UOFFSETOF(SUPLOGGERSETTINGS, u.In.szStrings[cbStrTab])
 #define SUP_IOCTL_LOGGER_SETTINGS_SIZE_OUT              sizeof(SUPREQHDR)
@@ -1360,6 +1367,111 @@ typedef struct SUPTRACERUMODFIREPROBE
 /** @} */
 
 
+/** @name SUP_IOCTL_MSR_PROBER
+ * MSR probing interface, not available in normal builds.
+ *
+ * @{
+ */
+#define SUP_IOCTL_MSR_PROBER                        SUP_CTL_CODE_SIZE(34, SUP_IOCTL_MSR_PROBER_SIZE)
+#define SUP_IOCTL_MSR_PROBER_SIZE                   sizeof(SUPMSRPROBER)
+#define SUP_IOCTL_MSR_PROBER_SIZE_IN                sizeof(SUPMSRPROBER)
+#define SUP_IOCTL_MSR_PROBER_SIZE_OUT               sizeof(SUPMSRPROBER)
+
+typedef enum SUPMSRPROBEROP
+{
+    SUPMSRPROBEROP_INVALID = 0,                     /**< The customary invalid zero value. */
+    SUPMSRPROBEROP_READ,                            /**< Read an MSR. */
+    SUPMSRPROBEROP_WRITE,                           /**< Write a value to an MSR (use with care!). */
+    SUPMSRPROBEROP_MODIFY,                          /**< Read-modify-restore-flushall. */
+    SUPMSRPROBEROP_MODIFY_FASTER,                   /**< Read-modify-restore, skip the flushing. */
+    SUPMSRPROBEROP_END,                             /**< End of valid values. */
+    SUPMSRPROBEROP_32BIT_HACK = 0x7fffffff          /**< The customary 32-bit type hack. */
+} SUPMSRPROBEROP;
+
+typedef struct SUPMSRPROBER
+{
+    /** The header. */
+    SUPREQHDR               Hdr;
+
+    /** Input/output union. */
+    union
+    {
+        /** Inputs.  */
+        struct
+        {
+            /** The operation. */
+            SUPMSRPROBEROP          enmOp;
+            /** The MSR to test. */
+            uint32_t                uMsr;
+            /** The CPU to perform the operation on.
+             * Use UINT32_MAX to indicate that any CPU will do. */
+            uint32_t                idCpu;
+            /** Alignment padding. */
+            uint32_t                u32Padding;
+            /** Operation specific arguments. */
+            union
+            {
+                /* SUPMSRPROBEROP_READ takes no extra arguments. */
+
+                /** For SUPMSRPROBEROP_WRITE. */
+                struct
+                {
+                    /** The value to write. */
+                    uint64_t        uToWrite;
+                } Write;
+
+                /** For SUPMSRPROBEROP_MODIFY and SUPMSRPROBEROP_MODIFY_FASTER. */
+                struct
+                {
+                    /** The value to AND the current MSR value with to construct the value to
+                     *  write.  This applied first. */
+                    uint64_t        fAndMask;
+                    /** The value to OR the result of the above mentioned AND operation with
+                     * attempting to modify the MSR. */
+                    uint64_t        fOrMask;
+                } Modify;
+
+                /** Reserve space for the future.. */
+                uint64_t        auPadding[3];
+            } uArgs;
+        } In;
+
+        /** Outputs. */
+        struct
+        {
+            /** Operation specific results. */
+            union
+            {
+                /** For SUPMSRPROBEROP_READ. */
+                struct
+                {
+                    /** The value we've read. */
+                    uint64_t        uValue;
+                    /** Set if we GPed while reading it. */
+                    bool            fGp;
+                } Read;
+
+                /** For SUPMSRPROBEROP_WRITE. */
+                struct
+                {
+                    /** Set if we GPed while writing it. */
+                    bool            fGp;
+                } Write;
+
+                /** For SUPMSRPROBEROP_MODIFY and SUPMSRPROBEROP_MODIFY_FASTER. */
+                SUPMSRPROBERMODIFYRESULT Modify;
+
+                /** Size padding/aligning. */
+                uint64_t        auPadding[5];
+            } uResults;
+        } Out;
+    } u;
+} SUPMSRPROBER, *PSUPMSRPROBER;
+AssertCompileMemberAlignment(SUPMSRPROBER, u, 8);
+AssertCompileMemberAlignment(SUPMSRPROBER, u.In.uArgs, 8);
+AssertCompileMembersSameSizeAndOffset(SUPMSRPROBER, u.In, SUPMSRPROBER, u.Out);
+/** @} */
+
 /** @name SUP_IOCTL_RESUME_SUSPENDED_KBDS
  * Resume suspended keyboard devices if any found in the system.
  *
@@ -1372,6 +1484,80 @@ typedef struct SUPTRACERUMODFIREPROBE
 /** @} */
 
 
+/** @name SUP_IOCTL_TSC_DELTA_MEASURE
+ * Measure the TSC-delta between the specified CPU and the master TSC.
+ *
+ * To call this I/O control, the client must first have mapped the GIP.
+ *
+ * @{
+ */
+#define SUP_IOCTL_TSC_DELTA_MEASURE                     SUP_CTL_CODE_SIZE(36, SUP_IOCTL_TSC_DELTA_MEASURE_SIZE)
+#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE                sizeof(SUPTSCDELTAMEASURE)
+#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_IN             sizeof(SUPTSCDELTAMEASURE)
+#define SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_OUT            sizeof(SUPREQHDR)
+typedef struct SUPTSCDELTAMEASURE
+{
+    /** The header. */
+    SUPREQHDR               Hdr;
+
+    /** Input/output union. */
+    union
+    {
+        struct
+        {
+            /** Which CPU to take the TSC-delta measurement for. */
+            RTCPUID         idCpu;
+            /** Number of times to retry on failure (specify 0 for default). */
+            uint8_t         cRetries;
+            /** Number of milliseconds to wait before each retry. */
+            uint8_t         cMsWaitRetry;
+            /** Whether to force taking a measurement if one exists already. */
+            bool            fForce;
+            /** Whether to do the measurement asynchronously (if possible). */
+            bool            fAsync;
+        } In;
+    } u;
+} SUPTSCDELTAMEASURE, *PSUPTSCDELTAMEASURE;
+AssertCompileMemberAlignment(SUPTSCDELTAMEASURE, u, 8);
+AssertCompileSize(SUPTSCDELTAMEASURE, 6*4 + 4+1+1+1+1);
+/** @} */
+
+/** @name SUP_IOCTL_TSC_READ
+ * Reads the TSC and apply TSC-delta if applicable, determining the delta if
+ * necessary (i64TSCDelta = INT64_MAX).
+ *
+ * This latter function is the primary use case of this I/O control.  To call
+ * this I/O control, the client must first have mapped the GIP.
+ *
+ * @{
+ */
+#define SUP_IOCTL_TSC_READ                              SUP_CTL_CODE_SIZE(37, SUP_IOCTL_TSC_READ_SIZE)
+#define SUP_IOCTL_TSC_READ_SIZE                         sizeof(SUPTSCREAD)
+#define SUP_IOCTL_TSC_READ_SIZE_IN                      sizeof(SUPREQHDR)
+#define SUP_IOCTL_TSC_READ_SIZE_OUT                     sizeof(SUPTSCREAD)
+typedef struct SUPTSCREAD
+{
+    /** The header. */
+    SUPREQHDR               Hdr;
+
+    /** Input/output union. */
+    union
+    {
+        struct
+        {
+            /** The TSC after applying the relevant delta. */
+            uint64_t        u64AdjustedTsc;
+            /** The APIC Id of the CPU where the TSC was read. */
+            uint16_t        idApic;
+            /** Explicit alignment padding. */
+            uint16_t        auPadding[3];
+        } Out;
+    } u;
+} SUPTSCREAD, *PSUPTSCREAD;
+AssertCompileMemberAlignment(SUPTSCREAD, u, 8);
+AssertCompileSize(SUPTSCREAD, 6*4 + 2*8);
+/** @} */
+
 #pragma pack()                          /* paranoia */
 
 #endif
diff --git a/src/VBox/HostDrivers/Support/SUPDrvInternal.h b/src/VBox/HostDrivers/Support/SUPDrvInternal.h
index e07bff4..b7e392b 100644
--- a/src/VBox/HostDrivers/Support/SUPDrvInternal.h
+++ b/src/VBox/HostDrivers/Support/SUPDrvInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -215,12 +215,73 @@
      && pDevExt->u32Cookie == BIRD)
 
 
+/** @def SUPDRV_WITH_MSR_PROBER
+ * Enables the SUP_IOCTL_MSR_PROBER function.
+ * By default, only enabled in DEBUG builds as it's a sensitive feature.
+ */
+#if defined(DEBUG) && !defined(SUPDRV_WITH_MSR_PROBER) && !defined(SUPDRV_WITHOUT_MSR_PROBER)
+# define SUPDRV_WITH_MSR_PROBER
+#endif
+
+/** @def SUPDRV_WITHOUT_MSR_PROBER
+ * Executive overide for disabling the SUP_IOCTL_MSR_PROBER function.
+ */
+#ifdef SUPDRV_WITHOUT_MSR_PROBER
+# undef SUPDRV_WITH_MSR_PROBER
+#endif
+
+#if 1
+/**  Use a dedicated kernel thread to service TSC-delta measurement requests.
+ *   @todo Test on servers with many CPUs and sockets. */
+#define SUPDRV_USE_TSC_DELTA_THREAD
+#endif
+
 /*******************************************************************************
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
 /** Pointer to the device extension. */
 typedef struct SUPDRVDEVEXT *PSUPDRVDEVEXT;
 
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+/**
+ * TSC-delta measurement thread state machine.
+ */
+typedef enum SUPDRVTSCDELTATHREADSTATE
+{
+    /** Uninitialized/invalid value. */
+    kTscDeltaThreadState_Invalid = 0,
+    /** The thread is being created.
+     * Next state: Listening, Butchered, Terminating  */
+    kTscDeltaThreadState_Creating,
+    /** The thread is listening for events.
+     * Previous state: Creating, Measuring
+     * Next state: WaitAndMeasure, Butchered, Terminated */
+    kTscDeltaThreadState_Listening,
+    /** The thread is sleeping before starting a measurement.
+     * Previous state: Listening, Measuring
+     * Next state:     Measuring, Butchered, Terminating
+     * @remarks The thread won't enter this state on its own, it is put into this
+     *          state by the GIP timer, the CPU online callback and by the
+     *          SUP_IOCTL_TSC_DELTA_MEASURE code. */
+    kTscDeltaThreadState_WaitAndMeasure,
+    /** The thread is currently servicing a measurement request.
+     * Previous state: WaitAndMeasure
+     * Next state:     Listening, WaitAndMeasure, Terminate */
+    kTscDeltaThreadState_Measuring,
+    /** The thread is terminating.
+     * @remarks The thread won't enter this state on its own, is put into this state
+     *          by supdrvTscDeltaTerm. */
+    kTscDeltaThreadState_Terminating,
+    /** The thread is butchered due to an unexpected error.
+     * Previous State: Creating, Listening, WaitAndMeasure  */
+    kTscDeltaThreadState_Butchered,
+    /** The thread is destroyed (final).
+     * Previous state: Terminating */
+    kTscDeltaThreadState_Destroyed,
+    /** The usual 32-bit blowup hack. */
+    kTscDeltaThreadState_32BitHack = 0x7fffffff
+} SUPDRVTSCDELTATHREADSTATE;
+#endif /* SUPDRV_USE_TSC_DELTA_THREAD */
 
 /**
  * Memory reference types.
@@ -588,7 +649,10 @@ typedef struct SUPDRVDEVEXT
     /** If non-zero we've successfully called RTTimerRequestSystemGranularity(). */
     uint32_t                        u32SystemTimerGranularityGrant;
     /** The CPU id of the GIP master.
-     * This CPU is responsible for the updating the common GIP data. */
+     * This CPU is responsible for the updating the common GIP data and it is
+     * the one used to calculate TSC deltas relative to.
+     * (The initial master will have a 0 zero value, but it it goes offline the
+     * new master may have a non-zero value.) */
     RTCPUID volatile                idGipMaster;
 
     /** Component factory mutex.
@@ -633,6 +697,60 @@ typedef struct SUPDRVDEVEXT
     int32_t                         cSessions;
     /** @} */
 
+    /** @name Invariant TSC frequency refinement.
+     * @{ */
+    /** Nanosecond timestamp at the start of the TSC frequency refinement phase. */
+    uint64_t                        nsStartInvarTscRefine;
+    /** TSC reading at the start of the TSC frequency refinement phase. */
+    uint64_t                        uTscStartInvarTscRefine;
+    /** The CPU id of the CPU that u64TscAnchor was measured on. */
+    RTCPUID                         idCpuInvarTscRefine;
+    /** Pointer to the timer used to refine the TSC frequency. */
+    PRTTIMER                        pInvarTscRefineTimer;
+    /** Stop the timer on the next tick because we saw a power event. */
+    bool volatile                   fInvTscRefinePowerEvent;
+    /** @} */
+
+    /** @name TSC-delta measurement.
+     *  @{ */
+    /** Number of online/offline events, incremented each time a CPU goes online
+     *  or offline. */
+    uint32_t volatile               cMpOnOffEvents;
+    /** TSC-delta measurement mutext.
+     * At the moment, we don't want to have more than one measurement going on at
+     * any one time.  We might be using broadcast IPIs which are heavy and could
+     * perhaps get in each others way. */
+#ifdef SUPDRV_USE_MUTEX_FOR_GIP
+    RTSEMMUTEX                      mtxTscDelta;
+#else
+    RTSEMFASTMUTEX                  mtxTscDelta;
+#endif
+    /** The set of CPUs we need to take measurements for. */
+    RTCPUSET                        TscDeltaCpuSet;
+    /** The set of CPUs we have completed taken measurements for. */
+    RTCPUSET                        TscDeltaObtainedCpuSet;
+    /** @}  */
+
+#ifdef SUPDRV_USE_TSC_DELTA_THREAD
+    /** @name TSC-delta measurement thread.
+     *  @{ */
+    /** Spinlock protecting enmTscDeltaThreadState. */
+    RTSPINLOCK                      hTscDeltaSpinlock;
+    /** TSC-delta measurement thread. */
+    RTTHREAD                        hTscDeltaThread;
+    /** The event signalled during state changes to the TSC-delta thread. */
+    RTSEMEVENT                      hTscDeltaEvent;
+    /** The state of the TSC-delta measurement thread. */
+    SUPDRVTSCDELTATHREADSTATE       enmTscDeltaThreadState;
+    /** Thread timeout time before rechecking state in ms. */
+    RTMSINTERVAL                    cMsTscDeltaTimeout;
+    /** Whether the TSC-delta measurement was successful. */
+    int32_t volatile                rcTscDelta;
+    /** Tell the thread we want TSC-deltas for all CPUs with retries. */
+    bool                            fTscThreadRecomputeAllDeltas;
+    /** @} */
+#endif
+
     /*
      * Note! The non-agnostic bits must be at the very end of the structure!
      */
@@ -686,6 +804,8 @@ void VBOXCALL   supdrvOSSessionHashTabRemoved(PSUPDRVDEVEXT pDevExt, PSUPDRVSESS
 void VBOXCALL   supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession);
 bool VBOXCALL   supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc);
 bool VBOXCALL   supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt);
+bool VBOXCALL   supdrvOSAreCpusOfflinedOnSuspend(void);
+bool VBOXCALL   supdrvOSAreTscDeltasInSync(void);
 int  VBOXCALL   supdrvOSEnableVTx(bool fEnabled);
 RTCCUINTREG VBOXCALL supdrvOSChangeCR4(RTCCUINTREG fOrMask, RTCCUINTREG fAndMask);
 bool VBOXCALL   supdrvOSSuspendVTxOnCpu(void);
@@ -753,11 +873,58 @@ int  VBOXCALL   supdrvOSLdrLoad(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, c
 void VBOXCALL   supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
 
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+
+/**
+ * Tries to read an MSR.
+ *
+ * @returns One of the listed VBox status codes.
+ * @retval  VINF_SUCCESS if read successfully, value in *puValue.
+ * @retval  VERR_ACCESS_DENIED if we couldn't read it (GP).
+ * @retval  VERR_NOT_SUPPORTED if not supported.
+ *
+ * @param   uMsr                The MSR to read from.
+ * @param   idCpu               The CPU to read the MSR on. NIL_RTCPUID
+ *                              indicates any suitable CPU.
+ * @param   puValue             Where to return the value.
+ */
+int VBOXCALL    supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue);
+
+/**
+ * Tries to write an MSR.
+ *
+ * @returns One of the listed VBox status codes.
+ * @retval  VINF_SUCCESS if written successfully.
+ * @retval  VERR_ACCESS_DENIED if we couldn't write the value to it (GP).
+ * @retval  VERR_NOT_SUPPORTED if not supported.
+ *
+ * @param   uMsr                The MSR to write to.
+ * @param   idCpu               The CPU to write the MSR on. NIL_RTCPUID
+ *                              indicates any suitable CPU.
+ * @param   uValue              The value to write.
+ */
+int VBOXCALL    supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue);
+
+/**
+ * Tries to modify an MSR value.
+ *
+ * @returns One of the listed VBox status codes.
+ * @retval  VINF_SUCCESS if succeeded.
+ * @retval  VERR_NOT_SUPPORTED if not supported.
+ *
+ * @param   idCpu               The CPU to modify the MSR on. NIL_RTCPUID
+ *                              indicates any suitable CPU.
+ * @param   pReq                The request packet with input arguments and
+ *                              where to store the results.
+ */
+int VBOXCALL    supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq);
+
+#endif /* SUPDRV_WITH_MSR_PROBER */
+
 #if defined(RT_OS_DARWIN)
 int VBOXCALL    supdrvDarwinResumeSuspendedKbds(void);
 #endif
 
-
 /*******************************************************************************
 *   Shared Functions                                                           *
 *******************************************************************************/
@@ -775,6 +942,13 @@ PSUPDRVSESSION VBOXCALL supdrvSessionHashTabLookup(PSUPDRVDEVEXT pDevExt, RTPROC
 uint32_t VBOXCALL supdrvSessionRetain(PSUPDRVSESSION pSession);
 uint32_t VBOXCALL supdrvSessionRelease(PSUPDRVSESSION pSession);
 
+/* SUPDrvGip.cpp */
+int  VBOXCALL   supdrvGipCreate(PSUPDRVDEVEXT pDevExt);
+void VBOXCALL   supdrvGipDestroy(PSUPDRVDEVEXT pDevExt);
+int  VBOXCALL   supdrvIOCtl_TscDeltaMeasure(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPTSCDELTAMEASURE pReq);
+int  VBOXCALL   supdrvIOCtl_TscRead(PSUPDRVDEVEXT pDevExt, PSUPDRVSESSION pSession, PSUPTSCREAD pReq);
+
+/* SUPDrvTracer.cpp */
 int  VBOXCALL   supdrvTracerInit(PSUPDRVDEVEXT pDevExt);
 void VBOXCALL   supdrvTracerTerm(PSUPDRVDEVEXT pDevExt);
 void VBOXCALL   supdrvTracerModuleUnloading(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage);
diff --git a/src/VBox/HostDrivers/Support/SUPDrvSem.c b/src/VBox/HostDrivers/Support/SUPDrvSem.c
deleted file mode 100644
index 142cfa7..0000000
--- a/src/VBox/HostDrivers/Support/SUPDrvSem.c
+++ /dev/null
@@ -1,421 +0,0 @@
-/* $Revision: 83575 $ */
-/** @file
- * VBoxDrv - The VirtualBox Support Driver - Common OS agnostic.
- */
-
-/*
- * Copyright (C) 2006-2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#define LOG_GROUP LOG_GROUP_SUP_DRV
-#define SUPDRV_AGNOSTIC
-#include "SUPDrvInternal.h"
-
-/** @todo trim this down. */
-#include <iprt/param.h>
-#include <iprt/alloc.h>
-#include <iprt/cpuset.h>
-#include <iprt/handletable.h>
-#include <iprt/mp.h>
-#include <iprt/power.h>
-#include <iprt/process.h>
-#include <iprt/semaphore.h>
-#include <iprt/spinlock.h>
-#include <iprt/thread.h>
-#include <iprt/uuid.h>
-
-#include <VBox/param.h>
-#include <VBox/log.h>
-#include <VBox/err.h>
-
-
-/**
- * Destructor for objects created by SUPSemEventCreate.
- *
- * @param   pvObj               The object handle.
- * @param   pvUser1             The IPRT event handle.
- * @param   pvUser2             NULL.
- */
-static DECLCALLBACK(void) supR0SemEventDestructor(void *pvObj, void *pvUser1, void *pvUser2)
-{
-    Assert(pvUser2 == NULL);
-    NOREF(pvObj);
-    RTSemEventDestroy((RTSEMEVENT)pvUser1);
-}
-
-
-SUPDECL(int) SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent)
-{
-    int         rc;
-    RTSEMEVENT  hEventReal;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrReturn(phEvent, VERR_INVALID_POINTER);
-
-    /*
-     * Create the event semaphore object.
-     */
-    rc = RTSemEventCreate(&hEventReal);
-    if (RT_SUCCESS(rc))
-    {
-        void *pvObj = SUPR0ObjRegister(pSession, SUPDRVOBJTYPE_SEM_EVENT, supR0SemEventDestructor, hEventReal, NULL);
-        if (pvObj)
-        {
-            uint32_t h32;
-            rc = RTHandleTableAllocWithCtx(pSession->hHandleTable, pvObj, SUPDRV_HANDLE_CTX_EVENT, &h32);
-            if (RT_SUCCESS(rc))
-            {
-                *phEvent = (SUPSEMEVENT)(uintptr_t)h32;
-                return VINF_SUCCESS;
-            }
-            SUPR0ObjRelease(pvObj, pSession);
-        }
-        else
-            RTSemEventDestroy(hEventReal);
-    }
-    return rc;
-}
-
-
-SUPDECL(int) SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
-{
-    uint32_t    h32;
-    PSUPDRVOBJ  pObj;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    if (hEvent == NIL_SUPSEMEVENT)
-        return VINF_SUCCESS;
-    h32 = (uint32_t)(uintptr_t)hEvent;
-    if (h32 != (uintptr_t)hEvent)
-        return VERR_INVALID_HANDLE;
-
-    /*
-     * Do the job.
-     */
-    pObj = (PSUPDRVOBJ)RTHandleTableFreeWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT);
-    if (!pObj)
-        return VERR_INVALID_HANDLE;
-
-    Assert(pObj->cUsage >= 2);
-    SUPR0ObjRelease(pObj, pSession);        /* The free call above. */
-    return SUPR0ObjRelease(pObj, pSession); /* The handle table reference. */
-}
-
-
-SUPDECL(int) SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
-{
-    int         rc;
-    uint32_t    h32;
-    PSUPDRVOBJ  pObj;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    h32 = (uint32_t)(uintptr_t)hEvent;
-    if (h32 != (uintptr_t)hEvent)
-        return VERR_INVALID_HANDLE;
-    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT);
-    if (!pObj)
-        return VERR_INVALID_HANDLE;
-
-    /*
-     * Do the job.
-     */
-    rc = RTSemEventSignal((RTSEMEVENT)pObj->pvUser1);
-
-    SUPR0ObjRelease(pObj, pSession);
-    return rc;
-}
-
-
-static int supR0SemEventWaitEx(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t fFlags, uint64_t uTimeout)
-{
-    int         rc;
-    uint32_t    h32;
-    PSUPDRVOBJ  pObj;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    h32 = (uint32_t)(uintptr_t)hEvent;
-    if (h32 != (uintptr_t)hEvent)
-        return VERR_INVALID_HANDLE;
-    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT);
-    if (!pObj)
-        return VERR_INVALID_HANDLE;
-
-    /*
-     * Do the job.
-     */
-    rc = RTSemEventWaitEx((RTSEMEVENT)pObj->pvUser1, fFlags, uTimeout);
-
-    SUPR0ObjRelease(pObj, pSession);
-    return rc;
-}
-
-
-SUPDECL(int) SUPSemEventWait(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies)
-{
-    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS | RTSEMWAIT_FLAGS_UNINTERRUPTIBLE;
-    if (cMillies == RT_INDEFINITE_WAIT)
-        fFlags |= RTSEMWAIT_FLAGS_INDEFINITE;
-    return supR0SemEventWaitEx(pSession, hEvent, fFlags, cMillies);
-}
-
-
-SUPDECL(int) SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies)
-{
-    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
-    if (cMillies == RT_INDEFINITE_WAIT)
-        fFlags |= RTSEMWAIT_FLAGS_INDEFINITE;
-    return supR0SemEventWaitEx(pSession, hEvent, fFlags, cMillies);
-}
-
-
-SUPDECL(int) SUPSemEventWaitNsAbsIntr(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint64_t uNsTimeout)
-{
-    uint32_t fFlags = RTSEMWAIT_FLAGS_ABSOLUTE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
-    return supR0SemEventWaitEx(pSession, hEvent, fFlags, uNsTimeout);
-}
-
-
-SUPDECL(int) SUPSemEventWaitNsRelIntr(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint64_t cNsTimeout)
-{
-    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
-    return supR0SemEventWaitEx(pSession, hEvent, fFlags, cNsTimeout);
-}
-
-
-SUPDECL(uint32_t) SUPSemEventGetResolution(PSUPDRVSESSION pSession)
-{
-    Assert(SUP_IS_SESSION_VALID(pSession));
-    return RTSemEventGetResolution();
-}
-
-
-/**
- * Destructor for objects created by SUPSemEventMultiCreate.
- *
- * @param   pvObj               The object handle.
- * @param   pvUser1             The IPRT event handle.
- * @param   pvUser2             NULL.
- */
-static DECLCALLBACK(void) supR0SemEventMultiDestructor(void *pvObj, void *pvUser1, void *pvUser2)
-{
-    Assert(pvUser2 == NULL);
-    NOREF(pvObj);
-    RTSemEventMultiDestroy((RTSEMEVENTMULTI)pvUser1);
-}
-
-
-SUPDECL(int) SUPSemEventMultiCreate(PSUPDRVSESSION pSession, PSUPSEMEVENTMULTI phEventMulti)
-{
-    int             rc;
-    RTSEMEVENTMULTI hEventMultReal;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    AssertPtrReturn(phEventMulti, VERR_INVALID_POINTER);
-
-    /*
-     * Create the event semaphore object.
-     */
-    rc = RTSemEventMultiCreate(&hEventMultReal);
-    if (RT_SUCCESS(rc))
-    {
-        void *pvObj = SUPR0ObjRegister(pSession, SUPDRVOBJTYPE_SEM_EVENT_MULTI, supR0SemEventMultiDestructor, hEventMultReal, NULL);
-        if (pvObj)
-        {
-            uint32_t h32;
-            rc = RTHandleTableAllocWithCtx(pSession->hHandleTable, pvObj, SUPDRV_HANDLE_CTX_EVENT_MULTI, &h32);
-            if (RT_SUCCESS(rc))
-            {
-                *phEventMulti = (SUPSEMEVENTMULTI)(uintptr_t)h32;
-                return VINF_SUCCESS;
-            }
-            SUPR0ObjRelease(pvObj, pSession);
-        }
-        else
-            RTSemEventMultiDestroy(hEventMultReal);
-    }
-    return rc;
-}
-
-
-SUPDECL(int) SUPSemEventMultiClose(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti)
-{
-    uint32_t    h32;
-    PSUPDRVOBJ  pObj;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    if (hEventMulti == NIL_SUPSEMEVENTMULTI)
-        return VINF_SUCCESS;
-    h32 = (uint32_t)(uintptr_t)hEventMulti;
-    if (h32 != (uintptr_t)hEventMulti)
-        return VERR_INVALID_HANDLE;
-
-    /*
-     * Do the job.
-     */
-    pObj = (PSUPDRVOBJ)RTHandleTableFreeWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT_MULTI);
-    if (!pObj)
-        return VERR_INVALID_HANDLE;
-
-    Assert(pObj->cUsage >= 2);
-    SUPR0ObjRelease(pObj, pSession);        /* The free call above. */
-    return SUPR0ObjRelease(pObj, pSession); /* The handle table reference. */
-}
-
-
-SUPDECL(int) SUPSemEventMultiSignal(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti)
-{
-    int         rc;
-    uint32_t    h32;
-    PSUPDRVOBJ  pObj;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    h32 = (uint32_t)(uintptr_t)hEventMulti;
-    if (h32 != (uintptr_t)hEventMulti)
-        return VERR_INVALID_HANDLE;
-    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT_MULTI);
-    if (!pObj)
-        return VERR_INVALID_HANDLE;
-
-    /*
-     * Do the job.
-     */
-    rc = RTSemEventMultiSignal((RTSEMEVENTMULTI)pObj->pvUser1);
-
-    SUPR0ObjRelease(pObj, pSession);
-    return rc;
-}
-
-
-SUPDECL(int) SUPSemEventMultiReset(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti)
-{
-    int         rc;
-    uint32_t    h32;
-    PSUPDRVOBJ  pObj;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    h32 = (uint32_t)(uintptr_t)hEventMulti;
-    if (h32 != (uintptr_t)hEventMulti)
-        return VERR_INVALID_HANDLE;
-    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT_MULTI);
-    if (!pObj)
-        return VERR_INVALID_HANDLE;
-
-    /*
-     * Do the job.
-     */
-    rc = RTSemEventMultiReset((RTSEMEVENTMULTI)pObj->pvUser1);
-
-    SUPR0ObjRelease(pObj, pSession);
-    return rc;
-}
-
-
-static int supR0SemEventMultiWaitEx(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t fFlags, uint64_t uTimeout)
-{
-    int         rc;
-    uint32_t    h32;
-    PSUPDRVOBJ  pObj;
-
-    /*
-     * Input validation.
-     */
-    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
-    h32 = (uint32_t)(uintptr_t)hEventMulti;
-    if (h32 != (uintptr_t)hEventMulti)
-        return VERR_INVALID_HANDLE;
-    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT_MULTI);
-    if (!pObj)
-        return VERR_INVALID_HANDLE;
-
-    /*
-     * Do the job.
-     */
-    rc = RTSemEventMultiWaitEx((RTSEMEVENTMULTI)pObj->pvUser1, fFlags, uTimeout);
-
-    SUPR0ObjRelease(pObj, pSession);
-    return rc;
-}
-
-SUPDECL(int) SUPSemEventMultiWait(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t cMillies)
-{
-    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS | RTSEMWAIT_FLAGS_UNINTERRUPTIBLE;
-    if (cMillies == RT_INDEFINITE_WAIT)
-        fFlags |= RTSEMWAIT_FLAGS_INDEFINITE;
-    return supR0SemEventMultiWaitEx(pSession, hEventMulti, fFlags, cMillies);
-}
-
-
-
-SUPDECL(int) SUPSemEventMultiWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t cMillies)
-{
-    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
-    if (cMillies == RT_INDEFINITE_WAIT)
-        fFlags |= RTSEMWAIT_FLAGS_INDEFINITE;
-    return supR0SemEventMultiWaitEx(pSession, hEventMulti, fFlags, cMillies);
-}
-
-
-SUPDECL(int) SUPSemEventMultiWaitNsAbsIntr(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint64_t uNsTimeout)
-{
-    uint32_t fFlags = RTSEMWAIT_FLAGS_ABSOLUTE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
-    return supR0SemEventMultiWaitEx(pSession, hEventMulti, fFlags, uNsTimeout);
-}
-
-
-SUPDECL(int) SUPSemEventMultiWaitNsRelIntr(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint64_t cNsTimeout)
-{
-    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
-    return supR0SemEventMultiWaitEx(pSession, hEventMulti, fFlags, cNsTimeout);
-}
-
-
-SUPDECL(uint32_t) SUPSemEventMultiGetResolution(PSUPDRVSESSION pSession)
-{
-    Assert(SUP_IS_SESSION_VALID(pSession));
-    return RTSemEventMultiGetResolution();
-}
-
diff --git a/src/VBox/HostDrivers/Support/SUPDrvSem.cpp b/src/VBox/HostDrivers/Support/SUPDrvSem.cpp
new file mode 100644
index 0000000..7aba9f2
--- /dev/null
+++ b/src/VBox/HostDrivers/Support/SUPDrvSem.cpp
@@ -0,0 +1,421 @@
+/* $Id: SUPDrvSem.cpp $ */
+/** @file
+ * VBoxDrv - The VirtualBox Support Driver - Common OS agnostic.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_SUP_DRV
+#define SUPDRV_AGNOSTIC
+#include "SUPDrvInternal.h"
+
+/** @todo trim this down. */
+#include <iprt/param.h>
+#include <iprt/alloc.h>
+#include <iprt/cpuset.h>
+#include <iprt/handletable.h>
+#include <iprt/mp.h>
+#include <iprt/power.h>
+#include <iprt/process.h>
+#include <iprt/semaphore.h>
+#include <iprt/spinlock.h>
+#include <iprt/thread.h>
+#include <iprt/uuid.h>
+
+#include <VBox/param.h>
+#include <VBox/log.h>
+#include <VBox/err.h>
+
+
+/**
+ * Destructor for objects created by SUPSemEventCreate.
+ *
+ * @param   pvObj               The object handle.
+ * @param   pvUser1             The IPRT event handle.
+ * @param   pvUser2             NULL.
+ */
+static DECLCALLBACK(void) supR0SemEventDestructor(void *pvObj, void *pvUser1, void *pvUser2)
+{
+    Assert(pvUser2 == NULL);
+    NOREF(pvObj);
+    RTSemEventDestroy((RTSEMEVENT)pvUser1);
+}
+
+
+SUPDECL(int) SUPSemEventCreate(PSUPDRVSESSION pSession, PSUPSEMEVENT phEvent)
+{
+    int         rc;
+    RTSEMEVENT  hEventReal;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrReturn(phEvent, VERR_INVALID_POINTER);
+
+    /*
+     * Create the event semaphore object.
+     */
+    rc = RTSemEventCreate(&hEventReal);
+    if (RT_SUCCESS(rc))
+    {
+        void *pvObj = SUPR0ObjRegister(pSession, SUPDRVOBJTYPE_SEM_EVENT, supR0SemEventDestructor, hEventReal, NULL);
+        if (pvObj)
+        {
+            uint32_t h32;
+            rc = RTHandleTableAllocWithCtx(pSession->hHandleTable, pvObj, SUPDRV_HANDLE_CTX_EVENT, &h32);
+            if (RT_SUCCESS(rc))
+            {
+                *phEvent = (SUPSEMEVENT)(uintptr_t)h32;
+                return VINF_SUCCESS;
+            }
+            SUPR0ObjRelease(pvObj, pSession);
+        }
+        else
+            RTSemEventDestroy(hEventReal);
+    }
+    return rc;
+}
+
+
+SUPDECL(int) SUPSemEventClose(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
+{
+    uint32_t    h32;
+    PSUPDRVOBJ  pObj;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    if (hEvent == NIL_SUPSEMEVENT)
+        return VINF_SUCCESS;
+    h32 = (uint32_t)(uintptr_t)hEvent;
+    if (h32 != (uintptr_t)hEvent)
+        return VERR_INVALID_HANDLE;
+
+    /*
+     * Do the job.
+     */
+    pObj = (PSUPDRVOBJ)RTHandleTableFreeWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT);
+    if (!pObj)
+        return VERR_INVALID_HANDLE;
+
+    Assert(pObj->cUsage >= 2);
+    SUPR0ObjRelease(pObj, pSession);        /* The free call above. */
+    return SUPR0ObjRelease(pObj, pSession); /* The handle table reference. */
+}
+
+
+SUPDECL(int) SUPSemEventSignal(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent)
+{
+    int         rc;
+    uint32_t    h32;
+    PSUPDRVOBJ  pObj;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    h32 = (uint32_t)(uintptr_t)hEvent;
+    if (h32 != (uintptr_t)hEvent)
+        return VERR_INVALID_HANDLE;
+    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT);
+    if (!pObj)
+        return VERR_INVALID_HANDLE;
+
+    /*
+     * Do the job.
+     */
+    rc = RTSemEventSignal((RTSEMEVENT)pObj->pvUser1);
+
+    SUPR0ObjRelease(pObj, pSession);
+    return rc;
+}
+
+
+static int supR0SemEventWaitEx(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t fFlags, uint64_t uTimeout)
+{
+    int         rc;
+    uint32_t    h32;
+    PSUPDRVOBJ  pObj;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    h32 = (uint32_t)(uintptr_t)hEvent;
+    if (h32 != (uintptr_t)hEvent)
+        return VERR_INVALID_HANDLE;
+    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT);
+    if (!pObj)
+        return VERR_INVALID_HANDLE;
+
+    /*
+     * Do the job.
+     */
+    rc = RTSemEventWaitEx((RTSEMEVENT)pObj->pvUser1, fFlags, uTimeout);
+
+    SUPR0ObjRelease(pObj, pSession);
+    return rc;
+}
+
+
+SUPDECL(int) SUPSemEventWait(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies)
+{
+    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS | RTSEMWAIT_FLAGS_UNINTERRUPTIBLE;
+    if (cMillies == RT_INDEFINITE_WAIT)
+        fFlags |= RTSEMWAIT_FLAGS_INDEFINITE;
+    return supR0SemEventWaitEx(pSession, hEvent, fFlags, cMillies);
+}
+
+
+SUPDECL(int) SUPSemEventWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint32_t cMillies)
+{
+    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
+    if (cMillies == RT_INDEFINITE_WAIT)
+        fFlags |= RTSEMWAIT_FLAGS_INDEFINITE;
+    return supR0SemEventWaitEx(pSession, hEvent, fFlags, cMillies);
+}
+
+
+SUPDECL(int) SUPSemEventWaitNsAbsIntr(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint64_t uNsTimeout)
+{
+    uint32_t fFlags = RTSEMWAIT_FLAGS_ABSOLUTE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
+    return supR0SemEventWaitEx(pSession, hEvent, fFlags, uNsTimeout);
+}
+
+
+SUPDECL(int) SUPSemEventWaitNsRelIntr(PSUPDRVSESSION pSession, SUPSEMEVENT hEvent, uint64_t cNsTimeout)
+{
+    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
+    return supR0SemEventWaitEx(pSession, hEvent, fFlags, cNsTimeout);
+}
+
+
+SUPDECL(uint32_t) SUPSemEventGetResolution(PSUPDRVSESSION pSession)
+{
+    Assert(SUP_IS_SESSION_VALID(pSession));
+    return RTSemEventGetResolution();
+}
+
+
+/**
+ * Destructor for objects created by SUPSemEventMultiCreate.
+ *
+ * @param   pvObj               The object handle.
+ * @param   pvUser1             The IPRT event handle.
+ * @param   pvUser2             NULL.
+ */
+static DECLCALLBACK(void) supR0SemEventMultiDestructor(void *pvObj, void *pvUser1, void *pvUser2)
+{
+    Assert(pvUser2 == NULL);
+    NOREF(pvObj);
+    RTSemEventMultiDestroy((RTSEMEVENTMULTI)pvUser1);
+}
+
+
+SUPDECL(int) SUPSemEventMultiCreate(PSUPDRVSESSION pSession, PSUPSEMEVENTMULTI phEventMulti)
+{
+    int             rc;
+    RTSEMEVENTMULTI hEventMultReal;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    AssertPtrReturn(phEventMulti, VERR_INVALID_POINTER);
+
+    /*
+     * Create the event semaphore object.
+     */
+    rc = RTSemEventMultiCreate(&hEventMultReal);
+    if (RT_SUCCESS(rc))
+    {
+        void *pvObj = SUPR0ObjRegister(pSession, SUPDRVOBJTYPE_SEM_EVENT_MULTI, supR0SemEventMultiDestructor, hEventMultReal, NULL);
+        if (pvObj)
+        {
+            uint32_t h32;
+            rc = RTHandleTableAllocWithCtx(pSession->hHandleTable, pvObj, SUPDRV_HANDLE_CTX_EVENT_MULTI, &h32);
+            if (RT_SUCCESS(rc))
+            {
+                *phEventMulti = (SUPSEMEVENTMULTI)(uintptr_t)h32;
+                return VINF_SUCCESS;
+            }
+            SUPR0ObjRelease(pvObj, pSession);
+        }
+        else
+            RTSemEventMultiDestroy(hEventMultReal);
+    }
+    return rc;
+}
+
+
+SUPDECL(int) SUPSemEventMultiClose(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti)
+{
+    uint32_t    h32;
+    PSUPDRVOBJ  pObj;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    if (hEventMulti == NIL_SUPSEMEVENTMULTI)
+        return VINF_SUCCESS;
+    h32 = (uint32_t)(uintptr_t)hEventMulti;
+    if (h32 != (uintptr_t)hEventMulti)
+        return VERR_INVALID_HANDLE;
+
+    /*
+     * Do the job.
+     */
+    pObj = (PSUPDRVOBJ)RTHandleTableFreeWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT_MULTI);
+    if (!pObj)
+        return VERR_INVALID_HANDLE;
+
+    Assert(pObj->cUsage >= 2);
+    SUPR0ObjRelease(pObj, pSession);        /* The free call above. */
+    return SUPR0ObjRelease(pObj, pSession); /* The handle table reference. */
+}
+
+
+SUPDECL(int) SUPSemEventMultiSignal(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti)
+{
+    int         rc;
+    uint32_t    h32;
+    PSUPDRVOBJ  pObj;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    h32 = (uint32_t)(uintptr_t)hEventMulti;
+    if (h32 != (uintptr_t)hEventMulti)
+        return VERR_INVALID_HANDLE;
+    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT_MULTI);
+    if (!pObj)
+        return VERR_INVALID_HANDLE;
+
+    /*
+     * Do the job.
+     */
+    rc = RTSemEventMultiSignal((RTSEMEVENTMULTI)pObj->pvUser1);
+
+    SUPR0ObjRelease(pObj, pSession);
+    return rc;
+}
+
+
+SUPDECL(int) SUPSemEventMultiReset(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti)
+{
+    int         rc;
+    uint32_t    h32;
+    PSUPDRVOBJ  pObj;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    h32 = (uint32_t)(uintptr_t)hEventMulti;
+    if (h32 != (uintptr_t)hEventMulti)
+        return VERR_INVALID_HANDLE;
+    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT_MULTI);
+    if (!pObj)
+        return VERR_INVALID_HANDLE;
+
+    /*
+     * Do the job.
+     */
+    rc = RTSemEventMultiReset((RTSEMEVENTMULTI)pObj->pvUser1);
+
+    SUPR0ObjRelease(pObj, pSession);
+    return rc;
+}
+
+
+static int supR0SemEventMultiWaitEx(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t fFlags, uint64_t uTimeout)
+{
+    int         rc;
+    uint32_t    h32;
+    PSUPDRVOBJ  pObj;
+
+    /*
+     * Input validation.
+     */
+    AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER);
+    h32 = (uint32_t)(uintptr_t)hEventMulti;
+    if (h32 != (uintptr_t)hEventMulti)
+        return VERR_INVALID_HANDLE;
+    pObj = (PSUPDRVOBJ)RTHandleTableLookupWithCtx(pSession->hHandleTable, h32, SUPDRV_HANDLE_CTX_EVENT_MULTI);
+    if (!pObj)
+        return VERR_INVALID_HANDLE;
+
+    /*
+     * Do the job.
+     */
+    rc = RTSemEventMultiWaitEx((RTSEMEVENTMULTI)pObj->pvUser1, fFlags, uTimeout);
+
+    SUPR0ObjRelease(pObj, pSession);
+    return rc;
+}
+
+SUPDECL(int) SUPSemEventMultiWait(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t cMillies)
+{
+    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS | RTSEMWAIT_FLAGS_UNINTERRUPTIBLE;
+    if (cMillies == RT_INDEFINITE_WAIT)
+        fFlags |= RTSEMWAIT_FLAGS_INDEFINITE;
+    return supR0SemEventMultiWaitEx(pSession, hEventMulti, fFlags, cMillies);
+}
+
+
+
+SUPDECL(int) SUPSemEventMultiWaitNoResume(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint32_t cMillies)
+{
+    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_MILLISECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
+    if (cMillies == RT_INDEFINITE_WAIT)
+        fFlags |= RTSEMWAIT_FLAGS_INDEFINITE;
+    return supR0SemEventMultiWaitEx(pSession, hEventMulti, fFlags, cMillies);
+}
+
+
+SUPDECL(int) SUPSemEventMultiWaitNsAbsIntr(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint64_t uNsTimeout)
+{
+    uint32_t fFlags = RTSEMWAIT_FLAGS_ABSOLUTE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
+    return supR0SemEventMultiWaitEx(pSession, hEventMulti, fFlags, uNsTimeout);
+}
+
+
+SUPDECL(int) SUPSemEventMultiWaitNsRelIntr(PSUPDRVSESSION pSession, SUPSEMEVENTMULTI hEventMulti, uint64_t cNsTimeout)
+{
+    uint32_t fFlags = RTSEMWAIT_FLAGS_RELATIVE | RTSEMWAIT_FLAGS_NANOSECS | RTSEMWAIT_FLAGS_INTERRUPTIBLE;
+    return supR0SemEventMultiWaitEx(pSession, hEventMulti, fFlags, cNsTimeout);
+}
+
+
+SUPDECL(uint32_t) SUPSemEventMultiGetResolution(PSUPDRVSESSION pSession)
+{
+    Assert(SUP_IS_SESSION_VALID(pSession));
+    return RTSemEventMultiGetResolution();
+}
+
diff --git a/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp b/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
index 373b269..bdc2912 100644
--- a/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
+++ b/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
@@ -339,6 +339,7 @@ static int supdrvVtgValidateHdr(PVTGOBJHDR pVtgHdr, RTUINTPTR uVtgHdrAddr, const
                         u64Tmp, pVtgHdr->uProbeLocs.u64, pVtgHdr->uProbeLocsEnd.u64);
             return VERR_SUPDRV_VTG_BAD_HDR_TOO_MUCH;
         }
+        /*SUPR0Printf("supdrvVtgValidateHdr: cbProbeLocs %#x -> %#x\n", pVtgHdr->cbProbeLocs, (uint32_t)u64Tmp);*/
         pVtgHdr->cbProbeLocs  = (uint32_t)u64Tmp;
 
         u64Tmp = pVtgHdr->uProbeLocs.u64 - uVtgHdrAddr;
@@ -355,6 +356,7 @@ static int supdrvVtgValidateHdr(PVTGOBJHDR pVtgHdr, RTUINTPTR uVtgHdrAddr, const
             && !fUmod)
         {
             uint64_t offDelta = uVtgHdrAddr - pVtgHdr->u64VtgObjSectionStart;
+            /*SUPR0Printf("supdrvVtgValidateHdr: offDelta=%#llx\n", offDelta);*/
             pVtgHdr->uProbeLocs.u64        += offDelta;
             pVtgHdr->uProbeLocsEnd.u64     += offDelta;
             u64Tmp += offDelta;
@@ -366,6 +368,7 @@ static int supdrvVtgValidateHdr(PVTGOBJHDR pVtgHdr, RTUINTPTR uVtgHdrAddr, const
                         u64Tmp, pVtgHdr->uProbeLocs.u64, uVtgHdrAddr);
             return VERR_SUPDRV_VTG_BAD_HDR_PTR;
         }
+        /*SUPR0Printf("supdrvVtgValidateHdr: offProbeLocs %#x -> %#x\n", pVtgHdr->offProbeLocs, (int32_t)u64Tmp);*/
         pVtgHdr->offProbeLocs = (int32_t)u64Tmp;
     }
 
@@ -373,7 +376,10 @@ static int supdrvVtgValidateHdr(PVTGOBJHDR pVtgHdr, RTUINTPTR uVtgHdrAddr, const
      * The non-area description fields.
      */
     if (memcmp(pVtgHdr->szMagic, VTGOBJHDR_MAGIC, sizeof(pVtgHdr->szMagic)))
+    {
+        SUPR0Printf("supdrvVtgValidateHdr: %p: %.16Rhxs\n", pVtgHdr, pVtgHdr->szMagic);
         return VERR_SUPDRV_VTG_MAGIC;
+    }
     if (   pVtgHdr->cBits != ARCH_BITS
         && (   !fUmod
             || (   pVtgHdr->cBits != 32
diff --git a/src/VBox/HostDrivers/Support/SUPLib.cpp b/src/VBox/HostDrivers/Support/SUPLib.cpp
index c019fcb..85679bb 100644
--- a/src/VBox/HostDrivers/Support/SUPLib.cpp
+++ b/src/VBox/HostDrivers/Support/SUPLib.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -67,8 +67,8 @@
 #include <iprt/rand.h>
 #include <iprt/x86.h>
 
-#include "SUPLibInternal.h"
 #include "SUPDrvIOC.h"
+#include "SUPLibInternal.h"
 
 
 /*******************************************************************************
@@ -116,7 +116,7 @@ SUPLIBDATA                      g_supLibData =
  */
 DECLEXPORT(PSUPGLOBALINFOPAGE)  g_pSUPGlobalInfoPage;
 /** Address of the ring-0 mapping of the GIP. */
-static PSUPGLOBALINFOPAGE       g_pSUPGlobalInfoPageR0;
+PSUPGLOBALINFOPAGE              g_pSUPGlobalInfoPageR0;
 /** The physical address of the GIP. */
 static RTHCPHYS                 g_HCPhysSUPGlobalInfoPage = NIL_RTHCPHYS;
 
@@ -127,14 +127,14 @@ uint32_t                        g_u32SessionCookie;
 /** Session handle. */
 PSUPDRVSESSION                  g_pSession;
 /** R0 SUP Functions used for resolving referenced to the SUPR0 module. */
-static PSUPQUERYFUNCS           g_pFunctions;
+PSUPQUERYFUNCS                  g_pSupFunctions;
 
 /** VMMR0 Load Address. */
 static RTR0PTR                  g_pvVMMR0 = NIL_RTR0PTR;
 /** PAGE_ALLOC_EX sans kernel mapping support indicator. */
 static bool                     g_fSupportsPageAllocNoKernel = true;
 /** Fake mode indicator. (~0 at first, 0 or 1 after first test) */
-static uint32_t                 g_u32FakeMode = ~0;
+uint32_t                        g_uSupFakeMode = ~0;
 
 
 /*******************************************************************************
@@ -247,15 +247,15 @@ SUPR3DECL(int) SUPR3InitEx(bool fUnrestricted, PSUPDRVSESSION *ppSession)
      * It's also useful on platforms where we haven't root access or which
      * we haven't ported the support driver to.
      */
-    if (g_u32FakeMode == ~0U)
+    if (g_uSupFakeMode == ~0U)
     {
         const char *psz = RTEnvGet("VBOX_SUPLIB_FAKE");
         if (psz && !strcmp(psz, "fake"))
-            ASMAtomicCmpXchgU32(&g_u32FakeMode, 1, ~0U);
+            ASMAtomicCmpXchgU32(&g_uSupFakeMode, 1, ~0U);
         else
-            ASMAtomicCmpXchgU32(&g_u32FakeMode, 0, ~0U);
+            ASMAtomicCmpXchgU32(&g_uSupFakeMode, 0, ~0U);
     }
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return supInitFake(ppSession);
 
     /*
@@ -278,8 +278,8 @@ SUPR3DECL(int) SUPR3InitEx(bool fUnrestricted, PSUPDRVSESSION *ppSession)
         CookieReq.Hdr.rc = VERR_INTERNAL_ERROR;
         strcpy(CookieReq.u.In.szMagic, SUPCOOKIE_MAGIC);
         CookieReq.u.In.u32ReqVersion = SUPDRV_IOC_VERSION;
-        const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x001a0000
-                                   ? 0x001a000a
+        const uint32_t uMinVersion = (SUPDRV_IOC_VERSION & 0xffff0000) == 0x00200000
+                                   ? 0x00200000
                                    : SUPDRV_IOC_VERSION & 0xffff0000;
         CookieReq.u.In.u32MinVersion = uMinVersion;
         rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_COOKIE, &CookieReq, SUP_IOCTL_COOKIE_SIZE);
@@ -353,7 +353,7 @@ SUPR3DECL(int) SUPR3InitEx(bool fUnrestricted, PSUPDRVSESSION *ppSession)
                     g_u32Cookie         = CookieReq.u.Out.u32Cookie;
                     g_u32SessionCookie  = CookieReq.u.Out.u32SessionCookie;
                     g_pSession          = CookieReq.u.Out.pSession;
-                    g_pFunctions        = pFuncsReq;
+                    g_pSupFunctions  = pFuncsReq;
                     if (ppSession)
                         *ppSession = CookieReq.u.Out.pSession;
                     return VINF_SUCCESS;
@@ -474,7 +474,6 @@ static int supInitFake(PSUPDRVSESSION *ppSession)
         { "RTSpinlockAcquire",                      0xefef0030 },
         { "RTSpinlockRelease",                      0xefef0031 },
         { "RTSpinlockAcquireNoInts",                0xefef0032 },
-        { "RTSpinlockReleaseNoInts",                0xefef0033 },
         { "RTTimeNanoTS",                           0xefef0034 },
         { "RTTimeMillieTS",                         0xefef0035 },
         { "RTTimeSystemNanoTS",                     0xefef0036 },
@@ -505,12 +504,12 @@ static int supInitFake(PSUPDRVSESSION *ppSession)
     };
 
     /* fake r0 functions. */
-    g_pFunctions = (PSUPQUERYFUNCS)RTMemAllocZ(SUP_IOCTL_QUERY_FUNCS_SIZE(RT_ELEMENTS(s_aFakeFunctions)));
-    if (g_pFunctions)
+    g_pSupFunctions = (PSUPQUERYFUNCS)RTMemAllocZ(SUP_IOCTL_QUERY_FUNCS_SIZE(RT_ELEMENTS(s_aFakeFunctions)));
+    if (g_pSupFunctions)
     {
-        g_pFunctions->u.Out.cFunctions = RT_ELEMENTS(s_aFakeFunctions);
-        memcpy(&g_pFunctions->u.Out.aFunctions[0], &s_aFakeFunctions[0], sizeof(s_aFakeFunctions));
-        g_pSession = (PSUPDRVSESSION)(void *)g_pFunctions;
+        g_pSupFunctions->u.Out.cFunctions = RT_ELEMENTS(s_aFakeFunctions);
+        memcpy(&g_pSupFunctions->u.Out.aFunctions[0], &s_aFakeFunctions[0], sizeof(s_aFakeFunctions));
+        g_pSession = (PSUPDRVSESSION)(void *)g_pSupFunctions;
         if (ppSession)
             *ppSession = g_pSession;
 
@@ -524,8 +523,8 @@ static int supInitFake(PSUPDRVSESSION *ppSession)
             return VINF_SUCCESS;
         }
 
-        RTMemFree(g_pFunctions);
-        g_pFunctions = NULL;
+        RTMemFree(g_pSupFunctions);
+        g_pSupFunctions = NULL;
     }
     return VERR_NO_MEMORY;
 }
@@ -574,7 +573,7 @@ SUPR3DECL(int) SUPR3Term(bool fForced)
 SUPR3DECL(SUPPAGINGMODE) SUPR3GetPagingMode(void)
 {
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
 #ifdef RT_ARCH_AMD64
         return SUPPAGINGMODE_AMD64_GLOBAL_NX;
 #else
@@ -640,7 +639,7 @@ SUPR3DECL(int) SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation,
                     VERR_INTERNAL_ERROR);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return supCallVMMR0ExFake(pVMR0, uOperation, u64Arg, pReqHdr);
 
     int rc;
@@ -731,7 +730,7 @@ SUPR3DECL(int) SUPR3CallVMMR0(PVMR0 pVMR0, VMCPUID idCpu, unsigned uOperation, v
 
 SUPR3DECL(int) SUPR3SetVMForFastIOCtl(PVMR0 pVMR0)
 {
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VINF_SUCCESS;
 
     SUPSETVMFORFAST Req;
@@ -755,7 +754,7 @@ SUPR3DECL(int) SUPR3CallR0Service(const char *pszService, size_t cchService, uin
     Assert(strlen(pszService) == cchService);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VERR_NOT_SUPPORTED;
 
     int rc;
@@ -956,7 +955,7 @@ SUPR3DECL(int) supR3PageLock(void *pvStart, size_t cPages, PSUPPAGE paPages)
     AssertPtr(paPages);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
     {
         RTHCPHYS    Phys = (uintptr_t)pvStart + PAGE_SIZE * 1024;
         size_t      iPage = cPages;
@@ -1017,7 +1016,7 @@ SUPR3DECL(int) supR3PageUnlock(void *pvStart)
     AssertMsg(RT_ALIGN_P(pvStart, PAGE_SIZE) == pvStart, ("pvStart (%p) must be page aligned\n", pvStart));
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VINF_SUCCESS;
 
     /*
@@ -1041,7 +1040,7 @@ SUPR3DECL(int) supR3PageUnlock(void *pvStart)
 SUPR3DECL(int) SUPR3LockDownLoader(PRTERRINFO pErrInfo)
 {
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VINF_SUCCESS;
 
     /*
@@ -1097,7 +1096,7 @@ SUPR3DECL(int) SUPR3PageAllocEx(size_t cPages, uint32_t fFlags, void **ppvPages,
     AssertReturn(!fFlags, VERR_INVALID_PARAMETER);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
     {
         void *pv = RTMemPageAllocZ(cPages * PAGE_SIZE);
         if (!pv)
@@ -1190,7 +1189,7 @@ SUPR3DECL(int) SUPR3PageMapKernel(void *pvR3, uint32_t off, uint32_t cb, uint32_
     *pR0Ptr = NIL_RTR0PTR;
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VERR_NOT_SUPPORTED;
 
     /*
@@ -1227,7 +1226,7 @@ SUPR3DECL(int) SUPR3PageProtect(void *pvR3, RTR0PTR R0Ptr, uint32_t off, uint32_
     AssertReturn(!(fProt & ~(RTMEM_PROT_NONE | RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC)), VERR_INVALID_PARAMETER);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return RTMemProtect((uint8_t *)pvR3 + off, cb, fProt);
 
     /*
@@ -1267,7 +1266,7 @@ SUPR3DECL(int) SUPR3PageFreeEx(void *pvPages, size_t cPages)
     AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
     {
         RTMemPageFree(pvPages, cPages * PAGE_SIZE);
         return VINF_SUCCESS;
@@ -1316,7 +1315,7 @@ SUPR3DECL(void *) SUPR3ContAlloc(size_t cPages, PRTR0PTR pR0Ptr, PRTHCPHYS pHCPh
     AssertMsgReturn(cPages > 0 && cPages < 256, ("cPages=%d must be > 0 and < 256\n", cPages), NULL);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
     {
         void *pv = RTMemPageAllocZ(cPages * PAGE_SIZE);
         if (pR0Ptr)
@@ -1365,7 +1364,7 @@ SUPR3DECL(int) SUPR3ContFree(void *pv, size_t cPages)
     AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
     {
         RTMemPageFree(pv, cPages * PAGE_SIZE);
         return VINF_SUCCESS;
@@ -1400,7 +1399,7 @@ SUPR3DECL(int) SUPR3LowAlloc(size_t cPages, void **ppvPages, PRTR0PTR ppvPagesR0
     AssertMsgReturn(cPages > 0 && cPages < 256, ("cPages=%d must be > 0 and < 256\n", cPages), VERR_PAGE_COUNT_OUT_OF_RANGE);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
     {
         *ppvPages = RTMemPageAllocZ((size_t)cPages * PAGE_SIZE);
         if (!*ppvPages)
@@ -1468,7 +1467,7 @@ SUPR3DECL(int) SUPR3LowFree(void *pv, size_t cPages)
     AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE);
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
     {
         RTMemPageFree(pv, cPages * PAGE_SIZE);
         return VINF_SUCCESS;
@@ -1641,557 +1640,6 @@ SUPR3DECL(int) SUPR3HardenedVerifyPlugIn(const char *pszFilename, PRTERRINFO pEr
 }
 
 
-SUPR3DECL(int) SUPR3LoadModule(const char *pszFilename, const char *pszModule, void **ppvImageBase, PRTERRINFO pErrInfo)
-{
-    /*
-     * Check that the module can be trusted.
-     */
-    int rc = SUPR3HardenedVerifyPlugIn(pszFilename, pErrInfo);
-    if (RT_SUCCESS(rc))
-    {
-        rc = supLoadModule(pszFilename, pszModule, NULL, ppvImageBase);
-        if (RT_FAILURE(rc))
-            RTErrInfoSetF(pErrInfo, rc, "SUPR3LoadModule: supLoadModule returned %Rrc", rc);
-    }
-    return rc;
-}
-
-
-SUPR3DECL(int) SUPR3LoadServiceModule(const char *pszFilename, const char *pszModule,
-                                      const char *pszSrvReqHandler, void **ppvImageBase)
-{
-    AssertPtrReturn(pszSrvReqHandler, VERR_INVALID_PARAMETER);
-
-    /*
-     * Check that the module can be trusted.
-     */
-    int rc = SUPR3HardenedVerifyPlugIn(pszFilename, NULL /*pErrInfo*/);
-    if (RT_SUCCESS(rc))
-        rc = supLoadModule(pszFilename, pszModule, pszSrvReqHandler, ppvImageBase);
-    else
-        LogRel(("SUPR3LoadServiceModule: Verification of \"%s\" failed, rc=%Rrc\n", rc));
-    return rc;
-}
-
-
-/**
- * Resolve an external symbol during RTLdrGetBits().
- *
- * @returns VBox status code.
- * @param   hLdrMod         The loader module handle.
- * @param   pszModule       Module name.
- * @param   pszSymbol       Symbol name, NULL if uSymbol should be used.
- * @param   uSymbol         Symbol ordinal, ~0 if pszSymbol should be used.
- * @param   pValue          Where to store the symbol value (address).
- * @param   pvUser          User argument.
- */
-static DECLCALLBACK(int) supLoadModuleResolveImport(RTLDRMOD hLdrMod, const char *pszModule,
-                                                    const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser)
-{
-    NOREF(hLdrMod); NOREF(pvUser); NOREF(uSymbol);
-    AssertPtr(pValue);
-    AssertPtr(pvUser);
-
-    /*
-     * Only SUPR0 and VMMR0.r0
-     */
-    if (    pszModule
-        &&  *pszModule
-        &&  strcmp(pszModule, "VBoxDrv.sys")
-        &&  strcmp(pszModule, "VMMR0.r0"))
-    {
-        AssertMsgFailed(("%s is importing from %s! (expected 'SUPR0.dll' or 'VMMR0.r0', case-sensitive)\n", pvUser, pszModule));
-        return VERR_SYMBOL_NOT_FOUND;
-    }
-
-    /*
-     * No ordinals.
-     */
-    if (pszSymbol < (const char*)0x10000)
-    {
-        AssertMsgFailed(("%s is importing by ordinal (ord=%d)\n", pvUser, (int)(uintptr_t)pszSymbol));
-        return VERR_SYMBOL_NOT_FOUND;
-    }
-
-    /*
-     * Lookup symbol.
-     */
-    /** @todo is this actually used??? */
-    /* skip the 64-bit ELF import prefix first. */
-    if (!strncmp(pszSymbol, RT_STR_TUPLE("SUPR0$")))
-        pszSymbol += sizeof("SUPR0$") - 1;
-
-    /*
-     * Check the VMMR0.r0 module if loaded.
-     */
-    /** @todo call the SUPR3LoadModule caller.... */
-    /** @todo proper reference counting and such. */
-    if (g_pvVMMR0 != NIL_RTR0PTR)
-    {
-        void *pvValue;
-        if (!SUPR3GetSymbolR0((void *)g_pvVMMR0, pszSymbol, &pvValue))
-        {
-            *pValue = (uintptr_t)pvValue;
-            return VINF_SUCCESS;
-        }
-    }
-
-    /* iterate the function table. */
-    int c = g_pFunctions->u.Out.cFunctions;
-    PSUPFUNC pFunc = &g_pFunctions->u.Out.aFunctions[0];
-    while (c-- > 0)
-    {
-        if (!strcmp(pFunc->szName, pszSymbol))
-        {
-            *pValue = (uintptr_t)pFunc->pfn;
-            return VINF_SUCCESS;
-        }
-        pFunc++;
-    }
-
-    /*
-     * The GIP.
-     */
-    if (    pszSymbol
-        &&  g_pSUPGlobalInfoPage
-        &&  g_pSUPGlobalInfoPageR0
-        &&  !strcmp(pszSymbol, "g_SUPGlobalInfoPage")
-       )
-    {
-        *pValue = (uintptr_t)g_pSUPGlobalInfoPageR0;
-        return VINF_SUCCESS;
-    }
-
-    /*
-     * Symbols that are undefined by convention.
-     */
-#ifdef RT_OS_SOLARIS
-    static const char * const s_apszConvSyms[] =
-    {
-        "", "mod_getctl",
-        "", "mod_install",
-        "", "mod_remove",
-        "", "mod_info",
-        "", "mod_miscops",
-    };
-    for (unsigned i = 0; i < RT_ELEMENTS(s_apszConvSyms); i += 2)
-    {
-        if (   !RTStrCmp(s_apszConvSyms[i],     pszModule)
-            && !RTStrCmp(s_apszConvSyms[i + 1], pszSymbol))
-        {
-            *pValue = ~(uintptr_t)0;
-            return VINF_SUCCESS;
-        }
-    }
-#endif
-
-    /*
-     * Despair.
-     */
-    c = g_pFunctions->u.Out.cFunctions;
-    pFunc = &g_pFunctions->u.Out.aFunctions[0];
-    while (c-- > 0)
-    {
-        RTAssertMsg2Weak("%d: %s\n", g_pFunctions->u.Out.cFunctions - c, pFunc->szName);
-        pFunc++;
-    }
-
-    AssertLogRelMsgFailed(("%s is importing %s which we couldn't find\n", pvUser, pszSymbol));
-    if (g_u32FakeMode)
-    {
-        *pValue = 0xdeadbeef;
-        return VINF_SUCCESS;
-    }
-    return VERR_SYMBOL_NOT_FOUND;
-}
-
-
-/** Argument package for supLoadModuleCalcSizeCB. */
-typedef struct SUPLDRCALCSIZEARGS
-{
-    size_t          cbStrings;
-    uint32_t        cSymbols;
-    size_t          cbImage;
-} SUPLDRCALCSIZEARGS, *PSUPLDRCALCSIZEARGS;
-
-/**
- * Callback used to calculate the image size.
- * @return VINF_SUCCESS
- */
-static DECLCALLBACK(int) supLoadModuleCalcSizeCB(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol, RTUINTPTR Value, void *pvUser)
-{
-    PSUPLDRCALCSIZEARGS pArgs = (PSUPLDRCALCSIZEARGS)pvUser;
-    if (    pszSymbol != NULL
-        &&  *pszSymbol
-        &&  Value <= pArgs->cbImage)
-    {
-        pArgs->cSymbols++;
-        pArgs->cbStrings += strlen(pszSymbol) + 1;
-    }
-    NOREF(hLdrMod); NOREF(uSymbol);
-    return VINF_SUCCESS;
-}
-
-
-/** Argument package for supLoadModuleCreateTabsCB. */
-typedef struct SUPLDRCREATETABSARGS
-{
-    size_t          cbImage;
-    PSUPLDRSYM      pSym;
-    char           *pszBase;
-    char           *psz;
-} SUPLDRCREATETABSARGS, *PSUPLDRCREATETABSARGS;
-
-/**
- * Callback used to calculate the image size.
- * @return VINF_SUCCESS
- */
-static DECLCALLBACK(int) supLoadModuleCreateTabsCB(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol, RTUINTPTR Value, void *pvUser)
-{
-    PSUPLDRCREATETABSARGS pArgs = (PSUPLDRCREATETABSARGS)pvUser;
-    if (    pszSymbol != NULL
-        &&  *pszSymbol
-        &&  Value <= pArgs->cbImage)
-    {
-        pArgs->pSym->offSymbol = (uint32_t)Value;
-        pArgs->pSym->offName = pArgs->psz - pArgs->pszBase;
-        pArgs->pSym++;
-
-        size_t cbCopy = strlen(pszSymbol) + 1;
-        memcpy(pArgs->psz, pszSymbol, cbCopy);
-        pArgs->psz += cbCopy;
-    }
-    NOREF(hLdrMod); NOREF(uSymbol);
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Worker for SUPR3LoadModule().
- *
- * @returns VBox status code.
- * @param   pszFilename     Name of the VMMR0 image file
- */
-static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, void **ppvImageBase)
-{
-    int rc;
-
-    /*
-     * Validate input.
-     */
-    AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
-    AssertPtrReturn(pszModule, VERR_INVALID_PARAMETER);
-    AssertPtrReturn(ppvImageBase, VERR_INVALID_PARAMETER);
-    AssertReturn(strlen(pszModule) < RT_SIZEOFMEMB(SUPLDROPEN, u.In.szName), VERR_FILENAME_TOO_LONG);
-    char szAbsFilename[RT_SIZEOFMEMB(SUPLDROPEN, u.In.szFilename)];
-    rc = RTPathAbs(pszFilename, szAbsFilename, sizeof(szAbsFilename));
-    if (RT_FAILURE(rc))
-        return rc;
-    pszFilename = szAbsFilename;
-
-    const bool fIsVMMR0 = !strcmp(pszModule, "VMMR0.r0");
-    AssertReturn(!pszSrvReqHandler || !fIsVMMR0, VERR_INTERNAL_ERROR);
-    *ppvImageBase = NULL;
-
-    /*
-     * Open image file and figure its size.
-     */
-    RTLDRMOD hLdrMod;
-    rc = RTLdrOpen(pszFilename, 0, RTLDRARCH_HOST, &hLdrMod);
-    if (!RT_SUCCESS(rc))
-    {
-        LogRel(("SUP: RTLdrOpen failed for %s (%s)\n", pszModule, pszFilename, rc));
-        return rc;
-    }
-
-    SUPLDRCALCSIZEARGS CalcArgs;
-    CalcArgs.cbStrings = 0;
-    CalcArgs.cSymbols = 0;
-    CalcArgs.cbImage = RTLdrSize(hLdrMod);
-    rc = RTLdrEnumSymbols(hLdrMod, 0, NULL, 0, supLoadModuleCalcSizeCB, &CalcArgs);
-    if (RT_SUCCESS(rc))
-    {
-        const uint32_t  offSymTab = RT_ALIGN_32(CalcArgs.cbImage, 8);
-        const uint32_t  offStrTab = offSymTab + CalcArgs.cSymbols * sizeof(SUPLDRSYM);
-        const uint32_t  cbImageWithTabs = RT_ALIGN_32(offStrTab + CalcArgs.cbStrings, 8);
-
-        /*
-         * Open the R0 image.
-         */
-        SUPLDROPEN OpenReq;
-        OpenReq.Hdr.u32Cookie = g_u32Cookie;
-        OpenReq.Hdr.u32SessionCookie = g_u32SessionCookie;
-        OpenReq.Hdr.cbIn = SUP_IOCTL_LDR_OPEN_SIZE_IN;
-        OpenReq.Hdr.cbOut = SUP_IOCTL_LDR_OPEN_SIZE_OUT;
-        OpenReq.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT;
-        OpenReq.Hdr.rc = VERR_INTERNAL_ERROR;
-        OpenReq.u.In.cbImageWithTabs = cbImageWithTabs;
-        OpenReq.u.In.cbImageBits = (uint32_t)CalcArgs.cbImage;
-        strcpy(OpenReq.u.In.szName, pszModule);
-        strcpy(OpenReq.u.In.szFilename, pszFilename);
-        if (!g_u32FakeMode)
-        {
-            rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_OPEN, &OpenReq, SUP_IOCTL_LDR_OPEN_SIZE);
-            if (RT_SUCCESS(rc))
-                rc = OpenReq.Hdr.rc;
-        }
-        else
-        {
-            OpenReq.u.Out.fNeedsLoading = true;
-            OpenReq.u.Out.pvImageBase = 0xef423420;
-        }
-        *ppvImageBase = (void *)OpenReq.u.Out.pvImageBase;
-        if (    RT_SUCCESS(rc)
-            &&  OpenReq.u.Out.fNeedsLoading)
-        {
-            /*
-             * We need to load it.
-             * Allocate memory for the image bits.
-             */
-            PSUPLDRLOAD pLoadReq = (PSUPLDRLOAD)RTMemTmpAlloc(SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs));
-            if (pLoadReq)
-            {
-                /*
-                 * Get the image bits.
-                 */
-                rc = RTLdrGetBits(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase,
-                                  supLoadModuleResolveImport, (void *)pszModule);
-
-                if (RT_SUCCESS(rc))
-                {
-                    /*
-                     * Get the entry points.
-                     */
-                    RTUINTPTR VMMR0EntryInt = 0;
-                    RTUINTPTR VMMR0EntryFast = 0;
-                    RTUINTPTR VMMR0EntryEx = 0;
-                    RTUINTPTR SrvReqHandler = 0;
-                    RTUINTPTR ModuleInit = 0;
-                    RTUINTPTR ModuleTerm = 0;
-                    if (fIsVMMR0)
-                    {
-                        rc = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase,
-                                              UINT32_MAX, "VMMR0EntryInt", &VMMR0EntryInt);
-                        if (RT_SUCCESS(rc))
-                            rc = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase,
-                                                  UINT32_MAX, "VMMR0EntryFast", &VMMR0EntryFast);
-                        if (RT_SUCCESS(rc))
-                            rc = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase,
-                                                  UINT32_MAX, "VMMR0EntryEx", &VMMR0EntryEx);
-                    }
-                    else if (pszSrvReqHandler)
-                        rc = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase,
-                                              UINT32_MAX, pszSrvReqHandler, &SrvReqHandler);
-                    if (RT_SUCCESS(rc))
-                    {
-                        int rc2 = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase,
-                                                   UINT32_MAX, "ModuleInit", &ModuleInit);
-                        if (RT_FAILURE(rc2))
-                            ModuleInit = 0;
-
-                        rc2 = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase,
-                                               UINT32_MAX, "ModuleTerm", &ModuleTerm);
-                        if (RT_FAILURE(rc2))
-                            ModuleTerm = 0;
-                    }
-                    if (RT_SUCCESS(rc))
-                    {
-                        /*
-                         * Create the symbol and string tables.
-                         */
-                        SUPLDRCREATETABSARGS CreateArgs;
-                        CreateArgs.cbImage = CalcArgs.cbImage;
-                        CreateArgs.pSym    = (PSUPLDRSYM)&pLoadReq->u.In.abImage[offSymTab];
-                        CreateArgs.pszBase =     (char *)&pLoadReq->u.In.abImage[offStrTab];
-                        CreateArgs.psz     = CreateArgs.pszBase;
-                        rc = RTLdrEnumSymbols(hLdrMod, 0, NULL, 0, supLoadModuleCreateTabsCB, &CreateArgs);
-                        if (RT_SUCCESS(rc))
-                        {
-                            AssertRelease((size_t)(CreateArgs.psz - CreateArgs.pszBase) <= CalcArgs.cbStrings);
-                            AssertRelease((size_t)(CreateArgs.pSym - (PSUPLDRSYM)&pLoadReq->u.In.abImage[offSymTab]) <= CalcArgs.cSymbols);
-
-                            /*
-                             * Upload the image.
-                             */
-                            pLoadReq->Hdr.u32Cookie = g_u32Cookie;
-                            pLoadReq->Hdr.u32SessionCookie = g_u32SessionCookie;
-                            pLoadReq->Hdr.cbIn = SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImageWithTabs);
-                            pLoadReq->Hdr.cbOut = SUP_IOCTL_LDR_LOAD_SIZE_OUT;
-                            pLoadReq->Hdr.fFlags = SUPREQHDR_FLAGS_MAGIC | SUPREQHDR_FLAGS_EXTRA_IN;
-                            pLoadReq->Hdr.rc = VERR_INTERNAL_ERROR;
-
-                            pLoadReq->u.In.pfnModuleInit              = (RTR0PTR)ModuleInit;
-                            pLoadReq->u.In.pfnModuleTerm              = (RTR0PTR)ModuleTerm;
-                            if (fIsVMMR0)
-                            {
-                                pLoadReq->u.In.eEPType                = SUPLDRLOADEP_VMMR0;
-                                pLoadReq->u.In.EP.VMMR0.pvVMMR0       = OpenReq.u.Out.pvImageBase;
-                                pLoadReq->u.In.EP.VMMR0.pvVMMR0EntryInt = (RTR0PTR)VMMR0EntryInt;
-                                pLoadReq->u.In.EP.VMMR0.pvVMMR0EntryFast= (RTR0PTR)VMMR0EntryFast;
-                                pLoadReq->u.In.EP.VMMR0.pvVMMR0EntryEx  = (RTR0PTR)VMMR0EntryEx;
-                            }
-                            else if (pszSrvReqHandler)
-                            {
-                                pLoadReq->u.In.eEPType                = SUPLDRLOADEP_SERVICE;
-                                pLoadReq->u.In.EP.Service.pfnServiceReq = (RTR0PTR)SrvReqHandler;
-                                pLoadReq->u.In.EP.Service.apvReserved[0] = NIL_RTR0PTR;
-                                pLoadReq->u.In.EP.Service.apvReserved[1] = NIL_RTR0PTR;
-                                pLoadReq->u.In.EP.Service.apvReserved[2] = NIL_RTR0PTR;
-                            }
-                            else
-                                pLoadReq->u.In.eEPType                = SUPLDRLOADEP_NOTHING;
-                            pLoadReq->u.In.offStrTab                  = offStrTab;
-                            pLoadReq->u.In.cbStrTab                   = (uint32_t)CalcArgs.cbStrings;
-                            AssertRelease(pLoadReq->u.In.cbStrTab == CalcArgs.cbStrings);
-                            pLoadReq->u.In.cbImageBits                = (uint32_t)CalcArgs.cbImage;
-                            pLoadReq->u.In.offSymbols                 = offSymTab;
-                            pLoadReq->u.In.cSymbols                   = CalcArgs.cSymbols;
-                            pLoadReq->u.In.cbImageWithTabs            = cbImageWithTabs;
-                            pLoadReq->u.In.pvImageBase                = OpenReq.u.Out.pvImageBase;
-                            if (!g_u32FakeMode)
-                            {
-                                rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_LOAD, pLoadReq, SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs));
-                                if (RT_SUCCESS(rc))
-                                    rc = pLoadReq->Hdr.rc;
-                                else
-                                    LogRel(("SUP: SUP_IOCTL_LDR_LOAD ioctl for %s (%s) failed rc=%Rrc\n", pszModule, pszFilename, rc));
-                            }
-                            else
-                                rc = VINF_SUCCESS;
-                            if (    RT_SUCCESS(rc)
-                                ||  rc == VERR_ALREADY_LOADED /* A competing process. */
-                               )
-                            {
-                                LogRel(("SUP: Loaded %s (%s) at %#p - ModuleInit at %RTptr and ModuleTerm at %RTptr%s\n",
-                                        pszModule, pszFilename, OpenReq.u.Out.pvImageBase, ModuleInit, ModuleTerm,
-                                        OpenReq.u.Out.fNativeLoader ? " using the native ring-0 loader" : ""));
-                                if (fIsVMMR0)
-                                {
-                                    g_pvVMMR0 = OpenReq.u.Out.pvImageBase;
-                                    LogRel(("SUP: VMMR0EntryEx located at %RTptr, VMMR0EntryFast at %RTptr and VMMR0EntryInt at %RTptr\n",
-                                            VMMR0EntryEx, VMMR0EntryFast, VMMR0EntryInt));
-                                }
-#ifdef RT_OS_WINDOWS
-                                LogRel(("SUP: windbg> .reload /f %s=%#p\n", pszFilename, OpenReq.u.Out.pvImageBase));
-#endif
-
-                                RTMemTmpFree(pLoadReq);
-                                RTLdrClose(hLdrMod);
-                                return VINF_SUCCESS;
-                            }
-                            else
-                                LogRel(("SUP: Loading failed for %s (%s) rc=%Rrc\n", pszModule, pszFilename, rc));
-                        }
-                        else
-                            LogRel(("SUP: RTLdrEnumSymbols failed for %s (%s) rc=%Rrc\n", pszModule, pszFilename, rc));
-                    }
-                    else
-                        LogRel(("SUP: Failed to get entry points for %s (%s) rc=%Rrc\n", pszModule, pszFilename, rc));
-                }
-                else
-                    LogRel(("SUP: RTLdrGetBits failed for %s (%s). rc=%Rrc\n", pszModule, pszFilename, rc));
-                RTMemTmpFree(pLoadReq);
-            }
-            else
-            {
-                AssertMsgFailed(("failed to allocated %u bytes for SUPLDRLOAD_IN structure!\n", SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs)));
-                rc = VERR_NO_TMP_MEMORY;
-            }
-        }
-        else if (RT_SUCCESS(rc))
-        {
-            if (fIsVMMR0)
-                g_pvVMMR0 = OpenReq.u.Out.pvImageBase;
-            LogRel(("SUP: Opened %s (%s) at %#p.\n", pszModule, pszFilename, OpenReq.u.Out.pvImageBase,
-                    OpenReq.u.Out.fNativeLoader ? " loaded by the native ring-0 loader" : ""));
-#ifdef RT_OS_WINDOWS
-            LogRel(("SUP: windbg> .reload /f %s=%#p\n", pszFilename, OpenReq.u.Out.pvImageBase));
-#endif
-        }
-    }
-    RTLdrClose(hLdrMod);
-    return rc;
-}
-
-
-SUPR3DECL(int) SUPR3FreeModule(void *pvImageBase)
-{
-    /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
-    {
-        g_pvVMMR0 = NIL_RTR0PTR;
-        return VINF_SUCCESS;
-    }
-
-    /*
-     * Free the requested module.
-     */
-    SUPLDRFREE Req;
-    Req.Hdr.u32Cookie = g_u32Cookie;
-    Req.Hdr.u32SessionCookie = g_u32SessionCookie;
-    Req.Hdr.cbIn = SUP_IOCTL_LDR_FREE_SIZE_IN;
-    Req.Hdr.cbOut = SUP_IOCTL_LDR_FREE_SIZE_OUT;
-    Req.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT;
-    Req.Hdr.rc = VERR_INTERNAL_ERROR;
-    Req.u.In.pvImageBase = (RTR0PTR)pvImageBase;
-    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_FREE, &Req, SUP_IOCTL_LDR_FREE_SIZE);
-    if (RT_SUCCESS(rc))
-        rc = Req.Hdr.rc;
-    if (    RT_SUCCESS(rc)
-        &&  (RTR0PTR)pvImageBase == g_pvVMMR0)
-        g_pvVMMR0 = NIL_RTR0PTR;
-    return rc;
-}
-
-
-SUPR3DECL(int) SUPR3GetSymbolR0(void *pvImageBase, const char *pszSymbol, void **ppvValue)
-{
-    *ppvValue = NULL;
-
-    /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
-    {
-        *ppvValue = (void *)(uintptr_t)0xdeadf00d;
-        return VINF_SUCCESS;
-    }
-
-    /*
-     * Do ioctl.
-     */
-    SUPLDRGETSYMBOL Req;
-    Req.Hdr.u32Cookie = g_u32Cookie;
-    Req.Hdr.u32SessionCookie = g_u32SessionCookie;
-    Req.Hdr.cbIn = SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN;
-    Req.Hdr.cbOut = SUP_IOCTL_LDR_GET_SYMBOL_SIZE_OUT;
-    Req.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT;
-    Req.Hdr.rc = VERR_INTERNAL_ERROR;
-    Req.u.In.pvImageBase = (RTR0PTR)pvImageBase;
-    size_t cchSymbol = strlen(pszSymbol);
-    if (cchSymbol >= sizeof(Req.u.In.szSymbol))
-        return VERR_SYMBOL_NOT_FOUND;
-    memcpy(Req.u.In.szSymbol, pszSymbol, cchSymbol + 1);
-    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_GET_SYMBOL, &Req, SUP_IOCTL_LDR_GET_SYMBOL_SIZE);
-    if (RT_SUCCESS(rc))
-        rc = Req.Hdr.rc;
-    if (RT_SUCCESS(rc))
-        *ppvValue = (void *)Req.u.Out.pvSymbol;
-    return rc;
-}
-
-
-SUPR3DECL(int) SUPR3LoadVMM(const char *pszFilename)
-{
-    void *pvImageBase;
-    return SUPR3LoadModule(pszFilename, "VMMR0.r0", &pvImageBase, NULL /*pErrInfo*/);
-}
-
-
-SUPR3DECL(int) SUPR3UnloadVMM(void)
-{
-    return SUPR3FreeModule((void*)g_pvVMMR0);
-}
-
-
 SUPR3DECL(int) SUPR3GipGetPhys(PRTHCPHYS pHCPhys)
 {
     if (g_pSUPGlobalInfoPage)
@@ -2204,160 +1652,6 @@ SUPR3DECL(int) SUPR3GipGetPhys(PRTHCPHYS pHCPhys)
 }
 
 
-/**
- * Worker for SUPR3HardenedLdrLoad and SUPR3HardenedLdrLoadAppPriv.
- *
- * @returns iprt status code.
- * @param   pszFilename     The full file name.
- * @param   phLdrMod        Where to store the handle to the loaded module.
- * @param   fFlags          See RTLDFLAGS_.
- * @param   pErrInfo        Where to return extended error information.
- *                          Optional.
- *
- */
-static int supR3HardenedLdrLoadIt(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo)
-{
-#ifdef VBOX_WITH_HARDENING
-    /*
-     * Verify the image file.
-     */
-    int rc = SUPR3HardenedVerifyInit();
-    if (RT_FAILURE(rc))
-        rc = supR3HardenedVerifyFixedFile(pszFilename, false /* fFatal */);
-    if (RT_FAILURE(rc))
-    {
-        LogRel(("supR3HardenedLdrLoadIt: Verification of \"%s\" failed, rc=%Rrc\n", pszFilename, rc));
-        return RTErrInfoSet(pErrInfo, rc, "supR3HardenedVerifyFixedFile failed");
-    }
-#endif
-
-    /*
-     * Try load it.
-     */
-    return RTLdrLoadEx(pszFilename, phLdrMod, fFlags, pErrInfo);
-}
-
-
-SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo)
-{
-    /*
-     * Validate input.
-     */
-    RTErrInfoClear(pErrInfo);
-    AssertPtrReturn(pszFilename, VERR_INVALID_POINTER);
-    AssertPtrReturn(phLdrMod, VERR_INVALID_POINTER);
-    *phLdrMod = NIL_RTLDRMOD;
-    AssertReturn(RTPathHavePath(pszFilename), VERR_INVALID_PARAMETER);
-
-    /*
-     * Add the default extension if it's missing.
-     */
-    if (!RTPathHaveExt(pszFilename))
-    {
-        const char *pszSuff = RTLdrGetSuff();
-        size_t      cchSuff = strlen(pszSuff);
-        size_t      cchFilename = strlen(pszFilename);
-        char       *psz = (char *)alloca(cchFilename + cchSuff + 1);
-        AssertReturn(psz, VERR_NO_TMP_MEMORY);
-        memcpy(psz, pszFilename, cchFilename);
-        memcpy(psz + cchFilename, pszSuff, cchSuff + 1);
-        pszFilename = psz;
-    }
-
-    /*
-     * Pass it on to the common library loader.
-     */
-    return supR3HardenedLdrLoadIt(pszFilename, phLdrMod, fFlags, pErrInfo);
-}
-
-
-SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo)
-{
-    LogFlow(("SUPR3HardenedLdrLoadAppPriv: pszFilename=%p:{%s} phLdrMod=%p fFlags=%08x pErrInfo=%p\n", pszFilename, pszFilename, phLdrMod, fFlags, pErrInfo));
-
-    /*
-     * Validate input.
-     */
-    RTErrInfoClear(pErrInfo);
-    AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER);
-    *phLdrMod = NIL_RTLDRMOD;
-    AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
-    AssertMsgReturn(!RTPathHavePath(pszFilename), ("%s\n", pszFilename), VERR_INVALID_PARAMETER);
-
-    /*
-     * Check the filename.
-     */
-    size_t cchFilename = strlen(pszFilename);
-    AssertMsgReturn(cchFilename < (RTPATH_MAX / 4) * 3, ("%zu\n", cchFilename), VERR_INVALID_PARAMETER);
-
-    const char *pszExt = "";
-    size_t cchExt = 0;
-    if (!RTPathHaveExt(pszFilename))
-    {
-        pszExt = RTLdrGetSuff();
-        cchExt = strlen(pszExt);
-    }
-
-    /*
-     * Construct the private arch path and check if the file exists.
-     */
-    char szPath[RTPATH_MAX];
-    int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - 1 - cchExt - cchFilename);
-    AssertRCReturn(rc, rc);
-
-    char *psz = strchr(szPath, '\0');
-    *psz++ = RTPATH_SLASH;
-    memcpy(psz, pszFilename, cchFilename);
-    psz += cchFilename;
-    memcpy(psz, pszExt, cchExt + 1);
-
-    if (!RTPathExists(szPath))
-    {
-        LogRel(("SUPR3HardenedLdrLoadAppPriv: \"%s\" not found\n", szPath));
-        return VERR_FILE_NOT_FOUND;
-    }
-
-    /*
-     * Pass it on to SUPR3HardenedLdrLoad.
-     */
-    rc = SUPR3HardenedLdrLoad(szPath, phLdrMod, fFlags, pErrInfo);
-
-    LogFlow(("SUPR3HardenedLdrLoadAppPriv: returns %Rrc\n", rc));
-    return rc;
-}
-
-
-SUPR3DECL(int) SUPR3HardenedLdrLoadPlugIn(const char *pszFilename, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo)
-{
-    /*
-     * Validate input.
-     */
-    RTErrInfoClear(pErrInfo);
-    AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER);
-    *phLdrMod = NIL_RTLDRMOD;
-    AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
-    AssertReturn(RTPathStartsWithRoot(pszFilename), VERR_INVALID_PARAMETER);
-
-#ifdef VBOX_WITH_HARDENING
-    /*
-     * Verify the image file.
-     */
-    int rc = supR3HardenedVerifyFile(pszFilename, RTHCUINTPTR_MAX, true /*fMaybe3rdParty*/, pErrInfo);
-    if (RT_FAILURE(rc))
-    {
-        if (!RTErrInfoIsSet(pErrInfo))
-            LogRel(("supR3HardenedVerifyFile: Verification of \"%s\" failed, rc=%Rrc\n", pszFilename, rc));
-        return rc;
-    }
-#endif
-
-    /*
-     * Try load it.
-     */
-    return RTLdrLoadEx(pszFilename, phLdrMod, RTLDRLOAD_FLAGS_LOCAL, pErrInfo);
-}
-
-
 SUPR3DECL(int) SUPR3QueryVTxSupported(void)
 {
 #ifdef RT_OS_LINUX
@@ -2375,7 +1669,7 @@ SUPR3DECL(int) SUPR3QueryVTCaps(uint32_t *pfCaps)
     *pfCaps = 0;
 
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VINF_SUCCESS;
 
     /*
@@ -2403,7 +1697,7 @@ SUPR3DECL(int) SUPR3QueryVTCaps(uint32_t *pfCaps)
 SUPR3DECL(int) SUPR3TracerOpen(uint32_t uCookie, uintptr_t uArg)
 {
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VINF_SUCCESS;
 
     /*
@@ -2428,7 +1722,7 @@ SUPR3DECL(int) SUPR3TracerOpen(uint32_t uCookie, uintptr_t uArg)
 SUPR3DECL(int) SUPR3TracerClose(void)
 {
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VINF_SUCCESS;
 
     /*
@@ -2451,7 +1745,7 @@ SUPR3DECL(int) SUPR3TracerClose(void)
 SUPR3DECL(int) SUPR3TracerIoCtl(uintptr_t uCmd, uintptr_t uArg, int32_t *piRetVal)
 {
     /* fake */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
     {
         *piRetVal = -1;
         return VERR_NOT_SUPPORTED;
@@ -2677,7 +1971,7 @@ SUPR3DECL(int) SUPR3TracerRegisterModule(uintptr_t hModNative, const char *pszMo
     /*
      * Fake out.
      */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VINF_SUCCESS;
 
     /*
@@ -2712,7 +2006,7 @@ SUPR3DECL(int) SUPR3TracerRegisterModule(uintptr_t hModNative, const char *pszMo
     Req.u.In.fFlags         = fFlags;
 
     memcpy(Req.u.In.szName, pszModule, cchModule + 1);
-    if (!RTPathHasExt(Req.u.In.szName))
+    if (!RTPathHasSuffix(Req.u.In.szName))
     {
         /* Add the default suffix if none is given. */
         switch (fFlags & SUP_TRACER_UMOD_FLAGS_TYPE_MASK)
@@ -2761,7 +2055,7 @@ SUPR3DECL(int) SUPR3TracerDeregisterModule(struct VTGOBJHDR *pVtgHdr)
     /*
      * Fake out.
      */
-    if (RT_UNLIKELY(g_u32FakeMode))
+    if (RT_UNLIKELY(g_uSupFakeMode))
         return VINF_SUCCESS;
 
     /*
@@ -2796,6 +2090,94 @@ DECLASM(void) suplibTracerFireProbe(PVTGPROBELOC pProbeLoc, PSUPTRACERUMODFIREPR
 }
 
 
+SUPR3DECL(int) SUPR3MsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue, bool *pfGp)
+{
+    SUPMSRPROBER  Req;
+    Req.Hdr.u32Cookie           = g_u32Cookie;
+    Req.Hdr.u32SessionCookie    = g_u32SessionCookie;
+    Req.Hdr.cbIn                = SUP_IOCTL_MSR_PROBER_SIZE_IN;
+    Req.Hdr.cbOut               = SUP_IOCTL_MSR_PROBER_SIZE_OUT;
+    Req.Hdr.fFlags              = SUPREQHDR_FLAGS_DEFAULT;
+    Req.Hdr.rc                  = VERR_INTERNAL_ERROR;
+
+    Req.u.In.enmOp              = SUPMSRPROBEROP_READ;
+    Req.u.In.uMsr               = uMsr;
+    Req.u.In.idCpu              = idCpu == NIL_RTCPUID ? UINT32_MAX : idCpu;
+
+    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_MSR_PROBER, &Req, SUP_IOCTL_MSR_PROBER_SIZE);
+    if (RT_SUCCESS(rc))
+        rc = Req.Hdr.rc;
+    if (RT_SUCCESS(rc))
+    {
+        if (puValue)
+            *puValue = Req.u.Out.uResults.Read.uValue;
+        if (pfGp)
+            *pfGp    = Req.u.Out.uResults.Read.fGp;
+    }
+
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3MsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue, bool *pfGp)
+{
+    SUPMSRPROBER  Req;
+    Req.Hdr.u32Cookie           = g_u32Cookie;
+    Req.Hdr.u32SessionCookie    = g_u32SessionCookie;
+    Req.Hdr.cbIn                = SUP_IOCTL_MSR_PROBER_SIZE_IN;
+    Req.Hdr.cbOut               = SUP_IOCTL_MSR_PROBER_SIZE_OUT;
+    Req.Hdr.fFlags              = SUPREQHDR_FLAGS_DEFAULT;
+    Req.Hdr.rc                  = VERR_INTERNAL_ERROR;
+
+    Req.u.In.enmOp                  = SUPMSRPROBEROP_WRITE;
+    Req.u.In.uMsr                   = uMsr;
+    Req.u.In.idCpu                  = idCpu == NIL_RTCPUID ? UINT32_MAX : idCpu;
+    Req.u.In.uArgs.Write.uToWrite   = uValue;
+
+    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_MSR_PROBER, &Req, SUP_IOCTL_MSR_PROBER_SIZE);
+    if (RT_SUCCESS(rc))
+        rc = Req.Hdr.rc;
+    if (RT_SUCCESS(rc) && pfGp)
+        *pfGp = Req.u.Out.uResults.Write.fGp;
+
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3MsrProberModify(uint32_t uMsr, RTCPUID idCpu, uint64_t fAndMask, uint64_t fOrMask,
+                                    PSUPMSRPROBERMODIFYRESULT pResult)
+{
+    return SUPR3MsrProberModifyEx(uMsr, idCpu, fAndMask, fOrMask, false /*fFaster*/, pResult);
+}
+
+
+SUPR3DECL(int) SUPR3MsrProberModifyEx(uint32_t uMsr, RTCPUID idCpu, uint64_t fAndMask, uint64_t fOrMask, bool fFaster,
+                                      PSUPMSRPROBERMODIFYRESULT pResult)
+{
+    SUPMSRPROBER  Req;
+    Req.Hdr.u32Cookie           = g_u32Cookie;
+    Req.Hdr.u32SessionCookie    = g_u32SessionCookie;
+    Req.Hdr.cbIn                = SUP_IOCTL_MSR_PROBER_SIZE_IN;
+    Req.Hdr.cbOut               = SUP_IOCTL_MSR_PROBER_SIZE_OUT;
+    Req.Hdr.fFlags              = SUPREQHDR_FLAGS_DEFAULT;
+    Req.Hdr.rc                  = VERR_INTERNAL_ERROR;
+
+    Req.u.In.enmOp                  = fFaster ? SUPMSRPROBEROP_MODIFY_FASTER : SUPMSRPROBEROP_MODIFY;
+    Req.u.In.uMsr                   = uMsr;
+    Req.u.In.idCpu                  = idCpu == NIL_RTCPUID ? UINT32_MAX : idCpu;
+    Req.u.In.uArgs.Modify.fAndMask  = fAndMask;
+    Req.u.In.uArgs.Modify.fOrMask   = fOrMask;
+
+    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_MSR_PROBER, &Req, SUP_IOCTL_MSR_PROBER_SIZE);
+    if (RT_SUCCESS(rc))
+        rc = Req.Hdr.rc;
+    if (RT_SUCCESS(rc))
+        *pResult = Req.u.Out.uResults.Modify;
+
+    return rc;
+}
+
+
 SUPR3DECL(int) SUPR3ResumeSuspendedKeyboards(void)
 {
 #ifdef RT_OS_DARWIN
@@ -2818,3 +2200,50 @@ SUPR3DECL(int) SUPR3ResumeSuspendedKeyboards(void)
 #endif
 }
 
+
+SUPR3DECL(int) SUPR3TscDeltaMeasure(RTCPUID idCpu, bool fAsync, bool fForce, uint8_t cRetries, uint8_t cMsWaitRetry)
+{
+    SUPTSCDELTAMEASURE Req;
+    Req.Hdr.u32Cookie        = g_u32Cookie;
+    Req.Hdr.u32SessionCookie = g_u32SessionCookie;
+    Req.Hdr.cbIn             = SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_IN;
+    Req.Hdr.cbOut            = SUP_IOCTL_TSC_DELTA_MEASURE_SIZE_OUT;
+    Req.Hdr.fFlags           = SUPREQHDR_FLAGS_DEFAULT;
+    Req.Hdr.rc               = VERR_INTERNAL_ERROR;
+
+    Req.u.In.cRetries     = cRetries;
+    Req.u.In.fAsync       = fAsync;
+    Req.u.In.fForce       = fForce;
+    Req.u.In.idCpu        = idCpu;
+    Req.u.In.cMsWaitRetry = cMsWaitRetry;
+
+    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_TSC_DELTA_MEASURE, &Req, SUP_IOCTL_TSC_DELTA_MEASURE_SIZE);
+    if (RT_SUCCESS(rc))
+        rc = Req.Hdr.rc;
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3ReadTsc(uint64_t *puTsc, uint16_t *pidApic)
+{
+    AssertReturn(puTsc, VERR_INVALID_PARAMETER);
+
+    SUPTSCREAD Req;
+    Req.Hdr.u32Cookie        = g_u32Cookie;
+    Req.Hdr.u32SessionCookie = g_u32SessionCookie;
+    Req.Hdr.cbIn             = SUP_IOCTL_TSC_READ_SIZE_IN;
+    Req.Hdr.cbOut            = SUP_IOCTL_TSC_READ_SIZE_OUT;
+    Req.Hdr.fFlags           = SUPREQHDR_FLAGS_DEFAULT;
+    Req.Hdr.rc               = VERR_INTERNAL_ERROR;
+
+    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_TSC_READ, &Req, SUP_IOCTL_TSC_READ_SIZE);
+    if (RT_SUCCESS(rc))
+    {
+        rc = Req.Hdr.rc;
+        *puTsc = Req.u.Out.u64AdjustedTsc;
+        if (pidApic)
+            *pidApic = Req.u.Out.idApic;
+    }
+    return rc;
+}
+
diff --git a/src/VBox/HostDrivers/Support/SUPLibAll.cpp b/src/VBox/HostDrivers/Support/SUPLibAll.cpp
new file mode 100644
index 0000000..fa3f0ee
--- /dev/null
+++ b/src/VBox/HostDrivers/Support/SUPLibAll.cpp
@@ -0,0 +1,273 @@
+/* $Id: SUPLibAll.cpp $ */
+/** @file
+ * VirtualBox Support Library - All Contexts Code.
+ */
+
+/*
+ * Copyright (C) 2006-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/sup.h>
+#ifdef IN_RC
+# include <VBox/vmm/vm.h>
+# include <VBox/vmm/vmm.h>
+#endif
+#ifdef IN_RING0
+# include <iprt/mp.h>
+#endif
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+# include <iprt/asm-amd64-x86.h>
+#endif
+
+
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+
+/**
+ * The slow case for SUPReadTsc where we need to apply deltas.
+ *
+ * Must only be called when deltas are applicable, so please do not call it
+ * directly.
+ *
+ * @returns TSC with delta applied.
+ * @param   pGip        Pointer to the GIP.
+ *
+ * @remarks May be called with interrupts disabled in ring-0!  This is why the
+ *          ring-0 code doesn't attempt to figure the delta.
+ *
+ * @internal
+ */
+SUPDECL(uint64_t) SUPReadTscWithDelta(PSUPGLOBALINFOPAGE pGip)
+{
+    uint64_t            uTsc;
+    uint16_t            iGipCpu;
+    AssertCompile(RT_IS_POWER_OF_TWO(RTCPUSET_MAX_CPUS));
+    AssertCompile(RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx) >= RTCPUSET_MAX_CPUS);
+    Assert(pGip->enmUseTscDelta > SUPGIPUSETSCDELTA_PRACTICALLY_ZERO);
+
+    /*
+     * Read the TSC and get the corresponding aCPUs index.
+     */
+#ifdef IN_RING3
+    if (pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS)
+    {
+        /* RDTSCP gives us all we need, no loops/cli. */
+        uint32_t iCpuSet;
+        uTsc      = ASMReadTscWithAux(&iCpuSet);
+        iCpuSet  &= RTCPUSET_MAX_CPUS - 1;
+        iGipCpu   = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    }
+    else if (pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS)
+    {
+        /* Storing the IDTR is normally very quick, but we need to loop. */
+        uint32_t cTries = 0;
+        for (;;)
+        {
+            uint16_t cbLim = ASMGetIdtrLimit();
+            uTsc = ASMReadTSC();
+            if (RT_LIKELY(ASMGetIdtrLimit() == cbLim))
+            {
+                uint16_t iCpuSet = cbLim - 256 * (ARCH_BITS == 64 ? 16 : 8);
+                iCpuSet &= RTCPUSET_MAX_CPUS - 1;
+                iGipCpu  = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+                break;
+            }
+            if (cTries >= 16)
+            {
+                iGipCpu = UINT16_MAX;
+                break;
+            }
+            cTries++;
+        }
+    }
+    else
+    {
+        /* Get APIC ID via the slow CPUID instruction, requires looping. */
+        uint32_t cTries = 0;
+        for (;;)
+        {
+            uint8_t idApic = ASMGetApicId();
+            uTsc = ASMReadTSC();
+            if (RT_LIKELY(ASMGetApicId() == idApic))
+            {
+                iGipCpu = pGip->aiCpuFromApicId[idApic];
+                break;
+            }
+            if (cTries >= 16)
+            {
+                iGipCpu = UINT16_MAX;
+                break;
+            }
+            cTries++;
+        }
+    }
+#elif defined(IN_RING0)
+    /* Ring-0: Use use RTMpCpuId(), no loops. */
+    RTCCUINTREG uFlags  = ASMIntDisableFlags();
+    int         iCpuSet = RTMpCpuIdToSetIndex(RTMpCpuId());
+    if (RT_LIKELY((unsigned)iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+        iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    else
+        iGipCpu = UINT16_MAX;
+    uTsc = ASMReadTSC();
+    ASMSetFlags(uFlags);
+
+# elif defined(IN_RC)
+    /* Raw-mode context: We can get the host CPU set index via VMCPU, no loops. */
+    RTCCUINTREG uFlags  = ASMIntDisableFlags(); /* Are already disable, but play safe. */
+    uint32_t    iCpuSet = VMMGetCpu(&g_VM)->iHostCpuSet;
+    if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+        iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    else
+        iGipCpu = UINT16_MAX;
+    uTsc = ASMReadTSC();
+    ASMSetFlags(uFlags);
+#else
+# error "IN_RING3, IN_RC or IN_RING0 must be defined!"
+#endif
+
+    /*
+     * If the delta is valid, apply it.
+     */
+    if (RT_LIKELY(iGipCpu < pGip->cCpus))
+    {
+        int64_t iTscDelta = pGip->aCPUs[iGipCpu].i64TSCDelta;
+        if (RT_LIKELY(iTscDelta != INT64_MAX))
+            return uTsc - iTscDelta;
+
+# ifdef IN_RING3
+        /*
+         * The delta needs calculating, call supdrv to get the TSC.
+         */
+        int rc = SUPR3ReadTsc(&uTsc, NULL);
+        if (RT_SUCCESS(rc))
+            return uTsc;
+        AssertMsgFailed(("SUPR3ReadTsc -> %Rrc\n", rc));
+        uTsc = ASMReadTSC();
+# endif /* IN_RING3 */
+    }
+
+    /*
+     * This shouldn't happen, especially not in ring-3 and raw-mode context.
+     * But if it does, return something that's half useful.
+     */
+    AssertMsgFailed(("iGipCpu=%d (%#x) cCpus=%d fGetGipCpu=%#x\n", iGipCpu, iGipCpu, pGip->cCpus, pGip->fGetGipCpu));
+    return uTsc;
+}
+
+
+/**
+ * Internal worker for getting the GIP CPU array index for the calling CPU.
+ *
+ * @returns Index into SUPGLOBALINFOPAGE::aCPUs or UINT16_MAX.
+ * @param   pGip    The GIP.
+ */
+DECLINLINE(uint16_t) supGetGipCpuIndex(PSUPGLOBALINFOPAGE pGip)
+{
+    uint16_t iGipCpu;
+#ifdef IN_RING3
+    if (pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS)
+    {
+        /* Storing the IDTR is normally very fast. */
+        uint16_t cbLim = ASMGetIdtrLimit();
+        uint16_t iCpuSet = cbLim - 256 * (ARCH_BITS == 64 ? 16 : 8);
+        iCpuSet  &= RTCPUSET_MAX_CPUS - 1;
+        iGipCpu   = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    }
+    else if (pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS)
+    {
+        /* RDTSCP gives us what need need and more. */
+        uint32_t iCpuSet;
+        ASMReadTscWithAux(&iCpuSet);
+        iCpuSet  &= RTCPUSET_MAX_CPUS - 1;
+        iGipCpu   = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    }
+    else
+    {
+        /* Get APIC ID via the slow CPUID instruction. */
+        uint8_t idApic = ASMGetApicId();
+        iGipCpu = pGip->aiCpuFromApicId[idApic];
+    }
+#elif defined(IN_RING0)
+    /* Ring-0: Use use RTMpCpuId() (disables cli to avoid host OS assertions about unsafe CPU number usage). */
+    RTCCUINTREG uFlags  = ASMIntDisableFlags();
+    int         iCpuSet = RTMpCpuIdToSetIndex(RTMpCpuId());
+    if (RT_LIKELY((unsigned)iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+        iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    else
+        iGipCpu = UINT16_MAX;
+    ASMSetFlags(uFlags);
+
+# elif defined(IN_RC)
+    /* Raw-mode context: We can get the host CPU set index via VMCPU. */
+    uint32_t    iCpuSet = VMMGetCpu(&g_VM)->iHostCpuSet;
+    if (RT_LIKELY(iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)))
+        iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+    else
+        iGipCpu = UINT16_MAX;
+#else
+# error "IN_RING3, IN_RC or IN_RING0 must be defined!"
+#endif
+    return iGipCpu;
+}
+
+
+/**
+ * Slow path in SUPGetTscDelta, don't call directly.
+ *
+ * @returns See SUPGetTscDelta.
+ * @param   pGip        The GIP.
+ * @internal
+ */
+SUPDECL(uint64_t) SUPGetTscDeltaSlow(PSUPGLOBALINFOPAGE pGip)
+{
+    uint16_t iGipCpu = supGetGipCpuIndex(pGip);
+    if (RT_LIKELY(iGipCpu < pGip->cCpus))
+    {
+        int64_t iTscDelta = pGip->aCPUs[iGipCpu].i64TSCDelta;
+        if (iTscDelta != INT64_MAX)
+            return iTscDelta;
+    }
+    AssertFailed();
+    return 0;
+}
+
+
+/**
+ * Slow path in SUPGetCpuHzFromGip, don't call directly.
+ *
+ * @returns See SUPGetCpuHzFromGip.
+ * @param   pGip        The GIP.
+ * @internal
+ */
+SUPDECL(uint64_t) SUPGetCpuHzFromGipForAsyncMode(PSUPGLOBALINFOPAGE pGip)
+{
+    uint16_t iGipCpu = supGetGipCpuIndex(pGip);
+    if (RT_LIKELY(iGipCpu < pGip->cCpus))
+        return pGip->aCPUs[iGipCpu].u64CpuHz;
+    AssertFailed();
+    return pGip->u64CpuHz;
+}
+
+
+#endif /* RT_ARCH_AMD64 || RT_ARCH_X86 */
+
diff --git a/src/VBox/HostDrivers/Support/SUPLibInternal.h b/src/VBox/HostDrivers/Support/SUPLibInternal.h
index b2ca829..c04dbe9 100644
--- a/src/VBox/HostDrivers/Support/SUPLibInternal.h
+++ b/src/VBox/HostDrivers/Support/SUPLibInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -332,9 +332,14 @@ typedef enum SUPR3HARDENEDMAINSTATE
 /*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
-extern DECLHIDDEN(uint32_t)     g_u32Cookie;
-extern DECLHIDDEN(uint32_t)     g_u32SessionCookie;
-extern DECLHIDDEN(SUPLIBDATA)   g_supLibData;
+extern DECLHIDDEN(uint32_t)             g_u32Cookie;
+extern DECLHIDDEN(uint32_t)             g_u32SessionCookie;
+extern DECLHIDDEN(SUPLIBDATA)           g_supLibData;
+extern DECLHIDDEN(uint32_t)             g_uSupFakeMode;
+extern DECLHIDDEN(PSUPGLOBALINFOPAGE)   g_pSUPGlobalInfoPageR0;
+#ifdef ___SUPDrvIOC_h___
+extern DECLHIDDEN(PSUPQUERYFUNCS)       g_pSupFunctions;
+#endif
 extern DECLHIDDEN(SUPR3HARDENEDMAINSTATE) g_enmSupR3HardenedMainState;
 #ifdef RT_OS_WINDOWS
 extern DECLHIDDEN(bool)                 g_fSupEarlyProcessInit;
diff --git a/src/VBox/HostDrivers/Support/SUPLibLdr.cpp b/src/VBox/HostDrivers/Support/SUPLibLdr.cpp
new file mode 100644
index 0000000..892ad1e
--- /dev/null
+++ b/src/VBox/HostDrivers/Support/SUPLibLdr.cpp
@@ -0,0 +1,799 @@
+/* $Id: SUPLibLdr.cpp $ */
+/** @file
+ * VirtualBox Support Library - Loader related bits.
+ */
+
+/*
+ * Copyright (C) 2006-2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/** @page   pg_sup          SUP - The Support Library
+ *
+ * The support library is responsible for providing facilities to load
+ * VMM Host Ring-0 code, to call Host VMM Ring-0 code from Ring-3 Host
+ * code, to pin down physical memory, and more.
+ *
+ * The VMM Host Ring-0 code can be combined in the support driver if
+ * permitted by kernel module license policies. If it is not combined
+ * it will be externalized in a .r0 module that will be loaded using
+ * the IPRT loader.
+ *
+ * The Ring-0 calling is done thru a generic SUP interface which will
+ * transfer an argument set and call a predefined entry point in the Host
+ * VMM Ring-0 code.
+ *
+ * See @ref grp_sup "SUP - Support APIs" for API details.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_SUP
+#include <VBox/sup.h>
+#include <VBox/err.h>
+#include <VBox/param.h>
+#include <VBox/log.h>
+#include <VBox/VBoxTpG.h>
+
+#include <iprt/assert.h>
+#include <iprt/alloc.h>
+#include <iprt/alloca.h>
+#include <iprt/ldr.h>
+#include <iprt/asm.h>
+#include <iprt/mp.h>
+#include <iprt/cpuset.h>
+#include <iprt/thread.h>
+#include <iprt/process.h>
+#include <iprt/path.h>
+#include <iprt/string.h>
+#include <iprt/env.h>
+#include <iprt/rand.h>
+#include <iprt/x86.h>
+
+#include "SUPDrvIOC.h"
+#include "SUPLibInternal.h"
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** R0 VMM module name. */
+#define VMMR0_NAME      "VMMR0"
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef DECLCALLBACK(int) FNCALLVMMR0(PVMR0 pVMR0, unsigned uOperation, void *pvArg);
+typedef FNCALLVMMR0 *PFNCALLVMMR0;
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** VMMR0 Load Address. */
+static RTR0PTR                  g_pvVMMR0 = NIL_RTR0PTR;
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, void **ppvImageBase);
+static DECLCALLBACK(int) supLoadModuleResolveImport(RTLDRMOD hLdrMod, const char *pszModule, const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser);
+
+
+SUPR3DECL(int) SUPR3LoadModule(const char *pszFilename, const char *pszModule, void **ppvImageBase, PRTERRINFO pErrInfo)
+{
+    /*
+     * Check that the module can be trusted.
+     */
+    int rc = SUPR3HardenedVerifyPlugIn(pszFilename, pErrInfo);
+    if (RT_SUCCESS(rc))
+    {
+        rc = supLoadModule(pszFilename, pszModule, NULL, ppvImageBase);
+        if (RT_FAILURE(rc))
+            RTErrInfoSetF(pErrInfo, rc, "SUPR3LoadModule: supLoadModule returned %Rrc", rc);
+    }
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3LoadServiceModule(const char *pszFilename, const char *pszModule,
+                                      const char *pszSrvReqHandler, void **ppvImageBase)
+{
+    AssertPtrReturn(pszSrvReqHandler, VERR_INVALID_PARAMETER);
+
+    /*
+     * Check that the module can be trusted.
+     */
+    int rc = SUPR3HardenedVerifyPlugIn(pszFilename, NULL /*pErrInfo*/);
+    if (RT_SUCCESS(rc))
+        rc = supLoadModule(pszFilename, pszModule, pszSrvReqHandler, ppvImageBase);
+    else
+        LogRel(("SUPR3LoadServiceModule: Verification of \"%s\" failed, rc=%Rrc\n", rc));
+    return rc;
+}
+
+
+/**
+ * Resolve an external symbol during RTLdrGetBits().
+ *
+ * @returns VBox status code.
+ * @param   hLdrMod         The loader module handle.
+ * @param   pszModule       Module name.
+ * @param   pszSymbol       Symbol name, NULL if uSymbol should be used.
+ * @param   uSymbol         Symbol ordinal, ~0 if pszSymbol should be used.
+ * @param   pValue          Where to store the symbol value (address).
+ * @param   pvUser          User argument.
+ */
+static DECLCALLBACK(int) supLoadModuleResolveImport(RTLDRMOD hLdrMod, const char *pszModule,
+                                                    const char *pszSymbol, unsigned uSymbol, RTUINTPTR *pValue, void *pvUser)
+{
+    NOREF(hLdrMod); NOREF(pvUser); NOREF(uSymbol);
+    AssertPtr(pValue);
+    AssertPtr(pvUser);
+
+    /*
+     * Only SUPR0 and VMMR0.r0
+     */
+    if (    pszModule
+        &&  *pszModule
+        &&  strcmp(pszModule, "VBoxDrv.sys")
+        &&  strcmp(pszModule, "VMMR0.r0"))
+    {
+        AssertMsgFailed(("%s is importing from %s! (expected 'SUPR0.dll' or 'VMMR0.r0', case-sensitive)\n", pvUser, pszModule));
+        return VERR_SYMBOL_NOT_FOUND;
+    }
+
+    /*
+     * No ordinals.
+     */
+    if (pszSymbol < (const char*)0x10000)
+    {
+        AssertMsgFailed(("%s is importing by ordinal (ord=%d)\n", pvUser, (int)(uintptr_t)pszSymbol));
+        return VERR_SYMBOL_NOT_FOUND;
+    }
+
+    /*
+     * Lookup symbol.
+     */
+    /** @todo is this actually used??? */
+    /* skip the 64-bit ELF import prefix first. */
+    if (!strncmp(pszSymbol, RT_STR_TUPLE("SUPR0$")))
+        pszSymbol += sizeof("SUPR0$") - 1;
+
+    /*
+     * Check the VMMR0.r0 module if loaded.
+     */
+    /** @todo call the SUPR3LoadModule caller.... */
+    /** @todo proper reference counting and such. */
+    if (g_pvVMMR0 != NIL_RTR0PTR)
+    {
+        void *pvValue;
+        if (!SUPR3GetSymbolR0((void *)g_pvVMMR0, pszSymbol, &pvValue))
+        {
+            *pValue = (uintptr_t)pvValue;
+            return VINF_SUCCESS;
+        }
+    }
+
+    /* iterate the function table. */
+    int c = g_pSupFunctions->u.Out.cFunctions;
+    PSUPFUNC pFunc = &g_pSupFunctions->u.Out.aFunctions[0];
+    while (c-- > 0)
+    {
+        if (!strcmp(pFunc->szName, pszSymbol))
+        {
+            *pValue = (uintptr_t)pFunc->pfn;
+            return VINF_SUCCESS;
+        }
+        pFunc++;
+    }
+
+    /*
+     * The GIP.
+     */
+    if (    pszSymbol
+        &&  g_pSUPGlobalInfoPage
+        &&  g_pSUPGlobalInfoPageR0
+        &&  !strcmp(pszSymbol, "g_SUPGlobalInfoPage")
+       )
+    {
+        *pValue = (uintptr_t)g_pSUPGlobalInfoPageR0;
+        return VINF_SUCCESS;
+    }
+
+    /*
+     * Symbols that are undefined by convention.
+     */
+#ifdef RT_OS_SOLARIS
+    static const char * const s_apszConvSyms[] =
+    {
+        "", "mod_getctl",
+        "", "mod_install",
+        "", "mod_remove",
+        "", "mod_info",
+        "", "mod_miscops",
+    };
+    for (unsigned i = 0; i < RT_ELEMENTS(s_apszConvSyms); i += 2)
+    {
+        if (   !RTStrCmp(s_apszConvSyms[i],     pszModule)
+            && !RTStrCmp(s_apszConvSyms[i + 1], pszSymbol))
+        {
+            *pValue = ~(uintptr_t)0;
+            return VINF_SUCCESS;
+        }
+    }
+#endif
+
+    /*
+     * Despair.
+     */
+    c = g_pSupFunctions->u.Out.cFunctions;
+    pFunc = &g_pSupFunctions->u.Out.aFunctions[0];
+    while (c-- > 0)
+    {
+        RTAssertMsg2Weak("%d: %s\n", g_pSupFunctions->u.Out.cFunctions - c, pFunc->szName);
+        pFunc++;
+    }
+
+    AssertLogRelMsgFailed(("%s is importing %s which we couldn't find\n", pvUser, pszSymbol));
+    if (g_uSupFakeMode)
+    {
+        *pValue = 0xdeadbeef;
+        return VINF_SUCCESS;
+    }
+    return VERR_SYMBOL_NOT_FOUND;
+}
+
+
+/** Argument package for supLoadModuleCalcSizeCB. */
+typedef struct SUPLDRCALCSIZEARGS
+{
+    size_t          cbStrings;
+    uint32_t        cSymbols;
+    size_t          cbImage;
+} SUPLDRCALCSIZEARGS, *PSUPLDRCALCSIZEARGS;
+
+/**
+ * Callback used to calculate the image size.
+ * @return VINF_SUCCESS
+ */
+static DECLCALLBACK(int) supLoadModuleCalcSizeCB(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol, RTUINTPTR Value, void *pvUser)
+{
+    PSUPLDRCALCSIZEARGS pArgs = (PSUPLDRCALCSIZEARGS)pvUser;
+    if (    pszSymbol != NULL
+        &&  *pszSymbol
+        &&  Value <= pArgs->cbImage)
+    {
+        pArgs->cSymbols++;
+        pArgs->cbStrings += strlen(pszSymbol) + 1;
+    }
+    NOREF(hLdrMod); NOREF(uSymbol);
+    return VINF_SUCCESS;
+}
+
+
+/** Argument package for supLoadModuleCreateTabsCB. */
+typedef struct SUPLDRCREATETABSARGS
+{
+    size_t          cbImage;
+    PSUPLDRSYM      pSym;
+    char           *pszBase;
+    char           *psz;
+} SUPLDRCREATETABSARGS, *PSUPLDRCREATETABSARGS;
+
+/**
+ * Callback used to calculate the image size.
+ * @return VINF_SUCCESS
+ */
+static DECLCALLBACK(int) supLoadModuleCreateTabsCB(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol, RTUINTPTR Value, void *pvUser)
+{
+    PSUPLDRCREATETABSARGS pArgs = (PSUPLDRCREATETABSARGS)pvUser;
+    if (    pszSymbol != NULL
+        &&  *pszSymbol
+        &&  Value <= pArgs->cbImage)
+    {
+        pArgs->pSym->offSymbol = (uint32_t)Value;
+        pArgs->pSym->offName = pArgs->psz - pArgs->pszBase;
+        pArgs->pSym++;
+
+        size_t cbCopy = strlen(pszSymbol) + 1;
+        memcpy(pArgs->psz, pszSymbol, cbCopy);
+        pArgs->psz += cbCopy;
+    }
+    NOREF(hLdrMod); NOREF(uSymbol);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Worker for SUPR3LoadModule().
+ *
+ * @returns VBox status code.
+ * @param   pszFilename     Name of the VMMR0 image file
+ */
+static int supLoadModule(const char *pszFilename, const char *pszModule, const char *pszSrvReqHandler, void **ppvImageBase)
+{
+    int rc;
+
+    /*
+     * Validate input.
+     */
+    AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pszModule, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(ppvImageBase, VERR_INVALID_PARAMETER);
+    AssertReturn(strlen(pszModule) < RT_SIZEOFMEMB(SUPLDROPEN, u.In.szName), VERR_FILENAME_TOO_LONG);
+    char szAbsFilename[RT_SIZEOFMEMB(SUPLDROPEN, u.In.szFilename)];
+    rc = RTPathAbs(pszFilename, szAbsFilename, sizeof(szAbsFilename));
+    if (RT_FAILURE(rc))
+        return rc;
+    pszFilename = szAbsFilename;
+
+    const bool fIsVMMR0 = !strcmp(pszModule, "VMMR0.r0");
+    AssertReturn(!pszSrvReqHandler || !fIsVMMR0, VERR_INTERNAL_ERROR);
+    *ppvImageBase = NULL;
+
+    /*
+     * Open image file and figure its size.
+     */
+    RTLDRMOD hLdrMod;
+    rc = RTLdrOpen(pszFilename, 0, RTLDRARCH_HOST, &hLdrMod);
+    if (!RT_SUCCESS(rc))
+    {
+        LogRel(("SUP: RTLdrOpen failed for %s (%s)\n", pszModule, pszFilename, rc));
+        return rc;
+    }
+
+    SUPLDRCALCSIZEARGS CalcArgs;
+    CalcArgs.cbStrings = 0;
+    CalcArgs.cSymbols = 0;
+    CalcArgs.cbImage = RTLdrSize(hLdrMod);
+    rc = RTLdrEnumSymbols(hLdrMod, 0, NULL, 0, supLoadModuleCalcSizeCB, &CalcArgs);
+    if (RT_SUCCESS(rc))
+    {
+        const uint32_t  offSymTab = RT_ALIGN_32(CalcArgs.cbImage, 8);
+        const uint32_t  offStrTab = offSymTab + CalcArgs.cSymbols * sizeof(SUPLDRSYM);
+        const uint32_t  cbImageWithTabs = RT_ALIGN_32(offStrTab + CalcArgs.cbStrings, 8);
+
+        /*
+         * Open the R0 image.
+         */
+        SUPLDROPEN OpenReq;
+        OpenReq.Hdr.u32Cookie = g_u32Cookie;
+        OpenReq.Hdr.u32SessionCookie = g_u32SessionCookie;
+        OpenReq.Hdr.cbIn = SUP_IOCTL_LDR_OPEN_SIZE_IN;
+        OpenReq.Hdr.cbOut = SUP_IOCTL_LDR_OPEN_SIZE_OUT;
+        OpenReq.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT;
+        OpenReq.Hdr.rc = VERR_INTERNAL_ERROR;
+        OpenReq.u.In.cbImageWithTabs = cbImageWithTabs;
+        OpenReq.u.In.cbImageBits = (uint32_t)CalcArgs.cbImage;
+        strcpy(OpenReq.u.In.szName, pszModule);
+        strcpy(OpenReq.u.In.szFilename, pszFilename);
+        if (!g_uSupFakeMode)
+        {
+            rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_OPEN, &OpenReq, SUP_IOCTL_LDR_OPEN_SIZE);
+            if (RT_SUCCESS(rc))
+                rc = OpenReq.Hdr.rc;
+        }
+        else
+        {
+            OpenReq.u.Out.fNeedsLoading = true;
+            OpenReq.u.Out.pvImageBase = 0xef423420;
+        }
+        *ppvImageBase = (void *)OpenReq.u.Out.pvImageBase;
+        if (    RT_SUCCESS(rc)
+            &&  OpenReq.u.Out.fNeedsLoading)
+        {
+            /*
+             * We need to load it.
+             * Allocate memory for the image bits.
+             */
+            PSUPLDRLOAD pLoadReq = (PSUPLDRLOAD)RTMemTmpAlloc(SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs));
+            if (pLoadReq)
+            {
+                /*
+                 * Get the image bits.
+                 */
+                rc = RTLdrGetBits(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase,
+                                  supLoadModuleResolveImport, (void *)pszModule);
+
+                if (RT_SUCCESS(rc))
+                {
+                    /*
+                     * Get the entry points.
+                     */
+                    RTUINTPTR VMMR0EntryInt = 0;
+                    RTUINTPTR VMMR0EntryFast = 0;
+                    RTUINTPTR VMMR0EntryEx = 0;
+                    RTUINTPTR SrvReqHandler = 0;
+                    RTUINTPTR ModuleInit = 0;
+                    RTUINTPTR ModuleTerm = 0;
+                    if (fIsVMMR0)
+                    {
+                        rc = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase, UINT32_MAX, "VMMR0EntryInt", &VMMR0EntryInt);
+                        if (RT_SUCCESS(rc))
+                            rc = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase, UINT32_MAX, "VMMR0EntryFast", &VMMR0EntryFast);
+                        if (RT_SUCCESS(rc))
+                            rc = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase, UINT32_MAX, "VMMR0EntryEx", &VMMR0EntryEx);
+                    }
+                    else if (pszSrvReqHandler)
+                        rc = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase, UINT32_MAX, pszSrvReqHandler, &SrvReqHandler);
+                    if (RT_SUCCESS(rc))
+                    {
+                        int rc2 = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase, UINT32_MAX, "ModuleInit", &ModuleInit);
+                        if (RT_FAILURE(rc2))
+                            ModuleInit = 0;
+
+                        rc2 = RTLdrGetSymbolEx(hLdrMod, &pLoadReq->u.In.abImage[0], (uintptr_t)OpenReq.u.Out.pvImageBase, UINT32_MAX, "ModuleTerm", &ModuleTerm);
+                        if (RT_FAILURE(rc2))
+                            ModuleTerm = 0;
+                    }
+                    if (RT_SUCCESS(rc))
+                    {
+                        /*
+                         * Create the symbol and string tables.
+                         */
+                        SUPLDRCREATETABSARGS CreateArgs;
+                        CreateArgs.cbImage = CalcArgs.cbImage;
+                        CreateArgs.pSym    = (PSUPLDRSYM)&pLoadReq->u.In.abImage[offSymTab];
+                        CreateArgs.pszBase =     (char *)&pLoadReq->u.In.abImage[offStrTab];
+                        CreateArgs.psz     = CreateArgs.pszBase;
+                        rc = RTLdrEnumSymbols(hLdrMod, 0, NULL, 0, supLoadModuleCreateTabsCB, &CreateArgs);
+                        if (RT_SUCCESS(rc))
+                        {
+                            AssertRelease((size_t)(CreateArgs.psz - CreateArgs.pszBase) <= CalcArgs.cbStrings);
+                            AssertRelease((size_t)(CreateArgs.pSym - (PSUPLDRSYM)&pLoadReq->u.In.abImage[offSymTab]) <= CalcArgs.cSymbols);
+
+                            /*
+                             * Upload the image.
+                             */
+                            pLoadReq->Hdr.u32Cookie = g_u32Cookie;
+                            pLoadReq->Hdr.u32SessionCookie = g_u32SessionCookie;
+                            pLoadReq->Hdr.cbIn = SUP_IOCTL_LDR_LOAD_SIZE_IN(cbImageWithTabs);
+                            pLoadReq->Hdr.cbOut = SUP_IOCTL_LDR_LOAD_SIZE_OUT;
+                            pLoadReq->Hdr.fFlags = SUPREQHDR_FLAGS_MAGIC | SUPREQHDR_FLAGS_EXTRA_IN;
+                            pLoadReq->Hdr.rc = VERR_INTERNAL_ERROR;
+
+                            pLoadReq->u.In.pfnModuleInit              = (RTR0PTR)ModuleInit;
+                            pLoadReq->u.In.pfnModuleTerm              = (RTR0PTR)ModuleTerm;
+                            if (fIsVMMR0)
+                            {
+                                pLoadReq->u.In.eEPType                = SUPLDRLOADEP_VMMR0;
+                                pLoadReq->u.In.EP.VMMR0.pvVMMR0       = OpenReq.u.Out.pvImageBase;
+                                pLoadReq->u.In.EP.VMMR0.pvVMMR0EntryInt = (RTR0PTR)VMMR0EntryInt;
+                                pLoadReq->u.In.EP.VMMR0.pvVMMR0EntryFast= (RTR0PTR)VMMR0EntryFast;
+                                pLoadReq->u.In.EP.VMMR0.pvVMMR0EntryEx  = (RTR0PTR)VMMR0EntryEx;
+                            }
+                            else if (pszSrvReqHandler)
+                            {
+                                pLoadReq->u.In.eEPType                = SUPLDRLOADEP_SERVICE;
+                                pLoadReq->u.In.EP.Service.pfnServiceReq = (RTR0PTR)SrvReqHandler;
+                                pLoadReq->u.In.EP.Service.apvReserved[0] = NIL_RTR0PTR;
+                                pLoadReq->u.In.EP.Service.apvReserved[1] = NIL_RTR0PTR;
+                                pLoadReq->u.In.EP.Service.apvReserved[2] = NIL_RTR0PTR;
+                            }
+                            else
+                                pLoadReq->u.In.eEPType                = SUPLDRLOADEP_NOTHING;
+                            pLoadReq->u.In.offStrTab                  = offStrTab;
+                            pLoadReq->u.In.cbStrTab                   = (uint32_t)CalcArgs.cbStrings;
+                            AssertRelease(pLoadReq->u.In.cbStrTab == CalcArgs.cbStrings);
+                            pLoadReq->u.In.cbImageBits                = (uint32_t)CalcArgs.cbImage;
+                            pLoadReq->u.In.offSymbols                 = offSymTab;
+                            pLoadReq->u.In.cSymbols                   = CalcArgs.cSymbols;
+                            pLoadReq->u.In.cbImageWithTabs            = cbImageWithTabs;
+                            pLoadReq->u.In.pvImageBase                = OpenReq.u.Out.pvImageBase;
+                            if (!g_uSupFakeMode)
+                            {
+                                rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_LOAD, pLoadReq, SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs));
+                                if (RT_SUCCESS(rc))
+                                    rc = pLoadReq->Hdr.rc;
+                                else
+                                    LogRel(("SUP: SUP_IOCTL_LDR_LOAD ioctl for %s (%s) failed rc=%Rrc\n", pszModule, pszFilename, rc));
+                            }
+                            else
+                                rc = VINF_SUCCESS;
+                            if (    RT_SUCCESS(rc)
+                                ||  rc == VERR_ALREADY_LOADED /* A competing process. */
+                               )
+                            {
+                                LogRel(("SUP: Loaded %s (%s) at %#p - ModuleInit at %RTptr and ModuleTerm at %RTptr%s\n",
+                                        pszModule, pszFilename, OpenReq.u.Out.pvImageBase, ModuleInit, ModuleTerm,
+                                        OpenReq.u.Out.fNativeLoader ? " using the native ring-0 loader" : ""));
+                                if (fIsVMMR0)
+                                {
+                                    g_pvVMMR0 = OpenReq.u.Out.pvImageBase;
+                                    LogRel(("SUP: VMMR0EntryEx located at %RTptr, VMMR0EntryFast at %RTptr and VMMR0EntryInt at %RTptr\n",
+                                            VMMR0EntryEx, VMMR0EntryFast, VMMR0EntryInt));
+                                }
+#ifdef RT_OS_WINDOWS
+                                LogRel(("SUP: windbg> .reload /f %s=%#p\n", pszFilename, OpenReq.u.Out.pvImageBase));
+#endif
+
+                                RTMemTmpFree(pLoadReq);
+                                RTLdrClose(hLdrMod);
+                                return VINF_SUCCESS;
+                            }
+                            else
+                                LogRel(("SUP: Loading failed for %s (%s) rc=%Rrc\n", pszModule, pszFilename, rc));
+                        }
+                        else
+                            LogRel(("SUP: RTLdrEnumSymbols failed for %s (%s) rc=%Rrc\n", pszModule, pszFilename, rc));
+                    }
+                    else
+                        LogRel(("SUP: Failed to get entry points for %s (%s) rc=%Rrc\n", pszModule, pszFilename, rc));
+                }
+                else
+                    LogRel(("SUP: RTLdrGetBits failed for %s (%s). rc=%Rrc\n", pszModule, pszFilename, rc));
+                RTMemTmpFree(pLoadReq);
+            }
+            else
+            {
+                AssertMsgFailed(("failed to allocated %u bytes for SUPLDRLOAD_IN structure!\n", SUP_IOCTL_LDR_LOAD_SIZE(cbImageWithTabs)));
+                rc = VERR_NO_TMP_MEMORY;
+            }
+        }
+        else if (RT_SUCCESS(rc))
+        {
+            if (fIsVMMR0)
+                g_pvVMMR0 = OpenReq.u.Out.pvImageBase;
+            LogRel(("SUP: Opened %s (%s) at %#p.\n", pszModule, pszFilename, OpenReq.u.Out.pvImageBase,
+                    OpenReq.u.Out.fNativeLoader ? " loaded by the native ring-0 loader" : ""));
+#ifdef RT_OS_WINDOWS
+            LogRel(("SUP: windbg> .reload /f %s=%#p\n", pszFilename, OpenReq.u.Out.pvImageBase));
+#endif
+        }
+    }
+    RTLdrClose(hLdrMod);
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3FreeModule(void *pvImageBase)
+{
+    /* fake */
+    if (RT_UNLIKELY(g_uSupFakeMode))
+    {
+        g_pvVMMR0 = NIL_RTR0PTR;
+        return VINF_SUCCESS;
+    }
+
+    /*
+     * Free the requested module.
+     */
+    SUPLDRFREE Req;
+    Req.Hdr.u32Cookie = g_u32Cookie;
+    Req.Hdr.u32SessionCookie = g_u32SessionCookie;
+    Req.Hdr.cbIn = SUP_IOCTL_LDR_FREE_SIZE_IN;
+    Req.Hdr.cbOut = SUP_IOCTL_LDR_FREE_SIZE_OUT;
+    Req.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT;
+    Req.Hdr.rc = VERR_INTERNAL_ERROR;
+    Req.u.In.pvImageBase = (RTR0PTR)pvImageBase;
+    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_FREE, &Req, SUP_IOCTL_LDR_FREE_SIZE);
+    if (RT_SUCCESS(rc))
+        rc = Req.Hdr.rc;
+    if (    RT_SUCCESS(rc)
+        &&  (RTR0PTR)pvImageBase == g_pvVMMR0)
+        g_pvVMMR0 = NIL_RTR0PTR;
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3GetSymbolR0(void *pvImageBase, const char *pszSymbol, void **ppvValue)
+{
+    *ppvValue = NULL;
+
+    /* fake */
+    if (RT_UNLIKELY(g_uSupFakeMode))
+    {
+        *ppvValue = (void *)(uintptr_t)0xdeadf00d;
+        return VINF_SUCCESS;
+    }
+
+    /*
+     * Do ioctl.
+     */
+    SUPLDRGETSYMBOL Req;
+    Req.Hdr.u32Cookie = g_u32Cookie;
+    Req.Hdr.u32SessionCookie = g_u32SessionCookie;
+    Req.Hdr.cbIn = SUP_IOCTL_LDR_GET_SYMBOL_SIZE_IN;
+    Req.Hdr.cbOut = SUP_IOCTL_LDR_GET_SYMBOL_SIZE_OUT;
+    Req.Hdr.fFlags = SUPREQHDR_FLAGS_DEFAULT;
+    Req.Hdr.rc = VERR_INTERNAL_ERROR;
+    Req.u.In.pvImageBase = (RTR0PTR)pvImageBase;
+    size_t cchSymbol = strlen(pszSymbol);
+    if (cchSymbol >= sizeof(Req.u.In.szSymbol))
+        return VERR_SYMBOL_NOT_FOUND;
+    memcpy(Req.u.In.szSymbol, pszSymbol, cchSymbol + 1);
+    int rc = suplibOsIOCtl(&g_supLibData, SUP_IOCTL_LDR_GET_SYMBOL, &Req, SUP_IOCTL_LDR_GET_SYMBOL_SIZE);
+    if (RT_SUCCESS(rc))
+        rc = Req.Hdr.rc;
+    if (RT_SUCCESS(rc))
+        *ppvValue = (void *)Req.u.Out.pvSymbol;
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3LoadVMM(const char *pszFilename)
+{
+    void *pvImageBase;
+    return SUPR3LoadModule(pszFilename, "VMMR0.r0", &pvImageBase, NULL /*pErrInfo*/);
+}
+
+
+SUPR3DECL(int) SUPR3UnloadVMM(void)
+{
+    return SUPR3FreeModule((void*)g_pvVMMR0);
+}
+
+
+/**
+ * Worker for SUPR3HardenedLdrLoad and SUPR3HardenedLdrLoadAppPriv.
+ *
+ * @returns iprt status code.
+ * @param   pszFilename     The full file name.
+ * @param   phLdrMod        Where to store the handle to the loaded module.
+ * @param   fFlags          See RTLDFLAGS_.
+ * @param   pErrInfo        Where to return extended error information.
+ *                          Optional.
+ *
+ */
+static int supR3HardenedLdrLoadIt(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo)
+{
+#ifdef VBOX_WITH_HARDENING
+    /*
+     * Verify the image file.
+     */
+    int rc = SUPR3HardenedVerifyInit();
+    if (RT_FAILURE(rc))
+        rc = supR3HardenedVerifyFixedFile(pszFilename, false /* fFatal */);
+    if (RT_FAILURE(rc))
+    {
+        LogRel(("supR3HardenedLdrLoadIt: Verification of \"%s\" failed, rc=%Rrc\n", pszFilename, rc));
+        return RTErrInfoSet(pErrInfo, rc, "supR3HardenedVerifyFixedFile failed");
+    }
+#endif
+
+    /*
+     * Try load it.
+     */
+    return RTLdrLoadEx(pszFilename, phLdrMod, fFlags, pErrInfo);
+}
+
+
+SUPR3DECL(int) SUPR3HardenedLdrLoad(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo)
+{
+    /*
+     * Validate input.
+     */
+    RTErrInfoClear(pErrInfo);
+    AssertPtrReturn(pszFilename, VERR_INVALID_POINTER);
+    AssertPtrReturn(phLdrMod, VERR_INVALID_POINTER);
+    *phLdrMod = NIL_RTLDRMOD;
+    AssertReturn(RTPathHavePath(pszFilename), VERR_INVALID_PARAMETER);
+
+    /*
+     * Add the default extension if it's missing.
+     */
+    if (!RTPathHasSuffix(pszFilename))
+    {
+        const char *pszSuff = RTLdrGetSuff();
+        size_t      cchSuff = strlen(pszSuff);
+        size_t      cchFilename = strlen(pszFilename);
+        char       *psz = (char *)alloca(cchFilename + cchSuff + 1);
+        AssertReturn(psz, VERR_NO_TMP_MEMORY);
+        memcpy(psz, pszFilename, cchFilename);
+        memcpy(psz + cchFilename, pszSuff, cchSuff + 1);
+        pszFilename = psz;
+    }
+
+    /*
+     * Pass it on to the common library loader.
+     */
+    return supR3HardenedLdrLoadIt(pszFilename, phLdrMod, fFlags, pErrInfo);
+}
+
+
+SUPR3DECL(int) SUPR3HardenedLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod, uint32_t fFlags, PRTERRINFO pErrInfo)
+{
+    LogFlow(("SUPR3HardenedLdrLoadAppPriv: pszFilename=%p:{%s} phLdrMod=%p fFlags=%08x pErrInfo=%p\n", pszFilename, pszFilename, phLdrMod, fFlags, pErrInfo));
+
+    /*
+     * Validate input.
+     */
+    RTErrInfoClear(pErrInfo);
+    AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER);
+    *phLdrMod = NIL_RTLDRMOD;
+    AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!RTPathHavePath(pszFilename), ("%s\n", pszFilename), VERR_INVALID_PARAMETER);
+
+    /*
+     * Check the filename.
+     */
+    size_t cchFilename = strlen(pszFilename);
+    AssertMsgReturn(cchFilename < (RTPATH_MAX / 4) * 3, ("%zu\n", cchFilename), VERR_INVALID_PARAMETER);
+
+    const char *pszExt = "";
+    size_t cchExt = 0;
+    if (!RTPathHasSuffix(pszFilename))
+    {
+        pszExt = RTLdrGetSuff();
+        cchExt = strlen(pszExt);
+    }
+
+    /*
+     * Construct the private arch path and check if the file exists.
+     */
+    char szPath[RTPATH_MAX];
+    int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - 1 - cchExt - cchFilename);
+    AssertRCReturn(rc, rc);
+
+    char *psz = strchr(szPath, '\0');
+    *psz++ = RTPATH_SLASH;
+    memcpy(psz, pszFilename, cchFilename);
+    psz += cchFilename;
+    memcpy(psz, pszExt, cchExt + 1);
+
+    if (!RTPathExists(szPath))
+    {
+        LogRel(("SUPR3HardenedLdrLoadAppPriv: \"%s\" not found\n", szPath));
+        return VERR_FILE_NOT_FOUND;
+    }
+
+    /*
+     * Pass it on to SUPR3HardenedLdrLoad.
+     */
+    rc = SUPR3HardenedLdrLoad(szPath, phLdrMod, fFlags, pErrInfo);
+
+    LogFlow(("SUPR3HardenedLdrLoadAppPriv: returns %Rrc\n", rc));
+    return rc;
+}
+
+
+SUPR3DECL(int) SUPR3HardenedLdrLoadPlugIn(const char *pszFilename, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo)
+{
+    /*
+     * Validate input.
+     */
+    RTErrInfoClear(pErrInfo);
+    AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER);
+    *phLdrMod = NIL_RTLDRMOD;
+    AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
+    AssertReturn(RTPathStartsWithRoot(pszFilename), VERR_INVALID_PARAMETER);
+
+#ifdef VBOX_WITH_HARDENING
+    /*
+     * Verify the image file.
+     */
+    int rc = supR3HardenedVerifyFile(pszFilename, RTHCUINTPTR_MAX, true /*fMaybe3rdParty*/, pErrInfo);
+    if (RT_FAILURE(rc))
+    {
+        if (!RTErrInfoIsSet(pErrInfo))
+            LogRel(("supR3HardenedVerifyFile: Verification of \"%s\" failed, rc=%Rrc\n", pszFilename, rc));
+        return rc;
+    }
+#endif
+
+    /*
+     * Try load it.
+     */
+    return RTLdrLoadEx(pszFilename, phLdrMod, RTLDRLOAD_FLAGS_LOCAL, pErrInfo);
+}
+
diff --git a/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp b/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp
index 8e34c8a..20c4cf1 100644
--- a/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp
+++ b/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -230,7 +230,7 @@ static SUPINSTFILE const    g_aSupInstallFiles[] =
     HARDENED_TESTCASE_ENTRY("tstCFGM"),
     HARDENED_TESTCASE_ENTRY("tstIntNet-1"),
     HARDENED_TESTCASE_ENTRY("tstMMHyperHeap"),
-    HARDENED_TESTCASE_ENTRY("tstR0ThreadPreemptionDriver"),
+    HARDENED_TESTCASE_ENTRY("tstRTR0ThreadPreemptionDriver"),
     HARDENED_TESTCASE_ENTRY("tstRTR0MemUserKernelDriver"),
     HARDENED_TESTCASE_ENTRY("tstRTR0SemMutexDriver"),
     HARDENED_TESTCASE_ENTRY("tstRTR0TimerDriver"),
@@ -1727,7 +1727,7 @@ DECLHIDDEN(int) supR3HardenedVerifyFile(const char *pszFilename, RTHCUINTPTR hNa
         uint32_t fFlags = SUPHNTVI_F_REQUIRE_KERNEL_CODE_SIGNING;
         if (!fMaybe3rdParty)
             fFlags = SUPHNTVI_F_REQUIRE_BUILD_CERT;
-        const char *pszSuffix = RTPathExt(pszFilename);
+        const char *pszSuffix = RTPathSuffix(pszFilename);
         if (   pszSuffix
             &&                   pszSuffix[0]  == '.'
             && (   RT_C_TO_LOWER(pszSuffix[1]) == 'r'
diff --git a/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp b/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
index e1c4dad..2eff2e1 100644
--- a/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
+++ b/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
@@ -78,6 +78,11 @@ RT_C_DECLS_BEGIN
 RT_C_DECLS_END
 #endif
 
+/* Temporary debugging. */
+#define VBOX_PROC_SELFNAME_LEN  (20)
+#define VBOX_RETRIEVE_CUR_PROC_NAME(_name)    char _name[VBOX_PROC_SELFNAME_LEN]; \
+                                              proc_selfname(pszProcName, VBOX_PROC_SELFNAME_LEN)
+
 
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
@@ -233,6 +238,15 @@ static PFNRT            g_pfnVmxResume = NULL;
 /** Pointer to vmx_use_count. */
 static int volatile    *g_pVmxUseCount = NULL;
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+/** Pointer to rdmsr_carefully if found. Returns 0 on success. */
+static int             (*g_pfnRdMsrCarefully)(uint32_t uMsr, uint32_t *puLow, uint32_t *puHigh) = NULL;
+/** Pointer to rdmsr64_carefully if found. Returns 0 on success. */
+static int             (*g_pfnRdMsr64Carefully)(uint32_t uMsr, uint64_t *uValue) = NULL;
+/** Pointer to wrmsr[64]_carefully if found. Returns 0 on success. */
+static int             (*g_pfnWrMsr64Carefully)(uint32_t uMsr, uint64_t uValue) = NULL;
+#endif
+
 
 /**
  * Start the kernel module.
@@ -358,6 +372,25 @@ static void vboxdrvDarwinResolveSymbols(void)
             g_pVmxUseCount  = NULL;
         }
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+        /* MSR prober stuff. */
+        int rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, "rdmsr_carefully", (void **)&g_pfnRdMsrCarefully);
+        if (RT_FAILURE(rc))
+            g_pfnRdMsrCarefully = NULL;
+        rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, "rdmsr64_carefully", (void **)&g_pfnRdMsr64Carefully);
+        if (RT_FAILURE(rc))
+            g_pfnRdMsr64Carefully = NULL;
+# ifdef RT_ARCH_AMD64 /* Missing 64 in name, so if implemented on 32-bit it could have different signature. */
+        rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, "wrmsr_carefully", (void **)&g_pfnWrMsr64Carefully);
+        if (RT_FAILURE(rc))
+# endif
+            g_pfnWrMsr64Carefully = NULL;
+
+        LogRel(("VBoxDrv: g_pfnRdMsrCarefully=%p g_pfnRdMsr64Carefully=%p g_pfnWrMsr64Carefully=%p\n",
+                g_pfnRdMsrCarefully, g_pfnRdMsr64Carefully, g_pfnWrMsr64Carefully));
+
+#endif /* SUPDRV_WITH_MSR_PROBER */
+
         RTR0DbgKrnlInfoRelease(hKrnlInfo);
     }
     else
@@ -480,7 +513,7 @@ static int VBoxDrvDarwinOpen(dev_t Dev, int fFlags, int fDevType, struct proc *p
         else
             rc = VERR_GENERAL_FAILURE;
 
-        RTSpinlockReleaseNoInts(g_Spinlock);
+        RTSpinlockRelease(g_Spinlock);
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
         kauth_cred_unref(&pCred);
 #else  /* 10.4 */
@@ -546,7 +579,7 @@ static int VBoxDrvDarwinIOCtl(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags,
     if (RT_LIKELY(pSession))
         supdrvSessionRetain(pSession);
 
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
     if (RT_UNLIKELY(!pSession))
     {
         OSDBGPRINT(("VBoxDrvDarwinIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#lx\n",
@@ -953,6 +986,18 @@ bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
 }
 
 
+bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void)
+{
+    /** @todo verify this. */
+    return false;
+}
+
+
+bool VBOXCALL supdrvOSAreTscDeltasInSync(void)
+{
+    return false;
+}
+
 void VBOXCALL   supdrvOSLdrNotifyOpened(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
 {
 #if 1
@@ -1007,6 +1052,181 @@ void VBOXCALL   supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
 }
 
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+
+typedef struct SUPDRVDARWINMSRARGS
+{
+    RTUINT64U       uValue;
+    uint32_t        uMsr;
+    int             rc;
+} SUPDRVDARWINMSRARGS, *PSUPDRVDARWINMSRARGS;
+
+/**
+ * On CPU worker for supdrvOSMsrProberRead.
+ *
+ * @param   idCpu           Ignored.
+ * @param   pvUser1         Pointer to a SUPDRVDARWINMSRARGS.
+ * @param   pvUser2         Ignored.
+ */
+static DECLCALLBACK(void) supdrvDarwinMsrProberReadOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PSUPDRVDARWINMSRARGS pArgs = (PSUPDRVDARWINMSRARGS)pvUser1;
+    if (g_pfnRdMsr64Carefully)
+        pArgs->rc = g_pfnRdMsr64Carefully(pArgs->uMsr, &pArgs->uValue.u);
+    else if (g_pfnRdMsrCarefully)
+        pArgs->rc = g_pfnRdMsrCarefully(pArgs->uMsr, &pArgs->uValue.s.Lo, &pArgs->uValue.s.Hi);
+    else
+        pArgs->rc = 2;
+    NOREF(idCpu); NOREF(pvUser2);
+}
+
+
+int VBOXCALL    supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue)
+{
+    if (!g_pfnRdMsr64Carefully && !g_pfnRdMsrCarefully)
+        return VERR_NOT_SUPPORTED;
+
+    SUPDRVDARWINMSRARGS Args;
+    Args.uMsr     = uMsr;
+    Args.uValue.u = 0;
+    Args.rc       = -1;
+
+    if (idCpu == NIL_RTCPUID)
+        supdrvDarwinMsrProberReadOnCpu(idCpu, &Args, NULL);
+    else
+    {
+        int rc = RTMpOnSpecific(idCpu, supdrvDarwinMsrProberReadOnCpu, &Args, NULL);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    if (Args.rc)
+        return VERR_ACCESS_DENIED;
+    *puValue = Args.uValue.u;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * On CPU worker for supdrvOSMsrProberWrite.
+ *
+ * @param   idCpu           Ignored.
+ * @param   pvUser1         Pointer to a SUPDRVDARWINMSRARGS.
+ * @param   pvUser2         Ignored.
+ */
+static DECLCALLBACK(void) supdrvDarwinMsrProberWriteOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PSUPDRVDARWINMSRARGS pArgs = (PSUPDRVDARWINMSRARGS)pvUser1;
+    if (g_pfnWrMsr64Carefully)
+        pArgs->rc = g_pfnWrMsr64Carefully(pArgs->uMsr, pArgs->uValue.u);
+    else
+        pArgs->rc = 2;
+    NOREF(idCpu); NOREF(pvUser2);
+}
+
+
+int VBOXCALL    supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue)
+{
+    if (!g_pfnWrMsr64Carefully)
+        return VERR_NOT_SUPPORTED;
+
+    SUPDRVDARWINMSRARGS Args;
+    Args.uMsr     = uMsr;
+    Args.uValue.u = uValue;
+    Args.rc       = -1;
+
+    if (idCpu == NIL_RTCPUID)
+        supdrvDarwinMsrProberWriteOnCpu(idCpu, &Args, NULL);
+    else
+    {
+        int rc = RTMpOnSpecific(idCpu, supdrvDarwinMsrProberWriteOnCpu, &Args, NULL);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    if (Args.rc)
+        return VERR_ACCESS_DENIED;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Worker for supdrvOSMsrProberModify.
+ */
+static DECLCALLBACK(void) supdrvDarwinMsrProberModifyOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PSUPMSRPROBER               pReq    = (PSUPMSRPROBER)pvUser1;
+    register uint32_t           uMsr    = pReq->u.In.uMsr;
+    bool const                  fFaster = pReq->u.In.enmOp == SUPMSRPROBEROP_MODIFY_FASTER;
+    uint64_t                    uBefore;
+    uint64_t                    uWritten;
+    uint64_t                    uAfter;
+    int                         rcBefore, rcWrite, rcAfter, rcRestore;
+    RTCCUINTREG                 fOldFlags;
+
+    /* Initialize result variables. */
+    uBefore = uWritten = uAfter    = 0;
+    rcWrite = rcAfter  = rcRestore = -1;
+
+    /*
+     * Do the job.
+     */
+    fOldFlags = ASMIntDisableFlags();
+    ASMCompilerBarrier(); /* paranoia */
+    if (!fFaster)
+        ASMWriteBackAndInvalidateCaches();
+
+    rcBefore = g_pfnRdMsr64Carefully(uMsr, &uBefore);
+    if (rcBefore >= 0)
+    {
+        register uint64_t uRestore = uBefore;
+        uWritten  = uRestore;
+        uWritten &= pReq->u.In.uArgs.Modify.fAndMask;
+        uWritten |= pReq->u.In.uArgs.Modify.fOrMask;
+
+        rcWrite   = g_pfnWrMsr64Carefully(uMsr, uWritten);
+        rcAfter   = g_pfnRdMsr64Carefully(uMsr, &uAfter);
+        rcRestore = g_pfnWrMsr64Carefully(uMsr, uRestore);
+
+        if (!fFaster)
+        {
+            ASMWriteBackAndInvalidateCaches();
+            ASMReloadCR3();
+            ASMNopPause();
+        }
+    }
+
+    ASMCompilerBarrier(); /* paranoia */
+    ASMSetFlags(fOldFlags);
+
+    /*
+     * Write out the results.
+     */
+    pReq->u.Out.uResults.Modify.uBefore    = uBefore;
+    pReq->u.Out.uResults.Modify.uWritten   = uWritten;
+    pReq->u.Out.uResults.Modify.uAfter     = uAfter;
+    pReq->u.Out.uResults.Modify.fBeforeGp  = rcBefore  != 0;
+    pReq->u.Out.uResults.Modify.fModifyGp  = rcWrite   != 0;
+    pReq->u.Out.uResults.Modify.fAfterGp   = rcAfter   != 0;
+    pReq->u.Out.uResults.Modify.fRestoreGp = rcRestore != 0;
+    RT_ZERO(pReq->u.Out.uResults.Modify.afReserved);
+}
+
+
+int VBOXCALL    supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq)
+{
+    if (!g_pfnWrMsr64Carefully || !g_pfnRdMsr64Carefully)
+        return VERR_NOT_SUPPORTED;
+    if (idCpu == NIL_RTCPUID)
+    {
+        supdrvDarwinMsrProberModifyOnCpu(idCpu, pReq, NULL);
+        return VINF_SUCCESS;
+    }
+    return RTMpOnSpecific(idCpu, supdrvDarwinMsrProberModifyOnCpu, pReq, NULL);
+}
+
+#endif /* SUPDRV_WITH_MSR_PROBER */
+
 /**
  * Resume Bluetooth keyboard.
  * If there is no Bluetooth keyboard device connected to the system we just ignore this.
@@ -1248,6 +1468,17 @@ bool org_virtualbox_SupDrvClient::initWithTask(task_t OwningTask, void *pvSecuri
 
     if (!OwningTask)
         return false;
+
+    VBOX_RETRIEVE_CUR_PROC_NAME(pszProcName);
+
+    if (u32Type != SUP_DARWIN_IOSERVICE_COOKIE)
+    {
+        LogRel(("org_virtualbox_SupDrvClient::initWithTask: Bad cookie %#x (%s)\n", u32Type, pszProcName));
+        return false;
+    }
+    else
+        LogRel(("org_virtualbox_SupDrvClient::initWithTask: Expected cookie %#x (%s)\n", u32Type, pszProcName));
+
     if (IOUserClient::initWithTask(OwningTask, pvSecurityId , u32Type))
     {
         m_Task = OwningTask;
@@ -1307,7 +1538,7 @@ bool org_virtualbox_SupDrvClient::start(IOService *pProvider)
                 else
                     rc = VERR_ALREADY_LOADED;
 
-                RTSpinlockReleaseNoInts(g_Spinlock);
+                RTSpinlockRelease(g_Spinlock);
                 if (RT_SUCCESS(rc))
                 {
                     Log(("org_virtualbox_SupDrvClient::start: created session %p for pid %d\n", m_pSession, (int)RTProcSelf()));
@@ -1370,7 +1601,7 @@ bool org_virtualbox_SupDrvClient::start(IOService *pProvider)
             }
         }
     }
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
     if (!pSession)
     {
         Log(("SupDrvClient::sessionClose: pSession == NULL, pid=%d; freed already?\n", (int)Process));
diff --git a/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp b/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
index cd73baf..c14a6a5 100644
--- a/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
+++ b/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
@@ -170,7 +170,7 @@ static int suplibDarwinOpenService(PSUPLIBDATA pThis)
      * instantiated and create a session for this process.
      */
     io_connect_t Connection = NULL;
-    kr = IOServiceOpen(ServiceObject, mach_task_self(), 0, &Connection);
+    kr = IOServiceOpen(ServiceObject, mach_task_self(), SUP_DARWIN_IOSERVICE_COOKIE, &Connection);
     IOObjectRelease(ServiceObject);
     if (kr != kIOReturnSuccess)
     {
diff --git a/src/VBox/HostDrivers/Support/freebsd/Makefile b/src/VBox/HostDrivers/Support/freebsd/Makefile
index 17bf3d8..278b3a4 100644
--- a/src/VBox/HostDrivers/Support/freebsd/Makefile
+++ b/src/VBox/HostDrivers/Support/freebsd/Makefile
@@ -4,8 +4,7 @@
 #
 
 #
-#
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -37,8 +36,10 @@ CFLAGS += -DRT_OS_FREEBSD -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DSUPDRV_WITH_RELEAS
 
 SRCS = \
 	SUPDrv.c \
+	SUPDrvGip.c \
 	SUPDrvSem.c \
 	SUPDrvTracer.c \
+	SUPLibAll.c \
 
 # Include needed interface headers so they are created during build
 SRCS += \
@@ -81,6 +82,7 @@ SRCS += \
 	handletable.c \
 	handletablectx.c \
 	once.c \
+	term.c \
 	thread.c
 
 .PATH:	${.CURDIR}/common/string
@@ -88,6 +90,7 @@ SRCS += \
 	RTStrNCmp.c \
 	RTStrNLen.c \
 	RTStrCopy.c \
+	RTStrCopyEx.c \
 	RTStrCopyP.c \
 	strformat.c \
 	strformatrt.c \
@@ -130,6 +133,7 @@ SRCS += \
 	RTLogWriteStdErr-stub-generic.c \
 	RTLogWriteUser-generic.c \
 	RTMpGetArraySize-generic.c \
+	RTMpOnPair-generic.c \
 	RTRandAdvCreateSystemFaster-generic.c \
 	RTRandAdvCreateSystemTruer-generic.c \
 	RTSemEventWait-2-ex-generic.c \
@@ -170,6 +174,7 @@ SRCS += \
 SRCS += \
 	semspinmutex-r0drv-generic.c \
 	mpnotification-r0drv-generic.c \
+	threadctxhooks-r0drv-generic.c \
 	RTMpIsCpuWorkPending-r0drv-generic.c
 
 .PATH:	${.CURDIR}/VBox
diff --git a/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c b/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
index ce99717..9cc500b 100644
--- a/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
+++ b/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c
@@ -539,6 +539,19 @@ bool VBOXCALL  supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
 }
 
 
+bool VBOXCALL  supdrvOSAreCpusOfflinedOnSuspend(void)
+{
+    /** @todo verify this. */
+    return false;
+}
+
+
+bool VBOXCALL  supdrvOSAreTscDeltasInSync(void)
+{
+    return false;
+}
+
+
 int  VBOXCALL   supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename)
 {
     NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename);
@@ -572,6 +585,31 @@ void VBOXCALL   supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
 }
 
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+
+int VBOXCALL    supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue)
+{
+    NOREF(uMsr); NOREF(idCpu); NOREF(puValue);
+    return VERR_NOT_SUPPORTED;
+}
+
+
+int VBOXCALL    supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue)
+{
+    NOREF(uMsr); NOREF(idCpu); NOREF(uValue);
+    return VERR_NOT_SUPPORTED;
+}
+
+
+int VBOXCALL    supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq)
+{
+    NOREF(idCpu); NOREF(pReq);
+    return VERR_NOT_SUPPORTED;
+}
+
+#endif /* SUPDRV_WITH_MSR_PROBER */
+
+
 SUPR0DECL(int) SUPR0Printf(const char *pszFormat, ...)
 {
     va_list va;
diff --git a/src/VBox/HostDrivers/Support/freebsd/files_vboxdrv b/src/VBox/HostDrivers/Support/freebsd/files_vboxdrv
index b02e35c..932e1a8 100755
--- a/src/VBox/HostDrivers/Support/freebsd/files_vboxdrv
+++ b/src/VBox/HostDrivers/Support/freebsd/files_vboxdrv
@@ -5,7 +5,7 @@
 #
 
 #
-# Copyright (C) 2007-2010 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -61,6 +61,7 @@ FILES_VBOXDRV_NOBIN=" \
     ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
     ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \
     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
+    ${PATH_ROOT}/include/iprt/uint128.h=>include/iprt/uint128.h \
     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
     ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \
     ${PATH_ROOT}/include/iprt/crc.h=>include/iprt/crc.h \
@@ -84,12 +85,14 @@ FILES_VBOXDRV_NOBIN=" \
     ${PATH_ROOT}/include/VBox/vmm/hm_vmx.h=>include/VBox/vmm/hm_vmx.h \
     ${PATH_ROOT}/include/VBox/vmm/hm_svm.h=>include/VBox/vmm/hm_svm.h \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/freebsd/SUPDrv-freebsd.c=>freebsd/SUPDrv-freebsd.c \
-    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrv.c=>SUPDrv.c \
-    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvSem.c=>SUPDrvSem.c \
+    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrv.cpp=>SUPDrv.c \
+    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvGip.cpp=>SUPDrvGip.c \
+    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvSem.cpp=>SUPDrvSem.c \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp=>SUPDrvTracer.c \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvIDC.h=>SUPDrvIDC.h \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvIOC.h=>SUPDrvIOC.h \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvInternal.h=>SUPDrvInternal.h \
+    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPLibAll.cpp=>SUPLibAll.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/alloc/heapsimple.cpp=>alloc/heapsimple.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/alloc/alloc.cpp=>alloc/alloc.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/err/RTErrConvertFromErrno.cpp=>common/err/RTErrConvertFromErrno.c \
@@ -112,9 +115,11 @@ FILES_VBOXDRV_NOBIN=" \
     ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletable.h=>common/misc/handletable.h \
     ${PATH_ROOT}/src/VBox/Runtime/common/misc/handletablectx.cpp=>common/misc/handletablectx.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/misc/once.cpp=>common/misc/once.c \
+    ${PATH_ROOT}/src/VBox/Runtime/common/misc/term.cpp=>common/misc/term.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/misc/thread.cpp=>common/misc/thread.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrCopyP.cpp=>common/string/RTStrCopyP.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrCopy.cpp=>common/string/RTStrCopy.c \
+    ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrCopyEx.cpp=>common/string/RTStrCopyEx.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrNCmp.cpp=>common/string/RTStrNCmp.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/string/RTStrNLen.cpp=>common/string/RTStrNLen.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/string/strformat.cpp=>common/string/strformat.c \
@@ -164,6 +169,7 @@ FILES_VBOXDRV_NOBIN=" \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp=>generic/RTSemEventMultiWaitNoResume-2-ex-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp=>generic/RTTimerCreate-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/RTMpGetArraySize-generic.cpp=>generic/RTMpGetArraySize-generic.c \
+    ${PATH_ROOT}/src/VBox/Runtime/generic/RTMpOnPair-generic.cpp=>generic/RTMpOnPair-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/errvars-generic.cpp=>generic/errvars-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/mppresent-generic.cpp=>generic/mppresent-generic.c \
     ${PATH_ROOT}/src/VBox/Runtime/generic/timer-generic.cpp=>generic/timer-generic.c \
diff --git a/src/VBox/HostDrivers/Support/linux/Makefile b/src/VBox/HostDrivers/Support/linux/Makefile
index af9f644..77f6ca1 100644
--- a/src/VBox/HostDrivers/Support/linux/Makefile
+++ b/src/VBox/HostDrivers/Support/linux/Makefile
@@ -72,8 +72,10 @@ override MODULE = vboxdrv
 OBJS   = \
 	linux/SUPDrv-linux.o \
 	SUPDrv.o \
+	SUPDrvGip.o \
 	SUPDrvSem.o \
 	SUPDrvTracer.o \
+	SUPLibAll.o \
 	r0drv/alloc-r0drv.o \
 	r0drv/initterm-r0drv.o \
 	r0drv/memobj-r0drv.o \
@@ -155,7 +157,7 @@ OBJS += math/gcc/divdi3.o \
 	math/gcc/moddi3.o \
 	math/gcc/qdivrem.o \
 	math/gcc/udivdi3.o \
-        math/gcc/divdi3.o \
+	math/gcc/divdi3.o \
 	math/gcc/umoddi3.o
 endif
 ifeq ($(BUILD_TARGET_ARCH),amd64)
@@ -241,6 +243,9 @@ ifndef INCL
  endif
  INCL    += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
  INCL    += $(addprefix -I$(KBUILD_EXTMOD)/vboxdrv,/ /include /r0drv/linux)
+ ifdef VBOX_WITH_NATIVE_DTRACE
+  INCL   += -I/usr/include/linux -I/usr/include
+ endif
  export INCL
 endif
 ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxdrv),)
@@ -250,6 +255,7 @@ else
 endif
 KFLAGS   := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \
 	    -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING \
+           -DSUPDRV_WITH_RELEASE_LOGGER \
 	    -Wno-declaration-after-statement
 ifdef VBOX_REDHAT_KABI
  KFLAGS  += -DVBOX_REDHAT_KABI
@@ -272,6 +278,9 @@ ifeq ($(BUILD_TYPE),debug)
  # IPRT_DEBUG_SEMS indicates thread wrt sems state via the comm field.
  #KFLAGS  += -DIPRT_DEBUG_SEMS
 endif
+ifdef VBOX_WITH_TEXT_MODMEM_HACK
+ KFLAGS += -DRTMEMALLOC_EXEC_HEAP -DVBOX_WITH_TEXT_MODMEM_HACK
+endif
 
 # 2.6 and later
 MODULE_EXT    := ko
diff --git a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
index 820adfe..c811058 100644
--- a/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
+++ b/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
@@ -1,4 +1,4 @@
-/* $Rev: 99005 $ */
+/* $Rev: 99782 $ */
 /** @file
  * VBoxDrv - The VirtualBox Support Driver - Linux specifics.
  */
@@ -59,9 +59,14 @@
 #ifdef VBOX_WITH_SUSPEND_NOTIFICATION
 # include <linux/platform_device.h>
 #endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) && defined(SUPDRV_WITH_MSR_PROBER)
+# define SUPDRV_LINUX_HAS_SAFE_MSR_API
+# include <asm/msr.h>
+#endif
 #include <iprt/asm-amd64-x86.h>
 
 
+
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
@@ -147,19 +152,35 @@ static int force_async_tsc = 0;
 /** The user device name. */
 #define DEVICE_NAME_USR     "vboxdrvu"
 
-#if defined(RT_ARCH_AMD64) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
+#if (defined(RT_ARCH_AMD64) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)) || defined(VBOX_WITH_TEXT_MODMEM_HACK)
 /**
  * Memory for the executable memory heap (in IPRT).
  */
-extern uint8_t g_abExecMemory[1572864]; /* 1.5 MB */
+# ifdef DEBUG
+#  define EXEC_MEMORY_SIZE   6291456    /* 6 MB */
+# else
+#  define EXEC_MEMORY_SIZE   1572864    /* 1.5 MB */
+# endif
+extern uint8_t g_abExecMemory[EXEC_MEMORY_SIZE];
+# ifndef VBOX_WITH_TEXT_MODMEM_HACK
 __asm__(".section execmemory, \"awx\", @progbits\n\t"
         ".align 32\n\t"
         ".globl g_abExecMemory\n"
         "g_abExecMemory:\n\t"
-        ".zero 1572864\n\t"
+        ".zero " RT_XSTR(EXEC_MEMORY_SIZE) "\n\t"
+        ".type g_abExecMemory, @object\n\t"
+        ".size g_abExecMemory, " RT_XSTR(EXEC_MEMORY_SIZE) "\n\t"
+        ".text\n\t");
+# else
+__asm__(".text\n\t"
+        ".align 4096\n\t"
+        ".globl g_abExecMemory\n"
+        "g_abExecMemory:\n\t"
+        ".zero " RT_XSTR(EXEC_MEMORY_SIZE) "\n\t"
         ".type g_abExecMemory, @object\n\t"
-        ".size g_abExecMemory, 1572864\n\t"
+        ".size g_abExecMemory, " RT_XSTR(EXEC_MEMORY_SIZE) "\n\t"
         ".text\n\t");
+# endif
 #endif
 
 /** The file_operations structure. */
@@ -302,7 +323,7 @@ static int __init VBoxDrvLinuxInit(void)
     /*
      * Check for synchronous/asynchronous TSC mode.
      */
-    printk(KERN_DEBUG "vboxdrv: Found %u processor cores.\n", (unsigned)RTMpGetOnlineCount());
+    printk(KERN_DEBUG "vboxdrv: Found %u processor cores\n", (unsigned)RTMpGetOnlineCount());
 #ifdef CONFIG_VBOXDRV_AS_MISC
     rc = misc_register(&gMiscDeviceSys);
     if (rc)
@@ -371,7 +392,11 @@ static int __init VBoxDrvLinuxInit(void)
         rc = RTR0Init(0);
         if (RT_SUCCESS(rc))
         {
-#if defined(RT_ARCH_AMD64) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
+#if (defined(RT_ARCH_AMD64) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)) || defined(VBOX_WITH_TEXT_MODMEM_HACK)
+# ifdef VBOX_WITH_TEXT_MODMEM_HACK
+            set_memory_x(&g_abExecMemory[0], sizeof(g_abExecMemory) / PAGE_SIZE);
+            set_memory_rw(&g_abExecMemory[0], sizeof(g_abExecMemory) / PAGE_SIZE);
+# endif
             rc = RTR0MemExecDonate(&g_abExecMemory[0], sizeof(g_abExecMemory));
             printk(KERN_DEBUG "VBoxDrv: dbg - g_abExecMemory=%p\n", (void *)&g_abExecMemory[0]);
 #endif
@@ -392,11 +417,11 @@ static int __init VBoxDrvLinuxInit(void)
                     if (rc == 0)
 #endif
                     {
-                        printk(KERN_INFO "vboxdrv: TSC mode is %s, kernel timer mode is 'normal'.\n",
-                               g_DevExt.pGip->u32Mode == SUPGIPMODE_SYNC_TSC ? "'synchronous'" : "'asynchronous'");
+                        printk(KERN_INFO "vboxdrv: TSC mode is %s, tentative frequency %llu Hz\n",
+                               SUPGetGIPModeName(g_DevExt.pGip), g_DevExt.pGip->u64CpuHz);
                         LogFlow(("VBoxDrv::ModuleInit returning %#x\n", rc));
                         printk(KERN_DEBUG "vboxdrv: Successfully loaded version "
-                                VBOX_VERSION_STRING " (interface " RT_XSTR(SUPDRV_IOC_VERSION) ").\n");
+                                VBOX_VERSION_STRING " (interface " RT_XSTR(SUPDRV_IOC_VERSION) ")\n");
                         return rc;
                     }
 #ifdef VBOX_WITH_SUSPEND_NOTIFICATION
@@ -679,7 +704,7 @@ static int VBoxDrvLinuxIOCtlSlow(struct file *pFilp, unsigned int uCmd, unsigned
      */
     if (RT_UNLIKELY(copy_from_user(&Hdr, (void *)ulArg, sizeof(Hdr))))
     {
-        Log(("VBoxDrvLinuxIOCtl: copy_from_user(,%#lx,) failed; uCmd=%#x.\n", ulArg, uCmd));
+        Log(("VBoxDrvLinuxIOCtl: copy_from_user(,%#lx,) failed; uCmd=%#x\n", ulArg, uCmd));
         return -EFAULT;
     }
     if (RT_UNLIKELY((Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC))
@@ -699,18 +724,18 @@ static int VBoxDrvLinuxIOCtlSlow(struct file *pFilp, unsigned int uCmd, unsigned
     }
     if (RT_UNLIKELY(_IOC_SIZE(uCmd) ? cbBuf != _IOC_SIZE(uCmd) : Hdr.cbIn < sizeof(Hdr)))
     {
-        Log(("VBoxDrvLinuxIOCtl: bad ioctl cbBuf=%#x _IOC_SIZE=%#x; uCmd=%#x.\n", cbBuf, _IOC_SIZE(uCmd), uCmd));
+        Log(("VBoxDrvLinuxIOCtl: bad ioctl cbBuf=%#x _IOC_SIZE=%#x; uCmd=%#x\n", cbBuf, _IOC_SIZE(uCmd), uCmd));
         return -EINVAL;
     }
     pHdr = RTMemAlloc(cbBuf);
     if (RT_UNLIKELY(!pHdr))
     {
-        OSDBGPRINT(("VBoxDrvLinuxIOCtl: failed to allocate buffer of %d bytes for uCmd=%#x.\n", cbBuf, uCmd));
+        OSDBGPRINT(("VBoxDrvLinuxIOCtl: failed to allocate buffer of %d bytes for uCmd=%#x\n", cbBuf, uCmd));
         return -ENOMEM;
     }
     if (RT_UNLIKELY(copy_from_user(pHdr, (void *)ulArg, Hdr.cbIn)))
     {
-        Log(("VBoxDrvLinuxIOCtl: copy_from_user(,%#lx, %#x) failed; uCmd=%#x.\n", ulArg, Hdr.cbIn, uCmd));
+        Log(("VBoxDrvLinuxIOCtl: copy_from_user(,%#lx, %#x) failed; uCmd=%#x\n", ulArg, Hdr.cbIn, uCmd));
         RTMemFree(pHdr);
         return -EFAULT;
     }
@@ -867,6 +892,18 @@ bool VBOXCALL supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
 }
 
 
+bool VBOXCALL supdrvOSAreCpusOfflinedOnSuspend(void)
+{
+    return true;
+}
+
+
+bool VBOXCALL supdrvOSAreTscDeltasInSync(void)
+{
+    return false;
+}
+
+
 int  VBOXCALL   supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename)
 {
     NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename);
@@ -900,6 +937,133 @@ void VBOXCALL   supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
 }
 
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+
+int VBOXCALL    supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue)
+{
+# ifdef SUPDRV_LINUX_HAS_SAFE_MSR_API
+    uint32_t u32Low, u32High;
+    int rc;
+
+    if (idCpu == NIL_RTCPUID)
+        rc = rdmsr_safe(uMsr, &u32Low, &u32High);
+    else if (RTMpIsCpuOnline(idCpu))
+        rc = rdmsr_safe_on_cpu(idCpu, uMsr, &u32Low, &u32High);
+    else
+        return VERR_CPU_OFFLINE;
+    if (rc == 0)
+    {
+        *puValue = RT_MAKE_U64(u32Low, u32High);
+        return VINF_SUCCESS;
+    }
+    return VERR_ACCESS_DENIED;
+# else
+    return VERR_NOT_SUPPORTED;
+# endif
+}
+
+
+int VBOXCALL    supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue)
+{
+# ifdef SUPDRV_LINUX_HAS_SAFE_MSR_API
+    int rc;
+
+    if (idCpu == NIL_RTCPUID)
+        rc = wrmsr_safe(uMsr, RT_LODWORD(uValue), RT_HIDWORD(uValue));
+    else if (RTMpIsCpuOnline(idCpu))
+        rc = wrmsr_safe_on_cpu(idCpu, uMsr, RT_LODWORD(uValue), RT_HIDWORD(uValue));
+    else
+        return VERR_CPU_OFFLINE;
+    if (rc == 0)
+        return VINF_SUCCESS;
+    return VERR_ACCESS_DENIED;
+# else
+    return VERR_NOT_SUPPORTED;
+# endif
+}
+
+# ifdef SUPDRV_LINUX_HAS_SAFE_MSR_API
+/**
+ * Worker for supdrvOSMsrProberModify.
+ */
+static DECLCALLBACK(void) supdrvLnxMsrProberModifyOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PSUPMSRPROBER               pReq    = (PSUPMSRPROBER)pvUser1;
+    register uint32_t           uMsr    = pReq->u.In.uMsr;
+    bool const                  fFaster = pReq->u.In.enmOp == SUPMSRPROBEROP_MODIFY_FASTER;
+    uint64_t                    uBefore;
+    uint64_t                    uWritten;
+    uint64_t                    uAfter;
+    int                         rcBefore, rcWrite, rcAfter, rcRestore;
+    RTCCUINTREG                 fOldFlags;
+
+    /* Initialize result variables. */
+    uBefore = uWritten = uAfter    = 0;
+    rcWrite = rcAfter  = rcRestore = -EIO;
+
+    /*
+     * Do the job.
+     */
+    fOldFlags = ASMIntDisableFlags();
+    ASMCompilerBarrier(); /* paranoia */
+    if (!fFaster)
+        ASMWriteBackAndInvalidateCaches();
+
+    rcBefore = rdmsrl_safe(uMsr, &uBefore);
+    if (rcBefore >= 0)
+    {
+        register uint64_t uRestore = uBefore;
+        uWritten  = uRestore;
+        uWritten &= pReq->u.In.uArgs.Modify.fAndMask;
+        uWritten |= pReq->u.In.uArgs.Modify.fOrMask;
+
+        rcWrite   = wrmsr_safe(uMsr, RT_LODWORD(uWritten), RT_HIDWORD(uWritten));
+        rcAfter   = rdmsrl_safe(uMsr, &uAfter);
+        rcRestore = wrmsr_safe(uMsr, RT_LODWORD(uRestore), RT_HIDWORD(uRestore));
+
+        if (!fFaster)
+        {
+            ASMWriteBackAndInvalidateCaches();
+            ASMReloadCR3();
+            ASMNopPause();
+        }
+    }
+
+    ASMCompilerBarrier(); /* paranoia */
+    ASMSetFlags(fOldFlags);
+
+    /*
+     * Write out the results.
+     */
+    pReq->u.Out.uResults.Modify.uBefore    = uBefore;
+    pReq->u.Out.uResults.Modify.uWritten   = uWritten;
+    pReq->u.Out.uResults.Modify.uAfter     = uAfter;
+    pReq->u.Out.uResults.Modify.fBeforeGp  = rcBefore  != 0;
+    pReq->u.Out.uResults.Modify.fModifyGp  = rcWrite   != 0;
+    pReq->u.Out.uResults.Modify.fAfterGp   = rcAfter   != 0;
+    pReq->u.Out.uResults.Modify.fRestoreGp = rcRestore != 0;
+    RT_ZERO(pReq->u.Out.uResults.Modify.afReserved);
+}
+# endif
+
+
+int VBOXCALL    supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq)
+{
+# ifdef SUPDRV_LINUX_HAS_SAFE_MSR_API
+    if (idCpu == NIL_RTCPUID)
+    {
+        supdrvLnxMsrProberModifyOnCpu(idCpu, pReq, NULL);
+        return VINF_SUCCESS;
+    }
+    return RTMpOnSpecific(idCpu, supdrvLnxMsrProberModifyOnCpu, pReq, NULL);
+# else
+    return VERR_NOT_SUPPORTED;
+# endif
+}
+
+#endif /* SUPDRV_WITH_MSR_PROBER */
+
+
 /**
  * Converts a supdrv error code to an linux error code.
  *
diff --git a/src/VBox/HostDrivers/Support/linux/files_vboxdrv b/src/VBox/HostDrivers/Support/linux/files_vboxdrv
index 064714d..4b4e8b0 100755
--- a/src/VBox/HostDrivers/Support/linux/files_vboxdrv
+++ b/src/VBox/HostDrivers/Support/linux/files_vboxdrv
@@ -5,7 +5,7 @@
 #
 
 #
-# Copyright (C) 2007-2012 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -63,6 +63,7 @@ FILES_VBOXDRV_NOBIN=" \
     ${PATH_ROOT}/include/iprt/time.h=>include/iprt/time.h \
     ${PATH_ROOT}/include/iprt/timer.h=>include/iprt/timer.h \
     ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \
+    ${PATH_ROOT}/include/iprt/uint128.h=>include/iprt/uint128.h \
     ${PATH_ROOT}/include/iprt/uni.h=>include/iprt/uni.h \
     ${PATH_ROOT}/include/iprt/uuid.h=>include/iprt/uuid.h \
     ${PATH_ROOT}/include/iprt/x86.h=>include/iprt/x86.h \
@@ -78,13 +79,15 @@ FILES_VBOXDRV_NOBIN=" \
     ${PATH_ROOT}/include/VBox/vmm/hm_vmx.h=>include/VBox/vmm/hm_vmx.h \
     ${PATH_ROOT}/include/VBox/vmm/hm_svm.h=>include/VBox/vmm/hm_svm.h \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c=>linux/SUPDrv-linux.c \
-    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrv.c=>SUPDrv.c \
-    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvSem.c=>SUPDrvSem.c \
+    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrv.cpp=>SUPDrv.c \
+    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvGip.cpp=>SUPDrvGip.c \
+    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvSem.cpp=>SUPDrvSem.c \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp=>SUPDrvTracer.c \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp=>SUPDrvDTrace.c \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvIDC.h=>SUPDrvIDC.h \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvIOC.h=>SUPDrvIOC.h \
     ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPDrvInternal.h=>SUPDrvInternal.h \
+    ${PATH_ROOT}/src/VBox/HostDrivers/Support/SUPLibAll.cpp=>SUPLibAll.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/alloc/alloc.cpp=>common/alloc/alloc.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/alloc/heapsimple.cpp=>common/alloc/heapsimple.c \
     ${PATH_ROOT}/src/VBox/Runtime/common/checksum/crc32.cpp=>common/checksum/crc32.c \
@@ -190,6 +193,7 @@ FILES_VBOXDRV_NOBIN=" \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c=>r0drv/linux/timer-r0drv-linux.c \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/waitqueue-r0drv-linux.h=>r0drv/linux/waitqueue-r0drv-linux.h \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/semspinmutex-r0drv-generic.c=>r0drv/generic/semspinmutex-r0drv-generic.c \
+    ${PATH_ROOT}/src/VBox/Runtime/r0drv/generic/threadctxhooks-r0drv-generic.cpp=>r0drv/generic/threadctxhooks-r0drv-generic.cpp \
     ${PATH_ROOT}/src/VBox/Runtime/r0drv/memobj-r0drv.cpp=>r0drv/memobj-r0drv.c \
     ${PATH_ROOT}/src/VBox/Runtime/VBox/log-vbox.cpp=>VBox/log-vbox.c \
     ${PATH_OUT}/version-generated.h=>version-generated.h \
diff --git a/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp b/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
index 69be647..71e3c0d 100644
--- a/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
+++ b/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp
@@ -162,7 +162,7 @@ DECLASM(int) VBoxDrvOpen(uint16_t sfn)
         RTSpinlockAcquire(g_Spinlock);
         pSession->pNextHash = g_apSessionHashTab[iHash];
         g_apSessionHashTab[iHash] = pSession;
-        RTSpinlockReleaseNoInts(g_Spinlock);
+        RTSpinlockRelease(g_Spinlock);
     }
 
     Log(("VBoxDrvOpen: g_DevExt=%p pSession=%p rc=%d pid=%d\n", &g_DevExt, pSession, rc, (int)RTProcSelf()));
@@ -211,7 +211,7 @@ DECLASM(int) VBoxDrvClose(uint16_t sfn)
             }
         }
     }
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
     if (!pSession)
     {
         OSDBGPRINT(("VBoxDrvIoctl: WHUT?!? pSession == NULL! This must be a mistake... pid=%d sfn=%d\n", (int)Process, sfn));
@@ -247,7 +247,7 @@ DECLASM(int) VBoxDrvIOCtlFast(uint16_t sfn, uint8_t iFunction)
         if (RT_LIKELY(pSession))
             supdrvSessionRetain(pSession);
     }
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
     if (RT_UNLIKELY(!pSession))
     {
         OSDBGPRINT(("VBoxDrvIoctl: WHUT?!? pSession == NULL! This must be a mistake... pid=%d\n", (int)Process));
@@ -284,7 +284,7 @@ DECLASM(int) VBoxDrvIOCtl(uint16_t sfn, uint8_t iCat, uint8_t iFunction, void *p
         if (RT_LIKELY(pSession))
             supdrvSessionRetain(pSession);
     }
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
     if (!pSession)
     {
         OSDBGPRINT(("VBoxDrvIoctl: WHUT?!? pSession == NULL! This must be a mistake... pid=%d\n", (int)Process));
@@ -406,6 +406,19 @@ bool VBOXCALL  supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
 }
 
 
+bool VBOXCALL  supdrvOSAreCpusOfflinedOnSuspend(void)
+{
+    return false;
+}
+
+
+bool VBOXCALL  supdrvOSAreTscDeltasInSync(void)
+{
+    NOREF(pDevExt);
+    return false;
+}
+
+
 int  VBOXCALL   supdrvOSLdrOpen(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage, const char *pszFilename)
 {
     NOREF(pDevExt); NOREF(pImage); NOREF(pszFilename);
@@ -439,6 +452,31 @@ void VBOXCALL   supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
 }
 
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+
+int VBOXCALL    supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue)
+{
+    NOREF(uMsr); NOREF(idCpu); NOREF(puValue);
+    return VERR_NOT_SUPPORTED;
+}
+
+
+int VBOXCALL    supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue)
+{
+    NOREF(uMsr); NOREF(idCpu); NOREF(uValue);
+    return VERR_NOT_SUPPORTED;
+}
+
+
+int VBOXCALL    supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq)
+{
+    NOREF(idCpu); NOREF(pReq);
+    return VERR_NOT_SUPPORTED;
+}
+
+#endif /* SUPDRV_WITH_MSR_PROBER */
+
+
 /**
  * Callback for writing to the log buffer.
  *
diff --git a/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c b/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
index c70df61..912a6d5 100644
--- a/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
+++ b/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -92,6 +92,7 @@ static int VBoxDrvSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArgs, int mode, cre
 
 static int VBoxDrvSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t Cmd);
 static int VBoxDrvSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t Cmd);
+static int VBoxDrvSolarisQuiesceNotNeeded(dev_info_t *pDip);
 
 static int VBoxSupDrvErr2SolarisErr(int rc);
 static int VBoxDrvSolarisIOCtlSlow(PSUPDRVSESSION pSession, int Cmd, int Mode, intptr_t pArgs);
@@ -107,20 +108,20 @@ static struct cb_ops g_VBoxDrvSolarisCbOps =
 {
     VBoxDrvSolarisOpen,
     VBoxDrvSolarisClose,
-    nodev,                  /* b strategy */
-    nodev,                  /* b dump */
-    nodev,                  /* b print */
+    nodev,                        /* b strategy */
+    nodev,                        /* b dump */
+    nodev,                        /* b print */
     VBoxDrvSolarisRead,
     VBoxDrvSolarisWrite,
     VBoxDrvSolarisIOCtl,
-    nodev,                  /* c devmap */
-    nodev,                  /* c mmap */
-    nodev,                  /* c segmap */
-    nochpoll,               /* c poll */
-    ddi_prop_op,            /* property ops */
-    NULL,                   /* streamtab  */
-    D_NEW | D_MP,          /* compat. flag */
-    CB_REV                  /* revision */
+    nodev,                        /* c devmap */
+    nodev,                        /* c mmap */
+    nodev,                        /* c segmap */
+    nochpoll,                     /* c poll */
+    ddi_prop_op,                  /* property ops */
+    NULL,                         /* streamtab  */
+    D_NEW | D_MP,                 /* compat. flag */
+    CB_REV                        /* revision */
 };
 
 /**
@@ -128,17 +129,18 @@ static struct cb_ops g_VBoxDrvSolarisCbOps =
  */
 static struct dev_ops g_VBoxDrvSolarisDevOps =
 {
-    DEVO_REV,               /* driver build revision */
-    0,                      /* ref count */
-    nulldev,                /* get info */
-    nulldev,                /* identify */
-    nulldev,                /* probe */
+    DEVO_REV,                     /* driver build revision */
+    0,                            /* ref count */
+    nulldev,                      /* get info */
+    nulldev,                      /* identify */
+    nulldev,                      /* probe */
     VBoxDrvSolarisAttach,
     VBoxDrvSolarisDetach,
-    nodev,                  /* reset */
+    nodev,                        /* reset */
     &g_VBoxDrvSolarisCbOps,
     (struct bus_ops *)0,
-    nodev                   /* power */
+    nodev,                        /* power */
+    VBoxDrvSolarisQuiesceNotNeeded
 };
 
 /**
@@ -146,7 +148,7 @@ static struct dev_ops g_VBoxDrvSolarisDevOps =
  */
 static struct modldrv g_VBoxDrvSolarisModule =
 {
-    &mod_driverops,         /* extern from kernel */
+    &mod_driverops,               /* extern from kernel */
     DEVICE_DESC " " VBOX_VERSION_STRING "r" RT_XSTR(VBOX_SVN_REV),
     &g_VBoxDrvSolarisDevOps
 };
@@ -159,7 +161,7 @@ static struct modlinkage g_VBoxDrvSolarisModLinkage =
     MODREV_1,                     /* loadable module system revision */
     {
         &g_VBoxDrvSolarisModule,
-        NULL                     /* terminate array of linkage structures */
+        NULL                      /* terminate array of linkage structures */
     }
 };
 
@@ -176,7 +178,7 @@ typedef struct
 /** State info. for each driver instance. */
 typedef struct
 {
-    dev_info_t     *pDip;   /* Device handle */
+    dev_info_t     *pDip;         /* Device handle */
 } vbox_devstate_t;
 #endif
 
@@ -198,7 +200,9 @@ static RTSPINLOCK           g_Spinlock = NIL_RTSPINLOCK;
  */
 int _init(void)
 {
+#if 0    /* No IPRT logging before RTR0Init() is done! */
     LogFlowFunc(("vboxdrv:_init\n"));
+#endif
 
     /*
      * Prevent module autounloading.
@@ -207,7 +211,7 @@ int _init(void)
     if (pModCtl)
         pModCtl->mod_loadflags |= MOD_NOAUTOUNLOAD;
     else
-        LogRel(("vboxdrv: failed to disable autounloading!\n"));
+        cmn_err(CE_NOTE, "vboxdrv: failed to disable autounloading!\n");
 
     /*
      * Initialize IPRT R0 driver, which internally calls OS-specific r0 init.
@@ -221,6 +225,8 @@ int _init(void)
         rc = supdrvInitDevExt(&g_DevExt, sizeof(SUPDRVSESSION));
         if (RT_SUCCESS(rc))
         {
+            cmn_err(CE_CONT, "!tsc::mode %s @ tentative %lu Hz\n", SUPGetGIPModeName(g_DevExt.pGip), g_DevExt.pGip->u64CpuHz);
+
             /*
              * Initialize the session hash table.
              */
@@ -254,7 +260,7 @@ int _init(void)
         else
         {
             LogRel(("VBoxDrvSolarisAttach: supdrvInitDevExt failed\n"));
-            rc = RTErrConvertToErrno(rc);
+            rc = EINVAL;
         }
         RTR0TermForced();
     }
@@ -297,7 +303,9 @@ int _fini(void)
 
 int _info(struct modinfo *pModInfo)
 {
-    LogFlowFunc(("vboxdrv:_info\n"));
+#if 0    /* No IPRT logging before RTR0Init() is done! And yes this is called before _init()!*/
+    LogFlowFunc(("vboxdrv:_init\n"));
+#endif
     int e = mod_info(&g_VBoxDrvSolarisModLinkage, pModInfo);
     return e;
 }
@@ -439,6 +447,19 @@ static int VBoxDrvSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd)
 }
 
 
+/**
+ * Quiesce not-needed entry point, as Solaris 10 doesn't have any
+ * ddi_quiesce_not_needed() function.
+ *
+ * @param   pDip            The module structure instance.
+ *
+ * @return  corresponding solaris error code.
+ */
+static int VBoxDrvSolarisQuiesceNotNeeded(dev_info_t *pDip)
+{
+    return DDI_SUCCESS;
+}
+
 
 /**
  * open() worker.
@@ -523,7 +544,7 @@ static int VBoxDrvSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred)
         RTSpinlockAcquire(g_Spinlock);
         pSession->pNextHash = g_apSessionHashTab[iHash];
         g_apSessionHashTab[iHash] = pSession;
-        RTSpinlockReleaseNoInts(g_Spinlock);
+        RTSpinlockRelease(g_Spinlock);
         LogFlow(("VBoxDrvSolarisOpen success\n"));
     }
 
@@ -611,7 +632,7 @@ static int VBoxDrvSolarisClose(dev_t Dev, int flag, int otyp, cred_t *cred)
             }
         }
     }
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
     if (!pSession)
     {
         LogRel(("VBoxDrvSolarisClose: WHAT?!? pSession == NULL! This must be a mistake... pid=%d (close)\n", (int)Process));
@@ -685,7 +706,7 @@ static int VBoxDrvSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArgs, int Mode, cre
     pSession = g_apSessionHashTab[iHash];
     while (pSession && pSession->Process != Process && pSession->fUnrestricted == fUnrestricted);
         pSession = pSession->pNextHash;
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
     if (!pSession)
     {
         LogRel(("VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x Dev=%#x\n",
@@ -942,6 +963,20 @@ bool VBOXCALL  supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
     return false;
 }
 
+
+bool VBOXCALL  supdrvOSAreCpusOfflinedOnSuspend(void)
+{
+    /** @todo verify this. */
+    return false;
+}
+
+
+bool VBOXCALL  supdrvOSAreTscDeltasInSync(void)
+{
+    return false;
+}
+
+
 #if  defined(VBOX_WITH_NATIVE_SOLARIS_LOADING) \
  && !defined(VBOX_WITHOUT_NATIVE_R0_LOADER)
 
@@ -1207,6 +1242,34 @@ void VBOXCALL   supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
 #endif /* !VBOX_WITH_NATIVE_SOLARIS_LOADING */
 
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+
+int VBOXCALL    supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue)
+{
+/** @todo cmi_hdl_rdmsr can safely do this. there is also the on_trap() fun
+ *        for catching traps that could possibly be used directly. */
+    NOREF(uMsr); NOREF(idCpu); NOREF(puValue);
+    return VERR_NOT_SUPPORTED;
+}
+
+
+int VBOXCALL    supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue)
+{
+/** @todo cmi_hdl_wrmsr can safely do this. */
+    NOREF(uMsr); NOREF(idCpu); NOREF(uValue);
+    return VERR_NOT_SUPPORTED;
+}
+
+
+int VBOXCALL    supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq)
+{
+    NOREF(idCpu); NOREF(pReq);
+    return VERR_NOT_SUPPORTED;
+}
+
+#endif /* SUPDRV_WITH_MSR_PROBER */
+
+
 RTDECL(int) SUPR0Printf(const char *pszFormat, ...)
 {
     va_list     args;
diff --git a/src/VBox/HostDrivers/Support/solaris/load.sh b/src/VBox/HostDrivers/Support/solaris/load.sh
index 985c345..0872ab4 100755
--- a/src/VBox/HostDrivers/Support/solaris/load.sh
+++ b/src/VBox/HostDrivers/Support/solaris/load.sh
@@ -5,7 +5,7 @@
 #
 
 #
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -44,7 +44,10 @@ SUDO=sudo
 #set -x
 
 # Disable the zone access service.
-$SUDO svcadm disable svc:/application/virtualbox/zoneaccess:default
+servicefound=`svcs -H "virtualbox/zoneaccess" 2>/dev/null | grep '^online'`
+if test ! -z "$servicefound"; then
+    $SUDO svcadm disable svc:/application/virtualbox/zoneaccess:default
+fi
 
 # Unload driver that may depend on the driver we're going to (re-)load
 # as well as the driver itself.
@@ -91,6 +94,10 @@ if $SUDO add_drv -v $DRVNAME; then
         echo "load.sh: successfully loaded the driver"
         modinfo | grep -w "$DRVNAME"
         MY_RC=0
+        if test ! -h "/dev/vboxdrv"; then
+            $SUDO ln -sf "/devices/pseudo/vboxdrv at 0:vboxdrv" /dev/vboxdrv
+            $SUDO chmod 0666 /dev/vboxdrv
+        fi
     else
         dmesg | tail
         echo "load.sh: modload failed"
diff --git a/src/VBox/HostDrivers/Support/testcase/Makefile.kmk b/src/VBox/HostDrivers/Support/testcase/Makefile.kmk
index efa06a6..35722ee 100644
--- a/src/VBox/HostDrivers/Support/testcase/Makefile.kmk
+++ b/src/VBox/HostDrivers/Support/testcase/Makefile.kmk
@@ -44,7 +44,8 @@ PROGRAMS += \
 	tstGetPagingMode \
 	tstSupLoadModule \
 	tstSupSem \
-	tstSupSem-Zombie
+	tstSupSem-Zombie \
+	tstSupTscDelta
  endif
 PROGRAMS.win += \
 	tstNtQueryStuff
@@ -100,5 +101,8 @@ tstSupSem_SOURCES     = tstSupSem.cpp
 tstSupSem-Zombie_TEMPLATE = VBOXR3TSTEXE
 tstSupSem-Zombie_SOURCES  = tstSupSem-Zombie.cpp
 
+tstSupTscDelta_TEMPLATE = VBOXR3TSTEXE
+tstSupTscDelta_SOURCES  = tstSupTscDelta.cpp
+
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp b/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp
index a3599e3..a44565b 100644
--- a/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp
+++ b/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -31,8 +31,6 @@
 #include <VBox/err.h>
 #include <VBox/param.h>
 #include <iprt/asm.h>
-#include <iprt/x86.h>
-#include <iprt/asm-amd64-x86.h>
 #include <iprt/assert.h>
 #include <iprt/alloc.h>
 #include <iprt/thread.h>
@@ -40,6 +38,7 @@
 #include <iprt/string.h>
 #include <iprt/initterm.h>
 #include <iprt/getopt.h>
+#include <iprt/x86.h>
 
 
 /**
@@ -78,7 +77,7 @@ int main(int argc, char **argv)
         { "--decimal",          'd', RTGETOPT_REQ_NOTHING },
         { "--spin",             's', RTGETOPT_REQ_NOTHING },
         { "--reference",        'r', RTGETOPT_REQ_UINT64 },  /* reference value of CpuHz, display the
-                                                              * difference in a separate column. */
+                                                              * CpuHz deviation in a separate column. */
     };
 
     uint32_t cIterations = 40;
@@ -88,7 +87,7 @@ int main(int argc, char **argv)
     uint64_t uCpuHzRef = 0;
     uint64_t uCpuHzOverallDeviation = 0;
     int64_t  iCpuHzMaxDeviation = 0;
-    uint32_t cCpuHzOverallDevCnt = 0;
+    int32_t cCpuHzOverallDevCnt = 0;
     RTGETOPTUNION ValueUnion;
     RTGETOPTSTATE GetState;
     RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
@@ -130,20 +129,19 @@ int main(int argc, char **argv)
     {
         if (g_pSUPGlobalInfoPage)
         {
-            RTPrintf("tstGIP-2: cCpus=%d  u32UpdateHz=%RU32  u32UpdateIntervalNS=%RU32  u64NanoTSLastUpdateHz=%RX64  uCpuHzRef=%RU64  u32Mode=%d (%s) u32Version=%#x\n",
+            RTPrintf("tstGIP-2: cCpus=%d  u32UpdateHz=%RU32  u32UpdateIntervalNS=%RU32  u64NanoTSLastUpdateHz=%RX64  u64CpuHz=%RU64  uCpuHzRef=%RU64  u32Mode=%d (%s) u32Version=%#x\n",
                      g_pSUPGlobalInfoPage->cCpus,
                      g_pSUPGlobalInfoPage->u32UpdateHz,
                      g_pSUPGlobalInfoPage->u32UpdateIntervalNS,
                      g_pSUPGlobalInfoPage->u64NanoTSLastUpdateHz,
+                     g_pSUPGlobalInfoPage->u64CpuHz,
                      uCpuHzRef,
                      g_pSUPGlobalInfoPage->u32Mode,
-                     g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_SYNC_TSC       ? "sync"
-                     : g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_ASYNC_TSC    ? "async"
-                     :                                                            "???",
+                     SUPGetGIPModeName(g_pSUPGlobalInfoPage),
                      g_pSUPGlobalInfoPage->u32Version);
             RTPrintf(fHex
-                     ? "tstGIP-2:     it: u64NanoTS        delta     u64TSC           UpIntTSC H  TransId           CpuHz %sTSC Interval History...\n"
-                     : "tstGIP-2:     it: u64NanoTS        delta     u64TSC             UpIntTSC H    TransId           CpuHz %sTSC Interval History...\n",
+                     ? "tstGIP-2:     it: u64NanoTS        delta     u64TSC           UpIntTSC H  TransId      CpuHz      %sTSC Interval History...\n"
+                     : "tstGIP-2:     it: u64NanoTS        delta     u64TSC             UpIntTSC H    TransId      CpuHz      %sTSC Interval History...\n",
                      uCpuHzRef ? "  CpuHz deviation  " : "");
             static SUPGIPCPU s_aaCPUs[2][256];
             for (uint32_t i = 0; i < cIterations; i++)
@@ -155,8 +153,7 @@ int main(int argc, char **argv)
                 uint32_t u32TransactionId = 0;
                 uint32_t volatile *pu32TransactionId = NULL;
                 for (unsigned iCpu = 0; iCpu < g_pSUPGlobalInfoPage->cCpus; iCpu++)
-                    if (    g_pSUPGlobalInfoPage->aCPUs[iCpu].u64CpuHz > 0
-                        &&  g_pSUPGlobalInfoPage->aCPUs[iCpu].u64CpuHz != _4G + 1)
+                    if (g_pSUPGlobalInfoPage->aCPUs[iCpu].enmState == SUPGIPCPUSTATE_ONLINE)
                     {
                         char szCpuHzDeviation[32];
                         PSUPGIPCPU pPrevCpu = &s_aaCPUs[!(i & 1)][iCpu];
@@ -169,7 +166,8 @@ int main(int argc, char **argv)
                                 RTStrPrintf(szCpuHzDeviation, sizeof(szCpuHzDeviation), "%17s  ", "?");
                             else
                             {
-                                if (pCpu->u32TransactionId > 23 + (8 * 2) + 1) /* Wait until the history validation code takes effect. */
+                                /* Wait until the history validation code takes effect. */
+                                if (pCpu->u32TransactionId > 23 + (8 * 2) + 1)
                                 {
                                     if (RT_ABS(iCpuHzDeviation) > RT_ABS(iCpuHzMaxDeviation))
                                         iCpuHzMaxDeviation = iCpuHzDeviation;
@@ -178,7 +176,7 @@ int main(int argc, char **argv)
                                 }
                                 uint32_t uPct = (uint32_t)(uCpuHzDeviation * 100000 / uCpuHzRef + 5);
                                 RTStrPrintf(szCpuHzDeviation, sizeof(szCpuHzDeviation), "%10RI64%3d.%02d%%  ",
-                                                iCpuHzDeviation, uPct / 1000, (uPct % 1000) / 10);
+                                            iCpuHzDeviation, uPct / 1000, (uPct % 1000) / 10);
                             }
                         }
                         else
@@ -218,21 +216,51 @@ int main(int argc, char **argv)
                 {
                     if (pu32TransactionId)
                     {
-                        while (u32TransactionId == *pu32TransactionId)
+                        uint32_t uTmp;
+                        while (   u32TransactionId == (uTmp = *pu32TransactionId)
+                               || (uTmp & 1))
                             ASMNopPause();
                     }
                     else
                         RTThreadSleep(1);
                 }
             }
-            RTPrintf("CPUID.Invariant-TSC: %RTbool\n", tstIsInvariantTsc());
+
+            /*
+             * Display TSC deltas.
+             *
+             * First iterative over the APIC ID array to get mostly consistent CPUID to APIC ID mapping.
+             * Then iterate over the offline CPUs. It is possible that there's a race between the online/offline
+             * states between the two iterations, but that cannot be helped from ring-3 anyway and not a biggie.
+             */
+            RTPrintf("tstGIP-2: TSC deltas:\n");
+            RTPrintf("tstGIP-2:  idApic: i64TSCDelta\n");
+            for (unsigned i = 0; i < RT_ELEMENTS(g_pSUPGlobalInfoPage->aiCpuFromApicId); i++)
+            {
+                uint16_t iCpu = g_pSUPGlobalInfoPage->aiCpuFromApicId[i];
+                if (iCpu != UINT16_MAX)
+                {
+                    RTPrintf("tstGIP-2: %7d: %lld\n", g_pSUPGlobalInfoPage->aCPUs[iCpu].idApic,
+                             g_pSUPGlobalInfoPage->aCPUs[iCpu].i64TSCDelta);
+                }
+            }
+
+            for (unsigned iCpu = 0; iCpu < g_pSUPGlobalInfoPage->cCpus; iCpu++)
+                if (g_pSUPGlobalInfoPage->aCPUs[iCpu].idApic == UINT16_MAX)
+                    RTPrintf("tstGIP-2: offline: %lld\n", g_pSUPGlobalInfoPage->aCPUs[iCpu].i64TSCDelta);
+
+            RTPrintf("tstGIP-2: enmUseTscDelta=%d  fGetGipCpu=%#x\n",
+                     g_pSUPGlobalInfoPage->enmUseTscDelta, g_pSUPGlobalInfoPage->fGetGipCpu);
             if (   uCpuHzRef
                 && cCpuHzOverallDevCnt)
             {
                 uint32_t uPct    = (uint32_t)(uCpuHzOverallDeviation * 100000 / cCpuHzOverallDevCnt / uCpuHzRef + 5);
+                RTPrintf("tstGIP-2: Average CpuHz deviation: %d.%02d%%\n",
+                         uPct / 1000, (uPct % 1000) / 10);
+
                 uint32_t uMaxPct = (uint32_t)(RT_ABS(iCpuHzMaxDeviation) * 100000 / uCpuHzRef + 5);
-                RTPrintf("Average CpuHz deviation: %d.%02d%%\n", uPct / 1000, (uPct % 1000) / 10);
-                RTPrintf("Maximum CpuHz deviation: %d.%02d%% (%RI64 ticks)\n", uMaxPct / 1000, (uMaxPct % 1000) / 10, iCpuHzMaxDeviation);
+                RTPrintf("tstGIP-2: Maximum CpuHz deviation: %d.%02d%% (%RI64 ticks)\n",
+                         uMaxPct / 1000, (uMaxPct % 1000) / 10, iCpuHzMaxDeviation);
             }
         }
         else
@@ -247,3 +275,4 @@ int main(int argc, char **argv)
         RTPrintf("tstGIP-2: SUPR3Init failed: %Rrc\n", rc);
     return !!rc;
 }
+
diff --git a/src/VBox/HostDrivers/Support/testcase/tstSupTscDelta.cpp b/src/VBox/HostDrivers/Support/testcase/tstSupTscDelta.cpp
new file mode 100644
index 0000000..9235e30
--- /dev/null
+++ b/src/VBox/HostDrivers/Support/testcase/tstSupTscDelta.cpp
@@ -0,0 +1,225 @@
+/* $Id: tstSupTscDelta.cpp $ */
+/** @file
+ * SUP Testcase - Global Info Page TSC Delta Measurement Utility.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/sup.h>
+#include <VBox/err.h>
+#include <iprt/assert.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/getopt.h>
+#include <iprt/test.h>
+#include <iprt/thread.h>
+
+
+
+int main(int argc, char **argv)
+{
+    RTTEST hTest;
+    RTEXITCODE rcExit = RTTestInitExAndCreate(argc, &argv, 0 /*fRtInit*/, "tstSupTscDelta", &hTest);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
+    /*
+     * Parse args
+     */
+    static const RTGETOPTDEF g_aOptions[] =
+    {
+        { "--iterations",       'i', RTGETOPT_REQ_INT32 },
+        { "--delay",            'd', RTGETOPT_REQ_INT32 },
+    };
+
+    uint32_t cIterations = 0; /* Currently 0 so that it doesn't upset testing. */
+    uint32_t cMsSleepBetweenIterations = 10;
+
+    int           ch;
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, g_aOptions, RT_ELEMENTS(g_aOptions), 1, RTGETOPTINIT_FLAGS_NO_STD_OPTS);
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (ch)
+        {
+            case 'd':
+                cMsSleepBetweenIterations = ValueUnion.u32;
+                break;
+            case 'i':
+                cIterations = ValueUnion.u32;
+                break;
+
+            default:
+                return RTGetOptPrintError(ch, &ValueUnion);
+        }
+    }
+    if (!cIterations)
+        return RTTestSkipAndDestroy(hTest, "Nothing to do. The --iterations argument is 0 or not given.");
+
+    /*
+     * Init
+     */
+    PSUPDRVSESSION pSession = NIL_RTR0PTR;
+    int rc = SUPR3Init(&pSession);
+    if (RT_SUCCESS(rc))
+    {
+        PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+        if (pGip)
+        {
+            if (pGip->enmUseTscDelta < SUPGIPUSETSCDELTA_PRACTICALLY_ZERO)
+                return RTTestSkipAndDestroy(hTest, "No deltas to play with: enmUseTscDelta=%d\n", pGip->enmUseTscDelta);
+
+            /*
+             * Init stats.
+             */
+            struct
+            {
+                int64_t iLowest;
+                int64_t iHighest;
+                int64_t iTotal;
+                uint64_t uAbsMin;
+                uint64_t uAbsMax;
+                uint64_t uAbsTotal;
+            } aCpuStats[RTCPUSET_MAX_CPUS];
+            RT_ZERO(aCpuStats);
+            for (uint32_t i = 0; i < pGip->cCpus; i++)
+            {
+                aCpuStats[i].iLowest  = INT64_MAX;
+                aCpuStats[i].iHighest = INT64_MIN;
+                aCpuStats[i].uAbsMin  = UINT64_MAX;
+            }
+
+            /*
+             * Do the work.
+             */
+            for (uint32_t iIteration = 0; ; iIteration++)
+            {
+                /*
+                 * Display the current deltas and gather statistics.
+                 */
+                RTPrintf("tstSupTscDelta: Iteration #%u results:", iIteration);
+                for (uint32_t iCpu = 0; iCpu < pGip->cCpus; iCpu++)
+                {
+                    int64_t iTscDelta = pGip->aCPUs[iCpu].i64TSCDelta;
+
+                    /* print */
+                    if ((iCpu % 4) == 0)
+                        RTPrintf("\ntstSupTscDelta:");
+                    if (pGip->aCPUs[iCpu].enmState != SUPGIPCPUSTATE_ONLINE)
+                        RTPrintf("  %02x: offline     ", iCpu, iTscDelta);
+                    else if (iTscDelta != INT64_MAX)
+                        RTPrintf("  %02x: %-12lld", iCpu, iTscDelta);
+                    else
+                        RTPrintf("  %02x: INT64_MAX   ", iCpu);
+
+                    /* stats */
+                    if (   iTscDelta != INT64_MAX
+                        && pGip->aCPUs[iCpu].enmState == SUPGIPCPUSTATE_ONLINE)
+                    {
+                        if (aCpuStats[iCpu].iLowest > iTscDelta)
+                            aCpuStats[iCpu].iLowest = iTscDelta;
+                        if (aCpuStats[iCpu].iHighest < iTscDelta)
+                            aCpuStats[iCpu].iHighest = iTscDelta;
+                        aCpuStats[iCpu].iTotal += iTscDelta;
+
+                        uint64_t uAbsTscDelta = iTscDelta >= 0 ? (uint64_t)iTscDelta : (uint64_t)-iTscDelta;
+                        if (aCpuStats[iCpu].uAbsMin > uAbsTscDelta)
+                            aCpuStats[iCpu].uAbsMin = uAbsTscDelta;
+                        if (aCpuStats[iCpu].uAbsMax < uAbsTscDelta)
+                            aCpuStats[iCpu].uAbsMax = uAbsTscDelta;
+                        aCpuStats[iCpu].uAbsTotal += uAbsTscDelta;
+                    }
+                }
+                if (((pGip->cCpus - 1) % 4) != 0)
+                    RTPrintf("\n");
+
+                /*
+                 * Done?
+                 */
+                if (iIteration + 1 >= cIterations)
+                    break;
+
+                /*
+                 * Force a new measurement.
+                 */
+                RTThreadSleep(cMsSleepBetweenIterations);
+                for (uint32_t iCpu = 0; iCpu < pGip->cCpus; iCpu++)
+                    if (pGip->aCPUs[iCpu].enmState == SUPGIPCPUSTATE_ONLINE)
+                    {
+                        rc = SUPR3TscDeltaMeasure(pGip->aCPUs[iCpu].idCpu, false /*fAsync*/, true /*fForce*/, 64, 16 /*ms*/);
+                        if (RT_FAILURE(rc))
+                            RTTestFailed(hTest, "SUPR3TscDeltaMeasure failed on %#x: %Rrc", pGip->aCPUs[iCpu].idCpu, rc);
+                    }
+            }
+
+            /*
+             * Display statistics that we've gathered.
+             */
+            RTPrintf("tstSupTscDelta: Results:\n");
+            int64_t  iLowest  = INT64_MAX;
+            int64_t  iHighest = INT64_MIN;
+            int64_t  iTotal   = 0;
+            uint32_t cTotal   = 0;
+            for (uint32_t iCpu = 0; iCpu < pGip->cCpus; iCpu++)
+            {
+                if (pGip->aCPUs[iCpu].enmState != SUPGIPCPUSTATE_ONLINE)
+                    RTPrintf("tstSupTscDelta:  %02x: offline\n", iCpu);
+                else
+                {
+                    RTPrintf("tstSupTscDelta:  %02x: lowest=%-12lld  highest=%-12lld  average=%-12lld  spread=%-12lld\n",
+                             iCpu,
+                             aCpuStats[iCpu].iLowest,
+                             aCpuStats[iCpu].iHighest,
+                             aCpuStats[iCpu].iTotal / cIterations,
+                             aCpuStats[iCpu].iHighest - aCpuStats[iCpu].iLowest);
+                    RTPrintf(  "tstSupTscDelta:      absmin=%-12llu   absmax=%-12llu   absavg=%-12llu  idCpu=%#4x  idApic=%#4x\n",
+                             aCpuStats[iCpu].uAbsMin,
+                             aCpuStats[iCpu].uAbsMax,
+                             aCpuStats[iCpu].uAbsTotal / cIterations,
+                             pGip->aCPUs[iCpu].idCpu,
+                             pGip->aCPUs[iCpu].idApic);
+                    if (iLowest > aCpuStats[iCpu].iLowest)
+                        iLowest = aCpuStats[iCpu].iLowest;
+                    if (iHighest < aCpuStats[iCpu].iHighest)
+                        iHighest = aCpuStats[iCpu].iHighest;
+                    iTotal += aCpuStats[iCpu].iHighest;
+                    cTotal += cIterations;
+                }
+            }
+            RTPrintf("tstSupTscDelta: all: lowest=%-12lld  highest=%-12lld  average=%-12lld  spread=%-12lld\n",
+                     iLowest, iHighest, iTotal / cTotal, iHighest - iLowest);
+        }
+        else
+            RTTestFailed(hTest, "g_pSUPGlobalInfoPage is NULL");
+
+        SUPR3Term(false /*fForced*/);
+    }
+    else
+        RTTestFailed(hTest, "SUPR3Init failed: %Rrc", rc);
+    return RTTestSummaryAndDestroy(hTest);
+}
+
+
diff --git a/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp b/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
index 1304494..f323d28 100644
--- a/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
+++ b/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp
@@ -1660,6 +1660,26 @@ bool VBOXCALL  supdrvOSGetForcedAsyncTscMode(PSUPDRVDEVEXT pDevExt)
 }
 
 
+/**
+ * Whether the host takes CPUs offline during a suspend/resume operation.
+ */
+bool VBOXCALL  supdrvOSAreCpusOfflinedOnSuspend(void)
+{
+    return false;
+}
+
+
+/**
+ * Whether the hardware TSC has been synchronized by the OS.
+ */
+bool VBOXCALL  supdrvOSAreTscDeltasInSync(void)
+{
+    /* If IPRT didn't find KeIpiGenericCall we pretend windows(, the firmware,
+       or whoever) always configures TSCs perfectly. */
+    return !RTMpOnPairIsConcurrentExecSupported();
+}
+
+
 #define MY_SystemLoadGdiDriverInSystemSpaceInformation  54
 #define MY_SystemUnloadGdiDriverInformation             27
 
@@ -1959,6 +1979,226 @@ void VBOXCALL   supdrvOSLdrUnload(PSUPDRVDEVEXT pDevExt, PSUPDRVLDRIMAGE pImage)
 }
 
 
+#ifdef SUPDRV_WITH_MSR_PROBER
+
+#if 1
+/** @todo make this selectable. */
+# define AMD_MSR_PASSCODE 0x9c5a203a
+#else
+# define ASMRdMsrEx(a, b, c) ASMRdMsr(a)
+# define ASMWrMsrEx(a, b, c) ASMWrMsr(a,c)
+#endif
+
+
+/**
+ * Argument package used by supdrvOSMsrProberRead and supdrvOSMsrProberWrite.
+ */
+typedef struct SUPDRVNTMSPROBERARGS
+{
+    uint32_t    uMsr;
+    uint64_t    uValue;
+    bool        fGp;
+} SUPDRVNTMSPROBERARGS;
+
+/** @callback_method_impl{FNRTMPWORKER, Worker for supdrvOSMsrProberRead.} */
+static DECLCALLBACK(void) supdrvNtMsProberReadOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    /*
+     * rdmsr and wrmsr faults can be caught even with interrupts disabled.
+     * (At least on 32-bit XP.)
+     */
+    SUPDRVNTMSPROBERARGS   *pArgs = (SUPDRVNTMSPROBERARGS *)pvUser1; NOREF(idCpu); NOREF(pvUser2);
+    RTCCUINTREG             fOldFlags = ASMIntDisableFlags();
+    __try
+    {
+        pArgs->uValue = ASMRdMsrEx(pArgs->uMsr, AMD_MSR_PASSCODE);
+        pArgs->fGp    = false;
+    }
+    __except(EXCEPTION_EXECUTE_HANDLER)
+    {
+        pArgs->fGp    = true;
+        pArgs->uValue = 0;
+    }
+    ASMSetFlags(fOldFlags);
+}
+
+
+int VBOXCALL    supdrvOSMsrProberRead(uint32_t uMsr, RTCPUID idCpu, uint64_t *puValue)
+{
+    SUPDRVNTMSPROBERARGS Args;
+    Args.uMsr   = uMsr;
+    Args.uValue = 0;
+    Args.fGp    = true;
+
+    if (idCpu == NIL_RTCPUID)
+        supdrvNtMsProberReadOnCpu(idCpu, &Args, NULL);
+    else
+    {
+        int rc = RTMpOnSpecific(idCpu, supdrvNtMsProberReadOnCpu, &Args, NULL);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    if (Args.fGp)
+        return VERR_ACCESS_DENIED;
+    *puValue = Args.uValue;
+    return VINF_SUCCESS;
+}
+
+
+/** @callback_method_impl{FNRTMPWORKER, Worker for supdrvOSMsrProberWrite.} */
+static DECLCALLBACK(void) supdrvNtMsProberWriteOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    /*
+     * rdmsr and wrmsr faults can be caught even with interrupts disabled.
+     * (At least on 32-bit XP.)
+     */
+    SUPDRVNTMSPROBERARGS   *pArgs = (SUPDRVNTMSPROBERARGS *)pvUser1; NOREF(idCpu); NOREF(pvUser2);
+    RTCCUINTREG             fOldFlags = ASMIntDisableFlags();
+    __try
+    {
+        ASMWrMsrEx(pArgs->uMsr, AMD_MSR_PASSCODE, pArgs->uValue);
+        pArgs->fGp = false;
+    }
+    __except(EXCEPTION_EXECUTE_HANDLER)
+    {
+        pArgs->fGp = true;
+    }
+    ASMSetFlags(fOldFlags);
+}
+
+int VBOXCALL    supdrvOSMsrProberWrite(uint32_t uMsr, RTCPUID idCpu, uint64_t uValue)
+{
+    SUPDRVNTMSPROBERARGS Args;
+    Args.uMsr   = uMsr;
+    Args.uValue = uValue;
+    Args.fGp    = true;
+
+    if (idCpu == NIL_RTCPUID)
+        supdrvNtMsProberReadOnCpu(idCpu, &Args, NULL);
+    else
+    {
+        int rc = RTMpOnSpecific(idCpu, supdrvNtMsProberReadOnCpu, &Args, NULL);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    if (Args.fGp)
+        return VERR_ACCESS_DENIED;
+    return VINF_SUCCESS;
+}
+
+/** @callback_method_impl{FNRTMPWORKER, Worker for supdrvOSMsrProberModify.} */
+static DECLCALLBACK(void) supdrvNtMsProberModifyOnCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PSUPMSRPROBER       pReq        = (PSUPMSRPROBER)pvUser1;
+    register uint32_t   uMsr        = pReq->u.In.uMsr;
+    bool const          fFaster     = pReq->u.In.enmOp == SUPMSRPROBEROP_MODIFY_FASTER;
+    uint64_t            uBefore     = 0;
+    uint64_t            uWritten    = 0;
+    uint64_t            uAfter      = 0;
+    bool                fBeforeGp   = true;
+    bool                fModifyGp   = true;
+    bool                fAfterGp    = true;
+    bool                fRestoreGp  = true;
+    RTCCUINTREG         fOldFlags;
+
+    /*
+     * Do the job.
+     */
+    fOldFlags = ASMIntDisableFlags();
+    ASMCompilerBarrier(); /* paranoia */
+    if (!fFaster)
+        ASMWriteBackAndInvalidateCaches();
+
+    __try
+    {
+        uBefore   = ASMRdMsrEx(uMsr, AMD_MSR_PASSCODE);
+        fBeforeGp = false;
+    }
+    __except(EXCEPTION_EXECUTE_HANDLER)
+    {
+        fBeforeGp = true;
+    }
+    if (!fBeforeGp)
+    {
+        register uint64_t uRestore = uBefore;
+
+        /* Modify. */
+        uWritten  = uRestore;
+        uWritten &= pReq->u.In.uArgs.Modify.fAndMask;
+        uWritten |= pReq->u.In.uArgs.Modify.fOrMask;
+        __try
+        {
+            ASMWrMsrEx(uMsr, AMD_MSR_PASSCODE, uWritten);
+            fModifyGp = false;
+        }
+        __except(EXCEPTION_EXECUTE_HANDLER)
+        {
+            fModifyGp = true;
+        }
+
+        /* Read modified value. */
+        __try
+        {
+            uAfter   = ASMRdMsrEx(uMsr, AMD_MSR_PASSCODE);
+            fAfterGp = false;
+        }
+        __except(EXCEPTION_EXECUTE_HANDLER)
+        {
+            fAfterGp = true;
+        }
+
+        /* Restore original value. */
+        __try
+        {
+            ASMWrMsrEx(uMsr, AMD_MSR_PASSCODE, uRestore);
+            fRestoreGp = false;
+        }
+        __except(EXCEPTION_EXECUTE_HANDLER)
+        {
+            fRestoreGp = true;
+        }
+
+        /* Invalid everything we can. */
+        if (!fFaster)
+        {
+            ASMWriteBackAndInvalidateCaches();
+            ASMReloadCR3();
+            ASMNopPause();
+        }
+    }
+
+    ASMCompilerBarrier(); /* paranoia */
+    ASMSetFlags(fOldFlags);
+
+    /*
+     * Write out the results.
+     */
+    pReq->u.Out.uResults.Modify.uBefore    = uBefore;
+    pReq->u.Out.uResults.Modify.uWritten   = uWritten;
+    pReq->u.Out.uResults.Modify.uAfter     = uAfter;
+    pReq->u.Out.uResults.Modify.fBeforeGp  = fBeforeGp;
+    pReq->u.Out.uResults.Modify.fModifyGp  = fModifyGp;
+    pReq->u.Out.uResults.Modify.fAfterGp   = fAfterGp;
+    pReq->u.Out.uResults.Modify.fRestoreGp = fRestoreGp;
+    RT_ZERO(pReq->u.Out.uResults.Modify.afReserved);
+}
+
+
+int VBOXCALL    supdrvOSMsrProberModify(RTCPUID idCpu, PSUPMSRPROBER pReq)
+{
+    if (idCpu == NIL_RTCPUID)
+    {
+        supdrvNtMsProberModifyOnCpu(idCpu, pReq, NULL);
+        return VINF_SUCCESS;
+    }
+    return RTMpOnSpecific(idCpu, supdrvNtMsProberModifyOnCpu, pReq, NULL);
+}
+
+#endif /* SUPDRV_WITH_MSR_PROBER */
+
+
 /**
  * Converts an IPRT error code to an nt status code.
  *
diff --git a/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp b/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp
index fd70415..af6582f 100644
--- a/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp
+++ b/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp
@@ -223,7 +223,7 @@ static const char *g_apszSupNtVpAllowedVmExes[] =
     "tstCFGM.exe",
     "tstIntNet-1.exe",
     "tstMMHyperHeap.exe",
-    "tstR0ThreadPreemptionDriver.exe",
+    "tstRTR0ThreadPreemptionDriver.exe",
     "tstRTR0MemUserKernelDriver.exe",
     "tstRTR0SemMutexDriver.exe",
     "tstRTR0TimerDriver.exe",
diff --git a/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp b/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp
index 99ef643..d4129a6 100644
--- a/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp
+++ b/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/HostDrivers/Support/win/VBoxDrv.rc b/src/VBox/HostDrivers/Support/win/VBoxDrv.rc
index c3543e2..43c63e0 100644
--- a/src/VBox/HostDrivers/Support/win/VBoxDrv.rc
+++ b/src/VBox/HostDrivers/Support/win/VBoxDrv.rc
@@ -30,26 +30,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DRV
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DRV
   FILESUBTYPE      VFT2_DRV_SYSTEM
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Support Driver\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxDrv\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxDrv.sys\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostDrivers/Support/win/VBoxSupLib.rc b/src/VBox/HostDrivers/Support/win/VBoxSupLib.rc
index 6aba492..0e01deb 100644
--- a/src/VBox/HostDrivers/Support/win/VBoxSupLib.rc
+++ b/src/VBox/HostDrivers/Support/win/VBoxSupLib.rc
@@ -30,26 +30,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Kernel Support\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxSupLib\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxSupLib.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk b/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk
index 16c1408..221f3df 100644
--- a/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk
+++ b/src/VBox/HostDrivers/VBoxNetAdp/Makefile.kmk
@@ -65,12 +65,11 @@ endif
 ifeq ($(KBUILD_TARGET),darwin)
  INSTALLS += VBoxNetAdp.kext
  VBoxNetAdp.kext_INST     = $(INST_VBOXNETADP)Contents/
- VBoxNetAdp.kext_SOURCES  = \
- 	$(VBoxNetAdp.kext_0_OUTDIR)/Info.plist
- VBoxNetAdp.kext_CLEAN    = \
- 	$(VBoxNetAdp.kext_0_OUTDIR)/Info.plist
+ VBoxNetAdp.kext_SOURCES  = $(VBoxNetAdp.kext_0_OUTDIR)/Contents/Info.plist
+ VBoxNetAdp.kext_CLEAN    = $(VBoxNetAdp.kext_0_OUTDIR)/Contents/Info.plist
+ VBoxNetAdp.kext_BLDDIRS  = $(VBoxNetAdp.kext_0_OUTDIR)/Contents/
 
-$$(VBoxNetAdp.kext_0_OUTDIR)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
+$$(VBoxNetAdp.kext_0_OUTDIR)/Contents/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
 	$(call MSG_GENERATE,VBoxNetAdp,$@,$<)
 	$(QUIET)$(RM) -f $@
 	$(QUIET)$(SED) \
@@ -84,6 +83,8 @@ $$(VBoxNetAdp.kext_0_OUTDIR)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $
 		--output $@ \
 		$<
 
+ $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxNetAdp)
+
  INSTALLS.darwin += Scripts-darwin-adp
  Scripts-darwin-adp_INST = $(INST_DIST)
  Scripts-darwin-adp_EXEC_SOURCES = \
diff --git a/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c b/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c
index f3c0aaf..36eec8e 100644
--- a/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c
+++ b/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -108,7 +108,7 @@ DECLINLINE(void) vboxNetAdpSetStateWithLock(PVBOXNETADP pThis, VBOXNETADPSTATE e
     Log(("vboxNetAdpSetStateWithLock: pThis=%p, state=%d.\n", pThis, enmNewState));
     RTSpinlockAcquire(pThis->hSpinlock);
     vboxNetAdpSetState(pThis, enmNewState);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 }
 
 
@@ -125,7 +125,7 @@ DECLINLINE(VBOXNETADPSTATE) vboxNetAdpGetStateWithLock(PVBOXNETADP pThis)
     VBOXNETADPSTATE enmState;
     RTSpinlockAcquire(pThis->hSpinlock);
     enmState = vboxNetAdpGetState(pThis);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
     Log(("vboxNetAdpGetStateWithLock: pThis=%p, state=%d.\n", pThis, enmState));
     return enmState;
 }
@@ -151,7 +151,7 @@ DECLINLINE(bool) vboxNetAdpCheckAndSetState(PVBOXNETADP pThis, VBOXNETADPSTATE e
         vboxNetAdpSetState(pThis, enmNewState);
     else
         fRc = false;
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     if (fRc)
         Log(("vboxNetAdpCheckAndSetState: pThis=%p, state changed: %d -> %d.\n", pThis, enmOldState, enmNewState));
@@ -179,10 +179,10 @@ static PVBOXNETADP vboxNetAdpFind(PVBOXNETADPGLOBALS pGlobals, const char *pszNa
         if (    vboxNetAdpGetState(pThis)
             &&  !strcmp(pThis->szName, pszName))
         {
-            RTSpinlockReleaseNoInts(pThis->hSpinlock);
+            RTSpinlockRelease(pThis->hSpinlock);
             return pThis;
         }
-        RTSpinlockReleaseNoInts(pThis->hSpinlock);
+        RTSpinlockRelease(pThis->hSpinlock);
     }
     return NULL;
 }
@@ -348,7 +348,7 @@ DECLHIDDEN(bool) vboxNetAdpPrepareToReceive(PVBOXNETADP pThis)
         vboxNetAdpRetain(pThis);
         vboxNetAdpBusy(pThis);
     }
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
     Log(("vboxNetAdpPrepareToReceive: fCanReceive=%d.\n", fCanReceive));
 
     return fCanReceive;
@@ -412,14 +412,14 @@ static DECLCALLBACK(int) vboxNetAdpPortXmit(PINTNETTRUNKIFPORT pIfPort, PINTNETS
     RTSpinlockAcquire(pThis->hSpinlock);
     if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Active)
     {
-        RTSpinlockReleaseNoInts(pThis->hSpinlock);
+        RTSpinlockRelease(pThis->hSpinlock);
         Log(("vboxNetAdpReceive: Dropping incoming packet for inactive interface %s.\n",
              pThis->szName));
         return VERR_INVALID_STATE;
     }
     vboxNetAdpRetain(pThis);
     vboxNetAdpBusy(pThis);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     rc = vboxNetAdpPortOsXmit(pThis, pSG, fDst);
     vboxNetAdpIdle(pThis);
@@ -514,7 +514,7 @@ static DECLCALLBACK(bool) vboxNetAdpPortSetActive(PINTNETTRUNKIFPORT pIfPort, bo
         }
     }
 
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
     Log(("vboxNetAdpPortSetActive: state after: %RTbool.\n", vboxNetAdpGetState(pThis)));
     return fPreviouslyActive;
 }
@@ -545,14 +545,14 @@ static DECLCALLBACK(void) vboxNetAdpPortDisconnectAndRelease(PINTNETTRUNKIFPORT
     //Assert(vboxNetAdpGetState(pThis) == kVBoxNetAdpState_Connected);
     Assert(!pThis->cBusy);
     vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     vboxNetAdpOsDisconnectIt(pThis);
     pThis->pSwitchPort = NULL;
 
     RTSpinlockAcquire(pThis->hSpinlock);
     vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     vboxNetAdpRelease(pThis);
 }
@@ -600,7 +600,7 @@ int vboxNetAdpCreate(PINTNETTRUNKFACTORY pIfFactory, PVBOXNETADP *ppNew)
 
             RTSpinlockAcquire(pThis->hSpinlock);
             vboxNetAdpSetState(pThis, kVBoxNetAdpState_Available);
-            RTSpinlockReleaseNoInts(pThis->hSpinlock);
+            RTSpinlockRelease(pThis->hSpinlock);
             return rc;
         }
     }
@@ -616,18 +616,18 @@ int vboxNetAdpDestroy(PVBOXNETADP pThis)
     RTSpinlockAcquire(pThis->hSpinlock);
     if (vboxNetAdpGetState(pThis) != kVBoxNetAdpState_Available || pThis->cBusy)
     {
-        RTSpinlockReleaseNoInts(pThis->hSpinlock);
+        RTSpinlockRelease(pThis->hSpinlock);
         return VERR_INTNET_FLT_IF_BUSY;
     }
     vboxNetAdpSetState(pThis, kVBoxNetAdpState_Transitional);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
     vboxNetAdpRelease(pThis);
 
     vboxNetAdpOsDestroy(pThis);
 
     RTSpinlockAcquire(pThis->hSpinlock);
     vboxNetAdpSetState(pThis, kVBoxNetAdpState_Invalid);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     return rc;
 }
diff --git a/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c b/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c
index 156f452..408007d 100644
--- a/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c
+++ b/src/VBox/HostDrivers/VBoxNetAdp/solaris/VBoxNetAdp-solaris.c
@@ -64,7 +64,6 @@
 #define DEVICE_NAME              "vboxnet"
 /** The module descriptions as seen in 'modinfo'. */
 #define DEVICE_DESC_DRV          "VirtualBox NetAdp"
-#define VBOXNETADP_MTU           1500
 
 
 /*******************************************************************************
@@ -72,6 +71,7 @@
 *******************************************************************************/
 static int VBoxNetAdpSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd);
 static int VBoxNetAdpSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd);
+static int VBoxNetAdpSolarisQuiesceNotNeeded(dev_info_t *pDip);
 
 /**
  * Streams: module info.
@@ -163,7 +163,8 @@ static struct dev_ops g_VBoxNetAdpSolarisDevOps =
     nodev,                          /* reset */
     &g_VBoxNetAdpSolarisCbOps,
     (struct bus_ops *)0,
-    nodev                           /* power */
+    nodev,                          /* power */
+    VBoxNetAdpSolarisQuiesceNotNeeded
 };
 
 /**
@@ -442,6 +443,20 @@ static int VBoxNetAdpSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd)
 }
 
 
+/**
+ * Quiesce not-needed entry point, as Solaris 10 doesn't have any
+ * ddi_quiesce_not_needed() function.
+ *
+ * @param   pDip            The module structure instance.
+ *
+ * @return  corresponding solaris error code.
+ */
+static int VBoxNetAdpSolarisQuiesceNotNeeded(dev_info_t *pDip)
+{
+    return DDI_SUCCESS;
+}
+
+
 static int vboxNetAdpSolarisGenerateMac(PRTMAC pMac)
 {
     pMac->au8[0] = 0x08;
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk b/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk
index b852efc..fbc5231 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk
+++ b/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk
@@ -71,12 +71,11 @@ if1of ($(KBUILD_TARGET), darwin win) # this ifeq must go, see @todo around elif
 ifeq ($(KBUILD_TARGET),darwin)
  INSTALLS += VBoxNetFlt.kext
  VBoxNetFlt.kext_INST     = $(INST_VBOXNETFLT)Contents/
- VBoxNetFlt.kext_SOURCES  = \
- 	$(VBoxNetFlt.kext_0_OUTDIR)/Info.plist
- VBoxNetFlt.kext_CLEAN    = \
- 	$(VBoxNetFlt.kext_0_OUTDIR)/Info.plist
+ VBoxNetFlt.kext_SOURCES  = $(VBoxNetFlt.kext_0_OUTDIR)/Contents/Info.plist
+ VBoxNetFlt.kext_CLEAN    = $(VBoxNetFlt.kext_0_OUTDIR)/Contents/Info.plist
+ VBoxNetFlt.kext_BLDDIRS  = $(VBoxNetFlt.kext_0_OUTDIR)/Contents/
 
-$$(VBoxNetFlt.kext_0_OUTDIR)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
+$$(VBoxNetFlt.kext_0_OUTDIR)/Contents/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
 	$(call MSG_GENERATE,VBoxNetFlt,$@,$<)
 	$(QUIET)$(RM) -f $@
 	$(QUIET)$(SED) \
@@ -90,6 +89,8 @@ $$(VBoxNetFlt.kext_0_OUTDIR)/Info.plist: $(PATH_SUB_CURRENT)/darwin/Info.plist $
 		--output $@ \
 		$<
 
+ $(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxNetFlt)
+
  INSTALLS.darwin += Scripts-darwin
  Scripts-darwin_INST = $(INST_DIST)
  Scripts-darwin_EXEC_SOURCES = \
@@ -139,6 +140,83 @@ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat: \
 
  endif # signing
 
+
+ #
+ # VBoxNetLwf.sys - The light-weight filter driver for NDIS6.
+ #
+ SYSMODS += VBoxNetLwf
+ VBoxNetLwf_TEMPLATE = VBOXR0DRV
+ VBoxNetLwf_INST = $(INST_VBOXNETFLT)
+ if defined(VBOX_SIGNING_MODE)
+  VBoxNetLwf_INSTTYPE = none
+  VBoxNetLwf_DEBUG_INSTTYPE = both
+ endif
+ VBoxNetLwf_DEFS = IN_RT_R0 IN_SUP_STATIC
+ VBoxNetLwf_INCS = .
+ VBoxNetLwf_SOURCES = VBoxNetFlt.c VBoxNetFlt.rc
+ VBoxNetLwf_SDKS.win = ReorderCompilerIncs $(VBOX_WINDDK_WLH) $(VBOX_WINPSDK)INCS
+ VBoxNetLwf_SOURCES.win = \
+ 	win/ndis6/VBoxNetLwf-win.cpp
+# 	win/drv/VBoxNetLwfRt-win.cpp \
+# 	win/drv/VBoxNetLwf-win.rc
+ # with WINDDKWLH the WIN9X_COMPAT_SPINLOCK is needed to avoid inline declaration of KeInitializeSpinLock
+ # otherwise the linker would complain about dumplicate _KeInitializeSpinLock at 4 definition
+ # in ntoskrnl.lib and our object files
+ VBoxNetLwf_DEFS.win += WIN9X_COMPAT_SPINLOCK=1 NDISLWF=1 DBG=1
+# VBoxNetLwf_DEFS.win += VBOXNETFLT_STATIC_CONFIG
+# VBoxNetLwf_DEFS.win += VBOXNETFLT_NO_PACKET_QUEUE
+# VBoxNetLwf_DEFS.win += NDIS_MINIPORT_DRIVER NDIS_WDM=1 BINARY_COMPATIBLE=0
+ VBoxNetLwf_DEFS.win += NDIS60=1
+# ifdef VBOX_LOOPBACK_USEFLAGS
+#  VBoxNetLwf_DEFS.win += VBOX_LOOPBACK_USEFLAGS
+# endif
+# VBoxNetLwf_SOURCES = VBoxNetLwf.c
+ VBoxNetLwf_LDFLAGS.win.x86 = -Entry:DriverEntry at 8
+ VBoxNetLwf_LDFLAGS.win.amd64 = -Entry:DriverEntry
+ VBoxNetLwf_LIBS.win = \
+ 	$(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/ntoskrnl.lib \
+ 	$(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/hal.lib \
+ 	$(PATH_SDK_$(VBOX_WINDDK_WLH)_LIB)/ndis.lib \
+ 	$(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
+ VBoxNetLwf_LIBS = \
+ 	$(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
+ #
+ # VBoxNetLwf installation.
+ #
+ INSTALLS.win += VBoxNetLwf-inf
+ VBoxNetLwf-inf_INST = $(INST_BIN)
+ VBoxNetLwf-inf_SOURCES = \
+ 	$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.inf
+ VBoxNetLwf-inf_CLEAN = $(VBoxNetLwf-inf_SOURCES)
+ VBoxNetLwf-inf_BLDDIRS = $(PATH_TARGET)/VBoxNetLwfCat.dir
+
+$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.inf: $(PATH_SUB_CURRENT)/win/ndis6/VBoxNetLwf.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
+	$(call MSG_GENERATE,VBoxNetLwf-inf,$@,$<)
+	$(call VBOX_EDIT_INF_FN,$<,$@)
+
+ ifdef VBOX_SIGNING_MODE
+VBoxNetLwf-inf_SOURCES += \
+	$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.sys \
+	$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.cat
+
+#	$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwfNobj.dll \
+
+$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.sys: $$(VBoxNetLwf_1_TARGET) | $$(dir $$@)
+	$(INSTALL) -m 644 $< $(@D)
+
+#$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwfNobj.dll: $$(VBoxNetLwfNobj_1_TARGET) | $$(dir $$@)
+#	$(INSTALL) -m 644 $< $(@D)
+
+$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.cat: \
+		$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.sys \
+		$(PATH_TARGET)/VBoxNetLwfCat.dir/VBoxNetLwf.inf
+	$(call MSG_TOOL,Inf2Cat,VBoxNetLwf-inf,$@,$<)
+	$(call VBOX_MAKE_CAT_FN, $(@D),$@)
+
+ endif # signing
+
+
+
  #
  # WinNetConfig - static library with host network interface config API
  #
@@ -209,6 +287,66 @@ $(PATH_TARGET)/VBoxNetFltCat.dir/VBoxNetFlt.cat: \
  	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/WbemUuid.Lib
 
  #
+ # NetAdp6Install
+ #
+ PROGRAMS.win  += NetAdp6Install
+ NetAdp6Install_TEMPLATE = VBOXR3STATIC
+ NetAdp6Install_SDKS     = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
+ NetAdp6Install_SOURCES  = win/tools/VBoxNetAdpInstall.cpp
+ NetAdp6Install_DEFS    += NDIS60=1
+ NetAdp6Install_LIBS     = \
+ 	$(WinNetConfig_1_TARGET) \
+	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB) \
+ 	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/Newdev.lib \
+  	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
+ 	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/WbemUuid.Lib
+
+
+ #
+ # NetAdp6Uninstall
+ #
+ PROGRAMS.win  += NetAdp6Uninstall
+ NetAdp6Uninstall_TEMPLATE = VBOXR3STATIC
+ NetAdp6Uninstall_SDKS     = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
+ NetAdp6Uninstall_SOURCES  = win/tools/VBoxNetAdpUninstall.cpp
+ NetAdp6Uninstall_DEFS    += NDIS60=1
+ NetAdp6Uninstall_LIBS     = \
+ 	$(WinNetConfig_1_TARGET) \
+	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB) \
+ 	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/Newdev.lib \
+  	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
+ 	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/WbemUuid.Lib
+
+ #
+ # NetLwfInstall
+ #
+ PROGRAMS.win  += NetLwfInstall
+ NetLwfInstall_TEMPLATE = VBOXR3STATIC
+ NetLwfInstall_SDKS     = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
+ NetLwfInstall_SOURCES  = win/tools/VBoxNetLwfInstall.cpp
+ NetLwfInstall_LIBS     = \
+ 	$(WinNetConfig_1_TARGET) \
+	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB) \
+ 	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/Newdev.lib \
+  	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
+ 	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/WbemUuid.Lib
+
+
+ #
+ # NetLwfUninstall
+ #
+ PROGRAMS.win  += NetLwfUninstall
+ NetLwfUninstall_TEMPLATE = VBOXR3STATIC
+ NetLwfUninstall_SDKS     = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
+ NetLwfUninstall_SOURCES  = win/tools/VBoxNetLwfUninstall.cpp
+ NetLwfUninstall_LIBS     = \
+ 	$(WinNetConfig_1_TARGET) \
+	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB) \
+ 	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/Newdev.lib \
+  	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
+ 	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/WbemUuid.Lib
+
+ #
  # VBoxNetFltNobj
  #
  DLLS.win += VBoxNetFltNobj
@@ -310,18 +448,79 @@ $(PATH_TARGET)/VBoxNetAdpCat.dir/VBoxNetAdp.cat: \
 
  endif #  ifdef VBOX_SIGNING_MODE
 
+ #
+ # VBoxNetAdp6.sys - The VirtualBox Adapter miniport driver.
+ #
+ SYSMODS.win += VBoxNetAdp6
+ VBoxNetAdp6_TEMPLATE = VBOXR0DRV
+ #VBoxNetAdp6_INST = $(INST_VBOXNETADP)
+ if defined(VBOX_SIGNING_MODE)
+  VBoxNetAdp6_INSTTYPE.win = none
+  VBoxNetAdp6_DEBUG_INSTTYPE.win = both
+ endif
+ VBoxNetAdp6_DEFS = IN_RT_R0 IN_SUP_STATIC
+ VBoxNetAdp6_INCS := $(PATH_SUB_CURRENT)
+ VBoxNetAdp6_SDKS = ReorderCompilerIncs $(VBOX_WINDDK_WLH) $(VBOX_WINPSDK)INCS
+ VBoxNetAdp6_SOURCES = \
+ 	win/ndis6/VBoxNetAdp-win.cpp \
+ 	win/ndis6/VBoxNetAdp-win.rc
+ VBoxNetAdp6_DEFS += NDIS_MINIPORT_DRIVER NDIS_WDM=1 BINARY_COMPATIBLE=0
+ VBoxNetAdp6_DEFS += NDIS60_MINIPORT=1 NDIS60=1
+ VBoxNetAdp6_LDFLAGS.win.x86 = -Entry:DriverEntry at 8
+ VBoxNetAdp6_LDFLAGS.win.amd64 = -Entry:DriverEntry
+ VBoxNetAdp6_LIBS.win = \
+ 	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/ntoskrnl.lib \
+ 	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/hal.lib \
+ 	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/ndis.lib \
+ 	$(PATH_STAGE_LIB)/RuntimeR0Drv$(VBOX_SUFF_LIB)
+ VBoxNetAdp6_LIBS = \
+ 	$(PATH_STAGE_LIB)/SUPR0IdcClient$(VBOX_SUFF_LIB)
+
+
+ INSTALLS.win += VBoxNetAdp6-inf
+ VBoxNetAdp6-inf_INST = $(INST_BIN)
+ VBoxNetAdp6-inf_MODE = a+r,u+w
+ VBoxNetAdp6-inf_SOURCES = \
+ 	$(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf
+ VBoxNetAdp6-inf_CLEAN = $(VBoxNetAdp6-inf_SOURCES)
+ VBoxNetAdp6-inf_BLDDIRS = $(PATH_TARGET)/VBoxNetAdp6Cat.dir
+
+$(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf: $(PATH_SUB_CURRENT)/win/ndis6/VBoxNetAdp6.inf $(MAKEFILE_CURRENT) | $$(dir $$@)
+	$(call MSG_GENERATE,VBoxNetAdp6-inf,$@,$<)
+	$(call VBOX_EDIT_INF_FN,$<,$@)
+
+ ifdef VBOX_SIGNING_MODE
+VBoxNetAdp6-inf_SOURCES += \
+	$(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys \
+	$(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat
+
+$(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys: $$(VBoxNetAdp6_1_TARGET) | $$(dir $$@)
+	$(INSTALL) -m 644 $< $(@D)
+
+$(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.cat: \
+		$(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.sys \
+		$(PATH_TARGET)/VBoxNetAdp6Cat.dir/VBoxNetAdp6.inf
+	$(call MSG_TOOL,Inf2Cat,VBoxNetFlt-inf,$@,$<)
+	$(call VBOX_MAKE_CAT_FN, $(@D),$@)
+
+ endif #  ifdef VBOX_SIGNING_MODE
+
 endif #ifeq ($(KBUILD_TARGET), win)
 
 else if1of ($(KBUILD_TARGET), linux solaris freebsd) ## @todo merge this with the mixed case stuff.
 #
 # vboxnetflt(.ko/.o/) - The lower case driver.
 # Note! On Solaris the name has to be <= 8 chars long.
+# The DEBUG_HASH* stuff is for CONFIG_DYNAMIC_DEBUG-enabled kernels
 #
  ifdef VBOX_WITH_VBOXDRV
   SYSMODS += vboxnetflt
   vboxnetflt_TEMPLATE      = VBOXR0DRV
   vboxnetflt_NAME.solaris  = vboxflt
-  vboxnetflt_DEFS.linux    = KBUILD_MODNAME=KBUILD_STR\(vboxnetflt\) KBUILD_BASENAME=KBUILD_STR\(vboxnetflt\) MODULE
+  vboxnetflt_DEFS.linux    = \
+	KBUILD_MODNAME=KBUILD_STR\(vboxnetflt\) \
+	KBUILD_BASENAME=KBUILD_STR\(vboxnetflt\) \
+	MODULE DEBUG_HASH=2 DEBUG_HASH2=3
   vboxnetflt_DEFS          = IN_RT_R0
   vboxnetflt_DEPS.solaris += $(VBOX_SVN_REV_KMK)
   vboxnetflt_INCS.linux   := \
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c
index fd26e83..3c54dd6 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c
+++ b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -403,7 +403,7 @@ static bool vboxNetFltMaybeRediscovered(PVBOXNETFLTINS pThis)
     if (fDoIt)
         ASMAtomicWriteBool(&pThis->fRediscoveryPending, true);
 
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     /*
      * Call the OS specific code to do the job.
@@ -516,7 +516,7 @@ static DECLCALLBACK(INTNETTRUNKIFSTATE) vboxNetFltPortSetState(PINTNETTRUNKIFPOR
     enmOldTrunkState = pThis->enmTrunkState;
     if (enmOldTrunkState != enmState)
         ASMAtomicWriteU32((uint32_t volatile *)&pThis->enmTrunkState, enmState);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     /*
      * If the state change indicates that the trunk has become active or
@@ -621,7 +621,7 @@ static DECLCALLBACK(void) vboxNetFltPortDisconnectAndRelease(PINTNETTRUNKIFPORT
      */
     RTSpinlockAcquire(pThis->hSpinlock);
     vboxNetFltSetState(pThis, kVBoxNetFltInsState_Disconnecting);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     vboxNetFltOsDisconnectIt(pThis);
     pThis->pSwitchPort = NULL;
@@ -629,7 +629,7 @@ static DECLCALLBACK(void) vboxNetFltPortDisconnectAndRelease(PINTNETTRUNKIFPORT
 #ifdef VBOXNETFLT_STATIC_CONFIG
     RTSpinlockAcquire(pThis->hSpinlock);
     vboxNetFltSetState(pThis, kVBoxNetFltInsState_Unconnected);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 #endif
 
     vboxNetFltRelease(pThis, false /* fBusy */);
@@ -748,7 +748,7 @@ DECLHIDDEN(void) vboxNetFltRelease(PVBOXNETFLTINS pThis, bool fBusy)
 
 
 /**
- * @copydoc INTNETTRUNKIFPORT::pfnRetain
+ * @copydoc INTNETTRUNKIFPORT::pfnRelease
  */
 static DECLCALLBACK(void) vboxNetFltPortRelease(PINTNETTRUNKIFPORT pIfPort)
 {
@@ -758,6 +758,16 @@ static DECLCALLBACK(void) vboxNetFltPortRelease(PINTNETTRUNKIFPORT pIfPort)
 
 
 /**
+ * @callback_method_impl{FNINTNETTRUNKIFPORTRELEASEBUSY}
+ */
+DECLHIDDEN(DECLCALLBACK(void)) vboxNetFltPortReleaseBusy(PINTNETTRUNKIFPORT pIfPort)
+{
+    PVBOXNETFLTINS pThis = IFPORT_2_VBOXNETFLTINS(pIfPort);
+    vboxNetFltRelease(pThis, true /*fBusy*/);
+}
+
+
+/**
  * Retains a reference to the specified instance and a busy reference too.
  *
  * @param   pThis           The instance.
@@ -839,7 +849,7 @@ DECLHIDDEN(bool) vboxNetFltTryRetainBusyActive(PVBOXNETFLTINS pThis)
         cRefs = ASMAtomicIncU32(&pThis->cBusy);
         AssertMsg(cRefs >= 1 && cRefs < UINT32_MAX / 2, ("%d\n", cRefs)); NOREF(cRefs);
     }
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     return fRc;
 }
@@ -886,7 +896,7 @@ DECLHIDDEN(bool) vboxNetFltTryRetainBusyNotDisconnected(PVBOXNETFLTINS pThis)
         cRefs = ASMAtomicIncU32(&pThis->cBusy);
         AssertMsg(cRefs >= 1 && cRefs < UINT32_MAX / 2, ("%d\n", cRefs)); NOREF(cRefs);
     }
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     return fRc;
 }
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.rc b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.rc
index 410b408..e7e89ff 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.rc
+++ b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFlt.rc
@@ -17,32 +17,30 @@
 #include <windows.h>
 #include <VBox/version.h>
 
-#define DESCRIPTION_STR    "VirtualBox NDIS 6.0 Lightweight Filter Driver\0"
-#define FILENAME_STR       "VBoxNetLwf"
-
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        VS_FFI_FILEFLAGSMASK
-   FILEFLAGS            0x0L
-   FILEOS               VOS_NT_WINDOWS32
-   FILETYPE             VFT_DRV
-   FILESUBTYPE          VFT2_DRV_NETWORK
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DRV
+   FILESUBTYPE      VFT2_DRV_NETWORK
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
+         VALUE "FileDescription",  "VirtualBox NDIS 6.0 Lightweight Filter Driver\0"
+         VALUE "InternalName",     "VBoxNetLwf\0"
+         VALUE "OriginalFilename", "VBoxNetLwf.sys\0"
          VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-         VALUE "FileDescription",  DESCRIPTION_STR
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-         VALUE "InternalName",     FILENAME_STR "\0"
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
          VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-         VALUE "OriginalFilename", FILENAME_STR ".sys\0"
-         VALUE "ProductName",      VBOX_PRODUCT "\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h
index 6d35a32..eba8701 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h
+++ b/src/VBox/HostDrivers/VBoxNetFlt/VBoxNetFltInternal.h
@@ -153,6 +153,8 @@ typedef struct VBOXNETFLTINS
             bool volatile fSetPromiscuous;
             /** The MAC address of the interface. */
             RTMAC MacAddr;
+            /** PF_SYSTEM socket to listen for events (XXX: globals?) */
+            socket_t pSysSock;
             /** @} */
 # elif defined(RT_OS_LINUX)
             /** @name Linux instance data
@@ -170,7 +172,9 @@ typedef struct VBOXNETFLTINS
             bool volatile fPacketHandler;
             /** The MAC address of the interface. */
             RTMAC MacAddr;
-            struct notifier_block Notifier;
+            struct notifier_block Notifier; /* netdevice */
+            struct notifier_block NotifierIPv4;
+            struct notifier_block NotifierIPv6;
             struct packet_type    PacketType;
 #  ifndef VBOXNETFLT_LINUX_NO_XMIT_QUEUE
             struct sk_buff_head   XmitQueue;
@@ -329,6 +333,7 @@ DECLHIDDEN(int) vboxNetFltTryDeleteIdc(PVBOXNETFLTGLOBALS pGlobals);
 DECLHIDDEN(bool) vboxNetFltCanUnload(PVBOXNETFLTGLOBALS pGlobals);
 DECLHIDDEN(PVBOXNETFLTINS) vboxNetFltFindInstance(PVBOXNETFLTGLOBALS pGlobals, const char *pszName);
 
+DECLHIDDEN(DECLCALLBACK(void)) vboxNetFltPortReleaseBusy(PINTNETTRUNKIFPORT pIfPort);
 DECLHIDDEN(void) vboxNetFltRetain(PVBOXNETFLTINS pThis, bool fBusy);
 DECLHIDDEN(bool) vboxNetFltTryRetainBusyActive(PVBOXNETFLTINS pThis);
 DECLHIDDEN(bool) vboxNetFltTryRetainBusyNotDisconnected(PVBOXNETFLTINS pThis);
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp b/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
index be095dc..2ddecc9 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
+++ b/src/VBox/HostDrivers/VBoxNetFlt/darwin/VBoxNetFlt-darwin.cpp
@@ -51,6 +51,7 @@
 #include <sys/conf.h>
 #include <sys/errno.h>
 #include <sys/ioccom.h>
+#include <sys/filio.h>
 #include <sys/malloc.h>
 #include <sys/proc.h>
 #include <sys/socket.h>
@@ -61,7 +62,13 @@ RT_C_DECLS_BEGIN /* Buggy 10.4 headers, fixed in 10.5. */
 #include <sys/kpi_mbuf.h>
 #include <net/kpi_interfacefilter.h>
 RT_C_DECLS_END
+
+#include <sys/kpi_socket.h>
 #include <net/if.h>
+#include <net/if_var.h>
+#include <netinet/in.h>
+#include <netinet/in_var.h>
+#include <netinet6/in6_var.h>
 
 #define VBOXNETFLT_OS_SPECFIC 1
 #include "../VBoxNetFltInternal.h"
@@ -86,6 +93,8 @@ RT_C_DECLS_END
 RT_C_DECLS_BEGIN
 static kern_return_t    VBoxNetFltDarwinStart(struct kmod_info *pKModInfo, void *pvData);
 static kern_return_t    VBoxNetFltDarwinStop(struct kmod_info *pKModInfo, void *pvData);
+
+static void vboxNetFltDarwinSysSockUpcall(socket_t pSysSock, void *pvData, int fWait);
 RT_C_DECLS_END
 
 
@@ -318,7 +327,7 @@ DECLINLINE(ifnet_t) vboxNetFltDarwinRetainIfNet(PVBOXNETFLTINS pThis)
         if (pIfNet)
             ifnet_reference(pIfNet);
     }
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     return pIfNet;
 }
@@ -748,7 +757,7 @@ static void vboxNetFltDarwinIffDetached(void *pvThis, ifnet_t pIfNet)
     ASMAtomicUoWriteBool(&pThis->fRediscoveryPending, false);
     ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
 
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     if (pIfNet)
         ifnet_release(pIfNet);
@@ -1030,7 +1039,7 @@ static int vboxNetFltDarwinAttachToInterface(PVBOXNETFLTINS pThis, bool fRedisco
 
     RTSpinlockAcquire(pThis->hSpinlock);
     ASMAtomicUoWritePtr(&pThis->u.s.pIfNet, pIfNet);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     /* Adjust g_offIfNetPCount as it varies for different versions of xnu. */
     vboxNetFltDarwinDetectPCountOffset(pIfNet);
@@ -1068,7 +1077,7 @@ static int vboxNetFltDarwinAttachToInterface(PVBOXNETFLTINS pThis, bool fRedisco
             ASMAtomicUoWritePtr(&pThis->u.s.pIfFilter, pIfFilter);
             pIfNet = NULL; /* don't dereference it */
         }
-        RTSpinlockReleaseNoInts(pThis->hSpinlock);
+        RTSpinlockRelease(pThis->hSpinlock);
 
         /* Report capabilities. */
         if (   !pIfNet
@@ -1289,17 +1298,266 @@ void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis)
     pIfFilter = ASMAtomicUoReadPtrT(&pThis->u.s.pIfFilter, interface_filter_t);
     if (pIfFilter)
         ASMAtomicUoWriteNullPtr(&pThis->u.s.pIfFilter);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     if (pIfFilter)
         iflt_detach(pIfFilter);
+
+    if (pThis->u.s.pSysSock != NULL)
+    {
+        sock_close(pThis->u.s.pSysSock);
+        pThis->u.s.pSysSock = NULL;
+    }
 }
 
 
 int  vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext)
 {
     NOREF(pvContext);
-    return vboxNetFltDarwinAttachToInterface(pThis, false /* fRediscovery */);
+
+    int rc = vboxNetFltDarwinAttachToInterface(pThis, false /* fRediscovery */);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    if (pThis->pSwitchPort->pfnNotifyHostAddress == NULL)
+        return rc;
+
+    /*
+     * XXX: uwe
+     *
+     * Learn host's IP addresses and set up notifications for changes.
+     * To avoid racing, set up notifications first.
+     *
+     * XXX: This should probably be global, since the only thing
+     * specific to ifnet here is its IPv6 link-local address.
+     */
+    errno_t error;
+
+    error = sock_socket(PF_SYSTEM, SOCK_RAW, SYSPROTO_EVENT,
+                        vboxNetFltDarwinSysSockUpcall, pThis,
+                        &pThis->u.s.pSysSock);
+    if (error != 0)
+    {
+        LogRel(("sock_socket(SYSPROTO_EVENT): error %d\n", error));
+        return rc;
+    }
+
+    int nbio = 1;
+    error = sock_ioctl(pThis->u.s.pSysSock, FIONBIO, &nbio);
+    if (error != 0)
+    {
+        LogRel(("FIONBIO: error %d\n", error));
+        sock_close(pThis->u.s.pSysSock);
+        return rc;
+    }
+
+    if (!sock_isnonblocking(pThis->u.s.pSysSock))
+    {
+        LogRel(("FIONBIO ok, but socket is blocking?!\n"));
+        sock_close(pThis->u.s.pSysSock);
+        return rc;        
+    }
+
+    struct kev_request req;
+    req.vendor_code = KEV_VENDOR_APPLE;
+    req.kev_class = KEV_NETWORK_CLASS;
+    req.kev_subclass = KEV_ANY_SUBCLASS; /* need both INET and INET6, so have to request all */
+
+    error = sock_ioctl(pThis->u.s.pSysSock, SIOCSKEVFILT, &req);
+    if (error != 0)
+    {
+        LogRel(("SIOCSKEVFILT: error %d\n", error));
+        sock_close(pThis->u.s.pSysSock);
+        return rc;
+    }
+
+    ifnet_t pIfNet = pThis->u.s.pIfNet; /* already retained */
+
+    ifaddr_t *pIfAddrList;
+    error = ifnet_get_address_list(/* all interfaces*/ NULL, &pIfAddrList);
+    if (error != 0)
+    {
+        LogRel(("ifnet_get_address_list: error %d\n", error));
+        return rc;
+    }
+
+    for (ifaddr_t *pIfAddr = pIfAddrList; *pIfAddr != NULL; ++pIfAddr)
+    {
+        ifaddr_t ifa = *pIfAddr;
+        sa_family_t family = ifaddr_address_family(ifa);
+        struct sockaddr_storage ss;
+
+        error = ifaddr_address(ifa, (struct sockaddr *)&ss, sizeof(ss));
+        if (error != 0)
+        {
+            LogRel(("getting address family %d: error %d\n", family, error));
+            continue;
+        }
+
+        if (family == AF_INET)
+        {
+            struct sockaddr_in *sin = (struct sockaddr_in *)&ss;
+            u_int32_t u32Addr = ntohl(sin->sin_addr.s_addr);
+
+            if ((u32Addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
+                continue;
+
+            Log(("> inet %RTnaipv4\n", sin->sin_addr.s_addr));
+            pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
+                /* :fAdded */ true, kIntNetAddrType_IPv4, &sin->sin_addr);
+        }
+        else if (family == AF_INET6)
+        {
+            struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&ss;
+
+            if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
+                continue;
+
+            /* link-local from other interfaces are out of scope */
+            if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) && ifaddr_ifnet(ifa) != pIfNet)
+                continue;
+
+            Log(("> inet6 %RTnaipv6\n", &sin6->sin6_addr));
+            pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
+                /* :fAdded */ true, kIntNetAddrType_IPv6, &sin6->sin6_addr);
+        }
+    }
+
+    ifnet_free_address_list(pIfAddrList);
+
+    /*
+     * Now that we've got current addresses, check for events that
+     * might have happened while we were working.
+     */
+    vboxNetFltDarwinSysSockUpcall(pThis->u.s.pSysSock, pThis, MBUF_DONTWAIT);
+
+    return rc;
+}
+
+
+static void vboxNetFltDarwinSysSockUpcall(socket_t pSysSock, void *pvData, int fWait)
+{
+    PVBOXNETFLTINS pThis = (PVBOXNETFLTINS)pvData;
+    errno_t error;
+
+    NOREF(fWait);
+
+    if (RT_UNLIKELY(pSysSock != pThis->u.s.pSysSock))
+    {
+        Log(("vboxNetFltDarwinSysSockUpcall: %p != %p?\n",
+             pSysSock, pThis->u.s.pSysSock));
+        return;
+    }
+
+    for (;;) {
+        mbuf_t m;
+        size_t len = sizeof(struct kern_event_msg) - sizeof(u_int32_t)
+            + sizeof(struct kev_in6_data);
+
+        error = sock_receivembuf(pSysSock, NULL, &m, 0, &len);
+        if (error == EWOULDBLOCK)
+        {
+            Log(("vboxNetFltDarwinSysSockUpcall: EWOULDBLOCK - we are done\n"));
+            error = 0;
+            break;
+        }
+        else if (error != 0)
+        {
+            Log(("sock_receivembuf: error %d\n", error));
+            break;
+        }
+
+        if (len < sizeof(struct kern_event_msg) - sizeof(u_int32_t))
+        {
+            Log(("vboxNetFltDarwinSysSockUpcall: %u bytes is too short\n",
+                 (unsigned int)len));
+            mbuf_freem(m);
+            return;
+        }
+
+        struct kern_event_msg *msg = (struct kern_event_msg *)mbuf_data(m);
+        if (msg->kev_subclass == KEV_INET_SUBCLASS)
+        {
+            if (len - (sizeof(struct kern_event_msg) - sizeof(u_int32_t)) < sizeof(struct kev_in_data))
+            {
+                Log(("vboxNetFltDarwinSysSockUpcall: %u bytes is too short for KEV_INET_SUBCLASS\n",
+                     (unsigned int)len));
+                mbuf_freem(m);
+                return;
+            }
+
+            struct kev_in_data *iev = (struct kev_in_data *)msg->event_data;
+            PCRTNETADDRU pAddr = (PCRTNETADDRU)&iev->ia_addr;
+            switch (msg->event_code)
+            {
+                case KEV_INET_NEW_ADDR:
+                    Log(("KEV_INET_NEW_ADDR %RTnaipv4\n", pAddr->IPv4));
+                    pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
+                        /* :fAdded */ true, kIntNetAddrType_IPv4, pAddr);
+                    break;
+
+                case KEV_INET_ADDR_DELETED:
+                    Log(("KEV_INET_ADDR_DELETED %RTnaipv4\n", pAddr->IPv4));
+                    pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
+                        /* :fAdded */ false, kIntNetAddrType_IPv4, &iev->ia_addr);
+                    break;
+
+                default:
+                    Log(("KEV INET event %u addr %RTnaipv4\n", msg->event_code, pAddr->IPv4));
+                    break;
+            }
+        }
+        else if (msg->kev_subclass == KEV_INET6_SUBCLASS)
+        {
+            if (len - (sizeof(struct kern_event_msg) - sizeof(u_int32_t)) < sizeof(struct kev_in6_data))
+            {
+                Log(("vboxNetFltDarwinSysSockUpcall: %u bytes is too short for KEV_INET6_SUBCLASS\n",
+                        (unsigned int)len));
+                mbuf_freem(m);
+                return;
+            }
+
+            struct kev_in6_data *iev6 = (struct kev_in6_data *)msg->event_data;
+            PCRTNETADDRU pAddr = (PCRTNETADDRU)&iev6->ia_addr.sin6_addr;
+            switch (msg->event_code)
+            {
+                case KEV_INET6_NEW_USER_ADDR:
+                    Log(("KEV_INET6_NEW_USER_ADDR: %RTnaipv6\n", pAddr));
+                    goto kev_inet6_new;
+
+                case KEV_INET6_NEW_LL_ADDR:
+                    Log(("KEV_INET6_NEW_LL_ADDR: %RTnaipv6\n", pAddr));
+                    /* XXX: uwe: TODO: only interface we are attached to */
+                    goto kev_inet6_new;
+
+                case KEV_INET6_NEW_RTADV_ADDR:
+                    Log(("KEV_INET6_NEW_RTADV_ADDR: %RTnaipv6\n", pAddr));
+                    goto kev_inet6_new;
+
+                kev_inet6_new:
+                    pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
+                        /* :fAdded */ true, kIntNetAddrType_IPv6, pAddr);
+                    break;
+
+                case KEV_INET6_ADDR_DELETED:
+                    Log(("KEV_INET6_ADDR_DELETED: %RTnaipv6\n", pAddr));
+                    pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
+                        /* :fAdded */ false, kIntNetAddrType_IPv6, pAddr);
+                    break;
+
+                default:
+                    Log(("KEV INET6 event %u addr %RTnaipv6\n", msg->event_code, pAddr));
+                    break;
+            }
+        }
+        else
+        {
+            Log(("vboxNetFltDarwinSysSockUpcall: subclass %u ignored\n",
+                 (unsigned)msg->kev_subclass));
+        }
+
+        mbuf_freem(m);
+    }
 }
 
 
@@ -1313,6 +1571,7 @@ int  vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis)
     pThis->u.s.fSetPromiscuous = false;
     pThis->u.s.fNeedSetPromiscuous = false;
     //pThis->u.s.MacAddr = {0};
+    pThis->u.s.pSysSock = NULL;
 
     return VINF_SUCCESS;
 }
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c b/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
index 8bd3d08..d5b9912 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
+++ b/src/VBox/HostDrivers/VBoxNetFlt/freebsd/VBoxNetFlt-freebsd.c
@@ -608,7 +608,7 @@ int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext)
     mtx_init(&pThis->u.s.outq.ifq_mtx, "vboxnetflt outq", NULL, MTX_SPIN);
     TASK_INIT(&pThis->u.s.tskout, 0, vboxNetFltFreeBSDoutput, pThis);
 
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     NG_NODE_SET_PRIVATE(node, pThis);
 
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
index 18d4910..c2a51d2 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
+++ b/src/VBox/HostDrivers/VBoxNetFlt/linux/VBoxNetFlt-linux.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -27,8 +27,11 @@
 #include <linux/etherdevice.h>
 #include <linux/rtnetlink.h>
 #include <linux/miscdevice.h>
+#include <linux/inetdevice.h>
 #include <linux/ip.h>
 #include <linux/if_vlan.h>
+#include <net/if_inet6.h>
+#include <net/addrconf.h>
 
 #include <VBox/log.h>
 #include <VBox/err.h>
@@ -66,6 +69,18 @@
 # define VBOX_FLT_XT_TO_INST(pXT)   RT_FROM_MEMBER(pXT, VBOXNETFLTINS, u.s.XmitTask)
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34)
+# define VBOX_NETDEV_NAME(dev)              netdev_name(dev)
+#else
+# define VBOX_NETDEV_NAME(dev)              ((dev)->reg_state != NETREG_REGISTERED ? "(unregistered net_device)" : (dev)->name)
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
+# define VBOX_DEV_NET(dev)                  dev_net(dev)
+#else
+# define VBOX_DEV_NET(dev)                  ((dev)->nd_net)
+#endif
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
 # define VBOX_SKB_RESET_NETWORK_HDR(skb)    skb_reset_network_header(skb)
 # define VBOX_SKB_RESET_MAC_HDR(skb)        skb_reset_mac_header(skb)
@@ -410,7 +425,7 @@ static void vboxNetFltLinuxHookDev(PVBOXNETFLTINS pThis, struct net_device *pDev
 # if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
     ASMAtomicXchgPtr((void * volatile *)&pDev->hard_start_xmit, vboxNetFltLinuxStartXmitFilter);
 # endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) */
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 }
 
 /**
@@ -446,7 +461,7 @@ static void vboxNetFltLinuxUnhookDev(PVBOXNETFLTINS pThis, struct net_device *pD
     }
     else
         pOverride = NULL;
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     if (pOverride)
     {
@@ -1469,7 +1484,7 @@ static void vboxNetFltLinuxReportNicGsoCapabilities(PVBOXNETFLTINS pThis)
         else
             fFeatures = 0;
 
-        RTSpinlockReleaseNoInts(pThis->hSpinlock);
+        RTSpinlockRelease(pThis->hSpinlock);
 
         if (pThis->pSwitchPort)
         {
@@ -1583,7 +1598,7 @@ static int vboxNetFltLinuxAttachToInterface(PVBOXNETFLTINS pThis, struct net_dev
 
     RTSpinlockAcquire(pThis->hSpinlock);
     ASMAtomicUoWritePtr(&pThis->u.s.pDev, pDev);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) retained. ref=%d\n",
           pDev, pDev->name,
@@ -1633,7 +1648,7 @@ static int vboxNetFltLinuxAttachToInterface(PVBOXNETFLTINS pThis, struct net_dev
         ASMAtomicUoWriteBool(&pThis->u.s.fRegistered, true);
         pDev = NULL; /* don't dereference it */
     }
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     /*
      * If the above succeeded report GSO capabilities,  if not undo and
@@ -1658,7 +1673,7 @@ static int vboxNetFltLinuxAttachToInterface(PVBOXNETFLTINS pThis, struct net_dev
 #endif
         RTSpinlockAcquire(pThis->hSpinlock);
         ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev);
-        RTSpinlockReleaseNoInts(pThis->hSpinlock);
+        RTSpinlockRelease(pThis->hSpinlock);
         dev_put(pDev);
         Log(("vboxNetFltLinuxAttachToInterface: Device %p(%s) released. ref=%d\n",
              pDev, pDev->name,
@@ -1697,7 +1712,7 @@ static int vboxNetFltLinuxUnregisterDevice(PVBOXNETFLTINS pThis, struct net_devi
         ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
         ASMAtomicUoWriteNullPtr(&pThis->u.s.pDev);
     }
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     if (fRegistered)
     {
@@ -1856,6 +1871,76 @@ static int vboxNetFltLinuxNotifierCallback(struct notifier_block *self, unsigned
     return rc;
 }
 
+#if 0 /* XXX: temporarily disable */
+static int vboxNetFltLinuxNotifierIPv4Callback(struct notifier_block *self, unsigned long ulEventType, void *ptr)
+{
+    PVBOXNETFLTINS     pThis = RT_FROM_MEMBER(self, VBOXNETFLTINS, u.s.NotifierIPv4);
+    struct net_device *pDev;
+    struct in_ifaddr  *ifa   = (struct in_ifaddr *)ptr;
+    int                rc    = NOTIFY_OK;
+
+    pDev = vboxNetFltLinuxRetainNetDev(pThis);
+    Log(("VBoxNetFlt: %s: IPv4 event %s(0x%lx): addr %RTnaipv4 mask %RTnaipv4\n",
+         pDev ? VBOX_NETDEV_NAME(pDev) : "<???>",
+         vboxNetFltLinuxGetNetDevEventName(ulEventType), ulEventType,
+         ifa->ifa_address, ifa->ifa_mask));
+
+    if (pDev != NULL)
+        vboxNetFltLinuxReleaseNetDev(pThis, pDev);
+
+    if (pThis->pSwitchPort->pfnNotifyHostAddress)
+    {
+        bool fAdded;
+        if (ulEventType == NETDEV_UP)
+            fAdded = true;
+        else if (ulEventType == NETDEV_DOWN)
+            fAdded = false;
+        else
+            return NOTIFY_OK;
+            
+        pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, fAdded,
+                                                 kIntNetAddrType_IPv4, &ifa->ifa_local);
+    }
+
+    return rc;
+}
+
+
+static int vboxNetFltLinuxNotifierIPv6Callback(struct notifier_block *self, unsigned long ulEventType, void *ptr)
+{
+    PVBOXNETFLTINS       pThis = RT_FROM_MEMBER(self, VBOXNETFLTINS, u.s.NotifierIPv6);
+    struct net_device   *pDev;
+    struct inet6_ifaddr *ifa   = (struct inet6_ifaddr *)ptr;
+    int                  rc    = NOTIFY_OK;
+
+    pDev = vboxNetFltLinuxRetainNetDev(pThis);
+    Log(("VBoxNetFlt: %s: IPv6 event %s(0x%lx): %RTnaipv6\n",
+         pDev ? VBOX_NETDEV_NAME(pDev) : "<???>",
+         vboxNetFltLinuxGetNetDevEventName(ulEventType), ulEventType,
+         &ifa->addr));
+
+    if (pDev != NULL)
+        vboxNetFltLinuxReleaseNetDev(pThis, pDev);
+
+    if (pThis->pSwitchPort->pfnNotifyHostAddress)
+    {
+        bool fAdded;
+        if (ulEventType == NETDEV_UP)
+            fAdded = true;
+        else if (ulEventType == NETDEV_DOWN)
+            fAdded = false;
+        else
+            return NOTIFY_OK;
+            
+        pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort, fAdded,
+                                                 kIntNetAddrType_IPv6, &ifa->addr);
+    }
+
+    return rc;
+}
+#endif /* 0 */
+
+
 bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThis)
 {
     return !ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost);
@@ -2032,7 +2117,7 @@ void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis)
     RTSpinlockAcquire(pThis->hSpinlock);
     pDev = ASMAtomicUoReadPtrT(&pThis->u.s.pDev, struct net_device *);
     fRegistered = ASMAtomicXchgBool(&pThis->u.s.fRegistered, false);
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 
     if (fRegistered)
     {
@@ -2052,6 +2137,10 @@ void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis)
              ));
         dev_put(pDev);
     }
+
+    unregister_inet6addr_notifier(&pThis->u.s.NotifierIPv6);
+    unregister_inetaddr_notifier(&pThis->u.s.NotifierIPv4);
+
     Log(("vboxNetFltOsDeleteInstance: this=%p: Notifier removed.\n", pThis));
     unregister_netdevice_notifier(&pThis->u.s.Notifier);
     module_put(THIS_MODULE);
@@ -2079,6 +2168,96 @@ int  vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext)
         || !try_module_get(THIS_MODULE))
         return VERR_INTNET_FLT_IF_FAILED;
 
+#if 0 /* XXX: temporarily disable */
+    if (pThis->pSwitchPort->pfnNotifyHostAddress)
+    {
+        struct net *net = VBOX_DEV_NET(pThis->u.s.pDev);
+        struct net_device *dev;
+
+#if !defined(for_each_netdev_rcu) /* introduced in 2.6.33 */
+        read_lock(&dev_base_lock);
+#endif
+        rcu_read_lock();
+
+#if !defined(for_each_netdev_rcu)
+        for_each_netdev(net, dev)
+#else
+        for_each_netdev_rcu(net, dev)
+#endif
+        {
+            struct in_device *in_dev;
+            struct inet6_dev *in6_dev;
+
+            /*
+             * IPv4
+             */
+            in_dev = __in_dev_get_rcu(dev);
+            if (in_dev != NULL)
+            {
+                for_ifa(in_dev) {
+                    if (ifa->ifa_address == htonl(INADDR_LOOPBACK))
+                        goto continue_netdev;
+
+                    Log(("%s: %s: IPv4: addr %RTnaipv4 mask %RTnaipv4\n",
+                         __FUNCTION__, VBOX_NETDEV_NAME(dev),
+                         ifa->ifa_address, ifa->ifa_mask));
+
+                    pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
+                        /* :fAdded */ true, kIntNetAddrType_IPv4, &ifa->ifa_address);
+                } endfor_ifa(in_dev);
+            }
+
+            /*
+             * IPv6
+             */
+            in6_dev = __in6_dev_get(dev);
+            if (in6_dev != NULL)
+            {
+                struct inet6_ifaddr *ifa;
+
+                read_lock_bh(&in6_dev->lock);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)
+                list_for_each_entry(ifa, &in6_dev->addr_list, if_list)
+#else
+                for (ifa = in6_dev->addr_list; ifa != NULL; ifa = ifa->if_next)
+#endif
+                {
+                    Log(("%s: %s: IPv6: addr %RTnaipv6/%u\n",
+                         __FUNCTION__, VBOX_NETDEV_NAME(dev),
+                         &ifa->addr, (unsigned)ifa->prefix_len));
+
+                    pThis->pSwitchPort->pfnNotifyHostAddress(pThis->pSwitchPort,
+                        /* :fAdded */ true, kIntNetAddrType_IPv6, &ifa->addr);
+                }
+                read_unlock_bh(&in6_dev->lock);
+            }
+
+          continue_netdev:
+            /* continue */;
+        }
+        rcu_read_unlock();
+#if !defined(for_each_netdev_rcu)
+        read_unlock(&dev_base_lock);
+#endif
+
+        Log(("%s: pfnNotifyHostAddress is set, register notifiers\n", __FUNCTION__));
+
+        pThis->u.s.NotifierIPv4.notifier_call = vboxNetFltLinuxNotifierIPv4Callback;
+        err = register_inetaddr_notifier(&pThis->u.s.NotifierIPv4);
+        if (err)
+            LogRel(("%s: failed to register IPv4 notifier: error %d\n",
+                    __FUNCTION__, err));
+
+        pThis->u.s.NotifierIPv6.notifier_call = vboxNetFltLinuxNotifierIPv6Callback;
+        err = register_inet6addr_notifier(&pThis->u.s.NotifierIPv6);
+        if (err)
+            LogRel(("%s: failed to register IPv6 notifier: error %d\n",
+                    __FUNCTION__, err));
+    }
+    else
+        Log(("%s: uwe: pfnNotifyHostAddress is NULL\n", __FUNCTION__));
+#endif
+
     return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c b/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
index a69be96..3815d56 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
+++ b/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -127,6 +127,7 @@ typedef struct VLANHEADER *PVLANHEADER;
 static int VBoxNetFltSolarisGetInfo(dev_info_t *pDip, ddi_info_cmd_t enmCmd, void *pArg, void **ppResult);
 static int VBoxNetFltSolarisAttach(dev_info_t *pDip, ddi_attach_cmd_t enmCmd);
 static int VBoxNetFltSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd);
+static int VBoxNetFltSolarisQuiesceNotNeeded(dev_info_t *pDip);
 
 /**
  * Stream Module hooks.
@@ -230,7 +231,8 @@ static struct dev_ops g_VBoxNetFltSolarisDevOps =
     nodev,                          /* reset */
     &g_VBoxNetFltSolarisCbOps,
     (struct bus_ops *)0,
-    nodev                           /* power */
+    nodev,                          /* power */
+    VBoxNetFltSolarisQuiesceNotNeeded
 };
 
 /**
@@ -693,6 +695,20 @@ static int VBoxNetFltSolarisDetach(dev_info_t *pDip, ddi_detach_cmd_t enmCmd)
 
 
 /**
+ * Quiesce not-needed entry point, as Solaris 10 doesn't have any
+ * ddi_quiesce_not_needed() function.
+ *
+ * @param   pDip            The module structure instance.
+ *
+ * @return  corresponding solaris error code.
+ */
+static int VBoxNetFltSolarisQuiesceNotNeeded(dev_info_t *pDip)
+{
+    return DDI_SUCCESS;
+}
+
+
+/**
  * Info entry point, called by solaris kernel for obtaining driver info.
  *
  * @param   pDip            The module structure instance (do not use).
@@ -1093,7 +1109,7 @@ static int VBoxNetFltSolarisModReadPut(queue_t *pQueue, mblk_t *pMsg)
             RTSpinlockAcquire(pThis->hSpinlock);
             const bool fActive = pThis->enmTrunkState == INTNETTRUNKIFSTATE_ACTIVE;
             vboxNetFltRetain(pThis, true /* fBusy */);
-            RTSpinlockReleaseNoInts(pThis->hSpinlock);
+            RTSpinlockRelease(pThis->hSpinlock);
 
             vboxnetflt_promisc_stream_t *pPromiscStream = (vboxnetflt_promisc_stream_t *)pStream;
 
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c b/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c
index ccb1b87..66abacf 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c
+++ b/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c
@@ -81,7 +81,7 @@
  *  @todo move this define into a common header. */
 #define VBOXBOW_VNIC_NAME               "vboxvnic"
 /** The VirtualBox VNIC template name (hardcoded in NetIf-solaris.cpp).
- *   *  @todo move this define into a common header. */
+ *  @todo move this define into a common header. */
 #define VBOXBOW_VNIC_TEMPLATE_NAME      "vboxvnic_template"
 /** Debugging switch for using symbols in kmdb */
 # define LOCAL                          static
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
index 7d5c3d0..68c09ae 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp
@@ -239,20 +239,16 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinGetComponentByGuid(IN INetCfg *pNc,
 
 static HRESULT vboxNetCfgWinQueryInstaller(IN INetCfg *pNetCfg, IN const GUID *pguidClass, INetCfgClassSetup **ppSetup)
 {
-    NonStandardLogFlow(("vboxNetCfgWinQueryInstaller: enter \n"));
     HRESULT hr = pNetCfg->QueryNetCfgClass(pguidClass, IID_INetCfgClassSetup, (void**)ppSetup);
     if (FAILED(hr))
         NonStandardLogFlow(("QueryNetCfgClass failed, hr (0x%x)\n", hr));
-    NonStandardLogFlow(("vboxNetCfgWinQueryInstaller: leave \n"));
     return hr;
 }
 
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinInstallComponent(IN INetCfg *pNetCfg, IN LPCWSTR pszwComponentId, IN const GUID *pguidClass,
                                                           OUT INetCfgComponent **ppComponent)
 {
-    NonStandardLogFlow(("VBoxNetCfgWinInstallComponent: enter \n"));
     INetCfgClassSetup *pSetup;
-
     HRESULT hr = vboxNetCfgWinQueryInstaller(pNetCfg, pguidClass, &pSetup);
     if (FAILED(hr))
     {
@@ -282,8 +278,6 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinInstallComponent(IN INetCfg *pNetCfg, I
         NonStandardLogFlow(("Install failed, hr (0x%x)\n", hr));
 
     pSetup->Release();
-
-    NonStandardLogFlow(("VBoxNetCfgWinInstallComponent: leave \n"));
     return hr;
 }
 
@@ -291,7 +285,6 @@ static HRESULT vboxNetCfgWinInstallInfAndComponent(IN INetCfg *pNetCfg, IN LPCWS
                                                    IN LPCWSTR const *apInfPaths, IN UINT cInfPaths,
                                                    OUT INetCfgComponent **ppComponent)
 {
-    NonStandardLogFlow(("vboxNetCfgWinInstallInfAndComponent: enter \n"));
     HRESULT hr = S_OK;
     UINT cFilesProcessed = 0;
 
@@ -306,7 +299,6 @@ static HRESULT vboxNetCfgWinInstallInfAndComponent(IN INetCfg *pNetCfg, IN LPCWS
             NonStandardLogFlow(("VBoxNetCfgWinInfInstall failed, hr (0x%x)\n", hr));
             break;
         }
-        NonStandardLogFlow(("Installing INF file \"%ws\" has been done \n", apInfPaths[cFilesProcessed]));
     }
 
     if (SUCCEEDED(hr))
@@ -333,7 +325,6 @@ static HRESULT vboxNetCfgWinInstallInfAndComponent(IN INetCfg *pNetCfg, IN LPCWS
         NonStandardLogFlow(("Rollback complete\n"));
     }
 
-    NonStandardLogFlow(("vboxNetCfgWinInstallInfAndComponent: leave \n"));
     return hr;
 }
 
@@ -695,6 +686,7 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinEnumNetDevices(LPCWSTR pwszPnPId,
             if (cCurId >= cPnPId)
             {
                 NonStandardLogFlow(("!wcsnicmp(pCurId = (%S), pwszPnPId = (%S), cPnPId = (%d))", pCurId, pwszPnPId, cPnPId));
+
                 pCurId += cCurId - cPnPId;
                 if (!wcsnicmp(pCurId, pwszPnPId, cPnPId))
                 {
@@ -735,6 +727,7 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinPropChangeAllNetDevicesOfId(IN LPCWSTR
     Pc.enmPcType = enmPcType;
     Pc.hr = S_OK;
     NonStandardLogFlow(("Calling VBoxNetCfgWinEnumNetDevices with lpszPnPId =(%S) and vboxNetCfgWinPropChangeAllNetDevicesOfIdCallback", lpszPnPId));
+
     HRESULT hr = VBoxNetCfgWinEnumNetDevices(lpszPnPId, vboxNetCfgWinPropChangeAllNetDevicesOfIdCallback, &Pc);
     if (!SUCCEEDED(hr))
     {
@@ -2065,7 +2058,7 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltUninstall(IN INetCfg *pNc)
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltInstall(IN INetCfg *pNc,
                                                        IN LPCWSTR const *apInfFullPaths, IN UINT cInfFullPaths)
 {
-    HRESULT hr = S_OK;
+    HRESULT hr = vboxNetCfgWinNetFltUninstall(pNc, SUOI_FORCEDELETE);
     if (SUCCEEDED(hr))
     {
         NonStandardLog("NetFlt will be installed ...\n");
@@ -2079,19 +2072,70 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetFltInstall(IN INetCfg *pNc,
 }
 
 #define VBOXNETCFGWIN_NETADP_ID L"sun_VBoxNetAdp"
-static HRESULT vboxNetCfgWinNetAdpUninstall(IN INetCfg *pNc, DWORD InfRmFlags)
+static HRESULT vboxNetCfgWinNetAdpUninstall(IN INetCfg *pNc, LPCWSTR pwszId, DWORD InfRmFlags)
 {
     HRESULT hr = S_OK;
     NonStandardLog("Finding NetAdp driver package and trying to uninstall it ...\n");
 
-    VBoxDrvCfgInfUninstallAllF(L"Net", VBOXNETCFGWIN_NETADP_ID, InfRmFlags);
-    NonStandardLog("NetAdp driver package has been uninstalled \n");
+    VBoxDrvCfgInfUninstallAllF(L"Net", pwszId, InfRmFlags);
+    NonStandardLog("NetAdp is not installed currently\n");
+    return hr;
+}
+
+VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetAdpUninstall(IN INetCfg *pNc, IN LPCWSTR pwszId)
+{
+    return vboxNetCfgWinNetAdpUninstall(pNc, pwszId, SUOI_FORCEDELETE);
+}
+
+#define VBOXNETCFGWIN_NETLWF_ID    L"oracle_VBoxNetLwf"
+
+static HRESULT vboxNetCfgWinNetLwfUninstall(IN INetCfg *pNc, DWORD InfRmFlags)
+{
+    INetCfgComponent * pNcc = NULL;
+    HRESULT hr = pNc->FindComponent(VBOXNETCFGWIN_NETLWF_ID, &pNcc);
+    if (hr == S_OK)
+    {
+        NonStandardLog("NetLwf is installed currently, uninstalling ...\n");
+
+        hr = VBoxNetCfgWinUninstallComponent(pNc, pNcc);
+
+        pNcc->Release();
+    }
+    else if (hr == S_FALSE)
+    {
+        NonStandardLog("NetLwf is not installed currently\n");
+        hr = S_OK;
+    }
+    else
+    {
+        NonStandardLogFlow(("FindComponent failed, hr (0x%x)\n", hr));
+        hr = S_OK;
+    }
+
+    VBoxDrvCfgInfUninstallAllF(L"NetService", VBOXNETCFGWIN_NETLWF_ID, InfRmFlags);
+
     return hr;
 }
 
-VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetAdpUninstall(IN INetCfg *pNc)
+VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetLwfUninstall(IN INetCfg *pNc)
 {
-    return vboxNetCfgWinNetAdpUninstall(pNc, SUOI_FORCEDELETE);
+    return vboxNetCfgWinNetLwfUninstall(pNc, 0);
+}
+
+VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinNetLwfInstall(IN INetCfg *pNc,
+                                                       IN LPCWSTR const pInfFullPath)
+{
+    HRESULT hr = vboxNetCfgWinNetLwfUninstall(pNc, SUOI_FORCEDELETE);
+    if (SUCCEEDED(hr))
+    {
+        NonStandardLog("NetLwf will be installed ...\n");
+        hr = vboxNetCfgWinInstallInfAndComponent(pNc, VBOXNETCFGWIN_NETLWF_ID,
+                                                 &GUID_DEVCLASS_NETSERVICE,
+                                                 &pInfFullPath,
+                                                 1,
+                                                 NULL);
+    }
+    return hr;
 }
 
 #define VBOX_CONNECTION_NAME L"VirtualBox Host-Only Network"
@@ -2576,9 +2620,9 @@ VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinRemoveHostOnlyNetworkInterface(IN const
     return hrc;
 }
 
-VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinUpdateHostOnlyNetworkInterface(LPCWSTR pcsxwInf, BOOL *pbRebootRequired)
+VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinUpdateHostOnlyNetworkInterface(LPCWSTR pcsxwInf, BOOL *pbRebootRequired, LPCWSTR pcsxwId)
 {
-    return VBoxDrvCfgDrvUpdate(DRIVERHWID, pcsxwInf, pbRebootRequired);
+    return VBoxDrvCfgDrvUpdate(pcsxwId, pcsxwInf, pbRebootRequired);
 }
 
 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinCreateHostOnlyNetworkInterface(IN LPCWSTR pInfPath, IN bool bIsInfPathFile,
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFlt-win.rc b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFlt-win.rc
index 589da16..0343c2d 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFlt-win.rc
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFlt-win.rc
@@ -28,12 +28,12 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DRV
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DRV
   FILESUBTYPE      VFT2_DRV_NETWORK
 BEGIN
   BLOCK "StringFileInfo"
@@ -42,12 +42,13 @@ BEGIN
     BEGIN
       VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  DESCRIPTION_STR
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
       VALUE "InternalName",     FILENAME_STR "\0"
       VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", FILENAME_STR ".sys\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltM-win.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltM-win.cpp
index 91936f5..8dd5989 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltM-win.cpp
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltM-win.cpp
@@ -4,7 +4,7 @@
  * Miniport edge
  */
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -142,7 +142,7 @@ DECLHIDDEN(NDIS_STATUS) vboxNetFltWinMpDoDeinitialization(PVBOXNETFLTINS pNetFlt
 
     vboxNetFltWinSetOpState(&pNetFlt->u.s.WinIf.MpState, kVBoxNetDevOpState_Deinitializing);
 
-    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+    RTSpinlockRelease(pNetFlt->hSpinlock);
 
     vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.MpState);
 
@@ -517,7 +517,7 @@ static UINT vboxNetFltWinMpRequestStatePrep(PVBOXNETFLTINS pNetFlt, NDIS_STATUS
     if (vboxNetFltWinGetOpState(&pNetFlt->u.s.WinIf.PtState) > kVBoxNetDevOpState_Initialized /* protocol unbind in progress */
             || vboxNetFltWinGetPowerState(&pNetFlt->u.s.WinIf.MpState) > NdisDeviceStateD0)
     {
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         *pStatus = NDIS_STATUS_FAILURE;
         return 0;
     }
@@ -526,21 +526,21 @@ static UINT vboxNetFltWinMpRequestStatePrep(PVBOXNETFLTINS pNetFlt, NDIS_STATUS
             && !pNetFlt->u.s.WinIf.StateFlags.fStandBy)
     {
         pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS | VBOXNDISREQUEST_QUEUED;
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         *pStatus = NDIS_STATUS_PENDING;
         return VBOXNDISREQUEST_INPROGRESS | VBOXNDISREQUEST_QUEUED;
     }
 
     if (pNetFlt->u.s.WinIf.StateFlags.fStandBy)
     {
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         *pStatus = NDIS_STATUS_FAILURE;
         return 0;
     }
 
     pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
 
-    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+    RTSpinlockRelease(pNetFlt->hSpinlock);
 
     *pStatus = NDIS_STATUS_SUCCESS;
     return VBOXNDISREQUEST_INPROGRESS;
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltP-win.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltP-win.cpp
index 3fea0a3..5f0e560 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltP-win.cpp
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltP-win.cpp
@@ -4,7 +4,7 @@
  * Protocol edge
  */
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -175,12 +175,12 @@ static void vboxNetFltWinPtRequestsWaitComplete(PVBOXNETFLTINS pNetFlt)
     {
         /* mark the request as InProgress before posting it to RequestComplete */
         pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         vboxNetFltWinPtRequestComplete(pNetFlt, &pNetFlt->u.s.WinIf.PassDownRequest, NDIS_STATUS_FAILURE);
     }
     else
     {
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
     }
 }
 
@@ -208,7 +208,7 @@ DECLHIDDEN(NDIS_STATUS) vboxNetFltWinPtDoUnbinding(PVBOXNETFLTINS pNetFlt, bool
         vboxNetFltWinSetOpState(&pNetFlt->u.s.WinIf.MpState, kVBoxNetDevOpState_Deinitializing);
     }
 
-    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+    RTSpinlockRelease(pNetFlt->hSpinlock);
 
     vboxNetFltWinPtRequestsWaitComplete(pNetFlt);
 
@@ -1400,19 +1400,19 @@ DECLHIDDEN(bool) vboxNetFltWinPtCloseInterface(PVBOXNETFLTINS pNetFlt, PNDIS_STA
 
     if (pNetFlt->u.s.WinIf.StateFlags.fInterfaceClosing)
     {
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         Assert(0);
         return false;
     }
     if (pNetFlt->u.s.WinIf.hBinding == NULL)
     {
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         Assert(0);
         return false;
     }
 
     pNetFlt->u.s.WinIf.StateFlags.fInterfaceClosing = TRUE;
-    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+    RTSpinlockRelease(pNetFlt->hSpinlock);
 
     NdisResetEvent(&pNetFlt->u.s.WinIf.OpenCloseEvent);
     NdisCloseAdapter(pStatus, pNetFlt->u.s.WinIf.hBinding);
@@ -1443,7 +1443,7 @@ static NDIS_STATUS vboxNetFltWinPtPnPSetPower(PVBOXNETFLTINS pNetFlt, NDIS_DEVIC
         {
             pNetFlt->u.s.WinIf.StateFlags.fStandBy = TRUE;
         }
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         vboxNetFltWinPtRequestsWaitComplete(pNetFlt);
         vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.MpState);
         vboxNetFltWinWaitDereference(&pNetFlt->u.s.WinIf.PtState);
@@ -1468,13 +1468,13 @@ static NDIS_STATUS vboxNetFltWinPtPnPSetPower(PVBOXNETFLTINS pNetFlt, NDIS_DEVIC
         if (pNetFlt->u.s.WinIf.StateFlags.fRequestInfo & VBOXNDISREQUEST_QUEUED)
         {
             pNetFlt->u.s.WinIf.StateFlags.fRequestInfo = VBOXNDISREQUEST_INPROGRESS;
-            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+            RTSpinlockRelease(pNetFlt->hSpinlock);
 
             vboxNetFltWinMpRequestPost(pNetFlt);
         }
         else
         {
-            RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+            RTSpinlockRelease(pNetFlt->hSpinlock);
         }
     }
 
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp
index 5aa2e7d..88753ec 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp
@@ -4,7 +4,7 @@
  * NetFlt Runtime
  */
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -1068,7 +1068,7 @@ DECLHIDDEN(void) vboxNetFltWinQuFiniPacketQueue(PVBOXNETFLTINS pInstance)
     {
         pSG = pWorker->pSG;
         pWorker->pSG = NULL;
-        RTSpinlockReleaseNoInts((pInstance)->hSpinlock);
+        RTSpinlockRelease((pInstance)->hSpinlock);
         KeSetEvent(&pWorker->KillEvent, 0, FALSE);
 
         KeWaitForSingleObject(pWorker->pThread, Executive,
@@ -1082,7 +1082,7 @@ DECLHIDDEN(void) vboxNetFltWinQuFiniPacketQueue(PVBOXNETFLTINS pInstance)
     }
     else
     {
-        RTSpinlockReleaseNoInts((pInstance)->hSpinlock);
+        RTSpinlockRelease((pInstance)->hSpinlock);
     }
 }
 
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.h b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.h
index 7d02493..7e6ca0c 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.h
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.h
@@ -4,7 +4,7 @@
  * NetFlt Runtime API
  */
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -395,17 +395,17 @@ extern RTMAC g_vboxNetFltWinVerifyMACGuest;
     do { \
         Assert(!vboxNetFltWinCheckMACs(_p, NULL, &g_vboxNetFltWinVerifyMACGuest)); \
         Assert(!vboxNetFltWinCheckMACs(_p, NULL, &(_pnf)->u.s.MacAddr)); \
-    } while(0)
+    } while (0)
 
 # define VBOXNETFLT_LBVERIFYSG(_pnf, _p) \
     do { \
         Assert(!vboxNetFltWinCheckMACsSG(_p, NULL, &g_vboxNetFltWinVerifyMACGuest)); \
         Assert(!vboxNetFltWinCheckMACsSG(_p, NULL, &(_pnf)->u.s.MacAddr)); \
-    } while(0)
+    } while (0)
 
 #else
-# define VBOXNETFLT_LBVERIFY(_pnf, _p) do{}while(0)
-# define VBOXNETFLT_LBVERIFYSG(_pnf, _p) do{}while(0)
+# define VBOXNETFLT_LBVERIFY(_pnf, _p) do { } while (0)
+# define VBOXNETFLT_LBVERIFYSG(_pnf, _p) do { } while (0)
 #endif
 
 /** initializes the list */
@@ -420,14 +420,14 @@ extern RTMAC g_vboxNetFltWinVerifyMACGuest;
     do { \
         INIT_SINGLE_LIST(&(_pList)->List); \
         NdisAllocateSpinLock(&(_pList)->Lock); \
-    } while(0)
+    } while (0)
 
 /** delete the packet queue */
 #define FINI_INTERLOCKED_SINGLE_LIST(_pList) \
     do { \
         Assert(vboxNetFltWinSListIsEmpty(&(_pList)->List)); \
         NdisFreeSpinLock(&(_pList)->Lock) \
-    } while(0)
+    } while (0)
 
 
 /**************************************************************************
@@ -593,7 +593,7 @@ DECLINLINE(bool) vboxNetFltWinReferenceWinIfNetFlt(PVBOXNETFLTINS pNetFlt, bool
     if(!vboxNetFltWinDoReferenceDevice(&pNetFlt->u.s.WinIf.MpState))
 #endif
     {
-        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
+        RTSpinlockRelease((pNetFlt)->hSpinlock);
         *pbNetFltActive = false;
         return false;
     }
@@ -601,14 +601,14 @@ DECLINLINE(bool) vboxNetFltWinReferenceWinIfNetFlt(PVBOXNETFLTINS pNetFlt, bool
     if(pNetFlt->enmTrunkState != INTNETTRUNKIFSTATE_ACTIVE)
     {
         vboxNetFltWinReferenceModePassThru(pNetFlt);
-        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
+        RTSpinlockRelease((pNetFlt)->hSpinlock);
         *pbNetFltActive = false;
         return true;
     }
 
     vboxNetFltRetain((pNetFlt), true /* fBusy */);
     vboxNetFltWinReferenceModeNetFlt(pNetFlt);
-    RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
+    RTSpinlockRelease((pNetFlt)->hSpinlock);
 
     *pbNetFltActive = true;
     return true;
@@ -632,7 +632,7 @@ DECLINLINE(bool) vboxNetFltWinIncReferenceWinIfNetFlt(PVBOXNETFLTINS pNetFlt, ui
     if(!vboxNetFltWinDoIncReferenceDevice(&pNetFlt->u.s.WinIf.MpState, v))
 #endif
     {
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         *pbNetFltActive = false;
         return false;
     }
@@ -641,7 +641,7 @@ DECLINLINE(bool) vboxNetFltWinIncReferenceWinIfNetFlt(PVBOXNETFLTINS pNetFlt, ui
     {
         vboxNetFltWinIncReferenceModePassThru(pNetFlt, v);
 
-        RTSpinlockReleaseNoInts((pNetFlt)->hSpinlock);
+        RTSpinlockRelease((pNetFlt)->hSpinlock);
         *pbNetFltActive = false;
         return true;
     }
@@ -650,7 +650,7 @@ DECLINLINE(bool) vboxNetFltWinIncReferenceWinIfNetFlt(PVBOXNETFLTINS pNetFlt, ui
 
     vboxNetFltWinIncReferenceModeNetFlt(pNetFlt, v);
 
-    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+    RTSpinlockRelease(pNetFlt->hSpinlock);
 
     /* we have marked it as busy, so can do the res references outside the lock */
     for(i = 0; i < v-1; i++)
@@ -714,11 +714,11 @@ DECLINLINE(bool) vboxNetFltWinIncReferenceWinIf(PVBOXNETFLTINS pNetFlt, uint32_t
     if(vboxNetFltWinDoIncReferenceDevices(&pNetFlt->u.s.WinIf.MpState, &pNetFlt->u.s.WinIf.PtState, v))
 #endif
     {
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         return true;
     }
 
-    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+    RTSpinlockRelease(pNetFlt->hSpinlock);
     return false;
 }
 
@@ -731,11 +731,11 @@ DECLINLINE(bool) vboxNetFltWinReferenceWinIf(PVBOXNETFLTINS pNetFlt)
     if(vboxNetFltWinDoReferenceDevices(&pNetFlt->u.s.WinIf.MpState, &pNetFlt->u.s.WinIf.PtState))
 #endif
     {
-        RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+        RTSpinlockRelease(pNetFlt->hSpinlock);
         return true;
     }
 
-    RTSpinlockReleaseNoInts(pNetFlt->hSpinlock);
+    RTSpinlockRelease(pNetFlt->hSpinlock);
     return false;
 }
 
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.cpp
new file mode 100644
index 0000000..f7ac91e
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.cpp
@@ -0,0 +1,748 @@
+/* $Id: VBoxNetAdp-win.cpp $ */
+/** @file
+ * VBoxNetAdp-win.cpp - NDIS6 Host-only Networking Driver, Windows-specific code.
+ */
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#define LOG_GROUP LOG_GROUP_NET_ADP_DRV
+
+#include <VBox/log.h>
+#include <VBox/version.h>
+#include <VBox/err.h>
+#include <iprt/initterm.h>
+#include <iprt/assert.h>
+
+RT_C_DECLS_BEGIN
+#include <ndis.h>
+RT_C_DECLS_END
+
+#include "VBoxNetAdp-win.h"
+#include "VBoxNetCmn-win.h"
+
+/* Forward declarations */
+MINIPORT_INITIALIZE                vboxNetAdpWinInitializeEx;
+MINIPORT_HALT                      vboxNetAdpWinHaltEx;
+MINIPORT_UNLOAD                    vboxNetAdpWinUnload;
+MINIPORT_PAUSE                     vboxNetAdpWinPause;
+MINIPORT_RESTART                   vboxNetAdpWinRestart;
+MINIPORT_OID_REQUEST               vboxNetAdpWinOidRequest;
+MINIPORT_SEND_NET_BUFFER_LISTS     vboxNetAdpWinSendNetBufferLists;
+MINIPORT_RETURN_NET_BUFFER_LISTS   vboxNetAdpWinReturnNetBufferLists;
+MINIPORT_CANCEL_SEND               vboxNetAdpWinCancelSend;
+MINIPORT_CHECK_FOR_HANG            vboxNetAdpWinCheckForHangEx;
+MINIPORT_RESET                     vboxNetAdpWinResetEx;
+MINIPORT_DEVICE_PNP_EVENT_NOTIFY   vboxNetAdpWinDevicePnPEventNotify;
+MINIPORT_SHUTDOWN                  vboxNetAdpWinShutdownEx;
+MINIPORT_CANCEL_OID_REQUEST        vboxNetAdpWinCancelOidRequest;
+
+
+typedef struct _VBOXNETADPGLOBALS
+{
+    /** ndis device */
+    NDIS_HANDLE hDevice;
+    /** device object */
+    PDEVICE_OBJECT pDevObj;
+    /** our miniport driver handle */
+    NDIS_HANDLE hMiniportDriver;
+    /** power management capabilities, shared by all instances, do not change after init */
+    NDIS_PNP_CAPABILITIES PMCaps;
+} VBOXNETADPGLOBALS, *PVBOXNETADPGLOBALS;
+
+/* win-specific global data */
+VBOXNETADPGLOBALS g_VBoxNetAdpGlobals;
+
+
+typedef struct _VBOXNETADP_ADAPTER {
+    NDIS_HANDLE hAdapter;
+    PVBOXNETADPGLOBALS pGlobals;
+    RTMAC MacAddr;
+} VBOXNETADP_ADAPTER;
+typedef VBOXNETADP_ADAPTER *PVBOXNETADP_ADAPTER;
+
+
+static NTSTATUS vboxNetAdpWinDevDispatch(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp)
+{
+    PIO_STACK_LOCATION pIrpSl = IoGetCurrentIrpStackLocation(pIrp);;
+    NTSTATUS Status = STATUS_SUCCESS;
+
+    switch (pIrpSl->MajorFunction)
+    {
+        case IRP_MJ_DEVICE_CONTROL:
+            Status = STATUS_NOT_SUPPORTED; // TODO: add/remove ioctls
+            break;
+        case IRP_MJ_CREATE:
+        case IRP_MJ_CLEANUP:
+        case IRP_MJ_CLOSE:
+            break;
+        default:
+            Assert(0);
+            break;
+    }
+
+    pIrp->IoStatus.Status = Status;
+    IoCompleteRequest(pIrp, IO_NO_INCREMENT);
+
+    return Status;
+}
+
+static NDIS_STATUS vboxNetAdpWinDevCreate(PVBOXNETADPGLOBALS pGlobals)
+{
+    NDIS_STRING DevName, LinkName;
+    PDRIVER_DISPATCH aMajorFunctions[IRP_MJ_MAXIMUM_FUNCTION+1];
+    NdisInitUnicodeString(&DevName, VBOXNETADP_NAME_DEVICE);
+    NdisInitUnicodeString(&LinkName, VBOXNETADP_NAME_LINK);
+
+    Assert(!pGlobals->hDevice);
+    Assert(!pGlobals->pDevObj);
+    NdisZeroMemory(aMajorFunctions, sizeof (aMajorFunctions));
+    aMajorFunctions[IRP_MJ_CREATE] = vboxNetAdpWinDevDispatch;
+    aMajorFunctions[IRP_MJ_CLEANUP] = vboxNetAdpWinDevDispatch;
+    aMajorFunctions[IRP_MJ_CLOSE] = vboxNetAdpWinDevDispatch;
+    aMajorFunctions[IRP_MJ_DEVICE_CONTROL] = vboxNetAdpWinDevDispatch;
+
+    NDIS_DEVICE_OBJECT_ATTRIBUTES DeviceAttributes;
+    NdisZeroMemory(&DeviceAttributes, sizeof(DeviceAttributes));
+    DeviceAttributes.Header.Type = NDIS_OBJECT_TYPE_DEVICE_OBJECT_ATTRIBUTES;
+    DeviceAttributes.Header.Revision = NDIS_DEVICE_OBJECT_ATTRIBUTES_REVISION_1;
+    DeviceAttributes.Header.Size = sizeof(DeviceAttributes);
+    DeviceAttributes.DeviceName = &DevName;
+    DeviceAttributes.SymbolicName = &LinkName;
+    DeviceAttributes.MajorFunctions = aMajorFunctions;
+
+    NDIS_STATUS Status = NdisRegisterDeviceEx(pGlobals->hMiniportDriver,
+                                              &DeviceAttributes,
+                                              &pGlobals->pDevObj,
+                                              &pGlobals->hDevice);
+    Log(("vboxNetAdpWinDevCreate: NdisRegisterDeviceEx returned 0x%x\n", Status));
+    Assert(Status == NDIS_STATUS_SUCCESS);
+    return Status;
+}
+
+static void vboxNetAdpWinDevDestroy(PVBOXNETADPGLOBALS pGlobals)
+{
+    Assert(pGlobals->hDevice);
+    Assert(pGlobals->pDevObj);
+    NdisDeregisterDeviceEx(pGlobals->hDevice);
+    pGlobals->hDevice = NULL;
+    pGlobals->pDevObj = NULL;
+}
+
+
+
+
+
+NDIS_OID g_SupportedOids[] =
+{
+    OID_GEN_CURRENT_LOOKAHEAD,
+    OID_GEN_CURRENT_PACKET_FILTER,
+    OID_GEN_INTERRUPT_MODERATION,
+    OID_GEN_LINK_PARAMETERS,
+    OID_GEN_MAXIMUM_TOTAL_SIZE,
+    OID_GEN_RCV_OK,
+    OID_GEN_RECEIVE_BLOCK_SIZE,
+    OID_GEN_RECEIVE_BUFFER_SPACE,
+    OID_GEN_STATISTICS,
+    OID_GEN_TRANSMIT_BLOCK_SIZE,
+    OID_GEN_TRANSMIT_BUFFER_SPACE,
+    OID_GEN_VENDOR_DESCRIPTION,
+    OID_GEN_VENDOR_DRIVER_VERSION,
+    OID_GEN_VENDOR_ID,
+    OID_GEN_XMIT_OK,
+    OID_802_3_PERMANENT_ADDRESS,
+    OID_802_3_CURRENT_ADDRESS,
+    OID_802_3_MULTICAST_LIST,
+    OID_802_3_MAXIMUM_LIST_SIZE,
+    OID_PNP_CAPABILITIES,
+    OID_PNP_QUERY_POWER,
+    OID_PNP_SET_POWER
+};
+
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinAllocAdapter(NDIS_HANDLE hAdapter, PVBOXNETADP_ADAPTER *ppAdapter, ULONG64 NetLuid)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    PVBOXNETADP_ADAPTER pAdapter = NULL;
+
+    LogFlow(("==>"__FUNCTION__": adapter handle=%p\n", hAdapter));
+
+    *ppAdapter = NULL;
+
+    pAdapter = (PVBOXNETADP_ADAPTER)NdisAllocateMemoryWithTagPriority(g_VBoxNetAdpGlobals.hMiniportDriver,
+                                                                         sizeof(VBOXNETADP_ADAPTER),
+                                                                         VBOXNETADPWIN_TAG,
+                                                                         NormalPoolPriority);
+    if (!pAdapter)
+    {
+        Status = NDIS_STATUS_RESOURCES;
+        Log((__FUNCTION__": Out of memory while allocating adapter context (size=%d)\n", sizeof(VBOXNETADP_ADAPTER)));
+    }
+    else
+    {
+        NdisZeroMemory(pAdapter, sizeof(VBOXNETADP_ADAPTER));
+        pAdapter->hAdapter = hAdapter;
+        pAdapter->pGlobals = &g_VBoxNetAdpGlobals;
+        // TODO: Use netadp structure instead!
+    /* Use a locally administered version of the OUI we use for the guest NICs. */
+    pAdapter->MacAddr.au8[0] = 0x08 | 2;
+    pAdapter->MacAddr.au8[1] = 0x00;
+    pAdapter->MacAddr.au8[2] = 0x27;
+
+    pAdapter->MacAddr.au8[3] = (NetLuid >> 16) & 0xFF;
+    pAdapter->MacAddr.au8[4] = (NetLuid >> 8) & 0xFF;
+    pAdapter->MacAddr.au8[5] = NetLuid & 0xFF;
+
+        //TODO: Statistics?
+
+        *ppAdapter = pAdapter;
+    }
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+DECLHIDDEN(void) vboxNetAdpWinFreeAdapter(PVBOXNETADP_ADAPTER pAdapter)
+{
+    NdisFreeMemory(pAdapter, 0, 0);
+}
+
+DECLINLINE(NDIS_MEDIA_CONNECT_STATE) vboxNetAdpWinGetConnectState(PVBOXNETADP_ADAPTER pAdapter)
+{
+    return MediaConnectStateConnected;
+}
+
+
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinInitializeEx(IN NDIS_HANDLE NdisMiniportHandle,
+                                                  IN NDIS_HANDLE MiniportDriverContext,
+                                                  IN PNDIS_MINIPORT_INIT_PARAMETERS MiniportInitParameters)
+{
+    PVBOXNETADP_ADAPTER pAdapter = NULL;
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+
+    LogFlow(("==>"__FUNCTION__": miniport=0x%x\n", NdisMiniportHandle));
+
+    do
+    {
+        NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES RAttrs = {0};
+        NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES GAttrs = {0};
+
+        Status = vboxNetAdpWinAllocAdapter(NdisMiniportHandle, &pAdapter, MiniportInitParameters->NetLuid.Value);
+        if (Status != NDIS_STATUS_SUCCESS)
+        {
+            Log((__FUNCTION__": Failed to allocate the adapter context with 0x%x\n", Status));
+            break;
+        }
+
+        RAttrs.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES;
+        RAttrs.Header.Size = NDIS_SIZEOF_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1;
+        RAttrs.Header.Revision = NDIS_MINIPORT_ADAPTER_REGISTRATION_ATTRIBUTES_REVISION_1;
+        RAttrs.MiniportAdapterContext = pAdapter;
+        RAttrs.AttributeFlags = VBOXNETADPWIN_ATTR_FLAGS; // NDIS_MINIPORT_ATTRIBUTES_NDIS_WDM
+        RAttrs.CheckForHangTimeInSeconds = VBOXNETADPWIN_HANG_CHECK_TIME;
+        RAttrs.InterfaceType = NdisInterfaceInternal;
+
+        Status = NdisMSetMiniportAttributes(NdisMiniportHandle,
+                                            (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&RAttrs);
+        if (Status != NDIS_STATUS_SUCCESS)
+        {
+            Log((__FUNCTION__": NdisMSetMiniportAttributes(registration) failed with 0x%x\n", Status));
+            break;
+        }
+
+        // TODO: Registry?
+
+        // TODO: WDM stack?
+
+        // TODO: DPC?
+
+        GAttrs.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES;
+        GAttrs.Header.Size = NDIS_SIZEOF_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_1;
+        GAttrs.Header.Revision = NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_1;
+
+        GAttrs.MediaType = NdisMedium802_3;
+        GAttrs.PhysicalMediumType = NdisPhysicalMediumUnspecified;
+        GAttrs.MtuSize = 1500; //TODO
+        GAttrs.MaxXmitLinkSpeed = 1000000000ULL;
+        GAttrs.XmitLinkSpeed = 1000000000ULL;
+        GAttrs.MaxRcvLinkSpeed = 1000000000ULL;
+        GAttrs.RcvLinkSpeed = 1000000000ULL;
+        GAttrs.MediaConnectState = vboxNetAdpWinGetConnectState(pAdapter);
+        GAttrs.MediaDuplexState = MediaDuplexStateFull;
+        GAttrs.LookaheadSize = 1500; //TODO
+        GAttrs.MacOptions = VBOXNETADP_MAC_OPTIONS;
+        GAttrs.SupportedPacketFilters = VBOXNETADP_SUPPORTED_FILTERS;
+        GAttrs.MaxMulticastListSize = 32; //TODO
+
+        GAttrs.MacAddressLength = ETH_LENGTH_OF_ADDRESS;
+        Assert(GAttrs.MacAddressLength == sizeof(pAdapter->MacAddr));
+        memcpy(GAttrs.PermanentMacAddress, pAdapter->MacAddr.au8, GAttrs.MacAddressLength);
+        memcpy(GAttrs.CurrentMacAddress, pAdapter->MacAddr.au8, GAttrs.MacAddressLength);
+
+        GAttrs.RecvScaleCapabilities = NULL;
+        GAttrs.AccessType = NET_IF_ACCESS_BROADCAST;
+        GAttrs.DirectionType = NET_IF_DIRECTION_SENDRECEIVE;
+        GAttrs.ConnectionType = NET_IF_CONNECTION_DEDICATED;
+        GAttrs.IfType = IF_TYPE_ETHERNET_CSMACD;
+        GAttrs.IfConnectorPresent = false;
+        GAttrs.SupportedStatistics = VBOXNETADPWIN_SUPPORTED_STATISTICS;
+        GAttrs.SupportedPauseFunctions = NdisPauseFunctionsUnsupported;
+        GAttrs.DataBackFillSize = 0;
+        GAttrs.ContextBackFillSize = 0;
+        GAttrs.SupportedOidList = g_SupportedOids;
+        GAttrs.SupportedOidListLength = sizeof(g_SupportedOids);
+        GAttrs.AutoNegotiationFlags = NDIS_LINK_STATE_DUPLEX_AUTO_NEGOTIATED;
+        GAttrs.PowerManagementCapabilities = &g_VBoxNetAdpGlobals.PMCaps;
+
+        Status = NdisMSetMiniportAttributes(NdisMiniportHandle,
+                                            (PNDIS_MINIPORT_ADAPTER_ATTRIBUTES)&GAttrs);
+        if (Status != NDIS_STATUS_SUCCESS)
+        {
+            Log((__FUNCTION__": NdisMSetMiniportAttributes(general) failed with 0x%x\n", Status));
+            break;
+        }
+    } while (false);
+
+    if (Status != NDIS_STATUS_SUCCESS)
+    {
+        if (pAdapter)
+            vboxNetAdpWinFreeAdapter(pAdapter);
+    }
+
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+DECLHIDDEN(VOID) vboxNetAdpWinHaltEx(IN NDIS_HANDLE MiniportAdapterContext,
+                                     IN NDIS_HALT_ACTION HaltAction)
+{
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    // TODO: Stop something?
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinPause(IN NDIS_HANDLE MiniportAdapterContext,
+                                           IN PNDIS_MINIPORT_PAUSE_PARAMETERS MiniportPauseParameters)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinRestart(IN NDIS_HANDLE MiniportAdapterContext,
+                                             IN PNDIS_MINIPORT_RESTART_PARAMETERS MiniportRestartParameters)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinOidRqQuery(PVBOXNETADP_ADAPTER pAdapter,
+                                                PNDIS_OID_REQUEST pRequest)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    struct _NDIS_OID_REQUEST::_REQUEST_DATA::_QUERY *pQuery = &pRequest->DATA.QUERY_INFORMATION;
+
+    LogFlow(("==>"__FUNCTION__"\n"));
+
+    uint64_t u64Tmp = 0;
+    ULONG ulTmp = 0;
+    PVOID pInfo = &ulTmp;
+    ULONG cbInfo = sizeof(ulTmp);
+
+    switch (pQuery->Oid)
+    {
+        case OID_GEN_INTERRUPT_MODERATION:
+        {
+            PNDIS_INTERRUPT_MODERATION_PARAMETERS pParams =
+                (PNDIS_INTERRUPT_MODERATION_PARAMETERS)pQuery->InformationBuffer;
+            cbInfo = NDIS_SIZEOF_INTERRUPT_MODERATION_PARAMETERS_REVISION_1;
+            if (cbInfo > pQuery->InformationBufferLength)
+                break;
+            pParams->Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
+            pParams->Header.Revision = NDIS_INTERRUPT_MODERATION_PARAMETERS_REVISION_1;
+            pParams->Header.Size = NDIS_SIZEOF_INTERRUPT_MODERATION_PARAMETERS_REVISION_1;
+            pParams->Flags = 0;
+            pParams->InterruptModeration = NdisInterruptModerationNotSupported;
+            pInfo = NULL; /* Do not copy */
+            break;
+        }
+        case OID_GEN_MAXIMUM_TOTAL_SIZE:
+        case OID_GEN_RECEIVE_BLOCK_SIZE:
+        case OID_GEN_TRANSMIT_BLOCK_SIZE:
+            ulTmp = VBOXNETADP_MAX_FRAME_SIZE;
+            break;
+        case OID_GEN_RCV_OK:
+        case OID_GEN_XMIT_OK:
+            u64Tmp = 0;
+            pInfo = &u64Tmp;
+            cbInfo = sizeof(u64Tmp);
+            break;
+        case OID_GEN_RECEIVE_BUFFER_SPACE:
+        case OID_GEN_TRANSMIT_BUFFER_SPACE:
+            // TODO: Make configurable
+            ulTmp = VBOXNETADP_MAX_FRAME_SIZE * 40;
+            break;
+        case OID_GEN_STATISTICS:
+        {
+            PNDIS_STATISTICS_INFO pStats =
+                (PNDIS_STATISTICS_INFO)pQuery->InformationBuffer;
+            cbInfo = NDIS_SIZEOF_STATISTICS_INFO_REVISION_1;
+            if (cbInfo > pQuery->InformationBufferLength)
+                break;
+            pInfo = NULL; /* Do not copy */
+            memset(pStats, 0, cbInfo);
+            pStats->Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
+            pStats->Header.Revision = NDIS_STATISTICS_INFO_REVISION_1;
+            pStats->Header.Size = NDIS_SIZEOF_STATISTICS_INFO_REVISION_1;
+            // TODO: We need some stats, don't we?
+            break;
+        }
+        case OID_GEN_VENDOR_DESCRIPTION:
+            pInfo = VBOXNETADP_VENDOR_NAME;
+            cbInfo = sizeof(VBOXNETADP_VENDOR_NAME);
+            break;
+        case OID_GEN_VENDOR_DRIVER_VERSION:
+            ulTmp = (VBOXNETADP_VERSION_NDIS_MAJOR << 16) | VBOXNETADP_VERSION_NDIS_MINOR;
+            break;
+        case OID_GEN_VENDOR_ID:
+            ulTmp = VBOXNETADP_VENDOR_ID;
+            break;
+        case OID_802_3_PERMANENT_ADDRESS:
+        case OID_802_3_CURRENT_ADDRESS:
+            pInfo = &pAdapter->MacAddr;
+            cbInfo = sizeof(pAdapter->MacAddr);
+            break;
+            //case OID_802_3_MULTICAST_LIST:
+        case OID_802_3_MAXIMUM_LIST_SIZE:
+            ulTmp = VBOXNETADP_MCAST_LIST_SIZE;
+            break;
+        case OID_PNP_CAPABILITIES:
+            pInfo = &pAdapter->pGlobals->PMCaps;
+            cbInfo = sizeof(pAdapter->pGlobals->PMCaps);
+            break;
+        case OID_PNP_QUERY_POWER:
+            pInfo = NULL; /* Do not copy */
+            cbInfo = 0;
+            break;
+        default:
+            Status = NDIS_STATUS_NOT_SUPPORTED;
+            break;
+    }
+
+    if (Status == NDIS_STATUS_SUCCESS)
+    {
+        if (cbInfo > pQuery->InformationBufferLength)
+        {
+            pQuery->BytesNeeded = cbInfo;
+            Status = NDIS_STATUS_BUFFER_TOO_SHORT;
+        }
+        else
+        {
+            if (pInfo)
+                NdisMoveMemory(pQuery->InformationBuffer, pInfo, cbInfo);
+            pQuery->BytesWritten = cbInfo;
+        }
+    }
+
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinOidRqSet(PVBOXNETADP_ADAPTER pAdapter,
+                                              PNDIS_OID_REQUEST pRequest)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    struct _NDIS_OID_REQUEST::_REQUEST_DATA::_SET *pSet = &pRequest->DATA.SET_INFORMATION;
+
+    LogFlow(("==>"__FUNCTION__"\n"));
+
+    switch (pSet->Oid)
+    {
+        case OID_GEN_CURRENT_LOOKAHEAD:
+            if (pSet->InformationBufferLength != sizeof(ULONG))
+            {
+                pSet->BytesNeeded = sizeof(ULONG);
+                Status = NDIS_STATUS_INVALID_LENGTH;
+                break;
+            }
+            // TODO: For the time being we simply ignore lookahead settings.
+            pSet->BytesRead = sizeof(ULONG);
+            Status = NDIS_STATUS_SUCCESS;
+            break;
+
+        case OID_GEN_CURRENT_PACKET_FILTER:
+            if (pSet->InformationBufferLength != sizeof(ULONG))
+            {
+                pSet->BytesNeeded = sizeof(ULONG);
+                Status = NDIS_STATUS_INVALID_LENGTH;
+                break;
+            }
+            // TODO: For the time being we simply ignore packet filter settings.
+            pSet->BytesRead = pSet->InformationBufferLength;
+            Status = NDIS_STATUS_SUCCESS;
+            break;
+
+        case OID_GEN_INTERRUPT_MODERATION:
+            pSet->BytesNeeded = 0;
+            pSet->BytesRead = 0;
+            Status = NDIS_STATUS_INVALID_DATA;
+            break;
+
+        case OID_PNP_SET_POWER:
+            if (pSet->InformationBufferLength < sizeof(NDIS_DEVICE_POWER_STATE))
+            {
+                Status = NDIS_STATUS_INVALID_LENGTH;
+                break;
+            }
+            pSet->BytesRead = sizeof(NDIS_DEVICE_POWER_STATE);
+            Status = NDIS_STATUS_SUCCESS;
+            break;
+
+        default:
+            Status = NDIS_STATUS_NOT_SUPPORTED;
+            break;
+    }
+
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinOidRequest(IN NDIS_HANDLE MiniportAdapterContext,
+                                                IN PNDIS_OID_REQUEST NdisRequest)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    vboxNetCmnWinDumpOidRequest(__FUNCTION__, NdisRequest);
+
+    switch (NdisRequest->RequestType)
+    {
+#if 0
+        case NdisRequestMethod:
+            Status = vboxNetAdpWinOidRqMethod(pAdapter, NdisRequest);
+            break;
+#endif
+
+        case NdisRequestSetInformation:
+            Status = vboxNetAdpWinOidRqSet(pAdapter, NdisRequest);
+            break;
+
+        case NdisRequestQueryInformation:
+        case NdisRequestQueryStatistics:
+            Status = vboxNetAdpWinOidRqQuery(pAdapter, NdisRequest);
+            break;
+
+        default:
+            Status = NDIS_STATUS_NOT_SUPPORTED;
+            break;
+    }
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+DECLHIDDEN(VOID) vboxNetAdpWinSendNetBufferLists(IN NDIS_HANDLE MiniportAdapterContext,
+                                                 IN PNET_BUFFER_LIST NetBufferLists,
+                                                 IN NDIS_PORT_NUMBER PortNumber,
+                                                 IN ULONG SendFlags)
+{
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    PNET_BUFFER_LIST pNbl = NetBufferLists;
+    for (pNbl = NetBufferLists; pNbl; pNbl = NET_BUFFER_LIST_NEXT_NBL(pNbl))
+        NET_BUFFER_LIST_STATUS(pNbl) = NDIS_STATUS_SUCCESS;
+    NdisMSendNetBufferListsComplete(pAdapter->hAdapter, NetBufferLists,
+                                    (SendFlags & NDIS_SEND_FLAGS_DISPATCH_LEVEL) ?
+                                    NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL : 0);
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+DECLHIDDEN(VOID) vboxNetAdpWinReturnNetBufferLists(IN NDIS_HANDLE MiniportAdapterContext,
+                                                   IN PNET_BUFFER_LIST NetBufferLists,
+                                                   IN ULONG ReturnFlags)
+{
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    Log((__FUNCTION__": We should not be here!\n"));
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+DECLHIDDEN(VOID) vboxNetAdpWinCancelSend(IN NDIS_HANDLE MiniportAdapterContext,
+                                         IN PVOID CancelId)
+{
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    Log((__FUNCTION__": We should not be here!\n"));
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+
+DECLHIDDEN(BOOLEAN) vboxNetAdpWinCheckForHangEx(IN NDIS_HANDLE MiniportAdapterContext)
+{
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    LogFlow(("<=="__FUNCTION__" return false\n"));
+    return FALSE;
+}
+
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinResetEx(IN NDIS_HANDLE MiniportAdapterContext,
+                                             OUT PBOOLEAN AddressingReset)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+DECLHIDDEN(VOID) vboxNetAdpWinDevicePnPEventNotify(IN NDIS_HANDLE MiniportAdapterContext,
+                                                   IN PNET_DEVICE_PNP_EVENT NetDevicePnPEvent)
+{
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    Log((__FUNCTION__": PnP event=%d\n", NetDevicePnPEvent->DevicePnPEvent));
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+
+DECLHIDDEN(VOID) vboxNetAdpWinShutdownEx(IN NDIS_HANDLE MiniportAdapterContext,
+                                         IN NDIS_SHUTDOWN_ACTION ShutdownAction)
+{
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    Log((__FUNCTION__": action=%d\n", ShutdownAction));
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+DECLHIDDEN(VOID) vboxNetAdpWinCancelOidRequest(IN NDIS_HANDLE MiniportAdapterContext,
+                                               IN PVOID RequestId)
+{
+    PVBOXNETADP_ADAPTER pAdapter = (PVBOXNETADP_ADAPTER)MiniportAdapterContext;
+    LogFlow(("==>"__FUNCTION__"\n"));
+    Log((__FUNCTION__": req id=%p\n", RequestId));
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+
+
+DECLHIDDEN(VOID) vboxNetAdpWinUnload(IN PDRIVER_OBJECT DriverObject)
+{
+    LogFlow(("==>"__FUNCTION__"\n"));
+    //vboxNetAdpWinDevDestroy(&g_VBoxNetAdpGlobals);
+    if (g_VBoxNetAdpGlobals.hMiniportDriver)
+        NdisMDeregisterMiniportDriver(g_VBoxNetAdpGlobals.hMiniportDriver);
+    //NdisFreeSpinLock(&g_VBoxNetAdpGlobals.Lock);
+    LogFlow(("<=="__FUNCTION__"\n"));
+    RTR0Term();
+}
+
+
+/**
+ * register the miniport driver
+ */
+DECLHIDDEN(NDIS_STATUS) vboxNetAdpWinRegister(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPathStr)
+{
+    NDIS_MINIPORT_DRIVER_CHARACTERISTICS MChars;
+
+    NdisZeroMemory(&MChars, sizeof (MChars));
+
+    MChars.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_DRIVER_CHARACTERISTICS;
+    MChars.Header.Size = sizeof(NDIS_MINIPORT_DRIVER_CHARACTERISTICS);
+    MChars.Header.Revision = NDIS_MINIPORT_DRIVER_CHARACTERISTICS_REVISION_1;
+
+    MChars.MajorNdisVersion = VBOXNETADP_VERSION_NDIS_MAJOR;
+    MChars.MinorNdisVersion = VBOXNETADP_VERSION_NDIS_MINOR;
+
+    MChars.MajorDriverVersion = VBOXNETADP_VERSION_MAJOR;
+    MChars.MinorDriverVersion = VBOXNETADP_VERSION_MINOR;
+
+    MChars.InitializeHandlerEx         = vboxNetAdpWinInitializeEx;
+    MChars.HaltHandlerEx               = vboxNetAdpWinHaltEx;
+    MChars.UnloadHandler               = vboxNetAdpWinUnload;
+    MChars.PauseHandler                = vboxNetAdpWinPause;
+    MChars.RestartHandler              = vboxNetAdpWinRestart;
+    MChars.OidRequestHandler           = vboxNetAdpWinOidRequest;
+    MChars.SendNetBufferListsHandler   = vboxNetAdpWinSendNetBufferLists;
+    MChars.ReturnNetBufferListsHandler = vboxNetAdpWinReturnNetBufferLists;
+    MChars.CancelSendHandler           = vboxNetAdpWinCancelSend;
+    MChars.CheckForHangHandlerEx       = vboxNetAdpWinCheckForHangEx;
+    MChars.ResetHandlerEx              = vboxNetAdpWinResetEx;
+    MChars.DevicePnPEventNotifyHandler = vboxNetAdpWinDevicePnPEventNotify;
+    MChars.ShutdownHandlerEx           = vboxNetAdpWinShutdownEx;
+    MChars.CancelOidRequestHandler     = vboxNetAdpWinCancelOidRequest;
+
+    NDIS_STATUS Status;
+    g_VBoxNetAdpGlobals.hMiniportDriver = NULL;
+    Log(("vboxNetAdpWinRegister: registering miniport driver...\n"));
+    Status = NdisMRegisterMiniportDriver(pDriverObject,
+                                         pRegistryPathStr,
+                                         (NDIS_HANDLE)&g_VBoxNetAdpGlobals,
+                                         &MChars,
+                                         &g_VBoxNetAdpGlobals.hMiniportDriver);
+    Assert(Status == STATUS_SUCCESS);
+    if (Status == STATUS_SUCCESS)
+    {
+        Log(("vboxNetAdpWinRegister: successfully registered miniport driver; registering device...\n"));
+        //Status = vboxNetAdpWinDevCreate(&g_VBoxNetAdpGlobals);
+        //Assert(Status == STATUS_SUCCESS);
+        //Log(("vboxNetAdpWinRegister: vboxNetAdpWinDevCreate() returned 0x%x\n", Status));
+    }
+    else
+    {
+        Log(("ERROR! vboxNetAdpWinRegister: failed to register miniport driver, status=0x%x", Status));
+    }
+    return Status;
+}
+
+
+RT_C_DECLS_BEGIN
+
+NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath);
+
+RT_C_DECLS_END
+
+NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    int rc;
+
+
+    rc = RTR0Init(0);
+    AssertRC(rc);
+    if (RT_SUCCESS(rc))
+    {
+        NdisZeroMemory(&g_VBoxNetAdpGlobals, sizeof (g_VBoxNetAdpGlobals));
+        //NdisAllocateSpinLock(&g_VBoxNetAdpGlobals.Lock);
+        //g_VBoxNetAdpGlobals.PMCaps.WakeUpCapabilities.Flags = NDIS_DEVICE_WAKE_UP_ENABLE;
+        g_VBoxNetAdpGlobals.PMCaps.WakeUpCapabilities.MinMagicPacketWakeUp = NdisDeviceStateUnspecified;
+        g_VBoxNetAdpGlobals.PMCaps.WakeUpCapabilities.MinPatternWakeUp = NdisDeviceStateUnspecified;
+
+        Status = vboxNetAdpWinRegister(pDriverObject, pRegistryPath);
+        Assert(Status == STATUS_SUCCESS);
+        if (Status == NDIS_STATUS_SUCCESS)
+        {
+            Log(("NETADP: started successfully\n"));
+            return STATUS_SUCCESS;
+        }
+        //NdisFreeSpinLock(&g_VBoxNetAdpGlobals.Lock);
+        RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
+        RTLogDestroy(RTLogSetDefaultInstance(NULL));
+
+        RTR0Term();
+    }
+    else
+    {
+        Status = NDIS_STATUS_FAILURE;
+    }
+
+    return Status;
+}
+
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.h b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.h
new file mode 100644
index 0000000..a8c7c9a
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.h
@@ -0,0 +1,48 @@
+/* $Id: VBoxNetAdp-win.h $ */
+/** @file
+ * VBoxNetAdp-win.h - Host-only Miniport Driver, Windows-specific code.
+ */
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#ifndef ___VBoxNetAdp_win_h___
+#define ___VBoxNetAdp_win_h___
+
+#define VBOXNETADP_VERSION_NDIS_MAJOR        6
+#define VBOXNETADP_VERSION_NDIS_MINOR        0
+
+#define VBOXNETADP_VERSION_MAJOR             1
+#define VBOXNETADP_VERSION_MINOR             0
+
+#define VBOXNETADP_VENDOR_NAME               "Oracle"
+#define VBOXNETADP_VENDOR_ID                 0xFFFFFF
+#define VBOXNETADP_MCAST_LIST_SIZE           32
+#define VBOXNETADP_MAX_FRAME_SIZE            1518 // TODO: 14+4+1500
+
+//#define VBOXNETADP_NAME_UNIQUE               L"{7af6b074-048d-4444-bfce-1ecc8bc5cb76}"
+#define VBOXNETADP_NAME_SERVICE              L"VBoxNetAdp"
+
+#define VBOXNETADP_NAME_LINK                 L"\\DosDevices\\Global\\VBoxNetAdp"
+#define VBOXNETADP_NAME_DEVICE               L"\\Device\\VBoxNetAdp"
+
+#define VBOXNETADPWIN_TAG                    'ANBV'
+
+#define VBOXNETADPWIN_ATTR_FLAGS             NDIS_MINIPORT_ATTRIBUTES_NDIS_WDM | NDIS_MINIPORT_ATTRIBUTES_NO_HALT_ON_SUSPEND
+#define VBOXNETADP_MAC_OPTIONS               NDIS_MAC_OPTION_NO_LOOPBACK
+#define VBOXNETADP_SUPPORTED_FILTERS         (NDIS_PACKET_TYPE_DIRECTED | \
+                                              NDIS_PACKET_TYPE_MULTICAST | \
+                                              NDIS_PACKET_TYPE_BROADCAST | \
+                                              NDIS_PACKET_TYPE_PROMISCUOUS | \
+                                              NDIS_PACKET_TYPE_ALL_MULTICAST)
+#define VBOXNETADPWIN_SUPPORTED_STATISTICS   0 //TODO!
+#define VBOXNETADPWIN_HANG_CHECK_TIME        4
+
+#endif /* #ifndef ___VBoxNetAdp_win_h___ */
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.rc b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.rc
new file mode 100644
index 0000000..1a1faa0
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp-win.rc
@@ -0,0 +1,53 @@
+/* $Id: VBoxNetAdp-win.rc $ */
+/** @file
+ * VBoxNetAdp6 - Resource file containing version info and icon.
+ */
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <windows.h>
+#include <VBox/version.h>
+
+#define DESCRIPTION_STR    "VirtualBox NDIS 6.0 Host-Only Network Adapter Driver\0"
+#define FILENAME_STR       "VBoxNetAdp6"
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+VS_VERSION_INFO VERSIONINFO
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DRV
+   FILESUBTYPE      VFT2_DRV_NETWORK
+BEGIN
+   BLOCK "StringFileInfo"
+   BEGIN
+      BLOCK "040904b0"
+      BEGIN
+         VALUE "FileDescription",  DESCRIPTION_STR
+         VALUE "InternalName",     FILENAME_STR "\0"
+         VALUE "OriginalFilename", FILENAME_STR ".sys\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
+      END
+   END
+   BLOCK "VarFileInfo"
+   BEGIN
+      VALUE "Translation", 0x409, 1200
+   END
+END
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp6.inf b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp6.inf
new file mode 100644
index 0000000..5c26849
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetAdp6.inf
@@ -0,0 +1,90 @@
+; $Id: VBoxNetAdp6.inf $
+; @file
+; VBoxNetAdp6.inf - VirtualBox NDIS6 Miniport Driver inf file
+;
+; Note: We use the same component id as the old NetAdp implementation ?
+;
+;
+; Copyright (C) 2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+
+[Version]
+Signature   = "$Windows NT$"
+;cat  CatalogFile = VBoxNetAdp6.cat
+Class       = Net
+ClassGUID   = {4D36E972-E325-11CE-BFC1-08002BE10318}
+Provider    = %Provider%
+;edit-DriverVer=10/23/2014,1.0.1.0
+
+
+[Manufacturer]
+%Provider% = VBox,NTx86,NTamd64
+
+[ControlFlags]
+
+[VBox]
+%VBoxNetAdp6_Desc% = VBoxNetAdp6.ndi, sun_VBoxNetAdp
+
+[VBox.NTx86]
+%VBoxNetAdp6_Desc% = VBoxNetAdp6.ndi, sun_VBoxNetAdp
+
+[VBox.NTamd64]
+%VBoxNetAdp6_Desc% = VBoxNetAdp6.ndi, sun_VBoxNetAdp
+
+[VBoxNetAdp6.ndi]
+AddReg             = VBoxNetAdp6.ndi.AddReg
+Characteristics    = 0x1 ; NCF_VIRTUAL
+*IfType            = 0x6 ; IF_TYPE_ETHERNET_CSMACD
+*MediaType         = 0x0 ; NdisMedium802_3
+*PhysicalMediaType = 14  ; NdisPhysicalMedium802_3
+CopyFiles          = VBoxNetAdp6.Files.Sys
+
+[VBoxNetAdp6.ndi.Remove.Services]
+DelService       = VBoxNetAdp,0x200 ; Stop the service before uninstalling
+
+[VBoxNetAdp6.ndi.Services]
+AddService = VBoxNetAdp, 2, VBoxNetAdp6.AddService
+
+[VBoxNetAdp6.AddService]
+DisplayName    = %VBoxNetAdp6Service_Desc%
+ServiceType    = 1 ;SERVICE_KERNEL_DRIVER
+StartType      = 1 ;SERVICE_SYSTEM_START
+ErrorControl   = 1 ;SERVICE_ERROR_NORMAL
+ServiceBinary  = %12%\VBoxNetAdp6.sys
+LoadOrderGroup = NDIS
+
+[SourceDisksNames]
+1=%DiskDescription%,"",,
+
+[SourceDisksFiles]
+VBoxNetAdp6.sys=1
+
+[DestinationDirs]
+DefaultDestDir = 12
+VBoxNetAdp6.Files.Sys   = 12   ; %windir%\System32\drivers
+
+[VBoxNetAdp6.Files.Sys]
+VBoxNetAdp6.sys,,,2
+
+[VBoxNetAdp6.ndi.AddReg]
+HKR,    ,            *NdisDeviceType, 0x00010001, 1   ; NDIS_DEVICE_TYPE_ENDPOINT
+HKR,    ,            BusNumber,  0, "0"
+HKR, Ndi,            Service,    0, VBoxNetAdp
+HKR, Ndi,            HelpText,    , %VBoxNetAdp6_HELP%
+HKR, Ndi\Interfaces, UpperRange, 0, ndis5
+HKR, Ndi\Interfaces, LowerRange, 0, ethernet
+
+[Strings]
+Provider = "Oracle Corporation"
+DiskDescription = "VirtualBox NDIS 6.0 Miniport Driver"
+VBoxNetAdp6_Desc = "VirtualBox Host-Only Ethernet Adapter"
+VBoxNetAdp6_HELP = "VirtualBox NDIS 6.0 Miniport Driver"
+VBoxNetAdp6Service_Desc = "VirtualBox NDIS 6.0 Miniport Service"
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetCmn-win.h b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetCmn-win.h
new file mode 100644
index 0000000..eacebfa
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetCmn-win.h
@@ -0,0 +1,127 @@
+/* $Id: VBoxNetCmn-win.h $ */
+/** @file
+ * VBoxNetCmn-win.h - NDIS6 Networking Driver Common Definitions, Windows-specific code.
+ */
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+DECLHIDDEN(void) vboxNetCmnWinDumpOidRequest(const char *pcszFunction, PNDIS_OID_REQUEST pRequest)
+{
+    char *pszType = "unknown";
+    char *pszOid  = "unknown";
+
+    switch (pRequest->RequestType)
+    {
+        case NdisRequestSetInformation: pszType = "set"; break;
+        case NdisRequestMethod: pszType = "method"; break;
+        case NdisRequestQueryInformation: pszType = "query info"; break;
+        case NdisRequestQueryStatistics: pszType = "query stats"; break;
+    }
+    switch (pRequest->DATA.SET_INFORMATION.Oid)
+    {
+        case OID_GEN_MAX_LINK_SPEED: pszOid = "OID_GEN_MAX_LINK_SPEED"; break;
+        case OID_GEN_LINK_STATE: pszOid = "OID_GEN_LINK_STATE"; break;
+        case OID_GEN_LINK_PARAMETERS: pszOid = "OID_GEN_LINK_PARAMETERS"; break;
+        case OID_GEN_MINIPORT_RESTART_ATTRIBUTES: pszOid = "OID_GEN_MINIPORT_RESTART_ATTRIBUTES"; break;
+        case OID_GEN_ENUMERATE_PORTS: pszOid = "OID_GEN_ENUMERATE_PORTS"; break;
+        case OID_GEN_PORT_STATE: pszOid = "OID_GEN_PORT_STATE"; break;
+        case OID_GEN_PORT_AUTHENTICATION_PARAMETERS: pszOid = "OID_GEN_PORT_AUTHENTICATION_PARAMETERS"; break;
+        case OID_GEN_INTERRUPT_MODERATION: pszOid = "OID_GEN_INTERRUPT_MODERATION"; break;
+        case OID_GEN_PHYSICAL_MEDIUM_EX: pszOid = "OID_GEN_PHYSICAL_MEDIUM_EX"; break;
+        case OID_GEN_SUPPORTED_LIST: pszOid = "OID_GEN_SUPPORTED_LIST"; break;
+        case OID_GEN_HARDWARE_STATUS: pszOid = "OID_GEN_HARDWARE_STATUS"; break;
+        case OID_GEN_MEDIA_SUPPORTED: pszOid = "OID_GEN_MEDIA_SUPPORTED"; break;
+        case OID_GEN_MEDIA_IN_USE: pszOid = "OID_GEN_MEDIA_IN_USE"; break;
+        case OID_GEN_MAXIMUM_LOOKAHEAD: pszOid = "OID_GEN_MAXIMUM_LOOKAHEAD"; break;
+        case OID_GEN_MAXIMUM_FRAME_SIZE: pszOid = "OID_GEN_MAXIMUM_FRAME_SIZE"; break;
+        case OID_GEN_LINK_SPEED: pszOid = "OID_GEN_LINK_SPEED"; break;
+        case OID_GEN_TRANSMIT_BUFFER_SPACE: pszOid = "OID_GEN_TRANSMIT_BUFFER_SPACE"; break;
+        case OID_GEN_RECEIVE_BUFFER_SPACE: pszOid = "OID_GEN_RECEIVE_BUFFER_SPACE"; break;
+        case OID_GEN_TRANSMIT_BLOCK_SIZE: pszOid = "OID_GEN_TRANSMIT_BLOCK_SIZE"; break;
+        case OID_GEN_RECEIVE_BLOCK_SIZE: pszOid = "OID_GEN_RECEIVE_BLOCK_SIZE"; break;
+        case OID_GEN_VENDOR_ID: pszOid = "OID_GEN_VENDOR_ID"; break;
+        case OID_GEN_VENDOR_DESCRIPTION: pszOid = "OID_GEN_VENDOR_DESCRIPTION"; break;
+        case OID_GEN_VENDOR_DRIVER_VERSION: pszOid = "OID_GEN_VENDOR_DRIVER_VERSION"; break;
+        case OID_GEN_CURRENT_PACKET_FILTER: pszOid = "OID_GEN_CURRENT_PACKET_FILTER"; break;
+        case OID_GEN_CURRENT_LOOKAHEAD: pszOid = "OID_GEN_CURRENT_LOOKAHEAD"; break;
+        case OID_GEN_DRIVER_VERSION: pszOid = "OID_GEN_DRIVER_VERSION"; break;
+        case OID_GEN_MAXIMUM_TOTAL_SIZE: pszOid = "OID_GEN_MAXIMUM_TOTAL_SIZE"; break;
+        case OID_GEN_PROTOCOL_OPTIONS: pszOid = "OID_GEN_PROTOCOL_OPTIONS"; break;
+        case OID_GEN_MAC_OPTIONS: pszOid = "OID_GEN_MAC_OPTIONS"; break;
+        case OID_GEN_MEDIA_CONNECT_STATUS: pszOid = "OID_GEN_MEDIA_CONNECT_STATUS"; break;
+        case OID_GEN_MAXIMUM_SEND_PACKETS: pszOid = "OID_GEN_MAXIMUM_SEND_PACKETS"; break;
+        case OID_GEN_SUPPORTED_GUIDS: pszOid = "OID_GEN_SUPPORTED_GUIDS"; break;
+        case OID_GEN_NETWORK_LAYER_ADDRESSES: pszOid = "OID_GEN_NETWORK_LAYER_ADDRESSES"; break;
+        case OID_GEN_TRANSPORT_HEADER_OFFSET: pszOid = "OID_GEN_TRANSPORT_HEADER_OFFSET"; break;
+        case OID_GEN_PHYSICAL_MEDIUM: pszOid = "OID_GEN_PHYSICAL_MEDIUM"; break;
+        case OID_GEN_MACHINE_NAME: pszOid = "OID_GEN_MACHINE_NAME"; break;
+        case OID_GEN_VLAN_ID: pszOid = "OID_GEN_VLAN_ID"; break;
+        case OID_GEN_RNDIS_CONFIG_PARAMETER: pszOid = "OID_GEN_RNDIS_CONFIG_PARAMETER"; break;
+        case OID_GEN_NDIS_RESERVED_1: pszOid = "OID_GEN_NDIS_RESERVED_1"; break;
+        case OID_GEN_NDIS_RESERVED_2: pszOid = "OID_GEN_NDIS_RESERVED_2"; break;
+        case OID_GEN_NDIS_RESERVED_5: pszOid = "OID_GEN_NDIS_RESERVED_5"; break;
+        case OID_GEN_MEDIA_CAPABILITIES: pszOid = "OID_GEN_MEDIA_CAPABILITIES"; break;
+        case OID_GEN_DEVICE_PROFILE: pszOid = "OID_GEN_DEVICE_PROFILE"; break;
+        case OID_GEN_FRIENDLY_NAME: pszOid = "OID_GEN_FRIENDLY_NAME"; break;
+        case OID_802_3_ADD_MULTICAST_ADDRESS: pszOid = "OID_802_3_ADD_MULTICAST_ADDRESS"; break;
+        case OID_802_3_DELETE_MULTICAST_ADDRESS: pszOid = "OID_802_3_DELETE_MULTICAST_ADDRESS"; break;
+        case OID_802_3_PERMANENT_ADDRESS: pszOid = "OID_802_3_PERMANENT_ADDRESS"; break;
+        case OID_802_3_CURRENT_ADDRESS: pszOid = "OID_802_3_CURRENT_ADDRESS"; break;
+        case OID_802_3_MULTICAST_LIST: pszOid = "OID_802_3_MULTICAST_LIST"; break;
+        case OID_802_3_MAXIMUM_LIST_SIZE: pszOid = "OID_802_3_MAXIMUM_LIST_SIZE"; break;
+        case OID_802_3_MAC_OPTIONS: pszOid = "OID_802_3_MAC_OPTIONS"; break;
+        case OID_TCP_TASK_OFFLOAD: pszOid = "OID_TCP_TASK_OFFLOAD"; break;
+        case OID_TCP_TASK_IPSEC_ADD_SA: pszOid = "OID_TCP_TASK_IPSEC_ADD_SA"; break;
+        case OID_TCP_TASK_IPSEC_ADD_UDPESP_SA: pszOid = "OID_TCP_TASK_IPSEC_ADD_UDPESP_SA"; break;
+        case OID_TCP_TASK_IPSEC_DELETE_SA: pszOid = "OID_TCP_TASK_IPSEC_DELETE_SA"; break;
+        case OID_TCP_TASK_IPSEC_DELETE_UDPESP_SA: pszOid = "OID_TCP_TASK_IPSEC_DELETE_UDPESP_SA"; break;
+
+        case OID_GEN_STATISTICS: pszOid = "OID_GEN_STATISTICS"; break;
+        case OID_GEN_BYTES_RCV: pszOid = "OID_GEN_BYTES_RCV"; break;
+        case OID_GEN_BYTES_XMIT: pszOid = "OID_GEN_BYTES_XMIT"; break;
+        case OID_GEN_RCV_DISCARDS: pszOid = "OID_GEN_RCV_DISCARDS"; break;
+        case OID_GEN_XMIT_DISCARDS: pszOid = "OID_GEN_XMIT_DISCARDS"; break;
+        case OID_GEN_XMIT_OK: pszOid = "OID_GEN_XMIT_OK"; break;
+        case OID_GEN_RCV_OK: pszOid = "OID_GEN_RCV_OK"; break;
+        case OID_GEN_XMIT_ERROR: pszOid = "OID_GEN_XMIT_ERROR"; break;
+        case OID_GEN_RCV_ERROR: pszOid = "OID_GEN_RCV_ERROR"; break;
+        case OID_GEN_RCV_NO_BUFFER: pszOid = "OID_GEN_RCV_NO_BUFFER"; break;
+        case OID_GEN_DIRECTED_BYTES_XMIT: pszOid = "OID_GEN_DIRECTED_BYTES_XMIT"; break;
+        case OID_GEN_DIRECTED_FRAMES_XMIT: pszOid = "OID_GEN_DIRECTED_FRAMES_XMIT"; break;
+        case OID_GEN_MULTICAST_BYTES_XMIT: pszOid = "OID_GEN_MULTICAST_BYTES_XMIT"; break;
+        case OID_GEN_MULTICAST_FRAMES_XMIT: pszOid = "OID_GEN_MULTICAST_FRAMES_XMIT"; break;
+        case OID_GEN_BROADCAST_BYTES_XMIT: pszOid = "OID_GEN_BROADCAST_BYTES_XMIT"; break;
+        case OID_GEN_BROADCAST_FRAMES_XMIT: pszOid = "OID_GEN_BROADCAST_FRAMES_XMIT"; break;
+        case OID_GEN_DIRECTED_BYTES_RCV: pszOid = "OID_GEN_DIRECTED_BYTES_RCV"; break;
+        case OID_GEN_DIRECTED_FRAMES_RCV: pszOid = "OID_GEN_DIRECTED_FRAMES_RCV"; break;
+        case OID_GEN_MULTICAST_BYTES_RCV: pszOid = "OID_GEN_MULTICAST_BYTES_RCV"; break;
+        case OID_GEN_MULTICAST_FRAMES_RCV: pszOid = "OID_GEN_MULTICAST_FRAMES_RCV"; break;
+        case OID_GEN_BROADCAST_BYTES_RCV: pszOid = "OID_GEN_BROADCAST_BYTES_RCV"; break;
+        case OID_GEN_BROADCAST_FRAMES_RCV: pszOid = "OID_GEN_BROADCAST_FRAMES_RCV"; break;
+        case OID_GEN_RCV_CRC_ERROR: pszOid = "OID_GEN_RCV_CRC_ERROR"; break;
+        case OID_GEN_TRANSMIT_QUEUE_LENGTH: pszOid = "OID_GEN_TRANSMIT_QUEUE_LENGTH"; break;
+        case OID_GEN_INIT_TIME_MS: pszOid = "OID_GEN_INIT_TIME_MS"; break;
+        case OID_GEN_RESET_COUNTS: pszOid = "OID_GEN_RESET_COUNTS"; break;
+        case OID_GEN_MEDIA_SENSE_COUNTS: pszOid = "OID_GEN_MEDIA_SENSE_COUNTS"; break;
+
+        case OID_PNP_CAPABILITIES: pszOid = "OID_PNP_CAPABILITIES"; break;
+        case OID_PNP_SET_POWER: pszOid = "OID_PNP_SET_POWER"; break;
+        case OID_PNP_QUERY_POWER: pszOid = "OID_PNP_QUERY_POWER"; break;
+        case OID_PNP_ADD_WAKE_UP_PATTERN: pszOid = "OID_PNP_ADD_WAKE_UP_PATTERN"; break;
+        case OID_PNP_REMOVE_WAKE_UP_PATTERN: pszOid = "OID_PNP_REMOVE_WAKE_UP_PATTERN"; break;
+        case OID_PNP_WAKE_UP_PATTERN_LIST: pszOid = "OID_PNP_WAKE_UP_PATTERN_LIST"; break;
+        case OID_PNP_ENABLE_WAKE_UP: pszOid = "OID_PNP_ENABLE_WAKE_UP"; break;
+        case OID_PNP_WAKE_UP_OK: pszOid = "OID_PNP_WAKE_UP_OK"; break;
+        case OID_PNP_WAKE_UP_ERROR: pszOid = "OID_PNP_WAKE_UP_ERROR"; break;
+    }
+    Log(("%s: %s(0x%x) %s(0x%x)\n", pcszFunction, pszType, pRequest->RequestType, pszOid, pRequest->DATA.SET_INFORMATION.Oid));
+}
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf-win.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf-win.cpp
new file mode 100644
index 0000000..83b47e3
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf-win.cpp
@@ -0,0 +1,2263 @@
+/* $Id: VBoxNetLwf-win.cpp $ */
+/** @file
+ * VBoxNetLwf-win.cpp - NDIS6 Bridged Networking Driver, Windows-specific code.
+ */
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#define LOG_GROUP LOG_GROUP_NET_FLT_DRV
+
+//#define VBOXNETLWF_SYNC_SEND
+#define VBOXNETLWF_NO_BYPASS
+
+#include <VBox/version.h>
+#include <VBox/err.h>
+#include <iprt/initterm.h>
+#include <iprt/net.h>
+#include <iprt/list.h>
+#include <VBox/intnetinline.h>
+
+/// @todo Not sure why, but can it help with build errors?
+RT_C_DECLS_BEGIN
+/* ntddk.h has a missing #pragma pack(), work around it
+ * see #ifdef VBOX_WITH_WORKAROUND_MISSING_PACK below for detail */
+#define VBOX_WITH_WORKAROUND_MISSING_PACK
+#if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
+#  define _InterlockedExchange           _InterlockedExchange_StupidDDKVsCompilerCrap
+#  define _InterlockedExchangeAdd        _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
+#  define _InterlockedCompareExchange    _InterlockedCompareExchange_StupidDDKVsCompilerCrap
+#  define _InterlockedAddLargeStatistic  _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
+#  define _interlockedbittestandset      _interlockedbittestandset_StupidDDKVsCompilerCrap
+#  define _interlockedbittestandreset    _interlockedbittestandreset_StupidDDKVsCompilerCrap
+#  define _interlockedbittestandset64    _interlockedbittestandset64_StupidDDKVsCompilerCrap
+#  define _interlockedbittestandreset64  _interlockedbittestandreset64_StupidDDKVsCompilerCrap
+#  pragma warning(disable : 4163)
+#  ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
+#    pragma warning(disable : 4103)
+#  endif
+#  include <ntddk.h>
+#  pragma warning(default : 4163)
+#  ifdef VBOX_WITH_WORKAROUND_MISSING_PACK
+#    pragma pack()
+#    pragma warning(default : 4103)
+#  endif
+#  undef  _InterlockedExchange
+#  undef  _InterlockedExchangeAdd
+#  undef  _InterlockedCompareExchange
+#  undef  _InterlockedAddLargeStatistic
+#  undef  _interlockedbittestandset
+#  undef  _interlockedbittestandreset
+#  undef  _interlockedbittestandset64
+#  undef  _interlockedbittestandreset64
+#  include <ndis.h>
+#else
+//#  include <ntddk.h>
+/* can include ndis.h right away */
+#  include <ndis.h>
+#endif
+RT_C_DECLS_END
+
+#if 0
+#undef Log
+#define Log(x) DbgPrint x
+#undef LogFlow
+#define LogFlow(x) DbgPrint x
+#endif
+
+/** We have an entirely different structure than the one defined in VBoxNetFltCmn-win.h */
+typedef struct VBOXNETFLTWIN
+{
+    /** filter module context handle */
+    NDIS_HANDLE hModuleCtx;
+} VBOXNETFLTWIN, *PVBOXNETFLTWIN;
+#define VBOXNETFLT_NO_PACKET_QUEUE
+#define VBOXNETFLT_OS_SPECFIC 1
+#include "VBoxNetFltInternal.h"
+
+#include "VBoxNetLwf-win.h"
+#include "VBoxNetCmn-win.h"
+
+/* Forward declarations */
+FILTER_ATTACH vboxNetLwfWinAttach;
+FILTER_DETACH vboxNetLwfWinDetach;
+FILTER_RESTART vboxNetLwfWinRestart;
+FILTER_PAUSE vboxNetLwfWinPause;
+FILTER_OID_REQUEST vboxNetLwfWinOidRequest;
+FILTER_OID_REQUEST_COMPLETE vboxNetLwfWinOidRequestComplete;
+//FILTER_CANCEL_OID_REQUEST vboxNetLwfWinCancelOidRequest;
+FILTER_STATUS vboxNetLwfWinStatus;
+FILTER_SET_MODULE_OPTIONS vboxNetLwfWinSetModuleOptions;
+//FILTER_NET_PNP_EVENT vboxNetLwfWinPnPEvent;
+FILTER_SEND_NET_BUFFER_LISTS vboxNetLwfWinSendNetBufferLists;
+FILTER_SEND_NET_BUFFER_LISTS_COMPLETE vboxNetLwfWinSendNetBufferListsComplete;
+FILTER_RECEIVE_NET_BUFFER_LISTS vboxNetLwfWinReceiveNetBufferLists;
+FILTER_RETURN_NET_BUFFER_LISTS vboxNetLwfWinReturnNetBufferLists;
+KSTART_ROUTINE vboxNetLwfWinInitIdcWorker;
+
+typedef enum {
+    LwfState_Detached = 0,
+    LwfState_Attaching,
+    LwfState_Paused,
+    LwfState_Restarting,
+    LwfState_Running,
+    LwfState_Pausing,
+    LwfState_32BitHack = 0x7fffffff
+} VBOXNETLWFSTATE;
+
+/*
+ * Valid state transitions are:
+ * 1) Disconnected -> Connecting   : start the worker thread, attempting to init IDC;
+ * 2) Connecting   -> Disconnected : failed to start IDC init worker thread;
+ * 3) Connecting   -> Connected    : IDC init successful, terminate the worker;
+ * 4) Connecting   -> Stopping     : IDC init incomplete, but the driver is being unloaded, terminate the worker;
+ * 5) Connected    -> Stopping     : IDC init was successful, no worker, the driver is being unloaded;
+ *
+ * Driver terminates in Stopping state.
+ */
+typedef enum {
+    LwfIdcState_Disconnected = 0, /* Initial state */
+    LwfIdcState_Connecting,       /* Attemping to init IDC, worker thread running */
+    LwfIdcState_Connected,        /* Successfully connected to IDC, worker thread terminated */
+    LwfIdcState_Stopping          /* Terminating the worker thread and disconnecting IDC */
+} VBOXNETLWFIDCSTATE;
+
+struct _VBOXNETLWF_MODULE;
+
+typedef struct VBOXNETLWFGLOBALS
+{
+    /** synch event used for device creation synchronization */
+    //KEVENT SynchEvent;
+    /** Device reference count */
+    //int cDeviceRefs;
+    /** ndis device */
+    NDIS_HANDLE hDevice;
+    /** device object */
+    PDEVICE_OBJECT pDevObj;
+    /** our filter driver handle */
+    NDIS_HANDLE hFilterDriver;
+    /** lock protecting the module list */
+    NDIS_SPIN_LOCK Lock;
+    /** the head of module list */
+    RTLISTANCHOR listModules;
+    /** IDC initialization state */
+    volatile uint32_t enmIdcState;
+    /** IDC init thread handle */
+    HANDLE hInitIdcThread;
+} VBOXNETLWFGLOBALS, *PVBOXNETLWFGLOBALS;
+
+/**
+ * The (common) global data.
+ */
+static VBOXNETFLTGLOBALS g_VBoxNetFltGlobals;
+/* win-specific global data */
+VBOXNETLWFGLOBALS g_VBoxNetLwfGlobals;
+
+typedef struct _VBOXNETLWF_MODULE {
+    RTLISTNODE node;
+
+    NDIS_HANDLE hFilter;
+    NDIS_HANDLE hPool;
+    PVBOXNETLWFGLOBALS pGlobals;
+    /** Associated instance of NetFlt, one-to-one relationship */
+    PVBOXNETFLTINS pNetFlt; /// @todo Consider automic access!
+    /** Module state as described in http://msdn.microsoft.com/en-us/library/windows/hardware/ff550017(v=vs.85).aspx */
+    volatile uint32_t enmState; /* No lock needed yet, atomic should suffice. */
+    /** Mutex to prevent pausing while transmitting on behalf of NetFlt */
+    NDIS_MUTEX InTransmit;
+#ifdef VBOXNETLWF_SYNC_SEND
+    /** Event signalled when sending to the wire is complete */
+    KEVENT EventWire;
+    /** Event signalled when NDIS returns our receive notification */
+    KEVENT EventHost;
+#else /* !VBOXNETLWF_SYNC_SEND */
+    /** Event signalled when all pending sends (both to wire and host) have completed */
+    NDIS_EVENT EventSendComplete;
+    /** Counter for pending sends (both to wire and host) */
+    int32_t cPendingBuffers;
+#endif /* !VBOXNETLWF_SYNC_SEND */
+    /** Name of underlying adapter */
+    ANSI_STRING strMiniportName;
+    /** MAC address of underlying adapter */
+    RTMAC MacAddr;
+    /** Saved offload configuration */
+    NDIS_OFFLOAD SavedOffloadConfig;
+    /** the cloned request we have passed down */
+    PNDIS_OID_REQUEST pPendingRequest;
+    /** true if the underlying miniport supplied offloading config */
+    bool fOffloadConfigValid;
+    /** true if the trunk expects data from us */
+    bool fActive;
+    /** true if the host wants the adapter to be in promisc mode */
+    bool fHostPromisc;
+} VBOXNETLWF_MODULE;
+typedef VBOXNETLWF_MODULE *PVBOXNETLWF_MODULE;
+
+/*
+ * A structure to wrap OID requests in.
+ */
+typedef struct _VBOXNETLWF_OIDREQ {
+    NDIS_OID_REQUEST Request;
+    NDIS_STATUS Status;
+    NDIS_EVENT Event;
+} VBOXNETLWF_OIDREQ;
+typedef VBOXNETLWF_OIDREQ *PVBOXNETLWF_OIDREQ;
+
+/* Forward declarations */
+static VOID vboxNetLwfWinUnloadDriver(IN PDRIVER_OBJECT pDriver);
+static int vboxNetLwfWinInitBase();
+static int vboxNetLwfWinFini();
+
+#ifdef DEBUG
+static const char *vboxNetLwfWinStatusToText(NDIS_STATUS code)
+{
+    switch (code)
+    {
+        case NDIS_STATUS_MEDIA_CONNECT: return "NDIS_STATUS_MEDIA_CONNECT";
+        case NDIS_STATUS_MEDIA_DISCONNECT: return "NDIS_STATUS_MEDIA_DISCONNECT";
+        case NDIS_STATUS_RESET_START: return "NDIS_STATUS_RESET_START";
+        case NDIS_STATUS_RESET_END: return "NDIS_STATUS_RESET_END";
+        case NDIS_STATUS_MEDIA_BUSY: return "NDIS_STATUS_MEDIA_BUSY";
+        case NDIS_STATUS_MEDIA_SPECIFIC_INDICATION: return "NDIS_STATUS_MEDIA_SPECIFIC_INDICATION";
+        case NDIS_STATUS_LINK_SPEED_CHANGE: return "NDIS_STATUS_LINK_SPEED_CHANGE";
+        case NDIS_STATUS_LINK_STATE: return "NDIS_STATUS_LINK_STATE";
+        case NDIS_STATUS_PORT_STATE: return "NDIS_STATUS_PORT_STATE";
+        case NDIS_STATUS_OPER_STATUS: return "NDIS_STATUS_OPER_STATUS";
+        case NDIS_STATUS_NETWORK_CHANGE: return "NDIS_STATUS_NETWORK_CHANGE";
+        case NDIS_STATUS_PACKET_FILTER: return "NDIS_STATUS_PACKET_FILTER";
+        case NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG: return "NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG";
+        case NDIS_STATUS_TASK_OFFLOAD_HARDWARE_CAPABILITIES: return "NDIS_STATUS_TASK_OFFLOAD_HARDWARE_CAPABILITIES";
+        case NDIS_STATUS_OFFLOAD_ENCASPULATION_CHANGE: return "NDIS_STATUS_OFFLOAD_ENCASPULATION_CHANGE";
+        case NDIS_STATUS_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES: return "NDIS_STATUS_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES";
+    }
+    return "unknown";
+}
+
+static void vboxNetLwfWinDumpFilterTypes(ULONG uFlags)
+{
+    if (uFlags & NDIS_PACKET_TYPE_DIRECTED) Log5(("   NDIS_PACKET_TYPE_DIRECTED\n"));
+    if (uFlags & NDIS_PACKET_TYPE_MULTICAST) Log5(("   NDIS_PACKET_TYPE_MULTICAST\n"));
+    if (uFlags & NDIS_PACKET_TYPE_ALL_MULTICAST) Log5(("   NDIS_PACKET_TYPE_ALL_MULTICAST\n"));
+    if (uFlags & NDIS_PACKET_TYPE_BROADCAST) Log5(("   NDIS_PACKET_TYPE_BROADCAST\n"));
+    if (uFlags & NDIS_PACKET_TYPE_PROMISCUOUS) Log5(("   NDIS_PACKET_TYPE_PROMISCUOUS\n"));
+    if (uFlags & NDIS_PACKET_TYPE_ALL_FUNCTIONAL) Log5(("   NDIS_PACKET_TYPE_ALL_FUNCTIONAL\n"));
+    if (uFlags & NDIS_PACKET_TYPE_ALL_LOCAL) Log5(("   NDIS_PACKET_TYPE_ALL_LOCAL\n"));
+    if (uFlags & NDIS_PACKET_TYPE_FUNCTIONAL) Log5(("   NDIS_PACKET_TYPE_FUNCTIONAL\n"));
+    if (uFlags & NDIS_PACKET_TYPE_GROUP) Log5(("   NDIS_PACKET_TYPE_GROUP\n"));
+    if (uFlags & NDIS_PACKET_TYPE_MAC_FRAME) Log5(("   NDIS_PACKET_TYPE_MAC_FRAME\n"));
+    if (uFlags & NDIS_PACKET_TYPE_SMT) Log5(("   NDIS_PACKET_TYPE_SMT\n"));
+    if (uFlags & NDIS_PACKET_TYPE_SOURCE_ROUTING) Log5(("   NDIS_PACKET_TYPE_SOURCE_ROUTING\n"));
+    if (uFlags == 0) Log5(("   NONE\n"));
+}
+
+DECLINLINE(void) vboxNetLwfWinDumpEncapsulation(const char *pcszText, ULONG uEncapsulation)
+{
+    if (uEncapsulation == NDIS_ENCAPSULATION_NOT_SUPPORTED)
+        Log5(("%s not supported\n", pcszText));
+    else
+    {
+        Log5(("%s", pcszText));
+        if (uEncapsulation & NDIS_ENCAPSULATION_NULL)
+            Log5((" null"));
+        if (uEncapsulation & NDIS_ENCAPSULATION_IEEE_802_3)
+            Log5((" 802.3"));
+        if (uEncapsulation & NDIS_ENCAPSULATION_IEEE_802_3_P_AND_Q)
+            Log5((" 802.3pq"));
+        if (uEncapsulation & NDIS_ENCAPSULATION_IEEE_802_3_P_AND_Q_IN_OOB)
+            Log5((" 802.3pq(oob)"));
+        if (uEncapsulation & NDIS_ENCAPSULATION_IEEE_LLC_SNAP_ROUTED)
+            Log5((" LLC"));
+        Log5(("\n"));
+    }
+}
+
+DECLINLINE(const char *) vboxNetLwfWinSetOnOffText(ULONG uOnOff)
+{
+    switch (uOnOff)
+    {
+        case NDIS_OFFLOAD_SET_NO_CHANGE: return "no change";
+        case NDIS_OFFLOAD_SET_ON: return "on";
+        case NDIS_OFFLOAD_SET_OFF: return "off";
+    }
+    return "unknown";
+}
+
+DECLINLINE(const char *) vboxNetLwfWinOnOffText(ULONG uOnOff)
+{
+    switch (uOnOff)
+    {
+        case NDIS_OFFLOAD_NOT_SUPPORTED: return "off";
+        case NDIS_OFFLOAD_SUPPORTED: return "on";
+    }
+    return "unknown";
+}
+
+DECLINLINE(const char *) vboxNetLwfWinSupportedText(ULONG uSupported)
+{
+    switch (uSupported)
+    {
+        case NDIS_OFFLOAD_NOT_SUPPORTED: return "not supported";
+        case NDIS_OFFLOAD_SUPPORTED: return "supported";
+    }
+    return "unknown";
+}
+
+static void vboxNetLwfWinDumpSetOffloadSettings(PNDIS_OFFLOAD pOffloadConfig)
+{
+    vboxNetLwfWinDumpEncapsulation("   Checksum.IPv4Transmit.Encapsulation               =", pOffloadConfig->Checksum.IPv4Transmit.Encapsulation);
+    Log5(("   Checksum.IPv4Transmit.IpOptionsSupported          = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Transmit.IpOptionsSupported)));
+    Log5(("   Checksum.IPv4Transmit.TcpOptionsSupported         = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Transmit.TcpOptionsSupported)));
+    Log5(("   Checksum.IPv4Transmit.TcpChecksum                 = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Transmit.TcpChecksum)));
+    Log5(("   Checksum.IPv4Transmit.UdpChecksum                 = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Transmit.UdpChecksum)));
+    Log5(("   Checksum.IPv4Transmit.IpChecksum                  = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Transmit.IpChecksum)));
+    vboxNetLwfWinDumpEncapsulation("   Checksum.IPv4Receive.Encapsulation                =", pOffloadConfig->Checksum.IPv4Receive.Encapsulation);
+    Log5(("   Checksum.IPv4Receive.IpOptionsSupported           = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Receive.IpOptionsSupported)));
+    Log5(("   Checksum.IPv4Receive.TcpOptionsSupported          = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Receive.TcpOptionsSupported)));
+    Log5(("   Checksum.IPv4Receive.TcpChecksum                  = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Receive.TcpChecksum)));
+    Log5(("   Checksum.IPv4Receive.UdpChecksum                  = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Receive.UdpChecksum)));
+    Log5(("   Checksum.IPv4Receive.IpChecksum                   = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv4Receive.IpChecksum)));
+    vboxNetLwfWinDumpEncapsulation("   Checksum.IPv6Transmit.Encapsulation               =", pOffloadConfig->Checksum.IPv6Transmit.Encapsulation);
+    Log5(("   Checksum.IPv6Transmit.IpExtensionHeadersSupported = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv6Transmit.IpExtensionHeadersSupported)));
+    Log5(("   Checksum.IPv6Transmit.TcpOptionsSupported         = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv6Transmit.TcpOptionsSupported)));
+    Log5(("   Checksum.IPv6Transmit.TcpChecksum                 = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv6Transmit.TcpChecksum)));
+    Log5(("   Checksum.IPv6Transmit.UdpChecksum                 = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv6Transmit.UdpChecksum)));
+    vboxNetLwfWinDumpEncapsulation("   Checksum.IPv6Receive.Encapsulation                =", pOffloadConfig->Checksum.IPv6Receive.Encapsulation);
+    Log5(("   Checksum.IPv6Receive.IpExtensionHeadersSupported  = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv6Receive.IpExtensionHeadersSupported)));
+    Log5(("   Checksum.IPv6Receive.TcpOptionsSupported          = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv6Receive.TcpOptionsSupported)));
+    Log5(("   Checksum.IPv6Receive.TcpChecksum                  = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv6Receive.TcpChecksum)));
+    Log5(("   Checksum.IPv6Receive.UdpChecksum                  = %s\n", vboxNetLwfWinSetOnOffText(pOffloadConfig->Checksum.IPv6Receive.UdpChecksum)));
+    vboxNetLwfWinDumpEncapsulation("   LsoV1.IPv4.Encapsulation                          =", pOffloadConfig->LsoV1.IPv4.Encapsulation);
+    Log5(("   LsoV1.IPv4.TcpOptions                             = %s\n", vboxNetLwfWinSupportedText(pOffloadConfig->LsoV1.IPv4.TcpOptions)));
+    Log5(("   LsoV1.IPv4.IpOptions                              = %s\n", vboxNetLwfWinSupportedText(pOffloadConfig->LsoV1.IPv4.IpOptions)));
+    vboxNetLwfWinDumpEncapsulation("   LsoV2.IPv4.Encapsulation                          =", pOffloadConfig->LsoV2.IPv4.Encapsulation);
+    vboxNetLwfWinDumpEncapsulation("   LsoV2.IPv6.Encapsulation                          =", pOffloadConfig->LsoV2.IPv6.Encapsulation);
+    Log5(("   LsoV2.IPv6.IpExtensionHeadersSupported            = %s\n", vboxNetLwfWinSupportedText(pOffloadConfig->LsoV2.IPv6.IpExtensionHeadersSupported)));
+    Log5(("   LsoV2.IPv6.TcpOptionsSupported                    = %s\n", vboxNetLwfWinSupportedText(pOffloadConfig->LsoV2.IPv6.TcpOptionsSupported)));
+}
+
+static void vboxNetLwfWinDumpOffloadSettings(PNDIS_OFFLOAD pOffloadConfig)
+{
+    vboxNetLwfWinDumpEncapsulation("   Checksum.IPv4Transmit.Encapsulation               =", pOffloadConfig->Checksum.IPv4Transmit.Encapsulation);
+    Log5(("   Checksum.IPv4Transmit.IpOptionsSupported          = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Transmit.IpOptionsSupported)));
+    Log5(("   Checksum.IPv4Transmit.TcpOptionsSupported         = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Transmit.TcpOptionsSupported)));
+    Log5(("   Checksum.IPv4Transmit.TcpChecksum                 = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Transmit.TcpChecksum)));
+    Log5(("   Checksum.IPv4Transmit.UdpChecksum                 = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Transmit.UdpChecksum)));
+    Log5(("   Checksum.IPv4Transmit.IpChecksum                  = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Transmit.IpChecksum)));
+    vboxNetLwfWinDumpEncapsulation("   Checksum.IPv4Receive.Encapsulation                =", pOffloadConfig->Checksum.IPv4Receive.Encapsulation);
+    Log5(("   Checksum.IPv4Receive.IpOptionsSupported           = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Receive.IpOptionsSupported)));
+    Log5(("   Checksum.IPv4Receive.TcpOptionsSupported          = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Receive.TcpOptionsSupported)));
+    Log5(("   Checksum.IPv4Receive.TcpChecksum                  = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Receive.TcpChecksum)));
+    Log5(("   Checksum.IPv4Receive.UdpChecksum                  = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Receive.UdpChecksum)));
+    Log5(("   Checksum.IPv4Receive.IpChecksum                   = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv4Receive.IpChecksum)));
+    vboxNetLwfWinDumpEncapsulation("   Checksum.IPv6Transmit.Encapsulation               =", pOffloadConfig->Checksum.IPv6Transmit.Encapsulation);
+    Log5(("   Checksum.IPv6Transmit.IpExtensionHeadersSupported = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv6Transmit.IpExtensionHeadersSupported)));
+    Log5(("   Checksum.IPv6Transmit.TcpOptionsSupported         = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv6Transmit.TcpOptionsSupported)));
+    Log5(("   Checksum.IPv6Transmit.TcpChecksum                 = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv6Transmit.TcpChecksum)));
+    Log5(("   Checksum.IPv6Transmit.UdpChecksum                 = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv6Transmit.UdpChecksum)));
+    vboxNetLwfWinDumpEncapsulation("   Checksum.IPv6Receive.Encapsulation                =", pOffloadConfig->Checksum.IPv6Receive.Encapsulation);
+    Log5(("   Checksum.IPv6Receive.IpExtensionHeadersSupported  = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv6Receive.IpExtensionHeadersSupported)));
+    Log5(("   Checksum.IPv6Receive.TcpOptionsSupported          = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv6Receive.TcpOptionsSupported)));
+    Log5(("   Checksum.IPv6Receive.TcpChecksum                  = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv6Receive.TcpChecksum)));
+    Log5(("   Checksum.IPv6Receive.UdpChecksum                  = %s\n", vboxNetLwfWinOnOffText(pOffloadConfig->Checksum.IPv6Receive.UdpChecksum)));
+    vboxNetLwfWinDumpEncapsulation("   LsoV1.IPv4.Encapsulation                          =", pOffloadConfig->LsoV1.IPv4.Encapsulation);
+    Log5(("   LsoV1.IPv4.TcpOptions                             = %s\n", vboxNetLwfWinSupportedText(pOffloadConfig->LsoV1.IPv4.TcpOptions)));
+    Log5(("   LsoV1.IPv4.IpOptions                              = %s\n", vboxNetLwfWinSupportedText(pOffloadConfig->LsoV1.IPv4.IpOptions)));
+    vboxNetLwfWinDumpEncapsulation("   LsoV2.IPv4.Encapsulation                          =", pOffloadConfig->LsoV2.IPv4.Encapsulation);
+    vboxNetLwfWinDumpEncapsulation("   LsoV2.IPv6.Encapsulation                          =", pOffloadConfig->LsoV2.IPv6.Encapsulation);
+    Log5(("   LsoV2.IPv6.IpExtensionHeadersSupported            = %s\n", vboxNetLwfWinSupportedText(pOffloadConfig->LsoV2.IPv6.IpExtensionHeadersSupported)));
+    Log5(("   LsoV2.IPv6.TcpOptionsSupported                    = %s\n", vboxNetLwfWinSupportedText(pOffloadConfig->LsoV2.IPv6.TcpOptionsSupported)));
+}
+
+static const char *vboxNetLwfWinStateToText(uint32_t enmState)
+{
+    switch (enmState)
+    {
+        case LwfState_Detached: return "Detached";
+        case LwfState_Attaching: return "Attaching";
+        case LwfState_Paused: return "Paused";
+        case LwfState_Restarting: return "Restarting";
+        case LwfState_Running: return "Running";
+        case LwfState_Pausing: return "Pausing";
+    }
+    return "invalid";
+}
+
+#else /* !DEBUG */
+#define vboxNetLwfWinDumpFilterTypes(uFlags)
+#define vboxNetLwfWinDumpOffloadSettings(p)
+#define vboxNetLwfWinDumpSetOffloadSettings(p)
+#endif /* DEBUG */
+
+DECLINLINE(bool) vboxNetLwfWinChangeState(PVBOXNETLWF_MODULE pModuleCtx, uint32_t enmNew, uint32_t enmOld = LwfState_32BitHack)
+{
+    AssertReturn(pModuleCtx, false);
+
+    bool fSuccess = true;
+    if (enmOld != LwfState_32BitHack)
+    {
+        fSuccess = ASMAtomicCmpXchgU32(&pModuleCtx->enmState, enmNew, enmOld);
+        if (fSuccess)
+            Log((__FUNCTION__": state change %s -> %s\n",
+                 vboxNetLwfWinStateToText(enmOld),
+                 vboxNetLwfWinStateToText(enmNew)));
+        else
+            Log((__FUNCTION__": failed state change %s (actual=%s) -> %s\n",
+                 vboxNetLwfWinStateToText(enmOld),
+                 vboxNetLwfWinStateToText(ASMAtomicReadU32(&pModuleCtx->enmState)),
+                 vboxNetLwfWinStateToText(enmNew)));
+        Assert(fSuccess);
+    }
+    else
+    {
+        uint32_t enmPrevState = ASMAtomicXchgU32(&pModuleCtx->enmState, enmNew);
+        Log((__FUNCTION__": state change %s -> %s\n",
+             vboxNetLwfWinStateToText(enmPrevState),
+             vboxNetLwfWinStateToText(enmNew)));
+    }
+    return fSuccess;
+}
+
+DECLINLINE(void) vboxNetLwfWinInitOidRequest(PVBOXNETLWF_OIDREQ pRequest)
+{
+    NdisZeroMemory(pRequest, sizeof(VBOXNETLWF_OIDREQ));
+
+    NdisInitializeEvent(&pRequest->Event);
+
+    pRequest->Request.Header.Type = NDIS_OBJECT_TYPE_OID_REQUEST;
+    pRequest->Request.Header.Revision = NDIS_OID_REQUEST_REVISION_1;
+    pRequest->Request.Header.Size = NDIS_SIZEOF_OID_REQUEST_REVISION_1;
+
+    pRequest->Request.RequestId = (PVOID)VBOXNETLWF_REQ_ID;
+}
+
+static NDIS_STATUS vboxNetLwfWinSyncOidRequest(PVBOXNETLWF_MODULE pModuleCtx, PVBOXNETLWF_OIDREQ pRequest)
+{
+    NDIS_STATUS Status = NdisFOidRequest(pModuleCtx->hFilter, &pRequest->Request);
+    if (Status == NDIS_STATUS_PENDING)
+    {
+        NdisWaitEvent(&pRequest->Event, 0);
+        Status = pRequest->Status;
+    }
+    return Status;
+}
+
+DECLINLINE(void) vboxNetLwfWinCopyOidRequestResults(PNDIS_OID_REQUEST pFrom, PNDIS_OID_REQUEST pTo)
+{
+    switch (pFrom->RequestType)
+    {
+        case NdisRequestSetInformation:
+            pTo->DATA.SET_INFORMATION.BytesRead   = pFrom->DATA.SET_INFORMATION.BytesRead;
+            pTo->DATA.SET_INFORMATION.BytesNeeded = pFrom->DATA.SET_INFORMATION.BytesNeeded;
+            break;
+        case NdisRequestMethod:
+            pTo->DATA.METHOD_INFORMATION.OutputBufferLength = pFrom->DATA.METHOD_INFORMATION.OutputBufferLength;
+            pTo->DATA.METHOD_INFORMATION.BytesWritten       = pFrom->DATA.METHOD_INFORMATION.BytesWritten;
+            pTo->DATA.METHOD_INFORMATION.BytesRead          = pFrom->DATA.METHOD_INFORMATION.BytesRead;
+            pTo->DATA.METHOD_INFORMATION.BytesNeeded        = pFrom->DATA.METHOD_INFORMATION.BytesNeeded;
+            break;
+        case NdisRequestQueryInformation:
+        case NdisRequestQueryStatistics:
+        default:
+            pTo->DATA.QUERY_INFORMATION.BytesWritten = pFrom->DATA.QUERY_INFORMATION.BytesWritten;
+            pTo->DATA.QUERY_INFORMATION.BytesNeeded  = pFrom->DATA.QUERY_INFORMATION.BytesNeeded;
+    }
+}
+
+void inline vboxNetLwfWinOverridePacketFiltersUp(PVBOXNETLWF_MODULE pModuleCtx, ULONG *pFilters)
+{
+    if (ASMAtomicReadBool(&pModuleCtx->fActive) && !ASMAtomicReadBool(&pModuleCtx->fHostPromisc))
+        *pFilters &= ~NDIS_PACKET_TYPE_PROMISCUOUS;
+}
+
+NDIS_STATUS vboxNetLwfWinOidRequest(IN NDIS_HANDLE hModuleCtx,
+                                    IN PNDIS_OID_REQUEST pOidRequest)
+{
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    vboxNetCmnWinDumpOidRequest(__FUNCTION__, pOidRequest);
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)hModuleCtx;
+    PNDIS_OID_REQUEST pClone = NULL;
+    NDIS_STATUS Status = NdisAllocateCloneOidRequest(pModuleCtx->hFilter,
+                                                     pOidRequest,
+                                                     VBOXNETLWF_MEM_TAG,
+                                                     &pClone);
+    if (Status == NDIS_STATUS_SUCCESS)
+    {
+        /* Save the pointer to the original */
+        *((PNDIS_OID_REQUEST*)(pClone->SourceReserved)) = pOidRequest;
+
+        pClone->RequestId = pOidRequest->RequestId;
+        /* We are not supposed to get another request until we are through with the one we "postponed" */
+        PNDIS_OID_REQUEST pPrev = ASMAtomicXchgPtrT(&pModuleCtx->pPendingRequest, pClone, PNDIS_OID_REQUEST);
+        Assert(pPrev == NULL);
+        pModuleCtx->pPendingRequest = pClone;
+        if (pOidRequest->RequestType == NdisRequestSetInformation
+            && pOidRequest->DATA.SET_INFORMATION.Oid == OID_GEN_CURRENT_PACKET_FILTER)
+        {
+            ASMAtomicWriteBool(&pModuleCtx->fHostPromisc, !!(*(ULONG*)pOidRequest->DATA.SET_INFORMATION.InformationBuffer & NDIS_PACKET_TYPE_PROMISCUOUS));
+            Log((__FUNCTION__": host wanted to set packet filter value to:\n"));
+            vboxNetLwfWinDumpFilterTypes(*(ULONG*)pOidRequest->DATA.SET_INFORMATION.InformationBuffer);
+            /* Keep adapter in promisc mode as long as we are active. */
+            if (ASMAtomicReadBool(&pModuleCtx->fActive))
+                *(ULONG*)pClone->DATA.SET_INFORMATION.InformationBuffer |= NDIS_PACKET_TYPE_PROMISCUOUS;
+            Log5((__FUNCTION__": pass the following packet filters to miniport:\n"));
+            vboxNetLwfWinDumpFilterTypes(*(ULONG*)pOidRequest->DATA.SET_INFORMATION.InformationBuffer);
+        }
+        if (pOidRequest->RequestType == NdisRequestSetInformation
+            && pOidRequest->DATA.SET_INFORMATION.Oid == OID_TCP_OFFLOAD_CURRENT_CONFIG)
+        {
+            Log5((__FUNCTION__": offloading set to:\n"));
+            vboxNetLwfWinDumpSetOffloadSettings((PNDIS_OFFLOAD)pOidRequest->DATA.SET_INFORMATION.InformationBuffer);
+        }
+
+        /* Forward the clone to underlying filters/miniport */
+        Status = NdisFOidRequest(pModuleCtx->hFilter, pClone);
+        if (Status != NDIS_STATUS_PENDING)
+        {
+            /* Synchronous completion */
+            pPrev = ASMAtomicXchgPtrT(&pModuleCtx->pPendingRequest, NULL, PNDIS_OID_REQUEST);
+            Assert(pPrev == pClone);
+            Log5((__FUNCTION__": got the following packet filters from miniport:\n"));
+            vboxNetLwfWinDumpFilterTypes(*(ULONG*)pOidRequest->DATA.QUERY_INFORMATION.InformationBuffer);
+            /*
+             * The host does not expect the adapter to be in promisc mode,
+             * unless it enabled the mode. Let's not disillusion it.
+             */
+            if (   pOidRequest->RequestType == NdisRequestQueryInformation
+                && pOidRequest->DATA.QUERY_INFORMATION.Oid == OID_GEN_CURRENT_PACKET_FILTER)
+                vboxNetLwfWinOverridePacketFiltersUp(pModuleCtx, (ULONG*)pOidRequest->DATA.QUERY_INFORMATION.InformationBuffer);
+            Log5((__FUNCTION__": reporting to the host the following packet filters:\n"));
+            vboxNetLwfWinDumpFilterTypes(*(ULONG*)pOidRequest->DATA.QUERY_INFORMATION.InformationBuffer);
+            vboxNetLwfWinCopyOidRequestResults(pClone, pOidRequest);
+            NdisFreeCloneOidRequest(pModuleCtx->hFilter, pClone);
+        }
+        /* In case of async completion we do the rest in vboxNetLwfWinOidRequestComplete() */
+    }
+    else
+    {
+        Log((__FUNCTION__": NdisAllocateCloneOidRequest failed with 0x%x\n", Status));
+    }
+    LogFlow(("<=="__FUNCTION__": Status=0x%x\n", Status));
+    return Status;
+}
+
+VOID vboxNetLwfWinOidRequestComplete(IN NDIS_HANDLE hModuleCtx,
+                                     IN PNDIS_OID_REQUEST pRequest,
+                                     IN NDIS_STATUS Status)
+{
+    LogFlow(("==>"__FUNCTION__": module=%p req=%p status=0x%x\n", hModuleCtx, pRequest, Status));
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)hModuleCtx;
+    PNDIS_OID_REQUEST pOriginal = *((PNDIS_OID_REQUEST*)(pRequest->SourceReserved));
+    if (pOriginal)
+    {
+        /* NDIS is supposed to serialize requests */
+        PNDIS_OID_REQUEST pPrev = ASMAtomicXchgPtrT(&pModuleCtx->pPendingRequest, NULL, PNDIS_OID_REQUEST);
+        Assert(pPrev == pRequest);
+
+        Log5((__FUNCTION__": completed rq type=%d oid=%x\n", pRequest->RequestType, pRequest->DATA.QUERY_INFORMATION.Oid));
+        vboxNetLwfWinCopyOidRequestResults(pRequest, pOriginal);
+        if (   pRequest->RequestType == NdisRequestQueryInformation
+            && pRequest->DATA.QUERY_INFORMATION.Oid == OID_GEN_CURRENT_PACKET_FILTER)
+        {
+            Log5((__FUNCTION__": underlying miniport reports its packet filters:\n"));
+            vboxNetLwfWinDumpFilterTypes(*(ULONG*)pRequest->DATA.QUERY_INFORMATION.InformationBuffer);
+            vboxNetLwfWinOverridePacketFiltersUp(pModuleCtx, (ULONG*)pRequest->DATA.QUERY_INFORMATION.InformationBuffer);
+            Log5((__FUNCTION__": reporting the following packet filters to upper protocol:\n"));
+            vboxNetLwfWinDumpFilterTypes(*(ULONG*)pRequest->DATA.QUERY_INFORMATION.InformationBuffer);
+        }
+        NdisFreeCloneOidRequest(pModuleCtx->hFilter, pRequest);
+        NdisFOidRequestComplete(pModuleCtx->hFilter, pOriginal, Status);
+    }
+    else
+    {
+        /* This is not a clone, we originated it */
+        Log((__FUNCTION__": locally originated request (%p) completed, status=0x%x\n", pRequest, Status));
+        PVBOXNETLWF_OIDREQ pRqWrapper = RT_FROM_MEMBER(pRequest, VBOXNETLWF_OIDREQ, Request);
+        pRqWrapper->Status = Status;
+        NdisSetEvent(&pRqWrapper->Event);
+    }
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+
+static bool vboxNetLwfWinIsPromiscuous(PVBOXNETLWF_MODULE pModuleCtx)
+{
+    return ASMAtomicReadBool(&pModuleCtx->fHostPromisc);
+}
+
+#if 0
+static NDIS_STATUS vboxNetLwfWinGetPacketFilter(PVBOXNETLWF_MODULE pModuleCtx)
+{
+    LogFlow(("==>"__FUNCTION__"\n"));
+    VBOXNETLWF_OIDREQ Rq;
+    vboxNetLwfWinInitOidRequest(&Rq);
+    Rq.Request.RequestType = NdisRequestQueryInformation;
+    Rq.Request.DATA.QUERY_INFORMATION.Oid = OID_GEN_CURRENT_PACKET_FILTER;
+    Rq.Request.DATA.QUERY_INFORMATION.InformationBuffer = &pModuleCtx->uPacketFilter;
+    Rq.Request.DATA.QUERY_INFORMATION.InformationBufferLength = sizeof(pModuleCtx->uPacketFilter);
+    NDIS_STATUS Status = vboxNetLwfWinSyncOidRequest(pModuleCtx, &Rq);
+    if (Status != NDIS_STATUS_SUCCESS)
+    {
+        Log((__FUNCTION__": vboxNetLwfWinSyncOidRequest(query, OID_GEN_CURRENT_PACKET_FILTER) failed with 0x%x\n", Status));
+        return FALSE;
+    }
+    if (Rq.Request.DATA.QUERY_INFORMATION.BytesWritten != sizeof(pModuleCtx->uPacketFilter))
+    {
+        Log((__FUNCTION__": vboxNetLwfWinSyncOidRequest(query, OID_GEN_CURRENT_PACKET_FILTER) failed to write neccessary amount (%d bytes), actually written %d bytes\n", sizeof(pModuleCtx->uPacketFilter), Rq.Request.DATA.QUERY_INFORMATION.BytesWritten));
+    }
+
+    Log5((__FUNCTION__": OID_GEN_CURRENT_PACKET_FILTER query returned the following filters:\n"));
+    vboxNetLwfWinDumpFilterTypes(pModuleCtx->uPacketFilter);
+
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+#endif
+
+static NDIS_STATUS vboxNetLwfWinSetPacketFilter(PVBOXNETLWF_MODULE pModuleCtx, bool fPromisc)
+{
+    LogFlow(("==>"__FUNCTION__": module=%p %s\n", pModuleCtx, fPromisc ? "promiscuous" : "normal"));
+    ULONG uFilter = 0;
+    VBOXNETLWF_OIDREQ Rq;
+    vboxNetLwfWinInitOidRequest(&Rq);
+    Rq.Request.RequestType = NdisRequestQueryInformation;
+    Rq.Request.DATA.QUERY_INFORMATION.Oid = OID_GEN_CURRENT_PACKET_FILTER;
+    Rq.Request.DATA.QUERY_INFORMATION.InformationBuffer = &uFilter;
+    Rq.Request.DATA.QUERY_INFORMATION.InformationBufferLength = sizeof(uFilter);
+    NDIS_STATUS Status = vboxNetLwfWinSyncOidRequest(pModuleCtx, &Rq);
+    if (Status != NDIS_STATUS_SUCCESS)
+    {
+        Log((__FUNCTION__": vboxNetLwfWinSyncOidRequest(query, OID_GEN_CURRENT_PACKET_FILTER) failed with 0x%x\n", Status));
+        return Status;
+    }
+    if (Rq.Request.DATA.QUERY_INFORMATION.BytesWritten != sizeof(uFilter))
+    {
+        Log((__FUNCTION__": vboxNetLwfWinSyncOidRequest(query, OID_GEN_CURRENT_PACKET_FILTER) failed to write neccessary amount (%d bytes), actually written %d bytes\n", sizeof(uFilter), Rq.Request.DATA.QUERY_INFORMATION.BytesWritten));
+        return NDIS_STATUS_FAILURE;
+    }
+
+    Log5((__FUNCTION__": OID_GEN_CURRENT_PACKET_FILTER query returned the following filters:\n"));
+    vboxNetLwfWinDumpFilterTypes(uFilter);
+
+    if (fPromisc)
+    {
+        /* If we about to go promiscuous, save the state before we change it. */
+        ASMAtomicWriteBool(&pModuleCtx->fHostPromisc, !!(uFilter & NDIS_PACKET_TYPE_PROMISCUOUS));
+        uFilter |= NDIS_PACKET_TYPE_PROMISCUOUS;
+    }
+    else
+    {
+        /* Reset promisc only if it was not enabled before we had changed it. */
+        if (!ASMAtomicReadBool(&pModuleCtx->fHostPromisc))
+            uFilter &= ~NDIS_PACKET_TYPE_PROMISCUOUS;
+    }
+
+    Log5((__FUNCTION__": OID_GEN_CURRENT_PACKET_FILTER about to set the following filters:\n"));
+    vboxNetLwfWinDumpFilterTypes(uFilter);
+
+    NdisResetEvent(&Rq.Event); /* need to reset as it has been set by query op */
+    Rq.Request.RequestType = NdisRequestSetInformation;
+    Rq.Request.DATA.SET_INFORMATION.Oid = OID_GEN_CURRENT_PACKET_FILTER;
+    Rq.Request.DATA.SET_INFORMATION.InformationBuffer = &uFilter;
+    Rq.Request.DATA.SET_INFORMATION.InformationBufferLength = sizeof(uFilter);
+    Status = vboxNetLwfWinSyncOidRequest(pModuleCtx, &Rq);
+    if (Status != NDIS_STATUS_SUCCESS)
+    {
+        Log((__FUNCTION__": vboxNetLwfWinSyncOidRequest(set, OID_GEN_CURRENT_PACKET_FILTER, vvv below vvv) failed with 0x%x\n", Status));
+        vboxNetLwfWinDumpFilterTypes(uFilter);
+    }
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+
+static NTSTATUS vboxNetLwfWinDevDispatch(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp)
+{
+    PIO_STACK_LOCATION pIrpSl = IoGetCurrentIrpStackLocation(pIrp);;
+    NTSTATUS Status = STATUS_SUCCESS;
+
+    switch (pIrpSl->MajorFunction)
+    {
+        case IRP_MJ_DEVICE_CONTROL:
+            Status = STATUS_NOT_SUPPORTED;
+            break;
+        case IRP_MJ_CREATE:
+        case IRP_MJ_CLEANUP:
+        case IRP_MJ_CLOSE:
+            break;
+        default:
+            Assert(0);
+            break;
+    }
+
+    pIrp->IoStatus.Status = Status;
+    IoCompleteRequest(pIrp, IO_NO_INCREMENT);
+
+    return Status;
+}
+
+/** @todo So far we had no use for device, should we even bother to create it? */
+static NDIS_STATUS vboxNetLwfWinDevCreate(PVBOXNETLWFGLOBALS pGlobals)
+{
+    NDIS_STRING DevName, LinkName;
+    PDRIVER_DISPATCH aMajorFunctions[IRP_MJ_MAXIMUM_FUNCTION+1];
+    NdisInitUnicodeString(&DevName, VBOXNETLWF_NAME_DEVICE);
+    NdisInitUnicodeString(&LinkName, VBOXNETLWF_NAME_LINK);
+
+    Assert(!pGlobals->hDevice);
+    Assert(!pGlobals->pDevObj);
+    NdisZeroMemory(aMajorFunctions, sizeof (aMajorFunctions));
+    aMajorFunctions[IRP_MJ_CREATE] = vboxNetLwfWinDevDispatch;
+    aMajorFunctions[IRP_MJ_CLEANUP] = vboxNetLwfWinDevDispatch;
+    aMajorFunctions[IRP_MJ_CLOSE] = vboxNetLwfWinDevDispatch;
+    aMajorFunctions[IRP_MJ_DEVICE_CONTROL] = vboxNetLwfWinDevDispatch;
+
+    NDIS_DEVICE_OBJECT_ATTRIBUTES DeviceAttributes;
+    NdisZeroMemory(&DeviceAttributes, sizeof(DeviceAttributes));
+    DeviceAttributes.Header.Type = NDIS_OBJECT_TYPE_DEVICE_OBJECT_ATTRIBUTES;
+    DeviceAttributes.Header.Revision = NDIS_DEVICE_OBJECT_ATTRIBUTES_REVISION_1;
+    DeviceAttributes.Header.Size = sizeof(DeviceAttributes);
+    DeviceAttributes.DeviceName = &DevName;
+    DeviceAttributes.SymbolicName = &LinkName;
+    DeviceAttributes.MajorFunctions = aMajorFunctions;
+    //DeviceAttributes.ExtensionSize = sizeof(FILTER_DEVICE_EXTENSION);
+
+    NDIS_STATUS Status = NdisRegisterDeviceEx(pGlobals->hFilterDriver,
+                                              &DeviceAttributes,
+                                              &pGlobals->pDevObj,
+                                              &pGlobals->hDevice);
+    Log(("vboxNetLwfWinDevCreate: NdisRegisterDeviceEx returned 0x%x\n", Status));
+    Assert(Status == NDIS_STATUS_SUCCESS);
+#if 0
+    if (Status == NDIS_STATUS_SUCCESS)
+    {
+        PFILTER_DEVICE_EXTENSION pExtension;
+        pExtension = NdisGetDeviceReservedExtension(pGlobals->pDevObj);
+        pExtension->Signature = VBOXNETLWF_MEM_TAG;
+        pExtension->Handle = pGlobals->hFilterDriver;
+    }
+#endif
+    return Status;
+}
+
+static void vboxNetLwfWinDevDestroy(PVBOXNETLWFGLOBALS pGlobals)
+{
+    Assert(pGlobals->hDevice);
+    Assert(pGlobals->pDevObj);
+    NdisDeregisterDeviceEx(pGlobals->hDevice);
+    pGlobals->hDevice = NULL;
+    pGlobals->pDevObj = NULL;
+}
+
+
+static NDIS_STATUS vboxNetLwfWinAttach(IN NDIS_HANDLE hFilter, IN NDIS_HANDLE hDriverCtx,
+                                       IN PNDIS_FILTER_ATTACH_PARAMETERS pParameters)
+{
+    LogFlow(("==>"__FUNCTION__": filter=%p\n", hFilter));
+
+    PVBOXNETLWFGLOBALS pGlobals = (PVBOXNETLWFGLOBALS)hDriverCtx;
+    AssertReturn(pGlobals, NDIS_STATUS_FAILURE);
+
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)NdisAllocateMemoryWithTagPriority(hFilter,
+                                                                      sizeof(VBOXNETLWF_MODULE),
+                                                                      VBOXNETLWF_MEM_TAG,
+                                                                      LowPoolPriority);
+    if (!pModuleCtx)
+        return NDIS_STATUS_RESOURCES;
+    Log4((__FUNCTION__ ": allocated module context 0x%p\n", pModuleCtx));
+
+    NdisZeroMemory(pModuleCtx, sizeof(VBOXNETLWF_MODULE));
+
+    /* We use the miniport name to associate this filter module with the netflt instance */
+    NTSTATUS rc = RtlUnicodeStringToAnsiString(&pModuleCtx->strMiniportName,
+                                               pParameters->BaseMiniportName,
+                                               TRUE);
+    if (rc != STATUS_SUCCESS)
+    {
+        Log(("ERROR! vboxNetLwfWinAttach: RtlUnicodeStringToAnsiString(%ls) failed with 0x%x\n",
+             pParameters->BaseMiniportName, rc));
+        NdisFreeMemory(pModuleCtx, 0, 0);
+        return NDIS_STATUS_FAILURE;
+    }
+    Assert(pParameters->MacAddressLength == sizeof(RTMAC));
+    NdisMoveMemory(&pModuleCtx->MacAddr, pParameters->CurrentMacAddress, RT_MIN(sizeof(RTMAC), pParameters->MacAddressLength));
+    if (pParameters->DefaultOffloadConfiguration)
+    {
+        pModuleCtx->SavedOffloadConfig = *pParameters->DefaultOffloadConfiguration;
+        pModuleCtx->fOffloadConfigValid = true;
+    }
+
+    pModuleCtx->pGlobals = pGlobals;
+    pModuleCtx->hFilter  = hFilter;
+    vboxNetLwfWinChangeState(pModuleCtx, LwfState_Attaching);
+    /* Insert into module chain */
+    NdisAcquireSpinLock(&pGlobals->Lock);
+    RTListPrepend(&pGlobals->listModules, &pModuleCtx->node);
+    NdisReleaseSpinLock(&pGlobals->Lock);
+    /* Initialize transmission mutex and events */
+    NDIS_INIT_MUTEX(&pModuleCtx->InTransmit);
+#ifdef VBOXNETLWF_SYNC_SEND
+    KeInitializeEvent(&pModuleCtx->EventWire, SynchronizationEvent, FALSE);
+    KeInitializeEvent(&pModuleCtx->EventHost, SynchronizationEvent, FALSE);
+#else /* !VBOXNETLWF_SYNC_SEND */
+    NdisInitializeEvent(&pModuleCtx->EventSendComplete);
+    pModuleCtx->cPendingBuffers = 0;
+#endif /* !VBOXNETLWF_SYNC_SEND */
+    /* Allocate buffer pools */
+    NET_BUFFER_LIST_POOL_PARAMETERS PoolParams;
+    NdisZeroMemory(&PoolParams, sizeof(PoolParams));
+    PoolParams.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
+    PoolParams.Header.Revision = NET_BUFFER_LIST_POOL_PARAMETERS_REVISION_1;
+    PoolParams.Header.Size = sizeof(PoolParams);
+    PoolParams.ProtocolId = NDIS_PROTOCOL_ID_DEFAULT;
+    PoolParams.fAllocateNetBuffer = TRUE;
+    PoolParams.ContextSize = 0; /** @todo Do we need to consider underlying drivers? I think not. */
+    PoolParams.PoolTag = VBOXNETLWF_MEM_TAG;
+#ifndef VBOXNETLWF_SYNC_SEND
+    PoolParams.DataSize = 2048; /** @todo figure out the optimal size, use several pools if necessary, make configurable, etc */
+#endif /* !VBOXNETLWF_SYNC_SEND */
+
+    pModuleCtx->hPool = NdisAllocateNetBufferListPool(hFilter, &PoolParams);
+    if (!pModuleCtx->hPool)
+    {
+        Log(("ERROR! "__FUNCTION__": NdisAllocateNetBufferListPool failed\n"));
+        RtlFreeAnsiString(&pModuleCtx->strMiniportName);
+        NdisFreeMemory(pModuleCtx, 0, 0);
+        return NDIS_STATUS_RESOURCES;
+    }
+    Log4((__FUNCTION__ ": allocated NBL+NB pool 0x%p\n", pModuleCtx->hPool));
+
+    NDIS_FILTER_ATTRIBUTES Attributes;
+    NdisZeroMemory(&Attributes, sizeof(Attributes));
+    Attributes.Header.Revision = NDIS_FILTER_ATTRIBUTES_REVISION_1;
+    Attributes.Header.Size = sizeof(Attributes);
+    Attributes.Header.Type = NDIS_OBJECT_TYPE_FILTER_ATTRIBUTES;
+    Attributes.Flags = 0;
+    NDIS_STATUS Status = NdisFSetAttributes(hFilter, pModuleCtx, &Attributes);
+    if (Status != NDIS_STATUS_SUCCESS)
+    {
+        Log(("ERROR! vboxNetLwfWinAttach: NdisFSetAttributes failed with 0x%x\n", Status));
+        NdisFreeNetBufferListPool(pModuleCtx->hPool);
+        Log4((__FUNCTION__ ": freed NBL+NB pool 0x%p\n", pModuleCtx->hPool));
+        RtlFreeAnsiString(&pModuleCtx->strMiniportName);
+        NdisFreeMemory(pModuleCtx, 0, 0);
+        return NDIS_STATUS_RESOURCES;
+    }
+
+    vboxNetLwfWinChangeState(pModuleCtx, LwfState_Paused);
+
+    /// @todo Somehow the packet filter is 0 at this point: Status = vboxNetLwfWinGetPacketFilter(pModuleCtx);
+    /// @todo We actually update it later in status handler, perhaps we should not do anything here.
+
+    LogFlow(("<=="__FUNCTION__": Status = 0x%x\n", Status));
+    return Status;
+}
+
+static VOID vboxNetLwfWinDetach(IN NDIS_HANDLE hModuleCtx)
+{
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)hModuleCtx;
+    vboxNetLwfWinChangeState(pModuleCtx, LwfState_Detached, LwfState_Paused);
+
+    /* Remove from module chain */
+    NdisAcquireSpinLock(&pModuleCtx->pGlobals->Lock);
+    RTListNodeRemove(&pModuleCtx->node);
+    NdisReleaseSpinLock(&pModuleCtx->pGlobals->Lock);
+
+    PVBOXNETFLTINS pNetFltIns = pModuleCtx->pNetFlt; /// @todo Atomic?
+    if (pNetFltIns && vboxNetFltTryRetainBusyNotDisconnected(pNetFltIns))
+    {
+        /*
+         * Set hModuleCtx to null now in order to prevent filter restart,
+         * OID requests and other stuff associated with NetFlt deactivation.
+         */
+        pNetFltIns->u.s.WinIf.hModuleCtx = NULL;
+        /* Notify NetFlt that we are going down */
+        pNetFltIns->pSwitchPort->pfnDisconnect(pNetFltIns->pSwitchPort, &pNetFltIns->MyPort, vboxNetFltPortReleaseBusy);
+        /* We do not 'release' netflt instance since it has been done by pfnDisconnect */
+    }
+    pModuleCtx->pNetFlt = NULL;
+
+    /*
+     * We have to make sure that all NET_BUFFER_LIST structures have been freed by now, but
+     * it does not require us to do anything here since it has already been taken care of
+     * by vboxNetLwfWinPause().
+     */
+    if (pModuleCtx->hPool)
+    {
+        NdisFreeNetBufferListPool(pModuleCtx->hPool);
+        Log4((__FUNCTION__ ": freed NBL+NB pool 0x%p\n", pModuleCtx->hPool));
+    }
+    RtlFreeAnsiString(&pModuleCtx->strMiniportName);
+    NdisFreeMemory(hModuleCtx, 0, 0);
+    Log4((__FUNCTION__ ": freed module context 0x%p\n", pModuleCtx));
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+
+static NDIS_STATUS vboxNetLwfWinPause(IN NDIS_HANDLE hModuleCtx, IN PNDIS_FILTER_PAUSE_PARAMETERS pParameters)
+{
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)hModuleCtx;
+    vboxNetLwfWinChangeState(pModuleCtx, LwfState_Pausing, LwfState_Running);
+    /* Wait for pending send/indication operations to complete. */
+    NDIS_WAIT_FOR_MUTEX(&pModuleCtx->InTransmit);
+#ifndef VBOXNETLWF_SYNC_SEND
+    NdisWaitEvent(&pModuleCtx->EventSendComplete, 1000 /* ms */);
+#endif /* !VBOXNETLWF_SYNC_SEND */
+    vboxNetLwfWinChangeState(pModuleCtx, LwfState_Paused, LwfState_Pausing);
+    NDIS_RELEASE_MUTEX(&pModuleCtx->InTransmit);
+    LogFlow(("<=="__FUNCTION__"\n"));
+    return NDIS_STATUS_SUCCESS; /* Failure is not an option */
+}
+
+
+static void vboxNetLwfWinIndicateOffload(PVBOXNETLWF_MODULE pModuleCtx, PNDIS_OFFLOAD pOffload)
+{
+    Log5((__FUNCTION__": offload config changed to:\n"));
+    vboxNetLwfWinDumpOffloadSettings(pOffload);
+    NDIS_STATUS_INDICATION OffloadingIndication;
+    NdisZeroMemory(&OffloadingIndication, sizeof(OffloadingIndication));
+    OffloadingIndication.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION;
+    OffloadingIndication.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1;
+    OffloadingIndication.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1;
+    OffloadingIndication.SourceHandle = pModuleCtx->hFilter;
+    OffloadingIndication.StatusCode = NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG;
+    OffloadingIndication.StatusBuffer = pOffload;
+    OffloadingIndication.StatusBufferSize = sizeof(NDIS_OFFLOAD);
+    NdisFIndicateStatus(pModuleCtx->hFilter, &OffloadingIndication);
+}
+
+
+static NDIS_STATUS vboxNetLwfWinRestart(IN NDIS_HANDLE hModuleCtx, IN PNDIS_FILTER_RESTART_PARAMETERS pParameters)
+{
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)hModuleCtx;
+    vboxNetLwfWinChangeState(pModuleCtx, LwfState_Restarting, LwfState_Paused);
+#if 1
+    if (pModuleCtx->fOffloadConfigValid)
+    {
+        if (ASMAtomicReadBool(&pModuleCtx->fActive))
+        {
+            /* Disable offloading temporarily by indicating offload config change. */
+            /** @todo Be sure to revise this when implementing offloading support! */
+            NDIS_OFFLOAD OffloadConfig;
+            OffloadConfig = pModuleCtx->SavedOffloadConfig;
+            OffloadConfig.Checksum.IPv4Transmit.Encapsulation               = NDIS_ENCAPSULATION_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Transmit.IpOptionsSupported          = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Transmit.TcpOptionsSupported         = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Transmit.TcpChecksum                 = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Transmit.UdpChecksum                 = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Transmit.IpChecksum                  = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Receive.Encapsulation                = NDIS_ENCAPSULATION_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Receive.IpOptionsSupported           = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Receive.TcpOptionsSupported          = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Receive.TcpChecksum                  = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Receive.UdpChecksum                  = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv4Receive.IpChecksum                   = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Transmit.Encapsulation               = NDIS_ENCAPSULATION_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Transmit.IpExtensionHeadersSupported = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Transmit.TcpOptionsSupported         = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Transmit.TcpChecksum                 = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Transmit.UdpChecksum                 = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Receive.Encapsulation                = NDIS_ENCAPSULATION_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Receive.IpExtensionHeadersSupported  = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Receive.TcpOptionsSupported          = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Receive.TcpChecksum                  = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.Checksum.IPv6Receive.UdpChecksum                  = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.LsoV1.IPv4.Encapsulation                          = NDIS_ENCAPSULATION_NOT_SUPPORTED;
+            OffloadConfig.LsoV1.IPv4.TcpOptions                             = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.LsoV1.IPv4.IpOptions                              = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.LsoV2.IPv4.Encapsulation                          = NDIS_ENCAPSULATION_NOT_SUPPORTED;
+            OffloadConfig.LsoV2.IPv6.Encapsulation                          = NDIS_ENCAPSULATION_NOT_SUPPORTED;
+            OffloadConfig.LsoV2.IPv6.IpExtensionHeadersSupported            = NDIS_OFFLOAD_NOT_SUPPORTED;
+            OffloadConfig.LsoV2.IPv6.TcpOptionsSupported                    = NDIS_OFFLOAD_NOT_SUPPORTED;
+            vboxNetLwfWinIndicateOffload(pModuleCtx, &OffloadConfig);
+            Log((__FUNCTION__": set offloading off\n"));
+        }
+        else
+        {
+            /* The filter is inactive -- restore offloading configuration. */
+            vboxNetLwfWinIndicateOffload(pModuleCtx, &pModuleCtx->SavedOffloadConfig);
+            Log((__FUNCTION__": restored offloading config\n"));
+        }
+    }
+#endif
+
+    vboxNetLwfWinChangeState(pModuleCtx, LwfState_Running, LwfState_Restarting);
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    LogFlow(("<=="__FUNCTION__": Status = 0x%x\n", Status));
+    return Status;
+}
+
+
+static void vboxNetLwfWinDumpPackets(const char *pszMsg, PNET_BUFFER_LIST pBufLists)
+{
+    for (PNET_BUFFER_LIST pList = pBufLists; pList; pList = NET_BUFFER_LIST_NEXT_NBL(pList))
+    {
+        for (PNET_BUFFER pBuf = NET_BUFFER_LIST_FIRST_NB(pList); pBuf; pBuf = NET_BUFFER_NEXT_NB(pBuf))
+        {
+            Log(("%s packet: cb=%d\n", pszMsg, NET_BUFFER_DATA_LENGTH(pBuf)));
+        }
+    }
+}
+
+DECLINLINE(const char *) vboxNetLwfWinEthTypeStr(uint16_t uType)
+{
+    switch (uType)
+    {
+        case RTNET_ETHERTYPE_IPV4: return "IP";
+        case RTNET_ETHERTYPE_IPV6: return "IPv6";
+        case RTNET_ETHERTYPE_ARP:  return "ARP";
+    }
+    return "unknown";
+}
+
+#define VBOXNETLWF_PKTDMPSIZE 0x50
+
+/**
+ * Dump a packet to debug log.
+ *
+ * @param   cpPacket    The packet.
+ * @param   cb          The size of the packet.
+ * @param   cszText     A string denoting direction of packet transfer.
+ */
+DECLINLINE(void) vboxNetLwfWinDumpPacket(PCINTNETSG pSG, const char *cszText)
+{
+    uint8_t bPacket[VBOXNETLWF_PKTDMPSIZE];
+
+    uint32_t cb = pSG->cbTotal < VBOXNETLWF_PKTDMPSIZE ? pSG->cbTotal : VBOXNETLWF_PKTDMPSIZE;
+    IntNetSgReadEx(pSG, 0, cb, bPacket);
+
+    AssertReturnVoid(cb >= 14);
+
+    uint8_t *pHdr = bPacket;
+    uint8_t *pEnd = bPacket + cb;
+    AssertReturnVoid(pEnd - pHdr >= 14);
+    uint16_t uEthType = RT_N2H_U16(*(uint16_t*)(pHdr+12));
+    Log2(("NetLWF: %s (%d bytes), %RTmac => %RTmac, EthType=%s(0x%x)\n",
+          cszText, cb, pHdr+6, pHdr, vboxNetLwfWinEthTypeStr(uEthType), uEthType));
+    pHdr += sizeof(RTNETETHERHDR);
+    if (uEthType == RTNET_ETHERTYPE_VLAN)
+    {
+        AssertReturnVoid(pEnd - pHdr >= 4);
+        uEthType = RT_N2H_U16(*(uint16_t*)(pHdr+2));
+        Log2((" + VLAN: id=%d EthType=%s(0x%x)\n", RT_N2H_U16(*(uint16_t*)(pHdr)) & 0xFFF,
+              vboxNetLwfWinEthTypeStr(uEthType), uEthType));
+        pHdr += 2 * sizeof(uint16_t);
+    }
+    uint8_t uProto = 0xFF;
+    switch (uEthType)
+    {
+        case RTNET_ETHERTYPE_IPV6:
+            AssertReturnVoid(pEnd - pHdr >= 40);
+            uProto = pHdr[6];
+            Log2((" + IPv6: %RTnaipv6 => %RTnaipv6\n", pHdr+8, pHdr+24));
+            pHdr += 40;
+            break;
+        case RTNET_ETHERTYPE_IPV4:
+            AssertReturnVoid(pEnd - pHdr >= 20);
+            uProto = pHdr[9];
+            Log2((" + IP: %RTnaipv4 => %RTnaipv4\n", *(uint32_t*)(pHdr+12), *(uint32_t*)(pHdr+16)));
+            pHdr += (pHdr[0] & 0xF) * 4;
+            break;
+        case RTNET_ETHERTYPE_ARP:
+            AssertReturnVoid(pEnd - pHdr >= 28);
+            AssertReturnVoid(RT_N2H_U16(*(uint16_t*)(pHdr+2)) == RTNET_ETHERTYPE_IPV4);
+            switch (RT_N2H_U16(*(uint16_t*)(pHdr+6)))
+            {
+                case 1: /* ARP request */
+                    Log2((" + ARP-REQ: who-has %RTnaipv4 tell %RTnaipv4\n",
+                          *(uint32_t*)(pHdr+24), *(uint32_t*)(pHdr+14)));
+                    break;
+                case 2: /* ARP reply */
+                    Log2((" + ARP-RPL: %RTnaipv4 is-at %RTmac\n",
+                          *(uint32_t*)(pHdr+14), pHdr+8));
+                    break;
+                default:
+                    Log2((" + ARP: unknown op %d\n", RT_N2H_U16(*(uint16_t*)(pHdr+6))));
+                    break;
+            }
+            break;
+        /* There is no default case as uProto is initialized with 0xFF */
+    }
+    while (uProto != 0xFF)
+    {
+        switch (uProto)
+        {
+            case 0:  /* IPv6 Hop-by-Hop option*/
+            case 60: /* IPv6 Destination option*/
+            case 43: /* IPv6 Routing option */
+            case 44: /* IPv6 Fragment option */
+                Log2((" + IPv6 option (%d): <not implemented>\n", uProto));
+                uProto = pHdr[0];
+                pHdr += pHdr[1] * 8 + 8; /* Skip to the next extension/protocol */
+                break;
+            case 51: /* IPv6 IPsec AH */
+                Log2((" + IPv6 IPsec AH: <not implemented>\n"));
+                uProto = pHdr[0];
+                pHdr += (pHdr[1] + 2) * 4; /* Skip to the next extension/protocol */
+                break;
+            case 50: /* IPv6 IPsec ESP */
+                /* Cannot decode IPsec, fall through */
+                Log2((" + IPv6 IPsec ESP: <not implemented>\n"));
+                uProto = 0xFF;
+                break;
+            case 59: /* No Next Header */
+                Log2((" + IPv6 No Next Header\n"));
+                uProto = 0xFF;
+                break;
+            case 58: /* IPv6-ICMP */
+                switch (pHdr[0])
+                {
+                    case 1:   Log2((" + IPv6-ICMP: destination unreachable, code %d\n", pHdr[1])); break;
+                    case 128: Log2((" + IPv6-ICMP: echo request\n")); break;
+                    case 129: Log2((" + IPv6-ICMP: echo reply\n")); break;
+                    default:  Log2((" + IPv6-ICMP: unknown type %d, code %d\n", pHdr[0], pHdr[1])); break;
+                }
+                uProto = 0xFF;
+                break;
+            case 1: /* ICMP */
+                switch (pHdr[0])
+                {
+                    case 0:  Log2((" + ICMP: echo reply\n")); break;
+                    case 8:  Log2((" + ICMP: echo request\n")); break;
+                    case 3:  Log2((" + ICMP: destination unreachable, code %d\n", pHdr[1])); break;
+                    default: Log2((" + ICMP: unknown type %d, code %d\n", pHdr[0], pHdr[1])); break;
+                }
+                uProto = 0xFF;
+                break;
+            case 6: /* TCP */
+                Log2((" + TCP: src=%d dst=%d seq=%x ack=%x\n",
+                      RT_N2H_U16(*(uint16_t*)(pHdr)), RT_N2H_U16(*(uint16_t*)(pHdr+2)),
+                      RT_N2H_U32(*(uint32_t*)(pHdr+4)), RT_N2H_U32(*(uint32_t*)(pHdr+8))));
+                uProto = 0xFF;
+                break;
+            case 17: /* UDP */
+                Log2((" + UDP: src=%d dst=%d\n",
+                      RT_N2H_U16(*(uint16_t*)(pHdr)), RT_N2H_U16(*(uint16_t*)(pHdr+2))));
+                uProto = 0xFF;
+                break;
+            default:
+                Log2((" + Unknown: proto=0x%x\n", uProto));
+                uProto = 0xFF;
+                break;
+        }
+    }
+    Log3(("%.*Rhxd\n", cb, bPacket));
+}
+
+static void vboxNetLwfWinDestroySG(PINTNETSG pSG)
+{
+    NdisFreeMemory(pSG, 0, 0);
+    Log4((__FUNCTION__ ": freed SG 0x%p\n", pSG));
+}
+
+DECLINLINE(ULONG) vboxNetLwfWinCalcSegments(PNET_BUFFER pNetBuf)
+{
+    ULONG cSegs = 0;
+    for (PMDL pMdl = NET_BUFFER_CURRENT_MDL(pNetBuf); pMdl; pMdl = NDIS_MDL_LINKAGE(pMdl))
+        cSegs++;
+    return cSegs;
+}
+
+DECLINLINE(void) vboxNetLwfWinFreeMdlChain(PMDL pMdl)
+{
+#ifdef VBOXNETLWF_SYNC_SEND
+    PMDL pMdlNext;
+    while (pMdl)
+    {
+        pMdlNext = pMdl->Next;
+        NdisFreeMdl(pMdl);
+        Log4((__FUNCTION__ ": freed MDL 0x%p\n", pMdl));
+        pMdl = pMdlNext;
+    }
+#endif /* VBOXNETLWF_SYNC_SEND */
+}
+
+/** @todo
+ * 1) Copy data from SG to MDL (if we decide to complete asynchronously).
+ * 2) Provide context/backfill space. Nobody does it, should we?
+ * 3) We always get a single segment from intnet. Simplify?
+ */
+static PNET_BUFFER_LIST vboxNetLwfWinSGtoNB(PVBOXNETLWF_MODULE pModule, PINTNETSG pSG)
+{
+    AssertReturn(pSG->cSegsUsed >= 1, NULL);
+    LogFlow(("==>"__FUNCTION__": segments=%d\n", pSG->cSegsUsed));
+
+#ifdef VBOXNETLWF_SYNC_SEND
+    PINTNETSEG pSeg = pSG->aSegs;
+    PMDL pMdl = NdisAllocateMdl(pModule->hFilter, pSeg->pv, pSeg->cb);
+    if (!pMdl)
+    {
+        Log(("ERROR! "__FUNCTION__": failed to allocate an MDL\n"));
+        LogFlow(("<=="__FUNCTION__": return NULL\n"));
+        return NULL;
+    }
+    Log4((__FUNCTION__ ": allocated Mdl 0x%p\n", pMdl));
+    PMDL pMdlCurr = pMdl;
+    for (int i = 1; i < pSG->cSegsUsed; i++)
+    {
+        pSeg = &pSG->aSegs[i];
+        pMdlCurr->Next = NdisAllocateMdl(pModule->hFilter, pSeg->pv, pSeg->cb);
+        if (!pMdlCurr->Next)
+        {
+            Log(("ERROR! "__FUNCTION__": failed to allocate an MDL\n"));
+            /* Tear down all MDL we chained so far */
+            vboxNetLwfWinFreeMdlChain(pMdl);
+            return NULL;
+        }
+        pMdlCurr = pMdlCurr->Next;
+        Log4((__FUNCTION__ ": allocated Mdl 0x%p\n", pMdlCurr));
+    }
+    PNET_BUFFER_LIST pBufList = NdisAllocateNetBufferAndNetBufferList(pModule->hPool,
+                                                                      0 /* ContextSize */,
+                                                                      0 /* ContextBackFill */,
+                                                                      pMdl,
+                                                                      0 /* DataOffset */,
+                                                                      pSG->cbTotal);
+    if (pBufList)
+    {
+        Log4((__FUNCTION__ ": allocated NBL+NB 0x%p\n", pBufList));
+        pBufList->SourceHandle = pModule->hFilter;
+        /** @todo Do we need to initialize anything else? */
+    }
+    else
+    {
+        Log(("ERROR! "__FUNCTION__": failed to allocate an NBL+NB\n"));
+        vboxNetLwfWinFreeMdlChain(pMdl);
+    }
+#else /* !VBOXNETLWF_SYNC_SEND */
+    AssertReturn(pSG->cbTotal < 2048, NULL);
+    PNET_BUFFER_LIST pBufList = NdisAllocateNetBufferList(pModule->hPool,
+                                                          0 /** @todo ContextSize */,
+                                                          0 /** @todo ContextBackFill */);
+    NET_BUFFER_LIST_NEXT_NBL(pBufList) = NULL; /** @todo Is it even needed? */
+    NET_BUFFER *pBuffer = NET_BUFFER_LIST_FIRST_NB(pBufList);
+    NDIS_STATUS Status = NdisRetreatNetBufferDataStart(pBuffer, pSG->cbTotal, 0 /** @todo DataBackfill */, NULL);
+    if (Status == NDIS_STATUS_SUCCESS)
+    {
+        uint8_t *pDst = (uint8_t*)NdisGetDataBuffer(pBuffer, pSG->cbTotal, NULL, 1, 0);
+        if (pDst)
+        {
+            for (int i = 0; i < pSG->cSegsUsed; i++)
+            {
+                NdisMoveMemory(pDst, pSG->aSegs[i].pv, pSG->aSegs[i].cb);
+                pDst += pSG->aSegs[i].cb;
+            }
+            Log4((__FUNCTION__ ": allocated NBL+NB+MDL+Data 0x%p\n", pBufList));
+            pBufList->SourceHandle = pModule->hFilter;
+            /** @todo Do we need to initialize anything else? */
+        }
+        else
+        {
+            Log((__FUNCTION__": failed to obtain the buffer pointer (size=%u)\n", pSG->cbTotal));
+            NdisAdvanceNetBufferDataStart(pBuffer, pSG->cbTotal, false, NULL); /** @todo why bother? */
+            NdisFreeNetBufferList(pBufList);
+            pBufList = NULL;
+        }
+    }
+    else
+    {
+        Log((__FUNCTION__": NdisRetreatNetBufferDataStart failed with 0x%x (size=%u)\n", Status, pSG->cbTotal));
+        NdisFreeNetBufferList(pBufList);
+        pBufList = NULL;
+    }
+#endif /* !VBOXNETLWF_SYNC_SEND */
+    LogFlow(("<=="__FUNCTION__": return %p\n", pBufList));
+    return pBufList;
+}
+
+static PINTNETSG vboxNetLwfWinNBtoSG(PVBOXNETLWF_MODULE pModule, PNET_BUFFER pNetBuf)
+{
+    ULONG cbPacket = NET_BUFFER_DATA_LENGTH(pNetBuf);
+    UINT cSegs = vboxNetLwfWinCalcSegments(pNetBuf);
+    /* Allocate and initialize SG */
+    PINTNETSG pSG = (PINTNETSG)NdisAllocateMemoryWithTagPriority(pModule->hFilter,
+                                                                 RT_OFFSETOF(INTNETSG, aSegs[cSegs]),
+                                                                 VBOXNETLWF_MEM_TAG,
+                                                                 NormalPoolPriority);
+    AssertReturn(pSG, pSG);
+    Log4((__FUNCTION__ ": allocated SG 0x%p\n", pSG));
+    IntNetSgInitTempSegs(pSG, cbPacket /*cbTotal*/, cSegs, cSegs /*cSegsUsed*/);
+
+    int rc = NDIS_STATUS_SUCCESS;
+    ULONG uOffset = NET_BUFFER_CURRENT_MDL_OFFSET(pNetBuf);
+    cSegs = 0;
+    for (PMDL pMdl = NET_BUFFER_CURRENT_MDL(pNetBuf);
+         pMdl != NULL && cbPacket > 0;
+         pMdl = NDIS_MDL_LINKAGE(pMdl))
+    {
+        PUCHAR pSrc = (PUCHAR)MmGetSystemAddressForMdlSafe(pMdl, LowPagePriority);
+        if (!pSrc)
+        {
+            rc = NDIS_STATUS_RESOURCES;
+            break;
+        }
+        ULONG cbSrc = MmGetMdlByteCount(pMdl);
+        if (uOffset)
+        {
+            Assert(uOffset < cbSrc);
+            pSrc  += uOffset;
+            cbSrc -= uOffset;
+            uOffset = 0;
+        }
+
+        if (cbSrc > cbPacket)
+            cbSrc = cbPacket;
+
+        pSG->aSegs[cSegs].pv = pSrc;
+        pSG->aSegs[cSegs].cb = cbSrc;
+        pSG->aSegs[cSegs].Phys = NIL_RTHCPHYS;
+        cSegs++;
+        cbPacket -= cbSrc;
+    }
+
+    Assert(cSegs <= pSG->cSegsAlloc);
+
+    if (RT_FAILURE(rc))
+    {
+        vboxNetLwfWinDestroySG(pSG);
+        pSG = NULL;
+    }
+    else
+    {
+        Assert(cbPacket == 0);
+        Assert(pSG->cSegsUsed == cSegs);
+    }
+    return pSG;
+}
+
+VOID vboxNetLwfWinStatus(IN NDIS_HANDLE hModuleCtx, IN PNDIS_STATUS_INDICATION pIndication)
+{
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)hModuleCtx;
+    Log((__FUNCTION__"Got status indication: %s\n", vboxNetLwfWinStatusToText(pIndication->StatusCode)));
+    switch (pIndication->StatusCode)
+    {
+        case NDIS_STATUS_PACKET_FILTER:
+            vboxNetLwfWinDumpFilterTypes(*(ULONG*)pIndication->StatusBuffer);
+            vboxNetLwfWinOverridePacketFiltersUp(pModuleCtx, (ULONG*)pIndication->StatusBuffer);
+            Log((__FUNCTION__"Reporting status: %s\n", vboxNetLwfWinStatusToText(pIndication->StatusCode)));
+            vboxNetLwfWinDumpFilterTypes(*(ULONG*)pIndication->StatusBuffer);
+            break;
+        case NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG:
+            Log5((__FUNCTION__": offloading currently set to:\n"));
+            vboxNetLwfWinDumpOffloadSettings((PNDIS_OFFLOAD)pIndication->StatusBuffer);
+            break;
+    }
+    NdisFIndicateStatus(pModuleCtx->hFilter, pIndication);
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+static bool vboxNetLwfWinForwardToIntNet(PVBOXNETLWF_MODULE pModuleCtx, PNET_BUFFER_LIST pBufLists, uint32_t fSrc)
+{
+    /* We must not forward anything to the trunk unless it is ready to receive. */
+    if (!ASMAtomicReadBool(&pModuleCtx->fActive))
+    {
+        Log((__FUNCTION__": trunk is inactive, won't forward\n"));
+        return false;
+    }
+
+    AssertReturn(pModuleCtx->pNetFlt, false);
+    AssertReturn(pModuleCtx->pNetFlt->pSwitchPort, false);
+    AssertReturn(pModuleCtx->pNetFlt->pSwitchPort->pfnRecv, false);
+    LogFlow(("==>"__FUNCTION__": module=%p\n", pModuleCtx));
+    Assert(pBufLists);                                                   /* The chain must contain at least one list */
+    Assert(NET_BUFFER_LIST_NEXT_NBL(pBufLists) == NULL); /* The caller is supposed to unlink the list from the chain */
+    /*
+     * Even if NBL contains more than one buffer we are prepared to deal with it.
+     * When any of buffers should not be dropped we keep the whole list. It is
+     * better to leak some "unexpected" packets to the wire/host than to loose any.
+     */
+    bool fDropIt   = false;
+    bool fDontDrop = false;
+    int nLists = 0;
+    for (PNET_BUFFER_LIST pList = pBufLists; pList; pList = NET_BUFFER_LIST_NEXT_NBL(pList))
+    {
+        int nBuffers = 0;
+        nLists++;
+        for (PNET_BUFFER pBuf = NET_BUFFER_LIST_FIRST_NB(pList); pBuf; pBuf = NET_BUFFER_NEXT_NB(pBuf))
+        {
+            nBuffers++;
+            PINTNETSG pSG = vboxNetLwfWinNBtoSG(pModuleCtx, pBuf);
+            if (pSG)
+            {
+                vboxNetLwfWinDumpPacket(pSG, (fSrc & INTNETTRUNKDIR_WIRE)?"intnet <-- wire":"intnet <-- host");
+                /* A bit paranoid, but we do not use any locks, so... */
+                if (ASMAtomicReadBool(&pModuleCtx->fActive))
+                    if (pModuleCtx->pNetFlt->pSwitchPort->pfnRecv(pModuleCtx->pNetFlt->pSwitchPort, NULL, pSG, fSrc))
+                        fDropIt = true;
+                    else
+                        fDontDrop = true;
+                vboxNetLwfWinDestroySG(pSG);
+            }
+        }
+        Log((__FUNCTION__": list=%d buffers=%d\n", nLists, nBuffers));
+    }
+    Log((__FUNCTION__": lists=%d drop=%s don't=%s\n", nLists, fDropIt ? "true":"false", fDontDrop ? "true":"false"));
+    LogFlow(("<=="__FUNCTION__": return '%s'\n",
+             fDropIt ? (fDontDrop ? "do not drop (some)" : "drop it") : "do not drop (any)"));
+    return fDropIt && !fDontDrop; /* Drop the list if ALL its buffers are being dropped! */
+}
+
+DECLINLINE(bool) vboxNetLwfWinIsRunning(PVBOXNETLWF_MODULE pModule)
+{
+    Log((__FUNCTION__": state=%d\n", ASMAtomicReadU32(&pModule->enmState)));
+    return ASMAtomicReadU32(&pModule->enmState) == LwfState_Running;
+}
+
+VOID vboxNetLwfWinSendNetBufferLists(IN NDIS_HANDLE hModuleCtx, IN PNET_BUFFER_LIST pBufLists, IN NDIS_PORT_NUMBER nPort, IN ULONG fFlags)
+{
+    size_t cb = 0;
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModule = (PVBOXNETLWF_MODULE)hModuleCtx;
+#ifdef VBOXNETLWF_NO_BYPASS
+    if (!ASMAtomicReadBool(&pModule->fActive))
+    {
+        /*
+         * The trunk is inactive, jusp pass along all packets to the next
+         * underlying driver.
+         */
+        NdisFSendNetBufferLists(pModule->hFilter, pBufLists, nPort, fFlags);
+        return;
+    }
+#endif
+    if (vboxNetLwfWinIsRunning(pModule))
+    {
+        PNET_BUFFER_LIST pNext     = NULL;
+        PNET_BUFFER_LIST pDropHead = NULL;
+        PNET_BUFFER_LIST pDropTail = NULL;
+        PNET_BUFFER_LIST pPassHead = NULL;
+        PNET_BUFFER_LIST pPassTail = NULL;
+        for (PNET_BUFFER_LIST pList = pBufLists; pList; pList = pNext)
+        {
+            pNext = NET_BUFFER_LIST_NEXT_NBL(pList);
+            NET_BUFFER_LIST_NEXT_NBL(pList) = NULL; /* Unlink */
+            if (vboxNetLwfWinForwardToIntNet(pModule, pList, INTNETTRUNKDIR_HOST))
+            {
+                NET_BUFFER_LIST_STATUS(pList) = NDIS_STATUS_SUCCESS;
+                if (pDropHead)
+                {
+                    NET_BUFFER_LIST_NEXT_NBL(pDropTail) = pList;
+                    pDropTail = pList;
+                }
+                else
+                    pDropHead = pDropTail = pList;
+            }
+            else
+            {
+                if (pPassHead)
+                {
+                    NET_BUFFER_LIST_NEXT_NBL(pPassTail) = pList;
+                    pPassTail = pList;
+                }
+                else
+                    pPassHead = pPassTail = pList;
+            }
+        }
+        Assert((pBufLists == pPassHead) || (pBufLists == pDropHead));
+        if (pPassHead)
+        {
+            vboxNetLwfWinDumpPackets(__FUNCTION__": passing down", pPassHead);
+            NdisFSendNetBufferLists(pModule->hFilter, pBufLists, nPort, fFlags);
+        }
+        if (pDropHead)
+        {
+            vboxNetLwfWinDumpPackets(__FUNCTION__": consumed", pDropHead);
+            NdisFSendNetBufferListsComplete(pModule->hFilter, pDropHead,
+                                            fFlags & NDIS_SEND_FLAGS_DISPATCH_LEVEL ? NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL : 0);
+        }
+    }
+    else
+    {
+        for (PNET_BUFFER_LIST pList = pBufLists; pList; pList = NET_BUFFER_LIST_NEXT_NBL(pList))
+        {
+            NET_BUFFER_LIST_STATUS(pList) = NDIS_STATUS_PAUSED;
+        }
+        vboxNetLwfWinDumpPackets(__FUNCTION__": consumed", pBufLists);
+        NdisFSendNetBufferListsComplete(pModule->hFilter, pBufLists,
+                                        fFlags & NDIS_SEND_FLAGS_DISPATCH_LEVEL ? NDIS_SEND_COMPLETE_FLAGS_DISPATCH_LEVEL : 0);
+
+    }
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+VOID vboxNetLwfWinSendNetBufferListsComplete(IN NDIS_HANDLE hModuleCtx, IN PNET_BUFFER_LIST pBufLists, IN ULONG fFlags)
+{
+    size_t cb = 0;
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModule = (PVBOXNETLWF_MODULE)hModuleCtx;
+    PNET_BUFFER_LIST pList = pBufLists;
+    PNET_BUFFER_LIST pNextList;
+    PNET_BUFFER_LIST pPrevList = NULL;
+    while (pList)
+    {
+        pNextList = NET_BUFFER_LIST_NEXT_NBL(pList);
+        if (pList->SourceHandle == pModule->hFilter)
+        {
+            /* We allocated this NET_BUFFER_LIST, let's free it up */
+            Assert(NET_BUFFER_LIST_FIRST_NB(pList));
+            Assert(NET_BUFFER_FIRST_MDL(NET_BUFFER_LIST_FIRST_NB(pList)));
+            /*
+             * All our NBLs hold a single NB each, no need to iterate over a list.
+             * There is no need to free an associated NB explicitly either, as it was
+             * preallocated with NBL structure.
+             */
+            Assert(!NET_BUFFER_NEXT_NB(NET_BUFFER_LIST_FIRST_NB(pList)));
+            vboxNetLwfWinFreeMdlChain(NET_BUFFER_FIRST_MDL(NET_BUFFER_LIST_FIRST_NB(pList)));
+            /* Unlink this list from the chain */
+            if (pPrevList)
+                NET_BUFFER_LIST_NEXT_NBL(pPrevList) = pNextList;
+            else
+                pBufLists = pNextList;
+            Log((__FUNCTION__": our list %p, next=%p, previous=%p, head=%p\n", pList, pNextList, pPrevList, pBufLists));
+            NdisFreeNetBufferList(pList);
+#ifdef VBOXNETLWF_SYNC_SEND
+            Log4((__FUNCTION__ ": freed NBL+NB 0x%p\n", pList));
+            KeSetEvent(&pModule->EventWire, 0, FALSE);
+#else /* !VBOXNETLWF_SYNC_SEND */
+            Log4((__FUNCTION__ ": freed NBL+NB+MDL+Data 0x%p\n", pList));
+            Assert(ASMAtomicReadS32(&pModule->cPendingBuffers) > 0);
+            if (ASMAtomicDecS32(&pModule->cPendingBuffers) == 0)
+                NdisSetEvent(&pModule->EventSendComplete);
+#endif /* !VBOXNETLWF_SYNC_SEND */
+        }
+        else
+        {
+            pPrevList = pList;
+            Log((__FUNCTION__": passing list %p, next=%p, previous=%p, head=%p\n", pList, pNextList, pPrevList, pBufLists));
+        }
+        pList = pNextList;
+    }
+    if (pBufLists)
+    {
+        /* There are still lists remaining in the chain, pass'em up */
+        NdisFSendNetBufferListsComplete(pModule->hFilter, pBufLists, fFlags);
+    }
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+VOID vboxNetLwfWinReceiveNetBufferLists(IN NDIS_HANDLE hModuleCtx,
+                                        IN PNET_BUFFER_LIST pBufLists,
+                                        IN NDIS_PORT_NUMBER nPort,
+                                        IN ULONG nBufLists,
+                                        IN ULONG fFlags)
+{
+    /// @todo Do we need loopback handling?
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModule = (PVBOXNETLWF_MODULE)hModuleCtx;
+#ifdef VBOXNETLWF_NO_BYPASS
+    if (!ASMAtomicReadBool(&pModule->fActive))
+    {
+        /*
+         * The trunk is inactive, jusp pass along all packets to the next
+         * overlying driver.
+         */
+        NdisFIndicateReceiveNetBufferLists(pModule->hFilter, pBufLists, nPort, nBufLists, fFlags);
+        return;
+    }
+#endif
+    if (vboxNetLwfWinIsRunning(pModule))
+    {
+        if (NDIS_TEST_RECEIVE_CANNOT_PEND(fFlags))
+        {
+            /* We do not own NBLs so we do not need to return them */
+            /* First we need to scan through the list to see if some packets must be dropped */
+            bool bDropIt = false;
+            for (PNET_BUFFER_LIST pList = pBufLists; pList; pList = NET_BUFFER_LIST_NEXT_NBL(pList))
+            {
+                PNET_BUFFER_LIST pNext = NET_BUFFER_LIST_NEXT_NBL(pList);
+                NET_BUFFER_LIST_NEXT_NBL(pList) = NULL; /* Unlink temporarily */
+                if (vboxNetLwfWinForwardToIntNet(pModule, pList, INTNETTRUNKDIR_WIRE))
+                    bDropIt = true;
+                NET_BUFFER_LIST_NEXT_NBL(pList) = pNext; /* Restore the link */
+            }
+            if (bDropIt)
+            {
+                /* Some NBLs must be dropped, indicate selectively one by one */
+                for (PNET_BUFFER_LIST pList = pBufLists; pList; pList = NET_BUFFER_LIST_NEXT_NBL(pList))
+                {
+                    PNET_BUFFER_LIST pNext = NET_BUFFER_LIST_NEXT_NBL(pList);
+                    NET_BUFFER_LIST_NEXT_NBL(pList) = NULL; /* Unlink temporarily */
+                    vboxNetLwfWinDumpPackets(__FUNCTION__": passing up", pList);
+                    NdisFIndicateReceiveNetBufferLists(pModule->hFilter, pList, nPort, nBufLists, fFlags);
+                    NET_BUFFER_LIST_NEXT_NBL(pList) = pNext; /* Restore the link */
+                }
+            }
+            else
+            {
+                /* All NBLs must be indicated, do it in bulk. */
+                vboxNetLwfWinDumpPackets(__FUNCTION__": passing up", pBufLists);
+                NdisFIndicateReceiveNetBufferLists(pModule->hFilter, pBufLists, nPort, nBufLists, fFlags);
+            }
+        }
+        else
+        {
+            /* We collect dropped NBLs in a separate list in order to "return" them. */
+            PNET_BUFFER_LIST pNext     = NULL;
+            PNET_BUFFER_LIST pDropHead = NULL;
+            PNET_BUFFER_LIST pDropTail = NULL;
+            PNET_BUFFER_LIST pPassHead = NULL;
+            PNET_BUFFER_LIST pPassTail = NULL;
+            ULONG nDrop = 0, nPass = 0;
+            for (PNET_BUFFER_LIST pList = pBufLists; pList; pList = pNext)
+            {
+                pNext = NET_BUFFER_LIST_NEXT_NBL(pList);
+                NET_BUFFER_LIST_NEXT_NBL(pList) = NULL; /* Unlink */
+                if (vboxNetLwfWinForwardToIntNet(pModule, pList, INTNETTRUNKDIR_WIRE))
+                {
+                    if (nDrop++)
+                    {
+                        NET_BUFFER_LIST_NEXT_NBL(pDropTail) = pList;
+                        pDropTail = pList;
+                    }
+                    else
+                        pDropHead = pDropTail = pList;
+                }
+                else
+                {
+                    if (nPass++)
+                    {
+                        NET_BUFFER_LIST_NEXT_NBL(pPassTail) = pList;
+                        pPassTail = pList;
+                    }
+                    else
+                        pPassHead = pPassTail = pList;
+                }
+            }
+            Assert((pBufLists == pPassHead) || (pBufLists == pDropHead));
+            Assert(nDrop + nPass == nBufLists);
+            if (pPassHead)
+            {
+                vboxNetLwfWinDumpPackets(__FUNCTION__": passing up", pPassHead);
+                NdisFIndicateReceiveNetBufferLists(pModule->hFilter, pPassHead, nPort, nPass, fFlags);
+            }
+            if (pDropHead)
+            {
+                vboxNetLwfWinDumpPackets(__FUNCTION__": consumed", pDropHead);
+                NdisFReturnNetBufferLists(pModule->hFilter, pDropHead,
+                                          fFlags & NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL ? NDIS_RETURN_FLAGS_DISPATCH_LEVEL : 0);
+            }
+        }
+
+    }
+    else
+    {
+        vboxNetLwfWinDumpPackets(__FUNCTION__": consumed", pBufLists);
+        if ((fFlags & NDIS_RECEIVE_FLAGS_RESOURCES) == 0)
+            NdisFReturnNetBufferLists(pModule->hFilter, pBufLists,
+                                      fFlags & NDIS_RECEIVE_FLAGS_DISPATCH_LEVEL ? NDIS_RETURN_FLAGS_DISPATCH_LEVEL : 0);
+    }
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+VOID vboxNetLwfWinReturnNetBufferLists(IN NDIS_HANDLE hModuleCtx, IN PNET_BUFFER_LIST pBufLists, IN ULONG fFlags)
+{
+    size_t cb = 0;
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModule = (PVBOXNETLWF_MODULE)hModuleCtx;
+    PNET_BUFFER_LIST pList = pBufLists;
+    PNET_BUFFER_LIST pNextList;
+    PNET_BUFFER_LIST pPrevList = NULL;
+    /** @todo Move common part into a separate function to be used by vboxNetLwfWinSendNetBufferListsComplete() as well */
+    while (pList)
+    {
+        pNextList = NET_BUFFER_LIST_NEXT_NBL(pList);
+        if (pList->SourceHandle == pModule->hFilter)
+        {
+            /* We allocated this NET_BUFFER_LIST, let's free it up */
+            Assert(NET_BUFFER_LIST_FIRST_NB(pList));
+            Assert(NET_BUFFER_FIRST_MDL(NET_BUFFER_LIST_FIRST_NB(pList)));
+            /*
+             * All our NBLs hold a single NB each, no need to iterate over a list.
+             * There is no need to free an associated NB explicitly either, as it was
+             * preallocated with NBL structure.
+             */
+            vboxNetLwfWinFreeMdlChain(NET_BUFFER_FIRST_MDL(NET_BUFFER_LIST_FIRST_NB(pList)));
+            /* Unlink this list from the chain */
+            if (pPrevList)
+                NET_BUFFER_LIST_NEXT_NBL(pPrevList) = pNextList;
+            else
+                pBufLists = pNextList;
+            NdisFreeNetBufferList(pList);
+#ifdef VBOXNETLWF_SYNC_SEND
+            Log4((__FUNCTION__ ": freed NBL+NB 0x%p\n", pList));
+            KeSetEvent(&pModule->EventHost, 0, FALSE);
+#else /* !VBOXNETLWF_SYNC_SEND */
+            Log4((__FUNCTION__ ": freed NBL+NB+MDL+Data 0x%p\n", pList));
+            Assert(ASMAtomicReadS32(&pModule->cPendingBuffers) > 0);
+            if (ASMAtomicDecS32(&pModule->cPendingBuffers) == 0)
+                NdisSetEvent(&pModule->EventSendComplete);
+#endif /* !VBOXNETLWF_SYNC_SEND */
+        }
+        else
+            pPrevList = pList;
+        pList = pNextList;
+    }
+    if (pBufLists)
+    {
+        /* There are still lists remaining in the chain, pass'em up */
+        NdisFReturnNetBufferLists(pModule->hFilter, pBufLists, fFlags);
+    }
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+NDIS_STATUS vboxNetLwfWinSetModuleOptions(IN NDIS_HANDLE hModuleCtx)
+{
+    LogFlow(("==>"__FUNCTION__": module=%p\n", hModuleCtx));
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)hModuleCtx;
+    NDIS_FILTER_PARTIAL_CHARACTERISTICS PChars;
+
+    NdisZeroMemory(&PChars, sizeof(PChars));
+
+    PChars.Header.Type = NDIS_OBJECT_TYPE_FILTER_PARTIAL_CHARACTERISTICS;
+    PChars.Header.Size = NDIS_SIZEOF_FILTER_PARTIAL_CHARACTERISTICS_REVISION_1;
+    PChars.Header.Revision = NDIS_FILTER_PARTIAL_CHARACTERISTICS_REVISION_1;
+
+#ifndef VBOXNETLWF_NO_BYPASS
+    if (ASMAtomicReadBool(&pModuleCtx->fActive))
+#endif
+    {
+        Log((__FUNCTION__": active mode\n"));
+        PChars.SendNetBufferListsHandler = vboxNetLwfWinSendNetBufferLists;
+        PChars.SendNetBufferListsCompleteHandler = vboxNetLwfWinSendNetBufferListsComplete;
+        PChars.ReceiveNetBufferListsHandler = vboxNetLwfWinReceiveNetBufferLists;
+        PChars.ReturnNetBufferListsHandler = vboxNetLwfWinReturnNetBufferLists;
+    }
+#ifndef VBOXNETLWF_NO_BYPASS
+    else
+    {
+        Log((__FUNCTION__": bypass mode\n"));
+    }
+#endif
+    NDIS_STATUS Status = NdisSetOptionalHandlers(pModuleCtx->hFilter,
+                                                 (PNDIS_DRIVER_OPTIONAL_HANDLERS)&PChars);
+    LogFlow(("<=="__FUNCTION__": status=0x%x\n", Status));
+    return Status;
+}
+
+/**
+ * register the filter driver
+ */
+DECLHIDDEN(NDIS_STATUS) vboxNetLwfWinRegister(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegistryPathStr)
+{
+    NDIS_FILTER_DRIVER_CHARACTERISTICS FChars;
+    NDIS_STRING FriendlyName;
+    NDIS_STRING UniqueName;
+    NDIS_STRING ServiceName;
+
+    NdisInitUnicodeString(&FriendlyName, VBOXNETLWF_NAME_FRIENDLY);
+    NdisInitUnicodeString(&UniqueName, VBOXNETLWF_NAME_UNIQUE);
+    NdisInitUnicodeString(&ServiceName, VBOXNETLWF_NAME_SERVICE);
+
+    NdisZeroMemory(&FChars, sizeof (FChars));
+
+    FChars.Header.Type = NDIS_OBJECT_TYPE_FILTER_DRIVER_CHARACTERISTICS;
+    FChars.Header.Size = sizeof(NDIS_FILTER_DRIVER_CHARACTERISTICS);
+    FChars.Header.Revision = NDIS_FILTER_CHARACTERISTICS_REVISION_1;
+
+    FChars.MajorNdisVersion = VBOXNETLWF_VERSION_NDIS_MAJOR;
+    FChars.MinorNdisVersion = VBOXNETLWF_VERSION_NDIS_MINOR;
+
+    FChars.FriendlyName = FriendlyName;
+    FChars.UniqueName = UniqueName;
+    FChars.ServiceName = ServiceName;
+
+    /* Mandatory functions */
+    FChars.AttachHandler = vboxNetLwfWinAttach;
+    FChars.DetachHandler = vboxNetLwfWinDetach;
+    FChars.RestartHandler = vboxNetLwfWinRestart;
+    FChars.PauseHandler = vboxNetLwfWinPause;
+
+    /* Optional functions, non changeble at run-time */
+    FChars.OidRequestHandler = vboxNetLwfWinOidRequest;
+    FChars.OidRequestCompleteHandler = vboxNetLwfWinOidRequestComplete;
+    //FChars.CancelOidRequestHandler = vboxNetLwfWinCancelOidRequest;
+    FChars.StatusHandler = vboxNetLwfWinStatus;
+    //FChars.NetPnPEventHandler = vboxNetLwfWinPnPEvent;
+    FChars.SetFilterModuleOptionsHandler = vboxNetLwfWinSetModuleOptions;
+
+    /* Optional functions */
+    FChars.SendNetBufferListsHandler = vboxNetLwfWinSendNetBufferLists;
+    FChars.SendNetBufferListsCompleteHandler = vboxNetLwfWinSendNetBufferListsComplete;
+    FChars.ReceiveNetBufferListsHandler = vboxNetLwfWinReceiveNetBufferLists;
+    FChars.ReturnNetBufferListsHandler = vboxNetLwfWinReturnNetBufferLists;
+
+    pDriverObject->DriverUnload = vboxNetLwfWinUnloadDriver;
+
+    NDIS_STATUS Status;
+    g_VBoxNetLwfGlobals.hFilterDriver = NULL;
+    Log(("vboxNetLwfWinRegister: registering filter driver...\n"));
+    Status = NdisFRegisterFilterDriver(pDriverObject,
+                                       (NDIS_HANDLE)&g_VBoxNetLwfGlobals,
+                                       &FChars,
+                                       &g_VBoxNetLwfGlobals.hFilterDriver);
+    Assert(Status == STATUS_SUCCESS);
+    if (Status == STATUS_SUCCESS)
+    {
+        Log(("vboxNetLwfWinRegister: successfully registered filter driver; registering device...\n"));
+        Status = vboxNetLwfWinDevCreate(&g_VBoxNetLwfGlobals);
+        Assert(Status == STATUS_SUCCESS);
+        Log(("vboxNetLwfWinRegister: vboxNetLwfWinDevCreate() returned 0x%x\n", Status));
+    }
+    else
+    {
+        Log(("ERROR! vboxNetLwfWinRegister: failed to register filter driver, status=0x%x", Status));
+    }
+    return Status;
+}
+
+static int vboxNetLwfWinStartInitIdcThread()
+{
+    int rc = VERR_INVALID_STATE;
+
+    if (ASMAtomicCmpXchgU32(&g_VBoxNetLwfGlobals.enmIdcState, LwfIdcState_Connecting, LwfIdcState_Disconnected))
+    {
+        Log((__FUNCTION__": IDC state change Diconnected -> Connecting\n"));
+
+        NTSTATUS Status = PsCreateSystemThread(&g_VBoxNetLwfGlobals.hInitIdcThread,
+                                               THREAD_ALL_ACCESS,
+                                               NULL,
+                                               NULL,
+                                               NULL,
+                                               vboxNetLwfWinInitIdcWorker,
+                                               &g_VBoxNetLwfGlobals);
+        Log((__FUNCTION__": create IDC initialization thread, status=0x%x\n", Status));
+        if (Status != STATUS_SUCCESS)
+        {
+            LogRel(("NETLWF: IDC initialization failed (system thread creation, status=0x%x)\n", Status));
+            /*
+             * We failed to init IDC and there will be no second chance.
+             */
+            Log((__FUNCTION__": IDC state change Connecting -> Diconnected\n"));
+            ASMAtomicWriteU32(&g_VBoxNetLwfGlobals.enmIdcState, LwfIdcState_Disconnected);
+        }
+        rc = RTErrConvertFromNtStatus(Status);
+    }
+    return rc;
+}
+
+static void vboxNetLwfWinStopInitIdcThread()
+{
+}
+
+
+RT_C_DECLS_BEGIN
+
+NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath);
+
+RT_C_DECLS_END
+
+NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath)
+{
+    NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
+    int rc;
+
+    /* the idc registration is initiated via IOCTL since our driver
+     * can be loaded when the VBoxDrv is not in case we are a Ndis IM driver */
+    rc = vboxNetLwfWinInitBase();
+    AssertRC(rc);
+    if (RT_SUCCESS(rc))
+    {
+        NdisZeroMemory(&g_VBoxNetLwfGlobals, sizeof (g_VBoxNetLwfGlobals));
+        RTListInit(&g_VBoxNetLwfGlobals.listModules);
+        NdisAllocateSpinLock(&g_VBoxNetLwfGlobals.Lock);
+        /*
+         * We choose to ignore IDC initialization errors here because if we fail to load
+         * our filter the upper protocols won't bind to the associated adapter, causing
+         * network failure at the host. Better to have non-working filter than broken
+         * networking on the host.
+         */
+        rc = vboxNetLwfWinStartInitIdcThread();
+        AssertRC(rc);
+
+        Status = vboxNetLwfWinRegister(pDriverObject, pRegistryPath);
+        Assert(Status == STATUS_SUCCESS);
+        if (Status == NDIS_STATUS_SUCCESS)
+        {
+            Log(("NETLWF: started successfully\n"));
+            return STATUS_SUCCESS;
+        }
+        NdisFreeSpinLock(&g_VBoxNetLwfGlobals.Lock);
+        vboxNetLwfWinFini();
+    }
+    else
+    {
+        Status = NDIS_STATUS_FAILURE;
+    }
+
+    return Status;
+}
+
+
+static VOID vboxNetLwfWinUnloadDriver(IN PDRIVER_OBJECT pDriver)
+{
+    LogFlow(("==>"__FUNCTION__": driver=%p\n", pDriver));
+    vboxNetLwfWinDevDestroy(&g_VBoxNetLwfGlobals);
+    NdisFDeregisterFilterDriver(g_VBoxNetLwfGlobals.hFilterDriver);
+    NdisFreeSpinLock(&g_VBoxNetLwfGlobals.Lock);
+    LogFlow(("<=="__FUNCTION__"\n"));
+    vboxNetLwfWinFini();
+}
+
+static const char *vboxNetLwfWinIdcStateToText(uint32_t enmState)
+{
+    switch (enmState)
+    {
+        case LwfIdcState_Disconnected: return "Disconnected";
+        case LwfIdcState_Connecting: return "Connecting";
+        case LwfIdcState_Connected: return "Connected";
+        case LwfIdcState_Stopping: return "Stopping";
+    }
+    return "Unknown";
+}
+
+static VOID vboxNetLwfWinInitIdcWorker(PVOID pvContext)
+{
+    int rc;
+    PVBOXNETLWFGLOBALS pGlobals = (PVBOXNETLWFGLOBALS)pvContext;
+
+    while (ASMAtomicReadU32(&pGlobals->enmIdcState) == LwfIdcState_Connecting)
+    {
+        rc = vboxNetFltInitIdc(&g_VBoxNetFltGlobals);
+        if (RT_SUCCESS(rc))
+        {
+            if (!ASMAtomicCmpXchgU32(&pGlobals->enmIdcState, LwfIdcState_Connected, LwfIdcState_Connecting))
+            {
+                /* The state has been changed (the only valid transition is to "Stopping"), undo init */
+                rc = vboxNetFltTryDeleteIdc(&g_VBoxNetFltGlobals);
+                Log((__FUNCTION__": state change (Connecting -> %s) while initializing IDC, deleted IDC, rc=0x%x\n",
+                     vboxNetLwfWinIdcStateToText(ASMAtomicReadU32(&pGlobals->enmIdcState)), rc));
+            }
+            else
+            {
+                Log((__FUNCTION__": IDC state change Connecting -> Connected\n"));
+            }
+        }
+        else
+        {
+            LARGE_INTEGER WaitIn100nsUnits;
+            WaitIn100nsUnits.QuadPart = -(LONGLONG)10000000; /* 1 sec */
+            KeDelayExecutionThread(KernelMode, FALSE /* non-alertable */, &WaitIn100nsUnits);
+        }
+    }
+    PsTerminateSystemThread(STATUS_SUCCESS);
+}
+
+static int vboxNetLwfWinTryFiniIdc()
+{
+    int rc = VINF_SUCCESS;
+    NTSTATUS Status;
+    PKTHREAD pThread = NULL;
+    uint32_t enmPrevState = ASMAtomicXchgU32(&g_VBoxNetLwfGlobals.enmIdcState, LwfIdcState_Stopping);
+
+    Log((__FUNCTION__": IDC state change %s -> Stopping\n", vboxNetLwfWinIdcStateToText(enmPrevState)));
+
+    switch (enmPrevState)
+    {
+        case LwfIdcState_Disconnected:
+            /* Have not even attempted to connect -- nothing to do. */
+            break;
+        case LwfIdcState_Stopping:
+            /* Impossible, but another thread is alreading doing FiniIdc, bail out */
+            Log(("ERROR: "__FUNCTION__"() called in 'Stopping' state\n"));
+            rc = VERR_INVALID_STATE;
+            break;
+        case LwfIdcState_Connecting:
+            /* the worker thread is running, let's wait for it to stop */
+            Status = ObReferenceObjectByHandle(g_VBoxNetLwfGlobals.hInitIdcThread,
+                                               THREAD_ALL_ACCESS, NULL, KernelMode,
+                                               (PVOID*)&pThread, NULL);
+            if (Status == STATUS_SUCCESS)
+            {
+                KeWaitForSingleObject(pThread, Executive, KernelMode, FALSE, NULL);
+                ObDereferenceObject(pThread);
+            }
+            else
+            {
+                Log(("ERROR in "__FUNCTION__": ObReferenceObjectByHandle(%p) failed with 0x%x\n",
+                     g_VBoxNetLwfGlobals.hInitIdcThread, Status));
+            }
+            rc = RTErrConvertFromNtStatus(Status);
+            break;
+        case LwfIdcState_Connected:
+            /* the worker succeeded in IDC init and terminated */
+            rc = vboxNetFltTryDeleteIdc(&g_VBoxNetFltGlobals);
+            Log((__FUNCTION__": deleted IDC, rc=0x%x\n", rc));
+            break;
+    }
+    return rc;
+}
+
+static void vboxNetLwfWinFiniBase()
+{
+    vboxNetFltDeleteGlobals(&g_VBoxNetFltGlobals);
+
+    /*
+     * Undo the work done during start (in reverse order).
+     */
+    memset(&g_VBoxNetFltGlobals, 0, sizeof(g_VBoxNetFltGlobals));
+
+    RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
+    RTLogDestroy(RTLogSetDefaultInstance(NULL));
+
+    RTR0Term();
+}
+
+static int vboxNetLwfWinInitBase()
+{
+    int rc = RTR0Init(0);
+    if (!RT_SUCCESS(rc))
+        return rc;
+
+    memset(&g_VBoxNetFltGlobals, 0, sizeof(g_VBoxNetFltGlobals));
+    rc = vboxNetFltInitGlobals(&g_VBoxNetFltGlobals);
+    if (!RT_SUCCESS(rc))
+        RTR0Term();
+
+    return rc;
+}
+
+static int vboxNetLwfWinFini()
+{
+    int rc = vboxNetLwfWinTryFiniIdc();
+    if (RT_SUCCESS(rc))
+    {
+        vboxNetLwfWinFiniBase();
+    }
+    return rc;
+}
+
+
+/*
+ *
+ * The OS specific interface definition
+ *
+ */
+
+
+bool vboxNetFltOsMaybeRediscovered(PVBOXNETFLTINS pThis)
+{
+    LogFlow(("==>"__FUNCTION__": instance=%p\n", pThis));
+    LogFlow(("<=="__FUNCTION__": return %RTbool\n", !ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost)));
+    /* AttachToInterface true if disconnected */
+    return !ASMAtomicUoReadBool(&pThis->fDisconnectedFromHost);
+}
+
+int vboxNetFltPortOsXmit(PVBOXNETFLTINS pThis, void *pvIfData, PINTNETSG pSG, uint32_t fDst)
+{
+    int rc = VINF_SUCCESS;
+
+    PVBOXNETLWF_MODULE pModule = (PVBOXNETLWF_MODULE)pThis->u.s.WinIf.hModuleCtx;
+    LogFlow(("==>"__FUNCTION__": instance=%p module=%p\n", pThis, pModule));
+    if (!pModule)
+    {
+        LogFlow(("<=="__FUNCTION__": pModule is null, return %d\n", VERR_INTERNAL_ERROR));
+        return VERR_INTERNAL_ERROR;
+    }
+    /* Prevent going into "paused" state until all transmissions have been completed. */
+    NDIS_WAIT_FOR_MUTEX(&pModule->InTransmit);
+    /* Ignore all sends if the stack is paused or being paused, etc... */
+    if (!vboxNetLwfWinIsRunning(pModule))
+    {
+        NDIS_RELEASE_MUTEX(&pModule->InTransmit);
+        return VINF_SUCCESS;
+    }
+
+    const char *pszDir = (fDst & INTNETTRUNKDIR_WIRE) ?
+        ( (fDst & INTNETTRUNKDIR_HOST) ? "intnet --> all" : "intnet --> wire" ) : "intnet --> host";
+    vboxNetLwfWinDumpPacket(pSG, pszDir);
+    /*
+     * There are two possible strategies to deal with incoming SGs:
+     * 1) make a copy of data and complete asynchronously;
+     * 2) complete synchronously using the original data buffers.
+     * Before we consider implementing (1) it is quite interesting to see
+     * how well (2) performs. So we block until our requests are complete.
+     * Actually there is third possibility -- to use SG retain/release
+     * callbacks, but those seem not be fully implemented yet.
+     * Note that ansynchronous completion will require different implementation
+     * of vboxNetLwfWinPause(), not relying on InTransmit mutex.
+     */
+#ifdef VBOXNETLWF_SYNC_SEND
+    PVOID aEvents[2]; /* To wire and to host */
+    ULONG nEvents = 0;
+    LARGE_INTEGER timeout;
+    timeout.QuadPart = -(LONGLONG)10000000; /* 1 sec */
+#endif /* VBOXNETLWF_SYNC_SEND */
+    if (fDst & INTNETTRUNKDIR_WIRE)
+    {
+        PNET_BUFFER_LIST pBufList = vboxNetLwfWinSGtoNB(pModule, pSG);
+        if (pBufList)
+        {
+#ifdef VBOXNETLWF_SYNC_SEND
+            aEvents[nEvents++] = &pModule->EventWire;
+#else /* !VBOXNETLWF_SYNC_SEND */
+            if (ASMAtomicIncS32(&pModule->cPendingBuffers) == 1)
+                NdisResetEvent(&pModule->EventSendComplete);
+#endif /* !VBOXNETLWF_SYNC_SEND */
+            NdisFSendNetBufferLists(pModule->hFilter, pBufList, NDIS_DEFAULT_PORT_NUMBER, 0); /** @todo sendFlags! */
+        }
+    }
+    if (fDst & INTNETTRUNKDIR_HOST)
+    {
+        PNET_BUFFER_LIST pBufList = vboxNetLwfWinSGtoNB(pModule, pSG);
+        if (pBufList)
+        {
+#ifdef VBOXNETLWF_SYNC_SEND
+            aEvents[nEvents++] = &pModule->EventHost;
+#else /* !VBOXNETLWF_SYNC_SEND */
+            if (ASMAtomicIncS32(&pModule->cPendingBuffers) == 1)
+                NdisResetEvent(&pModule->EventSendComplete);
+#endif /* !VBOXNETLWF_SYNC_SEND */
+            NdisFIndicateReceiveNetBufferLists(pModule->hFilter, pBufList, NDIS_DEFAULT_PORT_NUMBER, 1, 0);
+        }
+    }
+#ifdef VBOXNETLWF_SYNC_SEND
+    if (nEvents)
+    {
+        NTSTATUS Status = KeWaitForMultipleObjects(nEvents, aEvents, WaitAll, Executive, KernelMode, FALSE, &timeout, NULL);
+        if (Status != STATUS_SUCCESS)
+        {
+            Log(("ERROR! "__FUNCTION__": KeWaitForMultipleObjects() failed with 0x%x\n", Status));
+            if (Status == STATUS_TIMEOUT)
+                rc = VERR_TIMEOUT;
+            else
+                rc = RTErrConvertFromNtStatus(Status);
+        }
+    }
+#endif /* VBOXNETLWF_SYNC_SEND */
+    NDIS_RELEASE_MUTEX(&pModule->InTransmit);
+
+    LogFlow(("<=="__FUNCTION__": return %d\n", rc));
+    return rc;
+}
+
+void vboxNetFltPortOsSetActive(PVBOXNETFLTINS pThis, bool fActive)
+{
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)pThis->u.s.WinIf.hModuleCtx;
+    LogFlow(("==>"__FUNCTION__": instance=%p module=%p fActive=%RTbool\n", pThis, pModuleCtx, fActive));
+    if (!pModuleCtx)
+    {
+        LogFlow(("<=="__FUNCTION__": pModuleCtx is null\n"));
+        return;
+    }
+
+    NDIS_STATUS Status = STATUS_SUCCESS;
+    bool fOldActive = ASMAtomicXchgBool(&pModuleCtx->fActive, fActive);
+    if (fOldActive != fActive)
+    {
+        /// @todo Shouldn't we wait for traffic to cease here? Probably not.
+        /* Schedule restart to enable/disable bypass mode */
+        NdisFRestartFilter(pModuleCtx->hFilter);
+        Status = vboxNetLwfWinSetPacketFilter(pModuleCtx, fActive);
+        LogFlow(("<=="__FUNCTION__": vboxNetLwfWinSetPacketFilter() returned 0x%x\n", Status));
+    }
+    else
+        LogFlow(("<=="__FUNCTION__": no change, remain %sactive\n", fActive ? "":"in"));
+}
+
+int vboxNetFltOsDisconnectIt(PVBOXNETFLTINS pThis)
+{
+    LogFlow(("==>"__FUNCTION__": instance=%p\n", pThis));
+    LogFlow(("<=="__FUNCTION__": return 0\n"));
+    return VINF_SUCCESS;
+}
+
+int vboxNetFltOsConnectIt(PVBOXNETFLTINS pThis)
+{
+    LogFlow(("==>"__FUNCTION__": instance=%p\n", pThis));
+    LogFlow(("<=="__FUNCTION__": return 0\n"));
+    return VINF_SUCCESS;
+}
+
+void vboxNetFltOsDeleteInstance(PVBOXNETFLTINS pThis)
+{
+    PVBOXNETLWF_MODULE pModuleCtx = (PVBOXNETLWF_MODULE)pThis->u.s.WinIf.hModuleCtx;
+    LogFlow(("==>"__FUNCTION__": instance=%p module=%p\n", pThis, pModuleCtx));
+    /* Technically it is possible that the module has already been gone by now. */
+    if (pModuleCtx)
+    {
+        Assert(!pModuleCtx->fActive); /* Deactivation ensures bypass mode */
+        pModuleCtx->pNetFlt = NULL;
+        pThis->u.s.WinIf.hModuleCtx = NULL;
+    }
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+static void vboxNetLwfWinReportCapabilities(PVBOXNETFLTINS pThis, PVBOXNETLWF_MODULE pModuleCtx)
+{
+    if (pThis->pSwitchPort
+        && vboxNetFltTryRetainBusyNotDisconnected(pThis))
+    {
+        pThis->pSwitchPort->pfnReportMacAddress(pThis->pSwitchPort, &pModuleCtx->MacAddr);
+        pThis->pSwitchPort->pfnReportPromiscuousMode(pThis->pSwitchPort,
+                                                     vboxNetLwfWinIsPromiscuous(pModuleCtx));
+        pThis->pSwitchPort->pfnReportGsoCapabilities(pThis->pSwitchPort, 0,
+                                                     INTNETTRUNKDIR_WIRE | INTNETTRUNKDIR_HOST);
+        pThis->pSwitchPort->pfnReportNoPreemptDsts(pThis->pSwitchPort, 0 /* none */);
+        vboxNetFltRelease(pThis, true /*fBusy*/);
+    }
+}
+
+int vboxNetFltOsInitInstance(PVBOXNETFLTINS pThis, void *pvContext)
+{
+    LogFlow(("==>"__FUNCTION__": instance=%p context=%p\n", pThis, pvContext));
+    AssertReturn(pThis, VERR_INVALID_PARAMETER);
+    Log((__FUNCTION__": trunk name=%s\n", pThis->szName));
+    ANSI_STRING strInst;
+    RtlInitAnsiString(&strInst, pThis->szName);
+    PVBOXNETLWF_MODULE pModuleCtx = NULL;
+    RTListForEach(&g_VBoxNetLwfGlobals.listModules, pModuleCtx, VBOXNETLWF_MODULE, node)
+    {
+        DbgPrint(__FUNCTION__": evaluating module, name=%Z\n", pModuleCtx->strMiniportName);
+        if (RtlEqualString(&strInst, &pModuleCtx->strMiniportName, TRUE))
+        {
+            Log((__FUNCTION__": found matching module, name=%s\n", pThis->szName));
+            pThis->u.s.WinIf.hModuleCtx = pModuleCtx;
+            pModuleCtx->pNetFlt = pThis;
+            vboxNetLwfWinReportCapabilities(pThis, pModuleCtx);
+            LogFlow(("<=="__FUNCTION__": return 0\n"));
+            return VINF_SUCCESS;
+        }
+    }
+    LogFlow(("<=="__FUNCTION__": return VERR_INTNET_FLT_IF_NOT_FOUND\n"));
+    return VERR_INTNET_FLT_IF_NOT_FOUND;
+}
+
+int vboxNetFltOsPreInitInstance(PVBOXNETFLTINS pThis)
+{
+    LogFlow(("==>"__FUNCTION__": instance=%p\n", pThis));
+    pThis->u.s.WinIf.hModuleCtx = 0;
+    LogFlow(("<=="__FUNCTION__": return 0\n"));
+    return VINF_SUCCESS;
+}
+
+void vboxNetFltPortOsNotifyMacAddress(PVBOXNETFLTINS pThis, void *pvIfData, PCRTMAC pMac)
+{
+    LogFlow(("==>"__FUNCTION__": instance=%p data=%p mac=%RTmac\n", pThis, pvIfData, pMac));
+    LogFlow(("<=="__FUNCTION__"\n"));
+}
+
+int vboxNetFltPortOsConnectInterface(PVBOXNETFLTINS pThis, void *pvIf, void **ppvIfData)
+{
+    LogFlow(("==>"__FUNCTION__": instance=%p if=%p data=%p\n", pThis, pvIf, ppvIfData));
+    LogFlow(("<=="__FUNCTION__": return 0\n"));
+    /* Nothing to do */
+    return VINF_SUCCESS;
+}
+
+int vboxNetFltPortOsDisconnectInterface(PVBOXNETFLTINS pThis, void *pvIfData)
+{
+    LogFlow(("==>"__FUNCTION__": instance=%p data=%p\n", pThis, pvIfData));
+    LogFlow(("<=="__FUNCTION__": return 0\n"));
+    /* Nothing to do */
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf-win.h b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf-win.h
new file mode 100644
index 0000000..3d26f22
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf-win.h
@@ -0,0 +1,32 @@
+/* $Id: VBoxNetLwf-win.h $ */
+/** @file
+ * VBoxNetLwf-win.h - Bridged Networking Driver, Windows-specific code.
+ */
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#ifndef ___VBoxNetLwf_win_h___
+#define ___VBoxNetLwf_win_h___
+
+#define VBOXNETLWF_VERSION_NDIS_MAJOR        6
+#define VBOXNETLWF_VERSION_NDIS_MINOR        0
+
+#define VBOXNETLWF_NAME_FRIENDLY             L"VirtualBox NDIS Light-Weight Filter"
+#define VBOXNETLWF_NAME_UNIQUE               L"{7af6b074-048d-4444-bfce-1ecc8bc5cb76}"
+#define VBOXNETLWF_NAME_SERVICE              L"VBoxNetLwf"
+
+#define VBOXNETLWF_NAME_LINK                 L"\\DosDevices\\Global\\VBoxNetLwf"
+#define VBOXNETLWF_NAME_DEVICE               L"\\Device\\VBoxNetLwf"
+
+#define VBOXNETLWF_MEM_TAG                   'FLBV'
+#define VBOXNETLWF_REQ_ID                    'fLBV'
+
+#endif /* #ifndef ___VBoxNetLwf_win_h___ */
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf.inf b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf.inf
new file mode 100644
index 0000000..1d17d70
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/ndis6/VBoxNetLwf.inf
@@ -0,0 +1,98 @@
+; $Id: VBoxNetLwf.inf $
+; @file
+; VBoxNetLwf.inf - VirtualBox Bridged Networking Driver inf file
+;
+;
+; Copyright (C) 2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+
+[Version]
+Signature   = "$Windows NT$"
+;cat  CatalogFile = VBoxNetLwf.cat
+Class       = NetService
+ClassGUID   = {4D36E974-E325-11CE-BFC1-08002BE10318}
+Provider    = %Provider%
+;edit-DriverVer=10/23/2014,1.0.1.0
+
+
+[Manufacturer]
+%Provider% = VBox,NTx86,NTamd64
+
+[ControlFlags]
+
+[VBox]
+%VBoxNetLwf_Desc% = VBoxNetLwf.ndi, oracle_VBoxNetLwf
+
+[VBox.NTx86]
+%VBoxNetLwf_Desc% = VBoxNetLwf.ndi, oracle_VBoxNetLwf
+
+[VBox.NTamd64]
+%VBoxNetLwf_Desc% = VBoxNetLwf.ndi, oracle_VBoxNetLwf
+
+[VBoxNetLwf.ndi]
+AddReg           = VBoxNetLwf.ndi.AddReg, VBoxNetLwf.AddReg
+Characteristics  = 0x40000 ;  NCF_LW_FILTER
+CopyFiles        = VBoxNetLwf.Files.Sys
+NetCfgInstanceId = "{7af6b074-048d-4444-bfce-1ecc8bc5cb76}"
+
+[VBoxNetLwf.ndi.Remove.Services]
+DelService       = VBoxNetLwf,0x200 ; Stop the service before uninstalling
+
+[VBoxNetLwf.ndi.Services]
+AddService = VBoxNetLwf,, VBoxNetLwf.AddService
+
+[VBoxNetLwf.AddService]
+DisplayName    = %VBoxNetLwfService_Desc%
+ServiceType    = 1 ;SERVICE_KERNEL_DRIVER
+StartType      = 1 ;SERVICE_SYSTEM_START
+ErrorControl   = 1 ;SERVICE_ERROR_NORMAL
+ServiceBinary  = %12%\VBoxNetLwf.sys
+LoadOrderGroup = NDIS
+AddReg         = VBoxNetLwf.AddService.AddReg
+
+[VBoxNetLwf.AddService.AddReg]
+
+[SourceDisksNames]
+1=%DiskDescription%,"",,
+
+[SourceDisksFiles]
+VBoxNetLwf.sys=1
+
+[DestinationDirs]
+DefaultDestDir = 12
+VBoxNetLwf.Files.Sys   = 12   ; %windir%\System32\drivers
+
+[VBoxNetLwf.Files.Sys]
+VBoxNetLwf.sys,,,2
+
+
+[VBoxNetLwf.ndi.AddReg]
+HKR, Ndi, HelpText, , %VBoxNetLwf_HELP%
+HKR, Ndi,            ClsID,              0, {f374d1a0-bf08-4bdc-9cb2-c15ddaeef955}
+;HKR, Ndi,            ComponentDll,        , VBoxNetLwfNobj.dll
+HKR, Ndi,            FilterClass,         , compression
+HKR, Ndi,            FilterType,   0x10001, 0x2
+HKR, Ndi,            FilterRunType,0x10001, 2 ; OPTIONAL, to prevent unbinding of protocol drivers
+HKR, Ndi,            Service,             , VBoxNetLwf
+HKR, Ndi,            CoServices,   0x10000, VBoxNetLwf
+HKR, Ndi\Interfaces, UpperRange,          , noupper
+HKR, Ndi\Interfaces, LowerRange,          , nolower
+HKR, Ndi\Interfaces, FilterMediaTypes,    , ethernet
+
+[VBoxNetLwf.AddReg]
+;HKR, Parameters, Param1, 0, 4
+
+[Strings]
+Provider = "Oracle Corporation"
+DiskDescription = "VirtualBox NDIS6 Bridged Networking Driver"
+VBoxNetLwf_Desc = "VirtualBox NDIS6 Bridged Networking Driver"
+VBoxNetLwf_HELP = "VirtualBox NDIS6 Bridged Networking Driver"
+VBoxNetLwfService_Desc = "VirtualBox NDIS6 Bridged Networking Service"
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/nobj/VBoxNetFltNobj.rc b/src/VBox/HostDrivers/VBoxNetFlt/win/nobj/VBoxNetFltNobj.rc
index 34cfac4..f98786f 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/nobj/VBoxNetFltNobj.rc
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/nobj/VBoxNetFltNobj.rc
@@ -20,30 +20,27 @@
 #include "VBoxNetFltNobjRc.h"
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
-  FILEFLAGS        VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
-#else
-  FILEFLAGS        0 // final version
-#endif
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Bridged Networking Driver Notify Object v1.1\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxNetFltNobj\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxNetFltNobj.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpInstall.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpInstall.cpp
index 0d612f0..011a1ab 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpInstall.cpp
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpInstall.cpp
@@ -21,7 +21,12 @@
 
 #include <devguid.h>
 
+#define VBOX_NETADP_HWID L"sun_VBoxNetAdp"
+#ifdef NDIS60
+#define VBOX_NETADP_INF L"VBoxNetAdp6.inf"
+#else /* !NDIS60 */
 #define VBOX_NETADP_INF L"VBoxNetAdp.inf"
+#endif /* !NDIS60 */
 
 static VOID winNetCfgLogger(LPCSTR szString)
 {
@@ -45,6 +50,10 @@ static int VBoxNetAdpInstall(void)
 
         if (dwErr == ERROR_SUCCESS)
         {
+            hr = VBoxDrvCfgInfInstall(MpInf);
+            if (FAILED(hr))
+                printf("VBoxDrvCfgInfInstall failed %#x\n", hr);
+
             GUID guid;
             BSTR name, errMsg;
 
@@ -97,10 +106,10 @@ static int VBoxNetAdpUninstall(void)
     HRESULT hr = CoInitialize(NULL);
     if (SUCCEEDED(hr))
     {
-        hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(L"sun_VBoxNetAdp");
+        hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(VBOX_NETADP_HWID);
         if (SUCCEEDED(hr))
         {
-            hr = VBoxDrvCfgInfUninstallAllSetupDi(&GUID_DEVCLASS_NET, L"Net", L"sun_VBoxNetAdp", 0/* could be SUOI_FORCEDELETE */);
+            hr = VBoxDrvCfgInfUninstallAllSetupDi(&GUID_DEVCLASS_NET, L"Net", VBOX_NETADP_HWID, 0/* could be SUOI_FORCEDELETE */);
             if (SUCCEEDED(hr))
             {
                 printf("uninstallation successful\n");
@@ -130,7 +139,14 @@ static int VBoxNetAdpUpdate(void)
     if (SUCCEEDED(hr))
     {
         BOOL fRebootRequired = FALSE;
-        hr = VBoxNetCfgWinUpdateHostOnlyNetworkInterface(VBOX_NETADP_INF, &fRebootRequired);
+        /*
+         * Before we can update the driver for existing adapters we need to remove
+         * all old driver packages from the driver cache. Otherwise we may end up
+         * with both NDIS5 and NDIS6 versions of VBoxNetAdp in the cache which
+         * will cause all sorts of trouble.
+         */
+        VBoxDrvCfgInfUninstallAllF(L"Net", VBOX_NETADP_HWID, SUOI_FORCEDELETE);
+        hr = VBoxNetCfgWinUpdateHostOnlyNetworkInterface(VBOX_NETADP_INF, &fRebootRequired, VBOX_NETADP_HWID);
         if (SUCCEEDED(hr))
         {
             if (fRebootRequired)
@@ -159,7 +175,7 @@ static int VBoxNetAdpDisable(void)
     HRESULT hr = CoInitialize(NULL);
     if (SUCCEEDED(hr))
     {
-        hr = VBoxNetCfgWinPropChangeAllNetDevicesOfId(L"sun_VBoxNetAdp", VBOXNECTFGWINPROPCHANGE_TYPE_DISABLE);
+        hr = VBoxNetCfgWinPropChangeAllNetDevicesOfId(VBOX_NETADP_HWID, VBOXNECTFGWINPROPCHANGE_TYPE_DISABLE);
         if (SUCCEEDED(hr))
         {
             printf("disabling successful\n");
@@ -186,7 +202,7 @@ static int VBoxNetAdpEnable(void)
     HRESULT hr = CoInitialize(NULL);
     if (SUCCEEDED(hr))
     {
-        hr = VBoxNetCfgWinPropChangeAllNetDevicesOfId(L"sun_VBoxNetAdp", VBOXNECTFGWINPROPCHANGE_TYPE_ENABLE);
+        hr = VBoxNetCfgWinPropChangeAllNetDevicesOfId(VBOX_NETADP_HWID, VBOXNECTFGWINPROPCHANGE_TYPE_ENABLE);
         if (SUCCEEDED(hr))
         {
             printf("enabling successful\n");
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpUninstall.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpUninstall.cpp
index bbc7b91..89c8b13 100644
--- a/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpUninstall.cpp
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpUninstall.cpp
@@ -21,6 +21,11 @@
 
 #include <devguid.h>
 
+#ifdef NDIS60
+#define VBOX_NETADP_HWID L"sun_VBoxNetAdp6"
+#else /* !NDIS60 */
+#define VBOX_NETADP_HWID L"sun_VBoxNetAdp"
+#endif /* !NDIS60 */
 
 static VOID winNetCfgLogger (LPCSTR szString)
 {
@@ -37,10 +42,10 @@ static int VBoxNetAdpUninstall()
     HRESULT hr = CoInitialize(NULL);
     if(hr == S_OK)
     {
-        hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(L"sun_VBoxNetAdp");
+        hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(VBOX_NETADP_HWID);
         if(hr == S_OK)
         {
-            hr = VBoxDrvCfgInfUninstallAllSetupDi(&GUID_DEVCLASS_NET, L"Net", L"sun_VBoxNetAdp", 0/* could be SUOI_FORCEDELETE */);
+            hr = VBoxDrvCfgInfUninstallAllSetupDi(&GUID_DEVCLASS_NET, L"Net", VBOX_NETADP_HWID, 0/* could be SUOI_FORCEDELETE */);
             if(hr == S_OK)
             {
                 printf("uninstalled successfully\n");
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfInstall.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfInstall.cpp
new file mode 100644
index 0000000..7073b16
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfInstall.cpp
@@ -0,0 +1,157 @@
+/* $Id: VBoxNetLwfInstall.cpp $ */
+/** @file
+ * NetLwfInstall - VBoxNetLwf installer command line tool
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <VBox/VBoxNetCfg-win.h>
+#include <devguid.h>
+#include <stdio.h>
+
+#define VBOX_NETCFG_APP_NAME L"NetLwfInstall"
+#define VBOX_NETLWF_INF L".\\VBoxNetLwf.inf"
+#define VBOX_NETLWF_RETRIES 10
+
+
+static VOID winNetCfgLogger (LPCSTR szString)
+{
+    printf("%s", szString);
+}
+
+/** Wrapper around GetfullPathNameW that will try an alternative INF location.
+ *
+ * The default location is the current directory.  If not found there, the
+ * alternative location is the executable directory.  If not found there either,
+ * the first alternative is present to the caller.
+ */
+static DWORD MyGetfullPathNameW(LPCWSTR pwszName, size_t cchFull, LPWSTR pwszFull)
+{
+    LPWSTR pwszFilePart;
+    DWORD dwSize = GetFullPathNameW(pwszName, (DWORD)cchFull, pwszFull, &pwszFilePart);
+    if(dwSize <= 0)
+        return dwSize;
+
+    /* if it doesn't exist, see if the file exists in the same directory as the executable. */
+    if (GetFileAttributesW(pwszFull) == INVALID_FILE_ATTRIBUTES)
+    {
+        WCHAR wsz[512];
+        DWORD cch = GetModuleFileNameW(GetModuleHandle(NULL), &wsz[0], sizeof(wsz) / sizeof(wsz[0]));
+        if(cch > 0)
+        {
+            while(cch > 0 && wsz[cch - 1] != '/' && wsz[cch - 1] != '\\' && wsz[cch - 1] != ':')
+                cch--;
+            unsigned i = 0;
+            while(cch < sizeof(wsz) / sizeof(wsz[0]))
+            {
+                wsz[cch] = pwszFilePart[i++];
+                if(!wsz[cch])
+                {
+                    dwSize = GetFullPathNameW(wsz, (DWORD)cchFull, pwszFull, NULL);
+                    if(dwSize > 0 && GetFileAttributesW(pwszFull) != INVALID_FILE_ATTRIBUTES)
+                        return dwSize;
+                    break;
+                }
+                cch++;
+            }
+        }
+    }
+
+    /* fallback */
+    return GetFullPathNameW(pwszName, (DWORD)cchFull, pwszFull, NULL);
+}
+
+static int VBoxNetLwfInstall()
+{
+    WCHAR Inf[MAX_PATH];
+    INetCfg *pnc;
+    LPWSTR lpszLockedBy = NULL;
+    int r = 1;
+
+    VBoxNetCfgWinSetLogging(winNetCfgLogger);
+
+    HRESULT hr = CoInitialize(NULL);
+    if(hr == S_OK)
+    {
+        int i = 0;
+        do
+        {
+            hr = VBoxNetCfgWinQueryINetCfg(&pnc, TRUE, VBOX_NETCFG_APP_NAME, 10000, &lpszLockedBy);
+            if(hr == S_OK)
+            {
+                DWORD dwSize;
+                dwSize = MyGetfullPathNameW(VBOX_NETLWF_INF, sizeof(Inf)/sizeof(Inf[0]), Inf);
+                if(dwSize > 0)
+                {
+                    /** @todo add size check for (sizeof(Inf)/sizeof(Inf[0])) == dwSize (string length in sizeof(Inf[0])) */
+                    hr = VBoxNetCfgWinNetLwfInstall(pnc, Inf);
+                    if(hr == S_OK)
+                    {
+                        wprintf(L"installed successfully\n");
+                        r = 0;
+                    }
+                    else
+                    {
+                        wprintf(L"error installing VBoxNetLwf (0x%x)\n", hr);
+                    }
+                }
+                else
+                {
+                    hr = HRESULT_FROM_WIN32(GetLastError());
+                    wprintf(L"error getting full inf path for VBoxNetLwf.inf (0x%x)\n", hr);
+                }
+
+
+                VBoxNetCfgWinReleaseINetCfg(pnc, TRUE);
+                break;
+            }
+            else if(hr == NETCFG_E_NO_WRITE_LOCK && lpszLockedBy)
+            {
+                if(i < VBOX_NETLWF_RETRIES && !wcscmp(lpszLockedBy, L"6to4svc.dll"))
+                {
+                    wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", ++i, VBOX_NETLWF_RETRIES);
+                    CoTaskMemFree(lpszLockedBy);
+                }
+                else
+                {
+                    wprintf(L"Error: write lock is owned by another application (%s), close the application and retry installing\n", lpszLockedBy);
+                    r = 1;
+                    CoTaskMemFree(lpszLockedBy);
+                    break;
+                }
+            }
+            else
+            {
+                wprintf(L"Error getting the INetCfg interface (0x%x)\n", hr);
+                r = 1;
+                break;
+            }
+        } while(true);
+
+        CoUninitialize();
+    }
+    else
+    {
+        wprintf(L"Error initializing COM (0x%x)\n", hr);
+        r = 1;
+    }
+
+    VBoxNetCfgWinSetLogging(NULL);
+
+    return r;
+}
+
+int __cdecl main(int argc, char **argv)
+{
+    return VBoxNetLwfInstall();
+}
diff --git a/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfUninstall.cpp b/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfUninstall.cpp
new file mode 100644
index 0000000..af26bde
--- /dev/null
+++ b/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetLwfUninstall.cpp
@@ -0,0 +1,100 @@
+/* $Id: VBoxNetLwfUninstall.cpp $ */
+/** @file
+ * NetLwfUninstall - VBoxNetLwf uninstaller command line tool
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <VBox/VBoxNetCfg-win.h>
+#include <stdio.h>
+
+#define VBOX_NETCFG_APP_NAME L"NetLwfUninstall"
+#define VBOX_NETLWF_RETRIES 10
+
+static VOID winNetCfgLogger (LPCSTR szString)
+{
+    printf("%s", szString);
+}
+
+static int VBoxNetLwfUninstall()
+{
+    INetCfg *pnc;
+    LPWSTR lpszLockedBy = NULL;
+    int r;
+
+    VBoxNetCfgWinSetLogging(winNetCfgLogger);
+
+    HRESULT hr = CoInitialize(NULL);
+    if(hr == S_OK)
+    {
+        int i = 0;
+        do
+        {
+            hr = VBoxNetCfgWinQueryINetCfg(&pnc, TRUE, VBOX_NETCFG_APP_NAME, 10000, &lpszLockedBy);
+            if(hr == S_OK)
+            {
+                hr = VBoxNetCfgWinNetLwfUninstall(pnc);
+                if(hr != S_OK)
+                {
+                    wprintf(L"error uninstalling VBoxNetLwf (0x%x)\n", hr);
+                    r = 1;
+                }
+                else
+                {
+                    wprintf(L"uninstalled successfully\n");
+                    r = 0;
+                }
+
+                VBoxNetCfgWinReleaseINetCfg(pnc, TRUE);
+                break;
+            }
+            else if(hr == NETCFG_E_NO_WRITE_LOCK && lpszLockedBy)
+            {
+                if(i < VBOX_NETLWF_RETRIES && !wcscmp(lpszLockedBy, L"6to4svc.dll"))
+                {
+                    wprintf(L"6to4svc.dll is holding the lock, retrying %d out of %d\n", ++i, VBOX_NETLWF_RETRIES);
+                    CoTaskMemFree(lpszLockedBy);
+                }
+                else
+                {
+                    wprintf(L"Error: write lock is owned by another application (%s), close the application and retry uninstalling\n", lpszLockedBy);
+                    r = 1;
+                    CoTaskMemFree(lpszLockedBy);
+                    break;
+                }
+            }
+            else
+            {
+                wprintf(L"Error getting the INetCfg interface (0x%x)\n", hr);
+                r = 1;
+                break;
+            }
+        } while(true);
+
+        CoUninitialize();
+    }
+    else
+    {
+        wprintf(L"Error initializing COM (0x%x)\n", hr);
+        r = 1;
+    }
+
+    VBoxNetCfgWinSetLogging(NULL);
+
+    return r;
+}
+
+int __cdecl main(int argc, char **argv)
+{
+    return VBoxNetLwfUninstall();
+}
diff --git a/src/VBox/HostDrivers/VBoxPci/VBoxPci.c b/src/VBox/HostDrivers/VBoxPci/VBoxPci.c
index 6149f97..9eed3d7 100644
--- a/src/VBox/HostDrivers/VBoxPci/VBoxPci.c
+++ b/src/VBox/HostDrivers/VBoxPci/VBoxPci.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -89,7 +89,7 @@ DECLINLINE(int) vboxPciDevLock(PVBOXRAWPCIINS pThis)
 DECLINLINE(void) vboxPciDevUnlock(PVBOXRAWPCIINS pThis)
 {
 #ifdef VBOX_WITH_SHARED_PCI_INTERRUPTS
-    RTSpinlockReleaseNoInts(pThis->hSpinlock);
+    RTSpinlockRelease(pThis->hSpinlock);
 #else
     RTSemFastMutexRelease(pThis->hFastMtx);
 #endif
diff --git a/src/VBox/HostDrivers/VBoxPci/VBoxPciInternal.h b/src/VBox/HostDrivers/VBoxPci/VBoxPciInternal.h
index 6b435d6..a7f2ff3 100644
--- a/src/VBox/HostDrivers/VBoxPci/VBoxPciInternal.h
+++ b/src/VBox/HostDrivers/VBoxPci/VBoxPciInternal.h
@@ -94,6 +94,8 @@ typedef struct VBOXRAWPCIINS
 
     /** Pointer to per-VM context in hypervisor data. */
     PRAWPCIPERVM       pVmCtx;
+
+    RTR0PTR            aRegionR0Mapping[/* XXX: magic */ 7];
 } VBOXRAWPCIINS;
 
 /**
diff --git a/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c b/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
index f8e3f46..5ff080c 100644
--- a/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
+++ b/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
@@ -80,7 +80,7 @@ MODULE_VERSION(VBOX_VERSION_STRING);
 # define PCI_DEV_GET_SLOT(bus, devfn)  pci_get_bus_and_slot(bus, devfn)
 #else
 # define PCI_DEV_GET(v,d,p)            pci_find_device(v,d,p)
-# define PCI_DEV_PUT(x)                do {} while(0)
+# define PCI_DEV_PUT(x)                do { } while (0)
 # define PCI_DEV_GET_SLOT(bus, devfn)  pci_find_slot(bus, devfn)
 #endif
 
@@ -99,6 +99,17 @@ MODULE_VERSION(VBOX_VERSION_STRING);
  */
 #define DRIVER_NAME      "vboxpci"
 
+/*
+ * Currently we keep the device bound to pci stub driver, so
+ * dev_printk() &co would report that instead of our name. They also
+ * expect non-NULL dev pointer in older kernels.
+ */
+#define vbpci_printk(level, pdev, format, arg...)               \
+       printk(level DRIVER_NAME "%s%s: " format,                \
+              pdev ? " " : "", pdev ? pci_name(pdev) : "",      \
+              ## arg)
+
+
 /**
  * Initialize module.
  *
@@ -197,30 +208,34 @@ int vboxPciOsDevRegisterWithIommu(PVBOXRAWPCIINS pIns)
 #ifdef VBOX_WITH_IOMMU
     int rc;
     int status;
+    struct pci_dev *pPciDev = pIns->pPciDev;
     PVBOXRAWPCIDRVVM pData = VBOX_DRV_VMDATA(pIns);
 
     if (!pData)
     {
-        printk(KERN_DEBUG "vboxpci: VM data not initialized (attach)\n");
+        vbpci_printk(KERN_DEBUG, pPciDev,
+                     "cannot attach to IOMMU, no VM data\n");
         return VERR_INVALID_PARAMETER;
     }
 
     if (!pData->pIommuDomain)
     {
-        printk(KERN_DEBUG "vboxpci: No IOMMU domain (attach)\n");
+        vbpci_printk(KERN_DEBUG, pIns->pPciDev,
+                     "cannot attach to IOMMU, no domain\n");
         return VERR_NOT_FOUND;
     }
 
-    status = iommu_attach_device(pData->pIommuDomain, &pIns->pPciDev->dev);
+    status = iommu_attach_device(pData->pIommuDomain, &pPciDev->dev);
     if (status == 0)
     {
-        printk(KERN_DEBUG "vboxpci: iommu_attach_device() success\n");
+        vbpci_printk(KERN_DEBUG, pPciDev, "attached to IOMMU\n");
         pIns->fIommuUsed = true;
-        rc = VINF_SUCCESS;;
+        rc = VINF_SUCCESS;
     }
     else
     {
-        printk(KERN_DEBUG "vboxpci: iommu_attach_device() failed\n");
+        vbpci_printk(KERN_DEBUG, pPciDev,
+                     "failed to attach to IOMMU, error %d\n", status);
         rc = VERR_INTERNAL_ERROR;
     }
 
@@ -238,24 +253,27 @@ int vboxPciOsDevUnregisterWithIommu(PVBOXRAWPCIINS pIns)
 {
 #ifdef VBOX_WITH_IOMMU
     int rc = VINF_SUCCESS;
+    struct pci_dev *pPciDev = pIns->pPciDev;
     PVBOXRAWPCIDRVVM pData = VBOX_DRV_VMDATA(pIns);
 
     if (!pData)
     {
-        printk(KERN_DEBUG "vboxpci: VM data not inited (detach)\n");
+        vbpci_printk(KERN_DEBUG, pPciDev,
+                     "cannot detach from IOMMU, no VM data\n");
         return VERR_INVALID_PARAMETER;
     }
 
     if (!pData->pIommuDomain)
     {
-        printk(KERN_DEBUG "vboxpci: No IOMMU domain (detach)\n");
+        vbpci_printk(KERN_DEBUG, pPciDev,
+                     "cannot detach from IOMMU, no domain\n");
         return VERR_NOT_FOUND;
     }
 
     if (pIns->fIommuUsed)
     {
         iommu_detach_device(pData->pIommuDomain, &pIns->pPciDev->dev);
-        printk(KERN_DEBUG "vboxpci: iommu_detach_device()\n");
+        vbpci_printk(KERN_DEBUG, pPciDev, "detached from IOMMU\n");
         pIns->fIommuUsed = false;
     }
 
@@ -274,7 +292,8 @@ int vboxPciOsDevReset(PVBOXRAWPCIINS pIns)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
         if (pci_reset_function(pIns->pPciDev))
         {
-            printk(KERN_DEBUG "vboxpci: pci_reset_function() failed\n");
+            vbpci_printk(KERN_DEBUG, pIns->pPciDev,
+                         "pci_reset_function() failed\n");
             rc = VERR_INTERNAL_ERROR;
         }
 #else
@@ -351,7 +370,7 @@ int vboxPciOsDevDetachHostDriver(PVBOXRAWPCIINS pIns)
     uint8_t uDevFn = (pIns->HostPciAddress) & 0xff;
     const char* currentDriver;
     uint16_t uVendor, uDevice;
-    int fDetach = 0;
+    bool fDetach = 0;
 
     if (!g_VBoxPciGlobals.fPciStubModuleAvail)
     {
@@ -378,7 +397,7 @@ int vboxPciOsDevDetachHostDriver(PVBOXRAWPCIINS pIns)
            uVendor, uDevice, uBus, uDevFn>>3, uDevFn&7,
            currentDriver ? currentDriver : "<none>");
 
-    fDetach = (currentDriver == NULL  || (strcmp(currentDriver, PCI_STUB_MODULE) != 0)) ? 1 : 0;
+    fDetach = (currentDriver == NULL || (strcmp(currentDriver, PCI_STUB_MODULE) != 0));
 
     /* Init previous driver data. */
     pIns->szPrevDriver[0] = '\0';
@@ -520,7 +539,8 @@ int vboxPciOsDevReattachHostDriver(PVBOXRAWPCIINS pIns)
         uint8_t            uBus =   (pIns->HostPciAddress) >> 8;
         uint8_t            uDevFn = (pIns->HostPciAddress) & 0xff;
 
-        printk(KERN_DEBUG "vboxpci: reattaching old host driver %s\n", pIns->szPrevDriver);
+        vbpci_printk(KERN_DEBUG, pPciDev,
+                     "reattaching old host driver %s\n", pIns->szPrevDriver);
         /*
          * Now perform kernel analog of:
          *
@@ -597,8 +617,6 @@ int  vboxPciOsDevInit(PVBOXRAWPCIINS pIns, uint32_t fFlags)
     struct pci_dev *pPciDev = NULL;
     int rc;
 
-    printk(KERN_DEBUG "vboxpci: vboxPciOsDevInit: dev=%x\n", pIns->HostPciAddress);
-
     if (fFlags & PCIRAWDRIVERRFLAG_DETACH_HOST_DRIVER)
     {
         rc = vboxPciOsDevDetachHostDriver(pIns);
@@ -614,20 +632,17 @@ int  vboxPciOsDevInit(PVBOXRAWPCIINS pIns, uint32_t fFlags)
     pPciDev = PCI_DEV_GET_SLOT((pIns->HostPciAddress) >> 8,
                                (pIns->HostPciAddress) & 0xff);
 
-    printk(KERN_DEBUG "vboxpci: vboxPciOsDevInit: dev=%x pdev=%p\n",
-           pIns->HostPciAddress, pPciDev);
-
     if (!pPciDev)
         return 0;
 
     pIns->pPciDev = pPciDev;
+    vbpci_printk(KERN_DEBUG, pPciDev, "%s\n", __func__);
 
     rc = pci_enable_device(pPciDev);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 1)
     if (pci_enable_msi(pPciDev) == 0)
     {
-        printk(KERN_DEBUG "vboxpci: enabled MSI\n");
         pIns->fMsiUsed = true;
     }
 #endif
@@ -643,14 +658,23 @@ int  vboxPciOsDevInit(PVBOXRAWPCIINS pIns, uint32_t fFlags)
 
 int  vboxPciOsDevDeinit(PVBOXRAWPCIINS pIns, uint32_t fFlags)
 {
-    struct pci_dev *pPciDev = NULL;
-
-    printk(KERN_DEBUG "vboxpci: vboxPciOsDevDeinit: dev=%x\n", pIns->HostPciAddress);
+    struct pci_dev *pPciDev = pIns->pPciDev;
 
-    pPciDev = pIns->pPciDev;
+    vbpci_printk(KERN_DEBUG, pPciDev, "%s\n", __func__);
 
     if (pPciDev)
     {
+        int iRegion;
+        for (iRegion = 0; iRegion < 7; ++iRegion)
+        {
+            if (pIns->aRegionR0Mapping[iRegion])
+            {
+                iounmap(pIns->aRegionR0Mapping[iRegion]);
+                pIns->aRegionR0Mapping[iRegion] = 0;
+                pci_release_region(pPciDev, iRegion);
+            }
+        }
+
         vboxPciOsDevUnregisterWithIommu(pIns);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 1)
@@ -690,9 +714,6 @@ int  vboxPciOsDevGetRegionInfo(PVBOXRAWPCIINS pIns,
         return 0;
     }
 
-    printk(KERN_DEBUG "%x: linux vboxPciOsDevGetRegionInfo: reg=%d\n",
-           pIns->HostPciAddress, iRegion);
-
     flags = pci_resource_flags(pPciDev, iRegion);
     if (((flags & (IORESOURCE_MEM | IORESOURCE_IO)) == 0)
         ||
@@ -723,8 +744,10 @@ int  vboxPciOsDevGetRegionInfo(PVBOXRAWPCIINS pIns,
     *pRegionStart   = pci_resource_start(pPciDev, iRegion);
     *pu64RegionSize = pci_resource_len  (pPciDev, iRegion);
 
-    printk(KERN_DEBUG "got %s region: %llx:%lld\n",
-           (flags & IORESOURCE_MEM) ? "mmio" : "pio", *pRegionStart, *pu64RegionSize);
+    vbpci_printk(KERN_DEBUG, pPciDev,
+                 "region %d: %s %llx+%lld\n",
+                 iRegion, (flags & IORESOURCE_MEM) ? "mmio" : "pio",
+                 *pRegionStart, *pu64RegionSize);
 
     return 0;
 }
@@ -737,41 +760,59 @@ int  vboxPciOsDevMapRegion(PVBOXRAWPCIINS pIns,
                            RTR0PTR        *pRegionBase)
 {
     struct pci_dev  *pPciDev = pIns->pPciDev;
-    struct resource *pRegion;
     RTR0PTR          result = 0;
+    int              error;
 
-    printk(KERN_DEBUG "linux vboxPciOsDevMapRegion: reg=%d start=%llx size=%lld\n", iRegion, RegionStart, u64RegionSize);
+    vbpci_printk(KERN_DEBUG, pPciDev, "reg=%d start=%llx size=%lld\n",
+                 iRegion, RegionStart, u64RegionSize);
 
     if (!pPciDev)
-        return 0;
+        return VERR_INVALID_PARAMETER;
 
     if (iRegion < 0 || iRegion > 6)
     {
-        printk(KERN_DEBUG "vboxPciOsDevMapRegion: invalid region: %d\n", iRegion);
+        vbpci_printk(KERN_DEBUG, pPciDev, "invalid region %d\n", iRegion);
         return VERR_INVALID_PARAMETER;
     }
 
-    pRegion = request_mem_region(RegionStart, u64RegionSize, "vboxpci");
-    if (!pRegion)
+    if (pci_resource_flags(pPciDev, iRegion) & IORESOURCE_IO)
+        return VERR_INVALID_PARAMETER;
+
+    if (RegionStart != pci_resource_start(pPciDev, iRegion))
+        return VERR_INVALID_PARAMETER;
+
+    if (u64RegionSize != pci_resource_len(pPciDev, iRegion))
+        return VERR_INVALID_PARAMETER;
+
+    /*
+     * XXX: Current code never calls unmap.  To avoid leaking mappings
+     * only request and map resources once.
+     */
+    if (pIns->aRegionR0Mapping[iRegion])
     {
-        /** @todo: need to make sure if thise error indeed can be ignored. */
-        printk(KERN_DEBUG "request_mem_region() failed, don't care\n");
+        *pRegionBase = pIns->aRegionR0Mapping[iRegion];
+        return VINF_SUCCESS;
     }
 
+
+    error = pci_request_region(pPciDev, iRegion, "vboxpci");
+    if (error)
+        return VERR_RESOURCE_BUSY;
+
     /* For now no caching, try to optimize later. */
-    result = ioremap_nocache(RegionStart, u64RegionSize);
+    result = ioremap_nocache(pci_resource_start(pPciDev, iRegion),
+                             pci_resource_len(pPciDev, iRegion));
 
     if (!result)
     {
-        printk(KERN_DEBUG "cannot ioremap_nocache\n");
-        if (pRegion)
-            release_mem_region(RegionStart, u64RegionSize);
-        return 0;
+        vbpci_printk(KERN_DEBUG, pPciDev, "ioremap_nocache() failed\n");
+        pci_release_region(pPciDev, iRegion);
+        return VERR_MAP_FAILED;
     }
 
-    *pRegionBase = result;
+    *pRegionBase = pIns->aRegionR0Mapping[iRegion] = result;
 
-    return 0;
+    return VINF_SUCCESS;
 }
 
 int  vboxPciOsDevUnmapRegion(PVBOXRAWPCIINS pIns,
@@ -780,11 +821,8 @@ int  vboxPciOsDevUnmapRegion(PVBOXRAWPCIINS pIns,
                              uint64_t       u64RegionSize,
                              RTR0PTR        RegionBase)
 {
-
-    iounmap(RegionBase);
-    release_mem_region(RegionStart, u64RegionSize);
-
-    return VINF_SUCCESS;
+    /* XXX: Current code never calls unmap. */
+    return VERR_NOT_IMPLEMENTED;
 }
 
 int  vboxPciOsDevPciCfgWrite(PVBOXRAWPCIINS pIns, uint32_t Register, PCIRAWMEMLOC *pValue)
@@ -868,7 +906,7 @@ int vboxPciOsDevRegisterIrqHandler(PVBOXRAWPCIINS pIns, PFNRAWPCIISR pfnHandler,
 
     if (iIrq == 0)
     {
-        printk(KERN_DEBUG "device not assigned host interrupt\n");
+        vbpci_printk(KERN_NOTICE, pIns->pPciDev, "no irq assigned\n");
         return VERR_INVALID_PARAMETER;
     }
 
@@ -896,18 +934,19 @@ int vboxPciOsDevRegisterIrqHandler(PVBOXRAWPCIINS pIns, PFNRAWPCIISR pfnHandler,
                      pIns);
     if (rc)
     {
-        printk(KERN_DEBUG "could not request IRQ %d: err=%d\n", iIrq, rc);
+        vbpci_printk(KERN_DEBUG, pIns->pPciDev,
+                     "could not request irq %d, error %d\n", iIrq, rc);
         return VERR_RESOURCE_BUSY;
     }
 
-    printk(KERN_DEBUG "got PCI IRQ: %d\n", iIrq);
+    vbpci_printk(KERN_DEBUG, pIns->pPciDev, "got irq %d\n", iIrq);
     *piHostIrq = iIrq;
     return VINF_SUCCESS;
 }
 
 int vboxPciOsDevUnregisterIrqHandler(PVBOXRAWPCIINS pIns, int32_t iHostIrq)
 {
-    printk(KERN_DEBUG "free PCI IRQ: %d\n", iHostIrq);
+    vbpci_printk(KERN_DEBUG, pIns->pPciDev, "freeing irq %d\n", iHostIrq);
     free_irq(iHostIrq, pIns);
     return VINF_SUCCESS;
 }
@@ -916,29 +955,36 @@ int  vboxPciOsDevPowerStateChange(PVBOXRAWPCIINS pIns, PCIRAWPOWERSTATE  aState)
 {
     int rc;
 
-    printk(KERN_DEBUG "power state: %d\n", (int)aState);
-
     switch (aState)
     {
         case PCIRAW_POWER_ON:
+            vbpci_printk(KERN_DEBUG, pIns->pPciDev, "PCIRAW_POWER_ON\n");
             /* Reset device, just in case. */
             vboxPciOsDevReset(pIns);
             /* register us with IOMMU */
             rc = vboxPciOsDevRegisterWithIommu(pIns);
             break;
         case PCIRAW_POWER_RESET:
+            vbpci_printk(KERN_DEBUG, pIns->pPciDev, "PCIRAW_POWER_RESET\n");
             rc = vboxPciOsDevReset(pIns);
             break;
         case PCIRAW_POWER_OFF:
+            vbpci_printk(KERN_DEBUG, pIns->pPciDev, "PCIRAW_POWER_OFF\n");
             /* unregister us from IOMMU */
             rc = vboxPciOsDevUnregisterWithIommu(pIns);
             break;
         case PCIRAW_POWER_SUSPEND:
+            vbpci_printk(KERN_DEBUG, pIns->pPciDev, "PCIRAW_POWER_SUSPEND\n");
+            rc = VINF_SUCCESS;
+            /// @todo: what do we do here?
+            break;
         case PCIRAW_POWER_RESUME:
+            vbpci_printk(KERN_DEBUG, pIns->pPciDev, "PCIRAW_POWER_RESUME\n");
             rc = VINF_SUCCESS;
             /// @todo: what do we do here?
             break;
         default:
+            vbpci_printk(KERN_DEBUG, pIns->pPciDev, "unknown power state %u\n", aState);
             /* to make compiler happy */
             rc = VERR_NOT_SUPPORTED;
             break;
@@ -998,22 +1044,20 @@ static int vboxPciOsContigMemInfo(PRAWPCIPERVM pVmCtx, RTHCPHYS HostStart, RTGCP
 
 int  vboxPciOsInitVm(PVBOXRAWPCIDRVVM pThis, PVM pVM, PRAWPCIPERVM pVmData)
 {
-#ifdef DEBUG
-    printk(KERN_DEBUG "vboxPciOsInitVm: %p\n", pThis);
-#endif
 #ifdef VBOX_WITH_IOMMU
     if (IOMMU_PRESENT())
     {
         pThis->pIommuDomain = IOMMU_DOMAIN_ALLOC();
         if (!pThis->pIommuDomain)
         {
-            printk(KERN_DEBUG "cannot allocate IOMMU domain\n");
+            vbpci_printk(KERN_DEBUG, NULL, "cannot allocate IOMMU domain\n");
             return VERR_NO_MEMORY;
         }
 
         pVmData->pfnContigMemInfo = vboxPciOsContigMemInfo;
 
-        printk(KERN_DEBUG "created IOMMU domain %p\n", pThis->pIommuDomain);
+        vbpci_printk(KERN_DEBUG, NULL, "created IOMMU domain %p\n",
+                     pThis->pIommuDomain);
     }
 #endif
     return VINF_SUCCESS;
@@ -1021,12 +1065,11 @@ int  vboxPciOsInitVm(PVBOXRAWPCIDRVVM pThis, PVM pVM, PRAWPCIPERVM pVmData)
 
 void vboxPciOsDeinitVm(PVBOXRAWPCIDRVVM pThis, PVM pVM)
 {
-#ifdef DEBUG
-    printk(KERN_DEBUG "vboxPciOsDeinitVm: %p\n", pThis);
-#endif
 #ifdef VBOX_WITH_IOMMU
     if (pThis->pIommuDomain)
     {
+        vbpci_printk(KERN_DEBUG, NULL, "freeing IOMMU domain %p\n",
+                     pThis->pIommuDomain);
         iommu_domain_free(pThis->pIommuDomain);
         pThis->pIommuDomain = NULL;
     }
diff --git a/src/VBox/HostDrivers/VBoxUSB/darwin/Makefile.kmk b/src/VBox/HostDrivers/VBoxUSB/darwin/Makefile.kmk
index fd4c79b..c0f0cd3 100644
--- a/src/VBox/HostDrivers/VBoxUSB/darwin/Makefile.kmk
+++ b/src/VBox/HostDrivers/VBoxUSB/darwin/Makefile.kmk
@@ -38,10 +38,11 @@ VBoxUSB_SOURCES      := \
 
 INSTALLS += VBoxUSB.kext
 VBoxUSB.kext_INST     = $(INST_VBOXUSB)Contents/
-VBoxUSB.kext_SOURCES  =	$(VBoxUSB.kext_0_OUTDIR)/Info.plist
-VBoxUSB.kext_CLEAN    = $(VBoxUSB.kext_0_OUTDIR)/Info.plist
+VBoxUSB.kext_SOURCES  = $(VBoxUSB.kext_0_OUTDIR)/Contents/Info.plist
+VBoxUSB.kext_CLEAN    = $(VBoxUSB.kext_0_OUTDIR)/Contents/Info.plist
+VBoxUSB.kext_BLDDIRS  = $(VBoxUSB.kext_0_OUTDIR)/Contents/
 
-$$(VBoxUSB.kext_0_OUTDIR)/Info.plist: $(PATH_SUB_CURRENT)/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
+$$(VBoxUSB.kext_0_OUTDIR)/Contents/Info.plist: $(PATH_SUB_CURRENT)/Info.plist $(VBOX_VERSION_MK) | $$(dir $$@)
 	$(call MSG_GENERATE,VBoxUSB,$@,$<)
 	$(QUIET)$(RM) -f $@
 	$(QUIET)$(SED) \
@@ -55,6 +56,8 @@ $$(VBoxUSB.kext_0_OUTDIR)/Info.plist: $(PATH_SUB_CURRENT)/Info.plist $(VBOX_VERS
 		--output $@ \
 		$<
 
+$(evalcall2 VBOX_TEST_SIGN_KEXT,VBoxUSB)
+
 # Common manual loader script.
 INSTALLS += ScriptsUSB
 ScriptsUSB_INST     = $(INST_DIST)
diff --git a/src/VBox/HostDrivers/VBoxUSB/darwin/USBLib-darwin.cpp b/src/VBox/HostDrivers/VBoxUSB/darwin/USBLib-darwin.cpp
index 04324b9..41c0d62 100644
--- a/src/VBox/HostDrivers/VBoxUSB/darwin/USBLib-darwin.cpp
+++ b/src/VBox/HostDrivers/VBoxUSB/darwin/USBLib-darwin.cpp
@@ -101,7 +101,7 @@ USBLIB_DECL(int) USBLibInit(void)
      * Open the service.
      * This will cause the user client class in VBoxUSB.cpp to be instantiated.
      */
-    kr = IOServiceOpen(ServiceObject, mach_task_self(), 0, &g_Connection);
+    kr = IOServiceOpen(ServiceObject, mach_task_self(), VBOXUSB_DARWIN_IOSERVICE_COOKIE, &g_Connection);
     IOObjectRelease(ServiceObject);
     if (kr != kIOReturnSuccess)
     {
diff --git a/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp b/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp
index 9dbacb0..ddf46a8 100644
--- a/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp
+++ b/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSB.cpp
@@ -566,6 +566,12 @@ org_virtualbox_VBoxUSBClient::initWithTask(task_t OwningTask, void *pvSecurityId
         Log(("VBoxUSBClient::initWithTask([%p], %p, %p, %#x) -> false (no task)\n", this, OwningTask, pvSecurityId, u32Type));
         return false;
     }
+    if (u32Type != VBOXUSB_DARWIN_IOSERVICE_COOKIE)
+    {
+        Log(("VBoxUSBClient::initWithTask: Bade cookie %#x\n", u32Type));
+        return false;
+    }
+
     proc_t pProc = (proc_t)get_bsdtask_info(OwningTask); /* we need the pid */
     Log(("VBoxUSBClient::initWithTask([%p], %p(->%p:{.pid=%d}, %p, %#x)\n",
              this, OwningTask, pProc, pProc ? proc_pid(pProc) : -1, pvSecurityId, u32Type));
diff --git a/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSBInterface.h b/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSBInterface.h
index eeeb6fd..4659d0b 100644
--- a/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSBInterface.h
+++ b/src/VBox/HostDrivers/VBoxUSB/darwin/VBoxUSBInterface.h
@@ -46,6 +46,8 @@ typedef struct VBOXUSBADDFILTEROUT
 /** Pointer to a VBOXUSBADDFILTEROUT. */
 typedef VBOXUSBADDFILTEROUT *PVBOXUSBADDFILTEROUT;
 
+/** Cookie used to fend off some unwanted clients to the IOService.  */
+#define VBOXUSB_DARWIN_IOSERVICE_COOKIE     UINT32_C(0x62735556) /* 'VUsb' */
 
 #endif
 
diff --git a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c
index d417d28..f1be6b5 100644
--- a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c
+++ b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2013 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -324,6 +324,7 @@ LOCAL void vboxUSBSolarisIsocOutXferCompleted(usb_pipe_handle_t pPipe, usb_isoc_
 LOCAL vboxusb_urb_t *vboxUSBSolarisGetIsocInURB(vboxusb_state_t *pState, PVBOXUSBREQ_URB pUrbReq);
 LOCAL vboxusb_urb_t *vboxUSBSolarisQueueURB(vboxusb_state_t *pState, PVBOXUSBREQ_URB pUrbReq, mblk_t *pMsg);
 LOCAL inline void vboxUSBSolarisConcatMsg(vboxusb_urb_t *pUrb);
+LOCAL inline VUSBSTATUS vboxUSBSolarisGetUrbStatus(usb_cr_t Status);
 LOCAL inline void vboxUSBSolarisDeQueueURB(vboxusb_urb_t *pUrb, int URBStatus);
 LOCAL inline void vboxUSBSolarisNotifyComplete(vboxusb_state_t *pState);
 LOCAL int vboxUSBSolarisProcessIOCtl(int iFunction, void *pvState, int Mode, PVBOXUSBREQ pUSBReq, void *pvBuf,
@@ -1171,7 +1172,7 @@ int VBoxUSBSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArg, int Mode, cred_t *pCr
     /*
      * Process the IOCtl.
      */
-    size_t cbDataOut;
+    size_t cbDataOut = 0;
     rc = vboxUSBSolarisProcessIOCtl(Cmd, pState, Mode, &ReqWrap, pvBuf, &cbDataOut);
     ReqWrap.rc = rc;
     rc = 0;
@@ -1480,7 +1481,7 @@ LOCAL void vboxUSBSolarisDestroyPower(vboxusb_state_t *pState)
  *
  * @returns VBox USB URB status.
  */
-static inline VUSBSTATUS vboxUSBSolarisGetUrbStatus(usb_cr_t Status)
+LOCAL inline VUSBSTATUS vboxUSBSolarisGetUrbStatus(usb_cr_t Status)
 {
     switch (Status)
     {
diff --git a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c
index c060597..6c7e908 100644
--- a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c
+++ b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c
@@ -122,7 +122,8 @@ static struct dev_ops g_VBoxUSBMonSolarisDevOps =
     nodev,                      /* reset */
     &g_VBoxUSBMonSolarisCbOps,
     (struct bus_ops *)0,
-    nodev                       /* power */
+    nodev,                      /* power */
+    ddi_quiesce_not_needed
 };
 
 /**
diff --git a/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.h b/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.h
index 6d6dea9..764b01f 100644
--- a/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.h
+++ b/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.h
@@ -46,7 +46,7 @@ AssertCompile(sizeof (ENMVBOXUSB_PNPSTATE) == sizeof (uint32_t));
 DECLHIDDEN(VOID) vboxUsbPnPStateGbgChange(ENMVBOXUSB_PNPSTATE enmOld, ENMVBOXUSB_PNPSTATE enmNew);
 # define VBOXUSB_PNP_GBG_STATE_CHANGE(_old, _new) vboxUsbPnPStateGbgChange((_old), (_new))
 #else
-# define VBOXUSB_PNP_GBG_STATE_CHANGE(_old, _new) do {} while(0)
+# define VBOXUSB_PNP_GBG_STATE_CHANGE(_old, _new) do { } while (0)
 #endif
 
 
diff --git a/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.rc b/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.rc
index b2a995d..7073735 100644
--- a/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.rc
+++ b/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbDev.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DRV
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DRV
   FILESUBTYPE      VFT2_DRV_SYSTEM
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox USB Driver\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxUSB\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxUSB.sys\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbRt.cpp b/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbRt.cpp
index 09ed4c4..75fd6ce 100644
--- a/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbRt.cpp
+++ b/src/VBox/HostDrivers/VBoxUSB/win/dev/VBoxUsbRt.cpp
@@ -1133,6 +1133,7 @@ static NTSTATUS vboxUsbRtUrbSendCompletion(PDEVICE_OBJECT pDevObj, IRP *pIrp, vo
                 Status = STATUS_SUCCESS;
                 break;
             case USBD_STATUS_DEV_NOT_RESPONDING:
+            case USBD_STATUS_DEVICE_GONE:
                 pUrbInfo->error = USBSUP_XFER_DNR;
                 Status = STATUS_SUCCESS;
                 break;
diff --git a/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp b/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp
index 026f851..8a70331 100644
--- a/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp
+++ b/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -581,63 +581,55 @@ static void usbLibDevCfgDrFree(PUSB_CONFIGURATION_DESCRIPTOR pDr)
 
 static int usbLibDevStrDrEntryGet(HANDLE hHub, ULONG iPort, ULONG iDr, USHORT idLang, PVBOXUSB_STRING_DR_ENTRY *ppList)
 {
-    char Buf[sizeof (USB_DESCRIPTOR_REQUEST) + MAXIMUM_USB_STRING_LENGTH];
-    PUSB_DESCRIPTOR_REQUEST pRq = (PUSB_DESCRIPTOR_REQUEST)Buf;
-    PUSB_STRING_DESCRIPTOR pDr = (PUSB_STRING_DESCRIPTOR)(Buf + sizeof (*pRq));
-    memset (&Buf, 0, sizeof (Buf));
+    char szBuf[sizeof (USB_DESCRIPTOR_REQUEST) + MAXIMUM_USB_STRING_LENGTH];
+    RT_ZERO(szBuf);
+
+    PUSB_DESCRIPTOR_REQUEST pRq = (PUSB_DESCRIPTOR_REQUEST)szBuf;
+    PUSB_STRING_DESCRIPTOR pDr = (PUSB_STRING_DESCRIPTOR)(szBuf + sizeof (*pRq));
+    RT_BZERO(pDr, sizeof(USB_STRING_DESCRIPTOR));
+
     pRq->ConnectionIndex = iPort;
     pRq->SetupPacket.wValue = (USB_STRING_DESCRIPTOR_TYPE << 8) | iDr;
     pRq->SetupPacket.wIndex = idLang;
-    pRq->SetupPacket.wLength = sizeof (Buf) - sizeof (*pRq);
-    DWORD cbReturned = 0;
-    if (!DeviceIoControl(hHub, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, pRq, sizeof (Buf),
-                                    pRq, sizeof (Buf),
-                                    &cbReturned, NULL))
-    {
-        DWORD winEr = GetLastError();
-        LogRel((__FUNCTION__": DeviceIoControl 1 fail winEr (%d)\n", winEr));
-#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
-            AssertFailed();
-#endif
-        return VERR_GENERAL_FAILURE;
-    }
-
-    if (cbReturned < sizeof (*pDr) + 2)
-    {
-        AssertFailed();
-        return VERR_GENERAL_FAILURE;
-    }
-
-    if (!!(pDr->bLength % 2))
-    {
-        AssertFailed();
-        return VERR_GENERAL_FAILURE;
-    }
+    pRq->SetupPacket.wLength = sizeof (szBuf) - sizeof (*pRq);
 
-    if (pDr->bLength != cbReturned - sizeof (*pRq))
+    DWORD cbReturned = 0;
+    if (!DeviceIoControl(hHub, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, pRq, sizeof (szBuf),
+                         pRq, sizeof(szBuf),
+                         &cbReturned, NULL))
     {
-        AssertFailed();
-        return VERR_GENERAL_FAILURE;
+        DWORD dwErr = GetLastError();
+        AssertMsgFailed(("Getting USB descriptor failed with error %ld\n", dwErr));
+        return RTErrConvertFromWin32(dwErr);
     }
 
+    /* Wrong descriptor type at the requested port index? Bail out. */
     if (pDr->bDescriptorType != USB_STRING_DESCRIPTOR_TYPE)
+        return VERR_NOT_FOUND;
+
+    /* Some more sanity checks. */
+    if (   (cbReturned < sizeof (*pDr) + 2)
+        || (!!(pDr->bLength % 2))
+        || (pDr->bLength != cbReturned - sizeof(*pRq)))
     {
-        AssertFailed();
-        return VERR_GENERAL_FAILURE;
+        AssertMsgFailed(("Sanity check failed for string descriptor: cbReturned=%RI32, cbDevReq=%zu, type=%RU8, len=%RU8, port=%RU32, index=%RU32, lang=%RU32\n",
+                         cbReturned, sizeof(*pRq), pDr->bDescriptorType, pDr->bLength, iPort, iDr, idLang));
+        return VERR_INVALID_PARAMETER;
     }
 
-    PVBOXUSB_STRING_DR_ENTRY pEntry = (PVBOXUSB_STRING_DR_ENTRY)RTMemAllocZ(sizeof (*pEntry) + pDr->bLength + 2);
-    Assert(pEntry);
+    PVBOXUSB_STRING_DR_ENTRY pEntry =
+        (PVBOXUSB_STRING_DR_ENTRY)RTMemAllocZ(sizeof(VBOXUSB_STRING_DR_ENTRY) + pDr->bLength + 2);
+    AssertPtr(pEntry);
     if (!pEntry)
-    {
-        return VERR_OUT_OF_RESOURCES;
-    }
+        return VERR_NO_MEMORY;
 
     pEntry->pNext = *ppList;
     pEntry->iDr = iDr;
     pEntry->idLang = idLang;
     memcpy(&pEntry->StrDr, pDr, pDr->bLength);
+
     *ppList = pEntry;
+
     return VINF_SUCCESS;
 }
 
@@ -667,10 +659,8 @@ static int usbLibDevStrDrEntryGetForLangs(HANDLE hHub, ULONG iPort, ULONG iDr, U
 
 static int usbLibDevStrDrEntryGetAll(HANDLE hHub, ULONG iPort, PUSB_DEVICE_DESCRIPTOR pDevDr, PUSB_CONFIGURATION_DESCRIPTOR pCfgDr, PVBOXUSB_STRING_DR_ENTRY *ppList)
 {
+    /* Read string descriptor zero to determine what languages are available. */
     int rc = usbLibDevStrDrEntryGet(hHub, iPort, 0, 0, ppList);
-#ifdef VBOX_WITH_ANNOYING_USB_ASSERTIONS
-    AssertRC(rc);
-#endif
     if (RT_FAILURE(rc))
         return rc;
 
@@ -994,8 +984,13 @@ static int usbLibMonDevicesUpdate(PVBOXUSBGLOBALSTATE pGlobal, PUSBDEVICE pDevs,
                     || MonInfo.enmState == USBDEVICESTATE_HELD_BY_PROXY
                     || MonInfo.enmState == USBDEVICESTATE_USED_BY_GUEST);
             pDevs->enmState = MonInfo.enmState;
-            /* The following is not 100% accurate but we only care about high-speed vs. non-high-speed */
-            pDevs->enmSpeed = Dev.fHiSpeed ? USBDEVICESPEED_HIGH : USBDEVICESPEED_FULL;
+            if (pDevs->bcdUSB == 0x300)
+                /* USB3 spec guarantees this (9.6.1). */
+                pDevs->enmSpeed = USBDEVICESPEED_SUPER;
+            else
+                /* The following is not 100% accurate but we only care about high-speed vs. non-high-speed */
+                pDevs->enmSpeed = Dev.fHiSpeed ? USBDEVICESPEED_HIGH : USBDEVICESPEED_FULL;
+
             if (pDevs->enmState != USBDEVICESTATE_USED_BY_HOST)
             {
                 /* only set the interface name if device can be grabbed */
diff --git a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUSBMon.inf b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUSBMon.inf
index e4650df..7e8ec8f 100644
--- a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUSBMon.inf
+++ b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUSBMon.inf
@@ -34,7 +34,7 @@ CopyFiles = VBoxUSBMonitor.CopyFiles
 VBoxUSBMon.sys
 
 [DefaultInstall.NT.Services]
-AddService = VBoxUSBMon, 0x00000002, VBoxUSBMon_Service_Inst
+AddService = VBoxUSBMon, 0x00000002, VBoxUSBMon_Service_Inst, VBoxUSBMon_EventLog_Inst
 
 [VBoxUSBMon_Service_Inst]
 DisplayName    = %VBoxUSBMon.SvcDesc%
@@ -44,6 +44,13 @@ StartType      = 1                  ; autostart to fix Vista problem
 ErrorControl   = 1                  ; SERVICE_ERROR_NORMAL
 ServiceBinary  = %12%\VBoxUSBMon.sys
 
+[VBoxUSBMon_EventLog_Inst]
+AddReg         = VBoxUSBMon_EventLog_AddReg
+
+[VBoxUSBMon_EventLog_AddReg]
+HKR,,EventMessageFile,0x00020000,"%%SystemRoot%%\System32\IoLogMsg.dll"
+HKR,,TypesSupported,0x00010001,7
+
 [SourceDisksNames]
 1 = %VBoxUSBMon.MediaDesc%
 
diff --git a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp
index bf98d42..f371544 100644
--- a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp
+++ b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp
@@ -1145,6 +1145,48 @@ typedef struct VBOXUSBMONHOOKDRIVERWALKER
     PDRIVER_OBJECT pDrvObj;
 } VBOXUSBMONHOOKDRIVERWALKER, *PVBOXUSBMONHOOKDRIVERWALKER;
 
+/**
+ * Logs an error to the system event log.
+ *
+ * @param   ErrCode        Error to report to event log.
+ * @param   ReturnedStatus Error that was reported by the driver to the caller.
+ * @param   uErrId         Unique error id representing the location in the driver.
+ * @param   cbDumpData     Number of bytes at pDumpData.
+ * @param   pDumpData      Pointer to data that will be added to the message (see 'details' tab).
+ */
+static void vboxUsbMonLogError(NTSTATUS ErrCode, NTSTATUS ReturnedStatus, ULONG uErrId, USHORT cbDumpData, PVOID pDumpData)
+{
+    PIO_ERROR_LOG_PACKET pErrEntry;
+    
+
+    /* Truncate dumps that do not fit into IO_ERROR_LOG_PACKET. */
+    if (FIELD_OFFSET(IO_ERROR_LOG_PACKET, DumpData) + cbDumpData > ERROR_LOG_MAXIMUM_SIZE)
+        cbDumpData = ERROR_LOG_MAXIMUM_SIZE - FIELD_OFFSET(IO_ERROR_LOG_PACKET, DumpData);
+
+    pErrEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry(g_VBoxUsbMonGlobals.pDevObj,
+                                                              FIELD_OFFSET(IO_ERROR_LOG_PACKET, DumpData) + cbDumpData);
+    if (pErrEntry)
+    {
+        uint8_t *pDump = (uint8_t *)pErrEntry->DumpData;
+        if (cbDumpData)
+            memcpy(pDump, pDumpData, cbDumpData);
+        pErrEntry->MajorFunctionCode = 0;
+        pErrEntry->RetryCount = 0;
+        pErrEntry->DumpDataSize = cbDumpData;
+        pErrEntry->NumberOfStrings = 0;
+        pErrEntry->StringOffset = 0;
+        pErrEntry->ErrorCode = ErrCode;
+        pErrEntry->UniqueErrorValue = uErrId;
+        pErrEntry->FinalStatus = ReturnedStatus;
+        pErrEntry->IoControlCode = 0;
+        IoWriteErrorLogEntry(pErrEntry);
+    }
+    else
+    {
+        LOG(("Failed to allocate error log entry (cb=%d)\n", FIELD_OFFSET(IO_ERROR_LOG_PACKET, DumpData) + cbDumpData));
+    }
+}
+
 static DECLCALLBACK(BOOLEAN) vboxUsbMonHookDrvObjWalker(PFILE_OBJECT pFile, PDEVICE_OBJECT pTopDo, PDEVICE_OBJECT pHubDo, PVOID pvContext)
 {
     PDRIVER_OBJECT pDrvObj = pHubDo->DriverObject;
@@ -1182,6 +1224,16 @@ static DECLCALLBACK(BOOLEAN) vboxUsbMonHookDrvObjWalker(PFILE_OBJECT pFile, PDEV
     }
     /* No empty slots! No reason to continue. */
     LOG(("No empty slots!\n"));
+    ANSI_STRING ansiDrvName;
+    NTSTATUS Status = RtlUnicodeStringToAnsiString(&ansiDrvName, &pDrvObj->DriverName, true);
+    if (Status != STATUS_SUCCESS)
+    {
+        ansiDrvName.Length = 0;
+        LOG(("RtlUnicodeStringToAnsiString failed with 0x%x", Status));
+    }
+    vboxUsbMonLogError(IO_ERR_INSUFFICIENT_RESOURCES, STATUS_SUCCESS, 1, ansiDrvName.Length, ansiDrvName.Buffer);
+    if (Status == STATUS_SUCCESS)
+        RtlFreeAnsiString(&ansiDrvName);
     return FALSE;
 }
 
diff --git a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.rc b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.rc
index af4365f..1e41b64 100644
--- a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.rc
+++ b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DRV
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DRV
   FILESUBTYPE      VFT2_DRV_SYSTEM
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox USB Monitor Driver\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxUSBMon\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxUSBMon.sys\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp b/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp
index cf0a2df..3cf017e 100644
--- a/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp
+++ b/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp
@@ -188,7 +188,7 @@ int usbMonRemoveFilter (void *aID)
 
     Assert(g_hUSBMonitor);
 
-    printf("usblibRemoveFilter %x\n", aID);
+    printf("usblibRemoveFilter %p\n", aID);
 
     uId = (uintptr_t)aID;
     if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_REMOVE_FILTER, &uId, sizeof(uId),  NULL, 0,&cbReturned, NULL))
diff --git a/src/VBox/HostDrivers/linux/load.sh b/src/VBox/HostDrivers/linux/load.sh
index 99e8641..726059b 100755
--- a/src/VBox/HostDrivers/linux/load.sh
+++ b/src/VBox/HostDrivers/linux/load.sh
@@ -23,7 +23,7 @@ if [ ! -d "${MY_DIR}" ]; then
 fi
 
 set -e
-kmk -C "${MY_DIR}/src/vboxdrv" "$@"
+make -C "${MY_DIR}/src/vboxdrv" "$@"
 sudo make -C "${MY_DIR}/src/" unload
 echo "Installing SUPDrv (aka VBoxDrv/vboxdrv)"
 sudo /sbin/insmod "${MY_DIR}/src/vboxdrv/vboxdrv.ko"
diff --git a/src/VBox/HostDrivers/win/VBoxDbgLog.h b/src/VBox/HostDrivers/win/VBoxDbgLog.h
index 9fe6651..1702ae5 100644
--- a/src/VBox/HostDrivers/win/VBoxDbgLog.h
+++ b/src/VBox/HostDrivers/win/VBoxDbgLog.h
@@ -40,7 +40,7 @@
 #ifdef DEBUG_misha
 # define BP_WARN() AssertFailed()
 #else
-# define BP_WARN() do {} while(0)
+# define BP_WARN() do { } while (0)
 #endif
 
 #define _LOGMSG_EXACT(_logger, _a)                                          \
diff --git a/src/VBox/HostDrivers/win/cfg/VBoxDrvCfg.cpp b/src/VBox/HostDrivers/win/cfg/VBoxDrvCfg.cpp
index 4d66a26..7e168a6 100644
--- a/src/VBox/HostDrivers/win/cfg/VBoxDrvCfg.cpp
+++ b/src/VBox/HostDrivers/win/cfg/VBoxDrvCfg.cpp
@@ -348,6 +348,8 @@ static HRESULT vboxDrvCfgInfQueryModelsSectionName(HINF hInf, LPWSTR *lppszValue
 
 static HRESULT vboxDrvCfgInfQueryFirstPnPId(HINF hInf, LPWSTR *lppszPnPId)
 {
+    *lppszPnPId = NULL;
+
     LPWSTR lpszModels;
     LPWSTR lpszPnPId;
     HRESULT hr = vboxDrvCfgInfQueryModelsSectionName(hInf, &lpszModels, NULL);
@@ -368,17 +370,14 @@ static HRESULT vboxDrvCfgInfQueryFirstPnPId(HINF hInf, LPWSTR *lppszPnPId)
     {
         hr = vboxDrvCfgInfQueryKeyValue(&InfCtx, 2, &lpszPnPId, NULL);
         NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for models (%S) returned lpszPnPId (%S) \n", lpszModels, lpszPnPId));
+
         if (hr != S_OK)
-        {
             NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for models (%S) failed, hr=0x%x\n", lpszModels, hr));
-        }
     }
     /* free models string right away */
     free(lpszModels);
     if (hr != S_OK)
-    {
         return hr;
-    }
 
     *lppszPnPId = lpszPnPId;
     return S_OK;
@@ -393,45 +392,22 @@ static HRESULT vboxDrvCfgInfCopyEx(IN LPCWSTR lpszInfPath, IN DWORD fCopyStyle,
     WCHAR aMediaLocation[_MAX_DIR];
     WCHAR aDir[_MAX_DIR];
 
-    NonStandardLogRelCrap((__FUNCTION__ ":enter"));
-    NonStandardLogRelCrap((__FUNCTION__ ": lpszInfPath=%S \n", lpszInfPath));
-
-
-    NonStandardLogRelCrap((__FUNCTION__ ": call _wsplitpath(%S, aMediaLocation, aDir, NULL, NULL)\n", lpszInfPath));
     _wsplitpath(lpszInfPath, aMediaLocation, aDir, NULL, NULL);
-    NonStandardLogRelCrap((__FUNCTION__ ": after _wsplitpath(...) aMediaLocation=%S and aDir=%S\n", aMediaLocation, aDir));
-
-    NonStandardLogRelCrap((__FUNCTION__ ": call wcscat(%S, %S)", aMediaLocation, aDir));
     wcscat(aMediaLocation, aDir);
 
-    NonStandardLogRelCrap((__FUNCTION__ ": before call SetupCopyOEMInfW(lpszInfPath, aMediaLocation, SPOST_PATH, fCopyStyle,\
- lpszDstName, cbDstName, pcbDstNameSize, lpszDstNameComponent)\n"));
-    bool b = SetupCopyOEMInfW(lpszInfPath, aMediaLocation, SPOST_PATH, fCopyStyle,
-                              lpszDstName, cbDstName, pcbDstNameSize,
-                              lpszDstNameComponent);
-    NonStandardLogRelCrap((__FUNCTION__ ": after call SetupCopyOEMInfW(lpszInfPath, aMediaLocation, SPOST_PATH, fCopyStyle,\
- lpszDstName, cbDstName, pcbDstNameSize, lpszDstNameComponent)\n"));
-    NonStandardLogRelCrap((__FUNCTION__ ": lpszInfPath=%S \
-            fCopyStyle=%ld \
-            lpszDstName=%S \
-            cbDstName=%ld \
-            pcbDstNameSize=%ld \
-            \n", lpszInfPath,fCopyStyle,lpszDstName,cbDstName,pcbDstNameSize));
-
-    if (!b)
+    if (!SetupCopyOEMInfW(lpszInfPath, aMediaLocation, SPOST_PATH, fCopyStyle,
+            lpszDstName, cbDstName, pcbDstNameSize,
+            lpszDstNameComponent))
     {
         DWORD dwErr = GetLastError();
         HRESULT hr = HRESULT_FROM_WIN32(dwErr);
-        NonStandardLogRelCrap((__FUNCTION__ ": SetupCopyOEMInf fail dwErr=%ld\n", dwErr));
         if (fCopyStyle != SP_COPY_REPLACEONLY || hr != VBOXDRVCFG_S_INFEXISTS)
         {
-            NonStandardLogRelCrap((__FUNCTION__ ": SetupCopyOEMInf fail (with \"fCopyStyle != SP_COPY_REPLACEONLY || hr != VBOXDRVCFG_S_INFEXISTS)\" dwErr=%ld\n", dwErr));
+            NonStandardLogRelCrap((__FUNCTION__ ": SetupCopyOEMInf fail dwErr=%ld\n", dwErr));
         }
-        NonStandardLogRelCrap((__FUNCTION__ ":return error dwErr=%ld\n", dwErr));
         return hr;
     }
 
-    NonStandardLogRelCrap((__FUNCTION__ ":return S_OK\n"));
     return S_OK;
 }
 
@@ -662,7 +638,6 @@ static bool vboxDrvCfgInfEnumerationCallback(LPCWSTR lpszFileName, PVOID pCtxt)
     DWORD dwErr;
     NonStandardLogRelCrap((__FUNCTION__": lpszFileName (%S)\n", lpszFileName));
     NonStandardLogRelCrap((__FUNCTION__ ": pContext->InfInfo.lpszClassName = (%S)", pContext->InfInfo.lpszClassName));
-
     HINF hInf = SetupOpenInfFileW(lpszFileName, pContext->InfInfo.lpszClassName, INF_STYLE_WIN4, NULL /*__in PUINT ErrorLine */);
     if (hInf == INVALID_HANDLE_VALUE)
     {
diff --git a/src/VBox/HostDrivers/win/load.sh b/src/VBox/HostDrivers/win/load.sh
index 54fccf8..0381067 100755
--- a/src/VBox/HostDrivers/win/load.sh
+++ b/src/VBox/HostDrivers/win/load.sh
@@ -34,7 +34,7 @@ set +e
 #
 # Query the status of the drivers.
 #
-for drv in VBoxNetAdp VBoxNetFlt VBoxUSBMon VBoxUSB VBoxDrv;
+for drv in VBoxNetAdp VBoxNetAdp6 VBoxNetFlt VBoxNetLwf VBoxUSBMon VBoxUSB VBoxDrv;
 do
     if sc query $drv > /dev/null; then
         STATE=`sc query $drv \
@@ -55,7 +55,7 @@ set -x
 #
 # Invoke the uninstallers.
 #
-for uninst in NetAdpUninstall.exe NetFltUninstall.exe USBUninstall.exe SUPUninstall.exe;
+for uninst in NetAdpUninstall.exe NetAdp6Uninstall.exe USBUninstall.exe NetFltUninstall.exe NetLwfUninstall.exe SUPUninstall.exe;
 do
     if test -f ${MY_DIR}/$uninst; then
         ${MY_DIR}/$uninst
diff --git a/src/VBox/HostDrivers/win/loadall.sh b/src/VBox/HostDrivers/win/loadall.sh
index 7ff8a75..40460bf 100755
--- a/src/VBox/HostDrivers/win/loadall.sh
+++ b/src/VBox/HostDrivers/win/loadall.sh
@@ -34,7 +34,7 @@ set +e
 #
 # Query the status of the drivers.
 #
-for drv in VBoxNetAdp VBoxNetFlt VBoxUSBMon VBoxUSB VBoxDrv;
+for drv in VBoxNetAdp VBoxNetAdp6 VBoxNetFlt VBoxNetLwf VBoxUSBMon VBoxUSB VBoxDrv;
 do
     if sc query $drv > /dev/null; then
         STATE=`sc query $drv \
@@ -43,9 +43,9 @@ do
                          -e 's/^ *//g' \
                          -e 's/ *$//g' \
               `
-        echo "load.sh: $drv - $STATE"
+        echo "loadall.sh: $drv - $STATE"
     else
-        echo "load.sh: $drv - not configured, probably."
+        echo "loadall.sh: $drv - not configured, probably."
     fi
 done
 
@@ -55,7 +55,7 @@ set -x
 #
 # Invoke the uninstallers.
 #
-for uninst in NetAdpUninstall.exe NetFltUninstall.exe USBUninstall.exe SUPUninstall.exe;
+for uninst in NetAdpUninstall.exe NetAdp6Uninstall.exe USBUninstall.exe NetFltUninstall.exe NetLwfUninstall.exe SUPUninstall.exe;
 do
     if test -f ${MY_DIR}/$uninst; then
         ${MY_DIR}/$uninst
@@ -66,7 +66,19 @@ done
 # Invoke the installers.
 #
 if test "$1" != "-u" -a "$1" != "--uninstall"; then
-    for inst in SUPInstall.exe USBInstall.exe NetFltInstall.exe ; #NetAdpInstall.exe; - busted
+    INSTALLERS="SUPInstall.exe USBInstall.exe";
+    VER=`cmd.exe /c ver`
+    VER=`echo "$VER" | kmk_sed -e 's/^.*\[[^0-9]* \(.*\)\]/\1/' -e '/^$/d`
+    case "$VER" in
+        6.*|10.*|11.*|12.*)
+            INSTALLERS="$INSTALLERS NetLwfInstall.exe"; #NetAdp6Install.exe - also busted?
+            ;;
+        *)
+            INSTALLERS="$INSTALLERS NetFltInstall.exe"; #NetAdpInstall.exe; - busted
+            ;;
+    esac
+
+    for inst in $INSTALLERS;
     do
         if test -f ${MY_DIR}/$inst; then
             ${MY_DIR}/$inst
@@ -74,6 +86,6 @@ if test "$1" != "-u" -a "$1" != "--uninstall"; then
     done
 fi
 
-echo "load.sh: Successfully installed all drivers"
+echo "loadall.sh: Successfully installed all drivers"
 exit 0
 
diff --git a/src/VBox/HostServices/DragAndDrop/Makefile.kmk b/src/VBox/HostServices/DragAndDrop/Makefile.kmk
index 7e9ccc8..eb048e3 100644
--- a/src/VBox/HostServices/DragAndDrop/Makefile.kmk
+++ b/src/VBox/HostServices/DragAndDrop/Makefile.kmk
@@ -45,7 +45,8 @@ VBoxDragAndDropSvc_SOURCES.win = \
 VBoxDragAndDropSvc_LIBS = \
 	$(LIB_VMM) \
 	$(LIB_RUNTIME) \
-	$(LIB_REM)
+	$(LIB_REM) \
+	$(PATH_STAGE_LIB)/VBoxDnDHostR3Lib$(VBOX_SUFF_LIB)
 
 VBoxDragAndDropSvc_LDFLAGS.darwin = \
 	-install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDragAndDropSvc.dylib
diff --git a/src/VBox/HostServices/DragAndDrop/VBoxDragAndDropSvc.rc b/src/VBox/HostServices/DragAndDrop/VBoxDragAndDropSvc.rc
index 338baca..bb245fd 100644
--- a/src/VBox/HostServices/DragAndDrop/VBoxDragAndDropSvc.rc
+++ b/src/VBox/HostServices/DragAndDrop/VBoxDragAndDropSvc.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Drag and Drop Host Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxDragAndDropSvc\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxDragAndDropSvc.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/DragAndDrop/dndmanager.cpp b/src/VBox/HostServices/DragAndDrop/dndmanager.cpp
index 5766a8e..1cbbb9e 100644
--- a/src/VBox/HostServices/DragAndDrop/dndmanager.cpp
+++ b/src/VBox/HostServices/DragAndDrop/dndmanager.cpp
@@ -1,10 +1,10 @@
 /* $Id: dndmanager.cpp $ */
 /** @file
- * Drag and Drop manager.
+ * Drag and Drop manager: Handling of DnD messages on the host side.
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,7 +19,10 @@
  *   Header Files                                                             *
  ******************************************************************************/
 
-#define LOG_GROUP LOG_GROUP_HGCM
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
 
 #include "dndmanager.h"
 
@@ -29,663 +32,143 @@
 #include <iprt/path.h>
 #include <iprt/uri.h>
 
-#define VERBOSE 1
-
-#if defined(VERBOSE) && defined(DEBUG_poetzsch)
-# include <iprt/stream.h>
-# define DO(s) RTPrintf s
-#else
-# define DO(s) do {} while(0)
-//# define DO(s) Log s
-#endif
-
-/******************************************************************************
- *   Private declarations                                                     *
- ******************************************************************************/
-
-typedef DECLCALLBACK(int) FNDNDPRIVATEPROGRESS(size_t cbDone, void *pvUser);
-typedef FNDNDPRIVATEPROGRESS *PFNDNDPRIVATEPROGRESS;
-
-/**
- * Internal DnD message class for informing the guest about a new directory.
- *
- * @see DnDHGSendDataMessage
- */
-class DnDHGSendDirPrivate: public DnDMessage
-{
-public:
-    DnDHGSendDirPrivate(const RTCString &strPath, uint32_t fMode, uint64_t cbSize, PFNDNDPRIVATEPROGRESS pfnProgressCallback, void *pvProgressUser)
-      : m_strPath(strPath)
-      , m_cbSize(cbSize)
-      , m_pfnProgressCallback(pfnProgressCallback)
-      , m_pvProgressUser(pvProgressUser)
-    {
-        VBOXHGCMSVCPARM paTmpParms[3];
-        paTmpParms[0].setString(m_strPath.c_str());
-        paTmpParms[1].setUInt32(m_strPath.length() + 1);
-        paTmpParms[2].setUInt32(fMode);
-        m_pNextMsg = new HGCM::Message(DragAndDropSvc::HOST_DND_HG_SND_DIR, 3, paTmpParms);
-    }
-
-    int currentMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
-    {
-        int rc = DnDMessage::currentMessage(uMsg, cParms, paParms);
-        /* Advance progress info */
-        if (   RT_SUCCESS(rc)
-            && m_pfnProgressCallback)
-            rc = m_pfnProgressCallback(m_cbSize, m_pvProgressUser);
-
-        return rc;
-    }
-
-protected:
-    RTCString m_strPath;
-
-    /* Progress stuff */
-    size_t                 m_cbSize;
-    PFNDNDPRIVATEPROGRESS  m_pfnProgressCallback;
-    void                  *m_pvProgressUser;
-};
-
-/**
- * Internal DnD message class for informing the guest about a new file.
- *
- * @see DnDHGSendDataMessage
- */
-class DnDHGSendFilePrivate: public DnDMessage
-{
-public:
-    DnDHGSendFilePrivate(const RTCString &strHostPath, const RTCString &strGuestPath, uint32_t fMode, uint64_t cbSize, PFNDNDPRIVATEPROGRESS pfnProgressCallback, void *pvProgressUser);
-    ~DnDHGSendFilePrivate();
-
-    int currentMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
-
-protected:
-    RTCString              m_strHostPath;
-    RTCString              m_strGuestPath;
-    uint64_t               m_cbSize;
-    uint64_t               m_cbDone;
-    RTFILE                 m_hCurFile;
-    VBOXHGCMSVCPARM        m_paSkelParms[5];
-
-    /* Progress stuff */
-    PFNDNDPRIVATEPROGRESS  m_pfnProgressCallback;
-    void                  *m_pvProgressUser;
-};
-
-/**
- * Internal DnD message class for informing the guest about new drag & drop
- * data.
- *
- * @see DnDHGSendDataMessage
- */
-class DnDHGSendDataMessagePrivate: public DnDMessage
-{
-public:
-    DnDHGSendDataMessagePrivate(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[], PFNDNDPRIVATEPROGRESS pfnProgressCallback, void *pvProgressUser);
-    int currentMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
-
-protected:
-    size_t                 m_cbSize;
-    size_t                 m_cbDone;
-
-    /* Progress stuff */
-    PFNDNDPRIVATEPROGRESS  m_pfnProgressCallback;
-    void                  *m_pvProgressUser;
-};
-
-/******************************************************************************
- *   Implementation                                                           *
- ******************************************************************************/
-
-/******************************************************************************
- *   DnDHGSendFilePrivate                                                *
- ******************************************************************************/
-
-DnDHGSendFilePrivate::DnDHGSendFilePrivate(const RTCString &strHostPath, const RTCString &strGuestPath, uint32_t fMode, uint64_t cbSize, PFNDNDPRIVATEPROGRESS pfnProgressCallback, void *pvProgressUser)
-  : m_strHostPath(strHostPath)
-  , m_strGuestPath(strGuestPath)
-  , m_cbSize(cbSize)
-  , m_cbDone(0)
-  , m_hCurFile(0)
-  , m_pfnProgressCallback(pfnProgressCallback)
-  , m_pvProgressUser(pvProgressUser)
-{
-    m_paSkelParms[0].setString(m_strGuestPath.c_str());
-    m_paSkelParms[1].setUInt32(m_strGuestPath.length() + 1);
-    m_paSkelParms[2].setPointer(NULL, 0);
-    m_paSkelParms[3].setUInt32(0);
-    m_paSkelParms[4].setUInt32(fMode);
-    m_pNextMsg = new HGCM::Message(DragAndDropSvc::HOST_DND_HG_SND_FILE, 5, m_paSkelParms);
-}
-
-DnDHGSendFilePrivate::~DnDHGSendFilePrivate()
-{
-    if (m_hCurFile)
-        RTFileClose(m_hCurFile);
-}
-
-int DnDHGSendFilePrivate::currentMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
-{
-    if (!m_pNextMsg)
-        return VERR_NO_DATA;
-
-    int rc = m_pNextMsg->getData(uMsg, cParms, paParms);
-    clearNextMsg();
-    if (RT_FAILURE(rc))
-        return rc;
-
-    if (!m_hCurFile)
-    {
-        rc = RTFileOpen(&m_hCurFile, m_strHostPath.c_str(), RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_ALL);
-        if (RT_FAILURE(rc))
-            return rc;
-    }
-
-    /* How big is the pointer provided by the guest? */
-    uint32_t cbToRead = paParms[2].u.pointer.size;
-    size_t cbRead;
-    rc = RTFileRead(m_hCurFile, paParms[2].u.pointer.addr, cbToRead, &cbRead);
-    if (RT_FAILURE(rc))
-    {
-        /* On error, immediately close the file. */
-        RTFileClose(m_hCurFile);
-        m_hCurFile = 0;
-        return rc;
-    }
-    m_cbDone += cbRead;
-    /* Tell the guest the actual size. */
-    paParms[3].setUInt32(cbRead);
-    /* Check if we are done. */
-    if (m_cbSize == m_cbDone)
-    {
-        RTFileClose(m_hCurFile);
-        m_hCurFile = 0;
-    }
-    else
-    {
-        /* More data! Prepare the next message. */
-        m_pNextMsg = new HGCM::Message(DragAndDropSvc::HOST_DND_HG_SND_FILE, 5, m_paSkelParms);
-    }
-
-    /* Advance progress info */
-    if (   RT_SUCCESS(rc)
-        && m_pfnProgressCallback)
-        rc = m_pfnProgressCallback(cbRead, m_pvProgressUser);
-
-    return rc;
-}
-
 /******************************************************************************
- *   DnDHGSendDataMessagePrivate                                                *
+ *   DnDManager                                                               *
  ******************************************************************************/
 
-DnDHGSendDataMessagePrivate::DnDHGSendDataMessagePrivate(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[], PFNDNDPRIVATEPROGRESS pfnProgressCallback, void *pvProgressUser)
-  : m_cbSize(paParms[4].u.uint32)
-  , m_cbDone(0)
-  , m_pfnProgressCallback(pfnProgressCallback)
-  , m_pvProgressUser(pvProgressUser)
-{
-    /* Create the initial data message. */
-    m_pNextMsg = new HGCM::Message(uMsg, cParms, paParms);
-}
-
-int DnDHGSendDataMessagePrivate::currentMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
+int DnDManager::addMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool fAppend /* = true */)
 {
-    /* Todo: don't copy the data parts ... just move the data pointer in
-     * the original data ptr. */
-    if (!m_pNextMsg)
-        return VERR_NO_DATA;
-
     int rc = VINF_SUCCESS;
 
-    HGCM::Message *pCurMsg = m_pNextMsg;
-    m_pNextMsg = 0;
-    rc = pCurMsg->getData(uMsg, cParms, paParms);
-    /* Depending on the current message, the data pointer is on a
-     * different position (HOST_DND_HG_SND_DATA=3;
-     * HOST_DND_HG_SND_MORE_DATA=0). */
-    int iPos = uMsg == DragAndDropSvc::HOST_DND_HG_SND_DATA ? 3 : 0;
-    m_cbDone += paParms[iPos + 1].u.uint32;
-    /* Info & data send already? */
-    if (rc == VERR_BUFFER_OVERFLOW)
-    {
-        paParms[iPos + 1].u.uint32 = paParms[iPos].u.pointer.size;
-        VBOXHGCMSVCPARM paTmpParms[2];
-        void     *pvOldData;
-        uint32_t  cOldData;
-        pCurMsg->getParmPtrInfo(iPos, &pvOldData, &cOldData);
-        paTmpParms[0].setPointer(static_cast<uint8_t*>(pvOldData) + paParms[iPos].u.pointer.size, cOldData - paParms[iPos].u.pointer.size);
-        paTmpParms[1].setUInt32(cOldData - paParms[iPos].u.pointer.size);
-        m_pNextMsg = new HGCM::Message(DragAndDropSvc::HOST_DND_HG_SND_MORE_DATA, 2, paTmpParms);
-    }
-    delete pCurMsg;
-
-    /* Advance progress info */
-    if (   RT_SUCCESS(rc)
-        && m_pfnProgressCallback)
-        rc = m_pfnProgressCallback(m_cbDone, m_pvProgressUser);
-
-    return rc;
-}
-
-/******************************************************************************
- *   DnDHGSendDataMessage                                                       *
- ******************************************************************************/
+    LogFlowFunc(("uMsg=%RU32, cParms=%RU32, fAppend=%RTbool\n", uMsg, cParms, fAppend));
 
-/*
- * This class is a meta message class. It doesn't consist of any own message
- * data, but handle the meta info, the data itself as well any files or
- * directories which have to be transfered to the guest.
- */
-DnDHGSendDataMessage::DnDHGSendDataMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[], PFNDNDPROGRESS pfnProgressCallback, void *pvProgressUser)
-  : m_cbAll(0)
-  , m_cbTransfered(0)
-  , m_pfnProgressCallback(pfnProgressCallback)
-  , m_pvProgressUser(pvProgressUser)
-{
-    RTCString strNewUris;
-    /* Check the format for any uri type. */
-    if (hasFileUrls(static_cast<const char*>(paParms[1].u.pointer.addr), paParms[1].u.pointer.size))
+    try
     {
-        DO(("old data '%s'\n", (char*)paParms[3].u.pointer.addr));
-        /* The list is separated by newline (Even if only one file is
-         * listed). */
-        RTCList<RTCString> oldUriList = RTCString(static_cast<const char*>(paParms[3].u.pointer.addr), paParms[3].u.pointer.size).split("\r\n");
-        if (!oldUriList.isEmpty())
+        DnDMessage *pMessage = NULL;
+
+        switch (uMsg)
         {
-            RTCList<RTCString> newUriList;
-            for (size_t i = 0; i < oldUriList.size(); ++i)
+            case DragAndDropSvc::HOST_DND_HG_EVT_ENTER:
             {
-                const RTCString &strUri = oldUriList.at(i);
-                /* Query the path component of a file URI. If this hasn't a
-                 * file scheme null is returned. */
-                if (char *pszFilePath = RTUriFilePath(strUri.c_str(), URI_FILE_FORMAT_AUTO))
-                {
-                    /* Add the path to our internal file list (recursive in
-                     * the case of a directory). */
-                    if (char *pszFilename = RTPathFilename(pszFilePath))
-                    {
-                        char *pszNewUri = RTUriFileCreate(pszFilename);
-                        if (pszNewUri)
-                        {
-                            newUriList.append(pszNewUri);
-                            RTStrFree(pszNewUri);
-                            buildFileTree(pszFilePath, pszFilename - pszFilePath);
-                        }
-                    }
-                    RTStrFree(pszFilePath);
-                }
-                else
-                    newUriList.append(strUri);
+                clear();
+                LogFlowFunc(("HOST_DND_HG_EVT_ENTER\n"));
+                break;
             }
-            /* We have to change the actual DnD data. Remove any host paths and
-             * just decode the filename into the new data. The guest tools will
-             * add the correct path again, before sending the DnD drop event to
-             * some window. */
-            strNewUris = RTCString::join(newUriList, "\r\n") + "\r\n";
-            /* Remark: We don't delete the old pointer here, cause this is done
-             * by the caller. We just use the RTString data, which has the
-             * scope of this ctor. This is enough cause the data is copied in
-             * the DnDHGSendDataMessagePrivate anyway. */
-            paParms[3].u.pointer.addr = (void*)strNewUris.c_str();
-            paParms[3].u.pointer.size = strNewUris.length() + 1;
-            paParms[4].u.uint32       = strNewUris.length() + 1;
-        }
-    }
-    /* Add the size of the data to the todo list. */
-    m_cbAll += paParms[4].u.uint32;
-    /* The first message is the meta info for the data and the data itself. */
-    m_pNextPathMsg = new DnDHGSendDataMessagePrivate(uMsg, cParms, paParms, &DnDHGSendDataMessage::progressCallback, this);
-
-    DO(("new data '%s'\n", (char*)paParms[3].u.pointer.addr));
-    DO(("cbAll: %u\n", m_cbAll));
-    DO(("cbData: %u\n", paParms[4].u.uint32));
-
-    for (size_t i = 0; i < m_uriList.size(); ++i)
-        DO(("file: %s : %s - %o - %ld\n", m_uriList.at(i).m_strHostPath.c_str(), m_uriList.at(i).m_strGuestPath.c_str(), m_uriList.at(i).m_fMode, m_uriList.at(i).m_cbSize));
-}
-
-DnDHGSendDataMessage::~DnDHGSendDataMessage()
-{
-    if (m_pNextPathMsg)
-        delete m_pNextPathMsg;
-}
-
-HGCM::Message* DnDHGSendDataMessage::nextHGCMMessage()
-{
-    if (!m_pNextPathMsg)
-        return NULL;
-
-    return m_pNextPathMsg->nextHGCMMessage();
-}
-
-int DnDHGSendDataMessage::currentMessageInfo(uint32_t *puMsg, uint32_t *pcParms)
-{
-    if (!m_pNextPathMsg)
-        return VERR_NO_DATA;
-
-    return m_pNextPathMsg->currentMessageInfo(puMsg, pcParms);
-}
-
-int DnDHGSendDataMessage::currentMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
-{
-    if (!m_pNextPathMsg)
-        return VERR_NO_DATA;
-
-    /* Fill the data out of our current queued message. */
-    int rc = m_pNextPathMsg->currentMessage(uMsg, cParms, paParms);
-    /* Has this message more data to deliver? */
-    if (!m_pNextPathMsg->isMessageWaiting())
-    {
-        delete m_pNextPathMsg;
-        m_pNextPathMsg = NULL;
-    }
-
-    /* File data to send? */
-    if (!m_pNextPathMsg)
-    {
-        if (m_uriList.isEmpty())
-            return rc;
-        /* Create new messages based on our internal path list. Currently
-         * this could be directories or regular files. */
-        PathEntry nextPath = m_uriList.first();
-        if (RTFS_IS_DIRECTORY(nextPath.m_fMode))
-            m_pNextPathMsg = new DnDHGSendDirPrivate(nextPath.m_strGuestPath, nextPath.m_fMode, nextPath.m_cbSize, &DnDHGSendDataMessage::progressCallback, this);
-        else if (RTFS_IS_FILE(nextPath.m_fMode))
-            m_pNextPathMsg = new DnDHGSendFilePrivate(nextPath.m_strHostPath, nextPath.m_strGuestPath, nextPath.m_fMode, nextPath.m_cbSize, &DnDHGSendDataMessage::progressCallback, this);
-        else
-            AssertMsgFailedReturn(("type '%d' is not supported for path '%s'", nextPath.m_fMode, nextPath.m_strHostPath.c_str()), VERR_NO_DATA);
-        m_uriList.removeFirst();
-    }
-    return rc;
-}
-
-bool DnDHGSendDataMessage::hasFileUrls(const char *pcszFormat, size_t cbMax) const
-{
-    DO(("format %s\n", pcszFormat));
-    /* text/uri also an official variant? */
-    return    RTStrNICmp(pcszFormat, "text/uri-list", cbMax)             == 0
-           || RTStrNICmp(pcszFormat, "x-special/gnome-icon-list", cbMax) == 0;
-}
 
-int DnDHGSendDataMessage::buildFileTree(const char *pcszPath, size_t cbBaseLen)
-{
-    RTFSOBJINFO objInfo;
-    int rc = RTPathQueryInfo(pcszPath, &objInfo, RTFSOBJATTRADD_NOTHING);
-    if (RT_FAILURE(rc))
-        return rc;
-
-    /* These are the types we currently support. Symlinks are not directly
-     * supported. First the guest could be an OS which doesn't support it and
-     * second the symlink could point to a file which is out of the base tree.
-     * Both things are hard to support. For now we just copy the target file in
-     * this case. */
-    if (!(   RTFS_IS_DIRECTORY(objInfo.Attr.fMode)
-          || RTFS_IS_FILE(objInfo.Attr.fMode)
-          || RTFS_IS_SYMLINK(objInfo.Attr.fMode)))
-        return VINF_SUCCESS;
-
-    uint64_t cbSize = 0;
-    rc = RTFileQuerySize(pcszPath, &cbSize);
-    if (rc == VERR_IS_A_DIRECTORY)
-        rc = VINF_SUCCESS;
-    if (RT_FAILURE(rc))
-        return rc;
-    m_uriList.append(PathEntry(pcszPath, &pcszPath[cbBaseLen], objInfo.Attr.fMode, cbSize));
-    m_cbAll += cbSize;
-    DO(("cbFile: %u\n", cbSize));
-
-    PRTDIR hDir;
-    /* We have to try to open even symlinks, cause they could be symlinks
-     * to directories. */
-    rc = RTDirOpen(&hDir, pcszPath);
-    /* The following error happens when this was a symlink to an file or a
-     * regular file. */
-    if (rc == VERR_PATH_NOT_FOUND)
-        return VINF_SUCCESS;
-    if (RT_FAILURE(rc))
-        return rc;
-
-    while (RT_SUCCESS(rc))
-    {
-        RTDIRENTRY DirEntry;
-        rc = RTDirRead(hDir, &DirEntry, NULL);
-        if (RT_FAILURE(rc))
-        {
-            if (rc == VERR_NO_MORE_FILES)
-                rc = VINF_SUCCESS;
-            break;
-        }
-        switch (DirEntry.enmType)
-        {
-            case RTDIRENTRYTYPE_DIRECTORY:
+            case DragAndDropSvc::HOST_DND_HG_EVT_MOVE:
             {
-                /* Skip "." and ".." entries. */
-                if (   RTStrCmp(DirEntry.szName, ".")  == 0
-                    || RTStrCmp(DirEntry.szName, "..") == 0)
-                    break;
-                if (char *pszRecDir = RTStrAPrintf2("%s%c%s", pcszPath, RTPATH_DELIMITER, DirEntry.szName))
-                {
-                    rc = buildFileTree(pszRecDir, cbBaseLen);
-                    RTStrFree(pszRecDir);
-                }
-                else
-                    rc = VERR_NO_MEMORY;
+                LogFlowFunc(("HOST_DND_HG_EVT_MOVE\n"));
                 break;
             }
-            case RTDIRENTRYTYPE_SYMLINK:
-            case RTDIRENTRYTYPE_FILE:
+
+            case DragAndDropSvc::HOST_DND_HG_EVT_LEAVE:
             {
-                if (char *pszNewFile = RTStrAPrintf2("%s%c%s", pcszPath, RTPATH_DELIMITER, DirEntry.szName))
-                {
-                    /* We need the size and the mode of the file. */
-                    RTFSOBJINFO objInfo1;
-                    rc = RTPathQueryInfo(pszNewFile, &objInfo1, RTFSOBJATTRADD_NOTHING);
-                    if (RT_FAILURE(rc))
-                        return rc;
-                    rc = RTFileQuerySize(pszNewFile, &cbSize);
-                    if (RT_FAILURE(rc))
-                        break;
-                    m_uriList.append(PathEntry(pszNewFile, &pszNewFile[cbBaseLen], objInfo1.Attr.fMode, cbSize));
-                    m_cbAll += cbSize;
-                    RTStrFree(pszNewFile);
-                }
-                else
-                    rc = VERR_NO_MEMORY;
+                LogFlowFunc(("HOST_DND_HG_EVT_LEAVE\n"));
                 break;
             }
-            default: break;
-        }
-    }
-    RTDirClose(hDir);
-
-    return rc;
-}
-
-int DnDHGSendDataMessage::progressCallback(size_t cbDone, void *pvUser)
-{
-    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-
-    DnDHGSendDataMessage *pSelf = static_cast<DnDHGSendDataMessage *>(pvUser);
-
-    /* How many bytes are transfered already. */
-    pSelf->m_cbTransfered += cbDone;
-
-    /* Advance progress info */
-    int rc = VINF_SUCCESS;
-    if (   pSelf->m_pfnProgressCallback
-        && pSelf->m_cbAll)
-        rc = pSelf->m_pfnProgressCallback((uint64_t)pSelf->m_cbTransfered * 100 / pSelf->m_cbAll,
-                                          DragAndDropSvc::DND_PROGRESS_RUNNING, pSelf->m_pvProgressUser);
-
-    return rc;
-}
 
-/******************************************************************************
- *   DnDManager                                                               *
- ******************************************************************************/
+            case DragAndDropSvc::HOST_DND_HG_EVT_DROPPED:
+            {
+                LogFlowFunc(("HOST_DND_HG_EVT_DROPPED\n"));
+                break;
+            }
 
-int DnDManager::addMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
-{
-    int rc = VINF_SUCCESS;
-    switch (uMsg)
-    {
-        case DragAndDropSvc::HOST_DND_HG_EVT_ENTER:
-        {
-            clear();
-            LogFlowFunc(("HOST_DND_HG_EVT_ENTER\n"));
-            DO(("HOST_DND_HG_EVT_ENTER\n"));
-            /* Verify parameter count and types. */
-            if (   cParms != 7
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* screen id */
-                || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* x-pos */
-                || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* y-pos */
-                || paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT /* default action */
-                || paParms[4].type != VBOX_HGCM_SVC_PARM_32BIT /* allowed actions */
-                || paParms[5].type != VBOX_HGCM_SVC_PARM_PTR   /* data */
-                || paParms[6].type != VBOX_HGCM_SVC_PARM_32BIT /* size */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+            case DragAndDropSvc::HOST_DND_HG_EVT_CANCEL:
             {
-                m_fOpInProcess = true;
-                DnDGenericMessage *pMessage = new DnDGenericMessage(uMsg, cParms, paParms);
-                m_dndMessageQueue.append(pMessage);
+                LogFlowFunc(("HOST_DND_HG_EVT_CANCEL\n"));
+
+                pMessage = new DnDHGCancelMessage();
+                break;
             }
-            break;
-        }
-        case DragAndDropSvc::HOST_DND_HG_EVT_MOVE:
-        {
-            LogFlowFunc(("HOST_DND_HG_EVT_MOVE\n"));
-            DO(("HOST_DND_HG_EVT_MOVE\n"));
-            /* Verify parameter count and types. */
-            if (   cParms != 7
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* screen id */
-                || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* x-pos */
-                || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* y-pos */
-                || paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT /* default action */
-                || paParms[4].type != VBOX_HGCM_SVC_PARM_32BIT /* allowed actions */
-                || paParms[5].type != VBOX_HGCM_SVC_PARM_PTR   /* data */
-                || paParms[6].type != VBOX_HGCM_SVC_PARM_32BIT /* size */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+
+            case DragAndDropSvc::HOST_DND_HG_SND_DATA:
             {
-                m_fOpInProcess = true;
-                DnDGenericMessage *pMessage = new DnDGenericMessage(uMsg, cParms, paParms);
-                m_dndMessageQueue.append(pMessage);
+                LogFlowFunc(("HOST_DND_HG_SND_DATA\n"));
+                break;
             }
-            break;
-        }
-        case DragAndDropSvc::HOST_DND_HG_EVT_LEAVE:
-        {
-            LogFlowFunc(("HOST_DND_HG_EVT_LEAVE\n"));
-            DO(("HOST_DND_HG_EVT_LEAVE\n"));
 
-            /* Verify parameter count and types. */
-            if (cParms != 0)
-                rc = VERR_INVALID_PARAMETER;
-            else
+            case DragAndDropSvc::HOST_DND_HG_SND_DIR:
             {
-                DnDGenericMessage *pMessage = new DnDGenericMessage(uMsg, cParms, paParms);
-                m_dndMessageQueue.append(pMessage);
+                LogFlowFunc(("HOST_DND_HG_SND_DIR\n"));
+                break;
             }
-            m_fOpInProcess = false;
-            break;
-        }
-        case DragAndDropSvc::HOST_DND_HG_EVT_DROPPED:
-        {
-            LogFlowFunc(("HOST_DND_HG_EVT_DROPPED\n"));
-            DO(("HOST_DND_HG_EVT_DROPPED\n"));
-            /* Verify parameter count and types. */
-            if (   cParms != 7
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* screen id */
-                || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* x-pos */
-                || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* y-pos */
-                || paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT /* default action */
-                || paParms[4].type != VBOX_HGCM_SVC_PARM_32BIT /* allowed actions */
-                || paParms[5].type != VBOX_HGCM_SVC_PARM_PTR   /* data */
-                || paParms[6].type != VBOX_HGCM_SVC_PARM_32BIT /* size */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+
+            /* New since protocol version 2 (VBox 5.0). */
+            case DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR:
             {
-                DnDGenericMessage *pMessage = new DnDGenericMessage(uMsg, cParms, paParms);
-                m_dndMessageQueue.append(pMessage);
+                LogFlowFunc(("HOST_DND_HG_SND_FILE_HDR\n"));
+                break;
             }
-            break;
-        }
-        case DragAndDropSvc::HOST_DND_HG_SND_DATA:
-        {
-            LogFlowFunc(("HOST_DND_HG_SND_DATA\n"));
-            DO(("HOST_DND_HG_SND_DATA\n"));
-
-            /* Verify parameter count and types. */
-            if (   cParms != 5
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* screen id */
-                || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR   /* format */
-                || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* format size */
-                || paParms[3].type != VBOX_HGCM_SVC_PARM_PTR   /* data */
-                || paParms[4].type != VBOX_HGCM_SVC_PARM_32BIT /* data size */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+
+            case DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA:
             {
-                DnDHGSendDataMessage *pMessage = new DnDHGSendDataMessage(uMsg, cParms, paParms, m_pfnProgressCallback, m_pvProgressUser);
-                m_dndMessageQueue.append(pMessage);
+                LogFlowFunc(("HOST_DND_HG_SND_FILE\n"));
+
+                /* No parameter verification here as, depending on the protocol version
+                 * being used, the parameter count + types might change. */
+                break;
             }
-            break;
-        }
+
 #ifdef VBOX_WITH_DRAG_AND_DROP_GH
-        case DragAndDropSvc::HOST_DND_GH_REQ_PENDING:
-        {
-            LogFlowFunc(("HOST_DND_GH_REQ_PENDING\n"));
-            DO(("HOST_DND_GH_REQ_PENDING\n"));
-
-            /* Verify parameter count and types. */
-            if (   cParms != 1
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* screen id */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+            case DragAndDropSvc::HOST_DND_GH_REQ_PENDING:
             {
-                DnDGenericMessage *pMessage = new DnDGenericMessage(uMsg, cParms, paParms);
-                m_dndMessageQueue.append(pMessage);
+                LogFlowFunc(("HOST_DND_GH_REQ_PENDING\n"));
+
+                /* Verify parameter count and types. */
+                if (   cParms != 1
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* screen id */)
+                {
+                    rc = VERR_INVALID_PARAMETER;
+                }
+                break;
             }
-            break;
-        }
-        case DragAndDropSvc::HOST_DND_GH_EVT_DROPPED:
-        {
-            LogFlowFunc(("HOST_DND_GH_EVT_DROPPED\n"));
-            DO(("HOST_DND_GH_EVT_DROPPED\n"));
-
-            /* Verify parameter count and types. */
-            if (   cParms != 3
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR   /* format */
-                || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* format size */
-                || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* action */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+
+            case DragAndDropSvc::HOST_DND_GH_EVT_DROPPED:
             {
-                DnDGenericMessage *pMessage = new DnDGenericMessage(uMsg, cParms, paParms);
-                m_dndMessageQueue.append(pMessage);
+                LogFlowFunc(("HOST_DND_GH_EVT_DROPPED\n"));
+
+                /* Verify parameter count and types. */
+                if (   cParms != 3
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR   /* format */
+                    || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* format size */
+                    || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* action */)
+                {
+                    rc = VERR_INVALID_PARAMETER;
+                }
+                break;
             }
-            break;
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
+
+            default:
+                rc = VERR_NOT_IMPLEMENTED;
+                break;
         }
-#endif
-        default: rc = VERR_NOT_IMPLEMENTED; break;
+
+        if (!pMessage) /* Generic message needed? */
+            pMessage = new DnDGenericMessage(uMsg, cParms, paParms);
+
+        if (fAppend)
+            m_dndMessageQueue.append(pMessage);
+        else
+            m_dndMessageQueue.prepend(pMessage);
+    }
+    catch(std::bad_alloc &)
+    {
+        rc = VERR_NO_MEMORY;
     }
 
     return rc;
 }
 
-HGCM::Message* DnDManager::nextHGCMMessage()
+HGCM::Message* DnDManager::nextHGCMMessage(void)
 {
     if (m_pCurMsg)
         return m_pCurMsg->nextHGCMMessage();
-    else
-    {
-        if (m_dndMessageQueue.isEmpty())
-            return 0;
 
-        return m_dndMessageQueue.first()->nextHGCMMessage();
-    }
+    if (m_dndMessageQueue.isEmpty())
+        return NULL;
+
+    return m_dndMessageQueue.first()->nextHGCMMessage();
 }
 
 int DnDManager::nextMessageInfo(uint32_t *puMsg, uint32_t *pcParms)
@@ -693,69 +176,96 @@ int DnDManager::nextMessageInfo(uint32_t *puMsg, uint32_t *pcParms)
     AssertPtrReturn(puMsg, VERR_INVALID_POINTER);
     AssertPtrReturn(pcParms, VERR_INVALID_POINTER);
 
-    int rc = VINF_SUCCESS;
-
+    int rc;
     if (m_pCurMsg)
         rc = m_pCurMsg->currentMessageInfo(puMsg, pcParms);
     else
     {
         if (m_dndMessageQueue.isEmpty())
-        {
             rc = VERR_NO_DATA;
-//            if (m_pfnProgressCallback)
-//                m_pfnProgressCallback(100.0, DragAndDropSvc::DND_OP_CANCELLED, m_pvProgressUser);
-        }
         else
             rc = m_dndMessageQueue.first()->currentMessageInfo(puMsg, pcParms);
     }
 
-    DO(("next msg info: %d %d %Rrc\n", *puMsg, *pcParms, rc));
+    LogFlowFunc(("Returning puMsg=%RU32, pcParms=%RU32, rc=%Rrc\n", *puMsg, *pcParms, rc));
     return rc;
 }
 
 int DnDManager::nextMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
 {
+    LogFlowFunc(("uMsg=%RU32, cParms=%RU32\n", uMsg, cParms));
+
     if (!m_pCurMsg)
     {
         /* Check for pending messages in our queue. */
         if (m_dndMessageQueue.isEmpty())
+        {
+            LogFlowFunc(("Message queue is empty, returning\n"));
             return VERR_NO_DATA;
+        }
+
         m_pCurMsg = m_dndMessageQueue.first();
         m_dndMessageQueue.removeFirst();
     }
 
     /* Fetch the current message info */
     int rc = m_pCurMsg->currentMessage(uMsg, cParms, paParms);
-    /* If this message not provide any additional sub messages, clear it. */
+    /* If this message doesn't provide any additional sub messages, clear it. */
     if (!m_pCurMsg->isMessageWaiting())
     {
         delete m_pCurMsg;
-        m_pCurMsg = 0;
+        m_pCurMsg = NULL;
     }
 
-    /* If the user has canceled the operation, we need to cleanup all pending
-     * events and inform the progress callback about our successful cleanup. */
-    if (   rc == VERR_CANCELLED
-        && m_pfnProgressCallback)
+    /*
+     * If there was an error handling the current message or the user has canceled
+     * the operation, we need to cleanup all pending events and inform the progress
+     * callback about our exit.
+     */
+    if (RT_FAILURE(rc))
     {
-        /* Clear any pending messages */
+        /* Clear any pending messages. */
         clear();
-        /* Create a new cancel message to inform the guest. */
-        m_pCurMsg = new DnDHGCancelMessage();
-        m_pfnProgressCallback(100, DragAndDropSvc::DND_PROGRESS_CANCELLED, m_pvProgressUser);
+
+        /* Create a new cancel message to inform the guest + call
+         * the host whether the current transfer was canceled or aborted
+         * due to an error. */
+        try
+        {
+            if (rc == VERR_CANCELLED)
+                LogFlowFunc(("Operation was cancelled\n"));
+
+            Assert(!m_pCurMsg);
+            m_pCurMsg = new DnDHGCancelMessage();
+
+            if (m_pfnProgressCallback)
+            {
+                LogFlowFunc(("Notifying host about aborting operation (%Rrc) ...\n", rc));
+                m_pfnProgressCallback(  rc == VERR_CANCELLED
+                                      ? DragAndDropSvc::DND_PROGRESS_CANCELLED
+                                      : DragAndDropSvc::DND_PROGRESS_ERROR,
+                                      100 /* Percent */, rc,
+                                      m_pvProgressUser);
+            }
+        }
+        catch(std::bad_alloc &)
+        {
+            rc = VERR_NO_MEMORY;
+        }
     }
 
-    DO(("next msg: %d %d %Rrc\n", uMsg, cParms, rc));
+    LogFlowFunc(("Message processed with rc=%Rrc\n", rc));
     return rc;
 }
 
-void DnDManager::clear()
+void DnDManager::clear(void)
 {
     if (m_pCurMsg)
     {
         delete m_pCurMsg;
-        m_pCurMsg = 0;
+        m_pCurMsg = NULL;
     }
+
     while (!m_dndMessageQueue.isEmpty())
     {
         delete m_dndMessageQueue.last();
@@ -763,3 +273,25 @@ void DnDManager::clear()
     }
 }
 
+/**
+ * Triggers a rescheduling of the manager's message queue by setting the first
+ * message available in the queue as the current one to process.
+ *
+ * @return  IPRT status code. VERR_NO_DATA if not message to process is available at
+ *          the time of calling.
+ */
+int DnDManager::doReschedule(void)
+{
+    LogFlowFunc(("Rescheduling ...\n"));
+
+    if (!m_dndMessageQueue.isEmpty())
+    {
+        m_pCurMsg = m_dndMessageQueue.first();
+        m_dndMessageQueue.removeFirst();
+
+        return VINF_SUCCESS;
+    }
+
+    return VERR_NO_DATA;
+}
+
diff --git a/src/VBox/HostServices/DragAndDrop/dndmanager.h b/src/VBox/HostServices/DragAndDrop/dndmanager.h
index 1816540..f665280 100644
--- a/src/VBox/HostServices/DragAndDrop/dndmanager.h
+++ b/src/VBox/HostServices/DragAndDrop/dndmanager.h
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,13 +17,14 @@
 #ifndef ___VBox_HostService_DnD_dndmanager_h
 #define ___VBox_HostService_DnD_dndmanager_h
 
+#include <VBox/GuestHost/DragAndDrop.h>
 #include <VBox/HostServices/Service.h>
 #include <VBox/HostServices/DragAndDropSvc.h>
 
 #include <iprt/cpp/ministring.h>
 #include <iprt/cpp/list.h>
 
-typedef DECLCALLBACK(int) FNDNDPROGRESS(unsigned uPercentage, uint32_t uState, void *pvUser);
+typedef DECLCALLBACK(int) FNDNDPROGRESS(uint32_t uState, uint32_t uPercentage, int rc, void *pvUser);
 typedef FNDNDPROGRESS *PFNDNDPROGRESS;
 
 /**
@@ -33,19 +34,22 @@ typedef FNDNDPROGRESS *PFNDNDPROGRESS;
 class DnDMessage
 {
 public:
-    DnDMessage()
-      : m_pNextMsg(NULL)
+
+    DnDMessage(void)
+        : m_pNextMsg(NULL)
     {
     }
-    virtual ~DnDMessage()
+
+    virtual ~DnDMessage(void)
     {
         clearNextMsg();
     }
 
-    virtual HGCM::Message* nextHGCMMessage()
+    virtual HGCM::Message* nextHGCMMessage(void)
     {
         return m_pNextMsg;
     }
+
     virtual int currentMessageInfo(uint32_t *puMsg, uint32_t *pcParms)
     {
         AssertPtrReturn(puMsg, VERR_INVALID_POINTER);
@@ -59,7 +63,9 @@ public:
 
         return VINF_SUCCESS;
     }
-    virtual int currentMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
+
+    virtual int currentMessage(uint32_t uMsg, uint32_t cParms,
+                               VBOXHGCMSVCPARM paParms[])
     {
         if (!m_pNextMsg)
             return VERR_NO_DATA;
@@ -70,7 +76,8 @@ public:
 
         return rc;
     }
-    virtual void clearNextMsg()
+
+    virtual void clearNextMsg(void)
     {
         if (m_pNextMsg)
         {
@@ -79,9 +86,10 @@ public:
         }
     }
 
-    virtual bool isMessageWaiting() const { return m_pNextMsg != NULL; }
+    virtual bool isMessageWaiting(void) const { return m_pNextMsg != NULL; }
 
 protected:
+
     HGCM::Message *m_pNextMsg;
 };
 
@@ -99,58 +107,17 @@ public:
 };
 
 /**
- * DnD message class for informing the guest about a new drop data event.
- */
-class DnDHGSendDataMessage: public DnDMessage
-{
-public:
-    DnDHGSendDataMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[], PFNDNDPROGRESS pfnProgressCallback, void *pvProgressUser);
-    ~DnDHGSendDataMessage();
-
-    HGCM::Message* nextHGCMMessage();
-    int currentMessageInfo(uint32_t *puMsg, uint32_t *pcParms);
-    int currentMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
-
-    bool isMessageWaiting() const { return !!m_pNextPathMsg; }
-
-protected:
-    struct PathEntry
-    {
-        PathEntry(const RTCString &strHostPath, const RTCString &strGuestPath, uint32_t fMode, uint64_t cbSize)
-          : m_strHostPath(strHostPath)
-          , m_strGuestPath(strGuestPath)
-          , m_fMode(fMode)
-          , m_cbSize(cbSize) {}
-        RTCString m_strHostPath;
-        RTCString m_strGuestPath;
-        uint32_t  m_fMode;
-        uint64_t  m_cbSize;
-    };
-
-    bool hasFileUrls(const char *pcszFormat, size_t cbMax) const;
-    int buildFileTree(const char *pcszPath, size_t cbBaseLen);
-    static DECLCALLBACK(int) progressCallback(size_t cbDone, void *pvUser);
-
-    RTCList<PathEntry>  m_uriList;
-    DnDMessage         *m_pNextPathMsg;
-
-    /* Progress stuff */
-    size_t              m_cbAll;
-    size_t              m_cbTransfered;
-    PFNDNDPROGRESS      m_pfnProgressCallback;
-    void               *m_pvProgressUser;
-};
-
-/**
- * DnD message class for informing the guest to cancel any currently and
- * pending activities.
+ * DnD message class for informing the guest to cancel any current (and pending) activities.
  */
 class DnDHGCancelMessage: public DnDMessage
 {
 public:
-    DnDHGCancelMessage()
+
+    DnDHGCancelMessage(void)
     {
-        m_pNextMsg = new HGCM::Message(DragAndDropSvc::HOST_DND_HG_EVT_CANCEL, 0, 0);
+        m_pNextMsg
+            = new HGCM::Message(DragAndDropSvc::HOST_DND_HG_EVT_CANCEL,
+                                0 /* cParms */, 0 /* aParms */);
     }
 };
 
@@ -161,37 +128,34 @@ public:
 class DnDManager
 {
 public:
+
     DnDManager(PFNDNDPROGRESS pfnProgressCallback, void *pvProgressUser)
-      : m_pCurMsg(0)
-      , m_fOpInProcess(false)
-      , m_pfnProgressCallback(pfnProgressCallback)
-      , m_pvProgressUser(pvProgressUser)
+        : m_pCurMsg(NULL)
+        , m_pfnProgressCallback(pfnProgressCallback)
+        , m_pvProgressUser(pvProgressUser)
     {}
-    ~DnDManager()
+
+    virtual ~DnDManager(void)
     {
         clear();
     }
 
-    int addMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
+    int addMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[], bool fAppend = true);
 
-    HGCM::Message *nextHGCMMessage();
+    HGCM::Message *nextHGCMMessage(void);
     int nextMessageInfo(uint32_t *puMsg, uint32_t *pcParms);
     int nextMessage(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
 
-    void clear();
-
-    bool hasActiveOperation() const { return m_fOpInProcess; }
+    void clear(void);
+    int doReschedule(void);
 
 private:
     DnDMessage           *m_pCurMsg;
     RTCList<DnDMessage*>  m_dndMessageQueue;
 
-    bool                  m_fOpInProcess;
-
     /* Progress stuff */
     PFNDNDPROGRESS        m_pfnProgressCallback;
     void                 *m_pvProgressUser;
 };
-
 #endif /* ___VBox_HostService_DnD_dndmanager_h */
 
diff --git a/src/VBox/HostServices/DragAndDrop/service.cpp b/src/VBox/HostServices/DragAndDrop/service.cpp
index 54c5025..f4330ed 100644
--- a/src/VBox/HostServices/DragAndDrop/service.cpp
+++ b/src/VBox/HostServices/DragAndDrop/service.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -54,47 +54,56 @@
 /******************************************************************************
  *   Header Files                                                             *
  ******************************************************************************/
-#define LOG_GROUP LOG_GROUP_HGCM
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
 
-#include "dndmanager.h"
+#include <map>
 
-//# define DO(s) RTPrintf s
-#define DO(s) do {} while(0)
-//#define DO(s) Log s
+#include "dndmanager.h"
 
 /******************************************************************************
  *   Service class declaration                                                *
  ******************************************************************************/
 
+/** Map holding pointers to HGCM clients. Key is the (unique) HGCM client ID. */
+typedef std::map<uint32_t, HGCM::Client*> DnDClientMap;
+
 /**
  * Specialized drag & drop service class.
  */
-class DragAndDropService: public HGCM::AbstractService<DragAndDropService>
+class DragAndDropService : public HGCM::AbstractService<DragAndDropService>
 {
 public:
+
     explicit DragAndDropService(PVBOXHGCMSVCHELPERS pHelpers)
-      : HGCM::AbstractService<DragAndDropService>(pHelpers)
-      , m_pManager(0)
-      , m_cClients(0)
-    {}
+        : HGCM::AbstractService<DragAndDropService>(pHelpers)
+        , m_pManager(NULL) {}
 
 protected:
-    /* HGCM service implementation */
+
     int  init(VBOXHGCMSVCFNTABLE *pTable);
-    int  uninit();
+    int  uninit(void);
     int  clientConnect(uint32_t u32ClientID, void *pvClient);
     int  clientDisconnect(uint32_t u32ClientID, void *pvClient);
     void guestCall(VBOXHGCMCALLHANDLE callHandle, uint32_t u32ClientID, void *pvClient, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
     int  hostCall(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
 
-    static DECLCALLBACK(int) progressCallback(unsigned uPercentage, uint32_t uState, void *pvUser);
-    int      hostMessage(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
-    void     modeSet(uint32_t u32Mode);
+    int modeSet(uint32_t u32Mode);
     inline uint32_t modeGet() { return m_u32Mode; };
 
-    DnDManager             *m_pManager;
+protected:
+
+    static DECLCALLBACK(int) progressCallback(uint32_t uStatus, uint32_t uPercentage, int rc, void *pvUser);
 
-    uint32_t                m_cClients;
+protected:
+
+    DnDManager             *m_pManager;
+    /** Map of all connected clients. */
+    DnDClientMap            m_clientMap;
+    /** List of all clients which are queued up (deferred return) and ready
+     *  to process new commands. */
     RTCList<HGCM::Client*>  m_clientQueue;
     uint32_t                m_u32Mode;
 };
@@ -110,52 +119,118 @@ int DragAndDropService::init(VBOXHGCMSVCFNTABLE *pTable)
     pTable->pfnSaveState         = NULL;  /* The service is stateless, so the normal */
     pTable->pfnLoadState         = NULL;  /* construction done before restoring suffices */
     pTable->pfnRegisterExtension = svcRegisterExtension;
+
+    /* Drag'n drop mode is disabled by default. */
     modeSet(VBOX_DRAG_AND_DROP_MODE_OFF);
 
-    m_pManager = new DnDManager(&DragAndDropService::progressCallback, this);
+    int rc = VINF_SUCCESS;
 
-    return VINF_SUCCESS;
+    try
+    {
+        m_pManager = new DnDManager(&DragAndDropService::progressCallback, this);
+    }
+    catch(std::bad_alloc &)
+    {
+        rc = VERR_NO_MEMORY;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
 }
 
-int DragAndDropService::uninit()
+int DragAndDropService::uninit(void)
 {
-    delete m_pManager;
+    if (m_pManager)
+    {
+        delete m_pManager;
+        m_pManager = NULL;
+    }
 
     return VINF_SUCCESS;
 }
 
 int DragAndDropService::clientConnect(uint32_t u32ClientID, void *pvClient)
 {
-    LogFlowFunc(("New client (%ld) connected\n", u32ClientID));
-    DO(("New client (%ld) connected\n", u32ClientID));
-    if (m_cClients < UINT32_MAX)
-        m_cClients++;
-    else
+    if (m_clientMap.size() >= UINT8_MAX) /* Don't allow too much clients at the same time. */
+    {
         AssertMsgFailed(("Maximum number of clients reached\n"));
-    return VINF_SUCCESS;
+        return VERR_BUFFER_OVERFLOW;
+    }
+
+    int rc = VINF_SUCCESS;
+
+    /*
+     * Add client to our client map.
+     */
+    if (m_clientMap.find(u32ClientID) != m_clientMap.end())
+        rc = VERR_ALREADY_EXISTS;
+
+    if (RT_SUCCESS(rc))
+    {
+        try
+        {
+            m_clientMap[u32ClientID] = new HGCM::Client(u32ClientID);
+        }
+        catch(std::bad_alloc &)
+        {
+            rc = VERR_NO_MEMORY;
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Clear the message queue as soon as a new clients connect
+             * to ensure that every client has the same state.
+             */
+            if (m_pManager)
+                m_pManager->clear();
+        }
+    }
+
+    LogFlowFunc(("Client %RU32 connected, rc=%Rrc\n", u32ClientID, rc));
+    return rc;
 }
 
 int DragAndDropService::clientDisconnect(uint32_t u32ClientID, void *pvClient)
 {
-    /* Remove all waiters with this clientId. */
-    for (size_t i = 0; i < m_clientQueue.size(); )
+    /* Client not found? Bail out early. */
+    DnDClientMap::iterator itClient =  m_clientMap.find(u32ClientID);
+    if (itClient == m_clientMap.end())
+        return VERR_NOT_FOUND;
+
+    /*
+     * Remove from waiters queue.
+     */
+    for (size_t i = 0; i < m_clientQueue.size(); i++)
     {
         HGCM::Client *pClient = m_clientQueue.at(i);
         if (pClient->clientId() == u32ClientID)
         {
-            m_pHelpers->pfnCallComplete(pClient->handle(), VERR_INTERRUPTED);
+            if (m_pHelpers)
+                m_pHelpers->pfnCallComplete(pClient->handle(), VERR_INTERRUPTED);
+
             m_clientQueue.removeAt(i);
             delete pClient;
+
+            break;
         }
-        else
-            i++;
     }
 
+    /*
+     * Remove from client map and deallocate.
+     */
+    AssertPtr(itClient->second);
+    delete itClient->second;
+
+    m_clientMap.erase(itClient);
+
+    LogFlowFunc(("Client %RU32 disconnected\n", u32ClientID));
     return VINF_SUCCESS;
 }
 
-void DragAndDropService::modeSet(uint32_t u32Mode)
+int DragAndDropService::modeSet(uint32_t u32Mode)
 {
+    /** @todo Validate mode. */
     switch (u32Mode)
     {
         case VBOX_DRAG_AND_DROP_MODE_OFF:
@@ -167,254 +242,462 @@ void DragAndDropService::modeSet(uint32_t u32Mode)
 
         default:
             m_u32Mode = VBOX_DRAG_AND_DROP_MODE_OFF;
+            break;
     }
+
+    return VINF_SUCCESS;
 }
 
-void DragAndDropService::guestCall(VBOXHGCMCALLHANDLE callHandle, uint32_t u32ClientID, void *pvClient, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
+void DragAndDropService::guestCall(VBOXHGCMCALLHANDLE callHandle, uint32_t u32ClientID,
+                                   void *pvClient, uint32_t u32Function,
+                                   uint32_t cParms, VBOXHGCMSVCPARM paParms[])
 {
-    int rc = VINF_SUCCESS;
-    LogFlowFunc(("u32ClientID = %d, fn = %d, cParms = %d, pparms = %d\n",
-                 u32ClientID, u32Function, cParms, paParms));
-//    RTPrintf("u32ClientID = %d, fn = %d, cParms = %d, pparms = %d\n",
-//                 u32ClientID, u32Function, cParms, paParms);
+    LogFlowFunc(("u32ClientID=%RU32, u32Function=%RU32, cParms=%RU32\n",
+                 u32ClientID, u32Function, cParms));
 
+    /* Check if we've the right mode set. */
+    int rc = VERR_ACCESS_DENIED; /* Play safe. */
     switch (u32Function)
     {
         case DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG:
         {
-            DO(("GUEST_DND_GET_NEXT_HOST_MSG\n"));
-            if (   cParms != 3
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* message */
-                || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* parameter count */
-                || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* blocking */)
-                rc = VERR_INVALID_PARAMETER;
+            if (modeGet() != VBOX_DRAG_AND_DROP_MODE_OFF)
+            {
+                rc = VINF_SUCCESS;
+            }
             else
             {
-                rc = m_pManager->nextMessageInfo(&paParms[0].u.uint32, &paParms[1].u.uint32);
-                if (   RT_FAILURE(rc)
-                    && paParms[2].u.uint32) /* Blocking? */
-                {
-                    m_clientQueue.append(new HGCM::Client(u32ClientID, callHandle, u32Function, cParms, paParms));
-                    rc = VINF_HGCM_ASYNC_EXECUTE;
-                }
+                LogFlowFunc(("DnD disabled, deferring request\n"));
+                rc = VINF_HGCM_ASYNC_EXECUTE;
             }
             break;
         }
+
+        /* Note: New since protocol version 2. */
+        case DragAndDropSvc::GUEST_DND_CONNECT:
+            /* Fall through is intentional. */
         case DragAndDropSvc::GUEST_DND_HG_ACK_OP:
+        case DragAndDropSvc::GUEST_DND_HG_REQ_DATA:
+        case DragAndDropSvc::GUEST_DND_HG_EVT_PROGRESS:
         {
-            DO(("GUEST_DND_HG_ACK_OP\n"));
-            if (   modeGet() != VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL
-                && modeGet() != VBOX_DRAG_AND_DROP_MODE_HOST_TO_GUEST)
+            if (   modeGet() == VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL
+                || modeGet() == VBOX_DRAG_AND_DROP_MODE_HOST_TO_GUEST)
             {
-                DO(("=> ignoring!\n"));
-                break;
+                rc = VINF_SUCCESS;
             }
-
-            if (   cParms != 1
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* action */)
-                rc = VERR_INVALID_PARAMETER;
             else
+                LogFlowFunc(("Host -> Guest DnD mode disabled, ignoring request\n"));
+            break;
+        }
+
+        case DragAndDropSvc::GUEST_DND_GH_ACK_PENDING:
+        case DragAndDropSvc::GUEST_DND_GH_SND_DATA:
+        case DragAndDropSvc::GUEST_DND_GH_SND_DIR:
+        case DragAndDropSvc::GUEST_DND_GH_SND_FILE_HDR:
+        case DragAndDropSvc::GUEST_DND_GH_SND_FILE_DATA:
+        case DragAndDropSvc::GUEST_DND_GH_EVT_ERROR:
+        {
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+            if (   modeGet() == VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL
+                || modeGet() == VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST)
             {
-                DragAndDropSvc::VBOXDNDCBHGACKOPDATA data;
-                data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP;
-                paParms[0].getUInt32(&data.uAction);
-                if (m_pfnHostCallback)
-                    rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
-//                m_pHelpers->pfnCallComplete(callHandle, rc);
+                rc = VINF_SUCCESS;
             }
+            else
+#endif
+                LogFlowFunc(("Guest -> Host DnD mode disabled, ignoring request\n"));
             break;
         }
-        case DragAndDropSvc::GUEST_DND_HG_REQ_DATA:
+
+        default:
+            /* Reach through to DnD manager. */
+            rc = VINF_SUCCESS;
+            break;
+    }
+
+#ifdef DEBUG_andy
+    LogFlowFunc(("Mode (%RU32) check rc=%Rrc\n", modeGet(), rc));
+#endif
+
+#define DO_HOST_CALLBACK();                                                     \
+    if (   RT_SUCCESS(rc)                                                       \
+        && m_pfnHostCallback)                                                   \
+    {                                                                           \
+        rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data)); \
+    }
+
+    if (rc == VINF_SUCCESS) /* Note: rc might be VINF_HGCM_ASYNC_EXECUTE! */
+    {
+        DnDClientMap::iterator itClient =  m_clientMap.find(u32ClientID);
+        Assert(itClient != m_clientMap.end());
+
+        HGCM::Client *pClient = itClient->second;
+        AssertPtr(pClient);
+
+        switch (u32Function)
         {
-            DO(("GUEST_DND_HG_REQ_DATA\n"));
-            if (   modeGet() != VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL
-                && modeGet() != VBOX_DRAG_AND_DROP_MODE_HOST_TO_GUEST)
+            /*
+             * Note: Older VBox versions with enabled DnD guest->host support (< 5.0)
+             *       used the same message ID (300) for GUEST_DND_GET_NEXT_HOST_MSG and
+             *       HOST_DND_GH_REQ_PENDING, which led this service returning
+             *       VERR_INVALID_PARAMETER when the guest wanted to actually
+             *       handle HOST_DND_GH_REQ_PENDING.
+             */
+            case DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG:
             {
-                DO(("=> ignoring!\n"));
+                LogFlowFunc(("GUEST_DND_GET_NEXT_HOST_MSG\n"));
+                if (   cParms != 3
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* message */
+                    || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* parameter count */
+                    || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* blocking */)
+                {
+                    rc = VERR_INVALID_PARAMETER;
+                }
+                else
+                {
+                    rc = m_pManager->nextMessageInfo(&paParms[0].u.uint32 /* uMsg */, &paParms[1].u.uint32 /* cParms */);
+                    if (RT_FAILURE(rc)) /* No queued messages available? */
+                    {
+                        if (m_pfnHostCallback) /* Try asking the host. */
+                        {
+                            DragAndDropSvc::VBOXDNDCBHGGETNEXTHOSTMSG data;
+                            data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG;
+                            rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
+                            if (RT_SUCCESS(rc))
+                            {
+                                paParms[0].u.uint32 = data.uMsg;   /* uMsg */
+                                paParms[1].u.uint32 = data.cParms; /* cParms */
+                                /* Note: paParms[2] was set by the guest as blocking flag. */
+                            }
+                        }
+                        else
+                            rc = VERR_NOT_FOUND;
+
+                        if (RT_FAILURE(rc))
+                            rc = m_pManager->nextMessage(u32Function, cParms, paParms);
+
+                        /* Some error occurred? */
+                        if (   RT_FAILURE(rc)
+                            && paParms[2].u.uint32) /* Blocking flag set? */
+                        {
+                            /* Defer client returning. */
+                            rc = VINF_HGCM_ASYNC_EXECUTE;
+                        }
+                    }
+                }
                 break;
             }
-
-            if (   cParms != 1
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR /* format */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+            case DragAndDropSvc::GUEST_DND_CONNECT:
+            {
+                LogFlowFunc(("GUEST_DND_CONNECT\n"));
+                if (   cParms != 2
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* protocol version */
+                    || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* additional connection flags */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    uint32_t uProtocol;
+                    rc = paParms[0].getUInt32(&uProtocol); /* Get protocol version. */
+                    if (RT_SUCCESS(rc))
+                        rc = pClient->setProtocol(uProtocol);
+                    if (RT_SUCCESS(rc))
+                    {
+                        /** @todo Handle connection flags (paParms[1]). */
+                    }
+
+                    /* Note: Does not reach the host; the client's protocol version
+                     *       is only kept in this service. */
+                }
+                break;
+            }
+            case DragAndDropSvc::GUEST_DND_HG_ACK_OP:
             {
-                DragAndDropSvc::VBOXDNDCBHGREQDATADATA data;
-                data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_REQ_DATA;
-                uint32_t cTmp;
-                paParms[0].getPointer((void**)&data.pszFormat, &cTmp);
-                if (m_pfnHostCallback)
-                    rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
-//                m_pHelpers->pfnCallComplete(callHandle, rc);
-//                if (data.pszFormat)
-//                    RTMemFree(data.pszFormat);
-//                if (data.pszTmpPath)
-//                    RTMemFree(data.pszTmpPath);
+                LogFlowFunc(("GUEST_DND_HG_ACK_OP\n"));
+                if (   cParms != 1
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* action */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    DragAndDropSvc::VBOXDNDCBHGACKOPDATA data;
+                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP;
+                    rc = paParms[0].getUInt32(&data.uAction); /* Get drop action. */
+                    DO_HOST_CALLBACK();
+                }
+                break;
             }
-            break;
-        }
-#ifdef VBOX_WITH_DRAG_AND_DROP_GH
-        case DragAndDropSvc::GUEST_DND_GH_ACK_PENDING:
-        {
-            DO(("GUEST_DND_GH_ACK_PENDING\n"));
-            if (   modeGet() != VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL
-                && modeGet() != VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST)
+            case DragAndDropSvc::GUEST_DND_HG_REQ_DATA:
             {
-                DO(("=> ignoring!\n"));
+                LogFlowFunc(("GUEST_DND_HG_REQ_DATA\n"));
+                if (   cParms != 1
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR /* format */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    DragAndDropSvc::VBOXDNDCBHGREQDATADATA data;
+                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_REQ_DATA;
+                    rc = paParms[0].getPointer((void**)&data.pszFormat, &data.cbFormat);
+                    DO_HOST_CALLBACK();
+                }
                 break;
             }
-
-            if (   cParms != 3
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* defaction */
-                || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* allactions */
-                || paParms[2].type != VBOX_HGCM_SVC_PARM_PTR   /* format */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+            case DragAndDropSvc::GUEST_DND_HG_EVT_PROGRESS:
             {
-                DragAndDropSvc::VBOXDNDCBGHACKPENDINGDATA data;
-                data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_ACK_PENDING;
-                paParms[0].getUInt32(&data.uDefAction);
-                paParms[1].getUInt32(&data.uAllActions);
-                uint32_t cTmp;
-                paParms[2].getPointer((void**)&data.pszFormat, &cTmp);
-                if (m_pfnHostCallback)
-                    rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
+                LogFlowFunc(("GUEST_DND_HG_EVT_PROGRESS\n"));
+                if (   cParms != 3
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* status */
+                    || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* percent */
+                    || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* rc */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    DragAndDropSvc::VBOXDNDCBHGEVTPROGRESSDATA data;
+                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_EVT_PROGRESS;
+                    rc = paParms[0].getUInt32(&data.uStatus);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[1].getUInt32(&data.uPercentage);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[2].getUInt32(&data.rc);
+                    DO_HOST_CALLBACK();
+                }
+                break;
             }
-            break;
-        }
-        case DragAndDropSvc::GUEST_DND_GH_SND_DATA:
-        {
-            DO(("GUEST_DND_GH_SND_DATA\n"));
-            if (   modeGet() != VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL
-                && modeGet() != VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST)
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+            case DragAndDropSvc::GUEST_DND_GH_ACK_PENDING:
             {
-                DO(("=> ignoring\n"));
+                LogFlowFunc(("GUEST_DND_GH_ACK_PENDING\n"));
+                if (   cParms != 3
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* defaction */
+                    || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* alloctions */
+                    || paParms[2].type != VBOX_HGCM_SVC_PARM_PTR   /* format */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    DragAndDropSvc::VBOXDNDCBGHACKPENDINGDATA data;
+                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_ACK_PENDING;
+                    rc = paParms[0].getUInt32(&data.uDefAction);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[1].getUInt32(&data.uAllActions);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[2].getPointer((void**)&data.pszFormat, &data.cbFormat);
+                    DO_HOST_CALLBACK();
+                }
                 break;
             }
-
-            if (   cParms != 2
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR   /* data */
-                || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* size */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+            case DragAndDropSvc::GUEST_DND_GH_SND_DATA:
             {
-                DragAndDropSvc::VBOXDNDCBSNDDATADATA data;
-                data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_SND_DATA;
-                paParms[0].getPointer((void**)&data.pvData, &data.cbData);
-                paParms[1].getUInt32(&data.cbAllSize);
-                if (m_pfnHostCallback)
-                    rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
+                LogFlowFunc(("GUEST_DND_GH_SND_DATA\n"));
+                if (   cParms != 2
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR   /* data */
+                    || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* size */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    DragAndDropSvc::VBOXDNDCBSNDDATADATA data;
+                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_SND_DATA;
+                    rc = paParms[0].getPointer((void**)&data.pvData, &data.cbData);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[1].getUInt32(&data.cbTotalSize);
+                    DO_HOST_CALLBACK();
+                }
+                break;
             }
-            break;
-        }
-        case DragAndDropSvc::GUEST_DND_GH_EVT_ERROR:
-        {
-            DO(("GUEST_DND_GH_EVT_ERROR\n"));
-            if (   modeGet() != VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL
-                && modeGet() != VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST)
+            case DragAndDropSvc::GUEST_DND_GH_SND_DIR:
             {
-                DO(("=> ignoring!\n"));
+                LogFlowFunc(("GUEST_DND_GH_SND_DIR\n"));
+                if (   cParms != 3
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR   /* path */
+                    || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* path length */
+                    || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* creation mode */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    DragAndDropSvc::VBOXDNDCBSNDDIRDATA data;
+                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_SND_DIR;
+                    uint32_t cTmp;
+                    rc = paParms[0].getPointer((void**)&data.pszPath, &cTmp);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[1].getUInt32(&data.cbPath);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[2].getUInt32(&data.fMode);
+
+                    LogFlowFunc(("pszPath=%s, cbPath=%RU32, fMode=0x%x\n", data.pszPath, data.cbPath, data.fMode));
+                    DO_HOST_CALLBACK();
+                }
+                break;
+            }
+            /* Note: Since protocol v2 (>= VBox 5.0). */
+            case DragAndDropSvc::GUEST_DND_GH_SND_FILE_HDR:
+            {
+                LogFlowFunc(("GUEST_DND_GH_SND_FILE_HDR\n"));
+                if (   cParms != 6
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* context ID */
+                    || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR   /* file path */
+                    || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* file path length  */
+                    || paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT /* flags */
+                    || paParms[4].type != VBOX_HGCM_SVC_PARM_32BIT /* file mode */
+                    || paParms[5].type != VBOX_HGCM_SVC_PARM_64BIT /* file size */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    DragAndDropSvc::VBOXDNDCBSNDFILEHDRDATA data;
+                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_SND_FILE_HDR;
+                    uint32_t cTmp;
+                    /* paParms[0] is context ID; unused yet. */
+                    rc = paParms[1].getPointer((void**)&data.pszFilePath, &cTmp);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[2].getUInt32(&data.cbFilePath);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[3].getUInt32(&data.fFlags);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[4].getUInt32(&data.fMode);
+                    if (RT_SUCCESS(rc))
+                        rc = paParms[5].getUInt64(&data.cbSize);
+
+                    LogFlowFunc(("pszPath=%s, cbPath=%RU32, fMode=0x%x, cbSize=%RU64\n",
+                                 data.pszFilePath, data.cbFilePath, data.fMode, data.cbSize));
+                    DO_HOST_CALLBACK();
+                }
                 break;
             }
+            case DragAndDropSvc::GUEST_DND_GH_SND_FILE_DATA:
+            {
+                LogFlowFunc(("GUEST_DND_GH_SND_FILE_DATA\n"));
 
-            if (   cParms != 1
-                || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* rc */)
-                rc = VERR_INVALID_PARAMETER;
-            else
+                switch (pClient->protocol())
+                {
+                    case 2: /* Protocol version 2 only sends the next data chunks to reduce traffic. */
+                    {
+                        if (   cParms != 3
+                            /* paParms[0] is context ID; unused yet. */
+                            || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR   /* file data */
+                            || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* file data length */)
+                        {
+                            rc = VERR_INVALID_PARAMETER;
+                        }
+                        else
+                        {
+                            DragAndDropSvc::VBOXDNDCBSNDFILEDATADATA data;
+                            data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_SND_FILE_DATA;
+                            /* paParms[0] is context ID; unused yet. */
+                            rc = paParms[1].getPointer((void**)&data.pvData, &data.cbData);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getUInt32(&data.cbData);
+
+                            LogFlowFunc(("cbData=%RU32, pvData=0x%p\n", data.cbData, data.pvData));
+                            DO_HOST_CALLBACK();
+                        }
+                        break;
+                    }
+                    default:
+                    {
+                        if (   cParms != 5
+                            || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR   /* file path */
+                            || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* file path length */
+                            || paParms[2].type != VBOX_HGCM_SVC_PARM_PTR   /* file data */
+                            || paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT /* file data length */
+                            || paParms[4].type != VBOX_HGCM_SVC_PARM_32BIT /* creation mode */)
+                        {
+                            rc = VERR_INVALID_PARAMETER;
+                        }
+                        else
+                        {
+                            DragAndDropSvc::VBOXDNDCBSNDFILEDATADATA data;
+                            data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_SND_FILE_DATA;
+                            uint32_t cTmp;
+                            rc = paParms[0].getPointer((void**)&data.u.v1.pszFilePath, &cTmp);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[1].getUInt32(&data.u.v1.cbFilePath);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[2].getPointer((void**)&data.pvData, &cTmp);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[3].getUInt32(&data.cbData);
+                            if (RT_SUCCESS(rc))
+                                rc = paParms[4].getUInt32(&data.u.v1.fMode);
+
+                            LogFlowFunc(("pszFilePath=%s, cbData=%RU32, pvData=0x%p, fMode=0x%x\n",
+                                         data.u.v1.pszFilePath, data.cbData, data.pvData, data.u.v1.fMode));
+                            DO_HOST_CALLBACK();
+                        }
+                        break;
+                    }
+                }
+                break;
+            }
+            case DragAndDropSvc::GUEST_DND_GH_EVT_ERROR:
             {
-                DragAndDropSvc::VBOXDNDCBEVTERRORDATA data;
-                data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_EVT_ERROR;
-                uint32_t rcOp;
-                paParms[0].getUInt32(&rcOp);
-                data.rc = rcOp;
-                if (m_pfnHostCallback)
-                    rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
+                LogFlowFunc(("GUEST_DND_GH_EVT_ERROR\n"));
+                if (   cParms != 1
+                    || paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* rc */)
+                    rc = VERR_INVALID_PARAMETER;
+                else
+                {
+                    DragAndDropSvc::VBOXDNDCBEVTERRORDATA data;
+                    data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_GH_EVT_ERROR;
+
+                    uint32_t rcOp;
+                    rc = paParms[0].getUInt32(&rcOp);
+                    if (RT_SUCCESS(rc))
+                        data.rc = rcOp;
+
+                    DO_HOST_CALLBACK();
+                }
+                break;
             }
-            break;
-        }
-#endif
-        default:
-        {
-            /* All other messages are handled by the DnD manager. */
-            rc = m_pManager->nextMessage(u32Function, cParms, paParms);
-            /* Check for error. Buffer overflow is allowed. It signals the
-             * guest to ask for more data in the next event. */
-            if (   RT_FAILURE(rc)
-                && rc != VERR_CANCELLED
-                && rc != VERR_BUFFER_OVERFLOW) /* Buffer overflow is allowed. */
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
+            default:
             {
-                m_clientQueue.append(new HGCM::Client(u32ClientID, callHandle, u32Function, cParms, paParms));
-                rc = VINF_HGCM_ASYNC_EXECUTE;
+                /* All other messages are handled by the DnD manager. */
+                rc = m_pManager->nextMessage(u32Function, cParms, paParms);
+                if (rc == VERR_NO_DATA) /* Manager has no new messsages? Try asking the host. */
+                {
+                    if (m_pfnHostCallback)
+                    {
+                        DragAndDropSvc::VBOXDNDCBHGGETNEXTHOSTMSGDATA data;
+                        data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG_DATA;
+                        data.uMsg    = u32Function;
+                        data.cParms  = cParms;
+                        data.paParms = paParms;
+
+                        rc = m_pfnHostCallback(m_pvHostData, u32Function, &data, sizeof(data));
+                        if (RT_SUCCESS(rc))
+                        {
+                            cParms  = data.cParms;
+                            paParms = data.paParms;
+                        }
+                    }
+                }
+                break;
             }
-            break;
         }
     }
-    /* If async execute is requested, we didn't notify the guest about
+
+    /*
+     * If async execution is requested, we didn't notify the guest yet about
      * completion. The client is queued into the waiters list and will be
-     * notified as soon as a new event is available. */
-    if (rc != VINF_HGCM_ASYNC_EXECUTE)
-        m_pHelpers->pfnCallComplete(callHandle, rc);
-    DO(("guest call: %Rrc\n", rc));
-}
+     * notified as soon as a new event is available.
+     */
+    if (rc == VINF_HGCM_ASYNC_EXECUTE)
+    {
+        m_clientQueue.append(new HGCM::Client(u32ClientID, callHandle,
+                                              u32Function, cParms, paParms));
+    }
 
-int DragAndDropService::hostMessage(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
-{
-    int rc = VINF_SUCCESS;
-#if 0
-    HGCM::Message *pMessage = new HGCM::Message(u32Function, cParms, paParms);
-    m_hostQueue.push(pMessage);
-//    bool fPush = true;
-    RTPrintf("client queue %u\n", m_clientQueue.size());
-    RTPrintf("host   queue %u\n", m_hostQueue.size());
-    if (!m_clientQueue.empty())
+    if (   rc != VINF_HGCM_ASYNC_EXECUTE
+        && m_pHelpers)
     {
-        pMessage = m_hostQueue.front();
-        HGCM::Client *pClient = m_clientQueue.front();
-        /* Check if this was a request for getting the next host
-         * message. If so, return the message id and the parameter
-         * count. The message itself has to be queued. */
-        if (pClient->message() == DragAndDropSvc::GUEST_GET_NEXT_HOST_MSG)
-        {
-            RTPrintf("client is waiting for next host msg\n");
-//            rc = VERR_TOO_MUCH_DATA;
-            pClient->addMessageInfo(pMessage);
-            /* temp */
-//        m_pHelpers->pfnCallComplete(pClient->handle(), rc);
-//        m_clientQueue.pop();
-//        delete pClient;
-        }
-        else
-        {
-            RTPrintf("client is waiting for host msg (%d)\n", u32Function);
-            /* There is a request for a host message pending. Check
-             * if this is the correct message and if so deliver. If
-             * not the message will be queued. */
-            rc = pClient->addMessage(pMessage);
-            m_hostQueue.pop();
-            delete pMessage;
-//            if (RT_SUCCESS(rc))
-//                fPush = false;
-        }
-        /* In any case mark this client request as done. */
-        m_pHelpers->pfnCallComplete(pClient->handle(), rc);
-        m_clientQueue.pop_front();
-        delete pClient;
+        m_pHelpers->pfnCallComplete(callHandle, rc);
     }
-//    if (fPush)
-//    {
-//        RTPrintf("push message\n");
-//        m_hostQueue.push(pMessage);
-//    }
-//    else
-//        delete pMessage;
-#endif
 
-    return rc;
+    LogFlowFunc(("Returning rc=%Rrc\n", rc));
 }
 
-int DragAndDropService::hostCall(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
+int DragAndDropService::hostCall(uint32_t u32Function,
+                                 uint32_t cParms, VBOXHGCMSVCPARM paParms[])
 {
-    int rc = VINF_SUCCESS;
+    LogFlowFunc(("u32Function=%RU32, cParms=%RU32, cClients=%zu, cQueue=%zu\n",
+                 u32Function, cParms, m_clientMap.size(), m_clientQueue.size()));
+
+    int rc;
     if (u32Function == DragAndDropSvc::HOST_DND_SET_MODE)
     {
         if (cParms != 1)
@@ -422,61 +705,102 @@ int DragAndDropService::hostCall(uint32_t u32Function, uint32_t cParms, VBOXHGCM
         else if (paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT)
             rc = VERR_INVALID_PARAMETER;
         else
-            modeSet(paParms[0].u.uint32);
+            rc = modeSet(paParms[0].u.uint32);
     }
     else if (modeGet() != VBOX_DRAG_AND_DROP_MODE_OFF)
     {
-        rc = m_pManager->addMessage(u32Function, cParms, paParms);
-        if (    RT_SUCCESS(rc)
-            && !m_clientQueue.isEmpty())
+        if (m_clientMap.size()) /* At least one client on the guest connected? */
         {
-            HGCM::Client *pClient = m_clientQueue.first();
-            /* Check if this was a request for getting the next host
-             * message. If so, return the message id and the parameter
-             * count. The message itself has to be queued. */
-            if (pClient->message() == DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG)
+            rc = m_pManager->addMessage(u32Function, cParms, paParms, true /* fAppend */);
+            if (RT_SUCCESS(rc))
             {
-                DO(("client is waiting for next host msg\n"));
-//              rc = m_pManager->nextMessageInfo(&paParms[0].u.uint32, &paParms[1].u.uint32);
-                uint32_t uMsg1;
-                uint32_t cParms1;
-                rc = m_pManager->nextMessageInfo(&uMsg1, &cParms1);
-                if (RT_SUCCESS(rc))
+                if (m_clientQueue.size()) /* Any clients in our queue ready for processing the next command? */
                 {
-                    pClient->addMessageInfo(uMsg1, cParms1);
-                    m_pHelpers->pfnCallComplete(pClient->handle(), rc);
-                    m_clientQueue.removeFirst();
-                    delete pClient;
+                    HGCM::Client *pClient = m_clientQueue.first();
+                    AssertPtr(pClient);
+
+                    /*
+                     * Check if this was a request for getting the next host
+                     * message. If so, return the message ID and the parameter
+                     * count. The message itself has to be queued.
+                     */
+                    uint32_t uMsg = pClient->message();
+                    if (uMsg == DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG)
+                    {
+                        LogFlowFunc(("Client %RU32 is waiting for next host msg\n", pClient->clientId()));
+
+                        uint32_t uMsg1;
+                        uint32_t cParms1;
+                        rc = m_pManager->nextMessageInfo(&uMsg1, &cParms1);
+                        if (RT_SUCCESS(rc))
+                        {
+                            pClient->addMessageInfo(uMsg1, cParms1);
+                            if (   m_pHelpers
+                                && m_pHelpers->pfnCallComplete)
+                            {
+                                m_pHelpers->pfnCallComplete(pClient->handle(), rc);
+                            }
+
+                            m_clientQueue.removeFirst();
+
+                            delete pClient;
+                            pClient = NULL;
+                        }
+                        else
+                            AssertMsgFailed(("m_pManager::nextMessageInfo failed with rc=%Rrc\n", rc));
+                    }
+                    else
+                        AssertMsgFailed(("Client ID=%RU32 in wrong state with uMsg=%RU32\n",
+                                         pClient->clientId(), uMsg));
                 }
                 else
-                    AssertMsgFailed(("Should not happen!"));
+                    LogFlowFunc(("All clients busy; delaying execution\n"));
             }
             else
-                AssertMsgFailed(("Should not happen!"));
+                AssertMsgFailed(("Adding new message of type=%RU32 failed with rc=%Rrc\n",
+                                 u32Function, rc));
+        }
+        else
+        {
+            /*
+             * Tell the host that the guest does not support drag'n drop.
+             * This might happen due to not installed Guest Additions or
+             * not running VBoxTray/VBoxClient.
+             */
+            rc = VERR_NOT_SUPPORTED;
         }
-//      else
-//          AssertMsgFailed(("Should not happen %Rrc!", rc));
+    }
+    else
+    {
+        /* Tell the host that a wrong drag'n drop mode is set. */
+        rc = VERR_ACCESS_DENIED;
     }
 
-    LogFlowFunc(("rc=%Rrc\n", rc));
+    LogFlowFuncLeaveRC(rc);
     return rc;
 }
 
-DECLCALLBACK(int) DragAndDropService::progressCallback(unsigned uPercentage, uint32_t uState, void *pvUser)
+DECLCALLBACK(int) DragAndDropService::progressCallback(uint32_t uStatus, uint32_t uPercentage, int rc, void *pvUser)
 {
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
 
     DragAndDropService *pSelf = static_cast<DragAndDropService *>(pvUser);
+    AssertPtr(pSelf);
 
     if (pSelf->m_pfnHostCallback)
     {
-        DO(("GUEST_DND_HG_EVT_PROGRESS %u\n", uPercentage));
+        LogFlowFunc(("GUEST_DND_HG_EVT_PROGRESS: uStatus=%RU32, uPercentage=%RU32, rc=%Rrc\n",
+                     uStatus, uPercentage, rc));
+
         DragAndDropSvc::VBOXDNDCBHGEVTPROGRESSDATA data;
         data.hdr.u32Magic = DragAndDropSvc::CB_MAGIC_DND_HG_EVT_PROGRESS;
-        data.uPercentage  = uPercentage;
-        data.uState       = uState;
+        data.uPercentage  = RT_MIN(uPercentage, 100);
+        data.uStatus      = uStatus;
+        data.rc           = rc; /** @todo uin32_t vs. int. */
 
-        return pSelf->m_pfnHostCallback(pSelf->m_pvHostData, DragAndDropSvc::GUEST_DND_HG_EVT_PROGRESS, &data, sizeof(data));
+        return pSelf->m_pfnHostCallback(pSelf->m_pvHostData,
+                                        DragAndDropSvc::GUEST_DND_HG_EVT_PROGRESS,
+                                        &data, sizeof(data));
     }
 
     return VINF_SUCCESS;
diff --git a/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.rc b/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.rc
index 5940905..773d88e 100644
--- a/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.rc
+++ b/src/VBox/HostServices/GuestControl/VBoxGuestControlSvc.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Guest Control Host Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxGuestControl\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxGuestControl.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/GuestControl/service.cpp b/src/VBox/HostServices/GuestControl/service.cpp
index bbfd8ce..0569be7 100644
--- a/src/VBox/HostServices/GuestControl/service.cpp
+++ b/src/VBox/HostServices/GuestControl/service.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2013 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -921,7 +921,7 @@ public:
      * @copydoc VBOXHGCMSVCHELPERS::pfnUnload
      * Simply deletes the service object
      */
-    static DECLCALLBACK(int) svcUnload (void *pvService)
+    static DECLCALLBACK(int) svcUnload(void *pvService)
     {
         AssertLogRelReturn(VALID_PTR(pvService), VERR_INVALID_PARAMETER);
         SELF *pSelf = reinterpret_cast<SELF *>(pvService);
@@ -936,9 +936,9 @@ public:
      * @copydoc VBOXHGCMSVCHELPERS::pfnConnect
      * Stub implementation of pfnConnect and pfnDisconnect.
      */
-    static DECLCALLBACK(int) svcConnect (void *pvService,
-                                         uint32_t u32ClientID,
-                                         void *pvClient)
+    static DECLCALLBACK(int) svcConnect(void *pvService,
+                                        uint32_t u32ClientID,
+                                        void *pvClient)
     {
         AssertLogRelReturn(VALID_PTR(pvService), VERR_INVALID_PARAMETER);
         SELF *pSelf = reinterpret_cast<SELF *>(pvService);
@@ -950,9 +950,9 @@ public:
      * @copydoc VBOXHGCMSVCHELPERS::pfnConnect
      * Stub implementation of pfnConnect and pfnDisconnect.
      */
-    static DECLCALLBACK(int) svcDisconnect (void *pvService,
-                                            uint32_t u32ClientID,
-                                            void *pvClient)
+    static DECLCALLBACK(int) svcDisconnect(void *pvService,
+                                           uint32_t u32ClientID,
+                                           void *pvClient)
     {
         AssertLogRelReturn(VALID_PTR(pvService), VERR_INVALID_PARAMETER);
         SELF *pSelf = reinterpret_cast<SELF *>(pvService);
@@ -964,13 +964,13 @@ public:
      * @copydoc VBOXHGCMSVCHELPERS::pfnCall
      * Wraps to the call member function
      */
-    static DECLCALLBACK(void) svcCall (void * pvService,
-                                       VBOXHGCMCALLHANDLE callHandle,
-                                       uint32_t u32ClientID,
-                                       void *pvClient,
-                                       uint32_t u32Function,
-                                       uint32_t cParms,
-                                       VBOXHGCMSVCPARM paParms[])
+    static DECLCALLBACK(void) svcCall(void * pvService,
+                                      VBOXHGCMCALLHANDLE callHandle,
+                                      uint32_t u32ClientID,
+                                      void *pvClient,
+                                      uint32_t u32Function,
+                                      uint32_t cParms,
+                                      VBOXHGCMSVCPARM paParms[])
     {
         AssertLogRelReturnVoid(VALID_PTR(pvService));
         SELF *pSelf = reinterpret_cast<SELF *>(pvService);
@@ -982,10 +982,10 @@ public:
      * @copydoc VBOXHGCMSVCHELPERS::pfnHostCall
      * Wraps to the hostCall member function
      */
-    static DECLCALLBACK(int) svcHostCall (void *pvService,
-                                          uint32_t u32Function,
-                                          uint32_t cParms,
-                                          VBOXHGCMSVCPARM paParms[])
+    static DECLCALLBACK(int) svcHostCall(void *pvService,
+                                         uint32_t u32Function,
+                                         uint32_t cParms,
+                                         VBOXHGCMSVCPARM paParms[])
     {
         AssertLogRelReturn(VALID_PTR(pvService), VERR_INVALID_PARAMETER);
         SELF *pSelf = reinterpret_cast<SELF *>(pvService);
@@ -997,9 +997,9 @@ public:
      * @copydoc VBOXHGCMSVCHELPERS::pfnRegisterExtension
      * Installs a host callback for notifications of property changes.
      */
-    static DECLCALLBACK(int) svcRegisterExtension (void *pvService,
-                                                   PFNHGCMSVCEXT pfnExtension,
-                                                   void *pvExtension)
+    static DECLCALLBACK(int) svcRegisterExtension(void *pvService,
+                                                  PFNHGCMSVCEXT pfnExtension,
+                                                  void *pvExtension)
     {
         AssertLogRelReturn(VALID_PTR(pvService), VERR_INVALID_PARAMETER);
         SELF *pSelf = reinterpret_cast<SELF *>(pvService);
@@ -1074,7 +1074,7 @@ int Service::clientDisconnect(uint32_t u32ClientID, void *pvClient)
 
     ClientStateMapIter itClientState = mClientStateMap.find(u32ClientID);
     AssertMsg(itClientState != mClientStateMap.end(),
-              ("Clients ID=%RU32 not found in client list when it should be there\n", u32ClientID));
+              ("Client ID=%RU32 not found in client list when it should be there\n", u32ClientID));
 
     if (itClientState != mClientStateMap.end())
     {
@@ -1145,7 +1145,13 @@ int Service::clientGetCommand(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandl
     AssertMsg(itClientState != mClientStateMap.end(), ("Client with ID=%RU32 not found when it should be present\n",
                                                        u32ClientID));
     if (itClientState == mClientStateMap.end())
-        return VERR_NOT_FOUND; /* Should never happen. */
+    {
+        /* Should never happen. Complete the call on the guest side though. */
+        AssertPtr(mpHelpers);
+        mpHelpers->pfnCallComplete(callHandle, VERR_NOT_FOUND);
+
+        return VERR_NOT_FOUND;
+    }
 
     ClientState &clientState = itClientState->second;
 
@@ -1570,7 +1576,7 @@ int Service::sessionClose(uint32_t u32ClientID, VBOXHGCMCALLHANDLE callHandle, u
     return rc;
 }
 
-int Service::uninit()
+int Service::uninit(void)
 {
     return VINF_SUCCESS;
 }
diff --git a/src/VBox/HostServices/GuestProperties/VBoxGuestPropSvc.rc b/src/VBox/HostServices/GuestProperties/VBoxGuestPropSvc.rc
index 413891f..cb4cc3e 100644
--- a/src/VBox/HostServices/GuestProperties/VBoxGuestPropSvc.rc
+++ b/src/VBox/HostServices/GuestProperties/VBoxGuestPropSvc.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Guest Properties Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxGuestPropSvc\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxGuestPropSvc.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/HostChannel/VBoxHostChannel.rc b/src/VBox/HostServices/HostChannel/VBoxHostChannel.rc
index 766c2cb..339ddbc 100644
--- a/src/VBox/HostServices/HostChannel/VBoxHostChannel.rc
+++ b/src/VBox/HostServices/HostChannel/VBoxHostChannel.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Host Channel Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxHostChannel\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxHostChannel.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboard.rc b/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboard.rc
index 7b46928..c47862b 100644
--- a/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboard.rc
+++ b/src/VBox/HostServices/SharedClipboard/VBoxSharedClipboard.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Shared Clipboard Host Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxSharedClipboard\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxSharedClipboard.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/SharedClipboard/service.cpp b/src/VBox/HostServices/SharedClipboard/service.cpp
index f4c5d6f..75152b9 100644
--- a/src/VBox/HostServices/SharedClipboard/service.cpp
+++ b/src/VBox/HostServices/SharedClipboard/service.cpp
@@ -764,7 +764,7 @@ static SSMFIELD const g_aClipboardClientDataFields[] =
 static DECLCALLBACK(int) svcSaveState(void *, uint32_t u32ClientID, void *pvClient, PSSMHANDLE pSSM)
 {
 #ifndef UNIT_TEST
-    /* 
+    /*
      * When the state will be restored, pending requests will be reissued
      * by VMMDev. The service therefore must save state as if there were no
      * pending request.
diff --git a/src/VBox/HostServices/SharedFolders/VBoxSharedFolders.rc b/src/VBox/HostServices/SharedFolders/VBoxSharedFolders.rc
index f9b9621..2cccf78 100644
--- a/src/VBox/HostServices/SharedFolders/VBoxSharedFolders.rc
+++ b/src/VBox/HostServices/SharedFolders/VBoxSharedFolders.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Shared Folders Host Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxSharedFolders\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxSharedFolders.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp b/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
index 1215090..760bb82 100644
--- a/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
+++ b/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp
@@ -512,6 +512,7 @@ static SHFLROOT initWithWritableMapping(RTTEST hTest,
     AssertReleaseRC(VBoxHGCMSvcLoad(psvcTable));
     AssertRelease(  psvcTable->pvService
                   = RTTestGuardedAllocTail(hTest, psvcTable->cbClient));
+    RT_BZERO(psvcTable->pvService, psvcTable->cbClient);
     fillTestShflString(&FolderName, pcszFolderName);
     fillTestShflString(&Mapping, pcszMapping);
     aParms[0].setPointer(&FolderName,   RT_UOFFSETOF(SHFLSTRING, String)
diff --git a/src/VBox/HostServices/SharedOpenGL/Makefile.kmk b/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
index 24ad8c1..f237f6c 100644
--- a/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
+++ b/src/VBox/HostServices/SharedOpenGL/Makefile.kmk
@@ -30,6 +30,15 @@ BLDDIRS   += \
 endif
 
 ifeq ($(KBUILD_TARGET),darwin)
+ #VBOX_WITH_CR_DISPLAY_LISTS=1
+endif
+
+ifdef VBOX_WITH_CR_DISPLAY_LISTS
+ LIBRARIES += VBoxOGLcrdlm
+ DLLS      += VBoxOGLexpandospu
+endif # VBOX_WITH_CR_DISPLAY_LISTS
+
+ifeq ($(KBUILD_TARGET),darwin)
  #
  # We have to symlink the system headers of OpenGl cause they have some
  # different directory hierarchy on Mac OS X (no /GL sub directory).
@@ -49,7 +58,7 @@ endif # darwin
 VBoxSharedCrOpenGL_TEMPLATE = VBOXCROGLR3HOSTDLL
 ifdef VBOX_WITH_XPCOM
  VBoxSharedCrOpenGL_DEFS = VBOX_WITH_XPCOM
- VBoxSharedCrOpenGL_CXXFLAGS = -Wno-non-virtual-dtor
+ VBoxSharedCrOpenGL_CXXFLAGS = -Wno-non-virtual-dtor -fshort-wchar $(VBOX_GCC_std)
 endif
 VBoxSharedCrOpenGL_INTERMEDIATES = \
 	$(TEMPLATE_VBOXMAINEXE_INTERMEDIATES)
@@ -92,6 +101,9 @@ endif
 ifdef VBOX_WITH_CRHGSMI
 VBoxSharedCrOpenGL_DEFS += VBOX_WITH_CRHGSMI
 endif
+ifdef VBOX_WITH_CR_DISPLAY_LISTS
+VBoxSharedCrOpenGL_LIBS += $(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB)
+endif
 
 #
 # VBoxOGLcrserverlib
@@ -136,7 +148,13 @@ VBoxOGLcrserverlib_SOURCES := \
 	crserverlib/server_glsl.c \
 	crserverlib/server_muralfbo.cpp \
 	crserverlib/server_texture.c \
-	crserverlib/server_presenter.cpp \
+	crserverlib/presenter/server_presenter.cpp \
+	crserverlib/presenter/display_base.cpp \
+	crserverlib/presenter/display_composite.cpp \
+	crserverlib/presenter/window.cpp \
+	crserverlib/presenter/display_window.cpp \
+	crserverlib/presenter/display_window_rootvr.cpp \
+	crserverlib/presenter/display_vrdp.cpp \
 	crserverlib/server_rpw.cpp \
 	$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.c \
 	$(VBOX_PATH_CROGL_GENFILES)/server_retval.c \
@@ -148,6 +166,9 @@ VBoxOGLcrserverlib_CLEAN = \
 	$(VBOX_PATH_CROGL_GENFILES)/server_get.c \
 	$(VBOX_PATH_CROGL_GENFILES)/server_simpleget.c \
 	$(VBOX_PATH_CROGL_GENFILES)/server_dispatch.h
+ifdef VBOX_WITH_CR_DISPLAY_LISTS
+VBoxOGLcrserverlib_DEFS += VBOX_WITH_CR_DISPLAY_LISTS
+endif
 ifdef VBOXCR_LOGFPS
 VBoxOGLcrserverlib_DEFS += VBOXCR_LOGFPS
 endif
@@ -248,6 +269,94 @@ $(VBOX_PATH_CROGL_GENFILES)/unpack_extend.h: \
 	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D)
 
 
+ifdef VBOX_WITH_CR_DISPLAY_LISTS
+#
+# VBoxOGLcrdlm
+#
+
+VBoxOGLcrdlm_TEMPLATE       = VBOXCROGLR3HOSTLIB
+VBoxOGLcrdlm_INCS           = \
+	dlm
+VBoxOGLcrdlm_INTERMEDIATES  = \
+	$(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
+	$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h
+
+VBoxOGLcrdlm_SOURCES  = \
+	dlm/dlm.c \
+	dlm/dlm_arrays.c \
+	dlm/dlm_bbox.c \
+	dlm/dlm_calllist.c \
+	dlm/dlm_checklist.c \
+	dlm/dlm_error.c \
+	dlm/dlm_lists.c \
+	dlm/dlm_pointers.c \
+	$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c
+
+VBoxOGLcrdlm_CLEAN = \
+	$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c \
+	$(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
+	$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h
+#
+# Generate files for VBoxOGLcrdlm.
+#
+$(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h: \
+		$(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_header.py) \
+		$(VBOX_CROGL_API_FILES) \
+		| $$(dir $$@)
+	$(call MSG_GENERATE,python,$@,$<)
+	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< header $(VBOX_PATH_CROGL_GLAPI) > $@
+
+$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h: \
+		$(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_generated.py dlm_special) \
+		$(VBOX_PATH_CROGL_GENFILES)/cr_dlm.h \
+		$(VBOX_CROGL_API_FILES) \
+		| $$(dir $$@)
+	$(call MSG_GENERATE,python,$@,$<)
+	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< headers $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@
+
+$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.c: \
+		$(addprefix $(PATH_SUB_CURRENT)/dlm/, dlm_generated.py dlm_special) \
+		$(VBOX_PATH_CROGL_GENFILES)/dlm_generated.h \
+		$(VBOX_CROGL_API_FILES) \
+		| $$(dir $$@)
+	$(call MSG_GENERATE,python,$@,$<)
+	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< source $(<D) $(VBOX_PATH_CROGL_GLAPI) > $@
+
+
+#
+# VBoxOGLexpandospu
+#
+VBoxOGLexpandospu_TEMPLATE       = VBOXCROGLR3HOSTDLL
+VBoxOGLexpandospu_INCS           = \
+	expando
+VBoxOGLexpandospu_SOURCES  = \
+	expando/expandospu.c \
+	expando/expandospu_config.c \
+	expando/expandospu_init.c \
+	$(VBOX_PATH_CROGL_GENFILES)/expando.c
+VBoxOGLexpandospu_CLEAN = \
+	$(VBOX_PATH_CROGL_GENFILES)/expando.c
+VBoxOGLexpandospu_CLEAN = \
+	$(VBOX_PATH_CROGL_GENFILES)/expando.c
+VBoxOGLexpandospu_LDFLAGS.darwin += -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxOGLexpandospu.dylib
+VBoxOGLexpandospu_LIBS = \
+	$(PATH_STAGE_LIB)/VBoxOGLcrdlm$(VBOX_SUFF_LIB) \
+	$(PATH_STAGE_LIB)/VBoxOGLhostcrstate$(VBOX_SUFF_LIB) \
+	$(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \
+	$(VBOX_LIB_OGL_HOSTCRUTIL) \
+	$(LIB_RUNTIME)
+#
+# Generate files for VBoxOGLexpandospu.
+#
+$(VBOX_PATH_CROGL_GENFILES)/expando.c: \
+		$(addprefix $(PATH_SUB_CURRENT)/expando/, expando.py expando_special) \
+		$(VBOX_CROGL_API_FILES) \
+		| $$(dir $$@)
+	$(call MSG_GENERATE,python,$@,$<)
+	$(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D) > $@
+endif
+
+
 #
 # VBoxOGLrenderspu
 #
diff --git a/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTest.cpp b/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTest.cpp
index 228ccae..ee6fd27 100644
--- a/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTest.cpp
+++ b/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTest.cpp
@@ -27,9 +27,9 @@
 #include <iprt/env.h>
 #include <iprt/log.h>
 
-#include <VBox/VBoxOGLTest.h>
+#include <VBox/VBoxOGL.h>
 
-bool RTCALL VBoxOglIs3DAccelerationSupported()
+bool RTCALL VBoxOglIs3DAccelerationSupported(void)
 {
     if (RTEnvExist("VBOX_CROGL_FORCE_SUPPORTED"))
     {
diff --git a/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp b/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp
index b9472f7..b12a7d8 100644
--- a/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp
+++ b/src/VBox/HostServices/SharedOpenGL/OpenGLTest/OpenGLTestDarwin.cpp
@@ -1,5 +1,4 @@
 /* $Id: OpenGLTestDarwin.cpp $ */
-
 /** @file
  * VBox host opengl support test
  */
@@ -17,73 +16,54 @@
  */
 
 
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/VBoxOGL.h>
+
 #include <IOKit/IOKitLib.h>
 #include <OpenGL/OpenGL.h>
 #include <ApplicationServices/ApplicationServices.h>
 #include <OpenGL/gl.h>
 #ifdef VBOX_WITH_COCOA_QT
 # include <OpenGL/glu.h>
-# include <iprt/log.h>
-#endif /* VBOX_WITH_COCOA_QT */
+#endif
+
 #include <iprt/env.h>
 #include <iprt/log.h>
+#include <iprt/once.h>
 
-#include <iprt/asm.h>
-#include <iprt/thread.h>
 
-#include <VBox/VBoxOGLTest.h>
 
-bool RTCALL VBoxOglIsOfflineRenderingAppropriate()
+/**
+ * @callback_method_impl{FNRTONCE,
+ *  For determining the cached VBoxOglIsOfflineRenderingAppropriate result.}
+ */
+static DECLCALLBACK(int32_t) vboxOglIsOfflineRenderingAppropriateOnce(void *pvUser)
 {
+    bool *pfAppropriate = (bool *)pvUser;
+
     /* It is assumed that it is makes sense to enable offline rendering
        only in case if host has more than one GPU installed. This routine
        counts all the PCI devices in IORegistry which have IOName property
-       set to "display". If the amount of such devices if greater than one,
-       it returns TRUE or FALSE otherwise. */
-
-    kern_return_t   krc;
-    io_iterator_t   matchingServices;
-    CFDictionaryRef pMatchingDictionary;
-    static bool     fAppropriate = false;
-
-    /* In order to do not slowdown 3D engine which can ask about offline rendering several times,
-       let's cache the result and assume that renderers amount value is constant. Also prevent threads race
-       on startup. */
-
-#define VBOX_OGL_CHECK_UNINITIALIZED    (0)
-#define VBOX_OGL_CHECK_INITIALIZING     (1)
-#define VBOX_OGL_CHECK_INITIALIZED      (2)
-
-    /* Transition VBOX_OGL_CHECK_UNINITIALIZED -> VBOX_OGL_CHECK_INITIALIZING means the current thread
-       is the first one who entered the routine. In this case, it should detect number of GPUs, cache result
-       and return it. If it's not TRUE, then fInitialized is VBOX_OGL_CHECK_INITIALIZING (another thread is performing
-       the check; current thread should wait till result will be cached and return it) or VBOX_OGL_CHECK_INITIALIZED
-       (result is already cached; just return it.) */
-
-    static uint32_t volatile fInitialized = VBOX_OGL_CHECK_UNINITIALIZED;
-    if (!ASMAtomicCmpXchgU32(&fInitialized, VBOX_OGL_CHECK_INITIALIZING, VBOX_OGL_CHECK_UNINITIALIZED))
-    {
-        while (ASMAtomicReadU32(&fInitialized) != VBOX_OGL_CHECK_INITIALIZED)
-            RTThreadSleep(5);
-
-        return fAppropriate;
-    }
-
-#define VBOX_OGL_RENDERER_MATCH_KEYS_NUM    (2)
-
-    CFStringRef ppDictionaryKeys[VBOX_OGL_RENDERER_MATCH_KEYS_NUM] = { CFSTR(kIOProviderClassKey), CFSTR(kIONameMatchKey) };
-    CFStringRef ppDictionaryVals[VBOX_OGL_RENDERER_MATCH_KEYS_NUM] = { CFSTR("IOPCIDevice"),       CFSTR("display") };
-
-    pMatchingDictionary = CFDictionaryCreate(kCFAllocatorDefault,
-                                             (const void **)ppDictionaryKeys,
-                                             (const void **)ppDictionaryVals,
-                                             VBOX_OGL_RENDERER_MATCH_KEYS_NUM,
-                                             &kCFTypeDictionaryKeyCallBacks,
-                                             &kCFTypeDictionaryValueCallBacks);
+       set to "display". If the number of such devices is greater than one,
+       it sets pfAppropriate to TRUE, otherwise to FALSE. */
+
+    CFStringRef apKeyStrings[]   = { CFSTR(kIOProviderClassKey), CFSTR(kIONameMatchKey) };
+    CFStringRef apValueStrings[] = { CFSTR("IOPCIDevice"),       CFSTR("display") };
+    Assert(RT_ELEMENTS(apKeyStrings) == RT_ELEMENTS(apValueStrings));
+
+    CFDictionaryRef pMatchingDictionary = CFDictionaryCreate(kCFAllocatorDefault,
+                                                             (const void **)apKeyStrings,
+                                                             (const void **)apValueStrings,
+                                                             RT_ELEMENTS(apKeyStrings),
+                                                             &kCFTypeDictionaryKeyCallBacks,
+                                                             &kCFTypeDictionaryValueCallBacks);
     if (pMatchingDictionary)
     {
         /* The reference to pMatchingDictionary is consumed by the function below => no IORelease(pMatchingDictionary)! */
-        krc = IOServiceGetMatchingServices(kIOMasterPortDefault, pMatchingDictionary, &matchingServices);
+        io_iterator_t matchingServices;
+        kern_return_t krc = IOServiceGetMatchingServices(kIOMasterPortDefault, pMatchingDictionary, &matchingServices);
         if (krc == kIOReturnSuccess)
         {
             io_object_t matchingService;
@@ -95,21 +75,31 @@ bool RTCALL VBoxOglIsOfflineRenderingAppropriate()
                 IOObjectRelease(matchingService);
             }
 
-            fAppropriate = (cMatchingServices > 1);
+            *pfAppropriate = cMatchingServices > 1;
 
             IOObjectRelease(matchingServices);
         }
-
     }
 
-    LogRel(("OpenGL: Offline rendering support is %s (PID=%d)\n", fAppropriate ? "ON" : "OFF", (int)getpid()));
+    LogRel(("OpenGL: Offline rendering support is %s (pid=%d)\n", *pfAppropriate ? "ON" : "OFF", (int)getpid()));
+    return VINF_SUCCESS;
+}
 
-    ASMAtomicWriteU32(&fInitialized, VBOX_OGL_CHECK_INITIALIZED);
 
-    return fAppropriate;
+bool RTCALL VBoxOglIsOfflineRenderingAppropriate(void)
+{
+    /* In order to do not slowdown 3D engine which can ask about offline rendering several times,
+       let's cache the result and assume that renderers amount value is constant. Use the IPRT
+       execute once construct to make sure there aren't any threading issues. */
+    static RTONCE s_Once = RTONCE_INITIALIZER;
+    static bool   s_fCached = false;
+    int rc = RTOnce(&s_Once, vboxOglIsOfflineRenderingAppropriateOnce, &s_fCached);
+    AssertRC(rc);
+    return s_fCached;
 }
 
-bool RTCALL VBoxOglIs3DAccelerationSupported()
+
+bool RTCALL VBoxOglIs3DAccelerationSupported(void)
 {
     if (RTEnvExist("VBOX_CROGL_FORCE_SUPPORTED"))
     {
@@ -117,13 +107,9 @@ bool RTCALL VBoxOglIs3DAccelerationSupported()
         return true;
     }
 
-    CGDirectDisplayID   display = CGMainDisplayID ();
-    CGOpenGLDisplayMask cglDisplayMask = CGDisplayIDToOpenGLDisplayMask (display);
-    CGLPixelFormatObj   pixelFormat = NULL;
-    GLint numPixelFormats = 0;
-    CGLError            rcCgl;
-
-    CGLPixelFormatAttribute attribs[] = {
+    CGOpenGLDisplayMask     cglDisplayMask = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID());
+    CGLPixelFormatAttribute aAttribs[] =
+    {
         kCGLPFADisplayMask,
         (CGLPixelFormatAttribute)cglDisplayMask,
         kCGLPFAAccelerated,
@@ -131,21 +117,20 @@ bool RTCALL VBoxOglIs3DAccelerationSupported()
         VBoxOglIsOfflineRenderingAppropriate() ? kCGLPFAAllowOfflineRenderers : (CGLPixelFormatAttribute)NULL,
         (CGLPixelFormatAttribute)NULL
     };
-
-    display = CGMainDisplayID();
-    cglDisplayMask = CGDisplayIDToOpenGLDisplayMask(display);
-    rcCgl = CGLChoosePixelFormat(attribs, &pixelFormat, &numPixelFormats);
+    CGLPixelFormatObj pPixelFormat = NULL;
+    GLint             cPixelFormatsIgnored = 0;
+    CGLError rcCgl = CGLChoosePixelFormat(aAttribs, &pPixelFormat, &cPixelFormatsIgnored);
     if (rcCgl != kCGLNoError)
     {
         LogRel(("OpenGL Info: 3D test unable to choose pixel format (rcCgl=0x%X)\n", rcCgl));
         return false;
     }
 
-    if (pixelFormat)
+    if (pPixelFormat)
     {
-        CGLContextObj cglContext = 0;
-        rcCgl = CGLCreateContext(pixelFormat, NULL, &cglContext);
-        CGLDestroyPixelFormat(pixelFormat);
+        CGLContextObj pCglContext = 0;
+        rcCgl = CGLCreateContext(pPixelFormat, NULL, &pCglContext);
+        CGLDestroyPixelFormat(pPixelFormat);
 
         if (rcCgl != kCGLNoError)
         {
@@ -153,35 +138,38 @@ bool RTCALL VBoxOglIs3DAccelerationSupported()
             return false;
         }
 
-        if (cglContext)
+        if (pCglContext)
         {
             GLboolean isSupported = GL_TRUE;
+
 #ifdef VBOX_WITH_COCOA_QT
-            /* On the Cocoa port we depend on the GL_EXT_framebuffer_object &
+            /*
+             * In the Cocoa port we depend on the GL_EXT_framebuffer_object &
              * the GL_EXT_texture_rectangle extension. If they are not
-             * available, disable 3D support. */
-            CGLSetCurrentContext(cglContext);
-            const GLubyte* strExt;
-            strExt = glGetString(GL_EXTENSIONS);
-            isSupported = gluCheckExtension((const GLubyte*)"GL_EXT_framebuffer_object", strExt);
+             * available, disable 3D support.
+             */
+            CGLSetCurrentContext(pCglContext);
+            const GLubyte *pszExts = glGetString(GL_EXTENSIONS);
+            isSupported = gluCheckExtension((const GLubyte *)"GL_EXT_framebuffer_object", pszExts);
             if (isSupported)
             {
-                isSupported = gluCheckExtension((const GLubyte*)"GL_EXT_texture_rectangle", strExt);
+                isSupported = gluCheckExtension((const GLubyte *)"GL_EXT_texture_rectangle", pszExts);
                 if (!isSupported)
-                    LogRel(("OpenGL Info: 3D test found that GL_EXT_texture_rectangle extension not supported\n"));
+                    LogRel(("OpenGL Info: 3D test found that GL_EXT_texture_rectangle extension not supported.\n"));
             }
             else
-                LogRel(("OpenGL Info: 3D test found that GL_EXT_framebuffer_object extension not supported\n"));
+                LogRel(("OpenGL Info: 3D test found that GL_EXT_framebuffer_object extension not supported.\n"));
 #endif /* VBOX_WITH_COCOA_QT */
-            CGLDestroyContext(cglContext);
+
+            CGLDestroyContext(pCglContext);
             LogRel(("OpenGL Info: 3D test %spassed\n", isSupported == GL_TRUE ? "" : "not "));
-            return isSupported == GL_TRUE ? true : false;
+            return isSupported == GL_TRUE;
         }
-        else
-            LogRel(("OpenGL Info: 3D test unable to create context (internal error)\n"));
+
+        LogRel(("OpenGL Info: 3D test unable to create context (internal error).\n"));
     }
     else
-        LogRel(("OpenGL Info: 3D test unable to choose pixel format (internal error)\n"));
+        LogRel(("OpenGL Info: 3D test unable to choose pixel format (internal error).\n"));
 
     return false;
 }
diff --git a/src/VBox/HostServices/SharedOpenGL/OpenGLTest/VBoxTestOGL.rc b/src/VBox/HostServices/SharedOpenGL/OpenGLTest/VBoxTestOGL.rc
index 45675ec..de5baa9 100644
--- a/src/VBox/HostServices/SharedOpenGL/OpenGLTest/VBoxTestOGL.rc
+++ b/src/VBox/HostServices/SharedOpenGL/OpenGLTest/VBoxTestOGL.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_APP
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_APP
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox OpenGL Test Tool\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxTestOGL\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxTestOGL.exe\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/SharedOpenGL/crserver/VBoxSharedCrOpenGL.rc b/src/VBox/HostServices/SharedOpenGL/crserver/VBoxSharedCrOpenGL.rc
index bdabdc4..b759cf5 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserver/VBoxSharedCrOpenGL.rc
+++ b/src/VBox/HostServices/SharedOpenGL/crserver/VBoxSharedCrOpenGL.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox crOpenGL Host Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxSharedCrOpenGL\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxSharedCrOpenGL.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp b/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
index 52063f0..3c628d9 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
+++ b/src/VBox/HostServices/SharedOpenGL/crserver/crservice.cpp
@@ -31,11 +31,13 @@
 
 #include <VBox/hgcmsvc.h>
 #include <VBox/log.h>
+#include <VBox/com/array.h>
 #include <VBox/com/ErrorInfo.h>
 #include <VBox/com/VirtualBox.h>
 #include <VBox/com/errorprint.h>
 #include <VBox/HostServices/VBoxCrOpenGLSvc.h>
 #include <VBox/vmm/ssm.h>
+#include <VBox/VBoxOGL.h>
 
 #include "cr_mem.h"
 #include "cr_server.h"
@@ -71,166 +73,11 @@ typedef struct _CRVBOXSVCPRESENTFBOCMD_t {
     _CRVBOXSVCPRESENTFBOCMD_t *pNext;
 } CRVBOXSVCPRESENTFBOCMD_t, *PCRVBOXSVCPRESENTFBOCMD_t;
 
-typedef struct _CRVBOXSVCPRESENTFBO_t {
-    PCRVBOXSVCPRESENTFBOCMD_t pQueueHead, pQueueTail;   /* Head/Tail of FIFO cmds queue */
-    RTCRITSECT                hQueueLock;       /* Queue lock */
-    RTTHREAD                  hWorkerThread;    /* Worker thread */
-    bool volatile             bShutdownWorker;  /* Shutdown flag */
-    RTSEMEVENT                hEventProcess;    /* Signalled when worker thread should process data or exit */
-} CRVBOXSVCPRESENTFBO_t;
-
-static CRVBOXSVCPRESENTFBO_t g_SvcPresentFBO;
-
-/* Schedule a call to a separate worker thread to avoid deadlock on EMT thread when the screen configuration changes
-   and we're processing crServerPresentFBO caused by guest application command.
-   To avoid unnecessary memcpy, worker thread frees the data passed.
-*/
-static DECLCALLBACK(void) svcPresentFBO(void *data, int32_t screenId, int32_t x, int32_t y, uint32_t w, uint32_t h)
-{
-    PCRVBOXSVCPRESENTFBOCMD_t pCmd;
-
-    pCmd = (PCRVBOXSVCPRESENTFBOCMD_t) RTMemAlloc(sizeof(CRVBOXSVCPRESENTFBOCMD_t));
-    if (!pCmd)
-    {
-        LogRel(("SHARED_CROPENGL svcPresentFBO: not enough memory (%d)\n", sizeof(CRVBOXSVCPRESENTFBOCMD_t)));
-        return;
-    }
-    pCmd->pData = data;
-    pCmd->screenId = screenId;
-    pCmd->x = x;
-    pCmd->y = y;
-    pCmd->w = w;
-    pCmd->h = h;
-    pCmd->pNext = NULL;
-
-    RTCritSectEnter(&g_SvcPresentFBO.hQueueLock);
-
-    if (g_SvcPresentFBO.pQueueTail)
-    {
-        g_SvcPresentFBO.pQueueTail->pNext = pCmd;
-    }
-    else
-    {
-        Assert(!g_SvcPresentFBO.pQueueHead);
-        g_SvcPresentFBO.pQueueHead = pCmd;
-    }
-    g_SvcPresentFBO.pQueueTail = pCmd;
-
-    RTCritSectLeave(&g_SvcPresentFBO.hQueueLock);
-
-    RTSemEventSignal(g_SvcPresentFBO.hEventProcess);
-}
-
-static DECLCALLBACK(int) svcPresentFBOWorkerThreadProc(RTTHREAD ThreadSelf, void *pvUser)
-{
-    int rc = VINF_SUCCESS;
-    PCRVBOXSVCPRESENTFBOCMD_t pCmd;
-
-    Log(("SHARED_CROPENGL svcPresentFBOWorkerThreadProc started\n"));
-
-    for (;;)
-    {
-        rc = RTSemEventWait(g_SvcPresentFBO.hEventProcess, RT_INDEFINITE_WAIT);
-        AssertRCReturn(rc, rc);
-
-        if (g_SvcPresentFBO.bShutdownWorker)
-        {
-            break;
-        }
 
-        // @todo use critsect only to fetch the list and update the g_SvcPresentFBO's pQueueHead and pQueueTail.
-        rc = RTCritSectEnter(&g_SvcPresentFBO.hQueueLock);
-        AssertRCReturn(rc, rc);
-
-        pCmd = g_SvcPresentFBO.pQueueHead;
-        while (pCmd)
-        {
-            ComPtr<IDisplay> pDisplay;
-
-            /*remove from queue*/
-            g_SvcPresentFBO.pQueueHead = pCmd->pNext;
-            if (!g_SvcPresentFBO.pQueueHead)
-            {
-                g_SvcPresentFBO.pQueueTail = NULL;
-            }
-
-            CHECK_ERROR_RET(g_pConsole, COMGETTER(Display)(pDisplay.asOutParam()), rc);
-
-            RTCritSectLeave(&g_SvcPresentFBO.hQueueLock);
-
-            CHECK_ERROR_RET(pDisplay, DrawToScreen(pCmd->screenId, (BYTE*)pCmd->pData, pCmd->x, pCmd->y, pCmd->w, pCmd->h), rc);
-
-            crFree(pCmd->pData);
-            RTMemFree(pCmd);
-
-            rc = RTCritSectEnter(&g_SvcPresentFBO.hQueueLock);
-            AssertRCReturn(rc, rc);
-            pCmd = g_SvcPresentFBO.pQueueHead;
-        }
-
-        RTCritSectLeave(&g_SvcPresentFBO.hQueueLock);
-    }
-
-    Log(("SHARED_CROPENGL svcPresentFBOWorkerThreadProc finished\n"));
-
-    return rc;
-}
-
-static int svcPresentFBOInit(void)
-{
-    int rc = VINF_SUCCESS;
-
-    g_SvcPresentFBO.pQueueHead = NULL;
-    g_SvcPresentFBO.pQueueTail = NULL;
-    g_SvcPresentFBO.bShutdownWorker = false;
-
-    rc = RTCritSectInit(&g_SvcPresentFBO.hQueueLock);
-    AssertRCReturn(rc, rc);
-
-    rc = RTSemEventCreate(&g_SvcPresentFBO.hEventProcess);
-    AssertRCReturn(rc, rc);
-
-    rc = RTThreadCreate(&g_SvcPresentFBO.hWorkerThread, svcPresentFBOWorkerThreadProc, NULL, 0,
-                        RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "OpenGLWorker");
-    AssertRCReturn(rc, rc);
-
-    crVBoxServerSetPresentFBOCB(svcPresentFBO);
-
-    return rc;
-}
-
-static int svcPresentFBOTearDown(void)
-{
-    int rc = VINF_SUCCESS;
-    PCRVBOXSVCPRESENTFBOCMD_t pQueue, pTmp;
-
-    ASMAtomicWriteBool(&g_SvcPresentFBO.bShutdownWorker, true);
-    RTSemEventSignal(g_SvcPresentFBO.hEventProcess);
-    rc = RTThreadWait(g_SvcPresentFBO.hWorkerThread, 5000, NULL);
-    AssertRCReturn(rc, rc);
-
-    RTCritSectDelete(&g_SvcPresentFBO.hQueueLock);
-    RTSemEventDestroy(g_SvcPresentFBO.hEventProcess);
-
-    pQueue = g_SvcPresentFBO.pQueueHead;
-    while (pQueue)
-    {
-        pTmp = pQueue->pNext;
-        crFree(pQueue->pData);
-        RTMemFree(pQueue);
-        pQueue = pTmp;
-    }
-    g_SvcPresentFBO.pQueueHead = NULL;
-    g_SvcPresentFBO.pQueueTail = NULL;
-
-    return rc;
-}
-
-static DECLCALLBACK(void) svcNotifyEventCB(int32_t screenId, uint32_t uEvent, void*pvData)
+static DECLCALLBACK(void) svcNotifyEventCB(int32_t screenId, uint32_t uEvent, void* pvData, uint32_t cbData)
 {
     ComPtr<IDisplay> pDisplay;
     ComPtr<IFramebuffer> pFramebuffer;
-    LONG xo, yo;
 
     if (!g_pConsole)
     {
@@ -240,12 +87,16 @@ static DECLCALLBACK(void) svcNotifyEventCB(int32_t screenId, uint32_t uEvent, vo
 
     CHECK_ERROR2_STMT(g_pConsole, COMGETTER(Display)(pDisplay.asOutParam()), return);
 
-    CHECK_ERROR2_STMT(pDisplay, GetFramebuffer(screenId, pFramebuffer.asOutParam(), &xo, &yo), return);
+    CHECK_ERROR2_STMT(pDisplay, QueryFramebuffer(screenId, pFramebuffer.asOutParam()), return);
 
     if (!pFramebuffer)
         return;
 
-    pFramebuffer->Notify3DEvent(uEvent, (BYTE*)pvData);
+    com::SafeArray<BYTE> data(cbData);
+    if (cbData)
+        memcpy(data.raw(), pvData, cbData);
+
+    pFramebuffer->Notify3DEvent(uEvent, ComSafeArrayAsInParam(data));
 }
 
 
@@ -257,8 +108,6 @@ static DECLCALLBACK(int) svcUnload (void *)
 
     crVBoxServerTearDown();
 
-    svcPresentFBOTearDown();
-
     return rc;
 }
 
@@ -1107,7 +956,7 @@ static int svcHostCallPerform(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVC
 
                     for (i=0; i<monitorCount; ++i)
                     {
-                        CHECK_ERROR_RET(pDisplay, GetFramebuffer(i, pFramebuffer.asOutParam(), &xo, &yo), rc);
+                        CHECK_ERROR_RET(pDisplay, QueryFramebuffer(i, pFramebuffer.asOutParam()), rc);
 
                         if (!pFramebuffer)
                         {
@@ -1119,6 +968,9 @@ static int svcHostCallPerform(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVC
                             CHECK_ERROR_RET(pFramebuffer, COMGETTER(WinId)(&winId), rc);
                             CHECK_ERROR_RET(pFramebuffer, COMGETTER(Width)(&w), rc);
                             CHECK_ERROR_RET(pFramebuffer, COMGETTER(Height)(&h), rc);
+                            ULONG dummy;
+                            GuestMonitorStatus_T monitorStatus;
+                            CHECK_ERROR_RET(pDisplay, GetScreenResolution(i, &dummy, &dummy, &dummy, &xo, &yo, &monitorStatus), rc);
 
                             rc = crVBoxServerMapScreen(i, xo, yo, w, h, winId);
                             AssertRCReturn(rc, rc);
@@ -1215,7 +1067,7 @@ static int svcHostCallPerform(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVC
 
                 Assert(g_pConsole);
                 CHECK_ERROR_RET(g_pConsole, COMGETTER(Display)(pDisplay.asOutParam()), rc);
-                CHECK_ERROR_RET(pDisplay, GetFramebuffer(screenId, pFramebuffer.asOutParam(), &xo, &yo), rc);
+                CHECK_ERROR_RET(pDisplay, QueryFramebuffer(screenId, pFramebuffer.asOutParam()), rc);
 
                 crServerVBoxCompositionSetEnableStateGlobal(GL_FALSE);
 
@@ -1226,13 +1078,10 @@ static int svcHostCallPerform(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVC
                 }
                 else
                 {
-#if 0
-                    CHECK_ERROR_RET(pFramebuffer, Lock(), rc);
-#endif
-
                     do {
                         /* determine if the framebuffer is functional */
-                        rc = pFramebuffer->Notify3DEvent(VBOX3D_NOTIFY_EVENT_TYPE_TEST_FUNCTIONAL, NULL);
+                        com::SafeArray<BYTE> data;
+                        rc = pFramebuffer->Notify3DEvent(VBOX3D_NOTIFY_EVENT_TYPE_TEST_FUNCTIONAL, ComSafeArrayAsInParam(data));
 
                         if (rc == S_OK)
                             CHECK_ERROR_BREAK(pFramebuffer, COMGETTER(WinId)(&winId));
@@ -1247,14 +1096,14 @@ static int svcHostCallPerform(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVC
                         {
                             CHECK_ERROR_BREAK(pFramebuffer, COMGETTER(Width)(&w));
                             CHECK_ERROR_BREAK(pFramebuffer, COMGETTER(Height)(&h));
+                            ULONG dummy;
+                            GuestMonitorStatus_T monitorStatus;
+                            CHECK_ERROR_BREAK(pDisplay, GetScreenResolution(screenId, &dummy, &dummy, &dummy, &xo, &yo, &monitorStatus));
 
                             rc = crVBoxServerMapScreen(screenId, xo, yo, w, h, winId);
                             AssertRCReturn(rc, rc);
                         }
                     } while (0);
-#if 0
-                    CHECK_ERROR_RET(pFramebuffer, Unlock(), rc);
-#endif
                 }
 
                 crServerVBoxCompositionSetEnableStateGlobal(GL_TRUE);
@@ -1517,6 +1366,54 @@ static int svcHostCallPerform(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVC
 
             break;
         }
+        case SHCRGL_HOST_FN_SET_SCALE_FACTOR:
+        {
+            /* Verify parameter count and types. */
+            if (cParms != 1
+             || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR
+             || paParms[0].u.pointer.size != sizeof(CRVBOXHGCMSETSCALEFACTOR)
+             || !paParms[0].u.pointer.addr)
+            {
+                WARN(("invalid parameter"));
+                rc = VERR_INVALID_PARAMETER;
+                break;
+            }
+
+            CRVBOXHGCMSETSCALEFACTOR *pData = (CRVBOXHGCMSETSCALEFACTOR *)paParms[0].u.pointer.addr;
+            double dScaleFactorW = (double)(pData->u32ScaleFactorWMultiplied) / VBOX_OGL_SCALE_FACTOR_MULTIPLIER;
+            double dScaleFactorH = (double)(pData->u32ScaleFactorHMultiplied) / VBOX_OGL_SCALE_FACTOR_MULTIPLIER;
+
+            rc = VBoxOglSetScaleFactor(pData->u32Screen, dScaleFactorW, dScaleFactorH);
+
+            /* Log scaling factor rounded to nearest 'int' value (not so precise). */
+            LogRel(("OpenGL: Set 3D content scale factor to (%u, %u), multiplier %d (rc=%Rrc).\n",
+                pData->u32ScaleFactorWMultiplied,
+                pData->u32ScaleFactorHMultiplied,
+                (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER,
+                rc));
+
+            break;
+        }
+
+        case SHCRGL_HOST_FN_SET_UNSCALED_HIDPI:
+        {
+            /* Verify parameter count and types. */
+            if (cParms != 1
+             || paParms[0].type != VBOX_HGCM_SVC_PARM_PTR
+             || paParms[0].u.pointer.size != sizeof(CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT)
+             || !paParms[0].u.pointer.addr)
+            {
+                WARN(("invalid parameter"));
+                rc = VERR_INVALID_PARAMETER;
+                break;
+            }
+
+            CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT *pData = (CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT *)paParms[0].u.pointer.addr;
+            crServerSetUnscaledHiDPI(pData->fUnscaledHiDPI);
+            LogRel(("OpenGL: Set OpenGL scale policy on HiDPI displays (fUnscaledHiDPI=%d).\n", pData->fUnscaledHiDPI));
+            break;
+        }
+
         default:
             WARN(("svcHostCallPerform: unexpected u32Function %d", u32Function));
             rc = VERR_NOT_IMPLEMENTED;
@@ -1658,8 +1555,6 @@ extern "C" DECLCALLBACK(DECLEXPORT(int)) VBoxHGCMSvcLoad (VBOXHGCMSVCFNTABLE *pt
             if (!crVBoxServerInit())
                 return VERR_NOT_SUPPORTED;
 
-            rc = svcPresentFBOInit();
-
             crServerVBoxSetNotifyEventCB(svcNotifyEventCB);
         }
     }
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_base.cpp b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_base.cpp
new file mode 100644
index 0000000..c7fca48
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_base.cpp
@@ -0,0 +1,390 @@
+/* $Id: display_base.cpp $ */
+
+/** @file
+ * Presenter API: display base class implementation.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "server_presenter.h"
+
+CrFbDisplayBase::CrFbDisplayBase() :
+        mpContainer(NULL),
+        mpFb(NULL),
+        mcUpdates(0),
+        mhSlot(CRHTABLE_HANDLE_INVALID)
+{
+    mFlags.u32Value = 0;
+}
+
+
+CrFbDisplayBase::~CrFbDisplayBase()
+{
+    Assert(!mcUpdates);
+
+    if (mpContainer)
+        mpContainer->remove(this);
+}
+
+
+bool CrFbDisplayBase::isComposite()
+{
+    return false;
+}
+
+
+class CrFbDisplayComposite* CrFbDisplayBase::getContainer()
+{
+    return mpContainer;
+}
+
+
+bool CrFbDisplayBase::isInList()
+{
+    return !!mpContainer;
+}
+
+
+bool CrFbDisplayBase::isUpdating()
+{
+    return !!mcUpdates;
+}
+
+
+int CrFbDisplayBase::setRegionsChanged()
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+
+    mFlags.fRegionsShanged = 1;
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::setFramebuffer(struct CR_FRAMEBUFFER *pFb)
+{
+    if (mcUpdates)
+    {
+        WARN(("trying to set framebuffer while update is in progress"));
+        return VERR_INVALID_STATE;
+    }
+
+    if (mpFb == pFb)
+        return VINF_SUCCESS;
+
+    int rc = setFramebufferBegin(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    if (mpFb)
+    {
+        rc = fbCleanup();
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            setFramebufferEnd(pFb);
+            return rc;
+        }
+    }
+
+     mpFb = pFb;
+
+    if (mpFb)
+    {
+        rc = fbSync();
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            setFramebufferEnd(pFb);
+            return rc;
+        }
+    }
+
+    setFramebufferEnd(pFb);
+    return VINF_SUCCESS;
+}
+
+
+struct CR_FRAMEBUFFER* CrFbDisplayBase::getFramebuffer()
+{
+    return mpFb;
+}
+
+
+int CrFbDisplayBase::UpdateBegin(struct CR_FRAMEBUFFER *pFb)
+{
+    ++mcUpdates;
+    Assert(!mFlags.fRegionsShanged || mcUpdates > 1);
+    return VINF_SUCCESS;
+}
+
+
+void CrFbDisplayBase::UpdateEnd(struct CR_FRAMEBUFFER *pFb)
+{
+    --mcUpdates;
+    Assert(mcUpdates < UINT32_MAX/2);
+    if (!mcUpdates)
+        onUpdateEnd();
+}
+
+
+int CrFbDisplayBase::EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+    mFlags.fRegionsShanged = 1;
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry,
+    HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+    mFlags.fRegionsShanged = 1;
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::EntryPosChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+    mFlags.fRegionsShanged = 1;
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::RegionsChanged(struct CR_FRAMEBUFFER *pFb)
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+    mFlags.fRegionsShanged = 1;
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::FramebufferChanged(struct CR_FRAMEBUFFER *pFb)
+{
+    if (!mcUpdates)
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+    return VINF_SUCCESS;
+}
+
+
+void CrFbDisplayBase::onUpdateEnd()
+{
+    if (mFlags.fRegionsShanged)
+    {
+        mFlags.fRegionsShanged = 0;
+        if (getFramebuffer()) /*<-dont't do anything on cleanup*/
+            ueRegions();
+    }
+}
+
+
+void CrFbDisplayBase::ueRegions()
+{
+}
+
+
+DECLCALLBACK(bool) CrFbDisplayBase::entriesCreateCb(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
+{
+    int rc = ((ICrFbDisplay*)(pvContext))->EntryCreated(hFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+    }
+    return true;
+}
+
+
+DECLCALLBACK(bool) CrFbDisplayBase::entriesDestroyCb(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
+{
+    int rc = ((ICrFbDisplay*)(pvContext))->EntryDestroyed(hFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+    }
+    return true;
+}
+
+
+int CrFbDisplayBase::fbSynchAddAllEntries()
+{
+    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
+    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
+
+    CrVrScrCompositorConstIterInit(CrFbGetCompositor(mpFb), &Iter);
+    int rc = VINF_SUCCESS;
+
+    CrFbVisitCreatedEntries(mpFb, entriesCreateCb, this);
+
+    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
+    {
+        HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
+
+        rc = EntryAdded(mpFb, hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            EntryDestroyed(mpFb, hEntry);
+            break;
+        }
+    }
+
+    return rc;
+}
+
+
+int CrFbDisplayBase::fbCleanupRemoveAllEntries()
+{
+    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
+    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
+
+    CrVrScrCompositorConstIterInit(CrFbGetCompositor(mpFb), &Iter);
+
+    int rc = VINF_SUCCESS;
+
+    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
+    {
+        HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
+        rc = EntryRemoved(mpFb, hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            break;
+        }
+
+        CrFbVisitCreatedEntries(mpFb, entriesDestroyCb, this);
+    }
+
+    return rc;
+}
+
+
+int CrFbDisplayBase::setFramebufferBegin(struct CR_FRAMEBUFFER *pFb)
+{
+    return UpdateBegin(pFb);
+}
+
+
+void CrFbDisplayBase::setFramebufferEnd(struct CR_FRAMEBUFFER *pFb)
+{
+    UpdateEnd(pFb);
+}
+
+
+DECLCALLBACK(void) CrFbDisplayBase::slotEntryReleaseCB(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
+{
+}
+
+
+void CrFbDisplayBase::slotRelease()
+{
+    Assert(mhSlot);
+    CrFbDDataReleaseSlot(mpFb, mhSlot, slotEntryReleaseCB, this);
+}
+
+
+int CrFbDisplayBase::fbCleanup()
+{
+    if (mhSlot)
+    {
+        slotRelease();
+        mhSlot = 0;
+    }
+
+    mpFb = NULL;
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayBase::fbSync()
+{
+    return VINF_SUCCESS;
+}
+
+
+CRHTABLE_HANDLE CrFbDisplayBase::slotGet()
+{
+    if (!mhSlot)
+    {
+        if (mpFb)
+            mhSlot = CrFbDDataAllocSlot(mpFb);
+    }
+
+    return mhSlot;
+}
+
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_composite.cpp b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_composite.cpp
new file mode 100644
index 0000000..fae8d2d
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_composite.cpp
@@ -0,0 +1,341 @@
+/* $Id: display_composite.cpp $ */
+
+/** @file
+ * Presenter API: display composite class implementation.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "server_presenter.h"
+
+CrFbDisplayComposite::CrFbDisplayComposite() :
+        mcDisplays(0)
+{
+    RTListInit(&mDisplays);
+}
+
+
+bool CrFbDisplayComposite::isComposite()
+{
+    return true;
+}
+
+
+uint32_t CrFbDisplayComposite::getDisplayCount()
+{
+    return mcDisplays;
+}
+
+
+bool CrFbDisplayComposite::add(CrFbDisplayBase *pDisplay)
+{
+    if (pDisplay->isInList())
+    {
+        WARN(("entry in list already"));
+        return false;
+    }
+
+    RTListAppend(&mDisplays, &pDisplay->mNode);
+    pDisplay->mpContainer = this;
+    pDisplay->setFramebuffer(getFramebuffer());
+    ++mcDisplays;
+    return true;
+}
+
+
+bool CrFbDisplayComposite::remove(CrFbDisplayBase *pDisplay, bool fCleanupDisplay)
+{
+    if (pDisplay->getContainer() != this)
+    {
+        WARN(("invalid entry container"));
+        return false;
+    }
+
+    RTListNodeRemove(&pDisplay->mNode);
+    pDisplay->mpContainer = NULL;
+    if (fCleanupDisplay)
+        pDisplay->setFramebuffer(NULL);
+    --mcDisplays;
+    return true;
+}
+
+
+CrFbDisplayBase* CrFbDisplayComposite::first()
+{
+    return RTListGetFirstCpp(&mDisplays, CrFbDisplayBase, mNode);
+}
+
+
+CrFbDisplayBase* CrFbDisplayComposite::next(CrFbDisplayBase* pDisplay)
+{
+    if (pDisplay->getContainer() != this)
+    {
+        WARN(("invalid entry container"));
+        return NULL;
+    }
+
+    return RTListGetNextCpp(&mDisplays, pDisplay, CrFbDisplayBase, mNode);
+}
+
+
+int CrFbDisplayComposite::setFramebuffer(struct CR_FRAMEBUFFER *pFb)
+{
+    CrFbDisplayBase::setFramebuffer(pFb);
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        pIter->setFramebuffer(pFb);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayComposite::UpdateBegin(struct CR_FRAMEBUFFER *pFb)
+{
+    int rc = CrFbDisplayBase::UpdateBegin(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        rc = pIter->UpdateBegin(pFb);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+    return VINF_SUCCESS;
+}
+
+
+void CrFbDisplayComposite::UpdateEnd(struct CR_FRAMEBUFFER *pFb)
+{
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        pIter->UpdateEnd(pFb);
+    }
+
+    CrFbDisplayBase::UpdateEnd(pFb);
+}
+
+
+int CrFbDisplayComposite::EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryAdded(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        int rc = pIter->EntryAdded(pFb, hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayComposite::EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryAdded(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        int rc = pIter->EntryCreated(pFb, hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayComposite::EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
+{
+    int rc = CrFbDisplayBase::EntryReplaced(pFb, hNewEntry, hReplacedEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        int rc = pIter->EntryReplaced(pFb, hNewEntry, hReplacedEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayComposite::EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryTexChanged(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        int rc = pIter->EntryTexChanged(pFb, hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayComposite::EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryRemoved(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        int rc = pIter->EntryRemoved(pFb, hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayComposite::EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryDestroyed(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        int rc = pIter->EntryDestroyed(pFb, hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayComposite::RegionsChanged(struct CR_FRAMEBUFFER *pFb)
+{
+    int rc = CrFbDisplayBase::RegionsChanged(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        int rc = pIter->RegionsChanged(pFb);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayComposite::FramebufferChanged(struct CR_FRAMEBUFFER *pFb)
+{
+    int rc = CrFbDisplayBase::FramebufferChanged(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    CrFbDisplayBase *pIter;
+    RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
+    {
+        int rc = pIter->FramebufferChanged(pFb);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+CrFbDisplayComposite::~CrFbDisplayComposite()
+{
+    cleanup();
+}
+
+
+void CrFbDisplayComposite::cleanup(bool fCleanupDisplays)
+{
+    CrFbDisplayBase *pIter, *pIterNext;
+    RTListForEachSafeCpp(&mDisplays, pIter, pIterNext, CrFbDisplayBase, mNode)
+    {
+        remove(pIter, fCleanupDisplays);
+    }
+}
+
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_vrdp.cpp b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_vrdp.cpp
new file mode 100644
index 0000000..4f95527
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_vrdp.cpp
@@ -0,0 +1,381 @@
+/* $Id: display_vrdp.cpp $ */
+
+/** @file
+ * Presenter API: CrFbDisplayVrdp class implementation -- display content over VRDP.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "server_presenter.h"
+
+
+CrFbDisplayVrdp::CrFbDisplayVrdp()
+{
+    memset(&mPos, 0, sizeof (mPos));
+}
+
+
+int CrFbDisplayVrdp::EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryCreated(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("EntryAdded failed rc %d", rc));
+        return rc;
+    }
+
+    Assert(!CrFbDDataEntryGet(hEntry, slotGet()));
+    rc = vrdpCreate(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("vrdpCreate failed rc %d", rc));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayVrdp::EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
+{
+    int rc = CrFbDisplayBase::EntryReplaced(pFb, hNewEntry, hReplacedEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pReplacedEntry = CrFbEntryGetCompositorEntry(hReplacedEntry);
+    CR_TEXDATA *pReplacedTex = CrVrScrCompositorEntryTexGet(pReplacedEntry);
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pNewEntry = CrFbEntryGetCompositorEntry(hNewEntry);
+    CR_TEXDATA *pNewTex = CrVrScrCompositorEntryTexGet(pNewEntry);
+
+    CrTdBltDataInvalidateNe(pReplacedTex);
+
+    rc = CrTdBltEnter(pNewTex);
+    if (RT_SUCCESS(rc))
+    {
+        rc = vrdpFrame(hNewEntry);
+        CrTdBltLeave(pNewTex);
+    }
+    else
+        WARN(("CrTdBltEnter failed %d", rc));
+
+    return rc;
+}
+
+
+int CrFbDisplayVrdp::EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryTexChanged(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
+    CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
+
+    rc = CrTdBltEnter(pTex);
+    if (RT_SUCCESS(rc))
+    {
+        rc = vrdpFrame(hEntry);
+        CrTdBltLeave(pTex);
+    }
+    else
+        WARN(("CrTdBltEnter failed %d", rc));
+
+    return rc;
+}
+
+
+int CrFbDisplayVrdp::EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryRemoved(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
+    CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
+    CrTdBltDataInvalidateNe(pTex);
+
+    return vrdpRegions(pFb, hEntry);
+}
+
+
+int CrFbDisplayVrdp::EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryDestroyed(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    vrdpDestroy(hEntry);
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayVrdp::EntryPosChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryPosChanged(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    vrdpGeometry(hEntry);
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayVrdp::RegionsChanged(struct CR_FRAMEBUFFER *pFb)
+{
+    int rc = CrFbDisplayBase::RegionsChanged(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return vrdpRegionsAll(pFb);
+}
+
+
+int CrFbDisplayVrdp::FramebufferChanged(struct CR_FRAMEBUFFER *pFb)
+{
+    int rc = CrFbDisplayBase::FramebufferChanged(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    syncPos();
+
+    rc = vrdpSyncEntryAll(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return vrdpRegionsAll(pFb);
+}
+
+
+void CrFbDisplayVrdp::syncPos()
+{
+    const struct VBVAINFOSCREEN* pScreenInfo = CrFbGetScreenInfo(getFramebuffer());
+    mPos.x = pScreenInfo->i32OriginX;
+    mPos.y = pScreenInfo->i32OriginY;
+}
+
+int CrFbDisplayVrdp::fbCleanup()
+{
+    int rc = fbCleanupRemoveAllEntries();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return CrFbDisplayBase::fbCleanup();
+}
+
+
+int CrFbDisplayVrdp::fbSync()
+{
+    syncPos();
+
+    int rc = fbSynchAddAllEntries();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return CrFbDisplayBase::fbSync();
+}
+
+
+void CrFbDisplayVrdp::vrdpDestroy(HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    void *pVrdp = CrFbDDataEntryGet(hEntry, slotGet());
+    cr_server.outputRedirect.CROREnd(pVrdp);
+}
+
+
+void CrFbDisplayVrdp::vrdpGeometry(HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    void *pVrdp = CrFbDDataEntryGet(hEntry, slotGet());
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
+
+    cr_server.outputRedirect.CRORGeometry(
+        pVrdp,
+        mPos.x + CrVrScrCompositorEntryRectGet(pEntry)->xLeft,
+        mPos.y + CrVrScrCompositorEntryRectGet(pEntry)->yTop,
+        CrVrScrCompositorEntryTexGet(pEntry)->Tex.width,
+        CrVrScrCompositorEntryTexGet(pEntry)->Tex.height);
+}
+
+
+int CrFbDisplayVrdp::vrdpRegions(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    void *pVrdp = CrFbDDataEntryGet(hEntry, slotGet());
+    const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(pFb);
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
+    uint32_t cRects;
+    const RTRECT *pRects;
+
+    int rc = CrVrScrCompositorEntryRegionsGet(pCompositor, pEntry, &cRects, &pRects, NULL, NULL);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc));
+        return rc;
+    }
+
+    cr_server.outputRedirect.CRORVisibleRegion(pVrdp, cRects, pRects);
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayVrdp::vrdpFrame(HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    void *pVrdp = CrFbDDataEntryGet(hEntry, slotGet());
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
+    CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
+    const CR_BLITTER_IMG *pImg;
+    CrTdBltDataInvalidateNe(pTex);
+
+    int rc = CrTdBltDataAcquire(pTex, GL_BGRA, !!(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS), &pImg);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrTdBltDataAcquire failed rc %d", rc));
+        return rc;
+    }
+
+    cr_server.outputRedirect.CRORFrame(pVrdp, pImg->pvData, pImg->cbData);
+    CrTdBltDataRelease(pTex);
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayVrdp::vrdpRegionsAll(struct CR_FRAMEBUFFER *pFb)
+{
+    const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(pFb);
+    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
+    CrVrScrCompositorConstIterInit(pCompositor, &Iter);
+    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
+    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
+    {
+        HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
+        vrdpRegions(pFb, hEntry);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayVrdp::vrdpSynchEntry(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    vrdpGeometry(hEntry);
+
+    return vrdpRegions(pFb, hEntry);;
+}
+
+
+int CrFbDisplayVrdp::vrdpSyncEntryAll(struct CR_FRAMEBUFFER *pFb)
+{
+    const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(pFb);
+    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
+    CrVrScrCompositorConstIterInit(pCompositor, &Iter);
+    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
+    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
+    {
+        HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
+        int rc = vrdpSynchEntry(pFb, hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("vrdpSynchEntry failed rc %d", rc));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayVrdp::vrdpCreate(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    void *pVrdp;
+
+    /* Query supported formats. */
+    uint32_t cbFormats = 4096;
+    char *pachFormats = (char *)crAlloc(cbFormats);
+
+    if (!pachFormats)
+    {
+        WARN(("crAlloc failed"));
+        return VERR_NO_MEMORY;
+    }
+
+    int rc = cr_server.outputRedirect.CRORContextProperty(cr_server.outputRedirect.pvContext,
+                                                          0 /* H3DOR_PROP_FORMATS */, // @todo from a header
+                                                          pachFormats, cbFormats, &cbFormats);
+    if (RT_SUCCESS(rc))
+    {
+        if (RTStrStr(pachFormats, "H3DOR_FMT_RGBA_TOPDOWN"))
+        {
+            cr_server.outputRedirect.CRORBegin(
+                cr_server.outputRedirect.pvContext,
+                &pVrdp,
+                "H3DOR_FMT_RGBA_TOPDOWN"); // @todo from a header
+
+            if (pVrdp)
+            {
+                rc = CrFbDDataEntryPut(hEntry, slotGet(), pVrdp);
+                if (RT_SUCCESS(rc))
+                {
+                    vrdpGeometry(hEntry);
+                    vrdpRegions(hFb, hEntry);
+                    //vrdpFrame(hEntry);
+                    return VINF_SUCCESS;
+                }
+                else
+                    WARN(("CrFbDDataEntryPut failed rc %d", rc));
+
+                cr_server.outputRedirect.CROREnd(pVrdp);
+            }
+            else
+            {
+                WARN(("CRORBegin failed"));
+                rc = VERR_GENERAL_FAILURE;
+            }
+        }
+    }
+    else
+        WARN(("CRORContextProperty failed rc %d", rc));
+
+    crFree(pachFormats);
+
+    return rc;
+}
+
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_window.cpp b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_window.cpp
new file mode 100644
index 0000000..ff84899
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_window.cpp
@@ -0,0 +1,570 @@
+/* $Id: display_window.cpp $ */
+
+/** @file
+ * Presenter API: CrFbDisplayWindow class implementation -- display content into host GUI window.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "server_presenter.h"
+
+CrFbDisplayWindow::CrFbDisplayWindow(const RTRECT *pViewportRect, uint64_t parentId) :
+    mpWindow(NULL),
+    mViewportRect(*pViewportRect),
+    mu32Screen(~0),
+    mParentId(parentId)
+{
+    mFlags.u32Value = 0;
+}
+
+
+CrFbDisplayWindow::~CrFbDisplayWindow()
+{
+    if (mpWindow)
+        delete mpWindow;
+}
+
+
+int CrFbDisplayWindow::UpdateBegin(struct CR_FRAMEBUFFER *pFb)
+{
+    int rc = mpWindow ? mpWindow->UpdateBegin() : VINF_SUCCESS;
+    if (RT_SUCCESS(rc))
+    {
+        rc = CrFbDisplayBase::UpdateBegin(pFb);
+        if (RT_SUCCESS(rc))
+            return VINF_SUCCESS;
+        else
+        {
+            WARN(("err"));
+            if (mpWindow)
+                mpWindow->UpdateEnd();
+        }
+    }
+    else
+        WARN(("err"));
+
+    return rc;
+}
+
+
+void CrFbDisplayWindow::UpdateEnd(struct CR_FRAMEBUFFER *pFb)
+{
+    CrFbDisplayBase::UpdateEnd(pFb);
+
+    if (mpWindow)
+        mpWindow->UpdateEnd();
+}
+
+
+int CrFbDisplayWindow::RegionsChanged(struct CR_FRAMEBUFFER *pFb)
+{
+    int rc = CrFbDisplayBase::RegionsChanged(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    if (mpWindow && mpWindow->GetParentId())
+    {
+        rc = mpWindow->Create();
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindow::EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryCreated(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    if (mpWindow && mpWindow->GetParentId())
+    {
+        rc = mpWindow->Create();
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindow::EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
+{
+    int rc = CrFbDisplayBase::EntryReplaced(pFb, hNewEntry, hReplacedEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    if (mpWindow && mpWindow->GetParentId())
+    {
+        rc = mpWindow->Create();
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindow::EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayBase::EntryTexChanged(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    if (mpWindow && mpWindow->GetParentId())
+    {
+        rc = mpWindow->Create();
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindow::FramebufferChanged(struct CR_FRAMEBUFFER *pFb)
+{
+    int rc = CrFbDisplayBase::FramebufferChanged(pFb);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return screenChanged();
+}
+
+
+const RTRECT* CrFbDisplayWindow::getViewportRect()
+{
+    return &mViewportRect;
+}
+
+
+int CrFbDisplayWindow::setViewportRect(const RTRECT *pViewportRect)
+{
+    if (!isUpdating())
+    {
+        WARN(("not updating!"));
+        return VERR_INVALID_STATE;
+    }
+
+    // always call SetPosition to ensure window is adjustep properly
+    //        if (pViewportRect->xLeft != mViewportRect.xLeft || pViewportRect->yTop != mViewportRect.yTop)
+    if (mpWindow)
+    {
+        const RTRECT* pRect = getRect();
+        int rc = mpWindow->SetPosition(pRect->xLeft - pViewportRect->xLeft, pRect->yTop - pViewportRect->yTop);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("SetPosition failed"));
+            return rc;
+        }
+    }
+
+    mViewportRect = *pViewportRect;
+
+    return VINF_SUCCESS;
+}
+
+
+CrFbWindow * CrFbDisplayWindow::windowDetach(bool fCleanup)
+{
+    if (isUpdating())
+    {
+        WARN(("updating!"));
+        return NULL;
+    }
+
+    CrFbWindow * pWindow = mpWindow;
+    if (mpWindow)
+    {
+        if (fCleanup)
+            windowCleanup();
+        mpWindow = NULL;
+    }
+    return pWindow;
+}
+
+
+CrFbWindow * CrFbDisplayWindow::windowAttach(CrFbWindow * pNewWindow)
+{
+    if (isUpdating())
+    {
+        WARN(("updating!"));
+        return NULL;
+    }
+
+    CrFbWindow * pOld = mpWindow;
+    if (mpWindow)
+        windowDetach();
+
+    mpWindow = pNewWindow;
+    if (pNewWindow)
+        windowSync();
+
+    return mpWindow;
+}
+
+
+int CrFbDisplayWindow::reparent(uint64_t parentId)
+{
+    if (!isUpdating())
+    {
+        WARN(("not updating!"));
+        return VERR_INVALID_STATE;
+    }
+
+    crDebug("CrFbDisplayWindow: change parent from %p to %p.", mParentId, parentId);
+
+    mParentId = parentId;
+    int rc = VINF_SUCCESS;
+
+    if (isActive() && mpWindow)
+    {
+        rc = mpWindow->Reparent(parentId);
+        if (!RT_SUCCESS(rc))
+            WARN(("window reparent failed"));
+
+        mFlags.fNeForce = 1;
+    }
+
+    return rc;
+}
+
+
+bool CrFbDisplayWindow::isVisible()
+{
+    HCR_FRAMEBUFFER hFb = getFramebuffer();
+    if (!hFb)
+        return false;
+    const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(hFb);
+    return !CrVrScrCompositorIsEmpty(pCompositor);
+}
+
+
+int CrFbDisplayWindow::winVisibilityChanged()
+{
+    HCR_FRAMEBUFFER hFb = getFramebuffer();
+    if (!hFb || !CrFbIsEnabled(hFb))
+    {
+        Assert(!mpWindow || !mpWindow->IsVisivle());
+        return VINF_SUCCESS;
+    }
+
+    int rc = VINF_SUCCESS;
+
+    if (mpWindow)
+    {
+        rc = mpWindow->UpdateBegin();
+        if (RT_SUCCESS(rc))
+        {
+            rc = mpWindow->SetVisible(!g_CrPresenter.fWindowsForceHidden);
+            if (!RT_SUCCESS(rc))
+                WARN(("SetVisible failed, rc %d", rc));
+
+            mpWindow->UpdateEnd();
+        }
+        else
+            WARN(("UpdateBegin failed, rc %d", rc));
+    }
+
+    return rc;
+}
+
+
+CrFbWindow* CrFbDisplayWindow::getWindow()
+{
+    return mpWindow;
+}
+
+
+void CrFbDisplayWindow::onUpdateEnd()
+{
+    CrFbDisplayBase::onUpdateEnd();
+    bool fVisible = isVisible();
+    if (mFlags.fNeVisible != fVisible || mFlags.fNeForce)
+    {
+        crVBoxServerNotifyEvent(mu32Screen,
+                                fVisible? VBOX3D_NOTIFY_EVENT_TYPE_3DDATA_VISIBLE:
+                                          VBOX3D_NOTIFY_EVENT_TYPE_3DDATA_HIDDEN,
+                                NULL, 0);
+        mFlags.fNeVisible = fVisible;
+        mFlags.fNeForce = 0;
+    }
+}
+
+
+void CrFbDisplayWindow::ueRegions()
+{
+    if (mpWindow)
+        mpWindow->SetVisibleRegionsChanged();
+}
+
+
+int CrFbDisplayWindow::screenChanged()
+{
+    if (!isUpdating())
+    {
+        WARN(("not updating!"));
+            return VERR_INVALID_STATE;
+    }
+
+    int rc = windowDimensionsSync();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("windowDimensionsSync failed rc %d", rc));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindow::windowSetCompositor(bool fSet)
+{
+    if (!mpWindow)
+        return VINF_SUCCESS;
+
+    if (fSet)
+    {
+        const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(getFramebuffer());
+        return mpWindow->SetCompositor(pCompositor);
+    }
+    return mpWindow->SetCompositor(NULL);
+}
+
+
+int CrFbDisplayWindow::windowCleanup()
+{
+    if (!mpWindow)
+        return VINF_SUCCESS;
+
+    int rc = mpWindow->UpdateBegin();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    rc = windowDimensionsSync(true);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        mpWindow->UpdateEnd();
+        return rc;
+    }
+
+    rc = windowSetCompositor(false);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        mpWindow->UpdateEnd();
+        return rc;
+    }
+
+    mpWindow->UpdateEnd();
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindow::fbCleanup()
+{
+    int rc = windowCleanup();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("windowCleanup failed"));
+        return rc;
+    }
+    return CrFbDisplayBase::fbCleanup();
+}
+
+
+bool CrFbDisplayWindow::isActive()
+{
+    HCR_FRAMEBUFFER hFb = getFramebuffer();
+    return hFb && CrFbIsEnabled(hFb);
+}
+
+
+int CrFbDisplayWindow::windowDimensionsSync(bool fForceCleanup)
+{
+    int rc = VINF_SUCCESS;
+
+    if (!mpWindow)
+        return VINF_SUCCESS;
+
+    //HCR_FRAMEBUFFER hFb = getFramebuffer();
+    if (!fForceCleanup && isActive())
+    {
+        const RTRECT* pRect = getRect();
+
+        if (mpWindow->GetParentId() != mParentId)
+        {
+            rc = mpWindow->Reparent(mParentId);
+            if (!RT_SUCCESS(rc))
+            {
+                WARN(("err"));
+                return rc;
+            }
+        }
+
+        rc = mpWindow->SetPosition(pRect->xLeft - mViewportRect.xLeft, pRect->yTop - mViewportRect.yTop);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+
+        setRegionsChanged();
+
+        rc = mpWindow->SetSize((uint32_t)(pRect->xRight - pRect->xLeft), (uint32_t)(pRect->yBottom - pRect->yTop));
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+
+        rc = mpWindow->SetVisible(!g_CrPresenter.fWindowsForceHidden);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+    }
+    else
+    {
+        rc = mpWindow->SetVisible(false);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+#if 0
+        rc = mpWindow->Reparent(mDefaultParentId);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("err"));
+            return rc;
+        }
+#endif
+    }
+
+    return rc;
+}
+
+
+int CrFbDisplayWindow::windowSync()
+{
+    if (!mpWindow)
+        return VINF_SUCCESS;
+
+    int rc = mpWindow->UpdateBegin();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    rc = windowSetCompositor(true);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        mpWindow->UpdateEnd();
+        return rc;
+    }
+
+    rc = windowDimensionsSync();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        mpWindow->UpdateEnd();
+        return rc;
+    }
+
+    mpWindow->UpdateEnd();
+
+    return rc;
+}
+
+
+int CrFbDisplayWindow::fbSync()
+{
+    int rc = CrFbDisplayBase::fbSync();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    HCR_FRAMEBUFFER hFb = getFramebuffer();
+
+    mu32Screen = CrFbGetScreenInfo(hFb)->u32ViewIndex;
+
+    rc = windowSync();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("windowSync failed %d", rc));
+        return rc;
+    }
+
+    if (CrFbHas3DData(hFb))
+    {
+        if (mpWindow && mpWindow->GetParentId())
+        {
+            rc = mpWindow->Create();
+            if (!RT_SUCCESS(rc))
+            {
+                WARN(("err"));
+                return rc;
+            }
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+const struct RTRECT* CrFbDisplayWindow::getRect()
+{
+    const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(getFramebuffer());
+    return CrVrScrCompositorRectGet(pCompositor);
+}
+
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_window_rootvr.cpp b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_window_rootvr.cpp
new file mode 100644
index 0000000..d408da1
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/display_window_rootvr.cpp
@@ -0,0 +1,347 @@
+/* $Id: display_window_rootvr.cpp $ */
+
+/** @file
+ * Presenter API: CrFbDisplayWindowRootVr class implementation -- display seamless content (visible regions).
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "server_presenter.h"
+
+
+CrFbDisplayWindowRootVr::CrFbDisplayWindowRootVr(const RTRECT *pViewportRect, uint64_t parentId) :
+    CrFbDisplayWindow(pViewportRect, parentId)
+{
+    CrVrScrCompositorInit(&mCompositor, NULL);
+}
+
+
+int CrFbDisplayWindowRootVr::EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayWindow::EntryCreated(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    Assert(!CrFbDDataEntryGet(hEntry, slotGet()));
+
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcEntry = CrFbEntryGetCompositorEntry(hEntry);
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = entryAlloc();
+    CrVrScrCompositorEntryInit(pMyEntry, CrVrScrCompositorEntryRectGet(pSrcEntry), CrVrScrCompositorEntryTexGet(pSrcEntry), NULL);
+    CrVrScrCompositorEntryFlagsSet(pMyEntry, CrVrScrCompositorEntryFlagsGet(pSrcEntry));
+    rc = CrFbDDataEntryPut(hEntry, slotGet(), pMyEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrFbDDataEntryPut failed rc %d", rc));
+        entryFree(pMyEntry);
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindowRootVr::EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayWindow::EntryAdded(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcEntry = CrFbEntryGetCompositorEntry(hEntry);
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
+    Assert(pMyEntry);
+    CrVrScrCompositorEntryTexSet(pMyEntry, CrVrScrCompositorEntryTexGet(pSrcEntry));
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindowRootVr::EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
+{
+    int rc = CrFbDisplayWindow::EntryReplaced(pFb, hNewEntry, hReplacedEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcNewEntry = CrFbEntryGetCompositorEntry(hNewEntry);
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hNewEntry, slotGet());
+    CrVrScrCompositorEntryTexSet(pMyEntry, CrVrScrCompositorEntryTexGet(pSrcNewEntry));
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindowRootVr::EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayWindow::EntryTexChanged(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcEntry = CrFbEntryGetCompositorEntry(hEntry);
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
+    CrVrScrCompositorEntryTexSet(pMyEntry, CrVrScrCompositorEntryTexGet(pSrcEntry));
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindowRootVr::EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayWindow::EntryRemoved(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
+    rc = CrVrScrCompositorEntryRegionsSet(&mCompositor, pMyEntry, NULL, 0, NULL, false, NULL);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindowRootVr::EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    int rc = CrFbDisplayWindow::EntryDestroyed(pFb, hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcEntry = CrFbEntryGetCompositorEntry(hEntry);
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
+    CrVrScrCompositorEntryCleanup(pMyEntry);
+    entryFree(pMyEntry);
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindowRootVr::setViewportRect(const RTRECT *pViewportRect)
+{
+    int rc = CrFbDisplayWindow::setViewportRect(pViewportRect);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    rc = setRegionsChanged();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindowRootVr::windowSetCompositor(bool fSet)
+{
+    if (fSet)
+        return getWindow()->SetCompositor(&mCompositor);
+    return getWindow()->SetCompositor(NULL);
+}
+
+
+void CrFbDisplayWindowRootVr::ueRegions()
+{
+    synchCompositorRegions();
+}
+
+
+int CrFbDisplayWindowRootVr::compositorMarkUpdated()
+{
+    CrVrScrCompositorClear(&mCompositor);
+
+    int rc = CrVrScrCompositorRectSet(&mCompositor, CrVrScrCompositorRectGet(CrFbGetCompositor(getFramebuffer())), NULL);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    rc = setRegionsChanged();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("screenChanged failed %d", rc));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbDisplayWindowRootVr::screenChanged()
+{
+    int rc = compositorMarkUpdated();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    rc = CrFbDisplayWindow::screenChanged();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("screenChanged failed %d", rc));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+const struct RTRECT* CrFbDisplayWindowRootVr::getRect()
+{
+    return CrVrScrCompositorRectGet(&mCompositor);
+}
+
+int CrFbDisplayWindowRootVr::fbCleanup()
+{
+    int rc = clearCompositor();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return CrFbDisplayWindow::fbCleanup();
+}
+
+
+int CrFbDisplayWindowRootVr::fbSync()
+{
+    int rc = synchCompositor();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("err"));
+        return rc;
+    }
+
+    return CrFbDisplayWindow::fbSync();
+}
+
+
+VBOXVR_SCR_COMPOSITOR_ENTRY* CrFbDisplayWindowRootVr::entryAlloc()
+{
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+    return (VBOXVR_SCR_COMPOSITOR_ENTRY*)RTMemCacheAlloc(g_CrPresenter.CEntryLookasideList);
+#else
+    return (VBOXVR_SCR_COMPOSITOR_ENTRY*)RTMemAlloc(sizeof (VBOXVR_SCR_COMPOSITOR_ENTRY));
+#endif
+}
+
+
+void CrFbDisplayWindowRootVr::entryFree(VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry)
+{
+    Assert(!CrVrScrCompositorEntryIsUsed(pEntry));
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+    RTMemCacheFree(g_CrPresenter.CEntryLookasideList, pEntry);
+#else
+    RTMemFree(pEntry);
+#endif
+}
+
+
+int CrFbDisplayWindowRootVr::synchCompositorRegions()
+{
+    int rc;
+
+    rootVrTranslateForPos();
+
+    /* ensure the rootvr compositor does not hold any data,
+     * i.e. cleanup all rootvr entries data */
+    CrVrScrCompositorClear(&mCompositor);
+
+    rc = CrVrScrCompositorIntersectedList(CrFbGetCompositor(getFramebuffer()), &cr_server.RootVr, &mCompositor, rootVrGetCEntry, this, NULL);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrVrScrCompositorIntersectedList failed, rc %d", rc));
+        return rc;
+    }
+
+    return getWindow()->SetVisibleRegionsChanged();
+}
+
+
+int CrFbDisplayWindowRootVr::synchCompositor()
+{
+    int rc = compositorMarkUpdated();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("compositorMarkUpdated failed, rc %d", rc));
+        return rc;
+    }
+
+    rc = fbSynchAddAllEntries();
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("fbSynchAddAllEntries failed, rc %d", rc));
+        return rc;
+    }
+
+    return rc;
+}
+
+
+int CrFbDisplayWindowRootVr::clearCompositor()
+{
+    return fbCleanupRemoveAllEntries();
+}
+
+
+void CrFbDisplayWindowRootVr::rootVrTranslateForPos()
+{
+    const RTRECT *pRect = getViewportRect();
+    const struct VBVAINFOSCREEN* pScreen = CrFbGetScreenInfo(getFramebuffer());
+    int32_t x = pScreen->i32OriginX;
+    int32_t y = pScreen->i32OriginY;
+    int32_t dx = cr_server.RootVrCurPoint.x - x;
+    int32_t dy = cr_server.RootVrCurPoint.y - y;
+
+    cr_server.RootVrCurPoint.x = x;
+    cr_server.RootVrCurPoint.y = y;
+
+    VBoxVrListTranslate(&cr_server.RootVr, dx, dy);
+}
+
+
+DECLCALLBACK(VBOXVR_SCR_COMPOSITOR_ENTRY*) CrFbDisplayWindowRootVr::rootVrGetCEntry(const VBOXVR_SCR_COMPOSITOR_ENTRY*pEntry, void *pvContext)
+{
+    CrFbDisplayWindowRootVr *pThis = (CrFbDisplayWindowRootVr*)pvContext;
+    HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, pThis->slotGet());
+    Assert(!CrVrScrCompositorEntryIsUsed(pMyEntry));
+    CrVrScrCompositorEntryRectSet(&pThis->mCompositor, pMyEntry, CrVrScrCompositorEntryRectGet(pEntry));
+    return pMyEntry;
+}
+
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp
new file mode 100644
index 0000000..61f35b4
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.cpp
@@ -0,0 +1,4037 @@
+/* $Id: server_presenter.cpp $ */
+
+/** @file
+ * Presenter API
+ */
+
+/*
+ * Copyright (C) 2012-2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifdef DEBUG_misha
+# define VBOXVDBG_MEMCACHE_DISABLE
+#endif
+
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+# include <iprt/memcache.h>
+#endif
+
+#include "server_presenter.h"
+
+//#define CR_SERVER_WITH_CLIENT_CALLOUTS
+
+#define PCR_FBTEX_FROM_TEX(_pTex) ((CR_FBTEX*)((uint8_t*)(_pTex) - RT_OFFSETOF(CR_FBTEX, Tex)))
+#define PCR_FRAMEBUFFER_FROM_COMPOSITOR(_pCompositor) ((CR_FRAMEBUFFER*)((uint8_t*)(_pCompositor) - RT_OFFSETOF(CR_FRAMEBUFFER, Compositor)))
+#define PCR_FBENTRY_FROM_ENTRY(_pEntry) ((CR_FRAMEBUFFER_ENTRY*)((uint8_t*)(_pEntry) - RT_OFFSETOF(CR_FRAMEBUFFER_ENTRY, Entry)))
+
+
+static int crPMgrFbConnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeAdd);
+
+CR_PRESENTER_GLOBALS g_CrPresenter;
+
+/* FRAMEBUFFER */
+
+void CrFbInit(CR_FRAMEBUFFER *pFb, uint32_t idFb)
+{
+    RTRECT Rect;
+    Rect.xLeft = 0;
+    Rect.yTop = 0;
+    Rect.xRight = 1;
+    Rect.yBottom = 1;
+    memset(pFb, 0, sizeof (*pFb));
+    pFb->ScreenInfo.u16Flags = VBVA_SCREEN_F_DISABLED;
+    pFb->ScreenInfo.u32ViewIndex = idFb;
+    CrVrScrCompositorInit(&pFb->Compositor, &Rect);
+    RTListInit(&pFb->EntriesList);
+    CrHTableCreate(&pFb->SlotTable, 0);
+}
+
+
+bool CrFbIsEnabled(CR_FRAMEBUFFER *pFb)
+{
+    return !(pFb->ScreenInfo.u16Flags & VBVA_SCREEN_F_DISABLED);
+}
+
+
+const struct VBOXVR_SCR_COMPOSITOR* CrFbGetCompositor(CR_FRAMEBUFFER *pFb)
+{
+    return &pFb->Compositor;
+}
+
+DECLINLINE(CR_FRAMEBUFFER*) CrFbFromCompositor(const struct VBOXVR_SCR_COMPOSITOR* pCompositor)
+{
+    return RT_FROM_MEMBER(pCompositor, CR_FRAMEBUFFER, Compositor);
+}
+
+const struct VBVAINFOSCREEN* CrFbGetScreenInfo(HCR_FRAMEBUFFER hFb)
+{
+    return &hFb->ScreenInfo;
+}
+
+void* CrFbGetVRAM(HCR_FRAMEBUFFER hFb)
+{
+    return hFb->pvVram;
+}
+
+int CrFbUpdateBegin(CR_FRAMEBUFFER *pFb)
+{
+    ++pFb->cUpdating;
+
+    if (pFb->cUpdating == 1)
+    {
+        if (pFb->pDisplay)
+            pFb->pDisplay->UpdateBegin(pFb);
+    }
+
+    return VINF_SUCCESS;
+}
+
+void CrFbUpdateEnd(CR_FRAMEBUFFER *pFb)
+{
+    if (!pFb->cUpdating)
+    {
+        WARN(("invalid UpdateEnd call!"));
+        return;
+    }
+
+    --pFb->cUpdating;
+
+    if (!pFb->cUpdating)
+    {
+        if (pFb->pDisplay)
+            pFb->pDisplay->UpdateEnd(pFb);
+    }
+}
+
+bool CrFbIsUpdating(const CR_FRAMEBUFFER *pFb)
+{
+    return !!pFb->cUpdating;
+}
+
+bool CrFbHas3DData(HCR_FRAMEBUFFER hFb)
+{
+    return !CrVrScrCompositorIsEmpty(&hFb->Compositor);
+}
+
+static void crFbImgFromScreenVram(const VBVAINFOSCREEN *pScreen, void *pvVram, CR_BLITTER_IMG *pImg)
+{
+    pImg->pvData = pvVram;
+    pImg->cbData = pScreen->u32LineSize * pScreen->u32Height;
+    pImg->enmFormat = GL_BGRA;
+    pImg->width = pScreen->u32Width;
+    pImg->height = pScreen->u32Height;
+    pImg->bpp = pScreen->u16BitsPerPixel;
+    pImg->pitch = pScreen->u32LineSize;
+}
+
+static void crFbImgFromDimPtrBGRA(void *pvVram, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg)
+{
+    pImg->pvData = pvVram;
+    pImg->cbData = width * height * 4;
+    pImg->enmFormat = GL_BGRA;
+    pImg->width = width;
+    pImg->height = height;
+    pImg->bpp = 32;
+    pImg->pitch = width * 4;
+}
+
+static int8_t crFbImgFromDimOffVramBGRA(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg)
+{
+    uint32_t cbBuff = width * height * 4;
+    if (offVRAM >= g_cbVRam
+            || offVRAM + cbBuff >= g_cbVRam)
+    {
+        WARN(("invalid param"));
+        return -1;
+    }
+
+    uint8_t *pu8Buf = g_pvVRamBase + offVRAM;
+    crFbImgFromDimPtrBGRA(pu8Buf, width, height, pImg);
+
+    return 0;
+}
+
+static int8_t crFbImgFromDescBGRA(const VBOXCMDVBVA_ALLOCDESC *pDesc, CR_BLITTER_IMG *pImg)
+{
+    return crFbImgFromDimOffVramBGRA(pDesc->Info.u.offVRAM, pDesc->u16Width, pDesc->u16Height, pImg);
+}
+
+static void crFbImgFromFb(HCR_FRAMEBUFFER hFb, CR_BLITTER_IMG *pImg)
+{
+    const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
+    void *pvVram = CrFbGetVRAM(hFb);
+    crFbImgFromScreenVram(pScreen, pvVram, pImg);
+}
+
+static int crFbTexDataGetContents(CR_TEXDATA *pTex, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
+{
+    const CR_BLITTER_IMG *pSrcImg;
+    int rc = CrTdBltDataAcquire(pTex, GL_BGRA, false, &pSrcImg);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrTdBltDataAcquire failed rc %d", rc));
+        return rc;
+    }
+
+    CrMBltImg(pSrcImg, pPos, cRects, pRects, pDst);
+
+    CrTdBltDataRelease(pTex);
+
+    return VINF_SUCCESS;
+}
+
+static int crFbBltGetContentsScaledDirect(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
+{
+    VBOXVR_LIST List;
+    uint32_t c2DRects = 0;
+    CR_TEXDATA *pEnteredTex = NULL;
+    PCR_BLITTER pEnteredBlitter = NULL;
+
+    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
+    int32_t srcWidth = pSrcRectSize->cx;
+    int32_t srcHeight = pSrcRectSize->cy;
+    int32_t dstWidth = pDstRect->xRight - pDstRect->xLeft;
+    int32_t dstHeight = pDstRect->yBottom - pDstRect->yTop;
+
+    RTPOINT DstPoint = {pDstRect->xLeft, pDstRect->yTop};
+    float strX = ((float)dstWidth) / srcWidth;
+    float strY = ((float)dstHeight) / srcHeight;
+    bool fScale = (dstWidth != srcWidth || dstHeight != srcHeight);
+    Assert(fScale);
+
+    /* 'List' contains the destination rectangles to be updated (in pDst coords). */
+    VBoxVrListInit(&List);
+    int rc = VBoxVrListRectsAdd(&List, cRects, pRects, NULL);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("VBoxVrListRectsAdd failed rc %d", rc));
+        goto end;
+    }
+
+    CrVrScrCompositorConstIterInit(&hFb->Compositor, &Iter);
+
+    for(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry = CrVrScrCompositorConstIterNext(&Iter);
+            pEntry;
+            pEntry = CrVrScrCompositorConstIterNext(&Iter))
+    {
+        /* Where the entry would be located in pDst coords, i.e. convert pEntry hFb coord to pDst coord. */
+        RTPOINT ScaledEntryPoint;
+        ScaledEntryPoint.x = CR_FLOAT_RCAST(int32_t, strX * CrVrScrCompositorEntryRectGet(pEntry)->xLeft) + pDstRect->xLeft;
+        ScaledEntryPoint.y = CR_FLOAT_RCAST(int32_t, strY * CrVrScrCompositorEntryRectGet(pEntry)->yTop) + pDstRect->yTop;
+
+        /* Scaled texture size and rect. */
+        uint32_t width = 0, height = 0;
+        RTRECT ScaledSrcRect = {0};
+
+        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
+
+        /* Optimization to avoid entering/leaving the same texture and its blitter. */
+        if (pEnteredTex != pTex)
+        {
+            if (!pEnteredBlitter)
+            {
+                pEnteredBlitter = CrTdBlitterGet(pTex);
+                rc = CrBltEnter(pEnteredBlitter);
+                if (!RT_SUCCESS(rc))
+                {
+                    WARN(("CrBltEnter failed %d", rc));
+                    pEnteredBlitter = NULL;
+                    goto end;
+                }
+            }
+
+            if (pEnteredTex)
+            {
+                CrTdBltLeave(pEnteredTex);
+
+                pEnteredTex = NULL;
+
+                if (pEnteredBlitter != CrTdBlitterGet(pTex))
+                {
+                    WARN(("blitters not equal!"));
+                    CrBltLeave(pEnteredBlitter);
+
+                    pEnteredBlitter = CrTdBlitterGet(pTex);
+                    rc = CrBltEnter(pEnteredBlitter);
+                     if (!RT_SUCCESS(rc))
+                     {
+                         WARN(("CrBltEnter failed %d", rc));
+                         pEnteredBlitter = NULL;
+                         goto end;
+                     }
+                }
+            }
+
+            rc = CrTdBltEnter(pTex);
+            if (!RT_SUCCESS(rc))
+            {
+                WARN(("CrTdBltEnter failed %d", rc));
+                goto end;
+            }
+
+            pEnteredTex = pTex;
+
+            const VBOXVR_TEXTURE *pVrTex = CrTdTexGet(pTex);
+
+            width = CR_FLOAT_RCAST(uint32_t, strX * pVrTex->width);
+            height = CR_FLOAT_RCAST(uint32_t, strY * pVrTex->height);
+            ScaledSrcRect.xLeft = ScaledEntryPoint.x;
+            ScaledSrcRect.yTop = ScaledEntryPoint.y;
+            ScaledSrcRect.xRight = width + ScaledEntryPoint.x;
+            ScaledSrcRect.yBottom = height + ScaledEntryPoint.y;
+        }
+
+        bool fInvert = !(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS);
+
+        /* pRegions is where the pEntry was drawn in hFb coords. */
+        uint32_t cRegions;
+        const RTRECT *pRegions;
+        rc = CrVrScrCompositorEntryRegionsGet(&hFb->Compositor, pEntry, &cRegions, NULL, NULL, &pRegions);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("CrVrScrCompositorEntryRegionsGet failed rc %d", rc));
+            goto end;
+        }
+
+        /* CrTdBltDataAcquireScaled/CrTdBltDataReleaseScaled can use cached data,
+         * so it is not necessary to optimize and Aquire only when Tex changes.
+         */
+        const CR_BLITTER_IMG *pSrcImg;
+        rc = CrTdBltDataAcquireScaled(pTex, GL_BGRA, false, width, height, &pSrcImg);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("CrTdBltDataAcquire failed rc %d", rc));
+            goto end;
+        }
+
+        for (uint32_t j = 0; j < cRegions; ++j)
+        {
+            /* rects are in dst coordinates,
+             * while the pReg is in source coords
+             * convert */
+            const RTRECT * pReg = &pRegions[j];
+            RTRECT ScaledReg;
+            /* scale */
+            VBoxRectScaled(pReg, strX, strY, &ScaledReg);
+            /* translate */
+            VBoxRectTranslate(&ScaledReg, pDstRect->xLeft, pDstRect->yTop);
+
+            /* Exclude the pEntry rectangle, because it will be updated now in pDst.
+             * List uses dst coords and pRegions use hFb coords, therefore use
+             * ScaledReg which is already translated to dst.
+             */
+            rc = VBoxVrListRectsSubst(&List, 1, &ScaledReg, NULL);
+            if (!RT_SUCCESS(rc))
+            {
+                WARN(("VBoxVrListRectsSubst failed rc %d", rc));
+                goto end;
+            }
+
+            for (uint32_t i = 0; i < cRects; ++i)
+            {
+                const RTRECT * pRect = &pRects[i];
+
+                RTRECT Intersection;
+                VBoxRectIntersected(pRect, &ScaledReg, &Intersection);
+                if (VBoxRectIsZero(&Intersection))
+                    continue;
+
+                VBoxRectIntersect(&Intersection, &ScaledSrcRect);
+                if (VBoxRectIsZero(&Intersection))
+                    continue;
+
+                CrMBltImgRect(pSrcImg, &ScaledEntryPoint, fInvert, &Intersection, pDst);
+            }
+        }
+
+        CrTdBltDataReleaseScaled(pTex, pSrcImg);
+    }
+
+    /* Blit still not updated dst rects, i.e. not covered by 3D entries. */
+    c2DRects = VBoxVrListRectsCount(&List);
+    if (c2DRects)
+    {
+        if (g_CrPresenter.cbTmpBuf2 < c2DRects * sizeof (RTRECT))
+        {
+            if (g_CrPresenter.pvTmpBuf2)
+                RTMemFree(g_CrPresenter.pvTmpBuf2);
+
+            g_CrPresenter.cbTmpBuf2 = (c2DRects + 10) * sizeof (RTRECT);
+            g_CrPresenter.pvTmpBuf2 = RTMemAlloc(g_CrPresenter.cbTmpBuf2);
+            if (!g_CrPresenter.pvTmpBuf2)
+            {
+                WARN(("RTMemAlloc failed!"));
+                g_CrPresenter.cbTmpBuf2 = 0;
+                rc = VERR_NO_MEMORY;
+                goto end;
+            }
+        }
+
+        RTRECT *p2DRects  = (RTRECT *)g_CrPresenter.pvTmpBuf2;
+
+        rc = VBoxVrListRectsGet(&List, c2DRects, p2DRects);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("VBoxVrListRectsGet failed, rc %d", rc));
+            goto end;
+        }
+
+        /* p2DRects are in pDst coords and already scaled. */
+
+        CR_BLITTER_IMG FbImg;
+
+        crFbImgFromFb(hFb, &FbImg);
+
+        CrMBltImgScaled(&FbImg, pSrcRectSize, pDstRect, c2DRects, p2DRects, pDst);
+    }
+
+end:
+
+    if (pEnteredTex)
+        CrTdBltLeave(pEnteredTex);
+
+    if (pEnteredBlitter)
+        CrBltLeave(pEnteredBlitter);
+
+    VBoxVrListClear(&List);
+
+    return rc;
+}
+
+static int crFbBltGetContentsScaledCPU(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
+{
+    WARN(("not implemented!"));
+    return VERR_NOT_IMPLEMENTED;
+#if 0
+    int32_t srcWidth = pSrcRectSize->cx;
+    int32_t srcHeight = pSrcRectSize->cy;
+    int32_t dstWidth = pDstRect->xRight - pDstRect->xLeft;
+    int32_t dstHeight = pDstRect->yBottom - pDstRect->yTop;
+
+    RTPOINT DstPoint = {pDstRect->xLeft, pDstRect->yTop};
+    float strX = ((float)dstWidth) / srcWidth;
+    float strY = ((float)dstHeight) / srcHeight;
+
+    RTPOINT UnscaledPos;
+    UnscaledPos.x = CR_FLOAT_RCAST(int32_t, pDstRect->xLeft / strX);
+    UnscaledPos.y = CR_FLOAT_RCAST(int32_t, pDstRect->yTop / strY);
+
+    /* destination is bigger than the source, do 3D data stretching with CPU */
+    CR_BLITTER_IMG Img;
+    Img.cbData = srcWidth * srcHeight * 4;
+    Img.pvData = RTMemAlloc(Img.cbData);
+    if (!Img.pvData)
+    {
+        WARN(("RTMemAlloc Failed"));
+        return VERR_NO_MEMORY;
+    }
+    Img.enmFormat = pImg->enmFormat;
+    Img.width = srcWidth;
+    Img.height = srcHeight;
+    Img.bpp = pImg->bpp;
+    Img.pitch = Img.width * 4;
+
+    int rc = CrFbBltGetContents(hFb, &UnscaledPos, cRects, pRects, &Img);
+    if (RT_SUCCESS(rc))
+    {
+        CrBmpScale32((uint8_t *)pImg->pvData,
+                            pImg->pitch,
+                            pImg->width, pImg->height,
+                            (const uint8_t *)Img.pvData,
+                            Img.pitch,
+                            Img.width, Img.height);
+    }
+    else
+        WARN(("CrFbBltGetContents failed %d", rc));
+
+    RTMemFree(Img.pvData);
+
+    return rc;
+#endif
+}
+
+static int CrFbBltGetContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
+{
+    VBOXVR_LIST List;
+    uint32_t c2DRects = 0;
+    CR_TEXDATA *pEnteredTex = NULL;
+    PCR_BLITTER pEnteredBlitter = NULL;
+
+    /* 'List' contains the destination rectangles to be updated (in pDst coords). */
+    VBoxVrListInit(&List);
+    int rc = VBoxVrListRectsAdd(&List, cRects, pRects, NULL);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("VBoxVrListRectsAdd failed rc %d", rc));
+        goto end;
+    }
+
+    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
+    CrVrScrCompositorConstIterInit(&hFb->Compositor, &Iter);
+
+    for(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry = CrVrScrCompositorConstIterNext(&Iter);
+            pEntry;
+            pEntry = CrVrScrCompositorConstIterNext(&Iter))
+    {
+        /* Where the entry would be located in pDst coords (pPos = pDst_coord - hFb_coord). */
+        RTPOINT EntryPoint;
+        EntryPoint.x = CrVrScrCompositorEntryRectGet(pEntry)->xLeft + pPos->x;
+        EntryPoint.y = CrVrScrCompositorEntryRectGet(pEntry)->yTop + pPos->y;
+
+        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
+
+        /* Optimization to avoid entering/leaving the same texture and its blitter. */
+        if (pEnteredTex != pTex)
+        {
+            if (!pEnteredBlitter)
+            {
+                pEnteredBlitter = CrTdBlitterGet(pTex);
+                rc = CrBltEnter(pEnteredBlitter);
+                if (!RT_SUCCESS(rc))
+                {
+                    WARN(("CrBltEnter failed %d", rc));
+                    pEnteredBlitter = NULL;
+                    goto end;
+                }
+            }
+
+            if (pEnteredTex)
+            {
+                CrTdBltLeave(pEnteredTex);
+
+                pEnteredTex = NULL;
+
+                if (pEnteredBlitter != CrTdBlitterGet(pTex))
+                {
+                    WARN(("blitters not equal!"));
+                    CrBltLeave(pEnteredBlitter);
+
+                    pEnteredBlitter = CrTdBlitterGet(pTex);
+                    rc = CrBltEnter(pEnteredBlitter);
+                     if (!RT_SUCCESS(rc))
+                     {
+                         WARN(("CrBltEnter failed %d", rc));
+                         pEnteredBlitter = NULL;
+                         goto end;
+                     }
+                }
+            }
+
+            rc = CrTdBltEnter(pTex);
+            if (!RT_SUCCESS(rc))
+            {
+                WARN(("CrTdBltEnter failed %d", rc));
+                goto end;
+            }
+
+            pEnteredTex = pTex;
+        }
+
+        bool fInvert = !(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS);
+
+        /* pRegions is where the pEntry was drawn in hFb coords. */
+        uint32_t cRegions;
+        const RTRECT *pRegions;
+        rc = CrVrScrCompositorEntryRegionsGet(&hFb->Compositor, pEntry, &cRegions, NULL, NULL, &pRegions);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("CrVrScrCompositorEntryRegionsGet failed rc %d", rc));
+            goto end;
+        }
+
+        /* CrTdBltDataAcquire/CrTdBltDataRelease can use cached data,
+         * so it is not necessary to optimize and Aquire only when Tex changes.
+         */
+        const CR_BLITTER_IMG *pSrcImg;
+        rc = CrTdBltDataAcquire(pTex, GL_BGRA, false, &pSrcImg);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("CrTdBltDataAcquire failed rc %d", rc));
+            goto end;
+        }
+
+        for (uint32_t j = 0; j < cRegions; ++j)
+        {
+            /* rects are in dst coordinates,
+             * while the pReg is in source coords
+             * convert */
+            const RTRECT * pReg = &pRegions[j];
+            RTRECT SrcReg;
+            /* translate */
+            VBoxRectTranslated(pReg, pPos->x, pPos->y, &SrcReg);
+
+            /* Exclude the pEntry rectangle, because it will be updated now in pDst.
+             * List uses dst coords and pRegions use hFb coords, therefore use
+             * SrcReg which is already translated to dst.
+             */
+            rc = VBoxVrListRectsSubst(&List, 1, &SrcReg, NULL);
+            if (!RT_SUCCESS(rc))
+            {
+                WARN(("VBoxVrListRectsSubst failed rc %d", rc));
+                goto end;
+            }
+
+            for (uint32_t i = 0; i < cRects; ++i)
+            {
+                const RTRECT * pRect = &pRects[i];
+
+                RTRECT Intersection;
+                VBoxRectIntersected(pRect, &SrcReg, &Intersection);
+                if (VBoxRectIsZero(&Intersection))
+                    continue;
+
+                CrMBltImgRect(pSrcImg, &EntryPoint, fInvert, &Intersection, pDst);
+            }
+        }
+
+        CrTdBltDataRelease(pTex);
+    }
+
+    /* Blit still not updated dst rects, i.e. not covered by 3D entries. */
+    c2DRects = VBoxVrListRectsCount(&List);
+    if (c2DRects)
+    {
+        if (g_CrPresenter.cbTmpBuf2 < c2DRects * sizeof (RTRECT))
+        {
+            if (g_CrPresenter.pvTmpBuf2)
+                RTMemFree(g_CrPresenter.pvTmpBuf2);
+
+            g_CrPresenter.cbTmpBuf2 = (c2DRects + 10) * sizeof (RTRECT);
+            g_CrPresenter.pvTmpBuf2 = RTMemAlloc(g_CrPresenter.cbTmpBuf2);
+            if (!g_CrPresenter.pvTmpBuf2)
+            {
+                WARN(("RTMemAlloc failed!"));
+                g_CrPresenter.cbTmpBuf2 = 0;
+                rc = VERR_NO_MEMORY;
+                goto end;
+            }
+        }
+
+        RTRECT *p2DRects  = (RTRECT *)g_CrPresenter.pvTmpBuf2;
+
+        rc = VBoxVrListRectsGet(&List, c2DRects, p2DRects);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("VBoxVrListRectsGet failed, rc %d", rc));
+            goto end;
+        }
+
+        CR_BLITTER_IMG FbImg;
+
+        crFbImgFromFb(hFb, &FbImg);
+
+        CrMBltImg(&FbImg, pPos, c2DRects, p2DRects, pDst);
+    }
+
+end:
+
+    if (pEnteredTex)
+        CrTdBltLeave(pEnteredTex);
+
+    if (pEnteredBlitter)
+        CrBltLeave(pEnteredBlitter);
+
+    VBoxVrListClear(&List);
+
+    return rc;
+}
+
+int CrFbBltGetContentsEx(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
+{
+    uint32_t srcWidth = pSrcRectSize->cx;
+    uint32_t srcHeight = pSrcRectSize->cy;
+    uint32_t dstWidth = pDstRect->xRight - pDstRect->xLeft;
+    uint32_t dstHeight = pDstRect->yBottom - pDstRect->yTop;
+    if (srcWidth == dstWidth
+            && srcHeight == dstHeight)
+    {
+        RTPOINT Pos = {pDstRect->xLeft, pDstRect->yTop};
+        return CrFbBltGetContents(hFb, &Pos, cRects, pRects, pImg);
+    }
+    if (!CrFbHas3DData(hFb)
+            || (srcWidth * srcHeight > dstWidth * dstHeight))
+        return crFbBltGetContentsScaledDirect(hFb, pSrcRectSize, pDstRect, cRects, pRects, pImg);
+
+    return crFbBltGetContentsScaledCPU(hFb, pSrcRectSize, pDstRect, cRects, pRects, pImg);
+}
+
+static void crFbBltPutContentsFbVram(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pSrc)
+{
+    const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor);
+
+    CR_BLITTER_IMG FbImg;
+
+    crFbImgFromFb(hFb, &FbImg);
+
+    CrMBltImg(pSrc, pPos, cRects, pRects, &FbImg);
+}
+
+static void crFbClrFillFbVram(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color)
+{
+    CR_BLITTER_IMG FbImg;
+
+    crFbImgFromFb(hFb, &FbImg);
+
+    CrMClrFillImg(&FbImg, cRects, pRects, u32Color);
+}
+
+int CrFbClrFill(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color)
+{
+    if (!hFb->cUpdating)
+    {
+        WARN(("framebuffer not updating"));
+        return VERR_INVALID_STATE;
+    }
+
+    crFbClrFillFbVram(hFb, cRects, pRects, u32Color);
+
+    RTPOINT DstPoint = {0, 0};
+
+    int rc = CrFbEntryRegionsAdd(hFb, NULL, &DstPoint, cRects, pRects, false);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrFbEntryRegionsAdd failed %d", rc));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int crFbBltPutContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
+{
+    crFbBltPutContentsFbVram(hFb, pPos, cRects, pRects, pImg);
+
+    int rc = CrFbEntryRegionsAdd(hFb, NULL, pPos, cRects, pRects, false);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrFbEntryRegionsAdd failed %d", rc));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+int CrFbBltPutContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
+{
+    if (!hFb->cUpdating)
+    {
+        WARN(("framebuffer not updating"));
+        return VERR_INVALID_STATE;
+    }
+
+    return crFbBltPutContents(hFb, pPos, cRects, pRects, pImg);
+}
+
+static int crFbRegionsIsIntersectRects(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, bool *pfRegChanged)
+{
+    uint32_t cCompRects;
+    const RTRECT *pCompRects;
+    int rc = CrVrScrCompositorRegionsGet(&hFb->Compositor, &cCompRects, NULL, NULL, &pCompRects);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrVrScrCompositorRegionsGet failed rc %d", rc));
+        return rc;
+    }
+
+    bool fRegChanged = false;
+    for (uint32_t i = 0; i < cCompRects; ++i)
+    {
+        const RTRECT *pCompRect = &pCompRects[i];
+        for (uint32_t j = 0; j < cRects; ++j)
+        {
+            const RTRECT *pRect = &pRects[j];
+            if (VBoxRectIsIntersect(pCompRect, pRect))
+            {
+                *pfRegChanged = true;
+                return VINF_SUCCESS;
+            }
+        }
+    }
+
+    *pfRegChanged = false;
+    return VINF_SUCCESS;
+}
+
+int CrFbBltPutContentsNe(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
+{
+    bool fRegChanged = false;
+    int rc = crFbRegionsIsIntersectRects(hFb, cRects, pRects, &fRegChanged);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("crFbRegionsIsIntersectRects failed rc %d", rc));
+        return rc;
+    }
+
+    if (fRegChanged)
+    {
+        rc = CrFbUpdateBegin(hFb);
+        if (RT_SUCCESS(rc))
+        {
+            rc = CrFbBltPutContents(hFb, pPos, cRects, pRects, pImg);
+            if (!RT_SUCCESS(rc))
+                WARN(("CrFbBltPutContents failed rc %d", rc));
+            CrFbUpdateEnd(hFb);
+        }
+        else
+            WARN(("CrFbUpdateBegin failed rc %d", rc));
+
+        return rc;
+    }
+
+    crFbBltPutContentsFbVram(hFb, pPos, cRects, pRects, pImg);
+    return VINF_SUCCESS;
+}
+
+int CrFbClrFillNe(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color)
+{
+    bool fRegChanged = false;
+    int rc = crFbRegionsIsIntersectRects(hFb, cRects, pRects, &fRegChanged);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("crFbRegionsIsIntersectRects failed rc %d", rc));
+        return rc;
+    }
+
+    if (fRegChanged)
+    {
+        rc = CrFbUpdateBegin(hFb);
+        if (RT_SUCCESS(rc))
+        {
+            rc = CrFbClrFill(hFb, cRects, pRects, u32Color);
+            if (!RT_SUCCESS(rc))
+                WARN(("CrFbClrFill failed rc %d", rc));
+            CrFbUpdateEnd(hFb);
+        }
+        else
+            WARN(("CrFbUpdateBegin failed rc %d", rc));
+
+        return rc;
+    }
+
+    crFbClrFillFbVram(hFb, cRects, pRects, u32Color);
+    return VINF_SUCCESS;
+}
+
+int CrFbResize(CR_FRAMEBUFFER *pFb, const struct VBVAINFOSCREEN * pScreen, void *pvVRAM)
+{
+    if (!pFb->cUpdating)
+    {
+        WARN(("no update in progress"));
+        return VERR_INVALID_STATE;
+    }
+
+    int rc = VINF_SUCCESS;
+    if (CrFbIsEnabled(pFb))
+    {
+        rc = CrFbRegionsClear(pFb);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("CrFbRegionsClear failed %d", rc));
+            return rc;
+        }
+    }
+
+    RTRECT Rect;
+    Rect.xLeft = 0;
+    Rect.yTop = 0;
+    Rect.xRight = pScreen->u32Width;
+    Rect.yBottom = pScreen->u32Height;
+    rc = CrVrScrCompositorRectSet(&pFb->Compositor, &Rect, NULL);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrVrScrCompositorRectSet failed rc %d", rc));
+        return rc;
+    }
+
+    pFb->ScreenInfo = *pScreen;
+    pFb->pvVram = pvVRAM ? pvVRAM : g_pvVRamBase + pScreen->u32StartOffset;
+
+    if (pFb->pDisplay)
+        pFb->pDisplay->FramebufferChanged(pFb);
+
+    return VINF_SUCCESS;
+}
+
+void CrFbTerm(CR_FRAMEBUFFER *pFb)
+{
+    if (pFb->cUpdating)
+    {
+        WARN(("update in progress"));
+        return;
+    }
+    uint32_t idFb = pFb->ScreenInfo.u32ViewIndex;
+
+    CrVrScrCompositorClear(&pFb->Compositor);
+    CrHTableDestroy(&pFb->SlotTable);
+
+    Assert(RTListIsEmpty(&pFb->EntriesList));
+    Assert(!pFb->cEntries);
+
+    memset(pFb, 0, sizeof (*pFb));
+
+    pFb->ScreenInfo.u16Flags = VBVA_SCREEN_F_DISABLED;
+    pFb->ScreenInfo.u32ViewIndex = idFb;
+}
+
+ICrFbDisplay* CrFbDisplayGet(CR_FRAMEBUFFER *pFb)
+{
+    return pFb->pDisplay;
+}
+
+int CrFbDisplaySet(CR_FRAMEBUFFER *pFb, ICrFbDisplay *pDisplay)
+{
+    if (pFb->cUpdating)
+    {
+        WARN(("update in progress"));
+        return VERR_INVALID_STATE;
+    }
+
+    if (pFb->pDisplay == pDisplay)
+        return VINF_SUCCESS;
+
+    pFb->pDisplay = pDisplay;
+
+    return VINF_SUCCESS;
+}
+
+#define CR_PMGR_MODE_WINDOW 0x1
+/* mutually exclusive with CR_PMGR_MODE_WINDOW */
+#define CR_PMGR_MODE_ROOTVR 0x2
+#define CR_PMGR_MODE_VRDP   0x4
+#define CR_PMGR_MODE_ALL    0x7
+
+static int crPMgrModeModifyGlobal(uint32_t u32ModeAdd, uint32_t u32ModeRemove);
+static void crPMgrCleanUnusedDisplays();
+
+static CR_FBTEX* crFbTexAlloc()
+{
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+    return (CR_FBTEX*)RTMemCacheAlloc(g_CrPresenter.FbTexLookasideList);
+#else
+    return (CR_FBTEX*)RTMemAlloc(sizeof (CR_FBTEX));
+#endif
+}
+
+static void crFbTexFree(CR_FBTEX *pTex)
+{
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+    RTMemCacheFree(g_CrPresenter.FbTexLookasideList, pTex);
+#else
+    RTMemFree(pTex);
+#endif
+}
+
+static CR_FRAMEBUFFER_ENTRY* crFbEntryAlloc()
+{
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+    return (CR_FRAMEBUFFER_ENTRY*)RTMemCacheAlloc(g_CrPresenter.FbEntryLookasideList);
+#else
+    return (CR_FRAMEBUFFER_ENTRY*)RTMemAlloc(sizeof (CR_FRAMEBUFFER_ENTRY));
+#endif
+}
+
+static void crFbEntryFree(CR_FRAMEBUFFER_ENTRY *pEntry)
+{
+    Assert(!CrVrScrCompositorEntryIsUsed(&pEntry->Entry));
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+    RTMemCacheFree(g_CrPresenter.FbEntryLookasideList, pEntry);
+#else
+    RTMemFree(pEntry);
+#endif
+}
+
+DECLCALLBACK(void) crFbTexRelease(CR_TEXDATA *pTex)
+{
+    CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTex);
+    CRTextureObj *pTobj = pFbTex->pTobj;
+
+    CrTdBltDataCleanupNe(pTex);
+
+    if (pTobj)
+    {
+        crHashtableDelete(g_CrPresenter.pFbTexMap, pTobj->id, NULL);
+
+        crStateReleaseTexture(cr_server.MainContextInfo.pContext, pTobj);
+
+
+        crStateGlobalSharedRelease();
+    }
+
+    crFbTexFree(pFbTex);
+}
+
+void CrFbTexDataInit(CR_TEXDATA* pFbTex, const VBOXVR_TEXTURE *pTex, PFNCRTEXDATA_RELEASED pfnTextureReleased)
+{
+    PCR_BLITTER pBlitter = crServerVBoxBlitterGet();
+
+    CrTdInit(pFbTex, pTex, pBlitter, pfnTextureReleased);
+}
+
+static CR_FBTEX* crFbTexCreate(const VBOXVR_TEXTURE *pTex)
+{
+    CR_FBTEX *pFbTex = crFbTexAlloc();
+    if (!pFbTex)
+    {
+        WARN(("crFbTexAlloc failed!"));
+        return NULL;
+    }
+
+    CrFbTexDataInit(&pFbTex->Tex, pTex, crFbTexRelease);
+    pFbTex->pTobj = NULL;
+
+    return pFbTex;
+}
+
+CR_TEXDATA* CrFbTexDataCreate(const VBOXVR_TEXTURE *pTex)
+{
+    CR_FBTEX *pFbTex = crFbTexCreate(pTex);
+    if (!pFbTex)
+    {
+        WARN(("crFbTexCreate failed!"));
+        return NULL;
+    }
+
+    return &pFbTex->Tex;
+}
+
+static CR_FBTEX* crFbTexAcquire(GLuint idTexture)
+{
+    CR_FBTEX *pFbTex = (CR_FBTEX *)crHashtableSearch(g_CrPresenter.pFbTexMap, idTexture);
+    if (pFbTex)
+    {
+        CrTdAddRef(&pFbTex->Tex);
+        return pFbTex;
+    }
+
+    CRSharedState *pShared = crStateGlobalSharedAcquire();
+    if (!pShared)
+    {
+        WARN(("pShared is null!"));
+        return NULL;
+    }
+
+    CRTextureObj *pTobj = (CRTextureObj*)crHashtableSearch(pShared->textureTable, idTexture);
+    if (!pTobj)
+    {
+        LOG(("pTobj is null!"));
+        crStateGlobalSharedRelease();
+        return NULL;
+    }
+
+    Assert(pTobj->id == idTexture);
+
+    GLuint hwid = crStateGetTextureObjHWID(pTobj);
+    if (!hwid)
+    {
+        WARN(("hwId is null!"));
+        crStateGlobalSharedRelease();
+        return NULL;
+    }
+
+    VBOXVR_TEXTURE Tex;
+    Tex.width = pTobj->level[0]->width;
+    Tex.height = pTobj->level[0]->height;
+    Tex.hwid = hwid;
+    Tex.target = pTobj->target;
+
+    pFbTex = crFbTexCreate(&Tex);
+    if (!pFbTex)
+    {
+        WARN(("crFbTexCreate failed!"));
+        crStateGlobalSharedRelease();
+        return NULL;
+    }
+
+    CR_STATE_SHAREDOBJ_USAGE_SET(pTobj, cr_server.MainContextInfo.pContext);
+
+    pFbTex->pTobj = pTobj;
+
+    crHashtableAdd(g_CrPresenter.pFbTexMap, idTexture, pFbTex);
+
+    return pFbTex;
+}
+
+static CR_TEXDATA* CrFbTexDataAcquire(GLuint idTexture)
+{
+    CR_FBTEX* pTex = crFbTexAcquire(idTexture);
+    if (!pTex)
+    {
+        WARN(("crFbTexAcquire failed for %d", idTexture));
+        return NULL;
+    }
+
+    return &pTex->Tex;
+}
+
+static void crFbEntryMarkDestroyed(CR_FRAMEBUFFER *pFb, CR_FRAMEBUFFER_ENTRY* pEntry)
+{
+    if (pEntry->Flags.fCreateNotified)
+    {
+        pEntry->Flags.fCreateNotified = 0;
+        if (pFb->pDisplay)
+            pFb->pDisplay->EntryDestroyed(pFb, pEntry);
+
+        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&pEntry->Entry);
+        if (pTex)
+            CrTdBltDataInvalidateNe(pTex);
+    }
+}
+
+static void crFbEntryDestroy(CR_FRAMEBUFFER *pFb, CR_FRAMEBUFFER_ENTRY* pEntry)
+{
+    crFbEntryMarkDestroyed(pFb, pEntry);
+    CrVrScrCompositorEntryCleanup(&pEntry->Entry);
+    CrHTableDestroy(&pEntry->HTable);
+    Assert(pFb->cEntries);
+    RTListNodeRemove(&pEntry->Node);
+    --pFb->cEntries;
+    crFbEntryFree(pEntry);
+}
+
+DECLINLINE(uint32_t) crFbEntryAddRef(CR_FRAMEBUFFER_ENTRY* pEntry)
+{
+    return ++pEntry->cRefs;
+}
+
+DECLINLINE(uint32_t) crFbEntryRelease(CR_FRAMEBUFFER *pFb, CR_FRAMEBUFFER_ENTRY* pEntry)
+{
+    uint32_t cRefs = --pEntry->cRefs;
+    if (!cRefs)
+        crFbEntryDestroy(pFb, pEntry);
+    return cRefs;
+}
+
+static DECLCALLBACK(void) crFbEntryReleased(const struct VBOXVR_SCR_COMPOSITOR *pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacingEntry)
+{
+    CR_FRAMEBUFFER *pFb = PCR_FRAMEBUFFER_FROM_COMPOSITOR(pCompositor);
+    CR_FRAMEBUFFER_ENTRY *pFbEntry = PCR_FBENTRY_FROM_ENTRY(pEntry);
+    CR_FRAMEBUFFER_ENTRY *pFbReplacingEntry = pReplacingEntry ? PCR_FBENTRY_FROM_ENTRY(pReplacingEntry) : NULL;
+    if (pFbReplacingEntry)
+    {
+        /*replace operation implies the replaced entry gets auto-destroyed,
+         * while all its data gets moved to the *clean* replacing entry
+         * 1. ensure the replacing entry is cleaned up */
+        crFbEntryMarkDestroyed(pFb, pFbReplacingEntry);
+
+        CrHTableMoveTo(&pFbEntry->HTable, &pFbReplacingEntry->HTable);
+
+        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&pFbEntry->Entry);
+        CR_TEXDATA *pReplacingTex = CrVrScrCompositorEntryTexGet(&pFbReplacingEntry->Entry);
+
+        CrTdBltScaleCacheMoveTo(pTex, pReplacingTex);
+
+        if (pFb->pDisplay)
+            pFb->pDisplay->EntryReplaced(pFb, pFbReplacingEntry, pFbEntry);
+
+        CrTdBltDataInvalidateNe(pTex);
+
+        /* 2. mark the replaced entry is destroyed */
+        Assert(pFbEntry->Flags.fCreateNotified);
+        Assert(pFbEntry->Flags.fInList);
+        pFbEntry->Flags.fCreateNotified = 0;
+        pFbEntry->Flags.fInList = 0;
+        pFbReplacingEntry->Flags.fCreateNotified = 1;
+        pFbReplacingEntry->Flags.fInList = 1;
+    }
+    else
+    {
+        if (pFbEntry->Flags.fInList)
+        {
+            pFbEntry->Flags.fInList = 0;
+            if (pFb->pDisplay)
+                pFb->pDisplay->EntryRemoved(pFb, pFbEntry);
+
+            CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&pFbEntry->Entry);
+            if (pTex)
+                CrTdBltDataInvalidateNe(pTex);
+        }
+    }
+
+    crFbEntryRelease(pFb, pFbEntry);
+}
+
+static CR_FRAMEBUFFER_ENTRY* crFbEntryCreate(CR_FRAMEBUFFER *pFb, CR_TEXDATA* pTex, const RTRECT *pRect, uint32_t fFlags)
+{
+    CR_FRAMEBUFFER_ENTRY *pEntry = crFbEntryAlloc();
+    if (!pEntry)
+    {
+        WARN(("crFbEntryAlloc failed!"));
+        return NULL;
+    }
+
+    CrVrScrCompositorEntryInit(&pEntry->Entry, pRect, pTex, crFbEntryReleased);
+    CrVrScrCompositorEntryFlagsSet(&pEntry->Entry, fFlags);
+    pEntry->cRefs = 1;
+    pEntry->Flags.Value = 0;
+    CrHTableCreate(&pEntry->HTable, 0);
+
+    RTListAppend(&pFb->EntriesList, &pEntry->Node);
+    ++pFb->cEntries;
+
+    return pEntry;
+}
+
+int CrFbEntryCreateForTexData(CR_FRAMEBUFFER *pFb, struct CR_TEXDATA *pTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry)
+{
+    if (pTex == NULL)
+    {
+        WARN(("pTex is NULL"));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    RTRECT Rect;
+    Rect.xLeft = 0;
+    Rect.yTop = 0;
+    Rect.xRight = pTex->Tex.width;
+    Rect.yBottom = pTex->Tex.height;
+    CR_FRAMEBUFFER_ENTRY* pEntry = crFbEntryCreate(pFb, pTex, &Rect, fFlags);
+    if (!pEntry)
+    {
+        WARN(("crFbEntryCreate failed"));
+        return VERR_NO_MEMORY;
+    }
+
+    *phEntry = pEntry;
+    return VINF_SUCCESS;
+}
+
+int CrFbEntryTexDataUpdate(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY pEntry, struct CR_TEXDATA *pTex)
+{
+    if (!pFb->cUpdating)
+    {
+        WARN(("framebuffer not updating"));
+        return VERR_INVALID_STATE;
+    }
+
+    if (pTex)
+        CrVrScrCompositorEntryTexSet(&pEntry->Entry, pTex);
+
+    if (CrVrScrCompositorEntryIsUsed(&pEntry->Entry))
+    {
+        if (pFb->pDisplay)
+            pFb->pDisplay->EntryTexChanged(pFb, pEntry);
+
+        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&pEntry->Entry);
+        if (pTex)
+            CrTdBltDataInvalidateNe(pTex);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbEntryCreateForTexId(CR_FRAMEBUFFER *pFb, GLuint idTexture, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry)
+{
+    CR_FBTEX* pFbTex = crFbTexAcquire(idTexture);
+    if (!pFbTex)
+    {
+        LOG(("crFbTexAcquire failed"));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    CR_TEXDATA* pTex = &pFbTex->Tex;
+    int rc = CrFbEntryCreateForTexData(pFb, pTex, fFlags, phEntry);
+    if (!RT_SUCCESS(rc))
+    {
+    	WARN(("CrFbEntryCreateForTexData failed rc %d", rc));
+    }
+
+    /*always release the tex, the CrFbEntryCreateForTexData will do incref as necessary */
+    CrTdRelease(pTex);
+    return rc;
+}
+
+void CrFbEntryAddRef(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    ++hEntry->cRefs;
+}
+
+void CrFbEntryRelease(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    crFbEntryRelease(pFb, hEntry);
+}
+
+static int8_t crVBoxServerCrCmdBltPrimaryVramGenericProcess(uint32_t u32PrimaryID, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, bool fToPrimary);
+
+int CrFbRegionsClear(HCR_FRAMEBUFFER hFb)
+{
+    if (!hFb->cUpdating)
+    {
+        WARN(("framebuffer not updating"));
+        return VERR_INVALID_STATE;
+    }
+
+    uint32_t cRegions;
+    const RTRECT *pRegions;
+    int rc = CrVrScrCompositorRegionsGet(&hFb->Compositor, &cRegions, NULL, NULL, &pRegions);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrVrScrCompositorEntryRegionsGet failed rc %d", rc));
+        return rc;
+    }
+
+    const struct VBVAINFOSCREEN* pScreen = CrFbGetScreenInfo(hFb);
+    VBOXCMDVBVAOFFSET offVRAM = (VBOXCMDVBVAOFFSET)(((uintptr_t)CrFbGetVRAM(hFb)) - ((uintptr_t)g_pvVRamBase));
+    RTPOINT Pos = {0,0};
+    int8_t i8Result = crVBoxServerCrCmdBltPrimaryVramGenericProcess(pScreen->u32ViewIndex, offVRAM, pScreen->u32Width, pScreen->u32Height, &Pos, cRegions, pRegions, true);
+    if (i8Result)
+    {
+        WARN(("crVBoxServerCrCmdBltPrimaryVramGenericProcess failed"));
+        return VERR_INTERNAL_ERROR;
+    }
+
+#ifdef DEBUG
+    {
+        uint32_t cTmpRegions;
+        const RTRECT *pTmpRegions;
+        int tmpRc = CrVrScrCompositorRegionsGet(&hFb->Compositor, &cTmpRegions, NULL, NULL, &pTmpRegions);
+        if (!RT_SUCCESS(tmpRc))
+        {
+            WARN(("CrVrScrCompositorEntryRegionsGet failed rc %d", tmpRc));
+        }
+        Assert(!cTmpRegions);
+    }
+#endif
+
+    /* just in case */
+    bool fChanged = false;
+    CrVrScrCompositorRegionsClear(&hFb->Compositor, &fChanged);
+    Assert(!fChanged);
+
+    if (cRegions)
+    {
+        if (hFb->pDisplay)
+            hFb->pDisplay->RegionsChanged(hFb);
+    }
+
+    return VINF_SUCCESS;
+}
+
+int CrFbEntryRegionsAdd(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated)
+{
+    if (!pFb->cUpdating)
+    {
+        WARN(("framebuffer not updating"));
+        return VERR_INVALID_STATE;
+    }
+
+    uint32_t fChangeFlags = 0;
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacedScrEntry = NULL;
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pNewEntry;
+    bool fEntryWasInList;
+
+    if (hEntry)
+    {
+        crFbEntryAddRef(hEntry);
+        pNewEntry = &hEntry->Entry;
+        fEntryWasInList = CrVrScrCompositorEntryIsUsed(pNewEntry);
+
+        Assert(!hEntry->Flags.fInList == !fEntryWasInList);
+    }
+    else
+    {
+        pNewEntry = NULL;
+        fEntryWasInList = false;
+    }
+
+    int rc = CrVrScrCompositorEntryRegionsAdd(&pFb->Compositor, hEntry ? &hEntry->Entry : NULL, pPos, cRegions, paRegions, fPosRelated, &pReplacedScrEntry, &fChangeFlags);
+    if (RT_SUCCESS(rc))
+    {
+        if (fChangeFlags & VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED)
+        {
+            if (!fEntryWasInList && pNewEntry)
+            {
+                Assert(CrVrScrCompositorEntryIsUsed(pNewEntry));
+                if (!hEntry->Flags.fCreateNotified)
+                {
+                    hEntry->Flags.fCreateNotified = 1;
+                    if (pFb->pDisplay)
+                        pFb->pDisplay->EntryCreated(pFb, hEntry);
+                }
+
+#ifdef DEBUG_misha
+                /* in theory hEntry->Flags.fInList can be set if entry is replaced,
+                 * but then modified to fit the compositor rects,
+                 * and so we get the regions changed notification as a result
+                 * this should not generally happen though, so put an assertion to debug that situation */
+                Assert(!hEntry->Flags.fInList);
+#endif
+                if (!hEntry->Flags.fInList)
+                {
+                    hEntry->Flags.fInList = 1;
+
+                    if (pFb->pDisplay)
+                        pFb->pDisplay->EntryAdded(pFb, hEntry);
+                }
+            }
+            if (pFb->pDisplay)
+                pFb->pDisplay->RegionsChanged(pFb);
+
+            Assert(!pReplacedScrEntry);
+        }
+        else if (fChangeFlags & VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED)
+        {
+            Assert(pReplacedScrEntry);
+            /* we have already processed that in a "release" callback */
+            Assert(hEntry);
+        }
+        else
+        {
+            Assert(!fChangeFlags);
+            Assert(!pReplacedScrEntry);
+        }
+
+        if (hEntry)
+        {
+            if (CrVrScrCompositorEntryIsUsed(&hEntry->Entry))
+            {
+                if (pFb->pDisplay)
+                    pFb->pDisplay->EntryTexChanged(pFb, hEntry);
+
+                CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&hEntry->Entry);
+                if (pTex)
+                    CrTdBltDataInvalidateNe(pTex);
+            }
+        }
+    }
+    else
+        WARN(("CrVrScrCompositorEntryRegionsAdd failed, rc %d", rc));
+
+    return rc;
+}
+
+int CrFbEntryRegionsSet(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated)
+{
+    if (!pFb->cUpdating)
+    {
+        WARN(("framebuffer not updating"));
+        return VERR_INVALID_STATE;
+    }
+
+    bool fChanged = 0;
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacedScrEntry = NULL;
+    VBOXVR_SCR_COMPOSITOR_ENTRY *pNewEntry;
+    bool fEntryWasInList;
+
+    if (hEntry)
+    {
+        crFbEntryAddRef(hEntry);
+        pNewEntry = &hEntry->Entry;
+        fEntryWasInList = CrVrScrCompositorEntryIsUsed(pNewEntry);
+        Assert(!hEntry->Flags.fInList == !fEntryWasInList);
+    }
+    else
+    {
+        pNewEntry = NULL;
+        fEntryWasInList = false;
+    }
+
+    int rc = CrVrScrCompositorEntryRegionsSet(&pFb->Compositor, pNewEntry, pPos, cRegions, paRegions, fPosRelated, &fChanged);
+    if (RT_SUCCESS(rc))
+    {
+        if (fChanged)
+        {
+            if (!fEntryWasInList && pNewEntry)
+            {
+                if (CrVrScrCompositorEntryIsUsed(pNewEntry))
+                {
+                    if (!hEntry->Flags.fCreateNotified)
+                    {
+                        hEntry->Flags.fCreateNotified = 1;
+
+                        if (pFb->pDisplay)
+                            pFb->pDisplay->EntryCreated(pFb, hEntry);
+                    }
+
+                    Assert(!hEntry->Flags.fInList);
+                    hEntry->Flags.fInList = 1;
+
+                    if (pFb->pDisplay)
+                        pFb->pDisplay->EntryAdded(pFb, hEntry);
+                }
+            }
+
+            if (pFb->pDisplay)
+                pFb->pDisplay->RegionsChanged(pFb);
+        }
+
+        if (hEntry)
+        {
+            if (CrVrScrCompositorEntryIsUsed(&hEntry->Entry))
+            {
+                if (pFb->pDisplay)
+                    pFb->pDisplay->EntryTexChanged(pFb, hEntry);
+
+                CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&hEntry->Entry);
+                if (pTex)
+                    CrTdBltDataInvalidateNe(pTex);
+            }
+        }
+    }
+    else
+        WARN(("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc));
+
+    return rc;
+}
+
+const struct VBOXVR_SCR_COMPOSITOR_ENTRY* CrFbEntryGetCompositorEntry(HCR_FRAMEBUFFER_ENTRY hEntry)
+{
+    return &hEntry->Entry;
+}
+
+HCR_FRAMEBUFFER_ENTRY CrFbEntryFromCompositorEntry(const struct VBOXVR_SCR_COMPOSITOR_ENTRY* pCEntry)
+{
+    return RT_FROM_MEMBER(pCEntry, CR_FRAMEBUFFER_ENTRY, Entry);
+}
+
+void CrFbVisitCreatedEntries(HCR_FRAMEBUFFER hFb, PFNCR_FRAMEBUFFER_ENTRIES_VISITOR_CB pfnVisitorCb, void *pvContext)
+{
+    HCR_FRAMEBUFFER_ENTRY hEntry, hNext;
+    RTListForEachSafe(&hFb->EntriesList, hEntry, hNext, CR_FRAMEBUFFER_ENTRY, Node)
+    {
+        if (hEntry->Flags.fCreateNotified)
+        {
+            if (!pfnVisitorCb(hFb, hEntry, pvContext))
+                return;
+        }
+    }
+}
+
+
+CRHTABLE_HANDLE CrFbDDataAllocSlot(CR_FRAMEBUFFER *pFb)
+{
+    return CrHTablePut(&pFb->SlotTable, (void*)1);
+}
+
+void CrFbDDataReleaseSlot(CR_FRAMEBUFFER *pFb, CRHTABLE_HANDLE hSlot, PFNCR_FRAMEBUFFER_SLOT_RELEASE_CB pfnReleaseCb, void *pvContext)
+{
+    HCR_FRAMEBUFFER_ENTRY hEntry, hNext;
+    RTListForEachSafe(&pFb->EntriesList, hEntry, hNext, CR_FRAMEBUFFER_ENTRY, Node)
+    {
+        if (CrFbDDataEntryGet(hEntry, hSlot))
+        {
+            if (pfnReleaseCb)
+                pfnReleaseCb(pFb, hEntry, pvContext);
+
+            CrFbDDataEntryClear(hEntry, hSlot);
+        }
+    }
+
+    CrHTableRemove(&pFb->SlotTable, hSlot);
+}
+
+int CrFbDDataEntryPut(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot, void *pvData)
+{
+    return CrHTablePutToSlot(&hEntry->HTable, hSlot, pvData);
+}
+
+void* CrFbDDataEntryClear(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot)
+{
+    return CrHTableRemove(&hEntry->HTable, hSlot);
+}
+
+void* CrFbDDataEntryGet(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot)
+{
+    return CrHTableGet(&hEntry->HTable, hSlot);
+}
+
+int CrPMgrDisable()
+{
+    if (!g_CrPresenter.fEnabled)
+        return VINF_SUCCESS;
+
+    g_CrPresenter.u32DisabledDisplayMode = g_CrPresenter.u32DisplayMode;
+
+    int rc = crPMgrModeModifyGlobal(0, CR_PMGR_MODE_WINDOW);
+    if (RT_FAILURE(rc))
+    {
+        WARN(("crPMgrModeModifyGlobal failed %d", rc));
+        return rc;
+    }
+
+    crPMgrCleanUnusedDisplays();
+
+    g_CrPresenter.fEnabled = false;
+
+    return VINF_SUCCESS;
+}
+
+int CrPMgrEnable()
+{
+    if (g_CrPresenter.fEnabled)
+        return VINF_SUCCESS;
+
+    g_CrPresenter.fEnabled = true;
+
+    int rc = crPMgrModeModifyGlobal(g_CrPresenter.u32DisabledDisplayMode, 0);
+    if (RT_FAILURE(rc))
+    {
+        WARN(("crPMgrModeModifyGlobal failed %d", rc));
+        g_CrPresenter.fEnabled = false;
+        return rc;
+    }
+
+    g_CrPresenter.u32DisabledDisplayMode = 0;
+
+    return VINF_SUCCESS;
+}
+
+int CrPMgrInit()
+{
+    int rc = VINF_SUCCESS;
+    memset(&g_CrPresenter, 0, sizeof (g_CrPresenter));
+    g_CrPresenter.fEnabled = true;
+    for (int i = 0; i < RT_ELEMENTS(g_CrPresenter.aDisplayInfos); ++i)
+    {
+        g_CrPresenter.aDisplayInfos[i].u32Id = i;
+        g_CrPresenter.aDisplayInfos[i].iFb = -1;
+
+        g_CrPresenter.aFbInfos[i].u32Id = i;
+    }
+
+    g_CrPresenter.pFbTexMap = crAllocHashtable();
+    if (g_CrPresenter.pFbTexMap)
+    {
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+        rc = RTMemCacheCreate(&g_CrPresenter.FbEntryLookasideList, sizeof (CR_FRAMEBUFFER_ENTRY),
+                                0, /* size_t cbAlignment */
+                                UINT32_MAX, /* uint32_t cMaxObjects */
+                                NULL, /* PFNMEMCACHECTOR pfnCtor*/
+                                NULL, /* PFNMEMCACHEDTOR pfnDtor*/
+                                NULL, /* void *pvUser*/
+                                0 /* uint32_t fFlags*/
+                                );
+        if (RT_SUCCESS(rc))
+        {
+            rc = RTMemCacheCreate(&g_CrPresenter.FbTexLookasideList, sizeof (CR_FBTEX),
+                                        0, /* size_t cbAlignment */
+                                        UINT32_MAX, /* uint32_t cMaxObjects */
+                                        NULL, /* PFNMEMCACHECTOR pfnCtor*/
+                                        NULL, /* PFNMEMCACHEDTOR pfnDtor*/
+                                        NULL, /* void *pvUser*/
+                                        0 /* uint32_t fFlags*/
+                                        );
+            if (RT_SUCCESS(rc))
+            {
+                rc = RTMemCacheCreate(&g_CrPresenter.CEntryLookasideList, sizeof (VBOXVR_SCR_COMPOSITOR_ENTRY),
+                                            0, /* size_t cbAlignment */
+                                            UINT32_MAX, /* uint32_t cMaxObjects */
+                                            NULL, /* PFNMEMCACHECTOR pfnCtor*/
+                                            NULL, /* PFNMEMCACHEDTOR pfnDtor*/
+                                            NULL, /* void *pvUser*/
+                                            0 /* uint32_t fFlags*/
+                                            );
+                if (RT_SUCCESS(rc))
+                {
+#endif
+                    rc = crPMgrModeModifyGlobal(CR_PMGR_MODE_WINDOW, 0);
+                    if (RT_SUCCESS(rc))
+                        return VINF_SUCCESS;
+                    else
+                        WARN(("crPMgrModeModifyGlobal failed rc %d", rc));
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+                    RTMemCacheDestroy(g_CrPresenter.CEntryLookasideList);
+                }
+                else
+                    WARN(("RTMemCacheCreate failed rc %d", rc));
+
+                RTMemCacheDestroy(g_CrPresenter.FbTexLookasideList);
+            }
+            else
+                WARN(("RTMemCacheCreate failed rc %d", rc));
+
+            RTMemCacheDestroy(g_CrPresenter.FbEntryLookasideList);
+        }
+        else
+            WARN(("RTMemCacheCreate failed rc %d", rc));
+#endif
+    }
+    else
+    {
+        WARN(("crAllocHashtable failed"));
+        rc = VERR_NO_MEMORY;
+    }
+    return rc;
+}
+
+void CrPMgrTerm()
+{
+    crPMgrModeModifyGlobal(0, CR_PMGR_MODE_ALL);
+
+    HCR_FRAMEBUFFER hFb;
+
+    for (hFb = CrPMgrFbGetFirstInitialized();
+            hFb;
+            hFb = CrPMgrFbGetNextInitialized(hFb))
+    {
+        uint32_t iFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
+        CrFbDisplaySet(hFb, NULL);
+        CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[iFb];
+        if (pFbInfo->pDpComposite)
+        {
+            delete pFbInfo->pDpComposite;
+            pFbInfo->pDpComposite = NULL;
+        }
+
+        CrFbTerm(hFb);
+    }
+
+    crPMgrCleanUnusedDisplays();
+
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+    RTMemCacheDestroy(g_CrPresenter.FbEntryLookasideList);
+    RTMemCacheDestroy(g_CrPresenter.FbTexLookasideList);
+    RTMemCacheDestroy(g_CrPresenter.CEntryLookasideList);
+#endif
+    crFreeHashtable(g_CrPresenter.pFbTexMap, NULL);
+
+    if (g_CrPresenter.pvTmpBuf)
+        RTMemFree(g_CrPresenter.pvTmpBuf);
+
+    if (g_CrPresenter.pvTmpBuf2)
+        RTMemFree(g_CrPresenter.pvTmpBuf2);
+
+    memset(&g_CrPresenter, 0, sizeof (g_CrPresenter));
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGet(uint32_t idFb)
+{
+    if (idFb >= CR_MAX_GUEST_MONITORS)
+    {
+        WARN(("invalid idFb %d", idFb));
+        return NULL;
+    }
+
+    if (!CrFBmIsSet(&g_CrPresenter.FramebufferInitMap, idFb))
+    {
+        CrFbInit(&g_CrPresenter.aFramebuffers[idFb], idFb);
+        CrFBmSetAtomic(&g_CrPresenter.FramebufferInitMap, idFb);
+    }
+    else
+        Assert(g_CrPresenter.aFramebuffers[idFb].ScreenInfo.u32ViewIndex == idFb);
+
+    return &g_CrPresenter.aFramebuffers[idFb];
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGetInitialized(uint32_t idFb)
+{
+    if (idFb >= CR_MAX_GUEST_MONITORS)
+    {
+        WARN(("invalid idFb %d", idFb));
+        return NULL;
+    }
+
+    if (!CrFBmIsSet(&g_CrPresenter.FramebufferInitMap, idFb))
+    {
+        return NULL;
+    }
+    else
+        Assert(g_CrPresenter.aFramebuffers[idFb].ScreenInfo.u32ViewIndex == idFb);
+
+    return &g_CrPresenter.aFramebuffers[idFb];
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGetEnabled(uint32_t idFb)
+{
+    HCR_FRAMEBUFFER hFb = CrPMgrFbGetInitialized(idFb);
+
+    if(hFb && CrFbIsEnabled(hFb))
+        return hFb;
+
+    return NULL;
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGetEnabledForScreen(uint32_t idScreen)
+{
+    if (idScreen >= (uint32_t)cr_server.screenCount)
+    {
+        WARN(("invalid target id"));
+        return NULL;
+    }
+
+    const CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
+    if (pDpInfo->iFb < 0)
+        return NULL;
+
+    return CrPMgrFbGetEnabled(pDpInfo->iFb);
+}
+
+static HCR_FRAMEBUFFER crPMgrFbGetNextEnabled(uint32_t i)
+{
+    for (;i < (uint32_t)cr_server.screenCount; ++i)
+    {
+        HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(i);
+        if (hFb)
+            return hFb;
+    }
+
+    return NULL;
+}
+
+static HCR_FRAMEBUFFER crPMgrFbGetNextInitialized(uint32_t i)
+{
+    for (;i < (uint32_t)cr_server.screenCount; ++i)
+    {
+        HCR_FRAMEBUFFER hFb = CrPMgrFbGetInitialized(i);
+        if (hFb)
+            return hFb;
+    }
+
+    return NULL;
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGetFirstEnabled()
+{
+    HCR_FRAMEBUFFER hFb = crPMgrFbGetNextEnabled(0);
+//    if (!hFb)
+//        WARN(("no enabled framebuffer found"));
+    return hFb;
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGetNextEnabled(HCR_FRAMEBUFFER hFb)
+{
+    return crPMgrFbGetNextEnabled(hFb->ScreenInfo.u32ViewIndex+1);
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGetFirstInitialized()
+{
+    HCR_FRAMEBUFFER hFb = crPMgrFbGetNextInitialized(0);
+//    if (!hFb)
+//        WARN(("no initialized framebuffer found"));
+    return hFb;
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGetNextInitialized(HCR_FRAMEBUFFER hFb)
+{
+    return crPMgrFbGetNextInitialized(hFb->ScreenInfo.u32ViewIndex+1);
+}
+
+HCR_FRAMEBUFFER CrPMgrFbGetEnabledByVramStart(VBOXCMDVBVAOFFSET offVRAM)
+{
+    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled();
+            hFb;
+            hFb = CrPMgrFbGetNextEnabled(hFb))
+    {
+        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
+        if (pScreen->u32StartOffset == offVRAM)
+            return hFb;
+    }
+
+    return NULL;
+}
+
+
+static uint32_t crPMgrModeAdjustVal(uint32_t u32Mode)
+{
+    u32Mode = CR_PMGR_MODE_ALL & u32Mode;
+    if (CR_PMGR_MODE_ROOTVR & u32Mode)
+        u32Mode &= ~CR_PMGR_MODE_WINDOW;
+    return u32Mode;
+}
+
+static int crPMgrCheckInitWindowDisplays(uint32_t idScreen)
+{
+#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
+    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
+    if (pDpInfo->iFb >= 0)
+    {
+        uint32_t u32ModeAdd = g_CrPresenter.u32DisplayMode & (CR_PMGR_MODE_WINDOW | CR_PMGR_MODE_ROOTVR);
+        int rc = crPMgrFbConnectTargetDisplays(&g_CrPresenter.aFramebuffers[pDpInfo->iFb], pDpInfo, u32ModeAdd);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbConnectTargetDisplays failed %d", rc));
+            return rc;
+        }
+    }
+#endif
+    return VINF_SUCCESS;
+}
+
+extern "C" DECLEXPORT(int) VBoxOglSetScaleFactor(uint32_t idScreen, double dScaleFactorW, double dScaleFactorH)
+{
+    if (idScreen >= CR_MAX_GUEST_MONITORS)
+    {
+        crDebug("Can't set scale factor because specified screen ID (%u) is out of range (max=%d).", idScreen, CR_MAX_GUEST_MONITORS);
+        return VERR_INVALID_PARAMETER;
+    }
+
+    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
+    if (pDpInfo->pDpWin)
+    {
+        CrFbWindow *pWin = pDpInfo->pDpWin->getWindow();
+        if (pWin)
+        {
+            bool rc;
+            crDebug("Set scale factor for initialized display.");
+            rc = pWin->SetScaleFactor((GLdouble)dScaleFactorW, (GLdouble)dScaleFactorH);
+            return rc ? 0 : VERR_LOCK_FAILED;
+        }
+        else
+            crDebug("Can't apply scale factor at the moment bacause overlay window obgect not yet created. Will be chached.");
+    }
+    else
+        crDebug("Can't apply scale factor at the moment bacause display not yet initialized. Will be chached.");
+
+    /* Display output not yet initialized. Let's cache values. */
+    pDpInfo->dInitialScaleFactorW = dScaleFactorW;
+    pDpInfo->dInitialScaleFactorH = dScaleFactorH;
+
+    return 0;
+}
+
+int CrPMgrScreenChanged(uint32_t idScreen)
+{
+    if (idScreen >= CR_MAX_GUEST_MONITORS)
+    {
+        WARN(("invalid idScreen %d", idScreen));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    int rc = VINF_SUCCESS;
+
+    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
+    HCR_FRAMEBUFFER    hFb     = pDpInfo->iFb >= 0 ? CrPMgrFbGet(pDpInfo->iFb) : NULL;
+
+    if (hFb && CrFbIsUpdating(hFb))
+    {
+        WARN(("trying to update viewport while framebuffer is being updated"));
+        return VERR_INVALID_STATE;
+    }
+
+    if (pDpInfo->pDpWin)
+    {
+        CRASSERT(pDpInfo->pDpWin->getWindow());
+
+        rc = pDpInfo->pDpWin->UpdateBegin(hFb);
+        if (RT_SUCCESS(rc))
+        {
+            pDpInfo->pDpWin->reparent(cr_server.screen[idScreen].winID);
+            pDpInfo->pDpWin->UpdateEnd(hFb);
+        }
+    }
+    else
+    {
+        if (pDpInfo->pWindow)
+        {
+            rc = pDpInfo->pWindow->UpdateBegin();
+            if (RT_SUCCESS(rc))
+            {
+                rc = pDpInfo->pWindow->SetVisible(false);
+                if (RT_SUCCESS(rc))
+                    rc = pDpInfo->pWindow->Reparent(cr_server.screen[idScreen].winID);
+
+                pDpInfo->pWindow->UpdateEnd();
+            }
+        }
+
+        if (RT_SUCCESS(rc))
+            rc = crPMgrCheckInitWindowDisplays(idScreen);
+    }
+
+    CRASSERT(!rc);
+
+    return rc;
+}
+
+int CrPMgrViewportUpdate(uint32_t idScreen)
+{
+    if (idScreen >= CR_MAX_GUEST_MONITORS)
+    {
+        WARN(("invalid idScreen %d", idScreen));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
+    if (pDpInfo->iFb >= 0)
+    {
+        HCR_FRAMEBUFFER hFb = CrPMgrFbGet(pDpInfo->iFb);
+        if (CrFbIsUpdating(hFb))
+        {
+            WARN(("trying to update viewport while framebuffer is being updated"));
+            return VERR_INVALID_STATE;
+        }
+
+        if (pDpInfo->pDpWin)
+        {
+            CRASSERT(pDpInfo->pDpWin->getWindow());
+            int rc = pDpInfo->pDpWin->UpdateBegin(hFb);
+            if (RT_SUCCESS(rc))
+            {
+                pDpInfo->pDpWin->setViewportRect(&cr_server.screenVieport[idScreen].Rect);
+                pDpInfo->pDpWin->UpdateEnd(hFb);
+            }
+            else
+                WARN(("UpdateBegin failed %d", rc));
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int crPMgrFbDisconnectDisplay(HCR_FRAMEBUFFER hFb, CrFbDisplayBase *pDp)
+{
+    if (pDp->getFramebuffer() != hFb)
+        return VINF_SUCCESS;
+
+    CrFbDisplayBase * pCurDp = (CrFbDisplayBase*)CrFbDisplayGet(hFb);
+    if (!pCurDp)
+    {
+        WARN(("no display set, unexpected"));
+        return VERR_INTERNAL_ERROR;
+    }
+
+    if (pCurDp == pDp)
+    {
+        pDp->setFramebuffer(NULL);
+        CrFbDisplaySet(hFb, NULL);
+        return VINF_SUCCESS;
+    }
+
+    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
+    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
+    if (pFbInfo->pDpComposite != pCurDp)
+    {
+        WARN(("misconfig, expectig the curret framebuffer to be present, and thus composite is expected"));
+        return VERR_INTERNAL_ERROR;
+    }
+
+    if (pDp->getContainer() == pFbInfo->pDpComposite)
+    {
+        pFbInfo->pDpComposite->remove(pDp);
+        uint32_t cDisplays = pFbInfo->pDpComposite->getDisplayCount();
+        if (cDisplays <= 1)
+        {
+            Assert(cDisplays == 1);
+            CrFbDisplayBase *pDpFirst = pFbInfo->pDpComposite->first();
+            if (pDpFirst)
+                pFbInfo->pDpComposite->remove(pDpFirst, false);
+            CrFbDisplaySet(hFb, pDpFirst);
+        }
+        return VINF_SUCCESS;
+    }
+
+    WARN(("misconfig"));
+    return VERR_INTERNAL_ERROR;
+}
+
+static int crPMgrFbConnectDisplay(HCR_FRAMEBUFFER hFb, CrFbDisplayBase *pDp)
+{
+    if (pDp->getFramebuffer() == hFb)
+        return VINF_SUCCESS;
+
+    CrFbDisplayBase * pCurDp = (CrFbDisplayBase*)CrFbDisplayGet(hFb);
+    if (!pCurDp)
+    {
+        pDp->setFramebuffer(hFb);
+        CrFbDisplaySet(hFb, pDp);
+        return VINF_SUCCESS;
+    }
+
+    if (pCurDp == pDp)
+    {
+        WARN(("misconfig, current framebuffer is not expected to be set"));
+        return VERR_INTERNAL_ERROR;
+    }
+
+    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
+    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
+    if (pFbInfo->pDpComposite != pCurDp)
+    {
+        if (!pFbInfo->pDpComposite)
+        {
+            pFbInfo->pDpComposite = new CrFbDisplayComposite();
+            pFbInfo->pDpComposite->setFramebuffer(hFb);
+        }
+
+        pFbInfo->pDpComposite->add(pCurDp);
+        CrFbDisplaySet(hFb, pFbInfo->pDpComposite);
+    }
+
+    pFbInfo->pDpComposite->add(pDp);
+    return VINF_SUCCESS;
+}
+
+static int crPMgrFbDisconnectTarget(HCR_FRAMEBUFFER hFb, uint32_t i)
+{
+    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
+    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
+    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
+    if (pDpInfo->iFb != idFb)
+    {
+        WARN(("target not connected"));
+        Assert(!ASMBitTest(pFbInfo->aTargetMap, i));
+        return VINF_SUCCESS;
+    }
+
+    Assert(ASMBitTest(pFbInfo->aTargetMap, i));
+
+    int rc = VINF_SUCCESS;
+    if (pDpInfo->pDpVrdp)
+    {
+        rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpVrdp);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbDisconnectDisplay failed %d", rc));
+            return rc;
+        }
+    }
+
+    if (pDpInfo->pDpWinRootVr)
+    {
+#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
+        CrFbWindow *pWindow = pDpInfo->pDpWinRootVr->windowDetach(false);
+        Assert(pWindow == pDpInfo->pWindow);
+#endif
+        rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpWinRootVr);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbDisconnectDisplay failed %d", rc));
+            return rc;
+        }
+    }
+    else if (pDpInfo->pDpWin)
+    {
+#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
+        CrFbWindow *pWindow = pDpInfo->pDpWin->windowDetach(false);
+        Assert(pWindow == pDpInfo->pWindow);
+#endif
+        rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpWin);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbDisconnectDisplay failed %d", rc));
+            return rc;
+        }
+    }
+
+    ASMBitClear(pFbInfo->aTargetMap, i);
+    pDpInfo->iFb = -1;
+
+    return VINF_SUCCESS;
+}
+
+static void crPMgrDpWinRootVrCreate(CR_FBDISPLAY_INFO *pDpInfo)
+{
+    if (!pDpInfo->pDpWinRootVr)
+    {
+        if (pDpInfo->pDpWin)
+        {
+            CrFbWindow *pWin = pDpInfo->pDpWin->windowDetach();
+            CRASSERT(pWin);
+            Assert(pWin == pDpInfo->pWindow);
+            delete pDpInfo->pDpWin;
+            pDpInfo->pDpWin = NULL;
+        }
+        else if (!pDpInfo->pWindow)
+        {
+            pDpInfo->pWindow = new CrFbWindow(0);
+        }
+
+        pDpInfo->pDpWinRootVr = new CrFbDisplayWindowRootVr(&cr_server.screenVieport[pDpInfo->u32Id].Rect, cr_server.screen[pDpInfo->u32Id].winID);
+        pDpInfo->pDpWin = pDpInfo->pDpWinRootVr;
+        pDpInfo->pDpWinRootVr->windowAttach(pDpInfo->pWindow);
+
+        /* Set scale factor once it was previously cached when display output was not yet initialized. */
+        if (pDpInfo->dInitialScaleFactorW || pDpInfo->dInitialScaleFactorH)
+        {
+            crDebug("Set cached scale factor for seamless mode.");
+            pDpInfo->pWindow->SetScaleFactor((GLdouble)pDpInfo->dInitialScaleFactorW, (GLdouble)pDpInfo->dInitialScaleFactorH);
+            /* Invalidate cache. */
+            pDpInfo->dInitialScaleFactorW = pDpInfo->dInitialScaleFactorH = 0;
+        }
+    }
+}
+
+static void crPMgrDpWinCreate(CR_FBDISPLAY_INFO *pDpInfo)
+{
+    if (pDpInfo->pDpWinRootVr)
+    {
+        CRASSERT(pDpInfo->pDpWinRootVr == pDpInfo->pDpWin);
+        CrFbWindow *pWin = pDpInfo->pDpWin->windowDetach();
+        CRASSERT(pWin);
+        Assert(pWin == pDpInfo->pWindow);
+        delete pDpInfo->pDpWinRootVr;
+        pDpInfo->pDpWinRootVr = NULL;
+        pDpInfo->pDpWin = NULL;
+    }
+
+    if (!pDpInfo->pDpWin)
+    {
+        if (!pDpInfo->pWindow)
+            pDpInfo->pWindow = new CrFbWindow(0);
+
+        pDpInfo->pDpWin = new CrFbDisplayWindow(&cr_server.screenVieport[pDpInfo->u32Id].Rect, cr_server.screen[pDpInfo->u32Id].winID);
+        pDpInfo->pDpWin->windowAttach(pDpInfo->pWindow);
+
+        /* Set scale factor once it was previously cached when display output was not yet initialized. */
+        if (pDpInfo->dInitialScaleFactorW || pDpInfo->dInitialScaleFactorH)
+        {
+            crDebug("Set cached scale factor for host window.");
+            pDpInfo->pWindow->SetScaleFactor((GLdouble)pDpInfo->dInitialScaleFactorW, (GLdouble)pDpInfo->dInitialScaleFactorH);
+            /* Invalidate cache. */
+            pDpInfo->dInitialScaleFactorW = pDpInfo->dInitialScaleFactorH = 0;
+        }
+    }
+}
+
+static int crPMgrFbDisconnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeRemove)
+{
+    int rc = VINF_SUCCESS;
+    if (u32ModeRemove & CR_PMGR_MODE_ROOTVR)
+    {
+        if (pDpInfo->pDpWinRootVr)
+        {
+#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
+            CrFbWindow *pWindow = pDpInfo->pDpWinRootVr->windowDetach(false);
+            Assert(pWindow == pDpInfo->pWindow);
+#endif
+            CRASSERT(pDpInfo->pDpWin == pDpInfo->pDpWinRootVr);
+            rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpWinRootVr);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("crPMgrFbDisconnectDisplay pDpWinRootVr failed %d", rc));
+                return rc;
+            }
+        }
+    }
+    else if (u32ModeRemove & CR_PMGR_MODE_WINDOW)
+    {
+        CRASSERT(!pDpInfo->pDpWinRootVr);
+        if (pDpInfo->pDpWin)
+        {
+#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
+            CrFbWindow *pWindow = pDpInfo->pDpWin->windowDetach(false);
+            Assert(pWindow == pDpInfo->pWindow);
+#endif
+            rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpWin);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("crPMgrFbDisconnectDisplay pDpWin failed %d", rc));
+                return rc;
+            }
+        }
+    }
+
+    if (u32ModeRemove & CR_PMGR_MODE_VRDP)
+    {
+        if (pDpInfo->pDpVrdp)
+        {
+            rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpVrdp);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("crPMgrFbDisconnectDisplay pDpVrdp failed %d", rc));
+                return rc;
+            }
+        }
+    }
+
+    pDpInfo->u32DisplayMode &= ~u32ModeRemove;
+
+    return VINF_SUCCESS;
+}
+
+static int crPMgrFbConnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeAdd)
+{
+    int rc = VINF_SUCCESS;
+
+    if (u32ModeAdd & CR_PMGR_MODE_ROOTVR)
+    {
+        crPMgrDpWinRootVrCreate(pDpInfo);
+
+        rc = crPMgrFbConnectDisplay(hFb, pDpInfo->pDpWinRootVr);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbConnectDisplay pDpWinRootVr failed %d", rc));
+            return rc;
+        }
+    }
+    else if (u32ModeAdd & CR_PMGR_MODE_WINDOW)
+    {
+        crPMgrDpWinCreate(pDpInfo);
+
+        rc = crPMgrFbConnectDisplay(hFb, pDpInfo->pDpWin);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbConnectDisplay pDpWin failed %d", rc));
+            return rc;
+        }
+    }
+
+    if (u32ModeAdd & CR_PMGR_MODE_VRDP)
+    {
+        if (!pDpInfo->pDpVrdp)
+            pDpInfo->pDpVrdp = new CrFbDisplayVrdp();
+
+        rc = crPMgrFbConnectDisplay(hFb, pDpInfo->pDpVrdp);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbConnectDisplay pDpVrdp failed %d", rc));
+            return rc;
+        }
+    }
+
+    pDpInfo->u32DisplayMode |= u32ModeAdd;
+
+    return VINF_SUCCESS;
+}
+
+static int crPMgrFbConnectTarget(HCR_FRAMEBUFFER hFb, uint32_t i)
+{
+    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
+    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
+    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
+    if (pDpInfo->iFb == idFb)
+    {
+        WARN(("target not connected"));
+        Assert(ASMBitTest(pFbInfo->aTargetMap, i));
+        return VINF_SUCCESS;
+    }
+
+    Assert(!ASMBitTest(pFbInfo->aTargetMap, i));
+
+    int rc = VINF_SUCCESS;
+
+    if (pDpInfo->iFb != -1)
+    {
+        Assert(pDpInfo->iFb < cr_server.screenCount);
+        HCR_FRAMEBUFFER hAssignedFb = CrPMgrFbGet(pDpInfo->iFb);
+        Assert(hAssignedFb);
+        rc = crPMgrFbDisconnectTarget(hAssignedFb, i);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbDisconnectTarget failed %d", rc));
+            return rc;
+        }
+    }
+
+    rc = crPMgrFbConnectTargetDisplays(hFb, pDpInfo, g_CrPresenter.u32DisplayMode
+#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
+            & ~(CR_PMGR_MODE_WINDOW | CR_PMGR_MODE_ROOTVR)
+#endif
+            );
+    if (RT_FAILURE(rc))
+    {
+        WARN(("crPMgrFbConnectTargetDisplays failed %d", rc));
+        return rc;
+    }
+
+    ASMBitSet(pFbInfo->aTargetMap, i);
+    pDpInfo->iFb = idFb;
+
+    return VINF_SUCCESS;
+}
+
+static int crPMgrFbDisconnect(HCR_FRAMEBUFFER hFb, const uint32_t *pTargetMap)
+{
+    int rc = VINF_SUCCESS;
+    for (int i = ASMBitFirstSet(pTargetMap, cr_server.screenCount);
+            i >= 0;
+            i = ASMBitNextSet(pTargetMap, cr_server.screenCount, i))
+    {
+        rc = crPMgrFbDisconnectTarget(hFb, (uint32_t)i);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbDisconnectTarget failed %d", rc));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int crPMgrFbConnect(HCR_FRAMEBUFFER hFb, const uint32_t *pTargetMap)
+{
+    int rc = VINF_SUCCESS;
+    for (int i = ASMBitFirstSet(pTargetMap, cr_server.screenCount);
+            i >= 0;
+            i = ASMBitNextSet(pTargetMap, cr_server.screenCount, i))
+    {
+        rc = crPMgrFbConnectTarget(hFb, (uint32_t)i);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbConnectTarget failed %d", rc));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int crPMgrModeModifyTarget(HCR_FRAMEBUFFER hFb, uint32_t iDisplay, uint32_t u32ModeAdd, uint32_t u32ModeRemove)
+{
+    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[iDisplay];
+    int rc = crPMgrFbDisconnectTargetDisplays(hFb, pDpInfo, u32ModeRemove);
+    if (RT_FAILURE(rc))
+    {
+        WARN(("crPMgrFbDisconnectTargetDisplays failed %d", rc));
+        return rc;
+    }
+
+    rc = crPMgrFbConnectTargetDisplays(hFb, pDpInfo, u32ModeAdd);
+    if (RT_FAILURE(rc))
+    {
+        WARN(("crPMgrFbConnectTargetDisplays failed %d", rc));
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int crPMgrModeModify(HCR_FRAMEBUFFER hFb, uint32_t u32ModeAdd, uint32_t u32ModeRemove)
+{
+    int rc = VINF_SUCCESS;
+    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
+    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
+    for (int i = ASMBitFirstSet(pFbInfo->aTargetMap, cr_server.screenCount);
+            i >= 0;
+            i = ASMBitNextSet(pFbInfo->aTargetMap, cr_server.screenCount, i))
+    {
+        rc = crPMgrModeModifyTarget(hFb, (uint32_t)i, u32ModeAdd, u32ModeRemove);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrModeModifyTarget failed %d", rc));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+static void crPMgrCleanUnusedDisplays()
+{
+    for (int i = 0; i < cr_server.screenCount; ++i)
+    {
+        CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
+
+        if (pDpInfo->pDpWinRootVr)
+        {
+            if (!pDpInfo->pDpWinRootVr->getFramebuffer())
+            {
+                pDpInfo->pDpWinRootVr->windowDetach(false);
+                delete pDpInfo->pDpWinRootVr;
+                pDpInfo->pDpWinRootVr = NULL;
+                pDpInfo->pDpWin = NULL;
+                if (pDpInfo->pWindow)
+                {
+                    delete pDpInfo->pWindow;
+                    pDpInfo->pWindow = NULL;
+                }
+            }
+            else
+                WARN(("pDpWinRootVr is used"));
+        }
+        else if (pDpInfo->pDpWin)
+        {
+            if (!pDpInfo->pDpWin->getFramebuffer())
+            {
+                pDpInfo->pDpWin->windowDetach(false);
+                delete pDpInfo->pDpWin;
+                pDpInfo->pDpWin = NULL;
+                if (pDpInfo->pWindow)
+                {
+                    delete pDpInfo->pWindow;
+                    pDpInfo->pWindow = NULL;
+                }
+            }
+            else
+                WARN(("pDpWin is used"));
+        }
+
+        if (pDpInfo->pDpVrdp)
+        {
+            if (!pDpInfo->pDpVrdp->getFramebuffer())
+            {
+                delete pDpInfo->pDpVrdp;
+                pDpInfo->pDpVrdp = NULL;
+            }
+            else
+                WARN(("pDpVrdp is used"));
+        }
+    }
+}
+
+static int crPMgrModeModifyGlobal(uint32_t u32ModeAdd, uint32_t u32ModeRemove)
+{
+    uint32_t u32InternalMode = g_CrPresenter.fEnabled ? g_CrPresenter.u32DisplayMode : g_CrPresenter.u32DisabledDisplayMode;
+
+    u32ModeRemove = ((u32ModeRemove | crPMgrModeAdjustVal(u32ModeRemove)) & CR_PMGR_MODE_ALL);
+    u32ModeAdd = crPMgrModeAdjustVal(u32ModeAdd);
+    u32ModeRemove &= u32InternalMode;
+    u32ModeAdd &= ~(u32ModeRemove | u32InternalMode);
+    uint32_t u32ModeResulting = ((u32InternalMode | u32ModeAdd) & ~u32ModeRemove);
+    uint32_t u32Tmp = crPMgrModeAdjustVal(u32ModeResulting);
+    if (u32Tmp != u32ModeResulting)
+    {
+        u32ModeAdd |= (u32Tmp & ~u32ModeResulting);
+        u32ModeRemove |= (~u32Tmp & u32ModeResulting);
+        u32ModeResulting = u32Tmp;
+        Assert(u32ModeResulting == ((u32InternalMode | u32ModeAdd) & ~u32ModeRemove));
+    }
+    if (!u32ModeRemove && !u32ModeAdd)
+        return VINF_SUCCESS;
+
+    uint32_t u32DisplayMode = (g_CrPresenter.u32DisplayMode | u32ModeAdd) & ~u32ModeRemove;
+    if (!g_CrPresenter.fEnabled)
+    {
+        Assert(g_CrPresenter.u32DisplayMode == 0);
+        g_CrPresenter.u32DisabledDisplayMode = u32DisplayMode;
+        return VINF_SUCCESS;
+    }
+
+    g_CrPresenter.u32DisplayMode = u32DisplayMode;
+
+    /* disabled framebuffers may still have displays attached */
+    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstInitialized();
+            hFb;
+            hFb = CrPMgrFbGetNextInitialized(hFb))
+    {
+        crPMgrModeModify(hFb, u32ModeAdd, u32ModeRemove);
+    }
+
+    return VINF_SUCCESS;
+}
+
+int CrPMgrClearRegionsGlobal()
+{
+    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled();
+            hFb;
+            hFb = CrPMgrFbGetNextEnabled(hFb))
+    {
+        int rc = CrFbUpdateBegin(hFb);
+        if (RT_SUCCESS(rc))
+        {
+            rc = CrFbRegionsClear(hFb);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("CrFbRegionsClear failed %d", rc));
+            }
+
+            CrFbUpdateEnd(hFb);
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+int CrPMgrModeVrdp(bool fEnable)
+{
+    uint32_t u32ModeAdd, u32ModeRemove;
+    if (fEnable)
+    {
+        u32ModeAdd = CR_PMGR_MODE_VRDP;
+        u32ModeRemove = 0;
+    }
+    else
+    {
+        u32ModeAdd = 0;
+        u32ModeRemove = CR_PMGR_MODE_VRDP;
+    }
+    return crPMgrModeModifyGlobal(u32ModeAdd, u32ModeRemove);
+}
+
+int CrPMgrModeRootVr(bool fEnable)
+{
+    uint32_t u32ModeAdd, u32ModeRemove;
+    if (fEnable)
+    {
+        u32ModeAdd = CR_PMGR_MODE_ROOTVR;
+        u32ModeRemove = CR_PMGR_MODE_WINDOW;
+    }
+    else
+    {
+        u32ModeAdd = CR_PMGR_MODE_WINDOW;
+        u32ModeRemove = CR_PMGR_MODE_ROOTVR;
+    }
+
+    return crPMgrModeModifyGlobal(u32ModeAdd, u32ModeRemove);
+}
+
+int CrPMgrModeWinVisible(bool fEnable)
+{
+    if (!g_CrPresenter.fWindowsForceHidden == !!fEnable)
+        return VINF_SUCCESS;
+
+    g_CrPresenter.fWindowsForceHidden = !fEnable;
+
+    for (int i = 0; i < cr_server.screenCount; ++i)
+    {
+        CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
+
+        if (pDpInfo->pDpWin)
+            pDpInfo->pDpWin->winVisibilityChanged();
+    }
+
+    return VINF_SUCCESS;
+}
+
+int CrPMgrRootVrUpdate()
+{
+    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled();
+            hFb;
+            hFb = CrPMgrFbGetNextEnabled(hFb))
+    {
+        if (!CrFbHas3DData(hFb))
+            continue;
+
+        uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
+        CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
+        int rc = CrFbUpdateBegin(hFb);
+        if (RT_SUCCESS(rc))
+        {
+            for (int i = ASMBitFirstSet(pFbInfo->aTargetMap, cr_server.screenCount);
+                    i >= 0;
+                    i = ASMBitNextSet(pFbInfo->aTargetMap, cr_server.screenCount, i))
+            {
+                CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
+                Assert(pDpInfo->iFb == (int32_t)idFb);
+
+                pDpInfo->pDpWinRootVr->RegionsChanged(hFb);
+            }
+
+            CrFbUpdateEnd(hFb);
+        }
+        else
+            WARN(("CrFbUpdateBegin failed %d", rc));
+    }
+
+    return VINF_SUCCESS;
+}
+
+/*helper function that calls CrFbUpdateBegin for all enabled framebuffers */
+int CrPMgrHlpGlblUpdateBegin(CR_FBMAP *pMap)
+{
+    CrFBmInit(pMap);
+    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled();
+            hFb;
+            hFb = CrPMgrFbGetNextEnabled(hFb))
+    {
+        int rc = CrFbUpdateBegin(hFb);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("UpdateBegin failed, rc %d", rc));
+            for (HCR_FRAMEBUFFER hTmpFb = CrPMgrFbGetFirstEnabled();
+                        hFb != hTmpFb;
+                        hTmpFb = CrPMgrFbGetNextEnabled(hTmpFb))
+            {
+                CrFbUpdateEnd(hTmpFb);
+                CrFBmClear(pMap, CrFbGetScreenInfo(hFb)->u32ViewIndex);
+            }
+            return rc;
+        }
+
+        CrFBmSet(pMap, CrFbGetScreenInfo(hFb)->u32ViewIndex);
+    }
+
+    return VINF_SUCCESS;
+}
+
+/*helper function that calls CrFbUpdateEnd for all framebuffers being updated */
+void CrPMgrHlpGlblUpdateEnd(CR_FBMAP *pMap)
+{
+    for (uint32_t i = 0; i < (uint32_t)cr_server.screenCount; ++i)
+    {
+        if (!CrFBmIsSet(pMap, i))
+            continue;
+
+        HCR_FRAMEBUFFER hFb = CrPMgrFbGetInitialized(i);
+        CRASSERT(hFb);
+        CrFbUpdateEnd(hFb);
+    }
+}
+
+int CrPMgrResize(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM, const uint32_t *pTargetMap)
+{
+    int rc = VINF_SUCCESS;
+
+    if (pScreen->u32ViewIndex == 0xffffffff)
+    {
+        /* this is just a request to disable targets, search and disable */
+        for (int i = ASMBitFirstSet(pTargetMap, cr_server.screenCount);
+                i >= 0;
+                i = ASMBitNextSet(pTargetMap, cr_server.screenCount, i))
+        {
+            CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
+            if (pDpInfo->iFb < 0)
+                continue;
+
+            Assert(pDpInfo->iFb < cr_server.screenCount);
+            HCR_FRAMEBUFFER hAssignedFb = CrPMgrFbGet(pDpInfo->iFb);
+
+            rc = crPMgrFbDisconnectTarget(hAssignedFb, (uint32_t)i);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("crPMgrFbDisconnectTarget failed %d", rc));
+                return rc;
+            }
+        }
+
+        return VINF_SUCCESS;
+    }
+
+    HCR_FRAMEBUFFER hFb = CrPMgrFbGet(pScreen->u32ViewIndex);
+    if (!hFb)
+    {
+        WARN(("CrPMgrFbGet failed"));
+        return VERR_INVALID_PARAMETER;
+    }
+
+    const VBVAINFOSCREEN *pFbScreen = CrFbGetScreenInfo(hFb);
+    bool fFbInfoChanged = true;
+
+    if (!memcmp(pFbScreen, pScreen, sizeof (*pScreen)))
+    {
+        if (!pvVRAM || pvVRAM == CrFbGetVRAM(hFb))
+            fFbInfoChanged = false;
+    }
+
+    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[pScreen->u32ViewIndex];
+
+    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aRemovedTargetMap);
+    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aAddedTargetMap);
+
+    bool fDisplaysAdded = false, fDisplaysRemoved = false;
+
+    memcpy(aRemovedTargetMap, pFbInfo->aTargetMap, sizeof (aRemovedTargetMap));
+
+    if (pScreen->u16Flags & VBVA_SCREEN_F_DISABLED)
+    {
+        /* so far there is no need in keeping displays attached to disabled Framebffer,
+         * just disconnect everything */
+        for (int i = 0; i < RT_ELEMENTS(aRemovedTargetMap); ++i)
+        {
+            if (aRemovedTargetMap[i])
+            {
+                fDisplaysRemoved = true;
+                break;
+            }
+        }
+
+        memset(aAddedTargetMap, 0, sizeof (aAddedTargetMap));
+    }
+    else
+    {
+        for (int i = 0; i < RT_ELEMENTS(aRemovedTargetMap); ++i)
+        {
+            aRemovedTargetMap[i] = (aRemovedTargetMap[i] & ~pTargetMap[i]);
+            if (aRemovedTargetMap[i])
+                fDisplaysRemoved = true;
+        }
+
+        memcpy(aAddedTargetMap, pFbInfo->aTargetMap, sizeof (aAddedTargetMap));
+        for (int i = 0; i < RT_ELEMENTS(aAddedTargetMap); ++i)
+        {
+            aAddedTargetMap[i] = (pTargetMap[i] & ~aAddedTargetMap[i]);
+            if (aAddedTargetMap[i])
+                fDisplaysAdded = true;
+        }
+    }
+
+    if (!fFbInfoChanged && !fDisplaysRemoved && !fDisplaysAdded)
+    {
+        crDebug("resize: no changes");
+        return VINF_SUCCESS;
+    }
+
+    if (fDisplaysRemoved)
+    {
+        rc = crPMgrFbDisconnect(hFb, aRemovedTargetMap);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbDisconnect failed %d", rc));
+            return rc;
+        }
+    }
+
+    if (fFbInfoChanged)
+    {
+#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
+        rc = crPMgrModeModify(hFb, 0, CR_PMGR_MODE_WINDOW | CR_PMGR_MODE_ROOTVR);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("crPMgrModeModifyTarget failed %d", rc));
+            return rc;
+        }
+#endif
+        rc = CrFbUpdateBegin(hFb);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("CrFbUpdateBegin failed %d", rc));
+            return rc;
+        }
+
+        crVBoxServerMuralFbResizeBegin(hFb);
+
+        rc = CrFbResize(hFb, pScreen, pvVRAM);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("CrFbResize failed %d", rc));
+        }
+
+        crVBoxServerMuralFbResizeEnd(hFb);
+
+        CrFbUpdateEnd(hFb);
+    }
+
+    if (fDisplaysAdded)
+    {
+        rc = crPMgrFbConnect(hFb, aAddedTargetMap);
+        if (RT_FAILURE(rc))
+        {
+            WARN(("crPMgrFbConnect failed %d", rc));
+            return rc;
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+int CrFbEntrySaveState(CR_FRAMEBUFFER *pFb, CR_FRAMEBUFFER_ENTRY *hEntry, PSSMHANDLE pSSM)
+{
+    const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry = CrFbEntryGetCompositorEntry(hEntry);
+    CR_TEXDATA *pTexData = CrVrScrCompositorEntryTexGet(pEntry);
+    CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTexData);
+    int rc = SSMR3PutU32(pSSM, pFbTex->pTobj->id);
+    AssertRCReturn(rc, rc);
+    uint32_t u32 = 0;
+
+    u32 = CrVrScrCompositorEntryFlagsGet(pEntry);
+    rc = SSMR3PutU32(pSSM, u32);
+    AssertRCReturn(rc, rc);
+
+    const RTRECT *pRect = CrVrScrCompositorEntryRectGet(pEntry);
+
+    rc = SSMR3PutS32(pSSM, pRect->xLeft);
+    AssertRCReturn(rc, rc);
+    rc = SSMR3PutS32(pSSM, pRect->yTop);
+    AssertRCReturn(rc, rc);
+#if 0
+    rc = SSMR3PutS32(pSSM, pRect->xRight);
+    AssertRCReturn(rc, rc);
+    rc = SSMR3PutS32(pSSM, pRect->yBottom);
+    AssertRCReturn(rc, rc);
+#endif
+
+    rc = CrVrScrCompositorEntryRegionsGet(&pFb->Compositor, pEntry, &u32, NULL, NULL, &pRect);
+    AssertRCReturn(rc, rc);
+
+    rc = SSMR3PutU32(pSSM, u32);
+    AssertRCReturn(rc, rc);
+
+    if (u32)
+    {
+        rc = SSMR3PutMem(pSSM, pRect, u32 * sizeof (*pRect));
+        AssertRCReturn(rc, rc);
+    }
+    return rc;
+}
+
+int CrFbSaveState(CR_FRAMEBUFFER *pFb, PSSMHANDLE pSSM)
+{
+    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
+    CrVrScrCompositorConstIterInit(&pFb->Compositor, &Iter);
+    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
+    uint32_t u32 = 0;
+    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
+    {
+        CR_TEXDATA *pTexData = CrVrScrCompositorEntryTexGet(pEntry);
+        CRASSERT(pTexData);
+        CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTexData);
+        if (pFbTex->pTobj)
+            ++u32;
+    }
+
+    int rc = SSMR3PutU32(pSSM, u32);
+    AssertRCReturn(rc, rc);
+
+    CrVrScrCompositorConstIterInit(&pFb->Compositor, &Iter);
+
+    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
+    {
+        CR_TEXDATA *pTexData = CrVrScrCompositorEntryTexGet(pEntry);
+        CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTexData);
+        if (pFbTex->pTobj)
+        {
+            HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
+            rc = CrFbEntrySaveState(pFb, hEntry, pSSM);
+            AssertRCReturn(rc, rc);
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+int CrPMgrSaveState(PSSMHANDLE pSSM)
+{
+    int rc;
+    int cDisplays = 0, i;
+
+    for (i = 0; i < cr_server.screenCount; ++i)
+    {
+        if (CrPMgrFbGetEnabled(i))
+            ++cDisplays;
+    }
+
+    rc = SSMR3PutS32(pSSM, cDisplays);
+    AssertRCReturn(rc, rc);
+
+    if (!cDisplays)
+        return VINF_SUCCESS;
+
+    rc = SSMR3PutS32(pSSM, cr_server.screenCount);
+    AssertRCReturn(rc, rc);
+
+    for (i = 0; i < cr_server.screenCount; ++i)
+    {
+        CR_FRAMEBUFFER *hFb = CrPMgrFbGetEnabled(i);
+        if (hFb)
+        {
+            Assert(hFb->ScreenInfo.u32ViewIndex == i);
+            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32ViewIndex);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutS32(pSSM, hFb->ScreenInfo.i32OriginX);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutS32(pSSM, hFb->ScreenInfo.i32OriginY);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32StartOffset);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32LineSize);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32Width);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32Height);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutU16(pSSM, hFb->ScreenInfo.u16BitsPerPixel);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutU16(pSSM, hFb->ScreenInfo.u16Flags);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32StartOffset);
+            AssertRCReturn(rc, rc);
+
+            CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[hFb->ScreenInfo.u32ViewIndex];
+            rc = SSMR3PutMem(pSSM, pFbInfo->aTargetMap, sizeof (pFbInfo->aTargetMap));
+            AssertRCReturn(rc, rc);
+
+            rc = CrFbSaveState(hFb, pSSM);
+            AssertRCReturn(rc, rc);
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+int CrFbEntryLoadState(CR_FRAMEBUFFER *pFb, PSSMHANDLE pSSM, uint32_t version)
+{
+    uint32_t texture;
+    int  rc = SSMR3GetU32(pSSM, &texture);
+    AssertRCReturn(rc, rc);
+
+    uint32_t fFlags;
+    rc = SSMR3GetU32(pSSM, &fFlags);
+    AssertRCReturn(rc, rc);
+
+
+    HCR_FRAMEBUFFER_ENTRY hEntry;
+
+    rc = CrFbEntryCreateForTexId(pFb, texture, fFlags, &hEntry);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrFbEntryCreateForTexId Failed"));
+        return rc;
+    }
+
+    Assert(hEntry);
+
+    const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry = CrFbEntryGetCompositorEntry(hEntry);
+    CR_TEXDATA *pTexData = CrVrScrCompositorEntryTexGet(pEntry);
+    CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTexData);
+
+    RTPOINT Point;
+    rc = SSMR3GetS32(pSSM, &Point.x);
+    AssertRCReturn(rc, rc);
+
+    rc = SSMR3GetS32(pSSM, &Point.y);
+    AssertRCReturn(rc, rc);
+
+    uint32_t cRects;
+    rc = SSMR3GetU32(pSSM, &cRects);
+    AssertRCReturn(rc, rc);
+
+    RTRECT * pRects = NULL;
+    if (cRects)
+    {
+        pRects = (RTRECT *)crAlloc(cRects * sizeof (*pRects));
+        AssertReturn(pRects, VERR_NO_MEMORY);
+
+        rc = SSMR3GetMem(pSSM, pRects, cRects * sizeof (*pRects));
+        AssertRCReturn(rc, rc);
+    }
+
+    rc = CrFbEntryRegionsSet(pFb, hEntry, &Point, cRects, pRects, false);
+    AssertRCReturn(rc, rc);
+
+    if (pRects)
+        crFree(pRects);
+
+    CrFbEntryRelease(pFb, hEntry);
+
+    return VINF_SUCCESS;
+}
+
+int CrFbLoadState(CR_FRAMEBUFFER *pFb, PSSMHANDLE pSSM, uint32_t version)
+{
+    uint32_t u32 = 0;
+    int rc = SSMR3GetU32(pSSM, &u32);
+    AssertRCReturn(rc, rc);
+
+    if (!u32)
+        return VINF_SUCCESS;
+
+    rc = CrFbUpdateBegin(pFb);
+    AssertRCReturn(rc, rc);
+
+    for (uint32_t i = 0; i < u32; ++i)
+    {
+        rc = CrFbEntryLoadState(pFb, pSSM, version);
+        AssertRCReturn(rc, rc);
+    }
+
+    CrFbUpdateEnd(pFb);
+
+    return VINF_SUCCESS;
+}
+
+int CrPMgrLoadState(PSSMHANDLE pSSM, uint32_t version)
+{
+    int rc;
+    int cDisplays, screenCount, i;
+
+    rc = SSMR3GetS32(pSSM, &cDisplays);
+    AssertRCReturn(rc, rc);
+
+    if (!cDisplays)
+        return VINF_SUCCESS;
+
+    rc = SSMR3GetS32(pSSM, &screenCount);
+    AssertRCReturn(rc, rc);
+
+    CRASSERT(screenCount == cr_server.screenCount);
+
+    CRScreenInfo screen[CR_MAX_GUEST_MONITORS];
+
+    if (version < SHCROGL_SSM_VERSION_WITH_FB_INFO)
+    {
+        for (i = 0; i < cr_server.screenCount; ++i)
+        {
+            rc = SSMR3GetS32(pSSM, &screen[i].x);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetS32(pSSM, &screen[i].y);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU32(pSSM, &screen[i].w);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU32(pSSM, &screen[i].h);
+            AssertRCReturn(rc, rc);
+        }
+    }
+
+    for (i = 0; i < cDisplays; ++i)
+    {
+        int iScreen;
+
+        rc = SSMR3GetS32(pSSM, &iScreen);
+        AssertRCReturn(rc, rc);
+
+        CR_FRAMEBUFFER *pFb = CrPMgrFbGet(iScreen);
+        Assert(pFb);
+
+        VBVAINFOSCREEN Screen;
+
+        Screen.u32ViewIndex = iScreen;
+
+        VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap);
+
+        memset(aTargetMap, 0, sizeof (aTargetMap));
+        ASMBitSet(aTargetMap, iScreen);
+
+        if (version < SHCROGL_SSM_VERSION_WITH_FB_INFO)
+        {
+            memset(&Screen, 0, sizeof (Screen));
+            Screen.u32LineSize = 4 * screen[iScreen].w;
+            Screen.u32Width = screen[iScreen].w;
+            Screen.u32Height = screen[iScreen].h;
+            Screen.u16BitsPerPixel = 4;
+            Screen.u16Flags = VBVA_SCREEN_F_ACTIVE;
+        }
+        else
+        {
+            rc = SSMR3GetS32(pSSM, &Screen.i32OriginX);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetS32(pSSM, &Screen.i32OriginY);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU32(pSSM, &Screen.u32StartOffset);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU32(pSSM, &Screen.u32LineSize);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU32(pSSM, &Screen.u32Width);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU32(pSSM, &Screen.u32Height);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU16(pSSM, &Screen.u16BitsPerPixel);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU16(pSSM, &Screen.u16Flags);
+            AssertRCReturn(rc, rc);
+
+            rc = SSMR3GetU32(pSSM, &Screen.u32StartOffset);
+            AssertRCReturn(rc, rc);
+            if (Screen.u32StartOffset == 0xffffffff)
+            {
+                WARN(("not expected offVram"));
+                Screen.u32StartOffset = 0;
+            }
+
+            if (version >= SHCROGL_SSM_VERSION_WITH_SCREEN_MAP_REORDERED)
+            {
+                rc = SSMR3GetMem(pSSM, aTargetMap, sizeof (aTargetMap));
+                AssertRCReturn(rc, rc);
+            }
+
+            if (version == SHCROGL_SSM_VERSION_WITH_SCREEN_MAP)
+            {
+                VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aEmptyTargetMap);
+
+                memset(aEmptyTargetMap, 0, sizeof (aEmptyTargetMap));
+
+                rc = CrPMgrResize(&Screen, cr_server.fCrCmdEnabled ? NULL : CrFbGetVRAM(pFb), aEmptyTargetMap);
+                AssertRCReturn(rc, rc);
+
+                rc = CrFbLoadState(pFb, pSSM, version);
+                AssertRCReturn(rc, rc);
+
+                rc = SSMR3GetMem(pSSM, aTargetMap, sizeof (aTargetMap));
+                AssertRCReturn(rc, rc);
+            }
+        }
+
+        rc = CrPMgrResize(&Screen, cr_server.fCrCmdEnabled ? NULL : CrFbGetVRAM(pFb), aTargetMap);
+        AssertRCReturn(rc, rc);
+
+        if (version >= SHCROGL_SSM_VERSION_WITH_FB_INFO && version != SHCROGL_SSM_VERSION_WITH_SCREEN_MAP)
+        {
+            rc = CrFbLoadState(pFb, pSSM, version);
+            AssertRCReturn(rc, rc);
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+void SERVER_DISPATCH_APIENTRY
+crServerDispatchVBoxTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, const GLint *pRects)
+{
+    uint32_t idFb = CR_PRESENT_GET_SCREEN(cfg);
+    if (idFb >= CR_MAX_GUEST_MONITORS)
+    {
+        WARN(("Invalid guest screen"));
+        return;
+    }
+
+    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(idFb);
+    if (!hFb)
+    {
+        WARN(("request to present on disabled framebuffer, ignore"));
+        return;
+    }
+
+    HCR_FRAMEBUFFER_ENTRY hEntry;
+    int rc;
+    if (texture)
+    {
+        rc = CrFbEntryCreateForTexId(hFb, texture, (cfg & CR_PRESENT_FLAG_TEX_NONINVERT_YCOORD) ? 0 : CRBLT_F_INVERT_SRC_YCOORDS, &hEntry);
+        if (!RT_SUCCESS(rc))
+        {
+            LOG(("CrFbEntryCreateForTexId Failed"));
+            return;
+        }
+
+        Assert(hEntry);
+
+#if 0
+        if (!(cfg & CR_PRESENT_FLAG_CLEAR_RECTS))
+        {
+            CR_SERVER_DUMP_TEXPRESENT(&pEntry->CEntry.Tex);
+        }
+#endif
+    }
+    else
+        hEntry = NULL;
+
+    rc = CrFbUpdateBegin(hFb);
+    if (RT_SUCCESS(rc))
+    {
+        if (!(cfg & CR_PRESENT_FLAG_CLEAR_RECTS))
+        {
+            RTPOINT Point = {xPos, yPos};
+            rc = CrFbEntryRegionsAdd(hFb, hEntry, &Point, (uint32_t)cRects, (const RTRECT*)pRects, false);
+        }
+        else
+        {
+            CrFbRegionsClear(hFb);
+        }
+
+        CrFbUpdateEnd(hFb);
+    }
+    else
+    {
+        WARN(("CrFbUpdateBegin Failed"));
+    }
+
+    if (hEntry)
+        CrFbEntryRelease(hFb, hEntry);
+}
+
+DECLINLINE(void) crVBoxPRectUnpack(const VBOXCMDVBVA_RECT *pVbvaRect, RTRECT *pRect)
+{
+    pRect->xLeft = pVbvaRect->xLeft;
+    pRect->yTop = pVbvaRect->yTop;
+    pRect->xRight = pVbvaRect->xRight;
+    pRect->yBottom = pVbvaRect->yBottom;
+}
+
+DECLINLINE(void) crVBoxPRectUnpacks(const VBOXCMDVBVA_RECT *paVbvaRects, RTRECT *paRects, uint32_t cRects)
+{
+    uint32_t i = 0;
+    for (; i < cRects; ++i)
+    {
+        crVBoxPRectUnpack(&paVbvaRects[i], &paRects[i]);
+    }
+}
+
+static RTRECT * crVBoxServerCrCmdBltRecsUnpack(const VBOXCMDVBVA_RECT *pPRects, uint32_t cRects)
+{
+    if (g_CrPresenter.cbTmpBuf < cRects * sizeof (RTRECT))
+    {
+        if (g_CrPresenter.pvTmpBuf)
+            RTMemFree(g_CrPresenter.pvTmpBuf);
+
+        g_CrPresenter.cbTmpBuf = (cRects + 10) * sizeof (RTRECT);
+        g_CrPresenter.pvTmpBuf = RTMemAlloc(g_CrPresenter.cbTmpBuf);
+        if (!g_CrPresenter.pvTmpBuf)
+        {
+            WARN(("RTMemAlloc failed!"));
+            g_CrPresenter.cbTmpBuf = 0;
+            return NULL;
+        }
+    }
+
+    RTRECT *pRects = (RTRECT *)g_CrPresenter.pvTmpBuf;
+    crVBoxPRectUnpacks(pPRects, pRects, cRects);
+
+    return pRects;
+}
+
+static void crPMgrPrimaryUpdateScreen(HCR_FRAMEBUFFER hFb, uint32_t idScreen, uint32_t cRects, const RTRECT *pRects)
+{
+    const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
+
+    bool fDirtyEmpty = true;
+    RTRECT dirtyRect = {0};
+    cr_server.CrCmdClientInfo.pfnCltScrUpdateBegin(cr_server.CrCmdClientInfo.hCltScr, idScreen);
+
+    VBVACMDHDR hdr;
+    for (uint32_t i = 0; i < cRects; ++i)
+    {
+        hdr.x = pRects[i].xLeft;
+        hdr.y = pRects[i].yTop;
+        hdr.w = hdr.x + pRects[i].xRight;
+        hdr.h = hdr.y + pRects[i].yBottom;
+
+        cr_server.CrCmdClientInfo.pfnCltScrUpdateProcess(cr_server.CrCmdClientInfo.hCltScr, idScreen, &hdr, sizeof (hdr));
+
+        if (fDirtyEmpty)
+        {
+            /* This is the first rectangle to be added. */
+            dirtyRect.xLeft   = pRects[i].xLeft;
+            dirtyRect.yTop    = pRects[i].yTop;
+            dirtyRect.xRight  = pRects[i].xRight;
+            dirtyRect.yBottom = pRects[i].yBottom;
+            fDirtyEmpty       = false;
+        }
+        else
+        {
+            /* Adjust region coordinates. */
+            if (dirtyRect.xLeft > pRects[i].xLeft)
+            {
+                dirtyRect.xLeft = pRects[i].xLeft;
+            }
+
+            if (dirtyRect.yTop > pRects[i].yTop)
+            {
+                dirtyRect.yTop = pRects[i].yTop;
+            }
+
+            if (dirtyRect.xRight < pRects[i].xRight)
+            {
+                dirtyRect.xRight = pRects[i].xRight;
+            }
+
+            if (dirtyRect.yBottom < pRects[i].yBottom)
+            {
+                dirtyRect.yBottom = pRects[i].yBottom;
+            }
+        }
+    }
+
+    if (dirtyRect.xRight - dirtyRect.xLeft)
+    {
+        cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, idScreen, pScreen->i32OriginX + dirtyRect.xLeft, pScreen->i32OriginY + dirtyRect.yTop,
+                                           dirtyRect.xRight - dirtyRect.xLeft, dirtyRect.yBottom - dirtyRect.yTop);
+    }
+    else
+    {
+        cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, idScreen, 0, 0, 0, 0);
+    }
+
+}
+
+static void crPMgrPrimaryUpdate(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects)
+{
+    if (!cRects)
+        return;
+
+    const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
+
+    uint32_t idFb = pScreen->u32ViewIndex;
+    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
+
+    for (int i = ASMBitFirstSet(pFbInfo->aTargetMap, cr_server.screenCount);
+            i >= 0;
+            i = ASMBitNextSet(pFbInfo->aTargetMap, cr_server.screenCount, i))
+    {
+        crPMgrPrimaryUpdateScreen(hFb, i, cRects, pRects);
+    }
+}
+
+static int8_t crVBoxServerCrCmdBltPrimaryVramGenericProcess(uint32_t u32PrimaryID, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, bool fToPrimary)
+{
+    CR_BLITTER_IMG Img;
+    int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img);
+    if (i8Result)
+    {
+        WARN(("invalid param"));
+        return -1;
+    }
+
+    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID);
+    if (!hFb)
+    {
+        WARN(("request to present on disabled framebuffer"));
+        return -1;
+    }
+
+    if (!fToPrimary)
+    {
+        int rc = CrFbBltGetContents(hFb, pPos, cRects, pRects, &Img);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("CrFbBltGetContents failed %d", rc));
+            return -1;
+        }
+
+        return 0;
+    }
+
+    int rc = CrFbBltPutContentsNe(hFb, pPos, cRects, pRects, &Img);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrFbBltPutContentsNe failed %d", rc));
+        return -1;
+    }
+
+    return 0;
+}
+
+static int8_t crVBoxServerCrCmdBltPrimaryProcess(const VBOXCMDVBVA_BLT_PRIMARY *pCmd, uint32_t cbCmd)
+{
+    uint32_t u32PrimaryID = (uint32_t)pCmd->Hdr.Hdr.u.u8PrimaryID;
+    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID);
+    if (!hFb)
+    {
+        WARN(("request to present on disabled framebuffer, ignore"));
+        return 0;
+    }
+
+    uint32_t cRects;
+    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
+    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects)) % sizeof (VBOXCMDVBVA_RECT))
+    {
+        WARN(("invalid argument size"));
+        return -1;
+    }
+
+    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects)) / sizeof (VBOXCMDVBVA_RECT);
+
+    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
+    if (!pRects)
+    {
+        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
+        return -1;
+    }
+
+    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
+
+    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID)
+    {
+        uint32_t texId = pCmd->alloc.u.id;
+        if (!texId)
+        {
+            WARN(("texId is NULL!\n"));
+            return -1;
+        }
+
+        if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
+        {
+            WARN(("blit from primary to texture not implemented"));
+            return -1;
+        }
+
+        crServerDispatchVBoxTexPresent(texId, u32PrimaryID, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, (const GLint*)pRects);
+
+        return 0;
+    }
+    else
+    {
+        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
+        uint32_t width = pScreen->u32Width, height = pScreen->u32Height;
+        VBOXCMDVBVAOFFSET offVRAM = pCmd->alloc.u.offVRAM;
+
+        bool fToPrymary = !(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2);
+        RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
+        int8_t i8Result = crVBoxServerCrCmdBltPrimaryVramGenericProcess(u32PrimaryID, offVRAM, width, height, &Pos, cRects, pRects, fToPrymary);
+        if (i8Result < 0)
+        {
+            WARN(("crVBoxServerCrCmdBltPrimaryVramGenericProcess failed"));
+            return i8Result;
+        }
+
+        if (!fToPrymary)
+            return 0;
+    }
+
+    crPMgrPrimaryUpdate(hFb, cRects, pRects);
+
+    return 0;
+}
+
+static int8_t crVBoxServerCrCmdBltIdToVramMem(uint32_t hostId, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
+{
+    CR_TEXDATA* pTex = CrFbTexDataAcquire(hostId);
+    if (!pTex)
+    {
+        WARN(("pTex failed for %d", hostId));
+        return -1;
+    }
+
+    const VBOXVR_TEXTURE *pVrTex = CrTdTexGet(pTex);
+    if (!width)
+    {
+        width = pVrTex->width;
+        height = pVrTex->height;
+    }
+
+    CR_BLITTER_IMG Img;
+    int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img);
+    if (i8Result)
+    {
+        WARN(("invalid param"));
+        return -1;
+    }
+
+    int rc = CrTdBltEnter(pTex);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrTdBltEnter failed %d", rc));
+        return -1;
+    }
+
+    rc = crFbTexDataGetContents(pTex, pPos, cRects, pRects, &Img);
+
+    CrTdBltLeave(pTex);
+
+    CrTdRelease(pTex);
+
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("crFbTexDataGetContents failed %d", rc));
+        return -1;
+    }
+
+    return 0;
+}
+
+static int8_t crVBoxServerCrCmdBltIdToVram(uint32_t hostId, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
+{
+    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabledByVramStart(offVRAM);
+    if (hFb)
+    {
+        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
+        Assert(!width || pScreen->u32Width == width);
+        Assert(!height || pScreen->u32Height == height);
+
+        crServerDispatchVBoxTexPresent(hostId, pScreen->u32ViewIndex, pPos->x, pPos->y, cRects, (const GLint*)pRects);
+        return 0;
+    }
+
+    return crVBoxServerCrCmdBltIdToVramMem(hostId, offVRAM, width, height, pPos, cRects, pRects);
+}
+
+static int8_t crVBoxServerCrCmdBltVramToVramMem(VBOXCMDVBVAOFFSET offSrcVRAM, uint32_t srcWidth, uint32_t srcHeight, VBOXCMDVBVAOFFSET offDstVRAM, uint32_t dstWidth, uint32_t dstHeight, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
+{
+    CR_BLITTER_IMG srcImg, dstImg;
+    int8_t i8Result = crFbImgFromDimOffVramBGRA(offSrcVRAM, srcWidth, srcHeight, &srcImg);
+    if (i8Result)
+    {
+        WARN(("invalid param"));
+        return -1;
+    }
+
+    i8Result = crFbImgFromDimOffVramBGRA(offDstVRAM, dstWidth, dstHeight, &dstImg);
+    if (i8Result)
+    {
+        WARN(("invalid param"));
+        return -1;
+    }
+
+    CrMBltImg(&srcImg, pPos, cRects, pRects, &dstImg);
+
+    return 0;
+}
+
+static int8_t crVBoxServerCrCmdBltVramToVram(VBOXCMDVBVAOFFSET offSrcVRAM, uint32_t srcWidth, uint32_t srcHeight,
+        VBOXCMDVBVAOFFSET offDstVRAM, uint32_t dstWidth, uint32_t dstHeight,
+        const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
+{
+    HCR_FRAMEBUFFER hSrcFb = CrPMgrFbGetEnabledByVramStart(offSrcVRAM);
+    HCR_FRAMEBUFFER hDstFb = CrPMgrFbGetEnabledByVramStart(offDstVRAM);
+
+    if (hDstFb)
+    {
+        if (hSrcFb)
+        {
+            LOG(("blit from one framebuffer, wow"));
+
+            int rc = CrFbUpdateBegin(hSrcFb);
+            if (RT_SUCCESS(rc))
+            {
+                CrFbRegionsClear(hSrcFb);
+
+                CrFbUpdateEnd(hSrcFb);
+            }
+            else
+                WARN(("CrFbUpdateBegin failed %d", rc));
+        }
+
+        CR_BLITTER_IMG Img;
+        int8_t i8Result = crFbImgFromDimOffVramBGRA(offSrcVRAM, srcWidth, srcHeight, &Img);
+        if (i8Result)
+        {
+            WARN(("invalid param"));
+            return -1;
+        }
+
+        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hDstFb);
+        if (pScreen->u32Width == dstWidth && pScreen->u32Height == dstHeight)
+        {
+            int rc = CrFbBltPutContentsNe(hDstFb, pPos, cRects, pRects, &Img);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("CrFbBltPutContentsNe failed %d", rc));
+                return -1;
+            }
+        }
+        else
+        {
+            int rc = CrFbUpdateBegin(hDstFb);
+            if (RT_SUCCESS(rc))
+            {
+                CrFbRegionsClear(hDstFb);
+
+                CrFbUpdateEnd(hDstFb);
+            }
+            else
+                WARN(("CrFbUpdateBegin failed %d", rc));
+
+            rc = crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("crVBoxServerCrCmdBltVramToVramMem failed, %d", rc));
+                return -1;
+            }
+        }
+
+        crPMgrPrimaryUpdate(hDstFb, cRects, pRects);
+
+        return 0;
+    }
+    else if (hSrcFb)
+    {
+        CR_BLITTER_IMG Img;
+        int8_t i8Result = crFbImgFromDimOffVramBGRA(offDstVRAM, dstWidth, dstHeight, &Img);
+        if (i8Result)
+        {
+            WARN(("invalid param"));
+            return -1;
+        }
+
+        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hSrcFb);
+        if (pScreen->u32Width == srcWidth && pScreen->u32Height == srcHeight)
+        {
+            int rc = CrFbBltGetContents(hSrcFb, pPos, cRects, pRects, &Img);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("CrFbBltGetContents failed %d", rc));
+                return -1;
+            }
+        }
+        else
+        {
+            int rc = CrFbUpdateBegin(hSrcFb);
+            if (RT_SUCCESS(rc))
+            {
+                CrFbRegionsClear(hSrcFb);
+
+                CrFbUpdateEnd(hSrcFb);
+            }
+            else
+                WARN(("CrFbUpdateBegin failed %d", rc));
+
+            rc = crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
+            if (RT_FAILURE(rc))
+            {
+                WARN(("crVBoxServerCrCmdBltVramToVramMem failed, %d", rc));
+                return -1;
+            }
+        }
+
+        return 0;
+    }
+
+    return crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
+}
+
+
+static int8_t crVBoxServerCrCmdBltOffIdProcess(const VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID *pCmd, uint32_t cbCmd)
+{
+    uint32_t cRects;
+    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
+    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) % sizeof (VBOXCMDVBVA_RECT))
+    {
+        WARN(("invalid argument size"));
+        return -1;
+    }
+
+    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) / sizeof (VBOXCMDVBVA_RECT);
+
+    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
+    if (!pRects)
+    {
+        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
+        return -1;
+    }
+
+    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
+    uint32_t hostId = pCmd->id;
+
+    Assert(u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID);
+
+    if (!hostId)
+    {
+        WARN(("zero host id"));
+        return -1;
+    }
+
+    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
+    {
+        WARN(("blit from texture to texture not implemented"));
+        return -1;
+    }
+
+    if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
+    {
+        WARN(("blit to texture not implemented"));
+        return -1;
+    }
+
+    VBOXCMDVBVAOFFSET offVRAM = pCmd->alloc.u.offVRAM;
+
+    RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
+    return crVBoxServerCrCmdBltIdToVram(hostId, offVRAM, 0, 0, &Pos, cRects, pRects);
+}
+
+static int8_t crVBoxServerCrCmdBltSameDimOrId(const VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8 *pCmd, uint32_t cbCmd)
+{
+    uint32_t cRects;
+    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
+    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8, aRects)) % sizeof (VBOXCMDVBVA_RECT))
+    {
+        WARN(("invalid argument size"));
+        return -1;
+    }
+
+    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
+
+    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
+    if (!pRects)
+    {
+        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
+        return -1;
+    }
+
+    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
+    VBOXCMDVBVAOFFSET offVRAM = pCmd->alloc1.Info.u.offVRAM;
+    uint32_t width = pCmd->alloc1.u16Width;
+    uint32_t height = pCmd->alloc1.u16Height;
+    RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
+
+    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID)
+    {
+        uint32_t hostId = pCmd->info2.u.id;
+
+        if (!hostId)
+        {
+            WARN(("zero host id"));
+            return -1;
+        }
+
+        if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
+        {
+            WARN(("blit from texture to texture not implemented"));
+            return -1;
+        }
+
+        if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
+        {
+            WARN(("blit to texture not implemented"));
+            return -1;
+        }
+
+        return crVBoxServerCrCmdBltIdToVram(hostId, offVRAM, width, height, &Pos, cRects, pRects);
+    }
+
+    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
+    {
+        if (!(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2))
+        {
+            WARN(("blit to texture not implemented"));
+            return -1;
+        }
+
+        return crVBoxServerCrCmdBltIdToVram(pCmd->alloc1.Info.u.id, pCmd->info2.u.offVRAM, width, height, &Pos, cRects, pRects);
+    }
+
+    if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
+        crVBoxServerCrCmdBltVramToVram(offVRAM, width, height, pCmd->info2.u.offVRAM, width, height, &Pos, cRects, pRects);
+    else
+        crVBoxServerCrCmdBltVramToVram(pCmd->info2.u.offVRAM, width, height, offVRAM, width, height, &Pos, cRects, pRects);
+
+    return 0;
+}
+
+static int8_t crVBoxServerCrCmdBltGenericBGRAProcess(const VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8 *pCmd, uint32_t cbCmd)
+{
+    uint32_t cRects;
+    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
+    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8, aRects)) % sizeof (VBOXCMDVBVA_RECT))
+    {
+        WARN(("invalid argument size"));
+        return -1;
+    }
+
+    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
+
+    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
+    if (!pRects)
+    {
+        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
+        return -1;
+    }
+
+    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
+    RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
+
+    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID)
+    {
+        if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
+        {
+            WARN(("blit from texture to texture not implemented"));
+            return -1;
+        }
+
+        if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
+        {
+            WARN(("blit to texture not implemented"));
+            return -1;
+        }
+
+        return crVBoxServerCrCmdBltIdToVram(pCmd->alloc2.Info.u.id, pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, &Pos, cRects, pRects);
+    }
+    else
+    {
+        if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
+        {
+            if (!(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2))
+            {
+                WARN(("blit to texture not implemented"));
+                return -1;
+            }
+
+            RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
+            return crVBoxServerCrCmdBltIdToVram(pCmd->alloc1.Info.u.id, pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, &Pos, cRects, pRects);
+        }
+
+        if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
+            crVBoxServerCrCmdBltVramToVram(pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, &Pos, cRects, pRects);
+        else
+            crVBoxServerCrCmdBltVramToVram(pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, &Pos, cRects, pRects);
+
+        return 0;
+    }
+}
+
+static int8_t crVBoxServerCrCmdClrFillPrimaryGenericProcess(uint32_t u32PrimaryID, const RTRECT *pRects, uint32_t cRects, uint32_t u32Color)
+{
+    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID);
+    if (!hFb)
+    {
+        WARN(("request to present on disabled framebuffer, ignore"));
+        return 0;
+    }
+
+    int rc = CrFbClrFillNe(hFb, cRects, pRects, u32Color);
+    if (!RT_SUCCESS(rc))
+    {
+        WARN(("CrFbClrFillNe failed %d", rc));
+        return -1;
+    }
+
+    return 0;
+}
+
+static int8_t crVBoxServerCrCmdClrFillVramGenericProcess(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTRECT *pRects, uint32_t cRects, uint32_t u32Color)
+{
+    CR_BLITTER_IMG Img;
+    int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img);
+    if (i8Result)
+    {
+        WARN(("invalid param"));
+        return -1;
+    }
+
+    CrMClrFillImg(&Img, cRects, pRects, u32Color);
+
+    return 0;
+}
+
+static int8_t crVBoxServerCrCmdClrFillGenericBGRAProcess(const VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8 *pCmd, uint32_t cbCmd)
+{
+    uint32_t cRects;
+    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
+    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects)) % sizeof (VBOXCMDVBVA_RECT))
+    {
+        WARN(("invalid argument size"));
+        return -1;
+    }
+
+    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
+
+    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
+    if (!pRects)
+    {
+        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
+        return -1;
+    }
+
+//    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
+    int8_t i8Result = crVBoxServerCrCmdClrFillVramGenericProcess(pCmd->dst.Info.u.offVRAM, pCmd->dst.u16Width, pCmd->dst.u16Height, pRects, cRects, pCmd->Hdr.u32Color);
+    if (i8Result < 0)
+    {
+        WARN(("crVBoxServerCrCmdClrFillVramGenericProcess failed"));
+        return i8Result;
+    }
+
+    return 0;
+}
+
+int8_t crVBoxServerCrCmdClrFillProcess(const VBOXCMDVBVA_CLRFILL_HDR *pCmd, uint32_t cbCmd)
+{
+    uint8_t u8Flags = pCmd->Hdr.u8Flags;
+    uint8_t u8Cmd = (VBOXCMDVBVA_OPF_CLRFILL_TYPE_MASK & u8Flags);
+
+    switch (u8Cmd)
+    {
+        case VBOXCMDVBVA_OPF_CLRFILL_TYPE_GENERIC_A8R8G8B8:
+        {
+            if (cbCmd < sizeof (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8))
+            {
+                WARN(("VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8: invalid command size"));
+                return -1;
+            }
+
+            return crVBoxServerCrCmdClrFillGenericBGRAProcess((const VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8*)pCmd, cbCmd);
+        }
+        default:
+            WARN(("unsupported command"));
+            return -1;
+    }
+
+}
+
+int8_t crVBoxServerCrCmdBltProcess(const VBOXCMDVBVA_BLT_HDR *pCmd, uint32_t cbCmd)
+{
+    uint8_t u8Flags = pCmd->Hdr.u8Flags;
+    uint8_t u8Cmd = (VBOXCMDVBVA_OPF_BLT_TYPE_MASK & u8Flags);
+
+    switch (u8Cmd)
+    {
+        case VBOXCMDVBVA_OPF_BLT_TYPE_SAMEDIM_A8R8G8B8:
+        {
+            if (cbCmd < sizeof (VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8))
+            {
+                WARN(("VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8: invalid command size"));
+                return -1;
+            }
+
+            return crVBoxServerCrCmdBltSameDimOrId((const VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8 *)pCmd, cbCmd);
+        }
+        case VBOXCMDVBVA_OPF_BLT_TYPE_OFFPRIMSZFMT_OR_ID:
+        {
+            if (cbCmd < sizeof (VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID))
+            {
+                WARN(("VBOXCMDVBVA_OPF_BLT_TYPE_OFFPRIMSZFMT_OR_ID: invalid command size"));
+                return -1;
+            }
+
+            return crVBoxServerCrCmdBltOffIdProcess((const VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID *)pCmd, cbCmd);
+        }
+        case VBOXCMDVBVA_OPF_BLT_TYPE_GENERIC_A8R8G8B8:
+        {
+            if (cbCmd < sizeof (VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8))
+            {
+                WARN(("VBOXCMDVBVA_OPF_BLT_TYPE_GENERIC_A8R8G8B8: invalid command size"));
+                return -1;
+            }
+
+            return crVBoxServerCrCmdBltGenericBGRAProcess((const VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8 *)pCmd, cbCmd);
+        }
+        default:
+            WARN(("unsupported command"));
+            return -1;
+    }
+}
+
+int8_t crVBoxServerCrCmdFlipProcess(const VBOXCMDVBVA_FLIP *pFlip)
+{
+    uint32_t hostId;
+    if (pFlip->Hdr.u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
+    {
+        hostId = pFlip->src.u.id;
+        if (!hostId)
+        {
+            WARN(("hostId is NULL"));
+            return -1;
+        }
+    }
+    else
+    {
+        WARN(("VBOXCMDVBVA_OPF_ALLOC_SRCID not specified"));
+        hostId = 0;
+    }
+
+    uint32_t idFb = pFlip->Hdr.u.u8PrimaryID;
+    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(idFb);
+    if (!hFb)
+    {
+        WARN(("request to present on disabled framebuffer, ignore"));
+        return 0;
+    }
+
+    const RTRECT *pRect = CrVrScrCompositorRectGet(&hFb->Compositor);
+    crServerDispatchVBoxTexPresent(hostId, idFb, 0, 0, 1, (const GLint*)pRect);
+    return 0;
+}
+
+typedef struct CRSERVER_CLIENT_CALLOUT
+{
+    VBOXCRCMDCTL_CALLOUT_LISTENTRY Entry;
+    PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb;
+    void*pvCb;
+} CRSERVER_CLIENT_CALLOUT;
+
+static DECLCALLBACK(void) crServerClientCalloutCb(struct VBOXCRCMDCTL_CALLOUT_LISTENTRY *pEntry)
+{
+    CRSERVER_CLIENT_CALLOUT *pCallout = RT_FROM_MEMBER(pEntry, CRSERVER_CLIENT_CALLOUT, Entry);
+    pCallout->pfnCb(pCallout->pvCb);
+    int rc = RTSemEventSignal(cr_server.hCalloutCompletionEvent);
+    if (RT_FAILURE(rc))
+        WARN(("RTSemEventSignal failed rc %d", rc));
+}
+
+static DECLCALLBACK(void) crServerClientCallout(PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb, void*pvCb)
+{
+    Assert(cr_server.pCurrentCalloutCtl);
+    CRSERVER_CLIENT_CALLOUT Callout;
+    Callout.pfnCb = pfnCb;
+    Callout.pvCb = pvCb;
+    cr_server.ClientInfo.pfnCallout(cr_server.ClientInfo.hClient, cr_server.pCurrentCalloutCtl, &Callout.Entry, crServerClientCalloutCb);
+
+    int rc = RTSemEventWait(cr_server.hCalloutCompletionEvent, RT_INDEFINITE_WAIT);
+    if (RT_FAILURE(rc))
+        WARN(("RTSemEventWait failed %d", rc));
+}
+
+
+DECLEXPORT(void) crVBoxServerCalloutEnable(VBOXCRCMDCTL *pCtl)
+{
+#if 1 //def CR_SERVER_WITH_CLIENT_CALLOUTS
+    Assert(!cr_server.pCurrentCalloutCtl);
+    cr_server.pCurrentCalloutCtl = pCtl;
+
+    cr_server.head_spu->dispatch_table.ChromiumParametervCR(GL_HH_SET_CLIENT_CALLOUT, 0, 0, (void*)crServerClientCallout);
+#endif
+}
+
+extern DECLEXPORT(void) crVBoxServerCalloutDisable()
+{
+#if 1 //def CR_SERVER_WITH_CLIENT_CALLOUTS
+    Assert(cr_server.pCurrentCalloutCtl);
+
+    cr_server.head_spu->dispatch_table.ChromiumParametervCR(GL_HH_SET_CLIENT_CALLOUT, 0, 0, NULL);
+
+    cr_server.pCurrentCalloutCtl = NULL;
+#endif
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h
new file mode 100644
index 0000000..a929d27
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h
@@ -0,0 +1,440 @@
+/* $Id: server_presenter.h $ */
+
+/** @file
+ * Presenter API definitions.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef __SERVER_PRESENTER_H__
+#define __SERVER_PRESENTER_H__
+
+#include "cr_spu.h"
+#include "chromium.h"
+#include "cr_error.h"
+#include "cr_net.h"
+#include "cr_rand.h"
+#include "server_dispatch.h"
+#include "server.h"
+#include "cr_mem.h"
+#include "cr_string.h"
+#include <cr_vreg.h>
+#include <cr_htable.h>
+#include <cr_bmpscale.h>
+
+#include "render/renderspu.h"
+
+#include <iprt/cdefs.h>
+#include <iprt/types.h>
+#include <iprt/asm.h>
+#include <iprt/mem.h>
+#include <iprt/list.h>
+
+
+class ICrFbDisplay
+{
+    public:
+        virtual int UpdateBegin(struct CR_FRAMEBUFFER *pFb) = 0;
+        virtual void UpdateEnd(struct CR_FRAMEBUFFER *pFb) = 0;
+
+        virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
+        virtual int EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
+        virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry) = 0;
+        virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
+        virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
+        virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
+        virtual int EntryPosChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
+
+        virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb) = 0;
+
+        virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb) = 0;
+
+        virtual ~ICrFbDisplay() {}
+};
+
+
+typedef struct CR_FRAMEBUFFER
+{
+    VBOXVR_SCR_COMPOSITOR Compositor;
+    struct VBVAINFOSCREEN ScreenInfo;
+    void *pvVram;
+    ICrFbDisplay *pDisplay;
+    RTLISTNODE EntriesList;
+    uint32_t cEntries; /* <- just for debugging */
+    uint32_t cUpdating;
+    CRHTABLE SlotTable;
+} CR_FRAMEBUFFER;
+
+
+typedef union CR_FBENTRY_FLAGS
+{
+    struct {
+        uint32_t fCreateNotified : 1;
+        uint32_t fInList         : 1;
+        uint32_t Reserved        : 30;
+    };
+    uint32_t Value;
+} CR_FBENTRY_FLAGS;
+
+
+typedef struct CR_FRAMEBUFFER_ENTRY
+{
+    VBOXVR_SCR_COMPOSITOR_ENTRY Entry;
+    RTLISTNODE Node;
+    uint32_t cRefs;
+    CR_FBENTRY_FLAGS Flags;
+    CRHTABLE HTable;
+} CR_FRAMEBUFFER_ENTRY;
+
+
+typedef struct CR_FBTEX
+{
+    CR_TEXDATA Tex;
+    CRTextureObj *pTobj;
+} CR_FBTEX;
+
+
+class CrFbDisplayBase : public ICrFbDisplay
+{
+    public:
+
+        CrFbDisplayBase();
+
+        virtual bool isComposite();
+        class CrFbDisplayComposite* getContainer();
+        bool isInList();
+        bool isUpdating();
+        int setRegionsChanged();
+        int setFramebuffer(struct CR_FRAMEBUFFER *pFb);
+        struct CR_FRAMEBUFFER* getFramebuffer();
+        virtual int UpdateBegin(struct CR_FRAMEBUFFER *pFb);
+        virtual void UpdateEnd(struct CR_FRAMEBUFFER *pFb);
+        virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry);
+        virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryPosChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb);
+        virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb);
+        virtual ~CrFbDisplayBase();
+
+        /*@todo: move to protected and switch from RTLISTNODE*/
+        RTLISTNODE mNode;
+        class CrFbDisplayComposite* mpContainer;
+
+    protected:
+
+        virtual void onUpdateEnd();
+        virtual void ueRegions();
+        static DECLCALLBACK(bool) entriesCreateCb(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext);
+        static DECLCALLBACK(bool) entriesDestroyCb(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext);
+        int fbSynchAddAllEntries();
+        int fbCleanupRemoveAllEntries();
+        virtual int setFramebufferBegin(struct CR_FRAMEBUFFER *pFb);
+        virtual void setFramebufferEnd(struct CR_FRAMEBUFFER *pFb);
+        static DECLCALLBACK(void) slotEntryReleaseCB(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext);
+        virtual void slotRelease();
+        virtual int fbCleanup();
+        virtual int fbSync();
+        CRHTABLE_HANDLE slotGet();
+
+    private:
+
+        typedef union CR_FBDISPBASE_FLAGS
+        {
+            struct {
+                uint32_t fRegionsShanged : 1;
+                uint32_t Reserved        : 31;
+            };
+            uint32_t u32Value;
+        } CR_FBDISPBASE_FLAGS;
+
+        struct CR_FRAMEBUFFER *mpFb;
+        uint32_t mcUpdates;
+        CRHTABLE_HANDLE mhSlot;
+        CR_FBDISPBASE_FLAGS mFlags;
+};
+
+
+class CrFbDisplayComposite : public CrFbDisplayBase
+{
+    public:
+
+        CrFbDisplayComposite();
+        virtual bool isComposite();
+        uint32_t getDisplayCount();
+        bool add(CrFbDisplayBase *pDisplay);
+        bool remove(CrFbDisplayBase *pDisplay, bool fCleanupDisplay = true);
+        CrFbDisplayBase* first();
+        CrFbDisplayBase* next(CrFbDisplayBase* pDisplay);
+        virtual int setFramebuffer(struct CR_FRAMEBUFFER *pFb);
+        virtual int UpdateBegin(struct CR_FRAMEBUFFER *pFb);
+        virtual void UpdateEnd(struct CR_FRAMEBUFFER *pFb);
+        virtual int EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry);
+        virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb);
+        virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb);
+        virtual ~CrFbDisplayComposite();
+        void cleanup(bool fCleanupDisplays = true);
+
+    private:
+
+        RTLISTNODE mDisplays;
+        uint32_t mcDisplays;
+};
+
+
+class CrFbWindow
+{
+    public:
+
+        CrFbWindow(uint64_t parentId);
+        bool IsCreated() const;
+        bool IsVisivle() const;
+        void Destroy();
+        int Reparent(uint64_t parentId);
+        int SetVisible(bool fVisible);
+        int SetSize(uint32_t width, uint32_t height, bool fForced=false);
+        int SetPosition(int32_t x, int32_t y, bool fForced=false);
+        int SetVisibleRegionsChanged();
+        int SetCompositor(const struct VBOXVR_SCR_COMPOSITOR * pCompositor);
+        bool SetScaleFactor(GLdouble scaleFactorW, GLdouble scaleFactorH);
+        bool GetScaleFactor(GLdouble *scaleFactorW, GLdouble *scaleFactorH);
+        int UpdateBegin();
+        void UpdateEnd();
+        uint64_t GetParentId();
+        int Create();
+        ~CrFbWindow();
+
+    protected:
+
+        void checkRegions();
+        bool isPresentNeeded();
+        bool checkInitedUpdating();
+
+    private:
+
+        typedef union CR_FBWIN_FLAGS
+        {
+            struct {
+                uint32_t fVisible : 1;
+                uint32_t fDataPresented : 1;
+                uint32_t fForcePresentOnReenable : 1;
+                uint32_t fCompositoEntriesModified : 1;
+                uint32_t Reserved : 28;
+            };
+            uint32_t Value;
+        } CR_FBWIN_FLAGS;
+
+        GLint mSpuWindow;
+        const struct VBOXVR_SCR_COMPOSITOR * mpCompositor;
+        uint32_t mcUpdates;
+        int32_t mxPos;
+        int32_t myPos;
+        uint32_t mWidth;
+        uint32_t mHeight;
+        CR_FBWIN_FLAGS mFlags;
+        uint64_t mParentId;
+
+        RTSEMRW scaleFactorLock;
+        GLdouble mScaleFactorWStorage;
+        GLdouble mScaleFactorHStorage;
+};
+
+
+class CrFbDisplayWindow : public CrFbDisplayBase
+{
+    public:
+
+        CrFbDisplayWindow(const RTRECT *pViewportRect, uint64_t parentId);
+        virtual ~CrFbDisplayWindow();
+        virtual int UpdateBegin(struct CR_FRAMEBUFFER *pFb);
+        virtual void UpdateEnd(struct CR_FRAMEBUFFER *pFb);
+        virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb);
+        virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry);
+        virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb);
+        const RTRECT* getViewportRect();
+        virtual int setViewportRect(const RTRECT *pViewportRect);
+        virtual CrFbWindow * windowDetach(bool fCleanup = true);
+        virtual CrFbWindow * windowAttach(CrFbWindow * pNewWindow);
+        virtual int reparent(uint64_t parentId);
+        virtual bool isVisible();
+        int winVisibilityChanged();
+        CrFbWindow* getWindow();
+
+    protected:
+
+        virtual void onUpdateEnd();
+        virtual void ueRegions();
+        virtual int screenChanged();
+        virtual int windowSetCompositor(bool fSet);
+        virtual int windowCleanup();
+        virtual int fbCleanup();
+        bool isActive();
+        int windowDimensionsSync(bool fForceCleanup = false);
+        virtual int windowSync();
+        virtual int fbSync();
+        virtual const struct RTRECT* getRect();
+
+    private:
+
+        typedef union CR_FBDISPWINDOW_FLAGS
+        {
+            struct {
+                uint32_t fNeVisible : 1;
+                uint32_t fNeForce   : 1;
+                uint32_t Reserved   : 30;
+            };
+            uint32_t u32Value;
+        } CR_FBDISPWINDOW_FLAGS;
+
+        CrFbWindow *mpWindow;
+        RTRECT mViewportRect;
+        CR_FBDISPWINDOW_FLAGS mFlags;
+        uint32_t mu32Screen;
+        uint64_t mParentId;
+};
+
+
+class CrFbDisplayWindowRootVr : public CrFbDisplayWindow
+{
+    public:
+
+        CrFbDisplayWindowRootVr(const RTRECT *pViewportRect, uint64_t parentId);
+        virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry);
+        virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int setViewportRect(const RTRECT *pViewportRect);
+
+    protected:
+
+        virtual int windowSetCompositor(bool fSet);
+        virtual void ueRegions();
+        int compositorMarkUpdated();
+        virtual int screenChanged();
+        virtual const struct RTRECT* getRect();
+        virtual int fbCleanup();
+        virtual int fbSync();
+        VBOXVR_SCR_COMPOSITOR_ENTRY* entryAlloc();
+        void entryFree(VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry);
+        int synchCompositorRegions();
+        virtual int synchCompositor();
+        virtual int clearCompositor();
+        void rootVrTranslateForPos();
+        static DECLCALLBACK(VBOXVR_SCR_COMPOSITOR_ENTRY*) rootVrGetCEntry(const VBOXVR_SCR_COMPOSITOR_ENTRY*pEntry, void *pvContext);
+
+    private:
+
+        VBOXVR_SCR_COMPOSITOR mCompositor;
+};
+
+
+class CrFbDisplayVrdp : public CrFbDisplayBase
+{
+    public:
+
+        CrFbDisplayVrdp();
+        virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry);
+        virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int EntryPosChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb);
+        virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb);
+
+    protected:
+
+        void syncPos();
+        virtual int fbCleanup();
+        virtual int fbSync();
+        void vrdpDestroy(HCR_FRAMEBUFFER_ENTRY hEntry);
+        void vrdpGeometry(HCR_FRAMEBUFFER_ENTRY hEntry);
+        int vrdpRegions(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        int vrdpFrame(HCR_FRAMEBUFFER_ENTRY hEntry);
+        int vrdpRegionsAll(struct CR_FRAMEBUFFER *pFb);
+        int vrdpSynchEntry(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+        int vrdpSyncEntryAll(struct CR_FRAMEBUFFER *pFb);
+        int vrdpCreate(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry);
+
+    private:
+
+        RTPOINT mPos;
+};
+
+
+typedef struct CR_FB_INFO
+{
+    CrFbDisplayComposite *pDpComposite;
+    uint32_t u32Id;
+    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap);
+} CR_FB_INFO;
+
+typedef struct CR_FBDISPLAY_INFO
+{
+    CrFbDisplayWindow *pDpWin;
+    CrFbDisplayWindowRootVr *pDpWinRootVr;
+    CrFbDisplayVrdp *pDpVrdp;
+    CrFbWindow *pWindow;
+    uint32_t u32DisplayMode;
+    uint32_t u32Id;
+    int32_t iFb;
+
+    /* Cache scaling factor here before display output
+     * initialized (i.e., guest not yet initiated first 3D call).
+     * No synchronization stuff needed here because all the reads
+     * and writes are done in context of 3D HGCM thread. */
+    double dInitialScaleFactorW;
+    double dInitialScaleFactorH;
+} CR_FBDISPLAY_INFO;
+
+typedef struct CR_PRESENTER_GLOBALS
+{
+#ifndef VBOXVDBG_MEMCACHE_DISABLE
+    RTMEMCACHE FbEntryLookasideList;
+    RTMEMCACHE FbTexLookasideList;
+    RTMEMCACHE CEntryLookasideList;
+#endif
+    uint32_t u32DisplayMode;
+    uint32_t u32DisabledDisplayMode;
+    bool fEnabled;
+    CRHashTable *pFbTexMap;
+    CR_FBDISPLAY_INFO aDisplayInfos[CR_MAX_GUEST_MONITORS];
+    CR_FBMAP FramebufferInitMap;
+    CR_FRAMEBUFFER aFramebuffers[CR_MAX_GUEST_MONITORS];
+    CR_FB_INFO aFbInfos[CR_MAX_GUEST_MONITORS];
+    bool fWindowsForceHidden;
+    uint32_t cbTmpBuf;
+    void *pvTmpBuf;
+    uint32_t cbTmpBuf2;
+    void *pvTmpBuf2;
+} CR_PRESENTER_GLOBALS;
+
+extern CR_PRESENTER_GLOBALS g_CrPresenter;
+
+
+HCR_FRAMEBUFFER_ENTRY CrFbEntryFromCompositorEntry(const struct VBOXVR_SCR_COMPOSITOR_ENTRY* pCEntry);
+
+#endif /* __SERVER_PRESENTER_H__ */
+
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/window.cpp b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/window.cpp
new file mode 100644
index 0000000..9601c58
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/window.cpp
@@ -0,0 +1,463 @@
+/* $Id: window.cpp $ */
+
+/** @file
+ * Presenter API: window class implementation.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "server_presenter.h"
+#include <VBox/VBoxOGL.h>
+
+CrFbWindow::CrFbWindow(uint64_t parentId) :
+    mSpuWindow(0),
+    mpCompositor(NULL),
+    mcUpdates(0),
+    mxPos(0),
+    myPos(0),
+    mWidth(0),
+    mHeight(0),
+    mParentId(parentId),
+    mScaleFactorWStorage(1.0),
+    mScaleFactorHStorage(1.0)
+{
+    int rc;
+
+    mFlags.Value = 0;
+
+    rc = RTSemRWCreate(&scaleFactorLock);
+    if (!RT_SUCCESS(rc))
+        WARN(("Unable to initialize scaling factor data lock."));
+}
+
+
+bool CrFbWindow::IsCreated() const
+{
+    return !!mSpuWindow;
+}
+
+bool CrFbWindow::IsVisivle() const
+{
+    return mFlags.fVisible;
+}
+
+
+void CrFbWindow::Destroy()
+{
+    CRASSERT(!mcUpdates);
+
+    if (!mSpuWindow)
+        return;
+
+    cr_server.head_spu->dispatch_table.WindowDestroy(mSpuWindow);
+
+    mSpuWindow = 0;
+    mFlags.fDataPresented = 0;
+}
+
+
+int CrFbWindow::Reparent(uint64_t parentId)
+{
+    if (!checkInitedUpdating())
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+
+    crDebug("CrFbWindow: reparent to %p (current mxPos=%d, myPos=%d, mWidth=%u, mHeight=%u)",
+        parentId, mxPos, myPos, mWidth, mHeight);
+
+    uint64_t oldParentId = mParentId;
+
+    mParentId = parentId;
+
+    if (mSpuWindow)
+    {
+        if (oldParentId && !parentId && mFlags.fVisible)
+            cr_server.head_spu->dispatch_table.WindowShow(mSpuWindow, false);
+
+        renderspuSetWindowId(mParentId);
+        renderspuReparentWindow(mSpuWindow);
+        renderspuSetWindowId(cr_server.screen[0].winID);
+
+        if (parentId)
+        {
+            if (mFlags.fVisible)
+                cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, mxPos, myPos);
+            cr_server.head_spu->dispatch_table.WindowShow(mSpuWindow, mFlags.fVisible);
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbWindow::SetVisible(bool fVisible)
+{
+    if (!checkInitedUpdating())
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+
+    LOG(("CrWIN: Visible [%d]", fVisible));
+
+    if (!fVisible != !mFlags.fVisible)
+    {
+        mFlags.fVisible = fVisible;
+        if (mSpuWindow && mParentId)
+        {
+            if (fVisible)
+                cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, mxPos, myPos);
+            cr_server.head_spu->dispatch_table.WindowShow(mSpuWindow, fVisible);
+        }
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbWindow::SetSize(uint32_t width, uint32_t height, bool fForced)
+{
+    if (!fForced && !checkInitedUpdating())
+    {
+        crDebug("CrFbWindow: SetSize request dropped because window is currently updating"
+                "(width=%d, height=%d, mWidth=%d, mHeight=%d).", width, height, mWidth, mHeight);
+        return VERR_INVALID_STATE;
+    }
+
+    if (mWidth != width || mHeight != height || fForced)
+    {
+        GLdouble scaleFactorW, scaleFactorH;
+        uint32_t scaledWidth, scaledHeight;
+
+        /* Reset to default values if operation was unsuccessfull. */
+        if (!GetScaleFactor(&scaleFactorW, &scaleFactorH))
+            scaleFactorW = scaleFactorH = 1.0;
+
+        mFlags.fCompositoEntriesModified = 1;
+
+        /* Keep mWidth and mHeight unchanged (not multiplied by scale factor scalar). */
+        mWidth  = width;
+        mHeight = height;
+
+        scaledWidth  = (uint32_t)((GLdouble)width  * scaleFactorW);
+        scaledHeight = (uint32_t)((GLdouble)height * scaleFactorH);
+
+        if (mSpuWindow)
+        {
+            cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, scaledWidth, scaledHeight);
+            crDebug("CrFbWindow: SetSize request performed successfully "
+                    "(width=%d, height=%d, scaledWidth=%d, scaledHeight=%d).", width, height, scaledWidth, scaledHeight);
+        }
+        else
+            crDebug("CrFbWindow: SetSize request skipped because mSpuWindow not yet constructed "
+                    "(width=%d, height=%d, scaledWidth=%d, scaledHeight=%d).", width, height, scaledWidth, scaledHeight);
+    }
+    else
+        crDebug("CrFbWindow: SetSize request skipped because window arleady has requested size "
+                "(width=%d, height=%d, mWidth=%d, mHeight=%d).", width, height, mWidth, mHeight);
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbWindow::SetPosition(int32_t x, int32_t y, bool fForced)
+{
+    if (!fForced && !checkInitedUpdating())
+    {
+        crDebug("CrFbWindow: SetPosition request dropped because window is currently updating (x=%d, y=%d).", x, y);
+        return VERR_INVALID_STATE;
+    }
+
+    LOG(("CrWIN: Pos [%d ; %d]", x, y));
+//      always do WindowPosition to ensure window is adjusted properly
+//        if (x != mxPos || y != myPos)
+    {
+        mxPos = x;
+        myPos = y;
+        if (mSpuWindow)
+            cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, x, y);
+        crDebug("CrFbWindow: SetPosition performed successfully (x=%d, y=%d).", x, y);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+int CrFbWindow::SetVisibleRegionsChanged()
+{
+    if (!checkInitedUpdating())
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+
+    mFlags.fCompositoEntriesModified = 1;
+    return VINF_SUCCESS;
+}
+
+
+int CrFbWindow::SetCompositor(const struct VBOXVR_SCR_COMPOSITOR * pCompositor)
+{
+    if (!checkInitedUpdating())
+    {
+        WARN(("err"));
+        return VERR_INVALID_STATE;
+    }
+
+    mpCompositor = pCompositor;
+    mFlags.fCompositoEntriesModified = 1;
+
+    return VINF_SUCCESS;
+}
+
+
+bool CrFbWindow::SetScaleFactor(GLdouble scaleFactorW, GLdouble scaleFactorH)
+{
+    int rc;
+
+    /* Simple check for input values. */
+    if ( !(  (scaleFactorW >= VBOX_OGL_SCALE_FACTOR_MIN && scaleFactorW <= VBOX_OGL_SCALE_FACTOR_MAX)
+          && (scaleFactorH >= VBOX_OGL_SCALE_FACTOR_MIN && scaleFactorH <= VBOX_OGL_SCALE_FACTOR_MAX)))
+    {
+        crDebug("CrFbWindow: attempt to set scale factor out of valid values range: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.",
+            (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+            (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER);
+
+        return false;
+    }
+
+    rc = RTSemRWRequestWrite(scaleFactorLock, RT_INDEFINITE_WAIT);
+    if (RT_SUCCESS(rc))
+    {
+        mScaleFactorWStorage = scaleFactorW;
+        mScaleFactorHStorage = scaleFactorH;
+        RTSemRWReleaseWrite(scaleFactorLock);
+
+        crDebug("CrFbWindow: set scale factor: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.",
+            (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+            (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER);
+
+        /* Update window geometry. Do not wait for GAs to send SetSize() and SetPosition()
+         * events since they might not be running or installed at all. */
+        SetSize(mWidth, mHeight, true);
+        SetPosition(mxPos, myPos, true);
+
+        return true;
+    }
+
+    crDebug("CrFbWindow: unable to set scale factor because RW lock cannot be aquired: scaleFactorW=%d, scaleFactorH=%d, multiplier=%d.",
+            (int)(scaleFactorW * VBOX_OGL_SCALE_FACTOR_MULTIPLIER), (int)(scaleFactorH * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
+            (int)VBOX_OGL_SCALE_FACTOR_MULTIPLIER);
+
+    return false;
+}
+
+
+bool CrFbWindow::GetScaleFactor(GLdouble *scaleFactorW, GLdouble *scaleFactorH)
+{
+    int rc;
+
+    rc = RTSemRWRequestRead(scaleFactorLock, RT_INDEFINITE_WAIT);
+    if (RT_SUCCESS(rc))
+    {
+        *scaleFactorW = mScaleFactorWStorage;
+        *scaleFactorH = mScaleFactorHStorage;
+        RTSemRWReleaseRead(scaleFactorLock);
+        return true;
+    }
+
+    return false;
+}
+
+
+int CrFbWindow::UpdateBegin()
+{
+    ++mcUpdates;
+    if (mcUpdates > 1)
+        return VINF_SUCCESS;
+
+    Assert(!mFlags.fForcePresentOnReenable);
+
+    if (mFlags.fDataPresented)
+    {
+        Assert(mSpuWindow);
+        cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, NULL, NULL);
+        mFlags.fForcePresentOnReenable = isPresentNeeded();
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+void CrFbWindow::UpdateEnd()
+{
+    --mcUpdates;
+    Assert(mcUpdates < UINT32_MAX/2);
+    if (mcUpdates)
+        return;
+
+    checkRegions();
+
+    if (mSpuWindow)
+    {
+        bool fPresentNeeded = isPresentNeeded();
+        if (fPresentNeeded || mFlags.fForcePresentOnReenable)
+        {
+            GLdouble scaleFactorW, scaleFactorH;
+            /* Reset to default values if operation was unseccessfull. */
+            if (!GetScaleFactor(&scaleFactorW, &scaleFactorH))
+                scaleFactorW = scaleFactorH = 1.0;
+
+            mFlags.fForcePresentOnReenable = false;
+            if (mpCompositor)
+            {
+                CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)mpCompositor, scaleFactorW, scaleFactorH);
+                cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, mpCompositor, NULL);
+            }
+            else
+            {
+                VBOXVR_SCR_COMPOSITOR TmpCompositor;
+                RTRECT Rect;
+                Rect.xLeft   = 0;
+                Rect.yTop    = 0;
+                Rect.xRight  = (uint32_t)((GLdouble)mWidth  * scaleFactorW);
+                Rect.yBottom = (uint32_t)((GLdouble)mHeight * scaleFactorH);
+                CrVrScrCompositorInit(&TmpCompositor, &Rect);
+                CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)&TmpCompositor, scaleFactorW, scaleFactorH);
+                /* this is a cleanup operation
+                 * empty compositor is guarantid to be released on VBoxPresentComposition return */
+                cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, &TmpCompositor, NULL);
+            }
+            g_pLed->Asserted.s.fWriting = 1;
+        }
+
+        /* even if the above branch is entered due to mFlags.fForcePresentOnReenable,
+         * the backend should clean up the compositor as soon as presentation is performed */
+        mFlags.fDataPresented = fPresentNeeded;
+    }
+    else
+    {
+        Assert(!mFlags.fDataPresented);
+        Assert(!mFlags.fForcePresentOnReenable);
+    }
+}
+
+
+uint64_t CrFbWindow::GetParentId()
+{
+    return mParentId;
+}
+
+
+int CrFbWindow::Create()
+{
+    if (mSpuWindow)
+    {
+        //WARN(("window already created"));
+        return VINF_ALREADY_INITIALIZED;
+    }
+
+    CRASSERT(cr_server.fVisualBitsDefault);
+    renderspuSetWindowId(mParentId);
+    mSpuWindow = cr_server.head_spu->dispatch_table.WindowCreate("", cr_server.fVisualBitsDefault);
+    renderspuSetWindowId(cr_server.screen[0].winID);
+    if (mSpuWindow < 0) {
+        WARN(("WindowCreate failed"));
+        return VERR_GENERAL_FAILURE;
+    }
+
+    GLdouble scaleFactorW, scaleFactorH;
+    /* Reset to default values if operation was unseccessfull. */
+    if (!GetScaleFactor(&scaleFactorW, &scaleFactorH))
+        scaleFactorW = scaleFactorH = 1.0;
+
+    uint32_t scaledWidth, scaledHeight;
+
+    scaledWidth  = (uint32_t)((GLdouble)mWidth  * scaleFactorW);
+    scaledHeight = (uint32_t)((GLdouble)mHeight * scaleFactorH);
+
+    cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, scaledWidth, scaledHeight);
+    cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, mxPos, myPos);
+
+    checkRegions();
+
+    if (mParentId && mFlags.fVisible)
+        cr_server.head_spu->dispatch_table.WindowShow(mSpuWindow, true);
+
+    return VINF_SUCCESS;
+}
+
+
+CrFbWindow::~CrFbWindow()
+{
+    int rc;
+
+    Destroy();
+
+    rc = RTSemRWDestroy(scaleFactorLock);
+    if (!RT_SUCCESS(rc))
+        WARN(("Unable to release scaling factor data lock."));
+}
+
+
+void CrFbWindow::checkRegions()
+{
+    if (!mSpuWindow)
+        return;
+
+    if (!mFlags.fCompositoEntriesModified)
+        return;
+
+    uint32_t cRects;
+    const RTRECT *pRects;
+    if (mpCompositor)
+    {
+        int rc = CrVrScrCompositorRegionsGet(mpCompositor, &cRects, NULL, &pRects, NULL);
+        if (!RT_SUCCESS(rc))
+        {
+            WARN(("CrVrScrCompositorRegionsGet failed rc %d", rc));
+            cRects = 0;
+            pRects = NULL;
+        }
+    }
+    else
+    {
+        cRects = 0;
+        pRects = NULL;
+    }
+
+    cr_server.head_spu->dispatch_table.WindowVisibleRegion(mSpuWindow, cRects, (const GLint*)pRects);
+
+    mFlags.fCompositoEntriesModified = 0;
+}
+
+
+bool CrFbWindow::isPresentNeeded()
+{
+    return mFlags.fVisible && mWidth && mHeight && mpCompositor && !CrVrScrCompositorIsEmpty(mpCompositor);
+}
+
+
+bool CrFbWindow::checkInitedUpdating()
+{
+    if (!mcUpdates)
+    {
+        WARN(("not updating"));
+        return false;
+    }
+
+    return true;
+}
+
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h b/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
index d6ee948..c33cd48 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
@@ -140,7 +140,7 @@ GLboolean crServerSupportRedirMuralFBO(void);
 void crVBoxServerMuralFbResizeBegin(HCR_FRAMEBUFFER hFb);
 void crVBoxServerMuralFbResizeEnd(HCR_FRAMEBUFFER hFb);
 
-void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void*pvData);
+void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void* pvData, uint32_t cbData);
 
 void crServerRedirMuralFbClear(CRMuralInfo *mural);
 
@@ -434,7 +434,6 @@ bool CrFbHas3DData(HCR_FRAMEBUFFER hFb);
 void CrFbVisitCreatedEntries(HCR_FRAMEBUFFER hFb, PFNCR_FRAMEBUFFER_ENTRIES_VISITOR_CB pfnVisitorCb, void *pvContext);
 int CrFbResize(HCR_FRAMEBUFFER hFb, const struct VBVAINFOSCREEN * pScreen, void *pvVRAM);
 int CrFbBltGetContentsEx(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg);
-int CrFbBltGetContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pPrects, CR_BLITTER_IMG *pImg);
 bool CrFbIsEnabled(HCR_FRAMEBUFFER hFb);
 int CrFbEntryCreateForTexId(HCR_FRAMEBUFFER hFb, GLuint idTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry);
 int CrFbEntryCreateForTexData(HCR_FRAMEBUFFER hFb, struct CR_TEXDATA *pTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry);
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
index e9d41d9..4ffb7e3 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_config.c
@@ -72,8 +72,8 @@ static bool crServerHasInsufficientCaps()
     if (!cr_server.head_spu)
         return true;
 
-    sRealRender  = cr_server.head_spu->dispatch_table.GetString(GL_REAL_RENDERER);
-    sRealVersion = cr_server.head_spu->dispatch_table.GetString(GL_REAL_VERSION);
+    sRealRender  = (const char *)cr_server.head_spu->dispatch_table.GetString(GL_REAL_RENDERER);
+    sRealVersion = (const char *)cr_server.head_spu->dispatch_table.GetString(GL_REAL_VERSION);
 
     if (sRealRender && RTStrCmp(sRealRender, "GDI Generic") == 0)
         if (sRealVersion && RTStrCmp(sRealVersion, "1.1.0") == 0)
@@ -115,7 +115,11 @@ void crServerSetVBoxConfiguration()
         crError("CRServer: Couldn't get my own hostname?");
     }
 
+#ifdef VBOX_WITH_CR_DISPLAY_LISTS
+    strcpy(response, "1 0 expando");
+#else
     strcpy(response, "1 0 render");
+#endif
     crDebug("CRServer: my SPU chain: %s", response);
 
     /* response will describe the SPU chain.
@@ -134,7 +138,6 @@ void crServerSetVBoxConfiguration()
     }
     spu_names[i] = NULL;
 
-    //spu_dir = crStrdup(response);
     crNetSetRank(0);
     crNetSetContextRange(32, 35);
     crNetSetNodeRange("iam0", "iamvis20");
@@ -142,33 +145,6 @@ void crServerSetVBoxConfiguration()
     crNetSetKey(key,sizeof(key));
     cr_server.tcpip_port = 7000;
 
-        /*cr_server.optimizeBucket = crStrToInt(response);
-        cr_server.localTileSpec = crStrToInt(response);
-        cr_server.useL2 = crStrToInt(response);
-        cr_server.ignore_papi = crStrToInt(response);
-        if (crMothershipGetServerParam(conn, response, "overlap_blending"))
-        {
-            if (!crStrcmp(response, "blend"))
-                cr_server.overlapBlending = 1;
-            else if (!crStrcmp(response, "knockout"))
-                cr_server.overlapBlending = 2;
-        }
-        if (crMothershipGetServerParam(conn, response, "overlap_levels"))
-        cr_server.only_swap_once = crStrToInt(response);
-        cr_server.debug_barriers = crStrToInt(response);
-        cr_server.sharedDisplayLists = crStrToInt(response);
-        cr_server.sharedTextureObjects = crStrToInt(response);
-        cr_server.sharedPrograms = crStrToInt(response);
-        cr_server.sharedWindows = crStrToInt(response);
-        cr_server.uniqueWindows = crStrToInt(response);
-        cr_server.useDMX = crStrToInt(response);
-        if (crMothershipGetServerParam(conn, response, "vertprog_projection_param"))
-        if (crMothershipGetServerParam(conn, response, "stereo_view"))
-        if (crMothershipGetServerParam(conn, response, "view_matrix"))
-        if (crMothershipGetServerParam(conn, response, "right_view_matrix"))
-        if (crMothershipGetServerParam(conn, response, "projection_matrix"))
-        if (crMothershipGetServerParam(conn, response, "right_projection_matrix"))*/
-
     crDebug("CRServer: my port number is %d", cr_server.tcpip_port);
 
     /*
@@ -313,8 +289,13 @@ void crServerSetVBoxConfigurationHGCM()
 {
     CRMuralInfo *defaultMural;
 
+#ifdef VBOX_WITH_CR_DISPLAY_LISTS
+    int spu_ids[1]     = {0};
+    char *spu_names[1] = {"expando"};
+#else
     int spu_ids[1]     = {0};
     char *spu_names[1] = {"render"};
+#endif
     char *spu_dir = NULL;
     int i;
     GLint dims[4];
@@ -346,6 +327,7 @@ void crServerSetVBoxConfigurationHGCM()
     else
         cr_server.fVisualBitsDefault = CR_RGB_BIT | CR_ALPHA_BIT | CR_DOUBLE_BIT;
 
+
     env = crGetenv("CR_SERVER_CAPS");
     if (env && env[0] != '\0')
     {
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c
index 25d4b91..b627084 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_glsl.c
@@ -165,3 +165,70 @@ void SERVER_DISPATCH_APIENTRY crServerDispatchGetShaderiv( GLuint shader, GLenum
     crServerReturnValue( &(local_params[0]), 1*sizeof(GLint) );
 }
 #endif /* #ifdef CR_OPENGL_VERSION_2_0 */
+
+/* XXXX Note: shared/separate Program ID numbers aren't totally implemented! */
+GLuint crServerTranslateProgramID( GLuint id )
+{
+    if (!cr_server.sharedPrograms && id) {
+        int client = cr_server.curClient->number;
+        return id + client * 100000;
+    }
+    return id;
+}
+
+
+void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteProgramsARB(GLsizei n, const GLuint * programs)
+{
+    GLuint *pLocalProgs = (GLuint *) crAlloc(n * sizeof(GLuint));
+    GLint i;
+    if (!pLocalProgs) {
+        crError("crServerDispatchDeleteProgramsARB: out of memory");
+        return;
+    }
+    for (i = 0; i < n; i++) {
+        pLocalProgs[i] = crServerTranslateProgramID(programs[i]);
+    }
+    crStateDeleteProgramsARB(n, pLocalProgs);
+    cr_server.head_spu->dispatch_table.DeleteProgramsARB(n, pLocalProgs);
+    crFree(pLocalProgs);
+}
+
+
+/*@todo will fail for progs loaded from snapshot */
+GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsProgramARB( GLuint program )
+{
+    GLboolean retval;
+    program = crServerTranslateProgramID(program);
+    retval = cr_server.head_spu->dispatch_table.IsProgramARB( program );
+    crServerReturnValue( &retval, sizeof(retval) );
+    return retval; /* WILL PROBABLY BE IGNORED */
+}
+
+
+GLboolean SERVER_DISPATCH_APIENTRY
+crServerDispatchAreProgramsResidentNV(GLsizei n, const GLuint *programs,
+                                                                            GLboolean *residences)
+{
+    GLboolean retval;
+    GLboolean *res = (GLboolean *) crAlloc(n * sizeof(GLboolean));
+    GLsizei i;
+
+    (void) residences;
+
+    if (!cr_server.sharedTextureObjects) {
+        GLuint *programs2 = (GLuint *) crAlloc(n * sizeof(GLuint));
+        for (i = 0; i < n; i++)
+            programs2[i] = crServerTranslateProgramID(programs[i]);
+        retval = cr_server.head_spu->dispatch_table.AreProgramsResidentNV(n, programs2, res);
+        crFree(programs2);
+    }
+    else {
+        retval = cr_server.head_spu->dispatch_table.AreProgramsResidentNV(n, programs, res);
+    }
+
+    crServerReturnValue(res, n * sizeof(GLboolean));
+    crFree(res);
+
+    return retval; /* WILL PROBABLY BE IGNORED */
+}
+
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_lists.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_lists.c
index 4835dfd..89e9ce1 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_lists.c
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_lists.c
@@ -46,14 +46,13 @@ static GLuint TranslateListID( GLuint id )
     return id;
 }
 
-/* XXXX Note: shared/separate Program ID numbers aren't totally implemented! */
-GLuint crServerTranslateProgramID( GLuint id )
+
+GLuint SERVER_DISPATCH_APIENTRY crServerDispatchGenLists( GLsizei range )
 {
-    if (!cr_server.sharedPrograms && id) {
-        int client = cr_server.curClient->number;
-        return id + client * 100000;
-    }
-    return id;
+    GLuint retval;
+    retval = cr_server.head_spu->dispatch_table.GenLists( range );
+    crServerReturnValue( &retval, sizeof(retval) );
+    return retval; /* WILL PROBABLY BE IGNORED */
 }
 
 
@@ -270,148 +269,3 @@ void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteLists( GLuint list, GLsizei
     crStateDeleteLists( list, range );
     cr_server.head_spu->dispatch_table.DeleteLists( list, range );
 }
-
-
-void SERVER_DISPATCH_APIENTRY crServerDispatchBindTexture( GLenum target, GLuint texture )
-{
-    crStateBindTexture( target, texture );
-    cr_server.head_spu->dispatch_table.BindTexture(target, crStateGetTextureHWID(texture));
-}
-
-void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteTextures( GLsizei n, const GLuint *textures)
-{
-    GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint));
-    GLint i;
-
-    if (!newTextures)
-    {
-        crError("crServerDispatchDeleteTextures: out of memory");
-        return;
-    }
-
-    for (i = 0; i < n; i++)
-    {
-        newTextures[i] = crStateGetTextureHWID(textures[i]);
-    }
-
-//    for (i = 0; i < n; ++i)
-//    {
-//        crDebug("DeleteTexture: %d, pid %d, ctx %d", textures[i], (uint32_t)cr_server.curClient->pid, cr_server.currentCtxInfo->pContext->id);
-//    }
-
-
-    crStateDeleteTextures(n, textures);
-    cr_server.head_spu->dispatch_table.DeleteTextures(n, newTextures);
-    crFree(newTextures);
-}
-
-void SERVER_DISPATCH_APIENTRY crServerDispatchPrioritizeTextures( GLsizei n, const GLuint * textures, const GLclampf * priorities )
-{
-    GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint));
-    GLint i;
-
-    if (!newTextures)
-    {
-        crError("crServerDispatchDeleteTextures: out of memory");
-        return;
-    }
-
-    crStatePrioritizeTextures(n, textures, priorities);
-
-    for (i = 0; i < n; i++)
-    {
-        newTextures[i] = crStateGetTextureHWID(textures[i]);
-    }
-
-    cr_server.head_spu->dispatch_table.PrioritizeTextures(n, newTextures, priorities);
-    crFree(newTextures);
-}
-
-void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteProgramsARB(GLsizei n, const GLuint * programs)
-{
-    GLuint *pLocalProgs = (GLuint *) crAlloc(n * sizeof(GLuint));
-    GLint i;
-    if (!pLocalProgs) {
-        crError("crServerDispatchDeleteProgramsARB: out of memory");
-        return;
-    }
-    for (i = 0; i < n; i++) {
-        pLocalProgs[i] = crServerTranslateProgramID(programs[i]);
-    }
-    crStateDeleteProgramsARB(n, pLocalProgs);
-    cr_server.head_spu->dispatch_table.DeleteProgramsARB(n, pLocalProgs);
-    crFree(pLocalProgs);
-}
-
-/*@todo will fail for textures loaded from snapshot */
-GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsTexture( GLuint texture )
-{
-    GLboolean retval;
-    retval = cr_server.head_spu->dispatch_table.IsTexture(crStateGetTextureHWID(texture));
-    crServerReturnValue( &retval, sizeof(retval) );
-    return retval; /* WILL PROBABLY BE IGNORED */
-}
-
-/*@todo will fail for progs loaded from snapshot */
-GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsProgramARB( GLuint program )
-{
-    GLboolean retval;
-    program = crServerTranslateProgramID(program);
-    retval = cr_server.head_spu->dispatch_table.IsProgramARB( program );
-    crServerReturnValue( &retval, sizeof(retval) );
-    return retval; /* WILL PROBABLY BE IGNORED */
-}
-
-GLboolean SERVER_DISPATCH_APIENTRY
-crServerDispatchAreTexturesResident(GLsizei n, const GLuint *textures,
-                                    GLboolean *residences)
-{
-    GLboolean retval;
-    GLsizei i;
-    GLboolean *res = (GLboolean *) crAlloc(n * sizeof(GLboolean));
-    GLuint *textures2 = (GLuint *) crAlloc(n * sizeof(GLuint));
-
-    (void) residences;
-        
-    for (i = 0; i < n; i++)
-    {
-        textures2[i] = crStateGetTextureHWID(textures[i]);
-    }
-    retval = cr_server.head_spu->dispatch_table.AreTexturesResident(n, textures2, res);
-
-    crFree(textures2);
-
-    crServerReturnValue(res, n * sizeof(GLboolean));
-
-    crFree(res);
-
-    return retval; /* WILL PROBABLY BE IGNORED */
-}
-
-
-GLboolean SERVER_DISPATCH_APIENTRY
-crServerDispatchAreProgramsResidentNV(GLsizei n, const GLuint *programs,
-                                                                            GLboolean *residences)
-{
-    GLboolean retval;
-    GLboolean *res = (GLboolean *) crAlloc(n * sizeof(GLboolean));
-    GLsizei i;
-
-    (void) residences;
-
-    if (!cr_server.sharedTextureObjects) {
-        GLuint *programs2 = (GLuint *) crAlloc(n * sizeof(GLuint));
-        for (i = 0; i < n; i++)
-            programs2[i] = crServerTranslateProgramID(programs[i]);
-        retval = cr_server.head_spu->dispatch_table.AreProgramsResidentNV(n, programs2, res);
-        crFree(programs2);
-    }
-    else {
-        retval = cr_server.head_spu->dispatch_table.AreProgramsResidentNV(n, programs, res);
-    }
-
-    crServerReturnValue(res, n * sizeof(GLboolean));
-    crFree(res);
-
-    return retval; /* WILL PROBABLY BE IGNORED */
-}
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
index a2707fc..f653b18 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
@@ -15,6 +15,11 @@
 #include "cr_vreg.h"
 #include "cr_environment.h"
 #include "cr_pixeldata.h"
+
+#ifdef VBOX_WITH_CR_DISPLAY_LISTS
+# include "cr_dlm.h"
+#endif
+
 #include "server_dispatch.h"
 #include "state/cr_texture.h"
 #include "render/renderspu.h"
@@ -203,9 +208,11 @@ static void crServerTearDown( void )
 
     if (!fContextsDeleted)
     {
+#ifndef VBOX_WITH_CR_DISPLAY_LISTS
         /* sync our state with renderspu,
          * do it before mural & context deletion to avoid deleting currently set murals/contexts*/
         cr_server.head_spu->dispatch_table.MakeCurrent(CR_RENDER_DEFAULT_WINDOW_ID, 0, CR_RENDER_DEFAULT_CONTEXT_ID);
+#endif
     }
 
     /* Deallocate all semaphores */
@@ -745,34 +752,6 @@ static void crVBoxServerInternalClientWriteRead(CRClient *pClient)
     CRVBOXHGSMI_CMDDATA_ASSERT_CLEANED(&pClient->conn->CmdData);
 
     crServerServiceClients();
-
-#if 0
-        if (pClient->currentMural) {
-            crStateViewport( 0, 0, 500, 500 );
-            pClient->currentMural->viewportValidated = GL_FALSE;
-            cr_server.head_spu->dispatch_table.Viewport( 0, 0, 500, 500 );
-            crStateViewport( 0, 0, 600, 600 );
-            pClient->currentMural->viewportValidated = GL_FALSE;
-            cr_server.head_spu->dispatch_table.Viewport( 0, 0, 600, 600 );
-
-            crStateMatrixMode(GL_PROJECTION);
-            cr_server.head_spu->dispatch_table.MatrixMode(GL_PROJECTION);
-            crServerDispatchLoadIdentity();
-            crStateFrustum(-0.6, 0.6, -0.5, 0.5, 1.5, 150.0);
-            cr_server.head_spu->dispatch_table.Frustum(-0.6, 0.6, -0.5, 0.5, 1.5, 150.0);
-            crServerDispatchLoadIdentity();
-            crStateFrustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
-            cr_server.head_spu->dispatch_table.Frustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
-
-            crStateMatrixMode(GL_MODELVIEW);
-            cr_server.head_spu->dispatch_table.MatrixMode(GL_MODELVIEW);
-            crServerDispatchLoadIdentity();
-            crStateFrustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
-            cr_server.head_spu->dispatch_table.Frustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
-            crServerDispatchLoadIdentity();
-        }
-#endif
-
     crStateResetCurrentPointers(&cr_server.current);
 
 #ifndef VBOX_WITH_CRHGSMI
@@ -795,7 +774,6 @@ int32_t crVBoxServerClientWrite(uint32_t u32ClientID, uint8_t *pBuffer, uint32_t
     if (RT_FAILURE(rc))
         return rc;
 
-
     CRASSERT(pBuffer);
 
     /* This should never fire unless we start to multithread */
@@ -1391,11 +1369,6 @@ static int crVBoxServerFBImageDataInitEx(CRFBData *pData, CRContextInfo *pCtxInf
     return VINF_SUCCESS;
 }
 
-static int crVBoxServerFBImageDataInit(CRFBData *pData, CRContextInfo *pCtxInfo, CRMuralInfo *pMural, GLboolean fWrite)
-{
-    return crVBoxServerFBImageDataInitEx(pData, pCtxInfo, pMural, fWrite, SHCROGL_SSM_VERSION, 0, 0);
-}
-
 static int crVBoxServerSaveFBImage(PSSMHANDLE pSSM)
 {
     CRContextInfo *pCtxInfo;
@@ -1415,7 +1388,7 @@ static int crVBoxServerSaveFBImage(PSSMHANDLE pSSM)
     pContext = pCtxInfo->pContext;
     pMural = pCtxInfo->currentMural;
 
-    rc = crVBoxServerFBImageDataInit(&Data.data, pCtxInfo, pMural, GL_FALSE);
+    rc = crVBoxServerFBImageDataInitEx(&Data.data, pCtxInfo, pMural, GL_FALSE, SHCROGL_SSM_VERSION, 0, 0);
     if (!RT_SUCCESS(rc))
     {
         crWarning("crVBoxServerFBImageDataInit failed rc %d", rc);
@@ -1543,125 +1516,6 @@ static void crVBoxServerSaveContextStateCB(unsigned long key, void *data1, void
     pContextInfo->currentMural = pContextCurrentMural;
 }
 
-#if 0
-typedef struct CR_SERVER_CHECK_BUFFERS
-{
-    CRBufferObject *obj;
-    CRContext *ctx;
-}CR_SERVER_CHECK_BUFFERS, *PCR_SERVER_CHECK_BUFFERS;
-
-static void crVBoxServerCheckConsistencyContextBuffersCB(unsigned long key, void *data1, void *data2)
-{
-    CRContextInfo* pContextInfo = (CRContextInfo*)data1;
-    CRContext *ctx = pContextInfo->pContext;
-    PCR_SERVER_CHECK_BUFFERS pBuffers = (PCR_SERVER_CHECK_BUFFERS)data2;
-    CRBufferObject *obj = pBuffers->obj;
-    CRBufferObjectState *b = &(ctx->bufferobject);
-    int j, k;
-
-    if (obj == b->arrayBuffer)
-    {
-        Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
-        pBuffers->ctx = ctx;
-    }
-    if (obj == b->elementsBuffer)
-    {
-        Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
-        pBuffers->ctx = ctx;
-    }
-#ifdef CR_ARB_pixel_buffer_object
-    if (obj == b->packBuffer)
-    {
-        Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
-        pBuffers->ctx = ctx;
-    }
-    if (obj == b->unpackBuffer)
-    {
-        Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
-        pBuffers->ctx = ctx;
-    }
-#endif
-
-#ifdef CR_ARB_vertex_buffer_object
-    for (j=0; j<CRSTATECLIENT_MAX_VERTEXARRAYS; ++j)
-    {
-        CRClientPointer *cp = crStateGetClientPointerByIndex(j, &ctx->client.array);
-        if (obj == cp->buffer)
-        {
-            Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
-            pBuffers->ctx = ctx;
-        }
-    }
-
-    for (k=0; k<ctx->client.vertexArrayStackDepth; ++k)
-    {
-        CRVertexArrays *pArray = &ctx->client.vertexArrayStack[k];
-        for (j=0; j<CRSTATECLIENT_MAX_VERTEXARRAYS; ++j)
-        {
-            CRClientPointer *cp = crStateGetClientPointerByIndex(j, pArray);
-            if (obj == cp->buffer)
-            {
-                Assert(!pBuffers->ctx || pBuffers->ctx == ctx);
-                pBuffers->ctx = ctx;
-            }
-        }
-    }
-#endif
-}
-
-static void crVBoxServerCheckConsistencyBuffersCB(unsigned long key, void *data1, void *data2)
-{
-    CRBufferObject *obj = (CRBufferObject *)data1;
-    CR_SERVER_CHECK_BUFFERS Buffers = {0};
-    Buffers.obj = obj;
-    crHashtableWalk(cr_server.contextTable, crVBoxServerCheckConsistencyContextBuffersCB, (void*)&Buffers);
-}
-
-//static void crVBoxServerCheckConsistency2CB(unsigned long key, void *data1, void *data2)
-//{
-//    CRContextInfo* pContextInfo1 = (CRContextInfo*)data1;
-//    CRContextInfo* pContextInfo2 = (CRContextInfo*)data2;
-//
-//    CRASSERT(pContextInfo1->pContext);
-//    CRASSERT(pContextInfo2->pContext);
-//
-//    if (pContextInfo1 == pContextInfo2)
-//    {
-//        CRASSERT(pContextInfo1->pContext == pContextInfo2->pContext);
-//        return;
-//    }
-//
-//    CRASSERT(pContextInfo1->pContext != pContextInfo2->pContext);
-//    CRASSERT(pContextInfo1->pContext->shared);
-//    CRASSERT(pContextInfo2->pContext->shared);
-//    CRASSERT(pContextInfo1->pContext->shared == pContextInfo2->pContext->shared);
-//    if (pContextInfo1->pContext->shared != pContextInfo2->pContext->shared)
-//        return;
-//
-//    crHashtableWalk(pContextInfo1->pContext->shared->buffersTable, crVBoxServerCheckConsistencyBuffersCB, pContextInfo2);
-//}
-static void crVBoxServerCheckSharedCB(unsigned long key, void *data1, void *data2)
-{
-    CRContextInfo* pContextInfo = (CRContextInfo*)data1;
-    void **ppShared = (void**)data2;
-    if (!*ppShared)
-        *ppShared = pContextInfo->pContext->shared;
-    else
-        Assert(pContextInfo->pContext->shared == *ppShared);
-}
-
-static void crVBoxServerCheckConsistency()
-{
-    CRSharedState *pShared = NULL;
-    crHashtableWalk(cr_server.contextTable, crVBoxServerCheckSharedCB, (void*)&pShared);
-    Assert(pShared);
-    if (pShared)
-    {
-        crHashtableWalk(pShared->buffersTable, crVBoxServerCheckConsistencyBuffersCB, NULL);
-    }
-}
-#endif
-
 static uint32_t g_hackVBoxServerSaveLoadCallsLeft = 0;
 
 static int32_t crVBoxServerSaveStatePerform(PSSMHANDLE pSSM)
@@ -1828,6 +1682,11 @@ static int32_t crVBoxServerSaveStatePerform(PSSMHANDLE pSSM)
         }
     }
 
+#ifdef VBOX_WITH_CR_DISPLAY_LISTS
+    rc = crDLMSaveState();
+    AssertRCReturn(rc, rc);
+#endif
+
     rc = crServerPendSaveState(pSSM);
     AssertRCReturn(rc, rc);
 
@@ -2151,63 +2010,6 @@ static int32_t crVBoxServerLoadMurals(CR_SERVER_LOADSTATE_READER *pReader, uint3
                     }
                 }
 
-#if 0
-                if (muralInfo.pVisibleRects)
-                {
-                    int j;
-                    int cRects = RT_MIN(muralInfo.cVisibleRects, RT_ELEMENTS(LaBuf.aVisRects));
-                    CRASSERT(cRects);
-                    for (j = 0; j < cRects; ++j)
-                    {
-                        PRTRECT pRect = &LaBuf.aVisRects[j];
-                        if (pRect->xLeft >= pRect->xRight)
-                            break;
-                        if (pRect->yTop >= pRect->yBottom)
-                            break;
-                        if (pRect->xLeft < 0 || pRect->xRight < 0
-                                || pRect->yTop < 0 || pRect->yBottom < 0)
-                            break;
-                        if (pRect->xLeft > (GLint)muralInfo.width
-                                || pRect->xRight > (GLint)muralInfo.width)
-                            break;
-                        if (pRect->yTop > (GLint)muralInfo.height
-                                || pRect->yBottom > (GLint)muralInfo.height)
-                            break;
-                    }
-
-                    if (j < cRects)
-                    {
-                        fBuggyMuralData = true;
-                        break;
-                    }
-                }
-
-                if (muralInfo.pVisibleRects)
-                {
-                    /* @todo: do we actually need any further checks here? */
-                    fBuggyMuralData = true;
-                    break;
-                }
-
-                /* no visible regions*/
-
-                if (ui == uiNumElems - 1)
-                {
-                    /* this is the last mural, next it goes idsPool, whose content can not match the above template again */
-                    fBuggyMuralData = true;
-                    break;
-                }
-
-                /* next it goes a next mural info */
-//                if (!fExpectPtr)
-//                {
-//                    CRMuralInfo *pNextSpuWindowInfoMural = (CRMuralInfo*)((void*)&LaBuf);
-//                    if (!pNextSpuWindowInfoMural->spuWindow)
-//                        fBuggyMuralData = true;
-//
-//                    break;
-//                }
-#endif
                 /* fExpectPtr == true, the valid pointer values should not match possible mural width/height/position */
                 fBuggyMuralData = true;
                 break;
@@ -2659,71 +2461,9 @@ static int32_t crVBoxServerLoadStatePerform(PSSMHANDLE pSSM, uint32_t version)
 
             /* Restore client active context and window */
             crServerDispatchMakeCurrent(winID, 0, ctxID);
-
-            if (0)
-            {
-//            CRContext *tmpCtx;
-//            CRCreateInfo_t *createInfo;
-            GLfloat one[4] = { 1, 1, 1, 1 };
-            GLfloat amb[4] = { 0.4f, 0.4f, 0.4f, 1.0f };
-
-            crServerDispatchMakeCurrent(winID, 0, ctxID);
-
-            crHashtableWalk(client.currentCtxInfo->pContext->shared->textureTable, crVBoxServerSyncTextureCB, client.currentCtxInfo->pContext);
-
-            crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.base1D, GL_TRUE);
-            crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.base2D, GL_TRUE);
-            crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.base3D, GL_TRUE);
-#ifdef CR_ARB_texture_cube_map
-            crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.baseCubeMap, GL_TRUE);
-#endif
-#ifdef CR_NV_texture_rectangle
-            //@todo this doesn't work as expected
-            //crStateTextureObjectDiff(client.currentCtxInfo->pContext, NULL, NULL, &client.currentCtxInfo->pContext->texture.baseRect, GL_TRUE);
-#endif
-            /*cr_server.head_spu->dispatch_table.Materialfv(GL_FRONT_AND_BACK, GL_AMBIENT, amb);
-            cr_server.head_spu->dispatch_table.LightModelfv(GL_LIGHT_MODEL_AMBIENT, amb);
-            cr_server.head_spu->dispatch_table.Lightfv(GL_LIGHT1, GL_DIFFUSE, one);
-
-            cr_server.head_spu->dispatch_table.Enable(GL_LIGHTING);
-            cr_server.head_spu->dispatch_table.Enable(GL_LIGHT0);
-            cr_server.head_spu->dispatch_table.Enable(GL_LIGHT1);
-
-            cr_server.head_spu->dispatch_table.Enable(GL_CULL_FACE);
-            cr_server.head_spu->dispatch_table.Enable(GL_TEXTURE_2D);*/
-
-            //crStateViewport( 0, 0, 600, 600 );
-            //pClient->currentMural->viewportValidated = GL_FALSE;
-            //cr_server.head_spu->dispatch_table.Viewport( 0, 0, 600, 600 );
-
-            //crStateMatrixMode(GL_PROJECTION);
-            //cr_server.head_spu->dispatch_table.MatrixMode(GL_PROJECTION);
-
-            //crStateLoadIdentity();
-            //cr_server.head_spu->dispatch_table.LoadIdentity();
-
-            //crStateFrustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
-            //cr_server.head_spu->dispatch_table.Frustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
-
-            //crStateMatrixMode(GL_MODELVIEW);
-            //cr_server.head_spu->dispatch_table.MatrixMode(GL_MODELVIEW);
-            //crServerDispatchLoadIdentity();
-            //crStateFrustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
-            //cr_server.head_spu->dispatch_table.Frustum(-0.5, 0.5, -0.5, 0.5, 1.5, 150.0);
-            //crServerDispatchLoadIdentity();
-
-                /*createInfo = (CRCreateInfo_t *) crHashtableSearch(cr_server.pContextCreateInfoTable, ctxID);
-                CRASSERT(createInfo);
-                tmpCtx = crStateCreateContext(NULL, createInfo->visualBits, NULL);
-                CRASSERT(tmpCtx);
-                crStateDiffContext(tmpCtx, client.currentCtxInfo->pContext);
-                crStateDestroyContext(tmpCtx);*/
-            }
         }
     }
 
-    //crServerDispatchMakeCurrent(-1, 0, -1);
-
     cr_server.curClient = NULL;
 
     rc = crServerPendLoadState(pSSM, version);
@@ -2740,10 +2480,6 @@ static int32_t crVBoxServerLoadStatePerform(PSSMHANDLE pSSM, uint32_t version)
 
     cr_server.bIsInLoadingState = GL_FALSE;
 
-#if 0
-    crVBoxServerCheckConsistency();
-#endif
-
 #ifdef DEBUG_misha
     if (cr_server.head_spu->dispatch_table.StringMarkerGREMEDY)
         cr_server.head_spu->dispatch_table.StringMarkerGREMEDY(sizeof (CR_DBG_STR_STATE_LOAD_STOP), CR_DBG_STR_STATE_LOAD_STOP);
@@ -2774,7 +2510,7 @@ extern DECLEXPORT(void) crServerVBoxSetNotifyEventCB(PFNCRSERVERNOTIFYEVENT pfnC
     cr_server.pfnNotifyEventCB = pfnCb;
 }
 
-void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void*pvData)
+void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void* pvData, uint32_t cbData)
 {
     /* this is something unexpected, but just in case */
     if (idScreen >= cr_server.screenCount)
@@ -2783,7 +2519,7 @@ void crVBoxServerNotifyEvent(int32_t idScreen, uint32_t uEvent, void*pvData)
         return;
     }
 
-    cr_server.pfnNotifyEventCB(idScreen, uEvent, pvData);
+    cr_server.pfnNotifyEventCB(idScreen, uEvent, pvData, cbData);
 }
 
 void crServerWindowReparent(CRMuralInfo *pMural)
@@ -2793,6 +2529,11 @@ void crServerWindowReparent(CRMuralInfo *pMural)
     renderspuReparentWindow(pMural->spuWindow);
 }
 
+DECLEXPORT(void) crServerSetUnscaledHiDPI(bool fEnable)
+{
+    renderspuSetUnscaledHiDPI(fEnable);
+}
+
 static void crVBoxServerReparentMuralCB(unsigned long key, void *data1, void *data2)
 {
     CRMuralInfo *pMI = (CRMuralInfo*) data1;
@@ -2968,11 +2709,6 @@ DECLEXPORT(int32_t) crVBoxServerSetRootVisibleRegion(GLint cRects, const RTRECT
     return VINF_SUCCESS;
 }
 
-DECLEXPORT(void) crVBoxServerSetPresentFBOCB(PFNCRSERVERPRESENTFBO pfnPresentFBO)
-{
-    cr_server.pfnPresentFBO = pfnPresentFBO;
-}
-
 DECLEXPORT(int32_t) crVBoxServerSetOffscreenRendering(GLboolean value)
 {
     return CrPMgrModeVrdp(value);
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
index 0097c1b..de7676d 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
@@ -1971,7 +1971,7 @@ void SERVER_DISPATCH_APIENTRY crServerDispatchBegin(GLenum mode)
         GLint pid=-1;
 
         gl->GetIntegerv(GL_CURRENT_PROGRAM, &pid);
-        crDebug("pid %i, state: id %i, hwid %i", pid, ctx->glsl.activeProgram->id, ctx->glsl.activeProgram->hwid);
+        //crDebug("pid %i, state: id %i, hwid %i", pid, ctx->glsl.activeProgram->id, ctx->glsl.activeProgram->hwid);
         if (pid != ctx->glsl.activeProgram->hwid)
         {
             crWarning("pid(%d) != ctx->glsl.activeProgram->hwid(%d)", pid, ctx->glsl.activeProgram->hwid);
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
deleted file mode 100644
index 680e10a..0000000
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
+++ /dev/null
@@ -1,6435 +0,0 @@
-/* $Id: server_presenter.cpp $ */
-
-/** @file
- * Presenter API
- */
-
-/*
- * Copyright (C) 2012-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-#include "cr_spu.h"
-#include "chromium.h"
-#include "cr_error.h"
-#include "cr_net.h"
-#include "cr_rand.h"
-#include "server_dispatch.h"
-#include "server.h"
-#include "cr_mem.h"
-#include "cr_string.h"
-#include <cr_vreg.h>
-#include <cr_htable.h>
-#include <cr_bmpscale.h>
-
-#include <iprt/cdefs.h>
-#include <iprt/types.h>
-#include <iprt/asm.h>
-#include <iprt/mem.h>
-#include <iprt/list.h>
-
-
-#ifdef DEBUG_misha
-# define VBOXVDBG_MEMCACHE_DISABLE
-#endif
-
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-# include <iprt/memcache.h>
-#endif
-
-#include "render/renderspu.h"
-
-//#define CR_SERVER_WITH_CLIENT_CALLOUTS
-
-class ICrFbDisplay
-{
-public:
-    virtual int UpdateBegin(struct CR_FRAMEBUFFER *pFb) = 0;
-    virtual void UpdateEnd(struct CR_FRAMEBUFFER *pFb) = 0;
-
-    virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
-    virtual int EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
-    virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry) = 0;
-    virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
-    virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
-    virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
-    virtual int EntryPosChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry) = 0;
-
-    virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb) = 0;
-
-    virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb) = 0;
-
-    virtual ~ICrFbDisplay() {}
-};
-
-class CrFbDisplayComposite;
-class CrFbDisplayBase;
-class CrFbDisplayWindow;
-class CrFbDisplayWindowRootVr;
-class CrFbDisplayVrdp;
-class CrFbWindow;
-
-typedef struct CR_FRAMEBUFFER
-{
-    VBOXVR_SCR_COMPOSITOR Compositor;
-    struct VBVAINFOSCREEN ScreenInfo;
-    void *pvVram;
-    ICrFbDisplay *pDisplay;
-    RTLISTNODE EntriesList;
-    uint32_t cEntries; /* <- just for debugging */
-    uint32_t cUpdating;
-    CRHTABLE SlotTable;
-} CR_FRAMEBUFFER;
-
-typedef union CR_FBENTRY_FLAGS
-{
-    struct {
-        uint32_t fCreateNotified : 1;
-        uint32_t fInList         : 1;
-        uint32_t Reserved        : 30;
-    };
-    uint32_t Value;
-} CR_FBENTRY_FLAGS;
-
-typedef struct CR_FRAMEBUFFER_ENTRY
-{
-    VBOXVR_SCR_COMPOSITOR_ENTRY Entry;
-    RTLISTNODE Node;
-    uint32_t cRefs;
-    CR_FBENTRY_FLAGS Flags;
-    CRHTABLE HTable;
-} CR_FRAMEBUFFER_ENTRY;
-
-typedef struct CR_FBTEX
-{
-    CR_TEXDATA Tex;
-    CRTextureObj *pTobj;
-} CR_FBTEX;
-
-#define PCR_FBTEX_FROM_TEX(_pTex) ((CR_FBTEX*)((uint8_t*)(_pTex) - RT_OFFSETOF(CR_FBTEX, Tex)))
-#define PCR_FRAMEBUFFER_FROM_COMPOSITOR(_pCompositor) ((CR_FRAMEBUFFER*)((uint8_t*)(_pCompositor) - RT_OFFSETOF(CR_FRAMEBUFFER, Compositor)))
-#define PCR_FBENTRY_FROM_ENTRY(_pEntry) ((CR_FRAMEBUFFER_ENTRY*)((uint8_t*)(_pEntry) - RT_OFFSETOF(CR_FRAMEBUFFER_ENTRY, Entry)))
-
-typedef struct CR_FB_INFO
-{
-    CrFbDisplayComposite *pDpComposite;
-    uint32_t u32Id;
-    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap);
-} CR_FB_INFO;
-
-typedef struct CR_FBDISPLAY_INFO
-{
-    CrFbDisplayWindow *pDpWin;
-    CrFbDisplayWindowRootVr *pDpWinRootVr;
-    CrFbDisplayVrdp *pDpVrdp;
-    CrFbWindow *pWindow;
-    uint32_t u32DisplayMode;
-    uint32_t u32Id;
-    int32_t iFb;
-} CR_FBDISPLAY_INFO;
-
-typedef struct CR_PRESENTER_GLOBALS
-{
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-    RTMEMCACHE FbEntryLookasideList;
-    RTMEMCACHE FbTexLookasideList;
-    RTMEMCACHE CEntryLookasideList;
-#endif
-    uint32_t u32DisplayMode;
-    uint32_t u32DisabledDisplayMode;
-    bool fEnabled;
-    CRHashTable *pFbTexMap;
-    CR_FBDISPLAY_INFO aDisplayInfos[CR_MAX_GUEST_MONITORS];
-    CR_FBMAP FramebufferInitMap;
-    CR_FRAMEBUFFER aFramebuffers[CR_MAX_GUEST_MONITORS];
-    CR_FB_INFO aFbInfos[CR_MAX_GUEST_MONITORS];
-    bool fWindowsForceHidden;
-    uint32_t cbTmpBuf;
-    void *pvTmpBuf;
-    uint32_t cbTmpBuf2;
-    void *pvTmpBuf2;
-} CR_PRESENTER_GLOBALS;
-
-static int crPMgrFbConnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeAdd);
-
-static CR_PRESENTER_GLOBALS g_CrPresenter;
-
-/* FRAMEBUFFER */
-
-void CrFbInit(CR_FRAMEBUFFER *pFb, uint32_t idFb)
-{
-    RTRECT Rect;
-    Rect.xLeft = 0;
-    Rect.yTop = 0;
-    Rect.xRight = 1;
-    Rect.yBottom = 1;
-    memset(pFb, 0, sizeof (*pFb));
-    pFb->ScreenInfo.u16Flags = VBVA_SCREEN_F_DISABLED;
-    pFb->ScreenInfo.u32ViewIndex = idFb;
-    CrVrScrCompositorInit(&pFb->Compositor, &Rect);
-    RTListInit(&pFb->EntriesList);
-    CrHTableCreate(&pFb->SlotTable, 0);
-}
-
-bool CrFbIsEnabled(CR_FRAMEBUFFER *pFb)
-{
-    return !(pFb->ScreenInfo.u16Flags & VBVA_SCREEN_F_DISABLED);
-}
-
-HCR_FRAMEBUFFER_ENTRY CrFbEntryFromCompositorEntry(const struct VBOXVR_SCR_COMPOSITOR_ENTRY* pCEntry);
-
-const struct VBOXVR_SCR_COMPOSITOR* CrFbGetCompositor(CR_FRAMEBUFFER *pFb)
-{
-    return &pFb->Compositor;
-}
-
-DECLINLINE(CR_FRAMEBUFFER*) CrFbFromCompositor(const struct VBOXVR_SCR_COMPOSITOR* pCompositor)
-{
-    return RT_FROM_MEMBER(pCompositor, CR_FRAMEBUFFER, Compositor);
-}
-
-const struct VBVAINFOSCREEN* CrFbGetScreenInfo(HCR_FRAMEBUFFER hFb)
-{
-    return &hFb->ScreenInfo;
-}
-
-void* CrFbGetVRAM(HCR_FRAMEBUFFER hFb)
-{
-    return hFb->pvVram;
-}
-
-int CrFbUpdateBegin(CR_FRAMEBUFFER *pFb)
-{
-    ++pFb->cUpdating;
-
-    if (pFb->cUpdating == 1)
-    {
-        if (pFb->pDisplay)
-            pFb->pDisplay->UpdateBegin(pFb);
-    }
-
-    return VINF_SUCCESS;
-}
-
-void CrFbUpdateEnd(CR_FRAMEBUFFER *pFb)
-{
-    if (!pFb->cUpdating)
-    {
-        WARN(("invalid UpdateEnd call!"));
-        return;
-    }
-
-    --pFb->cUpdating;
-
-    if (!pFb->cUpdating)
-    {
-        if (pFb->pDisplay)
-            pFb->pDisplay->UpdateEnd(pFb);
-    }
-}
-
-bool CrFbIsUpdating(const CR_FRAMEBUFFER *pFb)
-{
-    return !!pFb->cUpdating;
-}
-
-bool CrFbHas3DData(HCR_FRAMEBUFFER hFb)
-{
-    return !CrVrScrCompositorIsEmpty(&hFb->Compositor);
-}
-
-static void crFbImgFromScreenVram(const VBVAINFOSCREEN *pScreen, void *pvVram, CR_BLITTER_IMG *pImg)
-{
-    pImg->pvData = pvVram;
-    pImg->cbData = pScreen->u32LineSize * pScreen->u32Height;
-    pImg->enmFormat = GL_BGRA;
-    pImg->width = pScreen->u32Width;
-    pImg->height = pScreen->u32Height;
-    pImg->bpp = pScreen->u16BitsPerPixel;
-    pImg->pitch = pScreen->u32LineSize;
-}
-
-static void crFbImgFromDimPtrBGRA(void *pvVram, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg)
-{
-    pImg->pvData = pvVram;
-    pImg->cbData = width * height * 4;
-    pImg->enmFormat = GL_BGRA;
-    pImg->width = width;
-    pImg->height = height;
-    pImg->bpp = 32;
-    pImg->pitch = width * 4;
-}
-
-static int8_t crFbImgFromDimOffVramBGRA(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, CR_BLITTER_IMG *pImg)
-{
-    uint32_t cbBuff = width * height * 4;
-    if (offVRAM >= g_cbVRam
-            || offVRAM + cbBuff >= g_cbVRam)
-    {
-        WARN(("invalid param"));
-        return -1;
-    }
-
-    uint8_t *pu8Buf = g_pvVRamBase + offVRAM;
-    crFbImgFromDimPtrBGRA(pu8Buf, width, height, pImg);
-
-    return 0;
-}
-
-static int8_t crFbImgFromDescBGRA(const VBOXCMDVBVA_ALLOCDESC *pDesc, CR_BLITTER_IMG *pImg)
-{
-    return crFbImgFromDimOffVramBGRA(pDesc->Info.u.offVRAM, pDesc->u16Width, pDesc->u16Height, pImg);
-}
-
-static void crFbImgFromFb(HCR_FRAMEBUFFER hFb, CR_BLITTER_IMG *pImg)
-{
-    const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
-    void *pvVram = CrFbGetVRAM(hFb);
-    crFbImgFromScreenVram(pScreen, pvVram, pImg);
-}
-
-static int crFbTexDataGetContents(CR_TEXDATA *pTex, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
-{
-    const CR_BLITTER_IMG *pSrcImg;
-    int rc = CrTdBltDataAcquire(pTex, GL_BGRA, false, &pSrcImg);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrTdBltDataAcquire failed rc %d", rc));
-        return rc;
-    }
-
-    CrMBltImg(pSrcImg, pPos, cRects, pRects, pDst);
-
-    CrTdBltDataRelease(pTex);
-
-    return VINF_SUCCESS;
-}
-
-static int crFbBltGetContentsScaledDirect(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
-{
-    VBOXVR_LIST List;
-    uint32_t c2DRects = 0;
-    CR_TEXDATA *pEnteredTex = NULL;
-    PCR_BLITTER pEnteredBlitter = NULL;
-    uint32_t width = 0, height = 0;
-    RTPOINT ScaledEntryPoint = {0};
-    RTRECT ScaledSrcRect = {0};
-
-    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
-    int32_t srcWidth = pSrcRectSize->cx;
-    int32_t srcHeight = pSrcRectSize->cy;
-    int32_t dstWidth = pDstRect->xRight - pDstRect->xLeft;
-    int32_t dstHeight = pDstRect->yBottom - pDstRect->yTop;
-
-    RTPOINT DstPoint = {pDstRect->xLeft, pDstRect->yTop};
-    float strX = ((float)dstWidth) / srcWidth;
-    float strY = ((float)dstHeight) / srcHeight;
-    bool fScale = (dstWidth != srcWidth || dstHeight != srcHeight);
-    Assert(fScale);
-
-    VBoxVrListInit(&List);
-    int rc = VBoxVrListRectsAdd(&List, 1, CrVrScrCompositorRectGet(&hFb->Compositor), NULL);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("VBoxVrListRectsAdd failed rc %d", rc));
-        goto end;
-    }
-
-    CrVrScrCompositorConstIterInit(&hFb->Compositor, &Iter);
-
-    for(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry = CrVrScrCompositorConstIterNext(&Iter);
-            pEntry;
-            pEntry = CrVrScrCompositorConstIterNext(&Iter))
-    {
-        uint32_t cRegions;
-        const RTRECT *pRegions;
-        rc = CrVrScrCompositorEntryRegionsGet(&hFb->Compositor, pEntry, &cRegions, NULL, NULL, &pRegions);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("CrVrScrCompositorEntryRegionsGet failed rc %d", rc));
-            goto end;
-        }
-
-        rc = VBoxVrListRectsSubst(&List, cRegions, pRegions, NULL);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("VBoxVrListRectsSubst failed rc %d", rc));
-            goto end;
-        }
-
-        for (uint32_t j = 0; j < cRegions; ++j)
-        {
-            /* rects are in dst coordinates,
-             * while the pReg is in source coords
-             * convert */
-            const RTRECT * pReg = &pRegions[j];
-            RTRECT ScaledReg;
-            /* scale */
-            VBoxRectScaled(pReg, strX, strY, &ScaledReg);
-            /* translate */
-            VBoxRectTranslate(&ScaledReg, pDstRect->xLeft, pDstRect->yTop);
-
-            for (uint32_t i = 0; i < cRects; ++i)
-            {
-                const RTRECT * pRect = &pRects[i];
-
-                RTRECT Intersection;
-                VBoxRectIntersected(pRect, &ScaledReg, &Intersection);
-                if (VBoxRectIsZero(&Intersection))
-                    continue;
-
-                CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
-                const CR_BLITTER_IMG *pSrcImg;
-
-                if (pEnteredTex != pTex)
-                {
-                    if (!pEnteredBlitter)
-                    {
-                        pEnteredBlitter = CrTdBlitterGet(pTex);
-                        rc = CrBltEnter(pEnteredBlitter);
-                        if (!RT_SUCCESS(rc))
-                        {
-                            WARN(("CrBltEnter failed %d", rc));
-                            pEnteredBlitter = NULL;
-                            goto end;
-                        }
-                    }
-
-                    if (pEnteredTex)
-                    {
-                        CrTdBltLeave(pEnteredTex);
-
-                        pEnteredTex = NULL;
-
-                        if (pEnteredBlitter != CrTdBlitterGet(pTex))
-                        {
-                            WARN(("blitters not equal!"));
-                            CrBltLeave(pEnteredBlitter);
-
-                            pEnteredBlitter = CrTdBlitterGet(pTex);
-                            rc = CrBltEnter(pEnteredBlitter);
-                             if (!RT_SUCCESS(rc))
-                             {
-                                 WARN(("CrBltEnter failed %d", rc));
-                                 pEnteredBlitter = NULL;
-                                 goto end;
-                             }
-                        }
-                    }
-
-                    rc = CrTdBltEnter(pTex);
-                    if (!RT_SUCCESS(rc))
-                    {
-                        WARN(("CrTdBltEnter failed %d", rc));
-                        goto end;
-                    }
-
-                    pEnteredTex = pTex;
-
-                    const VBOXVR_TEXTURE *pVrTex = CrTdTexGet(pTex);
-
-                    width = CR_FLOAT_RCAST(uint32_t, strX * pVrTex->width);
-                    height = CR_FLOAT_RCAST(uint32_t, strY * pVrTex->height);
-                    ScaledEntryPoint.x = CR_FLOAT_RCAST(int32_t, strX * CrVrScrCompositorEntryRectGet(pEntry)->xLeft) + pDstRect->xLeft;
-                    ScaledEntryPoint.y = CR_FLOAT_RCAST(int32_t, strY * CrVrScrCompositorEntryRectGet(pEntry)->yTop) + pDstRect->yTop;
-                    ScaledSrcRect.xLeft = ScaledEntryPoint.x;
-                    ScaledSrcRect.yTop = ScaledEntryPoint.y;
-                    ScaledSrcRect.xRight = width + ScaledEntryPoint.x;
-                    ScaledSrcRect.yBottom = height + ScaledEntryPoint.y;
-                }
-
-                VBoxRectIntersect(&Intersection, &ScaledSrcRect);
-                if (VBoxRectIsZero(&Intersection))
-                    continue;
-
-                rc = CrTdBltDataAcquireScaled(pTex, GL_BGRA, false, width, height, &pSrcImg);
-                if (!RT_SUCCESS(rc))
-                {
-                    WARN(("CrTdBltDataAcquire failed rc %d", rc));
-                    goto end;
-                }
-
-                bool fInvert = !(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS);
-
-                CrMBltImgRect(pSrcImg, &ScaledEntryPoint, fInvert, &Intersection, pDst);
-
-                CrTdBltDataReleaseScaled(pTex, pSrcImg);
-            }
-        }
-    }
-
-    c2DRects = VBoxVrListRectsCount(&List);
-    if (c2DRects)
-    {
-        if (g_CrPresenter.cbTmpBuf2 < c2DRects * sizeof (RTRECT))
-        {
-            if (g_CrPresenter.pvTmpBuf2)
-                RTMemFree(g_CrPresenter.pvTmpBuf2);
-
-            g_CrPresenter.cbTmpBuf2 = (c2DRects + 10) * sizeof (RTRECT);
-            g_CrPresenter.pvTmpBuf2 = RTMemAlloc(g_CrPresenter.cbTmpBuf2);
-            if (!g_CrPresenter.pvTmpBuf2)
-            {
-                WARN(("RTMemAlloc failed!"));
-                g_CrPresenter.cbTmpBuf2 = 0;
-                rc = VERR_NO_MEMORY;
-                goto end;
-            }
-        }
-
-        RTRECT *p2DRects  = (RTRECT *)g_CrPresenter.pvTmpBuf2;
-
-        rc = VBoxVrListRectsGet(&List, c2DRects, p2DRects);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("VBoxVrListRectsGet failed, rc %d", rc));
-            goto end;
-        }
-
-        const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor);
-
-        CR_BLITTER_IMG FbImg;
-
-        crFbImgFromFb(hFb, &FbImg);
-
-        for (uint32_t i = 0; i < c2DRects; ++i)
-        {
-            VBoxRectScale(&p2DRects[i], strX, strY);
-        }
-
-        CrMBltImgScaled(&FbImg, pSrcRectSize, pDstRect, c2DRects, p2DRects, pDst);
-    }
-
-end:
-
-    if (pEnteredTex)
-        CrTdBltLeave(pEnteredTex);
-
-    if (pEnteredBlitter)
-        CrBltLeave(pEnteredBlitter);
-
-    VBoxVrListClear(&List);
-
-    return rc;
-}
-
-static int crFbBltGetContentsScaledCPU(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
-{
-    WARN(("not implemented!"));
-    return VERR_NOT_IMPLEMENTED;
-#if 0
-    int32_t srcWidth = pSrcRectSize->cx;
-    int32_t srcHeight = pSrcRectSize->cy;
-    int32_t dstWidth = pDstRect->xRight - pDstRect->xLeft;
-    int32_t dstHeight = pDstRect->yBottom - pDstRect->yTop;
-
-    RTPOINT DstPoint = {pDstRect->xLeft, pDstRect->yTop};
-    float strX = ((float)dstWidth) / srcWidth;
-    float strY = ((float)dstHeight) / srcHeight;
-
-    RTPOINT UnscaledPos;
-    UnscaledPos.x = CR_FLOAT_RCAST(int32_t, pDstRect->xLeft / strX);
-    UnscaledPos.y = CR_FLOAT_RCAST(int32_t, pDstRect->yTop / strY);
-
-    /* destination is bigger than the source, do 3D data stretching with CPU */
-    CR_BLITTER_IMG Img;
-    Img.cbData = srcWidth * srcHeight * 4;
-    Img.pvData = RTMemAlloc(Img.cbData);
-    if (!Img.pvData)
-    {
-        WARN(("RTMemAlloc Failed"));
-        return VERR_NO_MEMORY;
-    }
-    Img.enmFormat = pImg->enmFormat;
-    Img.width = srcWidth;
-    Img.height = srcHeight;
-    Img.bpp = pImg->bpp;
-    Img.pitch = Img.width * 4;
-
-    int rc = CrFbBltGetContents(hFb, &UnscaledPos, cRects, pRects, &Img);
-    if (RT_SUCCESS(rc))
-    {
-        CrBmpScale32((uint8_t *)pImg->pvData,
-                            pImg->pitch,
-                            pImg->width, pImg->height,
-                            (const uint8_t *)Img.pvData,
-                            Img.pitch,
-                            Img.width, Img.height);
-    }
-    else
-        WARN(("CrFbBltGetContents failed %d", rc));
-
-    RTMemFree(Img.pvData);
-
-    return rc;
-#endif
-}
-
-int CrFbBltGetContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pDst)
-{
-    VBOXVR_LIST List;
-    uint32_t c2DRects = 0;
-    CR_TEXDATA *pEnteredTex = NULL;
-    PCR_BLITTER pEnteredBlitter = NULL;
-
-    VBoxVrListInit(&List);
-    int rc = VBoxVrListRectsAdd(&List, 1, CrVrScrCompositorRectGet(&hFb->Compositor), NULL);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("VBoxVrListRectsAdd failed rc %d", rc));
-        goto end;
-    }
-
-    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
-    CrVrScrCompositorConstIterInit(&hFb->Compositor, &Iter);
-
-    for(const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry = CrVrScrCompositorConstIterNext(&Iter);
-            pEntry;
-            pEntry = CrVrScrCompositorConstIterNext(&Iter))
-    {
-        RTPOINT EntryPoint;
-        EntryPoint.x = CrVrScrCompositorEntryRectGet(pEntry)->xLeft + pPos->x;
-        EntryPoint.y = CrVrScrCompositorEntryRectGet(pEntry)->yTop + pPos->y;
-
-        uint32_t cRegions;
-        const RTRECT *pRegions;
-        rc = CrVrScrCompositorEntryRegionsGet(&hFb->Compositor, pEntry, &cRegions, NULL, NULL, &pRegions);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("CrVrScrCompositorEntryRegionsGet failed rc %d", rc));
-            goto end;
-        }
-
-        rc = VBoxVrListRectsSubst(&List, cRegions, pRegions, NULL);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("VBoxVrListRectsSubst failed rc %d", rc));
-            goto end;
-        }
-
-        for (uint32_t j = 0; j < cRegions; ++j)
-        {
-            /* rects are in dst coordinates,
-             * while the pReg is in source coords
-             * convert */
-            const RTRECT * pReg = &pRegions[j];
-            RTRECT SrcReg;
-            /* translate */
-            VBoxRectTranslated(pReg, pPos->x, pPos->y, &SrcReg);
-
-            for (uint32_t i = 0; i < cRects; ++i)
-            {
-                const RTRECT * pRect = &pRects[i];
-
-                RTRECT Intersection;
-                VBoxRectIntersected(pRect, &SrcReg, &Intersection);
-                if (VBoxRectIsZero(&Intersection))
-                    continue;
-
-                CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
-                const CR_BLITTER_IMG *pSrcImg;
-
-                if (pEnteredTex != pTex)
-                {
-                    if (!pEnteredBlitter)
-                    {
-                        pEnteredBlitter = CrTdBlitterGet(pTex);
-                        rc = CrBltEnter(pEnteredBlitter);
-                        if (!RT_SUCCESS(rc))
-                        {
-                            WARN(("CrBltEnter failed %d", rc));
-                            pEnteredBlitter = NULL;
-                            goto end;
-                        }
-                    }
-
-                    if (pEnteredTex)
-                    {
-                        CrTdBltLeave(pEnteredTex);
-
-                        pEnteredTex = NULL;
-
-                        if (pEnteredBlitter != CrTdBlitterGet(pTex))
-                        {
-                            WARN(("blitters not equal!"));
-                            CrBltLeave(pEnteredBlitter);
-
-                            pEnteredBlitter = CrTdBlitterGet(pTex);
-                            rc = CrBltEnter(pEnteredBlitter);
-                             if (!RT_SUCCESS(rc))
-                             {
-                                 WARN(("CrBltEnter failed %d", rc));
-                                 pEnteredBlitter = NULL;
-                                 goto end;
-                             }
-                        }
-                    }
-
-                    rc = CrTdBltEnter(pTex);
-                    if (!RT_SUCCESS(rc))
-                    {
-                        WARN(("CrTdBltEnter failed %d", rc));
-                        goto end;
-                    }
-
-                    pEnteredTex = pTex;
-                }
-
-                rc = CrTdBltDataAcquire(pTex, GL_BGRA, false, &pSrcImg);
-                if (!RT_SUCCESS(rc))
-                {
-                    WARN(("CrTdBltDataAcquire failed rc %d", rc));
-                    goto end;
-                }
-
-                bool fInvert = !(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS);
-
-                CrMBltImgRect(pSrcImg, &EntryPoint, fInvert, &Intersection, pDst);
-
-                CrTdBltDataRelease(pTex);
-            }
-        }
-    }
-
-    c2DRects = VBoxVrListRectsCount(&List);
-    if (c2DRects)
-    {
-        if (g_CrPresenter.cbTmpBuf2 < c2DRects * sizeof (RTRECT))
-        {
-            if (g_CrPresenter.pvTmpBuf2)
-                RTMemFree(g_CrPresenter.pvTmpBuf2);
-
-            g_CrPresenter.cbTmpBuf2 = (c2DRects + 10) * sizeof (RTRECT);
-            g_CrPresenter.pvTmpBuf2 = RTMemAlloc(g_CrPresenter.cbTmpBuf2);
-            if (!g_CrPresenter.pvTmpBuf2)
-            {
-                WARN(("RTMemAlloc failed!"));
-                g_CrPresenter.cbTmpBuf2 = 0;
-                rc = VERR_NO_MEMORY;
-                goto end;
-            }
-        }
-
-        RTRECT *p2DRects  = (RTRECT *)g_CrPresenter.pvTmpBuf2;
-
-        rc = VBoxVrListRectsGet(&List, c2DRects, p2DRects);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("VBoxVrListRectsGet failed, rc %d", rc));
-            goto end;
-        }
-
-        const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor);
-
-        CR_BLITTER_IMG FbImg;
-
-        crFbImgFromFb(hFb, &FbImg);
-
-        CrMBltImg(&FbImg, pPos, c2DRects, p2DRects, pDst);
-    }
-
-end:
-
-    if (pEnteredTex)
-        CrTdBltLeave(pEnteredTex);
-
-    if (pEnteredBlitter)
-        CrBltLeave(pEnteredBlitter);
-
-    VBoxVrListClear(&List);
-
-    return rc;
-}
-
-int CrFbBltGetContentsEx(HCR_FRAMEBUFFER hFb, const RTRECTSIZE *pSrcRectSize, const RTRECT *pDstRect, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
-{
-    uint32_t srcWidth = pSrcRectSize->cx;
-    uint32_t srcHeight = pSrcRectSize->cy;
-    uint32_t dstWidth = pDstRect->xRight - pDstRect->xLeft;
-    uint32_t dstHeight = pDstRect->yBottom - pDstRect->yTop;
-    if (srcWidth == dstWidth
-            && srcHeight == dstHeight)
-    {
-        RTPOINT Pos = {pDstRect->xLeft, pDstRect->yTop};
-        return CrFbBltGetContents(hFb, &Pos, cRects, pRects, pImg);
-    }
-    if (!CrFbHas3DData(hFb)
-            || (srcWidth * srcHeight > dstWidth * dstHeight))
-        return crFbBltGetContentsScaledDirect(hFb, pSrcRectSize, pDstRect, cRects, pRects, pImg);
-
-    return crFbBltGetContentsScaledCPU(hFb, pSrcRectSize, pDstRect, cRects, pRects, pImg);
-}
-
-static void crFbBltPutContentsFbVram(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pSrc)
-{
-    const RTRECT *pCompRect = CrVrScrCompositorRectGet(&hFb->Compositor);
-
-    CR_BLITTER_IMG FbImg;
-
-    crFbImgFromFb(hFb, &FbImg);
-
-    CrMBltImg(pSrc, pPos, cRects, pRects, &FbImg);
-}
-
-static void crFbClrFillFbVram(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color)
-{
-    CR_BLITTER_IMG FbImg;
-
-    crFbImgFromFb(hFb, &FbImg);
-
-    CrMClrFillImg(&FbImg, cRects, pRects, u32Color);
-}
-
-int CrFbClrFill(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color)
-{
-    if (!hFb->cUpdating)
-    {
-        WARN(("framebuffer not updating"));
-        return VERR_INVALID_STATE;
-    }
-
-    crFbClrFillFbVram(hFb, cRects, pRects, u32Color);
-
-    RTPOINT DstPoint = {0, 0};
-
-    int rc = CrFbEntryRegionsAdd(hFb, NULL, &DstPoint, cRects, pRects, false);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrFbEntryRegionsAdd failed %d", rc));
-        return rc;
-    }
-
-    return VINF_SUCCESS;
-}
-
-static int crFbBltPutContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
-{
-    crFbBltPutContentsFbVram(hFb, pPos, cRects, pRects, pImg);
-
-    int rc = CrFbEntryRegionsAdd(hFb, NULL, pPos, cRects, pRects, false);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrFbEntryRegionsAdd failed %d", rc));
-        return rc;
-    }
-
-    return VINF_SUCCESS;
-}
-
-int CrFbBltPutContents(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
-{
-    if (!hFb->cUpdating)
-    {
-        WARN(("framebuffer not updating"));
-        return VERR_INVALID_STATE;
-    }
-
-    return crFbBltPutContents(hFb, pPos, cRects, pRects, pImg);
-}
-
-static int crFbRegionsIsIntersectRects(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, bool *pfRegChanged)
-{
-    uint32_t cCompRects;
-    const RTRECT *pCompRects;
-    int rc = CrVrScrCompositorRegionsGet(&hFb->Compositor, &cCompRects, NULL, NULL, &pCompRects);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrVrScrCompositorRegionsGet failed rc %d", rc));
-        return rc;
-    }
-
-    bool fRegChanged = false;
-    for (uint32_t i = 0; i < cCompRects; ++i)
-    {
-        const RTRECT *pCompRect = &pCompRects[i];
-        for (uint32_t j = 0; j < cRects; ++j)
-        {
-            const RTRECT *pRect = &pRects[j];
-            if (VBoxRectIsIntersect(pCompRect, pRect))
-            {
-                *pfRegChanged = true;
-                return VINF_SUCCESS;
-            }
-        }
-    }
-
-    *pfRegChanged = false;
-    return VINF_SUCCESS;
-}
-
-int CrFbBltPutContentsNe(HCR_FRAMEBUFFER hFb, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, CR_BLITTER_IMG *pImg)
-{
-    bool fRegChanged = false;
-    int rc = crFbRegionsIsIntersectRects(hFb, cRects, pRects, &fRegChanged);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("crFbRegionsIsIntersectRects failed rc %d", rc));
-        return rc;
-    }
-
-    if (fRegChanged)
-    {
-        rc = CrFbUpdateBegin(hFb);
-        if (RT_SUCCESS(rc))
-        {
-            rc = CrFbBltPutContents(hFb, pPos, cRects, pRects, pImg);
-            if (!RT_SUCCESS(rc))
-                WARN(("CrFbBltPutContents failed rc %d", rc));
-            CrFbUpdateEnd(hFb);
-        }
-        else
-            WARN(("CrFbUpdateBegin failed rc %d", rc));
-
-        return rc;
-    }
-
-    crFbBltPutContentsFbVram(hFb, pPos, cRects, pRects, pImg);
-    return VINF_SUCCESS;
-}
-
-int CrFbClrFillNe(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects, uint32_t u32Color)
-{
-    bool fRegChanged = false;
-    int rc = crFbRegionsIsIntersectRects(hFb, cRects, pRects, &fRegChanged);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("crFbRegionsIsIntersectRects failed rc %d", rc));
-        return rc;
-    }
-
-    if (fRegChanged)
-    {
-        rc = CrFbUpdateBegin(hFb);
-        if (RT_SUCCESS(rc))
-        {
-            rc = CrFbClrFill(hFb, cRects, pRects, u32Color);
-            if (!RT_SUCCESS(rc))
-                WARN(("CrFbClrFill failed rc %d", rc));
-            CrFbUpdateEnd(hFb);
-        }
-        else
-            WARN(("CrFbUpdateBegin failed rc %d", rc));
-
-        return rc;
-    }
-
-    crFbClrFillFbVram(hFb, cRects, pRects, u32Color);
-    return VINF_SUCCESS;
-}
-
-int CrFbResize(CR_FRAMEBUFFER *pFb, const struct VBVAINFOSCREEN * pScreen, void *pvVRAM)
-{
-    if (!pFb->cUpdating)
-    {
-        WARN(("no update in progress"));
-        return VERR_INVALID_STATE;
-    }
-
-    int rc = VINF_SUCCESS;
-    if (CrFbIsEnabled(pFb))
-    {
-        rc = CrFbRegionsClear(pFb);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("CrFbRegionsClear failed %d", rc));
-            return rc;
-        }
-    }
-
-    RTRECT Rect;
-    Rect.xLeft = 0;
-    Rect.yTop = 0;
-    Rect.xRight = pScreen->u32Width;
-    Rect.yBottom = pScreen->u32Height;
-    rc = CrVrScrCompositorRectSet(&pFb->Compositor, &Rect, NULL);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrVrScrCompositorRectSet failed rc %d", rc));
-        return rc;
-    }
-
-    pFb->ScreenInfo = *pScreen;
-    pFb->pvVram = pvVRAM ? pvVRAM : g_pvVRamBase + pScreen->u32StartOffset;
-
-    if (pFb->pDisplay)
-        pFb->pDisplay->FramebufferChanged(pFb);
-
-    return VINF_SUCCESS;
-}
-
-void CrFbTerm(CR_FRAMEBUFFER *pFb)
-{
-    if (pFb->cUpdating)
-    {
-        WARN(("update in progress"));
-        return;
-    }
-    uint32_t idFb = pFb->ScreenInfo.u32ViewIndex;
-
-    CrVrScrCompositorClear(&pFb->Compositor);
-    CrHTableDestroy(&pFb->SlotTable);
-
-    Assert(RTListIsEmpty(&pFb->EntriesList));
-    Assert(!pFb->cEntries);
-
-    memset(pFb, 0, sizeof (*pFb));
-
-    pFb->ScreenInfo.u16Flags = VBVA_SCREEN_F_DISABLED;
-    pFb->ScreenInfo.u32ViewIndex = idFb;
-}
-
-ICrFbDisplay* CrFbDisplayGet(CR_FRAMEBUFFER *pFb)
-{
-    return pFb->pDisplay;
-}
-
-int CrFbDisplaySet(CR_FRAMEBUFFER *pFb, ICrFbDisplay *pDisplay)
-{
-    if (pFb->cUpdating)
-    {
-        WARN(("update in progress"));
-        return VERR_INVALID_STATE;
-    }
-
-    if (pFb->pDisplay == pDisplay)
-        return VINF_SUCCESS;
-
-    pFb->pDisplay = pDisplay;
-
-    return VINF_SUCCESS;
-}
-
-#define CR_PMGR_MODE_WINDOW 0x1
-/* mutually exclusive with CR_PMGR_MODE_WINDOW */
-#define CR_PMGR_MODE_ROOTVR 0x2
-#define CR_PMGR_MODE_VRDP   0x4
-#define CR_PMGR_MODE_ALL    0x7
-
-static int crPMgrModeModifyGlobal(uint32_t u32ModeAdd, uint32_t u32ModeRemove);
-static void crPMgrCleanUnusedDisplays();
-
-static CR_FBTEX* crFbTexAlloc()
-{
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-    return (CR_FBTEX*)RTMemCacheAlloc(g_CrPresenter.FbTexLookasideList);
-#else
-    return (CR_FBTEX*)RTMemAlloc(sizeof (CR_FBTEX));
-#endif
-}
-
-static void crFbTexFree(CR_FBTEX *pTex)
-{
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-    RTMemCacheFree(g_CrPresenter.FbTexLookasideList, pTex);
-#else
-    RTMemFree(pTex);
-#endif
-}
-
-static CR_FRAMEBUFFER_ENTRY* crFbEntryAlloc()
-{
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-    return (CR_FRAMEBUFFER_ENTRY*)RTMemCacheAlloc(g_CrPresenter.FbEntryLookasideList);
-#else
-    return (CR_FRAMEBUFFER_ENTRY*)RTMemAlloc(sizeof (CR_FRAMEBUFFER_ENTRY));
-#endif
-}
-
-static void crFbEntryFree(CR_FRAMEBUFFER_ENTRY *pEntry)
-{
-    Assert(!CrVrScrCompositorEntryIsUsed(&pEntry->Entry));
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-    RTMemCacheFree(g_CrPresenter.FbEntryLookasideList, pEntry);
-#else
-    RTMemFree(pEntry);
-#endif
-}
-
-DECLCALLBACK(void) crFbTexRelease(CR_TEXDATA *pTex)
-{
-    CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTex);
-    CRTextureObj *pTobj = pFbTex->pTobj;
-
-    CrTdBltDataCleanupNe(pTex);
-
-    if (pTobj)
-    {
-        crHashtableDelete(g_CrPresenter.pFbTexMap, pTobj->id, NULL);
-
-        crStateReleaseTexture(cr_server.MainContextInfo.pContext, pTobj);
-
-
-        crStateGlobalSharedRelease();
-    }
-
-    crFbTexFree(pFbTex);
-}
-
-void CrFbTexDataInit(CR_TEXDATA* pFbTex, const VBOXVR_TEXTURE *pTex, PFNCRTEXDATA_RELEASED pfnTextureReleased)
-{
-    PCR_BLITTER pBlitter = crServerVBoxBlitterGet();
-
-    CrTdInit(pFbTex, pTex, pBlitter, pfnTextureReleased);
-}
-
-static CR_FBTEX* crFbTexCreate(const VBOXVR_TEXTURE *pTex)
-{
-    CR_FBTEX *pFbTex = crFbTexAlloc();
-    if (!pFbTex)
-    {
-        WARN(("crFbTexAlloc failed!"));
-        return NULL;
-    }
-
-    CrFbTexDataInit(&pFbTex->Tex, pTex, crFbTexRelease);
-    pFbTex->pTobj = NULL;
-
-    return pFbTex;
-}
-
-CR_TEXDATA* CrFbTexDataCreate(const VBOXVR_TEXTURE *pTex)
-{
-    CR_FBTEX *pFbTex = crFbTexCreate(pTex);
-    if (!pFbTex)
-    {
-        WARN(("crFbTexCreate failed!"));
-        return NULL;
-    }
-
-    return &pFbTex->Tex;
-}
-
-static CR_FBTEX* crFbTexAcquire(GLuint idTexture)
-{
-    CR_FBTEX *pFbTex = (CR_FBTEX *)crHashtableSearch(g_CrPresenter.pFbTexMap, idTexture);
-    if (pFbTex)
-    {
-        CrTdAddRef(&pFbTex->Tex);
-        return pFbTex;
-    }
-
-    CRSharedState *pShared = crStateGlobalSharedAcquire();
-    if (!pShared)
-    {
-        WARN(("pShared is null!"));
-        return NULL;
-    }
-
-    CRTextureObj *pTobj = (CRTextureObj*)crHashtableSearch(pShared->textureTable, idTexture);
-    if (!pTobj)
-    {
-        LOG(("pTobj is null!"));
-        crStateGlobalSharedRelease();
-        return NULL;
-    }
-
-    Assert(pTobj->id == idTexture);
-
-    GLuint hwid = crStateGetTextureObjHWID(pTobj);
-    if (!hwid)
-    {
-        WARN(("hwId is null!"));
-        crStateGlobalSharedRelease();
-        return NULL;
-    }
-
-    VBOXVR_TEXTURE Tex;
-    Tex.width = pTobj->level[0]->width;
-    Tex.height = pTobj->level[0]->height;
-    Tex.hwid = hwid;
-    Tex.target = pTobj->target;
-
-    pFbTex = crFbTexCreate(&Tex);
-    if (!pFbTex)
-    {
-        WARN(("crFbTexCreate failed!"));
-        crStateGlobalSharedRelease();
-        return NULL;
-    }
-
-    CR_STATE_SHAREDOBJ_USAGE_SET(pTobj, cr_server.MainContextInfo.pContext);
-
-    pFbTex->pTobj = pTobj;
-
-    crHashtableAdd(g_CrPresenter.pFbTexMap, idTexture, pFbTex);
-
-    return pFbTex;
-}
-
-static CR_TEXDATA* CrFbTexDataAcquire(GLuint idTexture)
-{
-    CR_FBTEX* pTex = crFbTexAcquire(idTexture);
-    if (!pTex)
-    {
-        WARN(("crFbTexAcquire failed for %d", idTexture));
-        return NULL;
-    }
-
-    return &pTex->Tex;
-}
-
-static void crFbEntryMarkDestroyed(CR_FRAMEBUFFER *pFb, CR_FRAMEBUFFER_ENTRY* pEntry)
-{
-    if (pEntry->Flags.fCreateNotified)
-    {
-        pEntry->Flags.fCreateNotified = 0;
-        if (pFb->pDisplay)
-            pFb->pDisplay->EntryDestroyed(pFb, pEntry);
-
-        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&pEntry->Entry);
-        if (pTex)
-            CrTdBltDataInvalidateNe(pTex);
-    }
-}
-
-static void crFbEntryDestroy(CR_FRAMEBUFFER *pFb, CR_FRAMEBUFFER_ENTRY* pEntry)
-{
-    crFbEntryMarkDestroyed(pFb, pEntry);
-    CrVrScrCompositorEntryCleanup(&pEntry->Entry);
-    CrHTableDestroy(&pEntry->HTable);
-    Assert(pFb->cEntries);
-    RTListNodeRemove(&pEntry->Node);
-    --pFb->cEntries;
-    crFbEntryFree(pEntry);
-}
-
-DECLINLINE(uint32_t) crFbEntryAddRef(CR_FRAMEBUFFER_ENTRY* pEntry)
-{
-    return ++pEntry->cRefs;
-}
-
-DECLINLINE(uint32_t) crFbEntryRelease(CR_FRAMEBUFFER *pFb, CR_FRAMEBUFFER_ENTRY* pEntry)
-{
-    uint32_t cRefs = --pEntry->cRefs;
-    if (!cRefs)
-        crFbEntryDestroy(pFb, pEntry);
-    return cRefs;
-}
-
-static DECLCALLBACK(void) crFbEntryReleased(const struct VBOXVR_SCR_COMPOSITOR *pCompositor, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry, struct VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacingEntry)
-{
-    CR_FRAMEBUFFER *pFb = PCR_FRAMEBUFFER_FROM_COMPOSITOR(pCompositor);
-    CR_FRAMEBUFFER_ENTRY *pFbEntry = PCR_FBENTRY_FROM_ENTRY(pEntry);
-    CR_FRAMEBUFFER_ENTRY *pFbReplacingEntry = pReplacingEntry ? PCR_FBENTRY_FROM_ENTRY(pReplacingEntry) : NULL;
-    if (pFbReplacingEntry)
-    {
-        /*replace operation implies the replaced entry gets auto-destroyed,
-         * while all its data gets moved to the *clean* replacing entry
-         * 1. ensure the replacing entry is cleaned up */
-        crFbEntryMarkDestroyed(pFb, pFbReplacingEntry);
-
-        CrHTableMoveTo(&pFbEntry->HTable, &pFbReplacingEntry->HTable);
-
-        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&pFbEntry->Entry);
-        CR_TEXDATA *pReplacingTex = CrVrScrCompositorEntryTexGet(&pFbReplacingEntry->Entry);
-
-        CrTdBltScaleCacheMoveTo(pTex, pReplacingTex);
-
-        if (pFb->pDisplay)
-            pFb->pDisplay->EntryReplaced(pFb, pFbReplacingEntry, pFbEntry);
-
-        CrTdBltDataInvalidateNe(pTex);
-
-        /* 2. mark the replaced entry is destroyed */
-        Assert(pFbEntry->Flags.fCreateNotified);
-        Assert(pFbEntry->Flags.fInList);
-        pFbEntry->Flags.fCreateNotified = 0;
-        pFbEntry->Flags.fInList = 0;
-        pFbReplacingEntry->Flags.fCreateNotified = 1;
-        pFbReplacingEntry->Flags.fInList = 1;
-    }
-    else
-    {
-        if (pFbEntry->Flags.fInList)
-        {
-            pFbEntry->Flags.fInList = 0;
-            if (pFb->pDisplay)
-                pFb->pDisplay->EntryRemoved(pFb, pFbEntry);
-
-            CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&pFbEntry->Entry);
-            if (pTex)
-                CrTdBltDataInvalidateNe(pTex);
-        }
-    }
-
-    crFbEntryRelease(pFb, pFbEntry);
-}
-
-static CR_FRAMEBUFFER_ENTRY* crFbEntryCreate(CR_FRAMEBUFFER *pFb, CR_TEXDATA* pTex, const RTRECT *pRect, uint32_t fFlags)
-{
-    CR_FRAMEBUFFER_ENTRY *pEntry = crFbEntryAlloc();
-    if (!pEntry)
-    {
-        WARN(("crFbEntryAlloc failed!"));
-        return NULL;
-    }
-
-    CrVrScrCompositorEntryInit(&pEntry->Entry, pRect, pTex, crFbEntryReleased);
-    CrVrScrCompositorEntryFlagsSet(&pEntry->Entry, fFlags);
-    pEntry->cRefs = 1;
-    pEntry->Flags.Value = 0;
-    CrHTableCreate(&pEntry->HTable, 0);
-
-    RTListAppend(&pFb->EntriesList, &pEntry->Node);
-    ++pFb->cEntries;
-
-    return pEntry;
-}
-
-int CrFbEntryCreateForTexData(CR_FRAMEBUFFER *pFb, struct CR_TEXDATA *pTex, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry)
-{
-    if (pTex == NULL)
-    {
-        WARN(("pTex is NULL"));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    RTRECT Rect;
-    Rect.xLeft = 0;
-    Rect.yTop = 0;
-    Rect.xRight = pTex->Tex.width;
-    Rect.yBottom = pTex->Tex.height;
-    CR_FRAMEBUFFER_ENTRY* pEntry = crFbEntryCreate(pFb, pTex, &Rect, fFlags);
-    if (!pEntry)
-    {
-        WARN(("crFbEntryCreate failed"));
-        return VERR_NO_MEMORY;
-    }
-
-    *phEntry = pEntry;
-    return VINF_SUCCESS;
-}
-
-int CrFbEntryTexDataUpdate(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY pEntry, struct CR_TEXDATA *pTex)
-{
-    if (!pFb->cUpdating)
-    {
-        WARN(("framebuffer not updating"));
-        return VERR_INVALID_STATE;
-    }
-
-    if (pTex)
-        CrVrScrCompositorEntryTexSet(&pEntry->Entry, pTex);
-
-    if (CrVrScrCompositorEntryIsUsed(&pEntry->Entry))
-    {
-        if (pFb->pDisplay)
-            pFb->pDisplay->EntryTexChanged(pFb, pEntry);
-
-        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&pEntry->Entry);
-        if (pTex)
-            CrTdBltDataInvalidateNe(pTex);
-    }
-
-    return VINF_SUCCESS;
-}
-
-
-int CrFbEntryCreateForTexId(CR_FRAMEBUFFER *pFb, GLuint idTexture, uint32_t fFlags, HCR_FRAMEBUFFER_ENTRY *phEntry)
-{
-    CR_FBTEX* pFbTex = crFbTexAcquire(idTexture);
-    if (!pFbTex)
-    {
-        LOG(("crFbTexAcquire failed"));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    CR_TEXDATA* pTex = &pFbTex->Tex;
-    int rc = CrFbEntryCreateForTexData(pFb, pTex, fFlags, phEntry);
-    if (!RT_SUCCESS(rc))
-    {
-    	WARN(("CrFbEntryCreateForTexData failed rc %d", rc));
-    }
-
-    /*always release the tex, the CrFbEntryCreateForTexData will do incref as necessary */
-    CrTdRelease(pTex);
-    return rc;
-}
-
-void CrFbEntryAddRef(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-{
-    ++hEntry->cRefs;
-}
-
-void CrFbEntryRelease(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-{
-    crFbEntryRelease(pFb, hEntry);
-}
-
-static int8_t crVBoxServerCrCmdBltPrimaryVramGenericProcess(uint32_t u32PrimaryID, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, bool fToPrimary);
-
-int CrFbRegionsClear(HCR_FRAMEBUFFER hFb)
-{
-    if (!hFb->cUpdating)
-    {
-        WARN(("framebuffer not updating"));
-        return VERR_INVALID_STATE;
-    }
-
-    uint32_t cRegions;
-    const RTRECT *pRegions;
-    int rc = CrVrScrCompositorRegionsGet(&hFb->Compositor, &cRegions, NULL, NULL, &pRegions);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrVrScrCompositorEntryRegionsGet failed rc %d", rc));
-        return rc;
-    }
-
-    const struct VBVAINFOSCREEN* pScreen = CrFbGetScreenInfo(hFb);
-    VBOXCMDVBVAOFFSET offVRAM = (VBOXCMDVBVAOFFSET)(((uintptr_t)CrFbGetVRAM(hFb)) - ((uintptr_t)g_pvVRamBase));
-    RTPOINT Pos = {0,0};
-    int8_t i8Result = crVBoxServerCrCmdBltPrimaryVramGenericProcess(pScreen->u32ViewIndex, offVRAM, pScreen->u32Width, pScreen->u32Height, &Pos, cRegions, pRegions, true);
-    if (i8Result)
-    {
-        WARN(("crVBoxServerCrCmdBltPrimaryVramGenericProcess failed"));
-        return VERR_INTERNAL_ERROR;
-    }
-
-#ifdef DEBUG
-    {
-        uint32_t cTmpRegions;
-        const RTRECT *pTmpRegions;
-        int tmpRc = CrVrScrCompositorRegionsGet(&hFb->Compositor, &cTmpRegions, NULL, NULL, &pTmpRegions);
-        if (!RT_SUCCESS(tmpRc))
-        {
-            WARN(("CrVrScrCompositorEntryRegionsGet failed rc %d", tmpRc));
-        }
-        Assert(!cTmpRegions);
-    }
-#endif
-
-    /* just in case */
-    bool fChanged = false;
-    CrVrScrCompositorRegionsClear(&hFb->Compositor, &fChanged);
-    Assert(!fChanged);
-
-    if (cRegions)
-    {
-        if (hFb->pDisplay)
-            hFb->pDisplay->RegionsChanged(hFb);
-    }
-
-    return VINF_SUCCESS;
-}
-
-int CrFbEntryRegionsAdd(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated)
-{
-    if (!pFb->cUpdating)
-    {
-        WARN(("framebuffer not updating"));
-        return VERR_INVALID_STATE;
-    }
-
-    uint32_t fChangeFlags = 0;
-    VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacedScrEntry = NULL;
-    VBOXVR_SCR_COMPOSITOR_ENTRY *pNewEntry;
-    bool fEntryWasInList;
-
-    if (hEntry)
-    {
-        crFbEntryAddRef(hEntry);
-        pNewEntry = &hEntry->Entry;
-        fEntryWasInList = CrVrScrCompositorEntryIsUsed(pNewEntry);
-
-        Assert(!hEntry->Flags.fInList == !fEntryWasInList);
-    }
-    else
-    {
-        pNewEntry = NULL;
-        fEntryWasInList = false;
-    }
-
-    int rc = CrVrScrCompositorEntryRegionsAdd(&pFb->Compositor, hEntry ? &hEntry->Entry : NULL, pPos, cRegions, paRegions, fPosRelated, &pReplacedScrEntry, &fChangeFlags);
-    if (RT_SUCCESS(rc))
-    {
-        if (fChangeFlags & VBOXVR_COMPOSITOR_CF_REGIONS_CHANGED)
-        {
-            if (!fEntryWasInList && pNewEntry)
-            {
-                Assert(CrVrScrCompositorEntryIsUsed(pNewEntry));
-                if (!hEntry->Flags.fCreateNotified)
-                {
-                    hEntry->Flags.fCreateNotified = 1;
-                    if (pFb->pDisplay)
-                        pFb->pDisplay->EntryCreated(pFb, hEntry);
-                }
-
-#ifdef DEBUG_misha
-                /* in theory hEntry->Flags.fInList can be set if entry is replaced,
-                 * but then modified to fit the compositor rects,
-                 * and so we get the regions changed notification as a result
-                 * this should not generally happen though, so put an assertion to debug that situation */
-                Assert(!hEntry->Flags.fInList);
-#endif
-                if (!hEntry->Flags.fInList)
-                {
-                    hEntry->Flags.fInList = 1;
-
-                    if (pFb->pDisplay)
-                        pFb->pDisplay->EntryAdded(pFb, hEntry);
-                }
-            }
-            if (pFb->pDisplay)
-                pFb->pDisplay->RegionsChanged(pFb);
-
-            Assert(!pReplacedScrEntry);
-        }
-        else if (fChangeFlags & VBOXVR_COMPOSITOR_CF_ENTRY_REPLACED)
-        {
-            Assert(pReplacedScrEntry);
-            /* we have already processed that in a "release" callback */
-            Assert(hEntry);
-        }
-        else
-        {
-            Assert(!fChangeFlags);
-            Assert(!pReplacedScrEntry);
-        }
-
-        if (hEntry)
-        {
-            if (CrVrScrCompositorEntryIsUsed(&hEntry->Entry))
-            {
-                if (pFb->pDisplay)
-                    pFb->pDisplay->EntryTexChanged(pFb, hEntry);
-
-                CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&hEntry->Entry);
-                if (pTex)
-                    CrTdBltDataInvalidateNe(pTex);
-            }
-        }
-    }
-    else
-        WARN(("CrVrScrCompositorEntryRegionsAdd failed, rc %d", rc));
-
-    return rc;
-}
-
-int CrFbEntryRegionsSet(CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry, const RTPOINT *pPos, uint32_t cRegions, const RTRECT *paRegions, bool fPosRelated)
-{
-    if (!pFb->cUpdating)
-    {
-        WARN(("framebuffer not updating"));
-        return VERR_INVALID_STATE;
-    }
-
-    bool fChanged = 0;
-    VBOXVR_SCR_COMPOSITOR_ENTRY *pReplacedScrEntry = NULL;
-    VBOXVR_SCR_COMPOSITOR_ENTRY *pNewEntry;
-    bool fEntryWasInList;
-
-    if (hEntry)
-    {
-        crFbEntryAddRef(hEntry);
-        pNewEntry = &hEntry->Entry;
-        fEntryWasInList = CrVrScrCompositorEntryIsUsed(pNewEntry);
-        Assert(!hEntry->Flags.fInList == !fEntryWasInList);
-    }
-    else
-    {
-        pNewEntry = NULL;
-        fEntryWasInList = false;
-    }
-
-    int rc = CrVrScrCompositorEntryRegionsSet(&pFb->Compositor, pNewEntry, pPos, cRegions, paRegions, fPosRelated, &fChanged);
-    if (RT_SUCCESS(rc))
-    {
-        if (fChanged)
-        {
-            if (!fEntryWasInList && pNewEntry)
-            {
-                if (CrVrScrCompositorEntryIsUsed(pNewEntry))
-                {
-                    if (!hEntry->Flags.fCreateNotified)
-                    {
-                        hEntry->Flags.fCreateNotified = 1;
-
-                        if (pFb->pDisplay)
-                            pFb->pDisplay->EntryCreated(pFb, hEntry);
-                    }
-
-                    Assert(!hEntry->Flags.fInList);
-                    hEntry->Flags.fInList = 1;
-
-                    if (pFb->pDisplay)
-                        pFb->pDisplay->EntryAdded(pFb, hEntry);
-                }
-            }
-
-            if (pFb->pDisplay)
-                pFb->pDisplay->RegionsChanged(pFb);
-        }
-
-        if (hEntry)
-        {
-            if (CrVrScrCompositorEntryIsUsed(&hEntry->Entry))
-            {
-                if (pFb->pDisplay)
-                    pFb->pDisplay->EntryTexChanged(pFb, hEntry);
-
-                CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(&hEntry->Entry);
-                if (pTex)
-                    CrTdBltDataInvalidateNe(pTex);
-            }
-        }
-    }
-    else
-        WARN(("CrVrScrCompositorEntryRegionsSet failed, rc %d", rc));
-
-    return rc;
-}
-
-const struct VBOXVR_SCR_COMPOSITOR_ENTRY* CrFbEntryGetCompositorEntry(HCR_FRAMEBUFFER_ENTRY hEntry)
-{
-    return &hEntry->Entry;
-}
-
-HCR_FRAMEBUFFER_ENTRY CrFbEntryFromCompositorEntry(const struct VBOXVR_SCR_COMPOSITOR_ENTRY* pCEntry)
-{
-    return RT_FROM_MEMBER(pCEntry, CR_FRAMEBUFFER_ENTRY, Entry);
-}
-
-void CrFbVisitCreatedEntries(HCR_FRAMEBUFFER hFb, PFNCR_FRAMEBUFFER_ENTRIES_VISITOR_CB pfnVisitorCb, void *pvContext)
-{
-    HCR_FRAMEBUFFER_ENTRY hEntry, hNext;
-    RTListForEachSafe(&hFb->EntriesList, hEntry, hNext, CR_FRAMEBUFFER_ENTRY, Node)
-    {
-        if (hEntry->Flags.fCreateNotified)
-        {
-            if (!pfnVisitorCb(hFb, hEntry, pvContext))
-                return;
-        }
-    }
-}
-
-
-CRHTABLE_HANDLE CrFbDDataAllocSlot(CR_FRAMEBUFFER *pFb)
-{
-    return CrHTablePut(&pFb->SlotTable, (void*)1);
-}
-
-void CrFbDDataReleaseSlot(CR_FRAMEBUFFER *pFb, CRHTABLE_HANDLE hSlot, PFNCR_FRAMEBUFFER_SLOT_RELEASE_CB pfnReleaseCb, void *pvContext)
-{
-    HCR_FRAMEBUFFER_ENTRY hEntry, hNext;
-    RTListForEachSafe(&pFb->EntriesList, hEntry, hNext, CR_FRAMEBUFFER_ENTRY, Node)
-    {
-        if (CrFbDDataEntryGet(hEntry, hSlot))
-        {
-            if (pfnReleaseCb)
-                pfnReleaseCb(pFb, hEntry, pvContext);
-
-            CrFbDDataEntryClear(hEntry, hSlot);
-        }
-    }
-
-    CrHTableRemove(&pFb->SlotTable, hSlot);
-}
-
-int CrFbDDataEntryPut(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot, void *pvData)
-{
-    return CrHTablePutToSlot(&hEntry->HTable, hSlot, pvData);
-}
-
-void* CrFbDDataEntryClear(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot)
-{
-    return CrHTableRemove(&hEntry->HTable, hSlot);
-}
-
-void* CrFbDDataEntryGet(HCR_FRAMEBUFFER_ENTRY hEntry, CRHTABLE_HANDLE hSlot)
-{
-    return CrHTableGet(&hEntry->HTable, hSlot);
-}
-
-typedef union CR_FBDISPBASE_FLAGS
-{
-    struct {
-        uint32_t fRegionsShanged : 1;
-        uint32_t Reserved        : 31;
-    };
-    uint32_t u32Value;
-} CR_FBDISPBASE_FLAGS;
-
-class CrFbDisplayBase : public ICrFbDisplay
-{
-public:
-    CrFbDisplayBase() :
-        mpContainer(NULL),
-        mpFb(NULL),
-        mcUpdates(0),
-        mhSlot(CRHTABLE_HANDLE_INVALID)
-    {
-        mFlags.u32Value = 0;
-    }
-
-    virtual bool isComposite()
-    {
-        return false;
-    }
-
-    class CrFbDisplayComposite* getContainer()
-    {
-        return mpContainer;
-    }
-
-    bool isInList()
-    {
-        return !!mpContainer;
-    }
-
-    bool isUpdating()
-    {
-        return !!mcUpdates;
-    }
-
-    int setRegionsChanged()
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-
-        mFlags.fRegionsShanged = 1;
-        return VINF_SUCCESS;
-    }
-
-    int setFramebuffer(struct CR_FRAMEBUFFER *pFb)
-    {
-        if (mcUpdates)
-        {
-            WARN(("trying to set framebuffer while update is in progress"));
-            return VERR_INVALID_STATE;
-        }
-
-        if (mpFb == pFb)
-            return VINF_SUCCESS;
-
-        int rc = setFramebufferBegin(pFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        if (mpFb)
-        {
-            rc = fbCleanup();
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                setFramebufferEnd(pFb);
-                return rc;
-            }
-        }
-
-        mpFb = pFb;
-
-        if (mpFb)
-        {
-            rc = fbSync();
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                setFramebufferEnd(pFb);
-                return rc;
-            }
-        }
-
-        setFramebufferEnd(pFb);
-        return VINF_SUCCESS;
-    }
-
-    struct CR_FRAMEBUFFER* getFramebuffer()
-    {
-        return mpFb;
-    }
-
-    virtual int UpdateBegin(struct CR_FRAMEBUFFER *pFb)
-    {
-        ++mcUpdates;
-        Assert(!mFlags.fRegionsShanged || mcUpdates > 1);
-        return VINF_SUCCESS;
-    }
-
-    virtual void UpdateEnd(struct CR_FRAMEBUFFER *pFb)
-    {
-        --mcUpdates;
-        Assert(mcUpdates < UINT32_MAX/2);
-        if (!mcUpdates)
-            onUpdateEnd();
-    }
-
-    virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-        mFlags.fRegionsShanged = 1;
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-        mFlags.fRegionsShanged = 1;
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryPosChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-        mFlags.fRegionsShanged = 1;
-        return VINF_SUCCESS;
-    }
-
-    virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb)
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-        mFlags.fRegionsShanged = 1;
-        return VINF_SUCCESS;
-    }
-
-    virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb)
-    {
-        if (!mcUpdates)
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual ~CrFbDisplayBase();
-
-    /*@todo: move to protected and switch from RTLISTNODE*/
-    RTLISTNODE mNode;
-    class CrFbDisplayComposite* mpContainer;
-protected:
-    virtual void onUpdateEnd()
-    {
-        if (mFlags.fRegionsShanged)
-        {
-            mFlags.fRegionsShanged = 0;
-            if (getFramebuffer()) /*<-dont't do anything on cleanup*/
-                ueRegions();
-        }
-    }
-
-    virtual void ueRegions()
-    {
-    }
-
-    static DECLCALLBACK(bool) entriesCreateCb(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
-    {
-        int rc = ((ICrFbDisplay*)(pvContext))->EntryCreated(hFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-        }
-        return true;
-    }
-
-    static DECLCALLBACK(bool) entriesDestroyCb(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
-    {
-        int rc = ((ICrFbDisplay*)(pvContext))->EntryDestroyed(hFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-        }
-        return true;
-    }
-
-    int fbSynchAddAllEntries()
-    {
-        VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
-        const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
-
-        CrVrScrCompositorConstIterInit(CrFbGetCompositor(mpFb), &Iter);
-
-        int rc = VINF_SUCCESS;
-
-        CrFbVisitCreatedEntries(mpFb, entriesCreateCb, this);
-
-        while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
-        {
-            HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
-
-            rc = EntryAdded(mpFb, hEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                EntryDestroyed(mpFb, hEntry);
-                break;
-            }
-        }
-
-        return rc;
-    }
-
-    int fbCleanupRemoveAllEntries()
-    {
-        VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
-        const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
-
-        CrVrScrCompositorConstIterInit(CrFbGetCompositor(mpFb), &Iter);
-
-        int rc = VINF_SUCCESS;
-
-        while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
-        {
-            HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
-            rc = EntryRemoved(mpFb, hEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                break;
-            }
-
-            CrFbVisitCreatedEntries(mpFb, entriesDestroyCb, this);
-        }
-
-        return rc;
-    }
-
-    virtual int setFramebufferBegin(struct CR_FRAMEBUFFER *pFb)
-    {
-        return UpdateBegin(pFb);
-    }
-    virtual void setFramebufferEnd(struct CR_FRAMEBUFFER *pFb)
-    {
-        UpdateEnd(pFb);
-    }
-
-    static DECLCALLBACK(void) slotEntryReleaseCB(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry, void *pvContext)
-    {
-    }
-
-    virtual void slotRelease()
-    {
-        Assert(mhSlot);
-        CrFbDDataReleaseSlot(mpFb, mhSlot, slotEntryReleaseCB, this);
-    }
-
-    virtual int fbCleanup()
-    {
-        if (mhSlot)
-        {
-            slotRelease();
-            mhSlot = 0;
-        }
-        mpFb = NULL;
-        return VINF_SUCCESS;
-    }
-
-    virtual int fbSync()
-    {
-        return VINF_SUCCESS;
-    }
-
-    CRHTABLE_HANDLE slotGet()
-    {
-        if (!mhSlot)
-        {
-            if (mpFb)
-                mhSlot = CrFbDDataAllocSlot(mpFb);
-        }
-
-        return mhSlot;
-    }
-
-private:
-    struct CR_FRAMEBUFFER *mpFb;
-    uint32_t mcUpdates;
-    CRHTABLE_HANDLE mhSlot;
-    CR_FBDISPBASE_FLAGS mFlags;
-};
-
-class CrFbDisplayComposite : public CrFbDisplayBase
-{
-public:
-    CrFbDisplayComposite() :
-        mcDisplays(0)
-    {
-        RTListInit(&mDisplays);
-    }
-
-    virtual bool isComposite()
-    {
-        return true;
-    }
-
-    uint32_t getDisplayCount()
-    {
-        return mcDisplays;
-    }
-
-    bool add(CrFbDisplayBase *pDisplay)
-    {
-        if (pDisplay->isInList())
-        {
-            WARN(("entry in list already"));
-            return false;
-        }
-
-        RTListAppend(&mDisplays, &pDisplay->mNode);
-        pDisplay->mpContainer = this;
-        pDisplay->setFramebuffer(getFramebuffer());
-        ++mcDisplays;
-        return true;
-    }
-
-    bool remove(CrFbDisplayBase *pDisplay, bool fCleanupDisplay = true)
-    {
-        if (pDisplay->getContainer() != this)
-        {
-            WARN(("invalid entry container"));
-            return false;
-        }
-
-        RTListNodeRemove(&pDisplay->mNode);
-        pDisplay->mpContainer = NULL;
-        if (fCleanupDisplay)
-            pDisplay->setFramebuffer(NULL);
-        --mcDisplays;
-        return true;
-    }
-
-    CrFbDisplayBase* first()
-    {
-        return RTListGetFirstCpp(&mDisplays, CrFbDisplayBase, mNode);
-    }
-
-    CrFbDisplayBase* next(CrFbDisplayBase* pDisplay)
-    {
-        if (pDisplay->getContainer() != this)
-        {
-            WARN(("invalid entry container"));
-            return NULL;
-        }
-
-        return RTListGetNextCpp(&mDisplays, pDisplay, CrFbDisplayBase, mNode);
-    }
-
-    virtual int setFramebuffer(struct CR_FRAMEBUFFER *pFb)
-    {
-        CrFbDisplayBase::setFramebuffer(pFb);
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            pIter->setFramebuffer(pFb);
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int UpdateBegin(struct CR_FRAMEBUFFER *pFb)
-    {
-        int rc = CrFbDisplayBase::UpdateBegin(pFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            rc = pIter->UpdateBegin(pFb);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual void UpdateEnd(struct CR_FRAMEBUFFER *pFb)
-    {
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            pIter->UpdateEnd(pFb);
-        }
-
-        CrFbDisplayBase::UpdateEnd(pFb);
-    }
-
-    virtual int EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryAdded(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            int rc = pIter->EntryAdded(pFb, hEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryAdded(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            int rc = pIter->EntryCreated(pFb, hEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
-    {
-        int rc = CrFbDisplayBase::EntryReplaced(pFb, hNewEntry, hReplacedEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            int rc = pIter->EntryReplaced(pFb, hNewEntry, hReplacedEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryTexChanged(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            int rc = pIter->EntryTexChanged(pFb, hEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryRemoved(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            int rc = pIter->EntryRemoved(pFb, hEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryDestroyed(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            int rc = pIter->EntryDestroyed(pFb, hEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb)
-    {
-        int rc = CrFbDisplayBase::RegionsChanged(pFb);
-          if (!RT_SUCCESS(rc))
-          {
-              WARN(("err"));
-              return rc;
-          }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            int rc = pIter->RegionsChanged(pFb);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb)
-    {
-        int rc = CrFbDisplayBase::FramebufferChanged(pFb);
-          if (!RT_SUCCESS(rc))
-          {
-              WARN(("err"));
-              return rc;
-          }
-
-        CrFbDisplayBase *pIter;
-        RTListForEachCpp(&mDisplays, pIter, CrFbDisplayBase, mNode)
-        {
-            int rc = pIter->FramebufferChanged(pFb);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        return VINF_SUCCESS;
-    }
-
-    virtual ~CrFbDisplayComposite()
-    {
-        cleanup();
-    }
-
-    void cleanup(bool fCleanupDisplays = true)
-    {
-        CrFbDisplayBase *pIter, *pIterNext;
-        RTListForEachSafeCpp(&mDisplays, pIter, pIterNext, CrFbDisplayBase, mNode)
-        {
-            remove(pIter, fCleanupDisplays);
-        }
-    }
-private:
-    RTLISTNODE mDisplays;
-    uint32_t mcDisplays;
-};
-
-typedef union CR_FBWIN_FLAGS
-{
-    struct {
-        uint32_t fVisible : 1;
-        uint32_t fDataPresented : 1;
-        uint32_t fForcePresentOnReenable : 1;
-        uint32_t fCompositoEntriesModified : 1;
-        uint32_t Reserved : 28;
-    };
-    uint32_t Value;
-} CR_FBWIN_FLAGS;
-
-class CrFbWindow
-{
-public:
-    CrFbWindow(uint64_t parentId) :
-        mSpuWindow(0),
-        mpCompositor(NULL),
-        mcUpdates(0),
-        mxPos(0),
-        myPos(0),
-        mWidth(0),
-        mHeight(0),
-        mParentId(parentId)
-    {
-        mFlags.Value = 0;
-    }
-
-    bool IsCreated() const
-    {
-        return !!mSpuWindow;
-    }
-
-    bool IsVisivle() const
-    {
-        return mFlags.fVisible;
-    }
-
-    void Destroy()
-    {
-        CRASSERT(!mcUpdates);
-
-        if (!mSpuWindow)
-            return;
-
-        cr_server.head_spu->dispatch_table.WindowDestroy(mSpuWindow);
-
-        mSpuWindow = 0;
-        mFlags.fDataPresented = 0;
-    }
-
-    int Reparent(uint64_t parentId)
-    {
-        if (!checkInitedUpdating())
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-
-        uint64_t oldParentId = mParentId;
-
-        mParentId = parentId;
-
-        if (mSpuWindow)
-        {
-            if (oldParentId && !parentId && mFlags.fVisible)
-                cr_server.head_spu->dispatch_table.WindowShow(mSpuWindow, false);
-
-            renderspuSetWindowId(mParentId);
-            renderspuReparentWindow(mSpuWindow);
-            renderspuSetWindowId(cr_server.screen[0].winID);
-
-            if (parentId)
-            {
-                if (mFlags.fVisible)
-                    cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, mxPos, myPos);
-                cr_server.head_spu->dispatch_table.WindowShow(mSpuWindow, mFlags.fVisible);
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    int SetVisible(bool fVisible)
-    {
-        if (!checkInitedUpdating())
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-
-        LOG(("CrWIN: Vidible [%d]", fVisible));
-
-        if (!fVisible != !mFlags.fVisible)
-        {
-            mFlags.fVisible = fVisible;
-            if (mSpuWindow && mParentId)
-            {
-                if (fVisible)
-                    cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, mxPos, myPos);
-                cr_server.head_spu->dispatch_table.WindowShow(mSpuWindow, fVisible);
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    int SetSize(uint32_t width, uint32_t height)
-    {
-        if (!checkInitedUpdating())
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-
-        LOG(("CrWIN: Size [%d ; %d]", width, height));
-
-        if (mWidth != width || mHeight != height)
-        {
-            mFlags.fCompositoEntriesModified = 1;
-            mWidth = width;
-            mHeight = height;
-            if (mSpuWindow)
-                cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, width, height);
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    int SetPosition(int32_t x, int32_t y)
-    {
-        if (!checkInitedUpdating())
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-
-        LOG(("CrWIN: Pos [%d ; %d]", x, y));
-//      always do WindowPosition to ensure window is adjusted properly
-//        if (x != mxPos || y != myPos)
-        {
-            mxPos = x;
-            myPos = y;
-            if (mSpuWindow)
-                cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, x, y);
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    int SetVisibleRegionsChanged()
-    {
-        if (!checkInitedUpdating())
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-
-        mFlags.fCompositoEntriesModified = 1;
-        return VINF_SUCCESS;
-    }
-
-    int SetCompositor(const struct VBOXVR_SCR_COMPOSITOR * pCompositor)
-    {
-        if (!checkInitedUpdating())
-        {
-            WARN(("err"));
-            return VERR_INVALID_STATE;
-        }
-
-        mpCompositor = pCompositor;
-        mFlags.fCompositoEntriesModified = 1;
-        return VINF_SUCCESS;
-    }
-
-    int UpdateBegin()
-    {
-        ++mcUpdates;
-        if (mcUpdates > 1)
-            return VINF_SUCCESS;
-
-        Assert(!mFlags.fForcePresentOnReenable);
-//        Assert(!mFlags.fCompositoEntriesModified);
-
-        if (mFlags.fDataPresented)
-        {
-            Assert(mSpuWindow);
-            cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, NULL, NULL);
-            mFlags.fForcePresentOnReenable = isPresentNeeded();
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    void UpdateEnd()
-    {
-        --mcUpdates;
-        Assert(mcUpdates < UINT32_MAX/2);
-        if (mcUpdates)
-            return;
-
-        checkRegions();
-
-        if (mSpuWindow)
-        {
-            bool fPresentNeeded = isPresentNeeded();
-            if (fPresentNeeded || mFlags.fForcePresentOnReenable)
-            {
-                mFlags.fForcePresentOnReenable = false;
-                if (mpCompositor)
-                    cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, mpCompositor, NULL);
-                else
-                {
-                    VBOXVR_SCR_COMPOSITOR TmpCompositor;
-                    RTRECT Rect;
-                    Rect.xLeft = 0;
-                    Rect.yTop = 0;
-                    Rect.xRight = mWidth;
-                    Rect.yBottom = mHeight;
-                    CrVrScrCompositorInit(&TmpCompositor, &Rect);
-                    /* this is a cleanup operation
-                     * empty compositor is guarantid to be released on VBoxPresentComposition return */
-                    cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, &TmpCompositor, NULL);
-                }
-                g_pLed->Asserted.s.fWriting = 1;
-            }
-
-            /* even if the above branch is entered due to mFlags.fForcePresentOnReenable,
-             * the backend should clean up the compositor as soon as presentation is performed */
-            mFlags.fDataPresented = fPresentNeeded;
-        }
-        else
-        {
-            Assert(!mFlags.fDataPresented);
-            Assert(!mFlags.fForcePresentOnReenable);
-        }
-    }
-
-    uint64_t GetParentId()
-    {
-        return mParentId;
-    }
-
-    int Create()
-    {
-        if (mSpuWindow)
-        {
-            //WARN(("window already created"));
-            return VINF_ALREADY_INITIALIZED;
-        }
-
-        CRASSERT(cr_server.fVisualBitsDefault);
-        renderspuSetWindowId(mParentId);
-        mSpuWindow = cr_server.head_spu->dispatch_table.WindowCreate("", cr_server.fVisualBitsDefault);
-        renderspuSetWindowId(cr_server.screen[0].winID);
-        if (mSpuWindow < 0) {
-            WARN(("WindowCreate failed"));
-            return VERR_GENERAL_FAILURE;
-        }
-
-        cr_server.head_spu->dispatch_table.WindowSize(mSpuWindow, mWidth, mHeight);
-        cr_server.head_spu->dispatch_table.WindowPosition(mSpuWindow, mxPos, myPos);
-
-        checkRegions();
-
-        if (mParentId && mFlags.fVisible)
-            cr_server.head_spu->dispatch_table.WindowShow(mSpuWindow, true);
-
-        return VINF_SUCCESS;
-    }
-
-    ~CrFbWindow()
-    {
-        Destroy();
-    }
-protected:
-    void checkRegions()
-    {
-        if (!mSpuWindow)
-            return;
-
-        if (!mFlags.fCompositoEntriesModified)
-            return;
-
-        uint32_t cRects;
-        const RTRECT *pRects;
-        if (mpCompositor)
-        {
-            int rc = CrVrScrCompositorRegionsGet(mpCompositor, &cRects, NULL, &pRects, NULL);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("CrVrScrCompositorRegionsGet failed rc %d", rc));
-                cRects = 0;
-                pRects = NULL;
-            }
-        }
-        else
-        {
-            cRects = 0;
-            pRects = NULL;
-        }
-
-        cr_server.head_spu->dispatch_table.WindowVisibleRegion(mSpuWindow, cRects, (const GLint*)pRects);
-
-        mFlags.fCompositoEntriesModified = 0;
-    }
-
-    bool isPresentNeeded()
-    {
-        return mFlags.fVisible && mWidth && mHeight && mpCompositor && !CrVrScrCompositorIsEmpty(mpCompositor);
-    }
-
-    bool checkInitedUpdating()
-    {
-        if (!mcUpdates)
-        {
-            WARN(("not updating"));
-            return false;
-        }
-
-        return true;
-    }
-private:
-    GLint mSpuWindow;
-    const struct VBOXVR_SCR_COMPOSITOR * mpCompositor;
-    uint32_t mcUpdates;
-    int32_t mxPos;
-    int32_t myPos;
-    uint32_t mWidth;
-    uint32_t mHeight;
-    CR_FBWIN_FLAGS mFlags;
-    uint64_t mParentId;
-};
-
-typedef union CR_FBDISPWINDOW_FLAGS
-{
-    struct {
-        uint32_t fNeVisible : 1;
-        uint32_t fNeForce   : 1;
-        uint32_t Reserved   : 30;
-    };
-    uint32_t u32Value;
-} CR_FBDISPWINDOW_FLAGS;
-class CrFbDisplayWindow : public CrFbDisplayBase
-{
-public:
-    CrFbDisplayWindow(const RTRECT *pViewportRect, uint64_t parentId, uint64_t defaultParentId) :
-        mpWindow(NULL),
-        mViewportRect(*pViewportRect),
-        mu32Screen(~0),
-        mParentId(parentId),
-        mDefaultParentId(defaultParentId)
-    {
-        mFlags.u32Value = 0;
-    }
-
-    virtual ~CrFbDisplayWindow()
-    {
-        if (mpWindow)
-            delete mpWindow;
-    }
-
-    virtual int UpdateBegin(struct CR_FRAMEBUFFER *pFb)
-    {
-        int rc = mpWindow ? mpWindow->UpdateBegin() : VINF_SUCCESS;
-        if (RT_SUCCESS(rc))
-        {
-            rc = CrFbDisplayBase::UpdateBegin(pFb);
-            if (RT_SUCCESS(rc))
-                return VINF_SUCCESS;
-            else
-            {
-                WARN(("err"));
-                if (mpWindow)
-                    mpWindow->UpdateEnd();
-            }
-        }
-        else
-            WARN(("err"));
-
-        return rc;
-    }
-
-    virtual void UpdateEnd(struct CR_FRAMEBUFFER *pFb)
-    {
-        CrFbDisplayBase::UpdateEnd(pFb);
-
-        if (mpWindow)
-            mpWindow->UpdateEnd();
-    }
-
-    virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb)
-    {
-        int rc = CrFbDisplayBase::RegionsChanged(pFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        if (mpWindow && mpWindow->GetParentId())
-        {
-            rc = mpWindow->Create();
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryCreated(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        if (mpWindow && mpWindow->GetParentId())
-        {
-            rc = mpWindow->Create();
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
-    {
-        int rc = CrFbDisplayBase::EntryReplaced(pFb, hNewEntry, hReplacedEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        if (mpWindow && mpWindow->GetParentId())
-        {
-            rc = mpWindow->Create();
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryTexChanged(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        if (mpWindow && mpWindow->GetParentId())
-        {
-            rc = mpWindow->Create();
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb)
-    {
-        int rc = CrFbDisplayBase::FramebufferChanged(pFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return screenChanged();
-    }
-
-    const RTRECT* getViewportRect()
-    {
-        return &mViewportRect;
-    }
-
-    virtual int setViewportRect(const RTRECT *pViewportRect)
-    {
-        if (!isUpdating())
-        {
-            WARN(("not updating!"));
-            return VERR_INVALID_STATE;
-        }
-
-// always call SetPosition to ensure window is adjustep properly
-//        if (pViewportRect->xLeft != mViewportRect.xLeft || pViewportRect->yTop != mViewportRect.yTop)
-        if (mpWindow)
-        {
-            const RTRECT* pRect = getRect();
-            int rc = mpWindow->SetPosition(pRect->xLeft - pViewportRect->xLeft, pRect->yTop - pViewportRect->yTop);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("SetPosition failed"));
-                return rc;
-            }
-        }
-
-        mViewportRect = *pViewportRect;
-
-        return VINF_SUCCESS;
-    }
-
-    virtual CrFbWindow * windowDetach(bool fCleanup = true)
-    {
-        if (isUpdating())
-        {
-            WARN(("updating!"));
-            return NULL;
-        }
-
-        CrFbWindow * pWindow = mpWindow;
-        if (mpWindow)
-        {
-            if (fCleanup)
-                windowCleanup();
-            mpWindow = NULL;
-        }
-        return pWindow;
-    }
-
-    virtual CrFbWindow * windowAttach(CrFbWindow * pNewWindow)
-    {
-        if (isUpdating())
-        {
-            WARN(("updating!"));
-            return NULL;
-        }
-
-        CrFbWindow * pOld = mpWindow;
-        if (mpWindow)
-            windowDetach();
-
-        mpWindow = pNewWindow;
-        if (pNewWindow)
-            windowSync();
-
-        return mpWindow;
-    }
-
-    virtual int setDefaultParent(uint64_t parentId)
-    {
-        mDefaultParentId = parentId;
-
-        if (!isActive() && mpWindow)
-        {
-            int rc = mpWindow->Reparent(parentId);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("window reparent failed"));
-                return rc;
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int reparent(uint64_t parentId)
-    {
-        if (!isUpdating())
-        {
-            WARN(("not updating!"));
-            return VERR_INVALID_STATE;
-        }
-
-        mParentId = parentId;
-        int rc = VINF_SUCCESS;
-
-        if (isActive() && mpWindow)
-        {
-            rc = mpWindow->Reparent(parentId);
-            if (!RT_SUCCESS(rc))
-                WARN(("window reparent failed"));
-
-            mFlags.fNeForce = 1;
-        }
-
-        return rc;
-    }
-
-    virtual bool isVisible()
-    {
-        HCR_FRAMEBUFFER hFb = getFramebuffer();
-        if (!hFb)
-            return false;
-        const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(hFb);
-        return !CrVrScrCompositorIsEmpty(pCompositor);
-    }
-
-    int winVisibilityChanged()
-    {
-        HCR_FRAMEBUFFER hFb = getFramebuffer();
-        if (!hFb || !CrFbIsEnabled(hFb))
-        {
-            Assert(!mpWindow || !mpWindow->IsVisivle());
-            return VINF_SUCCESS;
-        }
-
-        int rc = VINF_SUCCESS;
-
-        if (mpWindow)
-        {
-            rc = mpWindow->UpdateBegin();
-            if (RT_SUCCESS(rc))
-            {
-                rc = mpWindow->SetVisible(!g_CrPresenter.fWindowsForceHidden);
-                if (!RT_SUCCESS(rc))
-                    WARN(("SetVisible failed, rc %d", rc));
-
-                mpWindow->UpdateEnd();
-            }
-            else
-                WARN(("UpdateBegin failed, rc %d", rc));
-        }
-
-        return rc;
-    }
-
-    CrFbWindow* getWindow() {return mpWindow;}
-protected:
-    virtual void onUpdateEnd()
-    {
-        CrFbDisplayBase::onUpdateEnd();
-        bool fVisible = isVisible();
-        if (mFlags.fNeVisible != fVisible || mFlags.fNeForce)
-        {
-            crVBoxServerNotifyEvent(mu32Screen, VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA, fVisible ? (void*)1 : NULL);
-            mFlags.fNeVisible = fVisible;
-            mFlags.fNeForce = 0;
-        }
-    }
-
-    virtual void ueRegions()
-    {
-        if (mpWindow)
-            mpWindow->SetVisibleRegionsChanged();
-    }
-
-    virtual int screenChanged()
-    {
-        if (!isUpdating())
-        {
-            WARN(("not updating!"));
-            return VERR_INVALID_STATE;
-        }
-
-        int rc = windowDimensionsSync();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("windowDimensionsSync failed rc %d", rc));
-            return rc;
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int windowSetCompositor(bool fSet)
-    {
-        if (!mpWindow)
-            return VINF_SUCCESS;
-
-        if (fSet)
-        {
-            const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(getFramebuffer());
-            return mpWindow->SetCompositor(pCompositor);
-        }
-        return mpWindow->SetCompositor(NULL);
-    }
-
-    virtual int windowCleanup()
-    {
-        if (!mpWindow)
-            return VINF_SUCCESS;
-
-        int rc = mpWindow->UpdateBegin();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        rc = windowDimensionsSync(true);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            mpWindow->UpdateEnd();
-            return rc;
-        }
-
-        rc = windowSetCompositor(false);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            mpWindow->UpdateEnd();
-            return rc;
-        }
-
-        mpWindow->UpdateEnd();
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int fbCleanup()
-    {
-        int rc = windowCleanup();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("windowCleanup failed"));
-            return rc;
-        }
-        return CrFbDisplayBase::fbCleanup();
-    }
-
-    bool isActive()
-    {
-        HCR_FRAMEBUFFER hFb = getFramebuffer();
-        return hFb && CrFbIsEnabled(hFb);
-    }
-
-    int windowDimensionsSync(bool fForceCleanup = false)
-    {
-        int rc = VINF_SUCCESS;
-
-        if (!mpWindow)
-            return VINF_SUCCESS;
-
-//        HCR_FRAMEBUFFER hFb = getFramebuffer();
-        if (!fForceCleanup && isActive())
-        {
-            const RTRECT* pRect = getRect();
-
-            if (mpWindow->GetParentId() != mParentId)
-            {
-                rc = mpWindow->Reparent(mParentId);
-                if (!RT_SUCCESS(rc))
-                {
-                    WARN(("err"));
-                    return rc;
-                }
-            }
-
-            rc = mpWindow->SetPosition(pRect->xLeft - mViewportRect.xLeft, pRect->yTop - mViewportRect.yTop);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-
-            setRegionsChanged();
-
-            rc = mpWindow->SetSize((uint32_t)(pRect->xRight - pRect->xLeft), (uint32_t)(pRect->yBottom - pRect->yTop));
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-
-            rc = mpWindow->SetVisible(!g_CrPresenter.fWindowsForceHidden);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-        }
-        else
-        {
-            rc = mpWindow->SetVisible(false);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-
-#if 0
-            rc = mpWindow->Reparent(mDefaultParentId);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("err"));
-                return rc;
-            }
-#endif
-        }
-
-        return rc;
-    }
-
-    virtual int windowSync()
-    {
-        if (!mpWindow)
-            return VINF_SUCCESS;
-
-        int rc = mpWindow->UpdateBegin();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        rc = windowSetCompositor(true);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            mpWindow->UpdateEnd();
-            return rc;
-        }
-
-        rc = windowDimensionsSync();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            mpWindow->UpdateEnd();
-            return rc;
-        }
-
-        mpWindow->UpdateEnd();
-
-        return rc;
-    }
-
-    virtual int fbSync()
-    {
-        int rc = CrFbDisplayBase::fbSync();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        HCR_FRAMEBUFFER hFb = getFramebuffer();
-
-        mu32Screen = CrFbGetScreenInfo(hFb)->u32ViewIndex;
-
-        rc = windowSync();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("windowSync failed %d", rc));
-            return rc;
-        }
-
-        if (CrFbHas3DData(hFb))
-        {
-            if (mpWindow && mpWindow->GetParentId())
-            {
-                rc = mpWindow->Create();
-                if (!RT_SUCCESS(rc))
-                {
-                    WARN(("err"));
-                    return rc;
-                }
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual const struct RTRECT* getRect()
-    {
-        const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(getFramebuffer());
-        return CrVrScrCompositorRectGet(pCompositor);
-    }
-
-private:
-    CrFbWindow *mpWindow;
-    RTRECT mViewportRect;
-    CR_FBDISPWINDOW_FLAGS mFlags;
-    uint32_t mu32Screen;
-    uint64_t mParentId;
-    uint64_t mDefaultParentId;
-};
-
-class CrFbDisplayWindowRootVr : public CrFbDisplayWindow
-{
-public:
-    CrFbDisplayWindowRootVr(const RTRECT *pViewportRect, uint64_t parentId, uint64_t defaultParentId) :
-        CrFbDisplayWindow(pViewportRect, parentId, defaultParentId)
-    {
-        CrVrScrCompositorInit(&mCompositor, NULL);
-    }
-
-    virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayWindow::EntryCreated(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        Assert(!CrFbDDataEntryGet(hEntry, slotGet()));
-
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcEntry = CrFbEntryGetCompositorEntry(hEntry);
-        VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = entryAlloc();
-        CrVrScrCompositorEntryInit(pMyEntry, CrVrScrCompositorEntryRectGet(pSrcEntry), CrVrScrCompositorEntryTexGet(pSrcEntry), NULL);
-        CrVrScrCompositorEntryFlagsSet(pMyEntry, CrVrScrCompositorEntryFlagsGet(pSrcEntry));
-        rc = CrFbDDataEntryPut(hEntry, slotGet(), pMyEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("CrFbDDataEntryPut failed rc %d", rc));
-            entryFree(pMyEntry);
-            return rc;
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryAdded(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayWindow::EntryAdded(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcEntry = CrFbEntryGetCompositorEntry(hEntry);
-        VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
-        Assert(pMyEntry);
-        CrVrScrCompositorEntryTexSet(pMyEntry, CrVrScrCompositorEntryTexGet(pSrcEntry));
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
-    {
-        int rc = CrFbDisplayWindow::EntryReplaced(pFb, hNewEntry, hReplacedEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcNewEntry = CrFbEntryGetCompositorEntry(hNewEntry);
-        VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hNewEntry, slotGet());
-        CrVrScrCompositorEntryTexSet(pMyEntry, CrVrScrCompositorEntryTexGet(pSrcNewEntry));
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayWindow::EntryTexChanged(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcEntry = CrFbEntryGetCompositorEntry(hEntry);
-        VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
-        CrVrScrCompositorEntryTexSet(pMyEntry, CrVrScrCompositorEntryTexGet(pSrcEntry));
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayWindow::EntryRemoved(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
-        rc = CrVrScrCompositorEntryRegionsSet(&mCompositor, pMyEntry, NULL, 0, NULL, false, NULL);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayWindow::EntryDestroyed(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pSrcEntry = CrFbEntryGetCompositorEntry(hEntry);
-        VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, slotGet());
-        CrVrScrCompositorEntryCleanup(pMyEntry);
-        entryFree(pMyEntry);
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int setViewportRect(const RTRECT *pViewportRect)
-    {
-        int rc = CrFbDisplayWindow::setViewportRect(pViewportRect);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        rc = setRegionsChanged();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return VINF_SUCCESS;
-    }
-
-protected:
-    virtual int windowSetCompositor(bool fSet)
-    {
-        if (fSet)
-            return getWindow()->SetCompositor(&mCompositor);
-        return getWindow()->SetCompositor(NULL);
-    }
-
-    virtual void ueRegions()
-    {
-        synchCompositorRegions();
-    }
-
-    int compositorMarkUpdated()
-    {
-        CrVrScrCompositorClear(&mCompositor);
-
-        int rc = CrVrScrCompositorRectSet(&mCompositor, CrVrScrCompositorRectGet(CrFbGetCompositor(getFramebuffer())), NULL);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        rc = setRegionsChanged();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("screenChanged failed %d", rc));
-            return rc;
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int screenChanged()
-    {
-        int rc = compositorMarkUpdated();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        rc = CrFbDisplayWindow::screenChanged();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("screenChanged failed %d", rc));
-            return rc;
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual const struct RTRECT* getRect()
-    {
-        return CrVrScrCompositorRectGet(&mCompositor);
-    }
-
-    virtual int fbCleanup()
-    {
-        int rc = clearCompositor();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return CrFbDisplayWindow::fbCleanup();
-    }
-
-    virtual int fbSync()
-    {
-        int rc = synchCompositor();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return CrFbDisplayWindow::fbSync();
-    }
-
-    VBOXVR_SCR_COMPOSITOR_ENTRY* entryAlloc()
-    {
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-        return (VBOXVR_SCR_COMPOSITOR_ENTRY*)RTMemCacheAlloc(g_CrPresenter.CEntryLookasideList);
-#else
-        return (VBOXVR_SCR_COMPOSITOR_ENTRY*)RTMemAlloc(sizeof (VBOXVR_SCR_COMPOSITOR_ENTRY));
-#endif
-    }
-
-    void entryFree(VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry)
-    {
-        Assert(!CrVrScrCompositorEntryIsUsed(pEntry));
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-        RTMemCacheFree(g_CrPresenter.CEntryLookasideList, pEntry);
-#else
-        RTMemFree(pEntry);
-#endif
-    }
-
-    int synchCompositorRegions()
-    {
-        int rc;
-
-        rootVrTranslateForPos();
-
-        /* ensure the rootvr compositor does not hold any data,
-         * i.e. cleanup all rootvr entries data */
-        CrVrScrCompositorClear(&mCompositor);
-
-        rc = CrVrScrCompositorIntersectedList(CrFbGetCompositor(getFramebuffer()), &cr_server.RootVr, &mCompositor, rootVrGetCEntry, this, NULL);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("CrVrScrCompositorIntersectedList failed, rc %d", rc));
-            return rc;
-        }
-
-        return getWindow()->SetVisibleRegionsChanged();
-    }
-
-    virtual int synchCompositor()
-    {
-        int rc = compositorMarkUpdated();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("compositorMarkUpdated failed, rc %d", rc));
-            return rc;
-        }
-
-        rc = fbSynchAddAllEntries();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("fbSynchAddAllEntries failed, rc %d", rc));
-            return rc;
-        }
-
-        return rc;
-    }
-
-    virtual int clearCompositor()
-    {
-        return fbCleanupRemoveAllEntries();
-    }
-
-    void rootVrTranslateForPos()
-    {
-        const RTRECT *pRect = getViewportRect();
-        const struct VBVAINFOSCREEN* pScreen = CrFbGetScreenInfo(getFramebuffer());
-        int32_t x = pScreen->i32OriginX;
-        int32_t y = pScreen->i32OriginY;
-        int32_t dx = cr_server.RootVrCurPoint.x - x;
-        int32_t dy = cr_server.RootVrCurPoint.y - y;
-
-        cr_server.RootVrCurPoint.x = x;
-        cr_server.RootVrCurPoint.y = y;
-
-        VBoxVrListTranslate(&cr_server.RootVr, dx, dy);
-    }
-
-    static DECLCALLBACK(VBOXVR_SCR_COMPOSITOR_ENTRY*) rootVrGetCEntry(const VBOXVR_SCR_COMPOSITOR_ENTRY*pEntry, void *pvContext)
-    {
-        CrFbDisplayWindowRootVr *pThis = (CrFbDisplayWindowRootVr*)pvContext;
-        HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
-        VBOXVR_SCR_COMPOSITOR_ENTRY *pMyEntry = (VBOXVR_SCR_COMPOSITOR_ENTRY*)CrFbDDataEntryGet(hEntry, pThis->slotGet());
-        Assert(!CrVrScrCompositorEntryIsUsed(pMyEntry));
-        CrVrScrCompositorEntryRectSet(&pThis->mCompositor, pMyEntry, CrVrScrCompositorEntryRectGet(pEntry));
-        return pMyEntry;
-    }
-private:
-    VBOXVR_SCR_COMPOSITOR mCompositor;
-};
-
-class CrFbDisplayVrdp : public CrFbDisplayBase
-{
-public:
-    CrFbDisplayVrdp()
-    {
-        memset(&mPos, 0, sizeof (mPos));
-    }
-
-    virtual int EntryCreated(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryCreated(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("EntryAdded failed rc %d", rc));
-            return rc;
-        }
-
-        Assert(!CrFbDDataEntryGet(hEntry, slotGet()));
-        rc = vrdpCreate(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("vrdpCreate failed rc %d", rc));
-            return rc;
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
-    {
-        int rc = CrFbDisplayBase::EntryReplaced(pFb, hNewEntry, hReplacedEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pReplacedEntry = CrFbEntryGetCompositorEntry(hReplacedEntry);
-        CR_TEXDATA *pReplacedTex = CrVrScrCompositorEntryTexGet(pReplacedEntry);
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pNewEntry = CrFbEntryGetCompositorEntry(hNewEntry);
-        CR_TEXDATA *pNewTex = CrVrScrCompositorEntryTexGet(pNewEntry);
-
-        CrTdBltDataInvalidateNe(pReplacedTex);
-
-        rc = CrTdBltEnter(pNewTex);
-        if (RT_SUCCESS(rc))
-        {
-            rc = vrdpFrame(hNewEntry);
-            CrTdBltLeave(pNewTex);
-        }
-        else
-            WARN(("CrTdBltEnter failed %d", rc));
-
-        return rc;
-    }
-
-    virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryTexChanged(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
-        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
-
-        rc = CrTdBltEnter(pTex);
-        if (RT_SUCCESS(rc))
-        {
-            rc = vrdpFrame(hEntry);
-            CrTdBltLeave(pTex);
-        }
-        else
-            WARN(("CrTdBltEnter failed %d", rc));
-
-    	return rc;
-    }
-
-    virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryRemoved(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
-        CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
-        CrTdBltDataInvalidateNe(pTex);
-
-        return vrdpRegions(pFb, hEntry);
-    }
-
-    virtual int EntryDestroyed(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryDestroyed(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        vrdpDestroy(hEntry);
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryPosChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        int rc = CrFbDisplayBase::EntryPosChanged(pFb, hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        vrdpGeometry(hEntry);
-
-        return VINF_SUCCESS;
-    }
-
-    virtual int RegionsChanged(struct CR_FRAMEBUFFER *pFb)
-    {
-        int rc = CrFbDisplayBase::RegionsChanged(pFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return vrdpRegionsAll(pFb);
-    }
-
-    virtual int FramebufferChanged(struct CR_FRAMEBUFFER *pFb)
-    {
-        int rc = CrFbDisplayBase::FramebufferChanged(pFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        syncPos();
-
-        rc = vrdpSyncEntryAll(pFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return vrdpRegionsAll(pFb);
-    }
-
-protected:
-    void syncPos()
-    {
-        const struct VBVAINFOSCREEN* pScreenInfo = CrFbGetScreenInfo(getFramebuffer());
-        mPos.x = pScreenInfo->i32OriginX;
-        mPos.y = pScreenInfo->i32OriginY;
-    }
-
-    virtual int fbCleanup()
-    {
-        int rc = fbCleanupRemoveAllEntries();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return CrFbDisplayBase::fbCleanup();
-    }
-
-    virtual int fbSync()
-    {
-        syncPos();
-
-        int rc = fbSynchAddAllEntries();
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("err"));
-            return rc;
-        }
-
-        return CrFbDisplayBase::fbSync();
-    }
-protected:
-    void vrdpDestroy(HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        void *pVrdp = CrFbDDataEntryGet(hEntry, slotGet());
-        cr_server.outputRedirect.CROREnd(pVrdp);
-    }
-
-    void vrdpGeometry(HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-    	void *pVrdp = CrFbDDataEntryGet(hEntry, slotGet());
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
-
-        cr_server.outputRedirect.CRORGeometry(pVrdp,
-        										mPos.x + CrVrScrCompositorEntryRectGet(pEntry)->xLeft,
-        										mPos.y + CrVrScrCompositorEntryRectGet(pEntry)->yTop,
-        									   CrVrScrCompositorEntryTexGet(pEntry)->Tex.width,
-                                               CrVrScrCompositorEntryTexGet(pEntry)->Tex.height);
-    }
-
-    int vrdpRegions(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        void *pVrdp = CrFbDDataEntryGet(hEntry, slotGet());
-    	const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(pFb);
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
-        uint32_t cRects;
-        const RTRECT *pRects;
-
-        int rc = CrVrScrCompositorEntryRegionsGet(pCompositor, pEntry, &cRects, &pRects, NULL, NULL);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("CrVrScrCompositorEntryRegionsGet failed, rc %d", rc));
-            return rc;
-        }
-
-        cr_server.outputRedirect.CRORVisibleRegion(pVrdp, cRects, pRects);
-        return VINF_SUCCESS;
-    }
-
-    int vrdpFrame(HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        void *pVrdp = CrFbDDataEntryGet(hEntry, slotGet());
-        const VBOXVR_SCR_COMPOSITOR_ENTRY* pEntry = CrFbEntryGetCompositorEntry(hEntry);
-    	CR_TEXDATA *pTex = CrVrScrCompositorEntryTexGet(pEntry);
-    	const CR_BLITTER_IMG *pImg;
-    	CrTdBltDataInvalidateNe(pTex);
-    	int rc = CrTdBltDataAcquire(pTex, GL_BGRA, !!(CrVrScrCompositorEntryFlagsGet(pEntry) & CRBLT_F_INVERT_SRC_YCOORDS), &pImg);
-    	if (!RT_SUCCESS(rc))
-    	{
-    		WARN(("CrTdBltDataAcquire failed rc %d", rc));
-    		return rc;
-    	}
-
-        cr_server.outputRedirect.CRORFrame(pVrdp, pImg->pvData, pImg->cbData);
-        CrTdBltDataRelease(pTex);
-        return VINF_SUCCESS;
-    }
-
-    int vrdpRegionsAll(struct CR_FRAMEBUFFER *pFb)
-    {
-    	const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(pFb);
-        VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
-        CrVrScrCompositorConstIterInit(pCompositor, &Iter);
-        const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
-        while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
-        {
-        	HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
-        	vrdpRegions(pFb, hEntry);
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    int vrdpSynchEntry(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        vrdpGeometry(hEntry);
-
-        return vrdpRegions(pFb, hEntry);;
-    }
-
-    int vrdpSyncEntryAll(struct CR_FRAMEBUFFER *pFb)
-    {
-        const struct VBOXVR_SCR_COMPOSITOR* pCompositor = CrFbGetCompositor(pFb);
-        VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
-        CrVrScrCompositorConstIterInit(pCompositor, &Iter);
-        const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
-        while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
-        {
-            HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
-            int rc = vrdpSynchEntry(pFb, hEntry);
-            if (!RT_SUCCESS(rc))
-            {
-                WARN(("vrdpSynchEntry failed rc %d", rc));
-                return rc;
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    int vrdpCreate(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-    	void *pVrdp;
-
-        /* Query supported formats. */
-        uint32_t cbFormats = 4096;
-        char *pachFormats = (char *)crAlloc(cbFormats);
-
-        if (!pachFormats)
-        {
-            WARN(("crAlloc failed"));
-            return VERR_NO_MEMORY;
-        }
-
-        int rc = cr_server.outputRedirect.CRORContextProperty(cr_server.outputRedirect.pvContext,
-                                                                  0 /* H3DOR_PROP_FORMATS */, // @todo from a header
-                                                                  pachFormats, cbFormats, &cbFormats);
-        if (RT_SUCCESS(rc))
-        {
-            if (RTStrStr(pachFormats, "H3DOR_FMT_RGBA_TOPDOWN"))
-            {
-                cr_server.outputRedirect.CRORBegin(cr_server.outputRedirect.pvContext,
-                		        &pVrdp,
-                                "H3DOR_FMT_RGBA_TOPDOWN"); // @todo from a header
-
-                if (pVrdp)
-                {
-                    rc = CrFbDDataEntryPut(hEntry, slotGet(), pVrdp);
-                    if (RT_SUCCESS(rc))
-                    {
-                    	vrdpGeometry(hEntry);
-                    	vrdpRegions(hFb, hEntry);
-                    	//vrdpFrame(hEntry);
-                        return VINF_SUCCESS;
-                    }
-                    else
-                    	WARN(("CrFbDDataEntryPut failed rc %d", rc));
-
-                    cr_server.outputRedirect.CROREnd(pVrdp);
-                }
-                else
-                {
-                    WARN(("CRORBegin failed"));
-                    rc = VERR_GENERAL_FAILURE;
-                }
-            }
-        }
-        else
-            WARN(("CRORContextProperty failed rc %d", rc));
-
-        crFree(pachFormats);
-
-        return rc;
-    }
-private:
-    RTPOINT mPos;
-};
-
-CrFbDisplayBase::~CrFbDisplayBase()
-{
-    Assert(!mcUpdates);
-
-    if (mpContainer)
-        mpContainer->remove(this);
-}
-
-
-#if 0
-
-
-
-
-
-void crDbgDumpRect(uint32_t i, const RTRECT *pRect)
-{
-    crDebug("%d: (%d;%d) X (%d;%d)", i, pRect->xLeft, pRect->yTop, pRect->xRight, pRect->yBottom);
-}
-
-void crDbgDumpRects(uint32_t cRects, const RTRECT *paRects)
-{
-    crDebug("Dumping rects (%d)", cRects);
-    for (uint32_t i = 0; i < cRects; ++i)
-    {
-        crDbgDumpRect(i, &paRects[i]);
-    }
-    crDebug("End Dumping rects (%d)", cRects);
-}
-
-#endif
-
-class CrFbDisplayEntryDataMonitor : public CrFbDisplayBase
-{
-public:
-    virtual int EntryReplaced(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hNewEntry, HCR_FRAMEBUFFER_ENTRY hReplacedEntry)
-    {
-        entryDataChanged(pFb, hReplacedEntry);
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryTexChanged(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        entryDataChanged(pFb, hEntry);
-        return VINF_SUCCESS;
-    }
-
-    virtual int EntryRemoved(struct CR_FRAMEBUFFER *pFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-        entryDataChanged(pFb, hEntry);
-        return VINF_SUCCESS;
-    }
-protected:
-    virtual void entryDataChanged(HCR_FRAMEBUFFER hFb, HCR_FRAMEBUFFER_ENTRY hEntry)
-    {
-
-    }
-};
-
-int CrPMgrDisable()
-{
-    if (!g_CrPresenter.fEnabled)
-        return VINF_SUCCESS;
-
-    g_CrPresenter.u32DisabledDisplayMode = g_CrPresenter.u32DisplayMode;
-
-    int rc = crPMgrModeModifyGlobal(0, CR_PMGR_MODE_WINDOW);
-    if (RT_FAILURE(rc))
-    {
-        WARN(("crPMgrModeModifyGlobal failed %d", rc));
-        return rc;
-    }
-
-    crPMgrCleanUnusedDisplays();
-
-    g_CrPresenter.fEnabled = false;
-
-    return VINF_SUCCESS;
-}
-
-int CrPMgrEnable()
-{
-    if (g_CrPresenter.fEnabled)
-        return VINF_SUCCESS;
-
-    g_CrPresenter.fEnabled = true;
-
-    int rc = crPMgrModeModifyGlobal(g_CrPresenter.u32DisabledDisplayMode, 0);
-    if (RT_FAILURE(rc))
-    {
-        WARN(("crPMgrModeModifyGlobal failed %d", rc));
-        g_CrPresenter.fEnabled = false;
-        return rc;
-    }
-
-    g_CrPresenter.u32DisabledDisplayMode = 0;
-
-    return VINF_SUCCESS;
-}
-
-int CrPMgrInit()
-{
-    int rc = VINF_SUCCESS;
-    memset(&g_CrPresenter, 0, sizeof (g_CrPresenter));
-    g_CrPresenter.fEnabled = true;
-    for (int i = 0; i < RT_ELEMENTS(g_CrPresenter.aDisplayInfos); ++i)
-    {
-        g_CrPresenter.aDisplayInfos[i].u32Id = i;
-        g_CrPresenter.aDisplayInfos[i].iFb = -1;
-
-        g_CrPresenter.aFbInfos[i].u32Id = i;
-    }
-
-    g_CrPresenter.pFbTexMap = crAllocHashtable();
-    if (g_CrPresenter.pFbTexMap)
-    {
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-        rc = RTMemCacheCreate(&g_CrPresenter.FbEntryLookasideList, sizeof (CR_FRAMEBUFFER_ENTRY),
-                                0, /* size_t cbAlignment */
-                                UINT32_MAX, /* uint32_t cMaxObjects */
-                                NULL, /* PFNMEMCACHECTOR pfnCtor*/
-                                NULL, /* PFNMEMCACHEDTOR pfnDtor*/
-                                NULL, /* void *pvUser*/
-                                0 /* uint32_t fFlags*/
-                                );
-        if (RT_SUCCESS(rc))
-        {
-            rc = RTMemCacheCreate(&g_CrPresenter.FbTexLookasideList, sizeof (CR_FBTEX),
-                                        0, /* size_t cbAlignment */
-                                        UINT32_MAX, /* uint32_t cMaxObjects */
-                                        NULL, /* PFNMEMCACHECTOR pfnCtor*/
-                                        NULL, /* PFNMEMCACHEDTOR pfnDtor*/
-                                        NULL, /* void *pvUser*/
-                                        0 /* uint32_t fFlags*/
-                                        );
-            if (RT_SUCCESS(rc))
-            {
-                rc = RTMemCacheCreate(&g_CrPresenter.CEntryLookasideList, sizeof (VBOXVR_SCR_COMPOSITOR_ENTRY),
-                                            0, /* size_t cbAlignment */
-                                            UINT32_MAX, /* uint32_t cMaxObjects */
-                                            NULL, /* PFNMEMCACHECTOR pfnCtor*/
-                                            NULL, /* PFNMEMCACHEDTOR pfnDtor*/
-                                            NULL, /* void *pvUser*/
-                                            0 /* uint32_t fFlags*/
-                                            );
-                if (RT_SUCCESS(rc))
-                {
-#endif
-                    rc = crPMgrModeModifyGlobal(CR_PMGR_MODE_WINDOW, 0);
-                    if (RT_SUCCESS(rc))
-                        return VINF_SUCCESS;
-                    else
-                        WARN(("crPMgrModeModifyGlobal failed rc %d", rc));
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-                    RTMemCacheDestroy(g_CrPresenter.CEntryLookasideList);
-                }
-                else
-                    WARN(("RTMemCacheCreate failed rc %d", rc));
-
-                RTMemCacheDestroy(g_CrPresenter.FbTexLookasideList);
-            }
-            else
-                WARN(("RTMemCacheCreate failed rc %d", rc));
-
-            RTMemCacheDestroy(g_CrPresenter.FbEntryLookasideList);
-        }
-        else
-            WARN(("RTMemCacheCreate failed rc %d", rc));
-#endif
-    }
-    else
-    {
-        WARN(("crAllocHashtable failed"));
-        rc = VERR_NO_MEMORY;
-    }
-    return rc;
-}
-
-void CrPMgrTerm()
-{
-    crPMgrModeModifyGlobal(0, CR_PMGR_MODE_ALL);
-
-    HCR_FRAMEBUFFER hFb;
-
-    for (hFb = CrPMgrFbGetFirstInitialized();
-            hFb;
-            hFb = CrPMgrFbGetNextInitialized(hFb))
-    {
-        uint32_t iFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
-        CrFbDisplaySet(hFb, NULL);
-        CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[iFb];
-        if (pFbInfo->pDpComposite)
-        {
-            delete pFbInfo->pDpComposite;
-            pFbInfo->pDpComposite = NULL;
-        }
-
-        CrFbTerm(hFb);
-    }
-
-    crPMgrCleanUnusedDisplays();
-
-#ifndef VBOXVDBG_MEMCACHE_DISABLE
-    RTMemCacheDestroy(g_CrPresenter.FbEntryLookasideList);
-    RTMemCacheDestroy(g_CrPresenter.FbTexLookasideList);
-    RTMemCacheDestroy(g_CrPresenter.CEntryLookasideList);
-#endif
-    crFreeHashtable(g_CrPresenter.pFbTexMap, NULL);
-
-    if (g_CrPresenter.pvTmpBuf)
-        RTMemFree(g_CrPresenter.pvTmpBuf);
-
-    if (g_CrPresenter.pvTmpBuf2)
-        RTMemFree(g_CrPresenter.pvTmpBuf2);
-
-    memset(&g_CrPresenter, 0, sizeof (g_CrPresenter));
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGet(uint32_t idFb)
-{
-    if (idFb >= CR_MAX_GUEST_MONITORS)
-    {
-        WARN(("invalid idFb %d", idFb));
-        return NULL;
-    }
-
-    if (!CrFBmIsSet(&g_CrPresenter.FramebufferInitMap, idFb))
-    {
-        CrFbInit(&g_CrPresenter.aFramebuffers[idFb], idFb);
-        CrFBmSetAtomic(&g_CrPresenter.FramebufferInitMap, idFb);
-    }
-    else
-        Assert(g_CrPresenter.aFramebuffers[idFb].ScreenInfo.u32ViewIndex == idFb);
-
-    return &g_CrPresenter.aFramebuffers[idFb];
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGetInitialized(uint32_t idFb)
-{
-    if (idFb >= CR_MAX_GUEST_MONITORS)
-    {
-        WARN(("invalid idFb %d", idFb));
-        return NULL;
-    }
-
-    if (!CrFBmIsSet(&g_CrPresenter.FramebufferInitMap, idFb))
-    {
-        return NULL;
-    }
-    else
-        Assert(g_CrPresenter.aFramebuffers[idFb].ScreenInfo.u32ViewIndex == idFb);
-
-    return &g_CrPresenter.aFramebuffers[idFb];
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGetEnabled(uint32_t idFb)
-{
-    HCR_FRAMEBUFFER hFb = CrPMgrFbGetInitialized(idFb);
-
-    if(hFb && CrFbIsEnabled(hFb))
-        return hFb;
-
-    return NULL;
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGetEnabledForScreen(uint32_t idScreen)
-{
-    if (idScreen >= (uint32_t)cr_server.screenCount)
-    {
-        WARN(("invalid target id"));
-        return NULL;
-    }
-
-    const CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
-    if (pDpInfo->iFb < 0)
-        return NULL;
-
-    return CrPMgrFbGetEnabled(pDpInfo->iFb);
-}
-
-static HCR_FRAMEBUFFER crPMgrFbGetNextEnabled(uint32_t i)
-{
-    for (;i < (uint32_t)cr_server.screenCount; ++i)
-    {
-        HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(i);
-        if (hFb)
-            return hFb;
-    }
-
-    return NULL;
-}
-
-static HCR_FRAMEBUFFER crPMgrFbGetNextInitialized(uint32_t i)
-{
-    for (;i < (uint32_t)cr_server.screenCount; ++i)
-    {
-        HCR_FRAMEBUFFER hFb = CrPMgrFbGetInitialized(i);
-        if (hFb)
-            return hFb;
-    }
-
-    return NULL;
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGetFirstEnabled()
-{
-    HCR_FRAMEBUFFER hFb = crPMgrFbGetNextEnabled(0);
-//    if (!hFb)
-//        WARN(("no enabled framebuffer found"));
-    return hFb;
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGetNextEnabled(HCR_FRAMEBUFFER hFb)
-{
-    return crPMgrFbGetNextEnabled(hFb->ScreenInfo.u32ViewIndex+1);
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGetFirstInitialized()
-{
-    HCR_FRAMEBUFFER hFb = crPMgrFbGetNextInitialized(0);
-//    if (!hFb)
-//        WARN(("no initialized framebuffer found"));
-    return hFb;
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGetNextInitialized(HCR_FRAMEBUFFER hFb)
-{
-    return crPMgrFbGetNextInitialized(hFb->ScreenInfo.u32ViewIndex+1);
-}
-
-HCR_FRAMEBUFFER CrPMgrFbGetEnabledByVramStart(VBOXCMDVBVAOFFSET offVRAM)
-{
-    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled();
-            hFb;
-            hFb = CrPMgrFbGetNextEnabled(hFb))
-    {
-        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
-        if (pScreen->u32StartOffset == offVRAM)
-            return hFb;
-    }
-
-    return NULL;
-}
-
-
-static uint32_t crPMgrModeAdjustVal(uint32_t u32Mode)
-{
-    u32Mode = CR_PMGR_MODE_ALL & u32Mode;
-    if (CR_PMGR_MODE_ROOTVR & u32Mode)
-        u32Mode &= ~CR_PMGR_MODE_WINDOW;
-    return u32Mode;
-}
-
-static int crPMgrCheckInitWindowDisplays(uint32_t idScreen)
-{
-#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
-    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
-    if (pDpInfo->iFb >= 0)
-    {
-        uint32_t u32ModeAdd = g_CrPresenter.u32DisplayMode & (CR_PMGR_MODE_WINDOW | CR_PMGR_MODE_ROOTVR);
-        int rc = crPMgrFbConnectTargetDisplays(&g_CrPresenter.aFramebuffers[pDpInfo->iFb], pDpInfo, u32ModeAdd);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbConnectTargetDisplays failed %d", rc));
-            return rc;
-        }
-    }
-#endif
-    return VINF_SUCCESS;
-}
-
-int CrPMgrScreenChanged(uint32_t idScreen)
-{
-    if (idScreen >= CR_MAX_GUEST_MONITORS)
-    {
-        WARN(("invalid idScreen %d", idScreen));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    int rc = VINF_SUCCESS;
-    CR_FBDISPLAY_INFO *pDpInfo;
-#if 0
-    bool fDefaultParentChange = (idScreen == 0);
-    if (fDefaultParentChange)
-    {
-        for (int i = 0; i < cr_server.screenCount; ++i)
-        {
-            pDpInfo = &g_CrPresenter.aDisplayInfos[i];
-            if (pDpInfo->pDpWin)
-            {
-                HCR_FRAMEBUFFER hFb = pDpInfo->iFb >= 0 ? CrPMgrFbGet(pDpInfo->iFb) : NULL;
-                rc = pDpInfo->pDpWin->UpdateBegin(hFb);
-                if (RT_SUCCESS(rc))
-                {
-                    rc = pDpInfo->pDpWin->setDefaultParent(cr_server.screen[idScreen].winID);
-                    if (RT_FAILURE(rc))
-                    {
-                        WARN(("setDefaultParent failed %d", rc));
-                        pDpInfo->pDpWin->UpdateEnd(hFb);
-                    }
-                }
-                else
-                    WARN(("UpdateBegin failed %d", rc));
-
-                if (RT_FAILURE(rc))
-                {
-                    WARN(("err"));
-                    for (int j = 0; j < i - 1; ++j)
-                    {
-                        pDpInfo = &g_CrPresenter.aDisplayInfos[j];
-                        if (pDpInfo->pDpWin)
-                        {
-                            HCR_FRAMEBUFFER hFb = pDpInfo->iFb >= 0 ? CrPMgrFbGet(pDpInfo->iFb) : NULL;
-                            pDpInfo->pDpWin->UpdateEnd(hFb);
-                        }
-                    }
-
-                    Assert(RT_FAILURE(rc));
-                    return rc;
-                }
-            }
-        }
-    }
-#endif
-
-    pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
-
-    HCR_FRAMEBUFFER hFb = pDpInfo->iFb >= 0 ? CrPMgrFbGet(pDpInfo->iFb) : NULL;
-    if (hFb && CrFbIsUpdating(hFb))
-    {
-        WARN(("trying to update viewport while framebuffer is being updated"));
-        rc = VERR_INVALID_STATE;
-        goto end;
-    }
-
-    if (pDpInfo->pDpWin)
-    {
-        CRASSERT(pDpInfo->pDpWin->getWindow());
-
-        rc = pDpInfo->pDpWin->UpdateBegin(hFb);
-        if (RT_SUCCESS(rc))
-        {
-            pDpInfo->pDpWin->reparent(cr_server.screen[idScreen].winID);
-
-            pDpInfo->pDpWin->UpdateEnd(hFb);
-        }
-        else
-            WARN(("UpdateBegin failed %d", rc));
-    }
-    else
-    {
-        if (pDpInfo->pWindow)
-        {
-            rc = pDpInfo->pWindow->UpdateBegin();
-            if (RT_FAILURE(rc))
-            {
-                WARN(("UpdateBegin failed %d", rc));
-                goto end;
-            }
-
-            rc = pDpInfo->pWindow->SetVisible(false);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("SetVisible failed %d", rc));
-                pDpInfo->pWindow->UpdateEnd();
-                goto end;
-            }
-
-            rc = pDpInfo->pWindow->Reparent(cr_server.screen[idScreen].winID);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("Reparent failed %d", rc));
-                pDpInfo->pWindow->UpdateEnd();
-                goto end;
-            }
-
-            pDpInfo->pWindow->UpdateEnd();
-        }
-
-        rc = crPMgrCheckInitWindowDisplays(idScreen);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbConnectTargetDisplays failed %d", rc));
-            goto end;
-        }
-    }
-end:
-#if 0
-    if (fDefaultParentChange)
-    {
-        for (int i = 0; i < cr_server.screenCount; ++i)
-        {
-            pDpInfo = &g_CrPresenter.aDisplayInfos[i];
-            if (pDpInfo->pDpWin)
-            {
-                HCR_FRAMEBUFFER hFb = pDpInfo->iFb >= 0 ? CrPMgrFbGet(pDpInfo->iFb) : NULL;
-                pDpInfo->pDpWin->UpdateEnd(hFb);
-            }
-        }
-    }
-#endif
-    return rc;
-}
-
-int CrPMgrViewportUpdate(uint32_t idScreen)
-{
-    if (idScreen >= CR_MAX_GUEST_MONITORS)
-    {
-        WARN(("invalid idScreen %d", idScreen));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[idScreen];
-    if (pDpInfo->iFb >= 0)
-    {
-        HCR_FRAMEBUFFER hFb = CrPMgrFbGet(pDpInfo->iFb);
-        if (CrFbIsUpdating(hFb))
-        {
-            WARN(("trying to update viewport while framebuffer is being updated"));
-            return VERR_INVALID_STATE;
-        }
-
-        if (pDpInfo->pDpWin)
-        {
-            CRASSERT(pDpInfo->pDpWin->getWindow());
-            int rc = pDpInfo->pDpWin->UpdateBegin(hFb);
-            if (RT_SUCCESS(rc))
-            {
-                pDpInfo->pDpWin->setViewportRect(&cr_server.screenVieport[idScreen].Rect);
-                pDpInfo->pDpWin->UpdateEnd(hFb);
-            }
-            else
-                WARN(("UpdateBegin failed %d", rc));
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-static int crPMgrFbDisconnectDisplay(HCR_FRAMEBUFFER hFb, CrFbDisplayBase *pDp)
-{
-    if (pDp->getFramebuffer() != hFb)
-        return VINF_SUCCESS;
-
-    CrFbDisplayBase * pCurDp = (CrFbDisplayBase*)CrFbDisplayGet(hFb);
-    if (!pCurDp)
-    {
-        WARN(("no display set, unexpected"));
-        return VERR_INTERNAL_ERROR;
-    }
-
-    if (pCurDp == pDp)
-    {
-        pDp->setFramebuffer(NULL);
-        CrFbDisplaySet(hFb, NULL);
-        return VINF_SUCCESS;
-    }
-
-    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
-    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
-    if (pFbInfo->pDpComposite != pCurDp)
-    {
-        WARN(("misconfig, expectig the curret framebuffer to be present, and thus composite is expected"));
-        return VERR_INTERNAL_ERROR;
-    }
-
-    if (pDp->getContainer() == pFbInfo->pDpComposite)
-    {
-        pFbInfo->pDpComposite->remove(pDp);
-        uint32_t cDisplays = pFbInfo->pDpComposite->getDisplayCount();
-        if (cDisplays <= 1)
-        {
-            Assert(cDisplays == 1);
-            CrFbDisplayBase *pDpFirst = pFbInfo->pDpComposite->first();
-            if (pDpFirst)
-                pFbInfo->pDpComposite->remove(pDpFirst, false);
-            CrFbDisplaySet(hFb, pDpFirst);
-        }
-        return VINF_SUCCESS;
-    }
-
-    WARN(("misconfig"));
-    return VERR_INTERNAL_ERROR;
-}
-
-static int crPMgrFbConnectDisplay(HCR_FRAMEBUFFER hFb, CrFbDisplayBase *pDp)
-{
-    if (pDp->getFramebuffer() == hFb)
-        return VINF_SUCCESS;
-
-    CrFbDisplayBase * pCurDp = (CrFbDisplayBase*)CrFbDisplayGet(hFb);
-    if (!pCurDp)
-    {
-        pDp->setFramebuffer(hFb);
-        CrFbDisplaySet(hFb, pDp);
-        return VINF_SUCCESS;
-    }
-
-    if (pCurDp == pDp)
-    {
-        WARN(("misconfig, current framebuffer is not expected to be set"));
-        return VERR_INTERNAL_ERROR;
-    }
-
-    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
-    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
-    if (pFbInfo->pDpComposite != pCurDp)
-    {
-        if (!pFbInfo->pDpComposite)
-        {
-            pFbInfo->pDpComposite = new CrFbDisplayComposite();
-            pFbInfo->pDpComposite->setFramebuffer(hFb);
-        }
-
-        pFbInfo->pDpComposite->add(pCurDp);
-        CrFbDisplaySet(hFb, pFbInfo->pDpComposite);
-    }
-
-    pFbInfo->pDpComposite->add(pDp);
-    return VINF_SUCCESS;
-}
-
-static int crPMgrFbDisconnectTarget(HCR_FRAMEBUFFER hFb, uint32_t i)
-{
-    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
-    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
-    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
-    if (pDpInfo->iFb != idFb)
-    {
-        WARN(("target not connected"));
-        Assert(!ASMBitTest(pFbInfo->aTargetMap, i));
-        return VINF_SUCCESS;
-    }
-
-    Assert(ASMBitTest(pFbInfo->aTargetMap, i));
-
-    int rc = VINF_SUCCESS;
-    if (pDpInfo->pDpVrdp)
-    {
-        rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpVrdp);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbDisconnectDisplay failed %d", rc));
-            return rc;
-        }
-    }
-
-    if (pDpInfo->pDpWinRootVr)
-    {
-#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
-        CrFbWindow *pWindow = pDpInfo->pDpWinRootVr->windowDetach(false);
-        Assert(pWindow == pDpInfo->pWindow);
-#endif
-        rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpWinRootVr);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbDisconnectDisplay failed %d", rc));
-            return rc;
-        }
-    }
-    else if (pDpInfo->pDpWin)
-    {
-#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
-        CrFbWindow *pWindow = pDpInfo->pDpWin->windowDetach(false);
-        Assert(pWindow == pDpInfo->pWindow);
-#endif
-        rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpWin);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbDisconnectDisplay failed %d", rc));
-            return rc;
-        }
-    }
-
-    ASMBitClear(pFbInfo->aTargetMap, i);
-    pDpInfo->iFb = -1;
-
-    return VINF_SUCCESS;
-}
-
-static void crPMgrDpWinRootVrCreate(CR_FBDISPLAY_INFO *pDpInfo)
-{
-    if (!pDpInfo->pDpWinRootVr)
-    {
-        if (pDpInfo->pDpWin)
-        {
-            CrFbWindow *pWin = pDpInfo->pDpWin->windowDetach();
-            CRASSERT(pWin);
-            Assert(pWin == pDpInfo->pWindow);
-            delete pDpInfo->pDpWin;
-            pDpInfo->pDpWin = NULL;
-        }
-        else if (!pDpInfo->pWindow)
-        {
-            pDpInfo->pWindow = new CrFbWindow(0);
-        }
-
-        pDpInfo->pDpWinRootVr = new CrFbDisplayWindowRootVr(&cr_server.screenVieport[pDpInfo->u32Id].Rect, cr_server.screen[pDpInfo->u32Id].winID, /*cr_server.screen[0].winID*/ 0);
-        pDpInfo->pDpWin = pDpInfo->pDpWinRootVr;
-        pDpInfo->pDpWinRootVr->windowAttach(pDpInfo->pWindow);
-    }
-}
-
-static void crPMgrDpWinCreate(CR_FBDISPLAY_INFO *pDpInfo)
-{
-    if (pDpInfo->pDpWinRootVr)
-    {
-        CRASSERT(pDpInfo->pDpWinRootVr == pDpInfo->pDpWin);
-        CrFbWindow *pWin = pDpInfo->pDpWin->windowDetach();
-        CRASSERT(pWin);
-        Assert(pWin == pDpInfo->pWindow);
-        delete pDpInfo->pDpWinRootVr;
-        pDpInfo->pDpWinRootVr = NULL;
-        pDpInfo->pDpWin = NULL;
-    }
-
-    if (!pDpInfo->pDpWin)
-    {
-        if (!pDpInfo->pWindow)
-            pDpInfo->pWindow = new CrFbWindow(0);
-
-        pDpInfo->pDpWin = new CrFbDisplayWindow(&cr_server.screenVieport[pDpInfo->u32Id].Rect, cr_server.screen[pDpInfo->u32Id].winID, /*cr_server.screen[0].winID*/ 0);
-        pDpInfo->pDpWin->windowAttach(pDpInfo->pWindow);
-    }
-}
-
-static int crPMgrFbDisconnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeRemove)
-{
-    int rc = VINF_SUCCESS;
-    if (u32ModeRemove & CR_PMGR_MODE_ROOTVR)
-    {
-        if (pDpInfo->pDpWinRootVr)
-        {
-#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
-            CrFbWindow *pWindow = pDpInfo->pDpWinRootVr->windowDetach(false);
-            Assert(pWindow == pDpInfo->pWindow);
-#endif
-            CRASSERT(pDpInfo->pDpWin == pDpInfo->pDpWinRootVr);
-            rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpWinRootVr);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("crPMgrFbDisconnectDisplay pDpWinRootVr failed %d", rc));
-                return rc;
-            }
-        }
-    }
-    else if (u32ModeRemove & CR_PMGR_MODE_WINDOW)
-    {
-        CRASSERT(!pDpInfo->pDpWinRootVr);
-        if (pDpInfo->pDpWin)
-        {
-#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
-            CrFbWindow *pWindow = pDpInfo->pDpWin->windowDetach(false);
-            Assert(pWindow == pDpInfo->pWindow);
-#endif
-            rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpWin);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("crPMgrFbDisconnectDisplay pDpWin failed %d", rc));
-                return rc;
-            }
-        }
-    }
-
-    if (u32ModeRemove & CR_PMGR_MODE_VRDP)
-    {
-        if (pDpInfo->pDpVrdp)
-        {
-            rc = crPMgrFbDisconnectDisplay(hFb, pDpInfo->pDpVrdp);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("crPMgrFbDisconnectDisplay pDpVrdp failed %d", rc));
-                return rc;
-            }
-        }
-    }
-
-    pDpInfo->u32DisplayMode &= ~u32ModeRemove;
-
-    return VINF_SUCCESS;
-}
-
-static int crPMgrFbConnectTargetDisplays(HCR_FRAMEBUFFER hFb, CR_FBDISPLAY_INFO *pDpInfo, uint32_t u32ModeAdd)
-{
-    int rc = VINF_SUCCESS;
-
-    if (u32ModeAdd & CR_PMGR_MODE_ROOTVR)
-    {
-        crPMgrDpWinRootVrCreate(pDpInfo);
-
-        rc = crPMgrFbConnectDisplay(hFb, pDpInfo->pDpWinRootVr);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbConnectDisplay pDpWinRootVr failed %d", rc));
-            return rc;
-        }
-    }
-    else if (u32ModeAdd & CR_PMGR_MODE_WINDOW)
-    {
-        crPMgrDpWinCreate(pDpInfo);
-
-        rc = crPMgrFbConnectDisplay(hFb, pDpInfo->pDpWin);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbConnectDisplay pDpWin failed %d", rc));
-            return rc;
-        }
-    }
-
-    if (u32ModeAdd & CR_PMGR_MODE_VRDP)
-    {
-        if (!pDpInfo->pDpVrdp)
-            pDpInfo->pDpVrdp = new CrFbDisplayVrdp();
-
-        rc = crPMgrFbConnectDisplay(hFb, pDpInfo->pDpVrdp);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbConnectDisplay pDpVrdp failed %d", rc));
-            return rc;
-        }
-    }
-
-    pDpInfo->u32DisplayMode |= u32ModeAdd;
-
-    return VINF_SUCCESS;
-}
-
-static int crPMgrFbConnectTarget(HCR_FRAMEBUFFER hFb, uint32_t i)
-{
-    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
-    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
-    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
-    if (pDpInfo->iFb == idFb)
-    {
-        WARN(("target not connected"));
-        Assert(ASMBitTest(pFbInfo->aTargetMap, i));
-        return VINF_SUCCESS;
-    }
-
-    Assert(!ASMBitTest(pFbInfo->aTargetMap, i));
-
-    int rc = VINF_SUCCESS;
-
-    if (pDpInfo->iFb != -1)
-    {
-        Assert(pDpInfo->iFb < cr_server.screenCount);
-        HCR_FRAMEBUFFER hAssignedFb = CrPMgrFbGet(pDpInfo->iFb);
-        Assert(hAssignedFb);
-        rc = crPMgrFbDisconnectTarget(hAssignedFb, i);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbDisconnectTarget failed %d", rc));
-            return rc;
-        }
-    }
-
-    rc = crPMgrFbConnectTargetDisplays(hFb, pDpInfo, g_CrPresenter.u32DisplayMode
-#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
-            & ~(CR_PMGR_MODE_WINDOW | CR_PMGR_MODE_ROOTVR)
-#endif
-            );
-    if (RT_FAILURE(rc))
-    {
-        WARN(("crPMgrFbConnectTargetDisplays failed %d", rc));
-        return rc;
-    }
-
-    ASMBitSet(pFbInfo->aTargetMap, i);
-    pDpInfo->iFb = idFb;
-
-    return VINF_SUCCESS;
-}
-
-static int crPMgrFbDisconnect(HCR_FRAMEBUFFER hFb, const uint32_t *pTargetMap)
-{
-    int rc = VINF_SUCCESS;
-    for (int i = ASMBitFirstSet(pTargetMap, cr_server.screenCount);
-            i >= 0;
-            i = ASMBitNextSet(pTargetMap, cr_server.screenCount, i))
-    {
-        rc = crPMgrFbDisconnectTarget(hFb, (uint32_t)i);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbDisconnectTarget failed %d", rc));
-            return rc;
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-static int crPMgrFbConnect(HCR_FRAMEBUFFER hFb, const uint32_t *pTargetMap)
-{
-    int rc = VINF_SUCCESS;
-    for (int i = ASMBitFirstSet(pTargetMap, cr_server.screenCount);
-            i >= 0;
-            i = ASMBitNextSet(pTargetMap, cr_server.screenCount, i))
-    {
-        rc = crPMgrFbConnectTarget(hFb, (uint32_t)i);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbConnectTarget failed %d", rc));
-            return rc;
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-static int crPMgrModeModifyTarget(HCR_FRAMEBUFFER hFb, uint32_t iDisplay, uint32_t u32ModeAdd, uint32_t u32ModeRemove)
-{
-    CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[iDisplay];
-    int rc = crPMgrFbDisconnectTargetDisplays(hFb, pDpInfo, u32ModeRemove);
-    if (RT_FAILURE(rc))
-    {
-        WARN(("crPMgrFbDisconnectTargetDisplays failed %d", rc));
-        return rc;
-    }
-
-    rc = crPMgrFbConnectTargetDisplays(hFb, pDpInfo, u32ModeAdd);
-    if (RT_FAILURE(rc))
-    {
-        WARN(("crPMgrFbConnectTargetDisplays failed %d", rc));
-        return rc;
-    }
-
-    return VINF_SUCCESS;
-}
-
-static int crPMgrModeModify(HCR_FRAMEBUFFER hFb, uint32_t u32ModeAdd, uint32_t u32ModeRemove)
-{
-    int rc = VINF_SUCCESS;
-    uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
-    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
-    for (int i = ASMBitFirstSet(pFbInfo->aTargetMap, cr_server.screenCount);
-            i >= 0;
-            i = ASMBitNextSet(pFbInfo->aTargetMap, cr_server.screenCount, i))
-    {
-        rc = crPMgrModeModifyTarget(hFb, (uint32_t)i, u32ModeAdd, u32ModeRemove);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrModeModifyTarget failed %d", rc));
-            return rc;
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-static void crPMgrCleanUnusedDisplays()
-{
-    for (int i = 0; i < cr_server.screenCount; ++i)
-    {
-        CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
-
-        if (pDpInfo->pDpWinRootVr)
-        {
-            if (!pDpInfo->pDpWinRootVr->getFramebuffer())
-            {
-                pDpInfo->pDpWinRootVr->windowDetach(false);
-                delete pDpInfo->pDpWinRootVr;
-                pDpInfo->pDpWinRootVr = NULL;
-                pDpInfo->pDpWin = NULL;
-                if (pDpInfo->pWindow)
-                {
-                    delete pDpInfo->pWindow;
-                    pDpInfo->pWindow = NULL;
-                }
-            }
-            else
-                WARN(("pDpWinRootVr is used"));
-        }
-        else if (pDpInfo->pDpWin)
-        {
-            if (!pDpInfo->pDpWin->getFramebuffer())
-            {
-                pDpInfo->pDpWin->windowDetach(false);
-                delete pDpInfo->pDpWin;
-                pDpInfo->pDpWin = NULL;
-                if (pDpInfo->pWindow)
-                {
-                    delete pDpInfo->pWindow;
-                    pDpInfo->pWindow = NULL;
-                }
-            }
-            else
-                WARN(("pDpWin is used"));
-        }
-
-        if (pDpInfo->pDpVrdp)
-        {
-            if (!pDpInfo->pDpVrdp->getFramebuffer())
-            {
-                delete pDpInfo->pDpVrdp;
-                pDpInfo->pDpVrdp = NULL;
-            }
-            else
-                WARN(("pDpVrdp is used"));
-        }
-    }
-}
-
-static int crPMgrModeModifyGlobal(uint32_t u32ModeAdd, uint32_t u32ModeRemove)
-{
-    uint32_t u32InternalMode = g_CrPresenter.fEnabled ? g_CrPresenter.u32DisplayMode : g_CrPresenter.u32DisabledDisplayMode;
-
-    u32ModeRemove = ((u32ModeRemove | crPMgrModeAdjustVal(u32ModeRemove)) & CR_PMGR_MODE_ALL);
-    u32ModeAdd = crPMgrModeAdjustVal(u32ModeAdd);
-    u32ModeRemove &= u32InternalMode;
-    u32ModeAdd &= ~(u32ModeRemove | u32InternalMode);
-    uint32_t u32ModeResulting = ((u32InternalMode | u32ModeAdd) & ~u32ModeRemove);
-    uint32_t u32Tmp = crPMgrModeAdjustVal(u32ModeResulting);
-    if (u32Tmp != u32ModeResulting)
-    {
-        u32ModeAdd |= (u32Tmp & ~u32ModeResulting);
-        u32ModeRemove |= (~u32Tmp & u32ModeResulting);
-        u32ModeResulting = u32Tmp;
-        Assert(u32ModeResulting == ((u32InternalMode | u32ModeAdd) & ~u32ModeRemove));
-    }
-    if (!u32ModeRemove && !u32ModeAdd)
-        return VINF_SUCCESS;
-
-    uint32_t u32DisplayMode = (g_CrPresenter.u32DisplayMode | u32ModeAdd) & ~u32ModeRemove;
-    if (!g_CrPresenter.fEnabled)
-    {
-        Assert(g_CrPresenter.u32DisplayMode == 0);
-        g_CrPresenter.u32DisabledDisplayMode = u32DisplayMode;
-        return VINF_SUCCESS;
-    }
-
-    g_CrPresenter.u32DisplayMode = u32DisplayMode;
-
-    /* disabled framebuffers may still have displays attached */
-    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstInitialized();
-            hFb;
-            hFb = CrPMgrFbGetNextInitialized(hFb))
-    {
-        crPMgrModeModify(hFb, u32ModeAdd, u32ModeRemove);
-    }
-
-    return VINF_SUCCESS;
-}
-
-int CrPMgrClearRegionsGlobal()
-{
-    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled();
-            hFb;
-            hFb = CrPMgrFbGetNextEnabled(hFb))
-    {
-        int rc = CrFbUpdateBegin(hFb);
-        if (RT_SUCCESS(rc))
-        {
-            rc = CrFbRegionsClear(hFb);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("CrFbRegionsClear failed %d", rc));
-            }
-
-            CrFbUpdateEnd(hFb);
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-int CrPMgrModeVrdp(bool fEnable)
-{
-    uint32_t u32ModeAdd, u32ModeRemove;
-    if (fEnable)
-    {
-        u32ModeAdd = CR_PMGR_MODE_VRDP;
-        u32ModeRemove = 0;
-    }
-    else
-    {
-        u32ModeAdd = 0;
-        u32ModeRemove = CR_PMGR_MODE_VRDP;
-    }
-    return crPMgrModeModifyGlobal(u32ModeAdd, u32ModeRemove);
-}
-
-int CrPMgrModeRootVr(bool fEnable)
-{
-    uint32_t u32ModeAdd, u32ModeRemove;
-    if (fEnable)
-    {
-        u32ModeAdd = CR_PMGR_MODE_ROOTVR;
-        u32ModeRemove = CR_PMGR_MODE_WINDOW;
-    }
-    else
-    {
-        u32ModeAdd = CR_PMGR_MODE_WINDOW;
-        u32ModeRemove = CR_PMGR_MODE_ROOTVR;
-    }
-
-    return crPMgrModeModifyGlobal(u32ModeAdd, u32ModeRemove);
-}
-
-int CrPMgrModeWinVisible(bool fEnable)
-{
-    if (!g_CrPresenter.fWindowsForceHidden == !!fEnable)
-        return VINF_SUCCESS;
-
-    g_CrPresenter.fWindowsForceHidden = !fEnable;
-
-    for (int i = 0; i < cr_server.screenCount; ++i)
-    {
-        CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
-
-        if (pDpInfo->pDpWin)
-            pDpInfo->pDpWin->winVisibilityChanged();
-    }
-
-    return VINF_SUCCESS;
-}
-
-int CrPMgrRootVrUpdate()
-{
-    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled();
-            hFb;
-            hFb = CrPMgrFbGetNextEnabled(hFb))
-    {
-        if (!CrFbHas3DData(hFb))
-            continue;
-
-        uint32_t idFb = CrFbGetScreenInfo(hFb)->u32ViewIndex;
-        CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
-        int rc = CrFbUpdateBegin(hFb);
-        if (RT_SUCCESS(rc))
-        {
-            for (int i = ASMBitFirstSet(pFbInfo->aTargetMap, cr_server.screenCount);
-                    i >= 0;
-                    i = ASMBitNextSet(pFbInfo->aTargetMap, cr_server.screenCount, i))
-            {
-                CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
-                Assert(pDpInfo->iFb == (int32_t)idFb);
-
-                pDpInfo->pDpWinRootVr->RegionsChanged(hFb);
-            }
-
-            CrFbUpdateEnd(hFb);
-        }
-        else
-            WARN(("CrFbUpdateBegin failed %d", rc));
-    }
-
-    return VINF_SUCCESS;
-}
-
-/*helper function that calls CrFbUpdateBegin for all enabled framebuffers */
-int CrPMgrHlpGlblUpdateBegin(CR_FBMAP *pMap)
-{
-    CrFBmInit(pMap);
-    for (HCR_FRAMEBUFFER hFb = CrPMgrFbGetFirstEnabled();
-            hFb;
-            hFb = CrPMgrFbGetNextEnabled(hFb))
-    {
-        int rc = CrFbUpdateBegin(hFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("UpdateBegin failed, rc %d", rc));
-            for (HCR_FRAMEBUFFER hTmpFb = CrPMgrFbGetFirstEnabled();
-                        hFb != hTmpFb;
-                        hTmpFb = CrPMgrFbGetNextEnabled(hTmpFb))
-            {
-                CrFbUpdateEnd(hTmpFb);
-                CrFBmClear(pMap, CrFbGetScreenInfo(hFb)->u32ViewIndex);
-            }
-            return rc;
-        }
-
-        CrFBmSet(pMap, CrFbGetScreenInfo(hFb)->u32ViewIndex);
-    }
-
-    return VINF_SUCCESS;
-}
-
-/*helper function that calls CrFbUpdateEnd for all framebuffers being updated */
-void CrPMgrHlpGlblUpdateEnd(CR_FBMAP *pMap)
-{
-    for (uint32_t i = 0; i < (uint32_t)cr_server.screenCount; ++i)
-    {
-        if (!CrFBmIsSet(pMap, i))
-            continue;
-
-        HCR_FRAMEBUFFER hFb = CrPMgrFbGetInitialized(i);
-        CRASSERT(hFb);
-        CrFbUpdateEnd(hFb);
-    }
-}
-
-int CrPMgrResize(const struct VBVAINFOSCREEN *pScreen, void *pvVRAM, const uint32_t *pTargetMap)
-{
-    int rc = VINF_SUCCESS;
-
-    if (pScreen->u32ViewIndex == 0xffffffff)
-    {
-        /* this is just a request to disable targets, search and disable */
-        for (int i = ASMBitFirstSet(pTargetMap, cr_server.screenCount);
-                i >= 0;
-                i = ASMBitNextSet(pTargetMap, cr_server.screenCount, i))
-        {
-            CR_FBDISPLAY_INFO *pDpInfo = &g_CrPresenter.aDisplayInfos[i];
-            if (pDpInfo->iFb < 0)
-                continue;
-
-            Assert(pDpInfo->iFb < cr_server.screenCount);
-            HCR_FRAMEBUFFER hAssignedFb = CrPMgrFbGet(pDpInfo->iFb);
-
-            rc = crPMgrFbDisconnectTarget(hAssignedFb, (uint32_t)i);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("crPMgrFbDisconnectTarget failed %d", rc));
-                return rc;
-            }
-        }
-
-        return VINF_SUCCESS;
-    }
-
-    HCR_FRAMEBUFFER hFb = CrPMgrFbGet(pScreen->u32ViewIndex);
-    if (!hFb)
-    {
-        WARN(("CrPMgrFbGet failed"));
-        return VERR_INVALID_PARAMETER;
-    }
-
-    const VBVAINFOSCREEN *pFbScreen = CrFbGetScreenInfo(hFb);
-    bool fFbInfoChanged = true;
-
-    if (!memcmp(pFbScreen, pScreen, sizeof (*pScreen)))
-    {
-        if (!pvVRAM || pvVRAM == CrFbGetVRAM(hFb))
-            fFbInfoChanged = false;
-    }
-
-    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[pScreen->u32ViewIndex];
-
-    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aRemovedTargetMap);
-    VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aAddedTargetMap);
-
-    bool fDisplaysAdded = false, fDisplaysRemoved = false;
-
-    memcpy(aRemovedTargetMap, pFbInfo->aTargetMap, sizeof (aRemovedTargetMap));
-
-    if (pScreen->u16Flags & VBVA_SCREEN_F_DISABLED)
-    {
-        /* so far there is no need in keeping displays attached to disabled Framebffer,
-         * just disconnect everything */
-        for (int i = 0; i < RT_ELEMENTS(aRemovedTargetMap); ++i)
-        {
-            if (aRemovedTargetMap[i])
-            {
-                fDisplaysRemoved = true;
-                break;
-            }
-        }
-
-        memset(aAddedTargetMap, 0, sizeof (aAddedTargetMap));
-    }
-    else
-    {
-        for (int i = 0; i < RT_ELEMENTS(aRemovedTargetMap); ++i)
-        {
-            aRemovedTargetMap[i] = (aRemovedTargetMap[i] & ~pTargetMap[i]);
-            if (aRemovedTargetMap[i])
-                fDisplaysRemoved = true;
-        }
-
-        memcpy(aAddedTargetMap, pFbInfo->aTargetMap, sizeof (aAddedTargetMap));
-        for (int i = 0; i < RT_ELEMENTS(aAddedTargetMap); ++i)
-        {
-            aAddedTargetMap[i] = (pTargetMap[i] & ~aAddedTargetMap[i]);
-            if (aAddedTargetMap[i])
-                fDisplaysAdded = true;
-        }
-    }
-
-    if (!fFbInfoChanged && !fDisplaysRemoved && !fDisplaysAdded)
-    {
-        crDebug("resize: no changes");
-        return VINF_SUCCESS;
-    }
-
-    if (fDisplaysRemoved)
-    {
-        rc = crPMgrFbDisconnect(hFb, aRemovedTargetMap);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbDisconnect failed %d", rc));
-            return rc;
-        }
-    }
-
-    if (fFbInfoChanged)
-    {
-#ifdef CR_SERVER_WITH_CLIENT_CALLOUTS
-        rc = crPMgrModeModify(hFb, 0, CR_PMGR_MODE_WINDOW | CR_PMGR_MODE_ROOTVR);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("crPMgrModeModifyTarget failed %d", rc));
-            return rc;
-        }
-#endif
-        rc = CrFbUpdateBegin(hFb);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("CrFbUpdateBegin failed %d", rc));
-            return rc;
-        }
-
-        crVBoxServerMuralFbResizeBegin(hFb);
-
-        rc = CrFbResize(hFb, pScreen, pvVRAM);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("CrFbResize failed %d", rc));
-        }
-
-        crVBoxServerMuralFbResizeEnd(hFb);
-
-        CrFbUpdateEnd(hFb);
-    }
-
-    if (fDisplaysAdded)
-    {
-        rc = crPMgrFbConnect(hFb, aAddedTargetMap);
-        if (RT_FAILURE(rc))
-        {
-            WARN(("crPMgrFbConnect failed %d", rc));
-            return rc;
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-int CrFbEntrySaveState(CR_FRAMEBUFFER *pFb, CR_FRAMEBUFFER_ENTRY *hEntry, PSSMHANDLE pSSM)
-{
-    const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry = CrFbEntryGetCompositorEntry(hEntry);
-    CR_TEXDATA *pTexData = CrVrScrCompositorEntryTexGet(pEntry);
-    CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTexData);
-    int rc = SSMR3PutU32(pSSM, pFbTex->pTobj->id);
-    AssertRCReturn(rc, rc);
-    uint32_t u32 = 0;
-
-    u32 = CrVrScrCompositorEntryFlagsGet(pEntry);
-    rc = SSMR3PutU32(pSSM, u32);
-    AssertRCReturn(rc, rc);
-
-    const RTRECT *pRect = CrVrScrCompositorEntryRectGet(pEntry);
-
-    rc = SSMR3PutS32(pSSM, pRect->xLeft);
-    AssertRCReturn(rc, rc);
-    rc = SSMR3PutS32(pSSM, pRect->yTop);
-    AssertRCReturn(rc, rc);
-#if 0
-    rc = SSMR3PutS32(pSSM, pRect->xRight);
-    AssertRCReturn(rc, rc);
-    rc = SSMR3PutS32(pSSM, pRect->yBottom);
-    AssertRCReturn(rc, rc);
-#endif
-
-    rc = CrVrScrCompositorEntryRegionsGet(&pFb->Compositor, pEntry, &u32, NULL, NULL, &pRect);
-    AssertRCReturn(rc, rc);
-
-    rc = SSMR3PutU32(pSSM, u32);
-    AssertRCReturn(rc, rc);
-
-    if (u32)
-    {
-        rc = SSMR3PutMem(pSSM, pRect, u32 * sizeof (*pRect));
-        AssertRCReturn(rc, rc);
-    }
-    return rc;
-}
-
-int CrFbSaveState(CR_FRAMEBUFFER *pFb, PSSMHANDLE pSSM)
-{
-    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR Iter;
-    CrVrScrCompositorConstIterInit(&pFb->Compositor, &Iter);
-    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
-    uint32_t u32 = 0;
-    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
-    {
-        CR_TEXDATA *pTexData = CrVrScrCompositorEntryTexGet(pEntry);
-        CRASSERT(pTexData);
-        CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTexData);
-        if (pFbTex->pTobj)
-            ++u32;
-    }
-
-    int rc = SSMR3PutU32(pSSM, u32);
-    AssertRCReturn(rc, rc);
-
-    CrVrScrCompositorConstIterInit(&pFb->Compositor, &Iter);
-
-    while ((pEntry = CrVrScrCompositorConstIterNext(&Iter)) != NULL)
-    {
-        CR_TEXDATA *pTexData = CrVrScrCompositorEntryTexGet(pEntry);
-        CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTexData);
-        if (pFbTex->pTobj)
-        {
-            HCR_FRAMEBUFFER_ENTRY hEntry = CrFbEntryFromCompositorEntry(pEntry);
-            rc = CrFbEntrySaveState(pFb, hEntry, pSSM);
-            AssertRCReturn(rc, rc);
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-int CrPMgrSaveState(PSSMHANDLE pSSM)
-{
-    int rc;
-    int cDisplays = 0, i;
-
-    for (i = 0; i < cr_server.screenCount; ++i)
-    {
-        if (CrPMgrFbGetEnabled(i))
-            ++cDisplays;
-    }
-
-    rc = SSMR3PutS32(pSSM, cDisplays);
-    AssertRCReturn(rc, rc);
-
-    if (!cDisplays)
-        return VINF_SUCCESS;
-
-    rc = SSMR3PutS32(pSSM, cr_server.screenCount);
-    AssertRCReturn(rc, rc);
-
-    for (i = 0; i < cr_server.screenCount; ++i)
-    {
-        CR_FRAMEBUFFER *hFb = CrPMgrFbGetEnabled(i);
-        if (hFb)
-        {
-            Assert(hFb->ScreenInfo.u32ViewIndex == i);
-            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32ViewIndex);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutS32(pSSM, hFb->ScreenInfo.i32OriginX);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutS32(pSSM, hFb->ScreenInfo.i32OriginY);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32StartOffset);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32LineSize);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32Width);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32Height);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutU16(pSSM, hFb->ScreenInfo.u16BitsPerPixel);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutU16(pSSM, hFb->ScreenInfo.u16Flags);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3PutU32(pSSM, hFb->ScreenInfo.u32StartOffset);
-            AssertRCReturn(rc, rc);
-
-            CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[hFb->ScreenInfo.u32ViewIndex];
-            rc = SSMR3PutMem(pSSM, pFbInfo->aTargetMap, sizeof (pFbInfo->aTargetMap));
-            AssertRCReturn(rc, rc);
-
-            rc = CrFbSaveState(hFb, pSSM);
-            AssertRCReturn(rc, rc);
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-int CrFbEntryLoadState(CR_FRAMEBUFFER *pFb, PSSMHANDLE pSSM, uint32_t version)
-{
-    uint32_t texture;
-    int  rc = SSMR3GetU32(pSSM, &texture);
-    AssertRCReturn(rc, rc);
-
-    uint32_t fFlags;
-    rc = SSMR3GetU32(pSSM, &fFlags);
-    AssertRCReturn(rc, rc);
-
-
-    HCR_FRAMEBUFFER_ENTRY hEntry;
-
-    rc = CrFbEntryCreateForTexId(pFb, texture, fFlags, &hEntry);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrFbEntryCreateForTexId Failed"));
-        return rc;
-    }
-
-    Assert(hEntry);
-
-    const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry = CrFbEntryGetCompositorEntry(hEntry);
-    CR_TEXDATA *pTexData = CrVrScrCompositorEntryTexGet(pEntry);
-    CR_FBTEX *pFbTex = PCR_FBTEX_FROM_TEX(pTexData);
-
-    RTPOINT Point;
-    rc = SSMR3GetS32(pSSM, &Point.x);
-    AssertRCReturn(rc, rc);
-
-    rc = SSMR3GetS32(pSSM, &Point.y);
-    AssertRCReturn(rc, rc);
-
-    uint32_t cRects;
-    rc = SSMR3GetU32(pSSM, &cRects);
-    AssertRCReturn(rc, rc);
-
-    RTRECT * pRects = NULL;
-    if (cRects)
-    {
-        pRects = (RTRECT *)crAlloc(cRects * sizeof (*pRects));
-        AssertReturn(pRects, VERR_NO_MEMORY);
-
-        rc = SSMR3GetMem(pSSM, pRects, cRects * sizeof (*pRects));
-        AssertRCReturn(rc, rc);
-    }
-
-    rc = CrFbEntryRegionsSet(pFb, hEntry, &Point, cRects, pRects, false);
-    AssertRCReturn(rc, rc);
-
-    if (pRects)
-        crFree(pRects);
-
-    CrFbEntryRelease(pFb, hEntry);
-
-    return VINF_SUCCESS;
-}
-
-int CrFbLoadState(CR_FRAMEBUFFER *pFb, PSSMHANDLE pSSM, uint32_t version)
-{
-    uint32_t u32 = 0;
-    int rc = SSMR3GetU32(pSSM, &u32);
-    AssertRCReturn(rc, rc);
-
-    if (!u32)
-        return VINF_SUCCESS;
-
-    rc = CrFbUpdateBegin(pFb);
-    AssertRCReturn(rc, rc);
-
-    for (uint32_t i = 0; i < u32; ++i)
-    {
-        rc = CrFbEntryLoadState(pFb, pSSM, version);
-        AssertRCReturn(rc, rc);
-    }
-
-    CrFbUpdateEnd(pFb);
-
-    return VINF_SUCCESS;
-}
-
-int CrPMgrLoadState(PSSMHANDLE pSSM, uint32_t version)
-{
-    int rc;
-    int cDisplays, screenCount, i;
-
-    rc = SSMR3GetS32(pSSM, &cDisplays);
-    AssertRCReturn(rc, rc);
-
-    if (!cDisplays)
-        return VINF_SUCCESS;
-
-    rc = SSMR3GetS32(pSSM, &screenCount);
-    AssertRCReturn(rc, rc);
-
-    CRASSERT(screenCount == cr_server.screenCount);
-
-    CRScreenInfo screen[CR_MAX_GUEST_MONITORS];
-
-    if (version < SHCROGL_SSM_VERSION_WITH_FB_INFO)
-    {
-        for (i = 0; i < cr_server.screenCount; ++i)
-        {
-            rc = SSMR3GetS32(pSSM, &screen[i].x);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetS32(pSSM, &screen[i].y);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU32(pSSM, &screen[i].w);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU32(pSSM, &screen[i].h);
-            AssertRCReturn(rc, rc);
-        }
-    }
-
-    for (i = 0; i < cDisplays; ++i)
-    {
-        int iScreen;
-
-        rc = SSMR3GetS32(pSSM, &iScreen);
-        AssertRCReturn(rc, rc);
-
-        CR_FRAMEBUFFER *pFb = CrPMgrFbGet(iScreen);
-        Assert(pFb);
-
-        VBVAINFOSCREEN Screen;
-
-        Screen.u32ViewIndex = iScreen;
-
-        VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aTargetMap);
-
-        memset(aTargetMap, 0, sizeof (aTargetMap));
-        ASMBitSet(aTargetMap, iScreen);
-
-        if (version < SHCROGL_SSM_VERSION_WITH_FB_INFO)
-        {
-            memset(&Screen, 0, sizeof (Screen));
-            Screen.u32LineSize = 4 * screen[iScreen].w;
-            Screen.u32Width = screen[iScreen].w;
-            Screen.u32Height = screen[iScreen].h;
-            Screen.u16BitsPerPixel = 4;
-            Screen.u16Flags = VBVA_SCREEN_F_ACTIVE;
-        }
-        else
-        {
-            rc = SSMR3GetS32(pSSM, &Screen.i32OriginX);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetS32(pSSM, &Screen.i32OriginY);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU32(pSSM, &Screen.u32StartOffset);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU32(pSSM, &Screen.u32LineSize);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU32(pSSM, &Screen.u32Width);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU32(pSSM, &Screen.u32Height);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU16(pSSM, &Screen.u16BitsPerPixel);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU16(pSSM, &Screen.u16Flags);
-            AssertRCReturn(rc, rc);
-
-            rc = SSMR3GetU32(pSSM, &Screen.u32StartOffset);
-            AssertRCReturn(rc, rc);
-            if (Screen.u32StartOffset == 0xffffffff)
-            {
-                WARN(("not expected offVram"));
-                Screen.u32StartOffset = 0;
-            }
-
-            if (version >= SHCROGL_SSM_VERSION_WITH_SCREEN_MAP_REORDERED)
-            {
-                rc = SSMR3GetMem(pSSM, aTargetMap, sizeof (aTargetMap));
-                AssertRCReturn(rc, rc);
-            }
-
-            if (version == SHCROGL_SSM_VERSION_WITH_SCREEN_MAP)
-            {
-                VBOXCMDVBVA_SCREENMAP_DECL(uint32_t, aEmptyTargetMap);
-
-                memset(aEmptyTargetMap, 0, sizeof (aEmptyTargetMap));
-
-                rc = CrPMgrResize(&Screen, cr_server.fCrCmdEnabled ? NULL : CrFbGetVRAM(pFb), aEmptyTargetMap);
-                AssertRCReturn(rc, rc);
-
-                rc = CrFbLoadState(pFb, pSSM, version);
-                AssertRCReturn(rc, rc);
-
-                rc = SSMR3GetMem(pSSM, aTargetMap, sizeof (aTargetMap));
-                AssertRCReturn(rc, rc);
-            }
-        }
-
-        rc = CrPMgrResize(&Screen, cr_server.fCrCmdEnabled ? NULL : CrFbGetVRAM(pFb), aTargetMap);
-        AssertRCReturn(rc, rc);
-
-        if (version >= SHCROGL_SSM_VERSION_WITH_FB_INFO && version != SHCROGL_SSM_VERSION_WITH_SCREEN_MAP)
-        {
-            rc = CrFbLoadState(pFb, pSSM, version);
-            AssertRCReturn(rc, rc);
-        }
-    }
-
-    return VINF_SUCCESS;
-}
-
-
-void SERVER_DISPATCH_APIENTRY
-crServerDispatchVBoxTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, const GLint *pRects)
-{
-    uint32_t idFb = CR_PRESENT_GET_SCREEN(cfg);
-    if (idFb >= CR_MAX_GUEST_MONITORS)
-    {
-        WARN(("Invalid guest screen"));
-        return;
-    }
-
-    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(idFb);
-    if (!hFb)
-    {
-        WARN(("request to present on disabled framebuffer, ignore"));
-        return;
-    }
-
-    HCR_FRAMEBUFFER_ENTRY hEntry;
-    int rc;
-    if (texture)
-    {
-        rc = CrFbEntryCreateForTexId(hFb, texture, (cfg & CR_PRESENT_FLAG_TEX_NONINVERT_YCOORD) ? 0 : CRBLT_F_INVERT_SRC_YCOORDS, &hEntry);
-        if (!RT_SUCCESS(rc))
-        {
-            LOG(("CrFbEntryCreateForTexId Failed"));
-            return;
-        }
-
-        Assert(hEntry);
-
-#if 0
-        if (!(cfg & CR_PRESENT_FLAG_CLEAR_RECTS))
-        {
-            CR_SERVER_DUMP_TEXPRESENT(&pEntry->CEntry.Tex);
-        }
-#endif
-    }
-    else
-        hEntry = NULL;
-
-    rc = CrFbUpdateBegin(hFb);
-    if (RT_SUCCESS(rc))
-    {
-        if (!(cfg & CR_PRESENT_FLAG_CLEAR_RECTS))
-        {
-            RTPOINT Point = {xPos, yPos};
-            rc = CrFbEntryRegionsAdd(hFb, hEntry, &Point, (uint32_t)cRects, (const RTRECT*)pRects, false);
-        }
-        else
-        {
-            CrFbRegionsClear(hFb);
-        }
-
-        CrFbUpdateEnd(hFb);
-    }
-    else
-    {
-        WARN(("CrFbUpdateBegin Failed"));
-    }
-
-    if (hEntry)
-        CrFbEntryRelease(hFb, hEntry);
-}
-
-DECLINLINE(void) crVBoxPRectUnpack(const VBOXCMDVBVA_RECT *pVbvaRect, RTRECT *pRect)
-{
-    pRect->xLeft = pVbvaRect->xLeft;
-    pRect->yTop = pVbvaRect->yTop;
-    pRect->xRight = pVbvaRect->xRight;
-    pRect->yBottom = pVbvaRect->yBottom;
-}
-
-DECLINLINE(void) crVBoxPRectUnpacks(const VBOXCMDVBVA_RECT *paVbvaRects, RTRECT *paRects, uint32_t cRects)
-{
-    uint32_t i = 0;
-    for (; i < cRects; ++i)
-    {
-        crVBoxPRectUnpack(&paVbvaRects[i], &paRects[i]);
-    }
-}
-
-static RTRECT * crVBoxServerCrCmdBltRecsUnpack(const VBOXCMDVBVA_RECT *pPRects, uint32_t cRects)
-{
-    if (g_CrPresenter.cbTmpBuf < cRects * sizeof (RTRECT))
-    {
-        if (g_CrPresenter.pvTmpBuf)
-            RTMemFree(g_CrPresenter.pvTmpBuf);
-
-        g_CrPresenter.cbTmpBuf = (cRects + 10) * sizeof (RTRECT);
-        g_CrPresenter.pvTmpBuf = RTMemAlloc(g_CrPresenter.cbTmpBuf);
-        if (!g_CrPresenter.pvTmpBuf)
-        {
-            WARN(("RTMemAlloc failed!"));
-            g_CrPresenter.cbTmpBuf = 0;
-            return NULL;
-        }
-    }
-
-    RTRECT *pRects = (RTRECT *)g_CrPresenter.pvTmpBuf;
-    crVBoxPRectUnpacks(pPRects, pRects, cRects);
-
-    return pRects;
-}
-
-static void crPMgrPrimaryUpdateScreen(HCR_FRAMEBUFFER hFb, uint32_t idScreen, uint32_t cRects, const RTRECT *pRects)
-{
-    const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
-
-    bool fDirtyEmpty = true;
-    RTRECT dirtyRect = {0};
-    cr_server.CrCmdClientInfo.pfnCltScrUpdateBegin(cr_server.CrCmdClientInfo.hCltScr, idScreen);
-
-    VBVACMDHDR hdr;
-    for (uint32_t i = 0; i < cRects; ++i)
-    {
-        hdr.x = pRects[i].xLeft;
-        hdr.y = pRects[i].yTop;
-        hdr.w = hdr.x + pRects[i].xRight;
-        hdr.h = hdr.y + pRects[i].yBottom;
-
-        cr_server.CrCmdClientInfo.pfnCltScrUpdateProcess(cr_server.CrCmdClientInfo.hCltScr, idScreen, &hdr, sizeof (hdr));
-
-        if (fDirtyEmpty)
-        {
-            /* This is the first rectangle to be added. */
-            dirtyRect.xLeft   = pRects[i].xLeft;
-            dirtyRect.yTop    = pRects[i].yTop;
-            dirtyRect.xRight  = pRects[i].xRight;
-            dirtyRect.yBottom = pRects[i].yBottom;
-            fDirtyEmpty       = false;
-        }
-        else
-        {
-            /* Adjust region coordinates. */
-            if (dirtyRect.xLeft > pRects[i].xLeft)
-            {
-                dirtyRect.xLeft = pRects[i].xLeft;
-            }
-
-            if (dirtyRect.yTop > pRects[i].yTop)
-            {
-                dirtyRect.yTop = pRects[i].yTop;
-            }
-
-            if (dirtyRect.xRight < pRects[i].xRight)
-            {
-                dirtyRect.xRight = pRects[i].xRight;
-            }
-
-            if (dirtyRect.yBottom < pRects[i].yBottom)
-            {
-                dirtyRect.yBottom = pRects[i].yBottom;
-            }
-        }
-    }
-
-    if (dirtyRect.xRight - dirtyRect.xLeft)
-    {
-        cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, idScreen, pScreen->i32OriginX + dirtyRect.xLeft, pScreen->i32OriginY + dirtyRect.yTop,
-                                           dirtyRect.xRight - dirtyRect.xLeft, dirtyRect.yBottom - dirtyRect.yTop);
-    }
-    else
-    {
-        cr_server.CrCmdClientInfo.pfnCltScrUpdateEnd(cr_server.CrCmdClientInfo.hCltScr, idScreen, 0, 0, 0, 0);
-    }
-
-}
-
-static void crPMgrPrimaryUpdate(HCR_FRAMEBUFFER hFb, uint32_t cRects, const RTRECT *pRects)
-{
-    if (!cRects)
-        return;
-
-    const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
-
-    uint32_t idFb = pScreen->u32ViewIndex;
-    CR_FB_INFO *pFbInfo = &g_CrPresenter.aFbInfos[idFb];
-
-    for (int i = ASMBitFirstSet(pFbInfo->aTargetMap, cr_server.screenCount);
-            i >= 0;
-            i = ASMBitNextSet(pFbInfo->aTargetMap, cr_server.screenCount, i))
-    {
-        crPMgrPrimaryUpdateScreen(hFb, i, cRects, pRects);
-    }
-}
-
-static int8_t crVBoxServerCrCmdBltPrimaryVramGenericProcess(uint32_t u32PrimaryID, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects, bool fToPrimary)
-{
-    CR_BLITTER_IMG Img;
-    int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img);
-    if (i8Result)
-    {
-        WARN(("invalid param"));
-        return -1;
-    }
-
-    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID);
-    if (!hFb)
-    {
-        WARN(("request to present on disabled framebuffer"));
-        return -1;
-    }
-
-    if (!fToPrimary)
-    {
-        int rc = CrFbBltGetContents(hFb, pPos, cRects, pRects, &Img);
-        if (!RT_SUCCESS(rc))
-        {
-            WARN(("CrFbBltGetContents failed %d", rc));
-            return -1;
-        }
-
-        return 0;
-    }
-
-    int rc = CrFbBltPutContentsNe(hFb, pPos, cRects, pRects, &Img);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrFbBltPutContentsNe failed %d", rc));
-        return -1;
-    }
-
-    return 0;
-}
-
-static int8_t crVBoxServerCrCmdBltPrimaryProcess(const VBOXCMDVBVA_BLT_PRIMARY *pCmd, uint32_t cbCmd)
-{
-    uint32_t u32PrimaryID = (uint32_t)pCmd->Hdr.Hdr.u.u8PrimaryID;
-    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID);
-    if (!hFb)
-    {
-        WARN(("request to present on disabled framebuffer, ignore"));
-        return 0;
-    }
-
-    uint32_t cRects;
-    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
-    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects)) % sizeof (VBOXCMDVBVA_RECT))
-    {
-        WARN(("invalid argument size"));
-        return -1;
-    }
-
-    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_PRIMARY, aRects)) / sizeof (VBOXCMDVBVA_RECT);
-
-    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
-    if (!pRects)
-    {
-        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
-        return -1;
-    }
-
-    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
-
-    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID)
-    {
-        uint32_t texId = pCmd->alloc.u.id;
-        if (!texId)
-        {
-            WARN(("texId is NULL!\n"));
-            return -1;
-        }
-
-        if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
-        {
-            WARN(("blit from primary to texture not implemented"));
-            return -1;
-        }
-
-        crServerDispatchVBoxTexPresent(texId, u32PrimaryID, pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y, cRects, (const GLint*)pRects);
-
-        return 0;
-    }
-    else
-    {
-        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
-        uint32_t width = pScreen->u32Width, height = pScreen->u32Height;
-        VBOXCMDVBVAOFFSET offVRAM = pCmd->alloc.u.offVRAM;
-
-        bool fToPrymary = !(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2);
-        RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
-        int8_t i8Result = crVBoxServerCrCmdBltPrimaryVramGenericProcess(u32PrimaryID, offVRAM, width, height, &Pos, cRects, pRects, fToPrymary);
-        if (i8Result < 0)
-        {
-            WARN(("crVBoxServerCrCmdBltPrimaryVramGenericProcess failed"));
-            return i8Result;
-        }
-
-        if (!fToPrymary)
-            return 0;
-    }
-
-    crPMgrPrimaryUpdate(hFb, cRects, pRects);
-
-    return 0;
-}
-
-static int8_t crVBoxServerCrCmdBltIdToVramMem(uint32_t hostId, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
-{
-    CR_TEXDATA* pTex = CrFbTexDataAcquire(hostId);
-    if (!pTex)
-    {
-        WARN(("pTex failed for %d", hostId));
-        return -1;
-    }
-
-    const VBOXVR_TEXTURE *pVrTex = CrTdTexGet(pTex);
-    if (!width)
-    {
-        width = pVrTex->width;
-        height = pVrTex->height;
-    }
-
-    CR_BLITTER_IMG Img;
-    int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img);
-    if (i8Result)
-    {
-        WARN(("invalid param"));
-        return -1;
-    }
-
-    int rc = CrTdBltEnter(pTex);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrTdBltEnter failed %d", rc));
-        return -1;
-    }
-
-    rc = crFbTexDataGetContents(pTex, pPos, cRects, pRects, &Img);
-
-    CrTdBltLeave(pTex);
-
-    CrTdRelease(pTex);
-
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("crFbTexDataGetContents failed %d", rc));
-        return -1;
-    }
-
-    return 0;
-}
-
-static int8_t crVBoxServerCrCmdBltIdToVram(uint32_t hostId, VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
-{
-    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabledByVramStart(offVRAM);
-    if (hFb)
-    {
-        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hFb);
-        Assert(!width || pScreen->u32Width == width);
-        Assert(!height || pScreen->u32Height == height);
-
-        crServerDispatchVBoxTexPresent(hostId, pScreen->u32ViewIndex, pPos->x, pPos->y, cRects, (const GLint*)pRects);
-        return 0;
-    }
-
-    return crVBoxServerCrCmdBltIdToVramMem(hostId, offVRAM, width, height, pPos, cRects, pRects);
-}
-
-static int8_t crVBoxServerCrCmdBltVramToVramMem(VBOXCMDVBVAOFFSET offSrcVRAM, uint32_t srcWidth, uint32_t srcHeight, VBOXCMDVBVAOFFSET offDstVRAM, uint32_t dstWidth, uint32_t dstHeight, const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
-{
-    CR_BLITTER_IMG srcImg, dstImg;
-    int8_t i8Result = crFbImgFromDimOffVramBGRA(offSrcVRAM, srcWidth, srcHeight, &srcImg);
-    if (i8Result)
-    {
-        WARN(("invalid param"));
-        return -1;
-    }
-
-    i8Result = crFbImgFromDimOffVramBGRA(offDstVRAM, dstWidth, dstHeight, &dstImg);
-    if (i8Result)
-    {
-        WARN(("invalid param"));
-        return -1;
-    }
-
-    CrMBltImg(&srcImg, pPos, cRects, pRects, &dstImg);
-
-    return 0;
-}
-
-static int8_t crVBoxServerCrCmdBltVramToVram(VBOXCMDVBVAOFFSET offSrcVRAM, uint32_t srcWidth, uint32_t srcHeight,
-        VBOXCMDVBVAOFFSET offDstVRAM, uint32_t dstWidth, uint32_t dstHeight,
-        const RTPOINT *pPos, uint32_t cRects, const RTRECT *pRects)
-{
-    HCR_FRAMEBUFFER hSrcFb = CrPMgrFbGetEnabledByVramStart(offSrcVRAM);
-    HCR_FRAMEBUFFER hDstFb = CrPMgrFbGetEnabledByVramStart(offDstVRAM);
-
-    if (hDstFb)
-    {
-        if (hSrcFb)
-        {
-            LOG(("blit from one framebuffer, wow"));
-
-            int rc = CrFbUpdateBegin(hSrcFb);
-            if (RT_SUCCESS(rc))
-            {
-                CrFbRegionsClear(hSrcFb);
-
-                CrFbUpdateEnd(hSrcFb);
-            }
-            else
-                WARN(("CrFbUpdateBegin failed %d", rc));
-        }
-
-        CR_BLITTER_IMG Img;
-        int8_t i8Result = crFbImgFromDimOffVramBGRA(offSrcVRAM, srcWidth, srcHeight, &Img);
-        if (i8Result)
-        {
-            WARN(("invalid param"));
-            return -1;
-        }
-
-        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hDstFb);
-        if (pScreen->u32Width == dstWidth && pScreen->u32Height == dstHeight)
-        {
-            int rc = CrFbBltPutContentsNe(hDstFb, pPos, cRects, pRects, &Img);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("CrFbBltPutContentsNe failed %d", rc));
-                return -1;
-            }
-        }
-        else
-        {
-            int rc = CrFbUpdateBegin(hDstFb);
-            if (RT_SUCCESS(rc))
-            {
-                CrFbRegionsClear(hDstFb);
-
-                CrFbUpdateEnd(hDstFb);
-            }
-            else
-                WARN(("CrFbUpdateBegin failed %d", rc));
-
-            rc = crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("crVBoxServerCrCmdBltVramToVramMem failed, %d", rc));
-                return -1;
-            }
-        }
-
-        crPMgrPrimaryUpdate(hDstFb, cRects, pRects);
-
-        return 0;
-    }
-    else if (hSrcFb)
-    {
-        CR_BLITTER_IMG Img;
-        int8_t i8Result = crFbImgFromDimOffVramBGRA(offDstVRAM, dstWidth, dstHeight, &Img);
-        if (i8Result)
-        {
-            WARN(("invalid param"));
-            return -1;
-        }
-
-        const VBVAINFOSCREEN *pScreen = CrFbGetScreenInfo(hSrcFb);
-        if (pScreen->u32Width == srcWidth && pScreen->u32Height == srcHeight)
-        {
-            int rc = CrFbBltGetContents(hSrcFb, pPos, cRects, pRects, &Img);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("CrFbBltGetContents failed %d", rc));
-                return -1;
-            }
-        }
-        else
-        {
-            int rc = CrFbUpdateBegin(hSrcFb);
-            if (RT_SUCCESS(rc))
-            {
-                CrFbRegionsClear(hSrcFb);
-
-                CrFbUpdateEnd(hSrcFb);
-            }
-            else
-                WARN(("CrFbUpdateBegin failed %d", rc));
-
-            rc = crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
-            if (RT_FAILURE(rc))
-            {
-                WARN(("crVBoxServerCrCmdBltVramToVramMem failed, %d", rc));
-                return -1;
-            }
-        }
-
-        return 0;
-    }
-
-    return crVBoxServerCrCmdBltVramToVramMem(offSrcVRAM, srcWidth, srcHeight, offDstVRAM, dstWidth, dstHeight, pPos, cRects, pRects);
-}
-
-
-static int8_t crVBoxServerCrCmdBltOffIdProcess(const VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID *pCmd, uint32_t cbCmd)
-{
-    uint32_t cRects;
-    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
-    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) % sizeof (VBOXCMDVBVA_RECT))
-    {
-        WARN(("invalid argument size"));
-        return -1;
-    }
-
-    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID, aRects)) / sizeof (VBOXCMDVBVA_RECT);
-
-    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
-    if (!pRects)
-    {
-        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
-        return -1;
-    }
-
-    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
-    uint32_t hostId = pCmd->id;
-
-    Assert(u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID);
-
-    if (!hostId)
-    {
-        WARN(("zero host id"));
-        return -1;
-    }
-
-    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
-    {
-        WARN(("blit from texture to texture not implemented"));
-        return -1;
-    }
-
-    if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
-    {
-        WARN(("blit to texture not implemented"));
-        return -1;
-    }
-
-    VBOXCMDVBVAOFFSET offVRAM = pCmd->alloc.u.offVRAM;
-
-    RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
-    return crVBoxServerCrCmdBltIdToVram(hostId, offVRAM, 0, 0, &Pos, cRects, pRects);
-}
-
-static int8_t crVBoxServerCrCmdBltSameDimOrId(const VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8 *pCmd, uint32_t cbCmd)
-{
-    uint32_t cRects;
-    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
-    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8, aRects)) % sizeof (VBOXCMDVBVA_RECT))
-    {
-        WARN(("invalid argument size"));
-        return -1;
-    }
-
-    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
-
-    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
-    if (!pRects)
-    {
-        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
-        return -1;
-    }
-
-    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
-    VBOXCMDVBVAOFFSET offVRAM = pCmd->alloc1.Info.u.offVRAM;
-    uint32_t width = pCmd->alloc1.u16Width;
-    uint32_t height = pCmd->alloc1.u16Height;
-    RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
-
-    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID)
-    {
-        uint32_t hostId = pCmd->info2.u.id;
-
-        if (!hostId)
-        {
-            WARN(("zero host id"));
-            return -1;
-        }
-
-        if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
-        {
-            WARN(("blit from texture to texture not implemented"));
-            return -1;
-        }
-
-        if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
-        {
-            WARN(("blit to texture not implemented"));
-            return -1;
-        }
-
-        return crVBoxServerCrCmdBltIdToVram(hostId, offVRAM, width, height, &Pos, cRects, pRects);
-    }
-
-    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
-    {
-        if (!(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2))
-        {
-            WARN(("blit to texture not implemented"));
-            return -1;
-        }
-
-        return crVBoxServerCrCmdBltIdToVram(pCmd->alloc1.Info.u.id, pCmd->info2.u.offVRAM, width, height, &Pos, cRects, pRects);
-    }
-
-    if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
-        crVBoxServerCrCmdBltVramToVram(offVRAM, width, height, pCmd->info2.u.offVRAM, width, height, &Pos, cRects, pRects);
-    else
-        crVBoxServerCrCmdBltVramToVram(pCmd->info2.u.offVRAM, width, height, offVRAM, width, height, &Pos, cRects, pRects);
-
-    return 0;
-}
-
-static int8_t crVBoxServerCrCmdBltGenericBGRAProcess(const VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8 *pCmd, uint32_t cbCmd)
-{
-    uint32_t cRects;
-    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
-    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8, aRects)) % sizeof (VBOXCMDVBVA_RECT))
-    {
-        WARN(("invalid argument size"));
-        return -1;
-    }
-
-    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
-
-    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
-    if (!pRects)
-    {
-        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
-        return -1;
-    }
-
-    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
-    RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
-
-    if (u8Flags & VBOXCMDVBVA_OPF_OPERAND2_ISID)
-    {
-        if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
-        {
-            WARN(("blit from texture to texture not implemented"));
-            return -1;
-        }
-
-        if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
-        {
-            WARN(("blit to texture not implemented"));
-            return -1;
-        }
-
-        return crVBoxServerCrCmdBltIdToVram(pCmd->alloc2.Info.u.id, pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, &Pos, cRects, pRects);
-    }
-    else
-    {
-        if (u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
-        {
-            if (!(u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2))
-            {
-                WARN(("blit to texture not implemented"));
-                return -1;
-            }
-
-            RTPOINT Pos = {pCmd->Hdr.Pos.x, pCmd->Hdr.Pos.y};
-            return crVBoxServerCrCmdBltIdToVram(pCmd->alloc1.Info.u.id, pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, &Pos, cRects, pRects);
-        }
-
-        if (u8Flags & VBOXCMDVBVA_OPF_BLT_DIR_IN_2)
-            crVBoxServerCrCmdBltVramToVram(pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, &Pos, cRects, pRects);
-        else
-            crVBoxServerCrCmdBltVramToVram(pCmd->alloc2.Info.u.offVRAM, pCmd->alloc2.u16Width, pCmd->alloc2.u16Height, pCmd->alloc1.Info.u.offVRAM, pCmd->alloc1.u16Width, pCmd->alloc1.u16Height, &Pos, cRects, pRects);
-
-        return 0;
-    }
-}
-
-static int8_t crVBoxServerCrCmdClrFillPrimaryGenericProcess(uint32_t u32PrimaryID, const RTRECT *pRects, uint32_t cRects, uint32_t u32Color)
-{
-    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(u32PrimaryID);
-    if (!hFb)
-    {
-        WARN(("request to present on disabled framebuffer, ignore"));
-        return 0;
-    }
-
-    int rc = CrFbClrFillNe(hFb, cRects, pRects, u32Color);
-    if (!RT_SUCCESS(rc))
-    {
-        WARN(("CrFbClrFillNe failed %d", rc));
-        return -1;
-    }
-
-    return 0;
-}
-
-static int8_t crVBoxServerCrCmdClrFillVramGenericProcess(VBOXCMDVBVAOFFSET offVRAM, uint32_t width, uint32_t height, const RTRECT *pRects, uint32_t cRects, uint32_t u32Color)
-{
-    CR_BLITTER_IMG Img;
-    int8_t i8Result = crFbImgFromDimOffVramBGRA(offVRAM, width, height, &Img);
-    if (i8Result)
-    {
-        WARN(("invalid param"));
-        return -1;
-    }
-
-    CrMClrFillImg(&Img, cRects, pRects, u32Color);
-
-    return 0;
-}
-
-static int8_t crVBoxServerCrCmdClrFillGenericBGRAProcess(const VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8 *pCmd, uint32_t cbCmd)
-{
-    uint32_t cRects;
-    const VBOXCMDVBVA_RECT *pPRects = pCmd->aRects;
-    if ((cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects)) % sizeof (VBOXCMDVBVA_RECT))
-    {
-        WARN(("invalid argument size"));
-        return -1;
-    }
-
-    cRects = (cbCmd - RT_OFFSETOF(VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8, aRects)) / sizeof (VBOXCMDVBVA_RECT);
-
-    RTRECT *pRects = crVBoxServerCrCmdBltRecsUnpack(pPRects, cRects);
-    if (!pRects)
-    {
-        WARN(("crVBoxServerCrCmdBltRecsUnpack failed"));
-        return -1;
-    }
-
-//    uint8_t u8Flags = pCmd->Hdr.Hdr.u8Flags;
-    int8_t i8Result = crVBoxServerCrCmdClrFillVramGenericProcess(pCmd->dst.Info.u.offVRAM, pCmd->dst.u16Width, pCmd->dst.u16Height, pRects, cRects, pCmd->Hdr.u32Color);
-    if (i8Result < 0)
-    {
-        WARN(("crVBoxServerCrCmdClrFillVramGenericProcess failed"));
-        return i8Result;
-    }
-
-    return 0;
-}
-
-int8_t crVBoxServerCrCmdClrFillProcess(const VBOXCMDVBVA_CLRFILL_HDR *pCmd, uint32_t cbCmd)
-{
-    uint8_t u8Flags = pCmd->Hdr.u8Flags;
-    uint8_t u8Cmd = (VBOXCMDVBVA_OPF_CLRFILL_TYPE_MASK & u8Flags);
-
-    switch (u8Cmd)
-    {
-        case VBOXCMDVBVA_OPF_CLRFILL_TYPE_GENERIC_A8R8G8B8:
-        {
-            if (cbCmd < sizeof (VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8))
-            {
-                WARN(("VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8: invalid command size"));
-                return -1;
-            }
-
-            return crVBoxServerCrCmdClrFillGenericBGRAProcess((const VBOXCMDVBVA_CLRFILL_GENERIC_A8R8G8B8*)pCmd, cbCmd);
-        }
-        default:
-            WARN(("unsupported command"));
-            return -1;
-    }
-
-}
-
-int8_t crVBoxServerCrCmdBltProcess(const VBOXCMDVBVA_BLT_HDR *pCmd, uint32_t cbCmd)
-{
-    uint8_t u8Flags = pCmd->Hdr.u8Flags;
-    uint8_t u8Cmd = (VBOXCMDVBVA_OPF_BLT_TYPE_MASK & u8Flags);
-
-    switch (u8Cmd)
-    {
-        case VBOXCMDVBVA_OPF_BLT_TYPE_SAMEDIM_A8R8G8B8:
-        {
-            if (cbCmd < sizeof (VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8))
-            {
-                WARN(("VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8: invalid command size"));
-                return -1;
-            }
-
-            return crVBoxServerCrCmdBltSameDimOrId((const VBOXCMDVBVA_BLT_SAMEDIM_A8R8G8B8 *)pCmd, cbCmd);
-        }
-        case VBOXCMDVBVA_OPF_BLT_TYPE_OFFPRIMSZFMT_OR_ID:
-        {
-            if (cbCmd < sizeof (VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID))
-            {
-                WARN(("VBOXCMDVBVA_OPF_BLT_TYPE_OFFPRIMSZFMT_OR_ID: invalid command size"));
-                return -1;
-            }
-
-            return crVBoxServerCrCmdBltOffIdProcess((const VBOXCMDVBVA_BLT_OFFPRIMSZFMT_OR_ID *)pCmd, cbCmd);
-        }
-        case VBOXCMDVBVA_OPF_BLT_TYPE_GENERIC_A8R8G8B8:
-        {
-            if (cbCmd < sizeof (VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8))
-            {
-                WARN(("VBOXCMDVBVA_OPF_BLT_TYPE_GENERIC_A8R8G8B8: invalid command size"));
-                return -1;
-            }
-
-            return crVBoxServerCrCmdBltGenericBGRAProcess((const VBOXCMDVBVA_BLT_GENERIC_A8R8G8B8 *)pCmd, cbCmd);
-        }
-        default:
-            WARN(("unsupported command"));
-            return -1;
-    }
-}
-
-int8_t crVBoxServerCrCmdFlipProcess(const VBOXCMDVBVA_FLIP *pFlip)
-{
-    uint32_t hostId;
-    if (pFlip->Hdr.u8Flags & VBOXCMDVBVA_OPF_OPERAND1_ISID)
-    {
-        hostId = pFlip->src.u.id;
-        if (!hostId)
-        {
-            WARN(("hostId is NULL"));
-            return -1;
-        }
-    }
-    else
-    {
-        WARN(("VBOXCMDVBVA_OPF_ALLOC_SRCID not specified"));
-        hostId = 0;
-    }
-
-    uint32_t idFb = pFlip->Hdr.u.u8PrimaryID;
-    HCR_FRAMEBUFFER hFb = CrPMgrFbGetEnabled(idFb);
-    if (!hFb)
-    {
-        WARN(("request to present on disabled framebuffer, ignore"));
-        return 0;
-    }
-
-    const RTRECT *pRect = CrVrScrCompositorRectGet(&hFb->Compositor);
-    crServerDispatchVBoxTexPresent(hostId, idFb, 0, 0, 1, (const GLint*)pRect);
-    return 0;
-}
-
-typedef struct CRSERVER_CLIENT_CALLOUT
-{
-    VBOXCRCMDCTL_CALLOUT_LISTENTRY Entry;
-    PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb;
-    void*pvCb;
-} CRSERVER_CLIENT_CALLOUT;
-
-static DECLCALLBACK(void) crServerClientCalloutCb(struct VBOXCRCMDCTL_CALLOUT_LISTENTRY *pEntry)
-{
-    CRSERVER_CLIENT_CALLOUT *pCallout = RT_FROM_MEMBER(pEntry, CRSERVER_CLIENT_CALLOUT, Entry);
-    pCallout->pfnCb(pCallout->pvCb);
-    int rc = RTSemEventSignal(cr_server.hCalloutCompletionEvent);
-    if (RT_FAILURE(rc))
-        WARN(("RTSemEventSignal failed rc %d", rc));
-}
-
-static DECLCALLBACK(void) crServerClientCallout(PFNVCRSERVER_CLIENT_CALLOUT_CB pfnCb, void*pvCb)
-{
-    Assert(cr_server.pCurrentCalloutCtl);
-    CRSERVER_CLIENT_CALLOUT Callout;
-    Callout.pfnCb = pfnCb;
-    Callout.pvCb = pvCb;
-    cr_server.ClientInfo.pfnCallout(cr_server.ClientInfo.hClient, cr_server.pCurrentCalloutCtl, &Callout.Entry, crServerClientCalloutCb);
-
-    int rc = RTSemEventWait(cr_server.hCalloutCompletionEvent, RT_INDEFINITE_WAIT);
-    if (RT_FAILURE(rc))
-        WARN(("RTSemEventWait failed %d", rc));
-}
-
-
-DECLEXPORT(void) crVBoxServerCalloutEnable(VBOXCRCMDCTL *pCtl)
-{
-#if 1 //def CR_SERVER_WITH_CLIENT_CALLOUTS
-    Assert(!cr_server.pCurrentCalloutCtl);
-    cr_server.pCurrentCalloutCtl = pCtl;
-
-    cr_server.head_spu->dispatch_table.ChromiumParametervCR(GL_HH_SET_CLIENT_CALLOUT, 0, 0, (void*)crServerClientCallout);
-#endif
-}
-
-extern DECLEXPORT(void) crVBoxServerCalloutDisable()
-{
-#if 1 //def CR_SERVER_WITH_CLIENT_CALLOUTS
-    Assert(cr_server.pCurrentCalloutCtl);
-
-    cr_server.head_spu->dispatch_table.ChromiumParametervCR(GL_HH_SET_CLIENT_CALLOUT, 0, 0, NULL);
-
-    cr_server.pCurrentCalloutCtl = NULL;
-#endif
-}
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
index 6477afb..bcaa7cf 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
@@ -18,6 +18,7 @@ GetPixelMapfv
 GetPixelMapuiv 
 GetPixelMapusv
 GetPointerv
+GenLists
 Writeback
 Viewport
 LoadMatrixf
diff --git a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_texture.c b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_texture.c
index 8037ac6..2042567 100644
--- a/src/VBox/HostServices/SharedOpenGL/crserverlib/server_texture.c
+++ b/src/VBox/HostServices/SharedOpenGL/crserverlib/server_texture.c
@@ -20,6 +20,7 @@
 #include "cr_error.h" 
 #include "server_dispatch.h"
 #include "server.h"
+#include "cr_mem.h"
 
 #define CR_NOTHING()
 
@@ -189,3 +190,98 @@ void SERVER_DISPATCH_APIENTRY crServerDispatchGetTexEnviv( GLenum target, GLenum
 
     crServerReturnValue( &(local_params[0]), crStateHlpComponentsCount(pname)*sizeof (GLint) );
 }
+
+void SERVER_DISPATCH_APIENTRY crServerDispatchBindTexture( GLenum target, GLuint texture )
+{
+    crStateBindTexture( target, texture );
+    cr_server.head_spu->dispatch_table.BindTexture(target, crStateGetTextureHWID(texture));
+}
+
+
+void SERVER_DISPATCH_APIENTRY crServerDispatchDeleteTextures( GLsizei n, const GLuint *textures)
+{
+    GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint));
+    GLint i;
+
+    if (!newTextures)
+    {
+        crError("crServerDispatchDeleteTextures: out of memory");
+        return;
+    }
+
+    for (i = 0; i < n; i++)
+    {
+        newTextures[i] = crStateGetTextureHWID(textures[i]);
+    }
+
+//    for (i = 0; i < n; ++i)
+//    {
+//        crDebug("DeleteTexture: %d, pid %d, ctx %d", textures[i], (uint32_t)cr_server.curClient->pid, cr_server.currentCtxInfo->pContext->id);
+//    }
+
+
+    crStateDeleteTextures(n, textures);
+    cr_server.head_spu->dispatch_table.DeleteTextures(n, newTextures);
+    crFree(newTextures);
+}
+
+
+void SERVER_DISPATCH_APIENTRY crServerDispatchPrioritizeTextures( GLsizei n, const GLuint * textures, const GLclampf * priorities )
+{
+    GLuint *newTextures = (GLuint *) crAlloc(n * sizeof(GLuint));
+    GLint i;
+
+    if (!newTextures)
+    {
+        crError("crServerDispatchDeleteTextures: out of memory");
+        return;
+    }
+
+    crStatePrioritizeTextures(n, textures, priorities);
+
+    for (i = 0; i < n; i++)
+    {
+        newTextures[i] = crStateGetTextureHWID(textures[i]);
+    }
+
+    cr_server.head_spu->dispatch_table.PrioritizeTextures(n, newTextures, priorities);
+    crFree(newTextures);
+}
+
+
+/*@todo will fail for textures loaded from snapshot */
+GLboolean SERVER_DISPATCH_APIENTRY crServerDispatchIsTexture( GLuint texture )
+{
+    GLboolean retval;
+    retval = cr_server.head_spu->dispatch_table.IsTexture(crStateGetTextureHWID(texture));
+    crServerReturnValue( &retval, sizeof(retval) );
+    return retval; /* WILL PROBABLY BE IGNORED */
+}
+
+
+GLboolean SERVER_DISPATCH_APIENTRY
+crServerDispatchAreTexturesResident(GLsizei n, const GLuint *textures,
+                                    GLboolean *residences)
+{
+    GLboolean retval;
+    GLsizei i;
+    GLboolean *res = (GLboolean *) crAlloc(n * sizeof(GLboolean));
+    GLuint *textures2 = (GLuint *) crAlloc(n * sizeof(GLuint));
+
+    (void) residences;
+
+    for (i = 0; i < n; i++)
+    {
+        textures2[i] = crStateGetTextureHWID(textures[i]);
+    }
+    retval = cr_server.head_spu->dispatch_table.AreTexturesResident(n, textures2, res);
+
+    crFree(textures2);
+
+    crServerReturnValue(res, n * sizeof(GLboolean));
+
+    crFree(res);
+
+    return retval; /* WILL PROBABLY BE IGNORED */
+}
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/HostServices/SharedOpenGL/dlm/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/HostServices/SharedOpenGL/dlm/Makefile.kup
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm.c b/src/VBox/HostServices/SharedOpenGL/dlm/dlm.c
new file mode 100644
index 0000000..233f548
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm.c
@@ -0,0 +1,739 @@
+/* $Id: dlm.c $ */
+
+#include <float.h>
+#include "cr_dlm.h"
+#include "cr_mem.h"
+#include "dlm.h"
+
+/**
+ * \mainpage Dlm 
+ *
+ * \section DlmIntroduction Introduction
+ *
+ * Chromium consists of all the top-level files in the cr
+ * directory.  The dlm module basically takes care of API dispatch,
+ * and OpenGL state management.
+ *
+ */
+
+/**
+ * Module globals: the current DLM state, bound either to each thread, or
+ * to a global.
+ */
+#ifdef CHROMIUM_THREADSAFE
+CRtsd CRDLMTSDKey;
+#else
+CRDLMContextState *CRDLMCurrentState = NULL;
+#endif
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+
+/*************************************************************************/
+
+#ifdef CHROMIUM_THREADSAFE
+/**
+ * This is the thread-specific destructor function for the 
+ * data used in the DLM.  It's very simple: if a thread exits
+ * that has DLM-specific data, the data represents the listState
+ * for the thread.  All data and buffers associated with the list
+ * can be deleted, and the structure itself can be freed.
+ *
+ * Most Chromium threads don't have such things; but then,
+ * if a thread dies elsewhere in Chromium, huge buffers
+ * of information won't still be floating around in
+ * unrecoverable allocated areas, either.
+ */
+static void threadDestructor(void *tsd)
+{
+    CRDLMContextState *listState = (CRDLMContextState *)tsd;
+
+    if (listState) {
+	if (listState->currentListInfo) {
+	    crdlm_free_list(listState->currentListInfo);
+	}
+
+	crFree(listState);
+    }
+}
+#endif
+
+/**
+ * This function creates and initializes a new display list
+ * manager.  It returns a pointer to the manager, or NULL in
+ * the case of insufficient memory.  The dispatch table pointer
+ * is passed in to allow the utilities to muck with the table
+ * to gain functional control when GL calls are made.
+ */
+CRDLM DLM_APIENTRY *crDLMNewDLM(unsigned int userConfigSize, const CRDLMConfig *userConfig)
+{
+    CRDLM *dlm;
+
+    /* This is the default configuration.  We'll overwrite it later
+     * with user-supplied configuration information.
+     */
+    CRDLMConfig config = {
+	CRDLM_DEFAULT_BUFFERSIZE,
+    };
+
+    dlm = crAlloc(sizeof(*dlm));
+    if (!dlm) {
+	return NULL;
+    }
+
+    /* Start off by initializing all entries that require further
+     * memory allocation, so we can free up all the memory if there's
+     * a problem.
+     */
+    if (!(dlm->displayLists = crAllocHashtable())) {
+	crFree(dlm);
+	return NULL;
+    }
+
+    /* The creator counts as the first user. */
+    dlm->userCount = 1;
+
+#ifdef CHROMIUM_THREADSAFE
+    /* This mutex ensures that only one thread is changing the displayLists
+     * hash at a time.  Note that we may also need a mutex to guarantee that
+     * the hash is not changed by one thread while another thread is
+     * traversing it; this issue has not yet been resolved.
+     */
+    crInitMutex(&(dlm->dlMutex));
+
+    /* Although the thread-specific data (TSD) functions will initialize
+     * the thread key themselves when needed, those functions do not allow
+     * us to specify a thread destructor.  Since a thread could potentially
+     * exit with considerable memory allocated (e.g. if a thread exits 
+     * after it has issued NewList but before EndList, and while there
+     * are considerable content buffers allocated), I do the initialization
+     * myself, in order to be able to reclaim those resources if a thread
+     * exits.
+     */
+    crInitTSDF(&(dlm->tsdKey), threadDestructor);
+    crInitTSD(&CRDLMTSDKey);
+#endif
+
+    /* Copy over any appropriate configuration values */
+    if (userConfig != NULL) {
+	/* Copy over as much configuration information as is provided.
+	 * Note that if the CRDLMConfig structure strictly grows, this
+	 * allows forward compatability - routines compiled with
+	 * older versions of the structure will only initialize that
+	 * section of the structure that they know about.
+	 */
+	crMemcpy((void *)&config, (void *) userConfig, 
+		MIN(userConfigSize, sizeof(config)));
+    }
+    dlm->bufferSize = config.bufferSize;
+
+    /* Return the pointer to the newly-allocated display list manager */
+    return dlm;
+}
+
+void DLM_APIENTRY crDLMUseDLM(CRDLM *dlm)
+{
+    DLM_LOCK(dlm);
+    dlm->userCount++;
+    DLM_UNLOCK(dlm);
+}
+
+/**
+ * This routine is called when a context or thread is done with a DLM.
+ * It maintains an internal count of users, and will only actually destroy
+ * itself when no one is still using the DLM.
+ */
+void DLM_APIENTRY crDLMFreeDLM(CRDLM *dlm)
+{
+    /* We're about to change the displayLists hash; lock it first */
+    DLM_LOCK(dlm)
+
+    /* Decrement the user count.  If the user count has gone to
+     * 0, then free the rest of the DLM.  Otherwise, other
+     * contexts or threads are still using this DLM; keep
+     * it around.
+     */
+    dlm->userCount--;
+    if (dlm->userCount == 0) {
+
+	/* Free the set of display lists.  As each one is freed, the
+	 * crdlm_free_list function will be called to free up its
+	 * internal resources.  The crdlm_free_list() routine is
+	 * cast to a (void *) to avoid warnings about being an
+	 */
+	crFreeHashtable(dlm->displayLists, crdlm_free_list);
+	dlm->displayLists = NULL;
+
+	/* Must unlock before freeing the mutex */
+	DLM_UNLOCK(dlm)
+
+#ifdef CHROMIUM_THREADSAFE
+	/* We release the mutex here; we really should delete the
+	 * thread data key, but there's no utility in Chromium to
+	 * do this.
+	 *
+	 * Note that, should one thread release the entire DLM
+	 * while other threads still believe they are using it,
+	 * any other threads that have current display lists (i.e.
+	 * have issued glNewList more recently than glEndList)
+	 * will be unable to reclaim their (likely very large)
+	 * content buffers, as there will be no way to reclaim
+	 * the thread-specific data.
+	 *
+	 * On the other hand, if one thread really does release
+	 * the DLM while other threads still believe they are 
+	 * using it, unreclaimed memory is the least of the
+	 * application's problems...
+	 */
+	crFreeMutex(&(dlm->dlMutex));
+
+	/* We free the TSD key here as well.  Note that this will
+	 * strand any threads that still have thread-specific data
+	 * tied to this key; but as stated above, if any threads
+	 * still do have thread-specific data attached to this DLM,
+	 * they're in big trouble anyway.
+	 */
+	crFreeTSD(&(dlm->tsdKey));
+	crFreeTSD(&CRDLMTSDKey);
+#endif
+
+	/* Free the master record, and we're all done. */
+	crFree(dlm);
+    }
+    else {
+	/* We're keeping the DLM around for other users.  Unlock it,
+	 * but retain its memory and display lists.
+	 */
+	DLM_UNLOCK(dlm)
+    }
+}
+
+/**
+ * The actual run-time state of a DLM is bound to a context
+ * (because each context can be used by at most one thread at
+ * a time, and a thread can only use one context at a time,
+ * while multiple contexts can use the same DLM).
+ * This creates the structure required to hold the state, and
+ * returns it to the caller, who should store it with any other
+ * context-specific information.
+ */
+
+CRDLMContextState DLM_APIENTRY *crDLMNewContext(CRDLM *dlm)
+{
+	CRDLMContextState *state;
+
+	/* Get a record for our own internal state structure */
+	state = (CRDLMContextState *)crAlloc(sizeof(CRDLMContextState));
+	if (!state) {
+		return NULL;
+	}
+
+	state->dlm = dlm;
+	state->currentListIdentifier = 0;
+	state->currentListInfo = NULL;
+	state->currentListMode = GL_FALSE;
+	state->listBase = 0;
+	state->replayState = CRDLM_IMMEDIATE;
+	
+	/* Increment the use count of the DLM provided.  This guarantees that
+	 * the DLM won't be released until all the contexts have released it.
+	 */
+	crDLMUseDLM(dlm);
+
+	return state;
+}
+
+
+/**
+ * This routine should be called when a MakeCurrent changes the current
+ * context.  It sets the thread data (or global data, in an unthreaded
+ * environment) appropriately; this in turn changes the behavior of
+ * the installed DLM API functions.
+ */
+void DLM_APIENTRY crDLMSetCurrentState(CRDLMContextState *state)
+{
+	CRDLMContextState *currentState = CURRENT_STATE();
+	if (currentState != state) {
+		SET_CURRENT_STATE(state);
+	}
+}
+
+CRDLMContextState DLM_APIENTRY *crDLMGetCurrentState(void)
+{
+	return CURRENT_STATE();
+}
+
+/**
+ * This routine, of course, is used to release a DLM context when it
+ * is no longer going to be used.
+ */
+
+void DLM_APIENTRY crDLMFreeContext(CRDLMContextState *state)
+{
+	CRDLMContextState *listState = CURRENT_STATE();
+
+	/* If we're currently using this context, release it first */
+	if (listState == state) {
+		crDLMSetCurrentState(NULL);
+	}
+
+	/* Try to free the DLM.  This will either decrement the use count,
+	 * or will actually free the DLM, if we were the last user.
+	 */
+	crDLMFreeDLM(state->dlm);
+	state->dlm = NULL;
+
+	/* If any buffers still remain (e.g. because there was an open
+	 * display list), remove those as well.
+	 */
+	if (state->currentListInfo) {
+		crdlm_free_list((void *)state->currentListInfo);
+	}
+	state->currentListInfo = NULL;
+	state->currentListIdentifier = 0;
+
+	/* Free the state record itself */
+	crFree(state);
+}
+
+
+/**
+ * This function can be used if the caller wishes to free up the
+ * potentially considerable resources used to store the display list
+ * content, without losing the rest of the display list management.
+ * For one example, consider an SPU that conditionally sends its 
+ * input stream to multiple servers.  It could broadcast all display
+ * lists to all servers, or it could only send display lists to servers
+ * that need them.  After all servers have the display list, the SPU
+ * may wish to release the resources used to manage the content.
+ */
+CRDLMError DLM_APIENTRY crDLMDeleteListContent(CRDLM *dlm, unsigned long listIdentifier)
+{
+    DLMListInfo *listInfo;
+    DLMInstanceList *instance;
+
+    listInfo = (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);
+    if (listInfo && (instance = listInfo->first)) {
+	while (instance) {
+	    DLMInstanceList *nextInstance;
+	    nextInstance = instance->next;
+	    crFree(instance);
+	    instance = nextInstance;
+	}
+	listInfo->first = listInfo->last = NULL;
+    }
+    return GL_NO_ERROR;
+}
+
+/* Return whether the current thread is involved in playback.
+ * This is useful for some routines to selectively choose their
+ * unpack state, for example (as replayed DLM functions must be
+ * unpacked with crStateNativePixelPacking instead of the 
+ * normal unpack state, for example.
+ */
+CRDLMReplayState DLM_APIENTRY crDLMGetReplayState(void)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	return listState->replayState;
+    }
+    else {
+	return CRDLM_IMMEDIATE;
+    }
+}
+
+/**
+ *
+ * Playback/execute a list.
+ * dlm - the display list manager context
+ * listIdentifier - the display list ID (as specified by app) to playback
+ * dispatchTable - the GL dispatch table to jump through as we execute commands
+ */
+void DLM_APIENTRY crDLMReplayDLMList(CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable)
+{
+    DLMListInfo *listInfo;
+
+    listInfo = (DLMListInfo *)crHashtableSearch(dlm->displayLists, listIdentifier);
+    if (listInfo) {
+	DLMInstanceList *instance = listInfo->first;
+	while (instance) {
+	    /* mutex, to make sure another thread doesn't change the list? */
+	    /* For now, leave it alone. */
+	    (*instance->execute)(instance, dispatchTable);
+	    instance = instance->next;
+	}
+    }
+}
+
+/* Playback/execute a list in the current DLM */
+void DLM_APIENTRY crDLMReplayList(unsigned long listIdentifier, SPUDispatchTable *dispatchTable)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	CRDLMReplayState oldReplayState = listState->replayState;
+	listState->replayState = CRDLM_REPLAY_ALL_FUNCTIONS;
+	crDLMReplayDLMList(listState->dlm, listIdentifier, dispatchTable);
+	listState->replayState = oldReplayState;
+    }
+}
+
+/*
+ * Playback/execute the state changing portions of a list.
+ * dlm - the display list manager context
+ * listIdentifier - the display list ID (as specified by app) to playback
+ * dispatchTable - the GL dispatch table to jump through as we execute commands
+ */
+void DLM_APIENTRY crDLMReplayDLMListState(CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable)
+{
+    DLMListInfo *listInfo;
+
+    listInfo = (DLMListInfo *)crHashtableSearch(dlm->displayLists, listIdentifier);
+    if (listInfo) {
+	DLMInstanceList *instance = listInfo->stateFirst;
+	while (instance) {
+	    /* mutex, to make sure another thread doesn't change the list? */
+	    /* For now, leave it alone. */
+	    (*instance->execute)(instance, dispatchTable);
+	    instance = instance->stateNext;
+	}
+    }
+}
+
+void DLM_APIENTRY crDLMReplayListState(unsigned long listIdentifier, SPUDispatchTable *dispatchTable)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	CRDLMReplayState oldReplayState = listState->replayState;
+	listState->replayState = CRDLM_REPLAY_STATE_FUNCTIONS;
+	crDLMReplayDLMListState(listState->dlm, listIdentifier, dispatchTable);
+	listState->replayState = oldReplayState;
+    }
+}
+
+/* This is a switch statement that lists every "type" value valid for a
+ * glCallLists() function call, with code for decoding the subsequent
+ * values correctly.  It uses the current value of the EXPAND() macro,
+ * which must expand into an appropriate action to be taken.
+ * Its codification here allows for multiple uses.
+ */
+#define CALL_LISTS_SWITCH(type, defaultAction) \
+    switch (type) {\
+	EXPAND(GL_BYTE, GLbyte *, *p, p++)\
+	EXPAND(GL_UNSIGNED_BYTE, GLubyte *, *p, p++)\
+	EXPAND(GL_SHORT, GLshort *, *p, p++)\
+	EXPAND(GL_UNSIGNED_SHORT, GLushort *, *p, p++)\
+	EXPAND(GL_INT, GLint *, *p, p++)\
+	EXPAND(GL_FLOAT, GLfloat *, *p, p++)\
+	EXPAND(GL_2_BYTES, unsigned char *, 256*p[0] + p[1], p += 2)\
+	EXPAND(GL_3_BYTES, unsigned char *, 65536*p[0] + 256*p[1] + p[2], p += 3)\
+	EXPAND(GL_4_BYTES, unsigned char *, 16777216*p[0] + 65536*p[1] + 256*p[2] + p[3], p += 4)\
+	default:\
+	    defaultAction;\
+    }
+
+void DLM_APIENTRY crDLMReplayDLMLists(CRDLM *dlm, GLsizei n, GLenum type, const GLvoid * lists, SPUDispatchTable *dispatchTable)
+{
+    unsigned long listId;
+    CRDLMContextState *listState = CURRENT_STATE();
+
+#define EXPAND(TYPENAME, TYPE, REFERENCE, INCREMENT) \
+    case TYPENAME: {\
+	TYPE p = (TYPE)lists;\
+	while (n--) {\
+	    listId = listState->listBase + (unsigned long) (REFERENCE);\
+	    crDLMReplayDLMList(dlm, listId, dispatchTable);\
+	    INCREMENT;\
+	}\
+	break;\
+    }
+
+    CALL_LISTS_SWITCH(type, break)
+#undef EXPAND
+
+}
+
+void DLM_APIENTRY crDLMReplayLists(GLsizei n, GLenum type, const GLvoid * lists, SPUDispatchTable *dispatchTable)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	crDLMReplayDLMLists(listState->dlm, n, type, lists, dispatchTable);
+    }
+}
+
+void DLM_APIENTRY crDLMReplayDLMListsState(CRDLM *dlm, GLsizei n, GLenum type, const GLvoid * lists, SPUDispatchTable *dispatchTable)
+{
+    unsigned long listId;
+    CRDLMContextState *listState = CURRENT_STATE();
+
+#define EXPAND(TYPENAME, TYPE, REFERENCE, INCREMENT) \
+    case TYPENAME: {\
+	TYPE p = (TYPE)lists;\
+	while (n--) {\
+	    listId = listState->listBase + (unsigned long) (REFERENCE);\
+	    crDLMReplayDLMListState(dlm, listId, dispatchTable);\
+	    INCREMENT;\
+	}\
+	break;\
+    }
+
+    CALL_LISTS_SWITCH(type, break)
+#undef EXPAND
+
+}
+
+void DLM_APIENTRY crDLMReplayListsState(GLsizei n, GLenum type, const GLvoid * lists, SPUDispatchTable *dispatchTable)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	crDLMReplayDLMListsState(listState->dlm, n, type, lists, dispatchTable);
+    }
+}
+
+/* When we compiled the display list, we packed all pixel data
+ * tightly.  When we execute the display list, we have to make
+ * sure that the client state reflects that the pixel data is
+ * tightly packed, or it will be interpreted incorrectly.
+ */
+void DLM_APIENTRY crDLMSetupClientState(SPUDispatchTable *dispatchTable)
+{
+    dispatchTable->PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+    dispatchTable->PixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+    dispatchTable->PixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+    dispatchTable->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
+}
+
+void DLM_APIENTRY crDLMRestoreClientState(CRClientState *clientState, SPUDispatchTable *dispatchTable)
+{
+    if (clientState) {
+	dispatchTable->PixelStorei(GL_UNPACK_ROW_LENGTH, clientState->unpack.rowLength);
+	dispatchTable->PixelStorei(GL_UNPACK_SKIP_PIXELS, clientState->unpack.skipPixels);
+	dispatchTable->PixelStorei(GL_UNPACK_SKIP_ROWS, clientState->unpack.skipRows);
+	dispatchTable->PixelStorei(GL_UNPACK_ALIGNMENT, clientState->unpack.alignment);
+    }
+}
+
+void DLM_APIENTRY crDLMSendDLMList(CRDLM *dlm, unsigned long listIdentifier,
+	SPUDispatchTable *dispatchTable)
+{
+    dispatchTable->NewList(listIdentifier, GL_COMPILE);
+    crDLMReplayDLMList(dlm, listIdentifier, dispatchTable);
+    dispatchTable->EndList();
+}
+
+void DLM_APIENTRY crDLMSendList(unsigned long listIdentifier, SPUDispatchTable *dispatchTable)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	crDLMSendDLMList(listState->dlm, listIdentifier, dispatchTable);
+    }
+}
+
+struct sendListsCallbackParms {
+    CRDLM *dlm;
+    SPUDispatchTable *dispatchTable;
+};
+
+static void sendListsCallback(unsigned long key, void *data, void *dataPtr2)
+{
+    struct sendListsCallbackParms *parms = (struct sendListsCallbackParms *)dataPtr2;
+
+    crDLMSendDLMList(parms->dlm, key, parms->dispatchTable);
+}
+
+void DLM_APIENTRY crDLMSendAllDLMLists(CRDLM *dlm, SPUDispatchTable *dispatchTable)
+{
+    struct sendListsCallbackParms parms;
+
+    /* This is how we pass our parameter information to the callback routine -
+     * through a pointer to this local structure.
+     */
+    parms.dlm = dlm;
+    parms.dispatchTable = dispatchTable;
+
+    crHashtableWalk(dlm->displayLists, sendListsCallback, (void *)&parms);
+}
+
+void DLM_APIENTRY crDLMSendAllLists(SPUDispatchTable *dispatchTable)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	crDLMSendAllDLMLists(listState->dlm, dispatchTable);
+    }
+}
+
+/** Another clever callback arrangement to get the desired data. */
+struct getRefsCallbackParms {
+    int remainingOffset;
+    int remainingCount;
+    unsigned int *buffer;
+    int totalCount;
+};
+
+static void getRefsCallback(unsigned long key, void *data, void *dataPtr2)
+{
+    struct getRefsCallbackParms *cbParms = 
+	(struct getRefsCallbackParms *)dataPtr2;
+
+    /* Count the total number of references */
+    cbParms->totalCount++;
+
+    /* If we haven't yet reached the desired offset, decrement it */
+    if (cbParms->remainingOffset > 0) {
+	cbParms->remainingOffset--;
+    }
+    else if (cbParms->remainingCount > 0) {
+	 /* Store data until we've stored all we can.
+	 */
+	*(cbParms->buffer++) = key;
+	cbParms->remainingCount--;
+    }
+}
+
+int DLM_APIENTRY crDLMGetReferences(CRDLM *dlm, unsigned long listIdentifier,
+    int firstIndex, int sizeofBuffer, unsigned int *buffer)
+{
+    DLMListInfo *listInfo;
+
+    listInfo = (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);
+    if (listInfo) {
+	struct getRefsCallbackParms cbParms;
+
+	cbParms.remainingOffset = firstIndex;
+	cbParms.remainingCount = sizeofBuffer;
+	cbParms.buffer = buffer;
+	cbParms.totalCount = 0;
+
+	crHashtableWalk(listInfo->references, getRefsCallback, (void *)&cbParms);
+
+	return cbParms.totalCount;
+    }
+    else {
+	/* No list exists; it therefore has no references */
+	return 0;
+    }
+}
+
+CRDLMError DLM_APIENTRY crDLMGetDLMBounds(CRDLM *dlm, unsigned long listIdentifier, CRDLMBounds *bounds)
+{
+	DLMListInfo *listInfo
+		= (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);
+	if (listInfo) {
+		*bounds = listInfo->bbox;
+		return GL_NO_ERROR;
+	}
+	else {
+		return GL_INVALID_OPERATION;
+	}
+}
+
+CRDLMError DLM_APIENTRY crDLMGetBounds(unsigned long listIdentifier, CRDLMBounds *bounds)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	return crDLMGetDLMBounds(listState->dlm, listIdentifier, bounds);
+    }
+    else {
+	return CRDLM_ERROR_STATE;
+    }
+}
+
+
+/**
+ * Set the bounding box for a display list.
+ */
+void DLM_APIENTRY crDLMSetDLMBounds(CRDLM *dlm, unsigned long listIdentifier,
+               double xmin, double ymin, double zmin,
+               double xmax, double ymax, double zmax)
+{
+	DLMListInfo *listInfo
+		= (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);
+	if (!listInfo) {
+		/* allocate a list info now */
+		CRDLMContextState *listState = CURRENT_STATE();
+		listInfo = (DLMListInfo *) crCalloc(sizeof(DLMListInfo));
+		crHashtableReplace(listState->dlm->displayLists,
+											 listIdentifier, listInfo, crdlm_free_list);
+	}
+	if (listInfo) {
+		listInfo->bbox.xmin = xmin;
+		listInfo->bbox.ymin = ymin;
+		listInfo->bbox.zmin = zmin;
+		listInfo->bbox.xmax = xmax;
+		listInfo->bbox.ymax = ymax;
+		listInfo->bbox.zmax = zmax;
+	}
+}
+
+void DLM_APIENTRY crDLMSetBounds(unsigned long listIdentifier,
+               double xmin, double ymin, double zmin,
+               double xmax, double ymax, double zmax)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	crDLMSetDLMBounds(listState->dlm, listIdentifier,
+	    xmin, ymin, zmin, xmax, ymax, zmax);
+    }
+}
+
+/**
+ * Return GL_TRUE if the given list has a valid bounding box
+ */
+GLboolean DLM_APIENTRY crDLMListHasDLMBounds(CRDLM *dlm, unsigned long listIdentifier)
+{
+	DLMListInfo *listInfo
+		= (DLMListInfo *) crHashtableSearch(dlm->displayLists, listIdentifier);
+	if (listInfo)
+		return listInfo->bbox.xmin != FLT_MAX;
+	else
+		return GL_FALSE;
+}
+
+GLboolean DLM_APIENTRY crDLMListHasBounds(unsigned long listIdentifier)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+    if (listState) {
+	return crDLMListHasDLMBounds(listState->dlm, listIdentifier);
+    }
+    return 0;
+}
+
+/*
+ * Return id of list currently being compiled.  Returns 0 of there's no
+ * current DLM state, or if no list is being compiled. 
+ */
+GLuint DLM_APIENTRY crDLMGetCurrentList(void)
+{
+	CRDLMContextState *listState = CURRENT_STATE();
+	return listState ? listState->currentListIdentifier : 0;
+}
+
+/*
+ * Return mode of list currently being compiled.  Should be 
+ * GL_FALSE if no list is being compiled, or GL_COMPILE if a
+ * list is being compiled but not executed, or GL_COMPILE_AND_EXECUTE
+ * if a list is being compiled and executed.
+ */
+GLenum DLM_APIENTRY crDLMGetCurrentMode(void)
+{
+	CRDLMContextState *listState = CURRENT_STATE();
+	return listState ? listState->currentListMode : 0;
+}
+
+
+static CRDLMErrorCallback ErrorCallback = NULL;
+
+void DLM_APIENTRY crDLMErrorFunction(CRDLMErrorCallback callback)
+{
+	ErrorCallback = callback;
+}
+
+void crdlm_error(int line, const char *file, GLenum error, const char *info)
+{
+	if (ErrorCallback)
+		(*ErrorCallback)(line, file, error, info);
+}
+
+int32_t DLM_APIENTRY crDLMSaveState(void)
+{
+    return 0;
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm.h b/src/VBox/HostServices/SharedOpenGL/dlm/dlm.h
new file mode 100644
index 0000000..e3b51df
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm.h
@@ -0,0 +1,31 @@
+/* $Id: dlm.h $ */
+
+#ifndef _DLM_H
+#define _DLM_H
+
+#include "cr_dlm.h"
+#include "cr_spu.h"
+
+#ifdef CHROMIUM_THREADSAFE
+#define DLM_LOCK(dlm) crLockMutex(&(dlm->dlMutex));
+#define DLM_UNLOCK(dlm) crUnlockMutex(&(dlm->dlMutex));
+extern CRtsd CRDLMTSDKey;
+#define SET_CURRENT_STATE(state) crSetTSD(&CRDLMTSDKey, (void *)state);
+#define CURRENT_STATE() ((CRDLMContextState *)crGetTSD(&CRDLMTSDKey))
+#else
+#define DLM_LOCK(dlm)
+#define DLM_UNLOCK(dlm)
+extern CRDLMContextState *CRDLMCurrentState;
+#define SET_CURRENT_STATE(state) CRDLMCurrentState = (state);
+#define CURRENT_STATE() (CRDLMCurrentState)
+#endif
+
+/* These routines are intended to be used within the DLM library, across
+ * the modules therein, but not as an API into the DLM library from
+ * outside.
+ */
+extern void crdlmWarning( int line, char *file, GLenum error, char *format, ... );
+extern void crdlm_free_list(/* DLMListInfo * */ void *listInfo);
+extern void crdlm_error(int line, const char *file, GLenum error, const char *info);
+
+#endif
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_arrays.c b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_arrays.c
new file mode 100644
index 0000000..d14d719
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_arrays.c
@@ -0,0 +1,387 @@
+/* $Id: dlm_arrays.c $ */
+/* Copyright (c) 2001, Stanford University
+ * All rights reserved
+ *
+ * See the file LICENSE.txt for information on redistributing this software.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "chromium.h"
+#include "cr_dlm.h"
+#include "dlm.h"
+
+/*
+ * XXX this code is awfully similar to the code in arrayspu.c
+ * We should try to write something reusable.
+ */
+
+void DLM_APIENTRY crDLMCompileArrayElement (GLint index, CRClientState *c)
+{
+  unsigned char *p;
+  int unit;
+
+  if (c->array.e.enabled)
+  {
+    crDLMCompileEdgeFlagv(c->array.e.p + index*c->array.e.stride);
+  }
+  for (unit = 0; unit < CR_MAX_TEXTURE_UNITS; unit++)
+  {
+    if (c->array.t[unit].enabled)
+    {
+      p = c->array.t[unit].p + index*c->array.t[unit].stride;
+      switch (c->array.t[unit].type)
+      {
+        case GL_SHORT:
+          switch (c->array.t[c->curClientTextureUnit].size)
+          {
+            case 1: crDLMCompileMultiTexCoord1svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break;
+            case 2: crDLMCompileMultiTexCoord2svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break;
+            case 3: crDLMCompileMultiTexCoord3svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break;
+            case 4: crDLMCompileMultiTexCoord4svARB(GL_TEXTURE0_ARB + unit, (GLshort *)p); break;
+          }
+          break;
+        case GL_INT:
+          switch (c->array.t[c->curClientTextureUnit].size)
+          {
+            case 1: crDLMCompileMultiTexCoord1ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break;
+            case 2: crDLMCompileMultiTexCoord2ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break;
+            case 3: crDLMCompileMultiTexCoord3ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break;
+            case 4: crDLMCompileMultiTexCoord4ivARB(GL_TEXTURE0_ARB + unit, (GLint *)p); break;
+          }
+          break;
+        case GL_FLOAT:
+          switch (c->array.t[c->curClientTextureUnit].size)
+          {
+            case 1: crDLMCompileMultiTexCoord1fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break;
+            case 2: crDLMCompileMultiTexCoord2fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break;
+            case 3: crDLMCompileMultiTexCoord3fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break;
+            case 4: crDLMCompileMultiTexCoord4fvARB(GL_TEXTURE0_ARB + unit, (GLfloat *)p); break;
+          }
+          break;
+        case GL_DOUBLE:
+          switch (c->array.t[c->curClientTextureUnit].size)
+          {
+            case 1: crDLMCompileMultiTexCoord1dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break;
+            case 2: crDLMCompileMultiTexCoord2dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break;
+            case 3: crDLMCompileMultiTexCoord3dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break;
+            case 4: crDLMCompileMultiTexCoord4dvARB(GL_TEXTURE0_ARB + unit, (GLdouble *)p); break;
+          }
+          break;
+      }
+    }
+  } /* loop over texture units */
+
+  if (c->array.i.enabled)
+  {
+    p = c->array.i.p + index*c->array.i.stride;
+    switch (c->array.i.type)
+    {
+      case GL_SHORT: crDLMCompileIndexsv((GLshort *)p); break;
+      case GL_INT: crDLMCompileIndexiv((GLint *)p); break;
+      case GL_FLOAT: crDLMCompileIndexfv((GLfloat *)p); break;
+      case GL_DOUBLE: crDLMCompileIndexdv((GLdouble *)p); break;
+    }
+  }
+  if (c->array.c.enabled)
+  {
+    p = c->array.c.p + index*c->array.c.stride;
+    switch (c->array.c.type)
+    {
+      case GL_BYTE:
+        switch (c->array.c.size)
+        {
+          case 3: crDLMCompileColor3bv((GLbyte *)p); break;
+          case 4: crDLMCompileColor4bv((GLbyte *)p); break;
+        }
+        break;
+      case GL_UNSIGNED_BYTE:
+        switch (c->array.c.size)
+        {
+          case 3: crDLMCompileColor3ubv((GLubyte *)p); break;
+          case 4: crDLMCompileColor4ubv((GLubyte *)p); break;
+        }
+        break;
+      case GL_SHORT:
+        switch (c->array.c.size)
+        {
+          case 3: crDLMCompileColor3sv((GLshort *)p); break;
+          case 4: crDLMCompileColor4sv((GLshort *)p); break;
+        }
+        break;
+      case GL_UNSIGNED_SHORT:
+        switch (c->array.c.size)
+        {
+          case 3: crDLMCompileColor3usv((GLushort *)p); break;
+          case 4: crDLMCompileColor4usv((GLushort *)p); break;
+        }
+        break;
+      case GL_INT:
+        switch (c->array.c.size)
+        {
+          case 3: crDLMCompileColor3iv((GLint *)p); break;
+          case 4: crDLMCompileColor4iv((GLint *)p); break;
+        }
+        break;
+      case GL_UNSIGNED_INT:
+        switch (c->array.c.size)
+        {
+          case 3: crDLMCompileColor3uiv((GLuint *)p); break;
+          case 4: crDLMCompileColor4uiv((GLuint *)p); break;
+        }
+        break;
+      case GL_FLOAT:
+        switch (c->array.c.size)
+        {
+          case 3: crDLMCompileColor3fv((GLfloat *)p); break;
+          case 4: crDLMCompileColor4fv((GLfloat *)p); break;
+        }
+        break;
+      case GL_DOUBLE:
+        switch (c->array.c.size)
+        {
+          case 3: crDLMCompileColor3dv((GLdouble *)p); break;
+          case 4: crDLMCompileColor4dv((GLdouble *)p); break;
+        }
+        break;
+    }
+  }
+  if (c->array.n.enabled)
+  {
+    p = c->array.n.p + index*c->array.n.stride;
+    switch (c->array.n.type)
+    {
+      case GL_BYTE: crDLMCompileNormal3bv((GLbyte *)p); break;
+      case GL_SHORT: crDLMCompileNormal3sv((GLshort *)p); break;
+      case GL_INT: crDLMCompileNormal3iv((GLint *)p); break;
+      case GL_FLOAT: crDLMCompileNormal3fv((GLfloat *)p); break;
+      case GL_DOUBLE: crDLMCompileNormal3dv((GLdouble *)p); break;
+    }
+  }
+#ifdef CR_EXT_secondary_color
+  if (c->array.s.enabled)
+  {
+    p = c->array.s.p + index*c->array.s.stride;
+    switch (c->array.s.type)
+    {
+      case GL_BYTE:
+        crDLMCompileSecondaryColor3bvEXT((GLbyte *)p); break;
+      case GL_UNSIGNED_BYTE:
+        crDLMCompileSecondaryColor3ubvEXT((GLubyte *)p); break;
+      case GL_SHORT:
+        crDLMCompileSecondaryColor3svEXT((GLshort *)p); break;
+      case GL_UNSIGNED_SHORT:
+        crDLMCompileSecondaryColor3usvEXT((GLushort *)p); break;
+      case GL_INT:
+        crDLMCompileSecondaryColor3ivEXT((GLint *)p); break;
+      case GL_UNSIGNED_INT:
+        crDLMCompileSecondaryColor3uivEXT((GLuint *)p); break;
+      case GL_FLOAT:
+        crDLMCompileSecondaryColor3fvEXT((GLfloat *)p); break;
+      case GL_DOUBLE:
+        crDLMCompileSecondaryColor3dvEXT((GLdouble *)p); break;
+    }
+  }
+#endif
+  if (c->array.v.enabled)
+  {
+    p = c->array.v.p + (index*c->array.v.stride);
+
+    switch (c->array.v.type)
+    {
+      case GL_SHORT:
+        switch (c->array.v.size)
+        {
+          case 2: crDLMCompileVertex2sv((GLshort *)p); break;
+          case 3: crDLMCompileVertex3sv((GLshort *)p); break;
+          case 4: crDLMCompileVertex4sv((GLshort *)p); break;
+        }
+        break;
+      case GL_INT:
+        switch (c->array.v.size)
+        {
+          case 2: crDLMCompileVertex2iv((GLint *)p); break;
+          case 3: crDLMCompileVertex3iv((GLint *)p); break;
+          case 4: crDLMCompileVertex4iv((GLint *)p); break;
+        }
+        break;
+      case GL_FLOAT:
+        switch (c->array.v.size)
+        {
+          case 2: crDLMCompileVertex2fv((GLfloat *)p); break;
+          case 3: crDLMCompileVertex3fv((GLfloat *)p); break;
+          case 4: crDLMCompileVertex4fv((GLfloat *)p); break;
+        }
+        break;
+      case GL_DOUBLE:
+        switch (c->array.v.size)
+        {
+          case 2: crDLMCompileVertex2dv((GLdouble *)p); break;
+          case 3: crDLMCompileVertex3dv((GLdouble *)p); break;
+          case 4: crDLMCompileVertex4dv((GLdouble *)p); break;
+        }
+        break;
+    }
+  }
+}
+
+void DLM_APIENTRY crDLMCompileDrawArrays(GLenum mode, GLint first, GLsizei count, CRClientState *c)
+{
+  int i;
+
+  if (count < 0)
+  {
+    crdlmWarning(__LINE__, __FILE__, GL_INVALID_VALUE, "DLM DrawArrays(negative count)");
+    return;
+  }
+
+  if (mode > GL_POLYGON)
+  {
+    crdlmWarning(__LINE__, __FILE__, GL_INVALID_ENUM, "DLM DrawArrays(bad mode)");
+    return;
+  }
+
+  crDLMCompileBegin(mode);
+  for (i=0; i<count; i++)
+  {
+    crDLMCompileArrayElement(first + i, c);
+  }
+  crDLMCompileEnd();
+}
+
+void DLM_APIENTRY crDLMCompileDrawElements(GLenum mode, GLsizei count,
+                                      GLenum type, const GLvoid *indices, CRClientState *c)
+{
+  int i;
+  GLubyte *p = (GLubyte *)indices;
+
+  if (count < 0)
+  {
+    crdlmWarning(__LINE__, __FILE__, GL_INVALID_VALUE, "DLM DrawElements(negative count)");
+    return;
+  }
+
+  if (mode > GL_POLYGON)
+  {
+    crdlmWarning(__LINE__, __FILE__, GL_INVALID_ENUM, "DLM DrawElements(bad mode)");
+    return;
+  }
+
+  if (type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT)
+  {
+    crdlmWarning(__LINE__, __FILE__, GL_INVALID_ENUM, "DLM DrawElements(bad type)");
+    return;
+  }
+
+  crDLMCompileBegin(mode);
+  switch (type)
+  {
+  case GL_UNSIGNED_BYTE:
+    for (i=0; i<count; i++)
+    {
+      crDLMCompileArrayElement((GLint) *p++, c);
+    }
+    break;
+  case GL_UNSIGNED_SHORT:
+    for (i=0; i<count; i++)
+    {
+      crDLMCompileArrayElement((GLint) * (GLushort *) p, c);
+      p+=sizeof (GLushort);
+    }
+    break;
+  case GL_UNSIGNED_INT:
+    for (i=0; i<count; i++)
+    {
+      crDLMCompileArrayElement((GLint) * (GLuint *) p, c);
+      p+=sizeof (GLuint);
+    }
+    break;
+  default:
+    crError( "this can't happen: DLM DrawElements" );
+    break;
+  }
+  crDLMCompileEnd();
+}
+
+void DLM_APIENTRY crDLMCompileDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, 
+                                      GLenum type, const GLvoid *indices, CRClientState *c)
+{
+  int i;
+  GLubyte *p = (GLubyte *)indices;
+
+  (void) end;
+
+  if (count < 0)
+  {
+    crdlmWarning(__LINE__, __FILE__, GL_INVALID_VALUE, "DLM DrawRangeElements(negative count)");
+    return;
+  }
+
+  if (mode > GL_POLYGON)
+  {
+    crdlmWarning(__LINE__, __FILE__, GL_INVALID_ENUM, "DLM DrawRangeElements(bad mode)");
+    return;
+  }
+
+  if (type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT)
+  {
+    crdlmWarning(__LINE__, __FILE__, GL_INVALID_ENUM, "DLM DrawRangeElements(bad type)");
+    return;
+  }
+
+  crDLMCompileBegin(mode);
+  switch (type)
+  {
+  case GL_UNSIGNED_BYTE:
+    for (i=start; i<count; i++)
+    {
+      crDLMCompileArrayElement((GLint) *p++, c);
+    }
+    break;
+  case GL_UNSIGNED_SHORT:
+    for (i=start; i<count; i++)
+    {
+      crDLMCompileArrayElement((GLint) * (GLushort *) p, c);
+      p+=sizeof (GLushort);
+    }
+    break;
+  case GL_UNSIGNED_INT:
+    for (i=start; i<count; i++)
+    {
+      crDLMCompileArrayElement((GLint) * (GLuint *) p, c);
+      p+=sizeof (GLuint);
+    }
+    break;
+  default:
+    crError( "this can't happen: DLM DrawRangeElements" );
+    break;
+  }
+  crDLMCompileEnd();
+}
+
+#ifdef CR_EXT_multi_draw_arrays
+void DLM_APIENTRY crDLMCompileMultiDrawArraysEXT( GLenum mode, GLint *first,
+                          GLsizei *count, GLsizei primcount, CRClientState *c)
+{
+   GLint i;
+
+   for (i = 0; i < primcount; i++) {
+      if (count[i] > 0) {
+         crDLMCompileDrawArrays(mode, first[i], count[i], c);
+      }
+   }
+}
+
+
+void DLM_APIENTRY crDLMCompileMultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
+                            const GLvoid **indices, GLsizei primcount, CRClientState *c)
+{
+   GLint i;
+
+   for (i = 0; i < primcount; i++) {
+      if (count[i] > 0) {
+         crDLMCompileDrawElements(mode, count[i], type, indices[i], c);
+      }
+   }
+}
+#endif /* CR_EXT_multi_draw_arrays */
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_bbox.c b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_bbox.c
new file mode 100644
index 0000000..4fd11b9
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_bbox.c
@@ -0,0 +1,454 @@
+/* $Id: dlm_bbox.c $ */
+/**
+ * Code to compute the bounding box of a DLM display list.
+ * Matrix commands in the display list are observed to properly
+ * transform the vertices we find.
+ */
+
+#include <float.h>
+#include "cr_dlm.h"
+#include "cr_mem.h"
+#include "cr_spu.h"
+#include "cr_glstate.h"
+#include "dlm.h"
+
+
+static CRMatrixStack ModelViewStack;
+static CRMatrixStack DummyStack;
+static CRMatrixStack *CurrentStack;
+
+
+static GLfloat Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
+
+
+static void
+MatrixMode(GLenum matrix)
+{
+	switch (matrix) {
+	case GL_MODELVIEW:
+		CurrentStack = &ModelViewStack;
+		break;
+	default:
+		CurrentStack = &DummyStack;
+	}
+}
+
+
+static void
+LoadMatrixf(const GLfloat m[16])
+{
+	crMatrixInitFromFloats(CurrentStack->top, m);
+}
+
+
+static void
+LoadMatrixd(const GLdouble m[16])
+{
+	crMatrixInitFromDoubles(CurrentStack->top, m);
+}
+
+
+static void
+LoadIdentity(void)
+{
+	crMatrixInit(CurrentStack->top);
+}
+
+
+static void
+PushMatrix(void)
+{
+	if (CurrentStack->depth < CurrentStack->maxDepth) {
+		/* copy matrix */
+		*(CurrentStack->top + 1) = *(CurrentStack->top);
+		/* Move the stack pointer */
+		CurrentStack->depth++;
+		CurrentStack->top = CurrentStack->stack + CurrentStack->depth;
+	}
+	else {
+		crWarning("Stack overflow in dlm_bbox.c");
+	}
+}
+
+
+static void
+PopMatrix(void)
+{
+	if (CurrentStack->depth > 0) {
+		CurrentStack->depth--;
+		CurrentStack->top = CurrentStack->stack + CurrentStack->depth;
+	}
+	else {
+		crWarning("Stack underflow in dlm_bbox.c");
+	}
+}
+
+
+static void
+MultMatrixf(const GLfloat m1[16])
+{
+	CRmatrix *m = CurrentStack->top;
+	const GLdefault lm00 = m->m00;  
+	const GLdefault lm01 = m->m01;  
+	const GLdefault lm02 = m->m02;	
+	const GLdefault lm03 = m->m03;	
+	const GLdefault lm10 = m->m10;	
+	const GLdefault lm11 = m->m11;	
+	const GLdefault lm12 = m->m12;	
+	const GLdefault lm13 = m->m13;	
+	const GLdefault lm20 = m->m20;	
+	const GLdefault lm21 = m->m21;	
+	const GLdefault lm22 = m->m22;	
+	const GLdefault lm23 = m->m23;	
+	const GLdefault lm30 = m->m30;	
+	const GLdefault lm31 = m->m31;	
+	const GLdefault lm32 = m->m32;		
+	const GLdefault lm33 = m->m33;		
+	const GLdefault rm00 = (GLdefault) m1[0];	
+	const GLdefault rm01 = (GLdefault) m1[1];	
+	const GLdefault rm02 = (GLdefault) m1[2];	
+	const GLdefault rm03 = (GLdefault) m1[3];	
+	const GLdefault rm10 = (GLdefault) m1[4];	
+	const GLdefault rm11 = (GLdefault) m1[5];		
+	const GLdefault rm12 = (GLdefault) m1[6];	
+	const GLdefault rm13 = (GLdefault) m1[7];	
+	const GLdefault rm20 = (GLdefault) m1[8];	
+	const GLdefault rm21 = (GLdefault) m1[9];	
+	const GLdefault rm22 = (GLdefault) m1[10];	
+	const GLdefault rm23 = (GLdefault) m1[11];	
+	const GLdefault rm30 = (GLdefault) m1[12];	
+	const GLdefault rm31 = (GLdefault) m1[13];	
+	const GLdefault rm32 = (GLdefault) m1[14];	
+	const GLdefault rm33 = (GLdefault) m1[15];	
+
+	m->m00 = lm00*rm00 + lm10*rm01 + lm20*rm02 + lm30*rm03;	
+	m->m01 = lm01*rm00 + lm11*rm01 + lm21*rm02 + lm31*rm03;	
+	m->m02 = lm02*rm00 + lm12*rm01 + lm22*rm02 + lm32*rm03;	
+	m->m03 = lm03*rm00 + lm13*rm01 + lm23*rm02 + lm33*rm03;	
+	m->m10 = lm00*rm10 + lm10*rm11 + lm20*rm12 + lm30*rm13;	
+	m->m11 = lm01*rm10 + lm11*rm11 + lm21*rm12 + lm31*rm13;	
+	m->m12 = lm02*rm10 + lm12*rm11 + lm22*rm12 + lm32*rm13;	
+	m->m13 = lm03*rm10 + lm13*rm11 + lm23*rm12 + lm33*rm13;	
+	m->m20 = lm00*rm20 + lm10*rm21 + lm20*rm22 + lm30*rm23;	
+	m->m21 = lm01*rm20 + lm11*rm21 + lm21*rm22 + lm31*rm23;	
+	m->m22 = lm02*rm20 + lm12*rm21 + lm22*rm22 + lm32*rm23;	
+	m->m23 = lm03*rm20 + lm13*rm21 + lm23*rm22 + lm33*rm23;	
+	m->m30 = lm00*rm30 + lm10*rm31 + lm20*rm32 + lm30*rm33;	
+	m->m31 = lm01*rm30 + lm11*rm31 + lm21*rm32 + lm31*rm33;	
+	m->m32 = lm02*rm30 + lm12*rm31 + lm22*rm32 + lm32*rm33;	
+	m->m33 = lm03*rm30 + lm13*rm31 + lm23*rm32 + lm33*rm33;
+}
+
+
+static void
+MultMatrixd(const GLdouble m1[16])
+{
+	GLfloat m2[16];
+	int i;
+	for (i = 0; i < 16; i++)
+		m2[i] = (GLfloat) m1[i];
+	MultMatrixf(m2);
+}
+
+
+static void
+Rotatef(GLfloat ang, GLfloat x, GLfloat y, GLfloat z) 
+{
+	crMatrixRotate(CurrentStack->top, ang, x, y, z);
+}
+
+
+static void
+Rotated(GLdouble ang, GLdouble x, GLdouble y, GLdouble z) 
+{
+	crMatrixRotate(CurrentStack->top, (GLfloat) ang,
+								 (GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+
+static void
+Translatef(GLfloat x, GLfloat y, GLfloat z) 
+{
+	crMatrixTranslate(CurrentStack->top, x, y, z);
+}
+
+
+static void
+Translated(GLdouble x, GLdouble y, GLdouble z) 
+{
+	crMatrixTranslate(CurrentStack->top, (GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+
+static void
+Scalef(GLfloat x, GLfloat y, GLfloat z) 
+{
+	crMatrixScale(CurrentStack->top, x, y, z);
+}
+
+
+static void
+Scaled(GLdouble x, GLdouble y, GLdouble z) 
+{
+	crMatrixScale(CurrentStack->top, (GLfloat) x, (GLfloat) y, (GLfloat) z);
+}
+
+
+/**
+ * Transform given (x,y,z,w) by current matrix and update the bounding box.
+ */
+static void
+DoVertex(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+	const CRmatrix *m = CurrentStack->top;
+	const GLfloat x2 = m->m00 * x + m->m10 * y + m->m20 * z + m->m30 * w;
+	const GLfloat y2 = m->m01 * x + m->m11 * y + m->m21 * z + m->m31 * w;
+	const GLfloat z2 = m->m02 * x + m->m12 * y + m->m22 * z + m->m32 * w;
+	/*const GLfloat w2 = m->m03 * x + m->m13 * y + m->m23 * z + m->m33 * w;*/
+
+	if (x2 < Xmin) Xmin = x2;
+	if (x2 > Xmax) Xmax = x2;
+	if (y2 < Ymin) Ymin = y2;
+	if (y2 > Ymax) Ymax = y2;
+	if (z2 < Zmin) Zmin = z2;
+	if (z2 > Zmax) Zmax = z2;
+}
+
+
+static void
+Vertex2f(GLfloat x, GLfloat y)
+{
+	DoVertex(x, y, 0.0f, 1.0f);
+}
+
+static void
+Vertex2fv(const GLfloat *v)
+{
+	DoVertex(v[0], v[1], 0.0f, 1.0f);
+}
+
+static void
+Vertex3f(GLfloat x, GLfloat y, GLfloat z)
+{
+	DoVertex(x, y, z, 1.0f);
+}
+
+static void
+Vertex3fv(const GLfloat *v)
+{
+	DoVertex(v[0], v[1], v[2], 1.0f);
+}
+
+static void
+Vertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+	DoVertex(x, y, z, w);
+}
+
+static void
+Vertex4fv(const GLfloat *v)
+{
+	DoVertex(v[0], v[1], v[2], v[3]);
+}
+
+
+/**
+ ** XXX TO DO:
+ **
+glVertex2d( GLdouble x, GLdouble y );
+glVertex2f( GLfloat x, GLfloat y );
+glVertex2i( GLint x, GLint y );
+glVertex2s( GLshort x, GLshort y );
+glVertex3d( GLdouble x, GLdouble y, GLdouble z );
+glVertex3f( GLfloat x, GLfloat y, GLfloat z );
+glVertex3i( GLint x, GLint y, GLint z );
+glVertex3s( GLshort x, GLshort y, GLshort z );
+glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
+glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+glVertex4i( GLint x, GLint y, GLint z, GLint w );
+glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
+glVertex2dv( const GLdouble *v );
+glVertex2fv( const GLfloat *v );
+glVertex2iv( const GLint *v );
+glVertex2sv( const GLshort *v );
+glVertex3dv( const GLdouble *v );
+glVertex3fv( const GLfloat *v );
+glVertex3iv( const GLint *v );
+glVertex3sv( const GLshort *v );
+glVertex4dv( const GLdouble *v );
+glVertex4fv( const GLfloat *v );
+glVertex4iv( const GLint *v );
+glVertex4sv( const GLshort *v );
+
+glVertexAttrib1dARB(GLuint, GLdouble);
+glVertexAttrib1dvARB(GLuint, const GLdouble *);
+glVertexAttrib1fARB(GLuint, GLfloat);
+glVertexAttrib1fvARB(GLuint, const GLfloat *);
+glVertexAttrib1sARB(GLuint, GLshort);
+glVertexAttrib1svARB(GLuint, const GLshort *);
+glVertexAttrib2dARB(GLuint, GLdouble, GLdouble);
+glVertexAttrib2dvARB(GLuint, const GLdouble *);
+glVertexAttrib2fARB(GLuint, GLfloat, GLfloat);
+glVertexAttrib2fvARB(GLuint, const GLfloat *);
+glVertexAttrib2sARB(GLuint, GLshort, GLshort);
+glVertexAttrib2svARB(GLuint, const GLshort *);
+glVertexAttrib3dARB(GLuint, GLdouble, GLdouble, GLdouble);
+glVertexAttrib3dvARB(GLuint, const GLdouble *);
+**/
+
+static void
+VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+	if (index == 0)
+		DoVertex(x, y, z, 1.0f);
+}
+
+/**
+glVertexAttrib3fvARB(GLuint, const GLfloat *);
+glVertexAttrib3sARB(GLuint, GLshort, GLshort, GLshort);
+glVertexAttrib3svARB(GLuint, const GLshort *);
+glVertexAttrib4NbvARB(GLuint, const GLbyte *);
+glVertexAttrib4NivARB(GLuint, const GLint *);
+glVertexAttrib4NsvARB(GLuint, const GLshort *);
+glVertexAttrib4NubARB(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
+glVertexAttrib4NubvARB(GLuint, const GLubyte *);
+glVertexAttrib4NuivARB(GLuint, const GLuint *);
+glVertexAttrib4NusvARB(GLuint, const GLushort *);
+glVertexAttrib4bvARB(GLuint, const GLbyte *);
+glVertexAttrib4dARB(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+glVertexAttrib4dvARB(GLuint, const GLdouble *);
+glVertexAttrib4fARB(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+glVertexAttrib4fvARB(GLuint, const GLfloat *);
+glVertexAttrib4ivARB(GLuint, const GLint *);
+glVertexAttrib4sARB(GLuint, GLshort, GLshort, GLshort, GLshort);
+glVertexAttrib4svARB(GLuint, const GLshort *);
+glVertexAttrib4ubvARB(GLuint, const GLubyte *);
+glVertexAttrib4uivARB(GLuint, const GLuint *);
+glVertexAttrib4usvARB(GLuint, const GLushort *);
+
+glVertexAttrib1dNV(GLuint, GLdouble);
+glVertexAttrib1dvNV(GLuint, const GLdouble *);
+glVertexAttrib1fNV(GLuint, GLfloat);
+glVertexAttrib1fvNV(GLuint, const GLfloat *);
+glVertexAttrib1sNV(GLuint, GLshort);
+glVertexAttrib1svNV(GLuint, const GLshort *);
+glVertexAttrib2dNV(GLuint, GLdouble, GLdouble);
+glVertexAttrib2dvNV(GLuint, const GLdouble *);
+glVertexAttrib2fNV(GLuint, GLfloat, GLfloat);
+glVertexAttrib2fvNV(GLuint, const GLfloat *);
+glVertexAttrib2sNV(GLuint, GLshort, GLshort);
+glVertexAttrib2svNV(GLuint, const GLshort *);
+glVertexAttrib3dNV(GLuint, GLdouble, GLdouble, GLdouble);
+glVertexAttrib3dvNV(GLuint, const GLdouble *);
+glVertexAttrib3fNV(GLuint, GLfloat, GLfloat, GLfloat);
+glVertexAttrib3fvNV(GLuint, const GLfloat *);
+glVertexAttrib3sNV(GLuint, GLshort, GLshort, GLshort);
+glVertexAttrib3svNV(GLuint, const GLshort *);
+glVertexAttrib4dNV(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+glVertexAttrib4dvNV(GLuint, const GLdouble *);
+glVertexAttrib4fNV(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+glVertexAttrib4fvNV(GLuint, const GLfloat *);
+glVertexAttrib4sNV(GLuint, GLshort, GLshort, GLshort, GLshort);
+glVertexAttrib4svNV(GLuint, const GLshort *);
+glVertexAttrib4ubNV(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
+glVertexAttrib4ubvNV(GLuint, const GLubyte *);
+
+glVertexAttribs1dvNV(GLuint, GLsizei, const GLdouble *);
+glVertexAttribs1fvNV(GLuint, GLsizei, const GLfloat *);
+glVertexAttribs1svNV(GLuint, GLsizei, const GLshort *);
+glVertexAttribs2dvNV(GLuint, GLsizei, const GLdouble *);
+glVertexAttribs2fvNV(GLuint, GLsizei, const GLfloat *);
+glVertexAttribs2svNV(GLuint, GLsizei, const GLshort *);
+glVertexAttribs3dvNV(GLuint, GLsizei, const GLdouble *);
+glVertexAttribs3fvNV(GLuint, GLsizei, const GLfloat *);
+glVertexAttribs3svNV(GLuint, GLsizei, const GLshort *);
+glVertexAttribs4dvNV(GLuint, GLsizei, const GLdouble *);
+glVertexAttribs4fvNV(GLuint, GLsizei, const GLfloat *);
+glVertexAttribs4svNV(GLuint, GLsizei, const GLshort *);
+glVertexAttribs4ubvNV(GLuint, GLsizei, const GLubyte *);
+**/
+
+
+/**
+ ** XXX also need to track evaluator coordinates (glutTeapot)
+ **/
+
+
+static void
+InitDispatchTable(SPUDispatchTable *t)
+{
+	crMemZero(t, sizeof(*t));
+	crSPUInitDispatchNops(t);
+  /* drm1 */
+	t->MatrixMode = (MatrixModeFunc_t)MatrixMode;
+	t->LoadIdentity = (LoadIdentityFunc_t)LoadIdentity;
+	t->LoadMatrixf = (LoadMatrixfFunc_t)LoadMatrixf;
+	t->LoadMatrixd = (LoadMatrixdFunc_t)LoadMatrixd;
+	t->PushMatrix = (PushMatrixFunc_t)PushMatrix;
+	t->PopMatrix = (PopMatrixFunc_t)PopMatrix;
+	t->MultMatrixf = (MultMatrixfFunc_t)MultMatrixf;
+	t->MultMatrixd = (MultMatrixdFunc_t)MultMatrixd;
+	t->Rotatef = (RotatefFunc_t)Rotatef;
+  t->Rotated = (RotatedFunc_t)Rotated;
+	t->Translatef = (TranslatefFunc_t)Translatef;
+	t->Translated = (TranslatedFunc_t)Translated;
+	t->Scalef = (ScalefFunc_t)Scalef;
+	t->Scaled = (ScaledFunc_t)Scaled;
+	t->Vertex2f = (Vertex2fFunc_t)Vertex2f;
+	t->Vertex2fv = (Vertex2fvFunc_t)Vertex2fv;
+	t->Vertex3f = (Vertex3fFunc_t)Vertex3f;
+	t->Vertex3fv = (Vertex3fvFunc_t)Vertex3fv;
+	t->Vertex4f = (Vertex4fFunc_t)Vertex4f;
+	t->Vertex4fv = (Vertex4fvFunc_t)Vertex4fv;
+	t->VertexAttrib3fARB = (VertexAttrib3fARBFunc_t)VertexAttrib3fARB;
+}
+
+
+void
+crDLMComputeBoundingBox(unsigned long listId)
+{
+	static GLboolean tableInitialized = GL_FALSE;
+	static SPUDispatchTable t;
+	CRDLMContextState *listState = CURRENT_STATE();
+	CRDLM *dlm = listState->dlm;
+	DLMListInfo *listInfo
+		= (DLMListInfo *) crHashtableSearch(dlm->displayLists, listId);
+
+	if (!tableInitialized) {
+		InitDispatchTable(&t);
+		crStateInitMatrixStack(&ModelViewStack, CR_MAX_MODELVIEW_STACK_DEPTH);
+		crStateInitMatrixStack(&DummyStack, CR_MAX_MODELVIEW_STACK_DEPTH);
+		tableInitialized = GL_TRUE;
+	}
+
+	CurrentStack = &ModelViewStack;
+
+	Xmin = Ymin = Zmin = FLT_MAX;
+	Xmax = Ymax = Zmax = -FLT_MAX;
+	
+	crDLMReplayDLMList(listState->dlm, listId, &t);
+
+	if (Xmin == FLT_MAX) {
+		/* XXX review this choice of default bounds */
+		/*
+		crDebug("Warning: no bounding box!");
+		*/
+		Xmin = -100;
+		Xmax =  100;
+		Ymin = -100;
+		Ymax =  100;
+		Zmin = -100;
+		Zmax =  100;
+	}
+	/*
+	crDebug("List %d bbox: %f, %f, %f .. %f, %f, %f", (int) listId,
+					Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
+	*/
+
+	listInfo->bbox.xmin = Xmin;
+	listInfo->bbox.ymin = Ymin;
+	listInfo->bbox.zmin = Zmin;
+	listInfo->bbox.xmax = Xmax;
+	listInfo->bbox.ymax = Ymax;
+	listInfo->bbox.zmax = Zmax;
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_calllist.c b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_calllist.c
new file mode 100644
index 0000000..7138c9d
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_calllist.c
@@ -0,0 +1,63 @@
+/* $Id: dlm_calllist.c $ */
+#include <stdio.h>
+#include "cr_spu.h"
+#include "cr_dlm.h"
+#include "cr_mem.h"
+#include "cr_error.h"
+#include "dlm.h"
+#include <VBox/VBoxUhgsmi.h>
+/* The headers and structures are still auto-generated */
+#include "dlm_generated.h"
+
+/* The CallList functions have a special implementation.  They aren't commonly
+ * listed as state-changers, but they can cause state to change.
+ */
+
+static void DLM_APIENTRY executeCallList(DLMInstanceList *x, SPUDispatchTable *dispatchTable)
+{
+	struct instanceCallList *instance = (struct instanceCallList *)x;
+	dispatchTable->CallList(instance->list);
+}
+void DLM_APIENTRY crDLMCompileCallList( GLuint list )
+{
+	struct instanceCallList *instance;
+	instance = crCalloc(sizeof(struct instanceCallList));
+	if (!instance) {
+		crdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY,
+			"out of memory adding CallList to display list");
+		return;
+	}
+	/* Put in the parameters */
+	instance->list = list;
+
+	/* Add to the display list correctly */
+	crdlm_add_to_list((DLMInstanceList *)instance, executeCallList);
+}
+
+/*** CallLists ***/
+static void DLM_APIENTRY executeCallLists(DLMInstanceList *x, SPUDispatchTable *dispatchTable)
+{
+	struct instanceCallLists *instance = (struct instanceCallLists *)x;
+	dispatchTable->CallLists(instance->n, instance->type, instance->lists);
+}
+void DLM_APIENTRY crDLMCompileCallLists( GLsizei n, GLenum type, const GLvoid * lists )
+{
+	struct instanceCallLists *instance;
+	instance = crCalloc(sizeof(struct instanceCallLists) + crdlm_pointers_CallLists(NULL, n, type, lists));
+	if (!instance) {
+		crdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY,
+			"out of memory adding CallLists to display list");
+		return;
+	}
+	instance->n = n;
+	instance->type = type;
+	if (lists == NULL) {
+		instance->lists = NULL;
+	}
+	else {
+		instance->lists = instance->listsData;
+	}
+	(void) crdlm_pointers_CallLists(instance, n, type, lists);
+
+	crdlm_add_to_list((DLMInstanceList *)instance, executeCallLists);
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_checklist.c b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_checklist.c
new file mode 100644
index 0000000..e631c02
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_checklist.c
@@ -0,0 +1,51 @@
+/* $Id: dlm_checklist.c $ */
+#include "cr_dlm.h"
+#include "cr_mem.h"
+#include "cr_pixeldata.h"
+#include "cr_string.h"
+#include "dlm.h"
+
+/*****************************************************************************
+ * These helper functions are used for GL functions that are listed in
+ * the APIspec.txt file as "checklist", meaning that sometimes they
+ * represent functions that can be stored in a display list, and sometimes
+ * they represent control functions that must be executed immediately.
+ *
+ * The calling SPU must use these check functions (or their equivalents)
+ * before asking the DLM to compile any elements of these types.
+ * They return nonzero (TRUE) if the element goes into a display list.
+ */
+
+int DLM_APIENTRY crDLMCheckListTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    return (target != GL_PROXY_TEXTURE_1D);
+}
+
+int DLM_APIENTRY crDLMCheckListCompressedTexImage1DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imagesize, const GLvoid *data)
+{
+    return (target != GL_PROXY_TEXTURE_1D);
+}
+int DLM_APIENTRY crDLMCheckListTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    return (target != GL_PROXY_TEXTURE_2D);
+}
+
+int DLM_APIENTRY crDLMCheckListCompressedTexImage2DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imagesize, const GLvoid *data)
+{
+    return (target != GL_PROXY_TEXTURE_2D);
+}
+
+int DLM_APIENTRY crDLMCheckListTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    return (target != GL_PROXY_TEXTURE_3D);
+}
+
+int DLM_APIENTRY crDLMCheckListTexImage3DEXT(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    return (target != GL_PROXY_TEXTURE_3D);
+}
+
+int DLM_APIENTRY crDLMCheckListCompressedTexImage3DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imagesize, const GLvoid *data)
+{
+    return (target != GL_PROXY_TEXTURE_3D);
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_error.c b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_error.c
new file mode 100644
index 0000000..90590e7
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_error.c
@@ -0,0 +1,56 @@
+/* $Id: dlm_error.c $ */
+#include <stdio.h>
+#include <stdarg.h>
+#include "chromium.h"
+#include "cr_mem.h"
+#include "dlm.h"
+#include "cr_environment.h"
+#include "cr_error.h"
+
+#define GLCLIENT_LIST_ALLOC 1024
+
+void crdlmWarning( int line, char *file, GLenum error, char *format, ... )
+{
+    char errstr[8096];
+    va_list args;
+
+    if (crGetenv("CR_DEBUG")) {
+	char *glerr;
+	va_start( args, format );
+	vsprintf( errstr, format, args );
+	va_end( args );
+
+	switch (error) {
+	    case GL_NO_ERROR:
+		glerr = "GL_NO_ERROR";
+		break;
+	    case GL_INVALID_VALUE:
+		glerr = "GL_INVALID_VALUE";
+		break;
+	    case GL_INVALID_ENUM:
+		glerr = "GL_INVALID_ENUM";
+		break;
+	    case GL_INVALID_OPERATION:
+		glerr = "GL_INVALID_OPERATION";
+		break;
+	    case GL_STACK_OVERFLOW:
+		glerr = "GL_STACK_OVERFLOW";
+		break;
+	    case GL_STACK_UNDERFLOW:
+		glerr = "GL_STACK_UNDERFLOW";
+		break;
+	    case GL_OUT_OF_MEMORY:
+		glerr = "GL_OUT_OF_MEMORY";
+		break;
+	    case GL_TABLE_TOO_LARGE:
+		glerr = "GL_TABLE_TOO_LARGE";
+		break;
+	    default:
+		glerr = "unknown";
+		break;
+	}
+
+	crWarning( "DLM error in %s, line %d: %s: %s\n",
+	    file, line, glerr, errstr );
+    }
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_generated.py b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_generated.py
new file mode 100644
index 0000000..27a306c
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_generated.py
@@ -0,0 +1,418 @@
+# $Id: dlm_generated.py $
+import sys, cPickle, re
+
+sys.path.append( "../glapi_parser" )
+import apiutil
+
+# A routine that can create call strings from instance names
+def InstanceCallString( params ):
+	output = ''
+	for index in range(0,len(params)):
+		if index > 0:
+			output += ", "
+		if params[index][0] != '':
+			output += 'instance->' + params[index][0]
+	return output
+
+def GetPointerType(basetype):
+	words = basetype.split()
+	if words[0] == 'const':
+		words = words[1:]
+	if words[-1].endswith('*'):
+		words[-1] = words[-1][:-1].strip()
+		if words[-1] == '':
+			words = words[:-1]
+	if words[0] == 'void' or words[0] == 'GLvoid':
+		words[0] = 'int'
+	return ' '.join(words)
+
+
+def GetPointerInfo(functionName):
+	# We'll keep track of all the parameters that require pointers.
+	# They'll require special handling later.
+	params = apiutil.Parameters(functionName)
+	pointers = []
+	pointername=''
+	pointerarg=''
+	pointertype=''
+	pointersize=0
+	pointercomment=''
+
+	index = 0
+	for (name, type, vecSize) in params:
+		# Watch out for the word "const" (which should be ignored)
+		# and for types that end in "*" (which are pointers and need
+		# special treatment)
+		words = type.split()
+		if words[-1].endswith('*'):
+			pointers.append(index)
+		index += 1
+
+	# If any argument was a pointer, we need a special pointer data
+	# array.  The pointer data will be stored into this array, and
+	# references to the array will be generated as parameters.
+	if len(pointers) == 1:
+		index = pointers[0]
+		pointername = params[index][0]
+		pointerarg = pointername + 'Data'
+		pointertype = GetPointerType(params[index][1])
+		pointersize = params[index][2]
+		if pointersize == 0:
+			pointersize = "special"
+	elif len(pointers) > 1:
+		pointerarg = 'data';
+		pointertype = GetPointerType(params[pointers[0]][1])
+		for index in range(1,len(pointers)):
+			if GetPointerType(params[pointers[index]][1]) != pointertype:
+				pointertype = 'GLvoid *'
+
+	return (pointers,pointername,pointerarg,pointertype,pointersize,pointercomment)
+
+def wrap_struct(functionName):
+	params = apiutil.Parameters(functionName)
+	argstring = apiutil.MakeDeclarationString(params)
+	extendedArgstring = argstring
+	props = apiutil.Properties(functionName)
+	if "useclient" in props or "pixelstore" in props:
+		extendedArgstring += ", CRClientState *c"
+
+	# We'll keep track of all the parameters that require pointers.
+	# They'll require special handling later.
+	(pointers, pointername, pointerarg, pointertype, pointersize, pointercomment) = GetPointerInfo(functionName)
+
+	# Start writing the header
+	print 'struct instance%s {' % (functionName)
+	print '	DLMInstanceList *next;'
+	print '	DLMInstanceList *stateNext;'
+	print '	int cbInstance;'
+	print '	void (DLM_APIENTRY *execute)(DLMInstanceList *instance, SPUDispatchTable *dispatchTable);'
+	for (name, type, vecSize) in params:
+		# Watch out for the word "const" (which should be ignored)
+		# and for types that end in "*" (which are pointers and need
+		# special treatment)
+		words = type.split()
+		if words[0] == 'const':
+			words = words[1:]
+		if words[0] != "void":
+			print '	%s %s;' % (' '.join(words), name)
+
+	# If any argument was a pointer, we need a special pointer data
+	# array.  The pointer data will be stored into this array, and
+	# references to the array will be generated as parameters.
+	if len(pointers) == 1:
+		if pointersize == None:
+			print "	/* Oh no - pointer parameter %s found, but no pointer class specified and can't guess */" % pointername
+		else:
+			if pointersize == 'special':
+				print '	%s %s[1];%s' % (pointertype, pointerarg, pointercomment)
+			else:
+				print '	%s %s[%s];%s' % (pointertype, pointerarg, pointersize,pointercomment)
+	elif len(pointers) > 1:
+		print '	%s %s[1];%s' % (pointertype, pointerarg,pointercomment)
+
+	print '};'
+
+	# Pointers only happen with instances
+	if len(pointers) > 1 or (len(pointers) == 1 and pointersize == 'special'):
+		print 'int crdlm_pointers_%s(struct instance%s *instance, %s);' % (functionName, functionName, extendedArgstring)
+		
+	# See if the GL function must sometimes allow passthrough even
+	# if the display list is open
+	if "checklist" in apiutil.ChromiumProps(functionName):
+		print 'int crdlm_checklist_%s(%s);' % (functionName, argstring)
+
+	return
+
+def wrap_execute(functionName):
+	params = apiutil.Parameters(functionName)
+	print 'static void execute%s(DLMInstanceList *x, SPUDispatchTable *dispatchTable)' % functionName
+	print '{'
+	if len(params) > 0:
+	    print '\tstruct instance%s *instance = (struct instance%s *)x;' % (functionName, functionName)
+	print '\tif (dispatchTable->%s != NULL) {' % (functionName)
+	print '\t\tdispatchTable->%s(%s);' % (functionName, InstanceCallString(params))
+	print '\t}'
+	print '\telse {'
+	print '\t\tcrWarning("DLM warning: execute%s called with NULL dispatch entry");' % (functionName)
+	print '\t}'
+	print '}'
+
+def generate_bbox_code(functionName):
+	assert functionName[0:6] == "Vertex"
+	pattern = "(VertexAttribs|VertexAttrib|Vertex)(1|2|3|4)(N?)(f|d|i|s|b|ub|us|ui)(v?)"
+	m = re.match(pattern, functionName)
+	if m:
+		name = m.group(1)
+		size = int(m.group(2))
+		normalize = m.group(3)
+		type = m.group(4)
+		vector = m.group(5)
+
+		# only update bbox for vertex attribs if index == 0
+		if name == "VertexAttrib":
+			test = "if (index == 0) {"
+		elif name == "VertexAttribs":
+			test = "if (index == 0) {"
+		else:
+			assert name == "Vertex"
+			test = "{"
+
+		# find names of the X, Y, Z, W values
+		xName = ""
+		yName = ""
+		zName = "0.0"
+		wName = ""
+		if vector == "v":
+			xName = "v[0]"
+			if size > 1:
+				yName = "v[1]"
+			if size > 2:
+				zName = "v[2]"
+			if size > 3:
+				wName = "v[3]"
+		else:
+			xName = "x"
+			if size > 1:
+				yName = "y"
+			if size > 2:
+				zName = "z"
+			if size > 3:
+				wName = "w"
+
+		# start emitting code
+		print '\t%s' % test
+
+		if normalize == "N":
+			if type == "b":
+				denom = "128.0f"
+			elif type == "s":
+				denom = "32768.0f"
+			elif type == "i":
+				denom = "2147483647.0f"
+			elif type == "ub":
+				denom = "255.0f"
+			elif type == "us":
+				denom = "65535.0f"
+			elif type == "ui":
+				denom = "4294967295.0f"
+			
+			print '\t\tGLfloat nx = (GLfloat) %s / %s;' % (xName, denom)
+			xName = "nx"
+			if yName:
+				print '\t\tGLfloat ny = (GLfloat) %s / %s;' % (yName, denom)
+				yName = "ny"
+			if zName:
+				print '\t\tGLfloat nz = (GLfloat) %s / %s;' % (zName, denom)
+				zName = "nz"
+			if 0 and wName:
+				print '\t\tGLfloat nw = (GLfloat) %s / %s;' % (wName, denom)
+				wName = "nw"
+
+		if xName:
+			print '\t\tif (%s < state->currentListInfo->bbox.xmin)' % xName
+			print '\t\t\tstate->currentListInfo->bbox.xmin = %s;' % xName
+			print '\t\tif (%s > state->currentListInfo->bbox.xmax)' % xName
+			print '\t\t\tstate->currentListInfo->bbox.xmax = %s;' % xName
+		if yName:
+			print '\t\tif (%s < state->currentListInfo->bbox.ymin)' % yName
+			print '\t\t\tstate->currentListInfo->bbox.ymin = %s;' % yName
+			print '\t\tif (%s > state->currentListInfo->bbox.ymax)' % yName
+			print '\t\t\tstate->currentListInfo->bbox.ymax = %s;' % yName
+		if zName:
+			print '\t\tif (%s < state->currentListInfo->bbox.zmin)' % zName
+			print '\t\t\tstate->currentListInfo->bbox.zmin = %s;' % zName
+			print '\t\tif (%s > state->currentListInfo->bbox.zmax)' % zName
+			print '\t\t\tstate->currentListInfo->bbox.zmax = %s;' % zName
+		# XXX what about divide by W if we have 4 components?
+		print '\t}'
+			
+	else:
+		print ' /* bbox error for %s !!!!! */' % functionName
+
+# These code snippets isolate the code required to add a given instance
+# to the display list correctly.  They are used during generation, to
+# generate correct code, and also to create useful utilities.
+def AddInstanceToList(pad):
+    print '%s/* Add this instance to the current display list. */' % pad
+    print '%sinstance->next = NULL;' % pad
+    print '%sinstance->stateNext = NULL;' % pad
+    print '%sif (!state->currentListInfo->first) {' % pad
+    print '%s\tstate->currentListInfo->first = (DLMInstanceList *)instance;' % pad
+    print '%s}' % pad
+    print '%selse {' % pad
+    print '%s\tstate->currentListInfo->last->next = (DLMInstanceList *)instance;' % pad
+    print '%s}' % pad
+    print '%sstate->currentListInfo->last = (DLMInstanceList *)instance;' % pad
+    print '%sstate->currentListInfo->numInstances++;' % pad
+
+def AddInstanceToStateList(pad):
+    print '%s/* Instances that change state have to be added to the state list as well. */' % pad
+    print '%sif (!state->currentListInfo->stateFirst) {' % pad
+    print '%s\tstate->currentListInfo->stateFirst = (DLMInstanceList *)instance;' % pad
+    print '%s}' % pad
+    print '%selse {' % pad
+    print '%s\tstate->currentListInfo->stateLast->stateNext = (DLMInstanceList *)instance;' % pad
+    print '%s}' % pad
+    print '%sstate->currentListInfo->stateLast = (DLMInstanceList *)instance;' % pad
+
+
+# The compile wrapper collects the parameters into a DLMInstanceList
+# element, and adds that element to the end of the display list currently
+# being compiled.
+def wrap_compile(functionName):
+	params = apiutil.Parameters(functionName)
+	return_type = apiutil.ReturnType(functionName)
+	# Make sure the return type is void.  It's nonsensical to compile
+	# an element with any other return type.
+	if return_type != 'void':
+		print '/* Nonsense: DL function %s has a %s return type?!? */' % (functionName, return_type)
+	#	return
+	# Define a structure to hold all the parameters.  Note that the
+	# top parameters must exactly match the DLMInstanceList structure
+	# in include/cr_dlm.h, or everything will break horribly.
+	# Start off by getting all the pointer info we could ever use
+	# from the parameters
+	(pointers, pointername, pointerarg, pointertype, pointersize, pointercomment) = GetPointerInfo(functionName)
+
+	# Finally, the compile wrapper.  This one will diverge strongly
+	# depending on whether or not there are pointer parameters. 
+	callstring = apiutil.MakeCallString(params)
+	argstring = apiutil.MakeDeclarationString(params)
+	props = apiutil.Properties(functionName)
+	if "useclient" in props or "pixelstore" in props:
+		callstring += ", c"
+		argstring += ", CRClientState *c"
+	print 'void DLM_APIENTRY crDLMCompile%s( %s )' % (functionName, argstring)
+	print '{'
+	print '	CRDLMContextState *state = CURRENT_STATE();'
+	print '	struct instance%s *instance;' % (functionName)
+	
+	# The calling SPU is supposed to verify that the element is supposed to be
+	# compiled before it is actually compiled; typically, this is done based
+	# on whether a glNewList has been executed more recently than a glEndList.
+	# But some functions are dual-natured, sometimes being compiled, and sometimes
+	# being executed immediately.  We can check for this here.
+	if "checklist" in apiutil.ChromiumProps(functionName):
+	    print '\tif (crDLMCheckList%s(%s)) {' % (functionName, apiutil.MakeCallString(params))
+	    print '\t\tcrdlm_error(__LINE__, __FILE__, GL_INVALID_OPERATION,'
+	    print '\t\t    "this instance of function %s should not be compiled");' % functionName;
+	    print '\t\treturn;'
+	    print '\t}'
+
+	if len(pointers) > 1 or pointersize == 'special':
+		# Pass NULL, to just allocate space
+		print '\tinstance = crCalloc(sizeof(struct instance%s) + crdlm_pointers_%s(NULL, %s));' % (functionName, functionName, callstring)
+	else:
+		print '\tinstance = crCalloc(sizeof(struct instance%s));' % (functionName)
+	print '\tif (!instance) {'
+	print '\t\tcrdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY,'
+	print '\t\t\t"out of memory adding %s to display list");' % (functionName)
+	print '\t\treturn;'
+	print '\t}'
+
+	# Put in the fields that must always exist
+	print '\tinstance->execute = execute%s;' % functionName
+
+	# Apply all the simple (i.e. non-pointer) parameters
+	for index in range(len(params)):
+		if index not in pointers:
+			name = params[index][0]
+			print '\tinstance->%s = %s;' % (name, name)
+	
+	# We need to know instance size in bytes in order to save its state later.
+	print '\tinstance->cbInstance = sizeof(struct instance%s);' % functionName
+	
+	# If there's a pointer parameter, apply it.
+	if len(pointers) == 1:
+		print '\tif (%s == NULL) {' % (params[pointers[0]][0])
+		print '\t\tinstance->%s = NULL;' % (params[pointers[0]][0])
+		print '\t}'
+		print '\telse {'
+		print '\t\tinstance->%s = instance->%s;' % (params[pointers[0]][0], pointerarg)
+		print '\t}'
+		if pointersize == 'special':
+			print '\tinstance->cbInstance += crdlm_pointers_%s(instance, %s);' % (functionName, callstring)
+		else:
+			print '\tcrMemcpy((void *)instance->%s, (void *) %s, %s*sizeof(%s));' % (params[pointers[0]][0], params[pointers[0]][0], pointersize, pointertype)
+	elif len(pointers) == 2:
+		# this seems to work
+		print '\tinstance->cbInstance += crdlm_pointers_%s(instance, %s);' % (functionName, callstring)
+	elif len(pointers) > 2:
+		print "#error don't know how to handle pointer parameters for %s" % (functionName)
+	
+	# Add the element to the current display list
+	AddInstanceToList('\t')
+	# If the element is a state-changing element, add it to the current state list
+	if apiutil.SetsTrackedState(functionName):
+	    AddInstanceToStateList('\t')
+
+	# XXX might need a better test here
+	if functionName[0:6] == "Vertex":
+		generate_bbox_code(functionName)
+
+	print '}'
+
+whichfile=sys.argv[1]
+if whichfile == 'headers':
+    print """#ifndef _DLM_GENERATED_H
+#define _DLM_GENERATED_H
+
+/* DO NOT EDIT.  This file is auto-generated by dlm_generated.py. */
+"""
+else:
+    print """#include <stdio.h>
+#include "cr_spu.h"
+#include "cr_dlm.h"
+#include "cr_mem.h"
+#include "cr_error.h"
+#include "state/cr_statefuncs.h"
+#include "dlm.h"
+#include "dlm_pointers.h"
+#include "dlm_generated.h"
+
+/* DO NOT EDIT.  This file is auto-generated by dlm_generated.py. */
+"""
+
+# Add in the "add_to_dl" utility function, which will be used by
+# external (i.e. non-generated) functions.  The utility ensures that 
+# any external functions that are written for compiling elements
+# don't have to be rewritten if the conventions for adding to display
+# lists are changed.
+print """
+void crdlm_add_to_list(
+    DLMInstanceList *instance,
+    void (*executeFunc)(DLMInstanceList *x, SPUDispatchTable *dispatchTable)"""
+
+if (whichfile == 'headers'):
+    print ");"
+else:
+    print """) {
+    CRDLMContextState *state = CURRENT_STATE();
+    instance->execute = executeFunc;"""
+
+    # Add in the common code for adding the instance to the display list
+    AddInstanceToList("    ")
+
+    print '}'
+    print ''
+
+# Now generate the functions that won't use the crdlm_add_to_list utility.
+# These all directly add their own instances to the current display list
+# themselves, without using the crdlm_add_to_list() function.
+keys = apiutil.GetDispatchedFunctions(sys.argv[3]+"/APIspec.txt")
+for func_name in keys:
+	if apiutil.CanCompile(func_name):
+		print "\n/*** %s ***/" % func_name
+		# Auto-generate an appropriate DL function.  First, functions
+		# that go into the display list but that rely on state will
+		# have to have their argument strings expanded, to take pointers 
+		# to that appropriate state.
+		if whichfile == "headers":
+		    wrap_struct(func_name)
+		elif not apiutil.FindSpecial("dlm", func_name):
+		    wrap_execute(func_name)
+		    wrap_compile(func_name)
+		# All others just pass through
+
+if whichfile == 'headers':
+    print "#endif /* _DLM_GENERATED_H */"
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_header.py b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_header.py
new file mode 100644
index 0000000..703a18e
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_header.py
@@ -0,0 +1,265 @@
+# $Id: dlm_header.py $
+import sys, cPickle, re, os
+
+sys.path.append( "../glapi_parser" )
+import apiutil
+
+# mode is "header" or "defs"
+mode = sys.argv[1]
+
+# Any new function implemented in the DLM has to have an entry added here.
+# Each function has its return type, function name, and parameters provided.
+# We'll use these to generate both a header file, and a definition file.
+additionalFunctions = [
+	('CRDLM DLM_APIENTRY *', 'crDLMNewDLM', 'unsigned int configSize, const CRDLMConfig *config'),
+	('CRDLMContextState DLM_APIENTRY *', 'crDLMNewContext', 'CRDLM *dlm'),
+	('void DLM_APIENTRY', 'crDLMFreeContext', 'CRDLMContextState *state'),
+	('void DLM_APIENTRY', 'crDLMUseDLM', 'CRDLM *dlm'),
+	('void DLM_APIENTRY','crDLMFreeDLM', 'CRDLM *dlm'),
+	('void DLM_APIENTRY', 'crDLMSetCurrentState', 'CRDLMContextState *state'),
+	('CRDLMContextState DLM_APIENTRY *', 'crDLMGetCurrentState', 'void'),
+	('CRDLMReplayState DLM_APIENTRY', 'crDLMGetReplayState', 'void'),
+	('void DLM_APIENTRY', 'crDLMSetupClientState', 'SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMRestoreClientState', 'CRClientState *clientState, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMSendAllDLMLists', 'CRDLM *dlm, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMSendAllLists', 'SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMSendDLMList', 'CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMSendList', 'unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMReplayDLMList', 'CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMReplayList', 'unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMReplayDLMListState', 'CRDLM *dlm, unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMReplayListState', 'unsigned long listIdentifier, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMReplayDLMLists', 'CRDLM *dlm, GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMReplayLists', 'GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMReplayDLMListsState', 'CRDLM *dlm, GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable'),
+	('void DLM_APIENTRY', 'crDLMReplayListsState', 'GLsizei n, GLenum type, const GLvoid *lists, SPUDispatchTable *dispatchTable'),
+	('CRDLMError DLM_APIENTRY', 'crDLMDeleteListContent', 'CRDLM *dlm, unsigned long listIdentifier'),
+	('int DLM_APIENTRY', 'crDLMGetReferences', 'CRDLM *dlm, unsigned long listIdentifier, int firstIndex, int sizeofBuffer, unsigned int *buffer'),
+	('CRDLMError DLM_APIENTRY', 'crDLMGetDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier, CRDLMBounds *bounds'),
+	('CRDLMError DLM_APIENTRY', 'crDLMGetBounds', 'unsigned long listIdentifier, CRDLMBounds *bounds'),
+	('void DLM_APIENTRY', 'crDLMSetDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax'),
+	('void DLM_APIENTRY', 'crDLMSetBounds', 'unsigned long listIdentifier, double xmin, double ymin, double zmin, double xmax, double ymax, double zmax'),
+	('void DLM_APIENTRY', 'crDLMComputeBoundingBox', 'unsigned long listId'),
+	('GLboolean DLM_APIENTRY', 'crDLMListHasDLMBounds', 'CRDLM *dlm, unsigned long listIdentifier'),
+	('GLboolean DLM_APIENTRY', 'crDLMListHasBounds', 'unsigned long listIdentifier'),
+	('GLuint DLM_APIENTRY', 'crDLMGetCurrentList', 'void'),
+	('GLenum DLM_APIENTRY', 'crDLMGetCurrentMode', 'void'),
+	('void DLM_APIENTRY', 'crDLMErrorFunction', 'CRDLMErrorCallback callback'),
+	('void DLM_APIENTRY', 'crDLMNewList', 'GLuint listIdentifier, GLenum mode'),
+	('void DLM_APIENTRY', 'crDLMEndList', 'void'),
+	('void DLM_APIENTRY', 'crDLMDeleteLists', 'GLuint firstListIdentifier, GLsizei range'),
+	('GLboolean DLM_APIENTRY', 'crDLMIsList', 'GLuint list'),
+	('GLuint DLM_APIENTRY', 'crDLMGenLists', 'GLsizei range'),
+	('void DLM_APIENTRY', 'crDLMListBase', 'GLuint base'),
+	('int32_t DLM_APIENTRY', 'crDLMSaveState', 'void'),
+	#('void DLM_APIENTRY', 'crDLMListSent', 'CRDLM *dlm, unsigned long listIdentifier'),
+	#('GLboolean DLM_APIENTRY', 'crDLMIsListSent', 'CRDLM *dlm, unsigned long listIdentifier'),
+	#('GLint DLM_APIENTRY', 'crDLMListSize', 'CRDLM *dlm, unsigned long listIdentifier'),
+]
+
+if mode == 'header':
+	print """#ifndef CR_DLM_H
+
+/* DO NOT EDIT.  This file is auto-generated by %s. */
+#define CR_DLM_H
+
+#if defined(WINDOWS)
+#define DLM_APIENTRY
+#else
+#define DLM_APIENTRY
+#endif
+
+#include "chromium.h"
+#include "state/cr_client.h"
+#include "cr_spu.h"
+#include "cr_hash.h"
+#include "cr_threads.h"
+#include "cr_pack.h"
+#ifdef CHROMIUM_THREADSAFE
+#include "cr_threads.h"
+#endif
+
+/* 3D bounding box */
+typedef struct {
+	double xmin, xmax, ymin, ymax, zmin, zmax;
+} CRDLMBounds;
+
+/* Indicates whether we're currently involved in playback or not */
+typedef enum {
+	CRDLM_IMMEDIATE = 0,
+	CRDLM_REPLAY_STATE_FUNCTIONS = 1,
+	CRDLM_REPLAY_ALL_FUNCTIONS = 2
+} CRDLMReplayState;
+
+/* This is enough information to hold an instance of a single function call. */
+typedef struct DLMInstanceList {
+	struct DLMInstanceList *next;
+	struct DLMInstanceList *stateNext;
+	int    cbInstance;
+	void (*execute)(struct DLMInstanceList *instance, SPUDispatchTable *dispatchTable);
+} DLMInstanceList;
+
+typedef struct {
+	DLMInstanceList *first, *last;
+	int numInstances;
+	DLMInstanceList *stateFirst, *stateLast;
+	CRHashTable *references; /* display lists that this display list calls */
+	CRDLMBounds bbox;
+	GLboolean listSent;
+} DLMListInfo;
+
+typedef struct {
+	/* This holds all the display list information, hashed by list identifier. */
+	CRHashTable *displayLists;
+
+	/* This is a count of the number of contexts/users that are using
+	 * this DLM.
+	 */
+	unsigned int userCount;
+
+#ifdef CHROMIUM_THREADSAFE
+	/* This mutex protects the displayLists hash table from simultaneous
+	 * updates by multiple contexts.
+	 */
+	CRmutex dlMutex;
+	CRtsd tsdKey;
+#endif
+
+	/* Configuration information - see the CRDLMConfig structure below
+	 * for details.
+	 */
+	unsigned int bufferSize;
+} CRDLM;
+
+/* This structure holds thread-specific state.  Each thread can be
+ * associated with one (and only one) context; and each context can
+ * be associated with one (and only one) DLM.  Making things interesting,
+ * though, is that each DLM can be associated with multiple contexts.
+ *
+ * So the thread-specific data key is associated with each context, not
+ * with each DLM.  Two different threads can, through two different
+ * contexts that share a single DLM, each have independent state and
+ * conditions.
+ */
+
+typedef struct {
+	CRDLM *dlm;			/* the DLM associated with this state */
+	unsigned long currentListIdentifier;	/* open display list */
+	DLMListInfo *currentListInfo;	/* open display list data */
+	GLenum currentListMode;		/* GL_COMPILE or GL_COMPILE_AND_EXECUTE */
+	GLuint listBase;
+	CRDLMReplayState replayState;	/* CRDLM_IMMEDIATE, CRDLM_REPLAY_STATE_FUNCTIONS, or CRDLM_REPLAY_ALL_FUNCTIONS */
+
+} CRDLMContextState;
+
+/* These additional structures are for passing information to and from the 
+ * CRDLM interface routines.
+ */
+typedef struct {
+	/* The size, in bytes, that the packer will initially allocate for
+	 * each new buffer.
+	 */
+#define CRDLM_DEFAULT_BUFFERSIZE (1024*1024)
+	unsigned int bufferSize;	/* this will be allocated for each buffer */
+} CRDLMConfig;
+
+/* Positive values match GL error values.
+ * 0 (GL_NO_ERROR) is returned for success
+ * Negative values are internal errors.
+ * Possible positive values (from GL/gl.h) are:
+ * GL_NO_ERROR (0x0)
+ * GL_INVALID_ENUM (0x0500)
+ * GL_INVALID_VALUE (0x0501)
+ * GL_INVALID_OPERATION (0x0502)
+ * GL_STACK_OVERFLOW (0x0503)
+ * GL_STACK_UNDERFLOW (0x0504)
+ * GL_OUT_OF_MEMORY (0x0505)
+ */
+typedef int CRDLMError;
+
+/* This error reported if there's no current state. The caller is responsible
+ * for appropriately allocating context state with crDLMNewContext(), and
+ * for making it current with crDLMMakeCurrent().
+ */
+#define CRDLM_ERROR_STATE	(-1)
+
+
+typedef void (*CRDLMErrorCallback)(int line, const char *file, GLenum error, const char *info);
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+""" % os.path.basename(sys.argv[0])
+elif mode == 'defs':
+	apiutil.CopyrightDef()
+	print '''\t; DO NOT EDIT.  This code is generated by %s.
+
+EXPORTS''' % os.path.basename(sys.argv[0])
+else:
+	raise "unknown generation mode '%s'" % mode
+
+# Generate the list of functions, starting with those coded into
+# the module
+for (returnValue, name, parameters) in additionalFunctions:
+	if mode == 'header':
+		print "extern %s %s(%s);" % (returnValue, name, parameters)
+	elif mode == 'defs':
+		print "%s" % name
+
+# Continue with functions that are auto-generated.
+
+if mode == 'header':
+	print 
+	print "/* auto-generated compilation functions begin here */"
+
+
+keys = apiutil.GetDispatchedFunctions(sys.argv[2]+"/APIspec.txt")
+for func_name in keys:
+	props = apiutil.Properties(func_name)
+	# We're interested in intercepting all calls that:
+	#   - can be put into a display list (i.e. "not ("nolist" in props)")
+	#   - change client-side state that affects saving DL elements (i.e. "setclient" in props)
+
+	if apiutil.CanCompile(func_name):
+		params = apiutil.Parameters(func_name)
+		argstring = apiutil.MakeDeclarationString(params)
+		if "useclient" in props or "pixelstore" in props:
+			argstring = argstring + ", CRClientState *c"
+
+		if mode == 'header':
+			print 'extern void DLM_APIENTRY crDLMCompile%s( %s );' % (func_name, argstring)
+		elif mode == 'defs':
+			print "crDLMCompile%s" % func_name
+
+# Next make declarations for all the checklist functions.
+if mode == 'header':
+	print """
+/* auto-generated CheckList functions begin here.  There is one for each
+ * function that has a dual nature: even when there's an active glNewList,
+ * sometimes they are compiled into the display list, and sometimes they
+ * are treated like a control function.  The CheckList function will
+ * return TRUE if the function should really be compiled into a display
+ * list.  The calling SPU is responsible for checking this; but the
+ * DLM will also print an error if it detects an invalid use.
+ */
+"""
+elif mode == 'defs':
+	pass
+
+for func_name in keys:
+	if "checklist" in apiutil.ChromiumProps(func_name):
+		params = apiutil.Parameters(func_name)
+		argstring = apiutil.MakeDeclarationString(params)
+		if mode == 'header':
+			print 'int DLM_APIENTRY crDLMCheckList%s( %s );' % (func_name, argstring)
+		elif mode == 'defs':
+			print "crDLMCheckList%s" % func_name
+
+if mode == 'header':
+	print """
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CR_DLM_H */"""
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_lists.c b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_lists.c
new file mode 100644
index 0000000..4c3e473
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_lists.c
@@ -0,0 +1,275 @@
+/* $Id: dlm_lists.c $ */
+#include <float.h>
+#include "cr_dlm.h"
+#include "cr_mem.h"
+#include "dlm.h"
+
+
+
+/* This file defines the display list functions such as NewList, EndList,
+ * IsList, DeleteLists, etc.
+ * Generally, SPUs will call these as needed to implement display lists.
+ * See the expando, replicate, and tilesort SPUs for examples.
+ *
+ * The functions which compile GL functions into our display lists are named:
+ *     void DLM_APIENTRY crdlm_<function name>
+ * where <function_name> is the Chromium function name (which in 
+ * turn is the GL function name with the "gl" prefix removed).
+ *
+ * All these entry points require that a CRDLMContextState structure
+ * be created (with crDLMNewContext()) and assigned to the current
+ * thread (with crDLMSetCurrentState()).
+ */
+
+
+/*
+ * Begin compiling a list.
+ */
+void DLM_APIENTRY
+crDLMNewList(GLuint listIdentifier, GLenum mode)
+{
+    DLMListInfo *listInfo;
+    CRDLMContextState *listState = CURRENT_STATE();
+
+    /* Error checks: 0 is not a valid identifier, and
+     * we can't call NewList if NewList has been called
+     * more recently than EndList.
+     *
+     * The caller is expected to check for an improper
+     * mode parameter (GL_INVALID_ENUM), or for a NewList
+     * within a glBegin/glEnd (GL_INVALID_OPERATION).
+     */
+    if (listState == NULL)
+    {
+	crWarning("DLM error: NewList(%d,%d) called with no current state (%s line %d)\n",
+	    (int) listIdentifier, (int) mode, __FILE__, __LINE__);
+	return;
+    }
+
+    if (listIdentifier == 0)
+    {
+	crdlm_error(__LINE__, __FILE__, GL_INVALID_VALUE,
+	     "NewList called with a list identifier of 0");
+	return;
+    }
+
+    if (listState->currentListInfo != NULL)
+    {
+	char msg[1000];
+	sprintf(msg, "NewList called with display list %d while display list %d was already open",
+	    (int) listIdentifier, (int) listState->currentListIdentifier);
+	crdlm_error(__LINE__, __FILE__, GL_INVALID_OPERATION, msg);
+	return;
+    }
+
+    listInfo = (DLMListInfo *) crCalloc(sizeof(DLMListInfo));
+    if (!(listInfo))
+    {
+	char msg[1000];
+	sprintf(msg, "could not allocate %u bytes of memory in NewList",
+	    (unsigned) sizeof(DLMListInfo));
+	crdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY, msg);									 
+	return;
+    }
+
+    listInfo->first = listInfo->last = NULL;
+    listInfo->stateFirst = listInfo->stateLast = NULL;
+    listInfo->references = crAllocHashtable();
+    if (!(listInfo->references))
+    {
+	crFree(listInfo);
+	crdlm_error(__LINE__, __FILE__, GL_OUT_OF_MEMORY,
+	    "could not allocate memory in NewList");
+	return;
+    }
+    listInfo->numInstances = 0;
+    listInfo->listSent = GL_FALSE;
+    listInfo->bbox.xmin = FLT_MAX;
+    listInfo->bbox.xmax = -FLT_MAX;
+    listInfo->bbox.ymin = FLT_MAX;
+    listInfo->bbox.ymax = -FLT_MAX;
+    listInfo->bbox.zmin = FLT_MAX;
+    listInfo->bbox.zmax = -FLT_MAX;
+
+    listState->currentListInfo = listInfo;
+    listState->currentListIdentifier = listIdentifier;
+    listState->currentListMode = mode;
+}
+
+
+/* This small utility routine is used to traverse a buffer
+ * list, freeing each buffer.  It is used to free the buffer
+ * list in the DLMListInfo structure, both when freeing the
+ * entire structure and when freeing just the retained content.
+ */
+static void free_instance_list(DLMInstanceList * instance)
+{
+	while (instance)
+	{
+		DLMInstanceList *nextInstance = instance->next;
+		crFree(instance);
+		instance = nextInstance;
+	}
+}
+
+/* This utility routine frees a DLMListInfo structure and all
+ * of its components.  It is used directly, when deleting a
+ * single list; it is also used as a callback function for
+ * hash tree operations (Free and Replace).
+ *
+ * The parameter is listed as a (void *) instead of a (DLMListInfo *)
+ * in order that the function can be used as a callback routine for
+ * the hash table functions.  The (void *) designation causes no
+ * other harm, save disabling type-checking on the pointer argument
+ * of the function.
+ */
+void crdlm_free_list(void *parm)
+{
+	DLMListInfo *listInfo = (DLMListInfo *) parm;
+
+	free_instance_list(listInfo->first);
+	listInfo->first = listInfo->last = NULL;
+
+	/* The references list has no allocated information; it's
+	 * just a set of entries.  So we don't need to free any
+	 * information as each entry is deleted.
+	 */
+	crFreeHashtable(listInfo->references, NULL);
+
+	crFree(listInfo);
+}
+
+
+void DLM_APIENTRY crDLMEndList(void)
+{
+    CRDLMContextState *listState = CURRENT_STATE();
+
+    /* Error check: cannot call EndList without a (successful)
+     * preceding NewList.
+     *
+     * The caller is expected to check for glNewList within
+     * a glBegin/glEnd sequence.
+     */
+    if (listState == NULL)
+    {
+	crWarning("DLM error: EndList called with no current state (%s line %d)\n",
+	    __FILE__, __LINE__);
+	return;
+    }
+    if (listState->currentListInfo == NULL)
+    {
+	crdlm_error(__LINE__, __FILE__, GL_INVALID_OPERATION,
+	    "EndList called while no display list was open");
+	return;
+    }
+
+    DLM_LOCK(listState->dlm)
+
+    /* This function will either replace the list information that's
+     * already present with our new list information, freeing the
+     * former list information; or will add the new information
+     * to the set of display lists, depending on whether the
+     * list already exists or not.
+     */
+    crHashtableReplace(listState->dlm->displayLists,
+	listState->currentListIdentifier,
+	listState->currentListInfo, crdlm_free_list);
+
+    DLM_UNLOCK(listState->dlm)
+
+    /* reset the current state to show the list had been ended */
+    listState->currentListIdentifier = 0;
+    listState->currentListInfo = NULL;
+    listState->currentListMode = GL_FALSE;
+}
+
+
+void DLM_APIENTRY crDLMDeleteLists(GLuint firstListIdentifier, GLsizei range)
+{
+	CRDLMContextState *listState = CURRENT_STATE();
+	register int i;
+
+	if (listState == NULL)
+	{
+		crWarning
+			("DLM error: DeleteLists(%d,%d) called with no current state (%s line %d)\n",
+			 (int) firstListIdentifier, (int) range, __FILE__, __LINE__);
+		return;
+	}
+	if (range < 0)
+	{
+		char msg[1000];
+		sprintf(msg, "DeleteLists called with range (%d) less than zero", (int) range);
+		crdlm_error(__LINE__, __FILE__, GL_INVALID_VALUE, msg);								 
+		return;
+	}
+
+	/* Interestingly, there doesn't seem to be an error for deleting
+	 * display list 0, which cannot exist.
+	 *
+	 * We could delete the desired lists by walking the entire hash of
+	 * display lists and looking for and deleting any in our range; or we
+	 * could delete lists one by one.  The former is faster if the hashing
+	 * algorithm is inefficient or if we're deleting all or most of our
+	 * lists; the latter is faster if we're deleting a relatively small
+	 * number of lists.
+	 *
+	 * For now, we'll go with the latter; it's also easier to implement
+	 * given the current functions available.
+	 */
+	DLM_LOCK(listState->dlm)
+	for (i = 0; i < range; i++)
+	{
+		crHashtableDelete(listState->dlm->displayLists, 
+				  firstListIdentifier + i, crdlm_free_list);
+	}
+	DLM_UNLOCK(listState->dlm)
+}
+
+GLboolean DLM_APIENTRY crDLMIsList(GLuint list)
+{
+	CRDLMContextState *listState = CURRENT_STATE();
+
+	if (listState == NULL)
+	{
+		crWarning
+			("DLM error: IsLists(%d) called with no current state (%s line %d)\n",
+			 (int) list, __FILE__, __LINE__);
+		return 0;
+	}
+
+	if (list == 0)
+		return GL_FALSE;
+
+	return crHashtableIsKeyUsed(listState->dlm->displayLists, list);
+}
+
+GLuint DLM_APIENTRY crDLMGenLists(GLsizei range)
+{
+	CRDLMContextState *listState = CURRENT_STATE();
+
+	if (listState == NULL)
+	{
+		crWarning
+			("DLM error: GenLists(%d) called with no current state (%s line %d)\n",
+			 (int) range, __FILE__, __LINE__);
+		return 0;
+	}
+
+	return crHashtableAllocKeys(listState->dlm->displayLists, range);
+}
+
+void DLM_APIENTRY crDLMListBase( GLuint base )
+{
+	CRDLMContextState *listState = CURRENT_STATE();
+
+	if (listState == NULL)
+	{
+		crWarning
+			("DLM error: ListBase(%d) called with no current state (%s line %d)\n",
+			 (int) base, __FILE__, __LINE__);
+		return;
+	}
+
+	listState->listBase = base;
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_pointers.c b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_pointers.c
new file mode 100644
index 0000000..718ebde
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_pointers.c
@@ -0,0 +1,1125 @@
+/* $Id: dlm_pointers.c $ */
+#include "cr_dlm.h"
+#include "cr_mem.h"
+#include "cr_pixeldata.h"
+#include "cr_string.h"
+#include "dlm.h"
+#include "dlm_pointers.h"
+
+/**
+ * These helper functions are used for GL functions that take a pointers,
+ * if the size of the arrays that the pointers refer to is not constant.
+ * These helper functions will determine, on a case-by-case basis,
+ * how much space is needed to store the array.  If the buffer 
+ * parameter is not NULL, they will also pack the data into the given
+ * array.
+ *
+ * Many of the functions included deal with pixel state (Bitmap, DrawPixels,
+ * etc.).  In all these cases, when the function instance is stored in a
+ * display list, its data is read from memory (as per the parameters
+ * to PixelStore) and is stored in a tightly packed format (with no
+ * excess row length, no pixels skipped, no rows, skipped, and a byte
+ * alignment).
+ *
+ * When the instances are executed again, care must be taken to ensure
+ * that the PixelStore client state that unpacks them is set to reflect
+ * the tight packing actually used, instead of whatever the current
+ * client state indicates.
+ *
+ * So to do this, client PixelStore state is forced to known values
+ * before any instances in the display list are executed.  The client
+ * state is then restored to known values afterwards.  (The difficulty
+ * of this is somewhat mollified by the observation that PixelStore
+ * instances affect client state, and cannot be stored in a display list.)
+ *
+ */
+
+int crdlm_pointers_Bitmap( struct instanceBitmap *instance, GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap, CRClientState *c)
+{
+    unsigned int size = ((int)((width + 7) / 8)) * height;
+    /* glBitmap can be called with a NULL size 0 bitmap, say for
+     * an empty glyph that only moves the current raster position.
+     * crMemcpy will raise an exception with a NULL source pointer, even if
+     * the size to copy is 0.  So make sure we don't ram into this.
+     * Also, the bitmap isn't necessarily just sitting in memory; the PixelStore
+     * client-side state affects how it is read from memory.  It's easiest to just
+     * use the utility.
+     */
+    if (instance && size > 0) {
+	crBitmapCopy(width, height, instance->bitmap, bitmap,
+		&c->unpack);
+    }
+
+    return size;
+}
+
+int crdlm_pointers_DrawPixels( struct instanceDrawPixels *instance, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c )
+{
+    unsigned int size = crImageSize(format, type, width, height);
+
+    if (instance && size > 0) {
+	crPixelCopy2D(width, height, 
+		instance->pixels, format, type, NULL,
+		pixels, format, type, &c->unpack);
+    }
+
+    return size;
+}
+int crdlm_pointers_Fogfv( struct instanceFogfv *instance, GLenum pname, const GLfloat *params )
+{
+    unsigned int size = (pname == GL_FOG_COLOR?4:1)*sizeof(GLfloat);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_Fogiv( struct instanceFogiv *instance, GLenum pname, const GLint *params )
+{
+    unsigned int size = (pname == GL_FOG_COLOR?4:1)*sizeof(GLint);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_LightModelfv( struct instanceLightModelfv *instance, GLenum pname, const GLfloat *params )
+{
+    unsigned int size = (pname == GL_LIGHT_MODEL_AMBIENT?4:1)*sizeof(GLfloat);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_LightModeliv( struct instanceLightModeliv *instance, GLenum pname, const GLint *params )
+{
+    unsigned int size = (pname == GL_LIGHT_MODEL_AMBIENT?4:1)*sizeof(GLfloat);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_Lightfv( struct instanceLightfv *instance, GLenum light, GLenum pname, const GLfloat *params )
+{
+    unsigned int size;
+    switch(pname) {
+	case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_POSITION:
+	    size = 4 * sizeof(GLfloat);
+	    break;
+	case GL_SPOT_DIRECTION:
+	    size = 3 * sizeof(GLfloat);
+	    break;
+	default:
+	    size = 1 * sizeof(GLfloat);
+	    break;
+    }
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_Lightiv( struct instanceLightiv *instance, GLenum light, GLenum pname, const GLint *params )
+{
+    unsigned int size;
+    switch(pname) {
+	case GL_AMBIENT: case GL_DIFFUSE: case GL_SPECULAR: case GL_POSITION:
+	    size = 4 * sizeof(GLint);
+	    break;
+	case GL_SPOT_DIRECTION:
+	    size = 3 * sizeof(GLint);
+	    break;
+	default:
+	    size = 1 * sizeof(GLint);
+	    break;
+    }
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+
+/* This utility routine returns the number of components per
+ * mapping point for all the glMap* functions.
+ */
+static int map_num_components(GLenum target)
+{
+    switch(target) {
+	case GL_MAP1_INDEX: case GL_MAP1_TEXTURE_COORD_1:
+	    return 1;
+	case GL_MAP1_TEXTURE_COORD_2:
+	    return 2;
+	case GL_MAP1_VERTEX_3: case GL_MAP1_NORMAL: 
+	case GL_MAP1_TEXTURE_COORD_3:
+	    return 3;
+	case GL_MAP1_VERTEX_4: case GL_MAP1_COLOR_4:
+	case GL_MAP1_TEXTURE_COORD_4:
+	    return 4;
+
+	case GL_MAP2_INDEX: case GL_MAP2_TEXTURE_COORD_1:
+	    return 1;
+	case GL_MAP2_TEXTURE_COORD_2:
+	    return 2;
+	case GL_MAP2_VERTEX_3: case GL_MAP2_NORMAL:
+	case GL_MAP2_TEXTURE_COORD_3:
+	    return 3;
+	case GL_MAP2_VERTEX_4: case GL_MAP2_COLOR_4:
+	case GL_MAP2_TEXTURE_COORD_4:
+	    return 4;
+    }
+    return 0;
+} 
+
+
+int crdlm_pointers_Map1d( struct instanceMap1d *instance, GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points )
+{
+    unsigned int numValues = map_num_components(target);
+    unsigned int size = order * numValues * sizeof(GLdouble);
+    if (instance) {
+	/* This one's a little different - we rearrange the order to
+	 * compress it, and change the instance's stride value to
+	 * match.
+	 */
+	const GLdouble *src = points;
+	GLdouble *dest = instance->points;
+	register int i;
+	for (i = 0; i < order; i++) {
+	    crMemcpy(dest, src, numValues * sizeof(GLdouble));
+	    dest += numValues;
+	    src += stride;
+	}
+
+	/* We override the stride to show we've compressed the data */
+	instance->stride = numValues;
+    }
+    return size;
+}
+int crdlm_pointers_Map1f( struct instanceMap1f *instance, GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points )
+{
+    unsigned int numValues = map_num_components(target);
+    unsigned int size = order * numValues * sizeof(GLfloat);
+    if (instance) {
+	/* This one's a little different - we rearrange the order to
+	 * compress it, and change the instance's stride value to
+	 * match.
+	 */
+	const GLfloat *src = points;
+	GLfloat *dest = instance->points;
+	register int i;
+	for (i = 0; i < order; i++) {
+	    crMemcpy(dest, src, numValues * sizeof(GLfloat));
+	    dest += numValues;
+	    src += stride;
+	}
+
+	/* We override the stride to show we've compressed the data */
+	instance->stride = numValues;
+    }
+    return size;
+}
+int crdlm_pointers_Map2d( struct instanceMap2d *instance, GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points )
+{
+    unsigned int numValues = map_num_components(target);
+    unsigned int size = uorder * vorder * numValues * sizeof(GLdouble);
+    if (instance) {
+	register int v, u;
+	const GLdouble *src = points;
+	GLdouble *dest = instance->points;
+	for (v = 0; v < vorder; v++) {
+	    for (u = 0; u < uorder; u++) {
+		crMemcpy(dest, src, numValues * sizeof(GLdouble));
+		dest += numValues;
+		src += ustride;
+	    }
+	    src += vstride - ustride*uorder;
+	}
+	/* We override the stride to show we've compressed the data */
+	instance->ustride = numValues;
+	instance->vstride = ustride * uorder;
+    }
+    return size;
+}
+int crdlm_pointers_Map2f( struct instanceMap2f *instance, GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points )
+{
+    unsigned int numValues = map_num_components(target);
+    unsigned int size = uorder * vorder * numValues * sizeof(GLfloat);
+    if (instance) {
+	register int v, u;
+	const GLfloat *src = points;
+	GLfloat *dest = instance->points;
+	for (v = 0; v < vorder; v++) {
+	    for (u = 0; u < uorder; u++) {
+		crMemcpy(dest, src, numValues * sizeof(GLfloat));
+		dest += numValues;
+		src += ustride;
+	    }
+	    src += vstride - ustride*uorder;
+	}
+	/* We override the stride to show we've compressed the data */
+	instance->ustride = numValues;
+	instance->vstride = ustride * uorder;
+    }
+    return size;
+}
+
+int crdlm_pointers_Materialfv(struct instanceMaterialfv *instance, GLenum face, GLenum pname, const GLfloat *params)
+{
+    unsigned int size = 0;
+    switch(pname) {
+	case GL_AMBIENT_AND_DIFFUSE:
+	    size = 8 * sizeof(GLfloat);
+	    break;
+	case GL_AMBIENT:
+	case GL_DIFFUSE:
+	case GL_SPECULAR:
+	case GL_EMISSION:
+	    size = 4 * sizeof(GLfloat);
+	    break;
+	case GL_SHININESS:
+	    size = 1 * sizeof(GLfloat);
+	    break;
+	case GL_COLOR_INDEXES:
+	    size = 3 * sizeof(GLfloat);
+	    break;
+	default:
+	    break;
+    }
+    if (instance && size > 0) crMemcpy(instance->params, params, size);
+    return size;
+}
+
+int crdlm_pointers_Materialiv(struct instanceMaterialiv *instance, GLenum face, GLenum pname, const GLint *params)
+{
+    unsigned int size = 0;
+    switch(pname) {
+	case GL_AMBIENT_AND_DIFFUSE:
+	    size = 8 * sizeof(GLint);
+	    break;
+	case GL_AMBIENT:
+	case GL_DIFFUSE:
+	case GL_SPECULAR:
+	case GL_EMISSION:
+	    size = 4 * sizeof(GLint);
+	    break;
+	case GL_SHININESS:
+	    size = 1 * sizeof(GLint);
+	    break;
+	case GL_COLOR_INDEXES:
+	    size = 3 * sizeof(GLint);
+	    break;
+	default:
+	    break;
+    }
+    if (instance && size > 0) crMemcpy(instance->params, params, size);
+    return size;
+}
+
+int crdlm_pointers_PixelMapfv( struct instancePixelMapfv *instance, GLenum map, GLsizei mapsize, const GLfloat *values )
+{
+    unsigned int size = mapsize * sizeof(GLfloat);
+    if (instance && size > 0) crMemcpy(instance->values, values, size);
+    return size;
+}
+int crdlm_pointers_PixelMapuiv( struct instancePixelMapuiv *instance, GLenum map, GLsizei mapsize, const GLuint *values )
+{
+    unsigned int size = mapsize * sizeof(GLuint);
+    if (instance && size > 0) crMemcpy(instance->values, values, size);
+    return size;
+}
+int crdlm_pointers_PixelMapusv( struct instancePixelMapusv *instance, GLenum map, GLsizei mapsize, const GLushort *values )
+{
+    unsigned int size = mapsize * sizeof(GLushort);
+    if (instance && size > 0) crMemcpy(instance->values, values, size);
+    return size;
+}
+
+int crdlm_pointers_PointParameterfvARB( struct instancePointParameterfvARB *instance, GLenum pname, const GLfloat *params)
+{
+    unsigned int size = 0;
+    switch(pname) {
+	case GL_POINT_DISTANCE_ATTENUATION_ARB:
+	    size = 3 * sizeof(GLfloat);
+	    break;
+	default:
+	    size = 1 * sizeof(GLfloat);
+	    break;
+    }
+    return size;
+}
+
+int crdlm_pointers_PointParameteriv( struct instancePointParameteriv *instance, GLenum pname, const GLint *params)
+{
+    unsigned int size = 0;
+    switch(pname) {
+	case GL_POINT_DISTANCE_ATTENUATION_ARB:
+	    size = 3 * sizeof(GLint);
+	    break;
+	default:
+	    size = 1 * sizeof(GLint);
+	    break;
+    }
+    return size;
+}
+
+int crdlm_pointers_TexEnvfv( struct instanceTexEnvfv *instance, GLenum target, GLenum pname, const GLfloat *params )
+{
+    unsigned int size = (pname == GL_TEXTURE_ENV_COLOR?4:1)*sizeof(GLfloat);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_TexEnviv( struct instanceTexEnviv *instance, GLenum target, GLenum pname, const GLint *params )
+{
+    unsigned int size = (pname == GL_TEXTURE_ENV_COLOR?4:1)*sizeof(GLint);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_TexGendv( struct instanceTexGendv *instance, GLenum coord, GLenum pname, const GLdouble *params )
+{
+    unsigned int size = (pname == GL_OBJECT_PLANE||pname==GL_EYE_PLANE?4:1)*sizeof(GLdouble);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_TexGenfv( struct instanceTexGenfv *instance, GLenum coord, GLenum pname, const GLfloat *params )
+{
+    unsigned int size = (pname == GL_OBJECT_PLANE||pname==GL_EYE_PLANE?4:1)*sizeof(GLfloat);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_TexGeniv( struct instanceTexGeniv *instance, GLenum coord, GLenum pname, const GLint *params )
+{
+    unsigned int size = (pname == GL_OBJECT_PLANE||pname==GL_EYE_PLANE?4:1)*sizeof(GLint);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_TexImage1D( struct instanceTexImage1D *instance, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c )
+{
+    unsigned int size = crImageSize(format, type, width, 1);
+
+    if (instance && size > 0) {
+	crPixelCopy1D(instance->pixels, format, type,
+		pixels, format, type, width, &c->unpack);
+    }
+
+    return size;
+}
+int crdlm_pointers_CompressedTexImage1DARB(struct instanceCompressedTexImage1DARB *instance, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imagesize, const GLvoid *data)
+{
+    unsigned int size = imagesize;
+
+    if (instance && size > 0) {
+	crMemcpy(instance->data, data, size);
+    }
+
+    return size;
+}
+
+int crdlm_pointers_TexImage2D( struct instanceTexImage2D *instance, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c )
+{
+    unsigned int size = crImageSize(format, type, width, height);
+
+    if (instance && size > 0) {
+	crPixelCopy2D(width, height, 
+		instance->pixels, format, type, NULL,
+		pixels, format, type, &c->unpack);
+    }
+
+    return size;
+}
+int crdlm_pointers_CompressedTexImage2DARB(struct instanceCompressedTexImage2DARB *instance, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imagesize, const GLvoid *data)
+{
+    unsigned int size = imagesize;
+
+    if (instance && size > 0) {
+	crMemcpy(instance->data, data, size);
+    }
+
+    return size;
+}
+
+int crdlm_pointers_TexImage3D( struct instanceTexImage3D *instance, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c )
+{
+    unsigned int size;
+    int is_distrib = ((type == GL_TRUE) || (type == GL_FALSE));
+
+    if (pixels == NULL) {
+	size = 0;
+    }
+    else if (is_distrib) {
+	size = crStrlen(pixels) + 1 + (type==GL_TRUE?width*height*3:0);
+    }
+    else {
+	size = crTextureSize(format, type, width, height, depth);
+    }
+
+    if (instance && size > 0) {
+	if (is_distrib) {
+	    crMemcpy(instance->pixels, pixels, size);
+	}
+	else {
+	    crPixelCopy3D(width, height, depth,
+		instance->pixels, format, type, NULL,
+		pixels, format, type, &c->unpack);
+	}
+    }
+
+    return size;
+}
+int crdlm_pointers_TexImage3DEXT( struct instanceTexImage3DEXT *instance, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c )
+{
+    unsigned int size;
+    int is_distrib = ((type == GL_TRUE) || (type == GL_FALSE));
+
+    if (pixels == NULL) {
+	size = 0;
+    }
+    else if (is_distrib) {
+	size = crStrlen(pixels) + 1 + (type==GL_TRUE?width*height*3:0);
+    }
+    else {
+	size = crTextureSize(format, type, width, height, depth);
+    }
+
+    if (instance && size > 0) {
+	if (is_distrib) {
+	    crMemcpy(instance->pixels, pixels, size);
+	}
+	else {
+	    crPixelCopy3D(width, height, depth,
+		instance->pixels, format, type, NULL,
+		pixels, format, type, &c->unpack);
+	}
+    }
+
+    return size;
+}
+
+int crdlm_pointers_CompressedTexImage3DARB(struct instanceCompressedTexImage3DARB *instance, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imagesize, const GLvoid *data)
+{
+    unsigned int size = imagesize;
+
+    if (instance && size > 0) {
+	crMemcpy(instance->data, data, size);
+    }
+
+    return size;
+}
+
+int crdlm_pointers_TexParameterfv( struct instanceTexParameterfv *instance, GLenum target, GLenum pname, const GLfloat *params )
+{
+    unsigned int size = (pname == GL_TEXTURE_BORDER_COLOR?4:1)*sizeof(GLfloat);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_TexParameteriv( struct instanceTexParameteriv *instance, GLenum target, GLenum pname, const GLint *params )
+{
+    unsigned int size = (pname == GL_TEXTURE_BORDER_COLOR?4:1)*sizeof(GLfloat);
+    if (instance) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_TexSubImage1D( struct instanceTexSubImage1D *instance, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c )
+{
+    unsigned int size = crImageSize(format, type, width, 1);
+
+    if (instance && size > 0) {
+	crPixelCopy1D(instance->pixels, format, type,
+		pixels, format, type, width, &c->unpack);
+    }
+
+    return size;
+}
+int crdlm_pointers_TexSubImage2D( struct instanceTexSubImage2D *instance, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c )
+{
+    unsigned int size = crImageSize(format, type, width, height);
+
+    if (instance && size > 0) {
+	crPixelCopy2D(width, height, 
+		instance->pixels, format, type, NULL,
+		pixels, format, type, &c->unpack);
+    }
+
+    return size;
+}
+int crdlm_pointers_TexSubImage3D( struct instanceTexSubImage3D *instance, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c )
+{
+    unsigned int size;
+    int is_distrib = ((type == GL_TRUE) || (type == GL_FALSE));
+
+    if (pixels == NULL) {
+	size = 0;
+    }
+    else if (is_distrib) {
+	size = crStrlen(pixels) + 1 + (type==GL_TRUE?width*height*3:0);
+    }
+    else {
+	size = crTextureSize(format, type, width, height, depth);
+    }
+
+    if (instance && size > 0) {
+	if (is_distrib) {
+	    crMemcpy(instance->pixels, pixels, size);
+	}
+	else {
+	    crPixelCopy3D(width, height, depth,
+		instance->pixels, format, type, NULL,
+		pixels, format, type, &c->unpack);
+	}
+    }
+
+    return size;
+}
+
+int crdlm_pointers_CompressedTexSubImage1DARB(struct instanceCompressedTexSubImage1DARB *instance, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imagesize, const GLvoid *data)
+{
+    unsigned int size = imagesize;
+
+    if (instance && size > 0) {
+	crMemcpy(instance->data, data, size);
+    }
+
+    return size;
+}
+
+int crdlm_pointers_CompressedTexSubImage2DARB(struct instanceCompressedTexSubImage2DARB *instance, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imagesize, const GLvoid *data)
+{
+    unsigned int size = imagesize;
+
+    if (instance && size > 0) {
+	crMemcpy(instance->data, data, size);
+    }
+
+    return size;
+}
+int crdlm_pointers_CompressedTexSubImage3DARB(struct instanceCompressedTexSubImage3DARB *instance, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imagesize, const GLvoid *data)
+{
+    unsigned int size = imagesize;
+
+    if (instance && size > 0) {
+	crMemcpy(instance->data, data, size);
+    }
+
+    return size;
+}
+
+int crdlm_pointers_Rectdv(struct instanceRectdv *instance, const GLdouble *v1, const GLdouble *v2)
+{
+    unsigned int size = 4 * sizeof(GLdouble);
+    if (instance) {
+	instance->data[0] = v1[0];
+	instance->data[1] = v1[1];
+	instance->data[2] = v2[0];
+	instance->data[3] = v2[1];
+	instance->v1 = &instance->data[0];
+	instance->v2 = &instance->data[2];
+    }
+    return size;
+}
+int crdlm_pointers_Rectfv(struct instanceRectfv *instance, const GLfloat *v1, const GLfloat *v2)
+{
+    unsigned int size = 4 * sizeof(GLfloat);
+    if (instance) {
+	instance->data[0] = v1[0];
+	instance->data[1] = v1[1];
+	instance->data[2] = v2[0];
+	instance->data[3] = v2[1];
+	instance->v1 = &instance->data[0];
+	instance->v2 = &instance->data[2];
+    }
+    return size;
+}
+int crdlm_pointers_Rectiv(struct instanceRectiv *instance, const GLint *v1, const GLint *v2)
+{
+    unsigned int size = 4 * sizeof(GLint);
+    if (instance) {
+	instance->data[0] = v1[0];
+	instance->data[1] = v1[1];
+	instance->data[2] = v2[0];
+	instance->data[3] = v2[1];
+	instance->v1 = &instance->data[0];
+	instance->v2 = &instance->data[2];
+    }
+    return size;
+}
+int crdlm_pointers_Rectsv(struct instanceRectsv *instance, const GLshort *v1, const GLshort *v2)
+{
+    unsigned int size = 4 * sizeof(GLshort);
+    if (instance) {
+	instance->data[0] = v1[0];
+	instance->data[1] = v1[1];
+	instance->data[2] = v2[0];
+	instance->data[3] = v2[1];
+	instance->v1 = &instance->data[0];
+	instance->v2 = &instance->data[2];
+    }
+    return size;
+}
+
+int crdlm_pointers_PrioritizeTextures(struct instancePrioritizeTextures *instance, GLsizei n, const GLuint *textures, const GLclampf *priorities)
+{
+    unsigned int size = n * (sizeof(GLuint) + sizeof(GLclampf));
+    if (instance) {
+	instance->textures = (GLuint *)&instance->data[0];
+	instance->priorities = (GLclampf *)(((char *)&instance->data[0]) + n * sizeof(GLuint));
+	if (size > 0) {
+	    crMemcpy(instance->textures, textures, n * sizeof(GLuint));
+	    crMemcpy(instance->priorities, priorities, n * sizeof(GLclampf));
+	}
+    }
+
+    return size;
+}
+
+static int combiner_num_components(GLenum pname)
+{
+    switch(pname) {
+	case GL_CONSTANT_COLOR0_NV:
+	case GL_CONSTANT_COLOR1_NV:
+	    return 4;
+	case GL_NUM_GENERAL_COMBINERS_NV:
+	case GL_COLOR_SUM_CLAMP_NV:
+	    return 1;
+    }
+    return 0;
+} 
+int crdlm_pointers_CombinerParameterivNV(struct instanceCombinerParameterivNV *instance, GLenum pname, const GLint *params)
+{
+    unsigned int size = combiner_num_components(pname) * sizeof(GLint);
+    if (instance && size > 0) crMemcpy(instance->params, params, size);
+    return size;
+}
+int crdlm_pointers_CombinerParameterfvNV(struct instanceCombinerParameterfvNV *instance, GLenum pname, const GLfloat *params)
+{
+    unsigned int size = combiner_num_components(pname) * sizeof(GLfloat);
+    if (instance && size > 0) crMemcpy(instance->params, params, size);
+    return size;
+}
+
+static int combinerstage_num_components(GLenum pname)
+{
+    switch(pname) {
+	case GL_CONSTANT_COLOR0_NV:
+	case GL_CONSTANT_COLOR1_NV:
+	    return 4;
+    }
+    return 0;
+} 
+int crdlm_pointers_CombinerStageParameterfvNV(struct instanceCombinerStageParameterfvNV *instance, GLenum stage, GLenum pname, const GLfloat *params)
+{
+    unsigned int size = combinerstage_num_components(pname) * sizeof(GLfloat);
+    if (instance && size > 0) crMemcpy(instance->params, params, size);
+    return size;
+}
+
+static int program_num_components(GLenum target)
+{
+    switch(target) {
+	case GL_VERTEX_STATE_PROGRAM_NV:
+	    return 4;
+    }
+    return 0;
+} 
+int crdlm_pointers_ExecuteProgramNV(struct instanceExecuteProgramNV *instance, GLenum target, GLuint id, const GLfloat *params)
+{
+    unsigned int size = program_num_components(target) * sizeof(GLfloat);
+    if (instance && size > 0) crMemcpy(instance->params, params, size);
+    return size;
+}
+
+int crdlm_pointers_RequestResidentProgramsNV(struct instanceRequestResidentProgramsNV *instance, GLsizei n, const GLuint *ids)
+{
+    unsigned int size = 4*sizeof(GLuint);
+    if (instance && size > 0) crMemcpy(instance->ids, ids, size);
+    return size;
+}
+
+int crdlm_pointers_LoadProgramNV(struct instanceLoadProgramNV *instance, GLenum target, GLuint id, GLsizei len, const GLubyte *program)
+{
+    unsigned int size = len*sizeof(GLubyte);
+    if (instance && size > 0) crMemcpy(instance->program, program, size);
+    return size;
+}
+
+int crdlm_pointers_ProgramNamedParameter4dNV(struct instanceProgramNamedParameter4dNV *instance, GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+{
+	unsigned int size = len * sizeof(GLubyte);
+	/* XXX */
+	return size;
+}
+
+int crdlm_pointers_ProgramNamedParameter4dvNV(struct instanceProgramNamedParameter4dvNV *instance, GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v)
+{
+	unsigned int size = len * sizeof(GLubyte);
+	/* XXX */
+	return size;
+}
+	
+int crdlm_pointers_ProgramNamedParameter4fNV(struct instanceProgramNamedParameter4fNV *instance, GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+	unsigned int size = len * sizeof(GLubyte);
+	/* XXX */
+	return size;
+}
+
+int crdlm_pointers_ProgramNamedParameter4fvNV(struct instanceProgramNamedParameter4fvNV *instance, GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v)
+{
+	unsigned int size = len * sizeof(GLubyte);
+	/* XXX */
+	return size;
+}
+
+int crdlm_pointers_ProgramStringARB(struct instanceProgramStringARB *instance, GLenum target, GLenum format, GLsizei len, const GLvoid * string)
+{
+	unsigned int size = len*sizeof(GLubyte);
+	if (instance && size > 0) crMemcpy(instance->string, string, size);
+	return size;
+}
+
+int crdlm_pointers_CallLists(struct instanceCallLists *instance, GLsizei n, GLenum type, const GLvoid *lists )
+{
+	unsigned int size;
+	switch (type) {
+		case GL_BYTE:
+			size = sizeof(GLbyte);
+			break;
+		case GL_UNSIGNED_BYTE:
+			size = sizeof(GLubyte);
+			break;
+		case GL_SHORT:
+			size = sizeof(GLshort);
+			break;
+		case GL_UNSIGNED_SHORT:
+			size = sizeof(GLushort);
+			break;
+		case GL_INT:
+			size = sizeof(GLint);
+			break;
+		case GL_UNSIGNED_INT:
+			size = sizeof(GLuint);
+			break;
+		case GL_FLOAT:
+			size = sizeof(GLfloat);
+			break;
+		case GL_2_BYTES:
+			size = 2 * sizeof(GLbyte);
+			break;
+		case GL_3_BYTES:
+			size = 3 * sizeof(GLbyte);
+			break;
+		case GL_4_BYTES:
+			size = 4 * sizeof(GLbyte);
+			break;
+		default:
+			size = 0;
+	}
+	size *= n;
+	if (instance && size > 0) crMemcpy(instance->lists, lists, size);
+	return size;
+}
+
+
+int crdlm_pointers_VertexAttribs1dvNV(struct instanceVertexAttribs1dvNV *instance, GLuint index, GLsizei n, const GLdouble *v)
+{
+   return 1 * n * sizeof(GLdouble);
+}
+
+int crdlm_pointers_VertexAttribs1fvNV(struct instanceVertexAttribs1fvNV *instance, GLuint index, GLsizei n, const GLfloat *v)
+{
+   return 1 * n * sizeof(GLfloat);
+}
+
+int crdlm_pointers_VertexAttribs1svNV(struct instanceVertexAttribs1svNV *instance, GLuint index, GLsizei n, const GLshort *v)
+{
+   return 1 * n * sizeof(GLshort);
+}
+
+int crdlm_pointers_VertexAttribs2dvNV(struct instanceVertexAttribs2dvNV *instance, GLuint index, GLsizei n, const GLdouble *v)
+{
+   return 2 * n * sizeof(GLdouble);
+}
+
+int crdlm_pointers_VertexAttribs2fvNV(struct instanceVertexAttribs2fvNV *instance, GLuint index, GLsizei n, const GLfloat *v)
+{
+   return 2 * n * sizeof(GLfloat);
+}
+
+int crdlm_pointers_VertexAttribs2svNV(struct instanceVertexAttribs2svNV *instance, GLuint index, GLsizei n, const GLshort *v)
+{
+   return 2 * n * sizeof(GLshort);
+}
+
+int crdlm_pointers_VertexAttribs3dvNV(struct instanceVertexAttribs3dvNV *instance, GLuint index, GLsizei n, const GLdouble *v)
+{
+   return 3 * n * sizeof(GLdouble);
+}
+
+int crdlm_pointers_VertexAttribs3fvNV(struct instanceVertexAttribs3fvNV *instance, GLuint index, GLsizei n, const GLfloat *v)
+{
+   return 3 * n * sizeof(GLfloat);
+}
+
+int crdlm_pointers_VertexAttribs3svNV(struct instanceVertexAttribs3svNV *instance, GLuint index, GLsizei n, const GLshort *v)
+{
+   return 3 * n * sizeof(GLshort);
+}
+
+int crdlm_pointers_VertexAttribs4dvNV(struct instanceVertexAttribs4dvNV *instance, GLuint index, GLsizei n, const GLdouble *v)
+{
+   return 4 * n * sizeof(GLdouble);
+}
+
+int crdlm_pointers_VertexAttribs4fvNV(struct instanceVertexAttribs4fvNV *instance, GLuint index, GLsizei n, const GLfloat *v)
+{
+   return 4 * n * sizeof(GLfloat);
+}
+
+int crdlm_pointers_VertexAttribs4svNV(struct instanceVertexAttribs4svNV *instance, GLuint index, GLsizei n, const GLshort *v)
+{
+   return 4 * n * sizeof(GLshort);
+}
+
+int crdlm_pointers_VertexAttribs4ubvNV(struct instanceVertexAttribs4ubvNV *instance, GLuint index, GLsizei n, const GLubyte *v)
+{
+   return 4 * n * sizeof(GLubyte);
+}
+
+int crdlm_pointers_ZPixCR( struct instanceZPixCR *instance, GLsizei width, 
+			 GLsizei height, GLenum format, GLenum type, 
+			 GLenum ztype, GLint zparm, GLint length, 
+			 const GLvoid *pixels, CRClientState *c)
+{
+     unsigned int size = length;
+     if (instance && size > 0) {
+	  crMemcpy(instance->pixels,pixels,length);
+     }
+     
+     return size;
+}
+
+
+/*
+ * Prototypes for functions below are auto-generated and definded at out/<os.arch>/<build type>/obj/VBoxOGLgen/dlm_generated.h.
+ *
+ * All non-pointer structure fields are already assifned to *instance in out/<os.arch>/<build type>/obj/VBoxOGLgen/dlm_generated.c.
+ * Here we need to specify the additional size which is required to store data from pointers.
+ * This size will be added to sizeof(*instance) when dlm_generated.c will dynamically allocate memory for it. Also,
+ * data from pointers shouls be copied to *instance in case if instance != NULL. Each of functions below is called
+ * twice from dlm_generated.c:
+ *  - first time with instance = NULL in order to get actual size of data provided by pointer
+ *  - the second time with valid instance in order to copy data into it.
+ */
+
+int crdlm_pointers_BindAttribLocation(struct instanceBindAttribLocation *instance, GLuint program, GLuint index, const char * name)
+{
+    int cbExtraSpace = (name ? crStrlen(name) + 1 : 0);
+    if (instance && name && cbExtraSpace)
+    {
+        crMemcpy(instance->name, name, cbExtraSpace);
+    }
+
+    return cbExtraSpace;
+}
+
+int crdlm_pointers_DeleteFramebuffersEXT(struct instanceDeleteFramebuffersEXT *instance, GLsizei n, const GLuint * framebuffers)
+{
+    int cbExtraSpace = n * sizeof(GLuint);
+
+    if (instance && framebuffers && cbExtraSpace)
+        crMemcpy(instance->framebuffers, framebuffers, cbExtraSpace);
+
+    return cbExtraSpace;
+}
+
+int crdlm_pointers_DeleteRenderbuffersEXT(struct instanceDeleteRenderbuffersEXT *instance, GLsizei n, const GLuint * renderbuffers)
+{
+    int cbExtraSpace = n * sizeof(GLuint);
+
+    if (instance && renderbuffers && cbExtraSpace)
+        crMemcpy(instance->renderbuffers, renderbuffers, cbExtraSpace);
+
+    return cbExtraSpace;
+}
+
+int crdlm_pointers_DrawBuffers(struct instanceDrawBuffers *instance, GLsizei n, const GLenum* bufs)
+{
+    int cbExtraSpace = n * sizeof(GLenum);
+
+    if (instance && bufs && cbExtraSpace)
+        crMemcpy(instance->bufs, bufs, cbExtraSpace);
+
+    return cbExtraSpace;
+}
+
+int crdlm_pointers_ShaderSource(struct instanceShaderSource *instance, GLuint shader, GLsizei count, const char ** string, const GLint * length)
+{
+    int cbExtraSpace = 0;
+    int cbStrings    = 0;
+    int cbLenghts    = 0;
+    int i;
+
+    /* Calculate reported source code size. */
+    if (length && count)
+        for (i = 0; i < count; i++)
+            cbStrings += length[i] + /* termination character */ 1;
+
+    /* Calculate size of the rest of parameters. */
+    cbLenghts = count * sizeof(GLint);
+
+    /* Resulting size is a summ. */
+    cbExtraSpace = cbStrings + cbLenghts;
+
+    /* Copy data if requested. */
+    if (instance)
+    {
+        if (string && *string && cbStrings)
+            crMemcpy(instance->string, *string, cbStrings);
+        if (length && cbLenghts)
+            crMemcpy(instance->length, length, cbLenghts);
+    }
+
+    return cbExtraSpace;
+}
+
+int crdlm_pointers_StringMarkerGREMEDY(struct instanceStringMarkerGREMEDY *instance, GLsizei len, const GLvoid* string)
+{
+    /* @param len assumed to indicate string lenght in bytes. No termination character assumed. */
+    int cbExtraSpace = (string && len) ? len : 0;
+
+    if (instance && string && cbExtraSpace)
+        crMemcpy(instance->string, string, cbExtraSpace);
+
+    return cbExtraSpace;
+}
+
+/* Simplify things a bit. Use this macro instead of copy/paste to similar functions. */
+#define _VBOX_crdlm_pointers_UniformX(_uniformType) \
+    int cbExtraSpace = count * sizeof(_uniformType); \
+    if (instance && cbExtraSpace && value) \
+        crMemcpy(instance->value, value, cbExtraSpace); \
+    return cbExtraSpace;
+
+int crdlm_pointers_Uniform1fv(struct instanceUniform1fv *instance, GLint location, GLsizei count, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformX(GLfloat);
+}
+
+int crdlm_pointers_Uniform1iv(struct instanceUniform1iv *instance, GLint location, GLsizei count, const GLint * value)
+{
+    _VBOX_crdlm_pointers_UniformX(GLint);
+}
+
+int crdlm_pointers_Uniform2fv(struct instanceUniform2fv *instance, GLint location, GLsizei count, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformX(GLfloat);
+}
+
+int crdlm_pointers_Uniform2iv(struct instanceUniform2iv *instance, GLint location, GLsizei count, const GLint * value)
+{
+    _VBOX_crdlm_pointers_UniformX(GLint);
+}
+
+int crdlm_pointers_Uniform3fv(struct instanceUniform3fv *instance, GLint location, GLsizei count, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformX(GLfloat);
+}
+
+int crdlm_pointers_Uniform3iv(struct instanceUniform3iv *instance, GLint location, GLsizei count, const GLint * value)
+{
+    _VBOX_crdlm_pointers_UniformX(GLint);
+}
+
+int crdlm_pointers_Uniform4fv(struct instanceUniform4fv *instance, GLint location, GLsizei count, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformX(GLfloat);
+}
+
+int crdlm_pointers_Uniform4iv(struct instanceUniform4iv *instance, GLint location, GLsizei count, const GLint * value)
+{
+    _VBOX_crdlm_pointers_UniformX(GLint);
+}
+
+#undef crdlm_pointers_Uniform4iv
+
+/* Now do the same for UniformMatrix. */
+#define _VBOX_crdlm_pointers_UniformMatrixX(_uniformMatrixType) \
+    int cbExtraSpace = count * sizeof(_uniformMatrixType); \
+    if (instance && value && cbExtraSpace) \
+        crMemcpy(instance->value, value, cbExtraSpace); \
+    return cbExtraSpace;
+
+int crdlm_pointers_UniformMatrix2fv(struct instanceUniformMatrix2fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+int crdlm_pointers_UniformMatrix2x3fv(struct instanceUniformMatrix2x3fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+int crdlm_pointers_UniformMatrix2x4fv(struct instanceUniformMatrix2x4fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+int crdlm_pointers_UniformMatrix3fv(struct instanceUniformMatrix3fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+int crdlm_pointers_UniformMatrix3x2fv(struct instanceUniformMatrix3x2fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+int crdlm_pointers_UniformMatrix3x4fv(struct instanceUniformMatrix3x4fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+int crdlm_pointers_UniformMatrix4fv(struct instanceUniformMatrix4fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+int crdlm_pointers_UniformMatrix4x2fv(struct instanceUniformMatrix4x2fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+int crdlm_pointers_UniformMatrix4x3fv(struct instanceUniformMatrix4x3fv *instance, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value)
+{
+    _VBOX_crdlm_pointers_UniformMatrixX(GLfloat);
+}
+
+#undef _VBOX_crdlm_pointers_UniformMatrixX
+
+#if 0
+VBoxConCreate
+VBoxCreateContext
+VBoxPackSetInjectThread
+VBoxPresentComposition
+VBoxWindowCreate
+#endif
+
+int crdlm_pointers_VBoxConCreate(struct instanceVBoxConCreate *instance, struct VBOXUHGSMI * pHgsmi)
+{
+    CRASSERT(0);
+    return 0;
+}
+
+int crdlm_pointers_VBoxCreateContext(struct instanceVBoxCreateContext *instance, GLint con, const char * dpyName, GLint visual, GLint shareCtx)
+{
+    int cbExtraSpace = (dpyName ? crStrlen(dpyName) + 1 : 0);
+
+    if (instance && dpyName && cbExtraSpace)
+        crMemcpy(instance->dpyName, dpyName, cbExtraSpace);
+
+    return cbExtraSpace;
+}
+
+int crdlm_pointers_VBoxPackSetInjectThread(struct instanceVBoxPackSetInjectThread *instance, struct VBOXUHGSMI * pHgsmi)
+{
+    CRASSERT(0);
+    return 0;
+}
+
+int crdlm_pointers_VBoxPresentComposition(struct instanceVBoxPresentComposition *instance, GLint win,
+    const struct VBOXVR_SCR_COMPOSITOR * pCompositor, const struct VBOXVR_SCR_COMPOSITOR_ENTRY * pChangedEntry)
+{
+    CRASSERT(0);
+    return 0;
+}
+
+int crdlm_pointers_VBoxWindowCreate(struct instanceVBoxWindowCreate *instance, GLint con, const char * dpyName, GLint visBits)
+{
+    int cbExtraSpace = (dpyName ? crStrlen(dpyName) + 1 : 0);
+
+    if (instance && dpyName && cbExtraSpace)
+        crMemcpy(instance->dpyName, dpyName, cbExtraSpace);
+
+    return cbExtraSpace;
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_pointers.h b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_pointers.h
new file mode 100644
index 0000000..d5e74b3
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_pointers.h
@@ -0,0 +1,81 @@
+/* $Id: dlm_pointers.h $ */
+#include <VBox/VBoxUhgsmi.h>
+
+#include "cr_dlm.h"
+#include "dlm_generated.h"
+
+#ifndef _DLM_POINTERS_H
+#define _DLM_POINTERS_H
+
+extern int crdlm_pointers_Bitmap( struct instanceBitmap *instance, GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap, CRClientState *c);
+extern int crdlm_pointers_DrawPixels( struct instanceDrawPixels *instance, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c );
+extern int crdlm_pointers_Fogfv( struct instanceFogfv *instance, GLenum pname, const GLfloat *params );
+extern int crdlm_pointers_Fogiv( struct instanceFogiv *instance, GLenum pname, const GLint *params );
+extern int crdlm_pointers_LightModelfv( struct instanceLightModelfv *instance, GLenum pname, const GLfloat *params );
+extern int crdlm_pointers_LightModeliv( struct instanceLightModeliv *instance, GLenum pname, const GLint *params );
+extern int crdlm_pointers_Lightfv( struct instanceLightfv *instance, GLenum light, GLenum pname, const GLfloat *params );
+extern int crdlm_pointers_Lightiv( struct instanceLightiv *instance, GLenum light, GLenum pname, const GLint *params );
+extern int crdlm_pointers_Map1d( struct instanceMap1d *instance, GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points );
+extern int crdlm_pointers_Map1f( struct instanceMap1f *instance, GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points );
+extern int crdlm_pointers_Map2d( struct instanceMap2d *instance, GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points );
+extern int crdlm_pointers_Map2f( struct instanceMap2f *instance, GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points );
+extern int crdlm_pointers_Materialfv(struct instanceMaterialfv *instance, GLenum face, GLenum pname, const GLfloat *params);
+extern int crdlm_pointers_Materialiv(struct instanceMaterialiv *instance, GLenum face, GLenum pname, const GLint *params);
+extern int crdlm_pointers_PixelMapfv( struct instancePixelMapfv *instance, GLenum map, GLsizei mapsize, const GLfloat *values );
+extern int crdlm_pointers_PixelMapuiv( struct instancePixelMapuiv *instance, GLenum map, GLsizei mapsize, const GLuint *values );
+extern int crdlm_pointers_PixelMapusv( struct instancePixelMapusv *instance, GLenum map, GLsizei mapsize, const GLushort *values );
+extern int crdlm_pointers_PointParameterfvARB( struct instancePointParameterfvARB *instance, GLenum pname, const GLfloat *params);
+extern int crdlm_pointers_PointParameteriv( struct instancePointParameteriv *instance, GLenum pname, const GLint *params);
+extern int crdlm_pointers_TexEnvfv( struct instanceTexEnvfv *instance, GLenum target, GLenum pname, const GLfloat *params );
+extern int crdlm_pointers_TexEnviv( struct instanceTexEnviv *instance, GLenum target, GLenum pname, const GLint *params );
+extern int crdlm_pointers_TexGendv( struct instanceTexGendv *instance, GLenum coord, GLenum pname, const GLdouble *params );
+extern int crdlm_pointers_TexGenfv( struct instanceTexGenfv *instance, GLenum coord, GLenum pname, const GLfloat *params );
+extern int crdlm_pointers_TexGeniv( struct instanceTexGeniv *instance, GLenum coord, GLenum pname, const GLint *params );
+extern int crdlm_pointers_TexImage1D( struct instanceTexImage1D *instance, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c );
+extern int crdlm_pointers_CompressedTexImage1DARB(struct instanceCompressedTexImage1DARB *instance, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imagesize, const GLvoid *data);
+extern int crdlm_pointers_TexImage2D( struct instanceTexImage2D *instance, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c );
+extern int crdlm_pointers_CompressedTexImage2DARB(struct instanceCompressedTexImage2DARB *instance, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imagesize, const GLvoid *data);
+extern int crdlm_pointers_TexImage3D( struct instanceTexImage3D *instance, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c );
+extern int crdlm_pointers_TexImage3DEXT( struct instanceTexImage3DEXT *instance, GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c );
+extern int crdlm_pointers_CompressedTexImage3DARB(struct instanceCompressedTexImage3DARB *instance, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imagesize, const GLvoid *data);
+extern int crdlm_pointers_TexParameterfv( struct instanceTexParameterfv *instance, GLenum target, GLenum pname, const GLfloat *params );
+extern int crdlm_pointers_TexParameteriv( struct instanceTexParameteriv *instance, GLenum target, GLenum pname, const GLint *params );
+extern int crdlm_pointers_TexSubImage1D( struct instanceTexSubImage1D *instance, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c );
+extern int crdlm_pointers_TexSubImage2D( struct instanceTexSubImage2D *instance, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c );
+extern int crdlm_pointers_TexSubImage3D( struct instanceTexSubImage3D *instance, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels, CRClientState *c );
+extern int crdlm_pointers_CompressedTexSubImage1DARB(struct instanceCompressedTexSubImage1DARB *instance, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imagesize, const GLvoid *data);
+extern int crdlm_pointers_CompressedTexSubImage2DARB(struct instanceCompressedTexSubImage2DARB *instance, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imagesize, const GLvoid *data);
+extern int crdlm_pointers_CompressedTexSubImage3DARB(struct instanceCompressedTexSubImage3DARB *instance, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imagesize, const GLvoid *data);
+extern int crdlm_pointers_Rectdv(struct instanceRectdv *instance, const GLdouble *v1, const GLdouble *v2);
+extern int crdlm_pointers_Rectfv(struct instanceRectfv *instance, const GLfloat *v1, const GLfloat *v2);
+extern int crdlm_pointers_Rectiv(struct instanceRectiv *instance, const GLint *v1, const GLint *v2);
+extern int crdlm_pointers_Rectsv(struct instanceRectsv *instance, const GLshort *v1, const GLshort *v2);
+extern int crdlm_pointers_PrioritizeTextures(struct instancePrioritizeTextures *instance, GLsizei n, const GLuint *textures, const GLclampf *priorities);
+extern int crdlm_pointers_CombinerParameterivNV(struct instanceCombinerParameterivNV *instance, GLenum pname, const GLint *params);
+extern int crdlm_pointers_CombinerParameterfvNV(struct instanceCombinerParameterfvNV *instance, GLenum pname, const GLfloat *params);
+extern int crdlm_pointers_CombinerStageParameterfvNV(struct instanceCombinerStageParameterfvNV *instance, GLenum stage, GLenum pname, const GLfloat *params);
+extern int crdlm_pointers_ExecuteProgramNV(struct instanceExecuteProgramNV *instance, GLenum target, GLuint id, const GLfloat *params);
+extern int crdlm_pointers_RequestResidentProgramsNV(struct instanceRequestResidentProgramsNV *instance, GLsizei n, const GLuint *ids);
+extern int crdlm_pointers_LoadProgramNV(struct instanceLoadProgramNV *instance, GLenum target, GLuint id, GLsizei len, const GLubyte *program);
+extern int crdlm_pointers_ProgramNamedParameter4dNV(struct instanceProgramNamedParameter4dNV *instance, GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+extern int crdlm_pointers_ProgramNamedParameter4dvNV(struct instanceProgramNamedParameter4dvNV *instance, GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v);
+extern int crdlm_pointers_ProgramNamedParameter4fNV(struct instanceProgramNamedParameter4fNV *instance, GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+extern int crdlm_pointers_ProgramNamedParameter4fvNV(struct instanceProgramNamedParameter4fvNV *instance, GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v);
+extern int crdlm_pointers_ProgramStringARB(struct instanceProgramStringARB *instance, GLenum target, GLenum format, GLsizei len, const GLvoid * string);
+extern int crdlm_pointers_CallLists(struct instanceCallLists *instance, GLsizei n, GLenum type, const GLvoid *lists );
+extern int crdlm_pointers_VertexAttribs1dvNV(struct instanceVertexAttribs1dvNV *instance, GLuint index, GLsizei n, const GLdouble *v);
+extern int crdlm_pointers_VertexAttribs1fvNV(struct instanceVertexAttribs1fvNV *instance, GLuint index, GLsizei n, const GLfloat *v);
+extern int crdlm_pointers_VertexAttribs1svNV(struct instanceVertexAttribs1svNV *instance, GLuint index, GLsizei n, const GLshort *v);
+extern int crdlm_pointers_VertexAttribs2dvNV(struct instanceVertexAttribs2dvNV *instance, GLuint index, GLsizei n, const GLdouble *v);
+extern int crdlm_pointers_VertexAttribs2fvNV(struct instanceVertexAttribs2fvNV *instance, GLuint index, GLsizei n, const GLfloat *v);
+extern int crdlm_pointers_VertexAttribs2svNV(struct instanceVertexAttribs2svNV *instance, GLuint index, GLsizei n, const GLshort *v);
+extern int crdlm_pointers_VertexAttribs3dvNV(struct instanceVertexAttribs3dvNV *instance, GLuint index, GLsizei n, const GLdouble *v);
+extern int crdlm_pointers_VertexAttribs3fvNV(struct instanceVertexAttribs3fvNV *instance, GLuint index, GLsizei n, const GLfloat *v);
+extern int crdlm_pointers_VertexAttribs3svNV(struct instanceVertexAttribs3svNV *instance, GLuint index, GLsizei n, const GLshort *v);
+extern int crdlm_pointers_VertexAttribs4dvNV(struct instanceVertexAttribs4dvNV *instance, GLuint index, GLsizei n, const GLdouble *v);
+extern int crdlm_pointers_VertexAttribs4fvNV(struct instanceVertexAttribs4fvNV *instance, GLuint index, GLsizei n, const GLfloat *v);
+extern int crdlm_pointers_VertexAttribs4svNV(struct instanceVertexAttribs4svNV *instance, GLuint index, GLsizei n, const GLshort *v);
+extern int crdlm_pointers_VertexAttribs4ubvNV(struct instanceVertexAttribs4ubvNV *instance, GLuint index, GLsizei n, const GLubyte *v);
+extern int crdlm_pointers_ZPixCR( struct instanceZPixCR *instance, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum ztype, GLint zparm, GLint length, const GLvoid *pixels, CRClientState *c );
+
+#endif
diff --git a/src/VBox/HostServices/SharedOpenGL/dlm/dlm_special b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_special
new file mode 100644
index 0000000..cd20a30
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/dlm/dlm_special
@@ -0,0 +1,21 @@
+# dlm_arrays.c: these have to be expanded out into
+# their components before being stored in a display list
+ArrayElement
+DrawArrays
+DrawElements
+DrawRangeElements
+MultiDrawArraysEXT
+MultiDrawElementsEXT
+
+# dlm_calllist.c: since the DLM can manage state stored
+# inside display lists, we can manage state updates for
+# these sorts of elements.
+CallList
+CallLists
+
+# Calls to be ignored.
+#VBoxConCreate
+#VBoxCreateContext
+#VBoxPackSetInjectThread
+#VBoxPresentComposition
+#VBoxWindowCreate
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/HostServices/SharedOpenGL/expando/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/HostServices/SharedOpenGL/expando/Makefile.kup
diff --git a/src/VBox/HostServices/SharedOpenGL/expando/expando.py b/src/VBox/HostServices/SharedOpenGL/expando/expando.py
new file mode 100644
index 0000000..f7bedfb
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/expando/expando.py
@@ -0,0 +1,91 @@
+# $Id: expando.py $
+# This script generates calls for display list compilation
+# and state management.
+import sys
+
+sys.path.append( "../../glapi_parser" )
+import apiutil
+
+apiutil.CopyrightC()
+
+print """
+/* DO NOT EDIT - THIS FILE AUTOMATICALLY GENERATED BY expando.py SCRIPT */
+#include <stdio.h>
+#include "cr_error.h"
+#include "cr_spu.h"
+#include "cr_dlm.h"
+#include "expandospu.h"
+"""
+
+allFunctions = []
+generatedFunctions = []
+
+for func_name in apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt"):
+	if apiutil.FindSpecial("expando", func_name):
+		allFunctions.append(func_name)
+	elif apiutil.CanCompile(func_name) or apiutil.SetsClientState(func_name):
+		generatedFunctions.append(func_name)
+		allFunctions.append(func_name)
+
+for func_name in generatedFunctions:
+	params = apiutil.Parameters(func_name)
+	return_type = apiutil.ReturnType(func_name)
+	basicCallString = apiutil.MakeCallString(params)
+	declarationString = apiutil.MakeDeclarationString(params)
+	dlmCallString = basicCallString
+	chromiumProps = apiutil.ChromiumProps(func_name)
+
+	needClientState = 0
+	if apiutil.UsesClientState(func_name):
+		dlmCallString = basicCallString + ", clientState"
+		needClientState = 1
+
+	needDL = 0
+	if apiutil.CanCompile(func_name):
+		needDL = 1
+
+	print 'static %s EXPANDOSPU_APIENTRY expando%s( %s )' % ( return_type, func_name, declarationString)
+	print '{'
+	if needDL:
+		print '\tGLenum dlMode = crDLMGetCurrentMode();'
+	if needClientState:
+		print '\tCRContext *stateContext = crStateGetCurrent();'
+		print '\tCRClientState *clientState = NULL;'
+		print '\tif (stateContext != NULL) {'
+		print '\t\tclientState = &(stateContext->client);'
+		print '\t}'
+
+	if needDL:
+		if "checklist" in chromiumProps:
+			print '\tif (dlMode != GL_FALSE && crDLMCheckList%s(%s)) {' % (func_name, basicCallString)
+		else:
+			print '\tif (dlMode != GL_FALSE) {'
+		print '\t\tcrDLMCompile%s(%s);' % (func_name, dlmCallString)
+		# If we're only compiling, return now.
+		print '\t\tif (dlMode == GL_COMPILE) return %s;' % '0' if return_type != "void" else ""
+		print '\t}'
+
+	# If it gets this far, we're either just executing, or executing
+	# and compiling.  Either way, pass the call to the super SPU,
+	# and to the state tracker (if appropriate; note that we only
+	# track client-side state, not all state).
+	if return_type != "void":
+	    print '\t%s rc = expando_spu.super.%s(%s);' % (return_type, func_name, basicCallString)
+	else:
+	    print '\texpando_spu.super.%s(%s);' % (func_name, basicCallString)
+	if apiutil.SetsClientState(func_name):
+		print '\tcrState%s( %s );' % (func_name, basicCallString)	
+	
+	if return_type != "void":
+	    print "\treturn rc;"
+
+	print '}'
+	print ''
+
+# Generate the table of named functions. including all the static generated
+# functions as well as the special functions.
+print 'SPUNamedFunctionTable _cr_expando_table[] = {'
+for func_name in allFunctions:
+	print '\t{ "%s", (SPUGenericFunction) expando%s },' % (func_name, func_name )
+print '\t{ NULL, NULL }'
+print '};'
diff --git a/src/VBox/HostServices/SharedOpenGL/expando/expando_special b/src/VBox/HostServices/SharedOpenGL/expando/expando_special
new file mode 100644
index 0000000..18fdeed
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/expando/expando_special
@@ -0,0 +1,17 @@
+CreateContext
+DestroyContext
+MakeCurrent
+NewList
+EndList
+DeleteLists
+GenLists
+IsList
+CallList
+CallLists
+
+# Calls to be ignored.
+#VBoxConCreate
+#VBoxCreateContext
+#VBoxPackSetInjectThread
+#VBoxPresentComposition
+#VBoxWindowCreate
diff --git a/src/VBox/HostServices/SharedOpenGL/expando/expandospu.c b/src/VBox/HostServices/SharedOpenGL/expando/expandospu.c
new file mode 100644
index 0000000..f029349
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/expando/expandospu.c
@@ -0,0 +1,158 @@
+/* $Id: expandospu.c $ */
+/* Copyright (c) 2001, Stanford University
+ * All rights reserved
+ *
+ * See the file LICENSE.txt for information on redistributing this software.
+ */
+
+#include <stdio.h>
+#include "cr_spu.h"
+#include "cr_dlm.h"
+#include "cr_mem.h"
+#include "expandospu.h"
+
+extern GLint EXPANDOSPU_APIENTRY
+expandoCreateContext(const char *displayName, GLint visBits, GLint shareCtx)
+{
+	ExpandoContextState *contextState;
+	GLint contextId;
+
+	/* Allocate our own per-context record */
+	contextState = crCalloc(sizeof(ExpandoContextState));
+	if (contextState == NULL) {
+	    crError("expando: couldn't allocate per-context state");
+	    return 0;
+	}
+
+	/* Get an official context ID from our super */
+	contextId = expando_spu.super.CreateContext(displayName, visBits, shareCtx);
+
+	/* Supplement that with our DLM.  In a more correct situation, we should
+	 * see if we've been called through glXCreateContext, which has a parameter
+	 * for sharing DLMs.  We don't currently get that information, so for now
+	 * give each context its own DLM.
+	 */
+	contextState->dlm = crDLMNewDLM(0, NULL);
+	if (!contextState->dlm) {
+		crError("expando: couldn't get DLM!");
+	}
+
+	contextState->dlmContext = crDLMNewContext(contextState->dlm);
+	if (!contextState->dlmContext) {
+		crError("expando: couldn't get dlmContext");
+	}
+
+	/* The DLM needs us to use the state tracker to track client
+	 * state, so we can compile client-state-using functions correctly.
+	 */
+	contextState->State = crStateCreateContext(NULL, visBits, NULL);
+
+	/* Associate the Expando context with the user context. */
+	crHashtableAdd(expando_spu.contextTable, contextId, (void *)contextState);
+
+	return contextId;
+}
+
+void expando_free_context_state(void *data)
+{
+    ExpandoContextState *expandoContextState = (ExpandoContextState *)data;
+
+    crDLMFreeContext(expandoContextState->dlmContext);
+    crDLMFreeDLM(expandoContextState->dlm);
+    crStateDestroyContext(expandoContextState->State);
+    crFree(expandoContextState);
+}
+
+extern void EXPANDOSPU_APIENTRY
+expandoDestroyContext(GLint contextId)
+{
+	/* Destroy our context information */
+	crHashtableDelete(expando_spu.contextTable, contextId, 
+				expando_free_context_state);
+
+	/* Pass along the destruction to our super. */
+	expando_spu.super.DestroyContext(contextId);
+}
+
+extern void EXPANDOSPU_APIENTRY
+expandoMakeCurrent(GLint crWindow, GLint nativeWindow, GLint contextId)
+{
+	ExpandoContextState *expandoContextState;
+
+	expando_spu.super.MakeCurrent(crWindow, nativeWindow, contextId);
+
+	expandoContextState = crHashtableSearch(expando_spu.contextTable, contextId);
+	if (expandoContextState) {
+	    crDLMSetCurrentState(expandoContextState->dlmContext);
+	    crStateMakeCurrent(expandoContextState->State);
+	}
+	else {
+	    crDLMSetCurrentState(NULL);
+	    crStateMakeCurrent(NULL);
+	}
+}
+
+extern void EXPANDOSPU_APIENTRY
+expandoNewList(GLuint list, GLenum mode)
+{
+    crDebug("Expando SPU: expandoNewList()");
+	crDLMNewList(list, mode);
+}
+
+extern void EXPANDOSPU_APIENTRY
+expandoEndList(void)
+{
+    crDebug("Expando SPU: expandoEndList()");
+	crDLMEndList();
+}
+
+extern void EXPANDOSPU_APIENTRY
+expandoDeleteLists(GLuint first, GLsizei range)
+{
+	crDLMDeleteLists(first, range);
+}
+
+extern GLuint EXPANDOSPU_APIENTRY
+expandoGenLists(GLsizei range)
+{
+	 return crDLMGenLists(range);
+}
+
+extern GLboolean EXPANDOSPU_APIENTRY
+expandoIsList(GLuint list)
+{
+	 return crDLMIsList(list);
+}
+
+extern void EXPANDOSPU_APIENTRY
+expandoCallList(GLuint list)
+{
+	GLenum mode = crDLMGetCurrentMode();
+	if (mode != GL_FALSE) {
+		crDLMCompileCallList(list);
+		if (mode == GL_COMPILE) return;
+	}
+
+	/* Instead of passing through the CallList,
+	 * expand it into its components.  This will cause
+	 * a recursion if there are any compiled CallList
+	 * elements within the display list.
+	 */
+	crDLMReplayList(list, &expando_spu.self);
+}
+
+extern void EXPANDOSPU_APIENTRY
+expandoCallLists(GLsizei n, GLenum type, const GLvoid *lists)
+{
+	GLenum mode = crDLMGetCurrentMode();
+	if (mode != GL_FALSE) {
+		crDLMCompileCallLists(n, type, lists);
+		if (mode == GL_COMPILE) return;
+	}
+	/* Instead of passing through the CallLists,
+	 * expand it into its components.  This will cause
+	 * a recursion if there are any compiled CallLists
+	 * elements within the display list.
+	 */
+	crDLMReplayLists(n, type, lists, &expando_spu.self);
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/expando/expandospu.def b/src/VBox/HostServices/SharedOpenGL/expando/expandospu.def
new file mode 100644
index 0000000..9edc716
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/expando/expandospu.def
@@ -0,0 +1,6 @@
+; Copyright (c) 2001, Stanford University
+; All rights reserved.
+;
+; See the file LICENSE.txt for information on redistributing this software.
+EXPORTS
+SPULoad
diff --git a/src/VBox/HostServices/SharedOpenGL/expando/expandospu.h b/src/VBox/HostServices/SharedOpenGL/expando/expandospu.h
new file mode 100644
index 0000000..e905c54
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/expando/expandospu.h
@@ -0,0 +1,68 @@
+/* $Id: expandospu.h $ */
+/* Copyright (c) 2001, Stanford University
+ * All rights reserved.
+ *
+ * See the file LICENSE.txt for information on redistributing this software.
+ */
+
+#ifndef EXPANDO_SPU_H
+#define EXPANDO_SPU_H
+
+#ifdef WINDOWS
+#define EXPANDOSPU_APIENTRY __stdcall
+#else
+#define EXPANDOSPU_APIENTRY
+#endif
+
+#include "cr_glstate.h"
+#include "cr_spu.h"
+#include "cr_server.h"
+#include "cr_dlm.h"
+
+typedef struct {
+	int id;
+	int has_child;
+	SPUDispatchTable self, child, super;
+	CRServer *server;
+
+	/* Expando-specific variables */
+	CRHashTable *contextTable;
+} ExpandoSPU;
+
+typedef struct {
+	/* Local copy of state, needed by DLM to compile client-side stuff.
+	 * We only collect client-side state; we ignore all server-side
+	 * state (we just don't need it).
+	 */
+	CRContext *State; 
+
+	/* The DLM, and the per-context state for a DLM.  Right now, every
+	 * context will have its own DLM; it's possible in OpenGL to share
+	 * DLMs, but the Chromium interface doesn't allow it yet.
+	 */
+	CRDLM *dlm;
+	CRDLMContextState *dlmContext;
+} ExpandoContextState;
+
+extern ExpandoSPU expando_spu;
+
+extern SPUNamedFunctionTable _cr_expando_table[];
+
+extern SPUOptions expandoSPUOptions[];
+
+extern void expandospuGatherConfiguration( void );
+
+extern void expando_free_context_state(void *data);
+
+extern GLint EXPANDOSPU_APIENTRY expandoCreateContext(const char *displayName, GLint visBits, GLint shareCtx);
+extern void EXPANDOSPU_APIENTRY expandoDestroyContext(GLint contextId);
+extern void EXPANDOSPU_APIENTRY expandoMakeCurrent(GLint crWindow, GLint nativeWindow, GLint contextId);
+extern void EXPANDOSPU_APIENTRY expandoNewList(GLuint list, GLenum mode);
+extern void EXPANDOSPU_APIENTRY expandoEndList(void);
+extern void EXPANDOSPU_APIENTRY expandoDeleteLists(GLuint first, GLsizei range);
+extern GLuint EXPANDOSPU_APIENTRY expandoGenLists(GLsizei range);
+extern GLboolean EXPANDOSPU_APIENTRY expandoIsList(GLuint list);
+extern  void EXPANDOSPU_APIENTRY expandoCallList(GLuint list);
+extern void EXPANDOSPU_APIENTRY expandoCallLists(GLsizei n, GLenum type, const GLvoid *lists);
+
+#endif /* EXPANDO_SPU_H */
diff --git a/src/VBox/HostServices/SharedOpenGL/expando/expandospu_config.c b/src/VBox/HostServices/SharedOpenGL/expando/expandospu_config.c
new file mode 100644
index 0000000..9843f48
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/expando/expandospu_config.c
@@ -0,0 +1,48 @@
+/* $Id: expandospu_config.c $ */
+/* Copyright (c) 2001, Stanford University
+ * All rights reserved
+ *
+ * See the file LICENSE.txt for information on redistributing this software.
+ */
+
+#include "expandospu.h"
+
+//#include "cr_mothership.h"
+#include "cr_string.h"
+
+#include <stdio.h>
+
+static void __setDefaults( void )
+{
+}
+
+/* option, type, nr, default, min, max, title, callback
+ */
+SPUOptions expandoSPUOptions[] = {
+	{ NULL, CR_BOOL, 0, NULL, NULL, NULL, NULL, NULL },
+};
+
+
+void expandospuGatherConfiguration( void )
+{
+	CRConnection *conn;
+
+	__setDefaults();
+#if 0
+	/* Connect to the mothership and identify ourselves. */
+	
+	conn = crMothershipConnect( );
+	if (!conn)
+	{
+		/* The mothership isn't running.  Some SPU's can recover gracefully, some 
+		 * should issue an error here. */
+		crSPUSetDefaultParams( &expando_spu, expandoSPUOptions );
+		return;
+	}
+	crMothershipIdentifySPU( conn, expando_spu.id );
+
+	crSPUGetMothershipParams( conn, &expando_spu, expandoSPUOptions );
+
+	crMothershipDisconnect( conn );
+#endif
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/expando/expandospu_init.c b/src/VBox/HostServices/SharedOpenGL/expando/expandospu_init.c
new file mode 100644
index 0000000..b353c4c
--- /dev/null
+++ b/src/VBox/HostServices/SharedOpenGL/expando/expandospu_init.c
@@ -0,0 +1,87 @@
+/* $Id: expandospu_init.c $ */
+/* Copyright (c) 2001, Stanford University
+ * All rights reserved
+ *
+ * See the file LICENSE.txt for information on redistributing this software.
+ */
+
+#include <stdio.h>
+#include "cr_spu.h"
+#include "cr_dlm.h"
+#include "cr_hash.h"
+#include "expandospu.h"
+
+ExpandoSPU expando_spu;
+
+static SPUFunctions expando_functions = {
+	NULL, /* CHILD COPY */
+	NULL, /* DATA */
+	_cr_expando_table /* THE ACTUAL FUNCTIONS */
+};
+
+static SPUFunctions *
+expandoSPUInit( int id, SPU *child, SPU *self,
+								 unsigned int context_id,
+								 unsigned int num_contexts )
+{
+
+	(void) self;
+	(void) context_id;
+	(void) num_contexts;
+
+	expando_spu.id = id;
+	expando_spu.has_child = 0;
+	expando_spu.server = NULL;
+	if (child)
+	{
+		crSPUInitDispatchTable( &(expando_spu.child) );
+		crSPUCopyDispatchTable( &(expando_spu.child), &(child->dispatch_table) );
+		expando_spu.has_child = 1;
+	}
+	crSPUInitDispatchTable( &(expando_spu.super) );
+	crSPUCopyDispatchTable( &(expando_spu.super), &(self->superSPU->dispatch_table) );
+	expandospuGatherConfiguration();
+
+	/* Expando-specific initialization */
+	expando_spu.contextTable = crAllocHashtable();
+
+	/* We'll be using the state tracker for each context */
+	crStateInit();
+
+	return &expando_functions;
+}
+
+static void
+expandoSPUSelfDispatch(SPUDispatchTable *self)
+{
+	crSPUInitDispatchTable( &(expando_spu.self) );
+	crSPUCopyDispatchTable( &(expando_spu.self), self );
+
+	expando_spu.server = (CRServer *)(self->server);
+}
+
+
+static int
+expandoSPUCleanup(void)
+{
+    crFreeHashtable(expando_spu.contextTable, expando_free_context_state);
+    crStateDestroy();
+    return 1;
+}
+
+int
+SPULoad( char **name, char **super, SPUInitFuncPtr *init,
+				 SPUSelfDispatchFuncPtr *self, SPUCleanupFuncPtr *cleanup,
+				 SPUOptionsPtr *options, int *flags )
+{
+	*name = "expando";
+	//*super = "passthrough";
+	*super = "render";
+	*init = expandoSPUInit;
+	*self = expandoSPUSelfDispatch;
+	*cleanup = expandoSPUCleanup;
+	*options = expandoSPUOptions;
+	*flags = (SPU_NO_PACKER|SPU_NOT_TERMINAL|SPU_MAX_SERVERS_ZERO);
+	
+	return 1;
+}
diff --git a/src/VBox/HostServices/SharedOpenGL/render/VBoxOGLrenderspu.rc b/src/VBox/HostServices/SharedOpenGL/render/VBoxOGLrenderspu.rc
index e349828..b22d6c7 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/VBoxOGLrenderspu.rc
+++ b/src/VBox/HostServices/SharedOpenGL/render/VBoxOGLrenderspu.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox crOpenGL ICD\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxOGLrenderspu\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxOGLrenderspu.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu.c b/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
index 65de9e1..ece79dd 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
+++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu.c
@@ -1867,6 +1867,11 @@ DECLEXPORT(void) renderspuReparentWindow(GLint window)
     }
 }
 
+DECLEXPORT(void) renderspuSetUnscaledHiDPI(bool fEnable)
+{
+    render_spu.fUnscaledHiDPI = fEnable;
+}
+
 #define FILLIN( NAME, FUNC ) \
   table[i].name = crStrdup(NAME); \
   table[i].fn = (SPUGenericFunction) FUNC; \
diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu.h b/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
index 04996d3..68492d2 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
+++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
@@ -347,6 +347,9 @@ typedef struct {
     bool fInit;
 # endif
 #endif /* RT_OS_DARWIN */
+    /* If TRUE, render should tell window server to prevent artificial content
+     * up-scaling when displayed on HiDPI monitor. */
+    bool fUnscaledHiDPI;
 } RenderSPU;
 
 #ifdef RT_OS_WINDOWS
@@ -494,6 +497,7 @@ extern "C" {
 #endif
 DECLEXPORT(void) renderspuSetWindowId(uint64_t winId);
 DECLEXPORT(void) renderspuReparentWindow(GLint window);
+DECLEXPORT(void) renderspuSetUnscaledHiDPI(bool fEnable);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c
index 9ef119a..b5cb4b3 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c
+++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa.c
@@ -79,11 +79,7 @@ GLboolean renderspu_SystemVBoxCreateWindow(VisualInfo *pVisInfo, GLboolean fShow
     pWinInfo->nativeWindow = NULL;
     pWinInfo->currentCtx = NULL;
 
-#ifdef __LP64__
-    NativeNSViewRef pParentWin = (NativeNSViewRef)render_spu_parent_window_id;
-#else /* __LP64__ */
-    NativeNSViewRef pParentWin = (NativeNSViewRef)(uint32_t)render_spu_parent_window_id;
-#endif /* __LP64__ */
+    NativeNSViewRef pParentWin = (NativeNSViewRef)(uintptr_t)render_spu_parent_window_id;
 
     cocoaViewCreate(&pWinInfo->window, pWinInfo, pParentWin, pVisInfo->visAttribs);
 
@@ -95,11 +91,7 @@ GLboolean renderspu_SystemVBoxCreateWindow(VisualInfo *pVisInfo, GLboolean fShow
 
 void renderspu_SystemReparentWindow(WindowInfo *pWinInfo)
 {
-#ifdef __LP64__
-    NativeNSViewRef pParentWin = (NativeNSViewRef)render_spu_parent_window_id;
-#else /* __LP64__ */
-    NativeNSViewRef pParentWin = (NativeNSViewRef)(uint32_t)render_spu_parent_window_id;
-#endif /* __LP64__ */
+    NativeNSViewRef pParentWin = (NativeNSViewRef)(uintptr_t)render_spu_parent_window_id;
     cocoaViewReparent(pWinInfo->window, pParentWin);
 }
 
@@ -113,12 +105,7 @@ void renderspu_SystemDestroyWindow(WindowInfo *pWinInfo)
 void renderspu_SystemWindowPosition(WindowInfo *pWinInfo, GLint x, GLint y)
 {
     CRASSERT(pWinInfo);
-
-#ifdef __LP64__
-    NativeNSViewRef pParentWin = (NativeNSViewRef)render_spu_parent_window_id;
-#else /* __LP64__ */
-    NativeNSViewRef pParentWin = (NativeNSViewRef)(uint32_t)render_spu_parent_window_id;
-#endif /* __LP64__ */
+    NativeNSViewRef pParentWin = (NativeNSViewRef)(uintptr_t)render_spu_parent_window_id;
 
     /*pParentWin is unused in the call, otherwise it might hold incorrect value if for ex. last reparent call was for
       a different screen*/
diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h
index 8bc01a6..fef56d9 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h
+++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2012 Oracle Corporation
+ * Copyright (C) 2009-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -37,24 +37,27 @@ struct WindowInfo;
 ADD_COCOA_NATIVE_REF(NSView);
 ADD_COCOA_NATIVE_REF(NSOpenGLContext);
 
-/* OpenGL context management */
+/** @name OpenGL context management
+ * @{ */
 void cocoaGLCtxCreate(NativeNSOpenGLContextRef *ppCtx, GLbitfield fVisParams, NativeNSOpenGLContextRef pSharedCtx);
 void cocoaGLCtxDestroy(NativeNSOpenGLContextRef pCtx);
+/** @} */
 
-/* View management */
+/** @name View management
+ * @{ */
 void cocoaViewCreate(NativeNSViewRef *ppView, struct WindowInfo *pWinInfo, NativeNSViewRef pParentView, GLbitfield fVisParams);
 void cocoaViewReparent(NativeNSViewRef pView, NativeNSViewRef pParentView);
 void cocoaViewDestroy(NativeNSViewRef pView);
 void cocoaViewDisplay(NativeNSViewRef pView);
 void cocoaViewShow(NativeNSViewRef pView, GLboolean fShowIt);
 void cocoaViewSetPosition(NativeNSViewRef pView, NativeNSViewRef pParentView, int x, int y);
-void cocoaViewSetSize(NativeNSViewRef pView, int w, int h);
-void cocoaViewGetGeometry(NativeNSViewRef pView, int *pX, int *pY, int *pW, int *pH);
-
+void cocoaViewSetSize(NativeNSViewRef pView, int cx, int cy);
+void cocoaViewGetGeometry(NativeNSViewRef pView, int *px, int *py, int *pcx, int *pcy);
 void cocoaViewMakeCurrentContext(NativeNSViewRef pView, NativeNSOpenGLContextRef pCtx);
-void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, const GLint* paRects);
+void cocoaViewSetVisibleRegion(NativeNSViewRef pView, GLint cRects, const GLint *paRects);
 GLboolean cocoaViewNeedsEmptyPresent(NativeNSViewRef pView);
 void cocoaViewPresentComposition(NativeNSViewRef pView, const struct VBOXVR_SCR_COMPOSITOR_ENTRY *pChangedEntry);
+/** @} */
 
 RT_C_DECLS_END
 
diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
index 84bc632..16c39fd 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
+++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
@@ -1,8 +1,8 @@
 /* $Id: renderspu_cocoa_helper.m $ */
 /** @file
- * VirtualBox OpenGL Cocoa Window System Helper Implementation. 
- *  
- * This source file is shared between the SharedOpenGL HGCM service and the 
+ * VirtualBox OpenGL Cocoa Window System Helper Implementation.
+ *
+ * This source file is shared between the SharedOpenGL HGCM service and the
  * SVGA3d emulation.
  */
 
@@ -86,7 +86,7 @@
 #include <iprt/time.h>
 #include <iprt/thread.h>
 
-#include <VBox/VBoxOGLTest.h>
+#include <VBox/VBoxOGL.h>
 #include <VBox/log.h>
 
 #ifdef IN_VMSVGA3D
@@ -113,7 +113,7 @@
 /* Debug macros */
 /** @def FBO 
  * Disable this to see how the output is without the FBO in the middle of the processing chain. */
-# define FBO 1
+#define FBO 1
 /** @def CR_RENDER_FORCE_PRESENT_MAIN_THREAD
  * Force present schedule to main thread. */ 
 /** @def SHOW_WINDOW_BACKGROUND
@@ -123,7 +123,7 @@
 #if 0 || defined(DOXYGEN_RUNNING)
 # define CR_RENDER_FORCE_PRESENT_MAIN_THREAD
 # define SHOW_WINDOW_BACKGROUND 1
-# define DEBUG_VERBOSE      
+# define DEBUG_VERBOSE
 #endif
 
 #ifdef DEBUG_VERBOSE
@@ -136,8 +136,7 @@
 #  define DEBUG_WARN(text) do { LogRel(text); AssertFailed(); } while (0)
 # endif
 
-# define DEBUG_MSG(text) do { LogRel(text); } while (0)
-
+# define DEBUG_MSG(text)   do { LogRel(text); } while (0)
 # define DEBUG_MSG_1(text) do { LogRel(text); } while (0)
 
 #else
@@ -165,7 +164,7 @@
 #define DEBUG_FUNC_ENTER() DEBUG_MSG(("==>%s\n", __PRETTY_FUNCTION__))
 #define DEBUG_FUNC_LEAVE() DEBUG_MSG(("<==%s\n", __PRETTY_FUNCTION__))
 
-# define DEBUG_GL_SAVE_STATE() \
+#define DEBUG_GL_SAVE_STATE() \
     do { \
         glPushAttrib(GL_ALL_ATTRIB_BITS); \
         glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS); \
@@ -177,7 +176,7 @@
         glPushMatrix(); \
         glMatrixMode(GL_MODELVIEW); \
         glPushMatrix(); \
-    } while(0)
+    } while (0)
 
 #define DEBUG_GL_RESTORE_STATE() \
     do { \
@@ -210,11 +209,13 @@
 # define DEBUG_CHECK_GL_ERROR(a_szOp)   do {} while (0)
 #endif
 
+/* Whether we control NSView automatic content zooming on Retina/HiDPI displays. */
+#define VBOX_WITH_CONFIGURABLE_HIDPI_SCALING    1
 
 
 #ifdef IN_VMSVGA3D
 
-/* 
+/*
  * VMSVGA3D compatibility glue.
  */
 typedef struct WindowInfo WindowInfo;
@@ -353,18 +354,18 @@ static bool vboxCtxSyncCurrentInfo(void)
     {
         WindowInfo *pWinInfo = pCtxInfo->currentWindow;
         Assert(pWinInfo);
-        if (pCtxInfo->context != pCtx
-            || pWinInfo->window != pView)
+        if (   pCtxInfo->context != pCtx
+            || pWinInfo->window  != pView)
         {
             renderspu_SystemMakeCurrent(pWinInfo, 0, pCtxInfo);
             fAdjusted = true;
         }
     }
     else if (pCtx)
-        {
-            [NSOpenGLContext clearCurrentContext];
-            fAdjusted = true;
-        }
+    {
+        [NSOpenGLContext clearCurrentContext];
+        fAdjusted = true;
+    }
     
     return fAdjusted;
 #endif
@@ -376,25 +377,25 @@ static bool vboxCtxSyncCurrentInfo(void)
  */ 
 typedef struct VBOX_CR_RENDER_CTX_INFO
 {
-    bool fIsValid;
-    NSOpenGLContext *pCtx;
-    NSView *pView;
+    bool                fIsValid;
+    NSOpenGLContext    *pCtx;
+    NSView             *pView;
 } VBOX_CR_RENDER_CTX_INFO;
 /** Pointer to render context info for use with vboxCtxEnter/Leave. */
 typedef VBOX_CR_RENDER_CTX_INFO *PVBOX_CR_RENDER_CTX_INFO;
 
-static void vboxCtxEnter(NSOpenGLContext*pNewCtx, PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
+static void vboxCtxEnter(NSOpenGLContext *pNewCtx, PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
 {
-    NSOpenGLContext *pOldCtx = vboxCtxGetCurrent(); 
-    NSView *pOldView = pOldCtx ? [pOldCtx view] : nil;
-    NSView *pNewView = [pNewCtx view];
+    NSOpenGLContext *pOldCtx  = vboxCtxGetCurrent(); 
+    NSView          *pOldView = pOldCtx ? [pOldCtx view] : nil;
+    NSView          *pNewView = [pNewCtx view];
 
     Assert(pNewCtx);
 
-    if (pOldCtx != pNewCtx 
+    if (   pOldCtx  != pNewCtx 
         || pOldView != pNewView)
     {
-        if(pOldCtx != nil)
+        if (pOldCtx != nil)
             glFlush();
         
         DEBUG_CLEAR_GL_ERRORS();
@@ -402,9 +403,9 @@ static void vboxCtxEnter(NSOpenGLContext*pNewCtx, PVBOX_CR_RENDER_CTX_INFO pCtxI
         DEBUG_CHECK_GL_ERROR("makeCurrentContext");
         
         pCtxInfo->fIsValid = true;
-        pCtxInfo->pCtx = pOldCtx;
+        pCtxInfo->pCtx     = pOldCtx;
         /** @todo r=bird: Why do we save the NEW VIEW here? vboxCtxLeave calls it 'pOldView'. Bug? */
-        pCtxInfo->pView = pNewView;
+        pCtxInfo->pView    = pNewView; 
     }
     else
     {
@@ -417,8 +418,8 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
 {
     if (pCtxInfo->fIsValid)
     {
-        NSOpenGLContext *pOldCtx = pCtxInfo->pCtx;
-        NSView *pOldView = pCtxInfo->pView;
+        NSOpenGLContext *pOldCtx  = pCtxInfo->pCtx;
+        NSView          *pOldView = pCtxInfo->pView;
     
         glFlush();
         if (pOldCtx != nil)
@@ -428,7 +429,7 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
                one (wrt vboxCtxEnter) before making it current. */
             /** @todo r=bird: Figure out what we really want to do here, and either rename
              *        pOldView or fix the code. */
-            if ([pOldCtx view] != pOldView)
+            if ([pOldCtx view] != pOldView) 
             {
                 DEBUG_CLEAR_GL_ERRORS();
                 [pOldCtx setView: pOldView];
@@ -441,8 +442,8 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
             
 #ifdef VBOX_STRICT
             {
-                NSOpenGLContext *pTstOldCtx = [NSOpenGLContext currentContext];
-                NSView *pTstOldView = pTstOldCtx ? [pTstOldCtx view] : nil;
+                NSOpenGLContext *pTstOldCtx  = [NSOpenGLContext currentContext];
+                NSView          *pTstOldView = pTstOldCtx ? [pTstOldCtx view] : nil;
                 Assert(pTstOldCtx == pOldCtx);
                 Assert(pTstOldView == pOldView);
             }
@@ -455,19 +456,21 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
     }
 }
 
+
 /** 
  * Custom OpenGL context class.
  *
  * This implementation doesn't allow to set a view to the context, but save the
- * view for later use. Also it saves a copy of the pixel format used to create 
- * that context for later use. */
+ * view for later use.  Also it saves a copy of the pixel format used to create 
+ * that context for later use. 
+ */ 
 @interface OverlayOpenGLContext: NSOpenGLContext
 {
 @private
     NSOpenGLPixelFormat *m_pPixelFormat;
     NSView              *m_pView;
 }
-- (NSOpenGLPixelFormat*)openGLPixelFormat;
+- (NSOpenGLPixelFormat *)openGLPixelFormat;
 @end
 
 /**
@@ -495,9 +498,9 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
 @interface VBoxTaskPerformSelector : VBoxTask
 {
 @private
-    id m_Object;
+    id  m_Object;
     SEL m_Selector;
-    id m_Arg;
+    id  m_Arg;
 }
 - (id)initWithObject:(id)aObject selector:(SEL)aSelector arg:(id)aArg;
 - (void)run;
@@ -516,7 +519,6 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
 - (id)initWithObject:(id)aObject selector:(SEL)aSelector arg:(id)aArg
 {
     self = [super init];
-
     if (self)
     {
         [aObject retain];
@@ -589,7 +591,7 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
  *  
  * @param   pTask               Task to add.  Reference is NOT consumed.
  */
-- (void)add:(VBoxTask*)pTask
+- (void)add:(VBoxTask *)pTask
 {
     [pTask retain];
     int rc = RTCritSectEnter(&m_Lock);
@@ -607,7 +609,7 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
 
 - (void)run
 {
-    for(;;)
+    for (;;)
     {
         /*
          * Dequeue a task.
@@ -629,7 +631,7 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
             break;
         }
 
-        VBoxTask* pTask = (VBoxTask*)[m_pArray objectAtIndex:m_CurIndex];
+        VBoxTask *pTask = (VBoxTask *)[m_pArray objectAtIndex:m_CurIndex];
         Assert(pTask != nil);
         
         ++m_CurIndex;
@@ -658,9 +660,9 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
 - (void)dealloc
 {
     NSUInteger count = [m_pArray count];
-    for(;m_CurIndex < count; ++m_CurIndex)
+    for (;m_CurIndex < count; ++m_CurIndex)
     {
-        VBoxTask* pTask = (VBoxTask*)[m_pArray objectAtIndex:m_CurIndex];
+        VBoxTask *pTask = (VBoxTask*)[m_pArray objectAtIndex:m_CurIndex];
         DEBUG_WARN(("dealloc with non-empty tasks! %p\n", pTask));
         [pTask release];
     }
@@ -683,12 +685,12 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
     VBoxTaskComposite *m_pTasks;
 }
 - (id)init;
-- (void)add:(VBoxTask*)pTask;
+- (void)add:(VBoxTask *)pTask;
 - (void)addObj:(id)aObject selector:(SEL)aSelector arg:(id)aArg;
 - (void)runTasks;
 - (bool)runTasksSyncIfPossible;
 - (void)dealloc;
-+ (VBoxMainThreadTaskRunner*) globalInstance;
++ (VBoxMainThreadTaskRunner *) globalInstance;
 @end
 
 @implementation VBoxMainThreadTaskRunner
@@ -703,7 +705,7 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
     return self;
 }
 
-+ (VBoxMainThreadTaskRunner*) globalInstance
++ (VBoxMainThreadTaskRunner *) globalInstance
 {
     static dispatch_once_t s_DispatchOnce;
     static VBoxMainThreadTaskRunner *s_pRunner = nil;
@@ -713,7 +715,7 @@ static void vboxCtxLeave(PVBOX_CR_RENDER_CTX_INFO pCtxInfo)
     return s_pRunner;
 }
 
-- (void)add:(VBoxTask*)pTask
+- (void)add:(VBoxTask *)pTask
 {
     DEBUG_FUNC_ENTER();
     [m_pTasks add:pTask];
@@ -821,6 +823,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
      *        stored in an inaccessible static variable! */
     [m_pTasks release];
     m_pTasks = nil;
+
     [super dealloc];
 }
 
@@ -831,34 +834,35 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 #endif
 
 /** 
- * The custom view class.
+ * The custom view class. 
  *  
- * This is the main class of the cocoa OpenGL implementation. It manages a 
- * frame buffer object for the rendering of the guest applications. The guest 
+ * This is the main class of the cocoa OpenGL implementation.  It manages a 
+ * frame buffer object for the rendering of the guest applications.  The guest 
  * applications render in this frame buffer which is bound to an OpenGL texture.
  * To display the guest content, a secondary shared OpenGL context of the main 
- * OpenGL context is created. The secondary context is marked as non-opaque and
+ * OpenGL context is created.  The secondary context is marked as non-opaque and
  * the texture is displayed on an object which is composed out of the several 
- * visible region rectangles. */
- at interface OverlayView: NSView
+ * visible region rectangles. 
+ */ 
+ at interface OverlayView : NSView
 {
 @private
-    NSView          *m_pParentView;
-    NSWindow        *m_pOverlayWin;
-
-    NSOpenGLContext *m_pGLCtx;
-    NSOpenGLContext *m_pSharedGLCtx;
+    NSView             *m_pParentView;
+    NSWindow           *m_pOverlayWin;
+                       
+    NSOpenGLContext    *m_pGLCtx;
+    NSOpenGLContext    *m_pSharedGLCtx;
     RTTHREAD            m_Thread;
-
-    GLuint           m_FBOId;
+                       
+    GLuint              m_FBOId;
 
 #ifndef IN_VMSVGA3D
     /** The corresponding dock tile view of this OpenGL view & all helper
      * members. */
-    DockOverlayView *m_DockTileView;
+    DockOverlayView    *m_DockTileView;
 
-    GLfloat          m_FBOThumbScaleX;
-    GLfloat          m_FBOThumbScaleY;
+    GLfloat             m_FBOThumbScaleX;
+    GLfloat             m_FBOThumbScaleY;
     uint64_t            m_msDockUpdateTS;
 #endif
 
@@ -870,14 +874,14 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     /** @} */
 
     /** @name Position/Size tracking
-     * @{ */
-    NSPoint          m_Pos;
-    NSSize           m_Size;
+     * @{ */ 
+    NSPoint             m_Pos;
+    NSSize              m_Size;
     /** @} */
 
     /** This is necessary for clipping on the root window */
-    NSRect           m_RootRect;
-    float            m_yInvRootOffset;
+    NSRect              m_RootRect;
+    float               m_yInvRootOffset;
     
 #ifndef IN_VMSVGA3D
     CR_BLITTER         *m_pBlitter;
@@ -892,24 +896,28 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 - (id)initWithFrame:(NSRect)frame thread:(RTTHREAD)aThread parentView:(NSView *)pParentView winInfo:(WindowInfo *)pWinInfo 
          fVisParams:(GLbitfield) fVisParams;
 - (void)setGLCtx:(NSOpenGLContext*)pCtx;
-- (NSOpenGLContext*)glCtx;
+- (NSOpenGLContext *)glCtx;
 
-- (void)setParentView: (NSView*)view;
-- (NSView*)parentView;
-- (void)setOverlayWin: (NSWindow*)win;
-- (NSWindow*)overlayWin;
+- (void)setParentView: (NSView *)view;
+- (NSView *)parentView;
+- (void)setOverlayWin: (NSWindow *)win;
+- (NSWindow *)overlayWin;
 
 - (void)vboxSetPos:(NSPoint)pos;
 - (void)vboxSetPosUI:(NSPoint)pos;
-- (void)vboxSetPosUIObj:(NSValue*)pPos;
+- (void)vboxSetPosUIObj:(NSValue *)pPos;
 - (NSPoint)pos;
 - (bool)isEverSized;
 - (void)vboxDestroy;
 - (void)vboxSetSizeUI:(NSSize)size;
-- (void)vboxSetSizeUIObj:(NSValue*)pSize;
+- (void)vboxSetSizeUIObj:(NSValue *)pSize;
 - (void)vboxSetSize:(NSSize)size;
 - (NSSize)size;
 - (void)updateViewportCS;
+#ifdef VBOX_WITH_CONFIGURABLE_HIDPI_SCALING
+- (NSRect)safeConvertRectToBacking:(NSRect *)pRect;
+- (CGFloat)safeGetBackingScaleFactor;
+#endif
 - (NSRect)safeConvertToScreen:(NSRect *)pRect;
 - (void)vboxReshapePerform;
 - (void)vboxReshapeOnResizePerform;
@@ -923,25 +931,25 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 - (void)makeCurrentFBO;
 - (void)swapFBO;
 - (void)vboxSetVisible:(GLboolean)fVisible;
-- (void)vboxSetVisibleUIObj:(NSNumber*)pVisible;
+- (void)vboxSetVisibleUIObj:(NSNumber *)pVisible;
 - (void)vboxSetVisibleUI:(GLboolean)fVisible;
 - (void)vboxTryDraw;
 - (void)vboxTryDrawUI;
-- (void)vboxReparent:(NSView*)pParentView;
-- (void)vboxReparentUI:(NSView*)pParentView;
-- (void)vboxPresent:(const VBOXVR_SCR_COMPOSITOR*)pCompositor;
-- (void)vboxPresentCS:(const VBOXVR_SCR_COMPOSITOR*)pCompositor;
+- (void)vboxReparent:(NSView *)pParentView;
+- (void)vboxReparentUI:(NSView *)pParentView;
+- (void)vboxPresent:(const VBOXVR_SCR_COMPOSITOR *)pCompositor;
+- (void)vboxPresentCS:(const VBOXVR_SCR_COMPOSITOR *)pCompositor;
 #ifndef IN_VMSVGA3D
-- (void)vboxPresentToDockTileCS:(const VBOXVR_SCR_COMPOSITOR*)pCompositor;
+- (void)vboxPresentToDockTileCS:(const VBOXVR_SCR_COMPOSITOR *)pCompositor;
 #endif
-- (void)vboxPresentToViewCS:(const VBOXVR_SCR_COMPOSITOR*)pCompositor;
-- (void)presentComposition:(const VBOXVR_SCR_COMPOSITOR_ENTRY*)pChangedEntry;
+- (void)vboxPresentToViewCS:(const VBOXVR_SCR_COMPOSITOR *)pCompositor;
+- (void)presentComposition:(const VBOXVR_SCR_COMPOSITOR_ENTRY *)pChangedEntry;
 #ifndef IN_VMSVGA3D
 - (void)vboxBlitterSyncWindow;
 #endif
 
 - (void)clearVisibleRegions;
-- (void)setVisibleRegions:(GLint)cRects paRects:(const GLint*)paRects;
+- (void)setVisibleRegions:(GLint)cRects paRects:(const GLint *)paRects;
 - (GLboolean)vboxNeedsEmptyPresent;
 
 #ifndef IN_VMSVGA3D
@@ -958,7 +966,8 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
  * main window changes. Whenever the main window is changed
  * (which happens on fullscreen/seamless entry/exit) the overlay
  * window is informed & can add them self as a child window
- * again. */
+ * again. 
+ */ 
 @class OverlayWindow;
 @interface OverlayHelperView: NSView
 {
@@ -974,18 +983,19 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
  * This is the overlay window which contains our custom NSView.
  * Its a direct child of the Qt Main window. It marks its background
  * transparent & non opaque to make clipping possible. It also disable mouse
- * events and handle frame change events of the parent view. */
- at interface OverlayWindow: NSWindow
+ * events and handle frame change events of the parent view. 
+ */ 
+ at interface OverlayWindow : NSWindow
 {
 @private
-    NSView            *m_pParentView;
-    OverlayView       *m_pOverlayView;
-    OverlayHelperView *m_pOverlayHelperView;
-    NSThread          *m_Thread;
+    NSView             *m_pParentView;
+    OverlayView        *m_pOverlayView;
+    OverlayHelperView  *m_pOverlayHelperView;
+    NSThread           *m_Thread;
 }
-- (id)initWithParentView:(NSView*)pParentView overlayView:(OverlayView*)pOverlayView;
+- (id)initWithParentView:(NSView *)pParentView overlayView:(OverlayView *)pOverlayView;
 - (void)parentWindowFrameChanged:(NSNotification *)note;
-- (void)parentWindowChanged:(NSWindow*)pWindow;
+- (void)parentWindowChanged:(NSWindow *)pWindow;
 @end
 
 
@@ -995,9 +1005,9 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
  */
 @interface DockOverlayView: NSView
 {
-    NSBitmapImageRep *m_ThumbBitmap;
-    NSImage          *m_ThumbImage;
-    NSLock           *m_Lock;
+    NSBitmapImageRep   *m_ThumbBitmap;
+    NSImage            *m_ThumbImage;
+    NSLock             *m_Lock;
 }
 - (void)dealloc;
 - (void)cleanup;
@@ -1005,8 +1015,8 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 - (void)unlock;
 - (void)setFrame:(NSRect)frame;
 - (void)drawRect:(NSRect)aRect;
-- (NSBitmapImageRep*)thumbBitmap;
-- (NSImage*)thumbImage;
+- (NSBitmapImageRep *)thumbBitmap;
+- (NSImage *)thumbImage;
 @end
 
 @implementation DockOverlayView
@@ -1014,13 +1024,13 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 {
     DEBUG_FUNC_ENTER();
     self = [super init];
-
     if (self)
     {
         /* 
          * We need a lock cause the thumb image could be accessed from the main
          * thread when someone is calling display on the dock tile & from the
-         * OpenGL thread when the thumbnail is updated. */
+         * OpenGL thread when the thumbnail is updated. 
+         */ 
         m_Lock = [[NSLock alloc] init];
     }
 
@@ -1050,6 +1060,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
         [m_ThumbImage release];
         m_ThumbImage = nil;
     }
+
     if (m_ThumbBitmap != nil)
     {
         [m_ThumbBitmap release];
@@ -1095,10 +1106,12 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
             colorSpaceName:NSDeviceRGBColorSpace
             bitmapFormat:NSAlphaFirstBitmapFormat
             bytesPerRow:frame.size.width * 4
-            bitsPerPixel:8 * 4];
+            bitsPerPixel:8 * 4
+        ];
         m_ThumbImage = [[NSImage alloc] initWithSize:[m_ThumbBitmap size]];
         [m_ThumbImage addRepresentation:m_ThumbBitmap];
     }
+
     [self unlock];
     DEBUG_FUNC_LEAVE();
 }
@@ -1115,6 +1128,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     NSRect frame;
     DEBUG_FUNC_ENTER();
     [self lock];
+
 #ifdef SHOW_WINDOW_BACKGROUND
     [[NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:0.7] set];
     frame = [self frame];
@@ -1122,27 +1136,28 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 #endif /* SHOW_WINDOW_BACKGROUND */
     if (m_ThumbImage != nil)
         [m_ThumbImage drawAtPoint:NSMakePoint(0, 0) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
+
     [self unlock];
     DEBUG_FUNC_LEAVE();
 }
 
-- (NSBitmapImageRep*)thumbBitmap
+- (NSBitmapImageRep *)thumbBitmap
 {
     DEBUG_FUNC_ENTER();
     DEBUG_FUNC_LEAVE();
     return m_ThumbBitmap;
 }
 
-- (NSImage*)thumbImage
+- (NSImage *)thumbImage
 {
     DEBUG_FUNC_ENTER();
     DEBUG_FUNC_LEAVE();
-
     return m_ThumbImage;
 }
 @end
 #endif /* !IN_VMSVGA3D */
 
+
 /********************************************************************************
 *
 * OverlayOpenGLContext class implementation
@@ -1150,7 +1165,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 ********************************************************************************/
 @implementation OverlayOpenGLContext
 
--(id)initWithFormat:(NSOpenGLPixelFormat*)format shareContext:(NSOpenGLContext*)share
+-(id)initWithFormat:(NSOpenGLPixelFormat *)format shareContext:(NSOpenGLContext *)share
 {
     DEBUG_FUNC_ENTER();
 
@@ -1162,18 +1177,15 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     if (self)
         m_pPixelFormat = format;
 
-    DEBUG_MSG(("OCTX(%p): init OverlayOpenGLContext\n", (void*)self));
-
+    DEBUG_MSG(("OCTX(%p): init OverlayOpenGLContext\n", (void *)self));
     DEBUG_FUNC_LEAVE();
-
     return self;
 }
 
 - (void)dealloc
 {
     DEBUG_FUNC_ENTER();
-
-    DEBUG_MSG(("OCTX(%p): dealloc OverlayOpenGLContext\n", (void*)self));
+    DEBUG_MSG(("OCTX(%p): dealloc OverlayOpenGLContext\n", (void *)self));
 
     [m_pPixelFormat release];
 
@@ -1190,15 +1202,13 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     [m_pPixelFormat getValues:&val forAttribute:NSOpenGLPFADoubleBuffer forVirtualScreen:0];
     
     DEBUG_FUNC_LEAVE();
-    
     return val == GL_TRUE ? YES : NO;
 }
 
--(void)setView:(NSView*)view
+-(void)setView:(NSView *)view
 {
     DEBUG_FUNC_ENTER();
-
-    DEBUG_MSG(("OCTX(%p): setView: new view: %p\n", (void*)self, (void*)view));
+    DEBUG_MSG(("OCTX(%p): setView: new view: %p\n", (void *)self, (void *)view));
 
 #if 1 /* def FBO */
     m_pView = view;;
@@ -1209,11 +1219,10 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     DEBUG_FUNC_LEAVE();
 }
 
--(NSView*)view
+-(NSView *)view
 {
     DEBUG_FUNC_ENTER();
     DEBUG_FUNC_LEAVE();
-
 #if 1 /* def FBO */
     return m_pView;
 #else
@@ -1224,8 +1233,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 -(void)clearDrawable
 {
     DEBUG_FUNC_ENTER();
-
-    DEBUG_MSG(("OCTX(%p): clearDrawable\n", (void*)self));
+    DEBUG_MSG(("OCTX(%p): clearDrawable\n", (void *)self));
 
     m_pView = NULL;;
     [super clearDrawable];
@@ -1233,7 +1241,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     DEBUG_FUNC_LEAVE();
 }
 
--(NSOpenGLPixelFormat*)openGLPixelFormat
+-(NSOpenGLPixelFormat *)openGLPixelFormat
 {
     DEBUG_FUNC_ENTER();
     DEBUG_FUNC_LEAVE();
@@ -1262,18 +1270,15 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 
     m_pOverlayWindow = pOverlayWindow;
 
-    DEBUG_MSG(("OHVW(%p): init OverlayHelperView\n", (void*)self));
-
+    DEBUG_MSG(("OHVW(%p): init OverlayHelperView\n", (void *)self));
     DEBUG_FUNC_LEAVE();
-
     return self;
 }
 
 -(void)viewDidMoveToWindow
 {
     DEBUG_FUNC_ENTER();
-
-    DEBUG_MSG(("OHVW(%p): viewDidMoveToWindow: new win: %p\n", (void*)self, (void*)[self window]));
+    DEBUG_MSG(("OHVW(%p): viewDidMoveToWindow: new win: %p\n", (void *)self, (void *)[self window]));
 
     [m_pOverlayWindow parentWindowChanged:[self window]];
     
@@ -1282,6 +1287,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 
 @end
 
+
 /********************************************************************************
 *
 * OverlayWindow class implementation
@@ -1289,10 +1295,9 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 ********************************************************************************/
 @implementation OverlayWindow
 
-- (id)initWithParentView:(NSView*)pParentView overlayView:(OverlayView*)pOverlayView
+- (id)initWithParentView:(NSView *)pParentView overlayView:(OverlayView *)pOverlayView
 {
     DEBUG_FUNC_ENTER();
-
     NSWindow *pParentWin = nil;
 
     self = [super initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
@@ -1313,6 +1318,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
         m_pOverlayHelperView = [[OverlayHelperView alloc] initWithOverlayWindow:NSZeroRect
                                                                   overlayWindow:self];
 #endif
+
         /* Add the helper view as a child of the parent view to get notifications */
         [pParentView addSubview:m_pOverlayHelperView];
 
@@ -1325,6 +1331,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 #endif
         [self setOpaque:NO];
         [self setAlphaValue:.999];
+
         /* Disable mouse events for this window */
         [self setIgnoresMouseEvents:YES];
 
@@ -1343,18 +1350,16 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
          * parentWindowChanged. */
         [pParentWin addChildWindow:self ordered:NSWindowAbove];
     }
-    DEBUG_MSG(("OWIN(%p): init OverlayWindow\n", (void*)self));
 
+    DEBUG_MSG(("OWIN(%p): init OverlayWindow\n", (void *)self));
     DEBUG_FUNC_LEAVE();
-
     return self;
 }
 
 - (void)dealloc
 {
     DEBUG_FUNC_ENTER();
-
-    DEBUG_MSG(("OWIN(%p): dealloc OverlayWindow\n", (void*)self));
+    DEBUG_MSG(("OWIN(%p): dealloc OverlayWindow\n", (void *)self));
 
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
@@ -1366,22 +1371,22 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     DEBUG_FUNC_LEAVE();
 }
 
-- (void)parentWindowFrameChanged:(NSNotification*)pNote
+- (void)parentWindowFrameChanged:(NSNotification *)pNote
 {
     DEBUG_FUNC_ENTER();
-
-    DEBUG_MSG(("OWIN(%p): parentWindowFrameChanged\n", (void*)self));
+    DEBUG_MSG(("OWIN(%p): parentWindowFrameChanged\n", (void *)self));
 
     /* 
      * Reposition this window with the help of the OverlayView. Perform the
-     * call in the OpenGL thread. */
+     * call in the OpenGL thread. 
+     */ 
     /*
     [m_pOverlayView performSelector:@selector(vboxReshapePerform) onThread:m_Thread withObject:nil waitUntilDone:YES];
     */
 
     if ([m_pOverlayView isEverSized])
     {    
-        if([NSThread isMainThread])
+        if ([NSThread isMainThread])
             [m_pOverlayView vboxReshapePerform];
         else
             [self performSelectorOnMainThread:@selector(vboxReshapePerform) withObject:nil waitUntilDone:NO];
@@ -1390,15 +1395,14 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     DEBUG_FUNC_LEAVE();
 }
 
-- (void)parentWindowChanged:(NSWindow*)pWindow
+- (void)parentWindowChanged:(NSWindow *)pWindow
 {
     DEBUG_FUNC_ENTER();
-
-    DEBUG_MSG(("OWIN(%p): parentWindowChanged\n", (void*)self));
+    DEBUG_MSG(("OWIN(%p): parentWindowChanged\n", (void *)self));
 
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 
-    if(pWindow != nil)
+    if (pWindow != nil)
     {
         /* Ask to get notifications when our parent window frame changes. */
         [[NSNotificationCenter defaultCenter]
@@ -1406,11 +1410,14 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
             selector:@selector(parentWindowFrameChanged:)
             name:NSWindowDidResizeNotification
             object:pWindow];
+
         /* Add us self as child window */
         [pWindow addChildWindow:self ordered:NSWindowAbove];
+
         /* 
          * Reshape the overlay view after a short waiting time to let the main
-         * window resize itself properly. */
+         * window resize itself properly.
+         */
         /*
         [m_pOverlayView performSelector:@selector(vboxReshapePerform) withObject:nil afterDelay:0.2];
         [NSTimer scheduledTimerWithTimeInterval:0.2 target:m_pOverlayView selector:@selector(vboxReshapePerform) userInfo:nil repeats:NO];
@@ -1418,7 +1425,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 
         if ([m_pOverlayView isEverSized])
         {    
-            if([NSThread isMainThread])
+            if ([NSThread isMainThread])
                 [m_pOverlayView vboxReshapePerform];
             else
                 [self performSelectorOnMainThread:@selector(vboxReshapePerform) withObject:nil waitUntilDone:NO];
@@ -1461,13 +1468,18 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     m_pBlitter                = nil;
     m_pWinInfo                = pWinInfo;
 #endif
-    m_fNeedViewportUpdate     = true;        
+    m_fNeedViewportUpdate     = true;
     m_fNeedCtxUpdate          = true;
     m_fDataVisible            = false;
     m_fCleanupNeeded          = false;
     m_fEverSized              = false;
-    
+
     self = [super initWithFrame:frame];
+#if defined(VBOX_WITH_CONFIGURABLE_HIDPI_SCALING) && !defined(IN_VMSVGA3D)
+    /* Always allocate HiDPI-ready backing store for NSView, so we will be able change HiDPI scaling option in runtime. */
+    crDebug("HiDPI: Allocate big backing store for NSView. Up-scaling is currently %s.", render_spu.fUnscaledHiDPI ? "OFF" : "ON");
+    [self performSelector:@selector(setWantsBestResolutionOpenGLSurface:) withObject: (id)YES];
+#endif
 
     COCOA_LOG_FLOW(("%s: returns self=%p\n", __PRETTY_FUNCTION__, (void *)self));
     return self;
@@ -1489,15 +1501,12 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
             [m_pSharedGLCtx clearDrawable];
 
         [m_pSharedGLCtx release];
-
         m_pSharedGLCtx = nil;
         
 
 #ifndef IN_VMSVGA3D
         CrBltTerm(m_pBlitter);
-        
         RTMemFree(m_pBlitter);
-        
         m_pBlitter = nil;
 #endif
     }
@@ -1509,10 +1518,9 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 
 - (void)dealloc
 {
-    COCOA_LOG_FLOW(("%s: self=%p\n", __PRETTY_FUNCTION__, (void*)self));
+    COCOA_LOG_FLOW(("%s: self=%p\n", __PRETTY_FUNCTION__, (void *)self));
 
     [self cleanupData];
-
     [super dealloc];
 
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
@@ -1528,7 +1536,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
-- (void)setGLCtx:(NSOpenGLContext*)pCtx
+- (void)setGLCtx:(NSOpenGLContext *)pCtx
 {
     COCOA_LOG_FLOW(("%s: self=%p pCtx=%p (old=%p)\n", __PRETTY_FUNCTION__, (void *)self, (void *)pCtx, m_pGLCtx));
 
@@ -1556,21 +1564,19 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
-- (NSOpenGLContext*)glCtx
+- (NSOpenGLContext *)glCtx
 {
     COCOA_LOG_FLOW(("%s: self=%p returns %p\n", __PRETTY_FUNCTION__, (void *)self, (void *)m_pGLCtx));
-
     return m_pGLCtx;
 }
 
-- (NSView*)parentView
+- (NSView *)parentView
 {
     COCOA_LOG_FLOW(("%s: self=%p returns %p\n", __PRETTY_FUNCTION__, (void *)self, (void *)m_pParentView));
-
     return m_pParentView;
 }
 
-- (void)setParentView:(NSView*)pView
+- (void)setParentView:(NSView *)pView
 {
     COCOA_LOG_FLOW(("%s: self=%p pView=%p (old=%p)\n", __PRETTY_FUNCTION__, (void *)self, (void *)pView, m_pParentView));
 
@@ -1579,7 +1585,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
-- (void)setOverlayWin:(NSWindow*)pWin
+- (void)setOverlayWin:(NSWindow *)pWin
 {
     COCOA_LOG_FLOW(("%s: self=%p pWin=%p (old=%p)\n", __PRETTY_FUNCTION__, (void *)self, (void *)pWin, m_pOverlayWin));
 
@@ -1588,10 +1594,9 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
-- (NSWindow*)overlayWin
+- (NSWindow *)overlayWin
 {
     COCOA_LOG_FLOW(("%s: self=%p returns %p\n", __PRETTY_FUNCTION__, (void *)self, (void *)m_pOverlayWin));
-
     return m_pOverlayWin;
 }
 
@@ -1606,11 +1611,11 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 
     if (m_fEverSized)
         [self vboxReshapePerform];
-        
+
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
-- (void)vboxSetPosUIObj:(NSValue*)pPos
+- (void)vboxSetPosUIObj:(NSValue *)pPos
 {
     COCOA_LOG_FLOW(("%s: self=%p pPos=%p (%d,%d) (old pos=%d,%d)\n", __PRETTY_FUNCTION__, (void *)self, pPos,
                     (int)[pPos pointValue].x, (int)[pPos pointValue].y, (int)m_Pos.x, (int)m_Pos.y));
@@ -1648,8 +1653,8 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 - (void)vboxDestroy
 {
     COCOA_LOG_FLOW(("%s: self=%p\n", __PRETTY_FUNCTION__, (void *)self));
-    BOOL fIsMain = [NSThread isMainThread];
-    NSWindow *pWin = nil;
+    BOOL        fIsMain = [NSThread isMainThread];
+    NSWindow   *pWin    = nil;
     
     Assert(fIsMain);
 
@@ -1692,7 +1697,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
-- (void)vboxSetSizeUIObj:(NSValue*)pSize
+- (void)vboxSetSizeUIObj:(NSValue *)pSize
 {
     COCOA_LOG_FLOW(("%s: self=%p pSize=%p (%d,%d)\n", __PRETTY_FUNCTION__, (void *)self, (void *)pSize,
                     (int)[pSize sizeValue].width, (int)[pSize sizeValue].height));
@@ -1706,11 +1711,11 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 - (void)vboxSetSizeUI:(NSSize)size
 {
     COCOA_LOG_FLOW(("%s: self=%p size=%d,%d\n", __PRETTY_FUNCTION__, (void *)self, (int)size.width, (int)size.height));
+
     m_Size = size;
-    
     m_fEverSized = true;
 
-    DEBUG_MSG(("OVIW(%p): vboxSetSize: new size: %dx%d\n", (void*)self, (int)m_Size.width, (int)m_Size.height));
+    DEBUG_MSG(("OVIW(%p): vboxSetSize: new size: %dx%d\n", (void *)self, (int)m_Size.width, (int)m_Size.height));
     [self vboxReshapeOnResizePerform];
 
     /* ensure window contents is updated after that */
@@ -1756,8 +1761,8 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 - (void)vboxReshapeOnResizePerform
 {
     COCOA_LOG_FLOW(("%s: self=%p\n", __PRETTY_FUNCTION__, (void *)self));
+
     [self vboxReshapePerform];
-    
 #ifndef IN_VMSVGA3D
     [self createDockTile];
 #endif
@@ -1777,6 +1782,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
         m_fNeedCtxUpdate = true;
     }
 #endif
+
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
@@ -1790,6 +1796,102 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
+#ifdef VBOX_WITH_CONFIGURABLE_HIDPI_SCALING
+- (NSRect)safeConvertRectToBacking:(NSRect *)pRect
+{
+    NSRect resultingRect = NSZeroRect;
+
+    NSWindow *pWindow = [m_pParentView window];
+    if (pWindow)
+    {
+        if ([pWindow respondsToSelector:@selector(convertRectToBacking:)])
+        {
+            NSMethodSignature *pSignature = [pWindow methodSignatureForSelector:@selector(convertRectToBacking:)];
+            if (pSignature)
+            {
+                NSInvocation *pInvocation = [NSInvocation invocationWithMethodSignature:pSignature];
+                if (pInvocation)
+                {
+                    [pInvocation setSelector:@selector(convertRectToBacking:)];
+                    [pInvocation setTarget:pWindow];
+                    [pInvocation setArgument:pRect atIndex:2];
+                    [pInvocation invoke];
+                    [pInvocation getReturnValue:&resultingRect];
+
+                    DEBUG_MSG(("safeConvertRectToBacking: convert [X, Y, WxH]: [%d, %d, %dx%d] -> [%d, %d, %dx%d]\n",
+                        (int)pRect       ->origin.x, (int)pRect       ->origin.y, (int)pRect       ->size.width, (int)pRect       ->size.width,
+                        (int)resultingRect.origin.x, (int)resultingRect.origin.y, (int)resultingRect.size.width, (int)resultingRect.size.width));
+
+                    return resultingRect;
+                }
+            }
+        }
+    }
+    else
+        /* Should never happen. */
+        DEBUG_WARN(("safeConvertRectToBacking: parent widget has no window.\n"));
+
+    resultingRect = *pRect;
+
+    DEBUG_MSG(("safeConvertRectToBacking (reurn as is): convert [X, Y, WxH]: [%d, %d, %dx%d] -> [%d, %d, %dx%d]\n",
+        (int)pRect       ->origin.x, (int)pRect       ->origin.y, (int)pRect       ->size.width, (int)pRect       ->size.width,
+        (int)resultingRect.origin.x, (int)resultingRect.origin.y, (int)resultingRect.size.width, (int)resultingRect.size.width));
+
+    return resultingRect;
+}
+
+
+- (CGFloat)safeGetBackingScaleFactor
+{
+    /* Assume its default value. */
+    CGFloat backingScaleFactor = 1.;
+
+    NSWindow *pWindow = [m_pParentView window];
+    if (pWindow)
+    {
+        NSScreen *pScreen = [pWindow screen];
+        if (pScreen)
+        {
+            if ([pScreen respondsToSelector:@selector(backingScaleFactor)])
+            {
+                NSMethodSignature *pSignature = [pScreen methodSignatureForSelector:@selector(backingScaleFactor)];
+                if (pSignature)
+                {
+                    NSInvocation *pInvocation = [NSInvocation invocationWithMethodSignature:pSignature];
+                    if (pInvocation)
+                    {
+                        [pInvocation setSelector:@selector(backingScaleFactor)];
+                        [pInvocation setTarget:pScreen];
+                        [pInvocation invoke];
+                        [pInvocation getReturnValue:&backingScaleFactor];
+
+                        DEBUG_MSG(("safeGetBackingScaleFactor: %d\n", (int)backingScaleFactor));
+
+                        return backingScaleFactor;
+                    }
+                    else
+                        DEBUG_WARN(("safeGetBackingScaleFactor: unable to create invocation for backingScaleFactor method signature.\n"));
+                }
+                else
+                    DEBUG_WARN(("safeGetBackingScaleFactor: unable to create method signature for backingScaleFactor selector.\n"));
+            }
+            else
+                DEBUG_WARN(("safeGetBackingScaleFactor: NSScreen does not respond to backingScaleFactor selector.\n"));
+        }
+        else
+            /* Should never happen. */
+            DEBUG_WARN(("safeGetBackingScaleFactor: parent window has no screen.\n"));
+    }
+    else
+        /* Should never happen. */
+        DEBUG_WARN(("safeGetBackingScaleFactor: parent widget has no window.\n"));
+
+    return backingScaleFactor;
+}
+
+#endif
+
+
 - (NSRect)safeConvertToScreen:(NSRect *)pRect
 {
     NSRect resultingRect = NSZeroRect;
@@ -1868,6 +1970,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     NSRect parentFrameVCS, parentFrameWCS, parentFrameSCS;
     NSRect childFrameWCS, childFrameSCS;
     NSRect windowFrameSCS;
+
     CGFloat childFrameXWCS, childFrameYWCS;
 
     /* We need to construct a new window frame (windowFrameSCS) for entire NSWindow object in
@@ -1890,7 +1993,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 
     DEBUG_MSG(("vboxReshapePerform: a new overlay frame [%d, %d, %dx%d] has been constructed from intersection of window frame "
                "[%d, %d, %dx%d] and guest content rectangle [%d, %d, %dx%d]; m_Pos=[%d, %d], m_Size=%dx%d.\n",
-               (int)windowFrameSCS      .origin.x, (int)windowFrameSCS      .origin.y, (int)windowFrameSCS      .size.width, (int)windowFrameSCS      .size.width,
+               (int)windowFrameSCS.origin.x, (int)windowFrameSCS.origin.y, (int)windowFrameSCS.size.width, (int)windowFrameSCS.size.width,
                (int)parentFrameSCS.origin.x, (int)parentFrameSCS.origin.y, (int)parentFrameSCS.size.width, (int)parentFrameSCS.size.width,
                (int)childFrameSCS .origin.x, (int)childFrameSCS .origin.y, (int)childFrameSCS .size.width, (int)childFrameSCS .size.width,
                (int)m_Pos.x, (int)m_Pos.y, (int)m_Size.width, (int)m_Size.height));
@@ -1902,9 +2005,9 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     m_RootRect.origin.y =  childFrameSCS.size.height + childFrameSCS.origin.y - (windowFrameSCS.size.height + windowFrameSCS.origin.y);
     m_RootRect.size = windowFrameSCS.size;
     m_yInvRootOffset = windowFrameSCS.origin.y - childFrameSCS.origin.y;
-    
+
     DEBUG_MSG(("vboxReshapePerform: [%#p]: m_RootRect pos[%d : %d] size[%d : %d]\n",
-         (void*)self, (int)m_RootRect.origin.x, (int)m_RootRect.origin.y, (int)m_RootRect.size.width, (int)m_RootRect.size.height));
+               (void *)self, (int)m_RootRect.origin.x, (int)m_RootRect.origin.y, (int)m_RootRect.size.width, (int)m_RootRect.size.height));
 
     /* Set the new frame. */
     [[self window] setFrame:windowFrameSCS display:YES];
@@ -1920,11 +2023,12 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     {
         VBOX_CR_RENDER_CTX_INFO CtxInfo; 
         vboxCtxEnter(m_pSharedGLCtx, &CtxInfo);
-    
+
         [self updateViewportCS];
-    
+
         vboxCtxLeave(&CtxInfo);
     }
+
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
@@ -1933,18 +2037,20 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 - (void)createDockTile
 {
     COCOA_LOG_FLOW(("%s: self=%p\n", __PRETTY_FUNCTION__, (void *)self));
-	NSView *pDockScreen      = nil;
-	[self deleteDockTile];
-	
-	/* Is there a dock tile preview enabled in the GUI? If so setup a
+    NSView *pDockScreen = nil;
+
+    [self deleteDockTile];
+
+    /* Is there a dock tile preview enabled in the GUI? If so setup a
      * additional thumbnail view for the dock tile. */
-	pDockScreen = [self dockTileScreen];
-	if (pDockScreen)
+    pDockScreen = [self dockTileScreen];
+    if (pDockScreen)
     {
         m_DockTileView = [[DockOverlayView alloc] init];
         [self reshapeDockTile];
         [pDockScreen addSubview:m_DockTileView];
     }
+
     COCOA_LOG_FLOW(("%s: returns - m_DockTileView\n", __PRETTY_FUNCTION__, (void *)m_DockTileView));
 }
 
@@ -1952,7 +2058,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 {
     COCOA_LOG_FLOW(("%s: self=%p - m_DockTileView=%p\n", __PRETTY_FUNCTION__, (void *)self, (void *)m_DockTileView));
 
-	if (m_DockTileView != nil)
+    if (m_DockTileView != nil)
     {
         [m_DockTileView removeFromSuperview];
         [m_DockTileView release];
@@ -2018,7 +2124,6 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
             glGenFramebuffersEXT(1, &m_FBOId);
             Assert(m_FBOId);
         }
-        
     }
 
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
@@ -2066,10 +2171,11 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     /* Set the new context as non opaque */
     GLint opaque = 0;
     [pSharedGLCtx setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
+
     /* Set this view as the drawable for the new context */
-    [pSharedGLCtx setView: self];
+    [pSharedGLCtx setView:self];
     m_fNeedViewportUpdate = true;
-    
+
     m_pSharedGLCtx = pSharedGLCtx;
     
     COCOA_LOG_FLOW(("%s: returns true - new m_pSharedGLCtx=%p\n", __PRETTY_FUNCTION__, (void *)m_pSharedGLCtx));
@@ -2119,7 +2225,7 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
-- (void)vboxReparent:(NSView*)pParentView
+- (void)vboxReparent:(NSView *)pParentView
 {
     COCOA_LOG_FLOW(("%s: self=%p pParentView=%p\n", __PRETTY_FUNCTION__, (void *)self, (void *)pParentView));
 
@@ -2129,9 +2235,10 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
 
-- (void)vboxReparentUI:(NSView*)pParentView
+- (void)vboxReparentUI:(NSView *)pParentView
 {
     COCOA_LOG_FLOW(("%s: self=%p pParentView=%p\n", __PRETTY_FUNCTION__, (void *)self, (void *)pParentView));
+
     /* Make sure the window is removed from any previous parent window. */
     if ([[self overlayWin] parentWindow] != nil)
     {
@@ -2309,10 +2416,10 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 
     /* change to #if 0 to see thumbnail image */            
 #if 1
-            [self vboxPresentToViewCS:pCompositor];
+    [self vboxPresentToViewCS:pCompositor];
 #else
-            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-            [m_pSharedGLCtx flushBuffer];
+    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+    [m_pSharedGLCtx flushBuffer];
 #endif
 
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
@@ -2320,25 +2427,25 @@ static DECLCALLBACK(void) VBoxMainThreadTaskRunner_RcdRunCallback(void *pvUser)
 
 DECLINLINE(void) vboxNSRectToRect(const NSRect *pR, RTRECT *pRect)
 {
-    pRect->xLeft = (int)pR->origin.x;
-    pRect->yTop = (int)pR->origin.y;
-    pRect->xRight = (int)(pR->origin.x + pR->size.width);
+    pRect->xLeft   = (int)pR->origin.x;
+    pRect->yTop    = (int)pR->origin.y;
+    pRect->xRight  = (int)(pR->origin.x + pR->size.width);
     pRect->yBottom = (int)(pR->origin.y + pR->size.height);
 }
 
 DECLINLINE(void) vboxNSRectToRectUnstretched(const NSRect *pR, RTRECT *pRect, float xStretch, float yStretch)
 {
-    pRect->xLeft = (int)(pR->origin.x / xStretch);
-    pRect->yTop = (int)(pR->origin.y / yStretch);
-    pRect->xRight = (int)((pR->origin.x + pR->size.width) / xStretch);
+    pRect->xLeft   = (int)(pR->origin.x / xStretch);
+    pRect->yTop    = (int)(pR->origin.y / yStretch);
+    pRect->xRight  = (int)((pR->origin.x + pR->size.width) / xStretch);
     pRect->yBottom = (int)((pR->origin.y + pR->size.height) / yStretch);
 }
 
 DECLINLINE(void) vboxNSRectToRectStretched(const NSRect *pR, RTRECT *pRect, float xStretch, float yStretch)
 {
-    pRect->xLeft = (int)(pR->origin.x * xStretch);
-    pRect->yTop = (int)(pR->origin.y * yStretch);
-    pRect->xRight = (int)((pR->origin.x + pR->size.width) * xStretch);
+    pRect->xLeft   = (int)(pR->origin.x * xStretch);
+    pRect->yTop    = (int)(pR->origin.y * yStretch);
+    pRect->xRight  = (int)((pR->origin.x + pR->size.width) * xStretch);
     pRect->yBottom = (int)((pR->origin.y + pR->size.height) * yStretch);
 }
 
@@ -2349,11 +2456,23 @@ DECLINLINE(void) vboxNSRectToRectStretched(const NSRect *pR, RTRECT *pRect, floa
                     (int)r.origin.x, (int)r.origin.y, (int)r.size.width, (int)r.size.height));
 
 #if 1 /* Set to 0 to see the docktile instead of the real output */
-    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR CIter;
-    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
-        
-    CrVrScrCompositorConstIterInit(pCompositor, &CIter);
-        
+    float backingStretchFactor = 1.;
+#  if defined(VBOX_WITH_CONFIGURABLE_HIDPI_SCALING) && !defined(IN_VMSVGA3D)
+    /* Adjust viewport according to current NSView's backing store parameters. */
+    if (render_spu.fUnscaledHiDPI)
+    {
+        /* Update stretch factor in order to satisfy current NSView's backing store parameters. */
+        backingStretchFactor = [self safeGetBackingScaleFactor];
+    }
+
+    NSRect regularBounds = [self bounds];
+    NSRect backingBounds = [self safeConvertRectToBacking:&regularBounds];
+    glViewport(0, 0, backingBounds.size.width, backingBounds.size.height);
+
+    crDebug("HiDPI: vboxPresentToViewCS: up-scaling is %s (backingStretchFactor=%d).",
+        render_spu.fUnscaledHiDPI ? "OFF" : "ON", (int)backingStretchFactor);
+#  endif
+
     glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);
     glDrawBuffer(GL_BACK);
 
@@ -2367,6 +2486,10 @@ DECLINLINE(void) vboxNSRectToRectStretched(const NSRect *pR, RTRECT *pRect, floa
     float yStretch;
     CrVrScrCompositorGetStretching(pCompositor, &xStretch, &yStretch);
         
+    VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR CIter;
+    const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
+    CrVrScrCompositorConstIterInit(pCompositor, &CIter);
+
     while ((pEntry = CrVrScrCompositorConstIterNext(&CIter)) != NULL)
     {
         uint32_t cRegions;
@@ -2384,8 +2507,8 @@ DECLINLINE(void) vboxNSRectToRectStretched(const NSRect *pR, RTRECT *pRect, floa
                     const CR_TEXDATA *pTexData;
                     PCRTRECT pSrcRect = &paSrcRegions[i];
                     PCRTRECT pDstRect = &paDstRegions[i];
-                    RTRECT DstRect, RestrictDstRect;
-                    RTRECT SrcRect, RestrictSrcRect;
+                    RTRECT   DstRect, RestrictDstRect;
+                    RTRECT   SrcRect, RestrictSrcRect;
 
                     vboxNSRectToRect(&m_RootRect, &RestrictDstRect);
                     VBoxRectIntersected(&RestrictDstRect, pDstRect, &DstRect);
@@ -2395,8 +2518,10 @@ DECLINLINE(void) vboxNSRectToRectStretched(const NSRect *pR, RTRECT *pRect, floa
 
                     VBoxRectTranslate(&DstRect, -RestrictDstRect.xLeft, -RestrictDstRect.yTop);
 
-                    vboxNSRectToRectUnstretched(&m_RootRect, &RestrictSrcRect, xStretch, yStretch);
-                    VBoxRectTranslate(&RestrictSrcRect, -CrVrScrCompositorEntryRectGet(pEntry)->xLeft, -CrVrScrCompositorEntryRectGet(pEntry)->yTop);
+                    vboxNSRectToRectUnstretched(&m_RootRect, &RestrictSrcRect, xStretch / backingStretchFactor, yStretch / backingStretchFactor);
+                    VBoxRectTranslate(&RestrictSrcRect, 
+                                      -CrVrScrCompositorEntryRectGet(pEntry)->xLeft, 
+                                      -CrVrScrCompositorEntryRectGet(pEntry)->yTop);
                     VBoxRectIntersected(&RestrictSrcRect, pSrcRect, &SrcRect);
                     
                     if (VBoxRectIsZero(&SrcRect))
@@ -2429,11 +2554,12 @@ DECLINLINE(void) vboxNSRectToRectStretched(const NSRect *pR, RTRECT *pRect, floa
     }
 # endif /* !IN_VMSVGA3D */
 #endif
-            /*
-            glFinish();
-            */
-            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-            [m_pSharedGLCtx flushBuffer];
+
+    /*
+    glFinish();
+    */
+    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+    [m_pSharedGLCtx flushBuffer];
 
     COCOA_LOG_FLOW(("%s: returns\n", __PRETTY_FUNCTION__));
 }
@@ -2480,17 +2606,18 @@ static int g_cVBoxTgaCtr = 0;
     NSRect      r   = [self frame];
     NSRect      rr  = NSZeroRect;
     NSDockTile *pDT = nil;
-    float xStretch;
+    float       xStretch;
     float       yStretch;
 
     if ([m_DockTileView thumbBitmap] != nil)
     {
         /* 
          * Only update after at least 200 ms, cause glReadPixels is
-         * heavy performance wise. */
+         * heavy performance wise. 
+         */ 
         uint64_t                                msTS = RTTimeSystemMilliTS();
-        VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR CIter;
-        const VBOXVR_SCR_COMPOSITOR_ENTRY *pEntry;
+        VBOXVR_SCR_COMPOSITOR_CONST_ITERATOR    CIter;
+        const VBOXVR_SCR_COMPOSITOR_ENTRY      *pEntry;
         
         if (msTS - m_msDockUpdateTS > 200)
         {
@@ -2524,11 +2651,11 @@ static int g_cVBoxTgaCtr = 0;
             CrVrScrCompositorConstIterInit(pCompositor, &CIter);
             while ((pEntry = CrVrScrCompositorConstIterNext(&CIter)) != NULL)
             {
-                uint32_t cRegions;
+                uint32_t    cRegions;
                 PCRTRECT    paSrcRegions;
                 PCRTRECT    paDstRegions;
                 int rc = CrVrScrCompositorEntryRegionsGet(pCompositor, pEntry, &cRegions, &paSrcRegions, &paDstRegions, NULL);
-                uint32_t fFlags = CrVrScrCompositorEntryFlagsCombinedGet(pCompositor, pEntry);
+                uint32_t    fFlags = CrVrScrCompositorEntryFlagsCombinedGet(pCompositor, pEntry);
                 if (RT_SUCCESS(rc))
                 {
                     rc = CrBltEnter(m_pBlitter);
@@ -2554,7 +2681,9 @@ static int g_cVBoxTgaCtr = 0;
                                 continue;
                         
                             vboxNSRectToRectUnstretched(&m_RootRect, &RestrictSrcRect, xStretch, yStretch);
-                            VBoxRectTranslate(&RestrictSrcRect, -CrVrScrCompositorEntryRectGet(pEntry)->xLeft, -CrVrScrCompositorEntryRectGet(pEntry)->yTop);
+                            VBoxRectTranslate(&RestrictSrcRect, 
+                                              -CrVrScrCompositorEntryRectGet(pEntry)->xLeft, 
+                                              -CrVrScrCompositorEntryRectGet(pEntry)->yTop);
                             VBoxRectIntersected(&RestrictSrcRect, pSrcRect, &SrcRect);
                     
                             if (VBoxRectIsZero(&SrcRect))
@@ -2608,7 +2737,8 @@ static int g_cVBoxTgaCtr = 0;
             pDT = [[NSApplication sharedApplication] dockTile];
 
             /* Send a display message to the dock tile in the main thread */
-            [[[NSApplication sharedApplication] dockTile] performSelectorOnMainThread:@selector(display) withObject:nil waitUntilDone:NO];
+            [[[NSApplication sharedApplication] dockTile] performSelectorOnMainThread:@selector(display) withObject:nil 
+                                                                        waitUntilDone:NO];
         }
     }
 }
@@ -2616,7 +2746,7 @@ static int g_cVBoxTgaCtr = 0;
 
 - (void)clearVisibleRegions
 {
-    if(m_paClipRects)
+    if (m_paClipRects)
     {
         RTMemFree(m_paClipRects);
         m_paClipRects = NULL;
@@ -2645,9 +2775,9 @@ static int g_cVBoxTgaCtr = 0;
     if (cRects > 0)
     {
 #ifdef DEBUG_poetzsch
-        int i =0;
+        int i = 0;
         for (i = 0; i < cRects; ++i)
-            DEBUG_MSG_1(("OVIW(%p): setVisibleRegions: %d - %d %d %d %d\n", (void*)self, i, paRects[i * 4], paRects[i * 4 + 1], paRects[i * 4 + 2], paRects[i * 4 + 3]));
+            DEBUG_MSG_1(("OVIW(%p): setVisibleRegions: %d - %d %d %d %d\n", (void *)self, i, paRects[i * 4], paRects[i * 4 + 1], paRects[i * 4 + 2], paRects[i * 4 + 3]));
 #endif
 
         m_paClipRects = (GLint *)RTMemDup(paRects, sizeof(GLint) * 4 * cRects);
@@ -2664,6 +2794,7 @@ static int g_cVBoxTgaCtr = 0;
     COCOA_LOG_FLOW(("%s: self=%p\n", __PRETTY_FUNCTION__, (void *)self));
     NSView *pContentView = [[[NSApplication sharedApplication] dockTile] contentView];
     NSView *pScreenContent = nil;
+
     /* 
      * First try the new variant which checks if this window is within the
      * screen which is previewed in the dock. 
@@ -2694,7 +2825,10 @@ static int g_cVBoxTgaCtr = 0;
 
         m_FBOThumbScaleX = (float)dockFrame.size.width / parentFrame.size.width;
         m_FBOThumbScaleY = (float)dockFrame.size.height / parentFrame.size.height;
-        newFrame = NSMakeRect((int)(m_Pos.x * m_FBOThumbScaleX), (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_yInvRootOffset) * m_FBOThumbScaleY), (int)(m_Size.width * m_FBOThumbScaleX), (int)(m_Size.height * m_FBOThumbScaleY));
+        newFrame = NSMakeRect((int)(m_Pos.x * m_FBOThumbScaleX), 
+                              (int)(dockFrame.size.height - (m_Pos.y + m_Size.height - m_yInvRootOffset) * m_FBOThumbScaleY), 
+                              (int)(m_Size.width * m_FBOThumbScaleX), 
+                              (int)(m_Size.height * m_FBOThumbScaleY));
         /*
         NSRect newFrame = NSMakeRect ((int)roundf(m_Pos.x * m_FBOThumbScaleX), (int)roundf(dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (int)roundf(m_Size.width * m_FBOThumbScaleX), (int)roundf(m_Size.height * m_FBOThumbScaleY));
         NSRect newFrame = NSMakeRect ((m_Pos.x * m_FBOThumbScaleX), (dockFrame.size.height - (m_Pos.y + m_Size.height) * m_FBOThumbScaleY), (m_Size.width * m_FBOThumbScaleX), (m_Size.height * m_FBOThumbScaleY));
@@ -2898,7 +3032,7 @@ void cocoaViewDisplay(NativeNSViewRef pView)
 
 #ifndef IN_VMSVGA3D
     DEBUG_WARN(("cocoaViewDisplay should never happen!\n"));
-    DEBUG_MSG_1(("cocoaViewDisplay %p\n", (void*)pView));
+    DEBUG_MSG_1(("cocoaViewDisplay %p\n", (void *)pView));
 #endif
     [(OverlayView *)pView swapFBO];
 
@@ -2933,8 +3067,8 @@ void cocoaViewSetSize(NativeNSViewRef pView, int cx, int cy)
 
 typedef struct CR_RCD_GETGEOMETRY
 {
-    OverlayView *pView;
-    NSRect rect;
+    OverlayView    *pView;
+    NSRect          rect;
 } CR_RCD_GETGEOMETRY;
 
 static DECLCALLBACK(void) vboxRcdGetGeomerty(void *pvUser)
@@ -2961,7 +3095,7 @@ void cocoaViewGetGeometry(NativeNSViewRef pView, int *px, int *py, int *pcx, int
     if (renderspuCalloutAvailable())
     {
         CR_RCD_GETGEOMETRY GetGeometry;
-        GetGeometry.pView = (OverlayView*)pView;
+        GetGeometry.pView = (OverlayView *)pView;
         renderspuCalloutClient(vboxRcdGetGeomerty, &GetGeometry);
         frame = GetGeometry.rect;
     }
diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c b/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
index 6074fd0..6d935f0 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
+++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
@@ -68,50 +68,6 @@ WindowExists( Display *dpy, Window w )
     return WindowExistsFlag;
 }
 
-static GLboolean
-renderDestroyWindow( Display *dpy, Window w )
-{
-    XWindowAttributes xwa;
-    int (*oldXErrorHandler)(Display *, XErrorEvent *);
-
-    WindowExistsFlag = GL_TRUE;
-    oldXErrorHandler = XSetErrorHandler(WindowExistsErrorHandler);
-    XGetWindowAttributes(dpy, w, &xwa); /* dummy request */
-    if (xwa.map_state == IsViewable) {
-        XDestroyWindow (dpy, w); /* dummy request */
-        XSync (dpy,0);
-    }
-    XSetErrorHandler(oldXErrorHandler);
-    return WindowExistsFlag;
-}
-
-#if 0
-/*
- * Garbage collection function.
- * Loop over all known windows and check if corresponding X window still
- * exists.  If it doesn't, destroy the render SPU window.
- * XXX seems to blow up with threadtest.conf tests.
- */
-void
-renderspu_GCWindow(void)
-{
-    int i;
-    WindowInfo *window;
-
-    for (i = 0; i < (int)render_spu.window_id - 1; i++) {
-        window = (WindowInfo *) crHashtableSearch(render_spu.windowTable, i);
-        if (window->visual->dpy) {
-            if (!WindowExists (window->visual->dpy, window->appWindow) ) {
-                XSync(window->visual->dpy,0);
-                if(WindowExists(window->visual->dpy, window->window)) {
-                    renderDestroyWindow(window->visual->dpy, window->window);
-                }
-            }
-        }
-    }
-}
-#endif
-
 static Colormap 
 GetLUTColormap( Display *dpy, XVisualInfo *vi )
 {
@@ -1674,11 +1630,6 @@ renderspu_SystemMakeCurrent( WindowInfo *window, GLint nativeWindow,
         }
 
     }
-
-#if 0
-    /* XXX disabled for now due to problem with threadtest.conf */
-    renderspu_GCWindow();
-#endif
 }
 
 
diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c b/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
index ec5eedf..db99846 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
+++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
@@ -186,6 +186,7 @@ renderSPUInit( int id, SPU *child, SPU *self,
 
 #ifdef CHROMIUM_THREADSAFE
     crDebug("Render SPU: thread-safe");
+    crInitTSD(&_RenderTSD);
 #endif
 
     crMemZero(&render_spu, sizeof(render_spu));
@@ -618,4 +619,5 @@ int SPULoad( char **name, char **super, SPUInitFuncPtr *init,
 DECLEXPORT(void) renderspuSetWindowId(uint64_t winId)
 {
     render_spu_parent_window_id = winId;
+    crDebug("Set new parent window %p (no actual reparent performed)", winId);
 }
diff --git a/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c b/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c
index f5e8010..faf9908 100644
--- a/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c
+++ b/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c
@@ -286,7 +286,7 @@ static int renderspuAtiQuirk_ApplyForModule(LPCSTR pszAtiDll)
     }
 
     crDebug("renderspuAtiQuirk_ApplyForModule SUCCEEDED!");
-    crInfo("ATI Fullscreen qwirk SUCCEEDED!");
+    crInfo("ATI Fullscreen quirk patch SUCCEEDED!");
 
     return VINF_SUCCESS;
 }
diff --git a/src/VBox/HostServices/auth/simple/VBoxAuthSimple.rc b/src/VBox/HostServices/auth/simple/VBoxAuthSimple.rc
index f6bfe3b..ab65b22 100644
--- a/src/VBox/HostServices/auth/simple/VBoxAuthSimple.rc
+++ b/src/VBox/HostServices/auth/simple/VBoxAuthSimple.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Simple Authentication Host Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxAuthSimple\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxAuthSimple.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/HostServices/auth/winlogon/VBoxAuth.rc b/src/VBox/HostServices/auth/winlogon/VBoxAuth.rc
index 79df11c..87d7784 100644
--- a/src/VBox/HostServices/auth/winlogon/VBoxAuth.rc
+++ b/src/VBox/HostServices/auth/winlogon/VBoxAuth.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Authentication Host Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxAuth\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxAuth.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Installer/Config.kmk b/src/VBox/Installer/Config.kmk
new file mode 100644
index 0000000..2a5f4c9
--- /dev/null
+++ b/src/VBox/Installer/Config.kmk
@@ -0,0 +1,101 @@
+# $Id: Config.kmk $
+## @file
+# kBuild Configuration file for the installers
+#
+
+#
+# Copyright (C) 2015 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+VBOX_INSTALLER_CONFIG_KMK_INCLUDED = 1
+
+# Include the top-level configure file.
+ifndef VBOX_ROOT_CONFIG_KMK_INCLUDED
+ include $(PATH_ROOT)/Config.kmk
+endif
+
+#
+# Generic stuff.
+#
+VBOX_PATH_INST_COMMON_SRC := $(PATH_SUB_CURRENT)/common
+
+
+ifdef VBOX_WITH_PYTHON
+ VBOXINST_SDK_BINDINGS_XPCOM_PYTHON_FILES = \
+ 	sdk/bindings/xpcom/python/xpcom/__init__.py \
+ 	sdk/bindings/xpcom/python/xpcom/primitives.py \
+ 	sdk/bindings/xpcom/python/xpcom/file.py \
+ 	sdk/bindings/xpcom/python/xpcom/xpcom_consts.py \
+ 	sdk/bindings/xpcom/python/xpcom/nsError.py \
+ 	sdk/bindings/xpcom/python/xpcom/xpt.py \
+ 	sdk/bindings/xpcom/python/xpcom/components.py \
+ 	sdk/bindings/xpcom/python/xpcom/vboxxpcom.py \
+ 	sdk/bindings/xpcom/python/xpcom/client/__init__.py \
+ 	sdk/bindings/xpcom/python/xpcom/server/__init__.py \
+ 	sdk/bindings/xpcom/python/xpcom/server/enumerator.py \
+ 	sdk/bindings/xpcom/python/xpcom/server/factory.py \
+ 	sdk/bindings/xpcom/python/xpcom/server/loader.py \
+ 	sdk/bindings/xpcom/python/xpcom/server/module.py \
+ 	sdk/bindings/xpcom/python/xpcom/server/policy.py
+ VBOXINST_SDK_INSTALLER_PYTHON_FILES = \
+ 	sdk/installer/vboxapisetup.py \
+ 	sdk/installer/vboxapi/__init__.py \
+ 	sdk/installer/vboxapi/VirtualBox_constants.py
+endif
+
+
+#
+# DTrace globals.
+#
+ifdef VBOX_WITH_DTRACE
+ ## List of files in the per arch DTrace library directory.
+ VBOXINST_DTRACE_LIB_ARCH_FILES := \
+ 	 vbox-types.d \
+ 	 vbox-arch-types.d \
+ 	 vm.d \
+ 	 cpumctx.d \
+ 	 CPUMInternal.d \
+ 	 x86.d
+ ## List of files in the per arch DTrace testcase directory.
+ VBOXINST_DTRACE_TESTCASE_ARCH_FILES := \
+ 	vbox-vm-struct-test.d
+ ## List of file in the DTrace scripts directory.
+ VBOXINST_DTRACE_SCRIPTS_FILES :=
+else
+ VBOXINST_DTRACE_LIB_ARCH_FILES :=
+ VBOXINST_DTRACE_TESTCASE_ARCH_FILES :=
+ VBOXINST_DTRACE_SCRIPTS_FILES :=
+endif
+
+
+#
+# Some combined package (CP) globals.
+#
+ifeq ($(KBUILD_TARGET_ARCH),x86)
+ VBOX_CP_THIS_BITS   := 32
+ ifdef VBOX_WITH_COMBINED_PACKAGE
+  VBOX_CP_OTHER_ARCH := amd64
+  VBOX_CP_OTHER_BITS := 64
+ else
+  VBOX_CP_OTHER_ARCH = $(error VBOX_CP_OTHER_ARCH used in without VBOX_WITH_COMBINED_PACKAGE set)
+  VBOX_CP_OTHER_BITS = $(error VBOX_CP_OTHER_ARCH used in without VBOX_CP_OTHER_BITS set)
+ endif
+else
+  VBOX_CP_THIS_BITS  := 64
+ ifdef VBOX_WITH_COMBINED_PACKAGE
+  VBOX_CP_OTHER_ARCH := x86
+  VBOX_CP_OTHER_BITS := 32
+ else
+  VBOX_CP_OTHER_ARCH = $(error VBOX_CP_OTHER_ARCH used in without VBOX_WITH_COMBINED_PACKAGE set)
+  VBOX_CP_OTHER_BITS = $(error VBOX_CP_OTHER_ARCH used in without VBOX_CP_OTHER_BITS set)
+ endif
+endif
+
diff --git a/src/VBox/Installer/Makefile.kmk b/src/VBox/Installer/Makefile.kmk
index cd588ee..5c21d4e 100644
--- a/src/VBox/Installer/Makefile.kmk
+++ b/src/VBox/Installer/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2006-2012 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +19,13 @@ SUB_DEPTH = ../../..
 include $(KBUILD_PATH)/subheader.kmk
 
 #
+# Make sure our Config.kmk is included.
+#
+ifndef VBOX_INSTALLER_CONFIG_KMK_INCLUDED
+ include $(PATH_SUB_CURRENT)/Config.kmk
+endif
+
+#
 # Include Sub-Makefiles.
 #
 ifndef VBOX_ONLY_SDK
diff --git a/src/VBox/Installer/common/vboxapisetup.py b/src/VBox/Installer/common/vboxapisetup.py
index 68dfd92..967ab42 100755
--- a/src/VBox/Installer/common/vboxapisetup.py
+++ b/src/VBox/Installer/common/vboxapisetup.py
@@ -1,5 +1,5 @@
 """
-Copyright (C) 2009-2012 Oracle Corporation
+Copyright (C) 2009-2015 Oracle Corporation
 
 This file is part of VirtualBox Open Source Edition (OSE), as
 available from http://www.virtualbox.org. This file is free software;
@@ -16,14 +16,14 @@ from distutils.core import setup
 def cleanupComCache():
     import shutil
     from distutils.sysconfig import get_python_lib
-    comCache1 = os.path.join(get_python_lib(),'win32com', 'gen_py')
+    comCache1 = os.path.join(get_python_lib(), 'win32com', 'gen_py')
     comCache2 = os.path.join(os.environ.get("TEMP", "c:\\tmp"), 'gen_py')
     print "Cleaning COM cache at",comCache1,"and",comCache2
     shutil.rmtree(comCache1, True)
     shutil.rmtree(comCache2, True)
 
 def patchWith(file,install,sdk):
-    newFile=file+".new"
+    newFile=file + ".new"
     install=install.replace("\\", "\\\\")
     try:
         os.remove(newFile)
@@ -32,8 +32,8 @@ def patchWith(file,install,sdk):
     oldF = open(file, 'r')
     newF = open(newFile, 'w')
     for line in oldF:
-        line=line.replace("%VBOX_INSTALL_PATH%",install)
-        line=line.replace("%VBOX_SDK_PATH%",sdk)
+        line = line.replace("%VBOX_INSTALL_PATH%", install)
+        line = line.replace("%VBOX_SDK_PATH%", sdk)
         newF.write(line)
     newF.close()
     oldF.close()
@@ -45,32 +45,34 @@ def patchWith(file,install,sdk):
 
 # See http://docs.python.org/distutils/index.html
 def main(argv):
-    vboxDest=os.environ.get("VBOX_INSTALL_PATH", None)
+    vboxDest = os.environ.get("VBOX_INSTALL_PATH", None)
     if vboxDest is None:
         raise Exception("No VBOX_INSTALL_PATH defined, exiting")
-    vboxVersion=os.environ.get("VBOX_VERSION", None)
+
+    vboxVersion = os.environ.get("VBOX_VERSION", None)
     if vboxVersion is None:
         # Should we use VBox version for binding module versioning?
         vboxVersion = "1.0"
+
     import platform
-    if platform.system() == 'Darwin':
-        vboxSdkDest = os.path.join(vboxDest, "..", "..", "..", "sdk")
-        if not os.path.isdir(vboxSdkDest):
-            vboxSdkDest = os.path.join(vboxDest, "sdk")
-    else:
-        vboxSdkDest = os.path.join(vboxDest, "sdk")
+
     if platform.system() == 'Windows':
         cleanupComCache()
-    patchWith(os.path.join(os.path.dirname(sys.argv[0]), 'vboxapi', '__init__.py'), vboxDest, vboxSdkDest)
-    setup(name='vboxapi',
-      version=vboxVersion,
-      description='Python interface to VirtualBox',
-      author='Oracle Corp.',
-      author_email='vbox-dev at virtualbox.org',
-      url='http://www.virtualbox.org',
-      packages=['vboxapi']
-      )
 
+    # Darwin: Patched before installation. Modifying bundle is not allowed, breaks signing and upsets gatekeeper.
+    if platform.system() != 'Darwin':
+        vboxSdkDest = os.path.join(vboxDest, "sdk")
+        patchWith(os.path.join(os.path.dirname(sys.argv[0]), 'vboxapi', '__init__.py'), vboxDest, vboxSdkDest)
+
+    setup(name='vboxapi',
+          version=vboxVersion,
+          description='Python interface to VirtualBox',
+          author='Oracle Corp.',
+          author_email='vbox-dev at virtualbox.org',
+          url='http://www.virtualbox.org',
+          packages=['vboxapi']
+          )
 
 if __name__ == '__main__':
     main(sys.argv)
+
diff --git a/src/VBox/Installer/common/virtualbox.desktop.in b/src/VBox/Installer/common/virtualbox.desktop.in
index e87bb7f..d73c05d 100644
--- a/src/VBox/Installer/common/virtualbox.desktop.in
+++ b/src/VBox/Installer/common/virtualbox.desktop.in
@@ -3,9 +3,12 @@ Encoding=UTF-8
 Version=1.0
 Name=@VBOX_PRODUCT@
 GenericName=Virtual Machine
+GenericName[de]=Virtuelle Maschine
 Type=Application
 Exec=VirtualBox %U
 TryExec=VirtualBox
+Keywords=virtualization
+Keywords[de]=Virtualisierung
 MimeType=application/x-virtualbox-vbox;application/x-virtualbox-vbox-extpack;application/x-virtualbox-ovf;application/x-virtualbox-ova;
 DocPath=file://@VBOX_DOC_PATH@/UserManual.pdf
 Icon=virtualbox
diff --git a/src/VBox/Installer/darwin/Makefile.kmk b/src/VBox/Installer/darwin/Makefile.kmk
index c796c3e..a4bf651 100644
--- a/src/VBox/Installer/darwin/Makefile.kmk
+++ b/src/VBox/Installer/darwin/Makefile.kmk
@@ -26,28 +26,15 @@ VBOX_PATH_DI_SRC := $(PATH_SUB_CURRENT)
 VBOX_DI_OUT_DIR  := $(PATH_TARGET)/Installer/darwin
 BLDDIRS += $(VBOX_DI_OUT_DIR)
 
-ifdef VBOX_WITH_COMBINED_PACKAGE
- ifeq ($(KBUILD_TARGET_ARCH),x86)
-  VBOX_PATH_DIST_32 = $(VBOX_PATH_DIST)
-  VBOX_PATH_DIST_64 = $(PATH_OUT_BASE)/darwin.amd64/$(KBUILD_TYPE)/dist
- else
-  VBOX_PATH_DIST_64 = $(VBOX_PATH_DIST)
-  VBOX_PATH_DIST_32 = $(PATH_OUT_BASE)/darwin.x86/$(KBUILD_TYPE)/dist
- endif
- VBOX_DI_FN_DEP_BOTH = $(VBOX_PATH_DIST_32)/$1 $(VBOX_PATH_DIST_64)/$2
- VBOX_DI_FN_DEP_32   = $(VBOX_PATH_DIST_32)/$1
- VBOX_DI_FN_DEP_64   = $(VBOX_PATH_DIST_64)/$1
- VBOX_DI_LIPO = lipo
+VBOX_DI_FN_DEP_BOTH = $(VBOX_PATH_DIST)/$1
+ifeq ($(KBUILD_TARGET_ARCH),x86)
+ VBOX_DI_FN_DEP_32  = $(VBOX_PATH_DIST)/$1
+ VBOX_DI_FN_DEP_64  =
 else
- VBOX_DI_FN_DEP_BOTH = $(VBOX_PATH_DIST)/$1
- ifeq ($(KBUILD_TARGET_ARCH),x86)
-  VBOX_DI_FN_DEP_32  = $(VBOX_PATH_DIST)/$1
-  VBOX_DI_FN_DEP_64  =
- else
-  VBOX_DI_FN_DEP_64  = $(VBOX_PATH_DIST)/$1
-  VBOX_DI_FN_DEP_32  =
- endif
+ VBOX_DI_FN_DEP_64  = $(VBOX_PATH_DIST)/$1
+ VBOX_DI_FN_DEP_32  =
 endif
+VBOX_PATH_DIST_OTHER = $(error VBOX_PATH_DIST_OTHER used in a non-combined package deal)
 
 # Unset this to speed up things during makefile hacking.
 VBOX_DARWIN_INST_DEP_ON_MAKEFILE := $(MAKEFILE_CURRENT)
@@ -67,6 +54,9 @@ ifndef VBOX_PATH_PACK_TMP
  VBOX_PATH_PACK_TMP := $(VBOX_DI_OUT_DIR)
 endif
 
+# Shorthand for $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app
+VBOX_PATH_VBOX_APP_TMP := $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app
+
 
 #
 # Install the darwin docs/license.
@@ -137,6 +127,9 @@ $(VBOX_PATH_DIST)/VirtualBox-$(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_
 	$(QUIET)$(RM) -f $(wildcard $(VBOX_PATH_DIST)/VirtualBox-*-r*.dmg)
 	@# Populate the image with uninstaller, readme, picture, and .VolumeIcon.icns. (TODO)
 	$(INSTALL) $(VBOX_PATH_DI_SRC)/DiskImage/VirtualBox_Uninstall.tool  $(VBOX_PATH_PACK_TMP)/DiskImage/
+if defined(VBOX_SIGNING_MODE) && defined(VBOX_NOT_OSX_105)
+	$(call VBOX_SIGN_FILE_FN,$(VBOX_PATH_PACK_TMP)/DiskImage/VirtualBox_Uninstall.tool,org.virtualbox.dmg.uninstaller)
+endif
 ifeq (1,1)
 	@# Pedantic mode...
 	$(INSTALL) -m 644 $(VBOX_BRAND_DARWIN_DISKIMAGE_DS_STORE)           $(VBOX_PATH_PACK_TMP)/DiskImage/.DS_Store
@@ -282,16 +275,8 @@ $(VBOX_PATH_PACK_TMP)/Packages/VBoxKEXTs.pkg: \
 	$(foreach kext,$(VBOX_DI_KEXTS), \
 		$(NLTAB)$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/$(kext).kext/Contents/Info.plist $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents/)
 	@# Copy the binaries and invoking lipo.
-ifdef VBOX_WITH_COMBINED_PACKAGE
-	$(foreach kext,$(VBOX_DI_KEXTS_UNIVERSAL), \
-		$(NLTAB)$(VBOX_DI_LIPO) -create \
-			$(VBOX_PATH_DIST_32)/$(kext).kext/Contents/MacOS/$(kext) \
-			$(VBOX_PATH_DIST_64)/$(kext).kext/Contents/MacOS/$(kext) \
-			-output $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents/MacOS/$(kext))
-else
 	$(foreach kext,$(VBOX_DI_KEXTS), \
 		$(NLTAB)$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/$(kext).kext/Contents/MacOS/$(kext) $(VBOX_PATH_PACK_TMP)/VBoxKEXTs.pkg.root/$(kext).kext/Contents/MacOS/)
-endif
 	@# Signed the kext bundles.
 ifdef VBOX_SIGNING_MODE
 	$(foreach kext,$(VBOX_DI_KEXTS) \
@@ -386,7 +371,8 @@ ifdef VBOX_WITH_CROGL
 endif
 ifdef VBOX_WITH_DEBUGGER_GUI
  VBOX_DI_VBAPP_DYLIBS += \
- 	MacOS/VBoxDbg.dylib
+ 	MacOS/VBoxDbg.dylib \
+ 	MacOS/DbgPlugInDiggers.dylib
 endif
 ifdef VBOX_WITH_HARDENING
  VBOX_DI_VBAPP_DYLIBS += \
@@ -453,10 +439,12 @@ VBOX_DI_VBAPP_PROGS = \
 	MacOS/VBoxAutostart \
 	MacOS/VirtualBoxVM \
 	$(if $(VBOX_WITH_WEBSERVICES),MacOS/vboxwebsrv) \
-	MacOS/VirtualBox
+	MacOS/VirtualBox \
+	$(if $(VBOX_WITH_DTRACE),MacOS/VBoxDTrace,)
 
 VBOX_DI_VBAPP_UNIVERSAL_PROGS = \
-	MacOS/vmstarter
+	MacOS/vmstarter \
+	$(if $(VBOX_WITH_VBOX_IMG)$(VBOX_WITH_TESTCASES),MacOS/vbox-img,)
 
 VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS = \
 	MacOS/VMMR0.r0 \
@@ -510,28 +498,25 @@ endif
 VBOX_DI_VBAPP_MISC_FILES += \
 	Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/classes.nib \
 	Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/info.nib \
-	Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/keyedobjects.nib
+	Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Versions/4/Resources/qt_menu.nib/keyedobjects.nib \
+	$(foreach qtmod, $(VBOX_QT4_MOD_NAMES), Frameworks/$(qtmod).framework/Versions/4/Resources/Info.plist)
 
 VBOX_DI_VBAPP_SYMLINKS = \
 	Resources/VirtualBoxVM.app/Contents/MacOS=>../../../MacOS/ \
 	Resources/vmstarter.app/Contents/MacOS=>../../../MacOS/ \
-	$(foreach qtmod, $(VBOX_QT4_MOD_NAMES), Frameworks/$(qtmod).framework/$(qtmod)=>Versions/4/$(qtmod)) \
-	Frameworks/QtGui$(VBOX_QT4_INFIX).framework/Resources=>Versions/4/Resources/
+	$(foreach qtmod, $(VBOX_QT4_MOD_NAMES) \
+	,Frameworks/$(qtmod).framework/Versions/Current=>4 )
+ifndef VBOX_NOT_OSX_105
+VBOX_DI_VBAPP_SYMLINKS += $(foreach qtmod, $(VBOX_QT4_MOD_NAMES) \
+	,Frameworks/$(qtmod).framework/$(qtmod)=>Versions/4/$(qtmod) \
+	 Frameworks/$(qtmod).framework/Resources=>Versions/4/Resources/ )
+endif
 
 ifdef VBOX_WITH_PYTHON
  # Python XPCOM glue
  VBOX_DI_VBAPP_PYTHON_FILES = \
- 	$(foreach f,$(notdir $(wildcard $(VBOX_PATH_DIST)/sdk/bindings/xpcom/python/xpcom/*.py)),sdk/bindings/xpcom/python/xpcom/$(f)) \
- 	sdk/bindings/xpcom/python/xpcom/client/__init__.py \
- 	sdk/bindings/xpcom/python/xpcom/server/__init__.py \
- 	sdk/bindings/xpcom/python/xpcom/server/enumerator.py \
- 	sdk/bindings/xpcom/python/xpcom/server/factory.py \
- 	sdk/bindings/xpcom/python/xpcom/server/loader.py \
- 	sdk/bindings/xpcom/python/xpcom/server/module.py \
- 	sdk/bindings/xpcom/python/xpcom/server/policy.py \
- 	sdk/installer/vboxapisetup.py \
- 	sdk/installer/vboxapi/__init__.py \
- 	sdk/installer/vboxapi/VirtualBox_constants.py
+ 	$(VBOXINST_SDK_BINDINGS_XPCOM_PYTHON_FILES) \
+ 	$(VBOXINST_SDK_INSTALLER_PYTHON_FILES)
 endif
 
 
@@ -572,6 +557,15 @@ $(VBOX_PATH_PACK_TMP)/Packages/VirtualBox.pkg: \
 		$(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxballoonctrl.plist \
 		$(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxautostart.plist \
 		$(VBOX_PATH_DI_SRC)/VirtualBox/VBoxAutostartDarwin.sh \
+               $(if-expr defined(VBOX_WITH_DTRACE), \
+                $(foreach f, $(VBOXINST_DTRACE_LIB_ARCH_FILES), \
+		 	$(call VBOX_DI_FN_DEP_32,VirtualBox.app/Contents/MacOS/dtrace/lib/x86/$f) \
+		 	$(call VBOX_DI_FN_DEP_64,VirtualBox.app/Contents/MacOS/dtrace/lib/amd64/$f)) \
+                $(foreach f, $(VBOXINST_DTRACE_TESTCASE_ARCH_FILES), \
+		 	$(call VBOX_DI_FN_DEP_32,VirtualBox.app/Contents/MacOS/dtrace/testcase/x86/$f) \
+		 	$(call VBOX_DI_FN_DEP_64,VirtualBox.app/Contents/MacOS/dtrace/testcase/amd64/$f)) \
+                $(addprefix $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES)) \
+		 ,) \
 		$(VBOX_DARWIN_INST_DEP_ON_MAKEFILE)
 	$(call MSG_TOOL,pkgbuild,,,$@)
 	@# Cleanup any previously failed attempts.
@@ -589,144 +583,94 @@ $(VBOX_PATH_PACK_TMP)/Packages/VirtualBox.pkg: \
 	$(MKDIR) -p -m 0775 \
 		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications
 	$(MKDIR) -p -m 0755 $(sort \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/components \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/nls \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/accessible \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/vmstarter.app \
-		$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/vmstarter.app/Contents \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/components \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/nls \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/accessible \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/VirtualBoxVM.app \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/VirtualBoxVM.app/Contents \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/vmstarter.app \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/vmstarter.app/Contents \
 		$(if-expr defined(VBOX_WITH_PYTHON), \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/installer \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/installer/vboxapi \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/ \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/xpcom \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/xpcom/python \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/xpcom/python/xpcom \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/xpcom/python/xpcom/client \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/xpcom/python/xpcom/server,) \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/installer \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/installer/vboxapi \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/ \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/python \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/python/xpcom \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/python/xpcom/client \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/python/xpcom/server,) \
                 $(if-expr defined(VBOX_WITH_JXPCOM), \
-                        $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/xpcom/java,) \
-		$(addprefix $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/,$(dir \
-			$(VBOX_DI_VBAPP_DYLIBS) $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) $(VBOX_DI_VBAPP_UNIVERSAL_PROGS) $(VBOX_DI_VBAPP_OTHER_BINS) $(VBOX_DI_VBAPP_PROGS) $(VBOX_DI_VBAPP_MISC_FILES) \
-			$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE) || "$(KBUILD_TARGET_ARCH)" == "amd64",$(VBOX_DI_VBAPP_DYLIBS.amd64) $(VBOX_DI_VBAPP_MISC_FILES.amd64),) \
-			$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE) || "$(KBUILD_TARGET_ARCH)" == "x86",  $(VBOX_DI_VBAPP_DYLIBS.x86)   $(VBOX_DI_VBAPP_MISC_FILES.x86),) \
+                        $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/java,) \
+		$(addprefix $(VBOX_PATH_VBOX_APP_TMP)/Contents/,$(dir \
+			$(VBOX_DI_VBAPP_DYLIBS) \
+			$(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) \
+			$(VBOX_DI_VBAPP_UNIVERSAL_PROGS) \
+			$(VBOX_DI_VBAPP_OTHER_BINS) \
+			$(VBOX_DI_VBAPP_PROGS) \
+			$(VBOX_DI_VBAPP_MISC_FILES) \
+			$(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) \
+			$(VBOX_DI_VBAPP_MISC_FILES.$(KBUILD_TARGET_ARCH)) \
 			))\
 		)
-	@# Create the .lproj language directories
+# Create the .lproj language directories
 	$(MKDIR) -p -m 0755 \
-		$(addprefix $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/,$(VBOX_INSTALL_LANG_LPROJ))
-	@# Install all supported language files
+		$(addprefix $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/,$(VBOX_INSTALL_LANG_LPROJ))
+# Install all supported language files
 	$(foreach f, $(VBOX_INSTALL_LANG_FILES) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/nls/$(f)    $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/nls/$(f)$(NLTAB))
+		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/nls/$(f)    $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/nls/$(f)$(NLTAB))
 ifdef VBOX_WITH_WEBSERVICES
-	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxwebsrv.plist       $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/
+	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxwebsrv.plist       $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/
 endif
-	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxballoonctrl.plist  $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/
-	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxautostart.plist    $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/
-	$(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VirtualBox/VBoxAutostartDarwin.sh                $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/
-	@# Install the python stuff
+	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxballoonctrl.plist  $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/
+	$(INSTALL) -m 0644 $(VBOX_PATH_DI_SRC)/VirtualBox/org.virtualbox.vboxautostart.plist    $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/
+	$(INSTALL) -m 0755 $(VBOX_PATH_DI_SRC)/VirtualBox/VBoxAutostartDarwin.sh                $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/
+# Install the python bridge stuff
 ifdef VBOX_WITH_PYTHON
 	$(foreach f,$(VBOX_DI_VBAPP_PYTHON_FILES) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/$(f)                                      $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/$(f)$(NLTAB) )
-	$(INSTALL) -m 0755 $(PATH_ROOT)/src/VBox/Frontends/VBoxShell/vboxshell.py               $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS
+		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/$(f)                                      $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/$(f)$(NLTAB) )
+	$(INSTALL) -m 0755 $(PATH_ROOT)/src/VBox/Frontends/VBoxShell/vboxshell.py               $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS
 endif
+# Install the java bridge stuff
 ifdef VBOX_WITH_JXPCOM
-	$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/sdk/bindings/xpcom/java/vboxjxpcom.jar             $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk/bindings/xpcom/java/vboxjxpcom.jar
+	$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/sdk/bindings/xpcom/java/vboxjxpcom.jar             $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/sdk/bindings/xpcom/java/vboxjxpcom.jar
 endif
-	@# Copy misc files.
+# Copy misc files.
 	$(foreach f,$(VBOX_DI_VBAPP_MISC_FILES) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(f)              $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(f)$(NLTAB) )
-ifdef VBOX_WITH_COMBINED_PACKAGE
-	$(foreach f,$(VBOX_DI_VBAPP_MISC_FILES.x86) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST_32)/VirtualBox.app/Contents/$(f)           $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(f)$(NLTAB) )
-	$(foreach f,$(VBOX_DI_VBAPP_MISC_FILES.amd64) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST_64)/VirtualBox.app/Contents/$(f)           $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(f)$(NLTAB) )
-endif
-	$(INSTALL) -m 644 $(VBOX_BRAND_LICENSE_TXT)                                             $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/LICENSE
+		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(f)              $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(f)$(NLTAB) )
+	$(INSTALL) -m 644 $(VBOX_BRAND_LICENSE_TXT)                                             $(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/LICENSE
 ifdef VBOX_WITH_DOCS_PACKING
 	$(foreach f,$(VBOX_ADD_MANUALS) \
-		,$(INSTALL) -m 0644 $(f) $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/$(NLTAB))
+		,$(INSTALL) -m 0644 $(f) $(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/$(NLTAB))
 endif
 	@# Create symlinks.
-ifdef VBOX_WITH_COMBINED_PACKAGE
-	$(foreach symlink,$(VBOX_DI_VBAPP_SYMLINKS) $(VBOX_DI_VBAPP_SYMLINKS.amd64) $(VBOX_DI_VBAPP_SYMLINKS.x86) \
-		,$(LN) -s $(word 2,$(subst =>, ,$(symlink)))                                    $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(word 1,$(subst =>, ,$(symlink)))$(NLTAB))
-else
 	$(foreach symlink,$(VBOX_DI_VBAPP_SYMLINKS) $(VBOX_DI_VBAPP_SYMLINKS.$(KBUILD_TARGET_ARCH)) \
-		,$(LN) -s $(word 2,$(subst =>, ,$(symlink)))                                    $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(word 1,$(subst =>, ,$(symlink)))$(NLTAB))
-endif
+		,$(LN) -s $(word 2,$(subst =>, ,$(symlink)))                                    $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(word 1,$(subst =>, ,$(symlink)))$(NLTAB))
 	@# Copy the dylibs.
-ifdef VBOX_WITH_COMBINED_PACKAGE
-	$(foreach dylib, $(VBOX_DI_VBAPP_DYLIBS) \
-		,$(VBOX_DI_LIPO) -create \
-			$(VBOX_PATH_DIST_32)/VirtualBox.app/Contents/$(dylib) \
-			$(VBOX_PATH_DIST_64)/VirtualBox.app/Contents/$(dylib) \
-			-output $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(dylib)$(NLTAB))
-	$(foreach dylib, $(VBOX_DI_VBAPP_DYLIBS.x86) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST_32)/VirtualBox.app/Contents/$(dylib)       $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(dylib)$(NLTAB))
-	$(foreach dylib, $(VBOX_DI_VBAPP_DYLIBS.amd64) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST_64)/VirtualBox.app/Contents/$(dylib)       $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(dylib)$(NLTAB))
-else
 	$(foreach dylib, $(VBOX_DI_VBAPP_DYLIBS) $(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(dylib)          $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(dylib)$(NLTAB))
-endif
+		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(dylib)          $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(dylib)$(NLTAB))
 	@# Copy the other binaries.
-ifdef VBOX_WITH_COMBINED_PACKAGE
-	$(foreach otherbin, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) \
-		,$(VBOX_DI_LIPO) -create \
-			$(VBOX_PATH_DIST_32)/VirtualBox.app/Contents/$(otherbin) \
-			$(VBOX_PATH_DIST_64)/VirtualBox.app/Contents/$(otherbin) \
-			-output $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(otherbin)$(NLTAB))
-	$(foreach otherbin, $(VBOX_DI_VBAPP_OTHER_BINS), \
-		$(NLTAB)$(INSTALL) -m 0644 $(VBOX_PATH_DIST_32)/VirtualBox.app/Contents/$(otherbin)    $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(otherbin)-x86 \
-		$(NLTAB)$(INSTALL) -m 0644 $(VBOX_PATH_DIST_64)/VirtualBox.app/Contents/$(otherbin)    $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(otherbin)-amd64 )
-else
-	$(foreach otherbin, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(otherbin)       $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(otherbin)$(NLTAB))
-	$(foreach otherbin, $(VBOX_DI_VBAPP_OTHER_BINS) \
-		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(otherbin)       $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(otherbin)-$(KBUILD_TARGET_ARCH)$(NLTAB))
-endif
+	$(foreach otherbin, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) $(VBOX_DI_VBAPP_OTHER_BINS) \
+		,$(INSTALL) -m 0644 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(otherbin)       $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(otherbin)$(NLTAB))
 	@# Create/copy the universal executable binaries.
-ifdef VBOX_WITH_COMBINED_PACKAGE
 	$(foreach otherbin, $(VBOX_DI_VBAPP_UNIVERSAL_PROGS) \
-		,$(VBOX_DI_LIPO) -create \
-			$(VBOX_PATH_DIST_32)/VirtualBox.app/Contents/$(otherbin) \
-			$(VBOX_PATH_DIST_64)/VirtualBox.app/Contents/$(otherbin) \
-			-output $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(otherbin)$(NLTAB))
-else
-	$(foreach otherbin, $(VBOX_DI_VBAPP_UNIVERSAL_PROGS) \
-		,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(otherbin)       $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(otherbin)$(NLTAB))
-endif
+		,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(otherbin)       $(VBOX_PATH_VBOX_APP_TMP)/Contents/$(otherbin)$(NLTAB))
 	@# Copy the binaries.
-ifdef VBOX_WITH_COMBINED_PACKAGE
-	$(foreach prog, $(VBOX_DI_VBAPP_PROGS) \
-		,$(INSTALL) -m 0755 $(VBOX_PATH_DIST_32)/VirtualBox.app/Contents/$(prog)        $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(prog)-x86$(NLTAB) \
-		 $(INSTALL) -m 0755 $(VBOX_PATH_DIST_64)/VirtualBox.app/Contents/$(prog)        $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(prog)-amd64$(NLTAB))
-else
 	$(foreach prog, $(VBOX_DI_VBAPP_PROGS) \
-		,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(prog)       	$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(prog)-$(KBUILD_TARGET_ARCH)$(NLTAB))
-endif
+		,$(INSTALL) -m 0755 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/$(prog)       	$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(prog)$(NLTAB))
 #ifdef VBOX_WITH_HARDENING - disabled temporarily
 if 1
 	@# We cannot use @executable_path together with setuid binaries, dyld gets upset about it. So, fix Qt libs and users.
 	$(foreach qtmod, $(VBOX_QT4_MOD_NAMES) \
 		,install_name_tool -id /Applications/VirtualBox.app/Contents/Frameworks/$(qtmod).framework/Versions/4/$(qtmod) \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Frameworks/$(qtmod).framework/Versions/4/$(qtmod)$(NLTAB) )
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/Frameworks/$(qtmod).framework/Versions/4/$(qtmod)$(NLTAB) )
 	$(foreach f, \
 		$(VBOX_DI_VBAPP_DYLIBS) \
-		$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE), \
-			$(VBOX_DI_VBAPP_DYLIBS.x86) \
-			$(VBOX_DI_VBAPP_DYLIBS.amd64) \
-			$(addsuffix -x86, $(VBOX_DI_VBAPP_PROGS)) \
-			$(addsuffix -amd64, $(VBOX_DI_VBAPP_PROGS)) \
-			,$(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) \
-			$(addsuffix -$(KBUILD_TARGET_ARCH), $(VBOX_DI_VBAPP_PROGS)) \
-			) \
+		$(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) \
+		$(VBOX_DI_VBAPP_PROGS) \
 		,install_name_tool \
 			$(foreach qtmod, $(VBOX_QT4_MOD_NAMES), \
 				-change           @executable_path/../Frameworks/$(qtmod).framework/Versions/4/$(qtmod) \
@@ -738,64 +682,69 @@ if 1
 				-change                                          $(qtmod).framework/Versions/4/$(qtmod) \
 				/Applications/VirtualBox.app/Contents/Frameworks/$(qtmod).framework/Versions/4/$(qtmod) \
 				) \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(f)$(NLTAB) )
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(f)$(NLTAB) )
 endif
+ifdef VBOX_WITH_DTRACE
+	@# DTrace library, testcases and scripts.
+	$(MKDIR) -p -m 0755 -- \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/dtrace/lib/$(KBUILD_TARGET_ARCH)/ \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/dtrace/testcase/$(KBUILD_TARGET_ARCH)/ \
+		$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/dtrace/scripts/
+	$(foreach file, $(addprefix lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+			$(addprefix testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+       		$(addprefix scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES)) \
+		,$(INSTALL) -m 0655 $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/dtrace/$(file) \
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/dtrace/$(file)$(NLTAB))
+endif
+
 	@# Signed the binaries and the application bundle.
-	@# Note #1 - We cannot sign the application binary here, since we switch to match the kernel bitness.
-	@# Note #2 - Must sign -amd64/-x86 suffixed binaries without the suffix, or verification fails. (Too lazy to do this for *.gc.)
 ifdef VBOX_SIGNING_MODE
 	$(foreach qtmod, $(VBOX_QT4_MOD_NAMES) \
-		,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Frameworks/$(qtmod).framework/Versions/4/$(qtmod),org.virtualbox.app.frameworks.$(qtmod)) )
+		,$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Frameworks/$(qtmod).framework/Versions/4/$(qtmod),org.virtualbox.app.frameworks.$(qtmod)) )
+	$(foreach qtmod, $(VBOX_QT4_MOD_NAMES) \
+		,$(NLTAB)$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Frameworks/$(qtmod).framework/Versions/4,org.virtualbox.app.frameworks.$(qtmod)) )
 	$(foreach dylib, \
 		$(VBOX_DI_VBAPP_DYLIBS) \
-		$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE), \
-			$(VBOX_DI_VBAPP_DYLIBS.x86) \
-			$(VBOX_DI_VBAPP_DYLIBS.amd64) \
-			,$(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) ) \
-		, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(dylib),org.virtualbox.app.macos.$(notdir $(dylib))) )
+		$(VBOX_DI_VBAPP_DYLIBS.$(KBUILD_TARGET_ARCH)) \
+		, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(dylib),org.virtualbox.app.macos.$(notdir $(dylib))) )
 	$(foreach bin, $(VBOX_DI_VBAPP_UNIVERSAL_PROGS) \
-		, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin))) )
- ifdef VBOX_NOT_OSX_105 # Still being hacked on, everything needs to be signed that lives in Contents/MacOS, guess we have to MOVE files out.
-	$(foreach other, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) \
-		, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(other),org.virtualbox.app.macos.$(notdir $(other))) )
-	$(foreach arch, $(if-expr defined(VBOX_WITH_COMBINED_PACKAGE), amd64 x86, $(KBUILD_TARGET_ARCH)) \
-		, $(foreach other, $(VBOX_DI_VBAPP_OTHER_BINS) \
-			, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(other)-$(arch),org.virtualbox.app.macos.$(notdir $(other))-$(arch)) ) )
-	$(foreach other, $(filter MacOS/%,$(VBOX_DI_VBAPP_MISC_FILES)) \
-		, $(NLTAB)$(call VBOX_SIGN_VMM_MOD_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(other),org.virtualbox.app.macos.$(notdir $(other))) )
+		, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin))) )
+ ifdef VBOX_NOT_OSX_105 ## @todo Move as much stuff out of MacOS/ as possible!!
+	$(foreach other, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) $(VBOX_DI_VBAPP_OTHER_BINS)\
+		, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(other),org.virtualbox.app.macos.$(notdir $(other))) )
+	$(foreach bin, $(filter-out MacOS/VirtualBox,$(VBOX_DI_VBAPP_PROGS)) \
+		, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin))) )
+	$(foreach file, $(if-expr defined(VBOX_WITH_WEBSERVICES),MacOS/org.virtualbox.vboxwebsrv.plist,) \
+			MacOS/org.virtualbox.vboxballoonctrl.plist \
+			MacOS/org.virtualbox.vboxautostart.plist \
+			MacOS/VBoxAutostartDarwin.sh \
+			$(if-expr defined(VBOX_WITH_PYTHON),$(addprefix MacOS/, $(VBOX_DI_VBAPP_PYTHON_FILES) vboxshell.py),) \
+			$(if-expr defined(VBOX_WITH_JXPCOM),MacOS/sdk/bindings/xpcom/java/vboxjxpcom.jar,) \
+			$(filter MacOS/%,$(VBOX_DI_VBAPP_MISC_FILES)) \
+                       $(if-expr defined(VBOX_WITH_DOCS_PACKING),$(addprefix MacOS/,$(VBOX_ADD_MANUALS)),) \
+                       $(if-expr defined(VBOX_WITH_DTRACE),\
+				$(addprefix MacOS/dtrace/lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+				$(addprefix MacOS/dtrace/testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+       			$(addprefix MacOS/dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES)) ,) \
+			$(addprefix MacOS/nls/,$(VBOX_INSTALL_LANG_FILES)) \
+		, $(NLTAB)$(call VBOX_SIGN_FILE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(file),org.virtualbox.app.$(tolower $(subst $(SP),,$(subst /,.,$(file))))) )
+
+	$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/VirtualBoxVM.app,,)
+	$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/Resources/vmstarter.app,,)
+	$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_VBOX_APP_TMP),,--deep)
  else
-	$(foreach other, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) \
-		, $(NLTAB)$(call VBOX_SIGN_VMM_MOD_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(other),org.virtualbox.app.macos.$(notdir $(other))) )
-	$(foreach arch, $(if-expr defined(VBOX_WITH_COMBINED_PACKAGE), amd64 x86, $(KBUILD_TARGET_ARCH)) \
-		, $(foreach other, $(VBOX_DI_VBAPP_OTHER_BINS) \
-			, $(NLTAB)$(call VBOX_SIGN_VMM_MOD_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(other)-$(arch),org.virtualbox.app.macos.$(notdir $(other))-$(arch)) ) )
- endif
-	$(foreach arch, $(if-expr defined(VBOX_WITH_COMBINED_PACKAGE), amd64 x86, $(KBUILD_TARGET_ARCH)) \
-		, $(foreach bin, $(VBOX_DI_VBAPP_PROGS) \
-		, \
-               $(NLTAB)$(MV) -- $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(bin)-$(arch) $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(bin) \
-		$(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin))) \
-               $(NLTAB)$(MV) -- $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(bin) $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/$(bin)-$(arch) \
-		))
- ifdef VBOX_NOT_OSX_105 # requires codesign+framworks from Lion or later. Snow Leopard codesign says object file format invalid or unsuitable.
-	$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app,)
-	$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/vmstarter.app,)
-	$(call VBOX_SIGN_BUNDLE_FN,$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app,)
+	$(foreach other, $(VBOX_DI_VBAPP_OTHER_UNIVERSAL_BINS) $(VBOX_DI_VBAPP_OTHER_BINS) \
+		, $(NLTAB)$(call VBOX_SIGN_VMM_MOD_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(other),org.virtualbox.app.macos.$(notdir $(other))) )
+	$(foreach bin, $(VBOX_DI_VBAPP_PROGS) \
+		, $(NLTAB)$(call VBOX_SIGN_MACHO_FN,$(VBOX_PATH_VBOX_APP_TMP)/Contents/$(bin),org.virtualbox.app.macos.$(notdir $(bin))) )
  endif
 endif
 	@# Set the correct owner and set the set-user-ID-on-execution bit on the relevant executables.
 	sudo chown -R root:admin $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root
 ifdef VBOX_WITH_HARDENING
- ifdef VBOX_WITH_COMBINED_PACKAGE
-	sudo chmod u+s \
-		$(foreach bin,VBoxHeadless VirtualBox VirtualBoxVM VBoxNetAdpCtl VBoxNetDHCP VBoxNetNAT,\
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/$(bin)-x86 \
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/$(bin)-amd64)
- else
 	sudo chmod u+s \
 		$(foreach bin,VBoxHeadless VirtualBox VirtualBoxVM VBoxNetAdpCtl VBoxNetDHCP VBoxNetNAT,\
-			$(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/$(bin)-$(KBUILD_TARGET_ARCH))
- endif
+			$(VBOX_PATH_VBOX_APP_TMP)/Contents/MacOS/$(bin))
 endif
 	@# Do keyword replacement in the package info and description files.
 	$(SED) \
@@ -820,6 +769,7 @@ endif
 		--version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 		--install-location /Applications/ \
 		--ownership preserve \
+		$(if-expr defined(VBOX_NOT_OSX_105),--preserve-xattr,) \
 		$(if $(VBOX_MACOSX_INSTALLER_SIGN),--sign "$(VBOX_MACOSX_INSTALLER_SIGN)",) \
 		$@
 	@# Cleanup
@@ -870,10 +820,18 @@ ifdef VBOX_WITH_WEBSERVICES
 	$(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/bin/vboxwebsrv \
 		'#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/vboxwebsrv "$$@"'
 endif
+if defined(VBOX_WITH_VBOX_IMG) || defined(VBOX_WITH_TESTCASES)
+	$(APPEND) $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/bin/vbox-img \
+		'#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/vbox-img "$$@"'
+endif
 	$(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/bin/VBoxBalloonCtrl \
 		'#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxBalloonCtrl "$$@"'
 	$(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/bin/VBoxAutostart \
 		'#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart "$$@"'
+ifdef VBOX_WITH_DTRACE
+	$(APPEND) -tn $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/bin/VBoxDTrace \
+		'#!/bin/bash' 'exec /Applications/VirtualBox.app/Contents/MacOS/VBoxDTrace "$$@"'
+endif
 	@# Set the correct owners and file permissions.
 	sudo chmod 0755 $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root/usr/bin/*
 	sudo chown    root:admin $(VBOX_PATH_PACK_TMP)/VirtualBoxCLI.pkg.root
diff --git a/src/VBox/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh b/src/VBox/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh
index c132ccd..ce174b1 100755
--- a/src/VBox/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh
+++ b/src/VBox/Installer/darwin/VBoxKEXTs/VirtualBoxStartup.sh
@@ -6,7 +6,7 @@
 #
 
 #
-# Copyright (C) 2007-2013 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -72,30 +72,6 @@ StartService()
     VBOXUSB="VBoxUSB"
 
     #
-    # Switch the binaries to the right architecture.
-    #
-    VBOX_ARCH=`uname -m`
-    if test "$VBOX_ARCH" = "x86_64"; then
-        VBOX_ARCH="amd64"
-    else
-        VBOX_ARCH="x86"
-    fi
-    for VBOX_TRG in `ls /Applications/VirtualBox.app/Contents/MacOS/*-${VBOX_ARCH}`;
-    do
-        VBOX_LINKNAME=`echo "$VBOX_TRG" | sed -e 's|-'"${VBOX_ARCH}"'$||' `
-        if test "$VBOX_LINKNAME" != "$VBOX_TRG"; then
-            rm -f "$VBOX_LINKNAME"
-            if ! /bin/ln -vh "$VBOX_TRG" "$VBOX_LINKNAME"; then
-                ConsoleMessage "Error: /bin/ln -vh $VBOX_TRG $VBOX_LINKNAME failed"
-                VBOX_RC=1
-            fi
-        else
-            ConsoleMessage "Error: Script error VBOX_TRG=$VBOX_TRG"
-            VBOX_RC=1
-        fi
-    done
-
-    #
     # Check that all the directories exist first.
     #
     if [ ! -d "/Library/Application Support/VirtualBox/${VBOXDRV}.kext" ]; then
diff --git a/src/VBox/Installer/darwin/VirtualBox/postflight b/src/VBox/Installer/darwin/VirtualBox/postflight
index 5727131..2486edb 100755
--- a/src/VBox/Installer/darwin/VirtualBox/postflight
+++ b/src/VBox/Installer/darwin/VirtualBox/postflight
@@ -1,7 +1,11 @@
 #!/bin/sh
+# $Id: postflight $
+## @file
+# Post installation script.
+#
 
 #
-# Copyright (C) 2007-2010 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -15,26 +19,6 @@
 CP="/bin/cp -f"
 CPDIR="${CP} -R"
 
-#
-# Select the right architecture.
-#
-MY_ARCH=`uname -m`
-if test "$MY_ARCH" = "x86_64"; then
-  MY_ARCH="amd64"
-else
-  MY_ARCH="x86"
-fi
-set -e
-for trg in `ls /Applications/VirtualBox.app/Contents/MacOS/*-${MY_ARCH}`;
-do
-    linkname=`echo "$trg" | sed -e 's|-'"${MY_ARCH}"'$||' `
-    if test "$linkname" = "$trg"; then
-        echo "oops: $trg" 1>&2
-        exit 1;
-    fi
-    rm -f         "$linkname"
-    /bin/ln -vh "$trg" "$linkname"
-done
 
 #
 # Install the Python bindings
@@ -50,6 +34,7 @@ if [ -e "${VBOX_INSTALL_PATH}/sdk/installer/vboxapisetup.py" ]; then
     		# Pass install path via environment
     		export VBOX_INSTALL_PATH
     		/bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py install"
+    		/bin/sh -c "cd $VBOX_INSTALL_PATH/sdk/installer && ${p} vboxapisetup.py clean --all"
     	fi
     done
 fi
@@ -103,3 +88,4 @@ fi
 chown -R root:admin /Applications/VirtualBox.app
 
 exit 0;
+
diff --git a/src/VBox/Installer/freebsd/Makefile.kmk b/src/VBox/Installer/freebsd/Makefile.kmk
index 4455fec..8332b9b 100644
--- a/src/VBox/Installer/freebsd/Makefile.kmk
+++ b/src/VBox/Installer/freebsd/Makefile.kmk
@@ -109,7 +109,8 @@ VBOX_FBSD_STRIP_BIN = \
 		VBoxOGLrenderspu.so \
 		VBoxTestOGL \
 		VBoxSharedCrOpenGL.so,) \
-	$(if $(VBOX_WITH_PYTHON),VBoxPython.so,)
+	$(if $(VBOX_WITH_PYTHON),VBoxPython.so,) \
+	$(if $(VBOX_WITH_DTRACE),VBoxDTrace,)
 
 # Do not remove relocation information of these binaries
 VBOX_FBSD_STRIP_OBJ = \
@@ -130,9 +131,9 @@ VBOX_FBSD_NO_STRIP = \
 
 # EFI firmware
 ifdef VBOX_WITH_EFIFW_PACKING
-  VBOX_FBSD_NO_STRIP += \
-	VBoxEFI32.fd \
-        VBoxEFI64.fd
+ VBOX_FBSD_NO_STRIP += \
+ 	VBoxEFI32.fd \
+ 	VBoxEFI64.fd
 endif
 
 # Symlinks residing in bin/
@@ -140,7 +141,8 @@ VBOX_FBSD_SYMLINKS = \
 	$(if $(VBOX_WITH_MAIN), \
 		VBoxManage \
 		VBoxSVC) \
-	$(if $(VBOX_WITH_VBOXSDL),VBoxSDL,)
+	$(if $(VBOX_WITH_VBOXSDL),VBoxSDL,) \
+	$(if $(VBOX_WITH_DTRACE),VBoxDTrace,)
 
 # Qt4 GUI
 ifdef VBOX_WITH_QTGUI
@@ -149,7 +151,7 @@ ifdef VBOX_WITH_QTGUI
  	VBoxKeyboard.so \
  	VirtualBox \
  	$(if $(VBOX_WITH_HARDENING),VirtualBox.so) \
-	$(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so)
+	$(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so DbgPlugInDiggers.so,)
  VBOX_FBSD_SYMLINKS += \
  	VirtualBox
  VBOX_FBSD_NO_STRIP += \
@@ -211,6 +213,15 @@ ifdef VBOX_WITH_WEBSERVICES
 	vboxwebsrv
 endif
 
+# DTrace library, testcase and scripts (as the rest of this file, this makes bold
+# ASSUMPTIONS about VBPX_INST_XXX variable values).
+ifdef VBOX_WITH_DTRACE
+ VBOX_FBSD_NO_STRIP += \
+       $(addprefix dtrace/lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+       $(addprefix dtrace/testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+       $(addprefix dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES))
+endif
+
 #
 # All the bin files that goes into the archives.
 #
@@ -229,7 +240,7 @@ $(PATH_STAGE_BIN)/vboxdrv.tar.gz: \
 
 #
 # The generic installer.
-# @todo r=aeichner: Create pkg_plist dynamically based on the available features
+## @todo r=aeichner: Create pkg_plist dynamically based on the available features
 #
 $(PATH_STAGE_BIN)/$(VBOX_FBSD_PACKAGE_NAME): \
 		$(VBOX_VERSION_STAMP) \
@@ -315,6 +326,14 @@ $(VBOX_FBSD_INST_OUT_DIR)/pkg_plist: \
 		-e "s;_VBOX_REM_64BIT_MODULE_;$(if $(eq $(KBUILD_TARGET_ARCH),x86),VBoxREM64.so,);g" \
 		--output $@ \
 		$<
+ifdef VBOX_WITH_DTRACE
+	$(QUIET)$(APPEND) -n "$@" "@mode 644" \
+		$(addprefix lib/virtualbox/dtrace/lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+		$(addprefix lib/virtualbox/dtrace/testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+		$(addprefix lib/virtualbox/dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES)) \
+		"@mode 755" \
+		"bin/VBoxDTrace"
+endif
 
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/Installer/freebsd/pkg_plist b/src/VBox/Installer/freebsd/pkg_plist
index 1db2493..09bd557 100644
--- a/src/VBox/Installer/freebsd/pkg_plist
+++ b/src/VBox/Installer/freebsd/pkg_plist
@@ -2,6 +2,7 @@
 @group wheel
 @mode 755
 lib/virtualbox/VBoxDbg.so
+lib/virtualbox/DbgPlugInDiggers.so
 lib/virtualbox/VBoxDD.so
 lib/virtualbox/VBoxDD2.so
 lib/virtualbox/VBoxDDU.so
diff --git a/src/VBox/Installer/linux/Makefile.kmk b/src/VBox/Installer/linux/Makefile.kmk
index 04571eb..cb87c99 100644
--- a/src/VBox/Installer/linux/Makefile.kmk
+++ b/src/VBox/Installer/linux/Makefile.kmk
@@ -66,10 +66,10 @@ INSTALLS += linux-bin
 linux-bin_INST = bin/
 linux-bin_MODE = a+rx,u+w
 linux-bin_SOURCES = \
-        scripts/install.sh=>scripts/install.sh \
-        scripts/VBoxHeadlessXOrg.sh=>scripts/VBoxHeadlessXOrg.sh \
-        VBoxSysInfo.sh \
-        VBoxCreateUSBNode.sh \
+	scripts/install.sh=>scripts/install.sh \
+	scripts/VBoxHeadlessXOrg.sh=>scripts/VBoxHeadlessXOrg.sh \
+	VBoxSysInfo.sh \
+	VBoxCreateUSBNode.sh \
 	VBox.sh=>VBox.sh \
 	$(if $(VBOX_WITH_PYTHON),$(PATH_ROOT)/src/VBox/Frontends/VBoxShell/vboxshell.py=>vboxshell.py,)
 
@@ -77,26 +77,26 @@ INSTALLS += linux-scripts
 linux-scripts_INST = $(VBOX_LNX_INST_STAGE_DIR_REL)/
 linux-scripts_MODE = a+rx,u+w
 linux-scripts_SOURCES = \
-		deffiles \
-		routines.sh \
-		uninstall.sh \
-        vboxautostart-service.sh \
-		vboxballoonctrl-service.sh \
-		vboxdrv-pardus.py \
-		vboxweb-service.sh
+	deffiles \
+	routines.sh \
+	uninstall.sh \
+	vboxautostart-service.sh \
+	vboxballoonctrl-service.sh \
+	vboxdrv-pardus.py \
+	vboxweb-service.sh
 
 INSTALLS += linux-misc
 linux-misc_INST = bin/
 linux-misc_MODE = a+r,u+w
 linux-misc_SOURCES = \
 	$(PATH_ROOT)/src/VBox/Frontends/VirtualBox/images/$(if $(VBOX_OSE),OSE,NonOSE)/VirtualBox_32px.png=>VBox.png \
-	$(PATH_ROOT)/src/VBox/Installer/common/virtualbox.xml \
+	$(VBOX_PATH_INST_COMMON_SRC)/virtualbox.xml \
 	$(if $(VBOX_OSE),,$(VBOX_BRAND_LICENSE_TXT)=>LICENSE) \
 	$(linux-misc_0_OUTDIR)/generated.sh=>scripts/generated.sh \
 	$(if $(VBOX_WITH_QTGUI),$(linux-misc_0_OUTDIR)/virtualbox.desktop,)
 linux-misc_CLEAN = \
-    $(linux-misc_0_OUTDIR)/generated.sh \
-    $(linux-misc_0_OUTDIR)/virtualbox.desktop
+	$(linux-misc_0_OUTDIR)/generated.sh \
+	$(linux-misc_0_OUTDIR)/virtualbox.desktop
 
 $$(linux-misc_0_OUTDIR)/generated.sh: $(VBOX_VERSION_STAMP) $(VBOX_LNX_INST_DEP_ON_MAKEFILE) | $$(dir $$@)
 	$(call MSG_GENERATE,,$@,$<)
@@ -106,7 +106,7 @@ $$(linux-misc_0_OUTDIR)/generated.sh: $(VBOX_VERSION_STAMP) $(VBOX_LNX_INST_DEP_
 	$(QUIET)$(APPEND) '$@' 'VBOX_C_YEAR="$(VBOX_C_YEAR)"'
 	$(QUIET)$(APPEND) '$@' 'VBOX_VENDOR="$(VBOX_VENDOR)"'
 
-$$(linux-misc_0_OUTDIR)/virtualbox.desktop: $(PATH_ROOT)/src/VBox/Installer/common/virtualbox.desktop.in $(VBOX_VERSION_STAMP) | $$(dir $$@)
+$$(linux-misc_0_OUTDIR)/virtualbox.desktop: $(VBOX_PATH_INST_COMMON_SRC)/virtualbox.desktop.in $(VBOX_VERSION_STAMP) | $$(dir $$@)
 	$(call MSG_GENERATE,,$@,$<)
 ifdef VBOX_PATH_PACKAGE_DOCS
 	$(QUIET)$(SED) -e "s+ at VBOX_DOC_PATH@+$(VBOX_PATH_PACKAGE_DOCS)+" \
@@ -172,6 +172,7 @@ VBOX_LNX_STRIP_BIN = \
 	$(if $(and $(VBOX_WITH_EXTPACK_VNC),$(VBOX_WITHOUT_EXTPACK_VNC_PACKING)), \
 		ExtensionPacks/VNC/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/VBoxVNC.so \
 		ExtensionPacks/VNC/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/VBoxVNCMain.so,) \
+	$(if $(VBOX_WITH_DTRACE),VBoxDTrace,)\
 	VBoxTunctl \
 	helpers/generate_service_file
 
@@ -218,7 +219,7 @@ ifdef VBOX_WITH_QTGUI
  	VBoxKeyboard.so \
  	VirtualBox \
  	$(if $(VBOX_WITH_HARDENING),VirtualBox.so) \
-	$(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so)
+	$(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so DbgPlugInDiggers.so)
  VBOX_LNX_NO_STRIP += \
 	virtualbox.desktop \
 	virtualbox.xml \
@@ -273,17 +274,8 @@ endif
 # Python XPCOM glue
 ifdef VBOX_WITH_PYTHON
  VBOX_LNX_NO_STRIP += \
- 	$(foreach f,$(notdir $(wildcard $(PATH_STAGE_BIN)/sdk/bindings/xpcom/python/xpcom/*.py)),sdk/bindings/xpcom/python/xpcom/$(f)) \
- 	sdk/bindings/xpcom/python/xpcom/client/__init__.py \
- 	sdk/bindings/xpcom/python/xpcom/server/__init__.py \
- 	sdk/bindings/xpcom/python/xpcom/server/enumerator.py \
- 	sdk/bindings/xpcom/python/xpcom/server/factory.py \
- 	sdk/bindings/xpcom/python/xpcom/server/loader.py \
- 	sdk/bindings/xpcom/python/xpcom/server/module.py \
- 	sdk/bindings/xpcom/python/xpcom/server/policy.py \
- 	sdk/installer/vboxapisetup.py \
- 	sdk/installer/vboxapi/__init__.py \
- 	sdk/installer/vboxapi/VirtualBox_constants.py
+ 	$(VBOXINST_SDK_BINDINGS_XPCOM_PYTHON_FILES) \
+ 	$(VBOXINST_SDK_INSTALLER_PYTHON_FILES)
 endif
 
 # Java XPCOM bridge
@@ -306,6 +298,12 @@ ifdef VBOX_WITH_WEBSERVICES
  	webtest
 endif
 
+# vbox-img
+if defined(VBOX_WITH_TESTCASES) || defined(VBOX_WITH_VBOX_IMG)
+  VBOX_LNX_STRIP_BIN += \
+	vbox-img
+endif
+
 # EFI firmware
 ifdef VBOX_WITH_EFIFW_PACKING
  VBOX_LNX_NO_STRIP += \
@@ -313,6 +311,15 @@ ifdef VBOX_WITH_EFIFW_PACKING
  	VBoxEFI64.fd
 endif
 
+# DTrace library and scripts.
+ifdef VBOX_WITH_DTRACE
+ VBOX_LNX_NO_STRIP += \
+ 	$(addprefix dtrace/lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+ 	$(addprefix dtrace/testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+ 	$(addprefix dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES))
+endif
+
+# Icons
 VBOX_MIME_ICONS = \
 	$(addprefix $(PATH_ROOT)/src/VBox/Resources/other/,\
 	    $(foreach f,ova ovf vbox vbox-extpack vdi vmdk vhd hdd, \
@@ -490,7 +497,14 @@ BLDDIRS += $(foreach d,\
 	  archive/ExtensionPacks/VNC \
 	  archive/ExtensionPacks/VNC/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),) \
 	archive/additions \
-	install\
+	install \
+       $(if $(VBOX_WITH_DTRACE),\
+	  archive/dtrace \
+	  archive/dtrace/lib \
+	  archive/dtrace/lib/$(KBUILD_TARGET_ARCH) \
+	  archive/dtrace/testcase/ \
+	  archive/dtrace/testcase/$(KBUILD_TARGET_ARCH) \
+	  archive/dtrace/scripts,) \
 ,$(VBOX_LNX_INST_OUT_DIR)/$(d)/)
 
 
diff --git a/src/VBox/Installer/linux/VBox.sh b/src/VBox/Installer/linux/VBox.sh
index 6201a66..3f4b61c 100755
--- a/src/VBox/Installer/linux/VBox.sh
+++ b/src/VBox/Installer/linux/VBox.sh
@@ -1,8 +1,10 @@
 #!/bin/sh
-#
+## @file
 # Oracle VM VirtualBox startup script, Linux hosts.
 #
-# Copyright (C) 2006-2012 Oracle Corporation
+
+#
+# Copyright (C) 2006-2016 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -101,6 +103,9 @@ case "$APP" in
     VBoxBalloonCtrl|vboxballoonctrl)
         exec "$INSTALL_DIR/VBoxBalloonCtrl" "$@"
         ;;
+    VBoxDTrace|vboxdtrace)
+        exec "$INSTALL_DIR/VBoxDTrace" "$@"
+        ;;
     vboxwebsrv)
         exec "$INSTALL_DIR/vboxwebsrv" "$@"
         ;;
diff --git a/src/VBox/Installer/linux/deffiles b/src/VBox/Installer/linux/deffiles
index c2f48f6..a69278f 100755
--- a/src/VBox/Installer/linux/deffiles
+++ b/src/VBox/Installer/linux/deffiles
@@ -4,7 +4,7 @@
 # VirtualBox linux default files list
 
 #
-# Copyright (C) 2007-2012 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -26,6 +26,7 @@
 DEFAULT_FILE_NAMES=" \
     VBoxDD.so \
     VBoxDD2.so \
+    VBoxDTrace \
     VBoxKeyboard.so \
     VBoxManage \
     VBoxNetDHCP \
@@ -55,6 +56,8 @@ DEFAULT_FILE_NAMES=" \
     VBoxAuthSimple.so \
     VBoxDbg.so \
     VBoxDbg3.so \
+    DbgPlugInDiggers.so \
+    DBGCPlugInDiggers.so \
     VBoxVRDP.so \
     VBoxVRDP \
     VBoxHeadless \
@@ -68,6 +71,7 @@ DEFAULT_FILE_NAMES=" \
     vboxefi.fv \
     vboxefi64.fv \
     vboxwebsrv \
+    vbox-img \
     components/comreg.dat \
     components/xpti.dat \
     components/VBoxC.so \
@@ -79,6 +83,20 @@ DEFAULT_FILE_NAMES=" \
     components/VBoxXPCOMBase.xpt \
     components/VBoxXPCOMIPCC.so \
     components/VirtualBox_XPCOM.xpt \
+    dtrace/lib/amd64/vbox-types.d \
+    dtrace/lib/amd64/vbox-arch-types.d \
+    dtrace/lib/amd64/vm.d \
+    dtrace/lib/amd64/cpumctx.d \
+    dtrace/lib/amd64/CPUMInternal.d \
+    dtrace/lib/amd64/x86.d \
+    dtrace/lib/x86/vbox-types.d \
+    dtrace/lib/x86/vbox-arch-types.d \
+    dtrace/lib/x86/vm.d \
+    dtrace/lib/x86/cpumctx.d \
+    dtrace/lib/x86/CPUMInternal.d \
+    dtrace/lib/x86/x86.d \
+    dtrace/testcase/amd64/vbox-vm-struct-test.d \
+    dtrace/testcase/x86/vbox-vm-struct-test.d \
     VBox.sh \
     VBox.png \
     virtualbox.desktop \
diff --git a/src/VBox/Installer/linux/distributions_deb b/src/VBox/Installer/linux/distributions_deb
index 9b8f346..9f5cc77 100644
--- a/src/VBox/Installer/linux/distributions_deb
+++ b/src/VBox/Installer/linux/distributions_deb
@@ -1,6 +1,8 @@
-_Debian_sid      = DEBIAN_7_0
+_Debian_sid      = DEBIAN_8_0
+_Debian_jessie   = DEBIAN_8_0
 _Debian_wheezy   = DEBIAN_7_0
 _Debian_squeeze  = DEBIAN_6_0
+_Ubuntu_trusty   = UBUNTU_14_04
 _Ubuntu_raring   = UBUNTU_13_04
 _Ubuntu_quantal  = UBUNTU_12_10
 _Ubuntu_precise  = UBUNTU_12_04
diff --git a/src/VBox/Installer/linux/install.sh b/src/VBox/Installer/linux/install.sh
index a590e8a..ecf8a42 100755
--- a/src/VBox/Installer/linux/install.sh
+++ b/src/VBox/Installer/linux/install.sh
@@ -108,9 +108,11 @@ check_previous() {
     check_binary "/usr/bin/VBoxSDL" "$install_dir" &&
     check_binary "/usr/bin/VBoxVRDP" "$install_dir" &&
     check_binary "/usr/bin/VBoxHeadless" "$install_dir" &&
+    check_binary "/usr/bin/VBoxDTrace" "$install_dir" &&
     check_binary "/usr/bin/VBoxBalloonCtrl" "$install_dir" &&
     check_binary "/usr/bin/VBoxAutostart" "$install_dir" &&
     check_binary "/usr/bin/vboxwebsrv" "$install_dir"
+    check_binary "/usr/bin/vbox-img" "$install_dir"
 }
 
 ##############################################################################
@@ -402,7 +404,11 @@ if [ "$ACTION" = "install" ]; then
     ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VBoxBalloonCtrl
     ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VBoxAutostart
     ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/vboxwebsrv
+    ln -sf $INSTALLATION_DIR/vbox-img /usr/bin/vbox-img
     ln -sf $INSTALLATION_DIR/VBox.png /usr/share/pixmaps/VBox.png
+    if [ -f $INSTALLATION_DIR/VBoxDTrace ]; then
+        ln -sf $INSTALLATION_DIR/VBox.sh /usr/bin/VBoxDTrace
+    fi
     # Unity and Nautilus seem to look here for their icons
     ln -sf $INSTALLATION_DIR/icons/128x128/virtualbox.png /usr/share/pixmaps/virtualbox.png
     ln -sf $INSTALLATION_DIR/virtualbox.desktop /usr/share/applications/virtualbox.desktop
@@ -415,6 +421,9 @@ if [ "$ACTION" = "install" ]; then
     ln -sf VBoxManage /usr/bin/vboxmanage > /dev/null 2>&1
     ln -sf VBoxSDL /usr/bin/vboxsdl > /dev/null 2>&1
     ln -sf VBoxHeadless /usr/bin/vboxheadless > /dev/null 2>&1
+    if [ -f $INSTALLATION_DIR/VBoxDTrace ]; then
+        ln -sf VBoxDTrace /usr/bin/vboxdtrace > /dev/null 2>&1
+    fi
 
     # Icons
     cur=`pwd`
diff --git a/src/VBox/Installer/linux/install_service/generate_service_file.cpp b/src/VBox/Installer/linux/install_service/generate_service_file.cpp
index 2ff2757..75911ef 100644
--- a/src/VBox/Installer/linux/install_service/generate_service_file.cpp
+++ b/src/VBox/Installer/linux/install_service/generate_service_file.cpp
@@ -584,13 +584,11 @@ bool createServiceFileCore(char **ppachTemplate,
             }
             else
             {
-                const char *pcszFileName =
-                    RTPathFilename(pParameters->pcszCommand);
-                const char *pcszExtension =
-                    RTPathExt(pParameters->pcszCommand);
+                const char *pcszFileName = RTPathFilename(pParameters->pcszCommand);
+                const char *pcszSuffix   = RTPathSuffix(pParameters->pcszCommand);
                 char *pszName = RTStrDupN(pcszFileName,
-                                            pcszExtension
-                                          ? pcszExtension - pcszFileName
+                                            pcszSuffix
+                                          ? pcszSuffix - pcszFileName
                                           : RTPATH_MAX);
                 bool fRc;
                 if (!pszName)
diff --git a/src/VBox/Installer/linux/install_service/init_template.sh b/src/VBox/Installer/linux/install_service/init_template.sh
index ed9c9a4..9debff7 100755
--- a/src/VBox/Installer/linux/install_service/init_template.sh
+++ b/src/VBox/Installer/linux/install_service/init_template.sh
@@ -29,7 +29,7 @@
 
 cr="
 "
-tab="	"
+tab="   "
 IFS=" ${cr}${tab}"
 'unset' -f unalias
 'unalias' -a
diff --git a/src/VBox/Installer/linux/install_service/install_service.sh b/src/VBox/Installer/linux/install_service/install_service.sh
index 8931104..3064628 100755
--- a/src/VBox/Installer/linux/install_service/install_service.sh
+++ b/src/VBox/Installer/linux/install_service/install_service.sh
@@ -17,7 +17,7 @@
 # Clean up before we start.
 cr="
 "
-tab="	"
+tab="   "
 IFS=" ${cr}${tab}"
 'unset' -f unalias
 'unalias' -a 2>/dev/null
diff --git a/src/VBox/Installer/linux/rpm/LocalConfig.kmk b/src/VBox/Installer/linux/rpm/LocalConfig.kmk
index 2c5ef83..0acfee8 100644
--- a/src/VBox/Installer/linux/rpm/LocalConfig.kmk
+++ b/src/VBox/Installer/linux/rpm/LocalConfig.kmk
@@ -17,8 +17,7 @@
 
 # don't build testcases to save time, they are not needed for the package
 VBOX_WITH_TESTCASES        :=
-VBOX_WITH_TESTSUITE        :=
-VBOX_WITH_PLUGIN_CRYPT     :=
+VBOX_WITH_VALIDATIONKIT    :=
 
 # required for VBOX_WITH_RUNPATH
 VBOX_WITH_ORIGIN           :=
@@ -29,6 +28,7 @@ VBOX_PATH_SHARED_LIBS      := $(VBOX_PATH_APP_PRIVATE_ARCH)
 VBOX_WITH_RUNPATH          := $(VBOX_PATH_APP_PRIVATE_ARCH)
 VBOX_PATH_APP_PRIVATE      := /usr/share/virtualbox
 VBOX_PATH_APP_DOCS          = $(VBOX_PATH_PACKAGE_DOCS)
+VBOX_WITH_VBOX_IMG         := 1
 
 # gcc 4.5 produces some more false positives
 VBOX_WITH_WARNINGS_AS_ERRORS :=
diff --git a/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec b/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
index 07bc38c..966c4eb 100644
--- a/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
+++ b/src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec
@@ -115,7 +115,7 @@ cd icons
 cd -
 rmdir icons
 mv virtualbox.xml $RPM_BUILD_ROOT/usr/share/mime/packages
-for i in VBoxManage VBoxSVC VBoxSDL VirtualBox VBoxHeadless VBoxExtPackHelperApp VBoxBalloonCtrl VBoxAutostart; do
+for i in VBoxManage VBoxSVC VBoxSDL VirtualBox VBoxHeadless VBoxDTrace VBoxExtPackHelperApp VBoxBalloonCtrl VBoxAutostart vbox-img; do
   mv $i $RPM_BUILD_ROOT/usr/lib/virtualbox; done
 if %WEBSVC%; then
   for i in vboxwebsrv webtest; do
@@ -189,11 +189,14 @@ ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxsdl
 ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxVRDP
 ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxHeadless
 ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxheadless
+ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxDTrace
+ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxdtrace
 ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxBalloonCtrl
 ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxballoonctrl
 ln -s VBox $RPM_BUILD_ROOT/usr/bin/VBoxAutostart
 ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxautostart
 ln -s VBox $RPM_BUILD_ROOT/usr/bin/vboxwebsrv
+ln -s /usr/lib/virtualbox/vbox-img $RPM_BUILD_ROOT/usr/bin/vbox-img
 ln -s /usr/share/virtualbox/src/vboxhost $RPM_BUILD_ROOT/usr/src/vboxhost-%VER%
 mv virtualbox.desktop $RPM_BUILD_ROOT/usr/share/applications/virtualbox.desktop
 mv VBox.png $RPM_BUILD_ROOT/usr/share/pixmaps/VBox.png
diff --git a/src/VBox/Installer/linux/rpm/rules b/src/VBox/Installer/linux/rpm/rules
index 3a60467..e6477f8 100755
--- a/src/VBox/Installer/linux/rpm/rules
+++ b/src/VBox/Installer/linux/rpm/rules
@@ -52,7 +52,7 @@ ifeq ($(shell if grep -q '^%disttag' /usr/lib/rpm/macros.d/mandriva 2>/dev/null;
 $(error Fix /usr/lib/rpm/macros.d/mandriva)
 endif
 
-verpkg   := VirtualBox-4.3
+verpkg   := VirtualBox-5.0
 current  := $(shell pwd)
 vboxroot := $(shell cd ../../../..; pwd)
 pkgdir   := $(if $(PKGDIR),$(PKGDIR),$(shell cd ../../../../..; pwd))
diff --git a/src/VBox/Installer/linux/scripts/install.sh b/src/VBox/Installer/linux/scripts/install.sh
index 576eb4e..f3e565e 100755
--- a/src/VBox/Installer/linux/scripts/install.sh
+++ b/src/VBox/Installer/linux/scripts/install.sh
@@ -142,6 +142,9 @@ while test "${#}" -gt 0; do
     --no-helpers)
         NO_HELPERS="true"
         ;;
+    --no-vbox-img)
+        NO_VBOX_IMG="true"
+        ;;
     --python-command)
         test "${#}" -gt 1 ||
         {
@@ -219,8 +222,12 @@ test -n "${NO_QT}" &&
     test ! -r "${INSTALL_SOURCE}/VirtualBox"
 test -n "${NO_WEB_SERVICE}" &&
     test ! -r "${INSTALL_SOURCE}/vboxwebsrv"
+test -n "${NO_VBOX_IMG}" &&
+    test ! -r "${INSTALL_SOURCE}/vbox-img"
 test -n "${NO_WEB_SERVICE}" &&
     test ! -r "${INSTALL_SOURCE}/webtest"
+test -r "${INSTALL_SOURCE}/VBoxDTrace" &&
+    mv "${INSTALL_SOURCE}/VBoxDTrace" "${PREFIX}/bin"
 mv "${INSTALL_SOURCE}/VBoxTunctl" "${PREFIX}/bin"
 test -n "${OSE}" || test -n "${NO_QT}" &&
     test ! -r ${INSTALL_SOURCE}/kchmviewer
@@ -257,6 +264,8 @@ ln -sf "VBox" "${PREFIX}/bin/vboxballoonctrl"
 ln -s "VBox" "${PREFIX}/bin/VBoxAutostart"
 ln -s "VBox" "${PREFIX}/bin/vboxautostart"
 test -z "${NO_WEB_SERVICE}" && ln -s "VBox" "${PREFIX}/bin/vboxwebsrv"
+echo "NO_VBOX_IMG = ${NO_VBOX_IMG}"
+test -z "${NO_VBOX_IMG}" && ln -sv "${RELATIVE_PREFIX}${INSTALL_FOLDER}/vbox-img" "${PREFIX}/bin/vbox-img"
 rmdir ${INSTALL_SOURCE}/additions
 rm "${INSTALL_SOURCE}/scripts/install.sh"
 ## @todo Move this to a make file.
diff --git a/src/VBox/Installer/linux/testcase/tstInstallInit.sh b/src/VBox/Installer/linux/testcase/tstInstallInit.sh
index 9c6c1ba..f90a512 100755
--- a/src/VBox/Installer/linux/testcase/tstInstallInit.sh
+++ b/src/VBox/Installer/linux/testcase/tstInstallInit.sh
@@ -19,7 +19,7 @@
 # This will initially be a skeleton with a couple of tests - add more for quick
 # debugging when you suspect that something isn't working as specified.
 
-tab="	"
+tab="   "
 tmpbase="/tmp/tstInstallInit 99"  # Space in the name for a little stress...
 if [ -n "${TESTBOX_PATH_SCRATCH}" ]; then
     tmpbase="${TESTBOX_PATH_SCRATCH}/tstInstallInit 99"
diff --git a/src/VBox/Installer/linux/uninstall.sh b/src/VBox/Installer/linux/uninstall.sh
index b479b19..b3517cd 100755
--- a/src/VBox/Installer/linux/uninstall.sh
+++ b/src/VBox/Installer/linux/uninstall.sh
@@ -97,11 +97,13 @@ rm -f \
   /usr/bin/VBoxSDL \
   /usr/bin/VBoxVRDP \
   /usr/bin/VBoxHeadless \
+  /usr/bin/VBoxDTrace \
   /usr/bin/VBoxBalloonCtrl \
   /usr/bin/VBoxAutostart \
   /usr/bin/VBoxNetDHCP \
   /usr/bin/VBoxNetNAT \
   /usr/bin/vboxwebsrv \
+  /usr/bin/vbox-img \
   /usr/bin/VBoxAddIF \
   /usr/bin/VBoxDeleteIf \
   /usr/bin/VBoxTunctl \
@@ -115,6 +117,7 @@ rm -f \
   /usr/bin/vboxmanage \
   /usr/bin/vboxsdl \
   /usr/bin/vboxheadless \
+  /usr/bin/vboxdtrace \
   $PREV_INSTALLATION/components/VBoxVMM.so \
   $PREV_INSTALLATION/components/VBoxREM.so \
   $PREV_INSTALLATION/components/VBoxRT.so \
diff --git a/src/VBox/Installer/solaris/Makefile.kmk b/src/VBox/Installer/solaris/Makefile.kmk
index 11a3519..25233b1 100644
--- a/src/VBox/Installer/solaris/Makefile.kmk
+++ b/src/VBox/Installer/solaris/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2007-2013 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -22,108 +22,48 @@ ifneq ($(KBUILD_HOST),solaris)
 $(error "The Solaris installer can only be built on Solaris!") # yeah, right.
 endif
 
-# Unset this to speed up things during makefile hacking.
-VBOX_SOL_INST_DEP_ON_MAKEFILE := $(MAKEFILE_CURRENT)
 
 #
 # Globals
 #
-ifdef VBOX_WITH_COMBINED_SOLARIS_PACKAGE ## @todo remove this when tinderclient.pl is updated.
- VBOX_WITH_COMBINED_PACKAGE := 1
-endif
 VBOX_PATH_SOL_INST_SRC     := $(PATH_SUB_CURRENT)
-SOLARIS_DIR_NAME_64        := amd64
-SOLARIS_DIR_NAME_32        := i386
-SOLARIS_INST_OUT_DIR       := $(PATH_TARGET)/Installer
-SOLARIS_BASEINST_DIR       := $(PATH_TARGET)/Installer/BasePkg
-SOLARIS_VBOXINST_SUBDIR    := opt/VirtualBox
-SOLARIS_VBOXINST_DIR       := $(SOLARIS_BASEINST_DIR)/$(SOLARIS_VBOXINST_SUBDIR)
-SOLARIS_VBOXINST_DIR_32    := $(SOLARIS_VBOXINST_DIR)/$(SOLARIS_DIR_NAME_32)
-SOLARIS_VBOXINST_DIR_64    := $(SOLARIS_VBOXINST_DIR)/$(SOLARIS_DIR_NAME_64)
-SOLARIS_DRIVERINST_DIR     := $(SOLARIS_BASEINST_DIR)/platform/i86pc/kernel/drv
-SOLARIS_DRIVERINST_DIR_32  := $(SOLARIS_DRIVERINST_DIR)
-SOLARIS_DRIVERINST_DIR_64  := $(SOLARIS_DRIVERINST_DIR)/amd64
-SOLARIS_USR_DIR            := $(SOLARIS_BASEINST_DIR)/usr
-SOLARIS_USRBIN_DIR         := $(SOLARIS_USR_DIR)/bin
-SOLARIS_USRSHR_APPS_DIR    := $(SOLARIS_USR_DIR)/share/applications
-SOLARIS_USRSHR_APPREG_DIR  := $(SOLARIS_USR_DIR)/share/application-registry
-SOLARIS_USRSHR_MIMEXML_DIR := $(SOLARIS_USR_DIR)/share/mime/packages
-SOLARIS_USRSHR_MIMEINFO_DIR := $(SOLARIS_USR_DIR)/share/mime-info
-SOLARIS_USRSHR_ICONS_DIR   := $(SOLARIS_USR_DIR)/share/icons/hicolor
-SOLARIS_USRSHR_PIXMAPS_DIR := $(SOLARIS_USR_DIR)/share/pixmaps
-SOLARIS_VBOXSMF_DIR        := $(SOLARIS_BASEINST_DIR)/var/svc/manifest/application/virtualbox
-SOLARIS_ETC_DIR            := $(SOLARIS_BASEINST_DIR)/etc
-
-SOLARIS_OUT_BIN_64         := $(PATH_OUT_BASE)/solaris.amd64/$(KBUILD_TYPE)/bin
-SOLARIS_OUT_BIN_32         := $(PATH_OUT_BASE)/solaris.x86/$(KBUILD_TYPE)/bin
-SOLARIS_OUT_BIN            := $(PATH_STAGE_BIN)
-
-SOLARIS_DBG_DIR_NAME       := DebugPkg
-SOLARIS_DBG_DIR            := $(SOLARIS_INST_OUT_DIR)/$(SOLARIS_DBG_DIR_NAME)
-SOLARIS_DBG_DIR_32         := $(SOLARIS_DBG_DIR)/$(SOLARIS_DIR_NAME_32)
-SOLARIS_DBG_DIR_64         := $(SOLARIS_DBG_DIR)/$(SOLARIS_DIR_NAME_64)
-
+VBOX_PATH_SI_SCRATCH       := $(PATH_TARGET)/Installer-solaris
+VBOX_PATH_SI_SCRATCH_PKG   := $(PATH_TARGET)/Installer-solaris/pkg
+VBOX_PATH_SI_SCRATCH_DBG   := $(PATH_TARGET)/Installer-solaris/DebugPkg
+VBOX_SI_ARCH               := $(subst x86,i386,$(KBUILD_TARGET_ARCH))
+VBOX_SI_ICON_TYPES         := ova ovf vbox vbox-extpack vdi vmdk vhd hdd
+VBOX_SI_ICON_SIZES         := 16 20 24 32 48 64 72 96 128 256
+VBOX_SI_GTAR               := /usr/sfw/bin/gtar
+VBOX_SI_OBJCOPY_STRIP      := /usr/sfw/bin/gobjcopy --strip-debug -R .comment
 ifeq ($(KBUILD_TARGET_ARCH),amd64)
- SOLARIS_VBOXINST_DIR_ISA    := $(SOLARIS_VBOXINST_DIR_64)
- SOLARIS_DRIVERINST_DIR_ISA  := $(SOLARIS_DRIVERINST_DIR_64)
- SOLARIS_DBG_DIR_ISA         := $(SOLARIS_DBG_DIR_64)
- SOL_DBG_OBJCOPY             := /usr/sfw/bin/gobjcopy --only-keep-debug
- SOL64_PKG := 1
+ VBOX_SI_OBJCOPY_DBGINFO   := /usr/sfw/bin/gobjcopy --only-keep-debug
 else
- SOLARIS_VBOXINST_DIR_ISA    := $(SOLARIS_VBOXINST_DIR_32)
- SOLARIS_DRIVERINST_DIR_ISA  := $(SOLARIS_DRIVERINST_DIR_32)
- SOLARIS_DBG_DIR_ISA         := $(SOLARIS_DBG_DIR_32)
- SOL_DBG_OBJCOPY             := $(CP) -p    # Solaris ld/gobjcopy(2.15) don't get along on x86, works only on amd64. So just using cp for now.
+ VBOX_SI_OBJCOPY_DBGINFO   := $(CP) -p # Solaris ld/gobjcopy(2.15) don't get along on x86, works only on amd64. So just using cp for now.
 endif
-SOL_OBJCOPY                  := /usr/sfw/bin/gobjcopy --strip-debug -R .comment
-SOL_GTAR                     := /usr/sfw/bin/gtar
 
-# Figure out the paths to the two platform specific Qt4 directories
-SOLARIS_PATH_QT_32 = $(subst solaris.$(KBUILD_TARGET_ARCH),solaris.x86,$(VBOX_PATH_QT4))
-SOLARIS_PATH_QT_64 = $(subst solaris.$(KBUILD_TARGET_ARCH),solaris.amd64,$(VBOX_PATH_QT4))
+# Unset this to speed up things during makefile hacking.
+VBOX_SI_DEP_ON_MAKEFILE    := $(MAKEFILE_CURRENT)
 
-# Base package
-PKGINFO_ARCH     = $(shell uname -p)
-PKGINFO_REVSTAMP = $(date %Y.%m.%d.%H.%M)
-ifndef VBOX_WITH_COMBINED_PACKAGE
- PKG_FILENAME    = VirtualBox-$(VBOX_VERSION_STRING)-SunOS-$(KBUILD_TARGET_ARCH)-r$(VBOX_SVN_REV)
-else
- PKG_FILENAME    = VirtualBox-$(VBOX_VERSION_STRING)-SunOS-r$(VBOX_SVN_REV)
-endif
 
-# Debug package
-DBG_ARCHIVE      = VirtualBoxDebug.tar.bz2
+# Base package
+PKGINFO_ARCH      = $(shell uname -p)
+PKGINFO_REVSTAMP  = $(date %Y.%m.%d.%H.%M)
+PKG_FILENAME     := VirtualBox-$(VBOX_VERSION_STRING)-SunOS-$(KBUILD_TARGET_ARCH)-r$(VBOX_SVN_REV)
 
-# Kernel interface (vbi) package
-VBIPKG_FILENAME  = VirtualBoxKern-$(VBOX_VERSION_STRING)-SunOS-r$(VBOX_SVN_REV)
 
 #
 # Targets
 #
 PROGRAMS         += VBoxZoneAccess VBoxISAExec
 INSTALLS         += solaris-doc solaris-bin solaris-drv-confs solaris-icons
-
-BLDDIRS          += \
-	$(SOLARIS_INST_OUT_DIR) \
-	$(SOLARIS_BASEINST_DIR) \
-	$(SOLARIS_VBOXINST_DIR) \
-	$(SOLARIS_DBG_DIR)
-
-BLDDIRS          += $(addprefix $(SOLARIS_BASEINST_DIR)/,\
-	usr \
-	usr/bin \
-	platform \
-	platform/i86pc \
-	platform/i86pc/kernel \
-	platform/i86pc/kernel/drv \
-	platform/i86pc/kernel/drv/amd64 \
-)
-
-PACKING          += $(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz $(PATH_STAGE_BIN)/$(DBG_ARCHIVE)
-
-OTHER_CLEAN      += $(addprefix $(SOLARIS_BASEINST_DIR)/,\
-	vbox.pkginfo vbox.copyright vbox.space vbox.depend vbox.pkgresponse \
-	makepackage.sh prototype postinstall.sh checkinstall.sh preremove.sh)
+BLDDIRS          += $(VBOX_PATH_SI_SCRATCH)
+PACKING          += \
+	$(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz \
+	$(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2
+OTHER_CLEAN      += \
+	$(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg \
+	$(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz \
+	$(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2
 
 #
 # VBoxZoneAccess
@@ -173,49 +113,109 @@ solaris-drv-confs_SOURCES = \
 
 solaris-icons_INST = bin/icons/
 solaris-icons_MODE = a+r,u+w
-solaris-icons_SOURCES = $(VBOX_MIME_ICONS)
-
-BLDDIRS += \
-	$(SOLARIS_USR_DIR)/share \
-	$(SOLARIS_USR_DIR)/share/icons \
-	$(SOLARIS_USRSHR_ICONS_DIR) \
-    $(foreach s,16 20 24 32 48 64 72 96 128 256,\
-	    $(SOLARIS_USRSHR_ICONS_DIR)/$(s)x$(s) \
-	    $(SOLARIS_USRSHR_ICONS_DIR)/$(s)x$(s)/mimetypes)
-
-VBOX_MIME_ICONS = \
-	$(addprefix $(PATH_ROOT)/src/VBox/Resources/other/,\
-	    $(foreach f,ova ovf vbox vbox-extpack vdi vmdk vhd hdd, \
-	        $(foreach s,16 20 24 32 48 64 72 96 128 256,\
-	            virtualbox-$(f)-$(s)px.png=>$(s)x$(s)/mimetypes/virtualbox-$(f).png)))
-
-SOLARIS_COMMON_ICONS = \
-	$(foreach f,ova ovf vbox vbox-extpack vdi vmdk vhd hdd, \
-	    $(foreach s,16 20 24 32 48 64 72 96 128 256,\
-	        $(s)x$(s)/mimetypes/virtualbox-$(f).png))
-
-
-#
-# Note: Other than the files produced during packing (.pkg, .gzip etc.) all files that
-# go into the temporary install folder $(SOLARIS_VBOXINST_DIR) should be part of $(SOLARIS_ARCH_FILES).
-# For the files produced during packing they should be cleaned up promptly when the work is done.
-#
-
-# Strip these executables
-SOLARIS_STRIP_EXES = \
-	VBoxZoneAccess \
-	$(if $(VBOX_WITH_QTGUI),VirtualBox,) \
-	VBoxManage \
-	$(if $(VBOX_WITH_VBOXSDL),VBoxSDL,) \
-	$(if $(VBOX_WITH_NETADP),VBoxNetAdpCtl,) \
-	VBoxNetDHCP \
-	VBoxNetNAT \
-	$(if $(VBOX_WITH_EXTPACK),VBoxExtPackHelperApp,) \
-	VBoxSVC \
-	$(if $(VBOX_WITH_CROGL),VBoxTestOGL,) \
-	VBoxXPCOMIPCD \
-	$(if $(VBOX_WITH_KCHMVIEWER),kchmviewer,)
-
+solaris-icons_SOURCES = $(foreach f,$(VBOX_SI_ICON_TYPES), $(foreach s,$(VBOX_SI_ICON_SIZES)\
+	,$(PATH_ROOT)/src/VBox/Resources/other/virtualbox-$(f)-$(s)px.png=>$(s)x$(s)/mimetypes/virtualbox-$(f).png))
+
+
+#
+# What follows is various files lists (and a symlink list) that lists various
+# types of files going from/to various places during installation.
+#
+# Each list has the following attributes (used by makefile command and
+# depency generation):
+#       .SUBDIRS := <yes|no>
+#       .STRIP   := <yes|objcopy|no>
+#       .MODE    := <0644|0755>
+#       .SRC     := <Directory to copy the files from>
+#       .DST     := <Directory to copy the files to>
+#
+
+
+## List of file list variable names.
+SOLARIS_FILE_LIST_VARS :=
+
+## @def SOLARIS_ETC_FILES
+# Service management facility manifest files to copy from VBOX_PATH_SOL_INST_SRC to /var/svc/manifest/application/virtualbox/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_ETC_FILES
+SOLARIS_ETC_FILES.SUBDIRS := yes
+SOLARIS_ETC_FILES.STRIP   := no
+SOLARIS_ETC_FILES.MODE    := 0644
+SOLARIS_ETC_FILES.SRC     := $(PATH_ROOT)/src/VBox/HostDrivers/VBoxNetAdp/solaris
+SOLARIS_ETC_FILES.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/etc
+SOLARIS_ETC_FILES := $(if-expr defined(VBOX_WITH_NETADP),hostname.vboxnet0,)
+
+## @def SOLARIS_SMF_FILES
+# Service management facility manifest files to copy from VBOX_PATH_SOL_INST_SRC to /var/svc/manifest/application/virtualbox/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_SMF_FILES
+SOLARIS_SMF_FILES.SUBDIRS := yes
+SOLARIS_SMF_FILES.STRIP   := no
+SOLARIS_SMF_FILES.MODE    := 0644
+SOLARIS_SMF_FILES.SRC     := $(VBOX_PATH_SOL_INST_SRC)
+SOLARIS_SMF_FILES.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/var/svc/manifest/application/virtualbox
+SOLARIS_SMF_FILES = \
+	virtualbox-zoneaccess.xml \
+	virtualbox-balloonctrl.xml \
+	virtualbox-autostart.xml \
+	$(if-expr defined(VBOX_WITH_WEBSERVICES),virtualbox-webservice.xml,)
+
+## @def SOLARIS_MIME_INFO_FILES
+# MIME info files to be copied directly from VBOX_PATH_SOL_INST_SRC to /usr/share/mime-info/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_MIME_INFO_FILES
+SOLARIS_MIME_INFO_FILES.SUBDIRS := yes
+SOLARIS_MIME_INFO_FILES.STRIP   := no
+SOLARIS_MIME_INFO_FILES.MODE    := 0644
+SOLARIS_MIME_INFO_FILES.SRC     := $(VBOX_PATH_SOL_INST_SRC)
+SOLARIS_MIME_INFO_FILES.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime-info
+SOLARIS_MIME_INFO_FILES = \
+	virtualbox.keys \
+	virtualbox.mime
+
+## @def SOLARIS_PIXMAP_FILES
+# Bitmap files to copy directly from INST_BIN to /usr/share/pixmaps/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_PIXMAP_FILES
+SOLARIS_PIXMAP_FILES.SUBDIRS = no
+SOLARIS_PIXMAP_FILES.STRIP   = no
+SOLARIS_PIXMAP_FILES.MODE    = 0644
+SOLARIS_PIXMAP_FILES.SRC     = $(PATH_STAGE_BIN)
+SOLARIS_PIXMAP_FILES.DST     = $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/pixmaps
+SOLARIS_PIXMAP_FILES = \
+	VBox.png \
+	virtualbox.png
+
+
+## @def SOLARIS_INSTALLER_SCRIPTS
+# Installer shell scripts that gets copied directly from VBOX_PATH_SOL_INST_SRC to VBOX_PATH_SI_SCRATCH_PKG (/).
+SOLARIS_FILE_LIST_VARS += SOLARIS_INSTALLER_SCRIPTS
+SOLARIS_INSTALLER_SCRIPTS.SUBDIRS = no
+SOLARIS_INSTALLER_SCRIPTS.STRIP   = no
+SOLARIS_INSTALLER_SCRIPTS.MODE    = 0755
+SOLARIS_INSTALLER_SCRIPTS.SRC     = $(VBOX_PATH_SOL_INST_SRC)
+SOLARIS_INSTALLER_SCRIPTS.DST     = $(VBOX_PATH_SI_SCRATCH_PKG)
+SOLARIS_INSTALLER_SCRIPTS = \
+	postinstall.sh \
+	checkinstall.sh \
+	preremove.sh \
+	makepackage.sh
+
+## @def SOLARIS_INSTALLER_FILES
+# Installer files that gets copied directly from VBOX_PATH_SOL_INST_SRC to VBOX_PATH_SI_SCRATCH_PKG (/).
+SOLARIS_FILE_LIST_VARS += SOLARIS_INSTALLER_FILES
+SOLARIS_INSTALLER_FILES.SUBDIRS = no
+SOLARIS_INSTALLER_FILES.STRIP   = no
+SOLARIS_INSTALLER_FILES.MODE    = 0644
+SOLARIS_INSTALLER_FILES.SRC     = $(VBOX_PATH_SOL_INST_SRC)
+SOLARIS_INSTALLER_FILES.DST     = $(VBOX_PATH_SI_SCRATCH_PKG)
+SOLARIS_INSTALLER_FILES = \
+	vbox.space
+
+## @def SOLARIS_DRIVER_BINS
+# List of kernel module files that are copied from INST_BIN to platform/i86pc/kernel/drv/[amd64/] and stripped of debug info.
+SOLARIS_FILE_LIST_VARS += SOLARIS_DRIVER_BINS
+SOLARIS_DRIVER_BINS.SUBDIRS := no
+SOLARIS_DRIVER_BINS.STRIP   := yes
+SOLARIS_DRIVER_BINS.MODE    := 0644
+SOLARIS_DRIVER_BINS.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_DRIVER_BINS.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/kernel/drv/$(subst x86,,$(KBUILD_TARGET_ARCH))
 SOLARIS_DRIVER_BINS = \
 	vboxdrv \
 	$(if $(VBOX_WITH_NETFLT),vboxflt,) \
@@ -224,6 +224,14 @@ SOLARIS_DRIVER_BINS = \
 	$(if $(VBOX_WITH_USB),vboxusbmon,) \
 	$(if $(VBOX_WITH_USB),vboxusb,)
 
+## @def SOLARIS_DRIVER_CONFS
+# List of kernel module configuration files that are copied directly from INST_BIN to platform/i86pc/kernel/drv/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_DRIVER_CONFS
+SOLARIS_DRIVER_CONFS.SUBDIRS := no
+SOLARIS_DRIVER_CONFS.STRIP   := no
+SOLARIS_DRIVER_CONFS.MODE    := 0644
+SOLARIS_DRIVER_CONFS.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_DRIVER_CONFS.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/kernel/drv
 SOLARIS_DRIVER_CONFS = \
 	vboxdrv.conf \
 	$(if $(VBOX_WITH_NETFLT),vboxflt.conf,) \
@@ -232,11 +240,84 @@ SOLARIS_DRIVER_CONFS = \
 	$(if $(VBOX_WITH_USB),vboxusbmon.conf,) \
 	$(if $(VBOX_WITH_USB),vboxusb.conf,)
 
-# Strip these binaries
+## @def SOLARIS_COMMON
+# List of files that are copied directly from INST_BIN to /opt/VirtualBox/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_COMMON
+SOLARIS_COMMON.SUBDIRS := yes
+SOLARIS_COMMON.STRIP   := no
+SOLARIS_COMMON.MODE    := 0644
+SOLARIS_COMMON.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_COMMON.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox
+SOLARIS_COMMON = \
+	LICENSE
+## @def SOLARIS_COMMON_EXES
+# List of executable script (and VBoxISAExec) files that are copied directly from INST_BIN to /opt/VirtualBox/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_COMMON_EXES
+SOLARIS_COMMON_EXES.SUBDIRS := no
+SOLARIS_COMMON_EXES.STRIP   := no
+SOLARIS_COMMON_EXES.MODE    := 0755
+SOLARIS_COMMON_EXES.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_COMMON_EXES.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox
+SOLARIS_COMMON_EXES = \
+	VBoxISAExec
+
+## @def SOLARIS_COMMON_BINS
+# List of INST_BIN shared libraries that should be copied into /opt/VirtualBox/ and stripped.
+SOLARIS_FILE_LIST_VARS += SOLARIS_COMMON_STRIP_BINS
+SOLARIS_COMMON_STRIP_BINS.SUBDIRS := yes
+SOLARIS_COMMON_STRIP_BINS.STRIP   := no
+SOLARIS_COMMON_STRIP_BINS.MODE    := 0644
+SOLARIS_COMMON_STRIP_BINS.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_COMMON_STRIP_BINS.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/
+SOLARIS_COMMON_STRIP_BINS =
+
+## @def SOLARIS_COMMON_64_STRIP_BINS
+# List of INST_BIN shared libraries that should be copied into /opt/VirtualBox/64/ and stripped.
+SOLARIS_FILE_LIST_VARS += SOLARIS_COMMON_64_STRIP_BINS
+SOLARIS_COMMON_64_STRIP_BINS.SUBDIRS := yes
+SOLARIS_COMMON_64_STRIP_BINS.STRIP   := yes
+SOLARIS_COMMON_64_STRIP_BINS.MODE    := 0644
+SOLARIS_COMMON_64_STRIP_BINS.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_COMMON_64_STRIP_BINS.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/64
+SOLARIS_COMMON_64_STRIP_BINS =
+
+
+## @def SOLARIS_STRIP_EXES
+# List of exectuables files that are copied from INST_BIN to /opt/VirtualBox/$(VBOX_SI_ARCH)/ and stripped of debug info.
+SOLARIS_FILE_LIST_VARS += SOLARIS_STRIP_EXES
+SOLARIS_STRIP_EXES.SUBDIRS := no
+SOLARIS_STRIP_EXES.STRIP   := yes
+SOLARIS_STRIP_EXES.MODE    := 0755
+SOLARIS_STRIP_EXES.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_STRIP_EXES.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
+SOLARIS_STRIP_EXES = \
+	VBoxZoneAccess \
+	$(if $(VBOX_WITH_QTGUI),VirtualBox,) \
+	VBoxManage \
+	$(if $(VBOX_WITH_VBOXSDL),VBoxSDL,) \
+	$(if $(VBOX_WITH_NETADP),VBoxNetAdpCtl,) \
+	VBoxNetDHCP \
+	VBoxNetNAT \
+	$(if $(VBOX_WITH_EXTPACK),VBoxExtPackHelperApp,) \
+	VBoxSVC \
+	$(if $(VBOX_WITH_CROGL),VBoxTestOGL,) \
+	VBoxXPCOMIPCD \
+	$(if $(VBOX_WITH_KCHMVIEWER),kchmviewer,) \
+       $(if $(VBOX_WITH_DTRACE),VBoxDTrace,)
+
+## @def SOLARIS_STRIP_BINS
+# List of shared libraries that are copied from INST_BIN to /opt/VirtualBox/$(VBOX_SI_ARCH)/ and stripped of debug info.
+SOLARIS_FILE_LIST_VARS += SOLARIS_STRIP_BINS
+SOLARIS_STRIP_BINS.SUBDIRS := yes
+SOLARIS_STRIP_BINS.STRIP   := yes
+SOLARIS_STRIP_BINS.MODE    := 0644
+SOLARIS_STRIP_BINS.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_STRIP_BINS.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
 SOLARIS_STRIP_BINS = \
 	VBoxDD.so \
 	VBoxDD2.so \
 	VBoxREM.so \
+	$(if-expr "$(KBUILD_TARGET_ARCH)" == "x86",VBoxREM32.so VBoxREM64.so,) \
 	VBoxRT.so \
 	VBoxDDU.so \
 	VBoxVMM.so \
@@ -257,7 +338,7 @@ SOLARIS_STRIP_BINS = \
 	    libQtNetworkVBox.so.4 \
 	    $(if $(VBOX_GUI_USE_QGL),libQtOpenGLVBox.so.4,) \
 	    accessible/libqtaccessiblewidgets.so,)) \
-	$(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so,) \
+	$(if $(VBOX_WITH_DEBUGGER_GUI),VBoxDbg.so DbgPlugInDiggers.so,) \
 	$(if $(VBOX_WITH_CROGL),\
 	  VBoxOGLhostcrutil.so \
 	  VBoxOGLhosterrorspu.so \
@@ -282,7 +363,15 @@ ifdef VBOX_WITH_HARDENING
 	$(if $(VBOX_WITH_QTGUI),VirtualBox.so,)
 endif
 
-# Do not remove relocation information of these binaries
+## @def SOLARIS_STRIP_OBJS
+# List of relocable object files to be copied from INST_BIN to /opt/VirtualBox/$(VBOX_SI_ARCH)/ and carefully
+# stripped of debug info but not relocation information.  These are the ring-0 and raw-mode context modules.
+SOLARIS_FILE_LIST_VARS += SOLARIS_STRIP_OBJS
+SOLARIS_STRIP_OBJS.SUBDIRS := no
+SOLARIS_STRIP_OBJS.STRIP   := objcopy
+SOLARIS_STRIP_OBJS.MODE    := 0644
+SOLARIS_STRIP_OBJS.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_STRIP_OBJS.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
 SOLARIS_STRIP_OBJS = \
 	VBoxDD2GC.gc \
 	VBoxDD2R0.r0 \
@@ -291,26 +380,30 @@ SOLARIS_STRIP_OBJS = \
 	VMMGC.gc \
 	VMMR0.r0
 
-# Special differences between 32-bit and 64-bit
-SOLARIS_STRIP_BIN_32 = \
-	VBoxREM32.so \
-	VBoxREM64.so
-
-VBOX_SOL_PYTHON_DIR_64 = 64
-
-# Do not strip anything of these files
+## @def SOLARIS_NO_STRIP
+# List of data files that should be copied from INST_BIN to /opt/VirtualBox/$(VBOX_SI_ARCH)/.
+SOLARIS_FILE_LIST_VARS += SOLARIS_NO_STRIP
+SOLARIS_NO_STRIP.SUBDIRS := yes
+SOLARIS_NO_STRIP.STRIP   := no
+SOLARIS_NO_STRIP.MODE    := 0644
+SOLARIS_NO_STRIP.SRC     := $(PATH_STAGE_BIN)
+SOLARIS_NO_STRIP.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
 SOLARIS_NO_STRIP = \
 	components/VBoxXPCOMBase.xpt \
 	components/VirtualBox_XPCOM.xpt \
 	$(if $(and $(VBOX_LICENSE_FILES),$(VBOX_WITH_QTGUI)),$(VBOX_LICENSE_FILES))
 
+## @def SOLARIS_USRBIN_LINKS
+# List of links to create in /usr/bin to /opt/VirtualBox/VBox.sh.
+# Naturally no subdirectories.
 SOLARIS_USRBIN_LINKS = \
 	$(if $(VBOX_WITH_QTGUI),VirtualBox,) \
 	$(if $(VBOX_WITH_HEADLESS),VBoxHeadless,) \
 	$(if $(VBOX_WITH_VBOXSDL),VBoxSDL,) \
-	VBoxManage
+	VBoxManage \
+	$(if $(VBOX_WITH_DTRACE),VBoxDTrace,)
 
-SOLARIS_COMMON_EXES = \
+SOLARIS_COMMON_EXES += \
 	vboxconfig.sh \
 	VBox.sh \
 	pkginstall.sh \
@@ -319,38 +412,28 @@ SOLARIS_COMMON_EXES = \
 	smf-vboxautostart.sh \
 	$(if $(VBOX_WITH_WEBSERVICES),smf-vboxwebsrv.sh,)
 
-# Things packed explicitly, not from $(PATH_STAGE_BIN), track these to clean-up properly
-SOLARIS_EXTRAS = \
-	LICENSE \
-	VBox.png \
-	virtualbox.png \
-	autoresponse \
-	$(if $(VBOX_WITH_VBOXSDL),libSDL-1.2.so.0,) \
-	$(if $(not $(VBOX_WITH_NETFLT))vnic_setup.sh,) \
-	$(if $(not $(VBOX_WITH_NETFLT))vnic_term.sh,) \
-	$(if $(VBOX_WITH_QTGUI),virtualbox.desktop,) \
-	virtualbox.xml \
-	virtualbox-balloonctrl.xml \
-	virtualbox-webservice.xml \
-	virtualbox-zoneaccess.xml \
-	VBoxQtconfig \
-	VBoxISAExec \
-	vbox.copyright \
-	ReadMe.txt
 
-# These extra Qt libs are purely for running VBoxQtconfig
+## @def SOLARIS_QTLIBS
+# List of Qt shared libs that we need to copy from $(VBOX_PATH_QT4)/lib/ to /opt/VirtualBox/$(VBOX_SI_ARCH)/
+# so that we can run VBoxQtConfig.
+SOLARIS_FILE_LIST_VARS += SOLARIS_QTLIBS
+SOLARIS_QTLIBS.SUBDIRS := no
+SOLARIS_QTLIBS.STRIP   := no
+SOLARIS_QTLIBS.MODE    := 0644
+SOLARIS_QTLIBS.SRC     := $(VBOX_PATH_QT4)/lib
+SOLARIS_QTLIBS.DST     := $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)
+SOLARIS_QTLIBS =
 ifdef VBOX_WITH_QTGUI
- SOLARIS_QTLIBS = \
-	$(if $(VBOX_WITH_QT4_SUN),\
-	  libQtXmlVBox.so.4 \
-	  libQtSqlVBox.so.4 \
-	  libQt3SupportVBox.so.4,)
-
+ ifdef VBOX_WITH_QT4_SUN
+  SOLARIS_QTLIBS += \
+  	libQtXmlVBox.so.4 \
+  	libQtSqlVBox.so.4 \
+  	libQt3SupportVBox.so.4
+  SOLARIS_USRBIN_LINKS += \
+	VBoxQtconfig
+ endif
  include $(PATH_ROOT)/src/VBox/Frontends/VirtualBox/nls/ApprovedLanguages.kmk
- SOLARIS_COMMON = $(foreach f,$(VBOX_APPROVED_GUI_LANGUAGES),nls/VirtualBox_$(f).qm nls/qt_$(f).qm)
-else
- SOLARIS_QTLIBS =
- SOLARIS_COMMON =
+ SOLARIS_COMMON += $(foreach f,$(VBOX_APPROVED_GUI_LANGUAGES),nls/VirtualBox_$(f).qm nls/qt_$(f).qm)
 endif
 
 # Documentation (packed as DOCS as they are arch. neutral)
@@ -363,27 +446,26 @@ endif
 
 # Python XPCOM glue
 ifdef VBOX_WITH_PYTHON
-  SOLARIS_COMMON += \
-	$(foreach f,$(notdir $(wildcard $(PATH_STAGE_BIN)/sdk/bindings/xpcom/python/xpcom/*.py)),sdk/bindings/xpcom/python/xpcom/$(f)) \
-	sdk/bindings/xpcom/python/xpcom/client/__init__.py \
-	sdk/bindings/xpcom/python/xpcom/server/__init__.py \
-	sdk/bindings/xpcom/python/xpcom/server/enumerator.py \
-	sdk/bindings/xpcom/python/xpcom/server/factory.py \
-	sdk/bindings/xpcom/python/xpcom/server/loader.py \
-	sdk/bindings/xpcom/python/xpcom/server/module.py \
-	sdk/bindings/xpcom/python/xpcom/server/policy.py \
-	sdk/installer/vboxapisetup.py \
-	sdk/installer/vboxapi/__init__.py \
-	sdk/installer/vboxapi/VirtualBox_constants.py
+ SOLARIS_COMMON += \
+	$(VBOXINST_SDK_BINDINGS_XPCOM_PYTHON_FILES) \
+	$(VBOXINST_SDK_INSTALLER_PYTHON_FILES)
+ ifeq ($(KBUILD_TARGET_ARCH),amd64)
+  ifdef VBOX_WITH_32_ON_64_MAIN_API
+   SOLARIS_COMMON_STRIP_BINS   += VBoxPython2_6_x86.so
+  endif
+  SOLARIS_COMMON_64_STRIP_BINS += VBoxPython.so VBoxPython2_6.so
+ else
+  SOLARIS_COMMON_STRIP_BINS    += VBoxPython.so VBoxPython2_6.so
+ endif
 endif
 
 ifdef VBOX_WITH_JXPCOM
-   SOLARIS_COMMON += \
-         sdk/bindings/xpcom/java/vboxjxpcom.jar
+ SOLARIS_COMMON += \
+ 	sdk/bindings/xpcom/java/vboxjxpcom.jar
 endif
 
 # auth stuff
- SOLARIS_STRIP_BINS += \
+SOLARIS_STRIP_BINS += \
 	VBoxAuth.so \
 	VBoxAuthSimple.so
 
@@ -396,7 +478,7 @@ ifdef VBOX_WITH_VRDP
  SOLARIS_COMMON += \
  	rdesktop-vrdp.tar.gz
  ifdef VBOX_WITH_VRDP_RDESKTOP
-  SOLARIS_COMMON += $(addprefix rdesktop-vrdp-keymaps/,$(notdir $(wildcard $(SOLARIS_OUT_BIN)/rdesktop-vrdp-keymaps/*)))
+  SOLARIS_COMMON += $(addprefix rdesktop-vrdp-keymaps/,$(notdir $(wildcard $(PATH_STAGE_BIN)/rdesktop-vrdp-keymaps/*)))
   SOLARIS_STRIP_EXES += \
   	rdesktop-vrdp
  endif
@@ -410,12 +492,13 @@ SOLARIS_STRIP_EXES += \
 	VBoxBalloonCtrl \
 	VBoxAutostart \
 	$(if $(VBOX_WITH_WEBSERVICES),vboxwebsrv) \
-	$(if $(VBOX_WITH_WEBSERVICES),webtest)
+	$(if $(VBOX_WITH_WEBSERVICES),webtest) \
+	$(if $(VBOX_WITH_VBOX_IMG)$(VBOX_WITH_TESTCASES),vbox-img)
 
 # Guest Additions
 ifdef VBOX_WITH_ADDITIONS_PACKING
- SOLARIS_COMMON += \
-	additions/VBoxGuestAdditions.iso
+# SOLARIS_COMMON += \
+#	additions/VBoxGuestAdditions.iso
 endif
 
 
@@ -426,420 +509,225 @@ ifdef VBOX_WITH_EFIFW_PACKING
 	VBoxEFI64.fd
 endif
 
-SOLARIS_ARCH_FILES := \
-	$(SOLARIS_STRIP_EXES) \
-	$(SOLARIS_DRIVER_BINS) \
-	$(SOLARIS_DRIVER_CONFS) \
-	$(SOLARIS_USRBIN_LINKS) \
-	$(SOLARIS_STRIP_BINS) \
-	$(SOLARIS_STRIP_OBJS) \
-	$(SOLARIS_NO_STRIP) \
-	$(SOLARIS_EXTRAS) \
-	$(SOLARIS_QTLIBS) \
-	$(SOLARIS_COMMON_EXES) \
-	$(SOLARIS_COMMON)
-
-SOLARIS_DBG_FILES := \
-	$(SOLARIS_STRIP_EXES) \
-	$(SOLARIS_STRIP_BINS) \
-	$(SOLARIS_DRIVER_BINS)
-
-OTHER_CLEAN += \
-	$(addprefix $(SOLARIS_VBOXINST_DIR)/, $(SOLARIS_ARCH_FILES)) \
-	$(SOLARIS_BASEINST_DIR)/$(PKG_FILENAME).tar.gz \
-	$(SOLARIS_BASEINST_DIR)/$(PKG_FILENAME).pkg \
-	$(addprefix $(SOLARIS_DBG_DIR)/,$(SOLARIS_STRIP_BINS)) \
-	$(addprefix $(SOLARIS_DBG_DIR)/,$(SOLARIS_DRIVER_BINS)) \
-	$(addprefix $(SOLARIS_DBG_DIR)/,$(SOLARIS_STRIP_EXES)) \
-	$(SOLARIS_DBG_DIR)/$(DBG_ARCHIVE)
-
-ifdef VBOX_WITH_COMBINED_PACKAGE
- SOLARIS_ARCH_DEPFILES = $(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_STRIP_EXES)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_STRIP_BINS)) \
-	$(addprefix $(SOLARIS_DRIVERINST_DIR_64)/,$(SOLARIS_DRIVER_BINS)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_STRIP_OBJS)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_NO_STRIP)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_QTLIBS)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_STRIP_EXES)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_STRIP_BINS)) \
-	$(addprefix $(SOLARIS_DRIVERINST_DIR_32)/,$(SOLARIS_DRIVER_BINS)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_STRIP_OBJS)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_NO_STRIP)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_QTLIBS)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_STRIP_BIN_32)) \
-	$(wildcard $(addprefix $(SOLARIS_OUT_BIN_32)/,VBoxPython*.so)) \
-	$(wildcard $(addprefix $(SOLARIS_OUT_BIN_64)/,VBoxPython*.so))
- SOLARIS_DBG_DEPFILES = $(addprefix $(SOLARIS_DBG_DIR_64)/,$(SOLARIS_DBG_FILES)) \
-	$(addprefix $(SOLARIS_DBG_DIR_32)/,$(SOLARIS_DBG_FILES))
-else
- SOLARIS_ARCH_DEPFILES = $(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_STRIP_EXES)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_STRIP_BINS)) \
-	$(addprefix $(SOLARIS_DRIVERINST_DIR_ISA)/,$(SOLARIS_DRIVER_BINS)) \
-	$(addprefix $(SOLARIS_DRIVERINST_DIR)/,$(SOLARIS_DRIVER_CONFS)) \
-	$(ifeq ($(KBUILD_TARGET_ARCH),x86),$(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_STRIP_BIN_32)),) \
-	$(ifeq ($(KBUILD_TARGET_ARCH),amd64),$(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_STRIP_OBJ_64)),) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_STRIP_OBJS)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_NO_STRIP)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR_ISA)/,$(SOLARIS_QTLIBS)) \
-	$(wildcard $(addprefix $(SOLARIS_OUT_BIN)/,VBoxPython*.so))
- SOLARIS_DBG_DEPFILES = $(addprefix $(SOLARIS_DBG_DIR_ISA)/,$(SOLARIS_DBG_FILES))
+# DTrace library, testcase and scripts (as the rest of this file, this makes bold
+# ASSUMPTIONS about VBPX_INST_XXX variable values).
+ifdef VBOX_WITH_DTRACE
+ SOLARIS_COMMON += \
+ 	$(addprefix dtrace/lib/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_LIB_ARCH_FILES)) \
+ 	$(addprefix dtrace/testcase/$(KBUILD_TARGET_ARCH)/,$(VBOXINST_DTRACE_TESTCASE_ARCH_FILES)) \
+ 	$(addprefix dtrace/scripts/,$(VBOXINST_DTRACE_SCRIPTS_FILES))
 endif
-SOLARIS_ARCH_DEPFILES += $(addprefix $(SOLARIS_VBOXINST_DIR)/,$(SOLARIS_COMMON)) \
-	$(addprefix $(SOLARIS_DRIVERINST_DIR)/,$(SOLARIS_DRIVER_CONFS)) \
-	$(addprefix $(SOLARIS_VBOXINST_DIR)/,$(SOLARIS_COMMON_EXES)) \
-	$(addprefix $(SOLARIS_USRBIN_DIR)/,$(SOLARIS_USRBIN_LINKS)) \
-	$(addprefix $(SOLARIS_USRSHR_ICONS_DIR)/,$(SOLARIS_COMMON_ICONS))
-
-BLDDIRS += $(foreach d,\
-	additions \
-	rdesktop-vrdp-keymaps \
-	nls \
-	$(SOLARIS_DIR_NAME_64) \
-	$(SOLARIS_DIR_NAME_64)/components \
-	$(SOLARIS_DIR_NAME_64)/accessible \
-	$(VBOX_SOL_PYTHON_DIR_64) \
-	$(SOLARIS_DIR_NAME_32) \
-	$(SOLARIS_DIR_NAME_32)/components \
-	$(SOLARIS_DIR_NAME_32)/accessible \
-	$(if $(VBOX_WITH_PYTHON),\
-	 sdk/ \
-	 sdk/installer \
-	 sdk/installer/vboxapi \
-	 sdk/bindings/xpcom/python/xpcom \
-	 sdk/bindings/xpcom/python/xpcom/server \
-	 sdk/bindings/xpcom/python/xpcom/client,) \
-	$(if $(VBOX_WITH_JXPCOM), \
-	 sdk/bindings/xpcom/java,) \
-,$(SOLARIS_VBOXINST_DIR)/$(d)/)
-
-BLDDIRS += $(foreach d,\
-	additions \
-	components \
-	accessible \
-	$(SOLARIS_DIR_NAME_64) \
-	$(SOLARIS_DIR_NAME_64)/components \
-	$(SOLARIS_DIR_NAME_64)/accessible \
-	$(VBOX_SOL_PYTHON_DIR_64) \
-	$(SOLARIS_DIR_NAME_32) \
-	$(SOLARIS_DIR_NAME_32)/components \
-	$(SOLARIS_DIR_NAME_32)/accessible \
-,$(SOLARIS_DBG_DIR)/$(d))
-
-# List of files to be tar.gz'd, the files will be
-# installed in $(SOLARIS_BASEINST_DIR) and .gz'd from there.
-SOLARIS_TAR_GZ_FILES := \
-	$(PKG_FILENAME).pkg \
-	LICENSE \
-	autoresponse \
-	ReadMe.txt
 
-include $(FILE_KBUILD_SUB_FOOTER)
 
 #
-# -=-=-=-=-=-=-=- Main package -=-=-=-=-=-=-=-
-#
-# !!WARNING!!  The current packing may NOT produce the expected rules in
-# !!WARNING!!  incremental build!  Removed and renamed components may
-# !!WARNING!!  appear in the package!  Always do clean builds for customers.
+# End of file lists.
 #
 
-## @todo r=bird: makepackage.sh packing a directory tree, right? So, there is no guarantee that it's not
-#                containing any obsolete files the way packing is performed here. Consider recursively
-#                invoking $(MAKE) vbox_copy_sdk_files (or similar) to do the copying after $(RM) -Rf the
-#                directory tree.
-$(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz: \
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
+#
+# Creates the System V style installer package.
+#
+solaris-package:: $(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg
+$(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg: \
 		$(VBOX_VERSION_STAMP) \
-		$(VBOX_PATH_SOL_INST_SRC)/makepackage.sh \
-		$(VBOX_PATH_SOL_INST_SRC)/postinstall.sh \
-		$(VBOX_PATH_SOL_INST_SRC)/checkinstall.sh \
-		$(VBOX_PATH_SOL_INST_SRC)/preremove.sh \
+		\
+		$(VBOX_PATH_INST_COMMON_SRC)/virtualbox.desktop.in \
+		$(VBOX_PATH_INST_COMMON_SRC)/virtualbox.xml \
+		$(VBOX_PATH_SOL_INST_SRC)/virtualbox.applications.in \
 		$(VBOX_PATH_SOL_INST_SRC)/vbox.pkginfo \
-		$(VBOX_PATH_SOL_INST_SRC)/vbox.space \
-		$(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse \
-		$(PATH_ROOT)/src/VBox/Installer/common/virtualbox.desktop.in \
-		$(PATH_ROOT)/src/VBox/Installer/common/virtualbox.xml \
-		$(PATH_ROOT)/doc/ReadMe-Solaris.txt \
-		$(VBOX_PATH_SOL_INST_SRC)/Makefile.kmk \
-		$(VBOX_BRAND_LICENSE_TXT) \
-		$(PATH_STAGE_BIN)/LICENSE \
-		$(if $(and $(VBOX_LICENSE_BINS),$(VBOX_WITH_QTGUI)),$(VBOX_LICENSE_BINS),) \
-		$(if $(VBOX_WITH_NETADP),$(PATH_ROOT)/src/VBox/HostDrivers/VBoxNetAdp/solaris/hostname.vboxnet0,) \
-		$(if $(not $(VBOX_WITH_NETFLT))$(PATH_ROOT)/src/VBox/Devices/Network/solaris/vnicinit_solaris.sh,) \
-		$(if $(not $(VBOX_WITH_NETFLT))$(PATH_ROOT)/src/VBox/Devices/Network/solaris/vnicterm_solaris.sh,) \
-		$(addprefix $(PATH_STAGE_BIN)/,$(filter-out $(SOLARIS_EXTRAS) $(SOLARIS_QTLIBS),$(SOLARIS_ARCH_FILES))) \
-		VBoxISAExec \
-		$(SOLARIS_ARCH_DEPFILES)
-	$(QUIET)$(RM) -f $(wildcard $(PATH_STAGE_BIN)/VirtualBox-*-r*.tar.gz)
-	$(call MSG_L1,Installing binaries $(SOLARIS_VBOXINST_DIR))
-ifdef VBOX_WITH_COMBINED_PACKAGE
-	$(QUIET)$(if $(VBOX_WITH_ADDITIONS_PACKING),$(INSTALL) -m 0644 $(SOLARIS_OUT_BIN_32)/additions/VBoxGuestAdditions.iso            $(SOLARIS_VBOXINST_DIR)/additions/)
-else
-	$(QUIET)$(if $(VBOX_WITH_ADDITIONS_PACKING),$(INSTALL) -m 0644 $(SOLARIS_OUT_BIN)/additions/VBoxGuestAdditions.iso               $(SOLARIS_VBOXINST_DIR)/additions/)
-endif
-	$(call MSG_L1,Installing files $(SOLARIS_VBOXINST_DIR))
-	$(QUIET)$(SED) \
-		-e "s/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g" \
+		\
+		$(if-expr defined(VBOX_WITH_QTGUI) && defined(VBOX_WITH_QT4_SUN),$(VBOX_PATH_QT4)/bin/qtconfig,) \
+		$(if-expr defined(VBOX_WITH_ADDITIONS_PACKING),$(PATH_STAGE_BIN)/additions/VBoxGuestAdditions.iso,) \
+		$(if-expr !defined(VBOX_OSE) && defined(VBOX_WITH_VBOXSDL),$(PATH_DEVTOOLS_TRG)/libSDL/v1.2.13/lib/libSDL-1.2.so.0.11.2,) \
+		\
+		$(foreach var, $(SOLARIS_FILE_LIST_VARS),$(foreach file, $($(var)), $($(var).SRC)/$(file))) \
+		\
+		$(foreach size, $(VBOX_SI_ICON_SIZES), $(foreach type, $(VBOX_SI_ICON_TYPES) \
+		,$(PATH_ROOT)/src/VBox/Resources/other/virtualbox-$(type)-$(size)px.png)) \
+		\
+		$(VBOX_SI_DEP_ON_MAKEFILE) \
+		| $$(dir $$@)
+	$(call MSG_L1,Creating $(PKG_FILENAME).pkg: Copying files)
+# Start with a clean slate, don't want to pick up random garbage.
+	$(RM) -Rf -- "$(VBOX_PATH_SI_SCRATCH_PKG)/"
+	$(QUIET)$(RM) -f -- "$@"
+
+# Create all the directories we need. We specify each sub directory to make sure the mode is correct.
+	$(MKDIR) -p -m 0755 -- $(sort $(VBOX_PATH_SI_SCRATCH_PKG)/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/opt/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/platform/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/kernel/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/platform/i86pc/kernel/drv/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/bin/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/applications/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/application-registry/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/hicolor/ \
+		$(foreach size, $(VBOX_SI_ICON_SIZES) \
+		,$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/hicolor/$(size)x$(size)/ \
+		 $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/hicolor/$(size)x$(size)/mimetypes/) \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime/packages/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/var/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/var/svc/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/var/svc/manifest/ \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/var/svc/manifest/application/ \
+		$(foreach var,$(SOLARIS_FILE_LIST_VARS), $($(var).DST)/) \
+		$(foreach var,$(SOLARIS_FILE_LIST_VARS),$(if-expr "$($(var).SUBDIRS)" == "yes",$(sort $(dir $(addprefix $($(var).DST)/,$($(var))))),)) \
+	)
+
+# Generic copy file lists.
+	$(foreach var, $(SOLARIS_FILE_LIST_VARS), $(foreach file, $($(var)) \
+	,$(if-expr "$($(var).STRIP)" == "objcopy" && defined(VBOX_DO_STRIP)\
+	,$(NLTAB)$(VBOX_SI_OBJCOPY_STRIP) "$($(var).SRC)/$(file)" "$($(var).DST)/$(file)" \
+	 $(NLTAB)$(CHMOD) "$($(var).MODE)" "$($(var).DST)/$(file)" \
+	,$(NLTAB)$(INSTALL) -m "$($(var).MODE)" $(if-expr "$($(var).STRIP)" == "yes" && defined(VBOX_DO_STRIP),-s,) \
+		"$($(var).SRC)/$(file)" "$($(var).DST)/$(file)")))
+
+# VirtualBox: Common files.
+	$(if-expr defined(VBOX_WITH_ADDITIONS_PACKING) \
+	,$(INSTALL) -m 0644 $(PATH_STAGE_BIN)/additions/VBoxGuestAdditions.iso  $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/,)
+	$(LN_SYMLINK) -f ./pkginstall.sh	$(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/ipsinstall.sh
+	$(SED)	-e "s/_HARDENED_/$(if $(VBOX_WITH_HARDENED),hardened,)/" \
+		--output $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/vboxconfig.sh \
+		 $(VBOX_PATH_SOL_INST_SRC)/vboxconfig.sh
+	$(CHMOD) 0755 $(VBOX_PATH_SOL_INST_SRC)/vboxconfig.sh
+	$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse	$(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/autoresponse
+
+# VirtualBox: Arch specific files.
+	$(if-expr defined(VBOX_WITH_QTGUI) && defined(VBOX_WITH_QT4_SUN)\
+	,$(INSTALL) -m 0755 \
+		$(VBOX_PATH_QT4)/bin/qtconfig	$(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)/VBoxQtconfig,)
+
+	$(if-expr defined(VBOX_WITH_QTGUI) \
+	,$(NLTAB)$(LN_SYMLINK) ../rdesktop-vrdp-keymaps/ $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)/rdesktop-vrdp-keymaps,)
+
+	$(if-expr defined(VBOX_WITH_ADDITIONS_PACKING) \
+	,$(NLTAB)$(LN_SYMLINK) ../VBoxGuestAdditions.iso $(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)/,)
+
+	$(if-expr !defined(VBOX_OSE) && defined(VBOX_WITH_VBOXSDL) \
+	,$(INSTALL) -m 0644 $(PATH_DEVTOOLS_TRG)/libSDL/v1.2.13/lib/libSDL-1.2.so.0.11.2 \
+		$(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)/libSDL-1.2.so.0,)
+
+	$(if-expr defined(VBOX_WITH_EFIFW_PACKING) \
+	,$(LN_SYMLINK) ../VBoxEFI32.fd ../VBoxEFI64.fd	$(VBOX_PATH_SI_SCRATCH_PKG)/opt/VirtualBox/$(VBOX_SI_ARCH)/,)
+
+# Links to /usr/bin.
+	$(foreach link,$(SOLARIS_USRBIN_LINKS) \
+	,$(NLTAB)$(LN_SYMLINK) ../../opt/VirtualBox/VBox.sh $(VBOX_PATH_SI_SCRATCH_PKG)/usr/bin/$(link))
+
+# Desktop stuff in /usr/share/applications/.
+	$(SED)  -e "s+ at VBOX_PRODUCT@+$(VBOX_PRODUCT)+" \
+		-e "s+ at VBOX_DOC_PATH@+/opt/VirtualBox+" \
+		--output $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/applications/virtualbox.desktop \
+		$(VBOX_PATH_INST_COMMON_SRC)/virtualbox.desktop.in
+	$(CHMOD) 0644 $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/applications/virtualbox.desktop
+
+# Desktop stuff in /usr/share/mime/packages/ (S10 cannot deal with icon information in virtualbox.xml).
+	$(SED)	-e '/<icon/d' \
+		--output $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime/packages/virtualbox.xml \
+		$(VBOX_PATH_INST_COMMON_SRC)/virtualbox.xml
+	$(CHMOD) 0644 $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/mime/packages/virtualbox.xml
+
+# Desktop stuff in /usr/share/application-registry.
+	$(SED)	-e "s+ at VBOX_PRODUCT@+$(VBOX_PRODUCT)+" \
+		--output $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/application-registry/virtualbox.applications \
+		$(VBOX_PATH_SOL_INST_SRC)/virtualbox.applications.in
+	$(CHMOD) 0644 $(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/application-registry/virtualbox.applications
+
+# Icons stuff under /usr/share/icons/hicolor/<size>x<size>/mimetypes/.
+	$(foreach size, $(VBOX_SI_ICON_SIZES), $(foreach type, $(VBOX_SI_ICON_TYPES) \
+		,$(NLTAB)$(INSTALL) -m 0644 \
+			$(PATH_ROOT)/src/VBox/Resources/other/virtualbox-$(type)-$(size)px.png \
+			$(VBOX_PATH_SI_SCRATCH_PKG)/usr/share/icons/hicolor/$(size)x$(size)/mimetypes/virtualbox-$(type).png))
+
+# Files related to package creation.
+	$(SED)	-e "s/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g" \
 		-e "s/@VBOX_VENDOR@/$(VBOX_VENDOR)/g" \
 		-e "s/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g" \
 		-e "s/@VBOX_SVN_REV@/$(VBOX_SVN_REV)/g" \
 		-e "s/@VBOX_VERSION_REVSTAMP@/$(PKGINFO_REVSTAMP)/g" \
 		-e "s/@UNAME_P@/$(PKGINFO_ARCH)/g" \
-		--output $(SOLARIS_BASEINST_DIR)/vbox.pkginfo \
+		--output $(VBOX_PATH_SI_SCRATCH_PKG)/vbox.pkginfo \
 		$(VBOX_PATH_SOL_INST_SRC)/vbox.pkginfo
-	@# @todo BLDDIRS doesn't do "-p" subdir creation; so create for now
-	$(QUIET)$(if $(VBOX_WITH_NETADP),$(MKDIR) -p $(SOLARIS_ETC_DIR),)
-	$(QUIET)$(MKDIR) -p $(SOLARIS_VBOXSMF_DIR)
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(MKDIR) -p $(SOLARIS_USRSHR_APPS_DIR),)
-	$(QUIET)$(MKDIR) -p $(SOLARIS_USRSHR_APPREG_DIR)
-	$(QUIET)$(MKDIR) -p $(SOLARIS_USRSHR_MIMEXML_DIR)
-	$(QUIET)$(MKDIR) -p $(SOLARIS_USRSHR_MIMEINFO_DIR)
-	$(QUIET)$(MKDIR) -p $(SOLARIS_USRSHR_PIXMAPS_DIR)
-	$(QUIET)$(if $(VBOX_WITH_NETADP),$(INSTALL) -m 0644 $(PATH_ROOT)/src/VBox/HostDrivers/VBoxNetAdp/solaris/hostname.vboxnet0    $(SOLARIS_ETC_DIR)/hostname.vboxnet0,)
-	$(QUIET)$(INSTALL) -m 0644 $(PATH_STAGE_BIN)/LICENSE                                                          $(SOLARIS_VBOXINST_DIR)/LICENSE
-	# don't display the license on package install, since 4.0
-	#$(QUIET)$(INSTALL) -m 0644 $(PATH_STAGE_BIN)/LICENSE                                                          $(SOLARIS_BASEINST_DIR)/vbox.copyright
-	$(QUIET)$(INSTALL) -m 0644 $(PATH_STAGE_BIN)/LICENSE                                                          $(SOLARIS_BASEINST_DIR)/LICENSE
-ifdef VBOX_WITH_COMBINED_PACKAGE
- ifndef VBOX_OSE
-	$(QUIET)$(if $(VBOX_WITH_VBOXSDL),$(INSTALL) -m 0644 $(PATH_DEVTOOLS)/solaris.x86/libSDL/v1.2.13/lib/libSDL-1.2.so.0.11.2     $(SOLARIS_VBOXINST_DIR_32)/libSDL-1.2.so.0,)
-	$(QUIET)$(if $(VBOX_WITH_VBOXSDL),$(INSTALL) -m 0644 $(PATH_DEVTOOLS)/solaris.amd64/libSDL/v1.2.13/lib/libSDL-1.2.so.0.11.2   $(SOLARIS_VBOXINST_DIR_64)/libSDL-1.2.so.0,)
- endif
-	@# @todo -XXX- how to get rid of this manual MKDIR ?
-	$(QUIET)$(MKDIR) -p $(SOLARIS_VBOXINST_DIR)/$(VBOX_SOL_PYTHON_DIR_64)
-	$(QUIET)$(if $(VBOX_WITH_PYTHON),$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s) $(wildcard $(SOLARIS_OUT_BIN_32)/VBoxPython*.so)   $(SOLARIS_VBOXINST_DIR)/,)
-	$(QUIET)$(if $(VBOX_WITH_PYTHON),$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s) $(wildcard $(SOLARIS_OUT_BIN_64)/VBoxPython*.so)   $(SOLARIS_VBOXINST_DIR)/$(VBOX_SOL_PYTHON_DIR_64)/,)
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(if ($VBOX_WITH_QT4_SUN),$(INSTALL) -m 0755 $(SOLARIS_PATH_QT_32)/bin/qtconfig      $(SOLARIS_VBOXINST_DIR_32)/VBoxQtconfig,),)
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(if $(VBOX_WITH_QT4_SUN),$(INSTALL) -m 0755 $(SOLARIS_PATH_QT_64)/bin/qtconfig      $(SOLARIS_VBOXINST_DIR_64)/VBoxQtconfig,),)
-	$(QUIET)$(INSTALL) -m 0755 $(SOLARIS_OUT_BIN_32)/VBoxISAExec                                                         $(SOLARIS_VBOXINST_DIR)/VBoxISAExec
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(LN_SYMLINK) -f ../rdesktop-vrdp-keymaps                                            $(SOLARIS_VBOXINST_DIR_32)/rdesktop-vrdp-keymaps,)
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(LN_SYMLINK) -f ../rdesktop-vrdp-keymaps                                            $(SOLARIS_VBOXINST_DIR_64)/rdesktop-vrdp-keymaps,)
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(LN_SYMLINK) -f ../additions                                                        $(SOLARIS_VBOXINST_DIR_32)/additions,)
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(LN_SYMLINK) -f ../additions                                                        $(SOLARIS_VBOXINST_DIR_64)/additions,)
-	$(QUIET)$(if $(VBOX_WITH_EFIFW_PACKING),$(LN_SYMLINK) -f ../VBoxEFI32.fd                                             $(SOLARIS_VBOXINST_DIR_32)/,)
-	$(QUIET)$(if $(VBOX_WITH_EFIFW_PACKING),$(LN_SYMLINK) -f ../VBoxEFI32.fd                                             $(SOLARIS_VBOXINST_DIR_64)/,)
-	$(QUIET)$(if $(VBOX_WITH_EFIFW_PACKING),$(LN_SYMLINK) -f ../VBoxEFI64.fd                                             $(SOLARIS_VBOXINST_DIR_32)/,)
-	$(QUIET)$(if $(VBOX_WITH_EFIFW_PACKING),$(LN_SYMLINK) -f ../VBoxEFI64.fd                                             $(SOLARIS_VBOXINST_DIR_64)/,)
-else
- ifndef VBOX_OSE
-	$(QUIET)$(if $(VBOX_WITH_VBOXSDL),$(INSTALL) -m 0644 $(PATH_DEVTOOLS_TRG)/libSDL/v1.2.13/lib/libSDL-1.2.so.0.11.2    $(SOLARIS_VBOXINST_DIR_ISA)/libSDL-1.2.so.0,)
- endif
-	@# @todo -XXX- how to get rid of this manual MKDIR ?
- ifdef VBOX_WITH_PYTHON
-	$(QUIET)$(if $(SOL64_PKG),$(MKDIR) -p $(SOLARIS_VBOXINST_DIR)/$(VBOX_SOL_PYTHON_DIR_64),)
-  ifdef VBOX_WITH_32_ON_64_MAIN_API
-	$(QUIET)$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s) $(filter     %_x86.so,$(wildcard $(SOLARIS_OUT_BIN)/VBoxPython*.so)) $(SOLARIS_VBOXINST_DIR)/
-	$(QUIET)$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s) $(filter-out %_x86.so,$(wildcard $(SOLARIS_OUT_BIN)/VBoxPython*.so)) $(SOLARIS_VBOXINST_DIR)/$(VBOX_SOL_PYTHON_DIR_64)/
-  else
-	$(QUIET)$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s) $(wildcard $(SOLARIS_OUT_BIN)/VBoxPython*.so)                   $(SOLARIS_VBOXINST_DIR)/$(if $(SOL64_PKG),$(VBOX_SOL_PYTHON_DIR_64)/,)
-  endif
- endif
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(if $(VBOX_WITH_QT4_SUN),$(INSTALL) -m 0755 $(VBOX_PATH_QT4)/bin/qtconfig           $(SOLARIS_VBOXINST_DIR_ISA)/VBoxQtconfig,),)
-	$(QUIET)$(INSTALL) -m 0755 $(SOLARIS_OUT_BIN)/VBoxISAExec                                                            $(SOLARIS_VBOXINST_DIR)/VBoxISAExec
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(LN_SYMLINK) -f ../rdesktop-vrdp-keymaps                                            $(SOLARIS_VBOXINST_DIR_ISA)/rdesktop-vrdp-keymaps,)
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(LN_SYMLINK) -f ../additions                                                        $(SOLARIS_VBOXINST_DIR_ISA)/additions,)
-	$(QUIET)$(if $(VBOX_WITH_EFIFW_PACKING),$(LN_SYMLINK) -f ../VBoxEFI32.fd                                             $(SOLARIS_VBOXINST_DIR_ISA)/,)
-	$(QUIET)$(if $(VBOX_WITH_EFIFW_PACKING),$(LN_SYMLINK) -f ../VBoxEFI64.fd                                             $(SOLARIS_VBOXINST_DIR_ISA)/,)
-endif
-	$(QUIET)$(LN_SYMLINK) -f ./pkginstall.sh                                                                             $(SOLARIS_VBOXINST_DIR)/ipsinstall.sh
-	$(QUIET)$(if $(VBOX_WITH_QTGUI),$(LN_SYMLINK) -f ../../$(SOLARIS_VBOXINST_SUBDIR)/VBox.sh                            $(SOLARIS_USRBIN_DIR)/VBoxQtconfig,)
-	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/virtualbox-zoneaccess.xml                                       $(SOLARIS_VBOXSMF_DIR)/virtualbox-zoneaccess.xml
-	$(QUIET)$(if $(VBOX_WITH_WEBSERVICES),$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/virtualbox-webservice.xml         $(SOLARIS_VBOXSMF_DIR)/virtualbox-webservice.xml,)
-	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/virtualbox-balloonctrl.xml                                      $(SOLARIS_VBOXSMF_DIR)/virtualbox-balloonctrl.xml
-	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/virtualbox-autostart.xml                                        $(SOLARIS_VBOXSMF_DIR)/virtualbox-autostart.xml
-	$(QUIET)$(if $(not $(VBOX_WITH_NETFLT))$(INSTALL) -m 0755 $(PATH_ROOT)/src/VBox/Devices/Network/solaris/vnicinit_solaris.sh            $(SOLARIS_VBOXINST_DIR)/vnic_setup.sh,)
-	$(QUIET)$(if $(not $(VBOX_WITH_NETFLT))$(INSTALL) -m 0755 $(PATH_ROOT)/src/VBox/Devices/Network/solaris/vnicterm_solaris.sh            $(SOLARIS_VBOXINST_DIR)/vnic_term.sh,)
-	$(QUIET)$(SED) \
-		-e "s/_HARDENED_/$(if $(VBOX_WITH_HARDENED),hardened,)/" \
-		--output $(SOLARIS_VBOXINST_DIR)/vboxconfig.sh.tmp \
-		 $(PATH_STAGE_BIN)/vboxconfig.sh
-	$(QUIET)$(INSTALL) -m 0755 $(SOLARIS_VBOXINST_DIR)/vboxconfig.sh.tmp                                    $(SOLARIS_VBOXINST_DIR)/vboxconfig.sh
-	$(QUIET)$(RM) -f $(SOLARIS_VBOXINST_DIR)/vboxconfig.sh.tmp
-	$(QUIET)$(SED) \
-		-e "s+ at VBOX_PRODUCT@+$(VBOX_PRODUCT)+" \
-		-e "s+ at VBOX_DOC_PATH@+/opt/VirtualBox+" \
-		--output $(SOLARIS_USRSHR_APPS_DIR)/virtualbox.desktop.tmp \
-		$(PATH_ROOT)/src/VBox/Installer/common/virtualbox.desktop.in
-	$(QUIET)$(INSTALL) -m 0644 $(SOLARIS_USRSHR_APPS_DIR)/virtualbox.desktop.tmp                            $(SOLARIS_USRSHR_APPS_DIR)/virtualbox.desktop
-	$(QUIET)$(RM) -f $(SOLARIS_USRSHR_APPS_DIR)/virtualbox.desktop.tmp
-	# S10 cannot deal with icon information in virtualbox.xml
-	$(QUIET)$(SED) \
-		-e '/<icon/d' \
-		--output $(SOLARIS_USRSHR_MIMEXML_DIR)/virtualbox.xml.tmp \
-		$(PATH_ROOT)/src/VBox/Installer/common/virtualbox.xml
-	$(QUIET)$(INSTALL) -m 0644 $(SOLARIS_USRSHR_MIMEXML_DIR)/virtualbox.xml.tmp                             $(SOLARIS_USRSHR_MIMEXML_DIR)/virtualbox.xml
-	$(QUIET)$(RM) -f $(SOLARIS_USRSHR_MIMEXML_DIR)/virtualbox.xml.tmp
-	$(QUIET)$(SED) \
-		-e "s+ at VBOX_PRODUCT@+$(VBOX_PRODUCT)+" \
-		--output $(SOLARIS_USRSHR_APPREG_DIR)/virtualbox.applications.tmp \
-		$(VBOX_PATH_SOL_INST_SRC)/virtualbox.applications.in
-	$(QUIET)$(INSTALL) -m 0644 $(SOLARIS_USRSHR_APPREG_DIR)/virtualbox.applications.tmp                     $(SOLARIS_USRSHR_APPREG_DIR)/virtualbox.applications
-	$(QUIET)$(RM) -f $(SOLARIS_USRSHR_APPREG_DIR)/virtualbox.applications.tmp
-	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/virtualbox.keys                                    $(SOLARIS_USRSHR_MIMEINFO_DIR)/virtualbox.keys
-	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/virtualbox.mime                                    $(SOLARIS_USRSHR_MIMEINFO_DIR)/virtualbox.mime
-	$(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_SOL_INST_SRC)/postinstall.sh                                     $(SOLARIS_BASEINST_DIR)/postinstall.sh
-	$(QUIET)$(INSTALL) -m 0644 $(SOLARIS_OUT_BIN)/VBox.png                                                  $(SOLARIS_USRSHR_PIXMAPS_DIR)/VBox.png
-	$(QUIET)$(INSTALL) -m 0644 $(SOLARIS_OUT_BIN)/virtualbox.png                                            $(SOLARIS_USRSHR_PIXMAPS_DIR)/virtualbox.png
-	$(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_SOL_INST_SRC)/postinstall.sh                                     $(SOLARIS_BASEINST_DIR)/postinstall.sh
-	$(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_SOL_INST_SRC)/checkinstall.sh                                    $(SOLARIS_BASEINST_DIR)/checkinstall.sh
-	$(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_SOL_INST_SRC)/preremove.sh                                       $(SOLARIS_BASEINST_DIR)/preremove.sh
-	$(QUIET)$(INSTALL) -m 0755 $(VBOX_PATH_SOL_INST_SRC)/makepackage.sh                                     $(SOLARIS_BASEINST_DIR)/makepackage.sh
-	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse                                   $(SOLARIS_VBOXINST_DIR)/autoresponse
-	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse                                   $(SOLARIS_BASEINST_DIR)/autoresponse
-	$(QUIET)$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/vbox.space                                         $(SOLARIS_BASEINST_DIR)/vbox.space
+	$(INSTALL) -m 0644 $(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse	$(VBOX_PATH_SI_SCRATCH_PKG)/autoresponse
+
+# Done copying file, create the package!
+	$(call MSG_L1,Creating install package: $(PKG_FILENAME).pkg)
+	$(REDIRECT) -C $(VBOX_PATH_SOL_INST_SRC) -- $(VBOX_PATH_SI_SCRATCH_PKG)/makepackage.sh \
+		$(if-expr defined(VBOX_WITH_HARDENING),--hardened,) \
+		$(VBOX_PATH_SI_SCRATCH_PKG) \
+		$(PKG_FILENAME) \
+		$(KBUILD_TARGET_ARCH) \
+		$(VBOX_SVN_REV)
+	$(MV) -- "$(VBOX_PATH_SI_SCRATCH_PKG)/$(PKG_FILENAME).pkg" "$@"
+	$(RM) -Rf -- "$(VBOX_PATH_SI_SCRATCH_PKG)/"
+
+
+#
+# Creates the tar file containing license, readme and autoresponse file in addition to the system V package.
+#
+solaris-package-tar-gz:: $(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz
+$(PATH_STAGE_BIN)/$(PKG_FILENAME).tar.gz: \
+		$(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg \
+		$(PATH_STAGE_BIN)/LICENSE \
+		$(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse \
+		$(PATH_ROOT)/doc/ReadMe-Solaris.txt \
+		$(VBOX_SI_DEP_ON_MAKEFILE) \
+		| $(VBOX_PATH_SI_SCRATCH)/
+	$(call MSG_L1,Creating final tar.gz package: $(PKG_FILENAME).tar.gz)
+	$(QUIET)$(RM) -f -- $(VBOX_PATH_SI_SCRATCH)/ReadMe.txt "$@"
 	$(QUIET)$(SED) \
 		-e "s/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g" \
 		-e "s/@VBOX_VENDOR@/$(VBOX_VENDOR)/g" \
 		-e "s/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g" \
 		-e "s/@BUILD_TARGET_ARCH@/$(KBUILD_TARGET_ARCH)/g" \
 		-e "s/@VBOX_SVN_REV@/$(VBOX_SVN_REV)/g" \
-		--output $(SOLARIS_BASEINST_DIR)/ReadMe.txt \
+		--output $(VBOX_PATH_SI_SCRATCH)/ReadMe.txt \
 		$(PATH_ROOT)/doc/ReadMe-Solaris.txt
-	$(call MSG_L1,Creating install package: $(PKG_FILENAME).tar.gz)
-	$(QUIET)$(REDIRECT) -C $(VBOX_PATH_SOL_INST_SRC) -- $(SOLARIS_BASEINST_DIR)/makepackage.sh $(if $(VBOX_WITH_HARDENING),--hardened) \
-		$(SOLARIS_BASEINST_DIR) \
-		$(PKG_FILENAME) \
-		$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE),neutral,$(KBUILD_TARGET_ARCH)) \
-		$(VBOX_SVN_REV) \
-	$(call MSG_L1,Creating final tar.gz package)
-	$(QUIET)$(SOL_GTAR) -C $(SOLARIS_BASEINST_DIR) -zcvf $(SOLARIS_BASEINST_DIR)/$(PKG_FILENAME).tar.gz $(SOLARIS_TAR_GZ_FILES)
-	$(QUIET)$(INSTALL) -m 0644 $(SOLARIS_BASEINST_DIR)/$(PKG_FILENAME).tar.gz $(SOLARIS_OUT_BIN)
-	@# Clean up files emitted as side-effect or result of packing
-	$(QUIET)$(RM) -f $(SOLARIS_BASEINST_DIR)/$(PKG_FILENAME).tar.gz
-	$(QUIET)$(RM) -f $(SOLARIS_BASEINST_DIR)/$(PKG_FILENAME).pkg
+	$(QUIET)$(VBOX_SI_GTAR) -C $(VBOX_PATH_SI_SCRATCH) -czvf "$@" --show-transformed-name \
+		--xform 's,^.*/,,g' --xform 's,vbox.pkgresponse,autoresponse,' \
+		$(VBOX_PATH_SI_SCRATCH)/ReadMe.txt \
+		$(PATH_STAGE_BIN)/LICENSE \
+		$(VBOX_PATH_SOL_INST_SRC)/vbox.pkgresponse \
+		$(VBOX_PATH_SI_SCRATCH)/$(PKG_FILENAME).pkg
+	$(QUIET)$(RM) -f -- $(VBOX_PATH_SI_SCRATCH)/ReadMe.txt
 	$(call MSG_L1,Packaging $@ is completed.)
 
 
-#
-# 32-bit Main Package
-#
-$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_STRIP_BINS)): \
-		$(SOLARIS_VBOXINST_DIR_32)/% : $(SOLARIS_OUT_BIN_32)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-$(addprefix $(SOLARIS_DRIVERINST_DIR_32)/,$(SOLARIS_DRIVER_BINS)): \
-		$(SOLARIS_DRIVERINST_DIR_32)/% : $(SOLARIS_OUT_BIN_32)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_STRIP_BIN_32)): \
-		$(SOLARIS_VBOXINST_DIR_32)/% : $(SOLARIS_OUT_BIN_32)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_STRIP_EXES)): \
-		$(SOLARIS_VBOXINST_DIR_32)/% : $(SOLARIS_OUT_BIN_32)/% | $$(dir $$@)
-	$(INSTALL) -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_STRIP_OBJS)): \
-		$(SOLARIS_VBOXINST_DIR_32)/% : $(SOLARIS_OUT_BIN_32)/% | $$(dir $$@)
-	$(if $(VBOX_DO_STRIP),$(SOL_OBJCOPY) $< $@, $(INSTALL) -m 0644 $< $@)
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_NO_STRIP)): \
-		$(SOLARIS_VBOXINST_DIR_32)/% : $(SOLARIS_OUT_BIN_32)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $< $@
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_32)/,$(SOLARIS_QTLIBS)): \
-		$(SOLARIS_VBOXINST_DIR_32)/% : $(SOLARIS_PATH_QT_32)/lib/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-#
-# 64-bit Main Package
-#
-$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_STRIP_BINS)): \
-		$(SOLARIS_VBOXINST_DIR_64)/% : $(SOLARIS_OUT_BIN_64)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-$(addprefix $(SOLARIS_DRIVERINST_DIR_64)/,$(SOLARIS_DRIVER_BINS)): \
-		$(SOLARIS_DRIVERINST_DIR_64)/% : $(SOLARIS_OUT_BIN_64)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_STRIP_EXES)): \
-		$(SOLARIS_VBOXINST_DIR_64)/% : $(SOLARIS_OUT_BIN_64)/% | $$(dir $$@)
-	$(INSTALL) -m 0755 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_STRIP_OBJS)): \
-		$(SOLARIS_VBOXINST_DIR_64)/% : $(SOLARIS_OUT_BIN_64)/% | $$(dir $$@)
-	$(if $(VBOX_DO_STRIP),$(SOL_OBJCOPY) $< $@, $(INSTALL) -m 0644 $< $@)
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_STRIP_OBJ_64)): \
-		$(SOLARIS_VBOXINST_DIR_64)/% : $(SOLARIS_OUT_BIN_64)/% | $$(dir $$@)
-	$(if $(VBOX_DO_STRIP),$(SOL_OBJCOPY) $< $@, $(INSTALL) -m 0644 $< $@)
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_NO_STRIP)): \
-		$(SOLARIS_VBOXINST_DIR_64)/% : $(SOLARIS_OUT_BIN_64)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $< $@
-
-$(addprefix $(SOLARIS_VBOXINST_DIR_64)/,$(SOLARIS_QTLIBS)): \
-		$(SOLARIS_VBOXINST_DIR_64)/% : $(SOLARIS_PATH_QT_64)/lib/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $(if $(VBOX_DO_STRIP),-s,) $< $@
-
-
-#
-# Common (32-bit and 64-bit)
-#
-$(addprefix $(SOLARIS_VBOXINST_DIR)/,$(SOLARIS_COMMON)): \
-		$(SOLARIS_VBOXINST_DIR)/% : $(PATH_STAGE_BIN)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $< $@
-
-# Driver configuration files
-$(addprefix $(SOLARIS_DRIVERINST_DIR)/,$(SOLARIS_DRIVER_CONFS)): \
-		$(SOLARIS_DRIVERINST_DIR)/% : $(PATH_STAGE_BIN)/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $< $@
-
-# Common executables
-$(addprefix $(SOLARIS_VBOXINST_DIR)/,$(SOLARIS_COMMON_EXES)): \
-		$(SOLARIS_VBOXINST_DIR)/% : $(PATH_STAGE_BIN)/% | $$(dir $$@)
-	$(INSTALL) -m 0755 $< $@
-
-# Common MIME icons
-$(addprefix $(SOLARIS_USRSHR_ICONS_DIR)/,$(SOLARIS_COMMON_ICONS)): \
-		$(SOLARIS_USRSHR_ICONS_DIR)/% : $(PATH_STAGE_BIN)/icons/% | $$(dir $$@)
-	$(INSTALL) -m 0644 $< $@
-
-
-
-#
-# Common (relative symlinks to /opt/VirtualBox/ from /usr/bin/)
-# Some symlinks are created manually in the prepackage steps above (eg. VBoxQtconfig)
-# as those binaries do not originate from $(PATH_STAGE_BIN)
-#
-$(addprefix $(SOLARIS_USRBIN_DIR)/,$(SOLARIS_USRBIN_LINKS)): | $$(dir $$@)
-	$(LN_SYMLINK) -f ../../$(SOLARIS_VBOXINST_SUBDIR)/VBox.sh $@
-
-
+## List of file list variable names relevant for debug info.
+SOLARIS_FILE_LIST_DBGINFO_VARS := $(foreach var, $(SOLARIS_FILE_LIST_VARS), $(if-expr "$($(var).STRIP)" != "no",$(var),))
+## Adds a .DBGDST property to each of the debug info file lists. Simplifies our job below
+$(foreach var,$(SOLARIS_FILE_LIST_DBGINFO_VARS) \
+	,$(eval $(var).DBGDST := $(subst $(VBOX_PATH_SI_SCRATCH_PKG)/,$(VBOX_PATH_SI_SCRATCH_DBG)/,$(subst /opt/VirtualBox,,$($(var).DST)))))
 
 #
-#  -=-=-=-=-=-=-=- Debug package -=-=-=-=-=-=-=-
+# Creates a tar file containing the debug info.
 #
-$(PATH_STAGE_BIN)/$(DBG_ARCHIVE): \
+$(PATH_STAGE_BIN)/VirtualBoxDebug.tar.bz2: \
 		$(VBOX_VERSION_STAMP) \
-		$(VBOX_PATH_SOL_INST_SRC)/Makefile.kmk \
-		$(SOLARIS_DBG_DEPFILES)
-	$(call MSG_L1,Installing debug binaries $(SOLARIS_DBG_DIR))
+		$(VBOX_SI_DEP_ON_MAKEFILE) \
+		$(foreach var, $(SOLARIS_FILE_LIST_DBGINFO_VARS), $(foreach file, $($(var)), $($(var).SRC)/$(file)))
+	$(call MSG_L1,Preparing $@)
+	$(RM) -Rf -- "$(VBOX_PATH_SI_SCRATCH_DBG)/"
+	$(RM) -f -- "$@"
+	$(MKDIR) -p -m 0755 \
+		$(VBOX_PATH_SI_SCRATCH_DBG)/ \
+		$(sort $(foreach var, $(SOLARIS_FILE_LIST_DBGINFO_VARS), $($(var).DBGDST)/ $(if-expr "$($(var).SUBDIRS)" == "yes" \
+		,$(sort $(dir $(foreach file, $($(var)), $($(var).DBGDST)/$(file)))),)))
+	$(foreach var, $(SOLARIS_FILE_LIST_DBGINFO_VARS),$(foreach file, $($(var)) \
+	,$(NLTAB)$(VBOX_SI_OBJCOPY_DBGINFO) "$($(var).SRC)/$(file)" "$($(var).DBGDST)/$(file)"))
 	$(call MSG_L1,Packing $@)
-	$(QUIET)$(SOL_GTAR) --dereference --owner 0 --group 0 \
-		-cjRhf "$(PATH_STAGE_BIN)/$(DBG_ARCHIVE)" -C "$(SOLARIS_INST_OUT_DIR)" "$(SOLARIS_DBG_DIR_NAME)"
+	$(QUIET)$(VBOX_SI_GTAR) --dereference --owner 0 --group 0 \
+		-cvjRhf "$@" -C "$(VBOX_PATH_SI_SCRATCH_DBG)/.." "./$(notdir $(VBOX_PATH_SI_SCRATCH_DBG))/"
 	$(QUIET)$(CHMOD) 0644 $@
 	$(call MSG_L1,Packaging $@ is completed.)
-
-#
-# 32-bit Debug package
-#
-$(addprefix $(SOLARIS_DBG_DIR_32)/,$(SOLARIS_STRIP_BINS) $(SOLARIS_STRIP_EXES)): \
-		$(SOLARIS_DBG_DIR_32)/% : $(SOLARIS_OUT_BIN_32)/% | $$(dir $$@)
-	$(SOL_DBG_OBJCOPY) $< $@
-
-$(addprefix $(SOLARIS_DBG_DIR_32)/,$(SOLARIS_DRIVER_BINS)): \
-		$(SOLARIS_DBG_DIR_32)/% : $(SOLARIS_OUT_BIN_32)/% | $$(dir $$@)
-	$(SOL_DBG_OBJCOPY) $< $@
-
-
-#
-# 64-bit Debug package
-#
-$(addprefix $(SOLARIS_DBG_DIR_64)/,$(SOLARIS_STRIP_BINS) $(SOLARIS_STRIP_EXES)): \
-		$(SOLARIS_DBG_DIR_64)/% : $(SOLARIS_OUT_BIN_64)/% | $$(dir $$@)
-	$(SOL_DBG_OBJCOPY) $< $@
-
-$(addprefix $(SOLARIS_DBG_DIR_64)/,$(SOLARIS_DRIVER_BINS)): \
-		$(SOLARIS_DBG_DIR_64)/% : $(SOLARIS_OUT_BIN_64)/% | $$(dir $$@)
-	$(SOL_DBG_OBJCOPY) $< $@
+	$(RM) -Rf "$(VBOX_PATH_SI_SCRATCH_DBG)/"
 
diff --git a/src/VBox/Installer/solaris/VBox.sh b/src/VBox/Installer/solaris/VBox.sh
index c8f3584..9a47a3e 100755
--- a/src/VBox/Installer/solaris/VBox.sh
+++ b/src/VBox/Installer/solaris/VBox.sh
@@ -1,8 +1,10 @@
 #!/bin/sh
-#
+## @file
 # Oracle VM VirtualBox startup script, Solaris hosts.
 #
-# Copyright (C) 2006-2012 Oracle Corporation
+
+#
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -40,15 +42,22 @@ case "$APP" in
     VBoxAutostart|vboxautostart)
         exec "$INSTALL_DIR/VBoxAutostart" "$@"
         ;;
+    VBoxDTrace|vboxdtrace)
+        exec "$INSTALL_DIR/VBoxDTrace" "$@"
+        ;;
     vboxwebsrv)
         exec "$INSTALL_DIR/vboxwebsrv" "$@"
         ;;
     VBoxQtconfig)
         exec "$INSTALL_DIR/VBoxQtconfig" "$@"
         ;;
+    vbox-img)
+        exec "$INSTALL_DIR/vbox-img" "$0"
+        ;;
     *)
         echo "Unknown application - $APP"
         exit 1
         ;;
 esac
 exit 0
+
diff --git a/src/VBox/Installer/solaris/makepackage.sh b/src/VBox/Installer/solaris/makepackage.sh
index 1a82f18..c46c6a1 100755
--- a/src/VBox/Installer/solaris/makepackage.sh
+++ b/src/VBox/Installer/solaris/makepackage.sh
@@ -96,6 +96,12 @@ symlink_fixup()
   mv -f "tmp-$1" "$1"
 }
 
+create_hardlink()
+{
+    if test -f "$VBOX_INSTALLED_DIR/amd64/$1" || test -f "$VBOX_INSTALLED_DIR/i386/$1"; then
+        ln -f ./VBoxISAExec "$VBOX_INSTALLED_DIR/$1"
+    fi
+}
 
 # Prepare file list
 cd "$PKG_BASE_DIR"
@@ -108,27 +114,20 @@ if test -f "./vbox.copyright"; then
     echo 'i copyright=./vbox.copyright' >> prototype
 fi
 
-# Create relative hardlinks
+# Create relative hardlinks for executables to either the 32-bit or 64-bit subfolders
 cd "$VBOX_INSTALLED_DIR"
-ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxManage
-ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxSDL
-ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxBalloonCtrl
-ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxAutostart
-ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/vboxwebsrv
-ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/webtest
-ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxZoneAccess
-ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxSVC
-if test -f $VBOX_INSTALLED_DIR/amd64/VBoxTestOGL || test -f $VBOX_INSTALLED_DIR/i386/VBoxTestOGL; then
-    ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxTestOGL
-fi
-
-if test -f $VBOX_INSTALLED_DIR/amd64/VirtualBox || test -f $VBOX_INSTALLED_DIR/i386/VirtualBox; then
-    ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VirtualBox
-fi
-if test -f $VBOX_INSTALLED_DIR/amd64/VBoxHeadless || test -f $VBOX_INSTALLED_DIR/i386/VBoxHeadless; then
-    ln -f ./VBoxISAExec $VBOX_INSTALLED_DIR/VBoxHeadless
-    ln -fs ./VBoxHeadless $VBOX_INSTALLED_DIR/VBoxVRDP
-fi
+create_hardlink VBoxManage
+create_hardlink VBoxSDL
+create_hardlink VBoxAutostart
+create_hardlink vboxwebsrv
+create_hardlink webtest
+create_hardlink VBoxZoneAccess
+create_hardlink VBoxSVC
+create_hardlink VBoxBalloonCtrl
+create_hardlink VBoxTestOGL
+create_hardlink VirtualBox
+create_hardlink vbox-img
+create_hardlink VBoxHeadless
 
 # Exclude directories to not cause install-time conflicts with existing system directories
 cd "$PKG_BASE_DIR"
@@ -183,7 +182,7 @@ filelist_fixup prototype '$3 == "var/svc/manifest/application/virtualbox/virtual
 # we're violating directory attributes of another (non existing) package
 dirlist_fixup prototype  '$3 == "var/svc/manifest/application/virtualbox"'                              '$6 = "root"'
 
-# hardening requires some executables to be marked setuid.
+# Hardening requires some executables to be marked setuid.
 if test -n "$HARDENED"; then
     $VBOX_AWK 'NF == 6 \
         && (    $3 == "opt/VirtualBox/amd64/VirtualBox" \
@@ -232,7 +231,7 @@ pkgmk -p $VBOXPKG_TIMESTAMP -o -r .
 # Translate into package datastream
 pkgtrans -s -o /var/spool/pkg "`pwd`/$VBOX_PKGFILE" "$VBOX_PKGNAME"
 
-# $5 if exist would contain the path to the VBI package to include in the .tar.gz
+# $5 if exists would contain the path to the VBI package to include in the .tar.gz
 #if [ -f LICENSE ]; then
 #    VBOX_LICENSEFILE=LICENSE
 #fi
diff --git a/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh b/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh
index d27124c..9ad8a81 100755
--- a/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh
+++ b/src/VBox/Installer/solaris/smf-vboxballoonctrl.sh
@@ -1,7 +1,7 @@
 #!/sbin/sh
 # $Id: smf-vboxballoonctrl.sh $
 
-# Copyright (C) 2008-2013 Oracle Corporation
+# Copyright (C) 2008-2014 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -24,13 +24,13 @@ VW_EXIT=0
 
 case $VW_OPT in
     start)
-        if [ ! -x /opt/VirtualBox/VBoxBalloonCtrl ]; then
+        if [ ! -f /opt/VirtualBox/VBoxBalloonCtrl ]; then
             echo "ERROR: /opt/VirtualBox/VBoxBalloonCtrl does not exist."
             return $SMF_EXIT_ERR_CONFIG
         fi
 
-        if [ ! -f /opt/VirtualBox/VBoxBalloonCtrl ]; then
-            echo "ERROR: /opt/VirtualBox/VBoxBalloonCtrl does not exist."
+        if [ ! -x /opt/VirtualBox/VBoxBalloonCtrl ]; then
+            echo "ERROR: /opt/VirtualBox/VBoxBalloonCtrl is not executable."
             return $SMF_EXIT_ERR_CONFIG
         fi
 
diff --git a/src/VBox/Installer/solaris/smf-vboxwebsrv.sh b/src/VBox/Installer/solaris/smf-vboxwebsrv.sh
index 5831c95..2219d56 100755
--- a/src/VBox/Installer/solaris/smf-vboxwebsrv.sh
+++ b/src/VBox/Installer/solaris/smf-vboxwebsrv.sh
@@ -1,7 +1,7 @@
 #!/sbin/sh
 # $Id: smf-vboxwebsrv.sh $
 
-# Copyright (C) 2008-2012 Oracle Corporation
+# Copyright (C) 2008-2014 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -24,13 +24,13 @@ VW_EXIT=0
 
 case $VW_OPT in
     start)
-        if [ ! -x /opt/VirtualBox/vboxwebsrv ]; then
+        if [ ! -f /opt/VirtualBox/vboxwebsrv ]; then
             echo "ERROR: /opt/VirtualBox/vboxwebsrv does not exist."
             return $SMF_EXIT_ERR_CONFIG
         fi
 
-        if [ ! -f /opt/VirtualBox/vboxwebsrv ]; then
-            echo "ERROR: /opt/VirtualBox/vboxwebsrv does not exist."
+        if [ ! -x /opt/VirtualBox/vboxwebsrv ]; then
+            echo "ERROR: /opt/VirtualBox/vboxwebsrv is not executable."
             return $SMF_EXIT_ERR_CONFIG
         fi
 
diff --git a/src/VBox/Installer/solaris/vboxconfig.sh b/src/VBox/Installer/solaris/vboxconfig.sh
index 85448d8..3c93f05 100755
--- a/src/VBox/Installer/solaris/vboxconfig.sh
+++ b/src/VBox/Installer/solaris/vboxconfig.sh
@@ -46,6 +46,7 @@ BIN_IFCONFIG=/sbin/ifconfig
 BIN_SVCS=/usr/bin/svcs
 BIN_ID=/usr/bin/id
 BIN_PKILL=/usr/bin/pkill
+BIN_PGREP=/usr/bin/pgrep
 
 # "vboxdrv" is also used in sed lines here (change those as well if it ever changes)
 MOD_VBOXDRV=vboxdrv
@@ -203,6 +204,10 @@ find_bins()
     if test ! -x "$BIN_PKILL"; then
         BIN_PKILL=`find_bin_path "$BIN_PKILL"`
     fi
+
+    if test ! -x "$BIN_PGREP"; then
+        BIN_PGREP=`find_bin_path "$BIN_PGREP"`
+    fi
 }
 
 # check_root()
@@ -239,7 +244,8 @@ get_sysinfo()
             # The format is "pkg://solaris/system/kernel@0.5.11,5.11-0.161:20110315T070332Z"
             #            or "pkg://solaris/system/kernel@5.12,5.11-5.12.0.0.0.4.1:20120908T030246Z"
             #            or "pkg://solaris/system/kernel@0.5.11,5.11-0.175.0.0.0.1.0:20111012T032837Z"
-            #            or "pkg://solaris/system/kernel@5.12-5.12.0.0.0.9.1.3.0:20121012T032837Z"
+            #            or "pkg://solaris/system/kernel@5.12-5.12.0.0.0.9.1.3.0:20121012T032837Z" [1]
+	    # [1]: The sed below doesn't handle this. It's instead parsed below in the PSARC/2012/240 case.
             STR_KERN_MAJOR=`echo "$PKGFMRI" | sed 's/^.*\@//;s/\,.*//'`
             if test ! -z "$STR_KERN_MAJOR"; then
                 # The format is "0.5.11" or "5.12"
@@ -835,9 +841,9 @@ is_process_running()
         exit 1
     fi
 
-    procname=$1
-    procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'`
-    if test ! -z "$procpid" && test "$procpid" -ge 0; then
+    procname="$1"
+    $BIN_PGREP "$procname" > /dev/null 2>&1
+    if test "$?" -eq 0; then
         return 1
     fi
     return 0
@@ -853,14 +859,13 @@ stop_process()
         exit 1
     fi
 
-    # @todo use is_process_running()
-    procname=$1
-    procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'`
-    if test ! -z "$procpid" && test "$procpid" -ge 0; then
+    procname="$1"
+    is_process_running "$procname"
+    if test "$?" -eq 1; then
         $BIN_PKILL "$procname"
         sleep 2
-        procpid=`ps -eo pid,fname | grep $procname | grep -v grep | awk '{ print $1 }'`
-        if test ! -z "$procpid" && test "$procpid" -ge 0; then
+        is_process_running "$procname"
+        if test "$?" -eq 1; then
             subprint "Terminating: $procname  ...FAILED!"
             if test "$fatal" = "$FATALOP"; then
                 exit 1
@@ -901,10 +906,10 @@ start_service()
     if test "$success" -eq 0; then
         $BIN_SVCADM enable -s "$3"
         if test "$?" -eq 0; then
-            subprint "Loaded: $1"
+            subprint "Enabled: $1"
             return 0
         else
-            warnprint "Loading $1  ...FAILED."
+            warnprint "Enabling $1  ...FAILED."
             warnprint "Refer $4 for details."
         fi
     else
@@ -929,9 +934,9 @@ stop_service()
         # Don't delete the manifest, this is handled by the manifest class action
         # $BIN_SVCCFG delete "$3"
         if test "$?" -eq 0; then
-            subprint "Unloaded: $1"
+            subprint "Disabled: $1"
         else
-            subprint "Unloading: $1  ...ERROR(S)."
+            subprint "Disabling: $1  ...ERROR(S)."
         fi
     fi
 }
@@ -954,6 +959,13 @@ cleanup_install()
     stop_service "Autostart service" "virtualbox/autostart" "svc:/application/virtualbox/autostart:default"
     stop_service "Zone access service" "virtualbox/zoneaccess" "svc:/application/virtualbox/zoneaccess:default"
 
+    # DEBUG x4600b: verify that the ZoneAccess process is really gone
+    is_process_running "VBoxZoneAccess"
+    if test "$?" -eq 1; then
+        warnprint "VBoxZoneAccess is alive despite its service being dead. Killing..."
+        stop_process "VBoxZoneAccess"
+    fi
+
     # unplumb all vboxnet instances for non-remote installs
     inst=0
     while test $inst -ne $MOD_VBOXNET_INST; do
diff --git a/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp b/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
index 5f3d765..aa40883 100644
--- a/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
+++ b/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp
@@ -496,6 +496,8 @@ UINT __stdcall InstallBranding(MSIHANDLE hModule)
 #define NETFLT_ID  L"sun_VBoxNetFlt" /** @todo Needs to be changed (?). */
 #define NETADP_ID  L"sun_VBoxNetAdp" /** @todo Needs to be changed (?). */
 
+#define NETLWF_INF_NAME L"VBoxNetLwf.inf"
+
 static MSIHANDLE g_hCurrentModule = NULL;
 
 static VOID vboxDrvLoggerCallback(VBOXDRVCFG_LOG_SEVERITY enmSeverity, char * msg, void * pvContext)
@@ -540,7 +542,7 @@ static VOID netCfgLoggerEnable(MSIHANDLE hModule)
 
     VBoxNetCfgWinSetLogging((LOG_ROUTINE)netCfgLoggerCallback);
     /* uncomment next line if you want to add logging information from VBoxDrvCfg.cpp */
-    VBoxDrvCfgLoggerSet(vboxDrvLoggerCallback, NULL);
+//    VBoxDrvCfgLoggerSet(vboxDrvLoggerCallback, NULL);
 }
 
 static UINT errorConvertFromHResult(MSIHANDLE hModule, HRESULT hr)
@@ -791,6 +793,124 @@ UINT __stdcall InstallNetFlt(MSIHANDLE hModule)
     return ERROR_SUCCESS;
 }
 
+
+UINT __stdcall UninstallNetLwf(MSIHANDLE hModule)
+{
+#ifdef VBOX_WITH_NETFLT
+    INetCfg *pNetCfg;
+    UINT uErr;
+
+    netCfgLoggerEnable(hModule);
+
+    BOOL bOldIntMode = SetupSetNonInteractiveMode(FALSE);
+
+    __try
+    {
+        logStringW(hModule, L"Uninstalling NetLwf");
+
+        uErr = doNetCfgInit(hModule, &pNetCfg, TRUE);
+        if (uErr == ERROR_SUCCESS)
+        {
+            HRESULT hr = VBoxNetCfgWinNetLwfUninstall(pNetCfg);
+            if (hr != S_OK)
+                logStringW(hModule, L"UninstallNetLwf: VBoxNetCfgWinUninstallComponent failed, error = 0x%x", hr);
+
+            uErr = errorConvertFromHResult(hModule, hr);
+
+            VBoxNetCfgWinReleaseINetCfg(pNetCfg, TRUE);
+
+            logStringW(hModule, L"Uninstalling NetLwf done, error = 0x%x", uErr);
+        }
+        else
+            logStringW(hModule, L"UninstallNetLwf: doNetCfgInit failed, error = 0x%x", uErr);
+    }
+    __finally
+    {
+        if (bOldIntMode)
+        {
+            /* The prev mode != FALSE, i.e. non-interactive. */
+            SetupSetNonInteractiveMode(bOldIntMode);
+        }
+        netCfgLoggerDisable();
+    }
+#endif /* VBOX_WITH_NETFLT */
+
+    /* Never fail the install even if we did not succeed. */
+    return ERROR_SUCCESS;
+}
+
+UINT __stdcall InstallNetLwf(MSIHANDLE hModule)
+{
+#ifdef VBOX_WITH_NETFLT
+    UINT uErr;
+    INetCfg *pNetCfg;
+
+    netCfgLoggerEnable(hModule);
+
+    BOOL bOldIntMode = SetupSetNonInteractiveMode(FALSE);
+
+    __try
+    {
+
+        logStringW(hModule, L"InstallNetLwf: Installing NetLwf");
+
+        uErr = doNetCfgInit(hModule, &pNetCfg, TRUE);
+        if (uErr == ERROR_SUCCESS)
+        {
+            WCHAR wszInfName[] = NETLWF_INF_NAME;
+            WCHAR wszInf[MAX_PATH];
+            DWORD cchInf = RT_ELEMENTS(wszInf) - sizeof(NETLWF_INF_NAME) - 1;
+            UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", wszInf, &cchInf);
+            if (uErr == ERROR_SUCCESS)
+            {
+                if (cchInf)
+                {
+                    if (wszInf[cchInf - 1] != L'\\')
+                    {
+                        wszInf[cchInf++] = L'\\';
+                        wszInf[cchInf]   = L'\0';
+                    }
+
+                    wcscat(wszInf, NETLWF_INF_NAME);
+
+                    HRESULT hr = VBoxNetCfgWinNetLwfInstall(pNetCfg, wszInf);
+                    if (FAILED(hr))
+                        logStringW(hModule, L"InstallNetLwf: VBoxNetCfgWinNetLwfInstall failed, error = 0x%x", hr);
+
+                    uErr = errorConvertFromHResult(hModule, hr);
+                }
+                else
+                {
+                    logStringW(hModule, L"vboxNetFltQueryInfArray: Empty installation directory");
+                    uErr = ERROR_GEN_FAILURE;
+                }
+            }
+            else
+                logStringW(hModule, L"vboxNetFltQueryInfArray: MsiGetPropertyW failed, error = 0x%x", uErr);
+
+            VBoxNetCfgWinReleaseINetCfg(pNetCfg, TRUE);
+
+            logStringW(hModule, L"InstallNetLwf: Done");
+        }
+        else
+            logStringW(hModule, L"InstallNetLwf: doNetCfgInit failed, error = 0x%x", uErr);
+    }
+    __finally
+    {
+        if (bOldIntMode)
+        {
+            /* The prev mode != FALSE, i.e. non-interactive. */
+            SetupSetNonInteractiveMode(bOldIntMode);
+        }
+        netCfgLoggerDisable();
+    }
+#endif /* VBOX_WITH_NETFLT */
+
+    /* Never fail the install even if we did not succeed. */
+    return ERROR_SUCCESS;
+}
+
+
 #if 0
 static BOOL RenameHostOnlyConnectionsCallback(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDev, PVOID pContext)
 {
@@ -849,7 +969,7 @@ static BOOL RenameHostOnlyConnectionsCallback(HDEVINFO hDevInfo, PSP_DEVINFO_DAT
 }
 #endif
 
-UINT __stdcall CreateHostOnlyInterface(MSIHANDLE hModule)
+static UINT _createHostOnlyInterface(MSIHANDLE hModule, LPCWSTR pwszId, LPCWSTR pwszInfName)
 {
 #ifdef VBOX_WITH_NETFLT
     netCfgLoggerEnable(hModule);
@@ -863,7 +983,7 @@ UINT __stdcall CreateHostOnlyInterface(MSIHANDLE hModule)
 
     GUID guid;
     WCHAR wszMpInf[MAX_PATH];
-    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("VBoxNetAdp.inf") - 1;
+    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - wcslen(pwszInfName) - 1 - 1;
     LPCWSTR pwszInfPath = NULL;
     bool bIsFile = false;
     UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", wszMpInf, &cchMpInf);
@@ -878,7 +998,7 @@ UINT __stdcall CreateHostOnlyInterface(MSIHANDLE hModule)
                 wszMpInf[cchMpInf]   = L'\0';
             }
 
-            wcscat(wszMpInf, L"VBoxNetAdp.inf");
+            wcscat(wszMpInf, pwszInfName);
             pwszInfPath = wszMpInf;
             bIsFile = true;
 
@@ -904,7 +1024,7 @@ UINT __stdcall CreateHostOnlyInterface(MSIHANDLE hModule)
     {
     //first, try to update Host Only Network Interface
         BOOL fRebootRequired = FALSE;
-        hr = VBoxNetCfgWinUpdateHostOnlyNetworkInterface(pwszInfPath, &fRebootRequired);
+        hr = VBoxNetCfgWinUpdateHostOnlyNetworkInterface(pwszInfPath, &fRebootRequired, pwszId);
         if (SUCCEEDED(hr))
         {
             if (fRebootRequired)
@@ -955,7 +1075,17 @@ UINT __stdcall CreateHostOnlyInterface(MSIHANDLE hModule)
     return ERROR_SUCCESS;
 }
 
-UINT __stdcall RemoveHostOnlyInterfaces(MSIHANDLE hModule)
+UINT __stdcall CreateHostOnlyInterface(MSIHANDLE hModule)
+{
+    return _createHostOnlyInterface(hModule, NETADP_ID, L"VBoxNetAdp.inf");
+}
+
+UINT __stdcall Ndis6CreateHostOnlyInterface(MSIHANDLE hModule)
+{
+    return _createHostOnlyInterface(hModule, NETADP_ID, L"VBoxNetAdp6.inf");
+}
+
+static UINT _removeHostOnlyInterfaces(MSIHANDLE hModule, LPCWSTR pwszId)
 {
 #ifdef VBOX_WITH_NETFLT
     netCfgLoggerEnable(hModule);
@@ -964,16 +1094,17 @@ UINT __stdcall RemoveHostOnlyInterfaces(MSIHANDLE hModule)
 
     BOOL bSetupModeInteractive = SetupSetNonInteractiveMode(FALSE);
 
-    HRESULT hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(NETADP_ID);
+    HRESULT hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(pwszId);
     if (SUCCEEDED(hr))
     {
-        hr = VBoxDrvCfgInfUninstallAllSetupDi(&GUID_DEVCLASS_NET, L"Net", NETADP_ID, SUOI_FORCEDELETE/* could be SUOI_FORCEDELETE */);
+        hr = VBoxDrvCfgInfUninstallAllSetupDi(&GUID_DEVCLASS_NET, L"Net", pwszId, SUOI_FORCEDELETE/* could be SUOI_FORCEDELETE */);
         if (FAILED(hr))
         {
             logStringW(hModule, L"RemoveHostOnlyInterfaces: NetAdp uninstalled successfully, but failed to remove INF files");
         }
         else
             logStringW(hModule, L"RemoveHostOnlyInterfaces: NetAdp uninstalled successfully");
+
     }
     else
         logStringW(hModule, L"RemoveHostOnlyInterfaces: NetAdp uninstall failed, hr = 0x%x", hr);
@@ -989,7 +1120,12 @@ UINT __stdcall RemoveHostOnlyInterfaces(MSIHANDLE hModule)
     return ERROR_SUCCESS;
 }
 
-UINT __stdcall StopHostOnlyInterfaces(MSIHANDLE hModule)
+UINT __stdcall RemoveHostOnlyInterfaces(MSIHANDLE hModule)
+{
+    return _removeHostOnlyInterfaces(hModule, NETADP_ID);
+}
+
+static UINT _stopHostOnlyInterfaces(MSIHANDLE hModule, LPCWSTR pwszId)
 {
 #ifdef VBOX_WITH_NETFLT
     netCfgLoggerEnable(hModule);
@@ -998,9 +1134,11 @@ UINT __stdcall StopHostOnlyInterfaces(MSIHANDLE hModule)
 
     BOOL bSetupModeInteractive = SetupSetNonInteractiveMode(FALSE);
 
-    HRESULT hr = VBoxNetCfgWinPropChangeAllNetDevicesOfId(NETADP_ID, VBOXNECTFGWINPROPCHANGE_TYPE_DISABLE);
+    HRESULT hr = VBoxNetCfgWinPropChangeAllNetDevicesOfId(pwszId, VBOXNECTFGWINPROPCHANGE_TYPE_DISABLE);
     if (SUCCEEDED(hr))
+    {
         logStringW(hModule, L"StopHostOnlyInterfaces: Disabling host interfaces was successful, hr = 0x%x", hr);
+    }
     else
         logStringW(hModule, L"StopHostOnlyInterfaces: Disabling host interfaces failed, hr = 0x%x", hr);
 
@@ -1015,7 +1153,12 @@ UINT __stdcall StopHostOnlyInterfaces(MSIHANDLE hModule)
     return ERROR_SUCCESS;
 }
 
-UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
+UINT __stdcall StopHostOnlyInterfaces(MSIHANDLE hModule)
+{
+    return _stopHostOnlyInterfaces(hModule, NETADP_ID);
+}
+
+static UINT _updateHostOnlyInterfaces(MSIHANDLE hModule, LPCWSTR pwszInfName, LPCWSTR pwszId)
 {
 #ifdef VBOX_WITH_NETFLT
     netCfgLoggerEnable(hModule);
@@ -1025,7 +1168,7 @@ UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
     BOOL bSetupModeInteractive = SetupSetNonInteractiveMode(FALSE);
 
     WCHAR wszMpInf[MAX_PATH];
-    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("VBoxNetAdp.inf") - 1;
+    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - wcslen(pwszInfName) - 1 - 1;
     LPCWSTR pwszInfPath = NULL;
     bool bIsFile = false;
     UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", wszMpInf, &cchMpInf);
@@ -1040,7 +1183,7 @@ UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
                 wszMpInf[cchMpInf]   = L'\0';
             }
 
-            wcscat(wszMpInf, L"VBoxNetAdp.inf");
+            wcscat(wszMpInf, pwszInfName);
             pwszInfPath = wszMpInf;
             bIsFile = true;
 
@@ -1059,7 +1202,7 @@ UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
                            pwszInfPath);
 
                 BOOL fRebootRequired = FALSE;
-                HRESULT hr = VBoxNetCfgWinUpdateHostOnlyNetworkInterface(pwszInfPath, &fRebootRequired);
+                HRESULT hr = VBoxNetCfgWinUpdateHostOnlyNetworkInterface(pwszInfPath, &fRebootRequired, pwszId);
                 if (SUCCEEDED(hr))
                 {
                     if (fRebootRequired)
@@ -1091,7 +1234,17 @@ UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
     return ERROR_SUCCESS;
 }
 
-UINT __stdcall UninstallNetAdp(MSIHANDLE hModule)
+UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
+{
+    return _updateHostOnlyInterfaces(hModule, L"VBoxNetAdp.inf", NETADP_ID);
+}
+
+UINT __stdcall Ndis6UpdateHostOnlyInterfaces(MSIHANDLE hModule)
+{
+    return _updateHostOnlyInterfaces(hModule, L"VBoxNetAdp6.inf", NETADP_ID);
+}
+
+static UINT _uninstallNetAdp(MSIHANDLE hModule, LPCWSTR pwszId)
 {
 #ifdef VBOX_WITH_NETFLT
     INetCfg *pNetCfg;
@@ -1108,7 +1261,7 @@ UINT __stdcall UninstallNetAdp(MSIHANDLE hModule)
         uErr = doNetCfgInit(hModule, &pNetCfg, TRUE);
         if (uErr == ERROR_SUCCESS)
         {
-            HRESULT hr = VBoxNetCfgWinNetAdpUninstall(pNetCfg);
+            HRESULT hr = VBoxNetCfgWinNetAdpUninstall(pNetCfg, pwszId);
             if (hr != S_OK)
                 logStringW(hModule, L"UninstallNetAdp: VBoxNetCfgWinUninstallComponent failed, error = 0x%x", hr);
 
@@ -1136,6 +1289,11 @@ UINT __stdcall UninstallNetAdp(MSIHANDLE hModule)
     return ERROR_SUCCESS;
 }
 
+UINT __stdcall UninstallNetAdp(MSIHANDLE hModule)
+{
+    return _uninstallNetAdp(hModule, NETADP_ID);
+}
+
 static bool isTAPDevice(const WCHAR *pwszGUID)
 {
     HKEY hNetcard;
diff --git a/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.def b/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.def
index c408e3d..620acd8 100644
--- a/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.def
+++ b/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.def
@@ -24,10 +24,15 @@ EXPORTS
     UninstallBranding
     InstallNetFlt
     UninstallNetFlt
+	UninstallNetAdp
+	InstallNetLwf
+    UninstallNetLwf
     UninstallTAPInstances
     CreateHostOnlyInterface
     StopHostOnlyInterfaces
     UpdateHostOnlyInterfaces
     RemoveHostOnlyInterfaces
-    UninstallNetAdp
+    Ndis6CreateHostOnlyInterface
+    Ndis6UpdateHostOnlyInterfaces
+
 
diff --git a/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.rc b/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.rc
index 772403b..66fc00e 100644
--- a/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.rc
+++ b/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Installation Helper\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxInstallHelper\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxInstallHelper.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Installer/win/Makefile.kmk b/src/VBox/Installer/win/Makefile.kmk
index c731135..c1f7acb 100644
--- a/src/VBox/Installer/win/Makefile.kmk
+++ b/src/VBox/Installer/win/Makefile.kmk
@@ -146,9 +146,10 @@ OTHER_CLEAN += \
 		$(VBOX_WIN_INST_OUT_DIR)/NLS/$(lang).mst \
 		$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj \
 		$(VBOX_WIN_INST_OUT_DIR)/$(PACKAGE_NAME_LANG)_$(lang).msi) \
+	$(VBOX_WIN_INST_OUT_DIR)/DirComponentsAndFiles_DTrace.wxi \
+	$(VBOX_WIN_INST_OUT_DIR)/Files_Main.wxi \
 	$(VBOX_WIN_INST_OUT_DIR)/Files_Doc.wxi \
 	$(VBOX_WIN_INST_OUT_DIR)/Files_License.wxi \
-	$(VBOX_WIN_INST_OUT_DIR)/Files_Main.wxi \
 	$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi
 
 ifdef VBOX_WITH_COMBINED_PACKAGE
@@ -304,6 +305,44 @@ $(VBOX_WIN_INST_OUT_DIR)/Files_License.wxi: $(MAKEFILE_CURRENT) | $$(dir $$@)
 	             '	</File>')
 	$(APPEND) $@ '</Include>'
 
+$(VBOX_WIN_INST_OUT_DIR)/DirComponentsAndFiles_DTrace.wxi: $(MAKEFILE_CURRENT) $(PATH_SUB_CURRENT)/../Config.kmk | $$(dir $$@)
+	$(call MSG_GENERATE,,$@,$<)
+	$(QUIET)$(APPEND) -nt "$@" \
+		'<?xml version="1.0" ?>' \
+		'<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">'
+ifdef VBOX_WITH_DTRACE
+	$(QUIET)$(APPEND) -n "$@" \
+		'<Directory Id="dir_DTrace" Name="dtrace">' \
+		'  <Directory Id="dir_DTrace_lib" Name="lib">' \
+		'    <Directory Id="dir_DTrace_lib_arch" Name="$(KBUILD_TARGET_ARCH)">' \
+               '      <Component Id="cp_dir_DTrace_lib_arch" Guid="7476CDF6-4157-2E17-5CCC-FF92528D2854" Win64="$$(var.Property_Win64)">' \
+		$(foreach file, $(VBOXINST_DTRACE_LIB_ARCH_FILES) \
+                	, '        <File Id="file_dtrace_lib_arch_$(subst -,_,$(file))" Name="$(file)" Vital="yes" ' \
+			  '              Source="$(PATH_STAGE_BIN)/dtrace/lib/$(KBUILD_TARGET_ARCH)/$(file)" />' ) \
+		'      </Component>' \
+		'    </Directory>' \
+		'  </Directory>' \
+		'  <Directory Id="dir_DTrace_testcase" Name="testcase">' \
+		'    <Directory Id="dir_DTrace_testcase_arch" Name="$(KBUILD_TARGET_ARCH)">' \
+               '      <Component Id="cp_dir_DTrace_testcase_arch" Guid="45DF7014-4431-6C40-6DB0-35AF7C690EE1" Win64="$$(var.Property_Win64)">' \
+		$(foreach file, $(VBOXINST_DTRACE_TESTCASE_ARCH_FILES) \
+                	, '        <File Id="file_dtrace_testcase_arch_$(subst -,_,$(file))" Name="$(file)" Vital="yes" ' \
+			  '              Source="$(PATH_STAGE_BIN)/dtrace/testcase/$(KBUILD_TARGET_ARCH)/$(file)" />' ) \
+		'      </Component>' \
+		'    </Directory>' \
+		'  </Directory>' \
+		'  <Directory Id="dir_DTrace_scripts" Name="scripts">' \
+               '    <Component Id="cp_dir_DTrace_scripts" Guid="AE07F9D5-4FD9-ACC7-C760-E9923CE01E16" Win64="$$(var.Property_Win64)">' \
+		$(foreach file, $(VBOXINST_DTRACE_SCRIPTS_FILES) \
+                	, '      <File Id="file_dtrace_scripts_$(subst -,_,$(file))" Name="$(file)" Vital="yes" ' \
+			  '            Source="$(PATH_STAGE_BIN)/dtrace/scripts/$(file)" />' ) \
+		'    </Component>' \
+		'  </Directory>' \
+		'</Directory>'
+endif
+	$(QUIET)$(APPEND) "$@" '</Include>'
+
+
 $(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi: $(MAKEFILE_CURRENT) | $$(dir $$@)
 	$(call MSG_GENERATE,,$@,$<)
 	$(APPEND) -t $@ '<?xml version="1.0" ?>'
@@ -377,10 +416,7 @@ $(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
 # Note: This will clean up any previous .msm to prevent dep build boxes from
 #       filling up with old files.
 #
-# Note: Disable parallel jobs here because of shared common.cab access issues.
-#
 define def_vbox_link_msm
-.NOTPARALLEL: $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).msm
 $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).msm: \
 		$(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj \
 		$(VBOX_WIN_INST_OUT_DIR)/NLS/Language_$(lang).wxl \
@@ -410,93 +446,40 @@ $(if $(VBOX_WITH_MSM_INSTALL), \
 		$(foreach lang,$(VBOX_INSTALLER_MERGE_LANGUAGES), \
 			$(eval $(def_vbox_link_msm)))),)
 
-#
-# Load and adjust the MSI compile step dependencies.
-#
--include $(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep
-
-# Filter out some files depending on build type and compiler.
-ifeq ($(KBUILD_TYPE),release)
- VBOX_MSI_DEPENDENCIES := $(filer-out $(PATH_OUT)/bin/VBoxDbg3.dll, $(VBOX_MSI_DEPENDENCIES))
-endif
-ifndef VBOX_SIGNING_MODE
- VBOX_MSI_DEPENDENCIES := $(filer-out %.cat, $(VBOX_MSI_DEPENDENCIES))
-endif
-ifdef VBOX_USE_VCC110
- VBOX_MSI_DEPENDENCIES := $(filter-out \
-	$(PATH_OUT)/bin/msvcr100.dll \
-	$(PATH_OUT)/bin/msvcp100.dll \
-	, $(VBOX_MSI_DEPENDENCIES))
-else # VCC100
- VBOX_MSI_DEPENDENCIES := $(filter-out \
-	$(PATH_OUT)/bin/msvcr110.dll \
-	$(PATH_OUT)/bin/msvcp110.dll \
-	, $(VBOX_MSI_DEPENDENCIES))
-endif
-# TODO: Add filtering out more dependencies here!
-ifndef VBOX_WITH_QTGUI
- VBOX_MSI_DEPENDENCIES := $(filter-out \
-	$(PATH_OUT)/bin/VirtualBox.exe \
-	$(PATH_OUT)/bin/VBoxTestOGL.exe \
-	$(PATH_OUT)/bin/QtCoreVBox4.dll \
-	$(PATH_OUT)/bin/QtGuiVBox4.dll \
-	$(PATH_OUT)/bin/QtNetworkVBox4.dll \
-	$(PATH_OUT)/bin/QtOpenGLVBox4.dll \
-	$(PATH_OUT)/bin/accessible/qtaccessiblewidgets4.dll \
-	, $(VBOX_MSI_DEPENDENCIES))
-endif
-ifndef VBOX_WITH_PYTHON
- VBOX_MSI_DEPENDENCIES := $(filer-out $ \
-	$(PATH_OUT)/bin/sdk/installer/vboxapisetup.py \
-	$(PATH_OUT)/bin/sdk/installer/vboxapi/__init__.py \
-	$(PATH_OUT)/bin/sdk/installer/vboxapi/VirtualBox_constants.py \
-	, $(VBOX_MSI_DEPENDENCIES))
-endif
-ifndef VBOX_WITH_CROGL
- VBOX_MSI_DEPENDENCIES := $(filer-out $ \
-	$(PATH_OUT)/bin/VBoxOGLhostcrutil.dll \
-	$(PATH_OUT)/bin/VBoxOGLhosterrorspu.dll \
-	$(PATH_OUT)/bin/VBoxOGLrenderspu.dll \
-	$(PATH_OUT)/bin/VBoxSharedCrOpenGL.dll \
-	, $(VBOX_MSI_DEPENDENCIES))
-endif
-ifndef VBOX_WITH_SECURELABEL
- VBOX_MSI_DEPENDENCIES := $(filer-out $(PATH_OUT)/bin/SDL_ttf.dll, $(VBOX_MSI_DEPENDENCIES))
-endif
-ifndef VBOX_WITH_WEBSERVICES
- VBOX_MSI_DEPENDENCIES := $(filer-out $(PATH_OUT)/bin/vboxwebsrv.exe, $(VBOX_MSI_DEPENDENCIES))
-endif
-
-ifneq ($(KBUILD_TARGET_ARCH),amd64)
- VBOX_MSI_DEPENDENCIES := $(filter-out \
-	$(PATH_OUT)/bin/VBoxREM2.rel \
-	, $(VBOX_MSI_DEPENDENCIES))
-else
- VBOX_MSI_DEPENDENCIES := $(filter-out \
-	$(PATH_OUT)/bin/VBoxREM32.dll \
-	$(PATH_OUT)/bin/VBoxREM64.dll \
-	, $(VBOX_MSI_DEPENDENCIES))
-endif
-ifdef VBOX_WITH_EXTPACK_PUEL
- VBOX_MSI_DEPENDENCIES := $(filter-out $(PATH_OUT)/bin/VBoxVRDP$(VBOX_SUFF_DLL), $(VBOX_MSI_DEPENDENCIES))
-endif
 
-# Add dependencies that makes sure necessary bits gets built since
-# VBOX_MSI_DEPENDENCIES will be zero the first time around.
+#
+# Add dependencies that makes sure necessary bits gets built.
 # For combined packages we always use the .ISO from the amd64 build.
-VBOX_MSI_DEPENDENCIES := $(filter-out %/VBoxGuestAdditions.iso, $(VBOX_MSI_DEPENDENCIES))
+#
 ifdef VBOX_WITH_COMBINED_PACKAGE
- VBOX_MSI_DEPENDENCIES += \
+ VBOX_MSI_DEPENDENCIES := \
 	$(if $(VBOX_WITH_ADDITIONS_PACKING),$(PATH_MULTIARCH_GUEST_ADDITIONS_ISO)/VBoxGuestAdditions.iso)
 else
- VBOX_MSI_DEPENDENCIES += \
+ VBOX_MSI_DEPENDENCIES := \
 	$(if $(VBOX_WITH_ADDITIONS_PACKING),$(VBOX_PATH_ADDITIONS_ISO)/VBoxGuestAdditions.iso)
 endif
 
 #
+# A few manual dependencies to make sure everything is rebuilt when they should.
+#
+$(PATH_SUB_CURRENT)/VirtualBox.wxs: \
+	$(PATH_SUB_CURRENT)/Properties.wxi \
+	$(PATH_SUB_CURRENT)/VBoxMergeApp.wxi
+
+$(PATH_SUB_CURRENT)/VBoxMergeApp.wxi $(PATH_SUB_CURRENT)/VirtualBox.wxs: \
+	$(VBOX_WIN_INST_OUT_DIR)/Files_Doc.wxi \
+	$(VBOX_WIN_INST_OUT_DIR)/DirComponentsAndFiles_DTrace.wxi \
+	$(VBOX_WIN_INST_OUT_DIR)/Files_License.wxi \
+	$(VBOX_WIN_INST_OUT_DIR)/Files_Main.wxi \
+	$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
+	$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi \
+	$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi
+
+#
 # MSI compile.
 #
 define def_vbox_compile_wixobj
+includedep $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj.dep
 $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj: \
 			$(PATH_SUB_CURRENT)/VirtualBox.wxs \
 			$(PATH_SUB_CURRENT)/UserInterface.wxi \
@@ -513,16 +496,16 @@ $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj: \
 			| $$$$(dir $$$$@)
 	$(QUIET)$(RM) -f $@
 	$(REDIRECT) \
-		-E 'PATH_OUT=$(subst /,\\,$(PATH_OUT))' \
-		-E 'PATH_TARGET=$(subst /,\\,$(VBOX_WIN_INST_OUT_DIR))' \
-		-E 'PATH_ROOT=$(subst /,\\,$(PATH_ROOT))' \
-		-E 'PATH_MULTIARCH_GUEST_ADDITIONS_ISO=$(subst /,\\,$(PATH_MULTIARCH_GUEST_ADDITIONS_ISO))' \
-		-E 'VBOX_PATH_WIN_INST_SRC=$(subst /,\\,$(VBOX_PATH_WIN_INST_SRC))' \
-		-E 'VBOX_BRAND_WIN_INST_DLGJPG=$(subst /,\\,$(VBOX_BRAND_WIN_INST_DLGJPG))' \
+		-E 'PATH_OUT=$(subst /,\,$(PATH_OUT))' \
+		-E 'PATH_TARGET=$(subst /,\,$(VBOX_WIN_INST_OUT_DIR))' \
+		-E 'PATH_ROOT=$(subst /,\,$(PATH_ROOT))' \
+		-E 'PATH_MULTIARCH_GUEST_ADDITIONS_ISO=$(subst /,\,$(PATH_MULTIARCH_GUEST_ADDITIONS_ISO))' \
+		-E 'VBOX_PATH_WIN_INST_SRC=$(subst /,\,$(VBOX_PATH_WIN_INST_SRC))' \
+		-E 'VBOX_BRAND_WIN_INST_DLGJPG=$(subst /,\,$(VBOX_BRAND_WIN_INST_DLGJPG))' \
 		-E 'VBOX_ADD_LANGUAGES=$(VBOX_INSTALLER_ADD_LANGUAGES)' \
-		-E 'VBOX_BRAND_LICENSE_RTF=$(subst /,\\,$(VBOX_BRAND_LICENSE_RTF))' \
+		-E 'VBOX_BRAND_LICENSE_RTF=$(subst /,\,$(VBOX_BRAND_LICENSE_RTF))' \
 		$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
-			-E 'VBOX_BRAND_$(lang)_LICENSE_RTF=$(subst /,\\,$(VBOX_BRAND_$(subst en_US_,,$(lang)_)LICENSE_RTF))') \
+			-E 'VBOX_BRAND_$(lang)_LICENSE_RTF=$(subst /,\,$(VBOX_BRAND_$(subst en_US_,,$(lang)_)LICENSE_RTF))') \
 		-E 'VBOX_BUILD_NR_FOR_INST=$(VBOX_VERSION_BUILD)' \
 		-E 'VBOX_VENDOR=$(VBOX_VENDOR)' \
 		-E 'VBOX_VENDOR_SHORT=$(VBOX_VENDOR_SHORT)' \
@@ -543,6 +526,7 @@ $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj: \
 		-E 'VBOX_WITH_CROGL=$(if $(VBOX_WITH_CROGL),yes,no)' \
 		-E 'VBOX_WITH_DEBUGGER_GUI=$(if-expr defined(VBOX_WITH_DEBUGGER_GUI) && defined(VBOX_WITH_QTGUI),yes,no)' \
 		-E 'VBOX_WITH_DOCS_PACKING=$(if $(VBOX_WITH_DOCS_PACKING),yes,no)' \
+		-E 'VBOX_WITH_DTRACE=$(if $(VBOX_WITH_DTRACE),yes,no)' \
 		-E 'VBOX_WITH_EFIFW_PACKING=$(if $(VBOX_WITH_EFIFW_PACKING),yes,no)' \
 		-E 'VBOX_WITH_EXTPACK=$(if $(VBOX_WITH_EXTPACK),yes,no)' \
 		-E 'VBOX_WITH_GUEST_CONTROL=$(if $(VBOX_WITH_GUEST_CONTROL),yes,no)' \
@@ -559,7 +543,7 @@ $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj: \
 		-E 'VBOX_WITH_MSM_INSTALL=$(if $(VBOX_WITH_MSM_INSTALL),yes,no)' \
 		-E 'VBOX_WITH_SERIALNUMBER_INSTALL=$(if $(VBOX_WITH_SERIALNUMBER_INSTALL),yes,no)' \
 		-E 'VBOX_WITH_LICENSE_DISPLAY=$(if $(VBOX_WITH_LICENSE_DISPLAY),yes,no)' \
-		-E 'VBOX_WINDOWS_ICON_FILE=$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))' \
+		-E 'VBOX_WINDOWS_ICON_FILE=$(subst /,\,$(VBOX_WINDOWS_ICON_FILE))' \
 		-E 'BUILD_TYPE=$(KBUILD_TYPE)' \
 		-E 'BUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH)' \
 		-E 'VBOX_VCC_TOOL_STEM=$(VBOX_VCC_TOOL_STEM)' \
@@ -568,21 +552,11 @@ $(VBOX_WIN_INST_OUT_DIR)/VirtualBox_$(lang).wixobj: \
 			-ext $(VBOX_PATH_WIX)/WixUIExtension.dll \
 			-ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \
 			-out $$@
-ifeq ($(lang),en_US)
-#
-# Generate dependency file, we share this between all the languages.
-#
-	$(APPEND) -t $(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep 'VBOX_MSI_DEPENDENCIES = \'
-	$(SED) -f $(VBOX_PATH_WIN_INST_SRC)/dep.sed \
-		--append $(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep \
-		$(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
-			$(VBOX_PATH_WIN_INST_SRC)/VBoxMerge$(module).wxi) \
-		$(VBOX_PATH_WIN_INST_SRC)/VirtualBox.wxs \
-		$(VBOX_PATH_WIN_INST_SRC)/UserInterface.wxi \
-		$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
-		$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,)
-	$(APPEND) $(VBOX_WIN_INST_OUT_DIR)/VirtualBox.wixobj.dep ''
-endif
+# Generate wxi dependencies based on the sourceLineNumber references in the output.
+	$(QUIET)$(APPEND) -t '$$@.dep' '$$@: \'
+	$(QUIET)$(VBOX_XSLTPROC) $(VBOX_PATH_WIN_INST_SRC)/dep.xsl "$$@" >> "$$@.dep"
+	$(QUIET)$(VBOX_XSLTPROC) $(VBOX_PATH_WIN_INST_SRC)/dep2.xsl "$$@" | sort  | $(SED) '$!N; /^\(.*\)\n\1$$$$/!P; D' >> "$$@.dep"
+	$(QUIET)$(APPEND) -n '$$@.dep' '' ''
 endef
 
 $(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
@@ -592,32 +566,33 @@ $(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
 # MSM (merge module) compile.
 #
 define def_vbox_compile_msm
+includedep $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj
 $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj: \
-			$(PATH_SUB_CURRENT)/VBoxMerge$(module).wxs \
-			$(PATH_SUB_CURRENT)/VBoxMerge$(module).wxi \
-			$(PATH_SUB_CURRENT)/VBoxMerge$(module)CA.wxi \
-			$(PATH_SUB_CURRENT)/VBoxMerge$(module)Seq.wxi \
-			$(PATH_SUB_CURRENT)/UserInterface.wxi \
-			$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi \
-			$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
-			$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,) \
-			$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
-			$(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
-			$(VBOX_MSI_DEPENDENCIES) \
-			$(VBOX_VERSION_STAMP) \
-			| $$$$(dir $$$$@)
+		$(PATH_SUB_CURRENT)/VBoxMerge$(module).wxs \
+		$(PATH_SUB_CURRENT)/VBoxMerge$(module).wxi \
+		$(PATH_SUB_CURRENT)/VBoxMerge$(module)CA.wxi \
+		$(PATH_SUB_CURRENT)/VBoxMerge$(module)Seq.wxi \
+		$(PATH_SUB_CURRENT)/UserInterface.wxi \
+		$(VBOX_WIN_INST_OUT_DIR)/Shortcuts_StartMenu.wxi \
+		$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
+		$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,) \
+		$(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
+		$(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
+		$(VBOX_MSI_DEPENDENCIES) \
+		$(VBOX_VERSION_STAMP) \
+		| $$$$(dir $$$$@)
 	$(QUIET)$(RM) -f $@
 	$(REDIRECT) \
-		-E 'PATH_OUT=$(subst /,\\,$(PATH_OUT))' \
-		-E 'PATH_TARGET=$(subst /,\\,$(VBOX_WIN_INST_OUT_DIR))' \
-		-E 'PATH_ROOT=$(subst /,\\,$(PATH_ROOT))' \
-		-E 'PATH_MULTIARCH_GUEST_ADDITIONS_ISO=$(subst /,\\,$(PATH_MULTIARCH_GUEST_ADDITIONS_ISO))' \
-		-E 'VBOX_PATH_WIN_INST_SRC=$(subst /,\\,$(VBOX_PATH_WIN_INST_SRC))' \
-		-E 'VBOX_BRAND_WIN_INST_DLGJPG=$(subst /,\\,$(VBOX_BRAND_WIN_INST_DLGJPG))' \
+		-E 'PATH_OUT=$(subst /,\,$(PATH_OUT))' \
+		-E 'PATH_TARGET=$(subst /,\,$(VBOX_WIN_INST_OUT_DIR))' \
+		-E 'PATH_ROOT=$(subst /,\,$(PATH_ROOT))' \
+		-E 'PATH_MULTIARCH_GUEST_ADDITIONS_ISO=$(subst /,\,$(PATH_MULTIARCH_GUEST_ADDITIONS_ISO))' \
+		-E 'VBOX_PATH_WIN_INST_SRC=$(subst /,\,$(VBOX_PATH_WIN_INST_SRC))' \
+		-E 'VBOX_BRAND_WIN_INST_DLGJPG=$(subst /,\,$(VBOX_BRAND_WIN_INST_DLGJPG))' \
 		-E 'VBOX_ADD_LANGUAGES=$(VBOX_INSTALLER_ADD_LANGUAGES)' \
-		-E 'VBOX_BRAND_LICENSE_RTF=$(subst /,\\,$(VBOX_BRAND_LICENSE_RTF))' \
+		-E 'VBOX_BRAND_LICENSE_RTF=$(subst /,\,$(VBOX_BRAND_LICENSE_RTF))' \
 		$(foreach lang,$(VBOX_INSTALLER_LANGUAGES), \
-			-E 'VBOX_BRAND_$(lang)_LICENSE_RTF=$(subst /,\\,$(VBOX_BRAND_$(subst en_US_,,$(lang)_)LICENSE_RTF))') \
+			-E 'VBOX_BRAND_$(lang)_LICENSE_RTF=$(subst /,\,$(VBOX_BRAND_$(subst en_US_,,$(lang)_)LICENSE_RTF))') \
 		-E 'VBOX_BUILD_NR_FOR_INST=$(VBOX_VERSION_BUILD)' \
 		-E 'VBOX_VENDOR=$(VBOX_VENDOR)' \
 		-E 'VBOX_VENDOR_SHORT=$(VBOX_VENDOR_SHORT)' \
@@ -635,6 +610,7 @@ $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj: \
 		-E 'VBOX_WITH_CROGL=$(if $(VBOX_WITH_CROGL),yes,no)' \
 		-E 'VBOX_WITH_DEBUGGER_GUI=$(if-expr defined(VBOX_WITH_DEBUGGER_GUI) && defined(VBOX_WITH_QTGUI),yes,no)' \
 		-E 'VBOX_WITH_DOCS_PACKING=$(if $(VBOX_WITH_DOCS_PACKING),yes,no)' \
+		-E 'VBOX_WITH_DTRACE=$(if $(VBOX_WITH_DTRACE),yes,no)' \
 		-E 'VBOX_WITH_EFIFW_PACKING=$(if $(VBOX_WITH_EFIFW_PACKING),yes,no)' \
 		-E 'VBOX_WITH_EXTPACK=$(if $(VBOX_WITH_EXTPACK),yes,no)' \
 		-E 'VBOX_WITH_GUEST_CONTROL=$(if $(VBOX_WITH_GUEST_CONTROL),yes,no)' \
@@ -651,7 +627,7 @@ $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj: \
 		-E 'VBOX_WITH_SECURELABEL=$(if $(VBOX_WITH_SECURELABEL),yes,no)' \
 		-E 'VBOX_WITH_SERIALNUMBER_INSTALL=$(if $(VBOX_WITH_SERIALNUMBER_INSTALL),yes,no)' \
 		-E 'VBOX_WITH_LICENSE_DISPLAY=$(if $(VBOX_WITH_LICENSE_DISPLAY),yes,no)' \
-		-E 'VBOX_WINDOWS_ICON_FILE=$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))' \
+		-E 'VBOX_WINDOWS_ICON_FILE=$(subst /,\,$(VBOX_WINDOWS_ICON_FILE))' \
 		-E 'BUILD_TYPE=$(KBUILD_TYPE)' \
 		-E 'BUILD_TARGET_ARCH=$(KBUILD_TARGET_ARCH)' \
 		-E 'VBOX_VCC_TOOL_STEM=$(VBOX_VCC_TOOL_STEM)' \
@@ -660,19 +636,11 @@ $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module)_$(lang).wixobj: \
 			-ext $(VBOX_PATH_WIX)/WixUIExtension.dll \
 			-ext $(VBOX_PATH_WIX)/WixDifxAppExtension.dll \
 			-out $$@
-ifeq ($(lang),en_US)
-#
-# Generate dependency file, we share this between all the languages.
-#
-	$(APPEND) -t $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module).msm.dep 'VBOX_MSI_DEPENDENCIES = \'
-	$(SED) -f $(VBOX_PATH_WIN_INST_SRC)/dep.sed \
-		--append $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module).msm.dep \
-		$(VBOX_PATH_WIN_INST_SRC)/VBoxMerge$(module).wxi \
-		$(VBOX_PATH_WIN_INST_SRC)/UserInterface.wxi \
-		$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib.wxi \
-		$(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,)
-	$(APPEND) $(VBOX_WIN_INST_OUT_DIR)/VBoxMerge$(module).msm.dep ''
-endif
+# Generate wxi dependencies based on the sourceLineNumber references in the output.
+	$(QUIET)$(APPEND) -t '$$@.dep' '$$@: \'
+	$(QUIET)$(VBOX_XSLTPROC) $(VBOX_PATH_WIN_INST_SRC)/dep.xsl "$$@" >> "$$@.dep"
+	$(QUIET)$(VBOX_XSLTPROC) $(VBOX_PATH_WIN_INST_SRC)/dep2.xsl "$$@" | sort  | $(SED) '$!N; /^\(.*\)\n\1$$$$/!P; D' >> "$$@.dep"
+	$(QUIET)$(APPEND) -n '$$@.dep' '' ''
 endef
 
 $(foreach module,$(VBOX_INSTALLER_MERGE_MODULES), \
diff --git a/src/VBox/Installer/win/NLS/de_DE.wxl b/src/VBox/Installer/win/NLS/de_DE.wxl
index 23dcd96..a214f04 100644
--- a/src/VBox/Installer/win/NLS/de_DE.wxl
+++ b/src/VBox/Installer/win/NLS/de_DE.wxl
@@ -48,10 +48,12 @@
     <String Id="VB_App">[ProductName] Hauptanwendung.</String>
     <String Id="VB_USBDriver">[ProductName] Treiber für USB Geräte-Unterstützung.</String>
     <String Id="VB_Network">[ProductName] Treiber für Netzwerk-Unterstützung.</String>
-    <String Id="VB_NetFltDriver">[ProductName] Treiber für Bridged Networking.</String>
-    <String Id="VB_NetAdpDriver">[ProductName] Netzwerk-Adapter Treiber für Hostinterface-Networking.</String>
+    <String Id="VB_NetFltDriver">[ProductName] Treiber für Netzwerkbrücke.</String>
+    <String Id="VB_NetAdpDriver">[ProductName] Treiber für virtuellen Netzwerk-Adapter für Host-only Netzwerke.</String>
+    <String Id="VB_NetLwfDriver">[ProductName] Treiber für NDIS6-Netzwerkbrücke.</String>
+    <String Id="VB_NetAdp6Driver">[ProductName] Treiber für virtuellen Netzwerk-Adapter für NDIS6-Host-only-Netzwerke.</String>
 
-    <String Id="VB_Python">Python-Support für VirtualBox.</String>
+  <String Id="VB_Python">Python-Support für VirtualBox.</String>
 
     <!---->
 
@@ -123,6 +125,16 @@
 
     <!---->
 
+    <String Id="SelectionNetworkTypeDlg_CommonDescription">Please choose which type of network drivers you will use:</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS5">NDIS5 network drivers.
+This is default for older versions of Windows (pre-Vista).</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS6">NDIS6 network drivers.
+This is default for newer versions of Windows (Vista and newer).</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS5">Use NDIS5 network drivers.</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS6">Use NDIS6 network drivers.</String>
+
+    <!---->
+
     <String Id="WarnDisconNetIfacesDlg_Title">Warnung:</String>
     <String Id="WarnDisconNetIfacesDlg_Title2">Netzwerkschnittstellen</String>
     <String Id="WarnDisconNetIfacesDlg_Desc">Beim Installieren des [ProductName] Netzwerk-Features wird die Netzwerkverbindung unterbrochen und der Computer somit temporär vom Netzwerk getrennt.</String>
diff --git a/src/VBox/Installer/win/NLS/en_US.wxl b/src/VBox/Installer/win/NLS/en_US.wxl
index f773604..1c84a74 100644
--- a/src/VBox/Installer/win/NLS/en_US.wxl
+++ b/src/VBox/Installer/win/NLS/en_US.wxl
@@ -50,6 +50,8 @@
     <String Id="VB_Network">[ProductName] network device drivers for networking support.</String>
     <String Id="VB_NetFltDriver">[ProductName] driver for Bridged Networking.</String>
     <String Id="VB_NetAdpDriver">[ProductName] virtual network adapter driver for Host-Only Networking.</String>
+    <String Id="VB_NetLwfDriver">[ProductName] driver for NDIS6 Bridged Networking.</String>
+    <String Id="VB_NetAdp6Driver">[ProductName] virtual network adapter driver for NDIS6 Host-Only Networking.</String>
 
     <String Id="VB_Python">Python support for VirtualBox.</String>
 
@@ -127,6 +129,16 @@
 
     <!---->
 
+    <String Id="SelectionNetworkTypeDlg_CommonDescription">Please choose which type of network drivers you will use:</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS5">NDIS5 network drivers.
+This is default for older versions of Windows (pre-Vista).</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS6">NDIS6 network drivers.
+This is default for newer versions of Windows (Vista and newer).</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS5">Use NDIS5 network drivers.</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS6">Use NDIS6 network drivers.</String>
+
+    <!---->
+
     <String Id="WarnDisconNetIfacesDlg_Title">Warning:</String>
     <String Id="WarnDisconNetIfacesDlg_Title2">Network Interfaces</String>
     <String Id="WarnDisconNetIfacesDlg_Desc">Installing the [ProductName] Networking feature will reset your network connection and temporarily disconnect you from the network.</String>
diff --git a/src/VBox/Installer/win/NLS/fa_IR.wxl b/src/VBox/Installer/win/NLS/fa_IR.wxl
index 75f1956..54cc15b 100644
--- a/src/VBox/Installer/win/NLS/fa_IR.wxl
+++ b/src/VBox/Installer/win/NLS/fa_IR.wxl
@@ -45,7 +45,10 @@
     <String Id="VB_Network">درایور دستگاه شبکه [ProductName] برای پشتیبانی از شبکه.</String>
     <String Id="VB_NetFltDriver">درایور [ProductName] برای شبکه پل شده.</String>
     <String Id="VB_NetAdpDriver">درایور آداپتور شبکه مجازی [ProductName] برای شبکه فقط-میزبان.</String>
-    <String Id="VB_Python">پشتیبانی از پایتون برای ویرچوال باکس.</String>
+    <String Id="VB_NetLwfDriver">[ProductName] driver for NDIS6 Bridged Networking.</String>
+    <String Id="VB_NetAdp6Driver">[ProductName] virtual network adapter driver for NDIS6 Host-Only Networking.</String>
+
+  <String Id="VB_Python">پشتیبانی از پایتون برای ویرچوال باکس.</String>
     <!---->
     <String Id="NeedAdmin">برای حذف [ProductName] شما نیاز به اجازه مدیر دارید! این راه انداز حالا لغو میشود.</String>
     <String Id="WrongOS">این برنامه فقط در ویندوز ایکس پی یا بالاتر اِجرا میشود.</String>
@@ -97,6 +100,14 @@
     <String Id="Customize2Dlg_CreateQuickLaunch">ایجاد یک میانبر در اِجرای سریع</String>
     <String Id="Customize2Dlg_RegisterFileExtensions">ثبت نام انجمن فایل</String>
     <!---->
+    <String Id="SelectionNetworkTypeDlg_CommonDescription">Please choose which type of network drivers you will use:</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS5">NDIS5 network drivers.
+This is default for older versions of Windows (pre-Vista).</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS6">NDIS6 network drivers.
+This is default for newer versions of Windows (Vista and newer).</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS5">Use NDIS5 network drivers.</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS6">Use NDIS6 network drivers.</String>
+    <!---->
     <String Id="WarnDisconNetIfacesDlg_Title">هشدار:</String>
     <String Id="WarnDisconNetIfacesDlg_Title2">رابط های شبکه</String>
     <String Id="WarnDisconNetIfacesDlg_Desc">نصب ویژگی شبکه [ProductName] ارتباط شبکه شما را ریست خواهد کرد و موقتا ارتباط شما قطع خواهد شد.</String>
diff --git a/src/VBox/Installer/win/NLS/fr_FR.wxl b/src/VBox/Installer/win/NLS/fr_FR.wxl
index eb26d21..11a7f02 100644
--- a/src/VBox/Installer/win/NLS/fr_FR.wxl
+++ b/src/VBox/Installer/win/NLS/fr_FR.wxl
@@ -50,7 +50,10 @@
     <String Id="VB_Network">Pilotes [ProductName] pour le support réseau.</String>
     <String Id="VB_NetFltDriver">Pilote [ProductName] pour l'accès réseau par pont.</String>
     <String Id="VB_NetAdpDriver">Pilote de carte réseau virtuelle [ProductName] pour l'accès réseau privé hôte.</String>
-    <String Id="VB_Python">Python support for VirtualBox.</String>
+    <String Id="VB_NetLwfDriver">[ProductName] driver for NDIS6 Bridged Networking.</String>
+    <String Id="VB_NetAdp6Driver">[ProductName] virtual network adapter driver for NDIS6 Host-Only Networking.</String>
+
+  <String Id="VB_Python">Python support for VirtualBox.</String>
 
     <!---->
 
@@ -112,7 +115,7 @@
     <String Id="CustomizeDlg_SelItemPath"><Chemin de l'entrée sélectionnée></String>
 
     <!---->
-
+  
     <String Id="Customize2Dlg_Header">Personaliser</String>
     <String Id="Customize2Dlg_Desc">Veuillez choisir une des options suivantes:</String>
     <String Id="Customize2Dlg_CreateShortcut">Créer un raccourci sur le bureau</String>
@@ -121,6 +124,16 @@
 
     <!---->
 
+    <String Id="SelectionNetworkTypeDlg_CommonDescription">Veuillez choisir le type de pilotes réseau à utiliser :</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS5">NDIS5 network drivers.
+This is default for older versions of Windows (pre-Vista).</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS6">NDIS6 network drivers.
+This is default for newer versions of Windows (Vista and newer).</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS5">Utiliser pilotes réseau NDIS5.</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS6">Utiliser pilotes réseau NDIS6.</String>
+
+    <!---->
+
     <String Id="WarnDisconNetIfacesDlg_Title">Avertissement</String>
     <String Id="WarnDisconNetIfacesDlg_Title2">Interfaces réseau</String>
     <String Id="WarnDisconNetIfacesDlg_Desc">L'installation de la fonctionnalité réseau de [ProductName] réinitialisera votre connection réseau et vous déconnectera temporairement du réseau.</String>
diff --git a/src/VBox/Installer/win/NLS/it_IT.wxl b/src/VBox/Installer/win/NLS/it_IT.wxl
index b6d00e6..8519be0 100644
--- a/src/VBox/Installer/win/NLS/it_IT.wxl
+++ b/src/VBox/Installer/win/NLS/it_IT.wxl
@@ -45,7 +45,10 @@
     <String Id="VB_Network">Driver di [ProductName] per il supporto di rete.</String>
     <String Id="VB_NetFltDriver">Driver di [ProductName] per la rete con bridge.</String>
     <String Id="VB_NetAdpDriver">Driver per la scheda di rete virtuale di [ProductName] per la rete solo host.</String>
-    <String Id="VB_Python">Supporto Python per VirtualBox.</String>
+    <String Id="VB_NetLwfDriver">[ProductName] driver for NDIS6 Bridged Networking.</String>
+    <String Id="VB_NetAdp6Driver">[ProductName] virtual network adapter driver for NDIS6 Host-Only Networking.</String>
+
+  <String Id="VB_Python">Supporto Python per VirtualBox.</String>
     <!---->
     <String Id="NeedAdmin">Devi avere diritti di amministrazione per (dis)installare [ProductName]! L'installazione sarà interrotta immediatamente.</String>
     <String Id="WrongOS">Questa applicazione può essere eseguita solo su Windows XP o superiori.</String>
@@ -97,6 +100,14 @@
     <String Id="Customize2Dlg_CreateQuickLaunch">Crea una scorciatoia nella barra di avvio veloce</String>
     <String Id="Customize2Dlg_RegisterFileExtensions">Registrati associazioni di file</String>
     <!---->
+    <String Id="SelectionNetworkTypeDlg_CommonDescription">Please choose which type of network drivers you will use:</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS5">NDIS5 network drivers.
+This is default for older versions of Windows (pre-Vista).</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS6">NDIS6 network drivers.
+This is default for newer versions of Windows (Vista and newer).</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS5">Use NDIS5 network drivers.</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS6">Use NDIS6 network drivers.</String>
+    <!---->
     <String Id="WarnDisconNetIfacesDlg_Title">Avviso:</String>
     <String Id="WarnDisconNetIfacesDlg_Title2">Interfacce di rete</String>
     <String Id="WarnDisconNetIfacesDlg_Desc">L'installazione delle funzionalità di rete di [ProductName] ripristinerà la connessione di rete causando una disconnessione temporanea dalla rete.</String>
diff --git a/src/VBox/Installer/win/NLS/tr_TR.wxl b/src/VBox/Installer/win/NLS/tr_TR.wxl
index 508441d..cea17a2 100644
--- a/src/VBox/Installer/win/NLS/tr_TR.wxl
+++ b/src/VBox/Installer/win/NLS/tr_TR.wxl
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <WixLocalization xmlns="http://schemas.microsoft.com/wix/2006/localization" Codepage="1254" Culture="tr_TR">
 
     <!--
@@ -35,7 +35,7 @@
     <String Id="ButtonText_Ignore">Yok&say</String>
     <String Id="ButtonText_Exit">Çı&kış</String>
 
-	<String Id="InstallModeCustom">Özel</String>
+	  <String Id="InstallModeCustom">Özel</String>
     <String Id="Setup">Kur</String>
 
     <!---->
@@ -50,8 +50,10 @@
     <String Id="VB_Network">Ağ oluşturma desteği için [ProductName] ağ aygıtı sürücüleri.</String>
     <String Id="VB_NetFltDriver">Köprü Ağı Oluşturma için [ProductName] sürücüsü.</String>
     <String Id="VB_NetAdpDriver">Sadece-Anamakine Ağı Oluşturma için [ProductName] sanal ağ bağdaştırıcısı sürücüsü.</String>
+    <String Id="VB_NetLwfDriver">[ProductName] driver for NDIS6 Bridged Networking.</String>
+    <String Id="VB_NetAdp6Driver">[ProductName] virtual network adapter driver for NDIS6 Host-Only Networking.</String>
 
-    <String Id="VB_Python">VirtualBox için Python desteği.</String>
+  <String Id="VB_Python">VirtualBox için Python desteği.</String>
 
 	<!---->
 
@@ -117,7 +119,7 @@
     <String Id="CustomizeDlg_SelItemSize">CustomizeDlgItemSize-CustomizeDlgItemSize</String>
     <String Id="CustomizeDlg_SelItemPath">CustomizeDlgLocation-CustomizeDlgLocation</String>
 
-    <!---->
+	<!---->
 
 	<String Id="Customize2Dlg_Header">Özelleştir</String>
     <String Id="Customize2Dlg_Desc">Lütfen aşağıdaki seçeneklerden seçin:</String>
@@ -126,6 +128,16 @@
 
 	<!---->
 
+    <String Id="SelectionNetworkTypeDlg_CommonDescription">Please choose which type of network drivers you will use:</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS5">NDIS5 network drivers.
+This is default for older versions of Windows (pre-Vista).</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS6">NDIS6 network drivers.
+This is default for newer versions of Windows (Vista and newer).</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS5">Use NDIS5 network drivers.</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS6">Use NDIS6 network drivers.</String>
+
+	<!---->
+
 	<String Id="WarnDisconNetIfacesDlg_Title">Uyarı:</String>
     <String Id="WarnDisconNetIfacesDlg_Title2">Ağ Arayüzleri</String>
     <String Id="WarnDisconNetIfacesDlg_Desc">[ProductName] Ağ Oluşturma özelliği kurulumu ağ bağlantınızı sıfırlayacak ve geçici olarak ağınızın bağlantısını kesecek.</String>
diff --git a/src/VBox/Installer/win/NLS/zh_TW.wxl b/src/VBox/Installer/win/NLS/zh_TW.wxl
index 8af85c9..606ef14 100644
--- a/src/VBox/Installer/win/NLS/zh_TW.wxl
+++ b/src/VBox/Installer/win/NLS/zh_TW.wxl
@@ -50,8 +50,10 @@
     <String Id="VB_Network">[ProductName] 網路裝置驅動程式針對網路支援。</String>
     <String Id="VB_NetFltDriver">[ProductName] 驅動程式針對橋接網路。</String>
     <String Id="VB_NetAdpDriver">[ProductName] 虛擬網路介面卡針對「僅限主機」網路。</String>
+    <String Id="VB_NetLwfDriver">[ProductName] driver for NDIS6 Bridged Networking.</String>
+    <String Id="VB_NetAdp6Driver">[ProductName] virtual network adapter driver for NDIS6 Host-Only Networking.</String>
 
-    <String Id="VB_Python">VirtualBox 的 Python 支援。</String>
+  <String Id="VB_Python">VirtualBox 的 Python 支援。</String>
 
     <!---->
 
@@ -127,6 +129,16 @@
 
     <!---->
 
+    <String Id="SelectionNetworkTypeDlg_CommonDescription">Please choose which type of network drivers you will use:</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS5">NDIS5 network drivers.
+This is default for older versions of Windows (pre-Vista).</String>
+    <String Id="SelectionNetworkTypeDlg_DescriptionNDIS6">NDIS6 network drivers.
+This is default for newer versions of Windows (Vista and newer).</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS5">Use NDIS5 network drivers.</String>
+    <String Id="SelectionNetworkTypeDlg_RadioButtonNDIS6">Use NDIS6 network drivers.</String>
+
+    <!---->
+
     <String Id="WarnDisconNetIfacesDlg_Title">警告:</String>
     <String Id="WarnDisconNetIfacesDlg_Title2">網路介面</String>
     <String Id="WarnDisconNetIfacesDlg_Desc">安裝 [ProductName] 網路功能將重設您的網路連線並暫時中斷網路連線。</String>
diff --git a/src/VBox/Installer/win/Properties.wxi b/src/VBox/Installer/win/Properties.wxi
index 9b17c18..60ea881 100644
--- a/src/VBox/Installer/win/Properties.wxi
+++ b/src/VBox/Installer/win/Properties.wxi
@@ -28,7 +28,7 @@
       <?define Property_Platform     = "x64" ?>
       <?define Property_Win64        = "yes" ?>
 
-      <?if $(env.VBOX_SIGNING_MODE) != none ?>
+      <?if $(env.VBOX_SIGNING_MODE)!= none ?>
           <?define Property_DriverLegacy = "no" ?>
       <?else ?>
           <?define Property_DriverLegacy = "yes" ?>
@@ -39,7 +39,7 @@
       <?define Property_Platform     = "x86" ?>
       <?define Property_Win64        = "no" ?>
 
-      <?if $(env.VBOX_SIGNING_MODE) != none ?>
+      <?if $(env.VBOX_SIGNING_MODE)!= none ?>
           <!-- Note: Settings this to 'no' breaks Windows 2000 installs (!) -->
           <?define Property_DriverLegacy = "yes" ?>
       <?else ?>
diff --git a/src/VBox/Installer/win/Resources/VBoxRes.rc b/src/VBox/Installer/win/Resources/VBoxRes.rc
index a5a6162..a92e6c6 100644
--- a/src/VBox/Installer/win/Resources/VBoxRes.rc
+++ b/src/VBox/Installer/win/Resources/VBoxRes.rc
@@ -22,26 +22,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x2L
-   FILESUBTYPE          0x0L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DLL
+   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox Resources\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VBoxRes\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
          VALUE "OriginalFilename", "VBoxRes.dll\0"
-         VALUE "ProductName",      VBOX_PRODUCT "\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Installer/win/Stub/VBoxStub.cpp b/src/VBox/Installer/win/Stub/VBoxStub.cpp
index a60ee31..7540f50 100644
--- a/src/VBox/Installer/win/Stub/VBoxStub.cpp
+++ b/src/VBox/Installer/win/Stub/VBoxStub.cpp
@@ -638,10 +638,10 @@ static RTEXITCODE ProcessPackage(unsigned iPackage, const char *pszPkgDir, const
     RTPathChangeToDosSlashes(szPkgFile, true /* Force conversion. */); /* paranoia */
 
     RTEXITCODE rcExit;
-    const char *pszExt = RTPathExt(szPkgFile);
-    if (RTStrICmp(pszExt, ".msi") == 0)
+    const char *pszSuff = RTPathSuffix(szPkgFile);
+    if (RTStrICmp(pszSuff, ".msi") == 0)
         rcExit = ProcessMsiPackage(szPkgFile, pszMsiArgs, fLogging);
-    else if (RTStrICmp(pszExt, ".cab") == 0)
+    else if (RTStrICmp(pszSuff, ".cab") == 0)
         rcExit = RTEXITCODE_SUCCESS; /* Ignore .cab files, they're generally referenced by other files. */
     else
         rcExit = ShowError("Internal error: Do not know how to handle file '%s'.", pPackage->szFileName);
diff --git a/src/VBox/Installer/win/Stub/VBoxStub.rc b/src/VBox/Installer/win/Stub/VBoxStub.rc
index 04ef566..97f78dd 100644
--- a/src/VBox/Installer/win/Stub/VBoxStub.rc
+++ b/src/VBox/Installer/win/Stub/VBoxStub.rc
@@ -22,26 +22,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-   FILEVERSION          VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   PRODUCTVERSION       VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-   FILEFLAGSMASK        0x3fL
-   FILEFLAGS            0x0L
-   FILEOS               0x40004L
-   FILETYPE             0x2L
-   FILESUBTYPE          0x0L
+   FILEVERSION      VBOX_RC_FILE_VERSION
+   PRODUCTVERSION   VBOX_RC_FILE_VERSION
+   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
+   FILEFLAGS        VBOX_RC_FILE_FLAGS
+   FILEOS           VBOX_RC_FILE_OS
+   FILETYPE         VBOX_RC_TYPE_DLL
+   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
    BLOCK "StringFileInfo"
    BEGIN
       BLOCK "040904b0"
       BEGIN
-         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
          VALUE "FileDescription",  "VirtualBox\0"
-         VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
          VALUE "InternalName",     "VirtualBox\0"
-         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
          VALUE "OriginalFilename", "VirtualBox.exe\0"
-         VALUE "ProductName",      VBOX_PRODUCT "\0"
-         VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+         VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+         VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+         VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+         VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+         VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+         VBOX_RC_MORE_STRINGS
       END
    END
    BLOCK "VarFileInfo"
diff --git a/src/VBox/Installer/win/UserInterface.wxi b/src/VBox/Installer/win/UserInterface.wxi
index 904f73d..1905851 100644
--- a/src/VBox/Installer/win/UserInterface.wxi
+++ b/src/VBox/Installer/win/UserInterface.wxi
@@ -294,7 +294,15 @@
             </Control>
             <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.ButtonText_Next)">
         <?if $(env.VBOX_WITH_QTGUI) = "yes" ?>
-                <Publish Event="NewDialog" Value="VBoxCustomize2Dlg">1</Publish>
+                <!--
+                uncomment next two lines if there is a need in wizard page VBoxSelectionNetworkTypeDlg
+                don't forget to comment one line after
+                -->
+                <!--
+                <Publish Event="NewDialog" Value="VBoxSelectionNetworkTypeDlg"><![CDATA[VersionNT >= 600]]></Publish>
+                <Publish Event="NewDialog" Value="VBoxCustomize2Dlg"><![CDATA[VersionNT < 600]]></Publish>
+                -->
+                <Publish Event="NewDialog" Value="VBoxCustomize2Dlg"/>
         <?else ?>
                 <Publish Event="NewDialog" Value="VBoxVerifyReadyDlg">1</Publish>
         <?endif ?>
@@ -311,6 +319,60 @@
             </Control>
         </Dialog>
 
+        <!-- Dialog for selection network adapters type (NDIS5 or NDIS6) -->
+        <RadioButtonGroup Property="NETWORKTYPE">
+          <RadioButton Text="!(loc.SelectionNetworkTypeDlg_RadioButtonNDIS5)" Value="NDIS5" X="5" Y="0" Width="120" Height="20" />
+          <RadioButton Text="!(loc.SelectionNetworkTypeDlg_RadioButtonNDIS6)" Value="NDIS6" X="5" Y="20" Width="120" Height="20" />
+        </RadioButtonGroup>
+        <Dialog Id="VBoxSelectionNetworkTypeDlg" Width="370" Height="270" Title="[ProductName] !(loc.Setup)" NoMinimize="yes">
+            <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="[BannerBitmap]" />
+            <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+            <Control Id="Title" Type="Text" X="15" Y="6" Width="220" Height="40" Transparent="yes" NoPrefix="yes">
+                <Text>[DlgTitleFont]!(loc.CustomizeDlg_CustomSetup)</Text>
+            </Control>
+            <Control Id="Description" Type="Text" X="25" Y="23" Width="220" Height="20" Transparent="yes" NoPrefix="yes">
+                <Text>!(loc.CustomizeDlg_SelFeatures)</Text>
+            </Control>
+
+            <Control Id="CommonDescription" Type="Text" X="25" Y="55" Width="325" Height="20" Transparent="yes" NoPrefix="yes">
+              <Text>!(loc.SelectionNetworkTypeDlg_CommonDescription)</Text>
+            </Control>
+
+            <!-- The radio button group used for choosing NDIS5 or NDIS6 network drivers -->
+            <Control Id="Buttons" Type="RadioButtonGroup" X="25" Y="100" Width="130" Height="60" Property="NETWORKTYPE" />
+
+            <!-- Description text -->
+            <Control Id="DescriptionNDIS5" Type="Text" X="200" Y="105" Width="150" Height="60" Transparent="yes" NoPrefix="yes">
+              <Text>!(loc.SelectionNetworkTypeDlg_DescriptionNDIS5)</Text>
+              <Condition Action="hide"> NETWORKTYPE = "NDIS6"</Condition>
+              <Condition Action="show"> NETWORKTYPE = "NDIS5"</Condition>
+            </Control>
+            <Control Id="DescriptionNDIS6" Type="Text" X="200" Y="105" Width="150" Height="60" Transparent="yes" NoPrefix="yes">
+              <Text>!(loc.SelectionNetworkTypeDlg_DescriptionNDIS6)</Text>
+              <Condition Action="hide"> NETWORKTYPE = "NDIS5"</Condition>
+              <Condition Action="show"> NETWORKTYPE = "NDIS6"</Condition>
+            </Control>
+
+            <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17"
+                Default="yes" Cancel="yes" Text="!(loc.ButtonText_Next)">
+                <Publish Event="NewDialog" Value="VBoxCustomize2Dlg">1</Publish>
+            </Control>
+            <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17"
+                Text="!(loc.ButtonText_Back)">
+                <Publish Event="NewDialog" Value="VBoxCustomizeDlg">1</Publish>
+            </Control>
+            <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17"
+                Text="!(loc.ButtonText_Cancel)">
+                <Publish Event="SpawnDialog" Value="VBoxCancelDlg">1</Publish>
+            </Control>
+
+            <!-- Build number text drawn left bottom -->
+            <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+            <Control Id="Build" Type="Text" X="20" Y="247" Width="220" Height="10" Transparent="yes" NoPrefix="yes">
+                <Text>[Version_text] $(var.Property_Version)</Text>
+            </Control>
+        </Dialog>
+
         <Dialog Id="VBoxCustomize2Dlg" Width="370" Height="270" Title="[ProductName] !(loc.Setup)" NoMinimize="yes">
             <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="[BannerBitmap]" />
             <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
@@ -345,7 +407,7 @@
             <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17"
                 Default="yes" Cancel="yes" Text="!(loc.ButtonText_Next)">
             <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
-                <Publish Event="NewDialog" Value="VBoxWarnDisconNetIfacesDlg"><![CDATA[(&VBoxNetworkFlt=3) AND NOT(!VBoxNetworkFlt=3)]]></Publish>
+                <Publish Event="NewDialog" Value="VBoxWarnDisconNetIfacesDlg"><![CDATA[(&VBoxNetworkFlt=3)]]></Publish>
                 <Publish Event="NewDialog" Value="VBoxVerifyReadyDlg"><![CDATA[(&VBoxNetworkFlt<3)]]></Publish>
             <?else ?>
                 <Publish Event="NewDialog" Value="VBoxVerifyReadyDlg">1</Publish>
@@ -353,7 +415,15 @@
             </Control>
             <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17"
                 Text="!(loc.ButtonText_Back)">
-                <Publish Event="NewDialog" Value="VBoxCustomizeDlg">1</Publish>
+                <!--
+                uncomment next two lines if there is a need in wizard page VBoxSelectionNetworkTypeDlg
+                don't forget to comment one line after
+                -->
+                <!--
+                <Publish Event="NewDialog" Value="VBoxSelectionNetworkTypeDlg"><![CDATA[VersionNT >= 600]]></Publish>
+                <Publish Event="NewDialog" Value="VBoxCustomizeDlg"><![CDATA[VersionNT < 600]]></Publish>
+                -->
+                <Publish Event="NewDialog" Value="VBoxCustomizeDlg"/>
             </Control>
             <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17"
                 Text="!(loc.ButtonText_Cancel)">
diff --git a/src/VBox/Installer/win/VBoxMergeApp.wxi b/src/VBox/Installer/win/VBoxMergeApp.wxi
index 714eee4..76df976 100644
--- a/src/VBox/Installer/win/VBoxMergeApp.wxi
+++ b/src/VBox/Installer/win/VBoxMergeApp.wxi
@@ -30,13 +30,13 @@
     <Directory Id="dir_VBoxAppDrivers" Name="drivers">
         <Directory Id="dir_VBoxAppVBoxDrv" Name="vboxdrv">
             <Component Id="cp_VBoxDrv" Guid="D3E2F2BB-569F-46A2-836C-BDF30FF1EDF8" Win64="$(var.Property_Win64)">
-                <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
-                                Legacy="$(var.Property_DriverLegacy)" Sequence="2" PlugAndPlayPrompt="no"/>
+                <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes" DeleteFiles="yes"
+                      Legacy="$(var.Property_DriverLegacy)" Sequence="2" PlugAndPlayPrompt="no"/>
                 <File Id="file_VBoxDrv.sys" Name="VBoxDrv.sys" KeyPath="yes"
                       Source="$(env.PATH_OUT)\bin\VBoxDrv.sys"/>
                 <File Id="file_VBoxDrv.inf" Name="VBoxDrv.inf"
                       Source="$(env.PATH_OUT)\bin\VBoxDrv.inf" />
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
+<?if $(env.VBOX_SIGNING_MODE)!= none ?>
                 <File Id="file_VBoxDrv.cat" Name="VBoxDrv.cat"
                       Source="$(env.PATH_OUT)\bin\VBoxDrv.cat" />
 <?endif ?>
@@ -76,6 +76,9 @@
 
     </Component>
 
+    <?include $(env.PATH_TARGET)\DirComponentsAndFiles_DTrace.wxi ?>
+
+
     <!--
 
     <Component Id="cp_StartMenuShortcut" Guid="1C137D24-E599-47BD-98D0-2F62F202A8EA" Win64="$(var.Property_Win64)">
@@ -161,6 +164,8 @@
 <?endif ?>
         <File Id="file_VBoxBalloonCtrl.exe" Name="VBoxBalloonCtrl.exe"
               Source="$(env.PATH_OUT)\bin\VBoxBalloonCtrl.exe"/>
+        <File Id="file_vbox_img.exe" Name="vbox-img.exe"
+              Source="$(env.PATH_OUT)\bin\vbox-img.exe"/>
 
         <!-- Misc tools -->
         <File Id="file_VBoxNetDHCP.exe" Name="VBoxNetDHCP.exe"
@@ -181,6 +186,9 @@
         <File Id="file_VBoxExtPackHelperApp.exe" Name="VBoxExtPackHelperApp.exe"
               Source="$(env.PATH_OUT)\bin\VBoxExtPackHelperApp.exe"/>
 <?endif ?>
+<?if $(env.VBOX_WITH_DTRACE) = "yes" ?>
+	 <File Id="file_VBoxDTrace.exe" Name="VBoxDTrace.exe" Source="$(env.PATH_OUT)\bin\VBoxDTrace.exe" />
+<?endif ?>
         <!-- VBox DLL files -->
         <File Id="file_VBoxDD.dll" Name="VBoxDD.dll"
               Source="$(env.PATH_OUT)\bin\VBoxDD.dll" />
@@ -271,6 +279,8 @@
 <?if $(env.VBOX_WITH_DEBUGGER_GUI) = "yes" ?>
         <File Id="file_VBoxDbg.dll" Name="VBoxDbg.dll"
               Source="$(env.PATH_OUT)\bin\VBoxDbg.dll" />
+        <File Id="file_DbgPlugInDiggers.dll" Name="DbgPlugInDiggers.dll"
+              Source="$(env.PATH_OUT)\bin\DbgPlugInDiggers.dll" />
 <?endif ?>
 <?if $(env.VBOX_GUI_USE_QGL) = "yes" ?>
         <File Id="file_QtOpenGLVBox4.dll" Name="QtOpenGLVBox4.dll"
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdp.wxi b/src/VBox/Installer/win/VBoxMergeNetAdp.wxi
index 3c700d9..d167451 100644
--- a/src/VBox/Installer/win/VBoxMergeNetAdp.wxi
+++ b/src/VBox/Installer/win/VBoxMergeNetAdp.wxi
@@ -24,6 +24,7 @@
         <File Id="file_VBoxNetAdp.cat" Name="VBoxNetAdp.cat"
               Source="$(env.PATH_OUT)\bin\VBoxNetAdp.cat" />
 <?endif ?>
+        <Condition><![CDATA[NETWORKTYPE="NDIS5"]]></Condition>
     </Component>
 
 </Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdp6.wxi b/src/VBox/Installer/win/VBoxMergeNetAdp6.wxi
new file mode 100644
index 0000000..df48828
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetAdp6.wxi
@@ -0,0 +1,30 @@
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Component Id="cp_NetAdp6Driver" Guid="945d9537-e60d-4bbf-9422-239739e31092" Win64="$(var.Property_Win64)">
+        <File Id="file_VBoxNetAdp6.sys" Name="VBoxNetAdp6.sys" KeyPath="yes"
+              Source="$(env.PATH_OUT)\bin\VBoxNetAdp6.sys" Checksum="yes"/>
+        <File Id="file_VBoxNetAdp6.inf" Name="VBoxNetAdp6.inf"
+              Source="$(env.PATH_OUT)\bin\VBoxNetAdp6.inf" />
+<?if $(env.VBOX_SIGNING_MODE) != none ?>
+        <File Id="file_VBoxNetAdp6.cat" Name="VBoxNetAdp6.cat"
+              Source="$(env.PATH_OUT)\bin\VBoxNetAdp6.cat" />
+<?endif ?>
+        <Condition><![CDATA[NETWORKTYPE="NDIS6"]]></Condition>
+    </Component>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdp6.wxs b/src/VBox/Installer/win/VBoxMergeNetAdp6.wxs
new file mode 100644
index 0000000..81ee41f
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetAdp6.wxs
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<?include Properties.wxi ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Module Id="msm_VBoxNetworkAdp6"
+            Language="!(loc.LANG)"
+            Version="$(var.Property_Version)">
+
+        <Package Id="f6f83806-bd72-477d-af1d-275dca62cb6d"
+                 Keywords="Installer, Setup"
+                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) NetAdp6 installation package"
+                 Comments="$(env.VBOX_PRODUCT) NetAdp6 installation package"
+                 Manufacturer="$(env.VBOX_VENDOR)"
+                 InstallerVersion="200"
+                 AdminImage="yes"
+                 InstallPrivileges="elevated"
+                 Platform="$(var.Property_Platform)"
+                 SummaryCodepage="1252"/>
+
+        <!-- Here comes the file/directory list -->
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="msm_VBoxNetworkAdp6Folder" FileSource=".">
+
+                <?include VBoxMergeNetAdp6.wxi ?>
+
+            </Directory> <!-- msm_VBoxNetworkAdp6Folder -->
+        </Directory> <!-- TARGETDIR -->
+
+        <!-- Custom actions -->
+        <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
+        <?include VBoxMergeNetAdp6CA.wxi ?>
+
+        <InstallExecuteSequence>
+            <?include VBoxMergeNetAdp6Seq.wxi ?>
+        </InstallExecuteSequence>
+
+    </Module>
+</Wix>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdp6CA.wxi b/src/VBox/Installer/win/VBoxMergeNetAdp6CA.wxi
new file mode 100644
index 0000000..c278c80
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetAdp6CA.wxi
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <CustomAction Id="ca_CreateHostOnlyInterfaceNDIS6" BinaryKey="VBoxInstallHelper"  DllEntry="Ndis6CreateHostOnlyInterface" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_CreateHostOnlyInterfaceNDIS6Args" Property="ca_CreateHostOnlyInterfaceNDIS6" Value="[msm_VBoxNetworkAdp6Folder]" Execute="immediate"/>
+
+    <CustomAction Id="ca_RemoveHostOnlyInterfacesNDIS6" BinaryKey="VBoxInstallHelper"  DllEntry="RemoveHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_StopHostOnlyInterfacesNDIS6" BinaryKey="VBoxInstallHelper"  DllEntry="StopHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
+
+    <CustomAction Id="ca_UpdateHostOnlyInterfacesNDIS6" BinaryKey="VBoxInstallHelper"  DllEntry="Ndis6UpdateHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_UpdateHostOnlyInterfacesNDIS6Args" Property="ca_UpdateHostOnlyInterfacesNDIS6" Value="[msm_VBoxNetworkAdp6Folder]" Execute="immediate"/>
+
+    <CustomAction Id="ca_UninstallNetAdp6" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetAdp" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_UninstallNetAdp6Args" Property="ca_UninstallNetAdp6" Value="[msm_VBoxNetworkAdp6Folder]" Execute="immediate"/>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdp6Seq.wxi b/src/VBox/Installer/win/VBoxMergeNetAdp6Seq.wxi
new file mode 100644
index 0000000..bbb0752
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetAdp6Seq.wxi
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+    <!-- Create host-only interfaces on first-time install -->
+    <Custom Action="ca_CreateHostOnlyInterfaceNDIS6Args" Before="ca_CreateHostOnlyInterfaceNDIS6" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(NOT Installed) AND (VersionNT >= 600) AND ($cp_NetAdp6Driver=3)]]>
+        <?else ?>
+            <![CDATA[(NOT Installed) AND (VersionNT >= 600) AND ($cp_NetAdp6Driver=3)]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_CreateHostOnlyInterfaceNDIS6" Before="InstallFinalize" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(NOT Installed) AND (VersionNT >= 600) AND ($cp_NetAdp6Driver=3)]]>
+        <?else ?>
+            <![CDATA[(NOT Installed) AND (VersionNT >= 600) AND ($cp_NetAdp6Driver=3)]]>
+        <?endif ?>
+    </Custom>
+    <!-- Don't remove the host-only interfaces on update, only on uninstall -->
+    <Custom Action="ca_RemoveHostOnlyInterfacesNDIS6" After="InstallInitialize" >
+        <![CDATA[NOT (UPGRADINGPRODUCTCODE) AND (Installed) AND (REMOVE="ALL")]]>
+    </Custom>
+    <!-- First stop the existing host-only interfaces on update ... -->
+    <Custom Action="ca_StopHostOnlyInterfacesNDIS6" After="InstallInitialize" >
+        <![CDATA[(UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]>
+    </Custom>
+
+    <Custom Action="ca_UninstallNetAdp6Args" Before="ca_UninstallNetAdp6" >
+        <![CDATA[(UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]>
+    </Custom>
+    <Custom Action="ca_UninstallNetAdp6" After="ca_StopHostOnlyInterfacesNDIS6" >
+        <![CDATA[(UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]>
+    </Custom>
+
+<?endif ?>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi b/src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi
index 9dcbe5a..249227a 100644
--- a/src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi
+++ b/src/VBox/Installer/win/VBoxMergeNetAdpCA.wxi
@@ -22,6 +22,7 @@
     <CustomAction Id="ca_StopHostOnlyInterfaces" BinaryKey="VBoxInstallHelper" DllEntry="StopHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
     <CustomAction Id="ca_UpdateHostOnlyInterfacesArgs" Property="ca_UpdateHostOnlyInterfaces" Value="[msm_VBoxNetworkAdpFolder]" Execute="immediate"/>
     <CustomAction Id="ca_UpdateHostOnlyInterfaces" BinaryKey="VBoxInstallHelper" DllEntry="UpdateHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
-    <CustomAction Id="ca_UninstallNetAdp" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetAdp" Execute="deferred" Return="check" Impersonate="no"/> 
-    <CustomAction Id="ca_UninstallNetAdpArgs" Property="ca_UninstallNetAdp" Value="[msm_VBoxNetworkAdpFolder]" Execute="immediate"/> 
+    <CustomAction Id="ca_UninstallNetAdp" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetAdp" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_UninstallNetAdpArgs" Property="ca_UninstallNetAdp" Value="[msm_VBoxNetworkAdpFolder]" Execute="immediate"/>
+
 </Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi b/src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi
index af7ffb7..6226fd4 100644
--- a/src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi
+++ b/src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi
@@ -20,16 +20,16 @@
     <!-- Create host-only interfaces on first-time install -->
     <Custom Action="ca_CreateHostOnlyInterfaceArgs" Before="ca_CreateHostOnlyInterface" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
-            <![CDATA[NOT Installed]]>
+            <![CDATA[(NOT Installed) AND ($cp_NetAdpDriver=3)]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkAdp=3]]>
+            <![CDATA[(NOT Installed) AND ($cp_NetAdpDriver=3)]]>
         <?endif ?>
     </Custom>
     <Custom Action="ca_CreateHostOnlyInterface" Before="InstallFinalize" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
-            <![CDATA[NOT Installed]]>
+            <![CDATA[(NOT Installed) AND ($cp_NetAdpDriver=3)]]>
         <?else ?>
-            <![CDATA[(NOT Installed)AND (&VBoxNetworkAdp=3)]]>
+            <![CDATA[(NOT Installed) AND ($cp_NetAdpDriver=3)]]>
         <?endif ?>
     </Custom>
     <!-- Don't remove the host-only interfaces on update, only on uninstall -->
@@ -40,12 +40,14 @@
     <Custom Action="ca_StopHostOnlyInterfaces" After="InstallInitialize" >
         <![CDATA[(UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]>
     </Custom>
+
     <Custom Action="ca_UninstallNetAdpArgs" Before="ca_UninstallNetAdp" >
         <![CDATA[(UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]>
-    </Custom> 
-    <Custom Action="ca_UninstallNetAdp" After="ca_StopHostOnlyInterfaces" > 
-        <![CDATA[(UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]> 
-    </Custom> 
+    </Custom>
+    <Custom Action="ca_UninstallNetAdp" After="ca_StopHostOnlyInterfaces" >
+        <![CDATA[(UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]>
+    </Custom>
+
 <?endif ?>
 
 </Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetFlt.wxi b/src/VBox/Installer/win/VBoxMergeNetFlt.wxi
index 1462b8d..b8a8f30 100644
--- a/src/VBox/Installer/win/VBoxMergeNetFlt.wxi
+++ b/src/VBox/Installer/win/VBoxMergeNetFlt.wxi
@@ -29,7 +29,9 @@
         <File Id="file_VBoxNetFlt.cat" Name="VBoxNetFlt.cat"
               Source="$(env.PATH_OUT)\bin\VBoxNetFlt.cat" />
 <?endif ?>
+        <Condition><![CDATA[NETWORKTYPE="NDIS5"]]></Condition>
     </Component>
+
 <?endif ?> <!-- VBOX_WITH_NETFLT -->
 
 </Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi b/src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi
index c9a11db..cf5cf1e 100644
--- a/src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi
+++ b/src/VBox/Installer/win/VBoxMergeNetFltSeq.wxi
@@ -19,60 +19,61 @@
 <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
     <Custom Action="ca_RollbackInstallNetFltArgs" Before="ca_RollbackInstallNetFlt" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
-            <![CDATA[NOT Installed]]>
+            <![CDATA[$cp_NetFltDriver=3 AND (NOT Installed)]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkFlt=3]]>
+            <![CDATA[$cp_NetFltDriver=3 AND (NOT Installed)]]>
         <?endif ?>
     </Custom>
     <Custom Action="ca_RollbackInstallNetFlt" Before="ca_InstallNetFlt" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
-            <![CDATA[NOT Installed]]>
+            <![CDATA[$cp_NetFltDriver=3 AND (NOT Installed)]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkFlt=3]]>
+            <![CDATA[$cp_NetFltDriver=3 AND (NOT Installed)]]>
         <?endif ?>
     </Custom>
     <Custom Action="ca_InstallNetFltArgs" Before="ca_InstallNetFlt" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
-            <![CDATA[NOT Installed]]>
+            <![CDATA[$cp_NetFltDriver=3 AND (NOT Installed)]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkFlt=3]]>
+            <![CDATA[$cp_NetFltDriver=3 AND (NOT Installed)]]>
         <?endif ?>
     </Custom>
     <Custom Action="ca_InstallNetFlt" Before="InstallFinalize" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
-            <![CDATA[NOT Installed]]>
+            <![CDATA[$cp_NetFltDriver=3 AND (NOT Installed)]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkFlt=3]]>
+            <![CDATA[$cp_NetFltDriver=3 AND (NOT Installed)]]>
         <?endif ?>
     </Custom>
     <Custom Action="ca_RollbackUninstallNetFltArgs" Before="ca_RollbackUninstallNetFlt" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
             <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkFlt=2]]>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
         <?endif ?>
     </Custom>
     <Custom Action="ca_RollbackUninstallNetFlt" Before="ca_UninstallNetFlt" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
             <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkFlt=2]]>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
         <?endif ?>
     </Custom>
     <Custom Action="ca_UninstallNetFltArgs" Before="ca_UninstallNetFlt" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
             <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkFlt=2]]>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
         <?endif ?>
     </Custom>
     <Custom Action="ca_UninstallNetFlt" After="InstallInitialize" >
         <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
             <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
         <?else ?>
-            <![CDATA[&VBoxNetworkFlt=2]]>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
         <?endif ?>
     </Custom>
+
 <?endif?> <!-- VBOX_WITH_NETFLT -->
 
 </Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetLwf.wxi b/src/VBox/Installer/win/VBoxMergeNetLwf.wxi
new file mode 100644
index 0000000..5cb5793
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetLwf.wxi
@@ -0,0 +1,33 @@
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+    <Component Id="cp_NetLwfDriver" Guid="831b909d-f09a-4281-b6b0-99393fa4769d" Win64="$(var.Property_Win64)">
+        <File Id="file_VBoxNetLwf.sys" Name="VBoxNetLwf.sys"   KeyPath="yes"
+              Source="$(env.PATH_OUT)\bin\VBoxNetLwf.sys" Checksum="yes"/>
+        <File Id="file_VBoxNetLwf.inf" Name="VBoxNetLwf.inf"
+              Source="$(env.PATH_OUT)\bin\VBoxNetLwf.inf" />
+<?if $(env.VBOX_SIGNING_MODE) != none ?>
+        <File Id="file_VBoxNetLwf.cat" Name="VBoxNetLwf.cat"
+              Source="$(env.PATH_OUT)\bin\VBoxNetLwf.cat" />
+<?endif ?>
+        <Condition><![CDATA[NETWORKTYPE="NDIS6"]]></Condition>
+    </Component>
+
+<?endif ?> <!-- VBOX_WITH_NETFLT -->
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetLwf.wxs b/src/VBox/Installer/win/VBoxMergeNetLwf.wxs
new file mode 100644
index 0000000..927b175
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetLwf.wxs
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<?include Properties.wxi ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+     xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+    <Module Id="msm_VBoxNetworkLwf"
+            Language="!(loc.LANG)"
+            Version="$(var.Property_Version)">
+
+        <Package Id="5aca0331-4936-4c1b-820a-8359965d49a4"
+                 Keywords="Installer, Setup"
+                 Description="$(env.VBOX_PRODUCT) $(var.Property_VersionExt) NetLwf installation package"
+                 Comments="$(env.VBOX_PRODUCT) NetLwf installation package"
+                 Manufacturer="$(env.VBOX_VENDOR)"
+                 InstallerVersion="200"
+                 AdminImage="yes"
+                 InstallPrivileges="elevated"
+                 Platform="$(var.Property_Platform)"
+                 SummaryCodepage="1252"/>
+
+        <!-- Here comes the file/directory list -->
+        <Directory Id="TARGETDIR" Name="SourceDir">
+            <Directory Id="msm_VBoxNetworkLwfFolder" FileSource=".">
+
+                <?include VBoxMergeNetLwf.wxi ?>
+
+            </Directory> <!-- msm_VBoxNetworkLwfFolder -->
+        </Directory> <!-- TARGETDIR -->
+
+        <!-- Custom actions -->
+        <Binary Id="VBoxInstallHelper" SourceFile="$(env.PATH_OUT)\bin\VBoxInstallHelper.dll" />
+        <?include VBoxMergeNetLwfCA.wxi ?>
+
+        <InstallExecuteSequence>
+            <?include VBoxMergeNetLwfSeq.wxi ?>
+        </InstallExecuteSequence>
+
+    </Module>
+</Wix>
diff --git a/src/VBox/Installer/win/VBoxMergeNetLwfCA.wxi b/src/VBox/Installer/win/VBoxMergeNetLwfCA.wxi
new file mode 100644
index 0000000..c0babbd
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetLwfCA.wxi
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+    <CustomAction Id="ca_InstallNetLwf" BinaryKey="VBoxInstallHelper" DllEntry="InstallNetLwf" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_InstallNetLwfArgs" Property="ca_InstallNetLwf" Value="[msm_VBoxNetworkLwfFolder]" Execute="immediate"/>
+
+    <CustomAction Id="ca_RollbackInstallNetLwf" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetLwf" Execute="rollback" Impersonate="no"/>
+    <CustomAction Id="ca_RollbackInstallNetLwfArgs" Property="ca_RollbackInstallNetLwf" Value="[msm_VBoxNetworkLwfFolder]" Execute="immediate"/>
+
+    <CustomAction Id="ca_UninstallNetLwf" BinaryKey="VBoxInstallHelper" DllEntry="UninstallNetLwf" Execute="deferred" Return="check" Impersonate="no"/>
+    <CustomAction Id="ca_UninstallNetLwfArgs" Property="ca_UninstallNetLwf" Value="[msm_VBoxNetworkLwfFolder]" Execute="immediate"/>
+
+    <CustomAction Id="ca_RollbackUninstallNetLwf" BinaryKey="VBoxInstallHelper" DllEntry="InstallNetLwf" Execute="rollback" Impersonate="no"/>
+    <CustomAction Id="ca_RollbackUninstallNetLwfArgs" Property="ca_RollbackUninstallNetLwf" Value="[msm_VBoxNetworkLwfFolder]" Execute="immediate"/>
+<?endif ?>
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeNetLwfSeq.wxi b/src/VBox/Installer/win/VBoxMergeNetLwfSeq.wxi
new file mode 100644
index 0000000..8d8f8ef
--- /dev/null
+++ b/src/VBox/Installer/win/VBoxMergeNetLwfSeq.wxi
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<!--
+    VirtualBox Windows Installation Script (WiX)
+
+    Copyright (C) 2006-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
+         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+    <Custom Action="ca_RollbackInstallNetLwfArgs" Before="ca_RollbackInstallNetLwf" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(VersionNT >= 600) AND $cp_NetLwfDriver=3 AND (NOT Installed)]]>
+        <?else ?>
+            <![CDATA[(VersionNT >= 600) AND $cp_NetLwfDriver=3 AND (NOT Installed)]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_RollbackInstallNetLwf" Before="ca_InstallNetLwf" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(VersionNT >= 600) AND $cp_NetLwfDriver=3 AND (NOT Installed)]]>
+        <?else ?>
+            <![CDATA[(VersionNT >= 600) AND $cp_NetLwfDriver=3 AND (NOT Installed)]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_InstallNetLwfArgs" Before="ca_InstallNetLwf" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(VersionNT >= 600) AND $cp_NetLwfDriver=3 AND (NOT Installed)]]>
+        <?else ?>
+            <![CDATA[(VersionNT >= 600) AND $cp_NetLwfDriver=3 AND (NOT Installed)]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_InstallNetLwf" Before="InstallFinalize" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(VersionNT >= 600) AND $cp_NetLwfDriver=3 AND (NOT Installed)]]>
+        <?else ?>
+            <![CDATA[(VersionNT >= 600) AND $cp_NetLwfDriver=3 AND (NOT Installed)]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_RollbackUninstallNetLwfArgs" Before="ca_RollbackUninstallNetLwf" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
+        <?else ?>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_RollbackUninstallNetLwf" Before="ca_UninstallNetLwf" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
+        <?else ?>
+            <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_UninstallNetLwfArgs" Before="ca_UninstallNetLwf" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[((UPGRADINGPRODUCTCODE) OR (REMOVE="ALL"))]]>
+        <?else ?>
+            <![CDATA[((UPGRADINGPRODUCTCODE) OR (REMOVE="ALL"))]]>
+        <?endif ?>
+    </Custom>
+    <Custom Action="ca_UninstallNetLwf" After="InstallInitialize" >
+        <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+            <![CDATA[((UPGRADINGPRODUCTCODE) OR (REMOVE="ALL"))]]>
+        <?else ?>
+            <![CDATA[((UPGRADINGPRODUCTCODE) OR (REMOVE="ALL"))]]>
+        <?endif ?>
+    </Custom>
+
+<?endif?> <!-- VBOX_WITH_NETFLT -->
+
+</Include>
diff --git a/src/VBox/Installer/win/VBoxMergeUSB.wxi b/src/VBox/Installer/win/VBoxMergeUSB.wxi
index fad53c7..2ed2386 100644
--- a/src/VBox/Installer/win/VBoxMergeUSB.wxi
+++ b/src/VBox/Installer/win/VBoxMergeUSB.wxi
@@ -18,13 +18,13 @@
 
     <Directory Id="dir_VBoxUSBFilter" Name="filter">
         <Component Id="cp_USBFilterDriver" Guid="B7D782D2-96DF-4775-A0E1-A76CF7B04B65" Win64="$(var.Property_Win64)">
-            <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
-                            Legacy="$(var.Property_DriverLegacy)" Sequence="0" PlugAndPlayPrompt="no"/>
+            <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes" DeleteFiles="yes"
+                  Legacy="$(var.Property_DriverLegacy)" Sequence="0" PlugAndPlayPrompt="no"/>
             <File Id="file_VBoxUSBMon.sys" Name="VBoxUSBMon.sys"
                   Source="$(env.PATH_OUT)\bin\VBoxUSBMon.sys" />
             <File Id="file_VBoxUSBMon.inf" Name="VBoxUSBMon.inf"
                   Source="$(env.PATH_OUT)\bin\VBoxUSBMon.inf" />
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
+<?if $(env.VBOX_SIGNING_MODE)!= none ?>
             <File Id="file_VBoxUSBMon.cat" Name="VBoxUSBMon.cat"
                   Source="$(env.PATH_OUT)\bin\VBoxUSBMon.cat" />
 <?endif ?>
@@ -33,13 +33,13 @@
 
     <Directory Id="dir_VBoxUSBDevice" Name="device">
         <Component Id="cp_USBDeviceDriver" Guid="010FE46A-E358-43E2-8BDC-38BC8BEC82E0" Win64="$(var.Property_Win64)">
-            <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"
-                            Legacy="$(var.Property_DriverLegacy)" Sequence="0" PlugAndPlayPrompt="no"/>
+            <difxapp:Driver AddRemovePrograms="no" ForceInstall="yes"  DeleteFiles="yes"
+                  Legacy="$(var.Property_DriverLegacy)" Sequence="0" PlugAndPlayPrompt="no"/>
             <File Id="file_VBoxUSB.sys" Name="VBoxUSB.sys"
                   Source="$(env.PATH_OUT)\bin\VBoxUSB.sys" />
             <File Id="file_VBoxUSB.inf" Name="VBoxUSB.inf"
                   Source="$(env.PATH_OUT)\bin\VBoxUSB.inf" />
-<?if $(env.VBOX_SIGNING_MODE) != none ?>
+<?if $(env.VBOX_SIGNING_MODE)!= none ?>
             <File Id="file_VBoxUSB.cat" Name="VBoxUSB.cat"
                   Source="$(env.PATH_OUT)\bin\VBoxUSB.cat" />
 <?endif ?>
diff --git a/src/VBox/Installer/win/VirtualBox.wxs b/src/VBox/Installer/win/VirtualBox.wxs
index 0018e12..59645e7 100644
--- a/src/VBox/Installer/win/VirtualBox.wxs
+++ b/src/VBox/Installer/win/VirtualBox.wxs
@@ -29,6 +29,10 @@
         <?define Property_VBoxMergeNetworkFlt = "$(env.VBOX_WIN_INST_MERGE_NETFLT)" ?>
     <?endif ?>
     <?define Property_VBoxMergeNetworkAdp = "$(env.VBOX_WIN_INST_MERGE_NETADP)" ?>
+    <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+        <?define Property_VBoxMergeNetworkLwf = "$(env.VBOX_WIN_INST_MERGE_NETLWF)" ?>
+    <?endif ?>
+    <?define Property_VBoxMergeNetworkAdp6 = "$(env.VBOX_WIN_INST_MERGE_NETADP6)" ?>
     <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
         <?define Property_VBoxMergePython = "$(env.VBOX_WIN_INST_MERGE_PYTHON)" ?>
     <?endif ?>
@@ -57,6 +61,11 @@
     <Property Id="ARPURLINFOABOUT">http://www.virtualbox.org</Property>
     <Property Id="ARPURLUPDATEINFO">http://www.virtualbox.org</Property>
 
+    <!-- Default property for network adapter type -->
+    <Property Id="NETWORKTYPE" Value="NDIS6" Secure="yes"/>
+    <!-- Force NDIS5 on pre-Vista -->
+    <SetProperty Id="NETWORKTYPE" After="CostFinalize" Value="NDIS5"><![CDATA[VersionNT < 600]]></SetProperty>
+
     <!-- Install the product for all users on the system -->
     <Property Id="ALLUSERS"><![CDATA[1]]></Property>
 
@@ -98,6 +107,7 @@
         NOT VBOXINNOTEK
     </Condition>
 
+    
     <!-- *************************** Upgrade packages only ******************************* -->
     <!-- Minimum and Maximum specify the range of versions we are supposed to update with this upgrade.
          IncludeMaximum and IncludeMinimum specify whether the bound value is actually included in the range or not
@@ -154,6 +164,26 @@
     <CustomAction Id="ca_UninstallTAPInstances" BinaryKey="VBoxInstallHelper"
                   DllEntry="UninstallTAPInstances" Execute="deferred" Return="check" Impersonate="no"/>
 
+    <Property Id="VBOXDEPENDENCY" Secure="yes">
+        <DirectorySearch Id="VBoxInstallDir" Path="[EXISTINGINSTALLDIR]">
+            <FileSearch Name="dependency.dep"/>
+        </DirectorySearch>
+    </Property>
+    
+    <!--
+                            install upgrade uninstall
+    VBOXDEPENDENCY             0      1/0      1/0
+    UPGRADINGPRODUCTCODE       0       1        0
+    final                      0       1        0
+    not final                  1       0        1
+    -->
+
+    <Condition Message="It was detected an application which has been using currently installed VirtualBox version. 
+    You must remove this application before continuing installation. 
+    See the file dependency.dep in the VirtualBox installation directory for details. ">
+        NOT (VBOXDEPENDENCY AND UPGRADINGPRODUCTCODE)
+    </Condition>
+    
     <!-- Detect old Sun installation -->
     <!-- Force a manual uninstall of an already installed Sun VirtualBox version first -->
     <!--<Property Id="VBOXSUN">
@@ -178,8 +208,10 @@
     <?endif ?>
     <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
         <?include VBoxMergeNetFltCA.wxi ?>
+        <?include VBoxMergeNetLwfCA.wxi ?>
     <?endif ?>
     <?include VBoxMergeNetAdpCA.wxi ?>
+    <?include VBoxMergeNetAdp6CA.wxi ?>
     <?include VBoxMergeUSBCA.wxi ?>
     <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
         <?include VBoxMergePythonCA.wxi ?>
@@ -234,6 +266,27 @@
                             </Directory>
 <?endif ?>
                         </Directory>
+
+<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
+                        <Directory Id="dir_NetLwf" Name="netlwf">
+    <?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                            <Merge Id="msm_VBoxNetworkLwf" Language="!(loc.LANG)" SourceFile="$(var.Property_VBoxMergeNetworkLwf)" DiskId="1" />
+    <?else ?>
+                            <Directory Id="msm_VBoxNetworkLwfFolder" FileSource=".">
+                                <?include VBoxMergeNetLwf.wxi ?>
+                            </Directory>
+    <?endif ?>
+                        </Directory>
+<?endif ?>
+                        <Directory Id="dir_NetAdp6" Name="netadp6">
+<?if $(env.VBOX_WITH_MSM_INSTALL) = "yes" ?>
+                            <Merge Id="msm_VBoxNetworkAdp6" Language="!(loc.LANG)" SourceFile="$(var.Property_VBoxMergeNetworkAdp6)" DiskId="1" />
+<?else ?>
+                            <Directory Id="msm_VBoxNetworkAdp6Folder" FileSource=".">
+                                <?include VBoxMergeNetAdp6.wxi ?>
+                            </Directory>
+<?endif ?>
+                        </Directory>
                     </Directory>
                 </Directory>
 <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
@@ -292,9 +345,9 @@
                     <RegistryValue Root="HKCU" Key="$(var.Property_RegKeyInstall)"
                                    Type="string" Value="installed" KeyPath="yes" />
                 </Component>
-                </Directory><!-- INSTALLDIR -->
-            </Directory><!-- $(env.VBOX_VENDOR_SHORT) -->
-        </Directory><!-- $(var.Property_ProgramFiles) -->
+                </Directory>
+            </Directory>
+        </Directory>
     </Directory> <!-- TARGETDIR -->
 
     <!-- Note: Feature IDs *must not* be renamed to use any prefixes or such,
@@ -374,6 +427,7 @@
                 <MergeRef Id="msm_VBoxNetworkFlt" />
     <?else ?>
                 <ComponentRef Id="cp_NetFltDriver" />
+                <ComponentRef Id="cp_NetLwfDriver" />
     <?endif ?>
             </Feature>
             <Feature Id="VBoxNetworkAdp" Title="VirtualBox Host-Only Networking" Level="1"
@@ -384,8 +438,10 @@
                 <MergeRef Id="msm_VBoxNetworkAdp" />
     <?else ?>
                 <ComponentRef Id="cp_NetAdpDriver" />
+                <ComponentRef Id="cp_NetAdp6Driver" />
     <?endif ?>
             </Feature>
+
         </Feature>
 <?endif ?>
 
@@ -447,7 +503,7 @@
         <!-- First install the new version and then remove the old version. This is more efficient -->
         <RemoveExistingProducts After="InstallValidate"><![CDATA[PREVIOUSVERSIONSINSTALLED OR NEWERVERSIONDETECTED]]></RemoveExistingProducts>
 
-        <Custom Action="ca_OriginalTargetDir" After="FileCost"><![CDATA[NOT INSTALLDIR]]></Custom>
+        <Custom Action="ca_OriginalTargetDir" After="FileCost"><![CDATA[(NOT INSTALLDIR)]]></Custom>
         <Custom Action="ca_DefaultTargetDir" Before="FileCost" ><![CDATA[NOT INSTALLDIR AND EXISTINGINSTALLDIR]]></Custom>
 
         <!-- Check + unininstall old TAP instances - we  don't need them anymore -->
@@ -467,8 +523,10 @@
         <?endif ?>
         <?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
             <?include VBoxMergeNetFltSeq.wxi ?>
+            <?include VBoxMergeNetLwfSeq.wxi ?>
         <?endif ?>
         <?include VBoxMergeNetAdpSeq.wxi ?>
+        <?include VBoxMergeNetAdp6Seq.wxi ?>
         <?include VBoxMergeUSBSeq.wxi ?>
         <?if $(env.VBOX_WITH_PYTHON) = "yes" ?>
             <?include VBoxMergePythonSeq.wxi ?>
diff --git a/src/VBox/Installer/win/dep.sed b/src/VBox/Installer/win/dep.sed
deleted file mode 100644
index 7d75b54..0000000
--- a/src/VBox/Installer/win/dep.sed
+++ /dev/null
@@ -1,29 +0,0 @@
-# $Id: dep.sed $
-## @file
-# Generate dependencies from .wxs and .wxi sources.
-#
-
-#
-# Copyright (C) 2006-2011 Oracle Corporation
-#
-# This file is part of VirtualBox Open Source Edition (OSE), as
-# available from http://www.virtualbox.org. This file is free software;
-# you can redistribute it and/or modify it under the terms of the GNU
-# General Public License (GPL) as published by the Free Software
-# Foundation, in version 2 as it comes in the "COPYING" file of the
-# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
-#
-
-# drop all lines not including a src property.
-/Source=\"/!d
-# extract the file spec
-s/^.*Source="\([^"]*\).*$/\1 /
-# convert to unix slashes
-s/\\/\//g
-# $(env.PATH_OUT stuff.
-s/(env\./(/g
-# pretty
-s/$/\\/
-s/^/\t/
-
diff --git a/src/VBox/Installer/win/dep.xsl b/src/VBox/Installer/win/dep.xsl
new file mode 100644
index 0000000..e3542df
--- /dev/null
+++ b/src/VBox/Installer/win/dep.xsl
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+
+<!--
+    Generate a list of dependencies from a wixobj file.
+
+    Copyright (C) 2015 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:wix="http://schemas.microsoft.com/wix/2006/objects"
+    >
+<xsl:output method="text" encoding="utf-8"/>
+
+<xsl:strip-space elements="*"/>
+
+<xsl:include href="../../Main/idl/typemap-shared.inc.xsl"/>
+
+
+<xsl:template name="output-file">
+    <xsl:param name="name"/>
+    <xsl:if test="1 or substring($name, 2, 1) = ':'">
+        <xsl:text>    </xsl:text>
+        <xsl:value-of select="translate($name, '\', '/')"/>
+        <xsl:text> \</xsl:text>
+        <xsl:call-template name="xsltprocNewlineOutputHack"/>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template match="wix:table[@name = 'Binary' or @name = 'Icon']">
+    <xsl:for-each select="wix:row/wix:field[2]">
+        <xsl:call-template name="output-file">
+            <xsl:with-param name="name" select="normalize-space(.)"/>
+        </xsl:call-template>
+    </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="wix:table[@name = 'WixFile']">
+    <xsl:for-each select="wix:row/wix:field[7]">
+        <xsl:call-template name="output-file">
+            <xsl:with-param name="name" select="normalize-space(.)"/>
+        </xsl:call-template>
+    </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="wix:wixObject">
+    <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="wix:section">
+    <xsl:apply-templates/>
+</xsl:template>
+
+<!-- Eat everything that's unmatched. -->
+<xsl:template match="*">
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/src/VBox/Installer/win/dep2.xsl b/src/VBox/Installer/win/dep2.xsl
new file mode 100644
index 0000000..aad0245
--- /dev/null
+++ b/src/VBox/Installer/win/dep2.xsl
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+
+<!--
+    Generate a list of dependencies from a wixobj file.
+
+    Copyright (C) 2015 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:wix="http://schemas.microsoft.com/wix/2006/objects"
+    >
+<xsl:output method="text" encoding="utf-8"/>
+
+<xsl:strip-space elements="*"/>
+
+<xsl:include href="../../Main/idl/typemap-shared.inc.xsl"/>
+
+<xsl:template name="split-file-remove-number">
+    <xsl:param name="name"/>
+    <xsl:choose>
+        <xsl:when test="contains($name, '|')">
+            <xsl:text>    </xsl:text>
+            <xsl:value-of select="substring-before(substring-before($name, '|'), '*')"/>
+            <xsl:text> \
+</xsl:text>
+            <xsl:call-template name="split-file-remove-number">
+                <xsl:with-param name="name" select="substring-after($name, '|')"/>
+            </xsl:call-template>
+        </xsl:when>
+
+        <xsl:otherwise>
+            <xsl:text>    </xsl:text>
+            <xsl:value-of select="substring-before($name, '*')"/>
+            <xsl:text> \</xsl:text>
+            <xsl:call-template name="xsltprocNewlineOutputHack"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="output-source-line-number">
+    <xsl:param name="name"/>
+    <xsl:if test="1 or substring($name, 2, 1) = ':'">
+        <xsl:call-template name="split-file-remove-number">
+            <xsl:with-param name="name" select="translate($name, '\', '/')"/>
+        </xsl:call-template>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template match="wix:row">
+    <xsl:call-template name="output-source-line-number">
+        <xsl:with-param name="name" select="@sourceLineNumber"/>
+    </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="wix:table">
+    <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="wix:wixObject">
+    <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="wix:section">
+    <xsl:apply-templates/>
+</xsl:template>
+
+<!-- Eat everything that's unmatched. -->
+<xsl:template match="*">
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/src/VBox/Main/Config.kmk b/src/VBox/Main/Config.kmk
new file mode 100644
index 0000000..aa773e3
--- /dev/null
+++ b/src/VBox/Main/Config.kmk
@@ -0,0 +1,41 @@
+# $Id: Config.kmk $
+## @file
+# kBuild Configuration file for the Main API.
+#
+
+#
+# Copyright (C) 2013 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+
+VBOX_MAIN_CONFIG_KMK_INCLUDED = 1
+
+# Include the top-level configure file.
+ifndef VBOX_ROOT_CONFIG_KMK_INCLUDED
+ include $(PATH_ROOT)/Config.kmk
+endif
+
+
+#
+# Globals.
+#
+VBOX_MAIN_APIWRAPPER_DIR  := $(abspath $(call TARGET_PATH,VBoxAPIWrap))
+VBOX_MAIN_APIWRAPPER_INCS := $(VBOX_MAIN_APIWRAPPER_DIR)
+
+
+# The header is required by a testcase, that why these defines are here.
+VBOX_XML_SCHEMADEFS_H   = $(PATH_TARGET)/Main/SchemaDefs.h
+VBOX_XML_SCHEMADEFS_CPP = $(PATH_TARGET)/Main/SchemaDefs.cpp
+VBOX_XML_SCHEMADEFS_XSL = $(VBOX_PATH_MAIN_SRC)/xml/SchemaDefs.xsl
+
+# These files are also required by a testcase.
+VBOX_AUTOGEN_EVENT_H    = $(PATH_TARGET)/Main/VBoxEvents.h
+VBOX_AUTOGEN_EVENT_CPP  = $(PATH_TARGET)/Main/VBoxEvents.cpp
+
diff --git a/src/VBox/Main/Makefile.kmk b/src/VBox/Main/Makefile.kmk
index cbd49df..b4e8f51 100644
--- a/src/VBox/Main/Makefile.kmk
+++ b/src/VBox/Main/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2004-2014 Oracle Corporation
+# Copyright (C) 2004-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +19,13 @@ SUB_DEPTH = ../../..
 include $(KBUILD_PATH)/subheader.kmk
 
 #
+# Make sure our Config.kmk is included.
+#
+ifndef VBOX_MAIN_CONFIG_KMK_INCLUDED
+ include $(PATH_SUB_CURRENT)/Config.kmk
+endif
+
+#
 # Include sub-makefile(s).
 #
 ifdef VBOX_WITH_WEBSERVICES
@@ -164,8 +171,10 @@ $(PATH_TARGET)/docs.Main: \
 	$(APPEND) $(PATH_TARGET)/docs.Main
 # aliases
 docs.main docs.Main: $(PATH_TARGET)/docs.Main
-if !defined(VBOX_ONLY_DOCS)
+if !defined(VBOX_ONLY_DOCS) && defined(VBOX_WITH_ALL_DOXYGEN_TARGETS)
 docs:                $(PATH_TARGET)/docs.Main
+else
+docs:
 endif
 
 
@@ -175,28 +184,38 @@ ifndef VBOX_ONLY_SDK
 #
 LIBRARIES += VBoxAPIWrap
 VBoxAPIWrap_TEMPLATE        = VBoxMainLib
-VBoxAPIWrap_SOURCES         = $(VBoxAPIWrap_GENERATEDCPP)
-VBoxAPIWrap_GENERATEDCPP    = $(filter %.cpp,$(VBoxAPIWrap_GENERATEDSOURCES))
-VBoxAPIWrap_GENERATEDSOURCES = $(addprefix $(VBoxAPIWrap_0_OUTDIR)/,$(VBoxAPIWrap_VBOX_APIWRAPPERFILES))
-VBoxAPIWrap_RAWSRC          = \
-	$(VBoxAPIWrap_0_OUTDIR)/apiwrappers
-VBoxAPIWrap_XSLT            = \
-	$(VBOX_PATH_MAIN_SRC)/idl/apiwrap-server.xsl
-VBoxAPIWrap_DEFS.win.x86 += _WIN32_WINNT=0x0500
+VBoxAPIWrap_SOURCES         = \
+	$(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d \
+	$(VBOX_MAIN_APIWRAPPER_GEN_SRCS)
+VBoxAPIWrap_INTERMEDIATES   = $(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
+VBoxAPIWrap_DEFS.win.x86   += _WIN32_WINNT=0x0500
 VBoxAPIWrap_DEFS.win.amd64 += _WIN32_WINNT=0x0510
 VBoxAPIWrap_INCS           += \
 	include
 VBoxAPIWrap_CLEAN           = \
 	$(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.cpp) \
 	$(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.h) \
-	$(VBoxAPIWrap_RAWSRC)
-VBoxAPIWrap_KMK = $(PATH_OUT)/vboxapiwrap.kmk
-include $(VBoxAPIWrap_KMK)
+	$(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d.ts \
+	$(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d \
+	$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-headers \
+	$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-sources-even \
+	$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-sources-odd
+
+# Two VBox variables used here and/or in the rules generating wrappers.
+VBoxAPIWrap_VBOX_XSLT       = \
+	$(VBOX_PATH_MAIN_SRC)/idl/apiwrap-server.xsl
+
+
+# This include file (generated at the bottom of this file), defines
+# VBOX_MAIN_APIWRAPPER_GEN_SRCS and VBOX_MAIN_APIWRAPPER_GEN_HDRS.
+VBoxAPIWrap_VBOX_KMK_FILE = $(PATH_OUT)/vboxapiwrap.kmk
+include $(VBoxAPIWrap_VBOX_KMK_FILE)
 
 ifdef VBOX_WITH_32_ON_64_MAIN_API
 LIBRARIES += VBoxAPIWrap-x86
 VBoxAPIWrap-x86_TEMPLATE = VBoxMainLib-x86
 VBoxAPIWrap-x86_EXTENDS  = VBoxAPIWrap
+VBoxAPIWrap-x86_DTRACE_HDR_FLAGS = -32 # ugly, should be fixed in the tool in Config.kmk
 endif
 
 endif # !VBOX_ONLY_SDK
@@ -235,12 +254,6 @@ ifndef VBOX_ONLY_SDK # Note this goes on for *very* long
 # These two files are used by both VBoxC and VBoxSVC.
 #
 BLDDIRS += $(PATH_TARGET)/Main
-VBOX_XML_SCHEMADEFS_H   = $(PATH_TARGET)/Main/SchemaDefs.h
-VBOX_XML_SCHEMADEFS_CPP = $(PATH_TARGET)/Main/SchemaDefs.cpp
-VBOX_XML_SCHEMADEFS_XSL = $(VBOX_PATH_MAIN_SRC)/xml/SchemaDefs.xsl
-
-VBOX_AUTOGEN_EVENT_H    = $(PATH_TARGET)/Main/VBoxEvents.h
-VBOX_AUTOGEN_EVENT_CPP  = $(PATH_TARGET)/Main/VBoxEvents.cpp
 
 testschemadefs: $(VBOX_XML_SCHEMADEFS_H) $(VBOX_XML_SCHEMADEFS_CPP)
 
@@ -269,6 +282,7 @@ VBoxSVC_DEFS = \
 	$(if $(VBOX_WITH_LINUX_COMPILER_H),VBOX_WITH_LINUX_COMPILER_H,) \
 	$(if $(VBOX_WITH_RESOURCE_USAGE_API),VBOX_WITH_RESOURCE_USAGE_API,) \
 	$(if $(VBOX_WITH_PDM_ASYNC_COMPLETION),VBOX_WITH_PDM_ASYNC_COMPLETION,) \
+	$(if $(VBOX_WITH_DBUS),VBOX_WITH_DBUS,) \
 	$(if $(VBOX_WITH_DBUS),$(if $(VBOX_USB_WITH_DBUS),VBOX_USB_WITH_DBUS,),) \
 	$(if $(VBOX_USB_WITH_SYSFS),VBOX_USB_WITH_SYSFS,) \
 	$(if $(VBOX_USB_WITH_INOTIFY),VBOX_USB_WITH_INOTIFY,) \
@@ -277,6 +291,7 @@ VBoxSVC_DEFS = \
 	$(if $(VBOX_WITH_VUSB),VBOX_WITH_VUSB,) \
 	$(if $(VBOX_WITH_S3),VBOX_WITH_S3,) \
 	$(if $(VBOX_WITH_PCI_PASSTHROUGH),VBOX_WITH_PCI_PASSTHROUGH,) \
+	$(if $(VBOX_WITH_PDM_AUDIO_DRIVER),VBOX_WITH_PDM_AUDIO_DRIVER,) \
 	$(if $(VBOX_WITH_NAT_SERVICE),VBOX_WITH_NAT_SERVICE,) \
 	$(if $(VBOX_WITH_CROGL),VBOX_WITH_CROGL,) \
 	$(if $(VBOX_WITH_CRHGSMI),VBOX_WITH_CRHGSMI,)
@@ -295,13 +310,11 @@ VBoxSVC_DEFS.freebsd += VBOX_USE_LIBHAL
 
 VBoxSVC_CXXFLAGS = $(filter-out -Wno-unused,$(TEMPLATE_VBOXMAINEXE_CXXFLAGS))
 
-VBoxSVC_DEPS = $(filter %.h,$(VBoxAPIWrap_GENERATEDSOURCES))
-
 VBoxSVC_INCS = \
 	include \
 	$(VBoxSVC_0_OUTDIR) \
 	$(dir $(VBOX_XML_SCHEMADEFS_H)) \
-	$(VBoxAPIWrap_0_OUTDIR) \
+	$(VBOX_MAIN_APIWRAPPER_INCS) \
 	.
 VBoxSVC_INCS.win = \
 	$(VBoxCOM_0_OUTDIR)
@@ -314,7 +327,8 @@ VBoxSVC_LIBS += \
 	$(PATH_STAGE_LIB)/VBoxAPIWrap$(VBOX_SUFF_LIB) \
 	$(PATH_STAGE_LIB)/SSMStandalone$(VBOX_SUFF_LIB) \
 	$(LIB_DDU)
-VBoxSVC_SDKS = VBOX_LIBPNG VBOX_ZLIB
+
+VBoxSVC_SDKS = VBOX_LIBPNG VBOX_ZLIB VBOX_OPENSSL
 VBoxSVC_LIBS.solaris = \
 	adm \
 	nsl \
@@ -328,9 +342,11 @@ VBoxSVC_LIBS.win += \
 VBoxSVC_INTERMEDIATES = \
 	$(VBOX_MAIN_PREREQS) \
 	$(VBOX_XML_SCHEMADEFS_H) \
-	$(VBOX_AUTOGEN_EVENT_H)
+	$(VBOX_AUTOGEN_EVENT_H) \
+	$(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
 
 VBoxSVC_SOURCES = \
+	$(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d \
 	src-all/DisplayPNGUtil.cpp \
 	src-all/DisplayResampleImage.cpp \
 	src-all/DisplayUtils.cpp \
@@ -340,7 +356,10 @@ VBoxSVC_SOURCES = \
 	src-all/Logging.cpp \
 	src-all/PCIDeviceAttachmentImpl.cpp \
 	src-all/ProgressImpl.cpp \
+	src-all/QMTranslatorImpl.cpp \
+	src-all/SecretKeyStore.cpp \
 	src-all/SharedFolderImpl.cpp \
+	src-all/AutoCaller.cpp \
 	src-all/VirtualBoxBase.cpp \
 	src-all/VirtualBoxErrorInfoImpl.cpp \
 	$(if $(VBOX_WITH_EXTPACK),src-all/ExtPackManagerImpl.cpp src-all/ExtPackUtil.cpp,) \
@@ -391,7 +410,7 @@ VBoxSVC_SOURCES = \
 	$(VBOX_AUTOGEN_EVENT_CPP) \
 	$(if $(VBOX_WITH_XPCOM),src-server/xpcom/server.cpp,)
 
-ifn1of ($(KBUILD_TARGET), win darwin) 
+ifn1of ($(KBUILD_TARGET), win darwin)
 	VBoxSVC_SOURCES += $(PATH_ROOT)/src/VBox/Devices/Network/slirp/resolv_conf_parser.c
 endif
 
@@ -411,6 +430,7 @@ VBoxSVC_SOURCES.win = \
 VBoxSVC_SOURCES.linux = \
 	src-server/linux/HostHardwareLinux.cpp \
 	src-server/linux/HostDnsServiceLinux.cpp \
+	$(if $(VBOX_WITH_DBUS),src-server/linux/HostPowerLinux.cpp) \
 	src-server/HostDnsServiceResolvConf.cpp
 
 VBoxSVC_SOURCES.solaris = \
@@ -422,7 +442,8 @@ VBoxSVC_SOURCES.os2 = \
 	src-server/HostDnsServiceResolvConf.cpp
 
 VBoxSVC_SOURCES.freebsd = \
-	src-server/freebsd/HostHardwareFreeBSD.cpp
+	src-server/freebsd/HostHardwareFreeBSD.cpp \
+	src-server/HostDnsServiceResolvConf.cpp
 
 
 ifdef VBOX_WITH_USB
@@ -446,7 +467,7 @@ ifdef VBOX_WITH_NETFLT
  VBoxSVC_LIBS.win += \
 	$(PATH_STAGE_LIB)/WinNetConfig$(VBOX_SUFF_LIB) \
 	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB) \
-	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/Newdev.lib \
+	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/newdev.lib \
 	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
 	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/WbemUuid.Lib
 endif
@@ -614,7 +635,8 @@ VBoxC_DEFS = \
 	$(if-expr defined(VBOX_WITH_EHCI) && defined(VBOX_WITH_USB),VBOX_WITH_EHCI,) \
 	$(if $(VBOX_WITH_EXTPACK),VBOX_WITH_EXTPACK,) \
 	$(if $(VBOX_WITH_PCI_PASSTHROUGH),VBOX_WITH_PCI_PASSTHROUGH,) \
-	$(if $(VBOX_WITH_VPX),VBOX_WITH_VPX,)
+	$(if $(VBOX_WITH_VPX),VBOX_WITH_VPX,) \
+	$(if $(VBOX_WITH_PDM_AUDIO_DRIVER),VBOX_WITH_PDM_AUDIO_DRIVER,)
 ifdef VBOX_WITH_CRHGSMI
  VBoxC_DEFS += VBOX_WITH_CRHGSMI
 endif
@@ -629,14 +651,16 @@ VBoxC_SDKS = VBOX_LIBPNG VBOX_ZLIB
 ifdef VBOX_WITH_VPX
   VBoxC_SDKS += VBOX_VPX
 endif
-
-VBoxC_DEPS = $(filter %.h,$(VBoxAPIWrap_GENERATEDSOURCES))
+ifdef VBOX_WITH_OPENSSL_FIPS
+  VBoxC_SDKS += VBOX_OPENSSL2
+endif
 
 VBoxC_INCS          = \
 	include \
 	$(VBoxC_0_OUTDIR) \
-	$(VBoxAPIWrap_0_OUTDIR) \
-	$(dir $(VBOX_XML_SCHEMADEFS_H))
+	$(VBOX_MAIN_APIWRAPPER_INCS) \
+	$(dir $(VBOX_XML_SCHEMADEFS_H)) \
+       $(VBOX_MAIN_APIWRAPPER_DIR)/dtrace
 VBoxC_INCS.win      = \
 	$(VBoxCOM_0_OUTDIR) \
 	.
@@ -654,11 +678,12 @@ VBoxC_LIBS += \
 	$(if-expr "$(LIB_VMM)" == "$(VBOX_LIB_VMM_LAZY)",$(LIB_REM),) \
 	$(VBOX_LIB_VMM_LAZY)
 VBoxC_LIBS.win += \
+	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/psapi.lib \
 	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib
 ifdef VBOX_WITH_NETFLT
  VBoxC_LIBS.win += \
 	$(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB) \
-	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/Newdev.lib \
+	$(PATH_SDK_$(VBOX_WINDDK)_LIB)/newdev.lib \
 	$(PATH_STAGE_LIB)/WinNetConfig$(VBOX_SUFF_LIB) \
 	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/comsupp.lib \
 	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/WbemUuid.Lib
@@ -673,12 +698,18 @@ ifdef VBOX_WITH_CROGL
  VBoxC_LDFLAGS.darwin += -framework OpenGL
 endif
 
+ifdef VBOX_WITH_DRAG_AND_DROP
+ VBoxC_LIBS += $(PATH_STAGE_LIB)/VBoxDnDHostR3Lib$(VBOX_SUFF_LIB)
+endif
+
 VBoxC_INTERMEDIATES = \
 	$(VBOX_MAIN_PREREQS) \
 	$(VBOX_XML_SCHEMADEFS_H) \
-	$(VBOX_AUTOGEN_EVENT_H)
+	$(VBOX_AUTOGEN_EVENT_H) \
+	$(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
 
 VBoxC_SOURCES = \
+	$(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d \
 	src-all/DisplayPNGUtil.cpp \
 	src-all/DisplayResampleImage.cpp \
 	src-all/DisplayUtils.cpp \
@@ -688,7 +719,9 @@ VBoxC_SOURCES = \
 	src-all/Logging.cpp \
 	src-all/PCIDeviceAttachmentImpl.cpp \
 	src-all/ProgressImpl.cpp \
+	src-all/SecretKeyStore.cpp \
 	src-all/SharedFolderImpl.cpp \
+	src-all/AutoCaller.cpp \
 	src-all/VirtualBoxBase.cpp \
 	src-all/VirtualBoxErrorInfoImpl.cpp \
 	$(if $(VBOX_WITH_EXTPACK),src-all/ExtPackManagerImpl.cpp src-all/ExtPackUtil.cpp,) \
@@ -696,7 +729,6 @@ VBoxC_SOURCES = \
 	$(if $(VBOX_WITH_USB_CARDREADER),src-client/UsbCardReader.cpp,) \
 	src-client/Nvram.cpp \
 	src-client/AdditionsFacilityImpl.cpp \
-	src-client/AudioSnifferInterface.cpp \
 	src-client/BusAssignmentManager.cpp \
 	$(if $(VBOX_WITH_PCI_PASSTHROUGH),src-client/PCIRawDevImpl.cpp,) \
 	src-client/ClientTokenHolder.cpp \
@@ -705,13 +737,10 @@ VBoxC_SOURCES = \
 	src-client/ConsoleImplTeleporter.cpp \
 	src-client/ConsoleVRDPServer.cpp \
 	src-client/DisplayImpl.cpp \
+	src-client/DisplayImplLegacy.cpp \
+	src-client/DisplaySourceBitmapImpl.cpp \
 	src-client/EmulatedUSBImpl.cpp \
 	src-client/GuestImpl.cpp \
-	src-client/GuestDirectoryImpl.cpp \
-	src-client/GuestFileImpl.cpp \
-	src-client/GuestFsObjInfoImpl.cpp \
-	src-client/GuestProcessImpl.cpp \
-	src-client/GuestSessionImpl.cpp \
 	src-client/GuestCtrlImpl.cpp \
 	src-client/KeyboardImpl.cpp \
 	src-client/MachineDebuggerImpl.cpp \
@@ -724,6 +753,15 @@ VBoxC_SOURCES = \
 	src-client/VMMDevInterface.cpp \
 	$(VBOX_AUTOGEN_EVENT_CPP) \
 	$(VBOX_XML_SCHEMADEFS_CPP)
+ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+ VBoxC_SOURCES += \
+	../Devices/Audio/AudioMixBuffer.cpp \
+	../Devices/Audio/DrvAudioCommon.cpp \
+	src-client/DrvAudioVRDE.cpp
+else
+ VBoxC_SOURCES += \
+	src-client/AudioSnifferInterface.cpp
+endif
 VBoxC_SOURCES.win = \
 	src-client/win/dllmain.cpp \
 	src-client/win/VBoxC.def \
@@ -731,11 +769,18 @@ VBoxC_SOURCES.win = \
 ifdef VBOX_WITH_GUEST_CONTROL
  VBoxC_SOURCES += \
 	src-client/GuestSessionImplTasks.cpp \
-	src-client/GuestCtrlPrivate.cpp
+	src-client/GuestCtrlPrivate.cpp \
+	src-client/GuestDirectoryImpl.cpp \
+	src-client/GuestFileImpl.cpp \
+	src-client/GuestFsObjInfoImpl.cpp \
+	src-client/GuestProcessImpl.cpp \
+	src-client/GuestSessionImpl.cpp
 endif
 ifdef VBOX_WITH_DRAG_AND_DROP
  VBoxC_SOURCES += \
-	src-client/GuestDnDImpl.cpp
+	src-client/GuestDnDPrivate.cpp \
+	src-client/GuestDnDSourceImpl.cpp \
+	src-client/GuestDnDTargetImpl.cpp
 endif
 ifdef VBOX_WITH_XPCOM
  VBoxC_SOURCES += \
@@ -767,7 +812,8 @@ $$(VBoxC_0_OUTDIR)/VBoxC.def: $(MAKEFILE_CURRENT)
 endif
 
 src-client/ConsoleImpl.cpp_DEFS = \
-	$(if $(VBOX_BLEEDING_EDGE),VBOX_BLEEDING_EDGE=\"$(VBOX_BLEEDING_EDGE)\",)
+	$(if $(VBOX_BLEEDING_EDGE),VBOX_BLEEDING_EDGE=\"$(VBOX_BLEEDING_EDGE)\",) \
+	$(if $(VBOX_WITH_OPENSSL_FIPS), VBOX_OPENSSL_FIPS,)
 
 
 src-client/win/VBoxC.rc_DEPS = $(VBoxC_0_OUTDIR)/VBoxC.rgs $(VBoxCOM_0_OUTDIR)/VirtualBox.tlb
@@ -800,6 +846,7 @@ ifdef VBOX_WITH_32_ON_64_MAIN_API
  VBoxClient-x86_SOURCES = \
  	src-all/EventImpl.cpp \
  	src-all/Global.cpp \
+	src-all/AutoCaller.cpp \
  	src-all/VirtualBoxBase.cpp \
  	src-all/VirtualBoxErrorInfoImpl.cpp \
  	src-client/ClientTokenHolder.cpp \
@@ -815,7 +862,8 @@ ifdef VBOX_WITH_32_ON_64_MAIN_API
   VBoxClient-x86_SOURCES += \
   	src-client/xpcom/module.cpp
  endif
- VBoxClient-x86_LIBS = $(NO_SUCH_VARIABLE)
+ VBoxClient-x86_LIBS = \
+	$(PATH_STAGE_LIB)/VBoxAPIWrap-x86$(VBOX_SUFF_LIB)
  VBoxClient-x86_LIBS.win = $(NO_SUCH_VARIABLE)
  VBoxClient-x86_LIBS.win.x86 = $(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/delayimp.lib
  VBoxClient-x86_CLEAN.win += $(VBoxClient-x86_0_OUTDIR)/VBoxClient-x86.rgs
@@ -836,7 +884,8 @@ endif
 #
 LIBRARIES += VBoxCOM
 VBoxCOM_TEMPLATE        = VBoxMainLib
-VBoxCOM_INTERMEDIATES   = $(VBOX_MAIN_PREREQS)
+VBoxCOM_INTERMEDIATES   = $(VBOX_MAIN_PREREQS) \
+                          $(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
 VBoxCOM_SOURCES         = \
 	glue/com.cpp \
 	glue/initterm.cpp \
@@ -846,7 +895,7 @@ VBoxCOM_SOURCES         = \
 	glue/NativeEventQueue.cpp \
 	glue/ErrorInfo.cpp \
 	glue/errorprint.cpp
-VBoxCOM_INCS          += \
+VBoxCOM_INCS          += $(VBOX_MAIN_APIWRAPPER_INCS) \
 	include
 ifeq ($(KBUILD_TARGET),win)
  VBoxCOM_DEFS.x86       = _WIN32_WINNT=0x0500
@@ -926,6 +975,35 @@ if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "linux"
 endif
 
 
+if defined(VBOX_WITH_MIDL_PROXY_STUB) && "$(KBUILD_TARGET)" == "win"
+ #
+ # Experimental COM proxy + stub DLL.
+ #
+ DLLS += VBoxProxyStub
+ VBoxProxyStub_TEMPLATE = VBOXMAINCOMP
+ VBoxProxyStub_DEFS     = REGISTER_PROXY_DLL
+ VBoxProxyStub_DEFS.win.x86 = WIN32
+ VBoxProxyStub_SOURCES  = \
+ 	$(VBoxCOM_0_OUTDIR)/dlldata.c \
+ 	$(VBoxCOM_0_OUTDIR)/VirtualBox_p.c \
+ 	$(VBoxCOM_0_OUTDIR)/VirtualBox_i.c \
+ 	src-all/win/VBoxProxyStub.def
+
+ ifdef VBOX_WITH_32_ON_64_MAIN_API
+  DLLS += VBoxProxyStub-x86
+  VBoxProxyStub-x86_TEMPLATE = VBoxMainComp-x86
+  VBoxProxyStub-x86_DEFS     = REGISTER_PROXY_DLL
+  VBoxProxyStub-x86_DEFS.win.x86 = WIN32
+  VBoxProxyStub-x86_SOURCES  = \
+  	$(VBoxCOM-x86_0_OUTDIR)/dlldata.c \
+  	$(VBoxCOM-x86_0_OUTDIR)/VirtualBox_p.c \
+  	$(VBoxCOM-x86_0_OUTDIR)/VirtualBox_i.c \
+  	src-all/win/VBoxProxyStub.def
+ endif
+endif
+
+
+
 # generate rules
 include $(FILE_KBUILD_SUB_FOOTER)
 
@@ -954,7 +1032,7 @@ $(VBOX_IDL_HEADER.XPCOM): $(VBOX_IDL_FILE.XPCOM) | $$(dir $$@) $(VBOX_XPIDL)
 
 $(VBOX_IDL_FILE.MSCOM): $(VBOX_PATH_MAIN_SRC)/idl/midl.xsl $(VBOX_XIDL_FILE) | $$(dir $$@)
 	$(call MSG_TOOL,xsltproc,VBoxSVC,$<,$@)
-	$(QUIET)$(VBOX_XSLTPROC) -o $@ $< $(VBOX_XIDL_FILE)
+	$(QUIET)$(VBOX_XSLTPROC) -o $@ $(if $(VBOX_WITH_MIDL_PROXY_STUB),-stringparam g_fGenProxy yes,) $< $(VBOX_XIDL_FILE)
 
 # Aliases for testing purposes.
 ifdef VBOX_WITH_XPCOM
@@ -972,9 +1050,11 @@ $(VBoxCOM_0_OUTDIR)/VirtualBox_XPCOM_i.c: $(VBOX_PATH_MAIN_SRC)/idl/xpidl_iid.xs
 
 $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c \
 + $(VBoxCOM_0_OUTDIR)/VirtualBox.h \
+$(if $(VBOX_WITH_MIDL_PROXY_STUB),+ $(VBoxCOM_0_OUTDIR)/VirtualBox_p.c + $(VBoxCOM_0_OUTDIR)/dlldata.c,) \
 + $(VBoxCOM_0_OUTDIR)/VirtualBox.tlb: $(VBOX_IDL_FILE.MSCOM) | $$(dir $$@)
 	$(VBOX_WIN_MIDL) /nologo \
-		$(if-expr "$(KBUILD_TARGET_ARCH)" == "amd64" && "$(KBUILD_HOST)" == "win",/env amd64,/env win32) /target NT51 \
+		$(if-expr "$(KBUILD_TARGET_ARCH)" == "amd64" && "$(KBUILD_HOST)" == "win",/env amd64,/env win32) \
+		/robust /protocol all /target NT51 \
 		/out $(call VBOX_FN_MAKE_WIN_PATH,$(VBoxCOM_0_OUTDIR)) \
 		/cpp_cmd $(subst $(EXEC_X86_WIN32),,$(call VBOX_FN_MAKE_WIN_PATH,$(TOOL_$(VBOX_VCC_TOOL)_CC))) \
 		/I $(call VBOX_FN_MAKE_WIN_PATH,$(PATH_SDK_$(VBOX_WINPSDK)_INC)) \
@@ -983,8 +1063,10 @@ $(VBoxCOM_0_OUTDIR)/VirtualBox_i.c \
 
 $(VBoxCOM-x86_0_OUTDIR)/VirtualBox_i.c \
 + $(VBoxCOM-x86_0_OUTDIR)/VirtualBox.h \
+$(if $(VBOX_WITH_MIDL_PROXY_STUB),+ $(VBoxCOM-x86_0_OUTDIR)/VirtualBox_p.c + $(VBoxCOM-x86_0_OUTDIR)/dlldata.c,) \
 + $(VBoxCOM-x86_0_OUTDIR)/VirtualBox-x86.tlb: $(VBOX_IDL_FILE.MSCOM) | $$(dir $$@)
 	$(VBOX_WIN_MIDL) /nologo /env win32 /target NT51 \
+		/robust /protocol all \
 		/out $(call VBOX_FN_MAKE_WIN_PATH,$(VBoxCOM-x86_0_OUTDIR)) \
 		/tlb $(call VBOX_FN_MAKE_WIN_PATH,$(VBoxCOM-x86_0_OUTDIR)/VirtualBox-x86.tlb) \
 		/cpp_cmd $(subst $(EXEC_X86_WIN32),,$(call VBOX_FN_MAKE_WIN_PATH,$(TOOL_$(VBOX_VCC_TOOL_STEM)X86_CC))) \
@@ -1003,6 +1085,10 @@ VBoxSVC_VBOX_TRANSLATIONS = \
 
 VBoxC_VBOX_HEADERS = \
 	include/ConsoleImpl.h
+
+VBoxC_VBOX_INTERMEDIATES   = $(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
+VBoxC_VBOX_HEADERS += $(VBOX_MAIN_APIWRAPPER_INCS)
+
 VBoxC_VBOX_TRANSLATIONS = \
 	nls/VBoxC_de.ts
 
@@ -1075,34 +1161,101 @@ javagluesample_SOURCES = \
 	$(VBOX_PATH_MAIN_SRC)/glue/tests/TestVBox.java=>TestVBox.java \
 	$(VBOX_PATH_MAIN_SRC)/glue/tests/Makefile=>Makefile
 
-# moved those rules to the end so that VBoxAPIWrap_0_OUTDIR can be expanded without $$ trickery
-$(VBoxAPIWrap_RAWSRC) \
-+| $(VBoxAPIWrap_GENERATEDSOURCES): \
+#
+# Rules associated with VBoxAPIWrap (in typical invocation order).
+# We keep them down here to simplify the use of VBoxAPIWrap_0_OUTDIR.
+#
+
+# Generate a make include file which lists the wrapper header and source files.
+$(VBoxAPIWrap_VBOX_KMK_FILE).ts \
++| $(VBoxAPIWrap_VBOX_KMK_FILE): \
 		$(VBOX_XIDL_FILE) \
-		$(VBoxAPIWrap_XSLT) \
+		$(VBOX_PATH_MAIN_SRC)/idl/apiwrap-server-filelist.xsl \
+		$(VBOX_PATH_MAIN_SRC)/Makefile.kmk
+	$(call MSG_GENERATE,,$(VBoxAPIWrap_VBOX_KMK_FILE))
+	$(QUIET)$(RM) -f $@
+	$(QUIET)$(MKDIR) -p $(@D)
+	$(QUIET)$(VBOX_XSLTPROC) --stringparam KBUILD_HOST $(KBUILD_HOST) \
+		-o $@ $(VBOX_PATH_MAIN_SRC)/idl/apiwrap-server-filelist.xsl $<
+	$(QUIET)$(CP) --changed -fv $@ $(VBoxAPIWrap_VBOX_KMK_FILE)
+
+# Generate the header files for the wrappers.
+$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-headers \
++| $(VBOX_MAIN_APIWRAPPER_GEN_HDRS): \
+		$(VBOX_XIDL_FILE) \
+               $(VBOX_PATH_MAIN_SRC)/idl/typemap-shared.inc.xsl \
+		$(VBoxAPIWrap_VBOX_XSLT) \
 		$(VBOX_FILESPLIT) \
 		| $$(dir $$@)
-	$(call MSG_L1,Generating C++ Server API wrapper files from XIDL)
-	$(QUIET)$(RM) -f $(filter-out $(VBoxAPIWrap_GENERATEDSOURCES),$(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.cpp) $(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.h))
-	$(QUIET)$(VBOX_XSLTPROC) --stringparam filelistonly "" -o $@ $(VBoxAPIWrap_XSLT) $<
+	$(call MSG_L1,Generating C++ Server API wrapper header files from XIDL)
+	$(QUIET)$(RM) -f -- $(filter-out $(VBOX_MAIN_APIWRAPPER_GEN_HDRS), $(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.h))
+	$(QUIET)$(VBOX_XSLTPROC) --stringparam KBUILD_HOST $(KBUILD_HOST) \
+		--stringparam generating "headers" \
+		-o $@ $(VBoxAPIWrap_VBOX_XSLT) $<
 	$(QUIET)$(VBOX_FILESPLIT) $@ $(VBoxAPIWrap_0_OUTDIR)
 
-$(VBoxAPIWrap_KMK).ts +| $(VBoxAPIWrap_KMK): $(VBOX_XIDL_FILE) $(VBoxAPIWrap_XSLT)
-	$(call MSG_GENERATE,,$(VBoxAPIWrap_KMK))
-	$(QUIET)$(RM) -f $@
-	$(QUIET)$(MKDIR) -p $(@D)
-	$(QUIET)$(VBOX_XSLTPROC) --stringparam filelistonly VBoxAPIWrap_VBOX_APIWRAPPERFILES -o $@ $(VBoxAPIWrap_XSLT) $<
-	$(QUIET)$(CP) --changed -fv $@ $(VBoxAPIWrap_KMK)
+# Generate the DTrace probes for the wrappers and combine them with handcoded probes.
+$(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d.ts \
++| $(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d: \
+		$(VBOX_XIDL_FILE) \
+               $(VBOX_PATH_MAIN_SRC)/idl/typemap-shared.inc.xsl \
+		$(VBoxAPIWrap_VBOX_XSLT) \
+		$(VBOX_FILESPLIT) \
+		| $$(dir $$@)
+	$(call MSG_L1,Generating DTrace Provider for the VBox API (from XIDL))
+	$(QUIET)$(RM) -f -- "$@" "$@.tmp"
+	$(QUIET)$(VBOX_XSLTPROC) --stringparam KBUILD_HOST $(KBUILD_HOST) \
+		--stringparam generating "dtrace-probes" \
+		-o "$@" $(VBoxAPIWrap_VBOX_XSLT) $<
+	$(QUIET)$(SED) -e '' -o "$@.tmp" \
+		"$(VBOX_PATH_MAIN_SRC)/src-all/VBoxAPI-start.d" \
+		"$@" \
+		"$(VBOX_PATH_MAIN_SRC)/src-all/VBoxAPI-end.d"
+	$(QUIET)$(MV) -- "$@.tmp" "$@"
+	$(QUIET)$(CP) --changed -fv -- "$@" "$(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d"
+
+# Generate the wrapper source files - split in two due to long processing time
+$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-sources-even \
++| $(VBOX_MAIN_APIWRAPPER_GEN_SRCS_EVEN): \
+		$(VBOX_XIDL_FILE) \
+               $(VBOX_PATH_MAIN_SRC)/idl/typemap-shared.inc.xsl \
+		$(VBoxAPIWrap_VBOX_XSLT) \
+		$(VBOX_FILESPLIT) \
+		| $$(dir $$@)
+	$(call MSG_L1,Generating C++ Server API wrapper files from XIDL - part 1)
+	$(QUIET)$(RM) -f -- $(filter-out $(VBOX_MAIN_APIWRAPPER_GEN_SRCS), $(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.cpp))
+	$(QUIET)$(VBOX_XSLTPROC) --stringparam KBUILD_HOST $(KBUILD_HOST) \
+		--stringparam generating "sources" \
+		--param reminder 0 \
+		-o $@ $(VBoxAPIWrap_VBOX_XSLT) $<
+	$(QUIET)$(VBOX_FILESPLIT) $@ $(VBoxAPIWrap_0_OUTDIR)
 
+$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-sources-odd \
++| $(VBOX_MAIN_APIWRAPPER_GEN_SRCS_ODD): \
+		$(VBOX_XIDL_FILE) \
+               $(VBOX_PATH_MAIN_SRC)/idl/typemap-shared.inc.xsl \
+		$(VBoxAPIWrap_VBOX_XSLT) \
+		$(VBOX_FILESPLIT) \
+		| $$(dir $$@)
+	$(call MSG_L1,Generating C++ Server API wrapper files from XIDL - part 2)
+	$(QUIET)$(RM) -f -- $(filter-out $(VBOX_MAIN_APIWRAPPER_GEN_SRCS), $(wildcard $(VBoxAPIWrap_0_OUTDIR)/*.cpp))
+	$(QUIET)$(VBOX_XSLTPROC) --stringparam KBUILD_HOST $(KBUILD_HOST) \
+		--stringparam generating "sources" \
+		--param reminder 1 \
+		-o $@ $(VBoxAPIWrap_VBOX_XSLT) $<
+	$(QUIET)$(VBOX_FILESPLIT) $@ $(VBoxAPIWrap_0_OUTDIR)
+
+testapiwrappers:: \
+	$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-headers \
+	$(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d.ts \
+	$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-sources-odd \
+	$(VBoxAPIWrap_0_OUTDIR)/apiwrappers-sources-even
+
+
+#
+# NLS stuff.
+#
 updatenls::
 	$(VBOX_LUPDATE) $(VBoxSVC_SOURCES) $(VBoxSVC_VBOX_HEADERS) -ts $(VBoxSVC_VBOX_TRANSLATIONS)
 	$(VBOX_LUPDATE) $(VBoxC_SOURCES) $(VBoxC_VBOX_HEADERS) -ts $(VBoxC_VBOX_TRANSLATIONS)
 
-testconverter:: $(VBOX_USER_HOME)/VirtualBox.xml
-	$(call MSG_TOOL,xsltproc,Test Settings Converter,$<,$(VBOX_USER_HOME)/VirtualBox.xml.test)
-	$(QUIET)$(VBOX_XSLTPROC) -o $(VBOX_USER_HOME)/VirtualBox.xml.test xml/SettingsConverter.xsl $<
-
-testconverter2:: $(VBOX_USER_HOME)/Machines/dos/dos.xml
-	$(call MSG_TOOL,xsltproc,Test Settings Converter,$<,$<.test)
-	$(QUIET)$(VBOX_XSLTPROC) -o $<.test xml/SettingsConverter.xsl $<
-
diff --git a/src/VBox/Main/cbinding/LegacyVBoxXPCOMCGlue.c b/src/VBox/Main/cbinding/LegacyVBoxXPCOMCGlue.c
deleted file mode 100644
index 73db613..0000000
--- a/src/VBox/Main/cbinding/LegacyVBoxXPCOMCGlue.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* $Revision: 96259 $ */
-/** @file VBoxXPCOMCGlue.c
- * Glue code for dynamically linking to VBoxCAPI, LEGACY VARIANT.
- */
-
-/*
- * Copyright (C) 2008-2014 Oracle Corporation
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#include "VBoxXPCOMCGlue.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdint.h>
-#ifndef WIN32
-# include <dlfcn.h>
-# include <pthread.h>
-#else /* WIN32 */
-# include <Windows.h>
-#endif /* WIN32 */
-
-
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
-#if defined(__linux__) || defined(__linux_gnu__) || defined(__sun__) || defined(__FreeBSD__)
-# define DYNLIB_NAME        "VBoxXPCOMC.so"
-#elif defined(__APPLE__)
-# define DYNLIB_NAME        "VBoxXPCOMC.dylib"
-#elif defined(__OS2__)
-# define DYNLIB_NAME        "VBoxXPCOMC.dll"
-#elif defined(WIN32)
-# define DYNLIB_NAME        "VBoxCAPI.dll"
-#else
-# error "Port me"
-#endif
-
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
-/** The so/dynsym/dll handle for VBoxCAPI. */
-#ifndef WIN32
-void *g_hVBoxCAPI = NULL;
-#else /* WIN32 */
-HMODULE g_hVBoxCAPI = NULL;
-#endif /* WIN32 */
-/** The last load error. */
-char g_szVBoxErrMsg[256] = "";
-/** Pointer to the VBOXCAPI function table. */
-PCVBOXCAPI g_pVBoxFuncs = NULL;
-/** Pointer to VBoxGetCAPIFunctions for the loaded VBoxCAPI so/dylib/dll. */
-PFNVBOXGETCAPIFUNCTIONS g_pfnGetFunctions = NULL;
-
-typedef void FNDUMMY(void);
-typedef FNDUMMY *PFNDUMMY;
-/** Just a dummy global structure containing a bunch of
- * function pointers to code which is wanted in the link. */
-PFNDUMMY g_apfnVBoxCAPIGlue[] =
-{
-#ifndef WIN32
-    /* The following link dependency is for helping gdb as it gets hideously
-     * confused if the application doesn't drag in pthreads, but uses it. */
-    (PFNDUMMY)pthread_create,
-#endif /* !WIN32 */
-    NULL
-};
-
-
-/**
- * Wrapper for setting g_szVBoxErrMsg. Can be an empty stub.
- *
- * @param   fAlways         When 0 the g_szVBoxErrMsg is only set if empty.
- * @param   pszFormat       The format string.
- * @param   ...             The arguments.
- */
-static void setErrMsg(int fAlways, const char *pszFormat, ...)
-{
-    if (    fAlways
-        ||  !g_szVBoxErrMsg[0])
-    {
-        va_list va;
-        va_start(va, pszFormat);
-        vsnprintf(g_szVBoxErrMsg, sizeof(g_szVBoxErrMsg), pszFormat, va);
-        va_end(va);
-    }
-}
-
-
-/**
- * Try load C API .so/dylib/dll from the specified location and resolve all
- * the symbols we need. Tries both the new style and legacy name.
- *
- * @returns 0 on success, -1 on failure.
- * @param   pszHome         The directory where to try load VBoxCAPI/VBoxXPCOMC
- *                          from. Can be NULL.
- * @param   fSetAppHome     Whether to set the VBOX_APP_HOME env.var. or not
- *                          (boolean).
- */
-static int tryLoadLibrary(const char *pszHome, int fSetAppHome)
-{
-    size_t      cchHome = pszHome ? strlen(pszHome) : 0;
-    size_t      cbBufNeeded;
-    char        szName[4096];
-
-    /*
-     * Construct the full name.
-     */
-    cbBufNeeded = cchHome + sizeof("/" DYNLIB_NAME);
-    if (cbBufNeeded > sizeof(szName))
-    {
-        setErrMsg(1, "path buffer too small: %u bytes needed",
-                  (unsigned)cbBufNeeded);
-        return -1;
-    }
-    if (cchHome)
-    {
-        memcpy(szName, pszHome, cchHome);
-        szName[cchHome] = '/';
-        cchHome++;
-    }
-    memcpy(&szName[cchHome], DYNLIB_NAME, sizeof(DYNLIB_NAME));
-
-    /*
-     * Try load it by that name, setting the VBOX_APP_HOME first (for now).
-     * Then resolve and call the function table getter.
-     */
-    if (fSetAppHome)
-    {
-#ifndef WIN32
-        if (pszHome)
-            setenv("VBOX_APP_HOME", pszHome, 1 /* always override */);
-        else
-            unsetenv("VBOX_APP_HOME");
-#endif /* !WIN32 */
-    }
-
-#ifndef WIN32
-    g_hVBoxCAPI = dlopen(szName, RTLD_NOW | RTLD_LOCAL);
-    if (g_hVBoxCAPI)
-    {
-        PFNVBOXGETCAPIFUNCTIONS pfnGetFunctions;
-        pfnGetFunctions = (PFNVBOXGETCAPIFUNCTIONS)(uintptr_t)
-            dlsym(g_hVBoxCAPI, VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME);
-#ifdef VBOX_GET_XPCOM_FUNCTIONS_SYMBOL_NAME
-        if (!pfnGetFunctions)
-            pfnGetFunctions = (PFNVBOXGETCAPIFUNCTIONS)(uintptr_t)
-                dlsym(g_hVBoxCAPI, VBOX_GET_XPCOM_FUNCTIONS_SYMBOL_NAME);
-#endif /* VBOX_GET_XPCOM_FUNCTIONS_SYMBOL_NAME */
-        if (pfnGetFunctions)
-        {
-            g_pVBoxFuncs = pfnGetFunctions(VBOX_CAPI_VERSION);
-            if (g_pVBoxFuncs)
-            {
-                g_pfnGetFunctions = pfnGetFunctions;
-                return 0;
-            }
-
-            /* bail out */
-            setErrMsg(1, "%.80s: pfnGetFunctions(%#x) failed",
-                      szName, VBOX_CAPI_VERSION);
-        }
-        else
-            setErrMsg(1, "dlsym(%.80s/%.32s): %.128s",
-                      szName, VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME, dlerror());
-        dlclose(g_hVBoxCAPI);
-        g_hVBoxCAPI = NULL;
-    }
-    else
-        setErrMsg(0, "dlopen(%.80s): %.160s", szName, dlerror());
-#else /* !WIN32 */
-    g_hVBoxCAPI = LoadLibraryExA(szName, NULL /* hFile */, 0 /* dwFlags */);
-    if (g_hVBoxCAPI)
-    {
-        PFNVBOXGETCAPIFUNCTIONS pfnGetFunctions;
-        pfnGetFunctions = (PFNVBOXGETCAPIFUNCTIONS)
-            GetProcAddress(g_hVBoxCAPI, VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME);
-        if (pfnGetFunctions)
-        {
-            g_pVBoxFuncs = pfnGetFunctions(VBOX_CAPI_VERSION);
-            if (g_pVBoxFuncs)
-            {
-                g_pfnGetFunctions = pfnGetFunctions;
-                return 0;
-            }
-
-            /* bail out */
-            setErrMsg(1, "%.80s: pfnGetFunctions(%#x) failed",
-                      szName, VBOX_CAPI_VERSION);
-        }
-        else
-            setErrMsg(1, "GetProcAddress(%.80s/%.32s): %d",
-                      szName, VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME, GetLastError());
-        FreeLibrary(g_hVBoxCAPI);
-        g_hVBoxCAPI = NULL;
-    }
-    else
-        setErrMsg(0, "LoadLibraryEx(%.80s): %d", szName, GetLastError());
-#endif /* !WIN32 */
-
-    return -1;
-}
-
-
-/**
- * Tries to locate and load VBoxCAPI.so/dylib/dll, resolving all the related
- * function pointers.
- *
- * @returns 0 on success, -1 on failure.
- *
- * @remark  This should be considered moved into a separate glue library since
- *          its its going to be pretty much the same for any user of VBoxCAPI
- *          and it will just cause trouble to have duplicate versions of this
- *          source code all around the place.
- */
-int VBoxCGlueInit(void)
-{
-    const char *pszHome;
-
-    memset(g_szVBoxErrMsg, 0, sizeof(g_szVBoxErrMsg));
-
-    /*
-     * If the user specifies the location, try only that.
-     */
-    pszHome = getenv("VBOX_APP_HOME");
-    if (pszHome)
-        return tryLoadLibrary(pszHome, 0);
-
-    /*
-     * Try the known standard locations.
-     */
-#if defined(__gnu__linux__) || defined(__linux__)
-    if (tryLoadLibrary("/opt/VirtualBox", 1) == 0)
-        return 0;
-    if (tryLoadLibrary("/usr/lib/virtualbox", 1) == 0)
-        return 0;
-#elif defined(__sun__)
-    if (tryLoadLibrary("/opt/VirtualBox/amd64", 1) == 0)
-        return 0;
-    if (tryLoadLibrary("/opt/VirtualBox/i386", 1) == 0)
-        return 0;
-#elif defined(__APPLE__)
-    if (tryLoadLibrary("/Applications/VirtualBox.app/Contents/MacOS", 1) == 0)
-        return 0;
-#elif defined(__FreeBSD__)
-    if (tryLoadLibrary("/usr/local/lib/virtualbox", 1) == 0)
-        return 0;
-#elif defined(__OS2__)
-    if (tryLoadLibrary("C:/Apps/VirtualBox", 1) == 0)
-        return 0;
-#elif defined(WIN32)
-    pszHome = getenv("ProgramFiles");
-    if (pszHome)
-    {
-        char szPath[4096];
-        size_t cb = sizeof(szPath);
-        char *tmp = szPath;
-        strncpy(tmp, pszHome, cb);
-        tmp[cb - 1] = '\0';
-        cb -= strlen(tmp);
-        tmp += strlen(tmp);
-        strncpy(tmp, "/Oracle/VirtualBox", cb);
-        tmp[cb - 1] = '\0';
-        if (tryLoadLibrary(szPath, 1) == 0)
-            return 0;
-    }
-    if (tryLoadLibrary("C:/Program Files/Oracle/VirtualBox", 1) == 0)
-        return 0;
-#else
-# error "port me"
-#endif
-
-    /*
-     * Finally try the dynamic linker search path.
-     */
-    if (tryLoadLibrary(NULL, 1) == 0)
-        return 0;
-
-    /* No luck, return failure. */
-    return -1;
-}
-
-
-/**
- * Terminate the C glue library.
- */
-void VBoxCGlueTerm(void)
-{
-    if (g_hVBoxCAPI)
-    {
-#if 0 /* VBoxRT.so doesn't like being reloaded. See @bugref{3725}. */
-#ifndef WIN32
-        dlclose(g_hVBoxCAPI);
-#else
-        FreeLibrary(g_hVBoxCAPI);
-#endif
-#endif
-        g_hVBoxCAPI = NULL;
-    }
-    g_pVBoxFuncs = NULL;
-    g_pfnGetFunctions = NULL;
-    memset(g_szVBoxErrMsg, 0, sizeof(g_szVBoxErrMsg));
-}
-
diff --git a/src/VBox/Main/cbinding/LegacyVBoxXPCOMCGlue.h b/src/VBox/Main/cbinding/LegacyVBoxXPCOMCGlue.h
deleted file mode 100644
index a6670fa..0000000
--- a/src/VBox/Main/cbinding/LegacyVBoxXPCOMCGlue.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $Revision: 91907 $ */
-/** @file VBoxXPCOMCGlue.h
- * Glue for dynamically linking with VBoxCAPI, LEGACY VARIANT.
- */
-
-/*
- * Copyright (C) 2008-2014 Oracle Corporation
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef ___VBoxXPCOMCGlue_h
-#define ___VBoxXPCOMCGlue_h
-
-#undef VBOX_WITH_GLUE
-#include "VBoxCAPI_v4_3.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** The so/dynsym/dll handle for VBoxCAPI. */
-#ifndef WIN32
-extern void *g_hVBoxCAPI;
-#else
-extern HMODULE g_hVBoxCAPI;
-#endif
-/** The last load error. */
-extern char g_szVBoxErrMsg[256];
-/** Pointer to the VBOXCAPI function table. */
-extern PCVBOXCAPI g_pVBoxFuncs;
-/** Pointer to VBoxGetCAPIFunctions for the loaded VBoxCAPI so/dylib/dll. */
-extern PFNVBOXGETCAPIFUNCTIONS g_pfnGetFunctions;
-
-
-int VBoxCGlueInit(void);
-void VBoxCGlueTerm(void);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/VBox/Main/cbinding/Makefile.kmk b/src/VBox/Main/cbinding/Makefile.kmk
index 0d7118d..7f7f278 100644
--- a/src/VBox/Main/cbinding/Makefile.kmk
+++ b/src/VBox/Main/cbinding/Makefile.kmk
@@ -49,6 +49,7 @@ CAPIHeaders_SOURCES = \
 	VBoxCAPI_v4_0.h \
 	VBoxCAPI_v4_1.h \
 	VBoxCAPI_v4_2.h \
+	VBoxCAPI_v4_3.h \
 	$(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h=>VBoxCAPI_v$(VBOX_API_VERSION).h
 
 $$(CAPIHeaders_0_OUTDIR)/VBoxCAPIGlue.h: \
@@ -62,36 +63,12 @@ $$(CAPIHeaders_0_OUTDIR)/VBoxCAPIGlue.h: \
 
 $$(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h: \
 		$(PATH_SUB_CURRENT)/capiidl.xsl \
+		$(PATH_SUB_CURRENT)/../idl/typemap-shared.inc.xsl \
 		$(VBOX_XIDL_FILE) \
 		| $$(dir $$@)
 	$(call MSG_TOOL,xsltproc,CAPIHeaders,$<,$@)
 	$(QUIET)$(VBOX_XSLTPROC) -o $@ $^
 
-# Additional legacy install, to keep compatibility with older 4.3 SDK packages,
-# to avoid breaking 3rd party code in the middle of the 4.3 release.
-INSTALLS += LegacyXPCOMCGlue
-LegacyXPCOMCGlue_MODE = a+r,u+rw
-LegacyXPCOMCGlue_INST = \
-	$(INST_SDK)bindings/xpcom/cbinding/
-LegacyXPCOMCGlue_SOURCES = \
-	LegacyVBoxXPCOMCGlue.c=>VBoxXPCOMCGlue.c \
-	LegacyVBoxXPCOMCGlue.h=>VBoxXPCOMCGlue.h
-
-# Additional legacy install, to keep compatibility with older 4.3 SDK packages,
-# to avoid breaking 3rd party code in the middle of the 4.3 release.
-INSTALLS += LegacyXPCOMCHeaders
-LegacyXPCOMCHeaders_MODE = a+r,u+rw
-LegacyXPCOMCHeaders_INST = $(INST_SDK)bindings/xpcom/include/
-LegacyXPCOMCHeaders_SOURCES = \
-	VBoxCAPI_v2_2.h \
-	VBoxCAPI_v3_0.h \
-	VBoxCAPI_v3_1.h \
-	VBoxCAPI_v3_2.h \
-	VBoxCAPI_v4_0.h \
-	VBoxCAPI_v4_1.h \
-	VBoxCAPI_v4_2.h \
-	$(CAPIHeaders_0_OUTDIR)/VBoxCAPI.h=>VBoxCAPI_v$(VBOX_API_VERSION).h
-
 if !defined(VBOX_ONLY_SDK)
 
  #
diff --git a/src/VBox/Main/cbinding/VBoxCAPI.rc b/src/VBox/Main/cbinding/VBoxCAPI.rc
index 63121f3..8e2a217 100644
--- a/src/VBox/Main/cbinding/VBoxCAPI.rc
+++ b/src/VBox/Main/cbinding/VBoxCAPI.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox C Bindings\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxCAPI\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxCAPI.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Main/cbinding/VBoxCAPIGlue.c b/src/VBox/Main/cbinding/VBoxCAPIGlue.c
index a42351e..9ee6ed7 100644
--- a/src/VBox/Main/cbinding/VBoxCAPIGlue.c
+++ b/src/VBox/Main/cbinding/VBoxCAPIGlue.c
@@ -1,4 +1,4 @@
-/* $Revision: 97956 $ */
+/* $Id: VBoxCAPIGlue.c $ */
 /** @file
  * Glue code for dynamically linking to VBoxCAPI.
  */
diff --git a/src/VBox/Main/cbinding/VBoxCAPIGlue.h.in b/src/VBox/Main/cbinding/VBoxCAPIGlue.h.in
index 603b136..9ef5314 100644
--- a/src/VBox/Main/cbinding/VBoxCAPIGlue.h.in
+++ b/src/VBox/Main/cbinding/VBoxCAPIGlue.h.in
@@ -1,4 +1,4 @@
-/* $Revision: 91907 $ */
+/* $Revision: 91752 $ */
 /** @file VBoxCAPIGlue.h
  * Glue for dynamically linking with VBoxCAPI.
  */
diff --git a/src/VBox/Main/cbinding/VBoxCAPI_v4_2.h b/src/VBox/Main/cbinding/VBoxCAPI_v4_2.h
index 1db8217..61b6d65 100644
--- a/src/VBox/Main/cbinding/VBoxCAPI_v4_2.h
+++ b/src/VBox/Main/cbinding/VBoxCAPI_v4_2.h
@@ -2858,11 +2858,11 @@ struct IVFSExplorer_vtbl
         PRUint32 *aNamesSize,
         PRUnichar *** aNames,
         PRUint32 *aTypesSize,
-        PRUint32** aTypes,
+        PRUint32* aTypes,
         PRUint32 *aSizesSize,
-        PRUint32** aSizes,
+        PRUint32* aSizes,
         PRUint32 *aModesSize,
-        PRUint32** aModes
+        PRUint32* aModes
     );
 
     nsresult (*Exists)(
@@ -2966,7 +2966,7 @@ struct IVirtualSystemDescription_vtbl
     nsresult (*GetDescription)(
         IVirtualSystemDescription *pThis,
         PRUint32 *aTypesSize,
-        PRUint32** aTypes,
+        PRUint32* aTypes,
         PRUint32 *aRefsSize,
         PRUnichar *** aRefs,
         PRUint32 *aOvfValuesSize,
@@ -2981,7 +2981,7 @@ struct IVirtualSystemDescription_vtbl
         IVirtualSystemDescription *pThis,
         PRUint32 aType,
         PRUint32 *aTypesSize,
-        PRUint32** aTypes,
+        PRUint32* aTypes,
         PRUint32 *aRefsSize,
         PRUnichar *** aRefs,
         PRUint32 *aOvfValuesSize,
@@ -3171,7 +3171,7 @@ struct IInternalMachineControl_vtbl
         PRUint32 *valueSize,
         PRUnichar *** value,
         PRUint32 *timestampSize,
-        PRInt64** timestamp,
+        PRInt64* timestamp,
         PRUint32 *flagsSize,
         PRUnichar *** flags
     );
@@ -3905,7 +3905,7 @@ struct IMachine_vtbl
         PRUint32 *valueSize,
         PRUnichar *** value,
         PRUint32 *timestampSize,
-        PRInt64** timestamp,
+        PRInt64* timestamp,
         PRUint32 *flagsSize,
         PRUnichar *** flags
     );
@@ -5408,7 +5408,7 @@ struct IGuest_vtbl
         PRUint32 *formatSize,
         PRUnichar *** format,
         PRUint32 *allowedActionsSize,
-        PRUint32** allowedActions,
+        PRUint32* allowedActions,
         PRUint32 * defaultAction
     );
 
@@ -5835,7 +5835,7 @@ struct IMediumFormat_vtbl
         PRUint32 *extensionsSize,
         PRUnichar *** extensions,
         PRUint32 *typeSize,
-        PRUint32** type
+        PRUint32* type
     );
 
     nsresult (*DescribeProperties)(
@@ -5845,9 +5845,9 @@ struct IMediumFormat_vtbl
         PRUint32 *descriptionSize,
         PRUnichar *** description,
         PRUint32 *typesSize,
-        PRUint32** types,
+        PRUint32* types,
         PRUint32 *flagsSize,
-        PRUint32** flags,
+        PRUint32* flags,
         PRUint32 *defaultsSize,
         PRUnichar *** defaults
     );
@@ -6987,7 +6987,7 @@ struct IInternalSessionControl_vtbl
         PRUint32 *valueSize,
         PRUnichar *** value,
         PRUint32 *timestampSize,
-        PRInt64** timestamp,
+        PRInt64* timestamp,
         PRUint32 *flagsSize,
         PRUnichar *** flags
     );
@@ -7206,17 +7206,17 @@ struct IPerformanceCollector_vtbl
         PRUint32 *returnMetricNamesSize,
         PRUnichar *** returnMetricNames,
         PRUint32 *returnObjectsSize,
-        nsISupports *** returnObjects,
+        nsISupports ** returnObjects,
         PRUint32 *returnUnitsSize,
         PRUnichar *** returnUnits,
         PRUint32 *returnScalesSize,
-        PRUint32** returnScales,
+        PRUint32* returnScales,
         PRUint32 *returnSequenceNumbersSize,
-        PRUint32** returnSequenceNumbers,
+        PRUint32* returnSequenceNumbers,
         PRUint32 *returnDataIndicesSize,
-        PRUint32** returnDataIndices,
+        PRUint32* returnDataIndices,
         PRUint32 *returnDataLengthsSize,
-        PRUint32** returnDataLengths,
+        PRUint32* returnDataLengths,
         PRUint32 *returnDataSize,
         PRInt32** returnData
     );
@@ -8825,133 +8825,22 @@ typedef struct VBOXXPCOMC
     /** The structure version. */
     unsigned uVersion;
 
-    /** Gets the VirtualBox version, major * 1000000 + minor * 1000 + patch. */
     unsigned int (*pfnGetVersion)(void);
 
-    /** Gets the VirtualBox API version, major * 1000 + minor, e.g. 4003. */
-    unsigned int (*pfnGetAPIVersion)(void);
-
-    /**
-     * New and preferred way to initialize the C bindings for an API client.
-     *
-     * This way is much more flexible, as it can easily handle multiple
-     * sessions (important with more complicated API clients, including
-     * multithreaded ones), and even VBoxSVC crashes can be detected and
-     * processed appropriately by listening for events from the associated
-     * event source in VirtualBoxClient. It is completely up to the client
-     * to decide what to do (terminate or continue after getting new
-     * object references to server-side objects). Must be called in the
-     * primary thread of the client, later API use can be done in any
-     * thread.
-     *
-     * Note that the returned reference is owned by the caller, and thus it's
-     * the caller's responsibility to handle the reference count appropriately.
-     *
-     * @param pszVirtualBoxClientIID    pass IVIRTUALBOXCLIENT_IID_STR
-     * @param ppVirtualBoxClient        output parameter for VirtualBoxClient
-     *              reference, handled as usual with XPCOM.
-     * @returns XPCOM error code
-     */
-    nsresult (*pfnClientInitialize)(const char *pszVirtualBoxClientIID,
-                                    IVirtualBoxClient **ppVirtualBoxClient);
-    /**
-     * Uninitialize the C bindings for an API client.
-     *
-     * Should be called when the API client is about to terminate and does
-     * not want to use the C bindings any more. It will invalidate all
-     * object references. It is possible, however, to change one's mind,
-     * and call pfnClientInitialize again to continue using the API, as long
-     * as none of the object references from before the re-initialization
-     * are used. Must be called from the primary thread of the client.
-     */
-    void (*pfnClientUninitialize)(void);
-
-    /**
-     * Deprecated way to initialize the C bindings and getting important
-     * object references. Kept for backwards compatibility.
-     *
-     * If any returned reference is NULL then the initialization failed.
-     * Note that the returned references are owned by the C bindings. The
-     * number of calls to Release in the client code must match the number
-     * of calls to AddRef, and additionally at no point in time there can
-     * be more Release calls than AddRef calls.
-     *
-     * @param pszVirtualBoxIID      pass IVIRTUALBOX_IID_STR
-     * @param ppVirtualBox          output parameter for VirtualBox reference,
-     *          owned by C bindings
-     * @param pszSessionIID         pass ISESSION_IID_STR
-     * @param ppSession             output parameter for Session reference,
-     *          owned by C bindings
-     */
     void  (*pfnComInitialize)(const char *pszVirtualBoxIID,
                               IVirtualBox **ppVirtualBox,
                               const char *pszSessionIID,
                               ISession **ppSession);
-    /**
-     * Deprecated way to uninitialize the C bindings for an API client.
-     * Kept for backwards compatibility and must be used if the C bindings
-     * were initialized using pfnComInitialize. */
     void (*pfnComUninitialize)(void);
 
-    /**
-     * Free memory managed by XPCOM.
-     *
-     * @param pv        pointer to memory block to be freed
-     */
     void  (*pfnComUnallocMem)(void *pv);
+    void  (*pfnUtf16Free)(PRUnichar *pwszString);
+    void  (*pfnUtf8Free)(char *pszString);
 
-    /**
-     * Convert string from UTF-16 encoding to UTF-8 encoding.
-     *
-     * @param pwszString    input string
-     * @param ppszString    output string
-     * @returns IPRT status code
-     */
     int   (*pfnUtf16ToUtf8)(const PRUnichar *pwszString, char **ppszString);
-    /**
-     * Convert string from UTF-8 encoding to UTF-16 encoding.
-     *
-     * @param pszString     input string
-     * @param ppwszString   output string
-     * @returns IPRT status code
-     */
     int   (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString);
-    /**
-     * Free memory returned by pfnUtf16ToUtf8. Do not use for anything else.
-     *
-     * @param pszString     string to be freed.
-     */
-    void  (*pfnUtf8Free)(char *pszString);
-    /**
-     * Free memory returned by pfnUtf8ToUtf16. Do not use for anything else.
-     *
-     * @param pwszString    string to be freed.
-     */
-    void  (*pfnUtf16Free)(PRUnichar *pwszString);
 
-    /**
-     * Get main XPCOM event queue.
-     *
-     * @param ppEventQueue      output parameter for nsIEventQueue reference,
-     *              owned by C bindings.
-     */
-    void  (*pfnGetEventQueue)(nsIEventQueue **ppEventQueue);
-
-    /**
-     * Get current XPCOM exception.
-     *
-     * @param ppException       output parameter for nsIException reference,
-     *              may be @c NULL if no exception object has been created by
-     *              a previous XPCOM call.
-     * @returns XPCOM error code
-     */
-    nsresult (*pfnGetException)(nsIException **ppException);
-    /**
-     * Clears current XPCOM exception.
-     *
-     * @returns XPCOM error code
-     */
-    nsresult (*pfnClearException)(void);
+    void  (*pfnGetEventQueue)(nsIEventQueue **eventQueue);
 
     /** Tail version, same as uVersion. */
     unsigned uEndVersion;
@@ -8962,7 +8851,7 @@ typedef VBOXXPCOMC const *PCVBOXXPCOM;
 /** The current interface version.
  * For use with VBoxGetXPCOMCFunctions and to be found in
  * VBOXXPCOMC::uVersion. */
-#define VBOX_XPCOMC_VERSION     0x00030000U
+#define VBOX_XPCOMC_VERSION     0x00020000U
 
 VBOXXPCOMC_DECL(PCVBOXXPCOM) VBoxGetXPCOMCFunctions(unsigned uVersion);
 /** Typedef for VBoxGetXPCOMCFunctions. */
diff --git a/src/VBox/Main/cbinding/VBoxCAPI_v4_3.h b/src/VBox/Main/cbinding/VBoxCAPI_v4_3.h
new file mode 100644
index 0000000..18db2bb
--- /dev/null
+++ b/src/VBox/Main/cbinding/VBoxCAPI_v4_3.h
@@ -0,0 +1,21826 @@
+/*
+ *  DO NOT EDIT! This is a generated file.
+ *
+ *  Header file which provides C declarations for VirtualBox Main API
+ *  (COM interfaces), generated from XIDL (XML interface definition).
+ *  On Windows (which uses COM instead of XPCOM) the native C support
+ *  is used, and most of this file is not used.
+ *
+ *  Source    : src/VBox/Main/idl/VirtualBox.xidl
+ *  Generator : src/VBox/Main/cbinding/capiidl.xsl
+ *
+ *  This file contains portions from the following Mozilla XPCOM files:
+ *      xpcom/include/xpcom/nsID.h
+ *      xpcom/include/nsIException.h
+ *      xpcom/include/nsprpub/prtypes.h
+ *      xpcom/include/xpcom/nsISupportsBase.h
+ *
+ * These files were originally triple-licensed (MPL/GPL2/LGPL2.1). Oracle
+ * elects to distribute this derived work under the LGPL2.1 only.
+ */
+
+/*
+ * Copyright (C) 2008-2014 Oracle Corporation
+ *
+ * This file is part of a free software library; you can redistribute
+ * it and/or modify it under the terms of the GNU Lesser General
+ * Public License version 2.1 as published by the Free Software
+ * Foundation and shipped in the "COPYING" file with this library.
+ * The library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY of any kind.
+ *
+ * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if
+ * any license choice other than GPL or LGPL is available it will
+ * apply instead, Oracle elects to use only the Lesser General Public
+ * License version 2.1 (LGPLv2) at this time for any software where
+ * a choice of LGPL license versions is made available with the
+ * language indicating that LGPLv2 or any later version may be used,
+ * or where a choice of which version of the LGPL is applied is
+ * otherwise unspecified.
+ */
+
+#ifndef ___VirtualBox_CAPI_h
+#define ___VirtualBox_CAPI_h
+
+#ifdef _WIN32
+# undef COBJMACROS
+# define COBJMACROS
+# include "Windows.h"
+#endif /* _WIN32 */
+
+#ifdef WIN32
+# ifdef IN_VBOXCAPI
+#  define VBOXCAPI_DECL(type) extern __declspec(dllexport) type
+# else /* !IN_VBOXCAPI */
+#  define VBOXCAPI_DECL(type) __declspec(dllimport) type
+# endif /* !IN_VBOXCAPI */
+#endif /* WIN32 */
+
+#ifdef __cplusplus
+/* The C++ treatment in this file is not meant for SDK users, it only exists
+ * so that this file can be used to produce the VBoxCAPI shared library which
+ * has to use C++ as it does all the conversion magic. */
+# ifdef IN_VBOXCAPI
+#  include "VBox/com/VirtualBox.h"
+#  ifndef WIN32
+#   include "nsIEventQueue.h"
+#  endif /* !WIN32 */
+# else /* !IN_VBOXCAPI */
+#  error Do not include this header file from C++ code
+# endif /* !IN_VBOXCAPI */
+#endif /* __cplusplus */
+
+#ifdef __GNUC__
+# define VBOX_EXTERN_CONST(type, name) extern const type name __attribute__((nocommon))
+#else /* !__GNUC__ */
+# define VBOX_EXTERN_CONST(type, name) extern const type name
+#endif /* !__GNUC__ */
+
+/* Treat WIN32 completely separately, as on Windows VirtualBox uses COM, not
+ * XPCOM like on all other platforms. While the code below would also compile
+ * on Windows, we need to switch to the native C support provided by the header
+ * files produced by the COM IDL compiler. */
+#ifdef WIN32
+# include "ObjBase.h"
+# include "oaidl.h"
+# include "VirtualBox.h"
+
+#ifndef __cplusplus
+/* Skip this in the C++ case as there's already a definition for CBSTR. */
+typedef const BSTR CBSTR;
+#endif /* !__cplusplus */
+
+#define VBOX_WINAPI WINAPI
+
+#define ComSafeArrayAsInParam(f) (f)
+#define ComSafeArrayAsOutParam(f) (&(f))
+#define ComSafeArrayAsOutTypeParam(f,t) (&(f))
+#define ComSafeArrayAsOutIfaceParam(f,t) (&(f))
+
+#else /* !WIN32 */
+
+#include <stddef.h>
+#include "wchar.h"
+
+#ifdef IN_VBOXCAPI
+# define VBOXCAPI_DECL(type) PR_EXPORT(type)
+#else /* !IN_VBOXCAPI */
+# define VBOXCAPI_DECL(type) PR_IMPORT(type)
+#endif /* !IN_VBOXCAPI */
+
+#ifndef __cplusplus
+
+#if defined(WIN32)
+
+#define PR_EXPORT(__type) extern __declspec(dllexport) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT(__type) __declspec(dllimport) __type
+#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
+
+#define PR_EXTERN(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
+#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
+
+#define PR_CALLBACK
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x
+
+#elif defined(XP_BEOS)
+
+#define PR_EXPORT(__type) extern __declspec(dllexport) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT_DATA(__type) extern __declspec(dllexport) __type
+
+#define PR_EXTERN(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
+#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
+
+#define PR_CALLBACK
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x
+
+#elif defined(WIN16)
+
+#define PR_CALLBACK_DECL        __cdecl
+
+#if defined(_WINDLL)
+#define PR_EXPORT(__type) extern __type _cdecl _export _loadds
+#define PR_IMPORT(__type) extern __type _cdecl _export _loadds
+#define PR_EXPORT_DATA(__type) extern __type _export
+#define PR_IMPORT_DATA(__type) extern __type _export
+
+#define PR_EXTERN(__type) extern __type _cdecl _export _loadds
+#define PR_IMPLEMENT(__type) __type _cdecl _export _loadds
+#define PR_EXTERN_DATA(__type) extern __type _export
+#define PR_IMPLEMENT_DATA(__type) __type _export
+
+#define PR_CALLBACK             __cdecl __loadds
+#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
+
+#else /* this must be .EXE */
+#define PR_EXPORT(__type) extern __type _cdecl _export
+#define PR_IMPORT(__type) extern __type _cdecl _export
+#define PR_EXPORT_DATA(__type) extern __type _export
+#define PR_IMPORT_DATA(__type) extern __type _export
+
+#define PR_EXTERN(__type) extern __type _cdecl _export
+#define PR_IMPLEMENT(__type) __type _cdecl _export
+#define PR_EXTERN_DATA(__type) extern __type _export
+#define PR_IMPLEMENT_DATA(__type) __type _export
+
+#define PR_CALLBACK             __cdecl __loadds
+#define PR_STATIC_CALLBACK(__x) __x PR_CALLBACK
+#endif /* _WINDLL */
+
+#elif defined(XP_MAC)
+
+#define PR_EXPORT(__type) extern __declspec(export) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(export) __type
+#define PR_IMPORT(__type) extern __declspec(export) __type
+#define PR_IMPORT_DATA(__type) extern __declspec(export) __type
+
+#define PR_EXTERN(__type) extern __declspec(export) __type
+#define PR_IMPLEMENT(__type) __declspec(export) __type
+#define PR_EXTERN_DATA(__type) extern __declspec(export) __type
+#define PR_IMPLEMENT_DATA(__type) __declspec(export) __type
+
+#define PR_CALLBACK
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x
+
+#elif defined(XP_OS2) && defined(__declspec)
+
+#define PR_EXPORT(__type) extern __declspec(dllexport) __type
+#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPORT(__type) __declspec(dllimport) __type
+#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type
+
+#define PR_EXTERN(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT(__type) __declspec(dllexport) __type
+#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type
+#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type
+
+#define PR_CALLBACK
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x
+
+#elif defined(XP_OS2_VACPP)
+
+#define PR_EXPORT(__type) extern __type
+#define PR_EXPORT_DATA(__type) extern __type
+#define PR_IMPORT(__type) extern __type
+#define PR_IMPORT_DATA(__type) extern __type
+
+#define PR_EXTERN(__type) extern __type
+#define PR_IMPLEMENT(__type) __type
+#define PR_EXTERN_DATA(__type) extern __type
+#define PR_IMPLEMENT_DATA(__type) __type
+#define PR_CALLBACK _Optlink
+#define PR_CALLBACK_DECL
+#define PR_STATIC_CALLBACK(__x) static __x PR_CALLBACK
+
+#else /* Unix */
+
+# ifdef VBOX_HAVE_VISIBILITY_HIDDEN
+#  define PR_EXPORT(__type) __attribute__((visibility("default"))) extern __type
+#  define PR_EXPORT_DATA(__type) __attribute__((visibility("default"))) extern __type
+#  define PR_IMPORT(__type) extern __type
+#  define PR_IMPORT_DATA(__type) extern __type
+#  define PR_EXTERN(__type) __attribute__((visibility("default"))) extern __type
+#  define PR_IMPLEMENT(__type) __attribute__((visibility("default"))) __type
+#  define PR_EXTERN_DATA(__type) __attribute__((visibility("default"))) extern __type
+#  define PR_IMPLEMENT_DATA(__type) __attribute__((visibility("default"))) __type
+#  define PR_CALLBACK
+#  define PR_CALLBACK_DECL
+#  define PR_STATIC_CALLBACK(__x) static __x
+# else
+#  define PR_EXPORT(__type) extern __type
+#  define PR_EXPORT_DATA(__type) extern __type
+#  define PR_IMPORT(__type) extern __type
+#  define PR_IMPORT_DATA(__type) extern __type
+#  define PR_EXTERN(__type) extern __type
+#  define PR_IMPLEMENT(__type) __type
+#  define PR_EXTERN_DATA(__type) extern __type
+#  define PR_IMPLEMENT_DATA(__type) __type
+#  define PR_CALLBACK
+#  define PR_CALLBACK_DECL
+#  define PR_STATIC_CALLBACK(__x) static __x
+# endif
+#endif
+
+#if defined(_NSPR_BUILD_)
+#define NSPR_API(__type) PR_EXPORT(__type)
+#define NSPR_DATA_API(__type) PR_EXPORT_DATA(__type)
+#else
+#define NSPR_API(__type) PR_IMPORT(__type)
+#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)
+#endif
+
+typedef unsigned char PRUint8;
+#if (defined(HPUX) && defined(__cplusplus) \
+        && !defined(__GNUC__) && __cplusplus < 199707L) \
+    || (defined(SCO) && defined(__cplusplus) \
+        && !defined(__GNUC__) && __cplusplus == 1L)
+typedef char PRInt8;
+#else
+typedef signed char PRInt8;
+#endif
+
+#define PR_INT8_MAX 127
+#define PR_INT8_MIN (-128)
+#define PR_UINT8_MAX 255U
+
+typedef unsigned short PRUint16;
+typedef short PRInt16;
+
+#define PR_INT16_MAX 32767
+#define PR_INT16_MIN (-32768)
+#define PR_UINT16_MAX 65535U
+
+typedef unsigned int PRUint32;
+typedef int PRInt32;
+#define PR_INT32(x)  x
+#define PR_UINT32(x) x ## U
+
+#define PR_INT32_MAX PR_INT32(2147483647)
+#define PR_INT32_MIN (-PR_INT32_MAX - 1)
+#define PR_UINT32_MAX PR_UINT32(4294967295)
+
+typedef long PRInt64;
+typedef unsigned long PRUint64;
+typedef int PRIntn;
+typedef unsigned int PRUintn;
+
+typedef double          PRFloat64;
+typedef size_t PRSize;
+
+typedef ptrdiff_t PRPtrdiff;
+
+typedef unsigned long PRUptrdiff;
+
+typedef PRIntn PRBool;
+
+#define PR_TRUE 1
+#define PR_FALSE 0
+
+typedef PRUint8 PRPackedBool;
+
+/*
+** Status code used by some routines that have a single point of failure or
+** special status return.
+*/
+typedef enum { PR_FAILURE = -1, PR_SUCCESS = 0 } PRStatus;
+
+#ifndef __PRUNICHAR__
+#define __PRUNICHAR__
+#if defined(WIN32) || defined(XP_MAC)
+typedef wchar_t PRUnichar;
+#else
+typedef PRUint16 PRUnichar;
+#endif
+typedef PRUnichar *BSTR;
+typedef const PRUnichar *CBSTR;
+#endif
+
+typedef long PRWord;
+typedef unsigned long PRUword;
+
+#define nsnull 0
+typedef PRUint32 nsresult;
+
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define NS_LIKELY(x)    (__builtin_expect((x), 1))
+#define NS_UNLIKELY(x)  (__builtin_expect((x), 0))
+#else
+#define NS_LIKELY(x)    (x)
+#define NS_UNLIKELY(x)  (x)
+#endif
+
+#define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) & 0x80000000))
+#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000)))
+
+#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
+# define PR_IntervalNow VBoxNsprPR_IntervalNow
+# define PR_TicksPerSecond VBoxNsprPR_TicksPerSecond
+# define PR_SecondsToInterval VBoxNsprPR_SecondsToInterval
+# define PR_MillisecondsToInterval VBoxNsprPR_MillisecondsToInterval
+# define PR_MicrosecondsToInterval VBoxNsprPR_MicrosecondsToInterval
+# define PR_IntervalToSeconds VBoxNsprPR_IntervalToSeconds
+# define PR_IntervalToMilliseconds VBoxNsprPR_IntervalToMilliseconds
+# define PR_IntervalToMicroseconds VBoxNsprPR_IntervalToMicroseconds
+# define PR_EnterMonitor VBoxNsprPR_EnterMonitor
+# define PR_ExitMonitor VBoxNsprPR_ExitMonitor
+# define PR_Notify VBoxNsprPR_Notify
+# define PR_NotifyAll VBoxNsprPR_NotifyAll
+# define PR_Wait VBoxNsprPR_Wait
+# define PR_NewMonitor VBoxNsprPR_NewMonitor
+# define PR_DestroyMonitor VBoxNsprPR_DestroyMonitor
+#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
+
+typedef PRUint32 PRIntervalTime;
+
+#define PR_INTERVAL_MIN 1000UL
+#define PR_INTERVAL_MAX 100000UL
+#define PR_INTERVAL_NO_WAIT 0UL
+#define PR_INTERVAL_NO_TIMEOUT 0xffffffffUL
+
+NSPR_API(PRIntervalTime) PR_IntervalNow(void);
+NSPR_API(PRUint32) PR_TicksPerSecond(void);
+NSPR_API(PRIntervalTime) PR_SecondsToInterval(PRUint32 seconds);
+NSPR_API(PRIntervalTime) PR_MillisecondsToInterval(PRUint32 milli);
+NSPR_API(PRIntervalTime) PR_MicrosecondsToInterval(PRUint32 micro);
+NSPR_API(PRUint32) PR_IntervalToSeconds(PRIntervalTime ticks);
+NSPR_API(PRUint32) PR_IntervalToMilliseconds(PRIntervalTime ticks);
+NSPR_API(PRUint32) PR_IntervalToMicroseconds(PRIntervalTime ticks);
+
+typedef struct PRMonitor PRMonitor;
+
+NSPR_API(PRMonitor*) PR_NewMonitor(void);
+NSPR_API(void) PR_DestroyMonitor(PRMonitor *mon);
+NSPR_API(void) PR_EnterMonitor(PRMonitor *mon);
+NSPR_API(PRStatus) PR_ExitMonitor(PRMonitor *mon);
+NSPR_API(PRStatus) PR_Wait(PRMonitor *mon, PRIntervalTime ticks);
+NSPR_API(PRStatus) PR_Notify(PRMonitor *mon);
+NSPR_API(PRStatus) PR_NotifyAll(PRMonitor *mon);
+
+#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
+# define PR_CreateThread VBoxNsprPR_CreateThread
+# define PR_JoinThread VBoxNsprPR_JoinThread
+# define PR_Sleep VBoxNsprPR_Sleep
+# define PR_GetCurrentThread VBoxNsprPR_GetCurrentThread
+# define PR_GetThreadState VBoxNsprPR_GetThreadState
+# define PR_SetThreadPrivate VBoxNsprPR_SetThreadPrivate
+# define PR_GetThreadPrivate VBoxNsprPR_GetThreadPrivate
+# define PR_NewThreadPrivateIndex VBoxNsprPR_NewThreadPrivateIndex
+# define PR_GetThreadPriority VBoxNsprPR_GetThreadPriority
+# define PR_SetThreadPriority VBoxNsprPR_SetThreadPriority
+# define PR_Interrupt VBoxNsprPR_Interrupt
+# define PR_ClearInterrupt VBoxNsprPR_ClearInterrupt
+# define PR_BlockInterrupt VBoxNsprPR_BlockInterrupt
+# define PR_UnblockInterrupt VBoxNsprPR_UnblockInterrupt
+# define PR_GetThreadScope VBoxNsprPR_GetThreadScope
+# define PR_GetThreadType VBoxNsprPR_GetThreadType
+#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
+
+typedef struct PRThread PRThread;
+typedef struct PRThreadStack PRThreadStack;
+
+typedef enum PRThreadType {
+    PR_USER_THREAD,
+    PR_SYSTEM_THREAD
+} PRThreadType;
+
+typedef enum PRThreadScope {
+    PR_LOCAL_THREAD,
+    PR_GLOBAL_THREAD,
+    PR_GLOBAL_BOUND_THREAD
+} PRThreadScope;
+
+typedef enum PRThreadState {
+    PR_JOINABLE_THREAD,
+    PR_UNJOINABLE_THREAD
+} PRThreadState;
+
+typedef enum PRThreadPriority
+{
+    PR_PRIORITY_FIRST = 0,      /* just a placeholder */
+    PR_PRIORITY_LOW = 0,        /* the lowest possible priority */
+    PR_PRIORITY_NORMAL = 1,     /* most common expected priority */
+    PR_PRIORITY_HIGH = 2,       /* slightly more aggressive scheduling */
+    PR_PRIORITY_URGENT = 3,     /* it does little good to have more than one */
+    PR_PRIORITY_LAST = 3        /* this is just a placeholder */
+} PRThreadPriority;
+
+NSPR_API(PRThread*) PR_CreateThread(PRThreadType type,
+                     void (PR_CALLBACK *start)(void *arg),
+                     void *arg,
+                     PRThreadPriority priority,
+                     PRThreadScope scope,
+                     PRThreadState state,
+                     PRUint32 stackSize);
+NSPR_API(PRStatus) PR_JoinThread(PRThread *thread);
+NSPR_API(PRThread*) PR_GetCurrentThread(void);
+#ifndef NO_NSPR_10_SUPPORT
+#define PR_CurrentThread() PR_GetCurrentThread() /* for nspr1.0 compat. */
+#endif /* NO_NSPR_10_SUPPORT */
+NSPR_API(PRThreadPriority) PR_GetThreadPriority(const PRThread *thread);
+NSPR_API(void) PR_SetThreadPriority(PRThread *thread, PRThreadPriority priority);
+
+typedef void (PR_CALLBACK *PRThreadPrivateDTOR)(void *priv);
+
+NSPR_API(PRStatus) PR_NewThreadPrivateIndex(
+    PRUintn *newIndex, PRThreadPrivateDTOR destructor);
+NSPR_API(PRStatus) PR_SetThreadPrivate(PRUintn tpdIndex, void *priv);
+NSPR_API(void*) PR_GetThreadPrivate(PRUintn tpdIndex);
+NSPR_API(PRStatus) PR_Interrupt(PRThread *thread);
+NSPR_API(void) PR_ClearInterrupt(void);
+NSPR_API(void) PR_BlockInterrupt(void);
+NSPR_API(void) PR_UnblockInterrupt(void);
+NSPR_API(PRStatus) PR_Sleep(PRIntervalTime ticks);
+NSPR_API(PRThreadScope) PR_GetThreadScope(const PRThread *thread);
+NSPR_API(PRThreadType) PR_GetThreadType(const PRThread *thread);
+NSPR_API(PRThreadState) PR_GetThreadState(const PRThread *thread);
+
+#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
+# define PR_DestroyLock VBoxNsprPR_DestroyLock
+# define PR_Lock VBoxNsprPR_Lock
+# define PR_NewLock VBoxNsprPR_NewLock
+# define PR_Unlock VBoxNsprPR_Unlock
+#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
+
+typedef struct PRLock PRLock;
+
+NSPR_API(PRLock*) PR_NewLock(void);
+NSPR_API(void) PR_DestroyLock(PRLock *lock);
+NSPR_API(void) PR_Lock(PRLock *lock);
+NSPR_API(PRStatus) PR_Unlock(PRLock *lock);
+
+#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
+# define PR_NewCondVar VBoxNsprPR_NewCondVar
+# define PR_DestroyCondVar VBoxNsprPR_DestroyCondVar
+# define PR_WaitCondVar VBoxNsprPR_WaitCondVar
+# define PR_NotifyCondVar VBoxNsprPR_NotifyCondVar
+# define PR_NotifyAllCondVar VBoxNsprPR_NotifyAllCondVar
+#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
+
+typedef struct PRCondVar PRCondVar;
+
+NSPR_API(PRCondVar*) PR_NewCondVar(PRLock *lock);
+NSPR_API(void) PR_DestroyCondVar(PRCondVar *cvar);
+NSPR_API(PRStatus) PR_WaitCondVar(PRCondVar *cvar, PRIntervalTime timeout);
+NSPR_API(PRStatus) PR_NotifyCondVar(PRCondVar *cvar);
+NSPR_API(PRStatus) PR_NotifyAllCondVar(PRCondVar *cvar);
+
+typedef struct PRCListStr PRCList;
+
+struct PRCListStr {
+    PRCList *next;
+    PRCList *prev;
+};
+
+#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
+# define PL_DestroyEvent VBoxNsplPL_DestroyEvent
+# define PL_HandleEvent VBoxNsplPL_HandleEvent
+# define PL_InitEvent VBoxNsplPL_InitEvent
+# define PL_CreateEventQueue VBoxNsplPL_CreateEventQueue
+# define PL_CreateMonitoredEventQueue VBoxNsplPL_CreateMonitoredEventQueue
+# define PL_CreateNativeEventQueue VBoxNsplPL_CreateNativeEventQueue
+# define PL_DequeueEvent VBoxNsplPL_DequeueEvent
+# define PL_DestroyEventQueue VBoxNsplPL_DestroyEventQueue
+# define PL_EventAvailable VBoxNsplPL_EventAvailable
+# define PL_EventLoop VBoxNsplPL_EventLoop
+# define PL_GetEvent VBoxNsplPL_GetEvent
+# define PL_GetEventOwner VBoxNsplPL_GetEventOwner
+# define PL_GetEventQueueMonitor VBoxNsplPL_GetEventQueueMonitor
+# define PL_GetEventQueueSelectFD VBoxNsplPL_GetEventQueueSelectFD
+# define PL_MapEvents VBoxNsplPL_MapEvents
+# define PL_PostEvent VBoxNsplPL_PostEvent
+# define PL_PostSynchronousEvent VBoxNsplPL_PostSynchronousEvent
+# define PL_ProcessEventsBeforeID VBoxNsplPL_ProcessEventsBeforeID
+# define PL_ProcessPendingEvents VBoxNsplPL_ProcessPendingEvents
+# define PL_RegisterEventIDFunc VBoxNsplPL_RegisterEventIDFunc
+# define PL_RevokeEvents VBoxNsplPL_RevokeEvents
+# define PL_UnregisterEventIDFunc VBoxNsplPL_UnregisterEventIDFunc
+# define PL_WaitForEvent VBoxNsplPL_WaitForEvent
+# define PL_IsQueueNative VBoxNsplPL_IsQueueNative
+# define PL_IsQueueOnCurrentThread VBoxNsplPL_IsQueueOnCurrentThread
+# define PL_FavorPerformanceHint VBoxNsplPL_FavorPerformanceHint
+#endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
+
+typedef struct PLEvent PLEvent;
+typedef struct PLEventQueue PLEventQueue;
+
+PR_EXTERN(PLEventQueue*)
+PL_CreateEventQueue(const char* name, PRThread* handlerThread);
+PR_EXTERN(PLEventQueue *)
+    PL_CreateNativeEventQueue(
+        const char *name,
+        PRThread *handlerThread
+    );
+PR_EXTERN(PLEventQueue *)
+    PL_CreateMonitoredEventQueue(
+        const char *name,
+        PRThread *handlerThread
+    );
+PR_EXTERN(void)
+PL_DestroyEventQueue(PLEventQueue* self);
+PR_EXTERN(PRMonitor*)
+PL_GetEventQueueMonitor(PLEventQueue* self);
+
+#define PL_ENTER_EVENT_QUEUE_MONITOR(queue) \
+    PR_EnterMonitor(PL_GetEventQueueMonitor(queue))
+
+#define PL_EXIT_EVENT_QUEUE_MONITOR(queue)  \
+    PR_ExitMonitor(PL_GetEventQueueMonitor(queue))
+
+PR_EXTERN(PRStatus) PL_PostEvent(PLEventQueue* self, PLEvent* event);
+PR_EXTERN(void*) PL_PostSynchronousEvent(PLEventQueue* self, PLEvent* event);
+PR_EXTERN(PLEvent*) PL_GetEvent(PLEventQueue* self);
+PR_EXTERN(PRBool) PL_EventAvailable(PLEventQueue* self);
+
+typedef void (PR_CALLBACK *PLEventFunProc)(PLEvent* event, void* data, PLEventQueue* queue);
+
+PR_EXTERN(void) PL_MapEvents(PLEventQueue* self, PLEventFunProc fun, void* data);
+PR_EXTERN(void) PL_RevokeEvents(PLEventQueue* self, void* owner);
+PR_EXTERN(void) PL_ProcessPendingEvents(PLEventQueue* self);
+PR_EXTERN(PLEvent*) PL_WaitForEvent(PLEventQueue* self);
+PR_EXTERN(void) PL_EventLoop(PLEventQueue* self);
+PR_EXTERN(PRInt32) PL_GetEventQueueSelectFD(PLEventQueue* self);
+PR_EXTERN(PRBool) PL_IsQueueOnCurrentThread( PLEventQueue *queue );
+PR_EXTERN(PRBool) PL_IsQueueNative(PLEventQueue *queue);
+
+typedef void* (PR_CALLBACK *PLHandleEventProc)(PLEvent* self);
+typedef void (PR_CALLBACK *PLDestroyEventProc)(PLEvent* self);
+PR_EXTERN(void)
+PL_InitEvent(PLEvent* self, void* owner,
+             PLHandleEventProc handler,
+             PLDestroyEventProc destructor);
+PR_EXTERN(void*) PL_GetEventOwner(PLEvent* self);
+PR_EXTERN(void) PL_HandleEvent(PLEvent* self);
+PR_EXTERN(void) PL_DestroyEvent(PLEvent* self);
+PR_EXTERN(void) PL_DequeueEvent(PLEvent* self, PLEventQueue* queue);
+PR_EXTERN(void) PL_FavorPerformanceHint(PRBool favorPerformanceOverEventStarvation, PRUint32 starvationDelay);
+
+struct PLEvent {
+    PRCList             link;
+    PLHandleEventProc   handler;
+    PLDestroyEventProc  destructor;
+    void*               owner;
+    void*               synchronousResult;
+    PRLock*             lock;
+    PRCondVar*          condVar;
+    PRBool              handled;
+#ifdef PL_POST_TIMINGS
+    PRIntervalTime      postTime;
+#endif
+#ifdef XP_UNIX
+    unsigned long       id;
+#endif /* XP_UNIX */
+    /* other fields follow... */
+};
+
+#if defined(XP_WIN) || defined(XP_OS2)
+
+PR_EXTERN(HWND)
+    PL_GetNativeEventReceiverWindow(
+        PLEventQueue *eqp
+    );
+#endif /* XP_WIN || XP_OS2 */
+
+#ifdef XP_UNIX
+
+PR_EXTERN(PRInt32)
+PL_ProcessEventsBeforeID(PLEventQueue *aSelf, unsigned long aID);
+
+typedef unsigned long (PR_CALLBACK *PLGetEventIDFunc)(void *aClosure);
+
+PR_EXTERN(void)
+PL_RegisterEventIDFunc(PLEventQueue *aSelf, PLGetEventIDFunc aFunc,
+                       void *aClosure);
+PR_EXTERN(void) PL_UnregisterEventIDFunc(PLEventQueue *aSelf);
+
+#endif /* XP_UNIX */
+
+/* Standard "it worked" return value */
+#define NS_OK                              0
+
+#define NS_ERROR_BASE                      ((nsresult) 0xC1F30000)
+
+/* Returned when an instance is not initialized */
+#define NS_ERROR_NOT_INITIALIZED           (NS_ERROR_BASE + 1)
+
+/* Returned when an instance is already initialized */
+#define NS_ERROR_ALREADY_INITIALIZED       (NS_ERROR_BASE + 2)
+
+/* Returned by a not implemented function */
+#define NS_ERROR_NOT_IMPLEMENTED           ((nsresult) 0x80004001L)
+
+/* Returned when a given interface is not supported. */
+#define NS_NOINTERFACE                     ((nsresult) 0x80004002L)
+#define NS_ERROR_NO_INTERFACE              NS_NOINTERFACE
+
+#define NS_ERROR_INVALID_POINTER           ((nsresult) 0x80004003L)
+#define NS_ERROR_NULL_POINTER              NS_ERROR_INVALID_POINTER
+
+/* Returned when a function aborts */
+#define NS_ERROR_ABORT                     ((nsresult) 0x80004004L)
+
+/* Returned when a function fails */
+#define NS_ERROR_FAILURE                   ((nsresult) 0x80004005L)
+
+/* Returned when an unexpected error occurs */
+#define NS_ERROR_UNEXPECTED                ((nsresult) 0x8000ffffL)
+
+/* Returned when a memory allocation fails */
+#define NS_ERROR_OUT_OF_MEMORY             ((nsresult) 0x8007000eL)
+
+/* Returned when an illegal value is passed */
+#define NS_ERROR_ILLEGAL_VALUE             ((nsresult) 0x80070057L)
+#define NS_ERROR_INVALID_ARG               NS_ERROR_ILLEGAL_VALUE
+
+/* Returned when a class doesn't allow aggregation */
+#define NS_ERROR_NO_AGGREGATION            ((nsresult) 0x80040110L)
+
+/* Returned when an operation can't complete due to an unavailable resource */
+#define NS_ERROR_NOT_AVAILABLE             ((nsresult) 0x80040111L)
+
+/* Returned when a class is not registered */
+#define NS_ERROR_FACTORY_NOT_REGISTERED    ((nsresult) 0x80040154L)
+
+/* Returned when a class cannot be registered, but may be tried again later */
+#define NS_ERROR_FACTORY_REGISTER_AGAIN    ((nsresult) 0x80040155L)
+
+/* Returned when a dynamically loaded factory couldn't be found */
+#define NS_ERROR_FACTORY_NOT_LOADED        ((nsresult) 0x800401f8L)
+
+/* Returned when a factory doesn't support signatures */
+#define NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT \
+                                           (NS_ERROR_BASE + 0x101)
+
+/* Returned when a factory already is registered */
+#define NS_ERROR_FACTORY_EXISTS            (NS_ERROR_BASE + 0x100)
+
+/**
+ * An "interface id" which can be used to uniquely identify a given
+ * interface.
+ * A "unique identifier". This is modeled after OSF DCE UUIDs.
+ */
+
+struct nsID {
+    PRUint32 m0;
+    PRUint16 m1;
+    PRUint16 m2;
+    PRUint8 m3[8];
+};
+
+typedef struct nsID nsID;
+typedef nsID nsIID;
+typedef nsID nsCID;
+
+#endif /* __cplusplus */
+
+#define VBOX_WINAPI
+
+/* Various COM types defined by their XPCOM equivalent */
+typedef PRInt64 LONG64;
+typedef PRInt32 LONG;
+typedef PRInt32 DWORD;
+typedef PRInt16 SHORT;
+typedef PRUint64 ULONG64;
+typedef PRUint32 ULONG;
+typedef PRUint16 USHORT;
+
+typedef PRBool BOOL;
+
+#ifndef FALSE
+#define FALSE 0
+#define TRUE 1
+#endif
+
+#define HRESULT nsresult
+#define SUCCEEDED NS_SUCCEEDED
+#define FAILED NS_FAILED
+
+/* OLE error codes */
+#define S_OK                ((nsresult)NS_OK)
+#define E_UNEXPECTED        NS_ERROR_UNEXPECTED
+#define E_NOTIMPL           NS_ERROR_NOT_IMPLEMENTED
+#define E_OUTOFMEMORY       NS_ERROR_OUT_OF_MEMORY
+#define E_INVALIDARG        NS_ERROR_INVALID_ARG
+#define E_NOINTERFACE       NS_ERROR_NO_INTERFACE
+#define E_POINTER           NS_ERROR_NULL_POINTER
+#define E_ABORT             NS_ERROR_ABORT
+#define E_FAIL              NS_ERROR_FAILURE
+/* Note: a better analog for E_ACCESSDENIED would probably be
+ * NS_ERROR_NOT_AVAILABLE, but we want binary compatibility for now. */
+#define E_ACCESSDENIED      ((nsresult)0x80070005L)
+
+/* Basic vartype for COM compatibility. */
+typedef enum VARTYPE
+{
+    VT_I2 = 2,
+    VT_I4 = 3,
+    VT_BSTR = 8,
+    VT_DISPATCH = 9,
+    VT_BOOL = 11,
+    VT_UNKNOWN = 13,
+    VT_I1 = 16,
+    VT_UI1 = 17,
+    VT_UI2 = 18,
+    VT_UI4 = 19,
+    VT_I8 = 20,
+    VT_UI8 = 21,
+    VT_HRESULT = 25
+} VARTYPE;
+
+/* Basic safearray type for COM compatibility. */
+typedef struct SAFEARRAY
+{
+    void *pv;
+    ULONG c;
+} SAFEARRAY;
+
+#define ComSafeArrayAsInParam(f) ((f)->c), ((f)->pv)
+#define ComSafeArrayAsOutParam(f) (&((f)->c)), (&((f)->pv))
+#define ComSafeArrayAsOutTypeParam(f,t) (&((f)->c)), (t**)(&((f)->pv))
+#define ComSafeArrayAsOutIfaceParam(f,t) (&((f)->c)), (t**)(&((f)->pv))
+
+/* Glossing over differences between COM and XPCOM */
+#define IErrorInfo nsIException
+#define IUnknown nsISupports
+#define IDispatch nsISupports
+
+/* Make things as COM compatible as possible */
+#define interface struct
+#ifdef CONST_VTABLE
+# define CONST_VTBL const
+#else /* !CONST_VTABLE */
+# define CONST_VTBL
+#endif /* !CONST_VTABLE */
+
+#ifndef __cplusplus
+
+/** @todo this first batch of forward declarations (and the corresponding ones
+ * generated for each interface) are 100% redundant, remove eventually. */
+interface nsISupports;   /* forward declaration */
+interface nsIException;  /* forward declaration */
+interface nsIStackFrame; /* forward declaration */
+interface nsIEventTarget;/* forward declaration */
+interface nsIEventQueue; /* forward declaration */
+
+typedef interface nsISupports nsISupports;     /* forward declaration */
+typedef interface nsIException nsIException;   /* forward declaration */
+typedef interface nsIStackFrame nsIStackFrame; /* forward declaration */
+typedef interface nsIEventTarget nsIEventTarget;/* forward declaration */
+typedef interface nsIEventQueue nsIEventQueue; /* forward declaration */
+
+/* starting interface:    nsISupports */
+#define NS_ISUPPORTS_IID_STR "00000000-0000-0000-c000-000000000046"
+
+#define NS_ISUPPORTS_IID \
+    { 0x00000000, 0x0000, 0x0000, \
+      {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} }
+
+/**
+ * Reference count values
+ *
+ * This is the return type for AddRef() and Release() in nsISupports.
+ * IUnknown of COM returns an unsigned long from equivalent functions.
+ * The following ifdef exists to maintain binary compatibility with
+ * IUnknown.
+ */
+#if defined(XP_WIN) && PR_BYTES_PER_LONG == 4
+typedef unsigned long nsrefcnt;
+#else
+typedef PRUint32 nsrefcnt;
+#endif
+
+/**
+ * Basic component object model interface. Objects which implement
+ * this interface support runtime interface discovery (QueryInterface)
+ * and a reference counted memory model (AddRef/Release). This is
+ * modelled after the win32 IUnknown API.
+ */
+#ifndef VBOX_WITH_GLUE
+struct nsISupports_vtbl
+{
+    nsresult (*QueryInterface)(nsISupports *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(nsISupports *pThis);
+    nsrefcnt (*Release)(nsISupports *pThis);
+};
+#else /* !VBOX_WITH_GLUE */
+struct nsISupportsVtbl
+{
+    nsresult (*QueryInterface)(nsISupports *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(nsISupports *pThis);
+    nsrefcnt (*Release)(nsISupports *pThis);
+};
+#define nsISupports_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define nsISupports_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define nsISupports_Release(p) ((p)->lpVtbl->Release(p))
+#define IUnknown_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IUnknown_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IUnknown_Release(p) ((p)->lpVtbl->Release(p))
+#define IDispatch_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IDispatch_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IDispatch_Release(p) ((p)->lpVtbl->Release(p))
+#endif /* !VBOX_WITH_GLUE */
+
+interface nsISupports
+{
+#ifndef VBOX_WITH_GLUE
+    struct nsISupports_vtbl *vtbl;
+#else /* !VBOX_WITH_GLUE */
+    CONST_VTBL struct nsISupportsVtbl *lpVtbl;
+#endif /* !VBOX_WITH_GLUE */
+};
+
+/* starting interface:    nsIException */
+#define NS_IEXCEPTION_IID_STR "f3a8d3b4-c424-4edc-8bf6-8974c983ba78"
+
+#define NS_IEXCEPTION_IID \
+    {0xf3a8d3b4, 0xc424, 0x4edc, \
+      { 0x8b, 0xf6, 0x89, 0x74, 0xc9, 0x83, 0xba, 0x78 }}
+
+#ifndef VBOX_WITH_GLUE
+struct nsIException_vtbl
+{
+    /* Methods from the interface nsISupports */
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMessage)(nsIException *pThis, PRUnichar * *aMessage);
+    nsresult (*GetResult)(nsIException *pThis, nsresult *aResult);
+    nsresult (*GetName)(nsIException *pThis, PRUnichar * *aName);
+    nsresult (*GetFilename)(nsIException *pThis, PRUnichar * *aFilename);
+    nsresult (*GetLineNumber)(nsIException *pThis, PRUint32 *aLineNumber);
+    nsresult (*GetColumnNumber)(nsIException *pThis, PRUint32 *aColumnNumber);
+    nsresult (*GetLocation)(nsIException *pThis, nsIStackFrame * *aLocation);
+    nsresult (*GetInner)(nsIException *pThis, nsIException * *aInner);
+    nsresult (*GetData)(nsIException *pThis, nsISupports * *aData);
+    nsresult (*ToString)(nsIException *pThis, PRUnichar **_retval);
+};
+#else /* !VBOX_WITH_GLUE */
+struct nsIExceptionVtbl
+{
+    nsresult (*QueryInterface)(nsIException *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(nsIException *pThis);
+    nsrefcnt (*Release)(nsIException *pThis);
+
+    nsresult (*GetMessage)(nsIException *pThis, PRUnichar * *aMessage);
+    nsresult (*GetResult)(nsIException *pThis, nsresult *aResult);
+    nsresult (*GetName)(nsIException *pThis, PRUnichar * *aName);
+    nsresult (*GetFilename)(nsIException *pThis, PRUnichar * *aFilename);
+    nsresult (*GetLineNumber)(nsIException *pThis, PRUint32 *aLineNumber);
+    nsresult (*GetColumnNumber)(nsIException *pThis, PRUint32 *aColumnNumber);
+    nsresult (*GetLocation)(nsIException *pThis, nsIStackFrame * *aLocation);
+    nsresult (*GetInner)(nsIException *pThis, nsIException * *aInner);
+    nsresult (*GetData)(nsIException *pThis, nsISupports * *aData);
+    nsresult (*ToString)(nsIException *pThis, PRUnichar **_retval);
+};
+#define nsIException_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define nsIException_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define nsIException_Release(p) ((p)->lpVtbl->Release(p))
+#define nsIException_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#define nsIException_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#define nsIException_get_Result(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
+#define nsIException_GetResult(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
+#define nsIException_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define nsIException_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define nsIException_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
+#define nsIException_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
+#define nsIException_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
+#define nsIException_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
+#define nsIException_get_ColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
+#define nsIException_GetColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
+#define nsIException_get_Inner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
+#define nsIException_GetInner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
+#define nsIException_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#define nsIException_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#define nsIException_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))
+#define IErrorInfo_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IErrorInfo_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IErrorInfo_Release(p) ((p)->lpVtbl->Release(p))
+#define IErrorInfo_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#define IErrorInfo_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#define IErrorInfo_get_Result(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
+#define IErrorInfo_GetResult(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
+#define IErrorInfo_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IErrorInfo_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IErrorInfo_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
+#define IErrorInfo_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
+#define IErrorInfo_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
+#define IErrorInfo_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
+#define IErrorInfo_get_ColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
+#define IErrorInfo_GetColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
+#define IErrorInfo_get_Inner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
+#define IErrorInfo_GetInner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
+#define IErrorInfo_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#define IErrorInfo_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#define IErrorInfo_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))
+#endif /* !VBOX_WITH_GLUE */
+
+interface nsIException
+{
+#ifndef VBOX_WITH_GLUE
+    struct nsIException_vtbl *vtbl;
+#else /* !VBOX_WITH_GLUE */
+    CONST_VTBL struct nsIExceptionVtbl *lpVtbl;
+#endif /* !VBOX_WITH_GLUE */
+};
+
+/* starting interface:    nsIStackFrame */
+#define NS_ISTACKFRAME_IID_STR "91d82105-7c62-4f8b-9779-154277c0ee90"
+
+#define NS_ISTACKFRAME_IID \
+    {0x91d82105, 0x7c62, 0x4f8b, \
+      { 0x97, 0x79, 0x15, 0x42, 0x77, 0xc0, 0xee, 0x90 }}
+
+#ifndef VBOX_WITH_GLUE
+struct nsIStackFrame_vtbl
+{
+    /* Methods from the interface nsISupports */
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetLanguage)(nsIStackFrame *pThis, PRUint32 *aLanguage);
+    nsresult (*GetLanguageName)(nsIStackFrame *pThis, PRUnichar * *aLanguageName);
+    nsresult (*GetFilename)(nsIStackFrame *pThis, PRUnichar * *aFilename);
+    nsresult (*GetName)(nsIStackFrame *pThis, PRUnichar * *aName);
+    nsresult (*GetLineNumber)(nsIStackFrame *pThis, PRInt32 *aLineNumber);
+    nsresult (*GetSourceLine)(nsIStackFrame *pThis, PRUnichar * *aSourceLine);
+    nsresult (*GetCaller)(nsIStackFrame *pThis, nsIStackFrame * *aCaller);
+    nsresult (*ToString)(nsIStackFrame *pThis, PRUnichar **_retval);
+};
+#else /* !VBOX_WITH_GLUE */
+struct nsIStackFrameVtbl
+{
+    nsresult (*QueryInterface)(nsIStackFrame *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(nsIStackFrame *pThis);
+    nsrefcnt (*Release)(nsIStackFrame *pThis);
+
+    nsresult (*GetLanguage)(nsIStackFrame *pThis, PRUint32 *aLanguage);
+    nsresult (*GetLanguageName)(nsIStackFrame *pThis, PRUnichar * *aLanguageName);
+    nsresult (*GetFilename)(nsIStackFrame *pThis, PRUnichar * *aFilename);
+    nsresult (*GetName)(nsIStackFrame *pThis, PRUnichar * *aName);
+    nsresult (*GetLineNumber)(nsIStackFrame *pThis, PRInt32 *aLineNumber);
+    nsresult (*GetSourceLine)(nsIStackFrame *pThis, PRUnichar * *aSourceLine);
+    nsresult (*GetCaller)(nsIStackFrame *pThis, nsIStackFrame * *aCaller);
+    nsresult (*ToString)(nsIStackFrame *pThis, PRUnichar **_retval);
+};
+#define nsIStackFrame_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define nsIStackFrame_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define nsIStackFrame_Release(p) ((p)->lpVtbl->Release(p))
+#define nsIStackFrame_get_Language(p, aLanguage) ((p)->lpVtbl->GetLanguge(p, aLanguage))
+#define nsIStackFrame_GetLanguage(p, aLanguage) ((p)->lpVtbl->GetLanguge(p, aLanguage))
+#define nsIStackFrame_get_LanguageName(p, aLanguageName) ((p)->lpVtbl->GetLanguageName(p, aLanguageName))
+#define nsIStackFrame_GetLanguageName(p, aLanguageName) ((p)->lpVtbl->GetLanguageName(p, aLanguageName))
+#define nsIStackFrame_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
+#define nsIStackFrame_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
+#define nsIStackFrame_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define nsIStackFrame_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define nsIStackFrame_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
+#define nsIStackFrame_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
+#define nsIStackFrame_get_SourceLine(p, aSourceLine) ((p)->lpVtbl->GetSourceLine(p, aSourceLine))
+#define nsIStackFrame_GetSourceLine(p, aSourceLine) ((p)->lpVtbl->GetSourceLine(p, aSourceLine))
+#define nsIStackFrame_get_Caller(p, aCaller) ((p)->lpVtbl->GetCaller(p, aCaller))
+#define nsIStackFrame_GetCaller(p, aCaller) ((p)->lpVtbl->GetCaller(p, aCaller))
+#define nsIStackFrame_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))
+#endif /* !VBOX_WITH_GLUE */
+
+interface nsIStackFrame
+{
+#ifndef VBOX_WITH_GLUE
+    struct nsIStackFrame_vtbl *vtbl;
+#else /* !VBOX_WITH_GLUE */
+    CONST_VTBL struct nsIStackFrameVtbl *lpVtbl;
+#endif /* !VBOX_WITH_GLUE */
+};
+
+/* starting interface:    nsIEventTarget */
+#define NS_IEVENTTARGET_IID_STR "ea99ad5b-cc67-4efb-97c9-2ef620a59f2a"
+
+#define NS_IEVENTTARGET_IID \
+    {0xea99ad5b, 0xcc67, 0x4efb, \
+      { 0x97, 0xc9, 0x2e, 0xf6, 0x20, 0xa5, 0x9f, 0x2a }}
+
+#ifndef VBOX_WITH_GLUE
+struct nsIEventTarget_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*PostEvent)(nsIEventTarget *pThis, PLEvent * aEvent);
+    nsresult (*IsOnCurrentThread)(nsIEventTarget *pThis, PRBool *_retval);
+};
+#else /* !VBOX_WITH_GLUE */
+struct nsIEventTargetVtbl
+{
+    nsresult (*QueryInterface)(nsIEventTarget *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(nsIEventTarget *pThis);
+    nsrefcnt (*Release)(nsIEventTarget *pThis);
+
+    nsresult (*PostEvent)(nsIEventTarget *pThis, PLEvent * aEvent);
+    nsresult (*IsOnCurrentThread)(nsIEventTarget *pThis, PRBool *_retval);
+};
+#define nsIEventTarget_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define nsIEventTarget_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define nsIEventTarget_Release(p) ((p)->lpVtbl->Release(p))
+#define nsIEventTarget_PostEvent(p, aEvent) ((p)->lpVtbl->PostEvent(p, aEvent))
+#define nsIEventTarget_IsOnCurrentThread(p, retval) ((p)->lpVtbl->IsOnCurrentThread(p, retval))
+#endif /* !VBOX_WITH_GLUE */
+
+interface nsIEventTarget
+{
+#ifndef VBOX_WITH_GLUE
+    struct nsIEventTarget_vtbl *vtbl;
+#else /* !VBOX_WITH_GLUE */
+    CONST_VTBL struct nsIEventTargetVtbl *lpVtbl;
+#endif /* !VBOX_WITH_GLUE */
+};
+
+/* starting interface:    nsIEventQueue */
+#define NS_IEVENTQUEUE_IID_STR "176afb41-00a4-11d3-9f2a-00400553eef0"
+
+#define NS_IEVENTQUEUE_IID \
+  {0x176afb41, 0x00a4, 0x11d3, \
+    { 0x9f, 0x2a, 0x00, 0x40, 0x05, 0x53, 0xee, 0xf0 }}
+
+#ifndef VBOX_WITH_GLUE
+struct nsIEventQueue_vtbl
+{
+    struct nsIEventTarget_vtbl nsieventtarget;
+
+    nsresult (*InitEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * owner, PLHandleEventProc handler, PLDestroyEventProc destructor);
+    nsresult (*PostSynchronousEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * *aResult);
+    nsresult (*PendingEvents)(nsIEventQueue *pThis, PRBool *_retval);
+    nsresult (*ProcessPendingEvents)(nsIEventQueue *pThis);
+    nsresult (*EventLoop)(nsIEventQueue *pThis);
+    nsresult (*EventAvailable)(nsIEventQueue *pThis, PRBool *aResult);
+    nsresult (*GetEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
+    nsresult (*HandleEvent)(nsIEventQueue *pThis, PLEvent * aEvent);
+    nsresult (*WaitForEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
+    PRInt32 (*GetEventQueueSelectFD)(nsIEventQueue *pThis);
+    nsresult (*Init)(nsIEventQueue *pThis, PRBool aNative);
+    nsresult (*InitFromPRThread)(nsIEventQueue *pThis, PRThread * thread, PRBool aNative);
+    nsresult (*InitFromPLQueue)(nsIEventQueue *pThis, PLEventQueue * aQueue);
+    nsresult (*EnterMonitor)(nsIEventQueue *pThis);
+    nsresult (*ExitMonitor)(nsIEventQueue *pThis);
+    nsresult (*RevokeEvents)(nsIEventQueue *pThis, void * owner);
+    nsresult (*GetPLEventQueue)(nsIEventQueue *pThis, PLEventQueue * *_retval);
+    nsresult (*IsQueueNative)(nsIEventQueue *pThis, PRBool *_retval);
+    nsresult (*StopAcceptingEvents)(nsIEventQueue *pThis);
+};
+#else /* !VBOX_WITH_GLUE */
+struct nsIEventQueueVtbl
+{
+    nsresult (*QueryInterface)(nsIEventQueue *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(nsIEventQueue *pThis);
+    nsrefcnt (*Release)(nsIEventQueue *pThis);
+
+    nsresult (*PostEvent)(nsIEventQueue *pThis, PLEvent * aEvent);
+    nsresult (*IsOnCurrentThread)(nsIEventQueue *pThis, PRBool *_retval);
+
+    nsresult (*InitEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * owner, PLHandleEventProc handler, PLDestroyEventProc destructor);
+    nsresult (*PostSynchronousEvent)(nsIEventQueue *pThis, PLEvent * aEvent, void * *aResult);
+    nsresult (*PendingEvents)(nsIEventQueue *pThis, PRBool *_retval);
+    nsresult (*ProcessPendingEvents)(nsIEventQueue *pThis);
+    nsresult (*EventLoop)(nsIEventQueue *pThis);
+    nsresult (*EventAvailable)(nsIEventQueue *pThis, PRBool *aResult);
+    nsresult (*GetEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
+    nsresult (*HandleEvent)(nsIEventQueue *pThis, PLEvent * aEvent);
+    nsresult (*WaitForEvent)(nsIEventQueue *pThis, PLEvent * *_retval);
+    PRInt32 (*GetEventQueueSelectFD)(nsIEventQueue *pThis);
+    nsresult (*Init)(nsIEventQueue *pThis, PRBool aNative);
+    nsresult (*InitFromPRThread)(nsIEventQueue *pThis, PRThread * thread, PRBool aNative);
+    nsresult (*InitFromPLQueue)(nsIEventQueue *pThis, PLEventQueue * aQueue);
+    nsresult (*EnterMonitor)(nsIEventQueue *pThis);
+    nsresult (*ExitMonitor)(nsIEventQueue *pThis);
+    nsresult (*RevokeEvents)(nsIEventQueue *pThis, void * owner);
+    nsresult (*GetPLEventQueue)(nsIEventQueue *pThis, PLEventQueue * *_retval);
+    nsresult (*IsQueueNative)(nsIEventQueue *pThis, PRBool *_retval);
+    nsresult (*StopAcceptingEvents)(nsIEventQueue *pThis);
+};
+#define nsIEventQueue_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define nsIEventQueue_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define nsIEventQueue_Release(p) ((p)->lpVtbl->Release(p))
+#define nsIEventQueue_PostEvent(p, aEvent) ((p)->lpVtbl->PostEvent(p, aEvent))
+#define nsIEventQueue_IsOnCurrentThread(p, retval) ((p)->lpVtbl->IsOnCurrentThread(p, retval))
+#define nsIEventQueue_InitEvent(p, aEvent, owner, handler, destructor) ((p)->lpVtbl->InitEvent(p, aEvent, owner, handler, destructor))
+#define nsIEventQueue_PostSynchronousEvent(p, aEvent, aResult) ((p)->lpVtbl->PostSynchronousEvent(p, aEvent, aResult))
+#define nsIEventQueue_ProcessPendingEvents(p) ((p)->lpVtbl->ProcessPendingEvents(p))
+#define nsIEventQueue_EventLoop(p) ((p)->lpVtbl->EventLoop(p))
+#define nsIEventQueue_EventAvailable(p, aResult) ((p)->lpVtbl->EventAvailable(p, aResult))
+#define nsIEventQueue_get_Event(p, aEvent) ((p)->lpVtbl->GetEvent(p, aEvent))
+#define nsIEventQueue_GetEvent(p, aEvent) ((p)->lpVtbl->GetEvent(p, aEvent))
+#define nsIEventQueue_HandleEvent(p, aEvent) ((p)->lpVtbl->HandleEvent(p, aEvent))
+#define nsIEventQueue_WaitForEvent(p, aEvent) ((p)->lpVtbl->WaitForEvent(p, aEvent))
+#define nsIEventQueue_GetEventQueueSelectFD(p) ((p)->lpVtbl->GetEventQueueSelectFD(p))
+#define nsIEventQueue_Init(p, aNative) ((p)->lpVtbl->Init(p, aNative))
+#define nsIEventQueue_InitFromPLQueue(p, aQueue) ((p)->lpVtbl->InitFromPLQueue(p, aQueue))
+#define nsIEventQueue_EnterMonitor(p) ((p)->lpVtbl->EnterMonitor(p))
+#define nsIEventQueue_ExitMonitor(p) ((p)->lpVtbl->ExitMonitor(p))
+#define nsIEventQueue_RevokeEvents(p, owner) ((p)->lpVtbl->RevokeEvents(p, owner))
+#define nsIEventQueue_GetPLEventQueue(p, retval) ((p)->lpVtbl->GetPLEventQueue(p, retval))
+#define nsIEventQueue_IsQueueNative(p, retval) ((p)->lpVtbl->IsQueueNative(p, retval))
+#define nsIEventQueue_StopAcceptingEvents(p) ((p)->lpVtbl->StopAcceptingEvents(p))
+#endif /* !VBOX_WITH_GLUE */
+
+interface nsIEventQueue
+{
+#ifndef VBOX_WITH_GLUE
+    struct nsIEventQueue_vtbl *vtbl;
+#else /* !VBOX_WITH_GLUE */
+    CONST_VTBL struct nsIEventQueueVtbl *lpVtbl;
+#endif /* !VBOX_WITH_GLUE */
+};
+
+
+#define VBOX_E_OBJECT_NOT_FOUND 0x80BB0001
+#define VBOX_E_INVALID_VM_STATE 0x80BB0002
+#define VBOX_E_VM_ERROR 0x80BB0003
+#define VBOX_E_FILE_ERROR 0x80BB0004
+#define VBOX_E_IPRT_ERROR 0x80BB0005
+#define VBOX_E_PDM_ERROR 0x80BB0006
+#define VBOX_E_INVALID_OBJECT_STATE 0x80BB0007
+#define VBOX_E_HOST_ERROR 0x80BB0008
+#define VBOX_E_NOT_SUPPORTED 0x80BB0009
+#define VBOX_E_XML_ERROR 0x80BB000A
+#define VBOX_E_INVALID_SESSION_STATE 0x80BB000B
+#define VBOX_E_OBJECT_IN_USE 0x80BB000C
+
+
+interface IVirtualBoxErrorInfo;
+interface INATNetwork;
+interface IDHCPServer;
+interface IVirtualBox;
+interface IVFSExplorer;
+interface IAppliance;
+interface IVirtualSystemDescription;
+interface IBIOSSettings;
+interface IPCIAddress;
+interface IPCIDeviceAttachment;
+interface IMachine;
+interface IEmulatedUSB;
+interface IVRDEServerInfo;
+interface IConsole;
+interface IHostNetworkInterface;
+interface IHostVideoInputDevice;
+interface IHost;
+interface ISystemProperties;
+interface IGuestOSType;
+interface IAdditionsFacility;
+interface IGuestSession;
+interface IProcess;
+interface IGuestProcess;
+interface IDirectory;
+interface IGuestDirectory;
+interface IFile;
+interface IGuestFile;
+interface IFsObjInfo;
+interface IGuestFsObjInfo;
+interface IGuest;
+interface IProgress;
+interface ISnapshot;
+interface IMediumAttachment;
+interface IMedium;
+interface IMediumFormat;
+interface IToken;
+interface IKeyboard;
+interface IMouse;
+interface IFramebuffer;
+interface IFramebufferOverlay;
+interface IDisplay;
+interface INetworkAdapter;
+interface ISerialPort;
+interface IParallelPort;
+interface IMachineDebugger;
+interface IUSBDeviceFilters;
+interface IUSBController;
+interface IUSBDevice;
+interface IUSBDeviceFilter;
+interface IHostUSBDevice;
+interface IHostUSBDeviceFilter;
+interface IAudioAdapter;
+interface IVRDEServer;
+interface ISharedFolder;
+interface ISession;
+interface IStorageController;
+interface IPerformanceMetric;
+interface IPerformanceCollector;
+interface INATEngine;
+interface IExtPackPlugIn;
+interface IExtPackBase;
+interface IExtPack;
+interface IExtPackFile;
+interface IExtPackManager;
+interface IBandwidthGroup;
+interface IBandwidthControl;
+interface IVirtualBoxClient;
+interface IEventSource;
+interface IEventListener;
+interface IEvent;
+interface IReusableEvent;
+interface IMachineEvent;
+interface IMachineStateChangedEvent;
+interface IMachineDataChangedEvent;
+interface IMediumRegisteredEvent;
+interface IMachineRegisteredEvent;
+interface ISessionStateChangedEvent;
+interface IGuestPropertyChangedEvent;
+interface ISnapshotEvent;
+interface ISnapshotTakenEvent;
+interface ISnapshotDeletedEvent;
+interface ISnapshotChangedEvent;
+interface IMousePointerShapeChangedEvent;
+interface IMouseCapabilityChangedEvent;
+interface IKeyboardLedsChangedEvent;
+interface IStateChangedEvent;
+interface IAdditionsStateChangedEvent;
+interface INetworkAdapterChangedEvent;
+interface ISerialPortChangedEvent;
+interface IParallelPortChangedEvent;
+interface IStorageControllerChangedEvent;
+interface IMediumChangedEvent;
+interface IClipboardModeChangedEvent;
+interface IDragAndDropModeChangedEvent;
+interface ICPUChangedEvent;
+interface ICPUExecutionCapChangedEvent;
+interface IGuestKeyboardEvent;
+interface IGuestMouseEvent;
+interface IGuestMultiTouchEvent;
+interface IGuestSessionEvent;
+interface IGuestSessionStateChangedEvent;
+interface IGuestSessionRegisteredEvent;
+interface IGuestProcessEvent;
+interface IGuestProcessRegisteredEvent;
+interface IGuestProcessStateChangedEvent;
+interface IGuestProcessIOEvent;
+interface IGuestProcessInputNotifyEvent;
+interface IGuestProcessOutputEvent;
+interface IGuestFileEvent;
+interface IGuestFileRegisteredEvent;
+interface IGuestFileStateChangedEvent;
+interface IGuestFileIOEvent;
+interface IGuestFileOffsetChangedEvent;
+interface IGuestFileReadEvent;
+interface IGuestFileWriteEvent;
+interface IVRDEServerChangedEvent;
+interface IVRDEServerInfoChangedEvent;
+interface IVideoCaptureChangedEvent;
+interface IUSBControllerChangedEvent;
+interface IUSBDeviceStateChangedEvent;
+interface ISharedFolderChangedEvent;
+interface IRuntimeErrorEvent;
+interface IEventSourceChangedEvent;
+interface IExtraDataChangedEvent;
+interface IVetoEvent;
+interface IExtraDataCanChangeEvent;
+interface ICanShowWindowEvent;
+interface IShowWindowEvent;
+interface INATRedirectEvent;
+interface IHostPCIDevicePlugEvent;
+interface IVBoxSVCAvailabilityChangedEvent;
+interface IBandwidthGroupChangedEvent;
+interface IGuestMonitorChangedEvent;
+interface IGuestUserStateChangedEvent;
+interface IStorageDeviceChangedEvent;
+interface INATNetworkChangedEvent;
+interface INATNetworkStartStopEvent;
+interface INATNetworkAlterEvent;
+interface INATNetworkCreationDeletionEvent;
+interface INATNetworkSettingEvent;
+interface INATNetworkPortForwardEvent;
+interface IHostNameResolutionConfigurationChangeEvent;
+
+typedef interface IVirtualBoxErrorInfo IVirtualBoxErrorInfo;
+typedef interface INATNetwork INATNetwork;
+typedef interface IDHCPServer IDHCPServer;
+typedef interface IVirtualBox IVirtualBox;
+typedef interface IVFSExplorer IVFSExplorer;
+typedef interface IAppliance IAppliance;
+typedef interface IVirtualSystemDescription IVirtualSystemDescription;
+typedef interface IBIOSSettings IBIOSSettings;
+typedef interface IPCIAddress IPCIAddress;
+typedef interface IPCIDeviceAttachment IPCIDeviceAttachment;
+typedef interface IMachine IMachine;
+typedef interface IEmulatedUSB IEmulatedUSB;
+typedef interface IVRDEServerInfo IVRDEServerInfo;
+typedef interface IConsole IConsole;
+typedef interface IHostNetworkInterface IHostNetworkInterface;
+typedef interface IHostVideoInputDevice IHostVideoInputDevice;
+typedef interface IHost IHost;
+typedef interface ISystemProperties ISystemProperties;
+typedef interface IGuestOSType IGuestOSType;
+typedef interface IAdditionsFacility IAdditionsFacility;
+typedef interface IGuestSession IGuestSession;
+typedef interface IProcess IProcess;
+typedef interface IGuestProcess IGuestProcess;
+typedef interface IDirectory IDirectory;
+typedef interface IGuestDirectory IGuestDirectory;
+typedef interface IFile IFile;
+typedef interface IGuestFile IGuestFile;
+typedef interface IFsObjInfo IFsObjInfo;
+typedef interface IGuestFsObjInfo IGuestFsObjInfo;
+typedef interface IGuest IGuest;
+typedef interface IProgress IProgress;
+typedef interface ISnapshot ISnapshot;
+typedef interface IMediumAttachment IMediumAttachment;
+typedef interface IMedium IMedium;
+typedef interface IMediumFormat IMediumFormat;
+typedef interface IToken IToken;
+typedef interface IKeyboard IKeyboard;
+typedef interface IMouse IMouse;
+typedef interface IFramebuffer IFramebuffer;
+typedef interface IFramebufferOverlay IFramebufferOverlay;
+typedef interface IDisplay IDisplay;
+typedef interface INetworkAdapter INetworkAdapter;
+typedef interface ISerialPort ISerialPort;
+typedef interface IParallelPort IParallelPort;
+typedef interface IMachineDebugger IMachineDebugger;
+typedef interface IUSBDeviceFilters IUSBDeviceFilters;
+typedef interface IUSBController IUSBController;
+typedef interface IUSBDevice IUSBDevice;
+typedef interface IUSBDeviceFilter IUSBDeviceFilter;
+typedef interface IHostUSBDevice IHostUSBDevice;
+typedef interface IHostUSBDeviceFilter IHostUSBDeviceFilter;
+typedef interface IAudioAdapter IAudioAdapter;
+typedef interface IVRDEServer IVRDEServer;
+typedef interface ISharedFolder ISharedFolder;
+typedef interface ISession ISession;
+typedef interface IStorageController IStorageController;
+typedef interface IPerformanceMetric IPerformanceMetric;
+typedef interface IPerformanceCollector IPerformanceCollector;
+typedef interface INATEngine INATEngine;
+typedef interface IExtPackPlugIn IExtPackPlugIn;
+typedef interface IExtPackBase IExtPackBase;
+typedef interface IExtPack IExtPack;
+typedef interface IExtPackFile IExtPackFile;
+typedef interface IExtPackManager IExtPackManager;
+typedef interface IBandwidthGroup IBandwidthGroup;
+typedef interface IBandwidthControl IBandwidthControl;
+typedef interface IVirtualBoxClient IVirtualBoxClient;
+typedef interface IEventSource IEventSource;
+typedef interface IEventListener IEventListener;
+typedef interface IEvent IEvent;
+typedef interface IReusableEvent IReusableEvent;
+typedef interface IMachineEvent IMachineEvent;
+typedef interface IMachineStateChangedEvent IMachineStateChangedEvent;
+typedef interface IMachineDataChangedEvent IMachineDataChangedEvent;
+typedef interface IMediumRegisteredEvent IMediumRegisteredEvent;
+typedef interface IMachineRegisteredEvent IMachineRegisteredEvent;
+typedef interface ISessionStateChangedEvent ISessionStateChangedEvent;
+typedef interface IGuestPropertyChangedEvent IGuestPropertyChangedEvent;
+typedef interface ISnapshotEvent ISnapshotEvent;
+typedef interface ISnapshotTakenEvent ISnapshotTakenEvent;
+typedef interface ISnapshotDeletedEvent ISnapshotDeletedEvent;
+typedef interface ISnapshotChangedEvent ISnapshotChangedEvent;
+typedef interface IMousePointerShapeChangedEvent IMousePointerShapeChangedEvent;
+typedef interface IMouseCapabilityChangedEvent IMouseCapabilityChangedEvent;
+typedef interface IKeyboardLedsChangedEvent IKeyboardLedsChangedEvent;
+typedef interface IStateChangedEvent IStateChangedEvent;
+typedef interface IAdditionsStateChangedEvent IAdditionsStateChangedEvent;
+typedef interface INetworkAdapterChangedEvent INetworkAdapterChangedEvent;
+typedef interface ISerialPortChangedEvent ISerialPortChangedEvent;
+typedef interface IParallelPortChangedEvent IParallelPortChangedEvent;
+typedef interface IStorageControllerChangedEvent IStorageControllerChangedEvent;
+typedef interface IMediumChangedEvent IMediumChangedEvent;
+typedef interface IClipboardModeChangedEvent IClipboardModeChangedEvent;
+typedef interface IDragAndDropModeChangedEvent IDragAndDropModeChangedEvent;
+typedef interface ICPUChangedEvent ICPUChangedEvent;
+typedef interface ICPUExecutionCapChangedEvent ICPUExecutionCapChangedEvent;
+typedef interface IGuestKeyboardEvent IGuestKeyboardEvent;
+typedef interface IGuestMouseEvent IGuestMouseEvent;
+typedef interface IGuestMultiTouchEvent IGuestMultiTouchEvent;
+typedef interface IGuestSessionEvent IGuestSessionEvent;
+typedef interface IGuestSessionStateChangedEvent IGuestSessionStateChangedEvent;
+typedef interface IGuestSessionRegisteredEvent IGuestSessionRegisteredEvent;
+typedef interface IGuestProcessEvent IGuestProcessEvent;
+typedef interface IGuestProcessRegisteredEvent IGuestProcessRegisteredEvent;
+typedef interface IGuestProcessStateChangedEvent IGuestProcessStateChangedEvent;
+typedef interface IGuestProcessIOEvent IGuestProcessIOEvent;
+typedef interface IGuestProcessInputNotifyEvent IGuestProcessInputNotifyEvent;
+typedef interface IGuestProcessOutputEvent IGuestProcessOutputEvent;
+typedef interface IGuestFileEvent IGuestFileEvent;
+typedef interface IGuestFileRegisteredEvent IGuestFileRegisteredEvent;
+typedef interface IGuestFileStateChangedEvent IGuestFileStateChangedEvent;
+typedef interface IGuestFileIOEvent IGuestFileIOEvent;
+typedef interface IGuestFileOffsetChangedEvent IGuestFileOffsetChangedEvent;
+typedef interface IGuestFileReadEvent IGuestFileReadEvent;
+typedef interface IGuestFileWriteEvent IGuestFileWriteEvent;
+typedef interface IVRDEServerChangedEvent IVRDEServerChangedEvent;
+typedef interface IVRDEServerInfoChangedEvent IVRDEServerInfoChangedEvent;
+typedef interface IVideoCaptureChangedEvent IVideoCaptureChangedEvent;
+typedef interface IUSBControllerChangedEvent IUSBControllerChangedEvent;
+typedef interface IUSBDeviceStateChangedEvent IUSBDeviceStateChangedEvent;
+typedef interface ISharedFolderChangedEvent ISharedFolderChangedEvent;
+typedef interface IRuntimeErrorEvent IRuntimeErrorEvent;
+typedef interface IEventSourceChangedEvent IEventSourceChangedEvent;
+typedef interface IExtraDataChangedEvent IExtraDataChangedEvent;
+typedef interface IVetoEvent IVetoEvent;
+typedef interface IExtraDataCanChangeEvent IExtraDataCanChangeEvent;
+typedef interface ICanShowWindowEvent ICanShowWindowEvent;
+typedef interface IShowWindowEvent IShowWindowEvent;
+typedef interface INATRedirectEvent INATRedirectEvent;
+typedef interface IHostPCIDevicePlugEvent IHostPCIDevicePlugEvent;
+typedef interface IVBoxSVCAvailabilityChangedEvent IVBoxSVCAvailabilityChangedEvent;
+typedef interface IBandwidthGroupChangedEvent IBandwidthGroupChangedEvent;
+typedef interface IGuestMonitorChangedEvent IGuestMonitorChangedEvent;
+typedef interface IGuestUserStateChangedEvent IGuestUserStateChangedEvent;
+typedef interface IStorageDeviceChangedEvent IStorageDeviceChangedEvent;
+typedef interface INATNetworkChangedEvent INATNetworkChangedEvent;
+typedef interface INATNetworkStartStopEvent INATNetworkStartStopEvent;
+typedef interface INATNetworkAlterEvent INATNetworkAlterEvent;
+typedef interface INATNetworkCreationDeletionEvent INATNetworkCreationDeletionEvent;
+typedef interface INATNetworkSettingEvent INATNetworkSettingEvent;
+typedef interface INATNetworkPortForwardEvent INATNetworkPortForwardEvent;
+typedef interface IHostNameResolutionConfigurationChangeEvent IHostNameResolutionConfigurationChangeEvent;
+
+/* Start of enum SettingsVersion declaration */
+#define SETTINGSVERSION_IID_STR "d5b15ca7-3de7-46b2-a63a-ddcce42bfa3f"
+#define SETTINGSVERSION_IID { \
+    0xd5b15ca7, 0x3de7, 0x46b2, \
+    { 0xa6, 0x3a, 0xdd, 0xcc, 0xe4, 0x2b, 0xfa, 0x3f } \
+}
+typedef enum SettingsVersion
+{
+    SettingsVersion_Null = 0,
+    SettingsVersion_v1_0 = 1,
+    SettingsVersion_v1_1 = 2,
+    SettingsVersion_v1_2 = 3,
+    SettingsVersion_v1_3pre = 4,
+    SettingsVersion_v1_3 = 5,
+    SettingsVersion_v1_4 = 6,
+    SettingsVersion_v1_5 = 7,
+    SettingsVersion_v1_6 = 8,
+    SettingsVersion_v1_7 = 9,
+    SettingsVersion_v1_8 = 10,
+    SettingsVersion_v1_9 = 11,
+    SettingsVersion_v1_10 = 12,
+    SettingsVersion_v1_11 = 13,
+    SettingsVersion_v1_12 = 14,
+    SettingsVersion_v1_13 = 15,
+    SettingsVersion_v1_14 = 16,
+    SettingsVersion_Future = 99999
+} SettingsVersion;
+/* End of enum SettingsVersion declaration */
+#define SettingsVersion_T PRUint32
+
+
+/* Start of enum AccessMode declaration */
+#define ACCESSMODE_IID_STR "1da0007c-ddf7-4be8-bcac-d84a1558785f"
+#define ACCESSMODE_IID { \
+    0x1da0007c, 0xddf7, 0x4be8, \
+    { 0xbc, 0xac, 0xd8, 0x4a, 0x15, 0x58, 0x78, 0x5f } \
+}
+typedef enum AccessMode
+{
+    AccessMode_ReadOnly = 1,
+    AccessMode_ReadWrite = 2
+} AccessMode;
+/* End of enum AccessMode declaration */
+#define AccessMode_T PRUint32
+
+
+/* Start of enum MachineState declaration */
+#define MACHINESTATE_IID_STR "ec6c6a9e-113d-4ff4-b44f-0b69f21c97fe"
+#define MACHINESTATE_IID { \
+    0xec6c6a9e, 0x113d, 0x4ff4, \
+    { 0xb4, 0x4f, 0x0b, 0x69, 0xf2, 0x1c, 0x97, 0xfe } \
+}
+typedef enum MachineState
+{
+    MachineState_Null = 0,
+    MachineState_PoweredOff = 1,
+    MachineState_Saved = 2,
+    MachineState_Teleported = 3,
+    MachineState_Aborted = 4,
+    MachineState_Running = 5,
+    MachineState_Paused = 6,
+    MachineState_Stuck = 7,
+    MachineState_Teleporting = 8,
+    MachineState_LiveSnapshotting = 9,
+    MachineState_Starting = 10,
+    MachineState_Stopping = 11,
+    MachineState_Saving = 12,
+    MachineState_Restoring = 13,
+    MachineState_TeleportingPausedVM = 14,
+    MachineState_TeleportingIn = 15,
+    MachineState_FaultTolerantSyncing = 16,
+    MachineState_DeletingSnapshotOnline = 17,
+    MachineState_DeletingSnapshotPaused = 18,
+    MachineState_RestoringSnapshot = 19,
+    MachineState_DeletingSnapshot = 20,
+    MachineState_SettingUp = 21,
+    MachineState_FirstOnline = 5,
+    MachineState_LastOnline = 18,
+    MachineState_FirstTransient = 8,
+    MachineState_LastTransient = 21
+} MachineState;
+/* End of enum MachineState declaration */
+#define MachineState_T PRUint32
+
+
+/* Start of enum SessionState declaration */
+#define SESSIONSTATE_IID_STR "cf2700c0-ea4b-47ae-9725-7810114b94d8"
+#define SESSIONSTATE_IID { \
+    0xcf2700c0, 0xea4b, 0x47ae, \
+    { 0x97, 0x25, 0x78, 0x10, 0x11, 0x4b, 0x94, 0xd8 } \
+}
+typedef enum SessionState
+{
+    SessionState_Null = 0,
+    SessionState_Unlocked = 1,
+    SessionState_Locked = 2,
+    SessionState_Spawning = 3,
+    SessionState_Unlocking = 4
+} SessionState;
+/* End of enum SessionState declaration */
+#define SessionState_T PRUint32
+
+
+/* Start of enum CPUPropertyType declaration */
+#define CPUPROPERTYTYPE_IID_STR "52bc41f4-a279-45da-88ab-3a1d86fb73eb"
+#define CPUPROPERTYTYPE_IID { \
+    0x52bc41f4, 0xa279, 0x45da, \
+    { 0x88, 0xab, 0x3a, 0x1d, 0x86, 0xfb, 0x73, 0xeb } \
+}
+typedef enum CPUPropertyType
+{
+    CPUPropertyType_Null = 0,
+    CPUPropertyType_PAE = 1,
+    CPUPropertyType_Synthetic = 2,
+    CPUPropertyType_LongMode = 3,
+    CPUPropertyType_TripleFaultReset = 4
+} CPUPropertyType;
+/* End of enum CPUPropertyType declaration */
+#define CPUPropertyType_T PRUint32
+
+
+/* Start of enum HWVirtExPropertyType declaration */
+#define HWVIRTEXPROPERTYTYPE_IID_STR "411ad0ea-aeeb-44cb-9d03-1624d0d025ac"
+#define HWVIRTEXPROPERTYTYPE_IID { \
+    0x411ad0ea, 0xaeeb, 0x44cb, \
+    { 0x9d, 0x03, 0x16, 0x24, 0xd0, 0xd0, 0x25, 0xac } \
+}
+typedef enum HWVirtExPropertyType
+{
+    HWVirtExPropertyType_Null = 0,
+    HWVirtExPropertyType_Enabled = 1,
+    HWVirtExPropertyType_VPID = 2,
+    HWVirtExPropertyType_NestedPaging = 3,
+    HWVirtExPropertyType_UnrestrictedExecution = 4,
+    HWVirtExPropertyType_LargePages = 5,
+    HWVirtExPropertyType_Force = 6
+} HWVirtExPropertyType;
+/* End of enum HWVirtExPropertyType declaration */
+#define HWVirtExPropertyType_T PRUint32
+
+
+/* Start of enum FaultToleranceState declaration */
+#define FAULTTOLERANCESTATE_IID_STR "5124f7ec-6b67-493c-9dee-ee45a44114e1"
+#define FAULTTOLERANCESTATE_IID { \
+    0x5124f7ec, 0x6b67, 0x493c, \
+    { 0x9d, 0xee, 0xee, 0x45, 0xa4, 0x41, 0x14, 0xe1 } \
+}
+typedef enum FaultToleranceState
+{
+    FaultToleranceState_Inactive = 1,
+    FaultToleranceState_Master = 2,
+    FaultToleranceState_Standby = 3
+} FaultToleranceState;
+/* End of enum FaultToleranceState declaration */
+#define FaultToleranceState_T PRUint32
+
+
+/* Start of enum LockType declaration */
+#define LOCKTYPE_IID_STR "168a6a8e-12fd-4878-a1f9-38a750a56089"
+#define LOCKTYPE_IID { \
+    0x168a6a8e, 0x12fd, 0x4878, \
+    { 0xa1, 0xf9, 0x38, 0xa7, 0x50, 0xa5, 0x60, 0x89 } \
+}
+typedef enum LockType
+{
+    LockType_Write = 2,
+    LockType_Shared = 1,
+    LockType_VM = 3
+} LockType;
+/* End of enum LockType declaration */
+#define LockType_T PRUint32
+
+
+/* Start of enum SessionType declaration */
+#define SESSIONTYPE_IID_STR "A13C02CB-0C2C-421E-8317-AC0E8AAA153A"
+#define SESSIONTYPE_IID { \
+    0xA13C02CB, 0x0C2C, 0x421E, \
+    { 0x83, 0x17, 0xAC, 0x0E, 0x8A, 0xAA, 0x15, 0x3A } \
+}
+typedef enum SessionType
+{
+    SessionType_Null = 0,
+    SessionType_WriteLock = 1,
+    SessionType_Remote = 2,
+    SessionType_Shared = 3
+} SessionType;
+/* End of enum SessionType declaration */
+#define SessionType_T PRUint32
+
+
+/* Start of enum DeviceType declaration */
+#define DEVICETYPE_IID_STR "6d9420f7-0b56-4636-99f9-7346f1b01e57"
+#define DEVICETYPE_IID { \
+    0x6d9420f7, 0x0b56, 0x4636, \
+    { 0x99, 0xf9, 0x73, 0x46, 0xf1, 0xb0, 0x1e, 0x57 } \
+}
+typedef enum DeviceType
+{
+    DeviceType_Null = 0,
+    DeviceType_Floppy = 1,
+    DeviceType_DVD = 2,
+    DeviceType_HardDisk = 3,
+    DeviceType_Network = 4,
+    DeviceType_USB = 5,
+    DeviceType_SharedFolder = 6
+} DeviceType;
+/* End of enum DeviceType declaration */
+#define DeviceType_T PRUint32
+
+
+/* Start of enum DeviceActivity declaration */
+#define DEVICEACTIVITY_IID_STR "6FC8AEAA-130A-4eb5-8954-3F921422D707"
+#define DEVICEACTIVITY_IID { \
+    0x6FC8AEAA, 0x130A, 0x4eb5, \
+    { 0x89, 0x54, 0x3F, 0x92, 0x14, 0x22, 0xD7, 0x07 } \
+}
+typedef enum DeviceActivity
+{
+    DeviceActivity_Null = 0,
+    DeviceActivity_Idle = 1,
+    DeviceActivity_Reading = 2,
+    DeviceActivity_Writing = 3
+} DeviceActivity;
+/* End of enum DeviceActivity declaration */
+#define DeviceActivity_T PRUint32
+
+
+/* Start of enum ClipboardMode declaration */
+#define CLIPBOARDMODE_IID_STR "33364716-4008-4701-8f14-be0fa3d62950"
+#define CLIPBOARDMODE_IID { \
+    0x33364716, 0x4008, 0x4701, \
+    { 0x8f, 0x14, 0xbe, 0x0f, 0xa3, 0xd6, 0x29, 0x50 } \
+}
+typedef enum ClipboardMode
+{
+    ClipboardMode_Disabled = 0,
+    ClipboardMode_HostToGuest = 1,
+    ClipboardMode_GuestToHost = 2,
+    ClipboardMode_Bidirectional = 3
+} ClipboardMode;
+/* End of enum ClipboardMode declaration */
+#define ClipboardMode_T PRUint32
+
+
+/* Start of enum DragAndDropMode declaration */
+#define DRAGANDDROPMODE_IID_STR "b618ea0e-b6fb-4f8d-97f7-5e237e49b547"
+#define DRAGANDDROPMODE_IID { \
+    0xb618ea0e, 0xb6fb, 0x4f8d, \
+    { 0x97, 0xf7, 0x5e, 0x23, 0x7e, 0x49, 0xb5, 0x47 } \
+}
+typedef enum DragAndDropMode
+{
+    DragAndDropMode_Disabled = 0,
+    DragAndDropMode_HostToGuest = 1,
+    DragAndDropMode_GuestToHost = 2,
+    DragAndDropMode_Bidirectional = 3
+} DragAndDropMode;
+/* End of enum DragAndDropMode declaration */
+#define DragAndDropMode_T PRUint32
+
+
+/* Start of enum Scope declaration */
+#define SCOPE_IID_STR "7c91096e-499e-4eca-9f9b-9001438d7855"
+#define SCOPE_IID { \
+    0x7c91096e, 0x499e, 0x4eca, \
+    { 0x9f, 0x9b, 0x90, 0x01, 0x43, 0x8d, 0x78, 0x55 } \
+}
+typedef enum Scope
+{
+    Scope_Global = 0,
+    Scope_Machine = 1,
+    Scope_Session = 2
+} Scope;
+/* End of enum Scope declaration */
+#define Scope_T PRUint32
+
+
+/* Start of enum BIOSBootMenuMode declaration */
+#define BIOSBOOTMENUMODE_IID_STR "ae4fb9f7-29d2-45b4-b2c7-d579603135d5"
+#define BIOSBOOTMENUMODE_IID { \
+    0xae4fb9f7, 0x29d2, 0x45b4, \
+    { 0xb2, 0xc7, 0xd5, 0x79, 0x60, 0x31, 0x35, 0xd5 } \
+}
+typedef enum BIOSBootMenuMode
+{
+    BIOSBootMenuMode_Disabled = 0,
+    BIOSBootMenuMode_MenuOnly = 1,
+    BIOSBootMenuMode_MessageAndMenu = 2
+} BIOSBootMenuMode;
+/* End of enum BIOSBootMenuMode declaration */
+#define BIOSBootMenuMode_T PRUint32
+
+
+/* Start of enum ProcessorFeature declaration */
+#define PROCESSORFEATURE_IID_STR "64c38e6b-8bcf-45ad-ac03-9b406287c5bf"
+#define PROCESSORFEATURE_IID { \
+    0x64c38e6b, 0x8bcf, 0x45ad, \
+    { 0xac, 0x03, 0x9b, 0x40, 0x62, 0x87, 0xc5, 0xbf } \
+}
+typedef enum ProcessorFeature
+{
+    ProcessorFeature_HWVirtEx = 0,
+    ProcessorFeature_PAE = 1,
+    ProcessorFeature_LongMode = 2,
+    ProcessorFeature_NestedPaging = 3
+} ProcessorFeature;
+/* End of enum ProcessorFeature declaration */
+#define ProcessorFeature_T PRUint32
+
+
+/* Start of enum FirmwareType declaration */
+#define FIRMWARETYPE_IID_STR "b903f264-c230-483e-ac74-2b37ce60d371"
+#define FIRMWARETYPE_IID { \
+    0xb903f264, 0xc230, 0x483e, \
+    { 0xac, 0x74, 0x2b, 0x37, 0xce, 0x60, 0xd3, 0x71 } \
+}
+typedef enum FirmwareType
+{
+    FirmwareType_BIOS = 1,
+    FirmwareType_EFI = 2,
+    FirmwareType_EFI32 = 3,
+    FirmwareType_EFI64 = 4,
+    FirmwareType_EFIDUAL = 5
+} FirmwareType;
+/* End of enum FirmwareType declaration */
+#define FirmwareType_T PRUint32
+
+
+/* Start of enum PointingHIDType declaration */
+#define POINTINGHIDTYPE_IID_STR "19964e93-0050-45c4-9382-a7bccc53e666"
+#define POINTINGHIDTYPE_IID { \
+    0x19964e93, 0x0050, 0x45c4, \
+    { 0x93, 0x82, 0xa7, 0xbc, 0xcc, 0x53, 0xe6, 0x66 } \
+}
+typedef enum PointingHIDType
+{
+    PointingHIDType_None = 1,
+    PointingHIDType_PS2Mouse = 2,
+    PointingHIDType_USBMouse = 3,
+    PointingHIDType_USBTablet = 4,
+    PointingHIDType_ComboMouse = 5,
+    PointingHIDType_USBMultiTouch = 6
+} PointingHIDType;
+/* End of enum PointingHIDType declaration */
+#define PointingHIDType_T PRUint32
+
+
+/* Start of enum KeyboardHIDType declaration */
+#define KEYBOARDHIDTYPE_IID_STR "383e43d7-5c7c-4ec8-9cb8-eda1bccd6699"
+#define KEYBOARDHIDTYPE_IID { \
+    0x383e43d7, 0x5c7c, 0x4ec8, \
+    { 0x9c, 0xb8, 0xed, 0xa1, 0xbc, 0xcd, 0x66, 0x99 } \
+}
+typedef enum KeyboardHIDType
+{
+    KeyboardHIDType_None = 1,
+    KeyboardHIDType_PS2Keyboard = 2,
+    KeyboardHIDType_USBKeyboard = 3,
+    KeyboardHIDType_ComboKeyboard = 4
+} KeyboardHIDType;
+/* End of enum KeyboardHIDType declaration */
+#define KeyboardHIDType_T PRUint32
+
+
+/* Start of enum DhcpOpt declaration */
+#define DHCPOPT_IID_STR "40d99bd3-3ece-44d2-a07e-1085fe9c4f0b"
+#define DHCPOPT_IID { \
+    0x40d99bd3, 0x3ece, 0x44d2, \
+    { 0xa0, 0x7e, 0x10, 0x85, 0xfe, 0x9c, 0x4f, 0x0b } \
+}
+typedef enum DhcpOpt
+{
+    DhcpOpt_SubnetMask = 1,
+    DhcpOpt_TimeOffset = 2,
+    DhcpOpt_Router = 3,
+    DhcpOpt_TimeServer = 4,
+    DhcpOpt_NameServer = 5,
+    DhcpOpt_DomainNameServer = 6,
+    DhcpOpt_LogServer = 7,
+    DhcpOpt_Cookie = 8,
+    DhcpOpt_LPRServer = 9,
+    DhcpOpt_ImpressServer = 10,
+    DhcpOpt_ResourseLocationServer = 11,
+    DhcpOpt_HostName = 12,
+    DhcpOpt_BootFileSize = 13,
+    DhcpOpt_MeritDumpFile = 14,
+    DhcpOpt_DomainName = 15,
+    DhcpOpt_SwapServer = 16,
+    DhcpOpt_RootPath = 17,
+    DhcpOpt_ExtensionPath = 18,
+    DhcpOpt_IPForwardingEnableDisable = 19,
+    DhcpOpt_NonLocalSourceRoutingEnableDisable = 20,
+    DhcpOpt_PolicyFilter = 21,
+    DhcpOpt_MaximumDatagramReassemblySize = 22,
+    DhcpOpt_DefaultIPTime2Live = 23,
+    DhcpOpt_PathMTUAgingTimeout = 24,
+    DhcpOpt_IPLayerParametersPerInterface = 25,
+    DhcpOpt_InterfaceMTU = 26,
+    DhcpOpt_AllSubnetsAreLocal = 27,
+    DhcpOpt_BroadcastAddress = 28,
+    DhcpOpt_PerformMaskDiscovery = 29,
+    DhcpOpt_MaskSupplier = 30,
+    DhcpOpt_PerformRouteDiscovery = 31,
+    DhcpOpt_RouterSolicitationAddress = 32,
+    DhcpOpt_StaticRoute = 33,
+    DhcpOpt_TrailerEncapsulation = 34,
+    DhcpOpt_ARPCacheTimeout = 35,
+    DhcpOpt_EthernetEncapsulation = 36,
+    DhcpOpt_TCPDefaultTTL = 37,
+    DhcpOpt_TCPKeepAliveInterval = 38,
+    DhcpOpt_TCPKeepAliveGarbage = 39,
+    DhcpOpt_NetworkInformationServiceDomain = 40,
+    DhcpOpt_NetworkInformationServiceServers = 41,
+    DhcpOpt_NetworkTimeProtocolServers = 42,
+    DhcpOpt_VendorSpecificInformation = 43,
+    DhcpOpt_Option_44 = 44,
+    DhcpOpt_Option_45 = 45,
+    DhcpOpt_Option_46 = 46,
+    DhcpOpt_Option_47 = 47,
+    DhcpOpt_Option_48 = 48,
+    DhcpOpt_Option_49 = 49,
+    DhcpOpt_IPAddressLeaseTime = 51,
+    DhcpOpt_Option_64 = 64,
+    DhcpOpt_Option_65 = 65,
+    DhcpOpt_TFTPServerName = 66,
+    DhcpOpt_BootfileName = 67,
+    DhcpOpt_Option_68 = 68,
+    DhcpOpt_Option_69 = 69,
+    DhcpOpt_Option_70 = 70,
+    DhcpOpt_Option_71 = 71,
+    DhcpOpt_Option_72 = 72,
+    DhcpOpt_Option_73 = 73,
+    DhcpOpt_Option_74 = 74,
+    DhcpOpt_Option_75 = 75,
+    DhcpOpt_Option_119 = 119
+} DhcpOpt;
+/* End of enum DhcpOpt declaration */
+#define DhcpOpt_T PRUint32
+
+
+/* Start of enum VFSType declaration */
+#define VFSTYPE_IID_STR "813999ba-b949-48a8-9230-aadc6285e2f2"
+#define VFSTYPE_IID { \
+    0x813999ba, 0xb949, 0x48a8, \
+    { 0x92, 0x30, 0xaa, 0xdc, 0x62, 0x85, 0xe2, 0xf2 } \
+}
+typedef enum VFSType
+{
+    VFSType_File = 1,
+    VFSType_Cloud = 2,
+    VFSType_S3 = 3,
+    VFSType_WebDav = 4
+} VFSType;
+/* End of enum VFSType declaration */
+#define VFSType_T PRUint32
+
+
+/* Start of enum VFSFileType declaration */
+#define VFSFILETYPE_IID_STR "714333cd-44e2-415f-a245-d378fa9b1242"
+#define VFSFILETYPE_IID { \
+    0x714333cd, 0x44e2, 0x415f, \
+    { 0xa2, 0x45, 0xd3, 0x78, 0xfa, 0x9b, 0x12, 0x42 } \
+}
+typedef enum VFSFileType
+{
+    VFSFileType_Unknown = 1,
+    VFSFileType_Fifo = 2,
+    VFSFileType_DevChar = 3,
+    VFSFileType_Directory = 4,
+    VFSFileType_DevBlock = 5,
+    VFSFileType_File = 6,
+    VFSFileType_SymLink = 7,
+    VFSFileType_Socket = 8,
+    VFSFileType_WhiteOut = 9
+} VFSFileType;
+/* End of enum VFSFileType declaration */
+#define VFSFileType_T PRUint32
+
+
+/* Start of enum ImportOptions declaration */
+#define IMPORTOPTIONS_IID_STR "0a981523-3b20-4004-8ee3-dfd322202ace"
+#define IMPORTOPTIONS_IID { \
+    0x0a981523, 0x3b20, 0x4004, \
+    { 0x8e, 0xe3, 0xdf, 0xd3, 0x22, 0x20, 0x2a, 0xce } \
+}
+typedef enum ImportOptions
+{
+    ImportOptions_KeepAllMACs = 1,
+    ImportOptions_KeepNATMACs = 2
+} ImportOptions;
+/* End of enum ImportOptions declaration */
+#define ImportOptions_T PRUint32
+
+
+/* Start of enum ExportOptions declaration */
+#define EXPORTOPTIONS_IID_STR "8f45eb08-fd34-41ee-af95-a880bdee5554"
+#define EXPORTOPTIONS_IID { \
+    0x8f45eb08, 0xfd34, 0x41ee, \
+    { 0xaf, 0x95, 0xa8, 0x80, 0xbd, 0xee, 0x55, 0x54 } \
+}
+typedef enum ExportOptions
+{
+    ExportOptions_CreateManifest = 1,
+    ExportOptions_ExportDVDImages = 2,
+    ExportOptions_StripAllMACs = 3,
+    ExportOptions_StripAllNonNATMACs = 4
+} ExportOptions;
+/* End of enum ExportOptions declaration */
+#define ExportOptions_T PRUint32
+
+
+/* Start of enum VirtualSystemDescriptionType declaration */
+#define VIRTUALSYSTEMDESCRIPTIONTYPE_IID_STR "303c0900-a746-4612-8c67-79003e91f459"
+#define VIRTUALSYSTEMDESCRIPTIONTYPE_IID { \
+    0x303c0900, 0xa746, 0x4612, \
+    { 0x8c, 0x67, 0x79, 0x00, 0x3e, 0x91, 0xf4, 0x59 } \
+}
+typedef enum VirtualSystemDescriptionType
+{
+    VirtualSystemDescriptionType_Ignore = 1,
+    VirtualSystemDescriptionType_OS = 2,
+    VirtualSystemDescriptionType_Name = 3,
+    VirtualSystemDescriptionType_Product = 4,
+    VirtualSystemDescriptionType_Vendor = 5,
+    VirtualSystemDescriptionType_Version = 6,
+    VirtualSystemDescriptionType_ProductUrl = 7,
+    VirtualSystemDescriptionType_VendorUrl = 8,
+    VirtualSystemDescriptionType_Description = 9,
+    VirtualSystemDescriptionType_License = 10,
+    VirtualSystemDescriptionType_Miscellaneous = 11,
+    VirtualSystemDescriptionType_CPU = 12,
+    VirtualSystemDescriptionType_Memory = 13,
+    VirtualSystemDescriptionType_HardDiskControllerIDE = 14,
+    VirtualSystemDescriptionType_HardDiskControllerSATA = 15,
+    VirtualSystemDescriptionType_HardDiskControllerSCSI = 16,
+    VirtualSystemDescriptionType_HardDiskControllerSAS = 17,
+    VirtualSystemDescriptionType_HardDiskImage = 18,
+    VirtualSystemDescriptionType_Floppy = 19,
+    VirtualSystemDescriptionType_CDROM = 20,
+    VirtualSystemDescriptionType_NetworkAdapter = 21,
+    VirtualSystemDescriptionType_USBController = 22,
+    VirtualSystemDescriptionType_SoundCard = 23,
+    VirtualSystemDescriptionType_SettingsFile = 24
+} VirtualSystemDescriptionType;
+/* End of enum VirtualSystemDescriptionType declaration */
+#define VirtualSystemDescriptionType_T PRUint32
+
+
+/* Start of enum VirtualSystemDescriptionValueType declaration */
+#define VIRTUALSYSTEMDESCRIPTIONVALUETYPE_IID_STR "56d9403f-3425-4118-9919-36f2a9b8c77c"
+#define VIRTUALSYSTEMDESCRIPTIONVALUETYPE_IID { \
+    0x56d9403f, 0x3425, 0x4118, \
+    { 0x99, 0x19, 0x36, 0xf2, 0xa9, 0xb8, 0xc7, 0x7c } \
+}
+typedef enum VirtualSystemDescriptionValueType
+{
+    VirtualSystemDescriptionValueType_Reference = 1,
+    VirtualSystemDescriptionValueType_Original = 2,
+    VirtualSystemDescriptionValueType_Auto = 3,
+    VirtualSystemDescriptionValueType_ExtraConfig = 4
+} VirtualSystemDescriptionValueType;
+/* End of enum VirtualSystemDescriptionValueType declaration */
+#define VirtualSystemDescriptionValueType_T PRUint32
+
+
+/* Start of enum GraphicsControllerType declaration */
+#define GRAPHICSCONTROLLERTYPE_IID_STR "79c96ca0-9f39-4900-948e-68c41cbe127a"
+#define GRAPHICSCONTROLLERTYPE_IID { \
+    0x79c96ca0, 0x9f39, 0x4900, \
+    { 0x94, 0x8e, 0x68, 0xc4, 0x1c, 0xbe, 0x12, 0x7a } \
+}
+typedef enum GraphicsControllerType
+{
+    GraphicsControllerType_Null = 0,
+    GraphicsControllerType_VBoxVGA = 1,
+    GraphicsControllerType_VMSVGA = 2
+} GraphicsControllerType;
+/* End of enum GraphicsControllerType declaration */
+#define GraphicsControllerType_T PRUint32
+
+
+/* Start of enum CleanupMode declaration */
+#define CLEANUPMODE_IID_STR "67897c50-7cca-47a9-83f6-ce8fd8eb5441"
+#define CLEANUPMODE_IID { \
+    0x67897c50, 0x7cca, 0x47a9, \
+    { 0x83, 0xf6, 0xce, 0x8f, 0xd8, 0xeb, 0x54, 0x41 } \
+}
+typedef enum CleanupMode
+{
+    CleanupMode_UnregisterOnly = 1,
+    CleanupMode_DetachAllReturnNone = 2,
+    CleanupMode_DetachAllReturnHardDisksOnly = 3,
+    CleanupMode_Full = 4
+} CleanupMode;
+/* End of enum CleanupMode declaration */
+#define CleanupMode_T PRUint32
+
+
+/* Start of enum CloneMode declaration */
+#define CLONEMODE_IID_STR "A7A159FE-5096-4B8D-8C3C-D033CB0B35A8"
+#define CLONEMODE_IID { \
+    0xA7A159FE, 0x5096, 0x4B8D, \
+    { 0x8C, 0x3C, 0xD0, 0x33, 0xCB, 0x0B, 0x35, 0xA8 } \
+}
+typedef enum CloneMode
+{
+    CloneMode_MachineState = 1,
+    CloneMode_MachineAndChildStates = 2,
+    CloneMode_AllStates = 3
+} CloneMode;
+/* End of enum CloneMode declaration */
+#define CloneMode_T PRUint32
+
+
+/* Start of enum CloneOptions declaration */
+#define CLONEOPTIONS_IID_STR "22243f8e-96ab-497c-8cf0-f40a566c630b"
+#define CLONEOPTIONS_IID { \
+    0x22243f8e, 0x96ab, 0x497c, \
+    { 0x8c, 0xf0, 0xf4, 0x0a, 0x56, 0x6c, 0x63, 0x0b } \
+}
+typedef enum CloneOptions
+{
+    CloneOptions_Link = 1,
+    CloneOptions_KeepAllMACs = 2,
+    CloneOptions_KeepNATMACs = 3,
+    CloneOptions_KeepDiskNames = 4
+} CloneOptions;
+/* End of enum CloneOptions declaration */
+#define CloneOptions_T PRUint32
+
+
+/* Start of enum AutostopType declaration */
+#define AUTOSTOPTYPE_IID_STR "6bb96740-cf34-470d-aab2-2cd48ea2e10e"
+#define AUTOSTOPTYPE_IID { \
+    0x6bb96740, 0xcf34, 0x470d, \
+    { 0xaa, 0xb2, 0x2c, 0xd4, 0x8e, 0xa2, 0xe1, 0x0e } \
+}
+typedef enum AutostopType
+{
+    AutostopType_Disabled = 1,
+    AutostopType_SaveState = 2,
+    AutostopType_PowerOff = 3,
+    AutostopType_AcpiShutdown = 4
+} AutostopType;
+/* End of enum AutostopType declaration */
+#define AutostopType_T PRUint32
+
+
+/* Start of enum HostNetworkInterfaceMediumType declaration */
+#define HOSTNETWORKINTERFACEMEDIUMTYPE_IID_STR "1aa54aaf-2497-45a2-bfb1-8eb225e93d5b"
+#define HOSTNETWORKINTERFACEMEDIUMTYPE_IID { \
+    0x1aa54aaf, 0x2497, 0x45a2, \
+    { 0xbf, 0xb1, 0x8e, 0xb2, 0x25, 0xe9, 0x3d, 0x5b } \
+}
+typedef enum HostNetworkInterfaceMediumType
+{
+    HostNetworkInterfaceMediumType_Unknown = 0,
+    HostNetworkInterfaceMediumType_Ethernet = 1,
+    HostNetworkInterfaceMediumType_PPP = 2,
+    HostNetworkInterfaceMediumType_SLIP = 3
+} HostNetworkInterfaceMediumType;
+/* End of enum HostNetworkInterfaceMediumType declaration */
+#define HostNetworkInterfaceMediumType_T PRUint32
+
+
+/* Start of enum HostNetworkInterfaceStatus declaration */
+#define HOSTNETWORKINTERFACESTATUS_IID_STR "CC474A69-2710-434B-8D99-C38E5D5A6F41"
+#define HOSTNETWORKINTERFACESTATUS_IID { \
+    0xCC474A69, 0x2710, 0x434B, \
+    { 0x8D, 0x99, 0xC3, 0x8E, 0x5D, 0x5A, 0x6F, 0x41 } \
+}
+typedef enum HostNetworkInterfaceStatus
+{
+    HostNetworkInterfaceStatus_Unknown = 0,
+    HostNetworkInterfaceStatus_Up = 1,
+    HostNetworkInterfaceStatus_Down = 2
+} HostNetworkInterfaceStatus;
+/* End of enum HostNetworkInterfaceStatus declaration */
+#define HostNetworkInterfaceStatus_T PRUint32
+
+
+/* Start of enum HostNetworkInterfaceType declaration */
+#define HOSTNETWORKINTERFACETYPE_IID_STR "67431b00-9946-48a2-bc02-b25c5919f4f3"
+#define HOSTNETWORKINTERFACETYPE_IID { \
+    0x67431b00, 0x9946, 0x48a2, \
+    { 0xbc, 0x02, 0xb2, 0x5c, 0x59, 0x19, 0xf4, 0xf3 } \
+}
+typedef enum HostNetworkInterfaceType
+{
+    HostNetworkInterfaceType_Bridged = 1,
+    HostNetworkInterfaceType_HostOnly = 2
+} HostNetworkInterfaceType;
+/* End of enum HostNetworkInterfaceType declaration */
+#define HostNetworkInterfaceType_T PRUint32
+
+
+/* Start of enum AdditionsFacilityType declaration */
+#define ADDITIONSFACILITYTYPE_IID_STR "98f7f957-89fb-49b6-a3b1-31e3285eb1d8"
+#define ADDITIONSFACILITYTYPE_IID { \
+    0x98f7f957, 0x89fb, 0x49b6, \
+    { 0xa3, 0xb1, 0x31, 0xe3, 0x28, 0x5e, 0xb1, 0xd8 } \
+}
+typedef enum AdditionsFacilityType
+{
+    AdditionsFacilityType_None = 0,
+    AdditionsFacilityType_VBoxGuestDriver = 20,
+    AdditionsFacilityType_AutoLogon = 90,
+    AdditionsFacilityType_VBoxService = 100,
+    AdditionsFacilityType_VBoxTrayClient = 101,
+    AdditionsFacilityType_Seamless = 1000,
+    AdditionsFacilityType_Graphics = 1100,
+    AdditionsFacilityType_All = 2147483646
+} AdditionsFacilityType;
+/* End of enum AdditionsFacilityType declaration */
+#define AdditionsFacilityType_T PRUint32
+
+
+/* Start of enum AdditionsFacilityClass declaration */
+#define ADDITIONSFACILITYCLASS_IID_STR "446451b2-c88d-4e5d-84c9-91bc7f533f5f"
+#define ADDITIONSFACILITYCLASS_IID { \
+    0x446451b2, 0xc88d, 0x4e5d, \
+    { 0x84, 0xc9, 0x91, 0xbc, 0x7f, 0x53, 0x3f, 0x5f } \
+}
+typedef enum AdditionsFacilityClass
+{
+    AdditionsFacilityClass_None = 0,
+    AdditionsFacilityClass_Driver = 10,
+    AdditionsFacilityClass_Service = 30,
+    AdditionsFacilityClass_Program = 50,
+    AdditionsFacilityClass_Feature = 100,
+    AdditionsFacilityClass_ThirdParty = 999,
+    AdditionsFacilityClass_All = 2147483646
+} AdditionsFacilityClass;
+/* End of enum AdditionsFacilityClass declaration */
+#define AdditionsFacilityClass_T PRUint32
+
+
+/* Start of enum AdditionsFacilityStatus declaration */
+#define ADDITIONSFACILITYSTATUS_IID_STR "ce06f9e1-394e-4fe9-9368-5a88c567dbde"
+#define ADDITIONSFACILITYSTATUS_IID { \
+    0xce06f9e1, 0x394e, 0x4fe9, \
+    { 0x93, 0x68, 0x5a, 0x88, 0xc5, 0x67, 0xdb, 0xde } \
+}
+typedef enum AdditionsFacilityStatus
+{
+    AdditionsFacilityStatus_Inactive = 0,
+    AdditionsFacilityStatus_Paused = 1,
+    AdditionsFacilityStatus_PreInit = 20,
+    AdditionsFacilityStatus_Init = 30,
+    AdditionsFacilityStatus_Active = 50,
+    AdditionsFacilityStatus_Terminating = 100,
+    AdditionsFacilityStatus_Terminated = 101,
+    AdditionsFacilityStatus_Failed = 800,
+    AdditionsFacilityStatus_Unknown = 999
+} AdditionsFacilityStatus;
+/* End of enum AdditionsFacilityStatus declaration */
+#define AdditionsFacilityStatus_T PRUint32
+
+
+/* Start of enum AdditionsRunLevelType declaration */
+#define ADDITIONSRUNLEVELTYPE_IID_STR "a25417ee-a9dd-4f5b-b0dc-377860087754"
+#define ADDITIONSRUNLEVELTYPE_IID { \
+    0xa25417ee, 0xa9dd, 0x4f5b, \
+    { 0xb0, 0xdc, 0x37, 0x78, 0x60, 0x08, 0x77, 0x54 } \
+}
+typedef enum AdditionsRunLevelType
+{
+    AdditionsRunLevelType_None = 0,
+    AdditionsRunLevelType_System = 1,
+    AdditionsRunLevelType_Userland = 2,
+    AdditionsRunLevelType_Desktop = 3
+} AdditionsRunLevelType;
+/* End of enum AdditionsRunLevelType declaration */
+#define AdditionsRunLevelType_T PRUint32
+
+
+/* Start of enum AdditionsUpdateFlag declaration */
+#define ADDITIONSUPDATEFLAG_IID_STR "726a818d-18d6-4389-94e8-3e9e6826171a"
+#define ADDITIONSUPDATEFLAG_IID { \
+    0x726a818d, 0x18d6, 0x4389, \
+    { 0x94, 0xe8, 0x3e, 0x9e, 0x68, 0x26, 0x17, 0x1a } \
+}
+typedef enum AdditionsUpdateFlag
+{
+    AdditionsUpdateFlag_None = 0,
+    AdditionsUpdateFlag_WaitForUpdateStartOnly = 1
+} AdditionsUpdateFlag;
+/* End of enum AdditionsUpdateFlag declaration */
+#define AdditionsUpdateFlag_T PRUint32
+
+
+/* Start of enum GuestSessionStatus declaration */
+#define GUESTSESSIONSTATUS_IID_STR "ac2669da-4624-44f2-85b5-0b0bfb8d8673"
+#define GUESTSESSIONSTATUS_IID { \
+    0xac2669da, 0x4624, 0x44f2, \
+    { 0x85, 0xb5, 0x0b, 0x0b, 0xfb, 0x8d, 0x86, 0x73 } \
+}
+typedef enum GuestSessionStatus
+{
+    GuestSessionStatus_Undefined = 0,
+    GuestSessionStatus_Starting = 10,
+    GuestSessionStatus_Started = 100,
+    GuestSessionStatus_Terminating = 480,
+    GuestSessionStatus_Terminated = 500,
+    GuestSessionStatus_TimedOutKilled = 512,
+    GuestSessionStatus_TimedOutAbnormally = 513,
+    GuestSessionStatus_Down = 600,
+    GuestSessionStatus_Error = 800
+} GuestSessionStatus;
+/* End of enum GuestSessionStatus declaration */
+#define GuestSessionStatus_T PRUint32
+
+
+/* Start of enum GuestSessionWaitForFlag declaration */
+#define GUESTSESSIONWAITFORFLAG_IID_STR "bb7a372a-f635-4e11-a81a-e707f3a52ef5"
+#define GUESTSESSIONWAITFORFLAG_IID { \
+    0xbb7a372a, 0xf635, 0x4e11, \
+    { 0xa8, 0x1a, 0xe7, 0x07, 0xf3, 0xa5, 0x2e, 0xf5 } \
+}
+typedef enum GuestSessionWaitForFlag
+{
+    GuestSessionWaitForFlag_None = 0,
+    GuestSessionWaitForFlag_Start = 1,
+    GuestSessionWaitForFlag_Terminate = 2,
+    GuestSessionWaitForFlag_Status = 4
+} GuestSessionWaitForFlag;
+/* End of enum GuestSessionWaitForFlag declaration */
+#define GuestSessionWaitForFlag_T PRUint32
+
+
+/* Start of enum GuestSessionWaitResult declaration */
+#define GUESTSESSIONWAITRESULT_IID_STR "c0f6a8a5-fdb6-42bf-a582-56c6f82bcd2d"
+#define GUESTSESSIONWAITRESULT_IID { \
+    0xc0f6a8a5, 0xfdb6, 0x42bf, \
+    { 0xa5, 0x82, 0x56, 0xc6, 0xf8, 0x2b, 0xcd, 0x2d } \
+}
+typedef enum GuestSessionWaitResult
+{
+    GuestSessionWaitResult_None = 0,
+    GuestSessionWaitResult_Start = 1,
+    GuestSessionWaitResult_Terminate = 2,
+    GuestSessionWaitResult_Status = 3,
+    GuestSessionWaitResult_Error = 4,
+    GuestSessionWaitResult_Timeout = 5,
+    GuestSessionWaitResult_WaitFlagNotSupported = 6
+} GuestSessionWaitResult;
+/* End of enum GuestSessionWaitResult declaration */
+#define GuestSessionWaitResult_T PRUint32
+
+
+/* Start of enum GuestUserState declaration */
+#define GUESTUSERSTATE_IID_STR "b2a82b02-fd3d-4fc2-ba84-6ba5ac8be198"
+#define GUESTUSERSTATE_IID { \
+    0xb2a82b02, 0xfd3d, 0x4fc2, \
+    { 0xba, 0x84, 0x6b, 0xa5, 0xac, 0x8b, 0xe1, 0x98 } \
+}
+typedef enum GuestUserState
+{
+    GuestUserState_Unknown = 0,
+    GuestUserState_LoggedIn = 1,
+    GuestUserState_LoggedOut = 2,
+    GuestUserState_Locked = 3,
+    GuestUserState_Unlocked = 4,
+    GuestUserState_Disabled = 5,
+    GuestUserState_Idle = 6,
+    GuestUserState_InUse = 7,
+    GuestUserState_Created = 8,
+    GuestUserState_Deleted = 9,
+    GuestUserState_SessionChanged = 10,
+    GuestUserState_CredentialsChanged = 11,
+    GuestUserState_RoleChanged = 12,
+    GuestUserState_GroupAdded = 13,
+    GuestUserState_GroupRemoved = 14,
+    GuestUserState_Elevated = 15
+} GuestUserState;
+/* End of enum GuestUserState declaration */
+#define GuestUserState_T PRUint32
+
+
+/* Start of enum FileSeekType declaration */
+#define FILESEEKTYPE_IID_STR "1b73f4f3-3515-4073-a506-76878d9e2541"
+#define FILESEEKTYPE_IID { \
+    0x1b73f4f3, 0x3515, 0x4073, \
+    { 0xa5, 0x06, 0x76, 0x87, 0x8d, 0x9e, 0x25, 0x41 } \
+}
+typedef enum FileSeekType
+{
+    FileSeekType_Set = 0,
+    FileSeekType_Current = 1
+} FileSeekType;
+/* End of enum FileSeekType declaration */
+#define FileSeekType_T PRUint32
+
+
+/* Start of enum ProcessInputFlag declaration */
+#define PROCESSINPUTFLAG_IID_STR "5d38c1dd-2604-4ddf-92e5-0c0cdd3bdbd5"
+#define PROCESSINPUTFLAG_IID { \
+    0x5d38c1dd, 0x2604, 0x4ddf, \
+    { 0x92, 0xe5, 0x0c, 0x0c, 0xdd, 0x3b, 0xdb, 0xd5 } \
+}
+typedef enum ProcessInputFlag
+{
+    ProcessInputFlag_None = 0,
+    ProcessInputFlag_EndOfFile = 1
+} ProcessInputFlag;
+/* End of enum ProcessInputFlag declaration */
+#define ProcessInputFlag_T PRUint32
+
+
+/* Start of enum ProcessOutputFlag declaration */
+#define PROCESSOUTPUTFLAG_IID_STR "9979e85a-52bb-40b7-870c-57115e27e0f1"
+#define PROCESSOUTPUTFLAG_IID { \
+    0x9979e85a, 0x52bb, 0x40b7, \
+    { 0x87, 0x0c, 0x57, 0x11, 0x5e, 0x27, 0xe0, 0xf1 } \
+}
+typedef enum ProcessOutputFlag
+{
+    ProcessOutputFlag_None = 0,
+    ProcessOutputFlag_StdErr = 1
+} ProcessOutputFlag;
+/* End of enum ProcessOutputFlag declaration */
+#define ProcessOutputFlag_T PRUint32
+
+
+/* Start of enum ProcessWaitForFlag declaration */
+#define PROCESSWAITFORFLAG_IID_STR "23b550c7-78e1-437e-98f0-65fd9757bcd2"
+#define PROCESSWAITFORFLAG_IID { \
+    0x23b550c7, 0x78e1, 0x437e, \
+    { 0x98, 0xf0, 0x65, 0xfd, 0x97, 0x57, 0xbc, 0xd2 } \
+}
+typedef enum ProcessWaitForFlag
+{
+    ProcessWaitForFlag_None = 0,
+    ProcessWaitForFlag_Start = 1,
+    ProcessWaitForFlag_Terminate = 2,
+    ProcessWaitForFlag_StdIn = 4,
+    ProcessWaitForFlag_StdOut = 8,
+    ProcessWaitForFlag_StdErr = 16
+} ProcessWaitForFlag;
+/* End of enum ProcessWaitForFlag declaration */
+#define ProcessWaitForFlag_T PRUint32
+
+
+/* Start of enum ProcessWaitResult declaration */
+#define PROCESSWAITRESULT_IID_STR "40719cbe-f192-4fe9-a231-6697b3c8e2b4"
+#define PROCESSWAITRESULT_IID { \
+    0x40719cbe, 0xf192, 0x4fe9, \
+    { 0xa2, 0x31, 0x66, 0x97, 0xb3, 0xc8, 0xe2, 0xb4 } \
+}
+typedef enum ProcessWaitResult
+{
+    ProcessWaitResult_None = 0,
+    ProcessWaitResult_Start = 1,
+    ProcessWaitResult_Terminate = 2,
+    ProcessWaitResult_Status = 3,
+    ProcessWaitResult_Error = 4,
+    ProcessWaitResult_Timeout = 5,
+    ProcessWaitResult_StdIn = 6,
+    ProcessWaitResult_StdOut = 7,
+    ProcessWaitResult_StdErr = 8,
+    ProcessWaitResult_WaitFlagNotSupported = 9
+} ProcessWaitResult;
+/* End of enum ProcessWaitResult declaration */
+#define ProcessWaitResult_T PRUint32
+
+
+/* Start of enum CopyFileFlag declaration */
+#define COPYFILEFLAG_IID_STR "23f79fdf-738a-493d-b80b-42d607c9b916"
+#define COPYFILEFLAG_IID { \
+    0x23f79fdf, 0x738a, 0x493d, \
+    { 0xb8, 0x0b, 0x42, 0xd6, 0x07, 0xc9, 0xb9, 0x16 } \
+}
+typedef enum CopyFileFlag
+{
+    CopyFileFlag_None = 0,
+    CopyFileFlag_Recursive = 1,
+    CopyFileFlag_Update = 2,
+    CopyFileFlag_FollowLinks = 4
+} CopyFileFlag;
+/* End of enum CopyFileFlag declaration */
+#define CopyFileFlag_T PRUint32
+
+
+/* Start of enum DirectoryCreateFlag declaration */
+#define DIRECTORYCREATEFLAG_IID_STR "bd721b0e-ced5-4f79-b368-249897c32a36"
+#define DIRECTORYCREATEFLAG_IID { \
+    0xbd721b0e, 0xced5, 0x4f79, \
+    { 0xb3, 0x68, 0x24, 0x98, 0x97, 0xc3, 0x2a, 0x36 } \
+}
+typedef enum DirectoryCreateFlag
+{
+    DirectoryCreateFlag_None = 0,
+    DirectoryCreateFlag_Parents = 1
+} DirectoryCreateFlag;
+/* End of enum DirectoryCreateFlag declaration */
+#define DirectoryCreateFlag_T PRUint32
+
+
+/* Start of enum DirectoryRemoveRecFlag declaration */
+#define DIRECTORYREMOVERECFLAG_IID_STR "455aabf0-7692-48f6-9061-f21579b65769"
+#define DIRECTORYREMOVERECFLAG_IID { \
+    0x455aabf0, 0x7692, 0x48f6, \
+    { 0x90, 0x61, 0xf2, 0x15, 0x79, 0xb6, 0x57, 0x69 } \
+}
+typedef enum DirectoryRemoveRecFlag
+{
+    DirectoryRemoveRecFlag_None = 0,
+    DirectoryRemoveRecFlag_ContentAndDir = 1,
+    DirectoryRemoveRecFlag_ContentOnly = 2
+} DirectoryRemoveRecFlag;
+/* End of enum DirectoryRemoveRecFlag declaration */
+#define DirectoryRemoveRecFlag_T PRUint32
+
+
+/* Start of enum PathRenameFlag declaration */
+#define PATHRENAMEFLAG_IID_STR "f3baa09f-c758-453d-b91c-c7787d76351d"
+#define PATHRENAMEFLAG_IID { \
+    0xf3baa09f, 0xc758, 0x453d, \
+    { 0xb9, 0x1c, 0xc7, 0x78, 0x7d, 0x76, 0x35, 0x1d } \
+}
+typedef enum PathRenameFlag
+{
+    PathRenameFlag_None = 0,
+    PathRenameFlag_NoReplace = 1,
+    PathRenameFlag_Replace = 2,
+    PathRenameFlag_NoSymlinks = 4
+} PathRenameFlag;
+/* End of enum PathRenameFlag declaration */
+#define PathRenameFlag_T PRUint32
+
+
+/* Start of enum ProcessCreateFlag declaration */
+#define PROCESSCREATEFLAG_IID_STR "35192799-bfde-405d-9bea-c735ab9998e4"
+#define PROCESSCREATEFLAG_IID { \
+    0x35192799, 0xbfde, 0x405d, \
+    { 0x9b, 0xea, 0xc7, 0x35, 0xab, 0x99, 0x98, 0xe4 } \
+}
+typedef enum ProcessCreateFlag
+{
+    ProcessCreateFlag_None = 0,
+    ProcessCreateFlag_WaitForProcessStartOnly = 1,
+    ProcessCreateFlag_IgnoreOrphanedProcesses = 2,
+    ProcessCreateFlag_Hidden = 4,
+    ProcessCreateFlag_NoProfile = 8,
+    ProcessCreateFlag_WaitForStdOut = 16,
+    ProcessCreateFlag_WaitForStdErr = 32,
+    ProcessCreateFlag_ExpandArguments = 64
+} ProcessCreateFlag;
+/* End of enum ProcessCreateFlag declaration */
+#define ProcessCreateFlag_T PRUint32
+
+
+/* Start of enum ProcessPriority declaration */
+#define PROCESSPRIORITY_IID_STR "ee8cac50-e232-49fe-806b-d1214d9c2e49"
+#define PROCESSPRIORITY_IID { \
+    0xee8cac50, 0xe232, 0x49fe, \
+    { 0x80, 0x6b, 0xd1, 0x21, 0x4d, 0x9c, 0x2e, 0x49 } \
+}
+typedef enum ProcessPriority
+{
+    ProcessPriority_Invalid = 0,
+    ProcessPriority_Default = 1
+} ProcessPriority;
+/* End of enum ProcessPriority declaration */
+#define ProcessPriority_T PRUint32
+
+
+/* Start of enum SymlinkType declaration */
+#define SYMLINKTYPE_IID_STR "37794668-f8f1-4714-98a5-6f8fa2ed0118"
+#define SYMLINKTYPE_IID { \
+    0x37794668, 0xf8f1, 0x4714, \
+    { 0x98, 0xa5, 0x6f, 0x8f, 0xa2, 0xed, 0x01, 0x18 } \
+}
+typedef enum SymlinkType
+{
+    SymlinkType_Unknown = 0,
+    SymlinkType_Directory = 1,
+    SymlinkType_File = 2
+} SymlinkType;
+/* End of enum SymlinkType declaration */
+#define SymlinkType_T PRUint32
+
+
+/* Start of enum SymlinkReadFlag declaration */
+#define SYMLINKREADFLAG_IID_STR "b7fe2b9d-790e-4b25-8adf-1ca33026931f"
+#define SYMLINKREADFLAG_IID { \
+    0xb7fe2b9d, 0x790e, 0x4b25, \
+    { 0x8a, 0xdf, 0x1c, 0xa3, 0x30, 0x26, 0x93, 0x1f } \
+}
+typedef enum SymlinkReadFlag
+{
+    SymlinkReadFlag_None = 0,
+    SymlinkReadFlag_NoSymlinks = 1
+} SymlinkReadFlag;
+/* End of enum SymlinkReadFlag declaration */
+#define SymlinkReadFlag_T PRUint32
+
+
+/* Start of enum ProcessStatus declaration */
+#define PROCESSSTATUS_IID_STR "4d52368f-5b48-4bfe-b486-acf89139b52f"
+#define PROCESSSTATUS_IID { \
+    0x4d52368f, 0x5b48, 0x4bfe, \
+    { 0xb4, 0x86, 0xac, 0xf8, 0x91, 0x39, 0xb5, 0x2f } \
+}
+typedef enum ProcessStatus
+{
+    ProcessStatus_Undefined = 0,
+    ProcessStatus_Starting = 10,
+    ProcessStatus_Started = 100,
+    ProcessStatus_Paused = 110,
+    ProcessStatus_Terminating = 480,
+    ProcessStatus_TerminatedNormally = 500,
+    ProcessStatus_TerminatedSignal = 510,
+    ProcessStatus_TerminatedAbnormally = 511,
+    ProcessStatus_TimedOutKilled = 512,
+    ProcessStatus_TimedOutAbnormally = 513,
+    ProcessStatus_Down = 600,
+    ProcessStatus_Error = 800
+} ProcessStatus;
+/* End of enum ProcessStatus declaration */
+#define ProcessStatus_T PRUint32
+
+
+/* Start of enum ProcessInputStatus declaration */
+#define PROCESSINPUTSTATUS_IID_STR "a4a0ef9c-29cc-4805-9803-c8215ae9da6c"
+#define PROCESSINPUTSTATUS_IID { \
+    0xa4a0ef9c, 0x29cc, 0x4805, \
+    { 0x98, 0x03, 0xc8, 0x21, 0x5a, 0xe9, 0xda, 0x6c } \
+}
+typedef enum ProcessInputStatus
+{
+    ProcessInputStatus_Undefined = 0,
+    ProcessInputStatus_Broken = 1,
+    ProcessInputStatus_Available = 10,
+    ProcessInputStatus_Written = 50,
+    ProcessInputStatus_Overflow = 100
+} ProcessInputStatus;
+/* End of enum ProcessInputStatus declaration */
+#define ProcessInputStatus_T PRUint32
+
+
+/* Start of enum FileStatus declaration */
+#define FILESTATUS_IID_STR "8c86468b-b97b-4080-8914-e29f5b0abd2c"
+#define FILESTATUS_IID { \
+    0x8c86468b, 0xb97b, 0x4080, \
+    { 0x89, 0x14, 0xe2, 0x9f, 0x5b, 0x0a, 0xbd, 0x2c } \
+}
+typedef enum FileStatus
+{
+    FileStatus_Undefined = 0,
+    FileStatus_Opening = 10,
+    FileStatus_Open = 100,
+    FileStatus_Closing = 150,
+    FileStatus_Closed = 200,
+    FileStatus_Down = 600,
+    FileStatus_Error = 800
+} FileStatus;
+/* End of enum FileStatus declaration */
+#define FileStatus_T PRUint32
+
+
+/* Start of enum FsObjType declaration */
+#define FSOBJTYPE_IID_STR "a1ed437c-b3c3-4ca2-b19c-4239d658d5e8"
+#define FSOBJTYPE_IID { \
+    0xa1ed437c, 0xb3c3, 0x4ca2, \
+    { 0xb1, 0x9c, 0x42, 0x39, 0xd6, 0x58, 0xd5, 0xe8 } \
+}
+typedef enum FsObjType
+{
+    FsObjType_Undefined = 0,
+    FsObjType_FIFO = 1,
+    FsObjType_DevChar = 10,
+    FsObjType_DevBlock = 11,
+    FsObjType_Directory = 50,
+    FsObjType_File = 80,
+    FsObjType_Symlink = 100,
+    FsObjType_Socket = 200,
+    FsObjType_Whiteout = 400
+} FsObjType;
+/* End of enum FsObjType declaration */
+#define FsObjType_T PRUint32
+
+
+/* Start of enum DragAndDropAction declaration */
+#define DRAGANDDROPACTION_IID_STR "47f3b162-c107-4fcd-bfa7-54b8135c441e"
+#define DRAGANDDROPACTION_IID { \
+    0x47f3b162, 0xc107, 0x4fcd, \
+    { 0xbf, 0xa7, 0x54, 0xb8, 0x13, 0x5c, 0x44, 0x1e } \
+}
+typedef enum DragAndDropAction
+{
+    DragAndDropAction_Ignore = 0,
+    DragAndDropAction_Copy = 1,
+    DragAndDropAction_Move = 2,
+    DragAndDropAction_Link = 3
+} DragAndDropAction;
+/* End of enum DragAndDropAction declaration */
+#define DragAndDropAction_T PRUint32
+
+
+/* Start of enum DirectoryOpenFlag declaration */
+#define DIRECTORYOPENFLAG_IID_STR "5138837a-8fd2-4194-a1b0-08f7bc3949d0"
+#define DIRECTORYOPENFLAG_IID { \
+    0x5138837a, 0x8fd2, 0x4194, \
+    { 0xa1, 0xb0, 0x08, 0xf7, 0xbc, 0x39, 0x49, 0xd0 } \
+}
+typedef enum DirectoryOpenFlag
+{
+    DirectoryOpenFlag_None = 0,
+    DirectoryOpenFlag_NoSymlinks = 1
+} DirectoryOpenFlag;
+/* End of enum DirectoryOpenFlag declaration */
+#define DirectoryOpenFlag_T PRUint32
+
+
+/* Start of enum MediumState declaration */
+#define MEDIUMSTATE_IID_STR "ef41e980-e012-43cd-9dea-479d4ef14d13"
+#define MEDIUMSTATE_IID { \
+    0xef41e980, 0xe012, 0x43cd, \
+    { 0x9d, 0xea, 0x47, 0x9d, 0x4e, 0xf1, 0x4d, 0x13 } \
+}
+typedef enum MediumState
+{
+    MediumState_NotCreated = 0,
+    MediumState_Created = 1,
+    MediumState_LockedRead = 2,
+    MediumState_LockedWrite = 3,
+    MediumState_Inaccessible = 4,
+    MediumState_Creating = 5,
+    MediumState_Deleting = 6
+} MediumState;
+/* End of enum MediumState declaration */
+#define MediumState_T PRUint32
+
+
+/* Start of enum MediumType declaration */
+#define MEDIUMTYPE_IID_STR "fe663fb5-c244-4e1b-9d81-c628b417dd04"
+#define MEDIUMTYPE_IID { \
+    0xfe663fb5, 0xc244, 0x4e1b, \
+    { 0x9d, 0x81, 0xc6, 0x28, 0xb4, 0x17, 0xdd, 0x04 } \
+}
+typedef enum MediumType
+{
+    MediumType_Normal = 0,
+    MediumType_Immutable = 1,
+    MediumType_Writethrough = 2,
+    MediumType_Shareable = 3,
+    MediumType_Readonly = 4,
+    MediumType_MultiAttach = 5
+} MediumType;
+/* End of enum MediumType declaration */
+#define MediumType_T PRUint32
+
+
+/* Start of enum MediumVariant declaration */
+#define MEDIUMVARIANT_IID_STR "80685b6b-e42f-497d-8271-e77bf3c61ada"
+#define MEDIUMVARIANT_IID { \
+    0x80685b6b, 0xe42f, 0x497d, \
+    { 0x82, 0x71, 0xe7, 0x7b, 0xf3, 0xc6, 0x1a, 0xda } \
+}
+typedef enum MediumVariant
+{
+    MediumVariant_Standard = 0,
+    MediumVariant_VmdkSplit2G = 0x01,
+    MediumVariant_VmdkRawDisk = 0x02,
+    MediumVariant_VmdkStreamOptimized = 0x04,
+    MediumVariant_VmdkESX = 0x08,
+    MediumVariant_Fixed = 0x10000,
+    MediumVariant_Diff = 0x20000,
+    MediumVariant_NoCreateDir = 0x40000000
+} MediumVariant;
+/* End of enum MediumVariant declaration */
+#define MediumVariant_T PRUint32
+
+
+/* Start of enum DataType declaration */
+#define DATATYPE_IID_STR "d90ea51e-a3f1-4a01-beb1-c1723c0d3ba7"
+#define DATATYPE_IID { \
+    0xd90ea51e, 0xa3f1, 0x4a01, \
+    { 0xbe, 0xb1, 0xc1, 0x72, 0x3c, 0x0d, 0x3b, 0xa7 } \
+}
+typedef enum DataType
+{
+    DataType_Int32 = 0,
+    DataType_Int8 = 1,
+    DataType_String = 2
+} DataType;
+/* End of enum DataType declaration */
+#define DataType_T PRUint32
+
+
+/* Start of enum DataFlags declaration */
+#define DATAFLAGS_IID_STR "86884dcf-1d6b-4f1b-b4bf-f5aa44959d60"
+#define DATAFLAGS_IID { \
+    0x86884dcf, 0x1d6b, 0x4f1b, \
+    { 0xb4, 0xbf, 0xf5, 0xaa, 0x44, 0x95, 0x9d, 0x60 } \
+}
+typedef enum DataFlags
+{
+    DataFlags_None = 0x00,
+    DataFlags_Mandatory = 0x01,
+    DataFlags_Expert = 0x02,
+    DataFlags_Array = 0x04,
+    DataFlags_FlagMask = 0x07
+} DataFlags;
+/* End of enum DataFlags declaration */
+#define DataFlags_T PRUint32
+
+
+/* Start of enum MediumFormatCapabilities declaration */
+#define MEDIUMFORMATCAPABILITIES_IID_STR "7342ba79-7ce0-4d94-8f86-5ed5a185d9bd"
+#define MEDIUMFORMATCAPABILITIES_IID { \
+    0x7342ba79, 0x7ce0, 0x4d94, \
+    { 0x8f, 0x86, 0x5e, 0xd5, 0xa1, 0x85, 0xd9, 0xbd } \
+}
+typedef enum MediumFormatCapabilities
+{
+    MediumFormatCapabilities_Uuid = 0x01,
+    MediumFormatCapabilities_CreateFixed = 0x02,
+    MediumFormatCapabilities_CreateDynamic = 0x04,
+    MediumFormatCapabilities_CreateSplit2G = 0x08,
+    MediumFormatCapabilities_Differencing = 0x10,
+    MediumFormatCapabilities_Asynchronous = 0x20,
+    MediumFormatCapabilities_File = 0x40,
+    MediumFormatCapabilities_Properties = 0x80,
+    MediumFormatCapabilities_TcpNetworking = 0x100,
+    MediumFormatCapabilities_VFS = 0x200,
+    MediumFormatCapabilities_CapabilityMask = 0x3FF
+} MediumFormatCapabilities;
+/* End of enum MediumFormatCapabilities declaration */
+#define MediumFormatCapabilities_T PRUint32
+
+
+/* Start of enum MouseButtonState declaration */
+#define MOUSEBUTTONSTATE_IID_STR "9ee094b8-b28a-4d56-a166-973cb588d7f8"
+#define MOUSEBUTTONSTATE_IID { \
+    0x9ee094b8, 0xb28a, 0x4d56, \
+    { 0xa1, 0x66, 0x97, 0x3c, 0xb5, 0x88, 0xd7, 0xf8 } \
+}
+typedef enum MouseButtonState
+{
+    MouseButtonState_LeftButton = 0x01,
+    MouseButtonState_RightButton = 0x02,
+    MouseButtonState_MiddleButton = 0x04,
+    MouseButtonState_WheelUp = 0x08,
+    MouseButtonState_WheelDown = 0x10,
+    MouseButtonState_XButton1 = 0x20,
+    MouseButtonState_XButton2 = 0x40,
+    MouseButtonState_MouseStateMask = 0x7F
+} MouseButtonState;
+/* End of enum MouseButtonState declaration */
+#define MouseButtonState_T PRUint32
+
+
+/* Start of enum TouchContactState declaration */
+#define TOUCHCONTACTSTATE_IID_STR "3f942686-2506-421c-927c-90d4b45f4a38"
+#define TOUCHCONTACTSTATE_IID { \
+    0x3f942686, 0x2506, 0x421c, \
+    { 0x92, 0x7c, 0x90, 0xd4, 0xb4, 0x5f, 0x4a, 0x38 } \
+}
+typedef enum TouchContactState
+{
+    TouchContactState_None = 0x00,
+    TouchContactState_InContact = 0x01,
+    TouchContactState_InRange = 0x02,
+    TouchContactState_ContactStateMask = 0x03
+} TouchContactState;
+/* End of enum TouchContactState declaration */
+#define TouchContactState_T PRUint32
+
+
+/* Start of enum FramebufferPixelFormat declaration */
+#define FRAMEBUFFERPIXELFORMAT_IID_STR "7acfd5ed-29e3-45e3-8136-73c9224f3d2d"
+#define FRAMEBUFFERPIXELFORMAT_IID { \
+    0x7acfd5ed, 0x29e3, 0x45e3, \
+    { 0x81, 0x36, 0x73, 0xc9, 0x22, 0x4f, 0x3d, 0x2d } \
+}
+typedef enum FramebufferPixelFormat
+{
+    FramebufferPixelFormat_Opaque = 0,
+    FramebufferPixelFormat_FOURCC_RGB = 0x32424752
+} FramebufferPixelFormat;
+/* End of enum FramebufferPixelFormat declaration */
+#define FramebufferPixelFormat_T PRUint32
+
+
+/* Start of enum NetworkAttachmentType declaration */
+#define NETWORKATTACHMENTTYPE_IID_STR "524a8f9d-4b86-4b51-877d-1aa27c4ebeac"
+#define NETWORKATTACHMENTTYPE_IID { \
+    0x524a8f9d, 0x4b86, 0x4b51, \
+    { 0x87, 0x7d, 0x1a, 0xa2, 0x7c, 0x4e, 0xbe, 0xac } \
+}
+typedef enum NetworkAttachmentType
+{
+    NetworkAttachmentType_Null = 0,
+    NetworkAttachmentType_NAT = 1,
+    NetworkAttachmentType_Bridged = 2,
+    NetworkAttachmentType_Internal = 3,
+    NetworkAttachmentType_HostOnly = 4,
+    NetworkAttachmentType_Generic = 5,
+    NetworkAttachmentType_NATNetwork = 6
+} NetworkAttachmentType;
+/* End of enum NetworkAttachmentType declaration */
+#define NetworkAttachmentType_T PRUint32
+
+
+/* Start of enum NetworkAdapterType declaration */
+#define NETWORKADAPTERTYPE_IID_STR "3c2281e4-d952-4e87-8c7d-24379cb6a81c"
+#define NETWORKADAPTERTYPE_IID { \
+    0x3c2281e4, 0xd952, 0x4e87, \
+    { 0x8c, 0x7d, 0x24, 0x37, 0x9c, 0xb6, 0xa8, 0x1c } \
+}
+typedef enum NetworkAdapterType
+{
+    NetworkAdapterType_Null = 0,
+    NetworkAdapterType_Am79C970A = 1,
+    NetworkAdapterType_Am79C973 = 2,
+    NetworkAdapterType_I82540EM = 3,
+    NetworkAdapterType_I82543GC = 4,
+    NetworkAdapterType_I82545EM = 5,
+    NetworkAdapterType_Virtio = 6
+} NetworkAdapterType;
+/* End of enum NetworkAdapterType declaration */
+#define NetworkAdapterType_T PRUint32
+
+
+/* Start of enum NetworkAdapterPromiscModePolicy declaration */
+#define NETWORKADAPTERPROMISCMODEPOLICY_IID_STR "c963768a-376f-4c85-8d84-d8ced4b7269e"
+#define NETWORKADAPTERPROMISCMODEPOLICY_IID { \
+    0xc963768a, 0x376f, 0x4c85, \
+    { 0x8d, 0x84, 0xd8, 0xce, 0xd4, 0xb7, 0x26, 0x9e } \
+}
+typedef enum NetworkAdapterPromiscModePolicy
+{
+    NetworkAdapterPromiscModePolicy_Deny = 1,
+    NetworkAdapterPromiscModePolicy_AllowNetwork = 2,
+    NetworkAdapterPromiscModePolicy_AllowAll = 3
+} NetworkAdapterPromiscModePolicy;
+/* End of enum NetworkAdapterPromiscModePolicy declaration */
+#define NetworkAdapterPromiscModePolicy_T PRUint32
+
+
+/* Start of enum PortMode declaration */
+#define PORTMODE_IID_STR "533b5fe3-0185-4197-86a7-17e37dd39d76"
+#define PORTMODE_IID { \
+    0x533b5fe3, 0x0185, 0x4197, \
+    { 0x86, 0xa7, 0x17, 0xe3, 0x7d, 0xd3, 0x9d, 0x76 } \
+}
+typedef enum PortMode
+{
+    PortMode_Disconnected = 0,
+    PortMode_HostPipe = 1,
+    PortMode_HostDevice = 2,
+    PortMode_RawFile = 3
+} PortMode;
+/* End of enum PortMode declaration */
+#define PortMode_T PRUint32
+
+
+/* Start of enum USBControllerType declaration */
+#define USBCONTROLLERTYPE_IID_STR "8fdd1c6a-5412-41da-ab07-7baed7d6e18e"
+#define USBCONTROLLERTYPE_IID { \
+    0x8fdd1c6a, 0x5412, 0x41da, \
+    { 0xab, 0x07, 0x7b, 0xae, 0xd7, 0xd6, 0xe1, 0x8e } \
+}
+typedef enum USBControllerType
+{
+    USBControllerType_Null = 0,
+    USBControllerType_OHCI = 1,
+    USBControllerType_EHCI = 2,
+    USBControllerType_Last = 3
+} USBControllerType;
+/* End of enum USBControllerType declaration */
+#define USBControllerType_T PRUint32
+
+
+/* Start of enum USBDeviceState declaration */
+#define USBDEVICESTATE_IID_STR "b99a2e65-67fb-4882-82fd-f3e5e8193ab4"
+#define USBDEVICESTATE_IID { \
+    0xb99a2e65, 0x67fb, 0x4882, \
+    { 0x82, 0xfd, 0xf3, 0xe5, 0xe8, 0x19, 0x3a, 0xb4 } \
+}
+typedef enum USBDeviceState
+{
+    USBDeviceState_NotSupported = 0,
+    USBDeviceState_Unavailable = 1,
+    USBDeviceState_Busy = 2,
+    USBDeviceState_Available = 3,
+    USBDeviceState_Held = 4,
+    USBDeviceState_Captured = 5
+} USBDeviceState;
+/* End of enum USBDeviceState declaration */
+#define USBDeviceState_T PRUint32
+
+
+/* Start of enum USBDeviceFilterAction declaration */
+#define USBDEVICEFILTERACTION_IID_STR "cbc30a49-2f4e-43b5-9da6-121320475933"
+#define USBDEVICEFILTERACTION_IID { \
+    0xcbc30a49, 0x2f4e, 0x43b5, \
+    { 0x9d, 0xa6, 0x12, 0x13, 0x20, 0x47, 0x59, 0x33 } \
+}
+typedef enum USBDeviceFilterAction
+{
+    USBDeviceFilterAction_Null = 0,
+    USBDeviceFilterAction_Ignore = 1,
+    USBDeviceFilterAction_Hold = 2
+} USBDeviceFilterAction;
+/* End of enum USBDeviceFilterAction declaration */
+#define USBDeviceFilterAction_T PRUint32
+
+
+/* Start of enum AudioDriverType declaration */
+#define AUDIODRIVERTYPE_IID_STR "4bcc3d73-c2fe-40db-b72f-0c2ca9d68496"
+#define AUDIODRIVERTYPE_IID { \
+    0x4bcc3d73, 0xc2fe, 0x40db, \
+    { 0xb7, 0x2f, 0x0c, 0x2c, 0xa9, 0xd6, 0x84, 0x96 } \
+}
+typedef enum AudioDriverType
+{
+    AudioDriverType_Null = 0,
+    AudioDriverType_WinMM = 1,
+    AudioDriverType_OSS = 2,
+    AudioDriverType_ALSA = 3,
+    AudioDriverType_DirectSound = 4,
+    AudioDriverType_CoreAudio = 5,
+    AudioDriverType_MMPM = 6,
+    AudioDriverType_Pulse = 7,
+    AudioDriverType_SolAudio = 8
+} AudioDriverType;
+/* End of enum AudioDriverType declaration */
+#define AudioDriverType_T PRUint32
+
+
+/* Start of enum AudioControllerType declaration */
+#define AUDIOCONTROLLERTYPE_IID_STR "7afd395c-42c3-444e-8788-3ce80292f36c"
+#define AUDIOCONTROLLERTYPE_IID { \
+    0x7afd395c, 0x42c3, 0x444e, \
+    { 0x87, 0x88, 0x3c, 0xe8, 0x02, 0x92, 0xf3, 0x6c } \
+}
+typedef enum AudioControllerType
+{
+    AudioControllerType_AC97 = 0,
+    AudioControllerType_SB16 = 1,
+    AudioControllerType_HDA = 2
+} AudioControllerType;
+/* End of enum AudioControllerType declaration */
+#define AudioControllerType_T PRUint32
+
+
+/* Start of enum AuthType declaration */
+#define AUTHTYPE_IID_STR "7eef6ef6-98c2-4dc2-ab35-10d2b292028d"
+#define AUTHTYPE_IID { \
+    0x7eef6ef6, 0x98c2, 0x4dc2, \
+    { 0xab, 0x35, 0x10, 0xd2, 0xb2, 0x92, 0x02, 0x8d } \
+}
+typedef enum AuthType
+{
+    AuthType_Null = 0,
+    AuthType_External = 1,
+    AuthType_Guest = 2
+} AuthType;
+/* End of enum AuthType declaration */
+#define AuthType_T PRUint32
+
+
+/* Start of enum Reason declaration */
+#define REASON_IID_STR "e7e8e097-299d-4e98-8bbc-c31c2d47d0cc"
+#define REASON_IID { \
+    0xe7e8e097, 0x299d, 0x4e98, \
+    { 0x8b, 0xbc, 0xc3, 0x1c, 0x2d, 0x47, 0xd0, 0xcc } \
+}
+typedef enum Reason
+{
+    Reason_Unspecified = 0,
+    Reason_HostSuspend = 1,
+    Reason_HostResume = 2,
+    Reason_HostBatteryLow = 3
+} Reason;
+/* End of enum Reason declaration */
+#define Reason_T PRUint32
+
+
+/* Start of enum StorageBus declaration */
+#define STORAGEBUS_IID_STR "eee67ab3-668d-4ef5-91e0-7025fe4a0d7a"
+#define STORAGEBUS_IID { \
+    0xeee67ab3, 0x668d, 0x4ef5, \
+    { 0x91, 0xe0, 0x70, 0x25, 0xfe, 0x4a, 0x0d, 0x7a } \
+}
+typedef enum StorageBus
+{
+    StorageBus_Null = 0,
+    StorageBus_IDE = 1,
+    StorageBus_SATA = 2,
+    StorageBus_SCSI = 3,
+    StorageBus_Floppy = 4,
+    StorageBus_SAS = 5
+} StorageBus;
+/* End of enum StorageBus declaration */
+#define StorageBus_T PRUint32
+
+
+/* Start of enum StorageControllerType declaration */
+#define STORAGECONTROLLERTYPE_IID_STR "8a412b8a-f43e-4456-bd37-b474f0879a58"
+#define STORAGECONTROLLERTYPE_IID { \
+    0x8a412b8a, 0xf43e, 0x4456, \
+    { 0xbd, 0x37, 0xb4, 0x74, 0xf0, 0x87, 0x9a, 0x58 } \
+}
+typedef enum StorageControllerType
+{
+    StorageControllerType_Null = 0,
+    StorageControllerType_LsiLogic = 1,
+    StorageControllerType_BusLogic = 2,
+    StorageControllerType_IntelAhci = 3,
+    StorageControllerType_PIIX3 = 4,
+    StorageControllerType_PIIX4 = 5,
+    StorageControllerType_ICH6 = 6,
+    StorageControllerType_I82078 = 7,
+    StorageControllerType_LsiLogicSas = 8
+} StorageControllerType;
+/* End of enum StorageControllerType declaration */
+#define StorageControllerType_T PRUint32
+
+
+/* Start of enum ChipsetType declaration */
+#define CHIPSETTYPE_IID_STR "8b4096a8-a7c3-4d3b-bbb1-05a0a51ec394"
+#define CHIPSETTYPE_IID { \
+    0x8b4096a8, 0xa7c3, 0x4d3b, \
+    { 0xbb, 0xb1, 0x05, 0xa0, 0xa5, 0x1e, 0xc3, 0x94 } \
+}
+typedef enum ChipsetType
+{
+    ChipsetType_Null = 0,
+    ChipsetType_PIIX3 = 1,
+    ChipsetType_ICH9 = 2
+} ChipsetType;
+/* End of enum ChipsetType declaration */
+#define ChipsetType_T PRUint32
+
+
+/* Start of enum NATAliasMode declaration */
+#define NATALIASMODE_IID_STR "67772168-50d9-11df-9669-7fb714ee4fa1"
+#define NATALIASMODE_IID { \
+    0x67772168, 0x50d9, 0x11df, \
+    { 0x96, 0x69, 0x7f, 0xb7, 0x14, 0xee, 0x4f, 0xa1 } \
+}
+typedef enum NATAliasMode
+{
+    NATAliasMode_AliasLog = 0x1,
+    NATAliasMode_AliasProxyOnly = 0x02,
+    NATAliasMode_AliasUseSamePorts = 0x04
+} NATAliasMode;
+/* End of enum NATAliasMode declaration */
+#define NATAliasMode_T PRUint32
+
+
+/* Start of enum NATProtocol declaration */
+#define NATPROTOCOL_IID_STR "e90164be-eb03-11de-94af-fff9b1c1b19f"
+#define NATPROTOCOL_IID { \
+    0xe90164be, 0xeb03, 0x11de, \
+    { 0x94, 0xaf, 0xff, 0xf9, 0xb1, 0xc1, 0xb1, 0x9f } \
+}
+typedef enum NATProtocol
+{
+    NATProtocol_UDP = 0,
+    NATProtocol_TCP = 1
+} NATProtocol;
+/* End of enum NATProtocol declaration */
+#define NATProtocol_T PRUint32
+
+
+/* Start of enum BandwidthGroupType declaration */
+#define BANDWIDTHGROUPTYPE_IID_STR "1d92b67d-dc69-4be9-ad4c-93a01e1e0c8e"
+#define BANDWIDTHGROUPTYPE_IID { \
+    0x1d92b67d, 0xdc69, 0x4be9, \
+    { 0xad, 0x4c, 0x93, 0xa0, 0x1e, 0x1e, 0x0c, 0x8e } \
+}
+typedef enum BandwidthGroupType
+{
+    BandwidthGroupType_Null = 0,
+    BandwidthGroupType_Disk = 1,
+    BandwidthGroupType_Network = 2
+} BandwidthGroupType;
+/* End of enum BandwidthGroupType declaration */
+#define BandwidthGroupType_T PRUint32
+
+
+/* Start of enum VBoxEventType declaration */
+#define VBOXEVENTTYPE_IID_STR "5248e377-e578-47d7-b07b-84b1db6db8a8"
+#define VBOXEVENTTYPE_IID { \
+    0x5248e377, 0xe578, 0x47d7, \
+    { 0xb0, 0x7b, 0x84, 0xb1, 0xdb, 0x6d, 0xb8, 0xa8 } \
+}
+typedef enum VBoxEventType
+{
+    VBoxEventType_Invalid = 0,
+    VBoxEventType_Any = 1,
+    VBoxEventType_Vetoable = 2,
+    VBoxEventType_MachineEvent = 3,
+    VBoxEventType_SnapshotEvent = 4,
+    VBoxEventType_InputEvent = 5,
+    VBoxEventType_LastWildcard = 31,
+    VBoxEventType_OnMachineStateChanged = 32,
+    VBoxEventType_OnMachineDataChanged = 33,
+    VBoxEventType_OnExtraDataChanged = 34,
+    VBoxEventType_OnExtraDataCanChange = 35,
+    VBoxEventType_OnMediumRegistered = 36,
+    VBoxEventType_OnMachineRegistered = 37,
+    VBoxEventType_OnSessionStateChanged = 38,
+    VBoxEventType_OnSnapshotTaken = 39,
+    VBoxEventType_OnSnapshotDeleted = 40,
+    VBoxEventType_OnSnapshotChanged = 41,
+    VBoxEventType_OnGuestPropertyChanged = 42,
+    VBoxEventType_OnMousePointerShapeChanged = 43,
+    VBoxEventType_OnMouseCapabilityChanged = 44,
+    VBoxEventType_OnKeyboardLedsChanged = 45,
+    VBoxEventType_OnStateChanged = 46,
+    VBoxEventType_OnAdditionsStateChanged = 47,
+    VBoxEventType_OnNetworkAdapterChanged = 48,
+    VBoxEventType_OnSerialPortChanged = 49,
+    VBoxEventType_OnParallelPortChanged = 50,
+    VBoxEventType_OnStorageControllerChanged = 51,
+    VBoxEventType_OnMediumChanged = 52,
+    VBoxEventType_OnVRDEServerChanged = 53,
+    VBoxEventType_OnUSBControllerChanged = 54,
+    VBoxEventType_OnUSBDeviceStateChanged = 55,
+    VBoxEventType_OnSharedFolderChanged = 56,
+    VBoxEventType_OnRuntimeError = 57,
+    VBoxEventType_OnCanShowWindow = 58,
+    VBoxEventType_OnShowWindow = 59,
+    VBoxEventType_OnCPUChanged = 60,
+    VBoxEventType_OnVRDEServerInfoChanged = 61,
+    VBoxEventType_OnEventSourceChanged = 62,
+    VBoxEventType_OnCPUExecutionCapChanged = 63,
+    VBoxEventType_OnGuestKeyboard = 64,
+    VBoxEventType_OnGuestMouse = 65,
+    VBoxEventType_OnNATRedirect = 66,
+    VBoxEventType_OnHostPCIDevicePlug = 67,
+    VBoxEventType_OnVBoxSVCAvailabilityChanged = 68,
+    VBoxEventType_OnBandwidthGroupChanged = 69,
+    VBoxEventType_OnGuestMonitorChanged = 70,
+    VBoxEventType_OnStorageDeviceChanged = 71,
+    VBoxEventType_OnClipboardModeChanged = 72,
+    VBoxEventType_OnDragAndDropModeChanged = 73,
+    VBoxEventType_OnNATNetworkChanged = 74,
+    VBoxEventType_OnNATNetworkStartStop = 75,
+    VBoxEventType_OnNATNetworkAlter = 76,
+    VBoxEventType_OnNATNetworkCreationDeletion = 77,
+    VBoxEventType_OnNATNetworkSetting = 78,
+    VBoxEventType_OnNATNetworkPortForward = 79,
+    VBoxEventType_OnGuestSessionStateChanged = 80,
+    VBoxEventType_OnGuestSessionRegistered = 81,
+    VBoxEventType_OnGuestProcessRegistered = 82,
+    VBoxEventType_OnGuestProcessStateChanged = 83,
+    VBoxEventType_OnGuestProcessInputNotify = 84,
+    VBoxEventType_OnGuestProcessOutput = 85,
+    VBoxEventType_OnGuestFileRegistered = 86,
+    VBoxEventType_OnGuestFileStateChanged = 87,
+    VBoxEventType_OnGuestFileOffsetChanged = 88,
+    VBoxEventType_OnGuestFileRead = 89,
+    VBoxEventType_OnGuestFileWrite = 90,
+    VBoxEventType_OnVideoCaptureChanged = 91,
+    VBoxEventType_OnGuestUserStateChanged = 92,
+    VBoxEventType_OnGuestMultiTouch = 93,
+    VBoxEventType_OnHostNameResolutionConfigurationChange = 94,
+    VBoxEventType_Last = 95
+} VBoxEventType;
+/* End of enum VBoxEventType declaration */
+#define VBoxEventType_T PRUint32
+
+
+/* Start of enum GuestMouseEventMode declaration */
+#define GUESTMOUSEEVENTMODE_IID_STR "4b500146-ebba-4b7c-bc29-69c2d57a5caf"
+#define GUESTMOUSEEVENTMODE_IID { \
+    0x4b500146, 0xebba, 0x4b7c, \
+    { 0xbc, 0x29, 0x69, 0xc2, 0xd5, 0x7a, 0x5c, 0xaf } \
+}
+typedef enum GuestMouseEventMode
+{
+    GuestMouseEventMode_Relative = 0,
+    GuestMouseEventMode_Absolute = 1
+} GuestMouseEventMode;
+/* End of enum GuestMouseEventMode declaration */
+#define GuestMouseEventMode_T PRUint32
+
+
+/* Start of enum GuestMonitorChangedEventType declaration */
+#define GUESTMONITORCHANGEDEVENTTYPE_IID_STR "ef172985-7e36-4297-95be-e46396968d66"
+#define GUESTMONITORCHANGEDEVENTTYPE_IID { \
+    0xef172985, 0x7e36, 0x4297, \
+    { 0x95, 0xbe, 0xe4, 0x63, 0x96, 0x96, 0x8d, 0x66 } \
+}
+typedef enum GuestMonitorChangedEventType
+{
+    GuestMonitorChangedEventType_Enabled = 0,
+    GuestMonitorChangedEventType_Disabled = 1,
+    GuestMonitorChangedEventType_NewOrigin = 2
+} GuestMonitorChangedEventType;
+/* End of enum GuestMonitorChangedEventType declaration */
+#define GuestMonitorChangedEventType_T PRUint32
+
+
+/* Start of struct IVirtualBoxErrorInfo declaration */
+#define IVIRTUALBOXERRORINFO_IID_STR "c1bcc6d5-7966-481d-ab0b-d0ed73e28135"
+#define IVIRTUALBOXERRORINFO_IID { \
+    0xc1bcc6d5, 0x7966, 0x481d, \
+    { 0xab, 0x0b, 0xd0, 0xed, 0x73, 0xe2, 0x81, 0x35 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVirtualBoxErrorInfo);
+#ifndef VBOX_WITH_GLUE
+struct IVirtualBoxErrorInfo_vtbl
+{
+    struct nsIException_vtbl nsiexception;
+
+    nsresult (*GetResultCode)(IVirtualBoxErrorInfo *pThis, PRInt32 *resultCode);
+
+    nsresult (*GetResultDetail)(IVirtualBoxErrorInfo *pThis, PRInt32 *resultDetail);
+
+    nsresult (*GetInterfaceID)(IVirtualBoxErrorInfo *pThis, PRUnichar * *interfaceID);
+
+    nsresult (*GetComponent)(IVirtualBoxErrorInfo *pThis, PRUnichar * *component);
+
+    nsresult (*GetText)(IVirtualBoxErrorInfo *pThis, PRUnichar * *text);
+
+    nsresult (*GetNext)(IVirtualBoxErrorInfo *pThis, IVirtualBoxErrorInfo * *next);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVirtualBoxErrorInfoVtbl
+{
+    nsresult (*QueryInterface)(IVirtualBoxErrorInfo *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVirtualBoxErrorInfo *pThis);
+    nsrefcnt (*Release)(IVirtualBoxErrorInfo *pThis);
+    nsresult (*GetMessage)(IVirtualBoxErrorInfo *pThis, PRUnichar * *aMessage);
+    nsresult (*GetResult)(IVirtualBoxErrorInfo *pThis, nsresult *aResult);
+    nsresult (*GetName)(IVirtualBoxErrorInfo*pThis, PRUnichar * *aName);
+    nsresult (*GetFilename)(IVirtualBoxErrorInfo *pThis, PRUnichar * *aFilename);
+    nsresult (*GetLineNumber)(IVirtualBoxErrorInfo *pThis, PRUint32 *aLineNumber);
+    nsresult (*GetColumnNumber)(IVirtualBoxErrorInfo *pThis, PRUint32 *aColumnNumber);
+    nsresult (*GetLocation)(IVirtualBoxErrorInfo *pThis, nsIStackFrame * *aLocation);
+    nsresult (*GetInner)(IVirtualBoxErrorInfo *pThis, nsIException * *aInner);
+    nsresult (*GetData)(IVirtualBoxErrorInfo *pThis, nsISupports * *aData);
+    nsresult (*ToString)(IVirtualBoxErrorInfo *pThis, PRUnichar **_retval);
+    nsresult (*GetResultCode)(IVirtualBoxErrorInfo *pThis, PRInt32 *resultCode);
+
+    nsresult (*GetResultDetail)(IVirtualBoxErrorInfo *pThis, PRInt32 *resultDetail);
+
+    nsresult (*GetInterfaceID)(IVirtualBoxErrorInfo *pThis, PRUnichar * *interfaceID);
+
+    nsresult (*GetComponent)(IVirtualBoxErrorInfo *pThis, PRUnichar * *component);
+
+    nsresult (*GetText)(IVirtualBoxErrorInfo *pThis, PRUnichar * *text);
+
+    nsresult (*GetNext)(IVirtualBoxErrorInfo *pThis, IVirtualBoxErrorInfo * *next);
+
+};
+#define IVirtualBoxErrorInfo_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVirtualBoxErrorInfo_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVirtualBoxErrorInfo_Release(p) ((p)->lpVtbl->Release(p))
+#define IVirtualBoxErrorInfo_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#define IVirtualBoxErrorInfo_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#define IVirtualBoxErrorInfo_get_Result(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
+#define IVirtualBoxErrorInfo_GetResult(p, aResult) ((p)->lpVtbl->GetResult(p, aResult))
+#define IVirtualBoxErrorInfo_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IVirtualBoxErrorInfo_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IVirtualBoxErrorInfo_get_Filename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
+#define IVirtualBoxErrorInfo_GetFilename(p, aFilename) ((p)->lpVtbl->GetFilename(p, aFilename))
+#define IVirtualBoxErrorInfo_get_LineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
+#define IVirtualBoxErrorInfo_GetLineNumber(p, aLineNumber) ((p)->lpVtbl->GetLineNumber(p, aLineNumber))
+#define IVirtualBoxErrorInfo_get_ColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
+#define IVirtualBoxErrorInfo_GetColumnNumber(p, aColumnNumber) ((p)->lpVtbl->GetColumnNumber(p, aColumnNumber))
+#define IVirtualBoxErrorInfo_get_Location(p, aLocation) ((p)->lpVtbl->GetLocation(p, aLocation))
+#define IVirtualBoxErrorInfo_GetLocation(p, aLocation) ((p)->lpVtbl->GetLocation(p, aLocation))
+#define IVirtualBoxErrorInfo_get_Inner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
+#define IVirtualBoxErrorInfo_GetInner(p, aInner) ((p)->lpVtbl->GetInner(p, aInner))
+#define IVirtualBoxErrorInfo_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#define IVirtualBoxErrorInfo_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#define IVirtualBoxErrorInfo_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))
+#define IVirtualBoxErrorInfo_get_ResultCode(p, aResultCode) ((p)->lpVtbl->GetResultCode(p, aResultCode))
+#define IVirtualBoxErrorInfo_GetResultCode(p, aResultCode) ((p)->lpVtbl->GetResultCode(p, aResultCode))
+#define IVirtualBoxErrorInfo_get_ResultDetail(p, aResultDetail) ((p)->lpVtbl->GetResultDetail(p, aResultDetail))
+#define IVirtualBoxErrorInfo_GetResultDetail(p, aResultDetail) ((p)->lpVtbl->GetResultDetail(p, aResultDetail))
+#define IVirtualBoxErrorInfo_get_InterfaceID(p, aInterfaceID) ((p)->lpVtbl->GetInterfaceID(p, aInterfaceID))
+#define IVirtualBoxErrorInfo_GetInterfaceID(p, aInterfaceID) ((p)->lpVtbl->GetInterfaceID(p, aInterfaceID))
+#define IVirtualBoxErrorInfo_get_Component(p, aComponent) ((p)->lpVtbl->GetComponent(p, aComponent))
+#define IVirtualBoxErrorInfo_GetComponent(p, aComponent) ((p)->lpVtbl->GetComponent(p, aComponent))
+#define IVirtualBoxErrorInfo_get_Text(p, aText) ((p)->lpVtbl->GetText(p, aText))
+#define IVirtualBoxErrorInfo_GetText(p, aText) ((p)->lpVtbl->GetText(p, aText))
+#define IVirtualBoxErrorInfo_get_Next(p, aNext) ((p)->lpVtbl->GetNext(p, aNext))
+#define IVirtualBoxErrorInfo_GetNext(p, aNext) ((p)->lpVtbl->GetNext(p, aNext))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVirtualBoxErrorInfo
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVirtualBoxErrorInfo_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVirtualBoxErrorInfoVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVirtualBoxErrorInfo declaration */
+
+
+/* Start of struct INATNetwork declaration */
+#define INATNETWORK_IID_STR "a63c75da-4c99-4e9d-8351-eb73651c18cc"
+#define INATNETWORK_IID { \
+    0xa63c75da, 0x4c99, 0x4e9d, \
+    { 0x83, 0x51, 0xeb, 0x73, 0x65, 0x1c, 0x18, 0xcc } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATNetwork);
+#ifndef VBOX_WITH_GLUE
+struct INATNetwork_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetNetworkName)(INATNetwork *pThis, PRUnichar * *networkName);
+    nsresult (*SetNetworkName)(INATNetwork *pThis, PRUnichar * networkName);
+
+    nsresult (*GetEnabled)(INATNetwork *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(INATNetwork *pThis, PRBool enabled);
+
+    nsresult (*GetNetwork)(INATNetwork *pThis, PRUnichar * *network);
+    nsresult (*SetNetwork)(INATNetwork *pThis, PRUnichar * network);
+
+    nsresult (*GetGateway)(INATNetwork *pThis, PRUnichar * *gateway);
+
+    nsresult (*GetIPv6Enabled)(INATNetwork *pThis, PRBool *IPv6Enabled);
+    nsresult (*SetIPv6Enabled)(INATNetwork *pThis, PRBool IPv6Enabled);
+
+    nsresult (*GetIPv6Prefix)(INATNetwork *pThis, PRUnichar * *IPv6Prefix);
+    nsresult (*SetIPv6Prefix)(INATNetwork *pThis, PRUnichar * IPv6Prefix);
+
+    nsresult (*GetAdvertiseDefaultIPv6RouteEnabled)(INATNetwork *pThis, PRBool *advertiseDefaultIPv6RouteEnabled);
+    nsresult (*SetAdvertiseDefaultIPv6RouteEnabled)(INATNetwork *pThis, PRBool advertiseDefaultIPv6RouteEnabled);
+
+    nsresult (*GetNeedDhcpServer)(INATNetwork *pThis, PRBool *needDhcpServer);
+    nsresult (*SetNeedDhcpServer)(INATNetwork *pThis, PRBool needDhcpServer);
+
+    nsresult (*GetEventSource)(INATNetwork *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetPortForwardRules4)(INATNetwork *pThis, PRUint32 *portForwardRules4Size, PRUnichar * **portForwardRules4);
+
+    nsresult (*GetLocalMappings)(INATNetwork *pThis, PRUint32 *localMappingsSize, PRUnichar * **localMappings);
+
+    nsresult (*GetLoopbackIp6)(INATNetwork *pThis, PRInt32 *loopbackIp6);
+    nsresult (*SetLoopbackIp6)(INATNetwork *pThis, PRInt32 loopbackIp6);
+
+    nsresult (*GetPortForwardRules6)(INATNetwork *pThis, PRUint32 *portForwardRules6Size, PRUnichar * **portForwardRules6);
+
+    nsresult (*AddLocalMapping)(
+        INATNetwork *pThis,
+        PRUnichar * hostid,
+        PRInt32 offset
+    );
+
+    nsresult (*AddPortForwardRule)(
+        INATNetwork *pThis,
+        PRBool isIpv6,
+        PRUnichar * ruleName,
+        PRUint32 proto,
+        PRUnichar * hostIP,
+        PRUint16 hostPort,
+        PRUnichar * guestIP,
+        PRUint16 guestPort
+    );
+
+    nsresult (*RemovePortForwardRule)(
+        INATNetwork *pThis,
+        PRBool iSipv6,
+        PRUnichar * ruleName
+    );
+
+    nsresult (*Start)(
+        INATNetwork *pThis,
+        PRUnichar * trunkType
+    );
+
+    nsresult (*Stop)(INATNetwork *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATNetworkVtbl
+{
+    nsresult (*QueryInterface)(INATNetwork *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATNetwork *pThis);
+    nsrefcnt (*Release)(INATNetwork *pThis);
+    nsresult (*GetNetworkName)(INATNetwork *pThis, PRUnichar * *networkName);
+    nsresult (*SetNetworkName)(INATNetwork *pThis, PRUnichar * networkName);
+
+    nsresult (*GetEnabled)(INATNetwork *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(INATNetwork *pThis, PRBool enabled);
+
+    nsresult (*GetNetwork)(INATNetwork *pThis, PRUnichar * *network);
+    nsresult (*SetNetwork)(INATNetwork *pThis, PRUnichar * network);
+
+    nsresult (*GetGateway)(INATNetwork *pThis, PRUnichar * *gateway);
+
+    nsresult (*GetIPv6Enabled)(INATNetwork *pThis, PRBool *IPv6Enabled);
+    nsresult (*SetIPv6Enabled)(INATNetwork *pThis, PRBool IPv6Enabled);
+
+    nsresult (*GetIPv6Prefix)(INATNetwork *pThis, PRUnichar * *IPv6Prefix);
+    nsresult (*SetIPv6Prefix)(INATNetwork *pThis, PRUnichar * IPv6Prefix);
+
+    nsresult (*GetAdvertiseDefaultIPv6RouteEnabled)(INATNetwork *pThis, PRBool *advertiseDefaultIPv6RouteEnabled);
+    nsresult (*SetAdvertiseDefaultIPv6RouteEnabled)(INATNetwork *pThis, PRBool advertiseDefaultIPv6RouteEnabled);
+
+    nsresult (*GetNeedDhcpServer)(INATNetwork *pThis, PRBool *needDhcpServer);
+    nsresult (*SetNeedDhcpServer)(INATNetwork *pThis, PRBool needDhcpServer);
+
+    nsresult (*GetEventSource)(INATNetwork *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetPortForwardRules4)(INATNetwork *pThis, PRUint32 *portForwardRules4Size, PRUnichar * **portForwardRules4);
+
+    nsresult (*GetLocalMappings)(INATNetwork *pThis, PRUint32 *localMappingsSize, PRUnichar * **localMappings);
+
+    nsresult (*GetLoopbackIp6)(INATNetwork *pThis, PRInt32 *loopbackIp6);
+    nsresult (*SetLoopbackIp6)(INATNetwork *pThis, PRInt32 loopbackIp6);
+
+    nsresult (*GetPortForwardRules6)(INATNetwork *pThis, PRUint32 *portForwardRules6Size, PRUnichar * **portForwardRules6);
+
+    nsresult (*AddLocalMapping)(
+        INATNetwork *pThis,
+        PRUnichar * hostid,
+        PRInt32 offset
+    );
+
+    nsresult (*AddPortForwardRule)(
+        INATNetwork *pThis,
+        PRBool isIpv6,
+        PRUnichar * ruleName,
+        PRUint32 proto,
+        PRUnichar * hostIP,
+        PRUint16 hostPort,
+        PRUnichar * guestIP,
+        PRUint16 guestPort
+    );
+
+    nsresult (*RemovePortForwardRule)(
+        INATNetwork *pThis,
+        PRBool iSipv6,
+        PRUnichar * ruleName
+    );
+
+    nsresult (*Start)(
+        INATNetwork *pThis,
+        PRUnichar * trunkType
+    );
+
+    nsresult (*Stop)(INATNetwork *pThis );
+
+};
+#define INATNetwork_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATNetwork_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATNetwork_Release(p) ((p)->lpVtbl->Release(p))
+#define INATNetwork_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetwork_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetwork_put_NetworkName(p, aNetworkName) ((p)->lpVtbl->SetNetworkName(p, aNetworkName))
+#define INATNetwork_SetNetworkName(p, aNetworkName) ((p)->lpVtbl->SetNetworkName(p, aNetworkName))
+#define INATNetwork_get_Enabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define INATNetwork_GetEnabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define INATNetwork_put_Enabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define INATNetwork_SetEnabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define INATNetwork_get_Network(p, aNetwork) ((p)->lpVtbl->GetNetwork(p, aNetwork))
+#define INATNetwork_GetNetwork(p, aNetwork) ((p)->lpVtbl->GetNetwork(p, aNetwork))
+#define INATNetwork_put_Network(p, aNetwork) ((p)->lpVtbl->SetNetwork(p, aNetwork))
+#define INATNetwork_SetNetwork(p, aNetwork) ((p)->lpVtbl->SetNetwork(p, aNetwork))
+#define INATNetwork_get_Gateway(p, aGateway) ((p)->lpVtbl->GetGateway(p, aGateway))
+#define INATNetwork_GetGateway(p, aGateway) ((p)->lpVtbl->GetGateway(p, aGateway))
+#define INATNetwork_get_IPv6Enabled(p, aIPv6Enabled) ((p)->lpVtbl->GetIPv6Enabled(p, aIPv6Enabled))
+#define INATNetwork_GetIPv6Enabled(p, aIPv6Enabled) ((p)->lpVtbl->GetIPv6Enabled(p, aIPv6Enabled))
+#define INATNetwork_put_IPv6Enabled(p, aIPv6Enabled) ((p)->lpVtbl->SetIPv6Enabled(p, aIPv6Enabled))
+#define INATNetwork_SetIPv6Enabled(p, aIPv6Enabled) ((p)->lpVtbl->SetIPv6Enabled(p, aIPv6Enabled))
+#define INATNetwork_get_IPv6Prefix(p, aIPv6Prefix) ((p)->lpVtbl->GetIPv6Prefix(p, aIPv6Prefix))
+#define INATNetwork_GetIPv6Prefix(p, aIPv6Prefix) ((p)->lpVtbl->GetIPv6Prefix(p, aIPv6Prefix))
+#define INATNetwork_put_IPv6Prefix(p, aIPv6Prefix) ((p)->lpVtbl->SetIPv6Prefix(p, aIPv6Prefix))
+#define INATNetwork_SetIPv6Prefix(p, aIPv6Prefix) ((p)->lpVtbl->SetIPv6Prefix(p, aIPv6Prefix))
+#define INATNetwork_get_AdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled) ((p)->lpVtbl->GetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled))
+#define INATNetwork_GetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled) ((p)->lpVtbl->GetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled))
+#define INATNetwork_put_AdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled) ((p)->lpVtbl->SetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled))
+#define INATNetwork_SetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled) ((p)->lpVtbl->SetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled))
+#define INATNetwork_get_NeedDhcpServer(p, aNeedDhcpServer) ((p)->lpVtbl->GetNeedDhcpServer(p, aNeedDhcpServer))
+#define INATNetwork_GetNeedDhcpServer(p, aNeedDhcpServer) ((p)->lpVtbl->GetNeedDhcpServer(p, aNeedDhcpServer))
+#define INATNetwork_put_NeedDhcpServer(p, aNeedDhcpServer) ((p)->lpVtbl->SetNeedDhcpServer(p, aNeedDhcpServer))
+#define INATNetwork_SetNeedDhcpServer(p, aNeedDhcpServer) ((p)->lpVtbl->SetNeedDhcpServer(p, aNeedDhcpServer))
+#define INATNetwork_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define INATNetwork_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define INATNetwork_get_PortForwardRules4(p, aPortForwardRules4) ((p)->lpVtbl->GetPortForwardRules4(p, aPortForwardRules4))
+#define INATNetwork_GetPortForwardRules4(p, aPortForwardRules4) ((p)->lpVtbl->GetPortForwardRules4(p, aPortForwardRules4))
+#define INATNetwork_get_LocalMappings(p, aLocalMappings) ((p)->lpVtbl->GetLocalMappings(p, aLocalMappings))
+#define INATNetwork_GetLocalMappings(p, aLocalMappings) ((p)->lpVtbl->GetLocalMappings(p, aLocalMappings))
+#define INATNetwork_get_LoopbackIp6(p, aLoopbackIp6) ((p)->lpVtbl->GetLoopbackIp6(p, aLoopbackIp6))
+#define INATNetwork_GetLoopbackIp6(p, aLoopbackIp6) ((p)->lpVtbl->GetLoopbackIp6(p, aLoopbackIp6))
+#define INATNetwork_put_LoopbackIp6(p, aLoopbackIp6) ((p)->lpVtbl->SetLoopbackIp6(p, aLoopbackIp6))
+#define INATNetwork_SetLoopbackIp6(p, aLoopbackIp6) ((p)->lpVtbl->SetLoopbackIp6(p, aLoopbackIp6))
+#define INATNetwork_get_PortForwardRules6(p, aPortForwardRules6) ((p)->lpVtbl->GetPortForwardRules6(p, aPortForwardRules6))
+#define INATNetwork_GetPortForwardRules6(p, aPortForwardRules6) ((p)->lpVtbl->GetPortForwardRules6(p, aPortForwardRules6))
+#define INATNetwork_AddLocalMapping(p, aHostid, aOffset) ((p)->lpVtbl->AddLocalMapping(p, aHostid, aOffset))
+#define INATNetwork_AddPortForwardRule(p, aIsIpv6, aRuleName, aProto, aHostIP, aHostPort, aGuestIP, aGuestPort) ((p)->lpVtbl->AddPortForwardRule(p, aIsIpv6, aRuleName, aProto, aHostIP, aHostPort, aGuestIP, aGuestPort))
+#define INATNetwork_RemovePortForwardRule(p, aISipv6, aRuleName) ((p)->lpVtbl->RemovePortForwardRule(p, aISipv6, aRuleName))
+#define INATNetwork_Start(p, aTrunkType) ((p)->lpVtbl->Start(p, aTrunkType))
+#define INATNetwork_Stop(p) ((p)->lpVtbl->Stop(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATNetwork
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATNetwork_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATNetworkVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATNetwork declaration */
+
+
+/* Start of struct IDHCPServer declaration */
+#define IDHCPSERVER_IID_STR "ff0774c5-1f62-4bc3-919c-7fc942bf1d25"
+#define IDHCPSERVER_IID { \
+    0xff0774c5, 0x1f62, 0x4bc3, \
+    { 0x91, 0x9c, 0x7f, 0xc9, 0x42, 0xbf, 0x1d, 0x25 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IDHCPServer);
+#ifndef VBOX_WITH_GLUE
+struct IDHCPServer_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEventSource)(IDHCPServer *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetEnabled)(IDHCPServer *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(IDHCPServer *pThis, PRBool enabled);
+
+    nsresult (*GetIPAddress)(IDHCPServer *pThis, PRUnichar * *IPAddress);
+
+    nsresult (*GetNetworkMask)(IDHCPServer *pThis, PRUnichar * *networkMask);
+
+    nsresult (*GetNetworkName)(IDHCPServer *pThis, PRUnichar * *networkName);
+
+    nsresult (*GetLowerIP)(IDHCPServer *pThis, PRUnichar * *lowerIP);
+
+    nsresult (*GetUpperIP)(IDHCPServer *pThis, PRUnichar * *upperIP);
+
+    nsresult (*GetGlobalOptions)(IDHCPServer *pThis, PRUint32 *globalOptionsSize, PRUnichar * **globalOptions);
+
+    nsresult (*GetVmConfigs)(IDHCPServer *pThis, PRUint32 *vmConfigsSize, PRUnichar * **vmConfigs);
+
+    nsresult (*AddGlobalOption)(
+        IDHCPServer *pThis,
+        PRUint32 option,
+        PRUnichar * value
+    );
+
+    nsresult (*AddVmSlotOption)(
+        IDHCPServer *pThis,
+        PRUnichar * vmname,
+        PRInt32 slot,
+        PRUint32 option,
+        PRUnichar * value
+    );
+
+    nsresult (*RemoveVmSlotOptions)(
+        IDHCPServer *pThis,
+        PRUnichar * vmname,
+        PRInt32 slot
+    );
+
+    nsresult (*GetVmSlotOptions)(
+        IDHCPServer *pThis,
+        PRUnichar * vmname,
+        PRInt32 slot,
+        PRUint32 *optionSize,
+        PRUnichar *** option
+    );
+
+    nsresult (*GetMacOptions)(
+        IDHCPServer *pThis,
+        PRUnichar * mac,
+        PRUint32 *optionSize,
+        PRUnichar *** option
+    );
+
+    nsresult (*SetConfiguration)(
+        IDHCPServer *pThis,
+        PRUnichar * IPAddress,
+        PRUnichar * networkMask,
+        PRUnichar * FromIPAddress,
+        PRUnichar * ToIPAddress
+    );
+
+    nsresult (*Start)(
+        IDHCPServer *pThis,
+        PRUnichar * networkName,
+        PRUnichar * trunkName,
+        PRUnichar * trunkType
+    );
+
+    nsresult (*Stop)(IDHCPServer *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IDHCPServerVtbl
+{
+    nsresult (*QueryInterface)(IDHCPServer *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IDHCPServer *pThis);
+    nsrefcnt (*Release)(IDHCPServer *pThis);
+    nsresult (*GetEventSource)(IDHCPServer *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetEnabled)(IDHCPServer *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(IDHCPServer *pThis, PRBool enabled);
+
+    nsresult (*GetIPAddress)(IDHCPServer *pThis, PRUnichar * *IPAddress);
+
+    nsresult (*GetNetworkMask)(IDHCPServer *pThis, PRUnichar * *networkMask);
+
+    nsresult (*GetNetworkName)(IDHCPServer *pThis, PRUnichar * *networkName);
+
+    nsresult (*GetLowerIP)(IDHCPServer *pThis, PRUnichar * *lowerIP);
+
+    nsresult (*GetUpperIP)(IDHCPServer *pThis, PRUnichar * *upperIP);
+
+    nsresult (*GetGlobalOptions)(IDHCPServer *pThis, PRUint32 *globalOptionsSize, PRUnichar * **globalOptions);
+
+    nsresult (*GetVmConfigs)(IDHCPServer *pThis, PRUint32 *vmConfigsSize, PRUnichar * **vmConfigs);
+
+    nsresult (*AddGlobalOption)(
+        IDHCPServer *pThis,
+        PRUint32 option,
+        PRUnichar * value
+    );
+
+    nsresult (*AddVmSlotOption)(
+        IDHCPServer *pThis,
+        PRUnichar * vmname,
+        PRInt32 slot,
+        PRUint32 option,
+        PRUnichar * value
+    );
+
+    nsresult (*RemoveVmSlotOptions)(
+        IDHCPServer *pThis,
+        PRUnichar * vmname,
+        PRInt32 slot
+    );
+
+    nsresult (*GetVmSlotOptions)(
+        IDHCPServer *pThis,
+        PRUnichar * vmname,
+        PRInt32 slot,
+        PRUint32 *optionSize,
+        PRUnichar *** option
+    );
+
+    nsresult (*GetMacOptions)(
+        IDHCPServer *pThis,
+        PRUnichar * mac,
+        PRUint32 *optionSize,
+        PRUnichar *** option
+    );
+
+    nsresult (*SetConfiguration)(
+        IDHCPServer *pThis,
+        PRUnichar * IPAddress,
+        PRUnichar * networkMask,
+        PRUnichar * FromIPAddress,
+        PRUnichar * ToIPAddress
+    );
+
+    nsresult (*Start)(
+        IDHCPServer *pThis,
+        PRUnichar * networkName,
+        PRUnichar * trunkName,
+        PRUnichar * trunkType
+    );
+
+    nsresult (*Stop)(IDHCPServer *pThis );
+
+};
+#define IDHCPServer_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IDHCPServer_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IDHCPServer_Release(p) ((p)->lpVtbl->Release(p))
+#define IDHCPServer_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IDHCPServer_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IDHCPServer_get_Enabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define IDHCPServer_GetEnabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define IDHCPServer_put_Enabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define IDHCPServer_SetEnabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define IDHCPServer_get_IPAddress(p, aIPAddress) ((p)->lpVtbl->GetIPAddress(p, aIPAddress))
+#define IDHCPServer_GetIPAddress(p, aIPAddress) ((p)->lpVtbl->GetIPAddress(p, aIPAddress))
+#define IDHCPServer_get_NetworkMask(p, aNetworkMask) ((p)->lpVtbl->GetNetworkMask(p, aNetworkMask))
+#define IDHCPServer_GetNetworkMask(p, aNetworkMask) ((p)->lpVtbl->GetNetworkMask(p, aNetworkMask))
+#define IDHCPServer_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define IDHCPServer_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define IDHCPServer_get_LowerIP(p, aLowerIP) ((p)->lpVtbl->GetLowerIP(p, aLowerIP))
+#define IDHCPServer_GetLowerIP(p, aLowerIP) ((p)->lpVtbl->GetLowerIP(p, aLowerIP))
+#define IDHCPServer_get_UpperIP(p, aUpperIP) ((p)->lpVtbl->GetUpperIP(p, aUpperIP))
+#define IDHCPServer_GetUpperIP(p, aUpperIP) ((p)->lpVtbl->GetUpperIP(p, aUpperIP))
+#define IDHCPServer_get_GlobalOptions(p, aGlobalOptions) ((p)->lpVtbl->GetGlobalOptions(p, aGlobalOptions))
+#define IDHCPServer_GetGlobalOptions(p, aGlobalOptions) ((p)->lpVtbl->GetGlobalOptions(p, aGlobalOptions))
+#define IDHCPServer_get_VmConfigs(p, aVmConfigs) ((p)->lpVtbl->GetVmConfigs(p, aVmConfigs))
+#define IDHCPServer_GetVmConfigs(p, aVmConfigs) ((p)->lpVtbl->GetVmConfigs(p, aVmConfigs))
+#define IDHCPServer_AddGlobalOption(p, aOption, aValue) ((p)->lpVtbl->AddGlobalOption(p, aOption, aValue))
+#define IDHCPServer_AddVmSlotOption(p, aVmname, aSlot, aOption, aValue) ((p)->lpVtbl->AddVmSlotOption(p, aVmname, aSlot, aOption, aValue))
+#define IDHCPServer_RemoveVmSlotOptions(p, aVmname, aSlot) ((p)->lpVtbl->RemoveVmSlotOptions(p, aVmname, aSlot))
+#define IDHCPServer_GetVmSlotOptions(p, aVmname, aSlot, aOption) ((p)->lpVtbl->GetVmSlotOptions(p, aVmname, aSlot, aOption))
+#define IDHCPServer_GetMacOptions(p, aMac, aOption) ((p)->lpVtbl->GetMacOptions(p, aMac, aOption))
+#define IDHCPServer_SetConfiguration(p, aIPAddress, aNetworkMask, aFromIPAddress, aToIPAddress) ((p)->lpVtbl->SetConfiguration(p, aIPAddress, aNetworkMask, aFromIPAddress, aToIPAddress))
+#define IDHCPServer_Start(p, aNetworkName, aTrunkName, aTrunkType) ((p)->lpVtbl->Start(p, aNetworkName, aTrunkName, aTrunkType))
+#define IDHCPServer_Stop(p) ((p)->lpVtbl->Stop(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface IDHCPServer
+{
+#ifndef VBOX_WITH_GLUE
+    struct IDHCPServer_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IDHCPServerVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IDHCPServer declaration */
+
+
+/* Start of struct IVirtualBox declaration */
+#define IVIRTUALBOX_IID_STR "fafa4e17-1ee2-4905-a10e-fe7c18bf5554"
+#define IVIRTUALBOX_IID { \
+    0xfafa4e17, 0x1ee2, 0x4905, \
+    { 0xa1, 0x0e, 0xfe, 0x7c, 0x18, 0xbf, 0x55, 0x54 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVirtualBox);
+#ifndef VBOX_WITH_GLUE
+struct IVirtualBox_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetVersion)(IVirtualBox *pThis, PRUnichar * *version);
+
+    nsresult (*GetVersionNormalized)(IVirtualBox *pThis, PRUnichar * *versionNormalized);
+
+    nsresult (*GetRevision)(IVirtualBox *pThis, PRUint32 *revision);
+
+    nsresult (*GetPackageType)(IVirtualBox *pThis, PRUnichar * *packageType);
+
+    nsresult (*GetAPIVersion)(IVirtualBox *pThis, PRUnichar * *APIVersion);
+
+    nsresult (*GetHomeFolder)(IVirtualBox *pThis, PRUnichar * *homeFolder);
+
+    nsresult (*GetSettingsFilePath)(IVirtualBox *pThis, PRUnichar * *settingsFilePath);
+
+    nsresult (*GetHost)(IVirtualBox *pThis, IHost * *host);
+
+    nsresult (*GetSystemProperties)(IVirtualBox *pThis, ISystemProperties * *systemProperties);
+
+    nsresult (*GetMachines)(IVirtualBox *pThis, PRUint32 *machinesSize, IMachine * **machines);
+
+    nsresult (*GetMachineGroups)(IVirtualBox *pThis, PRUint32 *machineGroupsSize, PRUnichar * **machineGroups);
+
+    nsresult (*GetHardDisks)(IVirtualBox *pThis, PRUint32 *hardDisksSize, IMedium * **hardDisks);
+
+    nsresult (*GetDVDImages)(IVirtualBox *pThis, PRUint32 *DVDImagesSize, IMedium * **DVDImages);
+
+    nsresult (*GetFloppyImages)(IVirtualBox *pThis, PRUint32 *floppyImagesSize, IMedium * **floppyImages);
+
+    nsresult (*GetProgressOperations)(IVirtualBox *pThis, PRUint32 *progressOperationsSize, IProgress * **progressOperations);
+
+    nsresult (*GetGuestOSTypes)(IVirtualBox *pThis, PRUint32 *guestOSTypesSize, IGuestOSType * **guestOSTypes);
+
+    nsresult (*GetSharedFolders)(IVirtualBox *pThis, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetPerformanceCollector)(IVirtualBox *pThis, IPerformanceCollector * *performanceCollector);
+
+    nsresult (*GetDHCPServers)(IVirtualBox *pThis, PRUint32 *DHCPServersSize, IDHCPServer * **DHCPServers);
+
+    nsresult (*GetNATNetworks)(IVirtualBox *pThis, PRUint32 *NATNetworksSize, INATNetwork * **NATNetworks);
+
+    nsresult (*GetEventSource)(IVirtualBox *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetExtensionPackManager)(IVirtualBox *pThis, IExtPackManager * *extensionPackManager);
+
+    nsresult (*GetInternalNetworks)(IVirtualBox *pThis, PRUint32 *internalNetworksSize, PRUnichar * **internalNetworks);
+
+    nsresult (*GetGenericNetworkDrivers)(IVirtualBox *pThis, PRUint32 *genericNetworkDriversSize, PRUnichar * **genericNetworkDrivers);
+
+    nsresult (*ComposeMachineFilename)(
+        IVirtualBox *pThis,
+        PRUnichar * name,
+        PRUnichar * group,
+        PRUnichar * createFlags,
+        PRUnichar * baseFolder,
+        PRUnichar * * file
+    );
+
+    nsresult (*CreateMachine)(
+        IVirtualBox *pThis,
+        PRUnichar * settingsFile,
+        PRUnichar * name,
+        PRUint32 groupsSize,
+        PRUnichar ** groups,
+        PRUnichar * osTypeId,
+        PRUnichar * flags,
+        IMachine * * machine
+    );
+
+    nsresult (*OpenMachine)(
+        IVirtualBox *pThis,
+        PRUnichar * settingsFile,
+        IMachine * * machine
+    );
+
+    nsresult (*RegisterMachine)(
+        IVirtualBox *pThis,
+        IMachine * machine
+    );
+
+    nsresult (*FindMachine)(
+        IVirtualBox *pThis,
+        PRUnichar * nameOrId,
+        IMachine * * machine
+    );
+
+    nsresult (*GetMachinesByGroups)(
+        IVirtualBox *pThis,
+        PRUint32 groupsSize,
+        PRUnichar ** groups,
+        PRUint32 *machinesSize,
+        IMachine *** machines
+    );
+
+    nsresult (*GetMachineStates)(
+        IVirtualBox *pThis,
+        PRUint32 machinesSize,
+        IMachine ** machines,
+        PRUint32 *statesSize,
+        PRUint32** states
+    );
+
+    nsresult (*CreateAppliance)(
+        IVirtualBox *pThis,
+        IAppliance * * appliance
+    );
+
+    nsresult (*CreateHardDisk)(
+        IVirtualBox *pThis,
+        PRUnichar * format,
+        PRUnichar * location,
+        IMedium * * medium
+    );
+
+    nsresult (*OpenMedium)(
+        IVirtualBox *pThis,
+        PRUnichar * location,
+        PRUint32 deviceType,
+        PRUint32 accessMode,
+        PRBool forceNewUuid,
+        IMedium * * medium
+    );
+
+    nsresult (*GetGuestOSType)(
+        IVirtualBox *pThis,
+        PRUnichar * id,
+        IGuestOSType * * type
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IVirtualBox *pThis,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable,
+        PRBool automount
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IVirtualBox *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*GetExtraDataKeys)(
+        IVirtualBox *pThis,
+        PRUint32 *keysSize,
+        PRUnichar *** keys
+    );
+
+    nsresult (*GetExtraData)(
+        IVirtualBox *pThis,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetExtraData)(
+        IVirtualBox *pThis,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*SetSettingsSecret)(
+        IVirtualBox *pThis,
+        PRUnichar * password
+    );
+
+    nsresult (*CreateDHCPServer)(
+        IVirtualBox *pThis,
+        PRUnichar * name,
+        IDHCPServer * * server
+    );
+
+    nsresult (*FindDHCPServerByNetworkName)(
+        IVirtualBox *pThis,
+        PRUnichar * name,
+        IDHCPServer * * server
+    );
+
+    nsresult (*RemoveDHCPServer)(
+        IVirtualBox *pThis,
+        IDHCPServer * server
+    );
+
+    nsresult (*CreateNATNetwork)(
+        IVirtualBox *pThis,
+        PRUnichar * networkName,
+        INATNetwork * * network
+    );
+
+    nsresult (*FindNATNetworkByName)(
+        IVirtualBox *pThis,
+        PRUnichar * networkName,
+        INATNetwork * * network
+    );
+
+    nsresult (*RemoveNATNetwork)(
+        IVirtualBox *pThis,
+        INATNetwork * network
+    );
+
+    nsresult (*CheckFirmwarePresent)(
+        IVirtualBox *pThis,
+        PRUint32 firmwareType,
+        PRUnichar * version,
+        PRUnichar * * url,
+        PRUnichar * * file,
+        PRBool * result
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVirtualBoxVtbl
+{
+    nsresult (*QueryInterface)(IVirtualBox *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVirtualBox *pThis);
+    nsrefcnt (*Release)(IVirtualBox *pThis);
+    nsresult (*GetVersion)(IVirtualBox *pThis, PRUnichar * *version);
+
+    nsresult (*GetVersionNormalized)(IVirtualBox *pThis, PRUnichar * *versionNormalized);
+
+    nsresult (*GetRevision)(IVirtualBox *pThis, PRUint32 *revision);
+
+    nsresult (*GetPackageType)(IVirtualBox *pThis, PRUnichar * *packageType);
+
+    nsresult (*GetAPIVersion)(IVirtualBox *pThis, PRUnichar * *APIVersion);
+
+    nsresult (*GetHomeFolder)(IVirtualBox *pThis, PRUnichar * *homeFolder);
+
+    nsresult (*GetSettingsFilePath)(IVirtualBox *pThis, PRUnichar * *settingsFilePath);
+
+    nsresult (*GetHost)(IVirtualBox *pThis, IHost * *host);
+
+    nsresult (*GetSystemProperties)(IVirtualBox *pThis, ISystemProperties * *systemProperties);
+
+    nsresult (*GetMachines)(IVirtualBox *pThis, PRUint32 *machinesSize, IMachine * **machines);
+
+    nsresult (*GetMachineGroups)(IVirtualBox *pThis, PRUint32 *machineGroupsSize, PRUnichar * **machineGroups);
+
+    nsresult (*GetHardDisks)(IVirtualBox *pThis, PRUint32 *hardDisksSize, IMedium * **hardDisks);
+
+    nsresult (*GetDVDImages)(IVirtualBox *pThis, PRUint32 *DVDImagesSize, IMedium * **DVDImages);
+
+    nsresult (*GetFloppyImages)(IVirtualBox *pThis, PRUint32 *floppyImagesSize, IMedium * **floppyImages);
+
+    nsresult (*GetProgressOperations)(IVirtualBox *pThis, PRUint32 *progressOperationsSize, IProgress * **progressOperations);
+
+    nsresult (*GetGuestOSTypes)(IVirtualBox *pThis, PRUint32 *guestOSTypesSize, IGuestOSType * **guestOSTypes);
+
+    nsresult (*GetSharedFolders)(IVirtualBox *pThis, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetPerformanceCollector)(IVirtualBox *pThis, IPerformanceCollector * *performanceCollector);
+
+    nsresult (*GetDHCPServers)(IVirtualBox *pThis, PRUint32 *DHCPServersSize, IDHCPServer * **DHCPServers);
+
+    nsresult (*GetNATNetworks)(IVirtualBox *pThis, PRUint32 *NATNetworksSize, INATNetwork * **NATNetworks);
+
+    nsresult (*GetEventSource)(IVirtualBox *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetExtensionPackManager)(IVirtualBox *pThis, IExtPackManager * *extensionPackManager);
+
+    nsresult (*GetInternalNetworks)(IVirtualBox *pThis, PRUint32 *internalNetworksSize, PRUnichar * **internalNetworks);
+
+    nsresult (*GetGenericNetworkDrivers)(IVirtualBox *pThis, PRUint32 *genericNetworkDriversSize, PRUnichar * **genericNetworkDrivers);
+
+    nsresult (*ComposeMachineFilename)(
+        IVirtualBox *pThis,
+        PRUnichar * name,
+        PRUnichar * group,
+        PRUnichar * createFlags,
+        PRUnichar * baseFolder,
+        PRUnichar * * file
+    );
+
+    nsresult (*CreateMachine)(
+        IVirtualBox *pThis,
+        PRUnichar * settingsFile,
+        PRUnichar * name,
+        PRUint32 groupsSize,
+        PRUnichar ** groups,
+        PRUnichar * osTypeId,
+        PRUnichar * flags,
+        IMachine * * machine
+    );
+
+    nsresult (*OpenMachine)(
+        IVirtualBox *pThis,
+        PRUnichar * settingsFile,
+        IMachine * * machine
+    );
+
+    nsresult (*RegisterMachine)(
+        IVirtualBox *pThis,
+        IMachine * machine
+    );
+
+    nsresult (*FindMachine)(
+        IVirtualBox *pThis,
+        PRUnichar * nameOrId,
+        IMachine * * machine
+    );
+
+    nsresult (*GetMachinesByGroups)(
+        IVirtualBox *pThis,
+        PRUint32 groupsSize,
+        PRUnichar ** groups,
+        PRUint32 *machinesSize,
+        IMachine *** machines
+    );
+
+    nsresult (*GetMachineStates)(
+        IVirtualBox *pThis,
+        PRUint32 machinesSize,
+        IMachine ** machines,
+        PRUint32 *statesSize,
+        PRUint32** states
+    );
+
+    nsresult (*CreateAppliance)(
+        IVirtualBox *pThis,
+        IAppliance * * appliance
+    );
+
+    nsresult (*CreateHardDisk)(
+        IVirtualBox *pThis,
+        PRUnichar * format,
+        PRUnichar * location,
+        IMedium * * medium
+    );
+
+    nsresult (*OpenMedium)(
+        IVirtualBox *pThis,
+        PRUnichar * location,
+        PRUint32 deviceType,
+        PRUint32 accessMode,
+        PRBool forceNewUuid,
+        IMedium * * medium
+    );
+
+    nsresult (*GetGuestOSType)(
+        IVirtualBox *pThis,
+        PRUnichar * id,
+        IGuestOSType * * type
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IVirtualBox *pThis,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable,
+        PRBool automount
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IVirtualBox *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*GetExtraDataKeys)(
+        IVirtualBox *pThis,
+        PRUint32 *keysSize,
+        PRUnichar *** keys
+    );
+
+    nsresult (*GetExtraData)(
+        IVirtualBox *pThis,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetExtraData)(
+        IVirtualBox *pThis,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*SetSettingsSecret)(
+        IVirtualBox *pThis,
+        PRUnichar * password
+    );
+
+    nsresult (*CreateDHCPServer)(
+        IVirtualBox *pThis,
+        PRUnichar * name,
+        IDHCPServer * * server
+    );
+
+    nsresult (*FindDHCPServerByNetworkName)(
+        IVirtualBox *pThis,
+        PRUnichar * name,
+        IDHCPServer * * server
+    );
+
+    nsresult (*RemoveDHCPServer)(
+        IVirtualBox *pThis,
+        IDHCPServer * server
+    );
+
+    nsresult (*CreateNATNetwork)(
+        IVirtualBox *pThis,
+        PRUnichar * networkName,
+        INATNetwork * * network
+    );
+
+    nsresult (*FindNATNetworkByName)(
+        IVirtualBox *pThis,
+        PRUnichar * networkName,
+        INATNetwork * * network
+    );
+
+    nsresult (*RemoveNATNetwork)(
+        IVirtualBox *pThis,
+        INATNetwork * network
+    );
+
+    nsresult (*CheckFirmwarePresent)(
+        IVirtualBox *pThis,
+        PRUint32 firmwareType,
+        PRUnichar * version,
+        PRUnichar * * url,
+        PRUnichar * * file,
+        PRBool * result
+    );
+
+};
+#define IVirtualBox_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVirtualBox_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVirtualBox_Release(p) ((p)->lpVtbl->Release(p))
+#define IVirtualBox_get_Version(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IVirtualBox_GetVersion(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IVirtualBox_get_VersionNormalized(p, aVersionNormalized) ((p)->lpVtbl->GetVersionNormalized(p, aVersionNormalized))
+#define IVirtualBox_GetVersionNormalized(p, aVersionNormalized) ((p)->lpVtbl->GetVersionNormalized(p, aVersionNormalized))
+#define IVirtualBox_get_Revision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IVirtualBox_GetRevision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IVirtualBox_get_PackageType(p, aPackageType) ((p)->lpVtbl->GetPackageType(p, aPackageType))
+#define IVirtualBox_GetPackageType(p, aPackageType) ((p)->lpVtbl->GetPackageType(p, aPackageType))
+#define IVirtualBox_get_APIVersion(p, aAPIVersion) ((p)->lpVtbl->GetAPIVersion(p, aAPIVersion))
+#define IVirtualBox_GetAPIVersion(p, aAPIVersion) ((p)->lpVtbl->GetAPIVersion(p, aAPIVersion))
+#define IVirtualBox_get_HomeFolder(p, aHomeFolder) ((p)->lpVtbl->GetHomeFolder(p, aHomeFolder))
+#define IVirtualBox_GetHomeFolder(p, aHomeFolder) ((p)->lpVtbl->GetHomeFolder(p, aHomeFolder))
+#define IVirtualBox_get_SettingsFilePath(p, aSettingsFilePath) ((p)->lpVtbl->GetSettingsFilePath(p, aSettingsFilePath))
+#define IVirtualBox_GetSettingsFilePath(p, aSettingsFilePath) ((p)->lpVtbl->GetSettingsFilePath(p, aSettingsFilePath))
+#define IVirtualBox_get_Host(p, aHost) ((p)->lpVtbl->GetHost(p, aHost))
+#define IVirtualBox_GetHost(p, aHost) ((p)->lpVtbl->GetHost(p, aHost))
+#define IVirtualBox_get_SystemProperties(p, aSystemProperties) ((p)->lpVtbl->GetSystemProperties(p, aSystemProperties))
+#define IVirtualBox_GetSystemProperties(p, aSystemProperties) ((p)->lpVtbl->GetSystemProperties(p, aSystemProperties))
+#define IVirtualBox_get_Machines(p, aMachines) ((p)->lpVtbl->GetMachines(p, aMachines))
+#define IVirtualBox_GetMachines(p, aMachines) ((p)->lpVtbl->GetMachines(p, aMachines))
+#define IVirtualBox_get_MachineGroups(p, aMachineGroups) ((p)->lpVtbl->GetMachineGroups(p, aMachineGroups))
+#define IVirtualBox_GetMachineGroups(p, aMachineGroups) ((p)->lpVtbl->GetMachineGroups(p, aMachineGroups))
+#define IVirtualBox_get_HardDisks(p, aHardDisks) ((p)->lpVtbl->GetHardDisks(p, aHardDisks))
+#define IVirtualBox_GetHardDisks(p, aHardDisks) ((p)->lpVtbl->GetHardDisks(p, aHardDisks))
+#define IVirtualBox_get_DVDImages(p, aDVDImages) ((p)->lpVtbl->GetDVDImages(p, aDVDImages))
+#define IVirtualBox_GetDVDImages(p, aDVDImages) ((p)->lpVtbl->GetDVDImages(p, aDVDImages))
+#define IVirtualBox_get_FloppyImages(p, aFloppyImages) ((p)->lpVtbl->GetFloppyImages(p, aFloppyImages))
+#define IVirtualBox_GetFloppyImages(p, aFloppyImages) ((p)->lpVtbl->GetFloppyImages(p, aFloppyImages))
+#define IVirtualBox_get_ProgressOperations(p, aProgressOperations) ((p)->lpVtbl->GetProgressOperations(p, aProgressOperations))
+#define IVirtualBox_GetProgressOperations(p, aProgressOperations) ((p)->lpVtbl->GetProgressOperations(p, aProgressOperations))
+#define IVirtualBox_get_GuestOSTypes(p, aGuestOSTypes) ((p)->lpVtbl->GetGuestOSTypes(p, aGuestOSTypes))
+#define IVirtualBox_GetGuestOSTypes(p, aGuestOSTypes) ((p)->lpVtbl->GetGuestOSTypes(p, aGuestOSTypes))
+#define IVirtualBox_get_SharedFolders(p, aSharedFolders) ((p)->lpVtbl->GetSharedFolders(p, aSharedFolders))
+#define IVirtualBox_GetSharedFolders(p, aSharedFolders) ((p)->lpVtbl->GetSharedFolders(p, aSharedFolders))
+#define IVirtualBox_get_PerformanceCollector(p, aPerformanceCollector) ((p)->lpVtbl->GetPerformanceCollector(p, aPerformanceCollector))
+#define IVirtualBox_GetPerformanceCollector(p, aPerformanceCollector) ((p)->lpVtbl->GetPerformanceCollector(p, aPerformanceCollector))
+#define IVirtualBox_get_DHCPServers(p, aDHCPServers) ((p)->lpVtbl->GetDHCPServers(p, aDHCPServers))
+#define IVirtualBox_GetDHCPServers(p, aDHCPServers) ((p)->lpVtbl->GetDHCPServers(p, aDHCPServers))
+#define IVirtualBox_get_NATNetworks(p, aNATNetworks) ((p)->lpVtbl->GetNATNetworks(p, aNATNetworks))
+#define IVirtualBox_GetNATNetworks(p, aNATNetworks) ((p)->lpVtbl->GetNATNetworks(p, aNATNetworks))
+#define IVirtualBox_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IVirtualBox_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IVirtualBox_get_ExtensionPackManager(p, aExtensionPackManager) ((p)->lpVtbl->GetExtensionPackManager(p, aExtensionPackManager))
+#define IVirtualBox_GetExtensionPackManager(p, aExtensionPackManager) ((p)->lpVtbl->GetExtensionPackManager(p, aExtensionPackManager))
+#define IVirtualBox_get_InternalNetworks(p, aInternalNetworks) ((p)->lpVtbl->GetInternalNetworks(p, aInternalNetworks))
+#define IVirtualBox_GetInternalNetworks(p, aInternalNetworks) ((p)->lpVtbl->GetInternalNetworks(p, aInternalNetworks))
+#define IVirtualBox_get_GenericNetworkDrivers(p, aGenericNetworkDrivers) ((p)->lpVtbl->GetGenericNetworkDrivers(p, aGenericNetworkDrivers))
+#define IVirtualBox_GetGenericNetworkDrivers(p, aGenericNetworkDrivers) ((p)->lpVtbl->GetGenericNetworkDrivers(p, aGenericNetworkDrivers))
+#define IVirtualBox_ComposeMachineFilename(p, aName, aGroup, aCreateFlags, aBaseFolder, aFile) ((p)->lpVtbl->ComposeMachineFilename(p, aName, aGroup, aCreateFlags, aBaseFolder, aFile))
+#define IVirtualBox_CreateMachine(p, aSettingsFile, aName, aGroups, aOsTypeId, aFlags, aMachine) ((p)->lpVtbl->CreateMachine(p, aSettingsFile, aName, aGroups, aOsTypeId, aFlags, aMachine))
+#define IVirtualBox_OpenMachine(p, aSettingsFile, aMachine) ((p)->lpVtbl->OpenMachine(p, aSettingsFile, aMachine))
+#define IVirtualBox_RegisterMachine(p, aMachine) ((p)->lpVtbl->RegisterMachine(p, aMachine))
+#define IVirtualBox_FindMachine(p, aNameOrId, aMachine) ((p)->lpVtbl->FindMachine(p, aNameOrId, aMachine))
+#define IVirtualBox_GetMachinesByGroups(p, aGroups, aMachines) ((p)->lpVtbl->GetMachinesByGroups(p, aGroups, aMachines))
+#define IVirtualBox_GetMachineStates(p, aMachines, aStates) ((p)->lpVtbl->GetMachineStates(p, aMachines, aStates))
+#define IVirtualBox_CreateAppliance(p, aAppliance) ((p)->lpVtbl->CreateAppliance(p, aAppliance))
+#define IVirtualBox_CreateHardDisk(p, aFormat, aLocation, aMedium) ((p)->lpVtbl->CreateHardDisk(p, aFormat, aLocation, aMedium))
+#define IVirtualBox_OpenMedium(p, aLocation, aDeviceType, aAccessMode, aForceNewUuid, aMedium) ((p)->lpVtbl->OpenMedium(p, aLocation, aDeviceType, aAccessMode, aForceNewUuid, aMedium))
+#define IVirtualBox_GetGuestOSType(p, aId, aType) ((p)->lpVtbl->GetGuestOSType(p, aId, aType))
+#define IVirtualBox_CreateSharedFolder(p, aName, aHostPath, aWritable, aAutomount) ((p)->lpVtbl->CreateSharedFolder(p, aName, aHostPath, aWritable, aAutomount))
+#define IVirtualBox_RemoveSharedFolder(p, aName) ((p)->lpVtbl->RemoveSharedFolder(p, aName))
+#define IVirtualBox_GetExtraDataKeys(p, aKeys) ((p)->lpVtbl->GetExtraDataKeys(p, aKeys))
+#define IVirtualBox_GetExtraData(p, aKey, aValue) ((p)->lpVtbl->GetExtraData(p, aKey, aValue))
+#define IVirtualBox_SetExtraData(p, aKey, aValue) ((p)->lpVtbl->SetExtraData(p, aKey, aValue))
+#define IVirtualBox_SetSettingsSecret(p, aPassword) ((p)->lpVtbl->SetSettingsSecret(p, aPassword))
+#define IVirtualBox_CreateDHCPServer(p, aName, aServer) ((p)->lpVtbl->CreateDHCPServer(p, aName, aServer))
+#define IVirtualBox_FindDHCPServerByNetworkName(p, aName, aServer) ((p)->lpVtbl->FindDHCPServerByNetworkName(p, aName, aServer))
+#define IVirtualBox_RemoveDHCPServer(p, aServer) ((p)->lpVtbl->RemoveDHCPServer(p, aServer))
+#define IVirtualBox_CreateNATNetwork(p, aNetworkName, aNetwork) ((p)->lpVtbl->CreateNATNetwork(p, aNetworkName, aNetwork))
+#define IVirtualBox_FindNATNetworkByName(p, aNetworkName, aNetwork) ((p)->lpVtbl->FindNATNetworkByName(p, aNetworkName, aNetwork))
+#define IVirtualBox_RemoveNATNetwork(p, aNetwork) ((p)->lpVtbl->RemoveNATNetwork(p, aNetwork))
+#define IVirtualBox_CheckFirmwarePresent(p, aFirmwareType, aVersion, aUrl, aFile, aResult) ((p)->lpVtbl->CheckFirmwarePresent(p, aFirmwareType, aVersion, aUrl, aFile, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVirtualBox
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVirtualBox_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVirtualBoxVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVirtualBox declaration */
+
+
+/* Start of struct IVFSExplorer declaration */
+#define IVFSEXPLORER_IID_STR "fb220201-2fd3-47e2-a5dc-2c2431d833cc"
+#define IVFSEXPLORER_IID { \
+    0xfb220201, 0x2fd3, 0x47e2, \
+    { 0xa5, 0xdc, 0x2c, 0x24, 0x31, 0xd8, 0x33, 0xcc } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVFSExplorer);
+#ifndef VBOX_WITH_GLUE
+struct IVFSExplorer_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetPath)(IVFSExplorer *pThis, PRUnichar * *path);
+
+    nsresult (*GetType)(IVFSExplorer *pThis, PRUint32 *type);
+
+    nsresult (*Update)(
+        IVFSExplorer *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*Cd)(
+        IVFSExplorer *pThis,
+        PRUnichar * dir,
+        IProgress * * progress
+    );
+
+    nsresult (*CdUp)(
+        IVFSExplorer *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*EntryList)(
+        IVFSExplorer *pThis,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *typesSize,
+        PRUint32** types,
+        PRUint32 *sizesSize,
+        PRInt64** sizes,
+        PRUint32 *modesSize,
+        PRUint32** modes
+    );
+
+    nsresult (*Exists)(
+        IVFSExplorer *pThis,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        PRUint32 *existsSize,
+        PRUnichar *** exists
+    );
+
+    nsresult (*Remove)(
+        IVFSExplorer *pThis,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        IProgress * * progress
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVFSExplorerVtbl
+{
+    nsresult (*QueryInterface)(IVFSExplorer *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVFSExplorer *pThis);
+    nsrefcnt (*Release)(IVFSExplorer *pThis);
+    nsresult (*GetPath)(IVFSExplorer *pThis, PRUnichar * *path);
+
+    nsresult (*GetType)(IVFSExplorer *pThis, PRUint32 *type);
+
+    nsresult (*Update)(
+        IVFSExplorer *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*Cd)(
+        IVFSExplorer *pThis,
+        PRUnichar * dir,
+        IProgress * * progress
+    );
+
+    nsresult (*CdUp)(
+        IVFSExplorer *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*EntryList)(
+        IVFSExplorer *pThis,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *typesSize,
+        PRUint32** types,
+        PRUint32 *sizesSize,
+        PRInt64** sizes,
+        PRUint32 *modesSize,
+        PRUint32** modes
+    );
+
+    nsresult (*Exists)(
+        IVFSExplorer *pThis,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        PRUint32 *existsSize,
+        PRUnichar *** exists
+    );
+
+    nsresult (*Remove)(
+        IVFSExplorer *pThis,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        IProgress * * progress
+    );
+
+};
+#define IVFSExplorer_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVFSExplorer_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVFSExplorer_Release(p) ((p)->lpVtbl->Release(p))
+#define IVFSExplorer_get_Path(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define IVFSExplorer_GetPath(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define IVFSExplorer_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVFSExplorer_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVFSExplorer_Update(p, aProgress) ((p)->lpVtbl->Update(p, aProgress))
+#define IVFSExplorer_Cd(p, aDir, aProgress) ((p)->lpVtbl->Cd(p, aDir, aProgress))
+#define IVFSExplorer_CdUp(p, aProgress) ((p)->lpVtbl->CdUp(p, aProgress))
+#define IVFSExplorer_EntryList(p, aNames, aTypes, aSizes, aModes) ((p)->lpVtbl->EntryList(p, aNames, aTypes, aSizes, aModes))
+#define IVFSExplorer_Exists(p, aNames, aExists) ((p)->lpVtbl->Exists(p, aNames, aExists))
+#define IVFSExplorer_Remove(p, aNames, aProgress) ((p)->lpVtbl->Remove(p, aNames, aProgress))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVFSExplorer
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVFSExplorer_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVFSExplorerVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVFSExplorer declaration */
+
+
+/* Start of struct IAppliance declaration */
+#define IAPPLIANCE_IID_STR "3059cf9e-25c7-4f0b-9fa5-3c42e441670b"
+#define IAPPLIANCE_IID { \
+    0x3059cf9e, 0x25c7, 0x4f0b, \
+    { 0x9f, 0xa5, 0x3c, 0x42, 0xe4, 0x41, 0x67, 0x0b } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IAppliance);
+#ifndef VBOX_WITH_GLUE
+struct IAppliance_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetPath)(IAppliance *pThis, PRUnichar * *path);
+
+    nsresult (*GetDisks)(IAppliance *pThis, PRUint32 *disksSize, PRUnichar * **disks);
+
+    nsresult (*GetVirtualSystemDescriptions)(IAppliance *pThis, PRUint32 *virtualSystemDescriptionsSize, IVirtualSystemDescription * **virtualSystemDescriptions);
+
+    nsresult (*GetMachines)(IAppliance *pThis, PRUint32 *machinesSize, PRUnichar * **machines);
+
+    nsresult (*Read)(
+        IAppliance *pThis,
+        PRUnichar * file,
+        IProgress * * progress
+    );
+
+    nsresult (*Interpret)(IAppliance *pThis );
+
+    nsresult (*ImportMachines)(
+        IAppliance *pThis,
+        PRUint32 optionsSize,
+        PRUint32* options,
+        IProgress * * progress
+    );
+
+    nsresult (*CreateVFSExplorer)(
+        IAppliance *pThis,
+        PRUnichar * URI,
+        IVFSExplorer * * explorer
+    );
+
+    nsresult (*Write)(
+        IAppliance *pThis,
+        PRUnichar * format,
+        PRUint32 optionsSize,
+        PRUint32* options,
+        PRUnichar * path,
+        IProgress * * progress
+    );
+
+    nsresult (*GetWarnings)(
+        IAppliance *pThis,
+        PRUint32 *warningsSize,
+        PRUnichar *** warnings
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IApplianceVtbl
+{
+    nsresult (*QueryInterface)(IAppliance *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IAppliance *pThis);
+    nsrefcnt (*Release)(IAppliance *pThis);
+    nsresult (*GetPath)(IAppliance *pThis, PRUnichar * *path);
+
+    nsresult (*GetDisks)(IAppliance *pThis, PRUint32 *disksSize, PRUnichar * **disks);
+
+    nsresult (*GetVirtualSystemDescriptions)(IAppliance *pThis, PRUint32 *virtualSystemDescriptionsSize, IVirtualSystemDescription * **virtualSystemDescriptions);
+
+    nsresult (*GetMachines)(IAppliance *pThis, PRUint32 *machinesSize, PRUnichar * **machines);
+
+    nsresult (*Read)(
+        IAppliance *pThis,
+        PRUnichar * file,
+        IProgress * * progress
+    );
+
+    nsresult (*Interpret)(IAppliance *pThis );
+
+    nsresult (*ImportMachines)(
+        IAppliance *pThis,
+        PRUint32 optionsSize,
+        PRUint32* options,
+        IProgress * * progress
+    );
+
+    nsresult (*CreateVFSExplorer)(
+        IAppliance *pThis,
+        PRUnichar * URI,
+        IVFSExplorer * * explorer
+    );
+
+    nsresult (*Write)(
+        IAppliance *pThis,
+        PRUnichar * format,
+        PRUint32 optionsSize,
+        PRUint32* options,
+        PRUnichar * path,
+        IProgress * * progress
+    );
+
+    nsresult (*GetWarnings)(
+        IAppliance *pThis,
+        PRUint32 *warningsSize,
+        PRUnichar *** warnings
+    );
+
+};
+#define IAppliance_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IAppliance_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IAppliance_Release(p) ((p)->lpVtbl->Release(p))
+#define IAppliance_get_Path(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define IAppliance_GetPath(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define IAppliance_get_Disks(p, aDisks) ((p)->lpVtbl->GetDisks(p, aDisks))
+#define IAppliance_GetDisks(p, aDisks) ((p)->lpVtbl->GetDisks(p, aDisks))
+#define IAppliance_get_VirtualSystemDescriptions(p, aVirtualSystemDescriptions) ((p)->lpVtbl->GetVirtualSystemDescriptions(p, aVirtualSystemDescriptions))
+#define IAppliance_GetVirtualSystemDescriptions(p, aVirtualSystemDescriptions) ((p)->lpVtbl->GetVirtualSystemDescriptions(p, aVirtualSystemDescriptions))
+#define IAppliance_get_Machines(p, aMachines) ((p)->lpVtbl->GetMachines(p, aMachines))
+#define IAppliance_GetMachines(p, aMachines) ((p)->lpVtbl->GetMachines(p, aMachines))
+#define IAppliance_Read(p, aFile, aProgress) ((p)->lpVtbl->Read(p, aFile, aProgress))
+#define IAppliance_Interpret(p) ((p)->lpVtbl->Interpret(p))
+#define IAppliance_ImportMachines(p, aOptions, aProgress) ((p)->lpVtbl->ImportMachines(p, aOptions, aProgress))
+#define IAppliance_CreateVFSExplorer(p, aURI, aExplorer) ((p)->lpVtbl->CreateVFSExplorer(p, aURI, aExplorer))
+#define IAppliance_Write(p, aFormat, aOptions, aPath, aProgress) ((p)->lpVtbl->Write(p, aFormat, aOptions, aPath, aProgress))
+#define IAppliance_GetWarnings(p, aWarnings) ((p)->lpVtbl->GetWarnings(p, aWarnings))
+#endif /* VBOX_WITH_GLUE */
+
+interface IAppliance
+{
+#ifndef VBOX_WITH_GLUE
+    struct IAppliance_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IApplianceVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IAppliance declaration */
+
+
+/* Start of struct IVirtualSystemDescription declaration */
+#define IVIRTUALSYSTEMDESCRIPTION_IID_STR "d7525e6c-531a-4c51-8e04-41235083a3d8"
+#define IVIRTUALSYSTEMDESCRIPTION_IID { \
+    0xd7525e6c, 0x531a, 0x4c51, \
+    { 0x8e, 0x04, 0x41, 0x23, 0x50, 0x83, 0xa3, 0xd8 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVirtualSystemDescription);
+#ifndef VBOX_WITH_GLUE
+struct IVirtualSystemDescription_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetCount)(IVirtualSystemDescription *pThis, PRUint32 *count);
+
+    nsresult (*GetDescription)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 *typesSize,
+        PRUint32** types,
+        PRUint32 *refsSize,
+        PRUnichar *** refs,
+        PRUint32 *OVFValuesSize,
+        PRUnichar *** OVFValues,
+        PRUint32 *VBoxValuesSize,
+        PRUnichar *** VBoxValues,
+        PRUint32 *extraConfigValuesSize,
+        PRUnichar *** extraConfigValues
+    );
+
+    nsresult (*GetDescriptionByType)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 type,
+        PRUint32 *typesSize,
+        PRUint32** types,
+        PRUint32 *refsSize,
+        PRUnichar *** refs,
+        PRUint32 *OVFValuesSize,
+        PRUnichar *** OVFValues,
+        PRUint32 *VBoxValuesSize,
+        PRUnichar *** VBoxValues,
+        PRUint32 *extraConfigValuesSize,
+        PRUnichar *** extraConfigValues
+    );
+
+    nsresult (*GetValuesByType)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 type,
+        PRUint32 which,
+        PRUint32 *valuesSize,
+        PRUnichar *** values
+    );
+
+    nsresult (*SetFinalValues)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 enabledSize,
+        PRBool* enabled,
+        PRUint32 VBoxValuesSize,
+        PRUnichar ** VBoxValues,
+        PRUint32 extraConfigValuesSize,
+        PRUnichar ** extraConfigValues
+    );
+
+    nsresult (*AddDescription)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 type,
+        PRUnichar * VBoxValue,
+        PRUnichar * extraConfigValue
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVirtualSystemDescriptionVtbl
+{
+    nsresult (*QueryInterface)(IVirtualSystemDescription *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVirtualSystemDescription *pThis);
+    nsrefcnt (*Release)(IVirtualSystemDescription *pThis);
+    nsresult (*GetCount)(IVirtualSystemDescription *pThis, PRUint32 *count);
+
+    nsresult (*GetDescription)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 *typesSize,
+        PRUint32** types,
+        PRUint32 *refsSize,
+        PRUnichar *** refs,
+        PRUint32 *OVFValuesSize,
+        PRUnichar *** OVFValues,
+        PRUint32 *VBoxValuesSize,
+        PRUnichar *** VBoxValues,
+        PRUint32 *extraConfigValuesSize,
+        PRUnichar *** extraConfigValues
+    );
+
+    nsresult (*GetDescriptionByType)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 type,
+        PRUint32 *typesSize,
+        PRUint32** types,
+        PRUint32 *refsSize,
+        PRUnichar *** refs,
+        PRUint32 *OVFValuesSize,
+        PRUnichar *** OVFValues,
+        PRUint32 *VBoxValuesSize,
+        PRUnichar *** VBoxValues,
+        PRUint32 *extraConfigValuesSize,
+        PRUnichar *** extraConfigValues
+    );
+
+    nsresult (*GetValuesByType)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 type,
+        PRUint32 which,
+        PRUint32 *valuesSize,
+        PRUnichar *** values
+    );
+
+    nsresult (*SetFinalValues)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 enabledSize,
+        PRBool* enabled,
+        PRUint32 VBoxValuesSize,
+        PRUnichar ** VBoxValues,
+        PRUint32 extraConfigValuesSize,
+        PRUnichar ** extraConfigValues
+    );
+
+    nsresult (*AddDescription)(
+        IVirtualSystemDescription *pThis,
+        PRUint32 type,
+        PRUnichar * VBoxValue,
+        PRUnichar * extraConfigValue
+    );
+
+};
+#define IVirtualSystemDescription_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVirtualSystemDescription_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVirtualSystemDescription_Release(p) ((p)->lpVtbl->Release(p))
+#define IVirtualSystemDescription_get_Count(p, aCount) ((p)->lpVtbl->GetCount(p, aCount))
+#define IVirtualSystemDescription_GetCount(p, aCount) ((p)->lpVtbl->GetCount(p, aCount))
+#define IVirtualSystemDescription_GetDescription(p, aTypes, aRefs, aOVFValues, aVBoxValues, aExtraConfigValues) ((p)->lpVtbl->GetDescription(p, aTypes, aRefs, aOVFValues, aVBoxValues, aExtraConfigValues))
+#define IVirtualSystemDescription_GetDescriptionByType(p, aType, aTypes, aRefs, aOVFValues, aVBoxValues, aExtraConfigValues) ((p)->lpVtbl->GetDescriptionByType(p, aType, aTypes, aRefs, aOVFValues, aVBoxValues, aExtraConfigValues))
+#define IVirtualSystemDescription_GetValuesByType(p, aType, aWhich, aValues) ((p)->lpVtbl->GetValuesByType(p, aType, aWhich, aValues))
+#define IVirtualSystemDescription_SetFinalValues(p, aEnabled, aVBoxValues, aExtraConfigValues) ((p)->lpVtbl->SetFinalValues(p, aEnabled, aVBoxValues, aExtraConfigValues))
+#define IVirtualSystemDescription_AddDescription(p, aType, aVBoxValue, aExtraConfigValue) ((p)->lpVtbl->AddDescription(p, aType, aVBoxValue, aExtraConfigValue))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVirtualSystemDescription
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVirtualSystemDescription_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVirtualSystemDescriptionVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVirtualSystemDescription declaration */
+
+
+/* Start of struct IBIOSSettings declaration */
+#define IBIOSSETTINGS_IID_STR "38b54279-dc35-4f5e-a431-835b867c6b5e"
+#define IBIOSSETTINGS_IID { \
+    0x38b54279, 0xdc35, 0x4f5e, \
+    { 0xa4, 0x31, 0x83, 0x5b, 0x86, 0x7c, 0x6b, 0x5e } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IBIOSSettings);
+#ifndef VBOX_WITH_GLUE
+struct IBIOSSettings_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetLogoFadeIn)(IBIOSSettings *pThis, PRBool *logoFadeIn);
+    nsresult (*SetLogoFadeIn)(IBIOSSettings *pThis, PRBool logoFadeIn);
+
+    nsresult (*GetLogoFadeOut)(IBIOSSettings *pThis, PRBool *logoFadeOut);
+    nsresult (*SetLogoFadeOut)(IBIOSSettings *pThis, PRBool logoFadeOut);
+
+    nsresult (*GetLogoDisplayTime)(IBIOSSettings *pThis, PRUint32 *logoDisplayTime);
+    nsresult (*SetLogoDisplayTime)(IBIOSSettings *pThis, PRUint32 logoDisplayTime);
+
+    nsresult (*GetLogoImagePath)(IBIOSSettings *pThis, PRUnichar * *logoImagePath);
+    nsresult (*SetLogoImagePath)(IBIOSSettings *pThis, PRUnichar * logoImagePath);
+
+    nsresult (*GetBootMenuMode)(IBIOSSettings *pThis, PRUint32 *bootMenuMode);
+    nsresult (*SetBootMenuMode)(IBIOSSettings *pThis, PRUint32 bootMenuMode);
+
+    nsresult (*GetACPIEnabled)(IBIOSSettings *pThis, PRBool *ACPIEnabled);
+    nsresult (*SetACPIEnabled)(IBIOSSettings *pThis, PRBool ACPIEnabled);
+
+    nsresult (*GetIOAPICEnabled)(IBIOSSettings *pThis, PRBool *IOAPICEnabled);
+    nsresult (*SetIOAPICEnabled)(IBIOSSettings *pThis, PRBool IOAPICEnabled);
+
+    nsresult (*GetTimeOffset)(IBIOSSettings *pThis, PRInt64 *timeOffset);
+    nsresult (*SetTimeOffset)(IBIOSSettings *pThis, PRInt64 timeOffset);
+
+    nsresult (*GetPXEDebugEnabled)(IBIOSSettings *pThis, PRBool *PXEDebugEnabled);
+    nsresult (*SetPXEDebugEnabled)(IBIOSSettings *pThis, PRBool PXEDebugEnabled);
+
+    nsresult (*GetNonVolatileStorageFile)(IBIOSSettings *pThis, PRUnichar * *nonVolatileStorageFile);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IBIOSSettingsVtbl
+{
+    nsresult (*QueryInterface)(IBIOSSettings *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IBIOSSettings *pThis);
+    nsrefcnt (*Release)(IBIOSSettings *pThis);
+    nsresult (*GetLogoFadeIn)(IBIOSSettings *pThis, PRBool *logoFadeIn);
+    nsresult (*SetLogoFadeIn)(IBIOSSettings *pThis, PRBool logoFadeIn);
+
+    nsresult (*GetLogoFadeOut)(IBIOSSettings *pThis, PRBool *logoFadeOut);
+    nsresult (*SetLogoFadeOut)(IBIOSSettings *pThis, PRBool logoFadeOut);
+
+    nsresult (*GetLogoDisplayTime)(IBIOSSettings *pThis, PRUint32 *logoDisplayTime);
+    nsresult (*SetLogoDisplayTime)(IBIOSSettings *pThis, PRUint32 logoDisplayTime);
+
+    nsresult (*GetLogoImagePath)(IBIOSSettings *pThis, PRUnichar * *logoImagePath);
+    nsresult (*SetLogoImagePath)(IBIOSSettings *pThis, PRUnichar * logoImagePath);
+
+    nsresult (*GetBootMenuMode)(IBIOSSettings *pThis, PRUint32 *bootMenuMode);
+    nsresult (*SetBootMenuMode)(IBIOSSettings *pThis, PRUint32 bootMenuMode);
+
+    nsresult (*GetACPIEnabled)(IBIOSSettings *pThis, PRBool *ACPIEnabled);
+    nsresult (*SetACPIEnabled)(IBIOSSettings *pThis, PRBool ACPIEnabled);
+
+    nsresult (*GetIOAPICEnabled)(IBIOSSettings *pThis, PRBool *IOAPICEnabled);
+    nsresult (*SetIOAPICEnabled)(IBIOSSettings *pThis, PRBool IOAPICEnabled);
+
+    nsresult (*GetTimeOffset)(IBIOSSettings *pThis, PRInt64 *timeOffset);
+    nsresult (*SetTimeOffset)(IBIOSSettings *pThis, PRInt64 timeOffset);
+
+    nsresult (*GetPXEDebugEnabled)(IBIOSSettings *pThis, PRBool *PXEDebugEnabled);
+    nsresult (*SetPXEDebugEnabled)(IBIOSSettings *pThis, PRBool PXEDebugEnabled);
+
+    nsresult (*GetNonVolatileStorageFile)(IBIOSSettings *pThis, PRUnichar * *nonVolatileStorageFile);
+
+};
+#define IBIOSSettings_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IBIOSSettings_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IBIOSSettings_Release(p) ((p)->lpVtbl->Release(p))
+#define IBIOSSettings_get_LogoFadeIn(p, aLogoFadeIn) ((p)->lpVtbl->GetLogoFadeIn(p, aLogoFadeIn))
+#define IBIOSSettings_GetLogoFadeIn(p, aLogoFadeIn) ((p)->lpVtbl->GetLogoFadeIn(p, aLogoFadeIn))
+#define IBIOSSettings_put_LogoFadeIn(p, aLogoFadeIn) ((p)->lpVtbl->SetLogoFadeIn(p, aLogoFadeIn))
+#define IBIOSSettings_SetLogoFadeIn(p, aLogoFadeIn) ((p)->lpVtbl->SetLogoFadeIn(p, aLogoFadeIn))
+#define IBIOSSettings_get_LogoFadeOut(p, aLogoFadeOut) ((p)->lpVtbl->GetLogoFadeOut(p, aLogoFadeOut))
+#define IBIOSSettings_GetLogoFadeOut(p, aLogoFadeOut) ((p)->lpVtbl->GetLogoFadeOut(p, aLogoFadeOut))
+#define IBIOSSettings_put_LogoFadeOut(p, aLogoFadeOut) ((p)->lpVtbl->SetLogoFadeOut(p, aLogoFadeOut))
+#define IBIOSSettings_SetLogoFadeOut(p, aLogoFadeOut) ((p)->lpVtbl->SetLogoFadeOut(p, aLogoFadeOut))
+#define IBIOSSettings_get_LogoDisplayTime(p, aLogoDisplayTime) ((p)->lpVtbl->GetLogoDisplayTime(p, aLogoDisplayTime))
+#define IBIOSSettings_GetLogoDisplayTime(p, aLogoDisplayTime) ((p)->lpVtbl->GetLogoDisplayTime(p, aLogoDisplayTime))
+#define IBIOSSettings_put_LogoDisplayTime(p, aLogoDisplayTime) ((p)->lpVtbl->SetLogoDisplayTime(p, aLogoDisplayTime))
+#define IBIOSSettings_SetLogoDisplayTime(p, aLogoDisplayTime) ((p)->lpVtbl->SetLogoDisplayTime(p, aLogoDisplayTime))
+#define IBIOSSettings_get_LogoImagePath(p, aLogoImagePath) ((p)->lpVtbl->GetLogoImagePath(p, aLogoImagePath))
+#define IBIOSSettings_GetLogoImagePath(p, aLogoImagePath) ((p)->lpVtbl->GetLogoImagePath(p, aLogoImagePath))
+#define IBIOSSettings_put_LogoImagePath(p, aLogoImagePath) ((p)->lpVtbl->SetLogoImagePath(p, aLogoImagePath))
+#define IBIOSSettings_SetLogoImagePath(p, aLogoImagePath) ((p)->lpVtbl->SetLogoImagePath(p, aLogoImagePath))
+#define IBIOSSettings_get_BootMenuMode(p, aBootMenuMode) ((p)->lpVtbl->GetBootMenuMode(p, aBootMenuMode))
+#define IBIOSSettings_GetBootMenuMode(p, aBootMenuMode) ((p)->lpVtbl->GetBootMenuMode(p, aBootMenuMode))
+#define IBIOSSettings_put_BootMenuMode(p, aBootMenuMode) ((p)->lpVtbl->SetBootMenuMode(p, aBootMenuMode))
+#define IBIOSSettings_SetBootMenuMode(p, aBootMenuMode) ((p)->lpVtbl->SetBootMenuMode(p, aBootMenuMode))
+#define IBIOSSettings_get_ACPIEnabled(p, aACPIEnabled) ((p)->lpVtbl->GetACPIEnabled(p, aACPIEnabled))
+#define IBIOSSettings_GetACPIEnabled(p, aACPIEnabled) ((p)->lpVtbl->GetACPIEnabled(p, aACPIEnabled))
+#define IBIOSSettings_put_ACPIEnabled(p, aACPIEnabled) ((p)->lpVtbl->SetACPIEnabled(p, aACPIEnabled))
+#define IBIOSSettings_SetACPIEnabled(p, aACPIEnabled) ((p)->lpVtbl->SetACPIEnabled(p, aACPIEnabled))
+#define IBIOSSettings_get_IOAPICEnabled(p, aIOAPICEnabled) ((p)->lpVtbl->GetIOAPICEnabled(p, aIOAPICEnabled))
+#define IBIOSSettings_GetIOAPICEnabled(p, aIOAPICEnabled) ((p)->lpVtbl->GetIOAPICEnabled(p, aIOAPICEnabled))
+#define IBIOSSettings_put_IOAPICEnabled(p, aIOAPICEnabled) ((p)->lpVtbl->SetIOAPICEnabled(p, aIOAPICEnabled))
+#define IBIOSSettings_SetIOAPICEnabled(p, aIOAPICEnabled) ((p)->lpVtbl->SetIOAPICEnabled(p, aIOAPICEnabled))
+#define IBIOSSettings_get_TimeOffset(p, aTimeOffset) ((p)->lpVtbl->GetTimeOffset(p, aTimeOffset))
+#define IBIOSSettings_GetTimeOffset(p, aTimeOffset) ((p)->lpVtbl->GetTimeOffset(p, aTimeOffset))
+#define IBIOSSettings_put_TimeOffset(p, aTimeOffset) ((p)->lpVtbl->SetTimeOffset(p, aTimeOffset))
+#define IBIOSSettings_SetTimeOffset(p, aTimeOffset) ((p)->lpVtbl->SetTimeOffset(p, aTimeOffset))
+#define IBIOSSettings_get_PXEDebugEnabled(p, aPXEDebugEnabled) ((p)->lpVtbl->GetPXEDebugEnabled(p, aPXEDebugEnabled))
+#define IBIOSSettings_GetPXEDebugEnabled(p, aPXEDebugEnabled) ((p)->lpVtbl->GetPXEDebugEnabled(p, aPXEDebugEnabled))
+#define IBIOSSettings_put_PXEDebugEnabled(p, aPXEDebugEnabled) ((p)->lpVtbl->SetPXEDebugEnabled(p, aPXEDebugEnabled))
+#define IBIOSSettings_SetPXEDebugEnabled(p, aPXEDebugEnabled) ((p)->lpVtbl->SetPXEDebugEnabled(p, aPXEDebugEnabled))
+#define IBIOSSettings_get_NonVolatileStorageFile(p, aNonVolatileStorageFile) ((p)->lpVtbl->GetNonVolatileStorageFile(p, aNonVolatileStorageFile))
+#define IBIOSSettings_GetNonVolatileStorageFile(p, aNonVolatileStorageFile) ((p)->lpVtbl->GetNonVolatileStorageFile(p, aNonVolatileStorageFile))
+#endif /* VBOX_WITH_GLUE */
+
+interface IBIOSSettings
+{
+#ifndef VBOX_WITH_GLUE
+    struct IBIOSSettings_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IBIOSSettingsVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IBIOSSettings declaration */
+
+
+/* Start of struct IPCIAddress declaration */
+#define IPCIADDRESS_IID_STR "c984d15f-e191-400b-840e-970f3dad7296"
+#define IPCIADDRESS_IID { \
+    0xc984d15f, 0xe191, 0x400b, \
+    { 0x84, 0x0e, 0x97, 0x0f, 0x3d, 0xad, 0x72, 0x96 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IPCIAddress);
+#ifndef VBOX_WITH_GLUE
+struct IPCIAddress_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetBus)(IPCIAddress *pThis, PRInt16 *bus);
+    nsresult (*SetBus)(IPCIAddress *pThis, PRInt16 bus);
+
+    nsresult (*GetDevice)(IPCIAddress *pThis, PRInt16 *device);
+    nsresult (*SetDevice)(IPCIAddress *pThis, PRInt16 device);
+
+    nsresult (*GetDevFunction)(IPCIAddress *pThis, PRInt16 *devFunction);
+    nsresult (*SetDevFunction)(IPCIAddress *pThis, PRInt16 devFunction);
+
+    nsresult (*AsLong)(
+        IPCIAddress *pThis,
+        PRInt32 * result
+    );
+
+    nsresult (*FromLong)(
+        IPCIAddress *pThis,
+        PRInt32 number
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IPCIAddressVtbl
+{
+    nsresult (*QueryInterface)(IPCIAddress *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IPCIAddress *pThis);
+    nsrefcnt (*Release)(IPCIAddress *pThis);
+    nsresult (*GetBus)(IPCIAddress *pThis, PRInt16 *bus);
+    nsresult (*SetBus)(IPCIAddress *pThis, PRInt16 bus);
+
+    nsresult (*GetDevice)(IPCIAddress *pThis, PRInt16 *device);
+    nsresult (*SetDevice)(IPCIAddress *pThis, PRInt16 device);
+
+    nsresult (*GetDevFunction)(IPCIAddress *pThis, PRInt16 *devFunction);
+    nsresult (*SetDevFunction)(IPCIAddress *pThis, PRInt16 devFunction);
+
+    nsresult (*AsLong)(
+        IPCIAddress *pThis,
+        PRInt32 * result
+    );
+
+    nsresult (*FromLong)(
+        IPCIAddress *pThis,
+        PRInt32 number
+    );
+
+};
+#define IPCIAddress_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IPCIAddress_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IPCIAddress_Release(p) ((p)->lpVtbl->Release(p))
+#define IPCIAddress_get_Bus(p, aBus) ((p)->lpVtbl->GetBus(p, aBus))
+#define IPCIAddress_GetBus(p, aBus) ((p)->lpVtbl->GetBus(p, aBus))
+#define IPCIAddress_put_Bus(p, aBus) ((p)->lpVtbl->SetBus(p, aBus))
+#define IPCIAddress_SetBus(p, aBus) ((p)->lpVtbl->SetBus(p, aBus))
+#define IPCIAddress_get_Device(p, aDevice) ((p)->lpVtbl->GetDevice(p, aDevice))
+#define IPCIAddress_GetDevice(p, aDevice) ((p)->lpVtbl->GetDevice(p, aDevice))
+#define IPCIAddress_put_Device(p, aDevice) ((p)->lpVtbl->SetDevice(p, aDevice))
+#define IPCIAddress_SetDevice(p, aDevice) ((p)->lpVtbl->SetDevice(p, aDevice))
+#define IPCIAddress_get_DevFunction(p, aDevFunction) ((p)->lpVtbl->GetDevFunction(p, aDevFunction))
+#define IPCIAddress_GetDevFunction(p, aDevFunction) ((p)->lpVtbl->GetDevFunction(p, aDevFunction))
+#define IPCIAddress_put_DevFunction(p, aDevFunction) ((p)->lpVtbl->SetDevFunction(p, aDevFunction))
+#define IPCIAddress_SetDevFunction(p, aDevFunction) ((p)->lpVtbl->SetDevFunction(p, aDevFunction))
+#define IPCIAddress_AsLong(p, aResult) ((p)->lpVtbl->AsLong(p, aResult))
+#define IPCIAddress_FromLong(p, aNumber) ((p)->lpVtbl->FromLong(p, aNumber))
+#endif /* VBOX_WITH_GLUE */
+
+interface IPCIAddress
+{
+#ifndef VBOX_WITH_GLUE
+    struct IPCIAddress_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IPCIAddressVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IPCIAddress declaration */
+
+
+/* Start of struct IPCIDeviceAttachment declaration */
+#define IPCIDEVICEATTACHMENT_IID_STR "91f33d6f-e621-4f70-a77e-15f0e3c714d5"
+#define IPCIDEVICEATTACHMENT_IID { \
+    0x91f33d6f, 0xe621, 0x4f70, \
+    { 0xa7, 0x7e, 0x15, 0xf0, 0xe3, 0xc7, 0x14, 0xd5 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IPCIDeviceAttachment);
+#ifndef VBOX_WITH_GLUE
+struct IPCIDeviceAttachment_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IPCIDeviceAttachment *pThis, PRUnichar * *name);
+
+    nsresult (*GetIsPhysicalDevice)(IPCIDeviceAttachment *pThis, PRBool *isPhysicalDevice);
+
+    nsresult (*GetHostAddress)(IPCIDeviceAttachment *pThis, PRInt32 *hostAddress);
+
+    nsresult (*GetGuestAddress)(IPCIDeviceAttachment *pThis, PRInt32 *guestAddress);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IPCIDeviceAttachmentVtbl
+{
+    nsresult (*QueryInterface)(IPCIDeviceAttachment *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IPCIDeviceAttachment *pThis);
+    nsrefcnt (*Release)(IPCIDeviceAttachment *pThis);
+    nsresult (*GetName)(IPCIDeviceAttachment *pThis, PRUnichar * *name);
+
+    nsresult (*GetIsPhysicalDevice)(IPCIDeviceAttachment *pThis, PRBool *isPhysicalDevice);
+
+    nsresult (*GetHostAddress)(IPCIDeviceAttachment *pThis, PRInt32 *hostAddress);
+
+    nsresult (*GetGuestAddress)(IPCIDeviceAttachment *pThis, PRInt32 *guestAddress);
+
+};
+#define IPCIDeviceAttachment_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IPCIDeviceAttachment_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IPCIDeviceAttachment_Release(p) ((p)->lpVtbl->Release(p))
+#define IPCIDeviceAttachment_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IPCIDeviceAttachment_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IPCIDeviceAttachment_get_IsPhysicalDevice(p, aIsPhysicalDevice) ((p)->lpVtbl->GetIsPhysicalDevice(p, aIsPhysicalDevice))
+#define IPCIDeviceAttachment_GetIsPhysicalDevice(p, aIsPhysicalDevice) ((p)->lpVtbl->GetIsPhysicalDevice(p, aIsPhysicalDevice))
+#define IPCIDeviceAttachment_get_HostAddress(p, aHostAddress) ((p)->lpVtbl->GetHostAddress(p, aHostAddress))
+#define IPCIDeviceAttachment_GetHostAddress(p, aHostAddress) ((p)->lpVtbl->GetHostAddress(p, aHostAddress))
+#define IPCIDeviceAttachment_get_GuestAddress(p, aGuestAddress) ((p)->lpVtbl->GetGuestAddress(p, aGuestAddress))
+#define IPCIDeviceAttachment_GetGuestAddress(p, aGuestAddress) ((p)->lpVtbl->GetGuestAddress(p, aGuestAddress))
+#endif /* VBOX_WITH_GLUE */
+
+interface IPCIDeviceAttachment
+{
+#ifndef VBOX_WITH_GLUE
+    struct IPCIDeviceAttachment_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IPCIDeviceAttachmentVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IPCIDeviceAttachment declaration */
+
+
+/* Start of struct IMachine declaration */
+#define IMACHINE_IID_STR "480cf695-2d8d-4256-9c7c-cce4184fa048"
+#define IMACHINE_IID { \
+    0x480cf695, 0x2d8d, 0x4256, \
+    { 0x9c, 0x7c, 0xcc, 0xe4, 0x18, 0x4f, 0xa0, 0x48 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMachine);
+#ifndef VBOX_WITH_GLUE
+struct IMachine_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetParent)(IMachine *pThis, IVirtualBox * *parent);
+
+    nsresult (*GetIcon)(IMachine *pThis, PRUint32 *iconSize, PRUint8 **icon);
+    nsresult (*SetIcon)(IMachine *pThis, PRUint32 iconSize, PRUint8 *icon);
+
+    nsresult (*GetAccessible)(IMachine *pThis, PRBool *accessible);
+
+    nsresult (*GetAccessError)(IMachine *pThis, IVirtualBoxErrorInfo * *accessError);
+
+    nsresult (*GetName)(IMachine *pThis, PRUnichar * *name);
+    nsresult (*SetName)(IMachine *pThis, PRUnichar * name);
+
+    nsresult (*GetDescription)(IMachine *pThis, PRUnichar * *description);
+    nsresult (*SetDescription)(IMachine *pThis, PRUnichar * description);
+
+    nsresult (*GetId)(IMachine *pThis, PRUnichar * *id);
+
+    nsresult (*GetGroups)(IMachine *pThis, PRUint32 *groupsSize, PRUnichar * **groups);
+    nsresult (*SetGroups)(IMachine *pThis, PRUint32 groupsSize, PRUnichar * *groups);
+
+    nsresult (*GetOSTypeId)(IMachine *pThis, PRUnichar * *OSTypeId);
+    nsresult (*SetOSTypeId)(IMachine *pThis, PRUnichar * OSTypeId);
+
+    nsresult (*GetHardwareVersion)(IMachine *pThis, PRUnichar * *hardwareVersion);
+    nsresult (*SetHardwareVersion)(IMachine *pThis, PRUnichar * hardwareVersion);
+
+    nsresult (*GetHardwareUUID)(IMachine *pThis, PRUnichar * *hardwareUUID);
+    nsresult (*SetHardwareUUID)(IMachine *pThis, PRUnichar * hardwareUUID);
+
+    nsresult (*GetCPUCount)(IMachine *pThis, PRUint32 *CPUCount);
+    nsresult (*SetCPUCount)(IMachine *pThis, PRUint32 CPUCount);
+
+    nsresult (*GetCPUHotPlugEnabled)(IMachine *pThis, PRBool *CPUHotPlugEnabled);
+    nsresult (*SetCPUHotPlugEnabled)(IMachine *pThis, PRBool CPUHotPlugEnabled);
+
+    nsresult (*GetCPUExecutionCap)(IMachine *pThis, PRUint32 *CPUExecutionCap);
+    nsresult (*SetCPUExecutionCap)(IMachine *pThis, PRUint32 CPUExecutionCap);
+
+    nsresult (*GetMemorySize)(IMachine *pThis, PRUint32 *memorySize);
+    nsresult (*SetMemorySize)(IMachine *pThis, PRUint32 memorySize);
+
+    nsresult (*GetMemoryBalloonSize)(IMachine *pThis, PRUint32 *memoryBalloonSize);
+    nsresult (*SetMemoryBalloonSize)(IMachine *pThis, PRUint32 memoryBalloonSize);
+
+    nsresult (*GetPageFusionEnabled)(IMachine *pThis, PRBool *pageFusionEnabled);
+    nsresult (*SetPageFusionEnabled)(IMachine *pThis, PRBool pageFusionEnabled);
+
+    nsresult (*GetGraphicsControllerType)(IMachine *pThis, PRUint32 *graphicsControllerType);
+    nsresult (*SetGraphicsControllerType)(IMachine *pThis, PRUint32 graphicsControllerType);
+
+    nsresult (*GetVRAMSize)(IMachine *pThis, PRUint32 *VRAMSize);
+    nsresult (*SetVRAMSize)(IMachine *pThis, PRUint32 VRAMSize);
+
+    nsresult (*GetAccelerate3DEnabled)(IMachine *pThis, PRBool *accelerate3DEnabled);
+    nsresult (*SetAccelerate3DEnabled)(IMachine *pThis, PRBool accelerate3DEnabled);
+
+    nsresult (*GetAccelerate2DVideoEnabled)(IMachine *pThis, PRBool *accelerate2DVideoEnabled);
+    nsresult (*SetAccelerate2DVideoEnabled)(IMachine *pThis, PRBool accelerate2DVideoEnabled);
+
+    nsresult (*GetMonitorCount)(IMachine *pThis, PRUint32 *monitorCount);
+    nsresult (*SetMonitorCount)(IMachine *pThis, PRUint32 monitorCount);
+
+    nsresult (*GetVideoCaptureEnabled)(IMachine *pThis, PRBool *videoCaptureEnabled);
+    nsresult (*SetVideoCaptureEnabled)(IMachine *pThis, PRBool videoCaptureEnabled);
+
+    nsresult (*GetVideoCaptureScreens)(IMachine *pThis, PRUint32 *videoCaptureScreensSize, PRBool **videoCaptureScreens);
+    nsresult (*SetVideoCaptureScreens)(IMachine *pThis, PRUint32 videoCaptureScreensSize, PRBool *videoCaptureScreens);
+
+    nsresult (*GetVideoCaptureFile)(IMachine *pThis, PRUnichar * *videoCaptureFile);
+    nsresult (*SetVideoCaptureFile)(IMachine *pThis, PRUnichar * videoCaptureFile);
+
+    nsresult (*GetVideoCaptureWidth)(IMachine *pThis, PRUint32 *videoCaptureWidth);
+    nsresult (*SetVideoCaptureWidth)(IMachine *pThis, PRUint32 videoCaptureWidth);
+
+    nsresult (*GetVideoCaptureHeight)(IMachine *pThis, PRUint32 *videoCaptureHeight);
+    nsresult (*SetVideoCaptureHeight)(IMachine *pThis, PRUint32 videoCaptureHeight);
+
+    nsresult (*GetVideoCaptureRate)(IMachine *pThis, PRUint32 *videoCaptureRate);
+    nsresult (*SetVideoCaptureRate)(IMachine *pThis, PRUint32 videoCaptureRate);
+
+    nsresult (*GetVideoCaptureFPS)(IMachine *pThis, PRUint32 *videoCaptureFPS);
+    nsresult (*SetVideoCaptureFPS)(IMachine *pThis, PRUint32 videoCaptureFPS);
+
+    nsresult (*GetBIOSSettings)(IMachine *pThis, IBIOSSettings * *BIOSSettings);
+
+    nsresult (*GetFirmwareType)(IMachine *pThis, PRUint32 *firmwareType);
+    nsresult (*SetFirmwareType)(IMachine *pThis, PRUint32 firmwareType);
+
+    nsresult (*GetPointingHIDType)(IMachine *pThis, PRUint32 *pointingHIDType);
+    nsresult (*SetPointingHIDType)(IMachine *pThis, PRUint32 pointingHIDType);
+
+    nsresult (*GetKeyboardHIDType)(IMachine *pThis, PRUint32 *keyboardHIDType);
+    nsresult (*SetKeyboardHIDType)(IMachine *pThis, PRUint32 keyboardHIDType);
+
+    nsresult (*GetHPETEnabled)(IMachine *pThis, PRBool *HPETEnabled);
+    nsresult (*SetHPETEnabled)(IMachine *pThis, PRBool HPETEnabled);
+
+    nsresult (*GetChipsetType)(IMachine *pThis, PRUint32 *chipsetType);
+    nsresult (*SetChipsetType)(IMachine *pThis, PRUint32 chipsetType);
+
+    nsresult (*GetSnapshotFolder)(IMachine *pThis, PRUnichar * *snapshotFolder);
+    nsresult (*SetSnapshotFolder)(IMachine *pThis, PRUnichar * snapshotFolder);
+
+    nsresult (*GetVRDEServer)(IMachine *pThis, IVRDEServer * *VRDEServer);
+
+    nsresult (*GetEmulatedUSBCardReaderEnabled)(IMachine *pThis, PRBool *emulatedUSBCardReaderEnabled);
+    nsresult (*SetEmulatedUSBCardReaderEnabled)(IMachine *pThis, PRBool emulatedUSBCardReaderEnabled);
+
+    nsresult (*GetMediumAttachments)(IMachine *pThis, PRUint32 *mediumAttachmentsSize, IMediumAttachment * **mediumAttachments);
+
+    nsresult (*GetUSBControllers)(IMachine *pThis, PRUint32 *USBControllersSize, IUSBController * **USBControllers);
+
+    nsresult (*GetUSBDeviceFilters)(IMachine *pThis, IUSBDeviceFilters * *USBDeviceFilters);
+
+    nsresult (*GetAudioAdapter)(IMachine *pThis, IAudioAdapter * *audioAdapter);
+
+    nsresult (*GetStorageControllers)(IMachine *pThis, PRUint32 *storageControllersSize, IStorageController * **storageControllers);
+
+    nsresult (*GetSettingsFilePath)(IMachine *pThis, PRUnichar * *settingsFilePath);
+
+    nsresult (*GetSettingsModified)(IMachine *pThis, PRBool *settingsModified);
+
+    nsresult (*GetSessionState)(IMachine *pThis, PRUint32 *sessionState);
+
+    nsresult (*GetSessionType)(IMachine *pThis, PRUnichar * *sessionType);
+
+    nsresult (*GetSessionPID)(IMachine *pThis, PRUint32 *sessionPID);
+
+    nsresult (*GetState)(IMachine *pThis, PRUint32 *state);
+
+    nsresult (*GetLastStateChange)(IMachine *pThis, PRInt64 *lastStateChange);
+
+    nsresult (*GetStateFilePath)(IMachine *pThis, PRUnichar * *stateFilePath);
+
+    nsresult (*GetLogFolder)(IMachine *pThis, PRUnichar * *logFolder);
+
+    nsresult (*GetCurrentSnapshot)(IMachine *pThis, ISnapshot * *currentSnapshot);
+
+    nsresult (*GetSnapshotCount)(IMachine *pThis, PRUint32 *snapshotCount);
+
+    nsresult (*GetCurrentStateModified)(IMachine *pThis, PRBool *currentStateModified);
+
+    nsresult (*GetSharedFolders)(IMachine *pThis, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetClipboardMode)(IMachine *pThis, PRUint32 *clipboardMode);
+    nsresult (*SetClipboardMode)(IMachine *pThis, PRUint32 clipboardMode);
+
+    nsresult (*GetDragAndDropMode)(IMachine *pThis, PRUint32 *dragAndDropMode);
+    nsresult (*SetDragAndDropMode)(IMachine *pThis, PRUint32 dragAndDropMode);
+
+    nsresult (*GetGuestPropertyNotificationPatterns)(IMachine *pThis, PRUnichar * *guestPropertyNotificationPatterns);
+    nsresult (*SetGuestPropertyNotificationPatterns)(IMachine *pThis, PRUnichar * guestPropertyNotificationPatterns);
+
+    nsresult (*GetTeleporterEnabled)(IMachine *pThis, PRBool *teleporterEnabled);
+    nsresult (*SetTeleporterEnabled)(IMachine *pThis, PRBool teleporterEnabled);
+
+    nsresult (*GetTeleporterPort)(IMachine *pThis, PRUint32 *teleporterPort);
+    nsresult (*SetTeleporterPort)(IMachine *pThis, PRUint32 teleporterPort);
+
+    nsresult (*GetTeleporterAddress)(IMachine *pThis, PRUnichar * *teleporterAddress);
+    nsresult (*SetTeleporterAddress)(IMachine *pThis, PRUnichar * teleporterAddress);
+
+    nsresult (*GetTeleporterPassword)(IMachine *pThis, PRUnichar * *teleporterPassword);
+    nsresult (*SetTeleporterPassword)(IMachine *pThis, PRUnichar * teleporterPassword);
+
+    nsresult (*GetFaultToleranceState)(IMachine *pThis, PRUint32 *faultToleranceState);
+    nsresult (*SetFaultToleranceState)(IMachine *pThis, PRUint32 faultToleranceState);
+
+    nsresult (*GetFaultTolerancePort)(IMachine *pThis, PRUint32 *faultTolerancePort);
+    nsresult (*SetFaultTolerancePort)(IMachine *pThis, PRUint32 faultTolerancePort);
+
+    nsresult (*GetFaultToleranceAddress)(IMachine *pThis, PRUnichar * *faultToleranceAddress);
+    nsresult (*SetFaultToleranceAddress)(IMachine *pThis, PRUnichar * faultToleranceAddress);
+
+    nsresult (*GetFaultTolerancePassword)(IMachine *pThis, PRUnichar * *faultTolerancePassword);
+    nsresult (*SetFaultTolerancePassword)(IMachine *pThis, PRUnichar * faultTolerancePassword);
+
+    nsresult (*GetFaultToleranceSyncInterval)(IMachine *pThis, PRUint32 *faultToleranceSyncInterval);
+    nsresult (*SetFaultToleranceSyncInterval)(IMachine *pThis, PRUint32 faultToleranceSyncInterval);
+
+    nsresult (*GetRTCUseUTC)(IMachine *pThis, PRBool *RTCUseUTC);
+    nsresult (*SetRTCUseUTC)(IMachine *pThis, PRBool RTCUseUTC);
+
+    nsresult (*GetIOCacheEnabled)(IMachine *pThis, PRBool *IOCacheEnabled);
+    nsresult (*SetIOCacheEnabled)(IMachine *pThis, PRBool IOCacheEnabled);
+
+    nsresult (*GetIOCacheSize)(IMachine *pThis, PRUint32 *IOCacheSize);
+    nsresult (*SetIOCacheSize)(IMachine *pThis, PRUint32 IOCacheSize);
+
+    nsresult (*GetPCIDeviceAssignments)(IMachine *pThis, PRUint32 *PCIDeviceAssignmentsSize, IPCIDeviceAttachment * **PCIDeviceAssignments);
+
+    nsresult (*GetBandwidthControl)(IMachine *pThis, IBandwidthControl * *bandwidthControl);
+
+    nsresult (*GetTracingEnabled)(IMachine *pThis, PRBool *tracingEnabled);
+    nsresult (*SetTracingEnabled)(IMachine *pThis, PRBool tracingEnabled);
+
+    nsresult (*GetTracingConfig)(IMachine *pThis, PRUnichar * *tracingConfig);
+    nsresult (*SetTracingConfig)(IMachine *pThis, PRUnichar * tracingConfig);
+
+    nsresult (*GetAllowTracingToAccessVM)(IMachine *pThis, PRBool *allowTracingToAccessVM);
+    nsresult (*SetAllowTracingToAccessVM)(IMachine *pThis, PRBool allowTracingToAccessVM);
+
+    nsresult (*GetAutostartEnabled)(IMachine *pThis, PRBool *autostartEnabled);
+    nsresult (*SetAutostartEnabled)(IMachine *pThis, PRBool autostartEnabled);
+
+    nsresult (*GetAutostartDelay)(IMachine *pThis, PRUint32 *autostartDelay);
+    nsresult (*SetAutostartDelay)(IMachine *pThis, PRUint32 autostartDelay);
+
+    nsresult (*GetAutostopType)(IMachine *pThis, PRUint32 *autostopType);
+    nsresult (*SetAutostopType)(IMachine *pThis, PRUint32 autostopType);
+
+    nsresult (*GetDefaultFrontend)(IMachine *pThis, PRUnichar * *defaultFrontend);
+    nsresult (*SetDefaultFrontend)(IMachine *pThis, PRUnichar * defaultFrontend);
+
+    nsresult (*GetUSBProxyAvailable)(IMachine *pThis, PRBool *USBProxyAvailable);
+
+    nsresult (*LockMachine)(
+        IMachine *pThis,
+        ISession * session,
+        PRUint32 lockType
+    );
+
+    nsresult (*LaunchVMProcess)(
+        IMachine *pThis,
+        ISession * session,
+        PRUnichar * type,
+        PRUnichar * environment,
+        IProgress * * progress
+    );
+
+    nsresult (*SetBootOrder)(
+        IMachine *pThis,
+        PRUint32 position,
+        PRUint32 device
+    );
+
+    nsresult (*GetBootOrder)(
+        IMachine *pThis,
+        PRUint32 position,
+        PRUint32 * device
+    );
+
+    nsresult (*AttachDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRUint32 type,
+        IMedium * medium
+    );
+
+    nsresult (*AttachDeviceWithoutMedium)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRUint32 type
+    );
+
+    nsresult (*DetachDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device
+    );
+
+    nsresult (*PassthroughDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool passthrough
+    );
+
+    nsresult (*TemporaryEjectDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool temporaryEject
+    );
+
+    nsresult (*NonRotationalDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool nonRotational
+    );
+
+    nsresult (*SetAutoDiscardForDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool discard
+    );
+
+    nsresult (*SetHotPluggableForDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool hotPluggable
+    );
+
+    nsresult (*SetBandwidthGroupForDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IBandwidthGroup * bandwidthGroup
+    );
+
+    nsresult (*SetNoBandwidthGroupForDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device
+    );
+
+    nsresult (*UnmountMedium)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool force
+    );
+
+    nsresult (*MountMedium)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IMedium * medium,
+        PRBool force
+    );
+
+    nsresult (*GetMedium)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IMedium * * medium
+    );
+
+    nsresult (*GetMediumAttachmentsOfController)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUint32 *mediumAttachmentsSize,
+        IMediumAttachment *** mediumAttachments
+    );
+
+    nsresult (*GetMediumAttachment)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IMediumAttachment * * attachment
+    );
+
+    nsresult (*AttachHostPCIDevice)(
+        IMachine *pThis,
+        PRInt32 hostAddress,
+        PRInt32 desiredGuestAddress,
+        PRBool tryToUnbind
+    );
+
+    nsresult (*DetachHostPCIDevice)(
+        IMachine *pThis,
+        PRInt32 hostAddress
+    );
+
+    nsresult (*GetNetworkAdapter)(
+        IMachine *pThis,
+        PRUint32 slot,
+        INetworkAdapter * * adapter
+    );
+
+    nsresult (*AddStorageController)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUint32 connectionType,
+        IStorageController * * controller
+    );
+
+    nsresult (*GetStorageControllerByName)(
+        IMachine *pThis,
+        PRUnichar * name,
+        IStorageController * * storageController
+    );
+
+    nsresult (*GetStorageControllerByInstance)(
+        IMachine *pThis,
+        PRUint32 instance,
+        IStorageController * * storageController
+    );
+
+    nsresult (*RemoveStorageController)(
+        IMachine *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*SetStorageControllerBootable)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRBool bootable
+    );
+
+    nsresult (*AddUSBController)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUint32 type,
+        IUSBController * * controller
+    );
+
+    nsresult (*RemoveUSBController)(
+        IMachine *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*GetUSBControllerByName)(
+        IMachine *pThis,
+        PRUnichar * name,
+        IUSBController * * controller
+    );
+
+    nsresult (*GetUSBControllerCountByType)(
+        IMachine *pThis,
+        PRUint32 type,
+        PRUint32 * controllers
+    );
+
+    nsresult (*GetSerialPort)(
+        IMachine *pThis,
+        PRUint32 slot,
+        ISerialPort * * port
+    );
+
+    nsresult (*GetParallelPort)(
+        IMachine *pThis,
+        PRUint32 slot,
+        IParallelPort * * port
+    );
+
+    nsresult (*GetExtraDataKeys)(
+        IMachine *pThis,
+        PRUint32 *keysSize,
+        PRUnichar *** keys
+    );
+
+    nsresult (*GetExtraData)(
+        IMachine *pThis,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetExtraData)(
+        IMachine *pThis,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*GetCPUProperty)(
+        IMachine *pThis,
+        PRUint32 property,
+        PRBool * value
+    );
+
+    nsresult (*SetCPUProperty)(
+        IMachine *pThis,
+        PRUint32 property,
+        PRBool value
+    );
+
+    nsresult (*GetCPUIDLeaf)(
+        IMachine *pThis,
+        PRUint32 id,
+        PRUint32 * valEax,
+        PRUint32 * valEbx,
+        PRUint32 * valEcx,
+        PRUint32 * valEdx
+    );
+
+    nsresult (*SetCPUIDLeaf)(
+        IMachine *pThis,
+        PRUint32 id,
+        PRUint32 valEax,
+        PRUint32 valEbx,
+        PRUint32 valEcx,
+        PRUint32 valEdx
+    );
+
+    nsresult (*RemoveCPUIDLeaf)(
+        IMachine *pThis,
+        PRUint32 id
+    );
+
+    nsresult (*RemoveAllCPUIDLeaves)(IMachine *pThis );
+
+    nsresult (*GetHWVirtExProperty)(
+        IMachine *pThis,
+        PRUint32 property,
+        PRBool * value
+    );
+
+    nsresult (*SetHWVirtExProperty)(
+        IMachine *pThis,
+        PRUint32 property,
+        PRBool value
+    );
+
+    nsresult (*SetSettingsFilePath)(
+        IMachine *pThis,
+        PRUnichar * settingsFilePath,
+        IProgress * * progress
+    );
+
+    nsresult (*SaveSettings)(IMachine *pThis );
+
+    nsresult (*DiscardSettings)(IMachine *pThis );
+
+    nsresult (*Unregister)(
+        IMachine *pThis,
+        PRUint32 cleanupMode,
+        PRUint32 *mediaSize,
+        IMedium *** media
+    );
+
+    nsresult (*DeleteConfig)(
+        IMachine *pThis,
+        PRUint32 mediaSize,
+        IMedium ** media,
+        IProgress * * progress
+    );
+
+    nsresult (*ExportTo)(
+        IMachine *pThis,
+        IAppliance * appliance,
+        PRUnichar * location,
+        IVirtualSystemDescription * * description
+    );
+
+    nsresult (*FindSnapshot)(
+        IMachine *pThis,
+        PRUnichar * nameOrId,
+        ISnapshot * * snapshot
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable,
+        PRBool automount
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IMachine *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*CanShowConsoleWindow)(
+        IMachine *pThis,
+        PRBool * canShow
+    );
+
+    nsresult (*ShowConsoleWindow)(
+        IMachine *pThis,
+        PRInt64 * winId
+    );
+
+    nsresult (*GetGuestProperty)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUnichar * * value,
+        PRInt64 * timestamp,
+        PRUnichar * * flags
+    );
+
+    nsresult (*GetGuestPropertyValue)(
+        IMachine *pThis,
+        PRUnichar * property,
+        PRUnichar * * value
+    );
+
+    nsresult (*GetGuestPropertyTimestamp)(
+        IMachine *pThis,
+        PRUnichar * property,
+        PRInt64 * value
+    );
+
+    nsresult (*SetGuestProperty)(
+        IMachine *pThis,
+        PRUnichar * property,
+        PRUnichar * value,
+        PRUnichar * flags
+    );
+
+    nsresult (*SetGuestPropertyValue)(
+        IMachine *pThis,
+        PRUnichar * property,
+        PRUnichar * value
+    );
+
+    nsresult (*DeleteGuestProperty)(
+        IMachine *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*EnumerateGuestProperties)(
+        IMachine *pThis,
+        PRUnichar * patterns,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *valuesSize,
+        PRUnichar *** values,
+        PRUint32 *timestampsSize,
+        PRInt64** timestamps,
+        PRUint32 *flagsSize,
+        PRUnichar *** flags
+    );
+
+    nsresult (*QuerySavedGuestScreenInfo)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * originX,
+        PRUint32 * originY,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRBool * enabled
+    );
+
+    nsresult (*QuerySavedThumbnailSize)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * size,
+        PRUint32 * width,
+        PRUint32 * height
+    );
+
+    nsresult (*ReadSavedThumbnailToArray)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRBool BGR,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*ReadSavedThumbnailPNGToArray)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*QuerySavedScreenshotPNGSize)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * size,
+        PRUint32 * width,
+        PRUint32 * height
+    );
+
+    nsresult (*ReadSavedScreenshotPNGToArray)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*HotPlugCPU)(
+        IMachine *pThis,
+        PRUint32 cpu
+    );
+
+    nsresult (*HotUnplugCPU)(
+        IMachine *pThis,
+        PRUint32 cpu
+    );
+
+    nsresult (*GetCPUStatus)(
+        IMachine *pThis,
+        PRUint32 cpu,
+        PRBool * attached
+    );
+
+    nsresult (*QueryLogFilename)(
+        IMachine *pThis,
+        PRUint32 idx,
+        PRUnichar * * filename
+    );
+
+    nsresult (*ReadLog)(
+        IMachine *pThis,
+        PRUint32 idx,
+        PRInt64 offset,
+        PRInt64 size,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*CloneTo)(
+        IMachine *pThis,
+        IMachine * target,
+        PRUint32 mode,
+        PRUint32 optionsSize,
+        PRUint32* options,
+        IProgress * * progress
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMachineVtbl
+{
+    nsresult (*QueryInterface)(IMachine *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMachine *pThis);
+    nsrefcnt (*Release)(IMachine *pThis);
+    nsresult (*GetParent)(IMachine *pThis, IVirtualBox * *parent);
+
+    nsresult (*GetIcon)(IMachine *pThis, PRUint32 *iconSize, PRUint8 **icon);
+    nsresult (*SetIcon)(IMachine *pThis, PRUint32 iconSize, PRUint8 *icon);
+
+    nsresult (*GetAccessible)(IMachine *pThis, PRBool *accessible);
+
+    nsresult (*GetAccessError)(IMachine *pThis, IVirtualBoxErrorInfo * *accessError);
+
+    nsresult (*GetName)(IMachine *pThis, PRUnichar * *name);
+    nsresult (*SetName)(IMachine *pThis, PRUnichar * name);
+
+    nsresult (*GetDescription)(IMachine *pThis, PRUnichar * *description);
+    nsresult (*SetDescription)(IMachine *pThis, PRUnichar * description);
+
+    nsresult (*GetId)(IMachine *pThis, PRUnichar * *id);
+
+    nsresult (*GetGroups)(IMachine *pThis, PRUint32 *groupsSize, PRUnichar * **groups);
+    nsresult (*SetGroups)(IMachine *pThis, PRUint32 groupsSize, PRUnichar * *groups);
+
+    nsresult (*GetOSTypeId)(IMachine *pThis, PRUnichar * *OSTypeId);
+    nsresult (*SetOSTypeId)(IMachine *pThis, PRUnichar * OSTypeId);
+
+    nsresult (*GetHardwareVersion)(IMachine *pThis, PRUnichar * *hardwareVersion);
+    nsresult (*SetHardwareVersion)(IMachine *pThis, PRUnichar * hardwareVersion);
+
+    nsresult (*GetHardwareUUID)(IMachine *pThis, PRUnichar * *hardwareUUID);
+    nsresult (*SetHardwareUUID)(IMachine *pThis, PRUnichar * hardwareUUID);
+
+    nsresult (*GetCPUCount)(IMachine *pThis, PRUint32 *CPUCount);
+    nsresult (*SetCPUCount)(IMachine *pThis, PRUint32 CPUCount);
+
+    nsresult (*GetCPUHotPlugEnabled)(IMachine *pThis, PRBool *CPUHotPlugEnabled);
+    nsresult (*SetCPUHotPlugEnabled)(IMachine *pThis, PRBool CPUHotPlugEnabled);
+
+    nsresult (*GetCPUExecutionCap)(IMachine *pThis, PRUint32 *CPUExecutionCap);
+    nsresult (*SetCPUExecutionCap)(IMachine *pThis, PRUint32 CPUExecutionCap);
+
+    nsresult (*GetMemorySize)(IMachine *pThis, PRUint32 *memorySize);
+    nsresult (*SetMemorySize)(IMachine *pThis, PRUint32 memorySize);
+
+    nsresult (*GetMemoryBalloonSize)(IMachine *pThis, PRUint32 *memoryBalloonSize);
+    nsresult (*SetMemoryBalloonSize)(IMachine *pThis, PRUint32 memoryBalloonSize);
+
+    nsresult (*GetPageFusionEnabled)(IMachine *pThis, PRBool *pageFusionEnabled);
+    nsresult (*SetPageFusionEnabled)(IMachine *pThis, PRBool pageFusionEnabled);
+
+    nsresult (*GetGraphicsControllerType)(IMachine *pThis, PRUint32 *graphicsControllerType);
+    nsresult (*SetGraphicsControllerType)(IMachine *pThis, PRUint32 graphicsControllerType);
+
+    nsresult (*GetVRAMSize)(IMachine *pThis, PRUint32 *VRAMSize);
+    nsresult (*SetVRAMSize)(IMachine *pThis, PRUint32 VRAMSize);
+
+    nsresult (*GetAccelerate3DEnabled)(IMachine *pThis, PRBool *accelerate3DEnabled);
+    nsresult (*SetAccelerate3DEnabled)(IMachine *pThis, PRBool accelerate3DEnabled);
+
+    nsresult (*GetAccelerate2DVideoEnabled)(IMachine *pThis, PRBool *accelerate2DVideoEnabled);
+    nsresult (*SetAccelerate2DVideoEnabled)(IMachine *pThis, PRBool accelerate2DVideoEnabled);
+
+    nsresult (*GetMonitorCount)(IMachine *pThis, PRUint32 *monitorCount);
+    nsresult (*SetMonitorCount)(IMachine *pThis, PRUint32 monitorCount);
+
+    nsresult (*GetVideoCaptureEnabled)(IMachine *pThis, PRBool *videoCaptureEnabled);
+    nsresult (*SetVideoCaptureEnabled)(IMachine *pThis, PRBool videoCaptureEnabled);
+
+    nsresult (*GetVideoCaptureScreens)(IMachine *pThis, PRUint32 *videoCaptureScreensSize, PRBool **videoCaptureScreens);
+    nsresult (*SetVideoCaptureScreens)(IMachine *pThis, PRUint32 videoCaptureScreensSize, PRBool *videoCaptureScreens);
+
+    nsresult (*GetVideoCaptureFile)(IMachine *pThis, PRUnichar * *videoCaptureFile);
+    nsresult (*SetVideoCaptureFile)(IMachine *pThis, PRUnichar * videoCaptureFile);
+
+    nsresult (*GetVideoCaptureWidth)(IMachine *pThis, PRUint32 *videoCaptureWidth);
+    nsresult (*SetVideoCaptureWidth)(IMachine *pThis, PRUint32 videoCaptureWidth);
+
+    nsresult (*GetVideoCaptureHeight)(IMachine *pThis, PRUint32 *videoCaptureHeight);
+    nsresult (*SetVideoCaptureHeight)(IMachine *pThis, PRUint32 videoCaptureHeight);
+
+    nsresult (*GetVideoCaptureRate)(IMachine *pThis, PRUint32 *videoCaptureRate);
+    nsresult (*SetVideoCaptureRate)(IMachine *pThis, PRUint32 videoCaptureRate);
+
+    nsresult (*GetVideoCaptureFPS)(IMachine *pThis, PRUint32 *videoCaptureFPS);
+    nsresult (*SetVideoCaptureFPS)(IMachine *pThis, PRUint32 videoCaptureFPS);
+
+    nsresult (*GetBIOSSettings)(IMachine *pThis, IBIOSSettings * *BIOSSettings);
+
+    nsresult (*GetFirmwareType)(IMachine *pThis, PRUint32 *firmwareType);
+    nsresult (*SetFirmwareType)(IMachine *pThis, PRUint32 firmwareType);
+
+    nsresult (*GetPointingHIDType)(IMachine *pThis, PRUint32 *pointingHIDType);
+    nsresult (*SetPointingHIDType)(IMachine *pThis, PRUint32 pointingHIDType);
+
+    nsresult (*GetKeyboardHIDType)(IMachine *pThis, PRUint32 *keyboardHIDType);
+    nsresult (*SetKeyboardHIDType)(IMachine *pThis, PRUint32 keyboardHIDType);
+
+    nsresult (*GetHPETEnabled)(IMachine *pThis, PRBool *HPETEnabled);
+    nsresult (*SetHPETEnabled)(IMachine *pThis, PRBool HPETEnabled);
+
+    nsresult (*GetChipsetType)(IMachine *pThis, PRUint32 *chipsetType);
+    nsresult (*SetChipsetType)(IMachine *pThis, PRUint32 chipsetType);
+
+    nsresult (*GetSnapshotFolder)(IMachine *pThis, PRUnichar * *snapshotFolder);
+    nsresult (*SetSnapshotFolder)(IMachine *pThis, PRUnichar * snapshotFolder);
+
+    nsresult (*GetVRDEServer)(IMachine *pThis, IVRDEServer * *VRDEServer);
+
+    nsresult (*GetEmulatedUSBCardReaderEnabled)(IMachine *pThis, PRBool *emulatedUSBCardReaderEnabled);
+    nsresult (*SetEmulatedUSBCardReaderEnabled)(IMachine *pThis, PRBool emulatedUSBCardReaderEnabled);
+
+    nsresult (*GetMediumAttachments)(IMachine *pThis, PRUint32 *mediumAttachmentsSize, IMediumAttachment * **mediumAttachments);
+
+    nsresult (*GetUSBControllers)(IMachine *pThis, PRUint32 *USBControllersSize, IUSBController * **USBControllers);
+
+    nsresult (*GetUSBDeviceFilters)(IMachine *pThis, IUSBDeviceFilters * *USBDeviceFilters);
+
+    nsresult (*GetAudioAdapter)(IMachine *pThis, IAudioAdapter * *audioAdapter);
+
+    nsresult (*GetStorageControllers)(IMachine *pThis, PRUint32 *storageControllersSize, IStorageController * **storageControllers);
+
+    nsresult (*GetSettingsFilePath)(IMachine *pThis, PRUnichar * *settingsFilePath);
+
+    nsresult (*GetSettingsModified)(IMachine *pThis, PRBool *settingsModified);
+
+    nsresult (*GetSessionState)(IMachine *pThis, PRUint32 *sessionState);
+
+    nsresult (*GetSessionType)(IMachine *pThis, PRUnichar * *sessionType);
+
+    nsresult (*GetSessionPID)(IMachine *pThis, PRUint32 *sessionPID);
+
+    nsresult (*GetState)(IMachine *pThis, PRUint32 *state);
+
+    nsresult (*GetLastStateChange)(IMachine *pThis, PRInt64 *lastStateChange);
+
+    nsresult (*GetStateFilePath)(IMachine *pThis, PRUnichar * *stateFilePath);
+
+    nsresult (*GetLogFolder)(IMachine *pThis, PRUnichar * *logFolder);
+
+    nsresult (*GetCurrentSnapshot)(IMachine *pThis, ISnapshot * *currentSnapshot);
+
+    nsresult (*GetSnapshotCount)(IMachine *pThis, PRUint32 *snapshotCount);
+
+    nsresult (*GetCurrentStateModified)(IMachine *pThis, PRBool *currentStateModified);
+
+    nsresult (*GetSharedFolders)(IMachine *pThis, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetClipboardMode)(IMachine *pThis, PRUint32 *clipboardMode);
+    nsresult (*SetClipboardMode)(IMachine *pThis, PRUint32 clipboardMode);
+
+    nsresult (*GetDragAndDropMode)(IMachine *pThis, PRUint32 *dragAndDropMode);
+    nsresult (*SetDragAndDropMode)(IMachine *pThis, PRUint32 dragAndDropMode);
+
+    nsresult (*GetGuestPropertyNotificationPatterns)(IMachine *pThis, PRUnichar * *guestPropertyNotificationPatterns);
+    nsresult (*SetGuestPropertyNotificationPatterns)(IMachine *pThis, PRUnichar * guestPropertyNotificationPatterns);
+
+    nsresult (*GetTeleporterEnabled)(IMachine *pThis, PRBool *teleporterEnabled);
+    nsresult (*SetTeleporterEnabled)(IMachine *pThis, PRBool teleporterEnabled);
+
+    nsresult (*GetTeleporterPort)(IMachine *pThis, PRUint32 *teleporterPort);
+    nsresult (*SetTeleporterPort)(IMachine *pThis, PRUint32 teleporterPort);
+
+    nsresult (*GetTeleporterAddress)(IMachine *pThis, PRUnichar * *teleporterAddress);
+    nsresult (*SetTeleporterAddress)(IMachine *pThis, PRUnichar * teleporterAddress);
+
+    nsresult (*GetTeleporterPassword)(IMachine *pThis, PRUnichar * *teleporterPassword);
+    nsresult (*SetTeleporterPassword)(IMachine *pThis, PRUnichar * teleporterPassword);
+
+    nsresult (*GetFaultToleranceState)(IMachine *pThis, PRUint32 *faultToleranceState);
+    nsresult (*SetFaultToleranceState)(IMachine *pThis, PRUint32 faultToleranceState);
+
+    nsresult (*GetFaultTolerancePort)(IMachine *pThis, PRUint32 *faultTolerancePort);
+    nsresult (*SetFaultTolerancePort)(IMachine *pThis, PRUint32 faultTolerancePort);
+
+    nsresult (*GetFaultToleranceAddress)(IMachine *pThis, PRUnichar * *faultToleranceAddress);
+    nsresult (*SetFaultToleranceAddress)(IMachine *pThis, PRUnichar * faultToleranceAddress);
+
+    nsresult (*GetFaultTolerancePassword)(IMachine *pThis, PRUnichar * *faultTolerancePassword);
+    nsresult (*SetFaultTolerancePassword)(IMachine *pThis, PRUnichar * faultTolerancePassword);
+
+    nsresult (*GetFaultToleranceSyncInterval)(IMachine *pThis, PRUint32 *faultToleranceSyncInterval);
+    nsresult (*SetFaultToleranceSyncInterval)(IMachine *pThis, PRUint32 faultToleranceSyncInterval);
+
+    nsresult (*GetRTCUseUTC)(IMachine *pThis, PRBool *RTCUseUTC);
+    nsresult (*SetRTCUseUTC)(IMachine *pThis, PRBool RTCUseUTC);
+
+    nsresult (*GetIOCacheEnabled)(IMachine *pThis, PRBool *IOCacheEnabled);
+    nsresult (*SetIOCacheEnabled)(IMachine *pThis, PRBool IOCacheEnabled);
+
+    nsresult (*GetIOCacheSize)(IMachine *pThis, PRUint32 *IOCacheSize);
+    nsresult (*SetIOCacheSize)(IMachine *pThis, PRUint32 IOCacheSize);
+
+    nsresult (*GetPCIDeviceAssignments)(IMachine *pThis, PRUint32 *PCIDeviceAssignmentsSize, IPCIDeviceAttachment * **PCIDeviceAssignments);
+
+    nsresult (*GetBandwidthControl)(IMachine *pThis, IBandwidthControl * *bandwidthControl);
+
+    nsresult (*GetTracingEnabled)(IMachine *pThis, PRBool *tracingEnabled);
+    nsresult (*SetTracingEnabled)(IMachine *pThis, PRBool tracingEnabled);
+
+    nsresult (*GetTracingConfig)(IMachine *pThis, PRUnichar * *tracingConfig);
+    nsresult (*SetTracingConfig)(IMachine *pThis, PRUnichar * tracingConfig);
+
+    nsresult (*GetAllowTracingToAccessVM)(IMachine *pThis, PRBool *allowTracingToAccessVM);
+    nsresult (*SetAllowTracingToAccessVM)(IMachine *pThis, PRBool allowTracingToAccessVM);
+
+    nsresult (*GetAutostartEnabled)(IMachine *pThis, PRBool *autostartEnabled);
+    nsresult (*SetAutostartEnabled)(IMachine *pThis, PRBool autostartEnabled);
+
+    nsresult (*GetAutostartDelay)(IMachine *pThis, PRUint32 *autostartDelay);
+    nsresult (*SetAutostartDelay)(IMachine *pThis, PRUint32 autostartDelay);
+
+    nsresult (*GetAutostopType)(IMachine *pThis, PRUint32 *autostopType);
+    nsresult (*SetAutostopType)(IMachine *pThis, PRUint32 autostopType);
+
+    nsresult (*GetDefaultFrontend)(IMachine *pThis, PRUnichar * *defaultFrontend);
+    nsresult (*SetDefaultFrontend)(IMachine *pThis, PRUnichar * defaultFrontend);
+
+    nsresult (*GetUSBProxyAvailable)(IMachine *pThis, PRBool *USBProxyAvailable);
+
+    nsresult (*LockMachine)(
+        IMachine *pThis,
+        ISession * session,
+        PRUint32 lockType
+    );
+
+    nsresult (*LaunchVMProcess)(
+        IMachine *pThis,
+        ISession * session,
+        PRUnichar * type,
+        PRUnichar * environment,
+        IProgress * * progress
+    );
+
+    nsresult (*SetBootOrder)(
+        IMachine *pThis,
+        PRUint32 position,
+        PRUint32 device
+    );
+
+    nsresult (*GetBootOrder)(
+        IMachine *pThis,
+        PRUint32 position,
+        PRUint32 * device
+    );
+
+    nsresult (*AttachDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRUint32 type,
+        IMedium * medium
+    );
+
+    nsresult (*AttachDeviceWithoutMedium)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRUint32 type
+    );
+
+    nsresult (*DetachDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device
+    );
+
+    nsresult (*PassthroughDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool passthrough
+    );
+
+    nsresult (*TemporaryEjectDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool temporaryEject
+    );
+
+    nsresult (*NonRotationalDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool nonRotational
+    );
+
+    nsresult (*SetAutoDiscardForDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool discard
+    );
+
+    nsresult (*SetHotPluggableForDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool hotPluggable
+    );
+
+    nsresult (*SetBandwidthGroupForDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IBandwidthGroup * bandwidthGroup
+    );
+
+    nsresult (*SetNoBandwidthGroupForDevice)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device
+    );
+
+    nsresult (*UnmountMedium)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        PRBool force
+    );
+
+    nsresult (*MountMedium)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IMedium * medium,
+        PRBool force
+    );
+
+    nsresult (*GetMedium)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IMedium * * medium
+    );
+
+    nsresult (*GetMediumAttachmentsOfController)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUint32 *mediumAttachmentsSize,
+        IMediumAttachment *** mediumAttachments
+    );
+
+    nsresult (*GetMediumAttachment)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRInt32 controllerPort,
+        PRInt32 device,
+        IMediumAttachment * * attachment
+    );
+
+    nsresult (*AttachHostPCIDevice)(
+        IMachine *pThis,
+        PRInt32 hostAddress,
+        PRInt32 desiredGuestAddress,
+        PRBool tryToUnbind
+    );
+
+    nsresult (*DetachHostPCIDevice)(
+        IMachine *pThis,
+        PRInt32 hostAddress
+    );
+
+    nsresult (*GetNetworkAdapter)(
+        IMachine *pThis,
+        PRUint32 slot,
+        INetworkAdapter * * adapter
+    );
+
+    nsresult (*AddStorageController)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUint32 connectionType,
+        IStorageController * * controller
+    );
+
+    nsresult (*GetStorageControllerByName)(
+        IMachine *pThis,
+        PRUnichar * name,
+        IStorageController * * storageController
+    );
+
+    nsresult (*GetStorageControllerByInstance)(
+        IMachine *pThis,
+        PRUint32 instance,
+        IStorageController * * storageController
+    );
+
+    nsresult (*RemoveStorageController)(
+        IMachine *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*SetStorageControllerBootable)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRBool bootable
+    );
+
+    nsresult (*AddUSBController)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUint32 type,
+        IUSBController * * controller
+    );
+
+    nsresult (*RemoveUSBController)(
+        IMachine *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*GetUSBControllerByName)(
+        IMachine *pThis,
+        PRUnichar * name,
+        IUSBController * * controller
+    );
+
+    nsresult (*GetUSBControllerCountByType)(
+        IMachine *pThis,
+        PRUint32 type,
+        PRUint32 * controllers
+    );
+
+    nsresult (*GetSerialPort)(
+        IMachine *pThis,
+        PRUint32 slot,
+        ISerialPort * * port
+    );
+
+    nsresult (*GetParallelPort)(
+        IMachine *pThis,
+        PRUint32 slot,
+        IParallelPort * * port
+    );
+
+    nsresult (*GetExtraDataKeys)(
+        IMachine *pThis,
+        PRUint32 *keysSize,
+        PRUnichar *** keys
+    );
+
+    nsresult (*GetExtraData)(
+        IMachine *pThis,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetExtraData)(
+        IMachine *pThis,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*GetCPUProperty)(
+        IMachine *pThis,
+        PRUint32 property,
+        PRBool * value
+    );
+
+    nsresult (*SetCPUProperty)(
+        IMachine *pThis,
+        PRUint32 property,
+        PRBool value
+    );
+
+    nsresult (*GetCPUIDLeaf)(
+        IMachine *pThis,
+        PRUint32 id,
+        PRUint32 * valEax,
+        PRUint32 * valEbx,
+        PRUint32 * valEcx,
+        PRUint32 * valEdx
+    );
+
+    nsresult (*SetCPUIDLeaf)(
+        IMachine *pThis,
+        PRUint32 id,
+        PRUint32 valEax,
+        PRUint32 valEbx,
+        PRUint32 valEcx,
+        PRUint32 valEdx
+    );
+
+    nsresult (*RemoveCPUIDLeaf)(
+        IMachine *pThis,
+        PRUint32 id
+    );
+
+    nsresult (*RemoveAllCPUIDLeaves)(IMachine *pThis );
+
+    nsresult (*GetHWVirtExProperty)(
+        IMachine *pThis,
+        PRUint32 property,
+        PRBool * value
+    );
+
+    nsresult (*SetHWVirtExProperty)(
+        IMachine *pThis,
+        PRUint32 property,
+        PRBool value
+    );
+
+    nsresult (*SetSettingsFilePath)(
+        IMachine *pThis,
+        PRUnichar * settingsFilePath,
+        IProgress * * progress
+    );
+
+    nsresult (*SaveSettings)(IMachine *pThis );
+
+    nsresult (*DiscardSettings)(IMachine *pThis );
+
+    nsresult (*Unregister)(
+        IMachine *pThis,
+        PRUint32 cleanupMode,
+        PRUint32 *mediaSize,
+        IMedium *** media
+    );
+
+    nsresult (*DeleteConfig)(
+        IMachine *pThis,
+        PRUint32 mediaSize,
+        IMedium ** media,
+        IProgress * * progress
+    );
+
+    nsresult (*ExportTo)(
+        IMachine *pThis,
+        IAppliance * appliance,
+        PRUnichar * location,
+        IVirtualSystemDescription * * description
+    );
+
+    nsresult (*FindSnapshot)(
+        IMachine *pThis,
+        PRUnichar * nameOrId,
+        ISnapshot * * snapshot
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable,
+        PRBool automount
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IMachine *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*CanShowConsoleWindow)(
+        IMachine *pThis,
+        PRBool * canShow
+    );
+
+    nsresult (*ShowConsoleWindow)(
+        IMachine *pThis,
+        PRInt64 * winId
+    );
+
+    nsresult (*GetGuestProperty)(
+        IMachine *pThis,
+        PRUnichar * name,
+        PRUnichar * * value,
+        PRInt64 * timestamp,
+        PRUnichar * * flags
+    );
+
+    nsresult (*GetGuestPropertyValue)(
+        IMachine *pThis,
+        PRUnichar * property,
+        PRUnichar * * value
+    );
+
+    nsresult (*GetGuestPropertyTimestamp)(
+        IMachine *pThis,
+        PRUnichar * property,
+        PRInt64 * value
+    );
+
+    nsresult (*SetGuestProperty)(
+        IMachine *pThis,
+        PRUnichar * property,
+        PRUnichar * value,
+        PRUnichar * flags
+    );
+
+    nsresult (*SetGuestPropertyValue)(
+        IMachine *pThis,
+        PRUnichar * property,
+        PRUnichar * value
+    );
+
+    nsresult (*DeleteGuestProperty)(
+        IMachine *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*EnumerateGuestProperties)(
+        IMachine *pThis,
+        PRUnichar * patterns,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *valuesSize,
+        PRUnichar *** values,
+        PRUint32 *timestampsSize,
+        PRInt64** timestamps,
+        PRUint32 *flagsSize,
+        PRUnichar *** flags
+    );
+
+    nsresult (*QuerySavedGuestScreenInfo)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * originX,
+        PRUint32 * originY,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRBool * enabled
+    );
+
+    nsresult (*QuerySavedThumbnailSize)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * size,
+        PRUint32 * width,
+        PRUint32 * height
+    );
+
+    nsresult (*ReadSavedThumbnailToArray)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRBool BGR,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*ReadSavedThumbnailPNGToArray)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*QuerySavedScreenshotPNGSize)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * size,
+        PRUint32 * width,
+        PRUint32 * height
+    );
+
+    nsresult (*ReadSavedScreenshotPNGToArray)(
+        IMachine *pThis,
+        PRUint32 screenId,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*HotPlugCPU)(
+        IMachine *pThis,
+        PRUint32 cpu
+    );
+
+    nsresult (*HotUnplugCPU)(
+        IMachine *pThis,
+        PRUint32 cpu
+    );
+
+    nsresult (*GetCPUStatus)(
+        IMachine *pThis,
+        PRUint32 cpu,
+        PRBool * attached
+    );
+
+    nsresult (*QueryLogFilename)(
+        IMachine *pThis,
+        PRUint32 idx,
+        PRUnichar * * filename
+    );
+
+    nsresult (*ReadLog)(
+        IMachine *pThis,
+        PRUint32 idx,
+        PRInt64 offset,
+        PRInt64 size,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*CloneTo)(
+        IMachine *pThis,
+        IMachine * target,
+        PRUint32 mode,
+        PRUint32 optionsSize,
+        PRUint32* options,
+        IProgress * * progress
+    );
+
+};
+#define IMachine_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMachine_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMachine_Release(p) ((p)->lpVtbl->Release(p))
+#define IMachine_get_Parent(p, aParent) ((p)->lpVtbl->GetParent(p, aParent))
+#define IMachine_GetParent(p, aParent) ((p)->lpVtbl->GetParent(p, aParent))
+#define IMachine_get_Icon(p, aIcon) ((p)->lpVtbl->GetIcon(p, aIcon))
+#define IMachine_GetIcon(p, aIcon) ((p)->lpVtbl->GetIcon(p, aIcon))
+#define IMachine_put_Icon(p, aIcon) ((p)->lpVtbl->SetIcon(p, aIcon))
+#define IMachine_SetIcon(p, aIcon) ((p)->lpVtbl->SetIcon(p, aIcon))
+#define IMachine_get_Accessible(p, aAccessible) ((p)->lpVtbl->GetAccessible(p, aAccessible))
+#define IMachine_GetAccessible(p, aAccessible) ((p)->lpVtbl->GetAccessible(p, aAccessible))
+#define IMachine_get_AccessError(p, aAccessError) ((p)->lpVtbl->GetAccessError(p, aAccessError))
+#define IMachine_GetAccessError(p, aAccessError) ((p)->lpVtbl->GetAccessError(p, aAccessError))
+#define IMachine_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IMachine_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IMachine_put_Name(p, aName) ((p)->lpVtbl->SetName(p, aName))
+#define IMachine_SetName(p, aName) ((p)->lpVtbl->SetName(p, aName))
+#define IMachine_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IMachine_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IMachine_put_Description(p, aDescription) ((p)->lpVtbl->SetDescription(p, aDescription))
+#define IMachine_SetDescription(p, aDescription) ((p)->lpVtbl->SetDescription(p, aDescription))
+#define IMachine_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IMachine_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IMachine_get_Groups(p, aGroups) ((p)->lpVtbl->GetGroups(p, aGroups))
+#define IMachine_GetGroups(p, aGroups) ((p)->lpVtbl->GetGroups(p, aGroups))
+#define IMachine_put_Groups(p, aGroups) ((p)->lpVtbl->SetGroups(p, aGroups))
+#define IMachine_SetGroups(p, aGroups) ((p)->lpVtbl->SetGroups(p, aGroups))
+#define IMachine_get_OSTypeId(p, aOSTypeId) ((p)->lpVtbl->GetOSTypeId(p, aOSTypeId))
+#define IMachine_GetOSTypeId(p, aOSTypeId) ((p)->lpVtbl->GetOSTypeId(p, aOSTypeId))
+#define IMachine_put_OSTypeId(p, aOSTypeId) ((p)->lpVtbl->SetOSTypeId(p, aOSTypeId))
+#define IMachine_SetOSTypeId(p, aOSTypeId) ((p)->lpVtbl->SetOSTypeId(p, aOSTypeId))
+#define IMachine_get_HardwareVersion(p, aHardwareVersion) ((p)->lpVtbl->GetHardwareVersion(p, aHardwareVersion))
+#define IMachine_GetHardwareVersion(p, aHardwareVersion) ((p)->lpVtbl->GetHardwareVersion(p, aHardwareVersion))
+#define IMachine_put_HardwareVersion(p, aHardwareVersion) ((p)->lpVtbl->SetHardwareVersion(p, aHardwareVersion))
+#define IMachine_SetHardwareVersion(p, aHardwareVersion) ((p)->lpVtbl->SetHardwareVersion(p, aHardwareVersion))
+#define IMachine_get_HardwareUUID(p, aHardwareUUID) ((p)->lpVtbl->GetHardwareUUID(p, aHardwareUUID))
+#define IMachine_GetHardwareUUID(p, aHardwareUUID) ((p)->lpVtbl->GetHardwareUUID(p, aHardwareUUID))
+#define IMachine_put_HardwareUUID(p, aHardwareUUID) ((p)->lpVtbl->SetHardwareUUID(p, aHardwareUUID))
+#define IMachine_SetHardwareUUID(p, aHardwareUUID) ((p)->lpVtbl->SetHardwareUUID(p, aHardwareUUID))
+#define IMachine_get_CPUCount(p, aCPUCount) ((p)->lpVtbl->GetCPUCount(p, aCPUCount))
+#define IMachine_GetCPUCount(p, aCPUCount) ((p)->lpVtbl->GetCPUCount(p, aCPUCount))
+#define IMachine_put_CPUCount(p, aCPUCount) ((p)->lpVtbl->SetCPUCount(p, aCPUCount))
+#define IMachine_SetCPUCount(p, aCPUCount) ((p)->lpVtbl->SetCPUCount(p, aCPUCount))
+#define IMachine_get_CPUHotPlugEnabled(p, aCPUHotPlugEnabled) ((p)->lpVtbl->GetCPUHotPlugEnabled(p, aCPUHotPlugEnabled))
+#define IMachine_GetCPUHotPlugEnabled(p, aCPUHotPlugEnabled) ((p)->lpVtbl->GetCPUHotPlugEnabled(p, aCPUHotPlugEnabled))
+#define IMachine_put_CPUHotPlugEnabled(p, aCPUHotPlugEnabled) ((p)->lpVtbl->SetCPUHotPlugEnabled(p, aCPUHotPlugEnabled))
+#define IMachine_SetCPUHotPlugEnabled(p, aCPUHotPlugEnabled) ((p)->lpVtbl->SetCPUHotPlugEnabled(p, aCPUHotPlugEnabled))
+#define IMachine_get_CPUExecutionCap(p, aCPUExecutionCap) ((p)->lpVtbl->GetCPUExecutionCap(p, aCPUExecutionCap))
+#define IMachine_GetCPUExecutionCap(p, aCPUExecutionCap) ((p)->lpVtbl->GetCPUExecutionCap(p, aCPUExecutionCap))
+#define IMachine_put_CPUExecutionCap(p, aCPUExecutionCap) ((p)->lpVtbl->SetCPUExecutionCap(p, aCPUExecutionCap))
+#define IMachine_SetCPUExecutionCap(p, aCPUExecutionCap) ((p)->lpVtbl->SetCPUExecutionCap(p, aCPUExecutionCap))
+#define IMachine_get_MemorySize(p, aMemorySize) ((p)->lpVtbl->GetMemorySize(p, aMemorySize))
+#define IMachine_GetMemorySize(p, aMemorySize) ((p)->lpVtbl->GetMemorySize(p, aMemorySize))
+#define IMachine_put_MemorySize(p, aMemorySize) ((p)->lpVtbl->SetMemorySize(p, aMemorySize))
+#define IMachine_SetMemorySize(p, aMemorySize) ((p)->lpVtbl->SetMemorySize(p, aMemorySize))
+#define IMachine_get_MemoryBalloonSize(p, aMemoryBalloonSize) ((p)->lpVtbl->GetMemoryBalloonSize(p, aMemoryBalloonSize))
+#define IMachine_GetMemoryBalloonSize(p, aMemoryBalloonSize) ((p)->lpVtbl->GetMemoryBalloonSize(p, aMemoryBalloonSize))
+#define IMachine_put_MemoryBalloonSize(p, aMemoryBalloonSize) ((p)->lpVtbl->SetMemoryBalloonSize(p, aMemoryBalloonSize))
+#define IMachine_SetMemoryBalloonSize(p, aMemoryBalloonSize) ((p)->lpVtbl->SetMemoryBalloonSize(p, aMemoryBalloonSize))
+#define IMachine_get_PageFusionEnabled(p, aPageFusionEnabled) ((p)->lpVtbl->GetPageFusionEnabled(p, aPageFusionEnabled))
+#define IMachine_GetPageFusionEnabled(p, aPageFusionEnabled) ((p)->lpVtbl->GetPageFusionEnabled(p, aPageFusionEnabled))
+#define IMachine_put_PageFusionEnabled(p, aPageFusionEnabled) ((p)->lpVtbl->SetPageFusionEnabled(p, aPageFusionEnabled))
+#define IMachine_SetPageFusionEnabled(p, aPageFusionEnabled) ((p)->lpVtbl->SetPageFusionEnabled(p, aPageFusionEnabled))
+#define IMachine_get_GraphicsControllerType(p, aGraphicsControllerType) ((p)->lpVtbl->GetGraphicsControllerType(p, aGraphicsControllerType))
+#define IMachine_GetGraphicsControllerType(p, aGraphicsControllerType) ((p)->lpVtbl->GetGraphicsControllerType(p, aGraphicsControllerType))
+#define IMachine_put_GraphicsControllerType(p, aGraphicsControllerType) ((p)->lpVtbl->SetGraphicsControllerType(p, aGraphicsControllerType))
+#define IMachine_SetGraphicsControllerType(p, aGraphicsControllerType) ((p)->lpVtbl->SetGraphicsControllerType(p, aGraphicsControllerType))
+#define IMachine_get_VRAMSize(p, aVRAMSize) ((p)->lpVtbl->GetVRAMSize(p, aVRAMSize))
+#define IMachine_GetVRAMSize(p, aVRAMSize) ((p)->lpVtbl->GetVRAMSize(p, aVRAMSize))
+#define IMachine_put_VRAMSize(p, aVRAMSize) ((p)->lpVtbl->SetVRAMSize(p, aVRAMSize))
+#define IMachine_SetVRAMSize(p, aVRAMSize) ((p)->lpVtbl->SetVRAMSize(p, aVRAMSize))
+#define IMachine_get_Accelerate3DEnabled(p, aAccelerate3DEnabled) ((p)->lpVtbl->GetAccelerate3DEnabled(p, aAccelerate3DEnabled))
+#define IMachine_GetAccelerate3DEnabled(p, aAccelerate3DEnabled) ((p)->lpVtbl->GetAccelerate3DEnabled(p, aAccelerate3DEnabled))
+#define IMachine_put_Accelerate3DEnabled(p, aAccelerate3DEnabled) ((p)->lpVtbl->SetAccelerate3DEnabled(p, aAccelerate3DEnabled))
+#define IMachine_SetAccelerate3DEnabled(p, aAccelerate3DEnabled) ((p)->lpVtbl->SetAccelerate3DEnabled(p, aAccelerate3DEnabled))
+#define IMachine_get_Accelerate2DVideoEnabled(p, aAccelerate2DVideoEnabled) ((p)->lpVtbl->GetAccelerate2DVideoEnabled(p, aAccelerate2DVideoEnabled))
+#define IMachine_GetAccelerate2DVideoEnabled(p, aAccelerate2DVideoEnabled) ((p)->lpVtbl->GetAccelerate2DVideoEnabled(p, aAccelerate2DVideoEnabled))
+#define IMachine_put_Accelerate2DVideoEnabled(p, aAccelerate2DVideoEnabled) ((p)->lpVtbl->SetAccelerate2DVideoEnabled(p, aAccelerate2DVideoEnabled))
+#define IMachine_SetAccelerate2DVideoEnabled(p, aAccelerate2DVideoEnabled) ((p)->lpVtbl->SetAccelerate2DVideoEnabled(p, aAccelerate2DVideoEnabled))
+#define IMachine_get_MonitorCount(p, aMonitorCount) ((p)->lpVtbl->GetMonitorCount(p, aMonitorCount))
+#define IMachine_GetMonitorCount(p, aMonitorCount) ((p)->lpVtbl->GetMonitorCount(p, aMonitorCount))
+#define IMachine_put_MonitorCount(p, aMonitorCount) ((p)->lpVtbl->SetMonitorCount(p, aMonitorCount))
+#define IMachine_SetMonitorCount(p, aMonitorCount) ((p)->lpVtbl->SetMonitorCount(p, aMonitorCount))
+#define IMachine_get_VideoCaptureEnabled(p, aVideoCaptureEnabled) ((p)->lpVtbl->GetVideoCaptureEnabled(p, aVideoCaptureEnabled))
+#define IMachine_GetVideoCaptureEnabled(p, aVideoCaptureEnabled) ((p)->lpVtbl->GetVideoCaptureEnabled(p, aVideoCaptureEnabled))
+#define IMachine_put_VideoCaptureEnabled(p, aVideoCaptureEnabled) ((p)->lpVtbl->SetVideoCaptureEnabled(p, aVideoCaptureEnabled))
+#define IMachine_SetVideoCaptureEnabled(p, aVideoCaptureEnabled) ((p)->lpVtbl->SetVideoCaptureEnabled(p, aVideoCaptureEnabled))
+#define IMachine_get_VideoCaptureScreens(p, aVideoCaptureScreens) ((p)->lpVtbl->GetVideoCaptureScreens(p, aVideoCaptureScreens))
+#define IMachine_GetVideoCaptureScreens(p, aVideoCaptureScreens) ((p)->lpVtbl->GetVideoCaptureScreens(p, aVideoCaptureScreens))
+#define IMachine_put_VideoCaptureScreens(p, aVideoCaptureScreens) ((p)->lpVtbl->SetVideoCaptureScreens(p, aVideoCaptureScreens))
+#define IMachine_SetVideoCaptureScreens(p, aVideoCaptureScreens) ((p)->lpVtbl->SetVideoCaptureScreens(p, aVideoCaptureScreens))
+#define IMachine_get_VideoCaptureFile(p, aVideoCaptureFile) ((p)->lpVtbl->GetVideoCaptureFile(p, aVideoCaptureFile))
+#define IMachine_GetVideoCaptureFile(p, aVideoCaptureFile) ((p)->lpVtbl->GetVideoCaptureFile(p, aVideoCaptureFile))
+#define IMachine_put_VideoCaptureFile(p, aVideoCaptureFile) ((p)->lpVtbl->SetVideoCaptureFile(p, aVideoCaptureFile))
+#define IMachine_SetVideoCaptureFile(p, aVideoCaptureFile) ((p)->lpVtbl->SetVideoCaptureFile(p, aVideoCaptureFile))
+#define IMachine_get_VideoCaptureWidth(p, aVideoCaptureWidth) ((p)->lpVtbl->GetVideoCaptureWidth(p, aVideoCaptureWidth))
+#define IMachine_GetVideoCaptureWidth(p, aVideoCaptureWidth) ((p)->lpVtbl->GetVideoCaptureWidth(p, aVideoCaptureWidth))
+#define IMachine_put_VideoCaptureWidth(p, aVideoCaptureWidth) ((p)->lpVtbl->SetVideoCaptureWidth(p, aVideoCaptureWidth))
+#define IMachine_SetVideoCaptureWidth(p, aVideoCaptureWidth) ((p)->lpVtbl->SetVideoCaptureWidth(p, aVideoCaptureWidth))
+#define IMachine_get_VideoCaptureHeight(p, aVideoCaptureHeight) ((p)->lpVtbl->GetVideoCaptureHeight(p, aVideoCaptureHeight))
+#define IMachine_GetVideoCaptureHeight(p, aVideoCaptureHeight) ((p)->lpVtbl->GetVideoCaptureHeight(p, aVideoCaptureHeight))
+#define IMachine_put_VideoCaptureHeight(p, aVideoCaptureHeight) ((p)->lpVtbl->SetVideoCaptureHeight(p, aVideoCaptureHeight))
+#define IMachine_SetVideoCaptureHeight(p, aVideoCaptureHeight) ((p)->lpVtbl->SetVideoCaptureHeight(p, aVideoCaptureHeight))
+#define IMachine_get_VideoCaptureRate(p, aVideoCaptureRate) ((p)->lpVtbl->GetVideoCaptureRate(p, aVideoCaptureRate))
+#define IMachine_GetVideoCaptureRate(p, aVideoCaptureRate) ((p)->lpVtbl->GetVideoCaptureRate(p, aVideoCaptureRate))
+#define IMachine_put_VideoCaptureRate(p, aVideoCaptureRate) ((p)->lpVtbl->SetVideoCaptureRate(p, aVideoCaptureRate))
+#define IMachine_SetVideoCaptureRate(p, aVideoCaptureRate) ((p)->lpVtbl->SetVideoCaptureRate(p, aVideoCaptureRate))
+#define IMachine_get_VideoCaptureFPS(p, aVideoCaptureFPS) ((p)->lpVtbl->GetVideoCaptureFPS(p, aVideoCaptureFPS))
+#define IMachine_GetVideoCaptureFPS(p, aVideoCaptureFPS) ((p)->lpVtbl->GetVideoCaptureFPS(p, aVideoCaptureFPS))
+#define IMachine_put_VideoCaptureFPS(p, aVideoCaptureFPS) ((p)->lpVtbl->SetVideoCaptureFPS(p, aVideoCaptureFPS))
+#define IMachine_SetVideoCaptureFPS(p, aVideoCaptureFPS) ((p)->lpVtbl->SetVideoCaptureFPS(p, aVideoCaptureFPS))
+#define IMachine_get_BIOSSettings(p, aBIOSSettings) ((p)->lpVtbl->GetBIOSSettings(p, aBIOSSettings))
+#define IMachine_GetBIOSSettings(p, aBIOSSettings) ((p)->lpVtbl->GetBIOSSettings(p, aBIOSSettings))
+#define IMachine_get_FirmwareType(p, aFirmwareType) ((p)->lpVtbl->GetFirmwareType(p, aFirmwareType))
+#define IMachine_GetFirmwareType(p, aFirmwareType) ((p)->lpVtbl->GetFirmwareType(p, aFirmwareType))
+#define IMachine_put_FirmwareType(p, aFirmwareType) ((p)->lpVtbl->SetFirmwareType(p, aFirmwareType))
+#define IMachine_SetFirmwareType(p, aFirmwareType) ((p)->lpVtbl->SetFirmwareType(p, aFirmwareType))
+#define IMachine_get_PointingHIDType(p, aPointingHIDType) ((p)->lpVtbl->GetPointingHIDType(p, aPointingHIDType))
+#define IMachine_GetPointingHIDType(p, aPointingHIDType) ((p)->lpVtbl->GetPointingHIDType(p, aPointingHIDType))
+#define IMachine_put_PointingHIDType(p, aPointingHIDType) ((p)->lpVtbl->SetPointingHIDType(p, aPointingHIDType))
+#define IMachine_SetPointingHIDType(p, aPointingHIDType) ((p)->lpVtbl->SetPointingHIDType(p, aPointingHIDType))
+#define IMachine_get_KeyboardHIDType(p, aKeyboardHIDType) ((p)->lpVtbl->GetKeyboardHIDType(p, aKeyboardHIDType))
+#define IMachine_GetKeyboardHIDType(p, aKeyboardHIDType) ((p)->lpVtbl->GetKeyboardHIDType(p, aKeyboardHIDType))
+#define IMachine_put_KeyboardHIDType(p, aKeyboardHIDType) ((p)->lpVtbl->SetKeyboardHIDType(p, aKeyboardHIDType))
+#define IMachine_SetKeyboardHIDType(p, aKeyboardHIDType) ((p)->lpVtbl->SetKeyboardHIDType(p, aKeyboardHIDType))
+#define IMachine_get_HPETEnabled(p, aHPETEnabled) ((p)->lpVtbl->GetHPETEnabled(p, aHPETEnabled))
+#define IMachine_GetHPETEnabled(p, aHPETEnabled) ((p)->lpVtbl->GetHPETEnabled(p, aHPETEnabled))
+#define IMachine_put_HPETEnabled(p, aHPETEnabled) ((p)->lpVtbl->SetHPETEnabled(p, aHPETEnabled))
+#define IMachine_SetHPETEnabled(p, aHPETEnabled) ((p)->lpVtbl->SetHPETEnabled(p, aHPETEnabled))
+#define IMachine_get_ChipsetType(p, aChipsetType) ((p)->lpVtbl->GetChipsetType(p, aChipsetType))
+#define IMachine_GetChipsetType(p, aChipsetType) ((p)->lpVtbl->GetChipsetType(p, aChipsetType))
+#define IMachine_put_ChipsetType(p, aChipsetType) ((p)->lpVtbl->SetChipsetType(p, aChipsetType))
+#define IMachine_SetChipsetType(p, aChipsetType) ((p)->lpVtbl->SetChipsetType(p, aChipsetType))
+#define IMachine_get_SnapshotFolder(p, aSnapshotFolder) ((p)->lpVtbl->GetSnapshotFolder(p, aSnapshotFolder))
+#define IMachine_GetSnapshotFolder(p, aSnapshotFolder) ((p)->lpVtbl->GetSnapshotFolder(p, aSnapshotFolder))
+#define IMachine_put_SnapshotFolder(p, aSnapshotFolder) ((p)->lpVtbl->SetSnapshotFolder(p, aSnapshotFolder))
+#define IMachine_SetSnapshotFolder(p, aSnapshotFolder) ((p)->lpVtbl->SetSnapshotFolder(p, aSnapshotFolder))
+#define IMachine_get_VRDEServer(p, aVRDEServer) ((p)->lpVtbl->GetVRDEServer(p, aVRDEServer))
+#define IMachine_GetVRDEServer(p, aVRDEServer) ((p)->lpVtbl->GetVRDEServer(p, aVRDEServer))
+#define IMachine_get_EmulatedUSBCardReaderEnabled(p, aEmulatedUSBCardReaderEnabled) ((p)->lpVtbl->GetEmulatedUSBCardReaderEnabled(p, aEmulatedUSBCardReaderEnabled))
+#define IMachine_GetEmulatedUSBCardReaderEnabled(p, aEmulatedUSBCardReaderEnabled) ((p)->lpVtbl->GetEmulatedUSBCardReaderEnabled(p, aEmulatedUSBCardReaderEnabled))
+#define IMachine_put_EmulatedUSBCardReaderEnabled(p, aEmulatedUSBCardReaderEnabled) ((p)->lpVtbl->SetEmulatedUSBCardReaderEnabled(p, aEmulatedUSBCardReaderEnabled))
+#define IMachine_SetEmulatedUSBCardReaderEnabled(p, aEmulatedUSBCardReaderEnabled) ((p)->lpVtbl->SetEmulatedUSBCardReaderEnabled(p, aEmulatedUSBCardReaderEnabled))
+#define IMachine_get_MediumAttachments(p, aMediumAttachments) ((p)->lpVtbl->GetMediumAttachments(p, aMediumAttachments))
+#define IMachine_GetMediumAttachments(p, aMediumAttachments) ((p)->lpVtbl->GetMediumAttachments(p, aMediumAttachments))
+#define IMachine_get_USBControllers(p, aUSBControllers) ((p)->lpVtbl->GetUSBControllers(p, aUSBControllers))
+#define IMachine_GetUSBControllers(p, aUSBControllers) ((p)->lpVtbl->GetUSBControllers(p, aUSBControllers))
+#define IMachine_get_USBDeviceFilters(p, aUSBDeviceFilters) ((p)->lpVtbl->GetUSBDeviceFilters(p, aUSBDeviceFilters))
+#define IMachine_GetUSBDeviceFilters(p, aUSBDeviceFilters) ((p)->lpVtbl->GetUSBDeviceFilters(p, aUSBDeviceFilters))
+#define IMachine_get_AudioAdapter(p, aAudioAdapter) ((p)->lpVtbl->GetAudioAdapter(p, aAudioAdapter))
+#define IMachine_GetAudioAdapter(p, aAudioAdapter) ((p)->lpVtbl->GetAudioAdapter(p, aAudioAdapter))
+#define IMachine_get_StorageControllers(p, aStorageControllers) ((p)->lpVtbl->GetStorageControllers(p, aStorageControllers))
+#define IMachine_GetStorageControllers(p, aStorageControllers) ((p)->lpVtbl->GetStorageControllers(p, aStorageControllers))
+#define IMachine_get_SettingsFilePath(p, aSettingsFilePath) ((p)->lpVtbl->GetSettingsFilePath(p, aSettingsFilePath))
+#define IMachine_GetSettingsFilePath(p, aSettingsFilePath) ((p)->lpVtbl->GetSettingsFilePath(p, aSettingsFilePath))
+#define IMachine_get_SettingsModified(p, aSettingsModified) ((p)->lpVtbl->GetSettingsModified(p, aSettingsModified))
+#define IMachine_GetSettingsModified(p, aSettingsModified) ((p)->lpVtbl->GetSettingsModified(p, aSettingsModified))
+#define IMachine_get_SessionState(p, aSessionState) ((p)->lpVtbl->GetSessionState(p, aSessionState))
+#define IMachine_GetSessionState(p, aSessionState) ((p)->lpVtbl->GetSessionState(p, aSessionState))
+#define IMachine_get_SessionType(p, aSessionType) ((p)->lpVtbl->GetSessionType(p, aSessionType))
+#define IMachine_GetSessionType(p, aSessionType) ((p)->lpVtbl->GetSessionType(p, aSessionType))
+#define IMachine_get_SessionPID(p, aSessionPID) ((p)->lpVtbl->GetSessionPID(p, aSessionPID))
+#define IMachine_GetSessionPID(p, aSessionPID) ((p)->lpVtbl->GetSessionPID(p, aSessionPID))
+#define IMachine_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IMachine_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IMachine_get_LastStateChange(p, aLastStateChange) ((p)->lpVtbl->GetLastStateChange(p, aLastStateChange))
+#define IMachine_GetLastStateChange(p, aLastStateChange) ((p)->lpVtbl->GetLastStateChange(p, aLastStateChange))
+#define IMachine_get_StateFilePath(p, aStateFilePath) ((p)->lpVtbl->GetStateFilePath(p, aStateFilePath))
+#define IMachine_GetStateFilePath(p, aStateFilePath) ((p)->lpVtbl->GetStateFilePath(p, aStateFilePath))
+#define IMachine_get_LogFolder(p, aLogFolder) ((p)->lpVtbl->GetLogFolder(p, aLogFolder))
+#define IMachine_GetLogFolder(p, aLogFolder) ((p)->lpVtbl->GetLogFolder(p, aLogFolder))
+#define IMachine_get_CurrentSnapshot(p, aCurrentSnapshot) ((p)->lpVtbl->GetCurrentSnapshot(p, aCurrentSnapshot))
+#define IMachine_GetCurrentSnapshot(p, aCurrentSnapshot) ((p)->lpVtbl->GetCurrentSnapshot(p, aCurrentSnapshot))
+#define IMachine_get_SnapshotCount(p, aSnapshotCount) ((p)->lpVtbl->GetSnapshotCount(p, aSnapshotCount))
+#define IMachine_GetSnapshotCount(p, aSnapshotCount) ((p)->lpVtbl->GetSnapshotCount(p, aSnapshotCount))
+#define IMachine_get_CurrentStateModified(p, aCurrentStateModified) ((p)->lpVtbl->GetCurrentStateModified(p, aCurrentStateModified))
+#define IMachine_GetCurrentStateModified(p, aCurrentStateModified) ((p)->lpVtbl->GetCurrentStateModified(p, aCurrentStateModified))
+#define IMachine_get_SharedFolders(p, aSharedFolders) ((p)->lpVtbl->GetSharedFolders(p, aSharedFolders))
+#define IMachine_GetSharedFolders(p, aSharedFolders) ((p)->lpVtbl->GetSharedFolders(p, aSharedFolders))
+#define IMachine_get_ClipboardMode(p, aClipboardMode) ((p)->lpVtbl->GetClipboardMode(p, aClipboardMode))
+#define IMachine_GetClipboardMode(p, aClipboardMode) ((p)->lpVtbl->GetClipboardMode(p, aClipboardMode))
+#define IMachine_put_ClipboardMode(p, aClipboardMode) ((p)->lpVtbl->SetClipboardMode(p, aClipboardMode))
+#define IMachine_SetClipboardMode(p, aClipboardMode) ((p)->lpVtbl->SetClipboardMode(p, aClipboardMode))
+#define IMachine_get_DragAndDropMode(p, aDragAndDropMode) ((p)->lpVtbl->GetDragAndDropMode(p, aDragAndDropMode))
+#define IMachine_GetDragAndDropMode(p, aDragAndDropMode) ((p)->lpVtbl->GetDragAndDropMode(p, aDragAndDropMode))
+#define IMachine_put_DragAndDropMode(p, aDragAndDropMode) ((p)->lpVtbl->SetDragAndDropMode(p, aDragAndDropMode))
+#define IMachine_SetDragAndDropMode(p, aDragAndDropMode) ((p)->lpVtbl->SetDragAndDropMode(p, aDragAndDropMode))
+#define IMachine_get_GuestPropertyNotificationPatterns(p, aGuestPropertyNotificationPatterns) ((p)->lpVtbl->GetGuestPropertyNotificationPatterns(p, aGuestPropertyNotificationPatterns))
+#define IMachine_GetGuestPropertyNotificationPatterns(p, aGuestPropertyNotificationPatterns) ((p)->lpVtbl->GetGuestPropertyNotificationPatterns(p, aGuestPropertyNotificationPatterns))
+#define IMachine_put_GuestPropertyNotificationPatterns(p, aGuestPropertyNotificationPatterns) ((p)->lpVtbl->SetGuestPropertyNotificationPatterns(p, aGuestPropertyNotificationPatterns))
+#define IMachine_SetGuestPropertyNotificationPatterns(p, aGuestPropertyNotificationPatterns) ((p)->lpVtbl->SetGuestPropertyNotificationPatterns(p, aGuestPropertyNotificationPatterns))
+#define IMachine_get_TeleporterEnabled(p, aTeleporterEnabled) ((p)->lpVtbl->GetTeleporterEnabled(p, aTeleporterEnabled))
+#define IMachine_GetTeleporterEnabled(p, aTeleporterEnabled) ((p)->lpVtbl->GetTeleporterEnabled(p, aTeleporterEnabled))
+#define IMachine_put_TeleporterEnabled(p, aTeleporterEnabled) ((p)->lpVtbl->SetTeleporterEnabled(p, aTeleporterEnabled))
+#define IMachine_SetTeleporterEnabled(p, aTeleporterEnabled) ((p)->lpVtbl->SetTeleporterEnabled(p, aTeleporterEnabled))
+#define IMachine_get_TeleporterPort(p, aTeleporterPort) ((p)->lpVtbl->GetTeleporterPort(p, aTeleporterPort))
+#define IMachine_GetTeleporterPort(p, aTeleporterPort) ((p)->lpVtbl->GetTeleporterPort(p, aTeleporterPort))
+#define IMachine_put_TeleporterPort(p, aTeleporterPort) ((p)->lpVtbl->SetTeleporterPort(p, aTeleporterPort))
+#define IMachine_SetTeleporterPort(p, aTeleporterPort) ((p)->lpVtbl->SetTeleporterPort(p, aTeleporterPort))
+#define IMachine_get_TeleporterAddress(p, aTeleporterAddress) ((p)->lpVtbl->GetTeleporterAddress(p, aTeleporterAddress))
+#define IMachine_GetTeleporterAddress(p, aTeleporterAddress) ((p)->lpVtbl->GetTeleporterAddress(p, aTeleporterAddress))
+#define IMachine_put_TeleporterAddress(p, aTeleporterAddress) ((p)->lpVtbl->SetTeleporterAddress(p, aTeleporterAddress))
+#define IMachine_SetTeleporterAddress(p, aTeleporterAddress) ((p)->lpVtbl->SetTeleporterAddress(p, aTeleporterAddress))
+#define IMachine_get_TeleporterPassword(p, aTeleporterPassword) ((p)->lpVtbl->GetTeleporterPassword(p, aTeleporterPassword))
+#define IMachine_GetTeleporterPassword(p, aTeleporterPassword) ((p)->lpVtbl->GetTeleporterPassword(p, aTeleporterPassword))
+#define IMachine_put_TeleporterPassword(p, aTeleporterPassword) ((p)->lpVtbl->SetTeleporterPassword(p, aTeleporterPassword))
+#define IMachine_SetTeleporterPassword(p, aTeleporterPassword) ((p)->lpVtbl->SetTeleporterPassword(p, aTeleporterPassword))
+#define IMachine_get_FaultToleranceState(p, aFaultToleranceState) ((p)->lpVtbl->GetFaultToleranceState(p, aFaultToleranceState))
+#define IMachine_GetFaultToleranceState(p, aFaultToleranceState) ((p)->lpVtbl->GetFaultToleranceState(p, aFaultToleranceState))
+#define IMachine_put_FaultToleranceState(p, aFaultToleranceState) ((p)->lpVtbl->SetFaultToleranceState(p, aFaultToleranceState))
+#define IMachine_SetFaultToleranceState(p, aFaultToleranceState) ((p)->lpVtbl->SetFaultToleranceState(p, aFaultToleranceState))
+#define IMachine_get_FaultTolerancePort(p, aFaultTolerancePort) ((p)->lpVtbl->GetFaultTolerancePort(p, aFaultTolerancePort))
+#define IMachine_GetFaultTolerancePort(p, aFaultTolerancePort) ((p)->lpVtbl->GetFaultTolerancePort(p, aFaultTolerancePort))
+#define IMachine_put_FaultTolerancePort(p, aFaultTolerancePort) ((p)->lpVtbl->SetFaultTolerancePort(p, aFaultTolerancePort))
+#define IMachine_SetFaultTolerancePort(p, aFaultTolerancePort) ((p)->lpVtbl->SetFaultTolerancePort(p, aFaultTolerancePort))
+#define IMachine_get_FaultToleranceAddress(p, aFaultToleranceAddress) ((p)->lpVtbl->GetFaultToleranceAddress(p, aFaultToleranceAddress))
+#define IMachine_GetFaultToleranceAddress(p, aFaultToleranceAddress) ((p)->lpVtbl->GetFaultToleranceAddress(p, aFaultToleranceAddress))
+#define IMachine_put_FaultToleranceAddress(p, aFaultToleranceAddress) ((p)->lpVtbl->SetFaultToleranceAddress(p, aFaultToleranceAddress))
+#define IMachine_SetFaultToleranceAddress(p, aFaultToleranceAddress) ((p)->lpVtbl->SetFaultToleranceAddress(p, aFaultToleranceAddress))
+#define IMachine_get_FaultTolerancePassword(p, aFaultTolerancePassword) ((p)->lpVtbl->GetFaultTolerancePassword(p, aFaultTolerancePassword))
+#define IMachine_GetFaultTolerancePassword(p, aFaultTolerancePassword) ((p)->lpVtbl->GetFaultTolerancePassword(p, aFaultTolerancePassword))
+#define IMachine_put_FaultTolerancePassword(p, aFaultTolerancePassword) ((p)->lpVtbl->SetFaultTolerancePassword(p, aFaultTolerancePassword))
+#define IMachine_SetFaultTolerancePassword(p, aFaultTolerancePassword) ((p)->lpVtbl->SetFaultTolerancePassword(p, aFaultTolerancePassword))
+#define IMachine_get_FaultToleranceSyncInterval(p, aFaultToleranceSyncInterval) ((p)->lpVtbl->GetFaultToleranceSyncInterval(p, aFaultToleranceSyncInterval))
+#define IMachine_GetFaultToleranceSyncInterval(p, aFaultToleranceSyncInterval) ((p)->lpVtbl->GetFaultToleranceSyncInterval(p, aFaultToleranceSyncInterval))
+#define IMachine_put_FaultToleranceSyncInterval(p, aFaultToleranceSyncInterval) ((p)->lpVtbl->SetFaultToleranceSyncInterval(p, aFaultToleranceSyncInterval))
+#define IMachine_SetFaultToleranceSyncInterval(p, aFaultToleranceSyncInterval) ((p)->lpVtbl->SetFaultToleranceSyncInterval(p, aFaultToleranceSyncInterval))
+#define IMachine_get_RTCUseUTC(p, aRTCUseUTC) ((p)->lpVtbl->GetRTCUseUTC(p, aRTCUseUTC))
+#define IMachine_GetRTCUseUTC(p, aRTCUseUTC) ((p)->lpVtbl->GetRTCUseUTC(p, aRTCUseUTC))
+#define IMachine_put_RTCUseUTC(p, aRTCUseUTC) ((p)->lpVtbl->SetRTCUseUTC(p, aRTCUseUTC))
+#define IMachine_SetRTCUseUTC(p, aRTCUseUTC) ((p)->lpVtbl->SetRTCUseUTC(p, aRTCUseUTC))
+#define IMachine_get_IOCacheEnabled(p, aIOCacheEnabled) ((p)->lpVtbl->GetIOCacheEnabled(p, aIOCacheEnabled))
+#define IMachine_GetIOCacheEnabled(p, aIOCacheEnabled) ((p)->lpVtbl->GetIOCacheEnabled(p, aIOCacheEnabled))
+#define IMachine_put_IOCacheEnabled(p, aIOCacheEnabled) ((p)->lpVtbl->SetIOCacheEnabled(p, aIOCacheEnabled))
+#define IMachine_SetIOCacheEnabled(p, aIOCacheEnabled) ((p)->lpVtbl->SetIOCacheEnabled(p, aIOCacheEnabled))
+#define IMachine_get_IOCacheSize(p, aIOCacheSize) ((p)->lpVtbl->GetIOCacheSize(p, aIOCacheSize))
+#define IMachine_GetIOCacheSize(p, aIOCacheSize) ((p)->lpVtbl->GetIOCacheSize(p, aIOCacheSize))
+#define IMachine_put_IOCacheSize(p, aIOCacheSize) ((p)->lpVtbl->SetIOCacheSize(p, aIOCacheSize))
+#define IMachine_SetIOCacheSize(p, aIOCacheSize) ((p)->lpVtbl->SetIOCacheSize(p, aIOCacheSize))
+#define IMachine_get_PCIDeviceAssignments(p, aPCIDeviceAssignments) ((p)->lpVtbl->GetPCIDeviceAssignments(p, aPCIDeviceAssignments))
+#define IMachine_GetPCIDeviceAssignments(p, aPCIDeviceAssignments) ((p)->lpVtbl->GetPCIDeviceAssignments(p, aPCIDeviceAssignments))
+#define IMachine_get_BandwidthControl(p, aBandwidthControl) ((p)->lpVtbl->GetBandwidthControl(p, aBandwidthControl))
+#define IMachine_GetBandwidthControl(p, aBandwidthControl) ((p)->lpVtbl->GetBandwidthControl(p, aBandwidthControl))
+#define IMachine_get_TracingEnabled(p, aTracingEnabled) ((p)->lpVtbl->GetTracingEnabled(p, aTracingEnabled))
+#define IMachine_GetTracingEnabled(p, aTracingEnabled) ((p)->lpVtbl->GetTracingEnabled(p, aTracingEnabled))
+#define IMachine_put_TracingEnabled(p, aTracingEnabled) ((p)->lpVtbl->SetTracingEnabled(p, aTracingEnabled))
+#define IMachine_SetTracingEnabled(p, aTracingEnabled) ((p)->lpVtbl->SetTracingEnabled(p, aTracingEnabled))
+#define IMachine_get_TracingConfig(p, aTracingConfig) ((p)->lpVtbl->GetTracingConfig(p, aTracingConfig))
+#define IMachine_GetTracingConfig(p, aTracingConfig) ((p)->lpVtbl->GetTracingConfig(p, aTracingConfig))
+#define IMachine_put_TracingConfig(p, aTracingConfig) ((p)->lpVtbl->SetTracingConfig(p, aTracingConfig))
+#define IMachine_SetTracingConfig(p, aTracingConfig) ((p)->lpVtbl->SetTracingConfig(p, aTracingConfig))
+#define IMachine_get_AllowTracingToAccessVM(p, aAllowTracingToAccessVM) ((p)->lpVtbl->GetAllowTracingToAccessVM(p, aAllowTracingToAccessVM))
+#define IMachine_GetAllowTracingToAccessVM(p, aAllowTracingToAccessVM) ((p)->lpVtbl->GetAllowTracingToAccessVM(p, aAllowTracingToAccessVM))
+#define IMachine_put_AllowTracingToAccessVM(p, aAllowTracingToAccessVM) ((p)->lpVtbl->SetAllowTracingToAccessVM(p, aAllowTracingToAccessVM))
+#define IMachine_SetAllowTracingToAccessVM(p, aAllowTracingToAccessVM) ((p)->lpVtbl->SetAllowTracingToAccessVM(p, aAllowTracingToAccessVM))
+#define IMachine_get_AutostartEnabled(p, aAutostartEnabled) ((p)->lpVtbl->GetAutostartEnabled(p, aAutostartEnabled))
+#define IMachine_GetAutostartEnabled(p, aAutostartEnabled) ((p)->lpVtbl->GetAutostartEnabled(p, aAutostartEnabled))
+#define IMachine_put_AutostartEnabled(p, aAutostartEnabled) ((p)->lpVtbl->SetAutostartEnabled(p, aAutostartEnabled))
+#define IMachine_SetAutostartEnabled(p, aAutostartEnabled) ((p)->lpVtbl->SetAutostartEnabled(p, aAutostartEnabled))
+#define IMachine_get_AutostartDelay(p, aAutostartDelay) ((p)->lpVtbl->GetAutostartDelay(p, aAutostartDelay))
+#define IMachine_GetAutostartDelay(p, aAutostartDelay) ((p)->lpVtbl->GetAutostartDelay(p, aAutostartDelay))
+#define IMachine_put_AutostartDelay(p, aAutostartDelay) ((p)->lpVtbl->SetAutostartDelay(p, aAutostartDelay))
+#define IMachine_SetAutostartDelay(p, aAutostartDelay) ((p)->lpVtbl->SetAutostartDelay(p, aAutostartDelay))
+#define IMachine_get_AutostopType(p, aAutostopType) ((p)->lpVtbl->GetAutostopType(p, aAutostopType))
+#define IMachine_GetAutostopType(p, aAutostopType) ((p)->lpVtbl->GetAutostopType(p, aAutostopType))
+#define IMachine_put_AutostopType(p, aAutostopType) ((p)->lpVtbl->SetAutostopType(p, aAutostopType))
+#define IMachine_SetAutostopType(p, aAutostopType) ((p)->lpVtbl->SetAutostopType(p, aAutostopType))
+#define IMachine_get_DefaultFrontend(p, aDefaultFrontend) ((p)->lpVtbl->GetDefaultFrontend(p, aDefaultFrontend))
+#define IMachine_GetDefaultFrontend(p, aDefaultFrontend) ((p)->lpVtbl->GetDefaultFrontend(p, aDefaultFrontend))
+#define IMachine_put_DefaultFrontend(p, aDefaultFrontend) ((p)->lpVtbl->SetDefaultFrontend(p, aDefaultFrontend))
+#define IMachine_SetDefaultFrontend(p, aDefaultFrontend) ((p)->lpVtbl->SetDefaultFrontend(p, aDefaultFrontend))
+#define IMachine_get_USBProxyAvailable(p, aUSBProxyAvailable) ((p)->lpVtbl->GetUSBProxyAvailable(p, aUSBProxyAvailable))
+#define IMachine_GetUSBProxyAvailable(p, aUSBProxyAvailable) ((p)->lpVtbl->GetUSBProxyAvailable(p, aUSBProxyAvailable))
+#define IMachine_LockMachine(p, aSession, aLockType) ((p)->lpVtbl->LockMachine(p, aSession, aLockType))
+#define IMachine_LaunchVMProcess(p, aSession, aType, aEnvironment, aProgress) ((p)->lpVtbl->LaunchVMProcess(p, aSession, aType, aEnvironment, aProgress))
+#define IMachine_SetBootOrder(p, aPosition, aDevice) ((p)->lpVtbl->SetBootOrder(p, aPosition, aDevice))
+#define IMachine_GetBootOrder(p, aPosition, aDevice) ((p)->lpVtbl->GetBootOrder(p, aPosition, aDevice))
+#define IMachine_AttachDevice(p, aName, aControllerPort, aDevice, aType, aMedium) ((p)->lpVtbl->AttachDevice(p, aName, aControllerPort, aDevice, aType, aMedium))
+#define IMachine_AttachDeviceWithoutMedium(p, aName, aControllerPort, aDevice, aType) ((p)->lpVtbl->AttachDeviceWithoutMedium(p, aName, aControllerPort, aDevice, aType))
+#define IMachine_DetachDevice(p, aName, aControllerPort, aDevice) ((p)->lpVtbl->DetachDevice(p, aName, aControllerPort, aDevice))
+#define IMachine_PassthroughDevice(p, aName, aControllerPort, aDevice, aPassthrough) ((p)->lpVtbl->PassthroughDevice(p, aName, aControllerPort, aDevice, aPassthrough))
+#define IMachine_TemporaryEjectDevice(p, aName, aControllerPort, aDevice, aTemporaryEject) ((p)->lpVtbl->TemporaryEjectDevice(p, aName, aControllerPort, aDevice, aTemporaryEject))
+#define IMachine_NonRotationalDevice(p, aName, aControllerPort, aDevice, aNonRotational) ((p)->lpVtbl->NonRotationalDevice(p, aName, aControllerPort, aDevice, aNonRotational))
+#define IMachine_SetAutoDiscardForDevice(p, aName, aControllerPort, aDevice, aDiscard) ((p)->lpVtbl->SetAutoDiscardForDevice(p, aName, aControllerPort, aDevice, aDiscard))
+#define IMachine_SetHotPluggableForDevice(p, aName, aControllerPort, aDevice, aHotPluggable) ((p)->lpVtbl->SetHotPluggableForDevice(p, aName, aControllerPort, aDevice, aHotPluggable))
+#define IMachine_SetBandwidthGroupForDevice(p, aName, aControllerPort, aDevice, aBandwidthGroup) ((p)->lpVtbl->SetBandwidthGroupForDevice(p, aName, aControllerPort, aDevice, aBandwidthGroup))
+#define IMachine_SetNoBandwidthGroupForDevice(p, aName, aControllerPort, aDevice) ((p)->lpVtbl->SetNoBandwidthGroupForDevice(p, aName, aControllerPort, aDevice))
+#define IMachine_UnmountMedium(p, aName, aControllerPort, aDevice, aForce) ((p)->lpVtbl->UnmountMedium(p, aName, aControllerPort, aDevice, aForce))
+#define IMachine_MountMedium(p, aName, aControllerPort, aDevice, aMedium, aForce) ((p)->lpVtbl->MountMedium(p, aName, aControllerPort, aDevice, aMedium, aForce))
+#define IMachine_GetMedium(p, aName, aControllerPort, aDevice, aMedium) ((p)->lpVtbl->GetMedium(p, aName, aControllerPort, aDevice, aMedium))
+#define IMachine_GetMediumAttachmentsOfController(p, aName, aMediumAttachments) ((p)->lpVtbl->GetMediumAttachmentsOfController(p, aName, aMediumAttachments))
+#define IMachine_GetMediumAttachment(p, aName, aControllerPort, aDevice, aAttachment) ((p)->lpVtbl->GetMediumAttachment(p, aName, aControllerPort, aDevice, aAttachment))
+#define IMachine_AttachHostPCIDevice(p, aHostAddress, aDesiredGuestAddress, aTryToUnbind) ((p)->lpVtbl->AttachHostPCIDevice(p, aHostAddress, aDesiredGuestAddress, aTryToUnbind))
+#define IMachine_DetachHostPCIDevice(p, aHostAddress) ((p)->lpVtbl->DetachHostPCIDevice(p, aHostAddress))
+#define IMachine_GetNetworkAdapter(p, aSlot, aAdapter) ((p)->lpVtbl->GetNetworkAdapter(p, aSlot, aAdapter))
+#define IMachine_AddStorageController(p, aName, aConnectionType, aController) ((p)->lpVtbl->AddStorageController(p, aName, aConnectionType, aController))
+#define IMachine_GetStorageControllerByName(p, aName, aStorageController) ((p)->lpVtbl->GetStorageControllerByName(p, aName, aStorageController))
+#define IMachine_GetStorageControllerByInstance(p, aInstance, aStorageController) ((p)->lpVtbl->GetStorageControllerByInstance(p, aInstance, aStorageController))
+#define IMachine_RemoveStorageController(p, aName) ((p)->lpVtbl->RemoveStorageController(p, aName))
+#define IMachine_SetStorageControllerBootable(p, aName, aBootable) ((p)->lpVtbl->SetStorageControllerBootable(p, aName, aBootable))
+#define IMachine_AddUSBController(p, aName, aType, aController) ((p)->lpVtbl->AddUSBController(p, aName, aType, aController))
+#define IMachine_RemoveUSBController(p, aName) ((p)->lpVtbl->RemoveUSBController(p, aName))
+#define IMachine_GetUSBControllerByName(p, aName, aController) ((p)->lpVtbl->GetUSBControllerByName(p, aName, aController))
+#define IMachine_GetUSBControllerCountByType(p, aType, aControllers) ((p)->lpVtbl->GetUSBControllerCountByType(p, aType, aControllers))
+#define IMachine_GetSerialPort(p, aSlot, aPort) ((p)->lpVtbl->GetSerialPort(p, aSlot, aPort))
+#define IMachine_GetParallelPort(p, aSlot, aPort) ((p)->lpVtbl->GetParallelPort(p, aSlot, aPort))
+#define IMachine_GetExtraDataKeys(p, aKeys) ((p)->lpVtbl->GetExtraDataKeys(p, aKeys))
+#define IMachine_GetExtraData(p, aKey, aValue) ((p)->lpVtbl->GetExtraData(p, aKey, aValue))
+#define IMachine_SetExtraData(p, aKey, aValue) ((p)->lpVtbl->SetExtraData(p, aKey, aValue))
+#define IMachine_GetCPUProperty(p, aProperty, aValue) ((p)->lpVtbl->GetCPUProperty(p, aProperty, aValue))
+#define IMachine_SetCPUProperty(p, aProperty, aValue) ((p)->lpVtbl->SetCPUProperty(p, aProperty, aValue))
+#define IMachine_GetCPUIDLeaf(p, aId, aValEax, aValEbx, aValEcx, aValEdx) ((p)->lpVtbl->GetCPUIDLeaf(p, aId, aValEax, aValEbx, aValEcx, aValEdx))
+#define IMachine_SetCPUIDLeaf(p, aId, aValEax, aValEbx, aValEcx, aValEdx) ((p)->lpVtbl->SetCPUIDLeaf(p, aId, aValEax, aValEbx, aValEcx, aValEdx))
+#define IMachine_RemoveCPUIDLeaf(p, aId) ((p)->lpVtbl->RemoveCPUIDLeaf(p, aId))
+#define IMachine_RemoveAllCPUIDLeaves(p) ((p)->lpVtbl->RemoveAllCPUIDLeaves(p))
+#define IMachine_GetHWVirtExProperty(p, aProperty, aValue) ((p)->lpVtbl->GetHWVirtExProperty(p, aProperty, aValue))
+#define IMachine_SetHWVirtExProperty(p, aProperty, aValue) ((p)->lpVtbl->SetHWVirtExProperty(p, aProperty, aValue))
+#define IMachine_SetSettingsFilePath(p, aSettingsFilePath, aProgress) ((p)->lpVtbl->SetSettingsFilePath(p, aSettingsFilePath, aProgress))
+#define IMachine_SaveSettings(p) ((p)->lpVtbl->SaveSettings(p))
+#define IMachine_DiscardSettings(p) ((p)->lpVtbl->DiscardSettings(p))
+#define IMachine_Unregister(p, aCleanupMode, aMedia) ((p)->lpVtbl->Unregister(p, aCleanupMode, aMedia))
+#define IMachine_DeleteConfig(p, aMedia, aProgress) ((p)->lpVtbl->DeleteConfig(p, aMedia, aProgress))
+#define IMachine_ExportTo(p, aAppliance, aLocation, aDescription) ((p)->lpVtbl->ExportTo(p, aAppliance, aLocation, aDescription))
+#define IMachine_FindSnapshot(p, aNameOrId, aSnapshot) ((p)->lpVtbl->FindSnapshot(p, aNameOrId, aSnapshot))
+#define IMachine_CreateSharedFolder(p, aName, aHostPath, aWritable, aAutomount) ((p)->lpVtbl->CreateSharedFolder(p, aName, aHostPath, aWritable, aAutomount))
+#define IMachine_RemoveSharedFolder(p, aName) ((p)->lpVtbl->RemoveSharedFolder(p, aName))
+#define IMachine_CanShowConsoleWindow(p, aCanShow) ((p)->lpVtbl->CanShowConsoleWindow(p, aCanShow))
+#define IMachine_ShowConsoleWindow(p, aWinId) ((p)->lpVtbl->ShowConsoleWindow(p, aWinId))
+#define IMachine_GetGuestProperty(p, aName, aValue, aTimestamp, aFlags) ((p)->lpVtbl->GetGuestProperty(p, aName, aValue, aTimestamp, aFlags))
+#define IMachine_GetGuestPropertyValue(p, aProperty, aValue) ((p)->lpVtbl->GetGuestPropertyValue(p, aProperty, aValue))
+#define IMachine_GetGuestPropertyTimestamp(p, aProperty, aValue) ((p)->lpVtbl->GetGuestPropertyTimestamp(p, aProperty, aValue))
+#define IMachine_SetGuestProperty(p, aProperty, aValue, aFlags) ((p)->lpVtbl->SetGuestProperty(p, aProperty, aValue, aFlags))
+#define IMachine_SetGuestPropertyValue(p, aProperty, aValue) ((p)->lpVtbl->SetGuestPropertyValue(p, aProperty, aValue))
+#define IMachine_DeleteGuestProperty(p, aName) ((p)->lpVtbl->DeleteGuestProperty(p, aName))
+#define IMachine_EnumerateGuestProperties(p, aPatterns, aNames, aValues, aTimestamps, aFlags) ((p)->lpVtbl->EnumerateGuestProperties(p, aPatterns, aNames, aValues, aTimestamps, aFlags))
+#define IMachine_QuerySavedGuestScreenInfo(p, aScreenId, aOriginX, aOriginY, aWidth, aHeight, aEnabled) ((p)->lpVtbl->QuerySavedGuestScreenInfo(p, aScreenId, aOriginX, aOriginY, aWidth, aHeight, aEnabled))
+#define IMachine_QuerySavedThumbnailSize(p, aScreenId, aSize, aWidth, aHeight) ((p)->lpVtbl->QuerySavedThumbnailSize(p, aScreenId, aSize, aWidth, aHeight))
+#define IMachine_ReadSavedThumbnailToArray(p, aScreenId, aBGR, aWidth, aHeight, aData) ((p)->lpVtbl->ReadSavedThumbnailToArray(p, aScreenId, aBGR, aWidth, aHeight, aData))
+#define IMachine_ReadSavedThumbnailPNGToArray(p, aScreenId, aWidth, aHeight, aData) ((p)->lpVtbl->ReadSavedThumbnailPNGToArray(p, aScreenId, aWidth, aHeight, aData))
+#define IMachine_QuerySavedScreenshotPNGSize(p, aScreenId, aSize, aWidth, aHeight) ((p)->lpVtbl->QuerySavedScreenshotPNGSize(p, aScreenId, aSize, aWidth, aHeight))
+#define IMachine_ReadSavedScreenshotPNGToArray(p, aScreenId, aWidth, aHeight, aData) ((p)->lpVtbl->ReadSavedScreenshotPNGToArray(p, aScreenId, aWidth, aHeight, aData))
+#define IMachine_HotPlugCPU(p, aCpu) ((p)->lpVtbl->HotPlugCPU(p, aCpu))
+#define IMachine_HotUnplugCPU(p, aCpu) ((p)->lpVtbl->HotUnplugCPU(p, aCpu))
+#define IMachine_GetCPUStatus(p, aCpu, aAttached) ((p)->lpVtbl->GetCPUStatus(p, aCpu, aAttached))
+#define IMachine_QueryLogFilename(p, aIdx, aFilename) ((p)->lpVtbl->QueryLogFilename(p, aIdx, aFilename))
+#define IMachine_ReadLog(p, aIdx, aOffset, aSize, aData) ((p)->lpVtbl->ReadLog(p, aIdx, aOffset, aSize, aData))
+#define IMachine_CloneTo(p, aTarget, aMode, aOptions, aProgress) ((p)->lpVtbl->CloneTo(p, aTarget, aMode, aOptions, aProgress))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMachine
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMachine_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMachineVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMachine declaration */
+
+
+/* Start of struct IEmulatedUSB declaration */
+#define IEMULATEDUSB_IID_STR "38cc4dfd-8bb2-4d40-aebe-699eead8c2dd"
+#define IEMULATEDUSB_IID { \
+    0x38cc4dfd, 0x8bb2, 0x4d40, \
+    { 0xae, 0xbe, 0x69, 0x9e, 0xea, 0xd8, 0xc2, 0xdd } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IEmulatedUSB);
+#ifndef VBOX_WITH_GLUE
+struct IEmulatedUSB_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetWebcams)(IEmulatedUSB *pThis, PRUint32 *webcamsSize, PRUnichar * **webcams);
+
+    nsresult (*WebcamAttach)(
+        IEmulatedUSB *pThis,
+        PRUnichar * path,
+        PRUnichar * settings
+    );
+
+    nsresult (*WebcamDetach)(
+        IEmulatedUSB *pThis,
+        PRUnichar * path
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IEmulatedUSBVtbl
+{
+    nsresult (*QueryInterface)(IEmulatedUSB *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IEmulatedUSB *pThis);
+    nsrefcnt (*Release)(IEmulatedUSB *pThis);
+    nsresult (*GetWebcams)(IEmulatedUSB *pThis, PRUint32 *webcamsSize, PRUnichar * **webcams);
+
+    nsresult (*WebcamAttach)(
+        IEmulatedUSB *pThis,
+        PRUnichar * path,
+        PRUnichar * settings
+    );
+
+    nsresult (*WebcamDetach)(
+        IEmulatedUSB *pThis,
+        PRUnichar * path
+    );
+
+};
+#define IEmulatedUSB_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IEmulatedUSB_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IEmulatedUSB_Release(p) ((p)->lpVtbl->Release(p))
+#define IEmulatedUSB_get_Webcams(p, aWebcams) ((p)->lpVtbl->GetWebcams(p, aWebcams))
+#define IEmulatedUSB_GetWebcams(p, aWebcams) ((p)->lpVtbl->GetWebcams(p, aWebcams))
+#define IEmulatedUSB_WebcamAttach(p, aPath, aSettings) ((p)->lpVtbl->WebcamAttach(p, aPath, aSettings))
+#define IEmulatedUSB_WebcamDetach(p, aPath) ((p)->lpVtbl->WebcamDetach(p, aPath))
+#endif /* VBOX_WITH_GLUE */
+
+interface IEmulatedUSB
+{
+#ifndef VBOX_WITH_GLUE
+    struct IEmulatedUSB_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IEmulatedUSBVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IEmulatedUSB declaration */
+
+
+/* Start of struct IVRDEServerInfo declaration */
+#define IVRDESERVERINFO_IID_STR "714434a1-58c3-4aab-9049-7652c5df113b"
+#define IVRDESERVERINFO_IID { \
+    0x714434a1, 0x58c3, 0x4aab, \
+    { 0x90, 0x49, 0x76, 0x52, 0xc5, 0xdf, 0x11, 0x3b } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVRDEServerInfo);
+#ifndef VBOX_WITH_GLUE
+struct IVRDEServerInfo_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetActive)(IVRDEServerInfo *pThis, PRBool *active);
+
+    nsresult (*GetPort)(IVRDEServerInfo *pThis, PRInt32 *port);
+
+    nsresult (*GetNumberOfClients)(IVRDEServerInfo *pThis, PRUint32 *numberOfClients);
+
+    nsresult (*GetBeginTime)(IVRDEServerInfo *pThis, PRInt64 *beginTime);
+
+    nsresult (*GetEndTime)(IVRDEServerInfo *pThis, PRInt64 *endTime);
+
+    nsresult (*GetBytesSent)(IVRDEServerInfo *pThis, PRInt64 *bytesSent);
+
+    nsresult (*GetBytesSentTotal)(IVRDEServerInfo *pThis, PRInt64 *bytesSentTotal);
+
+    nsresult (*GetBytesReceived)(IVRDEServerInfo *pThis, PRInt64 *bytesReceived);
+
+    nsresult (*GetBytesReceivedTotal)(IVRDEServerInfo *pThis, PRInt64 *bytesReceivedTotal);
+
+    nsresult (*GetUser)(IVRDEServerInfo *pThis, PRUnichar * *user);
+
+    nsresult (*GetDomain)(IVRDEServerInfo *pThis, PRUnichar * *domain);
+
+    nsresult (*GetClientName)(IVRDEServerInfo *pThis, PRUnichar * *clientName);
+
+    nsresult (*GetClientIP)(IVRDEServerInfo *pThis, PRUnichar * *clientIP);
+
+    nsresult (*GetClientVersion)(IVRDEServerInfo *pThis, PRUint32 *clientVersion);
+
+    nsresult (*GetEncryptionStyle)(IVRDEServerInfo *pThis, PRUint32 *encryptionStyle);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVRDEServerInfoVtbl
+{
+    nsresult (*QueryInterface)(IVRDEServerInfo *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVRDEServerInfo *pThis);
+    nsrefcnt (*Release)(IVRDEServerInfo *pThis);
+    nsresult (*GetActive)(IVRDEServerInfo *pThis, PRBool *active);
+
+    nsresult (*GetPort)(IVRDEServerInfo *pThis, PRInt32 *port);
+
+    nsresult (*GetNumberOfClients)(IVRDEServerInfo *pThis, PRUint32 *numberOfClients);
+
+    nsresult (*GetBeginTime)(IVRDEServerInfo *pThis, PRInt64 *beginTime);
+
+    nsresult (*GetEndTime)(IVRDEServerInfo *pThis, PRInt64 *endTime);
+
+    nsresult (*GetBytesSent)(IVRDEServerInfo *pThis, PRInt64 *bytesSent);
+
+    nsresult (*GetBytesSentTotal)(IVRDEServerInfo *pThis, PRInt64 *bytesSentTotal);
+
+    nsresult (*GetBytesReceived)(IVRDEServerInfo *pThis, PRInt64 *bytesReceived);
+
+    nsresult (*GetBytesReceivedTotal)(IVRDEServerInfo *pThis, PRInt64 *bytesReceivedTotal);
+
+    nsresult (*GetUser)(IVRDEServerInfo *pThis, PRUnichar * *user);
+
+    nsresult (*GetDomain)(IVRDEServerInfo *pThis, PRUnichar * *domain);
+
+    nsresult (*GetClientName)(IVRDEServerInfo *pThis, PRUnichar * *clientName);
+
+    nsresult (*GetClientIP)(IVRDEServerInfo *pThis, PRUnichar * *clientIP);
+
+    nsresult (*GetClientVersion)(IVRDEServerInfo *pThis, PRUint32 *clientVersion);
+
+    nsresult (*GetEncryptionStyle)(IVRDEServerInfo *pThis, PRUint32 *encryptionStyle);
+
+};
+#define IVRDEServerInfo_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVRDEServerInfo_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVRDEServerInfo_Release(p) ((p)->lpVtbl->Release(p))
+#define IVRDEServerInfo_get_Active(p, aActive) ((p)->lpVtbl->GetActive(p, aActive))
+#define IVRDEServerInfo_GetActive(p, aActive) ((p)->lpVtbl->GetActive(p, aActive))
+#define IVRDEServerInfo_get_Port(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IVRDEServerInfo_GetPort(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IVRDEServerInfo_get_NumberOfClients(p, aNumberOfClients) ((p)->lpVtbl->GetNumberOfClients(p, aNumberOfClients))
+#define IVRDEServerInfo_GetNumberOfClients(p, aNumberOfClients) ((p)->lpVtbl->GetNumberOfClients(p, aNumberOfClients))
+#define IVRDEServerInfo_get_BeginTime(p, aBeginTime) ((p)->lpVtbl->GetBeginTime(p, aBeginTime))
+#define IVRDEServerInfo_GetBeginTime(p, aBeginTime) ((p)->lpVtbl->GetBeginTime(p, aBeginTime))
+#define IVRDEServerInfo_get_EndTime(p, aEndTime) ((p)->lpVtbl->GetEndTime(p, aEndTime))
+#define IVRDEServerInfo_GetEndTime(p, aEndTime) ((p)->lpVtbl->GetEndTime(p, aEndTime))
+#define IVRDEServerInfo_get_BytesSent(p, aBytesSent) ((p)->lpVtbl->GetBytesSent(p, aBytesSent))
+#define IVRDEServerInfo_GetBytesSent(p, aBytesSent) ((p)->lpVtbl->GetBytesSent(p, aBytesSent))
+#define IVRDEServerInfo_get_BytesSentTotal(p, aBytesSentTotal) ((p)->lpVtbl->GetBytesSentTotal(p, aBytesSentTotal))
+#define IVRDEServerInfo_GetBytesSentTotal(p, aBytesSentTotal) ((p)->lpVtbl->GetBytesSentTotal(p, aBytesSentTotal))
+#define IVRDEServerInfo_get_BytesReceived(p, aBytesReceived) ((p)->lpVtbl->GetBytesReceived(p, aBytesReceived))
+#define IVRDEServerInfo_GetBytesReceived(p, aBytesReceived) ((p)->lpVtbl->GetBytesReceived(p, aBytesReceived))
+#define IVRDEServerInfo_get_BytesReceivedTotal(p, aBytesReceivedTotal) ((p)->lpVtbl->GetBytesReceivedTotal(p, aBytesReceivedTotal))
+#define IVRDEServerInfo_GetBytesReceivedTotal(p, aBytesReceivedTotal) ((p)->lpVtbl->GetBytesReceivedTotal(p, aBytesReceivedTotal))
+#define IVRDEServerInfo_get_User(p, aUser) ((p)->lpVtbl->GetUser(p, aUser))
+#define IVRDEServerInfo_GetUser(p, aUser) ((p)->lpVtbl->GetUser(p, aUser))
+#define IVRDEServerInfo_get_Domain(p, aDomain) ((p)->lpVtbl->GetDomain(p, aDomain))
+#define IVRDEServerInfo_GetDomain(p, aDomain) ((p)->lpVtbl->GetDomain(p, aDomain))
+#define IVRDEServerInfo_get_ClientName(p, aClientName) ((p)->lpVtbl->GetClientName(p, aClientName))
+#define IVRDEServerInfo_GetClientName(p, aClientName) ((p)->lpVtbl->GetClientName(p, aClientName))
+#define IVRDEServerInfo_get_ClientIP(p, aClientIP) ((p)->lpVtbl->GetClientIP(p, aClientIP))
+#define IVRDEServerInfo_GetClientIP(p, aClientIP) ((p)->lpVtbl->GetClientIP(p, aClientIP))
+#define IVRDEServerInfo_get_ClientVersion(p, aClientVersion) ((p)->lpVtbl->GetClientVersion(p, aClientVersion))
+#define IVRDEServerInfo_GetClientVersion(p, aClientVersion) ((p)->lpVtbl->GetClientVersion(p, aClientVersion))
+#define IVRDEServerInfo_get_EncryptionStyle(p, aEncryptionStyle) ((p)->lpVtbl->GetEncryptionStyle(p, aEncryptionStyle))
+#define IVRDEServerInfo_GetEncryptionStyle(p, aEncryptionStyle) ((p)->lpVtbl->GetEncryptionStyle(p, aEncryptionStyle))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVRDEServerInfo
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVRDEServerInfo_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVRDEServerInfoVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVRDEServerInfo declaration */
+
+
+/* Start of struct IConsole declaration */
+#define ICONSOLE_IID_STR "8ab7c520-2442-4b66-8d74-4ff1e195d2b6"
+#define ICONSOLE_IID { \
+    0x8ab7c520, 0x2442, 0x4b66, \
+    { 0x8d, 0x74, 0x4f, 0xf1, 0xe1, 0x95, 0xd2, 0xb6 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IConsole);
+#ifndef VBOX_WITH_GLUE
+struct IConsole_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMachine)(IConsole *pThis, IMachine * *machine);
+
+    nsresult (*GetState)(IConsole *pThis, PRUint32 *state);
+
+    nsresult (*GetGuest)(IConsole *pThis, IGuest * *guest);
+
+    nsresult (*GetKeyboard)(IConsole *pThis, IKeyboard * *keyboard);
+
+    nsresult (*GetMouse)(IConsole *pThis, IMouse * *mouse);
+
+    nsresult (*GetDisplay)(IConsole *pThis, IDisplay * *display);
+
+    nsresult (*GetDebugger)(IConsole *pThis, IMachineDebugger * *debugger);
+
+    nsresult (*GetUSBDevices)(IConsole *pThis, PRUint32 *USBDevicesSize, IUSBDevice * **USBDevices);
+
+    nsresult (*GetRemoteUSBDevices)(IConsole *pThis, PRUint32 *remoteUSBDevicesSize, IHostUSBDevice * **remoteUSBDevices);
+
+    nsresult (*GetSharedFolders)(IConsole *pThis, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetVRDEServerInfo)(IConsole *pThis, IVRDEServerInfo * *VRDEServerInfo);
+
+    nsresult (*GetEventSource)(IConsole *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetAttachedPCIDevices)(IConsole *pThis, PRUint32 *attachedPCIDevicesSize, IPCIDeviceAttachment * **attachedPCIDevices);
+
+    nsresult (*GetUseHostClipboard)(IConsole *pThis, PRBool *useHostClipboard);
+    nsresult (*SetUseHostClipboard)(IConsole *pThis, PRBool useHostClipboard);
+
+    nsresult (*GetEmulatedUSB)(IConsole *pThis, IEmulatedUSB * *emulatedUSB);
+
+    nsresult (*PowerUp)(
+        IConsole *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*PowerUpPaused)(
+        IConsole *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*PowerDown)(
+        IConsole *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*Reset)(IConsole *pThis );
+
+    nsresult (*Pause)(IConsole *pThis );
+
+    nsresult (*Resume)(IConsole *pThis );
+
+    nsresult (*PowerButton)(IConsole *pThis );
+
+    nsresult (*SleepButton)(IConsole *pThis );
+
+    nsresult (*GetPowerButtonHandled)(
+        IConsole *pThis,
+        PRBool * handled
+    );
+
+    nsresult (*GetGuestEnteredACPIMode)(
+        IConsole *pThis,
+        PRBool * entered
+    );
+
+    nsresult (*SaveState)(
+        IConsole *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*AdoptSavedState)(
+        IConsole *pThis,
+        PRUnichar * savedStateFile
+    );
+
+    nsresult (*DiscardSavedState)(
+        IConsole *pThis,
+        PRBool fRemoveFile
+    );
+
+    nsresult (*GetDeviceActivity)(
+        IConsole *pThis,
+        PRUint32 type,
+        PRUint32 * activity
+    );
+
+    nsresult (*AttachUSBDevice)(
+        IConsole *pThis,
+        PRUnichar * id
+    );
+
+    nsresult (*DetachUSBDevice)(
+        IConsole *pThis,
+        PRUnichar * id,
+        IUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceByAddress)(
+        IConsole *pThis,
+        PRUnichar * name,
+        IUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceById)(
+        IConsole *pThis,
+        PRUnichar * id,
+        IUSBDevice * * device
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IConsole *pThis,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable,
+        PRBool automount
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IConsole *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*TakeSnapshot)(
+        IConsole *pThis,
+        PRUnichar * name,
+        PRUnichar * description,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteSnapshot)(
+        IConsole *pThis,
+        PRUnichar * id,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteSnapshotAndAllChildren)(
+        IConsole *pThis,
+        PRUnichar * id,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteSnapshotRange)(
+        IConsole *pThis,
+        PRUnichar * startId,
+        PRUnichar * endId,
+        IProgress * * progress
+    );
+
+    nsresult (*RestoreSnapshot)(
+        IConsole *pThis,
+        ISnapshot * snapshot,
+        IProgress * * progress
+    );
+
+    nsresult (*Teleport)(
+        IConsole *pThis,
+        PRUnichar * hostname,
+        PRUint32 tcpport,
+        PRUnichar * password,
+        PRUint32 maxDowntime,
+        IProgress * * progress
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IConsoleVtbl
+{
+    nsresult (*QueryInterface)(IConsole *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IConsole *pThis);
+    nsrefcnt (*Release)(IConsole *pThis);
+    nsresult (*GetMachine)(IConsole *pThis, IMachine * *machine);
+
+    nsresult (*GetState)(IConsole *pThis, PRUint32 *state);
+
+    nsresult (*GetGuest)(IConsole *pThis, IGuest * *guest);
+
+    nsresult (*GetKeyboard)(IConsole *pThis, IKeyboard * *keyboard);
+
+    nsresult (*GetMouse)(IConsole *pThis, IMouse * *mouse);
+
+    nsresult (*GetDisplay)(IConsole *pThis, IDisplay * *display);
+
+    nsresult (*GetDebugger)(IConsole *pThis, IMachineDebugger * *debugger);
+
+    nsresult (*GetUSBDevices)(IConsole *pThis, PRUint32 *USBDevicesSize, IUSBDevice * **USBDevices);
+
+    nsresult (*GetRemoteUSBDevices)(IConsole *pThis, PRUint32 *remoteUSBDevicesSize, IHostUSBDevice * **remoteUSBDevices);
+
+    nsresult (*GetSharedFolders)(IConsole *pThis, PRUint32 *sharedFoldersSize, ISharedFolder * **sharedFolders);
+
+    nsresult (*GetVRDEServerInfo)(IConsole *pThis, IVRDEServerInfo * *VRDEServerInfo);
+
+    nsresult (*GetEventSource)(IConsole *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetAttachedPCIDevices)(IConsole *pThis, PRUint32 *attachedPCIDevicesSize, IPCIDeviceAttachment * **attachedPCIDevices);
+
+    nsresult (*GetUseHostClipboard)(IConsole *pThis, PRBool *useHostClipboard);
+    nsresult (*SetUseHostClipboard)(IConsole *pThis, PRBool useHostClipboard);
+
+    nsresult (*GetEmulatedUSB)(IConsole *pThis, IEmulatedUSB * *emulatedUSB);
+
+    nsresult (*PowerUp)(
+        IConsole *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*PowerUpPaused)(
+        IConsole *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*PowerDown)(
+        IConsole *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*Reset)(IConsole *pThis );
+
+    nsresult (*Pause)(IConsole *pThis );
+
+    nsresult (*Resume)(IConsole *pThis );
+
+    nsresult (*PowerButton)(IConsole *pThis );
+
+    nsresult (*SleepButton)(IConsole *pThis );
+
+    nsresult (*GetPowerButtonHandled)(
+        IConsole *pThis,
+        PRBool * handled
+    );
+
+    nsresult (*GetGuestEnteredACPIMode)(
+        IConsole *pThis,
+        PRBool * entered
+    );
+
+    nsresult (*SaveState)(
+        IConsole *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*AdoptSavedState)(
+        IConsole *pThis,
+        PRUnichar * savedStateFile
+    );
+
+    nsresult (*DiscardSavedState)(
+        IConsole *pThis,
+        PRBool fRemoveFile
+    );
+
+    nsresult (*GetDeviceActivity)(
+        IConsole *pThis,
+        PRUint32 type,
+        PRUint32 * activity
+    );
+
+    nsresult (*AttachUSBDevice)(
+        IConsole *pThis,
+        PRUnichar * id
+    );
+
+    nsresult (*DetachUSBDevice)(
+        IConsole *pThis,
+        PRUnichar * id,
+        IUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceByAddress)(
+        IConsole *pThis,
+        PRUnichar * name,
+        IUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceById)(
+        IConsole *pThis,
+        PRUnichar * id,
+        IUSBDevice * * device
+    );
+
+    nsresult (*CreateSharedFolder)(
+        IConsole *pThis,
+        PRUnichar * name,
+        PRUnichar * hostPath,
+        PRBool writable,
+        PRBool automount
+    );
+
+    nsresult (*RemoveSharedFolder)(
+        IConsole *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*TakeSnapshot)(
+        IConsole *pThis,
+        PRUnichar * name,
+        PRUnichar * description,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteSnapshot)(
+        IConsole *pThis,
+        PRUnichar * id,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteSnapshotAndAllChildren)(
+        IConsole *pThis,
+        PRUnichar * id,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteSnapshotRange)(
+        IConsole *pThis,
+        PRUnichar * startId,
+        PRUnichar * endId,
+        IProgress * * progress
+    );
+
+    nsresult (*RestoreSnapshot)(
+        IConsole *pThis,
+        ISnapshot * snapshot,
+        IProgress * * progress
+    );
+
+    nsresult (*Teleport)(
+        IConsole *pThis,
+        PRUnichar * hostname,
+        PRUint32 tcpport,
+        PRUnichar * password,
+        PRUint32 maxDowntime,
+        IProgress * * progress
+    );
+
+};
+#define IConsole_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IConsole_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IConsole_Release(p) ((p)->lpVtbl->Release(p))
+#define IConsole_get_Machine(p, aMachine) ((p)->lpVtbl->GetMachine(p, aMachine))
+#define IConsole_GetMachine(p, aMachine) ((p)->lpVtbl->GetMachine(p, aMachine))
+#define IConsole_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IConsole_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IConsole_get_Guest(p, aGuest) ((p)->lpVtbl->GetGuest(p, aGuest))
+#define IConsole_GetGuest(p, aGuest) ((p)->lpVtbl->GetGuest(p, aGuest))
+#define IConsole_get_Keyboard(p, aKeyboard) ((p)->lpVtbl->GetKeyboard(p, aKeyboard))
+#define IConsole_GetKeyboard(p, aKeyboard) ((p)->lpVtbl->GetKeyboard(p, aKeyboard))
+#define IConsole_get_Mouse(p, aMouse) ((p)->lpVtbl->GetMouse(p, aMouse))
+#define IConsole_GetMouse(p, aMouse) ((p)->lpVtbl->GetMouse(p, aMouse))
+#define IConsole_get_Display(p, aDisplay) ((p)->lpVtbl->GetDisplay(p, aDisplay))
+#define IConsole_GetDisplay(p, aDisplay) ((p)->lpVtbl->GetDisplay(p, aDisplay))
+#define IConsole_get_Debugger(p, aDebugger) ((p)->lpVtbl->GetDebugger(p, aDebugger))
+#define IConsole_GetDebugger(p, aDebugger) ((p)->lpVtbl->GetDebugger(p, aDebugger))
+#define IConsole_get_USBDevices(p, aUSBDevices) ((p)->lpVtbl->GetUSBDevices(p, aUSBDevices))
+#define IConsole_GetUSBDevices(p, aUSBDevices) ((p)->lpVtbl->GetUSBDevices(p, aUSBDevices))
+#define IConsole_get_RemoteUSBDevices(p, aRemoteUSBDevices) ((p)->lpVtbl->GetRemoteUSBDevices(p, aRemoteUSBDevices))
+#define IConsole_GetRemoteUSBDevices(p, aRemoteUSBDevices) ((p)->lpVtbl->GetRemoteUSBDevices(p, aRemoteUSBDevices))
+#define IConsole_get_SharedFolders(p, aSharedFolders) ((p)->lpVtbl->GetSharedFolders(p, aSharedFolders))
+#define IConsole_GetSharedFolders(p, aSharedFolders) ((p)->lpVtbl->GetSharedFolders(p, aSharedFolders))
+#define IConsole_get_VRDEServerInfo(p, aVRDEServerInfo) ((p)->lpVtbl->GetVRDEServerInfo(p, aVRDEServerInfo))
+#define IConsole_GetVRDEServerInfo(p, aVRDEServerInfo) ((p)->lpVtbl->GetVRDEServerInfo(p, aVRDEServerInfo))
+#define IConsole_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IConsole_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IConsole_get_AttachedPCIDevices(p, aAttachedPCIDevices) ((p)->lpVtbl->GetAttachedPCIDevices(p, aAttachedPCIDevices))
+#define IConsole_GetAttachedPCIDevices(p, aAttachedPCIDevices) ((p)->lpVtbl->GetAttachedPCIDevices(p, aAttachedPCIDevices))
+#define IConsole_get_UseHostClipboard(p, aUseHostClipboard) ((p)->lpVtbl->GetUseHostClipboard(p, aUseHostClipboard))
+#define IConsole_GetUseHostClipboard(p, aUseHostClipboard) ((p)->lpVtbl->GetUseHostClipboard(p, aUseHostClipboard))
+#define IConsole_put_UseHostClipboard(p, aUseHostClipboard) ((p)->lpVtbl->SetUseHostClipboard(p, aUseHostClipboard))
+#define IConsole_SetUseHostClipboard(p, aUseHostClipboard) ((p)->lpVtbl->SetUseHostClipboard(p, aUseHostClipboard))
+#define IConsole_get_EmulatedUSB(p, aEmulatedUSB) ((p)->lpVtbl->GetEmulatedUSB(p, aEmulatedUSB))
+#define IConsole_GetEmulatedUSB(p, aEmulatedUSB) ((p)->lpVtbl->GetEmulatedUSB(p, aEmulatedUSB))
+#define IConsole_PowerUp(p, aProgress) ((p)->lpVtbl->PowerUp(p, aProgress))
+#define IConsole_PowerUpPaused(p, aProgress) ((p)->lpVtbl->PowerUpPaused(p, aProgress))
+#define IConsole_PowerDown(p, aProgress) ((p)->lpVtbl->PowerDown(p, aProgress))
+#define IConsole_Reset(p) ((p)->lpVtbl->Reset(p))
+#define IConsole_Pause(p) ((p)->lpVtbl->Pause(p))
+#define IConsole_Resume(p) ((p)->lpVtbl->Resume(p))
+#define IConsole_PowerButton(p) ((p)->lpVtbl->PowerButton(p))
+#define IConsole_SleepButton(p) ((p)->lpVtbl->SleepButton(p))
+#define IConsole_GetPowerButtonHandled(p, aHandled) ((p)->lpVtbl->GetPowerButtonHandled(p, aHandled))
+#define IConsole_GetGuestEnteredACPIMode(p, aEntered) ((p)->lpVtbl->GetGuestEnteredACPIMode(p, aEntered))
+#define IConsole_SaveState(p, aProgress) ((p)->lpVtbl->SaveState(p, aProgress))
+#define IConsole_AdoptSavedState(p, aSavedStateFile) ((p)->lpVtbl->AdoptSavedState(p, aSavedStateFile))
+#define IConsole_DiscardSavedState(p, aFRemoveFile) ((p)->lpVtbl->DiscardSavedState(p, aFRemoveFile))
+#define IConsole_GetDeviceActivity(p, aType, aActivity) ((p)->lpVtbl->GetDeviceActivity(p, aType, aActivity))
+#define IConsole_AttachUSBDevice(p, aId) ((p)->lpVtbl->AttachUSBDevice(p, aId))
+#define IConsole_DetachUSBDevice(p, aId, aDevice) ((p)->lpVtbl->DetachUSBDevice(p, aId, aDevice))
+#define IConsole_FindUSBDeviceByAddress(p, aName, aDevice) ((p)->lpVtbl->FindUSBDeviceByAddress(p, aName, aDevice))
+#define IConsole_FindUSBDeviceById(p, aId, aDevice) ((p)->lpVtbl->FindUSBDeviceById(p, aId, aDevice))
+#define IConsole_CreateSharedFolder(p, aName, aHostPath, aWritable, aAutomount) ((p)->lpVtbl->CreateSharedFolder(p, aName, aHostPath, aWritable, aAutomount))
+#define IConsole_RemoveSharedFolder(p, aName) ((p)->lpVtbl->RemoveSharedFolder(p, aName))
+#define IConsole_TakeSnapshot(p, aName, aDescription, aProgress) ((p)->lpVtbl->TakeSnapshot(p, aName, aDescription, aProgress))
+#define IConsole_DeleteSnapshot(p, aId, aProgress) ((p)->lpVtbl->DeleteSnapshot(p, aId, aProgress))
+#define IConsole_DeleteSnapshotAndAllChildren(p, aId, aProgress) ((p)->lpVtbl->DeleteSnapshotAndAllChildren(p, aId, aProgress))
+#define IConsole_DeleteSnapshotRange(p, aStartId, aEndId, aProgress) ((p)->lpVtbl->DeleteSnapshotRange(p, aStartId, aEndId, aProgress))
+#define IConsole_RestoreSnapshot(p, aSnapshot, aProgress) ((p)->lpVtbl->RestoreSnapshot(p, aSnapshot, aProgress))
+#define IConsole_Teleport(p, aHostname, aTcpport, aPassword, aMaxDowntime, aProgress) ((p)->lpVtbl->Teleport(p, aHostname, aTcpport, aPassword, aMaxDowntime, aProgress))
+#endif /* VBOX_WITH_GLUE */
+
+interface IConsole
+{
+#ifndef VBOX_WITH_GLUE
+    struct IConsole_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IConsoleVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IConsole declaration */
+
+
+/* Start of struct IHostNetworkInterface declaration */
+#define IHOSTNETWORKINTERFACE_IID_STR "f6e556f9-d598-409b-898c-8ba99d9b05ae"
+#define IHOSTNETWORKINTERFACE_IID { \
+    0xf6e556f9, 0xd598, 0x409b, \
+    { 0x89, 0x8c, 0x8b, 0xa9, 0x9d, 0x9b, 0x05, 0xae } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IHostNetworkInterface);
+#ifndef VBOX_WITH_GLUE
+struct IHostNetworkInterface_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IHostNetworkInterface *pThis, PRUnichar * *name);
+
+    nsresult (*GetShortName)(IHostNetworkInterface *pThis, PRUnichar * *shortName);
+
+    nsresult (*GetId)(IHostNetworkInterface *pThis, PRUnichar * *id);
+
+    nsresult (*GetNetworkName)(IHostNetworkInterface *pThis, PRUnichar * *networkName);
+
+    nsresult (*GetDHCPEnabled)(IHostNetworkInterface *pThis, PRBool *DHCPEnabled);
+
+    nsresult (*GetIPAddress)(IHostNetworkInterface *pThis, PRUnichar * *IPAddress);
+
+    nsresult (*GetNetworkMask)(IHostNetworkInterface *pThis, PRUnichar * *networkMask);
+
+    nsresult (*GetIPV6Supported)(IHostNetworkInterface *pThis, PRBool *IPV6Supported);
+
+    nsresult (*GetIPV6Address)(IHostNetworkInterface *pThis, PRUnichar * *IPV6Address);
+
+    nsresult (*GetIPV6NetworkMaskPrefixLength)(IHostNetworkInterface *pThis, PRUint32 *IPV6NetworkMaskPrefixLength);
+
+    nsresult (*GetHardwareAddress)(IHostNetworkInterface *pThis, PRUnichar * *hardwareAddress);
+
+    nsresult (*GetMediumType)(IHostNetworkInterface *pThis, PRUint32 *mediumType);
+
+    nsresult (*GetStatus)(IHostNetworkInterface *pThis, PRUint32 *status);
+
+    nsresult (*GetInterfaceType)(IHostNetworkInterface *pThis, PRUint32 *interfaceType);
+
+    nsresult (*EnableStaticIPConfig)(
+        IHostNetworkInterface *pThis,
+        PRUnichar * IPAddress,
+        PRUnichar * networkMask
+    );
+
+    nsresult (*EnableStaticIPConfigV6)(
+        IHostNetworkInterface *pThis,
+        PRUnichar * IPV6Address,
+        PRUint32 IPV6NetworkMaskPrefixLength
+    );
+
+    nsresult (*EnableDynamicIPConfig)(IHostNetworkInterface *pThis );
+
+    nsresult (*DHCPRediscover)(IHostNetworkInterface *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IHostNetworkInterfaceVtbl
+{
+    nsresult (*QueryInterface)(IHostNetworkInterface *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IHostNetworkInterface *pThis);
+    nsrefcnt (*Release)(IHostNetworkInterface *pThis);
+    nsresult (*GetName)(IHostNetworkInterface *pThis, PRUnichar * *name);
+
+    nsresult (*GetShortName)(IHostNetworkInterface *pThis, PRUnichar * *shortName);
+
+    nsresult (*GetId)(IHostNetworkInterface *pThis, PRUnichar * *id);
+
+    nsresult (*GetNetworkName)(IHostNetworkInterface *pThis, PRUnichar * *networkName);
+
+    nsresult (*GetDHCPEnabled)(IHostNetworkInterface *pThis, PRBool *DHCPEnabled);
+
+    nsresult (*GetIPAddress)(IHostNetworkInterface *pThis, PRUnichar * *IPAddress);
+
+    nsresult (*GetNetworkMask)(IHostNetworkInterface *pThis, PRUnichar * *networkMask);
+
+    nsresult (*GetIPV6Supported)(IHostNetworkInterface *pThis, PRBool *IPV6Supported);
+
+    nsresult (*GetIPV6Address)(IHostNetworkInterface *pThis, PRUnichar * *IPV6Address);
+
+    nsresult (*GetIPV6NetworkMaskPrefixLength)(IHostNetworkInterface *pThis, PRUint32 *IPV6NetworkMaskPrefixLength);
+
+    nsresult (*GetHardwareAddress)(IHostNetworkInterface *pThis, PRUnichar * *hardwareAddress);
+
+    nsresult (*GetMediumType)(IHostNetworkInterface *pThis, PRUint32 *mediumType);
+
+    nsresult (*GetStatus)(IHostNetworkInterface *pThis, PRUint32 *status);
+
+    nsresult (*GetInterfaceType)(IHostNetworkInterface *pThis, PRUint32 *interfaceType);
+
+    nsresult (*EnableStaticIPConfig)(
+        IHostNetworkInterface *pThis,
+        PRUnichar * IPAddress,
+        PRUnichar * networkMask
+    );
+
+    nsresult (*EnableStaticIPConfigV6)(
+        IHostNetworkInterface *pThis,
+        PRUnichar * IPV6Address,
+        PRUint32 IPV6NetworkMaskPrefixLength
+    );
+
+    nsresult (*EnableDynamicIPConfig)(IHostNetworkInterface *pThis );
+
+    nsresult (*DHCPRediscover)(IHostNetworkInterface *pThis );
+
+};
+#define IHostNetworkInterface_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IHostNetworkInterface_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IHostNetworkInterface_Release(p) ((p)->lpVtbl->Release(p))
+#define IHostNetworkInterface_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IHostNetworkInterface_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IHostNetworkInterface_get_ShortName(p, aShortName) ((p)->lpVtbl->GetShortName(p, aShortName))
+#define IHostNetworkInterface_GetShortName(p, aShortName) ((p)->lpVtbl->GetShortName(p, aShortName))
+#define IHostNetworkInterface_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IHostNetworkInterface_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IHostNetworkInterface_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define IHostNetworkInterface_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define IHostNetworkInterface_get_DHCPEnabled(p, aDHCPEnabled) ((p)->lpVtbl->GetDHCPEnabled(p, aDHCPEnabled))
+#define IHostNetworkInterface_GetDHCPEnabled(p, aDHCPEnabled) ((p)->lpVtbl->GetDHCPEnabled(p, aDHCPEnabled))
+#define IHostNetworkInterface_get_IPAddress(p, aIPAddress) ((p)->lpVtbl->GetIPAddress(p, aIPAddress))
+#define IHostNetworkInterface_GetIPAddress(p, aIPAddress) ((p)->lpVtbl->GetIPAddress(p, aIPAddress))
+#define IHostNetworkInterface_get_NetworkMask(p, aNetworkMask) ((p)->lpVtbl->GetNetworkMask(p, aNetworkMask))
+#define IHostNetworkInterface_GetNetworkMask(p, aNetworkMask) ((p)->lpVtbl->GetNetworkMask(p, aNetworkMask))
+#define IHostNetworkInterface_get_IPV6Supported(p, aIPV6Supported) ((p)->lpVtbl->GetIPV6Supported(p, aIPV6Supported))
+#define IHostNetworkInterface_GetIPV6Supported(p, aIPV6Supported) ((p)->lpVtbl->GetIPV6Supported(p, aIPV6Supported))
+#define IHostNetworkInterface_get_IPV6Address(p, aIPV6Address) ((p)->lpVtbl->GetIPV6Address(p, aIPV6Address))
+#define IHostNetworkInterface_GetIPV6Address(p, aIPV6Address) ((p)->lpVtbl->GetIPV6Address(p, aIPV6Address))
+#define IHostNetworkInterface_get_IPV6NetworkMaskPrefixLength(p, aIPV6NetworkMaskPrefixLength) ((p)->lpVtbl->GetIPV6NetworkMaskPrefixLength(p, aIPV6NetworkMaskPrefixLength))
+#define IHostNetworkInterface_GetIPV6NetworkMaskPrefixLength(p, aIPV6NetworkMaskPrefixLength) ((p)->lpVtbl->GetIPV6NetworkMaskPrefixLength(p, aIPV6NetworkMaskPrefixLength))
+#define IHostNetworkInterface_get_HardwareAddress(p, aHardwareAddress) ((p)->lpVtbl->GetHardwareAddress(p, aHardwareAddress))
+#define IHostNetworkInterface_GetHardwareAddress(p, aHardwareAddress) ((p)->lpVtbl->GetHardwareAddress(p, aHardwareAddress))
+#define IHostNetworkInterface_get_MediumType(p, aMediumType) ((p)->lpVtbl->GetMediumType(p, aMediumType))
+#define IHostNetworkInterface_GetMediumType(p, aMediumType) ((p)->lpVtbl->GetMediumType(p, aMediumType))
+#define IHostNetworkInterface_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IHostNetworkInterface_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IHostNetworkInterface_get_InterfaceType(p, aInterfaceType) ((p)->lpVtbl->GetInterfaceType(p, aInterfaceType))
+#define IHostNetworkInterface_GetInterfaceType(p, aInterfaceType) ((p)->lpVtbl->GetInterfaceType(p, aInterfaceType))
+#define IHostNetworkInterface_EnableStaticIPConfig(p, aIPAddress, aNetworkMask) ((p)->lpVtbl->EnableStaticIPConfig(p, aIPAddress, aNetworkMask))
+#define IHostNetworkInterface_EnableStaticIPConfigV6(p, aIPV6Address, aIPV6NetworkMaskPrefixLength) ((p)->lpVtbl->EnableStaticIPConfigV6(p, aIPV6Address, aIPV6NetworkMaskPrefixLength))
+#define IHostNetworkInterface_EnableDynamicIPConfig(p) ((p)->lpVtbl->EnableDynamicIPConfig(p))
+#define IHostNetworkInterface_DHCPRediscover(p) ((p)->lpVtbl->DHCPRediscover(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface IHostNetworkInterface
+{
+#ifndef VBOX_WITH_GLUE
+    struct IHostNetworkInterface_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IHostNetworkInterfaceVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IHostNetworkInterface declaration */
+
+
+/* Start of struct IHostVideoInputDevice declaration */
+#define IHOSTVIDEOINPUTDEVICE_IID_STR "a1ceae44-d65e-4156-9359-d390f93ee9a0"
+#define IHOSTVIDEOINPUTDEVICE_IID { \
+    0xa1ceae44, 0xd65e, 0x4156, \
+    { 0x93, 0x59, 0xd3, 0x90, 0xf9, 0x3e, 0xe9, 0xa0 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IHostVideoInputDevice);
+#ifndef VBOX_WITH_GLUE
+struct IHostVideoInputDevice_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IHostVideoInputDevice *pThis, PRUnichar * *name);
+
+    nsresult (*GetPath)(IHostVideoInputDevice *pThis, PRUnichar * *path);
+
+    nsresult (*GetAlias)(IHostVideoInputDevice *pThis, PRUnichar * *alias);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IHostVideoInputDeviceVtbl
+{
+    nsresult (*QueryInterface)(IHostVideoInputDevice *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IHostVideoInputDevice *pThis);
+    nsrefcnt (*Release)(IHostVideoInputDevice *pThis);
+    nsresult (*GetName)(IHostVideoInputDevice *pThis, PRUnichar * *name);
+
+    nsresult (*GetPath)(IHostVideoInputDevice *pThis, PRUnichar * *path);
+
+    nsresult (*GetAlias)(IHostVideoInputDevice *pThis, PRUnichar * *alias);
+
+};
+#define IHostVideoInputDevice_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IHostVideoInputDevice_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IHostVideoInputDevice_Release(p) ((p)->lpVtbl->Release(p))
+#define IHostVideoInputDevice_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IHostVideoInputDevice_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IHostVideoInputDevice_get_Path(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define IHostVideoInputDevice_GetPath(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define IHostVideoInputDevice_get_Alias(p, aAlias) ((p)->lpVtbl->GetAlias(p, aAlias))
+#define IHostVideoInputDevice_GetAlias(p, aAlias) ((p)->lpVtbl->GetAlias(p, aAlias))
+#endif /* VBOX_WITH_GLUE */
+
+interface IHostVideoInputDevice
+{
+#ifndef VBOX_WITH_GLUE
+    struct IHostVideoInputDevice_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IHostVideoInputDeviceVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IHostVideoInputDevice declaration */
+
+
+/* Start of struct IHost declaration */
+#define IHOST_IID_STR "93269330-48ca-4096-b4a2-1189df336267"
+#define IHOST_IID { \
+    0x93269330, 0x48ca, 0x4096, \
+    { 0xb4, 0xa2, 0x11, 0x89, 0xdf, 0x33, 0x62, 0x67 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IHost);
+#ifndef VBOX_WITH_GLUE
+struct IHost_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetDVDDrives)(IHost *pThis, PRUint32 *DVDDrivesSize, IMedium * **DVDDrives);
+
+    nsresult (*GetFloppyDrives)(IHost *pThis, PRUint32 *floppyDrivesSize, IMedium * **floppyDrives);
+
+    nsresult (*GetUSBDevices)(IHost *pThis, PRUint32 *USBDevicesSize, IHostUSBDevice * **USBDevices);
+
+    nsresult (*GetUSBDeviceFilters)(IHost *pThis, PRUint32 *USBDeviceFiltersSize, IHostUSBDeviceFilter * **USBDeviceFilters);
+
+    nsresult (*GetNetworkInterfaces)(IHost *pThis, PRUint32 *networkInterfacesSize, IHostNetworkInterface * **networkInterfaces);
+
+    nsresult (*GetNameServers)(IHost *pThis, PRUint32 *nameServersSize, PRUnichar * **nameServers);
+
+    nsresult (*GetDomainName)(IHost *pThis, PRUnichar * *domainName);
+
+    nsresult (*GetSearchStrings)(IHost *pThis, PRUint32 *searchStringsSize, PRUnichar * **searchStrings);
+
+    nsresult (*GetProcessorCount)(IHost *pThis, PRUint32 *processorCount);
+
+    nsresult (*GetProcessorOnlineCount)(IHost *pThis, PRUint32 *processorOnlineCount);
+
+    nsresult (*GetProcessorCoreCount)(IHost *pThis, PRUint32 *processorCoreCount);
+
+    nsresult (*GetProcessorOnlineCoreCount)(IHost *pThis, PRUint32 *processorOnlineCoreCount);
+
+    nsresult (*GetMemorySize)(IHost *pThis, PRUint32 *memorySize);
+
+    nsresult (*GetMemoryAvailable)(IHost *pThis, PRUint32 *memoryAvailable);
+
+    nsresult (*GetOperatingSystem)(IHost *pThis, PRUnichar * *operatingSystem);
+
+    nsresult (*GetOSVersion)(IHost *pThis, PRUnichar * *OSVersion);
+
+    nsresult (*GetUTCTime)(IHost *pThis, PRInt64 *UTCTime);
+
+    nsresult (*GetAcceleration3DAvailable)(IHost *pThis, PRBool *acceleration3DAvailable);
+
+    nsresult (*GetVideoInputDevices)(IHost *pThis, PRUint32 *videoInputDevicesSize, IHostVideoInputDevice * **videoInputDevices);
+
+    nsresult (*GetProcessorSpeed)(
+        IHost *pThis,
+        PRUint32 cpuId,
+        PRUint32 * speed
+    );
+
+    nsresult (*GetProcessorFeature)(
+        IHost *pThis,
+        PRUint32 feature,
+        PRBool * supported
+    );
+
+    nsresult (*GetProcessorDescription)(
+        IHost *pThis,
+        PRUint32 cpuId,
+        PRUnichar * * description
+    );
+
+    nsresult (*GetProcessorCPUIDLeaf)(
+        IHost *pThis,
+        PRUint32 cpuId,
+        PRUint32 leaf,
+        PRUint32 subLeaf,
+        PRUint32 * valEax,
+        PRUint32 * valEbx,
+        PRUint32 * valEcx,
+        PRUint32 * valEdx
+    );
+
+    nsresult (*CreateHostOnlyNetworkInterface)(
+        IHost *pThis,
+        IHostNetworkInterface * * hostInterface,
+        IProgress * * progress
+    );
+
+    nsresult (*RemoveHostOnlyNetworkInterface)(
+        IHost *pThis,
+        PRUnichar * id,
+        IProgress * * progress
+    );
+
+    nsresult (*CreateUSBDeviceFilter)(
+        IHost *pThis,
+        PRUnichar * name,
+        IHostUSBDeviceFilter * * filter
+    );
+
+    nsresult (*InsertUSBDeviceFilter)(
+        IHost *pThis,
+        PRUint32 position,
+        IHostUSBDeviceFilter * filter
+    );
+
+    nsresult (*RemoveUSBDeviceFilter)(
+        IHost *pThis,
+        PRUint32 position
+    );
+
+    nsresult (*FindHostDVDDrive)(
+        IHost *pThis,
+        PRUnichar * name,
+        IMedium * * drive
+    );
+
+    nsresult (*FindHostFloppyDrive)(
+        IHost *pThis,
+        PRUnichar * name,
+        IMedium * * drive
+    );
+
+    nsresult (*FindHostNetworkInterfaceByName)(
+        IHost *pThis,
+        PRUnichar * name,
+        IHostNetworkInterface * * networkInterface
+    );
+
+    nsresult (*FindHostNetworkInterfaceById)(
+        IHost *pThis,
+        PRUnichar * id,
+        IHostNetworkInterface * * networkInterface
+    );
+
+    nsresult (*FindHostNetworkInterfacesOfType)(
+        IHost *pThis,
+        PRUint32 type,
+        PRUint32 *networkInterfacesSize,
+        IHostNetworkInterface *** networkInterfaces
+    );
+
+    nsresult (*FindUSBDeviceById)(
+        IHost *pThis,
+        PRUnichar * id,
+        IHostUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceByAddress)(
+        IHost *pThis,
+        PRUnichar * name,
+        IHostUSBDevice * * device
+    );
+
+    nsresult (*GenerateMACAddress)(
+        IHost *pThis,
+        PRUnichar * * address
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IHostVtbl
+{
+    nsresult (*QueryInterface)(IHost *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IHost *pThis);
+    nsrefcnt (*Release)(IHost *pThis);
+    nsresult (*GetDVDDrives)(IHost *pThis, PRUint32 *DVDDrivesSize, IMedium * **DVDDrives);
+
+    nsresult (*GetFloppyDrives)(IHost *pThis, PRUint32 *floppyDrivesSize, IMedium * **floppyDrives);
+
+    nsresult (*GetUSBDevices)(IHost *pThis, PRUint32 *USBDevicesSize, IHostUSBDevice * **USBDevices);
+
+    nsresult (*GetUSBDeviceFilters)(IHost *pThis, PRUint32 *USBDeviceFiltersSize, IHostUSBDeviceFilter * **USBDeviceFilters);
+
+    nsresult (*GetNetworkInterfaces)(IHost *pThis, PRUint32 *networkInterfacesSize, IHostNetworkInterface * **networkInterfaces);
+
+    nsresult (*GetNameServers)(IHost *pThis, PRUint32 *nameServersSize, PRUnichar * **nameServers);
+
+    nsresult (*GetDomainName)(IHost *pThis, PRUnichar * *domainName);
+
+    nsresult (*GetSearchStrings)(IHost *pThis, PRUint32 *searchStringsSize, PRUnichar * **searchStrings);
+
+    nsresult (*GetProcessorCount)(IHost *pThis, PRUint32 *processorCount);
+
+    nsresult (*GetProcessorOnlineCount)(IHost *pThis, PRUint32 *processorOnlineCount);
+
+    nsresult (*GetProcessorCoreCount)(IHost *pThis, PRUint32 *processorCoreCount);
+
+    nsresult (*GetProcessorOnlineCoreCount)(IHost *pThis, PRUint32 *processorOnlineCoreCount);
+
+    nsresult (*GetMemorySize)(IHost *pThis, PRUint32 *memorySize);
+
+    nsresult (*GetMemoryAvailable)(IHost *pThis, PRUint32 *memoryAvailable);
+
+    nsresult (*GetOperatingSystem)(IHost *pThis, PRUnichar * *operatingSystem);
+
+    nsresult (*GetOSVersion)(IHost *pThis, PRUnichar * *OSVersion);
+
+    nsresult (*GetUTCTime)(IHost *pThis, PRInt64 *UTCTime);
+
+    nsresult (*GetAcceleration3DAvailable)(IHost *pThis, PRBool *acceleration3DAvailable);
+
+    nsresult (*GetVideoInputDevices)(IHost *pThis, PRUint32 *videoInputDevicesSize, IHostVideoInputDevice * **videoInputDevices);
+
+    nsresult (*GetProcessorSpeed)(
+        IHost *pThis,
+        PRUint32 cpuId,
+        PRUint32 * speed
+    );
+
+    nsresult (*GetProcessorFeature)(
+        IHost *pThis,
+        PRUint32 feature,
+        PRBool * supported
+    );
+
+    nsresult (*GetProcessorDescription)(
+        IHost *pThis,
+        PRUint32 cpuId,
+        PRUnichar * * description
+    );
+
+    nsresult (*GetProcessorCPUIDLeaf)(
+        IHost *pThis,
+        PRUint32 cpuId,
+        PRUint32 leaf,
+        PRUint32 subLeaf,
+        PRUint32 * valEax,
+        PRUint32 * valEbx,
+        PRUint32 * valEcx,
+        PRUint32 * valEdx
+    );
+
+    nsresult (*CreateHostOnlyNetworkInterface)(
+        IHost *pThis,
+        IHostNetworkInterface * * hostInterface,
+        IProgress * * progress
+    );
+
+    nsresult (*RemoveHostOnlyNetworkInterface)(
+        IHost *pThis,
+        PRUnichar * id,
+        IProgress * * progress
+    );
+
+    nsresult (*CreateUSBDeviceFilter)(
+        IHost *pThis,
+        PRUnichar * name,
+        IHostUSBDeviceFilter * * filter
+    );
+
+    nsresult (*InsertUSBDeviceFilter)(
+        IHost *pThis,
+        PRUint32 position,
+        IHostUSBDeviceFilter * filter
+    );
+
+    nsresult (*RemoveUSBDeviceFilter)(
+        IHost *pThis,
+        PRUint32 position
+    );
+
+    nsresult (*FindHostDVDDrive)(
+        IHost *pThis,
+        PRUnichar * name,
+        IMedium * * drive
+    );
+
+    nsresult (*FindHostFloppyDrive)(
+        IHost *pThis,
+        PRUnichar * name,
+        IMedium * * drive
+    );
+
+    nsresult (*FindHostNetworkInterfaceByName)(
+        IHost *pThis,
+        PRUnichar * name,
+        IHostNetworkInterface * * networkInterface
+    );
+
+    nsresult (*FindHostNetworkInterfaceById)(
+        IHost *pThis,
+        PRUnichar * id,
+        IHostNetworkInterface * * networkInterface
+    );
+
+    nsresult (*FindHostNetworkInterfacesOfType)(
+        IHost *pThis,
+        PRUint32 type,
+        PRUint32 *networkInterfacesSize,
+        IHostNetworkInterface *** networkInterfaces
+    );
+
+    nsresult (*FindUSBDeviceById)(
+        IHost *pThis,
+        PRUnichar * id,
+        IHostUSBDevice * * device
+    );
+
+    nsresult (*FindUSBDeviceByAddress)(
+        IHost *pThis,
+        PRUnichar * name,
+        IHostUSBDevice * * device
+    );
+
+    nsresult (*GenerateMACAddress)(
+        IHost *pThis,
+        PRUnichar * * address
+    );
+
+};
+#define IHost_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IHost_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IHost_Release(p) ((p)->lpVtbl->Release(p))
+#define IHost_get_DVDDrives(p, aDVDDrives) ((p)->lpVtbl->GetDVDDrives(p, aDVDDrives))
+#define IHost_GetDVDDrives(p, aDVDDrives) ((p)->lpVtbl->GetDVDDrives(p, aDVDDrives))
+#define IHost_get_FloppyDrives(p, aFloppyDrives) ((p)->lpVtbl->GetFloppyDrives(p, aFloppyDrives))
+#define IHost_GetFloppyDrives(p, aFloppyDrives) ((p)->lpVtbl->GetFloppyDrives(p, aFloppyDrives))
+#define IHost_get_USBDevices(p, aUSBDevices) ((p)->lpVtbl->GetUSBDevices(p, aUSBDevices))
+#define IHost_GetUSBDevices(p, aUSBDevices) ((p)->lpVtbl->GetUSBDevices(p, aUSBDevices))
+#define IHost_get_USBDeviceFilters(p, aUSBDeviceFilters) ((p)->lpVtbl->GetUSBDeviceFilters(p, aUSBDeviceFilters))
+#define IHost_GetUSBDeviceFilters(p, aUSBDeviceFilters) ((p)->lpVtbl->GetUSBDeviceFilters(p, aUSBDeviceFilters))
+#define IHost_get_NetworkInterfaces(p, aNetworkInterfaces) ((p)->lpVtbl->GetNetworkInterfaces(p, aNetworkInterfaces))
+#define IHost_GetNetworkInterfaces(p, aNetworkInterfaces) ((p)->lpVtbl->GetNetworkInterfaces(p, aNetworkInterfaces))
+#define IHost_get_NameServers(p, aNameServers) ((p)->lpVtbl->GetNameServers(p, aNameServers))
+#define IHost_GetNameServers(p, aNameServers) ((p)->lpVtbl->GetNameServers(p, aNameServers))
+#define IHost_get_DomainName(p, aDomainName) ((p)->lpVtbl->GetDomainName(p, aDomainName))
+#define IHost_GetDomainName(p, aDomainName) ((p)->lpVtbl->GetDomainName(p, aDomainName))
+#define IHost_get_SearchStrings(p, aSearchStrings) ((p)->lpVtbl->GetSearchStrings(p, aSearchStrings))
+#define IHost_GetSearchStrings(p, aSearchStrings) ((p)->lpVtbl->GetSearchStrings(p, aSearchStrings))
+#define IHost_get_ProcessorCount(p, aProcessorCount) ((p)->lpVtbl->GetProcessorCount(p, aProcessorCount))
+#define IHost_GetProcessorCount(p, aProcessorCount) ((p)->lpVtbl->GetProcessorCount(p, aProcessorCount))
+#define IHost_get_ProcessorOnlineCount(p, aProcessorOnlineCount) ((p)->lpVtbl->GetProcessorOnlineCount(p, aProcessorOnlineCount))
+#define IHost_GetProcessorOnlineCount(p, aProcessorOnlineCount) ((p)->lpVtbl->GetProcessorOnlineCount(p, aProcessorOnlineCount))
+#define IHost_get_ProcessorCoreCount(p, aProcessorCoreCount) ((p)->lpVtbl->GetProcessorCoreCount(p, aProcessorCoreCount))
+#define IHost_GetProcessorCoreCount(p, aProcessorCoreCount) ((p)->lpVtbl->GetProcessorCoreCount(p, aProcessorCoreCount))
+#define IHost_get_ProcessorOnlineCoreCount(p, aProcessorOnlineCoreCount) ((p)->lpVtbl->GetProcessorOnlineCoreCount(p, aProcessorOnlineCoreCount))
+#define IHost_GetProcessorOnlineCoreCount(p, aProcessorOnlineCoreCount) ((p)->lpVtbl->GetProcessorOnlineCoreCount(p, aProcessorOnlineCoreCount))
+#define IHost_get_MemorySize(p, aMemorySize) ((p)->lpVtbl->GetMemorySize(p, aMemorySize))
+#define IHost_GetMemorySize(p, aMemorySize) ((p)->lpVtbl->GetMemorySize(p, aMemorySize))
+#define IHost_get_MemoryAvailable(p, aMemoryAvailable) ((p)->lpVtbl->GetMemoryAvailable(p, aMemoryAvailable))
+#define IHost_GetMemoryAvailable(p, aMemoryAvailable) ((p)->lpVtbl->GetMemoryAvailable(p, aMemoryAvailable))
+#define IHost_get_OperatingSystem(p, aOperatingSystem) ((p)->lpVtbl->GetOperatingSystem(p, aOperatingSystem))
+#define IHost_GetOperatingSystem(p, aOperatingSystem) ((p)->lpVtbl->GetOperatingSystem(p, aOperatingSystem))
+#define IHost_get_OSVersion(p, aOSVersion) ((p)->lpVtbl->GetOSVersion(p, aOSVersion))
+#define IHost_GetOSVersion(p, aOSVersion) ((p)->lpVtbl->GetOSVersion(p, aOSVersion))
+#define IHost_get_UTCTime(p, aUTCTime) ((p)->lpVtbl->GetUTCTime(p, aUTCTime))
+#define IHost_GetUTCTime(p, aUTCTime) ((p)->lpVtbl->GetUTCTime(p, aUTCTime))
+#define IHost_get_Acceleration3DAvailable(p, aAcceleration3DAvailable) ((p)->lpVtbl->GetAcceleration3DAvailable(p, aAcceleration3DAvailable))
+#define IHost_GetAcceleration3DAvailable(p, aAcceleration3DAvailable) ((p)->lpVtbl->GetAcceleration3DAvailable(p, aAcceleration3DAvailable))
+#define IHost_get_VideoInputDevices(p, aVideoInputDevices) ((p)->lpVtbl->GetVideoInputDevices(p, aVideoInputDevices))
+#define IHost_GetVideoInputDevices(p, aVideoInputDevices) ((p)->lpVtbl->GetVideoInputDevices(p, aVideoInputDevices))
+#define IHost_GetProcessorSpeed(p, aCpuId, aSpeed) ((p)->lpVtbl->GetProcessorSpeed(p, aCpuId, aSpeed))
+#define IHost_GetProcessorFeature(p, aFeature, aSupported) ((p)->lpVtbl->GetProcessorFeature(p, aFeature, aSupported))
+#define IHost_GetProcessorDescription(p, aCpuId, aDescription) ((p)->lpVtbl->GetProcessorDescription(p, aCpuId, aDescription))
+#define IHost_GetProcessorCPUIDLeaf(p, aCpuId, aLeaf, aSubLeaf, aValEax, aValEbx, aValEcx, aValEdx) ((p)->lpVtbl->GetProcessorCPUIDLeaf(p, aCpuId, aLeaf, aSubLeaf, aValEax, aValEbx, aValEcx, aValEdx))
+#define IHost_CreateHostOnlyNetworkInterface(p, aHostInterface, aProgress) ((p)->lpVtbl->CreateHostOnlyNetworkInterface(p, aHostInterface, aProgress))
+#define IHost_RemoveHostOnlyNetworkInterface(p, aId, aProgress) ((p)->lpVtbl->RemoveHostOnlyNetworkInterface(p, aId, aProgress))
+#define IHost_CreateUSBDeviceFilter(p, aName, aFilter) ((p)->lpVtbl->CreateUSBDeviceFilter(p, aName, aFilter))
+#define IHost_InsertUSBDeviceFilter(p, aPosition, aFilter) ((p)->lpVtbl->InsertUSBDeviceFilter(p, aPosition, aFilter))
+#define IHost_RemoveUSBDeviceFilter(p, aPosition) ((p)->lpVtbl->RemoveUSBDeviceFilter(p, aPosition))
+#define IHost_FindHostDVDDrive(p, aName, aDrive) ((p)->lpVtbl->FindHostDVDDrive(p, aName, aDrive))
+#define IHost_FindHostFloppyDrive(p, aName, aDrive) ((p)->lpVtbl->FindHostFloppyDrive(p, aName, aDrive))
+#define IHost_FindHostNetworkInterfaceByName(p, aName, aNetworkInterface) ((p)->lpVtbl->FindHostNetworkInterfaceByName(p, aName, aNetworkInterface))
+#define IHost_FindHostNetworkInterfaceById(p, aId, aNetworkInterface) ((p)->lpVtbl->FindHostNetworkInterfaceById(p, aId, aNetworkInterface))
+#define IHost_FindHostNetworkInterfacesOfType(p, aType, aNetworkInterfaces) ((p)->lpVtbl->FindHostNetworkInterfacesOfType(p, aType, aNetworkInterfaces))
+#define IHost_FindUSBDeviceById(p, aId, aDevice) ((p)->lpVtbl->FindUSBDeviceById(p, aId, aDevice))
+#define IHost_FindUSBDeviceByAddress(p, aName, aDevice) ((p)->lpVtbl->FindUSBDeviceByAddress(p, aName, aDevice))
+#define IHost_GenerateMACAddress(p, aAddress) ((p)->lpVtbl->GenerateMACAddress(p, aAddress))
+#endif /* VBOX_WITH_GLUE */
+
+interface IHost
+{
+#ifndef VBOX_WITH_GLUE
+    struct IHost_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IHostVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IHost declaration */
+
+
+/* Start of struct ISystemProperties declaration */
+#define ISYSTEMPROPERTIES_IID_STR "1254a96a-ae57-4484-946a-22d86c1f98af"
+#define ISYSTEMPROPERTIES_IID { \
+    0x1254a96a, 0xae57, 0x4484, \
+    { 0x94, 0x6a, 0x22, 0xd8, 0x6c, 0x1f, 0x98, 0xaf } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISystemProperties);
+#ifndef VBOX_WITH_GLUE
+struct ISystemProperties_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMinGuestRAM)(ISystemProperties *pThis, PRUint32 *minGuestRAM);
+
+    nsresult (*GetMaxGuestRAM)(ISystemProperties *pThis, PRUint32 *maxGuestRAM);
+
+    nsresult (*GetMinGuestVRAM)(ISystemProperties *pThis, PRUint32 *minGuestVRAM);
+
+    nsresult (*GetMaxGuestVRAM)(ISystemProperties *pThis, PRUint32 *maxGuestVRAM);
+
+    nsresult (*GetMinGuestCPUCount)(ISystemProperties *pThis, PRUint32 *minGuestCPUCount);
+
+    nsresult (*GetMaxGuestCPUCount)(ISystemProperties *pThis, PRUint32 *maxGuestCPUCount);
+
+    nsresult (*GetMaxGuestMonitors)(ISystemProperties *pThis, PRUint32 *maxGuestMonitors);
+
+    nsresult (*GetInfoVDSize)(ISystemProperties *pThis, PRInt64 *infoVDSize);
+
+    nsresult (*GetSerialPortCount)(ISystemProperties *pThis, PRUint32 *serialPortCount);
+
+    nsresult (*GetParallelPortCount)(ISystemProperties *pThis, PRUint32 *parallelPortCount);
+
+    nsresult (*GetMaxBootPosition)(ISystemProperties *pThis, PRUint32 *maxBootPosition);
+
+    nsresult (*GetExclusiveHwVirt)(ISystemProperties *pThis, PRBool *exclusiveHwVirt);
+    nsresult (*SetExclusiveHwVirt)(ISystemProperties *pThis, PRBool exclusiveHwVirt);
+
+    nsresult (*GetDefaultMachineFolder)(ISystemProperties *pThis, PRUnichar * *defaultMachineFolder);
+    nsresult (*SetDefaultMachineFolder)(ISystemProperties *pThis, PRUnichar * defaultMachineFolder);
+
+    nsresult (*GetLoggingLevel)(ISystemProperties *pThis, PRUnichar * *loggingLevel);
+    nsresult (*SetLoggingLevel)(ISystemProperties *pThis, PRUnichar * loggingLevel);
+
+    nsresult (*GetMediumFormats)(ISystemProperties *pThis, PRUint32 *mediumFormatsSize, IMediumFormat * **mediumFormats);
+
+    nsresult (*GetDefaultHardDiskFormat)(ISystemProperties *pThis, PRUnichar * *defaultHardDiskFormat);
+    nsresult (*SetDefaultHardDiskFormat)(ISystemProperties *pThis, PRUnichar * defaultHardDiskFormat);
+
+    nsresult (*GetFreeDiskSpaceWarning)(ISystemProperties *pThis, PRInt64 *freeDiskSpaceWarning);
+    nsresult (*SetFreeDiskSpaceWarning)(ISystemProperties *pThis, PRInt64 freeDiskSpaceWarning);
+
+    nsresult (*GetFreeDiskSpacePercentWarning)(ISystemProperties *pThis, PRUint32 *freeDiskSpacePercentWarning);
+    nsresult (*SetFreeDiskSpacePercentWarning)(ISystemProperties *pThis, PRUint32 freeDiskSpacePercentWarning);
+
+    nsresult (*GetFreeDiskSpaceError)(ISystemProperties *pThis, PRInt64 *freeDiskSpaceError);
+    nsresult (*SetFreeDiskSpaceError)(ISystemProperties *pThis, PRInt64 freeDiskSpaceError);
+
+    nsresult (*GetFreeDiskSpacePercentError)(ISystemProperties *pThis, PRUint32 *freeDiskSpacePercentError);
+    nsresult (*SetFreeDiskSpacePercentError)(ISystemProperties *pThis, PRUint32 freeDiskSpacePercentError);
+
+    nsresult (*GetVRDEAuthLibrary)(ISystemProperties *pThis, PRUnichar * *VRDEAuthLibrary);
+    nsresult (*SetVRDEAuthLibrary)(ISystemProperties *pThis, PRUnichar * VRDEAuthLibrary);
+
+    nsresult (*GetWebServiceAuthLibrary)(ISystemProperties *pThis, PRUnichar * *webServiceAuthLibrary);
+    nsresult (*SetWebServiceAuthLibrary)(ISystemProperties *pThis, PRUnichar * webServiceAuthLibrary);
+
+    nsresult (*GetDefaultVRDEExtPack)(ISystemProperties *pThis, PRUnichar * *defaultVRDEExtPack);
+    nsresult (*SetDefaultVRDEExtPack)(ISystemProperties *pThis, PRUnichar * defaultVRDEExtPack);
+
+    nsresult (*GetLogHistoryCount)(ISystemProperties *pThis, PRUint32 *logHistoryCount);
+    nsresult (*SetLogHistoryCount)(ISystemProperties *pThis, PRUint32 logHistoryCount);
+
+    nsresult (*GetDefaultAudioDriver)(ISystemProperties *pThis, PRUint32 *defaultAudioDriver);
+
+    nsresult (*GetAutostartDatabasePath)(ISystemProperties *pThis, PRUnichar * *autostartDatabasePath);
+    nsresult (*SetAutostartDatabasePath)(ISystemProperties *pThis, PRUnichar * autostartDatabasePath);
+
+    nsresult (*GetDefaultAdditionsISO)(ISystemProperties *pThis, PRUnichar * *defaultAdditionsISO);
+    nsresult (*SetDefaultAdditionsISO)(ISystemProperties *pThis, PRUnichar * defaultAdditionsISO);
+
+    nsresult (*GetDefaultFrontend)(ISystemProperties *pThis, PRUnichar * *defaultFrontend);
+    nsresult (*SetDefaultFrontend)(ISystemProperties *pThis, PRUnichar * defaultFrontend);
+
+    nsresult (*GetMaxNetworkAdapters)(
+        ISystemProperties *pThis,
+        PRUint32 chipset,
+        PRUint32 * maxNetworkAdapters
+    );
+
+    nsresult (*GetMaxNetworkAdaptersOfType)(
+        ISystemProperties *pThis,
+        PRUint32 chipset,
+        PRUint32 type,
+        PRUint32 * maxNetworkAdapters
+    );
+
+    nsresult (*GetMaxDevicesPerPortForStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 bus,
+        PRUint32 * maxDevicesPerPort
+    );
+
+    nsresult (*GetMinPortCountForStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 bus,
+        PRUint32 * minPortCount
+    );
+
+    nsresult (*GetMaxPortCountForStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 bus,
+        PRUint32 * maxPortCount
+    );
+
+    nsresult (*GetMaxInstancesOfStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 chipset,
+        PRUint32 bus,
+        PRUint32 * maxInstances
+    );
+
+    nsresult (*GetDeviceTypesForStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 bus,
+        PRUint32 *deviceTypesSize,
+        PRUint32** deviceTypes
+    );
+
+    nsresult (*GetDefaultIoCacheSettingForStorageController)(
+        ISystemProperties *pThis,
+        PRUint32 controllerType,
+        PRBool * enabled
+    );
+
+    nsresult (*GetMaxInstancesOfUSBControllerType)(
+        ISystemProperties *pThis,
+        PRUint32 chipset,
+        PRUint32 type,
+        PRUint32 * maxInstances
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISystemPropertiesVtbl
+{
+    nsresult (*QueryInterface)(ISystemProperties *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISystemProperties *pThis);
+    nsrefcnt (*Release)(ISystemProperties *pThis);
+    nsresult (*GetMinGuestRAM)(ISystemProperties *pThis, PRUint32 *minGuestRAM);
+
+    nsresult (*GetMaxGuestRAM)(ISystemProperties *pThis, PRUint32 *maxGuestRAM);
+
+    nsresult (*GetMinGuestVRAM)(ISystemProperties *pThis, PRUint32 *minGuestVRAM);
+
+    nsresult (*GetMaxGuestVRAM)(ISystemProperties *pThis, PRUint32 *maxGuestVRAM);
+
+    nsresult (*GetMinGuestCPUCount)(ISystemProperties *pThis, PRUint32 *minGuestCPUCount);
+
+    nsresult (*GetMaxGuestCPUCount)(ISystemProperties *pThis, PRUint32 *maxGuestCPUCount);
+
+    nsresult (*GetMaxGuestMonitors)(ISystemProperties *pThis, PRUint32 *maxGuestMonitors);
+
+    nsresult (*GetInfoVDSize)(ISystemProperties *pThis, PRInt64 *infoVDSize);
+
+    nsresult (*GetSerialPortCount)(ISystemProperties *pThis, PRUint32 *serialPortCount);
+
+    nsresult (*GetParallelPortCount)(ISystemProperties *pThis, PRUint32 *parallelPortCount);
+
+    nsresult (*GetMaxBootPosition)(ISystemProperties *pThis, PRUint32 *maxBootPosition);
+
+    nsresult (*GetExclusiveHwVirt)(ISystemProperties *pThis, PRBool *exclusiveHwVirt);
+    nsresult (*SetExclusiveHwVirt)(ISystemProperties *pThis, PRBool exclusiveHwVirt);
+
+    nsresult (*GetDefaultMachineFolder)(ISystemProperties *pThis, PRUnichar * *defaultMachineFolder);
+    nsresult (*SetDefaultMachineFolder)(ISystemProperties *pThis, PRUnichar * defaultMachineFolder);
+
+    nsresult (*GetLoggingLevel)(ISystemProperties *pThis, PRUnichar * *loggingLevel);
+    nsresult (*SetLoggingLevel)(ISystemProperties *pThis, PRUnichar * loggingLevel);
+
+    nsresult (*GetMediumFormats)(ISystemProperties *pThis, PRUint32 *mediumFormatsSize, IMediumFormat * **mediumFormats);
+
+    nsresult (*GetDefaultHardDiskFormat)(ISystemProperties *pThis, PRUnichar * *defaultHardDiskFormat);
+    nsresult (*SetDefaultHardDiskFormat)(ISystemProperties *pThis, PRUnichar * defaultHardDiskFormat);
+
+    nsresult (*GetFreeDiskSpaceWarning)(ISystemProperties *pThis, PRInt64 *freeDiskSpaceWarning);
+    nsresult (*SetFreeDiskSpaceWarning)(ISystemProperties *pThis, PRInt64 freeDiskSpaceWarning);
+
+    nsresult (*GetFreeDiskSpacePercentWarning)(ISystemProperties *pThis, PRUint32 *freeDiskSpacePercentWarning);
+    nsresult (*SetFreeDiskSpacePercentWarning)(ISystemProperties *pThis, PRUint32 freeDiskSpacePercentWarning);
+
+    nsresult (*GetFreeDiskSpaceError)(ISystemProperties *pThis, PRInt64 *freeDiskSpaceError);
+    nsresult (*SetFreeDiskSpaceError)(ISystemProperties *pThis, PRInt64 freeDiskSpaceError);
+
+    nsresult (*GetFreeDiskSpacePercentError)(ISystemProperties *pThis, PRUint32 *freeDiskSpacePercentError);
+    nsresult (*SetFreeDiskSpacePercentError)(ISystemProperties *pThis, PRUint32 freeDiskSpacePercentError);
+
+    nsresult (*GetVRDEAuthLibrary)(ISystemProperties *pThis, PRUnichar * *VRDEAuthLibrary);
+    nsresult (*SetVRDEAuthLibrary)(ISystemProperties *pThis, PRUnichar * VRDEAuthLibrary);
+
+    nsresult (*GetWebServiceAuthLibrary)(ISystemProperties *pThis, PRUnichar * *webServiceAuthLibrary);
+    nsresult (*SetWebServiceAuthLibrary)(ISystemProperties *pThis, PRUnichar * webServiceAuthLibrary);
+
+    nsresult (*GetDefaultVRDEExtPack)(ISystemProperties *pThis, PRUnichar * *defaultVRDEExtPack);
+    nsresult (*SetDefaultVRDEExtPack)(ISystemProperties *pThis, PRUnichar * defaultVRDEExtPack);
+
+    nsresult (*GetLogHistoryCount)(ISystemProperties *pThis, PRUint32 *logHistoryCount);
+    nsresult (*SetLogHistoryCount)(ISystemProperties *pThis, PRUint32 logHistoryCount);
+
+    nsresult (*GetDefaultAudioDriver)(ISystemProperties *pThis, PRUint32 *defaultAudioDriver);
+
+    nsresult (*GetAutostartDatabasePath)(ISystemProperties *pThis, PRUnichar * *autostartDatabasePath);
+    nsresult (*SetAutostartDatabasePath)(ISystemProperties *pThis, PRUnichar * autostartDatabasePath);
+
+    nsresult (*GetDefaultAdditionsISO)(ISystemProperties *pThis, PRUnichar * *defaultAdditionsISO);
+    nsresult (*SetDefaultAdditionsISO)(ISystemProperties *pThis, PRUnichar * defaultAdditionsISO);
+
+    nsresult (*GetDefaultFrontend)(ISystemProperties *pThis, PRUnichar * *defaultFrontend);
+    nsresult (*SetDefaultFrontend)(ISystemProperties *pThis, PRUnichar * defaultFrontend);
+
+    nsresult (*GetMaxNetworkAdapters)(
+        ISystemProperties *pThis,
+        PRUint32 chipset,
+        PRUint32 * maxNetworkAdapters
+    );
+
+    nsresult (*GetMaxNetworkAdaptersOfType)(
+        ISystemProperties *pThis,
+        PRUint32 chipset,
+        PRUint32 type,
+        PRUint32 * maxNetworkAdapters
+    );
+
+    nsresult (*GetMaxDevicesPerPortForStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 bus,
+        PRUint32 * maxDevicesPerPort
+    );
+
+    nsresult (*GetMinPortCountForStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 bus,
+        PRUint32 * minPortCount
+    );
+
+    nsresult (*GetMaxPortCountForStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 bus,
+        PRUint32 * maxPortCount
+    );
+
+    nsresult (*GetMaxInstancesOfStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 chipset,
+        PRUint32 bus,
+        PRUint32 * maxInstances
+    );
+
+    nsresult (*GetDeviceTypesForStorageBus)(
+        ISystemProperties *pThis,
+        PRUint32 bus,
+        PRUint32 *deviceTypesSize,
+        PRUint32** deviceTypes
+    );
+
+    nsresult (*GetDefaultIoCacheSettingForStorageController)(
+        ISystemProperties *pThis,
+        PRUint32 controllerType,
+        PRBool * enabled
+    );
+
+    nsresult (*GetMaxInstancesOfUSBControllerType)(
+        ISystemProperties *pThis,
+        PRUint32 chipset,
+        PRUint32 type,
+        PRUint32 * maxInstances
+    );
+
+};
+#define ISystemProperties_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISystemProperties_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISystemProperties_Release(p) ((p)->lpVtbl->Release(p))
+#define ISystemProperties_get_MinGuestRAM(p, aMinGuestRAM) ((p)->lpVtbl->GetMinGuestRAM(p, aMinGuestRAM))
+#define ISystemProperties_GetMinGuestRAM(p, aMinGuestRAM) ((p)->lpVtbl->GetMinGuestRAM(p, aMinGuestRAM))
+#define ISystemProperties_get_MaxGuestRAM(p, aMaxGuestRAM) ((p)->lpVtbl->GetMaxGuestRAM(p, aMaxGuestRAM))
+#define ISystemProperties_GetMaxGuestRAM(p, aMaxGuestRAM) ((p)->lpVtbl->GetMaxGuestRAM(p, aMaxGuestRAM))
+#define ISystemProperties_get_MinGuestVRAM(p, aMinGuestVRAM) ((p)->lpVtbl->GetMinGuestVRAM(p, aMinGuestVRAM))
+#define ISystemProperties_GetMinGuestVRAM(p, aMinGuestVRAM) ((p)->lpVtbl->GetMinGuestVRAM(p, aMinGuestVRAM))
+#define ISystemProperties_get_MaxGuestVRAM(p, aMaxGuestVRAM) ((p)->lpVtbl->GetMaxGuestVRAM(p, aMaxGuestVRAM))
+#define ISystemProperties_GetMaxGuestVRAM(p, aMaxGuestVRAM) ((p)->lpVtbl->GetMaxGuestVRAM(p, aMaxGuestVRAM))
+#define ISystemProperties_get_MinGuestCPUCount(p, aMinGuestCPUCount) ((p)->lpVtbl->GetMinGuestCPUCount(p, aMinGuestCPUCount))
+#define ISystemProperties_GetMinGuestCPUCount(p, aMinGuestCPUCount) ((p)->lpVtbl->GetMinGuestCPUCount(p, aMinGuestCPUCount))
+#define ISystemProperties_get_MaxGuestCPUCount(p, aMaxGuestCPUCount) ((p)->lpVtbl->GetMaxGuestCPUCount(p, aMaxGuestCPUCount))
+#define ISystemProperties_GetMaxGuestCPUCount(p, aMaxGuestCPUCount) ((p)->lpVtbl->GetMaxGuestCPUCount(p, aMaxGuestCPUCount))
+#define ISystemProperties_get_MaxGuestMonitors(p, aMaxGuestMonitors) ((p)->lpVtbl->GetMaxGuestMonitors(p, aMaxGuestMonitors))
+#define ISystemProperties_GetMaxGuestMonitors(p, aMaxGuestMonitors) ((p)->lpVtbl->GetMaxGuestMonitors(p, aMaxGuestMonitors))
+#define ISystemProperties_get_InfoVDSize(p, aInfoVDSize) ((p)->lpVtbl->GetInfoVDSize(p, aInfoVDSize))
+#define ISystemProperties_GetInfoVDSize(p, aInfoVDSize) ((p)->lpVtbl->GetInfoVDSize(p, aInfoVDSize))
+#define ISystemProperties_get_SerialPortCount(p, aSerialPortCount) ((p)->lpVtbl->GetSerialPortCount(p, aSerialPortCount))
+#define ISystemProperties_GetSerialPortCount(p, aSerialPortCount) ((p)->lpVtbl->GetSerialPortCount(p, aSerialPortCount))
+#define ISystemProperties_get_ParallelPortCount(p, aParallelPortCount) ((p)->lpVtbl->GetParallelPortCount(p, aParallelPortCount))
+#define ISystemProperties_GetParallelPortCount(p, aParallelPortCount) ((p)->lpVtbl->GetParallelPortCount(p, aParallelPortCount))
+#define ISystemProperties_get_MaxBootPosition(p, aMaxBootPosition) ((p)->lpVtbl->GetMaxBootPosition(p, aMaxBootPosition))
+#define ISystemProperties_GetMaxBootPosition(p, aMaxBootPosition) ((p)->lpVtbl->GetMaxBootPosition(p, aMaxBootPosition))
+#define ISystemProperties_get_ExclusiveHwVirt(p, aExclusiveHwVirt) ((p)->lpVtbl->GetExclusiveHwVirt(p, aExclusiveHwVirt))
+#define ISystemProperties_GetExclusiveHwVirt(p, aExclusiveHwVirt) ((p)->lpVtbl->GetExclusiveHwVirt(p, aExclusiveHwVirt))
+#define ISystemProperties_put_ExclusiveHwVirt(p, aExclusiveHwVirt) ((p)->lpVtbl->SetExclusiveHwVirt(p, aExclusiveHwVirt))
+#define ISystemProperties_SetExclusiveHwVirt(p, aExclusiveHwVirt) ((p)->lpVtbl->SetExclusiveHwVirt(p, aExclusiveHwVirt))
+#define ISystemProperties_get_DefaultMachineFolder(p, aDefaultMachineFolder) ((p)->lpVtbl->GetDefaultMachineFolder(p, aDefaultMachineFolder))
+#define ISystemProperties_GetDefaultMachineFolder(p, aDefaultMachineFolder) ((p)->lpVtbl->GetDefaultMachineFolder(p, aDefaultMachineFolder))
+#define ISystemProperties_put_DefaultMachineFolder(p, aDefaultMachineFolder) ((p)->lpVtbl->SetDefaultMachineFolder(p, aDefaultMachineFolder))
+#define ISystemProperties_SetDefaultMachineFolder(p, aDefaultMachineFolder) ((p)->lpVtbl->SetDefaultMachineFolder(p, aDefaultMachineFolder))
+#define ISystemProperties_get_LoggingLevel(p, aLoggingLevel) ((p)->lpVtbl->GetLoggingLevel(p, aLoggingLevel))
+#define ISystemProperties_GetLoggingLevel(p, aLoggingLevel) ((p)->lpVtbl->GetLoggingLevel(p, aLoggingLevel))
+#define ISystemProperties_put_LoggingLevel(p, aLoggingLevel) ((p)->lpVtbl->SetLoggingLevel(p, aLoggingLevel))
+#define ISystemProperties_SetLoggingLevel(p, aLoggingLevel) ((p)->lpVtbl->SetLoggingLevel(p, aLoggingLevel))
+#define ISystemProperties_get_MediumFormats(p, aMediumFormats) ((p)->lpVtbl->GetMediumFormats(p, aMediumFormats))
+#define ISystemProperties_GetMediumFormats(p, aMediumFormats) ((p)->lpVtbl->GetMediumFormats(p, aMediumFormats))
+#define ISystemProperties_get_DefaultHardDiskFormat(p, aDefaultHardDiskFormat) ((p)->lpVtbl->GetDefaultHardDiskFormat(p, aDefaultHardDiskFormat))
+#define ISystemProperties_GetDefaultHardDiskFormat(p, aDefaultHardDiskFormat) ((p)->lpVtbl->GetDefaultHardDiskFormat(p, aDefaultHardDiskFormat))
+#define ISystemProperties_put_DefaultHardDiskFormat(p, aDefaultHardDiskFormat) ((p)->lpVtbl->SetDefaultHardDiskFormat(p, aDefaultHardDiskFormat))
+#define ISystemProperties_SetDefaultHardDiskFormat(p, aDefaultHardDiskFormat) ((p)->lpVtbl->SetDefaultHardDiskFormat(p, aDefaultHardDiskFormat))
+#define ISystemProperties_get_FreeDiskSpaceWarning(p, aFreeDiskSpaceWarning) ((p)->lpVtbl->GetFreeDiskSpaceWarning(p, aFreeDiskSpaceWarning))
+#define ISystemProperties_GetFreeDiskSpaceWarning(p, aFreeDiskSpaceWarning) ((p)->lpVtbl->GetFreeDiskSpaceWarning(p, aFreeDiskSpaceWarning))
+#define ISystemProperties_put_FreeDiskSpaceWarning(p, aFreeDiskSpaceWarning) ((p)->lpVtbl->SetFreeDiskSpaceWarning(p, aFreeDiskSpaceWarning))
+#define ISystemProperties_SetFreeDiskSpaceWarning(p, aFreeDiskSpaceWarning) ((p)->lpVtbl->SetFreeDiskSpaceWarning(p, aFreeDiskSpaceWarning))
+#define ISystemProperties_get_FreeDiskSpacePercentWarning(p, aFreeDiskSpacePercentWarning) ((p)->lpVtbl->GetFreeDiskSpacePercentWarning(p, aFreeDiskSpacePercentWarning))
+#define ISystemProperties_GetFreeDiskSpacePercentWarning(p, aFreeDiskSpacePercentWarning) ((p)->lpVtbl->GetFreeDiskSpacePercentWarning(p, aFreeDiskSpacePercentWarning))
+#define ISystemProperties_put_FreeDiskSpacePercentWarning(p, aFreeDiskSpacePercentWarning) ((p)->lpVtbl->SetFreeDiskSpacePercentWarning(p, aFreeDiskSpacePercentWarning))
+#define ISystemProperties_SetFreeDiskSpacePercentWarning(p, aFreeDiskSpacePercentWarning) ((p)->lpVtbl->SetFreeDiskSpacePercentWarning(p, aFreeDiskSpacePercentWarning))
+#define ISystemProperties_get_FreeDiskSpaceError(p, aFreeDiskSpaceError) ((p)->lpVtbl->GetFreeDiskSpaceError(p, aFreeDiskSpaceError))
+#define ISystemProperties_GetFreeDiskSpaceError(p, aFreeDiskSpaceError) ((p)->lpVtbl->GetFreeDiskSpaceError(p, aFreeDiskSpaceError))
+#define ISystemProperties_put_FreeDiskSpaceError(p, aFreeDiskSpaceError) ((p)->lpVtbl->SetFreeDiskSpaceError(p, aFreeDiskSpaceError))
+#define ISystemProperties_SetFreeDiskSpaceError(p, aFreeDiskSpaceError) ((p)->lpVtbl->SetFreeDiskSpaceError(p, aFreeDiskSpaceError))
+#define ISystemProperties_get_FreeDiskSpacePercentError(p, aFreeDiskSpacePercentError) ((p)->lpVtbl->GetFreeDiskSpacePercentError(p, aFreeDiskSpacePercentError))
+#define ISystemProperties_GetFreeDiskSpacePercentError(p, aFreeDiskSpacePercentError) ((p)->lpVtbl->GetFreeDiskSpacePercentError(p, aFreeDiskSpacePercentError))
+#define ISystemProperties_put_FreeDiskSpacePercentError(p, aFreeDiskSpacePercentError) ((p)->lpVtbl->SetFreeDiskSpacePercentError(p, aFreeDiskSpacePercentError))
+#define ISystemProperties_SetFreeDiskSpacePercentError(p, aFreeDiskSpacePercentError) ((p)->lpVtbl->SetFreeDiskSpacePercentError(p, aFreeDiskSpacePercentError))
+#define ISystemProperties_get_VRDEAuthLibrary(p, aVRDEAuthLibrary) ((p)->lpVtbl->GetVRDEAuthLibrary(p, aVRDEAuthLibrary))
+#define ISystemProperties_GetVRDEAuthLibrary(p, aVRDEAuthLibrary) ((p)->lpVtbl->GetVRDEAuthLibrary(p, aVRDEAuthLibrary))
+#define ISystemProperties_put_VRDEAuthLibrary(p, aVRDEAuthLibrary) ((p)->lpVtbl->SetVRDEAuthLibrary(p, aVRDEAuthLibrary))
+#define ISystemProperties_SetVRDEAuthLibrary(p, aVRDEAuthLibrary) ((p)->lpVtbl->SetVRDEAuthLibrary(p, aVRDEAuthLibrary))
+#define ISystemProperties_get_WebServiceAuthLibrary(p, aWebServiceAuthLibrary) ((p)->lpVtbl->GetWebServiceAuthLibrary(p, aWebServiceAuthLibrary))
+#define ISystemProperties_GetWebServiceAuthLibrary(p, aWebServiceAuthLibrary) ((p)->lpVtbl->GetWebServiceAuthLibrary(p, aWebServiceAuthLibrary))
+#define ISystemProperties_put_WebServiceAuthLibrary(p, aWebServiceAuthLibrary) ((p)->lpVtbl->SetWebServiceAuthLibrary(p, aWebServiceAuthLibrary))
+#define ISystemProperties_SetWebServiceAuthLibrary(p, aWebServiceAuthLibrary) ((p)->lpVtbl->SetWebServiceAuthLibrary(p, aWebServiceAuthLibrary))
+#define ISystemProperties_get_DefaultVRDEExtPack(p, aDefaultVRDEExtPack) ((p)->lpVtbl->GetDefaultVRDEExtPack(p, aDefaultVRDEExtPack))
+#define ISystemProperties_GetDefaultVRDEExtPack(p, aDefaultVRDEExtPack) ((p)->lpVtbl->GetDefaultVRDEExtPack(p, aDefaultVRDEExtPack))
+#define ISystemProperties_put_DefaultVRDEExtPack(p, aDefaultVRDEExtPack) ((p)->lpVtbl->SetDefaultVRDEExtPack(p, aDefaultVRDEExtPack))
+#define ISystemProperties_SetDefaultVRDEExtPack(p, aDefaultVRDEExtPack) ((p)->lpVtbl->SetDefaultVRDEExtPack(p, aDefaultVRDEExtPack))
+#define ISystemProperties_get_LogHistoryCount(p, aLogHistoryCount) ((p)->lpVtbl->GetLogHistoryCount(p, aLogHistoryCount))
+#define ISystemProperties_GetLogHistoryCount(p, aLogHistoryCount) ((p)->lpVtbl->GetLogHistoryCount(p, aLogHistoryCount))
+#define ISystemProperties_put_LogHistoryCount(p, aLogHistoryCount) ((p)->lpVtbl->SetLogHistoryCount(p, aLogHistoryCount))
+#define ISystemProperties_SetLogHistoryCount(p, aLogHistoryCount) ((p)->lpVtbl->SetLogHistoryCount(p, aLogHistoryCount))
+#define ISystemProperties_get_DefaultAudioDriver(p, aDefaultAudioDriver) ((p)->lpVtbl->GetDefaultAudioDriver(p, aDefaultAudioDriver))
+#define ISystemProperties_GetDefaultAudioDriver(p, aDefaultAudioDriver) ((p)->lpVtbl->GetDefaultAudioDriver(p, aDefaultAudioDriver))
+#define ISystemProperties_get_AutostartDatabasePath(p, aAutostartDatabasePath) ((p)->lpVtbl->GetAutostartDatabasePath(p, aAutostartDatabasePath))
+#define ISystemProperties_GetAutostartDatabasePath(p, aAutostartDatabasePath) ((p)->lpVtbl->GetAutostartDatabasePath(p, aAutostartDatabasePath))
+#define ISystemProperties_put_AutostartDatabasePath(p, aAutostartDatabasePath) ((p)->lpVtbl->SetAutostartDatabasePath(p, aAutostartDatabasePath))
+#define ISystemProperties_SetAutostartDatabasePath(p, aAutostartDatabasePath) ((p)->lpVtbl->SetAutostartDatabasePath(p, aAutostartDatabasePath))
+#define ISystemProperties_get_DefaultAdditionsISO(p, aDefaultAdditionsISO) ((p)->lpVtbl->GetDefaultAdditionsISO(p, aDefaultAdditionsISO))
+#define ISystemProperties_GetDefaultAdditionsISO(p, aDefaultAdditionsISO) ((p)->lpVtbl->GetDefaultAdditionsISO(p, aDefaultAdditionsISO))
+#define ISystemProperties_put_DefaultAdditionsISO(p, aDefaultAdditionsISO) ((p)->lpVtbl->SetDefaultAdditionsISO(p, aDefaultAdditionsISO))
+#define ISystemProperties_SetDefaultAdditionsISO(p, aDefaultAdditionsISO) ((p)->lpVtbl->SetDefaultAdditionsISO(p, aDefaultAdditionsISO))
+#define ISystemProperties_get_DefaultFrontend(p, aDefaultFrontend) ((p)->lpVtbl->GetDefaultFrontend(p, aDefaultFrontend))
+#define ISystemProperties_GetDefaultFrontend(p, aDefaultFrontend) ((p)->lpVtbl->GetDefaultFrontend(p, aDefaultFrontend))
+#define ISystemProperties_put_DefaultFrontend(p, aDefaultFrontend) ((p)->lpVtbl->SetDefaultFrontend(p, aDefaultFrontend))
+#define ISystemProperties_SetDefaultFrontend(p, aDefaultFrontend) ((p)->lpVtbl->SetDefaultFrontend(p, aDefaultFrontend))
+#define ISystemProperties_GetMaxNetworkAdapters(p, aChipset, aMaxNetworkAdapters) ((p)->lpVtbl->GetMaxNetworkAdapters(p, aChipset, aMaxNetworkAdapters))
+#define ISystemProperties_GetMaxNetworkAdaptersOfType(p, aChipset, aType, aMaxNetworkAdapters) ((p)->lpVtbl->GetMaxNetworkAdaptersOfType(p, aChipset, aType, aMaxNetworkAdapters))
+#define ISystemProperties_GetMaxDevicesPerPortForStorageBus(p, aBus, aMaxDevicesPerPort) ((p)->lpVtbl->GetMaxDevicesPerPortForStorageBus(p, aBus, aMaxDevicesPerPort))
+#define ISystemProperties_GetMinPortCountForStorageBus(p, aBus, aMinPortCount) ((p)->lpVtbl->GetMinPortCountForStorageBus(p, aBus, aMinPortCount))
+#define ISystemProperties_GetMaxPortCountForStorageBus(p, aBus, aMaxPortCount) ((p)->lpVtbl->GetMaxPortCountForStorageBus(p, aBus, aMaxPortCount))
+#define ISystemProperties_GetMaxInstancesOfStorageBus(p, aChipset, aBus, aMaxInstances) ((p)->lpVtbl->GetMaxInstancesOfStorageBus(p, aChipset, aBus, aMaxInstances))
+#define ISystemProperties_GetDeviceTypesForStorageBus(p, aBus, aDeviceTypes) ((p)->lpVtbl->GetDeviceTypesForStorageBus(p, aBus, aDeviceTypes))
+#define ISystemProperties_GetDefaultIoCacheSettingForStorageController(p, aControllerType, aEnabled) ((p)->lpVtbl->GetDefaultIoCacheSettingForStorageController(p, aControllerType, aEnabled))
+#define ISystemProperties_GetMaxInstancesOfUSBControllerType(p, aChipset, aType, aMaxInstances) ((p)->lpVtbl->GetMaxInstancesOfUSBControllerType(p, aChipset, aType, aMaxInstances))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISystemProperties
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISystemProperties_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISystemPropertiesVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISystemProperties declaration */
+
+
+/* Start of struct IGuestOSType declaration */
+#define IGUESTOSTYPE_IID_STR "6d968f9a-858b-4c50-bf17-241f069e94c2"
+#define IGUESTOSTYPE_IID { \
+    0x6d968f9a, 0x858b, 0x4c50, \
+    { 0xbf, 0x17, 0x24, 0x1f, 0x06, 0x9e, 0x94, 0xc2 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestOSType);
+#ifndef VBOX_WITH_GLUE
+struct IGuestOSType_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetFamilyId)(IGuestOSType *pThis, PRUnichar * *familyId);
+
+    nsresult (*GetFamilyDescription)(IGuestOSType *pThis, PRUnichar * *familyDescription);
+
+    nsresult (*GetId)(IGuestOSType *pThis, PRUnichar * *id);
+
+    nsresult (*GetDescription)(IGuestOSType *pThis, PRUnichar * *description);
+
+    nsresult (*GetIs64Bit)(IGuestOSType *pThis, PRBool *is64Bit);
+
+    nsresult (*GetRecommendedIOAPIC)(IGuestOSType *pThis, PRBool *recommendedIOAPIC);
+
+    nsresult (*GetRecommendedVirtEx)(IGuestOSType *pThis, PRBool *recommendedVirtEx);
+
+    nsresult (*GetRecommendedRAM)(IGuestOSType *pThis, PRUint32 *recommendedRAM);
+
+    nsresult (*GetRecommendedVRAM)(IGuestOSType *pThis, PRUint32 *recommendedVRAM);
+
+    nsresult (*GetRecommended2DVideoAcceleration)(IGuestOSType *pThis, PRBool *recommended2DVideoAcceleration);
+
+    nsresult (*GetRecommended3DAcceleration)(IGuestOSType *pThis, PRBool *recommended3DAcceleration);
+
+    nsresult (*GetRecommendedHDD)(IGuestOSType *pThis, PRInt64 *recommendedHDD);
+
+    nsresult (*GetAdapterType)(IGuestOSType *pThis, PRUint32 *adapterType);
+
+    nsresult (*GetRecommendedPAE)(IGuestOSType *pThis, PRBool *recommendedPAE);
+
+    nsresult (*GetRecommendedDVDStorageController)(IGuestOSType *pThis, PRUint32 *recommendedDVDStorageController);
+
+    nsresult (*GetRecommendedDVDStorageBus)(IGuestOSType *pThis, PRUint32 *recommendedDVDStorageBus);
+
+    nsresult (*GetRecommendedHDStorageController)(IGuestOSType *pThis, PRUint32 *recommendedHDStorageController);
+
+    nsresult (*GetRecommendedHDStorageBus)(IGuestOSType *pThis, PRUint32 *recommendedHDStorageBus);
+
+    nsresult (*GetRecommendedFirmware)(IGuestOSType *pThis, PRUint32 *recommendedFirmware);
+
+    nsresult (*GetRecommendedUSBHID)(IGuestOSType *pThis, PRBool *recommendedUSBHID);
+
+    nsresult (*GetRecommendedHPET)(IGuestOSType *pThis, PRBool *recommendedHPET);
+
+    nsresult (*GetRecommendedUSBTablet)(IGuestOSType *pThis, PRBool *recommendedUSBTablet);
+
+    nsresult (*GetRecommendedRTCUseUTC)(IGuestOSType *pThis, PRBool *recommendedRTCUseUTC);
+
+    nsresult (*GetRecommendedChipset)(IGuestOSType *pThis, PRUint32 *recommendedChipset);
+
+    nsresult (*GetRecommendedAudioController)(IGuestOSType *pThis, PRUint32 *recommendedAudioController);
+
+    nsresult (*GetRecommendedFloppy)(IGuestOSType *pThis, PRBool *recommendedFloppy);
+
+    nsresult (*GetRecommendedUSB)(IGuestOSType *pThis, PRBool *recommendedUSB);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestOSTypeVtbl
+{
+    nsresult (*QueryInterface)(IGuestOSType *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestOSType *pThis);
+    nsrefcnt (*Release)(IGuestOSType *pThis);
+    nsresult (*GetFamilyId)(IGuestOSType *pThis, PRUnichar * *familyId);
+
+    nsresult (*GetFamilyDescription)(IGuestOSType *pThis, PRUnichar * *familyDescription);
+
+    nsresult (*GetId)(IGuestOSType *pThis, PRUnichar * *id);
+
+    nsresult (*GetDescription)(IGuestOSType *pThis, PRUnichar * *description);
+
+    nsresult (*GetIs64Bit)(IGuestOSType *pThis, PRBool *is64Bit);
+
+    nsresult (*GetRecommendedIOAPIC)(IGuestOSType *pThis, PRBool *recommendedIOAPIC);
+
+    nsresult (*GetRecommendedVirtEx)(IGuestOSType *pThis, PRBool *recommendedVirtEx);
+
+    nsresult (*GetRecommendedRAM)(IGuestOSType *pThis, PRUint32 *recommendedRAM);
+
+    nsresult (*GetRecommendedVRAM)(IGuestOSType *pThis, PRUint32 *recommendedVRAM);
+
+    nsresult (*GetRecommended2DVideoAcceleration)(IGuestOSType *pThis, PRBool *recommended2DVideoAcceleration);
+
+    nsresult (*GetRecommended3DAcceleration)(IGuestOSType *pThis, PRBool *recommended3DAcceleration);
+
+    nsresult (*GetRecommendedHDD)(IGuestOSType *pThis, PRInt64 *recommendedHDD);
+
+    nsresult (*GetAdapterType)(IGuestOSType *pThis, PRUint32 *adapterType);
+
+    nsresult (*GetRecommendedPAE)(IGuestOSType *pThis, PRBool *recommendedPAE);
+
+    nsresult (*GetRecommendedDVDStorageController)(IGuestOSType *pThis, PRUint32 *recommendedDVDStorageController);
+
+    nsresult (*GetRecommendedDVDStorageBus)(IGuestOSType *pThis, PRUint32 *recommendedDVDStorageBus);
+
+    nsresult (*GetRecommendedHDStorageController)(IGuestOSType *pThis, PRUint32 *recommendedHDStorageController);
+
+    nsresult (*GetRecommendedHDStorageBus)(IGuestOSType *pThis, PRUint32 *recommendedHDStorageBus);
+
+    nsresult (*GetRecommendedFirmware)(IGuestOSType *pThis, PRUint32 *recommendedFirmware);
+
+    nsresult (*GetRecommendedUSBHID)(IGuestOSType *pThis, PRBool *recommendedUSBHID);
+
+    nsresult (*GetRecommendedHPET)(IGuestOSType *pThis, PRBool *recommendedHPET);
+
+    nsresult (*GetRecommendedUSBTablet)(IGuestOSType *pThis, PRBool *recommendedUSBTablet);
+
+    nsresult (*GetRecommendedRTCUseUTC)(IGuestOSType *pThis, PRBool *recommendedRTCUseUTC);
+
+    nsresult (*GetRecommendedChipset)(IGuestOSType *pThis, PRUint32 *recommendedChipset);
+
+    nsresult (*GetRecommendedAudioController)(IGuestOSType *pThis, PRUint32 *recommendedAudioController);
+
+    nsresult (*GetRecommendedFloppy)(IGuestOSType *pThis, PRBool *recommendedFloppy);
+
+    nsresult (*GetRecommendedUSB)(IGuestOSType *pThis, PRBool *recommendedUSB);
+
+};
+#define IGuestOSType_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestOSType_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestOSType_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestOSType_get_FamilyId(p, aFamilyId) ((p)->lpVtbl->GetFamilyId(p, aFamilyId))
+#define IGuestOSType_GetFamilyId(p, aFamilyId) ((p)->lpVtbl->GetFamilyId(p, aFamilyId))
+#define IGuestOSType_get_FamilyDescription(p, aFamilyDescription) ((p)->lpVtbl->GetFamilyDescription(p, aFamilyDescription))
+#define IGuestOSType_GetFamilyDescription(p, aFamilyDescription) ((p)->lpVtbl->GetFamilyDescription(p, aFamilyDescription))
+#define IGuestOSType_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IGuestOSType_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IGuestOSType_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IGuestOSType_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IGuestOSType_get_Is64Bit(p, aIs64Bit) ((p)->lpVtbl->GetIs64Bit(p, aIs64Bit))
+#define IGuestOSType_GetIs64Bit(p, aIs64Bit) ((p)->lpVtbl->GetIs64Bit(p, aIs64Bit))
+#define IGuestOSType_get_RecommendedIOAPIC(p, aRecommendedIOAPIC) ((p)->lpVtbl->GetRecommendedIOAPIC(p, aRecommendedIOAPIC))
+#define IGuestOSType_GetRecommendedIOAPIC(p, aRecommendedIOAPIC) ((p)->lpVtbl->GetRecommendedIOAPIC(p, aRecommendedIOAPIC))
+#define IGuestOSType_get_RecommendedVirtEx(p, aRecommendedVirtEx) ((p)->lpVtbl->GetRecommendedVirtEx(p, aRecommendedVirtEx))
+#define IGuestOSType_GetRecommendedVirtEx(p, aRecommendedVirtEx) ((p)->lpVtbl->GetRecommendedVirtEx(p, aRecommendedVirtEx))
+#define IGuestOSType_get_RecommendedRAM(p, aRecommendedRAM) ((p)->lpVtbl->GetRecommendedRAM(p, aRecommendedRAM))
+#define IGuestOSType_GetRecommendedRAM(p, aRecommendedRAM) ((p)->lpVtbl->GetRecommendedRAM(p, aRecommendedRAM))
+#define IGuestOSType_get_RecommendedVRAM(p, aRecommendedVRAM) ((p)->lpVtbl->GetRecommendedVRAM(p, aRecommendedVRAM))
+#define IGuestOSType_GetRecommendedVRAM(p, aRecommendedVRAM) ((p)->lpVtbl->GetRecommendedVRAM(p, aRecommendedVRAM))
+#define IGuestOSType_get_Recommended2DVideoAcceleration(p, aRecommended2DVideoAcceleration) ((p)->lpVtbl->GetRecommended2DVideoAcceleration(p, aRecommended2DVideoAcceleration))
+#define IGuestOSType_GetRecommended2DVideoAcceleration(p, aRecommended2DVideoAcceleration) ((p)->lpVtbl->GetRecommended2DVideoAcceleration(p, aRecommended2DVideoAcceleration))
+#define IGuestOSType_get_Recommended3DAcceleration(p, aRecommended3DAcceleration) ((p)->lpVtbl->GetRecommended3DAcceleration(p, aRecommended3DAcceleration))
+#define IGuestOSType_GetRecommended3DAcceleration(p, aRecommended3DAcceleration) ((p)->lpVtbl->GetRecommended3DAcceleration(p, aRecommended3DAcceleration))
+#define IGuestOSType_get_RecommendedHDD(p, aRecommendedHDD) ((p)->lpVtbl->GetRecommendedHDD(p, aRecommendedHDD))
+#define IGuestOSType_GetRecommendedHDD(p, aRecommendedHDD) ((p)->lpVtbl->GetRecommendedHDD(p, aRecommendedHDD))
+#define IGuestOSType_get_AdapterType(p, aAdapterType) ((p)->lpVtbl->GetAdapterType(p, aAdapterType))
+#define IGuestOSType_GetAdapterType(p, aAdapterType) ((p)->lpVtbl->GetAdapterType(p, aAdapterType))
+#define IGuestOSType_get_RecommendedPAE(p, aRecommendedPAE) ((p)->lpVtbl->GetRecommendedPAE(p, aRecommendedPAE))
+#define IGuestOSType_GetRecommendedPAE(p, aRecommendedPAE) ((p)->lpVtbl->GetRecommendedPAE(p, aRecommendedPAE))
+#define IGuestOSType_get_RecommendedDVDStorageController(p, aRecommendedDVDStorageController) ((p)->lpVtbl->GetRecommendedDVDStorageController(p, aRecommendedDVDStorageController))
+#define IGuestOSType_GetRecommendedDVDStorageController(p, aRecommendedDVDStorageController) ((p)->lpVtbl->GetRecommendedDVDStorageController(p, aRecommendedDVDStorageController))
+#define IGuestOSType_get_RecommendedDVDStorageBus(p, aRecommendedDVDStorageBus) ((p)->lpVtbl->GetRecommendedDVDStorageBus(p, aRecommendedDVDStorageBus))
+#define IGuestOSType_GetRecommendedDVDStorageBus(p, aRecommendedDVDStorageBus) ((p)->lpVtbl->GetRecommendedDVDStorageBus(p, aRecommendedDVDStorageBus))
+#define IGuestOSType_get_RecommendedHDStorageController(p, aRecommendedHDStorageController) ((p)->lpVtbl->GetRecommendedHDStorageController(p, aRecommendedHDStorageController))
+#define IGuestOSType_GetRecommendedHDStorageController(p, aRecommendedHDStorageController) ((p)->lpVtbl->GetRecommendedHDStorageController(p, aRecommendedHDStorageController))
+#define IGuestOSType_get_RecommendedHDStorageBus(p, aRecommendedHDStorageBus) ((p)->lpVtbl->GetRecommendedHDStorageBus(p, aRecommendedHDStorageBus))
+#define IGuestOSType_GetRecommendedHDStorageBus(p, aRecommendedHDStorageBus) ((p)->lpVtbl->GetRecommendedHDStorageBus(p, aRecommendedHDStorageBus))
+#define IGuestOSType_get_RecommendedFirmware(p, aRecommendedFirmware) ((p)->lpVtbl->GetRecommendedFirmware(p, aRecommendedFirmware))
+#define IGuestOSType_GetRecommendedFirmware(p, aRecommendedFirmware) ((p)->lpVtbl->GetRecommendedFirmware(p, aRecommendedFirmware))
+#define IGuestOSType_get_RecommendedUSBHID(p, aRecommendedUSBHID) ((p)->lpVtbl->GetRecommendedUSBHID(p, aRecommendedUSBHID))
+#define IGuestOSType_GetRecommendedUSBHID(p, aRecommendedUSBHID) ((p)->lpVtbl->GetRecommendedUSBHID(p, aRecommendedUSBHID))
+#define IGuestOSType_get_RecommendedHPET(p, aRecommendedHPET) ((p)->lpVtbl->GetRecommendedHPET(p, aRecommendedHPET))
+#define IGuestOSType_GetRecommendedHPET(p, aRecommendedHPET) ((p)->lpVtbl->GetRecommendedHPET(p, aRecommendedHPET))
+#define IGuestOSType_get_RecommendedUSBTablet(p, aRecommendedUSBTablet) ((p)->lpVtbl->GetRecommendedUSBTablet(p, aRecommendedUSBTablet))
+#define IGuestOSType_GetRecommendedUSBTablet(p, aRecommendedUSBTablet) ((p)->lpVtbl->GetRecommendedUSBTablet(p, aRecommendedUSBTablet))
+#define IGuestOSType_get_RecommendedRTCUseUTC(p, aRecommendedRTCUseUTC) ((p)->lpVtbl->GetRecommendedRTCUseUTC(p, aRecommendedRTCUseUTC))
+#define IGuestOSType_GetRecommendedRTCUseUTC(p, aRecommendedRTCUseUTC) ((p)->lpVtbl->GetRecommendedRTCUseUTC(p, aRecommendedRTCUseUTC))
+#define IGuestOSType_get_RecommendedChipset(p, aRecommendedChipset) ((p)->lpVtbl->GetRecommendedChipset(p, aRecommendedChipset))
+#define IGuestOSType_GetRecommendedChipset(p, aRecommendedChipset) ((p)->lpVtbl->GetRecommendedChipset(p, aRecommendedChipset))
+#define IGuestOSType_get_RecommendedAudioController(p, aRecommendedAudioController) ((p)->lpVtbl->GetRecommendedAudioController(p, aRecommendedAudioController))
+#define IGuestOSType_GetRecommendedAudioController(p, aRecommendedAudioController) ((p)->lpVtbl->GetRecommendedAudioController(p, aRecommendedAudioController))
+#define IGuestOSType_get_RecommendedFloppy(p, aRecommendedFloppy) ((p)->lpVtbl->GetRecommendedFloppy(p, aRecommendedFloppy))
+#define IGuestOSType_GetRecommendedFloppy(p, aRecommendedFloppy) ((p)->lpVtbl->GetRecommendedFloppy(p, aRecommendedFloppy))
+#define IGuestOSType_get_RecommendedUSB(p, aRecommendedUSB) ((p)->lpVtbl->GetRecommendedUSB(p, aRecommendedUSB))
+#define IGuestOSType_GetRecommendedUSB(p, aRecommendedUSB) ((p)->lpVtbl->GetRecommendedUSB(p, aRecommendedUSB))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestOSType
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestOSType_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestOSTypeVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestOSType declaration */
+
+
+/* Start of struct IAdditionsFacility declaration */
+#define IADDITIONSFACILITY_IID_STR "54992946-6af1-4e49-98ec-58b558b7291e"
+#define IADDITIONSFACILITY_IID { \
+    0x54992946, 0x6af1, 0x4e49, \
+    { 0x98, 0xec, 0x58, 0xb5, 0x58, 0xb7, 0x29, 0x1e } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IAdditionsFacility);
+#ifndef VBOX_WITH_GLUE
+struct IAdditionsFacility_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetClassType)(IAdditionsFacility *pThis, PRUint32 *classType);
+
+    nsresult (*GetLastUpdated)(IAdditionsFacility *pThis, PRInt64 *lastUpdated);
+
+    nsresult (*GetName)(IAdditionsFacility *pThis, PRUnichar * *name);
+
+    nsresult (*GetStatus)(IAdditionsFacility *pThis, PRUint32 *status);
+
+    nsresult (*GetType)(IAdditionsFacility *pThis, PRUint32 *type);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IAdditionsFacilityVtbl
+{
+    nsresult (*QueryInterface)(IAdditionsFacility *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IAdditionsFacility *pThis);
+    nsrefcnt (*Release)(IAdditionsFacility *pThis);
+    nsresult (*GetClassType)(IAdditionsFacility *pThis, PRUint32 *classType);
+
+    nsresult (*GetLastUpdated)(IAdditionsFacility *pThis, PRInt64 *lastUpdated);
+
+    nsresult (*GetName)(IAdditionsFacility *pThis, PRUnichar * *name);
+
+    nsresult (*GetStatus)(IAdditionsFacility *pThis, PRUint32 *status);
+
+    nsresult (*GetType)(IAdditionsFacility *pThis, PRUint32 *type);
+
+};
+#define IAdditionsFacility_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IAdditionsFacility_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IAdditionsFacility_Release(p) ((p)->lpVtbl->Release(p))
+#define IAdditionsFacility_get_ClassType(p, aClassType) ((p)->lpVtbl->GetClassType(p, aClassType))
+#define IAdditionsFacility_GetClassType(p, aClassType) ((p)->lpVtbl->GetClassType(p, aClassType))
+#define IAdditionsFacility_get_LastUpdated(p, aLastUpdated) ((p)->lpVtbl->GetLastUpdated(p, aLastUpdated))
+#define IAdditionsFacility_GetLastUpdated(p, aLastUpdated) ((p)->lpVtbl->GetLastUpdated(p, aLastUpdated))
+#define IAdditionsFacility_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IAdditionsFacility_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IAdditionsFacility_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IAdditionsFacility_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IAdditionsFacility_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IAdditionsFacility_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#endif /* VBOX_WITH_GLUE */
+
+interface IAdditionsFacility
+{
+#ifndef VBOX_WITH_GLUE
+    struct IAdditionsFacility_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IAdditionsFacilityVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IAdditionsFacility declaration */
+
+
+/* Start of struct IGuestSession declaration */
+#define IGUESTSESSION_IID_STR "5b28703c-07b6-4fcb-afba-ac199b309752"
+#define IGUESTSESSION_IID { \
+    0x5b28703c, 0x07b6, 0x4fcb, \
+    { 0xaf, 0xba, 0xac, 0x19, 0x9b, 0x30, 0x97, 0x52 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestSession);
+#ifndef VBOX_WITH_GLUE
+struct IGuestSession_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetUser)(IGuestSession *pThis, PRUnichar * *user);
+
+    nsresult (*GetDomain)(IGuestSession *pThis, PRUnichar * *domain);
+
+    nsresult (*GetName)(IGuestSession *pThis, PRUnichar * *name);
+
+    nsresult (*GetId)(IGuestSession *pThis, PRUint32 *id);
+
+    nsresult (*GetTimeout)(IGuestSession *pThis, PRUint32 *timeout);
+    nsresult (*SetTimeout)(IGuestSession *pThis, PRUint32 timeout);
+
+    nsresult (*GetProtocolVersion)(IGuestSession *pThis, PRUint32 *protocolVersion);
+
+    nsresult (*GetStatus)(IGuestSession *pThis, PRUint32 *status);
+
+    nsresult (*GetEnvironment)(IGuestSession *pThis, PRUint32 *environmentSize, PRUnichar * **environment);
+    nsresult (*SetEnvironment)(IGuestSession *pThis, PRUint32 environmentSize, PRUnichar * *environment);
+
+    nsresult (*GetProcesses)(IGuestSession *pThis, PRUint32 *processesSize, IGuestProcess * **processes);
+
+    nsresult (*GetDirectories)(IGuestSession *pThis, PRUint32 *directoriesSize, IGuestDirectory * **directories);
+
+    nsresult (*GetFiles)(IGuestSession *pThis, PRUint32 *filesSize, IGuestFile * **files);
+
+    nsresult (*GetEventSource)(IGuestSession *pThis, IEventSource * *eventSource);
+
+    nsresult (*Close)(IGuestSession *pThis );
+
+    nsresult (*CopyFrom)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * dest,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IProgress * * progress
+    );
+
+    nsresult (*CopyTo)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * dest,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IProgress * * progress
+    );
+
+    nsresult (*DirectoryCreate)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUint32 mode,
+        PRUint32 flagsSize,
+        PRUint32* flags
+    );
+
+    nsresult (*DirectoryCreateTemp)(
+        IGuestSession *pThis,
+        PRUnichar * templateName,
+        PRUint32 mode,
+        PRUnichar * path,
+        PRBool secure,
+        PRUnichar * * directory
+    );
+
+    nsresult (*DirectoryExists)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRBool * exists
+    );
+
+    nsresult (*DirectoryOpen)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUnichar * filter,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IGuestDirectory * * directory
+    );
+
+    nsresult (*DirectoryQueryInfo)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        IGuestFsObjInfo * * info
+    );
+
+    nsresult (*DirectoryRemove)(
+        IGuestSession *pThis,
+        PRUnichar * path
+    );
+
+    nsresult (*DirectoryRemoveRecursive)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IProgress * * progress
+    );
+
+    nsresult (*DirectoryRename)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * dest,
+        PRUint32 flagsSize,
+        PRUint32* flags
+    );
+
+    nsresult (*DirectorySetACL)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUnichar * acl
+    );
+
+    nsresult (*EnvironmentClear)(IGuestSession *pThis );
+
+    nsresult (*EnvironmentGet)(
+        IGuestSession *pThis,
+        PRUnichar * name,
+        PRUnichar * * value
+    );
+
+    nsresult (*EnvironmentSet)(
+        IGuestSession *pThis,
+        PRUnichar * name,
+        PRUnichar * value
+    );
+
+    nsresult (*EnvironmentUnset)(
+        IGuestSession *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*FileCreateTemp)(
+        IGuestSession *pThis,
+        PRUnichar * templateName,
+        PRUint32 mode,
+        PRUnichar * path,
+        PRBool secure,
+        IGuestFile * * file
+    );
+
+    nsresult (*FileExists)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRBool * exists
+    );
+
+    nsresult (*FileRemove)(
+        IGuestSession *pThis,
+        PRUnichar * path
+    );
+
+    nsresult (*FileOpen)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUnichar * openMode,
+        PRUnichar * disposition,
+        PRUint32 creationMode,
+        IGuestFile * * file
+    );
+
+    nsresult (*FileOpenEx)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUnichar * openMode,
+        PRUnichar * disposition,
+        PRUnichar * sharingMode,
+        PRUint32 creationMode,
+        PRInt64 offset,
+        IGuestFile * * file
+    );
+
+    nsresult (*FileQueryInfo)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        IGuestFsObjInfo * * info
+    );
+
+    nsresult (*FileQuerySize)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRInt64 * size
+    );
+
+    nsresult (*FileRename)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * dest,
+        PRUint32 flagsSize,
+        PRUint32* flags
+    );
+
+    nsresult (*FileSetACL)(
+        IGuestSession *pThis,
+        PRUnichar * file,
+        PRUnichar * acl
+    );
+
+    nsresult (*ProcessCreate)(
+        IGuestSession *pThis,
+        PRUnichar * command,
+        PRUint32 argumentsSize,
+        PRUnichar ** arguments,
+        PRUint32 environmentSize,
+        PRUnichar ** environment,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUint32 timeoutMS,
+        IGuestProcess * * guestProcess
+    );
+
+    nsresult (*ProcessCreateEx)(
+        IGuestSession *pThis,
+        PRUnichar * command,
+        PRUint32 argumentsSize,
+        PRUnichar ** arguments,
+        PRUint32 environmentSize,
+        PRUnichar ** environment,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUint32 timeoutMS,
+        PRUint32 priority,
+        PRUint32 affinitySize,
+        PRInt32* affinity,
+        IGuestProcess * * guestProcess
+    );
+
+    nsresult (*ProcessGet)(
+        IGuestSession *pThis,
+        PRUint32 pid,
+        IGuestProcess * * guestProcess
+    );
+
+    nsresult (*SymlinkCreate)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * target,
+        PRUint32 type
+    );
+
+    nsresult (*SymlinkExists)(
+        IGuestSession *pThis,
+        PRUnichar * symlink,
+        PRBool * exists
+    );
+
+    nsresult (*SymlinkRead)(
+        IGuestSession *pThis,
+        PRUnichar * symlink,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUnichar * * target
+    );
+
+    nsresult (*SymlinkRemoveDirectory)(
+        IGuestSession *pThis,
+        PRUnichar * path
+    );
+
+    nsresult (*SymlinkRemoveFile)(
+        IGuestSession *pThis,
+        PRUnichar * file
+    );
+
+    nsresult (*WaitFor)(
+        IGuestSession *pThis,
+        PRUint32 waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+    nsresult (*WaitForArray)(
+        IGuestSession *pThis,
+        PRUint32 waitForSize,
+        PRUint32* waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestSessionVtbl
+{
+    nsresult (*QueryInterface)(IGuestSession *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestSession *pThis);
+    nsrefcnt (*Release)(IGuestSession *pThis);
+    nsresult (*GetUser)(IGuestSession *pThis, PRUnichar * *user);
+
+    nsresult (*GetDomain)(IGuestSession *pThis, PRUnichar * *domain);
+
+    nsresult (*GetName)(IGuestSession *pThis, PRUnichar * *name);
+
+    nsresult (*GetId)(IGuestSession *pThis, PRUint32 *id);
+
+    nsresult (*GetTimeout)(IGuestSession *pThis, PRUint32 *timeout);
+    nsresult (*SetTimeout)(IGuestSession *pThis, PRUint32 timeout);
+
+    nsresult (*GetProtocolVersion)(IGuestSession *pThis, PRUint32 *protocolVersion);
+
+    nsresult (*GetStatus)(IGuestSession *pThis, PRUint32 *status);
+
+    nsresult (*GetEnvironment)(IGuestSession *pThis, PRUint32 *environmentSize, PRUnichar * **environment);
+    nsresult (*SetEnvironment)(IGuestSession *pThis, PRUint32 environmentSize, PRUnichar * *environment);
+
+    nsresult (*GetProcesses)(IGuestSession *pThis, PRUint32 *processesSize, IGuestProcess * **processes);
+
+    nsresult (*GetDirectories)(IGuestSession *pThis, PRUint32 *directoriesSize, IGuestDirectory * **directories);
+
+    nsresult (*GetFiles)(IGuestSession *pThis, PRUint32 *filesSize, IGuestFile * **files);
+
+    nsresult (*GetEventSource)(IGuestSession *pThis, IEventSource * *eventSource);
+
+    nsresult (*Close)(IGuestSession *pThis );
+
+    nsresult (*CopyFrom)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * dest,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IProgress * * progress
+    );
+
+    nsresult (*CopyTo)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * dest,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IProgress * * progress
+    );
+
+    nsresult (*DirectoryCreate)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUint32 mode,
+        PRUint32 flagsSize,
+        PRUint32* flags
+    );
+
+    nsresult (*DirectoryCreateTemp)(
+        IGuestSession *pThis,
+        PRUnichar * templateName,
+        PRUint32 mode,
+        PRUnichar * path,
+        PRBool secure,
+        PRUnichar * * directory
+    );
+
+    nsresult (*DirectoryExists)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRBool * exists
+    );
+
+    nsresult (*DirectoryOpen)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUnichar * filter,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IGuestDirectory * * directory
+    );
+
+    nsresult (*DirectoryQueryInfo)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        IGuestFsObjInfo * * info
+    );
+
+    nsresult (*DirectoryRemove)(
+        IGuestSession *pThis,
+        PRUnichar * path
+    );
+
+    nsresult (*DirectoryRemoveRecursive)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IProgress * * progress
+    );
+
+    nsresult (*DirectoryRename)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * dest,
+        PRUint32 flagsSize,
+        PRUint32* flags
+    );
+
+    nsresult (*DirectorySetACL)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUnichar * acl
+    );
+
+    nsresult (*EnvironmentClear)(IGuestSession *pThis );
+
+    nsresult (*EnvironmentGet)(
+        IGuestSession *pThis,
+        PRUnichar * name,
+        PRUnichar * * value
+    );
+
+    nsresult (*EnvironmentSet)(
+        IGuestSession *pThis,
+        PRUnichar * name,
+        PRUnichar * value
+    );
+
+    nsresult (*EnvironmentUnset)(
+        IGuestSession *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*FileCreateTemp)(
+        IGuestSession *pThis,
+        PRUnichar * templateName,
+        PRUint32 mode,
+        PRUnichar * path,
+        PRBool secure,
+        IGuestFile * * file
+    );
+
+    nsresult (*FileExists)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRBool * exists
+    );
+
+    nsresult (*FileRemove)(
+        IGuestSession *pThis,
+        PRUnichar * path
+    );
+
+    nsresult (*FileOpen)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUnichar * openMode,
+        PRUnichar * disposition,
+        PRUint32 creationMode,
+        IGuestFile * * file
+    );
+
+    nsresult (*FileOpenEx)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRUnichar * openMode,
+        PRUnichar * disposition,
+        PRUnichar * sharingMode,
+        PRUint32 creationMode,
+        PRInt64 offset,
+        IGuestFile * * file
+    );
+
+    nsresult (*FileQueryInfo)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        IGuestFsObjInfo * * info
+    );
+
+    nsresult (*FileQuerySize)(
+        IGuestSession *pThis,
+        PRUnichar * path,
+        PRInt64 * size
+    );
+
+    nsresult (*FileRename)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * dest,
+        PRUint32 flagsSize,
+        PRUint32* flags
+    );
+
+    nsresult (*FileSetACL)(
+        IGuestSession *pThis,
+        PRUnichar * file,
+        PRUnichar * acl
+    );
+
+    nsresult (*ProcessCreate)(
+        IGuestSession *pThis,
+        PRUnichar * command,
+        PRUint32 argumentsSize,
+        PRUnichar ** arguments,
+        PRUint32 environmentSize,
+        PRUnichar ** environment,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUint32 timeoutMS,
+        IGuestProcess * * guestProcess
+    );
+
+    nsresult (*ProcessCreateEx)(
+        IGuestSession *pThis,
+        PRUnichar * command,
+        PRUint32 argumentsSize,
+        PRUnichar ** arguments,
+        PRUint32 environmentSize,
+        PRUnichar ** environment,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUint32 timeoutMS,
+        PRUint32 priority,
+        PRUint32 affinitySize,
+        PRInt32* affinity,
+        IGuestProcess * * guestProcess
+    );
+
+    nsresult (*ProcessGet)(
+        IGuestSession *pThis,
+        PRUint32 pid,
+        IGuestProcess * * guestProcess
+    );
+
+    nsresult (*SymlinkCreate)(
+        IGuestSession *pThis,
+        PRUnichar * source,
+        PRUnichar * target,
+        PRUint32 type
+    );
+
+    nsresult (*SymlinkExists)(
+        IGuestSession *pThis,
+        PRUnichar * symlink,
+        PRBool * exists
+    );
+
+    nsresult (*SymlinkRead)(
+        IGuestSession *pThis,
+        PRUnichar * symlink,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUnichar * * target
+    );
+
+    nsresult (*SymlinkRemoveDirectory)(
+        IGuestSession *pThis,
+        PRUnichar * path
+    );
+
+    nsresult (*SymlinkRemoveFile)(
+        IGuestSession *pThis,
+        PRUnichar * file
+    );
+
+    nsresult (*WaitFor)(
+        IGuestSession *pThis,
+        PRUint32 waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+    nsresult (*WaitForArray)(
+        IGuestSession *pThis,
+        PRUint32 waitForSize,
+        PRUint32* waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+};
+#define IGuestSession_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestSession_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestSession_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestSession_get_User(p, aUser) ((p)->lpVtbl->GetUser(p, aUser))
+#define IGuestSession_GetUser(p, aUser) ((p)->lpVtbl->GetUser(p, aUser))
+#define IGuestSession_get_Domain(p, aDomain) ((p)->lpVtbl->GetDomain(p, aDomain))
+#define IGuestSession_GetDomain(p, aDomain) ((p)->lpVtbl->GetDomain(p, aDomain))
+#define IGuestSession_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestSession_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestSession_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IGuestSession_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IGuestSession_get_Timeout(p, aTimeout) ((p)->lpVtbl->GetTimeout(p, aTimeout))
+#define IGuestSession_GetTimeout(p, aTimeout) ((p)->lpVtbl->GetTimeout(p, aTimeout))
+#define IGuestSession_put_Timeout(p, aTimeout) ((p)->lpVtbl->SetTimeout(p, aTimeout))
+#define IGuestSession_SetTimeout(p, aTimeout) ((p)->lpVtbl->SetTimeout(p, aTimeout))
+#define IGuestSession_get_ProtocolVersion(p, aProtocolVersion) ((p)->lpVtbl->GetProtocolVersion(p, aProtocolVersion))
+#define IGuestSession_GetProtocolVersion(p, aProtocolVersion) ((p)->lpVtbl->GetProtocolVersion(p, aProtocolVersion))
+#define IGuestSession_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestSession_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestSession_get_Environment(p, aEnvironment) ((p)->lpVtbl->GetEnvironment(p, aEnvironment))
+#define IGuestSession_GetEnvironment(p, aEnvironment) ((p)->lpVtbl->GetEnvironment(p, aEnvironment))
+#define IGuestSession_put_Environment(p, aEnvironment) ((p)->lpVtbl->SetEnvironment(p, aEnvironment))
+#define IGuestSession_SetEnvironment(p, aEnvironment) ((p)->lpVtbl->SetEnvironment(p, aEnvironment))
+#define IGuestSession_get_Processes(p, aProcesses) ((p)->lpVtbl->GetProcesses(p, aProcesses))
+#define IGuestSession_GetProcesses(p, aProcesses) ((p)->lpVtbl->GetProcesses(p, aProcesses))
+#define IGuestSession_get_Directories(p, aDirectories) ((p)->lpVtbl->GetDirectories(p, aDirectories))
+#define IGuestSession_GetDirectories(p, aDirectories) ((p)->lpVtbl->GetDirectories(p, aDirectories))
+#define IGuestSession_get_Files(p, aFiles) ((p)->lpVtbl->GetFiles(p, aFiles))
+#define IGuestSession_GetFiles(p, aFiles) ((p)->lpVtbl->GetFiles(p, aFiles))
+#define IGuestSession_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IGuestSession_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IGuestSession_Close(p) ((p)->lpVtbl->Close(p))
+#define IGuestSession_CopyFrom(p, aSource, aDest, aFlags, aProgress) ((p)->lpVtbl->CopyFrom(p, aSource, aDest, aFlags, aProgress))
+#define IGuestSession_CopyTo(p, aSource, aDest, aFlags, aProgress) ((p)->lpVtbl->CopyTo(p, aSource, aDest, aFlags, aProgress))
+#define IGuestSession_DirectoryCreate(p, aPath, aMode, aFlags) ((p)->lpVtbl->DirectoryCreate(p, aPath, aMode, aFlags))
+#define IGuestSession_DirectoryCreateTemp(p, aTemplateName, aMode, aPath, aSecure, aDirectory) ((p)->lpVtbl->DirectoryCreateTemp(p, aTemplateName, aMode, aPath, aSecure, aDirectory))
+#define IGuestSession_DirectoryExists(p, aPath, aExists) ((p)->lpVtbl->DirectoryExists(p, aPath, aExists))
+#define IGuestSession_DirectoryOpen(p, aPath, aFilter, aFlags, aDirectory) ((p)->lpVtbl->DirectoryOpen(p, aPath, aFilter, aFlags, aDirectory))
+#define IGuestSession_DirectoryQueryInfo(p, aPath, aInfo) ((p)->lpVtbl->DirectoryQueryInfo(p, aPath, aInfo))
+#define IGuestSession_DirectoryRemove(p, aPath) ((p)->lpVtbl->DirectoryRemove(p, aPath))
+#define IGuestSession_DirectoryRemoveRecursive(p, aPath, aFlags, aProgress) ((p)->lpVtbl->DirectoryRemoveRecursive(p, aPath, aFlags, aProgress))
+#define IGuestSession_DirectoryRename(p, aSource, aDest, aFlags) ((p)->lpVtbl->DirectoryRename(p, aSource, aDest, aFlags))
+#define IGuestSession_DirectorySetACL(p, aPath, aAcl) ((p)->lpVtbl->DirectorySetACL(p, aPath, aAcl))
+#define IGuestSession_EnvironmentClear(p) ((p)->lpVtbl->EnvironmentClear(p))
+#define IGuestSession_EnvironmentGet(p, aName, aValue) ((p)->lpVtbl->EnvironmentGet(p, aName, aValue))
+#define IGuestSession_EnvironmentSet(p, aName, aValue) ((p)->lpVtbl->EnvironmentSet(p, aName, aValue))
+#define IGuestSession_EnvironmentUnset(p, aName) ((p)->lpVtbl->EnvironmentUnset(p, aName))
+#define IGuestSession_FileCreateTemp(p, aTemplateName, aMode, aPath, aSecure, aFile) ((p)->lpVtbl->FileCreateTemp(p, aTemplateName, aMode, aPath, aSecure, aFile))
+#define IGuestSession_FileExists(p, aPath, aExists) ((p)->lpVtbl->FileExists(p, aPath, aExists))
+#define IGuestSession_FileRemove(p, aPath) ((p)->lpVtbl->FileRemove(p, aPath))
+#define IGuestSession_FileOpen(p, aPath, aOpenMode, aDisposition, aCreationMode, aFile) ((p)->lpVtbl->FileOpen(p, aPath, aOpenMode, aDisposition, aCreationMode, aFile))
+#define IGuestSession_FileOpenEx(p, aPath, aOpenMode, aDisposition, aSharingMode, aCreationMode, aOffset, aFile) ((p)->lpVtbl->FileOpenEx(p, aPath, aOpenMode, aDisposition, aSharingMode, aCreationMode, aOffset, aFile))
+#define IGuestSession_FileQueryInfo(p, aPath, aInfo) ((p)->lpVtbl->FileQueryInfo(p, aPath, aInfo))
+#define IGuestSession_FileQuerySize(p, aPath, aSize) ((p)->lpVtbl->FileQuerySize(p, aPath, aSize))
+#define IGuestSession_FileRename(p, aSource, aDest, aFlags) ((p)->lpVtbl->FileRename(p, aSource, aDest, aFlags))
+#define IGuestSession_FileSetACL(p, aFile, aAcl) ((p)->lpVtbl->FileSetACL(p, aFile, aAcl))
+#define IGuestSession_ProcessCreate(p, aCommand, aArguments, aEnvironment, aFlags, aTimeoutMS, aGuestProcess) ((p)->lpVtbl->ProcessCreate(p, aCommand, aArguments, aEnvironment, aFlags, aTimeoutMS, aGuestProcess))
+#define IGuestSession_ProcessCreateEx(p, aCommand, aArguments, aEnvironment, aFlags, aTimeoutMS, aPriority, aAffinity, aGuestProcess) ((p)->lpVtbl->ProcessCreateEx(p, aCommand, aArguments, aEnvironment, aFlags, aTimeoutMS, aPriority, aAffinity, aGuestProcess))
+#define IGuestSession_ProcessGet(p, aPid, aGuestProcess) ((p)->lpVtbl->ProcessGet(p, aPid, aGuestProcess))
+#define IGuestSession_SymlinkCreate(p, aSource, aTarget, aType) ((p)->lpVtbl->SymlinkCreate(p, aSource, aTarget, aType))
+#define IGuestSession_SymlinkExists(p, aSymlink, aExists) ((p)->lpVtbl->SymlinkExists(p, aSymlink, aExists))
+#define IGuestSession_SymlinkRead(p, aSymlink, aFlags, aTarget) ((p)->lpVtbl->SymlinkRead(p, aSymlink, aFlags, aTarget))
+#define IGuestSession_SymlinkRemoveDirectory(p, aPath) ((p)->lpVtbl->SymlinkRemoveDirectory(p, aPath))
+#define IGuestSession_SymlinkRemoveFile(p, aFile) ((p)->lpVtbl->SymlinkRemoveFile(p, aFile))
+#define IGuestSession_WaitFor(p, aWaitFor, aTimeoutMS, aReason) ((p)->lpVtbl->WaitFor(p, aWaitFor, aTimeoutMS, aReason))
+#define IGuestSession_WaitForArray(p, aWaitFor, aTimeoutMS, aReason) ((p)->lpVtbl->WaitForArray(p, aWaitFor, aTimeoutMS, aReason))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestSession
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestSession_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestSessionVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestSession declaration */
+
+
+/* Start of struct IProcess declaration */
+#define IPROCESS_IID_STR "5a4fe06d-8cb1-40ff-ac9e-9676e32f706e"
+#define IPROCESS_IID { \
+    0x5a4fe06d, 0x8cb1, 0x40ff, \
+    { 0xac, 0x9e, 0x96, 0x76, 0xe3, 0x2f, 0x70, 0x6e } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IProcess);
+#ifndef VBOX_WITH_GLUE
+struct IProcess_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetArguments)(IProcess *pThis, PRUint32 *argumentsSize, PRUnichar * **arguments);
+
+    nsresult (*GetEnvironment)(IProcess *pThis, PRUint32 *environmentSize, PRUnichar * **environment);
+
+    nsresult (*GetEventSource)(IProcess *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetExecutablePath)(IProcess *pThis, PRUnichar * *executablePath);
+
+    nsresult (*GetExitCode)(IProcess *pThis, PRInt32 *exitCode);
+
+    nsresult (*GetName)(IProcess *pThis, PRUnichar * *name);
+
+    nsresult (*GetPID)(IProcess *pThis, PRUint32 *PID);
+
+    nsresult (*GetStatus)(IProcess *pThis, PRUint32 *status);
+
+    nsresult (*WaitFor)(
+        IProcess *pThis,
+        PRUint32 waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+    nsresult (*WaitForArray)(
+        IProcess *pThis,
+        PRUint32 waitForSize,
+        PRUint32* waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+    nsresult (*Read)(
+        IProcess *pThis,
+        PRUint32 handle,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*Write)(
+        IProcess *pThis,
+        PRUint32 handle,
+        PRUint32 flags,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*WriteArray)(
+        IProcess *pThis,
+        PRUint32 handle,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*Terminate)(IProcess *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IProcessVtbl
+{
+    nsresult (*QueryInterface)(IProcess *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IProcess *pThis);
+    nsrefcnt (*Release)(IProcess *pThis);
+    nsresult (*GetArguments)(IProcess *pThis, PRUint32 *argumentsSize, PRUnichar * **arguments);
+
+    nsresult (*GetEnvironment)(IProcess *pThis, PRUint32 *environmentSize, PRUnichar * **environment);
+
+    nsresult (*GetEventSource)(IProcess *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetExecutablePath)(IProcess *pThis, PRUnichar * *executablePath);
+
+    nsresult (*GetExitCode)(IProcess *pThis, PRInt32 *exitCode);
+
+    nsresult (*GetName)(IProcess *pThis, PRUnichar * *name);
+
+    nsresult (*GetPID)(IProcess *pThis, PRUint32 *PID);
+
+    nsresult (*GetStatus)(IProcess *pThis, PRUint32 *status);
+
+    nsresult (*WaitFor)(
+        IProcess *pThis,
+        PRUint32 waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+    nsresult (*WaitForArray)(
+        IProcess *pThis,
+        PRUint32 waitForSize,
+        PRUint32* waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+    nsresult (*Read)(
+        IProcess *pThis,
+        PRUint32 handle,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*Write)(
+        IProcess *pThis,
+        PRUint32 handle,
+        PRUint32 flags,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*WriteArray)(
+        IProcess *pThis,
+        PRUint32 handle,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*Terminate)(IProcess *pThis );
+
+};
+#define IProcess_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IProcess_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IProcess_Release(p) ((p)->lpVtbl->Release(p))
+#define IProcess_get_Arguments(p, aArguments) ((p)->lpVtbl->GetArguments(p, aArguments))
+#define IProcess_GetArguments(p, aArguments) ((p)->lpVtbl->GetArguments(p, aArguments))
+#define IProcess_get_Environment(p, aEnvironment) ((p)->lpVtbl->GetEnvironment(p, aEnvironment))
+#define IProcess_GetEnvironment(p, aEnvironment) ((p)->lpVtbl->GetEnvironment(p, aEnvironment))
+#define IProcess_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IProcess_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IProcess_get_ExecutablePath(p, aExecutablePath) ((p)->lpVtbl->GetExecutablePath(p, aExecutablePath))
+#define IProcess_GetExecutablePath(p, aExecutablePath) ((p)->lpVtbl->GetExecutablePath(p, aExecutablePath))
+#define IProcess_get_ExitCode(p, aExitCode) ((p)->lpVtbl->GetExitCode(p, aExitCode))
+#define IProcess_GetExitCode(p, aExitCode) ((p)->lpVtbl->GetExitCode(p, aExitCode))
+#define IProcess_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IProcess_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IProcess_get_PID(p, aPID) ((p)->lpVtbl->GetPID(p, aPID))
+#define IProcess_GetPID(p, aPID) ((p)->lpVtbl->GetPID(p, aPID))
+#define IProcess_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IProcess_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IProcess_WaitFor(p, aWaitFor, aTimeoutMS, aReason) ((p)->lpVtbl->WaitFor(p, aWaitFor, aTimeoutMS, aReason))
+#define IProcess_WaitForArray(p, aWaitFor, aTimeoutMS, aReason) ((p)->lpVtbl->WaitForArray(p, aWaitFor, aTimeoutMS, aReason))
+#define IProcess_Read(p, aHandle, aToRead, aTimeoutMS, aData) ((p)->lpVtbl->Read(p, aHandle, aToRead, aTimeoutMS, aData))
+#define IProcess_Write(p, aHandle, aFlags, aData, aTimeoutMS, aWritten) ((p)->lpVtbl->Write(p, aHandle, aFlags, aData, aTimeoutMS, aWritten))
+#define IProcess_WriteArray(p, aHandle, aFlags, aData, aTimeoutMS, aWritten) ((p)->lpVtbl->WriteArray(p, aHandle, aFlags, aData, aTimeoutMS, aWritten))
+#define IProcess_Terminate(p) ((p)->lpVtbl->Terminate(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface IProcess
+{
+#ifndef VBOX_WITH_GLUE
+    struct IProcess_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IProcessVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IProcess declaration */
+
+
+/* Start of struct IGuestProcess declaration */
+#define IGUESTPROCESS_IID_STR "dfa39a36-5d43-4840-a025-67ea956b3111"
+#define IGUESTPROCESS_IID { \
+    0xdfa39a36, 0x5d43, 0x4840, \
+    { 0xa0, 0x25, 0x67, 0xea, 0x95, 0x6b, 0x31, 0x11 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestProcess);
+#ifndef VBOX_WITH_GLUE
+struct IGuestProcess_vtbl
+{
+    struct IProcess_vtbl iprocess;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestProcessVtbl
+{
+    nsresult (*QueryInterface)(IGuestProcess *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestProcess *pThis);
+    nsrefcnt (*Release)(IGuestProcess *pThis);
+    nsresult (*GetArguments)(IGuestProcess *pThis, PRUint32 *argumentsSize, PRUnichar * **arguments);
+
+    nsresult (*GetEnvironment)(IGuestProcess *pThis, PRUint32 *environmentSize, PRUnichar * **environment);
+
+    nsresult (*GetEventSource)(IGuestProcess *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetExecutablePath)(IGuestProcess *pThis, PRUnichar * *executablePath);
+
+    nsresult (*GetExitCode)(IGuestProcess *pThis, PRInt32 *exitCode);
+
+    nsresult (*GetName)(IGuestProcess *pThis, PRUnichar * *name);
+
+    nsresult (*GetPID)(IGuestProcess *pThis, PRUint32 *PID);
+
+    nsresult (*GetStatus)(IGuestProcess *pThis, PRUint32 *status);
+
+    nsresult (*WaitFor)(
+        IGuestProcess *pThis,
+        PRUint32 waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+    nsresult (*WaitForArray)(
+        IGuestProcess *pThis,
+        PRUint32 waitForSize,
+        PRUint32* waitFor,
+        PRUint32 timeoutMS,
+        PRUint32 * reason
+    );
+
+    nsresult (*Read)(
+        IGuestProcess *pThis,
+        PRUint32 handle,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*Write)(
+        IGuestProcess *pThis,
+        PRUint32 handle,
+        PRUint32 flags,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*WriteArray)(
+        IGuestProcess *pThis,
+        PRUint32 handle,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*Terminate)(IGuestProcess *pThis );
+
+};
+#define IGuestProcess_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestProcess_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestProcess_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestProcess_get_Arguments(p, aArguments) ((p)->lpVtbl->GetArguments(p, aArguments))
+#define IGuestProcess_GetArguments(p, aArguments) ((p)->lpVtbl->GetArguments(p, aArguments))
+#define IGuestProcess_get_Environment(p, aEnvironment) ((p)->lpVtbl->GetEnvironment(p, aEnvironment))
+#define IGuestProcess_GetEnvironment(p, aEnvironment) ((p)->lpVtbl->GetEnvironment(p, aEnvironment))
+#define IGuestProcess_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IGuestProcess_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IGuestProcess_get_ExecutablePath(p, aExecutablePath) ((p)->lpVtbl->GetExecutablePath(p, aExecutablePath))
+#define IGuestProcess_GetExecutablePath(p, aExecutablePath) ((p)->lpVtbl->GetExecutablePath(p, aExecutablePath))
+#define IGuestProcess_get_ExitCode(p, aExitCode) ((p)->lpVtbl->GetExitCode(p, aExitCode))
+#define IGuestProcess_GetExitCode(p, aExitCode) ((p)->lpVtbl->GetExitCode(p, aExitCode))
+#define IGuestProcess_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestProcess_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestProcess_get_PID(p, aPID) ((p)->lpVtbl->GetPID(p, aPID))
+#define IGuestProcess_GetPID(p, aPID) ((p)->lpVtbl->GetPID(p, aPID))
+#define IGuestProcess_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestProcess_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestProcess_WaitFor(p, aWaitFor, aTimeoutMS, aReason) ((p)->lpVtbl->WaitFor(p, aWaitFor, aTimeoutMS, aReason))
+#define IGuestProcess_WaitForArray(p, aWaitFor, aTimeoutMS, aReason) ((p)->lpVtbl->WaitForArray(p, aWaitFor, aTimeoutMS, aReason))
+#define IGuestProcess_Read(p, aHandle, aToRead, aTimeoutMS, aData) ((p)->lpVtbl->Read(p, aHandle, aToRead, aTimeoutMS, aData))
+#define IGuestProcess_Write(p, aHandle, aFlags, aData, aTimeoutMS, aWritten) ((p)->lpVtbl->Write(p, aHandle, aFlags, aData, aTimeoutMS, aWritten))
+#define IGuestProcess_WriteArray(p, aHandle, aFlags, aData, aTimeoutMS, aWritten) ((p)->lpVtbl->WriteArray(p, aHandle, aFlags, aData, aTimeoutMS, aWritten))
+#define IGuestProcess_Terminate(p) ((p)->lpVtbl->Terminate(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestProcess
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestProcess_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestProcessVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestProcess declaration */
+
+
+/* Start of struct IDirectory declaration */
+#define IDIRECTORY_IID_STR "1b70dd03-26d7-483a-8877-89bbb0f87b70"
+#define IDIRECTORY_IID { \
+    0x1b70dd03, 0x26d7, 0x483a, \
+    { 0x88, 0x77, 0x89, 0xbb, 0xb0, 0xf8, 0x7b, 0x70 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IDirectory);
+#ifndef VBOX_WITH_GLUE
+struct IDirectory_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetDirectoryName)(IDirectory *pThis, PRUnichar * *directoryName);
+
+    nsresult (*GetFilter)(IDirectory *pThis, PRUnichar * *filter);
+
+    nsresult (*Close)(IDirectory *pThis );
+
+    nsresult (*Read)(
+        IDirectory *pThis,
+        IFsObjInfo * * objInfo
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IDirectoryVtbl
+{
+    nsresult (*QueryInterface)(IDirectory *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IDirectory *pThis);
+    nsrefcnt (*Release)(IDirectory *pThis);
+    nsresult (*GetDirectoryName)(IDirectory *pThis, PRUnichar * *directoryName);
+
+    nsresult (*GetFilter)(IDirectory *pThis, PRUnichar * *filter);
+
+    nsresult (*Close)(IDirectory *pThis );
+
+    nsresult (*Read)(
+        IDirectory *pThis,
+        IFsObjInfo * * objInfo
+    );
+
+};
+#define IDirectory_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IDirectory_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IDirectory_Release(p) ((p)->lpVtbl->Release(p))
+#define IDirectory_get_DirectoryName(p, aDirectoryName) ((p)->lpVtbl->GetDirectoryName(p, aDirectoryName))
+#define IDirectory_GetDirectoryName(p, aDirectoryName) ((p)->lpVtbl->GetDirectoryName(p, aDirectoryName))
+#define IDirectory_get_Filter(p, aFilter) ((p)->lpVtbl->GetFilter(p, aFilter))
+#define IDirectory_GetFilter(p, aFilter) ((p)->lpVtbl->GetFilter(p, aFilter))
+#define IDirectory_Close(p) ((p)->lpVtbl->Close(p))
+#define IDirectory_Read(p, aObjInfo) ((p)->lpVtbl->Read(p, aObjInfo))
+#endif /* VBOX_WITH_GLUE */
+
+interface IDirectory
+{
+#ifndef VBOX_WITH_GLUE
+    struct IDirectory_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IDirectoryVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IDirectory declaration */
+
+
+/* Start of struct IGuestDirectory declaration */
+#define IGUESTDIRECTORY_IID_STR "af4a8ce0-0725-42b7-8826-46e3c7ba7357"
+#define IGUESTDIRECTORY_IID { \
+    0xaf4a8ce0, 0x0725, 0x42b7, \
+    { 0x88, 0x26, 0x46, 0xe3, 0xc7, 0xba, 0x73, 0x57 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestDirectory);
+#ifndef VBOX_WITH_GLUE
+struct IGuestDirectory_vtbl
+{
+    struct IDirectory_vtbl idirectory;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestDirectoryVtbl
+{
+    nsresult (*QueryInterface)(IGuestDirectory *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestDirectory *pThis);
+    nsrefcnt (*Release)(IGuestDirectory *pThis);
+    nsresult (*GetDirectoryName)(IGuestDirectory *pThis, PRUnichar * *directoryName);
+
+    nsresult (*GetFilter)(IGuestDirectory *pThis, PRUnichar * *filter);
+
+    nsresult (*Close)(IGuestDirectory *pThis );
+
+    nsresult (*Read)(
+        IGuestDirectory *pThis,
+        IFsObjInfo * * objInfo
+    );
+
+};
+#define IGuestDirectory_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestDirectory_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestDirectory_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestDirectory_get_DirectoryName(p, aDirectoryName) ((p)->lpVtbl->GetDirectoryName(p, aDirectoryName))
+#define IGuestDirectory_GetDirectoryName(p, aDirectoryName) ((p)->lpVtbl->GetDirectoryName(p, aDirectoryName))
+#define IGuestDirectory_get_Filter(p, aFilter) ((p)->lpVtbl->GetFilter(p, aFilter))
+#define IGuestDirectory_GetFilter(p, aFilter) ((p)->lpVtbl->GetFilter(p, aFilter))
+#define IGuestDirectory_Close(p) ((p)->lpVtbl->Close(p))
+#define IGuestDirectory_Read(p, aObjInfo) ((p)->lpVtbl->Read(p, aObjInfo))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestDirectory
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestDirectory_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestDirectoryVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestDirectory declaration */
+
+
+/* Start of struct IFile declaration */
+#define IFILE_IID_STR "5ec56ea3-b55d-4bdb-8c4f-5f9fb26b894b"
+#define IFILE_IID { \
+    0x5ec56ea3, 0xb55d, 0x4bdb, \
+    { 0x8c, 0x4f, 0x5f, 0x9f, 0xb2, 0x6b, 0x89, 0x4b } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IFile);
+#ifndef VBOX_WITH_GLUE
+struct IFile_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetCreationMode)(IFile *pThis, PRUint32 *creationMode);
+
+    nsresult (*GetDisposition)(IFile *pThis, PRUnichar * *disposition);
+
+    nsresult (*GetEventSource)(IFile *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetFileName)(IFile *pThis, PRUnichar * *fileName);
+
+    nsresult (*GetId)(IFile *pThis, PRUint32 *id);
+
+    nsresult (*GetInitialSize)(IFile *pThis, PRInt64 *initialSize);
+
+    nsresult (*GetOpenMode)(IFile *pThis, PRUnichar * *openMode);
+
+    nsresult (*GetOffset)(IFile *pThis, PRInt64 *offset);
+
+    nsresult (*GetStatus)(IFile *pThis, PRUint32 *status);
+
+    nsresult (*Close)(IFile *pThis );
+
+    nsresult (*QueryInfo)(
+        IFile *pThis,
+        IFsObjInfo * * objInfo
+    );
+
+    nsresult (*Read)(
+        IFile *pThis,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*ReadAt)(
+        IFile *pThis,
+        PRInt64 offset,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*Seek)(
+        IFile *pThis,
+        PRInt64 offset,
+        PRUint32 whence
+    );
+
+    nsresult (*SetACL)(
+        IFile *pThis,
+        PRUnichar * acl
+    );
+
+    nsresult (*Write)(
+        IFile *pThis,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*WriteAt)(
+        IFile *pThis,
+        PRInt64 offset,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IFileVtbl
+{
+    nsresult (*QueryInterface)(IFile *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IFile *pThis);
+    nsrefcnt (*Release)(IFile *pThis);
+    nsresult (*GetCreationMode)(IFile *pThis, PRUint32 *creationMode);
+
+    nsresult (*GetDisposition)(IFile *pThis, PRUnichar * *disposition);
+
+    nsresult (*GetEventSource)(IFile *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetFileName)(IFile *pThis, PRUnichar * *fileName);
+
+    nsresult (*GetId)(IFile *pThis, PRUint32 *id);
+
+    nsresult (*GetInitialSize)(IFile *pThis, PRInt64 *initialSize);
+
+    nsresult (*GetOpenMode)(IFile *pThis, PRUnichar * *openMode);
+
+    nsresult (*GetOffset)(IFile *pThis, PRInt64 *offset);
+
+    nsresult (*GetStatus)(IFile *pThis, PRUint32 *status);
+
+    nsresult (*Close)(IFile *pThis );
+
+    nsresult (*QueryInfo)(
+        IFile *pThis,
+        IFsObjInfo * * objInfo
+    );
+
+    nsresult (*Read)(
+        IFile *pThis,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*ReadAt)(
+        IFile *pThis,
+        PRInt64 offset,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*Seek)(
+        IFile *pThis,
+        PRInt64 offset,
+        PRUint32 whence
+    );
+
+    nsresult (*SetACL)(
+        IFile *pThis,
+        PRUnichar * acl
+    );
+
+    nsresult (*Write)(
+        IFile *pThis,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*WriteAt)(
+        IFile *pThis,
+        PRInt64 offset,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+};
+#define IFile_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IFile_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IFile_Release(p) ((p)->lpVtbl->Release(p))
+#define IFile_get_CreationMode(p, aCreationMode) ((p)->lpVtbl->GetCreationMode(p, aCreationMode))
+#define IFile_GetCreationMode(p, aCreationMode) ((p)->lpVtbl->GetCreationMode(p, aCreationMode))
+#define IFile_get_Disposition(p, aDisposition) ((p)->lpVtbl->GetDisposition(p, aDisposition))
+#define IFile_GetDisposition(p, aDisposition) ((p)->lpVtbl->GetDisposition(p, aDisposition))
+#define IFile_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IFile_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IFile_get_FileName(p, aFileName) ((p)->lpVtbl->GetFileName(p, aFileName))
+#define IFile_GetFileName(p, aFileName) ((p)->lpVtbl->GetFileName(p, aFileName))
+#define IFile_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IFile_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IFile_get_InitialSize(p, aInitialSize) ((p)->lpVtbl->GetInitialSize(p, aInitialSize))
+#define IFile_GetInitialSize(p, aInitialSize) ((p)->lpVtbl->GetInitialSize(p, aInitialSize))
+#define IFile_get_OpenMode(p, aOpenMode) ((p)->lpVtbl->GetOpenMode(p, aOpenMode))
+#define IFile_GetOpenMode(p, aOpenMode) ((p)->lpVtbl->GetOpenMode(p, aOpenMode))
+#define IFile_get_Offset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IFile_GetOffset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IFile_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IFile_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IFile_Close(p) ((p)->lpVtbl->Close(p))
+#define IFile_QueryInfo(p, aObjInfo) ((p)->lpVtbl->QueryInfo(p, aObjInfo))
+#define IFile_Read(p, aToRead, aTimeoutMS, aData) ((p)->lpVtbl->Read(p, aToRead, aTimeoutMS, aData))
+#define IFile_ReadAt(p, aOffset, aToRead, aTimeoutMS, aData) ((p)->lpVtbl->ReadAt(p, aOffset, aToRead, aTimeoutMS, aData))
+#define IFile_Seek(p, aOffset, aWhence) ((p)->lpVtbl->Seek(p, aOffset, aWhence))
+#define IFile_SetACL(p, aAcl) ((p)->lpVtbl->SetACL(p, aAcl))
+#define IFile_Write(p, aData, aTimeoutMS, aWritten) ((p)->lpVtbl->Write(p, aData, aTimeoutMS, aWritten))
+#define IFile_WriteAt(p, aOffset, aData, aTimeoutMS, aWritten) ((p)->lpVtbl->WriteAt(p, aOffset, aData, aTimeoutMS, aWritten))
+#endif /* VBOX_WITH_GLUE */
+
+interface IFile
+{
+#ifndef VBOX_WITH_GLUE
+    struct IFile_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IFileVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IFile declaration */
+
+
+/* Start of struct IGuestFile declaration */
+#define IGUESTFILE_IID_STR "60661aec-145f-4d11-b80e-8ea151598093"
+#define IGUESTFILE_IID { \
+    0x60661aec, 0x145f, 0x4d11, \
+    { 0xb8, 0x0e, 0x8e, 0xa1, 0x51, 0x59, 0x80, 0x93 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFile);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFile_vtbl
+{
+    struct IFile_vtbl ifile;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFileVtbl
+{
+    nsresult (*QueryInterface)(IGuestFile *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFile *pThis);
+    nsrefcnt (*Release)(IGuestFile *pThis);
+    nsresult (*GetCreationMode)(IGuestFile *pThis, PRUint32 *creationMode);
+
+    nsresult (*GetDisposition)(IGuestFile *pThis, PRUnichar * *disposition);
+
+    nsresult (*GetEventSource)(IGuestFile *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetFileName)(IGuestFile *pThis, PRUnichar * *fileName);
+
+    nsresult (*GetId)(IGuestFile *pThis, PRUint32 *id);
+
+    nsresult (*GetInitialSize)(IGuestFile *pThis, PRInt64 *initialSize);
+
+    nsresult (*GetOpenMode)(IGuestFile *pThis, PRUnichar * *openMode);
+
+    nsresult (*GetOffset)(IGuestFile *pThis, PRInt64 *offset);
+
+    nsresult (*GetStatus)(IGuestFile *pThis, PRUint32 *status);
+
+    nsresult (*Close)(IGuestFile *pThis );
+
+    nsresult (*QueryInfo)(
+        IGuestFile *pThis,
+        IFsObjInfo * * objInfo
+    );
+
+    nsresult (*Read)(
+        IGuestFile *pThis,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*ReadAt)(
+        IGuestFile *pThis,
+        PRInt64 offset,
+        PRUint32 toRead,
+        PRUint32 timeoutMS,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*Seek)(
+        IGuestFile *pThis,
+        PRInt64 offset,
+        PRUint32 whence
+    );
+
+    nsresult (*SetACL)(
+        IGuestFile *pThis,
+        PRUnichar * acl
+    );
+
+    nsresult (*Write)(
+        IGuestFile *pThis,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+    nsresult (*WriteAt)(
+        IGuestFile *pThis,
+        PRInt64 offset,
+        PRUint32 dataSize,
+        PRUint8* data,
+        PRUint32 timeoutMS,
+        PRUint32 * written
+    );
+
+};
+#define IGuestFile_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFile_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFile_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFile_get_CreationMode(p, aCreationMode) ((p)->lpVtbl->GetCreationMode(p, aCreationMode))
+#define IGuestFile_GetCreationMode(p, aCreationMode) ((p)->lpVtbl->GetCreationMode(p, aCreationMode))
+#define IGuestFile_get_Disposition(p, aDisposition) ((p)->lpVtbl->GetDisposition(p, aDisposition))
+#define IGuestFile_GetDisposition(p, aDisposition) ((p)->lpVtbl->GetDisposition(p, aDisposition))
+#define IGuestFile_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IGuestFile_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IGuestFile_get_FileName(p, aFileName) ((p)->lpVtbl->GetFileName(p, aFileName))
+#define IGuestFile_GetFileName(p, aFileName) ((p)->lpVtbl->GetFileName(p, aFileName))
+#define IGuestFile_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IGuestFile_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IGuestFile_get_InitialSize(p, aInitialSize) ((p)->lpVtbl->GetInitialSize(p, aInitialSize))
+#define IGuestFile_GetInitialSize(p, aInitialSize) ((p)->lpVtbl->GetInitialSize(p, aInitialSize))
+#define IGuestFile_get_OpenMode(p, aOpenMode) ((p)->lpVtbl->GetOpenMode(p, aOpenMode))
+#define IGuestFile_GetOpenMode(p, aOpenMode) ((p)->lpVtbl->GetOpenMode(p, aOpenMode))
+#define IGuestFile_get_Offset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFile_GetOffset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFile_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestFile_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestFile_Close(p) ((p)->lpVtbl->Close(p))
+#define IGuestFile_QueryInfo(p, aObjInfo) ((p)->lpVtbl->QueryInfo(p, aObjInfo))
+#define IGuestFile_Read(p, aToRead, aTimeoutMS, aData) ((p)->lpVtbl->Read(p, aToRead, aTimeoutMS, aData))
+#define IGuestFile_ReadAt(p, aOffset, aToRead, aTimeoutMS, aData) ((p)->lpVtbl->ReadAt(p, aOffset, aToRead, aTimeoutMS, aData))
+#define IGuestFile_Seek(p, aOffset, aWhence) ((p)->lpVtbl->Seek(p, aOffset, aWhence))
+#define IGuestFile_SetACL(p, aAcl) ((p)->lpVtbl->SetACL(p, aAcl))
+#define IGuestFile_Write(p, aData, aTimeoutMS, aWritten) ((p)->lpVtbl->Write(p, aData, aTimeoutMS, aWritten))
+#define IGuestFile_WriteAt(p, aOffset, aData, aTimeoutMS, aWritten) ((p)->lpVtbl->WriteAt(p, aOffset, aData, aTimeoutMS, aWritten))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFile
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFile_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFileVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFile declaration */
+
+
+/* Start of struct IFsObjInfo declaration */
+#define IFSOBJINFO_IID_STR "4047ba30-7006-4966-ae86-94164e5e20eb"
+#define IFSOBJINFO_IID { \
+    0x4047ba30, 0x7006, 0x4966, \
+    { 0xae, 0x86, 0x94, 0x16, 0x4e, 0x5e, 0x20, 0xeb } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IFsObjInfo);
+#ifndef VBOX_WITH_GLUE
+struct IFsObjInfo_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetAccessTime)(IFsObjInfo *pThis, PRInt64 *accessTime);
+
+    nsresult (*GetAllocatedSize)(IFsObjInfo *pThis, PRInt64 *allocatedSize);
+
+    nsresult (*GetBirthTime)(IFsObjInfo *pThis, PRInt64 *birthTime);
+
+    nsresult (*GetChangeTime)(IFsObjInfo *pThis, PRInt64 *changeTime);
+
+    nsresult (*GetDeviceNumber)(IFsObjInfo *pThis, PRUint32 *deviceNumber);
+
+    nsresult (*GetFileAttributes)(IFsObjInfo *pThis, PRUnichar * *fileAttributes);
+
+    nsresult (*GetGenerationId)(IFsObjInfo *pThis, PRUint32 *generationId);
+
+    nsresult (*GetGID)(IFsObjInfo *pThis, PRUint32 *GID);
+
+    nsresult (*GetGroupName)(IFsObjInfo *pThis, PRUnichar * *groupName);
+
+    nsresult (*GetHardLinks)(IFsObjInfo *pThis, PRUint32 *hardLinks);
+
+    nsresult (*GetModificationTime)(IFsObjInfo *pThis, PRInt64 *modificationTime);
+
+    nsresult (*GetName)(IFsObjInfo *pThis, PRUnichar * *name);
+
+    nsresult (*GetNodeId)(IFsObjInfo *pThis, PRInt64 *nodeId);
+
+    nsresult (*GetNodeIdDevice)(IFsObjInfo *pThis, PRUint32 *nodeIdDevice);
+
+    nsresult (*GetObjectSize)(IFsObjInfo *pThis, PRInt64 *objectSize);
+
+    nsresult (*GetType)(IFsObjInfo *pThis, PRUint32 *type);
+
+    nsresult (*GetUID)(IFsObjInfo *pThis, PRUint32 *UID);
+
+    nsresult (*GetUserFlags)(IFsObjInfo *pThis, PRUint32 *userFlags);
+
+    nsresult (*GetUserName)(IFsObjInfo *pThis, PRUnichar * *userName);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IFsObjInfoVtbl
+{
+    nsresult (*QueryInterface)(IFsObjInfo *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IFsObjInfo *pThis);
+    nsrefcnt (*Release)(IFsObjInfo *pThis);
+    nsresult (*GetAccessTime)(IFsObjInfo *pThis, PRInt64 *accessTime);
+
+    nsresult (*GetAllocatedSize)(IFsObjInfo *pThis, PRInt64 *allocatedSize);
+
+    nsresult (*GetBirthTime)(IFsObjInfo *pThis, PRInt64 *birthTime);
+
+    nsresult (*GetChangeTime)(IFsObjInfo *pThis, PRInt64 *changeTime);
+
+    nsresult (*GetDeviceNumber)(IFsObjInfo *pThis, PRUint32 *deviceNumber);
+
+    nsresult (*GetFileAttributes)(IFsObjInfo *pThis, PRUnichar * *fileAttributes);
+
+    nsresult (*GetGenerationId)(IFsObjInfo *pThis, PRUint32 *generationId);
+
+    nsresult (*GetGID)(IFsObjInfo *pThis, PRUint32 *GID);
+
+    nsresult (*GetGroupName)(IFsObjInfo *pThis, PRUnichar * *groupName);
+
+    nsresult (*GetHardLinks)(IFsObjInfo *pThis, PRUint32 *hardLinks);
+
+    nsresult (*GetModificationTime)(IFsObjInfo *pThis, PRInt64 *modificationTime);
+
+    nsresult (*GetName)(IFsObjInfo *pThis, PRUnichar * *name);
+
+    nsresult (*GetNodeId)(IFsObjInfo *pThis, PRInt64 *nodeId);
+
+    nsresult (*GetNodeIdDevice)(IFsObjInfo *pThis, PRUint32 *nodeIdDevice);
+
+    nsresult (*GetObjectSize)(IFsObjInfo *pThis, PRInt64 *objectSize);
+
+    nsresult (*GetType)(IFsObjInfo *pThis, PRUint32 *type);
+
+    nsresult (*GetUID)(IFsObjInfo *pThis, PRUint32 *UID);
+
+    nsresult (*GetUserFlags)(IFsObjInfo *pThis, PRUint32 *userFlags);
+
+    nsresult (*GetUserName)(IFsObjInfo *pThis, PRUnichar * *userName);
+
+};
+#define IFsObjInfo_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IFsObjInfo_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IFsObjInfo_Release(p) ((p)->lpVtbl->Release(p))
+#define IFsObjInfo_get_AccessTime(p, aAccessTime) ((p)->lpVtbl->GetAccessTime(p, aAccessTime))
+#define IFsObjInfo_GetAccessTime(p, aAccessTime) ((p)->lpVtbl->GetAccessTime(p, aAccessTime))
+#define IFsObjInfo_get_AllocatedSize(p, aAllocatedSize) ((p)->lpVtbl->GetAllocatedSize(p, aAllocatedSize))
+#define IFsObjInfo_GetAllocatedSize(p, aAllocatedSize) ((p)->lpVtbl->GetAllocatedSize(p, aAllocatedSize))
+#define IFsObjInfo_get_BirthTime(p, aBirthTime) ((p)->lpVtbl->GetBirthTime(p, aBirthTime))
+#define IFsObjInfo_GetBirthTime(p, aBirthTime) ((p)->lpVtbl->GetBirthTime(p, aBirthTime))
+#define IFsObjInfo_get_ChangeTime(p, aChangeTime) ((p)->lpVtbl->GetChangeTime(p, aChangeTime))
+#define IFsObjInfo_GetChangeTime(p, aChangeTime) ((p)->lpVtbl->GetChangeTime(p, aChangeTime))
+#define IFsObjInfo_get_DeviceNumber(p, aDeviceNumber) ((p)->lpVtbl->GetDeviceNumber(p, aDeviceNumber))
+#define IFsObjInfo_GetDeviceNumber(p, aDeviceNumber) ((p)->lpVtbl->GetDeviceNumber(p, aDeviceNumber))
+#define IFsObjInfo_get_FileAttributes(p, aFileAttributes) ((p)->lpVtbl->GetFileAttributes(p, aFileAttributes))
+#define IFsObjInfo_GetFileAttributes(p, aFileAttributes) ((p)->lpVtbl->GetFileAttributes(p, aFileAttributes))
+#define IFsObjInfo_get_GenerationId(p, aGenerationId) ((p)->lpVtbl->GetGenerationId(p, aGenerationId))
+#define IFsObjInfo_GetGenerationId(p, aGenerationId) ((p)->lpVtbl->GetGenerationId(p, aGenerationId))
+#define IFsObjInfo_get_GID(p, aGID) ((p)->lpVtbl->GetGID(p, aGID))
+#define IFsObjInfo_GetGID(p, aGID) ((p)->lpVtbl->GetGID(p, aGID))
+#define IFsObjInfo_get_GroupName(p, aGroupName) ((p)->lpVtbl->GetGroupName(p, aGroupName))
+#define IFsObjInfo_GetGroupName(p, aGroupName) ((p)->lpVtbl->GetGroupName(p, aGroupName))
+#define IFsObjInfo_get_HardLinks(p, aHardLinks) ((p)->lpVtbl->GetHardLinks(p, aHardLinks))
+#define IFsObjInfo_GetHardLinks(p, aHardLinks) ((p)->lpVtbl->GetHardLinks(p, aHardLinks))
+#define IFsObjInfo_get_ModificationTime(p, aModificationTime) ((p)->lpVtbl->GetModificationTime(p, aModificationTime))
+#define IFsObjInfo_GetModificationTime(p, aModificationTime) ((p)->lpVtbl->GetModificationTime(p, aModificationTime))
+#define IFsObjInfo_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IFsObjInfo_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IFsObjInfo_get_NodeId(p, aNodeId) ((p)->lpVtbl->GetNodeId(p, aNodeId))
+#define IFsObjInfo_GetNodeId(p, aNodeId) ((p)->lpVtbl->GetNodeId(p, aNodeId))
+#define IFsObjInfo_get_NodeIdDevice(p, aNodeIdDevice) ((p)->lpVtbl->GetNodeIdDevice(p, aNodeIdDevice))
+#define IFsObjInfo_GetNodeIdDevice(p, aNodeIdDevice) ((p)->lpVtbl->GetNodeIdDevice(p, aNodeIdDevice))
+#define IFsObjInfo_get_ObjectSize(p, aObjectSize) ((p)->lpVtbl->GetObjectSize(p, aObjectSize))
+#define IFsObjInfo_GetObjectSize(p, aObjectSize) ((p)->lpVtbl->GetObjectSize(p, aObjectSize))
+#define IFsObjInfo_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IFsObjInfo_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IFsObjInfo_get_UID(p, aUID) ((p)->lpVtbl->GetUID(p, aUID))
+#define IFsObjInfo_GetUID(p, aUID) ((p)->lpVtbl->GetUID(p, aUID))
+#define IFsObjInfo_get_UserFlags(p, aUserFlags) ((p)->lpVtbl->GetUserFlags(p, aUserFlags))
+#define IFsObjInfo_GetUserFlags(p, aUserFlags) ((p)->lpVtbl->GetUserFlags(p, aUserFlags))
+#define IFsObjInfo_get_UserName(p, aUserName) ((p)->lpVtbl->GetUserName(p, aUserName))
+#define IFsObjInfo_GetUserName(p, aUserName) ((p)->lpVtbl->GetUserName(p, aUserName))
+#endif /* VBOX_WITH_GLUE */
+
+interface IFsObjInfo
+{
+#ifndef VBOX_WITH_GLUE
+    struct IFsObjInfo_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IFsObjInfoVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IFsObjInfo declaration */
+
+
+/* Start of struct IGuestFsObjInfo declaration */
+#define IGUESTFSOBJINFO_IID_STR "d5cf678e-3484-4e4a-ac55-329e15462e18"
+#define IGUESTFSOBJINFO_IID { \
+    0xd5cf678e, 0x3484, 0x4e4a, \
+    { 0xac, 0x55, 0x32, 0x9e, 0x15, 0x46, 0x2e, 0x18 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFsObjInfo);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFsObjInfo_vtbl
+{
+    struct IFsObjInfo_vtbl ifsobjinfo;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFsObjInfoVtbl
+{
+    nsresult (*QueryInterface)(IGuestFsObjInfo *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFsObjInfo *pThis);
+    nsrefcnt (*Release)(IGuestFsObjInfo *pThis);
+    nsresult (*GetAccessTime)(IGuestFsObjInfo *pThis, PRInt64 *accessTime);
+
+    nsresult (*GetAllocatedSize)(IGuestFsObjInfo *pThis, PRInt64 *allocatedSize);
+
+    nsresult (*GetBirthTime)(IGuestFsObjInfo *pThis, PRInt64 *birthTime);
+
+    nsresult (*GetChangeTime)(IGuestFsObjInfo *pThis, PRInt64 *changeTime);
+
+    nsresult (*GetDeviceNumber)(IGuestFsObjInfo *pThis, PRUint32 *deviceNumber);
+
+    nsresult (*GetFileAttributes)(IGuestFsObjInfo *pThis, PRUnichar * *fileAttributes);
+
+    nsresult (*GetGenerationId)(IGuestFsObjInfo *pThis, PRUint32 *generationId);
+
+    nsresult (*GetGID)(IGuestFsObjInfo *pThis, PRUint32 *GID);
+
+    nsresult (*GetGroupName)(IGuestFsObjInfo *pThis, PRUnichar * *groupName);
+
+    nsresult (*GetHardLinks)(IGuestFsObjInfo *pThis, PRUint32 *hardLinks);
+
+    nsresult (*GetModificationTime)(IGuestFsObjInfo *pThis, PRInt64 *modificationTime);
+
+    nsresult (*GetName)(IGuestFsObjInfo *pThis, PRUnichar * *name);
+
+    nsresult (*GetNodeId)(IGuestFsObjInfo *pThis, PRInt64 *nodeId);
+
+    nsresult (*GetNodeIdDevice)(IGuestFsObjInfo *pThis, PRUint32 *nodeIdDevice);
+
+    nsresult (*GetObjectSize)(IGuestFsObjInfo *pThis, PRInt64 *objectSize);
+
+    nsresult (*GetType)(IGuestFsObjInfo *pThis, PRUint32 *type);
+
+    nsresult (*GetUID)(IGuestFsObjInfo *pThis, PRUint32 *UID);
+
+    nsresult (*GetUserFlags)(IGuestFsObjInfo *pThis, PRUint32 *userFlags);
+
+    nsresult (*GetUserName)(IGuestFsObjInfo *pThis, PRUnichar * *userName);
+
+};
+#define IGuestFsObjInfo_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFsObjInfo_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFsObjInfo_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFsObjInfo_get_AccessTime(p, aAccessTime) ((p)->lpVtbl->GetAccessTime(p, aAccessTime))
+#define IGuestFsObjInfo_GetAccessTime(p, aAccessTime) ((p)->lpVtbl->GetAccessTime(p, aAccessTime))
+#define IGuestFsObjInfo_get_AllocatedSize(p, aAllocatedSize) ((p)->lpVtbl->GetAllocatedSize(p, aAllocatedSize))
+#define IGuestFsObjInfo_GetAllocatedSize(p, aAllocatedSize) ((p)->lpVtbl->GetAllocatedSize(p, aAllocatedSize))
+#define IGuestFsObjInfo_get_BirthTime(p, aBirthTime) ((p)->lpVtbl->GetBirthTime(p, aBirthTime))
+#define IGuestFsObjInfo_GetBirthTime(p, aBirthTime) ((p)->lpVtbl->GetBirthTime(p, aBirthTime))
+#define IGuestFsObjInfo_get_ChangeTime(p, aChangeTime) ((p)->lpVtbl->GetChangeTime(p, aChangeTime))
+#define IGuestFsObjInfo_GetChangeTime(p, aChangeTime) ((p)->lpVtbl->GetChangeTime(p, aChangeTime))
+#define IGuestFsObjInfo_get_DeviceNumber(p, aDeviceNumber) ((p)->lpVtbl->GetDeviceNumber(p, aDeviceNumber))
+#define IGuestFsObjInfo_GetDeviceNumber(p, aDeviceNumber) ((p)->lpVtbl->GetDeviceNumber(p, aDeviceNumber))
+#define IGuestFsObjInfo_get_FileAttributes(p, aFileAttributes) ((p)->lpVtbl->GetFileAttributes(p, aFileAttributes))
+#define IGuestFsObjInfo_GetFileAttributes(p, aFileAttributes) ((p)->lpVtbl->GetFileAttributes(p, aFileAttributes))
+#define IGuestFsObjInfo_get_GenerationId(p, aGenerationId) ((p)->lpVtbl->GetGenerationId(p, aGenerationId))
+#define IGuestFsObjInfo_GetGenerationId(p, aGenerationId) ((p)->lpVtbl->GetGenerationId(p, aGenerationId))
+#define IGuestFsObjInfo_get_GID(p, aGID) ((p)->lpVtbl->GetGID(p, aGID))
+#define IGuestFsObjInfo_GetGID(p, aGID) ((p)->lpVtbl->GetGID(p, aGID))
+#define IGuestFsObjInfo_get_GroupName(p, aGroupName) ((p)->lpVtbl->GetGroupName(p, aGroupName))
+#define IGuestFsObjInfo_GetGroupName(p, aGroupName) ((p)->lpVtbl->GetGroupName(p, aGroupName))
+#define IGuestFsObjInfo_get_HardLinks(p, aHardLinks) ((p)->lpVtbl->GetHardLinks(p, aHardLinks))
+#define IGuestFsObjInfo_GetHardLinks(p, aHardLinks) ((p)->lpVtbl->GetHardLinks(p, aHardLinks))
+#define IGuestFsObjInfo_get_ModificationTime(p, aModificationTime) ((p)->lpVtbl->GetModificationTime(p, aModificationTime))
+#define IGuestFsObjInfo_GetModificationTime(p, aModificationTime) ((p)->lpVtbl->GetModificationTime(p, aModificationTime))
+#define IGuestFsObjInfo_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestFsObjInfo_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestFsObjInfo_get_NodeId(p, aNodeId) ((p)->lpVtbl->GetNodeId(p, aNodeId))
+#define IGuestFsObjInfo_GetNodeId(p, aNodeId) ((p)->lpVtbl->GetNodeId(p, aNodeId))
+#define IGuestFsObjInfo_get_NodeIdDevice(p, aNodeIdDevice) ((p)->lpVtbl->GetNodeIdDevice(p, aNodeIdDevice))
+#define IGuestFsObjInfo_GetNodeIdDevice(p, aNodeIdDevice) ((p)->lpVtbl->GetNodeIdDevice(p, aNodeIdDevice))
+#define IGuestFsObjInfo_get_ObjectSize(p, aObjectSize) ((p)->lpVtbl->GetObjectSize(p, aObjectSize))
+#define IGuestFsObjInfo_GetObjectSize(p, aObjectSize) ((p)->lpVtbl->GetObjectSize(p, aObjectSize))
+#define IGuestFsObjInfo_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFsObjInfo_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFsObjInfo_get_UID(p, aUID) ((p)->lpVtbl->GetUID(p, aUID))
+#define IGuestFsObjInfo_GetUID(p, aUID) ((p)->lpVtbl->GetUID(p, aUID))
+#define IGuestFsObjInfo_get_UserFlags(p, aUserFlags) ((p)->lpVtbl->GetUserFlags(p, aUserFlags))
+#define IGuestFsObjInfo_GetUserFlags(p, aUserFlags) ((p)->lpVtbl->GetUserFlags(p, aUserFlags))
+#define IGuestFsObjInfo_get_UserName(p, aUserName) ((p)->lpVtbl->GetUserName(p, aUserName))
+#define IGuestFsObjInfo_GetUserName(p, aUserName) ((p)->lpVtbl->GetUserName(p, aUserName))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFsObjInfo
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFsObjInfo_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFsObjInfoVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFsObjInfo declaration */
+
+
+/* Start of struct IGuest declaration */
+#define IGUEST_IID_STR "8011a1b1-6adb-4ffb-a37e-20abdaee4650"
+#define IGUEST_IID { \
+    0x8011a1b1, 0x6adb, 0x4ffb, \
+    { 0xa3, 0x7e, 0x20, 0xab, 0xda, 0xee, 0x46, 0x50 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuest);
+#ifndef VBOX_WITH_GLUE
+struct IGuest_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetOSTypeId)(IGuest *pThis, PRUnichar * *OSTypeId);
+
+    nsresult (*GetAdditionsRunLevel)(IGuest *pThis, PRUint32 *additionsRunLevel);
+
+    nsresult (*GetAdditionsVersion)(IGuest *pThis, PRUnichar * *additionsVersion);
+
+    nsresult (*GetAdditionsRevision)(IGuest *pThis, PRUint32 *additionsRevision);
+
+    nsresult (*GetEventSource)(IGuest *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetFacilities)(IGuest *pThis, PRUint32 *facilitiesSize, IAdditionsFacility * **facilities);
+
+    nsresult (*GetSessions)(IGuest *pThis, PRUint32 *sessionsSize, IGuestSession * **sessions);
+
+    nsresult (*GetMemoryBalloonSize)(IGuest *pThis, PRUint32 *memoryBalloonSize);
+    nsresult (*SetMemoryBalloonSize)(IGuest *pThis, PRUint32 memoryBalloonSize);
+
+    nsresult (*GetStatisticsUpdateInterval)(IGuest *pThis, PRUint32 *statisticsUpdateInterval);
+    nsresult (*SetStatisticsUpdateInterval)(IGuest *pThis, PRUint32 statisticsUpdateInterval);
+
+    nsresult (*InternalGetStatistics)(
+        IGuest *pThis,
+        PRUint32 * cpuUser,
+        PRUint32 * cpuKernel,
+        PRUint32 * cpuIdle,
+        PRUint32 * memTotal,
+        PRUint32 * memFree,
+        PRUint32 * memBalloon,
+        PRUint32 * memShared,
+        PRUint32 * memCache,
+        PRUint32 * pagedTotal,
+        PRUint32 * memAllocTotal,
+        PRUint32 * memFreeTotal,
+        PRUint32 * memBalloonTotal,
+        PRUint32 * memSharedTotal
+    );
+
+    nsresult (*GetFacilityStatus)(
+        IGuest *pThis,
+        PRUint32 facility,
+        PRInt64 * timestamp,
+        PRUint32 * status
+    );
+
+    nsresult (*GetAdditionsStatus)(
+        IGuest *pThis,
+        PRUint32 level,
+        PRBool * active
+    );
+
+    nsresult (*SetCredentials)(
+        IGuest *pThis,
+        PRUnichar * userName,
+        PRUnichar * password,
+        PRUnichar * domain,
+        PRBool allowInteractiveLogon
+    );
+
+    nsresult (*DragHGEnter)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUint32 y,
+        PRUint32 x,
+        PRUint32 defaultAction,
+        PRUint32 allowedActionsSize,
+        PRUint32* allowedActions,
+        PRUint32 formatsSize,
+        PRUnichar ** formats,
+        PRUint32 * resultAction
+    );
+
+    nsresult (*DragHGMove)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 defaultAction,
+        PRUint32 allowedActionsSize,
+        PRUint32* allowedActions,
+        PRUint32 formatsSize,
+        PRUnichar ** formats,
+        PRUint32 * resultAction
+    );
+
+    nsresult (*DragHGLeave)(
+        IGuest *pThis,
+        PRUint32 screenId
+    );
+
+    nsresult (*DragHGDrop)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 defaultAction,
+        PRUint32 allowedActionsSize,
+        PRUint32* allowedActions,
+        PRUint32 formatsSize,
+        PRUnichar ** formats,
+        PRUnichar * * format,
+        PRUint32 * resultAction
+    );
+
+    nsresult (*DragHGPutData)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUnichar * format,
+        PRUint32 dataSize,
+        PRUint8* data,
+        IProgress * * progress
+    );
+
+    nsresult (*DragGHPending)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUint32 *formatsSize,
+        PRUnichar *** formats,
+        PRUint32 *allowedActionsSize,
+        PRUint32** allowedActions,
+        PRUint32 * defaultAction
+    );
+
+    nsresult (*DragGHDropped)(
+        IGuest *pThis,
+        PRUnichar * format,
+        PRUint32 action,
+        IProgress * * progress
+    );
+
+    nsresult (*DragGHGetData)(
+        IGuest *pThis,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*CreateSession)(
+        IGuest *pThis,
+        PRUnichar * user,
+        PRUnichar * password,
+        PRUnichar * domain,
+        PRUnichar * sessionName,
+        IGuestSession * * guestSession
+    );
+
+    nsresult (*FindSession)(
+        IGuest *pThis,
+        PRUnichar * sessionName,
+        PRUint32 *sessionsSize,
+        IGuestSession *** sessions
+    );
+
+    nsresult (*UpdateGuestAdditions)(
+        IGuest *pThis,
+        PRUnichar * source,
+        PRUint32 argumentsSize,
+        PRUnichar ** arguments,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IProgress * * progress
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestVtbl
+{
+    nsresult (*QueryInterface)(IGuest *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuest *pThis);
+    nsrefcnt (*Release)(IGuest *pThis);
+    nsresult (*GetOSTypeId)(IGuest *pThis, PRUnichar * *OSTypeId);
+
+    nsresult (*GetAdditionsRunLevel)(IGuest *pThis, PRUint32 *additionsRunLevel);
+
+    nsresult (*GetAdditionsVersion)(IGuest *pThis, PRUnichar * *additionsVersion);
+
+    nsresult (*GetAdditionsRevision)(IGuest *pThis, PRUint32 *additionsRevision);
+
+    nsresult (*GetEventSource)(IGuest *pThis, IEventSource * *eventSource);
+
+    nsresult (*GetFacilities)(IGuest *pThis, PRUint32 *facilitiesSize, IAdditionsFacility * **facilities);
+
+    nsresult (*GetSessions)(IGuest *pThis, PRUint32 *sessionsSize, IGuestSession * **sessions);
+
+    nsresult (*GetMemoryBalloonSize)(IGuest *pThis, PRUint32 *memoryBalloonSize);
+    nsresult (*SetMemoryBalloonSize)(IGuest *pThis, PRUint32 memoryBalloonSize);
+
+    nsresult (*GetStatisticsUpdateInterval)(IGuest *pThis, PRUint32 *statisticsUpdateInterval);
+    nsresult (*SetStatisticsUpdateInterval)(IGuest *pThis, PRUint32 statisticsUpdateInterval);
+
+    nsresult (*InternalGetStatistics)(
+        IGuest *pThis,
+        PRUint32 * cpuUser,
+        PRUint32 * cpuKernel,
+        PRUint32 * cpuIdle,
+        PRUint32 * memTotal,
+        PRUint32 * memFree,
+        PRUint32 * memBalloon,
+        PRUint32 * memShared,
+        PRUint32 * memCache,
+        PRUint32 * pagedTotal,
+        PRUint32 * memAllocTotal,
+        PRUint32 * memFreeTotal,
+        PRUint32 * memBalloonTotal,
+        PRUint32 * memSharedTotal
+    );
+
+    nsresult (*GetFacilityStatus)(
+        IGuest *pThis,
+        PRUint32 facility,
+        PRInt64 * timestamp,
+        PRUint32 * status
+    );
+
+    nsresult (*GetAdditionsStatus)(
+        IGuest *pThis,
+        PRUint32 level,
+        PRBool * active
+    );
+
+    nsresult (*SetCredentials)(
+        IGuest *pThis,
+        PRUnichar * userName,
+        PRUnichar * password,
+        PRUnichar * domain,
+        PRBool allowInteractiveLogon
+    );
+
+    nsresult (*DragHGEnter)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUint32 y,
+        PRUint32 x,
+        PRUint32 defaultAction,
+        PRUint32 allowedActionsSize,
+        PRUint32* allowedActions,
+        PRUint32 formatsSize,
+        PRUnichar ** formats,
+        PRUint32 * resultAction
+    );
+
+    nsresult (*DragHGMove)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 defaultAction,
+        PRUint32 allowedActionsSize,
+        PRUint32* allowedActions,
+        PRUint32 formatsSize,
+        PRUnichar ** formats,
+        PRUint32 * resultAction
+    );
+
+    nsresult (*DragHGLeave)(
+        IGuest *pThis,
+        PRUint32 screenId
+    );
+
+    nsresult (*DragHGDrop)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 defaultAction,
+        PRUint32 allowedActionsSize,
+        PRUint32* allowedActions,
+        PRUint32 formatsSize,
+        PRUnichar ** formats,
+        PRUnichar * * format,
+        PRUint32 * resultAction
+    );
+
+    nsresult (*DragHGPutData)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUnichar * format,
+        PRUint32 dataSize,
+        PRUint8* data,
+        IProgress * * progress
+    );
+
+    nsresult (*DragGHPending)(
+        IGuest *pThis,
+        PRUint32 screenId,
+        PRUint32 *formatsSize,
+        PRUnichar *** formats,
+        PRUint32 *allowedActionsSize,
+        PRUint32** allowedActions,
+        PRUint32 * defaultAction
+    );
+
+    nsresult (*DragGHDropped)(
+        IGuest *pThis,
+        PRUnichar * format,
+        PRUint32 action,
+        IProgress * * progress
+    );
+
+    nsresult (*DragGHGetData)(
+        IGuest *pThis,
+        PRUint32 *dataSize,
+        PRUint8** data
+    );
+
+    nsresult (*CreateSession)(
+        IGuest *pThis,
+        PRUnichar * user,
+        PRUnichar * password,
+        PRUnichar * domain,
+        PRUnichar * sessionName,
+        IGuestSession * * guestSession
+    );
+
+    nsresult (*FindSession)(
+        IGuest *pThis,
+        PRUnichar * sessionName,
+        PRUint32 *sessionsSize,
+        IGuestSession *** sessions
+    );
+
+    nsresult (*UpdateGuestAdditions)(
+        IGuest *pThis,
+        PRUnichar * source,
+        PRUint32 argumentsSize,
+        PRUnichar ** arguments,
+        PRUint32 flagsSize,
+        PRUint32* flags,
+        IProgress * * progress
+    );
+
+};
+#define IGuest_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuest_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuest_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuest_get_OSTypeId(p, aOSTypeId) ((p)->lpVtbl->GetOSTypeId(p, aOSTypeId))
+#define IGuest_GetOSTypeId(p, aOSTypeId) ((p)->lpVtbl->GetOSTypeId(p, aOSTypeId))
+#define IGuest_get_AdditionsRunLevel(p, aAdditionsRunLevel) ((p)->lpVtbl->GetAdditionsRunLevel(p, aAdditionsRunLevel))
+#define IGuest_GetAdditionsRunLevel(p, aAdditionsRunLevel) ((p)->lpVtbl->GetAdditionsRunLevel(p, aAdditionsRunLevel))
+#define IGuest_get_AdditionsVersion(p, aAdditionsVersion) ((p)->lpVtbl->GetAdditionsVersion(p, aAdditionsVersion))
+#define IGuest_GetAdditionsVersion(p, aAdditionsVersion) ((p)->lpVtbl->GetAdditionsVersion(p, aAdditionsVersion))
+#define IGuest_get_AdditionsRevision(p, aAdditionsRevision) ((p)->lpVtbl->GetAdditionsRevision(p, aAdditionsRevision))
+#define IGuest_GetAdditionsRevision(p, aAdditionsRevision) ((p)->lpVtbl->GetAdditionsRevision(p, aAdditionsRevision))
+#define IGuest_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IGuest_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IGuest_get_Facilities(p, aFacilities) ((p)->lpVtbl->GetFacilities(p, aFacilities))
+#define IGuest_GetFacilities(p, aFacilities) ((p)->lpVtbl->GetFacilities(p, aFacilities))
+#define IGuest_get_Sessions(p, aSessions) ((p)->lpVtbl->GetSessions(p, aSessions))
+#define IGuest_GetSessions(p, aSessions) ((p)->lpVtbl->GetSessions(p, aSessions))
+#define IGuest_get_MemoryBalloonSize(p, aMemoryBalloonSize) ((p)->lpVtbl->GetMemoryBalloonSize(p, aMemoryBalloonSize))
+#define IGuest_GetMemoryBalloonSize(p, aMemoryBalloonSize) ((p)->lpVtbl->GetMemoryBalloonSize(p, aMemoryBalloonSize))
+#define IGuest_put_MemoryBalloonSize(p, aMemoryBalloonSize) ((p)->lpVtbl->SetMemoryBalloonSize(p, aMemoryBalloonSize))
+#define IGuest_SetMemoryBalloonSize(p, aMemoryBalloonSize) ((p)->lpVtbl->SetMemoryBalloonSize(p, aMemoryBalloonSize))
+#define IGuest_get_StatisticsUpdateInterval(p, aStatisticsUpdateInterval) ((p)->lpVtbl->GetStatisticsUpdateInterval(p, aStatisticsUpdateInterval))
+#define IGuest_GetStatisticsUpdateInterval(p, aStatisticsUpdateInterval) ((p)->lpVtbl->GetStatisticsUpdateInterval(p, aStatisticsUpdateInterval))
+#define IGuest_put_StatisticsUpdateInterval(p, aStatisticsUpdateInterval) ((p)->lpVtbl->SetStatisticsUpdateInterval(p, aStatisticsUpdateInterval))
+#define IGuest_SetStatisticsUpdateInterval(p, aStatisticsUpdateInterval) ((p)->lpVtbl->SetStatisticsUpdateInterval(p, aStatisticsUpdateInterval))
+#define IGuest_InternalGetStatistics(p, aCpuUser, aCpuKernel, aCpuIdle, aMemTotal, aMemFree, aMemBalloon, aMemShared, aMemCache, aPagedTotal, aMemAllocTotal, aMemFreeTotal, aMemBalloonTotal, aMemSharedTotal) ((p)->lpVtbl->InternalGetStatistics(p, aCpuUser, aCpuKernel, aCpuIdle, aMemTotal, aMemFree, aMemBalloon, aMemShared, aMemCache, aPagedTotal, aMemAllocTotal, aMemFreeTotal, aMemBalloonTotal, aMemSharedTotal))
+#define IGuest_GetFacilityStatus(p, aFacility, aTimestamp, aStatus) ((p)->lpVtbl->GetFacilityStatus(p, aFacility, aTimestamp, aStatus))
+#define IGuest_GetAdditionsStatus(p, aLevel, aActive) ((p)->lpVtbl->GetAdditionsStatus(p, aLevel, aActive))
+#define IGuest_SetCredentials(p, aUserName, aPassword, aDomain, aAllowInteractiveLogon) ((p)->lpVtbl->SetCredentials(p, aUserName, aPassword, aDomain, aAllowInteractiveLogon))
+#define IGuest_DragHGEnter(p, aScreenId, aY, aX, aDefaultAction, aAllowedActions, aFormats, aResultAction) ((p)->lpVtbl->DragHGEnter(p, aScreenId, aY, aX, aDefaultAction, aAllowedActions, aFormats, aResultAction))
+#define IGuest_DragHGMove(p, aScreenId, aX, aY, aDefaultAction, aAllowedActions, aFormats, aResultAction) ((p)->lpVtbl->DragHGMove(p, aScreenId, aX, aY, aDefaultAction, aAllowedActions, aFormats, aResultAction))
+#define IGuest_DragHGLeave(p, aScreenId) ((p)->lpVtbl->DragHGLeave(p, aScreenId))
+#define IGuest_DragHGDrop(p, aScreenId, aX, aY, aDefaultAction, aAllowedActions, aFormats, aFormat, aResultAction) ((p)->lpVtbl->DragHGDrop(p, aScreenId, aX, aY, aDefaultAction, aAllowedActions, aFormats, aFormat, aResultAction))
+#define IGuest_DragHGPutData(p, aScreenId, aFormat, aData, aProgress) ((p)->lpVtbl->DragHGPutData(p, aScreenId, aFormat, aData, aProgress))
+#define IGuest_DragGHPending(p, aScreenId, aFormats, aAllowedActions, aDefaultAction) ((p)->lpVtbl->DragGHPending(p, aScreenId, aFormats, aAllowedActions, aDefaultAction))
+#define IGuest_DragGHDropped(p, aFormat, aAction, aProgress) ((p)->lpVtbl->DragGHDropped(p, aFormat, aAction, aProgress))
+#define IGuest_DragGHGetData(p, aData) ((p)->lpVtbl->DragGHGetData(p, aData))
+#define IGuest_CreateSession(p, aUser, aPassword, aDomain, aSessionName, aGuestSession) ((p)->lpVtbl->CreateSession(p, aUser, aPassword, aDomain, aSessionName, aGuestSession))
+#define IGuest_FindSession(p, aSessionName, aSessions) ((p)->lpVtbl->FindSession(p, aSessionName, aSessions))
+#define IGuest_UpdateGuestAdditions(p, aSource, aArguments, aFlags, aProgress) ((p)->lpVtbl->UpdateGuestAdditions(p, aSource, aArguments, aFlags, aProgress))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuest
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuest_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuest declaration */
+
+
+/* Start of struct IProgress declaration */
+#define IPROGRESS_IID_STR "c20238e4-3221-4d3f-8891-81ce92d9f913"
+#define IPROGRESS_IID { \
+    0xc20238e4, 0x3221, 0x4d3f, \
+    { 0x88, 0x91, 0x81, 0xce, 0x92, 0xd9, 0xf9, 0x13 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IProgress);
+#ifndef VBOX_WITH_GLUE
+struct IProgress_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(IProgress *pThis, PRUnichar * *id);
+
+    nsresult (*GetDescription)(IProgress *pThis, PRUnichar * *description);
+
+    nsresult (*GetInitiator)(IProgress *pThis, nsISupports * *initiator);
+
+    nsresult (*GetCancelable)(IProgress *pThis, PRBool *cancelable);
+
+    nsresult (*GetPercent)(IProgress *pThis, PRUint32 *percent);
+
+    nsresult (*GetTimeRemaining)(IProgress *pThis, PRInt32 *timeRemaining);
+
+    nsresult (*GetCompleted)(IProgress *pThis, PRBool *completed);
+
+    nsresult (*GetCanceled)(IProgress *pThis, PRBool *canceled);
+
+    nsresult (*GetResultCode)(IProgress *pThis, PRInt32 *resultCode);
+
+    nsresult (*GetErrorInfo)(IProgress *pThis, IVirtualBoxErrorInfo * *errorInfo);
+
+    nsresult (*GetOperationCount)(IProgress *pThis, PRUint32 *operationCount);
+
+    nsresult (*GetOperation)(IProgress *pThis, PRUint32 *operation);
+
+    nsresult (*GetOperationDescription)(IProgress *pThis, PRUnichar * *operationDescription);
+
+    nsresult (*GetOperationPercent)(IProgress *pThis, PRUint32 *operationPercent);
+
+    nsresult (*GetOperationWeight)(IProgress *pThis, PRUint32 *operationWeight);
+
+    nsresult (*GetTimeout)(IProgress *pThis, PRUint32 *timeout);
+    nsresult (*SetTimeout)(IProgress *pThis, PRUint32 timeout);
+
+    nsresult (*SetCurrentOperationProgress)(
+        IProgress *pThis,
+        PRUint32 percent
+    );
+
+    nsresult (*SetNextOperation)(
+        IProgress *pThis,
+        PRUnichar * nextOperationDescription,
+        PRUint32 nextOperationsWeight
+    );
+
+    nsresult (*WaitForCompletion)(
+        IProgress *pThis,
+        PRInt32 timeout
+    );
+
+    nsresult (*WaitForOperationCompletion)(
+        IProgress *pThis,
+        PRUint32 operation,
+        PRInt32 timeout
+    );
+
+    nsresult (*WaitForAsyncProgressCompletion)(
+        IProgress *pThis,
+        IProgress * pProgressAsync
+    );
+
+    nsresult (*Cancel)(IProgress *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IProgressVtbl
+{
+    nsresult (*QueryInterface)(IProgress *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IProgress *pThis);
+    nsrefcnt (*Release)(IProgress *pThis);
+    nsresult (*GetId)(IProgress *pThis, PRUnichar * *id);
+
+    nsresult (*GetDescription)(IProgress *pThis, PRUnichar * *description);
+
+    nsresult (*GetInitiator)(IProgress *pThis, nsISupports * *initiator);
+
+    nsresult (*GetCancelable)(IProgress *pThis, PRBool *cancelable);
+
+    nsresult (*GetPercent)(IProgress *pThis, PRUint32 *percent);
+
+    nsresult (*GetTimeRemaining)(IProgress *pThis, PRInt32 *timeRemaining);
+
+    nsresult (*GetCompleted)(IProgress *pThis, PRBool *completed);
+
+    nsresult (*GetCanceled)(IProgress *pThis, PRBool *canceled);
+
+    nsresult (*GetResultCode)(IProgress *pThis, PRInt32 *resultCode);
+
+    nsresult (*GetErrorInfo)(IProgress *pThis, IVirtualBoxErrorInfo * *errorInfo);
+
+    nsresult (*GetOperationCount)(IProgress *pThis, PRUint32 *operationCount);
+
+    nsresult (*GetOperation)(IProgress *pThis, PRUint32 *operation);
+
+    nsresult (*GetOperationDescription)(IProgress *pThis, PRUnichar * *operationDescription);
+
+    nsresult (*GetOperationPercent)(IProgress *pThis, PRUint32 *operationPercent);
+
+    nsresult (*GetOperationWeight)(IProgress *pThis, PRUint32 *operationWeight);
+
+    nsresult (*GetTimeout)(IProgress *pThis, PRUint32 *timeout);
+    nsresult (*SetTimeout)(IProgress *pThis, PRUint32 timeout);
+
+    nsresult (*SetCurrentOperationProgress)(
+        IProgress *pThis,
+        PRUint32 percent
+    );
+
+    nsresult (*SetNextOperation)(
+        IProgress *pThis,
+        PRUnichar * nextOperationDescription,
+        PRUint32 nextOperationsWeight
+    );
+
+    nsresult (*WaitForCompletion)(
+        IProgress *pThis,
+        PRInt32 timeout
+    );
+
+    nsresult (*WaitForOperationCompletion)(
+        IProgress *pThis,
+        PRUint32 operation,
+        PRInt32 timeout
+    );
+
+    nsresult (*WaitForAsyncProgressCompletion)(
+        IProgress *pThis,
+        IProgress * pProgressAsync
+    );
+
+    nsresult (*Cancel)(IProgress *pThis );
+
+};
+#define IProgress_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IProgress_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IProgress_Release(p) ((p)->lpVtbl->Release(p))
+#define IProgress_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IProgress_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IProgress_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IProgress_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IProgress_get_Initiator(p, aInitiator) ((p)->lpVtbl->GetInitiator(p, aInitiator))
+#define IProgress_GetInitiator(p, aInitiator) ((p)->lpVtbl->GetInitiator(p, aInitiator))
+#define IProgress_get_Cancelable(p, aCancelable) ((p)->lpVtbl->GetCancelable(p, aCancelable))
+#define IProgress_GetCancelable(p, aCancelable) ((p)->lpVtbl->GetCancelable(p, aCancelable))
+#define IProgress_get_Percent(p, aPercent) ((p)->lpVtbl->GetPercent(p, aPercent))
+#define IProgress_GetPercent(p, aPercent) ((p)->lpVtbl->GetPercent(p, aPercent))
+#define IProgress_get_TimeRemaining(p, aTimeRemaining) ((p)->lpVtbl->GetTimeRemaining(p, aTimeRemaining))
+#define IProgress_GetTimeRemaining(p, aTimeRemaining) ((p)->lpVtbl->GetTimeRemaining(p, aTimeRemaining))
+#define IProgress_get_Completed(p, aCompleted) ((p)->lpVtbl->GetCompleted(p, aCompleted))
+#define IProgress_GetCompleted(p, aCompleted) ((p)->lpVtbl->GetCompleted(p, aCompleted))
+#define IProgress_get_Canceled(p, aCanceled) ((p)->lpVtbl->GetCanceled(p, aCanceled))
+#define IProgress_GetCanceled(p, aCanceled) ((p)->lpVtbl->GetCanceled(p, aCanceled))
+#define IProgress_get_ResultCode(p, aResultCode) ((p)->lpVtbl->GetResultCode(p, aResultCode))
+#define IProgress_GetResultCode(p, aResultCode) ((p)->lpVtbl->GetResultCode(p, aResultCode))
+#define IProgress_get_ErrorInfo(p, aErrorInfo) ((p)->lpVtbl->GetErrorInfo(p, aErrorInfo))
+#define IProgress_GetErrorInfo(p, aErrorInfo) ((p)->lpVtbl->GetErrorInfo(p, aErrorInfo))
+#define IProgress_get_OperationCount(p, aOperationCount) ((p)->lpVtbl->GetOperationCount(p, aOperationCount))
+#define IProgress_GetOperationCount(p, aOperationCount) ((p)->lpVtbl->GetOperationCount(p, aOperationCount))
+#define IProgress_get_Operation(p, aOperation) ((p)->lpVtbl->GetOperation(p, aOperation))
+#define IProgress_GetOperation(p, aOperation) ((p)->lpVtbl->GetOperation(p, aOperation))
+#define IProgress_get_OperationDescription(p, aOperationDescription) ((p)->lpVtbl->GetOperationDescription(p, aOperationDescription))
+#define IProgress_GetOperationDescription(p, aOperationDescription) ((p)->lpVtbl->GetOperationDescription(p, aOperationDescription))
+#define IProgress_get_OperationPercent(p, aOperationPercent) ((p)->lpVtbl->GetOperationPercent(p, aOperationPercent))
+#define IProgress_GetOperationPercent(p, aOperationPercent) ((p)->lpVtbl->GetOperationPercent(p, aOperationPercent))
+#define IProgress_get_OperationWeight(p, aOperationWeight) ((p)->lpVtbl->GetOperationWeight(p, aOperationWeight))
+#define IProgress_GetOperationWeight(p, aOperationWeight) ((p)->lpVtbl->GetOperationWeight(p, aOperationWeight))
+#define IProgress_get_Timeout(p, aTimeout) ((p)->lpVtbl->GetTimeout(p, aTimeout))
+#define IProgress_GetTimeout(p, aTimeout) ((p)->lpVtbl->GetTimeout(p, aTimeout))
+#define IProgress_put_Timeout(p, aTimeout) ((p)->lpVtbl->SetTimeout(p, aTimeout))
+#define IProgress_SetTimeout(p, aTimeout) ((p)->lpVtbl->SetTimeout(p, aTimeout))
+#define IProgress_SetCurrentOperationProgress(p, aPercent) ((p)->lpVtbl->SetCurrentOperationProgress(p, aPercent))
+#define IProgress_SetNextOperation(p, aNextOperationDescription, aNextOperationsWeight) ((p)->lpVtbl->SetNextOperation(p, aNextOperationDescription, aNextOperationsWeight))
+#define IProgress_WaitForCompletion(p, aTimeout) ((p)->lpVtbl->WaitForCompletion(p, aTimeout))
+#define IProgress_WaitForOperationCompletion(p, aOperation, aTimeout) ((p)->lpVtbl->WaitForOperationCompletion(p, aOperation, aTimeout))
+#define IProgress_WaitForAsyncProgressCompletion(p, aPProgressAsync) ((p)->lpVtbl->WaitForAsyncProgressCompletion(p, aPProgressAsync))
+#define IProgress_Cancel(p) ((p)->lpVtbl->Cancel(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface IProgress
+{
+#ifndef VBOX_WITH_GLUE
+    struct IProgress_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IProgressVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IProgress declaration */
+
+
+/* Start of struct ISnapshot declaration */
+#define ISNAPSHOT_IID_STR "0472823b-c6e7-472a-8e9f-d732e86b8463"
+#define ISNAPSHOT_IID { \
+    0x0472823b, 0xc6e7, 0x472a, \
+    { 0x8e, 0x9f, 0xd7, 0x32, 0xe8, 0x6b, 0x84, 0x63 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISnapshot);
+#ifndef VBOX_WITH_GLUE
+struct ISnapshot_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(ISnapshot *pThis, PRUnichar * *id);
+
+    nsresult (*GetName)(ISnapshot *pThis, PRUnichar * *name);
+    nsresult (*SetName)(ISnapshot *pThis, PRUnichar * name);
+
+    nsresult (*GetDescription)(ISnapshot *pThis, PRUnichar * *description);
+    nsresult (*SetDescription)(ISnapshot *pThis, PRUnichar * description);
+
+    nsresult (*GetTimeStamp)(ISnapshot *pThis, PRInt64 *timeStamp);
+
+    nsresult (*GetOnline)(ISnapshot *pThis, PRBool *online);
+
+    nsresult (*GetMachine)(ISnapshot *pThis, IMachine * *machine);
+
+    nsresult (*GetParent)(ISnapshot *pThis, ISnapshot * *parent);
+
+    nsresult (*GetChildren)(ISnapshot *pThis, PRUint32 *childrenSize, ISnapshot * **children);
+
+    nsresult (*GetChildrenCount)(
+        ISnapshot *pThis,
+        PRUint32 * childrenCount
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISnapshotVtbl
+{
+    nsresult (*QueryInterface)(ISnapshot *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISnapshot *pThis);
+    nsrefcnt (*Release)(ISnapshot *pThis);
+    nsresult (*GetId)(ISnapshot *pThis, PRUnichar * *id);
+
+    nsresult (*GetName)(ISnapshot *pThis, PRUnichar * *name);
+    nsresult (*SetName)(ISnapshot *pThis, PRUnichar * name);
+
+    nsresult (*GetDescription)(ISnapshot *pThis, PRUnichar * *description);
+    nsresult (*SetDescription)(ISnapshot *pThis, PRUnichar * description);
+
+    nsresult (*GetTimeStamp)(ISnapshot *pThis, PRInt64 *timeStamp);
+
+    nsresult (*GetOnline)(ISnapshot *pThis, PRBool *online);
+
+    nsresult (*GetMachine)(ISnapshot *pThis, IMachine * *machine);
+
+    nsresult (*GetParent)(ISnapshot *pThis, ISnapshot * *parent);
+
+    nsresult (*GetChildren)(ISnapshot *pThis, PRUint32 *childrenSize, ISnapshot * **children);
+
+    nsresult (*GetChildrenCount)(
+        ISnapshot *pThis,
+        PRUint32 * childrenCount
+    );
+
+};
+#define ISnapshot_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISnapshot_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISnapshot_Release(p) ((p)->lpVtbl->Release(p))
+#define ISnapshot_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define ISnapshot_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define ISnapshot_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define ISnapshot_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define ISnapshot_put_Name(p, aName) ((p)->lpVtbl->SetName(p, aName))
+#define ISnapshot_SetName(p, aName) ((p)->lpVtbl->SetName(p, aName))
+#define ISnapshot_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define ISnapshot_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define ISnapshot_put_Description(p, aDescription) ((p)->lpVtbl->SetDescription(p, aDescription))
+#define ISnapshot_SetDescription(p, aDescription) ((p)->lpVtbl->SetDescription(p, aDescription))
+#define ISnapshot_get_TimeStamp(p, aTimeStamp) ((p)->lpVtbl->GetTimeStamp(p, aTimeStamp))
+#define ISnapshot_GetTimeStamp(p, aTimeStamp) ((p)->lpVtbl->GetTimeStamp(p, aTimeStamp))
+#define ISnapshot_get_Online(p, aOnline) ((p)->lpVtbl->GetOnline(p, aOnline))
+#define ISnapshot_GetOnline(p, aOnline) ((p)->lpVtbl->GetOnline(p, aOnline))
+#define ISnapshot_get_Machine(p, aMachine) ((p)->lpVtbl->GetMachine(p, aMachine))
+#define ISnapshot_GetMachine(p, aMachine) ((p)->lpVtbl->GetMachine(p, aMachine))
+#define ISnapshot_get_Parent(p, aParent) ((p)->lpVtbl->GetParent(p, aParent))
+#define ISnapshot_GetParent(p, aParent) ((p)->lpVtbl->GetParent(p, aParent))
+#define ISnapshot_get_Children(p, aChildren) ((p)->lpVtbl->GetChildren(p, aChildren))
+#define ISnapshot_GetChildren(p, aChildren) ((p)->lpVtbl->GetChildren(p, aChildren))
+#define ISnapshot_GetChildrenCount(p, aChildrenCount) ((p)->lpVtbl->GetChildrenCount(p, aChildrenCount))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISnapshot
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISnapshot_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISnapshotVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISnapshot declaration */
+
+
+/* Start of struct IMediumAttachment declaration */
+#define IMEDIUMATTACHMENT_IID_STR "4b252567-5d4e-4db8-b3c8-569ec1c9236c"
+#define IMEDIUMATTACHMENT_IID { \
+    0x4b252567, 0x5d4e, 0x4db8, \
+    { 0xb3, 0xc8, 0x56, 0x9e, 0xc1, 0xc9, 0x23, 0x6c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMediumAttachment);
+#ifndef VBOX_WITH_GLUE
+struct IMediumAttachment_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMedium)(IMediumAttachment *pThis, IMedium * *medium);
+
+    nsresult (*GetController)(IMediumAttachment *pThis, PRUnichar * *controller);
+
+    nsresult (*GetPort)(IMediumAttachment *pThis, PRInt32 *port);
+
+    nsresult (*GetDevice)(IMediumAttachment *pThis, PRInt32 *device);
+
+    nsresult (*GetType)(IMediumAttachment *pThis, PRUint32 *type);
+
+    nsresult (*GetPassthrough)(IMediumAttachment *pThis, PRBool *passthrough);
+
+    nsresult (*GetTemporaryEject)(IMediumAttachment *pThis, PRBool *temporaryEject);
+
+    nsresult (*GetIsEjected)(IMediumAttachment *pThis, PRBool *isEjected);
+
+    nsresult (*GetNonRotational)(IMediumAttachment *pThis, PRBool *nonRotational);
+
+    nsresult (*GetDiscard)(IMediumAttachment *pThis, PRBool *discard);
+
+    nsresult (*GetHotPluggable)(IMediumAttachment *pThis, PRBool *hotPluggable);
+
+    nsresult (*GetBandwidthGroup)(IMediumAttachment *pThis, IBandwidthGroup * *bandwidthGroup);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMediumAttachmentVtbl
+{
+    nsresult (*QueryInterface)(IMediumAttachment *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMediumAttachment *pThis);
+    nsrefcnt (*Release)(IMediumAttachment *pThis);
+    nsresult (*GetMedium)(IMediumAttachment *pThis, IMedium * *medium);
+
+    nsresult (*GetController)(IMediumAttachment *pThis, PRUnichar * *controller);
+
+    nsresult (*GetPort)(IMediumAttachment *pThis, PRInt32 *port);
+
+    nsresult (*GetDevice)(IMediumAttachment *pThis, PRInt32 *device);
+
+    nsresult (*GetType)(IMediumAttachment *pThis, PRUint32 *type);
+
+    nsresult (*GetPassthrough)(IMediumAttachment *pThis, PRBool *passthrough);
+
+    nsresult (*GetTemporaryEject)(IMediumAttachment *pThis, PRBool *temporaryEject);
+
+    nsresult (*GetIsEjected)(IMediumAttachment *pThis, PRBool *isEjected);
+
+    nsresult (*GetNonRotational)(IMediumAttachment *pThis, PRBool *nonRotational);
+
+    nsresult (*GetDiscard)(IMediumAttachment *pThis, PRBool *discard);
+
+    nsresult (*GetHotPluggable)(IMediumAttachment *pThis, PRBool *hotPluggable);
+
+    nsresult (*GetBandwidthGroup)(IMediumAttachment *pThis, IBandwidthGroup * *bandwidthGroup);
+
+};
+#define IMediumAttachment_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMediumAttachment_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMediumAttachment_Release(p) ((p)->lpVtbl->Release(p))
+#define IMediumAttachment_get_Medium(p, aMedium) ((p)->lpVtbl->GetMedium(p, aMedium))
+#define IMediumAttachment_GetMedium(p, aMedium) ((p)->lpVtbl->GetMedium(p, aMedium))
+#define IMediumAttachment_get_Controller(p, aController) ((p)->lpVtbl->GetController(p, aController))
+#define IMediumAttachment_GetController(p, aController) ((p)->lpVtbl->GetController(p, aController))
+#define IMediumAttachment_get_Port(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IMediumAttachment_GetPort(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IMediumAttachment_get_Device(p, aDevice) ((p)->lpVtbl->GetDevice(p, aDevice))
+#define IMediumAttachment_GetDevice(p, aDevice) ((p)->lpVtbl->GetDevice(p, aDevice))
+#define IMediumAttachment_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMediumAttachment_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMediumAttachment_get_Passthrough(p, aPassthrough) ((p)->lpVtbl->GetPassthrough(p, aPassthrough))
+#define IMediumAttachment_GetPassthrough(p, aPassthrough) ((p)->lpVtbl->GetPassthrough(p, aPassthrough))
+#define IMediumAttachment_get_TemporaryEject(p, aTemporaryEject) ((p)->lpVtbl->GetTemporaryEject(p, aTemporaryEject))
+#define IMediumAttachment_GetTemporaryEject(p, aTemporaryEject) ((p)->lpVtbl->GetTemporaryEject(p, aTemporaryEject))
+#define IMediumAttachment_get_IsEjected(p, aIsEjected) ((p)->lpVtbl->GetIsEjected(p, aIsEjected))
+#define IMediumAttachment_GetIsEjected(p, aIsEjected) ((p)->lpVtbl->GetIsEjected(p, aIsEjected))
+#define IMediumAttachment_get_NonRotational(p, aNonRotational) ((p)->lpVtbl->GetNonRotational(p, aNonRotational))
+#define IMediumAttachment_GetNonRotational(p, aNonRotational) ((p)->lpVtbl->GetNonRotational(p, aNonRotational))
+#define IMediumAttachment_get_Discard(p, aDiscard) ((p)->lpVtbl->GetDiscard(p, aDiscard))
+#define IMediumAttachment_GetDiscard(p, aDiscard) ((p)->lpVtbl->GetDiscard(p, aDiscard))
+#define IMediumAttachment_get_HotPluggable(p, aHotPluggable) ((p)->lpVtbl->GetHotPluggable(p, aHotPluggable))
+#define IMediumAttachment_GetHotPluggable(p, aHotPluggable) ((p)->lpVtbl->GetHotPluggable(p, aHotPluggable))
+#define IMediumAttachment_get_BandwidthGroup(p, aBandwidthGroup) ((p)->lpVtbl->GetBandwidthGroup(p, aBandwidthGroup))
+#define IMediumAttachment_GetBandwidthGroup(p, aBandwidthGroup) ((p)->lpVtbl->GetBandwidthGroup(p, aBandwidthGroup))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMediumAttachment
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMediumAttachment_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMediumAttachmentVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMediumAttachment declaration */
+
+
+/* Start of struct IMedium declaration */
+#define IMEDIUM_IID_STR "05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac"
+#define IMEDIUM_IID { \
+    0x05f2bbb6, 0xa3a6, 0x4fb9, \
+    { 0x9b, 0x49, 0x6d, 0x0d, 0xda, 0x71, 0x42, 0xac } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMedium);
+#ifndef VBOX_WITH_GLUE
+struct IMedium_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(IMedium *pThis, PRUnichar * *id);
+
+    nsresult (*GetDescription)(IMedium *pThis, PRUnichar * *description);
+    nsresult (*SetDescription)(IMedium *pThis, PRUnichar * description);
+
+    nsresult (*GetState)(IMedium *pThis, PRUint32 *state);
+
+    nsresult (*GetVariant)(IMedium *pThis, PRUint32 *variantSize, PRUint32 **variant);
+
+    nsresult (*GetLocation)(IMedium *pThis, PRUnichar * *location);
+
+    nsresult (*GetName)(IMedium *pThis, PRUnichar * *name);
+
+    nsresult (*GetDeviceType)(IMedium *pThis, PRUint32 *deviceType);
+
+    nsresult (*GetHostDrive)(IMedium *pThis, PRBool *hostDrive);
+
+    nsresult (*GetSize)(IMedium *pThis, PRInt64 *size);
+
+    nsresult (*GetFormat)(IMedium *pThis, PRUnichar * *format);
+
+    nsresult (*GetMediumFormat)(IMedium *pThis, IMediumFormat * *mediumFormat);
+
+    nsresult (*GetType)(IMedium *pThis, PRUint32 *type);
+    nsresult (*SetType)(IMedium *pThis, PRUint32 type);
+
+    nsresult (*GetAllowedTypes)(IMedium *pThis, PRUint32 *allowedTypesSize, PRUint32 **allowedTypes);
+
+    nsresult (*GetParent)(IMedium *pThis, IMedium * *parent);
+
+    nsresult (*GetChildren)(IMedium *pThis, PRUint32 *childrenSize, IMedium * **children);
+
+    nsresult (*GetBase)(IMedium *pThis, IMedium * *base);
+
+    nsresult (*GetReadOnly)(IMedium *pThis, PRBool *readOnly);
+
+    nsresult (*GetLogicalSize)(IMedium *pThis, PRInt64 *logicalSize);
+
+    nsresult (*GetAutoReset)(IMedium *pThis, PRBool *autoReset);
+    nsresult (*SetAutoReset)(IMedium *pThis, PRBool autoReset);
+
+    nsresult (*GetLastAccessError)(IMedium *pThis, PRUnichar * *lastAccessError);
+
+    nsresult (*GetMachineIds)(IMedium *pThis, PRUint32 *machineIdsSize, PRUnichar * **machineIds);
+
+    nsresult (*SetIds)(
+        IMedium *pThis,
+        PRBool setImageId,
+        PRUnichar * imageId,
+        PRBool setParentId,
+        PRUnichar * parentId
+    );
+
+    nsresult (*RefreshState)(
+        IMedium *pThis,
+        PRUint32 * state
+    );
+
+    nsresult (*GetSnapshotIds)(
+        IMedium *pThis,
+        PRUnichar * machineId,
+        PRUint32 *snapshotIdsSize,
+        PRUnichar *** snapshotIds
+    );
+
+    nsresult (*LockRead)(
+        IMedium *pThis,
+        IToken * * token
+    );
+
+    nsresult (*LockWrite)(
+        IMedium *pThis,
+        IToken * * token
+    );
+
+    nsresult (*Close)(IMedium *pThis );
+
+    nsresult (*GetProperty)(
+        IMedium *pThis,
+        PRUnichar * name,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetProperty)(
+        IMedium *pThis,
+        PRUnichar * name,
+        PRUnichar * value
+    );
+
+    nsresult (*GetProperties)(
+        IMedium *pThis,
+        PRUnichar * names,
+        PRUint32 *returnNamesSize,
+        PRUnichar *** returnNames,
+        PRUint32 *returnValuesSize,
+        PRUnichar *** returnValues
+    );
+
+    nsresult (*SetProperties)(
+        IMedium *pThis,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        PRUint32 valuesSize,
+        PRUnichar ** values
+    );
+
+    nsresult (*CreateBaseStorage)(
+        IMedium *pThis,
+        PRInt64 logicalSize,
+        PRUint32 variantSize,
+        PRUint32* variant,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteStorage)(
+        IMedium *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*CreateDiffStorage)(
+        IMedium *pThis,
+        IMedium * target,
+        PRUint32 variantSize,
+        PRUint32* variant,
+        IProgress * * progress
+    );
+
+    nsresult (*MergeTo)(
+        IMedium *pThis,
+        IMedium * target,
+        IProgress * * progress
+    );
+
+    nsresult (*CloneTo)(
+        IMedium *pThis,
+        IMedium * target,
+        PRUint32 variantSize,
+        PRUint32* variant,
+        IMedium * parent,
+        IProgress * * progress
+    );
+
+    nsresult (*CloneToBase)(
+        IMedium *pThis,
+        IMedium * target,
+        PRUint32 variantSize,
+        PRUint32* variant,
+        IProgress * * progress
+    );
+
+    nsresult (*SetLocation)(
+        IMedium *pThis,
+        PRUnichar * location,
+        IProgress * * progress
+    );
+
+    nsresult (*Compact)(
+        IMedium *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*Resize)(
+        IMedium *pThis,
+        PRInt64 logicalSize,
+        IProgress * * progress
+    );
+
+    nsresult (*Reset)(
+        IMedium *pThis,
+        IProgress * * progress
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMediumVtbl
+{
+    nsresult (*QueryInterface)(IMedium *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMedium *pThis);
+    nsrefcnt (*Release)(IMedium *pThis);
+    nsresult (*GetId)(IMedium *pThis, PRUnichar * *id);
+
+    nsresult (*GetDescription)(IMedium *pThis, PRUnichar * *description);
+    nsresult (*SetDescription)(IMedium *pThis, PRUnichar * description);
+
+    nsresult (*GetState)(IMedium *pThis, PRUint32 *state);
+
+    nsresult (*GetVariant)(IMedium *pThis, PRUint32 *variantSize, PRUint32 **variant);
+
+    nsresult (*GetLocation)(IMedium *pThis, PRUnichar * *location);
+
+    nsresult (*GetName)(IMedium *pThis, PRUnichar * *name);
+
+    nsresult (*GetDeviceType)(IMedium *pThis, PRUint32 *deviceType);
+
+    nsresult (*GetHostDrive)(IMedium *pThis, PRBool *hostDrive);
+
+    nsresult (*GetSize)(IMedium *pThis, PRInt64 *size);
+
+    nsresult (*GetFormat)(IMedium *pThis, PRUnichar * *format);
+
+    nsresult (*GetMediumFormat)(IMedium *pThis, IMediumFormat * *mediumFormat);
+
+    nsresult (*GetType)(IMedium *pThis, PRUint32 *type);
+    nsresult (*SetType)(IMedium *pThis, PRUint32 type);
+
+    nsresult (*GetAllowedTypes)(IMedium *pThis, PRUint32 *allowedTypesSize, PRUint32 **allowedTypes);
+
+    nsresult (*GetParent)(IMedium *pThis, IMedium * *parent);
+
+    nsresult (*GetChildren)(IMedium *pThis, PRUint32 *childrenSize, IMedium * **children);
+
+    nsresult (*GetBase)(IMedium *pThis, IMedium * *base);
+
+    nsresult (*GetReadOnly)(IMedium *pThis, PRBool *readOnly);
+
+    nsresult (*GetLogicalSize)(IMedium *pThis, PRInt64 *logicalSize);
+
+    nsresult (*GetAutoReset)(IMedium *pThis, PRBool *autoReset);
+    nsresult (*SetAutoReset)(IMedium *pThis, PRBool autoReset);
+
+    nsresult (*GetLastAccessError)(IMedium *pThis, PRUnichar * *lastAccessError);
+
+    nsresult (*GetMachineIds)(IMedium *pThis, PRUint32 *machineIdsSize, PRUnichar * **machineIds);
+
+    nsresult (*SetIds)(
+        IMedium *pThis,
+        PRBool setImageId,
+        PRUnichar * imageId,
+        PRBool setParentId,
+        PRUnichar * parentId
+    );
+
+    nsresult (*RefreshState)(
+        IMedium *pThis,
+        PRUint32 * state
+    );
+
+    nsresult (*GetSnapshotIds)(
+        IMedium *pThis,
+        PRUnichar * machineId,
+        PRUint32 *snapshotIdsSize,
+        PRUnichar *** snapshotIds
+    );
+
+    nsresult (*LockRead)(
+        IMedium *pThis,
+        IToken * * token
+    );
+
+    nsresult (*LockWrite)(
+        IMedium *pThis,
+        IToken * * token
+    );
+
+    nsresult (*Close)(IMedium *pThis );
+
+    nsresult (*GetProperty)(
+        IMedium *pThis,
+        PRUnichar * name,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetProperty)(
+        IMedium *pThis,
+        PRUnichar * name,
+        PRUnichar * value
+    );
+
+    nsresult (*GetProperties)(
+        IMedium *pThis,
+        PRUnichar * names,
+        PRUint32 *returnNamesSize,
+        PRUnichar *** returnNames,
+        PRUint32 *returnValuesSize,
+        PRUnichar *** returnValues
+    );
+
+    nsresult (*SetProperties)(
+        IMedium *pThis,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        PRUint32 valuesSize,
+        PRUnichar ** values
+    );
+
+    nsresult (*CreateBaseStorage)(
+        IMedium *pThis,
+        PRInt64 logicalSize,
+        PRUint32 variantSize,
+        PRUint32* variant,
+        IProgress * * progress
+    );
+
+    nsresult (*DeleteStorage)(
+        IMedium *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*CreateDiffStorage)(
+        IMedium *pThis,
+        IMedium * target,
+        PRUint32 variantSize,
+        PRUint32* variant,
+        IProgress * * progress
+    );
+
+    nsresult (*MergeTo)(
+        IMedium *pThis,
+        IMedium * target,
+        IProgress * * progress
+    );
+
+    nsresult (*CloneTo)(
+        IMedium *pThis,
+        IMedium * target,
+        PRUint32 variantSize,
+        PRUint32* variant,
+        IMedium * parent,
+        IProgress * * progress
+    );
+
+    nsresult (*CloneToBase)(
+        IMedium *pThis,
+        IMedium * target,
+        PRUint32 variantSize,
+        PRUint32* variant,
+        IProgress * * progress
+    );
+
+    nsresult (*SetLocation)(
+        IMedium *pThis,
+        PRUnichar * location,
+        IProgress * * progress
+    );
+
+    nsresult (*Compact)(
+        IMedium *pThis,
+        IProgress * * progress
+    );
+
+    nsresult (*Resize)(
+        IMedium *pThis,
+        PRInt64 logicalSize,
+        IProgress * * progress
+    );
+
+    nsresult (*Reset)(
+        IMedium *pThis,
+        IProgress * * progress
+    );
+
+};
+#define IMedium_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMedium_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMedium_Release(p) ((p)->lpVtbl->Release(p))
+#define IMedium_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IMedium_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IMedium_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IMedium_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IMedium_put_Description(p, aDescription) ((p)->lpVtbl->SetDescription(p, aDescription))
+#define IMedium_SetDescription(p, aDescription) ((p)->lpVtbl->SetDescription(p, aDescription))
+#define IMedium_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IMedium_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IMedium_get_Variant(p, aVariant) ((p)->lpVtbl->GetVariant(p, aVariant))
+#define IMedium_GetVariant(p, aVariant) ((p)->lpVtbl->GetVariant(p, aVariant))
+#define IMedium_get_Location(p, aLocation) ((p)->lpVtbl->GetLocation(p, aLocation))
+#define IMedium_GetLocation(p, aLocation) ((p)->lpVtbl->GetLocation(p, aLocation))
+#define IMedium_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IMedium_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IMedium_get_DeviceType(p, aDeviceType) ((p)->lpVtbl->GetDeviceType(p, aDeviceType))
+#define IMedium_GetDeviceType(p, aDeviceType) ((p)->lpVtbl->GetDeviceType(p, aDeviceType))
+#define IMedium_get_HostDrive(p, aHostDrive) ((p)->lpVtbl->GetHostDrive(p, aHostDrive))
+#define IMedium_GetHostDrive(p, aHostDrive) ((p)->lpVtbl->GetHostDrive(p, aHostDrive))
+#define IMedium_get_Size(p, aSize) ((p)->lpVtbl->GetSize(p, aSize))
+#define IMedium_GetSize(p, aSize) ((p)->lpVtbl->GetSize(p, aSize))
+#define IMedium_get_Format(p, aFormat) ((p)->lpVtbl->GetFormat(p, aFormat))
+#define IMedium_GetFormat(p, aFormat) ((p)->lpVtbl->GetFormat(p, aFormat))
+#define IMedium_get_MediumFormat(p, aMediumFormat) ((p)->lpVtbl->GetMediumFormat(p, aMediumFormat))
+#define IMedium_GetMediumFormat(p, aMediumFormat) ((p)->lpVtbl->GetMediumFormat(p, aMediumFormat))
+#define IMedium_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMedium_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMedium_put_Type(p, aType) ((p)->lpVtbl->SetType(p, aType))
+#define IMedium_SetType(p, aType) ((p)->lpVtbl->SetType(p, aType))
+#define IMedium_get_AllowedTypes(p, aAllowedTypes) ((p)->lpVtbl->GetAllowedTypes(p, aAllowedTypes))
+#define IMedium_GetAllowedTypes(p, aAllowedTypes) ((p)->lpVtbl->GetAllowedTypes(p, aAllowedTypes))
+#define IMedium_get_Parent(p, aParent) ((p)->lpVtbl->GetParent(p, aParent))
+#define IMedium_GetParent(p, aParent) ((p)->lpVtbl->GetParent(p, aParent))
+#define IMedium_get_Children(p, aChildren) ((p)->lpVtbl->GetChildren(p, aChildren))
+#define IMedium_GetChildren(p, aChildren) ((p)->lpVtbl->GetChildren(p, aChildren))
+#define IMedium_get_Base(p, aBase) ((p)->lpVtbl->GetBase(p, aBase))
+#define IMedium_GetBase(p, aBase) ((p)->lpVtbl->GetBase(p, aBase))
+#define IMedium_get_ReadOnly(p, aReadOnly) ((p)->lpVtbl->GetReadOnly(p, aReadOnly))
+#define IMedium_GetReadOnly(p, aReadOnly) ((p)->lpVtbl->GetReadOnly(p, aReadOnly))
+#define IMedium_get_LogicalSize(p, aLogicalSize) ((p)->lpVtbl->GetLogicalSize(p, aLogicalSize))
+#define IMedium_GetLogicalSize(p, aLogicalSize) ((p)->lpVtbl->GetLogicalSize(p, aLogicalSize))
+#define IMedium_get_AutoReset(p, aAutoReset) ((p)->lpVtbl->GetAutoReset(p, aAutoReset))
+#define IMedium_GetAutoReset(p, aAutoReset) ((p)->lpVtbl->GetAutoReset(p, aAutoReset))
+#define IMedium_put_AutoReset(p, aAutoReset) ((p)->lpVtbl->SetAutoReset(p, aAutoReset))
+#define IMedium_SetAutoReset(p, aAutoReset) ((p)->lpVtbl->SetAutoReset(p, aAutoReset))
+#define IMedium_get_LastAccessError(p, aLastAccessError) ((p)->lpVtbl->GetLastAccessError(p, aLastAccessError))
+#define IMedium_GetLastAccessError(p, aLastAccessError) ((p)->lpVtbl->GetLastAccessError(p, aLastAccessError))
+#define IMedium_get_MachineIds(p, aMachineIds) ((p)->lpVtbl->GetMachineIds(p, aMachineIds))
+#define IMedium_GetMachineIds(p, aMachineIds) ((p)->lpVtbl->GetMachineIds(p, aMachineIds))
+#define IMedium_SetIds(p, aSetImageId, aImageId, aSetParentId, aParentId) ((p)->lpVtbl->SetIds(p, aSetImageId, aImageId, aSetParentId, aParentId))
+#define IMedium_RefreshState(p, aState) ((p)->lpVtbl->RefreshState(p, aState))
+#define IMedium_GetSnapshotIds(p, aMachineId, aSnapshotIds) ((p)->lpVtbl->GetSnapshotIds(p, aMachineId, aSnapshotIds))
+#define IMedium_LockRead(p, aToken) ((p)->lpVtbl->LockRead(p, aToken))
+#define IMedium_LockWrite(p, aToken) ((p)->lpVtbl->LockWrite(p, aToken))
+#define IMedium_Close(p) ((p)->lpVtbl->Close(p))
+#define IMedium_GetProperty(p, aName, aValue) ((p)->lpVtbl->GetProperty(p, aName, aValue))
+#define IMedium_SetProperty(p, aName, aValue) ((p)->lpVtbl->SetProperty(p, aName, aValue))
+#define IMedium_GetProperties(p, aNames, aReturnNames, aReturnValues) ((p)->lpVtbl->GetProperties(p, aNames, aReturnNames, aReturnValues))
+#define IMedium_SetProperties(p, aNames, aValues) ((p)->lpVtbl->SetProperties(p, aNames, aValues))
+#define IMedium_CreateBaseStorage(p, aLogicalSize, aVariant, aProgress) ((p)->lpVtbl->CreateBaseStorage(p, aLogicalSize, aVariant, aProgress))
+#define IMedium_DeleteStorage(p, aProgress) ((p)->lpVtbl->DeleteStorage(p, aProgress))
+#define IMedium_CreateDiffStorage(p, aTarget, aVariant, aProgress) ((p)->lpVtbl->CreateDiffStorage(p, aTarget, aVariant, aProgress))
+#define IMedium_MergeTo(p, aTarget, aProgress) ((p)->lpVtbl->MergeTo(p, aTarget, aProgress))
+#define IMedium_CloneTo(p, aTarget, aVariant, aParent, aProgress) ((p)->lpVtbl->CloneTo(p, aTarget, aVariant, aParent, aProgress))
+#define IMedium_CloneToBase(p, aTarget, aVariant, aProgress) ((p)->lpVtbl->CloneToBase(p, aTarget, aVariant, aProgress))
+#define IMedium_SetLocation(p, aLocation, aProgress) ((p)->lpVtbl->SetLocation(p, aLocation, aProgress))
+#define IMedium_Compact(p, aProgress) ((p)->lpVtbl->Compact(p, aProgress))
+#define IMedium_Resize(p, aLogicalSize, aProgress) ((p)->lpVtbl->Resize(p, aLogicalSize, aProgress))
+#define IMedium_Reset(p, aProgress) ((p)->lpVtbl->Reset(p, aProgress))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMedium
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMedium_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMediumVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMedium declaration */
+
+
+/* Start of struct IMediumFormat declaration */
+#define IMEDIUMFORMAT_IID_STR "6238e1cf-a17d-4ec1-8172-418bfb22b93a"
+#define IMEDIUMFORMAT_IID { \
+    0x6238e1cf, 0xa17d, 0x4ec1, \
+    { 0x81, 0x72, 0x41, 0x8b, 0xfb, 0x22, 0xb9, 0x3a } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMediumFormat);
+#ifndef VBOX_WITH_GLUE
+struct IMediumFormat_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(IMediumFormat *pThis, PRUnichar * *id);
+
+    nsresult (*GetName)(IMediumFormat *pThis, PRUnichar * *name);
+
+    nsresult (*GetCapabilities)(IMediumFormat *pThis, PRUint32 *capabilitiesSize, PRUint32 **capabilities);
+
+    nsresult (*DescribeFileExtensions)(
+        IMediumFormat *pThis,
+        PRUint32 *extensionsSize,
+        PRUnichar *** extensions,
+        PRUint32 *typesSize,
+        PRUint32** types
+    );
+
+    nsresult (*DescribeProperties)(
+        IMediumFormat *pThis,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *descriptionsSize,
+        PRUnichar *** descriptions,
+        PRUint32 *typesSize,
+        PRUint32** types,
+        PRUint32 *flagsSize,
+        PRUint32** flags,
+        PRUint32 *defaultsSize,
+        PRUnichar *** defaults
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMediumFormatVtbl
+{
+    nsresult (*QueryInterface)(IMediumFormat *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMediumFormat *pThis);
+    nsrefcnt (*Release)(IMediumFormat *pThis);
+    nsresult (*GetId)(IMediumFormat *pThis, PRUnichar * *id);
+
+    nsresult (*GetName)(IMediumFormat *pThis, PRUnichar * *name);
+
+    nsresult (*GetCapabilities)(IMediumFormat *pThis, PRUint32 *capabilitiesSize, PRUint32 **capabilities);
+
+    nsresult (*DescribeFileExtensions)(
+        IMediumFormat *pThis,
+        PRUint32 *extensionsSize,
+        PRUnichar *** extensions,
+        PRUint32 *typesSize,
+        PRUint32** types
+    );
+
+    nsresult (*DescribeProperties)(
+        IMediumFormat *pThis,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *descriptionsSize,
+        PRUnichar *** descriptions,
+        PRUint32 *typesSize,
+        PRUint32** types,
+        PRUint32 *flagsSize,
+        PRUint32** flags,
+        PRUint32 *defaultsSize,
+        PRUnichar *** defaults
+    );
+
+};
+#define IMediumFormat_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMediumFormat_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMediumFormat_Release(p) ((p)->lpVtbl->Release(p))
+#define IMediumFormat_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IMediumFormat_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IMediumFormat_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IMediumFormat_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IMediumFormat_get_Capabilities(p, aCapabilities) ((p)->lpVtbl->GetCapabilities(p, aCapabilities))
+#define IMediumFormat_GetCapabilities(p, aCapabilities) ((p)->lpVtbl->GetCapabilities(p, aCapabilities))
+#define IMediumFormat_DescribeFileExtensions(p, aExtensions, aTypes) ((p)->lpVtbl->DescribeFileExtensions(p, aExtensions, aTypes))
+#define IMediumFormat_DescribeProperties(p, aNames, aDescriptions, aTypes, aFlags, aDefaults) ((p)->lpVtbl->DescribeProperties(p, aNames, aDescriptions, aTypes, aFlags, aDefaults))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMediumFormat
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMediumFormat_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMediumFormatVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMediumFormat declaration */
+
+
+/* Start of struct IToken declaration */
+#define ITOKEN_IID_STR "3b1c4797-e289-4d4c-b74c-50c9b86a36f8"
+#define ITOKEN_IID { \
+    0x3b1c4797, 0xe289, 0x4d4c, \
+    { 0xb7, 0x4c, 0x50, 0xc9, 0xb8, 0x6a, 0x36, 0xf8 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IToken);
+#ifndef VBOX_WITH_GLUE
+struct IToken_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*Abandon)(IToken *pThis );
+
+    nsresult (*Dummy)(IToken *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ITokenVtbl
+{
+    nsresult (*QueryInterface)(IToken *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IToken *pThis);
+    nsrefcnt (*Release)(IToken *pThis);
+    nsresult (*Abandon)(IToken *pThis );
+
+    nsresult (*Dummy)(IToken *pThis );
+
+};
+#define IToken_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IToken_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IToken_Release(p) ((p)->lpVtbl->Release(p))
+#define IToken_Abandon(p) ((p)->lpVtbl->Abandon(p))
+#define IToken_Dummy(p) ((p)->lpVtbl->Dummy(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface IToken
+{
+#ifndef VBOX_WITH_GLUE
+    struct IToken_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ITokenVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IToken declaration */
+
+
+/* Start of struct IKeyboard declaration */
+#define IKEYBOARD_IID_STR "f6916ec5-a881-4237-898f-7de58cf88672"
+#define IKEYBOARD_IID { \
+    0xf6916ec5, 0xa881, 0x4237, \
+    { 0x89, 0x8f, 0x7d, 0xe5, 0x8c, 0xf8, 0x86, 0x72 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IKeyboard);
+#ifndef VBOX_WITH_GLUE
+struct IKeyboard_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEventSource)(IKeyboard *pThis, IEventSource * *eventSource);
+
+    nsresult (*PutScancode)(
+        IKeyboard *pThis,
+        PRInt32 scancode
+    );
+
+    nsresult (*PutScancodes)(
+        IKeyboard *pThis,
+        PRUint32 scancodesSize,
+        PRInt32* scancodes,
+        PRUint32 * codesStored
+    );
+
+    nsresult (*PutCAD)(IKeyboard *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IKeyboardVtbl
+{
+    nsresult (*QueryInterface)(IKeyboard *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IKeyboard *pThis);
+    nsrefcnt (*Release)(IKeyboard *pThis);
+    nsresult (*GetEventSource)(IKeyboard *pThis, IEventSource * *eventSource);
+
+    nsresult (*PutScancode)(
+        IKeyboard *pThis,
+        PRInt32 scancode
+    );
+
+    nsresult (*PutScancodes)(
+        IKeyboard *pThis,
+        PRUint32 scancodesSize,
+        PRInt32* scancodes,
+        PRUint32 * codesStored
+    );
+
+    nsresult (*PutCAD)(IKeyboard *pThis );
+
+};
+#define IKeyboard_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IKeyboard_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IKeyboard_Release(p) ((p)->lpVtbl->Release(p))
+#define IKeyboard_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IKeyboard_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IKeyboard_PutScancode(p, aScancode) ((p)->lpVtbl->PutScancode(p, aScancode))
+#define IKeyboard_PutScancodes(p, aScancodes, aCodesStored) ((p)->lpVtbl->PutScancodes(p, aScancodes, aCodesStored))
+#define IKeyboard_PutCAD(p) ((p)->lpVtbl->PutCAD(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface IKeyboard
+{
+#ifndef VBOX_WITH_GLUE
+    struct IKeyboard_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IKeyboardVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IKeyboard declaration */
+
+
+/* Start of struct IMouse declaration */
+#define IMOUSE_IID_STR "ee770393-415f-4421-b2d5-28b73cacf86a"
+#define IMOUSE_IID { \
+    0xee770393, 0x415f, 0x4421, \
+    { 0xb2, 0xd5, 0x28, 0xb7, 0x3c, 0xac, 0xf8, 0x6a } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMouse);
+#ifndef VBOX_WITH_GLUE
+struct IMouse_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetAbsoluteSupported)(IMouse *pThis, PRBool *absoluteSupported);
+
+    nsresult (*GetRelativeSupported)(IMouse *pThis, PRBool *relativeSupported);
+
+    nsresult (*GetMultiTouchSupported)(IMouse *pThis, PRBool *multiTouchSupported);
+
+    nsresult (*GetNeedsHostCursor)(IMouse *pThis, PRBool *needsHostCursor);
+
+    nsresult (*GetEventSource)(IMouse *pThis, IEventSource * *eventSource);
+
+    nsresult (*PutMouseEvent)(
+        IMouse *pThis,
+        PRInt32 dx,
+        PRInt32 dy,
+        PRInt32 dz,
+        PRInt32 dw,
+        PRInt32 buttonState
+    );
+
+    nsresult (*PutMouseEventAbsolute)(
+        IMouse *pThis,
+        PRInt32 x,
+        PRInt32 y,
+        PRInt32 dz,
+        PRInt32 dw,
+        PRInt32 buttonState
+    );
+
+    nsresult (*PutEventMultiTouch)(
+        IMouse *pThis,
+        PRInt32 count,
+        PRUint32 contactsSize,
+        PRInt64* contacts,
+        PRUint32 scanTime
+    );
+
+    nsresult (*PutEventMultiTouchString)(
+        IMouse *pThis,
+        PRInt32 count,
+        PRUnichar * contacts,
+        PRUint32 scanTime
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMouseVtbl
+{
+    nsresult (*QueryInterface)(IMouse *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMouse *pThis);
+    nsrefcnt (*Release)(IMouse *pThis);
+    nsresult (*GetAbsoluteSupported)(IMouse *pThis, PRBool *absoluteSupported);
+
+    nsresult (*GetRelativeSupported)(IMouse *pThis, PRBool *relativeSupported);
+
+    nsresult (*GetMultiTouchSupported)(IMouse *pThis, PRBool *multiTouchSupported);
+
+    nsresult (*GetNeedsHostCursor)(IMouse *pThis, PRBool *needsHostCursor);
+
+    nsresult (*GetEventSource)(IMouse *pThis, IEventSource * *eventSource);
+
+    nsresult (*PutMouseEvent)(
+        IMouse *pThis,
+        PRInt32 dx,
+        PRInt32 dy,
+        PRInt32 dz,
+        PRInt32 dw,
+        PRInt32 buttonState
+    );
+
+    nsresult (*PutMouseEventAbsolute)(
+        IMouse *pThis,
+        PRInt32 x,
+        PRInt32 y,
+        PRInt32 dz,
+        PRInt32 dw,
+        PRInt32 buttonState
+    );
+
+    nsresult (*PutEventMultiTouch)(
+        IMouse *pThis,
+        PRInt32 count,
+        PRUint32 contactsSize,
+        PRInt64* contacts,
+        PRUint32 scanTime
+    );
+
+    nsresult (*PutEventMultiTouchString)(
+        IMouse *pThis,
+        PRInt32 count,
+        PRUnichar * contacts,
+        PRUint32 scanTime
+    );
+
+};
+#define IMouse_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMouse_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMouse_Release(p) ((p)->lpVtbl->Release(p))
+#define IMouse_get_AbsoluteSupported(p, aAbsoluteSupported) ((p)->lpVtbl->GetAbsoluteSupported(p, aAbsoluteSupported))
+#define IMouse_GetAbsoluteSupported(p, aAbsoluteSupported) ((p)->lpVtbl->GetAbsoluteSupported(p, aAbsoluteSupported))
+#define IMouse_get_RelativeSupported(p, aRelativeSupported) ((p)->lpVtbl->GetRelativeSupported(p, aRelativeSupported))
+#define IMouse_GetRelativeSupported(p, aRelativeSupported) ((p)->lpVtbl->GetRelativeSupported(p, aRelativeSupported))
+#define IMouse_get_MultiTouchSupported(p, aMultiTouchSupported) ((p)->lpVtbl->GetMultiTouchSupported(p, aMultiTouchSupported))
+#define IMouse_GetMultiTouchSupported(p, aMultiTouchSupported) ((p)->lpVtbl->GetMultiTouchSupported(p, aMultiTouchSupported))
+#define IMouse_get_NeedsHostCursor(p, aNeedsHostCursor) ((p)->lpVtbl->GetNeedsHostCursor(p, aNeedsHostCursor))
+#define IMouse_GetNeedsHostCursor(p, aNeedsHostCursor) ((p)->lpVtbl->GetNeedsHostCursor(p, aNeedsHostCursor))
+#define IMouse_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IMouse_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IMouse_PutMouseEvent(p, aDx, aDy, aDz, aDw, aButtonState) ((p)->lpVtbl->PutMouseEvent(p, aDx, aDy, aDz, aDw, aButtonState))
+#define IMouse_PutMouseEventAbsolute(p, aX, aY, aDz, aDw, aButtonState) ((p)->lpVtbl->PutMouseEventAbsolute(p, aX, aY, aDz, aDw, aButtonState))
+#define IMouse_PutEventMultiTouch(p, aCount, aContacts, aScanTime) ((p)->lpVtbl->PutEventMultiTouch(p, aCount, aContacts, aScanTime))
+#define IMouse_PutEventMultiTouchString(p, aCount, aContacts, aScanTime) ((p)->lpVtbl->PutEventMultiTouchString(p, aCount, aContacts, aScanTime))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMouse
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMouse_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMouseVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMouse declaration */
+
+
+/* Start of struct IFramebuffer declaration */
+#define IFRAMEBUFFER_IID_STR "e3f122c0-adab-4fc9-a8dc-da112fb48428"
+#define IFRAMEBUFFER_IID { \
+    0xe3f122c0, 0xadab, 0x4fc9, \
+    { 0xa8, 0xdc, 0xda, 0x11, 0x2f, 0xb4, 0x84, 0x28 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IFramebuffer);
+#ifndef VBOX_WITH_GLUE
+struct IFramebuffer_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetAddress)(IFramebuffer *pThis, PRUint8 * *address);
+
+    nsresult (*GetWidth)(IFramebuffer *pThis, PRUint32 *width);
+
+    nsresult (*GetHeight)(IFramebuffer *pThis, PRUint32 *height);
+
+    nsresult (*GetBitsPerPixel)(IFramebuffer *pThis, PRUint32 *bitsPerPixel);
+
+    nsresult (*GetBytesPerLine)(IFramebuffer *pThis, PRUint32 *bytesPerLine);
+
+    nsresult (*GetPixelFormat)(IFramebuffer *pThis, PRUint32 *pixelFormat);
+
+    nsresult (*GetUsesGuestVRAM)(IFramebuffer *pThis, PRBool *usesGuestVRAM);
+
+    nsresult (*GetHeightReduction)(IFramebuffer *pThis, PRUint32 *heightReduction);
+
+    nsresult (*GetOverlay)(IFramebuffer *pThis, IFramebufferOverlay * *overlay);
+
+    nsresult (*GetWinId)(IFramebuffer *pThis, PRInt64 *winId);
+
+    nsresult (*Lock)(IFramebuffer *pThis );
+
+    nsresult (*Unlock)(IFramebuffer *pThis );
+
+    nsresult (*NotifyUpdate)(
+        IFramebuffer *pThis,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*RequestResize)(
+        IFramebuffer *pThis,
+        PRUint32 screenId,
+        PRUint32 pixelFormat,
+        PRUint8 * VRAM,
+        PRUint32 bitsPerPixel,
+        PRUint32 bytesPerLine,
+        PRUint32 width,
+        PRUint32 height,
+        PRBool * finished
+    );
+
+    nsresult (*VideoModeSupported)(
+        IFramebuffer *pThis,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 bpp,
+        PRBool * supported
+    );
+
+    nsresult (*GetVisibleRegion)(
+        IFramebuffer *pThis,
+        PRUint8 * rectangles,
+        PRUint32 count,
+        PRUint32 * countCopied
+    );
+
+    nsresult (*SetVisibleRegion)(
+        IFramebuffer *pThis,
+        PRUint8 * rectangles,
+        PRUint32 count
+    );
+
+    nsresult (*ProcessVHWACommand)(
+        IFramebuffer *pThis,
+        PRUint8 * command
+    );
+
+    nsresult (*Notify3DEvent)(
+        IFramebuffer *pThis,
+        PRUint32 type,
+        PRUint8 * data
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IFramebufferVtbl
+{
+    nsresult (*QueryInterface)(IFramebuffer *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IFramebuffer *pThis);
+    nsrefcnt (*Release)(IFramebuffer *pThis);
+    nsresult (*GetAddress)(IFramebuffer *pThis, PRUint8 * *address);
+
+    nsresult (*GetWidth)(IFramebuffer *pThis, PRUint32 *width);
+
+    nsresult (*GetHeight)(IFramebuffer *pThis, PRUint32 *height);
+
+    nsresult (*GetBitsPerPixel)(IFramebuffer *pThis, PRUint32 *bitsPerPixel);
+
+    nsresult (*GetBytesPerLine)(IFramebuffer *pThis, PRUint32 *bytesPerLine);
+
+    nsresult (*GetPixelFormat)(IFramebuffer *pThis, PRUint32 *pixelFormat);
+
+    nsresult (*GetUsesGuestVRAM)(IFramebuffer *pThis, PRBool *usesGuestVRAM);
+
+    nsresult (*GetHeightReduction)(IFramebuffer *pThis, PRUint32 *heightReduction);
+
+    nsresult (*GetOverlay)(IFramebuffer *pThis, IFramebufferOverlay * *overlay);
+
+    nsresult (*GetWinId)(IFramebuffer *pThis, PRInt64 *winId);
+
+    nsresult (*Lock)(IFramebuffer *pThis );
+
+    nsresult (*Unlock)(IFramebuffer *pThis );
+
+    nsresult (*NotifyUpdate)(
+        IFramebuffer *pThis,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*RequestResize)(
+        IFramebuffer *pThis,
+        PRUint32 screenId,
+        PRUint32 pixelFormat,
+        PRUint8 * VRAM,
+        PRUint32 bitsPerPixel,
+        PRUint32 bytesPerLine,
+        PRUint32 width,
+        PRUint32 height,
+        PRBool * finished
+    );
+
+    nsresult (*VideoModeSupported)(
+        IFramebuffer *pThis,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 bpp,
+        PRBool * supported
+    );
+
+    nsresult (*GetVisibleRegion)(
+        IFramebuffer *pThis,
+        PRUint8 * rectangles,
+        PRUint32 count,
+        PRUint32 * countCopied
+    );
+
+    nsresult (*SetVisibleRegion)(
+        IFramebuffer *pThis,
+        PRUint8 * rectangles,
+        PRUint32 count
+    );
+
+    nsresult (*ProcessVHWACommand)(
+        IFramebuffer *pThis,
+        PRUint8 * command
+    );
+
+    nsresult (*Notify3DEvent)(
+        IFramebuffer *pThis,
+        PRUint32 type,
+        PRUint8 * data
+    );
+
+};
+#define IFramebuffer_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IFramebuffer_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IFramebuffer_Release(p) ((p)->lpVtbl->Release(p))
+#define IFramebuffer_get_Address(p, aAddress) ((p)->lpVtbl->GetAddress(p, aAddress))
+#define IFramebuffer_GetAddress(p, aAddress) ((p)->lpVtbl->GetAddress(p, aAddress))
+#define IFramebuffer_get_Width(p, aWidth) ((p)->lpVtbl->GetWidth(p, aWidth))
+#define IFramebuffer_GetWidth(p, aWidth) ((p)->lpVtbl->GetWidth(p, aWidth))
+#define IFramebuffer_get_Height(p, aHeight) ((p)->lpVtbl->GetHeight(p, aHeight))
+#define IFramebuffer_GetHeight(p, aHeight) ((p)->lpVtbl->GetHeight(p, aHeight))
+#define IFramebuffer_get_BitsPerPixel(p, aBitsPerPixel) ((p)->lpVtbl->GetBitsPerPixel(p, aBitsPerPixel))
+#define IFramebuffer_GetBitsPerPixel(p, aBitsPerPixel) ((p)->lpVtbl->GetBitsPerPixel(p, aBitsPerPixel))
+#define IFramebuffer_get_BytesPerLine(p, aBytesPerLine) ((p)->lpVtbl->GetBytesPerLine(p, aBytesPerLine))
+#define IFramebuffer_GetBytesPerLine(p, aBytesPerLine) ((p)->lpVtbl->GetBytesPerLine(p, aBytesPerLine))
+#define IFramebuffer_get_PixelFormat(p, aPixelFormat) ((p)->lpVtbl->GetPixelFormat(p, aPixelFormat))
+#define IFramebuffer_GetPixelFormat(p, aPixelFormat) ((p)->lpVtbl->GetPixelFormat(p, aPixelFormat))
+#define IFramebuffer_get_UsesGuestVRAM(p, aUsesGuestVRAM) ((p)->lpVtbl->GetUsesGuestVRAM(p, aUsesGuestVRAM))
+#define IFramebuffer_GetUsesGuestVRAM(p, aUsesGuestVRAM) ((p)->lpVtbl->GetUsesGuestVRAM(p, aUsesGuestVRAM))
+#define IFramebuffer_get_HeightReduction(p, aHeightReduction) ((p)->lpVtbl->GetHeightReduction(p, aHeightReduction))
+#define IFramebuffer_GetHeightReduction(p, aHeightReduction) ((p)->lpVtbl->GetHeightReduction(p, aHeightReduction))
+#define IFramebuffer_get_Overlay(p, aOverlay) ((p)->lpVtbl->GetOverlay(p, aOverlay))
+#define IFramebuffer_GetOverlay(p, aOverlay) ((p)->lpVtbl->GetOverlay(p, aOverlay))
+#define IFramebuffer_get_WinId(p, aWinId) ((p)->lpVtbl->GetWinId(p, aWinId))
+#define IFramebuffer_GetWinId(p, aWinId) ((p)->lpVtbl->GetWinId(p, aWinId))
+#define IFramebuffer_Lock(p) ((p)->lpVtbl->Lock(p))
+#define IFramebuffer_Unlock(p) ((p)->lpVtbl->Unlock(p))
+#define IFramebuffer_NotifyUpdate(p, aX, aY, aWidth, aHeight) ((p)->lpVtbl->NotifyUpdate(p, aX, aY, aWidth, aHeight))
+#define IFramebuffer_RequestResize(p, aScreenId, aPixelFormat, aVRAM, aBitsPerPixel, aBytesPerLine, aWidth, aHeight, aFinished) ((p)->lpVtbl->RequestResize(p, aScreenId, aPixelFormat, aVRAM, aBitsPerPixel, aBytesPerLine, aWidth, aHeight, aFinished))
+#define IFramebuffer_VideoModeSupported(p, aWidth, aHeight, aBpp, aSupported) ((p)->lpVtbl->VideoModeSupported(p, aWidth, aHeight, aBpp, aSupported))
+#define IFramebuffer_GetVisibleRegion(p, aRectangles, aCount, aCountCopied) ((p)->lpVtbl->GetVisibleRegion(p, aRectangles, aCount, aCountCopied))
+#define IFramebuffer_SetVisibleRegion(p, aRectangles, aCount) ((p)->lpVtbl->SetVisibleRegion(p, aRectangles, aCount))
+#define IFramebuffer_ProcessVHWACommand(p, aCommand) ((p)->lpVtbl->ProcessVHWACommand(p, aCommand))
+#define IFramebuffer_Notify3DEvent(p, aType, aData) ((p)->lpVtbl->Notify3DEvent(p, aType, aData))
+#endif /* VBOX_WITH_GLUE */
+
+interface IFramebuffer
+{
+#ifndef VBOX_WITH_GLUE
+    struct IFramebuffer_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IFramebufferVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IFramebuffer declaration */
+
+
+/* Start of struct IFramebufferOverlay declaration */
+#define IFRAMEBUFFEROVERLAY_IID_STR "0bcc1c7e-e415-47d2-bfdb-e4c705fb0f47"
+#define IFRAMEBUFFEROVERLAY_IID { \
+    0x0bcc1c7e, 0xe415, 0x47d2, \
+    { 0xbf, 0xdb, 0xe4, 0xc7, 0x05, 0xfb, 0x0f, 0x47 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IFramebufferOverlay);
+#ifndef VBOX_WITH_GLUE
+struct IFramebufferOverlay_vtbl
+{
+    struct IFramebuffer_vtbl iframebuffer;
+
+    nsresult (*GetX)(IFramebufferOverlay *pThis, PRUint32 *x);
+
+    nsresult (*GetY)(IFramebufferOverlay *pThis, PRUint32 *y);
+
+    nsresult (*GetVisible)(IFramebufferOverlay *pThis, PRBool *visible);
+    nsresult (*SetVisible)(IFramebufferOverlay *pThis, PRBool visible);
+
+    nsresult (*GetAlpha)(IFramebufferOverlay *pThis, PRUint32 *alpha);
+    nsresult (*SetAlpha)(IFramebufferOverlay *pThis, PRUint32 alpha);
+
+    nsresult (*Move)(
+        IFramebufferOverlay *pThis,
+        PRUint32 x,
+        PRUint32 y
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IFramebufferOverlayVtbl
+{
+    nsresult (*QueryInterface)(IFramebufferOverlay *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IFramebufferOverlay *pThis);
+    nsrefcnt (*Release)(IFramebufferOverlay *pThis);
+    nsresult (*GetAddress)(IFramebufferOverlay *pThis, PRUint8 * *address);
+
+    nsresult (*GetWidth)(IFramebufferOverlay *pThis, PRUint32 *width);
+
+    nsresult (*GetHeight)(IFramebufferOverlay *pThis, PRUint32 *height);
+
+    nsresult (*GetBitsPerPixel)(IFramebufferOverlay *pThis, PRUint32 *bitsPerPixel);
+
+    nsresult (*GetBytesPerLine)(IFramebufferOverlay *pThis, PRUint32 *bytesPerLine);
+
+    nsresult (*GetPixelFormat)(IFramebufferOverlay *pThis, PRUint32 *pixelFormat);
+
+    nsresult (*GetUsesGuestVRAM)(IFramebufferOverlay *pThis, PRBool *usesGuestVRAM);
+
+    nsresult (*GetHeightReduction)(IFramebufferOverlay *pThis, PRUint32 *heightReduction);
+
+    nsresult (*GetOverlay)(IFramebufferOverlay *pThis, IFramebufferOverlay * *overlay);
+
+    nsresult (*GetWinId)(IFramebufferOverlay *pThis, PRInt64 *winId);
+
+    nsresult (*Lock)(IFramebufferOverlay *pThis );
+
+    nsresult (*Unlock)(IFramebufferOverlay *pThis );
+
+    nsresult (*NotifyUpdate)(
+        IFramebufferOverlay *pThis,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*RequestResize)(
+        IFramebufferOverlay *pThis,
+        PRUint32 screenId,
+        PRUint32 pixelFormat,
+        PRUint8 * VRAM,
+        PRUint32 bitsPerPixel,
+        PRUint32 bytesPerLine,
+        PRUint32 width,
+        PRUint32 height,
+        PRBool * finished
+    );
+
+    nsresult (*VideoModeSupported)(
+        IFramebufferOverlay *pThis,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 bpp,
+        PRBool * supported
+    );
+
+    nsresult (*GetVisibleRegion)(
+        IFramebufferOverlay *pThis,
+        PRUint8 * rectangles,
+        PRUint32 count,
+        PRUint32 * countCopied
+    );
+
+    nsresult (*SetVisibleRegion)(
+        IFramebufferOverlay *pThis,
+        PRUint8 * rectangles,
+        PRUint32 count
+    );
+
+    nsresult (*ProcessVHWACommand)(
+        IFramebufferOverlay *pThis,
+        PRUint8 * command
+    );
+
+    nsresult (*Notify3DEvent)(
+        IFramebufferOverlay *pThis,
+        PRUint32 type,
+        PRUint8 * data
+    );
+
+    nsresult (*GetX)(IFramebufferOverlay *pThis, PRUint32 *x);
+
+    nsresult (*GetY)(IFramebufferOverlay *pThis, PRUint32 *y);
+
+    nsresult (*GetVisible)(IFramebufferOverlay *pThis, PRBool *visible);
+    nsresult (*SetVisible)(IFramebufferOverlay *pThis, PRBool visible);
+
+    nsresult (*GetAlpha)(IFramebufferOverlay *pThis, PRUint32 *alpha);
+    nsresult (*SetAlpha)(IFramebufferOverlay *pThis, PRUint32 alpha);
+
+    nsresult (*Move)(
+        IFramebufferOverlay *pThis,
+        PRUint32 x,
+        PRUint32 y
+    );
+
+};
+#define IFramebufferOverlay_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IFramebufferOverlay_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IFramebufferOverlay_Release(p) ((p)->lpVtbl->Release(p))
+#define IFramebufferOverlay_get_Address(p, aAddress) ((p)->lpVtbl->GetAddress(p, aAddress))
+#define IFramebufferOverlay_GetAddress(p, aAddress) ((p)->lpVtbl->GetAddress(p, aAddress))
+#define IFramebufferOverlay_get_Width(p, aWidth) ((p)->lpVtbl->GetWidth(p, aWidth))
+#define IFramebufferOverlay_GetWidth(p, aWidth) ((p)->lpVtbl->GetWidth(p, aWidth))
+#define IFramebufferOverlay_get_Height(p, aHeight) ((p)->lpVtbl->GetHeight(p, aHeight))
+#define IFramebufferOverlay_GetHeight(p, aHeight) ((p)->lpVtbl->GetHeight(p, aHeight))
+#define IFramebufferOverlay_get_BitsPerPixel(p, aBitsPerPixel) ((p)->lpVtbl->GetBitsPerPixel(p, aBitsPerPixel))
+#define IFramebufferOverlay_GetBitsPerPixel(p, aBitsPerPixel) ((p)->lpVtbl->GetBitsPerPixel(p, aBitsPerPixel))
+#define IFramebufferOverlay_get_BytesPerLine(p, aBytesPerLine) ((p)->lpVtbl->GetBytesPerLine(p, aBytesPerLine))
+#define IFramebufferOverlay_GetBytesPerLine(p, aBytesPerLine) ((p)->lpVtbl->GetBytesPerLine(p, aBytesPerLine))
+#define IFramebufferOverlay_get_PixelFormat(p, aPixelFormat) ((p)->lpVtbl->GetPixelFormat(p, aPixelFormat))
+#define IFramebufferOverlay_GetPixelFormat(p, aPixelFormat) ((p)->lpVtbl->GetPixelFormat(p, aPixelFormat))
+#define IFramebufferOverlay_get_UsesGuestVRAM(p, aUsesGuestVRAM) ((p)->lpVtbl->GetUsesGuestVRAM(p, aUsesGuestVRAM))
+#define IFramebufferOverlay_GetUsesGuestVRAM(p, aUsesGuestVRAM) ((p)->lpVtbl->GetUsesGuestVRAM(p, aUsesGuestVRAM))
+#define IFramebufferOverlay_get_HeightReduction(p, aHeightReduction) ((p)->lpVtbl->GetHeightReduction(p, aHeightReduction))
+#define IFramebufferOverlay_GetHeightReduction(p, aHeightReduction) ((p)->lpVtbl->GetHeightReduction(p, aHeightReduction))
+#define IFramebufferOverlay_get_Overlay(p, aOverlay) ((p)->lpVtbl->GetOverlay(p, aOverlay))
+#define IFramebufferOverlay_GetOverlay(p, aOverlay) ((p)->lpVtbl->GetOverlay(p, aOverlay))
+#define IFramebufferOverlay_get_WinId(p, aWinId) ((p)->lpVtbl->GetWinId(p, aWinId))
+#define IFramebufferOverlay_GetWinId(p, aWinId) ((p)->lpVtbl->GetWinId(p, aWinId))
+#define IFramebufferOverlay_Lock(p) ((p)->lpVtbl->Lock(p))
+#define IFramebufferOverlay_Unlock(p) ((p)->lpVtbl->Unlock(p))
+#define IFramebufferOverlay_NotifyUpdate(p, aX, aY, aWidth, aHeight) ((p)->lpVtbl->NotifyUpdate(p, aX, aY, aWidth, aHeight))
+#define IFramebufferOverlay_RequestResize(p, aScreenId, aPixelFormat, aVRAM, aBitsPerPixel, aBytesPerLine, aWidth, aHeight, aFinished) ((p)->lpVtbl->RequestResize(p, aScreenId, aPixelFormat, aVRAM, aBitsPerPixel, aBytesPerLine, aWidth, aHeight, aFinished))
+#define IFramebufferOverlay_VideoModeSupported(p, aWidth, aHeight, aBpp, aSupported) ((p)->lpVtbl->VideoModeSupported(p, aWidth, aHeight, aBpp, aSupported))
+#define IFramebufferOverlay_GetVisibleRegion(p, aRectangles, aCount, aCountCopied) ((p)->lpVtbl->GetVisibleRegion(p, aRectangles, aCount, aCountCopied))
+#define IFramebufferOverlay_SetVisibleRegion(p, aRectangles, aCount) ((p)->lpVtbl->SetVisibleRegion(p, aRectangles, aCount))
+#define IFramebufferOverlay_ProcessVHWACommand(p, aCommand) ((p)->lpVtbl->ProcessVHWACommand(p, aCommand))
+#define IFramebufferOverlay_Notify3DEvent(p, aType, aData) ((p)->lpVtbl->Notify3DEvent(p, aType, aData))
+#define IFramebufferOverlay_get_X(p, aX) ((p)->lpVtbl->GetX(p, aX))
+#define IFramebufferOverlay_GetX(p, aX) ((p)->lpVtbl->GetX(p, aX))
+#define IFramebufferOverlay_get_Y(p, aY) ((p)->lpVtbl->GetY(p, aY))
+#define IFramebufferOverlay_GetY(p, aY) ((p)->lpVtbl->GetY(p, aY))
+#define IFramebufferOverlay_get_Visible(p, aVisible) ((p)->lpVtbl->GetVisible(p, aVisible))
+#define IFramebufferOverlay_GetVisible(p, aVisible) ((p)->lpVtbl->GetVisible(p, aVisible))
+#define IFramebufferOverlay_put_Visible(p, aVisible) ((p)->lpVtbl->SetVisible(p, aVisible))
+#define IFramebufferOverlay_SetVisible(p, aVisible) ((p)->lpVtbl->SetVisible(p, aVisible))
+#define IFramebufferOverlay_get_Alpha(p, aAlpha) ((p)->lpVtbl->GetAlpha(p, aAlpha))
+#define IFramebufferOverlay_GetAlpha(p, aAlpha) ((p)->lpVtbl->GetAlpha(p, aAlpha))
+#define IFramebufferOverlay_put_Alpha(p, aAlpha) ((p)->lpVtbl->SetAlpha(p, aAlpha))
+#define IFramebufferOverlay_SetAlpha(p, aAlpha) ((p)->lpVtbl->SetAlpha(p, aAlpha))
+#define IFramebufferOverlay_Move(p, aX, aY) ((p)->lpVtbl->Move(p, aX, aY))
+#endif /* VBOX_WITH_GLUE */
+
+interface IFramebufferOverlay
+{
+#ifndef VBOX_WITH_GLUE
+    struct IFramebufferOverlay_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IFramebufferOverlayVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IFramebufferOverlay declaration */
+
+
+/* Start of struct IDisplay declaration */
+#define IDISPLAY_IID_STR "480b372c-c0b5-4c23-9bd7-dcbb85b1594c"
+#define IDISPLAY_IID { \
+    0x480b372c, 0xc0b5, 0x4c23, \
+    { 0x9b, 0xd7, 0xdc, 0xbb, 0x85, 0xb1, 0x59, 0x4c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IDisplay);
+#ifndef VBOX_WITH_GLUE
+struct IDisplay_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetScreenResolution)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRUint32 * bitsPerPixel,
+        PRInt32 * xOrigin,
+        PRInt32 * yOrigin
+    );
+
+    nsresult (*SetFramebuffer)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        IFramebuffer * framebuffer
+    );
+
+    nsresult (*GetFramebuffer)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        IFramebuffer * * framebuffer,
+        PRInt32 * xOrigin,
+        PRInt32 * yOrigin
+    );
+
+    nsresult (*SetVideoModeHint)(
+        IDisplay *pThis,
+        PRUint32 display,
+        PRBool enabled,
+        PRBool changeOrigin,
+        PRInt32 originX,
+        PRInt32 originY,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 bitsPerPixel
+    );
+
+    nsresult (*SetSeamlessMode)(
+        IDisplay *pThis,
+        PRBool enabled
+    );
+
+    nsresult (*TakeScreenShot)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint8 * address,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*TakeScreenShotToArray)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 *screenDataSize,
+        PRUint8** screenData
+    );
+
+    nsresult (*TakeScreenShotPNGToArray)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 *screenDataSize,
+        PRUint8** screenData
+    );
+
+    nsresult (*DrawToScreen)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint8 * address,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*InvalidateAndUpdate)(IDisplay *pThis );
+
+    nsresult (*ResizeCompleted)(
+        IDisplay *pThis,
+        PRUint32 screenId
+    );
+
+    nsresult (*CompleteVHWACommand)(
+        IDisplay *pThis,
+        PRUint8 * command
+    );
+
+    nsresult (*ViewportChanged)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IDisplayVtbl
+{
+    nsresult (*QueryInterface)(IDisplay *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IDisplay *pThis);
+    nsrefcnt (*Release)(IDisplay *pThis);
+    nsresult (*GetScreenResolution)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint32 * width,
+        PRUint32 * height,
+        PRUint32 * bitsPerPixel,
+        PRInt32 * xOrigin,
+        PRInt32 * yOrigin
+    );
+
+    nsresult (*SetFramebuffer)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        IFramebuffer * framebuffer
+    );
+
+    nsresult (*GetFramebuffer)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        IFramebuffer * * framebuffer,
+        PRInt32 * xOrigin,
+        PRInt32 * yOrigin
+    );
+
+    nsresult (*SetVideoModeHint)(
+        IDisplay *pThis,
+        PRUint32 display,
+        PRBool enabled,
+        PRBool changeOrigin,
+        PRInt32 originX,
+        PRInt32 originY,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 bitsPerPixel
+    );
+
+    nsresult (*SetSeamlessMode)(
+        IDisplay *pThis,
+        PRBool enabled
+    );
+
+    nsresult (*TakeScreenShot)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint8 * address,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*TakeScreenShotToArray)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 *screenDataSize,
+        PRUint8** screenData
+    );
+
+    nsresult (*TakeScreenShotPNGToArray)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint32 width,
+        PRUint32 height,
+        PRUint32 *screenDataSize,
+        PRUint8** screenData
+    );
+
+    nsresult (*DrawToScreen)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint8 * address,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+    nsresult (*InvalidateAndUpdate)(IDisplay *pThis );
+
+    nsresult (*ResizeCompleted)(
+        IDisplay *pThis,
+        PRUint32 screenId
+    );
+
+    nsresult (*CompleteVHWACommand)(
+        IDisplay *pThis,
+        PRUint8 * command
+    );
+
+    nsresult (*ViewportChanged)(
+        IDisplay *pThis,
+        PRUint32 screenId,
+        PRUint32 x,
+        PRUint32 y,
+        PRUint32 width,
+        PRUint32 height
+    );
+
+};
+#define IDisplay_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IDisplay_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IDisplay_Release(p) ((p)->lpVtbl->Release(p))
+#define IDisplay_GetScreenResolution(p, aScreenId, aWidth, aHeight, aBitsPerPixel, aXOrigin, aYOrigin) ((p)->lpVtbl->GetScreenResolution(p, aScreenId, aWidth, aHeight, aBitsPerPixel, aXOrigin, aYOrigin))
+#define IDisplay_SetFramebuffer(p, aScreenId, aFramebuffer) ((p)->lpVtbl->SetFramebuffer(p, aScreenId, aFramebuffer))
+#define IDisplay_GetFramebuffer(p, aScreenId, aFramebuffer, aXOrigin, aYOrigin) ((p)->lpVtbl->GetFramebuffer(p, aScreenId, aFramebuffer, aXOrigin, aYOrigin))
+#define IDisplay_SetVideoModeHint(p, aDisplay, aEnabled, aChangeOrigin, aOriginX, aOriginY, aWidth, aHeight, aBitsPerPixel) ((p)->lpVtbl->SetVideoModeHint(p, aDisplay, aEnabled, aChangeOrigin, aOriginX, aOriginY, aWidth, aHeight, aBitsPerPixel))
+#define IDisplay_SetSeamlessMode(p, aEnabled) ((p)->lpVtbl->SetSeamlessMode(p, aEnabled))
+#define IDisplay_TakeScreenShot(p, aScreenId, aAddress, aWidth, aHeight) ((p)->lpVtbl->TakeScreenShot(p, aScreenId, aAddress, aWidth, aHeight))
+#define IDisplay_TakeScreenShotToArray(p, aScreenId, aWidth, aHeight, aScreenData) ((p)->lpVtbl->TakeScreenShotToArray(p, aScreenId, aWidth, aHeight, aScreenData))
+#define IDisplay_TakeScreenShotPNGToArray(p, aScreenId, aWidth, aHeight, aScreenData) ((p)->lpVtbl->TakeScreenShotPNGToArray(p, aScreenId, aWidth, aHeight, aScreenData))
+#define IDisplay_DrawToScreen(p, aScreenId, aAddress, aX, aY, aWidth, aHeight) ((p)->lpVtbl->DrawToScreen(p, aScreenId, aAddress, aX, aY, aWidth, aHeight))
+#define IDisplay_InvalidateAndUpdate(p) ((p)->lpVtbl->InvalidateAndUpdate(p))
+#define IDisplay_ResizeCompleted(p, aScreenId) ((p)->lpVtbl->ResizeCompleted(p, aScreenId))
+#define IDisplay_CompleteVHWACommand(p, aCommand) ((p)->lpVtbl->CompleteVHWACommand(p, aCommand))
+#define IDisplay_ViewportChanged(p, aScreenId, aX, aY, aWidth, aHeight) ((p)->lpVtbl->ViewportChanged(p, aScreenId, aX, aY, aWidth, aHeight))
+#endif /* VBOX_WITH_GLUE */
+
+interface IDisplay
+{
+#ifndef VBOX_WITH_GLUE
+    struct IDisplay_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IDisplayVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IDisplay declaration */
+
+
+/* Start of struct INetworkAdapter declaration */
+#define INETWORKADAPTER_IID_STR "efa0f965-63c7-4c60-afdf-b1cc9943b9c0"
+#define INETWORKADAPTER_IID { \
+    0xefa0f965, 0x63c7, 0x4c60, \
+    { 0xaf, 0xdf, 0xb1, 0xcc, 0x99, 0x43, 0xb9, 0xc0 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INetworkAdapter);
+#ifndef VBOX_WITH_GLUE
+struct INetworkAdapter_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetAdapterType)(INetworkAdapter *pThis, PRUint32 *adapterType);
+    nsresult (*SetAdapterType)(INetworkAdapter *pThis, PRUint32 adapterType);
+
+    nsresult (*GetSlot)(INetworkAdapter *pThis, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(INetworkAdapter *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(INetworkAdapter *pThis, PRBool enabled);
+
+    nsresult (*GetMACAddress)(INetworkAdapter *pThis, PRUnichar * *MACAddress);
+    nsresult (*SetMACAddress)(INetworkAdapter *pThis, PRUnichar * MACAddress);
+
+    nsresult (*GetAttachmentType)(INetworkAdapter *pThis, PRUint32 *attachmentType);
+    nsresult (*SetAttachmentType)(INetworkAdapter *pThis, PRUint32 attachmentType);
+
+    nsresult (*GetBridgedInterface)(INetworkAdapter *pThis, PRUnichar * *bridgedInterface);
+    nsresult (*SetBridgedInterface)(INetworkAdapter *pThis, PRUnichar * bridgedInterface);
+
+    nsresult (*GetHostOnlyInterface)(INetworkAdapter *pThis, PRUnichar * *hostOnlyInterface);
+    nsresult (*SetHostOnlyInterface)(INetworkAdapter *pThis, PRUnichar * hostOnlyInterface);
+
+    nsresult (*GetInternalNetwork)(INetworkAdapter *pThis, PRUnichar * *internalNetwork);
+    nsresult (*SetInternalNetwork)(INetworkAdapter *pThis, PRUnichar * internalNetwork);
+
+    nsresult (*GetNATNetwork)(INetworkAdapter *pThis, PRUnichar * *NATNetwork);
+    nsresult (*SetNATNetwork)(INetworkAdapter *pThis, PRUnichar * NATNetwork);
+
+    nsresult (*GetGenericDriver)(INetworkAdapter *pThis, PRUnichar * *genericDriver);
+    nsresult (*SetGenericDriver)(INetworkAdapter *pThis, PRUnichar * genericDriver);
+
+    nsresult (*GetCableConnected)(INetworkAdapter *pThis, PRBool *cableConnected);
+    nsresult (*SetCableConnected)(INetworkAdapter *pThis, PRBool cableConnected);
+
+    nsresult (*GetLineSpeed)(INetworkAdapter *pThis, PRUint32 *lineSpeed);
+    nsresult (*SetLineSpeed)(INetworkAdapter *pThis, PRUint32 lineSpeed);
+
+    nsresult (*GetPromiscModePolicy)(INetworkAdapter *pThis, PRUint32 *promiscModePolicy);
+    nsresult (*SetPromiscModePolicy)(INetworkAdapter *pThis, PRUint32 promiscModePolicy);
+
+    nsresult (*GetTraceEnabled)(INetworkAdapter *pThis, PRBool *traceEnabled);
+    nsresult (*SetTraceEnabled)(INetworkAdapter *pThis, PRBool traceEnabled);
+
+    nsresult (*GetTraceFile)(INetworkAdapter *pThis, PRUnichar * *traceFile);
+    nsresult (*SetTraceFile)(INetworkAdapter *pThis, PRUnichar * traceFile);
+
+    nsresult (*GetNATEngine)(INetworkAdapter *pThis, INATEngine * *NATEngine);
+
+    nsresult (*GetBootPriority)(INetworkAdapter *pThis, PRUint32 *bootPriority);
+    nsresult (*SetBootPriority)(INetworkAdapter *pThis, PRUint32 bootPriority);
+
+    nsresult (*GetBandwidthGroup)(INetworkAdapter *pThis, IBandwidthGroup * *bandwidthGroup);
+    nsresult (*SetBandwidthGroup)(INetworkAdapter *pThis, IBandwidthGroup * bandwidthGroup);
+
+    nsresult (*GetProperty)(
+        INetworkAdapter *pThis,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetProperty)(
+        INetworkAdapter *pThis,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*GetProperties)(
+        INetworkAdapter *pThis,
+        PRUnichar * names,
+        PRUint32 *returnNamesSize,
+        PRUnichar *** returnNames,
+        PRUint32 *returnValuesSize,
+        PRUnichar *** returnValues
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INetworkAdapterVtbl
+{
+    nsresult (*QueryInterface)(INetworkAdapter *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INetworkAdapter *pThis);
+    nsrefcnt (*Release)(INetworkAdapter *pThis);
+    nsresult (*GetAdapterType)(INetworkAdapter *pThis, PRUint32 *adapterType);
+    nsresult (*SetAdapterType)(INetworkAdapter *pThis, PRUint32 adapterType);
+
+    nsresult (*GetSlot)(INetworkAdapter *pThis, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(INetworkAdapter *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(INetworkAdapter *pThis, PRBool enabled);
+
+    nsresult (*GetMACAddress)(INetworkAdapter *pThis, PRUnichar * *MACAddress);
+    nsresult (*SetMACAddress)(INetworkAdapter *pThis, PRUnichar * MACAddress);
+
+    nsresult (*GetAttachmentType)(INetworkAdapter *pThis, PRUint32 *attachmentType);
+    nsresult (*SetAttachmentType)(INetworkAdapter *pThis, PRUint32 attachmentType);
+
+    nsresult (*GetBridgedInterface)(INetworkAdapter *pThis, PRUnichar * *bridgedInterface);
+    nsresult (*SetBridgedInterface)(INetworkAdapter *pThis, PRUnichar * bridgedInterface);
+
+    nsresult (*GetHostOnlyInterface)(INetworkAdapter *pThis, PRUnichar * *hostOnlyInterface);
+    nsresult (*SetHostOnlyInterface)(INetworkAdapter *pThis, PRUnichar * hostOnlyInterface);
+
+    nsresult (*GetInternalNetwork)(INetworkAdapter *pThis, PRUnichar * *internalNetwork);
+    nsresult (*SetInternalNetwork)(INetworkAdapter *pThis, PRUnichar * internalNetwork);
+
+    nsresult (*GetNATNetwork)(INetworkAdapter *pThis, PRUnichar * *NATNetwork);
+    nsresult (*SetNATNetwork)(INetworkAdapter *pThis, PRUnichar * NATNetwork);
+
+    nsresult (*GetGenericDriver)(INetworkAdapter *pThis, PRUnichar * *genericDriver);
+    nsresult (*SetGenericDriver)(INetworkAdapter *pThis, PRUnichar * genericDriver);
+
+    nsresult (*GetCableConnected)(INetworkAdapter *pThis, PRBool *cableConnected);
+    nsresult (*SetCableConnected)(INetworkAdapter *pThis, PRBool cableConnected);
+
+    nsresult (*GetLineSpeed)(INetworkAdapter *pThis, PRUint32 *lineSpeed);
+    nsresult (*SetLineSpeed)(INetworkAdapter *pThis, PRUint32 lineSpeed);
+
+    nsresult (*GetPromiscModePolicy)(INetworkAdapter *pThis, PRUint32 *promiscModePolicy);
+    nsresult (*SetPromiscModePolicy)(INetworkAdapter *pThis, PRUint32 promiscModePolicy);
+
+    nsresult (*GetTraceEnabled)(INetworkAdapter *pThis, PRBool *traceEnabled);
+    nsresult (*SetTraceEnabled)(INetworkAdapter *pThis, PRBool traceEnabled);
+
+    nsresult (*GetTraceFile)(INetworkAdapter *pThis, PRUnichar * *traceFile);
+    nsresult (*SetTraceFile)(INetworkAdapter *pThis, PRUnichar * traceFile);
+
+    nsresult (*GetNATEngine)(INetworkAdapter *pThis, INATEngine * *NATEngine);
+
+    nsresult (*GetBootPriority)(INetworkAdapter *pThis, PRUint32 *bootPriority);
+    nsresult (*SetBootPriority)(INetworkAdapter *pThis, PRUint32 bootPriority);
+
+    nsresult (*GetBandwidthGroup)(INetworkAdapter *pThis, IBandwidthGroup * *bandwidthGroup);
+    nsresult (*SetBandwidthGroup)(INetworkAdapter *pThis, IBandwidthGroup * bandwidthGroup);
+
+    nsresult (*GetProperty)(
+        INetworkAdapter *pThis,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+    nsresult (*SetProperty)(
+        INetworkAdapter *pThis,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*GetProperties)(
+        INetworkAdapter *pThis,
+        PRUnichar * names,
+        PRUint32 *returnNamesSize,
+        PRUnichar *** returnNames,
+        PRUint32 *returnValuesSize,
+        PRUnichar *** returnValues
+    );
+
+};
+#define INetworkAdapter_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INetworkAdapter_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INetworkAdapter_Release(p) ((p)->lpVtbl->Release(p))
+#define INetworkAdapter_get_AdapterType(p, aAdapterType) ((p)->lpVtbl->GetAdapterType(p, aAdapterType))
+#define INetworkAdapter_GetAdapterType(p, aAdapterType) ((p)->lpVtbl->GetAdapterType(p, aAdapterType))
+#define INetworkAdapter_put_AdapterType(p, aAdapterType) ((p)->lpVtbl->SetAdapterType(p, aAdapterType))
+#define INetworkAdapter_SetAdapterType(p, aAdapterType) ((p)->lpVtbl->SetAdapterType(p, aAdapterType))
+#define INetworkAdapter_get_Slot(p, aSlot) ((p)->lpVtbl->GetSlot(p, aSlot))
+#define INetworkAdapter_GetSlot(p, aSlot) ((p)->lpVtbl->GetSlot(p, aSlot))
+#define INetworkAdapter_get_Enabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define INetworkAdapter_GetEnabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define INetworkAdapter_put_Enabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define INetworkAdapter_SetEnabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define INetworkAdapter_get_MACAddress(p, aMACAddress) ((p)->lpVtbl->GetMACAddress(p, aMACAddress))
+#define INetworkAdapter_GetMACAddress(p, aMACAddress) ((p)->lpVtbl->GetMACAddress(p, aMACAddress))
+#define INetworkAdapter_put_MACAddress(p, aMACAddress) ((p)->lpVtbl->SetMACAddress(p, aMACAddress))
+#define INetworkAdapter_SetMACAddress(p, aMACAddress) ((p)->lpVtbl->SetMACAddress(p, aMACAddress))
+#define INetworkAdapter_get_AttachmentType(p, aAttachmentType) ((p)->lpVtbl->GetAttachmentType(p, aAttachmentType))
+#define INetworkAdapter_GetAttachmentType(p, aAttachmentType) ((p)->lpVtbl->GetAttachmentType(p, aAttachmentType))
+#define INetworkAdapter_put_AttachmentType(p, aAttachmentType) ((p)->lpVtbl->SetAttachmentType(p, aAttachmentType))
+#define INetworkAdapter_SetAttachmentType(p, aAttachmentType) ((p)->lpVtbl->SetAttachmentType(p, aAttachmentType))
+#define INetworkAdapter_get_BridgedInterface(p, aBridgedInterface) ((p)->lpVtbl->GetBridgedInterface(p, aBridgedInterface))
+#define INetworkAdapter_GetBridgedInterface(p, aBridgedInterface) ((p)->lpVtbl->GetBridgedInterface(p, aBridgedInterface))
+#define INetworkAdapter_put_BridgedInterface(p, aBridgedInterface) ((p)->lpVtbl->SetBridgedInterface(p, aBridgedInterface))
+#define INetworkAdapter_SetBridgedInterface(p, aBridgedInterface) ((p)->lpVtbl->SetBridgedInterface(p, aBridgedInterface))
+#define INetworkAdapter_get_HostOnlyInterface(p, aHostOnlyInterface) ((p)->lpVtbl->GetHostOnlyInterface(p, aHostOnlyInterface))
+#define INetworkAdapter_GetHostOnlyInterface(p, aHostOnlyInterface) ((p)->lpVtbl->GetHostOnlyInterface(p, aHostOnlyInterface))
+#define INetworkAdapter_put_HostOnlyInterface(p, aHostOnlyInterface) ((p)->lpVtbl->SetHostOnlyInterface(p, aHostOnlyInterface))
+#define INetworkAdapter_SetHostOnlyInterface(p, aHostOnlyInterface) ((p)->lpVtbl->SetHostOnlyInterface(p, aHostOnlyInterface))
+#define INetworkAdapter_get_InternalNetwork(p, aInternalNetwork) ((p)->lpVtbl->GetInternalNetwork(p, aInternalNetwork))
+#define INetworkAdapter_GetInternalNetwork(p, aInternalNetwork) ((p)->lpVtbl->GetInternalNetwork(p, aInternalNetwork))
+#define INetworkAdapter_put_InternalNetwork(p, aInternalNetwork) ((p)->lpVtbl->SetInternalNetwork(p, aInternalNetwork))
+#define INetworkAdapter_SetInternalNetwork(p, aInternalNetwork) ((p)->lpVtbl->SetInternalNetwork(p, aInternalNetwork))
+#define INetworkAdapter_get_NATNetwork(p, aNATNetwork) ((p)->lpVtbl->GetNATNetwork(p, aNATNetwork))
+#define INetworkAdapter_GetNATNetwork(p, aNATNetwork) ((p)->lpVtbl->GetNATNetwork(p, aNATNetwork))
+#define INetworkAdapter_put_NATNetwork(p, aNATNetwork) ((p)->lpVtbl->SetNATNetwork(p, aNATNetwork))
+#define INetworkAdapter_SetNATNetwork(p, aNATNetwork) ((p)->lpVtbl->SetNATNetwork(p, aNATNetwork))
+#define INetworkAdapter_get_GenericDriver(p, aGenericDriver) ((p)->lpVtbl->GetGenericDriver(p, aGenericDriver))
+#define INetworkAdapter_GetGenericDriver(p, aGenericDriver) ((p)->lpVtbl->GetGenericDriver(p, aGenericDriver))
+#define INetworkAdapter_put_GenericDriver(p, aGenericDriver) ((p)->lpVtbl->SetGenericDriver(p, aGenericDriver))
+#define INetworkAdapter_SetGenericDriver(p, aGenericDriver) ((p)->lpVtbl->SetGenericDriver(p, aGenericDriver))
+#define INetworkAdapter_get_CableConnected(p, aCableConnected) ((p)->lpVtbl->GetCableConnected(p, aCableConnected))
+#define INetworkAdapter_GetCableConnected(p, aCableConnected) ((p)->lpVtbl->GetCableConnected(p, aCableConnected))
+#define INetworkAdapter_put_CableConnected(p, aCableConnected) ((p)->lpVtbl->SetCableConnected(p, aCableConnected))
+#define INetworkAdapter_SetCableConnected(p, aCableConnected) ((p)->lpVtbl->SetCableConnected(p, aCableConnected))
+#define INetworkAdapter_get_LineSpeed(p, aLineSpeed) ((p)->lpVtbl->GetLineSpeed(p, aLineSpeed))
+#define INetworkAdapter_GetLineSpeed(p, aLineSpeed) ((p)->lpVtbl->GetLineSpeed(p, aLineSpeed))
+#define INetworkAdapter_put_LineSpeed(p, aLineSpeed) ((p)->lpVtbl->SetLineSpeed(p, aLineSpeed))
+#define INetworkAdapter_SetLineSpeed(p, aLineSpeed) ((p)->lpVtbl->SetLineSpeed(p, aLineSpeed))
+#define INetworkAdapter_get_PromiscModePolicy(p, aPromiscModePolicy) ((p)->lpVtbl->GetPromiscModePolicy(p, aPromiscModePolicy))
+#define INetworkAdapter_GetPromiscModePolicy(p, aPromiscModePolicy) ((p)->lpVtbl->GetPromiscModePolicy(p, aPromiscModePolicy))
+#define INetworkAdapter_put_PromiscModePolicy(p, aPromiscModePolicy) ((p)->lpVtbl->SetPromiscModePolicy(p, aPromiscModePolicy))
+#define INetworkAdapter_SetPromiscModePolicy(p, aPromiscModePolicy) ((p)->lpVtbl->SetPromiscModePolicy(p, aPromiscModePolicy))
+#define INetworkAdapter_get_TraceEnabled(p, aTraceEnabled) ((p)->lpVtbl->GetTraceEnabled(p, aTraceEnabled))
+#define INetworkAdapter_GetTraceEnabled(p, aTraceEnabled) ((p)->lpVtbl->GetTraceEnabled(p, aTraceEnabled))
+#define INetworkAdapter_put_TraceEnabled(p, aTraceEnabled) ((p)->lpVtbl->SetTraceEnabled(p, aTraceEnabled))
+#define INetworkAdapter_SetTraceEnabled(p, aTraceEnabled) ((p)->lpVtbl->SetTraceEnabled(p, aTraceEnabled))
+#define INetworkAdapter_get_TraceFile(p, aTraceFile) ((p)->lpVtbl->GetTraceFile(p, aTraceFile))
+#define INetworkAdapter_GetTraceFile(p, aTraceFile) ((p)->lpVtbl->GetTraceFile(p, aTraceFile))
+#define INetworkAdapter_put_TraceFile(p, aTraceFile) ((p)->lpVtbl->SetTraceFile(p, aTraceFile))
+#define INetworkAdapter_SetTraceFile(p, aTraceFile) ((p)->lpVtbl->SetTraceFile(p, aTraceFile))
+#define INetworkAdapter_get_NATEngine(p, aNATEngine) ((p)->lpVtbl->GetNATEngine(p, aNATEngine))
+#define INetworkAdapter_GetNATEngine(p, aNATEngine) ((p)->lpVtbl->GetNATEngine(p, aNATEngine))
+#define INetworkAdapter_get_BootPriority(p, aBootPriority) ((p)->lpVtbl->GetBootPriority(p, aBootPriority))
+#define INetworkAdapter_GetBootPriority(p, aBootPriority) ((p)->lpVtbl->GetBootPriority(p, aBootPriority))
+#define INetworkAdapter_put_BootPriority(p, aBootPriority) ((p)->lpVtbl->SetBootPriority(p, aBootPriority))
+#define INetworkAdapter_SetBootPriority(p, aBootPriority) ((p)->lpVtbl->SetBootPriority(p, aBootPriority))
+#define INetworkAdapter_get_BandwidthGroup(p, aBandwidthGroup) ((p)->lpVtbl->GetBandwidthGroup(p, aBandwidthGroup))
+#define INetworkAdapter_GetBandwidthGroup(p, aBandwidthGroup) ((p)->lpVtbl->GetBandwidthGroup(p, aBandwidthGroup))
+#define INetworkAdapter_put_BandwidthGroup(p, aBandwidthGroup) ((p)->lpVtbl->SetBandwidthGroup(p, aBandwidthGroup))
+#define INetworkAdapter_SetBandwidthGroup(p, aBandwidthGroup) ((p)->lpVtbl->SetBandwidthGroup(p, aBandwidthGroup))
+#define INetworkAdapter_GetProperty(p, aKey, aValue) ((p)->lpVtbl->GetProperty(p, aKey, aValue))
+#define INetworkAdapter_SetProperty(p, aKey, aValue) ((p)->lpVtbl->SetProperty(p, aKey, aValue))
+#define INetworkAdapter_GetProperties(p, aNames, aReturnNames, aReturnValues) ((p)->lpVtbl->GetProperties(p, aNames, aReturnNames, aReturnValues))
+#endif /* VBOX_WITH_GLUE */
+
+interface INetworkAdapter
+{
+#ifndef VBOX_WITH_GLUE
+    struct INetworkAdapter_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INetworkAdapterVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INetworkAdapter declaration */
+
+
+/* Start of struct ISerialPort declaration */
+#define ISERIALPORT_IID_STR "937f6970-5103-4745-b78e-d28dcf1479a8"
+#define ISERIALPORT_IID { \
+    0x937f6970, 0x5103, 0x4745, \
+    { 0xb7, 0x8e, 0xd2, 0x8d, 0xcf, 0x14, 0x79, 0xa8 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISerialPort);
+#ifndef VBOX_WITH_GLUE
+struct ISerialPort_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetSlot)(ISerialPort *pThis, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(ISerialPort *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(ISerialPort *pThis, PRBool enabled);
+
+    nsresult (*GetIOBase)(ISerialPort *pThis, PRUint32 *IOBase);
+    nsresult (*SetIOBase)(ISerialPort *pThis, PRUint32 IOBase);
+
+    nsresult (*GetIRQ)(ISerialPort *pThis, PRUint32 *IRQ);
+    nsresult (*SetIRQ)(ISerialPort *pThis, PRUint32 IRQ);
+
+    nsresult (*GetHostMode)(ISerialPort *pThis, PRUint32 *hostMode);
+    nsresult (*SetHostMode)(ISerialPort *pThis, PRUint32 hostMode);
+
+    nsresult (*GetServer)(ISerialPort *pThis, PRBool *server);
+    nsresult (*SetServer)(ISerialPort *pThis, PRBool server);
+
+    nsresult (*GetPath)(ISerialPort *pThis, PRUnichar * *path);
+    nsresult (*SetPath)(ISerialPort *pThis, PRUnichar * path);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISerialPortVtbl
+{
+    nsresult (*QueryInterface)(ISerialPort *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISerialPort *pThis);
+    nsrefcnt (*Release)(ISerialPort *pThis);
+    nsresult (*GetSlot)(ISerialPort *pThis, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(ISerialPort *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(ISerialPort *pThis, PRBool enabled);
+
+    nsresult (*GetIOBase)(ISerialPort *pThis, PRUint32 *IOBase);
+    nsresult (*SetIOBase)(ISerialPort *pThis, PRUint32 IOBase);
+
+    nsresult (*GetIRQ)(ISerialPort *pThis, PRUint32 *IRQ);
+    nsresult (*SetIRQ)(ISerialPort *pThis, PRUint32 IRQ);
+
+    nsresult (*GetHostMode)(ISerialPort *pThis, PRUint32 *hostMode);
+    nsresult (*SetHostMode)(ISerialPort *pThis, PRUint32 hostMode);
+
+    nsresult (*GetServer)(ISerialPort *pThis, PRBool *server);
+    nsresult (*SetServer)(ISerialPort *pThis, PRBool server);
+
+    nsresult (*GetPath)(ISerialPort *pThis, PRUnichar * *path);
+    nsresult (*SetPath)(ISerialPort *pThis, PRUnichar * path);
+
+};
+#define ISerialPort_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISerialPort_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISerialPort_Release(p) ((p)->lpVtbl->Release(p))
+#define ISerialPort_get_Slot(p, aSlot) ((p)->lpVtbl->GetSlot(p, aSlot))
+#define ISerialPort_GetSlot(p, aSlot) ((p)->lpVtbl->GetSlot(p, aSlot))
+#define ISerialPort_get_Enabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define ISerialPort_GetEnabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define ISerialPort_put_Enabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define ISerialPort_SetEnabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define ISerialPort_get_IOBase(p, aIOBase) ((p)->lpVtbl->GetIOBase(p, aIOBase))
+#define ISerialPort_GetIOBase(p, aIOBase) ((p)->lpVtbl->GetIOBase(p, aIOBase))
+#define ISerialPort_put_IOBase(p, aIOBase) ((p)->lpVtbl->SetIOBase(p, aIOBase))
+#define ISerialPort_SetIOBase(p, aIOBase) ((p)->lpVtbl->SetIOBase(p, aIOBase))
+#define ISerialPort_get_IRQ(p, aIRQ) ((p)->lpVtbl->GetIRQ(p, aIRQ))
+#define ISerialPort_GetIRQ(p, aIRQ) ((p)->lpVtbl->GetIRQ(p, aIRQ))
+#define ISerialPort_put_IRQ(p, aIRQ) ((p)->lpVtbl->SetIRQ(p, aIRQ))
+#define ISerialPort_SetIRQ(p, aIRQ) ((p)->lpVtbl->SetIRQ(p, aIRQ))
+#define ISerialPort_get_HostMode(p, aHostMode) ((p)->lpVtbl->GetHostMode(p, aHostMode))
+#define ISerialPort_GetHostMode(p, aHostMode) ((p)->lpVtbl->GetHostMode(p, aHostMode))
+#define ISerialPort_put_HostMode(p, aHostMode) ((p)->lpVtbl->SetHostMode(p, aHostMode))
+#define ISerialPort_SetHostMode(p, aHostMode) ((p)->lpVtbl->SetHostMode(p, aHostMode))
+#define ISerialPort_get_Server(p, aServer) ((p)->lpVtbl->GetServer(p, aServer))
+#define ISerialPort_GetServer(p, aServer) ((p)->lpVtbl->GetServer(p, aServer))
+#define ISerialPort_put_Server(p, aServer) ((p)->lpVtbl->SetServer(p, aServer))
+#define ISerialPort_SetServer(p, aServer) ((p)->lpVtbl->SetServer(p, aServer))
+#define ISerialPort_get_Path(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define ISerialPort_GetPath(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define ISerialPort_put_Path(p, aPath) ((p)->lpVtbl->SetPath(p, aPath))
+#define ISerialPort_SetPath(p, aPath) ((p)->lpVtbl->SetPath(p, aPath))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISerialPort
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISerialPort_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISerialPortVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISerialPort declaration */
+
+
+/* Start of struct IParallelPort declaration */
+#define IPARALLELPORT_IID_STR "0c925f06-dd10-4b77-8de8-294d738c3214"
+#define IPARALLELPORT_IID { \
+    0x0c925f06, 0xdd10, 0x4b77, \
+    { 0x8d, 0xe8, 0x29, 0x4d, 0x73, 0x8c, 0x32, 0x14 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IParallelPort);
+#ifndef VBOX_WITH_GLUE
+struct IParallelPort_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetSlot)(IParallelPort *pThis, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(IParallelPort *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(IParallelPort *pThis, PRBool enabled);
+
+    nsresult (*GetIOBase)(IParallelPort *pThis, PRUint32 *IOBase);
+    nsresult (*SetIOBase)(IParallelPort *pThis, PRUint32 IOBase);
+
+    nsresult (*GetIRQ)(IParallelPort *pThis, PRUint32 *IRQ);
+    nsresult (*SetIRQ)(IParallelPort *pThis, PRUint32 IRQ);
+
+    nsresult (*GetPath)(IParallelPort *pThis, PRUnichar * *path);
+    nsresult (*SetPath)(IParallelPort *pThis, PRUnichar * path);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IParallelPortVtbl
+{
+    nsresult (*QueryInterface)(IParallelPort *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IParallelPort *pThis);
+    nsrefcnt (*Release)(IParallelPort *pThis);
+    nsresult (*GetSlot)(IParallelPort *pThis, PRUint32 *slot);
+
+    nsresult (*GetEnabled)(IParallelPort *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(IParallelPort *pThis, PRBool enabled);
+
+    nsresult (*GetIOBase)(IParallelPort *pThis, PRUint32 *IOBase);
+    nsresult (*SetIOBase)(IParallelPort *pThis, PRUint32 IOBase);
+
+    nsresult (*GetIRQ)(IParallelPort *pThis, PRUint32 *IRQ);
+    nsresult (*SetIRQ)(IParallelPort *pThis, PRUint32 IRQ);
+
+    nsresult (*GetPath)(IParallelPort *pThis, PRUnichar * *path);
+    nsresult (*SetPath)(IParallelPort *pThis, PRUnichar * path);
+
+};
+#define IParallelPort_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IParallelPort_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IParallelPort_Release(p) ((p)->lpVtbl->Release(p))
+#define IParallelPort_get_Slot(p, aSlot) ((p)->lpVtbl->GetSlot(p, aSlot))
+#define IParallelPort_GetSlot(p, aSlot) ((p)->lpVtbl->GetSlot(p, aSlot))
+#define IParallelPort_get_Enabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define IParallelPort_GetEnabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define IParallelPort_put_Enabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define IParallelPort_SetEnabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define IParallelPort_get_IOBase(p, aIOBase) ((p)->lpVtbl->GetIOBase(p, aIOBase))
+#define IParallelPort_GetIOBase(p, aIOBase) ((p)->lpVtbl->GetIOBase(p, aIOBase))
+#define IParallelPort_put_IOBase(p, aIOBase) ((p)->lpVtbl->SetIOBase(p, aIOBase))
+#define IParallelPort_SetIOBase(p, aIOBase) ((p)->lpVtbl->SetIOBase(p, aIOBase))
+#define IParallelPort_get_IRQ(p, aIRQ) ((p)->lpVtbl->GetIRQ(p, aIRQ))
+#define IParallelPort_GetIRQ(p, aIRQ) ((p)->lpVtbl->GetIRQ(p, aIRQ))
+#define IParallelPort_put_IRQ(p, aIRQ) ((p)->lpVtbl->SetIRQ(p, aIRQ))
+#define IParallelPort_SetIRQ(p, aIRQ) ((p)->lpVtbl->SetIRQ(p, aIRQ))
+#define IParallelPort_get_Path(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define IParallelPort_GetPath(p, aPath) ((p)->lpVtbl->GetPath(p, aPath))
+#define IParallelPort_put_Path(p, aPath) ((p)->lpVtbl->SetPath(p, aPath))
+#define IParallelPort_SetPath(p, aPath) ((p)->lpVtbl->SetPath(p, aPath))
+#endif /* VBOX_WITH_GLUE */
+
+interface IParallelPort
+{
+#ifndef VBOX_WITH_GLUE
+    struct IParallelPort_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IParallelPortVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IParallelPort declaration */
+
+
+/* Start of struct IMachineDebugger declaration */
+#define IMACHINEDEBUGGER_IID_STR "5e4534dc-21b8-4f6b-8a08-eef50e1a0aa1"
+#define IMACHINEDEBUGGER_IID { \
+    0x5e4534dc, 0x21b8, 0x4f6b, \
+    { 0x8a, 0x08, 0xee, 0xf5, 0x0e, 0x1a, 0x0a, 0xa1 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMachineDebugger);
+#ifndef VBOX_WITH_GLUE
+struct IMachineDebugger_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetSingleStep)(IMachineDebugger *pThis, PRBool *singleStep);
+    nsresult (*SetSingleStep)(IMachineDebugger *pThis, PRBool singleStep);
+
+    nsresult (*GetRecompileUser)(IMachineDebugger *pThis, PRBool *recompileUser);
+    nsresult (*SetRecompileUser)(IMachineDebugger *pThis, PRBool recompileUser);
+
+    nsresult (*GetRecompileSupervisor)(IMachineDebugger *pThis, PRBool *recompileSupervisor);
+    nsresult (*SetRecompileSupervisor)(IMachineDebugger *pThis, PRBool recompileSupervisor);
+
+    nsresult (*GetExecuteAllInIEM)(IMachineDebugger *pThis, PRBool *executeAllInIEM);
+    nsresult (*SetExecuteAllInIEM)(IMachineDebugger *pThis, PRBool executeAllInIEM);
+
+    nsresult (*GetPATMEnabled)(IMachineDebugger *pThis, PRBool *PATMEnabled);
+    nsresult (*SetPATMEnabled)(IMachineDebugger *pThis, PRBool PATMEnabled);
+
+    nsresult (*GetCSAMEnabled)(IMachineDebugger *pThis, PRBool *CSAMEnabled);
+    nsresult (*SetCSAMEnabled)(IMachineDebugger *pThis, PRBool CSAMEnabled);
+
+    nsresult (*GetLogEnabled)(IMachineDebugger *pThis, PRBool *logEnabled);
+    nsresult (*SetLogEnabled)(IMachineDebugger *pThis, PRBool logEnabled);
+
+    nsresult (*GetLogDbgFlags)(IMachineDebugger *pThis, PRUnichar * *logDbgFlags);
+
+    nsresult (*GetLogDbgGroups)(IMachineDebugger *pThis, PRUnichar * *logDbgGroups);
+
+    nsresult (*GetLogDbgDestinations)(IMachineDebugger *pThis, PRUnichar * *logDbgDestinations);
+
+    nsresult (*GetLogRelFlags)(IMachineDebugger *pThis, PRUnichar * *logRelFlags);
+
+    nsresult (*GetLogRelGroups)(IMachineDebugger *pThis, PRUnichar * *logRelGroups);
+
+    nsresult (*GetLogRelDestinations)(IMachineDebugger *pThis, PRUnichar * *logRelDestinations);
+
+    nsresult (*GetHWVirtExEnabled)(IMachineDebugger *pThis, PRBool *HWVirtExEnabled);
+
+    nsresult (*GetHWVirtExNestedPagingEnabled)(IMachineDebugger *pThis, PRBool *HWVirtExNestedPagingEnabled);
+
+    nsresult (*GetHWVirtExVPIDEnabled)(IMachineDebugger *pThis, PRBool *HWVirtExVPIDEnabled);
+
+    nsresult (*GetHWVirtExUXEnabled)(IMachineDebugger *pThis, PRBool *HWVirtExUXEnabled);
+
+    nsresult (*GetOSName)(IMachineDebugger *pThis, PRUnichar * *OSName);
+
+    nsresult (*GetOSVersion)(IMachineDebugger *pThis, PRUnichar * *OSVersion);
+
+    nsresult (*GetPAEEnabled)(IMachineDebugger *pThis, PRBool *PAEEnabled);
+
+    nsresult (*GetVirtualTimeRate)(IMachineDebugger *pThis, PRUint32 *virtualTimeRate);
+    nsresult (*SetVirtualTimeRate)(IMachineDebugger *pThis, PRUint32 virtualTimeRate);
+
+    nsresult (*GetVM)(IMachineDebugger *pThis, PRInt64 *VM);
+
+    nsresult (*DumpGuestCore)(
+        IMachineDebugger *pThis,
+        PRUnichar * filename,
+        PRUnichar * compression
+    );
+
+    nsresult (*DumpHostProcessCore)(
+        IMachineDebugger *pThis,
+        PRUnichar * filename,
+        PRUnichar * compression
+    );
+
+    nsresult (*Info)(
+        IMachineDebugger *pThis,
+        PRUnichar * name,
+        PRUnichar * args,
+        PRUnichar * * info
+    );
+
+    nsresult (*InjectNMI)(IMachineDebugger *pThis );
+
+    nsresult (*ModifyLogGroups)(
+        IMachineDebugger *pThis,
+        PRUnichar * settings
+    );
+
+    nsresult (*ModifyLogFlags)(
+        IMachineDebugger *pThis,
+        PRUnichar * settings
+    );
+
+    nsresult (*ModifyLogDestinations)(
+        IMachineDebugger *pThis,
+        PRUnichar * settings
+    );
+
+    nsresult (*ReadPhysicalMemory)(
+        IMachineDebugger *pThis,
+        PRInt64 address,
+        PRUint32 size,
+        PRUint32 *bytesSize,
+        PRUint8** bytes
+    );
+
+    nsresult (*WritePhysicalMemory)(
+        IMachineDebugger *pThis,
+        PRInt64 address,
+        PRUint32 size,
+        PRUint32 bytesSize,
+        PRUint8* bytes
+    );
+
+    nsresult (*ReadVirtualMemory)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRInt64 address,
+        PRUint32 size,
+        PRUint32 *bytesSize,
+        PRUint8** bytes
+    );
+
+    nsresult (*WriteVirtualMemory)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRInt64 address,
+        PRUint32 size,
+        PRUint32 bytesSize,
+        PRUint8* bytes
+    );
+
+    nsresult (*DetectOS)(
+        IMachineDebugger *pThis,
+        PRUnichar * * os
+    );
+
+    nsresult (*GetRegister)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUnichar * name,
+        PRUnichar * * value
+    );
+
+    nsresult (*GetRegisters)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *valuesSize,
+        PRUnichar *** values
+    );
+
+    nsresult (*SetRegister)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUnichar * name,
+        PRUnichar * value
+    );
+
+    nsresult (*SetRegisters)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        PRUint32 valuesSize,
+        PRUnichar ** values
+    );
+
+    nsresult (*DumpGuestStack)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUnichar * * stack
+    );
+
+    nsresult (*ResetStats)(
+        IMachineDebugger *pThis,
+        PRUnichar * pattern
+    );
+
+    nsresult (*DumpStats)(
+        IMachineDebugger *pThis,
+        PRUnichar * pattern
+    );
+
+    nsresult (*GetStats)(
+        IMachineDebugger *pThis,
+        PRUnichar * pattern,
+        PRBool withDescriptions,
+        PRUnichar * * stats
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMachineDebuggerVtbl
+{
+    nsresult (*QueryInterface)(IMachineDebugger *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMachineDebugger *pThis);
+    nsrefcnt (*Release)(IMachineDebugger *pThis);
+    nsresult (*GetSingleStep)(IMachineDebugger *pThis, PRBool *singleStep);
+    nsresult (*SetSingleStep)(IMachineDebugger *pThis, PRBool singleStep);
+
+    nsresult (*GetRecompileUser)(IMachineDebugger *pThis, PRBool *recompileUser);
+    nsresult (*SetRecompileUser)(IMachineDebugger *pThis, PRBool recompileUser);
+
+    nsresult (*GetRecompileSupervisor)(IMachineDebugger *pThis, PRBool *recompileSupervisor);
+    nsresult (*SetRecompileSupervisor)(IMachineDebugger *pThis, PRBool recompileSupervisor);
+
+    nsresult (*GetExecuteAllInIEM)(IMachineDebugger *pThis, PRBool *executeAllInIEM);
+    nsresult (*SetExecuteAllInIEM)(IMachineDebugger *pThis, PRBool executeAllInIEM);
+
+    nsresult (*GetPATMEnabled)(IMachineDebugger *pThis, PRBool *PATMEnabled);
+    nsresult (*SetPATMEnabled)(IMachineDebugger *pThis, PRBool PATMEnabled);
+
+    nsresult (*GetCSAMEnabled)(IMachineDebugger *pThis, PRBool *CSAMEnabled);
+    nsresult (*SetCSAMEnabled)(IMachineDebugger *pThis, PRBool CSAMEnabled);
+
+    nsresult (*GetLogEnabled)(IMachineDebugger *pThis, PRBool *logEnabled);
+    nsresult (*SetLogEnabled)(IMachineDebugger *pThis, PRBool logEnabled);
+
+    nsresult (*GetLogDbgFlags)(IMachineDebugger *pThis, PRUnichar * *logDbgFlags);
+
+    nsresult (*GetLogDbgGroups)(IMachineDebugger *pThis, PRUnichar * *logDbgGroups);
+
+    nsresult (*GetLogDbgDestinations)(IMachineDebugger *pThis, PRUnichar * *logDbgDestinations);
+
+    nsresult (*GetLogRelFlags)(IMachineDebugger *pThis, PRUnichar * *logRelFlags);
+
+    nsresult (*GetLogRelGroups)(IMachineDebugger *pThis, PRUnichar * *logRelGroups);
+
+    nsresult (*GetLogRelDestinations)(IMachineDebugger *pThis, PRUnichar * *logRelDestinations);
+
+    nsresult (*GetHWVirtExEnabled)(IMachineDebugger *pThis, PRBool *HWVirtExEnabled);
+
+    nsresult (*GetHWVirtExNestedPagingEnabled)(IMachineDebugger *pThis, PRBool *HWVirtExNestedPagingEnabled);
+
+    nsresult (*GetHWVirtExVPIDEnabled)(IMachineDebugger *pThis, PRBool *HWVirtExVPIDEnabled);
+
+    nsresult (*GetHWVirtExUXEnabled)(IMachineDebugger *pThis, PRBool *HWVirtExUXEnabled);
+
+    nsresult (*GetOSName)(IMachineDebugger *pThis, PRUnichar * *OSName);
+
+    nsresult (*GetOSVersion)(IMachineDebugger *pThis, PRUnichar * *OSVersion);
+
+    nsresult (*GetPAEEnabled)(IMachineDebugger *pThis, PRBool *PAEEnabled);
+
+    nsresult (*GetVirtualTimeRate)(IMachineDebugger *pThis, PRUint32 *virtualTimeRate);
+    nsresult (*SetVirtualTimeRate)(IMachineDebugger *pThis, PRUint32 virtualTimeRate);
+
+    nsresult (*GetVM)(IMachineDebugger *pThis, PRInt64 *VM);
+
+    nsresult (*DumpGuestCore)(
+        IMachineDebugger *pThis,
+        PRUnichar * filename,
+        PRUnichar * compression
+    );
+
+    nsresult (*DumpHostProcessCore)(
+        IMachineDebugger *pThis,
+        PRUnichar * filename,
+        PRUnichar * compression
+    );
+
+    nsresult (*Info)(
+        IMachineDebugger *pThis,
+        PRUnichar * name,
+        PRUnichar * args,
+        PRUnichar * * info
+    );
+
+    nsresult (*InjectNMI)(IMachineDebugger *pThis );
+
+    nsresult (*ModifyLogGroups)(
+        IMachineDebugger *pThis,
+        PRUnichar * settings
+    );
+
+    nsresult (*ModifyLogFlags)(
+        IMachineDebugger *pThis,
+        PRUnichar * settings
+    );
+
+    nsresult (*ModifyLogDestinations)(
+        IMachineDebugger *pThis,
+        PRUnichar * settings
+    );
+
+    nsresult (*ReadPhysicalMemory)(
+        IMachineDebugger *pThis,
+        PRInt64 address,
+        PRUint32 size,
+        PRUint32 *bytesSize,
+        PRUint8** bytes
+    );
+
+    nsresult (*WritePhysicalMemory)(
+        IMachineDebugger *pThis,
+        PRInt64 address,
+        PRUint32 size,
+        PRUint32 bytesSize,
+        PRUint8* bytes
+    );
+
+    nsresult (*ReadVirtualMemory)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRInt64 address,
+        PRUint32 size,
+        PRUint32 *bytesSize,
+        PRUint8** bytes
+    );
+
+    nsresult (*WriteVirtualMemory)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRInt64 address,
+        PRUint32 size,
+        PRUint32 bytesSize,
+        PRUint8* bytes
+    );
+
+    nsresult (*DetectOS)(
+        IMachineDebugger *pThis,
+        PRUnichar * * os
+    );
+
+    nsresult (*GetRegister)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUnichar * name,
+        PRUnichar * * value
+    );
+
+    nsresult (*GetRegisters)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUint32 *namesSize,
+        PRUnichar *** names,
+        PRUint32 *valuesSize,
+        PRUnichar *** values
+    );
+
+    nsresult (*SetRegister)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUnichar * name,
+        PRUnichar * value
+    );
+
+    nsresult (*SetRegisters)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUint32 namesSize,
+        PRUnichar ** names,
+        PRUint32 valuesSize,
+        PRUnichar ** values
+    );
+
+    nsresult (*DumpGuestStack)(
+        IMachineDebugger *pThis,
+        PRUint32 cpuId,
+        PRUnichar * * stack
+    );
+
+    nsresult (*ResetStats)(
+        IMachineDebugger *pThis,
+        PRUnichar * pattern
+    );
+
+    nsresult (*DumpStats)(
+        IMachineDebugger *pThis,
+        PRUnichar * pattern
+    );
+
+    nsresult (*GetStats)(
+        IMachineDebugger *pThis,
+        PRUnichar * pattern,
+        PRBool withDescriptions,
+        PRUnichar * * stats
+    );
+
+};
+#define IMachineDebugger_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMachineDebugger_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMachineDebugger_Release(p) ((p)->lpVtbl->Release(p))
+#define IMachineDebugger_get_SingleStep(p, aSingleStep) ((p)->lpVtbl->GetSingleStep(p, aSingleStep))
+#define IMachineDebugger_GetSingleStep(p, aSingleStep) ((p)->lpVtbl->GetSingleStep(p, aSingleStep))
+#define IMachineDebugger_put_SingleStep(p, aSingleStep) ((p)->lpVtbl->SetSingleStep(p, aSingleStep))
+#define IMachineDebugger_SetSingleStep(p, aSingleStep) ((p)->lpVtbl->SetSingleStep(p, aSingleStep))
+#define IMachineDebugger_get_RecompileUser(p, aRecompileUser) ((p)->lpVtbl->GetRecompileUser(p, aRecompileUser))
+#define IMachineDebugger_GetRecompileUser(p, aRecompileUser) ((p)->lpVtbl->GetRecompileUser(p, aRecompileUser))
+#define IMachineDebugger_put_RecompileUser(p, aRecompileUser) ((p)->lpVtbl->SetRecompileUser(p, aRecompileUser))
+#define IMachineDebugger_SetRecompileUser(p, aRecompileUser) ((p)->lpVtbl->SetRecompileUser(p, aRecompileUser))
+#define IMachineDebugger_get_RecompileSupervisor(p, aRecompileSupervisor) ((p)->lpVtbl->GetRecompileSupervisor(p, aRecompileSupervisor))
+#define IMachineDebugger_GetRecompileSupervisor(p, aRecompileSupervisor) ((p)->lpVtbl->GetRecompileSupervisor(p, aRecompileSupervisor))
+#define IMachineDebugger_put_RecompileSupervisor(p, aRecompileSupervisor) ((p)->lpVtbl->SetRecompileSupervisor(p, aRecompileSupervisor))
+#define IMachineDebugger_SetRecompileSupervisor(p, aRecompileSupervisor) ((p)->lpVtbl->SetRecompileSupervisor(p, aRecompileSupervisor))
+#define IMachineDebugger_get_ExecuteAllInIEM(p, aExecuteAllInIEM) ((p)->lpVtbl->GetExecuteAllInIEM(p, aExecuteAllInIEM))
+#define IMachineDebugger_GetExecuteAllInIEM(p, aExecuteAllInIEM) ((p)->lpVtbl->GetExecuteAllInIEM(p, aExecuteAllInIEM))
+#define IMachineDebugger_put_ExecuteAllInIEM(p, aExecuteAllInIEM) ((p)->lpVtbl->SetExecuteAllInIEM(p, aExecuteAllInIEM))
+#define IMachineDebugger_SetExecuteAllInIEM(p, aExecuteAllInIEM) ((p)->lpVtbl->SetExecuteAllInIEM(p, aExecuteAllInIEM))
+#define IMachineDebugger_get_PATMEnabled(p, aPATMEnabled) ((p)->lpVtbl->GetPATMEnabled(p, aPATMEnabled))
+#define IMachineDebugger_GetPATMEnabled(p, aPATMEnabled) ((p)->lpVtbl->GetPATMEnabled(p, aPATMEnabled))
+#define IMachineDebugger_put_PATMEnabled(p, aPATMEnabled) ((p)->lpVtbl->SetPATMEnabled(p, aPATMEnabled))
+#define IMachineDebugger_SetPATMEnabled(p, aPATMEnabled) ((p)->lpVtbl->SetPATMEnabled(p, aPATMEnabled))
+#define IMachineDebugger_get_CSAMEnabled(p, aCSAMEnabled) ((p)->lpVtbl->GetCSAMEnabled(p, aCSAMEnabled))
+#define IMachineDebugger_GetCSAMEnabled(p, aCSAMEnabled) ((p)->lpVtbl->GetCSAMEnabled(p, aCSAMEnabled))
+#define IMachineDebugger_put_CSAMEnabled(p, aCSAMEnabled) ((p)->lpVtbl->SetCSAMEnabled(p, aCSAMEnabled))
+#define IMachineDebugger_SetCSAMEnabled(p, aCSAMEnabled) ((p)->lpVtbl->SetCSAMEnabled(p, aCSAMEnabled))
+#define IMachineDebugger_get_LogEnabled(p, aLogEnabled) ((p)->lpVtbl->GetLogEnabled(p, aLogEnabled))
+#define IMachineDebugger_GetLogEnabled(p, aLogEnabled) ((p)->lpVtbl->GetLogEnabled(p, aLogEnabled))
+#define IMachineDebugger_put_LogEnabled(p, aLogEnabled) ((p)->lpVtbl->SetLogEnabled(p, aLogEnabled))
+#define IMachineDebugger_SetLogEnabled(p, aLogEnabled) ((p)->lpVtbl->SetLogEnabled(p, aLogEnabled))
+#define IMachineDebugger_get_LogDbgFlags(p, aLogDbgFlags) ((p)->lpVtbl->GetLogDbgFlags(p, aLogDbgFlags))
+#define IMachineDebugger_GetLogDbgFlags(p, aLogDbgFlags) ((p)->lpVtbl->GetLogDbgFlags(p, aLogDbgFlags))
+#define IMachineDebugger_get_LogDbgGroups(p, aLogDbgGroups) ((p)->lpVtbl->GetLogDbgGroups(p, aLogDbgGroups))
+#define IMachineDebugger_GetLogDbgGroups(p, aLogDbgGroups) ((p)->lpVtbl->GetLogDbgGroups(p, aLogDbgGroups))
+#define IMachineDebugger_get_LogDbgDestinations(p, aLogDbgDestinations) ((p)->lpVtbl->GetLogDbgDestinations(p, aLogDbgDestinations))
+#define IMachineDebugger_GetLogDbgDestinations(p, aLogDbgDestinations) ((p)->lpVtbl->GetLogDbgDestinations(p, aLogDbgDestinations))
+#define IMachineDebugger_get_LogRelFlags(p, aLogRelFlags) ((p)->lpVtbl->GetLogRelFlags(p, aLogRelFlags))
+#define IMachineDebugger_GetLogRelFlags(p, aLogRelFlags) ((p)->lpVtbl->GetLogRelFlags(p, aLogRelFlags))
+#define IMachineDebugger_get_LogRelGroups(p, aLogRelGroups) ((p)->lpVtbl->GetLogRelGroups(p, aLogRelGroups))
+#define IMachineDebugger_GetLogRelGroups(p, aLogRelGroups) ((p)->lpVtbl->GetLogRelGroups(p, aLogRelGroups))
+#define IMachineDebugger_get_LogRelDestinations(p, aLogRelDestinations) ((p)->lpVtbl->GetLogRelDestinations(p, aLogRelDestinations))
+#define IMachineDebugger_GetLogRelDestinations(p, aLogRelDestinations) ((p)->lpVtbl->GetLogRelDestinations(p, aLogRelDestinations))
+#define IMachineDebugger_get_HWVirtExEnabled(p, aHWVirtExEnabled) ((p)->lpVtbl->GetHWVirtExEnabled(p, aHWVirtExEnabled))
+#define IMachineDebugger_GetHWVirtExEnabled(p, aHWVirtExEnabled) ((p)->lpVtbl->GetHWVirtExEnabled(p, aHWVirtExEnabled))
+#define IMachineDebugger_get_HWVirtExNestedPagingEnabled(p, aHWVirtExNestedPagingEnabled) ((p)->lpVtbl->GetHWVirtExNestedPagingEnabled(p, aHWVirtExNestedPagingEnabled))
+#define IMachineDebugger_GetHWVirtExNestedPagingEnabled(p, aHWVirtExNestedPagingEnabled) ((p)->lpVtbl->GetHWVirtExNestedPagingEnabled(p, aHWVirtExNestedPagingEnabled))
+#define IMachineDebugger_get_HWVirtExVPIDEnabled(p, aHWVirtExVPIDEnabled) ((p)->lpVtbl->GetHWVirtExVPIDEnabled(p, aHWVirtExVPIDEnabled))
+#define IMachineDebugger_GetHWVirtExVPIDEnabled(p, aHWVirtExVPIDEnabled) ((p)->lpVtbl->GetHWVirtExVPIDEnabled(p, aHWVirtExVPIDEnabled))
+#define IMachineDebugger_get_HWVirtExUXEnabled(p, aHWVirtExUXEnabled) ((p)->lpVtbl->GetHWVirtExUXEnabled(p, aHWVirtExUXEnabled))
+#define IMachineDebugger_GetHWVirtExUXEnabled(p, aHWVirtExUXEnabled) ((p)->lpVtbl->GetHWVirtExUXEnabled(p, aHWVirtExUXEnabled))
+#define IMachineDebugger_get_OSName(p, aOSName) ((p)->lpVtbl->GetOSName(p, aOSName))
+#define IMachineDebugger_GetOSName(p, aOSName) ((p)->lpVtbl->GetOSName(p, aOSName))
+#define IMachineDebugger_get_OSVersion(p, aOSVersion) ((p)->lpVtbl->GetOSVersion(p, aOSVersion))
+#define IMachineDebugger_GetOSVersion(p, aOSVersion) ((p)->lpVtbl->GetOSVersion(p, aOSVersion))
+#define IMachineDebugger_get_PAEEnabled(p, aPAEEnabled) ((p)->lpVtbl->GetPAEEnabled(p, aPAEEnabled))
+#define IMachineDebugger_GetPAEEnabled(p, aPAEEnabled) ((p)->lpVtbl->GetPAEEnabled(p, aPAEEnabled))
+#define IMachineDebugger_get_VirtualTimeRate(p, aVirtualTimeRate) ((p)->lpVtbl->GetVirtualTimeRate(p, aVirtualTimeRate))
+#define IMachineDebugger_GetVirtualTimeRate(p, aVirtualTimeRate) ((p)->lpVtbl->GetVirtualTimeRate(p, aVirtualTimeRate))
+#define IMachineDebugger_put_VirtualTimeRate(p, aVirtualTimeRate) ((p)->lpVtbl->SetVirtualTimeRate(p, aVirtualTimeRate))
+#define IMachineDebugger_SetVirtualTimeRate(p, aVirtualTimeRate) ((p)->lpVtbl->SetVirtualTimeRate(p, aVirtualTimeRate))
+#define IMachineDebugger_get_VM(p, aVM) ((p)->lpVtbl->GetVM(p, aVM))
+#define IMachineDebugger_GetVM(p, aVM) ((p)->lpVtbl->GetVM(p, aVM))
+#define IMachineDebugger_DumpGuestCore(p, aFilename, aCompression) ((p)->lpVtbl->DumpGuestCore(p, aFilename, aCompression))
+#define IMachineDebugger_DumpHostProcessCore(p, aFilename, aCompression) ((p)->lpVtbl->DumpHostProcessCore(p, aFilename, aCompression))
+#define IMachineDebugger_Info(p, aName, aArgs, aInfo) ((p)->lpVtbl->Info(p, aName, aArgs, aInfo))
+#define IMachineDebugger_InjectNMI(p) ((p)->lpVtbl->InjectNMI(p))
+#define IMachineDebugger_ModifyLogGroups(p, aSettings) ((p)->lpVtbl->ModifyLogGroups(p, aSettings))
+#define IMachineDebugger_ModifyLogFlags(p, aSettings) ((p)->lpVtbl->ModifyLogFlags(p, aSettings))
+#define IMachineDebugger_ModifyLogDestinations(p, aSettings) ((p)->lpVtbl->ModifyLogDestinations(p, aSettings))
+#define IMachineDebugger_ReadPhysicalMemory(p, aAddress, aSize, aBytes) ((p)->lpVtbl->ReadPhysicalMemory(p, aAddress, aSize, aBytes))
+#define IMachineDebugger_WritePhysicalMemory(p, aAddress, aSize, aBytes) ((p)->lpVtbl->WritePhysicalMemory(p, aAddress, aSize, aBytes))
+#define IMachineDebugger_ReadVirtualMemory(p, aCpuId, aAddress, aSize, aBytes) ((p)->lpVtbl->ReadVirtualMemory(p, aCpuId, aAddress, aSize, aBytes))
+#define IMachineDebugger_WriteVirtualMemory(p, aCpuId, aAddress, aSize, aBytes) ((p)->lpVtbl->WriteVirtualMemory(p, aCpuId, aAddress, aSize, aBytes))
+#define IMachineDebugger_DetectOS(p, aOs) ((p)->lpVtbl->DetectOS(p, aOs))
+#define IMachineDebugger_GetRegister(p, aCpuId, aName, aValue) ((p)->lpVtbl->GetRegister(p, aCpuId, aName, aValue))
+#define IMachineDebugger_GetRegisters(p, aCpuId, aNames, aValues) ((p)->lpVtbl->GetRegisters(p, aCpuId, aNames, aValues))
+#define IMachineDebugger_SetRegister(p, aCpuId, aName, aValue) ((p)->lpVtbl->SetRegister(p, aCpuId, aName, aValue))
+#define IMachineDebugger_SetRegisters(p, aCpuId, aNames, aValues) ((p)->lpVtbl->SetRegisters(p, aCpuId, aNames, aValues))
+#define IMachineDebugger_DumpGuestStack(p, aCpuId, aStack) ((p)->lpVtbl->DumpGuestStack(p, aCpuId, aStack))
+#define IMachineDebugger_ResetStats(p, aPattern) ((p)->lpVtbl->ResetStats(p, aPattern))
+#define IMachineDebugger_DumpStats(p, aPattern) ((p)->lpVtbl->DumpStats(p, aPattern))
+#define IMachineDebugger_GetStats(p, aPattern, aWithDescriptions, aStats) ((p)->lpVtbl->GetStats(p, aPattern, aWithDescriptions, aStats))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMachineDebugger
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMachineDebugger_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMachineDebuggerVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMachineDebugger declaration */
+
+
+/* Start of struct IUSBDeviceFilters declaration */
+#define IUSBDEVICEFILTERS_IID_STR "2ab550b2-53cc-4c2e-ae07-0adf4114e75c"
+#define IUSBDEVICEFILTERS_IID { \
+    0x2ab550b2, 0x53cc, 0x4c2e, \
+    { 0xae, 0x07, 0x0a, 0xdf, 0x41, 0x14, 0xe7, 0x5c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IUSBDeviceFilters);
+#ifndef VBOX_WITH_GLUE
+struct IUSBDeviceFilters_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetDeviceFilters)(IUSBDeviceFilters *pThis, PRUint32 *deviceFiltersSize, IUSBDeviceFilter * **deviceFilters);
+
+    nsresult (*CreateDeviceFilter)(
+        IUSBDeviceFilters *pThis,
+        PRUnichar * name,
+        IUSBDeviceFilter * * filter
+    );
+
+    nsresult (*InsertDeviceFilter)(
+        IUSBDeviceFilters *pThis,
+        PRUint32 position,
+        IUSBDeviceFilter * filter
+    );
+
+    nsresult (*RemoveDeviceFilter)(
+        IUSBDeviceFilters *pThis,
+        PRUint32 position,
+        IUSBDeviceFilter * * filter
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IUSBDeviceFiltersVtbl
+{
+    nsresult (*QueryInterface)(IUSBDeviceFilters *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IUSBDeviceFilters *pThis);
+    nsrefcnt (*Release)(IUSBDeviceFilters *pThis);
+    nsresult (*GetDeviceFilters)(IUSBDeviceFilters *pThis, PRUint32 *deviceFiltersSize, IUSBDeviceFilter * **deviceFilters);
+
+    nsresult (*CreateDeviceFilter)(
+        IUSBDeviceFilters *pThis,
+        PRUnichar * name,
+        IUSBDeviceFilter * * filter
+    );
+
+    nsresult (*InsertDeviceFilter)(
+        IUSBDeviceFilters *pThis,
+        PRUint32 position,
+        IUSBDeviceFilter * filter
+    );
+
+    nsresult (*RemoveDeviceFilter)(
+        IUSBDeviceFilters *pThis,
+        PRUint32 position,
+        IUSBDeviceFilter * * filter
+    );
+
+};
+#define IUSBDeviceFilters_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IUSBDeviceFilters_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IUSBDeviceFilters_Release(p) ((p)->lpVtbl->Release(p))
+#define IUSBDeviceFilters_get_DeviceFilters(p, aDeviceFilters) ((p)->lpVtbl->GetDeviceFilters(p, aDeviceFilters))
+#define IUSBDeviceFilters_GetDeviceFilters(p, aDeviceFilters) ((p)->lpVtbl->GetDeviceFilters(p, aDeviceFilters))
+#define IUSBDeviceFilters_CreateDeviceFilter(p, aName, aFilter) ((p)->lpVtbl->CreateDeviceFilter(p, aName, aFilter))
+#define IUSBDeviceFilters_InsertDeviceFilter(p, aPosition, aFilter) ((p)->lpVtbl->InsertDeviceFilter(p, aPosition, aFilter))
+#define IUSBDeviceFilters_RemoveDeviceFilter(p, aPosition, aFilter) ((p)->lpVtbl->RemoveDeviceFilter(p, aPosition, aFilter))
+#endif /* VBOX_WITH_GLUE */
+
+interface IUSBDeviceFilters
+{
+#ifndef VBOX_WITH_GLUE
+    struct IUSBDeviceFilters_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IUSBDeviceFiltersVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IUSBDeviceFilters declaration */
+
+
+/* Start of struct IUSBController declaration */
+#define IUSBCONTROLLER_IID_STR "d2745291-65f7-4d75-9556-38047d802319"
+#define IUSBCONTROLLER_IID { \
+    0xd2745291, 0x65f7, 0x4d75, \
+    { 0x95, 0x56, 0x38, 0x04, 0x7d, 0x80, 0x23, 0x19 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IUSBController);
+#ifndef VBOX_WITH_GLUE
+struct IUSBController_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IUSBController *pThis, PRUnichar * *name);
+
+    nsresult (*GetType)(IUSBController *pThis, PRUint32 *type);
+
+    nsresult (*GetUSBStandard)(IUSBController *pThis, PRUint16 *USBStandard);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IUSBControllerVtbl
+{
+    nsresult (*QueryInterface)(IUSBController *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IUSBController *pThis);
+    nsrefcnt (*Release)(IUSBController *pThis);
+    nsresult (*GetName)(IUSBController *pThis, PRUnichar * *name);
+
+    nsresult (*GetType)(IUSBController *pThis, PRUint32 *type);
+
+    nsresult (*GetUSBStandard)(IUSBController *pThis, PRUint16 *USBStandard);
+
+};
+#define IUSBController_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IUSBController_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IUSBController_Release(p) ((p)->lpVtbl->Release(p))
+#define IUSBController_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IUSBController_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IUSBController_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IUSBController_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IUSBController_get_USBStandard(p, aUSBStandard) ((p)->lpVtbl->GetUSBStandard(p, aUSBStandard))
+#define IUSBController_GetUSBStandard(p, aUSBStandard) ((p)->lpVtbl->GetUSBStandard(p, aUSBStandard))
+#endif /* VBOX_WITH_GLUE */
+
+interface IUSBController
+{
+#ifndef VBOX_WITH_GLUE
+    struct IUSBController_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IUSBControllerVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IUSBController declaration */
+
+
+/* Start of struct IUSBDevice declaration */
+#define IUSBDEVICE_IID_STR "f8967b0b-4483-400f-92b5-8b675d98a85b"
+#define IUSBDEVICE_IID { \
+    0xf8967b0b, 0x4483, 0x400f, \
+    { 0x92, 0xb5, 0x8b, 0x67, 0x5d, 0x98, 0xa8, 0x5b } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IUSBDevice);
+#ifndef VBOX_WITH_GLUE
+struct IUSBDevice_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetId)(IUSBDevice *pThis, PRUnichar * *id);
+
+    nsresult (*GetVendorId)(IUSBDevice *pThis, PRUint16 *vendorId);
+
+    nsresult (*GetProductId)(IUSBDevice *pThis, PRUint16 *productId);
+
+    nsresult (*GetRevision)(IUSBDevice *pThis, PRUint16 *revision);
+
+    nsresult (*GetManufacturer)(IUSBDevice *pThis, PRUnichar * *manufacturer);
+
+    nsresult (*GetProduct)(IUSBDevice *pThis, PRUnichar * *product);
+
+    nsresult (*GetSerialNumber)(IUSBDevice *pThis, PRUnichar * *serialNumber);
+
+    nsresult (*GetAddress)(IUSBDevice *pThis, PRUnichar * *address);
+
+    nsresult (*GetPort)(IUSBDevice *pThis, PRUint16 *port);
+
+    nsresult (*GetVersion)(IUSBDevice *pThis, PRUint16 *version);
+
+    nsresult (*GetPortVersion)(IUSBDevice *pThis, PRUint16 *portVersion);
+
+    nsresult (*GetRemote)(IUSBDevice *pThis, PRBool *remote);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IUSBDeviceVtbl
+{
+    nsresult (*QueryInterface)(IUSBDevice *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IUSBDevice *pThis);
+    nsrefcnt (*Release)(IUSBDevice *pThis);
+    nsresult (*GetId)(IUSBDevice *pThis, PRUnichar * *id);
+
+    nsresult (*GetVendorId)(IUSBDevice *pThis, PRUint16 *vendorId);
+
+    nsresult (*GetProductId)(IUSBDevice *pThis, PRUint16 *productId);
+
+    nsresult (*GetRevision)(IUSBDevice *pThis, PRUint16 *revision);
+
+    nsresult (*GetManufacturer)(IUSBDevice *pThis, PRUnichar * *manufacturer);
+
+    nsresult (*GetProduct)(IUSBDevice *pThis, PRUnichar * *product);
+
+    nsresult (*GetSerialNumber)(IUSBDevice *pThis, PRUnichar * *serialNumber);
+
+    nsresult (*GetAddress)(IUSBDevice *pThis, PRUnichar * *address);
+
+    nsresult (*GetPort)(IUSBDevice *pThis, PRUint16 *port);
+
+    nsresult (*GetVersion)(IUSBDevice *pThis, PRUint16 *version);
+
+    nsresult (*GetPortVersion)(IUSBDevice *pThis, PRUint16 *portVersion);
+
+    nsresult (*GetRemote)(IUSBDevice *pThis, PRBool *remote);
+
+};
+#define IUSBDevice_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IUSBDevice_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IUSBDevice_Release(p) ((p)->lpVtbl->Release(p))
+#define IUSBDevice_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IUSBDevice_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IUSBDevice_get_VendorId(p, aVendorId) ((p)->lpVtbl->GetVendorId(p, aVendorId))
+#define IUSBDevice_GetVendorId(p, aVendorId) ((p)->lpVtbl->GetVendorId(p, aVendorId))
+#define IUSBDevice_get_ProductId(p, aProductId) ((p)->lpVtbl->GetProductId(p, aProductId))
+#define IUSBDevice_GetProductId(p, aProductId) ((p)->lpVtbl->GetProductId(p, aProductId))
+#define IUSBDevice_get_Revision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IUSBDevice_GetRevision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IUSBDevice_get_Manufacturer(p, aManufacturer) ((p)->lpVtbl->GetManufacturer(p, aManufacturer))
+#define IUSBDevice_GetManufacturer(p, aManufacturer) ((p)->lpVtbl->GetManufacturer(p, aManufacturer))
+#define IUSBDevice_get_Product(p, aProduct) ((p)->lpVtbl->GetProduct(p, aProduct))
+#define IUSBDevice_GetProduct(p, aProduct) ((p)->lpVtbl->GetProduct(p, aProduct))
+#define IUSBDevice_get_SerialNumber(p, aSerialNumber) ((p)->lpVtbl->GetSerialNumber(p, aSerialNumber))
+#define IUSBDevice_GetSerialNumber(p, aSerialNumber) ((p)->lpVtbl->GetSerialNumber(p, aSerialNumber))
+#define IUSBDevice_get_Address(p, aAddress) ((p)->lpVtbl->GetAddress(p, aAddress))
+#define IUSBDevice_GetAddress(p, aAddress) ((p)->lpVtbl->GetAddress(p, aAddress))
+#define IUSBDevice_get_Port(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IUSBDevice_GetPort(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IUSBDevice_get_Version(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IUSBDevice_GetVersion(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IUSBDevice_get_PortVersion(p, aPortVersion) ((p)->lpVtbl->GetPortVersion(p, aPortVersion))
+#define IUSBDevice_GetPortVersion(p, aPortVersion) ((p)->lpVtbl->GetPortVersion(p, aPortVersion))
+#define IUSBDevice_get_Remote(p, aRemote) ((p)->lpVtbl->GetRemote(p, aRemote))
+#define IUSBDevice_GetRemote(p, aRemote) ((p)->lpVtbl->GetRemote(p, aRemote))
+#endif /* VBOX_WITH_GLUE */
+
+interface IUSBDevice
+{
+#ifndef VBOX_WITH_GLUE
+    struct IUSBDevice_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IUSBDeviceVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IUSBDevice declaration */
+
+
+/* Start of struct IUSBDeviceFilter declaration */
+#define IUSBDEVICEFILTER_IID_STR "d6831fb4-1a94-4c2c-96ef-8d0d6192066d"
+#define IUSBDEVICEFILTER_IID { \
+    0xd6831fb4, 0x1a94, 0x4c2c, \
+    { 0x96, 0xef, 0x8d, 0x0d, 0x61, 0x92, 0x06, 0x6d } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IUSBDeviceFilter);
+#ifndef VBOX_WITH_GLUE
+struct IUSBDeviceFilter_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IUSBDeviceFilter *pThis, PRUnichar * *name);
+    nsresult (*SetName)(IUSBDeviceFilter *pThis, PRUnichar * name);
+
+    nsresult (*GetActive)(IUSBDeviceFilter *pThis, PRBool *active);
+    nsresult (*SetActive)(IUSBDeviceFilter *pThis, PRBool active);
+
+    nsresult (*GetVendorId)(IUSBDeviceFilter *pThis, PRUnichar * *vendorId);
+    nsresult (*SetVendorId)(IUSBDeviceFilter *pThis, PRUnichar * vendorId);
+
+    nsresult (*GetProductId)(IUSBDeviceFilter *pThis, PRUnichar * *productId);
+    nsresult (*SetProductId)(IUSBDeviceFilter *pThis, PRUnichar * productId);
+
+    nsresult (*GetRevision)(IUSBDeviceFilter *pThis, PRUnichar * *revision);
+    nsresult (*SetRevision)(IUSBDeviceFilter *pThis, PRUnichar * revision);
+
+    nsresult (*GetManufacturer)(IUSBDeviceFilter *pThis, PRUnichar * *manufacturer);
+    nsresult (*SetManufacturer)(IUSBDeviceFilter *pThis, PRUnichar * manufacturer);
+
+    nsresult (*GetProduct)(IUSBDeviceFilter *pThis, PRUnichar * *product);
+    nsresult (*SetProduct)(IUSBDeviceFilter *pThis, PRUnichar * product);
+
+    nsresult (*GetSerialNumber)(IUSBDeviceFilter *pThis, PRUnichar * *serialNumber);
+    nsresult (*SetSerialNumber)(IUSBDeviceFilter *pThis, PRUnichar * serialNumber);
+
+    nsresult (*GetPort)(IUSBDeviceFilter *pThis, PRUnichar * *port);
+    nsresult (*SetPort)(IUSBDeviceFilter *pThis, PRUnichar * port);
+
+    nsresult (*GetRemote)(IUSBDeviceFilter *pThis, PRUnichar * *remote);
+    nsresult (*SetRemote)(IUSBDeviceFilter *pThis, PRUnichar * remote);
+
+    nsresult (*GetMaskedInterfaces)(IUSBDeviceFilter *pThis, PRUint32 *maskedInterfaces);
+    nsresult (*SetMaskedInterfaces)(IUSBDeviceFilter *pThis, PRUint32 maskedInterfaces);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IUSBDeviceFilterVtbl
+{
+    nsresult (*QueryInterface)(IUSBDeviceFilter *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IUSBDeviceFilter *pThis);
+    nsrefcnt (*Release)(IUSBDeviceFilter *pThis);
+    nsresult (*GetName)(IUSBDeviceFilter *pThis, PRUnichar * *name);
+    nsresult (*SetName)(IUSBDeviceFilter *pThis, PRUnichar * name);
+
+    nsresult (*GetActive)(IUSBDeviceFilter *pThis, PRBool *active);
+    nsresult (*SetActive)(IUSBDeviceFilter *pThis, PRBool active);
+
+    nsresult (*GetVendorId)(IUSBDeviceFilter *pThis, PRUnichar * *vendorId);
+    nsresult (*SetVendorId)(IUSBDeviceFilter *pThis, PRUnichar * vendorId);
+
+    nsresult (*GetProductId)(IUSBDeviceFilter *pThis, PRUnichar * *productId);
+    nsresult (*SetProductId)(IUSBDeviceFilter *pThis, PRUnichar * productId);
+
+    nsresult (*GetRevision)(IUSBDeviceFilter *pThis, PRUnichar * *revision);
+    nsresult (*SetRevision)(IUSBDeviceFilter *pThis, PRUnichar * revision);
+
+    nsresult (*GetManufacturer)(IUSBDeviceFilter *pThis, PRUnichar * *manufacturer);
+    nsresult (*SetManufacturer)(IUSBDeviceFilter *pThis, PRUnichar * manufacturer);
+
+    nsresult (*GetProduct)(IUSBDeviceFilter *pThis, PRUnichar * *product);
+    nsresult (*SetProduct)(IUSBDeviceFilter *pThis, PRUnichar * product);
+
+    nsresult (*GetSerialNumber)(IUSBDeviceFilter *pThis, PRUnichar * *serialNumber);
+    nsresult (*SetSerialNumber)(IUSBDeviceFilter *pThis, PRUnichar * serialNumber);
+
+    nsresult (*GetPort)(IUSBDeviceFilter *pThis, PRUnichar * *port);
+    nsresult (*SetPort)(IUSBDeviceFilter *pThis, PRUnichar * port);
+
+    nsresult (*GetRemote)(IUSBDeviceFilter *pThis, PRUnichar * *remote);
+    nsresult (*SetRemote)(IUSBDeviceFilter *pThis, PRUnichar * remote);
+
+    nsresult (*GetMaskedInterfaces)(IUSBDeviceFilter *pThis, PRUint32 *maskedInterfaces);
+    nsresult (*SetMaskedInterfaces)(IUSBDeviceFilter *pThis, PRUint32 maskedInterfaces);
+
+};
+#define IUSBDeviceFilter_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IUSBDeviceFilter_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IUSBDeviceFilter_Release(p) ((p)->lpVtbl->Release(p))
+#define IUSBDeviceFilter_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IUSBDeviceFilter_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IUSBDeviceFilter_put_Name(p, aName) ((p)->lpVtbl->SetName(p, aName))
+#define IUSBDeviceFilter_SetName(p, aName) ((p)->lpVtbl->SetName(p, aName))
+#define IUSBDeviceFilter_get_Active(p, aActive) ((p)->lpVtbl->GetActive(p, aActive))
+#define IUSBDeviceFilter_GetActive(p, aActive) ((p)->lpVtbl->GetActive(p, aActive))
+#define IUSBDeviceFilter_put_Active(p, aActive) ((p)->lpVtbl->SetActive(p, aActive))
+#define IUSBDeviceFilter_SetActive(p, aActive) ((p)->lpVtbl->SetActive(p, aActive))
+#define IUSBDeviceFilter_get_VendorId(p, aVendorId) ((p)->lpVtbl->GetVendorId(p, aVendorId))
+#define IUSBDeviceFilter_GetVendorId(p, aVendorId) ((p)->lpVtbl->GetVendorId(p, aVendorId))
+#define IUSBDeviceFilter_put_VendorId(p, aVendorId) ((p)->lpVtbl->SetVendorId(p, aVendorId))
+#define IUSBDeviceFilter_SetVendorId(p, aVendorId) ((p)->lpVtbl->SetVendorId(p, aVendorId))
+#define IUSBDeviceFilter_get_ProductId(p, aProductId) ((p)->lpVtbl->GetProductId(p, aProductId))
+#define IUSBDeviceFilter_GetProductId(p, aProductId) ((p)->lpVtbl->GetProductId(p, aProductId))
+#define IUSBDeviceFilter_put_ProductId(p, aProductId) ((p)->lpVtbl->SetProductId(p, aProductId))
+#define IUSBDeviceFilter_SetProductId(p, aProductId) ((p)->lpVtbl->SetProductId(p, aProductId))
+#define IUSBDeviceFilter_get_Revision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IUSBDeviceFilter_GetRevision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IUSBDeviceFilter_put_Revision(p, aRevision) ((p)->lpVtbl->SetRevision(p, aRevision))
+#define IUSBDeviceFilter_SetRevision(p, aRevision) ((p)->lpVtbl->SetRevision(p, aRevision))
+#define IUSBDeviceFilter_get_Manufacturer(p, aManufacturer) ((p)->lpVtbl->GetManufacturer(p, aManufacturer))
+#define IUSBDeviceFilter_GetManufacturer(p, aManufacturer) ((p)->lpVtbl->GetManufacturer(p, aManufacturer))
+#define IUSBDeviceFilter_put_Manufacturer(p, aManufacturer) ((p)->lpVtbl->SetManufacturer(p, aManufacturer))
+#define IUSBDeviceFilter_SetManufacturer(p, aManufacturer) ((p)->lpVtbl->SetManufacturer(p, aManufacturer))
+#define IUSBDeviceFilter_get_Product(p, aProduct) ((p)->lpVtbl->GetProduct(p, aProduct))
+#define IUSBDeviceFilter_GetProduct(p, aProduct) ((p)->lpVtbl->GetProduct(p, aProduct))
+#define IUSBDeviceFilter_put_Product(p, aProduct) ((p)->lpVtbl->SetProduct(p, aProduct))
+#define IUSBDeviceFilter_SetProduct(p, aProduct) ((p)->lpVtbl->SetProduct(p, aProduct))
+#define IUSBDeviceFilter_get_SerialNumber(p, aSerialNumber) ((p)->lpVtbl->GetSerialNumber(p, aSerialNumber))
+#define IUSBDeviceFilter_GetSerialNumber(p, aSerialNumber) ((p)->lpVtbl->GetSerialNumber(p, aSerialNumber))
+#define IUSBDeviceFilter_put_SerialNumber(p, aSerialNumber) ((p)->lpVtbl->SetSerialNumber(p, aSerialNumber))
+#define IUSBDeviceFilter_SetSerialNumber(p, aSerialNumber) ((p)->lpVtbl->SetSerialNumber(p, aSerialNumber))
+#define IUSBDeviceFilter_get_Port(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IUSBDeviceFilter_GetPort(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IUSBDeviceFilter_put_Port(p, aPort) ((p)->lpVtbl->SetPort(p, aPort))
+#define IUSBDeviceFilter_SetPort(p, aPort) ((p)->lpVtbl->SetPort(p, aPort))
+#define IUSBDeviceFilter_get_Remote(p, aRemote) ((p)->lpVtbl->GetRemote(p, aRemote))
+#define IUSBDeviceFilter_GetRemote(p, aRemote) ((p)->lpVtbl->GetRemote(p, aRemote))
+#define IUSBDeviceFilter_put_Remote(p, aRemote) ((p)->lpVtbl->SetRemote(p, aRemote))
+#define IUSBDeviceFilter_SetRemote(p, aRemote) ((p)->lpVtbl->SetRemote(p, aRemote))
+#define IUSBDeviceFilter_get_MaskedInterfaces(p, aMaskedInterfaces) ((p)->lpVtbl->GetMaskedInterfaces(p, aMaskedInterfaces))
+#define IUSBDeviceFilter_GetMaskedInterfaces(p, aMaskedInterfaces) ((p)->lpVtbl->GetMaskedInterfaces(p, aMaskedInterfaces))
+#define IUSBDeviceFilter_put_MaskedInterfaces(p, aMaskedInterfaces) ((p)->lpVtbl->SetMaskedInterfaces(p, aMaskedInterfaces))
+#define IUSBDeviceFilter_SetMaskedInterfaces(p, aMaskedInterfaces) ((p)->lpVtbl->SetMaskedInterfaces(p, aMaskedInterfaces))
+#endif /* VBOX_WITH_GLUE */
+
+interface IUSBDeviceFilter
+{
+#ifndef VBOX_WITH_GLUE
+    struct IUSBDeviceFilter_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IUSBDeviceFilterVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IUSBDeviceFilter declaration */
+
+
+/* Start of struct IHostUSBDevice declaration */
+#define IHOSTUSBDEVICE_IID_STR "173b4b44-d268-4334-a00d-b6521c9a740a"
+#define IHOSTUSBDEVICE_IID { \
+    0x173b4b44, 0xd268, 0x4334, \
+    { 0xa0, 0x0d, 0xb6, 0x52, 0x1c, 0x9a, 0x74, 0x0a } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IHostUSBDevice);
+#ifndef VBOX_WITH_GLUE
+struct IHostUSBDevice_vtbl
+{
+    struct IUSBDevice_vtbl iusbdevice;
+
+    nsresult (*GetState)(IHostUSBDevice *pThis, PRUint32 *state);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IHostUSBDeviceVtbl
+{
+    nsresult (*QueryInterface)(IHostUSBDevice *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IHostUSBDevice *pThis);
+    nsrefcnt (*Release)(IHostUSBDevice *pThis);
+    nsresult (*GetId)(IHostUSBDevice *pThis, PRUnichar * *id);
+
+    nsresult (*GetVendorId)(IHostUSBDevice *pThis, PRUint16 *vendorId);
+
+    nsresult (*GetProductId)(IHostUSBDevice *pThis, PRUint16 *productId);
+
+    nsresult (*GetRevision)(IHostUSBDevice *pThis, PRUint16 *revision);
+
+    nsresult (*GetManufacturer)(IHostUSBDevice *pThis, PRUnichar * *manufacturer);
+
+    nsresult (*GetProduct)(IHostUSBDevice *pThis, PRUnichar * *product);
+
+    nsresult (*GetSerialNumber)(IHostUSBDevice *pThis, PRUnichar * *serialNumber);
+
+    nsresult (*GetAddress)(IHostUSBDevice *pThis, PRUnichar * *address);
+
+    nsresult (*GetPort)(IHostUSBDevice *pThis, PRUint16 *port);
+
+    nsresult (*GetVersion)(IHostUSBDevice *pThis, PRUint16 *version);
+
+    nsresult (*GetPortVersion)(IHostUSBDevice *pThis, PRUint16 *portVersion);
+
+    nsresult (*GetRemote)(IHostUSBDevice *pThis, PRBool *remote);
+
+    nsresult (*GetState)(IHostUSBDevice *pThis, PRUint32 *state);
+
+};
+#define IHostUSBDevice_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IHostUSBDevice_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IHostUSBDevice_Release(p) ((p)->lpVtbl->Release(p))
+#define IHostUSBDevice_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IHostUSBDevice_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IHostUSBDevice_get_VendorId(p, aVendorId) ((p)->lpVtbl->GetVendorId(p, aVendorId))
+#define IHostUSBDevice_GetVendorId(p, aVendorId) ((p)->lpVtbl->GetVendorId(p, aVendorId))
+#define IHostUSBDevice_get_ProductId(p, aProductId) ((p)->lpVtbl->GetProductId(p, aProductId))
+#define IHostUSBDevice_GetProductId(p, aProductId) ((p)->lpVtbl->GetProductId(p, aProductId))
+#define IHostUSBDevice_get_Revision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IHostUSBDevice_GetRevision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IHostUSBDevice_get_Manufacturer(p, aManufacturer) ((p)->lpVtbl->GetManufacturer(p, aManufacturer))
+#define IHostUSBDevice_GetManufacturer(p, aManufacturer) ((p)->lpVtbl->GetManufacturer(p, aManufacturer))
+#define IHostUSBDevice_get_Product(p, aProduct) ((p)->lpVtbl->GetProduct(p, aProduct))
+#define IHostUSBDevice_GetProduct(p, aProduct) ((p)->lpVtbl->GetProduct(p, aProduct))
+#define IHostUSBDevice_get_SerialNumber(p, aSerialNumber) ((p)->lpVtbl->GetSerialNumber(p, aSerialNumber))
+#define IHostUSBDevice_GetSerialNumber(p, aSerialNumber) ((p)->lpVtbl->GetSerialNumber(p, aSerialNumber))
+#define IHostUSBDevice_get_Address(p, aAddress) ((p)->lpVtbl->GetAddress(p, aAddress))
+#define IHostUSBDevice_GetAddress(p, aAddress) ((p)->lpVtbl->GetAddress(p, aAddress))
+#define IHostUSBDevice_get_Port(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IHostUSBDevice_GetPort(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IHostUSBDevice_get_Version(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IHostUSBDevice_GetVersion(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IHostUSBDevice_get_PortVersion(p, aPortVersion) ((p)->lpVtbl->GetPortVersion(p, aPortVersion))
+#define IHostUSBDevice_GetPortVersion(p, aPortVersion) ((p)->lpVtbl->GetPortVersion(p, aPortVersion))
+#define IHostUSBDevice_get_Remote(p, aRemote) ((p)->lpVtbl->GetRemote(p, aRemote))
+#define IHostUSBDevice_GetRemote(p, aRemote) ((p)->lpVtbl->GetRemote(p, aRemote))
+#define IHostUSBDevice_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IHostUSBDevice_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#endif /* VBOX_WITH_GLUE */
+
+interface IHostUSBDevice
+{
+#ifndef VBOX_WITH_GLUE
+    struct IHostUSBDevice_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IHostUSBDeviceVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IHostUSBDevice declaration */
+
+
+/* Start of struct IHostUSBDeviceFilter declaration */
+#define IHOSTUSBDEVICEFILTER_IID_STR "4cc70246-d74a-400f-8222-3900489c0374"
+#define IHOSTUSBDEVICEFILTER_IID { \
+    0x4cc70246, 0xd74a, 0x400f, \
+    { 0x82, 0x22, 0x39, 0x00, 0x48, 0x9c, 0x03, 0x74 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IHostUSBDeviceFilter);
+#ifndef VBOX_WITH_GLUE
+struct IHostUSBDeviceFilter_vtbl
+{
+    struct IUSBDeviceFilter_vtbl iusbdevicefilter;
+
+    nsresult (*GetAction)(IHostUSBDeviceFilter *pThis, PRUint32 *action);
+    nsresult (*SetAction)(IHostUSBDeviceFilter *pThis, PRUint32 action);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IHostUSBDeviceFilterVtbl
+{
+    nsresult (*QueryInterface)(IHostUSBDeviceFilter *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IHostUSBDeviceFilter *pThis);
+    nsrefcnt (*Release)(IHostUSBDeviceFilter *pThis);
+    nsresult (*GetName)(IHostUSBDeviceFilter *pThis, PRUnichar * *name);
+    nsresult (*SetName)(IHostUSBDeviceFilter *pThis, PRUnichar * name);
+
+    nsresult (*GetActive)(IHostUSBDeviceFilter *pThis, PRBool *active);
+    nsresult (*SetActive)(IHostUSBDeviceFilter *pThis, PRBool active);
+
+    nsresult (*GetVendorId)(IHostUSBDeviceFilter *pThis, PRUnichar * *vendorId);
+    nsresult (*SetVendorId)(IHostUSBDeviceFilter *pThis, PRUnichar * vendorId);
+
+    nsresult (*GetProductId)(IHostUSBDeviceFilter *pThis, PRUnichar * *productId);
+    nsresult (*SetProductId)(IHostUSBDeviceFilter *pThis, PRUnichar * productId);
+
+    nsresult (*GetRevision)(IHostUSBDeviceFilter *pThis, PRUnichar * *revision);
+    nsresult (*SetRevision)(IHostUSBDeviceFilter *pThis, PRUnichar * revision);
+
+    nsresult (*GetManufacturer)(IHostUSBDeviceFilter *pThis, PRUnichar * *manufacturer);
+    nsresult (*SetManufacturer)(IHostUSBDeviceFilter *pThis, PRUnichar * manufacturer);
+
+    nsresult (*GetProduct)(IHostUSBDeviceFilter *pThis, PRUnichar * *product);
+    nsresult (*SetProduct)(IHostUSBDeviceFilter *pThis, PRUnichar * product);
+
+    nsresult (*GetSerialNumber)(IHostUSBDeviceFilter *pThis, PRUnichar * *serialNumber);
+    nsresult (*SetSerialNumber)(IHostUSBDeviceFilter *pThis, PRUnichar * serialNumber);
+
+    nsresult (*GetPort)(IHostUSBDeviceFilter *pThis, PRUnichar * *port);
+    nsresult (*SetPort)(IHostUSBDeviceFilter *pThis, PRUnichar * port);
+
+    nsresult (*GetRemote)(IHostUSBDeviceFilter *pThis, PRUnichar * *remote);
+    nsresult (*SetRemote)(IHostUSBDeviceFilter *pThis, PRUnichar * remote);
+
+    nsresult (*GetMaskedInterfaces)(IHostUSBDeviceFilter *pThis, PRUint32 *maskedInterfaces);
+    nsresult (*SetMaskedInterfaces)(IHostUSBDeviceFilter *pThis, PRUint32 maskedInterfaces);
+
+    nsresult (*GetAction)(IHostUSBDeviceFilter *pThis, PRUint32 *action);
+    nsresult (*SetAction)(IHostUSBDeviceFilter *pThis, PRUint32 action);
+
+};
+#define IHostUSBDeviceFilter_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IHostUSBDeviceFilter_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IHostUSBDeviceFilter_Release(p) ((p)->lpVtbl->Release(p))
+#define IHostUSBDeviceFilter_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IHostUSBDeviceFilter_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IHostUSBDeviceFilter_put_Name(p, aName) ((p)->lpVtbl->SetName(p, aName))
+#define IHostUSBDeviceFilter_SetName(p, aName) ((p)->lpVtbl->SetName(p, aName))
+#define IHostUSBDeviceFilter_get_Active(p, aActive) ((p)->lpVtbl->GetActive(p, aActive))
+#define IHostUSBDeviceFilter_GetActive(p, aActive) ((p)->lpVtbl->GetActive(p, aActive))
+#define IHostUSBDeviceFilter_put_Active(p, aActive) ((p)->lpVtbl->SetActive(p, aActive))
+#define IHostUSBDeviceFilter_SetActive(p, aActive) ((p)->lpVtbl->SetActive(p, aActive))
+#define IHostUSBDeviceFilter_get_VendorId(p, aVendorId) ((p)->lpVtbl->GetVendorId(p, aVendorId))
+#define IHostUSBDeviceFilter_GetVendorId(p, aVendorId) ((p)->lpVtbl->GetVendorId(p, aVendorId))
+#define IHostUSBDeviceFilter_put_VendorId(p, aVendorId) ((p)->lpVtbl->SetVendorId(p, aVendorId))
+#define IHostUSBDeviceFilter_SetVendorId(p, aVendorId) ((p)->lpVtbl->SetVendorId(p, aVendorId))
+#define IHostUSBDeviceFilter_get_ProductId(p, aProductId) ((p)->lpVtbl->GetProductId(p, aProductId))
+#define IHostUSBDeviceFilter_GetProductId(p, aProductId) ((p)->lpVtbl->GetProductId(p, aProductId))
+#define IHostUSBDeviceFilter_put_ProductId(p, aProductId) ((p)->lpVtbl->SetProductId(p, aProductId))
+#define IHostUSBDeviceFilter_SetProductId(p, aProductId) ((p)->lpVtbl->SetProductId(p, aProductId))
+#define IHostUSBDeviceFilter_get_Revision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IHostUSBDeviceFilter_GetRevision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IHostUSBDeviceFilter_put_Revision(p, aRevision) ((p)->lpVtbl->SetRevision(p, aRevision))
+#define IHostUSBDeviceFilter_SetRevision(p, aRevision) ((p)->lpVtbl->SetRevision(p, aRevision))
+#define IHostUSBDeviceFilter_get_Manufacturer(p, aManufacturer) ((p)->lpVtbl->GetManufacturer(p, aManufacturer))
+#define IHostUSBDeviceFilter_GetManufacturer(p, aManufacturer) ((p)->lpVtbl->GetManufacturer(p, aManufacturer))
+#define IHostUSBDeviceFilter_put_Manufacturer(p, aManufacturer) ((p)->lpVtbl->SetManufacturer(p, aManufacturer))
+#define IHostUSBDeviceFilter_SetManufacturer(p, aManufacturer) ((p)->lpVtbl->SetManufacturer(p, aManufacturer))
+#define IHostUSBDeviceFilter_get_Product(p, aProduct) ((p)->lpVtbl->GetProduct(p, aProduct))
+#define IHostUSBDeviceFilter_GetProduct(p, aProduct) ((p)->lpVtbl->GetProduct(p, aProduct))
+#define IHostUSBDeviceFilter_put_Product(p, aProduct) ((p)->lpVtbl->SetProduct(p, aProduct))
+#define IHostUSBDeviceFilter_SetProduct(p, aProduct) ((p)->lpVtbl->SetProduct(p, aProduct))
+#define IHostUSBDeviceFilter_get_SerialNumber(p, aSerialNumber) ((p)->lpVtbl->GetSerialNumber(p, aSerialNumber))
+#define IHostUSBDeviceFilter_GetSerialNumber(p, aSerialNumber) ((p)->lpVtbl->GetSerialNumber(p, aSerialNumber))
+#define IHostUSBDeviceFilter_put_SerialNumber(p, aSerialNumber) ((p)->lpVtbl->SetSerialNumber(p, aSerialNumber))
+#define IHostUSBDeviceFilter_SetSerialNumber(p, aSerialNumber) ((p)->lpVtbl->SetSerialNumber(p, aSerialNumber))
+#define IHostUSBDeviceFilter_get_Port(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IHostUSBDeviceFilter_GetPort(p, aPort) ((p)->lpVtbl->GetPort(p, aPort))
+#define IHostUSBDeviceFilter_put_Port(p, aPort) ((p)->lpVtbl->SetPort(p, aPort))
+#define IHostUSBDeviceFilter_SetPort(p, aPort) ((p)->lpVtbl->SetPort(p, aPort))
+#define IHostUSBDeviceFilter_get_Remote(p, aRemote) ((p)->lpVtbl->GetRemote(p, aRemote))
+#define IHostUSBDeviceFilter_GetRemote(p, aRemote) ((p)->lpVtbl->GetRemote(p, aRemote))
+#define IHostUSBDeviceFilter_put_Remote(p, aRemote) ((p)->lpVtbl->SetRemote(p, aRemote))
+#define IHostUSBDeviceFilter_SetRemote(p, aRemote) ((p)->lpVtbl->SetRemote(p, aRemote))
+#define IHostUSBDeviceFilter_get_MaskedInterfaces(p, aMaskedInterfaces) ((p)->lpVtbl->GetMaskedInterfaces(p, aMaskedInterfaces))
+#define IHostUSBDeviceFilter_GetMaskedInterfaces(p, aMaskedInterfaces) ((p)->lpVtbl->GetMaskedInterfaces(p, aMaskedInterfaces))
+#define IHostUSBDeviceFilter_put_MaskedInterfaces(p, aMaskedInterfaces) ((p)->lpVtbl->SetMaskedInterfaces(p, aMaskedInterfaces))
+#define IHostUSBDeviceFilter_SetMaskedInterfaces(p, aMaskedInterfaces) ((p)->lpVtbl->SetMaskedInterfaces(p, aMaskedInterfaces))
+#define IHostUSBDeviceFilter_get_Action(p, aAction) ((p)->lpVtbl->GetAction(p, aAction))
+#define IHostUSBDeviceFilter_GetAction(p, aAction) ((p)->lpVtbl->GetAction(p, aAction))
+#define IHostUSBDeviceFilter_put_Action(p, aAction) ((p)->lpVtbl->SetAction(p, aAction))
+#define IHostUSBDeviceFilter_SetAction(p, aAction) ((p)->lpVtbl->SetAction(p, aAction))
+#endif /* VBOX_WITH_GLUE */
+
+interface IHostUSBDeviceFilter
+{
+#ifndef VBOX_WITH_GLUE
+    struct IHostUSBDeviceFilter_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IHostUSBDeviceFilterVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IHostUSBDeviceFilter declaration */
+
+
+/* Start of struct IAudioAdapter declaration */
+#define IAUDIOADAPTER_IID_STR "921873db-5f3f-4b69-91f9-7be9e535a2cb"
+#define IAUDIOADAPTER_IID { \
+    0x921873db, 0x5f3f, 0x4b69, \
+    { 0x91, 0xf9, 0x7b, 0xe9, 0xe5, 0x35, 0xa2, 0xcb } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IAudioAdapter);
+#ifndef VBOX_WITH_GLUE
+struct IAudioAdapter_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEnabled)(IAudioAdapter *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(IAudioAdapter *pThis, PRBool enabled);
+
+    nsresult (*GetAudioController)(IAudioAdapter *pThis, PRUint32 *audioController);
+    nsresult (*SetAudioController)(IAudioAdapter *pThis, PRUint32 audioController);
+
+    nsresult (*GetAudioDriver)(IAudioAdapter *pThis, PRUint32 *audioDriver);
+    nsresult (*SetAudioDriver)(IAudioAdapter *pThis, PRUint32 audioDriver);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IAudioAdapterVtbl
+{
+    nsresult (*QueryInterface)(IAudioAdapter *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IAudioAdapter *pThis);
+    nsrefcnt (*Release)(IAudioAdapter *pThis);
+    nsresult (*GetEnabled)(IAudioAdapter *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(IAudioAdapter *pThis, PRBool enabled);
+
+    nsresult (*GetAudioController)(IAudioAdapter *pThis, PRUint32 *audioController);
+    nsresult (*SetAudioController)(IAudioAdapter *pThis, PRUint32 audioController);
+
+    nsresult (*GetAudioDriver)(IAudioAdapter *pThis, PRUint32 *audioDriver);
+    nsresult (*SetAudioDriver)(IAudioAdapter *pThis, PRUint32 audioDriver);
+
+};
+#define IAudioAdapter_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IAudioAdapter_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IAudioAdapter_Release(p) ((p)->lpVtbl->Release(p))
+#define IAudioAdapter_get_Enabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define IAudioAdapter_GetEnabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define IAudioAdapter_put_Enabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define IAudioAdapter_SetEnabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define IAudioAdapter_get_AudioController(p, aAudioController) ((p)->lpVtbl->GetAudioController(p, aAudioController))
+#define IAudioAdapter_GetAudioController(p, aAudioController) ((p)->lpVtbl->GetAudioController(p, aAudioController))
+#define IAudioAdapter_put_AudioController(p, aAudioController) ((p)->lpVtbl->SetAudioController(p, aAudioController))
+#define IAudioAdapter_SetAudioController(p, aAudioController) ((p)->lpVtbl->SetAudioController(p, aAudioController))
+#define IAudioAdapter_get_AudioDriver(p, aAudioDriver) ((p)->lpVtbl->GetAudioDriver(p, aAudioDriver))
+#define IAudioAdapter_GetAudioDriver(p, aAudioDriver) ((p)->lpVtbl->GetAudioDriver(p, aAudioDriver))
+#define IAudioAdapter_put_AudioDriver(p, aAudioDriver) ((p)->lpVtbl->SetAudioDriver(p, aAudioDriver))
+#define IAudioAdapter_SetAudioDriver(p, aAudioDriver) ((p)->lpVtbl->SetAudioDriver(p, aAudioDriver))
+#endif /* VBOX_WITH_GLUE */
+
+interface IAudioAdapter
+{
+#ifndef VBOX_WITH_GLUE
+    struct IAudioAdapter_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IAudioAdapterVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IAudioAdapter declaration */
+
+
+/* Start of struct IVRDEServer declaration */
+#define IVRDESERVER_IID_STR "d38de40a-c2c1-4e95-b5a4-167b05f5694c"
+#define IVRDESERVER_IID { \
+    0xd38de40a, 0xc2c1, 0x4e95, \
+    { 0xb5, 0xa4, 0x16, 0x7b, 0x05, 0xf5, 0x69, 0x4c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVRDEServer);
+#ifndef VBOX_WITH_GLUE
+struct IVRDEServer_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetEnabled)(IVRDEServer *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(IVRDEServer *pThis, PRBool enabled);
+
+    nsresult (*GetAuthType)(IVRDEServer *pThis, PRUint32 *authType);
+    nsresult (*SetAuthType)(IVRDEServer *pThis, PRUint32 authType);
+
+    nsresult (*GetAuthTimeout)(IVRDEServer *pThis, PRUint32 *authTimeout);
+    nsresult (*SetAuthTimeout)(IVRDEServer *pThis, PRUint32 authTimeout);
+
+    nsresult (*GetAllowMultiConnection)(IVRDEServer *pThis, PRBool *allowMultiConnection);
+    nsresult (*SetAllowMultiConnection)(IVRDEServer *pThis, PRBool allowMultiConnection);
+
+    nsresult (*GetReuseSingleConnection)(IVRDEServer *pThis, PRBool *reuseSingleConnection);
+    nsresult (*SetReuseSingleConnection)(IVRDEServer *pThis, PRBool reuseSingleConnection);
+
+    nsresult (*GetVRDEExtPack)(IVRDEServer *pThis, PRUnichar * *VRDEExtPack);
+    nsresult (*SetVRDEExtPack)(IVRDEServer *pThis, PRUnichar * VRDEExtPack);
+
+    nsresult (*GetAuthLibrary)(IVRDEServer *pThis, PRUnichar * *authLibrary);
+    nsresult (*SetAuthLibrary)(IVRDEServer *pThis, PRUnichar * authLibrary);
+
+    nsresult (*GetVRDEProperties)(IVRDEServer *pThis, PRUint32 *VRDEPropertiesSize, PRUnichar * **VRDEProperties);
+
+    nsresult (*SetVRDEProperty)(
+        IVRDEServer *pThis,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*GetVRDEProperty)(
+        IVRDEServer *pThis,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVRDEServerVtbl
+{
+    nsresult (*QueryInterface)(IVRDEServer *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVRDEServer *pThis);
+    nsrefcnt (*Release)(IVRDEServer *pThis);
+    nsresult (*GetEnabled)(IVRDEServer *pThis, PRBool *enabled);
+    nsresult (*SetEnabled)(IVRDEServer *pThis, PRBool enabled);
+
+    nsresult (*GetAuthType)(IVRDEServer *pThis, PRUint32 *authType);
+    nsresult (*SetAuthType)(IVRDEServer *pThis, PRUint32 authType);
+
+    nsresult (*GetAuthTimeout)(IVRDEServer *pThis, PRUint32 *authTimeout);
+    nsresult (*SetAuthTimeout)(IVRDEServer *pThis, PRUint32 authTimeout);
+
+    nsresult (*GetAllowMultiConnection)(IVRDEServer *pThis, PRBool *allowMultiConnection);
+    nsresult (*SetAllowMultiConnection)(IVRDEServer *pThis, PRBool allowMultiConnection);
+
+    nsresult (*GetReuseSingleConnection)(IVRDEServer *pThis, PRBool *reuseSingleConnection);
+    nsresult (*SetReuseSingleConnection)(IVRDEServer *pThis, PRBool reuseSingleConnection);
+
+    nsresult (*GetVRDEExtPack)(IVRDEServer *pThis, PRUnichar * *VRDEExtPack);
+    nsresult (*SetVRDEExtPack)(IVRDEServer *pThis, PRUnichar * VRDEExtPack);
+
+    nsresult (*GetAuthLibrary)(IVRDEServer *pThis, PRUnichar * *authLibrary);
+    nsresult (*SetAuthLibrary)(IVRDEServer *pThis, PRUnichar * authLibrary);
+
+    nsresult (*GetVRDEProperties)(IVRDEServer *pThis, PRUint32 *VRDEPropertiesSize, PRUnichar * **VRDEProperties);
+
+    nsresult (*SetVRDEProperty)(
+        IVRDEServer *pThis,
+        PRUnichar * key,
+        PRUnichar * value
+    );
+
+    nsresult (*GetVRDEProperty)(
+        IVRDEServer *pThis,
+        PRUnichar * key,
+        PRUnichar * * value
+    );
+
+};
+#define IVRDEServer_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVRDEServer_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVRDEServer_Release(p) ((p)->lpVtbl->Release(p))
+#define IVRDEServer_get_Enabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define IVRDEServer_GetEnabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define IVRDEServer_put_Enabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define IVRDEServer_SetEnabled(p, aEnabled) ((p)->lpVtbl->SetEnabled(p, aEnabled))
+#define IVRDEServer_get_AuthType(p, aAuthType) ((p)->lpVtbl->GetAuthType(p, aAuthType))
+#define IVRDEServer_GetAuthType(p, aAuthType) ((p)->lpVtbl->GetAuthType(p, aAuthType))
+#define IVRDEServer_put_AuthType(p, aAuthType) ((p)->lpVtbl->SetAuthType(p, aAuthType))
+#define IVRDEServer_SetAuthType(p, aAuthType) ((p)->lpVtbl->SetAuthType(p, aAuthType))
+#define IVRDEServer_get_AuthTimeout(p, aAuthTimeout) ((p)->lpVtbl->GetAuthTimeout(p, aAuthTimeout))
+#define IVRDEServer_GetAuthTimeout(p, aAuthTimeout) ((p)->lpVtbl->GetAuthTimeout(p, aAuthTimeout))
+#define IVRDEServer_put_AuthTimeout(p, aAuthTimeout) ((p)->lpVtbl->SetAuthTimeout(p, aAuthTimeout))
+#define IVRDEServer_SetAuthTimeout(p, aAuthTimeout) ((p)->lpVtbl->SetAuthTimeout(p, aAuthTimeout))
+#define IVRDEServer_get_AllowMultiConnection(p, aAllowMultiConnection) ((p)->lpVtbl->GetAllowMultiConnection(p, aAllowMultiConnection))
+#define IVRDEServer_GetAllowMultiConnection(p, aAllowMultiConnection) ((p)->lpVtbl->GetAllowMultiConnection(p, aAllowMultiConnection))
+#define IVRDEServer_put_AllowMultiConnection(p, aAllowMultiConnection) ((p)->lpVtbl->SetAllowMultiConnection(p, aAllowMultiConnection))
+#define IVRDEServer_SetAllowMultiConnection(p, aAllowMultiConnection) ((p)->lpVtbl->SetAllowMultiConnection(p, aAllowMultiConnection))
+#define IVRDEServer_get_ReuseSingleConnection(p, aReuseSingleConnection) ((p)->lpVtbl->GetReuseSingleConnection(p, aReuseSingleConnection))
+#define IVRDEServer_GetReuseSingleConnection(p, aReuseSingleConnection) ((p)->lpVtbl->GetReuseSingleConnection(p, aReuseSingleConnection))
+#define IVRDEServer_put_ReuseSingleConnection(p, aReuseSingleConnection) ((p)->lpVtbl->SetReuseSingleConnection(p, aReuseSingleConnection))
+#define IVRDEServer_SetReuseSingleConnection(p, aReuseSingleConnection) ((p)->lpVtbl->SetReuseSingleConnection(p, aReuseSingleConnection))
+#define IVRDEServer_get_VRDEExtPack(p, aVRDEExtPack) ((p)->lpVtbl->GetVRDEExtPack(p, aVRDEExtPack))
+#define IVRDEServer_GetVRDEExtPack(p, aVRDEExtPack) ((p)->lpVtbl->GetVRDEExtPack(p, aVRDEExtPack))
+#define IVRDEServer_put_VRDEExtPack(p, aVRDEExtPack) ((p)->lpVtbl->SetVRDEExtPack(p, aVRDEExtPack))
+#define IVRDEServer_SetVRDEExtPack(p, aVRDEExtPack) ((p)->lpVtbl->SetVRDEExtPack(p, aVRDEExtPack))
+#define IVRDEServer_get_AuthLibrary(p, aAuthLibrary) ((p)->lpVtbl->GetAuthLibrary(p, aAuthLibrary))
+#define IVRDEServer_GetAuthLibrary(p, aAuthLibrary) ((p)->lpVtbl->GetAuthLibrary(p, aAuthLibrary))
+#define IVRDEServer_put_AuthLibrary(p, aAuthLibrary) ((p)->lpVtbl->SetAuthLibrary(p, aAuthLibrary))
+#define IVRDEServer_SetAuthLibrary(p, aAuthLibrary) ((p)->lpVtbl->SetAuthLibrary(p, aAuthLibrary))
+#define IVRDEServer_get_VRDEProperties(p, aVRDEProperties) ((p)->lpVtbl->GetVRDEProperties(p, aVRDEProperties))
+#define IVRDEServer_GetVRDEProperties(p, aVRDEProperties) ((p)->lpVtbl->GetVRDEProperties(p, aVRDEProperties))
+#define IVRDEServer_SetVRDEProperty(p, aKey, aValue) ((p)->lpVtbl->SetVRDEProperty(p, aKey, aValue))
+#define IVRDEServer_GetVRDEProperty(p, aKey, aValue) ((p)->lpVtbl->GetVRDEProperty(p, aKey, aValue))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVRDEServer
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVRDEServer_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVRDEServerVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVRDEServer declaration */
+
+
+/* Start of struct ISharedFolder declaration */
+#define ISHAREDFOLDER_IID_STR "8388da11-b559-4574-a5b7-2bd7acd5cef8"
+#define ISHAREDFOLDER_IID { \
+    0x8388da11, 0xb559, 0x4574, \
+    { 0xa5, 0xb7, 0x2b, 0xd7, 0xac, 0xd5, 0xce, 0xf8 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISharedFolder);
+#ifndef VBOX_WITH_GLUE
+struct ISharedFolder_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(ISharedFolder *pThis, PRUnichar * *name);
+
+    nsresult (*GetHostPath)(ISharedFolder *pThis, PRUnichar * *hostPath);
+
+    nsresult (*GetAccessible)(ISharedFolder *pThis, PRBool *accessible);
+
+    nsresult (*GetWritable)(ISharedFolder *pThis, PRBool *writable);
+
+    nsresult (*GetAutoMount)(ISharedFolder *pThis, PRBool *autoMount);
+
+    nsresult (*GetLastAccessError)(ISharedFolder *pThis, PRUnichar * *lastAccessError);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISharedFolderVtbl
+{
+    nsresult (*QueryInterface)(ISharedFolder *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISharedFolder *pThis);
+    nsrefcnt (*Release)(ISharedFolder *pThis);
+    nsresult (*GetName)(ISharedFolder *pThis, PRUnichar * *name);
+
+    nsresult (*GetHostPath)(ISharedFolder *pThis, PRUnichar * *hostPath);
+
+    nsresult (*GetAccessible)(ISharedFolder *pThis, PRBool *accessible);
+
+    nsresult (*GetWritable)(ISharedFolder *pThis, PRBool *writable);
+
+    nsresult (*GetAutoMount)(ISharedFolder *pThis, PRBool *autoMount);
+
+    nsresult (*GetLastAccessError)(ISharedFolder *pThis, PRUnichar * *lastAccessError);
+
+};
+#define ISharedFolder_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISharedFolder_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISharedFolder_Release(p) ((p)->lpVtbl->Release(p))
+#define ISharedFolder_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define ISharedFolder_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define ISharedFolder_get_HostPath(p, aHostPath) ((p)->lpVtbl->GetHostPath(p, aHostPath))
+#define ISharedFolder_GetHostPath(p, aHostPath) ((p)->lpVtbl->GetHostPath(p, aHostPath))
+#define ISharedFolder_get_Accessible(p, aAccessible) ((p)->lpVtbl->GetAccessible(p, aAccessible))
+#define ISharedFolder_GetAccessible(p, aAccessible) ((p)->lpVtbl->GetAccessible(p, aAccessible))
+#define ISharedFolder_get_Writable(p, aWritable) ((p)->lpVtbl->GetWritable(p, aWritable))
+#define ISharedFolder_GetWritable(p, aWritable) ((p)->lpVtbl->GetWritable(p, aWritable))
+#define ISharedFolder_get_AutoMount(p, aAutoMount) ((p)->lpVtbl->GetAutoMount(p, aAutoMount))
+#define ISharedFolder_GetAutoMount(p, aAutoMount) ((p)->lpVtbl->GetAutoMount(p, aAutoMount))
+#define ISharedFolder_get_LastAccessError(p, aLastAccessError) ((p)->lpVtbl->GetLastAccessError(p, aLastAccessError))
+#define ISharedFolder_GetLastAccessError(p, aLastAccessError) ((p)->lpVtbl->GetLastAccessError(p, aLastAccessError))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISharedFolder
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISharedFolder_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISharedFolderVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISharedFolder declaration */
+
+
+/* Start of struct ISession declaration */
+#define ISESSION_IID_STR "12F4DCDB-12B2-4EC1-B7CD-DDD9F6C5BF4D"
+#define ISESSION_IID { \
+    0x12F4DCDB, 0x12B2, 0x4EC1, \
+    { 0xB7, 0xCD, 0xDD, 0xD9, 0xF6, 0xC5, 0xBF, 0x4D } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISession);
+#ifndef VBOX_WITH_GLUE
+struct ISession_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetState)(ISession *pThis, PRUint32 *state);
+
+    nsresult (*GetType)(ISession *pThis, PRUint32 *type);
+
+    nsresult (*GetMachine)(ISession *pThis, IMachine * *machine);
+
+    nsresult (*GetConsole)(ISession *pThis, IConsole * *console);
+
+    nsresult (*UnlockMachine)(ISession *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISessionVtbl
+{
+    nsresult (*QueryInterface)(ISession *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISession *pThis);
+    nsrefcnt (*Release)(ISession *pThis);
+    nsresult (*GetState)(ISession *pThis, PRUint32 *state);
+
+    nsresult (*GetType)(ISession *pThis, PRUint32 *type);
+
+    nsresult (*GetMachine)(ISession *pThis, IMachine * *machine);
+
+    nsresult (*GetConsole)(ISession *pThis, IConsole * *console);
+
+    nsresult (*UnlockMachine)(ISession *pThis );
+
+};
+#define ISession_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISession_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISession_Release(p) ((p)->lpVtbl->Release(p))
+#define ISession_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define ISession_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define ISession_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISession_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISession_get_Machine(p, aMachine) ((p)->lpVtbl->GetMachine(p, aMachine))
+#define ISession_GetMachine(p, aMachine) ((p)->lpVtbl->GetMachine(p, aMachine))
+#define ISession_get_Console(p, aConsole) ((p)->lpVtbl->GetConsole(p, aConsole))
+#define ISession_GetConsole(p, aConsole) ((p)->lpVtbl->GetConsole(p, aConsole))
+#define ISession_UnlockMachine(p) ((p)->lpVtbl->UnlockMachine(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISession
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISession_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISessionVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISession declaration */
+
+
+/* Start of struct IStorageController declaration */
+#define ISTORAGECONTROLLER_IID_STR "a1556333-09b6-46d9-bfb7-fc239b7fbe1e"
+#define ISTORAGECONTROLLER_IID { \
+    0xa1556333, 0x09b6, 0x46d9, \
+    { 0xbf, 0xb7, 0xfc, 0x23, 0x9b, 0x7f, 0xbe, 0x1e } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IStorageController);
+#ifndef VBOX_WITH_GLUE
+struct IStorageController_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IStorageController *pThis, PRUnichar * *name);
+
+    nsresult (*GetMaxDevicesPerPortCount)(IStorageController *pThis, PRUint32 *maxDevicesPerPortCount);
+
+    nsresult (*GetMinPortCount)(IStorageController *pThis, PRUint32 *minPortCount);
+
+    nsresult (*GetMaxPortCount)(IStorageController *pThis, PRUint32 *maxPortCount);
+
+    nsresult (*GetInstance)(IStorageController *pThis, PRUint32 *instance);
+    nsresult (*SetInstance)(IStorageController *pThis, PRUint32 instance);
+
+    nsresult (*GetPortCount)(IStorageController *pThis, PRUint32 *portCount);
+    nsresult (*SetPortCount)(IStorageController *pThis, PRUint32 portCount);
+
+    nsresult (*GetBus)(IStorageController *pThis, PRUint32 *bus);
+
+    nsresult (*GetControllerType)(IStorageController *pThis, PRUint32 *controllerType);
+    nsresult (*SetControllerType)(IStorageController *pThis, PRUint32 controllerType);
+
+    nsresult (*GetUseHostIOCache)(IStorageController *pThis, PRBool *useHostIOCache);
+    nsresult (*SetUseHostIOCache)(IStorageController *pThis, PRBool useHostIOCache);
+
+    nsresult (*GetBootable)(IStorageController *pThis, PRBool *bootable);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IStorageControllerVtbl
+{
+    nsresult (*QueryInterface)(IStorageController *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IStorageController *pThis);
+    nsrefcnt (*Release)(IStorageController *pThis);
+    nsresult (*GetName)(IStorageController *pThis, PRUnichar * *name);
+
+    nsresult (*GetMaxDevicesPerPortCount)(IStorageController *pThis, PRUint32 *maxDevicesPerPortCount);
+
+    nsresult (*GetMinPortCount)(IStorageController *pThis, PRUint32 *minPortCount);
+
+    nsresult (*GetMaxPortCount)(IStorageController *pThis, PRUint32 *maxPortCount);
+
+    nsresult (*GetInstance)(IStorageController *pThis, PRUint32 *instance);
+    nsresult (*SetInstance)(IStorageController *pThis, PRUint32 instance);
+
+    nsresult (*GetPortCount)(IStorageController *pThis, PRUint32 *portCount);
+    nsresult (*SetPortCount)(IStorageController *pThis, PRUint32 portCount);
+
+    nsresult (*GetBus)(IStorageController *pThis, PRUint32 *bus);
+
+    nsresult (*GetControllerType)(IStorageController *pThis, PRUint32 *controllerType);
+    nsresult (*SetControllerType)(IStorageController *pThis, PRUint32 controllerType);
+
+    nsresult (*GetUseHostIOCache)(IStorageController *pThis, PRBool *useHostIOCache);
+    nsresult (*SetUseHostIOCache)(IStorageController *pThis, PRBool useHostIOCache);
+
+    nsresult (*GetBootable)(IStorageController *pThis, PRBool *bootable);
+
+};
+#define IStorageController_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IStorageController_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IStorageController_Release(p) ((p)->lpVtbl->Release(p))
+#define IStorageController_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IStorageController_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IStorageController_get_MaxDevicesPerPortCount(p, aMaxDevicesPerPortCount) ((p)->lpVtbl->GetMaxDevicesPerPortCount(p, aMaxDevicesPerPortCount))
+#define IStorageController_GetMaxDevicesPerPortCount(p, aMaxDevicesPerPortCount) ((p)->lpVtbl->GetMaxDevicesPerPortCount(p, aMaxDevicesPerPortCount))
+#define IStorageController_get_MinPortCount(p, aMinPortCount) ((p)->lpVtbl->GetMinPortCount(p, aMinPortCount))
+#define IStorageController_GetMinPortCount(p, aMinPortCount) ((p)->lpVtbl->GetMinPortCount(p, aMinPortCount))
+#define IStorageController_get_MaxPortCount(p, aMaxPortCount) ((p)->lpVtbl->GetMaxPortCount(p, aMaxPortCount))
+#define IStorageController_GetMaxPortCount(p, aMaxPortCount) ((p)->lpVtbl->GetMaxPortCount(p, aMaxPortCount))
+#define IStorageController_get_Instance(p, aInstance) ((p)->lpVtbl->GetInstance(p, aInstance))
+#define IStorageController_GetInstance(p, aInstance) ((p)->lpVtbl->GetInstance(p, aInstance))
+#define IStorageController_put_Instance(p, aInstance) ((p)->lpVtbl->SetInstance(p, aInstance))
+#define IStorageController_SetInstance(p, aInstance) ((p)->lpVtbl->SetInstance(p, aInstance))
+#define IStorageController_get_PortCount(p, aPortCount) ((p)->lpVtbl->GetPortCount(p, aPortCount))
+#define IStorageController_GetPortCount(p, aPortCount) ((p)->lpVtbl->GetPortCount(p, aPortCount))
+#define IStorageController_put_PortCount(p, aPortCount) ((p)->lpVtbl->SetPortCount(p, aPortCount))
+#define IStorageController_SetPortCount(p, aPortCount) ((p)->lpVtbl->SetPortCount(p, aPortCount))
+#define IStorageController_get_Bus(p, aBus) ((p)->lpVtbl->GetBus(p, aBus))
+#define IStorageController_GetBus(p, aBus) ((p)->lpVtbl->GetBus(p, aBus))
+#define IStorageController_get_ControllerType(p, aControllerType) ((p)->lpVtbl->GetControllerType(p, aControllerType))
+#define IStorageController_GetControllerType(p, aControllerType) ((p)->lpVtbl->GetControllerType(p, aControllerType))
+#define IStorageController_put_ControllerType(p, aControllerType) ((p)->lpVtbl->SetControllerType(p, aControllerType))
+#define IStorageController_SetControllerType(p, aControllerType) ((p)->lpVtbl->SetControllerType(p, aControllerType))
+#define IStorageController_get_UseHostIOCache(p, aUseHostIOCache) ((p)->lpVtbl->GetUseHostIOCache(p, aUseHostIOCache))
+#define IStorageController_GetUseHostIOCache(p, aUseHostIOCache) ((p)->lpVtbl->GetUseHostIOCache(p, aUseHostIOCache))
+#define IStorageController_put_UseHostIOCache(p, aUseHostIOCache) ((p)->lpVtbl->SetUseHostIOCache(p, aUseHostIOCache))
+#define IStorageController_SetUseHostIOCache(p, aUseHostIOCache) ((p)->lpVtbl->SetUseHostIOCache(p, aUseHostIOCache))
+#define IStorageController_get_Bootable(p, aBootable) ((p)->lpVtbl->GetBootable(p, aBootable))
+#define IStorageController_GetBootable(p, aBootable) ((p)->lpVtbl->GetBootable(p, aBootable))
+#endif /* VBOX_WITH_GLUE */
+
+interface IStorageController
+{
+#ifndef VBOX_WITH_GLUE
+    struct IStorageController_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IStorageControllerVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IStorageController declaration */
+
+
+/* Start of struct IPerformanceMetric declaration */
+#define IPERFORMANCEMETRIC_IID_STR "2a1a60ae-9345-4019-ad53-d34ba41cbfe9"
+#define IPERFORMANCEMETRIC_IID { \
+    0x2a1a60ae, 0x9345, 0x4019, \
+    { 0xad, 0x53, 0xd3, 0x4b, 0xa4, 0x1c, 0xbf, 0xe9 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IPerformanceMetric);
+#ifndef VBOX_WITH_GLUE
+struct IPerformanceMetric_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMetricName)(IPerformanceMetric *pThis, PRUnichar * *metricName);
+
+    nsresult (*GetObject)(IPerformanceMetric *pThis, nsISupports * *object);
+
+    nsresult (*GetDescription)(IPerformanceMetric *pThis, PRUnichar * *description);
+
+    nsresult (*GetPeriod)(IPerformanceMetric *pThis, PRUint32 *period);
+
+    nsresult (*GetCount)(IPerformanceMetric *pThis, PRUint32 *count);
+
+    nsresult (*GetUnit)(IPerformanceMetric *pThis, PRUnichar * *unit);
+
+    nsresult (*GetMinimumValue)(IPerformanceMetric *pThis, PRInt32 *minimumValue);
+
+    nsresult (*GetMaximumValue)(IPerformanceMetric *pThis, PRInt32 *maximumValue);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IPerformanceMetricVtbl
+{
+    nsresult (*QueryInterface)(IPerformanceMetric *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IPerformanceMetric *pThis);
+    nsrefcnt (*Release)(IPerformanceMetric *pThis);
+    nsresult (*GetMetricName)(IPerformanceMetric *pThis, PRUnichar * *metricName);
+
+    nsresult (*GetObject)(IPerformanceMetric *pThis, nsISupports * *object);
+
+    nsresult (*GetDescription)(IPerformanceMetric *pThis, PRUnichar * *description);
+
+    nsresult (*GetPeriod)(IPerformanceMetric *pThis, PRUint32 *period);
+
+    nsresult (*GetCount)(IPerformanceMetric *pThis, PRUint32 *count);
+
+    nsresult (*GetUnit)(IPerformanceMetric *pThis, PRUnichar * *unit);
+
+    nsresult (*GetMinimumValue)(IPerformanceMetric *pThis, PRInt32 *minimumValue);
+
+    nsresult (*GetMaximumValue)(IPerformanceMetric *pThis, PRInt32 *maximumValue);
+
+};
+#define IPerformanceMetric_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IPerformanceMetric_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IPerformanceMetric_Release(p) ((p)->lpVtbl->Release(p))
+#define IPerformanceMetric_get_MetricName(p, aMetricName) ((p)->lpVtbl->GetMetricName(p, aMetricName))
+#define IPerformanceMetric_GetMetricName(p, aMetricName) ((p)->lpVtbl->GetMetricName(p, aMetricName))
+#define IPerformanceMetric_get_Object(p, aObject) ((p)->lpVtbl->GetObject(p, aObject))
+#define IPerformanceMetric_GetObject(p, aObject) ((p)->lpVtbl->GetObject(p, aObject))
+#define IPerformanceMetric_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IPerformanceMetric_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IPerformanceMetric_get_Period(p, aPeriod) ((p)->lpVtbl->GetPeriod(p, aPeriod))
+#define IPerformanceMetric_GetPeriod(p, aPeriod) ((p)->lpVtbl->GetPeriod(p, aPeriod))
+#define IPerformanceMetric_get_Count(p, aCount) ((p)->lpVtbl->GetCount(p, aCount))
+#define IPerformanceMetric_GetCount(p, aCount) ((p)->lpVtbl->GetCount(p, aCount))
+#define IPerformanceMetric_get_Unit(p, aUnit) ((p)->lpVtbl->GetUnit(p, aUnit))
+#define IPerformanceMetric_GetUnit(p, aUnit) ((p)->lpVtbl->GetUnit(p, aUnit))
+#define IPerformanceMetric_get_MinimumValue(p, aMinimumValue) ((p)->lpVtbl->GetMinimumValue(p, aMinimumValue))
+#define IPerformanceMetric_GetMinimumValue(p, aMinimumValue) ((p)->lpVtbl->GetMinimumValue(p, aMinimumValue))
+#define IPerformanceMetric_get_MaximumValue(p, aMaximumValue) ((p)->lpVtbl->GetMaximumValue(p, aMaximumValue))
+#define IPerformanceMetric_GetMaximumValue(p, aMaximumValue) ((p)->lpVtbl->GetMaximumValue(p, aMaximumValue))
+#endif /* VBOX_WITH_GLUE */
+
+interface IPerformanceMetric
+{
+#ifndef VBOX_WITH_GLUE
+    struct IPerformanceMetric_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IPerformanceMetricVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IPerformanceMetric declaration */
+
+
+/* Start of struct IPerformanceCollector declaration */
+#define IPERFORMANCECOLLECTOR_IID_STR "e22e1acb-ac4a-43bb-a31c-17321659b0c6"
+#define IPERFORMANCECOLLECTOR_IID { \
+    0xe22e1acb, 0xac4a, 0x43bb, \
+    { 0xa3, 0x1c, 0x17, 0x32, 0x16, 0x59, 0xb0, 0xc6 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IPerformanceCollector);
+#ifndef VBOX_WITH_GLUE
+struct IPerformanceCollector_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetMetricNames)(IPerformanceCollector *pThis, PRUint32 *metricNamesSize, PRUnichar * **metricNames);
+
+    nsresult (*GetMetrics)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *metricsSize,
+        IPerformanceMetric *** metrics
+    );
+
+    nsresult (*SetupMetrics)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 period,
+        PRUint32 count,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*EnableMetrics)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*DisableMetrics)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*QueryMetricsData)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *returnMetricNamesSize,
+        PRUnichar *** returnMetricNames,
+        PRUint32 *returnObjectsSize,
+        nsISupports *** returnObjects,
+        PRUint32 *returnUnitsSize,
+        PRUnichar *** returnUnits,
+        PRUint32 *returnScalesSize,
+        PRUint32** returnScales,
+        PRUint32 *returnSequenceNumbersSize,
+        PRUint32** returnSequenceNumbers,
+        PRUint32 *returnDataIndicesSize,
+        PRUint32** returnDataIndices,
+        PRUint32 *returnDataLengthsSize,
+        PRUint32** returnDataLengths,
+        PRUint32 *returnDataSize,
+        PRInt32** returnData
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IPerformanceCollectorVtbl
+{
+    nsresult (*QueryInterface)(IPerformanceCollector *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IPerformanceCollector *pThis);
+    nsrefcnt (*Release)(IPerformanceCollector *pThis);
+    nsresult (*GetMetricNames)(IPerformanceCollector *pThis, PRUint32 *metricNamesSize, PRUnichar * **metricNames);
+
+    nsresult (*GetMetrics)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *metricsSize,
+        IPerformanceMetric *** metrics
+    );
+
+    nsresult (*SetupMetrics)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 period,
+        PRUint32 count,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*EnableMetrics)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*DisableMetrics)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *affectedMetricsSize,
+        IPerformanceMetric *** affectedMetrics
+    );
+
+    nsresult (*QueryMetricsData)(
+        IPerformanceCollector *pThis,
+        PRUint32 metricNamesSize,
+        PRUnichar ** metricNames,
+        PRUint32 objectsSize,
+        nsISupports ** objects,
+        PRUint32 *returnMetricNamesSize,
+        PRUnichar *** returnMetricNames,
+        PRUint32 *returnObjectsSize,
+        nsISupports *** returnObjects,
+        PRUint32 *returnUnitsSize,
+        PRUnichar *** returnUnits,
+        PRUint32 *returnScalesSize,
+        PRUint32** returnScales,
+        PRUint32 *returnSequenceNumbersSize,
+        PRUint32** returnSequenceNumbers,
+        PRUint32 *returnDataIndicesSize,
+        PRUint32** returnDataIndices,
+        PRUint32 *returnDataLengthsSize,
+        PRUint32** returnDataLengths,
+        PRUint32 *returnDataSize,
+        PRInt32** returnData
+    );
+
+};
+#define IPerformanceCollector_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IPerformanceCollector_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IPerformanceCollector_Release(p) ((p)->lpVtbl->Release(p))
+#define IPerformanceCollector_get_MetricNames(p, aMetricNames) ((p)->lpVtbl->GetMetricNames(p, aMetricNames))
+#define IPerformanceCollector_GetMetricNames(p, aMetricNames) ((p)->lpVtbl->GetMetricNames(p, aMetricNames))
+#define IPerformanceCollector_GetMetrics(p, aMetricNames, aObjects, aMetrics) ((p)->lpVtbl->GetMetrics(p, aMetricNames, aObjects, aMetrics))
+#define IPerformanceCollector_SetupMetrics(p, aMetricNames, aObjects, aPeriod, aCount, aAffectedMetrics) ((p)->lpVtbl->SetupMetrics(p, aMetricNames, aObjects, aPeriod, aCount, aAffectedMetrics))
+#define IPerformanceCollector_EnableMetrics(p, aMetricNames, aObjects, aAffectedMetrics) ((p)->lpVtbl->EnableMetrics(p, aMetricNames, aObjects, aAffectedMetrics))
+#define IPerformanceCollector_DisableMetrics(p, aMetricNames, aObjects, aAffectedMetrics) ((p)->lpVtbl->DisableMetrics(p, aMetricNames, aObjects, aAffectedMetrics))
+#define IPerformanceCollector_QueryMetricsData(p, aMetricNames, aObjects, aReturnMetricNames, aReturnObjects, aReturnUnits, aReturnScales, aReturnSequenceNumbers, aReturnDataIndices, aReturnDataLengths, aReturnData) ((p)->lpVtbl->QueryMetricsData(p, aMetricNames, aObjects, aReturnMetricNames, aReturnObjects, aReturnUnits, aReturnScales, aReturnSequenceNumbers, aReturnDataIndices, aReturnDataLengths, aReturnData))
+#endif /* VBOX_WITH_GLUE */
+
+interface IPerformanceCollector
+{
+#ifndef VBOX_WITH_GLUE
+    struct IPerformanceCollector_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IPerformanceCollectorVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IPerformanceCollector declaration */
+
+
+/* Start of struct INATEngine declaration */
+#define INATENGINE_IID_STR "26451b99-3b2d-4dcb-8e4b-d63654218175"
+#define INATENGINE_IID { \
+    0x26451b99, 0x3b2d, 0x4dcb, \
+    { 0x8e, 0x4b, 0xd6, 0x36, 0x54, 0x21, 0x81, 0x75 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATEngine);
+#ifndef VBOX_WITH_GLUE
+struct INATEngine_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetNetwork)(INATEngine *pThis, PRUnichar * *network);
+    nsresult (*SetNetwork)(INATEngine *pThis, PRUnichar * network);
+
+    nsresult (*GetHostIP)(INATEngine *pThis, PRUnichar * *hostIP);
+    nsresult (*SetHostIP)(INATEngine *pThis, PRUnichar * hostIP);
+
+    nsresult (*GetTFTPPrefix)(INATEngine *pThis, PRUnichar * *TFTPPrefix);
+    nsresult (*SetTFTPPrefix)(INATEngine *pThis, PRUnichar * TFTPPrefix);
+
+    nsresult (*GetTFTPBootFile)(INATEngine *pThis, PRUnichar * *TFTPBootFile);
+    nsresult (*SetTFTPBootFile)(INATEngine *pThis, PRUnichar * TFTPBootFile);
+
+    nsresult (*GetTFTPNextServer)(INATEngine *pThis, PRUnichar * *TFTPNextServer);
+    nsresult (*SetTFTPNextServer)(INATEngine *pThis, PRUnichar * TFTPNextServer);
+
+    nsresult (*GetAliasMode)(INATEngine *pThis, PRUint32 *aliasMode);
+    nsresult (*SetAliasMode)(INATEngine *pThis, PRUint32 aliasMode);
+
+    nsresult (*GetDNSPassDomain)(INATEngine *pThis, PRBool *DNSPassDomain);
+    nsresult (*SetDNSPassDomain)(INATEngine *pThis, PRBool DNSPassDomain);
+
+    nsresult (*GetDNSProxy)(INATEngine *pThis, PRBool *DNSProxy);
+    nsresult (*SetDNSProxy)(INATEngine *pThis, PRBool DNSProxy);
+
+    nsresult (*GetDNSUseHostResolver)(INATEngine *pThis, PRBool *DNSUseHostResolver);
+    nsresult (*SetDNSUseHostResolver)(INATEngine *pThis, PRBool DNSUseHostResolver);
+
+    nsresult (*GetRedirects)(INATEngine *pThis, PRUint32 *redirectsSize, PRUnichar * **redirects);
+
+    nsresult (*SetNetworkSettings)(
+        INATEngine *pThis,
+        PRUint32 mtu,
+        PRUint32 sockSnd,
+        PRUint32 sockRcv,
+        PRUint32 TcpWndSnd,
+        PRUint32 TcpWndRcv
+    );
+
+    nsresult (*GetNetworkSettings)(
+        INATEngine *pThis,
+        PRUint32 * mtu,
+        PRUint32 * sockSnd,
+        PRUint32 * sockRcv,
+        PRUint32 * TcpWndSnd,
+        PRUint32 * TcpWndRcv
+    );
+
+    nsresult (*AddRedirect)(
+        INATEngine *pThis,
+        PRUnichar * name,
+        PRUint32 proto,
+        PRUnichar * hostIP,
+        PRUint16 hostPort,
+        PRUnichar * guestIP,
+        PRUint16 guestPort
+    );
+
+    nsresult (*RemoveRedirect)(
+        INATEngine *pThis,
+        PRUnichar * name
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATEngineVtbl
+{
+    nsresult (*QueryInterface)(INATEngine *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATEngine *pThis);
+    nsrefcnt (*Release)(INATEngine *pThis);
+    nsresult (*GetNetwork)(INATEngine *pThis, PRUnichar * *network);
+    nsresult (*SetNetwork)(INATEngine *pThis, PRUnichar * network);
+
+    nsresult (*GetHostIP)(INATEngine *pThis, PRUnichar * *hostIP);
+    nsresult (*SetHostIP)(INATEngine *pThis, PRUnichar * hostIP);
+
+    nsresult (*GetTFTPPrefix)(INATEngine *pThis, PRUnichar * *TFTPPrefix);
+    nsresult (*SetTFTPPrefix)(INATEngine *pThis, PRUnichar * TFTPPrefix);
+
+    nsresult (*GetTFTPBootFile)(INATEngine *pThis, PRUnichar * *TFTPBootFile);
+    nsresult (*SetTFTPBootFile)(INATEngine *pThis, PRUnichar * TFTPBootFile);
+
+    nsresult (*GetTFTPNextServer)(INATEngine *pThis, PRUnichar * *TFTPNextServer);
+    nsresult (*SetTFTPNextServer)(INATEngine *pThis, PRUnichar * TFTPNextServer);
+
+    nsresult (*GetAliasMode)(INATEngine *pThis, PRUint32 *aliasMode);
+    nsresult (*SetAliasMode)(INATEngine *pThis, PRUint32 aliasMode);
+
+    nsresult (*GetDNSPassDomain)(INATEngine *pThis, PRBool *DNSPassDomain);
+    nsresult (*SetDNSPassDomain)(INATEngine *pThis, PRBool DNSPassDomain);
+
+    nsresult (*GetDNSProxy)(INATEngine *pThis, PRBool *DNSProxy);
+    nsresult (*SetDNSProxy)(INATEngine *pThis, PRBool DNSProxy);
+
+    nsresult (*GetDNSUseHostResolver)(INATEngine *pThis, PRBool *DNSUseHostResolver);
+    nsresult (*SetDNSUseHostResolver)(INATEngine *pThis, PRBool DNSUseHostResolver);
+
+    nsresult (*GetRedirects)(INATEngine *pThis, PRUint32 *redirectsSize, PRUnichar * **redirects);
+
+    nsresult (*SetNetworkSettings)(
+        INATEngine *pThis,
+        PRUint32 mtu,
+        PRUint32 sockSnd,
+        PRUint32 sockRcv,
+        PRUint32 TcpWndSnd,
+        PRUint32 TcpWndRcv
+    );
+
+    nsresult (*GetNetworkSettings)(
+        INATEngine *pThis,
+        PRUint32 * mtu,
+        PRUint32 * sockSnd,
+        PRUint32 * sockRcv,
+        PRUint32 * TcpWndSnd,
+        PRUint32 * TcpWndRcv
+    );
+
+    nsresult (*AddRedirect)(
+        INATEngine *pThis,
+        PRUnichar * name,
+        PRUint32 proto,
+        PRUnichar * hostIP,
+        PRUint16 hostPort,
+        PRUnichar * guestIP,
+        PRUint16 guestPort
+    );
+
+    nsresult (*RemoveRedirect)(
+        INATEngine *pThis,
+        PRUnichar * name
+    );
+
+};
+#define INATEngine_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATEngine_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATEngine_Release(p) ((p)->lpVtbl->Release(p))
+#define INATEngine_get_Network(p, aNetwork) ((p)->lpVtbl->GetNetwork(p, aNetwork))
+#define INATEngine_GetNetwork(p, aNetwork) ((p)->lpVtbl->GetNetwork(p, aNetwork))
+#define INATEngine_put_Network(p, aNetwork) ((p)->lpVtbl->SetNetwork(p, aNetwork))
+#define INATEngine_SetNetwork(p, aNetwork) ((p)->lpVtbl->SetNetwork(p, aNetwork))
+#define INATEngine_get_HostIP(p, aHostIP) ((p)->lpVtbl->GetHostIP(p, aHostIP))
+#define INATEngine_GetHostIP(p, aHostIP) ((p)->lpVtbl->GetHostIP(p, aHostIP))
+#define INATEngine_put_HostIP(p, aHostIP) ((p)->lpVtbl->SetHostIP(p, aHostIP))
+#define INATEngine_SetHostIP(p, aHostIP) ((p)->lpVtbl->SetHostIP(p, aHostIP))
+#define INATEngine_get_TFTPPrefix(p, aTFTPPrefix) ((p)->lpVtbl->GetTFTPPrefix(p, aTFTPPrefix))
+#define INATEngine_GetTFTPPrefix(p, aTFTPPrefix) ((p)->lpVtbl->GetTFTPPrefix(p, aTFTPPrefix))
+#define INATEngine_put_TFTPPrefix(p, aTFTPPrefix) ((p)->lpVtbl->SetTFTPPrefix(p, aTFTPPrefix))
+#define INATEngine_SetTFTPPrefix(p, aTFTPPrefix) ((p)->lpVtbl->SetTFTPPrefix(p, aTFTPPrefix))
+#define INATEngine_get_TFTPBootFile(p, aTFTPBootFile) ((p)->lpVtbl->GetTFTPBootFile(p, aTFTPBootFile))
+#define INATEngine_GetTFTPBootFile(p, aTFTPBootFile) ((p)->lpVtbl->GetTFTPBootFile(p, aTFTPBootFile))
+#define INATEngine_put_TFTPBootFile(p, aTFTPBootFile) ((p)->lpVtbl->SetTFTPBootFile(p, aTFTPBootFile))
+#define INATEngine_SetTFTPBootFile(p, aTFTPBootFile) ((p)->lpVtbl->SetTFTPBootFile(p, aTFTPBootFile))
+#define INATEngine_get_TFTPNextServer(p, aTFTPNextServer) ((p)->lpVtbl->GetTFTPNextServer(p, aTFTPNextServer))
+#define INATEngine_GetTFTPNextServer(p, aTFTPNextServer) ((p)->lpVtbl->GetTFTPNextServer(p, aTFTPNextServer))
+#define INATEngine_put_TFTPNextServer(p, aTFTPNextServer) ((p)->lpVtbl->SetTFTPNextServer(p, aTFTPNextServer))
+#define INATEngine_SetTFTPNextServer(p, aTFTPNextServer) ((p)->lpVtbl->SetTFTPNextServer(p, aTFTPNextServer))
+#define INATEngine_get_AliasMode(p, aAliasMode) ((p)->lpVtbl->GetAliasMode(p, aAliasMode))
+#define INATEngine_GetAliasMode(p, aAliasMode) ((p)->lpVtbl->GetAliasMode(p, aAliasMode))
+#define INATEngine_put_AliasMode(p, aAliasMode) ((p)->lpVtbl->SetAliasMode(p, aAliasMode))
+#define INATEngine_SetAliasMode(p, aAliasMode) ((p)->lpVtbl->SetAliasMode(p, aAliasMode))
+#define INATEngine_get_DNSPassDomain(p, aDNSPassDomain) ((p)->lpVtbl->GetDNSPassDomain(p, aDNSPassDomain))
+#define INATEngine_GetDNSPassDomain(p, aDNSPassDomain) ((p)->lpVtbl->GetDNSPassDomain(p, aDNSPassDomain))
+#define INATEngine_put_DNSPassDomain(p, aDNSPassDomain) ((p)->lpVtbl->SetDNSPassDomain(p, aDNSPassDomain))
+#define INATEngine_SetDNSPassDomain(p, aDNSPassDomain) ((p)->lpVtbl->SetDNSPassDomain(p, aDNSPassDomain))
+#define INATEngine_get_DNSProxy(p, aDNSProxy) ((p)->lpVtbl->GetDNSProxy(p, aDNSProxy))
+#define INATEngine_GetDNSProxy(p, aDNSProxy) ((p)->lpVtbl->GetDNSProxy(p, aDNSProxy))
+#define INATEngine_put_DNSProxy(p, aDNSProxy) ((p)->lpVtbl->SetDNSProxy(p, aDNSProxy))
+#define INATEngine_SetDNSProxy(p, aDNSProxy) ((p)->lpVtbl->SetDNSProxy(p, aDNSProxy))
+#define INATEngine_get_DNSUseHostResolver(p, aDNSUseHostResolver) ((p)->lpVtbl->GetDNSUseHostResolver(p, aDNSUseHostResolver))
+#define INATEngine_GetDNSUseHostResolver(p, aDNSUseHostResolver) ((p)->lpVtbl->GetDNSUseHostResolver(p, aDNSUseHostResolver))
+#define INATEngine_put_DNSUseHostResolver(p, aDNSUseHostResolver) ((p)->lpVtbl->SetDNSUseHostResolver(p, aDNSUseHostResolver))
+#define INATEngine_SetDNSUseHostResolver(p, aDNSUseHostResolver) ((p)->lpVtbl->SetDNSUseHostResolver(p, aDNSUseHostResolver))
+#define INATEngine_get_Redirects(p, aRedirects) ((p)->lpVtbl->GetRedirects(p, aRedirects))
+#define INATEngine_GetRedirects(p, aRedirects) ((p)->lpVtbl->GetRedirects(p, aRedirects))
+#define INATEngine_SetNetworkSettings(p, aMtu, aSockSnd, aSockRcv, aTcpWndSnd, aTcpWndRcv) ((p)->lpVtbl->SetNetworkSettings(p, aMtu, aSockSnd, aSockRcv, aTcpWndSnd, aTcpWndRcv))
+#define INATEngine_GetNetworkSettings(p, aMtu, aSockSnd, aSockRcv, aTcpWndSnd, aTcpWndRcv) ((p)->lpVtbl->GetNetworkSettings(p, aMtu, aSockSnd, aSockRcv, aTcpWndSnd, aTcpWndRcv))
+#define INATEngine_AddRedirect(p, aName, aProto, aHostIP, aHostPort, aGuestIP, aGuestPort) ((p)->lpVtbl->AddRedirect(p, aName, aProto, aHostIP, aHostPort, aGuestIP, aGuestPort))
+#define INATEngine_RemoveRedirect(p, aName) ((p)->lpVtbl->RemoveRedirect(p, aName))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATEngine
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATEngine_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATEngineVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATEngine declaration */
+
+
+/* Start of struct IExtPackPlugIn declaration */
+#define IEXTPACKPLUGIN_IID_STR "58000040-e718-4746-bbce-4b86d96da461"
+#define IEXTPACKPLUGIN_IID { \
+    0x58000040, 0xe718, 0x4746, \
+    { 0xbb, 0xce, 0x4b, 0x86, 0xd9, 0x6d, 0xa4, 0x61 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IExtPackPlugIn);
+#ifndef VBOX_WITH_GLUE
+struct IExtPackPlugIn_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IExtPackPlugIn *pThis, PRUnichar * *name);
+
+    nsresult (*GetDescription)(IExtPackPlugIn *pThis, PRUnichar * *description);
+
+    nsresult (*GetFrontend)(IExtPackPlugIn *pThis, PRUnichar * *frontend);
+
+    nsresult (*GetModulePath)(IExtPackPlugIn *pThis, PRUnichar * *modulePath);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IExtPackPlugInVtbl
+{
+    nsresult (*QueryInterface)(IExtPackPlugIn *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IExtPackPlugIn *pThis);
+    nsrefcnt (*Release)(IExtPackPlugIn *pThis);
+    nsresult (*GetName)(IExtPackPlugIn *pThis, PRUnichar * *name);
+
+    nsresult (*GetDescription)(IExtPackPlugIn *pThis, PRUnichar * *description);
+
+    nsresult (*GetFrontend)(IExtPackPlugIn *pThis, PRUnichar * *frontend);
+
+    nsresult (*GetModulePath)(IExtPackPlugIn *pThis, PRUnichar * *modulePath);
+
+};
+#define IExtPackPlugIn_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IExtPackPlugIn_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IExtPackPlugIn_Release(p) ((p)->lpVtbl->Release(p))
+#define IExtPackPlugIn_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IExtPackPlugIn_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IExtPackPlugIn_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IExtPackPlugIn_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IExtPackPlugIn_get_Frontend(p, aFrontend) ((p)->lpVtbl->GetFrontend(p, aFrontend))
+#define IExtPackPlugIn_GetFrontend(p, aFrontend) ((p)->lpVtbl->GetFrontend(p, aFrontend))
+#define IExtPackPlugIn_get_ModulePath(p, aModulePath) ((p)->lpVtbl->GetModulePath(p, aModulePath))
+#define IExtPackPlugIn_GetModulePath(p, aModulePath) ((p)->lpVtbl->GetModulePath(p, aModulePath))
+#endif /* VBOX_WITH_GLUE */
+
+interface IExtPackPlugIn
+{
+#ifndef VBOX_WITH_GLUE
+    struct IExtPackPlugIn_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IExtPackPlugInVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IExtPackPlugIn declaration */
+
+
+/* Start of struct IExtPackBase declaration */
+#define IEXTPACKBASE_IID_STR "f79b75d8-2890-4f34-ffff-ffffa144e82c"
+#define IEXTPACKBASE_IID { \
+    0xf79b75d8, 0x2890, 0x4f34, \
+    { 0xff, 0xff, 0xff, 0xff, 0xa1, 0x44, 0xe8, 0x2c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IExtPackBase);
+#ifndef VBOX_WITH_GLUE
+struct IExtPackBase_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IExtPackBase *pThis, PRUnichar * *name);
+
+    nsresult (*GetDescription)(IExtPackBase *pThis, PRUnichar * *description);
+
+    nsresult (*GetVersion)(IExtPackBase *pThis, PRUnichar * *version);
+
+    nsresult (*GetRevision)(IExtPackBase *pThis, PRUint32 *revision);
+
+    nsresult (*GetEdition)(IExtPackBase *pThis, PRUnichar * *edition);
+
+    nsresult (*GetVRDEModule)(IExtPackBase *pThis, PRUnichar * *VRDEModule);
+
+    nsresult (*GetPlugIns)(IExtPackBase *pThis, PRUint32 *plugInsSize, IExtPackPlugIn * **plugIns);
+
+    nsresult (*GetUsable)(IExtPackBase *pThis, PRBool *usable);
+
+    nsresult (*GetWhyUnusable)(IExtPackBase *pThis, PRUnichar * *whyUnusable);
+
+    nsresult (*GetShowLicense)(IExtPackBase *pThis, PRBool *showLicense);
+
+    nsresult (*GetLicense)(IExtPackBase *pThis, PRUnichar * *license);
+
+    nsresult (*QueryLicense)(
+        IExtPackBase *pThis,
+        PRUnichar * preferredLocale,
+        PRUnichar * preferredLanguage,
+        PRUnichar * format,
+        PRUnichar * * licenseText
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IExtPackBaseVtbl
+{
+    nsresult (*QueryInterface)(IExtPackBase *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IExtPackBase *pThis);
+    nsrefcnt (*Release)(IExtPackBase *pThis);
+    nsresult (*GetName)(IExtPackBase *pThis, PRUnichar * *name);
+
+    nsresult (*GetDescription)(IExtPackBase *pThis, PRUnichar * *description);
+
+    nsresult (*GetVersion)(IExtPackBase *pThis, PRUnichar * *version);
+
+    nsresult (*GetRevision)(IExtPackBase *pThis, PRUint32 *revision);
+
+    nsresult (*GetEdition)(IExtPackBase *pThis, PRUnichar * *edition);
+
+    nsresult (*GetVRDEModule)(IExtPackBase *pThis, PRUnichar * *VRDEModule);
+
+    nsresult (*GetPlugIns)(IExtPackBase *pThis, PRUint32 *plugInsSize, IExtPackPlugIn * **plugIns);
+
+    nsresult (*GetUsable)(IExtPackBase *pThis, PRBool *usable);
+
+    nsresult (*GetWhyUnusable)(IExtPackBase *pThis, PRUnichar * *whyUnusable);
+
+    nsresult (*GetShowLicense)(IExtPackBase *pThis, PRBool *showLicense);
+
+    nsresult (*GetLicense)(IExtPackBase *pThis, PRUnichar * *license);
+
+    nsresult (*QueryLicense)(
+        IExtPackBase *pThis,
+        PRUnichar * preferredLocale,
+        PRUnichar * preferredLanguage,
+        PRUnichar * format,
+        PRUnichar * * licenseText
+    );
+
+};
+#define IExtPackBase_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IExtPackBase_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IExtPackBase_Release(p) ((p)->lpVtbl->Release(p))
+#define IExtPackBase_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IExtPackBase_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IExtPackBase_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IExtPackBase_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IExtPackBase_get_Version(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IExtPackBase_GetVersion(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IExtPackBase_get_Revision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IExtPackBase_GetRevision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IExtPackBase_get_Edition(p, aEdition) ((p)->lpVtbl->GetEdition(p, aEdition))
+#define IExtPackBase_GetEdition(p, aEdition) ((p)->lpVtbl->GetEdition(p, aEdition))
+#define IExtPackBase_get_VRDEModule(p, aVRDEModule) ((p)->lpVtbl->GetVRDEModule(p, aVRDEModule))
+#define IExtPackBase_GetVRDEModule(p, aVRDEModule) ((p)->lpVtbl->GetVRDEModule(p, aVRDEModule))
+#define IExtPackBase_get_PlugIns(p, aPlugIns) ((p)->lpVtbl->GetPlugIns(p, aPlugIns))
+#define IExtPackBase_GetPlugIns(p, aPlugIns) ((p)->lpVtbl->GetPlugIns(p, aPlugIns))
+#define IExtPackBase_get_Usable(p, aUsable) ((p)->lpVtbl->GetUsable(p, aUsable))
+#define IExtPackBase_GetUsable(p, aUsable) ((p)->lpVtbl->GetUsable(p, aUsable))
+#define IExtPackBase_get_WhyUnusable(p, aWhyUnusable) ((p)->lpVtbl->GetWhyUnusable(p, aWhyUnusable))
+#define IExtPackBase_GetWhyUnusable(p, aWhyUnusable) ((p)->lpVtbl->GetWhyUnusable(p, aWhyUnusable))
+#define IExtPackBase_get_ShowLicense(p, aShowLicense) ((p)->lpVtbl->GetShowLicense(p, aShowLicense))
+#define IExtPackBase_GetShowLicense(p, aShowLicense) ((p)->lpVtbl->GetShowLicense(p, aShowLicense))
+#define IExtPackBase_get_License(p, aLicense) ((p)->lpVtbl->GetLicense(p, aLicense))
+#define IExtPackBase_GetLicense(p, aLicense) ((p)->lpVtbl->GetLicense(p, aLicense))
+#define IExtPackBase_QueryLicense(p, aPreferredLocale, aPreferredLanguage, aFormat, aLicenseText) ((p)->lpVtbl->QueryLicense(p, aPreferredLocale, aPreferredLanguage, aFormat, aLicenseText))
+#endif /* VBOX_WITH_GLUE */
+
+interface IExtPackBase
+{
+#ifndef VBOX_WITH_GLUE
+    struct IExtPackBase_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IExtPackBaseVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IExtPackBase declaration */
+
+
+/* Start of struct IExtPack declaration */
+#define IEXTPACK_IID_STR "431685da-3618-4ebc-b038-833ba829b4b2"
+#define IEXTPACK_IID { \
+    0x431685da, 0x3618, 0x4ebc, \
+    { 0xb0, 0x38, 0x83, 0x3b, 0xa8, 0x29, 0xb4, 0xb2 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IExtPack);
+#ifndef VBOX_WITH_GLUE
+struct IExtPack_vtbl
+{
+    struct IExtPackBase_vtbl iextpackbase;
+
+    nsresult (*QueryObject)(
+        IExtPack *pThis,
+        PRUnichar * objUuid,
+        nsISupports * * returnInterface
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IExtPackVtbl
+{
+    nsresult (*QueryInterface)(IExtPack *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IExtPack *pThis);
+    nsrefcnt (*Release)(IExtPack *pThis);
+    nsresult (*GetName)(IExtPack *pThis, PRUnichar * *name);
+
+    nsresult (*GetDescription)(IExtPack *pThis, PRUnichar * *description);
+
+    nsresult (*GetVersion)(IExtPack *pThis, PRUnichar * *version);
+
+    nsresult (*GetRevision)(IExtPack *pThis, PRUint32 *revision);
+
+    nsresult (*GetEdition)(IExtPack *pThis, PRUnichar * *edition);
+
+    nsresult (*GetVRDEModule)(IExtPack *pThis, PRUnichar * *VRDEModule);
+
+    nsresult (*GetPlugIns)(IExtPack *pThis, PRUint32 *plugInsSize, IExtPackPlugIn * **plugIns);
+
+    nsresult (*GetUsable)(IExtPack *pThis, PRBool *usable);
+
+    nsresult (*GetWhyUnusable)(IExtPack *pThis, PRUnichar * *whyUnusable);
+
+    nsresult (*GetShowLicense)(IExtPack *pThis, PRBool *showLicense);
+
+    nsresult (*GetLicense)(IExtPack *pThis, PRUnichar * *license);
+
+    nsresult (*QueryLicense)(
+        IExtPack *pThis,
+        PRUnichar * preferredLocale,
+        PRUnichar * preferredLanguage,
+        PRUnichar * format,
+        PRUnichar * * licenseText
+    );
+
+    nsresult (*QueryObject)(
+        IExtPack *pThis,
+        PRUnichar * objUuid,
+        nsISupports * * returnInterface
+    );
+
+};
+#define IExtPack_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IExtPack_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IExtPack_Release(p) ((p)->lpVtbl->Release(p))
+#define IExtPack_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IExtPack_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IExtPack_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IExtPack_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IExtPack_get_Version(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IExtPack_GetVersion(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IExtPack_get_Revision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IExtPack_GetRevision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IExtPack_get_Edition(p, aEdition) ((p)->lpVtbl->GetEdition(p, aEdition))
+#define IExtPack_GetEdition(p, aEdition) ((p)->lpVtbl->GetEdition(p, aEdition))
+#define IExtPack_get_VRDEModule(p, aVRDEModule) ((p)->lpVtbl->GetVRDEModule(p, aVRDEModule))
+#define IExtPack_GetVRDEModule(p, aVRDEModule) ((p)->lpVtbl->GetVRDEModule(p, aVRDEModule))
+#define IExtPack_get_PlugIns(p, aPlugIns) ((p)->lpVtbl->GetPlugIns(p, aPlugIns))
+#define IExtPack_GetPlugIns(p, aPlugIns) ((p)->lpVtbl->GetPlugIns(p, aPlugIns))
+#define IExtPack_get_Usable(p, aUsable) ((p)->lpVtbl->GetUsable(p, aUsable))
+#define IExtPack_GetUsable(p, aUsable) ((p)->lpVtbl->GetUsable(p, aUsable))
+#define IExtPack_get_WhyUnusable(p, aWhyUnusable) ((p)->lpVtbl->GetWhyUnusable(p, aWhyUnusable))
+#define IExtPack_GetWhyUnusable(p, aWhyUnusable) ((p)->lpVtbl->GetWhyUnusable(p, aWhyUnusable))
+#define IExtPack_get_ShowLicense(p, aShowLicense) ((p)->lpVtbl->GetShowLicense(p, aShowLicense))
+#define IExtPack_GetShowLicense(p, aShowLicense) ((p)->lpVtbl->GetShowLicense(p, aShowLicense))
+#define IExtPack_get_License(p, aLicense) ((p)->lpVtbl->GetLicense(p, aLicense))
+#define IExtPack_GetLicense(p, aLicense) ((p)->lpVtbl->GetLicense(p, aLicense))
+#define IExtPack_QueryLicense(p, aPreferredLocale, aPreferredLanguage, aFormat, aLicenseText) ((p)->lpVtbl->QueryLicense(p, aPreferredLocale, aPreferredLanguage, aFormat, aLicenseText))
+#define IExtPack_QueryObject(p, aObjUuid, aReturnInterface) ((p)->lpVtbl->QueryObject(p, aObjUuid, aReturnInterface))
+#endif /* VBOX_WITH_GLUE */
+
+interface IExtPack
+{
+#ifndef VBOX_WITH_GLUE
+    struct IExtPack_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IExtPackVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IExtPack declaration */
+
+
+/* Start of struct IExtPackFile declaration */
+#define IEXTPACKFILE_IID_STR "b6b49f55-efcc-4f08-b486-56e8d8afb10b"
+#define IEXTPACKFILE_IID { \
+    0xb6b49f55, 0xefcc, 0x4f08, \
+    { 0xb4, 0x86, 0x56, 0xe8, 0xd8, 0xaf, 0xb1, 0x0b } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IExtPackFile);
+#ifndef VBOX_WITH_GLUE
+struct IExtPackFile_vtbl
+{
+    struct IExtPackBase_vtbl iextpackbase;
+
+    nsresult (*GetFilePath)(IExtPackFile *pThis, PRUnichar * *filePath);
+
+    nsresult (*Install)(
+        IExtPackFile *pThis,
+        PRBool replace,
+        PRUnichar * displayInfo,
+        IProgress * * progess
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IExtPackFileVtbl
+{
+    nsresult (*QueryInterface)(IExtPackFile *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IExtPackFile *pThis);
+    nsrefcnt (*Release)(IExtPackFile *pThis);
+    nsresult (*GetName)(IExtPackFile *pThis, PRUnichar * *name);
+
+    nsresult (*GetDescription)(IExtPackFile *pThis, PRUnichar * *description);
+
+    nsresult (*GetVersion)(IExtPackFile *pThis, PRUnichar * *version);
+
+    nsresult (*GetRevision)(IExtPackFile *pThis, PRUint32 *revision);
+
+    nsresult (*GetEdition)(IExtPackFile *pThis, PRUnichar * *edition);
+
+    nsresult (*GetVRDEModule)(IExtPackFile *pThis, PRUnichar * *VRDEModule);
+
+    nsresult (*GetPlugIns)(IExtPackFile *pThis, PRUint32 *plugInsSize, IExtPackPlugIn * **plugIns);
+
+    nsresult (*GetUsable)(IExtPackFile *pThis, PRBool *usable);
+
+    nsresult (*GetWhyUnusable)(IExtPackFile *pThis, PRUnichar * *whyUnusable);
+
+    nsresult (*GetShowLicense)(IExtPackFile *pThis, PRBool *showLicense);
+
+    nsresult (*GetLicense)(IExtPackFile *pThis, PRUnichar * *license);
+
+    nsresult (*QueryLicense)(
+        IExtPackFile *pThis,
+        PRUnichar * preferredLocale,
+        PRUnichar * preferredLanguage,
+        PRUnichar * format,
+        PRUnichar * * licenseText
+    );
+
+    nsresult (*GetFilePath)(IExtPackFile *pThis, PRUnichar * *filePath);
+
+    nsresult (*Install)(
+        IExtPackFile *pThis,
+        PRBool replace,
+        PRUnichar * displayInfo,
+        IProgress * * progess
+    );
+
+};
+#define IExtPackFile_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IExtPackFile_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IExtPackFile_Release(p) ((p)->lpVtbl->Release(p))
+#define IExtPackFile_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IExtPackFile_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IExtPackFile_get_Description(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IExtPackFile_GetDescription(p, aDescription) ((p)->lpVtbl->GetDescription(p, aDescription))
+#define IExtPackFile_get_Version(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IExtPackFile_GetVersion(p, aVersion) ((p)->lpVtbl->GetVersion(p, aVersion))
+#define IExtPackFile_get_Revision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IExtPackFile_GetRevision(p, aRevision) ((p)->lpVtbl->GetRevision(p, aRevision))
+#define IExtPackFile_get_Edition(p, aEdition) ((p)->lpVtbl->GetEdition(p, aEdition))
+#define IExtPackFile_GetEdition(p, aEdition) ((p)->lpVtbl->GetEdition(p, aEdition))
+#define IExtPackFile_get_VRDEModule(p, aVRDEModule) ((p)->lpVtbl->GetVRDEModule(p, aVRDEModule))
+#define IExtPackFile_GetVRDEModule(p, aVRDEModule) ((p)->lpVtbl->GetVRDEModule(p, aVRDEModule))
+#define IExtPackFile_get_PlugIns(p, aPlugIns) ((p)->lpVtbl->GetPlugIns(p, aPlugIns))
+#define IExtPackFile_GetPlugIns(p, aPlugIns) ((p)->lpVtbl->GetPlugIns(p, aPlugIns))
+#define IExtPackFile_get_Usable(p, aUsable) ((p)->lpVtbl->GetUsable(p, aUsable))
+#define IExtPackFile_GetUsable(p, aUsable) ((p)->lpVtbl->GetUsable(p, aUsable))
+#define IExtPackFile_get_WhyUnusable(p, aWhyUnusable) ((p)->lpVtbl->GetWhyUnusable(p, aWhyUnusable))
+#define IExtPackFile_GetWhyUnusable(p, aWhyUnusable) ((p)->lpVtbl->GetWhyUnusable(p, aWhyUnusable))
+#define IExtPackFile_get_ShowLicense(p, aShowLicense) ((p)->lpVtbl->GetShowLicense(p, aShowLicense))
+#define IExtPackFile_GetShowLicense(p, aShowLicense) ((p)->lpVtbl->GetShowLicense(p, aShowLicense))
+#define IExtPackFile_get_License(p, aLicense) ((p)->lpVtbl->GetLicense(p, aLicense))
+#define IExtPackFile_GetLicense(p, aLicense) ((p)->lpVtbl->GetLicense(p, aLicense))
+#define IExtPackFile_QueryLicense(p, aPreferredLocale, aPreferredLanguage, aFormat, aLicenseText) ((p)->lpVtbl->QueryLicense(p, aPreferredLocale, aPreferredLanguage, aFormat, aLicenseText))
+#define IExtPackFile_get_FilePath(p, aFilePath) ((p)->lpVtbl->GetFilePath(p, aFilePath))
+#define IExtPackFile_GetFilePath(p, aFilePath) ((p)->lpVtbl->GetFilePath(p, aFilePath))
+#define IExtPackFile_Install(p, aReplace, aDisplayInfo, aProgess) ((p)->lpVtbl->Install(p, aReplace, aDisplayInfo, aProgess))
+#endif /* VBOX_WITH_GLUE */
+
+interface IExtPackFile
+{
+#ifndef VBOX_WITH_GLUE
+    struct IExtPackFile_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IExtPackFileVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IExtPackFile declaration */
+
+
+/* Start of struct IExtPackManager declaration */
+#define IEXTPACKMANAGER_IID_STR "3295e6ce-b051-47b2-9514-2c588bfe7554"
+#define IEXTPACKMANAGER_IID { \
+    0x3295e6ce, 0xb051, 0x47b2, \
+    { 0x95, 0x14, 0x2c, 0x58, 0x8b, 0xfe, 0x75, 0x54 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IExtPackManager);
+#ifndef VBOX_WITH_GLUE
+struct IExtPackManager_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetInstalledExtPacks)(IExtPackManager *pThis, PRUint32 *installedExtPacksSize, IExtPack * **installedExtPacks);
+
+    nsresult (*Find)(
+        IExtPackManager *pThis,
+        PRUnichar * name,
+        IExtPack * * returnData
+    );
+
+    nsresult (*OpenExtPackFile)(
+        IExtPackManager *pThis,
+        PRUnichar * path,
+        IExtPackFile * * file
+    );
+
+    nsresult (*Uninstall)(
+        IExtPackManager *pThis,
+        PRUnichar * name,
+        PRBool forcedRemoval,
+        PRUnichar * displayInfo,
+        IProgress * * progess
+    );
+
+    nsresult (*Cleanup)(IExtPackManager *pThis );
+
+    nsresult (*QueryAllPlugInsForFrontend)(
+        IExtPackManager *pThis,
+        PRUnichar * frontendName,
+        PRUint32 *plugInModulesSize,
+        PRUnichar *** plugInModules
+    );
+
+    nsresult (*IsExtPackUsable)(
+        IExtPackManager *pThis,
+        PRUnichar * name,
+        PRBool * usable
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IExtPackManagerVtbl
+{
+    nsresult (*QueryInterface)(IExtPackManager *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IExtPackManager *pThis);
+    nsrefcnt (*Release)(IExtPackManager *pThis);
+    nsresult (*GetInstalledExtPacks)(IExtPackManager *pThis, PRUint32 *installedExtPacksSize, IExtPack * **installedExtPacks);
+
+    nsresult (*Find)(
+        IExtPackManager *pThis,
+        PRUnichar * name,
+        IExtPack * * returnData
+    );
+
+    nsresult (*OpenExtPackFile)(
+        IExtPackManager *pThis,
+        PRUnichar * path,
+        IExtPackFile * * file
+    );
+
+    nsresult (*Uninstall)(
+        IExtPackManager *pThis,
+        PRUnichar * name,
+        PRBool forcedRemoval,
+        PRUnichar * displayInfo,
+        IProgress * * progess
+    );
+
+    nsresult (*Cleanup)(IExtPackManager *pThis );
+
+    nsresult (*QueryAllPlugInsForFrontend)(
+        IExtPackManager *pThis,
+        PRUnichar * frontendName,
+        PRUint32 *plugInModulesSize,
+        PRUnichar *** plugInModules
+    );
+
+    nsresult (*IsExtPackUsable)(
+        IExtPackManager *pThis,
+        PRUnichar * name,
+        PRBool * usable
+    );
+
+};
+#define IExtPackManager_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IExtPackManager_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IExtPackManager_Release(p) ((p)->lpVtbl->Release(p))
+#define IExtPackManager_get_InstalledExtPacks(p, aInstalledExtPacks) ((p)->lpVtbl->GetInstalledExtPacks(p, aInstalledExtPacks))
+#define IExtPackManager_GetInstalledExtPacks(p, aInstalledExtPacks) ((p)->lpVtbl->GetInstalledExtPacks(p, aInstalledExtPacks))
+#define IExtPackManager_Find(p, aName, aReturnData) ((p)->lpVtbl->Find(p, aName, aReturnData))
+#define IExtPackManager_OpenExtPackFile(p, aPath, aFile) ((p)->lpVtbl->OpenExtPackFile(p, aPath, aFile))
+#define IExtPackManager_Uninstall(p, aName, aForcedRemoval, aDisplayInfo, aProgess) ((p)->lpVtbl->Uninstall(p, aName, aForcedRemoval, aDisplayInfo, aProgess))
+#define IExtPackManager_Cleanup(p) ((p)->lpVtbl->Cleanup(p))
+#define IExtPackManager_QueryAllPlugInsForFrontend(p, aFrontendName, aPlugInModules) ((p)->lpVtbl->QueryAllPlugInsForFrontend(p, aFrontendName, aPlugInModules))
+#define IExtPackManager_IsExtPackUsable(p, aName, aUsable) ((p)->lpVtbl->IsExtPackUsable(p, aName, aUsable))
+#endif /* VBOX_WITH_GLUE */
+
+interface IExtPackManager
+{
+#ifndef VBOX_WITH_GLUE
+    struct IExtPackManager_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IExtPackManagerVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IExtPackManager declaration */
+
+
+/* Start of struct IBandwidthGroup declaration */
+#define IBANDWIDTHGROUP_IID_STR "badea2d7-0261-4146-89f0-6a57cc34833d"
+#define IBANDWIDTHGROUP_IID { \
+    0xbadea2d7, 0x0261, 0x4146, \
+    { 0x89, 0xf0, 0x6a, 0x57, 0xcc, 0x34, 0x83, 0x3d } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IBandwidthGroup);
+#ifndef VBOX_WITH_GLUE
+struct IBandwidthGroup_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetName)(IBandwidthGroup *pThis, PRUnichar * *name);
+
+    nsresult (*GetType)(IBandwidthGroup *pThis, PRUint32 *type);
+
+    nsresult (*GetReference)(IBandwidthGroup *pThis, PRUint32 *reference);
+
+    nsresult (*GetMaxBytesPerSec)(IBandwidthGroup *pThis, PRInt64 *maxBytesPerSec);
+    nsresult (*SetMaxBytesPerSec)(IBandwidthGroup *pThis, PRInt64 maxBytesPerSec);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IBandwidthGroupVtbl
+{
+    nsresult (*QueryInterface)(IBandwidthGroup *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IBandwidthGroup *pThis);
+    nsrefcnt (*Release)(IBandwidthGroup *pThis);
+    nsresult (*GetName)(IBandwidthGroup *pThis, PRUnichar * *name);
+
+    nsresult (*GetType)(IBandwidthGroup *pThis, PRUint32 *type);
+
+    nsresult (*GetReference)(IBandwidthGroup *pThis, PRUint32 *reference);
+
+    nsresult (*GetMaxBytesPerSec)(IBandwidthGroup *pThis, PRInt64 *maxBytesPerSec);
+    nsresult (*SetMaxBytesPerSec)(IBandwidthGroup *pThis, PRInt64 maxBytesPerSec);
+
+};
+#define IBandwidthGroup_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IBandwidthGroup_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IBandwidthGroup_Release(p) ((p)->lpVtbl->Release(p))
+#define IBandwidthGroup_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IBandwidthGroup_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IBandwidthGroup_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IBandwidthGroup_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IBandwidthGroup_get_Reference(p, aReference) ((p)->lpVtbl->GetReference(p, aReference))
+#define IBandwidthGroup_GetReference(p, aReference) ((p)->lpVtbl->GetReference(p, aReference))
+#define IBandwidthGroup_get_MaxBytesPerSec(p, aMaxBytesPerSec) ((p)->lpVtbl->GetMaxBytesPerSec(p, aMaxBytesPerSec))
+#define IBandwidthGroup_GetMaxBytesPerSec(p, aMaxBytesPerSec) ((p)->lpVtbl->GetMaxBytesPerSec(p, aMaxBytesPerSec))
+#define IBandwidthGroup_put_MaxBytesPerSec(p, aMaxBytesPerSec) ((p)->lpVtbl->SetMaxBytesPerSec(p, aMaxBytesPerSec))
+#define IBandwidthGroup_SetMaxBytesPerSec(p, aMaxBytesPerSec) ((p)->lpVtbl->SetMaxBytesPerSec(p, aMaxBytesPerSec))
+#endif /* VBOX_WITH_GLUE */
+
+interface IBandwidthGroup
+{
+#ifndef VBOX_WITH_GLUE
+    struct IBandwidthGroup_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IBandwidthGroupVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IBandwidthGroup declaration */
+
+
+/* Start of struct IBandwidthControl declaration */
+#define IBANDWIDTHCONTROL_IID_STR "e2eb3930-d2f4-4f87-be17-0707e30f019f"
+#define IBANDWIDTHCONTROL_IID { \
+    0xe2eb3930, 0xd2f4, 0x4f87, \
+    { 0xbe, 0x17, 0x07, 0x07, 0xe3, 0x0f, 0x01, 0x9f } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IBandwidthControl);
+#ifndef VBOX_WITH_GLUE
+struct IBandwidthControl_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetNumGroups)(IBandwidthControl *pThis, PRUint32 *numGroups);
+
+    nsresult (*CreateBandwidthGroup)(
+        IBandwidthControl *pThis,
+        PRUnichar * name,
+        PRUint32 type,
+        PRInt64 maxBytesPerSec
+    );
+
+    nsresult (*DeleteBandwidthGroup)(
+        IBandwidthControl *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*GetBandwidthGroup)(
+        IBandwidthControl *pThis,
+        PRUnichar * name,
+        IBandwidthGroup * * bandwidthGroup
+    );
+
+    nsresult (*GetAllBandwidthGroups)(
+        IBandwidthControl *pThis,
+        PRUint32 *bandwidthGroupsSize,
+        IBandwidthGroup *** bandwidthGroups
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IBandwidthControlVtbl
+{
+    nsresult (*QueryInterface)(IBandwidthControl *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IBandwidthControl *pThis);
+    nsrefcnt (*Release)(IBandwidthControl *pThis);
+    nsresult (*GetNumGroups)(IBandwidthControl *pThis, PRUint32 *numGroups);
+
+    nsresult (*CreateBandwidthGroup)(
+        IBandwidthControl *pThis,
+        PRUnichar * name,
+        PRUint32 type,
+        PRInt64 maxBytesPerSec
+    );
+
+    nsresult (*DeleteBandwidthGroup)(
+        IBandwidthControl *pThis,
+        PRUnichar * name
+    );
+
+    nsresult (*GetBandwidthGroup)(
+        IBandwidthControl *pThis,
+        PRUnichar * name,
+        IBandwidthGroup * * bandwidthGroup
+    );
+
+    nsresult (*GetAllBandwidthGroups)(
+        IBandwidthControl *pThis,
+        PRUint32 *bandwidthGroupsSize,
+        IBandwidthGroup *** bandwidthGroups
+    );
+
+};
+#define IBandwidthControl_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IBandwidthControl_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IBandwidthControl_Release(p) ((p)->lpVtbl->Release(p))
+#define IBandwidthControl_get_NumGroups(p, aNumGroups) ((p)->lpVtbl->GetNumGroups(p, aNumGroups))
+#define IBandwidthControl_GetNumGroups(p, aNumGroups) ((p)->lpVtbl->GetNumGroups(p, aNumGroups))
+#define IBandwidthControl_CreateBandwidthGroup(p, aName, aType, aMaxBytesPerSec) ((p)->lpVtbl->CreateBandwidthGroup(p, aName, aType, aMaxBytesPerSec))
+#define IBandwidthControl_DeleteBandwidthGroup(p, aName) ((p)->lpVtbl->DeleteBandwidthGroup(p, aName))
+#define IBandwidthControl_GetBandwidthGroup(p, aName, aBandwidthGroup) ((p)->lpVtbl->GetBandwidthGroup(p, aName, aBandwidthGroup))
+#define IBandwidthControl_GetAllBandwidthGroups(p, aBandwidthGroups) ((p)->lpVtbl->GetAllBandwidthGroups(p, aBandwidthGroups))
+#endif /* VBOX_WITH_GLUE */
+
+interface IBandwidthControl
+{
+#ifndef VBOX_WITH_GLUE
+    struct IBandwidthControl_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IBandwidthControlVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IBandwidthControl declaration */
+
+
+/* Start of struct IVirtualBoxClient declaration */
+#define IVIRTUALBOXCLIENT_IID_STR "d191281f-b0cb-4d83-a8fa-0d9fd6ba234c"
+#define IVIRTUALBOXCLIENT_IID { \
+    0xd191281f, 0xb0cb, 0x4d83, \
+    { 0xa8, 0xfa, 0x0d, 0x9f, 0xd6, 0xba, 0x23, 0x4c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVirtualBoxClient);
+#ifndef VBOX_WITH_GLUE
+struct IVirtualBoxClient_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetVirtualBox)(IVirtualBoxClient *pThis, IVirtualBox * *virtualBox);
+
+    nsresult (*GetSession)(IVirtualBoxClient *pThis, ISession * *session);
+
+    nsresult (*GetEventSource)(IVirtualBoxClient *pThis, IEventSource * *eventSource);
+
+    nsresult (*CheckMachineError)(
+        IVirtualBoxClient *pThis,
+        IMachine * machine
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVirtualBoxClientVtbl
+{
+    nsresult (*QueryInterface)(IVirtualBoxClient *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVirtualBoxClient *pThis);
+    nsrefcnt (*Release)(IVirtualBoxClient *pThis);
+    nsresult (*GetVirtualBox)(IVirtualBoxClient *pThis, IVirtualBox * *virtualBox);
+
+    nsresult (*GetSession)(IVirtualBoxClient *pThis, ISession * *session);
+
+    nsresult (*GetEventSource)(IVirtualBoxClient *pThis, IEventSource * *eventSource);
+
+    nsresult (*CheckMachineError)(
+        IVirtualBoxClient *pThis,
+        IMachine * machine
+    );
+
+};
+#define IVirtualBoxClient_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVirtualBoxClient_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVirtualBoxClient_Release(p) ((p)->lpVtbl->Release(p))
+#define IVirtualBoxClient_get_VirtualBox(p, aVirtualBox) ((p)->lpVtbl->GetVirtualBox(p, aVirtualBox))
+#define IVirtualBoxClient_GetVirtualBox(p, aVirtualBox) ((p)->lpVtbl->GetVirtualBox(p, aVirtualBox))
+#define IVirtualBoxClient_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IVirtualBoxClient_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IVirtualBoxClient_get_EventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IVirtualBoxClient_GetEventSource(p, aEventSource) ((p)->lpVtbl->GetEventSource(p, aEventSource))
+#define IVirtualBoxClient_CheckMachineError(p, aMachine) ((p)->lpVtbl->CheckMachineError(p, aMachine))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVirtualBoxClient
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVirtualBoxClient_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVirtualBoxClientVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVirtualBoxClient declaration */
+
+
+/* Start of struct IEventSource declaration */
+#define IEVENTSOURCE_IID_STR "9b6e1aee-35f3-4f4d-b5bb-ed0ecefd8538"
+#define IEVENTSOURCE_IID { \
+    0x9b6e1aee, 0x35f3, 0x4f4d, \
+    { 0xb5, 0xbb, 0xed, 0x0e, 0xce, 0xfd, 0x85, 0x38 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IEventSource);
+#ifndef VBOX_WITH_GLUE
+struct IEventSource_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*CreateListener)(
+        IEventSource *pThis,
+        IEventListener * * listener
+    );
+
+    nsresult (*CreateAggregator)(
+        IEventSource *pThis,
+        PRUint32 subordinatesSize,
+        IEventSource ** subordinates,
+        IEventSource * * result
+    );
+
+    nsresult (*RegisterListener)(
+        IEventSource *pThis,
+        IEventListener * listener,
+        PRUint32 interestingSize,
+        PRUint32* interesting,
+        PRBool active
+    );
+
+    nsresult (*UnregisterListener)(
+        IEventSource *pThis,
+        IEventListener * listener
+    );
+
+    nsresult (*FireEvent)(
+        IEventSource *pThis,
+        IEvent * event,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetEvent)(
+        IEventSource *pThis,
+        IEventListener * listener,
+        PRInt32 timeout,
+        IEvent * * event
+    );
+
+    nsresult (*EventProcessed)(
+        IEventSource *pThis,
+        IEventListener * listener,
+        IEvent * event
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IEventSourceVtbl
+{
+    nsresult (*QueryInterface)(IEventSource *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IEventSource *pThis);
+    nsrefcnt (*Release)(IEventSource *pThis);
+    nsresult (*CreateListener)(
+        IEventSource *pThis,
+        IEventListener * * listener
+    );
+
+    nsresult (*CreateAggregator)(
+        IEventSource *pThis,
+        PRUint32 subordinatesSize,
+        IEventSource ** subordinates,
+        IEventSource * * result
+    );
+
+    nsresult (*RegisterListener)(
+        IEventSource *pThis,
+        IEventListener * listener,
+        PRUint32 interestingSize,
+        PRUint32* interesting,
+        PRBool active
+    );
+
+    nsresult (*UnregisterListener)(
+        IEventSource *pThis,
+        IEventListener * listener
+    );
+
+    nsresult (*FireEvent)(
+        IEventSource *pThis,
+        IEvent * event,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetEvent)(
+        IEventSource *pThis,
+        IEventListener * listener,
+        PRInt32 timeout,
+        IEvent * * event
+    );
+
+    nsresult (*EventProcessed)(
+        IEventSource *pThis,
+        IEventListener * listener,
+        IEvent * event
+    );
+
+};
+#define IEventSource_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IEventSource_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IEventSource_Release(p) ((p)->lpVtbl->Release(p))
+#define IEventSource_CreateListener(p, aListener) ((p)->lpVtbl->CreateListener(p, aListener))
+#define IEventSource_CreateAggregator(p, aSubordinates, aResult) ((p)->lpVtbl->CreateAggregator(p, aSubordinates, aResult))
+#define IEventSource_RegisterListener(p, aListener, aInteresting, aActive) ((p)->lpVtbl->RegisterListener(p, aListener, aInteresting, aActive))
+#define IEventSource_UnregisterListener(p, aListener) ((p)->lpVtbl->UnregisterListener(p, aListener))
+#define IEventSource_FireEvent(p, aEvent, aTimeout, aResult) ((p)->lpVtbl->FireEvent(p, aEvent, aTimeout, aResult))
+#define IEventSource_GetEvent(p, aListener, aTimeout, aEvent) ((p)->lpVtbl->GetEvent(p, aListener, aTimeout, aEvent))
+#define IEventSource_EventProcessed(p, aListener, aEvent) ((p)->lpVtbl->EventProcessed(p, aListener, aEvent))
+#endif /* VBOX_WITH_GLUE */
+
+interface IEventSource
+{
+#ifndef VBOX_WITH_GLUE
+    struct IEventSource_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IEventSourceVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IEventSource declaration */
+
+
+/* Start of struct IEventListener declaration */
+#define IEVENTLISTENER_IID_STR "67099191-32e7-4f6c-85ee-422304c71b90"
+#define IEVENTLISTENER_IID { \
+    0x67099191, 0x32e7, 0x4f6c, \
+    { 0x85, 0xee, 0x42, 0x23, 0x04, 0xc7, 0x1b, 0x90 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IEventListener);
+#ifndef VBOX_WITH_GLUE
+struct IEventListener_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*HandleEvent)(
+        IEventListener *pThis,
+        IEvent * event
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IEventListenerVtbl
+{
+    nsresult (*QueryInterface)(IEventListener *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IEventListener *pThis);
+    nsrefcnt (*Release)(IEventListener *pThis);
+    nsresult (*HandleEvent)(
+        IEventListener *pThis,
+        IEvent * event
+    );
+
+};
+#define IEventListener_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IEventListener_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IEventListener_Release(p) ((p)->lpVtbl->Release(p))
+#define IEventListener_HandleEvent(p, aEvent) ((p)->lpVtbl->HandleEvent(p, aEvent))
+#endif /* VBOX_WITH_GLUE */
+
+interface IEventListener
+{
+#ifndef VBOX_WITH_GLUE
+    struct IEventListener_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IEventListenerVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IEventListener declaration */
+
+
+/* Start of struct IEvent declaration */
+#define IEVENT_IID_STR "0ca2adba-8f30-401b-a8cd-fe31dbe839c0"
+#define IEVENT_IID { \
+    0x0ca2adba, 0x8f30, 0x401b, \
+    { 0xa8, 0xcd, 0xfe, 0x31, 0xdb, 0xe8, 0x39, 0xc0 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IEvent);
+#ifndef VBOX_WITH_GLUE
+struct IEvent_vtbl
+{
+    struct nsISupports_vtbl nsisupports;
+
+    nsresult (*GetType)(IEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IEventVtbl
+{
+    nsresult (*QueryInterface)(IEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IEvent *pThis);
+    nsrefcnt (*Release)(IEvent *pThis);
+    nsresult (*GetType)(IEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#define IEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IEvent declaration */
+
+
+/* Start of struct IReusableEvent declaration */
+#define IREUSABLEEVENT_IID_STR "69bfb134-80f6-4266-8e20-16371f68fa25"
+#define IREUSABLEEVENT_IID { \
+    0x69bfb134, 0x80f6, 0x4266, \
+    { 0x8e, 0x20, 0x16, 0x37, 0x1f, 0x68, 0xfa, 0x25 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IReusableEvent);
+#ifndef VBOX_WITH_GLUE
+struct IReusableEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetGeneration)(IReusableEvent *pThis, PRUint32 *generation);
+
+    nsresult (*Reuse)(IReusableEvent *pThis );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IReusableEventVtbl
+{
+    nsresult (*QueryInterface)(IReusableEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IReusableEvent *pThis);
+    nsrefcnt (*Release)(IReusableEvent *pThis);
+    nsresult (*GetType)(IReusableEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IReusableEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IReusableEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IReusableEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IReusableEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetGeneration)(IReusableEvent *pThis, PRUint32 *generation);
+
+    nsresult (*Reuse)(IReusableEvent *pThis );
+
+};
+#define IReusableEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IReusableEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IReusableEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IReusableEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IReusableEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IReusableEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IReusableEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IReusableEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IReusableEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IReusableEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IReusableEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IReusableEvent_get_Generation(p, aGeneration) ((p)->lpVtbl->GetGeneration(p, aGeneration))
+#define IReusableEvent_GetGeneration(p, aGeneration) ((p)->lpVtbl->GetGeneration(p, aGeneration))
+#define IReusableEvent_Reuse(p) ((p)->lpVtbl->Reuse(p))
+#endif /* VBOX_WITH_GLUE */
+
+interface IReusableEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IReusableEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IReusableEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IReusableEvent declaration */
+
+
+/* Start of struct IMachineEvent declaration */
+#define IMACHINEEVENT_IID_STR "92ed7b1a-0d96-40ed-ae46-a564d484325e"
+#define IMACHINEEVENT_IID { \
+    0x92ed7b1a, 0x0d96, 0x40ed, \
+    { 0xae, 0x46, 0xa5, 0x64, 0xd4, 0x84, 0x32, 0x5e } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMachineEvent);
+#ifndef VBOX_WITH_GLUE
+struct IMachineEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetMachineId)(IMachineEvent *pThis, PRUnichar * *machineId);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMachineEventVtbl
+{
+    nsresult (*QueryInterface)(IMachineEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMachineEvent *pThis);
+    nsrefcnt (*Release)(IMachineEvent *pThis);
+    nsresult (*GetType)(IMachineEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IMachineEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IMachineEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IMachineEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IMachineEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(IMachineEvent *pThis, PRUnichar * *machineId);
+
+};
+#define IMachineEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMachineEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMachineEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IMachineEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMachineEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMachineEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMachineEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMachineEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMachineEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMachineEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IMachineEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IMachineEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IMachineEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMachineEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMachineEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMachineEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMachineEvent declaration */
+
+
+/* Start of struct IMachineStateChangedEvent declaration */
+#define IMACHINESTATECHANGEDEVENT_IID_STR "5748F794-48DF-438D-85EB-98FFD70D18C9"
+#define IMACHINESTATECHANGEDEVENT_IID { \
+    0x5748F794, 0x48DF, 0x438D, \
+    { 0x85, 0xEB, 0x98, 0xFF, 0xD7, 0x0D, 0x18, 0xC9 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMachineStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IMachineStateChangedEvent_vtbl
+{
+    struct IMachineEvent_vtbl imachineevent;
+
+    nsresult (*GetState)(IMachineStateChangedEvent *pThis, PRUint32 *state);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMachineStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IMachineStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMachineStateChangedEvent *pThis);
+    nsrefcnt (*Release)(IMachineStateChangedEvent *pThis);
+    nsresult (*GetType)(IMachineStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IMachineStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IMachineStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IMachineStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IMachineStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(IMachineStateChangedEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetState)(IMachineStateChangedEvent *pThis, PRUint32 *state);
+
+};
+#define IMachineStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMachineStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMachineStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IMachineStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMachineStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMachineStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMachineStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMachineStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMachineStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMachineStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IMachineStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IMachineStateChangedEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IMachineStateChangedEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IMachineStateChangedEvent_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IMachineStateChangedEvent_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMachineStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMachineStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMachineStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMachineStateChangedEvent declaration */
+
+
+/* Start of struct IMachineDataChangedEvent declaration */
+#define IMACHINEDATACHANGEDEVENT_IID_STR "abe94809-2e88-4436-83d7-50f3e64d0503"
+#define IMACHINEDATACHANGEDEVENT_IID { \
+    0xabe94809, 0x2e88, 0x4436, \
+    { 0x83, 0xd7, 0x50, 0xf3, 0xe6, 0x4d, 0x05, 0x03 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMachineDataChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IMachineDataChangedEvent_vtbl
+{
+    struct IMachineEvent_vtbl imachineevent;
+
+    nsresult (*GetTemporary)(IMachineDataChangedEvent *pThis, PRBool *temporary);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMachineDataChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IMachineDataChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMachineDataChangedEvent *pThis);
+    nsrefcnt (*Release)(IMachineDataChangedEvent *pThis);
+    nsresult (*GetType)(IMachineDataChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IMachineDataChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IMachineDataChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IMachineDataChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IMachineDataChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(IMachineDataChangedEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetTemporary)(IMachineDataChangedEvent *pThis, PRBool *temporary);
+
+};
+#define IMachineDataChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMachineDataChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMachineDataChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IMachineDataChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMachineDataChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMachineDataChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMachineDataChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMachineDataChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMachineDataChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMachineDataChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IMachineDataChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IMachineDataChangedEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IMachineDataChangedEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IMachineDataChangedEvent_get_Temporary(p, aTemporary) ((p)->lpVtbl->GetTemporary(p, aTemporary))
+#define IMachineDataChangedEvent_GetTemporary(p, aTemporary) ((p)->lpVtbl->GetTemporary(p, aTemporary))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMachineDataChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMachineDataChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMachineDataChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMachineDataChangedEvent declaration */
+
+
+/* Start of struct IMediumRegisteredEvent declaration */
+#define IMEDIUMREGISTEREDEVENT_IID_STR "53fac49a-b7f1-4a5a-a4ef-a11dd9c2a458"
+#define IMEDIUMREGISTEREDEVENT_IID { \
+    0x53fac49a, 0xb7f1, 0x4a5a, \
+    { 0xa4, 0xef, 0xa1, 0x1d, 0xd9, 0xc2, 0xa4, 0x58 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMediumRegisteredEvent);
+#ifndef VBOX_WITH_GLUE
+struct IMediumRegisteredEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetMediumId)(IMediumRegisteredEvent *pThis, PRUnichar * *mediumId);
+
+    nsresult (*GetMediumType)(IMediumRegisteredEvent *pThis, PRUint32 *mediumType);
+
+    nsresult (*GetRegistered)(IMediumRegisteredEvent *pThis, PRBool *registered);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMediumRegisteredEventVtbl
+{
+    nsresult (*QueryInterface)(IMediumRegisteredEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMediumRegisteredEvent *pThis);
+    nsrefcnt (*Release)(IMediumRegisteredEvent *pThis);
+    nsresult (*GetType)(IMediumRegisteredEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IMediumRegisteredEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IMediumRegisteredEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IMediumRegisteredEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IMediumRegisteredEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMediumId)(IMediumRegisteredEvent *pThis, PRUnichar * *mediumId);
+
+    nsresult (*GetMediumType)(IMediumRegisteredEvent *pThis, PRUint32 *mediumType);
+
+    nsresult (*GetRegistered)(IMediumRegisteredEvent *pThis, PRBool *registered);
+
+};
+#define IMediumRegisteredEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMediumRegisteredEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMediumRegisteredEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IMediumRegisteredEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMediumRegisteredEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMediumRegisteredEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMediumRegisteredEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMediumRegisteredEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMediumRegisteredEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMediumRegisteredEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IMediumRegisteredEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IMediumRegisteredEvent_get_MediumId(p, aMediumId) ((p)->lpVtbl->GetMediumId(p, aMediumId))
+#define IMediumRegisteredEvent_GetMediumId(p, aMediumId) ((p)->lpVtbl->GetMediumId(p, aMediumId))
+#define IMediumRegisteredEvent_get_MediumType(p, aMediumType) ((p)->lpVtbl->GetMediumType(p, aMediumType))
+#define IMediumRegisteredEvent_GetMediumType(p, aMediumType) ((p)->lpVtbl->GetMediumType(p, aMediumType))
+#define IMediumRegisteredEvent_get_Registered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#define IMediumRegisteredEvent_GetRegistered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMediumRegisteredEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMediumRegisteredEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMediumRegisteredEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMediumRegisteredEvent declaration */
+
+
+/* Start of struct IMachineRegisteredEvent declaration */
+#define IMACHINEREGISTEREDEVENT_IID_STR "c354a762-3ff2-4f2e-8f09-07382ee25088"
+#define IMACHINEREGISTEREDEVENT_IID { \
+    0xc354a762, 0x3ff2, 0x4f2e, \
+    { 0x8f, 0x09, 0x07, 0x38, 0x2e, 0xe2, 0x50, 0x88 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMachineRegisteredEvent);
+#ifndef VBOX_WITH_GLUE
+struct IMachineRegisteredEvent_vtbl
+{
+    struct IMachineEvent_vtbl imachineevent;
+
+    nsresult (*GetRegistered)(IMachineRegisteredEvent *pThis, PRBool *registered);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMachineRegisteredEventVtbl
+{
+    nsresult (*QueryInterface)(IMachineRegisteredEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMachineRegisteredEvent *pThis);
+    nsrefcnt (*Release)(IMachineRegisteredEvent *pThis);
+    nsresult (*GetType)(IMachineRegisteredEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IMachineRegisteredEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IMachineRegisteredEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IMachineRegisteredEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IMachineRegisteredEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(IMachineRegisteredEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetRegistered)(IMachineRegisteredEvent *pThis, PRBool *registered);
+
+};
+#define IMachineRegisteredEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMachineRegisteredEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMachineRegisteredEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IMachineRegisteredEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMachineRegisteredEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMachineRegisteredEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMachineRegisteredEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMachineRegisteredEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMachineRegisteredEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMachineRegisteredEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IMachineRegisteredEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IMachineRegisteredEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IMachineRegisteredEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IMachineRegisteredEvent_get_Registered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#define IMachineRegisteredEvent_GetRegistered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMachineRegisteredEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMachineRegisteredEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMachineRegisteredEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMachineRegisteredEvent declaration */
+
+
+/* Start of struct ISessionStateChangedEvent declaration */
+#define ISESSIONSTATECHANGEDEVENT_IID_STR "714a3eef-799a-4489-86cd-fe8e45b2ff8e"
+#define ISESSIONSTATECHANGEDEVENT_IID { \
+    0x714a3eef, 0x799a, 0x4489, \
+    { 0x86, 0xcd, 0xfe, 0x8e, 0x45, 0xb2, 0xff, 0x8e } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISessionStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct ISessionStateChangedEvent_vtbl
+{
+    struct IMachineEvent_vtbl imachineevent;
+
+    nsresult (*GetState)(ISessionStateChangedEvent *pThis, PRUint32 *state);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISessionStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(ISessionStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISessionStateChangedEvent *pThis);
+    nsrefcnt (*Release)(ISessionStateChangedEvent *pThis);
+    nsresult (*GetType)(ISessionStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ISessionStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ISessionStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ISessionStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ISessionStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(ISessionStateChangedEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetState)(ISessionStateChangedEvent *pThis, PRUint32 *state);
+
+};
+#define ISessionStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISessionStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISessionStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ISessionStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISessionStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISessionStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISessionStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISessionStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISessionStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISessionStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ISessionStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ISessionStateChangedEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISessionStateChangedEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISessionStateChangedEvent_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define ISessionStateChangedEvent_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISessionStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISessionStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISessionStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISessionStateChangedEvent declaration */
+
+
+/* Start of struct IGuestPropertyChangedEvent declaration */
+#define IGUESTPROPERTYCHANGEDEVENT_IID_STR "3f63597a-26f1-4edb-8dd2-6bddd0912368"
+#define IGUESTPROPERTYCHANGEDEVENT_IID { \
+    0x3f63597a, 0x26f1, 0x4edb, \
+    { 0x8d, 0xd2, 0x6b, 0xdd, 0xd0, 0x91, 0x23, 0x68 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestPropertyChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestPropertyChangedEvent_vtbl
+{
+    struct IMachineEvent_vtbl imachineevent;
+
+    nsresult (*GetName)(IGuestPropertyChangedEvent *pThis, PRUnichar * *name);
+
+    nsresult (*GetValue)(IGuestPropertyChangedEvent *pThis, PRUnichar * *value);
+
+    nsresult (*GetFlags)(IGuestPropertyChangedEvent *pThis, PRUnichar * *flags);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestPropertyChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestPropertyChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestPropertyChangedEvent *pThis);
+    nsrefcnt (*Release)(IGuestPropertyChangedEvent *pThis);
+    nsresult (*GetType)(IGuestPropertyChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestPropertyChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestPropertyChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestPropertyChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestPropertyChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(IGuestPropertyChangedEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetName)(IGuestPropertyChangedEvent *pThis, PRUnichar * *name);
+
+    nsresult (*GetValue)(IGuestPropertyChangedEvent *pThis, PRUnichar * *value);
+
+    nsresult (*GetFlags)(IGuestPropertyChangedEvent *pThis, PRUnichar * *flags);
+
+};
+#define IGuestPropertyChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestPropertyChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestPropertyChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestPropertyChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestPropertyChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestPropertyChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestPropertyChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestPropertyChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestPropertyChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestPropertyChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestPropertyChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestPropertyChangedEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IGuestPropertyChangedEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IGuestPropertyChangedEvent_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestPropertyChangedEvent_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestPropertyChangedEvent_get_Value(p, aValue) ((p)->lpVtbl->GetValue(p, aValue))
+#define IGuestPropertyChangedEvent_GetValue(p, aValue) ((p)->lpVtbl->GetValue(p, aValue))
+#define IGuestPropertyChangedEvent_get_Flags(p, aFlags) ((p)->lpVtbl->GetFlags(p, aFlags))
+#define IGuestPropertyChangedEvent_GetFlags(p, aFlags) ((p)->lpVtbl->GetFlags(p, aFlags))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestPropertyChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestPropertyChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestPropertyChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestPropertyChangedEvent declaration */
+
+
+/* Start of struct ISnapshotEvent declaration */
+#define ISNAPSHOTEVENT_IID_STR "21637b0e-34b8-42d3-acfb-7e96daf77c22"
+#define ISNAPSHOTEVENT_IID { \
+    0x21637b0e, 0x34b8, 0x42d3, \
+    { 0xac, 0xfb, 0x7e, 0x96, 0xda, 0xf7, 0x7c, 0x22 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISnapshotEvent);
+#ifndef VBOX_WITH_GLUE
+struct ISnapshotEvent_vtbl
+{
+    struct IMachineEvent_vtbl imachineevent;
+
+    nsresult (*GetSnapshotId)(ISnapshotEvent *pThis, PRUnichar * *snapshotId);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISnapshotEventVtbl
+{
+    nsresult (*QueryInterface)(ISnapshotEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISnapshotEvent *pThis);
+    nsrefcnt (*Release)(ISnapshotEvent *pThis);
+    nsresult (*GetType)(ISnapshotEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ISnapshotEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ISnapshotEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ISnapshotEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ISnapshotEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(ISnapshotEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetSnapshotId)(ISnapshotEvent *pThis, PRUnichar * *snapshotId);
+
+};
+#define ISnapshotEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISnapshotEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISnapshotEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ISnapshotEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISnapshotEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISnapshotEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISnapshotEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISnapshotEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISnapshotEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISnapshotEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ISnapshotEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ISnapshotEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISnapshotEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISnapshotEvent_get_SnapshotId(p, aSnapshotId) ((p)->lpVtbl->GetSnapshotId(p, aSnapshotId))
+#define ISnapshotEvent_GetSnapshotId(p, aSnapshotId) ((p)->lpVtbl->GetSnapshotId(p, aSnapshotId))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISnapshotEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISnapshotEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISnapshotEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISnapshotEvent declaration */
+
+
+/* Start of struct ISnapshotTakenEvent declaration */
+#define ISNAPSHOTTAKENEVENT_IID_STR "d27c0b3d-6038-422c-b45e-6d4a0503d9f1"
+#define ISNAPSHOTTAKENEVENT_IID { \
+    0xd27c0b3d, 0x6038, 0x422c, \
+    { 0xb4, 0x5e, 0x6d, 0x4a, 0x05, 0x03, 0xd9, 0xf1 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISnapshotTakenEvent);
+#ifndef VBOX_WITH_GLUE
+struct ISnapshotTakenEvent_vtbl
+{
+    struct ISnapshotEvent_vtbl isnapshotevent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISnapshotTakenEventVtbl
+{
+    nsresult (*QueryInterface)(ISnapshotTakenEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISnapshotTakenEvent *pThis);
+    nsrefcnt (*Release)(ISnapshotTakenEvent *pThis);
+    nsresult (*GetType)(ISnapshotTakenEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ISnapshotTakenEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ISnapshotTakenEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ISnapshotTakenEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ISnapshotTakenEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(ISnapshotTakenEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetSnapshotId)(ISnapshotTakenEvent *pThis, PRUnichar * *snapshotId);
+
+};
+#define ISnapshotTakenEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISnapshotTakenEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISnapshotTakenEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ISnapshotTakenEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISnapshotTakenEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISnapshotTakenEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISnapshotTakenEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISnapshotTakenEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISnapshotTakenEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISnapshotTakenEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ISnapshotTakenEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ISnapshotTakenEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISnapshotTakenEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISnapshotTakenEvent_get_SnapshotId(p, aSnapshotId) ((p)->lpVtbl->GetSnapshotId(p, aSnapshotId))
+#define ISnapshotTakenEvent_GetSnapshotId(p, aSnapshotId) ((p)->lpVtbl->GetSnapshotId(p, aSnapshotId))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISnapshotTakenEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISnapshotTakenEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISnapshotTakenEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISnapshotTakenEvent declaration */
+
+
+/* Start of struct ISnapshotDeletedEvent declaration */
+#define ISNAPSHOTDELETEDEVENT_IID_STR "c48f3401-4a9e-43f4-b7a7-54bd285e22f4"
+#define ISNAPSHOTDELETEDEVENT_IID { \
+    0xc48f3401, 0x4a9e, 0x43f4, \
+    { 0xb7, 0xa7, 0x54, 0xbd, 0x28, 0x5e, 0x22, 0xf4 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISnapshotDeletedEvent);
+#ifndef VBOX_WITH_GLUE
+struct ISnapshotDeletedEvent_vtbl
+{
+    struct ISnapshotEvent_vtbl isnapshotevent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISnapshotDeletedEventVtbl
+{
+    nsresult (*QueryInterface)(ISnapshotDeletedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISnapshotDeletedEvent *pThis);
+    nsrefcnt (*Release)(ISnapshotDeletedEvent *pThis);
+    nsresult (*GetType)(ISnapshotDeletedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ISnapshotDeletedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ISnapshotDeletedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ISnapshotDeletedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ISnapshotDeletedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(ISnapshotDeletedEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetSnapshotId)(ISnapshotDeletedEvent *pThis, PRUnichar * *snapshotId);
+
+};
+#define ISnapshotDeletedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISnapshotDeletedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISnapshotDeletedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ISnapshotDeletedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISnapshotDeletedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISnapshotDeletedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISnapshotDeletedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISnapshotDeletedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISnapshotDeletedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISnapshotDeletedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ISnapshotDeletedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ISnapshotDeletedEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISnapshotDeletedEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISnapshotDeletedEvent_get_SnapshotId(p, aSnapshotId) ((p)->lpVtbl->GetSnapshotId(p, aSnapshotId))
+#define ISnapshotDeletedEvent_GetSnapshotId(p, aSnapshotId) ((p)->lpVtbl->GetSnapshotId(p, aSnapshotId))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISnapshotDeletedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISnapshotDeletedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISnapshotDeletedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISnapshotDeletedEvent declaration */
+
+
+/* Start of struct ISnapshotChangedEvent declaration */
+#define ISNAPSHOTCHANGEDEVENT_IID_STR "07541941-8079-447a-a33e-47a69c7980db"
+#define ISNAPSHOTCHANGEDEVENT_IID { \
+    0x07541941, 0x8079, 0x447a, \
+    { 0xa3, 0x3e, 0x47, 0xa6, 0x9c, 0x79, 0x80, 0xdb } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISnapshotChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct ISnapshotChangedEvent_vtbl
+{
+    struct ISnapshotEvent_vtbl isnapshotevent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISnapshotChangedEventVtbl
+{
+    nsresult (*QueryInterface)(ISnapshotChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISnapshotChangedEvent *pThis);
+    nsrefcnt (*Release)(ISnapshotChangedEvent *pThis);
+    nsresult (*GetType)(ISnapshotChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ISnapshotChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ISnapshotChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ISnapshotChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ISnapshotChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(ISnapshotChangedEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetSnapshotId)(ISnapshotChangedEvent *pThis, PRUnichar * *snapshotId);
+
+};
+#define ISnapshotChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISnapshotChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISnapshotChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ISnapshotChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISnapshotChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISnapshotChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISnapshotChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISnapshotChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISnapshotChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISnapshotChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ISnapshotChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ISnapshotChangedEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISnapshotChangedEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define ISnapshotChangedEvent_get_SnapshotId(p, aSnapshotId) ((p)->lpVtbl->GetSnapshotId(p, aSnapshotId))
+#define ISnapshotChangedEvent_GetSnapshotId(p, aSnapshotId) ((p)->lpVtbl->GetSnapshotId(p, aSnapshotId))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISnapshotChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISnapshotChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISnapshotChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISnapshotChangedEvent declaration */
+
+
+/* Start of struct IMousePointerShapeChangedEvent declaration */
+#define IMOUSEPOINTERSHAPECHANGEDEVENT_IID_STR "a6dcf6e8-416b-4181-8c4a-45ec95177aef"
+#define IMOUSEPOINTERSHAPECHANGEDEVENT_IID { \
+    0xa6dcf6e8, 0x416b, 0x4181, \
+    { 0x8c, 0x4a, 0x45, 0xec, 0x95, 0x17, 0x7a, 0xef } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMousePointerShapeChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IMousePointerShapeChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetVisible)(IMousePointerShapeChangedEvent *pThis, PRBool *visible);
+
+    nsresult (*GetAlpha)(IMousePointerShapeChangedEvent *pThis, PRBool *alpha);
+
+    nsresult (*GetXhot)(IMousePointerShapeChangedEvent *pThis, PRUint32 *xhot);
+
+    nsresult (*GetYhot)(IMousePointerShapeChangedEvent *pThis, PRUint32 *yhot);
+
+    nsresult (*GetWidth)(IMousePointerShapeChangedEvent *pThis, PRUint32 *width);
+
+    nsresult (*GetHeight)(IMousePointerShapeChangedEvent *pThis, PRUint32 *height);
+
+    nsresult (*GetShape)(IMousePointerShapeChangedEvent *pThis, PRUint32 *shapeSize, PRUint8 **shape);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMousePointerShapeChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IMousePointerShapeChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMousePointerShapeChangedEvent *pThis);
+    nsrefcnt (*Release)(IMousePointerShapeChangedEvent *pThis);
+    nsresult (*GetType)(IMousePointerShapeChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IMousePointerShapeChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IMousePointerShapeChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IMousePointerShapeChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IMousePointerShapeChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetVisible)(IMousePointerShapeChangedEvent *pThis, PRBool *visible);
+
+    nsresult (*GetAlpha)(IMousePointerShapeChangedEvent *pThis, PRBool *alpha);
+
+    nsresult (*GetXhot)(IMousePointerShapeChangedEvent *pThis, PRUint32 *xhot);
+
+    nsresult (*GetYhot)(IMousePointerShapeChangedEvent *pThis, PRUint32 *yhot);
+
+    nsresult (*GetWidth)(IMousePointerShapeChangedEvent *pThis, PRUint32 *width);
+
+    nsresult (*GetHeight)(IMousePointerShapeChangedEvent *pThis, PRUint32 *height);
+
+    nsresult (*GetShape)(IMousePointerShapeChangedEvent *pThis, PRUint32 *shapeSize, PRUint8 **shape);
+
+};
+#define IMousePointerShapeChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMousePointerShapeChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMousePointerShapeChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IMousePointerShapeChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMousePointerShapeChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMousePointerShapeChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMousePointerShapeChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMousePointerShapeChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMousePointerShapeChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMousePointerShapeChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IMousePointerShapeChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IMousePointerShapeChangedEvent_get_Visible(p, aVisible) ((p)->lpVtbl->GetVisible(p, aVisible))
+#define IMousePointerShapeChangedEvent_GetVisible(p, aVisible) ((p)->lpVtbl->GetVisible(p, aVisible))
+#define IMousePointerShapeChangedEvent_get_Alpha(p, aAlpha) ((p)->lpVtbl->GetAlpha(p, aAlpha))
+#define IMousePointerShapeChangedEvent_GetAlpha(p, aAlpha) ((p)->lpVtbl->GetAlpha(p, aAlpha))
+#define IMousePointerShapeChangedEvent_get_Xhot(p, aXhot) ((p)->lpVtbl->GetXhot(p, aXhot))
+#define IMousePointerShapeChangedEvent_GetXhot(p, aXhot) ((p)->lpVtbl->GetXhot(p, aXhot))
+#define IMousePointerShapeChangedEvent_get_Yhot(p, aYhot) ((p)->lpVtbl->GetYhot(p, aYhot))
+#define IMousePointerShapeChangedEvent_GetYhot(p, aYhot) ((p)->lpVtbl->GetYhot(p, aYhot))
+#define IMousePointerShapeChangedEvent_get_Width(p, aWidth) ((p)->lpVtbl->GetWidth(p, aWidth))
+#define IMousePointerShapeChangedEvent_GetWidth(p, aWidth) ((p)->lpVtbl->GetWidth(p, aWidth))
+#define IMousePointerShapeChangedEvent_get_Height(p, aHeight) ((p)->lpVtbl->GetHeight(p, aHeight))
+#define IMousePointerShapeChangedEvent_GetHeight(p, aHeight) ((p)->lpVtbl->GetHeight(p, aHeight))
+#define IMousePointerShapeChangedEvent_get_Shape(p, aShape) ((p)->lpVtbl->GetShape(p, aShape))
+#define IMousePointerShapeChangedEvent_GetShape(p, aShape) ((p)->lpVtbl->GetShape(p, aShape))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMousePointerShapeChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMousePointerShapeChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMousePointerShapeChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMousePointerShapeChangedEvent declaration */
+
+
+/* Start of struct IMouseCapabilityChangedEvent declaration */
+#define IMOUSECAPABILITYCHANGEDEVENT_IID_STR "70e7779a-e64a-4908-804e-371cad23a756"
+#define IMOUSECAPABILITYCHANGEDEVENT_IID { \
+    0x70e7779a, 0xe64a, 0x4908, \
+    { 0x80, 0x4e, 0x37, 0x1c, 0xad, 0x23, 0xa7, 0x56 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMouseCapabilityChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IMouseCapabilityChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetSupportsAbsolute)(IMouseCapabilityChangedEvent *pThis, PRBool *supportsAbsolute);
+
+    nsresult (*GetSupportsRelative)(IMouseCapabilityChangedEvent *pThis, PRBool *supportsRelative);
+
+    nsresult (*GetSupportsMultiTouch)(IMouseCapabilityChangedEvent *pThis, PRBool *supportsMultiTouch);
+
+    nsresult (*GetNeedsHostCursor)(IMouseCapabilityChangedEvent *pThis, PRBool *needsHostCursor);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMouseCapabilityChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IMouseCapabilityChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMouseCapabilityChangedEvent *pThis);
+    nsrefcnt (*Release)(IMouseCapabilityChangedEvent *pThis);
+    nsresult (*GetType)(IMouseCapabilityChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IMouseCapabilityChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IMouseCapabilityChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IMouseCapabilityChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IMouseCapabilityChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSupportsAbsolute)(IMouseCapabilityChangedEvent *pThis, PRBool *supportsAbsolute);
+
+    nsresult (*GetSupportsRelative)(IMouseCapabilityChangedEvent *pThis, PRBool *supportsRelative);
+
+    nsresult (*GetSupportsMultiTouch)(IMouseCapabilityChangedEvent *pThis, PRBool *supportsMultiTouch);
+
+    nsresult (*GetNeedsHostCursor)(IMouseCapabilityChangedEvent *pThis, PRBool *needsHostCursor);
+
+};
+#define IMouseCapabilityChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMouseCapabilityChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMouseCapabilityChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IMouseCapabilityChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMouseCapabilityChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMouseCapabilityChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMouseCapabilityChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMouseCapabilityChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMouseCapabilityChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMouseCapabilityChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IMouseCapabilityChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IMouseCapabilityChangedEvent_get_SupportsAbsolute(p, aSupportsAbsolute) ((p)->lpVtbl->GetSupportsAbsolute(p, aSupportsAbsolute))
+#define IMouseCapabilityChangedEvent_GetSupportsAbsolute(p, aSupportsAbsolute) ((p)->lpVtbl->GetSupportsAbsolute(p, aSupportsAbsolute))
+#define IMouseCapabilityChangedEvent_get_SupportsRelative(p, aSupportsRelative) ((p)->lpVtbl->GetSupportsRelative(p, aSupportsRelative))
+#define IMouseCapabilityChangedEvent_GetSupportsRelative(p, aSupportsRelative) ((p)->lpVtbl->GetSupportsRelative(p, aSupportsRelative))
+#define IMouseCapabilityChangedEvent_get_SupportsMultiTouch(p, aSupportsMultiTouch) ((p)->lpVtbl->GetSupportsMultiTouch(p, aSupportsMultiTouch))
+#define IMouseCapabilityChangedEvent_GetSupportsMultiTouch(p, aSupportsMultiTouch) ((p)->lpVtbl->GetSupportsMultiTouch(p, aSupportsMultiTouch))
+#define IMouseCapabilityChangedEvent_get_NeedsHostCursor(p, aNeedsHostCursor) ((p)->lpVtbl->GetNeedsHostCursor(p, aNeedsHostCursor))
+#define IMouseCapabilityChangedEvent_GetNeedsHostCursor(p, aNeedsHostCursor) ((p)->lpVtbl->GetNeedsHostCursor(p, aNeedsHostCursor))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMouseCapabilityChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMouseCapabilityChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMouseCapabilityChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMouseCapabilityChangedEvent declaration */
+
+
+/* Start of struct IKeyboardLedsChangedEvent declaration */
+#define IKEYBOARDLEDSCHANGEDEVENT_IID_STR "6DDEF35E-4737-457B-99FC-BC52C851A44F"
+#define IKEYBOARDLEDSCHANGEDEVENT_IID { \
+    0x6DDEF35E, 0x4737, 0x457B, \
+    { 0x99, 0xFC, 0xBC, 0x52, 0xC8, 0x51, 0xA4, 0x4F } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IKeyboardLedsChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IKeyboardLedsChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetNumLock)(IKeyboardLedsChangedEvent *pThis, PRBool *numLock);
+
+    nsresult (*GetCapsLock)(IKeyboardLedsChangedEvent *pThis, PRBool *capsLock);
+
+    nsresult (*GetScrollLock)(IKeyboardLedsChangedEvent *pThis, PRBool *scrollLock);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IKeyboardLedsChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IKeyboardLedsChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IKeyboardLedsChangedEvent *pThis);
+    nsrefcnt (*Release)(IKeyboardLedsChangedEvent *pThis);
+    nsresult (*GetType)(IKeyboardLedsChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IKeyboardLedsChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IKeyboardLedsChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IKeyboardLedsChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IKeyboardLedsChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetNumLock)(IKeyboardLedsChangedEvent *pThis, PRBool *numLock);
+
+    nsresult (*GetCapsLock)(IKeyboardLedsChangedEvent *pThis, PRBool *capsLock);
+
+    nsresult (*GetScrollLock)(IKeyboardLedsChangedEvent *pThis, PRBool *scrollLock);
+
+};
+#define IKeyboardLedsChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IKeyboardLedsChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IKeyboardLedsChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IKeyboardLedsChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IKeyboardLedsChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IKeyboardLedsChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IKeyboardLedsChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IKeyboardLedsChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IKeyboardLedsChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IKeyboardLedsChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IKeyboardLedsChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IKeyboardLedsChangedEvent_get_NumLock(p, aNumLock) ((p)->lpVtbl->GetNumLock(p, aNumLock))
+#define IKeyboardLedsChangedEvent_GetNumLock(p, aNumLock) ((p)->lpVtbl->GetNumLock(p, aNumLock))
+#define IKeyboardLedsChangedEvent_get_CapsLock(p, aCapsLock) ((p)->lpVtbl->GetCapsLock(p, aCapsLock))
+#define IKeyboardLedsChangedEvent_GetCapsLock(p, aCapsLock) ((p)->lpVtbl->GetCapsLock(p, aCapsLock))
+#define IKeyboardLedsChangedEvent_get_ScrollLock(p, aScrollLock) ((p)->lpVtbl->GetScrollLock(p, aScrollLock))
+#define IKeyboardLedsChangedEvent_GetScrollLock(p, aScrollLock) ((p)->lpVtbl->GetScrollLock(p, aScrollLock))
+#endif /* VBOX_WITH_GLUE */
+
+interface IKeyboardLedsChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IKeyboardLedsChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IKeyboardLedsChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IKeyboardLedsChangedEvent declaration */
+
+
+/* Start of struct IStateChangedEvent declaration */
+#define ISTATECHANGEDEVENT_IID_STR "4376693C-CF37-453B-9289-3B0F521CAF27"
+#define ISTATECHANGEDEVENT_IID { \
+    0x4376693C, 0xCF37, 0x453B, \
+    { 0x92, 0x89, 0x3B, 0x0F, 0x52, 0x1C, 0xAF, 0x27 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IStateChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetState)(IStateChangedEvent *pThis, PRUint32 *state);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IStateChangedEvent *pThis);
+    nsrefcnt (*Release)(IStateChangedEvent *pThis);
+    nsresult (*GetType)(IStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetState)(IStateChangedEvent *pThis, PRUint32 *state);
+
+};
+#define IStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IStateChangedEvent_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IStateChangedEvent_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#endif /* VBOX_WITH_GLUE */
+
+interface IStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IStateChangedEvent declaration */
+
+
+/* Start of struct IAdditionsStateChangedEvent declaration */
+#define IADDITIONSSTATECHANGEDEVENT_IID_STR "D70F7915-DA7C-44C8-A7AC-9F173490446A"
+#define IADDITIONSSTATECHANGEDEVENT_IID { \
+    0xD70F7915, 0xDA7C, 0x44C8, \
+    { 0xA7, 0xAC, 0x9F, 0x17, 0x34, 0x90, 0x44, 0x6A } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IAdditionsStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IAdditionsStateChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IAdditionsStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IAdditionsStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IAdditionsStateChangedEvent *pThis);
+    nsrefcnt (*Release)(IAdditionsStateChangedEvent *pThis);
+    nsresult (*GetType)(IAdditionsStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IAdditionsStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IAdditionsStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IAdditionsStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IAdditionsStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#define IAdditionsStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IAdditionsStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IAdditionsStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IAdditionsStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IAdditionsStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IAdditionsStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IAdditionsStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IAdditionsStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IAdditionsStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IAdditionsStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IAdditionsStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IAdditionsStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IAdditionsStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IAdditionsStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IAdditionsStateChangedEvent declaration */
+
+
+/* Start of struct INetworkAdapterChangedEvent declaration */
+#define INETWORKADAPTERCHANGEDEVENT_IID_STR "08889892-1EC6-4883-801D-77F56CFD0103"
+#define INETWORKADAPTERCHANGEDEVENT_IID { \
+    0x08889892, 0x1EC6, 0x4883, \
+    { 0x80, 0x1D, 0x77, 0xF5, 0x6C, 0xFD, 0x01, 0x03 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INetworkAdapterChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct INetworkAdapterChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetNetworkAdapter)(INetworkAdapterChangedEvent *pThis, INetworkAdapter * *networkAdapter);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INetworkAdapterChangedEventVtbl
+{
+    nsresult (*QueryInterface)(INetworkAdapterChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INetworkAdapterChangedEvent *pThis);
+    nsrefcnt (*Release)(INetworkAdapterChangedEvent *pThis);
+    nsresult (*GetType)(INetworkAdapterChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(INetworkAdapterChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(INetworkAdapterChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(INetworkAdapterChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        INetworkAdapterChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetNetworkAdapter)(INetworkAdapterChangedEvent *pThis, INetworkAdapter * *networkAdapter);
+
+};
+#define INetworkAdapterChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INetworkAdapterChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INetworkAdapterChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define INetworkAdapterChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INetworkAdapterChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INetworkAdapterChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INetworkAdapterChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INetworkAdapterChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INetworkAdapterChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INetworkAdapterChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define INetworkAdapterChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define INetworkAdapterChangedEvent_get_NetworkAdapter(p, aNetworkAdapter) ((p)->lpVtbl->GetNetworkAdapter(p, aNetworkAdapter))
+#define INetworkAdapterChangedEvent_GetNetworkAdapter(p, aNetworkAdapter) ((p)->lpVtbl->GetNetworkAdapter(p, aNetworkAdapter))
+#endif /* VBOX_WITH_GLUE */
+
+interface INetworkAdapterChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct INetworkAdapterChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INetworkAdapterChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INetworkAdapterChangedEvent declaration */
+
+
+/* Start of struct ISerialPortChangedEvent declaration */
+#define ISERIALPORTCHANGEDEVENT_IID_STR "3BA329DC-659C-488B-835C-4ECA7AE71C6C"
+#define ISERIALPORTCHANGEDEVENT_IID { \
+    0x3BA329DC, 0x659C, 0x488B, \
+    { 0x83, 0x5C, 0x4E, 0xCA, 0x7A, 0xE7, 0x1C, 0x6C } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISerialPortChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct ISerialPortChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetSerialPort)(ISerialPortChangedEvent *pThis, ISerialPort * *serialPort);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISerialPortChangedEventVtbl
+{
+    nsresult (*QueryInterface)(ISerialPortChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISerialPortChangedEvent *pThis);
+    nsrefcnt (*Release)(ISerialPortChangedEvent *pThis);
+    nsresult (*GetType)(ISerialPortChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ISerialPortChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ISerialPortChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ISerialPortChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ISerialPortChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSerialPort)(ISerialPortChangedEvent *pThis, ISerialPort * *serialPort);
+
+};
+#define ISerialPortChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISerialPortChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISerialPortChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ISerialPortChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISerialPortChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISerialPortChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISerialPortChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISerialPortChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISerialPortChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISerialPortChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ISerialPortChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ISerialPortChangedEvent_get_SerialPort(p, aSerialPort) ((p)->lpVtbl->GetSerialPort(p, aSerialPort))
+#define ISerialPortChangedEvent_GetSerialPort(p, aSerialPort) ((p)->lpVtbl->GetSerialPort(p, aSerialPort))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISerialPortChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISerialPortChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISerialPortChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISerialPortChangedEvent declaration */
+
+
+/* Start of struct IParallelPortChangedEvent declaration */
+#define IPARALLELPORTCHANGEDEVENT_IID_STR "813C99FC-9849-4F47-813E-24A75DC85615"
+#define IPARALLELPORTCHANGEDEVENT_IID { \
+    0x813C99FC, 0x9849, 0x4F47, \
+    { 0x81, 0x3E, 0x24, 0xA7, 0x5D, 0xC8, 0x56, 0x15 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IParallelPortChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IParallelPortChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetParallelPort)(IParallelPortChangedEvent *pThis, IParallelPort * *parallelPort);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IParallelPortChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IParallelPortChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IParallelPortChangedEvent *pThis);
+    nsrefcnt (*Release)(IParallelPortChangedEvent *pThis);
+    nsresult (*GetType)(IParallelPortChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IParallelPortChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IParallelPortChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IParallelPortChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IParallelPortChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetParallelPort)(IParallelPortChangedEvent *pThis, IParallelPort * *parallelPort);
+
+};
+#define IParallelPortChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IParallelPortChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IParallelPortChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IParallelPortChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IParallelPortChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IParallelPortChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IParallelPortChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IParallelPortChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IParallelPortChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IParallelPortChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IParallelPortChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IParallelPortChangedEvent_get_ParallelPort(p, aParallelPort) ((p)->lpVtbl->GetParallelPort(p, aParallelPort))
+#define IParallelPortChangedEvent_GetParallelPort(p, aParallelPort) ((p)->lpVtbl->GetParallelPort(p, aParallelPort))
+#endif /* VBOX_WITH_GLUE */
+
+interface IParallelPortChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IParallelPortChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IParallelPortChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IParallelPortChangedEvent declaration */
+
+
+/* Start of struct IStorageControllerChangedEvent declaration */
+#define ISTORAGECONTROLLERCHANGEDEVENT_IID_STR "715212BF-DA59-426E-8230-3831FAA52C56"
+#define ISTORAGECONTROLLERCHANGEDEVENT_IID { \
+    0x715212BF, 0xDA59, 0x426E, \
+    { 0x82, 0x30, 0x38, 0x31, 0xFA, 0xA5, 0x2C, 0x56 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IStorageControllerChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IStorageControllerChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IStorageControllerChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IStorageControllerChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IStorageControllerChangedEvent *pThis);
+    nsrefcnt (*Release)(IStorageControllerChangedEvent *pThis);
+    nsresult (*GetType)(IStorageControllerChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IStorageControllerChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IStorageControllerChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IStorageControllerChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IStorageControllerChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#define IStorageControllerChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IStorageControllerChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IStorageControllerChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IStorageControllerChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IStorageControllerChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IStorageControllerChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IStorageControllerChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IStorageControllerChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IStorageControllerChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IStorageControllerChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IStorageControllerChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IStorageControllerChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IStorageControllerChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IStorageControllerChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IStorageControllerChangedEvent declaration */
+
+
+/* Start of struct IMediumChangedEvent declaration */
+#define IMEDIUMCHANGEDEVENT_IID_STR "0FE2DA40-5637-472A-9736-72019EABD7DE"
+#define IMEDIUMCHANGEDEVENT_IID { \
+    0x0FE2DA40, 0x5637, 0x472A, \
+    { 0x97, 0x36, 0x72, 0x01, 0x9E, 0xAB, 0xD7, 0xDE } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IMediumChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IMediumChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetMediumAttachment)(IMediumChangedEvent *pThis, IMediumAttachment * *mediumAttachment);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IMediumChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IMediumChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IMediumChangedEvent *pThis);
+    nsrefcnt (*Release)(IMediumChangedEvent *pThis);
+    nsresult (*GetType)(IMediumChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IMediumChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IMediumChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IMediumChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IMediumChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMediumAttachment)(IMediumChangedEvent *pThis, IMediumAttachment * *mediumAttachment);
+
+};
+#define IMediumChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IMediumChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IMediumChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IMediumChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMediumChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IMediumChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMediumChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IMediumChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMediumChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IMediumChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IMediumChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IMediumChangedEvent_get_MediumAttachment(p, aMediumAttachment) ((p)->lpVtbl->GetMediumAttachment(p, aMediumAttachment))
+#define IMediumChangedEvent_GetMediumAttachment(p, aMediumAttachment) ((p)->lpVtbl->GetMediumAttachment(p, aMediumAttachment))
+#endif /* VBOX_WITH_GLUE */
+
+interface IMediumChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IMediumChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IMediumChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IMediumChangedEvent declaration */
+
+
+/* Start of struct IClipboardModeChangedEvent declaration */
+#define ICLIPBOARDMODECHANGEDEVENT_IID_STR "cac21692-7997-4595-a731-3a509db604e5"
+#define ICLIPBOARDMODECHANGEDEVENT_IID { \
+    0xcac21692, 0x7997, 0x4595, \
+    { 0xa7, 0x31, 0x3a, 0x50, 0x9d, 0xb6, 0x04, 0xe5 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IClipboardModeChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IClipboardModeChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetClipboardMode)(IClipboardModeChangedEvent *pThis, PRUint32 *clipboardMode);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IClipboardModeChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IClipboardModeChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IClipboardModeChangedEvent *pThis);
+    nsrefcnt (*Release)(IClipboardModeChangedEvent *pThis);
+    nsresult (*GetType)(IClipboardModeChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IClipboardModeChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IClipboardModeChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IClipboardModeChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IClipboardModeChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetClipboardMode)(IClipboardModeChangedEvent *pThis, PRUint32 *clipboardMode);
+
+};
+#define IClipboardModeChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IClipboardModeChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IClipboardModeChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IClipboardModeChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IClipboardModeChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IClipboardModeChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IClipboardModeChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IClipboardModeChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IClipboardModeChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IClipboardModeChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IClipboardModeChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IClipboardModeChangedEvent_get_ClipboardMode(p, aClipboardMode) ((p)->lpVtbl->GetClipboardMode(p, aClipboardMode))
+#define IClipboardModeChangedEvent_GetClipboardMode(p, aClipboardMode) ((p)->lpVtbl->GetClipboardMode(p, aClipboardMode))
+#endif /* VBOX_WITH_GLUE */
+
+interface IClipboardModeChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IClipboardModeChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IClipboardModeChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IClipboardModeChangedEvent declaration */
+
+
+/* Start of struct IDragAndDropModeChangedEvent declaration */
+#define IDRAGANDDROPMODECHANGEDEVENT_IID_STR "e90b8850-ac8e-4dff-8059-4100ae2c3c3d"
+#define IDRAGANDDROPMODECHANGEDEVENT_IID { \
+    0xe90b8850, 0xac8e, 0x4dff, \
+    { 0x80, 0x59, 0x41, 0x00, 0xae, 0x2c, 0x3c, 0x3d } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IDragAndDropModeChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IDragAndDropModeChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetDragAndDropMode)(IDragAndDropModeChangedEvent *pThis, PRUint32 *dragAndDropMode);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IDragAndDropModeChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IDragAndDropModeChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IDragAndDropModeChangedEvent *pThis);
+    nsrefcnt (*Release)(IDragAndDropModeChangedEvent *pThis);
+    nsresult (*GetType)(IDragAndDropModeChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IDragAndDropModeChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IDragAndDropModeChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IDragAndDropModeChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IDragAndDropModeChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetDragAndDropMode)(IDragAndDropModeChangedEvent *pThis, PRUint32 *dragAndDropMode);
+
+};
+#define IDragAndDropModeChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IDragAndDropModeChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IDragAndDropModeChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IDragAndDropModeChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IDragAndDropModeChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IDragAndDropModeChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IDragAndDropModeChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IDragAndDropModeChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IDragAndDropModeChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IDragAndDropModeChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IDragAndDropModeChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IDragAndDropModeChangedEvent_get_DragAndDropMode(p, aDragAndDropMode) ((p)->lpVtbl->GetDragAndDropMode(p, aDragAndDropMode))
+#define IDragAndDropModeChangedEvent_GetDragAndDropMode(p, aDragAndDropMode) ((p)->lpVtbl->GetDragAndDropMode(p, aDragAndDropMode))
+#endif /* VBOX_WITH_GLUE */
+
+interface IDragAndDropModeChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IDragAndDropModeChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IDragAndDropModeChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IDragAndDropModeChangedEvent declaration */
+
+
+/* Start of struct ICPUChangedEvent declaration */
+#define ICPUCHANGEDEVENT_IID_STR "4da2dec7-71b2-4817-9a64-4ed12c17388e"
+#define ICPUCHANGEDEVENT_IID { \
+    0x4da2dec7, 0x71b2, 0x4817, \
+    { 0x9a, 0x64, 0x4e, 0xd1, 0x2c, 0x17, 0x38, 0x8e } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ICPUChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct ICPUChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetCPU)(ICPUChangedEvent *pThis, PRUint32 *CPU);
+
+    nsresult (*GetAdd)(ICPUChangedEvent *pThis, PRBool *add);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ICPUChangedEventVtbl
+{
+    nsresult (*QueryInterface)(ICPUChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ICPUChangedEvent *pThis);
+    nsrefcnt (*Release)(ICPUChangedEvent *pThis);
+    nsresult (*GetType)(ICPUChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ICPUChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ICPUChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ICPUChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ICPUChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetCPU)(ICPUChangedEvent *pThis, PRUint32 *CPU);
+
+    nsresult (*GetAdd)(ICPUChangedEvent *pThis, PRBool *add);
+
+};
+#define ICPUChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ICPUChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ICPUChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ICPUChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ICPUChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ICPUChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ICPUChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ICPUChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ICPUChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ICPUChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ICPUChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ICPUChangedEvent_get_CPU(p, aCPU) ((p)->lpVtbl->GetCPU(p, aCPU))
+#define ICPUChangedEvent_GetCPU(p, aCPU) ((p)->lpVtbl->GetCPU(p, aCPU))
+#define ICPUChangedEvent_get_Add(p, aAdd) ((p)->lpVtbl->GetAdd(p, aAdd))
+#define ICPUChangedEvent_GetAdd(p, aAdd) ((p)->lpVtbl->GetAdd(p, aAdd))
+#endif /* VBOX_WITH_GLUE */
+
+interface ICPUChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ICPUChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ICPUChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ICPUChangedEvent declaration */
+
+
+/* Start of struct ICPUExecutionCapChangedEvent declaration */
+#define ICPUEXECUTIONCAPCHANGEDEVENT_IID_STR "dfa7e4f5-b4a4-44ce-85a8-127ac5eb59dc"
+#define ICPUEXECUTIONCAPCHANGEDEVENT_IID { \
+    0xdfa7e4f5, 0xb4a4, 0x44ce, \
+    { 0x85, 0xa8, 0x12, 0x7a, 0xc5, 0xeb, 0x59, 0xdc } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ICPUExecutionCapChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct ICPUExecutionCapChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetExecutionCap)(ICPUExecutionCapChangedEvent *pThis, PRUint32 *executionCap);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ICPUExecutionCapChangedEventVtbl
+{
+    nsresult (*QueryInterface)(ICPUExecutionCapChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ICPUExecutionCapChangedEvent *pThis);
+    nsrefcnt (*Release)(ICPUExecutionCapChangedEvent *pThis);
+    nsresult (*GetType)(ICPUExecutionCapChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ICPUExecutionCapChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ICPUExecutionCapChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ICPUExecutionCapChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ICPUExecutionCapChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetExecutionCap)(ICPUExecutionCapChangedEvent *pThis, PRUint32 *executionCap);
+
+};
+#define ICPUExecutionCapChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ICPUExecutionCapChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ICPUExecutionCapChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ICPUExecutionCapChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ICPUExecutionCapChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ICPUExecutionCapChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ICPUExecutionCapChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ICPUExecutionCapChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ICPUExecutionCapChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ICPUExecutionCapChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ICPUExecutionCapChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ICPUExecutionCapChangedEvent_get_ExecutionCap(p, aExecutionCap) ((p)->lpVtbl->GetExecutionCap(p, aExecutionCap))
+#define ICPUExecutionCapChangedEvent_GetExecutionCap(p, aExecutionCap) ((p)->lpVtbl->GetExecutionCap(p, aExecutionCap))
+#endif /* VBOX_WITH_GLUE */
+
+interface ICPUExecutionCapChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ICPUExecutionCapChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ICPUExecutionCapChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ICPUExecutionCapChangedEvent declaration */
+
+
+/* Start of struct IGuestKeyboardEvent declaration */
+#define IGUESTKEYBOARDEVENT_IID_STR "88394258-7006-40d4-b339-472ee3801844"
+#define IGUESTKEYBOARDEVENT_IID { \
+    0x88394258, 0x7006, 0x40d4, \
+    { 0xb3, 0x39, 0x47, 0x2e, 0xe3, 0x80, 0x18, 0x44 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestKeyboardEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestKeyboardEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetScancodes)(IGuestKeyboardEvent *pThis, PRUint32 *scancodesSize, PRInt32 **scancodes);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestKeyboardEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestKeyboardEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestKeyboardEvent *pThis);
+    nsrefcnt (*Release)(IGuestKeyboardEvent *pThis);
+    nsresult (*GetType)(IGuestKeyboardEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestKeyboardEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestKeyboardEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestKeyboardEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestKeyboardEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetScancodes)(IGuestKeyboardEvent *pThis, PRUint32 *scancodesSize, PRInt32 **scancodes);
+
+};
+#define IGuestKeyboardEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestKeyboardEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestKeyboardEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestKeyboardEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestKeyboardEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestKeyboardEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestKeyboardEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestKeyboardEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestKeyboardEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestKeyboardEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestKeyboardEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestKeyboardEvent_get_Scancodes(p, aScancodes) ((p)->lpVtbl->GetScancodes(p, aScancodes))
+#define IGuestKeyboardEvent_GetScancodes(p, aScancodes) ((p)->lpVtbl->GetScancodes(p, aScancodes))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestKeyboardEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestKeyboardEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestKeyboardEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestKeyboardEvent declaration */
+
+
+/* Start of struct IGuestMouseEvent declaration */
+#define IGUESTMOUSEEVENT_IID_STR "179f8647-319c-4e7e-8150-c5837bd265f6"
+#define IGUESTMOUSEEVENT_IID { \
+    0x179f8647, 0x319c, 0x4e7e, \
+    { 0x81, 0x50, 0xc5, 0x83, 0x7b, 0xd2, 0x65, 0xf6 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestMouseEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestMouseEvent_vtbl
+{
+    struct IReusableEvent_vtbl ireusableevent;
+
+    nsresult (*GetMode)(IGuestMouseEvent *pThis, PRUint32 *mode);
+
+    nsresult (*GetX)(IGuestMouseEvent *pThis, PRInt32 *x);
+
+    nsresult (*GetY)(IGuestMouseEvent *pThis, PRInt32 *y);
+
+    nsresult (*GetZ)(IGuestMouseEvent *pThis, PRInt32 *z);
+
+    nsresult (*GetW)(IGuestMouseEvent *pThis, PRInt32 *w);
+
+    nsresult (*GetButtons)(IGuestMouseEvent *pThis, PRInt32 *buttons);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestMouseEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestMouseEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestMouseEvent *pThis);
+    nsrefcnt (*Release)(IGuestMouseEvent *pThis);
+    nsresult (*GetType)(IGuestMouseEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestMouseEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestMouseEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestMouseEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestMouseEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetGeneration)(IGuestMouseEvent *pThis, PRUint32 *generation);
+
+    nsresult (*Reuse)(IGuestMouseEvent *pThis );
+
+    nsresult (*GetMode)(IGuestMouseEvent *pThis, PRUint32 *mode);
+
+    nsresult (*GetX)(IGuestMouseEvent *pThis, PRInt32 *x);
+
+    nsresult (*GetY)(IGuestMouseEvent *pThis, PRInt32 *y);
+
+    nsresult (*GetZ)(IGuestMouseEvent *pThis, PRInt32 *z);
+
+    nsresult (*GetW)(IGuestMouseEvent *pThis, PRInt32 *w);
+
+    nsresult (*GetButtons)(IGuestMouseEvent *pThis, PRInt32 *buttons);
+
+};
+#define IGuestMouseEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestMouseEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestMouseEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestMouseEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestMouseEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestMouseEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestMouseEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestMouseEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestMouseEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestMouseEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestMouseEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestMouseEvent_get_Generation(p, aGeneration) ((p)->lpVtbl->GetGeneration(p, aGeneration))
+#define IGuestMouseEvent_GetGeneration(p, aGeneration) ((p)->lpVtbl->GetGeneration(p, aGeneration))
+#define IGuestMouseEvent_Reuse(p) ((p)->lpVtbl->Reuse(p))
+#define IGuestMouseEvent_get_Mode(p, aMode) ((p)->lpVtbl->GetMode(p, aMode))
+#define IGuestMouseEvent_GetMode(p, aMode) ((p)->lpVtbl->GetMode(p, aMode))
+#define IGuestMouseEvent_get_X(p, aX) ((p)->lpVtbl->GetX(p, aX))
+#define IGuestMouseEvent_GetX(p, aX) ((p)->lpVtbl->GetX(p, aX))
+#define IGuestMouseEvent_get_Y(p, aY) ((p)->lpVtbl->GetY(p, aY))
+#define IGuestMouseEvent_GetY(p, aY) ((p)->lpVtbl->GetY(p, aY))
+#define IGuestMouseEvent_get_Z(p, aZ) ((p)->lpVtbl->GetZ(p, aZ))
+#define IGuestMouseEvent_GetZ(p, aZ) ((p)->lpVtbl->GetZ(p, aZ))
+#define IGuestMouseEvent_get_W(p, aW) ((p)->lpVtbl->GetW(p, aW))
+#define IGuestMouseEvent_GetW(p, aW) ((p)->lpVtbl->GetW(p, aW))
+#define IGuestMouseEvent_get_Buttons(p, aButtons) ((p)->lpVtbl->GetButtons(p, aButtons))
+#define IGuestMouseEvent_GetButtons(p, aButtons) ((p)->lpVtbl->GetButtons(p, aButtons))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestMouseEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestMouseEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestMouseEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestMouseEvent declaration */
+
+
+/* Start of struct IGuestMultiTouchEvent declaration */
+#define IGUESTMULTITOUCHEVENT_IID_STR "be8a0eb5-f4f4-4dd0-9d30-c89b873247ec"
+#define IGUESTMULTITOUCHEVENT_IID { \
+    0xbe8a0eb5, 0xf4f4, 0x4dd0, \
+    { 0x9d, 0x30, 0xc8, 0x9b, 0x87, 0x32, 0x47, 0xec } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestMultiTouchEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestMultiTouchEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetContactCount)(IGuestMultiTouchEvent *pThis, PRInt32 *contactCount);
+
+    nsresult (*GetXPositions)(IGuestMultiTouchEvent *pThis, PRUint32 *xPositionsSize, PRInt16 **xPositions);
+
+    nsresult (*GetYPositions)(IGuestMultiTouchEvent *pThis, PRUint32 *yPositionsSize, PRInt16 **yPositions);
+
+    nsresult (*GetContactIds)(IGuestMultiTouchEvent *pThis, PRUint32 *contactIdsSize, PRUint16 **contactIds);
+
+    nsresult (*GetContactFlags)(IGuestMultiTouchEvent *pThis, PRUint32 *contactFlagsSize, PRUint16 **contactFlags);
+
+    nsresult (*GetScanTime)(IGuestMultiTouchEvent *pThis, PRUint32 *scanTime);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestMultiTouchEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestMultiTouchEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestMultiTouchEvent *pThis);
+    nsrefcnt (*Release)(IGuestMultiTouchEvent *pThis);
+    nsresult (*GetType)(IGuestMultiTouchEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestMultiTouchEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestMultiTouchEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestMultiTouchEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestMultiTouchEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetContactCount)(IGuestMultiTouchEvent *pThis, PRInt32 *contactCount);
+
+    nsresult (*GetXPositions)(IGuestMultiTouchEvent *pThis, PRUint32 *xPositionsSize, PRInt16 **xPositions);
+
+    nsresult (*GetYPositions)(IGuestMultiTouchEvent *pThis, PRUint32 *yPositionsSize, PRInt16 **yPositions);
+
+    nsresult (*GetContactIds)(IGuestMultiTouchEvent *pThis, PRUint32 *contactIdsSize, PRUint16 **contactIds);
+
+    nsresult (*GetContactFlags)(IGuestMultiTouchEvent *pThis, PRUint32 *contactFlagsSize, PRUint16 **contactFlags);
+
+    nsresult (*GetScanTime)(IGuestMultiTouchEvent *pThis, PRUint32 *scanTime);
+
+};
+#define IGuestMultiTouchEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestMultiTouchEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestMultiTouchEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestMultiTouchEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestMultiTouchEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestMultiTouchEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestMultiTouchEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestMultiTouchEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestMultiTouchEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestMultiTouchEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestMultiTouchEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestMultiTouchEvent_get_ContactCount(p, aContactCount) ((p)->lpVtbl->GetContactCount(p, aContactCount))
+#define IGuestMultiTouchEvent_GetContactCount(p, aContactCount) ((p)->lpVtbl->GetContactCount(p, aContactCount))
+#define IGuestMultiTouchEvent_get_XPositions(p, aXPositions) ((p)->lpVtbl->GetXPositions(p, aXPositions))
+#define IGuestMultiTouchEvent_GetXPositions(p, aXPositions) ((p)->lpVtbl->GetXPositions(p, aXPositions))
+#define IGuestMultiTouchEvent_get_YPositions(p, aYPositions) ((p)->lpVtbl->GetYPositions(p, aYPositions))
+#define IGuestMultiTouchEvent_GetYPositions(p, aYPositions) ((p)->lpVtbl->GetYPositions(p, aYPositions))
+#define IGuestMultiTouchEvent_get_ContactIds(p, aContactIds) ((p)->lpVtbl->GetContactIds(p, aContactIds))
+#define IGuestMultiTouchEvent_GetContactIds(p, aContactIds) ((p)->lpVtbl->GetContactIds(p, aContactIds))
+#define IGuestMultiTouchEvent_get_ContactFlags(p, aContactFlags) ((p)->lpVtbl->GetContactFlags(p, aContactFlags))
+#define IGuestMultiTouchEvent_GetContactFlags(p, aContactFlags) ((p)->lpVtbl->GetContactFlags(p, aContactFlags))
+#define IGuestMultiTouchEvent_get_ScanTime(p, aScanTime) ((p)->lpVtbl->GetScanTime(p, aScanTime))
+#define IGuestMultiTouchEvent_GetScanTime(p, aScanTime) ((p)->lpVtbl->GetScanTime(p, aScanTime))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestMultiTouchEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestMultiTouchEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestMultiTouchEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestMultiTouchEvent declaration */
+
+
+/* Start of struct IGuestSessionEvent declaration */
+#define IGUESTSESSIONEVENT_IID_STR "b9acd33f-647d-45ac-8fe9-f49b3183ba37"
+#define IGUESTSESSIONEVENT_IID { \
+    0xb9acd33f, 0x647d, 0x45ac, \
+    { 0x8f, 0xe9, 0xf4, 0x9b, 0x31, 0x83, 0xba, 0x37 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestSessionEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestSessionEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetSession)(IGuestSessionEvent *pThis, IGuestSession * *session);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestSessionEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestSessionEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestSessionEvent *pThis);
+    nsrefcnt (*Release)(IGuestSessionEvent *pThis);
+    nsresult (*GetType)(IGuestSessionEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestSessionEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestSessionEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestSessionEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestSessionEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestSessionEvent *pThis, IGuestSession * *session);
+
+};
+#define IGuestSessionEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestSessionEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestSessionEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestSessionEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestSessionEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestSessionEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestSessionEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestSessionEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestSessionEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestSessionEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestSessionEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestSessionEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestSessionEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestSessionEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestSessionEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestSessionEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestSessionEvent declaration */
+
+
+/* Start of struct IGuestSessionStateChangedEvent declaration */
+#define IGUESTSESSIONSTATECHANGEDEVENT_IID_STR "327e3c00-ee61-462f-aed3-0dff6cbf9904"
+#define IGUESTSESSIONSTATECHANGEDEVENT_IID { \
+    0x327e3c00, 0xee61, 0x462f, \
+    { 0xae, 0xd3, 0x0d, 0xff, 0x6c, 0xbf, 0x99, 0x04 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestSessionStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestSessionStateChangedEvent_vtbl
+{
+    struct IGuestSessionEvent_vtbl iguestsessionevent;
+
+    nsresult (*GetId)(IGuestSessionStateChangedEvent *pThis, PRUint32 *id);
+
+    nsresult (*GetStatus)(IGuestSessionStateChangedEvent *pThis, PRUint32 *status);
+
+    nsresult (*GetError)(IGuestSessionStateChangedEvent *pThis, IVirtualBoxErrorInfo * *error);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestSessionStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestSessionStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestSessionStateChangedEvent *pThis);
+    nsrefcnt (*Release)(IGuestSessionStateChangedEvent *pThis);
+    nsresult (*GetType)(IGuestSessionStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestSessionStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestSessionStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestSessionStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestSessionStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestSessionStateChangedEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetId)(IGuestSessionStateChangedEvent *pThis, PRUint32 *id);
+
+    nsresult (*GetStatus)(IGuestSessionStateChangedEvent *pThis, PRUint32 *status);
+
+    nsresult (*GetError)(IGuestSessionStateChangedEvent *pThis, IVirtualBoxErrorInfo * *error);
+
+};
+#define IGuestSessionStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestSessionStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestSessionStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestSessionStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestSessionStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestSessionStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestSessionStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestSessionStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestSessionStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestSessionStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestSessionStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestSessionStateChangedEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestSessionStateChangedEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestSessionStateChangedEvent_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IGuestSessionStateChangedEvent_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IGuestSessionStateChangedEvent_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestSessionStateChangedEvent_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestSessionStateChangedEvent_get_Error(p, aError) ((p)->lpVtbl->GetError(p, aError))
+#define IGuestSessionStateChangedEvent_GetError(p, aError) ((p)->lpVtbl->GetError(p, aError))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestSessionStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestSessionStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestSessionStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestSessionStateChangedEvent declaration */
+
+
+/* Start of struct IGuestSessionRegisteredEvent declaration */
+#define IGUESTSESSIONREGISTEREDEVENT_IID_STR "b79de686-eabd-4fa6-960a-f1756c99ea1c"
+#define IGUESTSESSIONREGISTEREDEVENT_IID { \
+    0xb79de686, 0xeabd, 0x4fa6, \
+    { 0x96, 0x0a, 0xf1, 0x75, 0x6c, 0x99, 0xea, 0x1c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestSessionRegisteredEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestSessionRegisteredEvent_vtbl
+{
+    struct IGuestSessionEvent_vtbl iguestsessionevent;
+
+    nsresult (*GetRegistered)(IGuestSessionRegisteredEvent *pThis, PRBool *registered);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestSessionRegisteredEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestSessionRegisteredEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestSessionRegisteredEvent *pThis);
+    nsrefcnt (*Release)(IGuestSessionRegisteredEvent *pThis);
+    nsresult (*GetType)(IGuestSessionRegisteredEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestSessionRegisteredEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestSessionRegisteredEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestSessionRegisteredEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestSessionRegisteredEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestSessionRegisteredEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetRegistered)(IGuestSessionRegisteredEvent *pThis, PRBool *registered);
+
+};
+#define IGuestSessionRegisteredEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestSessionRegisteredEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestSessionRegisteredEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestSessionRegisteredEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestSessionRegisteredEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestSessionRegisteredEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestSessionRegisteredEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestSessionRegisteredEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestSessionRegisteredEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestSessionRegisteredEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestSessionRegisteredEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestSessionRegisteredEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestSessionRegisteredEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestSessionRegisteredEvent_get_Registered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#define IGuestSessionRegisteredEvent_GetRegistered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestSessionRegisteredEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestSessionRegisteredEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestSessionRegisteredEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestSessionRegisteredEvent declaration */
+
+
+/* Start of struct IGuestProcessEvent declaration */
+#define IGUESTPROCESSEVENT_IID_STR "2405f0e5-6588-40a3-9b0a-68c05ba52c4b"
+#define IGUESTPROCESSEVENT_IID { \
+    0x2405f0e5, 0x6588, 0x40a3, \
+    { 0x9b, 0x0a, 0x68, 0xc0, 0x5b, 0xa5, 0x2c, 0x4b } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestProcessEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestProcessEvent_vtbl
+{
+    struct IGuestSessionEvent_vtbl iguestsessionevent;
+
+    nsresult (*GetProcess)(IGuestProcessEvent *pThis, IGuestProcess * *process);
+
+    nsresult (*GetPid)(IGuestProcessEvent *pThis, PRUint32 *pid);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestProcessEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestProcessEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestProcessEvent *pThis);
+    nsrefcnt (*Release)(IGuestProcessEvent *pThis);
+    nsresult (*GetType)(IGuestProcessEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestProcessEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestProcessEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestProcessEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestProcessEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestProcessEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetProcess)(IGuestProcessEvent *pThis, IGuestProcess * *process);
+
+    nsresult (*GetPid)(IGuestProcessEvent *pThis, PRUint32 *pid);
+
+};
+#define IGuestProcessEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestProcessEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestProcessEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestProcessEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestProcessEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestProcessEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessEvent_get_Process(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessEvent_GetProcess(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessEvent_get_Pid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessEvent_GetPid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestProcessEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestProcessEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestProcessEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestProcessEvent declaration */
+
+
+/* Start of struct IGuestProcessRegisteredEvent declaration */
+#define IGUESTPROCESSREGISTEREDEVENT_IID_STR "1d89e2b3-c6ea-45b6-9d43-dc6f70cc9f02"
+#define IGUESTPROCESSREGISTEREDEVENT_IID { \
+    0x1d89e2b3, 0xc6ea, 0x45b6, \
+    { 0x9d, 0x43, 0xdc, 0x6f, 0x70, 0xcc, 0x9f, 0x02 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestProcessRegisteredEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestProcessRegisteredEvent_vtbl
+{
+    struct IGuestProcessEvent_vtbl iguestprocessevent;
+
+    nsresult (*GetRegistered)(IGuestProcessRegisteredEvent *pThis, PRBool *registered);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestProcessRegisteredEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestProcessRegisteredEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestProcessRegisteredEvent *pThis);
+    nsrefcnt (*Release)(IGuestProcessRegisteredEvent *pThis);
+    nsresult (*GetType)(IGuestProcessRegisteredEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestProcessRegisteredEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestProcessRegisteredEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestProcessRegisteredEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestProcessRegisteredEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestProcessRegisteredEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetProcess)(IGuestProcessRegisteredEvent *pThis, IGuestProcess * *process);
+
+    nsresult (*GetPid)(IGuestProcessRegisteredEvent *pThis, PRUint32 *pid);
+
+    nsresult (*GetRegistered)(IGuestProcessRegisteredEvent *pThis, PRBool *registered);
+
+};
+#define IGuestProcessRegisteredEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestProcessRegisteredEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestProcessRegisteredEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestProcessRegisteredEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessRegisteredEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessRegisteredEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessRegisteredEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessRegisteredEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessRegisteredEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessRegisteredEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestProcessRegisteredEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestProcessRegisteredEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessRegisteredEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessRegisteredEvent_get_Process(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessRegisteredEvent_GetProcess(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessRegisteredEvent_get_Pid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessRegisteredEvent_GetPid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessRegisteredEvent_get_Registered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#define IGuestProcessRegisteredEvent_GetRegistered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestProcessRegisteredEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestProcessRegisteredEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestProcessRegisteredEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestProcessRegisteredEvent declaration */
+
+
+/* Start of struct IGuestProcessStateChangedEvent declaration */
+#define IGUESTPROCESSSTATECHANGEDEVENT_IID_STR "c365fb7b-4430-499f-92c8-8bed814a567a"
+#define IGUESTPROCESSSTATECHANGEDEVENT_IID { \
+    0xc365fb7b, 0x4430, 0x499f, \
+    { 0x92, 0xc8, 0x8b, 0xed, 0x81, 0x4a, 0x56, 0x7a } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestProcessStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestProcessStateChangedEvent_vtbl
+{
+    struct IGuestProcessEvent_vtbl iguestprocessevent;
+
+    nsresult (*GetStatus)(IGuestProcessStateChangedEvent *pThis, PRUint32 *status);
+
+    nsresult (*GetError)(IGuestProcessStateChangedEvent *pThis, IVirtualBoxErrorInfo * *error);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestProcessStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestProcessStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestProcessStateChangedEvent *pThis);
+    nsrefcnt (*Release)(IGuestProcessStateChangedEvent *pThis);
+    nsresult (*GetType)(IGuestProcessStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestProcessStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestProcessStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestProcessStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestProcessStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestProcessStateChangedEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetProcess)(IGuestProcessStateChangedEvent *pThis, IGuestProcess * *process);
+
+    nsresult (*GetPid)(IGuestProcessStateChangedEvent *pThis, PRUint32 *pid);
+
+    nsresult (*GetStatus)(IGuestProcessStateChangedEvent *pThis, PRUint32 *status);
+
+    nsresult (*GetError)(IGuestProcessStateChangedEvent *pThis, IVirtualBoxErrorInfo * *error);
+
+};
+#define IGuestProcessStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestProcessStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestProcessStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestProcessStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestProcessStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestProcessStateChangedEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessStateChangedEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessStateChangedEvent_get_Process(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessStateChangedEvent_GetProcess(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessStateChangedEvent_get_Pid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessStateChangedEvent_GetPid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessStateChangedEvent_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestProcessStateChangedEvent_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestProcessStateChangedEvent_get_Error(p, aError) ((p)->lpVtbl->GetError(p, aError))
+#define IGuestProcessStateChangedEvent_GetError(p, aError) ((p)->lpVtbl->GetError(p, aError))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestProcessStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestProcessStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestProcessStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestProcessStateChangedEvent declaration */
+
+
+/* Start of struct IGuestProcessIOEvent declaration */
+#define IGUESTPROCESSIOEVENT_IID_STR "9ea9227c-e9bb-49b3-bfc7-c5171e93ef38"
+#define IGUESTPROCESSIOEVENT_IID { \
+    0x9ea9227c, 0xe9bb, 0x49b3, \
+    { 0xbf, 0xc7, 0xc5, 0x17, 0x1e, 0x93, 0xef, 0x38 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestProcessIOEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestProcessIOEvent_vtbl
+{
+    struct IGuestProcessEvent_vtbl iguestprocessevent;
+
+    nsresult (*GetHandle)(IGuestProcessIOEvent *pThis, PRUint32 *handle);
+
+    nsresult (*GetProcessed)(IGuestProcessIOEvent *pThis, PRUint32 *processed);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestProcessIOEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestProcessIOEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestProcessIOEvent *pThis);
+    nsrefcnt (*Release)(IGuestProcessIOEvent *pThis);
+    nsresult (*GetType)(IGuestProcessIOEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestProcessIOEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestProcessIOEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestProcessIOEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestProcessIOEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestProcessIOEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetProcess)(IGuestProcessIOEvent *pThis, IGuestProcess * *process);
+
+    nsresult (*GetPid)(IGuestProcessIOEvent *pThis, PRUint32 *pid);
+
+    nsresult (*GetHandle)(IGuestProcessIOEvent *pThis, PRUint32 *handle);
+
+    nsresult (*GetProcessed)(IGuestProcessIOEvent *pThis, PRUint32 *processed);
+
+};
+#define IGuestProcessIOEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestProcessIOEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestProcessIOEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestProcessIOEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessIOEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessIOEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessIOEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessIOEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessIOEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessIOEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestProcessIOEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestProcessIOEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessIOEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessIOEvent_get_Process(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessIOEvent_GetProcess(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessIOEvent_get_Pid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessIOEvent_GetPid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessIOEvent_get_Handle(p, aHandle) ((p)->lpVtbl->GetHandle(p, aHandle))
+#define IGuestProcessIOEvent_GetHandle(p, aHandle) ((p)->lpVtbl->GetHandle(p, aHandle))
+#define IGuestProcessIOEvent_get_Processed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestProcessIOEvent_GetProcessed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestProcessIOEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestProcessIOEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestProcessIOEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestProcessIOEvent declaration */
+
+
+/* Start of struct IGuestProcessInputNotifyEvent declaration */
+#define IGUESTPROCESSINPUTNOTIFYEVENT_IID_STR "0de887f2-b7db-4616-aac6-cfb94d89ba78"
+#define IGUESTPROCESSINPUTNOTIFYEVENT_IID { \
+    0x0de887f2, 0xb7db, 0x4616, \
+    { 0xaa, 0xc6, 0xcf, 0xb9, 0x4d, 0x89, 0xba, 0x78 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestProcessInputNotifyEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestProcessInputNotifyEvent_vtbl
+{
+    struct IGuestProcessIOEvent_vtbl iguestprocessioevent;
+
+    nsresult (*GetStatus)(IGuestProcessInputNotifyEvent *pThis, PRUint32 *status);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestProcessInputNotifyEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestProcessInputNotifyEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestProcessInputNotifyEvent *pThis);
+    nsrefcnt (*Release)(IGuestProcessInputNotifyEvent *pThis);
+    nsresult (*GetType)(IGuestProcessInputNotifyEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestProcessInputNotifyEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestProcessInputNotifyEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestProcessInputNotifyEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestProcessInputNotifyEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestProcessInputNotifyEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetProcess)(IGuestProcessInputNotifyEvent *pThis, IGuestProcess * *process);
+
+    nsresult (*GetPid)(IGuestProcessInputNotifyEvent *pThis, PRUint32 *pid);
+
+    nsresult (*GetHandle)(IGuestProcessInputNotifyEvent *pThis, PRUint32 *handle);
+
+    nsresult (*GetProcessed)(IGuestProcessInputNotifyEvent *pThis, PRUint32 *processed);
+
+    nsresult (*GetStatus)(IGuestProcessInputNotifyEvent *pThis, PRUint32 *status);
+
+};
+#define IGuestProcessInputNotifyEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestProcessInputNotifyEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestProcessInputNotifyEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestProcessInputNotifyEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessInputNotifyEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessInputNotifyEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessInputNotifyEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessInputNotifyEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessInputNotifyEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessInputNotifyEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestProcessInputNotifyEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestProcessInputNotifyEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessInputNotifyEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessInputNotifyEvent_get_Process(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessInputNotifyEvent_GetProcess(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessInputNotifyEvent_get_Pid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessInputNotifyEvent_GetPid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessInputNotifyEvent_get_Handle(p, aHandle) ((p)->lpVtbl->GetHandle(p, aHandle))
+#define IGuestProcessInputNotifyEvent_GetHandle(p, aHandle) ((p)->lpVtbl->GetHandle(p, aHandle))
+#define IGuestProcessInputNotifyEvent_get_Processed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestProcessInputNotifyEvent_GetProcessed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestProcessInputNotifyEvent_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestProcessInputNotifyEvent_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestProcessInputNotifyEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestProcessInputNotifyEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestProcessInputNotifyEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestProcessInputNotifyEvent declaration */
+
+
+/* Start of struct IGuestProcessOutputEvent declaration */
+#define IGUESTPROCESSOUTPUTEVENT_IID_STR "d3d5f1ee-bcb2-4905-a7ab-cc85448a742b"
+#define IGUESTPROCESSOUTPUTEVENT_IID { \
+    0xd3d5f1ee, 0xbcb2, 0x4905, \
+    { 0xa7, 0xab, 0xcc, 0x85, 0x44, 0x8a, 0x74, 0x2b } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestProcessOutputEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestProcessOutputEvent_vtbl
+{
+    struct IGuestProcessIOEvent_vtbl iguestprocessioevent;
+
+    nsresult (*GetData)(IGuestProcessOutputEvent *pThis, PRUint32 *dataSize, PRUint8 **data);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestProcessOutputEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestProcessOutputEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestProcessOutputEvent *pThis);
+    nsrefcnt (*Release)(IGuestProcessOutputEvent *pThis);
+    nsresult (*GetType)(IGuestProcessOutputEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestProcessOutputEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestProcessOutputEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestProcessOutputEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestProcessOutputEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestProcessOutputEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetProcess)(IGuestProcessOutputEvent *pThis, IGuestProcess * *process);
+
+    nsresult (*GetPid)(IGuestProcessOutputEvent *pThis, PRUint32 *pid);
+
+    nsresult (*GetHandle)(IGuestProcessOutputEvent *pThis, PRUint32 *handle);
+
+    nsresult (*GetProcessed)(IGuestProcessOutputEvent *pThis, PRUint32 *processed);
+
+    nsresult (*GetData)(IGuestProcessOutputEvent *pThis, PRUint32 *dataSize, PRUint8 **data);
+
+};
+#define IGuestProcessOutputEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestProcessOutputEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestProcessOutputEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestProcessOutputEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessOutputEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestProcessOutputEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessOutputEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestProcessOutputEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessOutputEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestProcessOutputEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestProcessOutputEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestProcessOutputEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessOutputEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestProcessOutputEvent_get_Process(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessOutputEvent_GetProcess(p, aProcess) ((p)->lpVtbl->GetProcess(p, aProcess))
+#define IGuestProcessOutputEvent_get_Pid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessOutputEvent_GetPid(p, aPid) ((p)->lpVtbl->GetPid(p, aPid))
+#define IGuestProcessOutputEvent_get_Handle(p, aHandle) ((p)->lpVtbl->GetHandle(p, aHandle))
+#define IGuestProcessOutputEvent_GetHandle(p, aHandle) ((p)->lpVtbl->GetHandle(p, aHandle))
+#define IGuestProcessOutputEvent_get_Processed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestProcessOutputEvent_GetProcessed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestProcessOutputEvent_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#define IGuestProcessOutputEvent_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestProcessOutputEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestProcessOutputEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestProcessOutputEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestProcessOutputEvent declaration */
+
+
+/* Start of struct IGuestFileEvent declaration */
+#define IGUESTFILEEVENT_IID_STR "c8adb7b0-057d-4391-b928-f14b06b710c5"
+#define IGUESTFILEEVENT_IID { \
+    0xc8adb7b0, 0x057d, 0x4391, \
+    { 0xb9, 0x28, 0xf1, 0x4b, 0x06, 0xb7, 0x10, 0xc5 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFileEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFileEvent_vtbl
+{
+    struct IGuestSessionEvent_vtbl iguestsessionevent;
+
+    nsresult (*GetFile)(IGuestFileEvent *pThis, IGuestFile * *file);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFileEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestFileEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFileEvent *pThis);
+    nsrefcnt (*Release)(IGuestFileEvent *pThis);
+    nsresult (*GetType)(IGuestFileEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestFileEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestFileEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestFileEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestFileEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestFileEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetFile)(IGuestFileEvent *pThis, IGuestFile * *file);
+
+};
+#define IGuestFileEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFileEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFileEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFileEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestFileEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestFileEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileEvent_get_File(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileEvent_GetFile(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFileEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFileEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFileEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFileEvent declaration */
+
+
+/* Start of struct IGuestFileRegisteredEvent declaration */
+#define IGUESTFILEREGISTEREDEVENT_IID_STR "d0d93830-70a2-487e-895e-d3fc9679f7b3"
+#define IGUESTFILEREGISTEREDEVENT_IID { \
+    0xd0d93830, 0x70a2, 0x487e, \
+    { 0x89, 0x5e, 0xd3, 0xfc, 0x96, 0x79, 0xf7, 0xb3 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFileRegisteredEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFileRegisteredEvent_vtbl
+{
+    struct IGuestFileEvent_vtbl iguestfileevent;
+
+    nsresult (*GetRegistered)(IGuestFileRegisteredEvent *pThis, PRBool *registered);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFileRegisteredEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestFileRegisteredEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFileRegisteredEvent *pThis);
+    nsrefcnt (*Release)(IGuestFileRegisteredEvent *pThis);
+    nsresult (*GetType)(IGuestFileRegisteredEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestFileRegisteredEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestFileRegisteredEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestFileRegisteredEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestFileRegisteredEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestFileRegisteredEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetFile)(IGuestFileRegisteredEvent *pThis, IGuestFile * *file);
+
+    nsresult (*GetRegistered)(IGuestFileRegisteredEvent *pThis, PRBool *registered);
+
+};
+#define IGuestFileRegisteredEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFileRegisteredEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFileRegisteredEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFileRegisteredEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileRegisteredEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileRegisteredEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileRegisteredEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileRegisteredEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileRegisteredEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileRegisteredEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestFileRegisteredEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestFileRegisteredEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileRegisteredEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileRegisteredEvent_get_File(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileRegisteredEvent_GetFile(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileRegisteredEvent_get_Registered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#define IGuestFileRegisteredEvent_GetRegistered(p, aRegistered) ((p)->lpVtbl->GetRegistered(p, aRegistered))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFileRegisteredEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFileRegisteredEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFileRegisteredEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFileRegisteredEvent declaration */
+
+
+/* Start of struct IGuestFileStateChangedEvent declaration */
+#define IGUESTFILESTATECHANGEDEVENT_IID_STR "d37fe88f-0979-486c-baa1-3abb144dc82d"
+#define IGUESTFILESTATECHANGEDEVENT_IID { \
+    0xd37fe88f, 0x0979, 0x486c, \
+    { 0xba, 0xa1, 0x3a, 0xbb, 0x14, 0x4d, 0xc8, 0x2d } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFileStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFileStateChangedEvent_vtbl
+{
+    struct IGuestFileEvent_vtbl iguestfileevent;
+
+    nsresult (*GetStatus)(IGuestFileStateChangedEvent *pThis, PRUint32 *status);
+
+    nsresult (*GetError)(IGuestFileStateChangedEvent *pThis, IVirtualBoxErrorInfo * *error);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFileStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestFileStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFileStateChangedEvent *pThis);
+    nsrefcnt (*Release)(IGuestFileStateChangedEvent *pThis);
+    nsresult (*GetType)(IGuestFileStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestFileStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestFileStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestFileStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestFileStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestFileStateChangedEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetFile)(IGuestFileStateChangedEvent *pThis, IGuestFile * *file);
+
+    nsresult (*GetStatus)(IGuestFileStateChangedEvent *pThis, PRUint32 *status);
+
+    nsresult (*GetError)(IGuestFileStateChangedEvent *pThis, IVirtualBoxErrorInfo * *error);
+
+};
+#define IGuestFileStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFileStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFileStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFileStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestFileStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestFileStateChangedEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileStateChangedEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileStateChangedEvent_get_File(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileStateChangedEvent_GetFile(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileStateChangedEvent_get_Status(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestFileStateChangedEvent_GetStatus(p, aStatus) ((p)->lpVtbl->GetStatus(p, aStatus))
+#define IGuestFileStateChangedEvent_get_Error(p, aError) ((p)->lpVtbl->GetError(p, aError))
+#define IGuestFileStateChangedEvent_GetError(p, aError) ((p)->lpVtbl->GetError(p, aError))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFileStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFileStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFileStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFileStateChangedEvent declaration */
+
+
+/* Start of struct IGuestFileIOEvent declaration */
+#define IGUESTFILEIOEVENT_IID_STR "b5191a7c-9536-4ef8-820e-3b0e17e5bbc8"
+#define IGUESTFILEIOEVENT_IID { \
+    0xb5191a7c, 0x9536, 0x4ef8, \
+    { 0x82, 0x0e, 0x3b, 0x0e, 0x17, 0xe5, 0xbb, 0xc8 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFileIOEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFileIOEvent_vtbl
+{
+    struct IGuestFileEvent_vtbl iguestfileevent;
+
+    nsresult (*GetOffset)(IGuestFileIOEvent *pThis, PRInt64 *offset);
+
+    nsresult (*GetProcessed)(IGuestFileIOEvent *pThis, PRUint32 *processed);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFileIOEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestFileIOEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFileIOEvent *pThis);
+    nsrefcnt (*Release)(IGuestFileIOEvent *pThis);
+    nsresult (*GetType)(IGuestFileIOEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestFileIOEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestFileIOEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestFileIOEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestFileIOEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestFileIOEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetFile)(IGuestFileIOEvent *pThis, IGuestFile * *file);
+
+    nsresult (*GetOffset)(IGuestFileIOEvent *pThis, PRInt64 *offset);
+
+    nsresult (*GetProcessed)(IGuestFileIOEvent *pThis, PRUint32 *processed);
+
+};
+#define IGuestFileIOEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFileIOEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFileIOEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFileIOEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileIOEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileIOEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileIOEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileIOEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileIOEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileIOEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestFileIOEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestFileIOEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileIOEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileIOEvent_get_File(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileIOEvent_GetFile(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileIOEvent_get_Offset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFileIOEvent_GetOffset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFileIOEvent_get_Processed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestFileIOEvent_GetProcessed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFileIOEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFileIOEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFileIOEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFileIOEvent declaration */
+
+
+/* Start of struct IGuestFileOffsetChangedEvent declaration */
+#define IGUESTFILEOFFSETCHANGEDEVENT_IID_STR "e8f79a21-1207-4179-94cf-ca250036308f"
+#define IGUESTFILEOFFSETCHANGEDEVENT_IID { \
+    0xe8f79a21, 0x1207, 0x4179, \
+    { 0x94, 0xcf, 0xca, 0x25, 0x00, 0x36, 0x30, 0x8f } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFileOffsetChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFileOffsetChangedEvent_vtbl
+{
+    struct IGuestFileIOEvent_vtbl iguestfileioevent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFileOffsetChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestFileOffsetChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFileOffsetChangedEvent *pThis);
+    nsrefcnt (*Release)(IGuestFileOffsetChangedEvent *pThis);
+    nsresult (*GetType)(IGuestFileOffsetChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestFileOffsetChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestFileOffsetChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestFileOffsetChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestFileOffsetChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestFileOffsetChangedEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetFile)(IGuestFileOffsetChangedEvent *pThis, IGuestFile * *file);
+
+    nsresult (*GetOffset)(IGuestFileOffsetChangedEvent *pThis, PRInt64 *offset);
+
+    nsresult (*GetProcessed)(IGuestFileOffsetChangedEvent *pThis, PRUint32 *processed);
+
+};
+#define IGuestFileOffsetChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFileOffsetChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFileOffsetChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFileOffsetChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileOffsetChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileOffsetChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileOffsetChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileOffsetChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileOffsetChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileOffsetChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestFileOffsetChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestFileOffsetChangedEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileOffsetChangedEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileOffsetChangedEvent_get_File(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileOffsetChangedEvent_GetFile(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileOffsetChangedEvent_get_Offset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFileOffsetChangedEvent_GetOffset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFileOffsetChangedEvent_get_Processed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestFileOffsetChangedEvent_GetProcessed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFileOffsetChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFileOffsetChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFileOffsetChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFileOffsetChangedEvent declaration */
+
+
+/* Start of struct IGuestFileReadEvent declaration */
+#define IGUESTFILEREADEVENT_IID_STR "4ee3cbcb-486f-40db-9150-deee3fd24189"
+#define IGUESTFILEREADEVENT_IID { \
+    0x4ee3cbcb, 0x486f, 0x40db, \
+    { 0x91, 0x50, 0xde, 0xee, 0x3f, 0xd2, 0x41, 0x89 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFileReadEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFileReadEvent_vtbl
+{
+    struct IGuestFileIOEvent_vtbl iguestfileioevent;
+
+    nsresult (*GetData)(IGuestFileReadEvent *pThis, PRUint32 *dataSize, PRUint8 **data);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFileReadEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestFileReadEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFileReadEvent *pThis);
+    nsrefcnt (*Release)(IGuestFileReadEvent *pThis);
+    nsresult (*GetType)(IGuestFileReadEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestFileReadEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestFileReadEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestFileReadEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestFileReadEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestFileReadEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetFile)(IGuestFileReadEvent *pThis, IGuestFile * *file);
+
+    nsresult (*GetOffset)(IGuestFileReadEvent *pThis, PRInt64 *offset);
+
+    nsresult (*GetProcessed)(IGuestFileReadEvent *pThis, PRUint32 *processed);
+
+    nsresult (*GetData)(IGuestFileReadEvent *pThis, PRUint32 *dataSize, PRUint8 **data);
+
+};
+#define IGuestFileReadEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFileReadEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFileReadEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFileReadEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileReadEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileReadEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileReadEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileReadEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileReadEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileReadEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestFileReadEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestFileReadEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileReadEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileReadEvent_get_File(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileReadEvent_GetFile(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileReadEvent_get_Offset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFileReadEvent_GetOffset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFileReadEvent_get_Processed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestFileReadEvent_GetProcessed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestFileReadEvent_get_Data(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#define IGuestFileReadEvent_GetData(p, aData) ((p)->lpVtbl->GetData(p, aData))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFileReadEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFileReadEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFileReadEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFileReadEvent declaration */
+
+
+/* Start of struct IGuestFileWriteEvent declaration */
+#define IGUESTFILEWRITEEVENT_IID_STR "e062a915-3cf5-4c0a-bc90-9b8d4cc94d89"
+#define IGUESTFILEWRITEEVENT_IID { \
+    0xe062a915, 0x3cf5, 0x4c0a, \
+    { 0xbc, 0x90, 0x9b, 0x8d, 0x4c, 0xc9, 0x4d, 0x89 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestFileWriteEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestFileWriteEvent_vtbl
+{
+    struct IGuestFileIOEvent_vtbl iguestfileioevent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestFileWriteEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestFileWriteEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestFileWriteEvent *pThis);
+    nsrefcnt (*Release)(IGuestFileWriteEvent *pThis);
+    nsresult (*GetType)(IGuestFileWriteEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestFileWriteEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestFileWriteEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestFileWriteEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestFileWriteEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetSession)(IGuestFileWriteEvent *pThis, IGuestSession * *session);
+
+    nsresult (*GetFile)(IGuestFileWriteEvent *pThis, IGuestFile * *file);
+
+    nsresult (*GetOffset)(IGuestFileWriteEvent *pThis, PRInt64 *offset);
+
+    nsresult (*GetProcessed)(IGuestFileWriteEvent *pThis, PRUint32 *processed);
+
+};
+#define IGuestFileWriteEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestFileWriteEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestFileWriteEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestFileWriteEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileWriteEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestFileWriteEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileWriteEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestFileWriteEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileWriteEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestFileWriteEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestFileWriteEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestFileWriteEvent_get_Session(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileWriteEvent_GetSession(p, aSession) ((p)->lpVtbl->GetSession(p, aSession))
+#define IGuestFileWriteEvent_get_File(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileWriteEvent_GetFile(p, aFile) ((p)->lpVtbl->GetFile(p, aFile))
+#define IGuestFileWriteEvent_get_Offset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFileWriteEvent_GetOffset(p, aOffset) ((p)->lpVtbl->GetOffset(p, aOffset))
+#define IGuestFileWriteEvent_get_Processed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#define IGuestFileWriteEvent_GetProcessed(p, aProcessed) ((p)->lpVtbl->GetProcessed(p, aProcessed))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestFileWriteEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestFileWriteEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestFileWriteEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestFileWriteEvent declaration */
+
+
+/* Start of struct IVRDEServerChangedEvent declaration */
+#define IVRDESERVERCHANGEDEVENT_IID_STR "a06fd66a-3188-4c8c-8756-1395e8cb691c"
+#define IVRDESERVERCHANGEDEVENT_IID { \
+    0xa06fd66a, 0x3188, 0x4c8c, \
+    { 0x87, 0x56, 0x13, 0x95, 0xe8, 0xcb, 0x69, 0x1c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVRDEServerChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IVRDEServerChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVRDEServerChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IVRDEServerChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVRDEServerChangedEvent *pThis);
+    nsrefcnt (*Release)(IVRDEServerChangedEvent *pThis);
+    nsresult (*GetType)(IVRDEServerChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IVRDEServerChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IVRDEServerChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IVRDEServerChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IVRDEServerChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#define IVRDEServerChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVRDEServerChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVRDEServerChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IVRDEServerChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVRDEServerChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVRDEServerChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVRDEServerChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVRDEServerChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVRDEServerChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVRDEServerChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IVRDEServerChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVRDEServerChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVRDEServerChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVRDEServerChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVRDEServerChangedEvent declaration */
+
+
+/* Start of struct IVRDEServerInfoChangedEvent declaration */
+#define IVRDESERVERINFOCHANGEDEVENT_IID_STR "dd6a1080-e1b7-4339-a549-f0878115596e"
+#define IVRDESERVERINFOCHANGEDEVENT_IID { \
+    0xdd6a1080, 0xe1b7, 0x4339, \
+    { 0xa5, 0x49, 0xf0, 0x87, 0x81, 0x15, 0x59, 0x6e } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVRDEServerInfoChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IVRDEServerInfoChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVRDEServerInfoChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IVRDEServerInfoChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVRDEServerInfoChangedEvent *pThis);
+    nsrefcnt (*Release)(IVRDEServerInfoChangedEvent *pThis);
+    nsresult (*GetType)(IVRDEServerInfoChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IVRDEServerInfoChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IVRDEServerInfoChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IVRDEServerInfoChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IVRDEServerInfoChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#define IVRDEServerInfoChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVRDEServerInfoChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVRDEServerInfoChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IVRDEServerInfoChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVRDEServerInfoChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVRDEServerInfoChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVRDEServerInfoChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVRDEServerInfoChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVRDEServerInfoChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVRDEServerInfoChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IVRDEServerInfoChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVRDEServerInfoChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVRDEServerInfoChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVRDEServerInfoChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVRDEServerInfoChangedEvent declaration */
+
+
+/* Start of struct IVideoCaptureChangedEvent declaration */
+#define IVIDEOCAPTURECHANGEDEVENT_IID_STR "6215d169-25dd-4719-ab34-c908701efb58"
+#define IVIDEOCAPTURECHANGEDEVENT_IID { \
+    0x6215d169, 0x25dd, 0x4719, \
+    { 0xab, 0x34, 0xc9, 0x08, 0x70, 0x1e, 0xfb, 0x58 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVideoCaptureChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IVideoCaptureChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVideoCaptureChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IVideoCaptureChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVideoCaptureChangedEvent *pThis);
+    nsrefcnt (*Release)(IVideoCaptureChangedEvent *pThis);
+    nsresult (*GetType)(IVideoCaptureChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IVideoCaptureChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IVideoCaptureChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IVideoCaptureChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IVideoCaptureChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#define IVideoCaptureChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVideoCaptureChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVideoCaptureChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IVideoCaptureChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVideoCaptureChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVideoCaptureChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVideoCaptureChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVideoCaptureChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVideoCaptureChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVideoCaptureChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IVideoCaptureChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVideoCaptureChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVideoCaptureChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVideoCaptureChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVideoCaptureChangedEvent declaration */
+
+
+/* Start of struct IUSBControllerChangedEvent declaration */
+#define IUSBCONTROLLERCHANGEDEVENT_IID_STR "93BADC0C-61D9-4940-A084-E6BB29AF3D83"
+#define IUSBCONTROLLERCHANGEDEVENT_IID { \
+    0x93BADC0C, 0x61D9, 0x4940, \
+    { 0xA0, 0x84, 0xE6, 0xBB, 0x29, 0xAF, 0x3D, 0x83 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IUSBControllerChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IUSBControllerChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IUSBControllerChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IUSBControllerChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IUSBControllerChangedEvent *pThis);
+    nsrefcnt (*Release)(IUSBControllerChangedEvent *pThis);
+    nsresult (*GetType)(IUSBControllerChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IUSBControllerChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IUSBControllerChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IUSBControllerChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IUSBControllerChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#define IUSBControllerChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IUSBControllerChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IUSBControllerChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IUSBControllerChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IUSBControllerChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IUSBControllerChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IUSBControllerChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IUSBControllerChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IUSBControllerChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IUSBControllerChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IUSBControllerChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IUSBControllerChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IUSBControllerChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IUSBControllerChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IUSBControllerChangedEvent declaration */
+
+
+/* Start of struct IUSBDeviceStateChangedEvent declaration */
+#define IUSBDEVICESTATECHANGEDEVENT_IID_STR "806da61b-6679-422a-b629-51b06b0c6d93"
+#define IUSBDEVICESTATECHANGEDEVENT_IID { \
+    0x806da61b, 0x6679, 0x422a, \
+    { 0xb6, 0x29, 0x51, 0xb0, 0x6b, 0x0c, 0x6d, 0x93 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IUSBDeviceStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IUSBDeviceStateChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetDevice)(IUSBDeviceStateChangedEvent *pThis, IUSBDevice * *device);
+
+    nsresult (*GetAttached)(IUSBDeviceStateChangedEvent *pThis, PRBool *attached);
+
+    nsresult (*GetError)(IUSBDeviceStateChangedEvent *pThis, IVirtualBoxErrorInfo * *error);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IUSBDeviceStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IUSBDeviceStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IUSBDeviceStateChangedEvent *pThis);
+    nsrefcnt (*Release)(IUSBDeviceStateChangedEvent *pThis);
+    nsresult (*GetType)(IUSBDeviceStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IUSBDeviceStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IUSBDeviceStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IUSBDeviceStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IUSBDeviceStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetDevice)(IUSBDeviceStateChangedEvent *pThis, IUSBDevice * *device);
+
+    nsresult (*GetAttached)(IUSBDeviceStateChangedEvent *pThis, PRBool *attached);
+
+    nsresult (*GetError)(IUSBDeviceStateChangedEvent *pThis, IVirtualBoxErrorInfo * *error);
+
+};
+#define IUSBDeviceStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IUSBDeviceStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IUSBDeviceStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IUSBDeviceStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IUSBDeviceStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IUSBDeviceStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IUSBDeviceStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IUSBDeviceStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IUSBDeviceStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IUSBDeviceStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IUSBDeviceStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IUSBDeviceStateChangedEvent_get_Device(p, aDevice) ((p)->lpVtbl->GetDevice(p, aDevice))
+#define IUSBDeviceStateChangedEvent_GetDevice(p, aDevice) ((p)->lpVtbl->GetDevice(p, aDevice))
+#define IUSBDeviceStateChangedEvent_get_Attached(p, aAttached) ((p)->lpVtbl->GetAttached(p, aAttached))
+#define IUSBDeviceStateChangedEvent_GetAttached(p, aAttached) ((p)->lpVtbl->GetAttached(p, aAttached))
+#define IUSBDeviceStateChangedEvent_get_Error(p, aError) ((p)->lpVtbl->GetError(p, aError))
+#define IUSBDeviceStateChangedEvent_GetError(p, aError) ((p)->lpVtbl->GetError(p, aError))
+#endif /* VBOX_WITH_GLUE */
+
+interface IUSBDeviceStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IUSBDeviceStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IUSBDeviceStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IUSBDeviceStateChangedEvent declaration */
+
+
+/* Start of struct ISharedFolderChangedEvent declaration */
+#define ISHAREDFOLDERCHANGEDEVENT_IID_STR "B66349B5-3534-4239-B2DE-8E1535D94C0B"
+#define ISHAREDFOLDERCHANGEDEVENT_IID { \
+    0xB66349B5, 0x3534, 0x4239, \
+    { 0xB2, 0xDE, 0x8E, 0x15, 0x35, 0xD9, 0x4C, 0x0B } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ISharedFolderChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct ISharedFolderChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetScope)(ISharedFolderChangedEvent *pThis, PRUint32 *scope);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ISharedFolderChangedEventVtbl
+{
+    nsresult (*QueryInterface)(ISharedFolderChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ISharedFolderChangedEvent *pThis);
+    nsrefcnt (*Release)(ISharedFolderChangedEvent *pThis);
+    nsresult (*GetType)(ISharedFolderChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ISharedFolderChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ISharedFolderChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ISharedFolderChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ISharedFolderChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetScope)(ISharedFolderChangedEvent *pThis, PRUint32 *scope);
+
+};
+#define ISharedFolderChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ISharedFolderChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ISharedFolderChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ISharedFolderChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISharedFolderChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ISharedFolderChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISharedFolderChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ISharedFolderChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISharedFolderChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ISharedFolderChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ISharedFolderChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ISharedFolderChangedEvent_get_Scope(p, aScope) ((p)->lpVtbl->GetScope(p, aScope))
+#define ISharedFolderChangedEvent_GetScope(p, aScope) ((p)->lpVtbl->GetScope(p, aScope))
+#endif /* VBOX_WITH_GLUE */
+
+interface ISharedFolderChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ISharedFolderChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ISharedFolderChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ISharedFolderChangedEvent declaration */
+
+
+/* Start of struct IRuntimeErrorEvent declaration */
+#define IRUNTIMEERROREVENT_IID_STR "883DD18B-0721-4CDE-867C-1A82ABAF914C"
+#define IRUNTIMEERROREVENT_IID { \
+    0x883DD18B, 0x0721, 0x4CDE, \
+    { 0x86, 0x7C, 0x1A, 0x82, 0xAB, 0xAF, 0x91, 0x4C } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IRuntimeErrorEvent);
+#ifndef VBOX_WITH_GLUE
+struct IRuntimeErrorEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetFatal)(IRuntimeErrorEvent *pThis, PRBool *fatal);
+
+    nsresult (*GetId)(IRuntimeErrorEvent *pThis, PRUnichar * *id);
+
+    nsresult (*GetMessage)(IRuntimeErrorEvent *pThis, PRUnichar * *message);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IRuntimeErrorEventVtbl
+{
+    nsresult (*QueryInterface)(IRuntimeErrorEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IRuntimeErrorEvent *pThis);
+    nsrefcnt (*Release)(IRuntimeErrorEvent *pThis);
+    nsresult (*GetType)(IRuntimeErrorEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IRuntimeErrorEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IRuntimeErrorEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IRuntimeErrorEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IRuntimeErrorEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetFatal)(IRuntimeErrorEvent *pThis, PRBool *fatal);
+
+    nsresult (*GetId)(IRuntimeErrorEvent *pThis, PRUnichar * *id);
+
+    nsresult (*GetMessage)(IRuntimeErrorEvent *pThis, PRUnichar * *message);
+
+};
+#define IRuntimeErrorEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IRuntimeErrorEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IRuntimeErrorEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IRuntimeErrorEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IRuntimeErrorEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IRuntimeErrorEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IRuntimeErrorEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IRuntimeErrorEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IRuntimeErrorEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IRuntimeErrorEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IRuntimeErrorEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IRuntimeErrorEvent_get_Fatal(p, aFatal) ((p)->lpVtbl->GetFatal(p, aFatal))
+#define IRuntimeErrorEvent_GetFatal(p, aFatal) ((p)->lpVtbl->GetFatal(p, aFatal))
+#define IRuntimeErrorEvent_get_Id(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IRuntimeErrorEvent_GetId(p, aId) ((p)->lpVtbl->GetId(p, aId))
+#define IRuntimeErrorEvent_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#define IRuntimeErrorEvent_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#endif /* VBOX_WITH_GLUE */
+
+interface IRuntimeErrorEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IRuntimeErrorEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IRuntimeErrorEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IRuntimeErrorEvent declaration */
+
+
+/* Start of struct IEventSourceChangedEvent declaration */
+#define IEVENTSOURCECHANGEDEVENT_IID_STR "e7932cb8-f6d4-4ab6-9cbf-558eb8959a6a"
+#define IEVENTSOURCECHANGEDEVENT_IID { \
+    0xe7932cb8, 0xf6d4, 0x4ab6, \
+    { 0x9c, 0xbf, 0x55, 0x8e, 0xb8, 0x95, 0x9a, 0x6a } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IEventSourceChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IEventSourceChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetListener)(IEventSourceChangedEvent *pThis, IEventListener * *listener);
+
+    nsresult (*GetAdd)(IEventSourceChangedEvent *pThis, PRBool *add);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IEventSourceChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IEventSourceChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IEventSourceChangedEvent *pThis);
+    nsrefcnt (*Release)(IEventSourceChangedEvent *pThis);
+    nsresult (*GetType)(IEventSourceChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IEventSourceChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IEventSourceChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IEventSourceChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IEventSourceChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetListener)(IEventSourceChangedEvent *pThis, IEventListener * *listener);
+
+    nsresult (*GetAdd)(IEventSourceChangedEvent *pThis, PRBool *add);
+
+};
+#define IEventSourceChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IEventSourceChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IEventSourceChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IEventSourceChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IEventSourceChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IEventSourceChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IEventSourceChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IEventSourceChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IEventSourceChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IEventSourceChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IEventSourceChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IEventSourceChangedEvent_get_Listener(p, aListener) ((p)->lpVtbl->GetListener(p, aListener))
+#define IEventSourceChangedEvent_GetListener(p, aListener) ((p)->lpVtbl->GetListener(p, aListener))
+#define IEventSourceChangedEvent_get_Add(p, aAdd) ((p)->lpVtbl->GetAdd(p, aAdd))
+#define IEventSourceChangedEvent_GetAdd(p, aAdd) ((p)->lpVtbl->GetAdd(p, aAdd))
+#endif /* VBOX_WITH_GLUE */
+
+interface IEventSourceChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IEventSourceChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IEventSourceChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IEventSourceChangedEvent declaration */
+
+
+/* Start of struct IExtraDataChangedEvent declaration */
+#define IEXTRADATACHANGEDEVENT_IID_STR "024F00CE-6E0B-492A-A8D0-968472A94DC7"
+#define IEXTRADATACHANGEDEVENT_IID { \
+    0x024F00CE, 0x6E0B, 0x492A, \
+    { 0xA8, 0xD0, 0x96, 0x84, 0x72, 0xA9, 0x4D, 0xC7 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IExtraDataChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IExtraDataChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetMachineId)(IExtraDataChangedEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetKey)(IExtraDataChangedEvent *pThis, PRUnichar * *key);
+
+    nsresult (*GetValue)(IExtraDataChangedEvent *pThis, PRUnichar * *value);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IExtraDataChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IExtraDataChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IExtraDataChangedEvent *pThis);
+    nsrefcnt (*Release)(IExtraDataChangedEvent *pThis);
+    nsresult (*GetType)(IExtraDataChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IExtraDataChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IExtraDataChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IExtraDataChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IExtraDataChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(IExtraDataChangedEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetKey)(IExtraDataChangedEvent *pThis, PRUnichar * *key);
+
+    nsresult (*GetValue)(IExtraDataChangedEvent *pThis, PRUnichar * *value);
+
+};
+#define IExtraDataChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IExtraDataChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IExtraDataChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IExtraDataChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IExtraDataChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IExtraDataChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IExtraDataChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IExtraDataChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IExtraDataChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IExtraDataChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IExtraDataChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IExtraDataChangedEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IExtraDataChangedEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IExtraDataChangedEvent_get_Key(p, aKey) ((p)->lpVtbl->GetKey(p, aKey))
+#define IExtraDataChangedEvent_GetKey(p, aKey) ((p)->lpVtbl->GetKey(p, aKey))
+#define IExtraDataChangedEvent_get_Value(p, aValue) ((p)->lpVtbl->GetValue(p, aValue))
+#define IExtraDataChangedEvent_GetValue(p, aValue) ((p)->lpVtbl->GetValue(p, aValue))
+#endif /* VBOX_WITH_GLUE */
+
+interface IExtraDataChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IExtraDataChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IExtraDataChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IExtraDataChangedEvent declaration */
+
+
+/* Start of struct IVetoEvent declaration */
+#define IVETOEVENT_IID_STR "9a1a4130-69fe-472f-ac10-c6fa25d75007"
+#define IVETOEVENT_IID { \
+    0x9a1a4130, 0x69fe, 0x472f, \
+    { 0xac, 0x10, 0xc6, 0xfa, 0x25, 0xd7, 0x50, 0x07 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVetoEvent);
+#ifndef VBOX_WITH_GLUE
+struct IVetoEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*AddVeto)(
+        IVetoEvent *pThis,
+        PRUnichar * reason
+    );
+
+    nsresult (*IsVetoed)(
+        IVetoEvent *pThis,
+        PRBool * result
+    );
+
+    nsresult (*GetVetos)(
+        IVetoEvent *pThis,
+        PRUint32 *resultSize,
+        PRUnichar *** result
+    );
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVetoEventVtbl
+{
+    nsresult (*QueryInterface)(IVetoEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVetoEvent *pThis);
+    nsrefcnt (*Release)(IVetoEvent *pThis);
+    nsresult (*GetType)(IVetoEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IVetoEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IVetoEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IVetoEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IVetoEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*AddVeto)(
+        IVetoEvent *pThis,
+        PRUnichar * reason
+    );
+
+    nsresult (*IsVetoed)(
+        IVetoEvent *pThis,
+        PRBool * result
+    );
+
+    nsresult (*GetVetos)(
+        IVetoEvent *pThis,
+        PRUint32 *resultSize,
+        PRUnichar *** result
+    );
+
+};
+#define IVetoEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVetoEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVetoEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IVetoEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVetoEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVetoEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVetoEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVetoEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVetoEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVetoEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IVetoEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IVetoEvent_AddVeto(p, aReason) ((p)->lpVtbl->AddVeto(p, aReason))
+#define IVetoEvent_IsVetoed(p, aResult) ((p)->lpVtbl->IsVetoed(p, aResult))
+#define IVetoEvent_GetVetos(p, aResult) ((p)->lpVtbl->GetVetos(p, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVetoEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVetoEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVetoEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVetoEvent declaration */
+
+
+/* Start of struct IExtraDataCanChangeEvent declaration */
+#define IEXTRADATACANCHANGEEVENT_IID_STR "245d88bd-800a-40f8-87a6-170d02249a55"
+#define IEXTRADATACANCHANGEEVENT_IID { \
+    0x245d88bd, 0x800a, 0x40f8, \
+    { 0x87, 0xa6, 0x17, 0x0d, 0x02, 0x24, 0x9a, 0x55 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IExtraDataCanChangeEvent);
+#ifndef VBOX_WITH_GLUE
+struct IExtraDataCanChangeEvent_vtbl
+{
+    struct IVetoEvent_vtbl ivetoevent;
+
+    nsresult (*GetMachineId)(IExtraDataCanChangeEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetKey)(IExtraDataCanChangeEvent *pThis, PRUnichar * *key);
+
+    nsresult (*GetValue)(IExtraDataCanChangeEvent *pThis, PRUnichar * *value);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IExtraDataCanChangeEventVtbl
+{
+    nsresult (*QueryInterface)(IExtraDataCanChangeEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IExtraDataCanChangeEvent *pThis);
+    nsrefcnt (*Release)(IExtraDataCanChangeEvent *pThis);
+    nsresult (*GetType)(IExtraDataCanChangeEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IExtraDataCanChangeEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IExtraDataCanChangeEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IExtraDataCanChangeEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IExtraDataCanChangeEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*AddVeto)(
+        IExtraDataCanChangeEvent *pThis,
+        PRUnichar * reason
+    );
+
+    nsresult (*IsVetoed)(
+        IExtraDataCanChangeEvent *pThis,
+        PRBool * result
+    );
+
+    nsresult (*GetVetos)(
+        IExtraDataCanChangeEvent *pThis,
+        PRUint32 *resultSize,
+        PRUnichar *** result
+    );
+
+    nsresult (*GetMachineId)(IExtraDataCanChangeEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetKey)(IExtraDataCanChangeEvent *pThis, PRUnichar * *key);
+
+    nsresult (*GetValue)(IExtraDataCanChangeEvent *pThis, PRUnichar * *value);
+
+};
+#define IExtraDataCanChangeEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IExtraDataCanChangeEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IExtraDataCanChangeEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IExtraDataCanChangeEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IExtraDataCanChangeEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IExtraDataCanChangeEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IExtraDataCanChangeEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IExtraDataCanChangeEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IExtraDataCanChangeEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IExtraDataCanChangeEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IExtraDataCanChangeEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IExtraDataCanChangeEvent_AddVeto(p, aReason) ((p)->lpVtbl->AddVeto(p, aReason))
+#define IExtraDataCanChangeEvent_IsVetoed(p, aResult) ((p)->lpVtbl->IsVetoed(p, aResult))
+#define IExtraDataCanChangeEvent_GetVetos(p, aResult) ((p)->lpVtbl->GetVetos(p, aResult))
+#define IExtraDataCanChangeEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IExtraDataCanChangeEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IExtraDataCanChangeEvent_get_Key(p, aKey) ((p)->lpVtbl->GetKey(p, aKey))
+#define IExtraDataCanChangeEvent_GetKey(p, aKey) ((p)->lpVtbl->GetKey(p, aKey))
+#define IExtraDataCanChangeEvent_get_Value(p, aValue) ((p)->lpVtbl->GetValue(p, aValue))
+#define IExtraDataCanChangeEvent_GetValue(p, aValue) ((p)->lpVtbl->GetValue(p, aValue))
+#endif /* VBOX_WITH_GLUE */
+
+interface IExtraDataCanChangeEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IExtraDataCanChangeEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IExtraDataCanChangeEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IExtraDataCanChangeEvent declaration */
+
+
+/* Start of struct ICanShowWindowEvent declaration */
+#define ICANSHOWWINDOWEVENT_IID_STR "adf292b0-92c9-4a77-9d35-e058b39fe0b9"
+#define ICANSHOWWINDOWEVENT_IID { \
+    0xadf292b0, 0x92c9, 0x4a77, \
+    { 0x9d, 0x35, 0xe0, 0x58, 0xb3, 0x9f, 0xe0, 0xb9 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_ICanShowWindowEvent);
+#ifndef VBOX_WITH_GLUE
+struct ICanShowWindowEvent_vtbl
+{
+    struct IVetoEvent_vtbl ivetoevent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct ICanShowWindowEventVtbl
+{
+    nsresult (*QueryInterface)(ICanShowWindowEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(ICanShowWindowEvent *pThis);
+    nsrefcnt (*Release)(ICanShowWindowEvent *pThis);
+    nsresult (*GetType)(ICanShowWindowEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(ICanShowWindowEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(ICanShowWindowEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(ICanShowWindowEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        ICanShowWindowEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*AddVeto)(
+        ICanShowWindowEvent *pThis,
+        PRUnichar * reason
+    );
+
+    nsresult (*IsVetoed)(
+        ICanShowWindowEvent *pThis,
+        PRBool * result
+    );
+
+    nsresult (*GetVetos)(
+        ICanShowWindowEvent *pThis,
+        PRUint32 *resultSize,
+        PRUnichar *** result
+    );
+
+};
+#define ICanShowWindowEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define ICanShowWindowEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define ICanShowWindowEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define ICanShowWindowEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ICanShowWindowEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define ICanShowWindowEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ICanShowWindowEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define ICanShowWindowEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ICanShowWindowEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define ICanShowWindowEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define ICanShowWindowEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define ICanShowWindowEvent_AddVeto(p, aReason) ((p)->lpVtbl->AddVeto(p, aReason))
+#define ICanShowWindowEvent_IsVetoed(p, aResult) ((p)->lpVtbl->IsVetoed(p, aResult))
+#define ICanShowWindowEvent_GetVetos(p, aResult) ((p)->lpVtbl->GetVetos(p, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface ICanShowWindowEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct ICanShowWindowEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct ICanShowWindowEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct ICanShowWindowEvent declaration */
+
+
+/* Start of struct IShowWindowEvent declaration */
+#define ISHOWWINDOWEVENT_IID_STR "B0A0904D-2F05-4D28-855F-488F96BAD2B2"
+#define ISHOWWINDOWEVENT_IID { \
+    0xB0A0904D, 0x2F05, 0x4D28, \
+    { 0x85, 0x5F, 0x48, 0x8F, 0x96, 0xBA, 0xD2, 0xB2 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IShowWindowEvent);
+#ifndef VBOX_WITH_GLUE
+struct IShowWindowEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetWinId)(IShowWindowEvent *pThis, PRInt64 *winId);
+    nsresult (*SetWinId)(IShowWindowEvent *pThis, PRInt64 winId);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IShowWindowEventVtbl
+{
+    nsresult (*QueryInterface)(IShowWindowEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IShowWindowEvent *pThis);
+    nsrefcnt (*Release)(IShowWindowEvent *pThis);
+    nsresult (*GetType)(IShowWindowEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IShowWindowEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IShowWindowEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IShowWindowEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IShowWindowEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetWinId)(IShowWindowEvent *pThis, PRInt64 *winId);
+    nsresult (*SetWinId)(IShowWindowEvent *pThis, PRInt64 winId);
+
+};
+#define IShowWindowEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IShowWindowEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IShowWindowEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IShowWindowEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IShowWindowEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IShowWindowEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IShowWindowEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IShowWindowEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IShowWindowEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IShowWindowEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IShowWindowEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IShowWindowEvent_get_WinId(p, aWinId) ((p)->lpVtbl->GetWinId(p, aWinId))
+#define IShowWindowEvent_GetWinId(p, aWinId) ((p)->lpVtbl->GetWinId(p, aWinId))
+#define IShowWindowEvent_put_WinId(p, aWinId) ((p)->lpVtbl->SetWinId(p, aWinId))
+#define IShowWindowEvent_SetWinId(p, aWinId) ((p)->lpVtbl->SetWinId(p, aWinId))
+#endif /* VBOX_WITH_GLUE */
+
+interface IShowWindowEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IShowWindowEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IShowWindowEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IShowWindowEvent declaration */
+
+
+/* Start of struct INATRedirectEvent declaration */
+#define INATREDIRECTEVENT_IID_STR "24eef068-c380-4510-bc7c-19314a7352f1"
+#define INATREDIRECTEVENT_IID { \
+    0x24eef068, 0xc380, 0x4510, \
+    { 0xbc, 0x7c, 0x19, 0x31, 0x4a, 0x73, 0x52, 0xf1 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATRedirectEvent);
+#ifndef VBOX_WITH_GLUE
+struct INATRedirectEvent_vtbl
+{
+    struct IMachineEvent_vtbl imachineevent;
+
+    nsresult (*GetSlot)(INATRedirectEvent *pThis, PRUint32 *slot);
+
+    nsresult (*GetRemove)(INATRedirectEvent *pThis, PRBool *remove);
+
+    nsresult (*GetName)(INATRedirectEvent *pThis, PRUnichar * *name);
+
+    nsresult (*GetProto)(INATRedirectEvent *pThis, PRUint32 *proto);
+
+    nsresult (*GetHostIP)(INATRedirectEvent *pThis, PRUnichar * *hostIP);
+
+    nsresult (*GetHostPort)(INATRedirectEvent *pThis, PRInt32 *hostPort);
+
+    nsresult (*GetGuestIP)(INATRedirectEvent *pThis, PRUnichar * *guestIP);
+
+    nsresult (*GetGuestPort)(INATRedirectEvent *pThis, PRInt32 *guestPort);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATRedirectEventVtbl
+{
+    nsresult (*QueryInterface)(INATRedirectEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATRedirectEvent *pThis);
+    nsrefcnt (*Release)(INATRedirectEvent *pThis);
+    nsresult (*GetType)(INATRedirectEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(INATRedirectEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(INATRedirectEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(INATRedirectEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        INATRedirectEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(INATRedirectEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetSlot)(INATRedirectEvent *pThis, PRUint32 *slot);
+
+    nsresult (*GetRemove)(INATRedirectEvent *pThis, PRBool *remove);
+
+    nsresult (*GetName)(INATRedirectEvent *pThis, PRUnichar * *name);
+
+    nsresult (*GetProto)(INATRedirectEvent *pThis, PRUint32 *proto);
+
+    nsresult (*GetHostIP)(INATRedirectEvent *pThis, PRUnichar * *hostIP);
+
+    nsresult (*GetHostPort)(INATRedirectEvent *pThis, PRInt32 *hostPort);
+
+    nsresult (*GetGuestIP)(INATRedirectEvent *pThis, PRUnichar * *guestIP);
+
+    nsresult (*GetGuestPort)(INATRedirectEvent *pThis, PRInt32 *guestPort);
+
+};
+#define INATRedirectEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATRedirectEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATRedirectEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define INATRedirectEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATRedirectEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATRedirectEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATRedirectEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATRedirectEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATRedirectEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATRedirectEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define INATRedirectEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define INATRedirectEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define INATRedirectEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define INATRedirectEvent_get_Slot(p, aSlot) ((p)->lpVtbl->GetSlot(p, aSlot))
+#define INATRedirectEvent_GetSlot(p, aSlot) ((p)->lpVtbl->GetSlot(p, aSlot))
+#define INATRedirectEvent_get_Remove(p, aRemove) ((p)->lpVtbl->GetRemove(p, aRemove))
+#define INATRedirectEvent_GetRemove(p, aRemove) ((p)->lpVtbl->GetRemove(p, aRemove))
+#define INATRedirectEvent_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define INATRedirectEvent_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define INATRedirectEvent_get_Proto(p, aProto) ((p)->lpVtbl->GetProto(p, aProto))
+#define INATRedirectEvent_GetProto(p, aProto) ((p)->lpVtbl->GetProto(p, aProto))
+#define INATRedirectEvent_get_HostIP(p, aHostIP) ((p)->lpVtbl->GetHostIP(p, aHostIP))
+#define INATRedirectEvent_GetHostIP(p, aHostIP) ((p)->lpVtbl->GetHostIP(p, aHostIP))
+#define INATRedirectEvent_get_HostPort(p, aHostPort) ((p)->lpVtbl->GetHostPort(p, aHostPort))
+#define INATRedirectEvent_GetHostPort(p, aHostPort) ((p)->lpVtbl->GetHostPort(p, aHostPort))
+#define INATRedirectEvent_get_GuestIP(p, aGuestIP) ((p)->lpVtbl->GetGuestIP(p, aGuestIP))
+#define INATRedirectEvent_GetGuestIP(p, aGuestIP) ((p)->lpVtbl->GetGuestIP(p, aGuestIP))
+#define INATRedirectEvent_get_GuestPort(p, aGuestPort) ((p)->lpVtbl->GetGuestPort(p, aGuestPort))
+#define INATRedirectEvent_GetGuestPort(p, aGuestPort) ((p)->lpVtbl->GetGuestPort(p, aGuestPort))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATRedirectEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATRedirectEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATRedirectEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATRedirectEvent declaration */
+
+
+/* Start of struct IHostPCIDevicePlugEvent declaration */
+#define IHOSTPCIDEVICEPLUGEVENT_IID_STR "a0bad6df-d612-47d3-89d4-db3992533948"
+#define IHOSTPCIDEVICEPLUGEVENT_IID { \
+    0xa0bad6df, 0xd612, 0x47d3, \
+    { 0x89, 0xd4, 0xdb, 0x39, 0x92, 0x53, 0x39, 0x48 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IHostPCIDevicePlugEvent);
+#ifndef VBOX_WITH_GLUE
+struct IHostPCIDevicePlugEvent_vtbl
+{
+    struct IMachineEvent_vtbl imachineevent;
+
+    nsresult (*GetPlugged)(IHostPCIDevicePlugEvent *pThis, PRBool *plugged);
+
+    nsresult (*GetSuccess)(IHostPCIDevicePlugEvent *pThis, PRBool *success);
+
+    nsresult (*GetAttachment)(IHostPCIDevicePlugEvent *pThis, IPCIDeviceAttachment * *attachment);
+
+    nsresult (*GetMessage)(IHostPCIDevicePlugEvent *pThis, PRUnichar * *message);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IHostPCIDevicePlugEventVtbl
+{
+    nsresult (*QueryInterface)(IHostPCIDevicePlugEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IHostPCIDevicePlugEvent *pThis);
+    nsrefcnt (*Release)(IHostPCIDevicePlugEvent *pThis);
+    nsresult (*GetType)(IHostPCIDevicePlugEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IHostPCIDevicePlugEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IHostPCIDevicePlugEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IHostPCIDevicePlugEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IHostPCIDevicePlugEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetMachineId)(IHostPCIDevicePlugEvent *pThis, PRUnichar * *machineId);
+
+    nsresult (*GetPlugged)(IHostPCIDevicePlugEvent *pThis, PRBool *plugged);
+
+    nsresult (*GetSuccess)(IHostPCIDevicePlugEvent *pThis, PRBool *success);
+
+    nsresult (*GetAttachment)(IHostPCIDevicePlugEvent *pThis, IPCIDeviceAttachment * *attachment);
+
+    nsresult (*GetMessage)(IHostPCIDevicePlugEvent *pThis, PRUnichar * *message);
+
+};
+#define IHostPCIDevicePlugEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IHostPCIDevicePlugEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IHostPCIDevicePlugEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IHostPCIDevicePlugEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IHostPCIDevicePlugEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IHostPCIDevicePlugEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IHostPCIDevicePlugEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IHostPCIDevicePlugEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IHostPCIDevicePlugEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IHostPCIDevicePlugEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IHostPCIDevicePlugEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IHostPCIDevicePlugEvent_get_MachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IHostPCIDevicePlugEvent_GetMachineId(p, aMachineId) ((p)->lpVtbl->GetMachineId(p, aMachineId))
+#define IHostPCIDevicePlugEvent_get_Plugged(p, aPlugged) ((p)->lpVtbl->GetPlugged(p, aPlugged))
+#define IHostPCIDevicePlugEvent_GetPlugged(p, aPlugged) ((p)->lpVtbl->GetPlugged(p, aPlugged))
+#define IHostPCIDevicePlugEvent_get_Success(p, aSuccess) ((p)->lpVtbl->GetSuccess(p, aSuccess))
+#define IHostPCIDevicePlugEvent_GetSuccess(p, aSuccess) ((p)->lpVtbl->GetSuccess(p, aSuccess))
+#define IHostPCIDevicePlugEvent_get_Attachment(p, aAttachment) ((p)->lpVtbl->GetAttachment(p, aAttachment))
+#define IHostPCIDevicePlugEvent_GetAttachment(p, aAttachment) ((p)->lpVtbl->GetAttachment(p, aAttachment))
+#define IHostPCIDevicePlugEvent_get_Message(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#define IHostPCIDevicePlugEvent_GetMessage(p, aMessage) ((p)->lpVtbl->GetMessage(p, aMessage))
+#endif /* VBOX_WITH_GLUE */
+
+interface IHostPCIDevicePlugEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IHostPCIDevicePlugEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IHostPCIDevicePlugEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IHostPCIDevicePlugEvent declaration */
+
+
+/* Start of struct IVBoxSVCAvailabilityChangedEvent declaration */
+#define IVBOXSVCAVAILABILITYCHANGEDEVENT_IID_STR "97c78fcd-d4fc-485f-8613-5af88bfcfcdc"
+#define IVBOXSVCAVAILABILITYCHANGEDEVENT_IID { \
+    0x97c78fcd, 0xd4fc, 0x485f, \
+    { 0x86, 0x13, 0x5a, 0xf8, 0x8b, 0xfc, 0xfc, 0xdc } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IVBoxSVCAvailabilityChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IVBoxSVCAvailabilityChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetAvailable)(IVBoxSVCAvailabilityChangedEvent *pThis, PRBool *available);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IVBoxSVCAvailabilityChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IVBoxSVCAvailabilityChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IVBoxSVCAvailabilityChangedEvent *pThis);
+    nsrefcnt (*Release)(IVBoxSVCAvailabilityChangedEvent *pThis);
+    nsresult (*GetType)(IVBoxSVCAvailabilityChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IVBoxSVCAvailabilityChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IVBoxSVCAvailabilityChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IVBoxSVCAvailabilityChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IVBoxSVCAvailabilityChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetAvailable)(IVBoxSVCAvailabilityChangedEvent *pThis, PRBool *available);
+
+};
+#define IVBoxSVCAvailabilityChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IVBoxSVCAvailabilityChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IVBoxSVCAvailabilityChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IVBoxSVCAvailabilityChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVBoxSVCAvailabilityChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IVBoxSVCAvailabilityChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVBoxSVCAvailabilityChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IVBoxSVCAvailabilityChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVBoxSVCAvailabilityChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IVBoxSVCAvailabilityChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IVBoxSVCAvailabilityChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IVBoxSVCAvailabilityChangedEvent_get_Available(p, aAvailable) ((p)->lpVtbl->GetAvailable(p, aAvailable))
+#define IVBoxSVCAvailabilityChangedEvent_GetAvailable(p, aAvailable) ((p)->lpVtbl->GetAvailable(p, aAvailable))
+#endif /* VBOX_WITH_GLUE */
+
+interface IVBoxSVCAvailabilityChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IVBoxSVCAvailabilityChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IVBoxSVCAvailabilityChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IVBoxSVCAvailabilityChangedEvent declaration */
+
+
+/* Start of struct IBandwidthGroupChangedEvent declaration */
+#define IBANDWIDTHGROUPCHANGEDEVENT_IID_STR "334df94a-7556-4cbc-8c04-043096b02d82"
+#define IBANDWIDTHGROUPCHANGEDEVENT_IID { \
+    0x334df94a, 0x7556, 0x4cbc, \
+    { 0x8c, 0x04, 0x04, 0x30, 0x96, 0xb0, 0x2d, 0x82 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IBandwidthGroupChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IBandwidthGroupChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetBandwidthGroup)(IBandwidthGroupChangedEvent *pThis, IBandwidthGroup * *bandwidthGroup);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IBandwidthGroupChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IBandwidthGroupChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IBandwidthGroupChangedEvent *pThis);
+    nsrefcnt (*Release)(IBandwidthGroupChangedEvent *pThis);
+    nsresult (*GetType)(IBandwidthGroupChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IBandwidthGroupChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IBandwidthGroupChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IBandwidthGroupChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IBandwidthGroupChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetBandwidthGroup)(IBandwidthGroupChangedEvent *pThis, IBandwidthGroup * *bandwidthGroup);
+
+};
+#define IBandwidthGroupChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IBandwidthGroupChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IBandwidthGroupChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IBandwidthGroupChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IBandwidthGroupChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IBandwidthGroupChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IBandwidthGroupChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IBandwidthGroupChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IBandwidthGroupChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IBandwidthGroupChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IBandwidthGroupChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IBandwidthGroupChangedEvent_get_BandwidthGroup(p, aBandwidthGroup) ((p)->lpVtbl->GetBandwidthGroup(p, aBandwidthGroup))
+#define IBandwidthGroupChangedEvent_GetBandwidthGroup(p, aBandwidthGroup) ((p)->lpVtbl->GetBandwidthGroup(p, aBandwidthGroup))
+#endif /* VBOX_WITH_GLUE */
+
+interface IBandwidthGroupChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IBandwidthGroupChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IBandwidthGroupChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IBandwidthGroupChangedEvent declaration */
+
+
+/* Start of struct IGuestMonitorChangedEvent declaration */
+#define IGUESTMONITORCHANGEDEVENT_IID_STR "0f7b8a22-c71f-4a36-8e5f-a77d01d76090"
+#define IGUESTMONITORCHANGEDEVENT_IID { \
+    0x0f7b8a22, 0xc71f, 0x4a36, \
+    { 0x8e, 0x5f, 0xa7, 0x7d, 0x01, 0xd7, 0x60, 0x90 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestMonitorChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestMonitorChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetChangeType)(IGuestMonitorChangedEvent *pThis, PRUint32 *changeType);
+
+    nsresult (*GetScreenId)(IGuestMonitorChangedEvent *pThis, PRUint32 *screenId);
+
+    nsresult (*GetOriginX)(IGuestMonitorChangedEvent *pThis, PRUint32 *originX);
+
+    nsresult (*GetOriginY)(IGuestMonitorChangedEvent *pThis, PRUint32 *originY);
+
+    nsresult (*GetWidth)(IGuestMonitorChangedEvent *pThis, PRUint32 *width);
+
+    nsresult (*GetHeight)(IGuestMonitorChangedEvent *pThis, PRUint32 *height);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestMonitorChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestMonitorChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestMonitorChangedEvent *pThis);
+    nsrefcnt (*Release)(IGuestMonitorChangedEvent *pThis);
+    nsresult (*GetType)(IGuestMonitorChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestMonitorChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestMonitorChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestMonitorChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestMonitorChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetChangeType)(IGuestMonitorChangedEvent *pThis, PRUint32 *changeType);
+
+    nsresult (*GetScreenId)(IGuestMonitorChangedEvent *pThis, PRUint32 *screenId);
+
+    nsresult (*GetOriginX)(IGuestMonitorChangedEvent *pThis, PRUint32 *originX);
+
+    nsresult (*GetOriginY)(IGuestMonitorChangedEvent *pThis, PRUint32 *originY);
+
+    nsresult (*GetWidth)(IGuestMonitorChangedEvent *pThis, PRUint32 *width);
+
+    nsresult (*GetHeight)(IGuestMonitorChangedEvent *pThis, PRUint32 *height);
+
+};
+#define IGuestMonitorChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestMonitorChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestMonitorChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestMonitorChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestMonitorChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestMonitorChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestMonitorChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestMonitorChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestMonitorChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestMonitorChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestMonitorChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestMonitorChangedEvent_get_ChangeType(p, aChangeType) ((p)->lpVtbl->GetChangeType(p, aChangeType))
+#define IGuestMonitorChangedEvent_GetChangeType(p, aChangeType) ((p)->lpVtbl->GetChangeType(p, aChangeType))
+#define IGuestMonitorChangedEvent_get_ScreenId(p, aScreenId) ((p)->lpVtbl->GetScreenId(p, aScreenId))
+#define IGuestMonitorChangedEvent_GetScreenId(p, aScreenId) ((p)->lpVtbl->GetScreenId(p, aScreenId))
+#define IGuestMonitorChangedEvent_get_OriginX(p, aOriginX) ((p)->lpVtbl->GetOriginX(p, aOriginX))
+#define IGuestMonitorChangedEvent_GetOriginX(p, aOriginX) ((p)->lpVtbl->GetOriginX(p, aOriginX))
+#define IGuestMonitorChangedEvent_get_OriginY(p, aOriginY) ((p)->lpVtbl->GetOriginY(p, aOriginY))
+#define IGuestMonitorChangedEvent_GetOriginY(p, aOriginY) ((p)->lpVtbl->GetOriginY(p, aOriginY))
+#define IGuestMonitorChangedEvent_get_Width(p, aWidth) ((p)->lpVtbl->GetWidth(p, aWidth))
+#define IGuestMonitorChangedEvent_GetWidth(p, aWidth) ((p)->lpVtbl->GetWidth(p, aWidth))
+#define IGuestMonitorChangedEvent_get_Height(p, aHeight) ((p)->lpVtbl->GetHeight(p, aHeight))
+#define IGuestMonitorChangedEvent_GetHeight(p, aHeight) ((p)->lpVtbl->GetHeight(p, aHeight))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestMonitorChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestMonitorChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestMonitorChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestMonitorChangedEvent declaration */
+
+
+/* Start of struct IGuestUserStateChangedEvent declaration */
+#define IGUESTUSERSTATECHANGEDEVENT_IID_STR "39b4e759-1ec0-4c0f-857f-fbe2a737a256"
+#define IGUESTUSERSTATECHANGEDEVENT_IID { \
+    0x39b4e759, 0x1ec0, 0x4c0f, \
+    { 0x85, 0x7f, 0xfb, 0xe2, 0xa7, 0x37, 0xa2, 0x56 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IGuestUserStateChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IGuestUserStateChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetName)(IGuestUserStateChangedEvent *pThis, PRUnichar * *name);
+
+    nsresult (*GetDomain)(IGuestUserStateChangedEvent *pThis, PRUnichar * *domain);
+
+    nsresult (*GetState)(IGuestUserStateChangedEvent *pThis, PRUint32 *state);
+
+    nsresult (*GetStateDetails)(IGuestUserStateChangedEvent *pThis, PRUnichar * *stateDetails);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IGuestUserStateChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IGuestUserStateChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IGuestUserStateChangedEvent *pThis);
+    nsrefcnt (*Release)(IGuestUserStateChangedEvent *pThis);
+    nsresult (*GetType)(IGuestUserStateChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IGuestUserStateChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IGuestUserStateChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IGuestUserStateChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IGuestUserStateChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetName)(IGuestUserStateChangedEvent *pThis, PRUnichar * *name);
+
+    nsresult (*GetDomain)(IGuestUserStateChangedEvent *pThis, PRUnichar * *domain);
+
+    nsresult (*GetState)(IGuestUserStateChangedEvent *pThis, PRUint32 *state);
+
+    nsresult (*GetStateDetails)(IGuestUserStateChangedEvent *pThis, PRUnichar * *stateDetails);
+
+};
+#define IGuestUserStateChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IGuestUserStateChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IGuestUserStateChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IGuestUserStateChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestUserStateChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IGuestUserStateChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestUserStateChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IGuestUserStateChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestUserStateChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IGuestUserStateChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IGuestUserStateChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IGuestUserStateChangedEvent_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestUserStateChangedEvent_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define IGuestUserStateChangedEvent_get_Domain(p, aDomain) ((p)->lpVtbl->GetDomain(p, aDomain))
+#define IGuestUserStateChangedEvent_GetDomain(p, aDomain) ((p)->lpVtbl->GetDomain(p, aDomain))
+#define IGuestUserStateChangedEvent_get_State(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IGuestUserStateChangedEvent_GetState(p, aState) ((p)->lpVtbl->GetState(p, aState))
+#define IGuestUserStateChangedEvent_get_StateDetails(p, aStateDetails) ((p)->lpVtbl->GetStateDetails(p, aStateDetails))
+#define IGuestUserStateChangedEvent_GetStateDetails(p, aStateDetails) ((p)->lpVtbl->GetStateDetails(p, aStateDetails))
+#endif /* VBOX_WITH_GLUE */
+
+interface IGuestUserStateChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IGuestUserStateChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IGuestUserStateChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IGuestUserStateChangedEvent declaration */
+
+
+/* Start of struct IStorageDeviceChangedEvent declaration */
+#define ISTORAGEDEVICECHANGEDEVENT_IID_STR "232e9151-ae84-4b8e-b0f3-5c20c35caac9"
+#define ISTORAGEDEVICECHANGEDEVENT_IID { \
+    0x232e9151, 0xae84, 0x4b8e, \
+    { 0xb0, 0xf3, 0x5c, 0x20, 0xc3, 0x5c, 0xaa, 0xc9 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IStorageDeviceChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct IStorageDeviceChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetStorageDevice)(IStorageDeviceChangedEvent *pThis, IMediumAttachment * *storageDevice);
+
+    nsresult (*GetRemoved)(IStorageDeviceChangedEvent *pThis, PRBool *removed);
+
+    nsresult (*GetSilent)(IStorageDeviceChangedEvent *pThis, PRBool *silent);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IStorageDeviceChangedEventVtbl
+{
+    nsresult (*QueryInterface)(IStorageDeviceChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IStorageDeviceChangedEvent *pThis);
+    nsrefcnt (*Release)(IStorageDeviceChangedEvent *pThis);
+    nsresult (*GetType)(IStorageDeviceChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IStorageDeviceChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IStorageDeviceChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IStorageDeviceChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IStorageDeviceChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetStorageDevice)(IStorageDeviceChangedEvent *pThis, IMediumAttachment * *storageDevice);
+
+    nsresult (*GetRemoved)(IStorageDeviceChangedEvent *pThis, PRBool *removed);
+
+    nsresult (*GetSilent)(IStorageDeviceChangedEvent *pThis, PRBool *silent);
+
+};
+#define IStorageDeviceChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IStorageDeviceChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IStorageDeviceChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IStorageDeviceChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IStorageDeviceChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IStorageDeviceChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IStorageDeviceChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IStorageDeviceChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IStorageDeviceChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IStorageDeviceChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IStorageDeviceChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define IStorageDeviceChangedEvent_get_StorageDevice(p, aStorageDevice) ((p)->lpVtbl->GetStorageDevice(p, aStorageDevice))
+#define IStorageDeviceChangedEvent_GetStorageDevice(p, aStorageDevice) ((p)->lpVtbl->GetStorageDevice(p, aStorageDevice))
+#define IStorageDeviceChangedEvent_get_Removed(p, aRemoved) ((p)->lpVtbl->GetRemoved(p, aRemoved))
+#define IStorageDeviceChangedEvent_GetRemoved(p, aRemoved) ((p)->lpVtbl->GetRemoved(p, aRemoved))
+#define IStorageDeviceChangedEvent_get_Silent(p, aSilent) ((p)->lpVtbl->GetSilent(p, aSilent))
+#define IStorageDeviceChangedEvent_GetSilent(p, aSilent) ((p)->lpVtbl->GetSilent(p, aSilent))
+#endif /* VBOX_WITH_GLUE */
+
+interface IStorageDeviceChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IStorageDeviceChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IStorageDeviceChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IStorageDeviceChangedEvent declaration */
+
+
+/* Start of struct INATNetworkChangedEvent declaration */
+#define INATNETWORKCHANGEDEVENT_IID_STR "101ae042-1a29-4a19-92cf-02285773f3b5"
+#define INATNETWORKCHANGEDEVENT_IID { \
+    0x101ae042, 0x1a29, 0x4a19, \
+    { 0x92, 0xcf, 0x02, 0x28, 0x57, 0x73, 0xf3, 0xb5 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATNetworkChangedEvent);
+#ifndef VBOX_WITH_GLUE
+struct INATNetworkChangedEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+    nsresult (*GetNetworkName)(INATNetworkChangedEvent *pThis, PRUnichar * *networkName);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATNetworkChangedEventVtbl
+{
+    nsresult (*QueryInterface)(INATNetworkChangedEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATNetworkChangedEvent *pThis);
+    nsrefcnt (*Release)(INATNetworkChangedEvent *pThis);
+    nsresult (*GetType)(INATNetworkChangedEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(INATNetworkChangedEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(INATNetworkChangedEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(INATNetworkChangedEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        INATNetworkChangedEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetNetworkName)(INATNetworkChangedEvent *pThis, PRUnichar * *networkName);
+
+};
+#define INATNetworkChangedEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATNetworkChangedEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATNetworkChangedEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define INATNetworkChangedEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkChangedEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkChangedEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkChangedEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkChangedEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkChangedEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkChangedEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define INATNetworkChangedEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define INATNetworkChangedEvent_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkChangedEvent_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATNetworkChangedEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATNetworkChangedEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATNetworkChangedEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATNetworkChangedEvent declaration */
+
+
+/* Start of struct INATNetworkStartStopEvent declaration */
+#define INATNETWORKSTARTSTOPEVENT_IID_STR "269d8f6b-fa1e-4cee-91c7-6d8496bea3c1"
+#define INATNETWORKSTARTSTOPEVENT_IID { \
+    0x269d8f6b, 0xfa1e, 0x4cee, \
+    { 0x91, 0xc7, 0x6d, 0x84, 0x96, 0xbe, 0xa3, 0xc1 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATNetworkStartStopEvent);
+#ifndef VBOX_WITH_GLUE
+struct INATNetworkStartStopEvent_vtbl
+{
+    struct INATNetworkChangedEvent_vtbl inatnetworkchangedevent;
+
+    nsresult (*GetStartEvent)(INATNetworkStartStopEvent *pThis, PRBool *startEvent);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATNetworkStartStopEventVtbl
+{
+    nsresult (*QueryInterface)(INATNetworkStartStopEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATNetworkStartStopEvent *pThis);
+    nsrefcnt (*Release)(INATNetworkStartStopEvent *pThis);
+    nsresult (*GetType)(INATNetworkStartStopEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(INATNetworkStartStopEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(INATNetworkStartStopEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(INATNetworkStartStopEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        INATNetworkStartStopEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetNetworkName)(INATNetworkStartStopEvent *pThis, PRUnichar * *networkName);
+
+    nsresult (*GetStartEvent)(INATNetworkStartStopEvent *pThis, PRBool *startEvent);
+
+};
+#define INATNetworkStartStopEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATNetworkStartStopEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATNetworkStartStopEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define INATNetworkStartStopEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkStartStopEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkStartStopEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkStartStopEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkStartStopEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkStartStopEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkStartStopEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define INATNetworkStartStopEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define INATNetworkStartStopEvent_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkStartStopEvent_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkStartStopEvent_get_StartEvent(p, aStartEvent) ((p)->lpVtbl->GetStartEvent(p, aStartEvent))
+#define INATNetworkStartStopEvent_GetStartEvent(p, aStartEvent) ((p)->lpVtbl->GetStartEvent(p, aStartEvent))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATNetworkStartStopEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATNetworkStartStopEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATNetworkStartStopEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATNetworkStartStopEvent declaration */
+
+
+/* Start of struct INATNetworkAlterEvent declaration */
+#define INATNETWORKALTEREVENT_IID_STR "3f5a0822-163a-43b1-ad16-8d58b0ef6e75"
+#define INATNETWORKALTEREVENT_IID { \
+    0x3f5a0822, 0x163a, 0x43b1, \
+    { 0xad, 0x16, 0x8d, 0x58, 0xb0, 0xef, 0x6e, 0x75 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATNetworkAlterEvent);
+#ifndef VBOX_WITH_GLUE
+struct INATNetworkAlterEvent_vtbl
+{
+    struct INATNetworkChangedEvent_vtbl inatnetworkchangedevent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATNetworkAlterEventVtbl
+{
+    nsresult (*QueryInterface)(INATNetworkAlterEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATNetworkAlterEvent *pThis);
+    nsrefcnt (*Release)(INATNetworkAlterEvent *pThis);
+    nsresult (*GetType)(INATNetworkAlterEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(INATNetworkAlterEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(INATNetworkAlterEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(INATNetworkAlterEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        INATNetworkAlterEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetNetworkName)(INATNetworkAlterEvent *pThis, PRUnichar * *networkName);
+
+};
+#define INATNetworkAlterEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATNetworkAlterEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATNetworkAlterEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define INATNetworkAlterEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkAlterEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkAlterEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkAlterEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkAlterEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkAlterEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkAlterEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define INATNetworkAlterEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define INATNetworkAlterEvent_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkAlterEvent_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATNetworkAlterEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATNetworkAlterEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATNetworkAlterEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATNetworkAlterEvent declaration */
+
+
+/* Start of struct INATNetworkCreationDeletionEvent declaration */
+#define INATNETWORKCREATIONDELETIONEVENT_IID_STR "8d984a7e-b855-40b8-ab0c-44d3515b4528"
+#define INATNETWORKCREATIONDELETIONEVENT_IID { \
+    0x8d984a7e, 0xb855, 0x40b8, \
+    { 0xab, 0x0c, 0x44, 0xd3, 0x51, 0x5b, 0x45, 0x28 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATNetworkCreationDeletionEvent);
+#ifndef VBOX_WITH_GLUE
+struct INATNetworkCreationDeletionEvent_vtbl
+{
+    struct INATNetworkAlterEvent_vtbl inatnetworkalterevent;
+
+    nsresult (*GetCreationEvent)(INATNetworkCreationDeletionEvent *pThis, PRBool *creationEvent);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATNetworkCreationDeletionEventVtbl
+{
+    nsresult (*QueryInterface)(INATNetworkCreationDeletionEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATNetworkCreationDeletionEvent *pThis);
+    nsrefcnt (*Release)(INATNetworkCreationDeletionEvent *pThis);
+    nsresult (*GetType)(INATNetworkCreationDeletionEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(INATNetworkCreationDeletionEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(INATNetworkCreationDeletionEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(INATNetworkCreationDeletionEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        INATNetworkCreationDeletionEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetNetworkName)(INATNetworkCreationDeletionEvent *pThis, PRUnichar * *networkName);
+
+    nsresult (*GetCreationEvent)(INATNetworkCreationDeletionEvent *pThis, PRBool *creationEvent);
+
+};
+#define INATNetworkCreationDeletionEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATNetworkCreationDeletionEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATNetworkCreationDeletionEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define INATNetworkCreationDeletionEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkCreationDeletionEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkCreationDeletionEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkCreationDeletionEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkCreationDeletionEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkCreationDeletionEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkCreationDeletionEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define INATNetworkCreationDeletionEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define INATNetworkCreationDeletionEvent_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkCreationDeletionEvent_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkCreationDeletionEvent_get_CreationEvent(p, aCreationEvent) ((p)->lpVtbl->GetCreationEvent(p, aCreationEvent))
+#define INATNetworkCreationDeletionEvent_GetCreationEvent(p, aCreationEvent) ((p)->lpVtbl->GetCreationEvent(p, aCreationEvent))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATNetworkCreationDeletionEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATNetworkCreationDeletionEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATNetworkCreationDeletionEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATNetworkCreationDeletionEvent declaration */
+
+
+/* Start of struct INATNetworkSettingEvent declaration */
+#define INATNETWORKSETTINGEVENT_IID_STR "9db3a9e6-7f29-4aae-a627-5a282c83092c"
+#define INATNETWORKSETTINGEVENT_IID { \
+    0x9db3a9e6, 0x7f29, 0x4aae, \
+    { 0xa6, 0x27, 0x5a, 0x28, 0x2c, 0x83, 0x09, 0x2c } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATNetworkSettingEvent);
+#ifndef VBOX_WITH_GLUE
+struct INATNetworkSettingEvent_vtbl
+{
+    struct INATNetworkAlterEvent_vtbl inatnetworkalterevent;
+
+    nsresult (*GetEnabled)(INATNetworkSettingEvent *pThis, PRBool *enabled);
+
+    nsresult (*GetNetwork)(INATNetworkSettingEvent *pThis, PRUnichar * *network);
+
+    nsresult (*GetGateway)(INATNetworkSettingEvent *pThis, PRUnichar * *gateway);
+
+    nsresult (*GetAdvertiseDefaultIPv6RouteEnabled)(INATNetworkSettingEvent *pThis, PRBool *advertiseDefaultIPv6RouteEnabled);
+
+    nsresult (*GetNeedDhcpServer)(INATNetworkSettingEvent *pThis, PRBool *needDhcpServer);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATNetworkSettingEventVtbl
+{
+    nsresult (*QueryInterface)(INATNetworkSettingEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATNetworkSettingEvent *pThis);
+    nsrefcnt (*Release)(INATNetworkSettingEvent *pThis);
+    nsresult (*GetType)(INATNetworkSettingEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(INATNetworkSettingEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(INATNetworkSettingEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(INATNetworkSettingEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        INATNetworkSettingEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetNetworkName)(INATNetworkSettingEvent *pThis, PRUnichar * *networkName);
+
+    nsresult (*GetEnabled)(INATNetworkSettingEvent *pThis, PRBool *enabled);
+
+    nsresult (*GetNetwork)(INATNetworkSettingEvent *pThis, PRUnichar * *network);
+
+    nsresult (*GetGateway)(INATNetworkSettingEvent *pThis, PRUnichar * *gateway);
+
+    nsresult (*GetAdvertiseDefaultIPv6RouteEnabled)(INATNetworkSettingEvent *pThis, PRBool *advertiseDefaultIPv6RouteEnabled);
+
+    nsresult (*GetNeedDhcpServer)(INATNetworkSettingEvent *pThis, PRBool *needDhcpServer);
+
+};
+#define INATNetworkSettingEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATNetworkSettingEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATNetworkSettingEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define INATNetworkSettingEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkSettingEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkSettingEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkSettingEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkSettingEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkSettingEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkSettingEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define INATNetworkSettingEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define INATNetworkSettingEvent_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkSettingEvent_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkSettingEvent_get_Enabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define INATNetworkSettingEvent_GetEnabled(p, aEnabled) ((p)->lpVtbl->GetEnabled(p, aEnabled))
+#define INATNetworkSettingEvent_get_Network(p, aNetwork) ((p)->lpVtbl->GetNetwork(p, aNetwork))
+#define INATNetworkSettingEvent_GetNetwork(p, aNetwork) ((p)->lpVtbl->GetNetwork(p, aNetwork))
+#define INATNetworkSettingEvent_get_Gateway(p, aGateway) ((p)->lpVtbl->GetGateway(p, aGateway))
+#define INATNetworkSettingEvent_GetGateway(p, aGateway) ((p)->lpVtbl->GetGateway(p, aGateway))
+#define INATNetworkSettingEvent_get_AdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled) ((p)->lpVtbl->GetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled))
+#define INATNetworkSettingEvent_GetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled) ((p)->lpVtbl->GetAdvertiseDefaultIPv6RouteEnabled(p, aAdvertiseDefaultIPv6RouteEnabled))
+#define INATNetworkSettingEvent_get_NeedDhcpServer(p, aNeedDhcpServer) ((p)->lpVtbl->GetNeedDhcpServer(p, aNeedDhcpServer))
+#define INATNetworkSettingEvent_GetNeedDhcpServer(p, aNeedDhcpServer) ((p)->lpVtbl->GetNeedDhcpServer(p, aNeedDhcpServer))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATNetworkSettingEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATNetworkSettingEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATNetworkSettingEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATNetworkSettingEvent declaration */
+
+
+/* Start of struct INATNetworkPortForwardEvent declaration */
+#define INATNETWORKPORTFORWARDEVENT_IID_STR "2514881b-23d0-430a-a7ff-7ed7f05534bc"
+#define INATNETWORKPORTFORWARDEVENT_IID { \
+    0x2514881b, 0x23d0, 0x430a, \
+    { 0xa7, 0xff, 0x7e, 0xd7, 0xf0, 0x55, 0x34, 0xbc } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_INATNetworkPortForwardEvent);
+#ifndef VBOX_WITH_GLUE
+struct INATNetworkPortForwardEvent_vtbl
+{
+    struct INATNetworkAlterEvent_vtbl inatnetworkalterevent;
+
+    nsresult (*GetCreate)(INATNetworkPortForwardEvent *pThis, PRBool *create);
+
+    nsresult (*GetIpv6)(INATNetworkPortForwardEvent *pThis, PRBool *ipv6);
+
+    nsresult (*GetName)(INATNetworkPortForwardEvent *pThis, PRUnichar * *name);
+
+    nsresult (*GetProto)(INATNetworkPortForwardEvent *pThis, PRUint32 *proto);
+
+    nsresult (*GetHostIp)(INATNetworkPortForwardEvent *pThis, PRUnichar * *hostIp);
+
+    nsresult (*GetHostPort)(INATNetworkPortForwardEvent *pThis, PRInt32 *hostPort);
+
+    nsresult (*GetGuestIp)(INATNetworkPortForwardEvent *pThis, PRUnichar * *guestIp);
+
+    nsresult (*GetGuestPort)(INATNetworkPortForwardEvent *pThis, PRInt32 *guestPort);
+
+};
+#else /* VBOX_WITH_GLUE */
+struct INATNetworkPortForwardEventVtbl
+{
+    nsresult (*QueryInterface)(INATNetworkPortForwardEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(INATNetworkPortForwardEvent *pThis);
+    nsrefcnt (*Release)(INATNetworkPortForwardEvent *pThis);
+    nsresult (*GetType)(INATNetworkPortForwardEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(INATNetworkPortForwardEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(INATNetworkPortForwardEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(INATNetworkPortForwardEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        INATNetworkPortForwardEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+    nsresult (*GetNetworkName)(INATNetworkPortForwardEvent *pThis, PRUnichar * *networkName);
+
+    nsresult (*GetCreate)(INATNetworkPortForwardEvent *pThis, PRBool *create);
+
+    nsresult (*GetIpv6)(INATNetworkPortForwardEvent *pThis, PRBool *ipv6);
+
+    nsresult (*GetName)(INATNetworkPortForwardEvent *pThis, PRUnichar * *name);
+
+    nsresult (*GetProto)(INATNetworkPortForwardEvent *pThis, PRUint32 *proto);
+
+    nsresult (*GetHostIp)(INATNetworkPortForwardEvent *pThis, PRUnichar * *hostIp);
+
+    nsresult (*GetHostPort)(INATNetworkPortForwardEvent *pThis, PRInt32 *hostPort);
+
+    nsresult (*GetGuestIp)(INATNetworkPortForwardEvent *pThis, PRUnichar * *guestIp);
+
+    nsresult (*GetGuestPort)(INATNetworkPortForwardEvent *pThis, PRInt32 *guestPort);
+
+};
+#define INATNetworkPortForwardEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define INATNetworkPortForwardEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define INATNetworkPortForwardEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define INATNetworkPortForwardEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkPortForwardEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define INATNetworkPortForwardEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkPortForwardEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define INATNetworkPortForwardEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkPortForwardEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define INATNetworkPortForwardEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define INATNetworkPortForwardEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#define INATNetworkPortForwardEvent_get_NetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkPortForwardEvent_GetNetworkName(p, aNetworkName) ((p)->lpVtbl->GetNetworkName(p, aNetworkName))
+#define INATNetworkPortForwardEvent_get_Create(p, aCreate) ((p)->lpVtbl->GetCreate(p, aCreate))
+#define INATNetworkPortForwardEvent_GetCreate(p, aCreate) ((p)->lpVtbl->GetCreate(p, aCreate))
+#define INATNetworkPortForwardEvent_get_Ipv6(p, aIpv6) ((p)->lpVtbl->GetIpv6(p, aIpv6))
+#define INATNetworkPortForwardEvent_GetIpv6(p, aIpv6) ((p)->lpVtbl->GetIpv6(p, aIpv6))
+#define INATNetworkPortForwardEvent_get_Name(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define INATNetworkPortForwardEvent_GetName(p, aName) ((p)->lpVtbl->GetName(p, aName))
+#define INATNetworkPortForwardEvent_get_Proto(p, aProto) ((p)->lpVtbl->GetProto(p, aProto))
+#define INATNetworkPortForwardEvent_GetProto(p, aProto) ((p)->lpVtbl->GetProto(p, aProto))
+#define INATNetworkPortForwardEvent_get_HostIp(p, aHostIp) ((p)->lpVtbl->GetHostIp(p, aHostIp))
+#define INATNetworkPortForwardEvent_GetHostIp(p, aHostIp) ((p)->lpVtbl->GetHostIp(p, aHostIp))
+#define INATNetworkPortForwardEvent_get_HostPort(p, aHostPort) ((p)->lpVtbl->GetHostPort(p, aHostPort))
+#define INATNetworkPortForwardEvent_GetHostPort(p, aHostPort) ((p)->lpVtbl->GetHostPort(p, aHostPort))
+#define INATNetworkPortForwardEvent_get_GuestIp(p, aGuestIp) ((p)->lpVtbl->GetGuestIp(p, aGuestIp))
+#define INATNetworkPortForwardEvent_GetGuestIp(p, aGuestIp) ((p)->lpVtbl->GetGuestIp(p, aGuestIp))
+#define INATNetworkPortForwardEvent_get_GuestPort(p, aGuestPort) ((p)->lpVtbl->GetGuestPort(p, aGuestPort))
+#define INATNetworkPortForwardEvent_GetGuestPort(p, aGuestPort) ((p)->lpVtbl->GetGuestPort(p, aGuestPort))
+#endif /* VBOX_WITH_GLUE */
+
+interface INATNetworkPortForwardEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct INATNetworkPortForwardEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct INATNetworkPortForwardEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct INATNetworkPortForwardEvent declaration */
+
+
+/* Start of struct IHostNameResolutionConfigurationChangeEvent declaration */
+#define IHOSTNAMERESOLUTIONCONFIGURATIONCHANGEEVENT_IID_STR "f9b9e1cf-cb63-47a1-84fb-02c4894b89a9"
+#define IHOSTNAMERESOLUTIONCONFIGURATIONCHANGEEVENT_IID { \
+    0xf9b9e1cf, 0xcb63, 0x47a1, \
+    { 0x84, 0xfb, 0x02, 0xc4, 0x89, 0x4b, 0x89, 0xa9 } \
+}
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsIID, IID_IHostNameResolutionConfigurationChangeEvent);
+#ifndef VBOX_WITH_GLUE
+struct IHostNameResolutionConfigurationChangeEvent_vtbl
+{
+    struct IEvent_vtbl ievent;
+
+};
+#else /* VBOX_WITH_GLUE */
+struct IHostNameResolutionConfigurationChangeEventVtbl
+{
+    nsresult (*QueryInterface)(IHostNameResolutionConfigurationChangeEvent *pThis, const nsID *iid, void **resultp);
+    nsrefcnt (*AddRef)(IHostNameResolutionConfigurationChangeEvent *pThis);
+    nsrefcnt (*Release)(IHostNameResolutionConfigurationChangeEvent *pThis);
+    nsresult (*GetType)(IHostNameResolutionConfigurationChangeEvent *pThis, PRUint32 *type);
+
+    nsresult (*GetSource)(IHostNameResolutionConfigurationChangeEvent *pThis, IEventSource * *source);
+
+    nsresult (*GetWaitable)(IHostNameResolutionConfigurationChangeEvent *pThis, PRBool *waitable);
+
+    nsresult (*SetProcessed)(IHostNameResolutionConfigurationChangeEvent *pThis );
+
+    nsresult (*WaitProcessed)(
+        IHostNameResolutionConfigurationChangeEvent *pThis,
+        PRInt32 timeout,
+        PRBool * result
+    );
+
+};
+#define IHostNameResolutionConfigurationChangeEvent_QueryInterface(p, iid, resultp) ((p)->lpVtbl->QueryInterface(p, iid, resultp))
+#define IHostNameResolutionConfigurationChangeEvent_AddRef(p) ((p)->lpVtbl->AddRef(p))
+#define IHostNameResolutionConfigurationChangeEvent_Release(p) ((p)->lpVtbl->Release(p))
+#define IHostNameResolutionConfigurationChangeEvent_get_Type(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IHostNameResolutionConfigurationChangeEvent_GetType(p, aType) ((p)->lpVtbl->GetType(p, aType))
+#define IHostNameResolutionConfigurationChangeEvent_get_Source(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IHostNameResolutionConfigurationChangeEvent_GetSource(p, aSource) ((p)->lpVtbl->GetSource(p, aSource))
+#define IHostNameResolutionConfigurationChangeEvent_get_Waitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IHostNameResolutionConfigurationChangeEvent_GetWaitable(p, aWaitable) ((p)->lpVtbl->GetWaitable(p, aWaitable))
+#define IHostNameResolutionConfigurationChangeEvent_SetProcessed(p) ((p)->lpVtbl->SetProcessed(p))
+#define IHostNameResolutionConfigurationChangeEvent_WaitProcessed(p, aTimeout, aResult) ((p)->lpVtbl->WaitProcessed(p, aTimeout, aResult))
+#endif /* VBOX_WITH_GLUE */
+
+interface IHostNameResolutionConfigurationChangeEvent
+{
+#ifndef VBOX_WITH_GLUE
+    struct IHostNameResolutionConfigurationChangeEvent_vtbl *vtbl;
+#else /* VBOX_WITH_GLUE */
+    CONST_VTBL struct IHostNameResolutionConfigurationChangeEventVtbl *lpVtbl;
+#endif /* VBOX_WITH_GLUE */
+};
+/* End of struct IHostNameResolutionConfigurationChangeEvent declaration */
+
+
+
+#define NS_VIRTUALBOX_CID { \
+    0xB1A7A4F2, 0x47B9, 0x4A1E, \
+    { 0x82, 0xB2, 0x07, 0xCC, 0xD5, 0x32, 0x3C, 0x3F } \
+}
+#define NS_VIRTUALBOX_CONTRACTID "@virtualbox.org/VirtualBox;1"
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsCID, CLSID_VirtualBox);
+
+
+
+#define NS_VIRTUALBOXCLIENT_CID { \
+    0xdd3fc71d, 0x26c0, 0x4fe1, \
+    { 0xbf, 0x6f, 0x67, 0xf6, 0x33, 0x26, 0x5b, 0xba } \
+}
+#define NS_VIRTUALBOXCLIENT_CONTRACTID "@virtualbox.org/VirtualBoxClient;1"
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsCID, CLSID_VirtualBoxClient);
+
+
+
+#define NS_SESSION_CID { \
+    0x3C02F46D, 0xC9D2, 0x4F11, \
+    { 0xA3, 0x84, 0x53, 0xF0, 0xCF, 0x91, 0x72, 0x14 } \
+}
+#define NS_SESSION_CONTRACTID "@virtualbox.org/Session;1"
+/* COM compatibility */
+VBOX_EXTERN_CONST(nsCID, CLSID_Session);
+
+
+
+
+#endif /* __cplusplus */
+
+#endif /* !WIN32 */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+
+/**
+ * Function table for dynamic linking.
+ * Use VBoxGetCAPIFunctions() to obtain the pointer to it.
+ */
+typedef struct VBOXCAPI
+{
+    /** The size of the structure. */
+    unsigned cb;
+    /** The structure version. */
+    unsigned uVersion;
+
+    /** Gets the VirtualBox version, major * 1000000 + minor * 1000 + patch. */
+    unsigned int (*pfnGetVersion)(void);
+
+    /** Gets the VirtualBox API version, major * 1000 + minor, e.g. 4003. */
+    unsigned int (*pfnGetAPIVersion)(void);
+
+    /**
+     * New and preferred way to initialize the C bindings for an API client.
+     *
+     * This way is much more flexible, as it can easily handle multiple
+     * sessions (important with more complicated API clients, including
+     * multithreaded ones), and even VBoxSVC crashes can be detected and
+     * processed appropriately by listening for events from the associated
+     * event source in VirtualBoxClient. It is completely up to the client
+     * to decide what to do (terminate or continue after getting new
+     * object references to server-side objects). Must be called in the
+     * primary thread of the client, later API use can be done in any
+     * thread.
+     *
+     * Note that the returned reference is owned by the caller, and thus it's
+     * the caller's responsibility to handle the reference count appropriately.
+     *
+     * @param pszVirtualBoxClientIID    pass IVIRTUALBOXCLIENT_IID_STR
+     * @param ppVirtualBoxClient        output parameter for VirtualBoxClient
+     *              reference, handled as usual with COM/XPCOM.
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnClientInitialize)(const char *pszVirtualBoxClientIID,
+                                   IVirtualBoxClient **ppVirtualBoxClient);
+    /**
+     * Initialize the use of the C bindings in a non-primary thread.
+     *
+     * Must be called on any newly created thread which wants to use the
+     * VirtualBox API.
+     *
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnClientThreadInitialize)(void);
+    /**
+     * Uninitialize the use of the C bindings in a non-primary thread.
+     *
+     * Should be called before terminating the thread which initialized the
+     * C bindings using pfnClientThreadInitialize.
+     *
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnClientThreadUninitialize)(void);
+    /**
+     * Uninitialize the C bindings for an API client.
+     *
+     * Should be called when the API client is about to terminate and does
+     * not want to use the C bindings any more. It will invalidate all
+     * object references. It is possible, however, to change one's mind,
+     * and call pfnClientInitialize again to continue using the API, as long
+     * as none of the object references from before the re-initialization
+     * are used. Must be called from the primary thread of the client.
+     */
+    void (*pfnClientUninitialize)(void);
+
+    /**
+     * Deprecated way to initialize the C bindings and getting important
+     * object references. Kept for backwards compatibility.
+     *
+     * If any returned reference is NULL then the initialization failed.
+     * Note that the returned references are owned by the C bindings. The
+     * number of calls to Release in the client code must match the number
+     * of calls to AddRef, and additionally at no point in time there can
+     * be more Release calls than AddRef calls.
+     *
+     * @param pszVirtualBoxIID      pass IVIRTUALBOX_IID_STR
+     * @param ppVirtualBox          output parameter for VirtualBox reference,
+     *          owned by C bindings
+     * @param pszSessionIID         pass ISESSION_IID_STR
+     * @param ppSession             output parameter for Session reference,
+     *          owned by C bindings
+     */
+    void (*pfnComInitialize)(const char *pszVirtualBoxIID,
+                             IVirtualBox **ppVirtualBox,
+                             const char *pszSessionIID,
+                             ISession **ppSession);
+    /**
+     * Deprecated way to uninitialize the C bindings for an API client.
+     * Kept for backwards compatibility and must be used if the C bindings
+     * were initialized using pfnComInitialize. */
+    void (*pfnComUninitialize)(void);
+
+    /**
+     * Free string managed by COM/XPCOM.
+     *
+     * @param pwsz          pointer to string to be freed
+     */
+    void (*pfnComUnallocString)(BSTR pwsz);
+#ifndef WIN32
+    /** Legacy function, was always for freeing strings only. */
+#define pfnComUnallocMem(pv) pfnComUnallocString((BSTR)(pv))
+#endif /* !WIN32 */
+
+    /**
+     * Convert string from UTF-16 encoding to UTF-8 encoding.
+     *
+     * @param pwszString    input string
+     * @param ppszString    output string
+     * @returns IPRT status code
+     */
+    int (*pfnUtf16ToUtf8)(CBSTR pwszString, char **ppszString);
+    /**
+     * Convert string from UTF-8 encoding to UTF-16 encoding.
+     *
+     * @param pszString     input string
+     * @param ppwszString   output string
+     * @returns IPRT status code
+     */
+    int (*pfnUtf8ToUtf16)(const char *pszString, BSTR *ppwszString);
+    /**
+     * Free memory returned by pfnUtf16ToUtf8. Do not use for anything else.
+     *
+     * @param pszString     string to be freed.
+     */
+    void (*pfnUtf8Free)(char *pszString);
+    /**
+     * Free memory returned by pfnUtf8ToUtf16. Do not use for anything else.
+     *
+     * @param pwszString    string to be freed.
+     */
+    void (*pfnUtf16Free)(BSTR pwszString);
+
+    /**
+     * Create a safearray (used for passing arrays to COM/XPCOM)
+     *
+     * Must be freed by pfnSafeArrayDestroy.
+     *
+     * @param vt            variant type, defines the size of the elements
+     * @param lLbound       lower bound of the index, should be 0
+     * @param cElements     number of elements
+     * @returns pointer to safearray
+     */
+    SAFEARRAY *(*pfnSafeArrayCreateVector)(VARTYPE vt, LONG lLbound, ULONG cElements);
+    /**
+     * Pre-allocate a safearray to be used by an out safearray parameter
+     *
+     * Must be freed by pfnSafeArrayDestroy.
+     *
+     * @returns pointer to safearray (system dependent, may be NULL if
+     *    there is no need to pre-allocate a safearray)
+     */
+    SAFEARRAY *(*pfnSafeArrayOutParamAlloc)(void);
+    /**
+     * Copy a C array into a safearray (for passing as an input parameter)
+     *
+     * @param psa           pointer to already created safearray.
+     * @param pv            pointer to memory block to copy into safearray.
+     * @param cb            number of bytes to copy.
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnSafeArrayCopyInParamHelper)(SAFEARRAY *psa, const void *pv, ULONG cb);
+    /**
+     * Copy a safearray into a C array (for getting an output parameter)
+     *
+     * @param ppv           output pointer to newly created array, which has to
+     *          be freed with pfnArrayOutFree.
+     * @param pcb           number of bytes in the output buffer.
+     * @param vt            variant type, defines the size of the elements
+     * @param psa           pointer to safearray for getting the data
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnSafeArrayCopyOutParamHelper)(void **ppv, ULONG *pcb, VARTYPE vt, SAFEARRAY *psa);
+    /**
+     * Copy a safearray into a C array (special variant for interface pointers)
+     *
+     * @param ppaObj        output pointer to newly created array, which has
+     *          to be freed with pfnArrayOutFree. Note that it's the caller's
+     *          responsibility to call Release() on each non-NULL interface
+     *          pointer before freeing.
+     * @param pcObj         number of pointers in the output buffer.
+     * @param psa           pointer to safearray for getting the data
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnSafeArrayCopyOutIfaceParamHelper)(IUnknown ***ppaObj, ULONG *pcObj, SAFEARRAY *psa);
+    /**
+     * Free a safearray
+     *
+     * @param psa           pointer to safearray
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnSafeArrayDestroy)(SAFEARRAY *psa);
+    /**
+     * Free an out array created by pfnSafeArrayCopyOutParamHelper or
+     * pdnSafeArrayCopyOutIfaceParamHelper.
+     *
+     * @param psa           pointer to memory block
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnArrayOutFree)(void *pv);
+
+#ifndef WIN32
+    /**
+     * Get XPCOM event queue. Deprecated!
+     *
+     * @param ppEventQueue      output parameter for nsIEventQueue reference,
+     *              owned by C bindings.
+     */
+    void (*pfnGetEventQueue)(nsIEventQueue **ppEventQueue);
+#endif /* !WIN32 */
+
+    /**
+     * Get current COM/XPCOM exception.
+     *
+     * @param ppException       output parameter for exception info reference,
+     *              may be @c NULL if no exception object has been created by
+     *              a previous COM/XPCOM call.
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnGetException)(IErrorInfo **ppException);
+    /**
+     * Clears current COM/XPCOM exception.
+     *
+     * @returns COM/XPCOM error code
+     */
+    HRESULT (*pfnClearException)(void);
+
+    /**
+     * Process the event queue for a given amount of time.
+     *
+     * Must be called on the primary thread. Typical timeouts are from 200 to
+     * 5000 msecs, to allow for checking a volatile variable if the event queue
+     * processing should be terminated (,
+     * or 0 if only the pending events should be processed, without waiting.
+     *
+     * @param iTimeoutMS        how long to process the event queue, -1 means
+     *              infinitely long
+     * @returns status code
+     * @retval 0 if at least one event has been processed
+     * @retval 1 if any signal interrupted the native system call (or returned
+     *      otherwise)
+     * @retval 2 if the event queue was explicitly interrupted
+     * @retval 3 if the timeout expired
+     * @retval 4 if the function was called from the wrong thread
+     * @retval 5 for all other (unexpected) errors
+     */
+    int (*pfnProcessEventQueue)(LONG64 iTimeoutMS);
+    /**
+     * Interrupt event queue processing.
+     *
+     * Can be called on any thread. Note that this function is not async-signal
+     * safe, so never use it in such a context, instead use a volatile global
+     * variable and a sensible timeout.
+     * @returns 0 if successful, 1 otherwise.
+     */
+    int (*pfnInterruptEventQueueProcessing)(void);
+
+    /** Tail version, same as uVersion. */
+    unsigned uEndVersion;
+} VBOXCAPI;
+/** Pointer to a const VBOXCAPI function table. */
+typedef VBOXCAPI const *PCVBOXCAPI;
+#ifndef WIN32
+/** Backwards compatibility: Pointer to a const VBOXCAPI function table.
+ * Use PCVBOXCAPI instead. */
+typedef VBOXCAPI const *PCVBOXXPCOM;
+#endif /* !WIN32 */
+
+#ifndef WIN32
+/** Backwards compatibility: make sure old code using VBOXXPCOMC still compiles.
+ * Use VBOXCAPI instead. */
+#define VBOXXPCOMC VBOXCAPI
+#endif /* !WIN32 */
+
+/** The current interface version.
+ * For use with VBoxGetCAPIFunctions and to be found in VBOXCAPI::uVersion. */
+#define VBOX_CAPI_VERSION 0x00040000U
+
+#ifndef WIN32
+/** Backwards compatibility: The current interface version.
+ * Use VBOX_CAPI_VERSION instead. */
+#define VBOX_XPCOMC_VERSION VBOX_CAPI_VERSION
+#endif /* !WIN32 */
+
+/** VBoxGetCAPIFunctions. */
+VBOXCAPI_DECL(PCVBOXCAPI) VBoxGetCAPIFunctions(unsigned uVersion);
+#ifndef WIN32
+/** Backwards compatibility: VBoxGetXPCOMCFunctions.
+ * Use VBoxGetCAPIFunctions instead. */
+VBOXCAPI_DECL(PCVBOXCAPI) VBoxGetXPCOMCFunctions(unsigned uVersion);
+#endif /* !WIN32 */
+
+/** Typedef for VBoxGetCAPIFunctions. */
+typedef PCVBOXCAPI (*PFNVBOXGETCAPIFUNCTIONS)(unsigned uVersion);
+#ifndef WIN32
+/** Backwards compatibility: Typedef for VBoxGetXPCOMCFunctions.
+ * Use PFNVBOXGETCAPIFUNCTIONS instead. */
+typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
+#endif /* !WIN32 */
+
+/** The symbol name of VBoxGetCAPIFunctions. */
+#ifdef __OS2__
+# define VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME "_VBoxGetCAPIFunctions"
+#else /* !__OS2__ */
+# define VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME "VBoxGetCAPIFunctions"
+#endif /* !__OS2__ */
+#ifndef WIN32
+/** Backwards compatibility: The symbol name of VBoxGetXPCOMCFunctions.
+ * Use VBOX_GET_CAPI_FUNCTIONS_SYMBOL_NAME instead. */
+# ifdef __OS2__
+#  define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "_VBoxGetXPCOMCFunctions"
+# else /* !__OS2__ */
+#  define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "VBoxGetXPCOMCFunctions"
+# endif /* !__OS2__ */
+#endif /* !WIN32 */
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* !___VirtualBox_CAPI_h */
diff --git a/src/VBox/Main/cbinding/capiidl.xsl b/src/VBox/Main/cbinding/capiidl.xsl
index b8b8d00..720619a 100644
--- a/src/VBox/Main/cbinding/capiidl.xsl
+++ b/src/VBox/Main/cbinding/capiidl.xsl
@@ -7,7 +7,7 @@
  *  works on Windows, by using the C bindings header created by the MS COM IDL
  *  compiler (which simultaneously supports C and C++, unlike XPCOM).
 
-    Copyright (C) 2008-2014 Oracle Corporation
+    Copyright (C) 2008-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -24,65 +24,14 @@
 <xsl:strip-space elements="*"/>
 
 
-<!--
-//  helper definitions
-/////////////////////////////////////////////////////////////////////////////
--->
-
-<!--
- *  capitalizes the first letter
--->
-<xsl:template name="capitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    concat(
-      translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
-      substring($str,2)
-    )
-  "/>
-</xsl:template>
+<xsl:include href="../idl/typemap-shared.inc.xsl"/>
 
 <!--
- *  uncapitalizes the first letter only if the second one is not capital
- *  otherwise leaves the string unchanged
--->
-<xsl:template name="uncapitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:choose>
-    <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
-      <xsl:value-of select="
-        concat(
-          translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
-          substring($str,2)
-        )
-      "/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:value-of select="string($str)"/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<!--
- *  translates the string to uppercase
+//  Keys for more efficiently looking up of types.
+/////////////////////////////////////////////////////////////////////////////
 -->
-<xsl:template name="uppercase">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
-  "/>
-</xsl:template>
 
-
-<!--
- *  translates the string to lowercase
--->
-<xsl:template name="lowercase">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    translate($str,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')
-  "/>
-</xsl:template>
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
 
 
 <!--
@@ -123,7 +72,7 @@
  */
 
 /*
- * Copyright (C) 2008-2014 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of a free software library; you can redistribute
  * it and/or modify it under the terms of the GNU Lesser General
@@ -1257,8 +1206,8 @@ interface nsIEventQueue
     CONST_VTBL struct nsIEventQueueVtbl *lpVtbl;
 #endif /* !VBOX_WITH_GLUE */
 };
-
 </xsl:text>
+ <xsl:call-template name="xsltprocNewlineOutputHack"/>
  <xsl:apply-templates/>
  <xsl:text>
 
@@ -1656,17 +1605,18 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
 -->
 <xsl:template match="library">
   <!-- result codes -->
-  <xsl:text>&#x0A;</xsl:text>
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
   <xsl:for-each select="result">
     <xsl:apply-templates select="."/>
   </xsl:for-each>
-  <xsl:text>&#x0A;&#x0A;</xsl:text>
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
   <!-- forward declarations -->
   <xsl:apply-templates select="interface | if/interface" mode="forward"/>
-  <xsl:text>&#x0A;</xsl:text>
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
   <!-- typedef'ing the struct declarations -->
   <xsl:apply-templates select="interface | if/interface" mode="typedef"/>
-  <xsl:text>&#x0A;</xsl:text>
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
   <!-- all enums go first -->
   <xsl:apply-templates select="enum | if/enum"/>
   <!-- everything else but result codes and enums -->
@@ -1799,7 +1749,7 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
       <xsl:text>_ToString(p, retval) ((p)->lpVtbl->ToString(p, retval))&#x0A;</xsl:text>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="//interface[@name=$extends]" mode="cobjmacro">
+      <xsl:apply-templates select="key('G_keyInterfacesByName', $extends)" mode="cobjmacro">
         <xsl:with-param name="iface" select="$iface"/>
       </xsl:apply-templates>
     </xsl:otherwise>
@@ -1876,7 +1826,7 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
       <xsl:text> *pThis, PRUnichar **_retval);&#x0A;</xsl:text>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:apply-templates select="//interface[@name=$extends]" mode="vtab_flat">
+      <xsl:apply-templates select="key('G_keyInterfacesByName', $extends)" mode="vtab_flat">
         <xsl:with-param name="iface" select="$iface"/>
       </xsl:apply-templates>
     </xsl:otherwise>
@@ -1901,13 +1851,13 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
     <xsl:value-of select="@name"/>
     <xsl:text> declaration */&#x0A;</xsl:text>
     <xsl:text>#define </xsl:text>
-    <xsl:call-template name="uppercase">
+    <xsl:call-template name="string-to-upper">
       <xsl:with-param name="str" select="@name"/>
     </xsl:call-template>
     <xsl:value-of select="concat('_IID_STR "', at uuid,'"')"/>
     <xsl:text>&#x0A;</xsl:text>
     <xsl:text>#define </xsl:text>
-    <xsl:call-template name="uppercase">
+    <xsl:call-template name="string-to-upper">
       <xsl:with-param name="str" select="@name"/>
     </xsl:call-template>
     <xsl:text>_IID { \&#x0A;</xsl:text>
@@ -1940,7 +1890,7 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
         <xsl:text>struct </xsl:text>
         <xsl:value-of select="@extends"/>
         <xsl:text>_vtbl </xsl:text>
-        <xsl:call-template name="lowercase">
+        <xsl:call-template name="string-to-lower">
           <xsl:with-param name="str" select="@extends"/>
         </xsl:call-template>
         <xsl:text>;</xsl:text>
@@ -1982,7 +1932,8 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
     <xsl:text>};&#x0A;</xsl:text>
     <xsl:text>/* End of struct </xsl:text>
     <xsl:value-of select="@name"/>
-    <xsl:text> declaration */&#x0A;&#x0A;&#x0A;</xsl:text>
+    <xsl:text> declaration */&#x0A;&#x0A;</xsl:text>
+    <xsl:call-template name="xsltprocNewlineOutputHack"/>
   </xsl:if>
 </xsl:template>
 
@@ -2250,7 +2201,7 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
   <!-- class and contract id -->
   <xsl:text>&#x0A;</xsl:text>
   <xsl:text>#define NS_</xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="@name"/>
   </xsl:call-template>
   <xsl:text>_CID { \&#x0A;</xsl:text>
@@ -2268,7 +2219,7 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
   <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
   <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
   <xsl:text>#define NS_</xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="@name"/>
   </xsl:call-template>
   <!-- Contract ID -->
@@ -2294,13 +2245,13 @@ typedef PCVBOXCAPI (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
   <xsl:value-of select="@name"/>
   <xsl:text> declaration */&#x0A;</xsl:text>
   <xsl:text>#define </xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="@name"/>
   </xsl:call-template>
   <xsl:value-of select="concat('_IID_STR "', at uuid,'"')"/>
   <xsl:text>&#x0A;</xsl:text>
   <xsl:text>#define </xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="@name"/>
   </xsl:call-template>
   <xsl:text>_IID { \&#x0A;</xsl:text>
diff --git a/src/VBox/Main/cbinding/makefile.tstCAPIGlue b/src/VBox/Main/cbinding/makefile.tstCAPIGlue
index 057395a..40b85aa 100644
--- a/src/VBox/Main/cbinding/makefile.tstCAPIGlue
+++ b/src/VBox/Main/cbinding/makefile.tstCAPIGlue
@@ -1,4 +1,4 @@
-# $Revision: 91907 $
+# $Revision: 91752 $
 ## @file makefile.tstCAPIGlue
 # Makefile for sample program illustrating use of C binding for COM/XPCOM.
 #
diff --git a/src/VBox/Main/cbinding/tstCAPIGlue.c b/src/VBox/Main/cbinding/tstCAPIGlue.c
index 9cb9a44..ff66d91 100644
--- a/src/VBox/Main/cbinding/tstCAPIGlue.c
+++ b/src/VBox/Main/cbinding/tstCAPIGlue.c
@@ -1,4 +1,4 @@
-/* $Revision: 100177 $ */
+/* $Id: tstCAPIGlue.c $ */
 /** @file tstCAPIGlue.c
  * Demonstrator program to illustrate use of C bindings of Main API.
  *
diff --git a/src/VBox/Main/glue/com.cpp b/src/VBox/Main/glue/com.cpp
index 9a6366f..6d856a4 100644
--- a/src/VBox/Main/glue/com.cpp
+++ b/src/VBox/Main/glue/com.cpp
@@ -82,10 +82,7 @@ namespace com
 
 void GetInterfaceNameByIID(const GUID &aIID, BSTR *aName)
 {
-    Assert(aName);
-    if (!aName)
-        return;
-
+    AssertPtrReturnVoid(aName);
     *aName = NULL;
 
 #if !defined(VBOX_WITH_XPCOM)
@@ -114,7 +111,7 @@ void GetInterfaceNameByIID(const GUID &aIID, BSTR *aName)
                     if (rc != ERROR_SUCCESS)
                     {
                         SysFreeString(*aName);
-                        aName = NULL;
+                        *aName = NULL;
                     }
                 }
                 RegCloseKey(iidKey);
@@ -379,7 +376,8 @@ int VBoxLogRelCreate(const char *pcszEntity, const char *pcszLogFile,
     int vrc = RTLogCreateEx(&pReleaseLogger, fFlags, pcszGroupSettings,
                             pcszEnvVarBase, RT_ELEMENTS(s_apszGroups), s_apszGroups, fDestFlags,
                             vboxHeaderFooter, cHistory, uHistoryFileSize, uHistoryFileTime,
-                            pszError, cbError, pcszLogFile);
+                            pszError, cbError,
+                            pcszLogFile ? "%s" : NULL, pcszLogFile);
     if (RT_SUCCESS(vrc))
     {
         /* make sure that we don't flood logfiles */
diff --git a/src/VBox/Main/glue/constants-python.xsl b/src/VBox/Main/glue/constants-python.xsl
index 3795d25..2431cff 100644
--- a/src/VBox/Main/glue/constants-python.xsl
+++ b/src/VBox/Main/glue/constants-python.xsl
@@ -47,7 +47,7 @@ VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 """
 
-__version__ = "$Revision: 87223 $";
+__version__ = "$Revision: 97792 $";
 
 
 
@@ -73,10 +73,11 @@ class VirtualBoxReflectionInfo:
         <xsl:text>
         },</xsl:text>
     </xsl:for-each>
-    <xsl:text>
+    <!-- hack alert: force new output element to avoid large reallocations. -->
+    <xsl:text disable-output-escaping="yes"><![CDATA[
     }
 
-    __dValuesSym = {</xsl:text>
+    __dValuesSym = {]]></xsl:text>
     <xsl:for-each select="//enum">
         <xsl:text>
         '</xsl:text> <xsl:value-of select="@name"/> <xsl:text>': { </xsl:text>
@@ -89,10 +90,11 @@ class VirtualBoxReflectionInfo:
         <xsl:text>
         },</xsl:text>
     </xsl:for-each>
-<xsl:text>
+    <!-- hack alert: force new output element to avoid large reallocations. -->
+    <xsl:text disable-output-escaping="yes"><![CDATA[
     }
 
-    __dValuesFlat = {</xsl:text>
+    __dValuesFlat = {]]></xsl:text>
     <xsl:for-each select="//enum">
         <xsl:variable name="ename">
             <xsl:value-of select="@name"/>
@@ -104,14 +106,16 @@ class VirtualBoxReflectionInfo:
             <xsl:value-of select="@value"/><xsl:text>,</xsl:text>
         </xsl:for-each>
     </xsl:for-each>
-    <xsl:text>
-        # Result constants:</xsl:text>
+    <!-- hack alert: force new output element to avoid large reallocations. -->
+    <xsl:text disable-output-escaping="yes"><![CDATA[
+        # Result constants:]]></xsl:text>
     <xsl:for-each select="//result[@value]">
         <xsl:text>
         '</xsl:text> <xsl:value-of select="@name"/> <xsl:text>': </xsl:text>
         <xsl:value-of select="@value"/><xsl:text>,</xsl:text>
     </xsl:for-each>
-<xsl:text>
+    <!-- hack alert: force new output element to avoid large reallocations. -->
+    <xsl:text>
     }
 
     __dValuesFlatSym = {</xsl:text>
diff --git a/src/VBox/Main/glue/glue-java.xsl b/src/VBox/Main/glue/glue-java.xsl
index b3b22a6..a119664 100644
--- a/src/VBox/Main/glue/glue-java.xsl
+++ b/src/VBox/Main/glue/glue-java.xsl
@@ -10,7 +10,7 @@
         XSLT stylesheet that generates Java glue code for XPCOM, MSCOM and JAX-WS from
         VirtualBox.xidl.
 
-    Copyright (C) 2010-2014 Oracle Corporation
+    Copyright (C) 2010-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -43,6 +43,18 @@
 
 <xsl:strip-space elements="*"/>
 
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  Keys for more efficiently looking up of types.
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
+
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
 <xsl:template name="fileheader">
   <xsl:param name="name" />
   <xsl:text>/*
@@ -106,7 +118,7 @@
       </xsl:choose>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:value-of select="concat('	', $G_vboxDirPrefix, $file, ' \
')"/>
+      <xsl:value-of select="concat(' \', $G_sNewLine, '	', $G_vboxDirPrefix, $file)"/>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
@@ -114,79 +126,68 @@
 <xsl:template name="endFile">
   <xsl:param name="file" />
   <xsl:if test="$filelistonly=''">
-    <xsl:value-of select="concat('
// ##### ENDFILE "', $file, '"

')" />
+    <xsl:value-of select="concat('
// ##### ENDFILE "', $file, '"
')" />
+    <xsl:call-template name="xsltprocNewlineOutputHack"/>
   </xsl:if>
 </xsl:template>
 
+<!-- strip-and-normalize-desc
+ Removes leading and trailing white space on each line in the given text.
+ -->
+<xsl:template name="strip-and-normalize-desc">
+  <xsl:param name="text"/>
+
+  <!-- Strip the whole string first so we won't leave trailing new line chars behind. -->
+  <xsl:variable name="sStrippedText">
+    <xsl:call-template name="strip-string">
+      <xsl:with-param name="text" select="$text"/>
+    </xsl:call-template>
+  </xsl:variable>
 
-<xsl:template name="string-replace">
-  <xsl:param name="haystack"/>
-  <xsl:param name="needle"/>
-  <xsl:param name="replacement"/>
-  <xsl:param name="onlyfirst" select="false"/>
   <xsl:choose>
-    <xsl:when test="contains($haystack, $needle)">
-      <xsl:value-of select="substring-before($haystack, $needle)"/>
-      <xsl:value-of select="$replacement"/>
-      <xsl:choose>
-        <xsl:when test="$onlyfirst = 'true'">
-          <xsl:value-of select="substring-after($haystack, $needle)"/>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:call-template name="string-replace">
-            <xsl:with-param name="haystack" select="substring-after($haystack, $needle)"/>
-            <xsl:with-param name="needle" select="$needle"/>
-            <xsl:with-param name="replacement" select="$replacement"/>
-          </xsl:call-template>
-        </xsl:otherwise>
-      </xsl:choose>
+    <!-- If there are multiple lines, strip them one by one on a recursive fasion. -->
+    <xsl:when test="contains($sStrippedText, '
')">
+      <xsl:call-template name="strip-string-right">
+        <xsl:with-param name="text" select="substring-before($sStrippedText, '
')"/>
+      </xsl:call-template>
+      <xsl:value-of select="'
'"/>
+      <xsl:call-template name="strip-and-normalize-desc-recursive">
+        <xsl:with-param name="text" select="substring-after($sStrippedText, '
')"/>
+      </xsl:call-template>
     </xsl:when>
+
+    <!-- Single line, we're done. -->
     <xsl:otherwise>
-      <xsl:value-of select="$haystack"/>
+      <xsl:value-of select="$sStrippedText"/>
     </xsl:otherwise>
   </xsl:choose>
+
 </xsl:template>
 
-<xsl:template name="string-trim">
+<!-- Internal worker for strip-and-normalize-desc, don't use. -->
+<xsl:template name="strip-and-normalize-desc-recursive">
   <xsl:param name="text"/>
 
-  <xsl:variable name="begin" select="substring($text, 1, 1)"/>
   <xsl:choose>
-    <xsl:when test="$begin = ' ' or $begin = '
' or $begin = '
'">
-      <xsl:call-template name="string-trim">
-        <xsl:with-param name="text" select="substring($text, 2)"/>
+    <!-- If there are multiple lines, strip them one by one on a recursive fasion. -->
+    <xsl:when test="contains($text, '
')">
+      <xsl:call-template name="strip-string">
+        <xsl:with-param name="text" select="substring-before($text, '
')"/>
+      </xsl:call-template>
+      <xsl:value-of select="'
'"/>
+      <xsl:call-template name="strip-and-normalize-desc-recursive">
+        <xsl:with-param name="text" select="substring-after($text, '
')"/>
       </xsl:call-template>
     </xsl:when>
+
+    <!-- Single line: Left strip it. -->
     <xsl:otherwise>
-      <xsl:variable name="end" select="substring($text, string-length($text) - 1, 1)"/>
-      <xsl:choose>
-        <xsl:when test="$end = ' ' or $end = '
' or $end = '
'">
-          <xsl:call-template name="string-trim">
-            <xsl:with-param name="text" select="substring($text, 1, string-length($text) - 1)"/>
-          </xsl:call-template>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:choose>
-            <xsl:when test="contains($text, '
 ')">
-              <xsl:variable name="tmptext">
-                <xsl:call-template name="string-replace">
-                  <xsl:with-param name="haystack" select="$text"/>
-                  <xsl:with-param name="needle" select="'
 '"/>
-                  <xsl:with-param name="replacement" select="'
'"/>
-                </xsl:call-template>
-              </xsl:variable>
-              <xsl:call-template name="string-trim">
-                <xsl:with-param name="text" select="$tmptext"/>
-              </xsl:call-template>
-            </xsl:when>
-            <xsl:otherwise>
-              <xsl:value-of select="$text"/>
-            </xsl:otherwise>
-          </xsl:choose>
-        </xsl:otherwise>
-      </xsl:choose>
+      <xsl:call-template name="strip-string-left">
+        <xsl:with-param name="text" select="$text"/>
+      </xsl:call-template>
     </xsl:otherwise>
   </xsl:choose>
+
 </xsl:template>
 
 <!-- descriptions -->
@@ -218,13 +219,36 @@
     </xsl:call-template>
   </xsl:variable>
 
+  <!-- &, < and > must remain as they are or javadoc 8 throws a fit. -->
   <xsl:variable name="rep4">
-    <xsl:call-template name="string-trim">
-      <xsl:with-param name="text" select="$rep3"/>
+    <xsl:call-template name="string-replace">
+      <xsl:with-param name="haystack" select="$rep3"/>
+      <xsl:with-param name="needle" select="'&'"/>
+      <xsl:with-param name="replacement" select="'&amp;'"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="rep5">
+    <xsl:call-template name="string-replace">
+      <xsl:with-param name="haystack" select="$rep4"/>
+      <xsl:with-param name="needle" select="'<'"/>
+      <xsl:with-param name="replacement" select="'&lt;'"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="rep6">
+    <xsl:call-template name="string-replace">
+      <xsl:with-param name="haystack" select="$rep5"/>
+      <xsl:with-param name="needle" select="'>'"/>
+      <xsl:with-param name="replacement" select="'&gt;'"/>
     </xsl:call-template>
   </xsl:variable>
 
-  <xsl:value-of select="$rep4"/>
+  <xsl:variable name="rep7">
+    <xsl:call-template name="strip-and-normalize-desc">
+      <xsl:with-param name="text" select="$rep6"/>
+    </xsl:call-template>
+  </xsl:variable>
+
+  <xsl:value-of select="$rep7"/>
 </xsl:template>
 
 <!--
@@ -233,7 +257,11 @@
 -->
 <xsl:template match="desc//*">
   <xsl:variable name="tagname" select="local-name()"/>
-  <xsl:value-of select="concat('<', $tagname, '>')"/>
+  <xsl:value-of select="concat('<', $tagname)"/>
+  <xsl:if test="$tagname = 'table'"> <!-- javadoc 8 fudge -->
+    <xsl:text> summary=""</xsl:text>
+  </xsl:if>
+  <xsl:text>></xsl:text>
   <xsl:apply-templates/>
   <xsl:value-of select="concat('</', $tagname, '>')"/>
 </xsl:template>
@@ -243,13 +271,13 @@
   <xsl:param name="identifier"/>
 
   <xsl:choose>
-    <xsl:when test="//enum[@name=$context]/const[@name=$identifier]">
+    <xsl:when test="key('G_keyEnumsByName', $context)/const[@name=$identifier]">
       <xsl:value-of select="$identifier"/>
     </xsl:when>
-    <xsl:when test="//interface[@name=$context]/method[@name=$identifier]">
+    <xsl:when test="key('G_keyInterfacesByName', $context)/method[@name=$identifier]">
       <xsl:value-of select="$identifier"/>
       <xsl:text>(</xsl:text>
-      <xsl:for-each select="//interface[@name=$context]/method[@name=$identifier]/param">
+      <xsl:for-each select="key('G_keyInterfacesByName', $context)/method[@name=$identifier]/param">
         <xsl:if test="@dir!='return'">
           <xsl:if test="position() > 1">
             <xsl:text>,</xsl:text>
@@ -270,7 +298,7 @@
       </xsl:for-each>
       <xsl:text>)</xsl:text>
     </xsl:when>
-    <xsl:when test="//interface[@name=$context]/attribute[@name=$identifier]">
+    <xsl:when test="key('G_keyInterfacesByName', $context)/attribute[@name=$identifier]">
       <xsl:call-template name="makeGetterName">
         <xsl:with-param name="attrname" select="$identifier" />
       </xsl:call-template>
@@ -295,11 +323,10 @@
 
 <xsl:template match="link" mode="middle">
   <xsl:variable name="linktext">
-    <xsl:call-template name="string-replace">
+    <xsl:call-template name="string-replace-first">
       <xsl:with-param name="haystack" select="@to"/>
       <xsl:with-param name="needle" select="'_'"/>
       <xsl:with-param name="replacement" select="'#'"/>
-      <xsl:with-param name="onlyfirst" select="'true'"/>
     </xsl:call-template>
   </xsl:variable>
   <xsl:choose>
@@ -389,11 +416,16 @@
  * common comment prologue (handles group IDs)
 -->
 <xsl:template match="desc" mode="begin">
+  <!-- TODO,XXX: This is a hot spot. The whole $id crap isn't working though,
+                 so it's been disabled to save precious time. -->
+<!--
   <xsl:param name="id" select="@group | preceding::descGroup[1]/@id"/>
   <xsl:text>
/**
</xsl:text>
   <xsl:if test="$id">
     <xsl:value-of select="concat(' @ingroup ', $id, '
')"/>
   </xsl:if>
+-->
+  <xsl:value-of select="concat($G_sNewLine, '/**', $G_sNewLine)"/>
 </xsl:template>
 
 <!--
@@ -411,7 +443,7 @@
 <xsl:template match="desc" mode="results">
   <xsl:if test="result">
     <xsl:text>
Expected result codes:
</xsl:text>
-    <xsl:text><table>
</xsl:text>
+    <xsl:text><table summary="">
</xsl:text>
     <xsl:for-each select="result">
       <xsl:text><tr></xsl:text>
       <xsl:choose>
@@ -425,28 +457,20 @@
       <xsl:text><td></xsl:text>
       <xsl:apply-templates select="text() | *[not(self::note or self::see or
                                                   self::result)]"/>
-      <xsl:text></td><tr>
</xsl:text>
+      <xsl:text></td></tr>
</xsl:text>
     </xsl:for-each>
     <xsl:text></table>
</xsl:text>
   </xsl:if>
 </xsl:template>
 
 <!--
- * translates the string to uppercase
--->
-<xsl:template name="uppercase">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="translate($str, $G_lowerCase, $G_upperCase)"/>
-</xsl:template>
-
-<!--
  * comment for interfaces
 -->
 <xsl:template match="desc" mode="interface">
   <xsl:apply-templates select="." mode="begin"/>
   <xsl:apply-templates select="." mode="middle"/>
-  <xsl:text>
Interface ID: <tt>{</xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:text>

Interface ID: <tt>{</xsl:text>
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="../@uuid"/>
   </xsl:call-template>
   <xsl:text>}</tt>
*/
</xsl:text>
@@ -464,6 +488,7 @@
   <xsl:call-template name="typeIdl2Glue">
     <xsl:with-param name="type" select="../@type"/>
     <xsl:with-param name="safearray" select="../@safearray"/>
+    <xsl:with-param name="doubleescape">yes</xsl:with-param>
   </xsl:call-template>
   <xsl:text>
</xsl:text>
   <xsl:apply-templates select="see"/>
@@ -482,6 +507,7 @@
   <xsl:call-template name="typeIdl2Glue">
     <xsl:with-param name="type" select="../@type"/>
     <xsl:with-param name="safearray" select="../@safearray"/>
+    <xsl:with-param name="doubleescape">yes</xsl:with-param>
   </xsl:call-template>
   <xsl:text>
</xsl:text>
   <xsl:apply-templates select="see"/>
@@ -531,7 +557,7 @@
   <xsl:apply-templates select="." mode="begin"/>
   <xsl:apply-templates select="." mode="middle"/>
   <xsl:text>
Interface ID: <tt>{</xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="../@uuid"/>
   </xsl:call-template>
   <xsl:text>}</tt>
*/
</xsl:text>
@@ -695,10 +721,10 @@
   <xsl:param name="collPrefix" />
 
   <xsl:choose>
-    <xsl:when test="//enum[@name=$name] or //enum[@name=$origname]">
+    <xsl:when test="(count(key('G_keyEnumsByName', $name)) > 0) or (count(key('G_keyEnumsByName', $origname)) > 0)">
       <xsl:value-of select="concat($G_virtualBoxPackage, concat('.', $name))" />
     </xsl:when>
-    <xsl:when test="//interface[@name=$name]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $name)) > 0">
       <xsl:value-of select="concat($G_virtualBoxPackage, concat('.', $name))" />
     </xsl:when>
     <xsl:otherwise>
@@ -714,6 +740,7 @@
   <xsl:param name="safearray" />
   <xsl:param name="forceelem" />
   <xsl:param name="skiplisttype" />
+  <xsl:param name="doubleescape" />
 
   <xsl:variable name="needarray" select="($safearray='yes') and not($forceelem='yes')" />
   <xsl:variable name="needlist" select="($needarray) and not($type='octet')" />
@@ -721,7 +748,14 @@
   <xsl:if test="($needlist)">
     <xsl:text>List</xsl:text>
     <xsl:if test="not($skiplisttype='yes')">
-      <xsl:text><</xsl:text>
+      <xsl:choose>
+        <xsl:when test="$doubleescape='yes'">
+          <xsl:text>&lt;</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:text><</xsl:text>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:if>
   </xsl:if>
 
@@ -747,7 +781,14 @@
   <xsl:choose>
     <xsl:when test="($needlist)">
       <xsl:if test="not($skiplisttype='yes')">
-        <xsl:text>></xsl:text>
+        <xsl:choose>
+          <xsl:when test="$doubleescape='yes'">
+            <xsl:text>&gt;</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>></xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:if>
     </xsl:when>
     <xsl:when test="($needarray)">
@@ -809,19 +850,19 @@
           <xsl:text>String</xsl:text>
         </xsl:when>
 
-        <xsl:when test="//interface[@name=$type]/@wsmap='struct'">
+        <xsl:when test="key('G_keyInterfacesByName', $type)/@wsmap='struct'">
           <xsl:call-template name="wrappedName">
             <xsl:with-param name="ifname" select="$type" />
           </xsl:call-template>
         </xsl:when>
 
-        <xsl:when test="//interface[@name=$type]">
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
           <xsl:call-template name="wrappedName">
             <xsl:with-param name="ifname" select="$type" />
           </xsl:call-template>
         </xsl:when>
 
-        <xsl:when test="//enum[@name=$type]">
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
           <xsl:text>long</xsl:text>
         </xsl:when>
 
@@ -852,15 +893,15 @@
           <xsl:text>String</xsl:text>
         </xsl:when>
 
-        <xsl:when test="//interface[@name=$type]/@wsmap='managed'">
+        <xsl:when test="key('G_keyInterfacesByName', $type)/@wsmap='managed'">
           <xsl:text>String</xsl:text>
         </xsl:when>
 
-        <xsl:when test="//interface[@name=$type]/@wsmap='struct'">
+        <xsl:when test="key('G_keyInterfacesByName', $type)/@wsmap='struct'">
           <xsl:value-of select="concat($G_virtualBoxPackageCom, '.', $type)" />
         </xsl:when>
 
-        <xsl:when test="//enum[@name=$type]">
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
           <xsl:value-of select="concat($G_virtualBoxPackageCom, '.', $type)" />
         </xsl:when>
 
@@ -928,7 +969,7 @@
   <xsl:param name="idltype"/>
   <xsl:param name="safearray"/>
   <xsl:variable name="isstruct"
-                select="//interface[@name=$idltype]/@wsmap='struct'" />
+                select="key('G_keyInterfacesByName', $idltype)/@wsmap='struct'" />
 
   <xsl:variable name="gluetype">
     <xsl:call-template name="typeIdl2Glue">
@@ -948,7 +989,7 @@
   </xsl:variable>
 
   <xsl:choose>
-    <xsl:when test="//interface[@name=$idltype] or $idltype='$unknown'">
+    <xsl:when test="$idltype = '$unknown' or (count(key('G_keyInterfacesByName', $idltype)) > 0)">
       <xsl:choose>
         <xsl:when test="$safearray='yes'">
           <xsl:variable name="elembacktype">
@@ -966,7 +1007,7 @@
       </xsl:choose>
     </xsl:when>
 
-    <xsl:when test="//enum[@name=$idltype]">
+    <xsl:when test="count(key('G_keyEnumsByName', $idltype)) > 0">
       <xsl:choose>
         <xsl:when test="$safearray='yes'">
           <xsl:variable name="elembacktype">
@@ -1031,11 +1072,11 @@
       </xsl:choose>
     </xsl:when>
 
-    <xsl:when test="//interface[@name=$idltype] or $idltype='$unknown'">
+    <xsl:when test="$idltype = '$unknown' or (count(key('G_keyInterfacesByName', $idltype)) > 0)">
       <xsl:value-of select="concat('Helper.wrapDispatch(', $gluetype, '.class, ', $value, '.getDispatch())')"/>
     </xsl:when>
 
-    <xsl:when test="//enum[@name=$idltype]">
+    <xsl:when test="count(key('G_keyEnumsByName', $idltype)) > 0">
       <xsl:value-of select="concat($gluetype, '.fromValue(', $value, '.getInt())')"/>
     </xsl:when>
 
@@ -1091,7 +1132,7 @@
   <xsl:param name="safearray"/>
 
   <xsl:variable name="isstruct"
-                select="//interface[@name=$idltype]/@wsmap='struct'" />
+                select="key('G_keyInterfacesByName', $idltype)/@wsmap='struct'" />
 
   <xsl:variable name="gluetype">
     <xsl:call-template name="typeIdl2Glue">
@@ -1120,10 +1161,10 @@
         <xsl:when test="$isstruct">
           <xsl:value-of select="concat('Helper.wrap2(', $elemgluetype, '.class, ', $elembacktype, '.class, port, ', $value, ')')"/>
         </xsl:when>
-        <xsl:when test="//enum[@name=$idltype]">
+        <xsl:when test="count(key('G_keyEnumsByName', $idltype)) > 0">
           <xsl:value-of select="concat('Helper.convertEnums(', $elembacktype, '.class, ', $elemgluetype, '.class, ', $value, ')')"/>
         </xsl:when>
-        <xsl:when test="//interface[@name=$idltype] or $idltype='$unknown'">
+        <xsl:when test="$idltype = '$unknown' or (count(key('G_keyInterfacesByName', $idltype)) > 0)">
           <xsl:value-of select="concat('Helper.wrap(', $elemgluetype, '.class, port, ', $value, ')')"/>
         </xsl:when>
         <xsl:when test="$idltype='octet'">
@@ -1137,7 +1178,7 @@
 
     <xsl:otherwise>
       <xsl:choose>
-        <xsl:when test="//enum[@name=$idltype]">
+        <xsl:when test="count(key('G_keyEnumsByName', $idltype)) > 0">
           <xsl:value-of select="concat($gluetype, '.fromValue(', $value, '.value())')"/>
         </xsl:when>
         <xsl:when test="$idltype='boolean'">
@@ -1170,7 +1211,7 @@
         <xsl:when test="$isstruct">
           <xsl:value-of select="concat('(', $value, ' != null) ? new ', $gluetype, '(', $value, ', port) : null')" />
         </xsl:when>
-        <xsl:when test="//interface[@name=$idltype] or $idltype='$unknown'">
+        <xsl:when test="$idltype = '$unknown' or (count(key('G_keyInterfacesByName', $idltype)) > 0)">
           <!-- if the MOR string is empty, that means NULL, so return NULL instead of an object then -->
           <xsl:value-of select="concat('(', $value, '.length() > 0) ? new ', $gluetype, '(', $value, ', port) : null')" />
         </xsl:when>
@@ -1224,7 +1265,7 @@
   <xsl:param name="idltype"/>
   <xsl:param name="safearray"/>
   <xsl:variable name="isstruct"
-                select="//interface[@name=$idltype]/@wsmap='struct'" />
+                select="key('G_keyInterfacesByName', $idltype)/@wsmap='struct'" />
   <xsl:variable name="gluetype">
     <xsl:call-template name="typeIdl2Glue">
       <xsl:with-param name="type" select="$idltype" />
@@ -1250,7 +1291,7 @@
   </xsl:variable>
 
   <xsl:choose>
-    <xsl:when test="//interface[@name=$idltype]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $idltype)) > 0">
       <xsl:choose>
         <xsl:when test="$safearray='yes'">
           <xsl:variable name="elembacktype">
@@ -1279,7 +1320,7 @@
       </xsl:choose>
     </xsl:when>
 
-    <xsl:when test="//enum[@name=$idltype]">
+    <xsl:when test="count(key('G_keyEnumsByName', $idltype)) > 0">
       <xsl:choose>
         <xsl:when test="$safearray='yes'">
           <xsl:value-of select="concat('Helper.unwrapEnum(', $elemgluetype, '.class, ', $value, ')')"/>
@@ -1356,7 +1397,7 @@
   </xsl:variable>
 
   <xsl:choose>
-    <xsl:when test="//interface[@name=$idltype]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $idltype)) > 0">
       <xsl:choose>
         <xsl:when test="$safearray='yes'">
           <xsl:variable name="elembacktype">
@@ -1388,7 +1429,7 @@
       </xsl:choose>
     </xsl:when>
 
-    <xsl:when test="//enum[@name=$idltype]">
+    <xsl:when test="count(key('G_keyEnumsByName', $idltype)) > 0">
       <xsl:choose>
         <xsl:when test="$safearray='yes'">
           <xsl:value-of select="concat('Helper.unwrapEnum(', $elemgluetype, '.class, ', $value, ')')"/>
@@ -1473,7 +1514,7 @@
   <xsl:param name="idltype"/>
   <xsl:param name="safearray"/>
   <xsl:variable name="isstruct"
-                select="//interface[@name=$idltype]/@wsmap='struct'" />
+                select="key('G_keyInterfacesByName', $idltype)/@wsmap='struct'" />
 
   <xsl:variable name="gluetype">
     <xsl:call-template name="typeIdl2Glue">
@@ -1493,7 +1534,7 @@
   </xsl:variable>
 
   <xsl:choose>
-    <xsl:when test="//interface[@name=$idltype] or $idltype='$unknown'">
+    <xsl:when test="$idltype = '$unknown' or (count(key('G_keyInterfacesByName', $idltype)) > 0)">
       <xsl:choose>
         <xsl:when test="@safearray='yes'">
           <xsl:value-of select="concat('Helper.unwrap(', $value, ')')"/>
@@ -1504,7 +1545,7 @@
       </xsl:choose>
     </xsl:when>
 
-    <xsl:when test="//enum[@name=$idltype]">
+    <xsl:when test="count(key('G_keyEnumsByName', $idltype)) > 0">
       <xsl:choose>
         <xsl:when test="$safearray='yes'">
           <xsl:variable name="elembacktype">
@@ -1661,7 +1702,7 @@
         </xsl:call-template>
       </xsl:variable>
       <xsl:variable name="portArg">
-        <xsl:if test="not(//interface[@name=$ifname]/@wsmap='global')">
+        <xsl:if test="not(key('G_keyInterfacesByName', $ifname)/@wsmap='global')">
           <xsl:text>obj</xsl:text>
         </xsl:if>
       </xsl:variable>
@@ -1903,9 +1944,14 @@
     </xsl:when>
     <xsl:otherwise>
       <xsl:variable name="hasReturnParms" select="param[@dir='return']" />
-      <xsl:variable name="hasOutParms" select="param[@dir='out']" />
+      <xsl:variable name="hasOutParms" select="count(param[@dir='out']) > 0" />
       <xsl:variable name="returnidltype" select="param[@dir='return']/@type" />
       <xsl:variable name="returnidlsafearray" select="param[@dir='return']/@safearray" />
+      <xsl:if test="$hasOutParms and not($hasReturnParms) and (string-length(@wsmap) = 0) and (count(param[@dir='out']) = 1)">
+        <xsl:call-template name="fatalError">
+          <xsl:with-param name="msg" select="concat('genMethod: ', $ifname, $hasOutParms, not($hasReturnParms), 'a', string-length(@wsmap) = 0, 'b', @wsmap, (count(param[@dir='out']) = 1), '::', $methodname, ' has exactly one out parameter and no return parameter, this causes trouble with JAX-WS and the out parameter needs to be converted to return')" />
+        </xsl:call-template>
+      </xsl:if>
       <xsl:variable name="returngluetype">
         <xsl:choose>
           <xsl:when test="$returnidltype">
@@ -2159,7 +2205,6 @@
     </xsl:when>
     <xsl:otherwise>
       <xsl:variable name="hasReturnParms" select="param[@dir='return']" />
-      <xsl:variable name="hasOutParms" select="param[@dir='out']" />
       <xsl:variable name="returnidltype" select="param[@dir='return']/@type" />
       <xsl:variable name="returnidlsafearray" select="param[@dir='return']/@safearray" />
       <xsl:variable name="returnbacktype">
@@ -2487,13 +2532,13 @@
       </xsl:when>
 
       <xsl:otherwise>
-        <xsl:variable name="extends" select="//interface[@name=$ifname]/@extends" />
+        <xsl:variable name="extends" select="key('G_keyInterfacesByName', $ifname)/@extends" />
         <xsl:choose>
           <xsl:when test="($extends = '$unknown') or ($extends = '$errorinfo')">
             <xsl:value-of select="concat('public class ', $ifname, ' extends IUnknown
')" />
             <xsl:text>{

</xsl:text>
           </xsl:when>
-          <xsl:when test="//interface[@name=$extends]">
+          <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
             <xsl:value-of select="concat('public class ', $ifname, ' extends ', $extends, '
')" />
             <xsl:text>{

</xsl:text>
           </xsl:when>
@@ -4663,7 +4708,7 @@ public class VirtualBoxManager
   </xsl:if>
 
   <xsl:if test="not($filelistonly='')">
-    <xsl:value-of select="concat($filelistonly, ' := \
')"/>
+    <xsl:value-of select="concat($filelistonly, ' :=')"/>
   </xsl:if>
 
   <!-- Handwritten files -->
@@ -4714,7 +4759,7 @@ public class VirtualBoxManager
 
       <xsl:otherwise>
         <!-- We don't need WSDL-specific interfaces here -->
-        <xsl:if test="not($self_target='wsdl') and not($module)">
+        <xsl:if test="not(@internal='yes') and not($self_target='wsdl') and not($module)">
           <xsl:call-template name="genIface">
             <xsl:with-param name="ifname" select="@name" />
             <xsl:with-param name="filename" select="concat(@name, '.java')" />
@@ -4726,7 +4771,7 @@ public class VirtualBoxManager
   </xsl:for-each>
 
   <xsl:if test="not($filelistonly='')">
-    <xsl:value-of select="'
'"/>
+    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>
   </xsl:if>
 
 </xsl:template>
diff --git a/src/VBox/Main/glue/initterm.cpp b/src/VBox/Main/glue/initterm.cpp
index dbc493c..989c2fb 100644
--- a/src/VBox/Main/glue/initterm.cpp
+++ b/src/VBox/Main/glue/initterm.cpp
@@ -325,7 +325,6 @@ HRESULT Initialize(bool fGui)
 
     /* this is the first initialization */
     gXPCOMInitCount = 1;
-    bool const fInitEventQueues = true;
 
     /* prepare paths for registry files */
     char szCompReg[RTPATH_MAX];
@@ -558,7 +557,7 @@ HRESULT Shutdown()
         }
         else
         {
-            isOnMainThread = PR_TRUE;
+            isOnMainThread = RTThreadIsMain(RTThreadSelf());
             rc = NS_OK;
         }
 
diff --git a/src/VBox/Main/glue/string.cpp b/src/VBox/Main/glue/string.cpp
index 7c7fac8..1c6f74d 100644
--- a/src/VBox/Main/glue/string.cpp
+++ b/src/VBox/Main/glue/string.cpp
@@ -134,16 +134,35 @@ Utf8Str& Utf8Str::stripPath()
     return *this;
 }
 
-Utf8Str& Utf8Str::stripExt()
+Utf8Str& Utf8Str::stripSuffix()
 {
     if (length())
     {
-        RTPathStripExt(m_psz);
+        RTPathStripSuffix(m_psz);
         jolt();
     }
     return *this;
 }
 
+size_t Utf8Str::parseKeyValue(Utf8Str &key, Utf8Str &value, size_t pos, const Utf8Str &pairSeparator, const Utf8Str &keyValueSeparator) const
+{
+    size_t start = pos;
+    while(start == (pos = find(pairSeparator.c_str(), pos)))
+        start = ++pos;
+
+    size_t kvSepPos = find(keyValueSeparator.c_str(), start);
+    if (kvSepPos < pos)
+    {
+        key = substr(start, kvSepPos - start);
+        value = substr(kvSepPos + 1, pos - kvSepPos - 1);
+    }
+    else
+    {
+        key = value = "";
+    }
+    return pos;
+}
+
 /**
  * Internal function used in Utf8Str copy constructors and assignment when
  * copying from a UTF-16 string.
@@ -159,15 +178,17 @@ Utf8Str& Utf8Str::stripExt()
  *
  * @param   a_pbstr         The source string.  The caller guarantees that this
  *                          is valid UTF-16.
+ * @param   a_cwcMax        The number of characters to be copied. If set to RTSTR_MAX,
+ *                          the entire string will be copied.
  *
  * @sa      RTCString::copyFromN
  */
-void Utf8Str::copyFrom(CBSTR a_pbstr)
+void Utf8Str::copyFrom(CBSTR a_pbstr, size_t a_cwcMax)
 {
     if (a_pbstr && *a_pbstr)
     {
         int vrc = RTUtf16ToUtf8Ex((PCRTUTF16)a_pbstr,
-                                  RTSTR_MAX,        // size_t cwcString: translate entire string
+                                  a_cwcMax,        // size_t cwcString: translate entire string
                                   &m_psz,           // char **ppsz: output buffer
                                   0,                // size_t cch: if 0, func allocates buffer in *ppsz
                                   &m_cch);          // size_t *pcch: receives the size of the output string, excluding the terminator.
diff --git a/src/VBox/Main/glue/tests/TestVBox.java b/src/VBox/Main/glue/tests/TestVBox.java
index ce82372..48b8446 100644
--- a/src/VBox/Main/glue/tests/TestVBox.java
+++ b/src/VBox/Main/glue/tests/TestVBox.java
@@ -4,7 +4,7 @@
  * be used to connect to the webservice and (XP)COM APIs. */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -14,7 +14,7 @@
  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
-import org.virtualbox_4_3.*;
+import org.virtualbox_5_0.*;
 import java.util.List;
 import java.util.Arrays;
 import java.math.BigInteger;
diff --git a/src/VBox/Main/glue/vboxapi.py b/src/VBox/Main/glue/vboxapi.py
index 8fdfd12..ce79dca 100644
--- a/src/VBox/Main/glue/vboxapi.py
+++ b/src/VBox/Main/glue/vboxapi.py
@@ -5,45 +5,113 @@ VirtualBox Python API Glue.
 """
 
 __copyright__ = \
-"""
-Copyright (C) 2009-2015 Oracle Corporation
-
-This file is part of VirtualBox Open Source Edition (OSE), as
-available from http://www.virtualbox.org. This file is free software;
-you can redistribute it and/or modify it under the terms of the GNU
-General Public License (GPL) as published by the Free Software
-Foundation, in version 2 as it comes in the "COPYING" file of the
-VirtualBox OSE distribution. VirtualBox OSE is distributed in the
-hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
-"""
-__version__ = "$Revision: 98155 $"
+    """
+    Copyright (C) 2009-2015 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+    """
+__version__ = "$Revision: 99962 $"
 
 
 # Note! To set Python bitness on OSX use 'export VERSIONER_PYTHON_PREFER_32_BIT=yes'
 
 
 # Standard Python imports.
-import sys, os
+import os
+import sys
 import traceback
 
 
+if sys.version_info >= (3, 0):
+    xrange = range
+    long = int
+    import builtins
+    print_ = getattr(builtins, 'print', None)
+elif sys.version_info >= (2, 6):
+    import __builtin__
+    print_ = getattr(__builtin__, 'print', None)
+else:
+    def print_(*args, **kwargs):
+        """The new-style print function for Python 2.4 and 2.5."""
+        fp = kwargs.pop("file", sys.stdout)
+        if fp is None:
+            return
+
+        def write(data):
+            if not isinstance(data, basestring):
+                data = str(data)
+            # If the file has an encoding, encode unicode with it.
+            if isinstance(fp, file) and isinstance(data, unicode) and fp.encoding is not None:
+                errors = getattr(fp, "errors", None)
+                if errors is None:
+                    errors = "strict"
+                data = data.encode(fp.encoding, errors)
+            fp.write(data)
+
+        want_unicode = False
+        sep = kwargs.pop("sep", None)
+        if sep is not None:
+            if isinstance(sep, unicode):
+                want_unicode = True
+            elif not isinstance(sep, str):
+                raise TypeError("sep must be None or a string")
+        end = kwargs.pop("end", None)
+        if end is not None:
+            if isinstance(end, unicode):
+                want_unicode = True
+            elif not isinstance(end, str):
+                raise TypeError("end must be None or a string")
+        if kwargs:
+            raise TypeError("invalid keyword arguments to print()")
+        if not want_unicode:
+            for arg in args:
+                if isinstance(arg, unicode):
+                    want_unicode = True
+                    break
+        if want_unicode:
+            newline = unicode("\n")
+            space = unicode(" ")
+        else:
+            newline = "\n"
+            space = " "
+        if sep is None:
+            sep = space
+        if end is None:
+            end = newline
+        for i, arg in enumerate(args):
+            if i:
+                write(sep)
+            write(arg)
+        write(end)
+
 #
 # Globals, environment and sys.path changes.
 #
+import platform;
 VBoxBinDir = os.environ.get("VBOX_PROGRAM_PATH", None)
 VBoxSdkDir = os.environ.get("VBOX_SDK_PATH", None)
 
 if VBoxBinDir is None:
-    # Will be set by the installer
-    VBoxBinDir = "%VBOX_INSTALL_PATH%"
+    if platform.system() == 'Darwin':
+        VBoxBinDir = '/Applications/VirtualBox.app/Contents/MacOS'
+    else: # Will be set by the installer
+        VBoxBinDir = "%VBOX_INSTALL_PATH%"
 else:
-    VBoxBinDir = os.path.abspath(VBoxBinDir);
+    VBoxBinDir = os.path.abspath(VBoxBinDir)
 
 if VBoxSdkDir is None:
-    # Will be set by the installer
-    VBoxSdkDir = "%VBOX_SDK_PATH%"
+    if platform.system() == 'Darwin':
+        VBoxSdkDir = '/Applications/VirtualBox.app/Contents/MacOS/sdk'
+    else: # Will be set by the installer
+        VBoxSdkDir = "%VBOX_SDK_PATH%"
 else:
-    VBoxSdkDir = os.path.abspath(VBoxSdkDir);
+    VBoxSdkDir = os.path.abspath(VBoxSdkDir)
 
 os.environ["VBOX_PROGRAM_PATH"] = VBoxBinDir
 os.environ["VBOX_SDK_PATH"] = VBoxSdkDir
@@ -53,7 +121,7 @@ sys.path.append(VBoxBinDir)
 #
 # Import the generated VirtualBox constants.
 #
-from VirtualBox_constants import VirtualBoxReflectionInfo
+from .VirtualBox_constants import VirtualBoxReflectionInfo
 
 
 class PerfCollector(object):
@@ -109,10 +177,10 @@ class PerfCollector(object):
         # parameters (see #3953) for MSCOM.
         if self.isMscom:
             (values, names, objects, names_out, objects_out, units, scales, sequence_numbers,
-                indices, lengths) = self.collector.queryMetricsData(names, objects)
+             indices, lengths) = self.collector.queryMetricsData(names, objects)
         else:
             (values, names_out, objects_out, units, scales, sequence_numbers,
-                indices, lengths) = self.collector.queryMetricsData(names, objects)
+             indices, lengths) = self.collector.queryMetricsData(names, objects)
         out = []
         for i in xrange(0, len(names_out)):
             scale = int(scales[i])
@@ -121,15 +189,17 @@ class PerfCollector(object):
             else:
                 fmt = '%d %s'
             out.append({
-                'name':str(names_out[i]),
-                'object':str(objects_out[i]),
-                'unit':str(units[i]),
-                'scale':scale,
-                'values':[int(values[j]) for j in xrange(int(indices[i]), int(indices[i])+int(lengths[i]))],
-                'values_as_string':'['+', '.join([fmt % (int(values[j])/scale, units[i]) for j in xrange(int(indices[i]), int(indices[i])+int(lengths[i]))])+']'
+                'name': str(names_out[i]),
+                'object': str(objects_out[i]),
+                'unit': str(units[i]),
+                'scale': scale,
+                'values': [int(values[j]) for j in xrange(int(indices[i]), int(indices[i]) + int(lengths[i]))],
+                'values_as_string': '[' + ', '.join([fmt % (int(values[j]) / scale, units[i]) for j in
+                                                     xrange(int(indices[i]), int(indices[i]) + int(lengths[i]))]) + ']'
             })
         return out
 
+
 #
 # Attribute hacks.
 #
@@ -144,19 +214,20 @@ _g_dCOMForward = {
     'setattr': None,
 }
 
+
 def _CustomGetAttr(self, sAttr):
     """ Our getattr replacement for DispatchBaseClass. """
     # Fastpath.
-    oRet = self.__class__.__dict__.get(sAttr);
-    if oRet != None:
-        return oRet;
+    oRet = self.__class__.__dict__.get(sAttr)
+    if oRet is not None:
+        return oRet
 
     # Try case-insensitivity workaround for class attributes (COM methods).
-    sAttrLower = sAttr.lower();
-    for sKey in self.__class__.__dict__.keys():
-        if sKey.lower() == sAttrLower:
-            self.__class__.__dict__[sAttr] = self.__class__.__dict__[sKey]
-            return getattr(self, sKey)
+    sAttrLower = sAttr.lower()
+    for k in self.__class__.__dict__.keys():
+        if k.lower() == sAttrLower:
+            setattr(self.__class__, sAttr, self.__class__.__dict__[k])
+            return getattr(self, k)
 
     # Slow path.
     try:
@@ -164,6 +235,7 @@ def _CustomGetAttr(self, sAttr):
     except AttributeError:
         return _g_dCOMForward['getattr'](self, sAttr)
 
+
 def _CustomSetAttr(self, sAttr, oValue):
     """ Our setattr replacement for DispatchBaseClass. """
     try:
@@ -172,20 +244,19 @@ def _CustomSetAttr(self, sAttr, oValue):
         return _g_dCOMForward['setattr'](self, sAttr, oValue)
 
 
-
 class PlatformBase(object):
     """
     Base class for the platform specific code.
     """
 
     def __init__(self, aoParams):
-        _ = aoParams;
+        _ = aoParams
 
     def getVirtualBox(self):
         """
         Gets a the IVirtualBox singleton.
         """
-        return None;
+        return None
 
     def getSessionObject(self, oIVBox):
         """
@@ -196,12 +267,12 @@ class PlatformBase(object):
 
         See also openMachineSession.
         """
-        _ = oIVBox;
-        return None;
+        _ = oIVBox
+        return None
 
     def getType(self):
         """ Returns the platform type (class name sans 'Platform'). """
-        return None;
+        return None
 
     def isRemote(self):
         """
@@ -217,21 +288,34 @@ class PlatformBase(object):
         This is for hiding platform specific differences in attributes
         returning arrays.
         """
-        _ = oInterface;
-        _ = sAttrib;
-        return None;
+        _ = oInterface
+        _ = sAttrib
+        return None
+
+    def setArray(self, oInterface, sAttrib, aoArray):
+        """
+        Sets the value (aoArray) of the array attribute 'sAttrib' in
+        interface 'oInterface'.
+
+        This is for hiding platform specific differences in attributes
+        setting arrays.
+        """
+        _ = oInterface
+        _ = sAttrib
+        _ = aoArray
+        return None
 
     def initPerThread(self):
         """
         Does backend specific initialization for the calling thread.
         """
-        return True;
+        return True
 
     def deinitPerThread(self):
         """
         Does backend specific uninitialization for the calling thread.
         """
-        return True;
+        return True
 
     def createListener(self, oImplClass, dArgs):
         """
@@ -249,10 +333,9 @@ class PlatformBase(object):
         shortcuts taken in the COM bridge code, which is not under our control.
         Use passive listeners for COM and web services.
         """
-        _ = oImplClass;
-        _ = dArgs;
-        raise Exception("No active listeners for this platform");
-        return None;
+        _ = oImplClass
+        _ = dArgs
+        raise Exception("No active listeners for this platform")
 
     def waitForEvents(self, cMsTimeout):
         """
@@ -269,8 +352,8 @@ class PlatformBase(object):
         Raises an exception if the calling thread is not the main thread (the one
         that initialized VirtualBoxManager) or if the time isn't an integer.
         """
-        _ = cMsTimeout;
-        return 2;
+        _ = cMsTimeout
+        return 2
 
     def interruptWaitEvents(self):
         """
@@ -279,13 +362,13 @@ class PlatformBase(object):
 
         Returns True on success, False on failure.
         """
-        return False;
+        return False
 
     def deinit(self):
         """
         Unitializes the platform specific backend.
         """
-        return None;
+        return None
 
     def queryInterface(self, oIUnknown, sClassName):
         """
@@ -294,7 +377,7 @@ class PlatformBase(object):
         oIUnknown is who to ask.
         sClassName is the name of the interface we're asking for.
         """
-        return None;
+        return None
 
     #
     # Error (exception) access methods.
@@ -304,13 +387,13 @@ class PlatformBase(object):
         """
         Returns the COM status code from the VBox API given exception.
         """
-        return None;
+        return None
 
     def xcptIsDeadInterface(self, oXcpt):
         """
         Returns True if the exception indicates that the interface is dead, False if not.
         """
-        return False;
+        return False
 
     def xcptIsEqual(self, oXcpt, hrStatus):
         """
@@ -323,17 +406,17 @@ class PlatformBase(object):
         Will not raise any exception as long as hrStatus and self are not bad.
         """
         try:
-            hrXcpt = self.xcptGetStatus(oXcpt);
+            hrXcpt = self.xcptGetStatus(oXcpt)
         except AttributeError:
-            return False;
+            return False
         if hrXcpt == hrStatus:
-            return True;
+            return True
 
         # Fudge for 32-bit signed int conversion.
-        if hrStatus > 0x7fffffff and hrStatus <= 0xffffffff and hrXcpt < 0:
+        if 0x7fffffff < hrStatus <= 0xffffffff and hrXcpt < 0:
             if (hrStatus - 0x100000000) == hrXcpt:
-                return True;
-        return False;
+                return True
+        return False
 
     def xcptGetMessage(self, oXcpt):
         """
@@ -341,19 +424,19 @@ class PlatformBase(object):
         Returns None to fall back on xcptToString.
         Raises exception if oXcpt isn't our kind of exception object.
         """
-        return None;
+        return None
 
     def xcptGetBaseXcpt(self):
         """
         Returns the base exception class.
         """
-        return None;
+        return None
 
     def xcptSetupConstants(self, oDst):
         """
         Copy/whatever all error constants onto oDst.
         """
-        return oDst;
+        return oDst
 
     @staticmethod
     def xcptCopyErrorConstants(oDst, oSrc):
@@ -362,11 +445,10 @@ class PlatformBase(object):
         """
         for sAttr in dir(oSrc):
             if sAttr[0].isupper() and (sAttr[1].isupper() or sAttr[1] == '_'):
-                oAttr = getattr(oSrc, sAttr);
+                oAttr = getattr(oSrc, sAttr)
                 if type(oAttr) is int:
-                    setattr(oDst, sAttr, oAttr);
-        return oDst;
-
+                    setattr(oDst, sAttr, oAttr)
+        return oDst
 
 
 class PlatformMSCOM(PlatformBase):
@@ -379,74 +461,14 @@ class PlatformMSCOM(PlatformBase):
     # @remarks Must be updated when the corresponding VirtualBox.xidl bits
     #          are changed.  Fortunately this isn't very often.
     # @{
-    VBOX_TLB_GUID  = '{D7569351-1750-46F0-936E-BD127D5BC264}'
-    VBOX_TLB_LCID  = 0
+    VBOX_TLB_GUID = '{D7569351-1750-46F0-936E-BD127D5BC264}'
+    VBOX_TLB_LCID = 0
     VBOX_TLB_MAJOR = 1
     VBOX_TLB_MINOR = 3
     ## @}
 
-
-    class ConstantFake(object):
-        """ Class to fake access to constants in style of foo.bar.boo """
-
-        def __init__(self, parent, name):
-            self.__dict__['_parent'] = parent
-            self.__dict__['_name'] = name
-            self.__dict__['_consts'] = {}
-            try:
-                self.__dict__['_depth']=parent.__dict__['_depth']+1
-            except:
-                self.__dict__['_depth']=0
-                if self.__dict__['_depth'] > 4:
-                    raise AttributeError
-
-        def __getattr__(self, attr):
-            import win32com
-            from win32com.client import constants
-
-            if attr.startswith("__"):
-                raise AttributeError
-
-            consts = self.__dict__['_consts']
-
-            fake = consts.get(attr, None)
-            if fake != None:
-               return fake
-            try:
-               name = self.__dict__['_name']
-               parent = self.__dict__['_parent']
-               while parent != None:
-                  if parent._name is not None:
-                    name = parent._name+'_'+name
-                  parent = parent._parent
-
-               if name is not None:
-                  name += "_" + attr
-               else:
-                  name = attr
-               return win32com.client.constants.__getattr__(name)
-            except AttributeError, e:
-               fake = PlatformMSCOM.ConstantFake(self, attr)
-               consts[attr] = fake
-               return fake
-
-
-    class InterfacesWrapper:
-            def __init__(self):
-                self.__dict__['_rootFake'] = PlatformMSCOM.ConstantFake(None, None)
-
-            def __getattr__(self, a):
-                import win32com
-                from win32com.client import constants
-                if a.startswith("__"):
-                    raise AttributeError
-                try:
-                    return win32com.client.constants.__getattr__(a)
-                except AttributeError, e:
-                    return self.__dict__['_rootFake'].__getattr__(a)
-
     def __init__(self, dParams):
-        PlatformBase.__init__(self, dParams);
+        PlatformBase.__init__(self, dParams)
 
         #
         # Since the code runs on all platforms, we have to do a lot of
@@ -463,9 +485,9 @@ class PlatformMSCOM(PlatformBase):
         from win32api import GetCurrentThread, GetCurrentThreadId, DuplicateHandle, GetCurrentProcess
         import threading
 
-        self.winerror = winerror;
+        self.winerror = winerror
 
-        pid      = GetCurrentProcess()
+        pid = GetCurrentProcess()
         self.tid = GetCurrentThreadId()
         handle = DuplicateHandle(pid, GetCurrentThread(), pid, 0, 0, DUPLICATE_SAME_ACCESS)
         self.handles = []
@@ -475,9 +497,9 @@ class PlatformMSCOM(PlatformBase):
         # attribute names to match those in xpcom.
         if _g_dCOMForward['setattr'] is None:
             _g_dCOMForward['getattr'] = DispatchBaseClass.__dict__['__getattr__']
-            DispatchBaseClass.__dict__['__getattr__'] = _CustomGetAttr
             _g_dCOMForward['setattr'] = DispatchBaseClass.__dict__['__setattr__']
-            DispatchBaseClass.__dict__['__setattr__'] = _CustomSetAttr
+            setattr(DispatchBaseClass, '__getattr__', _CustomGetAttr)
+            setattr(DispatchBaseClass, '__setattr__', _CustomSetAttr)
 
         # Hack the exception base class so the users doesn't need to check for
         # XPCOM or COM and do different things.
@@ -487,14 +509,14 @@ class PlatformMSCOM(PlatformBase):
         # Make sure the gencache is correct (we don't quite follow the COM
         # versioning rules).
         #
-        self.flushGenPyCache(win32com.client.gencache);
-        win32com.client.gencache.EnsureDispatch('VirtualBox.Session');
-        win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox');
+        self.flushGenPyCache(win32com.client.gencache)
+        win32com.client.gencache.EnsureDispatch('VirtualBox.Session')
+        win32com.client.gencache.EnsureDispatch('VirtualBox.VirtualBox')
 
         self.oIntCv = threading.Condition()
-        self.fInterrupted = False;
+        self.fInterrupted = False
 
-        _ = dParams;
+        _ = dParams
 
     def flushGenPyCache(self, oGenCache):
         """
@@ -510,19 +532,19 @@ class PlatformMSCOM(PlatformBase):
         # version or the result of runnig makepy or gencache manually, but we
         # need to cover it as well.)
         #
-        sName    = oGenCache.GetGeneratedFileName(self.VBOX_TLB_GUID, self.VBOX_TLB_LCID,
-                                                  self.VBOX_TLB_MAJOR, self.VBOX_TLB_MINOR);
-        sGenPath = oGenCache.GetGeneratePath();
+        sName = oGenCache.GetGeneratedFileName(self.VBOX_TLB_GUID, self.VBOX_TLB_LCID,
+                                               self.VBOX_TLB_MAJOR, self.VBOX_TLB_MINOR)
+        sGenPath = oGenCache.GetGeneratePath()
         if len(sName) > 36 and len(sGenPath) > 5:
-            sTypelibPath = os.path.join(sGenPath, sName);
+            sTypelibPath = os.path.join(sGenPath, sName)
             if os.path.isdir(sTypelibPath):
-                import shutil;
-                shutil.rmtree(sTypelibPath, ignore_errors = True);
+                import shutil
+                shutil.rmtree(sTypelibPath, ignore_errors=True)
 
         #
         # Ensure that our typelib is valid.
         #
-        return oGenCache.EnsureModule(self.VBOX_TLB_GUID, self.VBOX_TLB_LCID, self.VBOX_TLB_MAJOR, self.VBOX_TLB_MINOR);
+        return oGenCache.EnsureModule(self.VBOX_TLB_GUID, self.VBOX_TLB_LCID, self.VBOX_TLB_MAJOR, self.VBOX_TLB_MINOR)
 
     def getSessionObject(self, oIVBox):
         _ = oIVBox
@@ -541,6 +563,9 @@ class PlatformMSCOM(PlatformBase):
     def getArray(self, oInterface, sAttrib):
         return oInterface.__getattr__(sAttrib)
 
+    def setArray(self, oInterface, sAttrib, aoArray):
+        return oInterface.__setattr__(sAttrib, aoArray)
+
     def initPerThread(self):
         import pythoncom
         pythoncom.CoInitializeEx(0)
@@ -553,44 +578,44 @@ class PlatformMSCOM(PlatformBase):
         if True:
             raise Exception('no active listeners on Windows as PyGatewayBase::QueryInterface() '
                             'returns new gateway objects all the time, thus breaking EventQueue '
-                            'assumptions about the listener interface pointer being constants between calls ');
+                            'assumptions about the listener interface pointer being constants between calls ')
         # Did this code ever really work?
         d = {}
         d['BaseClass'] = oImplClass
-        d['dArgs']     = dArgs
-        d['tlb_guid']  = PlatformMSCOM.VBOX_TLB_GUID
+        d['dArgs'] = dArgs
+        d['tlb_guid'] = PlatformMSCOM.VBOX_TLB_GUID
         d['tlb_major'] = PlatformMSCOM.VBOX_TLB_MAJOR
         d['tlb_minor'] = PlatformMSCOM.VBOX_TLB_MINOR
-        str = ""
-        str += "import win32com.server.util\n"
-        str += "import pythoncom\n"
-
-        str += "class ListenerImpl(BaseClass):\n"
-        str += "   _com_interfaces_ = ['IEventListener']\n"
-        str += "   _typelib_guid_ = tlb_guid\n"
-        str += "   _typelib_version_ = tlb_major, tlb_minor\n"
-        str += "   _reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER\n"
+        str_ = ""
+        str_ += "import win32com.server.util\n"
+        str_ += "import pythoncom\n"
+
+        str_ += "class ListenerImpl(BaseClass):\n"
+        str_ += "   _com_interfaces_ = ['IEventListener']\n"
+        str_ += "   _typelib_guid_ = tlb_guid\n"
+        str_ += "   _typelib_version_ = tlb_major, tlb_minor\n"
+        str_ += "   _reg_clsctx_ = pythoncom.CLSCTX_INPROC_SERVER\n"
         # Maybe we'd better implement Dynamic invoke policy, to be more flexible here
-        str += "   _reg_policy_spec_ = 'win32com.server.policy.EventHandlerPolicy'\n"
+        str_ += "   _reg_policy_spec_ = 'win32com.server.policy.EventHandlerPolicy'\n"
 
         # capitalized version of listener method
-        str += "   HandleEvent=BaseClass.handleEvent\n"
-        str += "   def __init__(self): BaseClass.__init__(self, dArgs)\n"
-        str += "result = win32com.server.util.wrap(ListenerImpl())\n"
-        exec(str, d, d)
+        str_ += "   HandleEvent=BaseClass.handleEvent\n"
+        str_ += "   def __init__(self): BaseClass.__init__(self, dArgs)\n"
+        str_ += "result = win32com.server.util.wrap(ListenerImpl())\n"
+        exec(str_, d, d)
         return d['result']
 
     def waitForEvents(self, timeout):
         from win32api import GetCurrentThreadId
         from win32event import INFINITE
         from win32event import MsgWaitForMultipleObjects, \
-                               QS_ALLINPUT, WAIT_TIMEOUT, WAIT_OBJECT_0
+            QS_ALLINPUT, WAIT_TIMEOUT, WAIT_OBJECT_0
         from pythoncom import PumpWaitingMessages
         import types
 
-        if not isinstance(timeout, types.IntType):
+        if not isinstance(timeout, int):
             raise TypeError("The timeout argument is not an integer")
-        if (self.tid != GetCurrentThreadId()):
+        if self.tid != GetCurrentThreadId():
             raise Exception("wait for events from the same thread you inited!")
 
         if timeout < 0:
@@ -598,25 +623,25 @@ class PlatformMSCOM(PlatformBase):
         else:
             cMsTimeout = timeout
         rc = MsgWaitForMultipleObjects(self.handles, 0, cMsTimeout, QS_ALLINPUT)
-        if rc >= WAIT_OBJECT_0 and rc < WAIT_OBJECT_0+len(self.handles):
+        if WAIT_OBJECT_0 <= rc < WAIT_OBJECT_0 + len(self.handles):
             # is it possible?
-            rc = 2;
-        elif rc==WAIT_OBJECT_0 + len(self.handles):
+            rc = 2
+        elif rc == WAIT_OBJECT_0 + len(self.handles):
             # Waiting messages
             PumpWaitingMessages()
-            rc = 0;
+            rc = 0
         else:
             # Timeout
-            rc = 1;
+            rc = 1
 
         # check for interruption
         self.oIntCv.acquire()
         if self.fInterrupted:
             self.fInterrupted = False
-            rc = 1;
+            rc = 1
         self.oIntCv.release()
 
-        return rc;
+        return rc
 
     def interruptWaitEvents(self):
         """
@@ -630,22 +655,23 @@ class PlatformMSCOM(PlatformBase):
         """
         from win32api import PostThreadMessage
         from win32con import WM_USER
+
         self.oIntCv.acquire()
         self.fInterrupted = True
         self.oIntCv.release()
         try:
             PostThreadMessage(self.tid, WM_USER, None, 0xf241b819)
         except:
-            return False;
-        return True;
+            return False
+        return True
 
     def deinit(self):
         import pythoncom
         from win32file import CloseHandle
 
         for h in self.handles:
-           if h is not None:
-              CloseHandle(h)
+            if h is not None:
+                CloseHandle(h)
         self.handles = None
         pythoncom.CoUninitialize()
         pass
@@ -659,57 +685,60 @@ class PlatformMSCOM(PlatformBase):
         # empirical info on it so far.
         hrXcpt = oXcpt.hresult
         if hrXcpt == self.winerror.DISP_E_EXCEPTION:
-            try:    hrXcpt = oXcpt.excepinfo[5];
-            except: pass;
-        return hrXcpt;
+            try:
+                hrXcpt = oXcpt.excepinfo[5]
+            except:
+                pass
+        return hrXcpt
 
     def xcptIsDeadInterface(self, oXcpt):
         return self.xcptGetStatus(oXcpt) in [
-            0x800706ba, -2147023174, # RPC_S_SERVER_UNAVAILABLE.
-            0x800706be, -2147023170, # RPC_S_CALL_FAILED.
-            0x800706bf, -2147023169, # RPC_S_CALL_FAILED_DNE.
-            0x80010108, -2147417848, # RPC_E_DISCONNECTED.
-            0x800706b5, -2147023179, # RPC_S_UNKNOWN_IF
-        ];
-
+            0x800706ba, -2147023174,  # RPC_S_SERVER_UNAVAILABLE.
+            0x800706be, -2147023170,  # RPC_S_CALL_FAILED.
+            0x800706bf, -2147023169,  # RPC_S_CALL_FAILED_DNE.
+            0x80010108, -2147417848,  # RPC_E_DISCONNECTED.
+            0x800706b5, -2147023179,  # RPC_S_UNKNOWN_IF
+        ]
 
     def xcptGetMessage(self, oXcpt):
         if hasattr(oXcpt, 'excepinfo'):
             try:
                 if len(oXcpt.excepinfo) >= 3:
-                    sRet = oXcpt.excepinfo[2];
+                    sRet = oXcpt.excepinfo[2]
                     if len(sRet) > 0:
-                        return sRet[0:];
+                        return sRet[0:]
             except:
-                pass;
+                pass
         if hasattr(oXcpt, 'strerror'):
             try:
-                sRet = oXcpt.strerror;
+                sRet = oXcpt.strerror
                 if len(sRet) > 0:
-                    return sRet;
+                    return sRet
             except:
-                pass;
-        return None;
+                pass
+        return None
 
     def xcptGetBaseXcpt(self):
-        import pythoncom;
-        return pythoncom.com_error;
+        import pythoncom
+
+        return pythoncom.com_error
 
     def xcptSetupConstants(self, oDst):
-        import winerror;
-        oDst = self.xcptCopyErrorConstants(oDst, winerror);
+        import winerror
+
+        oDst = self.xcptCopyErrorConstants(oDst, winerror)
 
         # XPCOM compatability constants.
-        oDst.NS_OK                    = oDst.S_OK;
-        oDst.NS_ERROR_FAILURE         = oDst.E_FAIL;
-        oDst.NS_ERROR_ABORT           = oDst.E_ABORT;
-        oDst.NS_ERROR_NULL_POINTER    = oDst.E_POINTER;
-        oDst.NS_ERROR_NO_INTERFACE    = oDst.E_NOINTERFACE;
-        oDst.NS_ERROR_INVALID_ARG     = oDst.E_INVALIDARG;
-        oDst.NS_ERROR_OUT_OF_MEMORY   = oDst.E_OUTOFMEMORY;
-        oDst.NS_ERROR_NOT_IMPLEMENTED = oDst.E_NOTIMPL;
-        oDst.NS_ERROR_UNEXPECTED      = oDst.E_UNEXPECTED;
-        return oDst;
+        oDst.NS_OK = oDst.S_OK
+        oDst.NS_ERROR_FAILURE = oDst.E_FAIL
+        oDst.NS_ERROR_ABORT = oDst.E_ABORT
+        oDst.NS_ERROR_NULL_POINTER = oDst.E_POINTER
+        oDst.NS_ERROR_NO_INTERFACE = oDst.E_NOINTERFACE
+        oDst.NS_ERROR_INVALID_ARG = oDst.E_INVALIDARG
+        oDst.NS_ERROR_OUT_OF_MEMORY = oDst.E_OUTOFMEMORY
+        oDst.NS_ERROR_NOT_IMPLEMENTED = oDst.E_NOTIMPL
+        oDst.NS_ERROR_UNEXPECTED = oDst.E_UNEXPECTED
+        return oDst
 
 
 class PlatformXPCOM(PlatformBase):
@@ -718,15 +747,15 @@ class PlatformXPCOM(PlatformBase):
     """
 
     def __init__(self, dParams):
-        PlatformBase.__init__(self, dParams);
-        sys.path.append(VBoxSdkDir+'/bindings/xpcom/python/')
+        PlatformBase.__init__(self, dParams)
+        sys.path.append(VBoxSdkDir + '/bindings/xpcom/python/')
         import xpcom.vboxxpcom
         import xpcom
         import xpcom.components
-        _ = dParams;
+        _ = dParams
 
     def getSessionObject(self, oIVBox):
-        _ = oIVBox;
+        _ = oIVBox
         import xpcom.components
         return xpcom.components.classes["@virtualbox.org/Session;1"].createInstance()
 
@@ -738,7 +767,10 @@ class PlatformXPCOM(PlatformBase):
         return 'XPCOM'
 
     def getArray(self, oInterface, sAttrib):
-        return oInterface.__getattr__('get'+ComifyName(sAttrib))()
+        return oInterface.__getattr__('get' + ComifyName(sAttrib))()
+
+    def setArray(self, oInterface, sAttrib, aoArray):
+        return oInterface.__getattr__('set' + ComifyName(sAttrib))(aoArray)
 
     def initPerThread(self):
         import xpcom
@@ -751,14 +783,14 @@ class PlatformXPCOM(PlatformBase):
     def createListener(self, oImplClass, dArgs):
         d = {}
         d['BaseClass'] = oImplClass
-        d['dArgs']     = dArgs
+        d['dArgs'] = dArgs
         str = ""
         str += "import xpcom.components\n"
         str += "class ListenerImpl(BaseClass):\n"
         str += "   _com_interfaces_ = xpcom.components.interfaces.IEventListener\n"
         str += "   def __init__(self): BaseClass.__init__(self, dArgs)\n"
         str += "result = ListenerImpl()\n"
-        exec (str, d, d)
+        exec(str, d, d)
         return d['result']
 
     def waitForEvents(self, timeout):
@@ -778,45 +810,45 @@ class PlatformXPCOM(PlatformBase):
         return oIUnknown.queryInterface(getattr(xpcom.components.interfaces, sClassName))
 
     def xcptGetStatus(self, oXcpt):
-        return oXcpt.errno;
+        return oXcpt.errno
 
     def xcptIsDeadInterface(self, oXcpt):
         return self.xcptGetStatus(oXcpt) in [
-            0x80004004, -2147467260, # NS_ERROR_ABORT
-            0x800706be, -2147023170, # NS_ERROR_CALL_FAILED (RPC_S_CALL_FAILED)
-        ];
+            0x80004004, -2147467260,  # NS_ERROR_ABORT
+            0x800706be, -2147023170,  # NS_ERROR_CALL_FAILED (RPC_S_CALL_FAILED)
+        ]
 
     def xcptGetMessage(self, oXcpt):
         if hasattr(oXcpt, 'msg'):
             try:
-                sRet = oXcpt.msg;
+                sRet = oXcpt.msg
                 if len(sRet) > 0:
-                    return sRet;
+                    return sRet
             except:
-                pass;
-        return None;
+                pass
+        return None
 
     def xcptGetBaseXcpt(self):
-        import xpcom;
-        return xpcom.Exception;
+        import xpcom
+        return xpcom.Exception
 
     def xcptSetupConstants(self, oDst):
-        import xpcom;
-        oDst = self.xcptCopyErrorConstants(oDst, xpcom.nsError);
+        import xpcom
+        oDst = self.xcptCopyErrorConstants(oDst, xpcom.nsError)
 
         # COM compatability constants.
-        oDst.E_ACCESSDENIED           = -2147024891; # see VBox/com/defs.h
-        oDst.S_OK                     = oDst.NS_OK;
-        oDst.E_FAIL                   = oDst.NS_ERROR_FAILURE;
-        oDst.E_ABORT                  = oDst.NS_ERROR_ABORT;
-        oDst.E_POINTER                = oDst.NS_ERROR_NULL_POINTER;
-        oDst.E_NOINTERFACE            = oDst.NS_ERROR_NO_INTERFACE;
-        oDst.E_INVALIDARG             = oDst.NS_ERROR_INVALID_ARG;
-        oDst.E_OUTOFMEMORY            = oDst.NS_ERROR_OUT_OF_MEMORY;
-        oDst.E_NOTIMPL                = oDst.NS_ERROR_NOT_IMPLEMENTED;
-        oDst.E_UNEXPECTED             = oDst.NS_ERROR_UNEXPECTED;
-        oDst.DISP_E_EXCEPTION         = -2147352567; # For COM compatability only.
-        return oDst;
+        oDst.E_ACCESSDENIED = -2147024891  # see VBox/com/defs.h
+        oDst.S_OK = oDst.NS_OK
+        oDst.E_FAIL = oDst.NS_ERROR_FAILURE
+        oDst.E_ABORT = oDst.NS_ERROR_ABORT
+        oDst.E_POINTER = oDst.NS_ERROR_NULL_POINTER
+        oDst.E_NOINTERFACE = oDst.NS_ERROR_NO_INTERFACE
+        oDst.E_INVALIDARG = oDst.NS_ERROR_INVALID_ARG
+        oDst.E_OUTOFMEMORY = oDst.NS_ERROR_OUT_OF_MEMORY
+        oDst.E_NOTIMPL = oDst.NS_ERROR_NOT_IMPLEMENTED
+        oDst.E_UNEXPECTED = oDst.NS_ERROR_UNEXPECTED
+        oDst.DISP_E_EXCEPTION = -2147352567  # For COM compatability only.
+        return oDst
 
 
 class PlatformWEBSERVICE(PlatformBase):
@@ -825,25 +857,25 @@ class PlatformWEBSERVICE(PlatformBase):
     """
 
     def __init__(self, dParams):
-        PlatformBase.__init__(self, dParams);
+        PlatformBase.__init__(self, dParams)
         # Import web services stuff.  Fix the sys.path the first time.
-        sWebServLib = os.path.join(VBoxSdkDir, 'bindings', 'webservice', 'python', 'lib');
+        sWebServLib = os.path.join(VBoxSdkDir, 'bindings', 'webservice', 'python', 'lib')
         if sWebServLib not in sys.path:
-            sys.path.append(sWebServLib);
+            sys.path.append(sWebServLib)
         import VirtualBox_wrappers
         from VirtualBox_wrappers import IWebsessionManager2
 
         # Initialize instance variables from parameters.
         if dParams is not None:
-            self.user     = dParams.get("user", "")
+            self.user = dParams.get("user", "")
             self.password = dParams.get("password", "")
-            self.url      = dParams.get("url", "")
+            self.url = dParams.get("url", "")
         else:
-            self.user     = ""
+            self.user = ""
             self.password = ""
-            self.url      = None
-        self.vbox  = None
-        self.wsmgr = None;
+            self.url = None
+        self.vbox = None
+        self.wsmgr = None
 
     #
     # Base class overrides.
@@ -865,13 +897,16 @@ class PlatformWEBSERVICE(PlatformBase):
     def getArray(self, oInterface, sAttrib):
         return oInterface.__getattr__(sAttrib)
 
+    def setArray(self, oInterface, sAttrib, aoArray):
+        return oInterface.__setattr__(sAttrib, aoArray)
+
     def waitForEvents(self, timeout):
         # Webservices cannot do that yet
-        return 2;
+        return 2
 
     def interruptWaitEvents(self, timeout):
         # Webservices cannot do that yet
-        return False;
+        return False
 
     def deinit(self):
         try:
@@ -883,10 +918,10 @@ class PlatformWEBSERVICE(PlatformBase):
         d = {}
         d['oIUnknown'] = oIUnknown
         str = ""
-        str += "from VirtualBox_wrappers import "+sClassName+"\n"
-        str += "result = "+sClassName+"(oIUnknown.mgr, oIUnknown.handle)\n"
+        str += "from VirtualBox_wrappers import " + sClassName + "\n"
+        str += "result = " + sClassName + "(oIUnknown.mgr, oIUnknown.handle)\n"
         # wrong, need to test if class indeed implements this interface
-        exec (str, d, d)
+        exec(str, d, d)
         return d['result']
 
     #
@@ -895,8 +930,9 @@ class PlatformWEBSERVICE(PlatformBase):
 
     def connect(self, url, user, passwd):
         if self.vbox is not None:
-             self.disconnect()
+            self.disconnect()
         from VirtualBox_wrappers import IWebsessionManager2
+
         if url is None:
             url = ""
         self.url = url
@@ -909,13 +945,13 @@ class PlatformWEBSERVICE(PlatformBase):
         self.wsmgr = IWebsessionManager2(self.url)
         self.vbox = self.wsmgr.logon(self.user, self.password)
         if not self.vbox.handle:
-            raise Exception("cannot connect to '"+self.url+"' as '"+self.user+"'")
+            raise Exception("cannot connect to '" + self.url + "' as '" + self.user + "'")
         return self.vbox
 
     def disconnect(self):
         if self.vbox is not None and self.wsmgr is not None:
             self.wsmgr.logoff(self.vbox)
-            self.vbox  = None
+            self.vbox = None
             self.wsmgr = None
 
 
@@ -925,7 +961,7 @@ class PlatformWEBSERVICE(PlatformBase):
 # was used.  Most clients does talk to multiple VBox instance on different
 # platforms at the same time, so this should be sufficent for most uses and
 # be way simpler to use than VirtualBoxManager::oXcptClass.
-CurXctpClass = None;
+CurXctpClass = None
 
 
 class VirtualBoxManager(object):
@@ -943,48 +979,49 @@ class VirtualBoxManager(object):
 
     class Statuses(object):
         def __init__(self):
-            pass;
+            pass
 
-    def __init__(self, sStyle = None, dPlatformParams = None):
+    def __init__(self, sStyle=None, dPlatformParams=None):
         if sStyle is None:
             if sys.platform == 'win32':
                 sStyle = "MSCOM"
             else:
                 sStyle = "XPCOM"
         if sStyle == 'XPCOM':
-            self.platform = PlatformXPCOM(dPlatformParams);
+            self.platform = PlatformXPCOM(dPlatformParams)
         elif sStyle == 'MSCOM':
-            self.platform = PlatformMSCOM(dPlatformParams);
+            self.platform = PlatformMSCOM(dPlatformParams)
         elif sStyle == 'WEBSERVICE':
-            self.platform = PlatformWEBSERVICE(dPlatformParams);
+            self.platform = PlatformWEBSERVICE(dPlatformParams)
         else:
-            raise Exception('Unknown sStyle=%s' % (sStyle,));
-        self.style     = sStyle
-        self.type      = self.platform.getType()
-        self.remote    = self.platform.isRemote()
+            raise Exception('Unknown sStyle=%s' % (sStyle,))
+        self.style = sStyle
+        self.type = self.platform.getType()
+        self.remote = self.platform.isRemote()
         ## VirtualBox API constants (for webservices, enums are symbolic).
         self.constants = VirtualBoxReflectionInfo(sStyle == "WEBSERVICE")
 
         ## Status constants.
-        self.statuses  = self.platform.xcptSetupConstants(VirtualBoxManager.Statuses());
+        self.statuses = self.platform.xcptSetupConstants(VirtualBoxManager.Statuses())
         ## @todo Add VBOX_E_XXX to statuses? They're already in constants...
         ## Dictionary for errToString, built on demand.
-        self._dErrorValToName = None;
+        self._dErrorValToName = None
 
         ## The exception class for the selected platform.
-        self.oXcptClass = self.platform.xcptGetBaseXcpt();
-        global CurXcptClass;
-        CurXcptClass = self.oXcptClass;
+        self.oXcptClass = self.platform.xcptGetBaseXcpt()
+        global CurXcptClass
+        CurXcptClass = self.oXcptClass
 
         # Get the virtualbox singleton.
         try:
             self.vbox = self.platform.getVirtualBox()
-        except NameError, ne:
-            print "Installation problem: check that appropriate libs in place"
+        except NameError:
+            print_("Installation problem: check that appropriate libs in place")
             traceback.print_exc()
-            raise ne
-        except Exception, e:
-            print "init exception: ", e
+            raise
+        except Exception:
+            _, e, _ = sys.exc_info()
+            print_("init exception: ", e)
             traceback.print_exc()
             if self.remote:
                 self.vbox = None
@@ -999,7 +1036,7 @@ class VirtualBoxManager(object):
         Returns a Python API revision number.
         This will be incremented when features are added to this file.
         """
-        return 3;
+        return 3
 
     @property
     def mgr(self):
@@ -1012,20 +1049,23 @@ class VirtualBoxManager(object):
     #
     # Wrappers for self.platform methods.
     #
-
     def getVirtualBox(self):
         """ See PlatformBase::getVirtualBox(). """
         return self.platform.getVirtualBox()
 
     def getSessionObject(self, oIVBox):
         """ See PlatformBase::getSessionObject(). """
-        return self.platform.getSessionObject(oIVBox);
+        return self.platform.getSessionObject(oIVBox)
 
     def getArray(self, oInterface, sAttrib):
         """ See PlatformBase::getArray(). """
         return self.platform.getArray(oInterface, sAttrib)
 
-    def createListener(self, oImplClass, dArgs = None):
+    def setArray(self, oInterface, sAttrib, aoArray):
+        """ See PlatformBase::setArray(). """
+        return self.platform.setArray(oInterface, sAttrib, aoArray)
+
+    def createListener(self, oImplClass, dArgs=None):
         """ See PlatformBase::createListener(). """
         return self.platform.createListener(oImplClass, dArgs)
 
@@ -1041,11 +1081,9 @@ class VirtualBoxManager(object):
         """ See PlatformBase::queryInterface(). """
         return self.platform.queryInterface(oIUnknown, sClassName)
 
-
     #
     # Init and uninit.
     #
-
     def initPerThread(self):
         """ See PlatformBase::deinitPerThread(). """
         self.platform.initPerThread()
@@ -1065,14 +1103,12 @@ class VirtualBoxManager(object):
         if hasattr(self, "platform"):
             self.platform.deinit()
             self.platform = None
-        return True;
-
+        return True
 
     #
     # Utility methods.
     #
-
-    def openMachineSession(self, oIMachine, fPermitSharing = True):
+    def openMachineSession(self, oIMachine, fPermitSharing=True):
         """
         Attempts to open the a session to the machine.
         Returns a session object on success.
@@ -1080,11 +1116,11 @@ class VirtualBoxManager(object):
         """
         oSession = self.getSessionObject(self.vbox);
         if fPermitSharing:
-            type = self.constants.LockType_Shared;
+            type_ = self.constants.LockType_Shared
         else:
-            type = self.constants.LockType_Write;
-        oIMachine.lockMachine(oSession, type);
-        return oSession;
+            type_ = self.constants.LockType_Write
+        oIMachine.lockMachine(oSession, type_)
+        return oSession
 
     def closeMachineSession(self, oSession):
         """
@@ -1093,7 +1129,7 @@ class VirtualBoxManager(object):
         """
         if oSession is not None:
             oSession.unlockMachine()
-        return True;
+        return True
 
     def getPerfCollector(self, oIVBox):
         """
@@ -1116,43 +1152,40 @@ class VirtualBoxManager(object):
         global VBoxSdkDir
         return VBoxSdkDir
 
-
     #
     # Error code utilities.
     #
-
     ## @todo port to webservices!
-
-    def xcptGetStatus(self, oXcpt = None):
+    def xcptGetStatus(self, oXcpt=None):
         """
         Gets the status code from an exception.  If the exception parameter
         isn't specified, the current exception is examined.
         """
         if oXcpt is None:
-            oXcpt = sys.exc_info()[1];
-        return self.platform.xcptGetStatus(oXcpt);
+            oXcpt = sys.exc_info()[1]
+        return self.platform.xcptGetStatus(oXcpt)
 
-    def xcptIsDeadInterface(self, oXcpt = None):
+    def xcptIsDeadInterface(self, oXcpt=None):
         """
         Returns True if the exception indicates that the interface is dead,
         False if not.  If the exception parameter isn't specified, the current
         exception is examined.
         """
         if oXcpt is None:
-            oXcpt = sys.exc_info()[1];
-        return self.platform.xcptIsDeadInterface(oXcpt);
+            oXcpt = sys.exc_info()[1]
+        return self.platform.xcptIsDeadInterface(oXcpt)
 
-    def xcptIsOurXcptKind(self, oXcpt = None):
+    def xcptIsOurXcptKind(self, oXcpt=None):
         """
         Checks if the exception is one that could come from the VBox API. If
         the exception parameter isn't specified, the current exception is
         examined.
         """
-        if self.oXcptClass is None: ## @todo find the exception class for web services!
-            return False;
+        if self.oXcptClass is None:  # @todo find the exception class for web services!
+            return False
         if oXcpt is None:
-            oXcpt = sys.exc_info()[1];
-        return isinstance(oXcpt, self.oXcptClass);
+            oXcpt = sys.exc_info()[1]
+        return isinstance(oXcpt, self.oXcptClass)
 
     def xcptIsEqual(self, oXcpt, hrStatus):
         """
@@ -1166,16 +1199,16 @@ class VirtualBoxManager(object):
         Will not raise any exception as long as hrStatus and self are not bad.
         """
         if oXcpt is None:
-            oXcpt = sys.exc_info()[1];
-        return self.platform.xcptIsEqual(oXcpt, hrStatus);
+            oXcpt = sys.exc_info()[1]
+        return self.platform.xcptIsEqual(oXcpt, hrStatus)
 
     def xcptIsNotEqual(self, oXcpt, hrStatus):
         """
         Negated xcptIsEqual.
         """
-        return not self.xcptIsEqual(oXcpt, hrStatus);
+        return not self.xcptIsEqual(oXcpt, hrStatus)
 
-    def xcptToString(self, hrStatusOrXcpt = None):
+    def xcptToString(self, hrStatusOrXcpt=None):
         """
         Converts the specified COM status code, or the status code of the
         specified exception, to a C constant string.  If the parameter isn't
@@ -1183,44 +1216,44 @@ class VirtualBoxManager(object):
         """
 
         # Deal with exceptions.
-        if hrStatusOrXcpt is None  or  self.xcptIsOurXcptKind(hrStatusOrXcpt):
-            hrStatus = self.xcptGetStatus(hrStatusOrXcpt);
+        if hrStatusOrXcpt is None or self.xcptIsOurXcptKind(hrStatusOrXcpt):
+            hrStatus = self.xcptGetStatus(hrStatusOrXcpt)
         else:
-            hrStatus = hrStatusOrXcpt;
+            hrStatus = hrStatusOrXcpt
 
         # Build the dictionary on demand.
         if self._dErrorValToName is None:
-            dErrorValToName = dict();
+            dErrorValToName = dict()
             for sKey in dir(self.statuses):
                 if sKey[0].isupper():
-                    oValue = getattr(self.statuses, sKey);
+                    oValue = getattr(self.statuses, sKey)
                     if type(oValue) is int:
-                        dErrorValToName[oValue] = sKey;
-            self._dErrorValToName = dErrorValToName;
+                        dErrorValToName[oValue] = sKey
+            self._dErrorValToName = dErrorValToName
 
         # Do the lookup, falling back on formatting the status number.
         try:
-            sStr = self._dErrorValToName[int(hrStatus)];
+            sStr = self._dErrorValToName[int(hrStatus)]
         except KeyError:
-            hrLong = long(hrStatus);
-            sStr = '%#x (%d)' % (hrLong, hrLong);
-        return sStr;
+            hrLong = long(hrStatus)
+            sStr = '%#x (%d)' % (hrLong, hrLong)
+        return sStr
 
-    def xcptGetMessage(self, oXcpt = None):
+    def xcptGetMessage(self, oXcpt=None):
         """
         Returns the best error message found in the COM-like exception. If the
         exception parameter isn't specified, the current exception is examined.
         """
         if oXcpt is None:
-            oXcpt = sys.exc_info()[1];
-        sRet = self.platform.xcptGetMessage(oXcpt);
+            oXcpt = sys.exc_info()[1]
+        sRet = self.platform.xcptGetMessage(oXcpt)
         if sRet is None:
-            sRet = self.xcptToString(oXcpt);
-        return sRet;
+            sRet = self.xcptToString(oXcpt)
+        return sRet
 
     # Legacy, remove in a day or two.
-    errGetStatus       = xcptGetStatus
+    errGetStatus = xcptGetStatus
     errIsDeadInterface = xcptIsDeadInterface
-    errIsOurXcptKind   = xcptIsOurXcptKind
-    errGetMessage      = xcptGetMessage
+    errIsOurXcptKind = xcptIsOurXcptKind
+    errGetMessage = xcptGetMessage
 
diff --git a/src/VBox/Main/glue/xpcom/helpers.cpp b/src/VBox/Main/glue/xpcom/helpers.cpp
index 53f0ab5..215433d 100644
--- a/src/VBox/Main/glue/xpcom/helpers.cpp
+++ b/src/VBox/Main/glue/xpcom/helpers.cpp
@@ -1,3 +1,4 @@
+/* $Id: helpers.cpp $ */
 /** @file
  *
  * COM helper functions for XPCOM
diff --git a/src/VBox/Main/idl/VirtualBox.dtd b/src/VBox/Main/idl/VirtualBox.dtd
index 0af06e2..ef4ae34 100644
--- a/src/VBox/Main/idl/VirtualBox.dtd
+++ b/src/VBox/Main/idl/VirtualBox.dtd
@@ -71,6 +71,10 @@
     <!ATTLIST interface waitable (yes|no) "no">
                 <!-- waitable is only relevant for event interfaces, and
                      specifies that this event can be waited for. -->
+    <!ATTLIST interface wrap-hint-server-addinterfaces CDATA #IMPLIED>
+    <!ATTLIST interface wrap-hint-server CDATA #IMPLIED>
+    <!-- DTrace has a probe name length limit, so dtracename helps dealing with excessivly long names. -->
+    <!ATTLIST interface dtracename CDATA #IMPLIED>
   <!ELEMENT class (interface)>                                <!-- done -->
     <!ATTLIST class name CDATA #REQUIRED>
     <!ATTLIST class uuid CDATA #REQUIRED>
@@ -84,11 +88,17 @@
     <!ATTLIST attribute internal (yes|no) "no">
     <!ATTLIST attribute safearray (yes|no) "no">
     <!ATTLIST attribute wsmap (managed|suppress) "managed">
+    <!ATTLIST attribute wrap-hint-server CDATA #IMPLIED>
+    <!-- DTrace has a probe name length limit, so dtracename helps dealing with excessivly long names. -->
+    <!ATTLIST attribute dtracename CDATA #IMPLIED>
   <!ELEMENT method (desc?,param*,result*)>                    <!-- done -->
     <!ATTLIST method name CDATA #REQUIRED>
     <!ATTLIST method const CDATA "no">
     <!ATTLIST method internal (yes|no) "no">
     <!ATTLIST method wsmap (managed|suppress) "managed">
+    <!ATTLIST method wrap-hint-server CDATA #IMPLIED>
+    <!-- DTrace has a probe name length limit, so dtracename helps dealing with excessivly long names. -->
+    <!ATTLIST method dtracename CDATA #IMPLIED>
   <!ELEMENT param (desc?)>                                    <!-- done -->
     <!ATTLIST param name CDATA #REQUIRED>
     <!ATTLIST param type CDATA #REQUIRED>
diff --git a/src/VBox/Main/idl/VirtualBox.xidl b/src/VBox/Main/idl/VirtualBox.xidl
index 272d3ae..cec7e70 100644
--- a/src/VBox/Main/idl/VirtualBox.xidl
+++ b/src/VBox/Main/idl/VirtualBox.xidl
@@ -2,7 +2,7 @@
 
 <!--
 
-    Copyright (C) 2006-2014 Oracle Corporation
+    Copyright (C) 2006-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -54,8 +54,15 @@
    7. src/VBox/Runtime/common/err/errmsgvboxcom.xsl =>
       out/<platform>/obj/Runtime/errmsgvboxcomdata.h
       (<result> extraction for the %Rhrc format specifier)
+
+
+   Note! SlickEdit users can use the 'xml_validate' command on the SlickEdit
+         command line to verify the document against the DTD.  Uncomment the
+         DOCTYPE below first (java doesn't seem to like it).
 -->
 
+<!-- <!DOCTYPE idl SYSTEM "VirtualBox.dtd"> -->
+
 <idl>
 
 <desc>
@@ -418,6 +425,12 @@
     </desc>
   </result>
 
+  <result name="VBOX_E_PASSWORD_INCORRECT" value="0x80BB000D">
+    <desc>
+      A provided password was incorrect.
+    </desc>
+  </result>
+
   <!--
     Note that src/VBox/Runtime/common/err/errmsgvboxcom.xsl will ignore
     everything in <result>/<desc> after (and including) the first dot, so express
@@ -547,9 +560,15 @@
           Machine changes: default frontend, USB rework.
       -->
     </const>
+    <const name="v1_15" value="17">
+      <desc>Settings version "1.15", written by VirtualBox 5.0.x.</desc>
+      <!--
+          Machine changes: hot-plug flag for storage devices.
+      -->
+    </const>
 
     <const name="Future" value="99999">
-      <desc>Settings version greater than "1.13", written by a future VirtualBox version.</desc>
+      <desc>Settings version greater than "1.15", written by a future VirtualBox version.</desc>
     </const>
   </enum>
 
@@ -567,7 +586,7 @@
 
   <enum
     name="MachineState"
-    uuid="ec6c6a9e-113d-4ff4-b44f-0b69f21c97fe"
+    uuid="87f085c3-ca67-4e45-9225-6057f32e9e8e"
     >
     <desc>
       Virtual machine execution state.
@@ -577,7 +596,7 @@
 
       Below is the basic virtual machine state diagram. It shows how the state
       changes during virtual machine execution. The text in square braces shows
-      a method of the IConsole interface that performs the given state
+      a method of the IConsole or IMachine interface that performs the given state
       transition.
 
       <pre>
@@ -591,7 +610,7 @@
     |     ^                                               | |                   | |
     |     |     +-----------------------------------------+-|-------------------+ +
     |     |     |                                           |                     |
-    |     |     +-- Saving <--------[takeSnapshot()]<-------+---------------------+
+    |     |     +- OnlineSnapshotting <--[takeSnapshot()]<--+---------------------+
     |     |                                                 |                     |
     |     +-------- Saving <--------[saveState()]<----------+---------------------+
     |                                                       |                     |
@@ -663,7 +682,7 @@
     +----------------------------------(same state as before the call)------+
     |                                                                       |
     +-> PoweredOff --+                                                      |
-    |                +-->[takeSnapshot()] -------------------> Saving ------+
+    |                +-->[takeSnapshot()] ------------------> Snapshotting -+
     +-> Aborted -----+
 
     +-> PoweredOff --+
@@ -675,13 +694,6 @@
     +---(Saved if restored from an online snapshot, PoweredOff otherwise)---+
       </pre>
 
-      Note that the Saving state is present in both the offline state group and
-      online state group. Currently, the only way to determine what group is
-      assumed in a particular case is to remember the previous machine state: if
-      it was Running or Paused, then Saving is an online state, otherwise it is
-      an offline state. This inconsistency may be removed in one of the future
-      versions of VirtualBox by adding a new state.
-
       <note internal="yes">
         For whoever decides to touch this enum: In order to keep the
         comparisons involving FirstOnline and LastOnline pseudo-states valid,
@@ -731,7 +743,8 @@
           For whoever decides to touch this enum: In order to keep the
           comparisons in the old source code valid, this state must immediately
           precede the Paused state.
-          TODO: Lift this spectacularly wonderful restriction.
+
+          @todo Lift this spectacularly wonderful restriction.
         </note>
       </desc>
     </const>
@@ -742,7 +755,8 @@
           For whoever decides to touch this enum: In order to keep the
           comparisons in the old source code valid, this state must immediately
           follow the Running state.
-          TODO: Lift this spectacularly wonderful restriction.
+
+          @todo Lift this spectacularly wonderful restriction.
         </note>
       </desc>
     </const>
@@ -770,7 +784,7 @@
         A live snapshot is being taken. The machine is running normally, but
         some of the runtime configuration options are inaccessible. Also, if
         paused while in this state it will transition to
-        @c Saving and it will not be resume the
+        @c OnlineSnapshotting and it will not be resume the
         execution until the snapshot operation has completed.
       </desc>
     </const>
@@ -788,8 +802,7 @@
     </const>
     <const name="Saving"                    value="12">
       <desc>
-        Machine is saving its execution state to a file, or an online
-        snapshot of the machine is being taken.
+        Machine is saving its execution state to a file.
       </desc>
     </const>
     <const name="Restoring"                 value="13">
@@ -802,7 +815,7 @@
       <desc>
         The machine is being teleported to another host or process, but it is
         not running. This is the paused variant of the
-        @c state.
+        @c Teleporting state.
       </desc>
     </const>
     <const name="TeleportingIn"             value="15">
@@ -827,30 +840,41 @@
         merging of differencing media was started.
       </desc>
     </const>
-    <const name="RestoringSnapshot"         value="19">
+    <const name="OnlineSnapshotting"        value="19">
+      <desc>
+        Like @c LiveSnapshotting, but the machine was paused when the
+        merging of differencing media was started.
+      </desc>
+    </const>
+    <const name="RestoringSnapshot"         value="20">
       <desc>
         A machine snapshot is being restored; this typically does not take long.
       </desc>
     </const>
-    <const name="DeletingSnapshot"          value="20">
+    <const name="DeletingSnapshot"          value="21">
       <desc>
         A machine snapshot is being deleted; this can take a long time since this
         may require merging differencing media. This value indicates that the
         machine is not running while the snapshot is being deleted.
       </desc>
     </const>
-    <const name="SettingUp"                 value="21">
+    <const name="SettingUp"                 value="22">
       <desc>
         Lengthy setup operation is in progress.
       </desc>
     </const>
+    <const name="Snapshotting"              value="23">
+      <desc>
+        Taking an (offline) snapshot.
+      </desc>
+    </const>
 
     <const name="FirstOnline" value="5" wsmap="suppress"> <!-- Running -->
       <desc>
         Pseudo-state: first online state (for use in relational expressions).
       </desc>
     </const>
-    <const name="LastOnline" value="18" wsmap="suppress"> <!-- DeletingSnapshotPaused -->
+    <const name="LastOnline" value="19" wsmap="suppress"> <!-- OnlineSnapshotting -->
       <desc>
         Pseudo-state: last online state (for use in relational expressions).
       </desc>
@@ -861,7 +885,7 @@
         Pseudo-state: first transient state (for use in relational expressions).
       </desc>
     </const>
-    <const name="LastTransient" value="21" wsmap="suppress"> <!-- SettingUp -->
+    <const name="LastTransient" value="23" wsmap="suppress"> <!-- Snapshotting -->
       <desc>
         Pseudo-state: last transient state (for use in relational expressions).
       </desc>
@@ -920,7 +944,7 @@
 
   <enum
     name="CPUPropertyType"
-    uuid="52bc41f4-a279-45da-88ab-3a1d86fb73eb"
+    uuid="ed4094c1-d00e-483a-93e9-7163549ebd6e"
     >
     <desc>
       Virtual CPU property type. This enumeration represents possible values of the
@@ -936,19 +960,13 @@
         is not available, it will not be reported.
       </desc>
     </const>
-    <const name="Synthetic"             value="2">
-      <desc>
-        This setting determines whether VirtualBox will expose a synthetic CPU to the guest to allow
-        teleporting between host systems that differ significantly.
-      </desc>
-    </const>
-    <const name="LongMode"             value="3">
+    <const name="LongMode"              value="2">
       <desc>
         This setting determines whether VirtualBox will advertise long mode
         (i.e. 64-bit guest support) and let the guest enter it.
       </desc>
     </const>
-    <const name="TripleFaultReset"     value="4">
+    <const name="TripleFaultReset"      value="3">
       <desc>
         This setting determines whether a triple fault within a guest will trigger an internal
         error condition and stop the VM (default) or reset the virtual CPU and continue execution.
@@ -1004,6 +1022,35 @@
   </enum>
 
   <enum
+    name="ParavirtProvider"
+    uuid="696453ec-3742-4a05-bead-658ccbf2c944"
+    >
+    <desc>
+      The paravirtualized guest interface provider. This enumeration represents possible
+      values for the <link to="IMachine::paravirtProvider"/> attribute.
+    </desc>
+    <const name="None"     value="0">
+      <desc>No provider is used.</desc>
+    </const>
+    <const name="Default"  value="1">
+      <desc>A default provider is automatically chosen according to the guest OS type.</desc>
+    </const>
+    <const name="Legacy"   value="2">
+      <desc>Used for VMs which didn't used to have any provider settings. Usually
+        interpreted as @c None for most VMs.</desc>
+    </const>
+    <const name="Minimal"  value="3">
+      <desc>A minimal set of features to expose to the paravirtualized guest.</desc>
+    </const>
+    <const name="HyperV"   value="4">
+      <desc>Microsoft Hyper-V.</desc>
+    </const>
+	<const name="KVM"      value="5">
+	  <desc>Linux KVM.</desc>
+	</const>
+  </enum>
+
+  <enum
     name="FaultToleranceState"
     uuid="5124f7ec-6b67-493c-9dee-ee45a44114e1"
     >
@@ -1023,11 +1070,19 @@
 
   <enum
     name="LockType"
-    uuid="168a6a8e-12fd-4878-a1f9-38a750a56089"
+    uuid="678aaf14-2815-4c3e-b20a-e86ed0216498"
     >
     <desc>
       Used with <link to="IMachine::lockMachine" />.
     </desc>
+    <const name="Null" value="0">
+      <desc>Placeholder value, do not use when obtaining a lock.</desc>
+    </const>
+    <const name="Shared" value="1">
+      <desc>Request only a shared lock for remote-controlling the machine.
+        Such a lock allows changing certain VM settings which can be safely
+        modified for a running VM.</desc>
+    </const>
     <const name="Write" value="2">
       <desc>Lock the machine for writing. This requests an exclusive lock, i.e.
         there cannot be any other API client holding any type of lock for this
@@ -1035,11 +1090,6 @@
         which implicitly holds the equivalent of a shared lock during the
         entire VM runtime.</desc>
     </const>
-    <const name="Shared" value="1">
-      <desc>Request only a shared lock for remote-controlling the machine.
-        Such a lock allows changing certain VM settings which can be safely
-        modified for a running VM.</desc>
-    </const>
     <const name="VM" value="3">
       <desc>Lock the machine for writing, and create objects necessary for
         running a VM in this process.</desc>
@@ -1080,7 +1130,7 @@
 
   <enum
     name="DeviceType"
-    uuid="6d9420f7-0b56-4636-99f9-7346f1b01e57"
+    uuid="cb977be1-d1fb-41f8-ad7e-951736c6cb3e"
     >
     <desc>
       Device type.
@@ -1109,6 +1159,9 @@
     <const name="SharedFolder"      value="6">
       <desc>Shared folder device.</desc>
     </const>
+    <const name="Graphics3D"          value="7">
+      <desc>Graphics device 3D activity.</desc>
+    </const>
   </enum>
 
   <enum
@@ -1140,11 +1193,11 @@
   </enum>
 
   <enum
-    name="DragAndDropMode"
-    uuid="b618ea0e-b6fb-4f8d-97f7-5e237e49b547"
+    name="DnDMode"
+    uuid="07af8800-f936-4b33-9172-cd400e83c148"
     >
     <desc>
-      Drag'n'Drop interchange mode.
+      Drag and drop interchange mode.
     </desc>
 
     <const name="Disabled"          value="0"/>
@@ -1277,6 +1330,63 @@
     </const>
   </enum>
 
+  <enum
+    name="BitmapFormat"
+    uuid="afb2bf39-8b1e-4f9f-8948-d1b887f83eb0"
+    >
+    <desc>
+      Format of a bitmap. Generic values for formats used by
+      the source bitmap, the screen shot or image update APIs.
+    </desc>
+
+    <const name="Opaque"          value="0">
+      <desc>
+        Unknown buffer format (the user may not assume any particular format of
+        the buffer).
+      </desc>
+    </const>
+    <const name="BGR"             value="0x20524742">
+      <desc>
+        Generic BGR format without alpha channel.
+        Pixel layout depends on the number of bits per pixel:
+        <ul>
+          <li>
+            <b>32</b> - bits 31:24 undefined, bits 23:16 R, bits 15:8 G, bits 7:0 B.
+          </li>
+
+          <li>
+            <b>16</b> - bits 15:11 R, bits 10:5 G, bits 4:0 B.
+          </li>
+        </ul>
+      </desc>
+    </const>
+    <const name="BGR0"            value="0x30524742">
+      <desc>
+        4 bytes per pixel: B, G, R, 0.
+      </desc>
+    </const>
+    <const name="BGRA"            value="0x41524742">
+      <desc>
+        4 bytes per pixel: B, G, R, A.
+      </desc>
+    </const>
+    <const name="RGBA"            value="0x41424752">
+      <desc>
+        4 bytes per pixel: R, G, B, A.
+      </desc>
+    </const>
+    <const name="PNG"             value="0x20474E50">
+      <desc>
+        PNG image.
+      </desc>
+    </const>
+    <const name="JPEG"            value="0x4745504A">
+      <desc>
+        JPEG image.
+      </desc>
+    </const>
+  </enum>
+
   <!--
   // IVirtualBoxErrorInfo
   /////////////////////////////////////////////////////////////////////////
@@ -1427,7 +1537,7 @@
         IPv6Enabled is false.
       </desc>
     </attribute>
-    <attribute name="advertiseDefaultIPv6RouteEnabled" type="boolean"/>
+    <attribute name="advertiseDefaultIPv6RouteEnabled" type="boolean" dtracename="advertiseDefaultIPv6Route"/>
     <attribute name="needDhcpServer" type="boolean"/>
     <attribute name="eventSource" type="IEventSource" readonly="yes"/>
     <attribute name="portForwardRules4" type="wstring" readonly="yes" safearray="yes">
@@ -1563,6 +1673,13 @@
     <const name="Option_119" value="119"/>
   </enum>
 
+  <enum
+      name="DhcpOptEncoding"
+      uuid="88ea6d70-8648-4871-ba30-1f49c61cfaa2">
+    <const name="Legacy" value="0"/>
+    <const name="Hex" value="1"/>
+  </enum>
+
   <interface
     name="IDHCPServer" extends="$unknown"
     uuid="ff0774c5-1f62-4bc3-919c-7fc942bf1d25"
@@ -1624,24 +1741,24 @@
     <attribute name="vmConfigs" type="wstring" safearray="yes" readonly="yes"/>
 
     <!-- VM-slot settings
-     It's corresponds to dhcpd.conf entries, like:
+         It's corresponds to dhcpd.conf entries, like:
 
-     host ncd1 { hardware ethernet 0:c0:c3:11:90:23; }
+         host ncd1 { hardware ethernet 0:c0:c3:11:90:23; }
 
-     - in Main we can match (vm name, slot) to ethernet address
-     that why it's easy to configure dhcp server in such way,
-     then ask user to to enter valid name,
+         - in Main we can match (vm name, slot) to ethernet address
+         that why it's easy to configure dhcp server in such way,
+         then ask user to to enter valid name,
 
-     - mac address might change because of adapter type (e1k <-> pcnet) or because
-     of import/export
+         - mac address might change because of adapter type (e1k <-> pcnet) or because
+         of import/export
 
-     - it's easy to provide vm-name.rom in boot filename VM with network boot.
+         - it's easy to provide vm-name.rom in boot filename VM with network boot.
 
-     XXX: do we need classic getOptionValueByMAC?
+         XXX: do we need classic getOptionValueByMAC?
 
-     XML: O-o-oh, this settings are per VM, so perhaps they should be stored in
-          VM configuration files. And we haven't got the attachment type for
-          NATNetwork.
+         XML: O-o-oh, this settings are per VM, so perhaps they should be stored in
+         VM configuration files. And we haven't got the attachment type for
+         NATNetwork.
     -->
     <method name="addVmSlotOption">
       <param name="vmname" type="wstring" dir="in"/>
@@ -1733,7 +1850,7 @@
 
   <interface
     name="IVirtualBox" extends="$unknown"
-    uuid="fafa4e17-1ee2-4905-a10e-fe7c18bf5554"
+    uuid="3afa096e-2cad-4cb0-aba2-47fe3fc62bd8"
     wsmap="managed"
     >
     <desc>
@@ -2204,7 +2321,7 @@
       </param>
     </method>
 
-    <method name="createHardDisk">
+    <method name="createMedium">
       <desc>
         Creates a new base medium object that will use the given storage
         format and location for medium data.
@@ -2222,16 +2339,30 @@
         remain uninitialized until the medium storage unit is successfully
         created by one of the above methods.
 
-        After the storage unit is successfully created, it will be
-        accessible through the <link to="#openMedium"/> method and can
-        be found in the <link to="#hardDisks"/> array.
+        Depending on the given device type, the file at the storage location
+        must be in one of the media formats understood by VirtualBox:
+
+        <ul>
+          <li>With a "HardDisk" device type, the file must be a hard disk image
+            in one of the formats supported by VirtualBox (see
+            <link to="ISystemProperties::mediumFormats" />).
+            After the storage unit is successfully created and this method succeeds,
+            if the medium is a base medium, it
+            will be added to the <link to="#hardDisks"/> array attribute. </li>
+          <li>With a "DVD" device type, the file must be an ISO 9960 CD/DVD image.
+            After this method succeeds, the medium will be added to the
+            <link to="#DVDImages"/> array attribute.</li>
+          <li>With a "Floppy" device type, the file must be an RAW floppy image.
+            After this method succeeds, the medium will be added to the
+            <link to="#floppyImages"/> array attribute.</li>
+        </ul>
 
         The list of all storage formats supported by this VirtualBox
         installation can be obtained using
         <link to="ISystemProperties::mediumFormats"/>. If the @a format
         attribute is empty or @c null then the default storage format
         specified by <link to="ISystemProperties::defaultHardDiskFormat"/> will
-        be used for creating a storage unit of the medium.
+        be used for disks r creating a storage unit of the medium.
 
         Note that the format of the location string is storage format specific.
         See <link to="IMedium::location"/> and IMedium for more details.
@@ -2254,6 +2385,15 @@
           Location of the storage unit for the new medium.
         </desc>
       </param>
+      <param name="accessMode" type="AccessMode" dir="in">
+        <desc>Whether to open the image in read/write or read-only mode. For
+        a "DVD" device type, this is ignored and read-only mode is always assumed.</desc>
+      </param>
+      <param name="aDeviceTypeType" type="DeviceType" dir="in">
+        <desc>
+          Must be one of "HardDisk", "DVD" or "Floppy".
+        </desc>
+      </param>
       <param name="medium" type="IMedium" dir="return">
         <desc>Created medium object.</desc>
       </param>
@@ -2375,7 +2515,7 @@
         </result>
 
       </desc>
-      <param name="id" type="uuid" mod="string" dir="in">
+      <param name="id" type="wstring" dir="in">
         <desc>Guest OS type ID string.</desc>
       </param>
       <param name="type" type="IGuestOSType" dir="return">
@@ -2666,25 +2806,6 @@
     <const name="WebDav" value="4" />
   </enum>
 
-  <enum
-    name="VFSFileType"
-    uuid="714333cd-44e2-415f-a245-d378fa9b1242"
-    >
-    <desc>
-      File types known by VFSExplorer.
-    </desc>
-
-    <const name="Unknown" value="1" />
-    <const name="Fifo" value="2" />
-    <const name="DevChar" value="3" />
-    <const name="Directory" value="4" />
-    <const name="DevBlock" value="5" />
-    <const name="File" value="6" />
-    <const name="SymLink" value="7" />
-    <const name="Socket" value="8" />
-    <const name="WhiteOut" value="9" />
-  </enum>
-
   <interface
     name="IVFSExplorer" extends="$unknown"
     uuid="fb220201-2fd3-47e2-a5dc-2c2431d833cc"
@@ -2745,7 +2866,7 @@
       </param>
 
       <param name="types" type="unsigned long" safearray="yes" dir="out">
-        <desc>The list of types for the entries.</desc>
+        <desc>The list of types for the entries. <link to="FsObjType"/></desc>
       </param>
 
       <param name="sizes" type="long long" safearray="yes" dir="out">
@@ -2800,6 +2921,10 @@
       <desc>Don't generate new MAC addresses of the attached network adapters when they are using NAT.</desc>
     </const>
 
+    <const name="ImportToVDI"       value="3">
+      <desc>Import all disks to VDI format</desc>
+    </const>
+
   </enum>
 
   <enum
@@ -2842,7 +2967,7 @@
 
   <interface
     name="IAppliance" extends="$unknown"
-    uuid="3059cf9e-25c7-4f0b-9fa5-3c42e441670b"
+    uuid="a529d52c-cf23-4936-9150-e8a6ce77fdad"
     wsmap="managed"
     >
     <desc>
@@ -3098,6 +3223,45 @@
       </param>
     </method>
 
+    <method name="getPasswordIds">
+      <desc>
+        Returns a list of password identifiers which must be supplied to import or export
+        encrypted virtual machines.
+      </desc>
+
+      <param name="identifiers" type="wstring" dir="return" safearray="yes">
+        The list of password identifiers required for export on success.
+      </param>
+    </method>
+
+    <method name="getMediumIdsForPasswordId">
+      <desc>
+        Returns a list of medium identifiers which use the given password identifier.
+      </desc>
+
+      <param name="passwordId" type="wstring" dir="in">
+        The password identifier to get the medium identifiers for.
+      </param>
+      <param name="identifiers" type="uuid" mod="string" dir="return" safearray="yes">
+        The list of medium identifiers returned on success.
+      </param>
+    </method>
+
+    <method name="addPasswords">
+      <desc>
+        Adds a list of passwords required to import or export encrypted virtual
+        machines.
+      </desc>
+
+      <param name="identifiers" type="wstring" dir="in" safearray="yes">
+        <desc>List of identifiers.</desc>
+      </param>
+
+      <param name="passwords" type="wstring" dir="in" safearray="yes">
+        <desc>List of matching passwords.</desc>
+      </param>
+    </method>
+
   </interface>
 
   <enum
@@ -3415,17 +3579,10 @@
 
   <interface
     name="IInternalMachineControl" extends="$unknown"
-    uuid="2d9ce4b7-0ab2-4931-ac4a-e45aa66465ef"
+    uuid="2cfec73b-4447-4ff8-bae5-e4306e6197e8"
     internal="yes"
     wsmap="suppress"
     >
-    <method name="setRemoveSavedStateFile">
-      <desc>
-        Updates the flag whether the saved state file is removed on a
-        machine state change from Saved to PoweredOff.
-      </desc>
-      <param name="remove" type="boolean" dir="in"/>
-    </method>
 
     <method name="updateState">
       <desc>
@@ -3525,6 +3682,7 @@
         notification.
       </desc>
       <param name="id" type="uuid" mod="string" dir="in"/>
+      <param name="captureFilename" type="wstring" dir="in"/>
     </method>
 
     <method name="detachUSBDevice">
@@ -3586,151 +3744,6 @@
       </param>
     </method>
 
-    <method name="beginSavingState">
-      <desc>
-        Called by the VM process to inform the server it wants to
-        save the current state and stop the VM execution.
-      </desc>
-      <param name="progress" type="IProgress" dir="out">
-        <desc>
-          Progress object created by VBoxSVC to wait until
-          the state is saved.
-        </desc>
-      </param>
-      <param name="stateFilePath" type="wstring" dir="out">
-        <desc>
-          File path the VM process must save the execution state to.
-        </desc>
-      </param>
-    </method>
-
-    <method name="endSavingState">
-      <desc>
-        Called by the VM process to inform the server that saving
-        the state previously requested by #beginSavingState is either
-        successfully finished or there was a failure.
-
-        <result name="VBOX_E_FILE_ERROR">
-          Settings file not accessible.
-        </result>
-        <result name="VBOX_E_XML_ERROR">
-          Could not parse the settings file.
-        </result>
-
-      </desc>
-
-      <param name="result" type="long" dir="in">
-        <desc>@c S_OK to indicate success.
-        </desc>
-      </param>
-      <param name="errMsg" type="wstring" dir="in">
-        <desc>@c human readable error message in case of failure.
-        </desc>
-      </param>
-    </method>
-
-    <method name="adoptSavedState">
-      <desc>
-        Gets called by <link to="IConsole::adoptSavedState"/>.
-        <result name="VBOX_E_FILE_ERROR">
-          Invalid saved state file path.
-        </result>
-      </desc>
-      <param name="savedStateFile" type="wstring" dir="in">
-        <desc>Path to the saved state file to adopt.</desc>
-      </param>
-    </method>
-
-    <method name="beginTakingSnapshot">
-      <desc>
-        Called from the VM process to request from the server to perform the
-        server-side actions of creating a snapshot (creating differencing images
-        and the snapshot object).
-
-        <result name="VBOX_E_FILE_ERROR">
-          Settings file not accessible.
-        </result>
-        <result name="VBOX_E_XML_ERROR">
-          Could not parse the settings file.
-        </result>
-      </desc>
-      <param name="initiator" type="IConsole" dir="in">
-        <desc>The console object that initiated this call.</desc>
-      </param>
-      <param name="name" type="wstring" dir="in">
-        <desc>Snapshot name.</desc>
-      </param>
-      <param name="description" type="wstring" dir="in">
-        <desc>Snapshot description.</desc>
-      </param>
-      <param name="consoleProgress" type="IProgress" dir="in">
-        <desc>
-          Progress object created by the VM process tracking the
-          snapshot's progress. This has the following sub-operations:
-          <ul>
-            <li>setting up (weight 1);</li>
-            <li>one for each medium attachment that needs a differencing image (weight 1 each);</li>
-            <li>another one to copy the VM state (if offline with saved state, weight is VM memory size in MB);</li>
-            <li>another one to save the VM state (if online, weight is VM memory size in MB);</li>
-            <li>finishing up (weight 1)</li>
-          </ul>
-        </desc>
-      </param>
-      <param name="fTakingSnapshotOnline" type="boolean" dir="in">
-        <desc>
-          Whether this is an online snapshot (i.e. the machine is running).
-        </desc>
-      </param>
-      <param name="stateFilePath" type="wstring" dir="out">
-        <desc>
-          File path the VM process must save the execution state to.
-        </desc>
-      </param>
-    </method>
-
-    <method name="endTakingSnapshot">
-      <desc>
-        Called by the VM process to inform the server that the snapshot
-        previously requested by #beginTakingSnapshot is either
-        successfully taken or there was a failure.
-      </desc>
-
-      <param name="success" type="boolean" dir="in">
-        <desc>@c true to indicate success and @c false otherwise</desc>
-      </param>
-    </method>
-
-    <method name="deleteSnapshot">
-      <desc>
-        Gets called by <link to="IConsole::deleteSnapshot"/>,
-        <link to="IConsole::deleteSnapshotAndAllChildren"/> and
-        <link to="IConsole::deleteSnapshotRange"/>.
-        <result name="VBOX_E_INVALID_OBJECT_STATE">
-          Snapshot has more than one child snapshot. Only possible if the
-          delete operation does not delete all children or the range does
-          not meet the linearity condition.
-        </result>
-      </desc>
-      <param name="initiator" type="IConsole" dir="in">
-        <desc>The console object that initiated this call.</desc>
-      </param>
-      <param name="startId" type="uuid" mod="string" dir="in">
-        <desc>UUID of the first snapshot to delete.</desc>
-      </param>
-      <param name="endId" type="uuid" mod="string" dir="in">
-        <desc>UUID of the last snapshot to delete.</desc>
-      </param>
-      <param name="deleteAllChildren" type="boolean" dir="in">
-        <desc>Whether all children should be deleted.</desc>
-      </param>
-      <param name="machineState" type="MachineState" dir="out">
-        <desc>New machine state after this operation is started.</desc>
-      </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
-      </param>
-    </method>
-
     <method name="finishOnlineMergeMedium">
       <desc>
         Gets called by <link to="IInternalSessionControl::onlineMergeMedium"/>.
@@ -3738,24 +3751,6 @@
       </desc>
     </method>
 
-    <method name="restoreSnapshot">
-      <desc>
-        Gets called by <link to="IConsole::restoreSnapshot"/>.
-      </desc>
-      <param name="initiator" type="IConsole" dir="in">
-        <desc>The console object that initiated this call.</desc>
-      </param>
-      <param name="snapshot" type="ISnapshot" dir="in">
-        <desc>The snapshot to restore the VM state from.</desc>
-      </param>
-      <param name="machineState" type="MachineState" dir="out">
-        <desc>New machine state after this operation is started.</desc>
-      </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
-      </param>
-    </method>
-
     <method name="pullGuestProperties">
       <desc>
         Get the list of the guest properties matching a set of patterns along
@@ -3811,8 +3806,13 @@
           The flags of the property.
         </desc>
       </param>
-    </method>
-
+      <param name="notify" type="boolean" dir="return">
+        <desc>
+          Returns if a guest property change notification event should be fired.
+        </desc>
+      </param>
+    </method>
+
     <method name="lockMedia">
       <desc>
         Locks all media attached to the machine for writing and parents of
@@ -4054,7 +4054,7 @@
 
     <attribute name="guestAddress" type="long" readonly="yes">
       <desc>
-        Address of device on the guest.
+        Address of device in the guest.
       </desc>
     </attribute>
 
@@ -4169,8 +4169,10 @@
 
   <interface
     name="IMachine" extends="$unknown"
-    uuid="480cf695-2d8d-4256-9c7c-cce4184fa048"
+    uuid="feb138aa-dbce-4a89-8ec0-380fc7ec4913"
     wsmap="managed"
+    wrap-hint-server-addinterfaces="IInternalMachineControl"
+    wrap-hint-server="manualaddinterfaces"
     >
     <desc>
       The IMachine interface represents a virtual machine, or guest, created
@@ -4208,7 +4210,7 @@
       <see><link to="ISession"/>, <link to="IConsole"/></see>
     </desc>
 
-    <attribute name="parent" type="IVirtualBox" readonly="yes">
+    <attribute name="parent" type="IVirtualBox" readonly="yes" wrap-hint-server="limitedcaller">
       <desc>Associated parent object.</desc>
     </attribute>
 
@@ -4216,7 +4218,7 @@
       <desc>Overridden VM Icon details.</desc>
     </attribute>
 
-    <attribute name="accessible" type="boolean" readonly="yes">
+    <attribute name="accessible" type="boolean" readonly="yes" wrap-hint-server="limitedcaller">
       <desc>
         Whether this virtual machine is currently accessible or not.
 
@@ -4260,7 +4262,7 @@
       </desc>
     </attribute>
 
-    <attribute name="accessError" type="IVirtualBoxErrorInfo" readonly="yes">
+    <attribute name="accessError" type="IVirtualBoxErrorInfo" readonly="yes" wrap-hint-server="limitedcaller">
       <desc>
         Error information describing the reason of machine
         inaccessibility.
@@ -4323,7 +4325,7 @@
       </desc>
     </attribute>
 
-    <attribute name="id" type="uuid" mod="string" readonly="yes">
+    <attribute name="id" type="uuid" mod="string" readonly="yes" wrap-hint-server="limitedcaller">
       <desc>UUID of the virtual machine.</desc>
     </attribute>
 
@@ -4384,6 +4386,18 @@
       </desc>
     </attribute>
 
+    <attribute name="CPUIDPortabilityLevel" type="unsigned long">
+      <desc>Virtual CPUID portability level, the higher number the fewer newer
+        or vendor specific CPU feature is reported to the guest (via the CPUID
+        instruction).  The default level of zero (0) means that all virtualized
+        feautres supported by the host is pass thru to the guest.  While the
+        three (3) is currently the level supressing the most features.
+
+        Exactly which of the CPUID features are left out by the VMM at which
+        level is subject to change with each major version.
+        </desc>
+    </attribute>
+
     <attribute name="memorySize" type="unsigned long">
       <desc>System memory size in megabytes.</desc>
     </attribute>
@@ -4489,6 +4503,33 @@
       </desc>
     </attribute>
 
+    <attribute name="videoCaptureMaxTime" type="unsigned long" default="0">
+      <desc>
+        This setting determines the maximal number of time video capture
+        will work for. The capture stops as the defined time interval
+        has elapsed. If this value is zero the capturing will not be limited
+        by time. This setting cannot be changed while video capturing is enabled.
+      </desc>
+    </attribute>
+
+    <attribute name="videoCaptureMaxFileSize" type="unsigned long" default="0">
+      <desc>
+        This setting determines the maximal number of captured video file
+        size in MB. The capture stops as the captured video file size
+        has reached the defined. If this value is zero the capturing
+        will not be limited by file size. This setting cannot be changed
+        while video capturing is enabled.
+      </desc>
+    </attribute>
+
+    <attribute name="videoCaptureOptions" type="wstring">
+      <desc>
+        This setting contains any additional video capture options
+        required in comma-separated key=value format. This setting
+        cannot be changed while video capturing is enabled.
+      </desc>
+    </attribute>
+
     <attribute name="BIOSSettings" type="IBIOSSettings" readonly="yes">
       <desc>Object containing all BIOS settings.</desc>
     </attribute>
@@ -4595,7 +4636,7 @@
       <desc>Array of storage controllers attached to this machine.</desc>
     </attribute>
 
-    <attribute name="settingsFilePath" type="wstring" readonly="yes">
+    <attribute name="settingsFilePath" type="wstring" readonly="yes" wrap-hint-server="limitedcaller">
       <desc>
         Full name of the file containing machine settings data.
       </desc>
@@ -4628,14 +4669,15 @@
       <desc>Current session state for this machine.</desc>
     </attribute>
 
-    <attribute name="sessionType" type="wstring" readonly="yes">
+    <attribute name="sessionName" type="wstring" readonly="yes">
       <desc>
-        Type of the session. If <link to="#sessionState"/> is
+        Name of the session. If <link to="#sessionState"/> is
         Spawning or Locked, this attribute contains the
         same value as passed to the
         <link to="IMachine::launchVMProcess"/> method in the
-        @a type parameter. If the session was used with
-        <link to="IMachine::lockMachine" />, or if
+        @a name parameter. If the session was established with
+        <link to="IMachine::lockMachine" />, it is the name of the session
+        (if set, otherwise empty string). If
         <link to="#sessionState"/> is SessionClosed, the value of this
         attribute is an empty string.
       </desc>
@@ -4687,10 +4729,9 @@
       <desc>
         Current snapshot of this machine. This is @c null if the machine
         currently has no snapshots. If it is not @c null, then it was
-        set by one of <link to="IConsole::takeSnapshot" />,
-        <link to="IConsole::deleteSnapshot" />
-        or <link to="IConsole::restoreSnapshot" />, depending on which
-        was called last. See <link to="ISnapshot"/> for details.
+        set by one of <link to="#takeSnapshot" />, <link to="#deleteSnapshot" />
+        or <link to="#restoreSnapshot" />, depending on which was called last.
+       See <link to="ISnapshot"/> for details.
       </desc>
     </attribute>
 
@@ -4710,11 +4751,10 @@
         directly after one of the following calls are made:
 
         <ul>
-          <li><link to="IConsole::restoreSnapshot"/>
+          <li><link to="#restoreSnapshot"/>
           </li>
-          <li><link to="IConsole::takeSnapshot"/> (issued on a
-            "powered off" or "saved" machine, for which
-            <link to="#settingsModified"/> returns @c false)
+          <li><link to="#takeSnapshot"/> (issued on a "powered off" or "saved"
+            machine, for which <link to="#settingsModified"/> returns @c false)
           </li>
         </ul>
 
@@ -4753,9 +4793,9 @@
       </desc>
     </attribute>
 
-    <attribute name="dragAndDropMode" type="DragAndDropMode">
+    <attribute name="dnDMode" type="DnDMode">
       <desc>
-        Which mode is allowed for drag'n'drop.
+        Sets or retrieves the current drag'n drop mode.
       </desc>
     </attribute>
 
@@ -4807,6 +4847,12 @@
       </desc>
     </attribute>
 
+    <attribute name="paravirtProvider" type="ParavirtProvider">
+      <desc>
+        The paravirtualized guest interface provider.
+      </desc>
+    </attribute>
+
     <attribute name="faultToleranceState" type="FaultToleranceState">
       <desc>
         Fault tolerance state; disabled, source or target.
@@ -5099,6 +5145,11 @@
         For details on the teleportation progress operation, see
         <link to="IConsole::powerUp"/>.
 
+<!-- TODO/r=bird: What about making @a environment into a smart array?  Guess
+this predates our safe array support by a year or so... Dmitry wrote the text here, right?
+Just rename it to @a environmentChanges and shorten the documentation to say the string
+are applied onto the server environment putenv style, i.e. "VAR=VALUE" for setting/replacing
+and "VAR" for unsetting. -->
         The @a environment argument is a string containing definitions of
         environment variables in the following format:
         <pre>
@@ -5140,7 +5191,7 @@
           must be in "Unlocked" state).
         </desc>
       </param>
-      <param name="type" type="wstring" dir="in">
+      <param name="name" type="wstring" dir="in">
         <desc>
           Front-end to use for the new VM process. The following are currently supported:
           <ul>
@@ -6471,7 +6522,7 @@
       </desc>
     </method>
 
-    <method name="unregister">
+    <method name="unregister" wrap-hint-server="limitedcaller,passcaller">
       <desc>
         Unregisters a machine previously registered with
         <link to="IVirtualBox::registerMachine"/> and optionally do additional
@@ -6985,45 +7036,18 @@
       </param>
     </method>
 
-    <method name="querySavedThumbnailSize">
-      <desc>
-        Returns size in bytes and dimensions in pixels of a saved thumbnail bitmap from saved state.
-      </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>
-          Saved guest screen to query info from.
-        </desc>
-      </param>
-      <param name="size" type="unsigned long" dir="out">
-        <desc>
-          Size of buffer required to store the bitmap.
-        </desc>
-      </param>
-      <param name="width" type="unsigned long" dir="out">
-        <desc>
-          Bitmap width.
-        </desc>
-      </param>
-      <param name="height" type="unsigned long" dir="out">
-        <desc>
-          Bitmap height.
-        </desc>
-      </param>
-    </method>
-
     <method name="readSavedThumbnailToArray">
       <desc>
-        Thumbnail is retrieved to an array of bytes in uncompressed 32-bit BGRA or RGBA format.
+        Thumbnail is retrieved to an array of bytes in the requested format.
       </desc>
       <param name="screenId" type="unsigned long" dir="in">
         <desc>
           Saved guest screen to read from.
         </desc>
       </param>
-      <param name="BGR" type="boolean" dir="in">
+      <param name="bitmapFormat" type="BitmapFormat" dir="in">
         <desc>
-          How to order bytes in the pixel. A pixel consists of 4 bytes. If this parameter is true, then
-          bytes order is: B, G, R, 0xFF. If this parameter is false, then bytes order is: R, G, B, 0xFF.
+          The requested format.
         </desc>
       </param>
       <param name="width" type="unsigned long" dir="out">
@@ -7043,13 +7067,13 @@
       </param>
     </method>
 
-    <method name="readSavedThumbnailPNGToArray">
+    <method name="querySavedScreenshotInfo">
       <desc>
-        Thumbnail in PNG format is retrieved to an array of bytes.
+        Returns available formats and size of the screenshot from saved state.
       </desc>
       <param name="screenId" type="unsigned long" dir="in">
         <desc>
-          Saved guest screen to read from.
+          Saved guest screen to query info from.
         </desc>
       </param>
       <param name="width" type="unsigned long" dir="out">
@@ -7062,46 +7086,25 @@
           Image height.
         </desc>
       </param>
-      <param name="data" type="octet" dir="return" safearray="yes">
+      <param name="bitmapFormats" type="BitmapFormat" safearray="yes" dir="return">
         <desc>
-          Array with resulting PNG data.
+          Formats supported by readSavedScreenshotToArray.
         </desc>
       </param>
     </method>
 
-    <method name="querySavedScreenshotPNGSize">
+    <method name="readSavedScreenshotToArray">
       <desc>
-        Returns size in bytes and dimensions of a saved PNG image of screenshot from saved state.
+        Screenshot in requested format is retrieved to an array of bytes.
       </desc>
       <param name="screenId" type="unsigned long" dir="in">
         <desc>
-          Saved guest screen to query info from.
-        </desc>
-      </param>
-      <param name="size" type="unsigned long" dir="out">
-        <desc>
-          Size of buffer required to store the PNG binary data.
-        </desc>
-      </param>
-      <param name="width" type="unsigned long" dir="out">
-        <desc>
-          Image width.
-        </desc>
-      </param>
-      <param name="height" type="unsigned long" dir="out">
-        <desc>
-          Image height.
+          Saved guest screen to read from.
         </desc>
       </param>
-    </method>
-
-    <method name="readSavedScreenshotPNGToArray">
-      <desc>
-        Screenshot in PNG format is retrieved to an array of bytes.
-      </desc>
-      <param name="screenId" type="unsigned long" dir="in">
+      <param name="bitmapFormat" type="BitmapFormat" dir="in">
         <desc>
-          Saved guest screen to read from.
+          The requested format.
         </desc>
       </param>
       <param name="width" type="unsigned long" dir="out">
@@ -7116,7 +7119,7 @@
       </param>
       <param name="data" type="octet" dir="return" safearray="yes">
         <desc>
-          Array with resulting PNG data.
+          Array with resulting image data.
         </desc>
       </param>
     </method>
@@ -7159,6 +7162,17 @@
       </param>
     </method>
 
+    <method name="getEffectiveParavirtProvider"  const="yes">
+      <desc>
+        Returns the effective paravirtualization provider for this VM.
+      </desc>
+      <param name="paravirtProvider" type="ParavirtProvider" dir="return">
+        <desc>
+          The effective paravirtualization provider for this VM.
+        </desc>
+      </param>
+    </method>
+
     <method name="queryLogFilename">
       <desc>
         Queries for the VM log file name of an given index. Returns an empty
@@ -7241,109 +7255,432 @@
       </param>
     </method>
 
-  </interface>
-
-  <interface
-    name="IEmulatedUSB" extends="$unknown"
-    uuid="38cc4dfd-8bb2-4d40-aebe-699eead8c2dd"
-    wsmap="managed"
-    >
-    <desc>
-      Manages emulated USB devices.
-    </desc>
-
-    <method name="webcamAttach">
+    <method name="saveState">
       <desc>
-        Attaches the emulated USB webcam to the VM, which will use a host video capture device.
-      </desc>
-      <param name="path" type="wstring" dir="in">
-        <desc>The host path of the capture device to use.</desc>
-      </param>
-      <param name="settings" type="wstring" dir="in">
-        <desc>Optional settings.</desc>
-      </param>
-    </method>
+        Saves the current execution state of a running virtual machine
+        and stops its execution.
 
-    <method name="webcamDetach">
-      <desc>
-        Detaches the emulated USB webcam from the VM
-      </desc>
-      <param name="path" type="wstring" dir="in">
-        <desc>The host path of the capture device to detach.</desc>
-      </param>
-    </method>
+        After this operation completes, the machine will go to the
+        Saved state. Next time it is powered up, this state will
+        be restored and the machine will continue its execution from
+        the place where it was saved.
 
-    <attribute name="webcams" type="wstring" safearray="yes" readonly="yes">
-      <desc>Lists attached virtual webcams.</desc>
-    </attribute>
-  </interface>
+        This operation differs from taking a snapshot to the effect
+        that it doesn't create new differencing media. Also, once
+        the machine is powered up from the state saved using this method,
+        the saved state is deleted, so it will be impossible to return
+        to this state later.
 
-  <!--
-  // IConsole
-  /////////////////////////////////////////////////////////////////////////
-  -->
+        <note>
+          On success, this method implicitly calls
+          <link to="#saveSettings"/> to save all current machine
+          settings (including runtime changes to the DVD medium, etc.).
+          Together with the impossibility to change any VM settings when it is
+          in the Saved state, this guarantees adequate hardware
+          configuration of the machine when it is restored from the saved
+          state file.
+        </note>
 
-  <interface
-    name="IVRDEServerInfo" extends="$unknown"
-    uuid="714434a1-58c3-4aab-9049-7652c5df113b"
-    wsmap="struct"
-    >
-    <desc>
-      Contains information about the remote desktop (VRDE) server capabilities and status.
-      This is used in the <link to="IConsole::VRDEServerInfo" /> attribute.
-    </desc>
+        <note>
+          The machine must be in the Running or Paused state, otherwise
+          the operation will fail.
+        </note>
+        <result name="VBOX_E_INVALID_VM_STATE">
+          Virtual machine state neither Running nor Paused.
+        </result>
+        <result name="VBOX_E_FILE_ERROR">
+          Failed to create directory for saved state file.
+        </result>
 
-    <attribute name="active" type="boolean" readonly="yes">
-      <desc>
-        Whether the remote desktop connection is active.
+        <see><link to="#takeSnapshot"/></see>
       </desc>
-    </attribute>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
 
-    <attribute name="port" type="long" readonly="yes">
+    <method name="adoptSavedState">
       <desc>
-        VRDE server port number. If this property is equal to <tt>0</tt>, then
-        the VRDE server failed to start, usually because there are no free IP
-        ports to bind to. If this property is equal to <tt>-1</tt>, then the VRDE
-        server has not yet been started.
-      </desc>
-    </attribute>
+        Associates the given saved state file to the virtual machine.
 
-    <attribute name="numberOfClients" type="unsigned long" readonly="yes">
-      <desc>
-        How many times a client connected.
-      </desc>
-    </attribute>
+        On success, the machine will go to the Saved state. Next time it is
+        powered up, it will be restored from the adopted saved state and
+        continue execution from the place where the saved state file was
+        created.
 
-    <attribute name="beginTime" type="long long" readonly="yes">
-      <desc>
-        When the last connection was established, in milliseconds since 1970-01-01 UTC.
-      </desc>
-    </attribute>
+        The specified saved state file path may be absolute or relative to the
+        folder the VM normally saves the state to (usually,
+        <link to="#snapshotFolder"/>).
 
-    <attribute name="endTime" type="long long" readonly="yes">
-      <desc>
-        When the last connection was terminated or the current time, if
-        connection is still active, in milliseconds since 1970-01-01 UTC.
+        <note>
+          It's a caller's responsibility to make sure the given saved state
+          file is compatible with the settings of this virtual machine that
+          represent its virtual hardware (memory size, storage disk configuration
+          etc.). If there is a mismatch, the behavior of the virtual machine
+          is undefined.
+        </note>
+        <result name="VBOX_E_INVALID_VM_STATE">
+          Virtual machine state neither PoweredOff nor Aborted.
+        </result>
       </desc>
-    </attribute>
+      <param name="savedStateFile" type="wstring" dir="in">
+        <desc>Path to the saved state file to adopt.</desc>
+      </param>
+    </method>
 
-    <attribute name="bytesSent" type="long long" readonly="yes">
+    <method name="discardSavedState">
       <desc>
-        How many bytes were sent in last or current, if still active, connection.
+        Forcibly resets the machine to "Powered Off" state if it is
+        currently in the "Saved" state (previously created by <link to="#saveState"/>).
+        Next time the machine is powered up, a clean boot will occur.
+        <note>
+          This operation is equivalent to resetting or powering off
+          the machine without doing a proper shutdown of the guest
+          operating system; as with resetting a running phyiscal
+          computer, it can can lead to data loss.
+        </note>
+        If @a fRemoveFile is @c true, the file in the machine directory
+        into which the machine state was saved is also deleted. If
+        this is @c false, then the state can be recovered and later
+        re-inserted into a machine using <link to="#adoptSavedState" />.
+        The location of the file can be found in the
+        <link to="#stateFilePath" /> attribute.
+        <result name="VBOX_E_INVALID_VM_STATE">
+          Virtual machine not in state Saved.
+        </result>
       </desc>
-    </attribute>
+      <param name="fRemoveFile" type="boolean" dir="in" >
+        <desc>Whether to also remove the saved state file.</desc>
+      </param>
+    </method>
 
-    <attribute name="bytesSentTotal" type="long long" readonly="yes">
+    <method name="takeSnapshot">
       <desc>
-        How many bytes were sent in all connections.
-      </desc>
-    </attribute>
+        Saves the current execution state
+        and all settings of the machine and creates differencing images
+        for all normal (non-independent) media.
+        See <link to="ISnapshot" /> for an introduction to snapshots.
 
-    <attribute name="bytesReceived" type="long long" readonly="yes">
-      <desc>
-        How many bytes were received in last or current, if still active, connection.
-      </desc>
-    </attribute>
+        This method can be called for a PoweredOff, Saved (see
+        <link to="#saveState"/>), Running or
+        Paused virtual machine. When the machine is PoweredOff, an
+        offline snapshot is created. When the machine is Running a live
+        snapshot is created, and an online snapshot is created when Paused.
+
+        The taken snapshot is always based on the
+        <link to="#currentSnapshot">current snapshot</link>
+        of the associated virtual machine and becomes a new current snapshot.
+
+        <note>
+          This method implicitly calls <link to="#saveSettings"/> to
+          save all current machine settings before taking an offline snapshot.
+        </note>
+
+        <result name="VBOX_E_INVALID_VM_STATE">
+          Virtual machine currently changing state.
+        </result>
+      </desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>Short name for the snapshot.</desc>
+      </param>
+      <param name="description" type="wstring" dir="in">
+        <desc>Optional description of the snapshot.</desc>
+      </param>
+      <param name="pause" type="boolean" dir="in">
+        <desc>Whether the VM should be paused while taking the snapshot. Only
+          relevant when the VM is running, and distinguishes between online
+          (@c true) and live (@c false) snapshots. When the VM is not running
+          the result is always an offline snapshot.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
+
+    <method name="deleteSnapshot">
+      <desc>
+        Starts deleting the specified snapshot asynchronously.
+        See <link to="ISnapshot" /> for an introduction to snapshots.
+
+        The execution state and settings of the associated machine stored in
+        the snapshot will be deleted. The contents of all differencing media of
+        this snapshot will be merged with the contents of their dependent child
+        media to keep the medium chain valid (in other words, all changes
+        represented by media being deleted will be propagated to their child
+        medium). After that, this snapshot's differencing medium will be
+        deleted. The parent of this snapshot will become a new parent for all
+        its child snapshots.
+
+        If the deleted snapshot is the current one, its parent snapshot will
+        become a new current snapshot. The current machine state is not directly
+        affected in this case, except that currently attached differencing
+        media based on media of the deleted snapshot will be also merged as
+        described above.
+
+        If the deleted snapshot is the first or current snapshot, then the
+        respective IMachine attributes will be adjusted. Deleting the current
+        snapshot will also implicitly call <link to="#saveSettings"/>
+        to make all current machine settings permanent.
+
+        Deleting a snapshot has the following preconditions:
+
+        <ul>
+          <li>Child media of all normal media of the deleted snapshot
+          must be accessible (see <link to="IMedium::state"/>) for this
+          operation to succeed. If only one running VM refers to all images
+          which participates in merging the operation can be performed while
+          the VM is running. Otherwise all virtual machines whose media are
+          directly or indirectly based on the media of deleted snapshot must
+          be powered off. In any case, online snapshot deleting usually is
+          slower than the same operation without any running VM.</li>
+
+          <li>You cannot delete the snapshot if a medium attached to it has
+          more than one child medium (differencing images) because otherwise
+          merging would be impossible. This might be the case if there is
+          more than one child snapshot or differencing images were created
+          for other reason (e.g. implicitly because of multiple machine
+          attachments).</li>
+        </ul>
+
+        The virtual machine's <link to="#state">state</link> is
+        changed to "DeletingSnapshot", "DeletingSnapshotOnline" or
+        "DeletingSnapshotPaused" while this operation is in progress.
+
+        <note>
+          Merging medium contents can be very time and disk space
+          consuming, if these media are big in size and have many
+          children. However, if the snapshot being deleted is the last
+          (head) snapshot on the branch, the operation will be rather
+          quick.
+        </note>
+        <result name="VBOX_E_INVALID_VM_STATE">
+          The running virtual machine prevents deleting this snapshot. This
+          happens only in very specific situations, usually snapshots can be
+          deleted without trouble while a VM is running. The error message
+          text explains the reason for the failure.
+        </result>
+      </desc>
+      <param name="id" type="uuid" mod="string" dir="in">
+        <desc>UUID of the snapshot to delete.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
+
+    <method name="deleteSnapshotAndAllChildren">
+      <desc>
+        Starts deleting the specified snapshot and all its children
+        asynchronously. See <link to="ISnapshot" /> for an introduction to
+        snapshots. The conditions and many details are the same as with
+        <link to="#deleteSnapshot"/>.
+
+        This operation is very fast if the snapshot subtree does not include
+        the current state. It is still significantly faster than deleting the
+        snapshots one by one if the current state is in the subtree and there
+        are more than one snapshots from current state to the snapshot which
+        marks the subtree, since it eliminates the incremental image merging.
+
+        <note>This API method is right now not implemented!</note>
+
+        <result name="VBOX_E_INVALID_VM_STATE">
+          The running virtual machine prevents deleting this snapshot. This
+          happens only in very specific situations, usually snapshots can be
+          deleted without trouble while a VM is running. The error message
+          text explains the reason for the failure.
+        </result>
+        <result name="E_NOTIMPL">
+          The method is not implemented yet.
+        </result>
+      </desc>
+      <param name="id" type="uuid" mod="string" dir="in">
+        <desc>UUID of the snapshot to delete, including all its children.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
+
+    <method name="deleteSnapshotRange">
+      <desc>
+        Starts deleting the specified snapshot range. This is limited to
+        linear snapshot lists, which means there may not be any other child
+        snapshots other than the direct sequence between the start and end
+        snapshot. If the start and end snapshot point to the same snapshot this
+        method is completely equivalent to <link to="#deleteSnapshot"/>. See
+        <link to="ISnapshot" /> for an introduction to snapshots. The
+        conditions and many details are the same as with
+        <link to="#deleteSnapshot"/>.
+
+        This operation is generally faster than deleting snapshots one by one
+        and often also needs less extra disk space before freeing up disk space
+        by deleting the removed disk images corresponding to the snapshot.
+
+        <note>This API method is right now not implemented!</note>
+
+        <result name="VBOX_E_INVALID_VM_STATE">
+          The running virtual machine prevents deleting this snapshot. This
+          happens only in very specific situations, usually snapshots can be
+          deleted without trouble while a VM is running. The error message
+          text explains the reason for the failure.
+        </result>
+        <result name="E_NOTIMPL">
+          The method is not implemented yet.
+        </result>
+      </desc>
+      <param name="startId" type="uuid" mod="string" dir="in">
+        <desc>UUID of the first snapshot to delete.</desc>
+      </param>
+      <param name="endId" type="uuid" mod="string" dir="in">
+        <desc>UUID of the last snapshot to delete.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
+
+    <method name="restoreSnapshot">
+      <desc>
+        Starts resetting the machine's current state to the state contained
+        in the given snapshot, asynchronously. All current settings of the
+        machine will be reset and changes stored in differencing media
+        will be lost.
+        See <link to="ISnapshot" /> for an introduction to snapshots.
+
+        After this operation is successfully completed, new empty differencing
+        media are created for all normal media of the machine.
+
+        If the given snapshot is an online snapshot, the machine will go to
+        the <link to="MachineState_Saved"> saved state</link>, so that the
+        next time it is powered on, the execution state will be restored
+        from the state of the snapshot.
+
+        <note>
+          The machine must not be running, otherwise the operation will fail.
+        </note>
+
+        <note>
+          If the machine state is <link to="MachineState_Saved">Saved</link>
+          prior to this operation, the saved state file will be implicitly
+          deleted (as if <link to="IMachine::discardSavedState"/> were
+          called).
+        </note>
+
+        <result name="VBOX_E_INVALID_VM_STATE">
+          Virtual machine is running.
+        </result>
+      </desc>
+      <param name="snapshot" type="ISnapshot" dir="in">
+        <desc>The snapshot to restore the VM state from.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
+
+  </interface>
+
+  <interface
+    name="IEmulatedUSB" extends="$unknown"
+    uuid="38cc4dfd-8bb2-4d40-aebe-699eead8c2dd"
+    wsmap="managed"
+    >
+    <desc>
+      Manages emulated USB devices.
+    </desc>
+
+    <method name="webcamAttach">
+      <desc>
+        Attaches the emulated USB webcam to the VM, which will use a host video capture device.
+      </desc>
+      <param name="path" type="wstring" dir="in">
+        <desc>The host path of the capture device to use.</desc>
+      </param>
+      <param name="settings" type="wstring" dir="in">
+        <desc>Optional settings.</desc>
+      </param>
+    </method>
+
+    <method name="webcamDetach">
+      <desc>
+        Detaches the emulated USB webcam from the VM
+      </desc>
+      <param name="path" type="wstring" dir="in">
+        <desc>The host path of the capture device to detach.</desc>
+      </param>
+    </method>
+
+    <attribute name="webcams" type="wstring" safearray="yes" readonly="yes">
+      <desc>Lists attached virtual webcams.</desc>
+    </attribute>
+  </interface>
+
+  <!--
+  // IConsole
+  /////////////////////////////////////////////////////////////////////////
+  -->
+
+  <interface
+    name="IVRDEServerInfo" extends="$unknown"
+    uuid="714434a1-58c3-4aab-9049-7652c5df113b"
+    wsmap="struct"
+    >
+    <desc>
+      Contains information about the remote desktop (VRDE) server capabilities and status.
+      This is used in the <link to="IConsole::VRDEServerInfo" /> attribute.
+    </desc>
+
+    <attribute name="active" type="boolean" readonly="yes">
+      <desc>
+        Whether the remote desktop connection is active.
+      </desc>
+    </attribute>
+
+    <attribute name="port" type="long" readonly="yes">
+      <desc>
+        VRDE server port number. If this property is equal to <tt>0</tt>, then
+        the VRDE server failed to start, usually because there are no free IP
+        ports to bind to. If this property is equal to <tt>-1</tt>, then the VRDE
+        server has not yet been started.
+      </desc>
+    </attribute>
+
+    <attribute name="numberOfClients" type="unsigned long" readonly="yes">
+      <desc>
+        How many times a client connected.
+      </desc>
+    </attribute>
+
+    <attribute name="beginTime" type="long long" readonly="yes">
+      <desc>
+        When the last connection was established, in milliseconds since 1970-01-01 UTC.
+      </desc>
+    </attribute>
+
+    <attribute name="endTime" type="long long" readonly="yes">
+      <desc>
+        When the last connection was terminated or the current time, if
+        connection is still active, in milliseconds since 1970-01-01 UTC.
+      </desc>
+    </attribute>
+
+    <attribute name="bytesSent" type="long long" readonly="yes">
+      <desc>
+        How many bytes were sent in last or current, if still active, connection.
+      </desc>
+    </attribute>
+
+    <attribute name="bytesSentTotal" type="long long" readonly="yes">
+      <desc>
+        How many bytes were sent in all connections.
+      </desc>
+    </attribute>
+
+    <attribute name="bytesReceived" type="long long" readonly="yes">
+      <desc>
+        How many bytes were received in last or current, if still active, connection.
+      </desc>
+    </attribute>
 
     <attribute name="bytesReceivedTotal" type="long long" readonly="yes">
       <desc>
@@ -7393,7 +7730,7 @@
 
   <interface
     name="IConsole" extends="$unknown"
-    uuid="8ab7c520-2442-4b66-8d74-4ff1e195d2b6"
+    uuid="650b5f05-8258-4ee9-b518-89c515ca5dd9"
     wsmap="managed"
     >
     <desc>
@@ -7574,7 +7911,7 @@
         last three operations of the progress objected returned by
         <link to="IMachine::launchVMProcess"/> as well.
 
-        <see><link to="#saveState"/></see>
+        <see><link to="IMachine::saveState"/></see>
 
         <result name="VBOX_E_INVALID_VM_STATE">
           Virtual machine already running.
@@ -7673,146 +8010,47 @@
         </result>
       </desc>
     </method>
-
-    <method name="sleepButton">
-      <desc>Sends the ACPI sleep button event to the guest.
-        <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine not in Running state.
-        </result>
-        <result name="VBOX_E_PDM_ERROR">
-          Sending sleep button event failed.
-        </result>
-      </desc>
-    </method>
-
-    <method name="getPowerButtonHandled">
-      <desc>Checks if the last power button event was handled by guest.
-        <result name="VBOX_E_PDM_ERROR">
-          Checking if the event was handled by the guest OS failed.
-        </result>
-      </desc>
-      <param name="handled" type="boolean" dir="return"/>
-    </method>
-
-    <method name="getGuestEnteredACPIMode">
-      <desc>Checks if the guest entered the ACPI mode G0 (working) or
-        G1 (sleeping). If this method returns @c false, the guest will
-        most likely not respond to external ACPI events.
-        <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine not in Running state.
-        </result>
-      </desc>
-      <param name="entered" type="boolean" dir="return"/>
-    </method>
-
-    <method name="saveState">
-      <desc>
-        Saves the current execution state of a running virtual machine
-        and stops its execution.
-
-        After this operation completes, the machine will go to the
-        Saved state. Next time it is powered up, this state will
-        be restored and the machine will continue its execution from
-        the place where it was saved.
-
-        This operation differs from taking a snapshot to the effect
-        that it doesn't create new differencing media. Also, once
-        the machine is powered up from the state saved using this method,
-        the saved state is deleted, so it will be impossible to return
-        to this state later.
-
-        <note>
-          On success, this method implicitly calls
-          <link to="IMachine::saveSettings"/> to save all current machine
-          settings (including runtime changes to the DVD medium, etc.).
-          Together with the impossibility to change any VM settings when it is
-          in the Saved state, this guarantees adequate hardware
-          configuration of the machine when it is restored from the saved
-          state file.
-        </note>
-
-        <note>
-          The machine must be in the Running or Paused state, otherwise
-          the operation will fail.
-        </note>
+
+    <method name="sleepButton">
+      <desc>Sends the ACPI sleep button event to the guest.
         <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine state neither Running nor Paused.
+          Virtual machine not in Running state.
         </result>
-        <result name="VBOX_E_FILE_ERROR">
-          Failed to create directory for saved state file.
+        <result name="VBOX_E_PDM_ERROR">
+          Sending sleep button event failed.
         </result>
-
-        <see><link to="#takeSnapshot"/></see>
       </desc>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
-      </param>
     </method>
 
-    <method name="adoptSavedState">
-      <desc>
-        Associates the given saved state file to the virtual machine.
-
-        On success, the machine will go to the Saved state. Next time it is
-        powered up, it will be restored from the adopted saved state and
-        continue execution from the place where the saved state file was
-        created.
-
-        The specified saved state file path may be absolute or relative to the
-        folder the VM normally saves the state to (usually,
-        <link to="IMachine::snapshotFolder"/>).
-
-        <note>
-          It's a caller's responsibility to make sure the given saved state
-          file is compatible with the settings of this virtual machine that
-          represent its virtual hardware (memory size, storage disk configuration
-          etc.). If there is a mismatch, the behavior of the virtual machine
-          is undefined.
-        </note>
-        <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine state neither PoweredOff nor Aborted.
+    <method name="getPowerButtonHandled">
+      <desc>Checks if the last power button event was handled by guest.
+        <result name="VBOX_E_PDM_ERROR">
+          Checking if the event was handled by the guest OS failed.
         </result>
       </desc>
-      <param name="savedStateFile" type="wstring" dir="in">
-        <desc>Path to the saved state file to adopt.</desc>
-      </param>
+      <param name="handled" type="boolean" dir="return"/>
     </method>
 
-    <method name="discardSavedState">
-      <desc>
-        Forcibly resets the machine to "Powered Off" state if it is
-        currently in the "Saved" state (previously created by <link to="#saveState"/>).
-        Next time the machine is powered up, a clean boot will occur.
-        <note>
-          This operation is equivalent to resetting or powering off
-          the machine without doing a proper shutdown of the guest
-          operating system; as with resetting a running phyiscal
-          computer, it can can lead to data loss.
-        </note>
-        If @a fRemoveFile is @c true, the file in the machine directory
-        into which the machine state was saved is also deleted. If
-        this is @c false, then the state can be recovered and later
-        re-inserted into a machine using <link to="#adoptSavedState" />.
-        The location of the file can be found in the
-        <link to="IMachine::stateFilePath" /> attribute.
+    <method name="getGuestEnteredACPIMode">
+      <desc>Checks if the guest entered the ACPI mode G0 (working) or
+        G1 (sleeping). If this method returns @c false, the guest will
+        most likely not respond to external ACPI events.
         <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine not in state Saved.
+          Virtual machine not in Running state.
         </result>
       </desc>
-      <param name="fRemoveFile" type="boolean" dir="in" >
-        <desc>Whether to also remove the saved state file.</desc>
-      </param>
+      <param name="entered" type="boolean" dir="return"/>
     </method>
 
     <method name="getDeviceActivity">
       <desc>
-        Gets the current activity type of a given device or device group.
+        Gets the current activity type of given devices or device groups.
         <result name="E_INVALIDARG">
           Invalid device type.
         </result>
       </desc>
-      <param name="type" type="DeviceType" dir="in"/>
-      <param name="activity" type="DeviceActivity" dir="return"/>
+      <param name="type" type="DeviceType" safearray="yes" dir="in"/>
+      <param name="activity" type="DeviceActivity" safearray="yes" dir="return"/>
     </method>
 
     <method name="attachUSBDevice">
@@ -7842,6 +8080,9 @@
       <param name="id" type="uuid" mod="string" dir="in">
         <desc>UUID of the host USB device to attach.</desc>
       </param>
+      <param name="captureFilename" type="wstring" dir="in">
+        <desc>Filename to capture the USB traffic to.</desc>
+      </param>
     </method>
 
     <method name="detachUSBDevice">
@@ -7906,272 +8147,54 @@
       <param name="id" type="uuid" mod="string" dir="in">
         <desc>UUID of the USB device to search for.</desc>
       </param>
-      <param name="device" type="IUSBDevice" dir="return">
-        <desc>Found USB device object.</desc>
-      </param>
-    </method>
-
-    <method name="createSharedFolder">
-      <desc>
-        Creates a transient new shared folder by associating the given logical
-        name with the given host path, adds it to the collection of shared
-        folders and starts sharing it. Refer to the description of
-        <link to="ISharedFolder"/> to read more about logical names.
-
-        <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine in Saved state or currently changing state.
-        </result>
-        <result name="VBOX_E_FILE_ERROR">
-          Shared folder already exists or not accessible.
-        </result>
-      </desc>
-      <param name="name" type="wstring" dir="in">
-        <desc>Unique logical name of the shared folder.</desc>
-      </param>
-      <param name="hostPath" type="wstring" dir="in">
-        <desc>Full path to the shared folder in the host file system.</desc>
-      </param>
-      <param name="writable" type="boolean" dir="in">
-        <desc>Whether the share is writable or readonly</desc>
-      </param>
-      <param name="automount" type="boolean" dir="in">
-        <desc>Whether the share gets automatically mounted by the guest
-          or not.</desc>
-      </param>
-    </method>
-
-    <method name="removeSharedFolder">
-      <desc>
-        Removes a transient shared folder with the given name previously
-        created by <link to="#createSharedFolder"/> from the collection of
-        shared folders and stops sharing it.
-        <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine in Saved state or currently changing state.
-        </result>
-        <result name="VBOX_E_FILE_ERROR">
-          Shared folder does not exists.
-        </result>
-      </desc>
-      <param name="name" type="wstring" dir="in">
-        <desc>Logical name of the shared folder to remove.</desc>
-      </param>
-    </method>
-
-    <method name="takeSnapshot">
-      <desc>
-        Saves the current execution state
-        and all settings of the machine and creates differencing images
-        for all normal (non-independent) media.
-        See <link to="ISnapshot" /> for an introduction to snapshots.
-
-        This method can be called for a PoweredOff, Saved (see
-        <link to="#saveState"/>), Running or
-        Paused virtual machine. When the machine is PoweredOff, an
-        offline snapshot is created. When the machine is Running a live
-        snapshot is created, and an online snapshot is created when Paused.
-
-        The taken snapshot is always based on the
-        <link to="IMachine::currentSnapshot">current snapshot</link>
-        of the associated virtual machine and becomes a new current snapshot.
-
-        <note>
-          This method implicitly calls <link to="IMachine::saveSettings"/> to
-          save all current machine settings before taking an offline snapshot.
-        </note>
-
-        <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine currently changing state.
-        </result>
-      </desc>
-      <param name="name" type="wstring" dir="in">
-        <desc>Short name for the snapshot.</desc>
-      </param>
-      <param name="description" type="wstring" dir="in">
-        <desc>Optional description of the snapshot.</desc>
-      </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
-      </param>
-    </method>
-
-    <method name="deleteSnapshot">
-      <desc>
-        Starts deleting the specified snapshot asynchronously.
-        See <link to="ISnapshot" /> for an introduction to snapshots.
-
-        The execution state and settings of the associated machine stored in
-        the snapshot will be deleted. The contents of all differencing media of
-        this snapshot will be merged with the contents of their dependent child
-        media to keep the medium chain valid (in other words, all changes
-        represented by media being deleted will be propagated to their child
-        medium). After that, this snapshot's differencing medium will be
-        deleted. The parent of this snapshot will become a new parent for all
-        its child snapshots.
-
-        If the deleted snapshot is the current one, its parent snapshot will
-        become a new current snapshot. The current machine state is not directly
-        affected in this case, except that currently attached differencing
-        media based on media of the deleted snapshot will be also merged as
-        described above.
-
-        If the deleted snapshot is the first or current snapshot, then the
-        respective IMachine attributes will be adjusted. Deleting the current
-        snapshot will also implicitly call <link to="IMachine::saveSettings"/>
-        to make all current machine settings permanent.
-
-        Deleting a snapshot has the following preconditions:
-
-        <ul>
-          <li>Child media of all normal media of the deleted snapshot
-          must be accessible (see <link to="IMedium::state"/>) for this
-          operation to succeed. If only one running VM refers to all images
-          which participates in merging the operation can be performed while
-          the VM is running. Otherwise all virtual machines whose media are
-          directly or indirectly based on the media of deleted snapshot must
-          be powered off. In any case, online snapshot deleting usually is
-          slower than the same operation without any running VM.</li>
-
-          <li>You cannot delete the snapshot if a medium attached to it has
-          more than one child medium (differencing images) because otherwise
-          merging would be impossible. This might be the case if there is
-          more than one child snapshot or differencing images were created
-          for other reason (e.g. implicitly because of multiple machine
-          attachments).</li>
-        </ul>
-
-        The virtual machine's <link to="IMachine::state">state</link> is
-        changed to "DeletingSnapshot", "DeletingSnapshotOnline" or
-        "DeletingSnapshotPaused" while this operation is in progress.
-
-        <note>
-          Merging medium contents can be very time and disk space
-          consuming, if these media are big in size and have many
-          children. However, if the snapshot being deleted is the last
-          (head) snapshot on the branch, the operation will be rather
-          quick.
-        </note>
-        <result name="VBOX_E_INVALID_VM_STATE">
-          The running virtual machine prevents deleting this snapshot. This
-          happens only in very specific situations, usually snapshots can be
-          deleted without trouble while a VM is running. The error message
-          text explains the reason for the failure.
-        </result>
-      </desc>
-      <param name="id" type="uuid" mod="string" dir="in">
-        <desc>UUID of the snapshot to delete.</desc>
-      </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
-      </param>
-    </method>
-
-    <method name="deleteSnapshotAndAllChildren">
-      <desc>
-        Starts deleting the specified snapshot and all its children
-        asynchronously. See <link to="ISnapshot" /> for an introduction to
-        snapshots. The conditions and many details are the same as with
-        <link to="#deleteSnapshot"/>.
-
-        This operation is very fast if the snapshot subtree does not include
-        the current state. It is still significantly faster than deleting the
-        snapshots one by one if the current state is in the subtree and there
-        are more than one snapshots from current state to the snapshot which
-        marks the subtree, since it eliminates the incremental image merging.
-
-        <note>This API method is right now not implemented!</note>
-
-        <result name="VBOX_E_INVALID_VM_STATE">
-          The running virtual machine prevents deleting this snapshot. This
-          happens only in very specific situations, usually snapshots can be
-          deleted without trouble while a VM is running. The error message
-          text explains the reason for the failure.
-        </result>
-        <result name="E_NOTIMPL">
-          The method is not implemented yet.
-        </result>
-      </desc>
-      <param name="id" type="uuid" mod="string" dir="in">
-        <desc>UUID of the snapshot to delete, including all its children.</desc>
-      </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
-      </param>
+      <param name="device" type="IUSBDevice" dir="return">
+        <desc>Found USB device object.</desc>
+      </param>
     </method>
 
-    <method name="deleteSnapshotRange">
+    <method name="createSharedFolder">
       <desc>
-        Starts deleting the specified snapshot range. This is limited to
-        linear snapshot lists, which means there may not be any other child
-        snapshots other than the direct sequence between the start and end
-        snapshot. If the start and end snapshot point to the same snapshot this
-        method is completely equivalent to <link to="#deleteSnapshot"/>. See
-        <link to="ISnapshot" /> for an introduction to snapshots. The
-        conditions and many details are the same as with
-        <link to="#deleteSnapshot"/>.
-
-        This operation is generally faster than deleting snapshots one by one
-        and often also needs less extra disk space before freeing up disk space
-        by deleting the removed disk images corresponding to the snapshot.
-
-        <note>This API method is right now not implemented!</note>
+        Creates a transient new shared folder by associating the given logical
+        name with the given host path, adds it to the collection of shared
+        folders and starts sharing it. Refer to the description of
+        <link to="ISharedFolder"/> to read more about logical names.
 
         <result name="VBOX_E_INVALID_VM_STATE">
-          The running virtual machine prevents deleting this snapshot. This
-          happens only in very specific situations, usually snapshots can be
-          deleted without trouble while a VM is running. The error message
-          text explains the reason for the failure.
+          Virtual machine in Saved state or currently changing state.
         </result>
-        <result name="E_NOTIMPL">
-          The method is not implemented yet.
+        <result name="VBOX_E_FILE_ERROR">
+          Shared folder already exists or not accessible.
         </result>
       </desc>
-      <param name="startId" type="uuid" mod="string" dir="in">
-        <desc>UUID of the first snapshot to delete.</desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>Unique logical name of the shared folder.</desc>
       </param>
-      <param name="endId" type="uuid" mod="string" dir="in">
-        <desc>UUID of the last snapshot to delete.</desc>
+      <param name="hostPath" type="wstring" dir="in">
+        <desc>Full path to the shared folder in the host file system.</desc>
       </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
+      <param name="writable" type="boolean" dir="in">
+        <desc>Whether the share is writable or readonly</desc>
+      </param>
+      <param name="automount" type="boolean" dir="in">
+        <desc>Whether the share gets automatically mounted by the guest
+          or not.</desc>
       </param>
     </method>
 
-    <method name="restoreSnapshot">
+    <method name="removeSharedFolder">
       <desc>
-        Starts resetting the machine's current state to the state contained
-        in the given snapshot, asynchronously. All current settings of the
-        machine will be reset and changes stored in differencing media
-        will be lost.
-        See <link to="ISnapshot" /> for an introduction to snapshots.
-
-        After this operation is successfully completed, new empty differencing
-        media are created for all normal media of the machine.
-
-        If the given snapshot is an online snapshot, the machine will go to
-        the <link to="MachineState_Saved"> saved state</link>, so that the
-        next time it is powered on, the execution state will be restored
-        from the state of the snapshot.
-
-        <note>
-          The machine must not be running, otherwise the operation will fail.
-        </note>
-
-        <note>
-          If the machine state is <link to="MachineState_Saved">Saved</link>
-          prior to this operation, the saved state file will be implicitly
-          deleted (as if <link to="IConsole::discardSavedState"/> were
-          called).
-        </note>
-
+        Removes a transient shared folder with the given name previously
+        created by <link to="#createSharedFolder"/> from the collection of
+        shared folders and stops sharing it.
         <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine is running.
+          Virtual machine in Saved state or currently changing state.
+        </result>
+        <result name="VBOX_E_FILE_ERROR">
+          Shared folder does not exists.
         </result>
       </desc>
-      <param name="snapshot" type="ISnapshot" dir="in">
-        <desc>The snapshot to restore the VM state from.</desc>
-      </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>Logical name of the shared folder to remove.</desc>
       </param>
     </method>
 
@@ -8179,7 +8202,7 @@
       <desc>
         Teleport the VM to a different host machine or process.
 
-        TODO explain the details.
+        @todo Explain the details.
 
         <result name="VBOX_E_INVALID_VM_STATE">
           Virtual machine not running or paused.
@@ -8214,6 +8237,76 @@
       </param>
     </method>
 
+    <method name="addDiskEncryptionPassword">
+      <desc>
+        Adds a password used for hard disk encryption/decryption.
+
+        <result name="VBOX_E_PASSWORD_INCORRECT">
+          The password provided wasn't correct for at least one disk using the provided
+          ID.
+        </result>
+      </desc>
+      <param name="id" type="wstring" dir="in">
+        <desc>
+          The identifier used for the password. Must match the identifier
+          used when the encrypted medium was created.
+        </desc>
+      </param>
+      <param name="password" type="wstring" dir="in">
+        <desc>The password.</desc>
+      </param>
+      <param name="clearOnSuspend" type="boolean" dir="in">
+        <desc>
+          Flag whether to clear the password on VM suspend (due to a suspending host
+          for example). The password must be supplied again before the VM can resume.
+        </desc>
+      </param>
+    </method>
+
+    <method name="addDiskEncryptionPasswords">
+      <desc>
+        Adds a password used for hard disk encryption/decryption.
+
+        <result name="VBOX_E_PASSWORD_INCORRECT">
+          The password provided wasn't correct for at least one disk using the provided
+          ID.
+        </result>
+      </desc>
+      <param name="ids" type="wstring" dir="in" safearray="yes">
+        <desc>
+          List of identifiers for the passwords. Must match the identifier
+          used when the encrypted medium was created.
+        </desc>
+      </param>
+      <param name="passwords" type="wstring" dir="in" safearray="yes">
+        <desc>List of passwords.</desc>
+      </param>
+      <param name="clearOnSuspend" type="boolean" dir="in">
+        <desc>
+          Flag whether to clear the given passwords on VM suspend (due to a suspending host
+          for example). The passwords must be supplied again before the VM can resume.
+        </desc>
+      </param>
+    </method>
+
+    <method name="removeDiskEncryptionPassword">
+      <desc>
+        Removes a password used for hard disk encryption/decryption from
+        the running VM. As soon as the medium requiring this password
+        is accessed the VM is paused with an error and the password must be
+        provided again.
+      </desc>
+      <param name="id" type="wstring" dir="in">
+        <desc>
+          The identifier used for the password. Must match the identifier
+          used when the encrypted medium was created.
+        </desc>
+      </param>
+    </method>
+
+    <method name="clearAllDiskEncryptionPasswords">
+      <desc>Clears all provided supplied disk encryption passwords.</desc>
+    </method>
   </interface>
 
   <!--
@@ -8893,7 +8986,7 @@
   <interface
     name="ISystemProperties"
     extends="$unknown"
-    uuid="1254a96a-ae57-4484-946a-22d86c1f98af"
+    uuid="2dc77d62-27e7-4e6e-87eb-b41ae0d555da"
     wsmap="managed"
     >
     <desc>
@@ -9008,7 +9101,7 @@
 
         Keep in mind that the medium format identifier
         (<link to="IMediumFormat::id"/>) used in other API calls like
-        <link to="IVirtualBox::createHardDisk"/> to refer to a particular
+        <link to="IVirtualBox::createMedium"/> to refer to a particular
         medium format is a case-insensitive string. This means that, for
         example, all of the following strings:
         <pre>
@@ -9031,7 +9124,7 @@
 
         The medium format set by this attribute is used by VirtualBox
         when the medium format was not specified explicitly. One example is
-        <link to="IVirtualBox::createHardDisk"/> with the empty
+        <link to="IVirtualBox::createMedium"/> with the empty
         format argument. A more complex example is implicit creation of
         differencing media when taking a snapshot of a virtual machine:
         this operation will try to use a format of the parent medium first
@@ -9055,7 +9148,7 @@
         <see>
           <link to="#mediumFormats"/>,
           <link to="IMediumFormat::id"/>,
-          <link to="IVirtualBox::createHardDisk"/>
+          <link to="IVirtualBox::createMedium"/>
         </see>
       </desc>
     </attribute>
@@ -9187,6 +9280,13 @@
       </desc>
     </attribute>
 
+    <attribute name="screenShotFormats" type="BitmapFormat" safearray="yes" readonly="yes">
+      <desc>
+        Supported bitmap formats which can be used with takeScreenShot
+        and takeScreenShotToArray methods.
+      </desc>
+    </attribute>
+
     <method name="getMaxNetworkAdapters">
       <desc>
         Maximum total number of network adapters associated with every
@@ -9297,7 +9397,7 @@
       </param>
     </method>
 
-    <method name="getDefaultIoCacheSettingForStorageController">
+    <method name="getDefaultIoCacheSettingForStorageController" dtracename="getDefaultStorageCtrlCacheSetting">
       <desc>Returns the default I/O cache setting for the
         given storage controller</desc>
 
@@ -9310,6 +9410,19 @@
       </param>
     </method>
 
+    <method name="getStorageControllerHotplugCapable">
+      <desc>Returns whether the given storage controller supports
+        hot-plugging devices.</desc>
+
+      <param name="controllerType" type="StorageControllerType" dir="in">
+        <desc>The storage controller to check for.</desc>
+      </param>
+
+      <param name="hotplugCapable" type="boolean" dir="return">
+        <desc>Returned flag indicating whether the controller is hotplug capable</desc>
+      </param>
+    </method>
+
     <method name="getMaxInstancesOfUSBControllerType">
       <desc>Returns the maximum number of USB controller instances which
         can be configured for each VM. This corresponds to the number of
@@ -9337,7 +9450,7 @@
 
   <interface
     name="IGuestOSType" extends="$unknown"
-    uuid="6d968f9a-858b-4c50-bf17-241f069e94c2"
+    uuid="ced74f7e-4c08-4d19-883a-017496ada2e1"
     wsmap="struct"
     >
     <desc>
@@ -9451,6 +9564,10 @@
       <desc>Returns @c true a USB controller is recommended for this OS type.</desc>
     </attribute>
 
+    <attribute name="recommendedTFReset" type="boolean" readonly="yes">
+      <desc>Returns @c true if using VCPU reset on triple fault is recommended for this OS type.</desc>
+    </attribute>
+
   </interface>
 
   <enum
@@ -9764,7 +9881,7 @@
     <const name="Locked"                  value="3">
       <desc>A guest user has locked its account. This might
         include running a password-protected screensaver
-        on the guest.
+        in the guest.
         <note>This property is not implemented yet!</note>
       </desc>
     </const>
@@ -9787,7 +9904,7 @@
           reporting contiguous idle times up to 49.7 days per user.</note>
         The event will be triggered if a guest user is not active for
         at least 5 seconds. This threshold can be adjusted by either altering
-        VBoxService's command line on the guest to
+        VBoxService's command line in the guest to
         <pre>--vminfo-user-idle-threshold <ms></pre>
         , or by setting the per-VM guest property
         <pre>/VirtualBox/GuestAdd/VBoxService/--vminfo-user-idle-threshold <ms></pre>
@@ -9848,19 +9965,23 @@
   </enum>
 
   <enum
-    name="FileSeekType"
-    uuid="1b73f4f3-3515-4073-a506-76878d9e2541"
+    name="FileSeekOrigin"
+    uuid="ad32f789-4279-4530-979c-f16892e1c263"
     >
     <desc>
-      File seeking types.
+      What a file seek (<link to="IFile::seek"/>) is relative to.
     </desc>
 
-    <const name="Set"                   value="0">
-      <desc>Seek from the start of the file.</desc>
+    <const name="Begin"                 value="0">
+      <desc>Seek from the beginning of the file.</desc>
     </const>
     <const name="Current"               value="1">
       <desc>Seek from the current file position.</desc>
     </const>
+    <const name="End"                   value="2">
+      <desc>Seek relative to the end of the file.  To seek to the position two
+        bytes from the end of the file, specify -2 as the seek offset.</desc>
+    </const>
   </enum>
 
   <enum
@@ -9933,7 +10054,7 @@
 
       To wait for a guest process to terminate after it has been
       created by <link to="IGuestSession::processCreate"/> or <link to="IGuestSession::processCreateEx"/>
-      one would specify ProcessWaitResult_Terminate.
+      one would specify ProcessWaitFor_Terminate.
 
       If a guest process has been started with ProcessCreateFlag_WaitForStdOut
       a client can wait with ProcessWaitResult_StdOut for new data to arrive on
@@ -9961,15 +10082,12 @@
     </const>
     <const name="Timeout"               value="5">
       <desc>
-        The waiting operation timed out. This also will happen
-        when no event has been occurred matching the
-        current waiting flags in a <link to="IProcess::waitFor"/> call.
+        The waiting operation timed out. Also use if the guest process has
+        timed out in the guest side (kill attempted).
       </desc>
     </const>
     <const name="StdIn"                 value="6">
-      <desc>
-        The process signalled that stdin became available for writing
-        and that the process awaits input now.</desc>
+      <desc>The process signalled that stdin became available for writing.</desc>
     </const>
     <const name="StdOut"                value="7">
       <desc>Data on stdout became available for reading.</desc>
@@ -9986,26 +10104,67 @@
   </enum>
 
   <enum
-    name="CopyFileFlag"
-    uuid="23f79fdf-738a-493d-b80b-42d607c9b916"
+    name="FileCopyFlag"
+    uuid="791909d7-4c64-2fa4-4303-adb10658d347"
     >
     <desc>
       File copying flags.
+      <note>Not flags are implemented yet.</note>
+    </desc>
+    <const name="None"                  value="0">
+      <desc>No flag set.</desc>
+    </const>
+    <const name="NoReplace"             value="1">
+      <!-- Would make more sense to not replace by default, however we the GAs
+           only supports replacing as of writing, so we currently have no choice. -->
+      <desc>
+        Do not replace the destination file if it exists.
+        <note>This flag is not implemented yet.</note>
+      </desc>
+    </const>
+    <const name="FollowLinks"           value="2">
+      <desc>
+        Follow symbolic links.
+        <note>This flag is not implemented yet.</note>
+      </desc>
+    </const>
+    <const name="Update"                value="4">
+      <desc>
+        Only copy when the source file is newer than the destination file
+        or when the destination file is missing.
+        <note>This flag is not implemented yet.</note>
+      </desc>
+    </const>
+  </enum>
+
+  <enum
+    name="FsObjMoveFlags"
+    uuid="98fdd11f-4063-ac60-5737-e49092aab95f"
+    >
+    <desc>
+      File moving flags.
     </desc>
     <const name="None"                  value="0">
       <desc>No flag set.</desc>
     </const>
-    <const name="Recursive"             value="1">
-      <desc>Copy directories recursively.
-        This flag is not implemented yet.</desc>
+    <const name="Replace"               value="1">
+      <desc>
+        Replace the destination file, symlink, etc if it exists, however this
+        does not allow replacing any directories.
+      </desc>
     </const>
-    <const name="Update"                value="2">
-      <desc>Only copy when the source file is newer than the destination file
-        or when the destination file is missing. This flag is not implemented
-        yet.</desc>
+    <const name="FollowLinks"           value="2">
+      <desc>
+        Follow symbolic links in the final components or not (only applied to
+        the given source and target paths, not to anything else).
+      </desc>
     </const>
-    <const name="FollowLinks"           value="4">
-      <desc>Follow symbolic links. This flag is not implemented yet.</desc>
+    <const name="AllowDirectoryMoves"   value="4">
+      <desc>
+        Allow moving directories accross file system boundraries. Because it
+        is could be a big undertaking, we require extra assurance that we
+        should do it when requested.
+      </desc>
     </const>
   </enum>
 
@@ -10025,11 +10184,33 @@
   </enum>
 
   <enum
+    name="DirectoryCopyFlags"
+    uuid="cc500f0c-4a54-88c9-56b3-7e9310416da7"
+    >
+    <desc>
+      Directory copying flags.
+      <note>Not flags are implemented yet.</note>
+    </desc>
+    <const name="None"                  value="0">
+      <desc>No flag set.</desc>
+    </const>
+    <const name="CopyIntoExisting"      value="1">
+      <desc>Allow copying into an existing destination directory.</desc>
+    </const>
+    <!-- Later, basically have to see what cp and xcopy offers. -->
+  </enum>
+
+  <enum
     name="DirectoryRemoveRecFlag"
     uuid="455aabf0-7692-48f6-9061-f21579b65769"
     >
     <desc>
       Directory recursive removement flags.
+      <note>
+        WARNING!! THE FLAGS ARE CURRENTLY IGNORED. THE METHOD APPLIES
+                  <link to="DirectoryRemoveRecFlag_ContentAndDir"/> REGARDLESS
+                  OF THE INPUT.
+      </note>
     </desc>
 
     <const name="None"                  value="0">
@@ -10044,30 +10225,26 @@
   </enum>
 
   <enum
-    name="PathRenameFlag"
-    uuid="f3baa09f-c758-453d-b91c-c7787d76351d"
+    name="FsObjRenameFlag"
+    uuid="59bbf3a1-4e23-d7cf-05d5-ccae32080ed2"
     >
     <desc>
-      Path renaming flags.
+      Flags for use when renaming file system objects (files, directories,
+      symlink, etc), see <link to="IGuestSession::fsObjRename"/>.
     </desc>
 
-    <const name="None"                  value="0">
-      <desc>No flag set.</desc>
-    </const>
-    <const name="NoReplace"             value="1">
-      <desc>Do not replace anything.</desc>
-    </const>
-    <const name="Replace"               value="2">
-      <desc>This will replace attempt any target which isn't a directory.</desc>
+    <const name="NoReplace"             value="0">
+      <desc>Do not replace any destination object.</desc>
     </const>
-    <const name="NoSymlinks"            value="4">
-      <desc>Don't allow symbolic links as part of the path.</desc>
+    <const name="Replace"               value="1">
+      <desc>This will attempt to replace any destination object other except
+        directories. (The default is to fail if the destination exists.)</desc>
     </const>
   </enum>
 
   <enum
     name="ProcessCreateFlag"
-    uuid="35192799-bfde-405d-9bea-c735ab9998e4"
+    uuid="be8c8dbd-4a76-e9ac-20df-468e86edf383"
     >
     <desc>
       Guest process execution flags.
@@ -10099,7 +10276,13 @@
       <desc>The guest process waits until all data from stderr is read out.</desc>
     </const>
     <const name="ExpandArguments"           value="64">
-      <desc>Expands environment variables in process arguments.</desc>
+      <desc>Expands environment variables in process arguments.
+        <note>
+          This is not yet implemented and is currently silently ignored.
+          We will document the protocolVersion number for this feature once it
+          appears, so don't use it till then.
+        </note>
+      </desc>
     </const>
     <const name="UnquotedArguments"         value="128">
       <desc>Work around for Windows and OS/2 applications not following normal
@@ -10131,7 +10314,8 @@
     uuid="37794668-f8f1-4714-98a5-6f8fa2ed0118"
     >
     <desc>
-      Symbolic link types.
+      Symbolic link types.  This is significant when creating links on the
+      Windows platform, ignored elsewhere.
     </desc>
 
     <const name="Unknown"               value="0">
@@ -10141,7 +10325,7 @@
       <desc>The link targets a directory.</desc>
     </const>
     <const name="File"                  value="2">
-      <desc>The link targets a file (or whatever else).</desc>
+      <desc>The link targets a file (or whatever else except directories).</desc>
     </const>
   </enum>
 
@@ -10199,36 +10383,175 @@
     <const name="TimedOutAbnormally"    value="513">
       <desc>Process timed out and was not killed successfully.</desc>
     </const>
-    <const name="Down"                  value="600">
-      <desc>Service/OS is stopping, process was killed.</desc>
+    <const name="Down"                  value="600">
+      <desc>Service/OS is stopping, process was killed.</desc>
+    </const>
+    <const name="Error"                 value="800">
+      <desc>Something went wrong.</desc>
+    </const>
+  </enum>
+
+  <enum
+    name="ProcessInputStatus"
+    uuid="a4a0ef9c-29cc-4805-9803-c8215ae9da6c"
+    >
+    <desc>
+      Process input statuses.
+    </desc>
+
+    <const name="Undefined"             value="0">
+      <desc>Undefined state.</desc>
+    </const>
+    <const name="Broken"                value="1">
+      <desc>Input pipe is broken.</desc>
+    </const>
+    <const name="Available"             value="10">
+      <desc>Input pipe became available for writing.</desc>
+    </const>
+    <const name="Written"               value="50">
+      <desc>Data has been successfully written.</desc>
+    </const>
+    <const name="Overflow"              value="100">
+      <desc>Too much input data supplied, data overflow.</desc>
+    </const>
+  </enum>
+
+  <enum
+    name="PathStyle"
+    uuid="97303a5b-42e8-0a55-d16f-d2a92c295261"
+    >
+    <desc>
+      The path style of a system.
+      (Values matches the RTPATH_STR_F_STYLE_XXX defines in iprt/path.h!)
+    </desc>
+    <const name="DOS"     value="1">
+      <desc>DOS-style paths with forward and backward slashes, drive
+      letters and UNC.  Known from DOS, OS/2 and Windows.</desc>
+    </const>
+    <const name="UNIX"    value="2">
+      <desc>UNIX-style paths with forward slashes only.</desc>
+    </const>
+    <const name="Unknown" value="8">
+      <desc>
+        The path style is not known, most likely because the guest additions
+        aren't active yet.
+      </desc>
+    </const>
+  </enum>
+
+  <enum
+    name="FileAccessMode"
+    uuid="231a578f-47fb-ea30-3b3e-8489558227f0"
+    >
+    <desc>
+      File open access mode for use with <link to="IGuestSession::fileOpen"/>
+      and <link to="IGuestSession::fileOpenEx"/>.
+    </desc>
+    <const name="ReadOnly"   value="1">
+      <desc>Open the file only with read access.</desc>
+    </const>
+    <const name="WriteOnly"  value="2">
+      <desc>Open the file only with write access.</desc>
+    </const>
+    <const name="ReadWrite"  value="3">
+      <desc>Open the file with both read and write access.</desc>
+    </const>
+    <const name="AppendOnly" value="4">
+      <desc>Open the file for appending only, no read or seek access.
+        <note>Not yet implemented.</note>
+      </desc>
+    </const>
+    <const name="AppendRead" value="5">
+      <desc>Open the file for appending and read.  Writes always goes to the
+        end of the file while reads are done at the current or specified file
+        position.
+        <note>Not yet implemented.</note>
+      </desc>
+    </const>
+  </enum>
+
+  <enum
+    name="FileOpenAction"
+    uuid="12bc97e2-4fc6-a8b4-4f84-0cbf4ab970d2"
+    >
+    <desc>
+      What action <link to="IGuestSession::fileOpen"/> and <link to="IGuestSession::fileOpenEx"/>
+      should take whether the file being opened exists or not.
+    </desc>
+    <const name="OpenExisting"            value="1">
+      <desc>Opens an existing file, fails if no file exists. (Was "oe".)</desc>
+    </const>
+    <const name="OpenOrCreate"            value="2">
+      <desc>Opens an existing file, creates a new one if no file exists. (Was "oc".)</desc>
+    </const>
+    <const name="CreateNew"               value="3">
+      <desc>Creates a new file is no file exists, fails if there is a file there already. (Was "ce".)</desc>
+    </const>
+    <const name="CreateOrReplace"         value="4">
+      <desc>
+        Creates a new file, replace any existing file. (Was "ca".)
+        <note>
+          Currently undefined whether we will inherit mode and ACLs from the
+          existing file or replace them.
+        </note>
+      </desc>
+    </const>
+    <const name="OpenExistingTruncated"   value="5">
+      <desc>Opens and truncate an existing file, fails if no file exists. (Was "ot".)</desc>
     </const>
-    <const name="Error"                 value="800">
-      <desc>Something went wrong.</desc>
+    <const name="AppendOrCreate"          value="99">
+      <desc>Opens an existing file and places the file pointer at the end of
+        the file, creates the file if it does not exist.  This action implies
+        write access. (Was "oa".)
+        <note>
+          <!-- @todo r=bird: See iprt/file.h, RTFILE_O_APPEND - not an action/disposition!
+              Moving the file pointer to the end, is almost fine, but impliying 'write' access
+              isn't. That is something that is exclusively reserved for the opening mode. -->
+          Deprecated. Only here for historical reasons. Do not use!
+        </note>
+      </desc>
     </const>
   </enum>
 
   <enum
-    name="ProcessInputStatus"
-    uuid="a4a0ef9c-29cc-4805-9803-c8215ae9da6c"
+    name="FileSharingMode"
+    uuid="f87dfe58-425b-c5ba-7d6d-22adeea25de1"
     >
     <desc>
-      Process input statuses.
+      File sharing mode for <link to="IGuestSession::fileOpenEx"/>.
     </desc>
-
-    <const name="Undefined"             value="0">
-      <desc>Undefined state.</desc>
+    <const name="Read"        value="1">
+      <desc>Only share read access to the file.</desc>
     </const>
-    <const name="Broken"                value="1">
-      <desc>Input pipe is broken.</desc>
+    <const name="Write"       value="2">
+      <desc>Only share write access to the file.</desc>
     </const>
-    <const name="Available"             value="10">
-      <desc>Input pipe became available for writing.</desc>
+    <const name="ReadWrite"   value="3">
+      <desc>Share both read and write access to the file, but deny deletion.</desc>
     </const>
-    <const name="Written"               value="50">
-      <desc>Data has been successfully written.</desc>
+    <const name="Delete"      value="4">
+      <desc>Only share delete access, denying read and write.</desc>
     </const>
-    <const name="Overflow"              value="100">
-      <desc>Too much input data supplied, data overflow.</desc>
+    <const name="ReadDelete"  value="5">
+      <desc>Share read and delete access to the file, denying writing.</desc>
+    </const>
+    <const name="WriteDelete" value="6">
+      <desc>Share write and delete access to the file, denying reading.</desc>
+    </const>
+    <const name="All"         value="7">
+      <desc>Share all access, i.e. read, write and delete, to the file.</desc>
+    </const>
+  </enum>
+
+  <enum
+    name="FileOpenExFlags"
+    uuid="9d62017b-ddd3-4e5a-a08e-14d1c23bbac1"
+    >
+    <desc>
+      Open flags for <link to="IGuestSession::fileOpenEx"/>.
+    </desc>
+    <const name="None"        value="0">
+      <desc>No flag set.</desc>
     </const>
   </enum>
 
@@ -10265,47 +10588,48 @@
 
   <enum
     name="FsObjType"
-    uuid="a1ed437c-b3c3-4ca2-b19c-4239d658d5e8"
+    uuid="34a0d1aa-491e-e209-e150-84964d6cee5f"
     >
     <desc>
-      File system object type.
+      File system object (file) types.
     </desc>
-
-    <const name="Undefined"             value="0">
-      <desc>Type is undefined / unknown.</desc>
+    <const name="Unknown"   value="1">
+      <desc>Used either if the object has type that is not in this enum, or
+        if the type has not yet been determined or set.</desc>
     </const>
-    <const name="FIFO"                  value="1">
-      <desc>Named pipe.</desc>
+    <const name="Fifo"      value="2">
+      <desc>FIFO or named pipe, depending on the platform/terminology.</desc>
     </const>
-    <const name="DevChar"               value="10">
+    <const name="DevChar"   value="3">
       <desc>Character device.</desc>
     </const>
-    <const name="DevBlock"              value="11">
-      <desc>Block device.</desc>
-    </const>
-    <const name="Directory"             value="50">
+    <const name="Directory" value="4">
       <desc>Directory.</desc>
     </const>
-    <const name="File"                  value="80">
-      <desc>File.</desc>
+    <const name="DevBlock"  value="5">
+      <desc>Block device.</desc>
+    </const>
+    <const name="File"      value="6">
+      <desc>Regular file.</desc>
     </const>
-    <const name="Symlink"               value="100">
-      <desc>Symlink.</desc>
+    <const name="Symlink"   value="7">
+      <desc>Symbolic link.</desc>
     </const>
-    <const name="Socket"                value="200">
+    <const name="Socket"    value="8">
       <desc>Socket.</desc>
     </const>
-    <const name="Whiteout"              value="400">
-      <desc>Whiteout.</desc>
+    <const name="WhiteOut"  value="9">
+      <desc>A white-out file.  Found in union mounts where it is used for
+        hiding files after deletion, I think. </desc>
     </const>
   </enum>
 
   <enum
-    name="DragAndDropAction"
-    uuid="47f3b162-c107-4fcd-bfa7-54b8135c441e"
+    name="DnDAction"
+    uuid="17609e74-778e-4d0e-8827-35f5230f287b"
   >
     <desc>
-      Possible actions within an Drag and Drop operation.
+      Possible actions of a drag'n drop operation.
     </desc>
 
     <const name="Ignore"                value="0">
@@ -10330,54 +10654,371 @@
     uuid="5138837a-8fd2-4194-a1b0-08f7bc3949d0"
     >
     <desc>
-      Directory open flags.
+      Directory open flags.
+    </desc>
+    <const name="None"                  value="0">
+      <desc>No flag set.</desc>
+    </const>
+    <const name="NoSymlinks"            value="1">
+      <desc>Don't allow symbolic links as part of the path.</desc>
+    </const>
+<!-- r=bird: need a "NoFollowSymlinks" value here.  IPRT probably needs that too. -->
+  </enum>
+
+  <interface
+    name="IDnDBase" extends="$unknown"
+    uuid="a9630a67-7238-4b0e-9a58-364b1dd3d032"
+    wsmap="managed"
+    >
+    <desc>Base abstract interface for drag'n drop.</desc>
+
+    <attribute name="formats" type="wstring" safearray="yes" readonly="yes">
+      <desc>Returns all supported drag'n drop formats.</desc>
+    </attribute>
+
+    <attribute name="protocolVersion" type="unsigned long" readonly="yes">
+      <desc>Returns the protocol version which is used to communicate
+       with the guest.</desc>
+    </attribute>
+
+    <method name="isFormatSupported" >
+      <desc>
+        Checks if a specific drag'n drop MIME / Content-type format is supported.
+      </desc>
+      <param name="format" type="wstring" dir="in">
+        <desc>Format to check for.</desc>
+      </param>
+      <param name="supported" type="boolean" dir="return">
+        <desc>Returns @c true if the specified format is supported, @c false if not.</desc>
+      </param>
+    </method>
+
+    <method name="addFormats" >
+      <desc>
+        Adds MIME / Content-type formats to the supported formats.
+      </desc>
+      <param name="formats" type="wstring" safearray="yes" dir="in">
+        <desc>Collection of formats to add.</desc>
+      </param>
+    </method>
+
+    <method name="removeFormats" >
+      <desc>
+        Removes MIME / Content-type formats from the supported formats.
+      </desc>
+      <param name="formats" type="wstring" safearray="yes" dir="in">
+        <desc>Collection of formats to remove.</desc>
+      </param>
+    </method>
+
+  </interface>
+
+  <interface
+    name="IDnDSource" extends="IDnDBase"
+    uuid="b69c400d-be63-4255-898a-e706d66b1637"
+    wsmap="managed"
+    >
+    <desc>Abstract interface for handling drag'n drop sources.</desc>
+
+    <method name="dragIsPending">
+      <desc>
+        Ask the source if there is any drag and drop operation pending.
+        If no drag and drop operation is pending currently, DnDAction_Ignore is returned.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in">
+        <desc>The screen ID where the drag and drop event occurred.</desc>
+      </param>
+      <param name="formats" type="wstring" dir="out" safearray="yes">
+        <desc>On return the supported mime types.</desc>
+      </param>
+      <param name="allowedActions" type="DnDAction" dir="out" safearray="yes">
+        <desc>On return the actions which are allowed.</desc>
+      </param>
+      <param name="defaultAction" type="DnDAction" dir="return">
+        <desc>On return the default action to use.</desc>
+      </param>
+    </method>
+
+    <method name="drop">
+      <desc>
+        Informs the source that a drop event occurred for a pending
+        drag and drop operation.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+      </desc>
+
+      <param name="format" type="wstring" dir="in">
+        <desc>The mime type the data must be in.</desc>
+      </param>
+      <param name="action" type="DnDAction" dir="in">
+        <desc>The action to use.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
+
+    <method name="receiveData">
+      <desc>
+        Receive the data of a previously drag and drop event from the source.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+
+      </desc>
+
+      <param name="data" type="octet" safearray="yes" dir="return">
+        <desc>The actual data.</desc>
+      </param>
+    </method>
+
+  </interface>
+
+  <interface
+    name="IGuestDnDSource" extends="IDnDSource"
+    uuid="dedfb5d9-4c1b-edf7-fdf3-c1be6827dc28"
+    wsmap="managed"
+    >
+    <desc>
+      Implementation of the <link to="IDnDSource" /> object
+      for source drag'n drop operations on the guest.
+    </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
+  </interface>
+
+  <interface
+    name="IDnDTarget" extends="IDnDBase"
+    uuid="25ac16fa-316d-4934-9a7f-fe02f6739bef"
+    wsmap="managed"
+    >
+    <desc>Abstract interface for handling drag'n drop targets.</desc>
+
+    <method name="enter">
+      <desc>
+        Informs the target about a drag and drop enter event.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in">
+        <desc>The screen ID where the drag and drop event occurred.</desc>
+      </param>
+      <param name="y" type="unsigned long" dir="in">
+        <desc>Y-position of the event.</desc>
+      </param>
+      <param name="x" type="unsigned long" dir="in">
+        <desc>X-position of the event.</desc>
+      </param>
+      <param name="defaultAction" type="DnDAction" dir="in">
+        <desc>The default action to use.</desc>
+      </param>
+      <param name="allowedActions" type="DnDAction" dir="in" safearray="yes">
+        <desc>The actions which are allowed.</desc>
+      </param>
+      <param name="formats" type="wstring" dir="in" safearray="yes">
+        <desc>The supported MIME types.</desc>
+      </param>
+      <param name="resultAction" type="DnDAction" dir="return">
+        <desc>The resulting action of this event.</desc>
+      </param>
+    </method>
+
+    <method name="move">
+      <desc>
+        Informs the target about a drag and drop move event.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in">
+        <desc>The screen ID where the drag and drop event occurred.</desc>
+      </param>
+      <param name="x" type="unsigned long" dir="in">
+        <desc>X-position of the event.</desc>
+      </param>
+      <param name="y" type="unsigned long" dir="in">
+        <desc>Y-position of the event.</desc>
+      </param>
+      <param name="defaultAction" type="DnDAction" dir="in">
+        <desc>The default action to use.</desc>
+      </param>
+      <param name="allowedActions" type="DnDAction" dir="in" safearray="yes">
+        <desc>The actions which are allowed.</desc>
+      </param>
+      <param name="formats" type="wstring" dir="in" safearray="yes">
+        <desc>The supported MIME types.</desc>
+      </param>
+      <param name="resultAction" type="DnDAction" dir="return">
+        <desc>The resulting action of this event.</desc>
+      </param>
+    </method>
+
+    <method name="leave">
+      <desc>
+        Informs the target about a drag and drop leave event.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in">
+        <desc>The screen ID where the drag and drop event occurred.</desc>
+      </param>
+    </method>
+
+    <method name="drop">
+      <desc>
+        Informs the target about a drop event.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in">
+        <desc>The screen ID where the Drag and Drop event occurred.</desc>
+      </param>
+      <param name="x" type="unsigned long" dir="in">
+        <desc>X-position of the event.</desc>
+      </param>
+      <param name="y" type="unsigned long" dir="in">
+        <desc>Y-position of the event.</desc>
+      </param>
+      <param name="defaultAction" type="DnDAction" dir="in">
+        <desc>The default action to use.</desc>
+      </param>
+      <param name="allowedActions" type="DnDAction" dir="in" safearray="yes">
+        <desc>The actions which are allowed.</desc>
+      </param>
+      <param name="formats" type="wstring" dir="in" safearray="yes">
+        <desc>The supported MIME types.</desc>
+      </param>
+      <param name="format" type="wstring" dir="out">
+        <desc>The resulting format of this event.</desc>
+      </param>
+      <param name="resultAction" type="DnDAction" dir="return">
+        <desc>The resulting action of this event.</desc>
+      </param>
+    </method>
+
+    <method name="sendData">
+      <desc>
+        Initiates sending data to the target.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in">
+        <desc>The screen ID where the drag and drop event occurred.</desc>
+      </param>
+      <param name="format" type="wstring" dir="in">
+        <desc>The MIME type the data is in.</desc>
+      </param>
+      <param name="data" type="octet" dir="in" safearray="yes">
+        <desc>The actual data.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
+
+    <method name="cancel">
+      <desc>
+        Requests cancelling the current operation. The target can veto
+        the request in case the operation is not cancelable at the moment.
+
+        <result name="VBOX_E_VM_ERROR">
+          VMM device is not available.
+        </result>
+
+      </desc>
+
+      <param name="veto" type="boolean" dir="return">
+        <desc>Whether the target has vetoed cancelling the operation.</desc>
+      </param>
+    </method>
+
+  </interface>
+
+  <interface
+    name="IGuestDnDTarget" extends="IDnDTarget"
+    uuid="50ce4b51-0ff7-46b7-a138-3c6e5ac946b4"
+    wsmap="managed"
+    >
+    <desc>
+      Implementation of the <link to="IDnDTarget" /> object
+      for target drag'n drop operations on the guest.
     </desc>
-    <const name="None"                  value="0">
-      <desc>No flag set.</desc>
-    </const>
-    <const name="NoSymlinks"            value="1">
-      <desc>Don't allow symbolic links as part of the path.</desc>
-    </const>
-  </enum>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
+  </interface>
 
   <interface
     name="IGuestSession" extends="$unknown"
-    uuid="5b28703c-07b6-4fcb-afba-ac199b309752"
+    uuid="3cbf62cf-c9cd-48c6-9623-d1dbe54ca557"
     wsmap="managed"
     >
     <desc>
-      A guest session represents one impersonated user account on the guest, so
+      A guest session represents one impersonated user account in the guest, so
       every operation will use the same credentials specified when creating
       the session object via <link to="IGuest::createSession"/>.
 
       There can be a maximum of 32 sessions at once per VM, whereas session 0
-      is reserved for the root session. This root session is controlling all
-      other guest sessions and also is responsible for actions which require
-      system level privileges. Each guest session keeps track of its started
-      guest processes, opened guest files or guest directories.
-      To work on guest files or directories a guest session offers methods to open
-      or create such objects (see <link to="IGuestSession::fileOpen"/> or
-      <link to="IGuestSession::directoryOpen"/> for example).
+      is reserved for the root session.
+<!-- r=bird: Is the root session part of the maximum of 32?? Not really clear. -->
+      This root session is controlling all other guest sessions and also is
+      responsible for actions which require system level privileges.
+
+      Each guest session keeps track of the guest directories and files that
+      it opened as well as guest processes it has created.  To work on guest
+      files or directories a guest session offers methods to open or create
+      such objects (see <link to="IGuestSession::fileOpen"/> or
+      <link to="IGuestSession::directoryOpen"/> for instance).  Similarly,
+      there a methods for creating guest processes.
+
+      There can be up to 2048 objects (guest processes, files and directories)
+      a time per guest session.  Exceeding the limit will result in an error.
+<!-- @todo r=bird: Add specific VBOX_E_XXX error for this and document it here! -->
 
       When done with either of these objects, including the guest session itself,
       use the appropriate close() method to let the object do its cleanup work.
 
-      Every guest session has its own environment variable block which gets
-      automatically applied when starting a new guest process via
-      <link to="IGuestSession::processCreate"/> or <link to="IGuestSession::processCreateEx"/>.
-      To override (or unset) certain environment variables already set by the
-      guest session, one can specify a per-process environment block when using
-      one of the both above mentioned process creation calls.
+      Closing a session via <link to="IGuestSession::close" /> will try to close
+      all the mentioned objects above unless these objects are still used by
+      a client.
+
+      A set of environment variables changes is associated with each session
+      (<link to="IGuestSession::environmentChanges"/>).  These are applied to
+      the base environment of the impersonated guest user when creating a new
+      guest process.  For additional flexibility the <link to="IGuestSession::processCreate"/>
+      and <link to="IGuestSession::processCreateEx"/> methods allows you to
+      specify individual environment changes for each process you create.
+      With newer guest addition versions, the base environment is also made
+      available via <link to="IGuestSession::environmentBase"/>.  (One reason
+      for why we record changes to a base environment instead of working
+      directly on an environment block is that we need to be compatible
+      with older guest additions.  Another reason is that this way it is always
+      possible to undo all the changes you've scheduled.)
     </desc>
 
     <attribute name="user" type="wstring" readonly="yes">
       <desc>Returns the user name used by this session to impersonate
-        users on the guest.
+        users in the guest.
       </desc>
     </attribute>
     <attribute name="domain" type="wstring" readonly="yes">
       <desc>Returns the domain name used by this session to impersonate
-        users on the guest.
+        users in the guest.
       </desc>
     </attribute>
     <attribute name="name" type="wstring" readonly="yes">
@@ -10388,9 +11029,10 @@
     </attribute>
     <attribute name="timeout" type="unsigned long">
       <desc>
+<!-- r=bird: Using 'Returns' for writable attributes is misleading. -->
         Returns the session timeout (in ms).
         <result name="E_NOTIMPL">
-          The method is not implemented yet.
+          This attribute is not implemented yet.
         </result>
       </desc>
     </attribute>
@@ -10401,9 +11043,34 @@
     <attribute name="status" type="GuestSessionStatus" readonly="yes">
       <desc>Returns the current session status.</desc>
     </attribute>
-    <attribute name="environment" type="wstring" safearray="yes">
+    <attribute name="environmentChanges" type="wstring" safearray="yes">
+      <desc>
+        The set of scheduled environment changes to the base environment of the
+        session.  They are in putenv format, i.e. "VAR=VALUE" for setting and
+        "VAR" for unsetting.  One entry per variable (change).  The changes are
+        applied when creating new guest processes.
+
+        This is writable, so to undo all the scheduled changes, assign it an
+        empty array.
+      </desc>
+    </attribute>
+    <attribute name="environmentBase" type="wstring" safearray="yes" readonly="yes">
       <desc>
-        Returns the current session environment.
+        The base environment of the session.  They are on the "VAR=VALUE" form,
+        one array entry per variable.
+        <!-- @todo/TODO/FIXME: This doesn't end up in the PDF.
+        <result name="VBOX_E_NOT_SUPPORTED">If the guest additions does not
+          support the session base environment feature.  Support for this was
+          introduced with protocol version XXX.</result>
+        <result name="VBOX_E_INVALID_OBJECT_STATE">If the guest additions has
+          yet to report the session base environment.</result> -->
+
+        Access fails with VBOX_E_NOT_SUPPORTED if the guest additions does not
+        support the session base environment feature.  Support for this was
+        introduced with protocol version XXXX.
+
+        Access fails with VBOX_E_INVALID_OBJECT_STATE if the guest additions
+        has yet to report the session base environment.
       </desc>
     </attribute>
     <attribute name="processes" type="IGuestProcess" readonly="yes" safearray="yes">
@@ -10411,6 +11078,20 @@
         Returns all current guest processes.
       </desc>
     </attribute>
+    <attribute name="pathStyle" type="PathStyle" readonly="yes">
+      <desc>
+        The style of paths used by the guest.  Handy for giving the right kind
+        of path specifications to <link to="IGuestSession::fileOpen"/> and similar methods.
+      </desc>
+    </attribute>
+    <attribute name="currentDirectory" type="wstring">
+      <desc>
+        The current directory of the session.  Guest path style.
+        <result name="E_NOTIMPL">
+          This attribute is not implemented yet.
+        </result>
+      </desc>
+    </attribute>
     <attribute name="directories" type="IGuestDirectory" readonly="yes" safearray="yes">
       <desc>
         Returns all currently opened guest directories.
@@ -10432,76 +11113,113 @@
         Closes this session. All opened guest directories, files and
         processes which are not referenced by clients anymore will be
         closed. Guest processes which fall into this category and still
-        are running on the guest will be terminated automatically.
+        are running in the guest will be terminated automatically.
       </desc>
     </method>
 
-    <method name="copyFrom">
+    <!-- Directory related methods.  -->
+
+    <method name="directoryCopy">
       <desc>
-        Copies a file from guest to the host.
+        Recursively copies a directory from one guest location to another.
 
-        <result name="VBOX_E_IPRT_ERROR">
-          Error starting the copy operation.
+        <result name="E_NOTIMPL">
+          Not yet implemented.
         </result>
       </desc>
       <param name="source" type="wstring" dir="in">
-        <desc>Source file on the guest to copy to the host.</desc>
+        <desc>The path to the directory to copy (in the guest).  Guest path style.</desc>
       </param>
-      <param name="dest" type="wstring" dir="in">
-        <desc>Destination file name on the host.</desc>
+      <param name="destination" type="wstring" dir="in">
+        <desc>The path to the target directory (in the guest).  Unless the
+          <link to="DirectoryCopyFlags::CopyIntoExisting"/> flag is given, the
+          directory shall not already exist.  Guest path style.</desc>
       </param>
-      <param name="flags" type="CopyFileFlag" dir="in" safearray="yes">
-        <desc>Copy flags; see <link to="CopyFileFlag"/> for more information.</desc>
+      <param name="flags" type="DirectoryCopyFlags" dir="in" safearray="yes">
+        <desc>Zero or more <link to="DirectoryCopyFlags"/> values.</desc>
       </param>
       <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
+        <desc>Progress object to track the operation to completion.</desc>
       </param>
     </method>
 
-    <method name="copyTo">
+    <method name="directoryCopyFromGuest">
       <desc>
-        Copies a file from host to the guest.
+        Recursively copies a directory from the guest to the host.
 
-        <result name="VBOX_E_IPRT_ERROR">
-          Error starting the copy operation.
+        <result name="E_NOTIMPL">
+          Not yet implemented.
         </result>
       </desc>
       <param name="source" type="wstring" dir="in">
-        <desc>Source file on the host to copy to the guest.</desc>
+        <desc>Path to the directory on the guest side that should be copied to
+          the host.  Guest path style.</desc>
       </param>
-      <param name="dest" type="wstring" dir="in">
-        <desc>Destination file name on the guest.</desc>
+      <param name="destination" type="wstring" dir="in">
+        <desc>Where to put the directory on the host.  Unless the
+          <link to="DirectoryCopyFlags::CopyIntoExisting"/> flag is given, the
+          directory shall not already exist.  Host path style.</desc>
       </param>
-      <param name="flags" type="CopyFileFlag" dir="in" safearray="yes">
-        <desc>Copy flags; see <link to="CopyFileFlag"/> for more information.</desc>
+      <param name="flags" type="DirectoryCopyFlags" dir="in" safearray="yes">
+        <desc>Zero or more <link to="DirectoryCopyFlags"/> values.</desc>
       </param>
       <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
+        <desc>Progress object to track the operation to completion.</desc>
+      </param>
+    </method>
+
+    <method name="directoryCopyToGuest">
+      <desc>
+        Recursively copies a directory from the host to the guest.
+
+        <result name="E_NOTIMPL">
+          Not yet implemented.
+        </result>
+      </desc>
+      <param name="source" type="wstring" dir="in">
+        <desc>Path to the directory on the host side that should be copied to
+          the guest.  Host path style.</desc>
+      </param>
+      <param name="destination" type="wstring" dir="in">
+        <desc>Where to put the file in the guest. Unless the
+          <link to="DirectoryCopyFlags::CopyIntoExisting"/> flag is given, the
+          directory shall not already exist.  Guest style path.</desc>
+      </param>
+      <param name="flags" type="DirectoryCopyFlags" dir="in" safearray="yes">
+        <desc>Zero or more <link to="DirectoryCopyFlags"/> values.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation to completion.</desc>
       </param>
     </method>
 
     <method name="directoryCreate">
       <desc>
-        Create a directory on the guest.
+        Creates a directory in the guest.
 
         <result name="VBOX_E_IPRT_ERROR">
           Error while creating the directory.
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>Full path of directory to create.</desc>
+        <desc>Path to the directory directory to be created. Guest path style.</desc>
       </param>
       <param name="mode" type="unsigned long" dir="in">
-        <desc>File creation mode.</desc>
+        <desc>
+          The UNIX-style access mode mask to create the directory with.
+          Whether/how all three access groups and associated access rights are
+          realized is guest OS dependent.  The API does the best it can on each
+          OS.
+        </desc>
       </param>
       <param name="flags" type="DirectoryCreateFlag" dir="in" safearray="yes">
-        <desc>Creation flags; see <link to="DirectoryCreateFlag"/> for more information.</desc>
+        <desc>Zero or more <link to="DirectoryCreateFlag"/> flags.</desc>
       </param>
     </method>
 
     <method name="directoryCreateTemp">
       <desc>
-        Create a temporary directory on the guest.
+        Creates a temporary directory in the guest.
 
         <result name="VBOX_E_NOT_SUPPORTED">
           The operation is not possible as requested on this particular
@@ -10524,36 +11242,53 @@
           alphanumeric string to produce a unique name.</desc>
       </param>
       <param name="mode" type="unsigned long" dir="in">
-        <desc>The mode of the directory to create. Use 0700 unless there are
-          reasons not to. This parameter is ignored if "secure" is specified.
-          </desc>
+        <desc>
+          The UNIX-style access mode mask to create the directory with.
+          Whether/how all three access groups and associated access rights are
+          realized is guest OS dependent.  The API does the best it can on each
+          OS.
+
+          This parameter is ignore if the @a secure parameter is set to @c true.
+          <note>It is strongly recommended to use 0700.</note>
+        </desc>
       </param>
       <param name="path" type="wstring" dir="in">
-        <desc>The absolute path to create the temporary directory in.</desc>
+        <desc>The path to the directory in which the temporary directory should
+          be created. Guest path style.</desc>
       </param>
       <param name="secure" type="boolean" dir="in">
-        <desc>Whether to fail if the directory can not be securely created.
+        <desc>
+          Whether to fail if the directory can not be securely created.
           Currently this means that another unprivileged user cannot
           manipulate the path specified or remove the temporary directory
           after it has been created. Also causes the mode specified to be
-          ignored. May not be supported on all guest types.</desc>
+          ignored. May not be supported on all guest types.
+        </desc>
       </param>
       <param name="directory" type="wstring" dir="return">
-        <desc>On success this will contain the name of the directory created
-          with full path.</desc>
+        <desc>On success this will contain the full path to the created
+          directory. Guest path style.</desc>
       </param>
     </method>
 
     <method name="directoryExists">
       <desc>
-        Checks whether a directory exists on the guest or not.
+        Checks whether a directory exists in the guest or not.
 
         <result name="VBOX_E_IPRT_ERROR">
           Error while checking existence of the directory specified.
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>Directory to check existence for.</desc>
+        <desc>Path to the directory to check if exists. Guest path style.</desc>
+      </param>
+      <param name="followSymlinks" type="boolean" dir="in">
+        <desc>
+          If @c true, symbolic links in the final component will be followed
+          and the existance of the symlink target made the question for this method.
+          If @c false, a symbolic link in the final component will make the
+          method return @c false (because a symlink isn't a directory).
+         </desc>
       </param>
       <param name="exists" type="boolean" dir="return">
         <desc>Returns @c true if the directory exists, @c false if not.</desc>
@@ -10562,8 +11297,11 @@
 
     <method name="directoryOpen">
       <desc>
-        Opens a directory and creates a <link to="IGuestDirectory"/> object that
-        can be used for further operations.
+        Opens a directory in the guest and creates a <link to="IGuestDirectory"/>
+        object that can be used for further operations.
+
+        <note>This method follows symbolic links by default at the moment, this
+          may change in the future.</note>
 
         <result name="VBOX_E_OBJECT_NOT_FOUND">
           Directory to open was not found.
@@ -10573,56 +11311,59 @@
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>Full path to file to open.</desc>
+        <desc>Path to the directory to open. Guest path style.</desc>
       </param>
       <param name="filter" type="wstring" dir="in">
-        <desc>Open filter to apply. This can include wildcards like ? and *.</desc>
+        <desc>Optional directory listing filter to apply.  This uses the DOS/NT
+          style wildcard characters '?' and '*'.</desc>
       </param>
       <param name="flags" type="DirectoryOpenFlag" dir="in" safearray="yes">
-        <desc>Open flags; see <link to="DirectoryOpenFlag"/> for more information.</desc>
+        <desc>Zero or more <link to="DirectoryOpenFlag"/> flags.</desc>
       </param>
       <param name="directory" type="IGuestDirectory" dir="return">
         <desc><link to="IGuestDirectory"/> object containing the opened directory.</desc>
       </param>
     </method>
 
-    <method name="directoryQueryInfo">
-      <desc>
-        Queries information of a directory on the guest.
-
-        <result name="VBOX_E_OBJECT_NOT_FOUND">
-          Directory to query information for was not found.
-        </result>
-        <result name="VBOX_E_IPRT_ERROR">
-          Error querying information.
-        </result>
-      </desc>
-      <param name="path" type="wstring" dir="in">
-        <desc>Directory to query information for.</desc>
-      </param>
-      <param name="info" type="IGuestFsObjInfo" dir="return">
-        <desc><link to="IGuestFsObjInfo"/> object containing the queried information.</desc>
-      </param>
-    </method>
-
     <method name="directoryRemove">
       <desc>
-        Removes a guest directory if not empty.
+        Removes a guest directory if empty.
+
+        <note>Symbolic links in the final component will not be followed,
+          instead an not-a-directory error is reported.</note>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>Full path of directory to remove.</desc>
+        <desc>Path to the directory that should be removed. Guest path style.</desc>
       </param>
     </method>
 
     <method name="directoryRemoveRecursive">
       <desc>
         Removes a guest directory recursively.
+
+<!--  Add this back when the warning can be removed:
+        Unless <link to="DirectoryRemoveRecFlag_ContentAndDir"/> or
+        <link to="DirectoryRemoveRecFlag_ContentOnly"/> is given, only the
+        directory structure is removed.  Which means it will fail if there are
+        directories which are not empty in the directory tree @a path points to.
+-->
+
+        <note> WARNING!! THE FLAGS ARE NOT CURRENTLY IMPLEMENTED.  THE IMPLEMENTATION
+          WORKS AS IF FLAGS WAS SET TO <link to="DirectoryRemoveRecFlag_ContentAndDir"/>.
+        </note>
+
+        <note>If the final path component is a symbolic link, this method will
+          fail as it can only be applied to directories.</note>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>Full path of directory to remove recursively.</desc>
+        <desc>Path of the directory that is to be removed recursively. Guest
+          path style.</desc>
       </param>
       <param name="flags" type="DirectoryRemoveRecFlag" dir="in" safearray="yes">
-        <desc>Remove flags; see <link to="DirectoryRemoveRecFlag"/> for more information.</desc>
+        <desc>Zero or more <link to="DirectoryRemoveRecFlag"/> flags.
+          <note>WARNING! SPECIFYING <link to="DirectoryRemoveRecFlag::ContentAndDir"/> IS
+             MANDATORY AT THE MOMENT!!</note>
+        </desc>
       </param>
       <param name="progress" type="IProgress" dir="return">
         <desc>Progress object to track the operation completion. This is not implemented
@@ -10630,102 +11371,168 @@
       </param>
     </method>
 
-    <method name="directoryRename">
+    <!-- Environment related methods.  -->
+
+    <method name="environmentScheduleSet">
       <desc>
-        Renames a directory on the guest.
+        Schedules setting an environment variable when creating the next guest
+        process.  This affects the <link to="IGuestSession::environmentChanges"/>
+        attribute.
       </desc>
-      <param name="source" type="wstring" dir="in">
-        <desc>Source directory to rename.</desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>Name of the environment variable to set.  This cannot be empty
+          nor can it contain any equal signs.</desc>
       </param>
-      <param name="dest" type="wstring" dir="in">
-        <desc>Destination directory to rename the source to.</desc>
+      <param name="value" type="wstring" dir="in">
+        <desc>Value to set the session environment variable to.</desc>
       </param>
-      <param name="flags" type="PathRenameFlag" dir="in" safearray="yes">
-        <desc>Rename flags; see <link to="PathRenameFlag"/> for more information.</desc>
+    </method>
+
+    <method name="environmentScheduleUnset">
+      <desc>
+        Schedules unsetting (removing) an environment variable when creating
+        the next guest process.  This affects the
+        <link to="IGuestSession::environmentChanges"/> attribute.
+      </desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>Name of the environment variable to unset.  This cannot be empty
+          nor can it contain any equal signs.</desc>
       </param>
     </method>
 
-    <method name="directorySetACL">
+    <method name="environmentGetBaseVariable">
       <desc>
-        Sets the ACL (Access Control List) of a guest directory.
+        Gets an environment variable from the session's base environment
+        (<link to="IGuestSession::environmentBase"/>).
 
-        <result name="E_NOTIMPL">
-          The method is not implemented yet.
-        </result>
+        <result name="VBOX_E_NOT_SUPPORTED">If the guest additions does not
+          support the session base environment feature.  Support for this was
+          introduced with protocol version XXXX.</result>
+        <result name="VBOX_E_INVALID_OBJECT_STATE">If the guest additions has
+          yet to report the session base environment.</result>
       </desc>
-      <param name="path" type="wstring" dir="in">
-        <desc>Full path of directory to set the ACL for.</desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>Name of the environment variable to   get.This cannot be empty
+          nor can it contain any equal signs.</desc>
       </param>
-      <param name="acl" type="wstring" dir="in">
-        <desc>Actual ACL string to set. Must comply with the guest OS.</desc>
+      <param name="value" type="wstring" dir="return">
+        <desc>
+          The value of the variable.  Empty if not found.  To deal with
+          variables that may have empty values, use
+          <link to="IGuestSession::environmentDoesBaseVariableExist"/>.
+        </desc>
       </param>
     </method>
 
-    <method name="environmentClear">
+    <method name="environmentDoesBaseVariableExist">
       <desc>
-        Clears (deletes) all session environment variables.
+        Checks if the given environment variable exists in the session's base
+        environment (<link to="IGuestSession::environmentBase"/>).
 
-        <result name="VBOX_E_IPRT_ERROR">
-          Error while clearing the session environment variables.
-        </result>
+        <result name="VBOX_E_NOT_SUPPORTED">If the guest additions does not
+          support the session base environment feature.  Support for this was
+          introduced with protocol version XXXX.</result>
+        <result name="VBOX_E_INVALID_OBJECT_STATE">If the guest additions has
+          yet to report the session base environment.</result>
       </desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>Name of the environment variable to look for.  This cannot be
+          empty nor can it contain any equal signs.</desc>
+      </param>
+      <param name="exists" type="boolean" dir="return">
+        <desc>TRUE if the variable exists, FALSE if not.</desc>
+      </param>
     </method>
 
-    <method name="environmentGet">
+    <!-- File related methods. -->
+
+    <method name="fileCopy">
       <desc>
-        Gets the value of a session environment variable.
+        Copies a file from one guest location to another.
 
-        <result name="VBOX_E_IPRT_ERROR">
-          Error while getting the value of the session environment variable.
+        <note>Will overwrite the destination file unless
+          <link to="FileCopyFlag::NoReplace"/> is specified.</note>
+
+        <result name="E_NOTIMPL">
+          Not yet implemented.
         </result>
       </desc>
-      <param name="name" type="wstring" dir="in">
-        <desc>Name of session environment variable to get the value for.</desc>
+      <param name="source" type="wstring" dir="in">
+        <desc>The path to the file to copy (in the guest).  Guest path style.</desc>
       </param>
-      <param name="value" type="wstring" dir="return">
-        <desc>
-          Value of the session environment variable specified. If this variable
-          does not exist and empty value will be returned.
-        </desc>
+      <param name="destination" type="wstring" dir="in">
+        <desc>The path to the target file (in the guest).  This cannot be a
+          directory.  Guest path style.</desc>
+      </param>
+      <param name="flags" type="FileCopyFlag" dir="in" safearray="yes">
+        <desc>Zero or more <link to="FileCopyFlag"/> values.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation to completion.</desc>
       </param>
     </method>
 
-    <method name="environmentSet">
+    <method name="fileCopyFromGuest">
       <desc>
-        Sets a session environment variable.
+        Copies a file from the guest to the host.
+
+        <note>Will overwrite the destination file unless
+          <link to="FileCopyFlag::NoReplace"/> is specified.</note>
 
         <result name="VBOX_E_IPRT_ERROR">
-          Error while setting the session environment variable.
+          Error starting the copy operation.
         </result>
       </desc>
-      <param name="name" type="wstring" dir="in">
-        <desc>Name of session environment variable to set.</desc>
+      <param name="source" type="wstring" dir="in">
+        <desc>Path to the file on the guest side that should be copied to the
+          host.  Guest path style.</desc>
       </param>
-      <param name="value" type="wstring" dir="in">
-        <desc>Value to set the session environment variable to.</desc>
+      <param name="destination" type="wstring" dir="in">
+        <desc>Where to put the file on the host (file, not directory). Host
+          path style.</desc>
+      </param>
+      <param name="flags" type="FileCopyFlag" dir="in" safearray="yes">
+        <desc>Zero or more <link to="FileCopyFlag"/> values.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation to completion.</desc>
       </param>
     </method>
 
-    <method name="environmentUnset">
+    <method name="fileCopyToGuest">
       <desc>
-        Unsets a session environment variable.
+        Copies a file from the host to the guest.
+
+        <note>Will overwrite the destination file unless
+          <link to="FileCopyFlag::NoReplace"/> is specified.</note>
 
         <result name="VBOX_E_IPRT_ERROR">
-          Error while unsetting the session environment variable.
+          Error starting the copy operation.
         </result>
       </desc>
-      <param name="name" type="wstring" dir="in">
-        <desc>Name of session environment variable to unset (clear).</desc>
+      <param name="source" type="wstring" dir="in">
+        <desc>Path to the file on the host side that should be copied to the
+          guest.  Host path style.</desc>
+      </param>
+      <param name="destination" type="wstring" dir="in">
+        <desc>Where to put the file in the guest (file, not directory).  Guest
+          style path.</desc>
+      </param>
+      <param name="flags" type="FileCopyFlag" dir="in" safearray="yes">
+        <desc>Zero or more <link to="FileCopyFlag"/> values.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation to completion.</desc>
       </param>
     </method>
 
     <method name="fileCreateTemp">
       <desc>
-        Creates a temporary file on the guest.
+        Creates a temporary file in the guest.
 
         <result name="VBOX_E_NOT_SUPPORTED">
           The operation is not possible as requested on this particular
-          guest type.
+          guest OS.
         </result>
         <result name="E_INVALIDARG">
           Invalid argument. This includes an incorrectly formatted template,
@@ -10745,12 +11552,19 @@
          </desc>
       </param>
       <param name="mode" type="unsigned long" dir="in">
-        <desc>The mode of the file to create. Use 0700 unless there are
-          reasons not to. This parameter is ignored if "secure" is specified.
-         </desc>
+        <desc>
+          The UNIX-style access mode mask to create the file with.
+          Whether/how all three access groups and associated access rights are
+          realized is guest OS dependent.  The API does the best it can on each
+          OS.
+
+          This parameter is ignore if the @a secure parameter is set to @c true.
+          <note>It is strongly recommended to use 0600.</note>
+        </desc>
       </param>
       <param name="path" type="wstring" dir="in">
-        <desc>The absolute path to create the temporary file in.</desc>
+        <desc>The path to the directory in which the temporary file should be
+          created.</desc>
       </param>
       <param name="secure" type="boolean" dir="in">
         <desc>Whether to fail if the file can not be securely created.
@@ -10768,40 +11582,69 @@
 
     <method name="fileExists">
       <desc>
-        Checks whether a file exists on the guest or not.
+        Checks whether a regular file exists in the guest or not.
 
         <result name="VBOX_E_IPRT_ERROR">
           Error while checking existence of the file specified.
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>File to check existence for.</desc>
+        <desc>Path to the alleged regular file.  Guest path style.</desc>
+      </param>
+      <param name="followSymlinks" type="boolean" dir="in">
+        <desc>
+          If @c true, symbolic links in the final component will be followed
+          and the existance of the symlink target made the question for this method.
+          If @c false, a symbolic link in the final component will make the
+          method return @c false (because a symlink isn't a regular file).
+         </desc>
       </param>
       <param name="exists" type="boolean" dir="return">
-        <desc>Returns @c true if the file exists, @c false if not.</desc>
+        <desc>Returns @c true if the file exists, @c false if not.  @c false is
+          also return if this @a path does not point to a file object.</desc>
       </param>
     </method>
 
-    <method name="fileRemove">
+    <method name="fileOpen">
       <desc>
-        Removes a single file on the guest.
+        Opens a file and creates a <link to="IGuestFile"/> object that
+        can be used for further operations.
 
         <result name="VBOX_E_OBJECT_NOT_FOUND">
-          File to remove was not found.
+          File to open was not found.
         </result>
         <result name="VBOX_E_IPRT_ERROR">
-          Error while removing the file.
+          Error while opening the file.
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>Path to the file to remove.</desc>
+        <desc>Path to file to open.  Guest path style.</desc>
+      </param>
+      <param name="accessMode" type="FileAccessMode" dir="in">
+        <desc>The file access mode (read, write and/or append).
+          See <link to="FileAccessMode"/> for details.</desc>
+      </param>
+      <param name="openAction" type="FileOpenAction" dir="in">
+        <desc>What action to take depending on whether the file exists or not.
+          See <link to="FileOpenAction"/> for details.</desc>
+      </param>
+      <param name="creationMode" type="unsigned long" dir="in">
+        <desc>
+          The UNIX-style access mode mask to create the file with if @a openAction
+          requested the file to be created (otherwise ignored).  Whether/how all
+          three access groups and associated access rights are realized is guest
+          OS dependent.  The API does the best it can on each OS.
+        </desc>
+      </param>
+      <param name="file" type="IGuestFile" dir="return">
+        <desc><link to="IGuestFile"/> object representing the opened file.</desc>
       </param>
     </method>
 
-    <method name="fileOpen">
+    <method name="fileOpenEx">
       <desc>
         Opens a file and creates a <link to="IGuestFile"/> object that
-        can be used for further operations.
+        can be used for further operations, extended version.
 
         <result name="VBOX_E_OBJECT_NOT_FOUND">
           File to open was not found.
@@ -10811,208 +11654,283 @@
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>Full path to file to open.</desc>
+        <desc>Path to file to open.  Guest path style.</desc>
       </param>
-      <param name="openMode" type="wstring" dir="in">
-        <desc>The file opening mode. This describes the wanted access to a file, whereas
-          the parameter must be one of the following:
-          <ul>
-            <li><tt>"r"</tt>: Opens a file for reading.</li>
-            <li><tt>"r+"</tt>: Opens a file for reading and writing.</li>
-            <li><tt>"w"</tt>: Opens a file for writing.</li>
-            <li><tt>"w+"</tt>: Opens a file for writing and reading.</li>
-          </ul>
-        </desc>
+      <param name="accessMode" type="FileAccessMode" dir="in">
+        <desc>The file access mode (read, write and/or append).
+          See <link to="FileAccessMode"/> for details.</desc>
       </param>
-      <param name="disposition" type="wstring" dir="in">
-        <desc>The file disposition. This describes the action to take in case a
-          file exists or does not exist, whereas the parameter must be one of the
-          following:
-          <ul>
-            <li><tt>"ca"</tt>: Creates a new file, always. Overwrites an existing file.</li>
-            <li><tt>"ce"</tt>: Creates a new file if it does not exist. Fail if exist.</li>
-            <li><tt>"oa"</tt>: Opens an existing file and places the file pointer at the
-              end of the file, if opened with write access. Create the file if it does not exist.</li>
-            <li><tt>"oc"</tt>: Opens an existing file or create it if it does not exist.</li>
-            <li><tt>"oe"</tt>: Opens an existing file or fail if it does not exist.</li>
-            <li><tt>"ot"</tt>: Opens and truncate an existing file or fail if it does not exist.</li>
-          </ul>
+      <param name="openAction" type="FileOpenAction" dir="in">
+        <desc>What action to take depending on whether the file exists or not.
+          See <link to="FileOpenAction"/> for details.</desc>
+      </param>
+      <param name="sharingMode" type="FileSharingMode" dir="in">
+        <desc>The file sharing mode in the guest. This parameter is currently
+          ignore for all guest OSes.  It will in the future be implemented for
+          Windows, OS/2 and maybe Solaris guests only, the others will ignore it.
+          Use <link to="FileSharingMode::All"/>.
         </desc>
       </param>
       <param name="creationMode" type="unsigned long" dir="in">
-        <desc>The mode to create the file with. Must be a three-digit octal number which
-          represents the access rights for the file.</desc>
+        <desc>
+          The UNIX-style access mode mask to create the file with if @a openAction
+          requested the file to be created (otherwise ignored).  Whether/how all
+          three access groups and associated access rights are realized is guest
+          OS dependent.  The API does the best it can on each OS.
+        </desc>
+      </param>
+      <param name="flags" type="FileOpenExFlags" dir="in" safearray="yes">
+        <desc>Zero or more <link to="FileOpenExFlags"/> values. </desc>
       </param>
       <param name="file" type="IGuestFile" dir="return">
         <desc><link to="IGuestFile"/> object representing the opened file.</desc>
       </param>
     </method>
 
-    <method name="fileOpenEx">
+    <method name="fileQuerySize">
       <desc>
-        Opens a file and creates a <link to="IGuestFile"/> object that
-        can be used for further operations, extended version.
+        Queries the size of a regular file in the guest.
 
         <result name="VBOX_E_OBJECT_NOT_FOUND">
-          File to open was not found.
+          File to was not found.
         </result>
         <result name="VBOX_E_IPRT_ERROR">
-          Error while opening the file.
+          Error querying file size.
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>Full path to file to open.</desc>
-      </param>
-      <param name="openMode" type="wstring" dir="in">
-        <desc>The file opening mode. This describes the wanted access to a file, whereas
-          the parameter must be one of the following:
-          <ul>
-            <li><tt>"r"</tt>: Opens a file for reading.</li>
-            <li><tt>"r+"</tt>: Opens a file for reading and writing.</li>
-            <li><tt>"w"</tt>: Opens a file for writing.</li>
-            <li><tt>"w+"</tt>: Opens a file for writing and reading.</li>
-          </ul>
-        </desc>
+        <desc>Path to the file which size is requested.  Guest path style.</desc>
       </param>
-      <param name="disposition" type="wstring" dir="in">
-        <desc>The file disposition. This describes the action to take in case a
-          file exists or does not exist, whereas the parameter must be one of the
-          following:
-          <ul>
-            <li><tt>"ca"</tt>: Creates a new file, always. Overwrites an existing file.</li>
-            <li><tt>"ce"</tt>: Creates a new file if it does not exist. Fail if exist.</li>
-            <li><tt>"oa"</tt>: Opens an existing file and places the file pointer at the
-              end of the file, if opened with write access. Create the file if it does not exist.</li>
-            <li><tt>"oc"</tt>: Opens an existing file or create it if it does not exist.</li>
-            <li><tt>"oe"</tt>: Opens an existing file or fail if it does not exist.</li>
-            <li><tt>"ot"</tt>: Opens and truncate an existing file or fail if it does not exist.</li>
-          </ul>
-        </desc>
+      <param name="followSymlinks" type="boolean" dir="in">
+        <desc>
+           It @c true, symbolic links in the final path component will be
+           followed to their target, and the size of the target is returned.
+           If @c false, symbolic links in the final path component will make
+           the method call fail (symblink is not a regular file).
+         </desc>
       </param>
-      <param name="sharingMode" type="wstring" dir="in">
-        <desc>The file sharing mode on the guest. This parameter
-          is not implemented yet. Pass an empty string here.</desc>
+      <param name="size" type="long long" dir="return">
+        <desc>Queried file size.</desc>
       </param>
-      <param name="creationMode" type="unsigned long" dir="in">
-        <desc>The mode to create the file with. Must be a three-digit octal number which
-          represents the access rights for the file.</desc>
+    </method>
+
+    <!-- File System Object Level -->
+
+    <method name="fsObjExists">
+      <desc>
+        Checks whether a file system object (file, directory, etc) exists in
+        the guest or not.
+
+        <result name="VBOX_E_IPRT_ERROR">
+          Error while checking existence of the file specified.
+        </result>
+      </desc>
+      <param name="path" type="wstring" dir="in">
+        <desc>Path to the file system object to check the existance of.  Guest
+          path style.</desc>
       </param>
-      <param name="offset" type="long long" dir="in">
-        <desc>The initial read/write offset (in bytes).</desc>
+      <param name="followSymlinks" type="boolean" dir="in">
+        <desc>
+           If @c true, symbolic links in the final component will be followed
+           and the method will instead check if the target exists.
+           If @c false, symbolic links in the final component will satisfy the
+           method and it will return @c true in @a exists.
+         </desc>
       </param>
-      <param name="file" type="IGuestFile" dir="return">
-        <desc><link to="IGuestFile"/> object representing the opened file.</desc>
+      <param name="exists" type="boolean" dir="return">
+        <desc>Returns @c true if the file exists, @c false if not.</desc>
       </param>
     </method>
 
-    <method name="fileQueryInfo">
+    <method name="fsObjQueryInfo">
       <desc>
-        Queries information of a file on the guest.
+        Queries information about a file system object (file, directory, etc)
+        in the guest.
 
         <result name="VBOX_E_OBJECT_NOT_FOUND">
-          File to query information for was not found.
+          The file system object was not found.
         </result>
         <result name="VBOX_E_IPRT_ERROR">
-          Error querying information.
+          Error while querying information.
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>File to query information for.</desc>
+        <desc>Path to the file system object to gather information about.
+          Guest path style.</desc>
+      </param>
+      <param name="followSymlinks" type="boolean" dir="in">
+        <desc>
+           Information about symbolic links is returned if @c false.  Otherwise,
+           symbolic links are followed and the returned information concerns
+           itself with the symlink target if @c true.
+         </desc>
       </param>
       <param name="info" type="IGuestFsObjInfo" dir="return">
-        <desc><link to="IGuestFsObjInfo"/> object containing the queried information.</desc>
+        <desc><link to="IGuestFsObjInfo"/> object containing the information.</desc>
       </param>
     </method>
 
-    <method name="fileQuerySize">
+    <method name="fsObjRemove">
       <desc>
-        Queries the size of a file on the guest.
+        Removes a file system object (file, symlink, etc) in the guest.  Will
+        not work on directories, use <link to="IGuestSession::directoryRemove"/>
+        to remove directories.
 
+        <note>This method will remove symbolic links in the final path
+          component, not follow them.</note>
+
+        <result name="E_NOTIMPL">
+          The method has not been implemented yet.
+        </result>
         <result name="VBOX_E_OBJECT_NOT_FOUND">
-          File to rename was not found.
+          The file system object was not found.
         </result>
         <result name="VBOX_E_IPRT_ERROR">
-          Error querying file size.
+          For most other errors. We know this is unhelpful, will fix shortly...
         </result>
       </desc>
       <param name="path" type="wstring" dir="in">
-        <desc>File to query the size for.</desc>
+        <desc>Path to the file system object to remove.  Guest style path.</desc>
       </param>
-      <param name="size" type="long long" dir="return">
-        <desc>Queried file size.</desc>
+    </method>
+
+    <method name="fsObjRename">
+      <desc>
+        Renames a file system object (file, directory, symlink, etc) in the
+        guest.
+
+        <result name="VBOX_E_OBJECT_NOT_FOUND">
+          The file system object was not found.
+        </result>
+        <result name="VBOX_E_IPRT_ERROR">
+          For most other errors. We know this is unhelpful, will fix shortly...
+        </result>
+      </desc>
+      <param name="oldPath" type="wstring" dir="in">
+        <desc>The current path to the object.  Guest path style.</desc>
+      </param>
+      <param name="newPath" type="wstring" dir="in">
+        <desc>The new path to the object.  Guest path style.</desc>
+      </param>
+      <param name="flags" type="FsObjRenameFlag" dir="in" safearray="yes">
+        <desc>Zero or more <link to="FsObjRenameFlag"/> values.</desc>
       </param>
     </method>
 
-    <method name="fileRename">
+    <method name="fsObjMove">
       <desc>
-        Renames a file on the guest.
+        Moves a file system object (file, directory, symlink, etc) from one
+        guest location to another.
+
+        This differs from <link to="IGuestSession::fsObjRename"/> in that it
+        can move accross file system boundraries.  In that case it will
+        perform a copy and then delete the original.  For directories, this
+        can take a while and is subject to races.
+
+        <result name="E_NOTIMPL">
+          Not yet implemented.
+        </result>
       </desc>
       <param name="source" type="wstring" dir="in">
-        <desc>Source file to rename.</desc>
+        <desc>Path to the file to move.  Guest path style.</desc>
+      </param>
+      <param name="destination" type="wstring" dir="in">
+        <desc>Where to move the file to (file, not directory).  Guest path
+          style.</desc>
       </param>
-      <param name="dest" type="wstring" dir="in">
-        <desc>Destination file to rename the source to.</desc>
+      <param name="flags" type="FsObjMoveFlags" dir="in" safearray="yes">
+        <desc>Zero or more <link to="FsObjMoveFlags"/> values.</desc>
       </param>
-      <param name="flags" type="PathRenameFlag" dir="in" safearray="yes">
-        <desc>Rename flags; see <link to="PathRenameFlag"/> for more information.</desc>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation to completion.</desc>
       </param>
     </method>
 
-    <method name="fileSetACL">
+    <method name="fsObjSetACL">
       <desc>
-        Sets the ACL (Access Control List) of a file on the guest.
+        Sets the access control list (ACL) of a file system object (file,
+        directory, etc) in the guest.
 
         <result name="E_NOTIMPL">
           The method is not implemented yet.
         </result>
       </desc>
-      <param name="file" type="wstring" dir="in">
-        <desc>Full path of file to set the ACL for.</desc>
+      <param name="path" type="wstring" dir="in">
+        <desc>Full path of the file system object which ACL to set</desc>
+      </param>
+      <param name="followSymlinks" type="boolean" dir="in">
+        <desc>
+          If @c true symbolic links in the final component will be followed,
+          otherwise, if @c false, the method will work directly on a symbolic
+          link in the final component.
+         </desc>
       </param>
       <param name="acl" type="wstring" dir="in">
-        <desc>Actual ACL string to set. Must comply with the guest OS.</desc>
+        <desc>The ACL specification string. To-be-defined.</desc>
+      </param>
+      <param name="mode" type="unsigned long" dir="in">
+        <desc>UNIX-style mode mask to use if @a acl is empty. As mention in
+          <link to="IGuestSession::directoryCreate"/> this is realized on
+          a best effort basis and the exact behavior depends on the Guest OS.
+        </desc>
       </param>
     </method>
 
+    <!-- Process methods -->
+
     <method name="processCreate">
       <desc>
-        Creates a new process running on the guest. The new process will be
+        Creates a new process running in the guest. The new process will be
         started asynchronously, meaning on return of this function it is not
-        guaranteed that the guest process is in a started state. To wait for
+        be guaranteed that the guest process is in a started state. To wait for
         successful startup, use the <link to="IProcess::waitFor"/> call.
 
         <note>
-          Starting at VirtualBox 4.2 guest process execution by default is limited
+          Starting at VirtualBox 4.2 guest process execution by is default limited
           to serve up to 255 guest processes at a time. If all 255 guest processes
-          are still active and running, creating a new guest process will result in an
-          appropriate error message.
+          are active and running, creating a new guest process will result in an
+          error.
 
-          If ProcessCreateFlag_WaitForStdOut and / or respectively ProcessCreateFlag_WaitForStdErr
-          is / are set, the guest process will not exit until all data from the specified
-          stream(s) is / are read out.
+          If ProcessCreateFlag_WaitForStdOut and/or ProcessCreateFlag_WaitForStdErr
+          are set, the guest process will not enter the terminated state until
+          all data from the specified streams have been read read.
         </note>
 
         <result name="VBOX_E_IPRT_ERROR">
           Error creating guest process.
         </result>
       </desc>
-      <param name="command" type="wstring" dir="in">
+      <param name="executable" type="wstring" dir="in">
         <desc>
-          Full path name of the command to execute on the guest; the
-          commands has to exists in the guest VM in order to be executed.
+          Full path to the file to execute in the guest.  The file has to
+          exists in the guest VM with executable right to the session user in
+          order to succeed.  If empty/null, the first entry in the
+          @a arguments array will be used instead (i.e. argv[0]).
         </desc>
       </param>
       <param name="arguments" type="wstring" dir="in" safearray="yes">
-        <desc>Array of arguments passed to the execution command.</desc>
+        <desc>Array of arguments passed to the new process.
+          <note>
+            Starting with VirtualBox 5.0 this array starts with argument 0
+            instead of argument 1 as in previous versions.  Whether the zeroth
+            argument can be passed to the guest depends on the VBoxService
+            version running there.  If you depend on this, check that the
+            <link to="IGuestSession::protocolVersion"/> is 3 or higher.
+          </note>
+        </desc>
       </param>
-      <param name="environment" type="wstring" dir="in" safearray="yes">
+      <param name="environmentChanges" type="wstring" dir="in" safearray="yes">
         <desc>
-          <para>Environment variables that can be set while the command is being
-          executed, in form of "NAME=VALUE"; one pair per entry. To unset a
-          variable just set its name ("NAME") without a value.</para>
-          <para>This parameter can be used to override environment variables set by
-          the guest session, which will be applied to the newly started process
-          in any case.</para>
+          Set of environment changes to complement
+          <link to="IGuestSession::environmentChanges"/>.  Takes precedence
+          over the session ones.  The changes are in putenv format, i.e.
+          "VAR=VALUE" for setting and "VAR" for unsetting.
+
+          The changes are applied to the base environment of the impersonated
+          guest user (<link to="IGuestSession::environmentBase"/>) when
+          creating the process.  (This is done on the guest side of things in
+          order to be compatible with older guest additions.  That is one of
+          the motivations for not passing in the whole environment here.)
         </desc>
       </param>
       <param name="flags" type="ProcessCreateFlag" dir="in" safearray="yes">
@@ -11036,35 +11954,48 @@
 
     <method name="processCreateEx">
       <desc>
-        <para>Creates a new process running on the guest. Extended version for
-          also setting the process priority and affinity.</para>
+        Creates a new process running in the guest with the extended options
+        for setting the process priority and affinity.
 
-        <para>See <link to="IGuestSession::processCreate"/> for more
-          information.</para>
+        See <link to="IGuestSession::processCreate"/> for more information.
       </desc>
-      <param name="command" type="wstring" dir="in">
+      <param name="executable" type="wstring" dir="in">
         <desc>
-          Full path name of the command to execute on the guest; the
-          commands has to exists in the guest VM in order to be executed.
+          Full path to the file to execute in the guest.  The file has to
+          exists in the guest VM with executable right to the session user in
+          order to succeed.  If empty/null, the first entry in the
+          @a arguments array will be used instead (i.e. argv[0]).
         </desc>
       </param>
       <param name="arguments" type="wstring" dir="in" safearray="yes">
-        <desc>Array of arguments passed to the execution command.</desc>
+        <desc>Array of arguments passed to the new process.
+          <note>
+            Starting with VirtualBox 5.0 this array starts with argument 0
+            instead of argument 1 as in previous versions.  Whether the zeroth
+            argument can be passed to the guest depends on the VBoxService
+            version running there.  If you depend on this, check that the
+            <link to="IGuestSession::protocolVersion"/> is 3 or higher.
+          </note>
+        </desc>
       </param>
-      <param name="environment" type="wstring" dir="in" safearray="yes">
+      <param name="environmentChanges" type="wstring" dir="in" safearray="yes">
         <desc>
-          <para>Environment variables that can be set while the command is being
-          executed, in form of "NAME=VALUE"; one pair per entry. To unset a
-          variable just set its name ("NAME") without a value.</para>
-          <para>This parameter can be used to override environment variables set by
-          the guest session, which will be applied to the newly started process
-          in any case.</para>
+          Set of environment changes to complement
+          <link to="IGuestSession::environmentChanges"/>.  Takes precedence
+          over the session ones.  The changes are in putenv format, i.e.
+          "VAR=VALUE" for setting and "VAR" for unsetting.
+
+          The changes are applied to the base environment of the impersonated
+          guest user (<link to="IGuestSession::environmentBase"/>) when
+          creating the process.  (This is done on the guest side of things in
+          order to be compatible with older guest additions.  That is one of
+          the motivations for not passing in the whole environment here.)
         </desc>
       </param>
       <param name="flags" type="ProcessCreateFlag" dir="in" safearray="yes">
         <desc>
-          Process creation flags;
-          see <link to="ProcessCreateFlag"/> for more information.
+          Process creation flags, see <link to="ProcessCreateFlag"/> for
+          detailed description of available flags.
         </desc>
       </param>
       <param name="timeoutMS" type="unsigned long" dir="in">
@@ -11077,13 +12008,20 @@
       </param>
       <param name="priority" type="ProcessPriority" dir="in">
         <desc>
-          Process priority to use for execution;
-          see see <link to="ProcessPriority"/> for more information.</desc>
+          Process priority to use for execution, see <link to="ProcessPriority"/>
+          for available priority levels.
+          <note>This is silently ignored if not supported by guest additions.</note>
+        </desc>
       </param>
       <param name="affinity" type="long" dir="in" safearray="yes">
         <desc>
-          Process affinity to use for execution. This parameter
-          is not implemented yet.
+          Processor affinity to set for the new process.  This is a list of
+          guest CPU numbers the process is allowed to run on.
+          <note>
+            This is silently ignored if the guest does not support setting the
+            affinity of processes, or if the guest additions does not implemet
+            this feature.
+          </note>
         </desc>
       </param>
       <param name="guestProcess" type="IGuestProcess" dir="return">
@@ -11103,96 +12041,80 @@
       </param>
     </method>
 
+    <!-- Symbolic link methods -->
+
     <method name="symlinkCreate">
       <desc>
-        Creates a symbolic link on the guest.
+        Creates a symbolic link in the guest.
 
         <result name="E_NOTIMPL">
           The method is not implemented yet.
         </result>
       </desc>
-      <param name="source" type="wstring" dir="in">
-        <desc>The name of the symbolic link.</desc>
+      <param name="symlink" type="wstring" dir="in">
+        <desc>Path to the symbolic link that should be created.  Guest path
+          style.</desc>
       </param>
       <param name="target" type="wstring" dir="in">
-        <desc>The path to the symbolic link target.</desc>
+        <desc>
+          The path to the symbolic link target.  If not an absolute, this will
+          be relative to the @a symlink location at access time.  Guest path
+          style.
+        </desc>
       </param>
       <param name="type" type="SymlinkType" dir="in">
         <desc>
-          The symbolic link type;
-          see <link to="SymlinkReadFlag"/> for more information.
+          The symbolic link type (mainly for Windows). See <link to="SymlinkType"/>
+          for more information.
         </desc>
       </param>
     </method>
 
     <method name="symlinkExists">
       <desc>
-        Checks whether a symbolic link exists on the guest or not.
+        Checks whether a symbolic link exists in the guest.
 
         <result name="E_NOTIMPL">
           The method is not implemented yet.
         </result>
       </desc>
       <param name="symlink" type="wstring" dir="in">
-        <desc>Symbolic link to check existence for.</desc>
+        <desc>Path to the alleged symbolic link.  Guest path style.</desc>
       </param>
       <param name="exists" type="boolean" dir="return">
-        <desc>Returns @c true if the symbolic link exists, @c false if not.</desc>
+        <desc>
+          Returns @c true if the symbolic link exists.  Returns @c false if it
+          does not exist, if the file system object identified by the path is
+          not a symbolic link, or if the object type is inaccessible to the
+          user, or if the @a symlink argument is empty.
+        </desc>
       </param>
     </method>
 
     <method name="symlinkRead">
       <desc>
-        Reads a symbolic link on the guest.
+        Reads the target value of a symbolic link in the guest.
 
         <result name="E_NOTIMPL">
           The method is not implemented yet.
         </result>
       </desc>
       <param name="symlink" type="wstring" dir="in">
-        <desc>Full path to symbolic link to read.</desc>
+        <desc>Path to the symbolic link to read.</desc>
       </param>
       <param name="flags" type="SymlinkReadFlag" dir="in" safearray="yes">
-        <desc>
-          Read flags; see <link to="SymlinkReadFlag"/> for more information.
-        </desc>
+        <desc>Zero or more <link to="SymlinkReadFlag"/> values.</desc>
       </param>
       <param name="target" type="wstring" dir="return">
-        <desc>
-          Target of the symbolic link pointing to, if found.
-        </desc>
-      </param>
-    </method>
-
-    <method name="symlinkRemoveDirectory">
-      <desc>
-        Removes a symbolic link on the guest if it's a directory.
-
-        <result name="E_NOTIMPL">
-          The method is not implemented yet.
-        </result>
-      </desc>
-      <param name="path" type="wstring" dir="in">
-        <desc>Symbolic link to remove.</desc>
+        <desc>Target value of the symbolic link.  Guest path style.</desc>
       </param>
     </method>
 
-    <method name="symlinkRemoveFile">
-      <desc>
-        Removes a symbolic link on the guest if it's a file.
-
-        <result name="E_NOTIMPL">
-          The method is not implemented yet.
-        </result>
-      </desc>
-      <param name="file" type="wstring" dir="in">
-        <desc>Symbolic link to remove.</desc>
-      </param>
-    </method>
+    <!-- Session wait methods -->
 
     <method name="waitFor">
       <desc>
-        Waits for one more events to happen.
+        Waits for one or more events to happen.
       </desc>
       <param name="waitFor" type="unsigned long" dir="in">
         <desc>
@@ -11216,7 +12138,7 @@
 
     <method name="waitForArray">
       <desc>
-        Waits for one more events to happen.
+        Waits for one or more events to happen.
         Scriptable version of <link to="#waitFor" />.
       </desc>
       <param name="waitFor" type="GuestSessionWaitForFlag" dir="in" safearray="yes">
@@ -11243,7 +12165,7 @@
 
   <interface
     name="IProcess" extends="$unknown"
-    uuid="5a4fe06d-8cb1-40ff-ac9e-9676e32f706e"
+    uuid="064cf1ca-4c0f-50b5-8f8e-e8b4bfa76c33"
     wsmap="managed"
     >
     <desc>
@@ -11257,12 +12179,12 @@
     </attribute>
     <attribute name="environment" type="wstring" readonly="yes" safearray="yes">
       <desc>
-        The environment block this process is using during execution.
+        The initial process environment.  Not yet implemented.
       </desc>
     </attribute>
     <attribute name="eventSource" type="IEventSource" readonly="yes">
       <desc>
-        Event source for VirtualBox events.
+        Event source for process events.
       </desc>
     </attribute>
     <attribute name="executablePath" type="wstring" readonly="yes">
@@ -11293,7 +12215,7 @@
 
     <method name="waitFor">
       <desc>
-        Waits for one more events to happen.
+        Waits for one or more events to happen.
       </desc>
       <param name="waitFor" type="unsigned long" dir="in">
         <desc>
@@ -11317,7 +12239,7 @@
 
     <method name="waitForArray">
       <desc>
-        Waits for one more events to happen.
+        Waits for one or more events to happen.
         Scriptable version of <link to="#waitFor" />.
       </desc>
       <param name="waitFor" type="ProcessWaitForFlag" dir="in" safearray="yes">
@@ -11432,13 +12354,14 @@
 
   <interface
     name="IGuestProcess" extends="IProcess"
-    uuid="dfa39a36-5d43-4840-a025-67ea956b3111"
+    uuid="35cf4b3f-4453-4f3e-c9b8-5686939c80b6"
     wsmap="managed"
     >
     <desc>
       Implementation of the <link to="IProcess" /> object
-      for processes on the guest.
+      for processes the host has started in the guest.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -11451,15 +12374,11 @@
     </desc>
 
     <attribute name="directoryName" type="wstring" readonly="yes">
-      <desc>
-        Full path of directory.
-      </desc>
+      <desc>The path specified when opening the directory.</desc>
     </attribute>
 
     <attribute name="filter" type="wstring" readonly="yes">
-      <desc>
-        The open filter.
-      </desc>
+      <desc>Directory listing filter to (specified when opening the directory).</desc>
     </attribute>
 
     <method name="close">
@@ -11481,50 +12400,42 @@
           <link to="IFsObjInfo"/>.</desc>
       </param>
     </method>
+
+    <!-- Would be useful to add queryInfo() and setACL() here later, but at
+         present IPRT isn't doing a race free job with the former and doesn't
+         have the latter.  So, let it be for now. -->
+
   </interface>
 
   <interface
     name="IGuestDirectory" extends="IDirectory"
-    uuid="af4a8ce0-0725-42b7-8826-46e3c7ba7357"
+    uuid="cc830458-4974-a19c-4dc6-cc98c2269626"
     wsmap="managed"
     >
     <desc>
       Implementation of the <link to="IDirectory" /> object
-      for directories on the guest.
+      for directories in the guest.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
     name="IFile" extends="$unknown"
-    uuid="5ec56ea3-b55d-4bdb-8c4f-5f9fb26b894b"
+    uuid="540804bf-4ca6-dd43-800c-bfb9765f96fe"
     wsmap="managed"
     >
     <desc>
       Abstract parent interface for files handled by VirtualBox.
     </desc>
-    <attribute name="creationMode" type="unsigned long" readonly="yes">
-      <desc>
-        The creation mode.
-      </desc>
-    </attribute>
-    <attribute name="disposition" type="wstring" readonly="yes">
-      <desc>
-        The disposition mode.
-      </desc>
-    </attribute>
+
     <attribute name="eventSource" type="IEventSource" readonly="yes">
       <desc>
-        Event source for guest session events.
-      </desc>
-    </attribute>
-    <attribute name="fileName" type="wstring" readonly="yes">
-      <desc>
-        Full path of the actual file name of this file.
+        Event source for file events.
       </desc>
     </attribute>
     <attribute name="id" type="unsigned long" readonly="yes">
       <desc>
-        The file's ID.
+        The ID VirtualBox internally assigned to the open file.
       </desc>
     </attribute>
     <attribute name="initialSize" type="long long" readonly="yes">
@@ -11532,14 +12443,18 @@
         The initial size in bytes when opened.
       </desc>
     </attribute>
-    <attribute name="openMode" type="wstring" readonly="yes">
-      <desc>
-        The open mode.
-      </desc>
-    </attribute>
     <attribute name="offset" type="long long" readonly="yes">
       <desc>
-        Current read/write offset in bytes.
+        The current file position.
+
+        The file current position always applies to the <link to="IFile::read"/>
+        method, which updates it upon return.  Same goes for the <link to="IFile::write"/>
+        method except when <link to="IFile::accessMode"/> is <link to="FileAccessMode::AppendOnly"/>
+        or <link to="FileAccessMode::AppendRead"/>, where it will always write
+        to the end of the file and will leave this attribute unchanged.
+
+        The <link to="IFile::seek"/> is used to change this attribute without
+        transfering any file data like read and write does.
       </desc>
     </attribute>
     <attribute name="status" type="FileStatus" readonly="yes">
@@ -11548,6 +12463,25 @@
       </desc>
     </attribute>
 
+    <!-- The following attributes just remembers the fileOpen parameters for you.
+         Nice for introspection and probably doesn't cost us much. -->
+    <attribute name="fileName" type="wstring" readonly="yes">
+      <desc>Full path of the actual file name of this file.
+        <!-- r=bird: The 'actual' file name is too tough, we cannot guarentee
+                     that on unix guests.  Seeing how IGuestDirectory did things,
+                     I'm questioning the 'Full path' part too.   Not urgent to check. -->
+      </desc>
+    </attribute>
+    <attribute name="creationMode" type="unsigned long" readonly="yes">
+      <desc>The UNIX-style creation mode specified when opening the file.</desc>
+    </attribute>
+    <attribute name="openAction" type="FileOpenAction" readonly="yes">
+      <desc>The opening action specified when opening the file.</desc>
+    </attribute>
+    <attribute name="accessMode" type="FileAccessMode" readonly="yes">
+      <desc>The file access mode.</desc>
+    </attribute>
+
     <method name="close">
       <desc>
         Closes this file. After closing operations like reading data,
@@ -11569,6 +12503,23 @@
       </param>
     </method>
 
+    <method name="querySize">
+      <!-- Can also be gotten via seek(Current, 0), but this is easier to us.
+           This is a query method both to match IGuestSession::fileQuerySize to
+           highlight that it is a value that is not cacheable as others may be
+           changing the file concurrently (image reading /var/log/messages). -->
+      <desc>
+        Queries the current file size.
+
+        <result name="E_NOTIMPL">
+          The method is not implemented yet.
+        </result>
+      </desc>
+      <param name="size" type="long long" dir="return">
+        <desc>Queried file size.</desc>
+      </param>
+    </method>
+
     <method name="read">
       <desc>
         Reads data from this file.
@@ -11618,20 +12569,24 @@
 
     <method name="seek">
       <desc>
-        Changes the read and write position of this file.
+        Changes the current file position of this file.
 
-        <result name="E_NOTIMPL">
-          The method is not implemented yet.
-        </result>
+        The file current position always applies to the <link to="IFile::read"/>
+        method.  Same for the <link to="IFile::write"/> method it except when
+        the <link to="IFile::accessMode"/> is <link to="FileAccessMode::AppendOnly"/>
+        or <link to="FileAccessMode::AppendRead"/>.
       </desc>
       <param name="offset" type="long long" dir="in">
-        <desc>Offset to seek.</desc>
+        <desc>Offset to seek relative to the position specified by @a whence.</desc>
       </param>
-      <param name="whence" type="FileSeekType" dir="in">
+      <param name="whence" type="FileSeekOrigin" dir="in">
         <desc>
-          Seek mode; see <link to="FileSeekType"/> for more information.
+          One of the <link to="FileSeekOrigin"/> seek starting points.
         </desc>
       </param>
+      <param name="newOffset" type="long long" dir="return">
+        <desc>The new file offset after the seek operation.</desc>
+      </param>
     </method>
 
     <method name="setACL">
@@ -11643,7 +12598,26 @@
         </result>
       </desc>
       <param name="acl" type="wstring" dir="in">
-        <desc>ACL string to set.</desc>
+        <desc>The ACL specification string. To-be-defined.</desc>
+      </param>
+      <param name="mode" type="unsigned long" dir="in">
+        <desc>UNIX-style mode mask to use if @a acl is empty. As mention in
+          <link to="IGuestSession::directoryCreate"/> this is realized on
+          a best effort basis and the exact behavior depends on the Guest OS.
+        </desc>
+      </param>
+    </method>
+
+    <method name="setSize">
+      <desc>
+        Changes the file size.
+
+        <result name="E_NOTIMPL">
+          The method is not implemented yet.
+        </result>
+      </desc>
+      <param name="size" type="long long" dir="in">
+        <desc>The new file size.</desc>
       </param>
     </method>
 
@@ -11700,18 +12674,19 @@
 
   <interface
     name="IGuestFile" extends="IFile"
-    uuid="60661aec-145f-4d11-b80e-8ea151598093"
+    uuid="92f21dc0-44de-1653-b717-2ebf0ca9b664"
     wsmap="managed"
     >
     <desc>
       Implementation of the <link to="IFile" /> object
-      for files on the guest.
+      for files in the guest.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
     name="IFsObjInfo" extends="$unknown"
-    uuid="4047ba30-7006-4966-ae86-94164e5e20eb"
+    uuid="37b30bc6-4506-58e4-bc43-fbbca92b4548"
     wsmap="managed"
     >
     <desc>
@@ -11821,18 +12796,19 @@
 
   <interface
     name="IGuestFsObjInfo" extends="IFsObjInfo"
-    uuid="d5cf678e-3484-4e4a-ac55-329e15462e18"
+    uuid="6620db85-44e0-ca69-e9e0-d4907ceccbe5"
     wsmap="managed"
     >
     <desc>
       Represents the guest implementation of the
       <link to="IFsObjInfo" /> object.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
     name="IGuest" extends="$unknown"
-    uuid="8011a1b1-6adb-4ffb-a37e-20abdaee4650"
+    uuid="97927199-7e1f-4094-97ab-92333e727843"
     wsmap="managed"
     >
     <desc>
@@ -11861,25 +12837,40 @@
 
     <attribute name="additionsRunLevel" type="AdditionsRunLevelType" readonly="yes">
       <desc>
-        Current run level of the Guest Additions.
+        Current run level of the installed Guest Additions.
       </desc>
     </attribute>
 
     <attribute name="additionsVersion" type="wstring" readonly="yes">
       <desc>
-        Version of the Guest Additions in the same format as
+        Version of the installed Guest Additions in the same format as
         <link to="IVirtualBox::version"/>.
       </desc>
     </attribute>
 
     <attribute name="additionsRevision" type="unsigned long" readonly="yes">
       <desc>
-        The internal build revision number of the additions.
+        The internal build revision number of the installed Guest Additions.
 
         See also <link to="IVirtualBox::revision"/>.
       </desc>
     </attribute>
 
+    <attribute name="dnDSource" type="IGuestDnDSource" readonly="yes">
+      <desc>
+        Retrieves the drag'n drop source implementation for the guest side, that
+        is, handling and retrieving drag'n drop data from the guest.
+      </desc>
+    </attribute>
+
+    <attribute name="dnDTarget" type="IGuestDnDTarget" readonly="yes">
+      <desc>
+        Retrieves the drag'n drop source implementation for the host side. This
+        will allow the host to handle and initiate a drag'n drop operation to copy
+        data from the host to the guest.
+      </desc>
+    </attribute>
+
     <attribute name="eventSource" type="IEventSource" readonly="yes">
       <desc>
         Event source for guest events.
@@ -11888,8 +12879,8 @@
 
     <attribute name="facilities" type="IAdditionsFacility" readonly="yes" safearray="yes">
       <desc>
-        Array of current known facilities. Only returns facilities where a status is known,
-        e.g. facilities with an unknown status will not be returned.
+        Returns a collection of current known facilities. Only returns facilities where
+        a status is known, e.g. facilities with an unknown status will not be returned.
       </desc>
     </attribute>
 
@@ -11933,296 +12924,83 @@
       <param name="memCache" type="unsigned long" dir="out">
         <desc>Total amount of guest (disk) cache memory.</desc>
       </param>
-      <param name="pagedTotal" type="unsigned long" dir="out">
-        <desc>Total amount of space in the page file.</desc>
-      </param>
-      <param name="memAllocTotal" type="unsigned long" dir="out">
-        <desc>Total amount of memory allocated by the hypervisor.</desc>
-      </param>
-      <param name="memFreeTotal" type="unsigned long" dir="out">
-        <desc>Total amount of free memory available in the hypervisor.</desc>
-      </param>
-      <param name="memBalloonTotal" type="unsigned long" dir="out">
-        <desc>Total amount of memory ballooned by the hypervisor.</desc>
-      </param>
-      <param name="memSharedTotal" type="unsigned long" dir="out">
-        <desc>Total amount of shared memory in the hypervisor.</desc>
-      </param>
-    </method>
-
-    <method name="getFacilityStatus">
-      <desc>
-        Get the current status of a Guest Additions facility.
-      </desc>
-      <param name="facility" type="AdditionsFacilityType" dir="in">
-        <desc>Facility to check status for.</desc>
-      </param>
-      <param name="timestamp" type="long long" dir="out">
-        <desc>Timestamp (in ms) of last status update seen by the host.</desc>
-      </param>
-      <param name="status" type="AdditionsFacilityStatus" dir="return">
-        <desc>The current (latest) facility status.</desc>
-      </param>
-    </method>
-
-    <method name="getAdditionsStatus">
-      <desc>
-        Retrieve the current status of a certain Guest Additions run level.
-
-        <result name="VBOX_E_NOT_SUPPORTED">
-          Wrong status level specified.
-        </result>
-
-      </desc>
-      <param name="level" type="AdditionsRunLevelType" dir="in">
-        <desc>Status level to check</desc>
-      </param>
-      <param name="active" type="boolean" dir="return">
-        <desc>Flag whether the status level has been reached or not</desc>
-      </param>
-    </method>
-
-    <method name="setCredentials">
-      <desc>
-        Store login credentials that can be queried by guest operating
-        systems with Additions installed. The credentials are transient
-        to the session and the guest may also choose to erase them. Note
-        that the caller cannot determine whether the guest operating system
-        has queried or made use of the credentials.
-
-        <result name="VBOX_E_VM_ERROR">
-          VMM device is not available.
-        </result>
-
-      </desc>
-      <param name="userName" type="wstring" dir="in">
-        <desc>User name string, can be empty</desc>
-      </param>
-      <param name="password" type="wstring" dir="in">
-        <desc>Password string, can be empty</desc>
-      </param>
-      <param name="domain" type="wstring" dir="in">
-        <desc>Domain name (guest logon scheme specific), can be empty</desc>
-      </param>
-      <param name="allowInteractiveLogon" type="boolean" dir="in">
-        <desc>
-          Flag whether the guest should alternatively allow the user to
-          interactively specify different credentials. This flag might
-          not be supported by all versions of the Additions.
-        </desc>
-      </param>
-    </method>
-
-    <method name="dragHGEnter">
-      <desc>
-        Informs the guest about a Drag and Drop enter event.
-
-        This is used in Host - Guest direction.
-
-        <result name="VBOX_E_VM_ERROR">
-          VMM device is not available.
-        </result>
-
-      </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>The screen id where the Drag and Drop event occurred.</desc>
-      </param>
-      <param name="y" type="unsigned long" dir="in">
-        <desc>y-position of the event.</desc>
-      </param>
-      <param name="x" type="unsigned long" dir="in">
-        <desc>x-position of the event.</desc>
-      </param>
-      <param name="defaultAction" type="DragAndDropAction" dir="in">
-        <desc>The default action to use.</desc>
-      </param>
-      <param name="allowedActions" type="DragAndDropAction" dir="in" safearray="yes">
-        <desc>The actions which are allowed.</desc>
-      </param>
-      <param name="formats" type="wstring" dir="in" safearray="yes">
-        <desc>The supported mime types.</desc>
-      </param>
-      <param name="resultAction" type="DragAndDropAction" dir="return">
-        <desc>The resulting action of this event.</desc>
-      </param>
-    </method>
-
-    <method name="dragHGMove">
-      <desc>
-        Informs the guest about a Drag and Drop move event.
-
-        This is used in Host - Guest direction.
-
-        <result name="VBOX_E_VM_ERROR">
-          VMM device is not available.
-        </result>
-
-      </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>The screen id where the Drag and Drop event occurred.</desc>
-      </param>
-      <param name="x" type="unsigned long" dir="in">
-        <desc>x-position of the event.</desc>
-      </param>
-      <param name="y" type="unsigned long" dir="in">
-        <desc>y-position of the event.</desc>
-      </param>
-      <param name="defaultAction" type="DragAndDropAction" dir="in">
-        <desc>The default action to use.</desc>
-      </param>
-      <param name="allowedActions" type="DragAndDropAction" dir="in" safearray="yes">
-        <desc>The actions which are allowed.</desc>
-      </param>
-      <param name="formats" type="wstring" dir="in" safearray="yes">
-        <desc>The supported mime types.</desc>
-      </param>
-      <param name="resultAction" type="DragAndDropAction" dir="return">
-        <desc>The resulting action of this event.</desc>
-      </param>
-    </method>
-
-    <method name="dragHGLeave">
-      <desc>
-        Informs the guest about a Drag and Drop leave event.
-
-        This is used in Host - Guest direction.
-
-        <result name="VBOX_E_VM_ERROR">
-          VMM device is not available.
-        </result>
-
-      </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>The screen id where the Drag and Drop event occurred.</desc>
-      </param>
-    </method>
-
-    <method name="dragHGDrop">
-      <desc>
-        Informs the guest about a drop event.
-
-        This is used in Host - Guest direction.
-
-        <result name="VBOX_E_VM_ERROR">
-          VMM device is not available.
-        </result>
-
-      </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>The screen id where the Drag and Drop event occurred.</desc>
-      </param>
-      <param name="x" type="unsigned long" dir="in">
-        <desc>x-position of the event.</desc>
-      </param>
-      <param name="y" type="unsigned long" dir="in">
-        <desc>y-position of the event.</desc>
-      </param>
-      <param name="defaultAction" type="DragAndDropAction" dir="in">
-        <desc>The default action to use.</desc>
+      <param name="pagedTotal" type="unsigned long" dir="out">
+        <desc>Total amount of space in the page file.</desc>
       </param>
-      <param name="allowedActions" type="DragAndDropAction" dir="in" safearray="yes">
-        <desc>The actions which are allowed.</desc>
+      <param name="memAllocTotal" type="unsigned long" dir="out">
+        <desc>Total amount of memory allocated by the hypervisor.</desc>
       </param>
-      <param name="formats" type="wstring" dir="in" safearray="yes">
-        <desc>The supported mime types.</desc>
+      <param name="memFreeTotal" type="unsigned long" dir="out">
+        <desc>Total amount of free memory available in the hypervisor.</desc>
       </param>
-      <param name="format" type="wstring" dir="out">
-        <desc>The resulting format of this event.</desc>
+      <param name="memBalloonTotal" type="unsigned long" dir="out">
+        <desc>Total amount of memory ballooned by the hypervisor.</desc>
       </param>
-      <param name="resultAction" type="DragAndDropAction" dir="return">
-        <desc>The resulting action of this event.</desc>
+      <param name="memSharedTotal" type="unsigned long" dir="out">
+        <desc>Total amount of shared memory in the hypervisor.</desc>
       </param>
     </method>
 
-    <method name="dragHGPutData">
+    <method name="getFacilityStatus">
       <desc>
-        Informs the guest about a drop data event.
-
-        This is used in Host - Guest direction.
-
-        <result name="VBOX_E_VM_ERROR">
-          VMM device is not available.
-        </result>
-
+        Get the current status of a Guest Additions facility.
       </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>The screen id where the Drag and Drop event occurred.</desc>
-      </param>
-      <param name="format" type="wstring" dir="in">
-        <desc>The mime type the data is in.</desc>
+      <param name="facility" type="AdditionsFacilityType" dir="in">
+        <desc>Facility to check status for.</desc>
       </param>
-      <param name="data" type="octet" dir="in" safearray="yes">
-        <desc>The actual data.</desc>
+      <param name="timestamp" type="long long" dir="out">
+        <desc>Timestamp (in ms) of last status update seen by the host.</desc>
       </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
+      <param name="status" type="AdditionsFacilityStatus" dir="return">
+        <desc>The current (latest) facility status.</desc>
       </param>
     </method>
 
-    <method name="dragGHPending">
+    <method name="getAdditionsStatus">
       <desc>
-        Ask the guest if there is any Drag and Drop operation pending in the guest.
-
-        If no Drag and Drop operation is pending currently, Ignore is returned.
-
-        This is used in Guest - Host direction.
+        Retrieve the current status of a certain Guest Additions run level.
 
-        <result name="VBOX_E_VM_ERROR">
-          VMM device is not available.
+        <result name="VBOX_E_NOT_SUPPORTED">
+          Wrong status level specified.
         </result>
 
       </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>The screen id where the Drag and Drop event occurred.</desc>
-      </param>
-      <param name="formats" type="wstring" dir="out" safearray="yes">
-        <desc>On return the supported mime types.</desc>
-      </param>
-      <param name="allowedActions" type="DragAndDropAction" dir="out" safearray="yes">
-        <desc>On return the actions which are allowed.</desc>
+      <param name="level" type="AdditionsRunLevelType" dir="in">
+        <desc>Status level to check</desc>
       </param>
-      <param name="defaultAction" type="DragAndDropAction" dir="return">
-        <desc>On return the default action to use.</desc>
+      <param name="active" type="boolean" dir="return">
+        <desc>Flag whether the status level has been reached or not</desc>
       </param>
     </method>
 
-    <method name="dragGHDropped">
+    <method name="setCredentials">
       <desc>
-        Informs the guest that a drop event occurred for a pending Drag and Drop event.
-
-        This is used in Guest - Host direction.
+        Store login credentials that can be queried by guest operating
+        systems with Additions installed. The credentials are transient
+        to the session and the guest may also choose to erase them. Note
+        that the caller cannot determine whether the guest operating system
+        has queried or made use of the credentials.
 
         <result name="VBOX_E_VM_ERROR">
           VMM device is not available.
         </result>
 
       </desc>
-
-      <param name="format" type="wstring" dir="in">
-        <desc>The mime type the data must be in.</desc>
+      <param name="userName" type="wstring" dir="in">
+        <desc>User name string, can be empty</desc>
       </param>
-      <param name="action" type="DragAndDropAction" dir="in">
-        <desc>The action to use.</desc>
+      <param name="password" type="wstring" dir="in">
+        <desc>Password string, can be empty</desc>
       </param>
-      <param name="progress" type="IProgress" dir="return">
-        <desc>Progress object to track the operation completion.</desc>
+      <param name="domain" type="wstring" dir="in">
+        <desc>Domain name (guest logon scheme specific), can be empty</desc>
       </param>
-    </method>
-
-    <method name="dragGHGetData">
-      <desc>
-        Fetch the data of a previously Drag and Drop event from the guest.
-
-        This is used in Guest - Host direction.
-
-        <result name="VBOX_E_VM_ERROR">
-          VMM device is not available.
-        </result>
-
-      </desc>
-
-      <param name="data" type="octet" safearray="yes" dir="return">
-        <desc>The actual data.</desc>
+      <param name="allowInteractiveLogon" type="boolean" dir="in">
+        <desc>
+          Flag whether the guest should alternatively allow the user to
+          interactively specify different credentials. This flag might
+          not be supported by all versions of the Additions.
+        </desc>
       </param>
     </method>
 
@@ -12234,35 +13012,23 @@
         To wait for successful startup, use the <link to="IGuestSession::waitFor"/>
         call.
 
-        A guest session represents one impersonated user account on the guest, so
+        A guest session represents one impersonated user account in the guest, so
         every operation will use the same credentials specified when creating
         the session object via <link to="IGuest::createSession"/>. Anonymous
         sessions, that is, sessions without specifying a valid
-        user account on the guest are not allowed due to security reasons.
-
-        There can be a maximum of 32 sessions at once per VM. Each session keeps
-        track of its started guest processes, opened guest files or guest directories.
-        To work on guest files or directories a guest session offers methods to open
-        or create such objects (see <link to="IGuestSession::fileOpen"/> or
-        <link to="IGuestSession::directoryOpen"/> for example).
-
-        There can be up to 2048 objects (guest processes, files or directories)
-        a time per guest session. Exceeding the limit will result in an appropriate
-        error message.
-
-        When done with either of these objects, including the guest session itself,
-        use the appropriate close() method to let the object do its cleanup work.
+        user account in the guest are not allowed reasons of security.
 
-        Every guest session has its own environment variable block which gets
-        automatically applied when starting a new guest process via
-        <link to="IGuestSession::processCreate"/> or <link to="IGuestSession::processCreateEx"/>.
-        To override (or unset) certain environment variables already set by the
-        guest session, one can specify a per-process environment block when using
-        one of the both above mentioned process creation calls.
+        There can be a maximum of 32 sessions at once per VM.  An error will
+        be returned if this has been reached. <!-- This should actually read:
+        VBOX_E_IPRT_ERROR will be return if this limit has been reached.
+        However, keep in mind that VBOX_E_IPRT_ERROR can be returned for about
+        88 unrelated reasons, so you don't know what happend unless you parse
+        the error text. (bird) -->
+<!-- @todo r=bird: Seriously, add an dedicated VBOX_E_MAX_GUEST_SESSIONS status
+for this condition.  Do the same for all other maximums and things that could be
+useful to the API client. -->
 
-        Closing a session via <link to="IGuestSession::close" /> will try to close
-        all the mentioned objects above unless these objects are still used by
-        a client.
+        For more information please consult <link to="IGuestSession"/>
       </desc>
       <param name="user" type="wstring" dir="in">
         <desc>
@@ -12346,7 +13112,7 @@
         <desc>
           Optional command line arguments to use for the Guest Additions
           installer. Useful for retrofitting features which weren't installed
-          before on the guest.
+          before in the guest.
         </desc>
       </param>
       <param name="flags" type="AdditionsUpdateFlag" dir="in" safearray="yes">
@@ -12379,7 +13145,7 @@
         An instance of this is returned every time VirtualBox starts
         an asynchronous task (in other words, a separate thread) which
         continues to run after a method call returns. For example,
-        <link to="IConsole::saveState" />, which saves the state of
+        <link to="IMachine::saveState" />, which saves the state of
         a running virtual machine, can take a long time to complete.
         To be able to display a progress bar, a user interface such as
         the VirtualBox graphical user interface can use the IProgress
@@ -12628,12 +13394,12 @@
       the exact state it was in when the snapshot was taken.
 
       The ISnapshot interface has no methods, only attributes; snapshots
-      are controlled through methods of the <link to="IConsole" /> interface
+      are controlled through methods of the <link to="IMachine" /> interface
       which also manage the media associated with the snapshot.
       The following operations exist:
 
       <ul>
-          <li><link to="IConsole::takeSnapshot"/> creates a new snapshot
+          <li><link to="IMachine::takeSnapshot"/> creates a new snapshot
               by creating new, empty differencing images for the machine's
               media and saving the VM settings and (if the VM is running)
               the current VM state in the snapshot.
@@ -12651,7 +13417,7 @@
               snapshots tree.
           </li>
 
-          <li><link to="IConsole::restoreSnapshot"/> resets a machine to
+          <li><link to="IMachine::restoreSnapshot"/> resets a machine to
               the state of a previous snapshot by deleting the differencing
               image of each of the machine's media and setting the machine's
               settings and state to the state that was saved in the snapshot (if any).
@@ -12661,7 +13427,7 @@
               that was restored.
           </li>
 
-          <li><link to="IConsole::deleteSnapshot"/> deletes a snapshot
+          <li><link to="IMachine::deleteSnapshot"/> deletes a snapshot
               without affecting the current machine state.
 
               This does not change the current machine state, but instead frees the
@@ -12890,7 +13656,7 @@
 
   <enum
     name="MediumVariant"
-    uuid="80685b6b-e42f-497d-8271-e77bf3c61ada"
+    uuid="0282e97f-4ef3-4411-a8e0-47c384803cb6"
     >
     <desc>
       Virtual medium image variant. More than one flag may be set.
@@ -12923,6 +13689,11 @@
         VMDK format variant used on ESX products.
       </desc>
     </const>
+    <const name="VdiZeroExpand"         value="0x100">
+      <desc>
+        Fill new blocks with zeroes while expanding image file.
+      </desc>
+    </const>
     <const name="Fixed"                 value="0x10000">
       <desc>
         Fixed image. Only allowed for base images.
@@ -13185,7 +13956,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
   <interface
     name="IMedium" extends="$unknown"
-    uuid="05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac"
+    uuid="9680d99b-3550-4e14-8fc4-82ad1426cbde"
     wsmap="managed"
     >
     <desc>
@@ -13225,7 +13996,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
       Existing media are opened using <link to="IVirtualBox::openMedium"/>;
       new hard disk media can be created with the VirtualBox API using the
-      <link to="IVirtualBox::createHardDisk"/> method. Differencing hard
+      <link to="IVirtualBox::createMedium"/> method. Differencing hard
       disks (see below) are usually implicitly created by VirtualBox as
       needed, but may also be created explicitly using <link to="#createDiffStorage"/>.
       VirtualBox cannot create CD/DVD or floppy images (ISO and RAW files); these
@@ -13516,7 +14287,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </desc>
     </attribute>
 
-    <attribute name="parent" type="IMedium" readonly="yes">
+    <attribute name="parent" type="IMedium" readonly="yes" wrap-hint-server="passcaller">
       <desc>
         Parent of this medium (the medium this medium is directly based
         on).
@@ -13526,7 +14297,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </desc>
     </attribute>
 
-    <attribute name="children" type="IMedium" safearray="yes" readonly="yes">
+    <attribute name="children" type="IMedium" safearray="yes" readonly="yes" wrap-hint-server="passcaller">
       <desc>
         Children of this medium (all differencing media directly based
         on this medium). A @c null array is returned if this medium
@@ -13534,7 +14305,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </desc>
     </attribute>
 
-    <attribute name="base" type="IMedium" readonly="yes">
+    <attribute name="base" type="IMedium" readonly="yes" wrap-hint-server="passcaller">
       <desc>
         Base medium of this medium.
 
@@ -13648,7 +14419,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </desc>
     </attribute>
 
-    <method name="setIds">
+    <method name="setIds" wrap-hint-server="passcaller">
       <desc>
         Changes the UUID and parent UUID for a hard disk medium.
       </desc>
@@ -13684,7 +14455,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </result>
     </method>
 
-    <method name="refreshState">
+    <method name="refreshState" wrap-hint-server="passcaller">
       <desc>
         If the current medium state (see <link to="MediumState"/>) is one of
         "Created", "Inaccessible" or "LockedRead", then this performs an
@@ -13863,7 +14634,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </param>
     </method>
 
-    <method name="close">
+    <method name="close" wrap-hint-server="passcaller">
       <desc>
         Closes this medium.
 
@@ -14433,6 +15204,81 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </param>
     </method>
 
+    <method name="changeEncryption">
+      <desc>
+        Starts encryption of this medium. This means that the stored data in the
+        medium is encrypted.
+
+        This medium will be placed to <link to="MediumState_LockedWrite"/>
+        state.
+
+        Please note that the results can be either returned straight away,
+        or later as the result of the background operation via the object
+        returned via the @a progress parameter.
+
+        <result name="VBOX_E_NOT_SUPPORTED">
+          Encryption is not supported for this medium because it is attached to more than one VM
+          or has children.
+        </result>
+      </desc>
+      <param name="currentPassword" type="wstring" dir="in">
+        <desc>
+          The current password the medium is protected with. Use an empty string to indicate
+          that the medium isn't encrypted.
+        </desc>
+      </param>
+      <param name="cipher" type="wstring" dir="in">
+        <desc>
+          The cipher to use for encryption. An empty string indicates no encryption for the
+          result.
+        </desc>
+      </param>
+      <param name="newPassword" type="wstring" dir="in">
+        <desc>
+          The new password the medium should be protected with. An empty password and password ID
+          will result in the medium being encrypted with the current password.
+        </desc>
+      </param>
+      <param name="newPasswordId" type="wstring" dir="in">
+        <desc>The ID of the new password when unlocking the medium.</desc>
+      </param>
+      <param name="progress" type="IProgress" dir="return">
+        <desc>Progress object to track the operation completion.</desc>
+      </param>
+    </method>
+
+    <method name="getEncryptionSettings" const="yes">
+      <desc>
+        Returns the encryption settings for this medium.
+
+        <result name="VBOX_E_NOT_SUPPORTED">
+          Encryption is not configured for this medium.
+        </result>
+      </desc>
+      <param name="cipher" type="wstring" dir="out">
+        <desc>The cipher used for encryption.</desc>
+      </param>
+      <param name="passwordId" type="wstring" dir="return">
+        <desc>The ID of the password when unlocking the medium.</desc>
+      </param>
+    </method>
+
+    <method name="checkEncryptionPassword" const="yes">
+      <desc>
+        Checks whether the supplied password is correct for the medium.
+
+        <result name="VBOX_E_NOT_SUPPORTED">
+          Encryption is not configured for this medium.
+        </result>
+        <result name="VBOX_E_PASSWORD_INCORRECT">
+          The given password is incorrect.
+        </result>
+      </desc>
+      <param name="password" type="wstring" dir="in">
+        <desc>The password to check.</desc>
+      </param>
+    </method>
+
   </interface>
 
 
@@ -14553,7 +15399,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
         Each medium format is identified by a string represented by the
         <link to="#id"/> attribute. This string is used in calls like
-        <link to="IVirtualBox::createHardDisk"/> to specify the desired
+        <link to="IVirtualBox::createMedium"/> to specify the desired
         format.
 
         The list of all supported medium formats can be obtained using
@@ -14577,7 +15423,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
         This string is used in methods of other interfaces where it is necessary
         to specify a medium format, such as
-        <link to="IVirtualBox::createHardDisk"/>.
+        <link to="IVirtualBox::createMedium"/>.
       </desc>
     </attribute>
 
@@ -14699,9 +15545,22 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
   /////////////////////////////////////////////////////////////////////////
   -->
 
+  <enum
+    name="KeyboardLED"
+    uuid="ef29ea38-409b-49c7-a817-c858d426dfba"
+    >
+    <desc>
+      Keyboard LED indicators.
+    </desc>
+
+    <const name="NumLock" value="0x01"/>
+    <const name="CapsLock" value="0x02"/>
+    <const name="ScrollLock" value="0x04"/>
+  </enum>
+
   <interface
     name="IKeyboard" extends="$unknown"
-    uuid="f6916ec5-a881-4237-898f-7de58cf88672"
+    uuid="585cc5e8-349c-41c6-899d-d9a38e3f4126"
     wsmap="managed"
     >
     <desc>
@@ -14712,6 +15571,12 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       to the virtual machine.
     </desc>
 
+    <attribute name="keyboardLEDs" type="KeyboardLED" safearray="yes" readonly="yes">
+      <desc>
+        Current status of the guest keyboard LEDs.
+      </desc>
+    </attribute>
+
     <method name="putScancode">
       <desc>Sends a scancode to the keyboard.
 
@@ -14747,6 +15612,18 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </desc>
     </method>
 
+    <method name="releaseKeys">
+      <desc>Causes the virtual keyboard to release any keys which are
+      currently pressed. Useful when host and guest keyboard may be out
+      of sync.
+
+        <result name="VBOX_E_IPRT_ERROR">
+          Could not release some or all keys.
+        </result>
+
+      </desc>
+    </method>
+
     <attribute name="eventSource" type="IEventSource" readonly="yes">
       <desc>
         Event source for keyboard events.
@@ -14802,8 +15679,81 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
   </enum>
 
   <interface
+    name="IMousePointerShape" extends="$unknown"
+    uuid="4609f3e1-839a-4edd-b57f-cc4584b39173"
+    wsmap="managed"
+    >
+    <desc>
+      The guest mouse pointer description.
+    </desc>
+
+    <attribute name="visible" type="boolean" readonly="yes">
+      <desc>
+        Flag whether the pointer is visible.
+      </desc>
+    </attribute>
+    <attribute name="alpha" type="boolean" readonly="yes">
+      <desc>
+        Flag whether the pointer has an alpha channel.
+      </desc>
+    </attribute>
+    <attribute name="hotX" type="unsigned long" readonly="yes">
+      <desc>
+        The pointer hot spot X coordinate.
+      </desc>
+    </attribute>
+    <attribute name="hotY" type="unsigned long" readonly="yes">
+      <desc>
+        The pointer hot spot Y coordinate.
+      </desc>
+    </attribute>
+    <attribute name="width" type="unsigned long" readonly="yes">
+      <desc>
+        Width of the pointer shape in pixels.
+      </desc>
+    </attribute>
+    <attribute name="height" type="unsigned long" readonly="yes">
+      <desc>
+        Height of the pointer shape in pixels.
+      </desc>
+    </attribute>
+    <attribute name="shape" type="octet" safearray="yes" readonly="yes">
+      <desc>
+        Shape bitmaps.
+
+        The @a shape buffer contains a 1bpp (bits per pixel) AND mask
+        followed by a 32bpp XOR (color) mask.
+
+        For pointers without alpha channel the XOR mask pixels are
+        32 bit values: (lsb)BGR0(msb). For pointers with alpha channel
+        the XOR mask consists of (lsb)BGRA(msb) 32 bit values.
+
+        An AND mask is provided for pointers with alpha channel, so if the
+        client does not support alpha, the pointer could be
+        displayed as a normal color pointer.
+
+        The AND mask is a 1bpp bitmap with byte aligned scanlines. The
+        size of the AND mask therefore is <tt>cbAnd = (width + 7) / 8 *
+          height</tt>. The padding bits at the end of each scanline are
+        undefined.
+
+        The XOR mask follows the AND mask on the next 4-byte aligned
+        offset: <tt>uint8_t *pu8Xor = pu8And + (cbAnd + 3) & ~3</tt>.
+        Bytes in the gap between the AND and the XOR mask are undefined.
+        The XOR mask scanlines have no gap between them and the size of
+        the XOR mask is: <tt>cbXor = width * 4 * height</tt>.
+
+        <note>
+          If @a shape size is 0, then the shape is not known or did not change.
+          This can happen if only the pointer visibility is changed.
+        </note>
+      </desc>
+    </attribute>
+  </interface>
+
+  <interface
     name="IMouse" extends="$unknown"
-    uuid="ee770393-415f-4421-b2d5-28b73cacf86a"
+    uuid="4c3fa51c-7b9a-4ecf-97f0-d75a945bd26c"
     wsmap="managed"
     >
     <desc>
@@ -14865,6 +15815,12 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </desc>
     </attribute>
 
+    <attribute name="pointerShape" type="IMousePointerShape" readonly="yes">
+      <desc>
+        The current mouse pointer used by the guest.
+      </desc>
+    </attribute>
+
     <method name="putMouseEvent">
       <desc>
         Initiates a mouse event using relative pointer movements
@@ -15065,41 +16021,55 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
   /////////////////////////////////////////////////////////////////////////
   -->
 
+  <interface
+    name="IDisplaySourceBitmap" extends="$unknown" wsmap="suppress"
+    uuid="0b78daeb-f52f-43b9-99e8-4a3c226cbe2d"
+    >
+    <attribute name="screenId" type="unsigned long" readonly="yes"/>
+    <method name="queryBitmapInfo">
+      <desc>Information about the screen bitmap.</desc>
+      <param name="address" type="octet" mod="ptr" dir="out"/>
+      <param name="width" type="unsigned long" dir="out"/>
+      <param name="height" type="unsigned long" dir="out"/>
+      <param name="bitsPerPixel" type="unsigned long" dir="out"/>
+      <param name="bytesPerLine" type="unsigned long" dir="out"/>
+      <param name="bitmapFormat" type="BitmapFormat" dir="out"/>
+    </method>
+
+  </interface>
+
   <enum
-    name="FramebufferPixelFormat"
-    uuid="7acfd5ed-29e3-45e3-8136-73c9224f3d2d"
+    name="FramebufferCapabilities"
+    uuid="cc395839-30fa-4ca5-ae65-e6360e3edd7a"
     >
     <desc>
-      Format of the video memory buffer. Constants represented by this enum can
-      be used to test for particular values of <link
-      to="IFramebuffer::pixelFormat"/>.
-
-      See also www.fourcc.org for more information about FOURCC pixel formats.
+      Framebuffer capability flags.
     </desc>
 
-    <const name="Opaque"                value="0">
+    <const name="UpdateImage" value="0x01">
       <desc>
-        Unknown buffer format (the user may not assume any particular format of
-        the buffer).
+        Requires NotifyUpdateImage. NotifyUpdate must not be called.
+      </desc>
+    </const>
+
+    <const name="VHWA" value="0x02">
+      <desc>
+        Supports VHWA interface. If set, then IFramebuffer::processVHWACommand can be called.
       </desc>
     </const>
-    <const name="FOURCC_RGB"            value="0x32424752">
+
+    <const name="VisibleRegion" value="0x04">
       <desc>
-        Basic RGB format (<link to="IFramebuffer::bitsPerPixel"/> determines the
-        bit layout).
+        Supports visible region. If set, then IFramebuffer::setVisibleRegion can be called.
       </desc>
     </const>
   </enum>
 
   <interface
     name="IFramebuffer" extends="$unknown"
-    uuid="e3f122c0-adab-4fc9-a8dc-da112fb48428"
+    uuid="dd07f843-be2e-4cae-83fe-8bf5d33c80e9"
     wsmap="managed"
     >
-    <attribute name="address" type="octet" mod="ptr" readonly="yes" wsmap="suppress">
-      <desc>Address of the start byte of the frame buffer.</desc>
-    </attribute>
-
     <attribute name="width" type="unsigned long" readonly="yes">
       <desc>Frame buffer width, in pixels.</desc>
     </attribute>
@@ -15110,39 +16080,28 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
     <attribute name="bitsPerPixel" type="unsigned long" readonly="yes">
       <desc>
-        Color depth, in bits per pixel. When <link to="#pixelFormat"/> is <link
-        to="FramebufferPixelFormat_FOURCC_RGB">FOURCC_RGB</link>, valid values
-        are: 8, 15, 16, 24 and 32.
+        Color depth, in bits per pixel.
       </desc>
     </attribute>
 
     <attribute name="bytesPerLine" type="unsigned long" readonly="yes">
       <desc>
-        Scan line size, in bytes. When <link to="#pixelFormat"/> is <link
-        to="FramebufferPixelFormat_FOURCC_RGB">FOURCC_RGB</link>, the
-        size of the scan line must be aligned to 32 bits.
+        Scan line size, in bytes.
       </desc>
     </attribute>
 
-    <attribute name="pixelFormat" type="unsigned long" readonly="yes">
+    <attribute name="pixelFormat" type="BitmapFormat" readonly="yes">
       <desc>
-        Frame buffer pixel format. It's either one of the values defined by <link
-        to="FramebufferPixelFormat"/> or a raw FOURCC code.
+        Frame buffer pixel format. It's one of the values defined by <link
+        to="BitmapFormat"/>.
         <note>
           This attribute must never (and will never) return <link
-          to="FramebufferPixelFormat_Opaque"/> -- the format of the frame
+          to="BitmapFormat_Opaque"/> -- the format of the frame
           buffer must be always known.
         </note>
       </desc>
     </attribute>
 
-    <attribute name="usesGuestVRAM" type="boolean" readonly="yes">
-      <desc>
-        Defines whether this frame buffer uses the virtual video card's memory
-        buffer (guest VRAM) directly or not.
-      </desc>
-    </attribute>
-
     <attribute name="heightReduction" type="unsigned long" readonly="yes">
       <desc>
         Hint from the frame buffer about how much of the standard
@@ -15173,25 +16132,9 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
         Platform-dependent identifier of the window where context of this
         frame buffer is drawn, or zero if there's no such window.
       </desc>
-    </attribute>
-
-    <method name="lock" wsmap="suppress">
-      <desc>
-        Locks the frame buffer.
-        Gets called by the IDisplay object where this frame buffer is
-        bound to.
-      </desc>
-    </method>
-
-    <method name="unlock" wsmap="suppress">
-      <desc>
-        Unlocks the frame buffer.
-        Gets called by the IDisplay object where this frame buffer is
-        bound to.
-      </desc>
-    </method>
+    </attribute>
 
-    <method name="notifyUpdate" wsmap="suppress">
+    <method name="notifyUpdate">
       <desc>
         Informs about an update.
         Gets called by the display object where this buffer is
@@ -15203,109 +16146,35 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       <param name="height" type="unsigned long" dir="in"/>
     </method>
 
-    <method name="requestResize" wsmap="suppress">
-      <desc>
-        Requests a size and pixel format change.
-
-        There are two modes of working with the video buffer of the virtual
-        machine. The <i>indirect</i> mode implies that the IFramebuffer
-        implementation allocates a memory buffer for the requested display mode
-        and provides it to the virtual machine. In <i>direct</i> mode, the
-        IFramebuffer implementation uses the memory buffer allocated and owned
-        by the virtual machine. This buffer represents the video memory of the
-        emulated video adapter (so called <i>guest VRAM</i>). The direct mode is
-        usually faster because the implementation gets a raw pointer to the
-        guest VRAM buffer which it can directly use for visualizing the contents
-        of the virtual display, as opposed to the indirect mode where the
-        contents of guest VRAM are copied to the memory buffer provided by
-        the implementation every time a display update occurs.
-
-        It is important to note that the direct mode is really fast only when
-        the implementation uses the given guest VRAM buffer directly, for
-        example, by blitting it to the window representing the virtual machine's
-        display, which saves at least one copy operation comparing to the
-        indirect mode. However, using the guest VRAM buffer directly is not
-        always possible: the format and the color depth of this buffer may be
-        not supported by the target window, or it may be unknown (opaque) as in
-        case of text or non-linear multi-plane VGA video modes. In this case,
-        the indirect mode (that is always available) should be used as a
-        fallback: when the guest VRAM contents are copied to the
-        implementation-provided memory buffer, color and format conversion is
-        done automatically by the underlying code.
-
-        The @a pixelFormat parameter defines whether the direct mode is
-        available or not. If @a pixelFormat is <link
-        to="FramebufferPixelFormat_Opaque"/> then direct access to the guest
-        VRAM buffer is not available -- the @a VRAM, @a bitsPerPixel and
-        @a bytesPerLine parameters must be ignored and the implementation must use
-        the indirect mode (where it provides its own buffer in one of the
-        supported formats). In all other cases, @a pixelFormat together with
-        @a bitsPerPixel and @a bytesPerLine define the format of the video memory
-        buffer pointed to by the @a VRAM parameter and the implementation is
-        free to choose which mode to use. To indicate that this frame buffer uses
-        the direct mode, the implementation of the <link to="#usesGuestVRAM"/>
-        attribute must return @c true and <link to="#address"/> must
-        return exactly the same address that is passed in the @a VRAM parameter
-        of this method; otherwise it is assumed that the indirect strategy is
-        chosen.
-
-        The @a width and @a height parameters represent the size of the
-        requested display mode in both modes. In case of indirect mode, the
-        provided memory buffer should be big enough to store data of the given
-        display mode. In case of direct mode, it is guaranteed that the given
-        @a VRAM buffer contains enough space to represent the display mode of the
-        given size. Note that this frame buffer's <link to="#width"/> and <link
-        to="#height"/> attributes must return exactly the same values as
-        passed to this method after the resize is completed (see below).
-
-        The @a finished output parameter determines if the implementation has
-        finished resizing the frame buffer or not. If, for some reason, the
-        resize cannot be finished immediately during this call, @a finished
-        must be set to @c false, and the implementation must call
-        <link to="IDisplay::resizeCompleted"/> after it has returned from
-        this method as soon as possible. If @a finished is @c false, the
-        machine will not call any frame buffer methods until
-        <link to="IDisplay::resizeCompleted"/> is called.
-
-        Note that if the direct mode is chosen, the <link to="#bitsPerPixel"/>,
-        <link to="#bytesPerLine"/> and <link to="#pixelFormat"/> attributes of
-        this frame buffer must return exactly the same values as specified in the
-        parameters of this method, after the resize is completed. If the
-        indirect mode is chosen, these attributes must return values describing
-        the format of the implementation's own memory buffer <link
-        to="#address"/> points to. Note also that the <link to="#bitsPerPixel"/>
-        value must always correlate with <link to="#pixelFormat"/>. Note that
-        the <link to="#pixelFormat"/> attribute must never return <link
-        to="FramebufferPixelFormat_Opaque"/> regardless of the selected mode.
-
-        <note>
-          This method is called by the IDisplay object under the
-          <link to="#lock"/> provided by this IFramebuffer
-          implementation. If this method returns @c false in @a finished, then
-          this lock is not released until
-          <link to="IDisplay::resizeCompleted"/> is called.
-        </note>
+    <method name="notifyUpdateImage">
+      <desc>
+        Informs about an update and provides 32bpp bitmap.
       </desc>
-      <param name="screenId" type="unsigned long" dir="in">
+      <param name="x" type="unsigned long" dir="in"/>
+      <param name="y" type="unsigned long" dir="in"/>
+      <param name="width" type="unsigned long" dir="in"/>
+      <param name="height" type="unsigned long" dir="in"/>
+      <param name="image" type="octet" dir="in" safearray="yes">
         <desc>
-          Logical screen number. Must be used in the corresponding call to
-          <link to="IDisplay::resizeCompleted"/> if this call is made.
+          Array with 32BPP image data.
         </desc>
       </param>
-      <param name="pixelFormat" type="unsigned long" dir="in">
+    </method>
+
+    <method name="notifyChange">
+      <desc>
+        Requests a size change.
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in">
         <desc>
-          Pixel format of the memory buffer pointed to by @a VRAM.
-          See also <link to="FramebufferPixelFormat"/>.
+          Logical guest screen number.
         </desc>
       </param>
-      <param name="VRAM" type="octet" mod="ptr" dir="in">
-        <desc>Pointer to the virtual video card's VRAM (may be @c null).</desc>
-      </param>
-      <param name="bitsPerPixel" type="unsigned long" dir="in">
-        <desc>Color depth, bits per pixel.</desc>
+      <param name="xOrigin" type="unsigned long" dir="in">
+        <desc>Location of the screen in the guest.</desc>
       </param>
-      <param name="bytesPerLine" type="unsigned long" dir="in">
-        <desc>Size of one scan line, in bytes.</desc>
+      <param name="yOrigin" type="unsigned long" dir="in">
+        <desc>Location of the screen in the guest.</desc>
       </param>
       <param name="width" type="unsigned long" dir="in">
         <desc>Width of the guest display, in pixels.</desc>
@@ -15313,13 +16182,6 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       <param name="height" type="unsigned long" dir="in">
         <desc>Height of the guest display, in pixels.</desc>
       </param>
-      <param name="finished" type="boolean" dir="return">
-        <desc>
-          Can the VM start using the new frame buffer immediately
-          after this method returns or it should wait for
-          <link to="IDisplay::resizeCompleted"/>.
-        </desc>
-      </param>
     </method>
 
     <method name="videoModeSupported">
@@ -15425,11 +16287,20 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       <param name="type" type="unsigned long" dir="in">
         <desc>event type. Currently only VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA is supported.</desc>
       </param>
-      <param name="data" type="octet" mod="ptr" dir="in">
+      <param name="data" type="octet" dir="in" safearray="yes">
         <desc>event-specific data, depends on the supplied event type</desc>
       </param>
     </method>
 
+    <attribute name="capabilities" type="FramebufferCapabilities" safearray="yes" readonly="yes">
+      <desc>
+        Capabilities of the framebuffer instance.
+
+        For the meaning of individual capability flags see
+        <link to="FramebufferCapabilities"/>.
+      </desc>
+    </attribute>
+
   </interface>
 
   <interface
@@ -15478,10 +16349,32 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
   </interface>
 
+  <enum
+    name="GuestMonitorStatus"
+    uuid="a0001cb1-97c9-496d-82bc-616c19a9e212"
+    >
+    <desc>
+      The current status of the guest display.
+    </desc>
+
+    <const name="Disabled" value="0">
+      <desc>
+        The guest monitor is disabled in the guest.
+      </desc>
+    </const>
+
+    <const name="Enabled" value="1">
+      <desc>
+        The guest monitor is enabled in the guest.
+      </desc>
+    </const>
+  </enum>
+
   <interface
     name="IDisplay" extends="$unknown"
-    uuid="480b372c-c0b5-4c23-9bd7-dcbb85b1594c"
+    uuid="94a7faa2-7792-42a3-8535-00770eca1f53"
     wsmap="managed"
+    wrap-hint-server-addinterfaces="IEventListener"
     >
     <desc>
       The IDisplay interface represents the virtual machine's display.
@@ -15494,32 +16387,48 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       IFramebuffer interface. Examples of the output target are a window on
       the host computer or an RDP session's display on a remote computer.
     </desc>
+
     <method name="getScreenResolution">
-      <desc>Queries display width, height and color depth for given screen.</desc>
+      <desc>
+        Queries certain attributes such as display width, height, color depth
+        and the X and Y origin for a given guest screen.
+
+        The parameters @a xOrigin and @a yOrigin return the X and Y
+        coordinates of the framebuffer's origin.
+
+        All return parameters are optional.</desc>
       <param name="screenId" type="unsigned long" dir="in"/>
       <param name="width" type="unsigned long" dir="out"/>
       <param name="height" type="unsigned long" dir="out"/>
       <param name="bitsPerPixel" type="unsigned long" dir="out"/>
       <param name="xOrigin" type="long" dir="out"/>
       <param name="yOrigin" type="long" dir="out"/>
+      <param name="guestMonitorStatus" type="GuestMonitorStatus" dir="out"/>
     </method>
 
-    <method name="setFramebuffer">
+    <method name="attachFramebuffer">
       <desc>
-        Sets the framebuffer for given screen.
+        Sets the graphics update target for a screen.
       </desc>
       <param name="screenId" type="unsigned long" dir="in"/>
       <param name="framebuffer" type="IFramebuffer" dir="in"/>
+      <param name="id" type="uuid" mod="string" dir="return"/>
     </method>
 
-    <method name="getFramebuffer">
+    <method name="detachFramebuffer">
       <desc>
-        Queries the framebuffer for given screen.
+        Removes the graphics updates target for a screen.
       </desc>
       <param name="screenId" type="unsigned long" dir="in"/>
-      <param name="framebuffer" type="IFramebuffer" dir="out"/>
-      <param name="xOrigin" type="long" dir="out"/>
-      <param name="yOrigin" type="long" dir="out"/>
+      <param name="id" type="uuid" mod="string" dir="in"/>
+    </method>
+
+    <method name="queryFramebuffer">
+      <desc>
+        Queries the graphics updates targets for a screen.
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in"/>
+      <param name="framebuffer" type="IFramebuffer" dir="return"/>
     </method>
 
     <method name="setVideoModeHint">
@@ -15593,9 +16502,10 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
     <method name="takeScreenShot">
       <desc>
-        Takes a screen shot of the requested size and copies it to the
-        32-bpp buffer allocated by the caller and pointed to by @a address.
-        A pixel consists of 4 bytes in order: B, G, R, 0.
+        Takes a screen shot of the requested size and format and copies it to the
+        buffer allocated by the caller and pointed to by @a address.
+        The buffer size must be enough for a 32 bits per pixel bitmap,
+        i.e. width * height * 4 bytes.
 
         <note>This API can be used only locally by a VM process through the
             COM/XPCOM C++ API as it requires pointer support. It is not
@@ -15603,41 +16513,22 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
             Unless you are writing a new VM frontend use
             <link to="#takeScreenShotToArray" />.
         </note>
-
-        <result name="E_NOTIMPL">
-          Feature not implemented.
-        </result>
-        <result name="VBOX_E_IPRT_ERROR">
-          Could not take a screenshot.
-        </result>
-
       </desc>
       <param name="screenId" type="unsigned long" dir="in"/>
       <param name="address" type="octet" mod="ptr" dir="in"/>
       <param name="width" type="unsigned long" dir="in"/>
       <param name="height" type="unsigned long" dir="in"/>
+      <param name="bitmapFormat" type="BitmapFormat" dir="in"/>
     </method>
 
     <method name="takeScreenShotToArray">
       <desc>
-        Takes a guest screen shot of the requested size and returns it as
-        an array of bytes in uncompressed 32-bpp RGBA format.
-        A pixel consists of 4 bytes in order: R, G, B, 0xFF.
-
-        This API is slow, but could be the only option to get guest screenshot
-        for scriptable languages not allowed to manipulate with addresses
-        directly.
-
-        <result name="E_NOTIMPL">
-          Feature not implemented.
-        </result>
-        <result name="VBOX_E_IPRT_ERROR">
-          Could not take a screenshot.
-        </result>
+        Takes a guest screen shot of the requested size and format
+        and returns it as an array of bytes.
       </desc>
       <param name="screenId" type="unsigned long" dir="in">
         <desc>
-          Monitor to take screenshot from.
+          The guest monitor to take screenshot from.
         </desc>
       </param>
       <param name="width" type="unsigned long" dir="in">
@@ -15650,38 +16541,9 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
           Desired image height.
         </desc>
       </param>
-      <param name="screenData" type="octet" dir="return" safearray="yes">
-        <desc>
-          Array with resulting screen data.
-        </desc>
-      </param>
-    </method>
-
-    <method name="takeScreenShotPNGToArray">
-      <desc>
-        Takes a guest screen shot of the requested size and returns it as
-        PNG image in array.
-
-        <result name="E_NOTIMPL">
-          Feature not implemented.
-        </result>
-        <result name="VBOX_E_IPRT_ERROR">
-          Could not take a screenshot.
-        </result>
-      </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>
-          Monitor to take the screenshot from.
-        </desc>
-      </param>
-      <param name="width" type="unsigned long" dir="in">
-        <desc>
-          Desired image width.
-        </desc>
-      </param>
-      <param name="height" type="unsigned long" dir="in">
+      <param name="bitmapFormat" type="BitmapFormat" dir="in">
         <desc>
-          Desired image height.
+          The requested format.
         </desc>
       </param>
       <param name="screenData" type="octet" dir="return" safearray="yes">
@@ -15748,16 +16610,15 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </desc>
     </method>
 
-    <method name="resizeCompleted">
+    <method name="invalidateAndUpdateScreen">
       <desc>
-        Signals that a framebuffer has completed the resize operation.
-
-        <result name="VBOX_E_NOT_SUPPORTED">
-          Operation only valid for external frame buffers.
-        </result>
-
+        Redraw the specified VM screen.
       </desc>
-      <param name="screenId" type="unsigned long" dir="in"/>
+      <param name="screenId" type="unsigned long" dir="in">
+        <desc>
+          The guest screen to redraw.
+        </desc>
+      </param>
     </method>
 
     <method name="completeVHWACommand">
@@ -15806,6 +16667,31 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
         </desc>
       </param>
     </method>
+
+    <method name="querySourceBitmap" wsmap="suppress">
+      <desc>
+         Obtains the guest screen bitmap parameters.
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in"/>
+      <param name="displaySourceBitmap" type="IDisplaySourceBitmap" dir="out"/>
+    </method>
+
+    <method name="notifyScaleFactorChange">
+      <desc>
+         Notify OpenGL HGCM host service about graphics content scaling factor change.
+      </desc>
+      <param name="screenId" type="unsigned long" dir="in"/>
+      <param name="u32ScaleFactorWMultiplied" type="unsigned long" dir="in"/>
+      <param name="u32ScaleFactorHMultiplied" type="unsigned long" dir="in"/>
+    </method>
+
+    <method name="notifyHiDPIOutputPolicyChange">
+      <desc>
+         Notify OpenGL HGCM host service about HiDPI monitor scaling policy change.
+      </desc>
+      <param name="fUnscaledHiDPI" type="boolean" dir="in"/>
+    </method>
+
   </interface>
 
   <!--
@@ -16101,7 +16987,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
   <enum
     name="PortMode"
-    uuid="533b5fe3-0185-4197-86a7-17e37dd39d76"
+    uuid="7485fcfd-d603-470a-87af-26d33beb7de9"
     >
     <desc>
       The PortMode enumeration represents possible communication modes for
@@ -16120,6 +17006,9 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <const name="RawFile"           value="3">
       <desc>Virtual device is attached to a raw file.</desc>
     </const>
+    <const name="TCP"               value="4">
+      <desc>Virtual device is attached to a TCP socket.</desc>
+    </const>
   </enum>
 
   <interface
@@ -16189,17 +17078,19 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       <desc>
         Flag whether this serial port acts as a server (creates a new pipe on
         the host) or as a client (uses the existing pipe). This attribute is
-        used only when <link to="#hostMode"/> is PortMode_HostPipe.
+        used only when <link to="#hostMode"/> is PortMode_HostPipe or PortMode_TCP.
       </desc>
     </attribute>
 
     <attribute name="path" type="wstring">
       <desc>
         Path to the serial port's pipe on the host when <link to="ISerialPort::hostMode"/> is
-        PortMode_HostPipe, or the host serial device name when
-        <link to="ISerialPort::hostMode"/> is PortMode_HostDevice. For both
-        cases, setting a @c null or empty string as the attribute's value
-        is an error. Otherwise, the value of this property is ignored.
+        PortMode_HostPipe, the host serial device name when
+        <link to="ISerialPort::hostMode"/> is PortMode_HostDevice or the TCP
+       <b>port</b> (server) or <b>hostname:port</b> (client) when
+        <link to="ISerialPort::hostMode"/> is PortMode_TCP.
+        For those cases, setting a @c null or empty string as the attribute's
+        value is an error. Otherwise, the value of this property is ignored.
       </desc>
     </attribute>
 
@@ -16272,7 +17163,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
   <interface
     name="IMachineDebugger" extends="$unknown"
-    uuid="5e4534dc-21b8-4f6b-8a08-eef50e1a0aa1"
+    uuid="ae7afb78-4265-8c03-ccb9-33a7970057e3"
     wsmap="managed"
     >
     <method name="dumpGuestCore">
@@ -16456,6 +17347,23 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </param>
     </method>
 
+    <method name="loadPlugIn">
+      <desc> Loads a DBGF plug-in. </desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>The plug-in name or DLL. Special name 'all' loads all installed plug-ins.</desc>
+      </param>
+      <param name="plugInName" type="wstring" dir="return">
+        <desc>The name of the loaded plug-in.</desc>
+      </param>
+    </method>
+
+    <method name="unloadPlugIn">
+      <desc>Unloads a DBGF plug-in.</desc>
+      <param name="name" type="wstring" dir="in">
+        <desc>The plug-in name or DLL. Special name 'all' unloads all plug-ins.</desc>
+      </param>
+    </method>
+
     <method name="detectOS">
       <desc>
         Tries to (re-)detect the guest OS kernel.
@@ -16470,12 +17378,25 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </param>
     </method>
 
+    <method name="queryOSKernelLog">
+      <desc>
+        Tries to get the kernel log (dmesg) of the guest OS.
+
+      </desc>
+      <param name="maxMessages" type="unsigned long" dir="in">
+        <desc>Max number of messages to return, counting from the end of the
+          log.  If 0, there is no limit.</desc>
+      </param>
+      <param name="dmesg" type="wstring" dir="return">
+        <desc>
+          The kernel log.
+        </desc>
+      </param>
+    </method>
+
     <method name="getRegister">
       <desc>
         Gets one register.
-
-        This feature is not implemented in the 4.0.0 release but may show up
-        in a dot release.
       </desc>
       <param name="cpuId" type="unsigned long" dir="in">
         <desc>The identifier of the Virtual CPU.</desc>
@@ -16494,9 +17415,6 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <method name="getRegisters">
       <desc>
         Gets all the registers for the given CPU.
-
-        This feature is not implemented in the 4.0.0 release but may show up
-        in a dot release.
       </desc>
       <param name="cpuId" type="unsigned long" dir="in">
         <desc>The identifier of the Virtual CPU.</desc>
@@ -16873,7 +17791,8 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     </const>
     <const name="OHCI"      value="1"/>
     <const name="EHCI"      value="2"/>
-    <const name="Last"      value="3">
+    <const name="XHCI"      value="3"/>
+    <const name="Last"      value="4">
       <desc>Last element (invalid). Used for parameter checks.</desc>
     </const>
   </enum>
@@ -16912,9 +17831,60 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
   /////////////////////////////////////////////////////////////////////////
   -->
 
+  <enum
+    name="USBConnectionSpeed"
+    uuid="d2915840-ea26-4fb4-b72a-21eaf6b888ff"
+    >
+    <desc>
+      USB device/port speed state. This enumeration represents speeds at
+      which a USB device can communicate with the host.
+
+      The speed is a function of both the device itself and the port which
+      it is attached to, including hubs and cables in the path.
+
+      <note>
+        Due to differences in USB stack implementations on various hosts,
+        the reported speed may not exactly match the actual speed.
+      </note>
+
+      <see><link to="IHostUSBDevice"/></see>
+    </desc>
+
+    <const name="Null"                  value="0">
+      <desc>
+        @c null value. Never returned by the API.
+      </desc>
+    </const>
+    <const name="Low"                   value="1">
+      <desc>
+        Low speed, 1.5 Mbps.
+      </desc>
+    </const>
+    <const name="Full"                  value="2">
+      <desc>
+        Full speed, 12 Mbps.
+      </desc>
+    </const>
+    <const name="High"                  value="3">
+      <desc>
+        High speed, 480 Mbps.
+      </desc>
+    </const>
+    <const name="Super"                 value="4">
+      <desc>
+        SuperSpeed, 5 Gbps.
+      </desc>
+    </const>
+    <const name="SuperPlus"             value="5">
+      <desc>
+        SuperSpeedPlus, 10 Gbps.
+      </desc>
+    </const>
+  </enum>
+
   <interface
     name="IUSBDevice" extends="$unknown"
-    uuid="f8967b0b-4483-400f-92b5-8b675d98a85b"
+    uuid="8d826296-e04f-4e86-9310-cb85b19becde"
     wsmap="managed"
     >
     <desc>
@@ -16974,18 +17944,24 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
     <attribute name="version" type="unsigned short" readonly="yes">
       <desc>
-        The major USB version of the device - 1 or 2.
+        The major USB version of the device - 1, 2 or 3.
       </desc>
     </attribute>
 
     <attribute name="portVersion" type="unsigned short" readonly="yes">
       <desc>
         The major USB version of the host USB port the device is
-        physically connected to - 1 or 2. For devices not connected to
+        physically connected to - 1, 2 or 3. For devices not connected to
         anything this will have the same value as the version attribute.
       </desc>
     </attribute>
 
+    <attribute name="speed" type="USBConnectionSpeed" readonly="yes">
+      <desc>
+        The speed at which the device is currently communicating.
+      </desc>
+    </attribute>
+
     <attribute name="remote" type="boolean" readonly="yes">
       <desc>
         Whether the device is physically connected to a remote VRDE
@@ -17389,7 +18365,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
   <interface
     name="IAudioAdapter" extends="$unknown"
-    uuid="921873db-5f3f-4b69-91f9-7be9e535a2cb"
+    uuid="280cc7f7-eddc-48b6-9bbb-5b1e8d761c0e"
     wsmap="managed"
     >
     <desc>
@@ -17404,6 +18380,18 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
         the VM is not running.
       </desc>
     </attribute>
+    <attribute name="enabledIn" type="boolean">
+      <desc>
+        Flag whether the audio adapter is enabled for audio
+        input. Only relevant if the adapter is enabled.
+      </desc>
+    </attribute>
+    <attribute name="enabledOut" type="boolean">
+      <desc>
+        Flag whether the audio adapter is enabled for audio
+        output. Only relevant if the adapter is enabled.
+      </desc>
+    </attribute>
     <attribute name="audioController" type="AudioControllerType">
       <desc>
         The audio hardware we emulate.
@@ -17656,21 +18644,23 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <const name="HostBatteryLow"    value="3">
       <desc>Host is running low on battery (power management event).</desc>
     </const>
+    <const name="Snapshot"          value="4">
+      <desc>A snapshot of the VM is being taken.</desc>
+    </const>
   </enum>
 
   <interface
     name="IInternalSessionControl" extends="$unknown"
-    uuid="2d2124a7-0f62-4907-ae21-eee5a559bdde"
+    uuid="747e397e-69c8-45a0-88d9-f7f070960718"
     internal="yes"
     wsmap="suppress"
     >
-    <method name="getPID">
+    <attribute name="PID" type="unsigned long" readonly="yes">
       <desc>PID of the process that has created this Session object.
       </desc>
-      <param name="pid" type="unsigned long" dir="return"/>
-    </method>
+    </attribute>
 
-    <method name="getRemoteConsole">
+    <attribute name="remoteConsole" type="IConsole" readonly="yes">
       <desc>
         Returns the console object suitable for remote control.
 
@@ -17682,8 +18672,14 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
         </result>
 
       </desc>
-      <param name="console" type="IConsole" dir="return"/>
-    </method>
+    </attribute>
+
+    <attribute name="nominalState" type="MachineState" readonly="yes">
+      <desc>Returns suitable machine state for the VM execution state. Useful
+        for choosing a sensible machine state after a complex operation which
+        failed or otherwise resulted in an unclear situation.
+      </desc>
+    </attribute>
 
 <if target="midl">
     <method name="assignMachine">
@@ -17891,12 +18887,12 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </param>
     </method>
 
-    <method name="onDragAndDropModeChange">
+    <method name="onDnDModeChange">
       <desc>
-        Notification when the drag'n'drop mode changes.
+        Notification when the drag'n drop mode changes.
       </desc>
-      <param name="dragAndDropMode" type="DragAndDropMode" dir="in">
-        <desc>The new mode for drag'n'drop.</desc>
+      <param name="dndMode" type="DnDMode" dir="in">
+        <desc>The new mode for drag'n drop.</desc>
       </param>
     </method>
 
@@ -18001,6 +18997,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       <param name="device" type="IUSBDevice" dir="in"/>
       <param name="error" type="IVirtualBoxErrorInfo" dir="in"/>
       <param name="maskedInterfaces" type="unsigned long" dir="in"/>
+      <param name="captureFilename" type="wstring" dir="in"/>
     </method>
 
     <method name="onUSBDeviceDetach">
@@ -18067,7 +19064,9 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       <param name="name" type="wstring" dir="in"/>
       <param name="value" type="wstring" dir="in"/>
       <param name="flags" type="wstring" dir="in"/>
-      <param name="isSetter" type="boolean" dir="in"/>
+      <param name="accessMode" type="unsigned long" dir="in">
+        <desc>0 = get, 1 = set, 2 = delete.</desc>
+      </param>
       <param name="retValue" type="wstring" dir="out"/>
       <param name="retTimestamp" type="long long" dir="out"/>
       <param name="retFlags" type="wstring" dir="out"/>
@@ -18149,6 +19148,24 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </param>
     </method>
 
+    <method name="reconfigureMediumAttachments">
+      <desc>
+        Reconfigure all specified medium attachments in one go, making sure
+        the current state corresponds to the specified medium.
+
+        <result name="VBOX_E_INVALID_VM_STATE">
+          Machine session is not open.
+        </result>
+        <result name="VBOX_E_INVALID_OBJECT_STATE">
+          Session type is not direct.
+        </result>
+      </desc>
+      <param name="attachments" type="IMediumAttachment" dir="in" safearray="yes">
+        <desc>Array containing the medium attachments which need to be
+          reconfigured.</desc>
+      </param>
+    </method>
+
     <method name="enableVMMStatistics">
       <desc>
         Enables or disables collection of VMM RAM statistics.
@@ -18212,29 +19229,52 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
         code. The reason code can be interpreted by device/drivers and thus it
         might behave slightly differently than a normal VM save state.
 
+        This call is fully synchronous, and the caller is expected to have set
+        the machine state appropriately (and has to set the follow-up machine
+        state if this call failed).
+
         <result name="VBOX_E_INVALID_VM_STATE">
-          Virtual machine state neither Running nor Paused.
+          Virtual machine state is not one of the expected values.
         </result>
         <result name="VBOX_E_FILE_ERROR">
           Failed to create directory for saved state file.
         </result>
-        <see><link to="IConsole::saveState"/></see>
+        <see><link to="IMachine::saveState"/></see>
       </desc>
 
       <param name="reason" type="Reason" dir="in">
         <desc>Specify the best matching reason code please.</desc>
       </param>
-      <param name="progress" type="IProgress" dir="return">
+      <param name="progress" type="IProgress" dir="in">
         <desc>Progress object to track the operation completion.</desc>
       </param>
+      <param name="stateFilePath" type="wstring" dir="in">
+        <desc>File path the VM process must save the execution state to.</desc>
+      </param>
+      <param name="pauseVM" type="boolean" dir="in">
+        <desc>The VM should be paused before saving state. It is automatically
+        unpaused on error in the "vanilla save state" case.</desc>
+      </param>
+      <param name="leftPaused" type="boolean" dir="return">
+        <desc>Returns if the VM was left in paused state, which is necessary
+        in many situations (snapshots, teleportation).</desc>
+      </param>
+    </method>
+
+    <method name="cancelSaveStateWithReason">
+      <desc>
+        Internal method for cancelling a VM save state.
+        <see><link to="IInternalSessionControl::saveStateWithReason"/></see>
+      </desc>
     </method>
 
   </interface>
 
   <interface
     name="ISession" extends="$unknown"
-    uuid="12F4DCDB-12B2-4EC1-B7CD-DDD9F6C5BF4D"
+    uuid="3d4f472c-aac8-4387-94be-54042bcd8901"
     wsmap="managed"
+    wrap-hint-server-addinterfaces="IInternalSessionControl"
     >
     <desc>
       The ISession interface represents a client process and allows for locking
@@ -18305,12 +19345,24 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </desc>
     </attribute>
 
+    <attribute name="name" type="wstring">
+      <desc>
+        Name of this session. Important only for VM sessions, otherwise it
+        it will be remembered, but not used for anything significant (and can
+        be left at the empty string which is the default). The value can only
+        be changed when the session state is SessionState_Unlocked. Make sure
+        that you use a descriptive name which does not conflict with the VM
+        process session names: "GUI/Qt", "GUI/SDL" and "headless".
+      </desc>
+    </attribute>
+
     <attribute name="machine" type="IMachine" readonly="yes">
       <desc>Machine object associated with this session.</desc>
     </attribute>
 
     <attribute name="console" type="IConsole" readonly="yes">
-      <desc>Console object associated with this session.</desc>
+      <desc>Console object associated with this session. Only sessions
+      which locked the machine for a VM process have a non-null console.</desc>
     </attribute>
 
     <method name="unlockMachine">
@@ -18351,7 +19403,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
   <enum
     name="StorageBus"
-    uuid="eee67ab3-668d-4ef5-91e0-7025fe4a0d7a"
+    uuid="2dab9df1-9683-48fd-8c11-caada236fcb0"
     >
     <desc>
       The bus type of the storage controller (IDE, SATA, SCSI, SAS or Floppy);
@@ -18365,11 +19417,12 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <const name="SCSI"      value="3"/>
     <const name="Floppy"    value="4"/>
     <const name="SAS"       value="5"/>
+    <const name="USB"       value="6"/>
   </enum>
 
   <enum
     name="StorageControllerType"
-    uuid="8a412b8a-f43e-4456-bd37-b474f0879a58"
+    uuid="02e190af-b546-4109-b036-6deaa4ef6e69"
     >
     <desc>
       The exact variant of storage controller hardware presented
@@ -18403,6 +19456,9 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <const name="LsiLogicSas"   value="8">
       <desc>A variant of the LsiLogic controller using SAS.</desc>
     </const>
+    <const name="USB"           value="9">
+      <desc>Special USB based storage controller.</desc>
+    </const>
   </enum>
 
   <enum
@@ -18590,7 +19646,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
   <interface
     name="IWebsessionManager" extends="$unknown"
-    uuid="dea1b4c7-2de3-418a-850d-7868617f7733"
+    uuid="930c8fea-453a-4a65-aca9-19ed9a872f88"
     internal="yes"
     wsmap="global"
     wscpp="hardcoded"
@@ -18613,8 +19669,8 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
     <method name="getSessionObject">
       <desc>
-        Returns a managed object reference to the internal ISession object that was created
-        for this web service session when the client logged on.
+        Returns a managed object reference to a new ISession object for every
+        call to this method.
 
         <see><link to="ISession"/></see>
       </desc>
@@ -18625,8 +19681,9 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <method name="logoff">
       <desc>
         Logs off the client who has previously logged on with <link to="IWebsessionManager::logon" />
-        and destroys all resources associated with the session (most importantly, all
-        managed objects created in the server while the session was active).
+        and destroys all resources associated with the websession (most
+        importantly, all managed objects created in the server while the
+        websession was active).
       </desc>
       <param name="refIVirtualBox" type="IVirtualBox" dir="in"/>
     </method>
@@ -19395,8 +20452,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <desc>
       Interface for managing VirtualBox Extension Packs.
 
-      TODO: Describe extension packs, how they are managed and how to create
-            one.
+      @todo Describe extension packs, how they are managed and how to create one.
     </desc>
 
     <attribute name="installedExtPacks" type="IExtPack" safearray="yes" readonly="yes">
@@ -19679,7 +20735,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
   -->
   <enum
     name="VBoxEventType"
-    uuid="5248e377-e578-47d7-b07b-84b1db6db8a8"
+    uuid="b2ddb312-2f9e-4e69-98df-7235e43b2149"
     >
 
     <desc>
@@ -19942,9 +20998,9 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
         See <link to="IClipboardModeChangedEvent">IClipboardModeChangedEvent</link>.
       </desc>
     </const>
-    <const name="OnDragAndDropModeChanged" value="73">
+    <const name="OnDnDModeChanged" value="73">
       <desc>
-        See <link to="IDragAndDropModeChangedEvent">IDragAndDropModeChangedEvent</link>.
+        See <link to="IDnDModeChangedEvent">IDnDModeChangedEvent</link>.
       </desc>
     </const>
     <const name="OnNATNetworkChanged" value="74">
@@ -20058,9 +21114,13 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
         See <link to="IHostNameResolutionConfigurationChangeEvent">IHostNameResolutionConfigurationChangeEvent</link>.
       </desc>
     </const>
-    <!-- OnHostNameResolutionConfigurationChange -->
+    <const name="OnSnapshotRestored" value="95">
+      <desc>
+        See <link to="ISnapshotRestoredEvent">ISnapshotRestoredEvent</link>.
+      </desc>
+    </const>
     <!-- Last event marker -->
-    <const name="Last" value="95">
+    <const name="Last" value="96">
       <desc>
         Must be last event, used for iterations and structures relying on numerical event values.
       </desc>
@@ -20538,6 +21598,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       A new snapshot of the machine has been taken.
       <see><link to="ISnapshot"/></see>
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -20556,6 +21617,19 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
       <see><link to="ISnapshot"/></see>
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
+  </interface>
+
+  <interface
+    name="ISnapshotRestoredEvent" extends="ISnapshotEvent"
+    uuid="f4d803b4-9b2d-4377-bfe6-9702e881516b"
+    wsmap="managed" autogen="VBoxEvent" id="OnSnapshotRestored"
+    >
+    <desc>
+      Snapshot of the given machine has been restored.
+      <see><link to="ISnapshot"/></see>
+    </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -20567,6 +21641,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       Snapshot properties (name and/or description) have been changed.
       <see><link to="ISnapshot"/></see>
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -20725,6 +21800,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       Interested callees should query IGuest attributes to
       find out what has changed.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -20791,6 +21867,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       <link to="IMachine::mediumAttachments">medium attachment</link>
       changes.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -20826,16 +21903,16 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
   </interface>
 
   <interface
-    name="IDragAndDropModeChangedEvent" extends="IEvent"
-    uuid="e90b8850-ac8e-4dff-8059-4100ae2c3c3d"
-    wsmap="managed" autogen="VBoxEvent" id="OnDragAndDropModeChanged"
+    name="IDnDModeChangedEvent" extends="IEvent"
+    uuid="b55cf856-1f8b-4692-abb4-462429fae5e9"
+    wsmap="managed" autogen="VBoxEvent" id="OnDnDModeChanged"
     >
     <desc>
-      Notification when the drag'n'drop mode changes.
+      Notification when the drag'n drop mode changes.
     </desc>
-    <attribute name="dragAndDropMode" type="DragAndDropMode" readonly="yes">
+    <attribute name="dndMode" type="DnDMode" readonly="yes">
       <desc>
-        The new drag'n'drop mode.
+        The new drag'n drop mode.
       </desc>
     </attribute>
   </interface>
@@ -20897,7 +21974,8 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
     <desc>
       The mode (relative, absolute, multi-touch) of a pointer event.
-      TODO: a clear pattern seems to be emerging that we should usually have
+
+      @todo A clear pattern seems to be emerging that we should usually have
       multiple input devices active for different types of reporting, so we
       should really have different event types for relative (including wheel),
       absolute (not including wheel) and multi-touch events.
@@ -21283,6 +22361,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       Notification when a guest file changed its current offset.
     </desc>
 
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -21311,6 +22390,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       Notification when data has been written to a guest file.
     </desc>
 
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -21324,6 +22404,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       Interested callees should use IVRDEServer methods and attributes to
       find out what has changed.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -21336,6 +22417,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       should use <link to="IConsole::VRDEServerInfo">IVRDEServerInfo</link>
       attributes to find out what is the current status.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -21346,6 +22428,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <desc>
       Notification when video capture settings have changed.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -21359,6 +22442,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       Interested callees should use IUSBController methods and attributes to
       find out what has changed.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -21446,7 +22530,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       to @c true. In case of fatal errors, the virtual machine
       execution is always paused before calling this notification, and
       the notification handler is supposed either to immediately save
-      the virtual machine state using <link to="IConsole::saveState"/>
+      the virtual machine state using <link to="IMachine::saveState"/>
       or power it off using <link to="IConsole::powerDown"/>.
       Resuming the execution can lead to unpredictable results.
 
@@ -21551,7 +22635,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
 
   <interface
     name="IVetoEvent" extends="IEvent"
-    uuid="9a1a4130-69fe-472f-ac10-c6fa25d75007"
+    uuid="7c5e945f-2354-4267-883f-2f417d216519"
     wsmap="managed"
     >
     <desc>Base abstract interface for veto events.</desc>
@@ -21589,6 +22673,35 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       </param>
     </method>
 
+    <method name="addApproval">
+      <desc>
+        Adds an approval on this event.
+      </desc>
+      <param name="reason" type="wstring" dir="in">
+        <desc>
+          Reason for approval, could be null or empty string.
+        </desc>
+      </param>
+    </method>
+
+    <method name="isApproved">
+      <desc>
+        If this event was approved.
+      </desc>
+      <param name="result" type="boolean" dir="return" />
+    </method>
+
+    <method name="getApprovals">
+      <desc>
+        Current approval reason list, if size is 0 - no approvals.
+      </desc>
+      <param name="result" type="wstring" dir="return" safearray="yes">
+        <desc>
+          Array of reasons for approval provided by different event handlers.
+        </desc>
+      </param>
+    </method>
+
   </interface>
 
   <interface
@@ -21637,6 +22750,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
       remain valid at least until the next
       <link to="IConsole::state">machine state</link> change.
     </desc>
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <interface
@@ -21966,9 +23080,13 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
   </interface>
 
   <!-- base class for modification events -->
-  <interface name="INATNetworkAlterEvent" extends="INATNetworkChangedEvent"
-             uuid="3f5a0822-163a-43b1-ad16-8d58b0ef6e75"
-             wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkAlter"/>
+  <interface
+    name="INATNetworkAlterEvent" extends="INATNetworkChangedEvent"
+    uuid="d947adf5-4022-dc80-5535-6fb116815604"
+    wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkAlter"
+    >
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
+  </interface>
 
   <interface name="INATNetworkCreationDeletionEvent" extends="INATNetworkAlterEvent"
              uuid="8d984a7e-b855-40b8-ab0c-44d3515b4528"
@@ -21981,7 +23099,7 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     <attribute name="enabled" type="boolean" readonly="yes"/>
     <attribute name="network" type="wstring" readonly="yes"/>
     <attribute name="gateway" type="wstring" readonly="yes"/>
-    <attribute name="advertiseDefaultIPv6RouteEnabled" type="boolean" readonly="yes"/>
+    <attribute name="advertiseDefaultIPv6RouteEnabled" type="boolean" readonly="yes" dtracename="advertiseDefIPv6Route"/>
     <attribute name="needDhcpServer" type="boolean" readonly="yes"/>
   </interface>
   <interface name="INATNetworkPortForwardEvent" extends="INATNetworkAlterEvent"
@@ -22001,7 +23119,9 @@ Snapshot 1 (B.vdi)            Snapshot 1 (B.vdi)
     name="IHostNameResolutionConfigurationChangeEvent" extends="IEvent"
     uuid="f9b9e1cf-cb63-47a1-84fb-02c4894b89a9"
     wsmap="managed" autogen="VBoxEvent" id="OnHostNameResolutionConfigurationChange"
+    dtracename="HostNameResCfgChangeEvent"
     >
+    <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
   </interface>
 
   <module name="VBoxSVC" context="LocalServer">
diff --git a/src/VBox/Main/idl/apiwrap-server-filelist.xsl b/src/VBox/Main/idl/apiwrap-server-filelist.xsl
new file mode 100644
index 0000000..246c124
--- /dev/null
+++ b/src/VBox/Main/idl/apiwrap-server-filelist.xsl
@@ -0,0 +1,138 @@
+<?xml version="1.0"?>
+
+<!--
+    apiwrap-server-filelist.xsl:
+
+        XSLT stylesheet that generate a makefile include with
+        the lists of files that apiwrap-server.xsl produces
+        from VirtualBox.xidl.
+
+    Copyright (C) 2015 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+-->
+
+<xsl:stylesheet
+    version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:exsl="http://exslt.org/common"
+    extension-element-prefixes="exsl">
+
+<xsl:output method="text"/>
+
+<xsl:strip-space elements="*"/>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  global XSLT variables
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:variable name="G_sNewLine">
+    <xsl:choose>
+        <xsl:when test="$KBUILD_HOST = 'win'">
+            <xsl:value-of select="'
'"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="'
'"/>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:variable>
+
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  wildcard match, ignore everything which has no explicit match
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:template match="*" mode="filelist-even-sources"/>
+<xsl:template match="*" mode="filelist-odd-sources"/>
+<xsl:template match="*" mode="filelist-headers"/>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  interface match
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:template match="interface" mode="filelist-even-sources">
+    <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no') and (position() mod 2) = 0">
+        <xsl:value-of select="concat(' \', $G_sNewLine, '	$(VBOX_MAIN_APIWRAPPER_DIR)/', substring(@name, 2), 'Wrap.cpp')"/>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template match="interface" mode="filelist-odd-sources">
+    <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no') and (position() mod 2) = 1">
+        <xsl:value-of select="concat(' \', $G_sNewLine, '	$(VBOX_MAIN_APIWRAPPER_DIR)/', substring(@name, 2), 'Wrap.cpp')"/>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template match="interface" mode="filelist-headers">
+    <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no')">
+        <xsl:value-of select="concat(' \', $G_sNewLine, '	$(VBOX_MAIN_APIWRAPPER_DIR)/', substring(@name, 2), 'Wrap.h')"/>
+    </xsl:if>
+</xsl:template>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  ignore all if tags except those for XPIDL or MIDL target
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:template match="if" mode="filelist-even-sources">
+    <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
+        <xsl:apply-templates mode="filelist-even-sources"/>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template match="if" mode="filelist-odd-sources">
+    <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
+        <xsl:apply-templates mode="filelist-odd-sources"/>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template match="if" mode="filelist-headers">
+    <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
+        <xsl:apply-templates mode="filelist-headers"/>
+    </xsl:if>
+</xsl:template>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  library match
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:template match="library" mode="filelist-even-sources">
+    <xsl:apply-templates mode="filelist-even-sources"/>
+</xsl:template>
+
+<xsl:template match="library" mode="filelist-odd-sources">
+    <xsl:apply-templates mode="filelist-odd-sources"/>
+</xsl:template>
+
+<xsl:template match="library" mode="filelist-headers">
+    <xsl:apply-templates mode="filelist-headers"/>
+</xsl:template>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  root match
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:template match="/idl">
+    <xsl:text>VBOX_MAIN_APIWRAPPER_GEN_SRCS_EVEN := </xsl:text>
+    <xsl:apply-templates mode="filelist-even-sources"/>
+    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>
+
+    <xsl:text>VBOX_MAIN_APIWRAPPER_GEN_SRCS_ODD := </xsl:text>
+    <xsl:apply-templates mode="filelist-odd-sources"/>
+    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>
+
+    <xsl:text>VBOX_MAIN_APIWRAPPER_GEN_SRCS := $(VBOX_MAIN_APIWRAPPER_GEN_SRCS_EVEN) $(VBOX_MAIN_APIWRAPPER_GEN_SRCS_ODD)</xsl:text>
+    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>
+
+    <xsl:text>VBOX_MAIN_APIWRAPPER_GEN_HDRS := </xsl:text>
+    <xsl:apply-templates mode="filelist-headers"/>
+    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>
+</xsl:template>
+
+</xsl:stylesheet>
+<!-- vi: set tabstop=4 shiftwidth=4 expandtab: -->
+
diff --git a/src/VBox/Main/idl/apiwrap-server.xsl b/src/VBox/Main/idl/apiwrap-server.xsl
index 7f85886..fcf9ce2 100644
--- a/src/VBox/Main/idl/apiwrap-server.xsl
+++ b/src/VBox/Main/idl/apiwrap-server.xsl
@@ -5,7 +5,7 @@
         XSLT stylesheet that generates C++ API wrappers (server side) from
         VirtualBox.xidl.
 
-    Copyright (C) 2010-2014 Oracle Corporation
+    Copyright (C) 2010-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -32,28 +32,32 @@
 
 <xsl:variable name="G_xsltFilename" select="'apiwrap-server.xsl'"/>
 
+<xsl:variable name="G_root" select="/"/>
+
 <xsl:include href="typemap-shared.inc.xsl"/>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-templates for file separation
+  Keys for more efficiently looking up of types.
  - - - - - - - - - - - - - - - - - - - - - - -->
 
-<xsl:template match="interface" mode="listfile">
-    <xsl:param name="file"/>
+<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
 
-    <xsl:value-of select="concat('	', $file, ' \
')"/>
-</xsl:template>
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+templates for file separation
+ - - - - - - - - - - - - - - - - - - - - - - -->
 
 <xsl:template match="interface" mode="startfile">
     <xsl:param name="file"/>
 
-    <xsl:value-of select="concat('
// ##### BEGINFILE "', $file, '"
')"/>
+    <xsl:call-template name="xsltprocNewlineOutputHack"/>
+    <xsl:value-of select="concat($G_sNewLine, '// ##### BEGINFILE "', $file, '"', $G_sNewLine)"/>
 </xsl:template>
 
 <xsl:template match="interface" mode="endfile">
     <xsl:param name="file"/>
 
-    <xsl:value-of select="concat('
// ##### ENDFILE "', $file, '"
')"/>
+    <xsl:value-of select="concat($G_sNewLine, '// ##### ENDFILE "', $file, '"', $G_sNewLine)"/>
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
@@ -66,7 +70,6 @@ templates for file headers/footers
     <xsl:param name="type"/>
 
     <xsl:text>/** @file
- *
 </xsl:text>
     <xsl:value-of select="concat(' * VirtualBox API class wrapper ', $type, ' for I', $class, '.')"/>
     <xsl:text>
@@ -77,7 +80,7 @@ templates for file headers/footers
  */
 
 /**
- * Copyright (C) 2010-2014 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -91,21 +94,21 @@ templates for file headers/footers
 </xsl:text>
 </xsl:template>
 
+<!-- Emits COM_INTERFACE_ENTRY statements for the current interface node and whatever it inherits from. -->
 <xsl:template name="emitCOMInterfaces">
-    <xsl:param name="iface"/>
-
-    <xsl:value-of select="concat('        COM_INTERFACE_ENTRY(', $iface/@name, ')
')"/>
+    <xsl:value-of select="concat('        COM_INTERFACE_ENTRY(', @name, ')' , $G_sNewLine)"/>
     <!-- now recurse to emit all base interfaces -->
-    <xsl:variable name="extends" select="$iface/@extends"/>
+    <xsl:variable name="extends" select="@extends"/>
     <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
-        <xsl:call-template name="emitCOMInterfaces">
-            <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
-        </xsl:call-template>
+        <xsl:for-each select="key('G_keyInterfacesByName', $extends)">
+            <xsl:call-template name="emitCOMInterfaces"/>
+        </xsl:for-each>
     </xsl:if>
 </xsl:template>
 
 <xsl:template match="interface" mode="classheader">
-    <xsl:value-of select="concat('#ifndef ', substring(@name, 2), 'Wrap_H_
')"/>
+    <xsl:param name="addinterfaces"/>
+    <xsl:value-of select="concat('#ifndef ', substring(@name, 2), 'Wrap_H_', $G_sNewLine)"/>
     <xsl:value-of select="concat('#define ', substring(@name, 2), 'Wrap_H_')"/>
     <xsl:text>
 
@@ -117,41 +120,78 @@ templates for file headers/footers
     <xsl:text>
     public VirtualBoxBase,
 </xsl:text>
-    <xsl:value-of select="concat('    VBOX_SCRIPTABLE_IMPL(', @name, ')
')"/>
+    <xsl:value-of select="concat('    VBOX_SCRIPTABLE_IMPL(', @name, ')')"/>
+    <xsl:if test="count(exsl:node-set($addinterfaces)/token) > 0">
+        <xsl:text>,</xsl:text>
+    </xsl:if>
+    <xsl:value-of select="$G_sNewLine"/>
+    <xsl:for-each select="exsl:node-set($addinterfaces)/token">
+        <xsl:value-of select="concat('    VBOX_SCRIPTABLE_IMPL(', text(), ')')"/>
+        <xsl:if test="not(position()=last())">
+            <xsl:text>,</xsl:text>
+        </xsl:if>
+        <xsl:value-of select="$G_sNewLine"/>
+    </xsl:for-each>
     <xsl:text>{
     Q_OBJECT
 
 public:
 </xsl:text>
-    <xsl:value-of select="concat('    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', substring(@name, 2), 'Wrap, ', @name, ')
')"/>
-    <xsl:value-of select="concat('    DECLARE_NOT_AGGREGATABLE(', substring(@name, 2), 'Wrap)
')"/>
+    <xsl:value-of select="concat('    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(', substring(@name, 2), 'Wrap, ', @name, ')', $G_sNewLine)"/>
+    <xsl:value-of select="concat('    DECLARE_NOT_AGGREGATABLE(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
     <xsl:text>    DECLARE_PROTECT_FINAL_CONSTRUCT()
 
 </xsl:text>
-    <xsl:value-of select="concat('    BEGIN_COM_MAP(', substring(@name, 2), 'Wrap)
')"/>
+    <xsl:value-of select="concat('    BEGIN_COM_MAP(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
     <xsl:text>        COM_INTERFACE_ENTRY(ISupportErrorInfo)
 </xsl:text>
-    <xsl:call-template name="emitCOMInterfaces">
-        <xsl:with-param name="iface" select="."/>
-    </xsl:call-template>
-    <xsl:value-of select="concat('        COM_INTERFACE_ENTRY2(IDispatch, ', @name, ')
')"/>
-    <xsl:text>    END_COM_MAP()
+    <xsl:call-template name="emitCOMInterfaces"/>
+    <xsl:value-of select="concat('        COM_INTERFACE_ENTRY2(IDispatch, ', @name, ')', $G_sNewLine)"/>
+    <xsl:variable name="manualAddInterfaces">
+        <xsl:call-template name="checkoption">
+            <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
+            <xsl:with-param name="option" select="'manualaddinterfaces'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:if test="not($manualAddInterfaces = 'true')">
+        <xsl:for-each select="exsl:node-set($addinterfaces)/token">
+            <!-- This is super tricky, as the for-each switches to the node set,
+                 which means the normal document isn't available any more.  We get
+                 the data we need, uses a for-each to switch document and then a
+                 key() to look up the interface by name. -->
+            <xsl:variable name="addifname">
+                <xsl:value-of select="string(.)"/>
+            </xsl:variable>
+            <xsl:for-each select="$G_root">
+                <xsl:for-each select="key('G_keyInterfacesByName', $addifname)">
+                    <xsl:call-template name="emitCOMInterfaces"/>
+                </xsl:for-each>
+            </xsl:for-each>
+        </xsl:for-each>
+    </xsl:if>
+    <xsl:text>        COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
+    END_COM_MAP()
 
 </xsl:text>
-    <xsl:value-of select="concat('    DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap)
')"/>
+    <xsl:value-of select="concat('    DECLARE_EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
 </xsl:template>
 
 <xsl:template match="interface" mode="classfooter">
+    <xsl:param name="addinterfaces"/>
     <xsl:text>};
 
 </xsl:text>
-    <xsl:value-of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_
')"/>
+    <xsl:value-of select="concat('#endif // !', substring(@name, 2), 'Wrap_H_', $G_sNewLine)"/>
 </xsl:template>
 
 <xsl:template match="interface" mode="codeheader">
-    <xsl:value-of select="concat('#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_', translate(substring(@name, 2), $G_lowerCase, $G_upperCase), '

')"/>
-    <xsl:value-of select="concat('#include "', substring(@name, 2), 'Wrap.h"
')"/>
+    <xsl:param name="addinterfaces"/>
+    <xsl:value-of select="concat('#define LOG_GROUP_MAIN_OVERRIDE LOG_GROUP_MAIN_', translate(substring(@name, 2), $G_lowerCase, $G_upperCase), $G_sNewLine, $G_sNewLine)"/>
+    <xsl:value-of select="concat('#include "', substring(@name, 2), 'Wrap.h"', $G_sNewLine)"/>
     <xsl:text>#include "Logging.h"
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+# include "dtrace/VBoxAPI.h"
+#endif
 
 </xsl:text>
 </xsl:template>
@@ -159,38 +199,80 @@ public:
 <xsl:template name="emitISupports">
     <xsl:param name="classname"/>
     <xsl:param name="extends"/>
+    <xsl:param name="addinterfaces"/>
     <xsl:param name="depth"/>
     <xsl:param name="interfacelist"/>
 
     <xsl:choose>
-        <xsl:when test="$extends and not($extends='$unknown') and not($extends='$dispatched') and not($extends='$errorinfo')">
-            <xsl:variable name="newextends" select="//interface[@name=$extends]/@extends"/>
+        <xsl:when test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
+            <xsl:variable name="newextends" select="key('G_keyInterfacesByName', $extends)/@extends"/>
             <xsl:variable name="newiflist" select="concat($interfacelist, ', ', $extends)"/>
             <xsl:call-template name="emitISupports">
                 <xsl:with-param name="classname" select="$classname"/>
                 <xsl:with-param name="extends" select="$newextends"/>
+                <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
                 <xsl:with-param name="depth" select="$depth + 1"/>
                 <xsl:with-param name="interfacelist" select="$newiflist"/>
             </xsl:call-template>
         </xsl:when>
         <xsl:otherwise>
-            <xsl:value-of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS', $depth, '_CI(', $classname, ', ', $interfacelist, ')
')"/>
+            <xsl:variable name="addinterfaces_ns" select="exsl:node-set($addinterfaces)"/>
+            <xsl:choose>
+                <xsl:when test="count($addinterfaces_ns/token) > 0">
+                    <xsl:variable name="addifname" select="$addinterfaces_ns/token[1]"/>
+                    <xsl:variable name="addif" select="key('G_keyInterfacesByName', $addifname)/@extends"/>
+                    <xsl:variable name="newextends" select="$addif/@extends"/>
+                    <xsl:variable name="newaddinterfaces" select="$addinterfaces_ns/token[position() > 1]"/>
+                    <xsl:variable name="newiflist" select="concat($interfacelist, ', ', $addifname)"/>
+                    <xsl:call-template name="emitISupports">
+                        <xsl:with-param name="classname" select="$classname"/>
+                        <xsl:with-param name="extends" select="$newextends"/>
+                        <xsl:with-param name="addinterfaces" select="$newaddinterfaces"/>
+                        <xsl:with-param name="depth" select="$depth + 1"/>
+                        <xsl:with-param name="interfacelist" select="$newiflist"/>
+                    </xsl:call-template>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS', $depth, '_CI(', $classname, ', ', $interfacelist, ')', $G_sNewLine)"/>
+                </xsl:otherwise>
+            </xsl:choose>
         </xsl:otherwise>
     </xsl:choose>
 </xsl:template>
 
 <xsl:template match="interface" mode="codefooter">
+    <xsl:param name="addinterfaces"/>
     <xsl:text>#ifdef VBOX_WITH_XPCOM
 </xsl:text>
-    <xsl:value-of select="concat('NS_DECL_CLASSINFO(', substring(@name, 2), 'Wrap)
')"/>
-
-    <xsl:call-template name="emitISupports">
-        <xsl:with-param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
-        <xsl:with-param name="extends" select="@extends"/>
-        <xsl:with-param name="depth" select="1"/>
-        <xsl:with-param name="interfacelist" select="@name"/>
-    </xsl:call-template>
+    <xsl:value-of select="concat('NS_DECL_CLASSINFO(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>
 
+    <xsl:variable name="manualAddInterfaces">
+        <xsl:call-template name="checkoption">
+            <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
+            <xsl:with-param name="option" select="'manualaddinterfaces'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:choose>
+        <xsl:when test="$manualAddInterfaces = 'true'">
+            <xsl:variable name="nulladdinterfaces"></xsl:variable>
+            <xsl:call-template name="emitISupports">
+                <xsl:with-param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
+                <xsl:with-param name="extends" select="@extends"/>
+                <xsl:with-param name="addinterfaces" select="$nulladdinterfaces"/>
+                <xsl:with-param name="depth" select="1"/>
+                <xsl:with-param name="interfacelist" select="@name"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:call-template name="emitISupports">
+                <xsl:with-param name="classname" select="concat(substring(@name, 2), 'Wrap')"/>
+                <xsl:with-param name="extends" select="@extends"/>
+                <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+                <xsl:with-param name="depth" select="1"/>
+                <xsl:with-param name="interfacelist" select="@name"/>
+            </xsl:call-template>
+        </xsl:otherwise>
+    </xsl:choose>
     <xsl:text>#endif // VBOX_WITH_XPCOM
 </xsl:text>
 </xsl:template>
@@ -211,52 +293,81 @@ public:
     <xsl:value-of select="string-length($option) > 0 and contains(concat(',', translate($optionlist, ' ', ''), ','), concat(',', $option, ','))"/>
 </xsl:template>
 
+<xsl:template name="getattrlist">
+    <xsl:param name="val"/>
+    <xsl:param name="separator" select="','"/>
+
+    <xsl:if test="$val and $val != ''">
+        <xsl:choose>
+            <xsl:when test="contains($val,$separator)">
+                <token>
+                    <xsl:value-of select="substring-before($val,$separator)"/>
+                </token>
+                <xsl:call-template name="getattrlist">
+                    <xsl:with-param name="val" select="substring-after($val,$separator)"/>
+                    <xsl:with-param name="separator" select="$separator"/>
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+                <token><xsl:value-of select="$val"/></token>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:if>
+</xsl:template>
+
 <xsl:template name="translatepublictype">
     <xsl:param name="type"/>
     <xsl:param name="dir"/>
+    <xsl:param name="mod"/>
 
-    <!-- get C++ glue type from IDL type from table in typemap-shared.inc.xsl -->
-    <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
     <xsl:choose>
         <xsl:when test="$type='wstring' or $type='uuid'">
-            <xsl:choose>
-                <xsl:when test="$dir='in'">
-                    <xsl:text>IN_BSTR</xsl:text>
-                </xsl:when>
-                <xsl:otherwise>
-                    <xsl:text>BSTR</xsl:text>
-                </xsl:otherwise>
-            </xsl:choose>
-        </xsl:when>
-        <xsl:when test="string-length($gluetypefield)">
-            <xsl:value-of select="$gluetypefield"/>
-        </xsl:when>
-        <xsl:when test="//enum[@name=$type]">
-            <xsl:value-of select="concat($type, '_T')"/>
+            <xsl:if test="$dir='in'">
+                <xsl:text>IN_</xsl:text>
+            </xsl:if>
+            <xsl:text>BSTR</xsl:text>
         </xsl:when>
+
         <xsl:when test="$type='$unknown'">
             <xsl:text>IUnknown *</xsl:text>
         </xsl:when>
-        <xsl:when test="//interface[@name=$type]">
-            <xsl:variable name="thatif" select="//interface[@name=$type]"/>
-            <xsl:variable name="thatifname" select="$thatif/@name"/>
-            <xsl:value-of select="concat($thatifname, ' *')"/>
+
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
+            <xsl:value-of select="concat($type, ' *')"/>
+        </xsl:when>
+
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
+            <xsl:value-of select="concat($type, '_T')"/>
         </xsl:when>
+
+        <!-- Micro optimizations: Put off wraptypefield calculation as long as possible; Check interfaces before enums. -->
         <xsl:otherwise>
-            <xsl:call-template name="fatalError">
-                <xsl:with-param name="msg" select="concat('translatepublictype: Type "', $type, '" is not supported.')"/>
-            </xsl:call-template>
+            <!-- get C++ glue type from IDL type from table in typemap-shared.inc.xsl -->
+            <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
+            <xsl:choose>
+                <xsl:when test="string-length($gluetypefield)">
+                    <xsl:value-of select="$gluetypefield"/>
+                </xsl:when>
+
+                <xsl:otherwise>
+                    <xsl:call-template name="fatalError">
+                        <xsl:with-param name="msg" select="concat('translatepublictype: Type "', $type, '" is not supported.')"/>
+                    </xsl:call-template>
+                </xsl:otherwise>
+            </xsl:choose>
         </xsl:otherwise>
     </xsl:choose>
+    <xsl:if test="$mod='ptr'">
+        <xsl:text> *</xsl:text>
+    </xsl:if>
 </xsl:template>
 
 <xsl:template name="translatewrappedtype">
     <xsl:param name="type"/>
     <xsl:param name="dir"/>
+    <xsl:param name="mod"/>
     <xsl:param name="safearray"/>
 
-    <!-- get C++ wrap type from IDL type from table in typemap-shared.inc.xsl -->
-    <xsl:variable name="wraptypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
     <xsl:choose>
         <xsl:when test="$type='wstring'">
             <xsl:if test="$dir='in' and not($safearray='yes')">
@@ -264,50 +375,65 @@ public:
             </xsl:if>
             <xsl:text>com::Utf8Str &</xsl:text>
         </xsl:when>
+
         <xsl:when test="$type='uuid'">
             <xsl:if test="$dir='in'">
                 <xsl:text>const </xsl:text>
             </xsl:if>
             <xsl:text>com::Guid &</xsl:text>
         </xsl:when>
-        <xsl:when test="string-length($wraptypefield)">
-            <xsl:value-of select="$wraptypefield"/>
-        </xsl:when>
-        <xsl:when test="//enum[@name=$type]">
-            <xsl:value-of select="concat($type, '_T')"/>
-        </xsl:when>
+
         <xsl:when test="$type='$unknown'">
             <xsl:if test="$dir='in' and not($safearray='yes')">
                 <xsl:text>const </xsl:text>
             </xsl:if>
             <xsl:text>ComPtr<IUnknown> &</xsl:text>
         </xsl:when>
-        <xsl:when test="//interface[@name=$type]">
-            <xsl:variable name="thatif" select="//interface[@name=$type]"/>
-            <xsl:variable name="thatifname" select="$thatif/@name"/>
+
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
             <xsl:if test="$dir='in' and not($safearray='yes')">
                 <xsl:text>const </xsl:text>
             </xsl:if>
-            <xsl:value-of select="concat('ComPtr<', $thatifname, '> &')"/>
+            <xsl:value-of select="concat('ComPtr<', $type, '> &')"/>
         </xsl:when>
+
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
+            <xsl:value-of select="concat($type, '_T')"/>
+        </xsl:when>
+
+        <!-- Micro optimizations: Put off wraptypefield calculation as long as possible; Check interfaces before enums. -->
         <xsl:otherwise>
-            <xsl:call-template name="fatalError">
-                <xsl:with-param name="msg" select="concat('translatewrappedtype: Type "', $type, '" is not supported.')"/>
-            </xsl:call-template>
+            <!-- get C++ wrap type from IDL type from table in typemap-shared.inc.xsl -->
+            <xsl:variable name="wraptypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename"/>
+            <xsl:choose>
+                <xsl:when test="string-length($wraptypefield)">
+                    <xsl:value-of select="$wraptypefield"/>
+                </xsl:when>
+
+                <xsl:otherwise>
+                    <xsl:call-template name="fatalError">
+                        <xsl:with-param name="msg" select="concat('translatewrappedtype: Type "', $type, '" is not supported.')"/>
+                    </xsl:call-template>
+                </xsl:otherwise>
+            </xsl:choose>
         </xsl:otherwise>
     </xsl:choose>
+    <xsl:if test="$mod='ptr'">
+        <xsl:text> *</xsl:text>
+    </xsl:if>
 </xsl:template>
 
 <xsl:template name="translatefmtspectype">
     <xsl:param name="type"/>
     <xsl:param name="dir"/>
-    <xsl:param name="safearray"/>
     <xsl:param name="mod"/>
+    <xsl:param name="safearray"/>
+    <xsl:param name="isref"/>
 
     <!-- get C format string for IDL type from table in typemap-shared.inc.xsl -->
     <xsl:variable name="wrapfmt" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluefmt"/>
     <xsl:choose>
-        <xsl:when test="$mod='ref' and $dir!='in'">
+        <xsl:when test="$mod='ptr' or ($isref='yes' and $dir!='in')">
             <xsl:text>%p</xsl:text>
         </xsl:when>
         <xsl:when test="$safearray='yes'">
@@ -316,13 +442,13 @@ public:
         <xsl:when test="string-length($wrapfmt)">
             <xsl:value-of select="$wrapfmt"/>
         </xsl:when>
-        <xsl:when test="//enum[@name=$type]">
-            <xsl:text>%RU32</xsl:text>
-        </xsl:when>
         <xsl:when test="$type='$unknown'">
             <xsl:text>%p</xsl:text>
         </xsl:when>
-        <xsl:when test="//interface[@name=$type]">
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
+            <xsl:text>%RU32</xsl:text>
+        </xsl:when>
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
             <xsl:text>%p</xsl:text>
         </xsl:when>
         <xsl:otherwise>
@@ -333,51 +459,130 @@ public:
     </xsl:choose>
 </xsl:template>
 
-<xsl:template match="attribute/@type | param/@type" mode="public">
+<xsl:template name="translatedtracetype">
+    <xsl:param name="type"/>
+    <xsl:param name="dir"/>
+    <xsl:param name="mod"/>
+
+    <!-- get dtrace probe type from IDL type from table in typemap-shared.inc.xsl -->
+    <xsl:variable name="dtracetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@dtracename"/>
+    <xsl:choose>
+        <xsl:when test="string-length($dtracetypefield)">
+            <xsl:value-of select="$dtracetypefield"/>
+        </xsl:when>
+        <xsl:when test="$type='$unknown'">
+            <!-- <xsl:text>struct IUnknown *</xsl:text> -->
+            <xsl:text>void *</xsl:text>
+        </xsl:when>
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
+            <!-- <xsl:value-of select="concat($type, '_T')"/> - later we can emit enums into dtrace the library -->
+            <xsl:text>int</xsl:text>
+        </xsl:when>
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
+            <!--
+            <xsl:value-of select="concat('struct ', $type, ' *')"/>
+            -->
+            <xsl:text>void *</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:call-template name="fatalError">
+                <xsl:with-param name="msg" select="concat('translatedtracetype Type "', $type, '" is not supported.')"/>
+            </xsl:call-template>
+        </xsl:otherwise>
+    </xsl:choose>
+    <xsl:if test="$mod='ptr'">
+        <xsl:text> *</xsl:text>
+    </xsl:if>
+</xsl:template>
+
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  templates for handling entire interfaces and their contents
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<!-- Called on interface node. -->
+<xsl:template name="emitInterface">
+    <!-- sources, headers and dtrace-probes all needs attribute lists -->
+    <xsl:variable name="addinterfaces">
+        <xsl:call-template name="getattrlist">
+            <xsl:with-param name="val" select="@wrap-hint-server-addinterfaces"/>
+        </xsl:call-template>
+    </xsl:variable>
+
+    <!-- interface santiy check, prevents crashes -->
+    <xsl:if test="(count(attribute) + count(method)) = 0">
+        <xsl:message terminate="yes">
+            Interface <xsl:value-of select="@name"/> is empty which causes midl generated proxy
+            stubs to crash. Please add a dummy:<xsl:value-of select="$G_sNewLine"/>
+              <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
+        </xsl:message>
+    </xsl:if>
+
+    <xsl:choose>
+        <xsl:when test="$generating = 'sources'">
+            <xsl:if test="(position() mod 2) = $reminder">
+                <xsl:call-template name="emitCode">
+                    <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+                </xsl:call-template>
+            </xsl:if>
+        </xsl:when>
+        <xsl:when test="$generating = 'headers'">
+            <xsl:call-template name="emitHeader">
+                <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:when test="$generating = 'dtrace-probes'">
+            <xsl:call-template name="emitDTraceProbes">
+                <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+            </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise><xsl:message terminate="yes">Otherwise oops in emitInterface</xsl:message></xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- Called on a method param or attribute node. -->
+<xsl:template name="emitPublicParameter">
     <xsl:param name="dir"/>
 
     <xsl:variable name="gluetype">
         <xsl:call-template name="translatepublictype">
-            <xsl:with-param name="type" select="."/>
+            <xsl:with-param name="type" select="@type"/>
             <xsl:with-param name="dir" select="$dir"/>
+            <xsl:with-param name="mod" select="@mod"/>
         </xsl:call-template>
     </xsl:variable>
 
-    <xsl:if test="../@safearray='yes'">
-        <xsl:choose>
-            <xsl:when test="$dir='in'">
-                <xsl:text>ComSafeArrayIn(</xsl:text>
-            </xsl:when>
-            <xsl:otherwise>
-                <xsl:text>ComSafeArrayOut(</xsl:text>
-            </xsl:otherwise>
-        </xsl:choose>
-    </xsl:if>
-    <xsl:value-of select="$gluetype"/>
     <xsl:choose>
-        <xsl:when test="../@safearray='yes'">
-            <xsl:text>, </xsl:text>
-        </xsl:when>
-        <xsl:otherwise>
-            <xsl:if test="substring($gluetype,string-length($gluetype))!='*'">
-                <xsl:text> </xsl:text>
-            </xsl:if>
+        <xsl:when test="@safearray='yes'">
             <xsl:choose>
                 <xsl:when test="$dir='in'">
+                    <xsl:text>ComSafeArrayIn(</xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
-                    <xsl:value-of select="'*'"/>
+                    <xsl:text>ComSafeArrayOut(</xsl:text>
                 </xsl:otherwise>
             </xsl:choose>
+            <xsl:value-of select="$gluetype"/>
+            <xsl:text>, a</xsl:text>
+            <xsl:call-template name="capitalize">
+                <xsl:with-param name="str" select="@name"/>
+            </xsl:call-template>
+            <xsl:text>)</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:value-of select="$gluetype"/>
+            <xsl:if test="substring($gluetype,string-length($gluetype))!='*'">
+                <xsl:text> </xsl:text>
+            </xsl:if>
+            <xsl:if test="$dir != 'in'">
+                <xsl:text>*</xsl:text>
+            </xsl:if>
+            <xsl:text>a</xsl:text>
+            <xsl:call-template name="capitalize">
+                <xsl:with-param name="str" select="@name"/>
+            </xsl:call-template>
         </xsl:otherwise>
     </xsl:choose>
-    <xsl:text>a</xsl:text>
-    <xsl:call-template name="capitalize">
-        <xsl:with-param name="str" select="../@name"/>
-    </xsl:call-template>
-    <xsl:if test="../@safearray='yes'">
-        <xsl:value-of select="')'"/>
-    </xsl:if>
 </xsl:template>
 
 <xsl:template match="attribute/@type | param/@type" mode="wrapped">
@@ -387,9 +592,13 @@ public:
         <xsl:call-template name="translatewrappedtype">
             <xsl:with-param name="type" select="."/>
             <xsl:with-param name="dir" select="$dir"/>
+            <xsl:with-param name="mod" select="../@mod"/>
             <xsl:with-param name="safearray" select="../@safearray"/>
         </xsl:call-template>
     </xsl:variable>
+    <xsl:variable name="lastchar">
+        <xsl:value-of select="substring($wraptype, string-length($wraptype))"/>
+    </xsl:variable>
 
     <xsl:choose>
         <xsl:when test="../@safearray='yes'">
@@ -398,21 +607,16 @@ public:
             </xsl:if>
             <xsl:text>std::vector<</xsl:text>
             <xsl:choose>
-                <xsl:when test="substring($wraptype,string-length($wraptype))='&'">
+                <xsl:when test="$lastchar = '&'">
                     <xsl:variable name="wraptype2">
-                        <xsl:value-of select="substring($wraptype,1,string-length($wraptype)-2)"/>
+                        <xsl:value-of select="substring($wraptype, 1, string-length($wraptype)-2)"/>
                     </xsl:variable>
-
-                    <xsl:choose>
-                        <xsl:when test="substring($wraptype2,string-length($wraptype2))='>'">
-                            <xsl:value-of select="concat($wraptype2, ' ')"/>
-                        </xsl:when>
-                        <xsl:otherwise>
-                            <xsl:value-of select="$wraptype2"/>
-                        </xsl:otherwise>
-                    </xsl:choose>
+                    <xsl:value-of select="$wraptype2"/>
+                    <xsl:if test="substring($wraptype2,string-length($wraptype2)) = '>'">
+                        <xsl:text> </xsl:text>
+                    </xsl:if>
                 </xsl:when>
-                <xsl:when test="substring($wraptype,string-length($wraptype))='>'">
+                <xsl:when test="lastchar = '>'">
                     <xsl:value-of select="concat($wraptype, ' ')"/>
                 </xsl:when>
                 <xsl:otherwise>
@@ -423,17 +627,13 @@ public:
         </xsl:when>
         <xsl:otherwise>
             <xsl:value-of select="$wraptype"/>
-            <xsl:if test="substring($wraptype,string-length($wraptype))!='&'">
-                <xsl:if test="substring($wraptype,string-length($wraptype))!='*'">
+            <xsl:if test="$lastchar != '&'">
+                <xsl:if test="$lastchar != '*'">
                     <xsl:text> </xsl:text>
                 </xsl:if>
-                <xsl:choose>
-                    <xsl:when test="$dir='in'">
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:value-of select="'*'"/>
-                    </xsl:otherwise>
-                </xsl:choose>
+                <xsl:if test="$dir != 'in'">
+                    <xsl:text>*</xsl:text>
+                </xsl:if>
             </xsl:if>
         </xsl:otherwise>
     </xsl:choose>
@@ -445,9 +645,9 @@ public:
 
 <xsl:template match="attribute/@type | param/@type" mode="logparamtext">
     <xsl:param name="dir"/>
-    <xsl:param name="mod"/>
+    <xsl:param name="isref"/>
 
-    <xsl:if test="$mod!='ref' and ($dir='out' or $dir='ret')">
+    <xsl:if test="$isref!='yes' and ($dir='out' or $dir='ret')">
         <xsl:text>*</xsl:text>
     </xsl:if>
     <xsl:text>a</xsl:text>
@@ -458,23 +658,24 @@ public:
     <xsl:call-template name="translatefmtspectype">
         <xsl:with-param name="type" select="."/>
         <xsl:with-param name="dir" select="$dir"/>
+        <xsl:with-param name="mod" select="../@mod"/>
         <xsl:with-param name="safearray" select="../@safearray"/>
-        <xsl:with-param name="mod" select="$mod"/>
+        <xsl:with-param name="isref" select="$isref"/>
     </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="attribute/@type | param/@type" mode="logparamval">
     <xsl:param name="dir"/>
-    <xsl:param name="mod"/>
+    <xsl:param name="isref"/>
 
     <xsl:choose>
-        <xsl:when test="../@safearray='yes' and $mod!='ref'">
+        <xsl:when test="../@safearray='yes' and $isref!='yes'">
             <xsl:text>ComSafeArraySize(</xsl:text>
-            <xsl:if test="$mod!='ref' and $dir!='in'">
+            <xsl:if test="$isref!='yes' and $dir!='in'">
                 <xsl:text>*</xsl:text>
             </xsl:if>
         </xsl:when>
-        <xsl:when test="$mod!='ref' and $dir!='in'">
+        <xsl:when test="$isref!='yes' and $dir!='in'">
             <xsl:text>*</xsl:text>
         </xsl:when>
     </xsl:choose>
@@ -483,23 +684,220 @@ public:
         <xsl:with-param name="str" select="../@name"/>
     </xsl:call-template>
     <xsl:choose>
-        <xsl:when test="../@safearray='yes' and $mod!='ref'">
+        <xsl:when test="../@safearray='yes' and $isref!='yes'">
             <xsl:text>)</xsl:text>
         </xsl:when>
     </xsl:choose>
 </xsl:template>
 
-<xsl:template match="attribute/@type | param/@type" mode="paramvalconversion">
+<!-- Emits the DTrace probe parameter value (using tmps), invoked on param or attribute node. -->
+<xsl:template name="emitDTraceParamValue">
+    <xsl:param name="dir"/>
+
+    <xsl:variable name="viatmpvar">
+        <xsl:for-each select="@type">
+            <xsl:call-template name="paramconversionviatmp">
+                <xsl:with-param name="dir" select="$dir"/>
+            </xsl:call-template>
+        </xsl:for-each>
+    </xsl:variable>
+
+    <xsl:variable name="type" select="@type"/>
+    <xsl:choose>
+        <!-- Doesn't help to inline paramconversionviatmp: <xsl:when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid' or @safearray = 'yes' or count(key('G_keyInterfacesByName', $type)) > 0"> -->
+        <xsl:when test="$viatmpvar = 'yes'">
+            <xsl:variable name="tmpname">
+                <xsl:text>Tmp</xsl:text>
+                <xsl:call-template name="capitalize">
+                    <xsl:with-param name="str" select="@name"/>
+                </xsl:call-template>
+            </xsl:variable>
+
+            <xsl:choose>
+                <xsl:when test="@safearray = 'yes'">
+                    <xsl:text>(uint32_t)</xsl:text>
+                    <xsl:value-of select="$tmpname"/>
+                    <xsl:text>.array().size(), </xsl:text>
+                    <!-- Later:
+                    <xsl:value-of select="concat($tmpname, '.array().data(), ')"/>
+                    -->
+                    <xsl:text>NULL /*for now*/</xsl:text>
+                </xsl:when>
+                <xsl:when test="$type = 'wstring'">
+                    <xsl:value-of select="$tmpname"/>
+                    <xsl:text>.str().c_str()</xsl:text>
+                </xsl:when>
+                <xsl:when test="$type = 'uuid'">
+                    <xsl:value-of select="$tmpname"/>
+                    <xsl:text>.uuid().toStringCurly().c_str()</xsl:text>
+                </xsl:when>
+                <xsl:when test="$type = '$unknown'">
+                    <xsl:text>(void *)</xsl:text>
+                    <xsl:value-of select="$tmpname"/>
+                    <xsl:text>.ptr()</xsl:text>
+                </xsl:when>
+                <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
+                    <xsl:text>(void *)</xsl:text>
+                    <xsl:value-of select="$tmpname"/>
+                    <xsl:text>.ptr()</xsl:text>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="$tmpname"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:when>
+
+        <xsl:otherwise>
+            <xsl:if test="$dir != 'in'">
+                <xsl:text>*</xsl:text>
+            </xsl:if>
+            <xsl:text>a</xsl:text>
+            <xsl:call-template name="capitalize">
+                <xsl:with-param name="str" select="@name"/>
+            </xsl:call-template>
+
+            <xsl:if test="$type = 'boolean'">
+                <xsl:text> != FALSE</xsl:text>
+            </xsl:if>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!--
+Same as emitDTraceParamValue except no temporary variables are used (they are out of scope).
+Note! There are two other instances of this code with different @dir values, see below.
+-->
+<xsl:template name="emitDTraceParamValNoTmp">
+    <!-- To speed this up, the logic of paramconversionviatmp has been duplicated/inlined here. -->
+    <xsl:variable name="type" select="@type"/>
+    <xsl:choose>
+        <xsl:when test="@safearray = 'yes'">
+            <xsl:text>0, 0</xsl:text>
+        </xsl:when>
+        <xsl:when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid' or count(key('G_keyInterfacesByName', $type)) > 0">
+            <xsl:text>0</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:if test="@dir != 'in'">
+                <xsl:text>*</xsl:text>
+            </xsl:if>
+            <xsl:text>a</xsl:text>
+            <xsl:call-template name="capitalize">
+                <xsl:with-param name="str" select="@name"/>
+            </xsl:call-template>
+            <xsl:if test="$type = 'boolean'">
+                <xsl:text> != FALSE</xsl:text>
+            </xsl:if>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- Copy of emitDTraceParamValNoTmp with @dir = 'in' for speeding up the code (noticable difference). -->
+<xsl:template name="emitDTraceParamValNoTmp-DirIn">
+    <xsl:variable name="type" select="@type"/>
+    <xsl:choose>
+        <xsl:when test="@safearray = 'yes'">
+            <xsl:text>0, 0</xsl:text>
+        </xsl:when>
+        <xsl:when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid' or count(key('G_keyInterfacesByName', $type)) > 0">
+            <xsl:text>0</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:text>a</xsl:text>
+            <xsl:call-template name="capitalize">
+                <xsl:with-param name="str" select="@name"/>
+            </xsl:call-template>
+            <xsl:if test="$type = 'boolean'">
+                <xsl:text> != FALSE</xsl:text>
+            </xsl:if>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<!-- Copy of emitDTraceParamValNoTmp with @dir != 'in' for speeding up attributes (noticable difference). -->
+<xsl:template name="emitDTraceParamValNoTmp-DirNotIn">
+    <xsl:variable name="type" select="@type"/>
+    <xsl:choose>
+        <xsl:when test="@safearray = 'yes'">
+            <xsl:text>0, 0</xsl:text>
+        </xsl:when>
+        <xsl:when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid' or count(key('G_keyInterfacesByName', $type)) > 0">
+            <xsl:text>0</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:text>*a</xsl:text>
+            <xsl:call-template name="capitalize">
+                <xsl:with-param name="str" select="@name"/>
+            </xsl:call-template>
+            <xsl:if test="$type = 'boolean'">
+                <xsl:text> != FALSE</xsl:text>
+            </xsl:if>
+        </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template match="attribute/@type | param/@type" mode="dtraceparamdecl">
     <xsl:param name="dir"/>
 
     <xsl:variable name="gluetype">
-        <xsl:call-template name="translatepublictype">
+        <xsl:call-template name="translatedtracetype">
             <xsl:with-param name="type" select="."/>
             <xsl:with-param name="dir" select="$dir"/>
+            <xsl:with-param name="mod" select="../@mod"/>
         </xsl:call-template>
     </xsl:variable>
+
+    <!-- Safe arrays get an extra size parameter. -->
+    <xsl:if test="../@safearray='yes'">
+        <xsl:text>uint32_t a_c</xsl:text>
+        <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="../@name"/>
+        </xsl:call-template>
+        <xsl:text>, </xsl:text>
+    </xsl:if>
+
+    <xsl:value-of select="$gluetype"/>
+    <xsl:choose>
+        <xsl:when test="../@safearray='yes'">
+            <xsl:text> *a_pa</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:if test="substring($gluetype,string-length($gluetype))!='*'">
+                <xsl:text> </xsl:text>
+            </xsl:if>
+            <xsl:text>a_</xsl:text>
+        </xsl:otherwise>
+    </xsl:choose>
+
+    <xsl:call-template name="capitalize">
+        <xsl:with-param name="str" select="../@name"/>
+    </xsl:call-template>
+</xsl:template>
+
+<!-- Call this to determine whether a temporary conversion variable is used for the current parameter.
+Returns empty if not needed, non-empty ('yes') if needed. -->
+<xsl:template name="paramconversionviatmp">
+    <xsl:param name="dir"/>
+    <xsl:variable name="type" select="."/>
+    <xsl:choose>
+        <xsl:when test="$type = 'wstring' or $type = '$unknown' or $type = 'uuid'">
+            <xsl:text>yes</xsl:text>
+        </xsl:when>
+        <xsl:when test="../@safearray = 'yes'">
+            <xsl:text>yes</xsl:text>
+        </xsl:when>
+        <xsl:when test="$type = 'boolean' or $type = 'long' or $type = 'long' or $type = 'long long'"/> <!-- XXX: drop this? -->
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
+            <xsl:text>yes</xsl:text>
+        </xsl:when>
+    </xsl:choose>
+</xsl:template>
+
+<!-- Call this to get the argument conversion class, if any is needed. -->
+<xsl:template name="paramconversionclass">
+    <xsl:param name="dir"/>
+
     <xsl:variable name="type" select="."/>
-    <xsl:variable name="thatif" select="../../../..//interface[@name=$type]"/>
     <xsl:choose>
         <xsl:when test="$type='$unknown'">
             <xsl:if test="../@safearray='yes'">
@@ -507,158 +905,169 @@ public:
             </xsl:if>
             <xsl:choose>
                 <xsl:when test="$dir='in'">
-                    <xsl:text>ComTypeInConverter<IUnknown>(</xsl:text>
+                    <xsl:text>ComTypeInConverter<IUnknown></xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
-                    <xsl:text>ComTypeOutConverter<IUnknown>(</xsl:text>
+                    <xsl:text>ComTypeOutConverter<IUnknown></xsl:text>
                 </xsl:otherwise>
             </xsl:choose>
-            <xsl:if test="../@safearray='yes'">
-                <xsl:choose>
-                    <xsl:when test="$dir='in'">
-                        <xsl:text>ComSafeArrayInArg(</xsl:text>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:text>ComSafeArrayOutArg(</xsl:text>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </xsl:if>
         </xsl:when>
-        <xsl:when test="$thatif">
+
+        <xsl:when test="$type='wstring'">
             <xsl:if test="../@safearray='yes'">
                 <xsl:text>Array</xsl:text>
             </xsl:if>
-            <xsl:variable name="thatifname" select="$thatif/@name"/>
             <xsl:choose>
                 <xsl:when test="$dir='in'">
-                    <xsl:text>ComTypeInConverter</xsl:text>
+                    <xsl:text>BSTRInConverter</xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
-                    <xsl:text>ComTypeOutConverter</xsl:text>
+                    <xsl:text>BSTROutConverter</xsl:text>
                 </xsl:otherwise>
             </xsl:choose>
-            <xsl:value-of select="concat('<', $thatifname, '>(')"/>
-            <xsl:if test="../@safearray='yes'">
-                <xsl:choose>
-                    <xsl:when test="$dir='in'">
-                        <xsl:text>ComSafeArrayInArg(</xsl:text>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:text>ComSafeArrayOutArg(</xsl:text>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </xsl:if>
         </xsl:when>
-        <xsl:when test="$type='wstring'">
+
+        <xsl:when test="$type='uuid'">
             <xsl:if test="../@safearray='yes'">
                 <xsl:text>Array</xsl:text>
             </xsl:if>
             <xsl:choose>
                 <xsl:when test="$dir='in'">
-                    <xsl:text>BSTRInConverter(</xsl:text>
+                    <xsl:text>UuidInConverter</xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
-                    <xsl:text>BSTROutConverter(</xsl:text>
+                    <xsl:text>UuidOutConverter</xsl:text>
                 </xsl:otherwise>
             </xsl:choose>
-            <xsl:if test="../@safearray='yes'">
-                <xsl:choose>
-                    <xsl:when test="$dir='in'">
-                        <xsl:text>ComSafeArrayInArg(</xsl:text>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:text>ComSafeArrayOutArg(</xsl:text>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </xsl:if>
         </xsl:when>
-        <xsl:when test="$type='uuid'">
+
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
             <xsl:if test="../@safearray='yes'">
                 <xsl:text>Array</xsl:text>
             </xsl:if>
             <xsl:choose>
                 <xsl:when test="$dir='in'">
-                    <xsl:text>UuidInConverter(</xsl:text>
+                    <xsl:text>ComTypeInConverter</xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
-                    <xsl:text>UuidOutConverter(</xsl:text>
+                    <xsl:text>ComTypeOutConverter</xsl:text>
                 </xsl:otherwise>
             </xsl:choose>
-            <xsl:if test="../@safearray='yes'">
-                <xsl:choose>
-                    <xsl:when test="$dir='in'">
-                        <xsl:text>ComSafeArrayInArg(</xsl:text>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:text>ComSafeArrayOutArg(</xsl:text>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </xsl:if>
+            <xsl:value-of select="concat('<', $type, '>')"/>
         </xsl:when>
-        <xsl:otherwise>
-            <xsl:if test="../@safearray='yes'">
-                <xsl:text>Array</xsl:text>
-                <xsl:choose>
-                    <xsl:when test="$dir='in'">
-                        <xsl:text>InConverter</xsl:text>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:text>OutConverter</xsl:text>
-                    </xsl:otherwise>
-                </xsl:choose>
-                <xsl:value-of select="concat('<', $gluetype, '>(')"/>
-                <xsl:choose>
-                    <xsl:when test="$dir='in'">
-                        <xsl:text>ComSafeArrayInArg(</xsl:text>
-                    </xsl:when>
-                    <xsl:otherwise>
-                        <xsl:text>ComSafeArrayOutArg(</xsl:text>
-                    </xsl:otherwise>
-                </xsl:choose>
-            </xsl:if>
-        </xsl:otherwise>
-    </xsl:choose>
-    <xsl:text>a</xsl:text>
-    <xsl:call-template name="capitalize">
-        <xsl:with-param name="str" select="../@name"/>
-    </xsl:call-template>
-    <xsl:choose>
-        <xsl:when test="$type='$unknown' or $thatif">
+
+        <xsl:when test="../@safearray='yes'">
+            <xsl:text>Array</xsl:text>
             <xsl:choose>
-                <xsl:when test="../@safearray='yes'">
-                    <xsl:text>)).array()</xsl:text>
+                <xsl:when test="$dir='in'">
+                    <xsl:text>InConverter</xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
-                    <xsl:text>).ptr()</xsl:text>
+                    <xsl:text>OutConverter</xsl:text>
                 </xsl:otherwise>
             </xsl:choose>
+            <xsl:variable name="gluetype">
+                <xsl:call-template name="translatepublictype">
+                    <xsl:with-param name="type" select="."/>
+                    <xsl:with-param name="dir" select="$dir"/>
+                    <xsl:with-param name="mod" select="../@mod"/>
+                </xsl:call-template>
+            </xsl:variable>
+            <xsl:value-of select="concat('<', $gluetype, '>')"/>
         </xsl:when>
-        <xsl:when test="$type='wstring'">
+    </xsl:choose>
+</xsl:template>
+
+<!-- Emits code for converting the parameter to a temporary variable. -->
+<xsl:template match="attribute/@type | param/@type" mode="paramvalconversion2tmpvar">
+    <xsl:param name="dir"/>
+
+    <xsl:variable name="conversionclass">
+        <xsl:call-template name="paramconversionclass">
+            <xsl:with-param name="dir" select="$dir"/>
+        </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:if test="$conversionclass != ''">
+        <xsl:value-of select="$conversionclass"/>
+        <xsl:text> Tmp</xsl:text>
+        <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="../@name"/>
+        </xsl:call-template>
+        <xsl:text>(</xsl:text>
+        <xsl:if test="../@safearray = 'yes'">
             <xsl:choose>
-                <xsl:when test="../@safearray='yes'">
-                    <xsl:text>)).array()</xsl:text>
+                <xsl:when test="$dir = 'in'">
+                    <xsl:text>ComSafeArrayInArg(</xsl:text>
                 </xsl:when>
                 <xsl:otherwise>
-                    <xsl:text>).str()</xsl:text>
+                    <xsl:text>ComSafeArrayOutArg(</xsl:text>
                 </xsl:otherwise>
             </xsl:choose>
-        </xsl:when>
-        <xsl:when test="$type='uuid'">
+        </xsl:if>
+        <xsl:text>a</xsl:text>
+        <xsl:call-template name="capitalize">
+            <xsl:with-param name="str" select="../@name"/>
+        </xsl:call-template>
+        <xsl:if test="../@safearray = 'yes'">
+            <xsl:text>)</xsl:text>
+        </xsl:if>
+        <xsl:text>);</xsl:text>
+    </xsl:if>
+
+</xsl:template>
+
+<!-- Partner to paramvalconversion2tmpvar that emits the parameter when calling call the internal worker method. -->
+<xsl:template match="attribute/@type | param/@type" mode="paramvalconversionusingtmp">
+    <xsl:param name="dir"/>
+
+    <xsl:variable name="viatmpvar">
+        <xsl:call-template name="paramconversionviatmp">
+            <xsl:with-param name="dir" select="$dir"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="type" select="."/>
+
+    <xsl:choose>
+        <xsl:when test="$viatmpvar = 'yes'">
+            <xsl:text>Tmp</xsl:text>
+            <xsl:call-template name="capitalize">
+                <xsl:with-param name="str" select="../@name"/>
+            </xsl:call-template>
+
             <xsl:choose>
                 <xsl:when test="../@safearray='yes'">
-                    <xsl:text>)).array()</xsl:text>
+                    <xsl:text>.array()</xsl:text>
                 </xsl:when>
-                <xsl:otherwise>
-                    <xsl:text>).uuid()</xsl:text>
-                </xsl:otherwise>
+                <xsl:when test="$type = 'wstring'">
+                    <xsl:text>.str()</xsl:text>
+                </xsl:when>
+                <xsl:when test="$type = 'uuid'">
+                    <xsl:text>.uuid()</xsl:text>
+                </xsl:when>
+                <xsl:when test="$type = '$unknown'">
+                    <xsl:text>.ptr()</xsl:text>
+                </xsl:when>
+                <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
+                    <xsl:text>.ptr()</xsl:text>
+                </xsl:when>
+                <xsl:otherwise><xsl:message terminate="yes">Oops #1</xsl:message></xsl:otherwise>
             </xsl:choose>
         </xsl:when>
+
         <xsl:otherwise>
-            <xsl:if test="../@safearray='yes'">
-                <xsl:text>)).array()</xsl:text>
+            <xsl:text>a</xsl:text>
+            <xsl:call-template name="capitalize">
+                <xsl:with-param name="str" select="../@name"/>
+            </xsl:call-template>
+
+            <!-- Make sure BOOL values we pass down are either TRUE or FALSE. -->
+            <xsl:if test="$type = 'boolean' and $dir = 'in'">
+                <xsl:text> != FALSE</xsl:text>
             </xsl:if>
         </xsl:otherwise>
     </xsl:choose>
+
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
@@ -666,6 +1075,12 @@ public:
  - - - - - - - - - - - - - - - - - - - - - - -->
 
 <xsl:template match="attribute" mode="public">
+    <xsl:param name="target"/>
+
+    <xsl:call-template name="emitTargetBegin">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
+
     <xsl:variable name="attrbasename">
         <xsl:call-template name="capitalize">
             <xsl:with-param name="str" select="@name"/>
@@ -673,29 +1088,43 @@ public:
     </xsl:variable>
 
     <xsl:value-of select="concat('    STDMETHOD(COMGETTER(', $attrbasename, '))(')"/>
-    <xsl:apply-templates select="@type" mode="public">
-        <xsl:with-param name="dir" select="'out'"/>
-    </xsl:apply-templates>
+    <xsl:call-template name="emitPublicParameter">
+        <xsl:with-param name="dir">out</xsl:with-param>
+    </xsl:call-template>
     <xsl:text>);
 </xsl:text>
 
     <xsl:if test="not(@readonly) or @readonly!='yes'">
         <xsl:value-of select="concat('    STDMETHOD(COMSETTER(', $attrbasename, '))(')"/>
-        <xsl:apply-templates select="@type" mode="public">
-            <xsl:with-param name="dir" select="'in'"/>
-        </xsl:apply-templates>
+        <xsl:call-template name="emitPublicParameter">
+            <xsl:with-param name="dir">in</xsl:with-param>
+        </xsl:call-template>
         <xsl:text>);
 </xsl:text>
     </xsl:if>
+
+    <xsl:call-template name="emitTargetEnd">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="attribute" mode="wrapped">
+    <xsl:param name="target"/>
+
+    <xsl:call-template name="emitTargetBegin">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
+
     <xsl:variable name="attrbasename">
         <xsl:call-template name="capitalize">
             <xsl:with-param name="str" select="@name"/>
         </xsl:call-template>
     </xsl:variable>
 
+    <xsl:if test="$attrbasename = 'MidlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>    //</xsl:text>
+    </xsl:if>
+
     <xsl:value-of select="concat('    virtual HRESULT get', $attrbasename, '(')"/>
     <xsl:variable name="passAutoCaller">
         <xsl:call-template name="checkoption">
@@ -723,33 +1152,65 @@ public:
         <xsl:text>) = 0;
 </xsl:text>
     </xsl:if>
+
+    <xsl:call-template name="emitTargetEnd">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="attribute" mode="code">
     <xsl:param name="topclass"/>
+    <xsl:param name="dtracetopclass"/>
+    <xsl:param name="target"/>
+
+    <xsl:call-template name="emitTargetBegin">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
 
     <xsl:variable name="attrbasename">
         <xsl:call-template name="capitalize">
             <xsl:with-param name="str" select="@name"/>
         </xsl:call-template>
     </xsl:variable>
+    <xsl:variable name="limitedAutoCaller">
+        <xsl:call-template name="checkoption">
+            <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
+            <xsl:with-param name="option" select="'limitedcaller'"/>
+        </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:variable name="dtraceattrname">
+        <xsl:choose>
+            <xsl:when test="@dtracename">
+                <xsl:value-of select="@dtracename"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$attrbasename"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:variable>
 
     <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMGETTER(', $attrbasename, ')(')"/>
-    <xsl:apply-templates select="@type" mode="public">
-        <xsl:with-param name="dir" select="'out'"/>
-    </xsl:apply-templates>
+    <xsl:call-template name="emitPublicParameter">
+        <xsl:with-param name="dir">out</xsl:with-param>
+    </xsl:call-template>
     <xsl:text>)
-{
+{</xsl:text>
+    <xsl:if test="$attrbasename = 'MidlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>
+#if 0 /* This is a dummy attribute */</xsl:text>
+    </xsl:if>
+    <xsl:text>
     LogRelFlow(("{%p} %s: enter </xsl:text>
     <xsl:apply-templates select="@type" mode="logparamtext">
         <xsl:with-param name="dir" select="'out'"/>
-        <xsl:with-param name="mod" select="'ref'"/>
+        <xsl:with-param name="isref" select="'yes'"/>
     </xsl:apply-templates>
     <xsl:text>\n", this, </xsl:text>
     <xsl:value-of select="concat('"', $topclass, '::get', $attrbasename, '", ')"/>
     <xsl:apply-templates select="@type" mode="logparamval">
         <xsl:with-param name="dir" select="'out'"/>
-        <xsl:with-param name="mod" select="'ref'"/>
+        <xsl:with-param name="isref" select="'yes'"/>
     </xsl:apply-templates>
     <xsl:text>));
 
@@ -762,8 +1223,30 @@ public:
         CheckComArgOutPointerValidThrow(a</xsl:text>
     <xsl:value-of select="$attrbasename"/>
     <xsl:text>);
+        </xsl:text>
+    <xsl:apply-templates select="@type" mode="paramvalconversion2tmpvar">
+        <xsl:with-param name="dir" select="'out'"/>
+    </xsl:apply-templates>
+    <xsl:if test="$attrbasename != 'MidlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+        <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_ENTER('), $G_lowerCase, $G_upperCase)"/>
+        <xsl:text>this);
+#endif</xsl:text>
+    </xsl:if>
+    <xsl:text>
 
-        AutoCaller autoCaller(this);
+        </xsl:text>
+    <xsl:choose>
+      <xsl:when test="$limitedAutoCaller = 'true'">
+        <xsl:text>AutoLimitedCaller</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>AutoCaller</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text> autoCaller(this);
         if (FAILED(autoCaller.rc()))
             throw autoCaller.rc();
 
@@ -778,50 +1261,101 @@ public:
     <xsl:if test="$passAutoCaller = 'true'">
         <xsl:text>autoCaller, </xsl:text>
     </xsl:if>
-    <xsl:apply-templates select="@type" mode="paramvalconversion">
+    <xsl:apply-templates select="@type" mode="paramvalconversionusingtmp">
         <xsl:with-param name="dir" select="'out'"/>
     </xsl:apply-templates>
     <xsl:text>);
+</xsl:text>
+    <xsl:if test="$attrbasename != 'MidlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+        <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+        <xsl:text>this, hrc, 0 /*normal*/,</xsl:text>
+        <xsl:call-template name="emitDTraceParamValue">
+            <xsl:with-param name="dir">out</xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>);
+#endif
+</xsl:text>
+    </xsl:if>
+    <xsl:text>
     }
     catch (HRESULT hrc2)
     {
-        hrc = hrc2;
+        hrc = hrc2;</xsl:text>
+    <xsl:if test="$attrbasename != 'MidlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+    <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+    <xsl:text>this, hrc, 1 /*hrc exception*/,</xsl:text>
+    <xsl:call-template name="emitDTraceParamValNoTmp-DirNotIn"/>
+    <xsl:text>);
+#endif
+</xsl:text>
+    </xsl:if>
+    <xsl:text>
     }
     catch (...)
     {
-        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
+        hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);</xsl:text>
+    <xsl:if test="$attrbasename != 'MidlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+    <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_GET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+    <xsl:text>this, hrc, 9 /*unhandled exception*/,</xsl:text>
+    <xsl:call-template name="emitDTraceParamValNoTmp-DirNotIn"/>
+    <xsl:text>);
+#endif
+</xsl:text>
+    </xsl:if>
+    <xsl:text>
     }
 
     LogRelFlow(("{%p} %s: leave </xsl:text>
     <xsl:apply-templates select="@type" mode="logparamtext">
         <xsl:with-param name="dir" select="'out'"/>
+        <xsl:with-param name="isref" select="''"/>
     </xsl:apply-templates>
     <xsl:text> hrc=%Rhrc\n", this, </xsl:text>
-    <xsl:value-of select="concat('"', $topclass, '::get', $attrbasename, '", ')"/>
+    <xsl:value-of select="concat('"', $topclass, '::get', $dtraceattrname, '", ')"/>
     <xsl:apply-templates select="@type" mode="logparamval">
         <xsl:with-param name="dir" select="'out'"/>
+        <xsl:with-param name="isref" select="''"/>
     </xsl:apply-templates>
     <xsl:text>, hrc));
-    return hrc;
+    return hrc;</xsl:text>
+    <xsl:if test="$attrbasename = 'MidlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>
+#else  /* dummy attribute */
+    return E_FAIL;
+#endif /* dummy attribute */</xsl:text>
+    </xsl:if>
+    <xsl:text>
 }
-
 </xsl:text>
     <xsl:if test="not(@readonly) or @readonly!='yes'">
+        <xsl:text>
+</xsl:text>
         <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::COMSETTER(', $attrbasename, ')(')"/>
-        <xsl:apply-templates select="@type" mode="public">
-            <xsl:with-param name="dir" select="'in'"/>
-        </xsl:apply-templates>
+        <xsl:call-template name="emitPublicParameter">
+            <xsl:with-param name="dir">in</xsl:with-param>
+        </xsl:call-template>
         <!-- @todo check in parameters if possible -->
         <xsl:text>)
 {
     LogRelFlow(("{%p} %s: enter </xsl:text>
         <xsl:apply-templates select="@type" mode="logparamtext">
             <xsl:with-param name="dir" select="'in'"/>
+            <xsl:with-param name="isref" select="''"/>
         </xsl:apply-templates>
         <xsl:text>\n", this, </xsl:text>
         <xsl:value-of select="concat('"', $topclass, '::set', $attrbasename, '", ')"/>
         <xsl:apply-templates select="@type" mode="logparamval">
             <xsl:with-param name="dir" select="'in'"/>
+            <xsl:with-param name="isref" select="''"/>
         </xsl:apply-templates>
         <xsl:text>));
 
@@ -831,7 +1365,32 @@ public:
 
     try
     {
-        AutoCaller autoCaller(this);
+        </xsl:text>
+        <xsl:apply-templates select="@type" mode="paramvalconversion2tmpvar">
+            <xsl:with-param name="dir" select="'in'"/>
+        </xsl:apply-templates>
+        <xsl:text>
+
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+        <xsl:value-of select="translate(concat('VBOXAPI_', $topclass, '_SET_', $dtraceattrname, '_ENTER('), $G_lowerCase, $G_upperCase)"/>
+        <xsl:text>this, </xsl:text>
+        <xsl:call-template name="emitDTraceParamValue">
+            <xsl:with-param name="dir">in</xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>);
+#endif
+
+        </xsl:text>
+        <xsl:choose>
+          <xsl:when test="$limitedAutoCaller = 'true'">
+            <xsl:text>AutoLimitedCaller</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>AutoCaller</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:text> autoCaller(this);
         if (FAILED(autoCaller.rc()))
             throw autoCaller.rc();
 
@@ -840,18 +1399,42 @@ public:
         <xsl:if test="$passAutoCaller = 'true'">
             <xsl:text>autoCaller, </xsl:text>
         </xsl:if>
-        <xsl:apply-templates select="@type" mode="paramvalconversion">
+        <xsl:apply-templates select="@type" mode="paramvalconversionusingtmp">
             <xsl:with-param name="dir" select="'in'"/>
         </xsl:apply-templates>
         <xsl:text>);
+
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+        <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+        <xsl:text>this, hrc, 0 /*normal*/,</xsl:text>
+        <xsl:call-template name="emitDTraceParamValue">
+            <xsl:with-param name="dir">in</xsl:with-param>
+        </xsl:call-template>
+        <xsl:text>);
+#endif
     }
     catch (HRESULT hrc2)
     {
         hrc = hrc2;
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+    <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+    <xsl:text>this, hrc, 1 /*hrc exception*/,</xsl:text>
+    <xsl:call-template name="emitDTraceParamValNoTmp-DirIn"/>
+    <xsl:text>);
+#endif
     }
     catch (...)
     {
         hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+    <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_SET_', $dtraceattrname, '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+    <xsl:text>this, hrc, 9 /*unhandled exception*/,</xsl:text>
+    <xsl:call-template name="emitDTraceParamValNoTmp-DirIn"/>
+    <xsl:text>);
+#endif
     }
 
     LogRelFlow(("{%p} %s: leave hrc=%Rhrc\n", this, </xsl:text>
@@ -859,64 +1442,182 @@ public:
         <xsl:text>hrc));
     return hrc;
 }
+</xsl:text>
+    </xsl:if>
+
+    <xsl:call-template name="emitTargetEnd">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
+
+    <xsl:call-template name="xsltprocNewlineOutputHack"/>
+</xsl:template>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+   Emit DTrace probes for the given attribute.
+  - - - - - - - - - - - - - - - - - - - - - - -->
+<xsl:template match="attribute" mode="dtrace-probes">
+    <xsl:param name="topclass"/>
+    <xsl:param name="dtracetopclass"/>
+    <xsl:param name="target"/>
+
+    <xsl:variable name="dtraceattrname">
+        <xsl:choose>
+            <xsl:when test="@dtracename">
+                <xsl:value-of select="@dtracename"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <!-- attrbasename -->
+                <xsl:call-template name="capitalize">
+                    <xsl:with-param name="str" select="@name"/>
+                </xsl:call-template>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:variable>
 
+    <xsl:if test="@name != 'midlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>    probe </xsl:text>
+        <!-- <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__enter(struct ', $topclass)"/> -->
+        <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__enter(void')"/>
+        <xsl:text> *a_pThis);
+    probe </xsl:text>
+        <!-- <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__return(struct ', $topclass, ' *a_pThis')"/> -->
+        <xsl:value-of select="concat($dtracetopclass, '__get__', $dtraceattrname, '__return(void *a_pThis')"/>
+        <xsl:text>, uint32_t a_hrc, int32_t enmWhy, </xsl:text>
+        <xsl:apply-templates select="@type" mode="dtraceparamdecl">
+            <xsl:with-param name="dir">out</xsl:with-param>
+        </xsl:apply-templates>
+        <xsl:text>);
+</xsl:text>
+    </xsl:if>
+    <xsl:if test="(not(@readonly) or @readonly!='yes') and @name != 'midlDoesNotLikeEmptyInterfaces'">
+        <xsl:text>    probe </xsl:text>
+        <!-- <xsl:value-of select="concat($topclass, '__set__', $dtraceattrname, '__enter(struct ', $topclass, ' *a_pThis, ')"/>-->
+        <xsl:value-of select="concat($topclass, '__set__', $dtraceattrname, '__enter(void *a_pThis, ')"/>
+        <xsl:apply-templates select="@type" mode="dtraceparamdecl">
+            <xsl:with-param name="dir" select="'in'"/>
+        </xsl:apply-templates>
+        <xsl:text>);
+    probe </xsl:text>
+        <!-- <xsl:value-of select="concat($dtracetopclass, '__set__', $dtraceattrname, '__return(struct ', $topclass, ' *a_pThis')"/> -->
+        <xsl:value-of select="concat($dtracetopclass, '__set__', $dtraceattrname, '__return(void *a_pThis')"/>
+        <xsl:text>, uint32_t a_hrc, int32_t enmWhy, </xsl:text>
+        <xsl:apply-templates select="@type" mode="dtraceparamdecl">
+            <xsl:with-param name="dir">in</xsl:with-param>
+        </xsl:apply-templates>
+        <xsl:text>);
 </xsl:text>
     </xsl:if>
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  emit all attributes of an interface
+  Emit all attributes of an interface (current node).
   - - - - - - - - - - - - - - - - - - - - - - -->
 <xsl:template name="emitAttributes">
-    <xsl:param name="iface"/>
     <xsl:param name="topclass"/>
+    <xsl:param name="dtracetopclass"/>
     <xsl:param name="pmode"/>
 
     <!-- first recurse to emit all base interfaces -->
-    <xsl:variable name="extends" select="$iface/@extends"/>
+    <xsl:variable name="extends" select="@extends"/>
     <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
-        <xsl:call-template name="emitAttributes">
-            <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
-            <xsl:with-param name="topclass" select="$topclass"/>
-            <xsl:with-param name="pmode" select="$pmode"/>
-        </xsl:call-template>
+        <xsl:for-each select="key('G_keyInterfacesByName', $extends)">
+            <xsl:call-template name="emitAttributes">
+                <xsl:with-param name="topclass" select="$topclass"/>
+                <xsl:with-param name="pmode" select="$pmode"/>
+                <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+            </xsl:call-template>
+        </xsl:for-each>
     </xsl:if>
 
     <xsl:choose>
         <xsl:when test="$pmode='code'">
             <xsl:text>//
 </xsl:text>
-            <xsl:value-of select="concat('// ', $iface/@name, ' properties')"/>
+            <xsl:value-of select="concat('// ', @name, ' properties')"/>
             <xsl:text>
 //
 
 </xsl:text>
         </xsl:when>
-        <xsl:otherwise>
-            <xsl:value-of select="concat('
    // ', $pmode, ' ', $iface/@name, ' properties
')"/>
-        </xsl:otherwise>
+        <xsl:when test="$pmode != 'dtrace-probes'">
+            <xsl:value-of select="concat($G_sNewLine, '    // ', $pmode, ' ', @name, ' properties', $G_sNewLine)"/>
+        </xsl:when>
     </xsl:choose>
     <xsl:choose>
         <xsl:when test="$pmode='public'">
-            <xsl:apply-templates select="$iface/attribute" mode="public"/>
+            <xsl:apply-templates select="./attribute | ./if" mode="public">
+                <xsl:with-param name="emitmode" select="'attribute'"/>
+            </xsl:apply-templates>
         </xsl:when>
         <xsl:when test="$pmode='wrapped'">
-            <xsl:apply-templates select="$iface/attribute" mode="wrapped"/>
+            <xsl:apply-templates select="./attribute | ./if" mode="wrapped">
+                <xsl:with-param name="emitmode" select="'attribute'"/>
+            </xsl:apply-templates>
         </xsl:when>
         <xsl:when test="$pmode='code'">
-            <xsl:apply-templates select="$iface/attribute" mode="code">
+            <xsl:apply-templates select="./attribute | ./if" mode="code">
                 <xsl:with-param name="topclass" select="$topclass"/>
+                <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                <xsl:with-param name="emitmode" select="'attribute'"/>
             </xsl:apply-templates>
         </xsl:when>
-        <xsl:otherwise/>
+        <xsl:when test="$pmode = 'dtrace-probes'">
+            <xsl:apply-templates select="./attribute | ./if" mode="dtrace-probes">
+                <xsl:with-param name="topclass" select="$topclass"/>
+                <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                <xsl:with-param name="emitmode" select="'attribute'"/>
+            </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise><xsl:message terminate="yes">Otherwise oops in emitAttributes</xsl:message></xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="emitTargetBegin">
+    <xsl:param name="target"/>
+
+    <xsl:choose>
+        <xsl:when test="$target = ''"/>
+        <xsl:when test="$target = 'xpidl'">
+            <xsl:text>#ifdef VBOX_WITH_XPCOM
+</xsl:text>
+        </xsl:when>
+        <xsl:when test="$target = 'midl'">
+            <xsl:text>#ifndef VBOX_WITH_XPCOM
+</xsl:text>
+        </xsl:when>
+        <xsl:otherwise><xsl:message terminate="yes">Otherwise oops in emitTargetBegin: target=<xsl:value-of select="$target"/></xsl:message></xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template name="emitTargetEnd">
+    <xsl:param name="target"/>
+
+    <xsl:choose>
+        <xsl:when test="$target = ''"/>
+        <xsl:when test="$target = 'xpidl'">
+            <xsl:text>#endif /* VBOX_WITH_XPCOM */
+</xsl:text>
+        </xsl:when>
+        <xsl:when test="$target = 'midl'">
+            <xsl:text>#endif /* !VBOX_WITH_XPCOM */
+</xsl:text>
+        </xsl:when>
+        <xsl:otherwise><xsl:message terminate="yes">Otherwise oops in emitTargetEnd target=<xsl:value-of select="$target"/></xsl:message></xsl:otherwise>
     </xsl:choose>
 </xsl:template>
 
+
 <!-- - - - - - - - - - - - - - - - - - - - - - -
   emit method
  - - - - - - - - - - - - - - - - - - - - - - -->
 
 <xsl:template match="method" mode="public">
+    <xsl:param name="target"/>
+
+    <xsl:call-template name="emitTargetBegin">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
+
     <xsl:variable name="methodindent">
       <xsl:call-template name="tospace">
           <xsl:with-param name="str" select="@name"/>
@@ -929,9 +1630,9 @@ public:
     </xsl:call-template>
     <xsl:text>)(</xsl:text>
     <xsl:for-each select="param">
-        <xsl:apply-templates select="@type" mode="public">
+        <xsl:call-template name="emitPublicParameter">
             <xsl:with-param name="dir" select="@dir"/>
-        </xsl:apply-templates>
+        </xsl:call-template>
         <xsl:if test="not(position()=last())">
             <xsl:text>,
                 </xsl:text>
@@ -940,9 +1641,19 @@ public:
     </xsl:for-each>
     <xsl:text>);
 </xsl:text>
+
+    <xsl:call-template name="emitTargetEnd">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="method" mode="wrapped">
+    <xsl:param name="target"/>
+
+    <xsl:call-template name="emitTargetBegin">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
+
     <xsl:variable name="methodindent">
         <xsl:call-template name="tospace">
             <xsl:with-param name="str" select="@name"/>
@@ -980,10 +1691,20 @@ public:
     </xsl:for-each>
     <xsl:text>) = 0;
 </xsl:text>
+
+    <xsl:call-template name="emitTargetEnd">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="method" mode="code">
     <xsl:param name="topclass"/>
+    <xsl:param name="dtracetopclass"/>
+    <xsl:param name="target"/>
+
+    <xsl:call-template name="emitTargetBegin">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
 
     <xsl:variable name="methodindent">
       <xsl:call-template name="tospace">
@@ -1000,12 +1721,33 @@ public:
             <xsl:with-param name="str" select="@name"/>
         </xsl:call-template>
     </xsl:variable>
+    <xsl:variable name="limitedAutoCaller">
+        <xsl:call-template name="checkoption">
+            <xsl:with-param name="optionlist" select="@wrap-hint-server"/>
+            <xsl:with-param name="option" select="'limitedcaller'"/>
+        </xsl:call-template>
+    </xsl:variable>
+    <xsl:variable name="dtracemethodname">
+        <xsl:choose>
+            <xsl:when test="@dtracename">
+                <xsl:value-of select="@dtracename"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="@name"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="dtracenamehack"> <!-- Ugly hack to deal with Session::assignMachine and similar. -->
+        <xsl:if test="name(..) = 'if'">
+            <xsl:value-of select="concat('__', ../@target)"/>
+        </xsl:if>
+    </xsl:variable>
 
     <xsl:value-of select="concat('STDMETHODIMP ', $topclass, 'Wrap::', $methodbasename, '(')"/>
     <xsl:for-each select="param">
-        <xsl:apply-templates select="@type" mode="public">
+        <xsl:call-template name="emitPublicParameter">
             <xsl:with-param name="dir" select="@dir"/>
-        </xsl:apply-templates>
+        </xsl:call-template>
         <xsl:if test="not(position()=last())">
             <xsl:text>,
                     </xsl:text>
@@ -1019,7 +1761,7 @@ public:
         <xsl:text> </xsl:text>
         <xsl:apply-templates select="@type" mode="logparamtext">
             <xsl:with-param name="dir" select="@dir"/>
-            <xsl:with-param name="mod" select="'ref'"/>
+            <xsl:with-param name="isref" select="'yes'"/>
         </xsl:apply-templates>
     </xsl:for-each>
     <xsl:text>\n", this</xsl:text>
@@ -1028,7 +1770,7 @@ public:
         <xsl:text>, </xsl:text>
         <xsl:apply-templates select="@type" mode="logparamval">
             <xsl:with-param name="dir" select="@dir"/>
-            <xsl:with-param name="mod" select="'ref'"/>
+            <xsl:with-param name="isref" select="'yes'"/>
         </xsl:apply-templates>
     </xsl:for-each>
     <xsl:text>));
@@ -1051,8 +1793,39 @@ public:
 </xsl:text>
         </xsl:if>
     </xsl:for-each>
+<xsl:text>
+</xsl:text>
+    <xsl:for-each select="param">
+        <xsl:text>
+        </xsl:text>
+        <xsl:apply-templates select="@type" mode="paramvalconversion2tmpvar">
+            <xsl:with-param name="dir" select="@dir"/>
+        </xsl:apply-templates>
+    </xsl:for-each>
     <xsl:text>
-        AutoCaller autoCaller(this);
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+    <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_ENTER('), $G_lowerCase, $G_upperCase)"/>
+    <xsl:text>this</xsl:text>
+    <xsl:for-each select="param[@dir='in']">
+        <xsl:text>, </xsl:text>
+        <xsl:call-template name="emitDTraceParamValue">
+            <xsl:with-param name="dir" select="@dir"/>
+        </xsl:call-template>
+    </xsl:for-each>
+    <xsl:text>);
+#endif
+
+        </xsl:text>
+    <xsl:choose>
+      <xsl:when test="$limitedAutoCaller = 'true'">
+        <xsl:text>AutoLimitedCaller</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>AutoCaller</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text> autoCaller(this);
         if (FAILED(autoCaller.rc()))
             throw autoCaller.rc();
 
@@ -1073,7 +1846,7 @@ public:
         </xsl:if>
     </xsl:if>
     <xsl:for-each select="param">
-        <xsl:apply-templates select="@type" mode="paramvalconversion">
+        <xsl:apply-templates select="@type" mode="paramvalconversionusingtmp">
             <xsl:with-param name="dir" select="@dir"/>
         </xsl:apply-templates>
         <xsl:if test="not(position()=last())">
@@ -1083,14 +1856,47 @@ public:
         </xsl:if>
     </xsl:for-each>
     <xsl:text>);
+
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+    <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+    <xsl:text>this, hrc, 0 /*normal*/</xsl:text>
+    <xsl:for-each select="param">
+        <xsl:text>, </xsl:text>
+        <xsl:call-template name="emitDTraceParamValue">
+            <xsl:with-param name="dir" select="@dir"/>
+        </xsl:call-template>
+    </xsl:for-each>
+    <xsl:text>);
+#endif
     }
     catch (HRESULT hrc2)
     {
         hrc = hrc2;
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+    <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+    <xsl:text>this, hrc, 1 /*hrc exception*/</xsl:text>
+    <xsl:for-each select="param">
+        <xsl:text>, </xsl:text>
+        <xsl:call-template name="emitDTraceParamValNoTmp"/>
+    </xsl:for-each>
+    <xsl:text>);
+#endif
     }
     catch (...)
     {
         hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        </xsl:text>
+    <xsl:value-of select="translate(concat('VBOXAPI_', $dtracetopclass, '_', $dtracemethodname, substring($dtracenamehack, 2), '_RETURN('), $G_lowerCase, $G_upperCase)"/>
+    <xsl:text>this, hrc, 9 /*unhandled exception*/</xsl:text>
+    <xsl:for-each select="param">
+        <xsl:text>, </xsl:text>
+        <xsl:call-template name="emitDTraceParamValNoTmp"/>
+    </xsl:for-each>
+    <xsl:text>);
+#endif
     }
 
     LogRelFlow(("{%p} %s: leave</xsl:text>
@@ -1099,6 +1905,7 @@ public:
             <xsl:text> </xsl:text>
             <xsl:apply-templates select="@type" mode="logparamtext">
                 <xsl:with-param name="dir" select="@dir"/>
+                <xsl:with-param name="isref" select="''"/>
             </xsl:apply-templates>
         </xsl:if>
     </xsl:for-each>
@@ -1109,58 +1916,261 @@ public:
             <xsl:text>, </xsl:text>
             <xsl:apply-templates select="@type" mode="logparamval">
                 <xsl:with-param name="dir" select="@dir"/>
+                <xsl:with-param name="isref" select="''"/>
             </xsl:apply-templates>
         </xsl:if>
     </xsl:for-each>
     <xsl:text>, hrc));
     return hrc;
 }
+</xsl:text>
+
+    <xsl:call-template name="emitTargetEnd">
+        <xsl:with-param name="target" select="$target"/>
+    </xsl:call-template>
+
+    <xsl:text>
+</xsl:text>
+</xsl:template>
+
+<!--  - - - - - - - - - - - - - - - - - - - - - -
+  Emits the DTrace probes for a method.
+  - - - - - - - - - - - - - - - - - - - - - - -->
+<xsl:template match="method" mode="dtrace-probes">
+    <xsl:param name="topclass"/>
+    <xsl:param name="dtracetopclass"/>
+    <xsl:param name="target"/>
 
+    <xsl:variable name="dtracemethodname">
+        <xsl:choose>
+            <xsl:when test="@dtracename">
+                <xsl:value-of select="@dtracename"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="@name"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="dtracenamehack"> <!-- Ugly hack to deal with Session::assignMachine and similar. -->
+        <xsl:if test="name(..) = 'if'">
+            <xsl:value-of select="concat('__', ../@target)"/>
+        </xsl:if>
+    </xsl:variable>
+
+    <xsl:text>    probe </xsl:text>
+    <!-- <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__enter(struct ', $dtracetopclass, ' *a_pThis')"/> -->
+    <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__enter(void *a_pThis')"/>
+    <xsl:for-each select="param[@dir='in']">
+        <xsl:text>, </xsl:text>
+        <xsl:apply-templates select="@type" mode="dtraceparamdecl">
+            <xsl:with-param name="dir" select="'@dir'"/>
+        </xsl:apply-templates>
+    </xsl:for-each>
+    <xsl:text>);
+    probe </xsl:text>
+    <!-- <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, '__return(struct ', $dtracetopclass, ' *a_pThis')"/> -->
+    <xsl:value-of select="concat($dtracetopclass, '__', $dtracemethodname, $dtracenamehack, '__return(void *a_pThis')"/>
+    <xsl:text>, uint32_t a_hrc, int32_t enmWhy</xsl:text>
+    <xsl:for-each select="param">
+        <xsl:text>, </xsl:text>
+        <xsl:apply-templates select="@type" mode="dtraceparamdecl">
+            <xsl:with-param name="dir" select="'@dir'"/>
+        </xsl:apply-templates>
+    </xsl:for-each>
+    <xsl:text>);
 </xsl:text>
+
+</xsl:template>
+
+
+<xsl:template name="emitIf">
+    <xsl:param name="passmode"/>
+    <xsl:param name="target"/>
+    <xsl:param name="topclass"/>
+    <xsl:param name="emitmode"/>
+    <xsl:param name="dtracetopclass"/>
+
+    <xsl:if test="($target = 'xpidl') or ($target = 'midl')">
+        <xsl:choose>
+            <xsl:when test="$passmode='public'">
+                <xsl:choose>
+                    <xsl:when test="$emitmode='method'">
+                        <xsl:apply-templates select="method" mode="public">
+                            <xsl:with-param name="target" select="$target"/>
+                        </xsl:apply-templates>
+                    </xsl:when>
+                    <xsl:when test="$emitmode='attribute'">
+                        <xsl:apply-templates select="attribute" mode="public">
+                            <xsl:with-param name="target" select="$target"/>
+                        </xsl:apply-templates>
+                    </xsl:when>
+                    <xsl:otherwise/>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$passmode='wrapped'">
+                <xsl:choose>
+                    <xsl:when test="$emitmode='method'">
+                        <xsl:apply-templates select="method" mode="wrapped">
+                            <xsl:with-param name="target" select="$target"/>
+                        </xsl:apply-templates>
+                    </xsl:when>
+                    <xsl:when test="$emitmode='attribute'">
+                        <xsl:apply-templates select="attribute" mode="wrapped">
+                            <xsl:with-param name="target" select="$target"/>
+                        </xsl:apply-templates>
+                    </xsl:when>
+                    <xsl:otherwise/>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$passmode='code'">
+                <xsl:choose>
+                    <xsl:when test="$emitmode='method'">
+                        <xsl:apply-templates select="method" mode="code">
+                            <xsl:with-param name="target" select="$target"/>
+                            <xsl:with-param name="topclass" select="$topclass"/>
+                            <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                        </xsl:apply-templates>
+                    </xsl:when>
+                    <xsl:when test="$emitmode='attribute'">
+                        <xsl:apply-templates select="attribute" mode="code">
+                            <xsl:with-param name="target" select="$target"/>
+                            <xsl:with-param name="topclass" select="$topclass"/>
+                            <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                        </xsl:apply-templates>
+                    </xsl:when>
+                    <xsl:otherwise/>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$passmode = 'dtrace-probes'">
+                <xsl:choose>
+                    <xsl:when test="$emitmode = 'method'">
+                        <xsl:apply-templates select="method" mode="dtrace-probes">
+                            <xsl:with-param name="target" select="$target"/>
+                            <xsl:with-param name="topclass" select="$topclass"/>
+                            <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                        </xsl:apply-templates>
+                    </xsl:when>
+                    <xsl:when test="$emitmode = 'attribute'">
+                        <xsl:apply-templates select="attribute" mode="dtrace-probes">
+                            <xsl:with-param name="target" select="$target"/>
+                            <xsl:with-param name="topclass" select="$topclass"/>
+                            <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                        </xsl:apply-templates>
+                    </xsl:when>
+                    <xsl:otherwise/>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise/>
+        </xsl:choose>
+    </xsl:if>
+</xsl:template>
+
+<xsl:template match="if" mode="public">
+    <xsl:param name="emitmode"/>
+
+    <xsl:call-template name="emitIf">
+        <xsl:with-param name="passmode" select="'public'"/>
+        <xsl:with-param name="target" select="@target"/>
+        <xsl:with-param name="emitmode" select="$emitmode"/>
+    </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="if" mode="wrapped">
+    <xsl:param name="emitmode"/>
+
+    <xsl:call-template name="emitIf">
+        <xsl:with-param name="passmode" select="'wrapped'"/>
+        <xsl:with-param name="target" select="@target"/>
+        <xsl:with-param name="emitmode" select="$emitmode"/>
+    </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="if" mode="code">
+    <xsl:param name="topclass"/>
+    <xsl:param name="emitmode"/>
+    <xsl:param name="dtracetopclass"/>
+
+    <xsl:call-template name="emitIf">
+        <xsl:with-param name="passmode" select="'code'"/>
+        <xsl:with-param name="target" select="@target"/>
+        <xsl:with-param name="emitmode" select="$emitmode"/>
+        <xsl:with-param name="topclass" select="$topclass"/>
+        <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+    </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="if" mode="dtrace-probes">
+    <xsl:param name="topclass"/>
+    <xsl:param name="emitmode"/>
+    <xsl:param name="dtracetopclass"/>
+
+    <xsl:call-template name="emitIf">
+        <xsl:with-param name="passmode" select="'dtrace-probes'"/>
+        <xsl:with-param name="target" select="@target"/>
+        <xsl:with-param name="emitmode" select="$emitmode"/>
+        <xsl:with-param name="topclass" select="$topclass"/>
+        <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+    </xsl:call-template>
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  emit all methods of an interface
+  emit all methods of the current interface
   - - - - - - - - - - - - - - - - - - - - - - -->
 <xsl:template name="emitMethods">
-    <xsl:param name="iface"/>
     <xsl:param name="topclass"/>
     <xsl:param name="pmode"/>
+    <xsl:param name="dtracetopclass"/>
 
     <!-- first recurse to emit all base interfaces -->
-    <xsl:variable name="extends" select="$iface/@extends"/>
+    <xsl:variable name="extends" select="@extends"/>
     <xsl:if test="$extends and not($extends='$unknown') and not($extends='$errorinfo')">
-        <xsl:call-template name="emitMethods">
-            <xsl:with-param name="iface" select="//interface[@name=$extends]"/>
-            <xsl:with-param name="topclass" select="$topclass"/>
-            <xsl:with-param name="pmode" select="$pmode"/>
-        </xsl:call-template>
+        <xsl:for-each select="key('G_keyInterfacesByName', $extends)">
+            <xsl:call-template name="emitMethods">
+                <xsl:with-param name="topclass" select="$topclass"/>
+                <xsl:with-param name="pmode" select="$pmode"/>
+                <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+            </xsl:call-template>
+        </xsl:for-each>
     </xsl:if>
 
     <xsl:choose>
         <xsl:when test="$pmode='code'">
             <xsl:text>//
 </xsl:text>
-            <xsl:value-of select="concat('// ', $iface/@name, ' methods')"/>
+            <xsl:value-of select="concat('// ', @name, ' methods')"/>
             <xsl:text>
 //
 
 </xsl:text>
         </xsl:when>
+        <xsl:when test="$pmode='dtrace-probes'"/>
         <xsl:otherwise>
-            <xsl:value-of select="concat('
    // ', $pmode, ' ', $iface/@name, ' methods
')"/>
+            <xsl:value-of select="concat($G_sNewLine, '    // ', $pmode, ' ', @name, ' methods', $G_sNewLine)"/>
         </xsl:otherwise>
     </xsl:choose>
     <xsl:choose>
         <xsl:when test="$pmode='public'">
-            <xsl:apply-templates select="$iface/method" mode="public"/>
+            <xsl:apply-templates select="./method | ./if" mode="public">
+                <xsl:with-param name="emitmode" select="'method'"/>
+            </xsl:apply-templates>
         </xsl:when>
         <xsl:when test="$pmode='wrapped'">
-            <xsl:apply-templates select="$iface/method" mode="wrapped"/>
+            <xsl:apply-templates select="./method | ./if" mode="wrapped">
+                <xsl:with-param name="emitmode" select="'method'"/>
+            </xsl:apply-templates>
         </xsl:when>
         <xsl:when test="$pmode='code'">
-            <xsl:apply-templates select="$iface/method" mode="code">
+            <xsl:apply-templates select="./method | ./if" mode="code">
                 <xsl:with-param name="topclass" select="$topclass"/>
+                <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                <xsl:with-param name="emitmode" select="'method'"/>
+            </xsl:apply-templates>
+        </xsl:when>
+        <xsl:when test="$pmode='dtrace-probes'">
+            <xsl:apply-templates select="./method | ./if" mode="dtrace-probes">
+                <xsl:with-param name="topclass" select="$topclass"/>
+                <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                <xsl:with-param name="emitmode" select="'method'"/>
             </xsl:apply-templates>
         </xsl:when>
         <xsl:otherwise/>
@@ -1168,164 +2178,242 @@ public:
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  emit all attributes and methods declarations of an interface
+  emit all attributes and methods declarations of the current interface
   - - - - - - - - - - - - - - - - - - - - - - -->
 <xsl:template name="emitInterfaceDecls">
-    <xsl:param name="iface"/>
     <xsl:param name="pmode"/>
 
     <!-- attributes -->
     <xsl:call-template name="emitAttributes">
-        <xsl:with-param name="iface" select="$iface"/>
         <xsl:with-param name="pmode" select="$pmode"/>
     </xsl:call-template>
 
     <!-- methods -->
     <xsl:call-template name="emitMethods">
-        <xsl:with-param name="iface" select="$iface"/>
         <xsl:with-param name="pmode" select="$pmode"/>
     </xsl:call-template>
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  emit auxiliary method declarations of an interface
+  emit auxiliary method declarations of the current interface
   - - - - - - - - - - - - - - - - - - - - - - -->
 <xsl:template name="emitAuxMethodDecls">
-    <xsl:param name="iface"/>
     <!-- currently nothing, maybe later some generic FinalConstruct/... helper declaration for ComObjPtr -->
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  emit the header file of an interface
+  emit the header file of the current interface
   - - - - - - - - - - - - - - - - - - - - - - -->
 <xsl:template name="emitHeader">
-    <xsl:param name="iface"/>
+    <xsl:param name="addinterfaces"/>
 
     <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.h')"/>
 
-    <xsl:choose>
-        <xsl:when test="$filelistonly=''">
-            <xsl:apply-templates select="$iface" mode="startfile">
-                <xsl:with-param name="file" select="$filename"/>
-            </xsl:apply-templates>
-            <xsl:call-template name="fileheader">
-                <xsl:with-param name="name" select="$filename"/>
-                <xsl:with-param name="class" select="substring(@name, 2)"/>
-                <xsl:with-param name="type" select="'header'"/>
-            </xsl:call-template>
-            <xsl:apply-templates select="." mode="classheader"/>
+    <xsl:apply-templates select="." mode="startfile">
+        <xsl:with-param name="file" select="$filename"/>
+    </xsl:apply-templates>
+    <xsl:call-template name="fileheader">
+        <xsl:with-param name="name" select="$filename"/>
+        <xsl:with-param name="class" select="substring(@name, 2)"/>
+        <xsl:with-param name="type" select="'header'"/>
+    </xsl:call-template>
+    <xsl:apply-templates select="." mode="classheader">
+        <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+    </xsl:apply-templates>
 
-            <!-- interface attributes/methods (public) -->
-            <xsl:call-template name="emitInterfaceDecls">
-                <xsl:with-param name="iface" select="$iface"/>
-                <xsl:with-param name="pmode" select="'public'"/>
-            </xsl:call-template>
+    <!-- interface attributes/methods (public) -->
+    <xsl:call-template name="emitInterfaceDecls">
+        <xsl:with-param name="pmode" select="'public'"/>
+    </xsl:call-template>
 
-            <!-- auxiliary methods (public) -->
-            <xsl:call-template name="emitAuxMethodDecls">
-                <xsl:with-param name="iface" select="$iface"/>
-            </xsl:call-template>
+    <xsl:for-each select="exsl:node-set($addinterfaces)/token">
+        <!-- This is super tricky, as the for-each switches to the node set,
+             which means the normal document isn't available any more.  We get
+             the data we need, uses a for-each to switch document and then a
+             key() to look up the interface by name. -->
+        <xsl:variable name="addifname">
+            <xsl:value-of select="string(.)"/>
+        </xsl:variable>
+        <xsl:for-each select="$G_root">
+            <xsl:for-each select="key('G_keyInterfacesByName', $addifname)">
+                <xsl:call-template name="emitInterfaceDecls">
+                    <xsl:with-param name="pmode" select="'public'"/>
+                </xsl:call-template>
+            </xsl:for-each>
+        </xsl:for-each>
+    </xsl:for-each>
 
-            <!-- switch to private -->
-            <xsl:text>
+    <!-- auxiliary methods (public) -->
+    <xsl:call-template name="emitAuxMethodDecls"/>
+
+    <!-- switch to private -->
+    <xsl:text>
 private:</xsl:text>
 
-            <!-- wrapped interface attributes/methods (private) -->
-            <xsl:call-template name="emitInterfaceDecls">
-                <xsl:with-param name="iface" select="$iface"/>
-                <xsl:with-param name="pmode" select="'wrapped'"/>
-            </xsl:call-template>
+    <!-- wrapped interface attributes/methods (private) -->
+    <xsl:call-template name="emitInterfaceDecls">
+        <xsl:with-param name="pmode" select="'wrapped'"/>
+    </xsl:call-template>
 
-            <xsl:apply-templates select="." mode="classfooter"/>
-            <xsl:apply-templates select="$iface" mode="endfile">
-                <xsl:with-param name="file" select="$filename"/>
-            </xsl:apply-templates>
-        </xsl:when>
-        <xsl:otherwise>
-            <xsl:apply-templates select="$iface" mode="listfile">
-                <xsl:with-param name="file" select="$filename"/>
-            </xsl:apply-templates>
-        </xsl:otherwise>
-    </xsl:choose>
+    <xsl:for-each select="exsl:node-set($addinterfaces)/token">
+        <!-- This is super tricky, as the for-each switches to the node set,
+             which means the normal document isn't available any more.  We get
+             the data we need, uses a for-each to switch document and then a
+             key() to look up the interface by name. -->
+        <xsl:variable name="addifname">
+            <xsl:value-of select="string(.)"/>
+        </xsl:variable>
+        <xsl:for-each select="$G_root">
+            <xsl:for-each select="key('G_keyInterfacesByName', $addifname)">
+                <xsl:call-template name="emitInterfaceDecls">
+                    <xsl:with-param name="pmode" select="'wrapped'"/>
+                </xsl:call-template>
+            </xsl:for-each>
+        </xsl:for-each>
+    </xsl:for-each>
+
+    <xsl:apply-templates select="." mode="classfooter"/>
+    <xsl:apply-templates select="." mode="endfile">
+        <xsl:with-param name="file" select="$filename"/>
+    </xsl:apply-templates>
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  emit all attributes and methods definitions of an interface
+  emit all attributes and methods definitions (pmode=code) or probes (pmode=dtrace-probes) of the current interface
   - - - - - - - - - - - - - - - - - - - - - - -->
 <xsl:template name="emitInterfaceDefs">
-    <xsl:param name="iface"/>
+    <xsl:param name="addinterfaces"/>
+    <xsl:param name="pmode" select="'code'"/>
+
+    <xsl:variable name="topclass" select="substring(@name, 2)"/>
+    <xsl:variable name="dtracetopclass">
+        <xsl:choose>
+            <xsl:when test="@dtracename"><xsl:value-of select="@dtracename"/></xsl:when>
+            <xsl:otherwise><xsl:value-of select="$topclass"/></xsl:otherwise>
+        </xsl:choose>
+    </xsl:variable>
 
-    <xsl:value-of select="concat('DEFINE_EMPTY_CTOR_DTOR(', substring($iface/@name, 2), 'Wrap)

')"/>
+    <xsl:if test="$pmode = 'code'">
+        <xsl:value-of select="concat('DEFINE_EMPTY_CTOR_DTOR(', $topclass, 'Wrap)', $G_sNewLine, $G_sNewLine)"/>
+    </xsl:if>
 
     <!-- attributes -->
     <xsl:call-template name="emitAttributes">
-        <xsl:with-param name="iface" select="$iface"/>
-        <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
-        <xsl:with-param name="pmode" select="'code'"/>
+        <xsl:with-param name="topclass" select="$topclass"/>
+        <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+        <xsl:with-param name="pmode" select="$pmode"/>
     </xsl:call-template>
 
+    <xsl:for-each select="exsl:node-set($addinterfaces)/token">
+        <!-- This is super tricky, as the for-each switches to the node set,
+             which means the normal document isn't available any more.  We get
+             the data we need, uses a for-each to switch document and then a
+             key() to look up the interface by name. -->
+        <xsl:variable name="addifname">
+            <xsl:value-of select="string(.)"/>
+        </xsl:variable>
+        <xsl:for-each select="$G_root">
+            <xsl:for-each select="key('G_keyInterfacesByName', $addifname)">
+                <xsl:call-template name="emitAttributes">
+                    <xsl:with-param name="topclass" select="$topclass"/>
+                    <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                    <xsl:with-param name="pmode" select="$pmode"/>
+                </xsl:call-template>
+            </xsl:for-each>
+        </xsl:for-each>
+    </xsl:for-each>
+
     <!-- methods -->
+    <xsl:call-template name="xsltprocNewlineOutputHack"/>
     <xsl:call-template name="emitMethods">
-        <xsl:with-param name="iface" select="$iface"/>
-        <xsl:with-param name="topclass" select="substring($iface/@name, 2)"/>
-        <xsl:with-param name="pmode" select="'code'"/>
+        <xsl:with-param name="topclass" select="$topclass"/>
+        <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+        <xsl:with-param name="pmode" select="$pmode"/>
     </xsl:call-template>
+
+    <xsl:for-each select="exsl:node-set($addinterfaces)/token">
+        <!-- This is super tricky, as the for-each switches to the node set,
+             which means the normal document isn't available any more.  We get
+             the data we need, uses a for-each to switch document and then a
+             key() to look up the interface by name. -->
+        <xsl:variable name="addifname">
+            <xsl:value-of select="string(.)"/>
+        </xsl:variable>
+        <xsl:for-each select="$G_root">
+            <xsl:for-each select="key('G_keyInterfacesByName', $addifname)">
+                <xsl:call-template name="emitMethods">
+                    <xsl:with-param name="topclass" select="$topclass"/>
+                    <xsl:with-param name="dtracetopclass" select="$dtracetopclass"/>
+                    <xsl:with-param name="pmode" select="$pmode"/>
+                </xsl:call-template>
+            </xsl:for-each>
+        </xsl:for-each>
+    </xsl:for-each>
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  emit auxiliary method declarations of an interface
+  emit auxiliary method declarations of the current interface
   - - - - - - - - - - - - - - - - - - - - - - -->
 <xsl:template name="emitAuxMethodDefs">
-    <xsl:param name="iface"/>
+    <xsl:param name="pmode" select="'code'"/>
     <!-- currently nothing, maybe later some generic FinalConstruct/... implementation -->
 </xsl:template>
 
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  emit the code file of an interface
+  emit the code file of the current interface
   - - - - - - - - - - - - - - - - - - - - - - -->
 <xsl:template name="emitCode">
-    <xsl:param name="iface"/>
+    <xsl:param name="addinterfaces"/>
 
     <xsl:variable name="filename" select="concat(substring(@name, 2), 'Wrap.cpp')"/>
 
-    <xsl:choose>
-        <xsl:when test="$filelistonly=''">
-            <xsl:apply-templates select="$iface" mode="startfile">
-                <xsl:with-param name="file" select="$filename"/>
-            </xsl:apply-templates>
-            <xsl:call-template name="fileheader">
-                <xsl:with-param name="name" select="$filename"/>
-                <xsl:with-param name="class" select="substring(@name, 2)"/>
-                <xsl:with-param name="type" select="'code'"/>
-            </xsl:call-template>
-            <xsl:apply-templates select="." mode="codeheader"/>
-
-            <!-- @todo special thread logging for API methods returning IProgress??? would be very usefulcurrently nothing, maybe later some generic FinalConstruct/... implementation -->
+    <xsl:apply-templates select="." mode="startfile">
+        <xsl:with-param name="file" select="$filename"/>
+    </xsl:apply-templates>
+    <xsl:call-template name="fileheader">
+        <xsl:with-param name="name" select="$filename"/>
+        <xsl:with-param name="class" select="substring(@name, 2)"/>
+        <xsl:with-param name="type" select="'code'"/>
+    </xsl:call-template>
+    <xsl:apply-templates select="." mode="codeheader">
+        <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+    </xsl:apply-templates>
 
-            <!-- interface attributes/methods (public) -->
-            <xsl:call-template name="emitInterfaceDefs">
-                <xsl:with-param name="iface" select="$iface"/>
-            </xsl:call-template>
+    <!-- interface attributes/methods (public) -->
+    <xsl:call-template name="emitInterfaceDefs">
+        <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+    </xsl:call-template>
 
-            <!-- auxiliary methods (public) -->
-            <xsl:call-template name="emitAuxMethodDefs">
-                <xsl:with-param name="iface" select="$iface"/>
-            </xsl:call-template>
+    <!-- auxiliary methods (public) -->
+    <xsl:call-template name="emitAuxMethodDefs"/>
 
-            <xsl:apply-templates select="." mode="codefooter"/>
-            <xsl:apply-templates select="$iface" mode="endfile">
-                <xsl:with-param name="file" select="$filename"/>
-            </xsl:apply-templates>
-        </xsl:when>
-        <xsl:otherwise>
-            <xsl:apply-templates select="$iface" mode="listfile">
-                <xsl:with-param name="file" select="$filename"/>
-            </xsl:apply-templates>
-        </xsl:otherwise>
-    </xsl:choose>
+    <xsl:apply-templates select="." mode="codefooter">
+        <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+    </xsl:apply-templates>
+    <xsl:apply-templates select="." mode="endfile">
+        <xsl:with-param name="file" select="$filename"/>
+    </xsl:apply-templates>
 </xsl:template>
 
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  emit the DTrace probes for the current interface
+  - - - - - - - - - - - - - - - - - - - - - - -->
+<xsl:template name="emitDTraceProbes">
+    <xsl:param name="addinterfaces"/>
+
+    <!-- interface attributes/methods (public) -->
+    <xsl:call-template name="emitInterfaceDefs">
+        <xsl:with-param name="addinterfaces" select="$addinterfaces"/>
+        <xsl:with-param name="pmode">dtrace-probes</xsl:with-param>
+    </xsl:call-template>
+
+    <!-- auxiliary methods (public) -->
+    <xsl:call-template name="emitAuxMethodDefs">
+        <xsl:with-param name="pmode">dtrace-probes</xsl:with-param>
+    </xsl:call-template>
+
+</xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
   wildcard match, ignore everything which has no explicit match
@@ -1344,18 +2432,12 @@ private:</xsl:text>
 </xsl:template>
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
-  library match
+  interface match
  - - - - - - - - - - - - - - - - - - - - - - -->
 
 <xsl:template match="interface">
-    <xsl:if test="not(@supportsErrorInfo='no')">
-        <xsl:call-template name="emitHeader">
-            <xsl:with-param name="iface" select="."/>
-        </xsl:call-template>
-
-        <xsl:call-template name="emitCode">
-            <xsl:with-param name="iface" select="."/>
-        </xsl:call-template>
+    <xsl:if test="not(@internal='yes') and not(@supportsErrorInfo='no')">
+        <xsl:call-template name="emitInterface"/>
     </xsl:if>
 </xsl:template>
 
@@ -1373,19 +2455,19 @@ private:</xsl:text>
 
 <xsl:template match="/idl">
     <xsl:choose>
-        <xsl:when test="$filelistonly=''">
+        <xsl:when test="$generating = 'headers'">
+            <xsl:apply-templates/>
         </xsl:when>
-        <xsl:otherwise>
-            <xsl:value-of select="concat($filelistonly, ' := \
')"/>
-        </xsl:otherwise>
-    </xsl:choose>
-    <xsl:apply-templates/>
-    <xsl:choose>
-        <xsl:when test="$filelistonly=''">
+        <xsl:when test="$generating = 'sources'">
+            <xsl:apply-templates/>
+        </xsl:when>
+        <xsl:when test="$generating = 'dtrace-probes'">
+            <xsl:apply-templates/>
         </xsl:when>
         <xsl:otherwise>
-            <xsl:text>
-</xsl:text>
+            <xsl:message terminate="yes">
+                Unknown string parameter value: generating='<xsl:value-of select="$generating"/>'
+            </xsl:message>
         </xsl:otherwise>
     </xsl:choose>
 </xsl:template>
diff --git a/src/VBox/Main/idl/comimpl.xsl b/src/VBox/Main/idl/comimpl.xsl
index 59ae42b..6d4c67d 100644
--- a/src/VBox/Main/idl/comimpl.xsl
+++ b/src/VBox/Main/idl/comimpl.xsl
@@ -13,7 +13,7 @@
         rather trivial container classes for their read-only attributes.
         Further extension to other interfaces is possible and anticipated.
 
-    Copyright (C) 2010-2013 Oracle Corporation
+    Copyright (C) 2010-2014 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -35,6 +35,17 @@
 <!-- $G_kind contains what kind of COM class implementation we generate -->
 <xsl:variable name="G_xsltFilename" select="'autogen.xsl'" />
 
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  Keys for more efficiently looking up of types.
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
 <xsl:template name="fileheader">
   <xsl:param name="name" />
   <xsl:text>/** @file </xsl:text>
@@ -46,7 +57,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -63,7 +74,7 @@
 <xsl:template name="genComEntry">
   <xsl:param name="name" />
   <xsl:variable name="extends">
-    <xsl:value-of select="//interface[@name=$name]/@extends" />
+    <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
   </xsl:variable>
 
   <xsl:value-of select="concat('        COM_INTERFACE_ENTRY(', $name, ')
')" />
@@ -71,7 +82,7 @@
     <xsl:when test="$extends='$unknown'">
       <!-- Reached base -->
     </xsl:when>
-    <xsl:when test="//interface[@name=$extends]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
       <xsl:call-template name="genComEntry">
         <xsl:with-param name="name" select="$extends" />
       </xsl:call-template>
@@ -130,10 +141,10 @@
             </xsl:otherwise>
           </xsl:choose>
         </xsl:when>
-        <xsl:when test="//enum[@name=$type]">
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
           <xsl:value-of select="concat($type,'_T')"/>
         </xsl:when>
-        <xsl:when test="//interface[@name=$type]">
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
           <xsl:choose>
             <xsl:when test="$param">
               <xsl:value-of select="concat($type,'*')"/>
@@ -232,7 +243,7 @@
         <xsl:when test="($type='wstring') or ($type = 'uuid')">
           <xsl:value-of select="concat('         ', $member, '.cloneTo(', $param, ');
')"/>
         </xsl:when>
-        <xsl:when test="//interface[@name=$type]">
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
           <xsl:value-of select="concat('         ', $member, '.queryInterfaceTo(', $param, ');
')"/>
         </xsl:when>
         <xsl:otherwise>
@@ -247,7 +258,7 @@
   <xsl:param name="name" />
   <xsl:param name="obj" />
   <xsl:variable name="extends">
-    <xsl:value-of select="//interface[@name=$name]/@extends" />
+    <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
   </xsl:variable>
 
   <xsl:choose>
@@ -255,7 +266,7 @@
     </xsl:when>
     <xsl:when test="$extends='IReusableEvent'">
     </xsl:when>
-    <xsl:when test="//interface[@name=$extends]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
       <xsl:call-template name="genAttrInitCode">
         <xsl:with-param name="name" select="$extends" />
         <xsl:with-param name="obj" select="$obj" />
@@ -268,7 +279,7 @@
     </xsl:otherwise>
   </xsl:choose>
 
-  <xsl:for-each select="//interface[@name=$name]/attribute">
+  <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
     <xsl:variable name="aName" select="concat('a_', at name)"/>
     <xsl:variable name="aTypeName">
       <xsl:call-template name="typeIdl2Back">
@@ -323,7 +334,7 @@
   <xsl:param name="parents" />
 
   <xsl:variable name="extends">
-    <xsl:value-of select="//interface[@name=$name]/@extends" />
+    <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
   </xsl:variable>
 
   <xsl:choose>
@@ -333,7 +344,7 @@
       <xsl:value-of select="concat('NS_IMPL_THREADSAFE_ISUPPORTS',$depth,'_CI(', $impl, $parents, ', IEvent)
')" />
       <xsl:value-of select="       '#endif

'"/>
     </xsl:when>
-    <xsl:when test="//interface[@name=$extends]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
       <xsl:call-template name="genImplList">
         <xsl:with-param name="impl" select="$impl" />
         <xsl:with-param name="name" select="$extends" />
@@ -355,10 +366,10 @@
   <xsl:param name="parents" />
 
   <xsl:variable name="extends">
-    <xsl:value-of select="//interface[@name=$name]/@extends" />
+    <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
   </xsl:variable>
 
-  <xsl:for-each select="//interface[@name=$name]/attribute">
+  <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute">
     <xsl:variable name="mName">
       <xsl:value-of select="concat('m_', @name)" />
     </xsl:variable>
@@ -448,7 +459,7 @@
      <xsl:when test="$extends='IVetoEvent'">
       <xsl:value-of select="   '    // skipping IVetoEvent attributes 
'" />
     </xsl:when>
-    <xsl:when test="//interface[@name=$extends]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
       <xsl:call-template name="genAttrCode">
         <xsl:with-param name="name" select="$extends" />
         <xsl:with-param name="depth" select="$depth+1" />
@@ -495,25 +506,25 @@
         mEvent->FinalRelease();
         BaseFinalRelease();
     }
-    STDMETHOD(COMGETTER(Type)) (VBoxEventType_T *aType)
+    STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType)
     {
-        return ((VBoxEvent*)mEvent)->COMGETTER(Type) (aType);
+        return mEvent->COMGETTER(Type)(aType);
     }
-    STDMETHOD(COMGETTER(Source)) (IEventSource * *aSource)
+    STDMETHOD(COMGETTER(Source))(IEventSource * *aSource)
     {
-        return ((VBoxEvent*)mEvent)->COMGETTER(Source) (aSource);
+        return mEvent->COMGETTER(Source)(aSource);
     }
-    STDMETHOD(COMGETTER(Waitable)) (BOOL *aWaitable)
+    STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable)
     {
-        return ((VBoxEvent*)mEvent)->COMGETTER(Waitable) (aWaitable);
+        return mEvent->COMGETTER(Waitable)(aWaitable);
     }
     STDMETHOD(SetProcessed)()
     {
-       return ((VBoxEvent*)mEvent)->SetProcessed();
+       return mEvent->SetProcessed();
     }
     STDMETHOD(WaitProcessed)(LONG aTimeout, BOOL *aResult)
     {
-        return ((VBoxEvent*)mEvent)->WaitProcessed(aTimeout, aResult);
+        return mEvent->WaitProcessed(aTimeout, aResult);
     }
     void uninit()
     {
@@ -544,6 +555,18 @@
     {
        return mEvent->GetVetos(ComSafeArrayOutArg(aVetos));
     }
+    STDMETHOD(AddApproval)(IN_BSTR aReason)
+    {
+        return mEvent->AddApproval(aReason);
+    }
+    STDMETHOD(IsApproved)(BOOL *aResult)
+    {
+       return mEvent->IsApproved(aResult);
+    }
+    STDMETHOD(GetApprovals)(ComSafeArrayOut(BSTR, aReasons))
+    {
+       return mEvent->GetApprovals(ComSafeArrayOutArg(aReasons));
+    }
 private:
     ComObjPtr<VBoxVetoEvent>      mEvent;
 ]]></xsl:text>
@@ -556,12 +579,12 @@ private:
         mGeneration = 1;
         return mEvent->init(aSource, aType, aWaitable);
     }
-    STDMETHOD(COMGETTER(Generation)) (ULONG *aGeneration)
+    STDMETHOD(COMGETTER(Generation))(ULONG *aGeneration)
     {
       *aGeneration = mGeneration;
       return S_OK;
     }
-    STDMETHOD(Reuse) ()
+    STDMETHOD(Reuse)()
     {
        ASMAtomicIncU32((volatile uint32_t*)&mGeneration);
        return S_OK;
@@ -582,6 +605,14 @@ private:
 ]]></xsl:text>
     </xsl:otherwise>
   </xsl:choose>
+
+  <!-- Before we generate attribute code, we check and make sure there are attributes here. -->
+  <xsl:if test="count(attribute) = 0 and @name != 'INATNetworkAlterEvent'">
+    <xsl:call-template name="fatalError">
+      <xsl:with-param name="msg">error: <xsl:value-of select="@name"/> has no attributes</xsl:with-param>
+    </xsl:call-template>
+  </xsl:if>
+
   <xsl:call-template name="genAttrCode">
     <xsl:with-param name="name" select="@name" />
   </xsl:call-template>
@@ -652,7 +683,8 @@ private:
 
   <!-- Interfaces -->
   <xsl:for-each select="//interface[@autogen=$G_kind]">
-    <xsl:value-of select="concat('// ', @name,  ' implementation code 
')" />
+    <xsl:value-of select="concat('// ', @name,  ' implementation code')" />
+    <xsl:call-template name="xsltprocNewlineOutputHack"/>
     <xsl:variable name="implName">
       <xsl:value-of select="substring(@name, 2)" />
     </xsl:variable>
@@ -679,7 +711,7 @@ private:
   </xsl:for-each>
 
   <xsl:text><![CDATA[
-HRESULT VBoxEventDesc::init(IEventSource* aSource, VBoxEventType_T aType, ...)
+HRESULT VBoxEventDesc::init(IEventSource *aSource, VBoxEventType_T aType, ...)
 {
     va_list args;
 
@@ -746,7 +778,7 @@ HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...)
 <xsl:template name="genFormalParams">
   <xsl:param name="name" />
   <xsl:variable name="extends">
-    <xsl:value-of select="//interface[@name=$name]/@extends" />
+    <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
   </xsl:variable>
 
   <xsl:choose>
@@ -754,7 +786,7 @@ HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...)
     </xsl:when>
     <xsl:when test="$extends='IReusableEvent'">
     </xsl:when>
-    <xsl:when test="//interface[@name=$extends]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
       <xsl:call-template name="genFormalParams">
         <xsl:with-param name="name" select="$extends" />
       </xsl:call-template>
@@ -766,7 +798,7 @@ HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...)
     </xsl:otherwise>
   </xsl:choose>
 
-  <xsl:for-each select="//interface[@name=$name]/attribute">
+  <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
     <xsl:variable name="aName" select="concat('a_', at name)"/>
     <xsl:variable name="aTypeName">
       <xsl:call-template name="typeIdl2Back">
@@ -784,7 +816,7 @@ HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...)
 <xsl:template name="genFactParams">
   <xsl:param name="name" />
   <xsl:variable name="extends">
-    <xsl:value-of select="//interface[@name=$name]/@extends" />
+    <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" />
   </xsl:variable>
 
   <xsl:choose>
@@ -792,7 +824,7 @@ HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...)
     </xsl:when>
     <xsl:when test="$extends='IReusableEvent'">
     </xsl:when>
-    <xsl:when test="//interface[@name=$extends]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
       <xsl:call-template name="genFactParams">
         <xsl:with-param name="name" select="$extends" />
       </xsl:call-template>
@@ -804,7 +836,7 @@ HRESULT VBoxEventDesc::reinit(VBoxEventType_T aType, ...)
     </xsl:otherwise>
   </xsl:choose>
 
-  <xsl:for-each select="//interface[@name=$name]/attribute">
+  <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[@name != 'midlDoesNotLikeEmptyInterfaces']">
     <xsl:variable name="aName" select="concat('a_', at name)"/>
     <xsl:choose>
       <xsl:when test="@safearray='yes'">
diff --git a/src/VBox/Main/idl/doxygen.xsl b/src/VBox/Main/idl/doxygen.xsl
index df12cd2..f7e1c72 100644
--- a/src/VBox/Main/idl/doxygen.xsl
+++ b/src/VBox/Main/idl/doxygen.xsl
@@ -21,42 +21,7 @@
 
 <xsl:strip-space elements="*"/>
 
-
-<!--
-//  helper definitions
-/////////////////////////////////////////////////////////////////////////////
--->
-
-<!--
- *  uncapitalizes the first letter only if the second one is not capital
- *  otherwise leaves the string unchanged
--->
-<xsl:template name="uncapitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:choose>
-    <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
-      <xsl:value-of select="
-        concat(
-          translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
-          substring($str,2)
-        )
-      "/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:value-of select="string($str)"/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<!--
- *  translates the string to uppercase
--->
-<xsl:template name="uppercase">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
-  "/>
-</xsl:template>
+<xsl:include href="typemap-shared.inc.xsl" />
 
 
 <!--
@@ -83,6 +48,39 @@
 </xsl:template>
 
 <!--
+ * same like desc//* but place <ol> at start of line otherwise Doxygen will not
+ * find it
+-->
+<xsl:template match="desc//ol">
+  <xsl:text>&#x0A;</xsl:text>
+  <xsl:copy>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<!--
+ * same like desc//* but place <ul> at start of line otherwise Doxygen will not
+ * find it
+-->
+<xsl:template match="desc//ul">
+  <xsl:text>&#x0A;</xsl:text>
+  <xsl:copy>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<!--
+ * same like desc//* but place <pre> at start of line otherwise Doxygen will not
+ * find it
+-->
+<xsl:template match="desc//pre">
+  <xsl:text>&#x0A;</xsl:text>
+  <xsl:copy>
+    <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<!--
  *  paragraph
 -->
 <xsl:template match="desc//p">
@@ -204,7 +202,7 @@
 <xsl:template match="desc" mode="results">
   <xsl:if test="result">
     <xsl:text>
-      @par Expected result codes:
+ at par Expected result codes:
     </xsl:text>
       <table>
     <xsl:for-each select="result">
@@ -236,7 +234,7 @@
   <xsl:apply-templates select="." mode="begin"/>
   <xsl:apply-templates select="." mode="middle"/>
 @par Interface ID:
-<tt>{<xsl:call-template name="uppercase">
+<tt>{<xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="../@uuid"/>
   </xsl:call-template>}</tt>
   <xsl:text>&#x0A;*/&#x0A;</xsl:text>
@@ -304,7 +302,7 @@ owns the object will most likely fail or crash your application.
   <xsl:apply-templates select="." mode="begin"/>
   <xsl:apply-templates select="." mode="middle"/>
 @par Interface ID:
-<tt>{<xsl:call-template name="uppercase">
+<tt>{<xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="../@uuid"/>
   </xsl:call-template>}</tt>
   <xsl:text>&#x0A;*/&#x0A;</xsl:text>
diff --git a/src/VBox/Main/idl/midl.xsl b/src/VBox/Main/idl/midl.xsl
index 5ee2c30..5e20c76 100644
--- a/src/VBox/Main/idl/midl.xsl
+++ b/src/VBox/Main/idl/midl.xsl
@@ -21,45 +21,10 @@
 
 <xsl:strip-space elements="*"/>
 
+<!-- Whether to generate proxy code and type library ('yes'), or just the type-library. -->
+<xsl:param name="g_fGenProxy" select="'no'"/>
 
-<!--
-//  helper definitions
-/////////////////////////////////////////////////////////////////////////////
--->
-
-<!--
- *  capitalizes the first letter
--->
-<xsl:template name="capitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    concat(
-      translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
-      substring($str,2)
-    )
-  "/>
-</xsl:template>
-
-<!--
- *  uncapitalizes the first letter only if the second one is not capital
- *  otherwise leaves the string unchanged
--->
-<xsl:template name="uncapitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:choose>
-    <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
-      <xsl:value-of select="
-        concat(
-          translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
-          substring($str,2)
-        )
-      "/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:value-of select="string($str)"/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
+<xsl:include href="typemap-shared.inc.xsl"/>
 
 
 <!--
@@ -143,7 +108,22 @@
 <!--
  *  libraries
 -->
-<xsl:template match="library">[
+<xsl:template match="library">
+  <xsl:if test="$g_fGenProxy = 'yes'">
+    <!-- Declare everything outside the library and then reference these
+         from inside the library statement.  See:
+         http://msdn.microsoft.com/en-us/library/windows/desktop/aa366841(v=vs.85).aspx -->
+    <xsl:text>&#x0A;</xsl:text>
+    <!-- forward declarations -->
+    <xsl:apply-templates select="if | interface" mode="forward"/>
+    <xsl:text>&#x0A;</xsl:text>
+    <!-- all enums go first -->
+    <xsl:apply-templates select="enum | if/enum"/>
+    <!-- declare the interfaces -->
+    <xsl:apply-templates select="if | interface"/>
+  </xsl:if>
+
+[
     uuid(<xsl:value-of select="@uuid"/>),
     version(<xsl:value-of select="@version"/>),
     helpstring("<xsl:value-of select="@desc"/>")
@@ -157,14 +137,25 @@
     <xsl:apply-templates select="."/>
   </xsl:for-each>
   <xsl:text>&#x0A;</xsl:text>
-  <!-- forward declarations -->
-  <xsl:apply-templates select="if | interface" mode="forward"/>
   <xsl:text>&#x0A;</xsl:text>
-  <!-- all enums go first -->
-  <xsl:apply-templates select="enum | if/enum"/>
-  <!-- everything else but result codes and enums -->
-  <xsl:apply-templates select="*[not(self::result or self::enum) and
-                                 not(self::if[result] or self::if[enum])]"/>
+  <xsl:choose>
+    <xsl:when test="$g_fGenProxy = 'yes'">
+      <!-- reference enums and interfaces -->
+      <xsl:apply-templates select="if | interface" mode="forward"/>
+      <xsl:apply-templates select="enum | if/enum" mode="forward"/>
+      <!-- the modules (i.e. everything else) -->
+      <xsl:apply-templates select="module | if/module"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- forward declarations -->
+      <xsl:apply-templates select="if | interface" mode="forward"/>
+      <!-- all enums go first -->
+      <xsl:apply-templates select="enum | if/enum"/>
+      <!-- everything else but result codes and enums -->
+      <xsl:apply-templates select="*[not(self::result or self::enum) and
+                                     not(self::if[result] or self::if[enum])]"/>
+    </xsl:otherwise>
+  </xsl:choose>
   <!-- -->
   <xsl:text>}; /* library </xsl:text>
   <xsl:value-of select="@name"/>
@@ -192,6 +183,13 @@
 </xsl:template>
 
 
+<xsl:template match="enum" mode="forward">
+  <xsl:text>enum </xsl:text>
+  <xsl:value-of select="@name"/>
+  <xsl:text>;&#x0A;&#x0A;</xsl:text>
+</xsl:template>
+
+
 <!--
  *  interfaces
 -->
@@ -207,9 +205,13 @@
   <xsl:choose>
     <xsl:when test="@extends='$unknown'">IDispatch</xsl:when>
     <xsl:when test="@extends='$errorinfo'">IErrorInfo</xsl:when>
+    <!-- TODO/FIXME/BUGBUG: The above $errorinfo value causes the following warning (/W4):
+warning MIDL2460 : dual interface should be derived from IDispatch : IVirtualBoxErrorInfo [ Interface 'IVirtualBoxErrorInfo'  ]
+    -->
     <xsl:otherwise><xsl:value-of select="@extends"/></xsl:otherwise>
   </xsl:choose>
-  <xsl:text>&#x0A;{&#x0A;</xsl:text>
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
+  <xsl:text>{&#x0A;</xsl:text>
   <!-- attributes (properties) -->
   <xsl:apply-templates select="attribute"/>
   <!-- methods -->
diff --git a/src/VBox/Main/idl/typemap-shared.inc.xsl b/src/VBox/Main/idl/typemap-shared.inc.xsl
index 845f8fa..0a4252e 100644
--- a/src/VBox/Main/idl/typemap-shared.inc.xsl
+++ b/src/VBox/Main/idl/typemap-shared.inc.xsl
@@ -28,6 +28,13 @@
 
 <xsl:variable name="G_lowerCase" select="'abcdefghijklmnopqrstuvwxyz'" />
 <xsl:variable name="G_upperCase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
+<xsl:variable name="G_sNewLine">
+  <xsl:text>
+</xsl:text>
+</xsl:variable>
+
+<!-- List of white space characters that the strip functions will remove -->
+<xsl:variable name="G_sWhiteSpace" select="' 

	'"/>
 
 <!-- target namespace; this must match the xmlns:vbox in stylesheet opening tags! -->
 <xsl:variable name="G_targetNamespace"
@@ -162,19 +169,19 @@
               select='"StructCom2Soap_"' />
 
 <xsl:variable name="G_aSharedTypes">
-  <type idlname="octet"              xmlname="unsignedByte"  cname="unsigned char"    gluename="BYTE"    gluefmt="%RU8"      javaname="byte" />
-  <type idlname="boolean"            xmlname="boolean"       cname="bool"             gluename="BOOL"    gluefmt="%RTbool"   javaname="Boolean" />
-  <type idlname="short"              xmlname="short"         cname="short"            gluename="SHORT"   gluefmt="%RI16"     javaname="Short" />
-  <type idlname="unsigned short"     xmlname="unsignedShort" cname="unsigned short"   gluename="USHORT"  gluefmt="%RU16"     javaname="Integer" />
-  <type idlname="long"               xmlname="int"           cname="int"              gluename="LONG"    gluefmt="%RI32"     javaname="Integer" />
-  <type idlname="unsigned long"      xmlname="unsignedInt"   cname="unsigned int"     gluename="ULONG"   gluefmt="%RU32"     javaname="Long" />
-  <type idlname="long long"          xmlname="long"          cname="LONG64"           gluename="LONG64"  gluefmt="%RI64"     javaname="Long" />
-  <type idlname="unsigned long long" xmlname="unsignedLong"  cname="ULONG64"          gluename="ULONG64" gluefmt="%RU64"     javaname="BigInteger" />
-  <type idlname="double"             xmlname="double"        cname="double"           gluename="DOUBLE"  gluefmt="%#RX64"    javaname="Double" />
-  <type idlname="float"              xmlname="float"         cname="float"            gluename="FLOAT"   gluefmt="%#RX32"    javaname="Float" />
-  <type idlname="wstring"            xmlname="string"        cname="std::string"      gluename="BSTR"    gluefmt="%ls"       javaname="String" />
-  <type idlname="uuid"               xmlname="string"        cname="std::string"      gluename="BSTR"    gluefmt="%ls"       javaname="String" />
-  <type idlname="result"             xmlname="unsignedInt"   cname="unsigned int"     gluename="HRESULT" gluefmt="%Rhrc"     javaname="Long" />
+  <type idlname="octet"              xmlname="unsignedByte"  cname="unsigned char"    gluename="BYTE"    gluefmt="%RU8"      javaname="byte"       dtracename="uint8_t"     />
+  <type idlname="boolean"            xmlname="boolean"       cname="bool"             gluename="BOOL"    gluefmt="%RTbool"   javaname="Boolean"    dtracename="int8_t"      />
+  <type idlname="short"              xmlname="short"         cname="short"            gluename="SHORT"   gluefmt="%RI16"     javaname="Short"      dtracename="int16_t"     />
+  <type idlname="unsigned short"     xmlname="unsignedShort" cname="unsigned short"   gluename="USHORT"  gluefmt="%RU16"     javaname="Integer"    dtracename="uint16_t"    />
+  <type idlname="long"               xmlname="int"           cname="int"              gluename="LONG"    gluefmt="%RI32"     javaname="Integer"    dtracename="int32_t"     />
+  <type idlname="unsigned long"      xmlname="unsignedInt"   cname="unsigned int"     gluename="ULONG"   gluefmt="%RU32"     javaname="Long"       dtracename="uint32_t"    />
+  <type idlname="long long"          xmlname="long"          cname="LONG64"           gluename="LONG64"  gluefmt="%RI64"     javaname="Long"       dtracename="int64_t"     />
+  <type idlname="unsigned long long" xmlname="unsignedLong"  cname="ULONG64"          gluename="ULONG64" gluefmt="%RU64"     javaname="BigInteger" dtracename="uint64_t"    />
+  <type idlname="double"             xmlname="double"        cname="double"           gluename="DOUBLE"  gluefmt="%#RX64"    javaname="Double"     dtracename="double"      />
+  <type idlname="float"              xmlname="float"         cname="float"            gluename="FLOAT"   gluefmt="%#RX32"    javaname="Float"      dtracename="float"       />
+  <type idlname="wstring"            xmlname="string"        cname="std::string"      gluename="BSTR"    gluefmt="%ls"       javaname="String"     dtracename="const char *"/>
+  <type idlname="uuid"               xmlname="string"        cname="std::string"      gluename="BSTR"    gluefmt="%ls"       javaname="String"     dtracename="const char *"/>
+  <type idlname="result"             xmlname="unsignedInt"   cname="unsigned int"     gluename="HRESULT" gluefmt="%Rhrc"     javaname="Long"       dtracename="int32_t"     />
 </xsl:variable>
 
 <!--
@@ -357,4 +364,197 @@
   </xsl:if>
 </xsl:template>
 
+<!--
+     xsltprocNewlineOutputHack - emits a single new line.
+
+     Hack Alert! This template helps xsltproc split up the output text elements
+                 and avoid reallocating them into the MB range. Calls to this
+                 template is made occationally while generating larger output
+                 file.  It's not necessary for small stuff like header.
+
+                 The trick we're playing on xsltproc has to do with CDATA
+                 and/or the escape setting of the xsl:text element.  It forces
+                 xsltproc to allocate a new output element, thus preventing
+                 things from growing out of proportions and slowing us down.
+
+                 This was successfully employed to reduce a 18+ seconds run to
+                 around one second (possibly less due to kmk overhead).
+ -->
+<xsl:template name="xsltprocNewlineOutputHack">
+    <xsl:text disable-output-escaping="yes"><![CDATA[
+]]></xsl:text>
+</xsl:template>
+
+
+<!--
+    string-to-upper - translates the string to uppercase.
+    -->
+<xsl:template name="string-to-upper">
+  <xsl:param name="str" select="."/>
+  <xsl:value-of select="translate($str, $G_lowerCase, $G_upperCase)"/>
+</xsl:template>
+
+<!--
+    string-to-lower - translates the string to lowercase.
+    -->
+<xsl:template name="string-to-lower">
+  <xsl:param name="str" select="."/>
+  <xsl:value-of select="translate($str, $G_upperCase, $G_lowerCase)"/>
+</xsl:template>
+
+<!--
+    string-replace - Replace all occurencees of needle in haystack.
+    -->
+<xsl:template name="string-replace">
+  <xsl:param name="haystack"/>
+  <xsl:param name="needle"/>
+  <xsl:param name="replacement"/>
+  <xsl:param name="onlyfirst" select="false"/>
+  <xsl:choose>
+    <xsl:when test="contains($haystack, $needle)">
+      <xsl:value-of select="substring-before($haystack, $needle)"/>
+      <xsl:value-of select="$replacement"/>
+      <xsl:call-template name="string-replace">
+        <xsl:with-param name="haystack" select="substring-after($haystack, $needle)"/>
+        <xsl:with-param name="needle" select="$needle"/>
+        <xsl:with-param name="replacement" select="$replacement"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$haystack"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!--
+    string-replace-first - Replace the _first_ occurence of needle in haystack.
+    -->
+<xsl:template name="string-replace-first">
+  <xsl:param name="haystack"/>
+  <xsl:param name="needle"/>
+  <xsl:param name="replacement"/>
+  <xsl:choose>
+    <xsl:when test="contains($haystack, $needle)">
+      <xsl:value-of select="substring-before($haystack, $needle)"/>
+      <xsl:value-of select="$replacement"/>
+      <xsl:value-of select="substring-after($haystack, $needle)"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="$haystack"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!--
+    strip-string-right - String trailing white space from a string.
+    -->
+<xsl:template name="strip-string-right">
+  <xsl:param name="text"/>
+
+  <!-- Check for trailing whitespace. -->
+  <xsl:choose>
+    <xsl:when test="contains($G_sWhiteSpace, substring($text, string-length($text), 1))">
+      <xsl:call-template name="strip-string-right">
+        <xsl:with-param name="text" select="substring($text, 1, string-length($text) - 1)"/>
+      </xsl:call-template>
+    </xsl:when>
+
+    <!-- No trailing white space. Return the string. -->
+    <xsl:otherwise>
+      <xsl:value-of select="$text"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!--
+    strip-string-left - String leading white space from a string.
+    -->
+<xsl:template name="strip-string-left">
+  <xsl:param name="text"/>
+
+  <!-- Check for leading white space.  To optimize for speed, we check a couple
+       of longer space sequences first. -->
+  <xsl:choose>
+    <xsl:when test="starts-with($text, '        ')">  <!-- 8 leading spaces -->
+      <xsl:call-template name="strip-string-left">
+        <xsl:with-param name="text" select="substring($text, 9)"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="starts-with($text, '    ')">      <!-- 4 leading spaces -->
+      <xsl:call-template name="strip-string-left">
+        <xsl:with-param name="text" select="substring($text, 5)"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="starts-with($text, '  ')">        <!-- 2 leading spaces -->
+      <xsl:call-template name="strip-string-left">
+        <xsl:with-param name="text" select="substring($text, 3)"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="contains($G_sWhiteSpace, substring($text, 1, 1))">
+      <xsl:if test="string-length($text) > 0">
+        <xsl:call-template name="strip-string">
+          <xsl:with-param name="text" select="substring($text, 2)"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:when>
+
+    <!-- No leading white space. Return the string. -->
+    <xsl:otherwise>
+      <xsl:value-of select="$text"/>
+    </xsl:otherwise>
+  </xsl:choose>
+
+</xsl:template>
+
+<!--
+    strip-string - String leading and trailing white space from a string.
+    -->
+<xsl:template name="strip-string">
+  <xsl:param name="text"/>
+
+  <!-- Check for leading white space.  To optimize for speed, we check a couple
+       of longer space sequences first. -->
+  <xsl:choose>
+    <xsl:when test="starts-with($text, '        ')">  <!-- 8 leading spaces -->
+      <xsl:call-template name="strip-string">
+        <xsl:with-param name="text" select="substring($text, 9)"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="starts-with($text, '    ')">      <!-- 4 leading spaces -->
+      <xsl:call-template name="strip-string">
+        <xsl:with-param name="text" select="substring($text, 5)"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="starts-with($text, '  ')">        <!-- 2 leading spaces -->
+      <xsl:call-template name="strip-string">
+        <xsl:with-param name="text" select="substring($text, 3)"/>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="contains($G_sWhiteSpace, substring($text, 1, 1))">
+      <xsl:if test="string-length($text) > 0">
+        <xsl:call-template name="strip-string">
+          <xsl:with-param name="text" select="substring($text, 2)"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:when>
+
+    <!-- Then check for trailing whitespace. -->
+    <xsl:otherwise>
+      <xsl:choose>
+        <xsl:when test="contains($G_sWhiteSpace, substring($text, string-length($text), 1))">
+          <xsl:call-template name="strip-string-right">
+            <xsl:with-param name="text" select="substring($text, 1, string-length($text) - 1)"/>
+          </xsl:call-template>
+        </xsl:when>
+
+        <!-- No leading or trailing white space. Return the string. -->
+        <xsl:otherwise>
+          <xsl:value-of select="$text"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:otherwise>
+  </xsl:choose>
+
+</xsl:template>
+
 </xsl:stylesheet>
diff --git a/src/VBox/Main/idl/xpidl.xsl b/src/VBox/Main/idl/xpidl.xsl
index 8a8597b..8582f81 100644
--- a/src/VBox/Main/idl/xpidl.xsl
+++ b/src/VBox/Main/idl/xpidl.xsl
@@ -21,56 +21,7 @@
 
 <xsl:strip-space elements="*"/>
 
-
-<!--
-//  helper definitions
-/////////////////////////////////////////////////////////////////////////////
--->
-
-<!--
- *  capitalizes the first letter
--->
-<xsl:template name="capitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    concat(
-      translate(substring($str,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
-      substring($str,2)
-    )
-  "/>
-</xsl:template>
-
-<!--
- *  uncapitalizes the first letter only if the second one is not capital
- *  otherwise leaves the string unchanged
--->
-<xsl:template name="uncapitalize">
-  <xsl:param name="str" select="."/>
-  <xsl:choose>
-    <xsl:when test="not(contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', substring($str,2,1)))">
-      <xsl:value-of select="
-        concat(
-          translate(substring($str,1,1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),
-          substring($str,2)
-        )
-      "/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:value-of select="string($str)"/>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<!--
- *  translates the string to uppercase
--->
-<xsl:template name="uppercase">
-  <xsl:param name="str" select="."/>
-  <xsl:value-of select="
-    translate($str,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')
-  "/>
-</xsl:template>
-
+<xsl:include href="typemap-shared.inc.xsl"/>
 
 <!--
 //  templates
@@ -246,7 +197,8 @@
       <xsl:when test="@extends='$errorinfo'">nsIException</xsl:when>
       <xsl:otherwise><xsl:value-of select="@extends"/></xsl:otherwise>
   </xsl:choose>
-  <xsl:text>&#x0A;{&#x0A;</xsl:text>
+  <xsl:call-template name="xsltprocNewlineOutputHack"/>
+  <xsl:text>{&#x0A;</xsl:text>
   <!-- attributes (properties) -->
   <xsl:apply-templates select="attribute"/>
   <!-- methods -->
@@ -268,7 +220,7 @@
   <xsl:text>#define COM_FORWARD_</xsl:text>
   <xsl:value-of select="@name"/>
   <xsl:text>_TO(smth) NS_FORWARD_</xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="@name"/>
   </xsl:call-template>
   <xsl:text> (smth)&#x0A;</xsl:text>
@@ -664,7 +616,7 @@
   <xsl:value-of select="@name"/>
   <xsl:text>:&#x0A;</xsl:text>
   <xsl:text>#define NS_</xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="@name"/>
   </xsl:call-template>
   <xsl:text>_CID { \&#x0A;</xsl:text>
@@ -682,7 +634,7 @@
   <xsl:text>, 0x</xsl:text><xsl:value-of select="substring(@uuid,35,2)"/>
   <xsl:text> } \&#x0A;}&#x0A;</xsl:text>
   <xsl:text>#define NS_</xsl:text>
-  <xsl:call-template name="uppercase">
+  <xsl:call-template name="string-to-upper">
     <xsl:with-param name="str" select="@name"/>
   </xsl:call-template>
   <!-- Contract ID -->
diff --git a/src/VBox/Main/include/AdditionsFacilityImpl.h b/src/VBox/Main/include/AdditionsFacilityImpl.h
index 1d624f6..59d78ad 100644
--- a/src/VBox/Main/include/AdditionsFacilityImpl.h
+++ b/src/VBox/Main/include/AdditionsFacilityImpl.h
@@ -1,9 +1,10 @@
+/* $Id: AdditionsFacilityImpl.h $ */
 /** @file
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,24 +21,14 @@
 #include <vector>
 #include <iprt/time.h>
 
-#include "VirtualBoxBase.h"
+#include "AdditionsFacilityWrap.h"
 
 class Guest;
 
 class ATL_NO_VTABLE AdditionsFacility :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IAdditionsFacility)
+    public AdditionsFacilityWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(AdditionsFacility, IAdditionsFacility)
-
-    DECLARE_NOT_AGGREGATABLE(AdditionsFacility)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(AdditionsFacility)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IAdditionsFacility)
-    END_COM_MAP()
 
     DECLARE_EMPTY_CTOR_DTOR(AdditionsFacility)
 
@@ -49,12 +40,6 @@ public:
     HRESULT FinalConstruct();
     void FinalRelease();
 
-    // IAdditionsFacility properties
-    STDMETHOD(COMGETTER(ClassType))(AdditionsFacilityClass_T *aClass);
-    STDMETHOD(COMGETTER(LastUpdated))(LONG64 *aTimestamp);
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMGETTER(Status))(AdditionsFacilityStatus_T *aStatus);
-    STDMETHOD(COMGETTER(Type))(AdditionsFacilityType_T *aType);
 
 public:
     /** Facility <-> string mappings. */
@@ -70,15 +55,23 @@ public:
     static const FacilityInfo s_aFacilityInfo[8];
 
     // public internal methods
-    static const AdditionsFacility::FacilityInfo &typeToInfo(AdditionsFacilityType_T aType);
-    AdditionsFacilityClass_T getClass() const;
-    LONG64 getLastUpdated() const;
-    Bstr getName() const;
-    AdditionsFacilityStatus_T getStatus() const;
-    AdditionsFacilityType_T getType() const;
-    void update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
+    static const AdditionsFacility::FacilityInfo &i_typeToInfo(AdditionsFacilityType_T aType);
+    AdditionsFacilityClass_T i_getClass() const;
+    LONG64 i_getLastUpdated() const;
+    com::Utf8Str i_getName() const;
+    AdditionsFacilityStatus_T i_getStatus() const;
+    AdditionsFacilityType_T i_getType() const;
+    void i_update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
 
 private:
+
+    // Wrapped IAdditionsFacility properties
+    HRESULT getClassType(AdditionsFacilityClass_T *aClassType);
+    HRESULT getLastUpdated(LONG64 *aLastUpdated);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getStatus(AdditionsFacilityStatus_T *aStatus);
+    HRESULT getType(AdditionsFacilityType_T *aType);
+
     /** A structure for keeping a facility status
      *  set at a certain time. Good for book-keeping. */
     struct FacilityState
diff --git a/src/VBox/Main/include/ApplianceImpl.h b/src/VBox/Main/include/ApplianceImpl.h
index 937ebbf..b6050a6 100644
--- a/src/VBox/Main/include/ApplianceImpl.h
+++ b/src/VBox/Main/include/ApplianceImpl.h
@@ -19,15 +19,14 @@
 #define ____H_APPLIANCEIMPL
 
 /* VBox includes */
-#include "VirtualBoxBase.h"
+#include <VBox/settings.h>
+#include "VirtualSystemDescriptionWrap.h"
+#include "ApplianceWrap.h"
+#include "MediumFormatImpl.h"
 
 /* Todo: This file needs massive cleanup. Split IAppliance in a public and
  * private classes. */
 #include <iprt/tar.h>
-#include <iprt/circbuf.h>
-#include <VBox/vd.h>
-#include <iprt/sha.h>
-
 #include "ovfreader.h"
 #include <set>
 
@@ -46,7 +45,7 @@ namespace ovf
 {
     struct HardDiskController;
     struct VirtualSystem;
-    class OVFReader;
+    class  OVFReader;
     struct DiskImage;
     struct EnvelopeData;
 }
@@ -63,60 +62,55 @@ namespace settings
 }
 
 class ATL_NO_VTABLE Appliance :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IAppliance)
+    public ApplianceWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Appliance, IAppliance)
-
-    DECLARE_NOT_AGGREGATABLE(Appliance)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-    BEGIN_COM_MAP(Appliance)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IAppliance)
-    END_COM_MAP()
+    DECLARE_EMPTY_CTOR_DTOR(Appliance)
 
-    DECLARE_EMPTY_CTOR_DTOR (Appliance)
+    HRESULT FinalConstruct();
+    void FinalRelease();
 
 
-
-    // public initializer/uninitializer for internal purposes only
-    HRESULT FinalConstruct() { return BaseFinalConstruct(); }
-    void FinalRelease() { uninit(); BaseFinalRelease(); }
-
     HRESULT init(VirtualBox *aVirtualBox);
     void uninit();
 
-    /* IAppliance properties */
-    STDMETHOD(COMGETTER(Path))(BSTR *aPath);
-    STDMETHOD(COMGETTER(Disks))(ComSafeArrayOut(BSTR, aDisks));
-    STDMETHOD(COMGETTER(VirtualSystemDescriptions))(ComSafeArrayOut(IVirtualSystemDescription*, aVirtualSystemDescriptions));
-    STDMETHOD(COMGETTER(Machines))(ComSafeArrayOut(BSTR, aMachines));
-
-    /* IAppliance methods */
-    /* Import methods */
-    STDMETHOD(Read)(IN_BSTR path, IProgress **aProgress);
-    STDMETHOD(Interpret)(void);
-    STDMETHOD(ImportMachines)(ComSafeArrayIn(ImportOptions_T, options), IProgress **aProgress);
-    /* Export methods */
-    STDMETHOD(CreateVFSExplorer)(IN_BSTR aURI, IVFSExplorer **aExplorer);
-    STDMETHOD(Write)(IN_BSTR format, ComSafeArrayIn(ExportOptions_T, options), IN_BSTR path, IProgress **aProgress);
-
-    STDMETHOD(GetWarnings)(ComSafeArrayOut(BSTR, aWarnings));
-
     /* public methods only for internal purposes */
 
-    static HRESULT setErrorStatic(HRESULT aResultCode,
-                                  const Utf8Str &aText)
+    static HRESULT i_setErrorStatic(HRESULT aResultCode,
+                                    const Utf8Str &aText)
     {
         return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
     }
 
     /* private instance data */
 private:
+    // wrapped IAppliance properties
+    HRESULT getPath(com::Utf8Str &aPath);
+    HRESULT getDisks(std::vector<com::Utf8Str> &aDisks);
+    HRESULT getVirtualSystemDescriptions(std::vector<ComPtr<IVirtualSystemDescription> > &aVirtualSystemDescriptions);
+    HRESULT getMachines(std::vector<com::Utf8Str> &aMachines);
+
+    // wrapped IAppliance methods
+    HRESULT read(const com::Utf8Str &aFile,
+                 ComPtr<IProgress> &aProgress);
+    HRESULT interpret();
+    HRESULT importMachines(const std::vector<ImportOptions_T> &aOptions,
+                           ComPtr<IProgress> &aProgress);
+    HRESULT createVFSExplorer(const com::Utf8Str &aURI,
+                              ComPtr<IVFSExplorer> &aExplorer);
+    HRESULT write(const com::Utf8Str &aFormat,
+                  const std::vector<ExportOptions_T> &aOptions,
+                  const com::Utf8Str &aPath,
+                  ComPtr<IProgress> &aProgress);
+    HRESULT getWarnings(std::vector<com::Utf8Str> &aWarnings);
+    HRESULT getPasswordIds(std::vector<com::Utf8Str> &aIdentifiers);
+    HRESULT getMediumIdsForPasswordId(const com::Utf8Str &aPasswordId, std::vector<com::Guid> &aIdentifiers);
+    HRESULT addPasswords(const std::vector<com::Utf8Str> &aIdentifiers,
+                         const std::vector<com::Utf8Str> &aPasswords);
+
     /** weak VirtualBox parent */
-    VirtualBox* const   mVirtualBox;
+    VirtualBox* const mVirtualBox;
 
     struct ImportStack;
     struct TaskOVF;
@@ -125,221 +119,210 @@ private:
 
     enum SetUpProgressMode { ImportFile, ImportS3, WriteFile, WriteS3 };
 
-    /*******************************************************************************
-     * General stuff
-     ******************************************************************************/
-
-    bool isApplianceIdle();
-    HRESULT searchUniqueVMName(Utf8Str& aName) const;
-    HRESULT searchUniqueDiskImageFilePath(Utf8Str& aName) const;
-    HRESULT setUpProgress(ComObjPtr<Progress> &pProgress,
-                          const Bstr &bstrDescription,
-                          SetUpProgressMode mode);
-    void waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis, ComPtr<IProgress> &pProgressAsync);
-    void addWarning(const char* aWarning, ...);
-    void disksWeight();
-    void parseBucket(Utf8Str &aPath, Utf8Str &aBucket);
-
-    static DECLCALLBACK(int) taskThreadImportOrExport(RTTHREAD aThread, void *pvUser);
-
-    HRESULT initSetOfSupportedStandardsURI();
-
-    Utf8Str typeOfVirtualDiskFormatFromURI(Utf8Str type) const;
-
-    std::set<Utf8Str> URIFromTypeOfVirtualDiskFormat(Utf8Str type);
-
-    HRESULT initApplianceIONameMap();
-
-    Utf8Str applianceIOName(APPLIANCEIONAME type) const;
-
-    /*******************************************************************************
-     * Read stuff
-     ******************************************************************************/
-
-    HRESULT readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
-
-    HRESULT readFS(TaskOVF *pTask);
-    HRESULT readFSOVF(TaskOVF *pTask);
-    HRESULT readFSOVA(TaskOVF *pTask);
-    HRESULT readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
-    HRESULT readS3(TaskOVF *pTask);
-
-    /*******************************************************************************
-     * Import stuff
-     ******************************************************************************/
-
-    HRESULT importImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
-
-    HRESULT importFS(TaskOVF *pTask);
-    HRESULT importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
-    HRESULT importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
-    HRESULT importS3(TaskOVF *pTask);
-
-    HRESULT readFileToBuf(const Utf8Str &strFile,
-                             void **ppvBuf,
-                             size_t *pcbSize,
-                             bool fCreateDigest,
-                             PVDINTERFACEIO pCallbacks,
-                             PSHASTORAGE pStorage);
-    HRESULT readTarFileToBuf(RTTAR tar,
-                             const Utf8Str &strFile,
-                             void **ppvBuf,
-                             size_t *pcbSize,
-                             bool fCreateDigest,
-                             PVDINTERFACEIO pCallbacks,
-                             PSHASTORAGE pStorage);
-    HRESULT verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize);
-
-    void convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
-                                     uint32_t ulAddressOnParent,
-                                     Bstr &controllerType,
-                                     int32_t &lControllerPort,
-                                     int32_t &lDevice);
-
-    void importOneDiskImage(const ovf::DiskImage &di,
-                            Utf8Str *strTargetPath,
-                            ComObjPtr<Medium> &pTargetHD,
-                            ImportStack &stack,
+    /** @name General stuff
+     * @{
+     */
+    bool i_isApplianceIdle();
+    HRESULT i_searchUniqueVMName(Utf8Str& aName) const;
+    HRESULT i_searchUniqueDiskImageFilePath(Utf8Str& aName) const;
+    HRESULT i_setUpProgress(ComObjPtr<Progress> &pProgress,
+                            const Bstr &bstrDescription,
+                            SetUpProgressMode mode);
+    void i_waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis, ComPtr<IProgress> &pProgressAsync);
+    void i_addWarning(const char* aWarning, ...);
+    void i_disksWeight();
+    void i_parseBucket(Utf8Str &aPath, Utf8Str &aBucket);
+
+    static DECLCALLBACK(int) i_taskThreadImportOrExport(RTTHREAD aThread, void *pvUser);
+
+    HRESULT i_initSetOfSupportedStandardsURI();
+
+    Utf8Str i_typeOfVirtualDiskFormatFromURI(Utf8Str type) const;
+
+    std::set<Utf8Str> i_URIFromTypeOfVirtualDiskFormat(Utf8Str type);
+
+    HRESULT i_initApplianceIONameMap();
+
+    Utf8Str i_applianceIOName(APPLIANCEIONAME type) const;
+
+    HRESULT i_findMediumFormatFromDiskImage(const ovf::DiskImage &di, ComObjPtr<MediumFormat>& mf);
+    /** @}  */
+
+    /** @name Read stuff
+     * @{
+     */
+    HRESULT i_readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
+
+    HRESULT i_readFS(TaskOVF *pTask);
+    HRESULT i_readFSOVF(TaskOVF *pTask);
+    HRESULT i_readFSOVA(TaskOVF *pTask);
+    HRESULT i_readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
+    HRESULT i_readS3(TaskOVF *pTask);
+    /** @}  */
+
+    /** @name Import stuff
+     * @}
+     */
+    HRESULT i_importImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
+
+    HRESULT i_importFS(TaskOVF *pTask);
+    HRESULT i_importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
+    HRESULT i_importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
+    HRESULT i_importS3(TaskOVF *pTask);
+
+    HRESULT i_readFileToBuf(const Utf8Str &strFile,
+                            void **ppvBuf,
+                            size_t *pcbSize,
+                            bool fCreateDigest,
                             PVDINTERFACEIO pCallbacks,
                             PSHASTORAGE pStorage);
-
-    void importMachineGeneric(const ovf::VirtualSystem &vsysThis,
-                              ComObjPtr<VirtualSystemDescription> &vsdescThis,
-                              ComPtr<IMachine> &pNewMachine,
+    HRESULT i_readTarFileToBuf(struct FSSRDONLYINTERFACEIO *pTarIo,
+                               const Utf8Str &strFile,
+                               void **ppvBuf,
+                               size_t *pcbSize,
+                               bool fCreateDigest,
+                               PVDINTERFACEIO pCallbacks,
+                               PSHASTORAGE pStorage);
+    HRESULT i_verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize);
+
+    HRESULT i_verifyCertificateFile(void *pvBuf, size_t cbSize, PSHASTORAGE pStorage);
+
+    void i_convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
+                                       uint32_t ulAddressOnParent,
+                                       Bstr &controllerType,
+                                       int32_t &lControllerPort,
+                                       int32_t &lDevice);
+
+    void i_importOneDiskImage(const ovf::DiskImage &di,
+                              Utf8Str *strTargetPath,
+                              ComObjPtr<Medium> &pTargetHD,
                               ImportStack &stack,
                               PVDINTERFACEIO pCallbacks,
                               PSHASTORAGE pStorage);
-    void importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
-                           ComPtr<IMachine> &pNewMachine,
-                           ImportStack &stack,
-                           PVDINTERFACEIO pCallbacks,
-                           PSHASTORAGE pStorage);
-    void importMachines(ImportStack &stack,
-                        PVDINTERFACEIO pCallbacks,
-                        PSHASTORAGE pStorage);
-
-    /*******************************************************************************
-     * Write stuff
-     ******************************************************************************/
-
-    HRESULT writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
-
-    HRESULT writeFS(TaskOVF *pTask);
-    HRESULT writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
-    HRESULT writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
-    HRESULT writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
-    HRESULT writeS3(TaskOVF *pTask);
+
+    void i_importMachineGeneric(const ovf::VirtualSystem &vsysThis,
+                                ComObjPtr<VirtualSystemDescription> &vsdescThis,
+                                ComPtr<IMachine> &pNewMachine,
+                                ImportStack &stack,
+                                PVDINTERFACEIO pCallbacks,
+                                PSHASTORAGE pStorage);
+    void i_importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
+                             ComPtr<IMachine> &pNewMachine,
+                             ImportStack &stack,
+                             PVDINTERFACEIO pCallbacks,
+                             PSHASTORAGE pStorage);
+    void i_importMachines(ImportStack &stack,
+                          PVDINTERFACEIO pCallbacks,
+                          PSHASTORAGE pStorage);
+
+    HRESULT i_preCheckImageAvailability(PSHASTORAGE pSHAStorage,
+                                        RTCString &availableImage);
+    /** @} */
+
+    /** @name Write stuff
+     * @{
+     */
+    HRESULT i_writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
+
+    HRESULT i_writeFS(TaskOVF *pTask);
+    HRESULT i_writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock);
+    HRESULT i_writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock);
+    HRESULT i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage);
+    HRESULT i_writeS3(TaskOVF *pTask);
 
     struct XMLStack;
 
-    void buildXML(AutoWriteLockBase& writeLock,
-                  xml::Document &doc,
-                  XMLStack &stack,
-                  const Utf8Str &strPath,
-                  ovf::OVFVersion_T enFormat);
-    void buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
-                                     xml::ElementNode &elmToAddVirtualSystemsTo,
-                                     std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
-                                     ComObjPtr<VirtualSystemDescription> &vsdescThis,
-                                     ovf::OVFVersion_T enFormat,
-                                     XMLStack &stack);
-
-    HRESULT preCheckImageAvailability(PSHASTORAGE pSHAStorage,
-                                      RTCString &availableImage);
+    void i_buildXML(AutoWriteLockBase& writeLock,
+                    xml::Document &doc,
+                    XMLStack &stack,
+                    const Utf8Str &strPath,
+                    ovf::OVFVersion_T enFormat);
+    void i_buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
+                                       xml::ElementNode &elmToAddVirtualSystemsTo,
+                                       std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
+                                       ComObjPtr<VirtualSystemDescription> &vsdescThis,
+                                       ovf::OVFVersion_T enFormat,
+                                       XMLStack &stack);
+    /** @} */
 
     friend class Machine;
 };
 
-void parseURI(Utf8Str strUri, LocationInfo &locInfo);
+void i_parseURI(Utf8Str strUri, LocationInfo &locInfo);
 
 struct VirtualSystemDescriptionEntry
 {
-    uint32_t ulIndex;                       // zero-based index of this entry within array
-    VirtualSystemDescriptionType_T type;    // type of this entry
-    Utf8Str strRef;                         // reference number (hard disk controllers only)
-    Utf8Str strOvf;                         // original OVF value (type-dependent)
-    Utf8Str strVBoxSuggested;               // configuration value (type-dependent); original value suggested by interpret()
-    Utf8Str strVBoxCurrent;                 // configuration value (type-dependent); current value, either from interpret() or setFinalValue()
-    Utf8Str strExtraConfigSuggested;        // extra configuration key=value strings (type-dependent); original value suggested by interpret()
-    Utf8Str strExtraConfigCurrent;          // extra configuration key=value strings (type-dependent); current value, either from interpret() or setFinalValue()
-
-    uint32_t ulSizeMB;                      // hard disk images only: a copy of ovf::DiskImage::ulSuggestedSizeMB
+    uint32_t ulIndex;                       ///< zero-based index of this entry within array
+    VirtualSystemDescriptionType_T type;    ///< type of this entry
+    Utf8Str strRef;                         ///< reference number (hard disk controllers only)
+    Utf8Str strOvf;                         ///< original OVF value (type-dependent)
+    Utf8Str strVBoxSuggested;               ///< configuration value (type-dependent); original value suggested by interpret()
+    Utf8Str strVBoxCurrent;                 ///< configuration value (type-dependent); current value, either from interpret() or setFinalValue()
+    Utf8Str strExtraConfigSuggested;        ///< extra configuration key=value strings (type-dependent); original value suggested by interpret()
+    Utf8Str strExtraConfigCurrent;          ///< extra configuration key=value strings (type-dependent); current value, either from interpret() or setFinalValue()
+
+    uint32_t ulSizeMB;                      ///< hard disk images only: a copy of ovf::DiskImage::ulSuggestedSizeMB
     bool skipIt;                            ///< used during export to skip some parts if it's needed
 };
 
 class ATL_NO_VTABLE VirtualSystemDescription :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IVirtualSystemDescription)
+    public VirtualSystemDescriptionWrap
 {
     friend class Appliance;
 
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VirtualSystemDescription, IVirtualSystemDescription)
-
-    DECLARE_NOT_AGGREGATABLE(VirtualSystemDescription)
 
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
+    DECLARE_EMPTY_CTOR_DTOR(VirtualSystemDescription)
 
-    BEGIN_COM_MAP(VirtualSystemDescription)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IVirtualSystemDescription)
-    END_COM_MAP()
-
-    DECLARE_EMPTY_CTOR_DTOR (VirtualSystemDescription)
-
-    // public initializer/uninitializer for internal purposes only
-    HRESULT FinalConstruct() { return BaseFinalConstruct(); }
-    void FinalRelease() { uninit(); BaseFinalRelease(); }
+    HRESULT FinalConstruct();
+    void FinalRelease();
 
     HRESULT init();
     void uninit();
 
-    /* IVirtualSystemDescription properties */
-    STDMETHOD(COMGETTER(Count))(ULONG *aCount);
-
-    /* IVirtualSystemDescription methods */
-    STDMETHOD(GetDescription)(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
-                              ComSafeArrayOut(BSTR, aRefs),
-                              ComSafeArrayOut(BSTR, aOvfValues),
-                              ComSafeArrayOut(BSTR, aVBoxValues),
-                              ComSafeArrayOut(BSTR, aExtraConfigValues));
-
-    STDMETHOD(GetDescriptionByType)(VirtualSystemDescriptionType_T aType,
-                                    ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
-                                    ComSafeArrayOut(BSTR, aRefs),
-                                    ComSafeArrayOut(BSTR, aOvfValues),
-                                    ComSafeArrayOut(BSTR, aVBoxValues),
-                                    ComSafeArrayOut(BSTR, aExtraConfigValues));
-
-    STDMETHOD(GetValuesByType)(VirtualSystemDescriptionType_T aType,
-                               VirtualSystemDescriptionValueType_T aWhich,
-                               ComSafeArrayOut(BSTR, aValues));
-
-    STDMETHOD(SetFinalValues)(ComSafeArrayIn(BOOL, aEnabled),
-                              ComSafeArrayIn(IN_BSTR, aVBoxValues),
-                              ComSafeArrayIn(IN_BSTR, aExtraConfigValues));
-
-    STDMETHOD(AddDescription)(VirtualSystemDescriptionType_T aType,
-                              IN_BSTR aVBoxValue,
-                              IN_BSTR aExtraConfigValue);
-
     /* public methods only for internal purposes */
-    void addEntry(VirtualSystemDescriptionType_T aType,
-                  const Utf8Str &strRef,
-                  const Utf8Str &aOvfValue,
-                  const Utf8Str &aVBoxValue,
-                  uint32_t ulSizeMB = 0,
-                  const Utf8Str &strExtraConfig = "");
-
-    std::list<VirtualSystemDescriptionEntry*> findByType(VirtualSystemDescriptionType_T aType);
-    const VirtualSystemDescriptionEntry* findControllerFromID(uint32_t id);
+    void i_addEntry(VirtualSystemDescriptionType_T aType,
+                    const Utf8Str &strRef,
+                    const Utf8Str &aOvfValue,
+                    const Utf8Str &aVBoxValue,
+                    uint32_t ulSizeMB = 0,
+                    const Utf8Str &strExtraConfig = "");
 
-    void importVBoxMachineXML(const xml::ElementNode &elmMachine);
-    const settings::MachineConfigFile* getMachineConfig() const;
+    std::list<VirtualSystemDescriptionEntry*> i_findByType(VirtualSystemDescriptionType_T aType);
+    const VirtualSystemDescriptionEntry* i_findControllerFromID(uint32_t id);
 
-    void removeByType(VirtualSystemDescriptionType_T aType);
+    void i_importVBoxMachineXML(const xml::ElementNode &elmMachine);
+    const settings::MachineConfigFile* i_getMachineConfig() const;
 
     /* private instance data */
 private:
+
+    // wrapped IVirtualSystemDescription properties
+    HRESULT getCount(ULONG *aCount);
+
+    // wrapped IVirtualSystemDescription methods
+    HRESULT getDescription(std::vector<VirtualSystemDescriptionType_T> &aTypes,
+                           std::vector<com::Utf8Str> &aRefs,
+                           std::vector<com::Utf8Str> &aOVFValues,
+                           std::vector<com::Utf8Str> &aVBoxValues,
+                           std::vector<com::Utf8Str> &aExtraConfigValues);
+    HRESULT getDescriptionByType(VirtualSystemDescriptionType_T aType,
+                                 std::vector<VirtualSystemDescriptionType_T> &aTypes,
+                                 std::vector<com::Utf8Str> &aRefs,
+                                 std::vector<com::Utf8Str> &aOVFValues,
+                                 std::vector<com::Utf8Str> &aVBoxValues,
+                                 std::vector<com::Utf8Str> &aExtraConfigValues);
+    HRESULT getValuesByType(VirtualSystemDescriptionType_T aType,
+                            VirtualSystemDescriptionValueType_T aWhich,
+                            std::vector<com::Utf8Str> &aValues);
+    HRESULT setFinalValues(const std::vector<BOOL> &aEnabled,
+                           const std::vector<com::Utf8Str> &aVBoxValues,
+                           const std::vector<com::Utf8Str> &aExtraConfigValues);
+    HRESULT addDescription(VirtualSystemDescriptionType_T aType,
+                           const com::Utf8Str &aVBoxValue,
+                           const com::Utf8Str &aExtraConfigValue);
+    void i_removeByType(VirtualSystemDescriptionType_T aType);
+
     struct Data;
     Data *m;
 
diff --git a/src/VBox/Main/include/ApplianceImplPrivate.h b/src/VBox/Main/include/ApplianceImplPrivate.h
index d36754a..d123192 100644
--- a/src/VBox/Main/include/ApplianceImplPrivate.h
+++ b/src/VBox/Main/include/ApplianceImplPrivate.h
@@ -1,3 +1,4 @@
+/* $Id: ApplianceImplPrivate.h $ */
 /** @file
  * VirtualBox Appliance private data definitions
  */
@@ -20,7 +21,10 @@
 class VirtualSystemDescription;
 
 #include "ovfreader.h"
+#include "SecretKeyStore.h"
 #include <map>
+#include <vector>
+#include <iprt/vfs.h>
 
 ////////////////////////////////////////////////////////////////////////////////
 //
@@ -30,6 +34,8 @@ class VirtualSystemDescription;
 
 typedef std::pair<Utf8Str, Utf8Str> STRPAIR;
 
+typedef std::vector<com::Guid> GUIDVEC;
+
 /* Describe a location for the import/export. The location could be a file on a
  * local hard disk or a remote target based on the supported inet protocols. */
 struct LocationInfo
@@ -59,6 +65,7 @@ struct Appliance::Data
       , ulWeightForManifestOperation(0)
       , ulTotalDisksMB(0)
       , cDisks(0)
+      , m_cPwProvided(0)
     {
     }
 
@@ -79,6 +86,7 @@ struct Appliance::Data
     Utf8Str             strOVFSHADigest;//SHA digest of OVf file. It is stored here after reading OVF file (before import)
 
     bool                fExportISOImages;// when 1 the ISO images are exported
+    bool                fX509;// wether X509 is used or not
 
     RTCList<ImportOptions_T> optListImport;
     RTCList<ExportOptions_T> optListExport;
@@ -96,6 +104,15 @@ struct Appliance::Data
     ULONG               cDisks;
 
     std::list<Guid>     llGuidsMachinesCreated;
+
+    /** Sequence of password identifiers to encrypt disk images during export. */
+    std::vector<com::Utf8Str> m_vecPasswordIdentifiers;
+    /** Map to get all medium identifiers assoicated with a given password identifier. */
+    std::map<com::Utf8Str, GUIDVEC> m_mapPwIdToMediumIds;
+    /** Secret key store used to hold the passwords during export. */
+    SecretKeyStore            *m_pSecretKeyStore;
+    /** Number of passwords provided. */
+    uint32_t                  m_cPwProvided;
 };
 
 struct Appliance::XMLStack
@@ -127,7 +144,7 @@ struct Appliance::TaskOVF
 
     static int updateProgress(unsigned uPercent, void *pvUser);
 
-    int startThread();
+    HRESULT startThread();
 
     Appliance *pAppliance;
     TaskType taskType;
@@ -182,6 +199,7 @@ struct Appliance::ImportStack
     // and will be cleaned up on errors
     std::list<MyHardDiskAttachment> llHardDiskAttachments;      // disks that were attached
     std::list<STRPAIR>              llSrcDisksDigest;           // Digests of the source disks
+    std::map<Utf8Str , Utf8Str> mapNewUUIDsToOriginalUUIDs;
 
     ImportStack(const LocationInfo &aLocInfo,
                 const ovf::DiskImagesMap &aMapDisks,
@@ -200,6 +218,10 @@ struct Appliance::ImportStack
         strSourceDir = aLocInfo.strPath;
         strSourceDir.stripFilename();
     }
+
+    HRESULT restoreOriginalUUIDOfAttachedDevice(settings::MachineConfigFile *config);
+    HRESULT saveOriginalUUIDOfAttachedDevice(settings::AttachedDevice &device,
+                                                  const Utf8Str &newlyUuid);
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -210,8 +232,8 @@ struct Appliance::ImportStack
 
 struct VirtualSystemDescription::Data
 {
-    std::list<VirtualSystemDescriptionEntry>
-                            llDescriptions;     // item descriptions
+    std::vector<VirtualSystemDescriptionEntry>
+                            maDescriptions;     // item descriptions
 
     ComPtr<Machine>         pMachine;           // VirtualBox machine this description was exported from (export only)
 
@@ -242,9 +264,19 @@ typedef struct SHASTORAGE
 
 PVDINTERFACEIO ShaCreateInterface();
 PVDINTERFACEIO FileCreateInterface();
-PVDINTERFACEIO TarCreateInterface();
-int ShaReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pIfIo, void *pvUser);
-int ShaWriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pIfIo, void *pvUser);
+PVDINTERFACEIO tarWriterCreateInterface(void);
+
+/** Pointer to the instance data for the fssRdOnly_ methods. */
+typedef struct FSSRDONLYINTERFACEIO *PFSSRDONLYINTERFACEIO;
+
+int  fssRdOnlyCreateInterfaceForTarFile(const char *pszFilename, PFSSRDONLYINTERFACEIO *pTarIo);
+void fssRdOnlyDestroyInterface(PFSSRDONLYINTERFACEIO pFssIo);
+int  fssRdOnlyGetCurrentName(PFSSRDONLYINTERFACEIO pFssIo, const char **ppszName);
+int  fssRdOnlySkipCurrent(PFSSRDONLYINTERFACEIO pFssIo);
+bool fssRdOnlyIsCurrentDirectory(PFSSRDONLYINTERFACEIO pFssIo);
+
+int readFileIntoBuffer(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pIfIo, void *pvUser);
+int writeBufferToFile(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pIfIo, void *pvUser);
 int decompressImageAndSave(const char *pcszFullFilenameIn, const char *pcszFullFilenameOut, PVDINTERFACEIO pIfIo, void *pvUser);
 int copyFileAndCalcShaDigest(const char *pcszSourceFilename, const char *pcszTargetFilename, PVDINTERFACEIO pIfIo, void *pvUser);
 #endif // !____H_APPLIANCEIMPLPRIVATE
diff --git a/src/VBox/Main/include/AudioAdapterImpl.h b/src/VBox/Main/include/AudioAdapterImpl.h
index 157664f..4d9004f 100644
--- a/src/VBox/Main/include/AudioAdapterImpl.h
+++ b/src/VBox/Main/include/AudioAdapterImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,38 +20,17 @@
 #ifndef ____H_AUDIOADAPTER
 #define ____H_AUDIOADAPTER
 
-#include "VirtualBoxBase.h"
-
+#include "AudioAdapterWrap.h"
 namespace settings
 {
     struct AudioAdapter;
 }
 
 class ATL_NO_VTABLE AudioAdapter :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IAudioAdapter)
+    public AudioAdapterWrap
 {
 public:
 
-    struct Data
-    {
-        Data();
-
-        BOOL mEnabled;
-        AudioDriverType_T mAudioDriver;
-        AudioControllerType_T mAudioController;
-    };
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(AudioAdapter, IAudioAdapter)
-
-    DECLARE_NOT_AGGREGATABLE(AudioAdapter)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(AudioAdapter)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IAudioAdapter)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR (AudioAdapter)
 
     HRESULT FinalConstruct();
@@ -63,28 +42,33 @@ public:
     HRESULT initCopy(Machine *aParent, AudioAdapter *aThat);
     void uninit();
 
-    STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(AudioDriver))(AudioDriverType_T *aAudioDriverType);
-    STDMETHOD(COMSETTER(AudioDriver))(AudioDriverType_T aAudioDriverType);
-    STDMETHOD(COMGETTER(AudioController))(AudioControllerType_T *aAudioControllerType);
-    STDMETHOD(COMSETTER(AudioController))(AudioControllerType_T aAudioControllerType);
 
     // public methods only for internal purposes
+    HRESULT i_loadSettings(const settings::AudioAdapter &data);
+    HRESULT i_saveSettings(settings::AudioAdapter &data);
 
-    HRESULT loadSettings(const settings::AudioAdapter &data);
-    HRESULT saveSettings(settings::AudioAdapter &data);
-
-    void rollback();
-    void commit();
-    void copyFrom(AudioAdapter *aThat);
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(AudioAdapter *aThat);
 
 private:
 
+    // wrapped IAudioAdapter properties
+    HRESULT getEnabled(BOOL *aEnabled);
+    HRESULT setEnabled(BOOL aEnabled);
+    HRESULT getEnabledIn(BOOL *aEnabled);
+    HRESULT setEnabledIn(BOOL aEnabled);
+    HRESULT getEnabledOut(BOOL *aEnabled);
+    HRESULT setEnabledOut(BOOL aEnabled);
+    HRESULT getAudioDriver(AudioDriverType_T *aAudioDriver);
+    HRESULT setAudioDriver(AudioDriverType_T aAudioDriver);
+    HRESULT getAudioController(AudioControllerType_T *aAudioController);
+    HRESULT setAudioController(AudioControllerType_T aAudioController);
+
     Machine * const     mParent;
     const ComObjPtr<AudioAdapter> mPeer;
-
-    Backupable<Data>    mData;
+    struct Data;
+    Data *mData;
 };
 
 #endif // ____H_AUDIOADAPTER
diff --git a/src/VBox/Main/include/AudioSnifferInterface.h b/src/VBox/Main/include/AudioSnifferInterface.h
index e7461f5..036eae0 100644
--- a/src/VBox/Main/include/AudioSnifferInterface.h
+++ b/src/VBox/Main/include/AudioSnifferInterface.h
@@ -1,3 +1,4 @@
+/* $Id: AudioSnifferInterface.h $ */
 /** @file
  * VirtualBox Driver interface to Audio Sniffer device
  */
diff --git a/src/VBox/Main/include/AutoCaller.h b/src/VBox/Main/include/AutoCaller.h
index 2ec2546..8950325 100644
--- a/src/VBox/Main/include/AutoCaller.h
+++ b/src/VBox/Main/include/AutoCaller.h
@@ -1,6 +1,7 @@
+/* $Id: AutoCaller.h $ */
 /** @file
  *
- * VirtualBox COM base classes definition
+ * VirtualBox object caller handling definitions
  */
 
 /*
@@ -18,69 +19,91 @@
 #ifndef ____H_AUTOCALLER
 #define ____H_AUTOCALLER
 
+#include "ObjectState.h"
+
+#include "VBox/com/AutoLock.h"
+
+// Forward declaration needed, but nothing more.
+class VirtualBoxBase;
+
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // AutoCaller* classes
 //
 ////////////////////////////////////////////////////////////////////////////////
 
+
 /**
- * Smart class that automatically increases the number of callers of the
- * given VirtualBoxBase object when an instance is constructed and decreases
- * it back when the created instance goes out of scope (i.e. gets destroyed).
+ * Smart class that automatically increases the number of normal (non-limited)
+ * callers of the given VirtualBoxBase object when an instance is constructed
+ * and decreases it back when the created instance goes out of scope (i.e. gets
+ * destroyed).
  *
  * If #rc() returns a failure after the instance creation, it means that
  * the managed VirtualBoxBase object is not Ready, or in any other invalid
  * state, so that the caller must not use the object and can return this
  * failed result code to the upper level.
  *
- * See VirtualBoxBase::addCaller(), VirtualBoxBase::addLimitedCaller() and
- * VirtualBoxBase::releaseCaller() for more details about object callers.
- *
- * @param aLimited  |false| if this template should use
- *                  VirtualBoxBase::addCaller() calls to add callers, or
- *                  |true| if VirtualBoxBase::addLimitedCaller() should be
- *                  used.
+ * See ObjectState::addCaller() and ObjectState::releaseCaller() for more
+ * details about object callers.
  *
- * @note It is preferable to use the AutoCaller and AutoLimitedCaller
- *       classes than specify the @a aLimited argument, for better
- *       self-descriptiveness.
+ * A typical usage pattern to declare a normal method of some object (i.e. a
+ * method that is valid only when the object provides its full
+ * functionality) is:
+ * <code>
+ * STDMETHODIMP Component::Foo()
+ * {
+ *     AutoCaller autoCaller(this);
+ *     HRESULT hrc = autoCaller.rc();
+ *     if (SUCCEEDED(hrc))
+ *     {
+ *         ...
+ *     }
+ *     return hrc;
+ * }
+ * </code>
  */
-template<bool aLimited>
-class AutoCallerBase
+class AutoCaller
 {
 public:
+    /**
+     * Default constructor. Not terribly useful, but it's valid to create
+     * an instance without associating it with an object. It's a no-op,
+     * like the more useful constructor below when NULL is passed to it.
+     */
+    AutoCaller()
+    {
+        init(NULL, false);
+    }
 
     /**
      * Increases the number of callers of the given object by calling
-     * VirtualBoxBase::addCaller().
+     * ObjectState::addCaller() for the corresponding member instance.
      *
-     * @param aObj      Object to add a caller to. If NULL, this
+     * @param aObj      Object to add a normal caller to. If NULL, this
      *                  instance is effectively turned to no-op (where
-     *                  rc() will return S_OK and state() will be
-     *                  NotReady).
+     *                  rc() will return S_OK).
      */
-    AutoCallerBase(VirtualBoxBase *aObj)
-        : mObj(aObj), mRC(S_OK), mState(VirtualBoxBase::NotReady)
+    AutoCaller(VirtualBoxBase *aObj)
     {
-        if (mObj)
-            mRC = mObj->addCaller(&mState, aLimited);
+        init(aObj, false);
     }
 
     /**
      * If the number of callers was successfully increased, decreases it
-     * using VirtualBoxBase::releaseCaller(), otherwise does nothing.
+     * using ObjectState::releaseCaller(), otherwise does nothing.
      */
-    ~AutoCallerBase()
+    ~AutoCaller()
     {
         if (mObj && SUCCEEDED(mRC))
-            mObj->releaseCaller();
+            mObj->getObjectState().releaseCaller();
     }
 
     /**
-     * Stores the result code returned by VirtualBoxBase::addCaller() after
-     * instance creation or after the last #add() call. A successful result
-     * code means the number of callers was successfully increased.
+     * Returns the stored result code returned by ObjectState::addCaller()
+     * after instance creation or after the last #add() call. A successful
+     * result code means the number of callers was successfully increased.
      */
     HRESULT rc() const { return mRC; }
 
@@ -91,12 +114,6 @@ public:
     bool isOk() const { return SUCCEEDED(mRC); }
 
     /**
-     * Stores the object state returned by VirtualBoxBase::addCaller() after
-     * instance creation or after the last #add() call.
-     */
-    VirtualBoxBase::State state() const { return mState; }
-
-    /**
      * Temporarily decreases the number of callers of the managed object.
      * May only be called if #isOk() returns |true|. Note that #rc() will
      * return E_FAIL after this method succeeds.
@@ -107,7 +124,7 @@ public:
         if (SUCCEEDED(mRC))
         {
             if (mObj)
-                mObj->releaseCaller();
+                mObj->getObjectState().releaseCaller();
             mRC = E_FAIL;
         }
     }
@@ -120,7 +137,7 @@ public:
     {
         Assert(!SUCCEEDED(mRC));
         if (mObj && !SUCCEEDED(mRC))
-            mRC = mObj->addCaller(&mState, aLimited);
+            mRC = mObj->getObjectState().addCaller(mLimited);
     }
 
     /**
@@ -147,50 +164,40 @@ public:
         }
     }
 
-    /** Verbose equivalent to <tt>attach (NULL)</tt>. */
+    /** Verbose equivalent to <tt>attach(NULL)</tt>. */
     void detach() { attach(NULL); }
 
-private:
+protected:
+    /**
+     * Internal constructor: Increases the number of callers of the given
+     * object (either normal or limited variant) by calling
+     * ObjectState::addCaller() for the corresponding member instance.
+     *
+     * @param aObj      Object to add a caller to. If NULL, this
+     *                  instance is effectively turned to no-op (where
+     *                  rc() will return S_OK).
+     * @param aLimited  If |false|, then it's a regular caller, otherwise a
+     *                  limited caller.
+     */
+    void init(VirtualBoxBase *aObj, bool aLimited)
+    {
+        mObj = aObj;
+        mRC = S_OK;
+        mLimited = aLimited;
+        if (mObj)
+            mRC = mObj->getObjectState().addCaller(mLimited);
+    }
 
-    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoCallerBase)
-    DECLARE_CLS_NEW_DELETE_NOOP(AutoCallerBase)
+private:
+    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP(AutoCaller)
+    DECLARE_CLS_NEW_DELETE_NOOP(AutoCaller)
 
     VirtualBoxBase *mObj;
     HRESULT mRC;
-    VirtualBoxBase::State mState;
+    bool mLimited;
 };
 
 /**
- * Smart class that automatically increases the number of normal
- * (non-limited) callers of the given VirtualBoxBase object when an instance
- * is constructed and decreases it back when the created instance goes out
- * of scope (i.e. gets destroyed).
- *
- * A typical usage pattern to declare a normal method of some object (i.e. a
- * method that is valid only when the object provides its full
- * functionality) is:
- * <code>
- * STDMETHODIMP Component::Foo()
- * {
- *     AutoCaller autoCaller(this);
- *     HRESULT hrc = autoCaller.rc();
- *     if (SUCCEEDED(hrc))
- *     {
- *         ...
- *     }
- *     return hrc;
- * }
- * </code>
- *
- * Using this class is equivalent to using the AutoCallerBase template with
- * the @a aLimited argument set to |false|, but this class is preferred
- * because provides better self-descriptiveness.
- *
- * See AutoCallerBase for more information about auto caller functionality.
- */
-typedef AutoCallerBase<false> AutoCaller;
-
-/**
  * Smart class that automatically increases the number of limited callers of
  * the given VirtualBoxBase object when an instance is constructed and
  * decreases it back when the created instance goes out of scope (i.e. gets
@@ -211,13 +218,35 @@ typedef AutoCallerBase<false> AutoCaller;
  *     return hrc;
  * </code>
  *
- * Using this class is equivalent to using the AutoCallerBase template with
- * the @a aLimited argument set to |true|, but this class is preferred
- * because provides better self-descriptiveness.
- *
- * See AutoCallerBase for more information about auto caller functionality.
+ * See AutoCaller for more information about auto caller functionality.
  */
-typedef AutoCallerBase<true> AutoLimitedCaller;
+class AutoLimitedCaller : public AutoCaller
+{
+public:
+    /**
+     * Default constructor. Not terribly useful, but it's valid to create
+     * an instance without associating it with an object. It's a no-op,
+     * like the more useful constructor below when NULL is passed to it.
+     */
+    AutoLimitedCaller()
+    {
+        AutoCaller::init(NULL, true);
+    }
+
+    /**
+     * Increases the number of callers of the given object by calling
+     * ObjectState::addCaller() for the corresponding member instance.
+     *
+     * @param aObj      Object to add a limited caller to. If NULL, this
+     *                  instance is effectively turned to no-op (where
+     *                  rc() will return S_OK).
+     */
+    AutoLimitedCaller(VirtualBoxBase *aObj)
+    {
+        AutoCaller::init(aObj, true);
+    }
+
+};
 
 /**
  * Smart class to enclose the state transition NotReady->InInit->Ready.
@@ -348,8 +377,8 @@ private:
  * <code>
  * HRESULT Component::reinit()
  * {
- *     AutoReinitSpan autoReinitSpan (this);
- *     AssertReturn (autoReinitSpan.isOk(), E_FAIL);
+ *     AutoReinitSpan autoReinitSpan(this);
+ *     AssertReturn(autoReinitSpan.isOk(), E_FAIL);
  *     ...
  *     if (FAILED(rc))
  *         return rc;
@@ -415,7 +444,7 @@ private:
  * <code>
  * void Component::uninit()
  * {
- *     AutoUninitSpan autoUninitSpan (this);
+ *     AutoUninitSpan autoUninitSpan(this);
  *     if (autoUninitSpan.uninitDone())
  *         return;
  *     ...
@@ -423,11 +452,11 @@ private:
  * </code>
  *
  * @note The constructor of this class blocks the current thread execution
- *       until the number of callers added to the object using #addCaller()
- *       or AutoCaller drops to zero. For this reason, it is forbidden to
- *       create instances of this class (or call uninit()) within the
- *       AutoCaller or #addCaller() scope because it is a guaranteed
- *       deadlock.
+ *       until the number of callers added to the object using
+ *       ObjectState::addCaller() or AutoCaller drops to zero. For this reason,
+ *       it is forbidden to create instances of this class (or call uninit())
+ *       within the AutoCaller or ObjectState::addCaller() scope because it is
+ *       a guaranteed deadlock.
  *
  * @note Never create instances of this class outside uninit() methods and
  *       never pass anything other than |this| as the argument to the
@@ -446,7 +475,6 @@ public:
     /** |true| when uninit() has already been called (so the object is NotReady) */
     bool uninitDone() { return mUninitDone; }
 
-    /** Immediately complete the span, object is NotReady now */
     void setSucceeded();
 
 private:
diff --git a/src/VBox/Main/include/AutoStateDep.h b/src/VBox/Main/include/AutoStateDep.h
index 409f499..f90dec9 100644
--- a/src/VBox/Main/include/AutoStateDep.h
+++ b/src/VBox/Main/include/AutoStateDep.h
@@ -1,3 +1,4 @@
+/* $Id: AutoStateDep.h $ */
 #ifndef ____H_AUTOSTATEDEP
 #define ____H_AUTOSTATEDEP
 
@@ -9,7 +10,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -39,10 +40,11 @@
      *
      *  Note that it is more convenient to use the following individual
      *  shortcut classes instead of using this template directly:
-     *  AutoAnyStateDependency, AutoMutableStateDependency and
-     *  AutoMutableOrSavedStateDependency. The usage pattern is exactly the
-     *  same as above except that there is no need to specify the template
-     *  argument because it is already done by the shortcut class.
+     *  AutoAnyStateDependency, AutoMutableStateDependency,
+     *  AutoMutableOrSavedStateDependency, AutoMutableOrRunningStateDependency
+     *  or AutoMutableOrSavedOrRunningStateDependency. The usage pattern is
+     *  exactly the same as above except that there is no need to specify the
+     *  template argument because it is already done by the shortcut class.
      *
      *  @param taDepType    Dependency type to manage.
      */
@@ -57,13 +59,13 @@
               mRegistered(FALSE)
         {
             Assert(aThat);
-            mRC = aThat->addStateDependency(taDepType, &mMachineState,
+            mRC = aThat->i_addStateDependency(taDepType, &mMachineState,
                                             &mRegistered);
         }
         ~AutoStateDependency()
         {
             if (SUCCEEDED(mRC))
-                mThat->releaseStateDependency();
+                mThat->i_releaseStateDependency();
         }
 
         /** Decreases the number of dependencies before the instance is
@@ -71,7 +73,7 @@
         void release()
         {
             AssertReturnVoid(SUCCEEDED(mRC));
-            mThat->releaseStateDependency();
+            mThat->i_releaseStateDependency();
             mRC = E_FAIL;
         }
 
@@ -81,7 +83,7 @@
         void add()
         {
             AssertReturnVoid(!SUCCEEDED(mRC));
-            mRC = mThat->addStateDependency(taDepType, &mMachineState,
+            mRC = mThat->i_addStateDependency(taDepType, &mMachineState,
                                             &mRegistered);
         }
 
@@ -138,7 +140,8 @@
      *
      *  Intended to be used within all setter methods of IMachine
      *  children objects (DVDDrive, NetworkAdapter, AudioAdapter, etc.) to
-     *  provide data protection and consistency.
+     *  provide data protection and consistency. There must be no VM process,
+     *  i.e. use for settings changes which are valid when the VM is shut down.
      */
     typedef AutoStateDependency<Machine::MutableStateDep> AutoMutableStateDependency;
 
@@ -154,9 +157,44 @@
      *  should return the failed result code to the upper level.
      *
      *  Intended to be used within setter methods of IMachine
-     *  children objects that may also operate on Saved machines.
+     *  children objects that may operate on shut down or Saved machines.
      */
     typedef AutoStateDependency<Machine::MutableOrSavedStateDep> AutoMutableOrSavedStateDependency;
 
+    /**
+     *  Shortcut to AutoStateDependency<MutableOrRunningStateDep>.
+     *  See AutoStateDependency to get the usage pattern.
+     *
+     *  Succeeds only if the machine state is in one of the mutable states, or
+     *  if the machine is in the Running or Paused state, and guarantees the
+     *  given mutable state won't change before this object is destroyed. If
+     *  the machine is not mutable, this instance's #rc() method will indicate
+     *  a failure, and the caller is not allowed to rely on any particular
+     *  machine state and should return the failed result code to the upper
+     *  level.
+     *
+     *  Intended to be used within setter methods of IMachine
+     *  children objects that may operate on shut down or running machines.
+     */
+    typedef AutoStateDependency<Machine::MutableOrRunningStateDep> AutoMutableOrRunningStateDependency;
+
+    /**
+     *  Shortcut to AutoStateDependency<MutableOrSavedOrRunningStateDep>.
+     *  See AutoStateDependency to get the usage pattern.
+     *
+     *  Succeeds only if the machine state is in one of the mutable states, or
+     *  if the machine is in the Running, Paused or Saved state, and guarantees
+     *  the given mutable state won't change before this object is destroyed.
+     *  If the machine is not mutable, this instance's #rc() method will
+     *  indicate a failure, and the caller is not allowed to rely on any
+     *  particular machine state and should return the failed result code to
+     *  the upper level.
+     *
+     *  Intended to be used within setter methods of IMachine
+     *  children objects that may operate on shut down, running or saved
+     *  machines.
+     */
+    typedef AutoStateDependency<Machine::MutableOrSavedOrRunningStateDep> AutoMutableOrSavedOrRunningStateDependency;
+
 #endif // ____H_AUTOSTATEDEP
 
diff --git a/src/VBox/Main/include/AutostartDb.h b/src/VBox/Main/include/AutostartDb.h
index 541766e..a516224 100644
--- a/src/VBox/Main/include/AutostartDb.h
+++ b/src/VBox/Main/include/AutostartDb.h
@@ -1,3 +1,4 @@
+/* $Id: AutostartDb.h $ */
 /** @file
  * Main - Autostart database Interfaces.
  */
diff --git a/src/VBox/Main/include/BIOSSettingsImpl.h b/src/VBox/Main/include/BIOSSettingsImpl.h
index 660ff0d..4115ab3 100644
--- a/src/VBox/Main/include/BIOSSettingsImpl.h
+++ b/src/VBox/Main/include/BIOSSettingsImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,7 +20,7 @@
 #ifndef ____H_BIOSSETTINGS
 #define ____H_BIOSSETTINGS
 
-#include "VirtualBoxBase.h"
+#include "BIOSSettingsWrap.h"
 
 class GuestOSType;
 
@@ -30,60 +30,53 @@ namespace settings
 }
 
 class ATL_NO_VTABLE BIOSSettings :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IBIOSSettings)
+    public BIOSSettingsWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(BIOSSettings, IBIOSSettings)
 
-    DECLARE_NOT_AGGREGATABLE(BIOSSettings)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(BIOSSettings)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IBIOSSettings)
-    END_COM_MAP()
+    DECLARE_EMPTY_CTOR_DTOR(BIOSSettings)
 
     HRESULT FinalConstruct();
     void FinalRelease();
 
     // public initializer/uninitializer for internal purposes only
-    HRESULT init (Machine *parent);
-    HRESULT init (Machine *parent, BIOSSettings *that);
-    HRESULT initCopy (Machine *parent, BIOSSettings *that);
+    HRESULT init(Machine *parent);
+    HRESULT init(Machine *parent, BIOSSettings *that);
+    HRESULT initCopy(Machine *parent, BIOSSettings *that);
     void uninit();
 
-    STDMETHOD(COMGETTER(LogoFadeIn))(BOOL *enabled);
-    STDMETHOD(COMSETTER(LogoFadeIn))(BOOL enable);
-    STDMETHOD(COMGETTER(LogoFadeOut))(BOOL *enabled);
-    STDMETHOD(COMSETTER(LogoFadeOut))(BOOL enable);
-    STDMETHOD(COMGETTER(LogoDisplayTime))(ULONG *displayTime);
-    STDMETHOD(COMSETTER(LogoDisplayTime))(ULONG displayTime);
-    STDMETHOD(COMGETTER(LogoImagePath))(BSTR *imagePath);
-    STDMETHOD(COMSETTER(LogoImagePath))(IN_BSTR imagePath);
-    STDMETHOD(COMGETTER(BootMenuMode))(BIOSBootMenuMode_T *bootMenuMode);
-    STDMETHOD(COMSETTER(BootMenuMode))(BIOSBootMenuMode_T bootMenuMode);
-    STDMETHOD(COMGETTER(ACPIEnabled))(BOOL *enabled);
-    STDMETHOD(COMSETTER(ACPIEnabled))(BOOL enable);
-    STDMETHOD(COMGETTER(IOAPICEnabled))(BOOL *enabled);
-    STDMETHOD(COMSETTER(IOAPICEnabled))(BOOL enable);
-    STDMETHOD(COMGETTER(PXEDebugEnabled))(BOOL *enabled);
-    STDMETHOD(COMSETTER(PXEDebugEnabled))(BOOL enable);
-    STDMETHOD(COMGETTER)(TimeOffset)(LONG64 *offset);
-    STDMETHOD(COMSETTER)(TimeOffset)(LONG64 offset);
-    STDMETHOD(COMGETTER)(NonVolatileStorageFile)(BSTR *pbstrPath);
-
     // public methods only for internal purposes
+    HRESULT i_loadSettings(const settings::BIOSSettings &data);
+    HRESULT i_saveSettings(settings::BIOSSettings &data);
 
-    HRESULT loadSettings(const settings::BIOSSettings &data);
-    HRESULT saveSettings(settings::BIOSSettings &data);
-
-    void rollback();
-    void commit();
-    void copyFrom (BIOSSettings *aThat);
-    void applyDefaults (GuestOSType *aOsType);
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(BIOSSettings *aThat);
+    void i_applyDefaults(GuestOSType *aOsType);
 
 private:
+
+    // wrapped IBIOSettings properties
+    HRESULT getLogoFadeIn(BOOL *enabled);
+    HRESULT setLogoFadeIn(BOOL enable);
+    HRESULT getLogoFadeOut(BOOL *enabled);
+    HRESULT setLogoFadeOut(BOOL enable);
+    HRESULT getLogoDisplayTime(ULONG *displayTime);
+    HRESULT setLogoDisplayTime(ULONG displayTime);
+    HRESULT getLogoImagePath(com::Utf8Str &imagePath);
+    HRESULT setLogoImagePath(const com::Utf8Str &imagePath);
+    HRESULT getBootMenuMode(BIOSBootMenuMode_T *bootMenuMode);
+    HRESULT setBootMenuMode(BIOSBootMenuMode_T bootMenuMode);
+    HRESULT getACPIEnabled(BOOL *enabled);
+    HRESULT setACPIEnabled(BOOL enable);
+    HRESULT getIOAPICEnabled(BOOL *aIOAPICEnabled);
+    HRESULT setIOAPICEnabled(BOOL aIOAPICEnabled);
+    HRESULT getTimeOffset(LONG64 *offset);
+    HRESULT setTimeOffset(LONG64 offset);
+    HRESULT getPXEDebugEnabled(BOOL *enabled);
+    HRESULT setPXEDebugEnabled(BOOL enable);
+    HRESULT getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile);
+
     struct Data;
     Data *m;
 };
diff --git a/src/VBox/Main/include/BandwidthControlImpl.h b/src/VBox/Main/include/BandwidthControlImpl.h
index f6a4b70..e47ac0e 100644
--- a/src/VBox/Main/include/BandwidthControlImpl.h
+++ b/src/VBox/Main/include/BandwidthControlImpl.h
@@ -1,10 +1,11 @@
+/* $Id: BandwidthControlImpl.h $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,7 +19,7 @@
 #ifndef ____H_BANDWIDTHCONTROLIMPL
 #define ____H_BANDWIDTHCONTROLIMPL
 
-#include "VirtualBoxBase.h"
+#include "BandwidthControlWrap.h"
 
 class BandwidthGroup;
 
@@ -28,22 +29,14 @@ namespace settings
 }
 
 class ATL_NO_VTABLE BandwidthControl :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IBandwidthControl)
+    public BandwidthControlWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(BandwidthControl, IBandwidthControl)
 
-    DECLARE_NOT_AGGREGATABLE(BandwidthControl)
+    DECLARE_EMPTY_CTOR_DTOR(BandwidthControl)
 
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(BandwidthControl)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IBandwidthControl)
-    END_COM_MAP()
-
-    BandwidthControl() { };
-    ~BandwidthControl() { };
+    HRESULT FinalConstruct();
+    void FinalRelease();
 
     // public initializer/uninitializer for internal purposes only
     HRESULT init(Machine *aParent);
@@ -51,32 +44,53 @@ public:
     HRESULT initCopy(Machine *aParent, BandwidthControl *aThat);
     void uninit();
 
-    STDMETHOD(CreateBandwidthGroup) (IN_BSTR aName, BandwidthGroupType_T aType, LONG64 aMaxBytesPerSec);
-    STDMETHOD(DeleteBandwidthGroup) (IN_BSTR aName);
-    STDMETHOD(COMGETTER(NumGroups)) (ULONG *aGroups);
-    STDMETHOD(GetBandwidthGroup) (IN_BSTR aName, IBandwidthGroup **aBandwidthGroup);
-    STDMETHOD(GetAllBandwidthGroups) (ComSafeArrayOut(IBandwidthGroup *, aBandwidthGroups));
+    // public internal methods
+    HRESULT i_loadSettings(const settings::IOSettings &data);
+    HRESULT i_saveSettings(settings::IOSettings &data);
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(BandwidthControl *aThat);
+    Machine *i_getMachine() const;
+    HRESULT i_getBandwidthGroupByName(const Utf8Str &aName,
+                                      ComObjPtr<BandwidthGroup> &aBandwidthGroup,
+                                      bool aSetError /* = false */);
 
-    HRESULT FinalConstruct();
-    void FinalRelease();
+private:
 
-    // public internal methods
+    // wrapped IBandwidthControl properties
+    HRESULT getNumGroups(ULONG *aNumGroups);
 
-    HRESULT loadSettings(const settings::IOSettings &data);
-    HRESULT saveSettings(settings::IOSettings &data);
+    // wrapped IBandwidthControl methods
+    HRESULT createBandwidthGroup(const com::Utf8Str &aName,
+                                       BandwidthGroupType_T aType,
+                                       LONG64 aMaxBytesPerSec);
+    HRESULT deleteBandwidthGroup(const com::Utf8Str &aName);
+    HRESULT getBandwidthGroup(const com::Utf8Str &aName,
+                                    ComPtr<IBandwidthGroup> &aBandwidthGroup);
+    HRESULT getAllBandwidthGroups(std::vector<ComPtr<IBandwidthGroup> > &aBandwidthGroups);
 
-    void rollback();
-    void commit();
-    void copyFrom (BandwidthControl *aThat);
+    // Data
+    typedef std::list< ComObjPtr<BandwidthGroup> > BandwidthGroupList;
 
-    Machine *getMachine() const;
+    struct Data
+    {
+        Data(Machine *pMachine)
+        : pParent(pMachine)
+        { }
 
-    HRESULT getBandwidthGroupByName(const Utf8Str &aName,
-                                    ComObjPtr<BandwidthGroup> &aBandwidthGroup,
-                                    bool aSetError /* = false */);
+        ~Data()
+        {};
+
+        Machine * const                 pParent;
+
+        // peer machine's bandwidth control
+        const ComObjPtr<BandwidthControl>  pPeer;
+
+        // the following fields need special backup/rollback/commit handling,
+        // so they cannot be a part of BackupableData
+        Backupable<BandwidthGroupList>    llBandwidthGroups;
+    };
 
-private:
-    struct Data;
     Data *m;
 };
 
diff --git a/src/VBox/Main/include/BandwidthGroupImpl.h b/src/VBox/Main/include/BandwidthGroupImpl.h
index dbcf159..784af40 100644
--- a/src/VBox/Main/include/BandwidthGroupImpl.h
+++ b/src/VBox/Main/include/BandwidthGroupImpl.h
@@ -1,10 +1,11 @@
+/* $Id: BandwidthGroupImpl.h $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,26 +19,19 @@
 #ifndef ____H_BANDWIDTHGROUPIMPL
 #define ____H_BANDWIDTHGROUPIMPL
 
-#include "VirtualBoxBase.h"
 #include "BandwidthControlImpl.h"
+#include "BandwidthGroupWrap.h"
+
 
 class ATL_NO_VTABLE BandwidthGroup :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IBandwidthGroup)
+    public BandwidthGroupWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(BandwidthGroup, IBandwidthGroup)
-
-    DECLARE_NOT_AGGREGATABLE(BandwidthGroup)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-    BEGIN_COM_MAP(BandwidthGroup)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IBandwidthGroup)
-    END_COM_MAP()
+    DECLARE_EMPTY_CTOR_DTOR(BandwidthGroup)
 
-    BandwidthGroup() { };
-    ~BandwidthGroup() { };
+    HRESULT FinalConstruct();
+    void FinalRelease();
 
     // public initializer/uninitializer for internal purposes only
     HRESULT init(BandwidthControl *aParent,
@@ -48,32 +42,62 @@ public:
     HRESULT initCopy(BandwidthControl *aParent, BandwidthGroup *aThat);
     void uninit();
 
-    HRESULT FinalConstruct();
-    void FinalRelease();
-
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMGETTER(Type))(BandwidthGroupType_T *aType);
-    STDMETHOD(COMGETTER(Reference))(ULONG *aReferences);
-    STDMETHOD(COMGETTER(MaxBytesPerSec))(LONG64 *aMaxBytesPerSec);
-    STDMETHOD(COMSETTER(MaxBytesPerSec))(LONG64 aMaxBytesPerSec);
-
     // public methods only for internal purposes
-    void rollback();
-    void commit();
-    void unshare();
+    void i_rollback();
+    void i_commit();
+    void i_unshare();
+    void i_reference();
+    void i_release();
+
+    ComObjPtr<BandwidthGroup> i_getPeer() { return m->pPeer; }
+    const Utf8Str &i_getName() const { return m->bd->strName; }
+    BandwidthGroupType_T i_getType() const { return m->bd->enmType; }
+    LONG64 i_getMaxBytesPerSec() const { return m->bd->aMaxBytesPerSec; }
+    ULONG i_getReferences() const { return m->bd->cReferences; }
 
-    const Utf8Str &getName() const;
-    BandwidthGroupType_T getType() const;
-    LONG64 getMaxBytesPerSec() const;
-    ULONG getReferences() const;
-
-    void reference();
-    void release();
+private:
 
-    ComObjPtr<BandwidthGroup> getPeer();
+    // wrapped IBandwidthGroup properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getType(BandwidthGroupType_T *aType);
+    HRESULT getReference(ULONG *aReferences);
+    HRESULT getMaxBytesPerSec(LONG64 *aMaxBytesPerSec);
+    HRESULT setMaxBytesPerSec(LONG64 MaxBytesPerSec);
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ////
+    //// private member data definition
+    ////
+    //////////////////////////////////////////////////////////////////////////////////
+    //
+    struct BackupableBandwidthGroupData
+    {
+       BackupableBandwidthGroupData()
+           : enmType(BandwidthGroupType_Null),
+             aMaxBytesPerSec(0),
+             cReferences(0)
+       { }
+
+       Utf8Str                 strName;
+       BandwidthGroupType_T    enmType;
+       LONG64                  aMaxBytesPerSec;
+       ULONG                   cReferences;
+    };
+
+    struct Data
+    {
+        Data(BandwidthControl * const aBandwidthControl)
+            : pParent(aBandwidthControl),
+              pPeer(NULL)
+        { }
+
+       BandwidthControl * const    pParent;
+       ComObjPtr<BandwidthGroup>   pPeer;
+
+       // use the XML settings structure in the members for simplicity
+       Backupable<BackupableBandwidthGroupData> bd;
+    };
 
-private:
-    struct Data;
     Data *m;
 };
 
diff --git a/src/VBox/Main/include/BusAssignmentManager.h b/src/VBox/Main/include/BusAssignmentManager.h
index 1938fe7..c0029cc 100644
--- a/src/VBox/Main/include/BusAssignmentManager.h
+++ b/src/VBox/Main/include/BusAssignmentManager.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -22,6 +22,7 @@
 #include "VBox/types.h"
 #include "VBox/pci.h"
 #include "VirtualBoxBase.h"
+#include <vector>
 
 class BusAssignmentManager
 {
@@ -32,14 +33,16 @@ private:
     BusAssignmentManager();
     virtual ~BusAssignmentManager();
 
-    HRESULT assignPCIDeviceImpl(const char* pszDevName, PCFGMNODE pCfg, PCIBusAddress& GuestAddress, PCIBusAddress HostAddress, bool fGuestAddressRequired = false);
+    HRESULT assignPCIDeviceImpl(const char* pszDevName, PCFGMNODE pCfg, PCIBusAddress& GuestAddress,
+                                PCIBusAddress HostAddress, bool fGuestAddressRequired = false);
 
 public:
     static BusAssignmentManager* createInstance(ChipsetType_T chipsetType);
     virtual void AddRef();
     virtual void Release();
 
-    virtual HRESULT assignHostPCIDevice(const char* pszDevName, PCFGMNODE pCfg, PCIBusAddress HostAddress, PCIBusAddress& GuestAddress, bool fAddressRequired = false)
+    virtual HRESULT assignHostPCIDevice(const char* pszDevName, PCFGMNODE pCfg, PCIBusAddress HostAddress,
+                                        PCIBusAddress& GuestAddress, bool fAddressRequired = false)
     {
         return assignPCIDeviceImpl(pszDevName, pCfg, GuestAddress, HostAddress, fAddressRequired);
     }
@@ -62,7 +65,7 @@ public:
         PCIBusAddress Address;
         return findPCIAddress(pszDevName, iInstance, Address);
     }
-    virtual void listAttachedPCIDevices(ComSafeArrayOut(IPCIDeviceAttachment*, aAttached));
+    virtual void listAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttached);
 };
 
 #endif //  __BusAssignmentManager_h
diff --git a/src/VBox/Main/include/ConsoleImpl.h b/src/VBox/Main/include/ConsoleImpl.h
index 46217f1..f98d0d2 100644
--- a/src/VBox/Main/include/ConsoleImpl.h
+++ b/src/VBox/Main/include/ConsoleImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2005-2014 Oracle Corporation
+ * Copyright (C) 2005-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -21,6 +21,8 @@
 #include "VirtualBoxBase.h"
 #include "VBox/com/array.h"
 #include "EventImpl.h"
+#include "SecretKeyStore.h"
+#include "ConsoleWrap.h"
 
 class Guest;
 class Keyboard;
@@ -33,7 +35,12 @@ class RemoteUSBDevice;
 class SharedFolder;
 class VRDEServerInfo;
 class EmulatedUSB;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+class AudioVRDE;
+#else
 class AudioSniffer;
+#endif
+class AudioVRDE;
 class Nvram;
 #ifdef VBOX_WITH_USB_CARDREADER
 class UsbCardReader;
@@ -49,6 +56,7 @@ class ExtPackManager;
 class VMMDevMouseInterface;
 class DisplayMouseInterface;
 
+#include <iprt/uuid.h>
 #include <iprt/memsafer.h>
 #include <VBox/RemoteDesktop/VRDE.h>
 #include <VBox/vmm/pdmdrv.h>
@@ -92,35 +100,23 @@ typedef struct VUSBIRHCONFIG *PVUSBIRHCONFIG;
 class ConsoleMouseInterface
 {
 public:
-    virtual VMMDevMouseInterface  *getVMMDevMouseInterface()  = 0;
-    virtual DisplayMouseInterface *getDisplayMouseInterface() = 0;
-    virtual void onMouseCapabilityChange(BOOL supportsAbsolute,
-                                         BOOL supportsRelative,
-                                         BOOL supportsMT,
-                                         BOOL needsHostCursor) = 0;
+    virtual VMMDevMouseInterface  *i_getVMMDevMouseInterface(){return NULL;}
+    virtual DisplayMouseInterface *i_getDisplayMouseInterface(){return NULL;}
+    virtual void i_onMouseCapabilityChange(BOOL supportsAbsolute,
+                                           BOOL supportsRelative,
+                                           BOOL supportsMT,
+                                           BOOL needsHostCursor){NOREF(supportsAbsolute); NOREF(supportsRelative); NOREF(supportsMT); NOREF(needsHostCursor);}
 };
 
 /** IConsole implementation class */
 class ATL_NO_VTABLE Console :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IConsole), public ConsoleMouseInterface
+    public ConsoleWrap,
+    public ConsoleMouseInterface
 {
-    Q_OBJECT
 
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Console, IConsole)
-
-    DECLARE_NOT_AGGREGATABLE(Console)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Console)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IConsole)
-    END_COM_MAP()
-
-    Console();
-    ~Console();
+    DECLARE_EMPTY_CTOR_DTOR(Console)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -129,53 +125,6 @@ public:
     HRESULT init(IMachine *aMachine, IInternalMachineControl *aControl, LockType_T aLockType);
     void uninit();
 
-    // IConsole properties
-    STDMETHOD(COMGETTER(Machine))(IMachine **aMachine);
-    STDMETHOD(COMGETTER(State))(MachineState_T *aMachineState);
-    STDMETHOD(COMGETTER(Guest))(IGuest **aGuest);
-    STDMETHOD(COMGETTER(Keyboard))(IKeyboard **aKeyboard);
-    STDMETHOD(COMGETTER(Mouse))(IMouse **aMouse);
-    STDMETHOD(COMGETTER(Display))(IDisplay **aDisplay);
-    STDMETHOD(COMGETTER(Debugger))(IMachineDebugger **aDebugger);
-    STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut(IUSBDevice *, aUSBDevices));
-    STDMETHOD(COMGETTER(RemoteUSBDevices))(ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices));
-    STDMETHOD(COMGETTER(VRDEServerInfo))(IVRDEServerInfo **aVRDEServerInfo);
-    STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders));
-    STDMETHOD(COMGETTER(EventSource)) (IEventSource ** aEventSource);
-    STDMETHOD(COMGETTER(AttachedPCIDevices))(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments));
-    STDMETHOD(COMGETTER(UseHostClipboard))(BOOL *aUseHostClipboard);
-    STDMETHOD(COMSETTER(UseHostClipboard))(BOOL aUseHostClipboard);
-    STDMETHOD(COMGETTER(EmulatedUSB))(IEmulatedUSB **aEmulatedUSB);
-
-    // IConsole methods
-    STDMETHOD(PowerUp)(IProgress **aProgress);
-    STDMETHOD(PowerUpPaused)(IProgress **aProgress);
-    STDMETHOD(PowerDown)(IProgress **aProgress);
-    STDMETHOD(Reset)();
-    STDMETHOD(Pause)();
-    STDMETHOD(Resume)();
-    STDMETHOD(PowerButton)();
-    STDMETHOD(SleepButton)();
-    STDMETHOD(GetPowerButtonHandled)(BOOL *aHandled);
-    STDMETHOD(GetGuestEnteredACPIMode)(BOOL *aEntered);
-    STDMETHOD(SaveState)(IProgress **aProgress);
-    STDMETHOD(AdoptSavedState)(IN_BSTR aSavedStateFile);
-    STDMETHOD(DiscardSavedState)(BOOL aRemoveFile);
-    STDMETHOD(GetDeviceActivity)(DeviceType_T aDeviceType,
-                                DeviceActivity_T *aDeviceActivity);
-    STDMETHOD(AttachUSBDevice)(IN_BSTR aId);
-    STDMETHOD(DetachUSBDevice)(IN_BSTR aId, IUSBDevice **aDevice);
-    STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IUSBDevice **aDevice);
-    STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IUSBDevice **aDevice);
-    STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
-    STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
-    STDMETHOD(TakeSnapshot)(IN_BSTR aName, IN_BSTR aDescription,
-                            IProgress **aProgress);
-    STDMETHOD(DeleteSnapshot)(IN_BSTR aId, IProgress **aProgress);
-    STDMETHOD(DeleteSnapshotAndAllChildren)(IN_BSTR aId, IProgress **aProgress);
-    STDMETHOD(DeleteSnapshotRange)(IN_BSTR aStartId, IN_BSTR aEndId, IProgress **aProgress);
-    STDMETHOD(RestoreSnapshot)(ISnapshot *aSnapshot, IProgress **aProgress);
-    STDMETHOD(Teleport)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress);
 
     // public methods for internal purposes only
 
@@ -184,130 +133,146 @@ public:
      *  called only by the VM execution thread.
      */
 
-    Guest *getGuest() const { return mGuest; }
-    Keyboard *getKeyboard() const { return mKeyboard; }
-    Mouse *getMouse() const { return mMouse; }
-    Display *getDisplay() const { return mDisplay; }
-    MachineDebugger *getMachineDebugger() const { return mDebugger; }
-    AudioSniffer *getAudioSniffer() const { return mAudioSniffer; }
+    Guest *i_getGuest() const { return mGuest; }
+    Keyboard *i_getKeyboard() const { return mKeyboard; }
+    Mouse *i_getMouse() const { return mMouse; }
+    Display *i_getDisplay() const { return mDisplay; }
+    MachineDebugger *i_getMachineDebugger() const { return mDebugger; }
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    AudioVRDE *i_getAudioVRDE() const { return mAudioVRDE; }
+#else
+    AudioSniffer *i_getAudioSniffer() const { return mAudioSniffer; }
+#endif
 
-    const ComPtr<IMachine> &machine() const { return mMachine; }
+    const ComPtr<IMachine> &i_machine() const { return mMachine; }
+    const Bstr &i_getId() const { return mstrUuid; }
 
-    bool useHostClipboard() { return mfUseHostClipboard; }
+    bool i_useHostClipboard() { return mfUseHostClipboard; }
 
     /** Method is called only from ConsoleVRDPServer */
-    IVRDEServer *getVRDEServer() const { return mVRDEServer; }
+    IVRDEServer *i_getVRDEServer() const { return mVRDEServer; }
 
-    ConsoleVRDPServer *consoleVRDPServer() const { return mConsoleVRDPServer; }
+    ConsoleVRDPServer *i_consoleVRDPServer() const { return mConsoleVRDPServer; }
 
-    HRESULT updateMachineState(MachineState_T aMachineState);
+    HRESULT i_updateMachineState(MachineState_T aMachineState);
+    HRESULT i_getNominalState(MachineState_T &aNominalState);
 
     // events from IInternalSessionControl
-    HRESULT onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter);
-    HRESULT onSerialPortChange(ISerialPort *aSerialPort);
-    HRESULT onParallelPortChange(IParallelPort *aParallelPort);
-    HRESULT onStorageControllerChange();
-    HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
-    HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
-    HRESULT onCPUExecutionCapChange(ULONG aExecutionCap);
-    HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode);
-    HRESULT onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode);
-    HRESULT onVRDEServerChange(BOOL aRestart);
-    HRESULT onVideoCaptureChange();
-    HRESULT onUSBControllerChange();
-    HRESULT onSharedFolderChange(BOOL aGlobal);
-    HRESULT onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
-    HRESULT onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
-    HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
-    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
-    HRESULT onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal);
-
-    HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
-    HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
-    HRESULT enumerateGuestProperties(IN_BSTR aPatterns,
-                                     ComSafeArrayOut(BSTR, aNames),
-                                     ComSafeArrayOut(BSTR, aValues),
-                                     ComSafeArrayOut(LONG64, aTimestamps),
-                                     ComSafeArrayOut(BSTR, aFlags));
-    HRESULT onlineMergeMedium(IMediumAttachment *aMediumAttachment,
-                              ULONG aSourceIdx, ULONG aTargetIdx,
-                              IProgress *aProgress);
-    int hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName);
-    VMMDev *getVMMDev() { return m_pVMMDev; }
-    AudioSniffer *getAudioSniffer() { return mAudioSniffer; }
+    HRESULT i_onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter);
+    HRESULT i_onSerialPortChange(ISerialPort *aSerialPort);
+    HRESULT i_onParallelPortChange(IParallelPort *aParallelPort);
+    HRESULT i_onStorageControllerChange();
+    HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
+    HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove);
+    HRESULT i_onCPUExecutionCapChange(ULONG aExecutionCap);
+    HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode);
+    HRESULT i_onDnDModeChange(DnDMode_T aDnDMode);
+    HRESULT i_onVRDEServerChange(BOOL aRestart);
+    HRESULT i_onVideoCaptureChange();
+    HRESULT i_onUSBControllerChange();
+    HRESULT i_onSharedFolderChange(BOOL aGlobal);
+    HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs,
+                                const Utf8Str &aCaptureFilename);
+    HRESULT i_onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
+    HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
+    HRESULT i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
+    HRESULT i_onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal);
+
+    HRESULT i_getGuestProperty(const Utf8Str &aName, Utf8Str *aValue, LONG64 *aTimestamp, Utf8Str *aFlags);
+    HRESULT i_setGuestProperty(const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags);
+    HRESULT i_deleteGuestProperty(const Utf8Str &aName);
+    HRESULT i_enumerateGuestProperties(const Utf8Str &aPatterns,
+                                       std::vector<Utf8Str> &aNames,
+                                       std::vector<Utf8Str> &aValues,
+                                       std::vector<LONG64>  &aTimestamps,
+                                       std::vector<Utf8Str> &aFlags);
+    HRESULT i_onlineMergeMedium(IMediumAttachment *aMediumAttachment,
+                                ULONG aSourceIdx, ULONG aTargetIdx,
+                                IProgress *aProgress);
+    HRESULT i_reconfigureMediumAttachments(const std::vector<ComPtr<IMediumAttachment> > &aAttachments);
+    int i_hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName);
+    VMMDev *i_getVMMDev() { return m_pVMMDev; }
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    AudioVRDE *i_getAudioVRDE() { return mAudioVRDE; }
+#else
+    AudioSniffer *i_getAudioSniffer() { return mAudioSniffer; }
+#endif
+
 #ifdef VBOX_WITH_EXTPACK
-    ExtPackManager *getExtPackManager();
+    ExtPackManager *i_getExtPackManager();
 #endif
-    EventSource *getEventSource() { return mEventSource; }
+    EventSource *i_getEventSource() { return mEventSource; }
 #ifdef VBOX_WITH_USB_CARDREADER
-    UsbCardReader *getUsbCardReader() { return mUsbCardReader; }
+    UsbCardReader *i_getUsbCardReader() { return mUsbCardReader; }
 #endif
 
-    int VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
-    void VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus);
-    void VRDPClientConnect(uint32_t u32ClientId);
-    void VRDPClientDisconnect(uint32_t u32ClientId, uint32_t fu32Intercepted);
-    void VRDPInterceptAudio(uint32_t u32ClientId);
-    void VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept);
-    void VRDPInterceptClipboard(uint32_t u32ClientId);
-
-    void processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt);
-    void reportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
-                               ULONG aCpuKernel, ULONG aCpuIdle,
-                               ULONG aMemTotal, ULONG aMemFree,
-                               ULONG aMemBalloon, ULONG aMemShared,
-                               ULONG aMemCache, ULONG aPageTotal,
-                               ULONG aAllocVMM, ULONG aFreeVMM,
-                               ULONG aBalloonedVMM, ULONG aSharedVMM,
-                               ULONG aVmNetRx, ULONG aVmNetTx)
+    int i_VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain);
+    void i_VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus);
+    void i_VRDPClientConnect(uint32_t u32ClientId);
+    void i_VRDPClientDisconnect(uint32_t u32ClientId, uint32_t fu32Intercepted);
+    void i_VRDPInterceptAudio(uint32_t u32ClientId);
+    void i_VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept);
+    void i_VRDPInterceptClipboard(uint32_t u32ClientId);
+
+    void i_processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt);
+    void i_reportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
+                              ULONG aCpuKernel, ULONG aCpuIdle,
+                              ULONG aMemTotal, ULONG aMemFree,
+                              ULONG aMemBalloon, ULONG aMemShared,
+                              ULONG aMemCache, ULONG aPageTotal,
+                              ULONG aAllocVMM, ULONG aFreeVMM,
+                              ULONG aBalloonedVMM, ULONG aSharedVMM,
+                              ULONG aVmNetRx, ULONG aVmNetTx)
     {
         mControl->ReportVmStatistics(aValidStats, aCpuUser, aCpuKernel, aCpuIdle,
                                      aMemTotal, aMemFree, aMemBalloon, aMemShared,
                                      aMemCache, aPageTotal, aAllocVMM, aFreeVMM,
                                      aBalloonedVMM, aSharedVMM, aVmNetRx, aVmNetTx);
     }
-    void enableVMMStatistics(BOOL aEnable);
+    void i_enableVMMStatistics(BOOL aEnable);
 
-    HRESULT pause(Reason_T aReason);
-    HRESULT resume(Reason_T aReason);
-    HRESULT saveState(Reason_T aReason, IProgress **aProgress);
+    HRESULT i_pause(Reason_T aReason);
+    HRESULT i_resume(Reason_T aReason, AutoWriteLock &alock);
+    HRESULT i_saveState(Reason_T aReason, const ComPtr<IProgress> &aProgress, const Utf8Str &aStateFilePath, bool fPauseVM, bool &fLeftPaused);
+    HRESULT i_cancelSaveState();
 
     // callback callers (partly; for some events console callbacks are notified
     // directly from IInternalSessionControl event handlers declared above)
-    void onMousePointerShapeChange(bool fVisible, bool fAlpha,
-                                   uint32_t xHot, uint32_t yHot,
-                                   uint32_t width, uint32_t height,
-                                   ComSafeArrayIn(uint8_t, aShape));
-    void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
-                                 BOOL supportsMT, BOOL needsHostCursor);
-    void onStateChange(MachineState_T aMachineState);
-    void onAdditionsStateChange();
-    void onAdditionsOutdated();
-    void onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
-    void onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
-                                IVirtualBoxErrorInfo *aError);
-    void onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
-    HRESULT onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
-    void onVRDEServerInfoChange();
+    void i_onMousePointerShapeChange(bool fVisible, bool fAlpha,
+                                     uint32_t xHot, uint32_t yHot,
+                                     uint32_t width, uint32_t height,
+                                     const uint8_t *pu8Shape,
+                                     uint32_t cbShape);
+    void i_onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
+                                   BOOL supportsMT, BOOL needsHostCursor);
+    void i_onStateChange(MachineState_T aMachineState);
+    void i_onAdditionsStateChange();
+    void i_onAdditionsOutdated();
+    void i_onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
+    void i_onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
+                                  IVirtualBoxErrorInfo *aError);
+    void i_onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage);
+    HRESULT i_onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
+    void i_onVRDEServerInfoChange();
     HRESULT i_sendACPIMonitorHotPlugEvent();
 
     static const PDMDRVREG DrvStatusReg;
 
-    static HRESULT setErrorStatic(HRESULT aResultCode, const char *pcsz, ...);
-    HRESULT setInvalidMachineStateError();
+    static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *pcsz, ...);
+    HRESULT i_setInvalidMachineStateError();
 
-    static const char *convertControllerTypeToDev(StorageControllerType_T enmCtrlType);
-    static HRESULT convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
+    static const char *i_convertControllerTypeToDev(StorageControllerType_T enmCtrlType);
+    static HRESULT i_convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
     // Called from event listener
-    HRESULT onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
-                                 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
-    HRESULT onNATDnsChanged();
+    HRESULT i_onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
+                                      NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
+    HRESULT i_onNATDnsChanged();
 
     // Mouse interface
-    VMMDevMouseInterface *getVMMDevMouseInterface();
-    DisplayMouseInterface *getDisplayMouseInterface();
+    VMMDevMouseInterface *i_getVMMDevMouseInterface();
+    DisplayMouseInterface *i_getDisplayMouseInterface();
 
-    EmulatedUSB *getEmulatedUSB(void) { return mEmulatedUSB; }
+    EmulatedUSB *i_getEmulatedUSB(void) { return mEmulatedUSB; }
 
     /**
      * Sets the disk encryption keys.
@@ -323,10 +288,65 @@ public:
      *                    the curly braces.
      *            - dek: The data encryption key in base64 encoding
      */
-    HRESULT setDiskEncryptionKeys(const Utf8Str &strCfg);
+    HRESULT i_setDiskEncryptionKeys(const Utf8Str &strCfg);
 
 private:
 
+    // wraped IConsole properties
+    HRESULT getMachine(ComPtr<IMachine> &aMachine);
+    HRESULT getState(MachineState_T *aState);
+    HRESULT getGuest(ComPtr<IGuest> &aGuest);
+    HRESULT getKeyboard(ComPtr<IKeyboard> &aKeyboard);
+    HRESULT getMouse(ComPtr<IMouse> &aMouse);
+    HRESULT getDisplay(ComPtr<IDisplay> &aDisplay);
+    HRESULT getDebugger(ComPtr<IMachineDebugger> &aDebugger);
+    HRESULT getUSBDevices(std::vector<ComPtr<IUSBDevice> > &aUSBDevices);
+    HRESULT getRemoteUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aRemoteUSBDevices);
+    HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
+    HRESULT getVRDEServerInfo(ComPtr<IVRDEServerInfo> &aVRDEServerInfo);
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+    HRESULT getAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttachedPCIDevices);
+    HRESULT getUseHostClipboard(BOOL *aUseHostClipboard);
+    HRESULT setUseHostClipboard(BOOL aUseHostClipboard);
+    HRESULT getEmulatedUSB(ComPtr<IEmulatedUSB> &aEmulatedUSB);
+
+    // wraped IConsole methods
+    HRESULT powerUp(ComPtr<IProgress> &aProgress);
+    HRESULT powerUpPaused(ComPtr<IProgress> &aProgress);
+    HRESULT powerDown(ComPtr<IProgress> &aProgress);
+    HRESULT reset();
+    HRESULT pause();
+    HRESULT resume();
+    HRESULT powerButton();
+    HRESULT sleepButton();
+    HRESULT getPowerButtonHandled(BOOL *aHandled);
+    HRESULT getGuestEnteredACPIMode(BOOL *aEntered);
+    HRESULT getDeviceActivity(const std::vector<DeviceType_T> &aType,
+                              std::vector<DeviceActivity_T> &aActivity);
+    HRESULT attachUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename);
+    HRESULT detachUSBDevice(const com::Guid &aId,
+                            ComPtr<IUSBDevice> &aDevice);
+    HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
+                                   ComPtr<IUSBDevice> &aDevice);
+    HRESULT findUSBDeviceById(const com::Guid &aId,
+                              ComPtr<IUSBDevice> &aDevice);
+    HRESULT createSharedFolder(const com::Utf8Str &aName,
+                               const com::Utf8Str &aHostPath,
+                               BOOL aWritable,
+                               BOOL aAutomount);
+    HRESULT removeSharedFolder(const com::Utf8Str &aName);
+    HRESULT teleport(const com::Utf8Str &aHostname,
+                     ULONG aTcpport,
+                     const com::Utf8Str &aPassword,
+                     ULONG aMaxDowntime,
+                     ComPtr<IProgress> &aProgress);
+    HRESULT addDiskEncryptionPassword(const com::Utf8Str &aId, const com::Utf8Str &aPassword,
+                                      BOOL aClearOnSuspend);
+    HRESULT addDiskEncryptionPasswords(const std::vector<com::Utf8Str> &aIds, const std::vector<com::Utf8Str> &aPasswords,
+                                      BOOL aClearOnSuspend);
+    HRESULT removeDiskEncryptionPassword(const com::Utf8Str &aId);
+    HRESULT clearAllDiskEncryptionPasswords();
+
     void notifyNatDnsChange(PUVM pUVM, const char *pszDevice, ULONG ulInstanceMax);
 
     /**
@@ -340,7 +360,7 @@ private:
         AutoVMCallerBase(Console *aThat) : mThat(aThat), mRC(E_FAIL)
         {
             Assert(aThat);
-            mRC = aThat->addVMCaller(taQuiet, taAllowNullVM);
+            mRC = aThat->i_addVMCaller(taQuiet, taAllowNullVM);
         }
         ~AutoVMCallerBase()
         {
@@ -357,7 +377,7 @@ private:
         void addYY()
         {
             AssertReturnVoid(!SUCCEEDED(mRC));
-            mRC = mThat->addVMCaller(taQuiet, taAllowNullVM);
+            mRC = mThat->i_addVMCaller(taQuiet, taAllowNullVM);
         }
         /** Returns the result of Console::addVMCaller() */
         HRESULT rc() const { return mRC; }
@@ -369,7 +389,7 @@ private:
         {
             if (SUCCEEDED(mRC))
             {
-                mThat->releaseVMCaller();
+                mThat->i_releaseVMCaller();
                 mRC = E_FAIL;
             }
         }
@@ -437,7 +457,7 @@ private:
         SafeVMPtrBase(Console *aThat) : Base(aThat), mRC(E_FAIL), mpUVM(NULL)
         {
             if (Base::isOk())
-                mRC = aThat->safeVMPtrRetainer(&mpUVM, taQuiet);
+                mRC = aThat->i_safeVMPtrRetainer(&mpUVM, taQuiet);
         }
         ~SafeVMPtrBase()
         {
@@ -462,7 +482,7 @@ private:
         {
             if (SUCCEEDED(mRC))
             {
-                Base::mThat->safeVMPtrReleaser(&mpUVM);
+                Base::mThat->i_safeVMPtrReleaser(&mpUVM);
                 mRC = E_FAIL;
             }
             Base::doRelease();
@@ -538,238 +558,220 @@ public:
     };
 
     /**
-     * Class for managing cryptographic keys.
-     * @ŧodo: Replace with a keystore implementation once it is ready.
+     * Class for managing emulated USB MSDs.
      */
-    class SecretKey
+    class USBStorageDevice
     {
-        public:
-            SecretKey() { }
-
-            SecretKey(void *pvKey, size_t cbKey)
-               : m_cRefs(0),
-                 m_pvKey(pvKey),
-                 m_cbKey(cbKey)
-            { }
-
-            ~SecretKey()
-            {
-                RTMemSaferFree(m_pvKey, m_cbKey);
-                m_cRefs = 0;
-                m_pvKey = NULL;
-                m_cbKey = 0;
-            }
-
-            /** Reference counter of the key. */
-            volatile uint32_t m_cRefs;
-            /** Key material. */
-            void    *m_pvKey;
-            /** Size of the key in bytes. */
-            size_t   m_cbKey;
+    public:
+        USBStorageDevice()
+        { }
+        /** The UUID associated with the USB device. */
+        RTUUID   mUuid;
+        /** Port of the storage device. */
+        LONG     iPort;
     };
 
     typedef std::map<Utf8Str, ComObjPtr<SharedFolder> > SharedFolderMap;
     typedef std::map<Utf8Str, SharedFolderData> SharedFolderDataMap;
     typedef std::map<Utf8Str, ComPtr<IMediumAttachment> > MediumAttachmentMap;
-    typedef std::map<Utf8Str, SecretKey *> SecretKeyMap;
+    typedef std::list <USBStorageDevice> USBStorageDeviceList;
 
 private:
 
     typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList;
     typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList;
 
-    HRESULT addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
-    void    releaseVMCaller();
-    HRESULT safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);
-    void    safeVMPtrReleaser(PUVM *a_ppUVM);
+    HRESULT i_addVMCaller(bool aQuiet = false, bool aAllowNullVM = false);
+    void    i_releaseVMCaller();
+    HRESULT i_safeVMPtrRetainer(PUVM *a_ppUVM, bool aQuiet);
+    void    i_safeVMPtrReleaser(PUVM *a_ppUVM);
 
-    HRESULT consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
+    HRESULT i_consoleInitReleaseLog(const ComPtr<IMachine> aMachine);
 
-    HRESULT powerUp(IProgress **aProgress, bool aPaused);
-    HRESULT powerDown(IProgress *aProgress = NULL);
+    HRESULT i_powerUp(IProgress **aProgress, bool aPaused);
+    HRESULT i_powerDown(IProgress *aProgress = NULL);
 
 /* Note: FreeBSD needs this whether netflt is used or not. */
 #if ((defined(RT_OS_LINUX) && !defined(VBOX_WITH_NETFLT)) || defined(RT_OS_FREEBSD))
-    HRESULT attachToTapInterface(INetworkAdapter *networkAdapter);
-    HRESULT detachFromTapInterface(INetworkAdapter *networkAdapter);
+    HRESULT i_attachToTapInterface(INetworkAdapter *networkAdapter);
+    HRESULT i_detachFromTapInterface(INetworkAdapter *networkAdapter);
 #endif
-    HRESULT powerDownHostInterfaces();
+    HRESULT i_powerDownHostInterfaces();
 
-    HRESULT setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
-    HRESULT setMachineStateLocally(MachineState_T aMachineState)
+    HRESULT i_setMachineState(MachineState_T aMachineState, bool aUpdateServer = true);
+    HRESULT i_setMachineStateLocally(MachineState_T aMachineState)
     {
-        return setMachineState(aMachineState, false /* aUpdateServer */);
+        return i_setMachineState(aMachineState, false /* aUpdateServer */);
     }
 
-    HRESULT findSharedFolder(const Utf8Str &strName,
-                             ComObjPtr<SharedFolder> &aSharedFolder,
-                             bool aSetError = false);
-
-    HRESULT fetchSharedFolders(BOOL aGlobal);
-    bool findOtherSharedFolder(const Utf8Str &straName,
-                               SharedFolderDataMap::const_iterator &aIt);
-
-    HRESULT createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
-    HRESULT removeSharedFolder(const Utf8Str &strName);
-
-    HRESULT suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
-    void    resumeAfterConfigChange(PUVM pUVM);
-
-    static DECLCALLBACK(int) configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
-    int configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);
-    int configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
-    int configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
-
-    int configGraphicsController(PCFGMNODE pDevices,
-                                 const GraphicsControllerType_T graphicsController,
-                                 BusAssignmentManager *pBusMgr,
-                                 const ComPtr<IMachine> &pMachine,
-                                 const ComPtr<IBIOSSettings> &biosSettings,
-                                 bool fHMEnabled);
-    int configMediumAttachment(PCFGMNODE pCtlInst,
-                               const char *pcszDevice,
-                               unsigned uInstance,
-                               StorageBus_T enmBus,
-                               bool fUseHostIOCache,
-                               bool fBuiltinIoCache,
-                               bool fSetupMerge,
-                               unsigned uMergeSource,
-                               unsigned uMergeTarget,
-                               IMediumAttachment *pMediumAtt,
-                               MachineState_T aMachineState,
-                               HRESULT *phrc,
-                               bool fAttachDetach,
-                               bool fForceUnmount,
-                               bool fHotplug,
-                               PUVM pUVM,
-                               DeviceType_T *paLedDevType,
-                               PCFGMNODE *ppLunL0);
-    int configMedium(PCFGMNODE pLunL0,
-                     bool fPassthrough,
-                     DeviceType_T enmType,
-                     bool fUseHostIOCache,
-                     bool fBuiltinIoCache,
-                     bool fSetupMerge,
-                     unsigned uMergeSource,
-                     unsigned uMergeTarget,
-                     const char *pcszBwGroup,
-                     bool fDiscard,
-                     IMedium *pMedium,
-                     MachineState_T aMachineState,
-                     HRESULT *phrc);
-    int configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHostIP);
-    static DECLCALLBACK(int) reconfigureMediumAttachment(Console *pThis,
-                                                         PUVM pUVM,
-                                                         const char *pcszDevice,
-                                                         unsigned uInstance,
-                                                         StorageBus_T enmBus,
-                                                         bool fUseHostIOCache,
-                                                         bool fBuiltinIoCache,
-                                                         bool fSetupMerge,
-                                                         unsigned uMergeSource,
-                                                         unsigned uMergeTarget,
-                                                         IMediumAttachment *aMediumAtt,
-                                                         MachineState_T aMachineState,
-                                                         HRESULT *phrc);
-    static DECLCALLBACK(int) changeRemovableMedium(Console *pThis,
+    HRESULT i_findSharedFolder(const Utf8Str &strName,
+                               ComObjPtr<SharedFolder> &aSharedFolder,
+                               bool aSetError = false);
+
+    HRESULT i_fetchSharedFolders(BOOL aGlobal);
+    bool    i_findOtherSharedFolder(const Utf8Str &straName,
+                                    SharedFolderDataMap::const_iterator &aIt);
+
+    HRESULT i_createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData);
+    HRESULT i_removeSharedFolder(const Utf8Str &strName);
+
+    HRESULT i_suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
+    void    i_resumeAfterConfigChange(PUVM pUVM);
+
+    static DECLCALLBACK(int) i_configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
+    int i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock);
+    int i_configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine);
+    int i_configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine);
+
+    int i_configGraphicsController(PCFGMNODE pDevices,
+                                   const GraphicsControllerType_T graphicsController,
+                                   BusAssignmentManager *pBusMgr,
+                                   const ComPtr<IMachine> &ptrMachine,
+                                   const ComPtr<IBIOSSettings> &ptrBiosSettings,
+                                   bool fHMEnabled);
+    int i_configMediumAttachment(const char *pcszDevice,
+                                 unsigned uInstance,
+                                 StorageBus_T enmBus,
+                                 bool fUseHostIOCache,
+                                 bool fBuiltinIoCache,
+                                 bool fSetupMerge,
+                                 unsigned uMergeSource,
+                                 unsigned uMergeTarget,
+                                 IMediumAttachment *pMediumAtt,
+                                 MachineState_T aMachineState,
+                                 HRESULT *phrc,
+                                 bool fAttachDetach,
+                                 bool fForceUnmount,
+                                 bool fHotplug,
+                                 PUVM pUVM,
+                                 DeviceType_T *paLedDevType,
+                                 PCFGMNODE *ppLunL0);
+    int i_configMedium(PCFGMNODE pLunL0,
+                       bool fPassthrough,
+                       DeviceType_T enmType,
+                       bool fUseHostIOCache,
+                       bool fBuiltinIoCache,
+                       bool fSetupMerge,
+                       unsigned uMergeSource,
+                       unsigned uMergeTarget,
+                       const char *pcszBwGroup,
+                       bool fDiscard,
+                       IMedium *pMedium,
+                       MachineState_T aMachineState,
+                       HRESULT *phrc);
+    int i_configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHostIP, bool *pfEncrypted);
+    static DECLCALLBACK(int) i_reconfigureMediumAttachment(Console *pThis,
+                                                           PUVM pUVM,
+                                                           const char *pcszDevice,
+                                                           unsigned uInstance,
+                                                           StorageBus_T enmBus,
+                                                           bool fUseHostIOCache,
+                                                           bool fBuiltinIoCache,
+                                                           bool fSetupMerge,
+                                                           unsigned uMergeSource,
+                                                           unsigned uMergeTarget,
+                                                           IMediumAttachment *aMediumAtt,
+                                                           MachineState_T aMachineState,
+                                                           HRESULT *phrc);
+    static DECLCALLBACK(int) i_changeRemovableMedium(Console *pThis,
+                                                     PUVM pUVM,
+                                                     const char *pcszDevice,
+                                                     unsigned uInstance,
+                                                     StorageBus_T enmBus,
+                                                     bool fUseHostIOCache,
+                                                     IMediumAttachment *aMediumAtt,
+                                                     bool fForce);
+
+    HRESULT i_attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
+    void i_attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
+                              uint64_t uFirst, uint64_t uLast,
+                              Console::MediumAttachmentMap *pmapMediumAttachments,
+                              const char *pcszDevice, unsigned uInstance);
+
+    int i_configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun,
+                        INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg,
+                        PCFGMNODE pLunL0, PCFGMNODE pInst,
+                        bool fAttachDetach, bool fIgnoreConnectFailure);
+
+    static DECLCALLBACK(int) i_configGuestProperties(void *pvConsole, PUVM pUVM);
+    static DECLCALLBACK(int) i_configGuestControl(void *pvConsole);
+    static DECLCALLBACK(void) i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
+    static DECLCALLBACK(int) i_unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
+    static DECLCALLBACK(int) i_plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
+    HRESULT i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM);
+    HRESULT i_doCPURemove(ULONG aCpu, PUVM pUVM);
+    HRESULT i_doCPUAdd(ULONG aCpu, PUVM pUVM);
+
+    HRESULT i_doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance,
+                                     unsigned uLun, INetworkAdapter *aNetworkAdapter);
+    static DECLCALLBACK(int) i_changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice,
+                                                       unsigned uInstance, unsigned uLun,
+                                                       INetworkAdapter *aNetworkAdapter);
+
+    void i_changeClipboardMode(ClipboardMode_T aClipboardMode);
+    int i_changeDnDMode(DnDMode_T aDnDMode);
+
+#ifdef VBOX_WITH_USB
+    HRESULT i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs, const Utf8Str &aCaptureFilename);
+    HRESULT i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
+
+    static DECLCALLBACK(int) i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
+                                                 bool aRemote, const char *aAddress, void *pvRemoteBackend,
+                                                 USHORT aPortVersion, ULONG aMaskedIfs, const char *pszCaptureFilename);
+    static DECLCALLBACK(int) i_usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid);
+#endif
+
+    static DECLCALLBACK(int) i_attachStorageDevice(Console *pThis,
                                                    PUVM pUVM,
                                                    const char *pcszDevice,
                                                    unsigned uInstance,
                                                    StorageBus_T enmBus,
                                                    bool fUseHostIOCache,
                                                    IMediumAttachment *aMediumAtt,
-                                                   bool fForce);
-
-    HRESULT attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *BusMgr, PCFGMNODE pDevices);
-    void attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
-                            uint64_t uFirst, uint64_t uLast,
-                            Console::MediumAttachmentMap *pmapMediumAttachments,
-                            const char *pcszDevice, unsigned uInstance);
-
-    int configNetwork(const char *pszDevice, unsigned uInstance, unsigned uLun,
-                      INetworkAdapter *aNetworkAdapter, PCFGMNODE pCfg,
-                      PCFGMNODE pLunL0, PCFGMNODE pInst,
-                      bool fAttachDetach, bool fIgnoreConnectFailure);
-
-    static DECLCALLBACK(int) configGuestProperties(void *pvConsole, PUVM pUVM);
-    static DECLCALLBACK(int) configGuestControl(void *pvConsole);
-    static DECLCALLBACK(void) vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
-    static DECLCALLBACK(int) unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
-    static DECLCALLBACK(int) plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu);
-    HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM);
-    HRESULT doCPURemove(ULONG aCpu, PUVM pUVM);
-    HRESULT doCPUAdd(ULONG aCpu, PUVM pUVM);
-
-    HRESULT doNetworkAdapterChange(PUVM pUVM, const char *pszDevice, unsigned uInstance,
-                                   unsigned uLun, INetworkAdapter *aNetworkAdapter);
-    static DECLCALLBACK(int) changeNetworkAttachment(Console *pThis, PUVM pUVM, const char *pszDevice,
-                                                     unsigned uInstance, unsigned uLun,
-                                                     INetworkAdapter *aNetworkAdapter);
-
-    void changeClipboardMode(ClipboardMode_T aClipboardMode);
-    void changeDragAndDropMode(DragAndDropMode_T aDragAndDropMode);
+                                                   bool fSilent);
+    static DECLCALLBACK(int) i_detachStorageDevice(Console *pThis,
+                                                   PUVM pUVM,
+                                                   const char *pcszDevice,
+                                                   unsigned uInstance,
+                                                   StorageBus_T enmBus,
+                                                   IMediumAttachment *aMediumAtt,
+                                                   bool fSilent);
+    HRESULT i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
+    HRESULT i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
 
-#ifdef VBOX_WITH_USB
-    HRESULT attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs);
-    HRESULT detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice);
+    static DECLCALLBACK(int)    i_stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
 
-    static DECLCALLBACK(int) usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid,
-                       bool aRemote, const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs);
-    static DECLCALLBACK(int) usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid);
-#endif
+    static DECLCALLBACK(void)   i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
+                                                            const char *pszErrorFmt, va_list va);
 
-    static DECLCALLBACK(int) attachStorageDevice(Console *pThis,
-                                                 PUVM pUVM,
-                                                 const char *pcszDevice,
-                                                 unsigned uInstance,
-                                                 StorageBus_T enmBus,
-                                                 bool fUseHostIOCache,
-                                                 IMediumAttachment *aMediumAtt,
-                                                 bool fSilent);
-    static DECLCALLBACK(int) detachStorageDevice(Console *pThis,
-                                                 PUVM pUVM,
-                                                 const char *pcszDevice,
-                                                 unsigned uInstance,
-                                                 StorageBus_T enmBus,
-                                                 IMediumAttachment *aMediumAtt,
-                                                 bool fSilent);
-    HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
-    HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
-
-    static DECLCALLBACK(int)    fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
-
-    static DECLCALLBACK(int)    stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser);
-
-    static DECLCALLBACK(void)   genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
-                                                          const char *pszErrorFmt, va_list va);
-
-    void                        setVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
-    static DECLCALLBACK(void)   setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
-                                                          const char *pszErrorId, const char *pszFormat, va_list va);
-
-    HRESULT                     captureUSBDevices(PUVM pUVM);
-    void                        detachAllUSBDevices(bool aDone);
-
-    static DECLCALLBACK(int)   powerUpThread(RTTHREAD Thread, void *pvUser);
-    static DECLCALLBACK(int)   saveStateThread(RTTHREAD Thread, void *pvUser);
-    static DECLCALLBACK(int)   powerDownThread(RTTHREAD Thread, void *pvUser);
-
-    static DECLCALLBACK(int)    vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
-    static DECLCALLBACK(void)   vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
-    static DECLCALLBACK(void)   vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
-    static DECLCALLBACK(void)   vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
-    static DECLCALLBACK(void)   vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
-    static DECLCALLBACK(void)   vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM);
-
-    static DECLCALLBACK(void *) drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
-    static DECLCALLBACK(void)   drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
-    static DECLCALLBACK(int)    drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned iLUN);
-    static DECLCALLBACK(void)   drvStatus_Destruct(PPDMDRVINS pDrvIns);
-    static DECLCALLBACK(int)    drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
+    void                        i_setVMRuntimeErrorCallbackF(uint32_t fFatal, const char *pszErrorId, const char *pszFormat, ...);
+    static DECLCALLBACK(void)   i_setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFatal,
+                                                            const char *pszErrorId, const char *pszFormat, va_list va);
+
+    HRESULT                     i_captureUSBDevices(PUVM pUVM);
+    void                        i_detachAllUSBDevices(bool aDone);
+
+    static DECLCALLBACK(int)    i_powerUpThread(RTTHREAD Thread, void *pvUser);
+    static DECLCALLBACK(int)    i_powerDownThread(RTTHREAD Thread, void *pvUser);
+
+    static DECLCALLBACK(int)    i_vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM);
+    static DECLCALLBACK(void)   i_vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
+    static DECLCALLBACK(void)   i_vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu);
+    static DECLCALLBACK(void)   i_vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM);
+    static DECLCALLBACK(void)   i_vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM);
+    static DECLCALLBACK(void)   i_vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM);
+
+    static DECLCALLBACK(void *) i_drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID);
+    static DECLCALLBACK(void)   i_drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN);
+    static DECLCALLBACK(int)    i_drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned iLUN);
+    static DECLCALLBACK(void)   i_drvStatus_Destruct(PPDMDRVINS pDrvIns);
+    static DECLCALLBACK(int)    i_drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
 
     static DECLCALLBACK(int)    i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, const uint8_t **ppbKey,
                                                         size_t *pcbKey);
     static DECLCALLBACK(int)    i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId);
+    static DECLCALLBACK(int)    i_pdmIfSecKey_PasswordRetain(PPDMISECKEY pInterface, const char *pszId, const char **ppszPassword);
+    static DECLCALLBACK(int)    i_pdmIfSecKey_PasswordRelease(PPDMISECKEY pInterface, const char *pszId);
 
     static DECLCALLBACK(int)    i_pdmIfSecKeyHlp_KeyMissingNotify(PPDMISECKEYHLP pInterface);
 
@@ -781,52 +783,54 @@ private:
     static const char *sSSMConsoleUnit;
     static uint32_t sSSMConsoleVer;
 
-    HRESULT loadDataFromSavedState();
-    int loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version);
+    HRESULT i_loadDataFromSavedState();
+    int i_loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version);
 
-    static DECLCALLBACK(void)   saveStateFileExec(PSSMHANDLE pSSM, void *pvUser);
-    static DECLCALLBACK(int)    loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
+    static DECLCALLBACK(void)   i_saveStateFileExec(PSSMHANDLE pSSM, void *pvUser);
+    static DECLCALLBACK(int)    i_loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
 
 #ifdef VBOX_WITH_GUEST_PROPS
-    static DECLCALLBACK(int)    doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
-    HRESULT                     doEnumerateGuestProperties(CBSTR aPatterns,
-                                                           ComSafeArrayOut(BSTR, aNames),
-                                                           ComSafeArrayOut(BSTR, aValues),
-                                                           ComSafeArrayOut(LONG64, aTimestamps),
-                                                           ComSafeArrayOut(BSTR, aFlags));
-
-    void guestPropertiesHandleVMReset(void);
-    bool guestPropertiesVRDPEnabled(void);
-    void guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
-    void guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId);
-    void guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached);
-    void guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName);
-    void guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr);
-    void guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation);
-    void guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo);
-    void guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
+    static DECLCALLBACK(int)    i_doGuestPropNotification(void *pvExtension, uint32_t, void *pvParms, uint32_t cbParms);
+    HRESULT                     i_doEnumerateGuestProperties(const Utf8Str &aPatterns,
+                                                             std::vector<Utf8Str> &aNames,
+                                                             std::vector<Utf8Str> &aValues,
+                                                             std::vector<LONG64>  &aTimestamps,
+                                                             std::vector<Utf8Str> &aFlags);
+
+    void i_guestPropertiesHandleVMReset(void);
+    bool i_guestPropertiesVRDPEnabled(void);
+    void i_guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain);
+    void i_guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId);
+    void i_guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached);
+    void i_guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName);
+    void i_guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr);
+    void i_guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation);
+    void i_guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo);
+    void i_guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId);
 #endif
 
-    bool isResetTurnedIntoPowerOff(void);
+    bool i_isResetTurnedIntoPowerOff(void);
 
     /** @name Disk encryption support
      * @{ */
-    HRESULT consoleParseDiskEncryption(const char *psz, const char **ppszEnd);
-    HRESULT configureEncryptionForDisk(const char *pszUuid);
-    HRESULT clearDiskEncryptionKeysOnAllAttachments(void);
-    int consoleParseKeyValue(const char *psz, const char **ppszEnd,
-                             char **ppszKey, char **ppszVal);
+    HRESULT i_consoleParseDiskEncryption(const char *psz, const char **ppszEnd);
+    HRESULT i_configureEncryptionForDisk(const Utf8Str &strId, unsigned *pcDisksConfigured);
+    HRESULT i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(const Utf8Str &strId);
+    HRESULT i_initSecretKeyIfOnAllAttachments(void);
+    int i_consoleParseKeyValue(const char *psz, const char **ppszEnd,
+                               char **ppszKey, char **ppszVal);
+    void i_removeSecretKeysOnSuspend();
     /** @} */
 
     /** @name Teleporter support
      * @{ */
-    static DECLCALLBACK(int)    teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
-    HRESULT                     teleporterSrc(TeleporterStateSrc *pState);
-    HRESULT                     teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
-    HRESULT                     teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
-    HRESULT                     teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
+    static DECLCALLBACK(int)    i_teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser);
+    HRESULT                     i_teleporterSrc(TeleporterStateSrc *pState);
+    HRESULT                     i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL);
+    HRESULT                     i_teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true);
+    HRESULT                     i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
                                               Progress *pProgress, bool *pfPowerOffOnFailure);
-    static DECLCALLBACK(int)    teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
+    static DECLCALLBACK(int)    i_teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser);
     /** @} */
 
     bool mSavedStateDataLoaded : 1;
@@ -900,7 +904,11 @@ private:
     NetworkAttachmentTypeVector meAttachmentType;
 
     VMMDev * m_pVMMDev;
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    AudioVRDE * const mAudioVRDE;
+#else
     AudioSniffer * const mAudioSniffer;
+#endif
     Nvram   * const mNvram;
 #ifdef VBOX_WITH_USB_CARDREADER
     UsbCardReader * const mUsbCardReader;
@@ -919,18 +927,28 @@ private:
         cLedScsi    = 16,
         iLedSas     = iLedScsi + cLedScsi,
         cLedSas     = 8,
-        cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas
+        iLedUsb     = iLedSas + cLedSas,
+        cLedUsb     = 8,
+        cLedStorage = cLedFloppy + cLedIde + cLedSata + cLedScsi + cLedSas + cLedUsb
     };
     DeviceType_T maStorageDevType[cLedStorage];
     PPDMLED      mapStorageLeds[cLedStorage];
     PPDMLED      mapNetworkLeds[36];    /**< @todo adapt this to the maximum network card count */
     PPDMLED      mapSharedFolderLed;
     PPDMLED      mapUSBLed[2];
+    PPDMLED      mapCrOglLed;
 
     MediumAttachmentMap mapMediumAttachments;
 
-    /** Map of secret keys used for disk encryption. */
-    SecretKeyMap         m_mapSecretKeys;
+    /** List of attached USB storage devices. */
+    USBStorageDeviceList mUSBStorageDevices;
+
+    /** Store for secret keys. */
+    SecretKeyStore * const m_pKeyStore;
+    /** Number of disks configured for encryption. */
+    unsigned               m_cDisksEncrypted;
+    /** Number of disks which have the key in the map. */
+    unsigned               m_cDisksPwProvided;
 
     /** Pointer to the key consumer -> provider (that's us) callbacks. */
     struct MYPDMISECKEY : public PDMISECKEY
@@ -957,6 +975,9 @@ private:
     /** Local machine state value. */
     MachineState_T mMachineState;
 
+    /** Machine uuid string. */
+    Bstr mstrUuid;
+
     /** Pointer to the progress object of a live cancelable task.
      *
      * This is currently only used by Console::Teleport(), but is intended to later
@@ -964,57 +985,8 @@ private:
      * Console::PowerDown, which automatically cancels out the running snapshot /
      * teleportation operation, will cancel the teleportation / live snapshot
      * operation before starting. */
-    ComObjPtr<Progress> mptrCancelableProgress;
+    ComPtr<IProgress> mptrCancelableProgress;
 
-    /* The purpose of caching of some events is probably in order to
-       automatically fire them at new event listeners.  However, there is no
-       (longer?) any code making use of this... */
-#ifdef CONSOLE_WITH_EVENT_CACHE
-    struct
-    {
-        /** OnMousePointerShapeChange() cache */
-        struct
-        {
-            bool valid;
-            bool visible;
-            bool alpha;
-            uint32_t xHot;
-            uint32_t yHot;
-            uint32_t width;
-            uint32_t height;
-            com::SafeArray<BYTE> shape;
-        } mpsc;
-
-        /** OnMouseCapabilityChange() cache */
-        struct
-        {
-            bool valid;
-            BOOL supportsAbsolute;
-            BOOL supportsRelative;
-            BOOL needsHostCursor;
-        } mcc;
-
-        /** OnKeyboardLedsChange() cache */
-        struct
-        {
-            bool valid;
-            bool numLock;
-            bool capsLock;
-            bool scrollLock;
-        } klc;
-
-        void clear()
-        {
-            RT_ZERO(mcc);
-            RT_ZERO(klc);
-
-            /* We cannot RT_ZERO mpsc because of shape's vtable. */
-            mpsc.shape.setNull();
-            mpsc.valid = mpsc.visible = mpsc.alpha = false;
-            mpsc.xHot = mpsc.yHot = mpsc.width = mpsc.height = 0;
-        }
-    } mCallbackData;
-#endif
     ComPtr<IEventListener> mVmListener;
 
     friend struct VMTask;
diff --git a/src/VBox/Main/include/ConsoleVRDPServer.h b/src/VBox/Main/include/ConsoleVRDPServer.h
index ee87367..f9afd98 100644
--- a/src/VBox/Main/include/ConsoleVRDPServer.h
+++ b/src/VBox/Main/include/ConsoleVRDPServer.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,6 +18,7 @@
 #ifndef ____H_CONSOLEVRDPSERVER
 #define ____H_CONSOLEVRDPSERVER
 
+#include "VRDEServerInfoWrap.h"
 #include "RemoteUSBBackend.h"
 #include "HGCM.h"
 
@@ -156,6 +157,9 @@ public:
 
     Console *getConsole(void) { return mConsole; }
 
+    void onMousePointerShapeChange(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot,
+                                   ULONG width, ULONG height, ComSafeArrayIn(BYTE,shape));
+
 private:
     /* Note: This is not a ComObjPtr here, because the ConsoleVRDPServer object
      * is actually just a part of the Console.
@@ -192,11 +196,13 @@ private:
     static DECLCALLBACK(void) VRDPCallbackVideoModeHint     (void *pvCallback, unsigned cWidth, unsigned cHeight,  unsigned cBitsPerPixel, unsigned uScreenId);
     static DECLCALLBACK(void) VRDECallbackAudioIn           (void *pvCallback, void *pvCtx, uint32_t u32ClientId, uint32_t u32Event, const void *pvData, uint32_t cbData);
 
+    void fetchCurrentState(void);
+
     bool m_fGuestWantsAbsolute;
     int m_mousex;
     int m_mousey;
 
-    IFramebuffer *maFramebuffers[SchemaDefs::MaxGuestMonitors];
+    ComPtr<IDisplaySourceBitmap> maSourceBitmaps[SchemaDefs::MaxGuestMonitors];
 
     ComPtr<IEventListener> mConsoleListener;
 
@@ -363,50 +369,41 @@ private:
 class Console;
 
 class ATL_NO_VTABLE VRDEServerInfo :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IVRDEServerInfo)
+    public VRDEServerInfoWrap
 {
 public:
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VRDEServerInfo, IVRDEServerInfo)
-
     DECLARE_NOT_AGGREGATABLE(VRDEServerInfo)
 
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(VRDEServerInfo)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IVRDEServerInfo)
-    END_COM_MAP()
-
-    DECLARE_EMPTY_CTOR_DTOR (VRDEServerInfo)
+    DECLARE_EMPTY_CTOR_DTOR(VRDEServerInfo)
 
     HRESULT FinalConstruct();
     void FinalRelease();
 
     /* Public initializer/uninitializer for internal purposes only. */
-    HRESULT init (Console *aParent);
+    HRESULT init(Console *aParent);
     void uninit();
 
-    /* IVRDEServerInfo properties */
-    #define DECL_GETTER(_aType, _aName) STDMETHOD(COMGETTER(_aName)) (_aType *a##_aName)
-        DECL_GETTER (BOOL,    Active);
-        DECL_GETTER (LONG,    Port);
-        DECL_GETTER (ULONG,   NumberOfClients);
-        DECL_GETTER (LONG64,  BeginTime);
-        DECL_GETTER (LONG64,  EndTime);
-        DECL_GETTER (LONG64,  BytesSent);
-        DECL_GETTER (LONG64,  BytesSentTotal);
-        DECL_GETTER (LONG64,  BytesReceived);
-        DECL_GETTER (LONG64,  BytesReceivedTotal);
-        DECL_GETTER (BSTR,    User);
-        DECL_GETTER (BSTR,    Domain);
-        DECL_GETTER (BSTR,    ClientName);
-        DECL_GETTER (BSTR,    ClientIP);
-        DECL_GETTER (ULONG,   ClientVersion);
-        DECL_GETTER (ULONG,   EncryptionStyle);
-    #undef DECL_GETTER
-
 private:
+    // wrapped IVRDEServerInfo properties
+#define DECL_GETTER(_aType, _aName) virtual HRESULT get##_aName(_aType *a##_aName)
+#define DECL_GETTER_REF(_aType, _aName) virtual HRESULT get##_aName(_aType &a##_aName)
+    DECL_GETTER(BOOL, Active);
+    DECL_GETTER(LONG, Port);
+    DECL_GETTER(ULONG, NumberOfClients);
+    DECL_GETTER(LONG64, BeginTime);
+    DECL_GETTER(LONG64, EndTime);
+    DECL_GETTER(LONG64, BytesSent);
+    DECL_GETTER(LONG64, BytesSentTotal);
+    DECL_GETTER(LONG64, BytesReceived);
+    DECL_GETTER(LONG64, BytesReceivedTotal);
+    DECL_GETTER_REF(com::Utf8Str, User);
+    DECL_GETTER_REF(com::Utf8Str, Domain);
+    DECL_GETTER_REF(com::Utf8Str, ClientName);
+    DECL_GETTER_REF(com::Utf8Str, ClientIP);
+    DECL_GETTER(ULONG, ClientVersion);
+    DECL_GETTER(ULONG, EncryptionStyle);
+#undef DECL_GETTER_REF
+#undef DECL_GETTER
 
     Console * const         mParent;
 };
diff --git a/src/VBox/Main/include/DHCPServerImpl.h b/src/VBox/Main/include/DHCPServerImpl.h
index 99d8c79..a600185 100644
--- a/src/VBox/Main/include/DHCPServerImpl.h
+++ b/src/VBox/Main/include/DHCPServerImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,8 +20,8 @@
 #ifndef ____H_H_DHCPSERVERIMPL
 #define ____H_H_DHCPSERVERIMPL
 
-#include "VirtualBoxBase.h"
 #include <VBox/settings.h>
+#include "DHCPServerWrap.h"
 
 #ifdef VBOX_WITH_HOSTNETIF_API
 struct NETIFINFO;
@@ -70,21 +70,10 @@ using settings::VmSlot2OptionsIterator;
 
 
 class ATL_NO_VTABLE DHCPServer :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IDHCPServer)
+    public DHCPServerWrap
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(DHCPServer, IDHCPServer)
-
-    DECLARE_NOT_AGGREGATABLE (DHCPServer)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP (DHCPServer)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IDHCPServer)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR (DHCPServer)
 
     HRESULT FinalConstruct();
@@ -94,46 +83,59 @@ public:
                  IN_BSTR aName);
     HRESULT init(VirtualBox *aVirtualBox,
                  const settings::DHCPServer &data);
-    HRESULT saveSettings(settings::DHCPServer &data);
-
     void uninit();
 
-    // IDHCPServer properties
-    STDMETHOD(COMGETTER(NetworkName))(BSTR *aName);
-    STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(IPAddress))(BSTR *aIPAddress);
-    STDMETHOD(COMGETTER(NetworkMask))(BSTR *aNetworkMask);
-    STDMETHOD(COMGETTER(LowerIP))(BSTR *aIPAddress);
-    STDMETHOD(COMGETTER(UpperIP))(BSTR *aIPAddress);
-
-    STDMETHOD(AddGlobalOption)(DhcpOpt_T aOption, IN_BSTR aValue);
-    STDMETHOD(COMGETTER(GlobalOptions))(ComSafeArrayOut(BSTR, aValues));
-    STDMETHOD(COMGETTER(VmConfigs))(ComSafeArrayOut(BSTR, aValues));
-    STDMETHOD(AddVmSlotOption)(IN_BSTR aVmName, LONG aSlot, DhcpOpt_T aOption, IN_BSTR aValue);
-    STDMETHOD(RemoveVmSlotOptions)(IN_BSTR aVmName, LONG aSlot);
-    STDMETHOD(GetVmSlotOptions)(IN_BSTR aVmName, LONG aSlot, ComSafeArrayOut(BSTR, aValues));
-    STDMETHOD(GetMacOptions)(IN_BSTR aMAC, ComSafeArrayOut(BSTR, aValues));
-    STDMETHOD(COMGETTER(EventSource))(IEventSource **aEventSource);
-
-    STDMETHOD(SetConfiguration)(IN_BSTR aIPAddress, IN_BSTR aNetworkMask, IN_BSTR aFromIPAddress, IN_BSTR aToIPAddress);
-
-    STDMETHOD(Start)(IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR aTrunkType);
-    STDMETHOD(Stop)();
+    // Public internal methids.
+    HRESULT i_saveSettings(settings::DHCPServer &data);
+    DhcpOptionMap& i_findOptMapByVmNameSlot(const com::Utf8Str& aVmName,
+                                            LONG Slot);
 
 private:
+    HRESULT encodeOption(com::Utf8Str &aEncoded,
+			 uint32_t aOptCode, const DhcpOptValue &aOptValue);
+    int addOption(DhcpOptionMap &aMap,
+		  DhcpOpt_T aOption, const com::Utf8Str &aValue);
+
+    // wrapped IDHCPServer properties
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+    HRESULT getEnabled(BOOL *aEnabled);
+    HRESULT setEnabled(BOOL aEnabled);
+    HRESULT getIPAddress(com::Utf8Str &aIPAddress);
+    HRESULT getNetworkMask(com::Utf8Str &aNetworkMask);
+    HRESULT getNetworkName(com::Utf8Str &aName);
+    HRESULT getLowerIP(com::Utf8Str &aIPAddress);
+    HRESULT getUpperIP(com::Utf8Str &aIPAddress);
+    HRESULT getGlobalOptions(std::vector<com::Utf8Str> &aGlobalOptions);
+    HRESULT getVmConfigs(std::vector<com::Utf8Str> &aVmConfigs);
+    HRESULT getMacOptions(const com::Utf8Str &aMAC, std::vector<com::Utf8Str> &aValues);
+    HRESULT setConfiguration(const com::Utf8Str &aIPAddress,
+                             const com::Utf8Str &aNetworkMask,
+                             const com::Utf8Str &aFromIPAddress,
+                             const com::Utf8Str &aToIPAddress);
+    HRESULT getVmSlotOptions(const com::Utf8Str &aVmName,
+                             LONG aSlot,
+                             std::vector<com::Utf8Str> &aValues);
+
+    // Wrapped IDHCPServer Methods
+    HRESULT addGlobalOption(DhcpOpt_T aOption,
+                            const com::Utf8Str &aValue);
+    HRESULT addVmSlotOption(const com::Utf8Str &aVmName,
+                            LONG aSlot,
+                            DhcpOpt_T aOption,
+                            const com::Utf8Str &aValue);
+    HRESULT removeVmSlotOptions(const com::Utf8Str &aVmName,
+                                LONG aSlot);
+    HRESULT start(const com::Utf8Str &aNetworkName,
+                  const com::Utf8Str &aTrunkName,
+                  const com::Utf8Str &aTrunkType);
+    HRESULT stop();
+
     struct Data;
     Data *m;
     /** weak VirtualBox parent */
-    VirtualBox * const      mVirtualBox;
+    VirtualBox * const mVirtualBox;
     const Bstr mName;
 
-    DhcpOptionMap& findOptMapByVmNameSlot(const com::Utf8Str& aVmName,
-                                          LONG Slot);
-    HRESULT encodeOption(com::Utf8Str &aEncoded,
-			 uint32_t aOptCode, const DhcpOptValue &aOptValue);
-    int addOption(DhcpOptionMap &aMap,
-		  DhcpOpt_T aOption, const com::Utf8Str &aValue);
 };
 
 #endif // ____H_H_DHCPSERVERIMPL
diff --git a/src/VBox/Main/include/DisplayImpl.h b/src/VBox/Main/include/DisplayImpl.h
index ad75347..ca3d50f 100644
--- a/src/VBox/Main/include/DisplayImpl.h
+++ b/src/VBox/Main/include/DisplayImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,37 +18,48 @@
 #ifndef ____H_DISPLAYIMPL
 #define ____H_DISPLAYIMPL
 
-#include "VirtualBoxBase.h"
 #include "SchemaDefs.h"
 
 #include <iprt/semaphore.h>
 #include <VBox/vmm/pdmdrv.h>
 #include <VBox/VMMDev.h>
 #include <VBox/VBoxVideo.h>
+#include <VBox/vmm/pdmifs.h>
+#include "DisplayWrap.h"
 
 #ifdef VBOX_WITH_CROGL
 # include <VBox/HostServices/VBoxCrOpenGLSvc.h>
 #endif
 
+#include "DisplaySourceBitmapWrap.h"
+
 class Console;
 struct VIDEORECCONTEXT;
 
-enum
-{
-    ResizeStatus_Void,
-    ResizeStatus_InProgress,
-    ResizeStatus_UpdateDisplayData
-};
-
 typedef struct _DISPLAYFBINFO
 {
+    /* The following 3 fields (u32Offset, u32MaxFramebufferSize and u32InformationSize)
+     * are not used by the current HGSMI. They are needed for backward compatibility with
+     * pre-HGSMI additions.
+     */
     uint32_t u32Offset;
     uint32_t u32MaxFramebufferSize;
     uint32_t u32InformationSize;
 
     ComPtr<IFramebuffer> pFramebuffer;
+    com::Guid framebufferId;
+    ComPtr<IDisplaySourceBitmap> pSourceBitmap;
     bool fDisabled;
 
+    uint32_t u32Caps;
+
+    struct
+    {
+        ComPtr<IDisplaySourceBitmap> pSourceBitmap;
+        uint8_t *pu8Address;
+        uint32_t cbLine;
+    } updateImage;
+
     LONG xOrigin;
     LONG yOrigin;
 
@@ -61,49 +72,15 @@ typedef struct _DISPLAYFBINFO
 
     uint16_t flags;
 
-    /* for saving the rectangles arrived during fb resize is in progress. */
-    PRTRECT mpSavedVisibleRegion;
-    uint32_t mcSavedVisibleRegion;
-
     VBOXVIDEOINFOHOSTEVENTS *pHostEvents;
 
-    volatile uint32_t u32ResizeStatus;
-
-    /* The Framebuffer has default format and must be updates immediately. */
+    /** The framebuffer has default format and must be updates immediately. */
     bool fDefaultFormat;
 
-    struct
-    {
-        /* The rectangle that includes all dirty rectangles. */
-        int32_t xLeft;
-        int32_t xRight;
-        int32_t yTop;
-        int32_t yBottom;
-    } dirtyRect;
-
-    struct
-    {
-        bool fPending;
-        ULONG pixelFormat;
-        void *pvVRAM;
-        uint32_t bpp;
-        uint32_t cbLine;
-        uint32_t w;
-        uint32_t h;
-        uint16_t flags;
-    } pendingResize;
-
 #ifdef VBOX_WITH_HGSMI
     bool fVBVAEnabled;
+    bool fVBVAForceResize;
     bool fRenderThreadMode;
-    uint32_t cVBVASkipUpdate;
-    struct
-    {
-       int32_t xLeft;
-       int32_t yTop;
-       int32_t xRight;
-       int32_t yBottom;
-    } vbvaSkippedRect;
     PVBVAHOSTFLAGS pVBVAHostFlags;
 #endif /* VBOX_WITH_HGSMI */
 
@@ -119,13 +96,34 @@ typedef struct _DISPLAYFBINFO
 #endif /* VBOX_WITH_CROGL */
 } DISPLAYFBINFO;
 
+/* The legacy VBVA (VideoAccel) data.
+ *
+ * Backward compatibility with the guest additions 3.x or older.
+ */
+typedef struct VIDEOACCEL
+{
+    VBVAMEMORY *pVbvaMemory;
+    bool        fVideoAccelEnabled;
+
+    uint8_t    *pu8VbvaPartial;
+    uint32_t    cbVbvaPartial;
+
+    /* Old guest additions (3.x and older) use both VMMDev and DevVGA refresh timer
+     * to process the VBVABUFFER memory. Therefore the legacy VBVA (VideoAccel) host
+     * code can be executed concurrently by VGA refresh timer and the guest VMMDev
+     * request in SMP VMs. The semaphore serialized this.
+     */
+    RTSEMXROADS hXRoadsVideoAccel;
+
+} VIDEOACCEL;
+
 class DisplayMouseInterface
 {
 public:
-    virtual int getScreenResolution(uint32_t cScreen, ULONG *pcx,
-                                    ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
-    virtual void getFramebufferDimensions(int32_t *px1, int32_t *py1,
-                                          int32_t *px2, int32_t *py2) = 0;
+    virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
+                                          ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin) = 0;
+    virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
+                                            int32_t *px2, int32_t *py2) = 0;
     virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved) = 0;
     virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y) = 0;
     virtual bool i_isInputMappingSet(void) = 0;
@@ -134,24 +132,11 @@ public:
 class VMMDev;
 
 class ATL_NO_VTABLE Display :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IEventListener),
-    VBOX_SCRIPTABLE_IMPL(IDisplay),
+    public DisplayWrap,
     public DisplayMouseInterface
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Display, IDisplay)
-
-    DECLARE_NOT_AGGREGATABLE(Display)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Display)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IDisplay)
-        COM_INTERFACE_ENTRY(IEventListener)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR(Display)
 
     HRESULT FinalConstruct();
@@ -160,79 +145,65 @@ public:
     // public initializer/uninitializer for internal purposes only
     HRESULT init(Console *aParent);
     void uninit();
-    int  registerSSM(PUVM pUVM);
+    int  i_registerSSM(PUVM pUVM);
 
     // public methods only for internal purposes
-    int  handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags);
-    void handleDisplayUpdateLegacy(int x, int y, int cx, int cy);
-    void handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
+    int  i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine,
+                               uint32_t w, uint32_t h, uint16_t flags);
+    void i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h);
     void i_handleUpdateVMMDevSupportsGraphics(bool fSupportsGraphics);
     void i_handleUpdateGuestVBVACapabilities(uint32_t fNewCapabilities);
     void i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy);
 #ifdef VBOX_WITH_VIDEOHWACCEL
-    int handleVHWACommandProcess(PVBOXVHWACMD pCommand);
+    int  i_handleVHWACommandProcess(PVBOXVHWACMD pCommand);
 #endif
 #ifdef VBOX_WITH_CRHGSMI
-    void handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
-    void handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
-    void handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
-    void handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
+    void i_handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
+    void i_handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam);
+    void i_handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
+    void i_handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
 #endif
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    int  handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
-                                        PFNCRCTLCOMPLETION pfnCompletion,
-                                        void *pvCompletion);
-    void  handleCrVRecScreenshotPerform(uint32_t uScreen,
-                                        uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
-                                        uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
-                                        uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
-    bool handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
-    void handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
-    void handleVRecCompletion();
+    int  i_handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
+                                 PFNCRCTLCOMPLETION pfnCompletion,
+                                 void *pvCompletion);
+    void  i_handleCrVRecScreenshotPerform(uint32_t uScreen,
+                                          uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBitsPerPixel,
+                                          uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
+                                          uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
+    bool i_handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp);
+    void i_handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp);
+    void i_handleVRecCompletion();
 #endif
 
-    int notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
+    int i_notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
 
-    IFramebuffer *getFramebuffer()
-    {
-        return maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer;
-    }
-    void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, int32_t *py2);
-    int getScreenResolution(uint32_t cScreen, ULONG *pcx, ULONG *pcy,
-                            ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
+    int  i_handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
+    int  i_handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
+
+    void i_VideoAccelVRDP(bool fEnable);
+
+    /* Legacy video acceleration requests coming from the VGA refresh timer. */
+    int  VideoAccelEnableVGA(bool fEnable, VBVAMEMORY *pVbvaMemory);
+
+    /* Legacy video acceleration requests coming from VMMDev. */
+    int  VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory);
+    void VideoAccelFlushVMMDev(void);
+
+    int  i_VideoCaptureStart();
+    void i_VideoCaptureStop();
+    int  i_VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
+
+    void i_notifyPowerDown(void);
+
+    // DisplayMouseInterface methods
+    virtual HRESULT i_getScreenResolution(ULONG cScreen, ULONG *pcx,
+                                          ULONG *pcy, ULONG *pcBPP, LONG *pXOrigin, LONG *pYOrigin)
     {
-        return GetScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin);
+        return getScreenResolution(cScreen, pcx, pcy, pcBPP, pXOrigin, pYOrigin, NULL);
     }
-
-    int  handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect);
-    int  handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect);
-
-    int  VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
-    void VideoAccelFlush(void);
-    bool VideoAccelAllowed(void);
-    void VideoAccelVRDP(bool fEnable);
-
-    int  VideoCaptureStart();
-    void VideoCaptureStop();
-    int  VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
-
-    // IEventListener methods
-    STDMETHOD(HandleEvent)(IEvent * aEvent);
-
-    // IDisplay methods
-    STDMETHOD(GetScreenResolution)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel, LONG *aXOrigin, LONG *aYOrigin);
-    STDMETHOD(SetFramebuffer)(ULONG aScreenId, IFramebuffer *aFramebuffer);
-    STDMETHOD(GetFramebuffer)(ULONG aScreenId, IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin);
-    STDMETHOD(SetVideoModeHint)(ULONG aDisplay, BOOL aEnabled, BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY, ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel);
-    STDMETHOD(TakeScreenShot)(ULONG aScreenId, BYTE *address, ULONG width, ULONG height);
-    STDMETHOD(TakeScreenShotToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
-    STDMETHOD(TakeScreenShotPNGToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData));
-    STDMETHOD(DrawToScreen)(ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
-    STDMETHOD(InvalidateAndUpdate)();
-    STDMETHOD(ResizeCompleted)(ULONG aScreenId);
-    STDMETHOD(SetSeamlessMode)(BOOL enabled);
-
-    STDMETHOD(CompleteVHWACommand)(BYTE *pCommand);
+    virtual void i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
+                                            int32_t *px2, int32_t *py2);
     virtual HRESULT i_reportHostCursorCapabilities(uint32_t fCapabilitiesAdded, uint32_t fCapabilitiesRemoved);
     virtual HRESULT i_reportHostCursorPosition(int32_t x, int32_t y);
     virtual bool i_isInputMappingSet(void)
@@ -240,63 +211,140 @@ public:
         return cxInputMapping != 0 && cyInputMapping != 0;
     }
 
-    STDMETHOD(ViewportChanged)(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
-
     static const PDMDRVREG  DrvReg;
 
 private:
-
-    int updateDisplayData(void);
+    // Wrapped IDisplay properties
+
+    // Wrapped IDisplay methods
+    virtual HRESULT getScreenResolution(ULONG aScreenId,
+                                        ULONG *aWidth,
+                                        ULONG *aHeight,
+                                        ULONG *aBitsPerPixel,
+                                        LONG *aXOrigin,
+                                        LONG *aYOrigin,
+                                        GuestMonitorStatus_T *aGuestMonitorStatus);
+    virtual HRESULT attachFramebuffer(ULONG aScreenId,
+                                      const ComPtr<IFramebuffer> &aFramebuffer,
+                                      com::Guid &aId);
+    virtual HRESULT detachFramebuffer(ULONG aScreenId,
+                                      const com::Guid &aId);
+    virtual HRESULT queryFramebuffer(ULONG aScreenId,
+                                     ComPtr<IFramebuffer> &aFramebuffer);
+    virtual HRESULT setVideoModeHint(ULONG aDisplay,
+                                     BOOL aEnabled,
+                                     BOOL aChangeOrigin,
+                                     LONG aOriginX,
+                                     LONG aOriginY,
+                                     ULONG aWidth,
+                                     ULONG aHeight,
+                                     ULONG aBitsPerPixel);
+    virtual HRESULT setSeamlessMode(BOOL aEnabled);
+    virtual HRESULT takeScreenShot(ULONG aScreenId,
+                                   BYTE *aAddress,
+                                   ULONG aWidth,
+                                   ULONG aHeight,
+                                   BitmapFormat_T aBitmapFormat);
+    virtual HRESULT takeScreenShotToArray(ULONG aScreenId,
+                                          ULONG aWidth,
+                                          ULONG aHeight,
+                                          BitmapFormat_T aBitmapFormat,
+                                          std::vector<BYTE> &aScreenData);
+    virtual HRESULT drawToScreen(ULONG aScreenId,
+                                 BYTE *aAddress,
+                                 ULONG aX,
+                                 ULONG aY,
+                                 ULONG aWidth,
+                                 ULONG aHeight);
+    virtual HRESULT invalidateAndUpdate();
+    virtual HRESULT invalidateAndUpdateScreen(ULONG aScreenId);
+    virtual HRESULT completeVHWACommand(BYTE *aCommand);
+    virtual HRESULT viewportChanged(ULONG aScreenId,
+                                    ULONG aX,
+                                    ULONG aY,
+                                    ULONG aWidth,
+                                    ULONG aHeight);
+    virtual HRESULT querySourceBitmap(ULONG aScreenId,
+                                      ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap);
+    virtual HRESULT notifyScaleFactorChange(ULONG aScreenId,
+                                            ULONG aScaleFactorWMultiplied,
+                                            ULONG aScaleFactorHMultiplied);
+    virtual HRESULT notifyHiDPIOutputPolicyChange(BOOL fUnscaledHiDPI);
+
+    // Wrapped IEventListener properties
+
+    // Wrapped IEventListener methods
+    virtual HRESULT handleEvent(const ComPtr<IEvent> &aEvent);
+
+    // other internal methods
+    HRESULT takeScreenShotWorker(ULONG aScreenId,
+                                 BYTE *aAddress,
+                                 ULONG aWidth,
+                                 ULONG aHeight,
+                                 BitmapFormat_T aBitmapFormat,
+                                 ULONG *pcbOut);
 
 #ifdef VBOX_WITH_CRHGSMI
-    void setupCrHgsmiData(void);
-    void destructCrHgsmiData(void);
+    void i_setupCrHgsmiData(void);
+    void i_destructCrHgsmiData(void);
 #endif
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    int crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
+    int i_crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height);
 #endif
 
-    static DECLCALLBACK(int)   changeFramebuffer(Display *that, IFramebuffer *aFB, unsigned uScreenId);
-
-    static DECLCALLBACK(void*) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
-    static DECLCALLBACK(int)   drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
-    static DECLCALLBACK(void)  drvDestruct(PPDMDRVINS pDrvIns);
-    static DECLCALLBACK(int)   displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy);
-    static DECLCALLBACK(void)  displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
-                                                     uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
-    static DECLCALLBACK(void)  displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
-    static DECLCALLBACK(void)  displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
-    static DECLCALLBACK(void)  displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
-    static DECLCALLBACK(void)  displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize);
-    static DECLCALLBACK(void)  displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId);
+    static DECLCALLBACK(void*) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
+    static DECLCALLBACK(int)   i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
+    static DECLCALLBACK(void)  i_drvDestruct(PPDMDRVINS pDrvIns);
+    static DECLCALLBACK(int)   i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM,
+                                                       uint32_t cbLine, uint32_t cx, uint32_t cy);
+    static DECLCALLBACK(void)  i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
+                                                       uint32_t x, uint32_t y, uint32_t cx, uint32_t cy);
+    static DECLCALLBACK(void)  i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface);
+    static DECLCALLBACK(void)  i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface);
+    static DECLCALLBACK(void)  i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled);
+    static DECLCALLBACK(void)  i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
+                                                                   void *pvVRAM, uint32_t u32VRAMSize);
+    static DECLCALLBACK(void)  i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
+                                                                   void *pvVRAM, unsigned uScreenId);
 
 #ifdef VBOX_WITH_VIDEOHWACCEL
-    static DECLCALLBACK(int)  displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
+    static DECLCALLBACK(int)  i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand);
 #endif
 
 #ifdef VBOX_WITH_CRHGSMI
-    static DECLCALLBACK(void)  displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
-    static DECLCALLBACK(void)  displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl);
-
-    static DECLCALLBACK(void)  displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
-    static DECLCALLBACK(void)  displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+    static DECLCALLBACK(void)  i_displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface,
+                                                              PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd);
+    static DECLCALLBACK(void)  i_displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl,
+                                                              uint32_t cbCtl);
+
+    static DECLCALLBACK(void)  i_displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
+                                                                 void *pvContext);
+    static DECLCALLBACK(void)  i_displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
+                                                                 void *pvContext);
 #endif
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    static DECLCALLBACK(int)  displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
-                                        struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
-                                        PFNCRCTLCOMPLETION pfnCompletion,
-                                        void *pvCompletion);
-    static DECLCALLBACK(void)  displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);
+    static DECLCALLBACK(int)  i_displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
+                                                       struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
+                                                       PFNCRCTLCOMPLETION pfnCompletion,
+                                                       void *pvCompletion);
+    static DECLCALLBACK(void) i_displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
+                                                                 void *pvContext);
 #endif
 #ifdef VBOX_WITH_HGSMI
-    static DECLCALLBACK(int)   displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
-    static DECLCALLBACK(void)  displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
-    static DECLCALLBACK(void)  displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
-    static DECLCALLBACK(void)  displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd);
-    static DECLCALLBACK(void)  displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy);
-    static DECLCALLBACK(int)   displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM);
-    static DECLCALLBACK(int)   displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha, uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, const void *pvShape);
+    static DECLCALLBACK(int)   i_displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
+                                                   PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode);
+    static DECLCALLBACK(void)  i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
+    static DECLCALLBACK(void)  i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId);
+    static DECLCALLBACK(void)  i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
+                                                          const PVBVACMDHDR pCmd, size_t cbCmd);
+    static DECLCALLBACK(void)  i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
+                                                      uint32_t cx, uint32_t cy);
+    static DECLCALLBACK(int)   i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView,
+                                                   const PVBVAINFOSCREEN pScreen, void *pvVRAM);
+    static DECLCALLBACK(int)   i_displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
+                                                              uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy,
+                                                              const void *pvShape);
     static DECLCALLBACK(void)  i_displayVBVAGuestCapabilityUpdate(PPDMIDISPLAYCONNECTOR pInterface, uint32_t fCapabilities);
 
     static DECLCALLBACK(void)  i_displayVBVAInputMappingUpdate(PPDMIDISPLAYCONNECTOR pInterface, int32_t xOrigin, int32_t yOrigin,
@@ -304,26 +352,26 @@ private:
 #endif
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    static DECLCALLBACK(void) displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
-                                                             uint32_t x, uint32_t y,
-                                                             uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
-                                                             uint32_t uGuestWidth, uint32_t uGuestHeight,
-                                                             uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
-    static DECLCALLBACK(bool) displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
-    static DECLCALLBACK(void) displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
-
-    static DECLCALLBACK(void)  displayVRecCompletion(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
+    static DECLCALLBACK(void) i_displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
+                                                               uint32_t x, uint32_t y,
+                                                               uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
+                                                               uint32_t uGuestWidth, uint32_t uGuestHeight,
+                                                               uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
+    static DECLCALLBACK(bool) i_displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
+    static DECLCALLBACK(void) i_displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp);
+
+    static DECLCALLBACK(void) i_displayVRecCompletion(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
 #endif
-    static DECLCALLBACK(void) displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
+    static DECLCALLBACK(void) i_displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion);
 
-    static DECLCALLBACK(void)  displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
-    static DECLCALLBACK(int)   displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
-    static DECLCALLBACK(void)  displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
-    static DECLCALLBACK(int)   displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
+    static DECLCALLBACK(void) i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser);
+    static DECLCALLBACK(int)  i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
+    static DECLCALLBACK(void) i_displaySSMSave(PSSMHANDLE pSSM, void *pvUser);
+    static DECLCALLBACK(int)  i_displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass);
 
     Console * const         mParent;
     /** Pointer to the associated display driver. */
-    struct DRVMAINDISPLAY  *mpDrv;
+    struct DRVMAINDISPLAY   *mpDrv;
     /** Pointer to the device instance for the VMM Device. */
     PPDMDEVINS              mpVMMDev;
     /** Set after the first attempt to find the VMM Device. */
@@ -345,25 +393,13 @@ private:
     /** Mirror of the current host cursor capabilities. */
     uint32_t    mfHostCursorCapabilities;
 
-    /* arguments of the last handleDisplayResize() call */
-    void       *mLastAddress;
-    uint32_t    mLastBytesPerLine;
-    uint32_t    mLastBitsPerPixel;
-    uint32_t    mLastWidth;
-    uint32_t    mLastHeight;
-    uint16_t    mLastFlags;
+    bool mfSourceBitmapEnabled;
+    bool volatile fVGAResizing;
 
-    VBVAMEMORY *mpVbvaMemory;
-    bool        mfVideoAccelEnabled;
     bool        mfVideoAccelVRDP;
     uint32_t    mfu32SupportedOrders;
-
     int32_t volatile mcVideoAccelVRDPRefs;
 
-    VBVAMEMORY *mpPendingVbvaMemory;
-    bool        mfPendingVideoAccelEnable;
-    bool        mfMachineRunning;
-
     /** Accelerate3DEnabled = true && GraphicsControllerType == VBoxVGA. */
     bool        mfIsCr3DEnabled;
 
@@ -371,9 +407,6 @@ private:
     bool        mfCrOglDataHidden;
 #endif
 
-    uint8_t    *mpu8VbvaPartial;
-    uint32_t    mcbVbvaPartial;
-
 #ifdef VBOX_WITH_CRHGSMI
     /* for fast host hgcm calls */
     HGCMCVSHANDLE mhCrOglSvc;
@@ -386,31 +419,37 @@ private:
     VBOXCRCMDCTL_HGCM mCrOglScreenshotCtl;
 #endif
 
-    bool vbvaFetchCmd(VBVACMDHDR **ppHdr, uint32_t *pcbCmd);
-    void vbvaReleaseCmd(VBVACMDHDR *pHdr, int32_t cbCmd);
+    /* The legacy VBVA data and methods. */
+    VIDEOACCEL mVideoAccelLegacy;
 
-    void handleResizeCompletedEMT(BOOL fResizeContext);
+    int  i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
+    void i_VideoAccelFlush(PPDMIDISPLAYPORT pUpPort);
+    bool i_VideoAccelAllowed(void);
 
-    RTCRITSECT mVBVALock;
-    volatile uint32_t mfu32PendingVideoAccelDisable;
+    int  i_videoAccelRefreshProcess(PPDMIDISPLAYPORT pUpPort);
+    int  i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort);
+    int  i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort);
 
-    int  vbvaLock(void);
-    void vbvaUnlock(void);
+    /* Legacy pre-HGSMI handlers. */
+    void processAdapterData(void *pvVRAM, uint32_t u32VRAMSize);
+    void processDisplayData(void *pvVRAM, unsigned uScreenId);
 
-    RTCRITSECT mSaveSeamlessRectLock;
-    int  SaveSeamlessRectLock(void);
-    void SaveSeamlessRectUnLock(void);
+    /* Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
+    RTCRITSECT mVideoAccelLock;
 
 public:
-    static int  displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);
+
+    static int i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData,
+                                          uint32_t *pu32Width, uint32_t *pu32Height);
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    static BOOL  displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data, uint32_t u32Width, uint32_t u32Height);
-    int crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
-    int crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
+    static BOOL  i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data,
+                                                   uint32_t u32Width, uint32_t u32Height);
+    int i_crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion);
+    int i_crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
     /* copies the given command and submits it asynchronously,
      * i.e. the pCmd data may be discarded right after the call returns */
-    int crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
+    int i_crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
     /* performs synchronous request processing if 3D backend has something to display
      * this is primarily to work-around 3d<->main thread deadlocks on OSX
      * in case of async completion, the command is coppied to the allocated buffer,
@@ -418,23 +457,17 @@ public:
      * can be used for "notification" commands, when client is not interested in command result,
      * that must synchronize with 3D backend only when some 3D data is displayed.
      * The routine does NOT provide any info on whether command is processed asynchronously or not */
-    int crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
+    int i_crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd);
 #endif
 
 private:
-    static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
-    static int  drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
-
-    int  videoAccelRefreshProcess(void);
-
-    /* Functions run under VBVA lock. */
-    int  videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);
-    void videoAccelFlush(void);
+    static int i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll);
+    static int i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);
 
     void i_updateGuestGraphicsFacility(void);
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    int crOglWindowsShow(bool fShow);
+    int i_crOglWindowsShow(bool fShow);
 #endif
 
 #ifdef VBOX_WITH_HGSMI
@@ -447,16 +480,82 @@ private:
 #endif
 };
 
+/* The legacy VBVA helpers. */
+int videoAccelConstruct(VIDEOACCEL *pVideoAccel);
+void videoAccelDestroy(VIDEOACCEL *pVideoAccel);
+void i_vbvaSetMemoryFlags(VBVAMEMORY *pVbvaMemory,
+                          bool fVideoAccelEnabled,
+                          bool fVideoAccelVRDP,
+                          uint32_t fu32SupportedOrders,
+                          DISPLAYFBINFO *paFBInfos,
+                          unsigned cFBInfos);
+int videoAccelEnterVGA(VIDEOACCEL *pVideoAccel);
+void videoAccelLeaveVGA(VIDEOACCEL *pVideoAccel);
+int videoAccelEnterVMMDev(VIDEOACCEL *pVideoAccel);
+void videoAccelLeaveVMMDev(VIDEOACCEL *pVideoAccel);
+
+
+/* helper function, code in DisplayResampleImage.cpp */
 void gdImageCopyResampled(uint8_t *dst, uint8_t *src,
-                          int dstX, int dstY, int srcX, int srcY,
-                          int dstW, int dstH, int srcW, int srcH);
+                            int dstX, int dstY, int srcX, int srcY,
+                            int dstW, int dstH, int srcW, int srcH);
 
 void BitmapScale32(uint8_t *dst, int dstW, int dstH,
                    const uint8_t *src, int iDeltaLine, int srcW, int srcH);
 
+/* helper function, code in DisplayPNGUtul.cpp */
 int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
                    uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG,
-                   uint8_t fLimitSize);
+                     uint8_t fLimitSize);
+
+class ATL_NO_VTABLE DisplaySourceBitmap:
+    public DisplaySourceBitmapWrap
+{
+public:
+
+    DECLARE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
+
+    HRESULT FinalConstruct();
+    void FinalRelease();
+
+    /* Public initializer/uninitializer for internal purposes only. */
+    HRESULT init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo);
+    void uninit();
+
+    bool i_usesVRAM(void) { return m.pu8Allocated == NULL; }
+
+private:
+    // wrapped IDisplaySourceBitmap properties
+    virtual HRESULT getScreenId(ULONG *aScreenId);
+
+    // wrapped IDisplaySourceBitmap methods
+    virtual HRESULT queryBitmapInfo(BYTE **aAddress,
+                                    ULONG *aWidth,
+                                    ULONG *aHeight,
+                                    ULONG *aBitsPerPixel,
+                                    ULONG *aBytesPerLine,
+                                    BitmapFormat_T *aBitmapFormat);
+
+    int initSourceBitmap(unsigned aScreenId, DISPLAYFBINFO *pFBInfo);
+
+    struct Data
+    {
+        ComObjPtr<Display> pDisplay;
+        unsigned uScreenId;
+        DISPLAYFBINFO *pFBInfo;
+
+        uint8_t *pu8Allocated;
+
+        uint8_t *pu8Address;
+        ULONG ulWidth;
+        ULONG ulHeight;
+        ULONG ulBitsPerPixel;
+        ULONG ulBytesPerLine;
+        BitmapFormat_T bitmapFormat;
+    };
+
+    Data m;
+};
 
 #endif // ____H_DISPLAYIMPL
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/DisplayUtils.h b/src/VBox/Main/include/DisplayUtils.h
index e69784e..ae805db 100644
--- a/src/VBox/Main/include/DisplayUtils.h
+++ b/src/VBox/Main/include/DisplayUtils.h
@@ -1,3 +1,4 @@
+/* $Id: DisplayUtils.h $ */
 /** @file
  * Display helper declarations
  */
diff --git a/src/VBox/Main/include/DrvAudioVRDE.h b/src/VBox/Main/include/DrvAudioVRDE.h
new file mode 100644
index 0000000..7d31636
--- /dev/null
+++ b/src/VBox/Main/include/DrvAudioVRDE.h
@@ -0,0 +1,64 @@
+/* $Id: DrvAudioVRDE.h $ */
+/** @file
+ * VirtualBox driver interface to VRDE backend.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_DRVAUDIOVRDE
+#define ____H_DRVAUDIOVRDE
+
+#include <VBox/com/ptr.h>
+#include <VBox/RemoteDesktop/VRDE.h>
+#include <VBox/vmm/pdmdrv.h>
+#include <VBox/vmm/pdmifs.h>
+
+class Console;
+
+class AudioVRDE
+{
+
+public:
+
+    AudioVRDE(Console *pConsole);
+    virtual ~AudioVRDE(void);
+
+public:
+
+    static const PDMDRVREG DrvReg;
+
+    Console *getParent(void) { return mParent; }
+
+public:
+
+    int onVRDEControl(bool fEnable, uint32_t uFlags);
+    int onVRDEInputBegin(void *pvContext, PVRDEAUDIOINBEGIN pVRDEAudioBegin);
+    int onVRDEInputData(void *pvContext, const void *pvData, uint32_t cbData);
+    int onVRDEInputEnd(void *pvContext);
+    int onVRDEInputIntercept(bool fIntercept);
+
+public:
+
+    static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
+    static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
+
+private:
+
+    /** Pointer to the associated VRDE audio driver. */
+    struct DRVAUDIOVRDE *mpDrv;
+    /** Pointer to parent. */
+    Console * const mParent;
+};
+
+#endif /* !____H_DRVAUDIOVRDE */
+
diff --git a/src/VBox/Main/include/DrvAudioVideoRec.h b/src/VBox/Main/include/DrvAudioVideoRec.h
new file mode 100644
index 0000000..cef1e50
--- /dev/null
+++ b/src/VBox/Main/include/DrvAudioVideoRec.h
@@ -0,0 +1,62 @@
+/* $Id: DrvAudioVideoRec.h $ */
+/** @file
+ * VirtualBox driver interface to video recording backend.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_DRVAUDIOVIDEOREC
+#define ____H_DRVAUDIOVIDEOREC
+
+#include <VBox/com/ptr.h>
+#include <VBox/vmm/pdmdrv.h>
+#include <VBox/vmm/pdmifs.h>
+
+class Console;
+
+class AudioVideoRec
+{
+
+public:
+
+    AudioVideoRec(Console *pConsole);
+    virtual ~AudioVideoRec(void);
+
+public:
+
+    static const PDMDRVREG DrvReg;
+
+    Console *getParent(void) { return mParent; }
+
+public:
+
+    int handleVideoRecSvrCmdAudioInputIntercept(bool fIntercept);
+    int handleVideoRecSvrCmdAudioInputEventBegin(void *pvContext, int iSampleHz, int cChannels, int cBits, bool fUnsigned);
+    int handleVideoRecSvrCmdAudioInputEventData(void *pvContext, const void *pvData, uint32_t cbData);
+    int handleVideoRecSvrCmdAudioInputEventEnd(void *pvContext);
+
+public:
+
+    static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
+    static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
+
+private:
+
+    /** Pointer to the associated video recording audio driver. */
+    struct DRVAUDIOVIDEOREC *mpDrv;
+    /** Pointer to parent. */
+    Console * const mParent;
+};
+
+#endif /* !____H_DRVAUDIOVIDEOREC */
+
diff --git a/src/VBox/Main/include/EmulatedUSBImpl.h b/src/VBox/Main/include/EmulatedUSBImpl.h
index fd8af0a..eabbebc 100644
--- a/src/VBox/Main/include/EmulatedUSBImpl.h
+++ b/src/VBox/Main/include/EmulatedUSBImpl.h
@@ -42,14 +42,14 @@ public:
     void uninit();
 
     /* Public method for internal use. */
-    static DECLCALLBACK(int) eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
-                                          const void *pvData, uint32_t cbData);
-
-    HRESULT webcamAttachInternal(const com::Utf8Str &aPath,
-                                 const com::Utf8Str &aSettings,
-                                 const char *pszDriver,
-                                 void *pvObject);
-    HRESULT webcamDetachInternal(const com::Utf8Str &aPath);
+    static DECLCALLBACK(int) i_eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
+                                            const void *pvData, uint32_t cbData);
+
+    HRESULT i_webcamAttachInternal(const com::Utf8Str &aPath,
+                                   const com::Utf8Str &aSettings,
+                                   const char *pszDriver,
+                                   void *pvObject);
+    HRESULT i_webcamDetachInternal(const com::Utf8Str &aPath);
 
 private:
 
diff --git a/src/VBox/Main/include/EventImpl.h b/src/VBox/Main/include/EventImpl.h
index 414ce01..faade26 100644
--- a/src/VBox/Main/include/EventImpl.h
+++ b/src/VBox/Main/include/EventImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,26 +18,16 @@
 #ifndef ____H_EVENTIMPL
 #define ____H_EVENTIMPL
 
-#include "VirtualBoxBase.h"
+#include "EventWrap.h"
+#include "EventSourceWrap.h"
+#include "VetoEventWrap.h"
 
 
 class ATL_NO_VTABLE VBoxEvent :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IEvent)
+    public EventWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VBoxEvent, IEvent)
-
-    DECLARE_NOT_AGGREGATABLE(VBoxEvent)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(VBoxEvent)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IEvent)
-    END_COM_MAP()
-
-    VBoxEvent() {}
-    virtual ~VBoxEvent() {}
+    DECLARE_EMPTY_CTOR_DTOR(VBoxEvent)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -46,39 +36,26 @@ public:
     HRESULT init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable);
     void uninit();
 
-    // IEvent properties
-    STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType);
-    STDMETHOD(COMGETTER(Source))(IEventSource * *aSource);
-    STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable);
+private:
+    // wrapped IEvent properties
+    HRESULT getType(VBoxEventType_T *aType);
+    HRESULT getSource(ComPtr<IEventSource> &aSource);
+    HRESULT getWaitable(BOOL *aWaitable);
 
-    // IEvent methods
-    STDMETHOD(SetProcessed)();
-    STDMETHOD(WaitProcessed)(LONG aTimeout, BOOL *aResult);
+    // wrapped IEvent methods
+    HRESULT setProcessed();
+    HRESULT waitProcessed(LONG aTimeout, BOOL *aResult);
 
-private:
     struct Data;
-
     Data* m;
 };
 
+
 class ATL_NO_VTABLE VBoxVetoEvent :
-    public VBoxEvent,
-    VBOX_SCRIPTABLE_IMPL(IVetoEvent)
+    public VetoEventWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VBoxVetoEvent, IVetoEvent)
-
-    DECLARE_NOT_AGGREGATABLE(VBoxVetoEvent)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(VBoxVetoEvent)
-        COM_INTERFACE_ENTRY2(IEvent, IVetoEvent)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IVetoEvent)
-    END_COM_MAP()
-
-    VBoxVetoEvent() {}
-    virtual ~VBoxVetoEvent() {}
+    DECLARE_EMPTY_CTOR_DTOR(VBoxVetoEvent)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -87,57 +64,32 @@ public:
     HRESULT init(IEventSource *aSource, VBoxEventType_T aType);
     void uninit();
 
-    // IEvent properties
-    STDMETHOD(COMGETTER(Type))(VBoxEventType_T *aType)
-    {
-        return VBoxEvent::COMGETTER(Type)(aType);
-    }
-    STDMETHOD(COMGETTER(Source))(IEventSource * *aSource)
-    {
-        return VBoxEvent::COMGETTER(Source)(aSource);
-    }
-    STDMETHOD(COMGETTER(Waitable))(BOOL *aWaitable)
-    {
-        return VBoxEvent::COMGETTER(Waitable)(aWaitable);
-    }
-
-    // IEvent methods
-    STDMETHOD(SetProcessed)()
-    {
-        return VBoxEvent::SetProcessed();
-    }
-    STDMETHOD(WaitProcessed)(LONG aTimeout, BOOL *aResult)
-    {
-        return VBoxEvent::WaitProcessed(aTimeout, aResult);
-    }
-
-     // IVetoEvent methods
-    STDMETHOD(AddVeto)(IN_BSTR aVeto);
-    STDMETHOD(IsVetoed)(BOOL *aResult);
-    STDMETHOD(GetVetos)(ComSafeArrayOut(BSTR, aVetos));
-
 private:
-    struct Data;
+    // wrapped IEvent properties
+    HRESULT getType(VBoxEventType_T *aType);
+    HRESULT getSource(ComPtr<IEventSource> &aSource);
+    HRESULT getWaitable(BOOL *aWaitable);
+
+    // wrapped IEvent methods
+    HRESULT setProcessed();
+    HRESULT waitProcessed(LONG aTimeout, BOOL *aResult);
+
+    // wrapped IVetoEvent methods
+    HRESULT addVeto(const com::Utf8Str &aReason);
+    HRESULT isVetoed(BOOL *aResult);
+    HRESULT getVetos(std::vector<com::Utf8Str> &aResult);
+    HRESULT addApproval(const com::Utf8Str &aReason);
+    HRESULT isApproved(BOOL *aResult);
+    HRESULT getApprovals(std::vector<com::Utf8Str> &aResult);
 
+    struct Data;
     Data* m;
 };
 
 class ATL_NO_VTABLE EventSource :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IEventSource)
+    public EventSourceWrap
 {
 public:
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(EventSource, IEventSource)
-
-    DECLARE_NOT_AGGREGATABLE(EventSource)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(EventSource)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IEventSource)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR(EventSource)
 
     HRESULT FinalConstruct();
@@ -147,22 +99,26 @@ public:
     HRESULT init();
     void uninit();
 
-    // IEventSource methods
-    STDMETHOD(CreateListener)(IEventListener **aListener);
-    STDMETHOD(CreateAggregator)(ComSafeArrayIn(IEventSource *, aSubordinates),
-                                IEventSource **aAggregator);
-    STDMETHOD(RegisterListener)(IEventListener *aListener,
-                                ComSafeArrayIn(VBoxEventType_T, aInterested),
-                                BOOL aActive);
-    STDMETHOD(UnregisterListener)(IEventListener *aListener);
-    STDMETHOD(FireEvent)(IEvent *aEvent, LONG aTimeout, BOOL *aProcessed);
-    STDMETHOD(GetEvent)(IEventListener *aListener, LONG aTimeout,
-                        IEvent **aEvent);
-    STDMETHOD(EventProcessed)(IEventListener *aListener, IEvent *aEvent);
-
 private:
-    struct Data;
+    // wrapped IEventSource methods
+    HRESULT createListener(ComPtr<IEventListener> &aListener);
+    HRESULT createAggregator(const std::vector<ComPtr<IEventSource> > &aSubordinates,
+                             ComPtr<IEventSource> &aResult);
+    HRESULT registerListener(const ComPtr<IEventListener> &aListener,
+                             const std::vector<VBoxEventType_T> &aInteresting,
+                             BOOL aActive);
+    HRESULT unregisterListener(const ComPtr<IEventListener> &aListener);
+    HRESULT fireEvent(const ComPtr<IEvent> &aEvent,
+                      LONG aTimeout,
+                      BOOL *aResult);
+    HRESULT getEvent(const ComPtr<IEventListener> &aListener,
+                     LONG aTimeout,
+                     ComPtr<IEvent> &aEvent);
+    HRESULT eventProcessed(const ComPtr<IEventListener> &aListener,
+                           const ComPtr<IEvent> &aEvent);
+
 
+    struct Data;
     Data* m;
 
     friend class ListenerRecord;
@@ -219,4 +175,5 @@ private:
     ComPtr<IEventSource>    mEventSource;
 };
 
+
 #endif // ____H_EVENTIMPL
diff --git a/src/VBox/Main/include/ExtPackManagerImpl.h b/src/VBox/Main/include/ExtPackManagerImpl.h
index e6f2c7f..e6aaf5d 100644
--- a/src/VBox/Main/include/ExtPackManagerImpl.h
+++ b/src/VBox/Main/include/ExtPackManagerImpl.h
@@ -20,6 +20,9 @@
 
 #include "VirtualBoxBase.h"
 #include <VBox/ExtPack/ExtPack.h>
+#include "ExtPackWrap.h"
+#include "ExtPackFileWrap.h"
+#include "ExtPackManagerWrap.h"
 #include <iprt/fs.h>
 
 #if !defined(VBOX_COM_INPROC)
@@ -27,49 +30,17 @@
  * An extension pack file.
  */
 class ATL_NO_VTABLE ExtPackFile :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IExtPackFile)
+    public ExtPackFileWrap
 {
 public:
     /** @name COM and internal init/term/mapping cruft.
      * @{ */
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackFile, IExtPackFile)
-    DECLARE_NOT_AGGREGATABLE(ExtPackFile)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-    BEGIN_COM_MAP(ExtPackFile)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IExtPackFile)
-        COM_INTERFACE_ENTRY(IExtPackBase)
-    END_COM_MAP()
     DECLARE_EMPTY_CTOR_DTOR(ExtPackFile)
 
     HRESULT     FinalConstruct();
     void        FinalRelease();
     HRESULT     initWithFile(const char *a_pszFile, const char *a_pszDigest, class ExtPackManager *a_pExtPackMgr, VirtualBox *a_pVirtualBox);
     void        uninit();
-    RTMEMEF_NEW_AND_DELETE_OPERATORS();
-    /** @}  */
-
-    /** @name IExtPackBase interfaces
-     * @{ */
-    STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
-    STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
-    STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
-    STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
-    STDMETHOD(COMGETTER(Edition))(BSTR *a_pbstrEdition);
-    STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule);
-    STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
-    STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
-    STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
-    STDMETHOD(COMGETTER(ShowLicense))(BOOL *a_pfShowIt);
-    STDMETHOD(COMGETTER(License))(BSTR *a_pbstrHtmlLicense);
-    STDMETHOD(QueryLicense)(IN_BSTR a_bstrPreferredLocale, IN_BSTR a_bstrPreferredLanguage,
-                            IN_BSTR a_bstrFormat, BSTR *a_pbstrLicense);
-    /** @}  */
-
-    /** @name IExtPackFile interfaces
-     * @{ */
-    STDMETHOD(COMGETTER(FilePath))(BSTR *a_pbstrPath);
-    STDMETHOD(Install)(BOOL a_fReplace, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress);
     /** @}  */
 
 private:
@@ -79,6 +50,30 @@ private:
     /** @} */
 
 private:
+
+    // wrapped IExtPackFile properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getDescription(com::Utf8Str &aDescription);
+    HRESULT getVersion(com::Utf8Str &aVersion);
+    HRESULT getRevision(ULONG *aRevision);
+    HRESULT getEdition(com::Utf8Str &aEdition);
+    HRESULT getVRDEModule(com::Utf8Str &aVRDEModule);
+    HRESULT getPlugIns(std::vector<ComPtr<IExtPackPlugIn> > &aPlugIns);
+    HRESULT getUsable(BOOL *aUsable);
+    HRESULT getWhyUnusable(com::Utf8Str &aWhyUnusable);
+    HRESULT getShowLicense(BOOL *aShowLicense);
+    HRESULT getLicense(com::Utf8Str &aLicense);
+    HRESULT getFilePath(com::Utf8Str &aFilePath);
+
+    // wrapped IExtPackFile methods
+    HRESULT queryLicense(const com::Utf8Str &aPreferredLocale,
+                         const com::Utf8Str &aPreferredLanguage,
+                         const com::Utf8Str &aFormat,
+                         com::Utf8Str &aLicenseText);
+    HRESULT install(BOOL aReplace,
+                    const com::Utf8Str &aDisplayInfo,
+                    ComPtr<IProgress> &aProgess);
+
     struct Data;
     /** Pointer to the private instance. */
     Data *m;
@@ -92,19 +87,11 @@ private:
  * An installed extension pack.
  */
 class ATL_NO_VTABLE ExtPack :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IExtPack)
+    public ExtPackWrap
 {
 public:
     /** @name COM and internal init/term/mapping cruft.
      * @{ */
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPack, IExtPack)
-    DECLARE_NOT_AGGREGATABLE(ExtPack)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-    BEGIN_COM_MAP(ExtPack)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IExtPack)
-        COM_INTERFACE_ENTRY(IExtPackBase)
-    END_COM_MAP()
     DECLARE_EMPTY_CTOR_DTOR(ExtPack)
 
     HRESULT     FinalConstruct();
@@ -114,67 +101,68 @@ public:
     RTMEMEF_NEW_AND_DELETE_OPERATORS();
     /** @}  */
 
-    /** @name IExtPackBase interfaces
-     * @{ */
-    STDMETHOD(COMGETTER(Name))(BSTR *a_pbstrName);
-    STDMETHOD(COMGETTER(Description))(BSTR *a_pbstrDescription);
-    STDMETHOD(COMGETTER(Version))(BSTR *a_pbstrVersion);
-    STDMETHOD(COMGETTER(Revision))(ULONG *a_puRevision);
-    STDMETHOD(COMGETTER(Edition))(BSTR *a_pbstrEdition);
-    STDMETHOD(COMGETTER(VRDEModule))(BSTR *a_pbstrVrdeModule);
-    STDMETHOD(COMGETTER(PlugIns))(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns));
-    STDMETHOD(COMGETTER(Usable))(BOOL *a_pfUsable);
-    STDMETHOD(COMGETTER(WhyUnusable))(BSTR *a_pbstrWhy);
-    STDMETHOD(COMGETTER(ShowLicense))(BOOL *a_pfShowIt);
-    STDMETHOD(COMGETTER(License))(BSTR *a_pbstrHtmlLicense);
-    STDMETHOD(QueryLicense)(IN_BSTR a_bstrPreferredLocale, IN_BSTR a_bstrPreferredLanguage,
-                            IN_BSTR a_bstrFormat, BSTR *a_pbstrLicense);
-    /** @}  */
-
-    /** @name IExtPack interfaces
-     * @{ */
-    STDMETHOD(QueryObject)(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown);
-    /** @}  */
-
     /** @name Internal interfaces used by ExtPackManager.
      * @{ */
-    bool        callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo);
-    HRESULT     callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
-    bool        callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
-    bool        callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock);
-    bool        callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock);
-    bool        callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
-    bool        callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
-    bool        callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock);
-    HRESULT     checkVrde(void);
-    HRESULT     getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary);
-    HRESULT     getLibraryName(const char *a_pszModuleName, Utf8Str *a_pstrLibrary);
-    bool        wantsToBeDefaultVrde(void) const;
-    HRESULT     refresh(bool *pfCanDelete);
+    bool        i_callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo);
+    HRESULT     i_callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval);
+    bool        i_callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock);
+    bool        i_callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock);
+    bool        i_callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock);
+    bool        i_callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
+    bool        i_callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc);
+    bool        i_callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock);
+    HRESULT     i_checkVrde(void);
+    HRESULT     i_getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary);
+    HRESULT     i_getLibraryName(const char *a_pszModuleName, Utf8Str *a_pstrLibrary);
+    bool        i_wantsToBeDefaultVrde(void) const;
+    HRESULT     i_refresh(bool *pfCanDelete);
     /** @}  */
 
 protected:
     /** @name Internal helper methods.
      * @{ */
-    void        probeAndLoad(void);
-    bool        findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
-                           Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
-    static bool objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
+    void        i_probeAndLoad(void);
+    bool        i_findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
+                             Utf8Str *a_ppStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const;
+    static bool i_objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2);
     /** @}  */
 
     /** @name Extension Pack Helpers
      * @{ */
-    static DECLCALLBACK(int)    hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
-                                              VBOXEXTPACKMODKIND enmKind, char *pszFound, size_t cbFound, bool *pfNative);
-    static DECLCALLBACK(int)    hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
-    static DECLCALLBACK(VBOXEXTPACKCTX) hlpGetContext(PCVBOXEXTPACKHLP pHlp);
-    static DECLCALLBACK(int)    hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole, const char *pszServiceLibrary, const char *pszServiceName);
-    static DECLCALLBACK(int)    hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary);
-    static DECLCALLBACK(int)    hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary);
-    static DECLCALLBACK(int)    hlpReservedN(PCVBOXEXTPACKHLP pHlp);
+    static DECLCALLBACK(int)    i_hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt,
+                                                VBOXEXTPACKMODKIND enmKind, char *pszFound, size_t cbFound, bool *pfNative);
+    static DECLCALLBACK(int)    i_hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath);
+    static DECLCALLBACK(VBOXEXTPACKCTX) i_hlpGetContext(PCVBOXEXTPACKHLP pHlp);
+    static DECLCALLBACK(int)    i_hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole, const char *pszServiceLibrary, const char *pszServiceName);
+    static DECLCALLBACK(int)    i_hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary);
+    static DECLCALLBACK(int)    i_hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary);
+    static DECLCALLBACK(int)    i_hlpReservedN(PCVBOXEXTPACKHLP pHlp);
     /** @}  */
 
 private:
+
+    // wrapped IExtPack properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getDescription(com::Utf8Str &aDescription);
+    HRESULT getVersion(com::Utf8Str &aVersion);
+    HRESULT getRevision(ULONG *aRevision);
+    HRESULT getEdition(com::Utf8Str &aEdition);
+    HRESULT getVRDEModule(com::Utf8Str &aVRDEModule);
+    HRESULT getPlugIns(std::vector<ComPtr<IExtPackPlugIn> > &aPlugIns);
+    HRESULT getUsable(BOOL *aUsable);
+    HRESULT getWhyUnusable(com::Utf8Str &aWhyUnusable);
+    HRESULT getShowLicense(BOOL *aShowLicense);
+    HRESULT getLicense(com::Utf8Str &aLicense);
+
+    // wrapped IExtPack methods
+    HRESULT queryLicense(const com::Utf8Str &aPreferredLocale,
+                         const com::Utf8Str &aPreferredLanguage,
+                         const com::Utf8Str &aFormat,
+                         com::Utf8Str &aLicenseText);
+    HRESULT queryObject(const com::Utf8Str &aObjUuid,
+                        ComPtr<IUnknown> &aReturnInterface);
+
+
     struct Data;
     /** Pointer to the private instance. */
     Data *m;
@@ -187,64 +175,65 @@ private:
  * Extension pack manager.
  */
 class ATL_NO_VTABLE ExtPackManager :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IExtPackManager)
+    public ExtPackManagerWrap
 {
+public:
     /** @name COM and internal init/term/mapping cruft.
      * @{ */
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ExtPackManager, IExtPackManager)
-    DECLARE_NOT_AGGREGATABLE(ExtPackManager)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-    BEGIN_COM_MAP(ExtPackManager)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IExtPackManager)
-    END_COM_MAP()
     DECLARE_EMPTY_CTOR_DTOR(ExtPackManager)
 
     HRESULT     FinalConstruct();
     void        FinalRelease();
     HRESULT     initExtPackManager(VirtualBox *a_pVirtualBox, VBOXEXTPACKCTX a_enmContext);
     void        uninit();
-    RTMEMEF_NEW_AND_DELETE_OPERATORS();
-    /** @}  */
-
-    /** @name IExtPack interfaces
-     * @{ */
-    STDMETHOD(COMGETTER(InstalledExtPacks))(ComSafeArrayOut(IExtPack *, a_paExtPacks));
-    STDMETHOD(Find)(IN_BSTR a_bstrName, IExtPack **a_pExtPack);
-    STDMETHOD(OpenExtPackFile)(IN_BSTR a_bstrTarball, IExtPackFile **a_ppExtPackFile);
-    STDMETHOD(Uninstall)(IN_BSTR a_bstrName, BOOL a_fForcedRemoval, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress);
-    STDMETHOD(Cleanup)(void);
-    STDMETHOD(QueryAllPlugInsForFrontend)(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules));
-    STDMETHOD(IsExtPackUsable(IN_BSTR a_bstrExtPack, BOOL *aUsable));
     /** @}  */
 
     /** @name Internal interfaces used by other Main classes.
      * @{ */
 #if !defined(VBOX_COM_INPROC)
-    static DECLCALLBACK(int) doInstallThreadProc(RTTHREAD hThread, void *pvJob);
-    HRESULT     doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo);
-    static DECLCALLBACK(int) doUninstallThreadProc(RTTHREAD hThread, void *pvJob);
-    HRESULT     doUninstall(const Utf8Str *a_pstrName, bool a_fForcedRemoval, const Utf8Str *a_pstrDisplayInfo);
+    static DECLCALLBACK(int) i_doInstallThreadProc(RTTHREAD hThread, void *pvJob);
+    HRESULT     i_doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo);
+    static DECLCALLBACK(int) i_doUninstallThreadProc(RTTHREAD hThread, void *pvJob);
+    HRESULT     i_doUninstall(const Utf8Str *a_pstrName, bool a_fForcedRemoval, const Utf8Str *a_pstrDisplayInfo);
 #endif
-    void        callAllVirtualBoxReadyHooks(void);
-    void        callAllConsoleReadyHooks(IConsole *a_pConsole);
-    void        callAllVmCreatedHooks(IMachine *a_pMachine);
-    int         callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
-    int         callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
-    void        callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
-    HRESULT     checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
-    int         getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
-    HRESULT     getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrLibrary);
-    HRESULT     getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
-    bool        isExtPackUsable(const char *a_pszExtPack);
-    void        dumpAllToReleaseLog(void);
+    void        i_callAllVirtualBoxReadyHooks(void);
+    void        i_callAllConsoleReadyHooks(IConsole *a_pConsole);
+    void        i_callAllVmCreatedHooks(IMachine *a_pMachine);
+    int         i_callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM);
+    int         i_callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM);
+    void        i_callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM);
+    HRESULT     i_checkVrdeExtPack(Utf8Str const *a_pstrExtPack);
+    int         i_getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary);
+    HRESULT     i_getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrLibrary);
+    HRESULT     i_getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack);
+    bool        i_isExtPackUsable(const char *a_pszExtPack);
+    void        i_dumpAllToReleaseLog(void);
     /** @}  */
 
 private:
-    HRESULT     runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...);
-    ExtPack    *findExtPack(const char *a_pszName);
-    void        removeExtPack(const char *a_pszName);
-    HRESULT     refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
+
+    // wrapped IExtPackManager properties
+    HRESULT getInstalledExtPacks(std::vector<ComPtr<IExtPack> > &aInstalledExtPacks);
+
+   // wrapped IExtPackManager methods
+    HRESULT find(const com::Utf8Str &aName,
+                 ComPtr<IExtPack> &aReturnData);
+    HRESULT openExtPackFile(const com::Utf8Str &aPath,
+                                  ComPtr<IExtPackFile> &aFile);
+    HRESULT uninstall(const com::Utf8Str &aName,
+                      BOOL aForcedRemoval,
+                      const com::Utf8Str &aDisplayInfo,
+                      ComPtr<IProgress> &aProgess);
+    HRESULT cleanup();
+    HRESULT queryAllPlugInsForFrontend(const com::Utf8Str &aFrontendName,
+                                       std::vector<com::Utf8Str> &aPlugInModules);
+    HRESULT isExtPackUsable(const com::Utf8Str &aName,
+                            BOOL *aUsable);
+
+    HRESULT     i_runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...);
+    ExtPack    *i_findExtPack(const char *a_pszName);
+    void        i_removeExtPack(const char *a_pszName);
+    HRESULT     i_refreshExtPack(const char *a_pszName, bool a_fUnsuableIsError, ExtPack **a_ppExtPack);
 
 private:
     struct Data;
diff --git a/src/VBox/Main/include/FramebufferImpl.h b/src/VBox/Main/include/FramebufferImpl.h
deleted file mode 100644
index feebfcd..0000000
--- a/src/VBox/Main/include/FramebufferImpl.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $Id: FramebufferImpl.h $ */
-
-/** @file
- *
- * Frame buffer COM class implementation
- */
-
-/*
- * Copyright (C) 2009-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef ____H_H_FRAMEBUFFERIMPL
-#define ____H_H_FRAMEBUFFERIMPL
-
-#include "VirtualBoxBase.h"
-#include "VirtualBoxImpl.h"
-
-class ATL_NO_VTABLE Framebuffer :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IFramebuffer)
-{
-public:
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Framebuffer, IFramebuffer)
-
-    DECLARE_NOT_AGGREGATABLE (Framebuffer)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP (Framebuffer)
-        VBOX_DEFAULT_INTERFACE_ENTRIES (IFramebuffer)
-    END_COM_MAP()
-
-    DECLARE_EMPTY_CTOR_DTOR (Framebuffer)
-
-    /* IFramebuffer properties */
-    STDMETHOD(COMGETTER(Address)) (BYTE **aAddress) = 0;
-    STDMETHOD(COMGETTER(Width)) (ULONG *aWidth) = 0;
-    STDMETHOD(COMGETTER(Height)) (ULONG *aHeight) = 0;
-    STDMETHOD(COMGETTER(BitsPerPixel)) (ULONG *aBitsPerPixel) = 0;
-    STDMETHOD(COMGETTER(BytesPerLine)) (ULONG *aBytesPerLine) = 0;
-    STDMETHOD(COMGETTER(PixelFormat)) (ULONG *aPixelFormat) = 0;
-    STDMETHOD(COMGETTER(UsesGuestVRAM)) (BOOL *aUsesGuestVRAM) = 0;
-    STDMETHOD(COMGETTER(HeightReduction)) (ULONG *aHeightReduction) = 0;
-    STDMETHOD(COMGETTER(Overlay)) (IFramebufferOverlay **aOverlay) = 0;
-    STDMETHOD(COMGETTER(WinId)) (ULONG64 *winId) = 0;
-
-    /* IFramebuffer methods */
-    STDMETHOD(Lock)() = 0;
-    STDMETHOD(Unlock)() = 0;
-
-    STDMETHOD(RequestResize) (ULONG aScreenId, ULONG aPixelFormat,
-                              BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine,
-                              ULONG aWidth, ULONG aHeight,
-                              BOOL *aFinished) = 0;
-
-    STDMETHOD(VideoModeSupported) (ULONG aWidth, ULONG aHeight, ULONG aBPP,
-                                   BOOL *aSupported) = 0;
-
-    STDMETHOD(GetVisibleRegion)(BYTE *aRectangles, ULONG aCount,
-                               ULONG *aCountCopied) = 0;
-    STDMETHOD(SetVisibleRegion)(BYTE *aRectangles, ULONG aCount) = 0;
-
-    STDMETHOD(ProcessVHWACommand)(BYTE *pCommand) = 0;
-};
-
-#endif // ____H_H_FRAMEBUFFERIMPL
-/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/Global.h b/src/VBox/Main/include/Global.h
index 38d9a47..2ee1a14 100644
--- a/src/VBox/Main/include/Global.h
+++ b/src/VBox/Main/include/Global.h
@@ -39,6 +39,7 @@
 #define VBOXOSHINT_ACCEL3D              RT_BIT(10)
 #define VBOXOSHINT_FLOPPY               RT_BIT(11)
 #define VBOXOSHINT_NOUSB                RT_BIT(12)
+#define VBOXOSHINT_TFRESET              RT_BIT(13)
 
 /** The VBoxVRDP kludge extension pack name.
  *
@@ -95,34 +96,11 @@ public:
      * recommended way to detect if the VM is online (being executed in a
      * dedicated process) or not. Note that some online states are also
      * transitional states (see #IsTransitional()).
-     *
-     * @remarks Saving may actually be an offline state according to the
-     *          documentation (offline snapshot).
      */
     static bool IsOnline(MachineState_T aState)
     {
-#if 0
         return aState >= MachineState_FirstOnline &&
                aState <= MachineState_LastOnline;
-#else
-        switch (aState)
-        {
-            case MachineState_Running:
-            case MachineState_Paused:
-            case MachineState_Teleporting:
-            case MachineState_LiveSnapshotting:
-            case MachineState_Stuck:
-            case MachineState_Starting:
-            case MachineState_Stopping:
-            case MachineState_Saving:
-            case MachineState_Restoring:
-            case MachineState_TeleportingPausedVM:
-            case MachineState_TeleportingIn:
-                return true;
-            default:
-                return false;
-        }
-#endif
     }
 
     /**
@@ -134,28 +112,8 @@ public:
      */
     static bool IsTransient(MachineState_T aState)
     {
-#if 0
         return aState >= MachineState_FirstTransient &&
                aState <= MachineState_LastTransient;
-#else
-        switch (aState)
-        {
-            case MachineState_Teleporting:
-            case MachineState_LiveSnapshotting:
-            case MachineState_Starting:
-            case MachineState_Stopping:
-            case MachineState_Saving:
-            case MachineState_Restoring:
-            case MachineState_TeleportingPausedVM:
-            case MachineState_TeleportingIn:
-            case MachineState_RestoringSnapshot:
-            case MachineState_DeletingSnapshot:
-            case MachineState_SettingUp:
-                return true;
-            default:
-                return false;
-        }
-#endif
     }
 
     /**
diff --git a/src/VBox/Main/include/GuestCtrlImplPrivate.h b/src/VBox/Main/include/GuestCtrlImplPrivate.h
index bd8a0f4..84d7b45 100644
--- a/src/VBox/Main/include/GuestCtrlImplPrivate.h
+++ b/src/VBox/Main/include/GuestCtrlImplPrivate.h
@@ -1,10 +1,10 @@
+/* $Id: GuestCtrlImplPrivate.h $ */
 /** @file
- *
  * Internal helpers/structures for guest control functionality.
  */
 
 /*
- * Copyright (C) 2011-2013 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,9 +19,12 @@
 #define ____H_GUESTIMPLPRIVATE
 
 #include "ConsoleImpl.h"
+#include "Global.h"
 
 #include <iprt/asm.h>
+#include <iprt/env.h>
 #include <iprt/semaphore.h>
+#include <iprt/cpp/utils.h>
 
 #include <VBox/com/com.h>
 #include <VBox/com/ErrorInfo.h>
@@ -58,48 +61,516 @@ struct GuestCredentials
 };
 
 
-typedef std::vector <Utf8Str> GuestEnvironmentArray;
-class GuestEnvironment
+
+/**
+ * Wrapper around the RTEnv API, unusable base class.
+ *
+ * @remarks Feel free to elevate this class to iprt/cpp/env.h as RTCEnv.
+ */
+class GuestEnvironmentBase
 {
 public:
+    /**
+     * Default constructor.
+     *
+     * The user must invoke one of the init methods before using the object.
+     */
+    GuestEnvironmentBase(void)
+        : m_hEnv(NIL_RTENV)
+        , m_cRefs(1)
+    { }
 
-    int BuildEnvironmentBlock(void **ppvEnv, size_t *pcbEnv, uint32_t *pcEnvVars);
+    /**
+     * Destructor.
+     */
+    virtual ~GuestEnvironmentBase(void)
+    {
+        Assert(m_cRefs <= 1);
+        int rc = RTEnvDestroy(m_hEnv); AssertRC(rc);
+        m_hEnv = NIL_RTENV;
+    }
 
-    void Clear(void);
+    /**
+     * Retains a reference to this object.
+     * @returns New reference count.
+     * @remarks Sharing an object is currently only safe if no changes are made to
+     *          it because RTENV does not yet implement any locking.  For the only
+     *          purpose we need this, implementing IGuestProcess::environment by
+     *          using IGuestSession::environmentBase, that's fine as the session
+     *          base environment is immutable.
+     */
+    uint32_t retain(void)
+    {
+        uint32_t cRefs = ASMAtomicIncU32(&m_cRefs);
+        Assert(cRefs > 1); Assert(cRefs < _1M);
+        return cRefs;
 
-    int CopyFrom(const GuestEnvironmentArray &environment);
+    }
+    /** Useful shortcut. */
+    uint32_t retainConst(void) const { return unconst(this)->retain(); }
 
-    int CopyTo(GuestEnvironmentArray &environment);
+    /**
+     * Releases a reference to this object, deleting the object when reaching zero.
+     * @returns New reference count.
+     */
+    uint32_t release(void)
+    {
+        uint32_t cRefs = ASMAtomicDecU32(&m_cRefs);
+        Assert(cRefs < _1M);
+        if (cRefs == 0)
+            delete this;
+        return cRefs;
+    }
 
-    static void FreeEnvironmentBlock(void *pvEnv);
+    /** Useful shortcut. */
+    uint32_t releaseConst(void) const { return unconst(this)->retain(); }
 
-    Utf8Str Get(const Utf8Str &strKey);
+    /**
+     * Checks if the environment has been successfully initialized or not.
+     *
+     * @returns @c true if initialized, @c false if not.
+     */
+    bool isInitialized(void) const
+    {
+        return m_hEnv != NIL_RTENV;
+    }
 
-    Utf8Str Get(size_t nPos);
+    /**
+     * Returns the variable count.
+     * @return Number of variables.
+     * @sa      RTEnvCountEx
+     */
+    uint32_t count(void) const
+    {
+        return RTEnvCountEx(m_hEnv);
+    }
+
+    /**
+     * Deletes the environment change record entirely.
+     *
+     * The count() method will return zero after this call.
+     *
+     * @sa      RTEnvReset
+     */
+    void reset(void)
+    {
+        int rc = RTEnvReset(m_hEnv);
+        AssertRC(rc);
+    }
+
+    /**
+     * Exports the environment change block as an array of putenv style strings.
+     *
+     *
+     * @returns VINF_SUCCESS or VERR_NO_MEMORY.
+     * @param   pArray              The output array.
+     */
+    int queryPutEnvArray(std::vector<com::Utf8Str> *pArray) const
+    {
+        uint32_t cVars = RTEnvCountEx(m_hEnv);
+        try
+        {
+            pArray->resize(cVars);
+            for (uint32_t iVar = 0; iVar < cVars; iVar++)
+            {
+                const char *psz = RTEnvGetByIndexRawEx(m_hEnv, iVar);
+                AssertReturn(psz, VERR_INTERNAL_ERROR_3); /* someone is racing us! */
+                (*pArray)[iVar] = psz;
+            }
+            return VINF_SUCCESS;
+        }
+        catch (std::bad_alloc &)
+        {
+            return VERR_NO_MEMORY;
+        }
+    }
 
-    bool Has(const Utf8Str &strKey);
+    /**
+     * Applies an array of putenv style strings.
+     *
+     * @returns IPRT status code.
+     * @param   rArray              The array with the putenv style strings.
+     * @sa      RTEnvPutEnvEx
+     */
+    int applyPutEnvArray(const std::vector<com::Utf8Str> &rArray)
+    {
+        size_t cArray = rArray.size();
+        for (size_t i = 0; i < cArray; i++)
+        {
+            int rc = RTEnvPutEx(m_hEnv, rArray[i].c_str());
+            if (RT_FAILURE(rc))
+                return rc;
+        }
+        return VINF_SUCCESS;
+    }
 
-    int Set(const Utf8Str &strKey, const Utf8Str &strValue);
+    /**
+     * Applies the changes from another environment to this.
+     *
+     * @returns IPRT status code.
+     * @param   rChanges        Reference to an environment which variables will be
+     *                          imported and, if it's a change record, schedule
+     *                          variable unsets will be applied.
+     * @sa      RTEnvApplyChanges
+     */
+    int applyChanges(const GuestEnvironmentBase &rChanges)
+    {
+        return RTEnvApplyChanges(m_hEnv, rChanges.m_hEnv);
+    }
 
-    int Set(const Utf8Str &strPair);
 
-    size_t Size(void);
+    /**
+     * See RTEnvQueryUtf8Block for details.
+     * @returns IPRT status code.
+     * @param   ppszzBlock      Where to return the block pointer.
+     * @param   pcbBlock        Where to optionally return the block size.
+     * @sa      RTEnvQueryUtf8Block
+     */
+    int queryUtf8Block(char **ppszzBlock, size_t *pcbBlock)
+    {
+        return RTEnvQueryUtf8Block(m_hEnv, true /*fSorted*/, ppszzBlock, pcbBlock);
+    }
 
-    int Unset(const Utf8Str &strKey);
+    /**
+     * Frees what queryUtf8Block returned, NULL ignored.
+     * @sa      RTEnvFreeUtf8Block
+     */
+    static void freeUtf8Block(char *pszzBlock)
+    {
+        return RTEnvFreeUtf8Block(pszzBlock);
+    }
 
-public:
+    /**
+     * Applies a block on the format returned by queryUtf8Block.
+     *
+     * @returns IPRT status code.
+     * @param   pszzBlock           Pointer to the block.
+     * @param   cbBlock             The size of the block.
+     * @param   fNoEqualMeansUnset  Whether the lack of a '=' (equal) sign in a
+     *                              string means it should be unset (@c true), or if
+     *                              it means the variable should be defined with an
+     *                              empty value (@c false, the default).
+     * @todo move this to RTEnv!
+     */
+    int copyUtf8Block(const char *pszzBlock, size_t cbBlock, bool fNoEqualMeansUnset = false)
+    {
+        int rc = VINF_SUCCESS;
+        while (cbBlock > 0 && *pszzBlock != '\0')
+        {
+            const char *pszEnd = (const char *)memchr(pszzBlock, '\0', cbBlock);
+            if (!pszEnd)
+                return VERR_BUFFER_UNDERFLOW;
+            int rc2;
+            if (fNoEqualMeansUnset || strchr(pszzBlock, '='))
+                rc2 = RTEnvPutEx(m_hEnv, pszzBlock);
+            else
+                rc2 = RTEnvSetEx(m_hEnv, pszzBlock, "");
+            if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
+                rc = rc2;
+
+            /* Advance. */
+            cbBlock -= pszEnd - pszzBlock;
+            if (cbBlock < 2)
+                return VERR_BUFFER_UNDERFLOW;
+            cbBlock--;
+            pszzBlock = pszEnd + 1;
+        }
 
-    GuestEnvironment& operator=(const GuestEnvironmentArray &that);
+        /* The remainder must be zero padded. */
+        if (RT_SUCCESS(rc))
+        {
+            if (ASMMemIsAll8(pszzBlock, cbBlock, 0))
+                return VINF_SUCCESS;
+            return VERR_TOO_MUCH_DATA;
+        }
+        return rc;
+    }
 
-    GuestEnvironment& operator=(const GuestEnvironment &that);
 
-protected:
+    /**
+     * Get an environment variable.
+     *
+     * @returns IPRT status code.
+     * @param   rName               The variable name.
+     * @param   pValue              Where to return the value.
+     * @sa      RTEnvGetEx
+     */
+    int getVariable(const com::Utf8Str &rName, com::Utf8Str *pValue) const
+    {
+        size_t cchNeeded;
+        int rc = RTEnvGetEx(m_hEnv, rName.c_str(), NULL, 0, &cchNeeded);
+        if (   RT_SUCCESS(rc)
+            || rc == VERR_BUFFER_OVERFLOW)
+        {
+            try
+            {
+                pValue->reserve(cchNeeded + 1);
+                rc = RTEnvGetEx(m_hEnv, rName.c_str(), pValue->mutableRaw(), pValue->capacity(), NULL);
+                pValue->jolt();
+            }
+            catch (std::bad_alloc &)
+            {
+                rc = VERR_NO_STR_MEMORY;
+            }
+        }
+        return rc;
+    }
 
-    int appendToEnvBlock(const char *pszEnv, void **ppvList, size_t *pcbList, uint32_t *pcEnvVars);
+    /**
+     * Checks if the given variable exists.
+     *
+     * @returns @c true if it exists, @c false if not or if it's an scheduled unset
+     *          in a environment change record.
+     * @param   rName               The variable name.
+     * @sa      RTEnvExistEx
+     */
+    bool doesVariableExist(const com::Utf8Str &rName) const
+    {
+        return RTEnvExistEx(m_hEnv, rName.c_str());
+    }
+
+    /**
+     * Set an environment variable.
+     *
+     * @returns IPRT status code.
+     * @param   rName               The variable name.
+     * @param   rValue              The value of the variable.
+     * @sa      RTEnvSetEx
+     */
+    int setVariable(const com::Utf8Str &rName, const com::Utf8Str &rValue)
+    {
+        return RTEnvSetEx(m_hEnv, rName.c_str(), rValue.c_str());
+    }
+
+    /**
+     * Unset an environment variable.
+     *
+     * @returns IPRT status code.
+     * @param   rName               The variable name.
+     * @sa      RTEnvUnsetEx
+     */
+    int unsetVariable(const com::Utf8Str &rName)
+    {
+        return RTEnvUnsetEx(m_hEnv, rName.c_str());
+    }
 
 protected:
+    /**
+     * Copy constructor.
+     * @throws HRESULT
+     */
+    GuestEnvironmentBase(const GuestEnvironmentBase &rThat, bool fChangeRecord)
+        : m_hEnv(NIL_RTENV)
+        , m_cRefs(1)
+    {
+        int rc = cloneCommon(rThat, fChangeRecord);
+        if (RT_FAILURE(rc))
+            throw (Global::vboxStatusCodeToCOM(rc));
+    }
+
+    /**
+     * Common clone/copy method with type conversion abilities.
+     *
+     * @returns IPRT status code.
+     * @param   rThat           The object to clone.
+     * @param   fChangeRecord   Whether the this instance is a change record (true)
+     *                          or normal (false) environment.
+     */
+    int cloneCommon(const GuestEnvironmentBase &rThat, bool fChangeRecord)
+    {
+        int   rc = VINF_SUCCESS;
+        RTENV hNewEnv = NIL_RTENV;
+        if (rThat.m_hEnv != NIL_RTENV)
+        {
+            if (RTEnvIsChangeRecord(rThat.m_hEnv) == fChangeRecord)
+                rc = RTEnvClone(&hNewEnv, rThat.m_hEnv);
+            else
+            {
+                /* Need to type convert it. */
+                if (fChangeRecord)
+                    rc = RTEnvCreateChangeRecord(&hNewEnv);
+                else
+                    rc = RTEnvCreate(&hNewEnv);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = RTEnvApplyChanges(hNewEnv, rThat.m_hEnv);
+                    if (RT_FAILURE(rc))
+                        RTEnvDestroy(hNewEnv);
+                }
+            }
+
+        }
+        if (RT_SUCCESS(rc))
+        {
+            RTEnvDestroy(m_hEnv);
+            m_hEnv = hNewEnv;
+        }
+        return rc;
+    }
+
 
-    std::map <Utf8Str, Utf8Str> mEnvironment;
+    /** The environment change record. */
+    RTENV               m_hEnv;
+    /** Reference counter. */
+    uint32_t volatile   m_cRefs;
+};
+
+class GuestEnvironmentChanges;
+
+
+/**
+ * Wrapper around the RTEnv API for a normal environment.
+ */
+class GuestEnvironment : public GuestEnvironmentBase
+{
+public:
+    /**
+     * Default constructor.
+     *
+     * The user must invoke one of the init methods before using the object.
+     */
+    GuestEnvironment(void)
+        : GuestEnvironmentBase()
+    { }
+
+    /**
+     * Copy operator.
+     * @param   rThat       The object to copy.
+     * @throws HRESULT
+     */
+    GuestEnvironment(const GuestEnvironment &rThat)
+        : GuestEnvironmentBase(rThat, false /*fChangeRecord*/)
+    { }
+
+    /**
+     * Copy operator.
+     * @param   rThat       The object to copy.
+     * @throws HRESULT
+     */
+    GuestEnvironment(const GuestEnvironmentBase &rThat)
+        : GuestEnvironmentBase(rThat, false /*fChangeRecord*/)
+    { }
+
+    /**
+     * Initialize this as a normal environment block.
+     * @returns IPRT status code.
+     */
+    int initNormal(void)
+    {
+        AssertReturn(m_hEnv == NIL_RTENV, VERR_WRONG_ORDER);
+        return RTEnvCreate(&m_hEnv);
+    }
+
+    /**
+     * Replaces this environemnt with that in @a rThat.
+     *
+     * @returns IPRT status code
+     * @param   rThat       The environment to copy. If it's a different type
+     *                      we'll convert the data to a normal environment block.
+     */
+    int copy(const GuestEnvironmentBase &rThat)
+    {
+        return cloneCommon(rThat, false /*fChangeRecord*/);
+    }
+
+    /**
+     * @copydoc copy()
+     */
+    GuestEnvironment &operator=(const GuestEnvironmentBase &rThat)
+    {
+        int rc = cloneCommon(rThat, true /*fChangeRecord*/);
+        if (RT_FAILURE(rc))
+            throw (Global::vboxStatusCodeToCOM(rc));
+        return *this;
+    }
+
+    /** @copydoc copy() */
+    GuestEnvironment &operator=(const GuestEnvironment &rThat)
+    {   return operator=((const GuestEnvironmentBase &)rThat); }
+
+    /** @copydoc copy() */
+    GuestEnvironment &operator=(const GuestEnvironmentChanges &rThat)
+    {   return operator=((const GuestEnvironmentBase &)rThat); }
+
+};
+
+
+/**
+ * Wrapper around the RTEnv API for a environment change record.
+ *
+ * This class is used as a record of changes to be applied to a different
+ * environment block (in VBoxService before launching a new process).
+ */
+class GuestEnvironmentChanges : public GuestEnvironmentBase
+{
+public:
+    /**
+     * Default constructor.
+     *
+     * The user must invoke one of the init methods before using the object.
+     */
+    GuestEnvironmentChanges(void)
+        : GuestEnvironmentBase()
+    { }
+
+    /**
+     * Copy operator.
+     * @param   rThat       The object to copy.
+     * @throws HRESULT
+     */
+    GuestEnvironmentChanges(const GuestEnvironmentChanges &rThat)
+        : GuestEnvironmentBase(rThat, true /*fChangeRecord*/)
+    { }
+
+    /**
+     * Copy operator.
+     * @param   rThat       The object to copy.
+     * @throws HRESULT
+     */
+    GuestEnvironmentChanges(const GuestEnvironmentBase &rThat)
+        : GuestEnvironmentBase(rThat, true /*fChangeRecord*/)
+    { }
+
+    /**
+     * Initialize this as a environment change record.
+     * @returns IPRT status code.
+     */
+    int initChangeRecord(void)
+    {
+        AssertReturn(m_hEnv == NIL_RTENV, VERR_WRONG_ORDER);
+        return RTEnvCreateChangeRecord(&m_hEnv);
+    }
+
+    /**
+     * Replaces this environemnt with that in @a rThat.
+     *
+     * @returns IPRT status code
+     * @param   rThat       The environment to copy. If it's a different type
+     *                      we'll convert the data to a set of changes.
+     */
+    int copy(const GuestEnvironmentBase &rThat)
+    {
+        return cloneCommon(rThat, true /*fChangeRecord*/);
+    }
+
+    /**
+     * @copydoc copy()
+     */
+    GuestEnvironmentChanges &operator=(const GuestEnvironmentBase &rThat)
+    {
+        int rc = cloneCommon(rThat, true /*fChangeRecord*/);
+        if (RT_FAILURE(rc))
+            throw (Global::vboxStatusCodeToCOM(rc));
+        return *this;
+    }
+
+    /** @copydoc copy() */
+    GuestEnvironmentChanges &operator=(const GuestEnvironmentChanges &rThat)
+    {   return operator=((const GuestEnvironmentBase &)rThat); }
+
+    /** @copydoc copy() */
+    GuestEnvironmentChanges &operator=(const GuestEnvironment &rThat)
+    {   return operator=((const GuestEnvironmentBase &)rThat); }
 };
 
 
@@ -126,17 +597,20 @@ struct GuestFileOpenInfo
 {
     /** The filename. */
     Utf8Str                 mFileName;
-    /** Then file's opening mode. */
-    Utf8Str                 mOpenMode;
-    /** The file's disposition mode. */
-    Utf8Str                 mDisposition;
-    /** The file's sharing mode.
-     **@todo Not implemented yet.*/
-    Utf8Str                 mSharingMode;
+    /** The file access mode. */
+    FileAccessMode_T        mAccessMode;
+    /** String translation of mFileAccessMode for the GAs. */
+    const char             *mpszAccessMode;
+    /** The file open action.  */
+    FileOpenAction_T        mOpenAction;
+    /** String translation of mOpenAction for the GAs. */
+    const char             *mpszOpenAction;
+    /** The file sharing mode. */
+    FileSharingMode_T       mSharingMode;
     /** Octal creation mode. */
     uint32_t                mCreationMode;
-    /** The initial offset on open. */
-    uint64_t                mInitialOffset;
+    /** Extended open flags (currently none defined). */
+    uint32_t                mfOpenEx;
 };
 
 
@@ -219,10 +693,12 @@ public:
 
     /** The process' friendly name. */
     Utf8Str                     mName;
-    /** The actual command to execute. */
-    Utf8Str                     mCommand;
+    /** The executable. */
+    Utf8Str                     mExecutable;
+    /** Arguments vector (starting with argument \#0). */
     ProcessArguments            mArguments;
-    GuestEnvironment            mEnvironment;
+    /** The process environment change record.  */
+    GuestEnvironmentChanges     mEnvironmentChanges;
     /** Process creation flags. */
     uint32_t                    mFlags;
     ULONG                       mTimeoutMS;
@@ -641,10 +1117,10 @@ public:
 
 protected:
 
-    virtual int onRemove(void) = 0;
+    virtual int i_onRemove(void) = 0;
 
     /** Callback dispatcher -- must be implemented by the actual object. */
-    virtual int callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb) = 0;
+    virtual int i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb) = 0;
 
 protected:
 
@@ -654,14 +1130,25 @@ protected:
 
 protected:
 
-    /**
-     * Commom parameters for all derived objects, when then have
-     * an own mData structure to keep their specific data around.
-     */
-
+    /** @name Common parameters for all derived objects.  They have their own
+     * mData structure to keep their specific data around.
+     * @{ */
     /** Pointer to parent session. Per definition
      *  this objects *always* lives shorter than the
-     *  parent. */
+     *  parent.
+     * @todo r=bird: When wanting to use mSession in the
+     * IGuestProcess::getEnvironment() implementation I wanted to access
+     * GuestSession::mData::mpBaseEnvironment.  Seeing the comment in
+     * GuestProcess::terminate() saying:
+     *      "Now only API clients still can hold references to it."
+     * and recalling seeing similar things in VirtualBox.xidl or some such place,
+     * I'm wondering how this "per definition" behavior is enforced.  Is there any
+     * GuestProcess:uninit() call or similar magic that invalidates objects that
+     * GuestSession loses track of in place like GuestProcess::terminate() that I've
+     * failed to spot?
+     *
+     * Please enlighten me.
+     */
     GuestSession            *mSession;
     /** The object ID -- must be unique for each guest
      *  object and is encoded into the context ID. Must
@@ -670,6 +1157,7 @@ protected:
      *  For guest processes this is the internal PID,
      *  for guest files this is the internal file ID. */
     uint32_t                 mObjectID;
+    /** @} */
 };
-#endif // ____H_GUESTIMPLPRIVATE
+#endif // !____H_GUESTIMPLPRIVATE
 
diff --git a/src/VBox/Main/include/GuestDirectoryImpl.h b/src/VBox/Main/include/GuestDirectoryImpl.h
index 7c454ea..bc8a579 100644
--- a/src/VBox/Main/include/GuestDirectoryImpl.h
+++ b/src/VBox/Main/include/GuestDirectoryImpl.h
@@ -1,11 +1,10 @@
-
 /* $Id: GuestDirectoryImpl.h $ */
 /** @file
- * VirtualBox Main - XXX.
+ * VirtualBox Main - Guest directory handling implementation.
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,8 +18,8 @@
 #ifndef ____H_GUESTDIRECTORYIMPL
 #define ____H_GUESTDIRECTORYIMPL
 
-#include "VirtualBoxBase.h"
 #include "GuestProcessImpl.h"
+#include "GuestDirectoryWrap.h"
 
 class GuestSession;
 
@@ -28,50 +27,44 @@ class GuestSession;
  * TODO
  */
 class ATL_NO_VTABLE GuestDirectory :
-    public VirtualBoxBase,
-    public GuestObject,
-    VBOX_SCRIPTABLE_IMPL(IGuestDirectory)
+    public GuestDirectoryWrap,
+    public GuestObject
 {
 public:
     /** @name COM and internal init/term/mapping cruft.
      * @{ */
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestDirectory, IGuestDirectory)
-    DECLARE_NOT_AGGREGATABLE(GuestDirectory)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-    BEGIN_COM_MAP(GuestDirectory)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestDirectory)
-        COM_INTERFACE_ENTRY(IDirectory)
-    END_COM_MAP()
     DECLARE_EMPTY_CTOR_DTOR(GuestDirectory)
 
     int     init(Console *pConsole, GuestSession *pSession, ULONG uDirID, const GuestDirectoryOpenInfo &openInfo);
     void    uninit(void);
+
     HRESULT FinalConstruct(void);
     void    FinalRelease(void);
     /** @}  */
 
-    /** @name IDirectory interface.
-     * @{ */
-    STDMETHOD(COMGETTER(DirectoryName))(BSTR *aName);
-    STDMETHOD(COMGETTER(Filter))(BSTR *aFilter);
-    STDMETHOD(Close)(void);
-    STDMETHOD(Read)(IFsObjInfo **aInfo);
-    /** @}  */
-
 public:
     /** @name Public internal methods.
      * @{ */
-    int            callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    static Utf8Str guestErrorToString(int guestRc);
-    int            onRemove(void);
-    static HRESULT setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
+    int            i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    int            i_onRemove(void);
+
+    static Utf8Str i_guestErrorToString(int guestRc);
+    static HRESULT i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
     /** @}  */
 
 private:
 
-    /** @name Private internal methods.
+    /** @name Private Wrapped properties
+     * @{ */
+    /** @}  */
+    HRESULT getDirectoryName(com::Utf8Str &aDirectoryName);
+    HRESULT getFilter(com::Utf8Str &aFilter);
+
+    /** @name Wrapped Private internal methods.
      * @{ */
     /** @}  */
+    HRESULT close();
+    HRESULT read(ComPtr<IFsObjInfo> &aObjInfo);
 
     struct Data
     {
diff --git a/src/VBox/Main/include/GuestDnDImpl.h b/src/VBox/Main/include/GuestDnDImpl.h
deleted file mode 100644
index e65657c..0000000
--- a/src/VBox/Main/include/GuestDnDImpl.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/** @file
- * Definition of GuestDnD
- */
-
-/*
- * Copyright (C) 2011-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#ifndef ____H_GUESTDND
-#define ____H_GUESTDND
-
-/* Forward declaration of the d-pointer. */
-class GuestDnDPrivate;
-
-class GuestDnD
-{
-public:
-    GuestDnD(const ComObjPtr<Guest>& pGuest);
-    ~GuestDnD();
-
-    /* Host -> Guest */
-    HRESULT dragHGEnter(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), DragAndDropAction_T *pResultAction);
-    HRESULT dragHGMove(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), DragAndDropAction_T *pResultAction);
-    HRESULT dragHGLeave(ULONG uScreenId);
-    HRESULT dragHGDrop(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), BSTR *pstrFormat, DragAndDropAction_T *pResultAction);
-    HRESULT dragHGPutData(ULONG uScreenId, IN_BSTR wstrFormat, ComSafeArrayIn(BYTE, data), IProgress **ppProgress);
-
-    /* Guest -> Host */
-    HRESULT dragGHPending(ULONG uScreenId, ComSafeArrayOut(BSTR, formats), ComSafeArrayOut(DragAndDropAction_T, allowedActions), DragAndDropAction_T *pDefaultAction);
-    HRESULT dragGHDropped(IN_BSTR bstrFormat, DragAndDropAction_T action, IProgress **ppProgress);
-    HRESULT dragGHGetData(ComSafeArrayOut(BYTE, data));
-
-    /* Guest response */
-    static DECLCALLBACK(int) notifyGuestDragAndDropEvent(void *pvExtension, uint32_t u32Function, void *pvParms, uint32_t cbParms);
-
-private:
-
-    /* d-pointer */
-    GuestDnDPrivate *d_ptr;
-
-    friend class GuestDnDPrivate;
-};
-
-#endif /* ____H_GUESTDND */
-
diff --git a/src/VBox/Main/include/GuestDnDPrivate.h b/src/VBox/Main/include/GuestDnDPrivate.h
new file mode 100644
index 0000000..a08647a
--- /dev/null
+++ b/src/VBox/Main/include/GuestDnDPrivate.h
@@ -0,0 +1,549 @@
+/* $Id: GuestDnDPrivate.h $ */
+/** @file
+ * Private guest drag and drop code, used by GuestDnDTarget +
+ * GuestDnDSource.
+ */
+
+/*
+ * Copyright (C) 2011-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_GUESTDNDPRIVATE
+#define ____H_GUESTDNDPRIVATE
+
+#include <iprt/dir.h>
+#include <iprt/file.h>
+
+#include "VBox/hgcmsvc.h" /* For PVBOXHGCMSVCPARM. */
+#include "VBox/GuestHost/DragAndDrop.h"
+
+/**
+ * Forward prototype declarations.
+ */
+class Guest;
+class GuestDnDBase;
+class GuestDnDResponse;
+class GuestDnDSource;
+class GuestDnDTarget;
+class Progress;
+
+class GuestDnDCallbackEvent
+{
+public:
+
+    GuestDnDCallbackEvent(void)
+        : mSemEvent(NIL_RTSEMEVENT)
+        , mRc(VINF_SUCCESS) { }
+
+    virtual ~GuestDnDCallbackEvent(void);
+
+public:
+
+    int Reset(void);
+
+    int Notify(int rc);
+
+    int Result(void) const { return mRc; }
+
+    int Wait(RTMSINTERVAL msTimeout);
+
+protected:
+
+    /** Event semaphore to notify on error/completion. */
+    RTSEMEVENT mSemEvent;
+    /** Callback result. */
+    int        mRc;
+};
+
+/**
+ * Structure for keeping the (URI) data to be sent/received.
+ */
+typedef struct GuestDnDData
+{
+    GuestDnDData(void)
+        : cbToProcess(0)
+        , cbProcessed(0) { }
+
+    void Reset(void)
+    {
+        vecData.clear();
+        cbToProcess = 0;
+        cbProcessed = 0;
+    }
+
+    /** Array (vector) of guest DnD data. This might be an URI list, according
+     *  to the format being set. */
+    std::vector<BYTE>         vecData;
+    /** Overall size (in bytes) of data to send. */
+    uint64_t                  cbToProcess;
+    /** Overall size (in bytes) of processed file data. */
+    uint64_t                  cbProcessed;
+
+} GuestDnDData;
+
+/**
+ * Structure for keeping around URI (list) data.
+ */
+typedef struct GuestDnDURIData
+{
+    GuestDnDURIData(void)
+        : pvScratchBuf(NULL)
+        , cbScratchBuf(0) { }
+
+    virtual ~GuestDnDURIData(void)
+    {
+        Reset();
+    }
+
+    void Reset(void)
+    {
+        lstURI.Clear();
+#if 0 /* Currently the scratch buffer will be maintained elswewhere. */
+        if (pvScratchBuf)
+        {
+            RTMemFree(pvScratchBuf);
+            pvScratchBuf = NULL;
+        }
+        cbScratchBuf = 0;
+#else
+        pvScratchBuf = NULL;
+        cbScratchBuf = 0;
+#endif
+    }
+
+    DNDDIRDROPPEDFILES              mDropDir;
+    /** (Non-recursive) List of root URI objects to receive. */
+    DnDURIList                      lstURI;
+    /** Current object to receive. */
+    DnDURIObject                    objURI;
+    /** Pointer to an optional scratch buffer to use for
+     *  doing the actual chunk transfers. */
+    void                           *pvScratchBuf;
+    /** Size (in bytes) of scratch buffer. */
+    size_t                          cbScratchBuf;
+
+} GuestDnDURIData;
+
+/**
+ * Context structure for sending data to the guest.
+ */
+typedef struct SENDDATACTX
+{
+    /** Pointer to guest target class this context belongs to. */
+    GuestDnDTarget                     *mpTarget;
+    /** Pointer to guest response class this context belongs to. */
+    GuestDnDResponse                   *mpResp;
+    /** Flag indicating whether a file transfer is active and
+     *  initiated by the host. */
+    bool                                mIsActive;
+    /** Target (VM) screen ID. */
+    uint32_t                            mScreenID;
+    /** Drag'n drop format to send. */
+    com::Utf8Str                        mFormat;
+    /** Drag'n drop data to send.
+     *  This can be arbitrary data or an URI list. */
+    GuestDnDData                        mData;
+    /** URI data structure. */
+    GuestDnDURIData                     mURI;
+    /** Callback event to use. */
+    GuestDnDCallbackEvent               mCallback;
+
+} SENDDATACTX, *PSENDDATACTX;
+
+/**
+ * Context structure for receiving data from the guest.
+ */
+typedef struct RECVDATACTX
+{
+    /** Pointer to guest source class this context belongs to. */
+    GuestDnDSource                     *mpSource;
+    /** Pointer to guest response class this context belongs to. */
+    GuestDnDResponse                   *mpResp;
+    /** Flag indicating whether a file transfer is active and
+     *  initiated by the host. */
+    bool                                mIsActive;
+    /** Drag'n drop format to send. */
+    com::Utf8Str                        mFormat;
+    /** Desired drop action to perform on the host.
+     *  Needed to tell the guest if data has to be
+     *  deleted e.g. when moving instead of copying. */
+    uint32_t                            mAction;
+    /** Drag'n drop received from the guest.
+     *  This can be arbitrary data or an URI list. */
+    GuestDnDData                        mData;
+    /** URI data structure. */
+    GuestDnDURIData                     mURI;
+    /** Callback event to use. */
+    GuestDnDCallbackEvent               mCallback;
+
+} RECVDATACTX, *PRECVDATACTX;
+
+/**
+ * Simple structure for a buffered guest DnD message.
+ */
+class GuestDnDMsg
+{
+public:
+
+    GuestDnDMsg(void)
+        : uMsg(0)
+        , cParms(0)
+        , cParmsAlloc(0)
+        , paParms(NULL) { }
+
+    virtual ~GuestDnDMsg(void)
+    {
+        if (paParms)
+        {
+            /* Remove deep copies. */
+            for (uint32_t i = 0; i < cParms; i++)
+            {
+                if (   paParms[i].type == VBOX_HGCM_SVC_PARM_PTR
+                    && paParms[i].u.pointer.addr)
+                {
+                    RTMemFree(paParms[i].u.pointer.addr);
+                }
+            }
+
+            delete paParms;
+        }
+    }
+
+public:
+
+    PVBOXHGCMSVCPARM getNextParam(void)
+    {
+        if (cParms >= cParmsAlloc)
+        {
+            paParms = (PVBOXHGCMSVCPARM)RTMemRealloc(paParms, (cParmsAlloc + 4) * sizeof(VBOXHGCMSVCPARM));
+            if (!paParms)
+                throw VERR_NO_MEMORY;
+            RT_BZERO(&paParms[cParmsAlloc], 4 * sizeof(VBOXHGCMSVCPARM));
+            cParmsAlloc += 4;
+        }
+
+        return &paParms[cParms++];
+    }
+
+    uint32_t getCount(void) const { return cParms; }
+    PVBOXHGCMSVCPARM getParms(void) const { return paParms; }
+    uint32_t getType(void) const { return uMsg; }
+
+    int setNextPointer(void *pvBuf, uint32_t cbBuf)
+    {
+        AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
+        AssertReturn(cbBuf, VERR_INVALID_PARAMETER);
+
+        PVBOXHGCMSVCPARM pParm = getNextParam();
+        if (!pParm)
+            return VERR_NO_MEMORY;
+
+        void *pvTmp = RTMemDup(pvBuf, cbBuf);
+        if (!pvTmp)
+        {
+            RTMemFree(pParm);
+            return VERR_NO_MEMORY;
+        }
+
+        pParm->setPointer(pvTmp, cbBuf);
+        return VINF_SUCCESS;
+    }
+
+    int setNextString(const char *pszString)
+    {
+        PVBOXHGCMSVCPARM pParm = getNextParam();
+        if (!pParm)
+            return VERR_NO_MEMORY;
+
+        char *pszTemp = RTStrDup(pszString);
+        if (!pszTemp)
+        {
+            RTMemFree(pParm);
+            return VERR_NO_MEMORY;
+        }
+
+        pParm->setString(pszTemp);
+        return VINF_SUCCESS;
+    }
+
+    int setNextUInt32(uint32_t u32Val)
+    {
+        PVBOXHGCMSVCPARM pParm = getNextParam();
+        if (!pParm)
+            return VERR_NO_MEMORY;
+
+        pParm->setUInt32(u32Val);
+        return VINF_SUCCESS;
+    }
+
+    int setNextUInt64(uint64_t u64Val)
+    {
+        PVBOXHGCMSVCPARM pParm = getNextParam();
+        if (!pParm)
+            return VERR_NO_MEMORY;
+
+        pParm->setUInt64(u64Val);
+        return VINF_SUCCESS;
+    }
+
+    void setType(uint32_t uMsgType) { uMsg = uMsgType; }
+
+protected:
+
+    /** Message type. */
+    uint32_t                    uMsg;
+    /** Message parameters. */
+    uint32_t                    cParms;
+    /** Size of array. */
+    uint32_t                    cParmsAlloc;
+    /** Array of HGCM parameters */
+    PVBOXHGCMSVCPARM            paParms;
+};
+
+/** Guest DnD callback function definition. */
+typedef DECLCALLBACKPTR(int, PFNGUESTDNDCALLBACK) (uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
+
+/**
+ * Structure for keeping a guest DnD callback.
+ * Each callback can handle one HGCM message, however, multiple HGCM messages can be registered
+ * to the same callback (function).
+ */
+typedef struct GuestDnDCallback
+{
+    GuestDnDCallback(void)
+        : uMessgage(0)
+        , pfnCallback(NULL)
+        , pvUser(NULL) { }
+
+    GuestDnDCallback(PFNGUESTDNDCALLBACK pvCB, uint32_t uMsg, void *pvUsr = NULL)
+        : uMessgage(uMsg)
+        , pfnCallback(pvCB)
+        , pvUser(pvUsr) { }
+
+    /** The HGCM message ID to handle. */
+    uint32_t             uMessgage;
+    /** Pointer to callback function. */
+    PFNGUESTDNDCALLBACK  pfnCallback;
+    /** Pointer to user-supplied data. */
+    void                *pvUser;
+
+} GuestDnDCallback;
+
+/** Contains registered callback pointers for specific HGCM message types. */
+typedef std::map<uint32_t, GuestDnDCallback> GuestDnDCallbackMap;
+
+class GuestDnDResponse
+{
+
+public:
+
+    GuestDnDResponse(const ComObjPtr<Guest>& pGuest);
+    virtual ~GuestDnDResponse(void);
+
+public:
+
+    int notifyAboutGuestResponse(void) const;
+    int waitForGuestResponse(RTMSINTERVAL msTimeout = 500) const;
+
+    void setAllActions(uint32_t a) { m_allActions = a; }
+    uint32_t allActions(void) const { return m_allActions; }
+
+    void setDefAction(uint32_t a) { m_defAction = a; }
+    uint32_t defAction(void) const { return m_defAction; }
+
+    void setFormat(const Utf8Str &strFormat) { m_strFormat = strFormat; }
+    Utf8Str format(void) const { return m_strFormat; }
+
+    void reset(void);
+
+    bool isProgressCanceled(void) const;
+    int setCallback(uint32_t uMsg, PFNGUESTDNDCALLBACK pfnCallback, void *pvUser = NULL);
+    int setProgress(unsigned uPercentage, uint32_t uState, int rcOp = VINF_SUCCESS);
+    HRESULT resetProgress(const ComObjPtr<Guest>& pParent);
+    HRESULT queryProgressTo(IProgress **ppProgress);
+
+public:
+
+    /** @name HGCM callback handling.
+       @{ */
+    int onDispatch(uint32_t u32Function, void *pvParms, uint32_t cbParms);
+    /** @}  */
+
+public:
+
+    Utf8Str errorToString(const ComObjPtr<Guest>& pGuest, int guestRc);
+
+protected:
+
+    /** Pointer to context this class is tied to. */
+    void                 *m_pvCtx;
+    RTSEMEVENT            m_EventSem;
+    uint32_t              m_defAction;
+    uint32_t              m_allActions;
+    Utf8Str               m_strFormat;
+
+    /** Pointer to IGuest parent object. */
+    ComObjPtr<Guest>      m_parent;
+    /** Pointer to associated progress object. Optional. */
+    ComObjPtr<Progress>   m_progress;
+    /** Callback map. */
+    GuestDnDCallbackMap   m_mapCallbacks;
+};
+
+/**
+ * Private singleton class for the guest's DnD
+ * implementation. Can't be instanciated directly, only via
+ * the factory pattern.
+ */
+class GuestDnD
+{
+public:
+
+    static GuestDnD *createInstance(const ComObjPtr<Guest>& pGuest)
+    {
+        Assert(NULL == GuestDnD::s_pInstance);
+        GuestDnD::s_pInstance = new GuestDnD(pGuest);
+        return GuestDnD::s_pInstance;
+    }
+
+    static void destroyInstance(void)
+    {
+        if (GuestDnD::s_pInstance)
+        {
+            delete GuestDnD::s_pInstance;
+            GuestDnD::s_pInstance = NULL;
+        }
+    }
+
+    static inline GuestDnD *getInstance(void)
+    {
+        AssertPtr(GuestDnD::s_pInstance);
+        return GuestDnD::s_pInstance;
+    }
+
+protected:
+
+    GuestDnD(const ComObjPtr<Guest>& pGuest);
+    virtual ~GuestDnD(void);
+
+public:
+
+    /** @name Public helper functions.
+     * @{ */
+    int                        adjustScreenCoordinates(ULONG uScreenId, ULONG *puX, ULONG *puY) const;
+    int                        hostCall(uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms) const;
+    GuestDnDResponse          *response(void) { return m_pResponse; }
+    std::vector<com::Utf8Str>  defaultFormats(void) const { return m_strDefaultFormats; }
+    /** @}  */
+
+public:
+
+    /** @name Static low-level HGCM callback handler.
+     * @{ */
+    static DECLCALLBACK(int)   notifyDnDDispatcher(void *pvExtension, uint32_t u32Function, void *pvParms, uint32_t cbParms);
+    /** @}  */
+
+    /** @name Static helper methods.
+     * @{ */
+    static com::Utf8Str        toFormatString(const std::vector<com::Utf8Str> &lstSupportedFormats, const std::vector<com::Utf8Str> &lstFormats);
+    static void                toFormatVector(const std::vector<com::Utf8Str> &lstSupportedFormats, const com::Utf8Str &strFormats, std::vector<com::Utf8Str> &vecformats);
+    static DnDAction_T         toMainAction(uint32_t uAction);
+    static void                toMainActions(uint32_t uActions, std::vector<DnDAction_T> &vecActions);
+    static uint32_t            toHGCMAction(DnDAction_T enmAction);
+    static void                toHGCMActions(DnDAction_T enmDefAction, uint32_t *puDefAction, const std::vector<DnDAction_T> vecAllowedActions, uint32_t *puAllowedActions);
+    /** @}  */
+
+protected:
+
+    /** @name Singleton properties.
+     * @{ */
+    /** List of supported default MIME/Content-type formats. */
+    std::vector<com::Utf8Str>  m_strDefaultFormats;
+    /** Pointer to guest implementation. */
+    const ComObjPtr<Guest>     m_pGuest;
+    /** The current (last) response from the guest. At the
+     *  moment we only support only response a time (ARQ-style). */
+    GuestDnDResponse          *m_pResponse;
+    /** @}  */
+
+private:
+
+    /** Staic pointer to singleton instance. */
+    static GuestDnD           *s_pInstance;
+};
+
+/** Access to the GuestDnD's singleton instance. */
+#define GuestDnDInst() GuestDnD::getInstance()
+
+/** List of pointers to guest DnD Messages. */
+typedef std::list<GuestDnDMsg *> GuestDnDMsgList;
+
+/**
+ * IDnDBase class implementation for sharing code between
+ * IGuestDnDSource and IGuestDnDTarget implementation.
+ */
+class GuestDnDBase
+{
+protected:
+
+    GuestDnDBase(void);
+
+protected:
+
+    /** Shared (internal) IDnDBase method implementations.
+     * @{ */
+    HRESULT i_isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
+    HRESULT i_getFormats(std::vector<com::Utf8Str> &aFormats);
+    HRESULT i_addFormats(const std::vector<com::Utf8Str> &aFormats);
+    HRESULT i_removeFormats(const std::vector<com::Utf8Str> &aFormats);
+
+    HRESULT i_getProtocolVersion(ULONG *puVersion);
+    /** @}  */
+
+protected:
+
+    int getProtocolVersion(uint32_t *puVersion);
+
+    /** @name Functions for handling a simple host HGCM message queue.
+     * @{ */
+    int msgQueueAdd(GuestDnDMsg *pMsg);
+    GuestDnDMsg *msgQueueGetNext(void);
+    void msgQueueRemoveNext(void);
+    void msgQueueClear(void);
+    /** @}  */
+
+    int sendCancel(void);
+    int waitForEvent(RTMSINTERVAL msTimeout, GuestDnDCallbackEvent &Event, GuestDnDResponse *pResp);
+
+protected:
+
+    /** @name Public attributes (through getters/setters).
+     * @{ */
+    /** Pointer to guest implementation. */
+    const ComObjPtr<Guest>          m_pGuest;
+    /** List of supported MIME/Content-type formats. */
+    std::vector<com::Utf8Str>       m_strFormats;
+    /** @}  */
+
+    struct
+    {
+        /** Flag indicating whether a drop operation currently
+         *  is in progress or not. */
+        bool                        mfTransferIsPending;
+        /** The DnD protocol version to use, depending on the
+         *  installed Guest Additions. */
+        uint32_t                    mProtocolVersion;
+        /** Outgoing message queue. */
+        GuestDnDMsgList             mListOutgoing;
+    } mDataBase;
+};
+#endif /* ____H_GUESTDNDPRIVATE */
+
diff --git a/src/VBox/Main/include/GuestDnDSourceImpl.h b/src/VBox/Main/include/GuestDnDSourceImpl.h
new file mode 100644
index 0000000..c9b35bc
--- /dev/null
+++ b/src/VBox/Main/include/GuestDnDSourceImpl.h
@@ -0,0 +1,103 @@
+/* $Id: GuestDnDSourceImpl.h $ */
+/** @file
+ * VBox Console COM Class implementation - Guest drag'n drop source.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_GUESTDNDSOURCEIMPL
+#define ____H_GUESTDNDSOURCEIMPL
+
+#include "GuestDnDSourceWrap.h"
+#include "GuestDnDPrivate.h"
+
+struct RECVDATACTX;
+typedef struct RECVDATACTX *PRECVDATACTX;
+
+class ATL_NO_VTABLE GuestDnDSource :
+    public GuestDnDSourceWrap,
+    public GuestDnDBase
+{
+public:
+    /** @name COM and internal init/term/mapping cruft.
+     * @{ */
+    DECLARE_EMPTY_CTOR_DTOR(GuestDnDSource)
+
+    int     init(const ComObjPtr<Guest>& pGuest);
+    void    uninit(void);
+
+    HRESULT FinalConstruct(void);
+    void    FinalRelease(void);
+    /** @}  */
+
+private:
+
+    /** Private wrapped @name IDnDBase methods.
+     * @{ */
+    HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
+    HRESULT getFormats(std::vector<com::Utf8Str> &aFormats);
+    HRESULT addFormats(const std::vector<com::Utf8Str> &aFormats);
+    HRESULT removeFormats(const std::vector<com::Utf8Str> &aFormats);
+
+    HRESULT getProtocolVersion(ULONG *aProtocolVersion);
+    /** @}  */
+
+    /** Private wrapped @name IDnDSource methods.
+     * @{ */
+    HRESULT dragIsPending(ULONG uScreenId, std::vector<com::Utf8Str> &aFormats, std::vector<DnDAction_T> &aAllowedActions, DnDAction_T *aDefaultAction);
+    HRESULT drop(const com::Utf8Str &aFormat, DnDAction_T aAction, ComPtr<IProgress> &aProgress);
+    HRESULT receiveData(std::vector<BYTE> &aData);
+    /** @}  */
+
+protected:
+
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+    /** @name Dispatch handlers for the HGCM callbacks.
+     * @{ */
+    int i_onReceiveData(PRECVDATACTX pCtx, const void *pvData, uint32_t cbData, uint64_t cbTotalSize);
+    int i_onReceiveDir(PRECVDATACTX pCtx, const char *pszPath, uint32_t cbPath, uint32_t fMode);
+    int i_onReceiveFileHdr(PRECVDATACTX pCtx, const char *pszPath, uint32_t cbPath, uint64_t cbSize, uint32_t fMode, uint32_t fFlags);
+    int i_onReceiveFileData(PRECVDATACTX pCtx, const void *pvData, uint32_t cbData);
+    /** @}  */
+#endif
+
+protected:
+
+    static DECLCALLBACK(int) i_receiveDataThread(RTTHREAD Thread, void *pvUser);
+
+    /** @name Callbacks for dispatch handler.
+     * @{ */
+    static DECLCALLBACK(int) i_receiveRawDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
+    static DECLCALLBACK(int) i_receiveURIDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
+    /** @}  */
+
+protected:
+
+    int i_receiveData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout);
+    int i_receiveRawData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout);
+    int i_receiveURIData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout);
+    int i_updateProcess(PRECVDATACTX pCtx, uint32_t cbDataAdd);
+
+protected:
+
+    struct
+    {
+        /** Maximum data block size (in bytes) the source can handle. */
+        uint32_t    mcbBlockSize;
+        /** The context for receiving data from the guest. */
+        RECVDATACTX mRecvCtx;
+    } mData;
+};
+
+#endif /* !____H_GUESTDNDSOURCEIMPL */
+
diff --git a/src/VBox/Main/include/GuestDnDTargetImpl.h b/src/VBox/Main/include/GuestDnDTargetImpl.h
new file mode 100644
index 0000000..c5b2d9a
--- /dev/null
+++ b/src/VBox/Main/include/GuestDnDTargetImpl.h
@@ -0,0 +1,95 @@
+/* $Id: GuestDnDTargetImpl.h $ */
+/** @file
+ * VBox Console COM Class implementation - Guest drag'n drop target.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_GUESTDNDTARGETIMPL
+#define ____H_GUESTDNDTARGETIMPL
+
+#include "GuestDnDTargetWrap.h"
+#include "GuestDnDPrivate.h"
+
+#include <VBox/GuestHost/DragAndDrop.h>
+#include <VBox/HostServices/DragAndDropSvc.h>
+
+struct SENDDATACTX;
+typedef struct SENDDATACTX *PSENDDATACTX;
+
+class ATL_NO_VTABLE GuestDnDTarget :
+    public GuestDnDTargetWrap,
+    public GuestDnDBase
+{
+public:
+    /** @name COM and internal init/term/mapping cruft.
+     * @{ */
+    DECLARE_EMPTY_CTOR_DTOR(GuestDnDTarget)
+
+    int     init(const ComObjPtr<Guest>& pGuest);
+    void    uninit(void);
+
+    HRESULT FinalConstruct(void);
+    void    FinalRelease(void);
+    /** @}  */
+
+private:
+
+    /** Private wrapped @name IDnDBase methods.
+     * @{ */
+    HRESULT isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported);
+    HRESULT getFormats(std::vector<com::Utf8Str> &aFormats);
+    HRESULT addFormats(const std::vector<com::Utf8Str> &aFormats);
+    HRESULT removeFormats(const std::vector<com::Utf8Str> &aFormats);
+
+    HRESULT getProtocolVersion(ULONG *aProtocolVersion);
+    /** @}  */
+
+    /** Private wrapped @name IDnDTarget methods.
+     * @{ */
+    HRESULT enter(ULONG aScreenId, ULONG ax, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const std::vector<com::Utf8Str> &aFormats, DnDAction_T *aResultAction);
+    HRESULT move(ULONG aScreenId, ULONG aX, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const std::vector<com::Utf8Str> &aFormats, DnDAction_T *aResultAction);
+    HRESULT leave(ULONG aScreenId);
+    HRESULT drop(ULONG aScreenId, ULONG aX, ULONG aY, DnDAction_T aDefaultAction, const std::vector<DnDAction_T> &aAllowedActions, const std::vector<com::Utf8Str> &aFormats, com::Utf8Str &aFormat, DnDAction_T *aResultAction);
+    HRESULT sendData(ULONG aScreenId, const com::Utf8Str &aFormat, const std::vector<BYTE> &aData, ComPtr<IProgress> &aProgress);
+    HRESULT cancel(BOOL *aVeto);
+    /** @}  */
+
+protected:
+
+    static DECLCALLBACK(int) i_sendDataThread(RTTHREAD Thread, void *pvUser);
+    static DECLCALLBACK(int) i_sendURIDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser);
+
+protected:
+
+    int i_cancelOperation(void);
+    int i_sendData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
+    int i_sendDirectory(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aDirectory);
+    int i_sendFile(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aFile);
+    int i_sendFileData(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aFile);
+    int i_sendURIData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
+    int i_sendRawData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout);
+    int i_sendURIDataLoop(PSENDDATACTX pCtx, GuestDnDMsg *pMsg);
+
+protected:
+
+    struct
+    {
+        bool     mfTransferIsPending;
+        /** Maximum data block size (in bytes) the target can handle. */
+        uint32_t mcbBlockSize;
+    } mData;
+};
+
+#endif /* !____H_GUESTDNDTARGETIMPL */
+
diff --git a/src/VBox/Main/include/GuestFileImpl.h b/src/VBox/Main/include/GuestFileImpl.h
index 7890cb4..5940270 100644
--- a/src/VBox/Main/include/GuestFileImpl.h
+++ b/src/VBox/Main/include/GuestFileImpl.h
@@ -1,11 +1,10 @@
-
 /* $Id: GuestFileImpl.h $ */
 /** @file
- * VirtualBox Main - Guest file handling.
+ * VirtualBox Main - Guest file handling implementation.
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -22,87 +21,96 @@
 #include "VirtualBoxBase.h"
 #include "EventImpl.h"
 
-#include "GuestFsObjInfoImpl.h"
 #include "GuestCtrlImplPrivate.h"
+#include "GuestFileWrap.h"
 
 class Console;
 class GuestSession;
 class GuestProcess;
 
-/**
- * TODO
- */
 class ATL_NO_VTABLE GuestFile :
-    public VirtualBoxBase,
-    public GuestObject,
-    VBOX_SCRIPTABLE_IMPL(IGuestFile)
+    public GuestFileWrap,
+    public GuestObject
 {
 public:
     /** @name COM and internal init/term/mapping cruft.
      * @{ */
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestFile, IGuestFile)
-    DECLARE_NOT_AGGREGATABLE(GuestFile)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-    BEGIN_COM_MAP(GuestFile)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestFile)
-        COM_INTERFACE_ENTRY(IFile)
-    END_COM_MAP()
     DECLARE_EMPTY_CTOR_DTOR(GuestFile)
 
     int     init(Console *pConsole, GuestSession *pSession, ULONG uFileID, const GuestFileOpenInfo &openInfo);
     void    uninit(void);
+
     HRESULT FinalConstruct(void);
     void    FinalRelease(void);
     /** @}  */
 
-    /** @name IFile interface.
-     * @{ */
-    STDMETHOD(COMGETTER(CreationMode))(ULONG *aCreationMode);
-    STDMETHOD(COMGETTER(Disposition))(BSTR *aDisposition);
-    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
-    STDMETHOD(COMGETTER(FileName))(BSTR *aFileName);
-    STDMETHOD(COMGETTER(Id))(ULONG *aID);
-    STDMETHOD(COMGETTER(InitialSize))(LONG64 *aInitialSize);
-    STDMETHOD(COMGETTER(Offset))(LONG64 *aOffset);
-    STDMETHOD(COMGETTER(OpenMode))(BSTR *aOpenMode);
-    STDMETHOD(COMGETTER(Status))(FileStatus_T *aStatus);
-
-    STDMETHOD(Close)(void);
-    STDMETHOD(QueryInfo)(IFsObjInfo **aInfo);
-    STDMETHOD(Read)(ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData));
-    STDMETHOD(ReadAt)(LONG64 aOffset, ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData));
-    STDMETHOD(Seek)(LONG64 aOffset, FileSeekType_T aType);
-    STDMETHOD(SetACL)(IN_BSTR aACL);
-    STDMETHOD(Write)(ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten);
-    STDMETHOD(WriteAt)(LONG64 aOffset, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten);
-    /** @}  */
-
 public:
     /** @name Public internal methods.
      * @{ */
-    int             callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    int             closeFile(int *pGuestRc);
-    EventSource    *getEventSource(void) { return mEventSource; }
-    static Utf8Str  guestErrorToString(int guestRc);
-    int             onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
-    int             onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
-    int             onRemove(void);
-    int             openFile(uint32_t uTimeoutMS, int *pGuestRc);
-    int             readData(uint32_t uSize, uint32_t uTimeoutMS, void* pvData, uint32_t cbData, uint32_t* pcbRead);
-    int             readDataAt(uint64_t uOffset, uint32_t uSize, uint32_t uTimeoutMS, void* pvData, size_t cbData, size_t* pcbRead);
-    int             seekAt(int64_t iOffset, GUEST_FILE_SEEKTYPE eSeekType, uint32_t uTimeoutMS, uint64_t *puOffset);
-    static HRESULT  setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
-    int             setFileStatus(FileStatus_T fileStatus, int fileRc);
-    int             waitForOffsetChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, uint64_t *puOffset);
-    int             waitForRead(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead);
-    int             waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, FileStatus_T *pFileStatus, int *pGuestRc);
-    int             waitForWrite(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, uint32_t *pcbWritten);
-    int             writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData, uint32_t *pcbWritten);
-    int             writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS, void *pvData, uint32_t cbData, uint32_t *pcbWritten);
+    int             i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    int             i_closeFile(int *pGuestRc);
+    EventSource    *i_getEventSource(void) { return mEventSource; }
+    static Utf8Str  i_guestErrorToString(int guestRc);
+    int             i_onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+    int             i_onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+    int             i_onRemove(void);
+    int             i_openFile(uint32_t uTimeoutMS, int *pGuestRc);
+    int             i_readData(uint32_t uSize, uint32_t uTimeoutMS, void* pvData, uint32_t cbData, uint32_t* pcbRead);
+    int             i_readDataAt(uint64_t uOffset, uint32_t uSize, uint32_t uTimeoutMS,
+                                 void* pvData, size_t cbData, size_t* pcbRead);
+    int             i_seekAt(int64_t iOffset, GUEST_FILE_SEEKTYPE eSeekType, uint32_t uTimeoutMS, uint64_t *puOffset);
+    static HRESULT  i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
+    int             i_setFileStatus(FileStatus_T fileStatus, int fileRc);
+    int             i_waitForOffsetChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, uint64_t *puOffset);
+    int             i_waitForRead(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead);
+    int             i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, FileStatus_T *pFileStatus, int *pGuestRc);
+    int             i_waitForWrite(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, uint32_t *pcbWritten);
+    int             i_writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData, uint32_t *pcbWritten);
+    int             i_writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS, void *pvData, uint32_t cbData, uint32_t *pcbWritten);
     /** @}  */
 
 private:
 
+    /** @name Wrapped IGuestFile properties.
+     * @{ */
+    HRESULT getCreationMode(ULONG *aCreationMode);
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+    HRESULT getId(ULONG *aId);
+    HRESULT getInitialSize(LONG64 *aInitialSize);
+    HRESULT getOffset(LONG64 *aOffset);
+    HRESULT getStatus(FileStatus_T *aStatus);
+    HRESULT getFileName(com::Utf8Str &aFileName);
+    HRESULT getAccessMode(FileAccessMode_T *aAccessMode);
+    HRESULT getOpenAction(FileOpenAction_T *aOpenAction);
+    /** @}  */
+
+    /** @name Wrapped IGuestFile methods.
+     * @{ */
+    HRESULT close();
+    HRESULT queryInfo(ComPtr<IFsObjInfo> &aObjInfo);
+    HRESULT querySize(LONG64 *aSize);
+    HRESULT read(ULONG aToRead,
+                 ULONG aTimeoutMS,
+                 std::vector<BYTE> &aData);
+    HRESULT readAt(LONG64 aOffset,
+                   ULONG aToRead,
+                   ULONG aTimeoutMS,
+                   std::vector<BYTE> &aData);
+    HRESULT seek(LONG64 aOffset,
+                 FileSeekOrigin_T aWhence,
+                 LONG64 *aNewOffset);
+    HRESULT setACL(const com::Utf8Str &aAcl,
+                   ULONG aMode);
+    HRESULT setSize(LONG64 aSize);
+    HRESULT write(const std::vector<BYTE> &aData,
+                  ULONG aTimeoutMS,
+                  ULONG *aWritten);
+    HRESULT writeAt(LONG64 aOffset,
+                    const std::vector<BYTE> &aData,
+                    ULONG aTimeoutMS,
+                    ULONG *aWritten);
+    /** @}  */
+
     /** This can safely be used without holding any locks.
      * An AutoCaller suffices to prevent it being destroy while in use and
      * internally there is a lock providing the necessary serialization. */
diff --git a/src/VBox/Main/include/GuestFsObjInfoImpl.h b/src/VBox/Main/include/GuestFsObjInfoImpl.h
index 21ac02a..ebf94a6 100644
--- a/src/VBox/Main/include/GuestFsObjInfoImpl.h
+++ b/src/VBox/Main/include/GuestFsObjInfoImpl.h
@@ -1,11 +1,10 @@
-
 /* $Id: GuestFsObjInfoImpl.h $ */
 /** @file
- * VirtualBox Main - XXX.
+ * VirtualBox Main - Guest file system object information implementation.
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,65 +18,49 @@
 #ifndef ____H_GUESTFSOBJINFOIMPL
 #define ____H_GUESTFSOBJINFOIMPL
 
-#include "VirtualBoxBase.h"
+#include "GuestFsObjInfoWrap.h"
 #include "GuestCtrlImplPrivate.h"
 
-/**
- * TODO
- */
 class ATL_NO_VTABLE GuestFsObjInfo :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IGuestFsObjInfo)
+    public GuestFsObjInfoWrap
 {
 public:
     /** @name COM and internal init/term/mapping cruft.
      * @{ */
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestFsObjInfo, IGuestFsObjInfo)
-    DECLARE_NOT_AGGREGATABLE(GuestFsObjInfo)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-    BEGIN_COM_MAP(GuestFsObjInfo)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestFsObjInfo)
-        COM_INTERFACE_ENTRY(IFsObjInfo)
-    END_COM_MAP()
     DECLARE_EMPTY_CTOR_DTOR(GuestFsObjInfo)
 
     int     init(const GuestFsObjData &objData);
     void    uninit(void);
+
     HRESULT FinalConstruct(void);
     void    FinalRelease(void);
     /** @}  */
 
-    /** @name IFsObjInfo interface.
-     * @{ */
-    STDMETHOD(COMGETTER(AccessTime))(LONG64 *aAccessTime);
-    STDMETHOD(COMGETTER(AllocatedSize))(LONG64 *aAllocatedSize);
-    STDMETHOD(COMGETTER(BirthTime))(LONG64 *aBirthTime);
-    STDMETHOD(COMGETTER(ChangeTime))(LONG64 *aChangeTime);
-    STDMETHOD(COMGETTER(DeviceNumber))(ULONG *aDeviceNumber);
-    STDMETHOD(COMGETTER(FileAttributes))(BSTR *aFileAttrs);
-    STDMETHOD(COMGETTER(GenerationId))(ULONG *aGenerationId);
-    STDMETHOD(COMGETTER(GID))(ULONG *aGID);
-    STDMETHOD(COMGETTER(GroupName))(BSTR *aGroupName);
-    STDMETHOD(COMGETTER(HardLinks))(ULONG *aHardLinks);
-    STDMETHOD(COMGETTER(ModificationTime))(LONG64 *aModificationTime);
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMGETTER(NodeId))(LONG64 *aNodeId);
-    STDMETHOD(COMGETTER(NodeIdDevice))(ULONG *aNodeIdDevice);
-    STDMETHOD(COMGETTER(ObjectSize))(LONG64 *aObjectSize);
-    STDMETHOD(COMGETTER(Type))(FsObjType_T *aType);
-    STDMETHOD(COMGETTER(UID))(ULONG *aUID);
-    STDMETHOD(COMGETTER(UserFlags))(ULONG *aUserFlags);
-    STDMETHOD(COMGETTER(UserName))(BSTR *aUserName);
-    STDMETHOD(COMGETTER(ACL))(BSTR *aACL);
-    /** @}  */
+private:
 
-public:
-    /** @name Public internal methods.
+    /** Wrapped @name IGuestFsObjInfo properties.
      * @{ */
+    HRESULT getAccessTime(LONG64 *aAccessTime);
+    HRESULT getAllocatedSize(LONG64 *aAllocatedSize);
+    HRESULT getBirthTime(LONG64 *aBirthTime);
+    HRESULT getChangeTime(LONG64 *aChangeTime);
+    HRESULT getDeviceNumber(ULONG *aDeviceNumber);
+    HRESULT getFileAttributes(com::Utf8Str &aFileAttributes);
+    HRESULT getGenerationId(ULONG *aGenerationId);
+    HRESULT getGID(ULONG *aGID);
+    HRESULT getGroupName(com::Utf8Str &aGroupName);
+    HRESULT getHardLinks(ULONG *aHardLinks);
+    HRESULT getModificationTime(LONG64 *aModificationTime);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getNodeId(LONG64 *aNodeId);
+    HRESULT getNodeIdDevice(ULONG *aNodeIdDevice);
+    HRESULT getObjectSize(LONG64 *aObjectSize);
+    HRESULT getType(FsObjType_T *aType);
+    HRESULT getUID(ULONG *aUID);
+    HRESULT getUserFlags(ULONG *aUserFlags);
+    HRESULT getUserName(com::Utf8Str &aUserName);
     /** @}  */
 
-private:
-
     GuestFsObjData mData;
 };
 
diff --git a/src/VBox/Main/include/GuestImpl.h b/src/VBox/Main/include/GuestImpl.h
index 1a856ee..b7e5214 100644
--- a/src/VBox/Main/include/GuestImpl.h
+++ b/src/VBox/Main/include/GuestImpl.h
@@ -1,9 +1,10 @@
+/* $Id: GuestImpl.h $ */
 /** @file
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,6 +18,7 @@
 #ifndef ____H_GUESTIMPL
 #define ____H_GUESTIMPL
 
+#include "GuestWrap.h"
 #include "VirtualBoxBase.h"
 #include <iprt/list.h>
 #include <iprt/time.h>
@@ -24,13 +26,16 @@
 #include <VBox/vmm/stam.h>
 
 #include "AdditionsFacilityImpl.h"
-#include "GuestCtrlImplPrivate.h"
-#include "GuestSessionImpl.h"
-#include "HGCM.h"
-
+#ifdef VBOX_WITH_GUEST_CONTROL
+# include "GuestCtrlImplPrivate.h"
+# include "GuestSessionImpl.h"
+#endif
 #ifdef VBOX_WITH_DRAG_AND_DROP
-class GuestDnD;
+# include "GuestDnDSourceImpl.h"
+# include "GuestDnDTargetImpl.h"
 #endif
+#include "EventImpl.h"
+#include "HGCM.h"
 
 typedef enum
 {
@@ -47,138 +52,154 @@ typedef enum
 } GUESTSTATTYPE;
 
 class Console;
-#ifdef VBOX_WITH_GUEST_CONTROL
-class Progress;
-#endif
 
 class ATL_NO_VTABLE Guest :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IGuest)
+    public GuestWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Guest, IGuest)
-
-    DECLARE_NOT_AGGREGATABLE(Guest)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Guest)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IGuest)
-    END_COM_MAP()
 
     DECLARE_EMPTY_CTOR_DTOR (Guest)
 
-    HRESULT FinalConstruct(void);
-    void FinalRelease(void);
+    HRESULT FinalConstruct();
+    void FinalRelease();
 
     // Public initializer/uninitializer for internal purposes only.
-    HRESULT init (Console *aParent);
+    HRESULT init(Console *aParent);
     void uninit();
 
-    // IGuest properties.
-    STDMETHOD(COMGETTER(OSTypeId)) (BSTR *aOSTypeId);
-    STDMETHOD(COMGETTER(AdditionsRunLevel)) (AdditionsRunLevelType_T *aRunLevel);
-    STDMETHOD(COMGETTER(AdditionsVersion))(BSTR *a_pbstrAdditionsVersion);
-    STDMETHOD(COMGETTER(AdditionsRevision))(ULONG *a_puAdditionsRevision);
-    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
-    STDMETHOD(COMGETTER(Facilities)) (ComSafeArrayOut(IAdditionsFacility *, aFacilities));
-    STDMETHOD(COMGETTER(Sessions)) (ComSafeArrayOut(IGuestSession *, aSessions));
-    STDMETHOD(COMGETTER(MemoryBalloonSize)) (ULONG *aMemoryBalloonSize);
-    STDMETHOD(COMSETTER(MemoryBalloonSize)) (ULONG aMemoryBalloonSize);
-    STDMETHOD(COMGETTER(StatisticsUpdateInterval)) (ULONG *aUpdateInterval);
-    STDMETHOD(COMSETTER(StatisticsUpdateInterval)) (ULONG aUpdateInterval);
-    // IGuest methods.
-    STDMETHOD(GetFacilityStatus)(AdditionsFacilityType_T aType, LONG64 *aTimestamp, AdditionsFacilityStatus_T *aStatus);
-    STDMETHOD(GetAdditionsStatus)(AdditionsRunLevelType_T aLevel, BOOL *aActive);
-    STDMETHOD(SetCredentials)(IN_BSTR aUsername, IN_BSTR aPassword,
-                              IN_BSTR aDomain, BOOL aAllowInteractiveLogon);
-    // Drag'n drop support.
-    STDMETHOD(DragHGEnter)(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), DragAndDropAction_T *pResultAction);
-    STDMETHOD(DragHGMove)(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), DragAndDropAction_T *pResultAction);
-    STDMETHOD(DragHGLeave)(ULONG uScreenId);
-    STDMETHOD(DragHGDrop)(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), BSTR *pstrFormat, DragAndDropAction_T *pResultAction);
-    STDMETHOD(DragHGPutData)(ULONG uScreenId, IN_BSTR strFormat, ComSafeArrayIn(BYTE, data), IProgress **ppProgress);
-    STDMETHOD(DragGHPending)(ULONG uScreenId, ComSafeArrayOut(BSTR, formats), ComSafeArrayOut(DragAndDropAction_T, allowedActions), DragAndDropAction_T *pDefaultAction);
-    STDMETHOD(DragGHDropped)(IN_BSTR strFormat, DragAndDropAction_T action, IProgress **ppProgress);
-    STDMETHOD(DragGHGetData)(ComSafeArrayOut(BYTE, data));
-    // Guest control.
-    STDMETHOD(CreateSession)(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDomain, IN_BSTR aSessionName, IGuestSession **aGuestSession);
-    STDMETHOD(FindSession)(IN_BSTR aSessionName, ComSafeArrayOut(IGuestSession *, aSessions));
-    // Misc stuff
-    STDMETHOD(InternalGetStatistics)(ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle,
-                                     ULONG *aMemTotal, ULONG *aMemFree, ULONG *aMemBalloon, ULONG *aMemShared, ULONG *aMemCache,
-                                     ULONG *aPageTotal, ULONG *aMemAllocTotal, ULONG *aMemFreeTotal, ULONG *aMemBalloonTotal, ULONG *aMemSharedTotal);
-    STDMETHOD(UpdateGuestAdditions)(IN_BSTR aSource, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(AdditionsUpdateFlag_T, aFlags), IProgress **aProgress);
 
 public:
     /** @name Static internal methods.
      * @{ */
 #ifdef VBOX_WITH_GUEST_CONTROL
     /** Static callback for handling guest control notifications. */
-    static DECLCALLBACK(int) notifyCtrlDispatcher(void *pvExtension, uint32_t u32Function, void *pvData, uint32_t cbData);
-    static DECLCALLBACK(void) staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick);
+    static DECLCALLBACK(int) i_notifyCtrlDispatcher(void *pvExtension, uint32_t u32Function, void *pvData, uint32_t cbData);
 #endif
+    static DECLCALLBACK(void) i_staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick);
     /** @}  */
 
 public:
     /** @name Public internal methods.
      * @{ */
-    void enableVMMStatistics(BOOL aEnable) { mCollectVMMStats = aEnable; };
-    void setAdditionsInfo(Bstr aInterfaceVersion, VBOXOSTYPE aOsType);
-    void setAdditionsInfo2(uint32_t a_uFullVersion, const char *a_pszName, uint32_t a_uRevision, uint32_t a_fFeatures);
-    bool facilityIsActive(VBoxGuestFacilityType enmFacility);
-    void facilityUpdate(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
-    void setAdditionsStatus(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
-    void onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmState, const uint8_t *puDetails, uint32_t cbDetails);
-    void setSupportedFeatures(uint32_t aCaps);
-    HRESULT setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal);
-    BOOL isPageFusionEnabled();
-    static HRESULT setErrorStatic(HRESULT aResultCode,
-                                  const Utf8Str &aText)
+    void i_enableVMMStatistics(BOOL aEnable) { mCollectVMMStats = aEnable; };
+    void i_setAdditionsInfo(com::Utf8Str aInterfaceVersion, VBOXOSTYPE aOsType);
+    void i_setAdditionsInfo2(uint32_t a_uFullVersion, const char *a_pszName, uint32_t a_uRevision, uint32_t a_fFeatures);
+    bool i_facilityIsActive(VBoxGuestFacilityType enmFacility);
+    void i_facilityUpdate(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus,
+                          uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
+    ComObjPtr<Console> i_getConsole(void) { return mParent; }
+    void i_setAdditionsStatus(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus,
+                              uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
+    void i_onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmState, const uint8_t *puDetails, uint32_t cbDetails);
+    void i_setSupportedFeatures(uint32_t aCaps);
+    HRESULT i_setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal);
+    BOOL i_isPageFusionEnabled();
+    static HRESULT i_setErrorStatic(HRESULT aResultCode, const Utf8Str &aText)
     {
         return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
     }
+    uint32_t    i_getAdditionsVersion(void) { return mData.mAdditionsVersionFull; }
+    VBOXOSTYPE  i_getGuestOSType(void) { return mData.mOSType; }
 #ifdef VBOX_WITH_GUEST_CONTROL
-    int         dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    uint32_t    getAdditionsVersion(void) { return mData.mAdditionsVersionFull; }
-    Console    *getConsole(void) { return mParent; }
-    int         sessionRemove(GuestSession *pSession);
-    int         sessionCreate(const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds, ComObjPtr<GuestSession> &pGuestSession);
-    inline bool sessionExists(uint32_t uSessionID);
+    int         i_dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    int         i_sessionRemove(GuestSession *pSession);
+    int         i_sessionCreate(const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds,
+                                ComObjPtr<GuestSession> &pGuestSession);
+    inline bool i_sessionExists(uint32_t uSessionID);
+
 #endif
     /** @}  */
 
 private:
+
+     // wrapped IGuest properties
+     HRESULT getOSTypeId(com::Utf8Str &aOSTypeId);
+     HRESULT getAdditionsRunLevel(AdditionsRunLevelType_T *aAdditionsRunLevel);
+     HRESULT getAdditionsVersion(com::Utf8Str &aAdditionsVersion);
+     HRESULT getAdditionsRevision(ULONG *aAdditionsRevision);
+     HRESULT getDnDSource(ComPtr<IGuestDnDSource> &aDnDSource);
+     HRESULT getDnDTarget(ComPtr<IGuestDnDTarget> &aDnDTarget);
+     HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+     HRESULT getFacilities(std::vector<ComPtr<IAdditionsFacility> > &aFacilities);
+     HRESULT getSessions(std::vector<ComPtr<IGuestSession> > &aSessions);
+     HRESULT getMemoryBalloonSize(ULONG *aMemoryBalloonSize);
+     HRESULT setMemoryBalloonSize(ULONG aMemoryBalloonSize);
+     HRESULT getStatisticsUpdateInterval(ULONG *aStatisticsUpdateInterval);
+     HRESULT setStatisticsUpdateInterval(ULONG aStatisticsUpdateInterval);
+     HRESULT internalGetStatistics(ULONG *aCpuUser,
+                                   ULONG *aCpuKernel,
+                                   ULONG *aCpuIdle,
+                                   ULONG *aMemTotal,
+                                   ULONG *aMemFree,
+                                   ULONG *aMemBalloon,
+                                   ULONG *aMemShared,
+                                   ULONG *aMemCache,
+                                   ULONG *aPagedTotal,
+                                   ULONG *aMemAllocTotal,
+                                   ULONG *aMemFreeTotal,
+                                   ULONG *aMemBalloonTotal,
+                                   ULONG *aMemSharedTotal);
+     HRESULT getFacilityStatus(AdditionsFacilityType_T aFacility,
+                               LONG64 *aTimestamp,
+                               AdditionsFacilityStatus_T *aStatus);
+     HRESULT getAdditionsStatus(AdditionsRunLevelType_T aLevel,
+                                BOOL *aActive);
+     HRESULT setCredentials(const com::Utf8Str &aUserName,
+                            const com::Utf8Str &aPassword,
+                            const com::Utf8Str &aDomain,
+                            BOOL aAllowInteractiveLogon);
+
+     // wrapped IGuest methods
+     HRESULT createSession(const com::Utf8Str &aUser,
+                           const com::Utf8Str &aPassword,
+                           const com::Utf8Str &aDomain,
+                           const com::Utf8Str &aSessionName,
+                           ComPtr<IGuestSession> &aGuestSession);
+
+     HRESULT findSession(const com::Utf8Str &aSessionName,
+                         std::vector<ComPtr<IGuestSession> > &aSessions);
+     HRESULT updateGuestAdditions(const com::Utf8Str &aSource,
+                                  const std::vector<com::Utf8Str> &aArguments,
+                                  const std::vector<AdditionsUpdateFlag_T> &aFlags,
+                                  ComPtr<IProgress> &aProgress);
+
+
     /** @name Private internal methods.
      * @{ */
-    void updateStats(uint64_t iTick);
-    static int staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,
-                                       STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser);
+    void i_updateStats(uint64_t iTick);
+    static int i_staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,
+                                         STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser);
+
     /** @}  */
 
     typedef std::map< AdditionsFacilityType_T, ComObjPtr<AdditionsFacility> > FacilityMap;
     typedef std::map< AdditionsFacilityType_T, ComObjPtr<AdditionsFacility> >::iterator FacilityMapIter;
     typedef std::map< AdditionsFacilityType_T, ComObjPtr<AdditionsFacility> >::const_iterator FacilityMapIterConst;
 
+#ifdef VBOX_WITH_GUEST_CONTROL
     /** Map for keeping the guest sessions. The primary key marks the guest session ID. */
     typedef std::map <uint32_t, ComObjPtr<GuestSession> > GuestSessions;
+#endif
 
     struct Data
     {
-        Data() : mAdditionsRunLevel(AdditionsRunLevelType_None)
+        Data() : mOSType(VBOXOSTYPE_Unknown),  mAdditionsRunLevel(AdditionsRunLevelType_None)
             , mAdditionsVersionFull(0), mAdditionsRevision(0), mAdditionsFeatures(0)
         { }
 
-        Bstr                    mOSTypeId;
-        FacilityMap             mFacilityMap;
-        AdditionsRunLevelType_T mAdditionsRunLevel;
-        uint32_t                mAdditionsVersionFull;
-        Bstr                    mAdditionsVersionNew;
-        uint32_t                mAdditionsRevision;
-        uint32_t                mAdditionsFeatures;
-        Bstr                    mInterfaceVersion;
-        GuestSessions           mGuestSessions;
-        uint32_t                mNextSessionID;
+        VBOXOSTYPE                  mOSType;        /**@< For internal used. VBOXOSTYPE_Unknown if not reported. */
+        Utf8Str                     mOSTypeId;
+        FacilityMap                 mFacilityMap;
+        AdditionsRunLevelType_T     mAdditionsRunLevel;
+        uint32_t                    mAdditionsVersionFull;
+        Utf8Str                     mAdditionsVersionNew;
+        uint32_t                    mAdditionsRevision;
+        uint32_t                    mAdditionsFeatures;
+        Utf8Str                     mInterfaceVersion;
+#ifdef VBOX_WITH_GUEST_CONTROL
+        GuestSessions               mGuestSessions;
+        uint32_t                    mNextSessionID;
+#endif
     } mData;
 
     ULONG                           mMemoryBalloonSize;
@@ -191,29 +212,30 @@ private:
     BOOL                            mCollectVMMStats;
     BOOL                            mfPageFusionEnabled;
 
-    Console                        *mParent;
+    const ComObjPtr<Console>        mParent;
 
-#ifdef VBOX_WITH_GUEST_CONTROL
     /**
      * This can safely be used without holding any locks.
      * An AutoCaller suffices to prevent it being destroy while in use and
      * internally there is a lock providing the necessary serialization.
      */
     const ComObjPtr<EventSource>    mEventSource;
+#ifdef VBOX_WITH_GUEST_CONTROL
     /** General extension callback for guest control. */
     HGCMSVCEXTHANDLE                mhExtCtrl;
 #endif
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
-    GuestDnD         *m_pGuestDnD;
-    friend class GuestDnD;
-    friend class GuestDnDPrivate;
+    /** The guest's DnD source. */
+    const ComObjPtr<GuestDnDSource> mDnDSource;
+    /** The guest's DnD target. */
+    const ComObjPtr<GuestDnDTarget> mDnDTarget;
 #endif
 
-    RTTIMERLR         mStatTimer;
-    uint32_t          mMagic;
+    RTTIMERLR                       mStatTimer;
+    uint32_t                        mMagic; /** @todo r=andy Rename this to something more meaningful. */
 };
-#define GUEST_MAGIC 0xCEED2006u
+#define GUEST_MAGIC 0xCEED2006u /** @todo r=andy Not very well defined!? */
 
 #endif // ____H_GUESTIMPL
 
diff --git a/src/VBox/Main/include/GuestOSTypeImpl.h b/src/VBox/Main/include/GuestOSTypeImpl.h
index 72ad317..9862dfa 100644
--- a/src/VBox/Main/include/GuestOSTypeImpl.h
+++ b/src/VBox/Main/include/GuestOSTypeImpl.h
@@ -1,10 +1,11 @@
+/* $Id: GuestOSTypeImpl.h $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,28 +16,17 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+    // static int i_vrdpServerVerifyPortsString(com::Utf8Str portRange);
 #ifndef ____H_GUESTOSTYPEIMPL
 #define ____H_GUESTOSTYPEIMPL
 
-#include "VirtualBoxBase.h"
 #include "Global.h"
-
-#include <VBox/ostypes.h>
+#include "GuestOSTypeWrap.h"
 
 class ATL_NO_VTABLE GuestOSType :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IGuestOSType)
+    public GuestOSTypeWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestOSType, IGuestOSType)
-
-    DECLARE_NOT_AGGREGATABLE(GuestOSType)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(GuestOSType)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestOSType)
-    END_COM_MAP()
 
     DECLARE_EMPTY_CTOR_DTOR(GuestOSType)
 
@@ -47,46 +37,48 @@ public:
     HRESULT init(const Global::OSType &ostype);
     void uninit();
 
-    // IGuestOSType properties
-    STDMETHOD(COMGETTER(FamilyId))(BSTR *aFamilyId);
-    STDMETHOD(COMGETTER(FamilyDescription))(BSTR *aFamilyDescription);
-    STDMETHOD(COMGETTER(Id))(BSTR *aId);
-    STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
-    STDMETHOD(COMGETTER(Is64Bit))(BOOL *aIs64Bit);
-    STDMETHOD(COMGETTER(RecommendedIOAPIC))(BOOL *aRecommendedIOAPIC);
-    STDMETHOD(COMGETTER(RecommendedVirtEx))(BOOL *aRecommendedVirtEx);
-    STDMETHOD(COMGETTER(RecommendedRAM))(ULONG *aRAMSize);
-    STDMETHOD(COMGETTER(RecommendedVRAM))(ULONG *aVRAMSize);
-    STDMETHOD(COMGETTER(Recommended2DVideoAcceleration))(BOOL *aRecommended2DVideoAcceleration);
-    STDMETHOD(COMGETTER(Recommended3DAcceleration))(BOOL *aRecommended3DAcceleration);
-    STDMETHOD(COMGETTER(RecommendedHDD))(LONG64 *aHDDSize);
-    STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aNetworkAdapterType);
-    STDMETHOD(COMGETTER(RecommendedFirmware))(FirmwareType_T *aFirmwareType);
-    STDMETHOD(COMGETTER(RecommendedDVDStorageBus))(StorageBus_T *aStorageBusType);
-    STDMETHOD(COMGETTER(RecommendedDVDStorageController))(StorageControllerType_T *aStorageControllerType);
-    STDMETHOD(COMGETTER(RecommendedHDStorageBus))(StorageBus_T *aStorageBusType);
-    STDMETHOD(COMGETTER(RecommendedHDStorageController))(StorageControllerType_T *aStorageControllerType);
-    STDMETHOD(COMGETTER(RecommendedPAE))(BOOL *aRecommendedExtHw);
-    STDMETHOD(COMGETTER(RecommendedUSBHID))(BOOL *aRecommendedUSBHID);
-    STDMETHOD(COMGETTER(RecommendedHPET))(BOOL *aRecommendedHPET);
-    STDMETHOD(COMGETTER(RecommendedUSBTablet))(BOOL *aRecommendedUSBTablet);
-    STDMETHOD(COMGETTER(RecommendedRTCUseUTC))(BOOL *aRecommendedRTCUseUTC);
-    STDMETHOD(COMGETTER(RecommendedChipset))(ChipsetType_T *aChipsetType);
-    STDMETHOD(COMGETTER(RecommendedAudioController))(AudioControllerType_T *aAudioController);
-    STDMETHOD(COMGETTER(RecommendedFloppy))(BOOL *aRecommendedFloppy);
-    STDMETHOD(COMGETTER(RecommendedUSB))(BOOL *aRecommendedUSB);
-
     // public methods only for internal purposes
-    const Bstr &id() const { return mID; }
-    bool is64Bit() const { return !!(mOSHint & VBOXOSHINT_64BIT); }
-    bool recommendedIOAPIC() const { return !!(mOSHint & VBOXOSHINT_IOAPIC); }
-    bool recommendedVirtEx() const { return !!(mOSHint & VBOXOSHINT_HWVIRTEX); }
-    bool recommendedEFI() const { return !!(mOSHint & VBOXOSHINT_EFI); }
-    NetworkAdapterType_T networkAdapterType() const { return mNetworkAdapterType; }
-    uint32_t numSerialEnabled() const { return mNumSerialEnabled; }
+    const Bstr &i_id() const { return mID; }
+    bool i_is64Bit() const { return !!(mOSHint & VBOXOSHINT_64BIT); }
+    bool i_recommendedIOAPIC() const { return !!(mOSHint & VBOXOSHINT_IOAPIC); }
+    bool i_recommendedVirtEx() const { return !!(mOSHint & VBOXOSHINT_HWVIRTEX); }
+    bool i_recommendedEFI() const { return !!(mOSHint & VBOXOSHINT_EFI); }
+    NetworkAdapterType_T i_networkAdapterType() const { return mNetworkAdapterType; }
+    uint32_t i_numSerialEnabled() const { return mNumSerialEnabled; }
 
 private:
 
+    // Wrapped IGuestOSType properties
+    HRESULT getFamilyId(com::Utf8Str &aFamilyId);
+    HRESULT getFamilyDescription(com::Utf8Str &aFamilyDescription);
+    HRESULT getId(com::Utf8Str &aId);
+    HRESULT getDescription(com::Utf8Str &aDescription);
+    HRESULT getIs64Bit(BOOL *aIs64Bit);
+    HRESULT getRecommendedIOAPIC(BOOL *aRecommendedIOAPIC);
+    HRESULT getRecommendedVirtEx(BOOL *aRecommendedVirtEx);
+    HRESULT getRecommendedRAM(ULONG *RAMSize);
+    HRESULT getRecommendedVRAM(ULONG *aVRAMSize);
+    HRESULT getRecommended2DVideoAcceleration(BOOL *aRecommended2DVideoAcceleration);
+    HRESULT getRecommended3DAcceleration(BOOL *aRecommended3DAcceleration);
+    HRESULT getRecommendedHDD(LONG64 *aHDDSize);
+    HRESULT getAdapterType(NetworkAdapterType_T *aNetworkAdapterType);
+    HRESULT getRecommendedPAE(BOOL *aRecommendedPAE);
+    HRESULT getRecommendedDVDStorageController(StorageControllerType_T *aStorageControllerType);
+    HRESULT getRecommendedFirmware(FirmwareType_T *aFirmwareType);
+    HRESULT getRecommendedDVDStorageBus(StorageBus_T *aStorageBusType);
+    HRESULT getRecommendedHDStorageController(StorageControllerType_T *aStorageControllerType);
+    HRESULT getRecommendedHDStorageBus(StorageBus_T *aStorageBusType);
+    HRESULT getRecommendedUSBHID(BOOL *aRecommendedUSBHID);
+    HRESULT getRecommendedHPET(BOOL *aRecommendedHPET);
+    HRESULT getRecommendedUSBTablet(BOOL *aRecommendedUSBTablet);
+    HRESULT getRecommendedRTCUseUTC(BOOL *aRecommendedRTCUseUTC);
+    HRESULT getRecommendedChipset(ChipsetType_T *aChipsetType);
+    HRESULT getRecommendedAudioController(AudioControllerType_T *aAudioController);
+    HRESULT getRecommendedFloppy(BOOL *aRecommendedFloppy);
+    HRESULT getRecommendedUSB(BOOL *aRecommendedUSB);
+    HRESULT getRecommendedTFReset(BOOL *aRecommendedTFReset);
+
+
     const Bstr mFamilyID;
     const Bstr mFamilyDescription;
     const Bstr mID;
diff --git a/src/VBox/Main/include/GuestProcessImpl.h b/src/VBox/Main/include/GuestProcessImpl.h
index 95564b4..f376bf6 100644
--- a/src/VBox/Main/include/GuestProcessImpl.h
+++ b/src/VBox/Main/include/GuestProcessImpl.h
@@ -1,11 +1,10 @@
-
 /* $Id: GuestProcessImpl.h $ */
 /** @file
- * VirtualBox Main - Guest process handling.
+ * VirtualBox Main - Guest process handling implementation.
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,8 +18,10 @@
 #ifndef ____H_GUESTPROCESSIMPL
 #define ____H_GUESTPROCESSIMPL
 
-#include "VirtualBoxBase.h"
 #include "GuestCtrlImplPrivate.h"
+#include "GuestProcessWrap.h"
+
+#include <iprt/cpp/utils.h>
 
 class Console;
 class GuestSession;
@@ -29,85 +30,103 @@ class GuestSession;
  * Class for handling a guest process.
  */
 class ATL_NO_VTABLE GuestProcess :
-    public VirtualBoxBase,
-    public GuestObject,
-    VBOX_SCRIPTABLE_IMPL(IGuestProcess)
+    public GuestProcessWrap,
+    public GuestObject
 {
 public:
     /** @name COM and internal init/term/mapping cruft.
      * @{ */
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestProcess, IGuestProcess)
-    DECLARE_NOT_AGGREGATABLE(GuestProcess)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-    BEGIN_COM_MAP(GuestProcess)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestProcess)
-        COM_INTERFACE_ENTRY(IProcess)
-    END_COM_MAP()
     DECLARE_EMPTY_CTOR_DTOR(GuestProcess)
 
-    int     init(Console *aConsole, GuestSession *aSession, ULONG aProcessID, const GuestProcessStartupInfo &aProcInfo);
+    int     init(Console *aConsole, GuestSession *aSession, ULONG aProcessID,
+                 const GuestProcessStartupInfo &aProcInfo, const GuestEnvironment *pBaseEnv);
     void    uninit(void);
     HRESULT FinalConstruct(void);
     void    FinalRelease(void);
     /** @}  */
 
-    /** @name IProcess interface.
-     * @{ */
-    STDMETHOD(COMGETTER(Arguments))(ComSafeArrayOut(BSTR, aArguments));
-    STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
-    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
-    STDMETHOD(COMGETTER(ExecutablePath))(BSTR *aExecutablePath);
-    STDMETHOD(COMGETTER(ExitCode))(LONG *aExitCode);
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMGETTER(PID))(ULONG *aPID);
-    STDMETHOD(COMGETTER(Status))(ProcessStatus_T *aStatus);
-
-    STDMETHOD(Read)(ULONG aHandle, ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData));
-    STDMETHOD(Terminate)(void);
-    STDMETHOD(WaitFor)(ULONG aWaitFlags, ULONG aTimeoutMS, ProcessWaitResult_T *aReason);
-    STDMETHOD(WaitForArray)(ComSafeArrayIn(ProcessWaitForFlag_T, aFlags), ULONG aTimeoutMS, ProcessWaitResult_T *aReason);
-    STDMETHOD(Write)(ULONG aHandle, ULONG aFlags, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten);
-    STDMETHOD(WriteArray)(ULONG aHandle, ComSafeArrayIn(ProcessInputFlag_T, aFlags), ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten);
-    /** @}  */
-
 public:
     /** @name Public internal methods.
      * @{ */
-    int callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    inline int checkPID(uint32_t uPID);
-    static Utf8Str guestErrorToString(int guestRc);
-    int onRemove(void);
-    int readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData, size_t cbData, uint32_t *pcbRead, int *pGuestRc);
-    static HRESULT setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
-    int startProcess(uint32_t uTimeoutMS, int *pGuestRc);
-    int startProcessAsync(void);
-    int terminateProcess(uint32_t uTimeoutMS, int *pGuestRc);
-    static ProcessWaitResult_T waitFlagsToResultEx(uint32_t fWaitFlags, ProcessStatus_T oldStatus, ProcessStatus_T newStatus, uint32_t uProcFlags, uint32_t uProtocol);
-    ProcessWaitResult_T waitFlagsToResult(uint32_t fWaitFlags);
-    int waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pGuestRc);
-    int waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, ProcessInputStatus_T *pInputStatus, uint32_t *pcbProcessed);
-    int waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS, void* pvData, size_t cbData, uint32_t *pcbRead);
-    int waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS, ProcessStatus_T *pProcessStatus, int *pGuestRc);
-    static bool waitResultImpliesEx(ProcessWaitResult_T waitResult, ProcessStatus_T procStatus, uint32_t uProcFlags, uint32_t uProtocol);
-    int writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc);
+    int i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    inline int i_checkPID(uint32_t uPID);
+    static Utf8Str i_guestErrorToString(int guestRc);
+    int i_onRemove(void);
+    int i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS, void *pvData,
+                   size_t cbData, uint32_t *pcbRead, int *pGuestRc);
+    static HRESULT i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
+    int i_startProcess(uint32_t uTimeoutMS, int *pGuestRc);
+    int i_startProcessAsync(void);
+    int i_terminateProcess(uint32_t uTimeoutMS, int *pGuestRc);
+    static ProcessWaitResult_T i_waitFlagsToResultEx(uint32_t fWaitFlags, ProcessStatus_T oldStatus,
+                                                     ProcessStatus_T newStatus, uint32_t uProcFlags,
+                                                     uint32_t uProtocol);
+    ProcessWaitResult_T i_waitFlagsToResult(uint32_t fWaitFlags);
+    int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, ProcessWaitResult_T &waitResult, int *pGuestRc);
+    int i_waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS,
+                             ProcessInputStatus_T *pInputStatus, uint32_t *pcbProcessed);
+    int i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS,
+                        void* pvData, size_t cbData, uint32_t *pcbRead);
+    int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
+                              ProcessStatus_T *pProcessStatus, int *pGuestRc);
+    static bool i_waitResultImpliesEx(ProcessWaitResult_T waitResult, ProcessStatus_T procStatus,
+                                      uint32_t uProcFlags, uint32_t uProtocol);
+    int i_writeData(uint32_t uHandle, uint32_t uFlags, void *pvData, size_t cbData,
+                    uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc);
     /** @}  */
 
 protected:
     /** @name Protected internal methods.
      * @{ */
-    inline bool isAlive(void);
-    inline bool hasEnded(void);
-    int onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
-    int onProcessInputStatus(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
-    int onProcessNotifyIO(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
-    int onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
-    int onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
-    int prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars);
-    int setProcessStatus(ProcessStatus_T procStatus, int procRc);
-    static DECLCALLBACK(int) startProcessThread(RTTHREAD Thread, void *pvUser);
+    inline bool i_isAlive(void);
+    inline bool i_hasEnded(void);
+    int i_onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+    int i_onProcessInputStatus(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+    int i_onProcessNotifyIO(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+    int i_onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+    int i_onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+    int i_prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars);
+    int i_setProcessStatus(ProcessStatus_T procStatus, int procRc);
+    static DECLCALLBACK(int) i_startProcessThread(RTTHREAD Thread, void *pvUser);
     /** @}  */
 
 private:
+    /** Wrapped @name IProcess properties.
+     * @{ */
+    HRESULT getArguments(std::vector<com::Utf8Str> &aArguments);
+    HRESULT getEnvironment(std::vector<com::Utf8Str> &aEnvironment);
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+    HRESULT getExecutablePath(com::Utf8Str &aExecutablePath);
+    HRESULT getExitCode(LONG *aExitCode);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getPID(ULONG *aPID);
+    HRESULT getStatus(ProcessStatus_T *aStatus);
+    /** @}  */
+
+    /** Wrapped @name IProcess methods.
+     * @{ */
+    HRESULT waitFor(ULONG aWaitFor,
+                    ULONG aTimeoutMS,
+                    ProcessWaitResult_T *aReason);
+    HRESULT waitForArray(const std::vector<ProcessWaitForFlag_T> &aWaitFor,
+                         ULONG aTimeoutMS,
+                         ProcessWaitResult_T *aReason);
+    HRESULT read(ULONG aHandle,
+                 ULONG aToRead,
+                 ULONG aTimeoutMS,
+                 std::vector<BYTE> &aData);
+    HRESULT write(ULONG aHandle,
+                  ULONG aFlags,
+                  const std::vector<BYTE> &aData,
+                  ULONG aTimeoutMS,
+                  ULONG *aWritten);
+    HRESULT writeArray(ULONG aHandle,
+                       const std::vector<ProcessInputFlag_T> &aFlags,
+                       const std::vector<BYTE> &aData,
+                       ULONG aTimeoutMS,
+                       ULONG *aWritten);
+    HRESULT terminate(void);
+    /** @}  */
 
     /**
      * This can safely be used without holding any locks.
@@ -120,6 +139,12 @@ private:
     {
         /** The process startup information. */
         GuestProcessStartupInfo  mProcess;
+        /** Reference to the immutable session base environment. NULL if the
+         * environment feature isn't supported.
+         * @remarks If there is proof that the uninit order of GuestSession and
+         *          this class is what GuestObjectBase claims, then this isn't
+         *          strictly necessary. */
+        GuestEnvironment const  *mpSessionBaseEnv;
         /** Exit code if process has been terminated. */
         LONG                     mExitCode;
         /** PID reported from the guest. */
@@ -129,6 +154,17 @@ private:
         /** The last returned process status
          *  returned from the guest side. */
         int                      mLastError;
+
+        Data(void) : mpSessionBaseEnv(NULL)
+        { }
+        ~Data(void)
+        {
+            if (mpSessionBaseEnv)
+            {
+                mpSessionBaseEnv->releaseConst();
+                mpSessionBaseEnv = NULL;
+            }
+        }
     } mData;
 };
 
@@ -159,26 +195,26 @@ public:
 
     int Init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, bool fAsync, int *pGuestRc);
 
-    GuestProcessStream &GetStdOut(void) { return mStdOut; }
+    GuestProcessStream &i_getStdOut(void) { return mStdOut; }
 
-    GuestProcessStream &GetStdErr(void) { return mStdErr; }
+    GuestProcessStream &i_getStdErr(void) { return mStdErr; }
 
-    int Wait(uint32_t fFlags, int *pGuestRc);
+    int i_wait(uint32_t fFlags, int *pGuestRc);
 
-    int WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStreamBlock, int *pGuestRc);
+    int i_waitEx(uint32_t fFlags, GuestProcessStreamBlock *pStreamBlock, int *pGuestRc);
 
-    int GetCurrentBlock(uint32_t uHandle, GuestProcessStreamBlock &strmBlock);
+    int i_getCurrentBlock(uint32_t uHandle, GuestProcessStreamBlock &strmBlock);
 
-    bool IsRunning(void);
+    bool i_isRunning(void);
 
-    static int Run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pGuestRc);
+    static int i_run(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, int *pGuestRc);
 
-    static int RunEx(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo, GuestCtrlStreamObjects *pStrmOutObjects,
-                     uint32_t cStrmOutObjects, int *pGuestRc);
+    static int i_runEx(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo,
+                       GuestCtrlStreamObjects *pStrmOutObjects, uint32_t cStrmOutObjects, int *pGuestRc);
 
-    int TerminatedOk(LONG *pExitCode);
+    int i_terminatedOk(LONG *pExitCode);
 
-    int Terminate(uint32_t uTimeoutMS, int *pGuestRc);
+    int i_terminate(uint32_t uTimeoutMS, int *pGuestRc);
 
 protected:
 
diff --git a/src/VBox/Main/include/GuestSessionImpl.h b/src/VBox/Main/include/GuestSessionImpl.h
index 263ed6d..1f93c06 100644
--- a/src/VBox/Main/include/GuestSessionImpl.h
+++ b/src/VBox/Main/include/GuestSessionImpl.h
@@ -1,4 +1,3 @@
-
 /* $Id: GuestSessionImpl.h $ */
 /** @file
  * VirtualBox Main - Guest session handling.
@@ -19,7 +18,7 @@
 #ifndef ____H_GUESTSESSIONIMPL
 #define ____H_GUESTSESSIONIMPL
 
-#include "VirtualBoxBase.h"
+#include "GuestSessionWrap.h"
 #include "EventImpl.h"
 
 #include "GuestCtrlImplPrivate.h"
@@ -52,7 +51,7 @@ public:
 protected:
 
     int getGuestProperty(const ComObjPtr<Guest> &pGuest,
-                         const Utf8Str &strPath, Utf8Str &strValue);
+                           const Utf8Str &strPath, Utf8Str &strValue);
     int setProgress(ULONG uPercent);
     int setProgressSuccess(void);
     HRESULT setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg);
@@ -204,7 +203,7 @@ protected:
               fFlags(aFlags),
               mProcInfo(startupInfo)
         {
-            mProcInfo.mCommand = strDest;
+            mProcInfo.mExecutable = strDest;
             if (mProcInfo.mName.isEmpty())
                 mProcInfo.mName = strDest;
         }
@@ -220,12 +219,12 @@ protected:
         GuestProcessStartupInfo mProcInfo;
     };
 
-    int addProcessArguments(ProcessArguments &aArgumentsDest,
-                            const ProcessArguments &aArgumentsSource);
-    int copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO,
-                        Utf8Str const &strFileSource, const Utf8Str &strFileDest,
-                        bool fOptional, uint32_t *pcbSize);
-    int runFileOnGuest(GuestSession *pSession, GuestProcessStartupInfo &procInfo);
+    int i_addProcessArguments(ProcessArguments &aArgumentsDest,
+                              const ProcessArguments &aArgumentsSource);
+    int i_copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO,
+                          Utf8Str const &strFileSource, const Utf8Str &strFileDest,
+                          bool fOptional, uint32_t *pcbSize);
+    int i_runFileOnGuest(GuestSession *pSession, GuestProcessStartupInfo &procInfo);
 
     /** Files to handle. */
     std::vector<InstallerFile> mFiles;
@@ -242,19 +241,12 @@ protected:
  * Guest session implementation.
  */
 class ATL_NO_VTABLE GuestSession :
-    public VirtualBoxBase,
-    public GuestBase,
-    VBOX_SCRIPTABLE_IMPL(IGuestSession)
+    public GuestSessionWrap,
+    public GuestBase
 {
 public:
     /** @name COM and internal init/term/mapping cruft.
      * @{ */
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(GuestSession, IGuestSession)
-    DECLARE_NOT_AGGREGATABLE(GuestSession)
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-    BEGIN_COM_MAP(GuestSession)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IGuestSession)
-    END_COM_MAP()
     DECLARE_EMPTY_CTOR_DTOR(GuestSession)
 
     int     init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds);
@@ -263,69 +255,158 @@ public:
     void    FinalRelease(void);
     /** @}  */
 
-    /** @name IGuestSession properties.
+private:
+
+    /** Wrapped @name IGuestSession properties.
      * @{ */
-    STDMETHOD(COMGETTER(User))(BSTR *aName);
-    STDMETHOD(COMGETTER(Domain))(BSTR *aDomain);
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMGETTER(Id))(ULONG *aId);
-    STDMETHOD(COMGETTER(Status))(GuestSessionStatus_T *aStatus);
-    STDMETHOD(COMGETTER(Timeout))(ULONG *aTimeout);
-    STDMETHOD(COMSETTER(Timeout))(ULONG aTimeout);
-    STDMETHOD(COMGETTER(ProtocolVersion))(ULONG *aVersion);
-    STDMETHOD(COMGETTER(Environment))(ComSafeArrayOut(BSTR, aEnvironment));
-    STDMETHOD(COMSETTER(Environment))(ComSafeArrayIn(IN_BSTR, aEnvironment));
-    STDMETHOD(COMGETTER(Processes))(ComSafeArrayOut(IGuestProcess *, aProcesses));
-    STDMETHOD(COMGETTER(Directories))(ComSafeArrayOut(IGuestDirectory *, aDirectories));
-    STDMETHOD(COMGETTER(Files))(ComSafeArrayOut(IGuestFile *, aFiles));
-    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
+    HRESULT getUser(com::Utf8Str &aUser);
+    HRESULT getDomain(com::Utf8Str &aDomain);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getId(ULONG *aId);
+    HRESULT getTimeout(ULONG *aTimeout);
+    HRESULT setTimeout(ULONG aTimeout);
+    HRESULT getProtocolVersion(ULONG *aProtocolVersion);
+    HRESULT getStatus(GuestSessionStatus_T *aStatus);
+    HRESULT getEnvironmentChanges(std::vector<com::Utf8Str> &aEnvironmentChanges);
+    HRESULT setEnvironmentChanges(const std::vector<com::Utf8Str> &aEnvironmentChanges);
+    HRESULT getEnvironmentBase(std::vector<com::Utf8Str> &aEnvironmentBase);
+    HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses);
+    HRESULT getPathStyle(PathStyle_T *aPathStyle);
+    HRESULT getCurrentDirectory(com::Utf8Str &aCurrentDirectory);
+    HRESULT setCurrentDirectory(const com::Utf8Str &aCurrentDirectory);
+    HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories);
+    HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles);
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
     /** @}  */
 
-    /** @name IGuestSession methods.
+    /** Wrapped @name IGuestSession methods.
      * @{ */
-    STDMETHOD(Close)(void);
-    STDMETHOD(CopyFrom)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(CopyFileFlag_T, aFlags), IProgress **aProgress);
-    STDMETHOD(CopyTo)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(CopyFileFlag_T, aFlags), IProgress **aProgress);
-    STDMETHOD(DirectoryCreate)(IN_BSTR aPath, ULONG aMode, ComSafeArrayIn(DirectoryCreateFlag_T, aFlags));
-    STDMETHOD(DirectoryCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, BSTR *aDirectory);
-    STDMETHOD(DirectoryExists)(IN_BSTR aPath, BOOL *aExists);
-    STDMETHOD(DirectoryOpen)(IN_BSTR aPath, IN_BSTR aFilter, ComSafeArrayIn(DirectoryOpenFlag_T, aFlags), IGuestDirectory **aDirectory);
-    STDMETHOD(DirectoryQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
-    STDMETHOD(DirectoryRemove)(IN_BSTR aPath);
-    STDMETHOD(DirectoryRemoveRecursive)(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress);
-    STDMETHOD(DirectoryRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
-    STDMETHOD(DirectorySetACL)(IN_BSTR aPath, IN_BSTR aACL);
-    STDMETHOD(EnvironmentClear)(void);
-    STDMETHOD(EnvironmentGet)(IN_BSTR aName, BSTR *aValue);
-    STDMETHOD(EnvironmentSet)(IN_BSTR aName, IN_BSTR aValue);
-    STDMETHOD(EnvironmentUnset)(IN_BSTR aName);
-    STDMETHOD(FileCreateTemp)(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, IGuestFile **aFile);
-    STDMETHOD(FileExists)(IN_BSTR aPath, BOOL *aExists);
-    STDMETHOD(FileRemove)(IN_BSTR aPath);
-    STDMETHOD(FileOpen)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, IGuestFile **aFile);
-    STDMETHOD(FileOpenEx)(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, IN_BSTR aSharingMode, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile);
-    STDMETHOD(FileQueryInfo)(IN_BSTR aPath, IGuestFsObjInfo **aInfo);
-    STDMETHOD(FileQuerySize)(IN_BSTR aPath, LONG64 *aSize);
-    STDMETHOD(FileRename)(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags));
-    STDMETHOD(FileSetACL)(IN_BSTR aPath, IN_BSTR aACL);
-    STDMETHOD(ProcessCreate)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
-                             ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **aProcess);
-    STDMETHOD(ProcessCreateEx)(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
-                               ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
-                               ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
-                               IGuestProcess **aProcess);
-    STDMETHOD(ProcessGet)(ULONG aPID, IGuestProcess **aProcess);
-    STDMETHOD(SymlinkCreate)(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType);
-    STDMETHOD(SymlinkExists)(IN_BSTR aSymlink, BOOL *aExists);
-    STDMETHOD(SymlinkRead)(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget);
-    STDMETHOD(SymlinkRemoveDirectory)(IN_BSTR aPath);
-    STDMETHOD(SymlinkRemoveFile)(IN_BSTR aFile);
-    STDMETHOD(WaitFor)(ULONG aWaitFlags, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason);
-    STDMETHOD(WaitForArray)(ComSafeArrayIn(GuestSessionWaitForFlag_T, aFlags), ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason);
+    HRESULT close();
+
+    HRESULT directoryCopy(const com::Utf8Str &aSource,
+                          const com::Utf8Str &aDestination,
+                          const std::vector<DirectoryCopyFlags_T> &aFlags,
+                          ComPtr<IProgress> &aProgress);
+    HRESULT directoryCopyFromGuest(const com::Utf8Str &aSource,
+                                   const com::Utf8Str &aDestination,
+                                   const std::vector<DirectoryCopyFlags_T> &aFlags,
+                                   ComPtr<IProgress> &aProgress);
+    HRESULT directoryCopyToGuest(const com::Utf8Str &aSource,
+                                 const com::Utf8Str &aDestination,
+                                 const std::vector<DirectoryCopyFlags_T> &aFlags,
+                                 ComPtr<IProgress> &aProgress);
+    HRESULT directoryCreate(const com::Utf8Str &aPath,
+                            ULONG aMode,
+                            const std::vector<DirectoryCreateFlag_T> &aFlags);
+    HRESULT directoryCreateTemp(const com::Utf8Str &aTemplateName,
+                                ULONG aMode,
+                                const com::Utf8Str &aPath,
+                                BOOL aSecure,
+                                com::Utf8Str &aDirectory);
+    HRESULT directoryExists(const com::Utf8Str &aPath,
+                            BOOL aFollowSymlinks,
+                            BOOL *aExists);
+    HRESULT directoryOpen(const com::Utf8Str &aPath,
+                          const com::Utf8Str &aFilter,
+                          const std::vector<DirectoryOpenFlag_T> &aFlags,
+                          ComPtr<IGuestDirectory> &aDirectory);
+    HRESULT directoryRemove(const com::Utf8Str &aPath);
+    HRESULT directoryRemoveRecursive(const com::Utf8Str &aPath,
+                                     const std::vector<DirectoryRemoveRecFlag_T> &aFlags,
+                                     ComPtr<IProgress> &aProgress);
+    HRESULT environmentScheduleSet(const com::Utf8Str &aName,
+                                   const com::Utf8Str &aValue);
+    HRESULT environmentScheduleUnset(const com::Utf8Str &aName);
+    HRESULT environmentGetBaseVariable(const com::Utf8Str &aName,
+                                       com::Utf8Str &aValue);
+    HRESULT environmentDoesBaseVariableExist(const com::Utf8Str &aName,
+                                             BOOL *aExists);
+
+    HRESULT fileCopy(const com::Utf8Str &aSource,
+                     const com::Utf8Str &aDestination,
+                     const std::vector<FileCopyFlag_T> &aFlags,
+                     ComPtr<IProgress> &aProgress);
+    HRESULT fileCopyToGuest(const com::Utf8Str &aSource,
+                            const com::Utf8Str &aDestination,
+                            const std::vector<FileCopyFlag_T> &aFlags,
+                            ComPtr<IProgress> &aProgress);
+    HRESULT fileCopyFromGuest(const com::Utf8Str &aSource,
+                              const com::Utf8Str &aDestination,
+                              const std::vector<FileCopyFlag_T> &aFlags,
+                              ComPtr<IProgress> &aProgress);
+    HRESULT fileCreateTemp(const com::Utf8Str &aTemplateName,
+                           ULONG aMode,
+                           const com::Utf8Str &aPath,
+                           BOOL aSecure,
+                           ComPtr<IGuestFile> &aFile);
+    HRESULT fileExists(const com::Utf8Str &aPath,
+                       BOOL aFollowSymlinks,
+                       BOOL *aExists);
+    HRESULT fileOpen(const com::Utf8Str &aPath,
+                     FileAccessMode_T aAccessMode,
+                     FileOpenAction_T aOpenAction,
+                     ULONG aCreationMode,
+                     ComPtr<IGuestFile> &aFile);
+    HRESULT fileOpenEx(const com::Utf8Str &aPath,
+                       FileAccessMode_T aAccessMode,
+                       FileOpenAction_T aOpenAction,
+                       FileSharingMode_T aSharingMode,
+                       ULONG aCreationMode,
+                       const std::vector<FileOpenExFlags_T> &aFlags,
+                       ComPtr<IGuestFile> &aFile);
+    HRESULT fileQuerySize(const com::Utf8Str &aPath,
+                          BOOL aFollowSymlinks,
+                          LONG64 *aSize);
+    HRESULT fsObjExists(const com::Utf8Str &aPath,
+                        BOOL aFollowSymlinks,
+                        BOOL *pfExists);
+    HRESULT fsObjQueryInfo(const com::Utf8Str &aPath,
+                           BOOL aFollowSymlinks,
+                           ComPtr<IGuestFsObjInfo> &aInfo);
+    HRESULT fsObjRemove(const com::Utf8Str &aPath);
+    HRESULT fsObjRename(const com::Utf8Str &aOldPath,
+                        const com::Utf8Str &aNewPath,
+                        const std::vector<FsObjRenameFlag_T> &aFlags);
+    HRESULT fsObjMove(const com::Utf8Str &aSource,
+                      const com::Utf8Str &aDestination,
+                      const std::vector<FsObjMoveFlags_T> &aFlags,
+                      ComPtr<IProgress> &aProgress);
+    HRESULT fsObjSetACL(const com::Utf8Str &aPath,
+                        BOOL aFollowSymlinks,
+                        const com::Utf8Str &aAcl,
+                        ULONG aMode);
+    HRESULT processCreate(const com::Utf8Str &aCommand,
+                          const std::vector<com::Utf8Str> &aArguments,
+                          const std::vector<com::Utf8Str> &aEnvironment,
+                          const std::vector<ProcessCreateFlag_T> &aFlags,
+                          ULONG aTimeoutMS,
+                          ComPtr<IGuestProcess> &aGuestProcess);
+    HRESULT processCreateEx(const com::Utf8Str &aCommand,
+                            const std::vector<com::Utf8Str> &aArguments,
+                            const std::vector<com::Utf8Str> &aEnvironment,
+                            const std::vector<ProcessCreateFlag_T> &aFlags,
+                            ULONG aTimeoutMS,
+                            ProcessPriority_T aPriority,
+                            const std::vector<LONG> &aAffinity,
+                            ComPtr<IGuestProcess> &aGuestProcess);
+    HRESULT processGet(ULONG aPid,
+                       ComPtr<IGuestProcess> &aGuestProcess);
+    HRESULT symlinkCreate(const com::Utf8Str &aSource,
+                          const com::Utf8Str &aTarget,
+                          SymlinkType_T aType);
+    HRESULT symlinkExists(const com::Utf8Str &aSymlink,
+                          BOOL *aExists);
+    HRESULT symlinkRead(const com::Utf8Str &aSymlink,
+                        const std::vector<SymlinkReadFlag_T> &aFlags,
+                        com::Utf8Str &aTarget);
+    HRESULT waitFor(ULONG aWaitFor,
+                    ULONG aTimeoutMS,
+                    GuestSessionWaitResult_T *aReason);
+    HRESULT waitForArray(const std::vector<GuestSessionWaitForFlag_T> &aWaitFor,
+                         ULONG aTimeoutMS,
+                         GuestSessionWaitResult_T *aReason);
     /** @}  */
 
-private:
-
     /** Map of guest directories. The key specifies the internal directory ID. */
     typedef std::map <uint32_t, ComObjPtr<GuestDirectory> > SessionDirectories;
     /** Map of guest files. The key specifies the internal file ID. */
@@ -336,55 +417,60 @@ private:
 
 public:
     /** @name Public internal methods.
+     * @todo r=bird: Most of these are public for no real reason...
      * @{ */
-    int                     closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc);
-    inline bool             directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
-    int                     directoryRemoveFromList(GuestDirectory *pDirectory);
-    int                     directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags, int *pGuestRc);
-    int                     directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
-    int                     objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName, int *pGuestRc);
-    int                     directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo, ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc);
-    int                     directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
-    int                     dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    int                     dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    int                     dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    int                     dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    int                     dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
-    inline bool             fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
-    int                     fileRemoveFromList(GuestFile *pFile);
-    int                     fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc);
-    int                     fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
-    int                     fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
-    int                     fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc);
-    int                     fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
-    const GuestCredentials &getCredentials(void);
-    const GuestEnvironment &getEnvironment(void);
-    EventSource            *getEventSource(void) { return mEventSource; }
-    Utf8Str                 getName(void);
-    ULONG                   getId(void) { return mData.mSession.mID; }
-    static Utf8Str          guestErrorToString(int guestRc);
-    HRESULT                 isReadyExternal(void);
-    int                     onRemove(void);
-    int                     onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
-    int                     startSessionInternal(int *pGuestRc);
-    int                     startSessionAsync(void);
+    int                     i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc);
+    inline bool             i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
+    int                     i_directoryRemoveFromList(GuestDirectory *pDirectory);
+    int                     i_directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags, int *pGuestRc);
+    int                     i_directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
+    int                     i_objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory,
+                                                       Utf8Str &strName, int *pGuestRc);
+    int                     i_directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
+                                                    ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc);
+    int                     i_directoryQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
+    int                     i_dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    int                     i_dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    int                     i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    int                     i_dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    int                     i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
+    inline bool             i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
+    int                     i_fileRemoveFromList(GuestFile *pFile);
+    int                     i_fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc);
+    int                     i_fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
+    int                     i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
+    int                     i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc);
+    int                     i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
+    const GuestCredentials &i_getCredentials(void);
+    EventSource            *i_getEventSource(void) { return mEventSource; }
+    Utf8Str                 i_getName(void);
+    ULONG                   i_getId(void) { return mData.mSession.mID; }
+    static Utf8Str          i_guestErrorToString(int guestRc);
+    HRESULT                 i_isReadyExternal(void);
+    int                     i_onRemove(void);
+    int                     i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
+    int                     i_startSessionInternal(int *pGuestRc);
+    int                     i_startSessionAsync(void);
     static DECLCALLBACK(int)
-                            startSessionThread(RTTHREAD Thread, void *pvUser);
-    Guest                  *getParent(void) { return mParent; }
-    uint32_t                getProtocolVersion(void) { return mData.mProtocolVersion; }
-    int                     pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pGuestRc);
-    int                     processRemoveFromList(GuestProcess *pProcess);
-    int                     processCreateExInteral(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
-    inline bool             processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
-    inline int              processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
-    int                     sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms);
-    static HRESULT          setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
-    int                     setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc);
-    int                     signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */);
-    int                     startTaskAsync(const Utf8Str &strTaskDesc, GuestSessionTask *pTask, ComObjPtr<Progress> &pProgress);
-    int                     queryInfo(void);
-    int                     waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
-    int                     waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS, GuestSessionStatus_T *pSessionStatus, int *pGuestRc);
+                            i_startSessionThread(RTTHREAD Thread, void *pvUser);
+    Guest                  *i_getParent(void) { return mParent; }
+    uint32_t                i_getProtocolVersion(void) { return mData.mProtocolVersion; }
+    int                     i_pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags,
+                                                 int *pGuestRc);
+    int                     i_processRemoveFromList(GuestProcess *pProcess);
+    int                     i_processCreateExInternal(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
+    inline bool             i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
+    inline int              i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
+    int                     i_sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms);
+    static HRESULT          i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
+    int                     i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc);
+    int                     i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */);
+    int                     i_startTaskAsync(const Utf8Str &strTaskDesc, GuestSessionTask *pTask,
+                                             ComObjPtr<Progress> &pProgress);
+    int                     i_determineProtocolVersion(void);
+    int                     i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
+    int                     i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
+                                                  GuestSessionStatus_T *pSessionStatus, int *pGuestRc);
     /** @}  */
 
 private:
@@ -410,9 +496,13 @@ private:
         GuestSessionStartupInfo     mSession;
         /** The session's current status. */
         GuestSessionStatus_T        mStatus;
-        /** The session's environment block. Can be
-         *  overwritten/extended by ProcessCreate(Ex). */
-        GuestEnvironment            mEnvironment;
+        /** The set of environment changes for the session for use when
+         *  creating new guest processes. */
+        GuestEnvironmentChanges     mEnvironmentChanges;
+        /** Pointer to the immutable base environment for the session.
+         * @note This is not allocated until the guest reports it to the host. It is
+         *       also shared with child processes. */
+        GuestEnvironment const     *mpBaseEnvironment;
         /** Directory objects bound to this session. */
         SessionDirectories          mDirectories;
         /** File objects bound to this session. */
@@ -431,6 +521,32 @@ private:
         /** The last returned session status
          *  returned from the guest side. */
         int                         mRC;
+
+        Data(void)
+            : mpBaseEnvironment(NULL)
+        { }
+        Data(const Data &rThat)
+            : mCredentials(rThat.mCredentials)
+            , mSession(rThat.mSession)
+            , mStatus(rThat.mStatus)
+            , mEnvironmentChanges(rThat.mEnvironmentChanges)
+            , mpBaseEnvironment(NULL)
+            , mDirectories(rThat.mDirectories)
+            , mFiles(rThat.mFiles)
+            , mProcesses(rThat.mProcesses)
+            , mProtocolVersion(rThat.mProtocolVersion)
+            , mTimeout(rThat.mTimeout)
+            , mNumObjects(rThat.mNumObjects)
+            , mRC(rThat.mRC)
+        { }
+        ~Data(void)
+        {
+            if (mpBaseEnvironment)
+            {
+                mpBaseEnvironment->releaseConst();
+                mpBaseEnvironment = NULL;
+            }
+        }
     } mData;
 };
 
diff --git a/src/VBox/Main/include/HGCM.h b/src/VBox/Main/include/HGCM.h
index acf1528..d7348d6 100644
--- a/src/VBox/Main/include/HGCM.h
+++ b/src/VBox/Main/include/HGCM.h
@@ -1,3 +1,4 @@
+/* $Id: HGCM.h $ */
 /** @file
  * HGCM - Host-Guest Communication Manager.
  */
diff --git a/src/VBox/Main/include/HGCMObjects.h b/src/VBox/Main/include/HGCMObjects.h
index 27c9c96..b6ea9a9 100644
--- a/src/VBox/Main/include/HGCMObjects.h
+++ b/src/VBox/Main/include/HGCMObjects.h
@@ -1,3 +1,4 @@
+/* $Id: HGCMObjects.h $ */
 /** @file
  *
  * HGCMObjects - Host-Guest Communication Manager objects header.
diff --git a/src/VBox/Main/include/HGCMThread.h b/src/VBox/Main/include/HGCMThread.h
index ab0abcc..f50ad1a 100644
--- a/src/VBox/Main/include/HGCMThread.h
+++ b/src/VBox/Main/include/HGCMThread.h
@@ -1,3 +1,4 @@
+/* $Id: HGCMThread.h $ */
 /** @file
  * HGCMThread - Host-Guest Communication Manager worker threads header.
  */
diff --git a/src/VBox/Main/include/HostImpl.h b/src/VBox/Main/include/HostImpl.h
index d5815a4..6d106a2 100644
--- a/src/VBox/Main/include/HostImpl.h
+++ b/src/VBox/Main/include/HostImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,7 +18,7 @@
 #ifndef ____H_HOSTIMPL
 #define ____H_HOSTIMPL
 
-#include "VirtualBoxBase.h"
+#include "HostWrap.h"
 
 class HostUSBDeviceFilter;
 class USBProxyService;
@@ -34,19 +34,11 @@ namespace settings
 #include <list>
 
 class ATL_NO_VTABLE Host :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IHost)
+    public HostWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Host, IHost)
 
-    DECLARE_NOT_AGGREGATABLE(Host)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Host)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IHost)
-    END_COM_MAP()
+    DECLARE_EMPTY_CTOR_DTOR(Host)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -55,48 +47,6 @@ public:
     HRESULT init(VirtualBox *aParent);
     void uninit();
 
-    // IHost properties
-    STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut(IMedium *, drives));
-    STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut(IMedium *, drives));
-    STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices));
-    STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut(IHostUSBDeviceFilter *, aUSBDeviceFilters));
-    STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces));
-    STDMETHOD(COMGETTER(NameServers))(ComSafeArrayOut(BSTR, aNameServers));
-    STDMETHOD(COMGETTER(DomainName))(BSTR *aDomainName);
-    STDMETHOD(COMGETTER(SearchStrings))(ComSafeArrayOut(BSTR, aSearchStrings));
-    STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
-    STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
-    STDMETHOD(COMGETTER(ProcessorCoreCount))(ULONG *count);
-    STDMETHOD(COMGETTER(ProcessorOnlineCoreCount))(ULONG *count);
-    STDMETHOD(GetProcessorSpeed)(ULONG cpuId, ULONG *speed);
-    STDMETHOD(GetProcessorDescription)(ULONG cpuId, BSTR *description);
-    STDMETHOD(GetProcessorFeature)(ProcessorFeature_T feature, BOOL *supported);
-    STDMETHOD(GetProcessorCPUIDLeaf)(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf, ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX);
-    STDMETHOD(COMGETTER(MemorySize))(ULONG *size);
-    STDMETHOD(COMGETTER(MemoryAvailable))(ULONG *available);
-    STDMETHOD(COMGETTER(OperatingSystem))(BSTR *os);
-    STDMETHOD(COMGETTER(OSVersion))(BSTR *version);
-    STDMETHOD(COMGETTER(UTCTime))(LONG64 *aUTCTime);
-    STDMETHOD(COMGETTER(Acceleration3DAvailable))(BOOL *aSupported);
-    STDMETHOD(COMGETTER(VideoInputDevices))(ComSafeArrayOut(IHostVideoInputDevice*, aVideoInputDevices));
-
-    // IHost methods
-    STDMETHOD(CreateHostOnlyNetworkInterface)(IHostNetworkInterface **aHostNetworkInterface,
-                                              IProgress **aProgress);
-    STDMETHOD(RemoveHostOnlyNetworkInterface)(IN_BSTR aId, IProgress **aProgress);
-    STDMETHOD(CreateUSBDeviceFilter)(IN_BSTR aName, IHostUSBDeviceFilter **aFilter);
-    STDMETHOD(InsertUSBDeviceFilter)(ULONG aPosition, IHostUSBDeviceFilter *aFilter);
-    STDMETHOD(RemoveUSBDeviceFilter)(ULONG aPosition);
-
-    STDMETHOD(FindHostDVDDrive)(IN_BSTR aName, IMedium **aDrive);
-    STDMETHOD(FindHostFloppyDrive)(IN_BSTR aName, IMedium **aDrive);
-    STDMETHOD(FindHostNetworkInterfaceByName)(IN_BSTR aName, IHostNetworkInterface **networkInterface);
-    STDMETHOD(FindHostNetworkInterfaceById)(IN_BSTR id, IHostNetworkInterface **networkInterface);
-    STDMETHOD(FindHostNetworkInterfacesOfType)(HostNetworkInterfaceType_T type, ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces));
-    STDMETHOD(FindUSBDeviceByAddress)(IN_BSTR aAddress, IHostUSBDevice **aDevice);
-    STDMETHOD(FindUSBDeviceById)(IN_BSTR aId, IHostUSBDevice **aDevice);
-    STDMETHOD(GenerateMACAddress)(BSTR *aAddress);
-
     // public methods only for internal purposes
 
     /**
@@ -108,59 +58,121 @@ public:
         return LOCKCLASS_HOSTOBJECT;
     }
 
-    HRESULT loadSettings(const settings::Host &data);
-    HRESULT saveSettings(settings::Host &data);
+    HRESULT i_loadSettings(const settings::Host &data);
+    HRESULT i_saveSettings(settings::Host &data);
 
-    HRESULT getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll, AutoWriteLock &treeLock);
-    HRESULT findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr<Medium> &pMedium);
-    HRESULT findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr<Medium> &pMedium);
+    HRESULT i_getDrives(DeviceType_T mediumType, bool fRefresh, MediaList *&pll, AutoWriteLock &treeLock);
+    HRESULT i_findHostDriveById(DeviceType_T mediumType, const Guid &uuid, bool fRefresh, ComObjPtr<Medium> &pMedium);
+    HRESULT i_findHostDriveByName(DeviceType_T mediumType, const Utf8Str &strLocationFull, bool fRefresh, ComObjPtr<Medium> &pMedium);
 
 #ifdef VBOX_WITH_USB
     typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
 
     /** Must be called from under this object's lock. */
-    USBProxyService* usbProxyService();
+    USBProxyService* i_usbProxyService();
 
-    HRESULT addChild(HostUSBDeviceFilter *pChild);
-    HRESULT removeChild(HostUSBDeviceFilter *pChild);
-    VirtualBox* parent();
+    HRESULT i_addChild(HostUSBDeviceFilter *pChild);
+    HRESULT i_removeChild(HostUSBDeviceFilter *pChild);
+    VirtualBox* i_parent();
 
-    HRESULT onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
-    void getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
-    HRESULT checkUSBProxyService();
+    HRESULT i_onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter, BOOL aActiveChanged = FALSE);
+    void i_getUSBFilters(USBDeviceFilterList *aGlobalFiltes);
+    HRESULT i_checkUSBProxyService();
 #endif /* !VBOX_WITH_USB */
 
-    static void generateMACAddress(Utf8Str &mac);
+    static void i_generateMACAddress(Utf8Str &mac);
 
 private:
 
-    HRESULT buildDVDDrivesList(MediaList &list);
-    HRESULT buildFloppyDrivesList(MediaList &list);
-    HRESULT findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
+    // wrapped IHost properties
+    HRESULT getDVDDrives(std::vector<ComPtr<IMedium> > &aDVDDrives);
+    HRESULT getFloppyDrives(std::vector<ComPtr<IMedium> > &aFloppyDrives);
+    HRESULT getUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
+    HRESULT getUSBDeviceFilters(std::vector<ComPtr<IHostUSBDeviceFilter> > &aUSBDeviceFilters);
+    HRESULT getNetworkInterfaces(std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
+    HRESULT getNameServers(std::vector<com::Utf8Str> &aNameServers);
+    HRESULT getDomainName(com::Utf8Str &aDomainName);
+    HRESULT getSearchStrings(std::vector<com::Utf8Str> &aSearchStrings);
+    HRESULT getProcessorCount(ULONG *aProcessorCount);
+    HRESULT getProcessorOnlineCount(ULONG *aProcessorOnlineCount);
+    HRESULT getProcessorCoreCount(ULONG *aProcessorCoreCount);
+    HRESULT getProcessorOnlineCoreCount(ULONG *aProcessorOnlineCoreCount);
+    HRESULT getMemorySize(ULONG *aMemorySize);
+    HRESULT getMemoryAvailable(ULONG *aMemoryAvailable);
+    HRESULT getOperatingSystem(com::Utf8Str &aOperatingSystem);
+    HRESULT getOSVersion(com::Utf8Str &aOSVersion);
+    HRESULT getUTCTime(LONG64 *aUTCTime);
+    HRESULT getAcceleration3DAvailable(BOOL *aAcceleration3DAvailable);
+    HRESULT getVideoInputDevices(std::vector<ComPtr<IHostVideoInputDevice> > &aVideoInputDevices);
+
+    // wrapped IHost methods
+    HRESULT getProcessorSpeed(ULONG aCpuId,
+                              ULONG *aSpeed);
+    HRESULT getProcessorFeature(ProcessorFeature_T aFeature,
+                                BOOL *aSupported);
+    HRESULT getProcessorDescription(ULONG aCpuId,
+                                    com::Utf8Str &aDescription);
+    HRESULT getProcessorCPUIDLeaf(ULONG aCpuId,
+                                  ULONG aLeaf,
+                                  ULONG aSubLeaf,
+                                  ULONG *aValEax,
+                                  ULONG *aValEbx,
+                                  ULONG *aValEcx,
+                                  ULONG *aValEdx);
+    HRESULT createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
+                                           ComPtr<IProgress> &aProgress);
+    HRESULT removeHostOnlyNetworkInterface(const com::Guid &aId,
+                                           ComPtr<IProgress> &aProgress);
+    HRESULT createUSBDeviceFilter(const com::Utf8Str &aName,
+                                  ComPtr<IHostUSBDeviceFilter> &aFilter);
+    HRESULT insertUSBDeviceFilter(ULONG aPosition,
+                                  const ComPtr<IHostUSBDeviceFilter> &aFilter);
+    HRESULT removeUSBDeviceFilter(ULONG aPosition);
+    HRESULT findHostDVDDrive(const com::Utf8Str &aName,
+                             ComPtr<IMedium> &aDrive);
+    HRESULT findHostFloppyDrive(const com::Utf8Str &aName,
+                                ComPtr<IMedium> &aDrive);
+    HRESULT findHostNetworkInterfaceByName(const com::Utf8Str &aName,
+                                           ComPtr<IHostNetworkInterface> &aNetworkInterface);
+    HRESULT findHostNetworkInterfaceById(const com::Guid &aId,
+                                         ComPtr<IHostNetworkInterface> &aNetworkInterface);
+    HRESULT findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
+                                            std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces);
+    HRESULT findUSBDeviceById(const com::Guid &aId,
+                              ComPtr<IHostUSBDevice> &aDevice);
+    HRESULT findUSBDeviceByAddress(const com::Utf8Str &aName,
+                                   ComPtr<IHostUSBDevice> &aDevice);
+    HRESULT generateMACAddress(com::Utf8Str &aAddress);
+
+    // Internal Methods.
+
+    HRESULT i_buildDVDDrivesList(MediaList &list);
+    HRESULT i_buildFloppyDrivesList(MediaList &list);
+    HRESULT i_findHostDriveByNameOrId(DeviceType_T mediumType, const Utf8Str &strNameOrId, ComObjPtr<Medium> &pMedium);
 
 #if defined(RT_OS_SOLARIS) && defined(VBOX_USE_LIBHAL)
-    bool getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
-    bool getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
+    bool i_getDVDInfoFromHal(std::list< ComObjPtr<Medium> > &list);
+    bool i_getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list);
 #endif
 
 #if defined(RT_OS_SOLARIS)
-    void getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
-    void parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
-    bool validateDevice(const char *deviceNode, bool isCDROM);
+    void i_getDVDInfoFromDevTree(std::list< ComObjPtr<Medium> > &list);
+    void i_parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list);
+    bool i_validateDevice(const char *deviceNode, bool isCDROM);
 #endif
 
-    HRESULT updateNetIfList();
+    HRESULT i_updateNetIfList();
 
 #ifndef RT_OS_WINDOWS
-    HRESULT parseResolvConf();
+    HRESULT i_parseResolvConf();
 #else
-    HRESULT fetchNameResolvingInformation();
+    HRESULT i_fetchNameResolvingInformation();
 #endif
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
-    void registerMetrics(PerformanceCollector *aCollector);
-    void registerDiskMetrics(PerformanceCollector *aCollector);
-    void unregisterMetrics(PerformanceCollector *aCollector);
+    void i_registerMetrics(PerformanceCollector *aCollector);
+    void i_registerDiskMetrics(PerformanceCollector *aCollector);
+    void i_unregisterMetrics(PerformanceCollector *aCollector);
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
 
     struct Data;        // opaque data structure, defined in HostImpl.cpp
diff --git a/src/VBox/Main/include/HostNetworkInterfaceImpl.h b/src/VBox/Main/include/HostNetworkInterfaceImpl.h
index 4055d1e..6a9efcb 100644
--- a/src/VBox/Main/include/HostNetworkInterfaceImpl.h
+++ b/src/VBox/Main/include/HostNetworkInterfaceImpl.h
@@ -20,31 +20,19 @@
 #ifndef ____H_HOSTNETWORKINTERFACEIMPL
 #define ____H_HOSTNETWORKINTERFACEIMPL
 
-#include "VirtualBoxBase.h"
-#include "VirtualBoxImpl.h"
+#include "HostNetworkInterfaceWrap.h"
 
 #ifdef VBOX_WITH_HOSTNETIF_API
-/* class HostNetworkInterface; */
-/* #include "netif.h" */
 struct NETIFINFO;
 #endif
 
+class PerformanceCollector;
+
 class ATL_NO_VTABLE HostNetworkInterface :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IHostNetworkInterface)
+    public HostNetworkInterfaceWrap
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(HostNetworkInterface, IHostNetworkInterface)
-
-    DECLARE_NOT_AGGREGATABLE(HostNetworkInterface)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(HostNetworkInterface)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IHostNetworkInterface)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR(HostNetworkInterface)
 
     HRESULT FinalConstruct();
@@ -57,35 +45,40 @@ public:
     HRESULT updateConfig();
 #endif
 
-    // IHostNetworkInterface properties
-    STDMETHOD(COMGETTER(Name))(BSTR *aInterfaceName);
-    STDMETHOD(COMGETTER(ShortName))(BSTR *aShortName);
-    STDMETHOD(COMGETTER(Id))(BSTR *aGuid);
-    STDMETHOD(COMGETTER(DHCPEnabled))(BOOL *aDHCPEnabled);
-    STDMETHOD(COMGETTER(IPAddress))(BSTR *aIPAddress);
-    STDMETHOD(COMGETTER(NetworkMask))(BSTR *aNetworkMask);
-    STDMETHOD(COMGETTER(IPV6Supported))(BOOL *aIPV6Supported);
-    STDMETHOD(COMGETTER(IPV6Address))(BSTR *aIPV6Address);
-    STDMETHOD(COMGETTER(IPV6NetworkMaskPrefixLength))(ULONG *aIPV6NetworkMaskPrefixLength);
-    STDMETHOD(COMGETTER(HardwareAddress))(BSTR *aHardwareAddress);
-    STDMETHOD(COMGETTER(MediumType))(HostNetworkInterfaceMediumType_T *aType);
-    STDMETHOD(COMGETTER(Status))(HostNetworkInterfaceStatus_T *aStatus);
-    STDMETHOD(COMGETTER(InterfaceType))(HostNetworkInterfaceType_T *aType);
-    STDMETHOD(COMGETTER(NetworkName))(BSTR *aNetworkName);
-
-    STDMETHOD(EnableStaticIPConfig)(IN_BSTR aIPAddress, IN_BSTR aNetworkMask);
-    STDMETHOD(EnableStaticIPConfigV6)(IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength);
-    STDMETHOD(EnableDynamicIPConfig)();
-    STDMETHOD(DHCPRediscover)();
-
-    HRESULT setVirtualBox(VirtualBox *pVBox);
+    HRESULT i_setVirtualBox(VirtualBox *pVirtualBox);
+
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
-    void registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
-    void unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
+    void i_registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
+    void i_unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr);
 #endif
 
 private:
-    Bstr composeNetworkName(const Utf8Str szShortName);
+
+    // Wrapped IHostNetworkInterface properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getShortName(com::Utf8Str &aShortName);
+    HRESULT getId(com::Guid &aGuiId);
+    HRESULT getDHCPEnabled(BOOL *aDHCPEnabled);
+    HRESULT getIPAddress(com::Utf8Str &aIPAddress);
+    HRESULT getNetworkMask(com::Utf8Str &aNetworkMask);
+    HRESULT getIPV6Supported(BOOL *aIPV6Supported);
+    HRESULT getIPV6Address(com::Utf8Str &aIPV6Address);
+    HRESULT getIPV6NetworkMaskPrefixLength(ULONG *aIPV6NetworkMaskPrefixLength);
+    HRESULT getHardwareAddress(com::Utf8Str &aHardwareAddress);
+    HRESULT getMediumType(HostNetworkInterfaceMediumType_T *aType);
+    HRESULT getStatus(HostNetworkInterfaceStatus_T *aStatus);
+    HRESULT getInterfaceType(HostNetworkInterfaceType_T *aType);
+    HRESULT getNetworkName(com::Utf8Str &aNetworkName);
+
+    // Wrapped IHostNetworkInterface methods
+    HRESULT enableStaticIPConfig(const com::Utf8Str &aIPAddress,
+                                 const com::Utf8Str &aNetworkMask);
+    HRESULT enableStaticIPConfigV6(const com::Utf8Str &aIPV6Address,
+                                   ULONG aIPV6NetworkMaskPrefixLength);
+    HRESULT enableDynamicIPConfig();
+    HRESULT dHCPRediscover();
+
+    Bstr i_composeNetworkName(const Utf8Str szShortName);
 
     const Bstr mInterfaceName;
     const Guid mGuid;
@@ -93,7 +86,7 @@ private:
     const Bstr mShortName;
     HostNetworkInterfaceType_T mIfType;
 
-    VirtualBox * const  mVBox;
+    VirtualBox * const  mVirtualBox;
 
     struct Data
     {
diff --git a/src/VBox/Main/include/HostPower.h b/src/VBox/Main/include/HostPower.h
index c7774c3..6f28873 100644
--- a/src/VBox/Main/include/HostPower.h
+++ b/src/VBox/Main/include/HostPower.h
@@ -1,3 +1,4 @@
+/* $Id: HostPower.h $ */
 /** @file
  *
  * VirtualBox interface to host's power notification service
@@ -22,6 +23,10 @@
 
 #include <vector>
 
+#ifdef RT_OS_LINUX
+# include <VBox/dbus.h>
+#endif
+
 #ifdef RT_OS_DARWIN
 # include <IOKit/pwr_mgt/IOPMLib.h>
 # include <Carbon/Carbon.h>
@@ -58,6 +63,29 @@ private:
     HWND        mHwnd;
     RTTHREAD    mThread;
 };
+#elif defined(RT_OS_LINUX)
+/**
+ * The Linux hosted Power Service.
+ */
+class HostPowerServiceLinux : public HostPowerService
+{
+public:
+
+    HostPowerServiceLinux(VirtualBox *aVirtualBox);
+    virtual ~HostPowerServiceLinux();
+
+private:
+
+    static DECLCALLBACK(int) powerChangeNotificationThread(RTTHREAD ThreadSelf, void *pInstance);
+
+    /* Private member vars */
+    /** Our message thread. */
+    RTTHREAD mThread;
+    /** Our (private) connection to the DBus.  Closing this will cause the
+     * message thread to exit. */
+    DBusConnection *mpConnection;
+};
+
 # elif defined(RT_OS_DARWIN) /* RT_OS_WINDOWS */
 /**
  * The Darwin hosted Power Service.
diff --git a/src/VBox/Main/include/HostUSBDeviceImpl.h b/src/VBox/Main/include/HostUSBDeviceImpl.h
index 57023e1..66aa1c2 100644
--- a/src/VBox/Main/include/HostUSBDeviceImpl.h
+++ b/src/VBox/Main/include/HostUSBDeviceImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -25,6 +25,7 @@
 
 #include <VBox/usb.h>
 #include "Logging.h"
+#include "HostUSBDeviceWrap.h"
 
 class SessionMachine;
 class USBProxyService;
@@ -168,23 +169,10 @@ typedef enum
  * Object class used to hold Host USB Device properties.
  */
 class ATL_NO_VTABLE HostUSBDevice :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IHostUSBDevice)
+    public HostUSBDeviceWrap
 {
 public:
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(HostUSBDevice, IHostUSBDevice)
-
-    DECLARE_NOT_AGGREGATABLE(HostUSBDevice)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(HostUSBDevice)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IHostUSBDevice)
-        COM_INTERFACE_ENTRY(IUSBDevice)
-    END_COM_MAP()
-
-    DECLARE_EMPTY_CTOR_DTOR (HostUSBDevice)
+    DECLARE_EMPTY_CTOR_DTOR(HostUSBDevice)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -193,36 +181,19 @@ public:
     HRESULT init(PUSBDEVICE aUsb, USBProxyService *aUSBProxyService);
     void uninit();
 
-    // IUSBDevice properties
-    STDMETHOD(COMGETTER(Id))(BSTR *aId);
-    STDMETHOD(COMGETTER(VendorId))(USHORT *aVendorId);
-    STDMETHOD(COMGETTER(ProductId))(USHORT *aProductId);
-    STDMETHOD(COMGETTER(Revision))(USHORT *aRevision);
-    STDMETHOD(COMGETTER(Manufacturer))(BSTR *aManufacturer);
-    STDMETHOD(COMGETTER(Product))(BSTR *aProduct);
-    STDMETHOD(COMGETTER(SerialNumber))(BSTR *aSerialNumber);
-    STDMETHOD(COMGETTER(Address))(BSTR *aAddress);
-    STDMETHOD(COMGETTER(Port))(USHORT *aPort);
-    STDMETHOD(COMGETTER(Version))(USHORT *aVersion);
-    STDMETHOD(COMGETTER(PortVersion))(USHORT *aPortVersion);
-    STDMETHOD(COMGETTER(Remote))(BOOL *aRemote);
-
-    // IHostUSBDevice properties
-    STDMETHOD(COMGETTER(State))(USBDeviceState_T *aState);
-
     // public methods only for internal purposes
 
     /** @note Must be called from under the object read lock. */
-    const Guid& getId() const { return mId; }
+    const Guid& i_getId() const { return mId; }
 
     /** @note Must be called from under the object read lock. */
-    HostUSBDeviceState getUnistate() const { return mUniState; }
+    HostUSBDeviceState i_getUnistate() const { return mUniState; }
 
     /** @note Must be called from under the object read lock. */
-    const char *getStateName() { return stateName (mUniState, mPendingUniState, mUniSubState); }
+    const char *i_getStateName() { return i_stateName (mUniState, mPendingUniState, mUniSubState); }
 
     /** @note Must be called from under the object read lock. */
-    bool isCapturableOrHeld()
+    bool i_isCapturableOrHeld()
     {
         return mUniState == kHostUSBDeviceState_Unused
             || mUniState == kHostUSBDeviceState_Capturable
@@ -230,47 +201,67 @@ public:
     }
 
     /** @note Must be called from under the object read lock. */
-    ComObjPtr<SessionMachine> &getMachine() { return mMachine; }
+    ComObjPtr<SessionMachine> &i_getMachine() { return mMachine; }
 
     /** @note Must be called from under the object read lock. */
-    PCUSBDEVICE getUsbData() const { return mUsb; }
+    PCUSBDEVICE i_getUsbData() const { return mUsb; }
 
-    Utf8Str getName();
+    com::Utf8Str i_getName();
 
-    HRESULT requestCaptureForVM(SessionMachine *aMachine, bool aSetError, ULONG aMaskedIfs = 0);
-    HRESULT onDetachFromVM(SessionMachine *aMachine, bool aDone, bool *aRunFilters, bool aAbnormal = false);
-    HRESULT requestReleaseToHost();
-    HRESULT requestHold();
-    bool wasActuallyDetached();
-    void onPhysicalDetached();
+    HRESULT i_requestCaptureForVM(SessionMachine *aMachine, bool aSetError,
+                                  const com::Utf8Str &aCaptureFilename, ULONG aMaskedIfs = 0);
+    HRESULT i_onDetachFromVM(SessionMachine *aMachine, bool aDone, bool *aRunFilters, bool aAbnormal = false);
+    HRESULT i_requestReleaseToHost();
+    HRESULT i_requestHold();
+    bool i_wasActuallyDetached();
+    void i_onPhysicalDetached();
 
-    bool isMatch(const USBDeviceFilter::Data &aData);
-    int compare(PCUSBDEVICE aDev2);
-    static int compare(PCUSBDEVICE aDev1, PCUSBDEVICE aDev2, bool aIsAwaitingReAttach = false);
+    bool i_isMatch(const USBDeviceFilter::Data &aData);
+    int i_compare(PCUSBDEVICE aDev2);
+    static int i_compare(PCUSBDEVICE aDev1, PCUSBDEVICE aDev2, bool aIsAwaitingReAttach = false);
 
-    bool updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMachine **aIgnoreMachine);
-    bool updateStateFake(PCUSBDEVICE aDev, bool *aRunFilters, SessionMachine **aIgnoreMachine);
+    bool i_updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMachine **aIgnoreMachine);
+    bool i_updateStateFake(PCUSBDEVICE aDev, bool *aRunFilters, SessionMachine **aIgnoreMachine);
 
-    static const char *stateName(HostUSBDeviceState aState,
-                                 HostUSBDeviceState aPendingState = kHostUSBDeviceState_Invalid,
-                                 HostUSBDeviceSubState aSubState = kHostUSBDeviceSubState_Default);
+    static const char *i_stateName(HostUSBDeviceState aState,
+                                   HostUSBDeviceState aPendingState = kHostUSBDeviceState_Invalid,
+                                   HostUSBDeviceSubState aSubState = kHostUSBDeviceSubState_Default);
 
 protected:
-    HRESULT attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs = 0);
-    void detachFromVM(HostUSBDeviceState aFinalState);
-    void onPhysicalDetachedInternal();
-    bool hasAsyncOperationTimedOut() const;
-
-    bool setState (HostUSBDeviceState aNewState, HostUSBDeviceState aNewPendingState = kHostUSBDeviceState_Invalid,
-                   HostUSBDeviceSubState aNewSubState = kHostUSBDeviceSubState_Default);
-    bool startTransition (HostUSBDeviceState aNewState, HostUSBDeviceState aFinalState,
-                          HostUSBDeviceSubState aNewSubState = kHostUSBDeviceSubState_Default);
-    bool advanceTransition(bool aSkipReAttach = false);
-    bool failTransition();
-    USBDeviceState_T canonicalState() const;
+
+    HRESULT i_attachToVM(SessionMachine *aMachine, const com::Utf8Str &aCaptureFilename, ULONG aMaskedIfs = 0);
+    void i_detachFromVM(HostUSBDeviceState aFinalState);
+    void i_onPhysicalDetachedInternal();
+    bool i_hasAsyncOperationTimedOut() const;
+
+    bool i_setState (HostUSBDeviceState aNewState, HostUSBDeviceState aNewPendingState = kHostUSBDeviceState_Invalid,
+                     HostUSBDeviceSubState aNewSubState = kHostUSBDeviceSubState_Default);
+    bool i_startTransition (HostUSBDeviceState aNewState, HostUSBDeviceState aFinalState,
+                            HostUSBDeviceSubState aNewSubState = kHostUSBDeviceSubState_Default);
+    bool i_advanceTransition(bool aSkipReAttach = false);
+    bool i_failTransition();
+    USBDeviceState_T i_canonicalState() const;
 
 private:
 
+    // wrapped IUSBDevice properties
+    HRESULT getId(com::Guid &aId);
+    HRESULT getVendorId(USHORT *aVendorId);
+    HRESULT getProductId(USHORT *aProductId);
+    HRESULT getRevision(USHORT *aRevision);
+    HRESULT getManufacturer(com::Utf8Str &aManufacturer);
+    HRESULT getProduct(com::Utf8Str &aProduct);
+    HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
+    HRESULT getAddress(com::Utf8Str &aAddress);
+    HRESULT getPort(USHORT *aPort);
+    HRESULT getVersion(USHORT *aVersion);
+    HRESULT getPortVersion(USHORT *aPortVersion);
+    HRESULT getSpeed(USBConnectionSpeed_T *aSpeed);
+    HRESULT getRemote(BOOL *aRemote);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getState(USBDeviceState_T *aState);
+
+
     const Guid mId;
 
     /** @name The state machine variables
@@ -310,6 +301,8 @@ private:
     /** The name of this device (for logging purposes).
      * This points to the string in mNameObj. */
     const char *mName;
+    /** The filename to capture the USB traffic to. */
+    com::Utf8Str mCaptureFilename;
 
     friend class USBProxyService;
 #ifdef RT_OS_SOLARIS
diff --git a/src/VBox/Main/include/KeyboardImpl.h b/src/VBox/Main/include/KeyboardImpl.h
index 71cee23..6cd7e20 100644
--- a/src/VBox/Main/include/KeyboardImpl.h
+++ b/src/VBox/Main/include/KeyboardImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,7 +18,7 @@
 #ifndef ____H_KEYBOARDIMPL
 #define ____H_KEYBOARDIMPL
 
-#include "VirtualBoxBase.h"
+#include "KeyboardWrap.h"
 #include "EventImpl.h"
 
 #include <VBox/vmm/pdmdrv.h>
@@ -32,7 +32,7 @@ class KeyboardEvent
 public:
     KeyboardEvent() : scan(-1) {}
     KeyboardEvent(int _scan) : scan(_scan) {}
-    bool isValid()
+    bool i_isValid()
     {
         return (scan & ~0x80) && !(scan & ~0xFF);
     }
@@ -41,21 +41,10 @@ public:
 class Console;
 
 class ATL_NO_VTABLE Keyboard :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IKeyboard)
+    public KeyboardWrap
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Keyboard, IKeyboard)
-
-    DECLARE_NOT_AGGREGATABLE(Keyboard)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Keyboard)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IKeyboard)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR(Keyboard)
 
     HRESULT FinalConstruct();
@@ -65,27 +54,33 @@ public:
     HRESULT init(Console *aParent);
     void uninit();
 
-    STDMETHOD(PutScancode)(LONG scancode);
-    STDMETHOD(PutScancodes)(ComSafeArrayIn(LONG, scancodes),
-                            ULONG *codesStored);
-    STDMETHOD(PutCAD)();
-
-    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
-
     static const PDMDRVREG  DrvReg;
 
-    Console *getParent() const
+    Console *i_getParent() const
     {
         return mParent;
     }
 
 private:
 
-    static DECLCALLBACK(void)   keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds);
-    static DECLCALLBACK(void)   keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive);
-    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
-    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
-    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
+    // Wrapped Keyboard properties
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+    HRESULT getKeyboardLEDs(std::vector<KeyboardLED_T> &aKeyboardLEDs);
+
+    // Wrapped Keyboard members
+    HRESULT putScancode(LONG aScancode);
+    HRESULT putScancodes(const std::vector<LONG> &aScancodes,
+                         ULONG *aCodesStored);
+    HRESULT putCAD();
+    HRESULT releaseKeys();
+
+    static DECLCALLBACK(void)   i_keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds);
+    static DECLCALLBACK(void)   i_keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive);
+    static DECLCALLBACK(void *) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
+    static DECLCALLBACK(int)    i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
+    static DECLCALLBACK(void)   i_drvDestruct(PPDMDRVINS pDrvIns);
+
+    void onKeyboardLedsChange(PDMKEYBLEDS enmLeds);
 
     Console * const         mParent;
     /** Pointer to the associated keyboard driver(s). */
@@ -95,6 +90,9 @@ private:
     /** Set after the first attempt to find the VMM Device. */
     bool                    mfVMMDevInited;
 
+    /* The current guest keyboard LED status. */
+    PDMKEYBLEDS menmLeds;
+
     const ComObjPtr<EventSource> mEventSource;
 };
 
diff --git a/src/VBox/Main/include/MachineDebuggerImpl.h b/src/VBox/Main/include/MachineDebuggerImpl.h
index ab5a6b6..13e650f 100644
--- a/src/VBox/Main/include/MachineDebuggerImpl.h
+++ b/src/VBox/Main/include/MachineDebuggerImpl.h
@@ -1,12 +1,10 @@
 /* $Id: MachineDebuggerImpl.h $ */
-
 /** @file
- *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,27 +18,17 @@
 #ifndef ____H_MACHINEDEBUGGER
 #define ____H_MACHINEDEBUGGER
 
-#include "VirtualBoxBase.h"
+#include "MachineDebuggerWrap.h"
 #include <iprt/log.h>
 #include <VBox/vmm/em.h>
 
 class Console;
 
 class ATL_NO_VTABLE MachineDebugger :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IMachineDebugger)
+    public MachineDebuggerWrap
 {
-public:
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (MachineDebugger, IMachineDebugger)
-
-    DECLARE_NOT_AGGREGATABLE (MachineDebugger)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-    BEGIN_COM_MAP(MachineDebugger)
-        VBOX_DEFAULT_INTERFACE_ENTRIES (IMachineDebugger)
-    END_COM_MAP()
+public:
 
     DECLARE_EMPTY_CTOR_DTOR (MachineDebugger)
 
@@ -51,75 +39,105 @@ public:
     HRESULT init (Console *aParent);
     void uninit();
 
-    // IMachineDebugger properties
-    STDMETHOD(COMGETTER(SingleStep))(BOOL *a_pfEnabled);
-    STDMETHOD(COMSETTER(SingleStep))(BOOL a_fEnable);
-    STDMETHOD(COMGETTER(RecompileUser))(BOOL *a_pfEnabled);
-    STDMETHOD(COMSETTER(RecompileUser))(BOOL a_fEnable);
-    STDMETHOD(COMGETTER(RecompileSupervisor))(BOOL *a_pfEnabled);
-    STDMETHOD(COMSETTER(RecompileSupervisor))(BOOL a_fEnable);
-    STDMETHOD(COMGETTER(ExecuteAllInIEM))(BOOL *a_pfEnabled);
-    STDMETHOD(COMSETTER(ExecuteAllInIEM))(BOOL a_fEnable);
-    STDMETHOD(COMGETTER(PATMEnabled))(BOOL *a_pfEnabled);
-    STDMETHOD(COMSETTER(PATMEnabled))(BOOL a_fEnable);
-    STDMETHOD(COMGETTER(CSAMEnabled))(BOOL *a_pfEnabled);
-    STDMETHOD(COMSETTER(CSAMEnabled))(BOOL a_fEnable);
-    STDMETHOD(COMGETTER(LogEnabled))(BOOL *a_pfEnabled);
-    STDMETHOD(COMSETTER(LogEnabled))(BOOL a_fEnable);
-    STDMETHOD(COMGETTER(LogDbgFlags))(BSTR *a_pbstrSettings);
-    STDMETHOD(COMGETTER(LogDbgGroups))(BSTR *a_pbstrSettings);
-    STDMETHOD(COMGETTER(LogDbgDestinations))(BSTR *a_pbstrSettings);
-    STDMETHOD(COMGETTER(LogRelFlags))(BSTR *a_pbstrSettings);
-    STDMETHOD(COMGETTER(LogRelGroups))(BSTR *a_pbstrSettings);
-    STDMETHOD(COMGETTER(LogRelDestinations))(BSTR *a_pbstrSettings);
-    STDMETHOD(COMGETTER(HWVirtExEnabled))(BOOL *a_pfEnabled);
-    STDMETHOD(COMGETTER(HWVirtExNestedPagingEnabled))(BOOL *a_pfEnabled);
-    STDMETHOD(COMGETTER(HWVirtExVPIDEnabled))(BOOL *a_pfEnabled);
-    STDMETHOD(COMGETTER(HWVirtExUXEnabled))(BOOL *a_pfEnabled);
-    STDMETHOD(COMGETTER(PAEEnabled))(BOOL *a_pfEnabled);
-    STDMETHOD(COMGETTER(OSName))(BSTR *a_pbstrName);
-    STDMETHOD(COMGETTER(OSVersion))(BSTR *a_pbstrVersion);
-    STDMETHOD(COMGETTER(VirtualTimeRate))(ULONG *a_puPct);
-    STDMETHOD(COMSETTER(VirtualTimeRate))(ULONG a_uPct);
-    STDMETHOD(COMGETTER(VM))(LONG64 *a_u64Vm);
-
-    // IMachineDebugger methods
-    STDMETHOD(DumpGuestCore)(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression);
-    STDMETHOD(DumpHostProcessCore)(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression);
-    STDMETHOD(Info)(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR *a_bstrInfo);
-    STDMETHOD(InjectNMI)();
-    STDMETHOD(ModifyLogFlags)(IN_BSTR a_bstrSettings);
-    STDMETHOD(ModifyLogGroups)(IN_BSTR a_bstrSettings);
-    STDMETHOD(ModifyLogDestinations)(IN_BSTR a_bstrSettings);
-    STDMETHOD(ReadPhysicalMemory)(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData));
-    STDMETHOD(WritePhysicalMemory)(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData));
-    STDMETHOD(ReadVirtualMemory)(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData));
-    STDMETHOD(WriteVirtualMemory)(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData));
-    STDMETHOD(DetectOS)(BSTR *a_pbstrName);
-    STDMETHOD(GetRegister)(ULONG a_idCpu, IN_BSTR a_bstrName, BSTR *a_pbstrValue);
-    STDMETHOD(GetRegisters)(ULONG a_idCpu, ComSafeArrayOut(BSTR, a_bstrNames), ComSafeArrayOut(BSTR, a_bstrValues));
-    STDMETHOD(SetRegister)(ULONG a_idCpu, IN_BSTR a_bstrName, IN_BSTR a_bstrValue);
-    STDMETHOD(SetRegisters)(ULONG a_idCpu, ComSafeArrayIn(IN_BSTR, a_bstrNames), ComSafeArrayIn(IN_BSTR, a_bstrValues));
-    STDMETHOD(DumpGuestStack)(ULONG a_idCpu, BSTR *a_pbstrStack);
-    STDMETHOD(ResetStats)(IN_BSTR aPattern);
-    STDMETHOD(DumpStats)(IN_BSTR aPattern);
-    STDMETHOD(GetStats)(IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats);
-
-
     // "public-private methods"
-    void flushQueuedSettings();
+    void i_flushQueuedSettings();
 
 private:
+
+    // wrapped IMachineDeugger properties
+    HRESULT getSingleStep(BOOL *aSingleStep);
+    HRESULT setSingleStep(BOOL aSingleStep);
+    HRESULT getRecompileUser(BOOL *aRecompileUser);
+    HRESULT setRecompileUser(BOOL aRecompileUser);
+    HRESULT getRecompileSupervisor(BOOL *aRecompileSupervisor);
+    HRESULT setRecompileSupervisor(BOOL aRecompileSupervisor);
+    HRESULT getExecuteAllInIEM(BOOL *aExecuteAllInIEM);
+    HRESULT setExecuteAllInIEM(BOOL aExecuteAllInIEM);
+    HRESULT getPATMEnabled(BOOL *aPATMEnabled);
+    HRESULT setPATMEnabled(BOOL aPATMEnabled);
+    HRESULT getCSAMEnabled(BOOL *aCSAMEnabled);
+    HRESULT setCSAMEnabled(BOOL aCSAMEnabled);
+    HRESULT getLogEnabled(BOOL *aLogEnabled);
+    HRESULT setLogEnabled(BOOL aLogEnabled);
+    HRESULT getLogDbgFlags(com::Utf8Str &aLogDbgFlags);
+    HRESULT getLogDbgGroups(com::Utf8Str &aLogDbgGroups);
+    HRESULT getLogDbgDestinations(com::Utf8Str &aLogDbgDestinations);
+    HRESULT getLogRelFlags(com::Utf8Str &aLogRelFlags);
+    HRESULT getLogRelGroups(com::Utf8Str &aLogRelGroups);
+    HRESULT getLogRelDestinations(com::Utf8Str &aLogRelDestinations);
+    HRESULT getHWVirtExEnabled(BOOL *aHWVirtExEnabled);
+    HRESULT getHWVirtExNestedPagingEnabled(BOOL *aHWVirtExNestedPagingEnabled);
+    HRESULT getHWVirtExVPIDEnabled(BOOL *aHWVirtExVPIDEnabled);
+    HRESULT getHWVirtExUXEnabled(BOOL *aHWVirtExUXEnabled);
+    HRESULT getOSName(com::Utf8Str &aOSName);
+    HRESULT getOSVersion(com::Utf8Str &aOSVersion);
+    HRESULT getPAEEnabled(BOOL *aPAEEnabled);
+    HRESULT getVirtualTimeRate(ULONG *aVirtualTimeRate);
+    HRESULT setVirtualTimeRate(ULONG aVirtualTimeRate);
+    HRESULT getVM(LONG64 *aVM);
+
+    // wrapped IMachineDeugger properties
+    HRESULT dumpGuestCore(const com::Utf8Str &aFilename,
+                          const com::Utf8Str &aCompression);
+    HRESULT dumpHostProcessCore(const com::Utf8Str &aFilename,
+                                const com::Utf8Str &aCompression);
+    HRESULT info(const com::Utf8Str &aName,
+                 const com::Utf8Str &aArgs,
+                 com::Utf8Str &aInfo);
+    HRESULT injectNMI();
+    HRESULT modifyLogGroups(const com::Utf8Str &aSettings);
+    HRESULT modifyLogFlags(const com::Utf8Str &aSettings);
+    HRESULT modifyLogDestinations(const com::Utf8Str &aSettings);
+    HRESULT readPhysicalMemory(LONG64 aAddress,
+                               ULONG aSize,
+                               std::vector<BYTE> &aBytes);
+    HRESULT writePhysicalMemory(LONG64 aAddress,
+                                ULONG aSize,
+                                const std::vector<BYTE> &aBytes);
+    HRESULT readVirtualMemory(ULONG aCpuId,
+                              LONG64 aAddress,
+                              ULONG aSize,
+                              std::vector<BYTE> &aBytes);
+    HRESULT writeVirtualMemory(ULONG aCpuId,
+                               LONG64 aAddress,
+                               ULONG aSize,
+                               const std::vector<BYTE> &aBytes);
+    HRESULT loadPlugIn(const com::Utf8Str &aName,
+                       com::Utf8Str &aPlugInName);
+    HRESULT unloadPlugIn(const com::Utf8Str &aName);
+    HRESULT detectOS(com::Utf8Str &aOs);
+    HRESULT queryOSKernelLog(ULONG aMaxMessages,
+                             com::Utf8Str &aDmesg);
+    HRESULT getRegister(ULONG aCpuId,
+                        const com::Utf8Str &aName,
+                        com::Utf8Str &aValue);
+    HRESULT getRegisters(ULONG aCpuId,
+                         std::vector<com::Utf8Str> &aNames,
+                         std::vector<com::Utf8Str> &aValues);
+    HRESULT setRegister(ULONG aCpuId,
+                        const com::Utf8Str &aName,
+                        const com::Utf8Str &aValue);
+    HRESULT setRegisters(ULONG aCpuId,
+                         const std::vector<com::Utf8Str> &aNames,
+                         const std::vector<com::Utf8Str> &aValues);
+    HRESULT dumpGuestStack(ULONG aCpuId,
+                           com::Utf8Str &aStack);
+    HRESULT resetStats(const com::Utf8Str &aPattern);
+    HRESULT dumpStats(const com::Utf8Str &aPattern);
+    HRESULT getStats(const com::Utf8Str &aPattern,
+                     BOOL aWithDescriptions,
+                     com::Utf8Str &aStats);
+
     // private methods
-    bool queueSettings() const;
-    HRESULT getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced);
-    HRESULT setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce);
+    bool i_queueSettings() const;
+    HRESULT i_getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced);
+    HRESULT i_setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce);
 
     /** RTLogGetFlags, RTLogGetGroupSettings and RTLogGetDestinations function. */
     typedef DECLCALLBACK(int) FNLOGGETSTR(PRTLOGGER, char *, size_t);
     /** Function pointer.  */
     typedef FNLOGGETSTR *PFNLOGGETSTR;
-    HRESULT logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, const char *pszLogGetStr, BSTR *a_bstrSettings);
+    HRESULT i_logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, const char *pszLogGetStr, Utf8Str aSettings);
 
     Console * const mParent;
     /** @name Flags whether settings have been queued because they could not be sent
diff --git a/src/VBox/Main/include/MachineImpl.h b/src/VBox/Main/include/MachineImpl.h
index d3c6d85..201dea4 100644
--- a/src/VBox/Main/include/MachineImpl.h
+++ b/src/VBox/Main/include/MachineImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -52,6 +52,8 @@
 #include <list>
 #include <vector>
 
+#include "MachineWrap.h"
+
 // defines
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -70,7 +72,6 @@ class Snapshot;
 class SharedFolder;
 class HostUSBDevice;
 class StorageController;
-
 class SessionMachine;
 
 namespace settings
@@ -85,12 +86,10 @@ namespace settings
 
 // Machine class
 ////////////////////////////////////////////////////////////////////////////////
-
+//
 class ATL_NO_VTABLE Machine :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IMachine)
+    public MachineWrap
 {
-    Q_OBJECT
 
 public:
 
@@ -99,7 +98,8 @@ public:
         AnyStateDep = 0,
         MutableStateDep,
         MutableOrSavedStateDep,
-        OfflineStateDep
+        MutableOrRunningStateDep,
+        MutableOrSavedOrRunningStateDep,
     };
 
     /**
@@ -124,6 +124,9 @@ public:
          */
         struct Session
         {
+            /** Type of lock which created this session */
+            LockType_T mLockType;
+
             /** Control of the direct session opened by lockMachine() */
             ComPtr<IInternalSessionControl> mDirectControl;
 
@@ -145,8 +148,8 @@ public:
             /** Current session state */
             SessionState_T mState;
 
-            /** Session type string (for indirect sessions) */
-            Bstr mType;
+            /** Session name string (of the primary session) */
+            Utf8Str mName;
 
             /** Session machine object */
             ComObjPtr<SessionMachine> mMachine;
@@ -264,6 +267,9 @@ public:
         ULONG               mVideoCaptureHeight;
         ULONG               mVideoCaptureRate;
         ULONG               mVideoCaptureFPS;
+        ULONG               mVideoCaptureMaxTime;
+        ULONG               mVideoCaptureMaxFileSize;
+        Utf8Str             mVideoCaptureOptions;
         Utf8Str             mVideoCaptureFile;
         BOOL                mVideoCaptureEnabled;
         BOOL                maVideoCaptureScreens[SchemaDefs::MaxGuestMonitors];
@@ -277,11 +283,11 @@ public:
         BOOL                mAccelerate2DVideoEnabled;
         BOOL                mPAEEnabled;
         settings::Hardware::LongModeType mLongMode;
-        BOOL                mSyntheticCpu;
         BOOL                mTripleFaultReset;
         ULONG               mCPUCount;
         BOOL                mCPUHotPlugEnabled;
         ULONG               mCpuExecutionCap;
+        uint32_t            mCpuIdPortabilityLevel;
         BOOL                mAccelerate3DEnabled;
         BOOL                mHPETEnabled;
 
@@ -296,7 +302,7 @@ public:
         SharedFolderList    mSharedFolders;
 
         ClipboardMode_T     mClipboardMode;
-        DragAndDropMode_T   mDragAndDropMode;
+        DnDMode_T           mDnDMode;
 
         typedef std::map<Utf8Str, GuestProperty> GuestPropertyMap;
         GuestPropertyMap    mGuestProperties;
@@ -306,6 +312,7 @@ public:
         KeyboardHIDType_T   mKeyboardHIDType;
         PointingHIDType_T   mPointingHIDType;
         ChipsetType_T       mChipsetType;
+        ParavirtProvider_T  mParavirtProvider;
         BOOL                mEmulatedUSBCardReaderEnabled;
 
         BOOL                mIOCacheEnabled;
@@ -338,16 +345,6 @@ public:
         AttachmentList mAttachments;
     };
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Machine, IMachine)
-
-    DECLARE_NOT_AGGREGATABLE(Machine)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Machine)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IMachine)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR(Machine)
 
     HRESULT FinalConstruct();
@@ -379,246 +376,28 @@ public:
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
     // Needed from VirtualBox, for the delayed metrics cleanup.
-    void unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine);
+    void i_unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine);
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
 
 protected:
     HRESULT initImpl(VirtualBox *aParent,
                      const Utf8Str &strConfigFile);
     HRESULT initDataAndChildObjects();
-    HRESULT registeredInit();
-    HRESULT tryCreateMachineConfigFile(bool fForceOverwrite);
+    HRESULT i_registeredInit();
+    HRESULT i_tryCreateMachineConfigFile(bool fForceOverwrite);
     void uninitDataAndChildObjects();
 
 public:
-    // IMachine properties
-    STDMETHOD(COMGETTER(Parent))(IVirtualBox **aParent);
-    STDMETHOD(COMGETTER(Accessible))(BOOL *aAccessible);
-    STDMETHOD(COMGETTER(AccessError))(IVirtualBoxErrorInfo **aAccessError);
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMSETTER(Name))(IN_BSTR aName);
-    STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
-    STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
-    STDMETHOD(COMGETTER(Id))(BSTR *aId);
-    STDMETHOD(COMGETTER(Groups))(ComSafeArrayOut(BSTR, aGroups));
-    STDMETHOD(COMSETTER(Groups))(ComSafeArrayIn(IN_BSTR, aGroups));
-    STDMETHOD(COMGETTER(OSTypeId))(BSTR *aOSTypeId);
-    STDMETHOD(COMSETTER(OSTypeId))(IN_BSTR aOSTypeId);
-    STDMETHOD(COMGETTER(HardwareVersion))(BSTR *aVersion);
-    STDMETHOD(COMSETTER(HardwareVersion))(IN_BSTR aVersion);
-    STDMETHOD(COMGETTER(HardwareUUID))(BSTR *aUUID);
-    STDMETHOD(COMSETTER(HardwareUUID))(IN_BSTR aUUID);
-    STDMETHOD(COMGETTER(MemorySize))(ULONG *memorySize);
-    STDMETHOD(COMSETTER(MemorySize))(ULONG memorySize);
-    STDMETHOD(COMGETTER(CPUCount))(ULONG *cpuCount);
-    STDMETHOD(COMSETTER(CPUCount))(ULONG cpuCount);
-    STDMETHOD(COMGETTER(CPUHotPlugEnabled))(BOOL *enabled);
-    STDMETHOD(COMSETTER(CPUHotPlugEnabled))(BOOL enabled);
-    STDMETHOD(COMGETTER(CPUExecutionCap))(ULONG *aExecutionCap);
-    STDMETHOD(COMSETTER(CPUExecutionCap))(ULONG aExecutionCap);
-    STDMETHOD(COMGETTER(EmulatedUSBCardReaderEnabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(EmulatedUSBCardReaderEnabled))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(HPETEnabled))(BOOL *enabled);
-    STDMETHOD(COMSETTER(HPETEnabled))(BOOL enabled);
-    STDMETHOD(COMGETTER(MemoryBalloonSize))(ULONG *memoryBalloonSize);
-    STDMETHOD(COMSETTER(MemoryBalloonSize))(ULONG memoryBalloonSize);
-    STDMETHOD(COMGETTER(PageFusionEnabled))(BOOL *enabled);
-    STDMETHOD(COMSETTER(PageFusionEnabled))(BOOL enabled);
-    STDMETHOD(COMGETTER(GraphicsControllerType))(GraphicsControllerType_T *aGraphicsController);
-    STDMETHOD(COMSETTER(GraphicsControllerType))(GraphicsControllerType_T aGraphicsController);
-    STDMETHOD(COMGETTER(VRAMSize))(ULONG *memorySize);
-    STDMETHOD(COMSETTER(VRAMSize))(ULONG memorySize);
-    STDMETHOD(COMGETTER(Accelerate3DEnabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(Accelerate3DEnabled))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(Accelerate2DVideoEnabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(Accelerate2DVideoEnabled))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(MonitorCount))(ULONG *monitorCount);
-    STDMETHOD(COMSETTER(MonitorCount))(ULONG monitorCount);
-    STDMETHOD(COMGETTER(VideoCaptureEnabled))(BOOL *u8VideoRecEnabled);
-    STDMETHOD(COMSETTER(VideoCaptureEnabled))(BOOL  u8VideoRecEnabled);
-    STDMETHOD(COMGETTER(VideoCaptureScreens))(ComSafeArrayOut(BOOL, aScreens));
-    STDMETHOD(COMSETTER(VideoCaptureScreens))(ComSafeArrayIn(BOOL, aScreens));
-    STDMETHOD(COMGETTER(VideoCaptureFile))(BSTR * ppChVideoRecFilename);
-    STDMETHOD(COMSETTER(VideoCaptureFile))(IN_BSTR pChVideoRecFilename);
-    STDMETHOD(COMGETTER(VideoCaptureWidth))(ULONG *aHorzRes);
-    STDMETHOD(COMSETTER(VideoCaptureWidth))(ULONG aorzRes);
-    STDMETHOD(COMGETTER(VideoCaptureHeight))(ULONG *aVertRes);
-    STDMETHOD(COMSETTER(VideoCaptureHeight))(ULONG aVertRes);
-    STDMETHOD(COMGETTER(VideoCaptureRate))(ULONG *aRate);
-    STDMETHOD(COMSETTER(VideoCaptureRate))(ULONG aRate);
-    STDMETHOD(COMGETTER(VideoCaptureFPS))(ULONG *aFPS);
-    STDMETHOD(COMSETTER(VideoCaptureFPS))(ULONG aFPS);
-    STDMETHOD(COMGETTER(BIOSSettings))(IBIOSSettings **biosSettings);
-    STDMETHOD(COMGETTER(SnapshotFolder))(BSTR *aSavedStateFolder);
-    STDMETHOD(COMSETTER(SnapshotFolder))(IN_BSTR aSavedStateFolder);
-    STDMETHOD(COMGETTER(MediumAttachments))(ComSafeArrayOut(IMediumAttachment *, aAttachments));
-    STDMETHOD(COMGETTER(VRDEServer))(IVRDEServer **vrdeServer);
-    STDMETHOD(COMGETTER(AudioAdapter))(IAudioAdapter **audioAdapter);
-    STDMETHOD(COMGETTER(USBControllers))(ComSafeArrayOut(IUSBController *, aUSBControllers));
-    STDMETHOD(COMGETTER(USBDeviceFilters))(IUSBDeviceFilters * *aUSBDeviceFilters);
-    STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *aFilePath);
-    STDMETHOD(COMGETTER(SettingsModified))(BOOL *aModified);
-    STDMETHOD(COMGETTER(SessionState))(SessionState_T *aSessionState);
-    STDMETHOD(COMGETTER(SessionType))(BSTR *aSessionType);
-    STDMETHOD(COMGETTER(SessionPID))(ULONG *aSessionPID);
-    STDMETHOD(COMGETTER(State))(MachineState_T *machineState);
-    STDMETHOD(COMGETTER(LastStateChange))(LONG64 *aLastStateChange);
-    STDMETHOD(COMGETTER(StateFilePath))(BSTR *aStateFilePath);
-    STDMETHOD(COMGETTER(LogFolder))(BSTR *aLogFolder);
-    STDMETHOD(COMGETTER(CurrentSnapshot))(ISnapshot **aCurrentSnapshot);
-    STDMETHOD(COMGETTER(SnapshotCount))(ULONG *aSnapshotCount);
-    STDMETHOD(COMGETTER(CurrentStateModified))(BOOL *aCurrentStateModified);
-    STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders));
-    STDMETHOD(COMGETTER(ClipboardMode))(ClipboardMode_T *aClipboardMode);
-    STDMETHOD(COMSETTER(ClipboardMode))(ClipboardMode_T aClipboardMode);
-    STDMETHOD(COMGETTER(DragAndDropMode))(DragAndDropMode_T *aDragAndDropMode);
-    STDMETHOD(COMSETTER(DragAndDropMode))(DragAndDropMode_T aDragAndDropMode);
-    STDMETHOD(COMGETTER(GuestPropertyNotificationPatterns))(BSTR *aPattern);
-    STDMETHOD(COMSETTER(GuestPropertyNotificationPatterns))(IN_BSTR aPattern);
-    STDMETHOD(COMGETTER(StorageControllers))(ComSafeArrayOut(IStorageController *, aStorageControllers));
-    STDMETHOD(COMGETTER(TeleporterEnabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(TeleporterEnabled))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(TeleporterPort))(ULONG *aPort);
-    STDMETHOD(COMSETTER(TeleporterPort))(ULONG aPort);
-    STDMETHOD(COMGETTER(TeleporterAddress))(BSTR *aAddress);
-    STDMETHOD(COMSETTER(TeleporterAddress))(IN_BSTR aAddress);
-    STDMETHOD(COMGETTER(TeleporterPassword))(BSTR *aPassword);
-    STDMETHOD(COMSETTER(TeleporterPassword))(IN_BSTR aPassword);
-    STDMETHOD(COMGETTER(FaultToleranceState))(FaultToleranceState_T *aEnabled);
-    STDMETHOD(COMSETTER(FaultToleranceState))(FaultToleranceState_T aEnabled);
-    STDMETHOD(COMGETTER(FaultToleranceAddress))(BSTR *aAddress);
-    STDMETHOD(COMSETTER(FaultToleranceAddress))(IN_BSTR aAddress);
-    STDMETHOD(COMGETTER(FaultTolerancePort))(ULONG *aPort);
-    STDMETHOD(COMSETTER(FaultTolerancePort))(ULONG aPort);
-    STDMETHOD(COMGETTER(FaultTolerancePassword))(BSTR *aPassword);
-    STDMETHOD(COMSETTER(FaultTolerancePassword))(IN_BSTR aPassword);
-    STDMETHOD(COMGETTER(FaultToleranceSyncInterval))(ULONG *aInterval);
-    STDMETHOD(COMSETTER(FaultToleranceSyncInterval))(ULONG aInterval);
-    STDMETHOD(COMGETTER(RTCUseUTC))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(RTCUseUTC))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(FirmwareType))(FirmwareType_T *aFirmware);
-    STDMETHOD(COMSETTER(FirmwareType))(FirmwareType_T  aFirmware);
-    STDMETHOD(COMGETTER(KeyboardHIDType))(KeyboardHIDType_T *aKeyboardHIDType);
-    STDMETHOD(COMSETTER(KeyboardHIDType))(KeyboardHIDType_T  aKeyboardHIDType);
-    STDMETHOD(COMGETTER(PointingHIDType))(PointingHIDType_T *aPointingHIDType);
-    STDMETHOD(COMSETTER(PointingHIDType))(PointingHIDType_T  aPointingHIDType);
-    STDMETHOD(COMGETTER(ChipsetType))(ChipsetType_T *aChipsetType);
-    STDMETHOD(COMSETTER(ChipsetType))(ChipsetType_T  aChipsetType);
-    STDMETHOD(COMGETTER(IOCacheEnabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(IOCacheEnabled))(BOOL  aEnabled);
-    STDMETHOD(COMGETTER(IOCacheSize))(ULONG *aIOCacheSize);
-    STDMETHOD(COMSETTER(IOCacheSize))(ULONG  aIOCacheSize);
-    STDMETHOD(COMGETTER(PCIDeviceAssignments))(ComSafeArrayOut(IPCIDeviceAttachment *, aAssignments));
-    STDMETHOD(COMGETTER(BandwidthControl))(IBandwidthControl **aBandwidthControl);
-    STDMETHOD(COMGETTER(TracingEnabled))(BOOL *pfEnabled);
-    STDMETHOD(COMSETTER(TracingEnabled))(BOOL fEnabled);
-    STDMETHOD(COMGETTER(TracingConfig))(BSTR *pbstrConfig);
-    STDMETHOD(COMSETTER(TracingConfig))(IN_BSTR bstrConfig);
-    STDMETHOD(COMGETTER(AllowTracingToAccessVM))(BOOL *pfAllow);
-    STDMETHOD(COMSETTER(AllowTracingToAccessVM))(BOOL fAllow);
-    STDMETHOD(COMGETTER(AutostartEnabled))(BOOL *pfEnabled);
-    STDMETHOD(COMSETTER(AutostartEnabled))(BOOL fEnabled);
-    STDMETHOD(COMGETTER(AutostartDelay))(ULONG *puDelay);
-    STDMETHOD(COMSETTER(AutostartDelay))(ULONG uDelay);
-    STDMETHOD(COMGETTER(AutostopType))(AutostopType_T *penmAutostopType);
-    STDMETHOD(COMSETTER(AutostopType))(AutostopType_T enmAutostopType);
-    STDMETHOD(COMGETTER(DefaultFrontend))(BSTR *aDefaultFrontend);
-    STDMETHOD(COMSETTER(DefaultFrontend))(IN_BSTR aDefaultFrontend);
-    STDMETHOD(COMGETTER(Icon))(ComSafeArrayOut(BYTE, aIcon));
-    STDMETHOD(COMSETTER(Icon))(ComSafeArrayIn(BYTE, aIcon));
-    STDMETHOD(COMGETTER(USBProxyAvailable))(BOOL *aAvailable);
-
-    // IMachine methods
-    STDMETHOD(LockMachine)(ISession *aSession, LockType_T lockType);
-    STDMETHOD(LaunchVMProcess)(ISession *aSession,  IN_BSTR aType, IN_BSTR aEnvironment, IProgress **aProgress);
-
-    STDMETHOD(SetBootOrder)(ULONG aPosition, DeviceType_T aDevice);
-    STDMETHOD(GetBootOrder)(ULONG aPosition, DeviceType_T *aDevice);
-    STDMETHOD(AttachDeviceWithoutMedium)(IN_BSTR aControllerName, LONG aControllerPort,
-                                        LONG aDevice, DeviceType_T aType);
-    STDMETHOD(AttachDevice)(IN_BSTR aControllerName, LONG aControllerPort,
-                            LONG aDevice, DeviceType_T aType, IMedium *aMedium);
-    STDMETHOD(DetachDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice);
-    STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough);
-    STDMETHOD(TemporaryEjectDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aTempEject);
-    STDMETHOD(NonRotationalDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aNonRotational);
-    STDMETHOD(SetAutoDiscardForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aDiscard);
-    STDMETHOD(SetHotPluggableForDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aHotPluggable);
-    STDMETHOD(SetNoBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort,
-                                            LONG aDevice);
-    STDMETHOD(SetBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort,
-                                          LONG aDevice, IBandwidthGroup *aBandwidthGroup);
-    STDMETHOD(MountMedium)(IN_BSTR aControllerName, LONG aControllerPort,
-                           LONG aDevice, IMedium *aMedium, BOOL aForce);
-    STDMETHOD(UnmountMedium)(IN_BSTR aControllerName, LONG aControllerPort,
-                             LONG aDevice, BOOL aForce);
-    STDMETHOD(GetMedium)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice,
-                         IMedium **aMedium);
-    STDMETHOD(GetSerialPort)(ULONG slot, ISerialPort **port);
-    STDMETHOD(GetParallelPort)(ULONG slot, IParallelPort **port);
-    STDMETHOD(GetNetworkAdapter)(ULONG slot, INetworkAdapter **adapter);
-    STDMETHOD(GetExtraDataKeys)(ComSafeArrayOut(BSTR, aKeys));
-    STDMETHOD(GetExtraData)(IN_BSTR aKey, BSTR *aValue);
-    STDMETHOD(SetExtraData)(IN_BSTR aKey, IN_BSTR aValue);
-    STDMETHOD(GetCPUProperty)(CPUPropertyType_T property, BOOL *aVal);
-    STDMETHOD(SetCPUProperty)(CPUPropertyType_T property, BOOL aVal);
-    STDMETHOD(GetCPUIDLeaf)(ULONG id, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx);
-    STDMETHOD(SetCPUIDLeaf)(ULONG id, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx);
-    STDMETHOD(RemoveCPUIDLeaf)(ULONG id);
-    STDMETHOD(RemoveAllCPUIDLeaves)();
-    STDMETHOD(GetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL *aVal);
-    STDMETHOD(SetHWVirtExProperty)(HWVirtExPropertyType_T property, BOOL aVal);
-    STDMETHOD(SetSettingsFilePath)(IN_BSTR aFilePath, IProgress **aProgress);
-    STDMETHOD(SaveSettings)();
-    STDMETHOD(DiscardSettings)();
-    STDMETHOD(Unregister)(CleanupMode_T cleanupMode, ComSafeArrayOut(IMedium*, aMedia));
-    STDMETHOD(DeleteConfig)(ComSafeArrayIn(IMedium*, aMedia), IProgress **aProgress);
-    STDMETHOD(ExportTo)(IAppliance *aAppliance, IN_BSTR location, IVirtualSystemDescription **aDescription);
-    STDMETHOD(FindSnapshot)(IN_BSTR aNameOrId, ISnapshot **aSnapshot);
-    STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
-    STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
-    STDMETHOD(CanShowConsoleWindow)(BOOL *aCanShow);
-    STDMETHOD(ShowConsoleWindow)(LONG64 *aWinId);
-    STDMETHOD(GetGuestProperty)(IN_BSTR aName, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
-    STDMETHOD(GetGuestPropertyValue)(IN_BSTR aName, BSTR *aValue);
-    STDMETHOD(GetGuestPropertyTimestamp)(IN_BSTR aName, LONG64 *aTimestamp);
-    STDMETHOD(SetGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags);
-    STDMETHOD(SetGuestPropertyValue)(IN_BSTR aName, IN_BSTR aValue);
-    STDMETHOD(DeleteGuestProperty)(IN_BSTR aName);
-    STDMETHOD(EnumerateGuestProperties)(IN_BSTR aPattern, ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues), ComSafeArrayOut(LONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
-    STDMETHOD(GetMediumAttachmentsOfController)(IN_BSTR aName, ComSafeArrayOut(IMediumAttachment *, aAttachments));
-    STDMETHOD(GetMediumAttachment)(IN_BSTR aConstrollerName, LONG aControllerPort, LONG aDevice, IMediumAttachment **aAttachment);
-    STDMETHOD(AddStorageController)(IN_BSTR aName, StorageBus_T aConnectionType, IStorageController **controller);
-    STDMETHOD(RemoveStorageController(IN_BSTR aName));
-    STDMETHOD(GetStorageControllerByName(IN_BSTR aName, IStorageController **storageController));
-    STDMETHOD(GetStorageControllerByInstance(ULONG aInstance, IStorageController **storageController));
-    STDMETHOD(SetStorageControllerBootable)(IN_BSTR aName, BOOL fBootable);
-    STDMETHOD(AddUSBController)(IN_BSTR aName, USBControllerType_T aConnectionType, IUSBController **controller);
-    STDMETHOD(RemoveUSBController(IN_BSTR aName));
-    STDMETHOD(GetUSBControllerByName(IN_BSTR aName, IUSBController **usbController));
-    STDMETHOD(GetUSBControllerCountByType(USBControllerType_T aType, ULONG *aControllers));
-    STDMETHOD(QuerySavedGuestScreenInfo)(ULONG uScreenId, ULONG *puOriginX, ULONG *puOriginY, ULONG *puWidth, ULONG *puHeight, BOOL *pfEnabled);
-    STDMETHOD(QuerySavedThumbnailSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight);
-    STDMETHOD(ReadSavedThumbnailToArray)(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
-    STDMETHOD(ReadSavedThumbnailPNGToArray)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
-    STDMETHOD(QuerySavedScreenshotPNGSize)(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight);
-    STDMETHOD(ReadSavedScreenshotPNGToArray)(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData));
-    STDMETHOD(HotPlugCPU(ULONG aCpu));
-    STDMETHOD(HotUnplugCPU(ULONG aCpu));
-    STDMETHOD(GetCPUStatus(ULONG aCpu, BOOL *aCpuAttached));
-    STDMETHOD(QueryLogFilename(ULONG aIdx, BSTR *aName));
-    STDMETHOD(ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeArrayOut(BYTE, aData)));
-    STDMETHOD(AttachHostPCIDevice(LONG hostAddress, LONG desiredGuestAddress, BOOL tryToUnbind));
-    STDMETHOD(DetachHostPCIDevice(LONG hostAddress));
-    STDMETHOD(CloneTo(IMachine *pTarget, CloneMode_T mode, ComSafeArrayIn(CloneOptions_T, options), IProgress **pProgress));
+
+
     // public methods only for internal purposes
 
-    virtual bool isSnapshotMachine() const
+    virtual bool i_isSnapshotMachine() const
     {
         return false;
     }
 
-    virtual bool isSessionMachine() const
+    virtual bool i_isSessionMachine() const
     {
         return false;
     }
@@ -635,7 +414,7 @@ public:
     /// @todo (dmik) add lock and make non-inlined after revising classes
     //  that use it. Note: they should enter Machine lock to keep the returned
     //  information valid!
-    bool isRegistered() { return !!mData->mRegistered; }
+    bool i_isRegistered() { return !!mData->mRegistered; }
 
     // unsafe inline public methods for internal purposes only (ensure there is
     // a caller and a read lock before calling them!)
@@ -647,7 +426,7 @@ public:
      * used by ready Machine children (whose readiness is bound to the parent's
      * one) or after doing addCaller() manually.
      */
-    VirtualBox* getVirtualBox() const { return mParent; }
+    VirtualBox* i_getVirtualBox() const { return mParent; }
 
     /**
      * Checks if this machine is accessible, without attempting to load the
@@ -657,7 +436,7 @@ public:
      * used by ready Machine children (whose readiness is bound to the parent's
      * one) or after doing addCaller() manually.
      */
-    bool isAccessible() const { return !!mData->mAccessible; }
+    bool i_isAccessible() const { return !!mData->mAccessible; }
 
     /**
      * Returns this machine ID.
@@ -666,7 +445,7 @@ public:
      * used by ready Machine children (whose readiness is bound to the parent's
      * one) or after adding a caller manually.
      */
-    const Guid& getId() const { return mData->mUuid; }
+    const Guid& i_getId() const { return mData->mUuid; }
 
     /**
      * Returns the snapshot ID this machine represents or an empty UUID if this
@@ -676,7 +455,7 @@ public:
      * used by ready Machine children (whose readiness is bound to the parent's
      * one) or after adding a caller manually.
      */
-    inline const Guid& getSnapshotId() const;
+    inline const Guid& i_getSnapshotId() const;
 
     /**
      * Returns this machine's full settings file path.
@@ -685,7 +464,7 @@ public:
      * Intended to be used only after doing addCaller() manually and locking it
      * for reading.
      */
-    const Utf8Str& getSettingsFileFull() const { return mData->m_strConfigFileFull; }
+    const Utf8Str& i_getSettingsFileFull() const { return mData->m_strConfigFileFull; }
 
     /**
      * Returns this machine name.
@@ -694,7 +473,7 @@ public:
      * Intended to be used only after doing addCaller() manually and locking it
      * for reading.
      */
-    const Utf8Str& getName() const { return mUserData->s.strName; }
+    const Utf8Str& i_getName() const { return mUserData->s.strName; }
 
     enum
     {
@@ -719,57 +498,60 @@ public:
      * Intended to be used only after doing addCaller() manually and locking it
      * for reading.
      */
-    ChipsetType_T getChipsetType() const { return mHWData->mChipsetType; }
+    ChipsetType_T i_getChipsetType() const { return mHWData->mChipsetType; }
+    ParavirtProvider_T i_getParavirtProvider() const { return mHWData->mParavirtProvider; }
 
-    void setModified(uint32_t fl, bool fAllowStateModification = true);
-    void setModifiedLock(uint32_t fl, bool fAllowStateModification = true);
+    void i_setModified(uint32_t fl, bool fAllowStateModification = true);
+    void i_setModifiedLock(uint32_t fl, bool fAllowStateModification = true);
 
-    bool isStateModificationAllowed() const { return mData->m_fAllowStateModification; }
-    void allowStateModification()           { mData->m_fAllowStateModification = true; }
-    void disallowStateModification()        { mData->m_fAllowStateModification = false; }
+    bool i_isStateModificationAllowed() const { return mData->m_fAllowStateModification; }
+    void i_allowStateModification()           { mData->m_fAllowStateModification = true; }
+    void i_disallowStateModification()        { mData->m_fAllowStateModification = false; }
 
-    const StringsList &getGroups() const { return mUserData->s.llGroups; }
+    const StringsList &i_getGroups() const { return mUserData->s.llGroups; }
 
     // callback handlers
-    virtual HRESULT onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; }
-    virtual HRESULT onNATRedirectRuleChange(ULONG /* slot */, BOOL /* fRemove */ , IN_BSTR /* name */,
-                                 NATProtocol_T /* protocol */, IN_BSTR /* host ip */, LONG /* host port */, IN_BSTR /* guest port */, LONG /* guest port */ ) { return S_OK; }
-    virtual HRESULT onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; }
-    virtual HRESULT onParallelPortChange(IParallelPort * /* parallelPort */) { return S_OK; }
-    virtual HRESULT onVRDEServerChange(BOOL /* aRestart */) { return S_OK; }
-    virtual HRESULT onUSBControllerChange() { return S_OK; }
-    virtual HRESULT onStorageControllerChange() { return S_OK; }
-    virtual HRESULT onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; }
-    virtual HRESULT onCPUExecutionCapChange(ULONG /* aExecutionCap */) { return S_OK; }
-    virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
-    virtual HRESULT onSharedFolderChange() { return S_OK; }
-    virtual HRESULT onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; }
-    virtual HRESULT onDragAndDropModeChange(DragAndDropMode_T /* aDragAndDropMode */) { return S_OK; }
-    virtual HRESULT onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; }
-    virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */, BOOL /* silent */) { return S_OK; }
-    virtual HRESULT onVideoCaptureChange() { return S_OK; }
-
-    HRESULT saveRegistryEntry(settings::MachineRegistryEntry &data);
-
-    int calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
-    void copyPathRelativeToMachine(const Utf8Str &strSource, Utf8Str &strTarget);
-
-    void getLogFolder(Utf8Str &aLogFolder);
-    Utf8Str queryLogFilename(ULONG idx);
+    virtual HRESULT i_onNetworkAdapterChange(INetworkAdapter * /* networkAdapter */, BOOL /* changeAdapter */) { return S_OK; }
+    virtual HRESULT i_onNATRedirectRuleChange(ULONG /* slot */, BOOL /* fRemove */ , IN_BSTR /* name */,
+                                              NATProtocol_T /* protocol */, IN_BSTR /* host ip */, LONG /* host port */,
+                                              IN_BSTR /* guest port */, LONG /* guest port */ ) { return S_OK; }
+    virtual HRESULT i_onSerialPortChange(ISerialPort * /* serialPort */) { return S_OK; }
+    virtual HRESULT i_onParallelPortChange(IParallelPort * /* parallelPort */) { return S_OK; }
+    virtual HRESULT i_onVRDEServerChange(BOOL /* aRestart */) { return S_OK; }
+    virtual HRESULT i_onUSBControllerChange() { return S_OK; }
+    virtual HRESULT i_onStorageControllerChange() { return S_OK; }
+    virtual HRESULT i_onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; }
+    virtual HRESULT i_onCPUExecutionCapChange(ULONG /* aExecutionCap */) { return S_OK; }
+    virtual HRESULT i_onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
+    virtual HRESULT i_onSharedFolderChange() { return S_OK; }
+    virtual HRESULT i_onClipboardModeChange(ClipboardMode_T /* aClipboardMode */) { return S_OK; }
+    virtual HRESULT i_onDnDModeChange(DnDMode_T /* aDnDMode */) { return S_OK; }
+    virtual HRESULT i_onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; }
+    virtual HRESULT i_onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */,
+                                            BOOL /* silent */) { return S_OK; }
+    virtual HRESULT i_onVideoCaptureChange() { return S_OK; }
+
+    HRESULT i_saveRegistryEntry(settings::MachineRegistryEntry &data);
+
+    int i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
+    void i_copyPathRelativeToMachine(const Utf8Str &strSource, Utf8Str &strTarget);
+
+    void i_getLogFolder(Utf8Str &aLogFolder);
+    Utf8Str i_queryLogFilename(ULONG idx);
     Utf8Str i_getStartupLogFilename(void);
 
-    void composeSavedStateFilename(Utf8Str &strStateFilePath);
+    void i_composeSavedStateFilename(Utf8Str &strStateFilePath);
 
-    void getDefaultVideoCaptureFile(Utf8Str &strFile);
+    void i_getDefaultVideoCaptureFile(Utf8Str &strFile);
 
-    bool isUSBControllerPresent();
+    bool i_isUSBControllerPresent();
 
-    HRESULT launchVMProcess(IInternalSessionControl *aControl,
-                            const Utf8Str &strType,
-                            const Utf8Str &strEnvironment,
-                            ProgressProxy *aProgress);
+    HRESULT i_launchVMProcess(IInternalSessionControl *aControl,
+                              const Utf8Str &strType,
+                              const Utf8Str &strEnvironment,
+                              ProgressProxy *aProgress);
 
-    HRESULT getDirectControl(ComPtr<IInternalSessionControl> *directControl)
+    HRESULT i_getDirectControl(ComPtr<IInternalSessionControl> *directControl)
     {
         HRESULT rc;
         *directControl = mData->mSession.mDirectControl;
@@ -782,94 +564,96 @@ public:
         return rc;
     }
 
-    bool isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
-                       ComPtr<IInternalSessionControl> *aControl = NULL,
-                       bool aAllowClosing = false);
-    bool isSessionSpawning();
+    bool i_isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
+                         ComPtr<IInternalSessionControl> *aControl = NULL,
+                         bool aAllowClosing = false);
+    bool i_isSessionSpawning();
 
-    bool isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
-                                ComPtr<IInternalSessionControl> *aControl = NULL)
-    { return isSessionOpen(aMachine, aControl, true /* aAllowClosing */); }
+    bool i_isSessionOpenOrClosing(ComObjPtr<SessionMachine> &aMachine,
+                                  ComPtr<IInternalSessionControl> *aControl = NULL)
+    { return i_isSessionOpen(aMachine, aControl, true /* aAllowClosing */); }
 
-    bool checkForSpawnFailure();
+    bool i_checkForSpawnFailure();
 
-    HRESULT prepareRegister();
+    HRESULT i_prepareRegister();
 
-    HRESULT getSharedFolder(CBSTR aName,
-                            ComObjPtr<SharedFolder> &aSharedFolder,
-                            bool aSetError = false)
+    HRESULT i_getSharedFolder(CBSTR aName,
+                              ComObjPtr<SharedFolder> &aSharedFolder,
+                              bool aSetError = false)
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        return findSharedFolder(aName, aSharedFolder, aSetError);
+        return i_findSharedFolder(aName, aSharedFolder, aSetError);
     }
 
-    HRESULT addStateDependency(StateDependency aDepType = AnyStateDep,
-                               MachineState_T *aState = NULL,
-                               BOOL *aRegistered = NULL);
-    void releaseStateDependency();
+    HRESULT i_addStateDependency(StateDependency aDepType = AnyStateDep,
+                                 MachineState_T *aState = NULL,
+                                 BOOL *aRegistered = NULL);
+    void i_releaseStateDependency();
 
-    HRESULT getBandwidthGroup(const Utf8Str &strBandwidthGroup,
-                              ComObjPtr<BandwidthGroup> &pBandwidthGroup,
-                              bool fSetError = false)
+    HRESULT i_getBandwidthGroup(const Utf8Str &strBandwidthGroup,
+                                ComObjPtr<BandwidthGroup> &pBandwidthGroup,
+                                bool fSetError = false)
     {
-        return mBandwidthControl->getBandwidthGroupByName(strBandwidthGroup,
-                                                          pBandwidthGroup,
-                                                          fSetError);
+        return mBandwidthControl->i_getBandwidthGroupByName(strBandwidthGroup,
+                                                            pBandwidthGroup,
+                                                            fSetError);
     }
 
+    static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *pcszMsg, ...);
+
 protected:
 
     class ClientToken;
 
-    HRESULT checkStateDependency(StateDependency aDepType);
-
-    Machine *getMachine();
-
-    void ensureNoStateDependencies();
-
-    virtual HRESULT setMachineState(MachineState_T aMachineState);
-
-    HRESULT findSharedFolder(const Utf8Str &aName,
-                             ComObjPtr<SharedFolder> &aSharedFolder,
-                             bool aSetError = false);
-
-    HRESULT loadSettings(bool aRegistered);
-    HRESULT loadMachineDataFromSettings(const settings::MachineConfigFile &config,
-                                        const Guid *puuidRegistry);
-    HRESULT loadSnapshot(const settings::Snapshot &data,
-                         const Guid &aCurSnapshotId,
-                         Snapshot *aParentSnapshot);
-    HRESULT loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg,
-                         const settings::Autostart *pAutostart);
-    HRESULT loadDebugging(const settings::Debugging *pDbg);
-    HRESULT loadAutostart(const settings::Autostart *pAutostart);
-    HRESULT loadStorageControllers(const settings::Storage &data,
-                                   const Guid *puuidRegistry,
-                                   const Guid *puuidSnapshot);
-    HRESULT loadStorageDevices(StorageController *aStorageController,
-                               const settings::StorageController &data,
-                               const Guid *puuidRegistry,
-                               const Guid *puuidSnapshot);
-
-    HRESULT findSnapshotById(const Guid &aId,
-                             ComObjPtr<Snapshot> &aSnapshot,
-                             bool aSetError = false);
-    HRESULT findSnapshotByName(const Utf8Str &strName,
+    HRESULT i_checkStateDependency(StateDependency aDepType);
+
+    Machine *i_getMachine();
+
+    void i_ensureNoStateDependencies();
+
+    virtual HRESULT i_setMachineState(MachineState_T aMachineState);
+
+    HRESULT i_findSharedFolder(const Utf8Str &aName,
+                               ComObjPtr<SharedFolder> &aSharedFolder,
+                               bool aSetError = false);
+
+    HRESULT i_loadSettings(bool aRegistered);
+    HRESULT i_loadMachineDataFromSettings(const settings::MachineConfigFile &config,
+                                          const Guid *puuidRegistry);
+    HRESULT i_loadSnapshot(const settings::Snapshot &data,
+                           const Guid &aCurSnapshotId,
+                           Snapshot *aParentSnapshot);
+    HRESULT i_loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg,
+                           const settings::Autostart *pAutostart);
+    HRESULT i_loadDebugging(const settings::Debugging *pDbg);
+    HRESULT i_loadAutostart(const settings::Autostart *pAutostart);
+    HRESULT i_loadStorageControllers(const settings::Storage &data,
+                                     const Guid *puuidRegistry,
+                                     const Guid *puuidSnapshot);
+    HRESULT i_loadStorageDevices(StorageController *aStorageController,
+                                 const settings::StorageController &data,
+                                 const Guid *puuidRegistry,
+                                 const Guid *puuidSnapshot);
+
+    HRESULT i_findSnapshotById(const Guid &aId,
                                ComObjPtr<Snapshot> &aSnapshot,
                                bool aSetError = false);
+    HRESULT i_findSnapshotByName(const Utf8Str &strName,
+                                 ComObjPtr<Snapshot> &aSnapshot,
+                                 bool aSetError = false);
 
-    HRESULT getStorageControllerByName(const Utf8Str &aName,
-                                       ComObjPtr<StorageController> &aStorageController,
-                                       bool aSetError = false);
+    HRESULT i_getStorageControllerByName(const Utf8Str &aName,
+                                         ComObjPtr<StorageController> &aStorageController,
+                                         bool aSetError = false);
 
-    HRESULT getMediumAttachmentsOfController(CBSTR aName,
-                                             MediaData::AttachmentList &aAttachments);
+    HRESULT i_getMediumAttachmentsOfController(const Utf8Str &aName,
+                                               MediaData::AttachmentList &aAttachments);
 
-    HRESULT getUSBControllerByName(const Utf8Str &aName,
-                                   ComObjPtr<USBController> &aUSBController,
-                                   bool aSetError = false);
+    HRESULT i_getUSBControllerByName(const Utf8Str &aName,
+                                     ComObjPtr<USBController> &aUSBController,
+                                     bool aSetError = false);
 
-    ULONG   getUSBControllerCountByType(USBControllerType_T enmType);
+    ULONG   i_getUSBControllerCountByType(USBControllerType_T enmType);
 
     enum
     {
@@ -883,83 +667,80 @@ protected:
         SaveSTS_StateTimeStamp = 0x80
     };
 
-    HRESULT prepareSaveSettings(bool *pfNeedsGlobalSaveSettings);
-    HRESULT saveSettings(bool *pfNeedsGlobalSaveSettings, int aFlags = 0);
-
-    void copyMachineDataToSettings(settings::MachineConfigFile &config);
-    HRESULT saveAllSnapshots(settings::MachineConfigFile &config);
-    HRESULT saveHardware(settings::Hardware &data, settings::Debugging *pDbg,
-                         settings::Autostart *pAutostart);
-    HRESULT saveStorageControllers(settings::Storage &data);
-    HRESULT saveStorageDevices(ComObjPtr<StorageController> aStorageController,
-                               settings::StorageController &data);
-    HRESULT saveStateSettings(int aFlags);
+    HRESULT i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings);
+    HRESULT i_saveSettings(bool *pfNeedsGlobalSaveSettings, int aFlags = 0);
 
-    void addMediumToRegistry(ComObjPtr<Medium> &pMedium);
+    void i_copyMachineDataToSettings(settings::MachineConfigFile &config);
+    HRESULT i_saveAllSnapshots(settings::MachineConfigFile &config);
+    HRESULT i_saveHardware(settings::Hardware &data, settings::Debugging *pDbg,
+                           settings::Autostart *pAutostart);
+    HRESULT i_saveStorageControllers(settings::Storage &data);
+    HRESULT i_saveStorageDevices(ComObjPtr<StorageController> aStorageController,
+                                 settings::StorageController &data);
+    HRESULT i_saveStateSettings(int aFlags);
 
-    HRESULT createImplicitDiffs(IProgress *aProgress,
-                                ULONG aWeight,
-                                bool aOnline);
-    HRESULT deleteImplicitDiffs(bool aOnline);
+    void i_addMediumToRegistry(ComObjPtr<Medium> &pMedium);
 
-    MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
-                                     IN_BSTR aControllerName,
-                                     LONG aControllerPort,
-                                     LONG aDevice);
-    MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
-                                     ComObjPtr<Medium> pMedium);
-    MediumAttachment* findAttachment(const MediaData::AttachmentList &ll,
-                                     Guid &id);
+    HRESULT i_createImplicitDiffs(IProgress *aProgress,
+                                  ULONG aWeight,
+                                  bool aOnline);
+    HRESULT i_deleteImplicitDiffs(bool aOnline);
 
-    HRESULT detachDevice(MediumAttachment *pAttach,
-                         AutoWriteLock &writeLock,
-                         Snapshot *pSnapshot);
+    MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll,
+                                       IN_BSTR aControllerName,
+                                       LONG aControllerPort,
+                                       LONG aDevice);
+    MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll,
+                                       ComObjPtr<Medium> pMedium);
+    MediumAttachment* i_findAttachment(const MediaData::AttachmentList &ll,
+                                       Guid &id);
 
-    HRESULT detachAllMedia(AutoWriteLock &writeLock,
-                           Snapshot *pSnapshot,
-                           CleanupMode_T cleanupMode,
-                           MediaList &llMedia);
+    HRESULT i_detachDevice(MediumAttachment *pAttach,
+                           AutoWriteLock &writeLock,
+                           Snapshot *pSnapshot);
 
-    void commitMedia(bool aOnline = false);
-    void rollbackMedia();
+    HRESULT i_detachAllMedia(AutoWriteLock &writeLock,
+                             Snapshot *pSnapshot,
+                             CleanupMode_T cleanupMode,
+                             MediaList &llMedia);
 
-    bool isInOwnDir(Utf8Str *aSettingsDir = NULL) const;
+    void i_commitMedia(bool aOnline = false);
+    void i_rollbackMedia();
 
-    void rollback(bool aNotify);
-    void commit();
-    void copyFrom(Machine *aThat);
-    bool isControllerHotplugCapable(StorageControllerType_T enmCtrlType);
+    bool i_isInOwnDir(Utf8Str *aSettingsDir = NULL) const;
 
-    struct DeleteTask;
-    static DECLCALLBACK(int) deleteThread(RTTHREAD Thread, void *pvUser);
-    HRESULT deleteTaskWorker(DeleteTask &task);
+    void i_rollback(bool aNotify);
+    void i_commit();
+    void i_copyFrom(Machine *aThat);
+    bool i_isControllerHotplugCapable(StorageControllerType_T enmCtrlType);
 
-    Utf8Str getExtraData(const Utf8Str &strKey);
+    Utf8Str i_getExtraData(const Utf8Str &strKey);
 
 #ifdef VBOX_WITH_GUEST_PROPS
-    HRESULT getGuestPropertyFromService(IN_BSTR aName, BSTR *aValue,
-                                        LONG64 *aTimestamp, BSTR *aFlags) const;
-    HRESULT getGuestPropertyFromVM(IN_BSTR aName, BSTR *aValue,
-                                   LONG64 *aTimestamp, BSTR *aFlags) const;
-    HRESULT setGuestPropertyToService(IN_BSTR aName, IN_BSTR aValue,
-                                      IN_BSTR aFlags);
-    HRESULT setGuestPropertyToVM(IN_BSTR aName, IN_BSTR aValue,
-                                 IN_BSTR aFlags);
-    HRESULT enumerateGuestPropertiesInService
-                (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames),
-                 ComSafeArrayOut(BSTR, aValues),
-                 ComSafeArrayOut(LONG64, aTimestamps),
-                 ComSafeArrayOut(BSTR, aFlags));
-    HRESULT enumerateGuestPropertiesOnVM
-                (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames),
-                 ComSafeArrayOut(BSTR, aValues),
-                 ComSafeArrayOut(LONG64, aTimestamps),
-                 ComSafeArrayOut(BSTR, aFlags));
+    HRESULT i_getGuestPropertyFromService(const com::Utf8Str &aName, com::Utf8Str &aValue,
+                                          LONG64 *aTimestamp, com::Utf8Str &aFlags) const;
+    HRESULT i_setGuestPropertyToService(const com::Utf8Str &aName, const com::Utf8Str &aValue,
+                                        const com::Utf8Str &aFlags, bool fDelete);
+    HRESULT i_getGuestPropertyFromVM(const com::Utf8Str &aName, com::Utf8Str &aValue,
+                                     LONG64 *aTimestamp, com::Utf8Str &aFlags) const;
+    HRESULT i_setGuestPropertyToVM(const com::Utf8Str &aName, const com::Utf8Str &aValue,
+                                   const com::Utf8Str &aFlags, bool fDelete);
+    HRESULT i_enumerateGuestPropertiesInService(const com::Utf8Str &aPatterns,
+                                                std::vector<com::Utf8Str> &aNames,
+                                                std::vector<com::Utf8Str> &aValues,
+                                                std::vector<LONG64> &aTimestamps,
+                                                std::vector<com::Utf8Str> &aFlags);
+    HRESULT i_enumerateGuestPropertiesOnVM(const com::Utf8Str &aPatterns,
+                                           std::vector<com::Utf8Str> &aNames,
+                                           std::vector<com::Utf8Str> &aValues,
+                                           std::vector<LONG64> &aTimestamps,
+                                           std::vector<com::Utf8Str> &aFlags);
+
 #endif /* VBOX_WITH_GUEST_PROPS */
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
-    void getDiskList(MediaList &list);
-    void registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid);
+    void i_getDiskList(MediaList &list);
+    void i_registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid);
 
     pm::CollectorGuest     *mCollectorGuest;
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
@@ -997,12 +778,481 @@ protected:
 
     uint64_t                        uRegistryNeedsSaving;
 
+    /**
+     * Abstract base class for all Machine or SessionMachine related
+     * asynchronous tasks. This is necessary since RTThreadCreate cannot call
+     * a (non-static) method as its thread function, so instead we have it call
+     * the static Machine::taskHandler, which then calls the handler() method
+     * in here (implemented by the subclasses).
+     */
+    struct Task
+    {
+        Task(Machine *m, Progress *p, const Utf8Str &t)
+            : m_pMachine(m),
+              m_machineCaller(m),
+              m_pProgress(p),
+              m_strTaskName(t),
+              m_machineStateBackup(m->mData->mMachineState) // save the current machine state
+        {}
+
+        HRESULT createThread()
+        {
+            int vrc = RTThreadCreate(NULL,
+                                     taskHandler,
+                                     (void *)this,
+                                     0,
+                                     RTTHREADTYPE_MAIN_WORKER,
+                                     0,
+                                     m_strTaskName.c_str());
+            if (RT_FAILURE(vrc))
+            {
+                HRESULT rc = Machine::i_setErrorStatic(E_FAIL, Machine::tr("Could not create thread \"%s\" (%Rrc)"), m_strTaskName.c_str(), vrc);
+                delete this;
+                return rc;
+            }
+            return S_OK;
+        }
+
+        void modifyBackedUpState(MachineState_T s)
+        {
+            *const_cast<MachineState_T *>(&m_machineStateBackup) = s;
+        }
+
+        virtual void handler() = 0;
+
+        ComObjPtr<Machine>       m_pMachine;
+        AutoCaller                      m_machineCaller;
+        ComObjPtr<Progress>             m_pProgress;
+        Utf8Str                         m_strTaskName;
+        const MachineState_T            m_machineStateBackup;
+    };
+
+    struct DeleteConfigTask;
+    void i_deleteConfigHandler(DeleteConfigTask &task);
+
+    static DECLCALLBACK(int) taskHandler(RTTHREAD thread, void *pvUser);
+
     friend class SessionMachine;
     friend class SnapshotMachine;
     friend class Appliance;
     friend class VirtualBox;
 
     friend class MachineCloneVM;
+
+private:
+    // wrapped IMachine properties
+    HRESULT getParent(ComPtr<IVirtualBox> &aParent);
+    HRESULT getIcon(std::vector<BYTE> &aIcon);
+    HRESULT setIcon(const std::vector<BYTE> &aIcon);
+    HRESULT getAccessible(BOOL *aAccessible);
+    HRESULT getAccessError(ComPtr<IVirtualBoxErrorInfo> &aAccessError);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT setName(const com::Utf8Str &aName);
+    HRESULT getDescription(com::Utf8Str &aDescription);
+    HRESULT setDescription(const com::Utf8Str &aDescription);
+    HRESULT getId(com::Guid &aId);
+    HRESULT getGroups(std::vector<com::Utf8Str> &aGroups);
+    HRESULT setGroups(const std::vector<com::Utf8Str> &aGroups);
+    HRESULT getOSTypeId(com::Utf8Str &aOSTypeId);
+    HRESULT setOSTypeId(const com::Utf8Str &aOSTypeId);
+    HRESULT getHardwareVersion(com::Utf8Str &aHardwareVersion);
+    HRESULT setHardwareVersion(const com::Utf8Str &aHardwareVersion);
+    HRESULT getHardwareUUID(com::Guid &aHardwareUUID);
+    HRESULT setHardwareUUID(const com::Guid &aHardwareUUID);
+    HRESULT getCPUCount(ULONG *aCPUCount);
+    HRESULT setCPUCount(ULONG aCPUCount);
+    HRESULT getCPUHotPlugEnabled(BOOL *aCPUHotPlugEnabled);
+    HRESULT setCPUHotPlugEnabled(BOOL aCPUHotPlugEnabled);
+    HRESULT getCPUExecutionCap(ULONG *aCPUExecutionCap);
+    HRESULT setCPUExecutionCap(ULONG aCPUExecutionCap);
+    HRESULT getCPUIDPortabilityLevel(ULONG *aCPUIDPortabilityLevel);
+    HRESULT setCPUIDPortabilityLevel(ULONG aCPUIDPortabilityLevel);
+    HRESULT getMemorySize(ULONG *aMemorySize);
+    HRESULT setMemorySize(ULONG aMemorySize);
+    HRESULT getMemoryBalloonSize(ULONG *aMemoryBalloonSize);
+    HRESULT setMemoryBalloonSize(ULONG aMemoryBalloonSize);
+    HRESULT getPageFusionEnabled(BOOL *aPageFusionEnabled);
+    HRESULT setPageFusionEnabled(BOOL aPageFusionEnabled);
+    HRESULT getGraphicsControllerType(GraphicsControllerType_T *aGraphicsControllerType);
+    HRESULT setGraphicsControllerType(GraphicsControllerType_T aGraphicsControllerType);
+    HRESULT getVRAMSize(ULONG *aVRAMSize);
+    HRESULT setVRAMSize(ULONG aVRAMSize);
+    HRESULT getAccelerate3DEnabled(BOOL *aAccelerate3DEnabled);
+    HRESULT setAccelerate3DEnabled(BOOL aAccelerate3DEnabled);
+    HRESULT getAccelerate2DVideoEnabled(BOOL *aAccelerate2DVideoEnabled);
+    HRESULT setAccelerate2DVideoEnabled(BOOL aAccelerate2DVideoEnabled);
+    HRESULT getMonitorCount(ULONG *aMonitorCount);
+    HRESULT setMonitorCount(ULONG aMonitorCount);
+    HRESULT getVideoCaptureEnabled(BOOL *aVideoCaptureEnabled);
+    HRESULT setVideoCaptureEnabled(BOOL aVideoCaptureEnabled);
+    HRESULT getVideoCaptureScreens(std::vector<BOOL> &aVideoCaptureScreens);
+    HRESULT setVideoCaptureScreens(const std::vector<BOOL> &aVideoCaptureScreens);
+    HRESULT getVideoCaptureFile(com::Utf8Str &aVideoCaptureFile);
+    HRESULT setVideoCaptureFile(const com::Utf8Str &aVideoCaptureFile);
+    HRESULT getVideoCaptureWidth(ULONG *aVideoCaptureWidth);
+    HRESULT setVideoCaptureWidth(ULONG aVideoCaptureWidth);
+    HRESULT getVideoCaptureHeight(ULONG *aVideoCaptureHeight);
+    HRESULT setVideoCaptureHeight(ULONG aVideoCaptureHeight);
+    HRESULT getVideoCaptureRate(ULONG *aVideoCaptureRate);
+    HRESULT setVideoCaptureRate(ULONG aVideoCaptureRate);
+    HRESULT getVideoCaptureFPS(ULONG *aVideoCaptureFPS);
+    HRESULT setVideoCaptureFPS(ULONG aVideoCaptureFPS);
+    HRESULT getVideoCaptureMaxTime(ULONG *aVideoCaptureMaxTime);
+    HRESULT setVideoCaptureMaxTime(ULONG aVideoCaptureMaxTime);
+    HRESULT getVideoCaptureMaxFileSize(ULONG *aVideoCaptureMaxFileSize);
+    HRESULT setVideoCaptureMaxFileSize(ULONG aVideoCaptureMaxFileSize);
+    HRESULT getVideoCaptureOptions(com::Utf8Str &aVideoCaptureOptions);
+    HRESULT setVideoCaptureOptions(const com::Utf8Str &aVideoCaptureOptions);
+    HRESULT getBIOSSettings(ComPtr<IBIOSSettings> &aBIOSSettings);
+    HRESULT getFirmwareType(FirmwareType_T *aFirmwareType);
+    HRESULT setFirmwareType(FirmwareType_T aFirmwareType);
+    HRESULT getPointingHIDType(PointingHIDType_T *aPointingHIDType);
+    HRESULT setPointingHIDType(PointingHIDType_T aPointingHIDType);
+    HRESULT getKeyboardHIDType(KeyboardHIDType_T *aKeyboardHIDType);
+    HRESULT setKeyboardHIDType(KeyboardHIDType_T aKeyboardHIDType);
+    HRESULT getHPETEnabled(BOOL *aHPETEnabled);
+    HRESULT setHPETEnabled(BOOL aHPETEnabled);
+    HRESULT getChipsetType(ChipsetType_T *aChipsetType);
+    HRESULT setChipsetType(ChipsetType_T aChipsetType);
+    HRESULT getSnapshotFolder(com::Utf8Str &aSnapshotFolder);
+    HRESULT setSnapshotFolder(const com::Utf8Str &aSnapshotFolder);
+    HRESULT getVRDEServer(ComPtr<IVRDEServer> &aVRDEServer);
+    HRESULT getEmulatedUSBCardReaderEnabled(BOOL *aEmulatedUSBCardReaderEnabled);
+    HRESULT setEmulatedUSBCardReaderEnabled(BOOL aEmulatedUSBCardReaderEnabled);
+    HRESULT getMediumAttachments(std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments);
+    HRESULT getUSBControllers(std::vector<ComPtr<IUSBController> > &aUSBControllers);
+    HRESULT getUSBDeviceFilters(ComPtr<IUSBDeviceFilters> &aUSBDeviceFilters);
+    HRESULT getAudioAdapter(ComPtr<IAudioAdapter> &aAudioAdapter);
+    HRESULT getStorageControllers(std::vector<ComPtr<IStorageController> > &aStorageControllers);
+    HRESULT getSettingsFilePath(com::Utf8Str &aSettingsFilePath);
+    HRESULT getSettingsModified(BOOL *aSettingsModified);
+    HRESULT getSessionState(SessionState_T *aSessionState);
+    HRESULT getSessionType(SessionType_T *aSessionType);
+    HRESULT getSessionName(com::Utf8Str &aSessionType);
+    HRESULT getSessionPID(ULONG *aSessionPID);
+    HRESULT getState(MachineState_T *aState);
+    HRESULT getLastStateChange(LONG64 *aLastStateChange);
+    HRESULT getStateFilePath(com::Utf8Str &aStateFilePath);
+    HRESULT getLogFolder(com::Utf8Str &aLogFolder);
+    HRESULT getCurrentSnapshot(ComPtr<ISnapshot> &aCurrentSnapshot);
+    HRESULT getSnapshotCount(ULONG *aSnapshotCount);
+    HRESULT getCurrentStateModified(BOOL *aCurrentStateModified);
+    HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
+    HRESULT getClipboardMode(ClipboardMode_T *aClipboardMode);
+    HRESULT setClipboardMode(ClipboardMode_T aClipboardMode);
+    HRESULT getDnDMode(DnDMode_T *aDnDMode);
+    HRESULT setDnDMode(DnDMode_T aDnDMode);
+    HRESULT getGuestPropertyNotificationPatterns(com::Utf8Str &aGuestPropertyNotificationPatterns);
+    HRESULT setGuestPropertyNotificationPatterns(const com::Utf8Str &aGuestPropertyNotificationPatterns);
+    HRESULT getTeleporterEnabled(BOOL *aTeleporterEnabled);
+    HRESULT setTeleporterEnabled(BOOL aTeleporterEnabled);
+    HRESULT getTeleporterPort(ULONG *aTeleporterPort);
+    HRESULT setTeleporterPort(ULONG aTeleporterPort);
+    HRESULT getTeleporterAddress(com::Utf8Str &aTeleporterAddress);
+    HRESULT setTeleporterAddress(const com::Utf8Str &aTeleporterAddress);
+    HRESULT getTeleporterPassword(com::Utf8Str &aTeleporterPassword);
+    HRESULT setTeleporterPassword(const com::Utf8Str &aTeleporterPassword);
+    HRESULT getParavirtProvider(ParavirtProvider_T *aParavirtProvider);
+    HRESULT setParavirtProvider(ParavirtProvider_T aParavirtProvider);
+    HRESULT getFaultToleranceState(FaultToleranceState_T *aFaultToleranceState);
+    HRESULT setFaultToleranceState(FaultToleranceState_T aFaultToleranceState);
+    HRESULT getFaultTolerancePort(ULONG *aFaultTolerancePort);
+    HRESULT setFaultTolerancePort(ULONG aFaultTolerancePort);
+    HRESULT getFaultToleranceAddress(com::Utf8Str &aFaultToleranceAddress);
+    HRESULT setFaultToleranceAddress(const com::Utf8Str &aFaultToleranceAddress);
+    HRESULT getFaultTolerancePassword(com::Utf8Str &aFaultTolerancePassword);
+    HRESULT setFaultTolerancePassword(const com::Utf8Str &aFaultTolerancePassword);
+    HRESULT getFaultToleranceSyncInterval(ULONG *aFaultToleranceSyncInterval);
+    HRESULT setFaultToleranceSyncInterval(ULONG aFaultToleranceSyncInterval);
+    HRESULT getRTCUseUTC(BOOL *aRTCUseUTC);
+    HRESULT setRTCUseUTC(BOOL aRTCUseUTC);
+    HRESULT getIOCacheEnabled(BOOL *aIOCacheEnabled);
+    HRESULT setIOCacheEnabled(BOOL aIOCacheEnabled);
+    HRESULT getIOCacheSize(ULONG *aIOCacheSize);
+    HRESULT setIOCacheSize(ULONG aIOCacheSize);
+    HRESULT getPCIDeviceAssignments(std::vector<ComPtr<IPCIDeviceAttachment> > &aPCIDeviceAssignments);
+    HRESULT getBandwidthControl(ComPtr<IBandwidthControl> &aBandwidthControl);
+    HRESULT getTracingEnabled(BOOL *aTracingEnabled);
+    HRESULT setTracingEnabled(BOOL aTracingEnabled);
+    HRESULT getTracingConfig(com::Utf8Str &aTracingConfig);
+    HRESULT setTracingConfig(const com::Utf8Str &aTracingConfig);
+    HRESULT getAllowTracingToAccessVM(BOOL *aAllowTracingToAccessVM);
+    HRESULT setAllowTracingToAccessVM(BOOL aAllowTracingToAccessVM);
+    HRESULT getAutostartEnabled(BOOL *aAutostartEnabled);
+    HRESULT setAutostartEnabled(BOOL aAutostartEnabled);
+    HRESULT getAutostartDelay(ULONG *aAutostartDelay);
+    HRESULT setAutostartDelay(ULONG aAutostartDelay);
+    HRESULT getAutostopType(AutostopType_T *aAutostopType);
+    HRESULT setAutostopType(AutostopType_T aAutostopType);
+    HRESULT getDefaultFrontend(com::Utf8Str &aDefaultFrontend);
+    HRESULT setDefaultFrontend(const com::Utf8Str &aDefaultFrontend);
+    HRESULT getUSBProxyAvailable(BOOL *aUSBProxyAvailable);
+
+    // wrapped IMachine methods
+    HRESULT lockMachine(const ComPtr<ISession> &aSession,
+                        LockType_T aLockType);
+    HRESULT launchVMProcess(const ComPtr<ISession> &aSession,
+                            const com::Utf8Str &aType,
+                            const com::Utf8Str &aEnvironment,
+                            ComPtr<IProgress> &aProgress);
+    HRESULT setBootOrder(ULONG aPosition,
+                         DeviceType_T aDevice);
+    HRESULT getBootOrder(ULONG aPosition,
+                         DeviceType_T *aDevice);
+    HRESULT attachDevice(const com::Utf8Str &aName,
+                         LONG aControllerPort,
+                         LONG aDevice,
+                         DeviceType_T aType,
+                         const ComPtr<IMedium> &aMedium);
+    HRESULT attachDeviceWithoutMedium(const com::Utf8Str &aName,
+                                      LONG aControllerPort,
+                                      LONG aDevice,
+                                      DeviceType_T aType);
+    HRESULT detachDevice(const com::Utf8Str &aName,
+                         LONG aControllerPort,
+                         LONG aDevice);
+    HRESULT passthroughDevice(const com::Utf8Str &aName,
+                              LONG aControllerPort,
+                              LONG aDevice,
+                              BOOL aPassthrough);
+    HRESULT temporaryEjectDevice(const com::Utf8Str &aName,
+                                 LONG aControllerPort,
+                                 LONG aDevice,
+                                 BOOL aTemporaryEject);
+    HRESULT nonRotationalDevice(const com::Utf8Str &aName,
+                                LONG aControllerPort,
+                                LONG aDevice,
+                                BOOL aNonRotational);
+    HRESULT setAutoDiscardForDevice(const com::Utf8Str &aName,
+                                    LONG aControllerPort,
+                                    LONG aDevice,
+                                    BOOL aDiscard);
+    HRESULT setHotPluggableForDevice(const com::Utf8Str &aName,
+                                     LONG aControllerPort,
+                                     LONG aDevice,
+                                     BOOL aHotPluggable);
+    HRESULT setBandwidthGroupForDevice(const com::Utf8Str &aName,
+                                       LONG aControllerPort,
+                                       LONG aDevice,
+                                       const ComPtr<IBandwidthGroup> &aBandwidthGroup);
+    HRESULT setNoBandwidthGroupForDevice(const com::Utf8Str &aName,
+                                         LONG aControllerPort,
+                                         LONG aDevice);
+    HRESULT unmountMedium(const com::Utf8Str &aName,
+                          LONG aControllerPort,
+                          LONG aDevice,
+                          BOOL aForce);
+    HRESULT mountMedium(const com::Utf8Str &aName,
+                        LONG aControllerPort,
+                        LONG aDevice,
+                        const ComPtr<IMedium> &aMedium,
+                        BOOL aForce);
+    HRESULT getMedium(const com::Utf8Str &aName,
+                      LONG aControllerPort,
+                      LONG aDevice,
+                      ComPtr<IMedium> &aMedium);
+    HRESULT getMediumAttachmentsOfController(const com::Utf8Str &aName,
+                                             std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments);
+    HRESULT getMediumAttachment(const com::Utf8Str &aName,
+                                LONG aControllerPort,
+                                LONG aDevice,
+                                ComPtr<IMediumAttachment> &aAttachment);
+    HRESULT attachHostPCIDevice(LONG aHostAddress,
+                                LONG aDesiredGuestAddress,
+                                BOOL aTryToUnbind);
+    HRESULT detachHostPCIDevice(LONG aHostAddress);
+    HRESULT getNetworkAdapter(ULONG aSlot,
+                              ComPtr<INetworkAdapter> &aAdapter);
+    HRESULT addStorageController(const com::Utf8Str &aName,
+                                 StorageBus_T aConnectionType,
+                                 ComPtr<IStorageController> &aController);
+    HRESULT getStorageControllerByName(const com::Utf8Str &aName,
+                                       ComPtr<IStorageController> &aStorageController);
+    HRESULT getStorageControllerByInstance(ULONG aInstance,
+                                           ComPtr<IStorageController> &aStorageController);
+    HRESULT removeStorageController(const com::Utf8Str &aName);
+    HRESULT setStorageControllerBootable(const com::Utf8Str &aName,
+                                         BOOL aBootable);
+    HRESULT addUSBController(const com::Utf8Str &aName,
+                             USBControllerType_T aType,
+                             ComPtr<IUSBController> &aController);
+    HRESULT removeUSBController(const com::Utf8Str &aName);
+    HRESULT getUSBControllerByName(const com::Utf8Str &aName,
+                                   ComPtr<IUSBController> &aController);
+    HRESULT getUSBControllerCountByType(USBControllerType_T aType,
+                                        ULONG *aControllers);
+    HRESULT getSerialPort(ULONG aSlot,
+                          ComPtr<ISerialPort> &aPort);
+    HRESULT getParallelPort(ULONG aSlot,
+                            ComPtr<IParallelPort> &aPort);
+    HRESULT getExtraDataKeys(std::vector<com::Utf8Str> &aKeys);
+    HRESULT getExtraData(const com::Utf8Str &aKey,
+                         com::Utf8Str &aValue);
+    HRESULT setExtraData(const com::Utf8Str &aKey,
+                         const com::Utf8Str &aValue);
+    HRESULT getCPUProperty(CPUPropertyType_T aProperty,
+                           BOOL *aValue);
+    HRESULT setCPUProperty(CPUPropertyType_T aProperty,
+                           BOOL aValue);
+    HRESULT getCPUIDLeaf(ULONG aId,
+                         ULONG *aValEax,
+                         ULONG *aValEbx,
+                         ULONG *aValEcx,
+                         ULONG *aValEdx);
+    HRESULT setCPUIDLeaf(ULONG aId,
+                         ULONG aValEax,
+                         ULONG aValEbx,
+                         ULONG aValEcx,
+                         ULONG aValEdx);
+    HRESULT removeCPUIDLeaf(ULONG aId);
+    HRESULT removeAllCPUIDLeaves();
+    HRESULT getHWVirtExProperty(HWVirtExPropertyType_T aProperty,
+                                BOOL *aValue);
+    HRESULT setHWVirtExProperty(HWVirtExPropertyType_T aProperty,
+                                BOOL aValue);
+    HRESULT setSettingsFilePath(const com::Utf8Str &aSettingsFilePath,
+                                ComPtr<IProgress> &aProgress);
+    HRESULT saveSettings();
+    HRESULT discardSettings();
+    HRESULT unregister(AutoCaller &aAutoCaller,
+                       CleanupMode_T aCleanupMode,
+                       std::vector<ComPtr<IMedium> > &aMedia);
+    HRESULT deleteConfig(const std::vector<ComPtr<IMedium> > &aMedia,
+                         ComPtr<IProgress> &aProgress);
+    HRESULT exportTo(const ComPtr<IAppliance> &aAppliance,
+                     const com::Utf8Str &aLocation,
+                     ComPtr<IVirtualSystemDescription> &aDescription);
+    HRESULT findSnapshot(const com::Utf8Str &aNameOrId,
+                         ComPtr<ISnapshot> &aSnapshot);
+    HRESULT createSharedFolder(const com::Utf8Str &aName,
+                               const com::Utf8Str &aHostPath,
+                               BOOL aWritable,
+                               BOOL aAutomount);
+    HRESULT removeSharedFolder(const com::Utf8Str &aName);
+    HRESULT canShowConsoleWindow(BOOL *aCanShow);
+    HRESULT showConsoleWindow(LONG64 *aWinId);
+    HRESULT getGuestProperty(const com::Utf8Str &aName,
+                             com::Utf8Str &aValue,
+                             LONG64 *aTimestamp,
+                             com::Utf8Str &aFlags);
+    HRESULT getGuestPropertyValue(const com::Utf8Str &aProperty,
+                                  com::Utf8Str &aValue);
+    HRESULT getGuestPropertyTimestamp(const com::Utf8Str &aProperty,
+                                      LONG64 *aValue);
+    HRESULT setGuestProperty(const com::Utf8Str &aProperty,
+                             const com::Utf8Str &aValue,
+                             const com::Utf8Str &aFlags);
+    HRESULT setGuestPropertyValue(const com::Utf8Str &aProperty,
+                                  const com::Utf8Str &aValue);
+    HRESULT deleteGuestProperty(const com::Utf8Str &aName);
+    HRESULT enumerateGuestProperties(const com::Utf8Str &aPatterns,
+                                     std::vector<com::Utf8Str> &aNames,
+                                     std::vector<com::Utf8Str> &aValues,
+                                     std::vector<LONG64> &aTimestamps,
+                                     std::vector<com::Utf8Str> &aFlags);
+    HRESULT querySavedGuestScreenInfo(ULONG aScreenId,
+                                      ULONG *aOriginX,
+                                      ULONG *aOriginY,
+                                      ULONG *aWidth,
+                                      ULONG *aHeight,
+                                      BOOL *aEnabled);
+    HRESULT readSavedThumbnailToArray(ULONG aScreenId,
+                                      BitmapFormat_T aBitmapFormat,
+                                      ULONG *aWidth,
+                                      ULONG *aHeight,
+                                      std::vector<BYTE> &aData);
+    HRESULT querySavedScreenshotInfo(ULONG aScreenId,
+                                     ULONG *aWidth,
+                                     ULONG *aHeight,
+                                     std::vector<BitmapFormat_T> &aBitmapFormats);
+    HRESULT readSavedScreenshotToArray(ULONG aScreenId,
+                                       BitmapFormat_T aBitmapFormat,
+                                       ULONG *aWidth,
+                                       ULONG *aHeight,
+                                       std::vector<BYTE> &aData);
+
+    HRESULT hotPlugCPU(ULONG aCpu);
+    HRESULT hotUnplugCPU(ULONG aCpu);
+    HRESULT getCPUStatus(ULONG aCpu,
+                         BOOL *aAttached);
+    HRESULT getEffectiveParavirtProvider(ParavirtProvider_T *aParavirtProvider);
+    HRESULT queryLogFilename(ULONG aIdx,
+                             com::Utf8Str &aFilename);
+    HRESULT readLog(ULONG aIdx,
+                    LONG64 aOffset,
+                    LONG64 aSize,
+                    std::vector<BYTE> &aData);
+    HRESULT cloneTo(const ComPtr<IMachine> &aTarget,
+                    CloneMode_T aMode,
+                    const std::vector<CloneOptions_T> &aOptions,
+                    ComPtr<IProgress> &aProgress);
+    HRESULT saveState(ComPtr<IProgress> &aProgress);
+    HRESULT adoptSavedState(const com::Utf8Str &aSavedStateFile);
+    HRESULT discardSavedState(BOOL aFRemoveFile);
+    HRESULT takeSnapshot(const com::Utf8Str &aName,
+                         const com::Utf8Str &aDescription,
+                         BOOL aPause,
+                         ComPtr<IProgress> &aProgress);
+    HRESULT deleteSnapshot(const com::Guid &aId,
+                           ComPtr<IProgress> &aProgress);
+    HRESULT deleteSnapshotAndAllChildren(const com::Guid &aId,
+                                         ComPtr<IProgress> &aProgress);
+    HRESULT deleteSnapshotRange(const com::Guid &aStartId,
+                                const com::Guid &aEndId,
+                                ComPtr<IProgress> &aProgress);
+    HRESULT restoreSnapshot(const ComPtr<ISnapshot> &aSnapshot,
+                            ComPtr<IProgress> &aProgress);
+
+    // wrapped IInternalMachineControl properties
+
+    // wrapped IInternalMachineControl methods
+    HRESULT updateState(MachineState_T aState);
+    HRESULT beginPowerUp(const ComPtr<IProgress> &aProgress);
+    HRESULT endPowerUp(LONG aResult);
+    HRESULT beginPoweringDown(ComPtr<IProgress> &aProgress);
+    HRESULT endPoweringDown(LONG aResult,
+                            const com::Utf8Str &aErrMsg);
+    HRESULT runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice,
+                                BOOL *aMatched,
+                                ULONG *aMaskedInterfaces);
+    HRESULT captureUSBDevice(const com::Guid &aId,
+                             const com::Utf8Str &aCaptureFilename);
+    HRESULT detachUSBDevice(const com::Guid &aId,
+                            BOOL aDone);
+    HRESULT autoCaptureUSBDevices();
+    HRESULT detachAllUSBDevices(BOOL aDone);
+    HRESULT onSessionEnd(const ComPtr<ISession> &aSession,
+                         ComPtr<IProgress> &aProgress);
+    HRESULT finishOnlineMergeMedium();
+    HRESULT pullGuestProperties(std::vector<com::Utf8Str> &aNames,
+                                std::vector<com::Utf8Str> &aValues,
+                                std::vector<LONG64> &aTimestamps,
+                                std::vector<com::Utf8Str> &aFlags);
+    HRESULT pushGuestProperty(const com::Utf8Str &aName,
+                              const com::Utf8Str &aValue,
+                              LONG64 aTimestamp,
+                              const com::Utf8Str &aFlags,
+                              BOOL *aNotify);
+    HRESULT lockMedia();
+    HRESULT unlockMedia();
+    HRESULT ejectMedium(const ComPtr<IMediumAttachment> &aAttachment,
+                        ComPtr<IMediumAttachment> &aNewAttachment);
+    HRESULT reportVmStatistics(ULONG aValidStats,
+                               ULONG aCpuUser,
+                               ULONG aCpuKernel,
+                               ULONG aCpuIdle,
+                               ULONG aMemTotal,
+                               ULONG aMemFree,
+                               ULONG aMemBalloon,
+                               ULONG aMemShared,
+                               ULONG aMemCache,
+                               ULONG aPagedTotal,
+                               ULONG aMemAllocTotal,
+                               ULONG aMemFreeTotal,
+                               ULONG aMemBalloonTotal,
+                               ULONG aMemSharedTotal,
+                               ULONG aVmNetRx,
+                               ULONG aVmNetTx);
 };
 
 // SessionMachine class
@@ -1017,8 +1267,7 @@ protected:
  *  instance is also locked in the same lock mode. Keep it in mind.
  */
 class ATL_NO_VTABLE SessionMachine :
-    public Machine,
-    VBOX_SCRIPTABLE_IMPL(IInternalMachineControl)
+    public Machine
 {
 public:
     VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SessionMachine, IMachine)
@@ -1051,167 +1300,200 @@ public:
     // util::Lockable interface
     RWLockHandle *lockHandle() const;
 
-    // IInternalMachineControl methods
-    STDMETHOD(SetRemoveSavedStateFile)(BOOL aRemove);
-    STDMETHOD(UpdateState)(MachineState_T machineState);
-    STDMETHOD(BeginPowerUp)(IProgress *aProgress);
-    STDMETHOD(EndPowerUp)(LONG iResult);
-    STDMETHOD(BeginPoweringDown)(IProgress **aProgress);
-    STDMETHOD(EndPoweringDown)(LONG aResult, IN_BSTR aErrMsg);
-    STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs);
-    STDMETHOD(CaptureUSBDevice)(IN_BSTR aId);
-    STDMETHOD(DetachUSBDevice)(IN_BSTR aId, BOOL aDone);
-    STDMETHOD(AutoCaptureUSBDevices)();
-    STDMETHOD(DetachAllUSBDevices)(BOOL aDone);
-    STDMETHOD(OnSessionEnd)(ISession *aSession, IProgress **aProgress);
-    STDMETHOD(BeginSavingState)(IProgress **aProgress, BSTR *aStateFilePath);
-    STDMETHOD(EndSavingState)(LONG aResult, IN_BSTR aErrMsg);
-    STDMETHOD(AdoptSavedState)(IN_BSTR aSavedStateFile);
-    STDMETHOD(BeginTakingSnapshot)(IConsole *aInitiator,
-                                   IN_BSTR aName,
-                                   IN_BSTR aDescription,
-                                   IProgress *aConsoleProgress,
-                                   BOOL fTakingSnapshotOnline,
-                                   BSTR *aStateFilePath);
-    STDMETHOD(EndTakingSnapshot)(BOOL aSuccess);
-    STDMETHOD(DeleteSnapshot)(IConsole *aInitiator, IN_BSTR aStartId,
-                              IN_BSTR aEndID, BOOL fDeleteAllChildren,
-                              MachineState_T *aMachineState, IProgress **aProgress);
-    STDMETHOD(FinishOnlineMergeMedium)();
-    STDMETHOD(RestoreSnapshot)(IConsole *aInitiator,
-                               ISnapshot *aSnapshot,
-                               MachineState_T *aMachineState,
-                               IProgress **aProgress);
-    STDMETHOD(PullGuestProperties)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(BSTR, aValues),
-              ComSafeArrayOut(LONG64, aTimestamps), ComSafeArrayOut(BSTR, aFlags));
-    STDMETHOD(PushGuestProperty)(IN_BSTR aName, IN_BSTR aValue,
-                                  LONG64 aTimestamp, IN_BSTR aFlags);
-    STDMETHOD(LockMedia)();
-    STDMETHOD(UnlockMedia)();
-    STDMETHOD(EjectMedium)(IMediumAttachment *aAttachment,
-                           IMediumAttachment **aNewAttachment);
-    STDMETHOD(ReportVmStatistics)(ULONG aValidStats, ULONG aCpuUser,
-                                  ULONG aCpuKernel, ULONG aCpuIdle,
-                                  ULONG aMemTotal, ULONG aMemFree,
-                                  ULONG aMemBalloon, ULONG aMemShared,
-                                  ULONG aMemCache, ULONG aPageTotal,
-                                  ULONG aAllocVMM, ULONG aFreeVMM,
-                                  ULONG aBalloonedVMM, ULONG aSharedVMM,
-                                  ULONG aVmNetRx, ULONG aVmNetTx);
-
     // public methods only for internal purposes
 
-    virtual bool isSessionMachine() const
+    virtual bool i_isSessionMachine() const
     {
         return true;
     }
 
 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
-    bool checkForDeath();
+    bool i_checkForDeath();
 
-    void getTokenId(Utf8Str &strTokenId);
+    void i_getTokenId(Utf8Str &strTokenId);
 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-    IToken *getToken();
+    IToken *i_getToken();
 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
     // getClientToken must be only used by callers who can guarantee that
     // the object cannot be deleted in the mean time, i.e. have a caller/lock.
-    ClientToken *getClientToken();
-
-    HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
-    HRESULT onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
-                                 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort);
-    HRESULT onStorageControllerChange();
-    HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
-    HRESULT onSerialPortChange(ISerialPort *serialPort);
-    HRESULT onParallelPortChange(IParallelPort *parallelPort);
-    HRESULT onCPUChange(ULONG aCPU, BOOL aRemove);
-    HRESULT onVRDEServerChange(BOOL aRestart);
-    HRESULT onVideoCaptureChange();
-    HRESULT onUSBControllerChange();
-    HRESULT onUSBDeviceAttach(IUSBDevice *aDevice,
-                              IVirtualBoxErrorInfo *aError,
-                              ULONG aMaskedIfs);
-    HRESULT onUSBDeviceDetach(IN_BSTR aId,
-                              IVirtualBoxErrorInfo *aError);
-    HRESULT onSharedFolderChange();
-    HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode);
-    HRESULT onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode);
-    HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
-    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
-    HRESULT onCPUExecutionCapChange(ULONG aCpuExecutionCap);
-
-    bool hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
+    ClientToken *i_getClientToken();
+
+    HRESULT i_onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
+    HRESULT i_onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
+                                      NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort,
+                                      IN_BSTR aGuestIp, LONG aGuestPort);
+    HRESULT i_onStorageControllerChange();
+    HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
+    HRESULT i_onSerialPortChange(ISerialPort *serialPort);
+    HRESULT i_onParallelPortChange(IParallelPort *parallelPort);
+    HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove);
+    HRESULT i_onVRDEServerChange(BOOL aRestart);
+    HRESULT i_onVideoCaptureChange();
+    HRESULT i_onUSBControllerChange();
+    HRESULT i_onUSBDeviceAttach(IUSBDevice *aDevice,
+                                IVirtualBoxErrorInfo *aError,
+                                ULONG aMaskedIfs,
+                                const com::Utf8Str &aCaptureFilename);
+    HRESULT i_onUSBDeviceDetach(IN_BSTR aId,
+                                IVirtualBoxErrorInfo *aError);
+    HRESULT i_onSharedFolderChange();
+    HRESULT i_onClipboardModeChange(ClipboardMode_T aClipboardMode);
+    HRESULT i_onDnDModeChange(DnDMode_T aDnDMode);
+    HRESULT i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
+    HRESULT i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
+    HRESULT i_onCPUExecutionCapChange(ULONG aCpuExecutionCap);
+
+    bool i_hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
+
+    HRESULT i_lockMedia();
+    HRESULT i_unlockMedia();
+
+    HRESULT i_saveStateWithReason(Reason_T aReason, ComPtr<IProgress> &aProgress);
+
+private:
 
+    // wrapped IInternalMachineControl properties
+
+    // wrapped IInternalMachineControl methods
+    HRESULT setRemoveSavedStateFile(BOOL aRemove);
+    HRESULT updateState(MachineState_T aState);
+    HRESULT beginPowerUp(const ComPtr<IProgress> &aProgress);
+    HRESULT endPowerUp(LONG aResult);
+    HRESULT beginPoweringDown(ComPtr<IProgress> &aProgress);
+    HRESULT endPoweringDown(LONG aResult,
+                            const com::Utf8Str &aErrMsg);
+    HRESULT runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice,
+                                BOOL *aMatched,
+                                ULONG *aMaskedInterfaces);
+    HRESULT captureUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename);
+    HRESULT detachUSBDevice(const com::Guid &aId,
+                            BOOL aDone);
+    HRESULT autoCaptureUSBDevices();
+    HRESULT detachAllUSBDevices(BOOL aDone);
+    HRESULT onSessionEnd(const ComPtr<ISession> &aSession,
+                         ComPtr<IProgress> &aProgress);
+    HRESULT finishOnlineMergeMedium();
+    HRESULT pullGuestProperties(std::vector<com::Utf8Str> &aNames,
+                                std::vector<com::Utf8Str> &aValues,
+                                std::vector<LONG64> &aTimestamps,
+                                std::vector<com::Utf8Str> &aFlags);
+    HRESULT pushGuestProperty(const com::Utf8Str &aName,
+                              const com::Utf8Str &aValue,
+                              LONG64 aTimestamp,
+                              const com::Utf8Str &aFlags,
+                              BOOL *aNotify);
     HRESULT lockMedia();
-    void unlockMedia();
+    HRESULT unlockMedia();
+    HRESULT ejectMedium(const ComPtr<IMediumAttachment> &aAttachment,
+                        ComPtr<IMediumAttachment> &aNewAttachment);
+    HRESULT reportVmStatistics(ULONG aValidStats,
+                               ULONG aCpuUser,
+                               ULONG aCpuKernel,
+                               ULONG aCpuIdle,
+                               ULONG aMemTotal,
+                               ULONG aMemFree,
+                               ULONG aMemBalloon,
+                               ULONG aMemShared,
+                               ULONG aMemCache,
+                               ULONG aPagedTotal,
+                               ULONG aMemAllocTotal,
+                               ULONG aMemFreeTotal,
+                               ULONG aMemBalloonTotal,
+                               ULONG aMemSharedTotal,
+                               ULONG aVmNetRx,
+                               ULONG aVmNetTx);
 
-private:
 
     struct ConsoleTaskData
     {
         ConsoleTaskData()
-            : mLastState(MachineState_Null), mDeleteSnapshotInfo(NULL)
+            : mLastState(MachineState_Null),
+              mDeleteSnapshotInfo(NULL)
         { }
 
         MachineState_T mLastState;
         ComObjPtr<Progress> mProgress;
 
-        // used when taking snapshot
-        ComObjPtr<Snapshot> mSnapshot;
-
-        // used when deleting online snapshot
+        // used when deleting online snaphshot
         void *mDeleteSnapshotInfo;
-
-        // used when saving state (either as part of a snapshot or separate)
-        Utf8Str strStateFilePath;
     };
 
+    struct SaveStateTask;
     struct SnapshotTask;
+    struct TakeSnapshotTask;
     struct DeleteSnapshotTask;
     struct RestoreSnapshotTask;
 
+    friend struct TakeSnapshotTask;
     friend struct DeleteSnapshotTask;
     friend struct RestoreSnapshotTask;
 
-    HRESULT endSavingState(HRESULT aRC, const Utf8Str &aErrMsg);
-    void releaseSavedStateFile(const Utf8Str &strSavedStateFile, Snapshot *pSnapshotToIgnore);
-
-    void deleteSnapshotHandler(DeleteSnapshotTask &aTask);
-    void restoreSnapshotHandler(RestoreSnapshotTask &aTask);
-
-    HRESULT prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
-                                        const Guid &machineId,
-                                        const Guid &snapshotId,
-                                        bool fOnlineMergePossible,
-                                        MediumLockList *aVMMALockList,
-                                        ComObjPtr<Medium> &aSource,
-                                        ComObjPtr<Medium> &aTarget,
-                                        bool &fMergeForward,
-                                        ComObjPtr<Medium> &pParentForTarget,
-                                        MediumLockList * &aChildrenToReparent,
-                                        bool &fNeedOnlineMerge,
-                                        MediumLockList * &aMediumLockList,
-                                        ComPtr<IToken> &aHDLockToken);
-    void cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
-                                    const ComObjPtr<Medium> &aSource,
-                                    MediumLockList *aChildrenToReparent,
-                                    bool fNeedsOnlineMerge,
-                                    MediumLockList *aMediumLockList,
-                                    const ComPtr<IToken> &aHDLockToken,
-                                    const Guid &aMediumId,
-                                    const Guid &aSnapshotId);
-    HRESULT onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,
-                              const ComObjPtr<Medium> &aSource,
-                              const ComObjPtr<Medium> &aTarget,
-                              bool fMergeForward,
-                              const ComObjPtr<Medium> &pParentForTarget,
-                              MediumLockList *aChildrenToReparent,
-                              MediumLockList *aMediumLockList,
-                              ComObjPtr<Progress> &aProgress,
-                              bool *pfNeedsMachineSaveSettings);
-
-    HRESULT setMachineState(MachineState_T aMachineState);
-    HRESULT updateMachineStateOnClient();
+    void i_saveStateHandler(SaveStateTask &aTask);
+
+    // Override some functionality for SessionMachine, this is where the
+    // real action happens (the Machine methods are just dummies).
+    HRESULT saveState(ComPtr<IProgress> &aProgress);
+    HRESULT adoptSavedState(const com::Utf8Str &aSavedStateFile);
+    HRESULT discardSavedState(BOOL aFRemoveFile);
+    HRESULT takeSnapshot(const com::Utf8Str &aName,
+                         const com::Utf8Str &aDescription,
+                         BOOL aPause,
+                         ComPtr<IProgress> &aProgress);
+    HRESULT deleteSnapshot(const com::Guid &aId,
+                           ComPtr<IProgress> &aProgress);
+    HRESULT deleteSnapshotAndAllChildren(const com::Guid &aId,
+                                         ComPtr<IProgress> &aProgress);
+    HRESULT deleteSnapshotRange(const com::Guid &aStartId,
+                                const com::Guid &aEndId,
+                                ComPtr<IProgress> &aProgress);
+    HRESULT restoreSnapshot(const ComPtr<ISnapshot> &aSnapshot,
+                            ComPtr<IProgress> &aProgress);
+
+    void i_releaseSavedStateFile(const Utf8Str &strSavedStateFile, Snapshot *pSnapshotToIgnore);
+
+    void i_takeSnapshotHandler(TakeSnapshotTask &aTask);
+    static void i_takeSnapshotProgressCancelCallback(void *pvUser);
+    HRESULT i_finishTakingSnapshot(TakeSnapshotTask &aTask, AutoWriteLock &alock, bool aSuccess);
+    HRESULT i_deleteSnapshot(const com::Guid &aStartId,
+                             const com::Guid &aEndId,
+                             BOOL aDeleteAllChildren,
+                             ComPtr<IProgress> &aProgress);
+    void i_deleteSnapshotHandler(DeleteSnapshotTask &aTask);
+    void i_restoreSnapshotHandler(RestoreSnapshotTask &aTask);
+
+    HRESULT i_prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
+                                          const Guid &machineId,
+                                          const Guid &snapshotId,
+                                          bool fOnlineMergePossible,
+                                          MediumLockList *aVMMALockList,
+                                          ComObjPtr<Medium> &aSource,
+                                          ComObjPtr<Medium> &aTarget,
+                                          bool &fMergeForward,
+                                          ComObjPtr<Medium> &pParentForTarget,
+                                          MediumLockList * &aChildrenToReparent,
+                                          bool &fNeedOnlineMerge,
+                                          MediumLockList * &aMediumLockList,
+                                          ComPtr<IToken> &aHDLockToken);
+    void i_cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
+                                      const ComObjPtr<Medium> &aSource,
+                                      MediumLockList *aChildrenToReparent,
+                                      bool fNeedsOnlineMerge,
+                                      MediumLockList *aMediumLockList,
+                                      const ComPtr<IToken> &aHDLockToken,
+                                      const Guid &aMediumId,
+                                      const Guid &aSnapshotId);
+    HRESULT i_onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,
+                                const ComObjPtr<Medium> &aSource,
+                                const ComObjPtr<Medium> &aTarget,
+                                bool fMergeForward,
+                                const ComObjPtr<Medium> &pParentForTarget,
+                                MediumLockList *aChildrenToReparent,
+                                MediumLockList *aMediumLockList,
+                                ComObjPtr<Progress> &aProgress,
+                                bool *pfNeedsMachineSaveSettings);
+
+    HRESULT i_setMachineState(MachineState_T aMachineState);
+    HRESULT i_updateMachineStateOnClient();
 
     bool mRemoveSavedState;
 
@@ -1221,8 +1503,6 @@ private:
     ClientToken *mClientToken;
 
     int miNATNetworksStarted;
-
-    static DECLCALLBACK(int) taskHandler(RTTHREAD thread, void *pvUser);
 };
 
 // SnapshotMachine class
@@ -1273,17 +1553,17 @@ public:
 
     // public methods only for internal purposes
 
-    virtual bool isSnapshotMachine() const
+    virtual bool i_isSnapshotMachine() const
     {
         return true;
     }
 
-    HRESULT onSnapshotChange(Snapshot *aSnapshot);
+    HRESULT i_onSnapshotChange(Snapshot *aSnapshot);
 
     // unsafe inline public methods for internal purposes only (ensure there is
     // a caller and a read lock before calling them!)
 
-    const Guid& getSnapshotId() const { return mSnapshotId; }
+    const Guid& i_getSnapshotId() const { return mSnapshotId; }
 
 private:
 
@@ -1298,10 +1578,10 @@ private:
 
 // third party methods that depend on SnapshotMachine definition
 
-inline const Guid &Machine::getSnapshotId() const
+inline const Guid &Machine::i_getSnapshotId() const
 {
-    return (isSnapshotMachine())
-                ? static_cast<const SnapshotMachine*>(this)->getSnapshotId()
+    return (i_isSnapshotMachine())
+                ? static_cast<const SnapshotMachine*>(this)->i_getSnapshotId()
                 : Guid::Empty;
 }
 
diff --git a/src/VBox/Main/include/MachineImplCloneVM.h b/src/VBox/Main/include/MachineImplCloneVM.h
index 6fa79a2..89b0e34 100644
--- a/src/VBox/Main/include/MachineImplCloneVM.h
+++ b/src/VBox/Main/include/MachineImplCloneVM.h
@@ -1,3 +1,4 @@
+/* $Id: MachineImplCloneVM.h $ */
 /** @file
  * Definition of MachineCloneVM
  */
diff --git a/src/VBox/Main/include/Matching.h b/src/VBox/Main/include/Matching.h
index 2f01f69..7f6b8f6 100644
--- a/src/VBox/Main/include/Matching.h
+++ b/src/VBox/Main/include/Matching.h
@@ -1,3 +1,4 @@
+/* $Id: Matching.h $ */
 /** @file
  *
  * Declaration of template classes that provide simple API to
diff --git a/src/VBox/Main/include/MediumAttachmentImpl.h b/src/VBox/Main/include/MediumAttachmentImpl.h
index 1f3f3d3..28ab860 100644
--- a/src/VBox/Main/include/MediumAttachmentImpl.h
+++ b/src/VBox/Main/include/MediumAttachmentImpl.h
@@ -1,3 +1,4 @@
+/* $Id:  $ */
 /** @file
  *
  * VirtualBox COM class implementation
@@ -18,26 +19,17 @@
 #ifndef ____H_MEDIUMATTACHMENTIMPL
 #define ____H_MEDIUMATTACHMENTIMPL
 
-#include "VirtualBoxBase.h"
-#include "BandwidthGroupImpl.h"
+#include "MediumAttachmentWrap.h"
 
 class ATL_NO_VTABLE MediumAttachment :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IMediumAttachment)
+    public MediumAttachmentWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumAttachment, IMediumAttachment)
 
-    DECLARE_NOT_AGGREGATABLE(MediumAttachment)
+    DECLARE_EMPTY_CTOR_DTOR(MediumAttachment)
 
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(MediumAttachment)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IMediumAttachment)
-    END_COM_MAP()
-
-    MediumAttachment() { };
-    ~MediumAttachment() { };
+    HRESULT FinalConstruct();
+    void FinalRelease();
 
     // public initializer/uninitializer for internal purposes only
     HRESULT init(Machine *aParent,
@@ -56,76 +48,74 @@ public:
     HRESULT initCopy(Machine *aParent, MediumAttachment *aThat);
     void uninit();
 
-    HRESULT FinalConstruct();
-    void FinalRelease();
-
-    // IMediumAttachment properties
-    STDMETHOD(COMGETTER(Medium))(IMedium **aMedium);
-    STDMETHOD(COMGETTER(Controller))(BSTR *aController);
-    STDMETHOD(COMGETTER(Port))(LONG *aPort);
-    STDMETHOD(COMGETTER(Device))(LONG *aDevice);
-    STDMETHOD(COMGETTER(Type))(DeviceType_T *aType);
-    STDMETHOD(COMGETTER(Passthrough))(BOOL *aPassthrough);
-    STDMETHOD(COMGETTER(TemporaryEject))(BOOL *aTemporaryEject);
-    STDMETHOD(COMGETTER(IsEjected))(BOOL *aIsEjected);
-    STDMETHOD(COMGETTER(NonRotational))(BOOL *aNonRotational);
-    STDMETHOD(COMGETTER(Discard))(BOOL *aDiscard);
-    STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup);
-    STDMETHOD(COMGETTER(HotPluggable))(BOOL *aHotPluggable);
-
     // public internal methods
-    void rollback();
-    void commit();
+    void i_rollback();
+    void i_commit();
 
     // unsafe public methods for internal purposes only (ensure there is
     // a caller and a read lock before calling them!)
-    bool isImplicit() const;
-    void setImplicit(bool aImplicit);
-
-    const ComObjPtr<Medium>& getMedium() const;
-    Bstr getControllerName() const;
-    LONG getPort() const;
-    LONG getDevice() const;
-    DeviceType_T getType() const;
-    bool getPassthrough() const;
-    bool getTempEject() const;
-    bool getNonRotational() const;
-    bool getDiscard() const;
-    const Utf8Str& getBandwidthGroup() const;
-    bool getHotPluggable() const;
-
-    bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice);
+    bool i_isImplicit() const;
+    void i_setImplicit(bool aImplicit);
+
+    const ComObjPtr<Medium>& i_getMedium() const;
+    const Bstr i_getControllerName() const;
+    LONG i_getPort() const;
+    LONG i_getDevice() const;
+    DeviceType_T i_getType() const;
+    bool i_getPassthrough() const;
+    bool i_getTempEject() const;
+    bool i_getNonRotational() const;
+    bool i_getDiscard() const;
+    Utf8Str& i_getBandwidthGroup() const;
+    bool i_getHotPluggable() const;
+
+    bool i_matches(CBSTR aControllerName, LONG aPort, LONG aDevice);
 
     /** Must be called from under this object's write lock. */
-    void updateMedium(const ComObjPtr<Medium> &aMedium);
+    void i_updateMedium(const ComObjPtr<Medium> &aMedium);
 
     /** Must be called from under this object's write lock. */
-    void updatePassthrough(bool aPassthrough);
+    void i_updatePassthrough(bool aPassthrough);
 
     /** Must be called from under this object's write lock. */
-    void updateTempEject(bool aTempEject);
+    void i_updateTempEject(bool aTempEject);
 
     /** Must be called from under this object's write lock. */
-    void updateNonRotational(bool aNonRotational);
+    void i_updateNonRotational(bool aNonRotational);
 
     /** Must be called from under this object's write lock. */
-    void updateDiscard(bool aDiscard);
+    void i_updateDiscard(bool aDiscard);
 
     /** Must be called from under this object's write lock. */
-    void updateEjected();
+    void i_updateEjected();
 
     /** Must be called from under this object's write lock. */
-    void updateBandwidthGroup(const Utf8Str &aBandwidthGroup);
+    void i_updateBandwidthGroup(const Utf8Str &aBandwidthGroup);
 
-    void updateParentMachine(Machine * const pMachine);
+    void i_updateParentMachine(Machine * const pMachine);
 
     /** Must be called from under this object's write lock. */
-    void updateHotPluggable(bool aHotPluggable);
+    void i_updateHotPluggable(bool aHotPluggable);
 
     /** Get a unique and somewhat descriptive name for logging. */
-    const char* getLogName(void) const { return mLogName.c_str(); }
+    const char* i_getLogName(void) const { return mLogName.c_str(); }
 
 private:
+
+    // Wrapped IMediumAttachment properties
+    HRESULT getMedium(ComPtr<IMedium> &aHardDisk);
+    HRESULT getController(com::Utf8Str &aController);
+    HRESULT getPort(LONG *aPort);
+    HRESULT getDevice(LONG *aDevice);
+    HRESULT getType(DeviceType_T *aType);
+    HRESULT getPassthrough(BOOL *aPassthrough);
+    HRESULT getTemporaryEject(BOOL *aTemporaryEject);
+    HRESULT getIsEjected(BOOL *aEjected);
+    HRESULT getDiscard(BOOL *aDiscard);
+    HRESULT getNonRotational(BOOL *aNonRotational);
+    HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup);
+    HRESULT getHotPluggable(BOOL *aHotPluggable);
+
     struct Data;
     Data *m;
 
diff --git a/src/VBox/Main/include/MediumImpl.h b/src/VBox/Main/include/MediumImpl.h
index 5109ddf..c1a606d 100644
--- a/src/VBox/Main/include/MediumImpl.h
+++ b/src/VBox/Main/include/MediumImpl.h
@@ -1,12 +1,10 @@
 /* $Id: MediumImpl.h $ */
-
 /** @file
- *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2008-2014 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,16 +15,18 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+
 #ifndef ____H_MEDIUMIMPL
 #define ____H_MEDIUMIMPL
 
 #include <VBox/vd.h>
-
+#include "MediumWrap.h"
 #include "VirtualBoxBase.h"
-#include "MediumLock.h"
-
+#include "AutoCaller.h"
+#include "SecretKeyStore.h"
 class Progress;
 class MediumFormat;
+class MediumLockList;
 
 namespace settings
 {
@@ -39,20 +39,9 @@ namespace settings
  * Medium component class for all media types.
  */
 class ATL_NO_VTABLE Medium :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IMedium)
+    public MediumWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Medium, IMedium)
-
-    DECLARE_NOT_AGGREGATABLE(Medium)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Medium)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IMedium)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR(Medium)
 
     HRESULT FinalConstruct();
@@ -65,11 +54,12 @@ public:
 
     // public initializer/uninitializer for internal purposes only
 
-    // initializer to create empty medium (VirtualBox::CreateHardDisk())
+    // initializer to create empty medium (VirtualBox::CreateMedium())
     HRESULT init(VirtualBox *aVirtualBox,
                  const Utf8Str &aFormat,
                  const Utf8Str &aLocation,
-                 const Guid &uuidMachineRegistry);
+                 const Guid &uuidMachineRegistry,
+                 const DeviceType_T aDeviceType);
 
     // initializer for opening existing media
     // (VirtualBox::OpenMedium(); Machine::AttachDevice())
@@ -80,12 +70,18 @@ public:
                  DeviceType_T aDeviceType);
 
     // initializer used when loading settings
+    HRESULT initOne(Medium *aParent,
+                    DeviceType_T aDeviceType,
+                    const Guid &uuidMachineRegistry,
+                    const settings::Medium &data,
+                    const Utf8Str &strMachineFolder);
     HRESULT init(VirtualBox *aVirtualBox,
                  Medium *aParent,
                  DeviceType_T aDeviceType,
                  const Guid &uuidMachineRegistry,
                  const settings::Medium &data,
-                 const Utf8Str &strMachineFolder);
+                 const Utf8Str &strMachineFolder,
+                 AutoWriteLock &mediaTreeLock);
 
     // initializer for host floppy/DVD
     HRESULT init(VirtualBox *aVirtualBox,
@@ -95,224 +91,267 @@ public:
 
     void uninit();
 
-    void deparent();
-    void setParent(const ComObjPtr<Medium> &pParent);
-
-    // IMedium properties
-    STDMETHOD(COMGETTER(Id))(BSTR *aId);
-    STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
-    STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
-    STDMETHOD(COMGETTER(State))(MediumState_T *aState);
-    STDMETHOD(COMGETTER(Variant))(ComSafeArrayOut(MediumVariant_T, aVariant));
-    STDMETHOD(COMGETTER(Location))(BSTR *aLocation);
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMGETTER(DeviceType))(DeviceType_T *aDeviceType);
-    STDMETHOD(COMGETTER(HostDrive))(BOOL *aHostDrive);
-    STDMETHOD(COMGETTER(Size))(LONG64 *aSize);
-    STDMETHOD(COMGETTER(Format))(BSTR *aFormat);
-    STDMETHOD(COMGETTER(MediumFormat))(IMediumFormat **aMediumFormat);
-    STDMETHOD(COMGETTER(Type))(MediumType_T *aType);
-    STDMETHOD(COMSETTER(Type))(MediumType_T aType);
-    STDMETHOD(COMGETTER(AllowedTypes))(ComSafeArrayOut(MediumType_T, aAllowedTypes));
-    STDMETHOD(COMGETTER(Parent))(IMedium **aParent);
-    STDMETHOD(COMGETTER(Children))(ComSafeArrayOut(IMedium *, aChildren));
-    STDMETHOD(COMGETTER(Base))(IMedium **aBase);
-    STDMETHOD(COMGETTER(ReadOnly))(BOOL *aReadOnly);
-    STDMETHOD(COMGETTER(LogicalSize))(LONG64 *aLogicalSize);
-    STDMETHOD(COMGETTER(AutoReset))(BOOL *aAutoReset);
-    STDMETHOD(COMSETTER(AutoReset))(BOOL aAutoReset);
-    STDMETHOD(COMGETTER(LastAccessError))(BSTR *aLastAccessError);
-    STDMETHOD(COMGETTER(MachineIds))(ComSafeArrayOut(BSTR, aMachineIds));
-
-    // IMedium methods
-    STDMETHOD(SetIds)(BOOL aSetImageId, IN_BSTR aImageId,
-                      BOOL aSetParentId, IN_BSTR aParentId);
-    STDMETHOD(RefreshState)(MediumState_T *aState);
-    STDMETHOD(GetSnapshotIds)(IN_BSTR aMachineId,
-                              ComSafeArrayOut(BSTR, aSnapshotIds));
-    STDMETHOD(LockRead)(IToken **aToken);
-    STDMETHOD(LockWrite)(IToken **aToken);
-    STDMETHOD(Close)();
-    STDMETHOD(GetProperty)(IN_BSTR aName, BSTR *aValue);
-    STDMETHOD(SetProperty)(IN_BSTR aName, IN_BSTR aValue);
-    STDMETHOD(GetProperties)(IN_BSTR aNames,
-                             ComSafeArrayOut(BSTR, aReturnNames),
-                             ComSafeArrayOut(BSTR, aReturnValues));
-    STDMETHOD(SetProperties)(ComSafeArrayIn(IN_BSTR, aNames),
-                             ComSafeArrayIn(IN_BSTR, aValues));
-    STDMETHOD(CreateBaseStorage)(LONG64 aLogicalSize,
-                                 ComSafeArrayIn(MediumVariant_T, aVariant),
-                                 IProgress **aProgress);
-    STDMETHOD(DeleteStorage)(IProgress **aProgress);
-    STDMETHOD(CreateDiffStorage)(IMedium *aTarget,
-                                 ComSafeArrayIn(MediumVariant_T, aVariant),
-                                 IProgress **aProgress);
-    STDMETHOD(MergeTo)(IMedium *aTarget, IProgress **aProgress);
-    STDMETHOD(CloneTo)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant),
-                        IMedium *aParent, IProgress **aProgress);
-    STDMETHOD(CloneToBase)(IMedium *aTarget, ComSafeArrayIn(MediumVariant_T, aVariant),
-                           IProgress **aProgress);
-    STDMETHOD(SetLocation)(IN_BSTR aLocation, IProgress **aProgress);
-    STDMETHOD(Compact)(IProgress **aProgress);
-    STDMETHOD(Resize)(LONG64 aLogicalSize, IProgress **aProgress);
-    STDMETHOD(Reset)(IProgress **aProgress);
+    void i_deparent();
+    void i_setParent(const ComObjPtr<Medium> &pParent);
 
     // unsafe methods for internal purposes only (ensure there is
     // a caller and a read lock before calling them!)
-    const ComObjPtr<Medium>& getParent() const;
-    const MediaList& getChildren() const;
-
-    const Guid& getId() const;
-    MediumState_T getState() const;
-    MediumVariant_T getVariant() const;
-    bool isHostDrive() const;
-    const Utf8Str& getLocationFull() const;
-    const Utf8Str& getFormat() const;
-    const ComObjPtr<MediumFormat> & getMediumFormat() const;
-    bool isMediumFormatFile() const;
-    uint64_t getSize() const;
-    DeviceType_T getDeviceType() const;
-    MediumType_T getType() const;
-    Utf8Str getName();
+    const ComObjPtr<Medium>& i_getParent() const;
+    const MediaList& i_getChildren() const;
+
+    const Guid& i_getId() const;
+    MediumState_T i_getState() const;
+    MediumVariant_T i_getVariant() const;
+    bool i_isHostDrive() const;
+    const Utf8Str& i_getLocationFull() const;
+    const Utf8Str& i_getFormat() const;
+    const ComObjPtr<MediumFormat> & i_getMediumFormat() const;
+    bool i_isMediumFormatFile() const;
+    uint64_t i_getSize() const;
+    DeviceType_T i_getDeviceType() const;
+    MediumType_T i_getType() const;
+    Utf8Str i_getName();
 
     /* handles caller/locking itself */
-    bool addRegistry(const Guid& id, bool fRecurse);
+    bool i_addRegistry(const Guid &id);
+    /* handles caller/locking itself, caller is responsible for tree lock */
+    bool i_addRegistryRecursive(const Guid &id);
     /* handles caller/locking itself */
-    bool removeRegistry(const Guid& id, bool fRecurse);
-    bool isInRegistry(const Guid& id);
-    bool getFirstRegistryMachineId(Guid &uuid) const;
-    void markRegistriesModified();
+    bool i_removeRegistry(const Guid& id);
+    /* handles caller/locking itself, caller is responsible for tree lock */
+    bool i_removeRegistryRecursive(const Guid& id);
+    bool i_isInRegistry(const Guid& id);
+    bool i_getFirstRegistryMachineId(Guid &uuid) const;
+    void i_markRegistriesModified();
 
-    HRESULT setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue);
+    HRESULT i_setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue);
 
-    HRESULT addBackReference(const Guid &aMachineId,
-                             const Guid &aSnapshotId = Guid::Empty);
-    HRESULT removeBackReference(const Guid &aMachineId,
-                                const Guid &aSnapshotId = Guid::Empty);
+    HRESULT i_addBackReference(const Guid &aMachineId,
+                               const Guid &aSnapshotId = Guid::Empty);
+    HRESULT i_removeBackReference(const Guid &aMachineId,
+                                  const Guid &aSnapshotId = Guid::Empty);
 
 
-    const Guid* getFirstMachineBackrefId() const;
-    const Guid* getAnyMachineBackref() const;
-    const Guid* getFirstMachineBackrefSnapshotId() const;
-    size_t getMachineBackRefCount() const;
+    const Guid* i_getFirstMachineBackrefId() const;
+    const Guid* i_getAnyMachineBackref() const;
+    const Guid* i_getFirstMachineBackrefSnapshotId() const;
+    size_t i_getMachineBackRefCount() const;
 
 #ifdef DEBUG
-    void dumpBackRefs();
+    void i_dumpBackRefs();
 #endif
 
-    HRESULT updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath);
-
-    ComObjPtr<Medium> getBase(uint32_t *aLevel = NULL);
-
-    bool isReadOnly();
-    void updateId(const Guid &id);
-
-    HRESULT saveSettings(settings::Medium &data,
-                         const Utf8Str &strHardDiskFolder);
-
-    HRESULT createMediumLockList(bool fFailIfInaccessible,
-                                 bool fMediumLockWrite,
-                                 Medium *pToBeParent,
-                                 MediumLockList &mediumLockList);
-
-    HRESULT createDiffStorage(ComObjPtr<Medium> &aTarget,
-                              MediumVariant_T aVariant,
-                              MediumLockList *pMediumLockList,
-                              ComObjPtr<Progress> *aProgress,
-                              bool aWait);
-    Utf8Str getPreferredDiffFormat();
-
-    HRESULT close(AutoCaller &autoCaller);
-    HRESULT unlockRead(MediumState_T *aState);
-    HRESULT unlockWrite(MediumState_T *aState);
-    HRESULT deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait);
-    HRESULT markForDeletion();
-    HRESULT unmarkForDeletion();
-    HRESULT markLockedForDeletion();
-    HRESULT unmarkLockedForDeletion();
-
-    HRESULT queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
-                                         bool &fMergeForward);
-
-    HRESULT prepareMergeTo(const ComObjPtr<Medium> &pTarget,
-                           const Guid *aMachineId,
-                           const Guid *aSnapshotId,
-                           bool fLockMedia,
-                           bool &fMergeForward,
-                           ComObjPtr<Medium> &pParentForTarget,
-                           MediumLockList * &aChildrenToReparent,
-                           MediumLockList * &aMediumLockList);
-    HRESULT mergeTo(const ComObjPtr<Medium> &pTarget,
-                    bool fMergeForward,
-                    const ComObjPtr<Medium> &pParentForTarget,
-                    MediumLockList *aChildrenToReparent,
-                    MediumLockList *aMediumLockList,
-                    ComObjPtr<Progress> *aProgress,
-                    bool aWait);
-    void cancelMergeTo(MediumLockList *aChildrenToReparent,
-                       MediumLockList *aMediumLockList);
-
-    HRESULT fixParentUuidOfChildren(MediumLockList *pChildrenToReparent);
+    HRESULT i_updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath);
 
-    HRESULT exportFile(const char *aFilename,
-                       const ComObjPtr<MediumFormat> &aFormat,
-                       MediumVariant_T aVariant,
-                       PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,
-                       const ComObjPtr<Progress> &aProgress);
-    HRESULT importFile(const char *aFilename,
-                       const ComObjPtr<MediumFormat> &aFormat,
-                       MediumVariant_T aVariant,
-                       PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,
-                       const ComObjPtr<Medium> &aParent,
-                       const ComObjPtr<Progress> &aProgress);
-
-    HRESULT cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
-                      const ComObjPtr<Medium> &aParent, IProgress **aProgress,
-                      uint32_t idxSrcImageSame, uint32_t idxDstImageSame);
-
-private:
-
-    HRESULT queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoCaller);
-
-    HRESULT canClose();
-    HRESULT unregisterWithVirtualBox();
-
-    HRESULT setStateError();
-
-    HRESULT setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat = Utf8Str::Empty);
-    HRESULT setFormat(const Utf8Str &aFormat);
+    /* handles caller/locking itself */
+    ComObjPtr<Medium> i_getBase(uint32_t *aLevel = NULL);
+    /* handles caller/locking itself */
+    uint32_t i_getDepth();
+
+    bool i_isReadOnly();
+    void i_updateId(const Guid &id);
+
+    void i_saveSettingsOne(settings::Medium &data,
+                           const Utf8Str &strHardDiskFolder);
+    HRESULT i_saveSettings(settings::Medium &data,
+                           const Utf8Str &strHardDiskFolder);
+
+    HRESULT i_createMediumLockList(bool fFailIfInaccessible,
+                                   bool fMediumLockWrite,
+                                   bool fMediumLockWriteAll,
+                                   Medium *pToBeParent,
+                                   MediumLockList &mediumLockList);
+
+    HRESULT i_createDiffStorage(ComObjPtr<Medium> &aTarget,
+                                MediumVariant_T aVariant,
+                                MediumLockList *pMediumLockList,
+                                ComObjPtr<Progress> *aProgress,
+                                bool aWait);
+    Utf8Str i_getPreferredDiffFormat();
+
+    HRESULT i_close(AutoCaller &autoCaller);
+    HRESULT i_unlockRead(MediumState_T *aState);
+    HRESULT i_unlockWrite(MediumState_T *aState);
+    HRESULT i_deleteStorage(ComObjPtr<Progress> *aProgress, bool aWait);
+    HRESULT i_markForDeletion();
+    HRESULT i_unmarkForDeletion();
+    HRESULT i_markLockedForDeletion();
+    HRESULT i_unmarkLockedForDeletion();
+
+    HRESULT i_queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
+                                           bool &fMergeForward);
+
+    HRESULT i_prepareMergeTo(const ComObjPtr<Medium> &pTarget,
+                             const Guid *aMachineId,
+                             const Guid *aSnapshotId,
+                             bool fLockMedia,
+                             bool &fMergeForward,
+                             ComObjPtr<Medium> &pParentForTarget,
+                             MediumLockList * &aChildrenToReparent,
+                             MediumLockList * &aMediumLockList);
+    HRESULT i_mergeTo(const ComObjPtr<Medium> &pTarget,
+                      bool fMergeForward,
+                      const ComObjPtr<Medium> &pParentForTarget,
+                      MediumLockList *aChildrenToReparent,
+                      MediumLockList *aMediumLockList,
+                      ComObjPtr<Progress> *aProgress,
+                      bool aWait);
+    void i_cancelMergeTo(MediumLockList *aChildrenToReparent,
+                       MediumLockList *aMediumLockList);
 
-    VDTYPE convertDeviceType();
-    DeviceType_T convertToDeviceType(VDTYPE enmType);
+    HRESULT i_fixParentUuidOfChildren(MediumLockList *pChildrenToReparent);
 
-    Utf8Str vdError(int aVRC);
+    HRESULT i_exportFile(const char *aFilename,
+                         const ComObjPtr<MediumFormat> &aFormat,
+                         MediumVariant_T aVariant,
+                         SecretKeyStore *pKeyStore,
+                         PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,
+                         const ComObjPtr<Progress> &aProgress);
+    HRESULT i_importFile(const char *aFilename,
+                        const ComObjPtr<MediumFormat> &aFormat,
+                        MediumVariant_T aVariant,
+                        PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,
+                        const ComObjPtr<Medium> &aParent,
+                        const ComObjPtr<Progress> &aProgress);
 
-    bool    isPropertyForFilter(const com::Utf8Str &aName);
+    HRESULT i_cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
+                        const ComObjPtr<Medium> &aParent, IProgress **aProgress,
+                        uint32_t idxSrcImageSame, uint32_t idxDstImageSame);
 
-    static DECLCALLBACK(void) vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,
-                                          const char *pszFormat, va_list va);
+    const Utf8Str& i_getKeyId();
 
-    static DECLCALLBACK(bool) vdConfigAreKeysValid(void *pvUser,
-                                                   const char *pszzValid);
-    static DECLCALLBACK(int) vdConfigQuerySize(void *pvUser, const char *pszName,
-                                               size_t *pcbValue);
-    static DECLCALLBACK(int) vdConfigQuery(void *pvUser, const char *pszName,
-                                           char *pszValue, size_t cchValue);
+private:
 
-    static DECLCALLBACK(int) vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock);
-    static DECLCALLBACK(int) vdTcpSocketDestroy(VDSOCKET Sock);
-    static DECLCALLBACK(int) vdTcpClientConnect(VDSOCKET Sock, const char *pszAddress, uint32_t uPort,
-                                                RTMSINTERVAL cMillies);
-    static DECLCALLBACK(int) vdTcpClientClose(VDSOCKET Sock);
-    static DECLCALLBACK(bool) vdTcpIsClientConnected(VDSOCKET Sock);
-    static DECLCALLBACK(int) vdTcpSelectOne(VDSOCKET Sock, RTMSINTERVAL cMillies);
-    static DECLCALLBACK(int) vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead);
-    static DECLCALLBACK(int) vdTcpWrite(VDSOCKET Sock, const void *pvBuffer, size_t cbBuffer);
-    static DECLCALLBACK(int) vdTcpSgWrite(VDSOCKET Sock, PCRTSGBUF pSgBuf);
-    static DECLCALLBACK(int) vdTcpFlush(VDSOCKET Sock);
-    static DECLCALLBACK(int) vdTcpSetSendCoalescing(VDSOCKET Sock, bool fEnable);
-    static DECLCALLBACK(int) vdTcpGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAddr);
-    static DECLCALLBACK(int) vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr);
+    // wrapped IMedium properties
+    HRESULT getId(com::Guid &aId);
+    HRESULT getDescription(com::Utf8Str &aDescription);
+    HRESULT setDescription(const com::Utf8Str &aDescription);
+    HRESULT getState(MediumState_T *aState);
+    HRESULT getVariant(std::vector<MediumVariant_T> &aVariant);
+    HRESULT getLocation(com::Utf8Str &aLocation);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getDeviceType(DeviceType_T *aDeviceType);
+    HRESULT getHostDrive(BOOL *aHostDrive);
+    HRESULT getSize(LONG64 *aSize);
+    HRESULT getFormat(com::Utf8Str &aFormat);
+    HRESULT getMediumFormat(ComPtr<IMediumFormat> &aMediumFormat);
+    HRESULT getType(MediumType_T *aType);
+    HRESULT setType(MediumType_T aType);
+    HRESULT getAllowedTypes(std::vector<MediumType_T> &aAllowedTypes);
+    HRESULT getParent(AutoCaller &autoCaller, ComPtr<IMedium> &aParent);
+    HRESULT getChildren(AutoCaller &autoCaller, std::vector<ComPtr<IMedium> > &aChildren);
+    HRESULT getBase(AutoCaller &autoCaller, ComPtr<IMedium> &aBase);
+    HRESULT getReadOnly(BOOL *aReadOnly);
+    HRESULT getLogicalSize(LONG64 *aLogicalSize);
+    HRESULT getAutoReset(BOOL *aAutoReset);
+    HRESULT setAutoReset(BOOL aAutoReset);
+    HRESULT getLastAccessError(com::Utf8Str &aLastAccessError);
+    HRESULT getMachineIds(std::vector<com::Guid> &aMachineIds);
+
+    // wrapped IMedium methods
+    HRESULT setIds(AutoCaller &aAutoCaller,
+                   BOOL aSetImageId,
+                   const com::Guid &aImageId,
+                   BOOL aSetParentId,
+                   const com::Guid &aParentId);
+    HRESULT refreshState(AutoCaller &aAutoCaller,
+                         MediumState_T *aState);
+    HRESULT getSnapshotIds(const com::Guid &aMachineId,
+                           std::vector<com::Guid> &aSnapshotIds);
+    HRESULT lockRead(ComPtr<IToken> &aToken);
+    HRESULT lockWrite(ComPtr<IToken> &aToken);
+    HRESULT close(AutoCaller &aAutoCaller);
+    HRESULT getProperty(const com::Utf8Str &aName,
+                        com::Utf8Str &aValue);
+    HRESULT setProperty(const com::Utf8Str &aName,
+                        const com::Utf8Str &aValue);
+    HRESULT getProperties(const com::Utf8Str &aNames,
+                          std::vector<com::Utf8Str> &aReturnNames,
+                          std::vector<com::Utf8Str> &aReturnValues);
+    HRESULT setProperties(const std::vector<com::Utf8Str> &aNames,
+                          const std::vector<com::Utf8Str> &aValues);
+    HRESULT createBaseStorage(LONG64 aLogicalSize,
+                              const std::vector<MediumVariant_T> &aVariant,
+                              ComPtr<IProgress> &aProgress);
+    HRESULT deleteStorage(ComPtr<IProgress> &aProgress);
+    HRESULT createDiffStorage(const ComPtr<IMedium> &aTarget,
+                              const std::vector<MediumVariant_T> &aVariant,
+                              ComPtr<IProgress> &aProgress);
+    HRESULT mergeTo(const ComPtr<IMedium> &aTarget,
+                    ComPtr<IProgress> &aProgress);
+    HRESULT cloneTo(const ComPtr<IMedium> &aTarget,
+                    const std::vector<MediumVariant_T> &aVariant,
+                    const ComPtr<IMedium> &aParent,
+                    ComPtr<IProgress> &aProgress);
+    HRESULT cloneToBase(const ComPtr<IMedium> &aTarget,
+                        const std::vector<MediumVariant_T> &aVariant,
+                        ComPtr<IProgress> &aProgress);
+    HRESULT setLocation(const com::Utf8Str &aLocation,
+                        ComPtr<IProgress> &aProgress);
+    HRESULT compact(ComPtr<IProgress> &aProgress);
+    HRESULT resize(LONG64 aLogicalSize,
+                   ComPtr<IProgress> &aProgress);
+    HRESULT reset(ComPtr<IProgress> &aProgress);
+    HRESULT changeEncryption(const com::Utf8Str &aCurrentPassword, const com::Utf8Str &aCipher,
+                             const com::Utf8Str &aNewPassword, const com::Utf8Str &aNewPasswordId,
+                             ComPtr<IProgress> &aProgress);
+    HRESULT getEncryptionSettings(com::Utf8Str &aCipher, com::Utf8Str &aPasswordId);
+    HRESULT checkEncryptionPassword(const com::Utf8Str &aPassword);
+
+    // Private internal nmethods
+    HRESULT i_queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoCaller);
+    HRESULT i_canClose();
+    HRESULT i_unregisterWithVirtualBox();
+    HRESULT i_setStateError();
+    HRESULT i_setLocation(const Utf8Str &aLocation, const Utf8Str &aFormat = Utf8Str::Empty);
+    HRESULT i_setFormat(const Utf8Str &aFormat);
+    VDTYPE i_convertDeviceType();
+    DeviceType_T i_convertToDeviceType(VDTYPE enmType);
+    Utf8Str i_vdError(int aVRC);
+
+    bool    i_isPropertyForFilter(const com::Utf8Str &aName);
+
+    HRESULT i_getFilterProperties(std::vector<com::Utf8Str> &aReturnNames,
+                                  std::vector<com::Utf8Str> &aReturnValues);
+
+    static DECLCALLBACK(void) i_vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,
+                                            const char *pszFormat, va_list va);
+    static DECLCALLBACK(bool) i_vdConfigAreKeysValid(void *pvUser,
+                                                     const char *pszzValid);
+    static DECLCALLBACK(int) i_vdConfigQuerySize(void *pvUser, const char *pszName,
+                                                 size_t *pcbValue);
+    static DECLCALLBACK(int) i_vdConfigQuery(void *pvUser, const char *pszName,
+                                             char *pszValue, size_t cchValue);
+    static DECLCALLBACK(int) i_vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock);
+    static DECLCALLBACK(int) i_vdTcpSocketDestroy(VDSOCKET Sock);
+    static DECLCALLBACK(int) i_vdTcpClientConnect(VDSOCKET Sock, const char *pszAddress, uint32_t uPort,
+                                                  RTMSINTERVAL cMillies);
+    static DECLCALLBACK(int) i_vdTcpClientClose(VDSOCKET Sock);
+    static DECLCALLBACK(bool) i_vdTcpIsClientConnected(VDSOCKET Sock);
+    static DECLCALLBACK(int) i_vdTcpSelectOne(VDSOCKET Sock, RTMSINTERVAL cMillies);
+    static DECLCALLBACK(int) i_vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead);
+    static DECLCALLBACK(int) i_vdTcpWrite(VDSOCKET Sock, const void *pvBuffer, size_t cbBuffer);
+    static DECLCALLBACK(int) i_vdTcpSgWrite(VDSOCKET Sock, PCRTSGBUF pSgBuf);
+    static DECLCALLBACK(int) i_vdTcpFlush(VDSOCKET Sock);
+    static DECLCALLBACK(int) i_vdTcpSetSendCoalescing(VDSOCKET Sock, bool fEnable);
+    static DECLCALLBACK(int) i_vdTcpGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAddr);
+    static DECLCALLBACK(int) i_vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr);
+
+    static DECLCALLBACK(bool) i_vdCryptoConfigAreKeysValid(void *pvUser,
+                                                           const char *pszzValid);
+    static DECLCALLBACK(int) i_vdCryptoConfigQuerySize(void *pvUser, const char *pszName,
+                                                       size_t *pcbValue);
+    static DECLCALLBACK(int) i_vdCryptoConfigQuery(void *pvUser, const char *pszName,
+                                                   char *pszValue, size_t cchValue);
+
+    static DECLCALLBACK(int) i_vdCryptoKeyRetain(void *pvUser, const char *pszId,
+                                                 const uint8_t **ppbKey, size_t *pcbKey);
+    static DECLCALLBACK(int) i_vdCryptoKeyRelease(void *pvUser, const char *pszId);
+    static DECLCALLBACK(int) i_vdCryptoKeyStorePasswordRetain(void *pvUser, const char *pszId, const char **ppszPassword);
+    static DECLCALLBACK(int) i_vdCryptoKeyStorePasswordRelease(void *pvUser, const char *pszId);
+    static DECLCALLBACK(int) i_vdCryptoKeyStoreSave(void *pvUser, const void *pvKeyStore, size_t cbKeyStore);
+    static DECLCALLBACK(int) i_vdCryptoKeyStoreReturnParameters(void *pvUser, const char *pszCipher,
+                                                                const uint8_t *pbDek, size_t cbDek);
 
     class Task;
     class CreateBaseTask;
@@ -325,6 +364,7 @@ private:
     class MergeTask;
     class ExportTask;
     class ImportTask;
+    class EncryptTask;
     friend class Task;
     friend class CreateBaseTask;
     friend class CreateDiffTask;
@@ -336,20 +376,27 @@ private:
     friend class MergeTask;
     friend class ExportTask;
     friend class ImportTask;
-
-    HRESULT startThread(Medium::Task *pTask);
-    HRESULT runNow(Medium::Task *pTask);
-
-    HRESULT taskCreateBaseHandler(Medium::CreateBaseTask &task);
-    HRESULT taskCreateDiffHandler(Medium::CreateDiffTask &task);
-    HRESULT taskMergeHandler(Medium::MergeTask &task);
-    HRESULT taskCloneHandler(Medium::CloneTask &task);
-    HRESULT taskDeleteHandler(Medium::DeleteTask &task);
-    HRESULT taskResetHandler(Medium::ResetTask &task);
-    HRESULT taskCompactHandler(Medium::CompactTask &task);
-    HRESULT taskResizeHandler(Medium::ResizeTask &task);
-    HRESULT taskExportHandler(Medium::ExportTask &task);
-    HRESULT taskImportHandler(Medium::ImportTask &task);
+    friend class EncryptTask;
+
+    HRESULT i_startThread(Medium::Task *pTask);
+    HRESULT i_runNow(Medium::Task *pTask);
+
+    HRESULT i_taskCreateBaseHandler(Medium::CreateBaseTask &task);
+    HRESULT i_taskCreateDiffHandler(Medium::CreateDiffTask &task);
+    HRESULT i_taskMergeHandler(Medium::MergeTask &task);
+    HRESULT i_taskCloneHandler(Medium::CloneTask &task);
+    HRESULT i_taskDeleteHandler(Medium::DeleteTask &task);
+    HRESULT i_taskResetHandler(Medium::ResetTask &task);
+    HRESULT i_taskCompactHandler(Medium::CompactTask &task);
+    HRESULT i_taskResizeHandler(Medium::ResizeTask &task);
+    HRESULT i_taskExportHandler(Medium::ExportTask &task);
+    HRESULT i_taskImportHandler(Medium::ImportTask &task);
+    HRESULT i_taskEncryptHandler(Medium::EncryptTask &task);
+
+    struct CryptoFilterSettings;
+    void i_taskEncryptSettingsSetup(CryptoFilterSettings *pSettings, const char *pszCipher,
+                                    const char *pszKeyStore,  const char *pszPassword,
+                                    bool fCreateKeyStore);
 
     struct Data;            // opaque data struct, defined in MediumImpl.cpp
     Data *m;
diff --git a/src/VBox/Main/include/MouseImpl.h b/src/VBox/Main/include/MouseImpl.h
index 2742057..ca72753 100644
--- a/src/VBox/Main/include/MouseImpl.h
+++ b/src/VBox/Main/include/MouseImpl.h
@@ -18,7 +18,7 @@
 #ifndef ____H_MOUSEIMPL
 #define ____H_MOUSEIMPL
 
-#include "VirtualBoxBase.h"
+#include "MouseWrap.h"
 #include "ConsoleImpl.h"
 #include "EventImpl.h"
 #include <VBox/vmm/pdmdrv.h>
@@ -29,21 +29,10 @@ enum { MOUSE_MAX_DEVICES = 3 };
 typedef struct DRVMAINMOUSE DRVMAINMOUSE, *PDRVMAINMOUSE;
 
 class ATL_NO_VTABLE Mouse :
-    public VirtualBoxBase
-    , VBOX_SCRIPTABLE_IMPL(IMouse)
+    public MouseWrap
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Mouse, IMouse)
-
-    DECLARE_NOT_AGGREGATABLE(Mouse)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Mouse)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IMouse)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR (Mouse)
 
     HRESULT FinalConstruct();
@@ -53,66 +42,82 @@ public:
     HRESULT init(ConsoleMouseInterface *parent);
     void uninit();
 
-    // IMouse properties
-    STDMETHOD(COMGETTER(AbsoluteSupported)) (BOOL *absoluteSupported);
-    STDMETHOD(COMGETTER(RelativeSupported)) (BOOL *relativeSupported);
-    STDMETHOD(COMGETTER(MultiTouchSupported)) (BOOL *multiTouchSupported);
-    STDMETHOD(COMGETTER(NeedsHostCursor)) (BOOL *needsHostCursor);
-
-    // IMouse methods
-    STDMETHOD(PutMouseEvent)(LONG dx, LONG dy, LONG dz, LONG dw,
-                             LONG buttonState);
-    STDMETHOD(PutMouseEventAbsolute)(LONG x, LONG y, LONG dz, LONG dw,
-                                     LONG buttonState);
-    STDMETHOD(PutEventMultiTouch)(LONG aCount, ComSafeArrayIn(LONG64, aContacts), ULONG aScanTime);
-    STDMETHOD(PutEventMultiTouchString)(LONG aCount, IN_BSTR aContacts, ULONG aScanTime);
-    STDMETHOD(COMGETTER(EventSource)) (IEventSource ** aEventSource);
-
     static const PDMDRVREG  DrvReg;
 
-    ConsoleMouseInterface *getParent() const
+    ConsoleMouseInterface *i_getParent() const
     {
         return mParent;
     }
 
     /** notify the front-end of guest capability changes */
-    void onVMMDevGuestCapsChange(uint32_t fCaps)
+    void i_onVMMDevGuestCapsChange(uint32_t fCaps)
     {
         mfVMMDevGuestCaps = fCaps;
-        sendMouseCapsNotifications();
+        i_sendMouseCapsNotifications();
     }
 
+    void updateMousePointerShape(bool fVisible, bool fAlpha,
+                                 uint32_t hotX, uint32_t hotY,
+                                 uint32_t width, uint32_t height,
+                                 const uint8_t *pu8Shape, uint32_t cbShape);
 private:
 
-    static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
-    static DECLCALLBACK(void)   mouseReportModes (PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT);
-    static DECLCALLBACK(int)    drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
-    static DECLCALLBACK(void)   drvDestruct(PPDMDRVINS pDrvIns);
-
-    HRESULT updateVMMDevMouseCaps(uint32_t fCapsAdded, uint32_t fCapsRemoved);
-    HRESULT reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
+    // Wrapped IMouse properties
+    HRESULT getAbsoluteSupported(BOOL *aAbsoluteSupported);
+    HRESULT getRelativeSupported(BOOL *aRelativeSupported);
+    HRESULT getMultiTouchSupported(BOOL *aMultiTouchSupported);
+    HRESULT getNeedsHostCursor(BOOL *aNeedsHostCursor);
+    HRESULT getPointerShape(ComPtr<IMousePointerShape> &aPointerShape);
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+
+    // Wrapped IMouse methods
+    HRESULT putMouseEvent(LONG aDx,
+                          LONG aDy,
+                          LONG aDz,
+                          LONG aDw,
+                          LONG aButtonState);
+    HRESULT putMouseEventAbsolute(LONG aX,
+                                  LONG aY,
+                                  LONG aDz,
+                                  LONG aDw,
+                                  LONG aButtonState);
+    HRESULT putEventMultiTouch(LONG aCount,
+                               const std::vector<LONG64> &aContacts,
+                               ULONG aScanTime);
+    HRESULT putEventMultiTouchString(LONG aCount,
+                                     const com::Utf8Str &aContacts,
+                                     ULONG aScanTime);
+
+
+    static DECLCALLBACK(void *) i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
+    static DECLCALLBACK(void)   i_mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT);
+    static DECLCALLBACK(int)    i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
+    static DECLCALLBACK(void)   i_drvDestruct(PPDMDRVINS pDrvIns);
+
+    HRESULT i_updateVMMDevMouseCaps(uint32_t fCapsAdded, uint32_t fCapsRemoved);
+    HRESULT i_reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
                                  int32_t dw, uint32_t fButtons);
-    HRESULT reportAbsEventToMouseDev(int32_t x, int32_t y, int32_t dz,
+    HRESULT i_reportAbsEventToMouseDev(int32_t x, int32_t y, int32_t dz,
                                      int32_t dw, uint32_t fButtons);
-    HRESULT reportMTEventToMouseDev(int32_t x, int32_t z, uint32_t cContact,
+    HRESULT i_reportMTEventToMouseDev(int32_t x, int32_t z, uint32_t cContact,
                                     uint32_t fContact);
-    HRESULT reportMultiTouchEventToDevice(uint8_t cContacts, const uint64_t *pau64Contacts, uint32_t u32ScanTime);
-    HRESULT reportAbsEventToVMMDev(int32_t x, int32_t y);
+    HRESULT i_reportMultiTouchEventToDevice(uint8_t cContacts, const uint64_t *pau64Contacts, uint32_t u32ScanTime);
+    HRESULT i_reportAbsEventToVMMDev(int32_t x, int32_t y);
     HRESULT i_reportAbsEventToInputDevices(int32_t x, int32_t y, int32_t dz, int32_t dw, uint32_t fButtons,
                                            bool fUsesVMMDevEvent);
     HRESULT i_reportAbsEventToDisplayDevice(int32_t x, int32_t y);
-    HRESULT convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
-                              bool *pfValid);
-    HRESULT putEventMultiTouch(LONG aCount, LONG64 *paContacts, ULONG aScanTime);
-
-    void getDeviceCaps(bool *pfAbs, bool *pfRel, bool *fMT);
-    void sendMouseCapsNotifications(void);
-    bool guestNeedsHostCursor(void);
-    bool vmmdevCanAbs(void);
-    bool deviceCanAbs(void);
-    bool supportsAbs(void);
-    bool supportsRel(void);
-    bool supportsMT(void);
+    HRESULT i_convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
+                                 bool *pfValid);
+    HRESULT i_putEventMultiTouch(LONG aCount, const LONG64 *paContacts, ULONG aScanTime);
+
+    void i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *fMT);
+    void i_sendMouseCapsNotifications(void);
+    bool i_guestNeedsHostCursor(void);
+    bool i_vmmdevCanAbs(void);
+    bool i_deviceCanAbs(void);
+    bool i_supportsAbs(void);
+    bool i_supportsRel(void);
+    bool i_supportsMT(void);
 
     ConsoleMouseInterface * const         mParent;
     /** Pointer to the associated mouse driver. */
@@ -123,15 +128,28 @@ private:
     int32_t mcLastY;
     uint32_t mfLastButtons;
 
+    ComPtr<IMousePointerShape> mPointerShape;
+    struct
+    {
+        bool fVisible;
+        bool fAlpha;
+        uint32_t hotX;
+        uint32_t hotY;
+        uint32_t width;
+        uint32_t height;
+        uint8_t *pu8Shape;
+        uint32_t cbShape;
+    } mPointerData;
+
     const ComObjPtr<EventSource> mEventSource;
     VBoxEventDesc                mMouseEvent;
 
-    void fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
-                        LONG fButtons);
+    void i_fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
+                          LONG fButtons);
 
-    void fireMultiTouchEvent(uint8_t cContacts,
-                             const LONG64 *paContacts,
-                             uint32_t u32ScanTime);
+    void i_fireMultiTouchEvent(uint8_t cContacts,
+                               const LONG64 *paContacts,
+                               uint32_t u32ScanTime);
 };
 
 #endif // !____H_MOUSEIMPL
diff --git a/src/VBox/Main/include/NATEngineImpl.h b/src/VBox/Main/include/NATEngineImpl.h
index c0aae93..975220e 100644
--- a/src/VBox/Main/include/NATEngineImpl.h
+++ b/src/VBox/Main/include/NATEngineImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -21,108 +21,87 @@
 #define ____H_NATENGINE
 
 
-#include "VirtualBoxBase.h"
 #include <VBox/settings.h>
+#include "NATEngineWrap.h"
 
 namespace settings
 {
     struct NAT;
 }
 
+
 class ATL_NO_VTABLE NATEngine :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(INATEngine)
+    public NATEngineWrap
 {
     public:
     typedef std::map<Utf8Str, settings::NATRule> NATRuleMap;
-    struct Data
-    {
-        Data() : mMtu(0),
-                 mSockRcv(0),
-                 mSockSnd(0),
-                 mTcpRcv(0),
-                 mTcpSnd(0),
-                 mDNSPassDomain(TRUE),
-                 mDNSProxy(FALSE),
-                 mDNSUseHostResolver(FALSE),
-                 mAliasMode(0)
-        {}
-
-        com::Utf8Str mNetwork;
-        com::Utf8Str mBindIP;
-        uint32_t mMtu;
-        uint32_t mSockRcv;
-        uint32_t mSockSnd;
-        uint32_t mTcpRcv;
-        uint32_t mTcpSnd;
-        /* TFTP service */
-        Utf8Str  mTFTPPrefix;
-        Utf8Str  mTFTPBootFile;
-        Utf8Str  mTFTPNextServer;
-        /* DNS service */
-        BOOL     mDNSPassDomain;
-        BOOL     mDNSProxy;
-        BOOL     mDNSUseHostResolver;
-        /* Alias service */
-        ULONG    mAliasMode;
-    };
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NATEngine, INATEngine)
-
-    DECLARE_NOT_AGGREGATABLE(NATEngine)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(NATEngine)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(INATEngine)
-    END_COM_MAP()
 
     DECLARE_EMPTY_CTOR_DTOR(NATEngine)
 
     HRESULT FinalConstruct();
+    void FinalRelease();
+
     HRESULT init(Machine *aParent, INetworkAdapter *aAdapter);
     HRESULT init(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *aThat);
     HRESULT initCopy(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *aThat);
-    bool isModified();
-    bool isReallyModified();
-    bool rollback();
-    void commit();
     void uninit();
-    void FinalRelease();
 
-    HRESULT loadSettings(const settings::NAT &data);
-    HRESULT saveSettings(settings::NAT &data);
-
-    STDMETHOD(COMSETTER(Network))(IN_BSTR aNetwork);
-    STDMETHOD(COMGETTER(Network))(BSTR *aNetwork);
-    STDMETHOD(COMSETTER(HostIP))(IN_BSTR aBindIP);
-    STDMETHOD(COMGETTER(HostIP))(BSTR *aBindIP);
-    /* TFTP attributes */
-    STDMETHOD(COMSETTER(TFTPPrefix))(IN_BSTR aTFTPPrefix);
-    STDMETHOD(COMGETTER(TFTPPrefix))(BSTR *aTFTPPrefix);
-    STDMETHOD(COMSETTER(TFTPBootFile))(IN_BSTR aTFTPBootFile);
-    STDMETHOD(COMGETTER(TFTPBootFile))(BSTR *aTFTPBootFile);
-    STDMETHOD(COMSETTER(TFTPNextServer))(IN_BSTR aTFTPNextServer);
-    STDMETHOD(COMGETTER(TFTPNextServer))(BSTR *aTFTPNextServer);
-    /* Alias attributes */
-    STDMETHOD(COMSETTER(AliasMode))(ULONG aAliasLog);
-    STDMETHOD(COMGETTER(AliasMode))(ULONG *aAliasLog);
-    /* DNS attributes */
-    STDMETHOD(COMSETTER(DNSPassDomain))(BOOL aDNSPassDomain);
-    STDMETHOD(COMGETTER(DNSPassDomain))(BOOL *aDNSPassDomain);
-    STDMETHOD(COMSETTER(DNSProxy))(BOOL aDNSProxy);
-    STDMETHOD(COMGETTER(DNSProxy))(BOOL *aDNSProxy);
-    STDMETHOD(COMGETTER(DNSUseHostResolver))(BOOL *aDNSUseHostResolver);
-    STDMETHOD(COMSETTER(DNSUseHostResolver))(BOOL aDNSUseHostResolver);
-
-    STDMETHOD(SetNetworkSettings)(ULONG aMtu, ULONG aSockSnd, ULONG aSockRcv, ULONG aTcpWndSnd, ULONG aTcpWndRcv);
-    STDMETHOD(GetNetworkSettings)(ULONG *aMtu, ULONG *aSockSnd, ULONG *aSockRcv, ULONG *aTcpWndSnd, ULONG *aTcpWndRcv);
-
-    STDMETHOD(COMGETTER(Redirects))(ComSafeArrayOut(BSTR, aNatRules));
-    STDMETHOD(AddRedirect)(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USHORT aHostPort, IN_BSTR aGuestIP, USHORT aGuestPort);
-    STDMETHOD(RemoveRedirect)(IN_BSTR aName);
+    bool i_isModified();
+    bool i_rollback();
+    void i_commit();
+    HRESULT i_loadSettings(const settings::NAT &data);
+    HRESULT i_saveSettings(settings::NAT &data);
 
 private:
-    Backupable<Data> mData;
+
+    // wrapped INATEngine properties
+    HRESULT setNetwork(const com::Utf8Str &aNetwork);
+    HRESULT getNetwork(com::Utf8Str &aNetwork);
+    HRESULT setHostIP(const com::Utf8Str &aHostIP);
+    HRESULT getHostIP(com::Utf8Str &aBindIP);
+    /* TFTP properties */
+    HRESULT setTFTPPrefix(const com::Utf8Str &aTFTPPrefix);
+    HRESULT getTFTPPrefix(com::Utf8Str &aTFTPPrefix);
+    HRESULT setTFTPBootFile(const com::Utf8Str &aTFTPBootFile);
+    HRESULT getTFTPBootFile(com::Utf8Str &aTFTPBootFile);
+    HRESULT setTFTPNextServer(const com::Utf8Str &aTFTPNextServer);
+    HRESULT getTFTPNextServer(com::Utf8Str &aTFTPNextServer);
+    /* DNS properties */
+    HRESULT setDNSPassDomain(BOOL aDNSPassDomain);
+    HRESULT getDNSPassDomain(BOOL *aDNSPassDomain);
+    HRESULT setDNSProxy(BOOL aDNSProxy);
+    HRESULT getDNSProxy(BOOL *aDNSProxy);
+    HRESULT getDNSUseHostResolver(BOOL *aDNSUseHostResolver);
+    HRESULT setDNSUseHostResolver(BOOL aDNSUseHostResolver);
+    /* Alias properties */
+    HRESULT setAliasMode(ULONG aAliasMode);
+    HRESULT getAliasMode(ULONG *aAliasMode);
+
+    HRESULT getRedirects(std::vector<com::Utf8Str> &aRedirects);
+
+    HRESULT setNetworkSettings(ULONG aMtu,
+                               ULONG aSockSnd,
+                               ULONG aSockRcv,
+                               ULONG aTcpWndSnd,
+                               ULONG aTcpWndRcv);
+
+    HRESULT getNetworkSettings(ULONG *aMtu,
+                               ULONG *aSockSnd,
+                               ULONG *aSockRcv,
+                               ULONG *aTcpWndSnd,
+                               ULONG *aTcpWndRcv);
+
+    HRESULT addRedirect(const com::Utf8Str  &aName,
+                              NATProtocol_T aProto,
+                        const com::Utf8Str  &aHostIP,
+                              USHORT        aHostPort,
+                        const com::Utf8Str  &aGuestIP,
+                              USHORT        aGuestPort);
+
+    HRESULT removeRedirect(const com::Utf8Str &aName);
+
+    struct Data;
+    Data *mData;
     bool m_fModified;
     const ComObjPtr<NATEngine> mPeer;
     Machine * const mParent;
diff --git a/src/VBox/Main/include/NATNetworkImpl.h b/src/VBox/Main/include/NATNetworkImpl.h
index 1ce0769..16108bf 100644
--- a/src/VBox/Main/include/NATNetworkImpl.h
+++ b/src/VBox/Main/include/NATNetworkImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,8 +17,8 @@
 
 #ifndef ____H_H_NATNETWORKIMPL
 #define ____H_H_NATNETWORKIMPL
-
-#include "VirtualBoxBase.h"
+#include "VBoxEvents.h"
+#include "NATNetworkWrap.h"
 
 #ifdef VBOX_WITH_HOSTNETIF_API
 struct NETIFINFO;
@@ -52,93 +52,78 @@ public:
 };
 
 class ATL_NO_VTABLE NATNetwork :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(INATNetwork)
+    public NATNetworkWrap
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NATNetwork, INATNetwork)
-
-    DECLARE_NOT_AGGREGATABLE (NATNetwork)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP (NATNetwork)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(INATNetwork)
-    END_COM_MAP()
-
-    DECLARE_EMPTY_CTOR_DTOR (NATNetwork)
+    DECLARE_EMPTY_CTOR_DTOR(NATNetwork)
 
     HRESULT FinalConstruct();
     void FinalRelease();
 
     HRESULT init(VirtualBox *aVirtualBox,
-                 IN_BSTR aName);
+                 com::Utf8Str aName);
 
 
     HRESULT init(VirtualBox *aVirtualBox,
                  const settings::NATNetwork &data);
-    HRESULT saveSettings(settings::NATNetwork &data);
     void uninit();
-    // INATNetwork::EventSource
-    STDMETHOD(COMGETTER(EventSource))(IEventSource **IEventSource);
-    // INATNetwork properties
-    STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
-
-    STDMETHOD(COMGETTER(NetworkName))(BSTR *aName);
-    STDMETHOD(COMSETTER(NetworkName))(IN_BSTR aName);
-
-    STDMETHOD(COMGETTER(Gateway))(BSTR *aIPGateway);
-
-    STDMETHOD(COMGETTER(Network))(BSTR *aIPNetwork);
-    STDMETHOD(COMSETTER(Network))(IN_BSTR aIPNetwork);
-
-    STDMETHOD(COMGETTER(IPv6Enabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(IPv6Enabled))(BOOL aEnabled);
-
-    STDMETHOD(COMGETTER(IPv6Prefix))(BSTR *aName);
-    STDMETHOD(COMSETTER(IPv6Prefix))(IN_BSTR aName);
-
-    STDMETHOD(COMGETTER(AdvertiseDefaultIPv6RouteEnabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(AdvertiseDefaultIPv6RouteEnabled))(BOOL aEnabled);
-
-    STDMETHOD(COMGETTER(NeedDhcpServer))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(NeedDhcpServer))(BOOL aEnabled);
-
-    STDMETHOD(COMGETTER(LocalMappings))(ComSafeArrayOut(BSTR, aLocalMappings));
-    STDMETHOD(AddLocalMapping)(IN_BSTR aHostId, LONG aOffset);
-
-    STDMETHOD(COMGETTER(LoopbackIp6))(LONG *aLoopbackIp6);
-    STDMETHOD(COMSETTER(LoopbackIp6))(LONG aLoopbackIp6);
-
-    STDMETHOD(COMGETTER(PortForwardRules4))(ComSafeArrayOut(BSTR, aPortForwardRules4));
-    STDMETHOD(COMGETTER(PortForwardRules6))(ComSafeArrayOut(BSTR, aPortForwardRules6));
-
-    STDMETHOD(AddPortForwardRule)(BOOL aIsIpv6,
-                                  IN_BSTR aPortForwardRuleName,
-                                  NATProtocol_T aProto,
-                                  IN_BSTR aHostIp,
-                                  USHORT aHostPort,
-                                  IN_BSTR aGuestIp,
-                                  USHORT aGuestPort);
-    STDMETHOD(RemovePortForwardRule)(BOOL aIsIpv6, IN_BSTR aPortForwardRuleName);
-
-    STDMETHOD(Start)(IN_BSTR aTrunkType);
-    STDMETHOD(Stop)();
+    HRESULT i_saveSettings(settings::NATNetwork &data);
 
 private:
-    int recalculateIpv4AddressAssignments();
-    int findFirstAvailableOffset(ADDRESSLOOKUPTYPE, uint32_t *);
+
+    // Wrapped INATNetwork properties
+    HRESULT getNetworkName(com::Utf8Str &aNetworkName);
+    HRESULT setNetworkName(const com::Utf8Str &aNetworkName);
+    HRESULT getEnabled(BOOL *aEnabled);
+    HRESULT setEnabled(BOOL aEnabled);
+    HRESULT getNetwork(com::Utf8Str &aNetwork);
+    HRESULT setNetwork(const com::Utf8Str &aNetwork);
+    HRESULT getGateway(com::Utf8Str &aGateway);
+    HRESULT getIPv6Enabled(BOOL *aIPv6Enabled);
+    HRESULT setIPv6Enabled(BOOL aIPv6Enabled);
+    HRESULT getIPv6Prefix(com::Utf8Str &aIPv6Prefix);
+    HRESULT setIPv6Prefix(const com::Utf8Str &aIPv6Prefix);
+    HRESULT getAdvertiseDefaultIPv6RouteEnabled(BOOL *aAdvertiseDefaultIPv6RouteEnabled);
+    HRESULT setAdvertiseDefaultIPv6RouteEnabled(BOOL aAdvertiseDefaultIPv6RouteEnabled);
+    HRESULT getNeedDhcpServer(BOOL *aNeedDhcpServer);
+    HRESULT setNeedDhcpServer(BOOL aNeedDhcpServer);
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+    HRESULT getPortForwardRules4(std::vector<com::Utf8Str> &aPortForwardRules4);
+    HRESULT getLocalMappings(std::vector<com::Utf8Str> &aLocalMappings);
+    HRESULT getLoopbackIp6(LONG *aLoopbackIp6);
+    HRESULT setLoopbackIp6(LONG aLoopbackIp6);
+    HRESULT getPortForwardRules6(std::vector<com::Utf8Str> &aPortForwardRules6);
+
+    // wrapped INATNetwork methods
+    HRESULT addLocalMapping(const com::Utf8Str &aHostid,
+                                  LONG aOffset);
+    HRESULT addPortForwardRule(BOOL aIsIpv6,
+                               const com::Utf8Str &aRuleName,
+                               NATProtocol_T aProto,
+                               const com::Utf8Str &aHostIP,
+                               USHORT aHostPort,
+                               const com::Utf8Str &aGuestIP,
+                               USHORT aGuestPort);
+    HRESULT removePortForwardRule(BOOL aISipv6,
+                                  const com::Utf8Str &aRuleName);
+    HRESULT start(const com::Utf8Str &aTrunkType);
+    HRESULT stop();
+
+    // Internal methods
+    int i_recalculateIpv4AddressAssignments();
+    int i_findFirstAvailableOffset(ADDRESSLOOKUPTYPE, uint32_t *);
 
     typedef std::map<Utf8Str, settings::NATRule> NATRuleMap;
     typedef NATRuleMap::const_iterator constNATRuleMapIterator;
 
-    void GetPortForwardRulesFromMap(ComSafeArrayOut(BSTR, aPortForwardRules), NATRuleMap& aRules);
+    void i_getPortForwardRulesFromMap(std::vector<Utf8Str> &aPortForwardRules, NATRuleMap& aRules);
+
     /** weak VirtualBox parent */
-    VirtualBox * const      mVirtualBox;
+    VirtualBox * const mVirtualBox;
+
+    const  com::Utf8Str mName;
 
-    const Bstr mName;
     struct Data;
     struct Data *m;
 
diff --git a/src/VBox/Main/include/NetworkAdapterImpl.h b/src/VBox/Main/include/NetworkAdapterImpl.h
index a99a957..da75cba 100644
--- a/src/VBox/Main/include/NetworkAdapterImpl.h
+++ b/src/VBox/Main/include/NetworkAdapterImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,11 +20,12 @@
 #ifndef ____H_NETWORKADAPTER
 #define ____H_NETWORKADAPTER
 
-#include "VirtualBoxBase.h"
-#include "NATEngineImpl.h"
-#include "BandwidthGroupImpl.h"
+#include "NetworkAdapterWrap.h"
 
 class GuestOSType;
+class BandwidthControl;
+class BandwidthGroup;
+class NATEngine;
 
 namespace settings
 {
@@ -32,11 +33,88 @@ namespace settings
 }
 
 class ATL_NO_VTABLE NetworkAdapter :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(INetworkAdapter)
+    public NetworkAdapterWrap
 {
 public:
 
+    DECLARE_EMPTY_CTOR_DTOR(NetworkAdapter)
+
+    HRESULT FinalConstruct();
+    void FinalRelease();
+
+    // public initializer/uninitializer for internal purposes only
+    HRESULT init(Machine *aParent, ULONG aSlot);
+    HRESULT init(Machine *aParent, NetworkAdapter *aThat, bool aReshare = false);
+    HRESULT initCopy(Machine *aParent, NetworkAdapter *aThat);
+    void uninit();
+
+    // public methods only for internal purposes
+    HRESULT i_loadSettings(BandwidthControl *bwctl, const settings::NetworkAdapter &data);
+    HRESULT i_saveSettings(settings::NetworkAdapter &data);
+
+    bool i_isModified();
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(NetworkAdapter *aThat);
+    void i_applyDefaults(GuestOSType *aOsType);
+
+    ComObjPtr<NetworkAdapter> i_getPeer();
+
+private:
+
+    // wrapped INetworkAdapter properties
+    HRESULT getAdapterType(NetworkAdapterType_T *aAdapterType);
+    HRESULT setAdapterType(NetworkAdapterType_T aAdapterType);
+    HRESULT getSlot(ULONG *aSlot);
+    HRESULT getEnabled(BOOL *aEnabled);
+    HRESULT setEnabled(BOOL aEnabled);
+    HRESULT getMACAddress(com::Utf8Str &aMACAddress);
+    HRESULT setMACAddress(const com::Utf8Str &aMACAddress);
+    HRESULT getAttachmentType(NetworkAttachmentType_T *aAttachmentType);
+    HRESULT setAttachmentType(NetworkAttachmentType_T aAttachmentType);
+    HRESULT getBridgedInterface(com::Utf8Str &aBridgedInterface);
+    HRESULT setBridgedInterface(const com::Utf8Str &aBridgedInterface);
+    HRESULT getHostOnlyInterface(com::Utf8Str &aHostOnlyInterface);
+    HRESULT setHostOnlyInterface(const com::Utf8Str &aHostOnlyInterface);
+    HRESULT getInternalNetwork(com::Utf8Str &aInternalNetwork);
+    HRESULT setInternalNetwork(const com::Utf8Str &aInternalNetwork);
+    HRESULT getNATNetwork(com::Utf8Str &aNATNetwork);
+    HRESULT setNATNetwork(const com::Utf8Str &aNATNetwork);
+    HRESULT getGenericDriver(com::Utf8Str &aGenericDriver);
+    HRESULT setGenericDriver(const com::Utf8Str &aGenericDriver);
+    HRESULT getCableConnected(BOOL *aCableConnected);
+    HRESULT setCableConnected(BOOL aCableConnected);
+    HRESULT getLineSpeed(ULONG *aLineSpeed);
+    HRESULT setLineSpeed(ULONG aLineSpeed);
+    HRESULT getPromiscModePolicy(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy);
+    HRESULT setPromiscModePolicy(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy);
+    HRESULT getTraceEnabled(BOOL *aTraceEnabled);
+    HRESULT setTraceEnabled(BOOL aTraceEnabled);
+    HRESULT getTraceFile(com::Utf8Str &aTraceFile);
+    HRESULT setTraceFile(const com::Utf8Str &aTraceFile);
+    HRESULT getNATEngine(ComPtr<INATEngine> &aNATEngine);
+    HRESULT getBootPriority(ULONG *aBootPriority);
+    HRESULT setBootPriority(ULONG aBootPriority);
+    HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup);
+    HRESULT setBandwidthGroup(const ComPtr<IBandwidthGroup> &aBandwidthGroup);
+
+    // wrapped INetworkAdapter methods
+    HRESULT getProperty(const com::Utf8Str &aKey,
+                        com::Utf8Str &aValue);
+    HRESULT setProperty(const com::Utf8Str &aKey,
+                        const com::Utf8Str &aValue);
+    HRESULT getProperties(const com::Utf8Str &aNames,
+                          std::vector<com::Utf8Str> &aReturnNames,
+                          std::vector<com::Utf8Str> &aReturnValues);
+    // Misc.
+    void i_generateMACAddress();
+    HRESULT i_updateMacAddress(Utf8Str aMacAddress);
+    void i_updateBandwidthGroup(BandwidthGroup *aBwGroup);
+    HRESULT i_checkAndSwitchFromNatNetworking(com::Utf8Str networkName);
+    HRESULT i_switchToNatNetworking(const com::Utf8Str &aNatNetworkName);
+
+    typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap;
+
     struct Data
     {
         Data() : mSlot(0),
@@ -55,108 +133,23 @@ public:
         NetworkAdapterType_T mAdapterType;
         ULONG mSlot;
         BOOL mEnabled;
-        Bstr mMACAddress;
+        com::Utf8Str mMACAddress;
         NetworkAttachmentType_T mAttachmentType;
         BOOL mCableConnected;
         ULONG mLineSpeed;
         NetworkAdapterPromiscModePolicy_T mPromiscModePolicy;
         BOOL mTraceEnabled;
-        Bstr mTraceFile;
-        Bstr mBridgedInterface;
-        Bstr mHostOnlyInterface;
-        Bstr mInternalNetwork;
-        Bstr mNATNetwork;
-        Bstr mGenericDriver;
-        settings::StringsMap mGenericProperties;
+        com::Utf8Str mTraceFile;
+        com::Utf8Str mBridgedInterface;
+        com::Utf8Str mHostOnlyInterface;
+        com::Utf8Str mInternalNetwork;
+        com::Utf8Str mNATNetwork;
+        com::Utf8Str mGenericDriver;
+        StringsMap mGenericProperties;
         ULONG mBootPriority;
-        Utf8Str mBandwidthGroup;
+        com::Utf8Str mBandwidthGroup;
     };
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NetworkAdapter, INetworkAdapter)
-
-    DECLARE_NOT_AGGREGATABLE(NetworkAdapter)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(NetworkAdapter)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(INetworkAdapter)
-    END_COM_MAP()
-
-    DECLARE_EMPTY_CTOR_DTOR(NetworkAdapter)
-
-    HRESULT FinalConstruct();
-    void FinalRelease();
-
-    // public initializer/uninitializer for internal purposes only
-    HRESULT init(Machine *aParent, ULONG aSlot);
-    HRESULT init(Machine *aParent, NetworkAdapter *aThat, bool aReshare = false);
-    HRESULT initCopy(Machine *aParent, NetworkAdapter *aThat);
-    void uninit();
-
-    // INetworkAdapter properties
-    STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aAdapterType);
-    STDMETHOD(COMSETTER(AdapterType))(NetworkAdapterType_T aAdapterType);
-    STDMETHOD(COMGETTER(Slot))(ULONG *aSlot);
-    STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(MACAddress))(BSTR *aMACAddress);
-    STDMETHOD(COMSETTER(MACAddress))(IN_BSTR aMACAddress);
-    STDMETHOD(COMGETTER(AttachmentType))(NetworkAttachmentType_T *aAttachmentType);
-    STDMETHOD(COMSETTER(AttachmentType))(NetworkAttachmentType_T aAttachmentType);
-    STDMETHOD(COMGETTER(BridgedInterface))(BSTR *aBridgedInterface);
-    STDMETHOD(COMSETTER(BridgedInterface))(IN_BSTR aBridgedInterface);
-    STDMETHOD(COMGETTER(HostOnlyInterface))(BSTR *aHostOnlyInterface);
-    STDMETHOD(COMSETTER(HostOnlyInterface))(IN_BSTR aHostOnlyInterface);
-    STDMETHOD(COMGETTER(InternalNetwork))(BSTR *aInternalNetwork);
-    STDMETHOD(COMSETTER(InternalNetwork))(IN_BSTR aInternalNetwork);
-    STDMETHOD(COMGETTER(NATNetwork))(BSTR *aNATNetwork);
-    STDMETHOD(COMSETTER(NATNetwork))(IN_BSTR aNATNetwork);
-    STDMETHOD(COMGETTER(GenericDriver))(BSTR *aGenericDriver);
-    STDMETHOD(COMSETTER(GenericDriver))(IN_BSTR aGenericDriver);
-    STDMETHOD(COMGETTER(CableConnected))(BOOL *aConnected);
-    STDMETHOD(COMSETTER(CableConnected))(BOOL aConnected);
-    STDMETHOD(COMGETTER(TraceEnabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(TraceEnabled))(BOOL aEnabled);
-    STDMETHOD(COMGETTER(LineSpeed))(ULONG *aSpeed);
-    STDMETHOD(COMSETTER(LineSpeed))(ULONG aSpeed);
-    STDMETHOD(COMGETTER(PromiscModePolicy))(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy);
-    STDMETHOD(COMSETTER(PromiscModePolicy))(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy);
-    STDMETHOD(COMGETTER(TraceFile))(BSTR *aTraceFile);
-    STDMETHOD(COMSETTER(TraceFile))(IN_BSTR aTraceFile);
-    STDMETHOD(COMGETTER(NATEngine))(INATEngine **aNATEngine);
-    STDMETHOD(COMGETTER(BootPriority))(ULONG *aBootPriority);
-    STDMETHOD(COMSETTER(BootPriority))(ULONG aBootPriority);
-    STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup);
-    STDMETHOD(COMSETTER(BandwidthGroup))(IBandwidthGroup *aBwGroup);
-
-    // INetworkAdapter methods
-    STDMETHOD(GetProperty)(IN_BSTR aName, BSTR *aValue);
-    STDMETHOD(SetProperty)(IN_BSTR aName, IN_BSTR aValue);
-    STDMETHOD(GetProperties)(IN_BSTR aNames,
-                             ComSafeArrayOut(BSTR, aReturnNames),
-                             ComSafeArrayOut(BSTR, aReturnValues));
-
-    // public methods only for internal purposes
-
-    HRESULT loadSettings(BandwidthControl *bwctl, const settings::NetworkAdapter &data);
-    HRESULT saveSettings(settings::NetworkAdapter &data);
-
-    bool isModified();
-    void rollback();
-    void commit();
-    void copyFrom(NetworkAdapter *aThat);
-    void applyDefaults(GuestOSType *aOsType);
-
-    ComObjPtr<NetworkAdapter> getPeer();
-
-private:
-
-    void generateMACAddress();
-    HRESULT updateMacAddress(Utf8Str aMacAddress);
-    void updateBandwidthGroup(BandwidthGroup *aBwGroup);
-    HRESULT checkAndSwitchFromNatNetworking(IN_BSTR aNatNetworkName);
-    HRESULT switchToNatNetworking(IN_BSTR aNatNetworkName);
-
     Machine * const     mParent;
     const ComObjPtr<NetworkAdapter> mPeer;
     const ComObjPtr<NATEngine> mNATEngine;
diff --git a/src/VBox/Main/include/ObjectState.h b/src/VBox/Main/include/ObjectState.h
new file mode 100644
index 0000000..0ce0f73
--- /dev/null
+++ b/src/VBox/Main/include/ObjectState.h
@@ -0,0 +1,129 @@
+/* $Id: ObjectState.h $ */
+/** @file
+ *
+ * VirtualBox object state handling definitions
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_OBJECTSTATE
+#define ____H_OBJECTSTATE
+
+#include "VBox/com/defs.h"
+#include "VBox/com/AutoLock.h"
+
+// Forward declaration needed, but nothing more.
+class VirtualBoxBase;
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// ObjectState
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Thec functionality implemented by this class is the primary object state
+ * (used by VirtualBoxBase and thus part of all API classes) that indicates
+ * if the object is ready to serve the calls, and if not, what stage it is
+ * currently at. Here is the primary state diagram:
+ *
+ *              +-------------------------------------------------------+
+ *              |                                                       |
+ *              |         (InitFailed) -----------------------+         |
+ *              |              ^                              |         |
+ *              v              |                              v         |
+ *  [*] ---> NotReady ----> (InInit) -----> Ready -----> (InUninit) ----+
+ *                     ^       |
+ *                     |       v
+ *                     |    Limited
+ *                     |       |
+ *                     +-------+
+ *
+ * The object is fully operational only when its state is Ready. The Limited
+ * state means that only some vital part of the object is operational, and it
+ * requires some sort of reinitialization to become fully operational. The
+ * NotReady state means the object is basically dead: it either was not yet
+ * initialized after creation at all, or was uninitialized and is waiting to be
+ * destroyed when the last reference to it is released. All other states are
+ * transitional.
+ *
+ * The NotReady->InInit->Ready, NotReady->InInit->Limited and
+ * NotReady->InInit->InitFailed transition is done by the AutoInitSpan smart
+ * class.
+ *
+ * The Limited->InInit->Ready, Limited->InInit->Limited and
+ * Limited->InInit->InitFailed transition is done by the AutoReinitSpan smart
+ * class.
+ *
+ * The Ready->InUninit->NotReady and InitFailed->InUninit->NotReady
+ * transitions are done by the AutoUninitSpan smart class.
+ *
+ * In order to maintain the primary state integrity and declared functionality
+ * the following rules apply everywhere:
+ *
+ * 1) Use the above Auto*Span classes to perform state transitions. See the
+ *    individual class descriptions for details.
+ *
+ * 2) All public methods of subclasses (i.e. all methods that can be called
+ *    directly, not only from within other methods of the subclass) must have a
+ *    standard prolog as described in the AutoCaller and AutoLimitedCaller
+ *    documentation. Alternatively, they must use #addCaller() and
+ *    #releaseCaller() directly (and therefore have both the prolog and the
+ *    epilog), but this is not recommended because it is easy to forget the
+ *    matching release, e.g. returning before reaching the call.
+ */
+class ObjectState
+{
+public:
+    enum State { NotReady, Ready, InInit, InUninit, InitFailed, Limited };
+
+    ObjectState(VirtualBoxBase *aObj);
+    ~ObjectState();
+
+    State getState();
+
+    HRESULT addCaller(bool aLimited = false);
+    void releaseCaller();
+
+    bool autoInitSpanConstructor(State aExpectedState);
+    void autoInitSpanDestructor(State aNewState);
+    State autoUninitSpanConstructor();
+    void autoUninitSpanDestructor();
+
+private:
+    ObjectState();
+
+    void setState(State aState);
+
+    /** Pointer to the managed object, mostly for error signalling or debugging
+     * purposes, not used much. Guaranteed to be valid during the lifetime of
+     * this object, no need to mess with refcount. */
+    VirtualBoxBase *mObj;
+    /** Primary state of this object */
+    State mState;
+    /** Thread that caused the last state change */
+    RTTHREAD mStateChangeThread;
+    /** Total number of active calls to this object */
+    unsigned mCallers;
+    /** Posted when the number of callers drops to zero */
+    RTSEMEVENT mZeroCallersSem;
+    /** Posted when the object goes from InInit/InUninit to some other state */
+    RTSEMEVENTMULTI mInitUninitSem;
+    /** Number of threads waiting for mInitUninitDoneSem */
+    unsigned mInitUninitWaiters;
+
+    /** Protects access to state related data members */
+    util::RWLockHandle mStateLock;
+};
+
+#endif // !____H_OBJECTSTATE
diff --git a/src/VBox/Main/include/PCIDeviceAttachmentImpl.h b/src/VBox/Main/include/PCIDeviceAttachmentImpl.h
index 8120be5..ec98e81 100644
--- a/src/VBox/Main/include/PCIDeviceAttachmentImpl.h
+++ b/src/VBox/Main/include/PCIDeviceAttachmentImpl.h
@@ -20,26 +20,15 @@
 #ifndef ____H_PCIDEVICEATTACHMENTIMPL
 #define ____H_PCIDEVICEATTACHMENTIMPL
 
-#include "VirtualBoxBase.h"
+#include "PCIDeviceAttachmentWrap.h"
 #include <VBox/settings.h>
 
 class ATL_NO_VTABLE PCIDeviceAttachment :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IPCIDeviceAttachment)
+    public PCIDeviceAttachmentWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(PCIDeviceAttachment, IPCIDeviceAttachment)
 
-    DECLARE_NOT_AGGREGATABLE(PCIDeviceAttachment)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(PCIDeviceAttachment)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IPCIDeviceAttachment)
-    END_COM_MAP()
-
-    PCIDeviceAttachment() { }
-    ~PCIDeviceAttachment() { }
+    DECLARE_EMPTY_CTOR_DTOR(PCIDeviceAttachment)
 
     // public initializer/uninitializer for internal purposes only
     HRESULT init(IMachine *    aParent,
@@ -51,20 +40,21 @@ public:
     void uninit();
 
     // settings
-    HRESULT loadSettings(IMachine * aParent,
-                         const settings::HostPCIDeviceAttachment& aHpda);
-    HRESULT saveSettings(settings::HostPCIDeviceAttachment &data);
+    HRESULT i_loadSettings(IMachine * aParent,
+                           const settings::HostPCIDeviceAttachment& aHpda);
+    HRESULT i_saveSettings(settings::HostPCIDeviceAttachment &data);
 
     HRESULT FinalConstruct();
     void FinalRelease();
 
-    // IPCIDeviceAttachment properties
-    STDMETHOD(COMGETTER(Name))(BSTR * aName);
-    STDMETHOD(COMGETTER(IsPhysicalDevice))(BOOL * aPhysical);
-    STDMETHOD(COMGETTER(HostAddress))(LONG  * hostAddress);
-    STDMETHOD(COMGETTER(GuestAddress))(LONG * guestAddress);
-
 private:
+
+    // wrapped IPCIDeviceAttachment properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getIsPhysicalDevice(BOOL *aIsPhysicalDevice);
+    HRESULT getHostAddress(LONG *aHostAddress);
+    HRESULT getGuestAddress(LONG *aGuestAddress);
+
     struct Data;
     Data*  m;
 };
diff --git a/src/VBox/Main/include/ParallelPortImpl.h b/src/VBox/Main/include/ParallelPortImpl.h
index 4ff5e9d..b4cc563 100644
--- a/src/VBox/Main/include/ParallelPortImpl.h
+++ b/src/VBox/Main/include/ParallelPortImpl.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,7 +19,7 @@
 #ifndef ____H_PARALLELPORTIMPL
 #define ____H_PARALLELPORTIMPL
 
-#include "VirtualBoxBase.h"
+#include "ParallelPortWrap.h"
 
 namespace settings
 {
@@ -27,22 +27,11 @@ namespace settings
 }
 
 class ATL_NO_VTABLE ParallelPort :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IParallelPort)
+    public ParallelPortWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(ParallelPort, IParallelPort)
 
-    DECLARE_NOT_AGGREGATABLE(ParallelPort)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(ParallelPort)
-        VBOX_DEFAULT_INTERFACE_ENTRIES (IParallelPort)
-    END_COM_MAP()
-
-    ParallelPort() {}
-    ~ParallelPort() {}
+    DECLARE_EMPTY_CTOR_DTOR(ParallelPort)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -53,32 +42,29 @@ public:
     HRESULT initCopy (Machine *parent, ParallelPort *aThat);
     void uninit();
 
-    // IParallelPort properties
-    STDMETHOD(COMGETTER(Slot))    (ULONG     *aSlot);
-    STDMETHOD(COMGETTER(Enabled)) (BOOL      *aEnabled);
-    STDMETHOD(COMSETTER(Enabled)) (BOOL       aEnabled);
-    STDMETHOD(COMGETTER(IRQ))     (ULONG     *aIRQ);
-    STDMETHOD(COMSETTER(IRQ))     (ULONG      aIRQ);
-    STDMETHOD(COMGETTER(IOBase))  (ULONG     *aIOBase);
-    STDMETHOD(COMSETTER(IOBase))  (ULONG      aIOBase);
-    STDMETHOD(COMGETTER(Path))    (BSTR      *aPath);
-    STDMETHOD(COMSETTER(Path))    (IN_BSTR aPath);
+    HRESULT i_loadSettings(const settings::ParallelPort &data);
+    HRESULT i_saveSettings(settings::ParallelPort &data);
 
     // public methods only for internal purposes
-
-    HRESULT loadSettings(const settings::ParallelPort &data);
-    HRESULT saveSettings(settings::ParallelPort &data);
-
-    bool isModified();
-    void rollback();
-    void commit();
-    void copyFrom(ParallelPort *aThat);
-
-    // public methods for internal purposes only
-    // (ensure there is a caller and a read lock before calling them!)
+    bool i_isModified();
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(ParallelPort *aThat);
 
 private:
-    HRESULT checkSetPath(const Utf8Str &str);
+
+    // Wrapped IParallelPort properties
+    HRESULT getEnabled(BOOL *aEnabled);
+    HRESULT setEnabled(BOOL aEnabled);
+    HRESULT getSlot(ULONG *aSlot);
+    HRESULT getIRQ(ULONG *aIRQ);
+    HRESULT setIRQ(ULONG aIRQ);
+    HRESULT getIOBase(ULONG *aIOBase);
+    HRESULT setIOBase(ULONG aIOBase);
+    HRESULT getPath(com::Utf8Str &aPath);
+    HRESULT setPath(const com::Utf8Str &aPath);
+
+    HRESULT i_checkSetPath(const Utf8Str &str);
 
     struct Data;
     Data *m;
diff --git a/src/VBox/Main/include/Performance.h b/src/VBox/Main/include/Performance.h
index c1e8ed2..f0e5680 100644
--- a/src/VBox/Main/include/Performance.h
+++ b/src/VBox/Main/include/Performance.h
@@ -124,7 +124,7 @@ namespace pm
         {
             processes.clear();
             processes.reserve(mProcesses.size());
-            for (ProcessList::const_iterator it = mProcesses.begin(); it != mProcesses.end(); it++)
+            for (ProcessList::const_iterator it = mProcesses.begin(); it != mProcesses.end(); ++it)
                 processes.push_back(it->first);
         }
         const ProcessList& getProcessFlags() const
@@ -138,7 +138,7 @@ namespace pm
         ProcessFlagsPair& findProcess(RTPROCESS process)
         {
             ProcessList::iterator it;
-            for (it = mProcesses.begin(); it != mProcesses.end(); it++)
+            for (it = mProcesses.begin(); it != mProcesses.end(); ++it)
                 if (it->first == process)
                     return *it;
 
diff --git a/src/VBox/Main/include/ProgressImpl.h b/src/VBox/Main/include/ProgressImpl.h
index 6b01274..33678e2 100644
--- a/src/VBox/Main/include/ProgressImpl.h
+++ b/src/VBox/Main/include/ProgressImpl.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +19,7 @@
 #ifndef ____H_PROGRESSIMPL
 #define ____H_PROGRESSIMPL
 
+#include "ProgressWrap.h"
 #include "VirtualBoxBase.h"
 
 #include <iprt/semaphore.h>
@@ -29,60 +30,10 @@
  * Class for progress objects.
  */
 class ATL_NO_VTABLE Progress :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IProgress)
+    public ProgressWrap
 {
-protected:
-
-    DECLARE_EMPTY_CTOR_DTOR (Progress)
-
-
-    void checkForAutomaticTimeout(void);
-
-#if !defined (VBOX_COM_INPROC)
-    /** Weak parent. */
-    VirtualBox * const      mParent;
-#endif
-
-    const ComPtr<IUnknown>  mInitiator;
-
-    const Guid mId;
-    const Bstr mDescription;
-
-    uint64_t m_ullTimestamp;                        // progress object creation timestamp, for ETA computation
-
-    void (*m_pfnCancelCallback)(void *);
-    void *m_pvCancelUserArg;
-
-    /* The fields below are to be properly initialized by subclasses */
-
-    BOOL mCompleted;
-    BOOL mCancelable;
-    BOOL mCanceled;
-    HRESULT mResultCode;
-    ComPtr<IVirtualBoxErrorInfo> mErrorInfo;
-
-    ULONG m_cOperations;                            // number of operations (so that progress dialog can display something like 1/3)
-    ULONG m_ulTotalOperationsWeight;                // sum of weights of all operations, given to constructor
-
-    ULONG m_ulOperationsCompletedWeight;            // summed-up weight of operations that have been completed; initially 0
-
-    ULONG m_ulCurrentOperation;                     // operations counter, incremented with each setNextOperation()
-    Bstr m_bstrOperationDescription;                // name of current operation; initially from constructor, changed with setNextOperation()
-    ULONG m_ulCurrentOperationWeight;               // weight of current operation, given to setNextOperation()
-    ULONG m_ulOperationPercent;                     // percentage of current operation, set with setCurrentOperationProgress()
-    ULONG m_cMsTimeout;                             /**< Automatic timeout value. 0 means none. */
-
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Progress, IProgress)
-
-    DECLARE_NOT_AGGREGATABLE (Progress)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP (Progress)
-        VBOX_DEFAULT_INTERFACE_ENTRIES (IProgress)
-    END_COM_MAP()
+    DECLARE_NOT_AGGREGATABLE(Progress)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -96,20 +47,18 @@ public:
      * @param aInitiator
      * @param aDescription
      * @param aCancelable
-     * @param aId
      * @return
      */
     HRESULT init(
-#if !defined (VBOX_COM_INPROC)
+#if !defined(VBOX_COM_INPROC)
                   VirtualBox *aParent,
 #endif
                   IUnknown *aInitiator,
-                  CBSTR aDescription,
-                  BOOL aCancelable,
-                  OUT_GUID aId = NULL)
+                  Utf8Str aDescription,
+                  BOOL aCancelable)
     {
         return init(
-#if !defined (VBOX_COM_INPROC)
+#if !defined(VBOX_COM_INPROC)
             aParent,
 #endif
             aInitiator,
@@ -117,9 +66,8 @@ public:
             aCancelable,
             1,      // cOperations
             1,      // ulTotalOperationsWeight
-            aDescription, // bstrFirstOperationDescription
-            1,      // ulFirstOperationWeight
-            aId);
+            aDescription, // aFirstOperationDescription
+            1);     // ulFirstOperationWeight
     }
 
     /**
@@ -131,21 +79,19 @@ public:
      * @param aCancelable
      * @param cOperations
      * @param bstrFirstOperationDescription
-     * @param aId
      * @return
      */
     HRESULT init(
-#if !defined (VBOX_COM_INPROC)
+#if !defined(VBOX_COM_INPROC)
                   VirtualBox *aParent,
 #endif
                   IUnknown *aInitiator,
-                  CBSTR aDescription, BOOL aCancelable,
+                  Utf8Str aDescription, BOOL aCancelable,
                   ULONG cOperations,
-                  CBSTR bstrFirstOperationDescription,
-                  OUT_GUID aId = NULL)
+                  Utf8Str aFirstOperationDescription)
     {
         return init(
-#if !defined (VBOX_COM_INPROC)
+#if !defined(VBOX_COM_INPROC)
             aParent,
 #endif
             aInitiator,
@@ -153,99 +99,120 @@ public:
             aCancelable,
             cOperations,      // cOperations
             cOperations,      // ulTotalOperationsWeight = cOperations
-            bstrFirstOperationDescription, // bstrFirstOperationDescription
-            1,      // ulFirstOperationWeight: weigh them all the same
-            aId);
+            aFirstOperationDescription, // aFirstOperationDescription
+            1);     // ulFirstOperationWeight: weigh them all the same
     }
 
     HRESULT init(
-#if !defined (VBOX_COM_INPROC)
+#if !defined(VBOX_COM_INPROC)
                   VirtualBox *aParent,
 #endif
                   IUnknown *aInitiator,
-                  CBSTR aDescription,
+                  Utf8Str aDescription,
                   BOOL aCancelable,
                   ULONG cOperations,
                   ULONG ulTotalOperationsWeight,
-                  CBSTR bstrFirstOperationDescription,
-                  ULONG ulFirstOperationWeight,
-                  OUT_GUID aId = NULL);
+                  Utf8Str aFirstOperationDescription,
+                  ULONG ulFirstOperationWeight);
 
     HRESULT init(BOOL aCancelable,
                  ULONG aOperationCount,
-                 CBSTR aOperationDescription);
+                 Utf8Str aOperationDescription);
 
-//   initializer/uninitializer for internal purposes only
-    HRESULT init(AutoInitSpan &aAutoInitSpan,
-#if !defined (VBOX_COM_INPROC)
-               VirtualBox *aParent,
-#endif
-               IUnknown *aInitiator,
-               CBSTR aDescription, OUT_GUID aId = NULL);
-    HRESULT init(AutoInitSpan &aAutoInitSpan);
-    void init(AutoUninitSpan &aAutoUninitSpan);
     void uninit();
-    void uninit(AutoUninitSpan &aAutoUninitSpan);
 
-    // IProgress methods
-    STDMETHOD(WaitForCompletion)(LONG aTimeout);
-    STDMETHOD(WaitForOperationCompletion)(ULONG aOperation, LONG aTimeout);
-    STDMETHOD(WaitForAsyncProgressCompletion)(IProgress *pProgressAsync);
-    STDMETHOD(Cancel)();
-
-    STDMETHOD(SetCurrentOperationProgress)(ULONG aPercent);
-    STDMETHOD(SetNextOperation)(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight);
 
     // public methods only for internal purposes
+    HRESULT i_notifyComplete(HRESULT aResultCode);
+    HRESULT i_notifyComplete(HRESULT aResultCode,
+                             const GUID &aIID,
+                             const char *pcszComponent,
+                             const char *aText,
+                             ...);
+    HRESULT i_notifyCompleteV(HRESULT aResultCode,
+                              const GUID &aIID,
+                              const char *pcszComponent,
+                              const char *aText,
+                              va_list va);
+    HRESULT i_notifyCompleteEI(HRESULT aResultCode,
+                               const ComPtr<IVirtualBoxErrorInfo> &aErrorInfo);
+
+    bool i_notifyPointOfNoReturn(void);
+    bool i_setCancelCallback(void (*pfnCallback)(void *), void *pvUser);
 
-    HRESULT setResultCode(HRESULT aResultCode);
-
-    HRESULT notifyComplete(HRESULT aResultCode);
-    HRESULT notifyComplete(HRESULT aResultCode,
-                           const GUID &aIID,
-                           const char *pcszComponent,
-                           const char *aText,
-                           ...);
-    HRESULT notifyCompleteV(HRESULT aResultCode,
-                            const GUID &aIID,
-                            const char *pcszComponent,
-                            const char *aText,
-                            va_list va);
-    bool notifyPointOfNoReturn(void);
-
-    // IProgress properties
-    STDMETHOD(COMGETTER(Id)) (BSTR *aId);
-    STDMETHOD(COMGETTER(Description)) (BSTR *aDescription);
-    STDMETHOD(COMGETTER(Initiator)) (IUnknown **aInitiator);
-
-    // IProgress properties
-    STDMETHOD(COMGETTER(Cancelable)) (BOOL *aCancelable);
-    STDMETHOD(COMGETTER(Percent)) (ULONG *aPercent);
-    STDMETHOD(COMGETTER(TimeRemaining)) (LONG *aTimeRemaining);
-    STDMETHOD(COMGETTER(Completed)) (BOOL *aCompleted);
-    STDMETHOD(COMGETTER(Canceled)) (BOOL *aCanceled);
-    STDMETHOD(COMGETTER(ResultCode)) (LONG *aResultCode);
-    STDMETHOD(COMGETTER(ErrorInfo)) (IVirtualBoxErrorInfo **aErrorInfo);
-    STDMETHOD(COMGETTER(OperationCount)) (ULONG *aOperationCount);
-    STDMETHOD(COMGETTER(Operation)) (ULONG *aOperation);
-    STDMETHOD(COMGETTER(OperationDescription)) (BSTR *aOperationDescription);
-    STDMETHOD(COMGETTER(OperationPercent)) (ULONG *aOperationPercent);
-    STDMETHOD(COMGETTER(OperationWeight)) (ULONG *aOperationWeight);
-    STDMETHOD(COMSETTER(Timeout)) (ULONG aTimeout);
-    STDMETHOD(COMGETTER(Timeout)) (ULONG *aTimeout);
+protected:
+    DECLARE_EMPTY_CTOR_DTOR(Progress)
 
-    // public methods only for internal purposes
+#if !defined(VBOX_COM_INPROC)
+    /** Weak parent. */
+    VirtualBox * const      mParent;
+#endif
+
+    const ComPtr<IUnknown>  mInitiator;
 
-    bool setCancelCallback(void (*pfnCallback)(void *), void *pvUser);
+    const Guid mId;
+    const com::Utf8Str mDescription;
 
+    uint64_t m_ullTimestamp;                        // progress object creation timestamp, for ETA computation
 
-    // unsafe inline public methods for internal purposes only (ensure there is
-    // a caller and a read lock before calling them!)
-    BOOL getCompleted() const { return mCompleted; }
-    HRESULT getResultCode() const { return mResultCode; }
-    double calcTotalPercent();
+    void (*m_pfnCancelCallback)(void *);
+    void *m_pvCancelUserArg;
+
+    /* The fields below are to be properly initialized by subclasses */
+
+    BOOL mCompleted;
+    BOOL mCancelable;
+    BOOL mCanceled;
+    HRESULT mResultCode;
+    ComPtr<IVirtualBoxErrorInfo> mErrorInfo;
+
+    ULONG m_cOperations;                            // number of operations (so that progress dialog can
+                                                    // display something like 1/3)
+    ULONG m_ulTotalOperationsWeight;                // sum of weights of all operations, given to constructor
+
+    ULONG m_ulOperationsCompletedWeight;            // summed-up weight of operations that have been completed; initially 0
+
+    ULONG m_ulCurrentOperation;                     // operations counter, incremented with
+                                                    // each setNextOperation()
+    com::Utf8Str m_operationDescription;            // name of current operation; initially
+                                                    // from constructor, changed with setNextOperation()
+    ULONG m_ulCurrentOperationWeight;               // weight of current operation, given to setNextOperation()
+    ULONG m_ulOperationPercent;                     // percentage of current operation, set with setCurrentOperationProgress()
+    ULONG m_cMsTimeout;                             /**< Automatic timeout value. 0 means none. */
 
 private:
+    // wrapped IProgress properties
+    HRESULT getId(com::Guid &aId);
+    HRESULT getDescription(com::Utf8Str &aDescription);
+    HRESULT getInitiator(ComPtr<IUnknown> &aInitiator);
+    HRESULT getCancelable(BOOL *aCancelable);
+    HRESULT getPercent(ULONG *aPercent);
+    HRESULT getTimeRemaining(LONG *aTimeRemaining);
+    HRESULT getCompleted(BOOL *aCompleted);
+    HRESULT getCanceled(BOOL *aCanceled);
+    HRESULT getResultCode(LONG *aResultCode);
+    HRESULT getErrorInfo(ComPtr<IVirtualBoxErrorInfo> &aErrorInfo);
+    HRESULT getOperationCount(ULONG *aOperationCount);
+    HRESULT getOperation(ULONG *aOperation);
+    HRESULT getOperationDescription(com::Utf8Str &aOperationDescription);
+    HRESULT getOperationPercent(ULONG *aOperationPercent);
+    HRESULT getOperationWeight(ULONG *aOperationWeight);
+    HRESULT getTimeout(ULONG *aTimeout);
+    HRESULT setTimeout(ULONG aTimeout);
+
+    // wrapped IProgress methods
+    HRESULT setCurrentOperationProgress(ULONG aPercent);
+    HRESULT setNextOperation(const com::Utf8Str &aNextOperationDescription,
+                             ULONG aNextOperationsWeight);
+    HRESULT waitForCompletion(LONG aTimeout);
+    HRESULT waitForOperationCompletion(ULONG aOperation,
+                                       LONG aTimeout);
+    HRESULT waitForAsyncProgressCompletion(const ComPtr<IProgress> &aPProgressAsync);
+    HRESULT cancel();
+
+    // internal helper methods
+    double i_calcTotalPercent();
+    void i_checkForAutomaticTimeout(void);
 
     RTSEMEVENTMULTI mCompletedSem;
     ULONG mWaitersCount;
diff --git a/src/VBox/Main/include/QMTranslator.h b/src/VBox/Main/include/QMTranslator.h
new file mode 100644
index 0000000..3dc89dd
--- /dev/null
+++ b/src/VBox/Main/include/QMTranslator.h
@@ -0,0 +1,57 @@
+/* $Id: QMTranslator.h $ */
+/** @file
+ * VirtualBox API translation handling class
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_QMTRANSLATOR
+#define ____H_QMTRANSLATOR
+
+class QMTranslator_Impl;
+
+class QMTranslator
+{
+public:
+    QMTranslator();
+    virtual ~QMTranslator();
+
+    /* Gets translation from loaded QM file
+     *
+     * @param   context   QM context to look for translation
+     * @param   source    Source string in one-byte encoding
+     * @param   disamb    Disambiguationg comment, empty by default
+     *
+     * @returns Pointer to a translation in UTF-8 encoding, empty string on failure */
+
+    const char *translate(const char *pszContext, const char *pszSource, const char *pszDisamb = "") const throw();
+
+    /* Loads and parses QM file
+     *
+     * @param       filename    The name of the file to load
+     *
+     * @returns VINF_SUCCESS if successful */
+    int load(const char *pszFilename) throw();
+
+private:
+        /* QMTranslator implementation.
+         * To separate all the code from the interface */
+    QMTranslator_Impl *_impl;
+
+    /* If copying is required, please define the following operators */
+    void operator=(QMTranslator &);
+    QMTranslator(const QMTranslator &);
+};
+
+#endif /* !____H_QMTRANSLATOR */
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/include/RemoteUSBBackend.h b/src/VBox/Main/include/RemoteUSBBackend.h
index baf47a4..4fc8ea4 100644
--- a/src/VBox/Main/include/RemoteUSBBackend.h
+++ b/src/VBox/Main/include/RemoteUSBBackend.h
@@ -1,3 +1,4 @@
+/* $Id: RemoteUSBBackend.h $ */
 /** @file
  *
  * VirtualBox Remote USB backend
diff --git a/src/VBox/Main/include/RemoteUSBDeviceImpl.h b/src/VBox/Main/include/RemoteUSBDeviceImpl.h
index e92552e..6de2ac4 100644
--- a/src/VBox/Main/include/RemoteUSBDeviceImpl.h
+++ b/src/VBox/Main/include/RemoteUSBDeviceImpl.h
@@ -64,6 +64,7 @@ public:
     STDMETHOD(COMGETTER(Port)) (USHORT *aPort);
     STDMETHOD(COMGETTER(Version)) (USHORT *aVersion);
     STDMETHOD(COMGETTER(PortVersion)) (USHORT *aPortVersion);
+    STDMETHOD(COMGETTER(Speed)) (USBConnectionSpeed_T *aSpeed);
     STDMETHOD(COMGETTER(Remote)) (BOOL *aRemote);
 
     // IHostUSBDevice properties
@@ -96,7 +97,7 @@ private:
     struct Data
     {
         Data() : vendorId (0), productId (0), revision (0), port (0), version (1),
-                 portVersion (1), dirty (FALSE), devId (0), clientId (0) {}
+                 portVersion (1), speed (USBConnectionSpeed_Null), dirty (FALSE), devId (0), clientId (0) {}
 
         const Guid id;
 
@@ -113,6 +114,7 @@ private:
         const uint16_t port;
         const uint16_t version;
         const uint16_t portVersion;
+        const USBConnectionSpeed_T speed;
 
         USBDeviceState_T state;
         bool dirty;
diff --git a/src/VBox/Main/include/SecretKeyStore.h b/src/VBox/Main/include/SecretKeyStore.h
new file mode 100644
index 0000000..af62b62
--- /dev/null
+++ b/src/VBox/Main/include/SecretKeyStore.h
@@ -0,0 +1,190 @@
+/* $Id: SecretKeyStore.h $ */
+/** @file
+ * Main - Secret key interface.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ____H_SECRETKEYSTORE
+#define ____H_SECRETKEYSTORE
+
+#include "VirtualBoxBase.h"
+#include "VBox/com/array.h"
+
+class SecretKey
+{
+    public:
+
+        /**
+         * Constructor for a secret key.
+         *
+         * @param pbKey                 The key buffer.
+         * @param cbKey                 Size of the key.
+         * @param fKeyBufNonPageable    Flag whether the key buffer should be non pageable.
+         */
+        SecretKey(const uint8_t *pbKey, size_t cbKey, bool fKeyBufNonPageable);
+
+        /**
+         * Secret key destructor.
+         */
+        ~SecretKey();
+
+        /**
+         * Increments the reference counter of the key.
+         *
+         * @returns The new reference count.
+         */
+        uint32_t retain();
+
+        /**
+         * Releases a reference of the key.
+         * If the reference counter reaches 0 the key buffer might be protected
+         * against further access or the data will become scrambled.
+         *
+         * @returns The new reference count.
+         */
+        uint32_t release();
+
+        /**
+         * Returns the reference count of the secret key.
+         */
+        uint32_t refCount();
+
+        /**
+         * Sets the possible number of users for this key.
+         *
+         * @returns VBox status code.
+         * @param   cUsers              The possible number of user for this key.
+         */
+        int setUsers(uint32_t cUsers);
+
+        /**
+         * Returns the possible amount of users.
+         *
+         * @returns Possible amount of users.
+         */
+        uint32_t getUsers();
+
+        /**
+         * Sets the remove on suspend flag.
+         *
+         * @returns VBox status code.
+         * @param   fRemoveOnSuspend    Flag whether to remove the key on host suspend.
+         */
+        int setRemoveOnSuspend(bool fRemoveOnSuspend);
+
+        /**
+         * Returns whether the key should be destroyed on suspend.
+         */
+        bool getRemoveOnSuspend();
+
+        /**
+         * Returns the buffer to the key.
+         */
+        const void *getKeyBuffer();
+
+        /**
+         * Returns the size of the key.
+         */
+        size_t getKeySize();
+
+    private:
+        /** Reference counter of the key. */
+        volatile uint32_t m_cRefs;
+        /** Key material. */
+        uint8_t          *m_pbKey;
+        /** Size of the key in bytes. */
+        size_t            m_cbKey;
+        /** Flag whether to remove the key on suspend. */
+        bool              m_fRemoveOnSuspend;
+        /** Number of entities which will use this key. */
+        uint32_t          m_cUsers;
+};
+
+class SecretKeyStore
+{
+    public:
+
+        /**
+         * Constructor for a secret key store.
+         *
+         * @param fKeyBufNonPageable    Flag whether the key buffer is required to
+         *                              be non pageable.
+         */
+        SecretKeyStore(bool fKeyBufNonPageable);
+
+        /**
+         * Destructor of a secret key store. This will free all stored secret keys
+         * inluding the key buffers. Make sure there no one accesses one of the keys
+         * stored.
+         */
+        ~SecretKeyStore();
+
+        /**
+         * Add a secret key to the store.
+         *
+         * @returns VBox status code.
+         * @param   strKeyId            The key identifier.
+         * @param   pbKey               The key to store.
+         * @param   cbKey               Size of the key.
+         */
+        int addSecretKey(const com::Utf8Str &strKeyId, const uint8_t *pbKey, size_t cbKey);
+
+        /**
+         * Deletes a key from the key store associated with the given identifier.
+         *
+         * @returns VBox status code.
+         * @param   strKeyId            The key identifier.
+         */
+        int deleteSecretKey(const com::Utf8Str &strKeyId);
+
+        /**
+         * Returns the secret key object associated with the given identifier.
+         * This increments the reference counter of the secret key object.
+         *
+         * @returns VBox status code.
+         * @param   strKeyId            The key identifier.
+         * @param   ppKey               Where to store the secret key object on success.
+         */
+        int retainSecretKey(const com::Utf8Str &strKeyId, SecretKey **ppKey);
+
+        /**
+         * Releases a reference to the secret key object.
+         *
+         * @returns VBox status code.
+         * @param   strKeyId            The key identifier.
+         */
+        int releaseSecretKey(const com::Utf8Str &strKeyId);
+
+        /**
+         * Deletes all secret keys from the key store.
+         *
+         * @returns VBox status code.
+         * @param   fSuspend           Flag whether to delete only keys which are
+         *                             marked for deletion during a suspend.
+         * @param   fForce             Flag whether to force deletion if some keys
+         *                             are still in use. Otherwise an error is returned.
+         */
+        int deleteAllSecretKeys(bool fSuspend, bool fForce);
+
+    private:
+
+        typedef std::map<com::Utf8Str, SecretKey *> SecretKeyMap;
+
+        /** The map to map key identifers to secret keys. */
+        SecretKeyMap m_mapSecretKeys;
+        /** Flag whether key buffers should be non pagable. */
+        bool         m_fKeyBufNonPageable;
+};
+
+#endif  /* !____H_SECRETKEYSTORE */
diff --git a/src/VBox/Main/include/SerialPortImpl.h b/src/VBox/Main/include/SerialPortImpl.h
index 9826f70..07c1d03 100644
--- a/src/VBox/Main/include/SerialPortImpl.h
+++ b/src/VBox/Main/include/SerialPortImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,7 +20,7 @@
 #ifndef ____H_SERIALPORTIMPL
 #define ____H_SERIALPORTIMPL
 
-#include "VirtualBoxBase.h"
+#include "SerialPortWrap.h"
 
 class GuestOSType;
 
@@ -30,21 +30,11 @@ namespace settings
 }
 
 class ATL_NO_VTABLE SerialPort :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(ISerialPort)
+    public SerialPortWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SerialPort, ISerialPort)
 
-    DECLARE_NOT_AGGREGATABLE(SerialPort)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(SerialPort)
-        VBOX_DEFAULT_INTERFACE_ENTRIES (ISerialPort)
-    END_COM_MAP()
-
-    DECLARE_EMPTY_CTOR_DTOR (SerialPort)
+    DECLARE_EMPTY_CTOR_DTOR(SerialPort)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -55,40 +45,58 @@ public:
     HRESULT initCopy (Machine *parent, SerialPort *aThat);
     void uninit();
 
-    // ISerialPort properties
-    STDMETHOD(COMGETTER(Slot))     (ULONG     *aSlot);
-    STDMETHOD(COMGETTER(Enabled))  (BOOL      *aEnabled);
-    STDMETHOD(COMSETTER(Enabled))  (BOOL       aEnabled);
-    STDMETHOD(COMGETTER(HostMode)) (PortMode_T *aHostMode);
-    STDMETHOD(COMSETTER(HostMode)) (PortMode_T  aHostMode);
-    STDMETHOD(COMGETTER(IRQ))      (ULONG     *aIRQ);
-    STDMETHOD(COMSETTER(IRQ))      (ULONG      aIRQ);
-    STDMETHOD(COMGETTER(IOBase) )  (ULONG     *aIOBase);
-    STDMETHOD(COMSETTER(IOBase))   (ULONG      aIOBase);
-    STDMETHOD(COMGETTER(Path))     (BSTR      *aPath);
-    STDMETHOD(COMSETTER(Path))     (IN_BSTR aPath);
-    STDMETHOD(COMGETTER(Server))   (BOOL      *aServer);
-    STDMETHOD(COMSETTER(Server))   (BOOL       aServer);
-
     // public methods only for internal purposes
+    HRESULT i_loadSettings(const settings::SerialPort &data);
+    HRESULT i_saveSettings(settings::SerialPort &data);
 
-    HRESULT loadSettings(const settings::SerialPort &data);
-    HRESULT saveSettings(settings::SerialPort &data);
-
-    bool isModified();
-    void rollback();
-    void commit();
-    void copyFrom(SerialPort *aThat);
+    bool i_isModified();
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(SerialPort *aThat);
 
-    void applyDefaults (GuestOSType *aOsType);
+    void i_applyDefaults (GuestOSType *aOsType);
 
     // public methods for internal purposes only
     // (ensure there is a caller and a read lock before calling them!)
 
 private:
-    HRESULT checkSetPath(const Utf8Str &str);
 
-    struct Data;
+    HRESULT i_checkSetPath(const Utf8Str &str);
+
+    // Wrapped ISerialPort properties
+    HRESULT getEnabled(BOOL *aEnabled);
+    HRESULT setEnabled(BOOL aEnabled);
+    HRESULT getHostMode(PortMode_T *aHostMode);
+    HRESULT setHostMode(PortMode_T aHostMode);
+    HRESULT getSlot(ULONG *aSlot);
+    HRESULT getIRQ(ULONG *aIRQ);
+    HRESULT setIRQ(ULONG aIRQ);
+    HRESULT getIOBase(ULONG *aIOBase);
+    HRESULT setIOBase(ULONG aIOBase);
+    HRESULT getServer(BOOL *aServer);
+    HRESULT setServer(BOOL aServer);
+    HRESULT getPath(com::Utf8Str &aPath);
+    HRESULT setPath(const com::Utf8Str &aPath);
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ////
+    //// SerialPort private data definition
+    ////
+    //////////////////////////////////////////////////////////////////////////////////
+    //
+    struct Data
+    {
+      Data()
+           : fModified(false),
+             pMachine(NULL)
+        { }
+
+       bool                                fModified;
+       Machine * const                     pMachine;
+       const ComObjPtr<SerialPort>         pPeer;
+       Backupable<settings::SerialPort>    bd;
+    };
+
     Data *m;
 };
 
diff --git a/src/VBox/Main/include/SessionImpl.h b/src/VBox/Main/include/SessionImpl.h
index b0f600e..9d619ae 100644
--- a/src/VBox/Main/include/SessionImpl.h
+++ b/src/VBox/Main/include/SessionImpl.h
@@ -1,9 +1,10 @@
+/* $Id: SessionImpl.h $ */
 /** @file
  * VBox Client Session COM Class definition
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -17,7 +18,7 @@
 #ifndef ____H_SESSIONIMPL
 #define ____H_SESSIONIMPL
 
-#include "VirtualBoxBase.h"
+#include "SessionWrap.h"
 #include "ConsoleImpl.h"
 
 #ifdef RT_OS_WINDOWS
@@ -28,29 +29,20 @@
 [threading(free)]
 #endif
 class ATL_NO_VTABLE Session :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(ISession),
-    VBOX_SCRIPTABLE_IMPL(IInternalSessionControl)
+    public SessionWrap
 #ifdef RT_OS_WINDOWS
     , public CComCoClass<Session, &CLSID_Session>
 #endif
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Session, ISession)
-
     DECLARE_CLASSFACTORY()
 
     DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
-    DECLARE_NOT_AGGREGATABLE(Session)
 
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
+    DECLARE_NOT_AGGREGATABLE(Session)
 
-    BEGIN_COM_MAP(Session)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(ISession)
-        COM_INTERFACE_ENTRY2(IDispatch, IInternalSessionControl)
-        COM_INTERFACE_ENTRY(IInternalSessionControl)
-    END_COM_MAP()
+    DECLARE_EMPTY_CTOR_DTOR(Session)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -59,65 +51,100 @@ public:
     HRESULT init();
     void uninit();
 
-    // ISession properties
-    STDMETHOD(COMGETTER(State))(SessionState_T *aState);
-    STDMETHOD(COMGETTER(Type))(SessionType_T *aType);
-    STDMETHOD(COMGETTER(Machine))(IMachine **aMachine);
-    STDMETHOD(COMGETTER(Console))(IConsole **aConsole);
+private:
 
-    // ISession methods
-    STDMETHOD(UnlockMachine)();
+    // Wrapped ISession properties
+    HRESULT getState(SessionState_T *aState);
+    HRESULT getType(SessionType_T *aType);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT setName(const com::Utf8Str &aName);
+    HRESULT getMachine(ComPtr<IMachine> &aMachine);
+    HRESULT getConsole(ComPtr<IConsole> &aConsole);
 
-    // IInternalSessionControl methods
-    STDMETHOD(GetPID)(ULONG *aPid);
-    STDMETHOD(GetRemoteConsole)(IConsole **aConsole);
-#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
-    STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType, IN_BSTR aTokenId);
-#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-    STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType, IToken *aToken);
-#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-    STDMETHOD(AssignRemoteMachine)(IMachine *aMachine, IConsole *aConsole);
-    STDMETHOD(UpdateMachineState)(MachineState_T aMachineState);
-    STDMETHOD(Uninitialize)();
-    STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *networkAdapter, BOOL changeAdapter);
-    STDMETHOD(OnSerialPortChange)(ISerialPort *serialPort);
-    STDMETHOD(OnParallelPortChange)(IParallelPort *parallelPort);
-    STDMETHOD(OnStorageControllerChange)();
-    STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment, BOOL aForce);
-    STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove);
-    STDMETHOD(OnCPUExecutionCapChange)(ULONG aExecutionCap);
-    STDMETHOD(OnVRDEServerChange)(BOOL aRestart);
-    STDMETHOD(OnVideoCaptureChange)();
-    STDMETHOD(OnUSBControllerChange)();
-    STDMETHOD(OnSharedFolderChange)(BOOL aGlobal);
-    STDMETHOD(OnClipboardModeChange)(ClipboardMode_T aClipboardMode);
-    STDMETHOD(OnDragAndDropModeChange)(DragAndDropMode_T aDragAndDropMode);
-    STDMETHOD(OnUSBDeviceAttach)(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
-    STDMETHOD(OnUSBDeviceDetach)(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
-    STDMETHOD(OnShowWindow)(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
-    STDMETHOD(OnBandwidthGroupChange)(IBandwidthGroup *aBandwidthGroup);
-    STDMETHOD(OnStorageDeviceChange)(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
-    STDMETHOD(AccessGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
-                                   BOOL aIsSetter, BSTR *aRetValue, LONG64 *aRetTimestamp, BSTR *aRetFlags);
-    STDMETHOD(EnumerateGuestProperties)(IN_BSTR aPatterns,
-                                        ComSafeArrayOut(BSTR, aNames),
-                                        ComSafeArrayOut(BSTR, aValues),
-                                        ComSafeArrayOut(LONG64, aTimestamps),
-                                        ComSafeArrayOut(BSTR, aFlags));
-    STDMETHOD(OnlineMergeMedium)(IMediumAttachment *aMediumAttachment,
-                                 ULONG aSourceIdx, ULONG aTargetIdx,
-                                 IProgress *aProgress);
-    STDMETHOD(EnableVMMStatistics)(BOOL aEnable);
-    STDMETHOD(PauseWithReason)(Reason_T aReason);
-    STDMETHOD(ResumeWithReason)(Reason_T aReason);
-    STDMETHOD(SaveStateWithReason)(Reason_T aReason, IProgress **aProgress);
+    // Wrapped ISession methods
+    HRESULT unlockMachine();
 
-private:
+    // Wrapped IInternalSessionControl properties
+    HRESULT getPID(ULONG *aPid);
+    HRESULT getRemoteConsole(ComPtr<IConsole> &aRemoteConsole);
+    HRESULT getNominalState(MachineState_T *aNominalState);
 
-    HRESULT unlockMachine(bool aFinalRelease, bool aFromServer, AutoWriteLock &alock);
+    // Wrapped IInternalSessionControl methods
+#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
+    HRESULT assignMachine(const ComPtr<IMachine> &aMachine,
+                          LockType_T aLockType,
+                          const com::Utf8Str &aTokenId);
+#else
+    HRESULT assignMachine(const ComPtr<IMachine> &aMachine,
+                          LockType_T aLockType,
+                          const ComPtr<IToken> &aToken);
+#endif /* !VBOX_WITH_GENERIC_SESSION_WATCHER */
+    HRESULT assignRemoteMachine(const ComPtr<IMachine> &aMachine,
+                                const ComPtr<IConsole> &aConsole);
+    HRESULT updateMachineState(MachineState_T aMachineState);
+    HRESULT uninitialize();
+    HRESULT onNetworkAdapterChange(const ComPtr<INetworkAdapter> &aNetworkAdapter,
+                                   BOOL aChangeAdapter);
+    HRESULT onSerialPortChange(const ComPtr<ISerialPort> &aSerialPort);
+    HRESULT onParallelPortChange(const ComPtr<IParallelPort> &aParallelPort);
+    HRESULT onStorageControllerChange();
+    HRESULT onMediumChange(const ComPtr<IMediumAttachment> &aMediumAttachment,
+                           BOOL aForce);
+    HRESULT onStorageDeviceChange(const ComPtr<IMediumAttachment> &aMediumAttachment,
+                                  BOOL aRemove,
+                                  BOOL aSilent);
+    HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode);
+    HRESULT onDnDModeChange(DnDMode_T aDndMode);
+    HRESULT onCPUChange(ULONG aCpu,
+                        BOOL aAdd);
+    HRESULT onCPUExecutionCapChange(ULONG aExecutionCap);
+    HRESULT onVRDEServerChange(BOOL aRestart);
+    HRESULT onVideoCaptureChange();
+    HRESULT onUSBControllerChange();
+    HRESULT onSharedFolderChange(BOOL aGlobal);
+    HRESULT onUSBDeviceAttach(const ComPtr<IUSBDevice> &aDevice,
+                              const ComPtr<IVirtualBoxErrorInfo> &aError,
+                              ULONG aMaskedInterfaces,
+                              const com::Utf8Str &aCaptureFilename);
+    HRESULT onUSBDeviceDetach(const com::Guid &aId,
+                              const ComPtr<IVirtualBoxErrorInfo> &aError);
+    HRESULT onShowWindow(BOOL aCheck,
+                         BOOL *aCanShow,
+                         LONG64 *aWinId);
+    HRESULT onBandwidthGroupChange(const ComPtr<IBandwidthGroup> &aBandwidthGroup);
+    HRESULT accessGuestProperty(const com::Utf8Str &aName,
+                                const com::Utf8Str &aValue,
+                                const com::Utf8Str &aFlags,
+                                ULONG aAccessMode,
+                                com::Utf8Str &aRetValue,
+                                LONG64 *aRetTimestamp,
+                                com::Utf8Str &aRetFlags);
+    HRESULT enumerateGuestProperties(const com::Utf8Str &aPatterns,
+                                     std::vector<com::Utf8Str> &aKeys,
+                                     std::vector<com::Utf8Str> &aValues,
+                                     std::vector<LONG64> &aTimestamps,
+                                     std::vector<com::Utf8Str> &aFlags);
+    HRESULT onlineMergeMedium(const ComPtr<IMediumAttachment> &aMediumAttachment,
+                              ULONG aSourceIdx,
+                              ULONG aTargetIdx,
+                              const ComPtr<IProgress> &aProgress);
+    HRESULT reconfigureMediumAttachments(const std::vector<ComPtr<IMediumAttachment> > &aAttachments);
+    HRESULT enableVMMStatistics(BOOL aEnable);
+    HRESULT pauseWithReason(Reason_T aReason);
+    HRESULT resumeWithReason(Reason_T aReason);
+    HRESULT saveStateWithReason(Reason_T aReason,
+                                const ComPtr<IProgress> &aProgress,
+                                const Utf8Str &aStateFilePath,
+                                BOOL aPauseVM,
+                                BOOL *aLeftPaused);
+    HRESULT cancelSaveStateWithReason();
+
+
+    HRESULT i_unlockMachine(bool aFinalRelease, bool aFromServer);
 
     SessionState_T mState;
     SessionType_T mType;
+    Utf8Str mName;
 
     ComPtr<IInternalMachineControl> mControl;
 
diff --git a/src/VBox/Main/include/SharedFolderImpl.h b/src/VBox/Main/include/SharedFolderImpl.h
index d14a7b5..b9e8c84 100644
--- a/src/VBox/Main/include/SharedFolderImpl.h
+++ b/src/VBox/Main/include/SharedFolderImpl.h
@@ -1,3 +1,4 @@
+/* $Id: SharedFolderImpl.h $ */
 /** @file
  *
  * VirtualBox COM class implementation
@@ -18,27 +19,16 @@
 #ifndef ____H_SHAREDFOLDERIMPL
 #define ____H_SHAREDFOLDERIMPL
 
-#include "VirtualBoxBase.h"
+#include "SharedFolderWrap.h"
 #include <VBox/shflsvc.h>
 
 class Console;
 
 class ATL_NO_VTABLE SharedFolder :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(ISharedFolder)
+    public SharedFolderWrap
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SharedFolder, ISharedFolder)
-
-    DECLARE_NOT_AGGREGATABLE(SharedFolder)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(SharedFolder)
-        VBOX_DEFAULT_INTERFACE_ENTRIES  (ISharedFolder)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
 
     HRESULT FinalConstruct();
@@ -51,14 +41,6 @@ public:
 //     HRESULT init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
     void uninit();
 
-    // ISharedFolder properties
-    STDMETHOD(COMGETTER(Name)) (BSTR *aName);
-    STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
-    STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
-    STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
-    STDMETHOD(COMGETTER(AutoMount)) (BOOL *aAutoMount);
-    STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
-
     // public methods for internal purposes only
     // (ensure there is a caller and a read lock before calling them!)
 
@@ -66,44 +48,52 @@ public:
      * Public internal method. Returns the shared folder's name. Needs caller! Locking not necessary.
      * @return
      */
-    const Utf8Str& getName() const;
+    const Utf8Str& i_getName() const;
 
     /**
      * Public internal method. Returns the shared folder's host path. Needs caller! Locking not necessary.
      * @return
      */
-    const Utf8Str& getHostPath() const;
+    const Utf8Str& i_getHostPath() const;
 
     /**
      * Public internal method. Returns true if the shared folder is writable. Needs caller and locking!
      * @return
      */
-    bool isWritable() const;
+    bool i_isWritable() const;
 
     /**
      * Public internal method. Returns true if the shared folder is auto-mounted. Needs caller and locking!
      * @return
      */
-    bool isAutoMounted() const;
+    bool i_isAutoMounted() const;
 
 protected:
 
-    HRESULT protectedInit(VirtualBoxBase *aParent,
-                          const Utf8Str &aName,
-                          const Utf8Str &aHostPath,
-                          bool aWritable,
-                          bool aAutoMount,
-                          bool fFailOnError);
+    HRESULT i_protectedInit(VirtualBoxBase *aParent,
+                            const Utf8Str &aName,
+                            const Utf8Str &aHostPath,
+                            bool aWritable,
+                            bool aAutoMount,
+                            bool fFailOnError);
 private:
 
-    VirtualBoxBase * const  mParent;
+    // wrapped ISharedFolder properies.
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getHostPath(com::Utf8Str &aHostPath);
+    HRESULT getAccessible(BOOL *aAccessible);
+    HRESULT getWritable(BOOL *aWritable);
+    HRESULT getAutoMount(BOOL *aAutoMount);
+    HRESULT getLastAccessError(com::Utf8Str &aLastAccessError);
+
+    VirtualBoxBase * const mParent;
 
     /* weak parents (only one of them is not null) */
 #if !defined(VBOX_COM_INPROC)
-    Machine * const         mMachine;
-    VirtualBox * const      mVirtualBox;
+    Machine        * const mMachine;
+    VirtualBox     * const mVirtualBox;
 #else
-    Console * const         mConsole;
+    Console        * const mConsole;
 #endif
 
     struct Data;            // opaque data struct, defined in SharedFolderImpl.cpp
diff --git a/src/VBox/Main/include/SnapshotImpl.h b/src/VBox/Main/include/SnapshotImpl.h
index e86bbbc..b02b554 100644
--- a/src/VBox/Main/include/SnapshotImpl.h
+++ b/src/VBox/Main/include/SnapshotImpl.h
@@ -1,12 +1,10 @@
 /* $Id: SnapshotImpl.h $ */
-
 /** @file
- *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,9 +18,7 @@
 #ifndef ____H_SNAPSHOTIMPL
 #define ____H_SNAPSHOTIMPL
 
-#include "VirtualBoxBase.h"
-
-#include <iprt/time.h>
+#include "SnapshotWrap.h"
 
 class SnapshotMachine;
 
@@ -32,25 +28,10 @@ namespace settings
 }
 
 class ATL_NO_VTABLE Snapshot :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(ISnapshot)
+    public SnapshotWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Snapshot, ISnapshot)
-
-    DECLARE_NOT_AGGREGATABLE(Snapshot)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(Snapshot)
-        VBOX_DEFAULT_INTERFACE_ENTRIES (ISnapshot)
-    END_COM_MAP()
-
-    Snapshot()
-        : m(NULL)
-    { };
-    ~Snapshot()
-    { };
+    DECLARE_EMPTY_CTOR_DTOR(Snapshot)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -65,24 +46,9 @@ public:
                  Snapshot *aParent);
     void uninit();
 
-    void beginSnapshotDelete();
+    void i_beginSnapshotDelete();
 
-    void deparent();
-
-    // ISnapshot properties
-    STDMETHOD(COMGETTER(Id))(BSTR *aId);
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMSETTER(Name))(IN_BSTR aName);
-    STDMETHOD(COMGETTER(Description))(BSTR *aDescription);
-    STDMETHOD(COMSETTER(Description))(IN_BSTR aDescription);
-    STDMETHOD(COMGETTER(TimeStamp))(LONG64 *aTimeStamp);
-    STDMETHOD(COMGETTER(Online))(BOOL *aOnline);
-    STDMETHOD(COMGETTER(Machine))(IMachine **aMachine);
-    STDMETHOD(COMGETTER(Parent))(ISnapshot **aParent);
-    STDMETHOD(COMGETTER(Children))(ComSafeArrayOut(ISnapshot *, aChildren));
-
-    // ISnapshot methods
-    STDMETHOD(GetChildrenCount)(ULONG* count);
+    void i_deparent();
 
     // public methods only for internal purposes
 
@@ -95,44 +61,67 @@ public:
         return LOCKCLASS_SNAPSHOTOBJECT;
     }
 
-    const ComObjPtr<Snapshot>& getParent() const;
-    const ComObjPtr<Snapshot> getFirstChild() const;
+    const ComObjPtr<Snapshot>& i_getParent() const;
+    const ComObjPtr<Snapshot> i_getFirstChild() const;
+
+    const Utf8Str& i_getStateFilePath() const;
 
-    const Utf8Str& getStateFilePath() const;
+    uint32_t i_getDepth();
 
-    uint32_t getDepth();
+    ULONG i_getChildrenCount();
+    ULONG i_getAllChildrenCount();
+    ULONG i_getAllChildrenCountImpl();
 
-    ULONG getChildrenCount();
-    ULONG getAllChildrenCount();
-    ULONG getAllChildrenCountImpl();
+    const ComObjPtr<SnapshotMachine>& i_getSnapshotMachine() const;
 
-    const ComObjPtr<SnapshotMachine>& getSnapshotMachine() const;
+    Guid i_getId() const;
+    const Utf8Str& i_getName() const;
+    RTTIMESPEC i_getTimeStamp() const;
 
-    Guid getId() const;
-    const Utf8Str& getName() const;
-    RTTIMESPEC getTimeStamp() const;
+    ComObjPtr<Snapshot> i_findChildOrSelf(IN_GUID aId);
+    ComObjPtr<Snapshot> i_findChildOrSelf(const Utf8Str &aName);
 
-    ComObjPtr<Snapshot> findChildOrSelf(IN_GUID aId);
-    ComObjPtr<Snapshot> findChildOrSelf(const Utf8Str &aName);
+    void i_updateSavedStatePaths(const Utf8Str &strOldPath,
+                                 const Utf8Str &strNewPath);
+    void i_updateSavedStatePathsImpl(const Utf8Str &strOldPath,
+                                     const Utf8Str &strNewPath);
 
-    void updateSavedStatePaths(const Utf8Str &strOldPath,
-                               const Utf8Str &strNewPath);
-    void updateSavedStatePathsImpl(const Utf8Str &strOldPath,
-                                   const Utf8Str &strNewPath);
+    bool i_sharesSavedStateFile(const Utf8Str &strPath,
+                                Snapshot *pSnapshotToIgnore);
 
-    bool sharesSavedStateFile(const Utf8Str &strPath,
-                              Snapshot *pSnapshotToIgnore);
+    HRESULT i_saveSnapshot(settings::Snapshot &data) const;
+    HRESULT i_saveSnapshotImpl(settings::Snapshot &data) const;
+    HRESULT i_saveSnapshotImplOne(settings::Snapshot &data) const;
 
-    HRESULT saveSnapshot(settings::Snapshot &data, bool aAttrsOnly);
-    HRESULT saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly);
+    HRESULT i_uninitOne(AutoWriteLock &writeLock,
+                        CleanupMode_T cleanupMode,
+                        MediaList &llMedia,
+                        std::list<Utf8Str> &llFilenames);
+    HRESULT i_uninitRecursively(AutoWriteLock &writeLock,
+                                CleanupMode_T cleanupMode,
+                                MediaList &llMedia,
+                                std::list<Utf8Str> &llFilenames);
 
-    HRESULT uninitRecursively(AutoWriteLock &writeLock,
-                              CleanupMode_T cleanupMode,
-                              MediaList &llMedia,
-                              std::list<Utf8Str> &llFilenames);
 
 private:
+
     struct Data;            // opaque, defined in SnapshotImpl.cpp
+
+    // wrapped ISnapshot properties
+    HRESULT getId(com::Guid &aId);
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT setName(const com::Utf8Str &aName);
+    HRESULT getDescription(com::Utf8Str &aDescription);
+    HRESULT setDescription(const com::Utf8Str &aDescription);
+    HRESULT getTimeStamp(LONG64 *aTimeStamp);
+    HRESULT getOnline(BOOL *aOnline);
+    HRESULT getMachine(ComPtr<IMachine> &aMachine);
+    HRESULT getParent(ComPtr<ISnapshot> &aParent);
+    HRESULT getChildren(std::vector<ComPtr<ISnapshot> > &aChildren);
+
+    // wrapped ISnapshot methods
+    HRESULT getChildrenCount(ULONG *aChildrenCount);
+
     Data *m;
 };
 
diff --git a/src/VBox/Main/include/StorageControllerImpl.h b/src/VBox/Main/include/StorageControllerImpl.h
index 1292804..3778691 100644
--- a/src/VBox/Main/include/StorageControllerImpl.h
+++ b/src/VBox/Main/include/StorageControllerImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,27 +19,14 @@
 
 #ifndef ____H_STORAGECONTROLLERIMPL
 #define ____H_STORAGECONTROLLERIMPL
-
-#include "VirtualBoxBase.h"
+#include "StorageControllerWrap.h"
 
 class ATL_NO_VTABLE StorageController :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IStorageController)
+    public StorageControllerWrap
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(StorageController, IStorageController)
-
-    DECLARE_NOT_AGGREGATABLE (StorageController)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(StorageController)
-        VBOX_DEFAULT_INTERFACE_ENTRIES (IStorageController)
-    END_COM_MAP()
-
-    StorageController() { };
-    ~StorageController() { };
+    DECLARE_EMPTY_CTOR_DTOR(StorageController)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -57,53 +44,48 @@ public:
                      StorageController *aThat);
     void uninit();
 
-    // IStorageController properties
-    STDMETHOD(COMGETTER(Name)) (BSTR *aName);
-    STDMETHOD(COMGETTER(Bus)) (StorageBus_T *aBus);
-    STDMETHOD(COMGETTER(ControllerType)) (StorageControllerType_T *aControllerType);
-    STDMETHOD(COMSETTER(ControllerType)) (StorageControllerType_T aControllerType);
-    STDMETHOD(COMGETTER(MaxDevicesPerPortCount)) (ULONG *aMaxDevices);
-    STDMETHOD(COMGETTER(MinPortCount)) (ULONG *aMinPortCount);
-    STDMETHOD(COMGETTER(MaxPortCount)) (ULONG *aMaxPortCount);
-    STDMETHOD(COMGETTER(PortCount)) (ULONG *aPortCount);
-    STDMETHOD(COMSETTER(PortCount)) (ULONG aPortCount);
-    STDMETHOD(COMGETTER(Instance)) (ULONG *aInstance);
-    STDMETHOD(COMSETTER(Instance)) (ULONG aInstance);
-    STDMETHOD(COMGETTER(UseHostIOCache)) (BOOL *fUseHostIOCache);
-    STDMETHOD(COMSETTER(UseHostIOCache)) (BOOL fUseHostIOCache);
-    STDMETHOD(COMGETTER(Bootable)) (BOOL *fBootable);
-
     // public methods only for internal purposes
-
-    const Utf8Str &getName() const;
-    StorageControllerType_T getControllerType() const;
-    StorageBus_T getStorageBus() const;
-    ULONG getInstance() const;
-    bool getBootable() const;
-
-    HRESULT checkPortAndDeviceValid(LONG aControllerPort,
-                                    LONG aDevice);
-
-    void setBootable(BOOL fBootable);
-
-    void rollback();
-    void commit();
-    HRESULT getIDEEmulationPort (LONG DevicePosition, LONG *aPortNumber);
-    HRESULT setIDEEmulationPort (LONG DevicePosition, LONG aPortNumber);
+    const Utf8Str &i_getName() const;
+    StorageControllerType_T i_getControllerType() const;
+    StorageBus_T i_getStorageBus() const;
+    ULONG i_getInstance() const;
+    bool i_getBootable() const;
+    HRESULT i_checkPortAndDeviceValid(LONG aControllerPort,
+                                      LONG aDevice);
+    void i_setBootable(BOOL fBootable);
+    void i_rollback();
+    void i_commit();
+    HRESULT i_getIDEEmulationPort (LONG DevicePosition, LONG *aPortNumber);
+    HRESULT i_setIDEEmulationPort (LONG DevicePosition, LONG aPortNumber);
 
     // public methods for internal purposes only
     // (ensure there is a caller and a read lock before calling them!)
 
-    void unshare();
+    void i_unshare();
 
     /** @note this doesn't require a read lock since mParent is constant. */
-    Machine* getMachine();
-
-    ComObjPtr<StorageController> getPeer();
+    Machine* i_getMachine();
+    ComObjPtr<StorageController> i_getPeer();
 
 private:
 
-    void printList();
+    // Wrapped IStorageController properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getMaxDevicesPerPortCount(ULONG *aMaxDevicesPerPortCount);
+    HRESULT getMinPortCount(ULONG *aMinPortCount);
+    HRESULT getMaxPortCount(ULONG *aMaxPortCount);
+    HRESULT getInstance(ULONG *aInstance);
+    HRESULT setInstance(ULONG aInstance);
+    HRESULT getPortCount(ULONG *aPortCount);
+    HRESULT setPortCount(ULONG aPortCount);
+    HRESULT getBus(StorageBus_T *aBus);
+    HRESULT getControllerType(StorageControllerType_T *aControllerType);
+    HRESULT setControllerType(StorageControllerType_T aControllerType);
+    HRESULT getUseHostIOCache(BOOL *aUseHostIOCache);
+    HRESULT setUseHostIOCache(BOOL aUseHostIOCache);
+    HRESULT getBootable(BOOL *aBootable);
+
+    void i_printList();
 
     struct Data;
     Data *m;
diff --git a/src/VBox/Main/include/SystemPropertiesImpl.h b/src/VBox/Main/include/SystemPropertiesImpl.h
index cb8e39d..adffa9f 100644
--- a/src/VBox/Main/include/SystemPropertiesImpl.h
+++ b/src/VBox/Main/include/SystemPropertiesImpl.h
@@ -20,12 +20,9 @@
 #ifndef ____H_SYSTEMPROPERTIESIMPL
 #define ____H_SYSTEMPROPERTIESIMPL
 
-#include "VirtualBoxBase.h"
 #include "MediumFormatImpl.h"
+#include "SystemPropertiesWrap.h"
 
-#include <VBox/com/array.h>
-
-#include <list>
 
 namespace settings
 {
@@ -33,20 +30,10 @@ namespace settings
 }
 
 class ATL_NO_VTABLE SystemProperties :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(ISystemProperties)
+    public SystemPropertiesWrap
 {
 public:
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SystemProperties, ISystemProperties)
-
-    DECLARE_NOT_AGGREGATABLE(SystemProperties)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(SystemProperties)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(ISystemProperties)
-    END_COM_MAP()
+    typedef std::list<ComObjPtr<MediumFormat> > MediumFormatList;
 
     DECLARE_EMPTY_CTOR_DTOR(SystemProperties)
 
@@ -57,93 +44,107 @@ public:
     HRESULT init(VirtualBox *aParent);
     void uninit();
 
-    // ISystemProperties properties
-    STDMETHOD(COMGETTER(MinGuestRAM))(ULONG *minRAM);
-    STDMETHOD(COMGETTER(MaxGuestRAM))(ULONG *maxRAM);
-    STDMETHOD(COMGETTER(MinGuestVRAM))(ULONG *minVRAM);
-    STDMETHOD(COMGETTER(MaxGuestVRAM))(ULONG *maxVRAM);
-    STDMETHOD(COMGETTER(MinGuestCPUCount))(ULONG *minCPUCount);
-    STDMETHOD(COMGETTER(MaxGuestCPUCount))(ULONG *maxCPUCount);
-    STDMETHOD(COMGETTER(MaxGuestMonitors))(ULONG *maxMonitors);
-    STDMETHOD(COMGETTER(InfoVDSize))(LONG64 *infoVDSize);
-    STDMETHOD(COMGETTER(SerialPortCount))(ULONG *count);
-    STDMETHOD(COMGETTER(ParallelPortCount))(ULONG *count);
-    STDMETHOD(COMGETTER(MaxBootPosition))(ULONG *aMaxBootPosition);
-    STDMETHOD(COMGETTER(ExclusiveHwVirt))(BOOL *aExclusiveHwVirt);
-    STDMETHOD(COMSETTER(ExclusiveHwVirt))(BOOL aExclusiveHwVirt);
-    STDMETHOD(COMGETTER(LoggingLevel))(BSTR *aLoggingLevel);
-    STDMETHOD(COMSETTER(LoggingLevel))(IN_BSTR aLoggingLevel);
-    STDMETHOD(COMGETTER(DefaultMachineFolder))(BSTR *aDefaultMachineFolder);
-    STDMETHOD(COMSETTER(DefaultMachineFolder))(IN_BSTR aDefaultMachineFolder);
-    STDMETHOD(COMGETTER(MediumFormats))(ComSafeArrayOut(IMediumFormat *, aMediumFormats));
-    STDMETHOD(COMGETTER(DefaultHardDiskFormat))(BSTR *aDefaultHardDiskFormat);
-    STDMETHOD(COMSETTER(DefaultHardDiskFormat))(IN_BSTR aDefaultHardDiskFormat);
-    STDMETHOD(COMGETTER(FreeDiskSpaceWarning))(LONG64 *aFreeDiskSpace);
-    STDMETHOD(COMSETTER(FreeDiskSpaceWarning))(LONG64 aFreeDiskSpace);
-    STDMETHOD(COMGETTER(FreeDiskSpacePercentWarning))(ULONG *aFreeDiskSpacePercent);
-    STDMETHOD(COMSETTER(FreeDiskSpacePercentWarning))(ULONG aFreeDiskSpacePercent);
-    STDMETHOD(COMGETTER(FreeDiskSpaceError))(LONG64 *aFreeDiskSpace);
-    STDMETHOD(COMSETTER(FreeDiskSpaceError))(LONG64 aFreeDiskSpace);
-    STDMETHOD(COMGETTER(FreeDiskSpacePercentError))(ULONG *aFreeDiskSpacePercent);
-    STDMETHOD(COMSETTER(FreeDiskSpacePercentError))(ULONG aFreeDiskSpacePercent);
-    STDMETHOD(COMGETTER(VRDEAuthLibrary))(BSTR *aVRDEAuthLibrary);
-    STDMETHOD(COMSETTER(VRDEAuthLibrary))(IN_BSTR aVRDEAuthLibrary);
-    STDMETHOD(COMGETTER(WebServiceAuthLibrary))(BSTR *aWebServiceAuthLibrary);
-    STDMETHOD(COMSETTER(WebServiceAuthLibrary))(IN_BSTR aWebServiceAuthLibrary);
-    STDMETHOD(COMGETTER(DefaultVRDEExtPack))(BSTR *aExtPack);
-    STDMETHOD(COMSETTER(DefaultVRDEExtPack))(IN_BSTR aExtPack);
-    STDMETHOD(COMGETTER(LogHistoryCount))(ULONG *count);
-    STDMETHOD(COMSETTER(LogHistoryCount))(ULONG count);
-    STDMETHOD(COMGETTER(DefaultAudioDriver))(AudioDriverType_T *aAudioDriver);
-    STDMETHOD(COMGETTER(AutostartDatabasePath))(BSTR *aAutostartDbPath);
-    STDMETHOD(COMSETTER(AutostartDatabasePath))(IN_BSTR aAutostartDbPath);
-    STDMETHOD(COMGETTER(DefaultAdditionsISO))(BSTR *aDefaultAdditionsISO);
-    STDMETHOD(COMSETTER(DefaultAdditionsISO))(IN_BSTR aDefaultAdditionsISO);
-    STDMETHOD(COMGETTER(DefaultFrontend))(BSTR *aDefaultFrontend);
-    STDMETHOD(COMSETTER(DefaultFrontend))(IN_BSTR aDefaultFrontend);
-
-    STDMETHOD(GetMaxNetworkAdapters)(ChipsetType_T aChipset, ULONG *aMaxInstances);
-    STDMETHOD(GetMaxNetworkAdaptersOfType)(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *aMaxInstances);
-    STDMETHOD(GetMaxDevicesPerPortForStorageBus)(StorageBus_T aBus, ULONG *aMaxDevicesPerPort);
-    STDMETHOD(GetMinPortCountForStorageBus)(StorageBus_T aBus, ULONG *aMinPortCount);
-    STDMETHOD(GetMaxPortCountForStorageBus)(StorageBus_T aBus, ULONG *aMaxPortCount);
-    STDMETHOD(GetMaxInstancesOfStorageBus)(ChipsetType_T aChipset, StorageBus_T aBus, ULONG *aMaxInstances);
-    STDMETHOD(GetDeviceTypesForStorageBus)(StorageBus_T aBus, ComSafeArrayOut(DeviceType_T, aDeviceTypes));
-    STDMETHOD(GetDefaultIoCacheSettingForStorageController)(StorageControllerType_T aControllerType, BOOL *aEnabled);
-    STDMETHOD(GetMaxInstancesOfUSBControllerType)(ChipsetType_T aChipset, USBControllerType_T aType, ULONG *aMaxInstances);
-
-    // public methods only for internal purposes
-
-    HRESULT loadSettings(const settings::SystemProperties &data);
-    HRESULT saveSettings(settings::SystemProperties &data);
-
-    ComObjPtr<MediumFormat> mediumFormat(const Utf8Str &aFormat);
-    ComObjPtr<MediumFormat> mediumFormatFromExtension(const Utf8Str &aExt);
-
-    int loadVDPlugin(const char *pszPluginLibrary);
-    int unloadVDPlugin(const char *pszPluginLibrary);
+    // public methods for internal purposes only
+    // (ensure there is a caller and a read lock before calling them!)
+    HRESULT i_loadSettings(const settings::SystemProperties &data);
+    HRESULT i_saveSettings(settings::SystemProperties &data);
 
-private:
+    ComObjPtr<MediumFormat> i_mediumFormat(const Utf8Str &aFormat);
+    ComObjPtr<MediumFormat> i_mediumFormatFromExtension(const Utf8Str &aExt);
 
-    typedef std::list<ComObjPtr<MediumFormat> > MediumFormatList;
+    int i_loadVDPlugin(const char *pszPluginLibrary);
+    int i_unloadVDPlugin(const char *pszPluginLibrary);
 
-    HRESULT getUserHomeDirectory(Utf8Str &strPath);
-    HRESULT setDefaultMachineFolder(const Utf8Str &aPath);
-    HRESULT setLoggingLevel(const Utf8Str &aLoggingLevel);
-    HRESULT setDefaultHardDiskFormat(const Utf8Str &aFormat);
+private:
 
-    HRESULT setVRDEAuthLibrary(const Utf8Str &aPath);
-    HRESULT setWebServiceAuthLibrary(const Utf8Str &aPath);
-    HRESULT setDefaultVRDEExtPack(const Utf8Str &aPath);
-    HRESULT setAutostartDatabasePath(const Utf8Str &aPath);
-    HRESULT setDefaultAdditionsISO(const Utf8Str &aPath);
-    HRESULT setDefaultFrontend(const Utf8Str &aPath);
+    // wrapped ISystemProperties properties
+    HRESULT getMinGuestRAM(ULONG *aMinGuestRAM);
+    HRESULT getMaxGuestRAM(ULONG *aMaxGuestRAM);
+    HRESULT getMinGuestVRAM(ULONG *aMinGuestVRAM);
+    HRESULT getMaxGuestVRAM(ULONG *aMaxGuestVRAM);
+    HRESULT getMinGuestCPUCount(ULONG *aMinGuestCPUCount);
+    HRESULT getMaxGuestCPUCount(ULONG *aMaxGuestCPUCount);
+    HRESULT getMaxGuestMonitors(ULONG *aMaxGuestMonitors);
+    HRESULT getInfoVDSize(LONG64 *aInfoVDSize);
+    HRESULT getSerialPortCount(ULONG *aSerialPortCount);
+    HRESULT getParallelPortCount(ULONG *aParallelPortCount);
+    HRESULT getMaxBootPosition(ULONG *aMaxBootPosition);
+    HRESULT getExclusiveHwVirt(BOOL *aExclusiveHwVirt);
+    HRESULT setExclusiveHwVirt(BOOL aExclusiveHwVirt);
+    HRESULT getDefaultMachineFolder(com::Utf8Str &aDefaultMachineFolder);
+    HRESULT setDefaultMachineFolder(const com::Utf8Str &aDefaultMachineFolder);
+    HRESULT getLoggingLevel(com::Utf8Str &aLoggingLevel);
+    HRESULT setLoggingLevel(const com::Utf8Str &aLoggingLevel);
+    HRESULT getMediumFormats(std::vector<ComPtr<IMediumFormat> > &aMediumFormats);
+    HRESULT getDefaultHardDiskFormat(com::Utf8Str &aDefaultHardDiskFormat);
+    HRESULT setDefaultHardDiskFormat(const com::Utf8Str &aDefaultHardDiskFormat);
+    HRESULT getFreeDiskSpaceWarning(LONG64 *aFreeDiskSpaceWarning);
+    HRESULT setFreeDiskSpaceWarning(LONG64 aFreeDiskSpaceWarning);
+    HRESULT getFreeDiskSpacePercentWarning(ULONG *aFreeDiskSpacePercentWarning);
+    HRESULT setFreeDiskSpacePercentWarning(ULONG aFreeDiskSpacePercentWarning);
+    HRESULT getFreeDiskSpaceError(LONG64 *aFreeDiskSpaceError);
+    HRESULT setFreeDiskSpaceError(LONG64 aFreeDiskSpaceError);
+    HRESULT getFreeDiskSpacePercentError(ULONG *aFreeDiskSpacePercentError);
+    HRESULT setFreeDiskSpacePercentError(ULONG aFreeDiskSpacePercentError);
+    HRESULT getVRDEAuthLibrary(com::Utf8Str &aVRDEAuthLibrary);
+    HRESULT setVRDEAuthLibrary(const com::Utf8Str &aVRDEAuthLibrary);
+    HRESULT getWebServiceAuthLibrary(com::Utf8Str &aWebServiceAuthLibrary);
+    HRESULT setWebServiceAuthLibrary(const com::Utf8Str &aWebServiceAuthLibrary);
+    HRESULT getDefaultVRDEExtPack(com::Utf8Str &aDefaultVRDEExtPack);
+    HRESULT setDefaultVRDEExtPack(const com::Utf8Str &aDefaultVRDEExtPack);
+    HRESULT getLogHistoryCount(ULONG *aLogHistoryCount);
+    HRESULT setLogHistoryCount(ULONG aLogHistoryCount);
+    HRESULT getDefaultAudioDriver(AudioDriverType_T *aDefaultAudioDriver);
+    HRESULT getAutostartDatabasePath(com::Utf8Str &aAutostartDatabasePath);
+    HRESULT setAutostartDatabasePath(const com::Utf8Str &aAutostartDatabasePath);
+    HRESULT getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO);
+    HRESULT setDefaultAdditionsISO(const com::Utf8Str &aDefaultAdditionsISO);
+    HRESULT getDefaultFrontend(com::Utf8Str &aDefaultFrontend);
+    HRESULT setDefaultFrontend(const com::Utf8Str &aDefaultFrontend);
+    HRESULT getScreenShotFormats(std::vector<BitmapFormat_T> &aScreenShotFormats);
+
+    // wrapped ISystemProperties methods
+    HRESULT getMaxNetworkAdapters(ChipsetType_T aChipset,
+                                  ULONG *aMaxNetworkAdapters);
+    HRESULT getMaxNetworkAdaptersOfType(ChipsetType_T aChipset,
+                                        NetworkAttachmentType_T aType,
+                                        ULONG *aMaxNetworkAdapters);
+    HRESULT getMaxDevicesPerPortForStorageBus(StorageBus_T aBus,
+                                              ULONG *aMaxDevicesPerPort);
+    HRESULT getMinPortCountForStorageBus(StorageBus_T aBus,
+                                         ULONG *aMinPortCount);
+    HRESULT getMaxPortCountForStorageBus(StorageBus_T aBus,
+                                         ULONG *aMaxPortCount);
+    HRESULT getMaxInstancesOfStorageBus(ChipsetType_T aChipset,
+                                        StorageBus_T aBus,
+                                        ULONG *aMaxInstances);
+    HRESULT getDeviceTypesForStorageBus(StorageBus_T aBus,
+                                        std::vector<DeviceType_T> &aDeviceTypes);
+    HRESULT getDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType,
+                                                         BOOL *aEnabled);
+    HRESULT getStorageControllerHotplugCapable(StorageControllerType_T aControllerType,
+                                               BOOL *aHotplugCapable);
+    HRESULT getMaxInstancesOfUSBControllerType(ChipsetType_T aChipset,
+                                               USBControllerType_T aType,
+                                               ULONG *aMaxInstances);
+
+    HRESULT i_getUserHomeDirectory(Utf8Str &strPath);
+    HRESULT i_setDefaultMachineFolder(const Utf8Str &strPath);
+    HRESULT i_setLoggingLevel(const com::Utf8Str &aLoggingLevel);
+    HRESULT i_setDefaultHardDiskFormat(const com::Utf8Str &aFormat);
+    HRESULT i_setVRDEAuthLibrary(const com::Utf8Str &aPath);
+
+    HRESULT i_setWebServiceAuthLibrary(const com::Utf8Str &aPath);
+    HRESULT i_setDefaultVRDEExtPack(const com::Utf8Str &aExtPack);
+    HRESULT i_setAutostartDatabasePath(const com::Utf8Str &aPath);
+    HRESULT i_setDefaultAdditionsISO(const com::Utf8Str &aPath);
+    HRESULT i_setDefaultFrontend(const com::Utf8Str &aDefaultFrontend);
 
     VirtualBox * const  mParent;
 
     settings::SystemProperties *m;
 
-    MediumFormatList    m_llMediumFormats;
+    MediumFormatList m_llMediumFormats;
 
     friend class VirtualBox;
 };
diff --git a/src/VBox/Main/include/USBControllerImpl.h b/src/VBox/Main/include/USBControllerImpl.h
index 814f4b5..79c304c 100644
--- a/src/VBox/Main/include/USBControllerImpl.h
+++ b/src/VBox/Main/include/USBControllerImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2005-2012 Oracle Corporation
+ * Copyright (C) 2005-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,7 +20,7 @@
 #ifndef ____H_USBCONTROLLERIMPL
 #define ____H_USBCONTROLLERIMPL
 
-#include "VirtualBoxBase.h"
+#include "USBControllerWrap.h"
 
 class HostUSBDevice;
 class USBDeviceFilter;
@@ -31,19 +31,9 @@ namespace settings
 }
 
 class ATL_NO_VTABLE USBController :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IUSBController)
+    public USBControllerWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(USBController, IUSBController)
-
-    DECLARE_NOT_AGGREGATABLE(USBController)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(USBController)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IUSBController)
-    END_COM_MAP()
 
     DECLARE_EMPTY_CTOR_DTOR(USBController)
 
@@ -56,25 +46,23 @@ public:
     HRESULT initCopy(Machine *aParent, USBController *aThat);
     void uninit();
 
-    // IUSBController properties
-    STDMETHOD(COMGETTER(Name))(BSTR *aName);
-    STDMETHOD(COMGETTER(Type))(USBControllerType_T *enmType);
-    STDMETHOD(COMGETTER(USBStandard))(USHORT *aUSBStandard);
-
     // public methods only for internal purposes
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(USBController *aThat);
+    void i_unshare();
 
-    void rollback();
-    void commit();
-    void copyFrom(USBController *aThat);
-    void unshare();
-
-    const Utf8Str &getName() const;
-    USBControllerType_T getControllerType() const;
-
-    ComObjPtr<USBController> getPeer();
+    ComObjPtr<USBController> i_getPeer();
+    const Utf8Str &i_getName() const;
+    const USBControllerType_T &i_getControllerType() const;
 
 private:
 
+    // wrapped IUSBController properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT getType(USBControllerType_T *aType);
+    HRESULT getUSBStandard(USHORT *aUSBStandard);
+
     void printList();
 
     struct Data;
diff --git a/src/VBox/Main/include/USBDeviceFilterImpl.h b/src/VBox/Main/include/USBDeviceFilterImpl.h
index aaa8ced..37974da 100644
--- a/src/VBox/Main/include/USBDeviceFilterImpl.h
+++ b/src/VBox/Main/include/USBDeviceFilterImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,10 +18,9 @@
 #ifndef ____H_USBDEVICEFILTERIMPL
 #define ____H_USBDEVICEFILTERIMPL
 
-#include "VirtualBoxBase.h"
-
 #include "Matching.h"
 #include <VBox/usbfilter.h>
+#include "USBDeviceFilterWrap.h"
 
 class USBDeviceFilters;
 class Host;
@@ -34,8 +33,7 @@ namespace settings
 ////////////////////////////////////////////////////////////////////////////////
 
 class ATL_NO_VTABLE USBDeviceFilter :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IUSBDeviceFilter)
+    public USBDeviceFilterWrap
 {
 public:
 
@@ -66,17 +64,7 @@ public:
         void *mId;
     };
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(USBDeviceFilter, IUSBDeviceFilter)
-
-    DECLARE_NOT_AGGREGATABLE(USBDeviceFilter)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(USBDeviceFilter)
-        VBOX_DEFAULT_INTERFACE_ENTRIES  (IUSBDeviceFilter)
-    END_COM_MAP()
-
-    DECLARE_EMPTY_CTOR_DTOR (USBDeviceFilter)
+    DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilter)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -90,57 +78,56 @@ public:
     HRESULT initCopy(USBDeviceFilters *aParent, USBDeviceFilter *aThat);
     void uninit();
 
-    // IUSBDeviceFilter properties
-    STDMETHOD(COMGETTER(Name)) (BSTR *aName);
-    STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
-    STDMETHOD(COMGETTER(Active)) (BOOL *aActive);
-    STDMETHOD(COMSETTER(Active)) (BOOL aActive);
-    STDMETHOD(COMGETTER(VendorId)) (BSTR *aVendorId);
-    STDMETHOD(COMSETTER(VendorId)) (IN_BSTR aVendorId);
-    STDMETHOD(COMGETTER(ProductId)) (BSTR *aProductId);
-    STDMETHOD(COMSETTER(ProductId)) (IN_BSTR aProductId);
-    STDMETHOD(COMGETTER(Revision)) (BSTR *aRevision);
-    STDMETHOD(COMSETTER(Revision)) (IN_BSTR aRevision);
-    STDMETHOD(COMGETTER(Manufacturer)) (BSTR *aManufacturer);
-    STDMETHOD(COMSETTER(Manufacturer)) (IN_BSTR aManufacturer);
-    STDMETHOD(COMGETTER(Product)) (BSTR *aProduct);
-    STDMETHOD(COMSETTER(Product)) (IN_BSTR aProduct);
-    STDMETHOD(COMGETTER(SerialNumber)) (BSTR *aSerialNumber);
-    STDMETHOD(COMSETTER(SerialNumber)) (IN_BSTR aSerialNumber);
-    STDMETHOD(COMGETTER(Port)) (BSTR *aPort);
-    STDMETHOD(COMSETTER(Port)) (IN_BSTR aPort);
-    STDMETHOD(COMGETTER(Remote)) (BSTR *aRemote);
-    STDMETHOD(COMSETTER(Remote)) (IN_BSTR aRemote);
-    STDMETHOD(COMGETTER(MaskedInterfaces)) (ULONG *aMaskedIfs);
-    STDMETHOD(COMSETTER(MaskedInterfaces)) (ULONG aMaskedIfs);
-
     // public methods only for internal purposes
-    bool isModified();
-    void rollback();
-    void commit();
+    bool i_isModified();
+    void i_rollback();
+    void i_commit();
 
     void unshare();
 
     // public methods for internal purposes only
     // (ensure there is a caller and a read lock before calling them!)
-
-    void *& getId() { return mData.data()->mId; }
-
-    const Data& getData() { return *mData.data(); }
-    ComObjPtr<USBDeviceFilter> peer() { return mPeer; }
+    void *& i_getId() { return mData.data()->mId; }
+    const Data& i_getData() { return *mData.data(); }
+    ComObjPtr<USBDeviceFilter> i_peer() { return mPeer; }
 
     // tr() wants to belong to a class it seems, thus this one here.
-    static HRESULT usbFilterFieldFromString(PUSBFILTER aFilter,
-                                            USBFILTERIDX aIdx,
-                                            const Utf8Str &aValue,
-                                            Utf8Str &aErrStr);
+    static HRESULT i_usbFilterFieldFromString(PUSBFILTER aFilter,
+                                              USBFILTERIDX aIdx,
+                                              const Utf8Str &aValue,
+                                              Utf8Str &aErrStr);
 
-    static const char* describeUSBFilterIdx(USBFILTERIDX aIdx);
+    static const char* i_describeUSBFilterIdx(USBFILTERIDX aIdx);
 
 private:
-    HRESULT usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr);
-    HRESULT usbFilterFieldSetter(USBFILTERIDX aIdx, IN_BSTR aStr);
-    HRESULT usbFilterFieldSetter(USBFILTERIDX aIdx, const Utf8Str &strNew);
+
+    // wrapped IUSBDeviceFilter properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT setName(const com::Utf8Str &aName);
+    HRESULT getActive(BOOL *aActive);
+    HRESULT setActive(BOOL aActive);
+    HRESULT getVendorId(com::Utf8Str &aVendorId);
+    HRESULT setVendorId(const com::Utf8Str &aVendorId);
+    HRESULT getProductId(com::Utf8Str &aProductId);
+    HRESULT setProductId(const com::Utf8Str &aProductId);
+    HRESULT getRevision(com::Utf8Str &aRevision);
+    HRESULT setRevision(const com::Utf8Str &aRevision);
+    HRESULT getManufacturer(com::Utf8Str &aManufacturer);
+    HRESULT setManufacturer(const com::Utf8Str &aManufacturer);
+    HRESULT getProduct(com::Utf8Str &aProduct);
+    HRESULT setProduct(const com::Utf8Str &aProduct);
+    HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
+    HRESULT setSerialNumber(const com::Utf8Str &aSerialNumber);
+    HRESULT getPort(com::Utf8Str &aPort);
+    HRESULT setPort(const com::Utf8Str &aPort);
+    HRESULT getRemote(com::Utf8Str &aRemote);
+    HRESULT setRemote(const com::Utf8Str &aRemote);
+    HRESULT getMaskedInterfaces(ULONG *aMaskedInterfaces);
+    HRESULT setMaskedInterfaces(ULONG aMaskedInterfaces);
+
+    // wrapped IUSBDeviceFilter methods
+    HRESULT i_usbFilterFieldGetter(USBFILTERIDX aIdx, com::Utf8Str &aStr);
+    HRESULT i_usbFilterFieldSetter(USBFILTERIDX aIdx, const com::Utf8Str &strNew);
 
     USBDeviceFilters * const     mParent;
     USBDeviceFilter  * const     mPeer;
@@ -155,13 +142,13 @@ private:
 
     friend class USBDeviceFilters;
 };
+#include "HostUSBDeviceFilterWrap.h"
 
 // HostUSBDeviceFilter
 ////////////////////////////////////////////////////////////////////////////////
 
 class ATL_NO_VTABLE HostUSBDeviceFilter :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IHostUSBDeviceFilter)
+    public HostUSBDeviceFilterWrap
 {
 public:
 
@@ -170,17 +157,6 @@ public:
         Data() {}
     };
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(HostUSBDeviceFilter, IHostUSBDeviceFilter)
-
-    DECLARE_NOT_AGGREGATABLE(HostUSBDeviceFilter)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(HostUSBDeviceFilter)
-        COM_INTERFACE_ENTRY(IUSBDeviceFilter)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IHostUSBDeviceFilter)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR (HostUSBDeviceFilter)
 
     HRESULT FinalConstruct();
@@ -192,48 +168,49 @@ public:
     HRESULT init(Host *aParent, IN_BSTR aName);
     void uninit();
 
-    // IUSBDeviceFilter properties
-    STDMETHOD(COMGETTER(Name)) (BSTR *aName);
-    STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);
-    STDMETHOD(COMGETTER(Active)) (BOOL *aActive);
-    STDMETHOD(COMSETTER(Active)) (BOOL aActive);
-    STDMETHOD(COMGETTER(VendorId)) (BSTR *aVendorId);
-    STDMETHOD(COMSETTER(VendorId)) (IN_BSTR aVendorId);
-    STDMETHOD(COMGETTER(ProductId)) (BSTR *aProductId);
-    STDMETHOD(COMSETTER(ProductId)) (IN_BSTR aProductId);
-    STDMETHOD(COMGETTER(Revision)) (BSTR *aRevision);
-    STDMETHOD(COMSETTER(Revision)) (IN_BSTR aRevision);
-    STDMETHOD(COMGETTER(Manufacturer)) (BSTR *aManufacturer);
-    STDMETHOD(COMSETTER(Manufacturer)) (IN_BSTR aManufacturer);
-    STDMETHOD(COMGETTER(Product)) (BSTR *aProduct);
-    STDMETHOD(COMSETTER(Product)) (IN_BSTR aProduct);
-    STDMETHOD(COMGETTER(SerialNumber)) (BSTR *aSerialNumber);
-    STDMETHOD(COMSETTER(SerialNumber)) (IN_BSTR aSerialNumber);
-    STDMETHOD(COMGETTER(Port)) (BSTR *aPort);
-    STDMETHOD(COMSETTER(Port)) (IN_BSTR aPort);
-    STDMETHOD(COMGETTER(Remote)) (BSTR *aRemote);
-    STDMETHOD(COMSETTER(Remote)) (IN_BSTR aRemote);
-    STDMETHOD(COMGETTER(MaskedInterfaces)) (ULONG *aMaskedIfs);
-    STDMETHOD(COMSETTER(MaskedInterfaces)) (ULONG aMaskedIfs);
-
-    // IHostUSBDeviceFilter properties
-    STDMETHOD(COMGETTER(Action)) (USBDeviceFilterAction_T *aAction);
-    STDMETHOD(COMSETTER(Action)) (USBDeviceFilterAction_T aAction);
-
     // public methods for internal purposes only
     // (ensure there is a caller and a read lock before calling them!)
-    void saveSettings(settings::USBDeviceFilter &data);
+    void i_saveSettings(settings::USBDeviceFilter &data);
 
-    void*& getId() { return mData.data()->mId; }
+    void*& i_getId() { return mData.data()->mId; }
 
-    const Data& getData() { return *mData.data(); }
+    const Data& i_getData() { return *mData.data(); }
 
     // util::Lockable interface
     RWLockHandle *lockHandle() const;
 
 private:
-    HRESULT usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr);
-    HRESULT usbFilterFieldSetter(USBFILTERIDX aIdx, Bstr aStr);
+
+    // wrapped IHostUSBDeviceFilter properties
+    HRESULT getName(com::Utf8Str &aName);
+    HRESULT setName(const com::Utf8Str &aName);
+    HRESULT getActive(BOOL *aActive);
+    HRESULT setActive(BOOL aActive);
+    HRESULT getVendorId(com::Utf8Str &aVendorId);
+    HRESULT setVendorId(const com::Utf8Str &aVendorId);
+    HRESULT getProductId(com::Utf8Str &aProductId);
+    HRESULT setProductId(const com::Utf8Str &aProductId);
+    HRESULT getRevision(com::Utf8Str &aRevision);
+    HRESULT setRevision(const com::Utf8Str &aRevision);
+    HRESULT getManufacturer(com::Utf8Str &aManufacturer);
+    HRESULT setManufacturer(const com::Utf8Str &aManufacturer);
+    HRESULT getProduct(com::Utf8Str &aProduct);
+    HRESULT setProduct(const com::Utf8Str &aProduct);
+    HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
+    HRESULT setSerialNumber(const com::Utf8Str &aSerialNumber);
+    HRESULT getPort(com::Utf8Str &aPort);
+    HRESULT setPort(const com::Utf8Str &aPort);
+    HRESULT getRemote(com::Utf8Str &aRemote);
+    HRESULT setRemote(const com::Utf8Str &aRemote);
+    HRESULT getMaskedInterfaces(ULONG *aMaskedInterfaces);
+    HRESULT setMaskedInterfaces(ULONG aMaskedInterfaces);
+
+    // wrapped IHostUSBDeviceFilter properties
+    HRESULT getAction(USBDeviceFilterAction_T *aAction);
+    HRESULT setAction(USBDeviceFilterAction_T aAction);
+
+    HRESULT i_usbFilterFieldGetter(USBFILTERIDX aIdx, com::Utf8Str &aStr);
+    HRESULT i_usbFilterFieldSetter(USBFILTERIDX aIdx, const com::Utf8Str &aStr);
 
     Host * const        mParent;
 
diff --git a/src/VBox/Main/include/USBDeviceFiltersImpl.h b/src/VBox/Main/include/USBDeviceFiltersImpl.h
index 190430f..596ea70 100644
--- a/src/VBox/Main/include/USBDeviceFiltersImpl.h
+++ b/src/VBox/Main/include/USBDeviceFiltersImpl.h
@@ -20,7 +20,7 @@
 #ifndef ____H_USBDEVICEFILTERSIMPL
 #define ____H_USBDEVICEFILTERSIMPL
 
-#include "VirtualBoxBase.h"
+#include "USBDeviceFiltersWrap.h"
 
 class HostUSBDevice;
 class USBDeviceFilter;
@@ -31,19 +31,9 @@ namespace settings
 }
 
 class ATL_NO_VTABLE USBDeviceFilters :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IUSBDeviceFilters)
+    public USBDeviceFiltersWrap
 {
 public:
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(USBDeviceFilters, IUSBDeviceFilters)
-
-    DECLARE_NOT_AGGREGATABLE(USBDeviceFilters)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(USBDeviceFilters)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IUSBDeviceFilters)
-    END_COM_MAP()
 
     DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilters)
 
@@ -56,41 +46,38 @@ public:
     HRESULT initCopy(Machine *aParent, USBDeviceFilters *aThat);
     void uninit();
 
-    // IUSBDeviceFilters attributes
-    STDMETHOD(COMGETTER(DeviceFilters))(ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters));
-
-    // IUSBDeviceFilters methods
-    STDMETHOD(CreateDeviceFilter)(IN_BSTR aName, IUSBDeviceFilter **aFilter);
-    STDMETHOD(InsertDeviceFilter)(ULONG aPosition, IUSBDeviceFilter *aFilter);
-    STDMETHOD(RemoveDeviceFilter)(ULONG aPosition, IUSBDeviceFilter **aFilter);
-
     // public methods only for internal purposes
+    HRESULT i_loadSettings(const settings::USB &data);
+    HRESULT i_saveSettings(settings::USB &data);
 
-    HRESULT loadSettings(const settings::USB &data);
-    HRESULT saveSettings(settings::USB &data);
-
-    void rollback();
-    void commit();
-    void copyFrom(USBDeviceFilters *aThat);
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(USBDeviceFilters *aThat);
 
 #ifdef VBOX_WITH_USB
-    HRESULT onDeviceFilterChange(USBDeviceFilter *aFilter,
-                                 BOOL aActiveChanged = FALSE);
-
-    bool hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
-    bool hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
-
-    HRESULT notifyProxy(bool aInsertFilters);
+    HRESULT i_onDeviceFilterChange(USBDeviceFilter *aFilter,
+                                   BOOL aActiveChanged = FALSE);
+    bool i_hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
+    bool i_hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
+    HRESULT i_notifyProxy(bool aInsertFilters);
 #endif /* VBOX_WITH_USB */
 
     // public methods for internal purposes only
     // (ensure there is a caller and a read lock before calling them!)
-    Machine* getMachine();
+    Machine* i_getMachine();
 
 private:
 
-    void printList();
+    // Wrapped IUSBDeviceFilters attributes
+    HRESULT getDeviceFilters(std::vector<ComPtr<IUSBDeviceFilter> > &aDeviceFilters);
 
+    // wrapped IUSBDeviceFilters methods
+    HRESULT createDeviceFilter(const com::Utf8Str &aName,
+                               ComPtr<IUSBDeviceFilter> &aFilter);
+    HRESULT insertDeviceFilter(ULONG aPosition,
+                               const ComPtr<IUSBDeviceFilter> &aFilter);
+    HRESULT removeDeviceFilter(ULONG aPosition,
+                               ComPtr<IUSBDeviceFilter> &aFilter);
     struct Data;
     Data *m;
 };
diff --git a/src/VBox/Main/include/USBDeviceImpl.h b/src/VBox/Main/include/USBDeviceImpl.h
index 2ea81ef..777589a 100644
--- a/src/VBox/Main/include/USBDeviceImpl.h
+++ b/src/VBox/Main/include/USBDeviceImpl.h
@@ -19,28 +19,17 @@
 #ifndef ____H_USBDEVICEIMPL
 #define ____H_USBDEVICEIMPL
 
-#include "VirtualBoxBase.h"
+#include "USBDeviceWrap.h"
 
 /**
  * Object class used for maintaining devices attached to a USB controller.
  * Generally this contains much less information.
  */
 class ATL_NO_VTABLE OUSBDevice :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IUSBDevice)
+    public USBDeviceWrap
 {
 public:
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(OUSBDevice, IUSBDevice)
-
-    DECLARE_NOT_AGGREGATABLE(OUSBDevice)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(OUSBDevice)
-        VBOX_DEFAULT_INTERFACE_ENTRIES (IUSBDevice)
-    END_COM_MAP()
-
     DECLARE_EMPTY_CTOR_DTOR (OUSBDevice)
 
     HRESULT FinalConstruct();
@@ -50,29 +39,30 @@ public:
     HRESULT init (IUSBDevice *a_pUSBDevice);
     void uninit();
 
-    // IUSBDevice properties
-    STDMETHOD(COMGETTER(Id))(BSTR *aId);
-    STDMETHOD(COMGETTER(VendorId))(USHORT *aVendorId);
-    STDMETHOD(COMGETTER(ProductId))(USHORT *aProductId);
-    STDMETHOD(COMGETTER(Revision))(USHORT *aRevision);
-    STDMETHOD(COMGETTER(Manufacturer))(BSTR *aManufacturer);
-    STDMETHOD(COMGETTER(Product))(BSTR *aProduct);
-    STDMETHOD(COMGETTER(SerialNumber))(BSTR *aSerialNumber);
-    STDMETHOD(COMGETTER(Address))(BSTR *aAddress);
-    STDMETHOD(COMGETTER(Port))(USHORT *aPort);
-    STDMETHOD(COMGETTER(Version))(USHORT *aVersion);
-    STDMETHOD(COMGETTER(PortVersion))(USHORT *aPortVersion);
-    STDMETHOD(COMGETTER(Remote))(BOOL *aRemote);
-
     // public methods only for internal purposes
-    const Guid &id() const { return mData.id; }
+    const Guid &i_id() const { return mData.id; }
 
 private:
 
+    // Wrapped IUSBDevice properties
+    HRESULT getId(com::Guid &aId);
+    HRESULT getVendorId(USHORT *aVendorId);
+    HRESULT getProductId(USHORT *aProductId);
+    HRESULT getRevision(USHORT *aRevision);
+    HRESULT getManufacturer(com::Utf8Str &aManufacturer);
+    HRESULT getProduct(com::Utf8Str &aProduct);
+    HRESULT getSerialNumber(com::Utf8Str &aSerialNumber);
+    HRESULT getAddress(com::Utf8Str &aAddress);
+    HRESULT getPort(USHORT *aPort);
+    HRESULT getVersion(USHORT *aVersion);
+    HRESULT getPortVersion(USHORT *aPortVersion);
+    HRESULT getSpeed(USBConnectionSpeed_T *aSpeed);
+    HRESULT getRemote(BOOL *aRemote);
+
     struct Data
     {
         Data() : vendorId (0), productId (0), revision (0), port (0),
-                 version (1), portVersion (1), remote (FALSE) {}
+                 version (1), portVersion (1), speed (USBConnectionSpeed_Null), remote (FALSE) {}
 
         /** The UUID of this device. */
         const Guid id;
@@ -85,19 +75,21 @@ private:
          * (high byte = integer; low byte = decimal) */
         const USHORT revision;
         /** The Manufacturer string. (Quite possibly NULL.) */
-        const Bstr manufacturer;
+        const com::Utf8Str manufacturer;
         /** The Product string. (Quite possibly NULL.) */
-        const Bstr product;
+        const com::Utf8Str product;
         /** The SerialNumber string. (Quite possibly NULL.) */
-        const Bstr serialNumber;
+        const com::Utf8Str serialNumber;
         /** The host specific address of the device. */
-        const Bstr address;
+        const com::Utf8Str address;
         /** The host port number. */
         const USHORT port;
         /** The major USB version number of the device. */
         const USHORT version;
         /** The major USB version number of the port the device is attached to. */
         const USHORT portVersion;
+        /** The speed at which the device is communicating. */
+        const USBConnectionSpeed_T speed;
         /** Remote (VRDP) or local device. */
         const BOOL remote;
     };
diff --git a/src/VBox/Main/include/USBProxyService.h b/src/VBox/Main/include/USBProxyService.h
index 35099c8..127a7ce 100644
--- a/src/VBox/Main/include/USBProxyService.h
+++ b/src/VBox/Main/include/USBProxyService.h
@@ -57,12 +57,12 @@ public:
 
     /** @name Host Interfaces
      * @{ */
-    HRESULT getDeviceCollection(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices));
+    HRESULT getDeviceCollection(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
     /** @} */
 
     /** @name SessionMachine Interfaces
      * @{ */
-    HRESULT captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId);
+    HRESULT captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId, const com::Utf8Str &aCaptureFilename);
     HRESULT detachDeviceFromVM(SessionMachine *aMachine, IN_GUID aId, bool aDone);
     HRESULT autoCaptureDevicesForVM(SessionMachine *aMachine);
     HRESULT detachAllDevicesFromVM(SessionMachine *aMachine, bool aDone, bool aAbnormal);
diff --git a/src/VBox/Main/include/VFSExplorerImpl.h b/src/VBox/Main/include/VFSExplorerImpl.h
index e87e1d9..d21530d 100644
--- a/src/VBox/Main/include/VFSExplorerImpl.h
+++ b/src/VBox/Main/include/VFSExplorerImpl.h
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2009-2011 Oracle Corporation
+ * Copyright (C) 2009-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,21 +20,12 @@
 #ifndef ____H_VFSEXPLORERIMPL
 #define ____H_VFSEXPLORERIMPL
 
-#include "VirtualBoxBase.h"
+#include "VFSExplorerWrap.h"
 
 class ATL_NO_VTABLE VFSExplorer :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IVFSExplorer)
+    public VFSExplorerWrap
 {
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VFSExplorer, IVFSExplorer)
-
-    DECLARE_NOT_AGGREGATABLE(VFSExplorer)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(VFSExplorer)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IVFSExplorer)
-    END_COM_MAP()
+public:
 
     DECLARE_EMPTY_CTOR_DTOR(VFSExplorer)
 
@@ -45,24 +36,7 @@ class ATL_NO_VTABLE VFSExplorer :
     HRESULT init(VFSType_T aType, Utf8Str aFilePath, Utf8Str aHostname, Utf8Str aUsername, Utf8Str aPassword, VirtualBox *aVirtualBox);
     void uninit();
 
-    /* IVFSExplorer properties */
-    STDMETHOD(COMGETTER(Path))(BSTR *aPath);
-    STDMETHOD(COMGETTER(Type))(VFSType_T *aType);
-
-    /* IVFSExplorer methods */
-    STDMETHOD(Update)(IProgress **aProgress);
-
-    STDMETHOD(Cd)(IN_BSTR aDir, IProgress **aProgress);
-    STDMETHOD(CdUp)(IProgress **aProgress);
-
-    STDMETHOD(EntryList)(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(VFSFileType_T, aTypes), ComSafeArrayOut(LONG64, aSizes), ComSafeArrayOut(ULONG, aModes));
-
-    STDMETHOD(Exists)(ComSafeArrayIn(IN_BSTR, aNames), ComSafeArrayOut(BSTR, aExists));
-
-    STDMETHOD(Remove)(ComSafeArrayIn(IN_BSTR, aNames), IProgress **aProgress);
-
     /* public methods only for internal purposes */
-
     static HRESULT setErrorStatic(HRESULT aResultCode,
                                   const Utf8Str &aText)
     {
@@ -70,20 +44,45 @@ class ATL_NO_VTABLE VFSExplorer :
     }
 
 private:
-    /* Private member vars */
-    VirtualBox * const  mVirtualBox;
 
+    // wrapped IVFSExplorer properties
+    HRESULT getPath(com::Utf8Str &aPath);
+    HRESULT getType(VFSType_T *aType);
+
+   // wrapped IVFSExplorer methods
+    HRESULT update(ComPtr<IProgress> &aProgress);
+    HRESULT cd(const com::Utf8Str &aDir, ComPtr<IProgress> &aProgress);
+    HRESULT cdUp(ComPtr<IProgress> &aProgress);
+    HRESULT entryList(std::vector<com::Utf8Str> &aNames,
+                      std::vector<ULONG> &aTypes,
+                      std::vector<LONG64> &aSizes,
+                      std::vector<ULONG> &aModes);
+    HRESULT exists(const std::vector<com::Utf8Str> &aNames,
+                   std::vector<com::Utf8Str> &aExists);
+    HRESULT remove(const std::vector<com::Utf8Str> &aNames,
+                   ComPtr<IProgress> &aProgress);
+
+    /* Private member vars */
+    VirtualBox * const mVirtualBox;
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ////
+    //// VFSExplorer definitions
+    ////
+    //////////////////////////////////////////////////////////////////////////////////
+    //
     struct TaskVFSExplorer;  /* Worker thread helper */
     struct Data;
     Data *m;
 
     /* Private member methods */
-    VFSFileType_T RTToVFSFileType(int aType) const;
+    FsObjType_T i_iprtToVfsObjType(RTFMODE aType) const;
+
+    HRESULT i_updateFS(TaskVFSExplorer *aTask);
+    HRESULT i_deleteFS(TaskVFSExplorer *aTask);
+    HRESULT i_updateS3(TaskVFSExplorer *aTask);
+    HRESULT i_deleteS3(TaskVFSExplorer *aTask);
 
-    HRESULT updateFS(TaskVFSExplorer *aTask);
-    HRESULT deleteFS(TaskVFSExplorer *aTask);
-    HRESULT updateS3(TaskVFSExplorer *aTask);
-    HRESULT deleteS3(TaskVFSExplorer *aTask);
 };
 
 #endif /* ____H_VFSEXPLORERIMPL */
diff --git a/src/VBox/Main/include/VMMDev.h b/src/VBox/Main/include/VMMDev.h
index 3fe366a..3f6d65e 100644
--- a/src/VBox/Main/include/VMMDev.h
+++ b/src/VBox/Main/include/VMMDev.h
@@ -1,3 +1,4 @@
+/* $Id: VMMDev.h $ */
 /** @file
  * VirtualBox Driver interface to VMM device
  */
diff --git a/src/VBox/Main/include/VRDEServerImpl.h b/src/VBox/Main/include/VRDEServerImpl.h
index dbef40e..5fce127 100644
--- a/src/VBox/Main/include/VRDEServerImpl.h
+++ b/src/VBox/Main/include/VRDEServerImpl.h
@@ -20,38 +20,15 @@
 #ifndef ____H_VRDPSERVER
 #define ____H_VRDPSERVER
 
-#include "VirtualBoxBase.h"
-
-#include <VBox/VBoxAuth.h>
 #include <VBox/settings.h>
+#include "VRDEServerWrap.h"
 
 class ATL_NO_VTABLE VRDEServer :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IVRDEServer)
+    public VRDEServerWrap
 {
 public:
 
-    struct Data
-    {
-        BOOL mEnabled;
-        Bstr mAuthLibrary;
-        AuthType_T mAuthType;
-        ULONG mAuthTimeout;
-        BOOL mAllowMultiConnection;
-        BOOL mReuseSingleConnection;
-        Utf8Str mVrdeExtPack;
-        settings::StringsMap mProperties;
-    };
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VRDEServer, IVRDEServer)
-
-    DECLARE_NOT_AGGREGATABLE(VRDEServer)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(VRDEServer)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IVRDEServer)
-    END_COM_MAP()
+    typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap;
 
     DECLARE_EMPTY_CTOR_DTOR(VRDEServer)
 
@@ -64,37 +41,49 @@ public:
     HRESULT initCopy(Machine *aParent, VRDEServer *aThat);
     void uninit();
 
-    // IVRDEServer properties
-    STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
-    STDMETHOD(COMSETTER(Enabled))(BOOL aEnable);
-    STDMETHOD(COMGETTER(AuthType))(AuthType_T *aType);
-    STDMETHOD(COMSETTER(AuthType))(AuthType_T aType);
-    STDMETHOD(COMGETTER(AuthTimeout))(ULONG *aTimeout);
-    STDMETHOD(COMSETTER(AuthTimeout))(ULONG aTimeout);
-    STDMETHOD(COMGETTER(AllowMultiConnection))(BOOL *aAllowMultiConnection);
-    STDMETHOD(COMSETTER(AllowMultiConnection))(BOOL aAllowMultiConnection);
-    STDMETHOD(COMGETTER(ReuseSingleConnection))(BOOL *aReuseSingleConnection);
-    STDMETHOD(COMSETTER(ReuseSingleConnection))(BOOL aReuseSingleConnection);
-    STDMETHOD(COMGETTER(VRDEExtPack))(BSTR *aExtPack);
-    STDMETHOD(COMSETTER(VRDEExtPack))(IN_BSTR aExtPack);
-    STDMETHOD(COMGETTER(AuthLibrary))(BSTR *aValue);
-    STDMETHOD(COMSETTER(AuthLibrary))(IN_BSTR aValue);
-    STDMETHOD(COMGETTER(VRDEProperties))(ComSafeArrayOut(BSTR, aProperties));
-
-    // IVRDEServer methods
-    STDMETHOD(SetVRDEProperty)(IN_BSTR aKey, IN_BSTR aValue);
-    STDMETHOD(GetVRDEProperty)(IN_BSTR aKey, BSTR *aValue);
-
     // public methods only for internal purposes
+    HRESULT i_loadSettings(const settings::VRDESettings &data);
+    HRESULT i_saveSettings(settings::VRDESettings &data);
+    void i_rollback();
+    void i_commit();
+    void i_copyFrom(VRDEServer *aThat);
 
-    HRESULT loadSettings(const settings::VRDESettings &data);
-    HRESULT saveSettings(settings::VRDESettings &data);
+private:
 
-    void rollback();
-    void commit();
-    void copyFrom(VRDEServer *aThat);
+     // wrapped IVRDEServer properties
+     HRESULT getEnabled(BOOL *aEnabled);
+     HRESULT setEnabled(BOOL aEnabled);
+     HRESULT getAuthType(AuthType_T *aAuthType);
+     HRESULT setAuthType(AuthType_T aAuthType);
+     HRESULT getAuthTimeout(ULONG *aAuthTimeout);
+     HRESULT setAuthTimeout(ULONG aAuthTimeout);
+     HRESULT getAllowMultiConnection(BOOL *aAllowMultiConnection);
+     HRESULT setAllowMultiConnection(BOOL aAllowMultiConnection);
+     HRESULT getReuseSingleConnection(BOOL *aReuseSingleConnection);
+     HRESULT setReuseSingleConnection(BOOL aReuseSingleConnection);
+     HRESULT getVRDEExtPack(com::Utf8Str &aVRDEExtPack);
+     HRESULT setVRDEExtPack(const com::Utf8Str &aVRDEExtPack);
+     HRESULT getAuthLibrary(com::Utf8Str &aAuthLibrary);
+     HRESULT setAuthLibrary(const com::Utf8Str &aAuthLibrary);
+     HRESULT getVRDEProperties(std::vector<com::Utf8Str> &aVRDEProperties);
+
+    // wrapped IVRDEServer methods
+    HRESULT setVRDEProperty(const com::Utf8Str &aKey,
+                            const com::Utf8Str &aValue);
+    HRESULT getVRDEProperty(const com::Utf8Str &aKey,
+                            com::Utf8Str &aValue);
 
-private:
+    struct Data
+    {
+        BOOL         mEnabled;
+        com::Utf8Str mAuthLibrary;
+        AuthType_T   mAuthType;
+        ULONG        mAuthTimeout;
+        BOOL         mAllowMultiConnection;
+        BOOL         mReuseSingleConnection;
+        Utf8Str      mVrdeExtPack;
+        StringsMap   mProperties;
+    };
 
     Machine * const     mParent;
     const ComObjPtr<VRDEServer> mPeer;
diff --git a/src/VBox/Main/include/VirtualBoxBase.h b/src/VBox/Main/include/VirtualBoxBase.h
index 6e7ea71..e84fe9a 100644
--- a/src/VBox/Main/include/VirtualBoxBase.h
+++ b/src/VBox/Main/include/VirtualBoxBase.h
@@ -1,9 +1,10 @@
+/* $Id: VirtualBoxBase.h $ */
 /** @file
  * VirtualBox COM base classes definition
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -23,14 +24,15 @@
 #include <list>
 #include <map>
 
+#include "ObjectState.h"
+
 #include "VBox/com/AutoLock.h"
 #include "VBox/com/string.h"
 #include "VBox/com/Guid.h"
 
 #include "VBox/com/VirtualBox.h"
 
-// avoid including VBox/settings.h and VBox/xml.h;
-// only declare the classes
+// avoid including VBox/settings.h and VBox/xml.h; only declare the classes
 namespace xml
 {
 class File;
@@ -44,9 +46,6 @@ class ErrorInfo;
 using namespace com;
 using namespace util;
 
-class AutoInitSpan;
-class AutoUninitSpan;
-
 class VirtualBox;
 class Machine;
 class Medium;
@@ -381,6 +380,19 @@ public:
     } while (0)
 
 /**
+ * Checks that the given pointer to an argument is valid and returns
+ * E_POINTER + extended error info otherwise.
+ * @param arg   Pointer argument.
+ */
+#define CheckComArgPointerValid(arg) \
+    do { \
+        if (RT_UNLIKELY(!RT_VALID_PTR(arg))) \
+            return setError(E_POINTER, \
+                tr("Argument %s points to invalid memory location (%p)"), \
+                #arg, (void *)(arg)); \
+    } while (0)
+
+/**
  * Checks that safe array argument is not NULL and returns E_INVALIDARG +
  * extended error info on failure.
  * @param arg   Input safe array argument (strings, interface pointers...)
@@ -651,53 +663,7 @@ public:
  *
  * Declares functionality that should be available in all components.
  *
- * Among the basic functionality implemented by this class is the primary object
- * state that indicates if the object is ready to serve the calls, and if not,
- * what stage it is currently at. Here is the primary state diagram:
- *
- *              +-------------------------------------------------------+
- *              |                                                       |
- *              |         (InitFailed) -----------------------+         |
- *              |              ^                              |         |
- *              v              |                              v         |
- *  [*] ---> NotReady ----> (InInit) -----> Ready -----> (InUninit) ----+
- *                     ^       |
- *                     |       v
- *                     |    Limited
- *                     |       |
- *                     +-------+
- *
- * The object is fully operational only when its state is Ready. The Limited
- * state means that only some vital part of the object is operational, and it
- * requires some sort of reinitialization to become fully operational. The
- * NotReady state means the object is basically dead: it either was not yet
- * initialized after creation at all, or was uninitialized and is waiting to be
- * destroyed when the last reference to it is released. All other states are
- * transitional.
- *
- * The NotReady->InInit->Ready, NotReady->InInit->Limited and
- * NotReady->InInit->InitFailed transition is done by the AutoInitSpan smart
- * class.
- *
- * The Limited->InInit->Ready, Limited->InInit->Limited and
- * Limited->InInit->InitFailed transition is done by the AutoReinitSpan smart
- * class.
- *
- * The Ready->InUninit->NotReady and InitFailed->InUninit->NotReady
- * transitions are done by the AutoUninitSpan smart class.
- *
- * In order to maintain the primary state integrity and declared functionality
- * all subclasses must:
- *
- * 1) Use the above Auto*Span classes to perform state transitions. See the
- *    individual class descriptions for details.
- *
- * 2) All public methods of subclasses (i.e. all methods that can be called
- *    directly, not only from within other methods of the subclass) must have a
- *    standard prolog as described in the AutoCaller and AutoLimitedCaller
- *    documentation. Alternatively, they must use addCaller()/releaseCaller()
- *    directly (and therefore have both the prolog and the epilog), but this is
- *    not recommended.
+ * The object state logic is documented in ObjectState.h.
  */
 class ATL_NO_VTABLE VirtualBoxBase
     : public VirtualBoxTranslatable,
@@ -730,8 +696,6 @@ protected:
 
 
 public:
-    enum State { NotReady, Ready, InInit, InUninit, InitFailed, Limited };
-
     VirtualBoxBase();
     virtual ~VirtualBoxBase();
 
@@ -742,24 +706,18 @@ public:
      * last reference to the object is released, before calling the destructor.
      *
      * @note Never call this method the AutoCaller scope or after the
-     *       #addCaller() call not paired by #releaseCaller() because it is a
-     *       guaranteed deadlock. See AutoUninitSpan for details.
+     *       ObjectState::addCaller() call not paired by
+     *       ObjectState::releaseCaller() because it is a guaranteed deadlock.
+     *       See AutoUninitSpan and AutoCaller.h/ObjectState.h for details.
      */
     virtual void uninit()
     { }
 
-    virtual HRESULT addCaller(State *aState = NULL,
-                              bool aLimited = false);
-    virtual void releaseCaller();
-
     /**
-     * Adds a limited caller. This method is equivalent to doing
-     * <tt>addCaller(aState, true)</tt>, but it is preferred because provides
-     * better self-descriptiveness. See #addCaller() for more info.
      */
-    HRESULT addLimitedCaller(State *aState = NULL)
+    ObjectState &getObjectState()
     {
-        return addCaller(aState, true /* aLimited */);
+        return mState;
     }
 
     /**
@@ -792,14 +750,6 @@ public:
 
     virtual RWLockHandle *lockHandle() const;
 
-    /**
-     * Returns a lock handle used to protect the primary state fields (used by
-     * #addCaller(), AutoInitSpan, AutoUninitSpan, etc.). Only intended to be
-     * used for similar purposes in subclasses. WARNING: NO any other locks may
-     * be requested while holding this lock!
-     */
-    WriteLockHandle *stateLockHandle() { return &mStateLock; }
-
     static HRESULT handleUnexpectedExceptions(VirtualBoxBase *const aThis, RT_SRC_POS_DECL);
 
     static HRESULT setErrorInternal(HRESULT aResultCode,
@@ -807,12 +757,17 @@ public:
                                     const char *aComponent,
                                     Utf8Str aText,
                                     bool aWarning,
-                                    bool aLogIt);
+                                    bool aLogIt,
+                                    LONG aResultDetail = 0);
     static void clearError(void);
 
     HRESULT setError(HRESULT aResultCode);
     HRESULT setError(HRESULT aResultCode, const char *pcsz, ...);
     HRESULT setError(const ErrorInfo &ei);
+    HRESULT setErrorVrc(int vrc);
+    HRESULT setErrorVrc(int vrc, const char *pcszMsgFmt, ...);
+    HRESULT setErrorBoth(HRESULT hrc, int vrc);
+    HRESULT setErrorBoth(HRESULT hrc, int vrc, const char *pcszMsgFmt, ...);
     HRESULT setWarning(HRESULT aResultCode, const char *pcsz, ...);
     HRESULT setErrorNoLog(HRESULT aResultCode, const char *pcsz, ...);
 
@@ -837,36 +792,11 @@ public:
 
 
 private:
-
-    void setState(State aState)
-    {
-        Assert(mState != aState);
-        mState = aState;
-        mStateChangeThread = RTThreadSelf();
-    }
-
-    /** Primary state of this object */
-    State mState;
-    /** Thread that caused the last state change */
-    RTTHREAD mStateChangeThread;
-    /** Total number of active calls to this object */
-    unsigned mCallers;
-    /** Posted when the number of callers drops to zero */
-    RTSEMEVENT mZeroCallersSem;
-    /** Posted when the object goes from InInit/InUninit to some other state */
-    RTSEMEVENTMULTI mInitUninitSem;
-    /** Number of threads waiting for mInitUninitDoneSem */
-    unsigned mInitUninitWaiters;
-
-    /** Protects access to state related data members */
-    WriteLockHandle mStateLock;
+    /** Object for representing object state */
+    ObjectState mState;
 
     /** User-level object lock for subclasses */
     mutable RWLockHandle *mObjectLock;
-
-    friend class AutoInitSpan;
-    friend class AutoReinitSpan;
-    friend class AutoUninitSpan;
 };
 
 /**
diff --git a/src/VBox/Main/include/VirtualBoxClientImpl.h b/src/VBox/Main/include/VirtualBoxClientImpl.h
index db17640..a9b6be5 100644
--- a/src/VBox/Main/include/VirtualBoxClientImpl.h
+++ b/src/VBox/Main/include/VirtualBoxClientImpl.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,7 +19,7 @@
 #ifndef ____H_VIRTUALBOXCLIENTIMPL
 #define ____H_VIRTUALBOXCLIENTIMPL
 
-#include "VirtualBoxBase.h"
+#include "VirtualBoxClientWrap.h"
 #include "EventImpl.h"
 
 #ifdef RT_OS_WINDOWS
@@ -27,26 +27,17 @@
 #endif
 
 class ATL_NO_VTABLE VirtualBoxClient :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IVirtualBoxClient)
+    public VirtualBoxClientWrap
 #ifdef RT_OS_WINDOWS
     , public CComCoClass<VirtualBoxClient, &CLSID_VirtualBoxClient>
 #endif
 {
 public:
-
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VirtualBoxClient, IVirtualBoxClient)
-
     DECLARE_CLASSFACTORY()
 
     DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
-    DECLARE_NOT_AGGREGATABLE(VirtualBoxClient)
-
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
 
-    BEGIN_COM_MAP(VirtualBoxClient)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IVirtualBoxClient)
-    END_COM_MAP()
+    DECLARE_NOT_AGGREGATABLE(VirtualBoxClient)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -55,13 +46,15 @@ public:
     HRESULT init();
     void uninit();
 
-    // IUSBDevice properties
-    STDMETHOD(COMGETTER(VirtualBox))(IVirtualBox **aVirtualBox);
-    STDMETHOD(COMGETTER(Session))(ISession **aSession);
-    STDMETHOD(COMGETTER(EventSource))(IEventSource **aEventSource);
-    STDMETHOD(CheckMachineError)(IMachine *aMachine);
-
 private:
+    // wrapped IVirtualBoxClient properties
+    virtual HRESULT getVirtualBox(ComPtr<IVirtualBox> &aVirtualBox);
+    virtual HRESULT getSession(ComPtr<ISession> &aSession);
+    virtual HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+
+    // wrapped IVirtualBoxClient methods
+    virtual HRESULT checkMachineError(const ComPtr<IMachine> &aMachine);
+
     /** Instance counter for simulating something similar to a singleton.
      * Only the first instance will be a usable object, all additional
      * instances will return a failure at creation time and will not work. */
diff --git a/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h b/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
index 8f02cf9..9e247f1 100644
--- a/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
+++ b/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
@@ -1,9 +1,10 @@
+/* $Id: VirtualBoxErrorInfoImpl.h $ */
 /** @file
  * VirtualBoxErrorInfo COM class definition.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -38,8 +39,29 @@ public:
         COM_INTERFACE_ENTRY(IErrorInfo)
         COM_INTERFACE_ENTRY(IVirtualBoxErrorInfo)
         COM_INTERFACE_ENTRY(IDispatch)
+        COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler)
     END_COM_MAP()
 
+    HRESULT FinalConstruct()
+    {
+#ifndef VBOX_WITH_XPCOM
+        return CoCreateFreeThreadedMarshaler((IUnknown *)(void *)this, &m_pUnkMarshaler);
+#else
+        return S_OK;
+#endif
+    }
+
+    void FinalRelease()
+    {
+#ifndef VBOX_WITH_XPCOM
+        if (m_pUnkMarshaler)
+        {
+            m_pUnkMarshaler->Release();
+            m_pUnkMarshaler = NULL;
+        }
+#endif
+    }
+
 #ifndef VBOX_WITH_XPCOM
 
     HRESULT init(IErrorInfo *aInfo);
@@ -127,6 +149,10 @@ private:
     Guid    m_IID;
     Utf8Str m_strComponent;
     ComPtr<IVirtualBoxErrorInfo> mNext;
+
+#ifndef VBOX_WITH_XPCOM
+    IUnknown *m_pUnkMarshaler;
+#endif
 };
 
 #endif // !____H_VIRTUALBOXERRORINFOIMPL
diff --git a/src/VBox/Main/include/VirtualBoxImpl.h b/src/VBox/Main/include/VirtualBoxImpl.h
index bcf769c..0a6daea 100644
--- a/src/VBox/Main/include/VirtualBoxImpl.h
+++ b/src/VBox/Main/include/VirtualBoxImpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,6 +20,7 @@
 
 #include "VirtualBoxBase.h"
 #include "objectslist.h"
+#include "VirtualBoxWrap.h"
 
 #ifdef RT_OS_WINDOWS
 # include "win/resource.h"
@@ -57,10 +58,9 @@ namespace settings
     struct MediaRegistry;
 }
 class ATL_NO_VTABLE VirtualBox :
-    public VirtualBoxBase,
-    VBOX_SCRIPTABLE_IMPL(IVirtualBox)
+    public VirtualBoxWrap
 #ifdef RT_OS_WINDOWS
-    , public CComCoClass<VirtualBox, &CLSID_VirtualBox>
+     , public CComCoClass<VirtualBox, &CLSID_VirtualBox>
 #endif
 {
 
@@ -72,22 +72,18 @@ public:
     class CallbackEvent;
     friend class CallbackEvent;
 
-    VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VirtualBox, IVirtualBox)
-
     DECLARE_CLASSFACTORY_SINGLETON(VirtualBox)
 
     DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
-    DECLARE_NOT_AGGREGATABLE(VirtualBox)
 
-    DECLARE_PROTECT_FINAL_CONSTRUCT()
-
-    BEGIN_COM_MAP(VirtualBox)
-        VBOX_DEFAULT_INTERFACE_ENTRIES(IVirtualBox)
-    END_COM_MAP()
+    // Kind of redundant (VirtualBoxWrap declares itself not aggregatable and
+    // CComCoClass<VirtualBox, &CLSID_VirtualBox> as aggregatable, the former
+    // is the first inheritance), but the C++ multiple inheritance rules and
+    // the class factory in svcmain.cpp needs this to disambiguate.
+    DECLARE_NOT_AGGREGATABLE(VirtualBox)
 
     // to postpone generation of the default ctor/dtor
-    VirtualBox();
-    ~VirtualBox();
+    DECLARE_EMPTY_CTOR_DTOR(VirtualBox)
 
     HRESULT FinalConstruct();
     void FinalRelease();
@@ -96,79 +92,10 @@ public:
     HRESULT init();
     HRESULT initMachines();
     HRESULT initMedia(const Guid &uuidMachineRegistry,
-                      const settings::MediaRegistry mediaRegistry,
+                      const settings::MediaRegistry &mediaRegistry,
                       const Utf8Str &strMachineFolder);
     void uninit();
 
-    /* IVirtualBox properties */
-    STDMETHOD(COMGETTER(Version))(BSTR *aVersion);
-    STDMETHOD(COMGETTER(VersionNormalized))(BSTR *aVersionNormalized);
-    STDMETHOD(COMGETTER(Revision))(ULONG *aRevision);
-    STDMETHOD(COMGETTER(PackageType))(BSTR *aPackageType);
-    STDMETHOD(COMGETTER(APIVersion))(BSTR *aAPIVersion);
-    STDMETHOD(COMGETTER(HomeFolder))(BSTR *aHomeFolder);
-    STDMETHOD(COMGETTER(SettingsFilePath))(BSTR *aSettingsFilePath);
-    STDMETHOD(COMGETTER(Host))(IHost **aHost);
-    STDMETHOD(COMGETTER(SystemProperties))(ISystemProperties **aSystemProperties);
-    STDMETHOD(COMGETTER(Machines))(ComSafeArrayOut(IMachine *, aMachines));
-    STDMETHOD(COMGETTER(MachineGroups))(ComSafeArrayOut(BSTR, aMachineGroups));
-    STDMETHOD(COMGETTER(HardDisks))(ComSafeArrayOut(IMedium *, aHardDisks));
-    STDMETHOD(COMGETTER(DVDImages))(ComSafeArrayOut(IMedium *, aDVDImages));
-    STDMETHOD(COMGETTER(FloppyImages))(ComSafeArrayOut(IMedium *, aFloppyImages));
-    STDMETHOD(COMGETTER(ProgressOperations))(ComSafeArrayOut(IProgress *, aOperations));
-    STDMETHOD(COMGETTER(GuestOSTypes))(ComSafeArrayOut(IGuestOSType *, aGuestOSTypes));
-    STDMETHOD(COMGETTER(SharedFolders))(ComSafeArrayOut(ISharedFolder *, aSharedFolders));
-    STDMETHOD(COMGETTER(PerformanceCollector))(IPerformanceCollector **aPerformanceCollector);
-    STDMETHOD(COMGETTER(DHCPServers))(ComSafeArrayOut(IDHCPServer *, aDHCPServers));
-    STDMETHOD(COMGETTER(NATNetworks))(ComSafeArrayOut(INATNetwork *, aNATNetworks));
-    STDMETHOD(COMGETTER(EventSource))(IEventSource ** aEventSource);
-    STDMETHOD(COMGETTER(ExtensionPackManager))(IExtPackManager **aExtPackManager);
-    STDMETHOD(COMGETTER(InternalNetworks))(ComSafeArrayOut(BSTR, aInternalNetworks));
-    STDMETHOD(COMGETTER(GenericNetworkDrivers))(ComSafeArrayOut(BSTR, aGenericNetworkDrivers));
-
-    /* IVirtualBox methods */
-    STDMETHOD(ComposeMachineFilename)(IN_BSTR aName, IN_BSTR aGroup, IN_BSTR aCreateFlags, IN_BSTR aBaseFolder, BSTR *aFilename);
-    STDMETHOD(CreateMachine)(IN_BSTR aSettingsFile,
-                             IN_BSTR aName,
-                             ComSafeArrayIn(IN_BSTR, aGroups),
-                             IN_BSTR aOsTypeId,
-                             IN_BSTR aCreateFlags,
-                             IMachine **aMachine);
-    STDMETHOD(OpenMachine)(IN_BSTR aSettingsFile, IMachine **aMachine);
-    STDMETHOD(RegisterMachine)(IMachine *aMachine);
-    STDMETHOD(FindMachine)(IN_BSTR aNameOrId, IMachine **aMachine);
-    STDMETHOD(GetMachinesByGroups)(ComSafeArrayIn(IN_BSTR, aGroups), ComSafeArrayOut(IMachine *, aMachines));
-    STDMETHOD(GetMachineStates)(ComSafeArrayIn(IMachine *, aMachines), ComSafeArrayOut(MachineState_T, aStates));
-    STDMETHOD(CreateAppliance)(IAppliance **anAppliance);
-
-    STDMETHOD(CreateHardDisk)(IN_BSTR aFormat,
-                              IN_BSTR aLocation,
-                              IMedium **aHardDisk);
-    STDMETHOD(OpenMedium)(IN_BSTR aLocation,
-                          DeviceType_T deviceType,
-                          AccessMode_T accessMode,
-                          BOOL fForceNewUuid,
-                          IMedium **aMedium);
-
-    STDMETHOD(GetGuestOSType)(IN_BSTR aId, IGuestOSType **aType);
-    STDMETHOD(CreateSharedFolder)(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount);
-    STDMETHOD(RemoveSharedFolder)(IN_BSTR aName);
-    STDMETHOD(GetExtraDataKeys)(ComSafeArrayOut(BSTR, aKeys));
-    STDMETHOD(GetExtraData)(IN_BSTR aKey, BSTR *aValue);
-    STDMETHOD(SetExtraData)(IN_BSTR aKey, IN_BSTR aValue);
-    STDMETHOD(SetSettingsSecret)(IN_BSTR aKey);
-
-    STDMETHOD(CreateDHCPServer)(IN_BSTR aName, IDHCPServer ** aServer);
-    STDMETHOD(FindDHCPServerByNetworkName)(IN_BSTR aName, IDHCPServer ** aServer);
-    STDMETHOD(RemoveDHCPServer)(IDHCPServer * aServer);
-
-    STDMETHOD(CreateNATNetwork)(IN_BSTR aName, INATNetwork ** aNATNetworks);
-    STDMETHOD(FindNATNetworkByName)(IN_BSTR aName, INATNetwork ** aNATNetworks);
-    STDMETHOD(RemoveNATNetwork)(INATNetwork * aNATNetwork);
-
-    STDMETHOD(CheckFirmwarePresent)(FirmwareType_T aFirmwareType, IN_BSTR aVersion,
-                                    BSTR * aUrl, BSTR * aFile, BOOL * aResult);
-
     /* public methods only for internal purposes */
 
     /**
@@ -181,192 +108,272 @@ public:
     }
 
 #ifdef DEBUG
-    void dumpAllBackRefs();
+    void i_dumpAllBackRefs();
 #endif
 
-    HRESULT postEvent(Event *event);
+    HRESULT i_postEvent(Event *event);
 
-    HRESULT addProgress(IProgress *aProgress);
-    HRESULT removeProgress(IN_GUID aId);
+    HRESULT i_addProgress(IProgress *aProgress);
+    HRESULT i_removeProgress(IN_GUID aId);
 
 #ifdef RT_OS_WINDOWS
     typedef DECLCALLBACKPTR(HRESULT, SVCHelperClientFunc)
         (SVCHlpClient *aClient, Progress *aProgress, void *aUser, int *aVrc);
-    HRESULT startSVCHelperClient(bool aPrivileged,
-                                 SVCHelperClientFunc aFunc,
-                                 void *aUser, Progress *aProgress);
+    HRESULT i_startSVCHelperClient(bool aPrivileged,
+                                   SVCHelperClientFunc aFunc,
+                                   void *aUser, Progress *aProgress);
 #endif
 
-    void addProcessToReap(RTPROCESS pid);
-    void updateClientWatcher();
-
-    int loadVDPlugin(const char *pszPluginLibrary);
-    int unloadVDPlugin(const char *pszPluginLibrary);
-
-    void onMachineStateChange(const Guid &aId, MachineState_T aState);
-    void onMachineDataChange(const Guid &aId, BOOL aTemporary = FALSE);
-    BOOL onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue,
-                              Bstr &aError);
-    void onExtraDataChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue);
-    void onMachineRegistered(const Guid &aId, BOOL aRegistered);
-    void onSessionStateChange(const Guid &aId, SessionState_T aState);
-
-    void onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId);
-    void onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId);
-    void onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId);
-    void onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName, IN_BSTR aValue,
-                               IN_BSTR aFlags);
-    void onNatRedirectChange(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName,
-                                   NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort,
-                                   IN_BSTR aGuestIp, uint16_t aGuestPort);
-    void onNATNetworkChange(IN_BSTR aNetworkName);
-    void onNATNetworkStartStop(IN_BSTR aNetworkName, BOOL aStart);
-    void onNATNetworkSetting(IN_BSTR aNetworkName, BOOL aEnabled, IN_BSTR aNetwork,
-                             IN_BSTR aGateway, BOOL aAdvertiseDefaultIpv6RouteEnabled,
-                             BOOL fNeedDhcpServer);
-    void onNATNetworkPortForward(IN_BSTR aNetworkName, BOOL create, BOOL fIpv6,
-                                 IN_BSTR aRuleName, NATProtocol_T proto,
-                                 IN_BSTR aHostIp, LONG aHostPort,
-                                 IN_BSTR aGuestIp, LONG aGuestPort);
-    void onHostNameResolutionConfigurationChange();
-
-    int natNetworkRefInc(IN_BSTR aNetworkName);
-    int natNetworkRefDec(IN_BSTR aNetworkName);
-
-    ComObjPtr<GuestOSType> getUnknownOSType();
-
-    void getOpenedMachines(SessionMachinesList &aMachines,
+    void i_addProcessToReap(RTPROCESS pid);
+    void i_updateClientWatcher();
+
+    int i_loadVDPlugin(const char *pszPluginLibrary);
+    int i_unloadVDPlugin(const char *pszPluginLibrary);
+
+    void i_onMachineStateChange(const Guid &aId, MachineState_T aState);
+    void i_onMachineDataChange(const Guid &aId, BOOL aTemporary = FALSE);
+    BOOL i_onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue,
+                                Bstr &aError);
+    void i_onExtraDataChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue);
+    void i_onMachineRegistered(const Guid &aId, BOOL aRegistered);
+    void i_onSessionStateChange(const Guid &aId, SessionState_T aState);
+
+    void i_onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId);
+    void i_onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId);
+    void i_onSnapshotRestored(const Guid &aMachineId, const Guid &aSnapshotId);
+    void i_onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId);
+    void i_onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName, IN_BSTR aValue,
+                                 IN_BSTR aFlags);
+    void i_onNatRedirectChange(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName,
+                                     NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort,
+                                     IN_BSTR aGuestIp, uint16_t aGuestPort);
+    void i_onNATNetworkChange(IN_BSTR aNetworkName);
+    void i_onNATNetworkStartStop(IN_BSTR aNetworkName, BOOL aStart);
+    void i_onNATNetworkSetting(IN_BSTR aNetworkName, BOOL aEnabled, IN_BSTR aNetwork,
+                               IN_BSTR aGateway, BOOL aAdvertiseDefaultIpv6RouteEnabled,
+                               BOOL fNeedDhcpServer);
+    void i_onNATNetworkPortForward(IN_BSTR aNetworkName, BOOL create, BOOL fIpv6,
+                                   IN_BSTR aRuleName, NATProtocol_T proto,
+                                   IN_BSTR aHostIp, LONG aHostPort,
+                                   IN_BSTR aGuestIp, LONG aGuestPort);
+    void i_onHostNameResolutionConfigurationChange();
+
+    int i_natNetworkRefInc(IN_BSTR aNetworkName);
+    int i_natNetworkRefDec(IN_BSTR aNetworkName);
+
+    ComObjPtr<GuestOSType> i_getUnknownOSType();
+
+    void i_getOpenedMachines(SessionMachinesList &aMachines,
                            InternalControlList *aControls = NULL);
-    MachinesOList &getMachinesList();
-
-    HRESULT findMachine(const Guid &aId,
-                        bool fPermitInaccessible,
-                        bool aSetError,
-                        ComObjPtr<Machine> *aMachine = NULL);
-    HRESULT findMachineByName(const Utf8Str &aName,
-                              bool aSetError,
-                              ComObjPtr<Machine> *aMachine = NULL);
-
-    HRESULT validateMachineGroup(const Utf8Str &aGroup, bool fPrimary);
-    HRESULT convertMachineGroups(ComSafeArrayIn(IN_BSTR, aMachineGroups), StringsList *pllMachineGroups);
-
-    HRESULT findHardDiskById(const Guid &id,
-                             bool aSetError,
-                             ComObjPtr<Medium> *aHardDisk = NULL);
-    HRESULT findHardDiskByLocation(const Utf8Str &strLocation,
+    MachinesOList &i_getMachinesList();
+
+    HRESULT i_findMachine(const Guid &aId,
+                          bool fPermitInaccessible,
+                          bool aSetError,
+                          ComObjPtr<Machine> *aMachine = NULL);
+
+    HRESULT i_findMachineByName(const Utf8Str &aName,
+                                bool aSetError,
+                                ComObjPtr<Machine> *aMachine = NULL);
+
+    HRESULT i_validateMachineGroup(const Utf8Str &aGroup, bool fPrimary);
+    HRESULT i_convertMachineGroups(const std::vector<com::Utf8Str> aMachineGroups, StringsList *pllMachineGroups);
+
+    HRESULT i_findHardDiskById(const Guid &id,
+                               bool aSetError,
+                               ComObjPtr<Medium> *aHardDisk = NULL);
+    HRESULT i_findHardDiskByLocation(const Utf8Str &strLocation,
+                                     bool aSetError,
+                                     ComObjPtr<Medium> *aHardDisk = NULL);
+    HRESULT i_findDVDOrFloppyImage(DeviceType_T mediumType,
+                                   const Guid *aId,
+                                   const Utf8Str &aLocation,
+                                   bool aSetError,
+                                   ComObjPtr<Medium> *aImage = NULL);
+    HRESULT i_findRemoveableMedium(DeviceType_T mediumType,
+                                   const Guid &uuid,
+                                   bool fRefresh,
                                    bool aSetError,
-                                   ComObjPtr<Medium> *aHardDisk = NULL);
-    HRESULT findDVDOrFloppyImage(DeviceType_T mediumType,
-                                 const Guid *aId,
-                                 const Utf8Str &aLocation,
-                                 bool aSetError,
-                                 ComObjPtr<Medium> *aImage = NULL);
-    HRESULT findRemoveableMedium(DeviceType_T mediumType,
-                                 const Guid &uuid,
-                                 bool fRefresh,
-                                 bool aSetError,
-                                 ComObjPtr<Medium> &pMedium);
-
-    HRESULT findGuestOSType(const Bstr &bstrOSType,
-                            GuestOSType*& pGuestOSType);
-
-    const Guid &getGlobalRegistryId() const;
-
-    const ComObjPtr<Host>& host() const;
-    SystemProperties* getSystemProperties() const;
+                                   ComObjPtr<Medium> &pMedium);
+
+    HRESULT i_findGuestOSType(const Bstr &bstrOSType,
+                              GuestOSType*& pGuestOSType);
+
+    const Guid &i_getGlobalRegistryId() const;
+
+    const ComObjPtr<Host>& i_host() const;
+    SystemProperties* i_getSystemProperties() const;
 #ifdef VBOX_WITH_EXTPACK
-    ExtPackManager* getExtPackManager() const;
+    ExtPackManager* i_getExtPackManager() const;
 #endif
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
-    const ComObjPtr<PerformanceCollector>& performanceCollector() const;
+    const ComObjPtr<PerformanceCollector>& i_performanceCollector() const;
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
 
-    void getDefaultMachineFolder(Utf8Str &str) const;
-    void getDefaultHardDiskFormat(Utf8Str &str) const;
+    void i_getDefaultMachineFolder(Utf8Str &str) const;
+    void i_getDefaultHardDiskFormat(Utf8Str &str) const;
 
     /** Returns the VirtualBox home directory */
-    const Utf8Str& homeDir() const;
-
-    int calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
-    void copyPathRelativeToConfig(const Utf8Str &strSource, Utf8Str &strTarget);
-
-    HRESULT registerMedium(const ComObjPtr<Medium> &pMedium, ComObjPtr<Medium> *ppMedium, DeviceType_T argType, AutoWriteLock &mediaTreeLock);
-    HRESULT unregisterMedium(Medium *pMedium);
-
-    void pushMediumToListWithChildren(MediaList &llMedia, Medium *pMedium);
-    HRESULT unregisterMachineMedia(const Guid &id);
+    const Utf8Str& i_homeDir() const;
+    int i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult);
+    void i_copyPathRelativeToConfig(const Utf8Str &strSource, Utf8Str &strTarget);
+    HRESULT i_registerMedium(const ComObjPtr<Medium> &pMedium, ComObjPtr<Medium> *ppMedium,
+                             AutoWriteLock &mediaTreeLock);
+    HRESULT i_unregisterMedium(Medium *pMedium);
+    void i_pushMediumToListWithChildren(MediaList &llMedia, Medium *pMedium);
+    HRESULT i_unregisterMachineMedia(const Guid &id);
+    HRESULT i_unregisterMachine(Machine *pMachine, const Guid &id);
+    void i_rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir,
+                                             const Utf8Str &strNewConfigDir);
+    void i_saveMediaRegistry(settings::MediaRegistry &mediaRegistry,
+                             const Guid &uuidRegistry,
+                             const Utf8Str &strMachineFolder);
+    HRESULT i_saveSettings();
+    void i_markRegistryModified(const Guid &uuid);
+    void i_unmarkRegistryModified(const Guid &uuid);
+    void i_saveModifiedRegistries();
+    static const com::Utf8Str &i_getVersionNormalized();
+    static HRESULT i_ensureFilePathExists(const Utf8Str &strFileName, bool fCreate);
+    const Utf8Str& i_settingsFilePath();
+    AutostartDb* i_getAutostartDb() const;
+    RWLockHandle& i_getMachinesListLockHandle();
+    RWLockHandle& i_getMediaTreeLockHandle();
+    int  i_encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext);
+    int  i_decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext);
+    void i_storeSettingsKey(const Utf8Str &aKey);
+    bool i_isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType);
 
-    HRESULT unregisterMachine(Machine *pMachine, const Guid &id);
 
-    void rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir,
-                                           const Utf8Str &strNewConfigDir);
-
-    void saveMediaRegistry(settings::MediaRegistry &mediaRegistry,
-                           const Guid &uuidRegistry,
-                           const Utf8Str &strMachineFolder);
-    HRESULT saveSettings();
-
-    void markRegistryModified(const Guid &uuid);
-    void saveModifiedRegistries();
-
-    static const Bstr &getVersionNormalized();
-
-    static HRESULT ensureFilePathExists(const Utf8Str &strFileName, bool fCreate);
-
-    const Utf8Str& settingsFilePath();
-
-    AutostartDb* getAutostartDb() const;
-
-    RWLockHandle& getMachinesListLockHandle();
-    RWLockHandle& getMediaTreeLockHandle();
-
-    int  encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext);
-    int  decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext);
-    void storeSettingsKey(const Utf8Str &aKey);
-
-    bool isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType);
 
 private:
     class ClientWatcher;
 
-    static HRESULT setErrorStatic(HRESULT aResultCode,
-                                  const Utf8Str &aText)
+    // wrapped IVirtualBox properties
+    HRESULT getVersion(com::Utf8Str &aVersion);
+    HRESULT getVersionNormalized(com::Utf8Str &aVersionNormalized);
+    HRESULT getRevision(ULONG *aRevision);
+    HRESULT getPackageType(com::Utf8Str &aPackageType);
+    HRESULT getAPIVersion(com::Utf8Str &aAPIVersion);
+    HRESULT getHomeFolder(com::Utf8Str &aHomeFolder);
+    HRESULT getSettingsFilePath(com::Utf8Str &aSettingsFilePath);
+    HRESULT getHost(ComPtr<IHost> &aHost);
+    HRESULT getSystemProperties(ComPtr<ISystemProperties> &aSystemProperties);
+    HRESULT getMachines(std::vector<ComPtr<IMachine> > &aMachines);
+    HRESULT getMachineGroups(std::vector<com::Utf8Str> &aMachineGroups);
+    HRESULT getHardDisks(std::vector<ComPtr<IMedium> > &aHardDisks);
+    HRESULT getDVDImages(std::vector<ComPtr<IMedium> > &aDVDImages);
+    HRESULT getFloppyImages(std::vector<ComPtr<IMedium> > &aFloppyImages);
+    HRESULT getProgressOperations(std::vector<ComPtr<IProgress> > &aProgressOperations);
+    HRESULT getGuestOSTypes(std::vector<ComPtr<IGuestOSType> > &aGuestOSTypes);
+    HRESULT getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders);
+    HRESULT getPerformanceCollector(ComPtr<IPerformanceCollector> &aPerformanceCollector);
+    HRESULT getDHCPServers(std::vector<ComPtr<IDHCPServer> > &aDHCPServers);
+    HRESULT getNATNetworks(std::vector<ComPtr<INATNetwork> > &aNATNetworks);
+    HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
+    HRESULT getExtensionPackManager(ComPtr<IExtPackManager> &aExtensionPackManager);
+    HRESULT getInternalNetworks(std::vector<com::Utf8Str> &aInternalNetworks);
+    HRESULT getGenericNetworkDrivers(std::vector<com::Utf8Str> &aGenericNetworkDrivers);
+
+   // wrapped IVirtualBox methods
+    HRESULT composeMachineFilename(const com::Utf8Str &aName,
+                                   const com::Utf8Str &aGroup,
+                                   const com::Utf8Str &aCreateFlags,
+                                   const com::Utf8Str &aBaseFolder,
+                                   com::Utf8Str &aFile);
+    HRESULT createMachine(const com::Utf8Str &aSettingsFile,
+                          const com::Utf8Str &aName,
+                          const std::vector<com::Utf8Str> &aGroups,
+                          const com::Utf8Str &aOsTypeId,
+                          const com::Utf8Str &aFlags,
+                          ComPtr<IMachine> &aMachine);
+    HRESULT openMachine(const com::Utf8Str &aSettingsFile,
+                        ComPtr<IMachine> &aMachine);
+    HRESULT registerMachine(const ComPtr<IMachine> &aMachine);
+    HRESULT findMachine(const com::Utf8Str &aNameOrId,
+                        ComPtr<IMachine> &aMachine);
+    HRESULT getMachinesByGroups(const std::vector<com::Utf8Str> &aGroups,
+                                std::vector<ComPtr<IMachine> > &aMachines);
+    HRESULT getMachineStates(const std::vector<ComPtr<IMachine> > &aMachines,
+                             std::vector<MachineState_T> &aStates);
+    HRESULT createAppliance(ComPtr<IAppliance> &aAppliance);
+    HRESULT createMedium(const com::Utf8Str &aFormat,
+                         const com::Utf8Str &aLocation,
+                         AccessMode_T aAccessMode,
+                         DeviceType_T aDeviceType,
+                         ComPtr<IMedium> &aMedium);
+    HRESULT openMedium(const com::Utf8Str &aLocation,
+                       DeviceType_T aDeviceType,
+                       AccessMode_T aAccessMode,
+                       BOOL aForceNewUuid,
+                       ComPtr<IMedium> &aMedium);
+    HRESULT getGuestOSType(const com::Utf8Str &aId,
+                           ComPtr<IGuestOSType> &aType);
+    HRESULT createSharedFolder(const com::Utf8Str &aName,
+                               const com::Utf8Str &aHostPath,
+                               BOOL aWritable,
+                               BOOL aAutomount);
+    HRESULT removeSharedFolder(const com::Utf8Str &aName);
+    HRESULT getExtraDataKeys(std::vector<com::Utf8Str> &aKeys);
+    HRESULT getExtraData(const com::Utf8Str &aKey,
+                         com::Utf8Str &aValue);
+    HRESULT setExtraData(const com::Utf8Str &aKey,
+                         const com::Utf8Str &aValue);
+    HRESULT setSettingsSecret(const com::Utf8Str &aPassword);
+    HRESULT createDHCPServer(const com::Utf8Str &aName,
+                             ComPtr<IDHCPServer> &aServer);
+    HRESULT findDHCPServerByNetworkName(const com::Utf8Str &aName,
+                                        ComPtr<IDHCPServer> &aServer);
+    HRESULT removeDHCPServer(const ComPtr<IDHCPServer> &aServer);
+    HRESULT createNATNetwork(const com::Utf8Str &aNetworkName,
+                             ComPtr<INATNetwork> &aNetwork);
+    HRESULT findNATNetworkByName(const com::Utf8Str &aNetworkName,
+                                 ComPtr<INATNetwork> &aNetwork);
+    HRESULT removeNATNetwork(const ComPtr<INATNetwork> &aNetwork);
+    HRESULT checkFirmwarePresent(FirmwareType_T aFirmwareType,
+                                 const com::Utf8Str &aVersion,
+                                 com::Utf8Str &aUrl,
+                                 com::Utf8Str &aFile,
+                                 BOOL *aResult);
+
+    static HRESULT i_setErrorStatic(HRESULT aResultCode,
+                                    const Utf8Str &aText)
     {
         return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true);
     }
 
-    HRESULT registerMachine(Machine *aMachine);
-
-    HRESULT registerDHCPServer(DHCPServer *aDHCPServer,
-                               bool aSaveRegistry = true);
-    HRESULT unregisterDHCPServer(DHCPServer *aDHCPServer,
+    HRESULT i_registerMachine(Machine *aMachine);
+    HRESULT i_registerDHCPServer(DHCPServer *aDHCPServer,
                                  bool aSaveRegistry = true);
-    HRESULT registerNATNetwork(NATNetwork *aNATNetwork,
-                               bool aSaveRegistry = true);
-    HRESULT unregisterNATNetwork(NATNetwork *aNATNetwork,
+    HRESULT i_unregisterDHCPServer(DHCPServer *aDHCPServer);
+    HRESULT i_registerNATNetwork(NATNetwork *aNATNetwork,
                                  bool aSaveRegistry = true);
-    HRESULT checkMediaForConflicts(const Guid &aId,
-                                   const Utf8Str &aLocation,
-                                   Utf8Str &aConflictType,
-                                   ComObjPtr<Medium> *pDupMedium);
-
-    int  decryptSettings();
-    int  decryptMediumSettings(Medium *pMedium);
-    int  decryptSettingBytes(uint8_t *aPlaintext, const uint8_t *aCiphertext,
-                             size_t aCiphertextSize) const;
-    int  encryptSettingBytes(const uint8_t *aPlaintext, uint8_t *aCiphertext,
-                             size_t aPlaintextSize, size_t aCiphertextSize) const;
+    HRESULT i_unregisterNATNetwork(NATNetwork *aNATNetwork,
+                                   bool aSaveRegistry = true);
+    HRESULT i_checkMediaForConflicts(const Guid &aId,
+                                     const Utf8Str &aLocation,
+                                     Utf8Str &aConflictType,
+                                     ComObjPtr<Medium> *pDupMedium);
+    int  i_decryptSettings();
+    int  i_decryptMediumSettings(Medium *pMedium);
+    int  i_decryptSettingBytes(uint8_t *aPlaintext,
+                               const uint8_t *aCiphertext,
+                               size_t aCiphertextSize) const;
+    int  i_encryptSettingBytes(const uint8_t *aPlaintext,
+                               uint8_t *aCiphertext,
+                               size_t aPlaintextSize,
+                               size_t aCiphertextSize) const;
 
     struct Data;            // opaque data structure, defined in VirtualBoxImpl.cpp
+
     Data *m;
 
     /* static variables (defined in VirtualBoxImpl.cpp) */
-    static Bstr sVersion;
-    static Bstr sVersionNormalized;
+    static com::Utf8Str sVersion;
+    static com::Utf8Str sVersionNormalized;
     static ULONG sRevision;
-    static Bstr sPackageType;
-    static Bstr sAPIVersion;
-    static std::map<Bstr, int> sNatNetworkNameToRefCount;
+    static com::Utf8Str sPackageType;
+    static com::Utf8Str sAPIVersion;
+    static std::map<com::Utf8Str, int> sNatNetworkNameToRefCount;
     static RWLockHandle* spMtxNatNetworkNameToRefCountLock;
 
     static DECLCALLBACK(int) AsyncEventHandler(RTTHREAD thread, void *pvUser);
diff --git a/src/VBox/Main/include/Wrapper.h b/src/VBox/Main/include/Wrapper.h
index 2381ea2..cfdb174 100644
--- a/src/VBox/Main/include/Wrapper.h
+++ b/src/VBox/Main/include/Wrapper.h
@@ -351,9 +351,7 @@ public:
     {
         if (mDst)
         {
-            com::SafeIfaceArray<A> outArray(mArray.size());
-            for (size_t i = 0; i < mArray.size(); i++)
-                outArray[i] = mArray[i];
+            com::SafeIfaceArray<A> outArray(mArray);
             outArray.detachTo(ComSafeArrayOutArg(mDst));
         }
     }
diff --git a/src/VBox/Main/include/netif.h b/src/VBox/Main/include/netif.h
index bd61892..7f3bfd4 100644
--- a/src/VBox/Main/include/netif.h
+++ b/src/VBox/Main/include/netif.h
@@ -1,3 +1,4 @@
+/* $Id: netif.h $ */
 /** @file
  * Main - Network Interfaces.
  */
diff --git a/src/VBox/Main/include/objectslist.h b/src/VBox/Main/include/objectslist.h
index f0c443c..c506dd8 100644
--- a/src/VBox/Main/include/objectslist.h
+++ b/src/VBox/Main/include/objectslist.h
@@ -1,3 +1,4 @@
+/* $Id: objectslist.h $ */
 /** @file
  *
  * List of COM objects
diff --git a/src/VBox/Main/include/vbox-libhal.h b/src/VBox/Main/include/vbox-libhal.h
index 5697b20..890fb28 100644
--- a/src/VBox/Main/include/vbox-libhal.h
+++ b/src/VBox/Main/include/vbox-libhal.h
@@ -1,3 +1,4 @@
+/* $Id: vbox-libhal.h $ */
 /** @file
  *
  * Module to dynamically load libhal and libdbus and load all symbols
diff --git a/src/VBox/Main/include/vector.h b/src/VBox/Main/include/vector.h
index b831aca..abcf0a6 100644
--- a/src/VBox/Main/include/vector.h
+++ b/src/VBox/Main/include/vector.h
@@ -1,3 +1,4 @@
+/* $Id: vector.h $ */
 /** @file
  * STL-inspired vector implementation in C
  * @note  functions in this file are inline to prevent warnings about
diff --git a/src/VBox/Main/include/win/resource.h b/src/VBox/Main/include/win/resource.h
index 160e473..854e1e2 100644
--- a/src/VBox/Main/include/win/resource.h
+++ b/src/VBox/Main/include/win/resource.h
@@ -1,3 +1,4 @@
+/* $Id: resource.h $ */
 /** @file
  *
  * Resource definitions
diff --git a/src/VBox/Main/src-all/AutoCaller.cpp b/src/VBox/Main/src-all/AutoCaller.cpp
new file mode 100644
index 0000000..88324f4
--- /dev/null
+++ b/src/VBox/Main/src-all/AutoCaller.cpp
@@ -0,0 +1,514 @@
+/* $Id: AutoCaller.cpp $ */
+
+/** @file
+ *
+ * VirtualBox object state implementation
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <iprt/semaphore.h>
+
+#include "VirtualBoxBase.h"
+#include "AutoCaller.h"
+#include "Logging.h"
+
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// ObjectState methods
+//
+////////////////////////////////////////////////////////////////////////////////
+
+
+ObjectState::ObjectState() : mStateLock(LOCKCLASS_OBJECTSTATE)
+{
+    AssertFailed();
+}
+
+ObjectState::ObjectState(VirtualBoxBase *aObj) :
+    mObj(aObj), mStateLock(LOCKCLASS_OBJECTSTATE)
+{
+    Assert(mObj);
+    mState = NotReady;
+    mStateChangeThread = NIL_RTTHREAD;
+    mCallers = 0;
+    mZeroCallersSem = NIL_RTSEMEVENT;
+    mInitUninitSem = NIL_RTSEMEVENTMULTI;
+    mInitUninitWaiters = 0;
+}
+
+ObjectState::~ObjectState()
+{
+    Assert(mInitUninitWaiters == 0);
+    Assert(mInitUninitSem == NIL_RTSEMEVENTMULTI);
+    if (mZeroCallersSem != NIL_RTSEMEVENT)
+        RTSemEventDestroy(mZeroCallersSem);
+    mCallers = 0;
+    mStateChangeThread = NIL_RTTHREAD;
+    mState = NotReady;
+    mObj = NULL;
+}
+
+ObjectState::State ObjectState::getState()
+{
+    AutoReadLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
+    return mState;
+}
+
+/**
+ * Increments the number of calls to this object by one.
+ *
+ * After this method succeeds, it is guaranteed that the object will remain
+ * in the Ready (or in the Limited) state at least until #releaseCaller() is
+ * called.
+ *
+ * This method is intended to mark the beginning of sections of code within
+ * methods of COM objects that depend on the readiness (Ready) state. The
+ * Ready state is a primary "ready to serve" state. Usually all code that
+ * works with component's data depends on it. On practice, this means that
+ * almost every public method, setter or getter of the object should add
+ * itself as an object's caller at the very beginning, to protect from an
+ * unexpected uninitialization that may happen on a different thread.
+ *
+ * Besides the Ready state denoting that the object is fully functional,
+ * there is a special Limited state. The Limited state means that the object
+ * is still functional, but its functionality is limited to some degree, so
+ * not all operations are possible. The @a aLimited argument to this method
+ * determines whether the caller represents this limited functionality or
+ * not.
+ *
+ * This method succeeds (and increments the number of callers) only if the
+ * current object's state is Ready. Otherwise, it will return E_ACCESSDENIED
+ * to indicate that the object is not operational. There are two exceptions
+ * from this rule:
+ * <ol>
+ *   <li>If the @a aLimited argument is |true|, then this method will also
+ *       succeed if the object's state is Limited (or Ready, of course).
+ *   </li>
+ *   <li>If this method is called from the same thread that placed
+ *       the object to InInit or InUninit state (i.e. either from within the
+ *       AutoInitSpan or AutoUninitSpan scope), it will succeed as well (but
+ *       will not increase the number of callers).
+ *   </li>
+ * </ol>
+ *
+ * Normally, calling addCaller() never blocks. However, if this method is
+ * called by a thread created from within the AutoInitSpan scope and this
+ * scope is still active (i.e. the object state is InInit), it will block
+ * until the AutoInitSpan destructor signals that it has finished
+ * initialization.
+ *
+ * When this method returns a failure, the caller must not use the object
+ * and should return the failed result code to its own caller.
+ *
+ * @param aLimited      |true| to add a limited caller.
+ *
+ * @return              S_OK on success or E_ACCESSDENIED on failure.
+ *
+ * @sa #releaseCaller()
+ */
+HRESULT ObjectState::addCaller(bool aLimited /* = false */)
+{
+    AutoWriteLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT rc = E_ACCESSDENIED;
+
+    if (mState == Ready || (aLimited && mState == Limited))
+    {
+        /* if Ready or allows Limited, increase the number of callers */
+        ++mCallers;
+        rc = S_OK;
+    }
+    else
+    if (mState == InInit || mState == InUninit)
+    {
+        if (mStateChangeThread == RTThreadSelf())
+        {
+            /* Called from the same thread that is doing AutoInitSpan or
+             * AutoUninitSpan, just succeed */
+            rc = S_OK;
+        }
+        else if (mState == InInit)
+        {
+            /* addCaller() is called by a "child" thread while the "parent"
+             * thread is still doing AutoInitSpan/AutoReinitSpan, so wait for
+             * the state to become either Ready/Limited or InitFailed (in
+             * case of init failure).
+             *
+             * Note that we increase the number of callers anyway -- to
+             * prevent AutoUninitSpan from early completion if we are
+             * still not scheduled to pick up the posted semaphore when
+             * uninit() is called.
+             */
+            ++mCallers;
+
+            /* lazy semaphore creation */
+            if (mInitUninitSem == NIL_RTSEMEVENTMULTI)
+            {
+                RTSemEventMultiCreate(&mInitUninitSem);
+                Assert(mInitUninitWaiters == 0);
+            }
+
+            ++mInitUninitWaiters;
+
+            LogFlowThisFunc(("Waiting for AutoInitSpan/AutoReinitSpan to finish...\n"));
+
+            stateLock.release();
+            RTSemEventMultiWait(mInitUninitSem, RT_INDEFINITE_WAIT);
+            stateLock.acquire();
+
+            if (--mInitUninitWaiters == 0)
+            {
+                /* destroy the semaphore since no more necessary */
+                RTSemEventMultiDestroy(mInitUninitSem);
+                mInitUninitSem = NIL_RTSEMEVENTMULTI;
+            }
+
+            if (mState == Ready || (aLimited && mState == Limited))
+                rc = S_OK;
+            else
+            {
+                Assert(mCallers != 0);
+                --mCallers;
+                if (mCallers == 0 && mState == InUninit)
+                {
+                    /* inform AutoUninitSpan ctor there are no more callers */
+                    RTSemEventSignal(mZeroCallersSem);
+                }
+            }
+        }
+    }
+
+    if (FAILED(rc))
+    {
+        if (mState == Limited)
+            rc = mObj->setError(rc, "The object functionality is limited");
+        else
+            rc = mObj->setError(rc, "The object is not ready");
+    }
+
+    return rc;
+}
+
+/**
+ * Decreases the number of calls to this object by one.
+ *
+ * Must be called after every #addCaller() when protecting the object
+ * from uninitialization is no more necessary.
+ */
+void ObjectState::releaseCaller()
+{
+    AutoWriteLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
+
+    if (mState == Ready || mState == Limited)
+    {
+        /* if Ready or Limited, decrease the number of callers */
+        AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0);
+        --mCallers;
+
+        return;
+    }
+
+    if (mState == InInit || mState == InUninit)
+    {
+        if (mStateChangeThread == RTThreadSelf())
+        {
+            /* Called from the same thread that is doing AutoInitSpan or
+             * AutoUninitSpan: just succeed */
+            return;
+        }
+
+        if (mState == InUninit)
+        {
+            /* the caller is being released after AutoUninitSpan has begun */
+            AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0);
+            --mCallers;
+
+            if (mCallers == 0)
+                /* inform the Auto*UninitSpan ctor there are no more callers */
+                RTSemEventSignal(mZeroCallersSem);
+
+            return;
+        }
+    }
+
+    AssertMsgFailed(("mState = %d!", mState));
+}
+
+bool ObjectState::autoInitSpanConstructor(ObjectState::State aExpectedState)
+{
+    AutoWriteLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
+
+    if (mState == aExpectedState)
+    {
+        setState(InInit);
+        return true;
+    }
+    else
+        return false;
+}
+
+void ObjectState::autoInitSpanDestructor(State aNewState)
+{
+    AutoWriteLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
+
+    Assert(mState == InInit);
+
+    if (mCallers > 0 && mInitUninitWaiters > 0)
+    {
+        /* We have some pending addCaller() calls on other threads (created
+         * during InInit), signal that InInit is finished and they may go on. */
+        RTSemEventMultiSignal(mInitUninitSem);
+    }
+
+    setState(aNewState);
+}
+
+ObjectState::State ObjectState::autoUninitSpanConstructor()
+{
+    AutoWriteLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
+
+    Assert(mState != InInit);
+
+    if (mState == NotReady)
+    {
+        /* do nothing if already uninitialized */
+        return mState;
+    }
+    else if (mState == InUninit)
+    {
+        /* Another thread has already started uninitialization, wait for its
+         * completion. This is necessary to make sure that when this method
+         * returns, the object state is well-defined (NotReady). */
+
+        /* lazy semaphore creation */
+        if (mInitUninitSem == NIL_RTSEMEVENTMULTI)
+        {
+            RTSemEventMultiCreate(&mInitUninitSem);
+            Assert(mInitUninitWaiters == 0);
+        }
+        ++mInitUninitWaiters;
+
+        LogFlowFunc(("{%p}: Waiting for AutoUninitSpan to finish...\n", mObj));
+
+        stateLock.release();
+        RTSemEventMultiWait(mInitUninitSem, RT_INDEFINITE_WAIT);
+        stateLock.acquire();
+
+        if (--mInitUninitWaiters == 0)
+        {
+            /* destroy the semaphore since no more necessary */
+            RTSemEventMultiDestroy(mInitUninitSem);
+            mInitUninitSem = NIL_RTSEMEVENTMULTI;
+        }
+
+        /* the other thread set it to NotReady */
+        return mState;
+    }
+
+    /* go to InUninit to prevent from adding new callers */
+    setState(InUninit);
+
+    /* wait for already existing callers to drop to zero */
+    if (mCallers > 0)
+    {
+        /* lazy creation */
+        Assert(mZeroCallersSem == NIL_RTSEMEVENT);
+        RTSemEventCreate(&mZeroCallersSem);
+
+        /* wait until remaining callers release the object */
+        LogFlowFunc(("{%p}: Waiting for callers (%d) to drop to zero...\n",
+                     mObj, mCallers));
+
+        stateLock.release();
+        RTSemEventWait(mZeroCallersSem, RT_INDEFINITE_WAIT);
+    }
+    return mState;
+}
+
+void ObjectState::autoUninitSpanDestructor()
+{
+    AutoWriteLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
+
+    Assert(mState == InUninit);
+
+    setState(NotReady);
+}
+
+
+void ObjectState::setState(ObjectState::State aState)
+{
+    Assert(mState != aState);
+    mState = aState;
+    mStateChangeThread = RTThreadSelf();
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// AutoInitSpan methods
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Creates a smart initialization span object that places the object to
+ * InInit state.
+ *
+ * Please see the AutoInitSpan class description for more info.
+ *
+ * @param aObj      |this| pointer of the managed VirtualBoxBase object whose
+ *                  init() method is being called.
+ * @param aResult   Default initialization result.
+ */
+AutoInitSpan::AutoInitSpan(VirtualBoxBase *aObj,
+                           Result aResult /* = Failed */)
+    : mObj(aObj),
+      mResult(aResult),
+      mOk(false)
+{
+    Assert(mObj);
+    mOk = mObj->getObjectState().autoInitSpanConstructor(ObjectState::NotReady);
+    AssertReturnVoid(mOk);
+}
+
+/**
+ * Places the managed VirtualBoxBase object to Ready/Limited state if the
+ * initialization succeeded or partly succeeded, or places it to InitFailed
+ * state and calls the object's uninit() method.
+ *
+ * Please see the AutoInitSpan class description for more info.
+ */
+AutoInitSpan::~AutoInitSpan()
+{
+    /* if the state was other than NotReady, do nothing */
+    if (!mOk)
+        return;
+
+    ObjectState::State newState;
+    if (mResult == Succeeded)
+        newState = ObjectState::Ready;
+    else if (mResult == Limited)
+        newState = ObjectState::Limited;
+    else
+        newState = ObjectState::InitFailed;
+    mObj->getObjectState().autoInitSpanDestructor(newState);
+    if (newState == ObjectState::InitFailed)
+    {
+        /* call uninit() to let the object uninit itself after failed init() */
+        mObj->uninit();
+        /* Note: the object may no longer exist here (for example, it can call
+         * the destructor in uninit()) */
+    }
+}
+
+// AutoReinitSpan methods
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Creates a smart re-initialization span object and places the object to
+ * InInit state.
+ *
+ * Please see the AutoInitSpan class description for more info.
+ *
+ * @param aObj      |this| pointer of the managed VirtualBoxBase object whose
+ *                  re-initialization method is being called.
+ */
+AutoReinitSpan::AutoReinitSpan(VirtualBoxBase *aObj)
+    : mObj(aObj),
+      mSucceeded(false),
+      mOk(false)
+{
+    Assert(mObj);
+    mOk = mObj->getObjectState().autoInitSpanConstructor(ObjectState::Limited);
+    AssertReturnVoid(mOk);
+}
+
+/**
+ * Places the managed VirtualBoxBase object to Ready state if the
+ * re-initialization succeeded (i.e. #setSucceeded() has been called) or back to
+ * Limited state otherwise.
+ *
+ * Please see the AutoInitSpan class description for more info.
+ */
+AutoReinitSpan::~AutoReinitSpan()
+{
+    /* if the state was other than Limited, do nothing */
+    if (!mOk)
+        return;
+
+    ObjectState::State newState;
+    if (mSucceeded)
+        newState = ObjectState::Ready;
+    else
+        newState = ObjectState::Limited;
+    mObj->getObjectState().autoInitSpanDestructor(newState);
+    /** @todo r=klaus: this is like the initial init() failure, but in this
+     * place uninit() is NOT called. Makes only limited sense. */
+}
+
+// AutoUninitSpan methods
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Creates a smart uninitialization span object and places this object to
+ * InUninit state.
+ *
+ * Please see the AutoInitSpan class description for more info.
+ *
+ * @note This method blocks the current thread execution until the number of
+ *       callers of the managed VirtualBoxBase object drops to zero!
+ *
+ * @param aObj  |this| pointer of the VirtualBoxBase object whose uninit()
+ *              method is being called.
+ */
+AutoUninitSpan::AutoUninitSpan(VirtualBoxBase *aObj)
+    : mObj(aObj),
+      mInitFailed(false),
+      mUninitDone(false)
+{
+    Assert(mObj);
+    ObjectState::State state;
+    state = mObj->getObjectState().autoUninitSpanConstructor();
+    if (state == ObjectState::InitFailed)
+        mInitFailed = true;
+    else if (state == ObjectState::NotReady)
+        mUninitDone = true;
+}
+
+/**
+ *  Places the managed VirtualBoxBase object to the NotReady state.
+ */
+AutoUninitSpan::~AutoUninitSpan()
+{
+    /* do nothing if already uninitialized */
+    if (mUninitDone)
+        return;
+
+    mObj->getObjectState().autoUninitSpanDestructor();
+}
+
+/**
+ * Marks the uninitializion as succeeded.
+ *
+ * Same as the destructor, and makes the destructor do nothing.
+ */
+void AutoUninitSpan::setSucceeded()
+{
+    /* do nothing if already uninitialized */
+    if (mUninitDone)
+        return;
+
+    mObj->getObjectState().autoUninitSpanDestructor();
+    mUninitDone = true;
+}
diff --git a/src/VBox/Main/src-all/DisplayResampleImage.cpp b/src/VBox/Main/src-all/DisplayResampleImage.cpp
index d46bffa..b656fbb 100644
--- a/src/VBox/Main/src-all/DisplayResampleImage.cpp
+++ b/src/VBox/Main/src-all/DisplayResampleImage.cpp
@@ -1,3 +1,4 @@
+/* $Id: DisplayResampleImage.cpp $ */
 /** @file
  * Image resampling code, used for snapshot thumbnails.
  */
diff --git a/src/VBox/Main/src-all/DisplayUtils.cpp b/src/VBox/Main/src-all/DisplayUtils.cpp
index 078961a..76e972b 100644
--- a/src/VBox/Main/src-all/DisplayUtils.cpp
+++ b/src/VBox/Main/src-all/DisplayUtils.cpp
@@ -22,7 +22,8 @@
 #include <VBox/vmm/ssm.h>
 #include <VBox/VBoxVideo.h>
 
-int readSavedDisplayScreenshot(const Utf8Str &strStateFilePath, uint32_t u32Type, uint8_t **ppu8Data, uint32_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height)
+int readSavedDisplayScreenshot(const Utf8Str &strStateFilePath, uint32_t u32Type, uint8_t **ppu8Data, uint32_t *pcbData,
+                               uint32_t *pu32Width, uint32_t *pu32Height)
 {
     LogFlowFunc(("u32Type = %d [%s]\n", u32Type, strStateFilePath.c_str()));
 
diff --git a/src/VBox/Main/src-all/EventImpl.cpp b/src/VBox/Main/src-all/EventImpl.cpp
index 182f267..96e09e1 100644
--- a/src/VBox/Main/src-all/EventImpl.cpp
+++ b/src/VBox/Main/src-all/EventImpl.cpp
@@ -82,6 +82,8 @@ struct VBoxEvent::Data
     ComPtr<IEventSource>    mSource;
 };
 
+DEFINE_EMPTY_CTOR_DTOR(VBoxEvent)
+
 HRESULT VBoxEvent::FinalConstruct()
 {
     m = new Data;
@@ -94,9 +96,9 @@ void VBoxEvent::FinalRelease()
     {
         uninit();
         delete m;
-        m = 0;
-        BaseFinalRelease();
+        m = NULL;
     }
+    BaseFinalRelease();
 }
 
 HRESULT VBoxEvent::init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable)
@@ -135,6 +137,10 @@ HRESULT VBoxEvent::init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWait
 
 void VBoxEvent::uninit()
 {
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
+
     if (!m)
         return;
 
@@ -150,51 +156,28 @@ void VBoxEvent::uninit()
     }
 }
 
-STDMETHODIMP VBoxEvent::COMGETTER(Type)(VBoxEventType_T *aType)
+HRESULT VBoxEvent::getType(VBoxEventType_T *aType)
 {
-    CheckComArgNotNull(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     // never changes while event alive, no locking
     *aType = m->mType;
     return S_OK;
 }
 
-STDMETHODIMP VBoxEvent::COMGETTER(Source)(IEventSource **aSource)
+HRESULT VBoxEvent::getSource(ComPtr<IEventSource> &aSource)
 {
-    CheckComArgOutPointerValid(aSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
-    m->mSource.queryInterfaceTo(aSource);
+    m->mSource.queryInterfaceTo(aSource.asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP VBoxEvent::COMGETTER(Waitable)(BOOL *aWaitable)
+HRESULT VBoxEvent::getWaitable(BOOL *aWaitable)
 {
-    CheckComArgNotNull(aWaitable);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     // never changes while event alive, no locking
     *aWaitable = m->mWaitable;
     return S_OK;
 }
 
-
-STDMETHODIMP VBoxEvent::SetProcessed()
+HRESULT VBoxEvent::setProcessed()
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (m->mProcessed)
@@ -208,28 +191,20 @@ STDMETHODIMP VBoxEvent::SetProcessed()
     return S_OK;
 }
 
-STDMETHODIMP VBoxEvent::WaitProcessed(LONG aTimeout, BOOL *aResult)
+HRESULT VBoxEvent::waitProcessed(LONG aTimeout, BOOL *aResult)
 {
-    CheckComArgNotNull(aResult);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
+    if (m->mProcessed)
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-        if (m->mProcessed)
-        {
-            *aResult = TRUE;
-            return S_OK;
-        }
+        *aResult = TRUE;
+        return S_OK;
+    }
 
-        if (aTimeout == 0)
-        {
-            *aResult = m->mProcessed;
-            return S_OK;
-        }
+    if (aTimeout == 0)
+    {
+        *aResult = m->mProcessed;
+        return S_OK;
     }
 
     /* @todo: maybe while loop for spurious wakeups? */
@@ -251,21 +226,25 @@ STDMETHODIMP VBoxEvent::WaitProcessed(LONG aTimeout, BOOL *aResult)
     return S_OK;
 }
 
-typedef std::list<Bstr> VetoList;
+typedef std::list<Utf8Str> VetoList;
+typedef std::list<Utf8Str> ApprovalList;
 struct VBoxVetoEvent::Data
 {
     Data() :
         mVetoed(FALSE)
     {}
+    ComObjPtr<VBoxEvent>    mEvent;
     BOOL                    mVetoed;
     VetoList                mVetoList;
+    ApprovalList            mApprovalList;
 };
 
 HRESULT VBoxVetoEvent::FinalConstruct()
 {
-    VBoxEvent::FinalConstruct();
     m = new Data;
-    return S_OK;
+    HRESULT rc = m->mEvent.createObject();
+    BaseFinalConstruct();
+    return rc;
 }
 
 void VBoxVetoEvent::FinalRelease()
@@ -274,88 +253,129 @@ void VBoxVetoEvent::FinalRelease()
     {
         uninit();
         delete m;
-        m = 0;
+        m = NULL;
     }
-    VBoxEvent::FinalRelease();
+    BaseFinalRelease();
 }
 
+DEFINE_EMPTY_CTOR_DTOR(VBoxVetoEvent)
 
 HRESULT VBoxVetoEvent::init(IEventSource *aSource, VBoxEventType_T aType)
 {
     HRESULT rc = S_OK;
     // all veto events are waitable
-    rc = VBoxEvent::init(aSource, aType, TRUE);
+    rc = m->mEvent->init(aSource, aType, TRUE);
     if (FAILED(rc))
         return rc;
 
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+
     m->mVetoed = FALSE;
     m->mVetoList.clear();
+    m->mApprovalList.clear();
 
-    return rc;
+    /* Confirm a successful initialization */
+    autoInitSpan.setSucceeded();
+
+    return S_OK;
 }
 
 void VBoxVetoEvent::uninit()
 {
-    VBoxEvent::uninit();
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
+
     if (!m)
         return;
+
     m->mVetoed = FALSE;
+    if (!m->mEvent.isNull())
+    {
+        m->mEvent->uninit();
+        m->mEvent.setNull();
+    }
 }
 
-STDMETHODIMP VBoxVetoEvent::AddVeto(IN_BSTR aVeto)
+HRESULT VBoxVetoEvent::getType(VBoxEventType_T *aType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
+    return m->mEvent->COMGETTER(Type)(aType);
+}
 
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+HRESULT VBoxVetoEvent::getSource(ComPtr<IEventSource> &aSource)
+{
+    return m->mEvent->COMGETTER(Source)(aSource.asOutParam());
+}
 
-    if (aVeto)
-        m->mVetoList.push_back(aVeto);
+HRESULT VBoxVetoEvent::getWaitable(BOOL *aWaitable)
+{
+    return m->mEvent->COMGETTER(Waitable)(aWaitable);
+}
 
-    m->mVetoed = TRUE;
+HRESULT VBoxVetoEvent::setProcessed()
+{
+    return m->mEvent->SetProcessed();
+}
 
-    return S_OK;
+HRESULT VBoxVetoEvent::waitProcessed(LONG aTimeout, BOOL *aResult)
+{
+    return m->mEvent->WaitProcessed(aTimeout, aResult);
 }
 
-STDMETHODIMP VBoxVetoEvent::IsVetoed(BOOL *aResult)
+HRESULT VBoxVetoEvent::addVeto(const com::Utf8Str &aReason)
 {
-    CheckComArgOutPointerValid(aResult);
+    // AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    if (aReason.length())
+        m->mVetoList.push_back(aReason);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
+    m->mVetoed = TRUE;
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    return S_OK;
+}
 
+HRESULT VBoxVetoEvent::isVetoed(BOOL *aResult)
+{
+    // AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     *aResult = m->mVetoed;
 
     return S_OK;
 }
 
-STDMETHODIMP VBoxVetoEvent::GetVetos(ComSafeArrayOut(BSTR, aVetos))
+HRESULT VBoxVetoEvent::getVetos(std::vector<com::Utf8Str> &aResult)
 {
-    if (ComSafeArrayOutIsNull(aVetos))
-        return E_POINTER;
+    // AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    aResult.resize(m->mVetoList.size());
+    size_t i = 0;
+    for (VetoList::const_iterator it = m->mVetoList.begin(); it != m->mVetoList.end(); ++it, ++i)
+        aResult[i] = (*it);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
+    return S_OK;
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    com::SafeArray<BSTR> vetos(m->mVetoList.size());
-    int i = 0;
-    for (VetoList::const_iterator it = m->mVetoList.begin();
-         it != m->mVetoList.end();
-         ++it, ++i)
-    {
-        const Bstr &str = *it;
-        str.cloneTo(&vetos[i]);
-    }
-    vetos.detachTo(ComSafeArrayOutArg(aVetos));
+}
+
+HRESULT VBoxVetoEvent::addApproval(const com::Utf8Str &aReason)
+{
+    // AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    m->mApprovalList.push_back(aReason);
+    return S_OK;
+}
 
+HRESULT VBoxVetoEvent::isApproved(BOOL *aResult)
+{
+    // AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    *aResult = !m->mApprovalList.empty();
     return S_OK;
+}
 
+HRESULT VBoxVetoEvent::getApprovals(std::vector<com::Utf8Str> &aResult)
+{
+    // AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    aResult.resize(m->mApprovalList.size());
+    size_t i = 0;
+    for (ApprovalList::const_iterator it = m->mApprovalList.begin(); it != m->mApprovalList.end(); ++it, ++i)
+        aResult[i] = (*it);
+    return S_OK;
 }
 
 static const int FirstEvent = (int)VBoxEventType_LastWildcard + 1;
@@ -1005,91 +1025,69 @@ void EventSource::uninit()
     // m->mEvMap shall be cleared at this point too by destructors, assert?
 }
 
-STDMETHODIMP EventSource::RegisterListener(IEventListener *aListener,
-                                           ComSafeArrayIn(VBoxEventType_T, aInterested),
-                                           BOOL aActive)
+HRESULT EventSource::registerListener(const ComPtr<IEventListener> &aListener,
+                                      const std::vector<VBoxEventType_T> &aInteresting,
+                                      BOOL aActive)
 {
-    CheckComArgNotNull(aListener);
-    CheckComArgSafeArrayNotNull(aInterested);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
-    {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        if (m->fShutdown)
-            return setError(VBOX_E_INVALID_OBJECT_STATE,
-                            tr("This event source is already shut down"));
+    if (m->fShutdown)
+        return setError(VBOX_E_INVALID_OBJECT_STATE,
+                        tr("This event source is already shut down"));
 
-        Listeners::const_iterator it = m->mListeners.find(aListener);
-        if (it != m->mListeners.end())
-            return setError(E_INVALIDARG,
-                            tr("This listener already registered"));
+    Listeners::const_iterator it = m->mListeners.find(aListener);
+    if (it != m->mListeners.end())
+        return setError(E_INVALIDARG,
+                        tr("This listener already registered"));
 
-        com::SafeArray<VBoxEventType_T> interested(ComSafeArrayInArg(aInterested));
-        RecordHolder<ListenerRecord> lrh(new ListenerRecord(aListener, interested, aActive, this));
-        m->mListeners.insert(Listeners::value_type(aListener, lrh));
-    }
+    com::SafeArray<VBoxEventType_T> interested(aInteresting);
+    RecordHolder<ListenerRecord> lrh(new ListenerRecord(aListener, interested, aActive, this));
+    m->mListeners.insert(Listeners::value_type((IEventListener *)aListener, lrh));
 
     VBoxEventDesc evDesc;
-    evDesc.init(this, VBoxEventType_OnEventSourceChanged, aListener, TRUE);
+    evDesc.init(this, VBoxEventType_OnEventSourceChanged, (IEventListener *)aListener, TRUE);
     evDesc.fire(0);
 
     return S_OK;
 }
 
-STDMETHODIMP EventSource::UnregisterListener(IEventListener *aListener)
+HRESULT EventSource::unregisterListener(const ComPtr<IEventListener> &aListener)
 {
-    CheckComArgNotNull(aListener);
+    HRESULT rc = S_OK;;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
-    HRESULT rc;
-    {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        Listeners::iterator it = m->mListeners.find(aListener);
+    Listeners::iterator it = m->mListeners.find(aListener);
 
-        if (it != m->mListeners.end())
-        {
-            it->second.obj()->shutdown();
-            m->mListeners.erase(it);
-            // destructor removes refs from the event map
-            rc = S_OK;
-        }
-        else
-        {
-            rc = setError(VBOX_E_OBJECT_NOT_FOUND,
-                          tr("Listener was never registered"));
-        }
+    if (it != m->mListeners.end())
+    {
+        it->second.obj()->shutdown();
+        m->mListeners.erase(it);
+        // destructor removes refs from the event map
+        rc = S_OK;
+    }
+    else
+    {
+        rc = setError(VBOX_E_OBJECT_NOT_FOUND,
+                      tr("Listener was never registered"));
     }
 
     if (SUCCEEDED(rc))
     {
         VBoxEventDesc evDesc;
-        evDesc.init(this, VBoxEventType_OnEventSourceChanged, aListener, FALSE);
+        evDesc.init(this, VBoxEventType_OnEventSourceChanged, (IEventListener *)aListener, FALSE);
         evDesc.fire(0);
     }
 
     return rc;
 }
 
-STDMETHODIMP EventSource::FireEvent(IEvent *aEvent,
-                                    LONG aTimeout,
-                                    BOOL *aProcessed)
+HRESULT EventSource::fireEvent(const ComPtr<IEvent> &aEvent,
+                               LONG aTimeout,
+                               BOOL *aResult)
 {
-    CheckComArgNotNull(aEvent);
-    CheckComArgOutPointerValid(aProcessed);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
-    HRESULT hrc;
+    HRESULT hrc = S_OK;
     BOOL aWaitable = FALSE;
     aEvent->COMGETTER(Waitable)(&aWaitable);
 
@@ -1157,25 +1155,17 @@ STDMETHODIMP EventSource::FireEvent(IEvent *aEvent,
     /* We leave the lock here */
 
     if (aWaitable)
-        hrc = aEvent->WaitProcessed(aTimeout, aProcessed);
+        hrc = aEvent->WaitProcessed(aTimeout, aResult);
     else
-        *aProcessed = TRUE;
+        *aResult = TRUE;
 
     return hrc;
 }
 
-
-STDMETHODIMP EventSource::GetEvent(IEventListener *aListener,
-                                   LONG aTimeout,
-                                   IEvent **aEvent)
+HRESULT EventSource::getEvent(const ComPtr<IEventListener> &aListener,
+                              LONG aTimeout,
+                              ComPtr<IEvent> &aEvent)
 {
-
-    CheckComArgNotNull(aListener);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (m->fShutdown)
@@ -1183,10 +1173,10 @@ STDMETHODIMP EventSource::GetEvent(IEventListener *aListener,
                         tr("This event source is already shut down"));
 
     Listeners::iterator it = m->mListeners.find(aListener);
-    HRESULT rc;
+    HRESULT rc = S_OK;
 
     if (it != m->mListeners.end())
-        rc = it->second.obj()->dequeue(aEvent, aTimeout, alock);
+        rc = it->second.obj()->dequeue(aEvent.asOutParam(), aTimeout, alock);
     else
         rc = setError(VBOX_E_OBJECT_NOT_FOUND,
                       tr("Listener was never registered"));
@@ -1197,16 +1187,9 @@ STDMETHODIMP EventSource::GetEvent(IEventListener *aListener,
     return rc;
 }
 
-STDMETHODIMP EventSource::EventProcessed(IEventListener *aListener,
-                                         IEvent *aEvent)
+HRESULT EventSource::eventProcessed(const ComPtr<IEventListener> &aListener,
+                                    const ComPtr<IEvent> &aEvent)
 {
-    CheckComArgNotNull(aListener);
-    CheckComArgNotNull(aEvent);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (m->fShutdown)
@@ -1390,7 +1373,7 @@ public:
     }
 
     // internal public
-    HRESULT init(ComSafeArrayIn(IEventSource *, aSources));
+    HRESULT init(const std::vector<ComPtr<IEventSource> >  aSourcesIn);
 
     // IEventSource methods
     STDMETHOD(CreateListener)(IEventListener **aListener);
@@ -1422,59 +1405,40 @@ NS_DECL_CLASSINFO(ProxyEventListener)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ProxyEventListener, IEventListener)
 NS_DECL_CLASSINFO(PassiveEventListener)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(PassiveEventListener, IEventListener)
-NS_DECL_CLASSINFO(VBoxEvent)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VBoxEvent, IEvent)
-NS_DECL_CLASSINFO(VBoxVetoEvent)
-NS_IMPL_ISUPPORTS_INHERITED1(VBoxVetoEvent, VBoxEvent, IVetoEvent)
-NS_DECL_CLASSINFO(EventSource)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(EventSource, IEventSource)
 NS_DECL_CLASSINFO(EventSourceAggregator)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(EventSourceAggregator, IEventSource)
 #endif
 
 
-STDMETHODIMP EventSource::CreateListener(IEventListener **aListener)
+HRESULT EventSource::createListener(ComPtr<IEventListener> &aListener)
 {
-    CheckComArgOutPointerValid(aListener);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     ComObjPtr<PassiveEventListener> listener;
 
     HRESULT rc = listener.createObject();
     ComAssertMsgRet(SUCCEEDED(rc), ("Could not create wrapper object (%Rhrc)", rc),
                     E_FAIL);
-    listener.queryInterfaceTo(aListener);
+    listener.queryInterfaceTo(aListener.asOutParam());
     return S_OK;
 }
 
-
-STDMETHODIMP EventSource::CreateAggregator(ComSafeArrayIn(IEventSource *, aSubordinates),
-                                           IEventSource **aResult)
+HRESULT EventSource::createAggregator(const std::vector<ComPtr<IEventSource> > &aSubordinates,
+                                      ComPtr<IEventSource> &aResult)
 {
-    CheckComArgOutPointerValid(aResult);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     ComObjPtr<EventSourceAggregator> agg;
 
     HRESULT rc = agg.createObject();
     ComAssertMsgRet(SUCCEEDED(rc), ("Could not create aggregator (%Rhrc)", rc),
                     E_FAIL);
 
-    rc = agg->init(ComSafeArrayInArg(aSubordinates));
+    rc = agg->init(aSubordinates);
     if (FAILED(rc))
         return rc;
 
-    agg.queryInterfaceTo(aResult);
+    agg.queryInterfaceTo(aResult.asOutParam());
     return S_OK;
 }
 
-HRESULT EventSourceAggregator::init(ComSafeArrayIn(IEventSource *, aSourcesIn))
+HRESULT EventSourceAggregator::init(const std::vector<ComPtr<IEventSource> >  aSourcesIn)
 {
     HRESULT rc;
 
@@ -1488,14 +1452,10 @@ HRESULT EventSourceAggregator::init(ComSafeArrayIn(IEventSource *, aSourcesIn))
     ComAssertMsgRet(SUCCEEDED(rc), ("Could not init source (%Rhrc)", rc),
                     E_FAIL);
 
-    com::SafeIfaceArray<IEventSource> aSources(ComSafeArrayInArg (aSourcesIn));
-
-    size_t cSize = aSources.size();
-
-    for (size_t i = 0; i < cSize; i++)
+    for (size_t i = 0; i < aSourcesIn.size(); i++)
     {
-        if (aSources[i] != NULL)
-            mEventSources.push_back(aSources[i]);
+        if (aSourcesIn[i] != NULL)
+            mEventSources.push_back(aSourcesIn[i]);
     }
 
     /* Confirm a successful initialization */
diff --git a/src/VBox/Main/src-all/ExtPackManagerImpl.cpp b/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
index 4946d9b..a6f914d 100644
--- a/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
+++ b/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -233,7 +233,8 @@ HRESULT ExtPackFile::FinalConstruct()
  * @param   a_pExtPackMgr   Pointer to the extension pack manager.
  * @param   a_pVirtualBox   Pointer to the VirtualBox object.
  */
-HRESULT ExtPackFile::initWithFile(const char *a_pszFile, const char *a_pszDigest, ExtPackManager *a_pExtPackMgr, VirtualBox *a_pVirtualBox)
+HRESULT ExtPackFile::initWithFile(const char *a_pszFile, const char *a_pszDigest, ExtPackManager *a_pExtPackMgr,
+                                  VirtualBox *a_pVirtualBox)
 {
     AutoInitSpan autoInitSpan(this);
     AssertReturn(autoInitSpan.isOk(), E_FAIL);
@@ -315,6 +316,7 @@ HRESULT ExtPackFile::initWithFile(const char *a_pszFile, const char *a_pszDigest
         return initFailed(tr("Extension pack name mismatch between the downloaded file and the XML inside it (xml='%s' file='%s')"),
                           m->Desc.strName.c_str(), strSavedName.c_str());
 
+
     m->fUsable = true;
     m->strWhyUnusable.setNull();
     return S_OK;
@@ -365,351 +367,273 @@ void ExtPackFile::uninit()
     }
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(Name)(BSTR *a_pbstrName)
+HRESULT ExtPackFile::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(a_pbstrName);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strName);
-        str.cloneTo(a_pbstrName);
-    }
-    return hrc;
+    aName = m->Desc.strName;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(Description)(BSTR *a_pbstrDescription)
+HRESULT ExtPackFile::getDescription(com::Utf8Str &aDescription)
 {
-    CheckComArgOutPointerValid(a_pbstrDescription);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strDescription);
-        str.cloneTo(a_pbstrDescription);
-    }
-    return hrc;
+    aDescription = m->Desc.strDescription;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(Version)(BSTR *a_pbstrVersion)
+HRESULT ExtPackFile::getVersion(com::Utf8Str &aVersion)
 {
-    CheckComArgOutPointerValid(a_pbstrVersion);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strVersion);
-        str.cloneTo(a_pbstrVersion);
-    }
-    return hrc;
+    aVersion = m->Desc.strVersion;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(Edition)(BSTR *a_pbstrEdition)
+HRESULT ExtPackFile::getEdition(com::Utf8Str &aEdition)
 {
-    CheckComArgOutPointerValid(a_pbstrEdition);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strEdition);
-        str.cloneTo(a_pbstrEdition);
-    }
-    return hrc;
+    aEdition = m->Desc.strEdition;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(Revision)(ULONG *a_puRevision)
+HRESULT ExtPackFile::getRevision(ULONG *aRevision)
 {
-    CheckComArgOutPointerValid(a_puRevision);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        *a_puRevision = m->Desc.uRevision;
-    return hrc;
+    *aRevision = m->Desc.uRevision;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(VRDEModule)(BSTR *a_pbstrVrdeModule)
+HRESULT ExtPackFile::getVRDEModule(com::Utf8Str &aVRDEModule)
 {
-    CheckComArgOutPointerValid(a_pbstrVrdeModule);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strVrdeModule);
-        str.cloneTo(a_pbstrVrdeModule);
-    }
-    return hrc;
+    aVRDEModule = m->Desc.strVrdeModule;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(PlugIns)(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns))
+HRESULT ExtPackFile::getPlugIns(std::vector<ComPtr<IExtPackPlugIn> > &aPlugIns)
 {
     /** @todo implement plug-ins. */
 #ifdef VBOX_WITH_XPCOM
-    NOREF(a_paPlugIns);
-    NOREF(a_paPlugInsSize);
+    NOREF(aPlugIns);
 #endif
+    NOREF(aPlugIns);
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(Usable)(BOOL *a_pfUsable)
+HRESULT ExtPackFile::getUsable(BOOL *aUsable)
 {
-    CheckComArgOutPointerValid(a_pfUsable);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        *a_pfUsable = m->fUsable;
-    return hrc;
+    *aUsable = m->fUsable;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(WhyUnusable)(BSTR *a_pbstrWhy)
+HRESULT ExtPackFile::getWhyUnusable(com::Utf8Str &aWhyUnusable)
 {
-    CheckComArgOutPointerValid(a_pbstrWhy);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        m->strWhyUnusable.cloneTo(a_pbstrWhy);
-    return hrc;
+    aWhyUnusable = m->strWhyUnusable;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(ShowLicense)(BOOL *a_pfShowIt)
+HRESULT  ExtPackFile::getShowLicense(BOOL *aShowLicense)
 {
-    CheckComArgOutPointerValid(a_pfShowIt);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        *a_pfShowIt = m->Desc.fShowLicense;
-    return hrc;
+    *aShowLicense = m->Desc.fShowLicense;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(License)(BSTR *a_pbstrHtmlLicense)
+HRESULT ExtPackFile::getLicense(com::Utf8Str &aLicense)
 {
-    Bstr bstrHtml("html");
-    return QueryLicense(Bstr::Empty.raw(), Bstr::Empty.raw(), bstrHtml.raw(), a_pbstrHtmlLicense);
+    Utf8Str strHtml("html");
+    Utf8Str str("");
+    return queryLicense(str, str, strHtml, aLicense);
 }
 
 /* Same as ExtPack::QueryLicense, should really explore the subject of base classes here... */
-STDMETHODIMP ExtPackFile::QueryLicense(IN_BSTR a_bstrPreferredLocale, IN_BSTR a_bstrPreferredLanguage, IN_BSTR a_bstrFormat,
-                                       BSTR *a_pbstrLicense)
+HRESULT ExtPackFile::queryLicense(const com::Utf8Str &aPreferredLocale, const com::Utf8Str &aPreferredLanguage,
+                                  const com::Utf8Str &aFormat, com::Utf8Str &aLicenseText)
 {
+    HRESULT hrc = S_OK;
+
     /*
      * Validate input.
      */
-    CheckComArgOutPointerValid(a_pbstrLicense);
-    CheckComArgNotNull(a_bstrPreferredLocale);
-    CheckComArgNotNull(a_bstrPreferredLanguage);
-    CheckComArgNotNull(a_bstrFormat);
 
-    Utf8Str strPreferredLocale(a_bstrPreferredLocale);
-    if (strPreferredLocale.length() != 2 && strPreferredLocale.length() != 0)
+    if (aPreferredLocale.length() != 2 && aPreferredLocale.length() != 0)
         return setError(E_FAIL, tr("The preferred locale is a two character string or empty."));
 
-    Utf8Str strPreferredLanguage(a_bstrPreferredLanguage);
-    if (strPreferredLanguage.length() != 2 && strPreferredLanguage.length() != 0)
+    if (aPreferredLanguage.length() != 2 && aPreferredLanguage.length() != 0)
         return setError(E_FAIL, tr("The preferred lanuage is a two character string or empty."));
 
-    Utf8Str strFormat(a_bstrFormat);
-    if (   !strFormat.equals("html")
-        && !strFormat.equals("rtf")
-        && !strFormat.equals("txt"))
+    if (   !aFormat.equals("html")
+        && !aFormat.equals("rtf")
+        && !aFormat.equals("txt"))
         return setError(E_FAIL, tr("The license format can only have the values 'html', 'rtf' and 'txt'."));
 
     /*
      * Combine the options to form a file name before locking down anything.
      */
     char szName[sizeof(VBOX_EXTPACK_LICENSE_NAME_PREFIX "-de_DE.html") + 2];
-    if (strPreferredLocale.isNotEmpty() && strPreferredLanguage.isNotEmpty())
+    if (aPreferredLocale.isNotEmpty() && aPreferredLanguage.isNotEmpty())
         RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-%s_%s.%s",
-                    strPreferredLocale.c_str(), strPreferredLanguage.c_str(), strFormat.c_str());
-    else if (strPreferredLocale.isNotEmpty())
-        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-%s.%s",  strPreferredLocale.c_str(), strFormat.c_str());
-    else if (strPreferredLanguage.isNotEmpty())
-        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-_%s.%s", strPreferredLocale.c_str(), strFormat.c_str());
+                    aPreferredLocale.c_str(), aPreferredLanguage.c_str(), aFormat.c_str());
+    else if (aPreferredLocale.isNotEmpty())
+        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-%s.%s",
+                    aPreferredLocale.c_str(), aFormat.c_str());
+    else if (aPreferredLanguage.isNotEmpty())
+        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-_%s.%s",
+                    aPreferredLocale.c_str(), aFormat.c_str());
     else
-        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX ".%s",     strFormat.c_str());
-
+        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX ".%s",
+                    aFormat.c_str());
     /*
      * Lock the extension pack. We need a write lock here as there must not be
      * concurrent accesses to the tar file handle.
      */
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS);
 
+    /*
+     * Do not permit this query on a pack that isn't considered usable (could
+     * be marked so because of bad license files).
+     */
+    if (!m->fUsable)
+        hrc = setError(E_FAIL, tr("%s"), m->strWhyUnusable.c_str());
+    else
+    {
         /*
-         * Do not permit this query on a pack that isn't considered usable (could
-         * be marked so because of bad license files).
+         * Look it up in the manifest before scanning the tarball for it
          */
-        if (!m->fUsable)
-            hrc = setError(E_FAIL, tr("%s"), m->strWhyUnusable.c_str());
-        else
+        if (RTManifestEntryExists(m->hOurManifest, szName))
         {
-            /*
-             * Look it up in the manifest before scanning the tarball for it
-             */
-            if (RTManifestEntryExists(m->hOurManifest, szName))
+            RTVFSFSSTREAM   hTarFss;
+            char            szError[8192];
+            int vrc = VBoxExtPackOpenTarFss(m->hExtPackFile, szError, sizeof(szError), &hTarFss, NULL);
+            if (RT_SUCCESS(vrc))
             {
-                RTVFSFSSTREAM   hTarFss;
-                char            szError[8192];
-                int vrc = VBoxExtPackOpenTarFss(m->hExtPackFile, szError, sizeof(szError), &hTarFss, NULL);
-                if (RT_SUCCESS(vrc))
+                for (;;)
                 {
-                    for (;;)
+                    /* Get the first/next. */
+                    char           *pszName;
+                    RTVFSOBJ        hVfsObj;
+                    RTVFSOBJTYPE    enmType;
+                    vrc = RTVfsFsStrmNext(hTarFss, &pszName, &enmType, &hVfsObj);
+                    if (RT_FAILURE(vrc))
                     {
-                        /* Get the first/next. */
-                        char           *pszName;
-                        RTVFSOBJ        hVfsObj;
-                        RTVFSOBJTYPE    enmType;
-                        vrc = RTVfsFsStrmNext(hTarFss, &pszName, &enmType, &hVfsObj);
-                        if (RT_FAILURE(vrc))
-                        {
-                            if (vrc != VERR_EOF)
-                                hrc = setError(VBOX_E_IPRT_ERROR, tr("RTVfsFsStrmNext failed: %Rrc"), vrc);
-                            else
-                                hrc = setError(E_UNEXPECTED, tr("'%s' was found in the manifest but not in the tarball"), szName);
-                            break;
-                        }
+                        if (vrc != VERR_EOF)
+                            hrc = setError(VBOX_E_IPRT_ERROR, tr("RTVfsFsStrmNext failed: %Rrc"), vrc);
+                        else
+                            hrc = setError(E_UNEXPECTED, tr("'%s' was found in the manifest but not in the tarball"), szName);
+                        break;
+                    }
+
+                    /* Is this it? */
+                    const char *pszAdjName = pszName[0] == '.' && pszName[1] == '/' ? &pszName[2] : pszName;
+                    if (   !strcmp(pszAdjName, szName)
+                        && (   enmType == RTVFSOBJTYPE_IO_STREAM
+                            || enmType == RTVFSOBJTYPE_FILE))
+                    {
+                        RTVFSIOSTREAM hVfsIos = RTVfsObjToIoStream(hVfsObj);
+                        RTVfsObjRelease(hVfsObj);
+                        RTStrFree(pszName);
 
-                        /* Is this it? */
-                        const char *pszAdjName = pszName[0] == '.' && pszName[1] == '/' ? &pszName[2] : pszName;
-                        if (   !strcmp(pszAdjName, szName)
-                            && (   enmType == RTVFSOBJTYPE_IO_STREAM
-                                || enmType == RTVFSOBJTYPE_FILE))
+                        /* Load the file into memory. */
+                        RTFSOBJINFO ObjInfo;
+                        vrc = RTVfsIoStrmQueryInfo(hVfsIos, &ObjInfo, RTFSOBJATTRADD_NOTHING);
+                        if (RT_SUCCESS(vrc))
                         {
-                            RTVFSIOSTREAM hVfsIos = RTVfsObjToIoStream(hVfsObj);
-                            RTVfsObjRelease(hVfsObj);
-                            RTStrFree(pszName);
-
-                            /* Load the file into memory. */
-                            RTFSOBJINFO ObjInfo;
-                            vrc = RTVfsIoStrmQueryInfo(hVfsIos, &ObjInfo, RTFSOBJATTRADD_NOTHING);
-                            if (RT_SUCCESS(vrc))
+                            size_t cbFile = (size_t)ObjInfo.cbObject;
+                            void  *pvFile = RTMemAllocZ(cbFile + 1);
+                            if (pvFile)
                             {
-                                size_t cbFile = (size_t)ObjInfo.cbObject;
-                                void  *pvFile = RTMemAllocZ(cbFile + 1);
-                                if (pvFile)
+                                vrc = RTVfsIoStrmRead(hVfsIos, pvFile, cbFile, true /*fBlocking*/, NULL);
+                                if (RT_SUCCESS(vrc))
                                 {
-                                    vrc = RTVfsIoStrmRead(hVfsIos, pvFile, cbFile, true /*fBlocking*/, NULL);
-                                    if (RT_SUCCESS(vrc))
+                                    /* try translate it into a string we can return. */
+                                    Bstr bstrLicense((const char *)pvFile, cbFile);
+                                    if (bstrLicense.isNotEmpty())
                                     {
-                                        /* try translate it into a string we can return. */
-                                        Bstr bstrLicense((const char *)pvFile, cbFile);
-                                        if (bstrLicense.isNotEmpty())
-                                        {
-                                            bstrLicense.detachTo(a_pbstrLicense);
-                                            hrc = S_OK;
-                                        }
-                                        else
-                                            hrc = setError(VBOX_E_IPRT_ERROR,
-                                                           tr("The license file '%s' is empty or contains invalid UTF-8 encoding"),
-                                                           szName);
+                                        aLicenseText = Utf8Str(bstrLicense);
+                                        hrc = S_OK;
                                     }
                                     else
-                                        hrc = setError(VBOX_E_IPRT_ERROR, tr("Failed to read '%s': %Rrc"), szName, vrc);
-                                    RTMemFree(pvFile);
+                                        hrc = setError(VBOX_E_IPRT_ERROR,
+                                                       tr("The license file '%s' is empty or contains invalid UTF-8 encoding"),
+                                                       szName);
                                 }
                                 else
-                                    hrc = setError(E_OUTOFMEMORY, tr("Failed to allocate %zu bytes for '%s'"), cbFile, szName);
+                                    hrc = setError(VBOX_E_IPRT_ERROR, tr("Failed to read '%s': %Rrc"), szName, vrc);
+                                RTMemFree(pvFile);
                             }
                             else
-                                hrc = setError(VBOX_E_IPRT_ERROR, tr("RTVfsIoStrmQueryInfo on '%s': %Rrc"), szName, vrc);
-                            RTVfsIoStrmRelease(hVfsIos);
-                            break;
+                                hrc = setError(E_OUTOFMEMORY, tr("Failed to allocate %zu bytes for '%s'"), cbFile, szName);
                         }
-
-                        /* Release current. */
-                        RTVfsObjRelease(hVfsObj);
-                        RTStrFree(pszName);
+                        else
+                            hrc = setError(VBOX_E_IPRT_ERROR, tr("RTVfsIoStrmQueryInfo on '%s': %Rrc"), szName, vrc);
+                        RTVfsIoStrmRelease(hVfsIos);
+                            break;
                     }
-                    RTVfsFsStrmRelease(hTarFss);
+
+                    /* Release current. */
+                    RTVfsObjRelease(hVfsObj);
+                    RTStrFree(pszName);
                 }
-                else
-                    hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s"), szError);
+                RTVfsFsStrmRelease(hTarFss);
             }
             else
-                hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("The license file '%s' was not found in '%s'"),
-                               szName, m->strExtPackFile.c_str());
+                hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s"), szError);
         }
+            else
+            hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("The license file '%s' was not found in '%s'"),
+                               szName, m->strExtPackFile.c_str());
     }
     return hrc;
 }
 
-STDMETHODIMP ExtPackFile::COMGETTER(FilePath)(BSTR *a_pbstrPath)
+HRESULT ExtPackFile::getFilePath(com::Utf8Str &aFilePath)
 {
-    CheckComArgOutPointerValid(a_pbstrPath);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        m->strExtPackFile.cloneTo(a_pbstrPath);
-    return hrc;
+    aFilePath = m->strExtPackFile;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackFile::Install(BOOL a_fReplace, IN_BSTR a_bstrDisplayInfo, IProgress **a_ppProgress)
+HRESULT ExtPackFile::install(BOOL aReplace, const com::Utf8Str &aDisplayInfo, ComPtr<IProgress> &aProgress)
 {
-    if (a_ppProgress)
-        *a_ppProgress = NULL;
+    HRESULT hrc = S_OK;
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    if (m->fUsable)
     {
-        if (m->fUsable)
+        PEXTPACKINSTALLJOB pJob = NULL;
+        try
         {
-            PEXTPACKINSTALLJOB pJob = NULL;
-            try
+            pJob = new EXTPACKINSTALLJOB;
+            pJob->ptrExtPackFile    = this;
+            pJob->fReplace          = aReplace != FALSE;
+            pJob->strDisplayInfo    = aDisplayInfo;
+            pJob->ptrExtPackMgr     = m->ptrExtPackMgr;
+            hrc = pJob->ptrProgress.createObject();
+            if (SUCCEEDED(hrc))
             {
-                pJob = new EXTPACKINSTALLJOB;
-                pJob->ptrExtPackFile    = this;
-                pJob->fReplace          = a_fReplace != FALSE;
-                pJob->strDisplayInfo    = a_bstrDisplayInfo;
-                pJob->ptrExtPackMgr     = m->ptrExtPackMgr;
-                hrc = pJob->ptrProgress.createObject();
-                if (SUCCEEDED(hrc))
-                {
-                    Bstr bstrDescription = tr("Installing extension pack");
-                    hrc = pJob->ptrProgress->init(
+                Bstr bstrDescription = tr("Installing extension pack");
+                hrc = pJob->ptrProgress->init(
 #ifndef VBOX_COM_INPROC
-                                                  m->pVirtualBox,
+                                              m->pVirtualBox,
 #endif
-                                                  static_cast<IExtPackFile *>(this),
-                                                  bstrDescription.raw(),
-                                                  FALSE /*aCancelable*/,
-                                                  NULL /*aId*/);
-                }
-                if (SUCCEEDED(hrc))
-                {
-                    ComPtr<Progress> ptrProgress = pJob->ptrProgress;
-                    int vrc = RTThreadCreate(NULL /*phThread*/, ExtPackManager::doInstallThreadProc, pJob, 0,
-                                             RTTHREADTYPE_DEFAULT, 0 /*fFlags*/, "ExtPackInst");
-                    if (RT_SUCCESS(vrc))
-                    {
-                        pJob = NULL; /* the thread deletes it */
-                        ptrProgress.queryInterfaceTo(a_ppProgress);
-                    }
-                    else
-                        hrc = setError(VBOX_E_IPRT_ERROR, tr("RTThreadCreate failed with %Rrc"), vrc);
-                }
+                                              static_cast<IExtPackFile *>(this),
+                                              bstrDescription.raw(),
+                                              FALSE /*aCancelable*/);
             }
-            catch (std::bad_alloc)
+            if (SUCCEEDED(hrc))
             {
-                hrc = E_OUTOFMEMORY;
+                ComPtr<Progress> ptrProgress = pJob->ptrProgress;
+                int vrc = RTThreadCreate(NULL /*phThread*/, ExtPackManager::i_doInstallThreadProc, pJob, 0,
+                                         RTTHREADTYPE_DEFAULT, 0 /*fFlags*/, "ExtPackInst");
+                if (RT_SUCCESS(vrc))
+                {
+                    pJob = NULL; /* the thread deletes it */
+                    ptrProgress.queryInterfaceTo(aProgress.asOutParam());
+                }
+                else
+                    hrc = setError(VBOX_E_IPRT_ERROR, tr("RTThreadCreate failed with %Rrc"), vrc);
             }
-            if (pJob)
-                delete pJob;
         }
-        else
-            hrc = setError(E_FAIL, "%s", m->strWhyUnusable.c_str());
+        catch (std::bad_alloc)
+        {
+            hrc = E_OUTOFMEMORY;
+        }
+        if (pJob)
+            delete pJob;
     }
+    else
+        hrc = setError(E_FAIL, "%s", m->strWhyUnusable.c_str());
     return hrc;
 }
 
@@ -755,18 +679,18 @@ HRESULT ExtPack::initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName,
         /* uVBoxVersionRevision = */ 0,
         /* u32Padding           = */ 0,
         /* pszVBoxVersion       = */ "",
-        /* pfnFindModule        = */ ExtPack::hlpFindModule,
-        /* pfnGetFilePath       = */ ExtPack::hlpGetFilePath,
-        /* pfnGetContext        = */ ExtPack::hlpGetContext,
-        /* pfnLoadHGCMService   = */ ExtPack::hlpLoadHGCMService,
-        /* pfnLoadVDPlugin      = */ ExtPack::hlpLoadVDPlugin,
-        /* pfnUnloadVDPlugin    = */ ExtPack::hlpUnloadVDPlugin,
-        /* pfnReserved1         = */ ExtPack::hlpReservedN,
-        /* pfnReserved2         = */ ExtPack::hlpReservedN,
-        /* pfnReserved3         = */ ExtPack::hlpReservedN,
-        /* pfnReserved4         = */ ExtPack::hlpReservedN,
-        /* pfnReserved5         = */ ExtPack::hlpReservedN,
-        /* pfnReserved6         = */ ExtPack::hlpReservedN,
+        /* pfnFindModule        = */ ExtPack::i_hlpFindModule,
+        /* pfnGetFilePath       = */ ExtPack::i_hlpGetFilePath,
+        /* pfnGetContext        = */ ExtPack::i_hlpGetContext,
+        /* pfnLoadHGCMService   = */ ExtPack::i_hlpLoadHGCMService,
+        /* pfnLoadVDPlugin      = */ ExtPack::i_hlpLoadVDPlugin,
+        /* pfnUnloadVDPlugin    = */ ExtPack::i_hlpUnloadVDPlugin,
+        /* pfnReserved1         = */ ExtPack::i_hlpReservedN,
+        /* pfnReserved2         = */ ExtPack::i_hlpReservedN,
+        /* pfnReserved3         = */ ExtPack::i_hlpReservedN,
+        /* pfnReserved4         = */ ExtPack::i_hlpReservedN,
+        /* pfnReserved5         = */ ExtPack::i_hlpReservedN,
+        /* pfnReserved6         = */ ExtPack::i_hlpReservedN,
         /* u32EndMarker         = */ VBOXEXTPACKHLP_VERSION
     };
 
@@ -802,7 +726,7 @@ HRESULT ExtPack::initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName,
     /*
      * Probe the extension pack (this code is shared with refresh()).
      */
-    probeAndLoad();
+    i_probeAndLoad();
 
     autoInitSpan.setSucceeded();
     return S_OK;
@@ -852,7 +776,7 @@ void ExtPack::uninit()
  * @param   a_pLock             The write lock held by the caller.
  * @param   pErrInfo            Where to return error information.
  */
-bool    ExtPack::callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo)
+bool    ExtPack::i_callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock, PRTERRINFO pErrInfo)
 {
     if (   m != NULL
         && m->hMainMod != NIL_RTLDRMOD)
@@ -879,7 +803,7 @@ bool    ExtPack::callInstalledHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_
  *                              uninstall hook.
  * @remarks The caller holds the manager's write lock, not released.
  */
-HRESULT ExtPack::callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval)
+HRESULT ExtPack::i_callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fForcedRemoval)
 {
     HRESULT hrc = S_OK;
 
@@ -914,7 +838,7 @@ HRESULT ExtPack::callUninstallHookAndClose(IVirtualBox *a_pVirtualBox, bool a_fF
  * @param   a_pVirtualBox       The VirtualBox interface.
  * @param   a_pLock             The write lock held by the caller.
  */
-bool ExtPack::callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock)
+bool ExtPack::i_callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock *a_pLock)
 {
     if (    m != NULL
         &&  m->fUsable
@@ -940,7 +864,7 @@ bool ExtPack::callVirtualBoxReadyHook(IVirtualBox *a_pVirtualBox, AutoWriteLock
  * @param   a_pConsole          The Console interface.
  * @param   a_pLock             The write lock held by the caller.
  */
-bool ExtPack::callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock)
+bool ExtPack::i_callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock)
 {
     if (    m != NULL
         &&  m->fUsable
@@ -967,7 +891,7 @@ bool ExtPack::callConsoleReadyHook(IConsole *a_pConsole, AutoWriteLock *a_pLock)
  * @param   a_pMachine          The machine interface of the new VM.
  * @param   a_pLock             The write lock held by the caller.
  */
-bool ExtPack::callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock)
+bool ExtPack::i_callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine, AutoWriteLock *a_pLock)
 {
     if (   m != NULL
         && m->fUsable)
@@ -995,7 +919,7 @@ bool ExtPack::callVmCreatedHook(IVirtualBox *a_pVirtualBox, IMachine *a_pMachine
  *                              callback.  This is always set.  LogRel is
  *                              called on if a failure status is returned.
  */
-bool ExtPack::callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc)
+bool ExtPack::i_callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc)
 {
     *a_pvrc = VINF_SUCCESS;
     if (   m != NULL
@@ -1027,7 +951,7 @@ bool ExtPack::callVmConfigureVmmHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteL
  *                              callback.  This is always set.  LogRel is
  *                              called on if a failure status is returned.
  */
-bool ExtPack::callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc)
+bool ExtPack::i_callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock, int *a_pvrc)
 {
     *a_pvrc = VINF_SUCCESS;
     if (   m != NULL
@@ -1056,7 +980,7 @@ bool ExtPack::callVmPowerOnHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *
  * @param   a_pVM               The VM handle.
  * @param   a_pLock             The write lock held by the caller.
  */
-bool ExtPack::callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock)
+bool ExtPack::i_callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock *a_pLock)
 {
     if (   m != NULL
         && m->fUsable)
@@ -1081,7 +1005,7 @@ bool ExtPack::callVmPowerOffHook(IConsole *a_pConsole, PVM a_pVM, AutoWriteLock
  * @remarks Caller holds the extension manager lock for reading, no locking
  *          necessary.
  */
-HRESULT ExtPack::checkVrde(void)
+HRESULT ExtPack::i_checkVrde(void)
 {
     HRESULT hrc;
     if (   m != NULL
@@ -1106,13 +1030,13 @@ HRESULT ExtPack::checkVrde(void)
  * @remarks Caller holds the extension manager lock for reading, no locking
  *          necessary.
  */
-HRESULT ExtPack::getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary)
+HRESULT ExtPack::i_getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary)
 {
-    HRESULT hrc = checkVrde();
+    HRESULT hrc = i_checkVrde();
     if (SUCCEEDED(hrc))
     {
-        if (findModule(m->Desc.strVrdeModule.c_str(), NULL, VBOXEXTPACKMODKIND_R3,
-                       a_pstrVrdeLibrary, NULL /*a_pfNative*/, NULL /*a_pObjInfo*/))
+        if (i_findModule(m->Desc.strVrdeModule.c_str(), NULL, VBOXEXTPACKMODKIND_R3,
+                         a_pstrVrdeLibrary, NULL /*a_pfNative*/, NULL /*a_pObjInfo*/))
             hrc = S_OK;
         else
             hrc = setError(E_FAIL, tr("Failed to locate the VRDE module '%s' in extension pack '%s'"),
@@ -1131,11 +1055,11 @@ HRESULT ExtPack::getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary)
  * @remarks Caller holds the extension manager lock for reading, no locking
  *          necessary.
  */
-HRESULT ExtPack::getLibraryName(const char *a_pszModuleName, Utf8Str *a_pstrLibrary)
+HRESULT ExtPack::i_getLibraryName(const char *a_pszModuleName, Utf8Str *a_pstrLibrary)
 {
     HRESULT hrc;
-    if (findModule(a_pszModuleName, NULL, VBOXEXTPACKMODKIND_R3,
-                   a_pstrLibrary, NULL /*a_pfNative*/, NULL /*a_pObjInfo*/))
+    if (i_findModule(a_pszModuleName, NULL, VBOXEXTPACKMODKIND_R3,
+                     a_pstrLibrary, NULL /*a_pfNative*/, NULL /*a_pObjInfo*/))
         hrc = S_OK;
     else
         hrc = setError(E_FAIL, tr("Failed to locate the module '%s' in extension pack '%s'"),
@@ -1152,7 +1076,7 @@ HRESULT ExtPack::getLibraryName(const char *a_pszModuleName, Utf8Str *a_pstrLibr
  * @remarks Caller holds the extension manager lock for reading, no locking
  *          necessary.
  */
-bool ExtPack::wantsToBeDefaultVrde(void) const
+bool ExtPack::i_wantsToBeDefaultVrde(void) const
 {
     return m->fUsable
         && m->Desc.strVrdeModule.isNotEmpty();
@@ -1170,7 +1094,7 @@ bool ExtPack::wantsToBeDefaultVrde(void) const
  * @remarks Caller holds the extension manager lock for writing.
  * @remarks Only called in VBoxSVC.
  */
-HRESULT ExtPack::refresh(bool *a_pfCanDelete)
+HRESULT ExtPack::i_refresh(bool *a_pfCanDelete)
 {
     if (a_pfCanDelete)
         *a_pfCanDelete = false;
@@ -1215,10 +1139,10 @@ HRESULT ExtPack::refresh(bool *a_pfCanDelete)
     if (m->fUsable)
     {
         if (m->hMainMod == NIL_RTLDRMOD)
-            probeAndLoad();
-        else if (   !objinfoIsEqual(&ObjInfoDesc,    &m->ObjInfoDesc)
-                 || !objinfoIsEqual(&ObjInfoMainMod, &m->ObjInfoMainMod)
-                 || !objinfoIsEqual(&ObjInfoExtPack, &m->ObjInfoExtPack) )
+            i_probeAndLoad();
+        else if (   !i_objinfoIsEqual(&ObjInfoDesc,    &m->ObjInfoDesc)
+                 || !i_objinfoIsEqual(&ObjInfoMainMod, &m->ObjInfoMainMod)
+                 || !i_objinfoIsEqual(&ObjInfoExtPack, &m->ObjInfoExtPack) )
         {
             /** @todo not important, so it can wait. */
         }
@@ -1227,10 +1151,10 @@ HRESULT ExtPack::refresh(bool *a_pfCanDelete)
      * Ok, it is currently not usable.  If anything has changed since last time
      * reprobe the extension pack.
      */
-    else if (   !objinfoIsEqual(&ObjInfoDesc,    &m->ObjInfoDesc)
-             || !objinfoIsEqual(&ObjInfoMainMod, &m->ObjInfoMainMod)
-             || !objinfoIsEqual(&ObjInfoExtPack, &m->ObjInfoExtPack) )
-        probeAndLoad();
+    else if (   !i_objinfoIsEqual(&ObjInfoDesc,    &m->ObjInfoDesc)
+             || !i_objinfoIsEqual(&ObjInfoMainMod, &m->ObjInfoMainMod)
+             || !i_objinfoIsEqual(&ObjInfoExtPack, &m->ObjInfoExtPack) )
+        i_probeAndLoad();
 
     return S_OK;
 }
@@ -1242,7 +1166,7 @@ HRESULT ExtPack::refresh(bool *a_pfCanDelete)
  * This updates the state accordingly, the strWhyUnusable and fUnusable members
  * being the most important ones.
  */
-void ExtPack::probeAndLoad(void)
+void ExtPack::i_probeAndLoad(void)
 {
     m->fUsable = false;
     m->fMadeReadyCall = false;
@@ -1260,11 +1184,14 @@ void ExtPack::probeAndLoad(void)
     if (!RTFS_IS_DIRECTORY(m->ObjInfoExtPack.Attr.fMode))
     {
         if (RTFS_IS_SYMLINK(m->ObjInfoExtPack.Attr.fMode))
-            m->strWhyUnusable.printf(tr("'%s' is a symbolic link, this is not allowed"), m->strExtPackPath.c_str(), vrc);
+            m->strWhyUnusable.printf(tr("'%s' is a symbolic link, this is not allowed"),
+                                     m->strExtPackPath.c_str(), vrc);
         else if (RTFS_IS_FILE(m->ObjInfoExtPack.Attr.fMode))
-            m->strWhyUnusable.printf(tr("'%s' is a symbolic file, not a directory"), m->strExtPackPath.c_str(), vrc);
+            m->strWhyUnusable.printf(tr("'%s' is a symbolic file, not a directory"),
+                                     m->strExtPackPath.c_str(), vrc);
         else
-            m->strWhyUnusable.printf(tr("'%s' is not a directory (fMode=%#x)"), m->strExtPackPath.c_str(), m->ObjInfoExtPack.Attr.fMode);
+            m->strWhyUnusable.printf(tr("'%s' is not a directory (fMode=%#x)"),
+                                     m->strExtPackPath.c_str(), m->ObjInfoExtPack.Attr.fMode);
         return;
     }
 
@@ -1306,8 +1233,8 @@ void ExtPack::probeAndLoad(void)
      * Load the main DLL and call the predefined entry point.
      */
     bool fIsNative;
-    if (!findModule(m->Desc.strMainModule.c_str(), NULL /* default extension */, VBOXEXTPACKMODKIND_R3,
-                    &m->strMainModPath, &fIsNative, &m->ObjInfoMainMod))
+    if (!i_findModule(m->Desc.strMainModule.c_str(), NULL /* default extension */, VBOXEXTPACKMODKIND_R3,
+                      &m->strMainModPath, &fIsNative, &m->ObjInfoMainMod))
     {
         m->strWhyUnusable.printf(tr("Failed to locate the main module ('%s')"), m->Desc.strMainModule.c_str());
         return;
@@ -1407,8 +1334,8 @@ void ExtPack::probeAndLoad(void)
  * @param   a_pObjInfo          Where to return the file system object info for
  *                              the module. Optional.
  */
-bool ExtPack::findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
-                         Utf8Str *a_pStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const
+bool ExtPack::i_findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPACKMODKIND a_enmKind,
+                           Utf8Str *a_pStrFound, bool *a_pfNative, PRTFSOBJINFO a_pObjInfo) const
 {
     /*
      * Try the native path first.
@@ -1499,7 +1426,7 @@ bool ExtPack::findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPAC
  * @param   pObjInfo2           The second.
  * @todo    IPRT should do this, really.
  */
-/* static */ bool ExtPack::objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2)
+/* static */ bool ExtPack::i_objinfoIsEqual(PCRTFSOBJINFO pObjInfo1, PCRTFSOBJINFO pObjInfo2)
 {
     if (!RTTimeSpecIsEqual(&pObjInfo1->ModificationTime,   &pObjInfo2->ModificationTime))
         return false;
@@ -1539,8 +1466,8 @@ bool ExtPack::findModule(const char *a_pszName, const char *a_pszExt, VBOXEXTPAC
  * @interface_method_impl{VBOXEXTPACKHLP,pfnFindModule}
  */
 /*static*/ DECLCALLBACK(int)
-ExtPack::hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt, VBOXEXTPACKMODKIND enmKind,
-                       char *pszFound, size_t cbFound, bool *pfNative)
+ExtPack::i_hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *pszExt, VBOXEXTPACKMODKIND enmKind,
+                         char *pszFound, size_t cbFound, bool *pfNative)
 {
     /*
      * Validate the input and get our bearings.
@@ -1562,13 +1489,13 @@ ExtPack::hlpFindModule(PCVBOXEXTPACKHLP pHlp, const char *pszName, const char *p
      * This is just a wrapper around findModule.
      */
     Utf8Str strFound;
-    if (pThis->findModule(pszName, pszExt, enmKind, &strFound, pfNative, NULL))
+    if (pThis->i_findModule(pszName, pszExt, enmKind, &strFound, pfNative, NULL))
         return RTStrCopy(pszFound, cbFound, strFound.c_str());
     return VERR_FILE_NOT_FOUND;
 }
 
 /*static*/ DECLCALLBACK(int)
-ExtPack::hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath)
+ExtPack::i_hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *pszPath, size_t cbPath)
 {
     /*
      * Validate the input and get our bearings.
@@ -1594,7 +1521,7 @@ ExtPack::hlpGetFilePath(PCVBOXEXTPACKHLP pHlp, const char *pszFilename, char *ps
 }
 
 /*static*/ DECLCALLBACK(VBOXEXTPACKCTX)
-ExtPack::hlpGetContext(PCVBOXEXTPACKHLP pHlp)
+ExtPack::i_hlpGetContext(PCVBOXEXTPACKHLP pHlp)
 {
     /*
      * Validate the input and get our bearings.
@@ -1610,8 +1537,8 @@ ExtPack::hlpGetContext(PCVBOXEXTPACKHLP pHlp)
 }
 
 /*static*/ DECLCALLBACK(int)
-ExtPack::hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole,
-                            const char *pszServiceLibrary, const char *pszServiceName)
+ExtPack::i_hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole,
+                              const char *pszServiceLibrary, const char *pszServiceName)
 {
 #ifdef VBOX_COM_INPROC
     /*
@@ -1629,7 +1556,7 @@ ExtPack::hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *
     AssertPtrReturn(pConsole, VERR_INVALID_POINTER);
 
     Console *pCon = (Console *)pConsole;
-    return pCon->hgcmLoadService(pszServiceLibrary, pszServiceName);
+    return pCon->i_hgcmLoadService(pszServiceLibrary, pszServiceName);
 #else
     NOREF(pHlp); NOREF(pConsole); NOREF(pszServiceLibrary); NOREF(pszServiceName);
 #endif
@@ -1637,7 +1564,7 @@ ExtPack::hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *
 }
 
 /*static*/ DECLCALLBACK(int)
-ExtPack::hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary)
+ExtPack::i_hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary)
 {
 #ifndef VBOX_COM_INPROC
     /*
@@ -1654,7 +1581,7 @@ ExtPack::hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *
     AssertPtrReturn(pVirtualBox, VERR_INVALID_POINTER);
 
     VirtualBox *pVBox = (VirtualBox *)pVirtualBox;
-    return pVBox->loadVDPlugin(pszPluginLibrary);
+    return pVBox->i_loadVDPlugin(pszPluginLibrary);
 #else
     NOREF(pHlp); NOREF(pVirtualBox);
 #endif
@@ -1662,7 +1589,7 @@ ExtPack::hlpLoadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *
 }
 
 /*static*/ DECLCALLBACK(int)
-ExtPack::hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary)
+ExtPack::i_hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox) *pVirtualBox, const char *pszPluginLibrary)
 {
 #ifndef VBOX_COM_INPROC
     /*
@@ -1679,7 +1606,7 @@ ExtPack::hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox)
     AssertPtrReturn(pVirtualBox, VERR_INVALID_POINTER);
 
     VirtualBox *pVBox = (VirtualBox *)pVirtualBox;
-    return pVBox->unloadVDPlugin(pszPluginLibrary);
+    return pVBox->i_unloadVDPlugin(pszPluginLibrary);
 #else
     NOREF(pHlp); NOREF(pVirtualBox);
 #endif
@@ -1687,7 +1614,7 @@ ExtPack::hlpUnloadVDPlugin(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IVirtualBox)
 }
 
 /*static*/ DECLCALLBACK(int)
-ExtPack::hlpReservedN(PCVBOXEXTPACKHLP pHlp)
+ExtPack::i_hlpReservedN(PCVBOXEXTPACKHLP pHlp)
 {
     /*
      * Validate the input and get our bearings.
@@ -1705,251 +1632,175 @@ ExtPack::hlpReservedN(PCVBOXEXTPACKHLP pHlp)
 
 
 
-
-STDMETHODIMP ExtPack::COMGETTER(Name)(BSTR *a_pbstrName)
+HRESULT ExtPack::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(a_pbstrName);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strName);
-        str.cloneTo(a_pbstrName);
-    }
-    return hrc;
+    aName = m->Desc.strName;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(Description)(BSTR *a_pbstrDescription)
+HRESULT ExtPack::getDescription(com::Utf8Str &aDescription)
 {
-    CheckComArgOutPointerValid(a_pbstrDescription);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strDescription);
-        str.cloneTo(a_pbstrDescription);
-    }
-    return hrc;
+    aDescription = m->Desc.strDescription;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(Version)(BSTR *a_pbstrVersion)
+HRESULT ExtPack::getVersion(com::Utf8Str &aVersion)
 {
-    CheckComArgOutPointerValid(a_pbstrVersion);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strVersion);
-        str.cloneTo(a_pbstrVersion);
-    }
-    return hrc;
+    aVersion = m->Desc.strVersion;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(Revision)(ULONG *a_puRevision)
+HRESULT ExtPack::getRevision(ULONG *aRevision)
 {
-    CheckComArgOutPointerValid(a_puRevision);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        *a_puRevision = m->Desc.uRevision;
-    return hrc;
+    *aRevision = m->Desc.uRevision;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(Edition)(BSTR *a_pbstrEdition)
+HRESULT ExtPack::getEdition(com::Utf8Str &aEdition)
 {
-    CheckComArgOutPointerValid(a_pbstrEdition);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strEdition);
-        str.cloneTo(a_pbstrEdition);
-    }
-    return hrc;
+    aEdition = m->Desc.strEdition;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(VRDEModule)(BSTR *a_pbstrVrdeModule)
+HRESULT ExtPack::getVRDEModule(com::Utf8Str &aVRDEModule)
 {
-    CheckComArgOutPointerValid(a_pbstrVrdeModule);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        Bstr str(m->Desc.strVrdeModule);
-        str.cloneTo(a_pbstrVrdeModule);
-    }
-    return hrc;
+    aVRDEModule = m->Desc.strVrdeModule;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(PlugIns)(ComSafeArrayOut(IExtPackPlugIn *, a_paPlugIns))
+HRESULT ExtPack::getPlugIns(std::vector<ComPtr<IExtPackPlugIn> > &aPlugIns)
 {
     /** @todo implement plug-ins. */
 #ifdef VBOX_WITH_XPCOM
-    NOREF(a_paPlugIns);
-    NOREF(a_paPlugInsSize);
+    NOREF(aPlugIns);
 #endif
+    NOREF(aPlugIns);
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP ExtPack::COMGETTER(Usable)(BOOL *a_pfUsable)
+HRESULT ExtPack::getUsable(BOOL *aUsable)
 {
-    CheckComArgOutPointerValid(a_pfUsable);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        *a_pfUsable = m->fUsable;
-    return hrc;
+    *aUsable = m->fUsable;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(WhyUnusable)(BSTR *a_pbstrWhy)
+HRESULT ExtPack::getWhyUnusable(com::Utf8Str &aWhyUnusable)
 {
-    CheckComArgOutPointerValid(a_pbstrWhy);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        m->strWhyUnusable.cloneTo(a_pbstrWhy);
-    return hrc;
+    aWhyUnusable = m->strWhyUnusable;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(ShowLicense)(BOOL *a_pfShowIt)
+HRESULT ExtPack::getShowLicense(BOOL *aShowLicense)
 {
-    CheckComArgOutPointerValid(a_pfShowIt);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        *a_pfShowIt = m->Desc.fShowLicense;
-    return hrc;
+    *aShowLicense = m->Desc.fShowLicense;
+    return S_OK;
 }
 
-STDMETHODIMP ExtPack::COMGETTER(License)(BSTR *a_pbstrHtmlLicense)
+HRESULT ExtPack::getLicense(com::Utf8Str &aLicense)
 {
-    Bstr bstrHtml("html");
-    return QueryLicense(Bstr::Empty.raw(), Bstr::Empty.raw(), bstrHtml.raw(), a_pbstrHtmlLicense);
+    Utf8Str strHtml("html");
+    Utf8Str str("");
+    return queryLicense(str, str, strHtml, aLicense);
 }
 
-STDMETHODIMP ExtPack::QueryLicense(IN_BSTR a_bstrPreferredLocale, IN_BSTR a_bstrPreferredLanguage, IN_BSTR a_bstrFormat,
-                                   BSTR *a_pbstrLicense)
+HRESULT ExtPack::queryLicense(const com::Utf8Str &aPreferredLocale, const com::Utf8Str &aPreferredLanguage,
+                              const com::Utf8Str &aFormat, com::Utf8Str &aLicenseText)
 {
+    HRESULT hrc = S_OK;
+
     /*
      * Validate input.
      */
-    CheckComArgOutPointerValid(a_pbstrLicense);
-    CheckComArgNotNull(a_bstrPreferredLocale);
-    CheckComArgNotNull(a_bstrPreferredLanguage);
-    CheckComArgNotNull(a_bstrFormat);
-
-    Utf8Str strPreferredLocale(a_bstrPreferredLocale);
-    if (strPreferredLocale.length() != 2 && strPreferredLocale.length() != 0)
+    if (aPreferredLocale.length() != 2 && aPreferredLocale.length() != 0)
         return setError(E_FAIL, tr("The preferred locale is a two character string or empty."));
 
-    Utf8Str strPreferredLanguage(a_bstrPreferredLanguage);
-    if (strPreferredLanguage.length() != 2 && strPreferredLanguage.length() != 0)
+    if (aPreferredLanguage.length() != 2 && aPreferredLanguage.length() != 0)
         return setError(E_FAIL, tr("The preferred lanuage is a two character string or empty."));
 
-    Utf8Str strFormat(a_bstrFormat);
-    if (   !strFormat.equals("html")
-        && !strFormat.equals("rtf")
-        && !strFormat.equals("txt"))
+    if (   !aFormat.equals("html")
+        && !aFormat.equals("rtf")
+        && !aFormat.equals("txt"))
         return setError(E_FAIL, tr("The license format can only have the values 'html', 'rtf' and 'txt'."));
 
     /*
      * Combine the options to form a file name before locking down anything.
      */
     char szName[sizeof(VBOX_EXTPACK_LICENSE_NAME_PREFIX "-de_DE.html") + 2];
-    if (strPreferredLocale.isNotEmpty() && strPreferredLanguage.isNotEmpty())
+    if (aPreferredLocale.isNotEmpty() && aPreferredLanguage.isNotEmpty())
         RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-%s_%s.%s",
-                    strPreferredLocale.c_str(), strPreferredLanguage.c_str(), strFormat.c_str());
-    else if (strPreferredLocale.isNotEmpty())
-        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-%s.%s",  strPreferredLocale.c_str(), strFormat.c_str());
-    else if (strPreferredLanguage.isNotEmpty())
-        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-_%s.%s", strPreferredLocale.c_str(), strFormat.c_str());
+                    aPreferredLocale.c_str(), aPreferredLanguage.c_str(), aFormat.c_str());
+    else if (aPreferredLocale.isNotEmpty())
+        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-%s.%s",
+                    aPreferredLocale.c_str(), aFormat.c_str());
+    else if (aPreferredLanguage.isNotEmpty())
+        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX "-_%s.%s",
+                    aPreferredLocale.c_str(), aFormat.c_str());
     else
-        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX ".%s",     strFormat.c_str());
+        RTStrPrintf(szName, sizeof(szName), VBOX_EXTPACK_LICENSE_NAME_PREFIX ".%s",
+                    aFormat.c_str());
 
     /*
      * Effectuate the query.
      */
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS); /* paranoia */
+    AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS); /* paranoia */
 
-        if (!m->fUsable)
-            hrc = setError(E_FAIL, tr("%s"), m->strWhyUnusable.c_str());
-        else
+    if (!m->fUsable)
+        hrc = setError(E_FAIL, tr("%s"), m->strWhyUnusable.c_str());
+    else
+    {
+        char szPath[RTPATH_MAX];
+        int vrc = RTPathJoin(szPath, sizeof(szPath), m->strExtPackPath.c_str(), szName);
+        if (RT_SUCCESS(vrc))
         {
-            char szPath[RTPATH_MAX];
-            int vrc = RTPathJoin(szPath, sizeof(szPath), m->strExtPackPath.c_str(), szName);
+            void   *pvFile;
+            size_t  cbFile;
+            vrc = RTFileReadAllEx(szPath, 0, RTFOFF_MAX, RTFILE_RDALL_O_DENY_READ, &pvFile, &cbFile);
             if (RT_SUCCESS(vrc))
             {
-                void   *pvFile;
-                size_t  cbFile;
-                vrc = RTFileReadAllEx(szPath, 0, RTFOFF_MAX, RTFILE_RDALL_O_DENY_READ, &pvFile, &cbFile);
-                if (RT_SUCCESS(vrc))
+                Bstr bstrLicense((const char *)pvFile, cbFile);
+                if (bstrLicense.isNotEmpty())
                 {
-                    Bstr bstrLicense((const char *)pvFile, cbFile);
-                    if (bstrLicense.isNotEmpty())
-                    {
-                        bstrLicense.detachTo(a_pbstrLicense);
-                        hrc = S_OK;
-                    }
-                    else
-                        hrc = setError(VBOX_E_IPRT_ERROR, tr("The license file '%s' is empty or contains invalid UTF-8 encoding"),
-                                       szPath);
-                    RTFileReadAllFree(pvFile, cbFile);
+                    aLicenseText = Utf8Str(bstrLicense);
+                    hrc = S_OK;
                 }
-                else if (vrc == VERR_FILE_NOT_FOUND || vrc == VERR_PATH_NOT_FOUND)
-                    hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("The license file '%s' was not found in extension pack '%s'"),
-                                   szName, m->Desc.strName.c_str());
                 else
-                    hrc = setError(VBOX_E_FILE_ERROR, tr("Failed to open the license file '%s': %Rrc"), szPath, vrc);
+                    hrc = setError(VBOX_E_IPRT_ERROR, tr("The license file '%s' is empty or contains invalid UTF-8 encoding"),
+                                   szPath);
+                RTFileReadAllFree(pvFile, cbFile);
             }
+            else if (vrc == VERR_FILE_NOT_FOUND || vrc == VERR_PATH_NOT_FOUND)
+                hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("The license file '%s' was not found in extension pack '%s'"),
+                               szName, m->Desc.strName.c_str());
             else
-                hrc = setError(VBOX_E_IPRT_ERROR, tr("RTPathJoin failed: %Rrc"), vrc);
+                hrc = setError(VBOX_E_FILE_ERROR, tr("Failed to open the license file '%s': %Rrc"), szPath, vrc);
         }
+        else
+            hrc = setError(VBOX_E_IPRT_ERROR, tr("RTPathJoin failed: %Rrc"), vrc);
     }
     return hrc;
 }
 
-
-STDMETHODIMP ExtPack::QueryObject(IN_BSTR a_bstrObjectId, IUnknown **a_ppUnknown)
+HRESULT ExtPack::queryObject(const com::Utf8Str &aObjUuid, ComPtr<IUnknown> &aReturnInterface)
 {
     com::Guid ObjectId;
-    CheckComArgGuid(a_bstrObjectId, ObjectId);
-    CheckComArgOutPointerValid(a_ppUnknown);
+    CheckComArgGuid(aObjUuid, ObjectId);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    HRESULT hrc  S_OK;
+
+    if (   m->pReg
+        && m->pReg->pfnQueryObject)
     {
-        if (   m->pReg
-            && m->pReg->pfnQueryObject)
-        {
-            void *pvUnknown = m->pReg->pfnQueryObject(m->pReg, ObjectId.raw());
-            if (pvUnknown)
-                *a_ppUnknown = (IUnknown *)pvUnknown;
-            else
-                hrc = E_NOINTERFACE;
-        }
+        void *pvUnknown = m->pReg->pfnQueryObject(m->pReg, ObjectId.raw());
+        if (pvUnknown)
+             aReturnInterface = (IUnknown *)pvUnknown;
         else
             hrc = E_NOINTERFACE;
     }
+    else
+        hrc = E_NOINTERFACE;
     return hrc;
 }
 
-
-
-
 DEFINE_EMPTY_CTOR_DTOR(ExtPackManager)
 
 /**
@@ -2103,52 +1954,40 @@ void ExtPackManager::uninit()
     }
 }
 
-
-STDMETHODIMP ExtPackManager::COMGETTER(InstalledExtPacks)(ComSafeArrayOut(IExtPack *, a_paExtPacks))
+HRESULT ExtPackManager::getInstalledExtPacks(std::vector<ComPtr<IExtPack> > &aInstalledExtPacks)
 {
-    CheckComArgOutSafeArrayPointerValid(a_paExtPacks);
     Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
+    AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
 
-        SafeIfaceArray<IExtPack> SaExtPacks(m->llInstalledExtPacks);
-        SaExtPacks.detachTo(ComSafeArrayOutArg(a_paExtPacks));
-    }
 
-    return hrc;
+    SafeIfaceArray<IExtPack> SaExtPacks(m->llInstalledExtPacks);
+    aInstalledExtPacks.resize(SaExtPacks.size());
+    for(size_t i = 0; i < SaExtPacks.size(); ++i)
+        aInstalledExtPacks[i] = SaExtPacks[i];
+
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackManager::Find(IN_BSTR a_bstrName, IExtPack **a_pExtPack)
+HRESULT ExtPackManager::find(const com::Utf8Str &aName, ComPtr<IExtPack> &aReturnData)
 {
-    CheckComArgNotNull(a_bstrName);
-    CheckComArgOutPointerValid(a_pExtPack);
-    Utf8Str strName(a_bstrName);
+    HRESULT hrc = S_OK;
+
     Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
+    AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
 
-        ComPtr<ExtPack> ptrExtPack = findExtPack(strName.c_str());
-        if (!ptrExtPack.isNull())
-            ptrExtPack.queryInterfaceTo(a_pExtPack);
-        else
-            hrc = VBOX_E_OBJECT_NOT_FOUND;
-    }
+    ComPtr<ExtPack> ptrExtPack = i_findExtPack(aName.c_str());
+    if (!ptrExtPack.isNull())
+        ptrExtPack.queryInterfaceTo(aReturnData.asOutParam());
+    else
+        hrc = VBOX_E_OBJECT_NOT_FOUND;
 
     return hrc;
 }
 
-STDMETHODIMP ExtPackManager::OpenExtPackFile(IN_BSTR a_bstrTarballAndDigest, IExtPackFile **a_ppExtPackFile)
+HRESULT ExtPackManager::openExtPackFile(const com::Utf8Str &aPath, ComPtr<IExtPackFile> &aFile)
 {
-    CheckComArgNotNull(a_bstrTarballAndDigest);
-    CheckComArgOutPointerValid(a_ppExtPackFile);
     AssertReturn(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON, E_UNEXPECTED);
 
 #if !defined(VBOX_COM_INPROC)
@@ -2157,14 +1996,13 @@ STDMETHODIMP ExtPackManager::OpenExtPackFile(IN_BSTR a_bstrTarballAndDigest, IEx
        backporting, in 4.2 we'll add another parameter to the method. */
     Utf8Str strTarball;
     Utf8Str strDigest;
-    Utf8Str strTarballAndDigest(a_bstrTarballAndDigest);
-    size_t offSha256 = strTarballAndDigest.find("::SHA-256=");
+    size_t offSha256 = aPath.find("::SHA-256=");
     if (offSha256 == Utf8Str::npos)
-        strTarball = strTarballAndDigest;
+        strTarball = aPath;
     else
     {
-        strTarball = strTarballAndDigest.substr(0, offSha256);
-        strDigest  = strTarballAndDigest.substr(offSha256 + sizeof("::SHA-256=") - 1);
+        strTarball = aPath.substr(0, offSha256);
+        strDigest  = aPath.substr(offSha256 + sizeof("::SHA-256=") - 1);
     }
 
     ComObjPtr<ExtPackFile> NewExtPackFile;
@@ -2172,7 +2010,7 @@ STDMETHODIMP ExtPackManager::OpenExtPackFile(IN_BSTR a_bstrTarballAndDigest, IEx
     if (SUCCEEDED(hrc))
         hrc = NewExtPackFile->initWithFile(strTarball.c_str(), strDigest.c_str(), this, m->pVirtualBox);
     if (SUCCEEDED(hrc))
-        NewExtPackFile.queryInterfaceTo(a_ppExtPackFile);
+        NewExtPackFile.queryInterfaceTo(aFile.asOutParam());
 
     return hrc;
 #else
@@ -2180,61 +2018,54 @@ STDMETHODIMP ExtPackManager::OpenExtPackFile(IN_BSTR a_bstrTarballAndDigest, IEx
 #endif
 }
 
-STDMETHODIMP ExtPackManager::Uninstall(IN_BSTR a_bstrName, BOOL a_fForcedRemoval, IN_BSTR a_bstrDisplayInfo,
-                                       IProgress **a_ppProgress)
+HRESULT ExtPackManager::uninstall(const com::Utf8Str &aName, BOOL aForcedRemoval,
+                                  const com::Utf8Str &aDisplayInfo, ComPtr<IProgress> &aProgress)
 {
-    CheckComArgNotNull(a_bstrName);
-    if (a_ppProgress)
-        *a_ppProgress = NULL;
+    HRESULT hrc = S_OK;
+
     Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON);
 
 #if !defined(VBOX_COM_INPROC)
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        PEXTPACKUNINSTALLJOB pJob = NULL;
-        try
+    PEXTPACKUNINSTALLJOB pJob = NULL;
+    try
+    {
+        pJob = new EXTPACKUNINSTALLJOB;
+        pJob->ptrExtPackMgr     = this;
+        pJob->strName           = aName;
+        pJob->fForcedRemoval    = aForcedRemoval != FALSE;
+        pJob->strDisplayInfo    = aDisplayInfo;
+        hrc = pJob->ptrProgress.createObject();
+        if (SUCCEEDED(hrc))
         {
-            pJob = new EXTPACKUNINSTALLJOB;
-            pJob->ptrExtPackMgr     = this;
-            pJob->strName           = a_bstrName;
-            pJob->fForcedRemoval    = a_fForcedRemoval != FALSE;
-            pJob->strDisplayInfo    = a_bstrDisplayInfo;
-            hrc = pJob->ptrProgress.createObject();
-            if (SUCCEEDED(hrc))
-            {
-                Bstr bstrDescription = tr("Uninstalling extension pack");
-                hrc = pJob->ptrProgress->init(
+            Bstr bstrDescription = tr("Uninstalling extension pack");
+            hrc = pJob->ptrProgress->init(
 #ifndef VBOX_COM_INPROC
-                                              m->pVirtualBox,
+                                          m->pVirtualBox,
 #endif
-                                              static_cast<IExtPackManager *>(this),
-                                              bstrDescription.raw(),
-                                              FALSE /*aCancelable*/,
-                                              NULL /*aId*/);
-            }
-            if (SUCCEEDED(hrc))
-            {
-                ComPtr<Progress> ptrProgress = pJob->ptrProgress;
-                int vrc = RTThreadCreate(NULL /*phThread*/, ExtPackManager::doUninstallThreadProc, pJob, 0,
-                                         RTTHREADTYPE_DEFAULT, 0 /*fFlags*/, "ExtPackUninst");
-                if (RT_SUCCESS(vrc))
-                {
-                    pJob = NULL; /* the thread deletes it */
-                    ptrProgress.queryInterfaceTo(a_ppProgress);
-                }
-                else
-                    hrc = setError(VBOX_E_IPRT_ERROR, tr("RTThreadCreate failed with %Rrc"), vrc);
-            }
+                                          static_cast<IExtPackManager *>(this),
+                                          bstrDescription.raw(),
+                                          FALSE /*aCancelable*/);
         }
-        catch (std::bad_alloc)
+        if (SUCCEEDED(hrc))
         {
-            hrc = E_OUTOFMEMORY;
+            ComPtr<Progress> ptrProgress = pJob->ptrProgress;
+            int vrc = RTThreadCreate(NULL /*phThread*/, ExtPackManager::i_doUninstallThreadProc, pJob, 0,
+                                     RTTHREADTYPE_DEFAULT, 0 /*fFlags*/, "ExtPackUninst");
+            if (RT_SUCCESS(vrc))
+            {
+                pJob = NULL; /* the thread deletes it */
+                ptrProgress.queryInterfaceTo(aProgress.asOutParam());
+            }
+            else
+                hrc = setError(VBOX_E_IPRT_ERROR, tr("RTThreadCreate failed with %Rrc"), vrc);
         }
-        if (pJob)
-            delete pJob;
     }
+    catch (std::bad_alloc)
+    {
+        hrc = E_OUTOFMEMORY;
+    }
+    if (pJob)
+        delete pJob;
 
     return hrc;
 #else
@@ -2242,7 +2073,7 @@ STDMETHODIMP ExtPackManager::Uninstall(IN_BSTR a_bstrName, BOOL a_fForcedRemoval
 #endif
 }
 
-STDMETHODIMP ExtPackManager::Cleanup(void)
+HRESULT ExtPackManager::cleanup(void)
 {
     Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON);
 
@@ -2257,38 +2088,25 @@ STDMETHODIMP ExtPackManager::Cleanup(void)
          * VBoxSVC instance.
          */
         AutoWriteLock autoLock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = runSetUidToRootHelper(NULL,
-                                    "cleanup",
-                                    "--base-dir", m->strBaseDir.c_str(),
-                                    (const char *)NULL);
+        hrc = i_runSetUidToRootHelper(NULL,
+                                      "cleanup",
+                                      "--base-dir", m->strBaseDir.c_str(),
+                                      (const char *)NULL);
     }
 
     return hrc;
 }
 
-STDMETHODIMP ExtPackManager::QueryAllPlugInsForFrontend(IN_BSTR a_bstrFrontend, ComSafeArrayOut(BSTR, a_pabstrPlugInModules))
+HRESULT ExtPackManager::queryAllPlugInsForFrontend(const com::Utf8Str &aFrontendName, std::vector<com::Utf8Str> &aPlugInModules)
 {
-    CheckComArgNotNull(a_bstrFrontend);
-    Utf8Str strName(a_bstrFrontend);
-    CheckComArgOutSafeArrayPointerValid(a_pabstrPlugInModules);
-    Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        com::SafeArray<BSTR> saPaths((size_t)0);
-        /** @todo implement plug-ins */
-        saPaths.detachTo(ComSafeArrayOutArg(a_pabstrPlugInModules));
-    }
-    return hrc;
+    NOREF(aFrontendName);
+    aPlugInModules.resize(0);
+    return S_OK;
 }
 
-STDMETHODIMP ExtPackManager::IsExtPackUsable(IN_BSTR a_bstrExtPack, BOOL *aUsable)
+HRESULT ExtPackManager::isExtPackUsable(const com::Utf8Str &aName, BOOL *aUsable)
 {
-    CheckComArgNotNull(a_bstrExtPack);
-    Utf8Str strExtPack(a_bstrExtPack);
-    *aUsable = isExtPackUsable(strExtPack.c_str());
+    *aUsable = i_isExtPackUsable(aName.c_str());
     return S_OK;
 }
 
@@ -2321,7 +2139,7 @@ static char *findSuccessIndicator(char *psz, size_t cch)
  *                              command. Maximum is about 16.  Terminated by a
  *                              NULL.
  */
-HRESULT ExtPackManager::runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...)
+HRESULT ExtPackManager::i_runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo, const char *a_pszCommand, ...)
 {
     /*
      * Calculate the path to the helper application.
@@ -2529,13 +2347,13 @@ HRESULT ExtPackManager::runSetUidToRootHelper(Utf8Str const *a_pstrDisplayInfo,
  *          counting problem here since the caller must be holding the lock.)
  * @param   a_pszName       The name of the extension pack.
  */
-ExtPack *ExtPackManager::findExtPack(const char *a_pszName)
+ExtPack *ExtPackManager::i_findExtPack(const char *a_pszName)
 {
     size_t cchName = strlen(a_pszName);
 
     for (ExtPackList::iterator it = m->llInstalledExtPacks.begin();
          it != m->llInstalledExtPacks.end();
-         it++)
+         ++it)
     {
         ExtPack::Data *pExtPackData = (*it)->m;
         if (   pExtPackData
@@ -2553,13 +2371,13 @@ ExtPack *ExtPackManager::findExtPack(const char *a_pszName)
  *
  * @param   a_pszName       The name of the extension pack.
  */
-void ExtPackManager::removeExtPack(const char *a_pszName)
+void ExtPackManager::i_removeExtPack(const char *a_pszName)
 {
     size_t cchName = strlen(a_pszName);
 
     for (ExtPackList::iterator it = m->llInstalledExtPacks.begin();
          it != m->llInstalledExtPacks.end();
-         it++)
+         ++it)
     {
         ExtPack::Data *pExtPackData = (*it)->m;
         if (   pExtPackData
@@ -2593,24 +2411,24 @@ void ExtPackManager::removeExtPack(const char *a_pszName)
  * @remarks Caller holds the extension manager lock.
  * @remarks Only called in VBoxSVC.
  */
-HRESULT ExtPackManager::refreshExtPack(const char *a_pszName, bool a_fUnusableIsError, ExtPack **a_ppExtPack)
+HRESULT ExtPackManager::i_refreshExtPack(const char *a_pszName, bool a_fUnusableIsError, ExtPack **a_ppExtPack)
 {
     Assert(m->pVirtualBox != NULL); /* Only called from VBoxSVC. */
 
     HRESULT hrc;
-    ExtPack *pExtPack = findExtPack(a_pszName);
+    ExtPack *pExtPack = i_findExtPack(a_pszName);
     if (pExtPack)
     {
         /*
          * Refresh existing object.
          */
         bool fCanDelete;
-        hrc = pExtPack->refresh(&fCanDelete);
+        hrc = pExtPack->i_refresh(&fCanDelete);
         if (SUCCEEDED(hrc))
         {
             if (fCanDelete)
             {
-                removeExtPack(a_pszName);
+                i_removeExtPack(a_pszName);
                 pExtPack = NULL;
             }
         }
@@ -2714,11 +2532,11 @@ HRESULT ExtPackManager::refreshExtPack(const char *a_pszName, bool a_fUnusableIs
  * @param   hThread             The thread handle (ignored).
  * @param   pvJob               The job structure.
  */
-/*static*/ DECLCALLBACK(int) ExtPackManager::doInstallThreadProc(RTTHREAD hThread, void *pvJob)
+/*static*/ DECLCALLBACK(int) ExtPackManager::i_doInstallThreadProc(RTTHREAD hThread, void *pvJob)
 {
     PEXTPACKINSTALLJOB pJob = (PEXTPACKINSTALLJOB)pvJob;
-    HRESULT hrc = pJob->ptrExtPackMgr->doInstall(pJob->ptrExtPackFile, pJob->fReplace, &pJob->strDisplayInfo);
-    pJob->ptrProgress->notifyComplete(hrc);
+    HRESULT hrc = pJob->ptrExtPackMgr->i_doInstall(pJob->ptrExtPackFile, pJob->fReplace, &pJob->strDisplayInfo);
+    pJob->ptrProgress->i_notifyComplete(hrc);
     delete pJob;
 
     NOREF(hThread);
@@ -2739,7 +2557,7 @@ HRESULT ExtPackManager::refreshExtPack(const char *a_pszName, bool a_fUnusableIs
  * @param   a_ppProgress        Where to return a progress object some day. Can
  *                              be NULL.
  */
-HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo)
+HRESULT ExtPackManager::i_doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, Utf8Str const *a_pstrDisplayInfo)
 {
     AssertReturn(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON, E_UNEXPECTED);
     RTCString const * const pStrName          = &a_pExtPackFile->m->Desc.strName;
@@ -2757,11 +2575,11 @@ HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace,
          * may be made stale by direct meddling or some other user.
          */
         ExtPack *pExtPack;
-        hrc = refreshExtPack(pStrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack);
+        hrc = i_refreshExtPack(pStrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack);
         if (SUCCEEDED(hrc))
         {
             if (pExtPack && a_fReplace)
-                hrc = pExtPack->callUninstallHookAndClose(m->pVirtualBox, false /*a_ForcedRemoval*/);
+                hrc = pExtPack->i_callUninstallHookAndClose(m->pVirtualBox, false /*a_ForcedRemoval*/);
             else if (pExtPack)
                 hrc = setError(E_FAIL,
                                tr("Extension pack '%s' is already installed."
@@ -2775,23 +2593,23 @@ HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace,
              * installation.  Then create an object for the packet (we do this
              * even on failure, to be on the safe side).
              */
-            hrc = runSetUidToRootHelper(a_pstrDisplayInfo,
-                                        "install",
-                                        "--base-dir",   m->strBaseDir.c_str(),
-                                        "--cert-dir",   m->strCertificatDirPath.c_str(),
-                                        "--name",       pStrName->c_str(),
-                                        "--tarball",    pStrTarball->c_str(),
-                                        "--sha-256",    pStrTarballDigest->c_str(),
-                                        pExtPack ? "--replace" : (const char *)NULL,
-                                        (const char *)NULL);
+            hrc = i_runSetUidToRootHelper(a_pstrDisplayInfo,
+                                          "install",
+                                          "--base-dir",   m->strBaseDir.c_str(),
+                                          "--cert-dir",   m->strCertificatDirPath.c_str(),
+                                          "--name",       pStrName->c_str(),
+                                          "--tarball",    pStrTarball->c_str(),
+                                          "--sha-256",    pStrTarballDigest->c_str(),
+                                          pExtPack ? "--replace" : (const char *)NULL,
+                                          (const char *)NULL);
             if (SUCCEEDED(hrc))
             {
-                hrc = refreshExtPack(pStrName->c_str(), true /*a_fUnusableIsError*/, &pExtPack);
+                hrc = i_refreshExtPack(pStrName->c_str(), true /*a_fUnusableIsError*/, &pExtPack);
                 if (SUCCEEDED(hrc) && pExtPack)
                 {
                     RTERRINFOSTATIC ErrInfo;
                     RTErrInfoInitStatic(&ErrInfo);
-                    pExtPack->callInstalledHook(m->pVirtualBox, &autoLock, &ErrInfo.Core);
+                    pExtPack->i_callInstalledHook(m->pVirtualBox, &autoLock, &ErrInfo.Core);
                     if (RT_SUCCESS(ErrInfo.Core.rc))
                         LogRel(("ExtPackManager: Successfully installed extension pack '%s'.\n", pStrName->c_str()));
                     else
@@ -2803,12 +2621,12 @@ HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace,
                          * Uninstall the extpack if the error indicates that.
                          */
                         if (ErrInfo.Core.rc == VERR_EXTPACK_UNSUPPORTED_HOST_UNINSTALL)
-                            runSetUidToRootHelper(a_pstrDisplayInfo,
-                                                  "uninstall",
-                                                  "--base-dir", m->strBaseDir.c_str(),
-                                                  "--name",     pStrName->c_str(),
-                                                  "--forced",
-                                                  (const char *)NULL);
+                            i_runSetUidToRootHelper(a_pstrDisplayInfo,
+                                                    "uninstall",
+                                                    "--base-dir", m->strBaseDir.c_str(),
+                                                    "--name",     pStrName->c_str(),
+                                                    "--forced",
+                                                    (const char *)NULL);
                         hrc = setError(E_FAIL, tr("The installation hook failed: %Rrc - %s"),
                                        ErrInfo.Core.rc, ErrInfo.Core.pszMsg);
                     }
@@ -2820,7 +2638,7 @@ HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace,
             else
             {
                 ErrorInfoKeeper Eik;
-                refreshExtPack(pStrName->c_str(), false /*a_fUnusableIsError*/, NULL);
+                i_refreshExtPack(pStrName->c_str(), false /*a_fUnusableIsError*/, NULL);
             }
         }
 
@@ -2831,7 +2649,7 @@ HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace,
         if (m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON)
         {
             autoLock.release();
-            callAllVirtualBoxReadyHooks();
+            i_callAllVirtualBoxReadyHooks();
         }
     }
 
@@ -2845,11 +2663,11 @@ HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace,
  * @param   hThread             The thread handle (ignored).
  * @param   pvJob               The job structure.
  */
-/*static*/ DECLCALLBACK(int) ExtPackManager::doUninstallThreadProc(RTTHREAD hThread, void *pvJob)
+/*static*/ DECLCALLBACK(int) ExtPackManager::i_doUninstallThreadProc(RTTHREAD hThread, void *pvJob)
 {
     PEXTPACKUNINSTALLJOB pJob = (PEXTPACKUNINSTALLJOB)pvJob;
-    HRESULT hrc = pJob->ptrExtPackMgr->doUninstall(&pJob->strName, pJob->fForcedRemoval, &pJob->strDisplayInfo);
-    pJob->ptrProgress->notifyComplete(hrc);
+    HRESULT hrc = pJob->ptrExtPackMgr->i_doUninstall(&pJob->strName, pJob->fForcedRemoval, &pJob->strDisplayInfo);
+    pJob->ptrProgress->i_notifyComplete(hrc);
     delete pJob;
 
     NOREF(hThread);
@@ -2868,7 +2686,7 @@ HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace,
  *                              extension pack hooks.
  * @param   a_pstrDisplayInfo   Host specific display information hacks.
  */
-HRESULT ExtPackManager::doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRemoval, Utf8Str const *a_pstrDisplayInfo)
+HRESULT ExtPackManager::i_doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRemoval, Utf8Str const *a_pstrDisplayInfo)
 {
     Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON);
 
@@ -2883,7 +2701,7 @@ HRESULT ExtPackManager::doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRem
          * stale by direct meddling or some other user.
          */
         ExtPack *pExtPack;
-        hrc = refreshExtPack(a_pstrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack);
+        hrc = i_refreshExtPack(a_pstrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack);
         if (SUCCEEDED(hrc))
         {
             if (!pExtPack)
@@ -2896,7 +2714,7 @@ HRESULT ExtPackManager::doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRem
                 /*
                  * Call the uninstall hook and unload the main dll.
                  */
-                hrc = pExtPack->callUninstallHookAndClose(m->pVirtualBox, a_fForcedRemoval);
+                hrc = pExtPack->i_callUninstallHookAndClose(m->pVirtualBox, a_fForcedRemoval);
                 if (SUCCEEDED(hrc))
                 {
                     /*
@@ -2907,15 +2725,15 @@ HRESULT ExtPackManager::doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRem
                      * the don't-do-that variety.
                      */
                     const char *pszForcedOpt = a_fForcedRemoval ? "--forced" : NULL;
-                    hrc = runSetUidToRootHelper(a_pstrDisplayInfo,
-                                                "uninstall",
-                                                "--base-dir", m->strBaseDir.c_str(),
-                                                "--name",     a_pstrName->c_str(),
-                                                pszForcedOpt, /* Last as it may be NULL. */
-                                                (const char *)NULL);
+                    hrc = i_runSetUidToRootHelper(a_pstrDisplayInfo,
+                                                  "uninstall",
+                                                  "--base-dir", m->strBaseDir.c_str(),
+                                                  "--name",     a_pstrName->c_str(),
+                                                  pszForcedOpt, /* Last as it may be NULL. */
+                                                  (const char *)NULL);
                     if (SUCCEEDED(hrc))
                     {
-                        hrc = refreshExtPack(a_pstrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack);
+                        hrc = i_refreshExtPack(a_pstrName->c_str(), false /*a_fUnusableIsError*/, &pExtPack);
                         if (SUCCEEDED(hrc))
                         {
                             if (!pExtPack)
@@ -2929,7 +2747,7 @@ HRESULT ExtPackManager::doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRem
                     else
                     {
                         ErrorInfoKeeper Eik;
-                        refreshExtPack(a_pstrName->c_str(), false /*a_fUnusableIsError*/, NULL);
+                        i_refreshExtPack(a_pstrName->c_str(), false /*a_fUnusableIsError*/, NULL);
                     }
                 }
             }
@@ -2942,7 +2760,7 @@ HRESULT ExtPackManager::doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRem
         if (m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON)
         {
             autoLock.release();
-            callAllVirtualBoxReadyHooks();
+            i_callAllVirtualBoxReadyHooks();
         }
     }
 
@@ -2955,7 +2773,7 @@ HRESULT ExtPackManager::doUninstall(Utf8Str const *a_pstrName, bool a_fForcedRem
  *
  * @remarks The caller must not hold any locks.
  */
-void ExtPackManager::callAllVirtualBoxReadyHooks(void)
+void ExtPackManager::i_callAllVirtualBoxReadyHooks(void)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -2968,10 +2786,10 @@ void ExtPackManager::callAllVirtualBoxReadyHooks(void)
          it != m->llInstalledExtPacks.end();
          /* advancing below */)
     {
-        if ((*it)->callVirtualBoxReadyHook(m->pVirtualBox, &autoLock))
+        if ((*it)->i_callVirtualBoxReadyHook(m->pVirtualBox, &autoLock))
             it = m->llInstalledExtPacks.begin();
         else
-            it++;
+            ++it;
     }
 }
 #endif
@@ -2982,7 +2800,7 @@ void ExtPackManager::callAllVirtualBoxReadyHooks(void)
  * @param   a_pConsole          The console interface.
  * @remarks The caller must not hold any locks.
  */
-void ExtPackManager::callAllConsoleReadyHooks(IConsole *a_pConsole)
+void ExtPackManager::i_callAllConsoleReadyHooks(IConsole *a_pConsole)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -2995,10 +2813,10 @@ void ExtPackManager::callAllConsoleReadyHooks(IConsole *a_pConsole)
          it != m->llInstalledExtPacks.end();
          /* advancing below */)
     {
-        if ((*it)->callConsoleReadyHook(a_pConsole, &autoLock))
+        if ((*it)->i_callConsoleReadyHook(a_pConsole, &autoLock))
             it = m->llInstalledExtPacks.begin();
         else
-            it++;
+            ++it;
     }
 }
 
@@ -3008,7 +2826,7 @@ void ExtPackManager::callAllConsoleReadyHooks(IConsole *a_pConsole)
  *
  * @param   a_pMachine          The machine interface of the new VM.
  */
-void ExtPackManager::callAllVmCreatedHooks(IMachine *a_pMachine)
+void ExtPackManager::i_callAllVmCreatedHooks(IMachine *a_pMachine)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3018,8 +2836,8 @@ void ExtPackManager::callAllVmCreatedHooks(IMachine *a_pMachine)
     ComPtr<ExtPackManager>  ptrSelfRef = this; /* paranoia */
     ExtPackList             llExtPacks = m->llInstalledExtPacks;
 
-    for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); it++)
-        (*it)->callVmCreatedHook(m->pVirtualBox, a_pMachine, &autoLock);
+    for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); ++it)
+        (*it)->i_callVmCreatedHook(m->pVirtualBox, a_pMachine, &autoLock);
 }
 #endif
 
@@ -3031,7 +2849,7 @@ void ExtPackManager::callAllVmCreatedHooks(IMachine *a_pMachine)
  * @param   a_pConsole          The console interface for the VM.
  * @param   a_pVM               The VM handle.
  */
-int ExtPackManager::callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM)
+int ExtPackManager::i_callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3041,10 +2859,10 @@ int ExtPackManager::callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM)
     ComPtr<ExtPackManager>  ptrSelfRef = this; /* paranoia */
     ExtPackList             llExtPacks = m->llInstalledExtPacks;
 
-    for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); it++)
+    for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); ++it)
     {
         int vrc;
-        (*it)->callVmConfigureVmmHook(a_pConsole, a_pVM, &autoLock, &vrc);
+        (*it)->i_callVmConfigureVmmHook(a_pConsole, a_pVM, &autoLock, &vrc);
         if (RT_FAILURE(vrc))
             return vrc;
     }
@@ -3060,7 +2878,7 @@ int ExtPackManager::callAllVmConfigureVmmHooks(IConsole *a_pConsole, PVM a_pVM)
  * @param   a_pConsole          The console interface for the VM.
  * @param   a_pVM               The VM handle.
  */
-int ExtPackManager::callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM)
+int ExtPackManager::i_callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3070,10 +2888,10 @@ int ExtPackManager::callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM)
     ComPtr<ExtPackManager>  ptrSelfRef = this; /* paranoia */
     ExtPackList             llExtPacks = m->llInstalledExtPacks;
 
-    for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); it++)
+    for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); ++it)
     {
         int vrc;
-        (*it)->callVmPowerOnHook(a_pConsole, a_pVM, &autoLock, &vrc);
+        (*it)->i_callVmPowerOnHook(a_pConsole, a_pVM, &autoLock, &vrc);
         if (RT_FAILURE(vrc))
             return vrc;
     }
@@ -3087,7 +2905,7 @@ int ExtPackManager::callAllVmPowerOnHooks(IConsole *a_pConsole, PVM a_pVM)
  * @param   a_pConsole          The console interface for the VM.
  * @param   a_pVM               The VM handle. Can be NULL.
  */
-void ExtPackManager::callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM)
+void ExtPackManager::i_callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3097,8 +2915,8 @@ void ExtPackManager::callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM)
     ComPtr<ExtPackManager>  ptrSelfRef = this; /* paranoia */
     ExtPackList             llExtPacks = m->llInstalledExtPacks;
 
-    for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); it++)
-        (*it)->callVmPowerOffHook(a_pConsole, a_pVM, &autoLock);
+    for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); ++it)
+        (*it)->i_callVmPowerOffHook(a_pConsole, a_pVM, &autoLock);
 }
 
 
@@ -3109,7 +2927,7 @@ void ExtPackManager::callAllVmPowerOffHooks(IConsole *a_pConsole, PVM a_pVM)
  * @returns S_OK if ok, appropriate failure status code with details.
  * @param   a_pstrExtPack   The name of the extension pack.
  */
-HRESULT ExtPackManager::checkVrdeExtPack(Utf8Str const *a_pstrExtPack)
+HRESULT ExtPackManager::i_checkVrdeExtPack(Utf8Str const *a_pstrExtPack)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3117,9 +2935,9 @@ HRESULT ExtPackManager::checkVrdeExtPack(Utf8Str const *a_pstrExtPack)
     {
         AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
 
-        ExtPack *pExtPack = findExtPack(a_pstrExtPack->c_str());
+        ExtPack *pExtPack = i_findExtPack(a_pstrExtPack->c_str());
         if (pExtPack)
-            hrc = pExtPack->checkVrde();
+            hrc = pExtPack->i_checkVrde();
         else
             hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"), a_pstrExtPack->c_str());
     }
@@ -3138,7 +2956,7 @@ HRESULT ExtPackManager::checkVrdeExtPack(Utf8Str const *a_pstrExtPack)
  * @param   a_pstrExtPack       The extension pack.
  * @param   a_pstrVrdeLibrary   Where to return the path.
  */
-int ExtPackManager::getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary)
+int ExtPackManager::i_getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrVrdeLibrary)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3146,11 +2964,12 @@ int ExtPackManager::getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, U
     {
         AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
 
-        ExtPack *pExtPack = findExtPack(a_pstrExtPack->c_str());
+        ExtPack *pExtPack = i_findExtPack(a_pstrExtPack->c_str());
         if (pExtPack)
-            hrc = pExtPack->getVrdpLibraryName(a_pstrVrdeLibrary);
+            hrc = pExtPack->i_getVrdpLibraryName(a_pstrVrdeLibrary);
         else
-            hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"), a_pstrExtPack->c_str());
+            hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"),
+                           a_pstrExtPack->c_str());
     }
 
     return hrc;
@@ -3165,7 +2984,8 @@ int ExtPackManager::getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, U
  * @param   a_pstrExtPack       The extension pack.
  * @param   a_pstrVrdeLibrary   Where to return the path.
  */
-HRESULT ExtPackManager::getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrLibrary)
+HRESULT ExtPackManager::i_getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack,
+                                                   Utf8Str *a_pstrLibrary)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3173,9 +2993,9 @@ HRESULT ExtPackManager::getLibraryPathForExtPack(const char *a_pszModuleName, Ut
     {
         AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
 
-        ExtPack *pExtPack = findExtPack(a_pstrExtPack->c_str());
+        ExtPack *pExtPack = i_findExtPack(a_pstrExtPack->c_str());
         if (pExtPack)
-            hrc = pExtPack->getLibraryName(a_pszModuleName, a_pstrLibrary);
+            hrc = pExtPack->i_getLibraryName(a_pszModuleName, a_pstrLibrary);
         else
             hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"), a_pstrExtPack->c_str());
     }
@@ -3191,7 +3011,7 @@ HRESULT ExtPackManager::getLibraryPathForExtPack(const char *a_pszModuleName, Ut
  *                          empty if no extension pack wishes to be the default
  *                          VRDP provider.
  */
-HRESULT ExtPackManager::getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack)
+HRESULT ExtPackManager::i_getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack)
 {
     a_pstrExtPack->setNull();
 
@@ -3203,9 +3023,9 @@ HRESULT ExtPackManager::getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack)
 
         for (ExtPackList::iterator it = m->llInstalledExtPacks.begin();
              it != m->llInstalledExtPacks.end();
-             it++)
+             ++it)
         {
-            if ((*it)->wantsToBeDefaultVrde())
+            if ((*it)->i_wantsToBeDefaultVrde())
             {
                 *a_pstrExtPack = (*it)->m->Desc.strName;
                 break;
@@ -3221,7 +3041,7 @@ HRESULT ExtPackManager::getDefaultVrdeExtPack(Utf8Str *a_pstrExtPack)
  * @returns @c true if it is, otherwise @c false.
  * @param   a_pszExtPack    The name of the extension pack.
  */
-bool ExtPackManager::isExtPackUsable(const char *a_pszExtPack)
+bool ExtPackManager::i_isExtPackUsable(const char *a_pszExtPack)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3229,7 +3049,7 @@ bool ExtPackManager::isExtPackUsable(const char *a_pszExtPack)
         return false;
     AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS);
 
-    ExtPack *pExtPack = findExtPack(a_pszExtPack);
+    ExtPack *pExtPack = i_findExtPack(a_pszExtPack);
     return pExtPack != NULL
         && pExtPack->m->fUsable;
 }
@@ -3237,7 +3057,7 @@ bool ExtPackManager::isExtPackUsable(const char *a_pszExtPack)
 /**
  * Dumps all extension packs to the release log.
  */
-void ExtPackManager::dumpAllToReleaseLog(void)
+void ExtPackManager::i_dumpAllToReleaseLog(void)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
@@ -3248,7 +3068,7 @@ void ExtPackManager::dumpAllToReleaseLog(void)
     LogRel(("Installed Extension Packs:\n"));
     for (ExtPackList::iterator it = m->llInstalledExtPacks.begin();
          it != m->llInstalledExtPacks.end();
-         it++)
+         ++it)
     {
         ExtPack::Data *pExtPackData = (*it)->m;
         if (pExtPackData)
diff --git a/src/VBox/Main/src-all/ExtPackUtil.cpp b/src/VBox/Main/src-all/ExtPackUtil.cpp
index 3e7aaf9..dd1e81f 100644
--- a/src/VBox/Main/src-all/ExtPackUtil.cpp
+++ b/src/VBox/Main/src-all/ExtPackUtil.cpp
@@ -1122,7 +1122,8 @@ int VBoxExtPackValidateMember(const char *pszName, RTVFSOBJTYPE enmType, RTVFSOB
  *                              "extpack" and be ready when the file system
  *                              stream is at an end.  Optional.
  */
-int VBoxExtPackOpenTarFss(RTFILE hTarballFile, char *pszError, size_t cbError, PRTVFSFSSTREAM phTarFss, PRTMANIFEST phFileManifest)
+int VBoxExtPackOpenTarFss(RTFILE hTarballFile, char *pszError, size_t cbError, PRTVFSFSSTREAM phTarFss,
+                          PRTMANIFEST phFileManifest)
 {
     Assert(cbError > 0);
     *pszError = '\0';
@@ -1146,7 +1147,8 @@ int VBoxExtPackOpenTarFss(RTFILE hTarballFile, char *pszError, size_t cbError, P
     if (RT_SUCCESS(rc))
     {
         RTVFSIOSTREAM hPtIos;
-        rc = RTManifestEntryAddPassthruIoStream(hFileManifest, hTarballIos, "extpack", RTMANIFEST_ATTR_SHA256, true /*read*/, &hPtIos);
+        rc = RTManifestEntryAddPassthruIoStream(hFileManifest, hTarballIos, "extpack", RTMANIFEST_ATTR_SHA256,
+                                                true /*read*/, &hPtIos);
         if (RT_SUCCESS(rc))
         {
             RTVFSIOSTREAM hGunzipIos;
@@ -1331,11 +1333,14 @@ int VBoxExtPackValidateTarball(RTFILE hTarballFile, const char *pszExtPackName,
         if (RT_SUCCESS(rc))
         {
             if (hXmlFile == NIL_RTVFSFILE)
-                rc = vboxExtPackReturnError(VERR_MISSING, pszError, cbError, "Mandator file '%s' is missing", VBOX_EXTPACK_DESCRIPTION_NAME);
+                rc = vboxExtPackReturnError(VERR_MISSING, pszError, cbError, "Mandator file '%s' is missing",
+                                            VBOX_EXTPACK_DESCRIPTION_NAME);
             if (hManifestFile == NIL_RTVFSFILE)
-                rc = vboxExtPackReturnError(VERR_MISSING, pszError, cbError, "Mandator file '%s' is missing", VBOX_EXTPACK_MANIFEST_NAME);
+                rc = vboxExtPackReturnError(VERR_MISSING, pszError, cbError, "Mandator file '%s' is missing",
+                                            VBOX_EXTPACK_MANIFEST_NAME);
             if (hSignatureFile == NIL_RTVFSFILE)
-                rc = vboxExtPackReturnError(VERR_MISSING, pszError, cbError, "Mandator file '%s' is missing", VBOX_EXTPACK_SIGNATURE_NAME);
+                rc = vboxExtPackReturnError(VERR_MISSING, pszError, cbError, "Mandator file '%s' is missing",
+                                            VBOX_EXTPACK_SIGNATURE_NAME);
         }
 
         /*
diff --git a/src/VBox/Main/src-all/Global.cpp b/src/VBox/Main/src-all/Global.cpp
index eca370b..78a4fe8 100644
--- a/src/VBox/Main/src-all/Global.cpp
+++ b/src/VBox/Main/src-all/Global.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2008-2013 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -211,7 +211,7 @@ const Global::OSType Global::sOSTypes[] =
         StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97  },
     { "Linux",   "Linux",             "RedHat_64",          "Red Hat (64 bit)",
       VBOXOSTYPE_RedHat_x64,      VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
-       512,  12,  8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
+       768,  12,  8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
         StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97  },
     { "Linux",   "Linux",             "Turbolinux",         "Turbolinux (32 bit)",
       VBOXOSTYPE_Turbolinux,      VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
@@ -243,7 +243,7 @@ const Global::OSType Global::sOSTypes[] =
         StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97  },
     { "Linux",   "Linux",             "Oracle_64",          "Oracle (64 bit)",
       VBOXOSTYPE_Oracle_x64,      VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC,
-       512,  12, 12 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
+       768,  12, 12 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE,
         StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97  },
     { "Linux",   "Linux",             "Linux",              "Other Linux (32 bit)",
       VBOXOSTYPE_Linux,           VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET,
@@ -313,6 +313,10 @@ const Global::OSType Global::sOSTypes[] =
       VBOXOSTYPE_ECS,             VBOXOSHINT_HWVIRTEX,
         256,  4,  2 * _1G64, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
         StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97  },
+    { "OS2",     "IBM OS/2",          "OS21x",              "OS/2 1.x",
+      VBOXOSTYPE_OS21x,           VBOXOSHINT_FLOPPY | VBOXOSHINT_NOUSB | VBOXOSHINT_TFRESET,
+        8, 4, 500 * _1M, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
+        StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16  },
     { "OS2",     "IBM OS/2",          "OS2",                "Other OS/2",
       VBOXOSTYPE_OS2,             VBOXOSHINT_HWVIRTEX | VBOXOSHINT_FLOPPY | VBOXOSHINT_NOUSB,
         96,   4,  2 * _1G64, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE,
@@ -443,9 +447,11 @@ Global::stringifyMachineState(MachineState_T aState)
         case MachineState_FaultTolerantSyncing: return "FaultTolerantSyncing";
         case MachineState_DeletingSnapshotOnline: return "DeletingSnapshotOnline";
         case MachineState_DeletingSnapshotPaused: return "DeletingSnapshotPaused";
+        case MachineState_OnlineSnapshotting:   return "OnlineSnapshotting";
         case MachineState_RestoringSnapshot:    return "RestoringSnapshot";
         case MachineState_DeletingSnapshot:     return "DeletingSnapshot";
         case MachineState_SettingUp:            return "SettingUp";
+        case MachineState_Snapshotting:         return "Snapshotting";
         default:
         {
             AssertMsgFailed(("%d (%#x)\n", aState, aState));
@@ -508,6 +514,7 @@ Global::stringifyReason(Reason_T aReason)
         case Reason_HostSuspend:      return "host suspend";
         case Reason_HostResume:       return "host resume";
         case Reason_HostBatteryLow:   return "host battery low";
+        case Reason_Snapshot:         return "snapshot";
         default:
         {
             AssertMsgFailed(("%d (%#x)\n", aReason, aReason));
diff --git a/src/VBox/Main/src-all/Logging.cpp b/src/VBox/Main/src-all/Logging.cpp
index 21f9de6..17b0797 100644
--- a/src/VBox/Main/src-all/Logging.cpp
+++ b/src/VBox/Main/src-all/Logging.cpp
@@ -1,3 +1,4 @@
+/* $Id: Logging.cpp $ */
 /** @file
  *
  * VirtualBox Main Logging
diff --git a/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp b/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp
index e984238..7eb7b3d 100644
--- a/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp
+++ b/src/VBox/Main/src-all/PCIDeviceAttachmentImpl.cpp
@@ -42,6 +42,7 @@ struct PCIDeviceAttachment::Data
 
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
+DEFINE_EMPTY_CTOR_DTOR(PCIDeviceAttachment)
 
 HRESULT PCIDeviceAttachment::FinalConstruct()
 {
@@ -70,15 +71,15 @@ HRESULT PCIDeviceAttachment::init(IMachine      *aParent,
     return m != NULL ? S_OK : E_FAIL;
 }
 
-HRESULT PCIDeviceAttachment::loadSettings(IMachine *aParent,
-                                          const settings::HostPCIDeviceAttachment &hpda)
+HRESULT PCIDeviceAttachment::i_loadSettings(IMachine *aParent,
+                                            const settings::HostPCIDeviceAttachment &hpda)
 {
     Bstr bname(hpda.strDeviceName);
     return init(aParent, bname,  hpda.uHostAddress, hpda.uGuestAddress, TRUE);
 }
 
 
-HRESULT PCIDeviceAttachment::saveSettings(settings::HostPCIDeviceAttachment &data)
+HRESULT PCIDeviceAttachment::i_saveSettings(settings::HostPCIDeviceAttachment &data)
 {
     Assert(m);
     data.uHostAddress = m->HostAddress;
@@ -103,34 +104,25 @@ void PCIDeviceAttachment::uninit()
 
 // IPCIDeviceAttachment properties
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP PCIDeviceAttachment::COMGETTER(Name)(BSTR * aName)
+HRESULT PCIDeviceAttachment::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-    m->DevName.cloneTo(aName);
+    aName = m->DevName;
     return S_OK;
 }
 
-STDMETHODIMP PCIDeviceAttachment::COMGETTER(IsPhysicalDevice)(BOOL * aPhysical)
+HRESULT PCIDeviceAttachment::getIsPhysicalDevice(BOOL *aIsPhysicalDevice)
 {
-    CheckComArgOutPointerValid(aPhysical);
-    *aPhysical = m->fPhysical;
+    *aIsPhysicalDevice = m->fPhysical;
     return S_OK;
 }
 
-STDMETHODIMP PCIDeviceAttachment::COMGETTER(HostAddress)(LONG * aHostAddress)
+HRESULT PCIDeviceAttachment::getHostAddress(LONG *aHostAddress)
 {
     *aHostAddress = m->HostAddress;
     return S_OK;
 }
-
-STDMETHODIMP PCIDeviceAttachment::COMGETTER(GuestAddress)(LONG * aGuestAddress)
+HRESULT PCIDeviceAttachment::getGuestAddress(LONG *aGuestAddress)
 {
     *aGuestAddress = m->GuestAddress;
     return S_OK;
 }
-
-#ifdef VBOX_WITH_XPCOM
-NS_DECL_CLASSINFO(PCIDeviceAttachment)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(PCIDeviceAttachment, IPCIDeviceAttachment)
-#endif
diff --git a/src/VBox/Main/src-all/ProgressImpl.cpp b/src/VBox/Main/src-all/ProgressImpl.cpp
index fa3ecea..bbdc9aa 100644
--- a/src/VBox/Main/src-all/ProgressImpl.cpp
+++ b/src/VBox/Main/src-all/ProgressImpl.cpp
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -54,162 +54,546 @@ Progress::~Progress()
 }
 
 
-// IProgress properties
-/////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP Progress::COMGETTER(Id)(BSTR *aId)
+HRESULT Progress::FinalConstruct()
 {
-    CheckComArgOutPointerValid(aId);
+    mCancelable = FALSE;
+    mCompleted = FALSE;
+    mCanceled = FALSE;
+    mResultCode = S_OK;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    m_cOperations
+        = m_ulTotalOperationsWeight
+        = m_ulOperationsCompletedWeight
+        = m_ulCurrentOperation
+        = m_ulCurrentOperationWeight
+        = m_ulOperationPercent
+        = m_cMsTimeout
+        = 0;
 
-    /* mId is constant during life time, no need to lock */
-    mId.toUtf16().cloneTo(aId);
+    // get creation timestamp
+    m_ullTimestamp = RTTimeMilliTS();
 
-    return S_OK;
+    m_pfnCancelCallback = NULL;
+    m_pvCancelUserArg = NULL;
+
+    mCompletedSem = NIL_RTSEMEVENTMULTI;
+    mWaitersCount = 0;
+
+    return Progress::BaseFinalConstruct();
 }
 
-STDMETHODIMP Progress::COMGETTER(Description)(BSTR *aDescription)
+void Progress::FinalRelease()
 {
-    CheckComArgOutPointerValid(aDescription);
+    uninit();
+    BaseFinalRelease();
+}
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+// public initializer/uninitializer for internal purposes only
+////////////////////////////////////////////////////////////////////////////////
 
-    /* mDescription is constant during life time, no need to lock */
-    mDescription.cloneTo(aDescription);
+/**
+ * Initializes the normal progress object. With this variant, one can have
+ * an arbitrary number of sub-operation which IProgress can analyze to
+ * have a weighted progress computed.
+ *
+ * For example, say that one IProgress is supposed to track the cloning
+ * of two hard disk images, which are 100 MB and 1000 MB in size, respectively,
+ * and each of these hard disks should be one sub-operation of the IProgress.
+ *
+ * Obviously the progress would be misleading if the progress displayed 50%
+ * after the smaller image was cloned and would then take much longer for
+ * the second half.
+ *
+ * With weighted progress, one can invoke the following calls:
+ *
+ * 1) create progress object with cOperations = 2 and ulTotalOperationsWeight =
+ *    1100 (100 MB plus 1100, but really the weights can be any ULONG); pass
+ *    in ulFirstOperationWeight = 100 for the first sub-operation
+ *
+ * 2) Then keep calling setCurrentOperationProgress() with a percentage
+ *    for the first image; the total progress will increase up to a value
+ *    of 9% (100MB / 1100MB * 100%).
+ *
+ * 3) Then call setNextOperation with the second weight (1000 for the megabytes
+ *    of the second disk).
+ *
+ * 4) Then keep calling setCurrentOperationProgress() with a percentage for
+ *    the second image, where 100% of the operation will then yield a 100%
+ *    progress of the entire task.
+ *
+ * Weighting is optional; you can simply assign a weight of 1 to each operation
+ * and pass ulTotalOperationsWeight == cOperations to this constructor (but
+ * for that variant and for backwards-compatibility a simpler constructor exists
+ * in ProgressImpl.h as well).
+ *
+ * Even simpler, if you need no sub-operations at all, pass in cOperations =
+ * ulTotalOperationsWeight = ulFirstOperationWeight = 1.
+ *
+ * @param aParent       Parent object (only for server-side Progress objects).
+ * @param aInitiator    Initiator of the task (for server-side objects. Can be
+ *                      NULL which means initiator = parent, otherwise must not
+ *                      be NULL).
+ * @param aDescription  Overall task description.
+ * @param aCancelable   Flag whether the task maybe canceled.
+ * @param cOperations   Number of operations within this task (at least 1).
+ * @param ulTotalOperationsWeight Total weight of operations; must be the sum of ulFirstOperationWeight and
+ *                          what is later passed with each subsequent setNextOperation() call.
+ * @param bstrFirstOperationDescription Description of the first operation.
+ * @param ulFirstOperationWeight Weight of first sub-operation.
+ */
+HRESULT Progress::init(
+#if !defined(VBOX_COM_INPROC)
+                       VirtualBox *aParent,
+#endif
+                       IUnknown *aInitiator,
+                       Utf8Str aDescription,
+                       BOOL aCancelable,
+                       ULONG cOperations,
+                       ULONG ulTotalOperationsWeight,
+                       Utf8Str aFirstOperationDescription,
+                       ULONG ulFirstOperationWeight)
+{
+    LogFlowThisFunc(("aDescription=\"%s\", cOperations=%d, ulTotalOperationsWeight=%d, aFirstOperationDescription=\"%s\", ulFirstOperationWeight=%d\n",
+                     aDescription.c_str(),
+                     cOperations,
+                     ulTotalOperationsWeight,
+                     aFirstOperationDescription.c_str(),
+                     ulFirstOperationWeight));
 
-    return S_OK;
-}
+    AssertReturn(ulTotalOperationsWeight >= 1, E_INVALIDARG);
 
-STDMETHODIMP Progress::COMGETTER(Initiator)(IUnknown **aInitiator)
-{
-    CheckComArgOutPointerValid(aInitiator);
+    /* Enclose the state transition NotReady->InInit->Ready */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    HRESULT rc = S_OK;
 
-    /* mInitiator/mParent are constant during life time, no need to lock */
+//    rc = Progress::init(
+//#if !defined(VBOX_COM_INPROC)
+//                        aParent,
+//#endif
+//                         aInitiator, aDescription, FALSE, aId);
+// NA
+#if !defined(VBOX_COM_INPROC)
+    AssertReturn(aParent, E_INVALIDARG);
+#else
+    AssertReturn(aInitiator, E_INVALIDARG);
+#endif
 
 #if !defined(VBOX_COM_INPROC)
-    if (mInitiator)
-        mInitiator.queryInterfaceTo(aInitiator);
-    else
+    /* share parent weakly */
+    unconst(mParent) = aParent;
+#endif
+
+#if !defined(VBOX_COM_INPROC)
+    /* assign (and therefore addref) initiator only if it is not VirtualBox
+     * (to avoid cycling); otherwise mInitiator will remain null which means
+     * that it is the same as the parent */
+    if (aInitiator)
     {
         ComObjPtr<VirtualBox> pVirtualBox(mParent);
-        pVirtualBox.queryInterfaceTo(aInitiator);
+        if (!(pVirtualBox == aInitiator))
+            unconst(mInitiator) = aInitiator;
     }
 #else
-    mInitiator.queryInterfaceTo(aInitiator);
+    unconst(mInitiator) = aInitiator;
 #endif
 
-    return S_OK;
-}
+    unconst(mId).create();
 
-STDMETHODIMP Progress::COMGETTER(Cancelable)(BOOL *aCancelable)
-{
-    CheckComArgOutPointerValid(aCancelable);
+#if !defined(VBOX_COM_INPROC)
+    /* add to the global collection of progress operations (note: after
+     * creating mId) */
+    mParent->i_addProgress(this);
+#endif
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    unconst(mDescription) = aDescription;
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aCancelable = mCancelable;
+// end of assertion
 
-    return S_OK;
+
+    if (FAILED(rc)) return rc;
+
+    mCancelable = aCancelable;
+
+    m_cOperations = cOperations;
+    m_ulTotalOperationsWeight = ulTotalOperationsWeight;
+    m_ulOperationsCompletedWeight = 0;
+    m_ulCurrentOperation = 0;
+    m_operationDescription = aFirstOperationDescription;
+    m_ulCurrentOperationWeight = ulFirstOperationWeight;
+    m_ulOperationPercent = 0;
+
+    int vrc = RTSemEventMultiCreate(&mCompletedSem);
+    ComAssertRCRet(vrc, E_FAIL);
+
+    RTSemEventMultiReset(mCompletedSem);
+
+    /* Confirm a successful initialization when it's the case */
+    if (SUCCEEDED(rc))
+        autoInitSpan.setSucceeded();
+
+    return rc;
 }
 
 /**
- * Internal helper to compute the total percent value based on the member values and
- * returns it as a "double". This is used both by GetPercent (which returns it as a
- * rounded ULONG) and GetTimeRemaining().
+ * Initializes the sub-progress object that represents a specific operation of
+ * the whole task.
  *
- * Requires locking by the caller!
+ * Objects initialized with this method are then combined together into the
+ * single task using a Progress instance, so it doesn't require the
+ * parent, initiator, description and doesn't create an ID. Note that calling
+ * respective getter methods on an object initialized with this method is
+ * useless. Such objects are used only to provide a separate wait semaphore and
+ * store individual operation descriptions.
  *
- * @return fractional percentage as a double value.
+ * @param aCancelable       Flag whether the task maybe canceled.
+ * @param aOperationCount   Number of sub-operations within this task (at least 1).
+ * @param aOperationDescription Description of the individual operation.
  */
-double Progress::calcTotalPercent()
+HRESULT Progress::init(BOOL aCancelable,
+                       ULONG aOperationCount,
+                       Utf8Str aOperationDescription)
 {
-    // avoid division by zero
-    if (m_ulTotalOperationsWeight == 0)
-        return 0;
+    LogFlowThisFunc(("aOperationDescription=\"%s\"\n", aOperationDescription.c_str()));
 
-    double dPercent = (    (double)m_ulOperationsCompletedWeight                                              // weight of operations that have been completed
-                         + ((double)m_ulOperationPercent * (double)m_ulCurrentOperationWeight / (double)100)  // plus partial weight of the current operation
-                      ) * (double)100 / (double)m_ulTotalOperationsWeight;
+    /* Enclose the state transition NotReady->InInit->Ready */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
 
-    return dPercent;
+    HRESULT rc = S_OK;
+    /* Guarantees subclasses call this method at the proper time */
+    NOREF(autoInitSpan);
+
+    if (FAILED(rc)) return rc;
+
+    mCancelable = aCancelable;
+
+    // for this variant we assume for now that all operations are weighed "1"
+    // and equal total weight = operation count
+    m_cOperations = aOperationCount;
+    m_ulTotalOperationsWeight = aOperationCount;
+    m_ulOperationsCompletedWeight = 0;
+    m_ulCurrentOperation = 0;
+    m_operationDescription = aOperationDescription;
+    m_ulCurrentOperationWeight = 1;
+    m_ulOperationPercent = 0;
+
+    int vrc = RTSemEventMultiCreate(&mCompletedSem);
+    ComAssertRCRet(vrc, E_FAIL);
+
+    RTSemEventMultiReset(mCompletedSem);
+
+    /* Confirm a successful initialization when it's the case */
+    if (SUCCEEDED(rc))
+        autoInitSpan.setSucceeded();
+
+    return rc;
 }
 
+
 /**
- * Internal helper for automatically timing out the operation.
+ * Uninitializes the instance and sets the ready flag to FALSE.
  *
- * The caller should hold the object write lock.
+ * Called either from FinalRelease() or by the parent when it gets destroyed.
  */
-void Progress::checkForAutomaticTimeout(void)
+void Progress::uninit()
 {
-    if (   m_cMsTimeout
-        && mCancelable
-        && !mCanceled
-        && RTTimeMilliTS() - m_ullTimestamp > m_cMsTimeout
-       )
-        Cancel();
-}
+    LogFlowThisFunc(("\n"));
 
+    /* Enclose the state transition Ready->InUninit->NotReady */
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
 
-STDMETHODIMP Progress::COMGETTER(TimeRemaining)(LONG *aTimeRemaining)
-{
-    CheckComArgOutPointerValid(aTimeRemaining);
+    /* wake up all threads still waiting on occasion */
+    if (mWaitersCount > 0)
+    {
+        LogFlow(("WARNING: There are still %d threads waiting for '%s' completion!\n",
+                 mWaitersCount, mDescription.c_str()));
+        RTSemEventMultiSignal(mCompletedSem);
+    }
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    RTSemEventMultiDestroy(mCompletedSem);
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    /* release initiator (effective only if mInitiator has been assigned in init()) */
+    unconst(mInitiator).setNull();
 
-    if (mCompleted)
-        *aTimeRemaining = 0;
-    else
+#if !defined(VBOX_COM_INPROC)
+    if (mParent)
     {
-        double dPercentDone = calcTotalPercent();
-        if (dPercentDone < 1)
-            *aTimeRemaining = -1;       // unreliable, or avoid division by 0 below
-        else
-        {
-            uint64_t ullTimeNow = RTTimeMilliTS();
-            uint64_t ullTimeElapsed = ullTimeNow - m_ullTimestamp;
-            uint64_t ullTimeTotal = (uint64_t)(ullTimeElapsed * 100 / dPercentDone);
-            uint64_t ullTimeRemaining = ullTimeTotal - ullTimeElapsed;
-
-//             Log(("Progress::GetTimeRemaining: dPercentDone %RI32, ullTimeNow = %RI64, ullTimeElapsed = %RI64, ullTimeTotal = %RI64, ullTimeRemaining = %RI64\n",
-//                         (uint32_t)dPercentDone, ullTimeNow, ullTimeElapsed, ullTimeTotal, ullTimeRemaining));
+        /* remove the added progress on failure to complete the initialization */
+        if (autoUninitSpan.initFailed() && mId.isValid() && !mId.isZero())
+            mParent->i_removeProgress(mId.ref());
 
-            *aTimeRemaining = (LONG)(ullTimeRemaining / 1000);
-        }
+        unconst(mParent) = NULL;
     }
-
-    return S_OK;
+#endif
 }
 
-STDMETHODIMP Progress::COMGETTER(Percent)(ULONG *aPercent)
+
+// public methods only for internal purposes
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Marks the whole task as complete and sets the result code.
+ *
+ * If the result code indicates a failure (|FAILED(@a aResultCode)|) then this
+ * method will import the error info from the current thread and assign it to
+ * the errorInfo attribute (it will return an error if no info is available in
+ * such case).
+ *
+ * If the result code indicates a success (|SUCCEEDED(@a aResultCode)|) then
+ * the current operation is set to the last.
+ *
+ * Note that this method may be called only once for the given Progress object.
+ * Subsequent calls will assert.
+ *
+ * @param aResultCode   Operation result code.
+ */
+HRESULT Progress::i_notifyComplete(HRESULT aResultCode)
+{
+    HRESULT rc;
+    ComPtr<IVirtualBoxErrorInfo> errorInfo;
+    if (FAILED(aResultCode))
+    {
+        /* try to import error info from the current thread */
+#if !defined(VBOX_WITH_XPCOM)
+        ComPtr<IErrorInfo> err;
+        rc = ::GetErrorInfo(0, err.asOutParam());
+        if (rc == S_OK && err)
+            rc = err.queryInterfaceTo(errorInfo.asOutParam());
+#else /* !defined(VBOX_WITH_XPCOM) */
+        nsCOMPtr<nsIExceptionService> es;
+        es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
+        if (NS_SUCCEEDED(rc))
+        {
+            nsCOMPtr <nsIExceptionManager> em;
+            rc = es->GetCurrentExceptionManager(getter_AddRefs(em));
+            if (NS_SUCCEEDED(rc))
+            {
+                ComPtr<nsIException> ex;
+                rc = em->GetCurrentException(ex.asOutParam());
+                if (NS_SUCCEEDED(rc) && ex)
+                    rc = ex.queryInterfaceTo(errorInfo.asOutParam());
+            }
+        }
+#endif /* !defined(VBOX_WITH_XPCOM) */
+    }
+
+    return i_notifyCompleteEI(aResultCode, errorInfo);
+}
+
+/**
+ * Wrapper around Progress:notifyCompleteV.
+ */
+HRESULT Progress::i_notifyComplete(HRESULT aResultCode,
+                                   const GUID &aIID,
+                                   const char *pcszComponent,
+                                   const char *aText,
+                                   ...)
+{
+    va_list va;
+    va_start(va, aText);
+    HRESULT hrc = i_notifyCompleteV(aResultCode, aIID, pcszComponent, aText, va);
+    va_end(va);
+    return hrc;
+}
+
+/**
+ * Marks the operation as complete and attaches full error info.
+ *
+ * @param aResultCode   Operation result (error) code, must not be S_OK.
+ * @param aIID          IID of the interface that defines the error.
+ * @param aComponent    Name of the component that generates the error.
+ * @param aText         Error message (must not be null), an RTStrPrintf-like
+ *                      format string in UTF-8 encoding.
+ * @param va            List of arguments for the format string.
+ */
+HRESULT Progress::i_notifyCompleteV(HRESULT aResultCode,
+                                    const GUID &aIID,
+                                    const char *pcszComponent,
+                                    const char *aText,
+                                    va_list va)
+{
+    /* expected to be used only in case of error */
+    Assert(FAILED(aResultCode));
+
+    Utf8Str text(aText, va);
+    ComObjPtr<VirtualBoxErrorInfo> errorInfo;
+    HRESULT rc = errorInfo.createObject();
+    AssertComRCReturnRC(rc);
+    errorInfo->init(aResultCode, aIID, pcszComponent, text);
+
+    return i_notifyCompleteEI(aResultCode, errorInfo);
+}
+
+/**
+ * Marks the operation as complete and attaches full error info.
+ *
+ * This is where the actual work is done, the related methods all end up here.
+ *
+ * @param aResultCode   Operation result (error) code, must not be S_OK.
+ * @param aErrorInfo            List of arguments for the format string.
+ */
+HRESULT Progress::i_notifyCompleteEI(HRESULT aResultCode, const ComPtr<IVirtualBoxErrorInfo> &aErrorInfo)
+{
+    LogThisFunc(("aResultCode=%d\n", aResultCode));
+    /* on failure we expect error info, on success there must be none */
+    AssertMsg(FAILED(aResultCode) ^ aErrorInfo.isNull(),
+              ("No error info but trying to set a failed result (%08X)!\n",
+               aResultCode));
+
+    AutoCaller autoCaller(this);
+    AssertComRCReturnRC(autoCaller.rc());
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    AssertReturn(mCompleted == FALSE, E_FAIL);
+
+    if (mCanceled && SUCCEEDED(aResultCode))
+        aResultCode = E_FAIL;
+
+    mCompleted = TRUE;
+    mResultCode = aResultCode;
+    if (SUCCEEDED(aResultCode))
+    {
+        m_ulCurrentOperation = m_cOperations - 1; /* last operation */
+        m_ulOperationPercent = 100;
+    }
+    mErrorInfo = aErrorInfo;
+
+#if !defined VBOX_COM_INPROC
+    /* remove from the global collection of pending progress operations */
+    if (mParent)
+        mParent->i_removeProgress(mId.ref());
+#endif
+
+    /* wake up all waiting threads */
+    if (mWaitersCount > 0)
+        RTSemEventMultiSignal(mCompletedSem);
+
+    return S_OK;
+}
+
+/**
+ * Notify the progress object that we're almost at the point of no return.
+ *
+ * This atomically checks for and disables cancelation.  Calls to
+ * IProgress::Cancel() made after a successful call to this method will fail
+ * and the user can be told.  While this isn't entirely clean behavior, it
+ * prevents issues with an irreversible actually operation succeeding while the
+ * user believe it was rolled back.
+ *
+ * @returns Success indicator.
+ * @retval  true on success.
+ * @retval  false if the progress object has already been canceled or is in an
+ *          invalid state
+ */
+bool Progress::i_notifyPointOfNoReturn(void)
 {
-    CheckComArgOutPointerValid(aPercent);
+    AutoCaller autoCaller(this);
+    AssertComRCReturn(autoCaller.rc(), false);
 
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (mCanceled)
+    {
+        LogThisFunc(("returns false\n"));
+        return false;
+    }
+
+    mCancelable = FALSE;
+    LogThisFunc(("returns true\n"));
+    return true;
+}
+
+/**
+ * Sets the cancelation callback, checking for cancelation first.
+ *
+ * @returns Success indicator.
+ * @retval  true on success.
+ * @retval  false if the progress object has already been canceled or is in an
+ *          invalid state
+ *
+ * @param   pfnCallback     The function to be called upon cancelation.
+ * @param   pvUser          The callback argument.
+ */
+bool Progress::i_setCancelCallback(void (*pfnCallback)(void *), void *pvUser)
+{
     AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    AssertComRCReturn(autoCaller.rc(), false);
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    i_checkForAutomaticTimeout();
+    if (mCanceled)
+        return false;
+
+    m_pvCancelUserArg   = pvUser;
+    m_pfnCancelCallback = pfnCallback;
+    return true;
+}
+
+
+// IProgress properties
+/////////////////////////////////////////////////////////////////////////////
+
+HRESULT Progress::getId(com::Guid &aId)
+{
+    /* mId is constant during life time, no need to lock */
+    aId = mId;
+
+    return S_OK;
+}
+
+HRESULT Progress::getDescription(com::Utf8Str &aDescription)
+{
+    /* mDescription is constant during life time, no need to lock */
+    aDescription = mDescription;
+
+    return S_OK;
+}
+HRESULT Progress::getInitiator(ComPtr<IUnknown> &aInitiator)
+{
+    /* mInitiator/mParent are constant during life time, no need to lock */
+#if !defined(VBOX_COM_INPROC)
+    if (mInitiator)
+        mInitiator.queryInterfaceTo(aInitiator.asOutParam());
+    else
+    {
+        ComObjPtr<VirtualBox> pVirtualBox(mParent);
+        pVirtualBox.queryInterfaceTo(aInitiator.asOutParam());
+    }
+#else
+    mInitiator.queryInterfaceTo(aInitiator.asOutParam());
+#endif
+
+    return S_OK;
+}
+
+HRESULT Progress::getCancelable(BOOL *aCancelable)
+{
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    checkForAutomaticTimeout();
+    *aCancelable = mCancelable;
+
+    return S_OK;
+}
 
-    /* checkForAutomaticTimeout requires a write lock. */
+HRESULT Progress::getPercent(ULONG *aPercent)
+{
+    /* i_checkForAutomaticTimeout requires a write lock. */
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mCompleted && SUCCEEDED(mResultCode))
         *aPercent = 100;
     else
     {
-        ULONG ulPercent = (ULONG)calcTotalPercent();
-        // do not report 100% until we're really really done with everything as the Qt GUI dismisses progress dialogs in that case
+        ULONG ulPercent = (ULONG)i_calcTotalPercent();
+        // do not report 100% until we're really really done with everything
+        // as the Qt GUI dismisses progress dialogs in that case
         if (    ulPercent == 100
              && (    m_ulOperationPercent < 100
                   || (m_ulCurrentOperation < m_cOperations -1)
@@ -220,32 +604,50 @@ STDMETHODIMP Progress::COMGETTER(Percent)(ULONG *aPercent)
             *aPercent = ulPercent;
     }
 
-    checkForAutomaticTimeout();
+    i_checkForAutomaticTimeout();
 
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(Completed)(BOOL *aCompleted)
+HRESULT Progress::getTimeRemaining(LONG *aTimeRemaining)
 {
-    CheckComArgOutPointerValid(aCompleted);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (mCompleted)
+        *aTimeRemaining = 0;
+    else
+    {
+        double dPercentDone = i_calcTotalPercent();
+        if (dPercentDone < 1)
+            *aTimeRemaining = -1;       // unreliable, or avoid division by 0 below
+        else
+        {
+            uint64_t ullTimeNow = RTTimeMilliTS();
+            uint64_t ullTimeElapsed = ullTimeNow - m_ullTimestamp;
+            uint64_t ullTimeTotal = (uint64_t)(ullTimeElapsed * 100 / dPercentDone);
+            uint64_t ullTimeRemaining = ullTimeTotal - ullTimeElapsed;
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+//          LogFunc(("dPercentDone = %RI32, ullTimeNow = %RI64, ullTimeElapsed = %RI64, ullTimeTotal = %RI64, ullTimeRemaining = %RI64\n",
+//                   (uint32_t)dPercentDone, ullTimeNow, ullTimeElapsed, ullTimeTotal, ullTimeRemaining));
 
-    *aCompleted = mCompleted;
+            *aTimeRemaining = (LONG)(ullTimeRemaining / 1000);
+        }
+    }
 
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(Canceled)(BOOL *aCanceled)
+HRESULT Progress::getCompleted(BOOL *aCompleted)
 {
-    CheckComArgOutPointerValid(aCanceled);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    *aCompleted = mCompleted;
+
+    return S_OK;
+}
 
+HRESULT Progress::getCanceled(BOOL *aCanceled)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aCanceled = mCanceled;
@@ -253,13 +655,8 @@ STDMETHODIMP Progress::COMGETTER(Canceled)(BOOL *aCanceled)
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(ResultCode)(LONG *aResultCode)
+HRESULT Progress::getResultCode(LONG *aResultCode)
 {
-    CheckComArgOutPointerValid(aResultCode);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (!mCompleted)
@@ -271,31 +668,21 @@ STDMETHODIMP Progress::COMGETTER(ResultCode)(LONG *aResultCode)
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(ErrorInfo)(IVirtualBoxErrorInfo **aErrorInfo)
+HRESULT Progress::getErrorInfo(ComPtr<IVirtualBoxErrorInfo> &aErrorInfo)
 {
-    CheckComArgOutPointerValid(aErrorInfo);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (!mCompleted)
         return setError(E_FAIL,
                         tr("Error info is not available, operation is still in progress"));
 
-    mErrorInfo.queryInterfaceTo(aErrorInfo);
+    mErrorInfo.queryInterfaceTo(aErrorInfo.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(OperationCount)(ULONG *aOperationCount)
+HRESULT Progress::getOperationCount(ULONG *aOperationCount)
 {
-    CheckComArgOutPointerValid(aOperationCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aOperationCount = m_cOperations;
@@ -303,13 +690,8 @@ STDMETHODIMP Progress::COMGETTER(OperationCount)(ULONG *aOperationCount)
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(Operation)(ULONG *aOperation)
+HRESULT Progress::getOperation(ULONG *aOperation)
 {
-    CheckComArgOutPointerValid(aOperation);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aOperation = m_ulCurrentOperation;
@@ -317,27 +699,17 @@ STDMETHODIMP Progress::COMGETTER(Operation)(ULONG *aOperation)
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(OperationDescription)(BSTR *aOperationDescription)
+HRESULT Progress::getOperationDescription(com::Utf8Str &aOperationDescription)
 {
-    CheckComArgOutPointerValid(aOperationDescription);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m_bstrOperationDescription.cloneTo(aOperationDescription);
+    aOperationDescription = m_operationDescription;
 
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(OperationPercent)(ULONG *aOperationPercent)
+HRESULT Progress::getOperationPercent(ULONG *aOperationPercent)
 {
-    CheckComArgOutPointerValid(aOperationPercent);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mCompleted && SUCCEEDED(mResultCode))
@@ -348,13 +720,8 @@ STDMETHODIMP Progress::COMGETTER(OperationPercent)(ULONG *aOperationPercent)
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMGETTER(OperationWeight)(ULONG *aOperationWeight)
+HRESULT Progress::getOperationWeight(ULONG *aOperationWeight)
 {
-    CheckComArgOutPointerValid(aOperationWeight);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aOperationWeight = m_ulCurrentOperationWeight;
@@ -362,358 +729,86 @@ STDMETHODIMP Progress::COMGETTER(OperationWeight)(ULONG *aOperationWeight)
     return S_OK;
 }
 
-STDMETHODIMP Progress::COMSETTER(Timeout)(ULONG aTimeout)
+HRESULT Progress::getTimeout(ULONG *aTimeout)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aTimeout = m_cMsTimeout;
 
+    return S_OK;
+}
+
+HRESULT Progress::setTimeout(ULONG aTimeout)
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (!mCancelable)
         return setError(VBOX_E_INVALID_OBJECT_STATE,
                         tr("Operation cannot be canceled"));
-
-    LogThisFunc(("%#x => %#x\n", m_cMsTimeout, aTimeout));
     m_cMsTimeout = aTimeout;
-    return S_OK;
-}
-
-STDMETHODIMP Progress::COMGETTER(Timeout)(ULONG *aTimeout)
-{
-    CheckComArgOutPointerValid(aTimeout);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    *aTimeout = m_cMsTimeout;
     return S_OK;
 }
 
-// public methods only for internal purposes
-////////////////////////////////////////////////////////////////////////////////
+
+// IProgress methods
+/////////////////////////////////////////////////////////////////////////////
 
 /**
- * Sets the cancelation callback, checking for cancelation first.
- *
- * @returns Success indicator.
- * @retval  true on success.
- * @retval  false if the progress object has already been canceled or is in an
- *          invalid state
+ * Updates the percentage value of the current operation.
  *
- * @param   pfnCallback     The function to be called upon cancelation.
- * @param   pvUser          The callback argument.
+ * @param aPercent  New percentage value of the operation in progress
+ *                  (in range [0, 100]).
  */
-bool Progress::setCancelCallback(void (*pfnCallback)(void *), void *pvUser)
+HRESULT Progress::setCurrentOperationProgress(ULONG aPercent)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), false);
+    AssertMsgReturn(aPercent <= 100, ("%u\n", aPercent), E_INVALIDARG);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    checkForAutomaticTimeout();
-    if (mCanceled)
-        return false;
-
-    m_pvCancelUserArg   = pvUser;
-    m_pfnCancelCallback = pfnCallback;
-    return true;
-}
-
-HRESULT Progress::FinalConstruct()
-{
-    mCancelable = FALSE;
-    mCompleted = FALSE;
-    mCanceled = FALSE;
-    mResultCode = S_OK;
-
-    m_cOperations
-        = m_ulTotalOperationsWeight
-        = m_ulOperationsCompletedWeight
-        = m_ulCurrentOperation
-        = m_ulCurrentOperationWeight
-        = m_ulOperationPercent
-        = m_cMsTimeout
-        = 0;
-
-    // get creation timestamp
-    m_ullTimestamp = RTTimeMilliTS();
-
-    m_pfnCancelCallback = NULL;
-    m_pvCancelUserArg = NULL;
-
-    HRESULT rc = Progress::BaseFinalConstruct();
-    if (FAILED(rc)) return rc;
+    i_checkForAutomaticTimeout();
+    if (mCancelable && mCanceled)
+        AssertReturn(!mCompleted, E_FAIL);
+    AssertReturn(!mCompleted && !mCanceled, E_FAIL);
 
-    mCompletedSem = NIL_RTSEMEVENTMULTI;
-    mWaitersCount = 0;
+    m_ulOperationPercent = aPercent;
 
     return S_OK;
 }
 
-void Progress::FinalRelease()
-{
-    uninit();
-    BaseFinalRelease();
-}
-
-// public initializer/uninitializer for internal purposes only
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Initializes the normal progress object. With this variant, one can have
- * an arbitrary number of sub-operation which IProgress can analyze to
- * have a weighted progress computed.
- *
- * For example, say that one IProgress is supposed to track the cloning
- * of two hard disk images, which are 100 MB and 1000 MB in size, respectively,
- * and each of these hard disks should be one sub-operation of the IProgress.
- *
- * Obviously the progress would be misleading if the progress displayed 50%
- * after the smaller image was cloned and would then take much longer for
- * the second half.
- *
- * With weighted progress, one can invoke the following calls:
- *
- * 1) create progress object with cOperations = 2 and ulTotalOperationsWeight =
- *    1100 (100 MB plus 1100, but really the weights can be any ULONG); pass
- *    in ulFirstOperationWeight = 100 for the first sub-operation
- *
- * 2) Then keep calling setCurrentOperationProgress() with a percentage
- *    for the first image; the total progress will increase up to a value
- *    of 9% (100MB / 1100MB * 100%).
- *
- * 3) Then call setNextOperation with the second weight (1000 for the megabytes
- *    of the second disk).
- *
- * 4) Then keep calling setCurrentOperationProgress() with a percentage for
- *    the second image, where 100% of the operation will then yield a 100%
- *    progress of the entire task.
- *
- * Weighting is optional; you can simply assign a weight of 1 to each operation
- * and pass ulTotalOperationsWeight == cOperations to this constructor (but
- * for that variant and for backwards-compatibility a simpler constructor exists
- * in ProgressImpl.h as well).
- *
- * Even simpler, if you need no sub-operations at all, pass in cOperations =
- * ulTotalOperationsWeight = ulFirstOperationWeight = 1.
- *
- * @param aParent           See Progress::init().
- * @param aInitiator        See Progress::init().
- * @param aDescription      See Progress::init().
- * @param aCancelable       Flag whether the task maybe canceled.
- * @param cOperations       Number of operations within this task (at least 1).
- * @param ulTotalOperationsWeight Total weight of operations; must be the sum of ulFirstOperationWeight and
- *                          what is later passed with each subsequent setNextOperation() call.
- * @param bstrFirstOperationDescription Description of the first operation.
- * @param ulFirstOperationWeight Weight of first sub-operation.
- * @param aId               See Progress::init().
- */
-HRESULT Progress::init(
-#if !defined(VBOX_COM_INPROC)
-                       VirtualBox *aParent,
-#endif
-                       IUnknown *aInitiator,
-                       CBSTR aDescription,
-                       BOOL aCancelable,
-                       ULONG cOperations,
-                       ULONG ulTotalOperationsWeight,
-                       CBSTR bstrFirstOperationDescription,
-                       ULONG ulFirstOperationWeight,
-                       OUT_GUID aId /* = NULL */)
-{
-    LogFlowThisFunc(("aDescription=\"%ls\", cOperations=%d, ulTotalOperationsWeight=%d, bstrFirstOperationDescription=\"%ls\", ulFirstOperationWeight=%d\n",
-                     aDescription,
-                     cOperations,
-                     ulTotalOperationsWeight,
-                     bstrFirstOperationDescription,
-                     ulFirstOperationWeight));
-
-    AssertReturn(bstrFirstOperationDescription, E_INVALIDARG);
-    AssertReturn(ulTotalOperationsWeight >= 1, E_INVALIDARG);
-
-    /* Enclose the state transition NotReady->InInit->Ready */
-    AutoInitSpan autoInitSpan(this);
-    AssertReturn(autoInitSpan.isOk(), E_FAIL);
-
-    HRESULT rc = S_OK;
-
-//    rc = Progress::init(
-//#if !defined(VBOX_COM_INPROC)
-//                        aParent,
-//#endif
-//                         aInitiator, aDescription, FALSE, aId);
-// NA
-#if !defined(VBOX_COM_INPROC)
-    AssertReturn(aParent, E_INVALIDARG);
-#else
-    AssertReturn(aInitiator, E_INVALIDARG);
-#endif
-
-    AssertReturn(aDescription, E_INVALIDARG);
-
-#if !defined(VBOX_COM_INPROC)
-    /* share parent weakly */
-    unconst(mParent) = aParent;
-#endif
-
-#if !defined(VBOX_COM_INPROC)
-    /* assign (and therefore addref) initiator only if it is not VirtualBox
- *      * (to avoid cycling); otherwise mInitiator will remain null which means
- *           * that it is the same as the parent */
-    if (aInitiator)
-    {
-        ComObjPtr<VirtualBox> pVirtualBox(mParent);
-        if (!(pVirtualBox == aInitiator))
-            unconst(mInitiator) = aInitiator;
-    }
-#else
-    unconst(mInitiator) = aInitiator;
-#endif
-
-    unconst(mId).create();
-    if (aId)
-        mId.cloneTo(aId);
-
-#if !defined(VBOX_COM_INPROC)
-    /* add to the global collection of progress operations (note: after
- *      * creating mId) */
-    mParent->addProgress(this);
-#endif
-
-    unconst(mDescription) = aDescription;
-
-
-// end of assertion
-
-
-    if (FAILED(rc)) return rc;
-
-    mCancelable = aCancelable;
-
-    m_cOperations = cOperations;
-    m_ulTotalOperationsWeight = ulTotalOperationsWeight;
-    m_ulOperationsCompletedWeight = 0;
-    m_ulCurrentOperation = 0;
-    m_bstrOperationDescription = bstrFirstOperationDescription;
-    m_ulCurrentOperationWeight = ulFirstOperationWeight;
-    m_ulOperationPercent = 0;
-
-    int vrc = RTSemEventMultiCreate(&mCompletedSem);
-    ComAssertRCRet(vrc, E_FAIL);
-
-    RTSemEventMultiReset(mCompletedSem);
-
-    /* Confirm a successful initialization when it's the case */
-    if (SUCCEEDED(rc))
-        autoInitSpan.setSucceeded();
-
-    return rc;
-}
-
 /**
- * Initializes the sub-progress object that represents a specific operation of
- * the whole task.
+ * Signals that the current operation is successfully completed and advances to
+ * the next operation. The operation percentage is reset to 0.
  *
- * Objects initialized with this method are then combined together into the
- * single task using a Progress instance, so it doesn't require the
- * parent, initiator, description and doesn't create an ID. Note that calling
- * respective getter methods on an object initialized with this method is
- * useless. Such objects are used only to provide a separate wait semaphore and
- * store individual operation descriptions.
+ * @param aOperationDescription     Description of the next operation.
  *
- * @param aCancelable       Flag whether the task maybe canceled.
- * @param aOperationCount   Number of sub-operations within this task (at least 1).
- * @param aOperationDescription Description of the individual operation.
+ * @note The current operation must not be the last one.
  */
-HRESULT Progress::init(BOOL aCancelable,
-                       ULONG aOperationCount,
-                       CBSTR aOperationDescription)
+HRESULT Progress::setNextOperation(const com::Utf8Str &aNextOperationDescription, ULONG aNextOperationsWeight)
 {
-    LogFlowThisFunc(("aOperationDescription=\"%ls\"\n", aOperationDescription));
-
-    /* Enclose the state transition NotReady->InInit->Ready */
-    AutoInitSpan autoInitSpan(this);
-    AssertReturn(autoInitSpan.isOk(), E_FAIL);
-
-    HRESULT rc = S_OK;
-    /* Guarantees subclasses call this method at the proper time */
-    NOREF(autoInitSpan);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (FAILED(rc)) return rc;
+    if (mCanceled)
+        return E_FAIL;
+    AssertReturn(!mCompleted, E_FAIL);
+    AssertReturn(m_ulCurrentOperation + 1 < m_cOperations, E_FAIL);
 
-    mCancelable = aCancelable;
+    ++m_ulCurrentOperation;
+    m_ulOperationsCompletedWeight += m_ulCurrentOperationWeight;
 
-    // for this variant we assume for now that all operations are weighed "1"
-    // and equal total weight = operation count
-    m_cOperations = aOperationCount;
-    m_ulTotalOperationsWeight = aOperationCount;
-    m_ulOperationsCompletedWeight = 0;
-    m_ulCurrentOperation = 0;
-    m_bstrOperationDescription = aOperationDescription;
-    m_ulCurrentOperationWeight = 1;
+    m_operationDescription = aNextOperationDescription;
+    m_ulCurrentOperationWeight = aNextOperationsWeight;
     m_ulOperationPercent = 0;
 
-    int vrc = RTSemEventMultiCreate(&mCompletedSem);
-    ComAssertRCRet(vrc, E_FAIL);
-
-    RTSemEventMultiReset(mCompletedSem);
-
-    /* Confirm a successful initialization when it's the case */
-    if (SUCCEEDED(rc))
-        autoInitSpan.setSucceeded();
-
-    return rc;
-}
-
-
-/**
- * Uninitializes the instance and sets the ready flag to FALSE.
- *
- * Called either from FinalRelease() or by the parent when it gets destroyed.
- */
-void Progress::uninit()
-{
-    LogFlowThisFunc(("\n"));
-
-    /* Enclose the state transition Ready->InUninit->NotReady */
-    AutoUninitSpan autoUninitSpan(this);
-    if (autoUninitSpan.uninitDone())
-        return;
+    LogThisFunc(("%s: aNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n",
+                 m_operationDescription.c_str(), aNextOperationsWeight, m_ulCurrentOperation, m_ulOperationsCompletedWeight));
 
-    /* wake up all threads still waiting on occasion */
-    if (mWaitersCount > 0)
-    {
-        LogFlow(("WARNING: There are still %d threads waiting for '%ls' completion!\n",
-                 mWaitersCount, mDescription.raw()));
-        RTSemEventMultiSignal(mCompletedSem);
-    }
-
-    RTSemEventMultiDestroy(mCompletedSem);
-
-    /* release initiator (effective only if mInitiator has been assigned in
- *      * init()) */
-    unconst(mInitiator).setNull();
-
-#if !defined(VBOX_COM_INPROC)
-    if (mParent)
-    {
-        /* remove the added progress on failure to complete the initialization */
-        if (autoUninitSpan.initFailed() && mId.isValid() && !mId.isZero())
-            mParent->removeProgress(mId.ref());
-
-        unconst(mParent) = NULL;
-    }
-#endif
-}
-
-
-// IProgress properties
-/////////////////////////////////////////////////////////////////////////////
+    /* wake up all waiting threads */
+    if (mWaitersCount > 0)
+        RTSemEventMultiSignal(mCompletedSem);
 
-// IProgress methods
-/////////////////////////////////////////////////////////////////////////////
+    return S_OK;
+}
 
 /**
  * @note XPCOM: when this method is not called on the main XPCOM thread, it
@@ -721,14 +816,11 @@ void Progress::uninit()
  *       thread has its own event queue (hmm, what for?) that it must run, then
  *       calling this method will definitely freeze event processing.
  */
-STDMETHODIMP Progress::WaitForCompletion(LONG aTimeout)
+HRESULT Progress::waitForCompletion(LONG aTimeout)
 {
     LogFlowThisFuncEnter();
     LogFlowThisFunc(("aTimeout=%d\n", aTimeout));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* if we're already completed, take a shortcut */
@@ -780,14 +872,12 @@ STDMETHODIMP Progress::WaitForCompletion(LONG aTimeout)
  *       thread has its own event queue (hmm, what for?) that it must run, then
  *       calling this method will definitely freeze event processing.
  */
-STDMETHODIMP Progress::WaitForOperationCompletion(ULONG aOperation, LONG aTimeout)
+HRESULT Progress::waitForOperationCompletion(ULONG aOperation, LONG aTimeout)
+
 {
     LogFlowThisFuncEnter();
     LogFlowThisFunc(("aOperation=%d, aTimeout=%d\n", aOperation, aTimeout));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     CheckComArgExpr(aOperation, aOperation < m_cOperations);
@@ -838,15 +928,10 @@ STDMETHODIMP Progress::WaitForOperationCompletion(ULONG aOperation, LONG aTimeou
     return S_OK;
 }
 
-STDMETHODIMP Progress::WaitForAsyncProgressCompletion(IProgress *pProgressAsync)
+HRESULT Progress::waitForAsyncProgressCompletion(const ComPtr<IProgress> &aPProgressAsync)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgNotNull(pProgressAsync);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* Note: we don't lock here, cause we just using public methods. */
 
     HRESULT rc           = S_OK;
@@ -857,10 +942,10 @@ STDMETHODIMP Progress::WaitForAsyncProgressCompletion(IProgress *pProgressAsync)
     ULONG currentPercent = 0;
     ULONG cOp            = 0;
     /* Is the async process cancelable? */
-    rc = pProgressAsync->COMGETTER(Cancelable)(&fCancelable);
+    rc = aPProgressAsync->COMGETTER(Cancelable)(&fCancelable);
     if (FAILED(rc)) return rc;
     /* Loop as long as the sync process isn't completed. */
-    while (SUCCEEDED(pProgressAsync->COMGETTER(Completed(&fCompleted))))
+    while (SUCCEEDED(aPProgressAsync->COMGETTER(Completed(&fCompleted))))
     {
         /* We can forward any cancel request to the async process only when
          * it is cancelable. */
@@ -870,7 +955,7 @@ STDMETHODIMP Progress::WaitForAsyncProgressCompletion(IProgress *pProgressAsync)
             if (FAILED(rc)) return rc;
             if (fCanceled)
             {
-                rc = pProgressAsync->Cancel();
+                rc = aPProgressAsync->Cancel();
                 if (FAILED(rc)) return rc;
             }
         }
@@ -887,15 +972,15 @@ STDMETHODIMP Progress::WaitForAsyncProgressCompletion(IProgress *pProgressAsync)
             ULONG curOp;
             for (;;)
             {
-                rc = pProgressAsync->COMGETTER(Operation(&curOp));
+                rc = aPProgressAsync->COMGETTER(Operation(&curOp));
                 if (FAILED(rc)) return rc;
                 if (cOp != curOp)
                 {
                     Bstr bstr;
                     ULONG currentWeight;
-                    rc = pProgressAsync->COMGETTER(OperationDescription(bstr.asOutParam()));
+                    rc = aPProgressAsync->COMGETTER(OperationDescription(bstr.asOutParam()));
                     if (FAILED(rc)) return rc;
-                    rc = pProgressAsync->COMGETTER(OperationWeight(&currentWeight));
+                    rc = aPProgressAsync->COMGETTER(OperationWeight(&currentWeight));
                     if (FAILED(rc)) return rc;
                     rc = SetNextOperation(bstr.raw(), currentWeight);
                     if (FAILED(rc)) return rc;
@@ -905,7 +990,7 @@ STDMETHODIMP Progress::WaitForAsyncProgressCompletion(IProgress *pProgressAsync)
                     break;
             }
 
-            rc = pProgressAsync->COMGETTER(OperationPercent(&currentPercent));
+            rc = aPProgressAsync->COMGETTER(OperationPercent(&currentPercent));
             if (FAILED(rc)) return rc;
             if (currentPercent != prevPercent)
             {
@@ -918,7 +1003,7 @@ STDMETHODIMP Progress::WaitForAsyncProgressCompletion(IProgress *pProgressAsync)
             break;
 
         /* Make sure the loop is not too tight */
-        rc = pProgressAsync->WaitForCompletion(100);
+        rc = aPProgressAsync->WaitForCompletion(100);
         if (FAILED(rc)) return rc;
     }
 
@@ -927,11 +1012,8 @@ STDMETHODIMP Progress::WaitForAsyncProgressCompletion(IProgress *pProgressAsync)
     return rc;
 }
 
-STDMETHODIMP Progress::Cancel()
+HRESULT Progress::cancel()
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (!mCancelable)
@@ -952,295 +1034,45 @@ STDMETHODIMP Progress::Cancel()
     return S_OK;
 }
 
-/**
- * Updates the percentage value of the current operation.
- *
- * @param aPercent  New percentage value of the operation in progress
- *                  (in range [0, 100]).
- */
-STDMETHODIMP Progress::SetCurrentOperationProgress(ULONG aPercent)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    AssertMsgReturn(aPercent <= 100, ("%u\n", aPercent), E_INVALIDARG);
-
-    checkForAutomaticTimeout();
-    if (mCancelable && mCanceled)
-    {
-        Assert(!mCompleted);
-        return E_FAIL;
-    }
-    AssertReturn(!mCompleted && !mCanceled, E_FAIL);
-
-    m_ulOperationPercent = aPercent;
-
-    return S_OK;
-}
-
-/**
- * Signals that the current operation is successfully completed and advances to
- * the next operation. The operation percentage is reset to 0.
- *
- * @param aOperationDescription     Description of the next operation.
- *
- * @note The current operation must not be the last one.
- */
-STDMETHODIMP Progress::SetNextOperation(IN_BSTR bstrNextOperationDescription, ULONG ulNextOperationsWeight)
-{
-    AssertReturn(bstrNextOperationDescription, E_INVALIDARG);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (mCanceled)
-        return E_FAIL;
-    AssertReturn(!mCompleted, E_FAIL);
-    AssertReturn(m_ulCurrentOperation + 1 < m_cOperations, E_FAIL);
-
-    ++m_ulCurrentOperation;
-    m_ulOperationsCompletedWeight += m_ulCurrentOperationWeight;
-
-    m_bstrOperationDescription = bstrNextOperationDescription;
-    m_ulCurrentOperationWeight = ulNextOperationsWeight;
-    m_ulOperationPercent = 0;
-
-    Log(("Progress::setNextOperation(%ls): ulNextOperationsWeight = %d; m_ulCurrentOperation is now %d, m_ulOperationsCompletedWeight is now %d\n",
-         m_bstrOperationDescription.raw(), ulNextOperationsWeight, m_ulCurrentOperation, m_ulOperationsCompletedWeight));
-
-    /* wake up all waiting threads */
-    if (mWaitersCount > 0)
-        RTSemEventMultiSignal(mCompletedSem);
-
-    return S_OK;
-}
 
-// public methods only for internal purposes
+// private internal helpers
 /////////////////////////////////////////////////////////////////////////////
 
 /**
- * Sets the internal result code and attempts to retrieve additional error
- * info from the current thread. Gets called from Progress::notifyComplete(),
- * but can be called again to override a previous result set with
- * notifyComplete().
- *
- * @param aResultCode
- */
-HRESULT Progress::setResultCode(HRESULT aResultCode)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    mResultCode = aResultCode;
-
-    HRESULT rc = S_OK;
-
-    if (FAILED(aResultCode))
-    {
-        /* try to import error info from the current thread */
-
-#if !defined(VBOX_WITH_XPCOM)
-
-        ComPtr<IErrorInfo> err;
-        rc = ::GetErrorInfo(0, err.asOutParam());
-        if (rc == S_OK && err)
-        {
-            rc = err.queryInterfaceTo(mErrorInfo.asOutParam());
-            if (SUCCEEDED(rc) && !mErrorInfo)
-                rc = E_FAIL;
-        }
-
-#else /* !defined(VBOX_WITH_XPCOM) */
-
-        nsCOMPtr<nsIExceptionService> es;
-        es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
-        if (NS_SUCCEEDED(rc))
-        {
-            nsCOMPtr <nsIExceptionManager> em;
-            rc = es->GetCurrentExceptionManager(getter_AddRefs(em));
-            if (NS_SUCCEEDED(rc))
-            {
-                ComPtr<nsIException> ex;
-                rc = em->GetCurrentException(ex.asOutParam());
-                if (NS_SUCCEEDED(rc) && ex)
-                {
-                    rc = ex.queryInterfaceTo(mErrorInfo.asOutParam());
-                    if (NS_SUCCEEDED(rc) && !mErrorInfo)
-                        rc = E_FAIL;
-                }
-            }
-        }
-#endif /* !defined(VBOX_WITH_XPCOM) */
-
-        AssertMsg(rc == S_OK, ("Couldn't get error info (rc=%08X) while trying to set a failed result (%08X)!\n",
-                               rc, aResultCode));
-    }
-
-    return rc;
-}
-
-/**
- * Marks the whole task as complete and sets the result code.
- *
- * If the result code indicates a failure (|FAILED(@a aResultCode)|) then this
- * method will import the error info from the current thread and assign it to
- * the errorInfo attribute (it will return an error if no info is available in
- * such case).
- *
- * If the result code indicates a success (|SUCCEEDED(@a aResultCode)|) then
- * the current operation is set to the last.
- *
- * Note that this method may be called only once for the given Progress object.
- * Subsequent calls will assert.
- *
- * @param aResultCode   Operation result code.
- */
-HRESULT Progress::notifyComplete(HRESULT aResultCode)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    AssertReturn(mCompleted == FALSE, E_FAIL);
-
-    LogFunc(("aResultCode=%d\n", aResultCode));
-
-    if (mCanceled && SUCCEEDED(aResultCode))
-        aResultCode = E_FAIL;
-
-    HRESULT rc = setResultCode(aResultCode);
-
-    mCompleted = TRUE;
-
-    if (!FAILED(aResultCode))
-    {
-        m_ulCurrentOperation = m_cOperations - 1; /* last operation */
-        m_ulOperationPercent = 100;
-    }
-
-#if !defined VBOX_COM_INPROC
-    /* remove from the global collection of pending progress operations */
-    if (mParent)
-        mParent->removeProgress(mId.ref());
-#endif
-
-    /* wake up all waiting threads */
-    if (mWaitersCount > 0)
-        RTSemEventMultiSignal(mCompletedSem);
-
-    return rc;
-}
-
-/**
- * Wrapper around Progress:notifyCompleteV.
- */
-HRESULT Progress::notifyComplete(HRESULT aResultCode,
-                                 const GUID &aIID,
-                                 const char *pcszComponent,
-                                 const char *aText,
-                                 ...)
-{
-    va_list va;
-    va_start(va, aText);
-    HRESULT hrc = notifyCompleteV(aResultCode, aIID, pcszComponent, aText, va);
-    va_end(va);
-    return hrc;
-}
-
-/**
- * Marks the operation as complete and attaches full error info.
+ * Internal helper to compute the total percent value based on the member values and
+ * returns it as a "double". This is used both by GetPercent (which returns it as a
+ * rounded ULONG) and GetTimeRemaining().
  *
- * See VirtualBoxBase::setError(HRESULT, const GUID &, const wchar_t
- * *, const char *, ...) for more info.
+ * Requires locking by the caller!
  *
- * @param aResultCode   Operation result (error) code, must not be S_OK.
- * @param aIID          IID of the interface that defines the error.
- * @param aComponent    Name of the component that generates the error.
- * @param aText         Error message (must not be null), an RTStrPrintf-like
- *                      format string in UTF-8 encoding.
- * @param va            List of arguments for the format string.
+ * @return fractional percentage as a double value.
  */
-HRESULT Progress::notifyCompleteV(HRESULT aResultCode,
-                                  const GUID &aIID,
-                                  const char *pcszComponent,
-                                  const char *aText,
-                                  va_list va)
+double Progress::i_calcTotalPercent()
 {
-    Utf8Str text(aText, va);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    AssertReturn(mCompleted == FALSE, E_FAIL);
-
-    if (mCanceled && SUCCEEDED(aResultCode))
-        aResultCode = E_FAIL;
-
-    mCompleted = TRUE;
-    mResultCode = aResultCode;
-
-    AssertReturn(FAILED(aResultCode), E_FAIL);
-
-    ComObjPtr<VirtualBoxErrorInfo> errorInfo;
-    HRESULT rc = errorInfo.createObject();
-    AssertComRC(rc);
-    if (SUCCEEDED(rc))
-    {
-        errorInfo->init(aResultCode, aIID, pcszComponent, text);
-        errorInfo.queryInterfaceTo(mErrorInfo.asOutParam());
-    }
-
-#if !defined VBOX_COM_INPROC
-    /* remove from the global collection of pending progress operations */
-    if (mParent)
-        mParent->removeProgress(mId.ref());
-#endif
+    // avoid division by zero
+    if (m_ulTotalOperationsWeight == 0)
+        return 0.0;
 
-    /* wake up all waiting threads */
-    if (mWaitersCount > 0)
-        RTSemEventMultiSignal(mCompletedSem);
+    double dPercent = (    (double)m_ulOperationsCompletedWeight  // weight of operations that have been completed
+                         + ((double)m_ulOperationPercent *
+                            (double)m_ulCurrentOperationWeight / 100.0)  // plus partial weight of the current operation
+                      ) * 100.0 / (double)m_ulTotalOperationsWeight;
 
-    return rc;
+    return dPercent;
 }
 
 /**
- * Notify the progress object that we're almost at the point of no return.
- *
- * This atomically checks for and disables cancelation.  Calls to
- * IProgress::Cancel() made after a successful call to this method will fail
- * and the user can be told.  While this isn't entirely clean behavior, it
- * prevents issues with an irreversible actually operation succeeding while the
- * user believe it was rolled back.
+ * Internal helper for automatically timing out the operation.
  *
- * @returns Success indicator.
- * @retval  true on success.
- * @retval  false if the progress object has already been canceled or is in an
- *          invalid state
+ * The caller must hold the object write lock.
  */
-bool Progress::notifyPointOfNoReturn(void)
+void Progress::i_checkForAutomaticTimeout(void)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), false);
+    AssertReturnVoid(isWriteLockOnCurrentThread());
 
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (mCanceled)
-    {
-        LogThisFunc(("returns false\n"));
-        return false;
-    }
-
-    mCancelable = FALSE;
-    LogThisFunc(("returns true\n"));
-    return true;
+    if (   m_cMsTimeout
+        && mCancelable
+        && !mCanceled
+        && RTTimeMilliTS() - m_ullTimestamp > m_cMsTimeout)
+        Cancel();
 }
-
diff --git a/src/VBox/Main/src-all/QMTranslatorImpl.cpp b/src/VBox/Main/src-all/QMTranslatorImpl.cpp
new file mode 100644
index 0000000..5ee0999
--- /dev/null
+++ b/src/VBox/Main/src-all/QMTranslatorImpl.cpp
@@ -0,0 +1,433 @@
+/* $Id: QMTranslatorImpl.cpp $ */
+/** @file
+ * VirtualBox API translation handling class
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <vector>
+#include <set>
+#include <algorithm>
+#include <iterator>
+#include <iprt/file.h>
+#include <iprt/asm.h>
+#include <VBox/com/string.h>
+#include <VBox/log.h>
+#include <QMTranslator.h>
+
+/* QM File Magic Number */
+static const size_t MagicLength = 16;
+static const uint8_t Magic[MagicLength] = {
+    0x3c, 0xb8, 0x64, 0x18, 0xca, 0xef, 0x9c, 0x95,
+    0xcd, 0x21, 0x1c, 0xbf, 0x60, 0xa1, 0xbd, 0xdd
+};
+
+/* Used internally */
+class QMException : public std::exception
+{
+    const char *m_str;
+public:
+    QMException(const char *str) : m_str(str) {}
+    virtual const char *what() const throw() { return m_str; }
+};
+
+/* Bytes stream. Used by the parser to iterate through the data */
+class QMBytesStream
+{
+    size_t m_cbSize;
+    const uint8_t * const m_dataStart;
+    const uint8_t *m_iter;
+    const uint8_t *m_end;
+
+    /* Function stub for transform method */
+    static uint16_t func_BE2H_U16(uint16_t value)
+    {
+        return RT_BE2H_U16(value);
+    }
+
+public:
+
+    QMBytesStream(const uint8_t *const dataStart, size_t cbSize) :
+        m_cbSize(dataStart ? cbSize : 0),
+        m_dataStart(dataStart),
+        m_iter(dataStart)
+    {
+        setEnd();
+    }
+
+    /* Sets end pointer
+     * Used in message reader to detect the end of message block */
+    inline void setEnd(size_t pos = 0)
+    {
+        m_end = m_dataStart + (pos && pos < m_cbSize ? pos : m_cbSize);
+    }
+
+    inline uint8_t read8()
+    {
+        checkSize(1);
+        return *m_iter++;
+    }
+
+    inline uint32_t read32()
+    {
+        checkSize(4);
+        uint32_t result = *reinterpret_cast<const uint32_t *>(m_iter);
+        m_iter += 4;
+        return RT_BE2H_U32(result);
+    }
+
+    /* Reads string in UTF16 and converts it into a UTF8 string */
+    inline com::Utf8Str readUtf16String()
+    {
+        uint32_t size = read32();
+        checkSize(size);
+        if (size & 1) throw QMException("Incorrect string size");
+        std::vector<uint16_t> wstr;
+        wstr.reserve(size / 2);
+
+        /* We cannot convert to host endianess without copying the data
+         * since the file might be mapped to the memory and any memory
+         * change will lead to the change of the file. */
+        std::transform(reinterpret_cast<const uint16_t *>(m_iter),
+                       reinterpret_cast<const uint16_t *>(m_iter + size),
+                       std::back_inserter(wstr),
+                       func_BE2H_U16);
+        m_iter += size;
+        return com::Utf8Str((CBSTR) &wstr.front(), wstr.size());
+    }
+
+    /* Reads string in one-byte encoding
+     * The string is assumed to be in ISO-8859-1 encoding */
+    inline com::Utf8Str readString()
+    {
+        uint32_t size = read32();
+        checkSize(size);
+        com::Utf8Str result(reinterpret_cast<const char *>(m_iter), size);
+        m_iter += size;
+        return result;
+    }
+
+    /* Checks the magic number
+     * Should be called when in the beginning of the data */
+    inline void checkMagic()
+    {
+        checkSize(MagicLength);
+        if (memcmp(&(*m_iter), Magic, MagicLength)) throw QMException("Wrong magic number");
+        m_iter += MagicLength;
+    }
+
+    /* Has we reached the end pointer? */
+    inline bool hasFinished() { return m_iter == m_end; }
+
+    /* Returns current stream position */
+    inline size_t tellPos() { return m_iter - m_dataStart; }
+
+    /* Moves current pointer to a desired position */
+    inline void seek(int pos) { m_iter += pos; }
+
+    /* Checks whether stream has enough data to read size bytes */
+    inline void checkSize(int size)
+    {
+        if (m_end - m_iter < size) throw QMException("Incorrect item size");
+    }
+};
+
+/* Internal QMTranslator implementation */
+class QMTranslator_Impl
+{
+    struct QMMessage
+    {
+        /* Everything is in UTF-8 */
+        com::Utf8Str strContext;
+        com::Utf8Str strTranslation;
+        com::Utf8Str strComment;
+        com::Utf8Str strSource;
+        uint32_t     hash;
+        QMMessage() : hash(0) {}
+    };
+
+    struct HashOffset
+    {
+        uint32_t hash;
+        uint32_t offset;
+
+        HashOffset(uint32_t _hash = 0, uint32_t _offs = 0) : hash(_hash), offset(_offs) {}
+
+        bool operator<(const HashOffset &obj) const
+        {
+            return (hash != obj.hash ? hash < obj.hash : offset < obj.offset);
+        }
+
+    };
+
+    typedef std::set<HashOffset> QMHashSet;
+    typedef QMHashSet::const_iterator QMHashSetConstIter;
+    typedef std::vector<QMMessage> QMMessageArray;
+
+    QMHashSet m_hashSet;
+    QMMessageArray m_messageArray;
+
+public:
+
+    QMTranslator_Impl() {}
+
+    const char *translate(const char *pszContext,
+                          const char *pszSource,
+                          const char *pszDisamb) const
+    {
+        QMHashSetConstIter iter;
+        QMHashSetConstIter lowerIter, upperIter;
+
+        do {
+            uint32_t hash = calculateHash(pszSource, pszDisamb);
+            lowerIter = m_hashSet.lower_bound(HashOffset(hash, 0));
+            upperIter = m_hashSet.upper_bound(HashOffset(hash, ~0));
+
+            for (iter = lowerIter; iter != upperIter; ++iter)
+            {
+                const QMMessage &message = m_messageArray[iter->offset];
+                if ((!pszContext || !*pszContext || message.strContext == pszContext) &&
+                    message.strSource == pszSource &&
+                    ((pszDisamb && !*pszDisamb) || message.strComment == pszDisamb))
+                    break;
+            }
+
+            /* Try without disambiguating comment if it isn't empty */
+            if (pszDisamb)
+            {
+                if (!*pszDisamb) pszDisamb = 0;
+                else pszDisamb = "";
+            }
+
+        } while (iter == upperIter && pszDisamb);
+
+        return (iter != upperIter ? m_messageArray[iter->offset].strTranslation.c_str() : "");
+    }
+
+    void load(QMBytesStream &stream)
+    {
+        /* Load into local variables. If we failed during the load,
+         * it would allow us to keep the object in a valid (previous) state. */
+        QMHashSet hashSet;
+        QMMessageArray messageArray;
+
+        stream.checkMagic();
+
+        while (!stream.hasFinished())
+        {
+            uint32_t sectionCode = stream.read8();
+            uint32_t sLen = stream.read32();
+
+            /* Hashes and Context sections are ignored. They contain hash tables
+             * to speed-up search which is not useful since we recalculate all hashes
+             * and don't perform context search by hash */
+            switch (sectionCode)
+            {
+                case Messages:
+                parseMessages(stream, &hashSet, &messageArray, sLen);
+                break;
+                case Hashes:
+                /* Only get size information to speed-up vector filling
+                 * if Hashes section goes in the file before Message section */
+                m_messageArray.reserve(sLen >> 3);
+                /* NB! NO BREAK HERE */
+                case Context:
+                stream.seek(sLen);
+                break;
+                default:
+                throw QMException("Unkown section");
+            }
+        }
+        /* Store the data into member variables.
+         * The following functions never generate exceptions */
+        m_hashSet.swap(hashSet);
+        m_messageArray.swap(messageArray);
+    }
+
+private:
+
+    /* Some QM stuff */
+    enum SectionType
+    {
+        Hashes   = 0x42,
+        Messages = 0x69,
+        Contexts = 0x2f
+    };
+
+    enum MessageType
+    {
+        End          = 1,
+        SourceText16 = 2,
+        Translation  = 3,
+        Context16    = 4,
+        Hash         = 5,
+        SourceText   = 6,
+        Context      = 7,
+        Comment      = 8
+    };
+
+    /* Read messages from the stream. */
+    static void parseMessages(QMBytesStream &stream, QMHashSet * const hashSet, QMMessageArray * const messageArray, size_t cbSize)
+    {
+        stream.setEnd(stream.tellPos() + cbSize);
+        uint32_t cMessage = 0;
+        while (!stream.hasFinished())
+        {
+            QMMessage message;
+            HashOffset hashOffs;
+
+            parseMessageRecord(stream, &message);
+            if (!message.hash)
+                message.hash = calculateHash(message.strSource.c_str(), message.strComment.c_str());
+
+            hashOffs.hash = message.hash;
+            hashOffs.offset = cMessage++;
+
+            hashSet->insert(hashOffs);
+            messageArray->push_back(message);
+        }
+        stream.setEnd();
+    }
+
+    /* Parse one message from the stream */
+    static void parseMessageRecord(QMBytesStream &stream, QMMessage * const message)
+    {
+        while(!stream.hasFinished())
+        {
+            uint8_t type = stream.read8();
+            switch(type)
+            {
+                case End:
+                return;
+                /* Ignored as obsolete */
+                case Context16:
+                case SourceText16:
+                stream.seek(stream.read32());
+                break;
+                case Translation:
+                {
+                    com::Utf8Str str = stream.readUtf16String();
+                    message->strTranslation.swap(str);
+                    break;
+                }
+                case Hash:
+                message->hash = stream.read32();
+                break;
+
+                case SourceText:
+                {
+                    com::Utf8Str str = stream.readString();
+                    message->strSource.swap(str);
+                    break;
+                }
+
+                case Context:
+                {
+                    com::Utf8Str str = stream.readString();
+                    message->strContext.swap(str);
+                    break;
+                }
+
+                case Comment:
+                {
+                    com::Utf8Str str = stream.readString();
+                    message->strComment.swap(str);
+                    break;
+                }
+
+                default:
+                /* Ignore unknown block */
+                LogRel(("QMTranslator::parseMessageRecord(): Unkown message block %x\n", type));
+                break;
+            }
+        }
+    }
+
+    /* Defines the so called `hashpjw' function by P.J. Weinberger
+       [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
+       1986, 1987 Bell Telephone Laboratories, Inc.]   */
+    static uint32_t calculateHash(const char *pszStr1, const char *pszStr2 = 0)
+    {
+        uint32_t hash = 0, g;
+
+        for (const char *pszStr = pszStr1; pszStr != pszStr2; pszStr = pszStr2)
+            for (; pszStr && *pszStr; pszStr++)
+            {
+                hash = (hash << 4) + static_cast<uint8_t>(*pszStr);
+
+                if ((g = hash & 0xf0000000ul) != 0)
+                {
+                    hash ^= g >> 24;
+                    hash ^= g;
+                }
+            }
+
+        return (hash != 0 ? hash : 1);
+    }
+};
+
+/* Inteface functions implementation */
+QMTranslator::QMTranslator() : _impl(new QMTranslator_Impl) {}
+
+QMTranslator::~QMTranslator() { delete _impl; }
+
+const char *QMTranslator::translate(const char *pszContext, const char *pszSource, const char *pszDisamb) const throw()
+{
+    return _impl->translate(pszContext, pszSource, pszDisamb);
+}
+
+/* The function is noexcept for now but it may be changed
+ * to throw exceptions if required to catch them in another
+ * place. */
+int QMTranslator::load(const char *pszFilename) throw()
+{
+    /* To free safely the file in case of exception */
+    struct FileLoader
+    {
+        uint8_t *data;
+        size_t cbSize;
+        int rc;
+        FileLoader(const char *pszFname)
+        {
+            rc = RTFileReadAll(pszFname, (void**) &data, &cbSize);
+        }
+
+        ~FileLoader()
+        {
+            if (isSuccess())
+                RTFileReadAllFree(data, cbSize);
+        }
+        bool isSuccess() { return RT_SUCCESS(rc); }
+    };
+
+    try
+    {
+        FileLoader loader(pszFilename);
+        if (loader.isSuccess())
+        {
+            QMBytesStream stream(loader.data, loader.cbSize);
+            _impl->load(stream);
+        }
+        return loader.rc;
+    }
+    catch(std::exception &e)
+    {
+        LogRel(("QMTranslator::load() failed to load file '%s', reason: %s\n", pszFilename, e.what()));
+        return VERR_INTERNAL_ERROR;
+    }
+    catch(...)
+    {
+        LogRel(("QMTranslator::load() failed to load file '%s'\n", pszFilename));
+        return VERR_GENERAL_FAILURE;
+    }
+}
diff --git a/src/VBox/Main/src-all/SecretKeyStore.cpp b/src/VBox/Main/src-all/SecretKeyStore.cpp
new file mode 100644
index 0000000..cb9ab71
--- /dev/null
+++ b/src/VBox/Main/src-all/SecretKeyStore.cpp
@@ -0,0 +1,228 @@
+/* $Id: SecretKeyStore.cpp $ */
+/** @file
+ * Main - Secret key interface.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include <VBox/err.h>
+#include <VBox/log.h>
+#include <iprt/assert.h>
+#include <iprt/asm.h>
+#include <iprt/memsafer.h>
+
+#include "SecretKeyStore.h"
+
+SecretKey::SecretKey(const uint8_t *pbKey, size_t cbKey, bool fKeyBufNonPageable)
+{
+    m_cRefs            = 0;
+    m_fRemoveOnSuspend = false;
+    m_cUsers           = 0;
+    m_cbKey            = cbKey;
+
+    int rc = RTMemSaferAllocZEx((void **)&this->m_pbKey, cbKey,
+                                fKeyBufNonPageable ? RTMEMSAFER_F_REQUIRE_NOT_PAGABLE : 0);
+    if (RT_SUCCESS(rc))
+    {
+        memcpy(this->m_pbKey, pbKey, cbKey);
+
+        /* Scramble content to make retrieving the key more difficult. */
+        rc = RTMemSaferScramble(this->m_pbKey, cbKey);
+    }
+    else
+        throw rc;
+}
+
+SecretKey::~SecretKey()
+{
+    Assert(!m_cRefs);
+
+    RTMemSaferFree(m_pbKey, m_cbKey);
+    m_cRefs = 0;
+    m_pbKey = NULL;
+    m_cbKey = 0;
+    m_fRemoveOnSuspend = false;
+    m_cUsers = 0;
+}
+
+uint32_t SecretKey::retain()
+{
+    uint32_t cRefs = ASMAtomicIncU32(&m_cRefs);
+    if (cRefs == 1)
+    {
+        int rc = RTMemSaferUnscramble(m_pbKey, m_cbKey);
+        AssertRC(rc);
+    }
+
+    return cRefs;
+}
+
+uint32_t SecretKey::release()
+{
+    uint32_t cRefs = ASMAtomicDecU32(&m_cRefs);
+    if (!cRefs)
+    {
+        int rc = RTMemSaferScramble(m_pbKey, m_cbKey);
+        AssertRC(rc);
+    }
+
+    return cRefs;
+}
+
+uint32_t SecretKey::refCount()
+{
+    return m_cRefs;
+}
+
+int SecretKey::setUsers(uint32_t cUsers)
+{
+    m_cUsers = cUsers;
+    return VINF_SUCCESS;
+}
+
+uint32_t SecretKey::getUsers()
+{
+    return m_cUsers;
+}
+
+int SecretKey::setRemoveOnSuspend(bool fRemoveOnSuspend)
+{
+    m_fRemoveOnSuspend = fRemoveOnSuspend;
+    return VINF_SUCCESS;
+}
+
+bool SecretKey::getRemoveOnSuspend()
+{
+    return m_fRemoveOnSuspend;
+}
+
+const void *SecretKey::getKeyBuffer()
+{
+    AssertReturn(m_cRefs > 0, NULL);
+    return m_pbKey;
+}
+
+size_t SecretKey::getKeySize()
+{
+    return m_cbKey;
+}
+
+SecretKeyStore::SecretKeyStore(bool fKeyBufNonPageable)
+{
+    m_fKeyBufNonPageable = fKeyBufNonPageable;
+}
+
+SecretKeyStore::~SecretKeyStore()
+{
+    int rc = deleteAllSecretKeys(false /* fSuspend */, true /* fForce */);
+    AssertRC(rc);
+}
+
+int SecretKeyStore::addSecretKey(const com::Utf8Str &strKeyId, const uint8_t *pbKey, size_t cbKey)
+{
+    /* Check that the ID is not existing already. */
+    SecretKeyMap::const_iterator it = m_mapSecretKeys.find(strKeyId);
+    if (it != m_mapSecretKeys.end())
+        return VERR_ALREADY_EXISTS;
+
+    try
+    {
+        SecretKey *pKey = new SecretKey(pbKey, cbKey, m_fKeyBufNonPageable);
+
+        m_mapSecretKeys.insert(std::make_pair(strKeyId, pKey));
+    }
+    catch (int rc)
+    {
+        return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+int SecretKeyStore::deleteSecretKey(const com::Utf8Str &strKeyId)
+{
+    SecretKeyMap::iterator it = m_mapSecretKeys.find(strKeyId);
+    if (it == m_mapSecretKeys.end())
+        return VERR_NOT_FOUND;
+
+    SecretKey *pKey = it->second;
+    if (pKey->refCount() != 0)
+        return VERR_RESOURCE_IN_USE;
+
+    m_mapSecretKeys.erase(it);
+    delete pKey;
+
+    return VINF_SUCCESS;
+}
+
+int SecretKeyStore::retainSecretKey(const com::Utf8Str &strKeyId, SecretKey **ppKey)
+{
+    SecretKeyMap::const_iterator it = m_mapSecretKeys.find(strKeyId);
+    if (it == m_mapSecretKeys.end())
+        return VERR_NOT_FOUND;
+
+    SecretKey *pKey = it->second;
+    pKey->retain();
+
+    *ppKey = pKey;
+
+    return VINF_SUCCESS;
+}
+
+int SecretKeyStore::releaseSecretKey(const com::Utf8Str &strKeyId)
+{
+    SecretKeyMap::const_iterator it = m_mapSecretKeys.find(strKeyId);
+    if (it == m_mapSecretKeys.end())
+        return VERR_NOT_FOUND;
+
+    SecretKey *pKey = it->second;
+    pKey->release();
+    return VINF_SUCCESS;
+}
+
+int SecretKeyStore::deleteAllSecretKeys(bool fSuspend, bool fForce)
+{
+    /* First check whether a key is still in use. */
+    if (!fForce)
+    {
+        for (SecretKeyMap::iterator it = m_mapSecretKeys.begin();
+             it != m_mapSecretKeys.end();
+             ++it)
+        {
+            SecretKey *pKey = it->second;
+            if (   pKey->refCount()
+                && (   (   pKey->getRemoveOnSuspend()
+                        && fSuspend)
+                    || !fSuspend))
+                return VERR_RESOURCE_IN_USE;
+        }
+    }
+
+    SecretKeyMap::iterator it = m_mapSecretKeys.begin();
+    while (it != m_mapSecretKeys.end())
+    {
+        SecretKey *pKey = it->second;
+        if (   pKey->getRemoveOnSuspend()
+            || !fSuspend)
+        {
+            AssertMsg(!pKey->refCount(), ("No one should access the stored key at this point anymore!\n"));
+            delete pKey;
+            m_mapSecretKeys.erase(it++);
+        }
+        else
+            ++it;
+    }
+
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Main/src-all/SharedFolderImpl.cpp b/src/VBox/Main/src-all/SharedFolderImpl.cpp
index 9f4ad6c..bcf2483 100644
--- a/src/VBox/Main/src-all/SharedFolderImpl.cpp
+++ b/src/VBox/Main/src-all/SharedFolderImpl.cpp
@@ -1,3 +1,4 @@
+/* $Id: SharedFolderImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
@@ -110,7 +111,7 @@ HRESULT SharedFolder::init(Machine *aMachine,
 
     unconst(mMachine) = aMachine;
 
-    HRESULT rc = protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount, fFailOnError);
+    HRESULT rc = i_protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount, fFailOnError);
 
     /* Confirm a successful initialization when it's the case */
     if (SUCCEEDED(rc))
@@ -139,12 +140,12 @@ HRESULT SharedFolder::initCopy(Machine *aMachine, SharedFolder *aThat)
 
     unconst(mMachine) = aMachine;
 
-    HRESULT rc = protectedInit(aMachine,
-                               aThat->m->strName,
-                               aThat->m->strHostPath,
-                               aThat->m->fWritable,
-                               aThat->m->fAutoMount,
-                               false /* fFailOnError */ );
+    HRESULT rc = i_protectedInit(aMachine,
+                                 aThat->m->strName,
+                                 aThat->m->strHostPath,
+                                 aThat->m->fWritable,
+                                 aThat->m->fAutoMount,
+                                 false /* fFailOnError */ );
 
     /* Confirm a successful initialization when it's the case */
     if (SUCCEEDED(rc))
@@ -220,7 +221,7 @@ HRESULT SharedFolder::init(Console *aConsole,
 
     unconst(mConsole) = aConsole;
 
-    HRESULT rc = protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, fFailOnError);
+    HRESULT rc = i_protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, fFailOnError);
 
     /* Confirm a successful initialization when it's the case */
     if (SUCCEEDED(rc))
@@ -236,12 +237,12 @@ HRESULT SharedFolder::init(Console *aConsole,
  *  @note
  *      Must be called from under the object's lock!
  */
-HRESULT SharedFolder::protectedInit(VirtualBoxBase *aParent,
-                                    const Utf8Str &aName,
-                                    const Utf8Str &aHostPath,
-                                    bool aWritable,
-                                    bool aAutoMount,
-                                    bool fFailOnError)
+HRESULT SharedFolder::i_protectedInit(VirtualBoxBase *aParent,
+                                      const Utf8Str &aName,
+                                      const Utf8Str &aHostPath,
+                                      bool aWritable,
+                                      bool aAutoMount,
+                                      bool fFailOnError)
 {
     LogFlowThisFunc(("aName={%s}, aHostPath={%s}, aWritable={%d}, aAutoMount={%d}\n",
                       aName.c_str(), aHostPath.c_str(), aWritable, aAutoMount));
@@ -321,42 +322,26 @@ void SharedFolder::uninit()
 #endif
 }
 
-// ISharedFolder properties
+// wrapped ISharedFolder properties
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP SharedFolder::COMGETTER(Name) (BSTR *aName)
+HRESULT SharedFolder::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mName is constant during life time, no need to lock */
-    m->strName.cloneTo(aName);
+    aName = m->strName;
 
     return S_OK;
 }
 
-STDMETHODIMP SharedFolder::COMGETTER(HostPath) (BSTR *aHostPath)
+HRESULT SharedFolder::getHostPath(com::Utf8Str &aHostPath)
 {
-    CheckComArgOutPointerValid(aHostPath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mHostPath is constant during life time, no need to lock */
-    m->strHostPath.cloneTo(aHostPath);
+    aHostPath = m->strHostPath;
 
     return S_OK;
 }
 
-STDMETHODIMP SharedFolder::COMGETTER(Accessible) (BOOL *aAccessible)
+HRESULT SharedFolder::getAccessible(BOOL *aAccessible)
 {
-    CheckComArgOutPointerValid(aAccessible);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mName and mHostPath are constant during life time, no need to lock */
 
     /* check whether the host path exists */
@@ -381,16 +366,12 @@ STDMETHODIMP SharedFolder::COMGETTER(Accessible) (BOOL *aAccessible)
     LogWarningThisFunc(("m.lastAccessError=\"%s\"\n", m->strLastAccessError.c_str()));
 
     *aAccessible = FALSE;
+
     return S_OK;
 }
 
-STDMETHODIMP SharedFolder::COMGETTER(Writable) (BOOL *aWritable)
+HRESULT SharedFolder::getWritable(BOOL *aWritable)
 {
-    CheckComArgOutPointerValid(aWritable);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aWritable = !!m->fWritable;
@@ -398,13 +379,8 @@ STDMETHODIMP SharedFolder::COMGETTER(Writable) (BOOL *aWritable)
     return S_OK;
 }
 
-STDMETHODIMP SharedFolder::COMGETTER(AutoMount) (BOOL *aAutoMount)
+HRESULT SharedFolder::getAutoMount(BOOL *aAutoMount)
 {
-    CheckComArgOutPointerValid(aAutoMount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aAutoMount = !!m->fAutoMount;
@@ -412,36 +388,32 @@ STDMETHODIMP SharedFolder::COMGETTER(AutoMount) (BOOL *aAutoMount)
     return S_OK;
 }
 
-STDMETHODIMP SharedFolder::COMGETTER(LastAccessError) (BSTR *aLastAccessError)
+HRESULT SharedFolder::getLastAccessError(com::Utf8Str &aLastAccessError)
 {
-    CheckComArgOutPointerValid(aLastAccessError);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strLastAccessError.cloneTo(aLastAccessError);
+    aLastAccessError = m->strLastAccessError;
 
     return S_OK;
 }
 
-const Utf8Str& SharedFolder::getName() const
+
+const Utf8Str& SharedFolder::i_getName() const
 {
     return m->strName;
 }
 
-const Utf8Str& SharedFolder::getHostPath() const
+const Utf8Str& SharedFolder::i_getHostPath() const
 {
     return m->strHostPath;
 }
 
-bool SharedFolder::isWritable() const
+bool SharedFolder::i_isWritable() const
 {
     return m->fWritable;
 }
 
-bool SharedFolder::isAutoMounted() const
+bool SharedFolder::i_isAutoMounted() const
 {
     return m->fAutoMount;
 }
diff --git a/src/VBox/Main/src-all/VBoxAPI-end.d b/src/VBox/Main/src-all/VBoxAPI-end.d
new file mode 100644
index 0000000..5f88a01
--- /dev/null
+++ b/src/VBox/Main/src-all/VBoxAPI-end.d
@@ -0,0 +1,9 @@
+
+};
+
+#pragma D attributes Evolving/Evolving/Common provider vboxapi provider
+#pragma D attributes Private/Private/Unknown  provider vboxapi module
+#pragma D attributes Private/Private/Unknown  provider vboxapi function
+#pragma D attributes Evolving/Evolving/Common provider vboxapi name
+#pragma D attributes Evolving/Evolving/Common provider vboxapi args
+
diff --git a/src/VBox/Main/src-all/VBoxAPI-start.d b/src/VBox/Main/src-all/VBoxAPI-start.d
new file mode 100644
index 0000000..8968e7a
--- /dev/null
+++ b/src/VBox/Main/src-all/VBoxAPI-start.d
@@ -0,0 +1,23 @@
+/* $Id: VBoxAPI-start.d $ */
+/** @file
+ * VBoxAPI - Static dtrace probes.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+provider vboxapi
+{
+    /* Manually defined probes: */
+    probe machine__state__changed(void *a_pMachine, int a_enmNewState, int a_enmOldState, const char *pszMachineUuid);
+
+    /* The following probes are automatically generated and changes with the API: */
diff --git a/src/VBox/Main/src-all/VirtualBoxBase.cpp b/src/VBox/Main/src-all/VirtualBoxBase.cpp
index b43f5a6..9319522 100644
--- a/src/VBox/Main/src-all/VirtualBoxBase.cpp
+++ b/src/VBox/Main/src-all/VirtualBoxBase.cpp
@@ -23,19 +23,20 @@
 
 #include <typeinfo>
 
-#if !defined (VBOX_WITH_XPCOM)
+#if !defined(VBOX_WITH_XPCOM)
 #include <windows.h>
 #include <dbghelp.h>
-#else /* !defined (VBOX_WITH_XPCOM) */
+#else /* !defined(VBOX_WITH_XPCOM) */
 /// @todo remove when VirtualBoxErrorInfo goes away from here
 #include <nsIServiceManager.h>
 #include <nsIExceptionService.h>
-#endif /* !defined (VBOX_WITH_XPCOM) */
+#endif /* !defined(VBOX_WITH_XPCOM) */
 
 #include "VirtualBoxBase.h"
 #include "AutoCaller.h"
 #include "VirtualBoxErrorInfoImpl.h"
 #include "Logging.h"
+#include "Global.h"
 
 #include "VBox/com/ErrorInfo.h"
 #include "VBox/com/MultiResult.h"
@@ -46,15 +47,8 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-VirtualBoxBase::VirtualBoxBase()
-    : mStateLock(LOCKCLASS_OBJECTSTATE)
+VirtualBoxBase::VirtualBoxBase() : mState(this)
 {
-    mState = NotReady;
-    mStateChangeThread = NIL_RTTHREAD;
-    mCallers = 0;
-    mZeroCallersSem = NIL_RTSEMEVENT;
-    mInitUninitSem = NIL_RTSEMEVENTMULTI;
-    mInitUninitWaiters = 0;
     mObjectLock = NULL;
 }
 
@@ -62,13 +56,6 @@ VirtualBoxBase::~VirtualBoxBase()
 {
     if (mObjectLock)
         delete mObjectLock;
-    Assert(mInitUninitWaiters == 0);
-    Assert(mInitUninitSem == NIL_RTSEMEVENTMULTI);
-    if (mZeroCallersSem != NIL_RTSEMEVENT)
-        RTSemEventDestroy (mZeroCallersSem);
-    mCallers = 0;
-    mStateChangeThread = NIL_RTTHREAD;
-    mState = NotReady;
 }
 
 /**
@@ -89,7 +76,7 @@ RWLockHandle *VirtualBoxBase::lockHandle() const
     /* lazy initialization */
     if (RT_UNLIKELY(!mObjectLock))
     {
-        AssertCompile (sizeof (RWLockHandle *) == sizeof (void *));
+        AssertCompile(sizeof(RWLockHandle *) == sizeof(void *));
 
         // getLockingClass() is overridden by many subclasses to return
         // one of the locking classes listed at the top of AutoLock.h
@@ -105,198 +92,6 @@ RWLockHandle *VirtualBoxBase::lockHandle() const
 }
 
 /**
- * Increments the number of calls to this object by one.
- *
- * After this method succeeds, it is guaranteed that the object will remain
- * in the Ready (or in the Limited) state at least until #releaseCaller() is
- * called.
- *
- * This method is intended to mark the beginning of sections of code within
- * methods of COM objects that depend on the readiness (Ready) state. The
- * Ready state is a primary "ready to serve" state. Usually all code that
- * works with component's data depends on it. On practice, this means that
- * almost every public method, setter or getter of the object should add
- * itself as an object's caller at the very beginning, to protect from an
- * unexpected uninitialization that may happen on a different thread.
- *
- * Besides the Ready state denoting that the object is fully functional,
- * there is a special Limited state. The Limited state means that the object
- * is still functional, but its functionality is limited to some degree, so
- * not all operations are possible. The @a aLimited argument to this method
- * determines whether the caller represents this limited functionality or
- * not.
- *
- * This method succeeds (and increments the number of callers) only if the
- * current object's state is Ready. Otherwise, it will return E_ACCESSDENIED
- * to indicate that the object is not operational. There are two exceptions
- * from this rule:
- * <ol>
- *   <li>If the @a aLimited argument is |true|, then this method will also
- *       succeed if the object's state is Limited (or Ready, of course).
- *   </li>
- *   <li>If this method is called from the same thread that placed
- *       the object to InInit or InUninit state (i.e. either from within the
- *       AutoInitSpan or AutoUninitSpan scope), it will succeed as well (but
- *       will not increase the number of callers).
- *   </li>
- * </ol>
- *
- * Normally, calling addCaller() never blocks. However, if this method is
- * called by a thread created from within the AutoInitSpan scope and this
- * scope is still active (i.e. the object state is InInit), it will block
- * until the AutoInitSpan destructor signals that it has finished
- * initialization.
- *
- * When this method returns a failure, the caller must not use the object
- * and should return the failed result code to its own caller.
- *
- * @param aState        Where to store the current object's state (can be
- *                      used in overridden methods to determine the cause of
- *                      the failure).
- * @param aLimited      |true| to add a limited caller.
- *
- * @return              S_OK on success or E_ACCESSDENIED on failure.
- *
- * @note It is preferable to use the #addLimitedCaller() rather than
- *       calling this method with @a aLimited = |true|, for better
- *       self-descriptiveness.
- *
- * @sa #addLimitedCaller()
- * @sa #releaseCaller()
- */
-HRESULT VirtualBoxBase::addCaller(State *aState /* = NULL */,
-                                  bool aLimited /* = false */)
-{
-    AutoWriteLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    HRESULT rc = E_ACCESSDENIED;
-
-    if (mState == Ready || (aLimited && mState == Limited))
-    {
-        /* if Ready or allows Limited, increase the number of callers */
-        ++ mCallers;
-        rc = S_OK;
-    }
-    else
-    if (mState == InInit || mState == InUninit)
-    {
-        if (mStateChangeThread == RTThreadSelf())
-        {
-            /* Called from the same thread that is doing AutoInitSpan or
-             * AutoUninitSpan, just succeed */
-            rc = S_OK;
-        }
-        else if (mState == InInit)
-        {
-            /* addCaller() is called by a "child" thread while the "parent"
-             * thread is still doing AutoInitSpan/AutoReinitSpan, so wait for
-             * the state to become either Ready/Limited or InitFailed (in
-             * case of init failure).
-             *
-             * Note that we increase the number of callers anyway -- to
-             * prevent AutoUninitSpan from early completion if we are
-             * still not scheduled to pick up the posted semaphore when
-             * uninit() is called.
-             */
-            ++ mCallers;
-
-            /* lazy semaphore creation */
-            if (mInitUninitSem == NIL_RTSEMEVENTMULTI)
-            {
-                RTSemEventMultiCreate (&mInitUninitSem);
-                Assert(mInitUninitWaiters == 0);
-            }
-
-            ++ mInitUninitWaiters;
-
-            LogFlowThisFunc(("Waiting for AutoInitSpan/AutoReinitSpan to finish...\n"));
-
-            stateLock.release();
-            RTSemEventMultiWait (mInitUninitSem, RT_INDEFINITE_WAIT);
-            stateLock.acquire();
-
-            if (-- mInitUninitWaiters == 0)
-            {
-                /* destroy the semaphore since no more necessary */
-                RTSemEventMultiDestroy (mInitUninitSem);
-                mInitUninitSem = NIL_RTSEMEVENTMULTI;
-            }
-
-            if (mState == Ready || (aLimited && mState == Limited))
-                rc = S_OK;
-            else
-            {
-                Assert(mCallers != 0);
-                -- mCallers;
-                if (mCallers == 0 && mState == InUninit)
-                {
-                    /* inform AutoUninitSpan ctor there are no more callers */
-                    RTSemEventSignal(mZeroCallersSem);
-                }
-            }
-        }
-    }
-
-    if (aState)
-        *aState = mState;
-
-    if (FAILED(rc))
-    {
-        if (mState == VirtualBoxBase::Limited)
-            rc = setError(rc, "The object functionality is limited");
-        else
-            rc = setError(rc, "The object is not ready");
-    }
-
-    return rc;
-}
-
-/**
- * Decreases the number of calls to this object by one.
- *
- * Must be called after every #addCaller() or #addLimitedCaller() when
- * protecting the object from uninitialization is no more necessary.
- */
-void VirtualBoxBase::releaseCaller()
-{
-    AutoWriteLock stateLock(mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    if (mState == Ready || mState == Limited)
-    {
-        /* if Ready or Limited, decrease the number of callers */
-        AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0);
-        --mCallers;
-
-        return;
-    }
-
-    if (mState == InInit || mState == InUninit)
-    {
-        if (mStateChangeThread == RTThreadSelf())
-        {
-            /* Called from the same thread that is doing AutoInitSpan or
-             * AutoUninitSpan: just succeed */
-            return;
-        }
-
-        if (mState == InUninit)
-        {
-            /* the caller is being released after AutoUninitSpan has begun */
-            AssertMsgReturn(mCallers != 0, ("mCallers is ZERO!"), (void) 0);
-            --mCallers;
-
-            if (mCallers == 0)
-                /* inform the Auto*UninitSpan ctor there are no more callers */
-                RTSemEventSignal(mZeroCallersSem);
-
-            return;
-        }
-    }
-
-    AssertMsgFailed (("mState = %d!", mState));
-}
-
-/**
  * Handles unexpected exceptions by turning them into COM errors in release
  * builds or by hitting a breakpoint in the release builds.
  *
@@ -373,13 +168,14 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
                                          const char *pcszComponent,
                                          Utf8Str aText,
                                          bool aWarning,
-                                         bool aLogIt)
+                                         bool aLogIt,
+                                         LONG aResultDetail /* = 0*/)
 {
     /* whether multi-error mode is turned on */
     bool preserve = MultiResult::isMultiEnabled();
 
     if (aLogIt)
-        LogRel(("%s [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%s} aText={%s}, preserve=%RTbool\n",
+        LogRel(("%s [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%s} aText={%s}, preserve=%RTbool aResultDetail=%d\n",
                 aWarning ? "WARNING" : "ERROR",
                 aResultCode,
                 aResultCode,
@@ -387,7 +183,8 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
                 pcszComponent,
                 aText.c_str(),
                 aWarning,
-                preserve));
+                preserve,
+                aResultDetail));
 
     /* these are mandatory, others -- not */
     AssertReturn((!aWarning && FAILED(aResultCode)) ||
@@ -436,14 +233,14 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
         rc = info.createObject();
         if (FAILED(rc)) break;
 
-#if !defined (VBOX_WITH_XPCOM)
+#if !defined(VBOX_WITH_XPCOM)
 
         ComPtr<IVirtualBoxErrorInfo> curInfo;
         if (preserve)
         {
             /* get the current error info if any */
             ComPtr<IErrorInfo> err;
-            rc = ::GetErrorInfo (0, err.asOutParam());
+            rc = ::GetErrorInfo(0, err.asOutParam());
             if (FAILED(rc)) break;
             rc = err.queryInterfaceTo(curInfo.asOutParam());
             if (FAILED(rc))
@@ -454,7 +251,7 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
                 rc = wrapper.createObject();
                 if (SUCCEEDED(rc))
                 {
-                    rc = wrapper->init (err);
+                    rc = wrapper->init(err);
                     if (SUCCEEDED(rc))
                         curInfo = wrapper;
                 }
@@ -464,22 +261,22 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
         Assert(SUCCEEDED(rc) || curInfo.isNull());
 
         /* set the current error info and preserve the previous one if any */
-        rc = info->init(aResultCode, aIID, pcszComponent, aText, curInfo);
+        rc = info->initEx(aResultCode, aResultDetail, aIID, pcszComponent, aText, curInfo);
         if (FAILED(rc)) break;
 
         ComPtr<IErrorInfo> err;
         rc = info.queryInterfaceTo(err.asOutParam());
         if (SUCCEEDED(rc))
-            rc = ::SetErrorInfo (0, err);
+            rc = ::SetErrorInfo(0, err);
 
-#else // !defined (VBOX_WITH_XPCOM)
+#else // !defined(VBOX_WITH_XPCOM)
 
         nsCOMPtr <nsIExceptionService> es;
-        es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
+        es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
         if (NS_SUCCEEDED(rc))
         {
             nsCOMPtr <nsIExceptionManager> em;
-            rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
+            rc = es->GetCurrentExceptionManager(getter_AddRefs(em));
             if (FAILED(rc)) break;
 
             ComPtr<IVirtualBoxErrorInfo> curInfo;
@@ -487,7 +284,7 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
             {
                 /* get the current error info if any */
                 ComPtr<nsIException> ex;
-                rc = em->GetCurrentException (ex.asOutParam());
+                rc = em->GetCurrentException(ex.asOutParam());
                 if (FAILED(rc)) break;
                 rc = ex.queryInterfaceTo(curInfo.asOutParam());
                 if (FAILED(rc))
@@ -498,7 +295,7 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
                     rc = wrapper.createObject();
                     if (SUCCEEDED(rc))
                     {
-                        rc = wrapper->init (ex);
+                        rc = wrapper->init(ex);
                         if (SUCCEEDED(rc))
                             curInfo = wrapper;
                     }
@@ -508,13 +305,13 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
             Assert(SUCCEEDED(rc) || curInfo.isNull());
 
             /* set the current error info and preserve the previous one if any */
-            rc = info->init(aResultCode, aIID, pcszComponent, Bstr(aText), curInfo);
+            rc = info->initEx(aResultCode, aResultDetail, aIID, pcszComponent, Bstr(aText), curInfo);
             if (FAILED(rc)) break;
 
             ComPtr<nsIException> ex;
             rc = info.queryInterfaceTo(ex.asOutParam());
             if (SUCCEEDED(rc))
-                rc = em->SetCurrentException (ex);
+                rc = em->SetCurrentException(ex);
         }
         else if (rc == NS_ERROR_UNEXPECTED)
         {
@@ -532,11 +329,11 @@ HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode,
             rc = NS_OK;
         }
 
-#endif // !defined (VBOX_WITH_XPCOM)
+#endif // !defined(VBOX_WITH_XPCOM)
     }
     while (0);
 
-    AssertComRC (rc);
+    AssertComRC(rc);
 
     return SUCCEEDED(rc) ? aResultCode : rc;
 }
@@ -603,14 +400,14 @@ HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei)
         rc = info.createObject();
         if (FAILED(rc)) break;
 
-#if !defined (VBOX_WITH_XPCOM)
+#if !defined(VBOX_WITH_XPCOM)
 
         ComPtr<IVirtualBoxErrorInfo> curInfo;
         if (preserve)
         {
             /* get the current error info if any */
             ComPtr<IErrorInfo> err;
-            rc = ::GetErrorInfo (0, err.asOutParam());
+            rc = ::GetErrorInfo(0, err.asOutParam());
             if (FAILED(rc)) break;
             rc = err.queryInterfaceTo(curInfo.asOutParam());
             if (FAILED(rc))
@@ -621,7 +418,7 @@ HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei)
                 rc = wrapper.createObject();
                 if (SUCCEEDED(rc))
                 {
-                    rc = wrapper->init (err);
+                    rc = wrapper->init(err);
                     if (SUCCEEDED(rc))
                         curInfo = wrapper;
                 }
@@ -637,16 +434,16 @@ HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei)
         ComPtr<IErrorInfo> err;
         rc = info.queryInterfaceTo(err.asOutParam());
         if (SUCCEEDED(rc))
-            rc = ::SetErrorInfo (0, err);
+            rc = ::SetErrorInfo(0, err);
 
-#else // !defined (VBOX_WITH_XPCOM)
+#else // !defined(VBOX_WITH_XPCOM)
 
         nsCOMPtr <nsIExceptionService> es;
-        es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
+        es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
         if (NS_SUCCEEDED(rc))
         {
             nsCOMPtr <nsIExceptionManager> em;
-            rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
+            rc = es->GetCurrentExceptionManager(getter_AddRefs(em));
             if (FAILED(rc)) break;
 
             ComPtr<IVirtualBoxErrorInfo> curInfo;
@@ -654,7 +451,7 @@ HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei)
             {
                 /* get the current error info if any */
                 ComPtr<nsIException> ex;
-                rc = em->GetCurrentException (ex.asOutParam());
+                rc = em->GetCurrentException(ex.asOutParam());
                 if (FAILED(rc)) break;
                 rc = ex.queryInterfaceTo(curInfo.asOutParam());
                 if (FAILED(rc))
@@ -665,7 +462,7 @@ HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei)
                     rc = wrapper.createObject();
                     if (SUCCEEDED(rc))
                     {
-                        rc = wrapper->init (ex);
+                        rc = wrapper->init(ex);
                         if (SUCCEEDED(rc))
                             curInfo = wrapper;
                     }
@@ -681,7 +478,7 @@ HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei)
             ComPtr<nsIException> ex;
             rc = info.queryInterfaceTo(ex.asOutParam());
             if (SUCCEEDED(rc))
-                rc = em->SetCurrentException (ex);
+                rc = em->SetCurrentException(ex);
         }
         else if (rc == NS_ERROR_UNEXPECTED)
         {
@@ -699,16 +496,115 @@ HRESULT VirtualBoxBase::setError(const com::ErrorInfo &ei)
             rc = NS_OK;
         }
 
-#endif // !defined (VBOX_WITH_XPCOM)
+#endif // !defined(VBOX_WITH_XPCOM)
     }
     while (0);
 
-    AssertComRC (rc);
+    AssertComRC(rc);
 
     return SUCCEEDED(rc) ? ei.getResultCode() : rc;
 }
 
 /**
+ * Converts the VBox status code a COM one and sets the error info.
+ *
+ * The VBox status code is made available to the API user via
+ * IVirtualBoxErrorInfo::resultDetail attribute.
+ *
+ * @param   vrc             The VBox status code.
+ * @return  COM status code appropriate for @a vrc.
+ *
+ * @sa      VirtualBoxBase::setError(HRESULT)
+ */
+HRESULT VirtualBoxBase::setErrorVrc(int vrc)
+{
+    return setErrorInternal(Global::vboxStatusCodeToCOM(vrc),
+                            this->getClassIID(),
+                            this->getComponentName(),
+                            Utf8Str("%Rrc", vrc),
+                            false /* aWarning */,
+                            true /* aLogIt */,
+                            vrc /* aResultDetail */);
+}
+
+/**
+ * Converts the VBox status code a COM one and sets the error info.
+ *
+ * @param   vrc             The VBox status code.
+ * @param   pcszMsgFmt      Error message format string.
+ * @param   ...             Argument specified in the @a pcszMsgFmt
+ * @return  COM status code appropriate for @a vrc.
+ *
+ * @sa      VirtualBoxBase::setError(HRESULT, const char *, ...)
+ */
+HRESULT VirtualBoxBase::setErrorVrc(int vrc, const char *pcszMsgFmt, ...)
+{
+    va_list va;
+    va_start(va, pcszMsgFmt);
+    HRESULT hrc = setErrorInternal(Global::vboxStatusCodeToCOM(vrc),
+                                   this->getClassIID(),
+                                   this->getComponentName(),
+                                   Utf8Str(pcszMsgFmt, va),
+                                   false /* aWarning */,
+                                   true /* aLogIt */,
+                                   vrc /* aResultDetail */);
+    va_end(va);
+    return hrc;
+}
+
+/**
+ * Sets error info with both a COM status and an VBox status code.
+ *
+ * The VBox status code is made available to the API user via
+ * IVirtualBoxErrorInfo::resultDetail attribute.
+ *
+ * @param   hrc             The COM status code to return.
+ * @param   vrc             The VBox status code.
+ * @return  Most likely @hrc, see setErrorInternal.
+ *
+ * @sa      VirtualBoxBase::setError(HRESULT)
+ */
+HRESULT VirtualBoxBase::setErrorBoth(HRESULT hrc, int vrc)
+{
+    return setErrorInternal(hrc,
+                            this->getClassIID(),
+                            this->getComponentName(),
+                            Utf8Str("%Rrc", vrc),
+                            false /* aWarning */,
+                            true /* aLogIt */,
+                            vrc /* aResultDetail */);
+}
+
+/**
+ * Sets error info with a message and both a COM status and an VBox status code.
+ *
+ * The VBox status code is made available to the API user via
+ * IVirtualBoxErrorInfo::resultDetail attribute.
+ *
+ * @param   hrc             The COM status code to return.
+ * @param   vrc             The VBox status code.
+ * @param   pcszMsgFmt      Error message format string.
+ * @param   ...             Argument specified in the @a pcszMsgFmt
+ * @return  Most likely @hrc, see setErrorInternal.
+ *
+ * @sa      VirtualBoxBase::setError(HRESULT, const char *, ...)
+ */
+HRESULT VirtualBoxBase::setErrorBoth(HRESULT hrc, int vrc, const char *pcszMsgFmt, ...)
+{
+    va_list va;
+    va_start(va, pcszMsgFmt);
+    hrc = setErrorInternal(hrc,
+                           this->getClassIID(),
+                           this->getComponentName(),
+                           Utf8Str(pcszMsgFmt, va),
+                           false /* aWarning */,
+                           true /* aLogIt */,
+                           vrc /* aResultDetail */);
+    va_end(va);
+    return hrc;
+}
+
+/**
  * Like setError(), but sets the "warning" bit in the call to setErrorInternal().
  * @param aResultCode
  * @param pcsz
@@ -755,7 +651,7 @@ HRESULT VirtualBoxBase::setErrorNoLog(HRESULT aResultCode, const char *pcsz, ...
 void VirtualBoxBase::clearError(void)
 {
 #if !defined(VBOX_WITH_XPCOM)
-    ::SetErrorInfo (0, NULL);
+    ::SetErrorInfo(0, NULL);
 #else
     HRESULT rc = S_OK;
     nsCOMPtr <nsIExceptionService> es;
@@ -763,7 +659,7 @@ void VirtualBoxBase::clearError(void)
     if (NS_SUCCEEDED(rc))
     {
         nsCOMPtr <nsIExceptionManager> em;
-        rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
+        rc = es->GetCurrentExceptionManager(getter_AddRefs(em));
         if (SUCCEEDED(rc))
             em->SetCurrentException(NULL);
     }
@@ -773,273 +669,6 @@ void VirtualBoxBase::clearError(void)
 
 ////////////////////////////////////////////////////////////////////////////////
 //
-// AutoInitSpan methods
-//
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Creates a smart initialization span object that places the object to
- * InInit state.
- *
- * Please see the AutoInitSpan class description for more info.
- *
- * @param aObj      |this| pointer of the managed VirtualBoxBase object whose
- *                  init() method is being called.
- * @param aResult   Default initialization result.
- */
-AutoInitSpan::AutoInitSpan(VirtualBoxBase *aObj,
-                           Result aResult /* = Failed */)
-    : mObj(aObj),
-      mResult(aResult),
-      mOk(false)
-{
-    Assert(aObj);
-
-    AutoWriteLock stateLock(mObj->mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    mOk = mObj->mState == VirtualBoxBase::NotReady;
-    AssertReturnVoid (mOk);
-
-    mObj->setState(VirtualBoxBase::InInit);
-}
-
-/**
- * Places the managed VirtualBoxBase object to Ready/Limited state if the
- * initialization succeeded or partly succeeded, or places it to InitFailed
- * state and calls the object's uninit() method.
- *
- * Please see the AutoInitSpan class description for more info.
- */
-AutoInitSpan::~AutoInitSpan()
-{
-    /* if the state was other than NotReady, do nothing */
-    if (!mOk)
-        return;
-
-    AutoWriteLock stateLock(mObj->mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    Assert(mObj->mState == VirtualBoxBase::InInit);
-
-    if (mObj->mCallers > 0)
-    {
-        Assert(mObj->mInitUninitWaiters > 0);
-
-        /* We have some pending addCaller() calls on other threads (created
-         * during InInit), signal that InInit is finished and they may go on. */
-        RTSemEventMultiSignal(mObj->mInitUninitSem);
-    }
-
-    if (mResult == Succeeded)
-    {
-        mObj->setState(VirtualBoxBase::Ready);
-    }
-    else
-    if (mResult == Limited)
-    {
-        mObj->setState(VirtualBoxBase::Limited);
-    }
-    else
-    {
-        mObj->setState(VirtualBoxBase::InitFailed);
-        /* release the lock to prevent nesting when uninit() is called */
-        stateLock.release();
-        /* call uninit() to let the object uninit itself after failed init() */
-        mObj->uninit();
-        /* Note: the object may no longer exist here (for example, it can call
-         * the destructor in uninit()) */
-    }
-}
-
-// AutoReinitSpan methods
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Creates a smart re-initialization span object and places the object to
- * InInit state.
- *
- * Please see the AutoInitSpan class description for more info.
- *
- * @param aObj      |this| pointer of the managed VirtualBoxBase object whose
- *                  re-initialization method is being called.
- */
-AutoReinitSpan::AutoReinitSpan(VirtualBoxBase *aObj)
-    : mObj(aObj),
-      mSucceeded(false),
-      mOk(false)
-{
-    Assert(aObj);
-
-    AutoWriteLock stateLock(mObj->mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    mOk = mObj->mState == VirtualBoxBase::Limited;
-    AssertReturnVoid (mOk);
-
-    mObj->setState(VirtualBoxBase::InInit);
-}
-
-/**
- * Places the managed VirtualBoxBase object to Ready state if the
- * re-initialization succeeded (i.e. #setSucceeded() has been called) or back to
- * Limited state otherwise.
- *
- * Please see the AutoInitSpan class description for more info.
- */
-AutoReinitSpan::~AutoReinitSpan()
-{
-    /* if the state was other than Limited, do nothing */
-    if (!mOk)
-        return;
-
-    AutoWriteLock stateLock(mObj->mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    Assert(mObj->mState == VirtualBoxBase::InInit);
-
-    if (mObj->mCallers > 0 && mObj->mInitUninitWaiters > 0)
-    {
-        /* We have some pending addCaller() calls on other threads (created
-         * during InInit), signal that InInit is finished and they may go on. */
-        RTSemEventMultiSignal(mObj->mInitUninitSem);
-    }
-
-    if (mSucceeded)
-    {
-        mObj->setState(VirtualBoxBase::Ready);
-    }
-    else
-    {
-        mObj->setState(VirtualBoxBase::Limited);
-    }
-}
-
-// AutoUninitSpan methods
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Creates a smart uninitialization span object and places this object to
- * InUninit state.
- *
- * Please see the AutoInitSpan class description for more info.
- *
- * @note This method blocks the current thread execution until the number of
- *       callers of the managed VirtualBoxBase object drops to zero!
- *
- * @param aObj  |this| pointer of the VirtualBoxBase object whose uninit()
- *              method is being called.
- */
-AutoUninitSpan::AutoUninitSpan(VirtualBoxBase *aObj)
-    : mObj(aObj),
-      mInitFailed(false),
-      mUninitDone(false)
-{
-    Assert(aObj);
-
-    AutoWriteLock stateLock(mObj->mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    Assert(mObj->mState != VirtualBoxBase::InInit);
-
-    /* Set mUninitDone to |true| if this object is already uninitialized
-     * (NotReady) or if another AutoUninitSpan is currently active on some
-     *  other thread (InUninit). */
-    mUninitDone =    mObj->mState == VirtualBoxBase::NotReady
-                  || mObj->mState == VirtualBoxBase::InUninit;
-
-    if (mObj->mState == VirtualBoxBase::InitFailed)
-    {
-        /* we've been called by init() on failure */
-        mInitFailed = true;
-    }
-    else
-    {
-        if (mUninitDone)
-        {
-            /* do nothing if already uninitialized */
-            if (mObj->mState == VirtualBoxBase::NotReady)
-                return;
-
-            /* otherwise, wait until another thread finishes uninitialization.
-             * This is necessary to make sure that when this method returns, the
-             * object is NotReady and therefore can be deleted (for example). */
-
-            /* lazy semaphore creation */
-            if (mObj->mInitUninitSem == NIL_RTSEMEVENTMULTI)
-            {
-                RTSemEventMultiCreate(&mObj->mInitUninitSem);
-                Assert(mObj->mInitUninitWaiters == 0);
-            }
-            ++mObj->mInitUninitWaiters;
-
-            LogFlowFunc(("{%p}: Waiting for AutoUninitSpan to finish...\n",
-                         mObj));
-
-            stateLock.release();
-            RTSemEventMultiWait(mObj->mInitUninitSem, RT_INDEFINITE_WAIT);
-            stateLock.acquire();
-
-            if (--mObj->mInitUninitWaiters == 0)
-            {
-                /* destroy the semaphore since no more necessary */
-                RTSemEventMultiDestroy(mObj->mInitUninitSem);
-                mObj->mInitUninitSem = NIL_RTSEMEVENTMULTI;
-            }
-
-            return;
-        }
-    }
-
-    /* go to InUninit to prevent from adding new callers */
-    mObj->setState(VirtualBoxBase::InUninit);
-
-    /* wait for already existing callers to drop to zero */
-    if (mObj->mCallers > 0)
-    {
-        /* lazy creation */
-        Assert(mObj->mZeroCallersSem == NIL_RTSEMEVENT);
-        RTSemEventCreate(&mObj->mZeroCallersSem);
-
-        /* wait until remaining callers release the object */
-        LogFlowFunc(("{%p}: Waiting for callers (%d) to drop to zero...\n",
-                     mObj, mObj->mCallers));
-
-        stateLock.release();
-        RTSemEventWait(mObj->mZeroCallersSem, RT_INDEFINITE_WAIT);
-    }
-}
-
-/**
- *  Places the managed VirtualBoxBase object to the NotReady state.
- */
-AutoUninitSpan::~AutoUninitSpan()
-{
-    /* do nothing if already uninitialized */
-    if (mUninitDone)
-        return;
-
-    AutoWriteLock stateLock(mObj->mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    Assert(mObj->mState == VirtualBoxBase::InUninit);
-
-    mObj->setState(VirtualBoxBase::NotReady);
-}
-
-/**
- * Immediately complete the span, object is NotReady now
- */
-void AutoUninitSpan::setSucceeded()
-{
-    /* do nothing if already uninitialized */
-    if (mUninitDone)
-        return;
-
-    AutoWriteLock stateLock(mObj->mStateLock COMMA_LOCKVAL_SRC_POS);
-
-    Assert(mObj->mState == VirtualBoxBase::InUninit);
-
-    mObj->setState(VirtualBoxBase::NotReady);
-    mUninitDone = true;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-//
 // MultiResult methods
 //
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp b/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp
index 96ade44..405e5c5 100644
--- a/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp
+++ b/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp
@@ -1,3 +1,4 @@
+/* $Id: VirtualBoxErrorInfoImpl.cpp $ */
 /** @file
  *
  * VirtualBoxErrorInfo COM class implementation
diff --git a/src/VBox/Main/src-all/win/VBoxProxyStub.def b/src/VBox/Main/src-all/win/VBoxProxyStub.def
new file mode 100644
index 0000000..81b8e9f
--- /dev/null
+++ b/src/VBox/Main/src-all/win/VBoxProxyStub.def
@@ -0,0 +1,25 @@
+; $Id: VBoxProxyStub.def $
+;; @file
+; VBoxC DLL Definition File.
+;
+
+;
+; Copyright (C) 2006-2013 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+
+LIBRARY VBoxProxyStub.dll
+
+EXPORTS
+    DllGetClassObject   PRIVATE
+    DllCanUnloadNow     PRIVATE
+    DllRegisterServer   PRIVATE
+    DllUnregisterServer PRIVATE
+
diff --git a/src/VBox/Main/src-all/win/comregister.cmd b/src/VBox/Main/src-all/win/comregister.cmd
index 7377544..2ef4ac4 100644
--- a/src/VBox/Main/src-all/win/comregister.cmd
+++ b/src/VBox/Main/src-all/win/comregister.cmd
@@ -6,7 +6,7 @@ REM (both inproc and out-of-process)
 REM
 
 REM
-REM Copyright (C) 2006-2013 Oracle Corporation
+REM Copyright (C) 2006-2015 Oracle Corporation
 REM
 REM This file is part of VirtualBox Open Source Edition (OSE), as
 REM available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +19,10 @@ REM
 
 setlocal
 
+REM Check if the current user is an administrator. Otherwise
+REM all the COM registration will fail silently.
+NET FILE 1>NUL 2>NUL & IF ERRORLEVEL 1 (ECHO Must be run as Administrator. Exiting.) & GOTO end
+
 REM
 REM Figure out where the script lives first, so that we can invoke the
 REM correct VBoxSVC and register the right VBoxC.dll.
@@ -90,35 +94,97 @@ cd "%_SCRIPT_SELF%\.."
 for /f "tokens=*" %%d in ('cd') do set _VBOX_DIR=%%d\
 cd "%_SCRIPT_CURDIR%"
 
+REM
+REM Check for 64-bitness.
+REM
+set fIs64BitWindows=0
+if not "%ProgramW6432%x" == "x" set fIs64BitWindows=1
+if exist "%windir\syswow64\kernel32.dll" set fIs64BitWindows=1
+
+REM
+REM Figure out the Windows version as the proxy stub requires 6.0 or later (at least for 64-bit).
+REM
+set WinVer=Version 4.0.1381
+set WinVerMajor=4
+set WinVerMinor=0
+set WinVerBuild=1381
+for /f "tokens=2 delims=[]" %%a in ('ver') do set WinVer=%%a
+for /f "tokens=2,3,4 delims=. " %%a in ("%WinVer%") do (
+    set WinVerMajor=%%a
+    set WinVerMinor=%%b
+    set WinVerBuild=%%c
+)
+REM echo WinVerMajor=%WinVerMajor% WinVerMinor=%WinVerMinor% WinVerBuild=%WinVerBuild%  WinVer=%WinVer%
+
+REM
+REM Parse arguments.
+REM
+set fNoProxy=0
+if "%WinVerMajor%" LSS "6" set fNoProxy=1
+set fUninstallOnly=0
+
+:arg_loop
+if "%1x" == "x"             goto arg_done
+
+if "%1" == "-u"             goto arg_uninstall
+if "%1" == "--uninstall"    goto arg_uninstall
+if "%1" == "--proxy"        goto arg_proxy
+if "%1" == "--no-proxy"     goto arg_no_proxy
+echo syntax error: Unknown option %1
+echo usage: comregister.cmd [-u,--uninstall] [--no-proxy] [--proxy]
+goto end
+
+:arg_uninstall
+set fUninstallOnly=1
+goto arg_next
+
+:arg_proxy
+set fNoProxy=0
+goto arg_next
+
+:arg_no_proxy
+set fNoProxy=1
+goto arg_next
+
+:arg_next
+shift
+goto arg_loop
+:arg_done
 
 REM
 REM Do the registrations.
 REM
-if "%ProgramW6432%x" == "x" goto register_x86
-goto register_amd64
+ at if %fIs64BitWindows% == 1 goto register_amd64
 
 :register_x86
 @echo on
-%_VBOX_DIR%VBoxSVC.exe /UnregServer
-regsvr32 /s /u %_VBOX_DIR%VBoxC.dll
- at if "%1" == "-u" goto end
-%_VBOX_DIR%VBoxSVC.exe /RegServer
-regsvr32 /s    %_VBOX_DIR%VBoxC.dll
+"%_VBOX_DIR%VBoxSVC.exe" /UnregServer
+regsvr32 /s /u "%_VBOX_DIR%VBoxC.dll"
+%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxProxyStub.dll"
+ at if %fUninstallOnly% == 1 goto end
+"%_VBOX_DIR%VBoxSVC.exe" /RegServer
+regsvr32 /s    "%_VBOX_DIR%VBoxC.dll"
+ at if %fNoProxy% == 1 goto end
+if exist "%_VBOX_DIR%VBoxProxyStub.dll"     %windir%\system32\regsvr32 /s "%_VBOX_DIR%VBoxProxyStub.dll"
 @echo off
 goto end
 
-REM Unregister both first, then register them. The order matters here.
+REM Unregister all first, then register them. The order matters here.
 :register_amd64
 @echo on
-%_VBOX_DIR%VBoxSVC.exe /UnregServer
-%windir%\syswow64\regsvr32 /s /u %_VBOX_DIR%x86\VBoxClient-x86.dll
-%windir%\system32\regsvr32 /s /u %_VBOX_DIR%VBoxC.dll
- at if "%1" == "-u" goto end
-%_VBOX_DIR%VBoxSVC.exe /RegServer
-%windir%\system32\regsvr32 /s    %_VBOX_DIR%VBoxC.dll
-%windir%\syswow64\regsvr32 /s    %_VBOX_DIR%x86\VBoxClient-x86.dll
+"%_VBOX_DIR%VBoxSVC.exe" /UnregServer
+%windir%\syswow64\regsvr32 /s /u "%_VBOX_DIR%x86\VBoxClient-x86.dll"
+%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxC.dll"
+%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxProxyStub.dll"
+%windir%\system32\regsvr32 /s /u "%_VBOX_DIR%VBoxProxyStub-x86.dll"
+ at if %fUninstallOnly% == 1 goto end
+"%_VBOX_DIR%VBoxSVC.exe" /RegServer
+%windir%\system32\regsvr32 /s    "%_VBOX_DIR%VBoxC.dll"
+%windir%\syswow64\regsvr32 /s    "%_VBOX_DIR%x86\VBoxClient-x86.dll"
+ at if %fNoProxy% == 1 goto end
+if exist "%_VBOX_DIR%VBoxProxyStub.dll"     %windir%\system32\regsvr32 /s "%_VBOX_DIR%VBoxProxyStub.dll"
+if exist "%_VBOX_DIR%VBoxProxyStub-x86.dll" %windir%\system32\regsvr32 /s "%_VBOX_DIR%VBoxProxyStub-x86.dll"
 @echo off
 
 :end
 @endlocal
-
diff --git a/src/VBox/Main/src-client/AdditionsFacilityImpl.cpp b/src/VBox/Main/src-client/AdditionsFacilityImpl.cpp
index 408a22f..c0bd7c2 100644
--- a/src/VBox/Main/src-client/AdditionsFacilityImpl.cpp
+++ b/src/VBox/Main/src-client/AdditionsFacilityImpl.cpp
@@ -1,10 +1,11 @@
+/* $Id: AdditionsFacilityImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -98,87 +99,62 @@ void AdditionsFacility::uninit()
     mData.mStates.clear();
 }
 
-STDMETHODIMP AdditionsFacility::COMGETTER(ClassType)(AdditionsFacilityClass_T *aClass)
+HRESULT AdditionsFacility::getClassType(AdditionsFacilityClass_T *aClassType)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aClass);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aClass = getClass();
+    *aClassType = i_getClass();
 
     return S_OK;
 }
 
-STDMETHODIMP AdditionsFacility::COMGETTER(Name)(BSTR *aName)
+HRESULT AdditionsFacility::getName(com::Utf8Str &aName)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Bstr(getName()).cloneTo(aName);
+    aName = i_getName();
 
     return S_OK;
 }
 
-STDMETHODIMP AdditionsFacility::COMGETTER(LastUpdated)(LONG64 *aTimestamp)
+HRESULT AdditionsFacility::getLastUpdated(LONG64 *aLastUpdated)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aTimestamp);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aTimestamp = getLastUpdated();
+    *aLastUpdated = i_getLastUpdated();
 
     return S_OK;
 }
 
-STDMETHODIMP AdditionsFacility::COMGETTER(Status)(AdditionsFacilityStatus_T *aStatus)
+HRESULT AdditionsFacility::getStatus(AdditionsFacilityStatus_T *aStatus)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aStatus);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aStatus = getStatus();
+    *aStatus = i_getStatus();
 
     return S_OK;
 }
 
-STDMETHODIMP AdditionsFacility::COMGETTER(Type)(AdditionsFacilityType_T *aType)
+HRESULT AdditionsFacility::getType(AdditionsFacilityType_T *aType)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aType = getType();
+    *aType = i_getType();
 
     return S_OK;
 }
 
-const AdditionsFacility::FacilityInfo &AdditionsFacility::typeToInfo(AdditionsFacilityType_T aType)
+const AdditionsFacility::FacilityInfo &AdditionsFacility::i_typeToInfo(AdditionsFacilityType_T aType)
 {
     for (size_t i = 0; i < RT_ELEMENTS(s_aFacilityInfo); ++i)
     {
@@ -188,17 +164,17 @@ const AdditionsFacility::FacilityInfo &AdditionsFacility::typeToInfo(AdditionsFa
     return s_aFacilityInfo[0]; /* Return unknown type. */
 }
 
-AdditionsFacilityClass_T AdditionsFacility::getClass() const
+AdditionsFacilityClass_T AdditionsFacility::i_getClass() const
 {
-    return AdditionsFacility::typeToInfo(mData.mType).mClass;
+    return AdditionsFacility::i_typeToInfo(mData.mType).mClass;
 }
 
-Bstr AdditionsFacility::getName() const
+com::Utf8Str AdditionsFacility::i_getName() const
 {
-    return AdditionsFacility::typeToInfo(mData.mType).mName;
+    return AdditionsFacility::i_typeToInfo(mData.mType).mName;
 }
 
-LONG64 AdditionsFacility::getLastUpdated() const
+LONG64 AdditionsFacility::i_getLastUpdated() const
 {
     if (mData.mStates.size())
         return RTTimeSpecGetMilli(&mData.mStates.front().mTimestamp);
@@ -207,7 +183,7 @@ LONG64 AdditionsFacility::getLastUpdated() const
     return 0; /* Should never happen! */
 }
 
-AdditionsFacilityStatus_T AdditionsFacility::getStatus() const
+AdditionsFacilityStatus_T AdditionsFacility::i_getStatus() const
 {
     if (mData.mStates.size())
         return mData.mStates.back().mStatus;
@@ -216,7 +192,7 @@ AdditionsFacilityStatus_T AdditionsFacility::getStatus() const
     return AdditionsFacilityStatus_Unknown; /* Should never happen! */
 }
 
-AdditionsFacilityType_T AdditionsFacility::getType() const
+AdditionsFacilityType_T AdditionsFacility::i_getType() const
 {
     return mData.mType;
 }
@@ -224,7 +200,7 @@ AdditionsFacilityType_T AdditionsFacility::getType() const
 /**
  * Method used by IGuest::facilityUpdate to make updates.
  */
-void AdditionsFacility::update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS)
+void AdditionsFacility::i_update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS)
 {
     FacilityState state;
     state.mStatus    = a_enmStatus;
diff --git a/src/VBox/Main/src-client/AudioSnifferInterface.cpp b/src/VBox/Main/src-client/AudioSnifferInterface.cpp
index c5b902e..31563f2 100644
--- a/src/VBox/Main/src-client/AudioSnifferInterface.cpp
+++ b/src/VBox/Main/src-client/AudioSnifferInterface.cpp
@@ -26,6 +26,12 @@
 #include <VBox/vmm/cfgm.h>
 #include <VBox/err.h>
 
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
 //
 // defines
 //
@@ -99,7 +105,7 @@ DECLCALLBACK(void) iface_AudioSamplesOut (PPDMIAUDIOSNIFFERCONNECTOR pInterface,
      * Just call the VRDP server with the data.
      */
     VRDEAUDIOFORMAT format = VRDE_AUDIO_FMT_MAKE(samplesPerSec, nChannels, bitsPerSample, !fUnsigned);
-    pDrv->pAudioSniffer->getParent()->consoleVRDPServer()->SendAudioSamples(pvSamples, cSamples, format);
+    pDrv->pAudioSniffer->getParent()->i_consoleVRDPServer()->SendAudioSamples(pvSamples, cSamples, format);
 }
 
 DECLCALLBACK(void) iface_AudioVolumeOut (PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t left, uint16_t right)
@@ -109,7 +115,7 @@ DECLCALLBACK(void) iface_AudioVolumeOut (PPDMIAUDIOSNIFFERCONNECTOR pInterface,
     /*
      * Just call the VRDP server with the data.
      */
-    pDrv->pAudioSniffer->getParent()->consoleVRDPServer()->SendAudioVolume(left, right);
+    pDrv->pAudioSniffer->getParent()->i_consoleVRDPServer()->SendAudioVolume(left, right);
 }
 
 DECLCALLBACK(int) iface_AudioInputBegin (PPDMIAUDIOSNIFFERCONNECTOR pInterface,
@@ -122,7 +128,7 @@ DECLCALLBACK(int) iface_AudioInputBegin (PPDMIAUDIOSNIFFERCONNECTOR pInterface,
 {
     PDRVAUDIOSNIFFER pDrv = PDMIAUDIOSNIFFERCONNECTOR_2_MAINAUDIOSNIFFER(pInterface);
 
-    return pDrv->pAudioSniffer->getParent()->consoleVRDPServer()->SendAudioInputBegin(ppvUserCtx,
+    return pDrv->pAudioSniffer->getParent()->i_consoleVRDPServer()->SendAudioInputBegin(ppvUserCtx,
                                                                                       pvContext,
                                                                                       cSamples,
                                                                                       iSampleHz,
@@ -135,7 +141,7 @@ DECLCALLBACK(void) iface_AudioInputEnd (PPDMIAUDIOSNIFFERCONNECTOR pInterface,
 {
     PDRVAUDIOSNIFFER pDrv = PDMIAUDIOSNIFFERCONNECTOR_2_MAINAUDIOSNIFFER(pInterface);
 
-    pDrv->pAudioSniffer->getParent()->consoleVRDPServer()->SendAudioInputEnd(pvUserCtx);
+    pDrv->pAudioSniffer->getParent()->i_consoleVRDPServer()->SendAudioInputEnd(pvUserCtx);
 }
 
 
diff --git a/src/VBox/Main/src-client/BusAssignmentManager.cpp b/src/VBox/Main/src-client/BusAssignmentManager.cpp
index 068bb79..75d19a2 100644
--- a/src/VBox/Main/src-client/BusAssignmentManager.cpp
+++ b/src/VBox/Main/src-client/BusAssignmentManager.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -71,6 +71,7 @@ static const DeviceAssignmentRule aGenericRules[] =
     /* USB controllers */
     {"usb-ohci",      0,  6,  0, 0},
     {"usb-ehci",      0, 11,  0, 0},
+    {"usb-xhci",      0, 12,  0, 0},
 
     /* ACPI controller */
     {"acpi",          0,  7,  0, 0},
@@ -267,7 +268,7 @@ struct BusAssignmentManager::State
 
     const char* findAlias(const char* pszName);
     void addMatchingRules(const char* pszName, PCIRulesList& aList);
-    void listAttachedPCIDevices(ComSafeArrayOut(IPCIDeviceAttachment*, aAttached));
+    void listAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttached);
 };
 
 HRESULT BusAssignmentManager::State::init(ChipsetType_T chipsetType)
@@ -393,24 +394,21 @@ bool BusAssignmentManager::State::checkAvailable(PCIBusAddress& Address)
     return (it == mPCIMap.end());
 }
 
-
-void BusAssignmentManager::State::listAttachedPCIDevices(ComSafeArrayOut(IPCIDeviceAttachment*, aAttached))
+void BusAssignmentManager::State::listAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttached)
 {
-    com::SafeIfaceArray<IPCIDeviceAttachment> result(mPCIMap.size());
+    aAttached.resize(mPCIMap.size());
 
-    size_t iIndex = 0;
+    size_t i = 0;
     ComObjPtr<PCIDeviceAttachment> dev;
-    for (PCIMap::const_iterator it = mPCIMap.begin(); it !=  mPCIMap.end(); ++it)
+    for (PCIMap::const_iterator it = mPCIMap.begin(); it !=  mPCIMap.end(); ++it, ++i)
     {
         dev.createObject();
         com::Bstr devname(it->second.szDevName);
         dev->init(NULL, devname,
                   it->second.HostAddress.valid() ? it->second.HostAddress.asLong() : -1,
                   it->first.asLong(), it->second.HostAddress.valid());
-        result.setElement(iIndex++, dev);
+        dev.queryInterfaceTo(aAttached[i].asOutParam());
     }
-
-    result.detachTo(ComSafeArrayOutArg(aAttached));
 }
 
 BusAssignmentManager::BusAssignmentManager()
@@ -506,8 +504,7 @@ bool BusAssignmentManager::findPCIAddress(const char* pszDevName, int iInstance,
 {
     return pState->findPCIAddress(pszDevName, iInstance, Address);
 }
-
-void BusAssignmentManager::listAttachedPCIDevices(ComSafeArrayOut(IPCIDeviceAttachment*, aAttached))
+void BusAssignmentManager::listAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttached)
 {
-    pState->listAttachedPCIDevices(ComSafeArrayOutArg(aAttached));
+    pState->listAttachedPCIDevices(aAttached);
 }
diff --git a/src/VBox/Main/src-client/ClientTokenHolder.cpp b/src/VBox/Main/src-client/ClientTokenHolder.cpp
index 07ad83e..d7d17bc 100644
--- a/src/VBox/Main/src-client/ClientTokenHolder.cpp
+++ b/src/VBox/Main/src-client/ClientTokenHolder.cpp
@@ -1,3 +1,4 @@
+/* $Id: ClientTokenHolder.cpp $ */
 /** @file
  *
  * VirtualBox API client session token holder (in the client process)
diff --git a/src/VBox/Main/src-client/ConsoleImpl.cpp b/src/VBox/Main/src-client/ConsoleImpl.cpp
index 88a44c7..2d8cbd4 100644
--- a/src/VBox/Main/src-client/ConsoleImpl.cpp
+++ b/src/VBox/Main/src-client/ConsoleImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2005-2014 Oracle Corporation
+ * Copyright (C) 2005-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,29 +18,29 @@
 /** @todo Move the TAP mess back into the driver! */
 #if defined(RT_OS_WINDOWS)
 #elif defined(RT_OS_LINUX)
-#   include <errno.h>
-#   include <sys/ioctl.h>
-#   include <sys/poll.h>
-#   include <sys/fcntl.h>
-#   include <sys/types.h>
-#   include <sys/wait.h>
-#   include <net/if.h>
-#   include <linux/if_tun.h>
-#   include <stdio.h>
-#   include <stdlib.h>
-#   include <string.h>
+# include <errno.h>
+# include <sys/ioctl.h>
+# include <sys/poll.h>
+# include <sys/fcntl.h>
+# include <sys/types.h>
+# include <sys/wait.h>
+# include <net/if.h>
+# include <linux/if_tun.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
 #elif defined(RT_OS_FREEBSD)
-#   include <errno.h>
-#   include <sys/ioctl.h>
-#   include <sys/poll.h>
-#   include <sys/fcntl.h>
-#   include <sys/types.h>
-#   include <sys/wait.h>
-#   include <stdio.h>
-#   include <stdlib.h>
-#   include <string.h>
+# include <errno.h>
+# include <sys/ioctl.h>
+# include <sys/poll.h>
+# include <sys/fcntl.h>
+# include <sys/types.h>
+# include <sys/wait.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
 #elif defined(RT_OS_SOLARIS)
-#   include <iprt/coredumper.h>
+# include <iprt/coredumper.h>
 #endif
 
 #include "ConsoleImpl.h"
@@ -55,7 +55,11 @@
 #include "USBDeviceImpl.h"
 #include "RemoteUSBDeviceImpl.h"
 #include "SharedFolderImpl.h"
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+#include "DrvAudioVRDE.h"
+#else
 #include "AudioSnifferInterface.h"
+#endif
 #include "Nvram.h"
 #ifdef VBOX_WITH_USB_CARDREADER
 # include "UsbCardReader.h"
@@ -117,6 +121,10 @@
 # include <VBox/com/array.h>
 #endif
 
+#ifdef VBOX_OPENSSL_FIPS
+# include <openssl/crypto.h>
+#endif
+
 #include <set>
 #include <algorithm>
 #include <memory> // for auto_ptr
@@ -155,7 +163,6 @@ struct VMTask
           mConsoleCaller(aConsole),
           mProgress(aProgress),
           mServerProgress(aServerProgress),
-          mpUVM(NULL),
           mRC(E_FAIL),
           mpSafeVMPtr(NULL)
     {
@@ -166,9 +173,7 @@ struct VMTask
         if (aUsesVMPtr)
         {
             mpSafeVMPtr = new Console::SafeVMPtr(aConsole);
-            if (mpSafeVMPtr->isOk())
-                mpUVM = mpSafeVMPtr->rawUVM();
-            else
+            if (!mpSafeVMPtr->isOk())
                 mRC = mpSafeVMPtr->rc();
         }
     }
@@ -196,33 +201,12 @@ struct VMTask
     const ComObjPtr<Progress>   mProgress;
     Utf8Str                     mErrorMsg;
     const ComPtr<IProgress>     mServerProgress;
-    PUVM                        mpUVM;
 
 private:
     HRESULT                     mRC;
     Console::SafeVMPtr         *mpSafeVMPtr;
 };
 
-struct VMTakeSnapshotTask : public VMTask
-{
-    VMTakeSnapshotTask(Console *aConsole,
-                       Progress *aProgress,
-                       IN_BSTR aName,
-                       IN_BSTR aDescription)
-        : VMTask(aConsole, aProgress, NULL /* aServerProgress */,
-                 false /* aUsesVMPtr */),
-          bstrName(aName),
-          bstrDescription(aDescription),
-          lastMachineState(MachineState_Null)
-    {}
-
-    Bstr                    bstrName,
-                            bstrDescription;
-    Bstr                    bstrSavedStateFile;         // received from BeginTakeSnapshot()
-    MachineState_T          lastMachineState;
-    bool                    fTakingSnapshotOnline;
-    ULONG                   ulMemSize;
-};
 
 struct VMPowerUpTask : public VMTask
 {
@@ -257,27 +241,6 @@ struct VMPowerDownTask : public VMTask
     {}
 };
 
-struct VMSaveTask : public VMTask
-{
-    VMSaveTask(Console *aConsole,
-               const ComPtr<IProgress> &aServerProgress,
-               const Utf8Str &aSavedStateFile,
-               MachineState_T aMachineStateBefore,
-               Reason_T aReason)
-        : VMTask(aConsole, NULL /* aProgress */, aServerProgress,
-                 true /* aUsesVMPtr */),
-          mSavedStateFile(aSavedStateFile),
-          mMachineStateBefore(aMachineStateBefore),
-          mReason(aReason)
-    {}
-
-    Utf8Str mSavedStateFile;
-    /* The local machine state we had before. Required if something fails */
-    MachineState_T mMachineStateBefore;
-    /* The reason for saving state */
-    Reason_T mReason;
-};
-
 // Handler for global events
 ////////////////////////////////////////////////////////////////////////////////
 inline static const char *networkAdapterTypeToName(NetworkAdapterType_T adapterType);
@@ -302,24 +265,21 @@ public:
     {
     }
 
-    STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent * aEvent)
+    STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent)
     {
         switch(aType)
         {
             case VBoxEventType_OnNATRedirect:
             {
                 Bstr id;
-                ComPtr<IMachine> pMachine = mConsole->machine();
+                ComPtr<IMachine> pMachine = mConsole->i_machine();
                 ComPtr<INATRedirectEvent> pNREv = aEvent;
                 HRESULT rc = E_FAIL;
                 Assert(pNREv);
 
-                Bstr interestedId;
-                rc = pMachine->COMGETTER(Id)(interestedId.asOutParam());
-                AssertComRC(rc);
                 rc = pNREv->COMGETTER(MachineId)(id.asOutParam());
                 AssertComRC(rc);
-                if (id != interestedId)
+                if (id != mConsole->i_getId())
                     break;
                 /* now we can operate with redirects */
                 NATProtocol_T proto;
@@ -338,13 +298,13 @@ public:
                 AssertComRC(rc);
                 if (FAILED(rc))
                     break;
-                mConsole->onNATRedirectRuleChange(ulSlot, fRemove, proto, hostIp.raw(), hostPort, guestIp.raw(), guestPort);
+                mConsole->i_onNATRedirectRuleChange(ulSlot, fRemove, proto, hostIp.raw(), hostPort, guestIp.raw(), guestPort);
             }
             break;
 
             case VBoxEventType_OnHostNameResolutionConfigurationChange:
             {
-                mConsole->onNATDnsChanged();
+                mConsole->i_onNATDnsChanged();
                 break;
             }
 
@@ -371,13 +331,14 @@ public:
                 hrc = pEDCEv->COMGETTER(Value)(strVal.asOutParam());
                 if (FAILED(hrc)) break;
 
-                mConsole->onExtraDataChange(strMachineId.raw(), strKey.raw(), strVal.raw());
+                mConsole->i_onExtraDataChange(strMachineId.raw(), strKey.raw(), strVal.raw());
                 break;
             }
 
             default:
               AssertFailed();
         }
+
         return S_OK;
     }
 private:
@@ -411,12 +372,17 @@ Console::Console()
     , mfPowerOffCausedByReset(false)
     , mpVmm2UserMethods(NULL)
     , m_pVMMDev(NULL)
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    , mAudioVRDE(NULL)
+#else
     , mAudioSniffer(NULL)
+#endif
     , mNvram(NULL)
 #ifdef VBOX_WITH_USB_CARDREADER
     , mUsbCardReader(NULL)
 #endif
     , mBusMgr(NULL)
+    , m_pKeyStore(NULL)
     , mpIfSecKey(NULL)
     , mpIfSecKeyHlp(NULL)
     , mVMStateChangeCallbackDisabled(false)
@@ -436,6 +402,7 @@ HRESULT Console::FinalConstruct()
     RT_ZERO(mapNetworkLeds);
     RT_ZERO(mapUSBLed);
     RT_ZERO(mapSharedFolderLed);
+    RT_ZERO(mapCrOglLed);
 
     for (unsigned i = 0; i < RT_ELEMENTS(maStorageDevType); ++i)
         maStorageDevType[i] = DeviceType_Null;
@@ -445,12 +412,12 @@ HRESULT Console::FinalConstruct()
         return E_OUTOFMEMORY;
     pVmm2UserMethods->u32Magic          = VMM2USERMETHODS_MAGIC;
     pVmm2UserMethods->u32Version        = VMM2USERMETHODS_VERSION;
-    pVmm2UserMethods->pfnSaveState      = Console::vmm2User_SaveState;
-    pVmm2UserMethods->pfnNotifyEmtInit  = Console::vmm2User_NotifyEmtInit;
-    pVmm2UserMethods->pfnNotifyEmtTerm  = Console::vmm2User_NotifyEmtTerm;
-    pVmm2UserMethods->pfnNotifyPdmtInit = Console::vmm2User_NotifyPdmtInit;
-    pVmm2UserMethods->pfnNotifyPdmtTerm = Console::vmm2User_NotifyPdmtTerm;
-    pVmm2UserMethods->pfnNotifyResetTurnedIntoPowerOff = Console::vmm2User_NotifyResetTurnedIntoPowerOff;
+    pVmm2UserMethods->pfnSaveState      = Console::i_vmm2User_SaveState;
+    pVmm2UserMethods->pfnNotifyEmtInit  = Console::i_vmm2User_NotifyEmtInit;
+    pVmm2UserMethods->pfnNotifyEmtTerm  = Console::i_vmm2User_NotifyEmtTerm;
+    pVmm2UserMethods->pfnNotifyPdmtInit = Console::i_vmm2User_NotifyPdmtInit;
+    pVmm2UserMethods->pfnNotifyPdmtTerm = Console::i_vmm2User_NotifyPdmtTerm;
+    pVmm2UserMethods->pfnNotifyResetTurnedIntoPowerOff = Console::i_vmm2User_NotifyResetTurnedIntoPowerOff;
     pVmm2UserMethods->u32EndMagic       = VMM2USERMETHODS_MAGIC;
     pVmm2UserMethods->pConsole          = this;
     mpVmm2UserMethods = pVmm2UserMethods;
@@ -460,6 +427,8 @@ HRESULT Console::FinalConstruct()
         return E_OUTOFMEMORY;
     pIfSecKey->pfnKeyRetain             = Console::i_pdmIfSecKey_KeyRetain;
     pIfSecKey->pfnKeyRelease            = Console::i_pdmIfSecKey_KeyRelease;
+    pIfSecKey->pfnPasswordRetain        = Console::i_pdmIfSecKey_PasswordRetain;
+    pIfSecKey->pfnPasswordRelease       = Console::i_pdmIfSecKey_PasswordRelease;
     pIfSecKey->pConsole                 = this;
     mpIfSecKey = pIfSecKey;
 
@@ -506,6 +475,9 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc
     rc = mMachine->COMGETTER(State)(&mMachineState);
     AssertComRCReturnRC(rc);
 
+    rc = mMachine->COMGETTER(Id)(mstrUuid.asOutParam());
+    AssertComRCReturnRC(rc);
+
 #ifdef VBOX_WITH_EXTPACK
     unconst(mptrExtPackManager).createObject();
     rc = mptrExtPackManager->initExtPackManager(NULL, VBOXEXTPACKCTX_VM_PROCESS);
@@ -554,9 +526,9 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc
 
         /* Grab global and machine shared folder lists */
 
-        rc = fetchSharedFolders(true /* aGlobal */);
+        rc = i_fetchSharedFolders(true /* aGlobal */);
         AssertComRCReturnRC(rc);
-        rc = fetchSharedFolders(false /* aGlobal */);
+        rc = i_fetchSharedFolders(false /* aGlobal */);
         AssertComRCReturnRC(rc);
 
         /* Create other child objects */
@@ -580,17 +552,13 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc
         for (ULONG slot = 0; slot < maxNetworkAdapters; ++slot)
             meAttachmentType[slot] = NetworkAttachmentType_Null;
 
-        // VirtualBox 4.0: We no longer initialize the VMMDev instance here,
-        // which starts the HGCM thread. Instead, this is now done in the
-        // power-up thread when a VM is actually being powered up to avoid
-        // having HGCM threads all over the place every time a session is
-        // opened, even if that session will not run a VM.
-        //     unconst(m_pVMMDev) = new VMMDev(this);
-        //     AssertReturn(mVMMDev, E_FAIL);
-
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        unconst(mAudioVRDE) = new AudioVRDE(this);
+        AssertReturn(mAudioVRDE, E_FAIL);
+#else
         unconst(mAudioSniffer) = new AudioSniffer(this);
         AssertReturn(mAudioSniffer, E_FAIL);
-
+#endif
         FirmwareType_T enmFirmwareType;
         mMachine->COMGETTER(FirmwareType)(&enmFirmwareType);
         if (   enmFirmwareType == FirmwareType_EFI
@@ -607,6 +575,9 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc
         AssertReturn(mUsbCardReader, E_FAIL);
 #endif
 
+        unconst(m_pKeyStore) = new SecretKeyStore(true /* fKeyBufNonPageable */);
+        AssertReturn(m_pKeyStore, E_FAIL);
+
         /* VirtualBox events registration. */
         {
             ComPtr<IEventSource> pES;
@@ -632,7 +603,7 @@ HRESULT Console::init(IMachine *aMachine, IInternalMachineControl *aControl, Loc
 #ifdef VBOX_WITH_EXTPACK
     /* Let the extension packs have a go at things (hold no locks). */
     if (SUCCEEDED(rc))
-        mptrExtPackManager->callAllConsoleReadyHooks(this);
+        mptrExtPackManager->i_callAllConsoleReadyHooks(this);
 #endif
 
     LogFlowThisFuncLeave();
@@ -679,7 +650,7 @@ void Console::uninit()
     /* power down the VM if necessary */
     if (mpUVM)
     {
-        powerDown();
+        i_powerDown();
         Assert(mpUVM == NULL);
     }
 
@@ -721,11 +692,19 @@ void Console::uninit()
     }
 #endif
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    if (mAudioVRDE)
+    {
+        delete mAudioVRDE;
+        unconst(mAudioVRDE) = NULL;
+    }
+#else
     if (mAudioSniffer)
     {
         delete mAudioSniffer;
         unconst(mAudioSniffer) = NULL;
     }
+#endif
 
     // if the VM had a VMMDev with an HGCM thread, then remove that here
     if (m_pVMMDev)
@@ -740,6 +719,12 @@ void Console::uninit()
         mBusMgr = NULL;
     }
 
+    if (m_pKeyStore)
+    {
+        delete m_pKeyStore;
+        unconst(m_pKeyStore) = NULL;
+    }
+
     m_mapGlobalSharedFolders.clear();
     m_mapMachineSharedFolders.clear();
     m_mapSharedFolders.clear();             // console instances
@@ -747,12 +732,6 @@ void Console::uninit()
     mRemoteUSBDevices.clear();
     mUSBDevices.clear();
 
-    for (SecretKeyMap::iterator it = m_mapSecretKeys.begin();
-         it != m_mapSecretKeys.end();
-         it++)
-        delete it->second;
-    m_mapSecretKeys.clear();
-
     if (mVRDEServerInfo)
     {
         mVRDEServerInfo->uninit();
@@ -809,10 +788,6 @@ void Console::uninit()
     // we don't perform uninit() as it's possible that some pending event refers to this source
     unconst(mEventSource).setNull();
 
-#ifdef CONSOLE_WITH_EVENT_CACHE
-    mCallbackData.clear();
-#endif
-
     LogFlowThisFuncLeave();
 }
 
@@ -828,28 +803,24 @@ void Console::uninit()
  *       (IMachine::SetGuestProperty ends up in VBoxSVC, which in turns calls
  *       back into the VM process and the HGCM service.)
  */
-void Console::guestPropertiesHandleVMReset(void)
-{
-    com::SafeArray<BSTR>   arrNames;
-    com::SafeArray<BSTR>   arrValues;
-    com::SafeArray<LONG64> arrTimestamps;
-    com::SafeArray<BSTR>   arrFlags;
-    HRESULT hrc = enumerateGuestProperties(Bstr("*").raw(),
-                                           ComSafeArrayAsOutParam(arrNames),
-                                           ComSafeArrayAsOutParam(arrValues),
-                                           ComSafeArrayAsOutParam(arrTimestamps),
-                                           ComSafeArrayAsOutParam(arrFlags));
+void Console::i_guestPropertiesHandleVMReset(void)
+{
+    std::vector<Utf8Str> names;
+    std::vector<Utf8Str> values;
+    std::vector<LONG64>  timestamps;
+    std::vector<Utf8Str> flags;
+    HRESULT hrc = i_enumerateGuestProperties("*", names, values, timestamps, flags);
     if (SUCCEEDED(hrc))
     {
-        for (size_t i = 0; i < arrFlags.size(); i++)
+        for (size_t i = 0; i < flags.size(); i++)
         {
             /* Delete all properties which have the flag "TRANSRESET". */
-            if (Utf8Str(arrFlags[i]).contains("TRANSRESET", Utf8Str::CaseInsensitive))
+            if (flags[i].contains("TRANSRESET", Utf8Str::CaseInsensitive))
             {
-                hrc = mMachine->DeleteGuestProperty(arrNames[i]);
+                hrc = mMachine->DeleteGuestProperty(Bstr(names[i]).raw());
                 if (FAILED(hrc))
-                    LogRel(("RESET: Could not delete transient property \"%ls\", rc=%Rhrc\n",
-                            arrNames[i], hrc));
+                    LogRel(("RESET: Could not delete transient property \"%s\", rc=%Rhrc\n",
+                            names[i].c_str(), hrc));
             }
         }
     }
@@ -857,7 +828,7 @@ void Console::guestPropertiesHandleVMReset(void)
         LogRel(("RESET: Unable to enumerate guest properties, rc=%Rhrc\n", hrc));
 }
 
-bool Console::guestPropertiesVRDPEnabled(void)
+bool Console::i_guestPropertiesVRDPEnabled(void)
 {
     Bstr value;
     HRESULT hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/EnableGuestPropertiesVRDP").raw(),
@@ -868,9 +839,9 @@ bool Console::guestPropertiesVRDPEnabled(void)
     return false;
 }
 
-void Console::guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain)
+void Console::i_guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *pszUser, const char *pszDomain)
 {
-    if (!guestPropertiesVRDPEnabled())
+    if (!i_guestPropertiesVRDPEnabled())
         return;
 
     LogFlowFunc(("\n"));
@@ -905,9 +876,9 @@ void Console::guestPropertiesVRDPUpdateLogon(uint32_t u32ClientId, const char *p
     return;
 }
 
-void Console::guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId)
+void Console::i_guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId)
 {
-    if (!guestPropertiesVRDPEnabled())
+    if (!i_guestPropertiesVRDPEnabled())
         return;
 
     LogFlowFunc(("%d\n", u32ClientId));
@@ -924,9 +895,9 @@ void Console::guestPropertiesVRDPUpdateActiveClient(uint32_t u32ClientId)
     return;
 }
 
-void Console::guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName)
+void Console::i_guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const char *pszName)
 {
-    if (!guestPropertiesVRDPEnabled())
+    if (!i_guestPropertiesVRDPEnabled())
         return;
 
     LogFlowFunc(("\n"));
@@ -943,9 +914,9 @@ void Console::guestPropertiesVRDPUpdateNameChange(uint32_t u32ClientId, const ch
 
 }
 
-void Console::guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr)
+void Console::i_guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const char *pszIPAddr)
 {
-    if (!guestPropertiesVRDPEnabled())
+    if (!i_guestPropertiesVRDPEnabled())
         return;
 
     LogFlowFunc(("\n"));
@@ -962,9 +933,9 @@ void Console::guestPropertiesVRDPUpdateIPAddrChange(uint32_t u32ClientId, const
 
 }
 
-void Console::guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation)
+void Console::i_guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, const char *pszLocation)
 {
-    if (!guestPropertiesVRDPEnabled())
+    if (!i_guestPropertiesVRDPEnabled())
         return;
 
     LogFlowFunc(("\n"));
@@ -981,9 +952,9 @@ void Console::guestPropertiesVRDPUpdateLocationChange(uint32_t u32ClientId, cons
 
 }
 
-void Console::guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo)
+void Console::i_guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, const char *pszOtherInfo)
 {
-    if (!guestPropertiesVRDPEnabled())
+    if (!i_guestPropertiesVRDPEnabled())
         return;
 
     LogFlowFunc(("\n"));
@@ -1000,9 +971,9 @@ void Console::guestPropertiesVRDPUpdateOtherInfoChange(uint32_t u32ClientId, con
 
 }
 
-void Console::guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached)
+void Console::i_guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool fAttached)
 {
-    if (!guestPropertiesVRDPEnabled())
+    if (!i_guestPropertiesVRDPEnabled())
         return;
 
     LogFlowFunc(("\n"));
@@ -1019,9 +990,9 @@ void Console::guestPropertiesVRDPUpdateClientAttach(uint32_t u32ClientId, bool f
                                bstrReadOnlyGuest.raw());
 }
 
-void Console::guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId)
+void Console::i_guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId)
 {
-    if (!guestPropertiesVRDPEnabled())
+    if (!i_guestPropertiesVRDPEnabled())
         return;
 
     LogFlowFunc(("\n"));
@@ -1056,7 +1027,7 @@ void Console::guestPropertiesVRDPUpdateDisconnect(uint32_t u32ClientId)
 
 #endif /* VBOX_WITH_GUEST_PROPS */
 
-bool Console::isResetTurnedIntoPowerOff(void)
+bool Console::i_isResetTurnedIntoPowerOff(void)
 {
     Bstr value;
     HRESULT hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/TurnResetIntoPowerOff").raw(),
@@ -1073,14 +1044,14 @@ bool Console::isResetTurnedIntoPowerOff(void)
  *
  * @returns The extension pack manager.
  */
-ExtPackManager *Console::getExtPackManager()
+ExtPackManager *Console::i_getExtPackManager()
 {
     return mptrExtPackManager;
 }
 #endif
 
 
-int Console::VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain)
+int Console::i_VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain)
 {
     LogFlowFuncEnter();
     LogFlowFunc(("%d, %s, %s, %s\n", u32ClientId, pszUser, pszPassword, pszDomain));
@@ -1094,14 +1065,10 @@ int Console::VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const ch
         return VERR_ACCESS_DENIED;
     }
 
-    Bstr id;
-    HRESULT hrc = mMachine->COMGETTER(Id)(id.asOutParam());
-    Guid uuid = Guid(id);
-
-    AssertComRCReturn(hrc, VERR_ACCESS_DENIED);
+    Guid uuid = Guid(i_getId());
 
     AuthType_T authType = AuthType_Null;
-    hrc = mVRDEServer->COMGETTER(AuthType)(&authType);
+    HRESULT hrc = mVRDEServer->COMGETTER(AuthType)(&authType);
     AssertComRCReturn(hrc, VERR_ACCESS_DENIED);
 
     ULONG authTimeout = 0;
@@ -1173,7 +1140,8 @@ int Console::VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const ch
 
                     if (RT_SUCCESS(rc))
                     {
-                        switch (u32GuestFlags & (VMMDEV_CREDENTIALS_JUDGE_OK | VMMDEV_CREDENTIALS_JUDGE_DENY | VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT))
+                        switch (u32GuestFlags & (VMMDEV_CREDENTIALS_JUDGE_OK | VMMDEV_CREDENTIALS_JUDGE_DENY |
+                                                 VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT))
                         {
                             case VMMDEV_CREDENTIALS_JUDGE_DENY:        guestJudgement = AuthGuestAccessDenied;  break;
                             case VMMDEV_CREDENTIALS_JUDGE_NOJUDGEMENT: guestJudgement = AuthGuestNoJudgement;   break;
@@ -1240,7 +1208,8 @@ int Console::VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const ch
     hrc = mVRDEServer->COMGETTER(ReuseSingleConnection)(&reuseSingleConnection);
     AssertComRCReturn(hrc, VERR_ACCESS_DENIED);
 
-    LogFlowFunc(("allowMultiConnection %d, reuseSingleConnection = %d, mcVRDPClients = %d, mu32SingleRDPClientId = %d\n", allowMultiConnection, reuseSingleConnection, mcVRDPClients, mu32SingleRDPClientId));
+    LogFlowFunc(("allowMultiConnection %d, reuseSingleConnection = %d, mcVRDPClients = %d, mu32SingleRDPClientId = %d\n",
+                 allowMultiConnection, reuseSingleConnection, mcVRDPClients, mu32SingleRDPClientId));
 
     if (allowMultiConnection == FALSE)
     {
@@ -1272,7 +1241,7 @@ int Console::VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const ch
     }
 
 #ifdef VBOX_WITH_GUEST_PROPS
-    guestPropertiesVRDPUpdateLogon(u32ClientId, pszUser, pszDomain);
+    i_guestPropertiesVRDPUpdateLogon(u32ClientId, pszUser, pszDomain);
 #endif /* VBOX_WITH_GUEST_PROPS */
 
     /* Check if the successfully verified credentials are to be sent to the guest. */
@@ -1284,14 +1253,14 @@ int Console::VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const ch
     if (SUCCEEDED(hrc) && value == "1")
     {
         /* Provide credentials only if there are no logged in users. */
-        Bstr noLoggedInUsersValue;
+        Utf8Str noLoggedInUsersValue;
         LONG64 ul64Timestamp = 0;
-        Bstr flags;
+        Utf8Str flags;
 
-        hrc = getGuestProperty(Bstr("/VirtualBox/GuestInfo/OS/NoLoggedInUsers").raw(),
-                               noLoggedInUsersValue.asOutParam(), &ul64Timestamp, flags.asOutParam());
+        hrc = i_getGuestProperty("/VirtualBox/GuestInfo/OS/NoLoggedInUsers",
+                                 &noLoggedInUsersValue, &ul64Timestamp, &flags);
 
-        if (SUCCEEDED(hrc) && noLoggedInUsersValue != Bstr("false"))
+        if (SUCCEEDED(hrc) && noLoggedInUsersValue != "false")
         {
             /* And only if there are no connected clients. */
             if (ASMAtomicCmpXchgBool(&mcGuestCredentialsProvided, true, false))
@@ -1319,7 +1288,7 @@ int Console::VRDPClientLogon(uint32_t u32ClientId, const char *pszUser, const ch
     return VINF_SUCCESS;
 }
 
-void Console::VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus)
+void Console::i_VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus)
 {
     LogFlowFuncEnter();
 
@@ -1332,34 +1301,34 @@ void Console::VRDPClientStatusChange(uint32_t u32ClientId, const char *pszStatus
     /* Parse the status string. */
     if (RTStrICmp(pszStatus, "ATTACH") == 0)
     {
-        guestPropertiesVRDPUpdateClientAttach(u32ClientId, true);
+        i_guestPropertiesVRDPUpdateClientAttach(u32ClientId, true);
     }
     else if (RTStrICmp(pszStatus, "DETACH") == 0)
     {
-        guestPropertiesVRDPUpdateClientAttach(u32ClientId, false);
+        i_guestPropertiesVRDPUpdateClientAttach(u32ClientId, false);
     }
     else if (RTStrNICmp(pszStatus, "NAME=", strlen("NAME=")) == 0)
     {
-        guestPropertiesVRDPUpdateNameChange(u32ClientId, pszStatus + strlen("NAME="));
+        i_guestPropertiesVRDPUpdateNameChange(u32ClientId, pszStatus + strlen("NAME="));
     }
     else if (RTStrNICmp(pszStatus, "CIPA=", strlen("CIPA=")) == 0)
     {
-        guestPropertiesVRDPUpdateIPAddrChange(u32ClientId, pszStatus + strlen("CIPA="));
+        i_guestPropertiesVRDPUpdateIPAddrChange(u32ClientId, pszStatus + strlen("CIPA="));
     }
     else if (RTStrNICmp(pszStatus, "CLOCATION=", strlen("CLOCATION=")) == 0)
     {
-        guestPropertiesVRDPUpdateLocationChange(u32ClientId, pszStatus + strlen("CLOCATION="));
+        i_guestPropertiesVRDPUpdateLocationChange(u32ClientId, pszStatus + strlen("CLOCATION="));
     }
     else if (RTStrNICmp(pszStatus, "COINFO=", strlen("COINFO=")) == 0)
     {
-        guestPropertiesVRDPUpdateOtherInfoChange(u32ClientId, pszStatus + strlen("COINFO="));
+        i_guestPropertiesVRDPUpdateOtherInfoChange(u32ClientId, pszStatus + strlen("COINFO="));
     }
 #endif
 
     LogFlowFuncLeave();
 }
 
-void Console::VRDPClientConnect(uint32_t u32ClientId)
+void Console::i_VRDPClientConnect(uint32_t u32ClientId)
 {
     LogFlowFuncEnter();
 
@@ -1370,7 +1339,7 @@ void Console::VRDPClientConnect(uint32_t u32ClientId)
     VMMDev *pDev;
     PPDMIVMMDEVPORT pPort;
     if (    (u32Clients == 1)
-         && ((pDev = getVMMDev()))
+         && ((pDev = i_getVMMDev()))
          && ((pPort = pDev->getVMMDevPort()))
        )
     {
@@ -1380,18 +1349,18 @@ void Console::VRDPClientConnect(uint32_t u32ClientId)
     }
 
     NOREF(u32ClientId);
-    mDisplay->VideoAccelVRDP(true);
+    mDisplay->i_VideoAccelVRDP(true);
 
 #ifdef VBOX_WITH_GUEST_PROPS
-    guestPropertiesVRDPUpdateActiveClient(u32ClientId);
+    i_guestPropertiesVRDPUpdateActiveClient(u32ClientId);
 #endif /* VBOX_WITH_GUEST_PROPS */
 
     LogFlowFuncLeave();
     return;
 }
 
-void Console::VRDPClientDisconnect(uint32_t u32ClientId,
-                                   uint32_t fu32Intercepted)
+void Console::i_VRDPClientDisconnect(uint32_t u32ClientId,
+                                     uint32_t fu32Intercepted)
 {
     LogFlowFuncEnter();
 
@@ -1405,7 +1374,7 @@ void Console::VRDPClientDisconnect(uint32_t u32ClientId,
     PPDMIVMMDEVPORT pPort;
 
     if (    (u32Clients == 0)
-         && ((pDev = getVMMDev()))
+         && ((pDev = i_getVMMDev()))
          && ((pPort = pDev->getVMMDevPort()))
        )
     {
@@ -1414,7 +1383,7 @@ void Console::VRDPClientDisconnect(uint32_t u32ClientId,
                              0);
     }
 
-    mDisplay->VideoAccelVRDP(false);
+    mDisplay->i_VideoAccelVRDP(false);
 
     if (fu32Intercepted & VRDE_CLIENT_INTERCEPT_USB)
     {
@@ -1428,6 +1397,10 @@ void Console::VRDPClientDisconnect(uint32_t u32ClientId,
 
     if (fu32Intercepted & VRDE_CLIENT_INTERCEPT_AUDIO)
     {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        if (mAudioVRDE)
+            mAudioVRDE->onVRDEControl(false /* fEnable */, 0 /* uFlags */);
+#else
         mcAudioRefs--;
 
         if (mcAudioRefs <= 0)
@@ -1436,28 +1409,23 @@ void Console::VRDPClientDisconnect(uint32_t u32ClientId,
             {
                 PPDMIAUDIOSNIFFERPORT port = mAudioSniffer->getAudioSnifferPort();
                 if (port)
-                {
                     port->pfnSetup(port, false, false);
-                }
             }
         }
+#endif
     }
 
-    Bstr uuid;
-    HRESULT hrc = mMachine->COMGETTER(Id)(uuid.asOutParam());
-    AssertComRC(hrc);
-
     AuthType_T authType = AuthType_Null;
-    hrc = mVRDEServer->COMGETTER(AuthType)(&authType);
+    HRESULT hrc = mVRDEServer->COMGETTER(AuthType)(&authType);
     AssertComRC(hrc);
 
     if (authType == AuthType_External)
-        mConsoleVRDPServer->AuthDisconnect(uuid, u32ClientId);
+        mConsoleVRDPServer->AuthDisconnect(i_getId(), u32ClientId);
 
 #ifdef VBOX_WITH_GUEST_PROPS
-    guestPropertiesVRDPUpdateDisconnect(u32ClientId);
+    i_guestPropertiesVRDPUpdateDisconnect(u32ClientId);
     if (u32Clients == 0)
-        guestPropertiesVRDPUpdateActiveClient(0);
+        i_guestPropertiesVRDPUpdateActiveClient(0);
 #endif /* VBOX_WITH_GUEST_PROPS */
 
     if (u32Clients == 0)
@@ -1467,17 +1435,19 @@ void Console::VRDPClientDisconnect(uint32_t u32ClientId,
     return;
 }
 
-void Console::VRDPInterceptAudio(uint32_t u32ClientId)
+void Console::i_VRDPInterceptAudio(uint32_t u32ClientId)
 {
     LogFlowFuncEnter();
 
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
 
-    LogFlowFunc(("mAudioSniffer %p, u32ClientId %d.\n",
-                 mAudioSniffer, u32ClientId));
-    NOREF(u32ClientId);
+    LogFlowFunc(("u32ClientId=%RU32\n", u32ClientId));
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    if (mAudioVRDE)
+        mAudioVRDE->onVRDEControl(true /* fEnable */, 0 /* uFlags */);
+#else
     ++mcAudioRefs;
 
     if (mcAudioRefs == 1)
@@ -1486,17 +1456,16 @@ void Console::VRDPInterceptAudio(uint32_t u32ClientId)
         {
             PPDMIAUDIOSNIFFERPORT port = mAudioSniffer->getAudioSnifferPort();
             if (port)
-            {
                 port->pfnSetup(port, true, true);
-            }
         }
     }
+#endif
 
     LogFlowFuncLeave();
     return;
 }
 
-void Console::VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept)
+void Console::i_VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept)
 {
     LogFlowFuncEnter();
 
@@ -1511,7 +1480,7 @@ void Console::VRDPInterceptUSB(uint32_t u32ClientId, void **ppvIntercept)
     return;
 }
 
-void Console::VRDPInterceptClipboard(uint32_t u32ClientId)
+void Console::i_VRDPInterceptClipboard(uint32_t u32ClientId)
 {
     LogFlowFuncEnter();
 
@@ -1566,7 +1535,7 @@ inline static const char *networkAdapterTypeToName(NetworkAdapterType_T adapterT
  *
  * @note The caller must lock this object for writing.
  */
-HRESULT Console::loadDataFromSavedState()
+HRESULT Console::i_loadDataFromSavedState()
 {
     if (mMachineState != MachineState_Saved || mSavedStateDataLoaded)
         return S_OK;
@@ -1585,7 +1554,7 @@ HRESULT Console::loadDataFromSavedState()
         if (SSM_VERSION_MAJOR(version) == SSM_VERSION_MAJOR(sSSMConsoleVer))
         {
             if (RT_SUCCESS(vrc))
-                vrc = loadStateFileExecInternal(ssm, version);
+                vrc = i_loadStateFileExecInternal(ssm, version);
             else if (vrc == VERR_SSM_UNIT_NOT_FOUND)
                 vrc = VINF_SUCCESS;
         }
@@ -1614,8 +1583,7 @@ HRESULT Console::loadDataFromSavedState()
  * @note Locks the Console object for reading.
  */
 //static
-DECLCALLBACK(void)
-Console::saveStateFileExec(PSSMHANDLE pSSM, void *pvUser)
+DECLCALLBACK(void) Console::i_saveStateFileExec(PSSMHANDLE pSSM, void *pvUser)
 {
     LogFlowFunc(("\n"));
 
@@ -1638,22 +1606,22 @@ Console::saveStateFileExec(PSSMHANDLE pSSM, void *pvUser)
         AutoCaller sfCaller(pSF);
         AutoReadLock sfLock(pSF COMMA_LOCKVAL_SRC_POS);
 
-        Utf8Str name = pSF->getName();
+        Utf8Str name = pSF->i_getName();
         vrc = SSMR3PutU32(pSSM, (uint32_t)name.length() + 1 /* term. 0 */);
         AssertRC(vrc);
         vrc = SSMR3PutStrZ(pSSM, name.c_str());
         AssertRC(vrc);
 
-        Utf8Str hostPath = pSF->getHostPath();
+        Utf8Str hostPath = pSF->i_getHostPath();
         vrc = SSMR3PutU32(pSSM, (uint32_t)hostPath.length() + 1 /* term. 0 */);
         AssertRC(vrc);
         vrc = SSMR3PutStrZ(pSSM, hostPath.c_str());
         AssertRC(vrc);
 
-        vrc = SSMR3PutBool(pSSM, !!pSF->isWritable());
+        vrc = SSMR3PutBool(pSSM, !!pSF->i_isWritable());
         AssertRC(vrc);
 
-        vrc = SSMR3PutBool(pSSM, !!pSF->isAutoMounted());
+        vrc = SSMR3PutBool(pSSM, !!pSF->i_isAutoMounted());
         AssertRC(vrc);
     }
 
@@ -1673,7 +1641,7 @@ Console::saveStateFileExec(PSSMHANDLE pSSM, void *pvUser)
  */
 //static
 DECLCALLBACK(int)
-Console::loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass)
+Console::i_loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass)
 {
     LogFlowFunc(("\n"));
 
@@ -1698,8 +1666,7 @@ Console::loadStateFileExec(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uin
  *
  * @note Locks the Console object for writing.
  */
-int
-Console::loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version)
+int Console::i_loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), VERR_ACCESS_DENIED);
@@ -1763,10 +1730,10 @@ Console::loadStateFileExecInternal(PSSMHANDLE pSSM, uint32_t u32Version)
 #ifdef VBOX_WITH_GUEST_PROPS
 
 // static
-DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension,
-                                                   uint32_t u32Function,
-                                                   void *pvParms,
-                                                   uint32_t cbParms)
+DECLCALLBACK(int) Console::i_doGuestPropNotification(void *pvExtension,
+                                                     uint32_t u32Function,
+                                                     void *pvParms,
+                                                     uint32_t cbParms)
 {
     using namespace guestProp;
 
@@ -1787,10 +1754,12 @@ DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension,
     Bstr value(pCBData->pcszValue);
     Bstr flags(pCBData->pcszFlags);
     ComObjPtr<Console> pConsole = reinterpret_cast<Console *>(pvExtension);
+    BOOL fNotify = FALSE;
     HRESULT hrc = pConsole->mControl->PushGuestProperty(name.raw(),
                                                         value.raw(),
                                                         pCBData->u64Timestamp,
-                                                        flags.raw());
+                                                        flags.raw(),
+                                                        &fNotify);
     if (SUCCEEDED(hrc))
         rc = VINF_SUCCESS;
     else
@@ -1799,14 +1768,16 @@ DECLCALLBACK(int) Console::doGuestPropNotification(void *pvExtension,
                  hrc, pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags));
         rc = Global::vboxStatusCodeFromCOM(hrc);
     }
+    if (fNotify)
+        fireGuestPropertyChangedEvent(pConsole->mEventSource, pConsole->i_getId().raw(), name.raw(), value.raw(), flags.raw());
     return rc;
 }
 
-HRESULT Console::doEnumerateGuestProperties(CBSTR aPatterns,
-                                            ComSafeArrayOut(BSTR, aNames),
-                                            ComSafeArrayOut(BSTR, aValues),
-                                            ComSafeArrayOut(LONG64, aTimestamps),
-                                            ComSafeArrayOut(BSTR, aFlags))
+HRESULT Console::i_doEnumerateGuestProperties(const Utf8Str &aPatterns,
+                                              std::vector<Utf8Str> &aNames,
+                                              std::vector<Utf8Str> &aValues,
+                                              std::vector<LONG64>  &aTimestamps,
+                                              std::vector<Utf8Str> &aFlags)
 {
     AssertReturn(m_pVMMDev, E_FAIL);
 
@@ -1814,10 +1785,9 @@ HRESULT Console::doEnumerateGuestProperties(CBSTR aPatterns,
 
     VBOXHGCMSVCPARM parm[3];
 
-    Utf8Str utf8Patterns(aPatterns);
     parm[0].type = VBOX_HGCM_SVC_PARM_PTR;
-    parm[0].u.pointer.addr = (void*)utf8Patterns.c_str();
-    parm[0].u.pointer.size = (uint32_t)utf8Patterns.length() + 1;
+    parm[0].u.pointer.addr = (void*)aPatterns.c_str();
+    parm[0].u.pointer.size = (uint32_t)aPatterns.length() + 1;
 
     /*
      * Now things get slightly complicated. Due to a race with the guest adding
@@ -1839,9 +1809,14 @@ HRESULT Console::doEnumerateGuestProperties(CBSTR aPatterns,
         {
             return E_OUTOFMEMORY;
         }
+
         parm[1].type = VBOX_HGCM_SVC_PARM_PTR;
         parm[1].u.pointer.addr = Utf8Buf.mutableRaw();
         parm[1].u.pointer.size = (uint32_t)cchBuf + 1024;
+
+        parm[2].type = VBOX_HGCM_SVC_PARM_32BIT;
+        parm[2].u.uint32 = 0;
+
         vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", ENUM_PROPS_HOST, 3,
                                       &parm[0]);
         Utf8Buf.jolt();
@@ -1870,34 +1845,32 @@ HRESULT Console::doEnumerateGuestProperties(CBSTR aPatterns,
        ++cEntries;
     }
 
-    /*
-     * And now we create the COM safe arrays and fill them in.
-     */
-    com::SafeArray<BSTR> names(cEntries);
-    com::SafeArray<BSTR> values(cEntries);
-    com::SafeArray<LONG64> timestamps(cEntries);
-    com::SafeArray<BSTR> flags(cEntries);
+    aNames.resize(cEntries);
+    aValues.resize(cEntries);
+    aTimestamps.resize(cEntries);
+    aFlags.resize(cEntries);
+
     size_t iBuf = 0;
     /* Rely on the service to have formated the data correctly. */
     for (unsigned i = 0; i < cEntries; ++i)
     {
         size_t cchName = strlen(pszBuf + iBuf);
-        Bstr(pszBuf + iBuf).detachTo(&names[i]);
+        aNames[i] = &pszBuf[iBuf];
         iBuf += cchName + 1;
+
         size_t cchValue = strlen(pszBuf + iBuf);
-        Bstr(pszBuf + iBuf).detachTo(&values[i]);
+        aValues[i] = &pszBuf[iBuf];
         iBuf += cchValue + 1;
+
         size_t cchTimestamp = strlen(pszBuf + iBuf);
-        timestamps[i] = RTStrToUInt64(pszBuf + iBuf);
+        aTimestamps[i] = RTStrToUInt64(&pszBuf[iBuf]);
         iBuf += cchTimestamp + 1;
+
         size_t cchFlags = strlen(pszBuf + iBuf);
-        Bstr(pszBuf + iBuf).detachTo(&flags[i]);
+        aFlags[i] = &pszBuf[iBuf];
         iBuf += cchFlags + 1;
     }
-    names.detachTo(ComSafeArrayOutArg(aNames));
-    values.detachTo(ComSafeArrayOutArg(aValues));
-    timestamps.detachTo(ComSafeArrayOutArg(aTimestamps));
-    flags.detachTo(ComSafeArrayOutArg(aFlags));
+
     return S_OK;
 }
 
@@ -1906,16 +1879,10 @@ HRESULT Console::doEnumerateGuestProperties(CBSTR aPatterns,
 
 // IConsole properties
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP Console::COMGETTER(Machine)(IMachine **aMachine)
+HRESULT Console::getMachine(ComPtr<IMachine> &aMachine)
 {
-    CheckComArgOutPointerValid(aMachine);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mMachine is constant during life time, no need to lock */
-    mMachine.queryInterfaceTo(aMachine);
+    mMachine.queryInterfaceTo(aMachine.asOutParam());
 
     /* callers expect to get a valid reference, better fail than crash them */
     if (mMachine.isNull())
@@ -1924,80 +1891,50 @@ STDMETHODIMP Console::COMGETTER(Machine)(IMachine **aMachine)
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(State)(MachineState_T *aMachineState)
+HRESULT Console::getState(MachineState_T *aState)
 {
-    CheckComArgOutPointerValid(aMachineState);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* we return our local state (since it's always the same as on the server) */
-    *aMachineState = mMachineState;
+    *aState = mMachineState;
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(Guest)(IGuest **aGuest)
+HRESULT Console::getGuest(ComPtr<IGuest> &aGuest)
 {
-    CheckComArgOutPointerValid(aGuest);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mGuest is constant during life time, no need to lock */
-    mGuest.queryInterfaceTo(aGuest);
+    mGuest.queryInterfaceTo(aGuest.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(Keyboard)(IKeyboard **aKeyboard)
+HRESULT Console::getKeyboard(ComPtr<IKeyboard> &aKeyboard)
 {
-    CheckComArgOutPointerValid(aKeyboard);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mKeyboard is constant during life time, no need to lock */
-    mKeyboard.queryInterfaceTo(aKeyboard);
+    mKeyboard.queryInterfaceTo(aKeyboard.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(Mouse)(IMouse **aMouse)
+HRESULT Console::getMouse(ComPtr<IMouse> &aMouse)
 {
-    CheckComArgOutPointerValid(aMouse);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mMouse is constant during life time, no need to lock */
-    mMouse.queryInterfaceTo(aMouse);
+    mMouse.queryInterfaceTo(aMouse.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(Display)(IDisplay **aDisplay)
+HRESULT Console::getDisplay(ComPtr<IDisplay> &aDisplay)
 {
-    CheckComArgOutPointerValid(aDisplay);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mDisplay is constant during life time, no need to lock */
-    mDisplay.queryInterfaceTo(aDisplay);
+    mDisplay.queryInterfaceTo(aDisplay.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(Debugger)(IMachineDebugger **aDebugger)
+HRESULT Console::getDebugger(ComPtr<IMachineDebugger> &aDebugger)
 {
-    CheckComArgOutPointerValid(aDebugger);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* we need a write lock because of the lazy mDebugger initialization*/
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -2008,131 +1945,91 @@ STDMETHODIMP Console::COMGETTER(Debugger)(IMachineDebugger **aDebugger)
         mDebugger->init(this);
     }
 
-    mDebugger.queryInterfaceTo(aDebugger);
+    mDebugger.queryInterfaceTo(aDebugger.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(USBDevices)(ComSafeArrayOut(IUSBDevice *, aUSBDevices))
+HRESULT Console::getUSBDevices(std::vector<ComPtr<IUSBDevice> > &aUSBDevices)
 {
-    CheckComArgOutSafeArrayPointerValid(aUSBDevices);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IUSBDevice> collection(mUSBDevices);
-    collection.detachTo(ComSafeArrayOutArg(aUSBDevices));
+    size_t i = 0;
+    aUSBDevices.resize(mUSBDevices.size());
+    for (USBDeviceList::const_iterator it = mUSBDevices.begin(); it != mUSBDevices.end(); ++i, ++it)
+        (*it).queryInterfaceTo(aUSBDevices[i].asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(RemoteUSBDevices)(ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices))
-{
-    CheckComArgOutSafeArrayPointerValid(aRemoteUSBDevices);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT Console::getRemoteUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aRemoteUSBDevices)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IHostUSBDevice> collection(mRemoteUSBDevices);
-    collection.detachTo(ComSafeArrayOutArg(aRemoteUSBDevices));
+    size_t i = 0;
+    aRemoteUSBDevices.resize(mRemoteUSBDevices.size());
+    for (RemoteUSBDeviceList::const_iterator it = mRemoteUSBDevices.begin(); it != mRemoteUSBDevices.end(); ++i, ++it)
+        (*it).queryInterfaceTo(aRemoteUSBDevices[i].asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(VRDEServerInfo)(IVRDEServerInfo **aVRDEServerInfo)
+HRESULT Console::getVRDEServerInfo(ComPtr<IVRDEServerInfo> &aVRDEServerInfo)
 {
-    CheckComArgOutPointerValid(aVRDEServerInfo);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mVRDEServerInfo is constant during life time, no need to lock */
-    mVRDEServerInfo.queryInterfaceTo(aVRDEServerInfo);
+    mVRDEServerInfo.queryInterfaceTo(aVRDEServerInfo.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(EmulatedUSB)(IEmulatedUSB **aEmulatedUSB)
+HRESULT Console::getEmulatedUSB(ComPtr<IEmulatedUSB> &aEmulatedUSB)
 {
-    CheckComArgOutPointerValid(aEmulatedUSB);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mEmulatedUSB is constant during life time, no need to lock */
-    mEmulatedUSB.queryInterfaceTo(aEmulatedUSB);
+    mEmulatedUSB.queryInterfaceTo(aEmulatedUSB.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP
-Console::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders))
+HRESULT Console::getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders)
 {
-    CheckComArgOutSafeArrayPointerValid(aSharedFolders);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* loadDataFromSavedState() needs a write lock */
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Read console data stored in the saved state file (if not yet done) */
-    HRESULT rc = loadDataFromSavedState();
+    HRESULT rc = i_loadDataFromSavedState();
     if (FAILED(rc)) return rc;
 
-    SafeIfaceArray<ISharedFolder> sf(m_mapSharedFolders);
-    sf.detachTo(ComSafeArrayOutArg(aSharedFolders));
+    size_t i = 0;
+    aSharedFolders.resize(m_mapSharedFolders.size());
+    for (SharedFolderMap::const_iterator it = m_mapSharedFolders.begin(); it != m_mapSharedFolders.end(); ++i, ++it)
+        (it)->second.queryInterfaceTo(aSharedFolders[i].asOutParam());
 
     return S_OK;
 }
 
-
-STDMETHODIMP Console::COMGETTER(EventSource)(IEventSource ** aEventSource)
+HRESULT Console::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        // no need to lock - lifetime constant
-        mEventSource.queryInterfaceTo(aEventSource);
-    }
+    // no need to lock - lifetime constant
+    mEventSource.queryInterfaceTo(aEventSource.asOutParam());
 
-    return hrc;
+    return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(AttachedPCIDevices)(ComSafeArrayOut(IPCIDeviceAttachment *, aAttachments))
+HRESULT Console::getAttachedPCIDevices(std::vector<ComPtr<IPCIDeviceAttachment> > &aAttachedPCIDevices)
 {
-    CheckComArgOutSafeArrayPointerValid(aAttachments);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mBusMgr)
-        mBusMgr->listAttachedPCIDevices(ComSafeArrayOutArg(aAttachments));
+        mBusMgr->listAttachedPCIDevices(aAttachedPCIDevices);
     else
-    {
-        com::SafeIfaceArray<IPCIDeviceAttachment> result((size_t)0);
-        result.detachTo(ComSafeArrayOutArg(aAttachments));
-    }
+        aAttachedPCIDevices.resize(0);
 
     return S_OK;
 }
 
-STDMETHODIMP Console::COMGETTER(UseHostClipboard)(BOOL *aUseHostClipboard)
+HRESULT Console::getUseHostClipboard(BOOL *aUseHostClipboard)
 {
-    CheckComArgOutPointerValid(aUseHostClipboard);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aUseHostClipboard = mfUseHostClipboard;
@@ -2140,13 +2037,8 @@ STDMETHODIMP Console::COMGETTER(UseHostClipboard)(BOOL *aUseHostClipboard)
     return S_OK;
 }
 
-STDMETHODIMP Console::COMSETTER(UseHostClipboard)(BOOL aUseHostClipboard)
+HRESULT Console::setUseHostClipboard(BOOL aUseHostClipboard)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     mfUseHostClipboard = !!aUseHostClipboard;
 
     return S_OK;
@@ -2155,26 +2047,22 @@ STDMETHODIMP Console::COMSETTER(UseHostClipboard)(BOOL aUseHostClipboard)
 // IConsole methods
 /////////////////////////////////////////////////////////////////////////////
 
-
-STDMETHODIMP Console::PowerUp(IProgress **aProgress)
+HRESULT Console::powerUp(ComPtr<IProgress> &aProgress)
 {
-    return powerUp(aProgress, false /* aPaused */);
+    i_powerUp(aProgress.asOutParam(), false /* aPaused */);
+    return S_OK;
 }
 
-STDMETHODIMP Console::PowerUpPaused(IProgress **aProgress)
+HRESULT Console::powerUpPaused(ComPtr<IProgress> &aProgress)
 {
-    return powerUp(aProgress, true /* aPaused */);
+    i_powerUp(aProgress.asOutParam(), true /* aPaused */);
+    return S_OK;
 }
 
-STDMETHODIMP Console::PowerDown(IProgress **aProgress)
+HRESULT Console::powerDown(ComPtr<IProgress> &aProgress)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     LogFlowThisFunc(("mMachineState=%d\n", mMachineState));
@@ -2185,6 +2073,16 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress)
         case MachineState_Stuck:
             break;
 
+        /* Try cancel the save state. */
+        case MachineState_Saving:
+            if (!mptrCancelableProgress.isNull())
+            {
+                HRESULT hrc = mptrCancelableProgress->Cancel();
+                if (SUCCEEDED(hrc))
+                    break;
+            }
+            return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point during a save state"));
+
         /* Try cancel the teleportation. */
         case MachineState_Teleporting:
         case MachineState_TeleportingPausedVM:
@@ -2196,6 +2094,16 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress)
             }
             return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point in a teleportation"));
 
+        /* Try cancel the online snapshot. */
+        case MachineState_OnlineSnapshotting:
+            if (!mptrCancelableProgress.isNull())
+            {
+                HRESULT hrc = mptrCancelableProgress->Cancel();
+                if (SUCCEEDED(hrc))
+                    break;
+            }
+            return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point in an online snapshot"));
+
         /* Try cancel the live snapshot. */
         case MachineState_LiveSnapshotting:
             if (!mptrCancelableProgress.isNull())
@@ -2242,7 +2150,7 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress)
 #ifdef VBOX_WITH_GUEST_PROPS
         alock.release();
 
-        if (isResetTurnedIntoPowerOff())
+        if (i_isResetTurnedIntoPowerOff())
         {
             mMachine->DeleteGuestProperty(Bstr("/VirtualBox/HostInfo/VMPowerOffReason").raw());
             mMachine->SetGuestProperty(Bstr("/VirtualBox/HostInfo/VMPowerOffReason").raw(),
@@ -2265,13 +2173,13 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress)
         fBeganPowerDown = true;
 
         /* sync the state with the server */
-        setMachineStateLocally(MachineState_Stopping);
+        i_setMachineStateLocally(MachineState_Stopping);
 
         /* setup task object and thread to carry out the operation asynchronously */
         std::auto_ptr<VMPowerDownTask> task(new VMPowerDownTask(this, pProgress));
         AssertBreakStmt(task->isOk(), rc = E_FAIL);
 
-        int vrc = RTThreadCreate(NULL, Console::powerDownThread,
+        int vrc = RTThreadCreate(NULL, Console::i_powerDownThread,
                                  (void *) task.get(), 0,
                                  RTTHREADTYPE_MAIN_WORKER, 0,
                                  "VMPwrDwn");
@@ -2285,7 +2193,7 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress)
         task.release();
 
         /* pass the progress to the caller */
-        pProgress.queryInterfaceTo(aProgress);
+        pProgress.queryInterfaceTo(aProgress.asOutParam());
     }
     while (0);
 
@@ -2303,7 +2211,7 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress)
              */
             mControl->EndPoweringDown(eik.getResultCode(), eik.getText().raw());        }
 
-        setMachineStateLocally(lastMachineState);
+        i_setMachineStateLocally(lastMachineState);
     }
 
     LogFlowThisFunc(("rc=%Rhrc\n", rc));
@@ -2312,13 +2220,10 @@ STDMETHODIMP Console::PowerDown(IProgress **aProgress)
     return rc;
 }
 
-STDMETHODIMP Console::Reset()
+HRESULT Console::reset()
 {
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     LogFlowThisFunc(("mMachineState=%d\n", mMachineState));
@@ -2327,7 +2232,7 @@ STDMETHODIMP Console::Reset()
         && mMachineState != MachineState_LiveSnapshotting
         /** @todo r=bird: This should be allowed on paused VMs as well. Later.  */
        )
-        return setInvalidMachineStateError();
+        return i_setInvalidMachineStateError();
 
     /* protect mpUVM */
     SafeVMPtr ptrVM(this);
@@ -2349,7 +2254,7 @@ STDMETHODIMP Console::Reset()
     return rc;
 }
 
-/*static*/ DECLCALLBACK(int) Console::unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu)
+/*static*/ DECLCALLBACK(int) Console::i_unplugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu)
 {
     LogFlowFunc(("pThis=%p pVM=%p idCpu=%u\n", pThis, pUVM, idCpu));
 
@@ -2361,7 +2266,7 @@ STDMETHODIMP Console::Reset()
     return vrc;
 }
 
-HRESULT Console::doCPURemove(ULONG aCpu, PUVM pUVM)
+HRESULT Console::i_doCPURemove(ULONG aCpu, PUVM pUVM)
 {
     HRESULT rc = S_OK;
 
@@ -2381,7 +2286,7 @@ HRESULT Console::doCPURemove(ULONG aCpu, PUVM pUVM)
         && mMachineState != MachineState_Teleporting
         && mMachineState != MachineState_LiveSnapshotting
        )
-        return setInvalidMachineStateError();
+        return i_setInvalidMachineStateError();
 
     /* Check if the CPU is present */
     BOOL fCpuAttached;
@@ -2422,7 +2327,7 @@ HRESULT Console::doCPURemove(ULONG aCpu, PUVM pUVM)
                 RTThreadSleep(100);
             } while (cTries-- > 0);
         }
-        else if (vrc == VERR_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST)
+        else if (vrc == VERR_VMMDEV_CPU_HOTPLUG_NOT_MONITORED_BY_GUEST)
         {
             /* Query one time. It is possible that the user ejected the CPU. */
             vrc = pApicPort ? pApicPort->pfnGetCpuStatus(pApicPort, aCpu, &fLocked) : VERR_INVALID_POINTER;
@@ -2438,9 +2343,9 @@ HRESULT Console::doCPURemove(ULONG aCpu, PUVM pUVM)
          */
         PVMREQ pReq;
         vrc = VMR3ReqCallU(pUVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                           (PFNRT)unplugCpu, 3,
+                           (PFNRT)i_unplugCpu, 3,
                            this, pUVM, (VMCPUID)aCpu);
-    
+
         /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */
         alock.release();
 
@@ -2470,7 +2375,7 @@ HRESULT Console::doCPURemove(ULONG aCpu, PUVM pUVM)
     return rc;
 }
 
-/*static*/ DECLCALLBACK(int) Console::plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu)
+/*static*/ DECLCALLBACK(int) Console::i_plugCpu(Console *pThis, PUVM pUVM, VMCPUID idCpu)
 {
     LogFlowFunc(("pThis=%p uCpu=%u\n", pThis, idCpu));
 
@@ -2507,7 +2412,7 @@ HRESULT Console::doCPURemove(ULONG aCpu, PUVM pUVM)
     return VINF_SUCCESS;
 }
 
-HRESULT Console::doCPUAdd(ULONG aCpu, PUVM pUVM)
+HRESULT Console::i_doCPUAdd(ULONG aCpu, PUVM pUVM)
 {
     HRESULT rc = S_OK;
 
@@ -2524,7 +2429,7 @@ HRESULT Console::doCPUAdd(ULONG aCpu, PUVM pUVM)
         && mMachineState != MachineState_LiveSnapshotting
         /** @todo r=bird: This should be allowed on paused VMs as well. Later.  */
        )
-        return setInvalidMachineStateError();
+        return i_setInvalidMachineStateError();
 
     AssertReturn(m_pVMMDev, E_FAIL);
     PPDMIVMMDEVPORT pDevPort = m_pVMMDev->getVMMDevPort();
@@ -2546,7 +2451,7 @@ HRESULT Console::doCPUAdd(ULONG aCpu, PUVM pUVM)
      */
     PVMREQ pReq;
     int vrc = VMR3ReqCallU(pUVM, 0, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                           (PFNRT)plugCpu, 3,
+                           (PFNRT)i_plugCpu, 3,
                            this, pUVM, aCpu);
 
     /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */
@@ -2578,42 +2483,46 @@ HRESULT Console::doCPUAdd(ULONG aCpu, PUVM pUVM)
     return rc;
 }
 
-STDMETHODIMP Console::Pause()
+HRESULT Console::pause()
 {
     LogFlowThisFuncEnter();
 
-    HRESULT rc = pause(Reason_Unspecified);
+    HRESULT rc = i_pause(Reason_Unspecified);
 
     LogFlowThisFunc(("rc=%Rhrc\n", rc));
     LogFlowThisFuncLeave();
     return rc;
 }
 
-STDMETHODIMP Console::Resume()
+HRESULT Console::resume()
 {
     LogFlowThisFuncEnter();
 
-    HRESULT rc = resume(Reason_Unspecified);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (mMachineState != MachineState_Paused)
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("Cannot resume the machine as it is not paused (machine state: %s)"),
+                        Global::stringifyMachineState(mMachineState));
+
+    HRESULT rc = i_resume(Reason_Unspecified, alock);
 
     LogFlowThisFunc(("rc=%Rhrc\n", rc));
     LogFlowThisFuncLeave();
     return rc;
 }
 
-STDMETHODIMP Console::PowerButton()
+HRESULT Console::powerButton()
 {
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   mMachineState != MachineState_Running
         && mMachineState != MachineState_Teleporting
         && mMachineState != MachineState_LiveSnapshotting
        )
-        return setInvalidMachineStateError();
+        return i_setInvalidMachineStateError();
 
     /* get the VM handle. */
     SafeVMPtr ptrVM(this);
@@ -2645,23 +2554,19 @@ STDMETHODIMP Console::PowerButton()
     return rc;
 }
 
-STDMETHODIMP Console::GetPowerButtonHandled(BOOL *aHandled)
+HRESULT Console::getPowerButtonHandled(BOOL *aHandled)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aHandled);
-
     *aHandled = FALSE;
 
-    AutoCaller autoCaller(this);
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   mMachineState != MachineState_Running
         && mMachineState != MachineState_Teleporting
         && mMachineState != MachineState_LiveSnapshotting
        )
-        return setInvalidMachineStateError();
+        return i_setInvalidMachineStateError();
 
     /* get the VM handle. */
     SafeVMPtr ptrVM(this);
@@ -2698,16 +2603,12 @@ STDMETHODIMP Console::GetPowerButtonHandled(BOOL *aHandled)
     return rc;
 }
 
-STDMETHODIMP Console::GetGuestEnteredACPIMode(BOOL *aEntered)
+HRESULT Console::getGuestEnteredACPIMode(BOOL *aEntered)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aEntered);
-
     *aEntered = FALSE;
 
-    AutoCaller autoCaller(this);
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   mMachineState != MachineState_Running
@@ -2747,19 +2648,16 @@ STDMETHODIMP Console::GetGuestEnteredACPIMode(BOOL *aEntered)
     return S_OK;
 }
 
-STDMETHODIMP Console::SleepButton()
+HRESULT Console::sleepButton()
 {
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   mMachineState != MachineState_Running
         && mMachineState != MachineState_Teleporting
         && mMachineState != MachineState_LiveSnapshotting)
-        return setInvalidMachineStateError();
+        return i_setInvalidMachineStateError();
 
     /* get the VM handle. */
     SafeVMPtr ptrVM(this);
@@ -2791,61 +2689,6 @@ STDMETHODIMP Console::SleepButton()
     return rc;
 }
 
-STDMETHODIMP Console::SaveState(IProgress **aProgress)
-{
-    LogFlowThisFuncEnter();
-
-    HRESULT rc = saveState(Reason_Unspecified, aProgress);
-
-    LogFlowThisFunc(("rc=%Rhrc\n", rc));
-    LogFlowThisFuncLeave();
-    return rc;
-}
-
-STDMETHODIMP Console::AdoptSavedState(IN_BSTR aSavedStateFile)
-{
-    CheckComArgStrNotEmptyOrNull(aSavedStateFile);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (   mMachineState != MachineState_PoweredOff
-        && mMachineState != MachineState_Teleported
-        && mMachineState != MachineState_Aborted
-       )
-        return setError(VBOX_E_INVALID_VM_STATE,
-            tr("Cannot adopt the saved machine state as the machine is not in Powered Off, Teleported or Aborted state (machine state: %s)"),
-            Global::stringifyMachineState(mMachineState));
-
-    return mControl->AdoptSavedState(aSavedStateFile);
-}
-
-STDMETHODIMP Console::DiscardSavedState(BOOL aRemoveFile)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (mMachineState != MachineState_Saved)
-        return setError(VBOX_E_INVALID_VM_STATE,
-            tr("Cannot delete the machine state as the machine is not in the saved state (machine state: %s)"),
-            Global::stringifyMachineState(mMachineState));
-
-    HRESULT rc = mControl->SetRemoveSavedStateFile(aRemoveFile);
-    if (FAILED(rc)) return rc;
-
-    /*
-     * Saved -> PoweredOff transition will be detected in the SessionMachine
-     * and properly handled.
-     */
-    rc = setMachineState(MachineState_PoweredOff);
-
-    return rc;
-}
-
 /** read the value of a LED. */
 inline uint32_t readAndClearLed(PPDMLED pLed)
 {
@@ -2856,83 +2699,87 @@ inline uint32_t readAndClearLed(PPDMLED pLed)
     return u32;
 }
 
-STDMETHODIMP Console::GetDeviceActivity(DeviceType_T aDeviceType,
-                                        DeviceActivity_T *aDeviceActivity)
+HRESULT Console::getDeviceActivity(const std::vector<DeviceType_T> &aType,
+                                   std::vector<DeviceActivity_T> &aActivity)
 {
-    CheckComArgNotNull(aDeviceActivity);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /*
      * Note: we don't lock the console object here because
      * readAndClearLed() should be thread safe.
      */
 
-    /* Get LED array to read */
-    PDMLEDCORE SumLed = {0};
-    switch (aDeviceType)
+    aActivity.resize(aType.size());
+
+    size_t iType;
+    for (iType = 0; iType < aType.size(); ++iType)
     {
-        case DeviceType_Floppy:
-        case DeviceType_DVD:
-        case DeviceType_HardDisk:
+        /* Get LED array to read */
+        PDMLEDCORE SumLed = {0};
+        switch (aType[iType])
         {
-            for (unsigned i = 0; i < RT_ELEMENTS(mapStorageLeds); ++i)
-                if (maStorageDevType[i] == aDeviceType)
-                    SumLed.u32 |= readAndClearLed(mapStorageLeds[i]);
-            break;
-        }
+            case DeviceType_Floppy:
+            case DeviceType_DVD:
+            case DeviceType_HardDisk:
+            {
+                for (unsigned i = 0; i < RT_ELEMENTS(mapStorageLeds); ++i)
+                    if (maStorageDevType[i] == aType[iType])
+                        SumLed.u32 |= readAndClearLed(mapStorageLeds[i]);
+                break;
+            }
 
-        case DeviceType_Network:
-        {
-            for (unsigned i = 0; i < RT_ELEMENTS(mapNetworkLeds); ++i)
-                SumLed.u32 |= readAndClearLed(mapNetworkLeds[i]);
-            break;
-        }
+            case DeviceType_Network:
+            {
+                for (unsigned i = 0; i < RT_ELEMENTS(mapNetworkLeds); ++i)
+                    SumLed.u32 |= readAndClearLed(mapNetworkLeds[i]);
+                break;
+            }
 
-        case DeviceType_USB:
-        {
-            for (unsigned i = 0; i < RT_ELEMENTS(mapUSBLed); ++i)
-                SumLed.u32 |= readAndClearLed(mapUSBLed[i]);
-            break;
+            case DeviceType_USB:
+            {
+                for (unsigned i = 0; i < RT_ELEMENTS(mapUSBLed); ++i)
+                    SumLed.u32 |= readAndClearLed(mapUSBLed[i]);
+                break;
+            }
+
+            case DeviceType_SharedFolder:
+            {
+                SumLed.u32 |= readAndClearLed(mapSharedFolderLed);
+                break;
+            }
+
+            case DeviceType_Graphics3D:
+            {
+                SumLed.u32 |= readAndClearLed(mapCrOglLed);
+                break;
+            }
+
+            default:
+                return setError(E_INVALIDARG,
+                    tr("Invalid device type: %d"),
+                    aType[iType]);
         }
 
-        case DeviceType_SharedFolder:
+        /* Compose the result */
+        switch (SumLed.u32 & (PDMLED_READING | PDMLED_WRITING))
         {
-            SumLed.u32 |= readAndClearLed(mapSharedFolderLed);
-            break;
+            case 0:
+                aActivity[iType] = DeviceActivity_Idle;
+                break;
+            case PDMLED_READING:
+                aActivity[iType] = DeviceActivity_Reading;
+                break;
+            case PDMLED_WRITING:
+            case PDMLED_READING | PDMLED_WRITING:
+                aActivity[iType] = DeviceActivity_Writing;
+                break;
         }
-
-        default:
-            return setError(E_INVALIDARG,
-                tr("Invalid device type: %d"),
-                aDeviceType);
-    }
-
-    /* Compose the result */
-    switch (SumLed.u32 & (PDMLED_READING | PDMLED_WRITING))
-    {
-        case 0:
-            *aDeviceActivity = DeviceActivity_Idle;
-            break;
-        case PDMLED_READING:
-            *aDeviceActivity = DeviceActivity_Reading;
-            break;
-        case PDMLED_WRITING:
-        case PDMLED_READING | PDMLED_WRITING:
-            *aDeviceActivity = DeviceActivity_Writing;
-            break;
     }
 
     return S_OK;
 }
 
-STDMETHODIMP Console::AttachUSBDevice(IN_BSTR aId)
+HRESULT Console::attachUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename)
 {
 #ifdef VBOX_WITH_USB
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   mMachineState != MachineState_Running
@@ -2956,7 +2803,7 @@ STDMETHODIMP Console::AttachUSBDevice(IN_BSTR aId)
     alock.release();
 
     /* Request the device capture */
-    return mControl->CaptureUSBDevice(aId);
+    return mControl->CaptureUSBDevice(Bstr(aId.toString()).raw(), Bstr(aCaptureFilename).raw());
 
 #else   /* !VBOX_WITH_USB */
     return setError(VBOX_E_PDM_ERROR,
@@ -2964,23 +2811,18 @@ STDMETHODIMP Console::AttachUSBDevice(IN_BSTR aId)
 #endif  /* !VBOX_WITH_USB */
 }
 
-STDMETHODIMP Console::DetachUSBDevice(IN_BSTR aId, IUSBDevice **aDevice)
+HRESULT Console::detachUSBDevice(const com::Guid &aId, ComPtr<IUSBDevice> &aDevice)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgOutPointerValid(aDevice);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Find it. */
     ComObjPtr<OUSBDevice> pUSBDevice;
     USBDeviceList::iterator it = mUSBDevices.begin();
-    Guid uuid(aId);
     while (it != mUSBDevices.end())
     {
-        if ((*it)->id() == uuid)
+        if ((*it)->i_id() == aId)
         {
             pUSBDevice = *it;
             break;
@@ -2991,7 +2833,7 @@ STDMETHODIMP Console::DetachUSBDevice(IN_BSTR aId, IUSBDevice **aDevice)
     if (!pUSBDevice)
         return setError(E_INVALIDARG,
             tr("USB device with UUID {%RTuuid} is not attached to this machine"),
-            Guid(aId).raw());
+            aId.raw());
 
     /* Remove the device from the collection, it is re-added below for failures */
     mUSBDevices.erase(it);
@@ -3000,7 +2842,7 @@ STDMETHODIMP Console::DetachUSBDevice(IN_BSTR aId, IUSBDevice **aDevice)
      * Inform the USB device and USB proxy about what's cooking.
      */
     alock.release();
-    HRESULT rc = mControl->DetachUSBDevice(aId, false /* aDone */);
+    HRESULT rc = mControl->DetachUSBDevice(Bstr(aId.toString()).raw(), false /* aDone */);
     if (FAILED(rc))
     {
         /* Re-add the device to the collection */
@@ -3010,12 +2852,12 @@ STDMETHODIMP Console::DetachUSBDevice(IN_BSTR aId, IUSBDevice **aDevice)
     }
 
     /* Request the PDM to detach the USB device. */
-    rc = detachUSBDevice(pUSBDevice);
+    rc = i_detachUSBDevice(pUSBDevice);
     if (SUCCEEDED(rc))
     {
         /* Request the device release. Even if it fails, the device will
          * remain as held by proxy, which is OK for us (the VM process). */
-        rc = mControl->DetachUSBDevice(aId, true /* aDone */);
+        rc = mControl->DetachUSBDevice(Bstr(aId.toString()).raw(), true /* aDone */);
     }
     else
     {
@@ -3033,13 +2875,12 @@ STDMETHODIMP Console::DetachUSBDevice(IN_BSTR aId, IUSBDevice **aDevice)
 #endif  /* !VBOX_WITH_USB */
 }
 
-STDMETHODIMP Console::FindUSBDeviceByAddress(IN_BSTR aAddress, IUSBDevice **aDevice)
+
+HRESULT Console::findUSBDeviceByAddress(const com::Utf8Str &aName, ComPtr<IUSBDevice> &aDevice)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgStrNotEmptyOrNull(aAddress);
-    CheckComArgOutPointerValid(aDevice);
 
-    *aDevice = NULL;
+    aDevice = NULL;
 
     SafeIfaceArray<IUSBDevice> devsvec;
     HRESULT rc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));
@@ -3050,31 +2891,29 @@ STDMETHODIMP Console::FindUSBDeviceByAddress(IN_BSTR aAddress, IUSBDevice **aDev
         Bstr address;
         rc = devsvec[i]->COMGETTER(Address)(address.asOutParam());
         if (FAILED(rc)) return rc;
-        if (address == aAddress)
+        if (address == Bstr(aName))
         {
             ComObjPtr<OUSBDevice> pUSBDevice;
             pUSBDevice.createObject();
             pUSBDevice->init(devsvec[i]);
-            return pUSBDevice.queryInterfaceTo(aDevice);
+            return pUSBDevice.queryInterfaceTo(aDevice.asOutParam());
         }
     }
 
     return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND,
-        tr("Could not find a USB device with address '%ls'"),
-        aAddress);
+        tr("Could not find a USB device with address '%s'"),
+        aName.c_str());
 
 #else   /* !VBOX_WITH_USB */
     return E_NOTIMPL;
 #endif  /* !VBOX_WITH_USB */
 }
 
-STDMETHODIMP Console::FindUSBDeviceById(IN_BSTR aId, IUSBDevice **aDevice)
+HRESULT Console::findUSBDeviceById(const com::Guid &aId, ComPtr<IUSBDevice> &aDevice)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgExpr(aId, Guid(aId).isValid());
-    CheckComArgOutPointerValid(aDevice);
 
-    *aDevice = NULL;
+    aDevice = NULL;
 
     SafeIfaceArray<IUSBDevice> devsvec;
     HRESULT rc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));
@@ -3085,12 +2924,13 @@ STDMETHODIMP Console::FindUSBDeviceById(IN_BSTR aId, IUSBDevice **aDevice)
         Bstr id;
         rc = devsvec[i]->COMGETTER(Id)(id.asOutParam());
         if (FAILED(rc)) return rc;
-        if (id == aId)
+        if (Utf8Str(id) == aId.toString())
         {
             ComObjPtr<OUSBDevice> pUSBDevice;
             pUSBDevice.createObject();
             pUSBDevice->init(devsvec[i]);
-            return pUSBDevice.queryInterfaceTo(aDevice);
+            ComObjPtr<IUSBDevice> iUSBDevice = static_cast <ComObjPtr<IUSBDevice> > (pUSBDevice);
+            return iUSBDevice.queryInterfaceTo(aDevice.asOutParam());
         }
     }
 
@@ -3103,19 +2943,9 @@ STDMETHODIMP Console::FindUSBDeviceById(IN_BSTR aId, IUSBDevice **aDevice)
 #endif  /* !VBOX_WITH_USB */
 }
 
-STDMETHODIMP
-Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount)
+HRESULT Console::createSharedFolder(const com::Utf8Str &aName, const com::Utf8Str &aHostPath, BOOL aWritable, BOOL aAutomount)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgStrNotEmptyOrNull(aHostPath);
-
-    LogFlowThisFunc(("Entering for '%ls' -> '%ls'\n", aName, aHostPath));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    Utf8Str strName(aName);
-    Utf8Str strHostPath(aHostPath);
+    LogFlowThisFunc(("Entering for '%s' -> '%s'\n", aName.c_str(), aHostPath.c_str()));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -3134,18 +2964,18 @@ Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BO
             Global::stringifyMachineState(mMachineState));
 
     ComObjPtr<SharedFolder> pSharedFolder;
-    HRESULT rc = findSharedFolder(strName, pSharedFolder, false /* aSetError */);
+    HRESULT rc = i_findSharedFolder(aName, pSharedFolder, false /* aSetError */);
     if (SUCCEEDED(rc))
         return setError(VBOX_E_FILE_ERROR,
                         tr("Shared folder named '%s' already exists"),
-                        strName.c_str());
+                        aName.c_str());
 
     pSharedFolder.createObject();
     rc = pSharedFolder->init(this,
-                             strName,
-                             strHostPath,
+                             aName,
+                             aHostPath,
                              !!aWritable,
-                             !!aAutoMount,
+                             !!aAutomount,
                              true /* fFailOnError */);
     if (FAILED(rc)) return rc;
 
@@ -3159,15 +2989,15 @@ Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BO
     {
         /* first, remove the machine or the global folder if there is any */
         SharedFolderDataMap::const_iterator it;
-        if (findOtherSharedFolder(aName, it))
+        if (i_findOtherSharedFolder(aName, it))
         {
-            rc = removeSharedFolder(aName);
+            rc = i_removeSharedFolder(aName);
             if (FAILED(rc))
                 return rc;
         }
 
         /* second, create the given folder */
-        rc = createSharedFolder(aName, SharedFolderData(aHostPath, !!aWritable, !!aAutoMount));
+        rc = i_createSharedFolder(aName, SharedFolderData(aHostPath, !!aWritable, !!aAutomount));
         if (FAILED(rc))
             return rc;
     }
@@ -3178,21 +3008,14 @@ Console::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BO
     alock.release();
     fireSharedFolderChangedEvent(mEventSource, Scope_Session);
 
-    LogFlowThisFunc(("Leaving for '%ls' -> '%ls'\n", aName, aHostPath));
+    LogFlowThisFunc(("Leaving for '%s' -> '%s'\n", aName.c_str(), aHostPath.c_str()));
 
     return rc;
 }
 
-STDMETHODIMP Console::RemoveSharedFolder(IN_BSTR aName)
+HRESULT Console::removeSharedFolder(const com::Utf8Str &aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    LogFlowThisFunc(("Entering for '%ls'\n", aName));
-
-    Utf8Str strName(aName);
+    LogFlowThisFunc(("Entering for '%s'\n", aName.c_str()));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -3211,7 +3034,7 @@ STDMETHODIMP Console::RemoveSharedFolder(IN_BSTR aName)
             Global::stringifyMachineState(mMachineState));
 
     ComObjPtr<SharedFolder> pSharedFolder;
-    HRESULT rc = findSharedFolder(aName, pSharedFolder, true /* aSetError */);
+    HRESULT rc = i_findSharedFolder(aName, pSharedFolder, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
     /* protect the VM handle (if not NULL) */
@@ -3225,249 +3048,176 @@ STDMETHODIMP Console::RemoveSharedFolder(IN_BSTR aName)
          * folder. */
 
         /* first, remove the given folder */
-        rc = removeSharedFolder(strName);
+        rc = i_removeSharedFolder(aName);
         if (FAILED(rc)) return rc;
 
         /* first, remove the machine or the global folder if there is any */
         SharedFolderDataMap::const_iterator it;
-        if (findOtherSharedFolder(strName, it))
+        if (i_findOtherSharedFolder(aName, it))
         {
-            rc = createSharedFolder(strName, it->second);
+            rc = i_createSharedFolder(aName, it->second);
             /* don't check rc here because we need to remove the console
              * folder from the collection even on failure */
         }
     }
 
-    m_mapSharedFolders.erase(strName);
+    m_mapSharedFolders.erase(aName);
 
     /* Notify console callbacks after the folder is removed from the list. */
     alock.release();
     fireSharedFolderChangedEvent(mEventSource, Scope_Session);
 
-    LogFlowThisFunc(("Leaving for '%ls'\n", aName));
+    LogFlowThisFunc(("Leaving for '%s'\n", aName.c_str()));
 
     return rc;
 }
 
-STDMETHODIMP Console::TakeSnapshot(IN_BSTR aName,
-                                   IN_BSTR aDescription,
-                                   IProgress **aProgress)
+HRESULT Console::addDiskEncryptionPassword(const com::Utf8Str &aId, const com::Utf8Str &aPassword,
+                                           BOOL aClearOnSuspend)
 {
-    LogFlowThisFuncEnter();
-
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (   aId.isEmpty()
+        || aPassword.isEmpty())
+        return setError(E_FAIL, tr("The ID and password must be both valid"));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aName='%ls' mMachineState=%d\n", aName, mMachineState));
-
-    if (Global::IsTransient(mMachineState))
-        return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Cannot take a snapshot of the machine while it is changing the state (machine state: %s)"),
-                        Global::stringifyMachineState(mMachineState));
-
-    HRESULT rc = S_OK;
 
-    /* prepare the progress object:
-       a) count the no. of hard disk attachments to get a matching no. of progress sub-operations */
-    ULONG cOperations = 2;              // always at least setting up + finishing up
-    ULONG ulTotalOperationsWeight = 2;  // one each for setting up + finishing up
-    SafeIfaceArray<IMediumAttachment> aMediumAttachments;
-    rc = mMachine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(aMediumAttachments));
-    if (FAILED(rc))
-        return setError(rc, tr("Cannot get medium attachments of the machine"));
-
-    ULONG ulMemSize;
-    rc = mMachine->COMGETTER(MemorySize)(&ulMemSize);
-    if (FAILED(rc))
-        return rc;
+    HRESULT hrc = S_OK;
+    size_t cbKey = aPassword.length() + 1; /* Include terminator */
+    const uint8_t *pbKey = (const uint8_t *)aPassword.c_str();
 
-    for (size_t i = 0;
-         i < aMediumAttachments.size();
-         ++i)
+    int rc = m_pKeyStore->addSecretKey(aId, pbKey, cbKey);
+    if (RT_SUCCESS(rc))
     {
-        DeviceType_T type;
-        rc = aMediumAttachments[i]->COMGETTER(Type)(&type);
-        if (FAILED(rc))
-            return rc;
+        unsigned cDisksConfigured = 0;
 
-        if (type == DeviceType_HardDisk)
+        hrc = i_configureEncryptionForDisk(aId, &cDisksConfigured);
+        if (SUCCEEDED(hrc))
         {
-            ++cOperations;
-
-            // assume that creating a diff image takes as long as saving a 1MB state
-            // (note, the same value must be used in SessionMachine::BeginTakingSnapshot() on the server!)
-            ulTotalOperationsWeight += 1;
-        }
-    }
-
-    // b) one extra sub-operations for online snapshots OR offline snapshots that have a saved state (needs to be copied)
-    bool const fTakingSnapshotOnline = Global::IsOnline(mMachineState);
-
-    LogFlowFunc(("fTakingSnapshotOnline = %d, mMachineState = %d\n", fTakingSnapshotOnline, mMachineState));
-
-    if (fTakingSnapshotOnline)
-    {
-        ++cOperations;
-        ulTotalOperationsWeight += ulMemSize;
-    }
-
-    // finally, create the progress object
-    ComObjPtr<Progress> pProgress;
-    pProgress.createObject();
-    rc = pProgress->init(static_cast<IConsole *>(this),
-                         Bstr(tr("Taking a snapshot of the virtual machine")).raw(),
-                            (mMachineState >= MachineState_FirstOnline)
-                         && (mMachineState <= MachineState_LastOnline) /* aCancelable */,
-                         cOperations,
-                         ulTotalOperationsWeight,
-                         Bstr(tr("Setting up snapshot operation")).raw(),      // first sub-op description
-                         1);        // ulFirstOperationWeight
-
-    if (FAILED(rc))
-        return rc;
-
-    VMTakeSnapshotTask *pTask;
-    if (!(pTask = new VMTakeSnapshotTask(this, pProgress, aName, aDescription)))
-        return E_OUTOFMEMORY;
-
-    Assert(pTask->mProgress);
-
-    try
-    {
-        mptrCancelableProgress = pProgress;
-
-        /*
-         * If we fail here it means a PowerDown() call happened on another
-         * thread while we were doing Pause() (which releases the Console lock).
-         * We assign PowerDown() a higher precedence than TakeSnapshot(),
-         * therefore just return the error to the caller.
-         */
-        rc = pTask->rc();
-        if (FAILED(rc)) throw rc;
+            SecretKey *pKey = NULL;
+            rc = m_pKeyStore->retainSecretKey(aId, &pKey);
+            AssertRCReturn(rc, E_FAIL);
 
-        pTask->ulMemSize = ulMemSize;
+            pKey->setUsers(cDisksConfigured);
+            pKey->setRemoveOnSuspend(!!aClearOnSuspend);
+            m_pKeyStore->releaseSecretKey(aId);
+            m_cDisksPwProvided += cDisksConfigured;
 
-        /* memorize the current machine state */
-        pTask->lastMachineState = mMachineState;
-        pTask->fTakingSnapshotOnline = fTakingSnapshotOnline;
+            if (   m_cDisksPwProvided == m_cDisksEncrypted
+                && mMachineState == MachineState_Paused)
+            {
+                /* get the VM handle. */
+                SafeVMPtr ptrVM(this);
+                if (!ptrVM.isOk())
+                    return ptrVM.rc();
 
-        int vrc = RTThreadCreate(NULL,
-                                 Console::fntTakeSnapshotWorker,
-                                 (void *)pTask,
-                                 0,
-                                 RTTHREADTYPE_MAIN_WORKER,
-                                 0,
-                                 "TakeSnap");
-        if (FAILED(vrc))
-            throw setError(E_FAIL,
-                           tr("Could not create VMTakeSnap thread (%Rrc)"),
-                           vrc);
+                alock.release();
+                int vrc = VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_RECONFIG);
 
-        pTask->mProgress.queryInterfaceTo(aProgress);
-    }
-    catch (HRESULT erc)
-    {
-        delete pTask;
-        rc = erc;
-        mptrCancelableProgress.setNull();
+                hrc = RT_SUCCESS(vrc) ? S_OK :
+                    setError(VBOX_E_VM_ERROR,
+                             tr("Could not resume the machine execution (%Rrc)"),
+                             vrc);
+            }
+        }
     }
+    else if (rc == VERR_ALREADY_EXISTS)
+        hrc = setError(VBOX_E_OBJECT_IN_USE, tr("A password with the given ID already exists"));
+    else if (rc == VERR_NO_MEMORY)
+        hrc = setError(E_FAIL, tr("Failed to allocate enough secure memory for the key"));
+    else
+        hrc = setError(E_FAIL, tr("Unknown error happened while adding a password (%Rrc)"), rc);
 
-    LogFlowThisFunc(("rc=%Rhrc\n", rc));
-    LogFlowThisFuncLeave();
-    return rc;
+    return hrc;
 }
 
-STDMETHODIMP Console::DeleteSnapshot(IN_BSTR aId, IProgress **aProgress)
+HRESULT Console::addDiskEncryptionPasswords(const std::vector<com::Utf8Str> &aIds, const std::vector<com::Utf8Str> &aPasswords,
+                                            BOOL aClearOnSuspend)
 {
-    CheckComArgExpr(aId, Guid(aId).isValid());
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (Global::IsTransient(mMachineState))
-        return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Cannot delete a snapshot of the machine while it is changing the state (machine state: %s)"),
-                        Global::stringifyMachineState(mMachineState));
-
-    MachineState_T machineState = MachineState_Null;
-    HRESULT rc = mControl->DeleteSnapshot(this, aId, aId, FALSE /* fDeleteAllChildren */, &machineState, aProgress);
-    if (FAILED(rc)) return rc;
-
-    setMachineStateLocally(machineState);
-    return S_OK;
-}
+    HRESULT hrc = S_OK;
 
-STDMETHODIMP Console::DeleteSnapshotAndAllChildren(IN_BSTR aId, IProgress **aProgress)
-{
-    CheckComArgExpr(aId, Guid(aId).isValid());
-    CheckComArgOutPointerValid(aProgress);
+    if (   !aIds.size()
+        || !aPasswords.size())
+        return setError(E_FAIL, tr("IDs and passwords must not be empty"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (aIds.size() != aPasswords.size())
+        return setError(E_FAIL, tr("The number of entries in the id and password arguments must match"));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (Global::IsTransient(mMachineState))
-        return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Cannot delete a snapshot of the machine while it is changing the state (machine state: %s)"),
-                        Global::stringifyMachineState(mMachineState));
+    /* Check that the IDs do not exist already before changing anything. */
+    for (unsigned i = 0; i < aIds.size(); i++)
+    {
+        SecretKey *pKey = NULL;
+        int rc = m_pKeyStore->retainSecretKey(aIds[i], &pKey);
+        if (rc != VERR_NOT_FOUND)
+        {
+            AssertPtr(pKey);
+            if (pKey)
+                pKey->release();
+            return setError(VBOX_E_OBJECT_IN_USE, tr("A password with the given ID already exists"));
+        }
+    }
 
-    MachineState_T machineState = MachineState_Null;
-    HRESULT rc = mControl->DeleteSnapshot(this, aId, aId, TRUE /* fDeleteAllChildren */, &machineState, aProgress);
-    if (FAILED(rc)) return rc;
+    for (unsigned i = 0; i < aIds.size(); i++)
+    {
+        hrc = addDiskEncryptionPassword(aIds[i], aPasswords[i], aClearOnSuspend);
+        if (FAILED(hrc))
+        {
+            /*
+             * Try to remove already successfully added passwords from the map to not
+             * change the state of the Console object.
+             */
+            ErrorInfoKeeper eik; /* Keep current error info or it gets deestroyed in the IPC methods below. */
+            for (unsigned ii = 0; ii < i; ii++)
+            {
+                i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(aIds[ii]);
+                removeDiskEncryptionPassword(aIds[ii]);
+            }
 
-    setMachineStateLocally(machineState);
-    return S_OK;
+            break;
+        }
+    }
+
+    return hrc;
 }
 
-STDMETHODIMP Console::DeleteSnapshotRange(IN_BSTR aStartId, IN_BSTR aEndId, IProgress **aProgress)
+HRESULT Console::removeDiskEncryptionPassword(const com::Utf8Str &aId)
 {
-    CheckComArgExpr(aStartId, Guid(aStartId).isValid());
-    CheckComArgExpr(aEndId, Guid(aEndId).isValid());
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (aId.isEmpty())
+        return setError(E_FAIL, tr("The ID must be valid"));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (Global::IsTransient(mMachineState))
-        return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Cannot delete a snapshot of the machine while it is changing the state (machine state: %s)"),
-                        Global::stringifyMachineState(mMachineState));
-
-    MachineState_T machineState = MachineState_Null;
-    HRESULT rc = mControl->DeleteSnapshot(this, aStartId, aEndId, FALSE /* fDeleteAllChildren */, &machineState, aProgress);
-    if (FAILED(rc)) return rc;
+    SecretKey *pKey = NULL;
+    int rc = m_pKeyStore->retainSecretKey(aId, &pKey);
+    if (RT_SUCCESS(rc))
+    {
+        m_cDisksPwProvided -= pKey->getUsers();
+        m_pKeyStore->releaseSecretKey(aId);
+        rc = m_pKeyStore->deleteSecretKey(aId);
+        AssertRCReturn(rc, E_FAIL);
+    }
+    else if (rc == VERR_NOT_FOUND)
+        return setError(VBOX_E_OBJECT_NOT_FOUND, tr("A password with the ID \"%s\" does not exist"),
+                                                 aId.c_str());
+    else
+        return setError(E_FAIL, tr("Failed to remove password with ID \"%s\" (%Rrc)"),
+                                aId.c_str(), rc);
 
-    setMachineStateLocally(machineState);
     return S_OK;
 }
 
-STDMETHODIMP Console::RestoreSnapshot(ISnapshot *aSnapshot, IProgress **aProgress)
+HRESULT Console::clearAllDiskEncryptionPasswords()
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (Global::IsOnlineOrTransient(mMachineState))
-        return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Cannot delete the current state of the running machine (machine state: %s)"),
-                        Global::stringifyMachineState(mMachineState));
-
-    MachineState_T machineState = MachineState_Null;
-    HRESULT rc = mControl->RestoreSnapshot(this, aSnapshot, &machineState, aProgress);
-    if (FAILED(rc)) return rc;
+    int rc = m_pKeyStore->deleteAllSecretKeys(false /* fSuspend */, false /* fForce */);
+    if (rc == VERR_RESOURCE_IN_USE)
+        return setError(VBOX_E_OBJECT_IN_USE, tr("A password is still in use by the VM"));
+    else if (RT_FAILURE(rc))
+        return setError(E_FAIL, tr("Deleting all passwords failed (%Rrc)"));
 
-    setMachineStateLocally(machineState);
+    m_cDisksPwProvided = 0;
     return S_OK;
 }
 
@@ -3475,7 +3225,7 @@ STDMETHODIMP Console::RestoreSnapshot(ISnapshot *aSnapshot, IProgress **aProgres
 /////////////////////////////////////////////////////////////////////////////
 
 /*static*/
-HRESULT Console::setErrorStatic(HRESULT aResultCode, const char *pcsz, ...)
+HRESULT Console::i_setErrorStatic(HRESULT aResultCode, const char *pcsz, ...)
 {
     va_list args;
     va_start(args, pcsz);
@@ -3489,7 +3239,7 @@ HRESULT Console::setErrorStatic(HRESULT aResultCode, const char *pcsz, ...)
     return rc;
 }
 
-HRESULT Console::setInvalidMachineStateError()
+HRESULT Console::i_setInvalidMachineStateError()
 {
     return setError(VBOX_E_INVALID_VM_STATE,
                     tr("Invalid machine state: %s"),
@@ -3498,7 +3248,7 @@ HRESULT Console::setInvalidMachineStateError()
 
 
 /* static */
-const char *Console::convertControllerTypeToDev(StorageControllerType_T enmCtrlType)
+const char *Console::i_convertControllerTypeToDev(StorageControllerType_T enmCtrlType)
 {
     switch (enmCtrlType)
     {
@@ -3516,12 +3266,14 @@ const char *Console::convertControllerTypeToDev(StorageControllerType_T enmCtrlT
             return "piix3ide";
         case StorageControllerType_I82078:
             return "i82078";
+        case StorageControllerType_USB:
+            return "Msd";
         default:
             return NULL;
     }
 }
 
-HRESULT Console::convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun)
+HRESULT Console::i_convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun)
 {
     switch (enmBus)
     {
@@ -3540,6 +3292,15 @@ HRESULT Console::convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG
             uLun = port;
             return S_OK;
         }
+        case StorageBus_USB:
+        {
+             /*
+              * It is always the first lun, the port denotes the device instance
+              * for the Msd device.
+              */
+            uLun = 0;
+            return S_OK;
+        }
         default:
             uLun = 0;
             AssertMsgFailedReturn(("%d\n", enmBus), E_INVALIDARG);
@@ -3548,7 +3309,7 @@ HRESULT Console::convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG
 
 // private methods
 /////////////////////////////////////////////////////////////////////////////
-    
+
 /**
  * Suspend the VM before we do any medium or network attachment change.
  *
@@ -3558,7 +3319,7 @@ HRESULT Console::convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG
  * @param pfSuspend         where to store the information if we need to resume
  *                          afterwards.
  */
-HRESULT Console::suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume)
+HRESULT Console::i_suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume)
 {
     *pfResume = false;
     VMSTATE enmVMState = VMR3GetStateU(pUVM);
@@ -3580,7 +3341,7 @@ HRESULT Console::suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, boo
                 return setErrorInternal(VBOX_E_INVALID_VM_STATE,
                                         COM_IIDOF(IConsole),
                                         getStaticComponentName(),
-                                        Utf8StrFmt("Couldn't suspend VM for medium change (%Rrc)", rc),
+                                        Utf8StrFmt("Could suspend VM for medium change (%Rrc)", rc),
                                         false /*aWarning*/,
                                         true /*aLogIt*/);
             *pfResume = true;
@@ -3592,8 +3353,8 @@ HRESULT Console::suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, boo
             return setErrorInternal(VBOX_E_INVALID_VM_STATE,
                                     COM_IIDOF(IConsole),
                                     getStaticComponentName(),
-                                    Utf8StrFmt("Invalid VM state '%s' for changing medium",
-                                        VMR3GetStateName(enmVMState)),
+                                    Utf8StrFmt("Invalid state '%s' for changing medium",
+                                               VMR3GetStateName(enmVMState)),
                                     false /*aWarning*/,
                                     true /*aLogIt*/);
     }
@@ -3607,7 +3368,7 @@ HRESULT Console::suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, boo
  *
  * @param pUVM              Safe VM handle.
  */
-void Console::resumeAfterConfigChange(PUVM pUVM)
+void Console::i_resumeAfterConfigChange(PUVM pUVM)
 {
     LogFlowFunc(("Resuming the VM...\n"));
     /* disable the callback to prevent Console-level state change */
@@ -3621,7 +3382,7 @@ void Console::resumeAfterConfigChange(PUVM pUVM)
         if (enmVMState == VMSTATE_SUSPENDED)
         {
             /* too bad, we failed. try to sync the console state with the VMM state */
-            vmstateChangeCallback(pUVM, VMSTATE_SUSPENDED, enmVMState, this);
+            i_vmstateChangeCallback(pUVM, VMSTATE_SUSPENDED, enmVMState, this);
         }
     }
 }
@@ -3635,7 +3396,7 @@ void Console::resumeAfterConfigChange(PUVM pUVM)
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM)
+HRESULT Console::i_doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce, PUVM pUVM)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -3681,7 +3442,7 @@ HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForc
     StorageControllerType_T enmCtrlType;
     rc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
     AssertComRC(rc);
-    pszDevice = convertControllerTypeToDev(enmCtrlType);
+    pszDevice = i_convertControllerTypeToDev(enmCtrlType);
 
     StorageBus_T enmBus;
     rc = pStorageController->COMGETTER(Bus)(&enmBus);
@@ -3698,7 +3459,7 @@ HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForc
      * pending I/O to the drive which is being changed.
      */
     bool fResume = false;
-    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
+    rc = i_suspendBeforeConfigChange(pUVM, &alock, &fResume);
     if (FAILED(rc))
         return rc;
 
@@ -3709,7 +3470,7 @@ HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForc
      */
     PVMREQ pReq;
     int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                           (PFNRT)changeRemovableMedium, 8,
+                           (PFNRT)i_changeRemovableMedium, 8,
                            this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fForce);
 
     /* release the lock before waiting for a result (EMT might wait for it, @bugref{7648})! */
@@ -3723,7 +3484,7 @@ HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForc
     VMR3ReqFree(pReq);
 
     if (fResume)
-        resumeAfterConfigChange(pUVM);
+        i_resumeAfterConfigChange(pUVM);
 
     if (RT_SUCCESS(vrc))
     {
@@ -3762,14 +3523,14 @@ HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForc
  * @thread  EMT
  * @note The VM must not be running since it might have pending I/O to the drive which is being changed.
  */
-DECLCALLBACK(int) Console::changeRemovableMedium(Console *pThis,
-                                                 PUVM pUVM,
-                                                 const char *pcszDevice,
-                                                 unsigned uInstance,
-                                                 StorageBus_T enmBus,
-                                                 bool fUseHostIOCache,
-                                                 IMediumAttachment *aMediumAtt,
-                                                 bool fForce)
+DECLCALLBACK(int) Console::i_changeRemovableMedium(Console *pThis,
+                                                   PUVM pUVM,
+                                                   const char *pcszDevice,
+                                                   unsigned uInstance,
+                                                   StorageBus_T enmBus,
+                                                   bool fUseHostIOCache,
+                                                   IMediumAttachment *aMediumAtt,
+                                                   bool fForce)
 {
     LogFlowFunc(("pThis=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, aMediumAtt=%p, fForce=%d\n",
                  pThis, uInstance, pcszDevice, pcszDevice, enmBus, aMediumAtt, fForce));
@@ -3785,33 +3546,23 @@ DECLCALLBACK(int) Console::changeRemovableMedium(Console *pThis,
     VMSTATE enmVMState = VMR3GetStateU(pUVM);
     AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE);
 
-    /* Determine the base path for the device instance. */
-    PCFGMNODE pCtlInst;
-    pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance);
-    AssertReturn(pCtlInst, VERR_INTERNAL_ERROR);
-
-    PCFGMNODE pLunL0 = NULL;
-    int rc = pThis->configMediumAttachment(pCtlInst,
-                                           pcszDevice,
-                                           uInstance,
-                                           enmBus,
-                                           fUseHostIOCache,
-                                           false /* fSetupMerge */,
-                                           false /* fBuiltinIOCache */,
-                                           0 /* uMergeSource */,
-                                           0 /* uMergeTarget */,
-                                           aMediumAtt,
-                                           pThis->mMachineState,
-                                           NULL /* phrc */,
-                                           true /* fAttachDetach */,
-                                           fForce /* fForceUnmount */,
-                                           false  /* fHotplug */,
-                                           pUVM,
-                                           NULL /* paLedDevType */,
-                                           &pLunL0);
-    /* Dump the changed LUN if possible, dump the complete device otherwise */
-    CFGMR3Dump(pLunL0 ? pLunL0 : pCtlInst);
-
+    int rc = pThis->i_configMediumAttachment(pcszDevice,
+                                             uInstance,
+                                             enmBus,
+                                             fUseHostIOCache,
+                                             false /* fSetupMerge */,
+                                             false /* fBuiltinIOCache */,
+                                             0 /* uMergeSource */,
+                                             0 /* uMergeTarget */,
+                                             aMediumAtt,
+                                             pThis->mMachineState,
+                                             NULL /* phrc */,
+                                             true /* fAttachDetach */,
+                                             fForce /* fForceUnmount */,
+                                             false  /* fHotplug */,
+                                             pUVM,
+                                             NULL /* paLedDevType */,
+                                             NULL /* ppLunL0 */);
     LogFlowFunc(("Returning %Rrc\n", rc));
     return rc;
 }
@@ -3826,7 +3577,7 @@ DECLCALLBACK(int) Console::changeRemovableMedium(Console *pThis,
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)
+HRESULT Console::i_doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -3872,7 +3623,7 @@ HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUV
     StorageControllerType_T enmCtrlType;
     rc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
     AssertComRC(rc);
-    pszDevice = convertControllerTypeToDev(enmCtrlType);
+    pszDevice = i_convertControllerTypeToDev(enmCtrlType);
 
     StorageBus_T enmBus;
     rc = pStorageController->COMGETTER(Bus)(&enmBus);
@@ -3889,7 +3640,7 @@ HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUV
      * pending I/O to the drive which is being changed.
      */
     bool fResume = false;
-    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
+    rc = i_suspendBeforeConfigChange(pUVM, &alock, &fResume);
     if (FAILED(rc))
         return rc;
 
@@ -3900,7 +3651,7 @@ HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUV
      */
     PVMREQ pReq;
     int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                           (PFNRT)attachStorageDevice, 8,
+                           (PFNRT)i_attachStorageDevice, 8,
                            this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fSilent);
 
     /* release the lock before waiting for a result (EMT might wait for it, @bugref{7648})! */
@@ -3914,7 +3665,7 @@ HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUV
     VMR3ReqFree(pReq);
 
     if (fResume)
-        resumeAfterConfigChange(pUVM);
+        i_resumeAfterConfigChange(pUVM);
 
     if (RT_SUCCESS(vrc))
     {
@@ -3947,14 +3698,14 @@ HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUV
  * @thread  EMT
  * @note The VM must not be running since it might have pending I/O to the drive which is being changed.
  */
-DECLCALLBACK(int) Console::attachStorageDevice(Console *pThis,
-                                               PUVM pUVM,
-                                               const char *pcszDevice,
-                                               unsigned uInstance,
-                                               StorageBus_T enmBus,
-                                               bool fUseHostIOCache,
-                                               IMediumAttachment *aMediumAtt,
-                                               bool fSilent)
+DECLCALLBACK(int) Console::i_attachStorageDevice(Console *pThis,
+                                                 PUVM pUVM,
+                                                 const char *pcszDevice,
+                                                 unsigned uInstance,
+                                                 StorageBus_T enmBus,
+                                                 bool fUseHostIOCache,
+                                                 IMediumAttachment *aMediumAtt,
+                                                 bool fSilent)
 {
     LogFlowFunc(("pThis=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, aMediumAtt=%p\n",
                  pThis, uInstance, pcszDevice, pcszDevice, enmBus, aMediumAtt));
@@ -3970,33 +3721,23 @@ DECLCALLBACK(int) Console::attachStorageDevice(Console *pThis,
     VMSTATE enmVMState = VMR3GetStateU(pUVM);
     AssertReturn(enmVMState == VMSTATE_SUSPENDED, VERR_INVALID_STATE);
 
-    /* Determine the base path for the device instance. */
-    PCFGMNODE pCtlInst;
-    pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance);
-    AssertReturn(pCtlInst, VERR_INTERNAL_ERROR);
-
-    PCFGMNODE pLunL0 = NULL;
-    int rc = pThis->configMediumAttachment(pCtlInst,
-                                           pcszDevice,
-                                           uInstance,
-                                           enmBus,
-                                           fUseHostIOCache,
-                                           false /* fSetupMerge */,
-                                           false /* fBuiltinIOCache */,
-                                           0 /* uMergeSource */,
-                                           0 /* uMergeTarget */,
-                                           aMediumAtt,
-                                           pThis->mMachineState,
-                                           NULL /* phrc */,
-                                           true /* fAttachDetach */,
-                                           false /* fForceUnmount */,
-                                           !fSilent /* fHotplug */,
-                                           pUVM,
-                                           NULL /* paLedDevType */,
-                                           &pLunL0);
-    /* Dump the changed LUN if possible, dump the complete device otherwise */
-    CFGMR3Dump(pLunL0 ? pLunL0 : pCtlInst);
-
+    int rc = pThis->i_configMediumAttachment(pcszDevice,
+                                             uInstance,
+                                             enmBus,
+                                             fUseHostIOCache,
+                                             false /* fSetupMerge */,
+                                             false /* fBuiltinIOCache */,
+                                             0 /* uMergeSource */,
+                                             0 /* uMergeTarget */,
+                                             aMediumAtt,
+                                             pThis->mMachineState,
+                                             NULL /* phrc */,
+                                             true /* fAttachDetach */,
+                                             false /* fForceUnmount */,
+                                             !fSilent /* fHotplug */,
+                                             pUVM,
+                                             NULL /* paLedDevType */,
+                                             NULL);
     LogFlowFunc(("Returning %Rrc\n", rc));
     return rc;
 }
@@ -4010,7 +3751,7 @@ DECLCALLBACK(int) Console::attachStorageDevice(Console *pThis,
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)
+HRESULT Console::i_doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -4056,7 +3797,7 @@ HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUV
     StorageControllerType_T enmCtrlType;
     rc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
     AssertComRC(rc);
-    pszDevice = convertControllerTypeToDev(enmCtrlType);
+    pszDevice = i_convertControllerTypeToDev(enmCtrlType);
 
     StorageBus_T enmBus;
     rc = pStorageController->COMGETTER(Bus)(&enmBus);
@@ -4070,7 +3811,7 @@ HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUV
      * pending I/O to the drive which is being changed.
      */
     bool fResume = false;
-    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
+    rc = i_suspendBeforeConfigChange(pUVM, &alock, &fResume);
     if (FAILED(rc))
         return rc;
 
@@ -4081,7 +3822,7 @@ HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUV
      */
     PVMREQ pReq;
     int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                           (PFNRT)detachStorageDevice, 7,
+                           (PFNRT)i_detachStorageDevice, 7,
                            this, pUVM, pszDevice, uInstance, enmBus, aMediumAttachment, fSilent);
 
     /* release the lock before waiting for a result (EMT might wait for it, @bugref{7648})! */
@@ -4095,7 +3836,7 @@ HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUV
     VMR3ReqFree(pReq);
 
     if (fResume)
-        resumeAfterConfigChange(pUVM);
+        i_resumeAfterConfigChange(pUVM);
 
     if (RT_SUCCESS(vrc))
     {
@@ -4127,13 +3868,13 @@ HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUV
  * @thread  EMT
  * @note The VM must not be running since it might have pending I/O to the drive which is being changed.
  */
-DECLCALLBACK(int) Console::detachStorageDevice(Console *pThis,
-                                               PUVM pUVM,
-                                               const char *pcszDevice,
-                                               unsigned uInstance,
-                                               StorageBus_T enmBus,
-                                               IMediumAttachment *pMediumAtt,
-                                               bool fSilent)
+DECLCALLBACK(int) Console::i_detachStorageDevice(Console *pThis,
+                                                 PUVM pUVM,
+                                                 const char *pcszDevice,
+                                                 unsigned uInstance,
+                                                 StorageBus_T enmBus,
+                                                 IMediumAttachment *pMediumAtt,
+                                                 bool fSilent)
 {
     LogFlowFunc(("pThis=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, pMediumAtt=%p\n",
                  pThis, uInstance, pcszDevice, pcszDevice, enmBus, pMediumAtt));
@@ -4152,7 +3893,7 @@ DECLCALLBACK(int) Console::detachStorageDevice(Console *pThis,
     /* Determine the base path for the device instance. */
     PCFGMNODE pCtlInst;
     pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance);
-    AssertReturn(pCtlInst, VERR_INTERNAL_ERROR);
+    AssertReturn(pCtlInst || enmBus == StorageBus_USB, VERR_INTERNAL_ERROR);
 
 #define H()         AssertMsgReturn(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), VERR_GENERAL_FAILURE)
 
@@ -4169,33 +3910,51 @@ DECLCALLBACK(int) Console::detachStorageDevice(Console *pThis,
     hrc = pMediumAtt->COMGETTER(Device)(&lDev);                             H();
     hrc = pMediumAtt->COMGETTER(Port)(&lPort);                              H();
     hrc = pMediumAtt->COMGETTER(Type)(&lType);                              H();
-    hrc = Console::convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);    H();
+    hrc = Console::i_convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);  H();
 
 #undef H
 
-    /* First check if the LUN really exists. */
-    pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN);
-    if (pLunL0)
+    if (enmBus != StorageBus_USB)
     {
-        uint32_t fFlags = 0;
+        /* First check if the LUN really exists. */
+        pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN);
+        if (pLunL0)
+        {
+            uint32_t fFlags = 0;
 
-        if (fSilent)
-            fFlags |= PDM_TACH_FLAGS_NOT_HOT_PLUG;
+            if (fSilent)
+                fFlags |= PDM_TACH_FLAGS_NOT_HOT_PLUG;
 
-        rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags);
-        if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN)
-            rc = VINF_SUCCESS;
-        AssertRCReturn(rc, rc);
-        CFGMR3RemoveNode(pLunL0);
+            rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags);
+            if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN)
+                rc = VINF_SUCCESS;
+            AssertRCReturn(rc, rc);
+            CFGMR3RemoveNode(pLunL0);
 
-        Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN);
-        pThis->mapMediumAttachments.erase(devicePath);
+            Utf8Str devicePath = Utf8StrFmt("%s/%u/LUN#%u", pcszDevice, uInstance, uLUN);
+            pThis->mapMediumAttachments.erase(devicePath);
 
+        }
+        else
+            AssertFailedReturn(VERR_INTERNAL_ERROR);
+
+        CFGMR3Dump(pCtlInst);
     }
     else
-        AssertFailedReturn(VERR_INTERNAL_ERROR);
+    {
+        /* Find the correct USB device in the list. */
+        USBStorageDeviceList::iterator it;
+        for (it = pThis->mUSBStorageDevices.begin(); it != pThis->mUSBStorageDevices.end(); ++it)
+        {
+            if (it->iPort == lPort)
+                break;
+        }
 
-    CFGMR3Dump(pCtlInst);
+        AssertReturn(it != pThis->mUSBStorageDevices.end(), VERR_INTERNAL_ERROR);
+        rc = PDMR3UsbDetachDevice(pUVM, &it->mUuid);
+        AssertRCReturn(rc, rc);
+        pThis->mUSBStorageDevices.erase(it);
+    }
 
     LogFlowFunc(("Returning %Rrc\n", rcRet));
     return rcRet;
@@ -4206,7 +3965,7 @@ DECLCALLBACK(int) Console::detachStorageDevice(Console *pThis,
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter)
+HRESULT Console::i_onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL changeAdapter)
 {
     LogFlowThisFunc(("\n"));
 
@@ -4268,7 +4027,8 @@ HRESULT Console::onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL c
                     if (RT_SUCCESS(vrc) && changeAdapter)
                     {
                         VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM());
-                        if (    enmVMState == VMSTATE_RUNNING    /** @todo LiveMigration: Forbid or deal correctly with the _LS variants */
+                        if (    enmVMState == VMSTATE_RUNNING    /** @todo LiveMigration: Forbid or deal
+                                                                     correctly with the _LS variants */
                             ||  enmVMState == VMSTATE_SUSPENDED)
                         {
                             if (fTraceEnabled && fCableConnected && pINetCfg)
@@ -4277,7 +4037,7 @@ HRESULT Console::onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL c
                                 ComAssertRC(vrc);
                             }
 
-                            rc = doNetworkAdapterChange(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, aNetworkAdapter);
+                            rc = i_doNetworkAdapterChange(ptrVM.rawUVM(), pszAdapterName, ulInstance, 0, aNetworkAdapter);
 
                             if (fTraceEnabled && fCableConnected && pINetCfg)
                             {
@@ -4318,8 +4078,10 @@ HRESULT Console::onNetworkAdapterChange(INetworkAdapter *aNetworkAdapter, BOOL c
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
-                                         NATProtocol_T aProto, IN_BSTR aHostIP, LONG aHostPort, IN_BSTR aGuestIP, LONG aGuestPort)
+HRESULT Console::i_onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
+                                           NATProtocol_T aProto, IN_BSTR aHostIP,
+                                           LONG aHostPort, IN_BSTR aGuestIP,
+                                           LONG aGuestPort)
 {
     LogFlowThisFunc(("\n"));
 
@@ -4337,7 +4099,7 @@ HRESULT Console::onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
         do
         {
             ComPtr<INetworkAdapter> pNetworkAdapter;
-            rc = machine()->GetNetworkAdapter(ulInstance, pNetworkAdapter.asOutParam());
+            rc = i_machine()->GetNetworkAdapter(ulInstance, pNetworkAdapter.asOutParam());
             if (   FAILED(rc)
                 || pNetworkAdapter.isNull())
                 break;
@@ -4409,7 +4171,7 @@ HRESULT Console::onNATRedirectRuleChange(ULONG ulInstance, BOOL aNatRuleRemove,
  * Currently this event doesn't carry actual resolver configuration,
  * so we have to go back to VBoxSVC and ask...  This is not ideal.
  */
-HRESULT Console::onNATDnsChanged()
+HRESULT Console::i_onNATDnsChanged()
 {
     HRESULT hrc;
 
@@ -4494,12 +4256,12 @@ void Console::notifyNatDnsChange(PUVM pUVM, const char *pszDevice, ULONG ulInsta
 }
 
 
-VMMDevMouseInterface *Console::getVMMDevMouseInterface()
+VMMDevMouseInterface *Console::i_getVMMDevMouseInterface()
 {
     return m_pVMMDev;
 }
 
-DisplayMouseInterface *Console::getDisplayMouseInterface()
+DisplayMouseInterface *Console::i_getDisplayMouseInterface()
 {
     return mDisplay;
 }
@@ -4513,8 +4275,8 @@ DisplayMouseInterface *Console::getDisplayMouseInterface()
  * @param   ppszKey Where to store the key on success.
  * @param   ppszVal Where to store the value on success.
  */
-int Console::consoleParseKeyValue(const char *psz, const char **ppszEnd,
-                                  char **ppszKey, char **ppszVal)
+int Console::i_consoleParseKeyValue(const char *psz, const char **ppszEnd,
+                                    char **ppszKey, char **ppszVal)
 {
     int rc = VINF_SUCCESS;
     const char *pszKeyStart = psz;
@@ -4567,10 +4329,11 @@ int Console::consoleParseKeyValue(const char *psz, const char **ppszEnd,
 }
 
 /**
- * Removes the key interfaces from all disk attachments, useful when
- * changing the key store or dropping it.
+ * Initializes the secret key interface on all configured attachments.
+ *
+ * @returns COM status code.
  */
-HRESULT Console::clearDiskEncryptionKeysOnAllAttachments(void)
+HRESULT Console::i_initSecretKeyIfOnAllAttachments(void)
 {
     HRESULT hrc = S_OK;
     SafeIfaceArray<IMediumAttachment> sfaAttachments;
@@ -4592,7 +4355,6 @@ HRESULT Console::clearDiskEncryptionKeysOnAllAttachments(void)
     for (unsigned i = 0; i < sfaAttachments.size(); i++)
     {
         const ComPtr<IMediumAttachment> &pAtt = sfaAttachments[i];
-
         /*
          * Query storage controller, port and device
          * to identify the correct driver.
@@ -4620,14 +4382,14 @@ HRESULT Console::clearDiskEncryptionKeysOnAllAttachments(void)
         StorageControllerType_T enmCtrlType;
         hrc = pStorageCtrl->COMGETTER(ControllerType)(&enmCtrlType);
         AssertComRC(hrc);
-        const char *pcszDevice = convertControllerTypeToDev(enmCtrlType);
+        const char *pcszDevice = i_convertControllerTypeToDev(enmCtrlType);
 
         StorageBus_T enmBus;
         hrc = pStorageCtrl->COMGETTER(Bus)(&enmBus);
         AssertComRC(hrc);
 
         unsigned uLUN;
-        hrc = Console::convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
+        hrc = Console::i_convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
         AssertComRC(hrc);
 
         PPDMIBASE pIBase = NULL;
@@ -4651,20 +4413,17 @@ HRESULT Console::clearDiskEncryptionKeysOnAllAttachments(void)
 }
 
 /**
- * Configures the encryption support for the disk identified by the gien UUID with
- * the given key.
+ * Removes the key interfaces from all disk attachments with the given key ID.
+ * Useful when changing the key store or dropping it.
  *
  * @returns COM status code.
- * @param   pszUuid   The UUID of the disk to configure encryption for.
+ * @param   aId    The ID to look for.
  */
-HRESULT Console::configureEncryptionForDisk(const char *pszUuid)
+HRESULT Console::i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(const Utf8Str &strId)
 {
     HRESULT hrc = S_OK;
     SafeIfaceArray<IMediumAttachment> sfaAttachments;
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
     /* Get the VM - must be done before the read-locking. */
     SafeVMPtr ptrVM(this);
     if (!ptrVM.isOk())
@@ -4673,8 +4432,7 @@ HRESULT Console::configureEncryptionForDisk(const char *pszUuid)
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     hrc = mMachine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments));
-    if (FAILED(hrc))
-        return hrc;
+    AssertComRCReturnRC(hrc);
 
     /* Find the correct attachment. */
     for (unsigned i = 0; i < sfaAttachments.size(); i++)
@@ -4682,7 +4440,7 @@ HRESULT Console::configureEncryptionForDisk(const char *pszUuid)
         const ComPtr<IMediumAttachment> &pAtt = sfaAttachments[i];
         ComPtr<IMedium> pMedium;
         ComPtr<IMedium> pBase;
-        Bstr uuid;
+        Bstr bstrKeyId;
 
         hrc = pAtt->COMGETTER(Medium)(pMedium.asOutParam());
         if (FAILED(hrc))
@@ -4697,14 +4455,20 @@ HRESULT Console::configureEncryptionForDisk(const char *pszUuid)
         if (FAILED(hrc))
             break;
 
-        hrc = pBase->COMGETTER(Id)(uuid.asOutParam());
-        if (FAILED(hrc))
+        hrc = pBase->GetProperty(Bstr("CRYPT/KeyId").raw(), bstrKeyId.asOutParam());
+        if (hrc == VBOX_E_OBJECT_NOT_FOUND)
+        {
+            hrc = S_OK;
+            continue;
+        }
+        else if (FAILED(hrc))
             break;
 
-        if (!RTUuidCompare2Strs(Utf8Str(uuid).c_str(), pszUuid))
+        if (strId.equals(Utf8Str(bstrKeyId)))
         {
+
             /*
-             * Found the matching medium, query storage controller, port and device
+             * Query storage controller, port and device
              * to identify the correct driver.
              */
             ComPtr<IStorageController> pStorageCtrl;
@@ -4713,37 +4477,32 @@ HRESULT Console::configureEncryptionForDisk(const char *pszUuid)
             ULONG ulStorageCtrlInst;
 
             hrc = pAtt->COMGETTER(Controller)(storageCtrlName.asOutParam());
-            if (FAILED(hrc))
-                break;
+            AssertComRC(hrc);
 
             hrc = pAtt->COMGETTER(Port)(&lPort);
-            if (FAILED(hrc))
-                break;
+            AssertComRC(hrc);
 
             hrc = pAtt->COMGETTER(Device)(&lDev);
-            if (FAILED(hrc))
-                break;
+            AssertComRC(hrc);
 
             hrc = mMachine->GetStorageControllerByName(storageCtrlName.raw(), pStorageCtrl.asOutParam());
-            if (FAILED(hrc))
-                break;
+            AssertComRC(hrc);
 
             hrc = pStorageCtrl->COMGETTER(Instance)(&ulStorageCtrlInst);
-            if (FAILED(hrc))
-                break;
+            AssertComRC(hrc);
 
             StorageControllerType_T enmCtrlType;
             hrc = pStorageCtrl->COMGETTER(ControllerType)(&enmCtrlType);
             AssertComRC(hrc);
-            const char *pcszDevice = convertControllerTypeToDev(enmCtrlType);
+            const char *pcszDevice = i_convertControllerTypeToDev(enmCtrlType);
 
             StorageBus_T enmBus;
             hrc = pStorageCtrl->COMGETTER(Bus)(&enmBus);
             AssertComRC(hrc);
 
             unsigned uLUN;
-            hrc = Console::convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
-            AssertComRCReturnRC(hrc);
+            hrc = Console::i_convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
+            AssertComRC(hrc);
 
             PPDMIBASE pIBase = NULL;
             PPDMIMEDIA pIMedium = NULL;
@@ -4753,17 +4512,12 @@ HRESULT Console::configureEncryptionForDisk(const char *pszUuid)
                 if (pIBase)
                 {
                     pIMedium = (PPDMIMEDIA)pIBase->pfnQueryInterface(pIBase, PDMIMEDIA_IID);
-                    if (!pIMedium)
-                        return setError(E_FAIL, tr("could not query medium interface of controller"));
-                    else
+                    if (pIMedium)
                     {
-                        rc = pIMedium->pfnSetSecKeyIf(pIMedium, mpIfSecKey, mpIfSecKeyHlp);
-                        if (RT_FAILURE(rc))
-                            return setError(E_FAIL, tr("Failed to set the encryption key (%Rrc)"), rc);
+                        rc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL, mpIfSecKeyHlp);
+                        Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
                     }
                 }
-                else
-                    return setError(E_FAIL, tr("could not query base interface of controller"));
             }
         }
     }
@@ -4772,40 +4526,190 @@ HRESULT Console::configureEncryptionForDisk(const char *pszUuid)
 }
 
 /**
- * Parses the encryption configuration for one disk.
+ * Configures the encryption support for the disk which have encryption conigured
+ * with the configured key.
  *
- * @returns Pointer to the string following encryption configuration.
- * @param   psz    Pointer to the configuration for the encryption of one disk.
+ * @returns COM status code.
+ * @param   strId                The ID of the password.
+ * @param   pcDisksConfigured    Where to store the number of disks configured for the given ID.
  */
-HRESULT Console::consoleParseDiskEncryption(const char *psz, const char **ppszEnd)
+HRESULT Console::i_configureEncryptionForDisk(const com::Utf8Str &strId, unsigned *pcDisksConfigured)
 {
-    char *pszUuid = NULL;
-    char *pszKeyEnc = NULL;
-    int rc = VINF_SUCCESS;
+    unsigned cDisksConfigured = 0;
     HRESULT hrc = S_OK;
+    SafeIfaceArray<IMediumAttachment> sfaAttachments;
 
-    while (   *psz
-           && RT_SUCCESS(rc))
-    {
-        char *pszKey = NULL;
-        char *pszVal = NULL;
-        const char *pszEnd = NULL;
+    AutoCaller autoCaller(this);
+    AssertComRCReturnRC(autoCaller.rc());
 
-        rc = consoleParseKeyValue(psz, &pszEnd, &pszKey, &pszVal);
-        if (RT_SUCCESS(rc))
-        {
-            if (!RTStrCmp(pszKey, "uuid"))
-                pszUuid = pszVal;
-            else if (!RTStrCmp(pszKey, "dek"))
-                pszKeyEnc = pszVal;
-            else
-                rc = VERR_INVALID_PARAMETER;
+    /* Get the VM - must be done before the read-locking. */
+    SafeVMPtr ptrVM(this);
+    if (!ptrVM.isOk())
+        return ptrVM.rc();
 
-            RTStrFree(pszKey);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-            if (*pszEnd == ',')
-                psz = pszEnd + 1;
-            else
+    hrc = mMachine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments));
+    if (FAILED(hrc))
+        return hrc;
+
+    /* Find the correct attachment. */
+    for (unsigned i = 0; i < sfaAttachments.size(); i++)
+    {
+        const ComPtr<IMediumAttachment> &pAtt = sfaAttachments[i];
+        ComPtr<IMedium> pMedium;
+        ComPtr<IMedium> pBase;
+        Bstr bstrKeyId;
+
+        hrc = pAtt->COMGETTER(Medium)(pMedium.asOutParam());
+        if (FAILED(hrc))
+            break;
+
+        /* Skip non hard disk attachments. */
+        if (pMedium.isNull())
+            continue;
+
+        /* Get the UUID of the base medium and compare. */
+        hrc = pMedium->COMGETTER(Base)(pBase.asOutParam());
+        if (FAILED(hrc))
+            break;
+
+        hrc = pBase->GetProperty(Bstr("CRYPT/KeyId").raw(), bstrKeyId.asOutParam());
+        if (hrc == VBOX_E_OBJECT_NOT_FOUND)
+        {
+            hrc = S_OK;
+            continue;
+        }
+        else if (FAILED(hrc))
+            break;
+
+        if (strId.equals(Utf8Str(bstrKeyId)))
+        {
+            /*
+             * Found the matching medium, query storage controller, port and device
+             * to identify the correct driver.
+             */
+            ComPtr<IStorageController> pStorageCtrl;
+            Bstr storageCtrlName;
+            LONG lPort, lDev;
+            ULONG ulStorageCtrlInst;
+
+            hrc = pAtt->COMGETTER(Controller)(storageCtrlName.asOutParam());
+            if (FAILED(hrc))
+                break;
+
+            hrc = pAtt->COMGETTER(Port)(&lPort);
+            if (FAILED(hrc))
+                break;
+
+            hrc = pAtt->COMGETTER(Device)(&lDev);
+            if (FAILED(hrc))
+                break;
+
+            hrc = mMachine->GetStorageControllerByName(storageCtrlName.raw(), pStorageCtrl.asOutParam());
+            if (FAILED(hrc))
+                break;
+
+            hrc = pStorageCtrl->COMGETTER(Instance)(&ulStorageCtrlInst);
+            if (FAILED(hrc))
+                break;
+
+            StorageControllerType_T enmCtrlType;
+            hrc = pStorageCtrl->COMGETTER(ControllerType)(&enmCtrlType);
+            AssertComRC(hrc);
+            const char *pcszDevice = i_convertControllerTypeToDev(enmCtrlType);
+
+            StorageBus_T enmBus;
+            hrc = pStorageCtrl->COMGETTER(Bus)(&enmBus);
+            AssertComRC(hrc);
+
+            unsigned uLUN;
+            hrc = Console::i_convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
+            AssertComRCReturnRC(hrc);
+
+            PPDMIBASE pIBase = NULL;
+            PPDMIMEDIA pIMedium = NULL;
+            int rc = PDMR3QueryDriverOnLun(ptrVM.rawUVM(), pcszDevice, ulStorageCtrlInst, uLUN, "VD", &pIBase);
+            if (RT_SUCCESS(rc))
+            {
+                if (pIBase)
+                {
+                    pIMedium = (PPDMIMEDIA)pIBase->pfnQueryInterface(pIBase, PDMIMEDIA_IID);
+                    if (!pIMedium)
+                        return setError(E_FAIL, tr("could not query medium interface of controller"));
+                    else
+                    {
+                        rc = pIMedium->pfnSetSecKeyIf(pIMedium, mpIfSecKey, mpIfSecKeyHlp);
+                        if (rc == VERR_VD_PASSWORD_INCORRECT)
+                        {
+                            hrc = setError(VBOX_E_PASSWORD_INCORRECT, tr("The provided password for ID \"%s\" is not correct for at least one disk using this ID"),
+                                           strId.c_str());
+                            break;
+                        }
+                        else if (RT_FAILURE(rc))
+                        {
+                            hrc = setError(E_FAIL, tr("Failed to set the encryption key (%Rrc)"), rc);
+                            break;
+                        }
+
+                        if (RT_SUCCESS(rc))
+                           cDisksConfigured++;
+                    }
+                }
+                else
+                    return setError(E_FAIL, tr("could not query base interface of controller"));
+            }
+        }
+    }
+
+    if (   SUCCEEDED(hrc)
+        && pcDisksConfigured)
+        *pcDisksConfigured = cDisksConfigured;
+    else if (FAILED(hrc))
+    {
+        /* Clear disk encryption setup on successfully configured attachments. */
+        ErrorInfoKeeper eik; /* Keep current error info or it gets deestroyed in the IPC methods below. */
+        i_clearDiskEncryptionKeysOnAllAttachmentsWithKeyId(strId);
+    }
+
+    return hrc;
+}
+
+/**
+ * Parses the encryption configuration for one disk.
+ *
+ * @returns Pointer to the string following encryption configuration.
+ * @param   psz    Pointer to the configuration for the encryption of one disk.
+ */
+HRESULT Console::i_consoleParseDiskEncryption(const char *psz, const char **ppszEnd)
+{
+    char *pszUuid = NULL;
+    char *pszKeyEnc = NULL;
+    int rc = VINF_SUCCESS;
+    HRESULT hrc = S_OK;
+
+    while (   *psz
+           && RT_SUCCESS(rc))
+    {
+        char *pszKey = NULL;
+        char *pszVal = NULL;
+        const char *pszEnd = NULL;
+
+        rc = i_consoleParseKeyValue(psz, &pszEnd, &pszKey, &pszVal);
+        if (RT_SUCCESS(rc))
+        {
+            if (!RTStrCmp(pszKey, "uuid"))
+                pszUuid = pszVal;
+            else if (!RTStrCmp(pszKey, "dek"))
+                pszKeyEnc = pszVal;
+            else
+                rc = VERR_INVALID_PARAMETER;
+
+            RTStrFree(pszKey);
+
+            if (*pszEnd == ',')
+                psz = pszEnd + 1;
+            else
             {
                 /*
                  * End of the configuration for the current disk, skip linefeed and
@@ -4832,27 +4736,31 @@ HRESULT Console::consoleParseDiskEncryption(const char *psz, const char **ppszEn
         cbKey = RTBase64DecodedSize(pszKeyEnc, NULL);
         if (cbKey != -1)
         {
-            void *pvKey = NULL;
-            rc = RTMemSaferAllocZEx(&pvKey, cbKey, RTMEMSAFER_F_REQUIRE_NOT_PAGABLE);
+            uint8_t *pbKey;
+            rc = RTMemSaferAllocZEx((void **)&pbKey, cbKey, RTMEMSAFER_F_REQUIRE_NOT_PAGABLE);
             if (RT_SUCCESS(rc))
             {
-                rc = RTBase64Decode(pszKeyEnc, pvKey, cbKey, NULL, NULL);
+                rc = RTBase64Decode(pszKeyEnc, pbKey, cbKey, NULL, NULL);
                 if (RT_SUCCESS(rc))
                 {
-                    SecretKey *pKey = new SecretKey(pvKey, cbKey);
-                    /* Add the key to the map */
-                    m_mapSecretKeys.insert(std::make_pair(Utf8Str(pszUuid), pKey));
-                    hrc = configureEncryptionForDisk(pszUuid);
-                    if (FAILED(hrc))
+                    rc = m_pKeyStore->addSecretKey(Utf8Str(pszUuid), pbKey, cbKey);
+                    if (RT_SUCCESS(rc))
                     {
-                        /* Delete the key from the map. */
-                        m_mapSecretKeys.erase(Utf8Str(pszUuid));
+                        hrc = i_configureEncryptionForDisk(Utf8Str(pszUuid), NULL);
+                        if (FAILED(hrc))
+                        {
+                            /* Delete the key from the map. */
+                            rc = m_pKeyStore->deleteSecretKey(Utf8Str(pszUuid));
+                            AssertRC(rc);
+                        }
                     }
                 }
                 else
                     hrc = setError(E_FAIL,
                                    tr("Failed to decode the key (%Rrc)"),
                                    rc);
+
+                RTMemSaferFree(pbKey, cbKey);
             }
             else
                 hrc = setError(E_FAIL,
@@ -4880,7 +4788,7 @@ HRESULT Console::consoleParseDiskEncryption(const char *psz, const char **ppszEn
     return hrc;
 }
 
-HRESULT Console::setDiskEncryptionKeys(const Utf8Str &strCfg)
+HRESULT Console::i_setDiskEncryptionKeys(const Utf8Str &strCfg)
 {
     HRESULT hrc = S_OK;
     const char *pszCfg = strCfg.c_str();
@@ -4889,13 +4797,19 @@ HRESULT Console::setDiskEncryptionKeys(const Utf8Str &strCfg)
            && SUCCEEDED(hrc))
     {
         const char *pszNext = NULL;
-        hrc = consoleParseDiskEncryption(pszCfg, &pszNext);
+        hrc = i_consoleParseDiskEncryption(pszCfg, &pszNext);
         pszCfg = pszNext;
     }
 
     return hrc;
 }
 
+void Console::i_removeSecretKeysOnSuspend()
+{
+    /* Remove keys which are supposed to be removed on a suspend. */
+    int rc = m_pKeyStore->deleteAllSecretKeys(true /* fSuspend */, true /* fForce */);
+}
+
 /**
  * Process a network adaptor change.
  *
@@ -4907,11 +4821,11 @@ HRESULT Console::setDiskEncryptionKeys(const Utf8Str &strCfg)
  * @param   uLun                The PDM LUN number of the drive.
  * @param   aNetworkAdapter     The network adapter whose attachment needs to be changed
  */
-HRESULT Console::doNetworkAdapterChange(PUVM pUVM,
-                                        const char *pszDevice,
-                                        unsigned uInstance,
-                                        unsigned uLun,
-                                        INetworkAdapter *aNetworkAdapter)
+HRESULT Console::i_doNetworkAdapterChange(PUVM pUVM,
+                                          const char *pszDevice,
+                                          unsigned uInstance,
+                                          unsigned uLun,
+                                          INetworkAdapter *aNetworkAdapter)
 {
     LogFlowThisFunc(("pszDevice=%p:{%s} uInstance=%u uLun=%u aNetworkAdapter=%p\n",
                       pszDevice, pszDevice, uInstance, uLun, aNetworkAdapter));
@@ -4923,32 +4837,27 @@ HRESULT Console::doNetworkAdapterChange(PUVM pUVM,
      * Suspend the VM first.
      */
     bool fResume = false;
-    int rc = suspendBeforeConfigChange(pUVM, NULL, &fResume);
-    if (FAILED(rc))
-        return rc;
+    HRESULT hr = i_suspendBeforeConfigChange(pUVM, NULL, &fResume);
+    if (FAILED(hr))
+        return hr;
 
     /*
      * Call worker in EMT, that's faster and safer than doing everything
      * using VM3ReqCall. Note that we separate VMR3ReqCall from VMR3ReqWait
      * here to make requests from under the lock in order to serialize them.
      */
-    PVMREQ pReq;
-    int vrc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/,
-                               (PFNRT)changeNetworkAttachment, 6,
-                               this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);
+    int rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/,
+                              (PFNRT)i_changeNetworkAttachment, 6,
+                              this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);
 
     if (fResume)
-        resumeAfterConfigChange(pUVM);
+        i_resumeAfterConfigChange(pUVM);
 
-    if (RT_SUCCESS(vrc))
-    {
-        LogFlowThisFunc(("Returns S_OK\n"));
+    if (RT_SUCCESS(rc))
         return S_OK;
-    }
 
     return setError(E_FAIL,
-                    tr("Could not change the network adaptor attachement type (%Rrc)"),
-                    vrc);
+                    tr("Could not change the network adaptor attachement type (%Rrc)"), rc);
 }
 
 
@@ -4968,12 +4877,12 @@ HRESULT Console::doNetworkAdapterChange(PUVM pUVM,
  * @note Locks the Console object for writing.
  * @note The VM must not be running.
  */
-DECLCALLBACK(int) Console::changeNetworkAttachment(Console *pThis,
-                                                   PUVM pUVM,
-                                                   const char *pszDevice,
-                                                   unsigned uInstance,
-                                                   unsigned uLun,
-                                                   INetworkAdapter *aNetworkAdapter)
+DECLCALLBACK(int) Console::i_changeNetworkAttachment(Console *pThis,
+                                                     PUVM pUVM,
+                                                     const char *pszDevice,
+                                                     unsigned uInstance,
+                                                     unsigned uLun,
+                                                     INetworkAdapter *aNetworkAdapter)
 {
     LogFlowFunc(("pThis=%p pszDevice=%p:{%s} uInstance=%u uLun=%u aNetworkAdapter=%p\n",
                  pThis, pszDevice, pszDevice, uInstance, uLun, aNetworkAdapter));
@@ -5012,7 +4921,7 @@ DECLCALLBACK(int) Console::changeNetworkAttachment(Console *pThis,
     PCFGMNODE pInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%d/", pszDevice, uInstance);
     AssertRelease(pInst);
 
-    int rc = pThis->configNetwork(pszDevice, uInstance, uLun, aNetworkAdapter, pCfg, pLunL0, pInst,
+    int rc = pThis->i_configNetwork(pszDevice, uInstance, uLun, aNetworkAdapter, pCfg, pLunL0, pInst,
                                   true /*fAttachDetach*/, false /*fIgnoreConnectFailure*/);
 
     LogFlowFunc(("Returning %Rrc\n", rc));
@@ -5023,7 +4932,7 @@ DECLCALLBACK(int) Console::changeNetworkAttachment(Console *pThis,
 /**
  * Called by IInternalSessionControl::OnSerialPortChange().
  */
-HRESULT Console::onSerialPortChange(ISerialPort *aSerialPort)
+HRESULT Console::i_onSerialPortChange(ISerialPort *aSerialPort)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5039,7 +4948,7 @@ HRESULT Console::onSerialPortChange(ISerialPort *aSerialPort)
 /**
  * Called by IInternalSessionControl::OnParallelPortChange().
  */
-HRESULT Console::onParallelPortChange(IParallelPort *aParallelPort)
+HRESULT Console::i_onParallelPortChange(IParallelPort *aParallelPort)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5055,7 +4964,7 @@ HRESULT Console::onParallelPortChange(IParallelPort *aParallelPort)
 /**
  * Called by IInternalSessionControl::OnStorageControllerChange().
  */
-HRESULT Console::onStorageControllerChange()
+HRESULT Console::i_onStorageControllerChange()
 {
     LogFlowThisFunc(("\n"));
 
@@ -5071,7 +4980,7 @@ HRESULT Console::onStorageControllerChange()
 /**
  * Called by IInternalSessionControl::OnMediumChange().
  */
-HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce)
+HRESULT Console::i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5084,7 +4993,7 @@ HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForc
     SafeVMPtrQuiet ptrVM(this);
     if (ptrVM.isOk())
     {
-        rc = doMediumChange(aMediumAttachment, !!aForce, ptrVM.rawUVM());
+        rc = i_doMediumChange(aMediumAttachment, !!aForce, ptrVM.rawUVM());
         ptrVM.release();
     }
 
@@ -5101,7 +5010,7 @@ HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForc
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onCPUChange(ULONG aCPU, BOOL aRemove)
+HRESULT Console::i_onCPUChange(ULONG aCPU, BOOL aRemove)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5115,9 +5024,9 @@ HRESULT Console::onCPUChange(ULONG aCPU, BOOL aRemove)
     if (ptrVM.isOk())
     {
         if (aRemove)
-            rc = doCPURemove(aCPU, ptrVM.rawUVM());
+            rc = i_doCPURemove(aCPU, ptrVM.rawUVM());
         else
-            rc = doCPUAdd(aCPU, ptrVM.rawUVM());
+            rc = i_doCPUAdd(aCPU, ptrVM.rawUVM());
         ptrVM.release();
     }
 
@@ -5134,7 +5043,7 @@ HRESULT Console::onCPUChange(ULONG aCPU, BOOL aRemove)
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onCPUExecutionCapChange(ULONG aExecutionCap)
+HRESULT Console::i_onCPUExecutionCapChange(ULONG aExecutionCap)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5158,7 +5067,7 @@ HRESULT Console::onCPUExecutionCapChange(ULONG aExecutionCap)
             rc = VMR3SetCpuExecutionCap(ptrVM.rawUVM(), aExecutionCap);
         }
         else
-            rc = setInvalidMachineStateError();
+            rc = i_setInvalidMachineStateError();
         ptrVM.release();
     }
 
@@ -5178,7 +5087,7 @@ HRESULT Console::onCPUExecutionCapChange(ULONG aExecutionCap)
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onClipboardModeChange(ClipboardMode_T aClipboardMode)
+HRESULT Console::i_onClipboardModeChange(ClipboardMode_T aClipboardMode)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5196,9 +5105,9 @@ HRESULT Console::onClipboardModeChange(ClipboardMode_T aClipboardMode)
         if (   mMachineState == MachineState_Running
             || mMachineState == MachineState_Teleporting
             || mMachineState == MachineState_LiveSnapshotting)
-            changeClipboardMode(aClipboardMode);
+            i_changeClipboardMode(aClipboardMode);
         else
-            rc = setInvalidMachineStateError();
+            rc = i_setInvalidMachineStateError();
         ptrVM.release();
     }
 
@@ -5214,11 +5123,11 @@ HRESULT Console::onClipboardModeChange(ClipboardMode_T aClipboardMode)
 }
 
 /**
- * Called by IInternalSessionControl::OnDragAndDropModeChange().
+ * Called by IInternalSessionControl::OnDnDModeChange().
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode)
+HRESULT Console::i_onDnDModeChange(DnDMode_T aDnDMode)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5229,16 +5138,16 @@ HRESULT Console::onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode)
 
     HRESULT rc = S_OK;
 
-    /* don't trigger the drag'n'drop mode change if the VM isn't running */
+    /* don't trigger the drag and drop mode change if the VM isn't running */
     SafeVMPtrQuiet ptrVM(this);
     if (ptrVM.isOk())
     {
         if (   mMachineState == MachineState_Running
             || mMachineState == MachineState_Teleporting
             || mMachineState == MachineState_LiveSnapshotting)
-            changeDragAndDropMode(aDragAndDropMode);
+            i_changeDnDMode(aDnDMode);
         else
-            rc = setInvalidMachineStateError();
+            rc = i_setInvalidMachineStateError();
         ptrVM.release();
     }
 
@@ -5246,7 +5155,7 @@ HRESULT Console::onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode)
     if (SUCCEEDED(rc))
     {
         alock.release();
-        fireDragAndDropModeChangedEvent(mEventSource, aDragAndDropMode);
+        fireDnDModeChangedEvent(mEventSource, aDnDMode);
     }
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
@@ -5258,7 +5167,7 @@ HRESULT Console::onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode)
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onVRDEServerChange(BOOL aRestart)
+HRESULT Console::i_onVRDEServerChange(BOOL aRestart)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -5317,7 +5226,7 @@ HRESULT Console::onVRDEServerChange(BOOL aRestart)
                     }
                 }
                 else
-                    rc = setInvalidMachineStateError();
+                    rc = i_setInvalidMachineStateError();
 
                 mfVRDEChangeInProcess = false;
             } while (mfVRDEChangePending && SUCCEEDED(rc));
@@ -5336,7 +5245,7 @@ HRESULT Console::onVRDEServerChange(BOOL aRestart)
     return rc;
 }
 
-void Console::onVRDEServerInfoChange()
+void Console::i_onVRDEServerInfoChange()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -5353,7 +5262,7 @@ HRESULT Console::i_sendACPIMonitorHotPlugEvent()
     if (   mMachineState != MachineState_Running
         && mMachineState != MachineState_Teleporting
         && mMachineState != MachineState_LiveSnapshotting)
-        return setInvalidMachineStateError();
+        return i_setInvalidMachineStateError();
 
     /* get the VM handle. */
     SafeVMPtr ptrVM(this);
@@ -5385,7 +5294,7 @@ HRESULT Console::i_sendACPIMonitorHotPlugEvent()
     return rc;
 }
 
-HRESULT Console::onVideoCaptureChange()
+HRESULT Console::i_onVideoCaptureChange()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -5407,17 +5316,17 @@ HRESULT Console::onVideoCaptureChange()
         {
             int vrc = VINF_SUCCESS;
             if (SUCCEEDED(rc))
-                vrc = mDisplay->VideoCaptureEnableScreens(ComSafeArrayAsInParam(screens));
+                vrc = mDisplay->i_VideoCaptureEnableScreens(ComSafeArrayAsInParam(screens));
             if (RT_SUCCESS(vrc))
             {
                 if (fEnabled)
                 {
-                    vrc = mDisplay->VideoCaptureStart();
+                    vrc = mDisplay->i_VideoCaptureStart();
                     if (RT_FAILURE(vrc))
                         rc = setError(E_FAIL, tr("Unable to start video capturing (%Rrc)"), vrc);
                 }
                 else
-                    mDisplay->VideoCaptureStop();
+                    mDisplay->i_VideoCaptureStop();
             }
             else
                 rc = setError(E_FAIL, tr("Unable to set screens for capturing (%Rrc)"), vrc);
@@ -5438,7 +5347,7 @@ HRESULT Console::onVideoCaptureChange()
 /**
  * Called by IInternalSessionControl::OnUSBControllerChange().
  */
-HRESULT Console::onUSBControllerChange()
+HRESULT Console::i_onUSBControllerChange()
 {
     LogFlowThisFunc(("\n"));
 
@@ -5455,7 +5364,7 @@ HRESULT Console::onUSBControllerChange()
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onSharedFolderChange(BOOL aGlobal)
+HRESULT Console::i_onSharedFolderChange(BOOL aGlobal)
 {
     LogFlowThisFunc(("aGlobal=%RTbool\n", aGlobal));
 
@@ -5464,7 +5373,7 @@ HRESULT Console::onSharedFolderChange(BOOL aGlobal)
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = fetchSharedFolders(aGlobal);
+    HRESULT rc = i_fetchSharedFolders(aGlobal);
 
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
@@ -5491,7 +5400,8 @@ HRESULT Console::onSharedFolderChange(BOOL aGlobal)
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs)
+HRESULT Console::i_onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs,
+                                     const Utf8Str &aCaptureFilename)
 {
 #ifdef VBOX_WITH_USB
     LogFlowThisFunc(("aDevice=%p aError=%p\n", aDevice, aError));
@@ -5517,7 +5427,7 @@ HRESULT Console::onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aE
     {
         /* notify callbacks about the error */
         alock.release();
-        onUSBDeviceStateChange(aDevice, true /* aAttached */, aError);
+        i_onUSBDeviceStateChange(aDevice, true /* aAttached */, aError);
         return S_OK;
     }
 
@@ -5529,7 +5439,7 @@ HRESULT Console::onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aE
     }
 
     alock.release();
-    HRESULT rc = attachUSBDevice(aDevice, aMaskedIfs);
+    HRESULT rc = i_attachUSBDevice(aDevice, aMaskedIfs, aCaptureFilename);
     if (FAILED(rc))
     {
         /* take the current error info */
@@ -5540,7 +5450,7 @@ HRESULT Console::onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aE
         if (!pError.isNull())
         {
             /* notify callbacks about the error */
-            onUSBDeviceStateChange(aDevice, true /* aAttached */, pError);
+            i_onUSBDeviceStateChange(aDevice, true /* aAttached */, pError);
         }
     }
 
@@ -5557,7 +5467,7 @@ HRESULT Console::onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aE
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onUSBDeviceDetach(IN_BSTR aId,
+HRESULT Console::i_onUSBDeviceDetach(IN_BSTR aId,
                                    IVirtualBoxErrorInfo *aError)
 {
 #ifdef VBOX_WITH_USB
@@ -5574,8 +5484,8 @@ HRESULT Console::onUSBDeviceDetach(IN_BSTR aId,
     USBDeviceList::iterator it = mUSBDevices.begin();
     while (it != mUSBDevices.end())
     {
-        LogFlowThisFunc(("it={%RTuuid}\n", (*it)->id().raw()));
-        if ((*it)->id() == Uuid)
+        LogFlowThisFunc(("it={%RTuuid}\n", (*it)->i_id().raw()));
+        if ((*it)->i_id() == Uuid)
         {
             pUSBDevice = *it;
             break;
@@ -5609,7 +5519,7 @@ HRESULT Console::onUSBDeviceDetach(IN_BSTR aId,
     {
         /* notify callback about an error */
         alock.release();
-        onUSBDeviceStateChange(pUSBDevice, false /* aAttached */, aError);
+        i_onUSBDeviceStateChange(pUSBDevice, false /* aAttached */, aError);
         return S_OK;
     }
 
@@ -5617,7 +5527,7 @@ HRESULT Console::onUSBDeviceDetach(IN_BSTR aId,
     mUSBDevices.erase(it);
 
     alock.release();
-    HRESULT rc = detachUSBDevice(pUSBDevice);
+    HRESULT rc = i_detachUSBDevice(pUSBDevice);
     if (FAILED(rc))
     {
         /* Re-add the device to the collection */
@@ -5632,7 +5542,7 @@ HRESULT Console::onUSBDeviceDetach(IN_BSTR aId,
         if (!pError.isNull())
         {
             /* notify callbacks about the error */
-            onUSBDeviceStateChange(pUSBDevice, false /* aAttached */, pError);
+            i_onUSBDeviceStateChange(pUSBDevice, false /* aAttached */, pError);
         }
     }
 
@@ -5648,7 +5558,7 @@ HRESULT Console::onUSBDeviceDetach(IN_BSTR aId,
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
+HRESULT Console::i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5693,7 +5603,7 @@ HRESULT Console::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
             }
         }
         else
-            rc = setInvalidMachineStateError();
+            rc = i_setInvalidMachineStateError();
         ptrVM.release();
     }
 
@@ -5713,7 +5623,7 @@ HRESULT Console::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent)
+HRESULT Console::i_onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent)
 {
     LogFlowThisFunc(("\n"));
 
@@ -5727,9 +5637,9 @@ HRESULT Console::onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOO
     if (ptrVM.isOk())
     {
         if (aRemove)
-            rc = doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM(), RT_BOOL(aSilent));
+            rc = i_doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM(), RT_BOOL(aSilent));
         else
-            rc = doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM(), RT_BOOL(aSilent));
+            rc = i_doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM(), RT_BOOL(aSilent));
         ptrVM.release();
     }
 
@@ -5741,22 +5651,21 @@ HRESULT Console::onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOO
     return rc;
 }
 
-HRESULT Console::onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal)
+HRESULT Console::i_onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVal)
 {
     LogFlowThisFunc(("\n"));
 
     AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
+    if (FAILED(autoCaller.rc()))
+        return autoCaller.rc();
 
     if (!aMachineId)
         return S_OK;
 
     HRESULT hrc = S_OK;
     Bstr idMachine(aMachineId);
-    Bstr idSelf;
-    hrc = mMachine->COMGETTER(Id)(idSelf.asOutParam());
     if (   FAILED(hrc)
-        || idMachine != idSelf)
+        || idMachine != i_getId())
         return hrc;
 
     /* don't do anything if the VM isn't running */
@@ -5786,19 +5695,16 @@ HRESULT Console::onExtraDataChange(IN_BSTR aMachineId, IN_BSTR aKey, IN_BSTR aVa
 /**
  * @note Temporarily locks this object for writing.
  */
-HRESULT Console::getGuestProperty(IN_BSTR aName, BSTR *aValue,
-                                  LONG64 *aTimestamp, BSTR *aFlags)
+HRESULT Console::i_getGuestProperty(const Utf8Str &aName, Utf8Str *aValue, LONG64 *aTimestamp, Utf8Str *aFlags)
 {
 #ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
 #else  /* VBOX_WITH_GUEST_PROPS */
-    if (!VALID_PTR(aName))
-        return E_INVALIDARG;
-    if (!VALID_PTR(aValue))
-        return E_POINTER;
-    if ((aTimestamp != NULL) && !VALID_PTR(aTimestamp))
+    if (!RT_VALID_PTR(aValue))
+         return E_POINTER;
+    if (aTimestamp != NULL && !RT_VALID_PTR(aTimestamp))
         return E_POINTER;
-    if ((aFlags != NULL) && !VALID_PTR(aFlags))
+    if (aFlags != NULL && !RT_VALID_PTR(aFlags))
         return E_POINTER;
 
     AutoCaller autoCaller(this);
@@ -5818,50 +5724,54 @@ HRESULT Console::getGuestProperty(IN_BSTR aName, BSTR *aValue,
     try
     {
         VBOXHGCMSVCPARM parm[4];
-        Utf8Str Utf8Name = aName;
         char szBuffer[MAX_VALUE_LEN + MAX_FLAGS_LEN];
 
         parm[0].type = VBOX_HGCM_SVC_PARM_PTR;
-        parm[0].u.pointer.addr = (void*)Utf8Name.c_str();
-        /* The + 1 is the null terminator */
-        parm[0].u.pointer.size = (uint32_t)Utf8Name.length() + 1;
+        parm[0].u.pointer.addr = (void*)aName.c_str();
+        parm[0].u.pointer.size = (uint32_t)aName.length() + 1; /* The + 1 is the null terminator */
+
         parm[1].type = VBOX_HGCM_SVC_PARM_PTR;
         parm[1].u.pointer.addr = szBuffer;
         parm[1].u.pointer.size = sizeof(szBuffer);
+
+        parm[2].type = VBOX_HGCM_SVC_PARM_64BIT;
+        parm[2].u.uint64 = 0;
+
+        parm[3].type = VBOX_HGCM_SVC_PARM_32BIT;
+        parm[3].u.uint32 = 0;
+
         int vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", GET_PROP_HOST,
                                           4, &parm[0]);
         /* The returned string should never be able to be greater than our buffer */
         AssertLogRel(vrc != VERR_BUFFER_OVERFLOW);
-        AssertLogRel(RT_FAILURE(vrc) || VBOX_HGCM_SVC_PARM_64BIT == parm[2].type);
-        if (RT_SUCCESS(vrc) || (VERR_NOT_FOUND == vrc))
+        AssertLogRel(RT_FAILURE(vrc) || parm[2].type == VBOX_HGCM_SVC_PARM_64BIT);
+        if (RT_SUCCESS(vrc))
         {
-            rc = S_OK;
-            if (vrc != VERR_NOT_FOUND)
-            {
-                Utf8Str strBuffer(szBuffer);
-                strBuffer.cloneTo(aValue);
+            *aValue = szBuffer;
 
-                if (aTimestamp)
-                    *aTimestamp = parm[2].u.uint64;
+            if (aTimestamp)
+                *aTimestamp = parm[2].u.uint64;
 
-                if (aFlags)
-                {
-                    size_t iFlags = strBuffer.length() + 1;
-                    Utf8Str(szBuffer + iFlags).cloneTo(aFlags);
-                }
-            }
-            else
-                aValue = NULL;
+            if (aFlags)
+                *aFlags = &szBuffer[strlen(szBuffer) + 1];
+
+            rc = S_OK;
+        }
+        else if (vrc == VERR_NOT_FOUND)
+        {
+            *aValue = "";
+            rc = S_OK;
         }
         else
-            rc = setError(E_UNEXPECTED,
-                tr("The service call failed with the error %Rrc"),
-                vrc);
+            rc = setError(VBOX_E_IPRT_ERROR,
+                          tr("The VBoxGuestPropSvc service call failed with the error %Rrc"),
+                          vrc);
     }
     catch(std::bad_alloc & /*e*/)
     {
         rc = E_OUTOFMEMORY;
     }
+
     return rc;
 #endif /* VBOX_WITH_GUEST_PROPS */
 }
@@ -5869,17 +5779,11 @@ HRESULT Console::getGuestProperty(IN_BSTR aName, BSTR *aValue,
 /**
  * @note Temporarily locks this object for writing.
  */
-HRESULT Console::setGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags)
+HRESULT Console::i_setGuestProperty(const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags)
 {
 #ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
 #else /* VBOX_WITH_GUEST_PROPS */
-    if (!RT_VALID_PTR(aName))
-        return setError(E_INVALIDARG, tr("Name cannot be NULL or an invalid pointer"));
-    if (aValue != NULL && !RT_VALID_PTR(aValue))
-        return setError(E_INVALIDARG, tr("Invalid value pointer"));
-    if (aFlags != NULL && !RT_VALID_PTR(aFlags))
-        return setError(E_INVALIDARG, tr("Invalid flags pointer"));
 
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -5896,74 +5800,84 @@ HRESULT Console::setGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags)
 
     VBOXHGCMSVCPARM parm[3];
 
-    Utf8Str Utf8Name = aName;
     parm[0].type = VBOX_HGCM_SVC_PARM_PTR;
-    parm[0].u.pointer.addr = (void*)Utf8Name.c_str();
-    /* The + 1 is the null terminator */
-    parm[0].u.pointer.size = (uint32_t)Utf8Name.length() + 1;
+    parm[0].u.pointer.addr = (void*)aName.c_str();
+    parm[0].u.pointer.size = (uint32_t)aName.length() + 1; /* The + 1 is the null terminator */
+
+    parm[1].type = VBOX_HGCM_SVC_PARM_PTR;
+    parm[1].u.pointer.addr = (void *)aValue.c_str();
+    parm[1].u.pointer.size = (uint32_t)aValue.length() + 1; /* The + 1 is the null terminator */
 
-    Utf8Str Utf8Value;
-    if (aValue != NULL)
+    int vrc;
+    if (aFlags.isEmpty())
     {
-        Utf8Value = aValue;
-        parm[1].type = VBOX_HGCM_SVC_PARM_PTR;
-        parm[1].u.pointer.addr = (void *)Utf8Value.c_str();
-        /* The + 1 is the null terminator */
-        parm[1].u.pointer.size = (uint32_t)Utf8Value.length() + 1;
+        vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", SET_PROP_VALUE_HOST,
+                                    2, &parm[0]);
     }
-
-    Utf8Str Utf8Flags;
-    if (aFlags != NULL)
+    else
     {
-        Utf8Flags = aFlags;
         parm[2].type = VBOX_HGCM_SVC_PARM_PTR;
-        parm[2].u.pointer.addr = (void*)Utf8Flags.c_str();
-        /* The + 1 is the null terminator */
-        parm[2].u.pointer.size = (uint32_t)Utf8Flags.length() + 1;
-    }
+        parm[2].u.pointer.addr = (void*)aFlags.c_str();
+        parm[2].u.pointer.size = (uint32_t)aFlags.length() + 1; /* The + 1 is the null terminator */
 
-    int vrc;
-    if (aValue != NULL && aFlags != NULL)
         vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", SET_PROP_HOST,
                                       3, &parm[0]);
-    else if (aValue != NULL)
-        vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", SET_PROP_VALUE_HOST,
-                                    2, &parm[0]);
-    else
-        vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", DEL_PROP_HOST,
-                                    1, &parm[0]);
-    HRESULT hrc;
-    if (RT_SUCCESS(vrc))
-        hrc = S_OK;
-    else
-        hrc = setError(E_UNEXPECTED, tr("The service call failed with the error %Rrc"), vrc);
+    }
+
+    HRESULT hrc = S_OK;
+    if (RT_FAILURE(vrc))
+        hrc = setError(VBOX_E_IPRT_ERROR, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc);
     return hrc;
 #endif /* VBOX_WITH_GUEST_PROPS */
 }
 
+HRESULT Console::i_deleteGuestProperty(const Utf8Str &aName)
+{
+#ifndef VBOX_WITH_GUEST_PROPS
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_GUEST_PROPS */
+
+    AutoCaller autoCaller(this);
+    AssertComRCReturnRC(autoCaller.rc());
+
+    /* protect mpUVM (if not NULL) */
+    SafeVMPtrQuiet ptrVM(this);
+    if (FAILED(ptrVM.rc()))
+        return ptrVM.rc();
+
+    /* Note: validity of mVMMDev which is bound to uninit() is guaranteed by
+     * ptrVM, so there is no need to hold a lock of this */
+
+    using namespace guestProp;
+
+    VBOXHGCMSVCPARM parm[1];
+
+    parm[0].type = VBOX_HGCM_SVC_PARM_PTR;
+    parm[0].u.pointer.addr = (void*)aName.c_str();
+    parm[0].u.pointer.size = (uint32_t)aName.length() + 1; /* The + 1 is the null terminator */
+
+    int vrc = m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", DEL_PROP_HOST,
+                                      1, &parm[0]);
+
+    HRESULT hrc = S_OK;
+    if (RT_FAILURE(vrc))
+        hrc = setError(VBOX_E_IPRT_ERROR, tr("The VBoxGuestPropSvc service call failed with the error %Rrc"), vrc);
+    return hrc;
+#endif /* VBOX_WITH_GUEST_PROPS */
+}
 
 /**
  * @note Temporarily locks this object for writing.
  */
-HRESULT Console::enumerateGuestProperties(IN_BSTR aPatterns,
-                                          ComSafeArrayOut(BSTR, aNames),
-                                          ComSafeArrayOut(BSTR, aValues),
-                                          ComSafeArrayOut(LONG64, aTimestamps),
-                                          ComSafeArrayOut(BSTR, aFlags))
+HRESULT Console::i_enumerateGuestProperties(const Utf8Str &aPatterns,
+                                            std::vector<Utf8Str> &aNames,
+                                            std::vector<Utf8Str> &aValues,
+                                            std::vector<LONG64>  &aTimestamps,
+                                            std::vector<Utf8Str> &aFlags)
 {
 #ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
 #else /* VBOX_WITH_GUEST_PROPS */
-    if (!VALID_PTR(aPatterns) && (aPatterns != NULL))
-        return E_POINTER;
-    if (ComSafeArrayOutIsNull(aNames))
-        return E_POINTER;
-    if (ComSafeArrayOutIsNull(aValues))
-        return E_POINTER;
-    if (ComSafeArrayOutIsNull(aTimestamps))
-        return E_POINTER;
-    if (ComSafeArrayOutIsNull(aFlags))
-        return E_POINTER;
 
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -5976,10 +5890,7 @@ HRESULT Console::enumerateGuestProperties(IN_BSTR aPatterns,
     /* Note: validity of mVMMDev which is bound to uninit() is guaranteed by
      * autoVMCaller, so there is no need to hold a lock of this */
 
-    return doEnumerateGuestProperties(aPatterns, ComSafeArrayOutArg(aNames),
-                                      ComSafeArrayOutArg(aValues),
-                                      ComSafeArrayOutArg(aTimestamps),
-                                      ComSafeArrayOutArg(aFlags));
+    return i_doEnumerateGuestProperties(aPatterns, aNames, aValues, aTimestamps, aFlags);
 #endif /* VBOX_WITH_GUEST_PROPS */
 }
 
@@ -5999,9 +5910,9 @@ static int onlineMergeMediumProgress(void *pvUser, unsigned uPercentage)
 /**
  * @note Temporarily locks this object for writing. bird: And/or reading?
  */
-HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
-                                   ULONG aSourceIdx, ULONG aTargetIdx,
-                                   IProgress *aProgress)
+HRESULT Console::i_onlineMergeMedium(IMediumAttachment *aMediumAttachment,
+                                     ULONG aSourceIdx, ULONG aTargetIdx,
+                                     IProgress *aProgress)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -6015,7 +5926,7 @@ HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
         return ptrVM.rc();
 
     /* We will need to release the lock before doing the actual merge */
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* paranoia - we don't want merges to happen while teleporting etc. */
     switch (mMachineState)
@@ -6025,7 +5936,7 @@ HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
             break;
 
         default:
-            return setInvalidMachineStateError();
+            return i_setInvalidMachineStateError();
     }
 
     /** @todo AssertComRC -> AssertComRCReturn! Could potentially end up
@@ -6075,7 +5986,7 @@ HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
     StorageControllerType_T enmCtrlType;
     rc = pStorageController->COMGETTER(ControllerType)(&enmCtrlType);
     AssertComRC(rc);
-    const char *pcszDevice = convertControllerTypeToDev(enmCtrlType);
+    const char *pcszDevice = i_convertControllerTypeToDev(enmCtrlType);
 
     StorageBus_T enmBus;
     rc = pStorageController->COMGETTER(Bus)(&enmBus);
@@ -6088,44 +5999,27 @@ HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
     AssertComRC(rc);
 
     unsigned uLUN;
-    rc = Console::convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
+    rc = Console::i_convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);
     AssertComRCReturnRC(rc);
 
-    alock.release();
+    Assert(mMachineState == MachineState_DeletingSnapshotOnline);
 
     /* Pause the VM, as it might have pending IO on this drive */
-    VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM());
-    if (mMachineState == MachineState_DeletingSnapshotOnline)
-    {
-        LogFlowFunc(("Suspending the VM...\n"));
-        /* disable the callback to prevent Console-level state change */
-        mVMStateChangeCallbackDisabled = true;
-        int vrc2 = VMR3Suspend(ptrVM.rawUVM(), VMSUSPENDREASON_RECONFIG);
-        mVMStateChangeCallbackDisabled = false;
-        AssertRCReturn(vrc2, E_FAIL);
-    }
+    bool fResume = false;
+    rc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), &alock, &fResume);
+    if (FAILED(rc))
+        return rc;
 
+    alock.release();
     vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,
-                           (PFNRT)reconfigureMediumAttachment, 13,
+                           (PFNRT)i_reconfigureMediumAttachment, 13,
                            this, ptrVM.rawUVM(), pcszDevice, uInstance, enmBus, fUseHostIOCache,
                            fBuiltinIOCache, true /* fSetupMerge */, aSourceIdx, aTargetIdx,
                            aMediumAttachment, mMachineState, &rc);
     /* error handling is after resuming the VM */
 
-    if (mMachineState == MachineState_DeletingSnapshotOnline)
-    {
-        LogFlowFunc(("Resuming the VM...\n"));
-        /* disable the callback to prevent Console-level state change */
-        mVMStateChangeCallbackDisabled = true;
-        int vrc2 = VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_RECONFIG);
-        mVMStateChangeCallbackDisabled = false;
-        if (RT_FAILURE(vrc2))
-        {
-            /* too bad, we failed. try to sync the console state with the VMM state */
-            AssertLogRelRC(vrc2);
-            vmstateChangeCallback(ptrVM.rawUVM(), VMSTATE_SUSPENDED, enmVMState, this);
-        }
-    }
+    if (fResume)
+        i_resumeAfterConfigChange(ptrVM.rawUVM());
 
     if (RT_FAILURE(vrc))
         return setError(E_FAIL, tr("%Rrc"), vrc);
@@ -6152,42 +6046,25 @@ HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
     if (RT_FAILURE(vrc))
         return setError(E_FAIL, tr("Failed to perform an online medium merge (%Rrc)"), vrc);
 
+    alock.acquire();
     /* Pause the VM, as it might have pending IO on this drive */
-    enmVMState = VMR3GetStateU(ptrVM.rawUVM());
-    if (mMachineState == MachineState_DeletingSnapshotOnline)
-    {
-        LogFlowFunc(("Suspending the VM...\n"));
-        /* disable the callback to prevent Console-level state change */
-        mVMStateChangeCallbackDisabled = true;
-        int vrc2 = VMR3Suspend(ptrVM.rawUVM(), VMSUSPENDREASON_RECONFIG);
-        mVMStateChangeCallbackDisabled = false;
-        AssertRCReturn(vrc2, E_FAIL);
-    }
+    rc = i_suspendBeforeConfigChange(ptrVM.rawUVM(), &alock, &fResume);
+    if (FAILED(rc))
+        return rc;
+    alock.release();
 
     /* Update medium chain and state now, so that the VM can continue. */
     rc = mControl->FinishOnlineMergeMedium();
 
     vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,
-                           (PFNRT)reconfigureMediumAttachment, 13,
+                           (PFNRT)i_reconfigureMediumAttachment, 13,
                            this, ptrVM.rawUVM(), pcszDevice, uInstance, enmBus, fUseHostIOCache,
                            fBuiltinIOCache, false /* fSetupMerge */, 0 /* uMergeSource */,
                            0 /* uMergeTarget */, aMediumAttachment, mMachineState, &rc);
     /* error handling is after resuming the VM */
 
-    if (mMachineState == MachineState_DeletingSnapshotOnline)
-    {
-        LogFlowFunc(("Resuming the VM...\n"));
-        /* disable the callback to prevent Console-level state change */
-        mVMStateChangeCallbackDisabled = true;
-        int vrc2 = VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_RECONFIG);
-        mVMStateChangeCallbackDisabled = false;
-        AssertRC(vrc2);
-        if (RT_FAILURE(vrc2))
-        {
-            /* too bad, we failed. try to sync the console state with the VMM state */
-            vmstateChangeCallback(ptrVM.rawUVM(), VMSTATE_SUSPENDED, enmVMState, this);
-        }
-    }
+    if (fResume)
+        i_resumeAfterConfigChange(ptrVM.rawUVM());
 
     if (RT_FAILURE(vrc))
         return setError(E_FAIL, tr("%Rrc"), vrc);
@@ -6197,6 +6074,82 @@ HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
     return rc;
 }
 
+HRESULT Console::i_reconfigureMediumAttachments(const std::vector<ComPtr<IMediumAttachment> > &aAttachments)
+{
+    HRESULT rc = S_OK;
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* get the VM handle. */
+    SafeVMPtr ptrVM(this);
+    if (!ptrVM.isOk())
+        return ptrVM.rc();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    for (size_t i = 0; i < aAttachments.size(); ++i)
+    {
+        ComPtr<IStorageController> pStorageController;
+        Bstr controllerName;
+        ULONG lInstance;
+        StorageControllerType_T enmController;
+        StorageBus_T enmBus;
+        BOOL fUseHostIOCache;
+
+        /*
+         * We could pass the objects, but then EMT would have to do lots of
+         * IPC (to VBoxSVC) which takes a significant amount of time.
+         * Better query needed values here and pass them.
+         */
+        rc = aAttachments[i]->COMGETTER(Controller)(controllerName.asOutParam());
+        if (FAILED(rc))
+            throw rc;
+
+        rc = mMachine->GetStorageControllerByName(controllerName.raw(),
+                                                  pStorageController.asOutParam());
+        if (FAILED(rc))
+            throw rc;
+
+        rc = pStorageController->COMGETTER(ControllerType)(&enmController);
+        if (FAILED(rc))
+            throw rc;
+        rc = pStorageController->COMGETTER(Instance)(&lInstance);
+        if (FAILED(rc))
+            throw rc;
+        rc = pStorageController->COMGETTER(Bus)(&enmBus);
+        if (FAILED(rc))
+            throw rc;
+        rc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
+        if (FAILED(rc))
+            throw rc;
+
+        const char *pcszDevice = i_convertControllerTypeToDev(enmController);
+
+        BOOL fBuiltinIOCache;
+        rc = mMachine->COMGETTER(IOCacheEnabled)(&fBuiltinIOCache);
+        if (FAILED(rc))
+            throw rc;
+
+        alock.release();
+
+        IMediumAttachment *pAttachment = aAttachments[i];
+        int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,
+                                   (PFNRT)i_reconfigureMediumAttachment, 13,
+                                   this, ptrVM.rawUVM(), pcszDevice, lInstance, enmBus, fUseHostIOCache,
+                                   fBuiltinIOCache, false /* fSetupMerge */, 0 /* uMergeSource */,
+                                   0 /* uMergeTarget */, pAttachment, mMachineState, &rc);
+        if (RT_FAILURE(vrc))
+            throw setError(E_FAIL, tr("%Rrc"), vrc);
+        if (FAILED(rc))
+            throw rc;
+
+        alock.acquire();
+    }
+
+    return rc;
+}
+
 
 /**
  * Load an HGCM service.
@@ -6207,7 +6160,7 @@ HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment,
  * Extension modules must not link directly against VBoxC, (XP)COM is
  * handling this.
  */
-int Console::hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName)
+int Console::i_hgcmLoadService(const char *pszServiceLibrary, const char *pszServiceName)
 {
     /* Everyone seems to delegate all HGCM calls to VMMDev, so stick to this
      * convention. Adds one level of indirection for no obvious reason. */
@@ -6218,17 +6171,17 @@ int Console::hgcmLoadService(const char *pszServiceLibrary, const char *pszServi
 /**
  * Merely passes the call to Guest::enableVMMStatistics().
  */
-void Console::enableVMMStatistics(BOOL aEnable)
+void Console::i_enableVMMStatistics(BOOL aEnable)
 {
     if (mGuest)
-        mGuest->enableVMMStatistics(aEnable);
+        mGuest->i_enableVMMStatistics(aEnable);
 }
 
 /**
  * Worker for Console::Pause and internal entry point for pausing a VM for
  * a specific reason.
  */
-HRESULT Console::pause(Reason_T aReason)
+HRESULT Console::i_pause(Reason_T aReason)
 {
     LogFlowThisFuncEnter();
 
@@ -6246,11 +6199,18 @@ HRESULT Console::pause(Reason_T aReason)
 
         case MachineState_Paused:
         case MachineState_TeleportingPausedVM:
-        case MachineState_Saving:
+        case MachineState_OnlineSnapshotting:
+            /* Remove any keys which are supposed to be removed on a suspend. */
+            if (   aReason == Reason_HostSuspend
+                || aReason == Reason_HostBatteryLow)
+            {
+                i_removeSecretKeysOnSuspend();
+                return S_OK;
+            }
             return setError(VBOX_E_INVALID_VM_STATE, tr("Already paused"));
 
         default:
-            return setInvalidMachineStateError();
+            return i_setInvalidMachineStateError();
     }
 
     /* get the VM handle. */
@@ -6263,7 +6223,7 @@ HRESULT Console::pause(Reason_T aReason)
 
     LogFlowThisFunc(("Sending PAUSE request...\n"));
     if (aReason != Reason_Unspecified)
-        LogRel(("Pausing VM execution, reason \"%s\"\n", Global::stringifyReason(aReason)));
+        LogRel(("Pausing VM execution, reason '%s'\n", Global::stringifyReason(aReason)));
 
     /** @todo r=klaus make use of aReason */
     VMSUSPENDREASON enmReason = VMSUSPENDREASON_USER;
@@ -6276,17 +6236,11 @@ HRESULT Console::pause(Reason_T aReason)
     HRESULT hrc = S_OK;
     if (RT_FAILURE(vrc))
         hrc = setError(VBOX_E_VM_ERROR, tr("Could not suspend the machine execution (%Rrc)"), vrc);
-    else
+    else if (   aReason == Reason_HostSuspend
+             || aReason == Reason_HostBatteryLow)
     {
-        /* Unconfigure disk encryption from all attachments. */
-        clearDiskEncryptionKeysOnAllAttachments();
-
-        /* Clear any keys we have stored. */
-        for (SecretKeyMap::iterator it = m_mapSecretKeys.begin();
-            it != m_mapSecretKeys.end();
-            it++)
-            delete it->second;
-        m_mapSecretKeys.clear();
+        alock.acquire();
+        i_removeSecretKeysOnSuspend();
     }
 
     LogFlowThisFunc(("hrc=%Rhrc\n", hrc));
@@ -6298,20 +6252,13 @@ HRESULT Console::pause(Reason_T aReason)
  * Worker for Console::Resume and internal entry point for resuming a VM for
  * a specific reason.
  */
-HRESULT Console::resume(Reason_T aReason)
+HRESULT Console::i_resume(Reason_T aReason, AutoWriteLock &alock)
 {
     LogFlowThisFuncEnter();
 
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (mMachineState != MachineState_Paused)
-        return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Cannot resume the machine as it is not paused (machine state: %s)"),
-                        Global::stringifyMachineState(mMachineState));
-
     /* get the VM handle. */
     SafeVMPtr ptrVM(this);
     if (!ptrVM.isOk())
@@ -6322,13 +6269,13 @@ HRESULT Console::resume(Reason_T aReason)
 
     LogFlowThisFunc(("Sending RESUME request...\n"));
     if (aReason != Reason_Unspecified)
-        LogRel(("Resuming VM execution, reason \"%s\"\n", Global::stringifyReason(aReason)));
+        LogRel(("Resuming VM execution, reason '%s'\n", Global::stringifyReason(aReason)));
 
     int vrc;
     if (VMR3GetStateU(ptrVM.rawUVM()) == VMSTATE_CREATED)
     {
 #ifdef VBOX_WITH_EXTPACK
-        vrc = mptrExtPackManager->callAllVmPowerOnHooks(this, VMR3GetVM(ptrVM.rawUVM()));
+        vrc = mptrExtPackManager->i_callAllVmPowerOnHooks(this, VMR3GetVM(ptrVM.rawUVM()));
 #else
         vrc = VINF_SUCCESS;
 #endif
@@ -6339,8 +6286,25 @@ HRESULT Console::resume(Reason_T aReason)
     {
         VMRESUMEREASON enmReason = VMRESUMEREASON_USER;
         if (aReason == Reason_HostResume)
+        {
+            /*
+             * Host resume may be called multiple times successively. We don't want to VMR3Resume->vmR3Resume->vmR3TrySetState()
+             * to assert on us, hence check for the VM state here and bail if it's already in the 'running' state.
+             * See @bugref{3495}.
+             */
             enmReason = VMRESUMEREASON_HOST_RESUME;
+            if (VMR3GetStateU(ptrVM.rawUVM()) == VMSTATE_RUNNING)
+                return S_OK;
+        }
+        else if (aReason == Reason_Snapshot)
+            enmReason = VMRESUMEREASON_STATE_SAVED;
+
+        // for snapshots: no state change callback, VBoxSVC does everything
+        if (aReason == Reason_Snapshot)
+            mVMStateChangeCallbackDisabled = true;
         vrc = VMR3Resume(ptrVM.rawUVM(), enmReason);
+        if (aReason == Reason_Snapshot)
+            mVMStateChangeCallbackDisabled = false;
     }
 
     HRESULT rc = RT_SUCCESS(vrc) ? S_OK :
@@ -6354,14 +6318,22 @@ HRESULT Console::resume(Reason_T aReason)
 }
 
 /**
- * Worker for Console::SaveState and internal entry point for saving state of
- * a VM for a specific reason.
+ * Internal entry point for saving state of a VM for a specific reason. This
+ * method is completely synchronous.
+ *
+ * The machine state is already set appropriately. It is only changed when
+ * saving state actually paused the VM (happens with live snapshots and
+ * teleportation), and in this case reflects the now paused variant.
+ *
+ * @note Locks this object for writing.
  */
-HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress)
+HRESULT Console::i_saveState(Reason_T aReason, const ComPtr<IProgress> &aProgress, const Utf8Str &aStateFilePath, bool aPauseVM, bool &aLeftPaused)
 {
     LogFlowThisFuncEnter();
+    aLeftPaused = false;
 
-    CheckComArgOutPointerValid(aProgress);
+    AssertReturn(!aProgress.isNull(), E_INVALIDARG);
+    AssertReturn(!aStateFilePath.isEmpty(), E_INVALIDARG);
 
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -6369,13 +6341,17 @@ HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress)
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     LogFlowThisFunc(("mMachineState=%d\n", mMachineState));
-    if (   mMachineState != MachineState_Running
-        && mMachineState != MachineState_Paused)
+    if (   mMachineState != MachineState_Saving
+        && mMachineState != MachineState_LiveSnapshotting
+        && mMachineState != MachineState_OnlineSnapshotting
+        && mMachineState != MachineState_Teleporting
+        && mMachineState != MachineState_TeleportingPausedVM)
     {
         return setError(VBOX_E_INVALID_VM_STATE,
             tr("Cannot save the execution state as the machine is not running or paused (machine state: %s)"),
             Global::stringifyMachineState(mMachineState));
     }
+    bool fContinueAfterwards = mMachineState != MachineState_Saving;
 
     Bstr strDisableSaveState;
     mMachine->GetExtraData(Bstr("VBoxInternal2/DisableSaveState").raw(), strDisableSaveState.asOutParam());
@@ -6384,18 +6360,30 @@ HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress)
                         tr("Saving the execution state is disabled for this VM"));
 
     if (aReason != Reason_Unspecified)
-        LogRel(("Saving state of VM, reason \"%s\"\n", Global::stringifyReason(aReason)));
+        LogRel(("Saving state of VM, reason '%s'\n", Global::stringifyReason(aReason)));
 
-    /* memorize the current machine state */
-    MachineState_T lastMachineState = mMachineState;
-
-    if (mMachineState == MachineState_Running)
+    /* ensure the directory for the saved state file exists */
     {
-        /* get the VM handle. */
-        SafeVMPtr ptrVM(this);
-        if (!ptrVM.isOk())
-            return ptrVM.rc();
+        Utf8Str dir = aStateFilePath;
+        dir.stripFilename();
+        if (!RTDirExists(dir.c_str()))
+        {
+            int vrc = RTDirCreateFullPath(dir.c_str(), 0700);
+            if (RT_FAILURE(vrc))
+                return setError(VBOX_E_FILE_ERROR,
+                                tr("Could not create a directory '%s' to save the state to (%Rrc)"),
+                                dir.c_str(), vrc);
+        }
+    }
 
+    /* Get the VM handle early, we need it in several places. */
+    SafeVMPtr ptrVM(this);
+    if (!ptrVM.isOk())
+        return ptrVM.rc();
+
+    bool fPaused = false;
+    if (aPauseVM)
+    {
         /* release the lock before a VMR3* call (EMT might wait for it, @bugref{7648})! */
         alock.release();
         VMSUSPENDREASON enmReason = VMSUSPENDREASON_USER;
@@ -6406,123 +6394,84 @@ HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress)
         int vrc = VMR3Suspend(ptrVM.rawUVM(), enmReason);
         alock.acquire();
 
-        HRESULT hrc = S_OK;
         if (RT_FAILURE(vrc))
-            hrc = setError(VBOX_E_VM_ERROR, tr("Could not suspend the machine execution (%Rrc)"), vrc);
-        if (FAILED(hrc))
-            return hrc;
+            return setError(VBOX_E_VM_ERROR, tr("Could not suspend the machine execution (%Rrc)"), vrc);
+        fPaused = true;
     }
 
-    HRESULT rc = S_OK;
-    bool fBeganSavingState = false;
-    bool fTaskCreationFailed = false;
+    LogFlowFunc(("Saving the state to '%s'...\n", aStateFilePath.c_str()));
 
-    do
+    mptrCancelableProgress = aProgress;
+    alock.release();
+    int vrc = VMR3Save(ptrVM.rawUVM(),
+                       aStateFilePath.c_str(),
+                       fContinueAfterwards,
+                       Console::i_stateProgressCallback,
+                       static_cast<IProgress *>(aProgress),
+                       &aLeftPaused);
+    alock.acquire();
+    mptrCancelableProgress.setNull();
+    if (RT_FAILURE(vrc))
     {
-        ComPtr<IProgress> pProgress;
-        Bstr stateFilePath;
-
-        /*
-         * request a saved state file path from the server
-         * (this will set the machine state to Saving on the server to block
-         * others from accessing this machine)
-         */
-        rc = mControl->BeginSavingState(pProgress.asOutParam(),
-                                        stateFilePath.asOutParam());
-        if (FAILED(rc))
-            break;
-
-        fBeganSavingState = true;
-
-        /* sync the state with the server */
-        setMachineStateLocally(MachineState_Saving);
-
-        /* ensure the directory for the saved state file exists */
+        if (fPaused)
         {
-            Utf8Str dir = stateFilePath;
-            dir.stripFilename();
-            if (!RTDirExists(dir.c_str()))
-            {
-                int vrc = RTDirCreateFullPath(dir.c_str(), 0700);
-                if (RT_FAILURE(vrc))
-                {
-                    rc = setError(VBOX_E_FILE_ERROR,
-                        tr("Could not create a directory '%s' to save the state to (%Rrc)"),
-                        dir.c_str(), vrc);
-                    break;
-                }
-            }
+            alock.release();
+            VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_STATE_RESTORED);
+            alock.acquire();
         }
+        return setError(E_FAIL, tr("Failed to save the machine state to '%s' (%Rrc)"),
+                        aStateFilePath.c_str(), vrc);
+    }
+    Assert(fContinueAfterwards || !aLeftPaused);
 
-        /* Create a task object early to ensure mpUVM protection is successful. */
-        std::auto_ptr<VMSaveTask> task(new VMSaveTask(this, pProgress,
-                                                      stateFilePath,
-                                                      lastMachineState,
-                                                      aReason));
-        rc = task->rc();
+    if (!fContinueAfterwards)
+    {
         /*
-         * If we fail here it means a PowerDown() call happened on another
-         * thread while we were doing Pause() (which releases the Console lock).
-         * We assign PowerDown() a higher precedence than SaveState(),
-         * therefore just return the error to the caller.
+         * The machine has been successfully saved, so power it down
+         * (vmstateChangeCallback() will set state to Saved on success).
+         * Note: we release the VM caller, otherwise it will deadlock.
          */
-        if (FAILED(rc))
-        {
-            fTaskCreationFailed = true;
-            break;
-        }
+        ptrVM.release();
+        alock.release();
+        autoCaller.release();
+        HRESULT rc = i_powerDown();
+        AssertComRC(rc);
+        autoCaller.add();
+        alock.acquire();
+    }
+    else
+    {
+        if (fPaused)
+            aLeftPaused = true;
+    }
 
-        /* create a thread to wait until the VM state is saved */
-        int vrc = RTThreadCreate(NULL, Console::saveStateThread, (void *)task.get(),
-                                 0, RTTHREADTYPE_MAIN_WORKER, 0, "VMSave");
-        if (RT_FAILURE(vrc))
-        {
-            rc = setError(E_FAIL, "Could not create VMSave thread (%Rrc)", vrc);
-            break;
-        }
+    LogFlowFuncLeave();
+    return S_OK;
+}
 
-        /* task is now owned by saveStateThread(), so release it */
-        task.release();
+/**
+ * Internal entry point for cancelling a VM save state.
+ *
+ * @note Locks this object for writing.
+ */
+HRESULT Console::i_cancelSaveState()
+{
+    LogFlowThisFuncEnter();
 
-        /* return the progress to the caller */
-        pProgress.queryInterfaceTo(aProgress);
-    } while (0);
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    if (FAILED(rc) && !fTaskCreationFailed)
-    {
-        /* preserve existing error info */
-        ErrorInfoKeeper eik;
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        if (fBeganSavingState)
-        {
-            /*
-             * cancel the requested save state procedure.
-             * This will reset the machine state to the state it had right
-             * before calling mControl->BeginSavingState().
-             */
-            mControl->EndSavingState(eik.getResultCode(), eik.getText().raw());
-        }
+    /* Get the VM handle. */
+    SafeVMPtr ptrVM(this);
+    if (!ptrVM.isOk())
+        return ptrVM.rc();
 
-        if (lastMachineState == MachineState_Running)
-        {
-            /* restore the paused state if appropriate */
-            setMachineStateLocally(MachineState_Paused);
-            /* restore the running state if appropriate */
-            SafeVMPtr ptrVM(this);
-            if (ptrVM.isOk())
-            {
-                alock.release();
-                VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_STATE_RESTORED);
-                alock.acquire();
-            }
-        }
-        else
-            setMachineStateLocally(lastMachineState);
-    }
+    SSMR3Cancel(ptrVM.rawUVM());
 
-    LogFlowThisFunc(("rc=%Rhrc\n", rc));
-    LogFlowThisFuncLeave();
-    return rc;
+    LogFlowFuncLeave();
+    return S_OK;
 }
 
 /**
@@ -6533,7 +6482,7 @@ HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress)
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::updateMachineState(MachineState_T aMachineState)
+HRESULT Console::i_updateMachineState(MachineState_T aMachineState)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -6541,25 +6490,105 @@ HRESULT Console::updateMachineState(MachineState_T aMachineState)
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     AssertReturn(   mMachineState == MachineState_Saving
+                 || mMachineState == MachineState_OnlineSnapshotting
                  || mMachineState == MachineState_LiveSnapshotting
-                 || mMachineState == MachineState_RestoringSnapshot
-                 || mMachineState == MachineState_DeletingSnapshot
                  || mMachineState == MachineState_DeletingSnapshotOnline
                  || mMachineState == MachineState_DeletingSnapshotPaused
+                 || aMachineState == MachineState_Saving
+                 || aMachineState == MachineState_OnlineSnapshotting
+                 || aMachineState == MachineState_LiveSnapshotting
+                 || aMachineState == MachineState_DeletingSnapshotOnline
+                 || aMachineState == MachineState_DeletingSnapshotPaused
                  , E_FAIL);
 
-    return setMachineStateLocally(aMachineState);
+    return i_setMachineStateLocally(aMachineState);
 }
 
-#ifdef CONSOLE_WITH_EVENT_CACHE
 /**
- * @note Locks this object for writing.
+ * Gets called by Session::COMGETTER(NominalState)()
+ * (IInternalSessionControl::getNominalState()).
+ *
+ * @note Locks this object for reading.
  */
-#endif
-void Console::onMousePointerShapeChange(bool fVisible, bool fAlpha,
-                                        uint32_t xHot, uint32_t yHot,
-                                        uint32_t width, uint32_t height,
-                                        ComSafeArrayIn(BYTE,pShape))
+HRESULT Console::i_getNominalState(MachineState_T &aNominalState)
+{
+    LogFlowThisFuncEnter();
+
+    AutoCaller autoCaller(this);
+    AssertComRCReturnRC(autoCaller.rc());
+
+    /* Get the VM handle. */
+    SafeVMPtr ptrVM(this);
+    if (!ptrVM.isOk())
+        return ptrVM.rc();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    MachineState_T enmMachineState = MachineState_Null;
+    VMSTATE enmVMState = VMR3GetStateU(ptrVM.rawUVM());
+    switch (enmVMState)
+    {
+        case VMSTATE_CREATING:
+        case VMSTATE_CREATED:
+        case VMSTATE_POWERING_ON:
+            enmMachineState = MachineState_Starting;
+            break;
+        case VMSTATE_LOADING:
+            enmMachineState = MachineState_Restoring;
+            break;
+        case VMSTATE_RESUMING:
+        case VMSTATE_SUSPENDING:
+        case VMSTATE_SUSPENDING_LS:
+        case VMSTATE_SUSPENDING_EXT_LS:
+        case VMSTATE_SUSPENDED:
+        case VMSTATE_SUSPENDED_LS:
+        case VMSTATE_SUSPENDED_EXT_LS:
+            enmMachineState = MachineState_Paused;
+            break;
+        case VMSTATE_RUNNING:
+        case VMSTATE_RUNNING_LS:
+        case VMSTATE_RUNNING_FT:
+        case VMSTATE_RESETTING:
+        case VMSTATE_RESETTING_LS:
+        case VMSTATE_DEBUGGING:
+        case VMSTATE_DEBUGGING_LS:
+            enmMachineState = MachineState_Running;
+            break;
+        case VMSTATE_SAVING:
+            enmMachineState = MachineState_Saving;
+            break;
+        case VMSTATE_POWERING_OFF:
+        case VMSTATE_POWERING_OFF_LS:
+        case VMSTATE_DESTROYING:
+            enmMachineState = MachineState_Stopping;
+            break;
+        case VMSTATE_OFF:
+        case VMSTATE_OFF_LS:
+        case VMSTATE_FATAL_ERROR:
+        case VMSTATE_FATAL_ERROR_LS:
+        case VMSTATE_LOAD_FAILURE:
+        case VMSTATE_TERMINATED:
+            enmMachineState = MachineState_PoweredOff;
+            break;
+        case VMSTATE_GURU_MEDITATION:
+        case VMSTATE_GURU_MEDITATION_LS:
+            enmMachineState = MachineState_Stuck;
+            break;
+        default:
+            AssertMsgFailed(("%s\n", VMR3GetStateName(enmVMState)));
+            enmMachineState = MachineState_PoweredOff;
+    }
+    aNominalState = enmMachineState;
+
+    LogFlowFuncLeave();
+    return S_OK;
+}
+
+void Console::i_onMousePointerShapeChange(bool fVisible, bool fAlpha,
+                                          uint32_t xHot, uint32_t yHot,
+                                          uint32_t width, uint32_t height,
+                                          const uint8_t *pu8Shape,
+                                          uint32_t cbShape)
 {
 #if 0
     LogFlowThisFuncEnter();
@@ -6570,46 +6599,22 @@ void Console::onMousePointerShapeChange(bool fVisible, bool fAlpha,
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
 
-#ifdef CONSOLE_WITH_EVENT_CACHE
-    {
-        /* We need a write lock because we alter the cached callback data */
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-        /* Save the callback arguments */
-        mCallbackData.mpsc.visible = fVisible;
-        mCallbackData.mpsc.alpha = fAlpha;
-        mCallbackData.mpsc.xHot = xHot;
-        mCallbackData.mpsc.yHot = yHot;
-        mCallbackData.mpsc.width = width;
-        mCallbackData.mpsc.height = height;
-
-        /* start with not valid */
-        bool wasValid = mCallbackData.mpsc.valid;
-        mCallbackData.mpsc.valid = false;
-
-        com::SafeArray<BYTE> aShape(ComSafeArrayInArg(pShape));
-        if (aShape.size() != 0)
-            mCallbackData.mpsc.shape.initFrom(aShape);
-        else
-            mCallbackData.mpsc.shape.resize(0);
-        mCallbackData.mpsc.valid = true;
-    }
-#endif
+    if (!mMouse.isNull())
+       mMouse->updateMousePointerShape(fVisible, fAlpha, xHot, yHot, width, height,
+                                       pu8Shape, cbShape);
 
-    fireMousePointerShapeChangedEvent(mEventSource, fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayInArg(pShape));
+    com::SafeArray<BYTE> shape(cbShape);
+    if (pu8Shape)
+        memcpy(shape.raw(), pu8Shape, cbShape);
+    fireMousePointerShapeChangedEvent(mEventSource, fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayAsInParam(shape));
 
 #if 0
-    LogFlowThisFuncLeave();
-#endif
-}
-
-#ifdef CONSOLE_WITH_EVENT_CACHE
-/**
- * @note Locks this object for writing.
- */
+    LogFlowThisFuncLeave();
 #endif
-void Console::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
-                                      BOOL supportsMT, BOOL needsHostCursor)
+}
+
+void Console::i_onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
+                                        BOOL supportsMT, BOOL needsHostCursor)
 {
     LogFlowThisFunc(("supportsAbsolute=%d supportsRelative=%d needsHostCursor=%d\n",
                       supportsAbsolute, supportsRelative, needsHostCursor));
@@ -6617,30 +6622,17 @@ void Console::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelati
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
 
-#ifdef CONSOLE_WITH_EVENT_CACHE
-    {
-        /* We need a write lock because we alter the cached callback data */
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-        /* save the callback arguments */
-        mCallbackData.mcc.supportsAbsolute = supportsAbsolute;
-        mCallbackData.mcc.supportsRelative = supportsRelative;
-        mCallbackData.mcc.needsHostCursor = needsHostCursor;
-        mCallbackData.mcc.valid = true;
-    }
-#endif
-
     fireMouseCapabilityChangedEvent(mEventSource, supportsAbsolute, supportsRelative, supportsMT, needsHostCursor);
 }
 
-void Console::onStateChange(MachineState_T machineState)
+void Console::i_onStateChange(MachineState_T machineState)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
     fireStateChangedEvent(mEventSource, machineState);
 }
 
-void Console::onAdditionsStateChange()
+void Console::i_onAdditionsStateChange()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -6655,7 +6647,7 @@ void Console::onAdditionsStateChange()
  *          The user will be notified inside the guest if new Guest
  *          Additions are available (via VBoxTray/VBoxClient).
  */
-void Console::onAdditionsOutdated()
+void Console::i_onAdditionsOutdated()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -6663,34 +6655,16 @@ void Console::onAdditionsOutdated()
     /** @todo implement this */
 }
 
-#ifdef CONSOLE_WITH_EVENT_CACHE
-/**
- * @note Locks this object for writing.
- */
-#endif
-void Console::onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock)
+void Console::i_onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
 
-#ifdef CONSOLE_WITH_EVENT_CACHE
-    {
-        /* We need a write lock because we alter the cached callback data */
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-        /* save the callback arguments */
-        mCallbackData.klc.numLock = fNumLock;
-        mCallbackData.klc.capsLock = fCapsLock;
-        mCallbackData.klc.scrollLock = fScrollLock;
-        mCallbackData.klc.valid = true;
-    }
-#endif
-
     fireKeyboardLedsChangedEvent(mEventSource, fNumLock, fCapsLock, fScrollLock);
 }
 
-void Console::onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
-                                     IVirtualBoxErrorInfo *aError)
+void Console::i_onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
+                                       IVirtualBoxErrorInfo *aError)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -6698,7 +6672,7 @@ void Console::onUSBDeviceStateChange(IUSBDevice *aDevice, bool aAttached,
     fireUSBDeviceStateChangedEvent(mEventSource, aDevice, aAttached, aError);
 }
 
-void Console::onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage)
+void Console::i_onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -6706,7 +6680,7 @@ void Console::onRuntimeError(BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage)
     fireRuntimeErrorEvent(mEventSource, aFatal, aErrorID, aMessage);
 }
 
-HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId)
+HRESULT Console::i_onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId)
 {
     AssertReturn(aCanShow, E_POINTER);
     AssertReturn(aWinId, E_POINTER);
@@ -6732,8 +6706,10 @@ HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId)
             if (pCanShowEvent)
             {
                 BOOL fVetoed = FALSE;
+                BOOL fApproved = FALSE;
                 pCanShowEvent->IsVetoed(&fVetoed);
-                *aCanShow = !fVetoed;
+                pCanShowEvent->IsApproved(&fApproved);
+                *aCanShow = fApproved || !fVetoed;
             }
             else
             {
@@ -6797,8 +6773,8 @@ HRESULT Console::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId)
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::addVMCaller(bool aQuiet /* = false */,
-                             bool aAllowNullVM /* = false */)
+HRESULT Console::i_addVMCaller(bool aQuiet /* = false */,
+                               bool aAllowNullVM /* = false */)
 {
     AutoCaller autoCaller(this);
     /** @todo Fix race during console/VM reference destruction, refer @bugref{6318}
@@ -6837,7 +6813,7 @@ HRESULT Console::addVMCaller(bool aQuiet /* = false */,
  *
  * @note Locks this object for writing.
  */
-void Console::releaseVMCaller()
+void Console::i_releaseVMCaller()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -6857,7 +6833,7 @@ void Console::releaseVMCaller()
 }
 
 
-HRESULT Console::safeVMPtrRetainer(PUVM *a_ppUVM, bool a_Quiet)
+HRESULT Console::i_safeVMPtrRetainer(PUVM *a_ppUVM, bool a_Quiet)
 {
     *a_ppUVM = NULL;
 
@@ -6892,7 +6868,7 @@ HRESULT Console::safeVMPtrRetainer(PUVM *a_ppUVM, bool a_Quiet)
     return S_OK;
 }
 
-void Console::safeVMPtrReleaser(PUVM *a_ppUVM)
+void Console::i_safeVMPtrReleaser(PUVM *a_ppUVM)
 {
     if (*a_ppUVM)
         VMR3ReleaseUVM(*a_ppUVM);
@@ -6906,7 +6882,7 @@ void Console::safeVMPtrReleaser(PUVM *a_ppUVM)
  * we can add some logic to use different file names in this case.
  * Note that the logic must be in sync with Machine::DeleteSettings().
  */
-HRESULT Console::consoleInitReleaseLog(const ComPtr<IMachine> aMachine)
+HRESULT Console::i_consoleInitReleaseLog(const ComPtr<IMachine> aMachine)
 {
     HRESULT hrc = S_OK;
 
@@ -6993,7 +6969,7 @@ HRESULT Console::consoleInitReleaseLog(const ComPtr<IMachine> aMachine)
  * @param   aProgress       Where to return the progress object.
  * @param   aPaused         true if PowerUpPaused called.
  */
-HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
+HRESULT Console::i_powerUp(IProgress **aProgress, bool aPaused)
 {
 
     LogFlowThisFuncEnter();
@@ -7015,7 +6991,6 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
 
     try
     {
-
         if (Global::IsOnlineOrTransient(mMachineState))
             throw setError(VBOX_E_INVALID_VM_STATE,
                 tr("The virtual machine is already running or busy (machine state: %s)"),
@@ -7023,10 +6998,14 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
 
         /* Set up release logging as early as possible after the check if
          * there is already a running VM which we shouldn't disturb. */
-        rc = consoleInitReleaseLog(mMachine);
+        rc = i_consoleInitReleaseLog(mMachine);
         if (FAILED(rc))
             throw rc;
 
+#ifdef VBOX_OPENSSL_FIPS
+        LogRel(("crypto: FIPS mode %s\n", FIPS_mode() ? "enabled" : "FAILED"));
+#endif
+
         /* test and clear the TeleporterEnabled property  */
         BOOL fTeleporterEnabled;
         rc = mMachine->COMGETTER(TeleporterEnabled)(&fTeleporterEnabled);
@@ -7085,7 +7064,7 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
         /* Read console data, including console shared folders, stored in the
          * saved state file (if not yet done).
          */
-        rc = loadDataFromSavedState();
+        rc = i_loadDataFromSavedState();
         if (FAILED(rc))
             throw rc;
 
@@ -7118,18 +7097,18 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
                 SharedFolder *pSF = it->second;
                 AutoCaller sfCaller(pSF);
                 AutoReadLock sfLock(pSF COMMA_LOCKVAL_SRC_POS);
-                sharedFolders[it->first] = SharedFolderData(pSF->getHostPath(),
-                                                            pSF->isWritable(),
-                                                            pSF->isAutoMounted());
+                sharedFolders[it->first] = SharedFolderData(pSF->i_getHostPath(),
+                                                            pSF->i_isWritable(),
+                                                            pSF->i_isAutoMounted());
             }
         }
 
-        /* Setup task object and thread to carry out the operaton
-         * Asycnhronously */
+        /* Setup task object and thread to carry out the operation
+         * asynchronously */
         std::auto_ptr<VMPowerUpTask> task(new VMPowerUpTask(this, pPowerupProgress));
         ComAssertComRCRetRC(task->rc());
 
-        task->mConfigConstructor = configConstructor;
+        task->mConfigConstructor = i_configConstructor;
         task->mSharedFolders = sharedFolders;
         task->mStartPaused = aPaused;
         if (mMachineState == MachineState_Saved)
@@ -7207,7 +7186,7 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
          * asynchronously */
 
 #ifdef VBOX_WITH_EXTPACK
-        mptrExtPackManager->dumpAllToReleaseLog();
+        mptrExtPackManager->i_dumpAllToReleaseLog();
 #endif
 
 #ifdef RT_OS_SOLARIS
@@ -7245,7 +7224,8 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
                  */
                 vrc = RTDirCreateFullPath(pszDumpDir, 0700);
                 if (RT_FAILURE(vrc))
-                    throw setError(E_FAIL, "Failed to setup CoreDumper. Couldn't create dump directory '%s' (%Rrc)\n", pszDumpDir, vrc);
+                    throw setError(E_FAIL, "Failed to setup CoreDumper. Couldn't create dump directory '%s' (%Rrc)\n",
+                                   pszDumpDir, vrc);
             }
 
             vrc = RTCoreDumperSetup(pszDumpDir, fCoreFlags);
@@ -7272,8 +7252,7 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
                                         cOperations,
                                         ulTotalOperationsWeight,
                                         Bstr(tr("Starting Hard Disk operations")).raw(),
-                                        1,
-                                        NULL);
+                                        1);
             AssertComRCReturnRC(rc);
         }
         else if (    mMachineState == MachineState_Saved
@@ -7291,8 +7270,7 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
                                         3    /* cOperations */,
                                         10   /* ulTotalOperationsWeight */,
                                         Bstr(tr("Teleporting virtual machine")).raw(),
-                                        1    /* ulFirstOperationWeight */,
-                                        NULL);
+                                        1    /* ulFirstOperationWeight */);
         }
         else if (fFaultToleranceSyncEnabled)
         {
@@ -7302,8 +7280,7 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
                                         3    /* cOperations */,
                                         10   /* ulTotalOperationsWeight */,
                                         Bstr(tr("Fault Tolerance syncing of remote virtual machine")).raw(),
-                                        1    /* ulFirstOperationWeight */,
-                                        NULL);
+                                        1    /* ulFirstOperationWeight */);
         }
 
         if (FAILED(rc))
@@ -7394,7 +7371,7 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
                 AssertComRCReturnRC(rc);
         }
 
-        int vrc = RTThreadCreate(NULL, Console::powerUpThread,
+        int vrc = RTThreadCreate(NULL, Console::i_powerUpThread,
                                  (void *)task.get(), 0,
                                  RTTHREADTYPE_MAIN_WORKER, 0, "VMPwrUp");
         if (RT_FAILURE(vrc))
@@ -7407,13 +7384,13 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
          * since we've already started the thread and it is now responsible for
          * any error reporting and appropriate state change! */
         if (mMachineState == MachineState_Saved)
-            setMachineState(MachineState_Restoring);
+            i_setMachineState(MachineState_Restoring);
         else if (fTeleporterEnabled)
-           setMachineState(MachineState_TeleportingIn);
+            i_setMachineState(MachineState_TeleportingIn);
         else if (enmFaultToleranceState == FaultToleranceState_Standby)
-            setMachineState(MachineState_FaultTolerantSyncing);
+            i_setMachineState(MachineState_FaultTolerantSyncing);
         else
-            setMachineState(MachineState_Starting);
+            i_setMachineState(MachineState_Starting);
     }
     catch (HRESULT aRC) { rc = aRC; }
 
@@ -7422,7 +7399,7 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
 
         /* The progress object will fetch the current error info */
         if (!pPowerupProgress.isNull())
-            pPowerupProgress->notifyComplete(rc);
+            pPowerupProgress->i_notifyComplete(rc);
 
         /* Save the error info across the IPC below. Can't be done before the
          * progress notification above, as saving the error info deletes it
@@ -7467,7 +7444,7 @@ HRESULT Console::powerUp(IProgress **aProgress, bool aPaused)
  *       instantiated an AutoVMCaller object; first call releaseVMCaller() or
  *       release(). Otherwise it will deadlock.
  */
-HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/)
+HRESULT Console::i_powerDown(IProgress *aProgress /*= NULL*/)
 {
     LogFlowThisFuncEnter();
 
@@ -7504,7 +7481,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/)
               , ("Invalid machine state: %s\n", Global::stringifyMachineState(mMachineState)));
 
     LogRel(("Console::powerDown(): A request to power off the VM has been issued (mMachineState=%s, InUninit=%d)\n",
-            Global::stringifyMachineState(mMachineState), autoCaller.state() == InUninit));
+            Global::stringifyMachineState(mMachineState), getObjectState().getState() == ObjectState::InUninit));
 
     /* Check if we need to power off the VM. In case of mVMPoweredOff=true, the
      * VM has already powered itself off in vmstateChangeCallback() and is just
@@ -7535,21 +7512,29 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/)
         && mMachineState != MachineState_TeleportingPausedVM
         && mMachineState != MachineState_FaultTolerantSyncing
        )
-        setMachineState(MachineState_Stopping);
+        i_setMachineState(MachineState_Stopping);
 
     /* ----------------------------------------------------------------------
      * DONE with necessary state changes, perform the power down actions (it's
      * safe to release the object lock now if needed)
      * ---------------------------------------------------------------------- */
 
+    if (mDisplay)
+    {
+        alock.release();
+
+        mDisplay->i_notifyPowerDown();
+
+        alock.acquire();
+    }
+
     /* Stop the VRDP server to prevent new clients connection while VM is being
      * powered off. */
     if (mConsoleVRDPServer)
     {
         LogFlowThisFunc(("Stopping VRDP server...\n"));
 
-        /* Leave the lock since EMT will call us back as addVMCaller()
-         * in updateDisplayData(). */
+        /* Leave the lock since EMT could call us back as addVMCaller() */
         alock.release();
 
         mConsoleVRDPServer->Stop();
@@ -7606,7 +7591,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/)
         alock.release();
         vrc = VMR3PowerOff(pUVM);
 #ifdef VBOX_WITH_EXTPACK
-        mptrExtPackManager->callAllVmPowerOffHooks(this, VMR3GetVM(pUVM));
+        mptrExtPackManager->i_callAllVmPowerOffHooks(this, VMR3GetVM(pUVM));
 #endif
         alock.acquire();
     }
@@ -7639,14 +7624,14 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/)
 
     /* If we are called from Console::uninit(), then try to destroy the VM even
      * on failure (this will most likely fail too, but what to do?..) */
-    if (RT_SUCCESS(vrc) || autoCaller.state() == InUninit)
+    if (RT_SUCCESS(vrc) || getObjectState().getState() == ObjectState::InUninit)
     {
         /* If the machine has a USB controller, release all USB devices
          * (symmetric to the code in captureUSBDevices()) */
         if (mfVMHasUsbController)
         {
             alock.release();
-            detachAllUSBDevices(false /* aDone */);
+            i_detachAllUSBDevices(false /* aDone */);
             alock.acquire();
         }
 
@@ -7701,7 +7686,7 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/)
         if (mfVMHasUsbController)
         {
             alock.release();
-            detachAllUSBDevices(true /* aDone */);
+            i_detachAllUSBDevices(true /* aDone */);
             alock.acquire();
         }
 
@@ -7729,11 +7714,6 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/)
     else
         mVMDestroying = false;
 
-#ifdef CONSOLE_WITH_EVENT_CACHE
-    if (SUCCEEDED(rc))
-        mCallbackData.clear();
-#endif
-
     LogFlowThisFuncLeave();
     return rc;
 }
@@ -7741,8 +7721,8 @@ HRESULT Console::powerDown(IProgress *aProgress /*= NULL*/)
 /**
  * @note Locks this object for writing.
  */
-HRESULT Console::setMachineState(MachineState_T aMachineState,
-                                 bool aUpdateServer /* = true */)
+HRESULT Console::i_setMachineState(MachineState_T aMachineState,
+                                   bool aUpdateServer /* = true */)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -7755,6 +7735,7 @@ HRESULT Console::setMachineState(MachineState_T aMachineState,
     {
         LogThisFunc(("machineState=%s -> %s aUpdateServer=%RTbool\n",
                      Global::stringifyMachineState(mMachineState), Global::stringifyMachineState(aMachineState), aUpdateServer));
+        LogRel(("Console: Machine state changed to '%s'\n", Global::stringifyMachineState(aMachineState)));
         mMachineState = aMachineState;
 
         /// @todo (dmik)
@@ -7765,7 +7746,7 @@ HRESULT Console::setMachineState(MachineState_T aMachineState,
         //      ability to synchronously react to state changes (is it really
         //      necessary??)
         LogFlowThisFunc(("Doing onStateChange()...\n"));
-        onStateChange(aMachineState);
+        i_onStateChange(aMachineState);
         LogFlowThisFunc(("Done onStateChange()\n"));
 
         if (aUpdateServer)
@@ -7805,9 +7786,9 @@ HRESULT Console::setMachineState(MachineState_T aMachineState,
  *
  * @note The caller must lock this object for writing.
  */
-HRESULT Console::findSharedFolder(const Utf8Str &strName,
-                                  ComObjPtr<SharedFolder> &aSharedFolder,
-                                  bool aSetError /* = false */)
+HRESULT Console::i_findSharedFolder(const Utf8Str &strName,
+                                    ComObjPtr<SharedFolder> &aSharedFolder,
+                                    bool aSetError /* = false */)
 {
     /* sanity check */
     AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
@@ -7834,11 +7815,11 @@ HRESULT Console::findSharedFolder(const Utf8Str &strName,
  *
  * @note The caller must lock this object for writing.
  */
-HRESULT Console::fetchSharedFolders(BOOL aGlobal)
+HRESULT Console::i_fetchSharedFolders(BOOL aGlobal)
 {
     /* sanity check */
-    AssertReturn(AutoCaller(this).state() == InInit ||
-                 isWriteLockOnCurrentThread(), E_FAIL);
+    AssertReturn(   getObjectState().getState() == ObjectState::InInit
+                 || isWriteLockOnCurrentThread(), E_FAIL);
 
     LogFlowThisFunc(("Entering\n"));
 
@@ -7914,13 +7895,13 @@ HRESULT Console::fetchSharedFolders(BOOL aGlobal)
                                  || m_mapGlobalSharedFolders.find(strName) != m_mapGlobalSharedFolders.end()
                                )
                             {
-                                rc = removeSharedFolder(strName);
+                                rc = i_removeSharedFolder(strName);
                                 if (FAILED(rc)) throw rc;
                             }
 
                             /* create the new machine folder */
-                            rc = createSharedFolder(strName,
-                                                    SharedFolderData(strHostPath, !!writable, !!autoMount));
+                            rc = i_createSharedFolder(strName,
+                                                      SharedFolderData(strHostPath, !!writable, !!autoMount));
                             if (FAILED(rc)) throw rc;
                         }
                     }
@@ -7941,7 +7922,7 @@ HRESULT Console::fetchSharedFolders(BOOL aGlobal)
                     else
                     {
                         /* remove the outdated machine folder */
-                        rc = removeSharedFolder(it->first);
+                        rc = i_removeSharedFolder(it->first);
                         if (FAILED(rc)) throw rc;
 
                         /* create the global folder if there is any */
@@ -7949,7 +7930,7 @@ HRESULT Console::fetchSharedFolders(BOOL aGlobal)
                             m_mapGlobalSharedFolders.find(it->first);
                         if (git != m_mapGlobalSharedFolders.end())
                         {
-                            rc = createSharedFolder(git->first, git->second);
+                            rc = i_createSharedFolder(git->first, git->second);
                             if (FAILED(rc)) throw rc;
                         }
                     }
@@ -7961,8 +7942,8 @@ HRESULT Console::fetchSharedFolders(BOOL aGlobal)
     {
         rc = rc2;
         if (online)
-            setVMRuntimeErrorCallbackF(0, "BrokenSharedFolder",
-                                       N_("Broken shared folder!"));
+            i_setVMRuntimeErrorCallbackF(0, "BrokenSharedFolder",
+                                         N_("Broken shared folder!"));
     }
 
     LogFlowThisFunc(("Leaving\n"));
@@ -7980,7 +7961,7 @@ HRESULT Console::fetchSharedFolders(BOOL aGlobal)
  *
  * @note The caller must lock this object for reading.
  */
-bool Console::findOtherSharedFolder(const Utf8Str &strName,
+bool Console::i_findOtherSharedFolder(const Utf8Str &strName,
                                     SharedFolderDataMap::const_iterator &aIt)
 {
     /* sanity check */
@@ -8008,7 +7989,7 @@ bool Console::findOtherSharedFolder(const Utf8Str &strName,
  * @note Must be called from under AutoVMCaller and when mpUVM != NULL!
  * @note Doesn't lock anything.
  */
-HRESULT Console::createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData)
+HRESULT Console::i_createSharedFolder(const Utf8Str &strName, const SharedFolderData &aData)
 {
     ComAssertRet(strName.isNotEmpty(), E_FAIL);
     ComAssertRet(aData.m_strHostPath.isNotEmpty(), E_FAIL);
@@ -8120,7 +8101,7 @@ HRESULT Console::createSharedFolder(const Utf8Str &strName, const SharedFolderDa
  * @note Must be called from under AutoVMCaller and when mpUVM != NULL!
  * @note Doesn't lock anything.
  */
-HRESULT Console::removeSharedFolder(const Utf8Str &strName)
+HRESULT Console::i_removeSharedFolder(const Utf8Str &strName)
 {
     ComAssertRet(strName.isNotEmpty(), E_FAIL);
 
@@ -8167,7 +8148,7 @@ HRESULT Console::removeSharedFolder(const Utf8Str &strName)
  * @remarks The @a pUVM parameter can be NULL in one case where powerUpThread()
  *          calls after the VM was destroyed.
  */
-DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser)
+DECLCALLBACK(void) Console::i_vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser)
 {
     LogFlowFunc(("Changing state from %s to %s (pUVM=%p)\n",
                  VMR3GetStateName(enmOldState), VMR3GetStateName(enmState),     pUVM));
@@ -8182,7 +8163,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
      * 1) powerDown() called from uninit() itself, or
      * 2) VM-(guest-)initiated power off. */
     AssertReturnVoid(   autoCaller.isOk()
-                     || autoCaller.state() == InUninit);
+                     || that->getObjectState().getState() == ObjectState::InUninit);
 
     switch (enmState)
     {
@@ -8192,7 +8173,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
         case VMSTATE_OFF:
         {
 #ifdef VBOX_WITH_GUEST_PROPS
-            if (that->isResetTurnedIntoPowerOff())
+            if (that->i_isResetTurnedIntoPowerOff())
             {
                 Bstr strPowerOffReason;
 
@@ -8245,7 +8226,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
                 AssertComRC(rc);
 
                 /* sync the state with the server */
-                that->setMachineStateLocally(MachineState_Stopping);
+                that->i_setMachineStateLocally(MachineState_Stopping);
 
                 /* Setup task object and thread to carry out the operation
                  * asynchronously (if we call powerDown() right here but there
@@ -8266,7 +8247,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
                     return;
                 }
 
-                int vrc = RTThreadCreate(NULL, Console::powerDownThread,
+                int vrc = RTThreadCreate(NULL, Console::i_powerDownThread,
                                          (void *)task.get(), 0,
                                          RTTHREADTYPE_MAIN_WORKER, 0,
                                          "VMPwrDwn");
@@ -8298,7 +8279,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
              * networking.
              */
             if (pUVM)
-                that->powerDownHostInterfaces();
+                that->i_powerDownHostInterfaces();
 
             /* From now on the machine is officially powered down or remains in
              * the Saved state.
@@ -8310,33 +8291,33 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
                     /* fall through */
                 case MachineState_Stopping:
                     /* successfully powered down */
-                    that->setMachineState(MachineState_PoweredOff);
+                    that->i_setMachineState(MachineState_PoweredOff);
                     break;
                 case MachineState_Saving:
                     /* successfully saved */
-                    that->setMachineState(MachineState_Saved);
+                    that->i_setMachineState(MachineState_Saved);
                     break;
                 case MachineState_Starting:
                     /* failed to start, but be patient: set back to PoweredOff
                      * (for similarity with the below) */
-                    that->setMachineState(MachineState_PoweredOff);
+                    that->i_setMachineState(MachineState_PoweredOff);
                     break;
                 case MachineState_Restoring:
                     /* failed to load the saved state file, but be patient: set
                      * back to Saved (to preserve the saved state file) */
-                    that->setMachineState(MachineState_Saved);
+                    that->i_setMachineState(MachineState_Saved);
                     break;
                 case MachineState_TeleportingIn:
                     /* Teleportation failed or was canceled.  Back to powered off. */
-                    that->setMachineState(MachineState_PoweredOff);
+                    that->i_setMachineState(MachineState_PoweredOff);
                     break;
                 case MachineState_TeleportingPausedVM:
                     /* Successfully teleported the VM. */
-                    that->setMachineState(MachineState_Teleported);
+                    that->i_setMachineState(MachineState_Teleported);
                     break;
                 case MachineState_FaultTolerantSyncing:
                     /* Fault tolerant sync failed or was canceled.  Back to powered off. */
-                    that->setMachineState(MachineState_PoweredOff);
+                    that->i_setMachineState(MachineState_PoweredOff);
                     break;
             }
             break;
@@ -8346,7 +8327,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
         {
 #ifdef VBOX_WITH_GUEST_PROPS
             /* Do not take any read/write locks here! */
-            that->guestPropertiesHandleVMReset();
+            that->i_guestPropertiesHandleVMReset();
 #endif
             break;
         }
@@ -8361,11 +8342,11 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
             switch (that->mMachineState)
             {
                 case MachineState_Teleporting:
-                    that->setMachineState(MachineState_TeleportingPausedVM);
+                    that->i_setMachineState(MachineState_TeleportingPausedVM);
                     break;
 
                 case MachineState_LiveSnapshotting:
-                    that->setMachineState(MachineState_Saving);
+                    that->i_setMachineState(MachineState_OnlineSnapshotting);
                     break;
 
                 case MachineState_TeleportingPausedVM:
@@ -8374,18 +8355,20 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
                 case MachineState_Stopping:
                 case MachineState_TeleportingIn:
                 case MachineState_FaultTolerantSyncing:
+                case MachineState_OnlineSnapshotting:
                     /* The worker thread handles the transition. */
                     break;
 
-                default:
-                    AssertMsgFailed(("%s\n", Global::stringifyMachineState(that->mMachineState)));
                 case MachineState_Running:
-                    that->setMachineState(MachineState_Paused);
+                    that->i_setMachineState(MachineState_Paused);
                     break;
 
                 case MachineState_Paused:
                     /* Nothing to do. */
                     break;
+
+                default:
+                    AssertMsgFailed(("%s\n", Global::stringifyMachineState(that->mMachineState)));
             }
             break;
         }
@@ -8399,11 +8382,11 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
             switch (that->mMachineState)
             {
                 case MachineState_Teleporting:
-                    that->setMachineState(MachineState_TeleportingPausedVM);
+                    that->i_setMachineState(MachineState_TeleportingPausedVM);
                     break;
 
                 case MachineState_LiveSnapshotting:
-                    that->setMachineState(MachineState_Saving);
+                    that->i_setMachineState(MachineState_OnlineSnapshotting);
                     break;
 
                 case MachineState_TeleportingPausedVM:
@@ -8412,8 +8395,9 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
                     break;
 
                 default:
-                    AssertMsgFailed(("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(enmOldState),  VMR3GetStateName(enmState) ));
-                    that->setMachineState(MachineState_Paused);
+                    AssertMsgFailed(("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState),
+                                    VMR3GetStateName(enmOldState), VMR3GetStateName(enmState) ));
+                    that->i_setMachineState(MachineState_Paused);
                     break;
             }
             break;
@@ -8442,7 +8426,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
                        || (   that->mMachineState == MachineState_FaultTolerantSyncing
                            && enmOldState == VMSTATE_RUNNING_FT));
 
-                that->setMachineState(MachineState_Running);
+                that->i_setMachineState(MachineState_Running);
             }
 
             break;
@@ -8451,12 +8435,14 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
         case VMSTATE_RUNNING_LS:
             AssertMsg(   that->mMachineState == MachineState_LiveSnapshotting
                       || that->mMachineState == MachineState_Teleporting,
-                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(enmOldState),  VMR3GetStateName(enmState) ));
+                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState),
+                      VMR3GetStateName(enmOldState), VMR3GetStateName(enmState) ));
             break;
 
         case VMSTATE_RUNNING_FT:
             AssertMsg(that->mMachineState == MachineState_FaultTolerantSyncing,
-                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), VMR3GetStateName(enmOldState),  VMR3GetStateName(enmState) ));
+                      ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState),
+                      VMR3GetStateName(enmOldState), VMR3GetStateName(enmState) ));
             break;
 
         case VMSTATE_FATAL_ERROR:
@@ -8473,7 +8459,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
              *       are currently only two places where fatal errors might be
              *       raised, so it is not worth adding a new externally
              *       visible state for this yet.  */
-            that->setMachineState(MachineState_Paused);
+            that->i_setMachineState(MachineState_Paused);
             break;
         }
 
@@ -8487,17 +8473,17 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
             /* Guru are only for running VMs */
             Assert(Global::IsOnline(that->mMachineState));
 
-            that->setMachineState(MachineState_Stuck);
+            that->i_setMachineState(MachineState_Stuck);
             break;
         }
 
-        case VMSTATE_POWERING_ON:
+        case VMSTATE_CREATED:
         {
             /*
              * We have to set the secret key helper interface for the VD drivers to
              * get notified about missing keys.
              */
-            that->clearDiskEncryptionKeysOnAllAttachments();
+            that->i_initSecretKeyIfOnAllAttachments();
             break;
         }
 
@@ -8511,7 +8497,7 @@ DECLCALLBACK(void) Console::vmstateChangeCallback(PUVM pUVM, VMSTATE enmState, V
  *
  * @param aClipboardMode  new clipboard mode.
  */
-void Console::changeClipboardMode(ClipboardMode_T aClipboardMode)
+void Console::i_changeClipboardMode(ClipboardMode_T aClipboardMode)
 {
     VMMDev *pVMMDev = m_pVMMDev;
     Assert(pVMMDev);
@@ -8544,40 +8530,44 @@ void Console::changeClipboardMode(ClipboardMode_T aClipboardMode)
 }
 
 /**
- * Changes the drag'n_drop mode.
+ * Changes the drag and drop mode.
  *
- * @param aDragAndDropMode  new drag'n'drop mode.
+ * @param aDnDMode  new drag and drop mode.
  */
-void Console::changeDragAndDropMode(DragAndDropMode_T aDragAndDropMode)
+int Console::i_changeDnDMode(DnDMode_T aDnDMode)
 {
     VMMDev *pVMMDev = m_pVMMDev;
-    Assert(pVMMDev);
+    AssertPtrReturn(pVMMDev, VERR_INVALID_POINTER);
 
     VBOXHGCMSVCPARM parm;
+    RT_ZERO(parm);
     parm.type = VBOX_HGCM_SVC_PARM_32BIT;
 
-    switch (aDragAndDropMode)
+    switch (aDnDMode)
     {
         default:
-        case DragAndDropMode_Disabled:
-            LogRel(("Drag'n'drop mode: Off\n"));
+        case DnDMode_Disabled:
+            LogRel(("Changed drag and drop mode to: Off\n"));
             parm.u.uint32 = VBOX_DRAG_AND_DROP_MODE_OFF;
             break;
-        case DragAndDropMode_GuestToHost:
-            LogRel(("Drag'n'drop mode: Guest to Host\n"));
+        case DnDMode_GuestToHost:
+            LogRel(("Changed drag and drop mode to: Guest to Host\n"));
             parm.u.uint32 = VBOX_DRAG_AND_DROP_MODE_GUEST_TO_HOST;
             break;
-        case DragAndDropMode_HostToGuest:
-            LogRel(("Drag'n'drop mode: Host to Guest\n"));
+        case DnDMode_HostToGuest:
+            LogRel(("Changed drag and drop mode to: Host to Guest\n"));
             parm.u.uint32 = VBOX_DRAG_AND_DROP_MODE_HOST_TO_GUEST;
             break;
-        case DragAndDropMode_Bidirectional:
-            LogRel(("Drag'n'drop mode: Bidirectional\n"));
+        case DnDMode_Bidirectional:
+            LogRel(("Changed drag and drop mode to: Bidirectional\n"));
             parm.u.uint32 = VBOX_DRAG_AND_DROP_MODE_BIDIRECTIONAL;
             break;
     }
 
-    pVMMDev->hgcmHostCall("VBoxDragAndDropSvc", DragAndDropSvc::HOST_DND_SET_MODE, 1, &parm);
+    int rc = pVMMDev->hgcmHostCall("VBoxDragAndDropSvc",
+                                   DragAndDropSvc::HOST_DND_SET_MODE, 1, &parm);
+    LogFlowFunc(("rc=%Rrc\n", rc));
+    return rc;
 }
 
 #ifdef VBOX_WITH_USB
@@ -8590,7 +8580,8 @@ void Console::changeDragAndDropMode(DragAndDropMode_T aDragAndDropMode)
  *
  * @note Synchronously calls EMT.
  */
-HRESULT Console::attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs)
+HRESULT Console::i_attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs,
+                                   const Utf8Str &aCaptureFilename)
 {
     AssertReturn(aHostDevice, E_FAIL);
     AssertReturn(!isWriteLockOnCurrentThread(), E_FAIL);
@@ -8628,20 +8619,21 @@ HRESULT Console::attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs)
     if (fRemote)
     {
         RemoteUSBDevice *pRemoteUSBDevice = static_cast<RemoteUSBDevice *>(aHostDevice);
-        pvRemoteBackend = consoleVRDPServer()->USBBackendRequestPointer(pRemoteUSBDevice->clientId(), &uuid);
+        pvRemoteBackend = i_consoleVRDPServer()->USBBackendRequestPointer(pRemoteUSBDevice->clientId(), &uuid);
         if (!pvRemoteBackend)
             return E_INVALIDARG; /* The clientId is invalid then. */
     }
 
-    USHORT portVersion = 1;
+    USHORT portVersion = 0;
     hrc = aHostDevice->COMGETTER(PortVersion)(&portVersion);
     AssertComRCReturnRC(hrc);
-    Assert(portVersion == 1 || portVersion == 2);
+    Assert(portVersion == 1 || portVersion == 2 || portVersion == 3);
 
     int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */,
-                               (PFNRT)usbAttachCallback, 9,
+                               (PFNRT)i_usbAttachCallback, 10,
                                this, ptrVM.rawUVM(), aHostDevice, uuid.raw(), fRemote,
-                               Address.c_str(), pvRemoteBackend, portVersion, aMaskedIfs);
+                               Address.c_str(), pvRemoteBackend, portVersion, aMaskedIfs,
+                               aCaptureFilename.isEmpty() ? NULL : aCaptureFilename.c_str());
     if (RT_SUCCESS(vrc))
     {
         /* Create a OUSBDevice and add it to the device list */
@@ -8652,11 +8644,11 @@ HRESULT Console::attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs)
 
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
         mUSBDevices.push_back(pUSBDevice);
-        LogFlowFunc(("Attached device {%RTuuid}\n", pUSBDevice->id().raw()));
+        LogFlowFunc(("Attached device {%RTuuid}\n", pUSBDevice->i_id().raw()));
 
         /* notify callbacks */
         alock.release();
-        onUSBDeviceStateChange(pUSBDevice, true /* aAttached */, NULL);
+        i_onUSBDeviceStateChange(pUSBDevice, true /* aAttached */, NULL);
     }
     else
     {
@@ -8691,8 +8683,9 @@ HRESULT Console::attachUSBDevice(IUSBDevice *aHostDevice, ULONG aMaskedIfs)
  */
 //static
 DECLCALLBACK(int)
-Console::usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote,
-                           const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs)
+Console::i_usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote,
+                             const char *aAddress, void *pvRemoteBackend, USHORT aPortVersion, ULONG aMaskedIfs,
+                             const char *pszCaptureFilename)
 {
     LogFlowFuncEnter();
     LogFlowFunc(("that={%p} aUuid={%RTuuid}\n", that, aUuid));
@@ -8701,7 +8694,9 @@ Console::usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PC
     AssertReturn(!that->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     int vrc = PDMR3UsbCreateProxyDevice(pUVM, aUuid, aRemote, aAddress, pvRemoteBackend,
-                                        aPortVersion == 1 ? VUSB_STDVER_11 : VUSB_STDVER_20, aMaskedIfs);
+                                        aPortVersion == 3 ? VUSB_STDVER_30 :
+                                        aPortVersion == 2 ? VUSB_STDVER_20 : VUSB_STDVER_11,
+                                        aMaskedIfs, pszCaptureFilename);
     LogFlowFunc(("vrc=%Rrc\n", vrc));
     LogFlowFuncLeave();
     return vrc;
@@ -8716,7 +8711,7 @@ Console::usbAttachCallback(Console *that, PUVM pUVM, IUSBDevice *aHostDevice, PC
  *
  * @note Synchronously calls EMT.
  */
-HRESULT Console::detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice)
+HRESULT Console::i_detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice)
 {
     AssertReturn(!isWriteLockOnCurrentThread(), E_FAIL);
 
@@ -8730,7 +8725,7 @@ HRESULT Console::detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice)
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     LogFlowThisFunc(("Detaching USB proxy device {%RTuuid}...\n",
-                     aHostDevice->id().raw()));
+                     aHostDevice->i_id().raw()));
 
     /*
      * If this was a remote device, release the backend pointer.
@@ -8740,25 +8735,25 @@ HRESULT Console::detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice)
 
     HRESULT hrc2 = aHostDevice->COMGETTER(Remote)(&fRemote);
     if (FAILED(hrc2))
-        setErrorStatic(hrc2, "GetRemote() failed");
+        i_setErrorStatic(hrc2, "GetRemote() failed");
 
-    PCRTUUID pUuid = aHostDevice->id().raw();
+    PCRTUUID pUuid = aHostDevice->i_id().raw();
     if (fRemote)
     {
         Guid guid(*pUuid);
-        consoleVRDPServer()->USBBackendReleasePointer(&guid);
+        i_consoleVRDPServer()->USBBackendReleasePointer(&guid);
     }
 
     alock.release();
     int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), 0 /* idDstCpu (saved state, see #6232) */,
-                               (PFNRT)usbDetachCallback, 5,
+                               (PFNRT)i_usbDetachCallback, 5,
                                this, ptrVM.rawUVM(), pUuid);
     if (RT_SUCCESS(vrc))
     {
         LogFlowFunc(("Detached device {%RTuuid}\n", pUuid));
 
         /* notify callbacks */
-        onUSBDeviceStateChange(aHostDevice, false /* aAttached */, NULL);
+        i_onUSBDeviceStateChange(aHostDevice, false /* aAttached */, NULL);
     }
 
     ComAssertRCRet(vrc, E_FAIL);
@@ -8777,7 +8772,7 @@ HRESULT Console::detachUSBDevice(const ComObjPtr<OUSBDevice> &aHostDevice)
  */
 //static
 DECLCALLBACK(int)
-Console::usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid)
+Console::i_usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid)
 {
     LogFlowFuncEnter();
     LogFlowFunc(("that={%p} aUuid={%RTuuid}\n", that, aUuid));
@@ -8805,7 +8800,7 @@ Console::usbDetachCallback(Console *that, PUVM pUVM, PCRTUUID aUuid)
  *
  * @todo Move this back into the driver!
  */
-HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter)
+HRESULT Console::i_attachToTapInterface(INetworkAdapter *networkAdapter)
 {
     LogFlowThisFunc(("\n"));
     /* sanity check */
@@ -8854,7 +8849,7 @@ HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter)
             Utf8Str str(tapDeviceName);
             RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), str.c_str()); /** @todo bitch about names which are too long... */
             IfReq.ifr_flags = IFF_TAP | IFF_NO_PI;
-            rcVBox = ioctl(maTapFD[slot], TUNSETIFF, &IfReq);
+            rcVBox = ioctl(RTFileToNative(maTapFD[slot]), TUNSETIFF, &IfReq);
             if (rcVBox != 0)
             {
                 LogRel(("Failed to open the host network interface %ls\n", tapDeviceName.raw()));
@@ -8868,9 +8863,9 @@ HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter)
             /*
              * Make it pollable.
              */
-            if (fcntl(maTapFD[slot], F_SETFL, O_NONBLOCK) != -1)
+            if (fcntl(RTFileToNative(maTapFD[slot]), F_SETFL, O_NONBLOCK) != -1)
             {
-                Log(("attachToTapInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));
+                Log(("i_attachToTapInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));
                 /*
                  * Here is the right place to communicate the TAP file descriptor and
                  * the host interface name to the server if/when it becomes really
@@ -8975,7 +8970,7 @@ HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter)
  *
  * @todo Move this back into the driver!
  */
-HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter)
+HRESULT Console::i_detachFromTapInterface(INetworkAdapter *networkAdapter)
 {
     /* sanity check */
     LogFlowThisFunc(("\n"));
@@ -9033,7 +9028,7 @@ HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter)
  *
  * @note The caller must lock this object for writing.
  */
-HRESULT Console::powerDownHostInterfaces()
+HRESULT Console::i_powerDownHostInterfaces()
 {
     LogFlowThisFunc(("\n"));
 
@@ -9071,7 +9066,7 @@ HRESULT Console::powerDownHostInterfaces()
         if (attachment == NetworkAttachmentType_Bridged)
         {
 #if ((defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) && !defined(VBOX_WITH_NETFLT))
-            HRESULT rc2 = detachFromTapInterface(pNetworkAdapter);
+            HRESULT rc2 = i_detachFromTapInterface(pNetworkAdapter);
             if (FAILED(rc2) && SUCCEEDED(rc))
                 rc = rc2;
 #endif /* (RT_OS_LINUX || RT_OS_FREEBSD) && !VBOX_WITH_NETFLT */
@@ -9092,7 +9087,7 @@ HRESULT Console::powerDownHostInterfaces()
  * @return  VINF_SUCCESS.
  */
 /*static*/
-DECLCALLBACK(int) Console::stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser)
+DECLCALLBACK(int) Console::i_stateProgressCallback(PUVM pUVM, unsigned uPercent, void *pvUser)
 {
     IProgress *pProgress = static_cast<IProgress *>(pvUser);
 
@@ -9111,8 +9106,8 @@ DECLCALLBACK(int) Console::stateProgressCallback(PUVM pUVM, unsigned uPercent, v
  *          object here...
  */
 /*static*/ DECLCALLBACK(void)
-Console::genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
-                                   const char *pszErrorFmt, va_list va)
+Console::i_genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_DECL,
+                                     const char *pszErrorFmt, va_list va)
 {
     Utf8Str *pErrorText = (Utf8Str *)pvUser;
     AssertPtr(pErrorText);
@@ -9147,9 +9142,9 @@ Console::genericVMSetErrorCallback(PUVM pUVM, void *pvUser, int rc, RT_SRC_POS_D
  * @thread EMT.
  */
 /* static */ DECLCALLBACK(void)
-Console::setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFlags,
-                                   const char *pszErrorId,
-                                   const char *pszFormat, va_list va)
+Console::i_setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFlags,
+                                     const char *pszErrorId,
+                                     const char *pszFormat, va_list va)
 {
     bool const fFatal = !!(fFlags & VMSETRTERR_FLAGS_FATAL);
     LogFlowFuncEnter();
@@ -9162,7 +9157,7 @@ Console::setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFlags,
     LogRel(("Console: VM runtime error: fatal=%RTbool, errorID=%s message=\"%s\"\n",
             fFatal, pszErrorId, message.c_str()));
 
-    that->onRuntimeError(BOOL(fFatal), Bstr(pszErrorId).raw(), Bstr(message).raw());
+    that->i_onRuntimeError(BOOL(fFatal), Bstr(pszErrorId).raw(), Bstr(message).raw());
 
     LogFlowFuncLeave(); NOREF(pUVM);
 }
@@ -9173,7 +9168,7 @@ Console::setVMRuntimeErrorCallback(PUVM pUVM, void *pvUser, uint32_t fFlags,
  *
  * @param   pUVM    The VM handle.
  */
-HRESULT Console::captureUSBDevices(PUVM pUVM)
+HRESULT Console::i_captureUSBDevices(PUVM pUVM)
 {
     LogFlowThisFunc(("\n"));
 
@@ -9202,7 +9197,7 @@ HRESULT Console::captureUSBDevices(PUVM pUVM)
  * Detach all USB device which are attached to the VM for the
  * purpose of clean up and such like.
  */
-void Console::detachAllUSBDevices(bool aDone)
+void Console::i_detachAllUSBDevices(bool aDone)
 {
     LogFlowThisFunc(("aDone=%RTbool\n", aDone));
 
@@ -9223,10 +9218,11 @@ void Console::detachAllUSBDevices(bool aDone)
 /**
  * @note Locks this object for writing.
  */
-void Console::processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt)
+void Console::i_processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevList, uint32_t cbDevList, bool fDescExt)
 {
     LogFlowThisFuncEnter();
-    LogFlowThisFunc(("u32ClientId = %d, pDevList=%p, cbDevList = %d, fDescExt = %d\n", u32ClientId, pDevList, cbDevList, fDescExt));
+    LogFlowThisFunc(("u32ClientId = %d, pDevList=%p, cbDevList = %d, fDescExt = %d\n",
+                     u32ClientId, pDevList, cbDevList, fDescExt));
 
     AutoCaller autoCaller(this);
     if (!autoCaller.isOk())
@@ -9314,7 +9310,7 @@ void Console::processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *p
             if (fMatched)
             {
                 alock.release();
-                hrc = onUSBDeviceAttach(pUSBDevice, NULL, fMaskedIfs);
+                hrc = i_onUSBDeviceAttach(pUSBDevice, NULL, fMaskedIfs, Utf8Str());
                 alock.acquire();
 
                 /// @todo (r=dmik) warning reporting subsystem
@@ -9381,7 +9377,7 @@ void Console::processRemoteUSBDevices(uint32_t u32ClientId, VRDEUSBDEVICEDESC *p
             Bstr uuid;
             pUSBDevice->COMGETTER(Id)(uuid.asOutParam());
             alock.release();
-            onUSBDeviceDetach(uuid.raw(), NULL);
+            i_onUSBDeviceDetach(uuid.raw(), NULL);
             alock.acquire();
         }
 
@@ -9414,7 +9410,7 @@ static void faultToleranceProgressCancelCallback(void *pvUser)
  * @note Locks the Console object for writing.
  */
 /*static*/
-DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
+DECLCALLBACK(int) Console::i_powerUpThread(RTTHREAD Thread, void *pvUser)
 {
     LogFlowFuncEnter();
 
@@ -9450,8 +9446,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
     {
         // Create the VMM device object, which starts the HGCM thread; do this only
         // once for the console, for the pathological case that the same console
-        // object is used to power up a VM twice. VirtualBox 4.0: we now do that
-        // here instead of the Console constructor (see Console::init())
+        // object is used to power up a VM twice.
         if (!pConsole->m_pVMMDev)
         {
             pConsole->m_pVMMDev = new VMMDev(pConsole);
@@ -9477,7 +9472,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
          * migrate between local processes.
          *
          * Note! The media will be unlocked automatically by
-         *       SessionMachine::setMachineState() when the VM is powered down.
+         *       SessionMachine::i_setMachineState() when the VM is powered down.
          */
         if (    !task->mTeleporterEnabled
             &&  task->mEnmFaultToleranceState != FaultToleranceState_Standby)
@@ -9489,7 +9484,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
         /* Create the VRDP server. In case of headless operation, this will
          * also create the framebuffer, required at VM creation.
          */
-        ConsoleVRDPServer *server = pConsole->consoleVRDPServer();
+        ConsoleVRDPServer *server = pConsole->i_consoleVRDPServer();
         Assert(server);
 
         /* Does VRDP server call Console from the other thread?
@@ -9533,10 +9528,10 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
             }
             LogRel(("VRDE: Failed: (%Rrc), error message: '%s'\n",
                      vrc, errMsg.c_str()));
-            throw setErrorStatic(E_FAIL, errMsg.c_str());
+            throw i_setErrorStatic(E_FAIL, errMsg.c_str());
         }
 
-        ComPtr<IMachine> pMachine = pConsole->machine();
+        ComPtr<IMachine> pMachine = pConsole->i_machine();
         ULONG cCpus = 1;
         pMachine->COMGETTER(CPUCount)(&cCpus);
 
@@ -9551,7 +9546,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
         PVM pVM;
         vrc = VMR3Create(cCpus,
                          pConsole->mpVmm2UserMethods,
-                         Console::genericVMSetErrorCallback,
+                         Console::i_genericVMSetErrorCallback,
                          &task->mErrorMsg,
                          task->mConfigConstructor,
                          static_cast<Console *>(pConsole),
@@ -9560,7 +9555,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
         alock.acquire();
 
         /* Enable client connections to the server. */
-        pConsole->consoleVRDPServer()->EnableConnections();
+        pConsole->i_consoleVRDPServer()->EnableConnections();
 
         if (RT_SUCCESS(vrc))
         {
@@ -9571,12 +9566,12 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                  */
                 vrc = SSMR3RegisterExternal(pConsole->mpUVM, sSSMConsoleUnit, 0 /*iInstance*/, sSSMConsoleVer, 0 /* cbGuess */,
                                             NULL, NULL, NULL,
-                                            NULL, saveStateFileExec, NULL,
-                                            NULL, loadStateFileExec, NULL,
+                                            NULL, i_saveStateFileExec, NULL,
+                                            NULL, i_loadStateFileExec, NULL,
                                             static_cast<Console *>(pConsole));
                 AssertRCBreak(vrc);
 
-                vrc = static_cast<Console *>(pConsole)->getDisplay()->registerSSM(pConsole->mpUVM);
+                vrc = static_cast<Console *>(pConsole)->i_getDisplay()->i_registerSSM(pConsole->mpUVM);
                 AssertRC(vrc);
                 if (RT_FAILURE(vrc))
                     break;
@@ -9584,9 +9579,9 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                 /*
                  * Synchronize debugger settings
                  */
-                MachineDebugger *machineDebugger = pConsole->getMachineDebugger();
+                MachineDebugger *machineDebugger = pConsole->i_getMachineDebugger();
                 if (machineDebugger)
-                    machineDebugger->flushQueuedSettings();
+                    machineDebugger->i_flushQueuedSettings();
 
                 /*
                  * Shared Folders
@@ -9602,14 +9597,14 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                          ++it)
                     {
                         const SharedFolderData &d = it->second;
-                        rc = pConsole->createSharedFolder(it->first, d);
+                        rc = pConsole->i_createSharedFolder(it->first, d);
                         if (FAILED(rc))
                         {
                             ErrorInfoKeeper eik;
-                            pConsole->setVMRuntimeErrorCallbackF(0, "BrokenSharedFolder",
-                                    N_("The shared folder '%s' could not be set up: %ls.\n"
-                                       "The shared folder setup will not be complete. It is recommended to power down the virtual "
-                                       "machine and fix the shared folder settings while the machine is not running"),
+                            pConsole->i_setVMRuntimeErrorCallbackF(0, "BrokenSharedFolder",
+                                   N_("The shared folder '%s' could not be set up: %ls.\n"
+                                      "The shared folder setup will not be complete. It is recommended to power down the virtual "
+                                      "machine and fix the shared folder settings while the machine is not running"),
                                     it->first.c_str(), eik.getText().raw());
                         }
                     }
@@ -9626,7 +9621,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                 /*
                  * Capture USB devices.
                  */
-                rc = pConsole->captureUSBDevices(pConsole->mpUVM);
+                rc = pConsole->i_captureUSBDevices(pConsole->mpUVM);
                 if (FAILED(rc))
                     break;
 
@@ -9638,19 +9633,19 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
 
                     vrc = VMR3LoadFromFile(pConsole->mpUVM,
                                            task->mSavedStateFile.c_str(),
-                                           Console::stateProgressCallback,
+                                           Console::i_stateProgressCallback,
                                            static_cast<IProgress *>(task->mProgress));
 
                     if (RT_SUCCESS(vrc))
                     {
                         if (task->mStartPaused)
                             /* done */
-                            pConsole->setMachineState(MachineState_Paused);
+                            pConsole->i_setMachineState(MachineState_Paused);
                         else
                         {
                             /* Start/Resume the VM execution */
 #ifdef VBOX_WITH_EXTPACK
-                            vrc = pConsole->mptrExtPackManager->callAllVmPowerOnHooks(pConsole, pVM);
+                            vrc = pConsole->mptrExtPackManager->i_callAllVmPowerOnHooks(pConsole, pVM);
 #endif
                             if (RT_SUCCESS(vrc))
                                 vrc = VMR3Resume(pConsole->mpUVM, VMRESUMEREASON_STATE_RESTORED);
@@ -9663,7 +9658,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                     {
                         int vrc2 = VMR3PowerOff(pConsole->mpUVM); AssertLogRelRC(vrc2);
 #ifdef VBOX_WITH_EXTPACK
-                        pConsole->mptrExtPackManager->callAllVmPowerOffHooks(pConsole, pVM);
+                        pConsole->mptrExtPackManager->i_callAllVmPowerOffHooks(pConsole, pVM);
 #endif
                     }
                 }
@@ -9671,14 +9666,14 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                 {
                     /* -> ConsoleImplTeleporter.cpp */
                     bool fPowerOffOnFailure;
-                    rc = pConsole->teleporterTrg(pConsole->mpUVM, pMachine, &task->mErrorMsg, task->mStartPaused,
-                                                 task->mProgress, &fPowerOffOnFailure);
+                    rc = pConsole->i_teleporterTrg(pConsole->mpUVM, pMachine, &task->mErrorMsg, task->mStartPaused,
+                                                   task->mProgress, &fPowerOffOnFailure);
                     if (FAILED(rc) && fPowerOffOnFailure)
                     {
                         ErrorInfoKeeper eik;
                         int vrc2 = VMR3PowerOff(pConsole->mpUVM); AssertLogRelRC(vrc2);
 #ifdef VBOX_WITH_EXTPACK
-                        pConsole->mptrExtPackManager->callAllVmPowerOffHooks(pConsole, pVM);
+                        pConsole->mptrExtPackManager->i_callAllVmPowerOffHooks(pConsole, pVM);
 #endif
                     }
                 }
@@ -9700,7 +9695,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                         if (SUCCEEDED(rc))
                             rc = pMachine->COMGETTER(FaultTolerancePassword)(bstrPassword.asOutParam());
                     }
-                    if (task->mProgress->setCancelCallback(faultToleranceProgressCancelCallback, pConsole->mpUVM))
+                    if (task->mProgress->i_setCancelCallback(faultToleranceProgressCancelCallback, pConsole->mpUVM))
                     {
                         if (SUCCEEDED(rc))
                         {
@@ -9711,7 +9706,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
 
                             /* Power on the FT enabled VM. */
 #ifdef VBOX_WITH_EXTPACK
-                            vrc = pConsole->mptrExtPackManager->callAllVmPowerOnHooks(pConsole, pVM);
+                            vrc = pConsole->mptrExtPackManager->i_callAllVmPowerOnHooks(pConsole, pVM);
 #endif
                             if (RT_SUCCESS(vrc))
                                 vrc = FTMR3PowerOn(pConsole->mpUVM,
@@ -9722,19 +9717,19 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                                                    pszPassword);
                             AssertLogRelRC(vrc);
                         }
-                        task->mProgress->setCancelCallback(NULL, NULL);
+                        task->mProgress->i_setCancelCallback(NULL, NULL);
                     }
                     else
                         rc = E_FAIL;
                 }
                 else if (task->mStartPaused)
                     /* done */
-                    pConsole->setMachineState(MachineState_Paused);
+                    pConsole->i_setMachineState(MachineState_Paused);
                 else
                 {
                     /* Power on the VM (i.e. start executing) */
 #ifdef VBOX_WITH_EXTPACK
-                    vrc = pConsole->mptrExtPackManager->callAllVmPowerOnHooks(pConsole, pVM);
+                    vrc = pConsole->mptrExtPackManager->i_callAllVmPowerOnHooks(pConsole, pVM);
 #endif
                     if (RT_SUCCESS(vrc))
                         vrc = VMR3PowerOn(pConsole->mpUVM);
@@ -9755,7 +9750,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                 /* powerDown() will call VMR3Destroy() and do all necessary
                  * cleanup (VRDP, USB devices) */
                 alock.release();
-                HRESULT rc2 = pConsole->powerDown();
+                HRESULT rc2 = pConsole->i_powerDown();
                 alock.acquire();
                 AssertComRC(rc2);
             }
@@ -9767,7 +9762,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
                  * be sticky but our error callback isn't.
                  */
                 alock.release();
-                VMR3AtErrorDeregister(pConsole->mpUVM, Console::genericVMSetErrorCallback, &task->mErrorMsg);
+                VMR3AtErrorDeregister(pConsole->mpUVM, Console::i_genericVMSetErrorCallback, &task->mErrorMsg);
                 /** @todo register another VMSetError callback? */
                 alock.acquire();
             }
@@ -9802,7 +9797,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
 
             /* Set the error message as the COM error.
              * Progress::notifyComplete() will pick it up later. */
-            throw setErrorStatic(E_FAIL, task->mErrorMsg.c_str());
+            throw i_setErrorStatic(E_FAIL, task->mErrorMsg.c_str());
         }
     }
     catch (HRESULT aRC) { rc = aRC; }
@@ -9826,7 +9821,7 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
         ErrorInfoKeeper eik;
 
         Assert(pConsole->mpUVM == NULL);
-        vmstateChangeCallback(NULL, VMSTATE_TERMINATED, VMSTATE_CREATING, pConsole);
+        i_vmstateChangeCallback(NULL, VMSTATE_TERMINATED, VMSTATE_CREATING, pConsole);
     }
 
     /*
@@ -9840,12 +9835,12 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
     if (SUCCEEDED(rc))
     {
         /* Notify the progress object of the success */
-        task->mProgress->notifyComplete(S_OK);
+        task->mProgress->i_notifyComplete(S_OK);
     }
     else
     {
         /* The progress object will fetch the current error info */
-        task->mProgress->notifyComplete(rc);
+        task->mProgress->i_notifyComplete(rc);
         LogRel(("Power up failed (vrc=%Rrc, rc=%Rhrc (%#08X))\n", vrc, rc, rc));
     }
 
@@ -9880,19 +9875,19 @@ DECLCALLBACK(int) Console::powerUpThread(RTTHREAD Thread, void *pvUser)
  * @return  VBox status code.
  */
 /* static */
-DECLCALLBACK(int) Console::reconfigureMediumAttachment(Console *pThis,
-                                                       PUVM pUVM,
-                                                       const char *pcszDevice,
-                                                       unsigned uInstance,
-                                                       StorageBus_T enmBus,
-                                                       bool fUseHostIOCache,
-                                                       bool fBuiltinIOCache,
-                                                       bool fSetupMerge,
-                                                       unsigned uMergeSource,
-                                                       unsigned uMergeTarget,
-                                                       IMediumAttachment *aMediumAtt,
-                                                       MachineState_T aMachineState,
-                                                       HRESULT *phrc)
+DECLCALLBACK(int) Console::i_reconfigureMediumAttachment(Console *pThis,
+                                                         PUVM pUVM,
+                                                         const char *pcszDevice,
+                                                         unsigned uInstance,
+                                                         StorageBus_T enmBus,
+                                                         bool fUseHostIOCache,
+                                                         bool fBuiltinIOCache,
+                                                         bool fSetupMerge,
+                                                         unsigned uMergeSource,
+                                                         unsigned uMergeTarget,
+                                                         IMediumAttachment *aMediumAtt,
+                                                         MachineState_T aMachineState,
+                                                         HRESULT *phrc)
 {
     LogFlowFunc(("pUVM=%p aMediumAtt=%p phrc=%p\n", pUVM, aMediumAtt, phrc));
 
@@ -9908,33 +9903,24 @@ DECLCALLBACK(int) Console::reconfigureMediumAttachment(Console *pThis,
     if (lType != DeviceType_HardDisk)
         return VINF_SUCCESS;
 
-    /* Determine the base path for the device instance. */
-    PCFGMNODE pCtlInst;
-    pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance);
-    AssertReturn(pCtlInst, VERR_INTERNAL_ERROR);
-
     /* Update the device instance configuration. */
-    PCFGMNODE pLunL0 = NULL;
-    int rc = pThis->configMediumAttachment(pCtlInst,
-                                           pcszDevice,
-                                           uInstance,
-                                           enmBus,
-                                           fUseHostIOCache,
-                                           fBuiltinIOCache,
-                                           fSetupMerge,
-                                           uMergeSource,
-                                           uMergeTarget,
-                                           aMediumAtt,
-                                           aMachineState,
-                                           phrc,
-                                           true /* fAttachDetach */,
-                                           false /* fForceUnmount */,
-                                           false /* fHotplug */,
-                                           pUVM,
-                                           NULL /* paLedDevType */,
-                                           &pLunL0);
-    /* Dump the changed LUN if possible, dump the complete device otherwise */
-    CFGMR3Dump(pLunL0 ? pLunL0 : pCtlInst);
+    int rc = pThis->i_configMediumAttachment(pcszDevice,
+                                             uInstance,
+                                             enmBus,
+                                             fUseHostIOCache,
+                                             fBuiltinIOCache,
+                                             fSetupMerge,
+                                             uMergeSource,
+                                             uMergeTarget,
+                                             aMediumAtt,
+                                             aMachineState,
+                                             phrc,
+                                             true /* fAttachDetach */,
+                                             false /* fForceUnmount */,
+                                             false /* fHotplug */,
+                                             pUVM,
+                                             NULL /* paLedDevType */,
+                                             NULL /* ppLunL0)*/);
     if (RT_FAILURE(rc))
     {
         AssertMsgFailed(("rc=%Rrc\n", rc));
@@ -9948,414 +9934,6 @@ DECLCALLBACK(int) Console::reconfigureMediumAttachment(Console *pThis,
 }
 
 /**
- * Progress cancelation callback employed by Console::fntTakeSnapshotWorker.
- */
-static void takesnapshotProgressCancelCallback(void *pvUser)
-{
-    PUVM pUVM = (PUVM)pvUser;
-    SSMR3Cancel(pUVM);
-}
-
-/**
- * Worker thread created by Console::TakeSnapshot.
- * @param Thread The current thread (ignored).
- * @param pvUser The task.
- * @return VINF_SUCCESS (ignored).
- */
-/*static*/
-DECLCALLBACK(int) Console::fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser)
-{
-    VMTakeSnapshotTask *pTask = (VMTakeSnapshotTask*)pvUser;
-
-    // taking a snapshot consists of the following:
-
-    // 1) creating a diff image for each virtual hard disk, into which write operations go after
-    //    the snapshot has been created (done in VBoxSVC, in SessionMachine::BeginTakingSnapshot)
-    // 2) creating a Snapshot object with the state of the machine (hardware + storage,
-    //    done in VBoxSVC, also in SessionMachine::BeginTakingSnapshot)
-    // 3) saving the state of the virtual machine (here, in the VM process, if the machine is online)
-
-    Console    *that                 = pTask->mConsole;
-    bool        fBeganTakingSnapshot = false;
-    bool        fSuspenededBySave    = false;
-
-    AutoCaller autoCaller(that);
-    if (FAILED(autoCaller.rc()))
-    {
-        that->mptrCancelableProgress.setNull();
-        return autoCaller.rc();
-    }
-
-    AutoWriteLock alock(that COMMA_LOCKVAL_SRC_POS);
-
-    HRESULT rc = S_OK;
-
-    try
-    {
-        /* STEP 1 + 2:
-         * request creating the diff images on the server and create the snapshot object
-         * (this will set the machine state to Saving on the server to block
-         * others from accessing this machine)
-         */
-        rc = that->mControl->BeginTakingSnapshot(that,
-                                                 pTask->bstrName.raw(),
-                                                 pTask->bstrDescription.raw(),
-                                                 pTask->mProgress,
-                                                 pTask->fTakingSnapshotOnline,
-                                                 pTask->bstrSavedStateFile.asOutParam());
-        if (FAILED(rc))
-            throw rc;
-
-        fBeganTakingSnapshot = true;
-
-        /* Check sanity: for offline snapshots there must not be a saved state
-         * file name. All other combinations are valid (even though online
-         * snapshots without saved state file seems inconsistent - there are
-         * some exotic use cases, which need to be explicitly enabled, see the
-         * code of SessionMachine::BeginTakingSnapshot. */
-        if (   !pTask->fTakingSnapshotOnline
-            && !pTask->bstrSavedStateFile.isEmpty())
-            throw setErrorStatic(E_FAIL, "Invalid state of saved state file");
-
-        /* sync the state with the server */
-        if (pTask->lastMachineState == MachineState_Running)
-            that->setMachineStateLocally(MachineState_LiveSnapshotting);
-        else
-            that->setMachineStateLocally(MachineState_Saving);
-
-        // STEP 3: save the VM state (if online)
-        if (pTask->fTakingSnapshotOnline)
-        {
-            int vrc;
-            SafeVMPtr ptrVM(that);
-            if (!ptrVM.isOk())
-                throw ptrVM.rc();
-
-            pTask->mProgress->SetNextOperation(Bstr(tr("Saving the machine state")).raw(),
-                                               pTask->ulMemSize);       // operation weight, same as computed when setting up progress object
-            if (!pTask->bstrSavedStateFile.isEmpty())
-            {
-                Utf8Str strSavedStateFile(pTask->bstrSavedStateFile);
-
-                pTask->mProgress->setCancelCallback(takesnapshotProgressCancelCallback, ptrVM.rawUVM());
-
-                alock.release();
-                LogFlowFunc(("VMR3Save...\n"));
-                vrc = VMR3Save(ptrVM.rawUVM(),
-                               strSavedStateFile.c_str(),
-                               true /*fContinueAfterwards*/,
-                               Console::stateProgressCallback,
-                               static_cast<IProgress *>(pTask->mProgress),
-                               &fSuspenededBySave);
-                alock.acquire();
-                if (RT_FAILURE(vrc))
-                    throw setErrorStatic(E_FAIL,
-                                         tr("Failed to save the machine state to '%s' (%Rrc)"),
-                                         strSavedStateFile.c_str(), vrc);
-
-                pTask->mProgress->setCancelCallback(NULL, NULL);
-            }
-            else
-                LogRel(("Console: skipped saving state as part of online snapshot\n"));
-
-            if (!pTask->mProgress->notifyPointOfNoReturn())
-                throw setErrorStatic(E_FAIL, tr("Canceled"));
-            that->mptrCancelableProgress.setNull();
-
-            // STEP 4: reattach hard disks
-            LogFlowFunc(("Reattaching new differencing hard disks...\n"));
-
-            pTask->mProgress->SetNextOperation(Bstr(tr("Reconfiguring medium attachments")).raw(),
-                                               1);       // operation weight, same as computed when setting up progress object
-
-            com::SafeIfaceArray<IMediumAttachment> atts;
-            rc = that->mMachine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(atts));
-            if (FAILED(rc))
-                throw rc;
-
-            for (size_t i = 0;
-                i < atts.size();
-                ++i)
-            {
-                ComPtr<IStorageController> pStorageController;
-                Bstr controllerName;
-                ULONG lInstance;
-                StorageControllerType_T enmController;
-                StorageBus_T enmBus;
-                BOOL fUseHostIOCache;
-
-                /*
-                * We can't pass a storage controller object directly
-                * (g++ complains about not being able to pass non POD types through '...')
-                * so we have to query needed values here and pass them.
-                */
-                rc = atts[i]->COMGETTER(Controller)(controllerName.asOutParam());
-                if (FAILED(rc))
-                    throw rc;
-
-                rc = that->mMachine->GetStorageControllerByName(controllerName.raw(),
-                                                                pStorageController.asOutParam());
-                if (FAILED(rc))
-                    throw rc;
-
-                rc = pStorageController->COMGETTER(ControllerType)(&enmController);
-                if (FAILED(rc))
-                    throw rc;
-                rc = pStorageController->COMGETTER(Instance)(&lInstance);
-                if (FAILED(rc))
-                    throw rc;
-                rc = pStorageController->COMGETTER(Bus)(&enmBus);
-                if (FAILED(rc))
-                    throw rc;
-                rc = pStorageController->COMGETTER(UseHostIOCache)(&fUseHostIOCache);
-                if (FAILED(rc))
-                    throw rc;
-
-                const char *pcszDevice = Console::convertControllerTypeToDev(enmController);
-
-                BOOL fBuiltinIOCache;
-                rc = that->mMachine->COMGETTER(IOCacheEnabled)(&fBuiltinIOCache);
-                if (FAILED(rc))
-                    throw rc;
-
-                /*
-                 * don't release the lock since reconfigureMediumAttachment
-                 * isn't going to need the Console lock.
-                 */
-
-                /* TODO: do alock.release here as EMT might wait on it! See other places
-                 * where we do VMR3ReqCall requests. See @bugref{7648}. */
-                vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,
-                                       (PFNRT)reconfigureMediumAttachment, 13,
-                                       that, ptrVM.rawUVM(), pcszDevice, lInstance, enmBus, fUseHostIOCache,
-                                       fBuiltinIOCache, false /* fSetupMerge */, 0 /* uMergeSource */,
-                                       0 /* uMergeTarget */, atts[i], that->mMachineState, &rc);
-                if (RT_FAILURE(vrc))
-                    throw setErrorStatic(E_FAIL, Console::tr("%Rrc"), vrc);
-                if (FAILED(rc))
-                    throw rc;
-            }
-        }
-
-        /*
-         * finalize the requested snapshot object.
-         * This will reset the machine state to the state it had right
-         * before calling mControl->BeginTakingSnapshot().
-         */
-        rc = that->mControl->EndTakingSnapshot(TRUE /*aSuccess*/);
-        // do not throw rc here because we can't call EndTakingSnapshot() twice
-        LogFlowFunc(("EndTakingSnapshot -> %Rhrc [mMachineState=%s]\n", rc, Global::stringifyMachineState(that->mMachineState)));
-    }
-    catch (HRESULT rcThrown)
-    {
-        /* preserve existing error info */
-        ErrorInfoKeeper eik;
-
-        if (fBeganTakingSnapshot)
-            that->mControl->EndTakingSnapshot(FALSE /*aSuccess*/);
-
-        rc = rcThrown;
-        LogFunc(("Caught %Rhrc [mMachineState=%s]\n", rc, Global::stringifyMachineState(that->mMachineState)));
-    }
-    Assert(alock.isWriteLockOnCurrentThread());
-
-    if (FAILED(rc)) /* Must come before calling setMachineState. */
-        pTask->mProgress->notifyComplete(rc);
-
-    /*
-     * Fix up the machine state.
-     *
-     * For live snapshots we do all the work, for the two other variations we
-     * just update the local copy.
-     */
-    MachineState_T enmMachineState;
-    that->mMachine->COMGETTER(State)(&enmMachineState);
-    if (   that->mMachineState == MachineState_LiveSnapshotting
-        || that->mMachineState == MachineState_Saving)
-    {
-
-        if (!pTask->fTakingSnapshotOnline)
-            that->setMachineStateLocally(pTask->lastMachineState);
-        else if (SUCCEEDED(rc))
-        {
-            Assert(   pTask->lastMachineState == MachineState_Running
-                   || pTask->lastMachineState == MachineState_Paused);
-            Assert(that->mMachineState == MachineState_Saving);
-            if (pTask->lastMachineState == MachineState_Running)
-            {
-                LogFlowFunc(("VMR3Resume...\n"));
-                SafeVMPtr ptrVM(that);
-                alock.release();
-                int vrc = VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_STATE_SAVED);
-                alock.acquire();
-                if (RT_FAILURE(vrc))
-                {
-                    rc = setErrorStatic(VBOX_E_VM_ERROR, tr("Could not resume the machine execution (%Rrc)"), vrc);
-                    pTask->mProgress->notifyComplete(rc);
-                    if (that->mMachineState == MachineState_Saving)
-                        that->setMachineStateLocally(MachineState_Paused);
-                }
-            }
-            else
-                that->setMachineStateLocally(MachineState_Paused);
-        }
-        else
-        {
-            /** @todo this could probably be made more generic and reused elsewhere. */
-            /* paranoid cleanup on for a failed online snapshot. */
-            VMSTATE enmVMState = VMR3GetStateU(that->mpUVM);
-            switch (enmVMState)
-            {
-                case VMSTATE_RUNNING:
-                case VMSTATE_RUNNING_LS:
-                case VMSTATE_DEBUGGING:
-                case VMSTATE_DEBUGGING_LS:
-                case VMSTATE_POWERING_OFF:
-                case VMSTATE_POWERING_OFF_LS:
-                case VMSTATE_RESETTING:
-                case VMSTATE_RESETTING_LS:
-                    Assert(!fSuspenededBySave);
-                    that->setMachineState(MachineState_Running);
-                    break;
-
-                case VMSTATE_GURU_MEDITATION:
-                case VMSTATE_GURU_MEDITATION_LS:
-                    that->setMachineState(MachineState_Stuck);
-                    break;
-
-                case VMSTATE_FATAL_ERROR:
-                case VMSTATE_FATAL_ERROR_LS:
-                    if (pTask->lastMachineState == MachineState_Paused)
-                        that->setMachineStateLocally(pTask->lastMachineState);
-                    else
-                        that->setMachineState(MachineState_Paused);
-                    break;
-
-                default:
-                    AssertMsgFailed(("%s\n", VMR3GetStateName(enmVMState)));
-                case VMSTATE_SUSPENDED:
-                case VMSTATE_SUSPENDED_LS:
-                case VMSTATE_SUSPENDING:
-                case VMSTATE_SUSPENDING_LS:
-                case VMSTATE_SUSPENDING_EXT_LS:
-                    if (fSuspenededBySave)
-                    {
-                        Assert(pTask->lastMachineState == MachineState_Running);
-                        LogFlowFunc(("VMR3Resume (on failure)...\n"));
-                        SafeVMPtr ptrVM(that);
-                        alock.release();
-                        int vrc = VMR3Resume(ptrVM.rawUVM(), VMRESUMEREASON_STATE_SAVED); AssertLogRelRC(vrc);
-                        alock.acquire();
-                        if (RT_FAILURE(vrc))
-                            that->setMachineState(MachineState_Paused);
-                    }
-                    else if (pTask->lastMachineState == MachineState_Paused)
-                        that->setMachineStateLocally(pTask->lastMachineState);
-                    else
-                        that->setMachineState(MachineState_Paused);
-                    break;
-            }
-
-        }
-    }
-    /*else: somebody else has change the state... Leave it. */
-
-    /* check the remote state to see that we got it right. */
-    that->mMachine->COMGETTER(State)(&enmMachineState);
-    AssertLogRelMsg(that->mMachineState == enmMachineState,
-                    ("mMachineState=%s enmMachineState=%s\n", Global::stringifyMachineState(that->mMachineState),
-                     Global::stringifyMachineState(enmMachineState) ));
-
-
-    if (SUCCEEDED(rc)) /* The failure cases are handled above. */
-        pTask->mProgress->notifyComplete(rc);
-
-    delete pTask;
-
-    LogFlowFuncLeave();
-    return VINF_SUCCESS;
-}
-
-/**
- * Thread for executing the saved state operation.
- *
- * @param   Thread      The thread handle.
- * @param   pvUser      Pointer to a VMSaveTask structure.
- * @return  VINF_SUCCESS (ignored).
- *
- * @note Locks the Console object for writing.
- */
-/*static*/
-DECLCALLBACK(int) Console::saveStateThread(RTTHREAD Thread, void *pvUser)
-{
-    LogFlowFuncEnter();
-
-    std::auto_ptr<VMSaveTask> task(static_cast<VMSaveTask*>(pvUser));
-    AssertReturn(task.get(), VERR_INVALID_PARAMETER);
-
-    Assert(task->mSavedStateFile.length());
-    Assert(task->mProgress.isNull());
-    Assert(!task->mServerProgress.isNull());
-
-    const ComObjPtr<Console> &that = task->mConsole;
-    Utf8Str errMsg;
-    HRESULT rc = S_OK;
-
-    LogFlowFunc(("Saving the state to '%s'...\n", task->mSavedStateFile.c_str()));
-
-    bool fSuspenededBySave;
-    int vrc = VMR3Save(task->mpUVM,
-                       task->mSavedStateFile.c_str(),
-                       false, /*fContinueAfterwards*/
-                       Console::stateProgressCallback,
-                       static_cast<IProgress *>(task->mServerProgress),
-                       &fSuspenededBySave);
-    if (RT_FAILURE(vrc))
-    {
-        errMsg = Utf8StrFmt(Console::tr("Failed to save the machine state to '%s' (%Rrc)"),
-                            task->mSavedStateFile.c_str(), vrc);
-        rc = E_FAIL;
-    }
-    Assert(!fSuspenededBySave);
-
-    /* lock the console once we're going to access it */
-    AutoWriteLock thatLock(that COMMA_LOCKVAL_SRC_POS);
-
-    /* synchronize the state with the server */
-    if (SUCCEEDED(rc))
-    {
-        /*
-         * The machine has been successfully saved, so power it down
-         * (vmstateChangeCallback() will set state to Saved on success).
-         * Note: we release the task's VM caller, otherwise it will
-         * deadlock.
-         */
-        task->releaseVMCaller();
-        thatLock.release();
-        rc = that->powerDown();
-        thatLock.acquire();
-    }
-
-    /*
-     * If we failed, reset the local machine state.
-     */
-    if (FAILED(rc))
-        that->setMachineStateLocally(task->mMachineStateBefore);
-
-    /*
-     * Finalize the requested save state procedure. In case of failure it will
-     * reset the machine state to the state it had right before calling
-     * mControl->BeginSavingState(). This must be the last thing because it
-     * will set the progress to completed, and that means that the frontend
-     * can immediately uninit the associated console object.
-     */
-    that->mControl->EndSavingState(rc, Bstr(errMsg).raw());
-
-    LogFlowFuncLeave();
-    return VINF_SUCCESS;
-}
-
-/**
  * Thread for powering down the Console.
  *
  * @param   Thread      The thread handle.
@@ -10365,7 +9943,7 @@ DECLCALLBACK(int) Console::saveStateThread(RTTHREAD Thread, void *pvUser)
  * @note Locks the Console object for writing.
  */
 /*static*/
-DECLCALLBACK(int) Console::powerDownThread(RTTHREAD Thread, void *pvUser)
+DECLCALLBACK(int) Console::i_powerDownThread(RTTHREAD Thread, void *pvUser)
 {
     LogFlowFuncEnter();
 
@@ -10389,7 +9967,7 @@ DECLCALLBACK(int) Console::powerDownThread(RTTHREAD Thread, void *pvUser)
 
     thatLock.release();
 
-    that->powerDown(task->mServerProgress);
+    that->i_powerDown(task->mServerProgress);
 
     /* complete the operation */
     that->mControl->EndPoweringDown(S_OK, Bstr().raw());
@@ -10403,16 +9981,19 @@ DECLCALLBACK(int) Console::powerDownThread(RTTHREAD Thread, void *pvUser)
  * @interface_method_impl{VMM2USERMETHODS,pfnSaveState}
  */
 /*static*/ DECLCALLBACK(int)
-Console::vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM)
+Console::i_vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM)
 {
     Console *pConsole = ((MYVMM2USERMETHODS *)pThis)->pConsole;
     NOREF(pUVM);
 
     /*
      * For now, just call SaveState.  We should probably try notify the GUI so
-     * it can pop up a progress object and stuff.
+     * it can pop up a progress object and stuff. The progress object created
+     * by the call isn't returned to anyone and thus gets updated without
+     * anyone noticing it.
      */
-    HRESULT hrc = pConsole->SaveState(NULL);
+    ComPtr<IProgress> pProgress;
+    HRESULT hrc = pConsole->mMachine->SaveState(pProgress.asOutParam());
     return SUCCEEDED(hrc) ? VINF_SUCCESS : Global::vboxStatusCodeFromCOM(hrc);
 }
 
@@ -10420,7 +10001,7 @@ Console::vmm2User_SaveState(PCVMM2USERMETHODS pThis, PUVM pUVM)
  * @interface_method_impl{VMM2USERMETHODS,pfnNotifyEmtInit}
  */
 /*static*/ DECLCALLBACK(void)
-Console::vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu)
+Console::i_vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu)
 {
     NOREF(pThis); NOREF(pUVM); NOREF(pUVCpu);
     VirtualBoxBase::initializeComForThread();
@@ -10430,7 +10011,7 @@ Console::vmm2User_NotifyEmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVC
  * @interface_method_impl{VMM2USERMETHODS,pfnNotifyEmtTerm}
  */
 /*static*/ DECLCALLBACK(void)
-Console::vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu)
+Console::i_vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVCpu)
 {
     NOREF(pThis); NOREF(pUVM); NOREF(pUVCpu);
     VirtualBoxBase::uninitializeComForThread();
@@ -10440,7 +10021,7 @@ Console::vmm2User_NotifyEmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM, PUVMCPU pUVC
  * @interface_method_impl{VMM2USERMETHODS,pfnNotifyPdmtInit}
  */
 /*static*/ DECLCALLBACK(void)
-Console::vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM)
+Console::i_vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM)
 {
     NOREF(pThis); NOREF(pUVM);
     VirtualBoxBase::initializeComForThread();
@@ -10450,7 +10031,7 @@ Console::vmm2User_NotifyPdmtInit(PCVMM2USERMETHODS pThis, PUVM pUVM)
  * @interface_method_impl{VMM2USERMETHODS,pfnNotifyPdmtTerm}
  */
 /*static*/ DECLCALLBACK(void)
-Console::vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM)
+Console::i_vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM)
 {
     NOREF(pThis); NOREF(pUVM);
     VirtualBoxBase::uninitializeComForThread();
@@ -10460,7 +10041,7 @@ Console::vmm2User_NotifyPdmtTerm(PCVMM2USERMETHODS pThis, PUVM pUVM)
  * @interface_method_impl{VMM2USERMETHODS,pfnNotifyResetTurnedIntoPowerOff}
  */
 /*static*/ DECLCALLBACK(void)
-Console::vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM)
+Console::i_vmm2User_NotifyResetTurnedIntoPowerOff(PCVMM2USERMETHODS pThis, PUVM pUVM)
 {
     Console *pConsole = ((MYVMM2USERMETHODS *)pThis)->pConsole;
     NOREF(pUVM);
@@ -10480,18 +10061,17 @@ Console::i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, cons
 {
     Console *pConsole = ((MYPDMISECKEY *)pInterface)->pConsole;
 
-    SecretKeyMap::const_iterator it = pConsole->m_mapSecretKeys.find(Utf8Str(pszId));
-    if (it != pConsole->m_mapSecretKeys.end())
-    {
-        SecretKey *pKey = (*it).second;
+    AutoReadLock thatLock(pConsole COMMA_LOCKVAL_SRC_POS);
+    SecretKey *pKey = NULL;
 
-        ASMAtomicIncU32(&pKey->m_cRefs);
-        *ppbKey = (const uint8_t *)pKey->m_pvKey;
-        *pcbKey = pKey->m_cbKey;
-        return VINF_SUCCESS;
+    int rc = pConsole->m_pKeyStore->retainSecretKey(Utf8Str(pszId), &pKey);
+    if (RT_SUCCESS(rc))
+    {
+        *ppbKey = (const uint8_t *)pKey->getKeyBuffer();
+        *pcbKey = pKey->getKeySize();
     }
 
-    return VERR_NOT_FOUND;
+    return rc;
 }
 
 /**
@@ -10501,15 +10081,39 @@ Console::i_pdmIfSecKey_KeyRetain(PPDMISECKEY pInterface, const char *pszId, cons
 Console::i_pdmIfSecKey_KeyRelease(PPDMISECKEY pInterface, const char *pszId)
 {
     Console *pConsole = ((MYPDMISECKEY *)pInterface)->pConsole;
-    SecretKeyMap::const_iterator it = pConsole->m_mapSecretKeys.find(Utf8Str(pszId));
-    if (it != pConsole->m_mapSecretKeys.end())
-    {
-        SecretKey *pKey = (*it).second;
-        ASMAtomicDecU32(&pKey->m_cRefs);
-        return VINF_SUCCESS;
-    }
 
-    return VERR_NOT_FOUND;
+    AutoReadLock thatLock(pConsole COMMA_LOCKVAL_SRC_POS);
+    return pConsole->m_pKeyStore->releaseSecretKey(Utf8Str(pszId));
+}
+
+/**
+ * @interface_method_impl{PDMISECKEY,pfnPasswordRetain}
+ */
+/*static*/ DECLCALLBACK(int)
+Console::i_pdmIfSecKey_PasswordRetain(PPDMISECKEY pInterface, const char *pszId, const char **ppszPassword)
+{
+    Console *pConsole = ((MYPDMISECKEY *)pInterface)->pConsole;
+
+    AutoReadLock thatLock(pConsole COMMA_LOCKVAL_SRC_POS);
+    SecretKey *pKey = NULL;
+
+    int rc = pConsole->m_pKeyStore->retainSecretKey(Utf8Str(pszId), &pKey);
+    if (RT_SUCCESS(rc))
+        *ppszPassword = (const char *)pKey->getKeyBuffer();
+
+    return rc;
+}
+
+/**
+ * @interface_method_impl{PDMISECKEY,pfnPasswordRelease}
+ */
+/*static*/ DECLCALLBACK(int)
+Console::i_pdmIfSecKey_PasswordRelease(PPDMISECKEY pInterface, const char *pszId)
+{
+    Console *pConsole = ((MYPDMISECKEY *)pInterface)->pConsole;
+
+    AutoReadLock thatLock(pConsole COMMA_LOCKVAL_SRC_POS);
+    return pConsole->m_pKeyStore->releaseSecretKey(Utf8Str(pszId));
 }
 
 /**
@@ -10570,9 +10174,9 @@ typedef struct DRVMAINSTATUS
  * @param   pInterface      Pointer to the interface structure containing the called function pointer.
  * @param   iLUN            The unit number.
  */
-DECLCALLBACK(void) Console::drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN)
+DECLCALLBACK(void) Console::i_drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface, unsigned iLUN)
 {
-    PDRVMAINSTATUS pThis = (PDRVMAINSTATUS)((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINSTATUS, ILedConnectors));
+    PDRVMAINSTATUS pThis = RT_FROM_MEMBER(pInterface, DRVMAINSTATUS, ILedConnectors);
     if (iLUN >= pThis->iFirstLUN && iLUN <= pThis->iLastLUN)
     {
         PPDMLED pLed;
@@ -10592,9 +10196,9 @@ DECLCALLBACK(void) Console::drvStatus_UnitChanged(PPDMILEDCONNECTORS pInterface,
  * @param   pInterface      Pointer to the interface structure containing the called function pointer.
  * @param   uLUN            The unit number.
  */
-DECLCALLBACK(int) Console::drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned uLUN)
+DECLCALLBACK(int) Console::i_drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface, unsigned uLUN)
 {
-    PDRVMAINSTATUS pThis = (PDRVMAINSTATUS)((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINSTATUS, IMediaNotify));
+    PDRVMAINSTATUS pThis = RT_FROM_MEMBER(pInterface, DRVMAINSTATUS, IMediaNotify);
     PPDMDRVINS pDrvIns = pThis->pDrvIns;
     LogFunc(("uLUN=%d\n", uLUN));
     if (pThis->pmapMediumAttachments)
@@ -10647,7 +10251,7 @@ DECLCALLBACK(int) Console::drvStatus_MediumEjected(PPDMIMEDIANOTIFY pInterface,
 /**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
-DECLCALLBACK(void *)  Console::drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID)
+DECLCALLBACK(void *)  Console::i_drvStatus_QueryInterface(PPDMIBASE pInterface, const char *pszIID)
 {
     PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     PDRVMAINSTATUS pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINSTATUS);
@@ -10664,7 +10268,7 @@ DECLCALLBACK(void *)  Console::drvStatus_QueryInterface(PPDMIBASE pInterface, co
  * @returns VBox status.
  * @param   pDrvIns     The driver instance data.
  */
-DECLCALLBACK(void) Console::drvStatus_Destruct(PPDMDRVINS pDrvIns)
+DECLCALLBACK(void) Console::i_drvStatus_Destruct(PPDMDRVINS pDrvIns)
 {
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINSTATUS pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINSTATUS);
@@ -10684,7 +10288,7 @@ DECLCALLBACK(void) Console::drvStatus_Destruct(PPDMDRVINS pDrvIns)
  *
  * @copydoc FNPDMDRVCONSTRUCT
  */
-DECLCALLBACK(int) Console::drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+DECLCALLBACK(int) Console::i_drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
     PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINSTATUS pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINSTATUS);
@@ -10702,9 +10306,9 @@ DECLCALLBACK(int) Console::drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCf
     /*
      * Data.
      */
-    pDrvIns->IBase.pfnQueryInterface        = Console::drvStatus_QueryInterface;
-    pThis->ILedConnectors.pfnUnitChanged    = Console::drvStatus_UnitChanged;
-    pThis->IMediaNotify.pfnEjected          = Console::drvStatus_MediumEjected;
+    pDrvIns->IBase.pfnQueryInterface        = Console::i_drvStatus_QueryInterface;
+    pThis->ILedConnectors.pfnUnitChanged    = Console::i_drvStatus_UnitChanged;
+    pThis->IMediaNotify.pfnEjected          = Console::i_drvStatus_MediumEjected;
     pThis->pDrvIns                          = pDrvIns;
     pThis->pszDeviceInstance                = NULL;
 
@@ -10772,7 +10376,7 @@ DECLCALLBACK(int) Console::drvStatus_Construct(PPDMDRVINS pDrvIns, PCFGMNODE pCf
                     VERR_PDM_MISSING_INTERFACE_ABOVE);
 
     for (unsigned i = pThis->iFirstLUN; i <= pThis->iLastLUN; ++i)
-        Console::drvStatus_UnitChanged(&pThis->ILedConnectors, i);
+        Console::i_drvStatus_UnitChanged(&pThis->ILedConnectors, i);
 
     return VINF_SUCCESS;
 }
@@ -10802,9 +10406,9 @@ const PDMDRVREG Console::DrvStatusReg =
     /* cbInstance */
     sizeof(DRVMAINSTATUS),
     /* pfnConstruct */
-    Console::drvStatus_Construct,
+    Console::i_drvStatus_Construct,
     /* pfnDestruct */
-    Console::drvStatus_Destruct,
+    Console::i_drvStatus_Destruct,
     /* pfnRelocate */
     NULL,
     /* pfnIOCtl */
@@ -10829,4 +10433,6 @@ const PDMDRVREG Console::DrvStatusReg =
     PDM_DRVREG_VERSION
 };
 
+
+
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-client/ConsoleImpl2.cpp b/src/VBox/Main/src-client/ConsoleImpl2.cpp
index 4d07cb7..0646c20 100644
--- a/src/VBox/Main/src-client/ConsoleImpl2.cpp
+++ b/src/VBox/Main/src-client/ConsoleImpl2.cpp
@@ -9,7 +9,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -23,7 +23,7 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
-// for some reason Windows burns in sdk\...\winsock.h if this isn't included first
+/* For some reason Windows burns in sdk\...\winsock.h if this isn't included first. */
 #include "VBox/com/ptr.h"
 
 #include "ConsoleImpl.h"
@@ -32,7 +32,7 @@
 # include "GuestImpl.h"
 #endif
 #ifdef VBOX_WITH_DRAG_AND_DROP
-# include "GuestDnDImpl.h"
+# include "GuestDnDPrivate.h"
 #endif
 #include "VMMDev.h"
 #include "Global.h"
@@ -64,19 +64,20 @@
 #include <VBox/vmm/vmapi.h>
 #include <VBox/err.h>
 #include <VBox/param.h>
-#include <VBox/vmm/pdmapi.h> /* For PDMR3DriverAttach/PDMR3DriverDetach */
+#include <VBox/vmm/pdmapi.h> /* For PDMR3DriverAttach/PDMR3DriverDetach. */
+#include <VBox/vmm/pdmusb.h> /* For PDMR3UsbCreateEmulatedDevice. */
 #include <VBox/version.h>
 #include <VBox/HostServices/VBoxClipboardSvc.h>
 #ifdef VBOX_WITH_CROGL
 # include <VBox/HostServices/VBoxCrOpenGLSvc.h>
-#include <VBox/VBoxOGLTest.h>
+#include <VBox/VBoxOGL.h>
 #endif
 #ifdef VBOX_WITH_GUEST_PROPS
 # include <VBox/HostServices/GuestPropertySvc.h>
 # include <VBox/com/defs.h>
 # include <VBox/com/array.h>
-# include "HGCM.h" /** @todo it should be possible to register a service
-                          * extension using a VMMDev callback. */
+# include "HGCM.h" /** @todo It should be possible to register a service
+                    *        extension using a VMMDev callback. */
 # include <vector>
 #endif /* VBOX_WITH_GUEST_PROPS */
 #include <VBox/intnet.h>
@@ -528,13 +529,13 @@ static int SetBiosDiskInfo(ComPtr<IMachine> pMachine, PCFGMNODE pCfg, PCFGMNODE
 }
 
 #ifdef VBOX_WITH_PCI_PASSTHROUGH
-HRESULT Console::attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *pBusMgr, PCFGMNODE pDevices)
+HRESULT Console::i_attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *pBusMgr, PCFGMNODE pDevices)
 {
     HRESULT hrc = S_OK;
     PCFGMNODE pInst, pCfg, pLunL0, pLunL1;
 
     SafeIfaceArray<IPCIDeviceAttachment> assignments;
-    ComPtr<IMachine> aMachine = machine();
+    ComPtr<IMachine> aMachine = i_machine();
 
     hrc = aMachine->COMGETTER(PCIDeviceAssignments)(ComSafeArrayAsOutParam(assignments));
     if (   hrc != S_OK
@@ -551,7 +552,7 @@ HRESULT Console::attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *pBusMgr, P
      */
 # ifdef VBOX_WITH_EXTPACK
     static const char *s_pszPCIRawExtPackName = "Oracle VM VirtualBox Extension Pack";
-    if (!mptrExtPackManager->isExtPackUsable(s_pszPCIRawExtPackName))
+    if (!mptrExtPackManager->i_isExtPackUsable(s_pszPCIRawExtPackName))
         /* Always fatal! */
         return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,
                 N_("Implementation of the PCI passthrough framework not found!\n"
@@ -667,10 +668,10 @@ HRESULT Console::attachRawPCIDevices(PUVM pUVM, BusAssignmentManager *pBusMgr, P
 #endif
 
 
-void Console::attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
-                                 uint64_t uFirst, uint64_t uLast,
-                                 Console::MediumAttachmentMap *pmapMediumAttachments,
-                                 const char *pcszDevice, unsigned uInstance)
+void Console::i_attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
+                                   uint64_t uFirst, uint64_t uLast,
+                                   Console::MediumAttachmentMap *pmapMediumAttachments,
+                                   const char *pcszDevice, unsigned uInstance)
 {
     PCFGMNODE pLunL0, pCfg;
     InsertConfigNode(pCtlInst,  "LUN#999", &pLunL0);
@@ -704,7 +705,7 @@ void Console::attachStatusDriver(PCFGMNODE pCtlInst, PPDMLED *papLeds,
  *
  *  @note Locks the Console object for writing.
  */
-DECLCALLBACK(int) Console::configConstructor(PUVM pUVM, PVM pVM, void *pvConsole)
+DECLCALLBACK(int) Console::i_configConstructor(PUVM pUVM, PVM pVM, void *pvConsole)
 {
     LogFlowFuncEnter();
 
@@ -726,7 +727,7 @@ DECLCALLBACK(int) Console::configConstructor(PUVM pUVM, PVM pVM, void *pvConsole
     int vrc;
     try
     {
-        vrc = pConsole->configConstructorInner(pUVM, pVM, &alock);
+        vrc = pConsole->i_configConstructorInner(pUVM, pVM, &alock);
     }
     catch (...)
     {
@@ -742,6 +743,151 @@ DECLCALLBACK(int) Console::configConstructor(PUVM pUVM, PVM pVM, void *pvConsole
 }
 
 
+#ifdef RT_OS_WINDOWS
+#include <psapi.h>
+
+/**
+ * Report versions of installed drivers to release log.
+ */
+static void reportDriverVersions(void)
+{
+    DWORD   err;
+    HRESULT hrc;
+    LPVOID  aDrivers[1024];
+    LPVOID *pDrivers      = aDrivers;
+    UINT    cNeeded       = 0;
+    TCHAR   szSystemRoot[MAX_PATH];
+    TCHAR  *pszSystemRoot = szSystemRoot;
+    LPVOID  pVerInfo      = NULL;
+    DWORD   cbVerInfo     = 0;
+
+    do
+    {
+        cNeeded = GetWindowsDirectory(szSystemRoot, RT_ELEMENTS(szSystemRoot));
+        if (cNeeded == 0)
+        {
+            err = GetLastError();
+            hrc = HRESULT_FROM_WIN32(err);
+            AssertLogRelMsgFailed(("GetWindowsDirectory failed, hr=%Rhrc (0x%x) err=%u\n",
+                                                   hrc, hrc, err));
+            break;
+        }
+        else if (cNeeded > RT_ELEMENTS(szSystemRoot))
+        {
+            /* The buffer is too small, allocate big one. */
+            pszSystemRoot = (TCHAR *)RTMemTmpAlloc(cNeeded * sizeof(_TCHAR));
+            if (!pszSystemRoot)
+            {
+                AssertLogRelMsgFailed(("RTMemTmpAlloc failed to allocate %d bytes\n", cNeeded));
+                break;
+            }
+            if (GetWindowsDirectory(pszSystemRoot, cNeeded) == 0)
+            {
+                err = GetLastError();
+                hrc = HRESULT_FROM_WIN32(err);
+                AssertLogRelMsgFailed(("GetWindowsDirectory failed, hr=%Rhrc (0x%x) err=%u\n",
+                                                   hrc, hrc, err));
+                break;
+            }
+        }
+
+        DWORD  cbNeeded = 0;
+        if (!EnumDeviceDrivers(aDrivers, sizeof(aDrivers), &cbNeeded) || cbNeeded > sizeof(aDrivers))
+        {
+            pDrivers = (LPVOID *)RTMemTmpAlloc(cbNeeded);
+            if (!EnumDeviceDrivers(pDrivers, cbNeeded, &cbNeeded))
+            {
+                err = GetLastError();
+                hrc = HRESULT_FROM_WIN32(err);
+                AssertLogRelMsgFailed(("EnumDeviceDrivers failed, hr=%Rhrc (0x%x) err=%u\n",
+                                                   hrc, hrc, err));
+                break;
+            }
+        }
+
+        LogRel(("Installed Drivers:\n"));
+
+        TCHAR szDriver[1024];
+        int cDrivers = cbNeeded / sizeof(pDrivers[0]);
+        for (int i = 0; i < cDrivers; i++)
+        {
+            if (GetDeviceDriverBaseName(pDrivers[i], szDriver, sizeof(szDriver) / sizeof(szDriver[0])))
+            {
+                if (_tcsnicmp(TEXT("vbox"), szDriver, 4))
+                    continue;
+            }
+            else
+                continue;
+            if (GetDeviceDriverFileName(pDrivers[i], szDriver, sizeof(szDriver) / sizeof(szDriver[0])))
+            {
+                _TCHAR szTmpDrv[1024];
+                _TCHAR *pszDrv = szDriver;
+                if (!_tcsncmp(TEXT("\\SystemRoot"), szDriver, 11))
+                {
+                    _tcscpy_s(szTmpDrv, pszSystemRoot);
+                    _tcsncat_s(szTmpDrv, szDriver + 11, sizeof(szTmpDrv) / sizeof(szTmpDrv[0]) - _tclen(pszSystemRoot));
+                    pszDrv = szTmpDrv;
+                }
+                else if (!_tcsncmp(TEXT("\\??\\"), szDriver, 4))
+                    pszDrv = szDriver + 4;
+
+                /* Allocate a buffer for version info. Reuse if large enough. */
+                DWORD cbNewVerInfo = GetFileVersionInfoSize(pszDrv, NULL);
+                if (cbNewVerInfo > cbVerInfo)
+                {
+                    if (pVerInfo)
+                        RTMemTmpFree(pVerInfo);
+                    cbVerInfo = cbNewVerInfo;
+                    pVerInfo = RTMemTmpAlloc(cbVerInfo);
+                    if (!pVerInfo)
+                    {
+                        AssertLogRelMsgFailed(("RTMemTmpAlloc failed to allocate %d bytes\n", cbVerInfo));
+                        break;
+                    }
+                }
+                        
+                if (GetFileVersionInfo(pszDrv, NULL, cbVerInfo, pVerInfo))
+                {
+                    UINT   cbSize = 0;
+                    LPBYTE lpBuffer = NULL;
+                    if (VerQueryValue(pVerInfo, TEXT("\\"), (VOID FAR* FAR*)&lpBuffer, &cbSize))
+                    {
+                        if (cbSize)
+                        {
+                            VS_FIXEDFILEINFO *pFileInfo = (VS_FIXEDFILEINFO *)lpBuffer;
+                            if (pFileInfo->dwSignature == 0xfeef04bd)
+                            {
+                                LogRel(("  %ls (Version: %d.%d.%d.%d)\n", pszDrv,
+                                        (pFileInfo->dwFileVersionMS >> 16) & 0xffff,
+                                        (pFileInfo->dwFileVersionMS >> 0) & 0xffff,
+                                        (pFileInfo->dwFileVersionLS >> 16) & 0xffff,
+                                        (pFileInfo->dwFileVersionLS >> 0) & 0xffff));
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+    while (0);
+
+    if (pVerInfo)
+        RTMemTmpFree(pVerInfo);
+
+    if (pDrivers != aDrivers)
+        RTMemTmpFree(pDrivers);
+
+    if (pszSystemRoot != szSystemRoot)
+        RTMemTmpFree(pszSystemRoot);
+}
+#else /* !RT_OS_WINDOWS */
+static void reportDriverVersions(void)
+{
+}
+#endif /* !RT_OS_WINDOWS */
+
+
 /**
  * Worker for configConstructor.
  *
@@ -752,10 +898,10 @@ DECLCALLBACK(int) Console::configConstructor(PUVM pUVM, PVM pVM, void *pvConsole
  *                      to leave it in order to avoid deadlocks (ext packs and
  *                      more).
  */
-int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
+int Console::i_configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 {
     VMMDev         *pVMMDev   = m_pVMMDev; Assert(pVMMDev);
-    ComPtr<IMachine> pMachine = machine();
+    ComPtr<IMachine> pMachine = i_machine();
 
     int             rc;
     HRESULT         hrc;
@@ -795,6 +941,9 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
     uint64_t uMcfgBase     = 0;
     uint32_t cbMcfgLength  = 0;
 
+    ParavirtProvider_T paravirtProvider;
+    hrc = pMachine->GetEffectiveParavirtProvider(&paravirtProvider);                        H();
+
     ChipsetType_T chipsetType;
     hrc = pMachine->COMGETTER(ChipsetType)(&chipsetType);                                   H();
     if (chipsetType == ChipsetType_ICH9)
@@ -830,6 +979,8 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
     ULONG maxNetworkAdapters;
     hrc = systemProperties->GetMaxNetworkAdapters(chipsetType, &maxNetworkAdapters);        H();
+
+    reportDriverVersions();
     /*
      * Get root node first.
      * This is the only node in the tree.
@@ -923,16 +1074,11 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             InsertConfigInteger(pCPUM, "CMPXCHG16B", true);
         }
 
-        /* Expose extended MWAIT features to Mac OS X guests. */
         if (fOsXGuest)
         {
+            /* Expose extended MWAIT features to Mac OS X guests. */
             LogRel(("Using MWAIT extensions\n"));
             InsertConfigInteger(pCPUM, "MWaitExtensions", true);
-        }
-
-        if (fOsXGuest)
-        {
-            InsertConfigInteger(pCPUM, "EnableHVP", 1);
 
             /* Fake the CPU family/model so the guest works.  This is partly
                because older mac releases really doesn't work on newer cpus,
@@ -947,29 +1093,30 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                 uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 7); /* Penryn / X5482 */
             else if (   osTypeId == "MacOS107"
                      || osTypeId == "MacOS107_64")
-                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 7); /* Penryn / X5482 */ /** @todo figure out what is required here. */
+                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 7); /* Penryn / X5482 */ /** @todo figure out
+                                                                                what is required here. */
             else if (   osTypeId == "MacOS108"
                      || osTypeId == "MacOS108_64")
-                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 7); /* Penryn / X5482 */ /** @todo figure out what is required here. */
+                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 7); /* Penryn / X5482 */ /** @todo figure out
+                                                                                what is required here. */
             else if (   osTypeId == "MacOS109"
                      || osTypeId == "MacOS109_64")
-                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 7); /* Penryn / X5482 */ /** @todo figure out what is required here. */
+                uMaxIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(1, 23, 6, 7); /* Penryn / X5482 */ /** @todo figure
+                                                                                out what is required here. */
             if (uMaxIntelFamilyModelStep != UINT32_MAX)
                 InsertConfigInteger(pCPUM, "MaxIntelFamilyModelStep", uMaxIntelFamilyModelStep);
         }
 
-
-        /* Synthetic CPU */
-        BOOL fSyntheticCpu = false;
-        hrc = pMachine->GetCPUProperty(CPUPropertyType_Synthetic, &fSyntheticCpu);          H();
-        InsertConfigInteger(pCPUM, "SyntheticCpu", fSyntheticCpu);
+        /* CPU Portability level, */
+        ULONG uCpuIdPortabilityLevel = 0;
+        hrc = pMachine->COMGETTER(CPUIDPortabilityLevel)(&uCpuIdPortabilityLevel);            H();
+        InsertConfigInteger(pCPUM, "PortableCpuIdLevel", uCpuIdPortabilityLevel);
 
         /* Physical Address Extension (PAE) */
         BOOL fEnablePAE = false;
         hrc = pMachine->GetCPUProperty(CPUPropertyType_PAE, &fEnablePAE);                   H();
         InsertConfigInteger(pRoot, "EnablePAE", fEnablePAE);
 
-
         /*
          * Hardware virtualization extensions.
          */
@@ -1062,7 +1209,8 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             InsertConfigInteger(pREM, "64bitEnabled", 1);
 #endif
 
-            /** @todo Not exactly pretty to check strings; VBOXOSTYPE would be better, but that requires quite a bit of API change in Main. */
+            /** @todo Not exactly pretty to check strings; VBOXOSTYPE would be better,
+                but that requires quite a bit of API change in Main. */
             if (    fIOAPIC
                 &&  (   osTypeId == "WindowsNT4"
                      || osTypeId == "Windows2000"
@@ -1102,9 +1250,41 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
         InsertConfigInteger(pHM, "EnableUX", fEnableUX);
 
         /* Reset overwrite. */
-        if (isResetTurnedIntoPowerOff())
+        if (i_isResetTurnedIntoPowerOff())
             InsertConfigInteger(pRoot, "PowerOffInsteadOfReset", 1);
 
+        /*
+         * Paravirt. provider.
+         */
+        PCFGMNODE pParavirtNode;
+        InsertConfigNode(pRoot, "GIM", &pParavirtNode);
+        const char *pcszParavirtProvider;
+        bool fGimDeviceNeeded = true;
+        switch (paravirtProvider)
+        {
+            case ParavirtProvider_None:
+                pcszParavirtProvider = "None";
+                fGimDeviceNeeded = false;
+                break;
+
+            case ParavirtProvider_Minimal:
+                pcszParavirtProvider = "Minimal";
+                break;
+
+            case ParavirtProvider_HyperV:
+                pcszParavirtProvider = "HyperV";
+                break;
+
+            case ParavirtProvider_KVM:
+                pcszParavirtProvider = "KVM";
+                break;
+
+            default:
+                AssertMsgFailed(("Invalid paravirtProvider=%d\n", paravirtProvider));
+                return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS, N_("Invalid paravirt. provider '%d'"),
+                                    paravirtProvider);
+        }
+        InsertConfigString(pParavirtNode, "Provider", pcszParavirtProvider);
 
         /*
          * MM values.
@@ -1215,11 +1395,21 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
         PCFGMNODE pLunL2 = NULL;        /* /Devices/Dev/0/LUN#0/AttachedDriver/Config/ */
         PCFGMNODE pBiosCfg = NULL;      /* /Devices/pcbios/0/Config/ */
         PCFGMNODE pNetBootCfg = NULL;   /* /Devices/pcbios/0/Config/NetBoot/ */
-        bool fHaveBiosScsiConfig = false;
 
         InsertConfigNode(pRoot, "Devices", &pDevices);
 
         /*
+         * GIM Device
+         */
+        if (fGimDeviceNeeded)
+        {
+            InsertConfigNode(pDevices, "GIMDev", &pDev);
+            InsertConfigNode(pDev,     "0", &pInst);
+            InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
+            //InsertConfigNode(pInst,    "Config", &pCfg);
+        }
+
+        /*
          * PC Arch.
          */
         InsertConfigNode(pDevices, "pcarch", &pDev);
@@ -1285,7 +1475,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
 #ifdef VBOX_WITH_PCI_PASSTHROUGH
             /* Add PCI passthrough devices */
-            hrc = attachRawPCIDevices(pUVM, pBusMgr, pDevices);                             H();
+            hrc = i_attachRawPCIDevices(pUVM, pBusMgr, pDevices);                             H();
 #endif
         }
 
@@ -1448,13 +1638,13 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 #ifdef VBOX_WITH_VMSVGA
             case GraphicsControllerType_VMSVGA:
 #endif
-                rc = configGraphicsController(pDevices, enmGraphicsController, pBusMgr, pMachine, biosSettings,
-                                              RT_BOOL(fHMEnabled));
+                rc = i_configGraphicsController(pDevices, enmGraphicsController, pBusMgr, pMachine, biosSettings,
+                                                RT_BOOL(fHMEnabled));
                 if (FAILED(rc))
                     return rc;
                 break;
             default:
-                AssertMsgFailed(("Invalid enmGraphicsController=%d\n", enmGraphicsController));
+                AssertMsgFailed(("Invalid graphicsController=%d\n", enmGraphicsController));
                 return VMR3SetError(pUVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
                                     N_("Invalid graphics controller type '%d'"), enmGraphicsController);
         }
@@ -1565,10 +1755,10 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                 u32GopMode = strTmp.toUInt32();
 
             /* UGA mode settings */
-            uint32_t u32UgaHorisontal = 0;
+            uint32_t u32UgaHorizontal = 0;
             GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/EfiUgaHorizontalResolution", &strTmp);
             if (!strTmp.isEmpty())
-                u32UgaHorisontal = strTmp.toUInt32();
+                u32UgaHorizontal = strTmp.toUInt32();
 
             uint32_t u32UgaVertical = 0;
             GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/EfiUgaVerticalResolution", &strTmp);
@@ -1592,7 +1782,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             InsertConfigBytes(pCfg,    "UUID", &HardwareUuid,sizeof(HardwareUuid));
             InsertConfigInteger(pCfg,  "64BitEntry", f64BitEntry); /* boolean */
             InsertConfigInteger(pCfg,  "GopMode", u32GopMode);
-            InsertConfigInteger(pCfg,  "UgaHorizontalResolution", u32UgaHorisontal);
+            InsertConfigInteger(pCfg,  "UgaHorizontalResolution", u32UgaHorizontal);
             InsertConfigInteger(pCfg,  "UgaVerticalResolution", u32UgaVertical);
 
             /* For OS X guests we'll force passing host's DMI info to the guest */
@@ -1611,6 +1801,263 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
         }
 
         /*
+         * The USB Controllers.
+         */
+        com::SafeIfaceArray<IUSBController> usbCtrls;
+        hrc = pMachine->COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbCtrls));        H();
+        bool fOhciPresent = false; /**< Flag whether at least one OHCI controller is present. */
+        bool fXhciPresent = false; /**< Flag whether at least one XHCI controller is present. */
+
+        for (size_t i = 0; i < usbCtrls.size(); ++i)
+        {
+            USBControllerType_T enmCtrlType;
+            rc = usbCtrls[i]->COMGETTER(Type)(&enmCtrlType);                                   H();
+            if (enmCtrlType == USBControllerType_OHCI)
+            {
+                fOhciPresent = true;
+                break;
+            }
+            else if (enmCtrlType == USBControllerType_XHCI)
+            {
+                fXhciPresent = true;
+                break;
+            }
+        }
+
+        /*
+         * Currently EHCI is only enabled when an OHCI or XHCI controller is present as well.
+         */
+        if (fOhciPresent || fXhciPresent)
+            mfVMHasUsbController = true;
+
+        PCFGMNODE pUsbDevices = NULL; /**< Required for USB storage controller later. */
+        if (mfVMHasUsbController)
+        {
+            for (size_t i = 0; i < usbCtrls.size(); ++i)
+            {
+                USBControllerType_T enmCtrlType;
+                rc = usbCtrls[i]->COMGETTER(Type)(&enmCtrlType);                                   H();
+
+                if (enmCtrlType == USBControllerType_OHCI)
+                {
+                    InsertConfigNode(pDevices, "usb-ohci", &pDev);
+                    InsertConfigNode(pDev,     "0", &pInst);
+                    InsertConfigNode(pInst,    "Config", &pCfg);
+                    InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
+                    hrc = pBusMgr->assignPCIDevice("usb-ohci", pInst);                          H();
+                    InsertConfigNode(pInst,    "LUN#0", &pLunL0);
+                    InsertConfigString(pLunL0, "Driver",               "VUSBRootHub");
+                    InsertConfigNode(pLunL0,   "Config", &pCfg);
+
+                    /*
+                     * Attach the status driver.
+                     */
+                    i_attachStatusDriver(pInst, &mapUSBLed[0], 0, 0, NULL, NULL, 0);
+                }
+#ifdef VBOX_WITH_EHCI
+                else if (enmCtrlType == USBControllerType_EHCI)
+                {
+                    /*
+                     * USB 2.0 is only available if the proper ExtPack is installed.
+                     *
+                     * Note. Configuring EHCI here and providing messages about
+                     * the missing extpack isn't exactly clean, but it is a
+                     * necessary evil to patch over legacy compatability issues
+                     * introduced by the new distribution model.
+                     */
+                    static const char *s_pszUsbExtPackName = "Oracle VM VirtualBox Extension Pack";
+# ifdef VBOX_WITH_EXTPACK
+                    if (mptrExtPackManager->i_isExtPackUsable(s_pszUsbExtPackName))
+# endif
+                    {
+                        InsertConfigNode(pDevices, "usb-ehci", &pDev);
+                        InsertConfigNode(pDev,     "0", &pInst);
+                        InsertConfigNode(pInst,    "Config", &pCfg);
+                        InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
+                        hrc = pBusMgr->assignPCIDevice("usb-ehci", pInst);                  H();
+
+                        InsertConfigNode(pInst,    "LUN#0", &pLunL0);
+                        InsertConfigString(pLunL0, "Driver",               "VUSBRootHub");
+                        InsertConfigNode(pLunL0,   "Config", &pCfg);
+
+                        /*
+                         * Attach the status driver.
+                         */
+                        i_attachStatusDriver(pInst, &mapUSBLed[1], 0, 0, NULL, NULL, 0);
+                    }
+# ifdef VBOX_WITH_EXTPACK
+                    else
+                    {
+                        /* Always fatal! Up to VBox 4.0.4 we allowed to start the VM anyway
+                         * but this induced problems when the user saved + restored the VM! */
+                        return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,
+                                N_("Implementation of the USB 2.0 controller not found!\n"
+                                   "Because the USB 2.0 controller state is part of the saved "
+                                   "VM state, the VM cannot be started. To fix "
+                                   "this problem, either install the '%s' or disable USB 2.0 "
+                                   "support in the VM settings"),
+                                s_pszUsbExtPackName);
+                    }
+# endif
+                }
+#endif
+                else if (enmCtrlType == USBControllerType_XHCI)
+                {
+                    /*
+                     * USB 3.0 is only available if the proper ExtPack is installed.
+                     *
+                     * Note. Configuring EHCI here and providing messages about
+                     * the missing extpack isn't exactly clean, but it is a
+                     * necessary evil to patch over legacy compatability issues
+                     * introduced by the new distribution model.
+                     */
+                    static const char *s_pszUsbExtPackName = "Oracle VM VirtualBox Extension Pack";
+# ifdef VBOX_WITH_EXTPACK
+                    if (mptrExtPackManager->i_isExtPackUsable(s_pszUsbExtPackName))
+# endif
+                    {
+                        InsertConfigNode(pDevices, "usb-xhci", &pDev);
+                        InsertConfigNode(pDev,     "0", &pInst);
+                        InsertConfigNode(pInst,    "Config", &pCfg);
+                        InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
+                        hrc = pBusMgr->assignPCIDevice("usb-xhci", pInst);                  H();
+
+                        InsertConfigNode(pInst,    "LUN#0", &pLunL0);
+                        InsertConfigString(pLunL0, "Driver",               "VUSBRootHub");
+                        InsertConfigNode(pLunL0,   "Config", &pCfg);
+
+                        InsertConfigNode(pInst,    "LUN#1", &pLunL1);
+                        InsertConfigString(pLunL1, "Driver",               "VUSBRootHub");
+                        InsertConfigNode(pLunL1,   "Config", &pCfg);
+
+                        /*
+                         * Attach the status driver.
+                         */
+                        i_attachStatusDriver(pInst, &mapUSBLed[0], 0, 1, NULL, NULL, 0);
+                    }
+# ifdef VBOX_WITH_EXTPACK
+                    else
+                    {
+                        /* Always fatal. */
+                        return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,
+                                N_("Implementation of the USB 3.0 controller not found!\n"
+                                   "Because the USB 3.0 controller state is part of the saved "
+                                   "VM state, the VM cannot be started. To fix "
+                                   "this problem, either install the '%s' or disable USB 3.0 "
+                                   "support in the VM settings"),
+                                s_pszUsbExtPackName);
+                    }
+# endif
+                }
+            } /* for every USB controller. */
+
+
+            /*
+             * Virtual USB Devices.
+             */
+            InsertConfigNode(pRoot, "USB", &pUsbDevices);
+
+#ifdef VBOX_WITH_USB
+            {
+                /*
+                 * Global USB options, currently unused as we'll apply the 2.0 -> 1.1 morphing
+                 * on a per device level now.
+                 */
+                InsertConfigNode(pUsbDevices, "USBProxy", &pCfg);
+                InsertConfigNode(pCfg, "GlobalConfig", &pCfg);
+                // This globally enables the 2.0 -> 1.1 device morphing of proxied devices to keep windows quiet.
+                //InsertConfigInteger(pCfg, "Force11Device", true);
+                // The following breaks stuff, but it makes MSDs work in vista. (I include it here so
+                // that it's documented somewhere.) Users needing it can use:
+                //      VBoxManage setextradata "myvm" "VBoxInternal/USB/USBProxy/GlobalConfig/Force11PacketSize" 1
+                //InsertConfigInteger(pCfg, "Force11PacketSize", true);
+            }
+#endif
+
+#ifdef VBOX_WITH_USB_CARDREADER
+            BOOL aEmulatedUSBCardReaderEnabled = FALSE;
+            hrc = pMachine->COMGETTER(EmulatedUSBCardReaderEnabled)(&aEmulatedUSBCardReaderEnabled);    H();
+            if (aEmulatedUSBCardReaderEnabled)
+            {
+                InsertConfigNode(pUsbDevices, "CardReader", &pDev);
+                InsertConfigNode(pDev,     "0", &pInst);
+                InsertConfigNode(pInst,    "Config", &pCfg);
+
+                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
+# ifdef VBOX_WITH_USB_CARDREADER_TEST
+                InsertConfigString(pLunL0, "Driver", "DrvDirectCardReader");
+                InsertConfigNode(pLunL0,   "Config", &pCfg);
+# else
+                InsertConfigString(pLunL0, "Driver", "UsbCardReader");
+                InsertConfigNode(pLunL0,   "Config", &pCfg);
+                InsertConfigInteger(pCfg,  "Object", (uintptr_t)mUsbCardReader);
+# endif
+             }
+#endif
+
+            /* Virtual USB Mouse/Tablet */
+            if (   aPointingHID == PointingHIDType_USBMouse
+                || aPointingHID == PointingHIDType_USBTablet
+                || aPointingHID == PointingHIDType_USBMultiTouch)
+            {
+                InsertConfigNode(pUsbDevices, "HidMouse", &pDev);
+                InsertConfigNode(pDev,     "0", &pInst);
+                InsertConfigNode(pInst,    "Config", &pCfg);
+
+                if (aPointingHID == PointingHIDType_USBMouse)
+                    InsertConfigString(pCfg,   "Mode", "relative");
+                else
+                    InsertConfigString(pCfg,   "Mode", "absolute");
+                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
+                InsertConfigString(pLunL0, "Driver",        "MouseQueue");
+                InsertConfigNode(pLunL0,   "Config", &pCfg);
+                InsertConfigInteger(pCfg,  "QueueSize",            128);
+
+                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
+                InsertConfigString(pLunL1, "Driver",        "MainMouse");
+                InsertConfigNode(pLunL1,   "Config", &pCfg);
+                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
+            }
+            if (aPointingHID == PointingHIDType_USBMultiTouch)
+            {
+                InsertConfigNode(pDev,     "1", &pInst);
+                InsertConfigNode(pInst,    "Config", &pCfg);
+
+                InsertConfigString(pCfg,   "Mode", "multitouch");
+                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
+                InsertConfigString(pLunL0, "Driver",        "MouseQueue");
+                InsertConfigNode(pLunL0,   "Config", &pCfg);
+                InsertConfigInteger(pCfg,  "QueueSize",            128);
+
+                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
+                InsertConfigString(pLunL1, "Driver",        "MainMouse");
+                InsertConfigNode(pLunL1,   "Config", &pCfg);
+                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
+            }
+
+            /* Virtual USB Keyboard */
+            KeyboardHIDType_T aKbdHID;
+            hrc = pMachine->COMGETTER(KeyboardHIDType)(&aKbdHID);                       H();
+            if (aKbdHID == KeyboardHIDType_USBKeyboard)
+            {
+                InsertConfigNode(pUsbDevices, "HidKeyboard", &pDev);
+                InsertConfigNode(pDev,     "0", &pInst);
+                InsertConfigNode(pInst,    "Config", &pCfg);
+
+                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
+                InsertConfigString(pLunL0, "Driver",               "KeyboardQueue");
+                InsertConfigNode(pLunL0,   "Config", &pCfg);
+                InsertConfigInteger(pCfg,  "QueueSize",            64);
+
+                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
+                InsertConfigString(pLunL1, "Driver",               "MainKeyboard");
+                InsertConfigNode(pLunL1,   "Config", &pCfg);
+                pKeyboard = mKeyboard;
+                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
+            }
+        }
+
+        /*
          * Storage controllers.
          */
         com::SafeIfaceArray<IStorageController> ctrls;
@@ -1624,7 +2071,8 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
             StorageControllerType_T enmCtrlType;
             rc = ctrls[i]->COMGETTER(ControllerType)(&enmCtrlType);                         H();
-            AssertRelease((unsigned)enmCtrlType < RT_ELEMENTS(aCtrlNodes));
+            AssertRelease((unsigned)enmCtrlType < RT_ELEMENTS(aCtrlNodes)
+                          || enmCtrlType == StorageControllerType_USB);
 
             StorageBus_T enmBus;
             rc = ctrls[i]->COMGETTER(Bus)(&enmBus);                                         H();
@@ -1641,22 +2089,25 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             BOOL fBootable;
             rc = ctrls[i]->COMGETTER(Bootable)(&fBootable);                                 H();
 
-            /* /Devices/<ctrldev>/ */
-            const char *pszCtrlDev = convertControllerTypeToDev(enmCtrlType);
-            pDev = aCtrlNodes[enmCtrlType];
-            if (!pDev)
+            PCFGMNODE pCtlInst = NULL;
+            const char *pszCtrlDev = i_convertControllerTypeToDev(enmCtrlType);
+            if (enmCtrlType != StorageControllerType_USB)
             {
-                InsertConfigNode(pDevices, pszCtrlDev, &pDev);
-                aCtrlNodes[enmCtrlType] = pDev; /* IDE variants are handled in the switch */
-            }
+                /* /Devices/<ctrldev>/ */
+                pDev = aCtrlNodes[enmCtrlType];
+                if (!pDev)
+                {
+                    InsertConfigNode(pDevices, pszCtrlDev, &pDev);
+                    aCtrlNodes[enmCtrlType] = pDev; /* IDE variants are handled in the switch */
+                }
 
-            /* /Devices/<ctrldev>/<instance>/ */
-            PCFGMNODE pCtlInst = NULL;
-            InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pCtlInst);
+                /* /Devices/<ctrldev>/<instance>/ */
+                InsertConfigNode(pDev, Utf8StrFmt("%u", ulInstance).c_str(), &pCtlInst);
 
-            /* Device config: /Devices/<ctrldev>/<instance>/<values> & /ditto/Config/<values> */
-            InsertConfigInteger(pCtlInst, "Trusted",   1);
-            InsertConfigNode(pCtlInst,    "Config",    &pCfg);
+                /* Device config: /Devices/<ctrldev>/<instance>/<values> & /ditto/Config/<values> */
+                InsertConfigInteger(pCtlInst, "Trusted",   1);
+                InsertConfigNode(pCtlInst,    "Config",    &pCfg);
+            }
 
             static const char * const apszBiosConfigScsi[MAX_BIOS_LUN_COUNT] =
             { "ScsiLUN1", "ScsiLUN2", "ScsiLUN3", "ScsiLUN4" };
@@ -1672,21 +2123,19 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
                     InsertConfigInteger(pCfg, "Bootable",  fBootable);
 
-                    /* BIOS configuration values, first controller only. */
-                    if (!pBusMgr->hasPCIDevice("lsilogicscsi", 1) && pBiosCfg)
+                    /* BIOS configuration values, first SCSI controller only. */
+                    if (   !pBusMgr->hasPCIDevice("lsilogic", 1)
+                        && !pBusMgr->hasPCIDevice("buslogic", 0)
+                        && !pBusMgr->hasPCIDevice("lsilogicsas", 0)
+                        && pBiosCfg)
                     {
-                        if (!fHaveBiosScsiConfig)
-                        {
-                            fHaveBiosScsiConfig = true;
-                            InsertConfigString(pBiosCfg, "ScsiHardDiskDevice", "lsilogicscsi");
-
-                            hrc = SetBiosDiskInfo(pMachine, pCfg, pBiosCfg, controllerName, apszBiosConfigScsi);    H();
-                        }
+                        InsertConfigString(pBiosCfg, "ScsiHardDiskDevice", "lsilogicscsi");
+                        hrc = SetBiosDiskInfo(pMachine, pCfg, pBiosCfg, controllerName, apszBiosConfigScsi);    H();
                     }
 
                     /* Attach the status driver */
                     Assert(cLedScsi >= 16);
-                    attachStatusDriver(pCtlInst, &mapStorageLeds[iLedScsi], 0, 15,
+                    i_attachStatusDriver(pCtlInst, &mapStorageLeds[iLedScsi], 0, 15,
                                        &mapMediumAttachments, pszCtrlDev, ulInstance);
                     paLedDevType = &maStorageDevType[iLedScsi];
                     break;
@@ -1698,21 +2147,19 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
                     InsertConfigInteger(pCfg, "Bootable",  fBootable);
 
-                    /* BIOS configuration values, first controller only. */
-                    if (!pBusMgr->hasPCIDevice("buslogic", 1) && pBiosCfg)
+                    /* BIOS configuration values, first SCSI controller only. */
+                    if (   !pBusMgr->hasPCIDevice("lsilogic", 0)
+                        && !pBusMgr->hasPCIDevice("buslogic", 1)
+                        && !pBusMgr->hasPCIDevice("lsilogicsas", 0)
+                        && pBiosCfg)
                     {
-                        if (!fHaveBiosScsiConfig)
-                        {
-                            fHaveBiosScsiConfig = true;
-                            InsertConfigString(pBiosCfg, "ScsiHardDiskDevice", "buslogic");
-
-                            hrc = SetBiosDiskInfo(pMachine, pCfg, pBiosCfg, controllerName, apszBiosConfigScsi);    H();
-                        }
+                        InsertConfigString(pBiosCfg, "ScsiHardDiskDevice", "buslogic");
+                        hrc = SetBiosDiskInfo(pMachine, pCfg, pBiosCfg, controllerName, apszBiosConfigScsi);    H();
                     }
 
                     /* Attach the status driver */
                     Assert(cLedScsi >= 16);
-                    attachStatusDriver(pCtlInst, &mapStorageLeds[iLedScsi], 0, 15,
+                    i_attachStatusDriver(pCtlInst, &mapStorageLeds[iLedScsi], 0, 15,
                                        &mapMediumAttachments, pszCtrlDev, ulInstance);
                     paLedDevType = &maStorageDevType[iLedScsi];
                     break;
@@ -1727,24 +2174,17 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                     InsertConfigInteger(pCfg, "PortCount", cPorts);
                     InsertConfigInteger(pCfg, "Bootable",  fBootable);
 
-                    /* Needed configuration values for the bios, only first controller. */
-                    if (!pBusMgr->hasPCIDevice("ahci", 1))
+                    /* BIOS configuration values, first AHCI controller only. */
+                    if (   !pBusMgr->hasPCIDevice("ahci", 1)
+                        && pBiosCfg)
                     {
-                        if (pBiosCfg)
-                        {
-                            InsertConfigString(pBiosCfg, "SataHardDiskDevice", "ahci");
-                        }
-
+                        InsertConfigString(pBiosCfg, "SataHardDiskDevice", "ahci");
                         hrc = SetBiosDiskInfo(pMachine, pCfg, pBiosCfg, controllerName, apszBiosConfigSata);    H();
                     }
 
-                    GetExtraDataBoth(virtualBox, pMachine, "VBoxInternal2/AhciPortsHotpluggable", &strTmp);
-                    if (!strTmp.isEmpty())
-                        InsertConfigInteger(pCfg, "PortsHotpluggable", strTmp == "1" ? true : false);
-
                     /* Attach the status driver */
                     AssertRelease(cPorts <= cLedSata);
-                    attachStatusDriver(pCtlInst, &mapStorageLeds[iLedSata], 0, cPorts - 1,
+                    i_attachStatusDriver(pCtlInst, &mapStorageLeds[iLedSata], 0, cPorts - 1,
                                        &mapMediumAttachments, pszCtrlDev, ulInstance);
                     paLedDevType = &maStorageDevType[iLedSata];
                     break;
@@ -1761,7 +2201,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                     InsertConfigString(pCfg,   "Type", controllerString(enmCtrlType));
                     /* Attach the status driver */
                     Assert(cLedIde >= 4);
-                    attachStatusDriver(pCtlInst, &mapStorageLeds[iLedIde], 0, 3,
+                    i_attachStatusDriver(pCtlInst, &mapStorageLeds[iLedIde], 0, 3,
                                        &mapMediumAttachments, pszCtrlDev, ulInstance);
                     paLedDevType = &maStorageDevType[iLedIde];
 
@@ -1785,7 +2225,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
                     /* Attach the status driver */
                     Assert(cLedFloppy >= 2);
-                    attachStatusDriver(pCtlInst, &mapStorageLeds[iLedFloppy], 0, 1,
+                    i_attachStatusDriver(pCtlInst, &mapStorageLeds[iLedFloppy], 0, 1,
                                        &mapMediumAttachments, pszCtrlDev, ulInstance);
                     paLedDevType = &maStorageDevType[iLedFloppy];
                     break;
@@ -1798,16 +2238,14 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                     InsertConfigString(pCfg,  "ControllerType", "SAS1068");
                     InsertConfigInteger(pCfg, "Bootable",  fBootable);
 
-                    /* BIOS configuration values, first controller only. */
-                    if (!pBusMgr->hasPCIDevice("lsilogicsas", 1) && pBiosCfg)
+                    /* BIOS configuration values, first SCSI controller only. */
+                    if (   !pBusMgr->hasPCIDevice("lsilogic", 0)
+                        && !pBusMgr->hasPCIDevice("buslogic", 0)
+                        && !pBusMgr->hasPCIDevice("lsilogicsas", 1)
+                        && pBiosCfg)
                     {
-                        if (!fHaveBiosScsiConfig)
-                        {
-                            fHaveBiosScsiConfig = true;
-                            InsertConfigString(pBiosCfg, "ScsiHardDiskDevice", "lsilogicsas");
-
-                            hrc = SetBiosDiskInfo(pMachine, pCfg, pBiosCfg, controllerName, apszBiosConfigScsi);    H();
-                        }
+                        InsertConfigString(pBiosCfg, "ScsiHardDiskDevice", "lsilogicsas");
+                        hrc = SetBiosDiskInfo(pMachine, pCfg, pBiosCfg, controllerName, apszBiosConfigScsi);    H();
                     }
 
                     ULONG cPorts = 0;
@@ -1816,12 +2254,32 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
                     /* Attach the status driver */
                     Assert(cLedSas >= 8);
-                    attachStatusDriver(pCtlInst, &mapStorageLeds[iLedSas], 0, 7,
+                    i_attachStatusDriver(pCtlInst, &mapStorageLeds[iLedSas], 0, 7,
                                        &mapMediumAttachments, pszCtrlDev, ulInstance);
                     paLedDevType = &maStorageDevType[iLedSas];
                     break;
                 }
 
+                case StorageControllerType_USB:
+                {
+                    if (pUsbDevices)
+                    {
+                        /*
+                         * USB MSDs are handled a bit different as the device instance
+                         * doesn't match the storage controller instance but the port.
+                         */
+                        InsertConfigNode(pUsbDevices, "Msd", &pDev);
+                        pCtlInst = pDev;
+                    }
+                    else
+                        return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,
+                                N_("There is no USB controller enabled but there\n"
+                                   "is at least one USB storage device configured for this VM.\n"
+                                   "To fix this problem either enable the USB controller or remove\n"
+                                   "the storage device from the VM"));
+                    break;
+                }
+
                 default:
                     AssertLogRelMsgFailedReturn(("invalid storage controller type: %d\n", enmCtrlType), VERR_MAIN_CONFIG_CONSTRUCTOR_IPE);
             }
@@ -1839,24 +2297,23 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             for (size_t j = 0; j < atts.size(); ++j)
             {
                 IMediumAttachment *pMediumAtt = atts[j];
-                rc = configMediumAttachment(pCtlInst,
-                                            pszCtrlDev,
-                                            ulInstance,
-                                            enmBus,
-                                            !!fUseHostIOCache,
-                                            !!fBuiltinIOCache,
-                                            false /* fSetupMerge */,
-                                            0 /* uMergeSource */,
-                                            0 /* uMergeTarget */,
-                                            pMediumAtt,
-                                            mMachineState,
-                                            NULL /* phrc */,
-                                            false /* fAttachDetach */,
-                                            false /* fForceUnmount */,
-                                            false /* fHotplug */,
-                                            pUVM,
-                                            paLedDevType,
-                                            NULL /* ppLunL0 */);
+                rc = i_configMediumAttachment(pszCtrlDev,
+                                              ulInstance,
+                                              enmBus,
+                                              !!fUseHostIOCache,
+                                              !!fBuiltinIOCache,
+                                              false /* fSetupMerge */,
+                                              0 /* uMergeSource */,
+                                              0 /* uMergeTarget */,
+                                              pMediumAtt,
+                                              mMachineState,
+                                              NULL /* phrc */,
+                                              false /* fAttachDetach */,
+                                              false /* fForceUnmount */,
+                                              false /* fHotplug */,
+                                              pUVM,
+                                              paLedDevType,
+                                              NULL /* ppLunL0 */);
                 if (RT_FAILURE(rc))
                     return rc;
             }
@@ -2044,21 +2501,21 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             /*
              * Attach the status driver.
              */
-            attachStatusDriver(pInst, &mapNetworkLeds[ulInstance], 0, 0, NULL, NULL, 0);
+            i_attachStatusDriver(pInst, &mapNetworkLeds[ulInstance], 0, 0, NULL, NULL, 0);
 
             /*
              * Configure the network card now
              */
             bool fIgnoreConnectFailure = mMachineState == MachineState_Restoring;
-            rc = configNetwork(pszAdapterName,
-                               ulInstance,
-                               0,
-                               networkAdapter,
-                               pCfg,
-                               pLunL0,
-                               pInst,
-                               false /*fAttachDetach*/,
-                               fIgnoreConnectFailure);
+            rc = i_configNetwork(pszAdapterName,
+                                 ulInstance,
+                                 0,
+                                 networkAdapter,
+                                 pCfg,
+                                 pLunL0,
+                                 pInst,
+                                 false /*fAttachDetach*/,
+                                 fIgnoreConnectFailure);
             if (RT_FAILURE(rc))
                 return rc;
         }
@@ -2142,6 +2599,15 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                     InsertConfigNode(pLunL0,    "Config", &pLunL1);
                     InsertConfigString(pLunL1,  "DevicePath", bstr);
                 }
+                else if (eHostMode == PortMode_TCP)
+                {
+                    InsertConfigString(pLunL0,  "Driver", "Char");
+                    InsertConfigNode(pLunL0,    "AttachedDriver", &pLunL1);
+                    InsertConfigString(pLunL1,  "Driver", "TCP");
+                    InsertConfigNode(pLunL1,    "Config", &pLunL2);
+                    InsertConfigString(pLunL2,  "Location", bstr);
+                    InsertConfigInteger(pLunL2, "IsServer", fServer);
+                }
                 else if (eHostMode == PortMode_RawFile)
                 {
                     InsertConfigString(pLunL0,  "Driver", "Char");
@@ -2212,8 +2678,9 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
         /*
          * Attach the status driver.
          */
-        attachStatusDriver(pInst, &mapSharedFolderLed, 0, 0, NULL, NULL, 0);
+        i_attachStatusDriver(pInst, &mapSharedFolderLed, 0, 0, NULL, NULL, 0);
 
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
         /*
          * Audio Sniffer Device
          */
@@ -2227,9 +2694,9 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
         InsertConfigNode(pLunL0,   "Config", &pCfg);
         AudioSniffer *pAudioSniffer = mAudioSniffer;
         InsertConfigInteger(pCfg,  "Object", (uintptr_t)pAudioSniffer);
-
+#endif
         /*
-         * AC'97 ICH / SoundBlaster16 audio / Intel HD Audio
+         * AC'97 ICH / SoundBlaster16 audio / Intel HD Audio.
          */
         BOOL fAudioEnabled = FALSE;
         ComPtr<IAudioAdapter> audioAdapter;
@@ -2245,7 +2712,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             {
                 case AudioControllerType_AC97:
                 {
-                    /* default: ICH AC97 */
+                    /* Default: ICH AC97. */
                     InsertConfigNode(pDevices, "ichac97", &pDev);
                     InsertConfigNode(pDev,     "0", &pInst);
                     InsertConfigInteger(pInst, "Trusted",          1); /* boolean */
@@ -2255,7 +2722,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                 }
                 case AudioControllerType_SB16:
                 {
-                    /* legacy SoundBlaster16 */
+                    /* Legacy SoundBlaster16. */
                     InsertConfigNode(pDevices, "sb16", &pDev);
                     InsertConfigNode(pDev,     "0", &pInst);
                     InsertConfigInteger(pInst, "Trusted",          1); /* boolean */
@@ -2269,7 +2736,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                 }
                 case AudioControllerType_HDA:
                 {
-                    /* Intel HD Audio */
+                    /* Intel HD Audio. */
                     InsertConfigNode(pDevices, "hda", &pDev);
                     InsertConfigNode(pDev,     "0", &pInst);
                     InsertConfigInteger(pInst, "Trusted",          1); /* boolean */
@@ -2278,313 +2745,136 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                 }
             }
 
-            /* the Audio driver */
+            /* The audio driver. */
             InsertConfigNode(pInst,    "LUN#0", &pLunL0);
-            InsertConfigString(pLunL0, "Driver",               "AUDIO");
+            InsertConfigString(pLunL0, "Driver", "AUDIO");
             InsertConfigNode(pLunL0,   "Config", &pCfg);
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
+            InsertConfigNode(pLunL1, "Config", &pCfg);
+#endif
             AudioDriverType_T audioDriver;
             hrc = audioAdapter->COMGETTER(AudioDriver)(&audioDriver);                       H();
             switch (audioDriver)
             {
                 case AudioDriverType_Null:
                 {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    InsertConfigString(pLunL1, "Driver", "NullAudio");
+#else
                     InsertConfigString(pCfg, "AudioDriver", "null");
-                    break;
-                }
-#ifdef RT_OS_WINDOWS
-#ifdef VBOX_WITH_WINMM
-                case AudioDriverType_WinMM:
-                {
-                    InsertConfigString(pCfg, "AudioDriver", "winmm");
-                    break;
-                }
-#endif
-                case AudioDriverType_DirectSound:
-                {
-                    InsertConfigString(pCfg, "AudioDriver", "dsound");
-                    break;
-                }
-#endif /* RT_OS_WINDOWS */
-#ifdef RT_OS_SOLARIS
-                case AudioDriverType_SolAudio:
-                {
-                    InsertConfigString(pCfg, "AudioDriver", "solaudio");
-                    break;
-                }
 #endif
-#ifdef RT_OS_LINUX
-# ifdef VBOX_WITH_ALSA
-                case AudioDriverType_ALSA:
-                {
-                    InsertConfigString(pCfg, "AudioDriver", "alsa");
                     break;
                 }
-# endif
-# ifdef VBOX_WITH_PULSE
-                case AudioDriverType_Pulse:
-                {
-                    InsertConfigString(pCfg, "AudioDriver", "pulse");
-                    break;
-                }
-# endif
-#endif /* RT_OS_LINUX */
-#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(VBOX_WITH_SOLARIS_OSS)
-                case AudioDriverType_OSS:
-                {
-                    InsertConfigString(pCfg, "AudioDriver", "oss");
-                    break;
-                }
-#endif
-#ifdef RT_OS_FREEBSD
-# ifdef VBOX_WITH_PULSE
-                case AudioDriverType_Pulse:
-                {
-                    InsertConfigString(pCfg, "AudioDriver", "pulse");
-                    break;
-                }
-# endif
-#endif
-#ifdef RT_OS_DARWIN
-                case AudioDriverType_CoreAudio:
-                {
-                    InsertConfigString(pCfg, "AudioDriver", "coreaudio");
-                    break;
-                }
-#endif
-            }
-            hrc = pMachine->COMGETTER(Name)(bstr.asOutParam());                             H();
-            InsertConfigString(pCfg, "StreamName", bstr);
-        }
-
-        /*
-         * The USB Controllers.
-         */
-        com::SafeIfaceArray<IUSBController> usbCtrls;
-        hrc = pMachine->COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbCtrls));        H();
-        bool fOhciPresent = false; /**< Flag whether at least one OHCI controller is presnet. */
-
-        for (size_t i = 0; i < usbCtrls.size(); ++i)
-        {
-            USBControllerType_T enmCtrlType;
-            rc = usbCtrls[i]->COMGETTER(Type)(&enmCtrlType);                                   H();
-            if (enmCtrlType == USBControllerType_OHCI)
-            {
-                fOhciPresent = true;
-                break;
-            }
-        }
-
-        /*
-         * Currently EHCI is only enabled when a OHCI controller is present too.
-         * This might change when XHCI is supported.
-         */
-        if (fOhciPresent)
-            mfVMHasUsbController = true;
-
-        if (mfVMHasUsbController)
-        {
-            for (size_t i = 0; i < usbCtrls.size(); ++i)
-            {
-                USBControllerType_T enmCtrlType;
-                rc = usbCtrls[i]->COMGETTER(Type)(&enmCtrlType);                                   H();
-
-                if (enmCtrlType == USBControllerType_OHCI)
-                {
-                    InsertConfigNode(pDevices, "usb-ohci", &pDev);
-                    InsertConfigNode(pDev,     "0", &pInst);
-                    InsertConfigNode(pInst,    "Config", &pCfg);
-                    InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
-                    hrc = pBusMgr->assignPCIDevice("usb-ohci", pInst);                          H();
-                    InsertConfigNode(pInst,    "LUN#0", &pLunL0);
-                    InsertConfigString(pLunL0, "Driver",               "VUSBRootHub");
-                    InsertConfigNode(pLunL0,   "Config", &pCfg);
-
-                    /*
-                     * Attach the status driver.
-                     */
-                    attachStatusDriver(pInst, &mapUSBLed[0], 0, 0, NULL, NULL, 0);
+#ifdef RT_OS_WINDOWS
+# ifdef VBOX_WITH_WINMM
+                case AudioDriverType_WinMM:
+                {
+#  ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    #error "Port WinMM audio backend!" /** @todo Still needed? */
+#  else
+                    InsertConfigString(pCfg, "AudioDriver", "winmm");
+#  endif
+                    break;
                 }
-#ifdef VBOX_WITH_EHCI
-                else if (enmCtrlType == USBControllerType_EHCI)
+# endif
+                case AudioDriverType_DirectSound:
                 {
-                    /*
-                     * USB 2.0 is only available if the proper ExtPack is installed.
-                     *
-                     * Note. Configuring EHCI here and providing messages about
-                     * the missing extpack isn't exactly clean, but it is a
-                     * necessary evil to patch over legacy compatability issues
-                     * introduced by the new distribution model.
-                     */
-                    static const char *s_pszUsbExtPackName = "Oracle VM VirtualBox Extension Pack";
-# ifdef VBOX_WITH_EXTPACK
-                    if (mptrExtPackManager->isExtPackUsable(s_pszUsbExtPackName))
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    InsertConfigString(pLunL1, "Driver", "DSoundAudio");
+#else
+                    InsertConfigString(pCfg, "AudioDriver", "dsound");
+#endif
+                    break;
+                }
+#endif /* RT_OS_WINDOWS */
+#ifdef RT_OS_SOLARIS
+                case AudioDriverType_SolAudio:
+                {
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    /** @todo Hack alert: Find a better solution. */
+                    LogRel(("Audio: WARNING: Solaris Audio is deprecated, please switch to OSS!\n"));
+                    LogRel(("Audio: Automatically setting host audio backend to OSS\n"));
+                    /* Manually set backend to OSS for now. */
+                    InsertConfigString(pLunL1, "Driver", "OSSAudio");
+# else
+                    InsertConfigString(pCfg, "AudioDriver", "solaudio");
 # endif
-                    {
-                        InsertConfigNode(pDevices, "usb-ehci", &pDev);
-                        InsertConfigNode(pDev,     "0", &pInst);
-                        InsertConfigNode(pInst,    "Config", &pCfg);
-                        InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
-                        hrc = pBusMgr->assignPCIDevice("usb-ehci", pInst);                  H();
-
-                        InsertConfigNode(pInst,    "LUN#0", &pLunL0);
-                        InsertConfigString(pLunL0, "Driver",               "VUSBRootHub");
-                        InsertConfigNode(pLunL0,   "Config", &pCfg);
-
-                        /*
-                         * Attach the status driver.
-                         */
-                        attachStatusDriver(pInst, &mapUSBLed[1], 0, 0, NULL, NULL, 0);
-                    }
-# ifdef VBOX_WITH_EXTPACK
-                    else
-                    {
-                        /* Always fatal! Up to VBox 4.0.4 we allowed to start the VM anyway
-                         * but this induced problems when the user saved + restored the VM! */
-                        return VMR3SetError(pUVM, VERR_NOT_FOUND, RT_SRC_POS,
-                                N_("Implementation of the USB 2.0 controller not found!\n"
-                                   "Because the USB 2.0 controller state is part of the saved "
-                                   "VM state, the VM cannot be started. To fix "
-                                   "this problem, either install the '%s' or disable USB 2.0 "
-                                   "support in the VM settings"),
-                                s_pszUsbExtPackName);
-                    }
+                    break;
+                }
+#endif
+#ifdef VBOX_WITH_ALSA
+                case AudioDriverType_ALSA:
+                {
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    InsertConfigString(pLunL1, "Driver", "ALSAAudio");
+# else
+                    InsertConfigString(pCfg, "AudioDriver", "alsa");
 # endif
+                    break;
                 }
 #endif
-            } /* for every USB controller. */
-
-
-            /*
-             * Virtual USB Devices.
-             */
-            PCFGMNODE pUsbDevices = NULL;
-            InsertConfigNode(pRoot, "USB", &pUsbDevices);
-
-#ifdef VBOX_WITH_USB
-            {
-                /*
-                 * Global USB options, currently unused as we'll apply the 2.0 -> 1.1 morphing
-                 * on a per device level now.
-                 */
-                InsertConfigNode(pUsbDevices, "USBProxy", &pCfg);
-                InsertConfigNode(pCfg, "GlobalConfig", &pCfg);
-                // This globally enables the 2.0 -> 1.1 device morphing of proxied devices to keep windows quiet.
-                //InsertConfigInteger(pCfg, "Force11Device", true);
-                // The following breaks stuff, but it makes MSDs work in vista. (I include it here so
-                // that it's documented somewhere.) Users needing it can use:
-                //      VBoxManage setextradata "myvm" "VBoxInternal/USB/USBProxy/GlobalConfig/Force11PacketSize" 1
-                //InsertConfigInteger(pCfg, "Force11PacketSize", true);
-            }
+#ifdef VBOX_WITH_PULSE
+                case AudioDriverType_Pulse:
+                {
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    InsertConfigString(pLunL1, "Driver", "PulseAudio");
+# else
+                    InsertConfigString(pCfg, "AudioDriver", "pulse");
+# endif
+                    break;
+                }
 #endif
-
-#ifdef VBOX_WITH_USB_CARDREADER
-            BOOL aEmulatedUSBCardReaderEnabled = FALSE;
-            hrc = pMachine->COMGETTER(EmulatedUSBCardReaderEnabled)(&aEmulatedUSBCardReaderEnabled);    H();
-            if (aEmulatedUSBCardReaderEnabled)
-            {
-                InsertConfigNode(pUsbDevices, "CardReader", &pDev);
-                InsertConfigNode(pDev,     "0", &pInst);
-                InsertConfigNode(pInst,    "Config", &pCfg);
-
-                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
-# ifdef VBOX_WITH_USB_CARDREADER_TEST
-                InsertConfigString(pLunL0, "Driver", "DrvDirectCardReader");
-                InsertConfigNode(pLunL0,   "Config", &pCfg);
+#if defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(VBOX_WITH_SOLARIS_OSS)
+                case AudioDriverType_OSS:
+                {
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    InsertConfigString(pLunL1, "Driver", "OSSAudio");
 # else
-                InsertConfigString(pLunL0, "Driver", "UsbCardReader");
-                InsertConfigNode(pLunL0,   "Config", &pCfg);
-                InsertConfigInteger(pCfg,  "Object", (uintptr_t)mUsbCardReader);
+                    InsertConfigString(pCfg, "AudioDriver", "ossaudio");
 # endif
-             }
+                    break;
+                }
 #endif
-
-# if 0  /* Virtual MSD*/
-            InsertConfigNode(pUsbDevices, "Msd", &pDev);
-            InsertConfigNode(pDev,     "0", &pInst);
-            InsertConfigNode(pInst,    "Config", &pCfg);
-            InsertConfigNode(pInst,    "LUN#0", &pLunL0);
-
-            InsertConfigString(pLunL0, "Driver", "SCSI");
-            InsertConfigNode(pLunL0,   "Config", &pCfg);
-
-            InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
-            InsertConfigString(pLunL1, "Driver", "Block");
-            InsertConfigNode(pLunL1,   "Config", &pCfg);
-            InsertConfigString(pCfg,   "Type", "HardDisk");
-            InsertConfigInteger(pCfg,  "Mountable", 0);
-
-            InsertConfigNode(pLunL1,   "AttachedDriver", &pLunL2);
-            InsertConfigString(pLunL2, "Driver", "VD");
-            InsertConfigNode(pLunL2,   "Config", &pCfg);
-            InsertConfigString(pCfg,   "Path", "/Volumes/DataHFS/bird/VDIs/linux.vdi");
-            InsertConfigString(pCfg,   "Format", "VDI");
+#ifdef RT_OS_DARWIN
+                case AudioDriverType_CoreAudio:
+                {
+# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                    InsertConfigString(pLunL1, "Driver", "CoreAudio");
+# else
+                    InsertConfigString(pCfg, "AudioDriver", "coreaudio");
 # endif
-
-            /* Virtual USB Mouse/Tablet */
-            if (   aPointingHID == PointingHIDType_USBMouse
-                || aPointingHID == PointingHIDType_USBTablet
-                || aPointingHID == PointingHIDType_USBMultiTouch)
-            {
-                InsertConfigNode(pUsbDevices, "HidMouse", &pDev);
-                InsertConfigNode(pDev,     "0", &pInst);
-                InsertConfigNode(pInst,    "Config", &pCfg);
-
-                if (aPointingHID == PointingHIDType_USBMouse)
-                    InsertConfigString(pCfg,   "Mode", "relative");
-                else
-                    InsertConfigString(pCfg,   "Mode", "absolute");
-                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
-                InsertConfigString(pLunL0, "Driver",        "MouseQueue");
-                InsertConfigNode(pLunL0,   "Config", &pCfg);
-                InsertConfigInteger(pCfg,  "QueueSize",            128);
-
-                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
-                InsertConfigString(pLunL1, "Driver",        "MainMouse");
-                InsertConfigNode(pLunL1,   "Config", &pCfg);
-                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
+                    break;
+                }
+#endif
             }
-            if (aPointingHID == PointingHIDType_USBMultiTouch)
-            {
-                InsertConfigNode(pDev,     "1", &pInst);
-                InsertConfigNode(pInst,    "Config", &pCfg);
 
-                InsertConfigString(pCfg,   "Mode", "multitouch");
-                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
-                InsertConfigString(pLunL0, "Driver",        "MouseQueue");
-                InsertConfigNode(pLunL0,   "Config", &pCfg);
-                InsertConfigInteger(pCfg,  "QueueSize",            128);
+            hrc = pMachine->COMGETTER(Name)(bstr.asOutParam());                             H();
 
-                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
-                InsertConfigString(pLunL1, "Driver",        "MainMouse");
-                InsertConfigNode(pLunL1,   "Config", &pCfg);
-                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pMouse);
-            }
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            /*
+             * The VRDE audio backend driver. This one always is there
+             * and therefore is hardcoded here.
+             */
+            InsertConfigNode(pInst, "LUN#1", &pLunL1);
+            InsertConfigString(pLunL1, "Driver", "AUDIO");
 
-            /* Virtual USB Keyboard */
-            KeyboardHIDType_T aKbdHID;
-            hrc = pMachine->COMGETTER(KeyboardHIDType)(&aKbdHID);                       H();
-            if (aKbdHID == KeyboardHIDType_USBKeyboard)
-            {
-                InsertConfigNode(pUsbDevices, "HidKeyboard", &pDev);
-                InsertConfigNode(pDev,     "0", &pInst);
-                InsertConfigNode(pInst,    "Config", &pCfg);
+            InsertConfigNode(pLunL1, "AttachedDriver", &pLunL1);
+            InsertConfigString(pLunL1, "Driver", "AudioVRDE");
 
-                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
-                InsertConfigString(pLunL0, "Driver",               "KeyboardQueue");
-                InsertConfigNode(pLunL0,   "Config", &pCfg);
-                InsertConfigInteger(pCfg,  "QueueSize",            64);
+            InsertConfigNode(pLunL1, "Config", &pCfg);
+            InsertConfigString(pCfg, "AudioDriver", "AudioVRDE");
+            InsertConfigString(pCfg, "StreamName", bstr);
+            InsertConfigInteger(pCfg, "Object", (uintptr_t)mAudioVRDE);
+            InsertConfigInteger(pCfg, "ObjectVRDPServer", (uintptr_t)mConsoleVRDPServer);
 
-                InsertConfigNode(pLunL0,   "AttachedDriver", &pLunL1);
-                InsertConfigString(pLunL1, "Driver",               "MainKeyboard");
-                InsertConfigNode(pLunL1,   "Config", &pCfg);
-                pKeyboard = mKeyboard;
-                InsertConfigInteger(pCfg,  "Object",     (uintptr_t)pKeyboard);
-            }
+            /** @todo Add audio video recording driver here. */
+#endif
         }
 
         /*
-         * Clipboard
+         * Shared Clipboard.
          */
         {
             ClipboardMode_T mode = ClipboardMode_Disabled;
@@ -2594,30 +2884,30 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             {
                 /* Load the service */
                 rc = pVMMDev->hgcmLoadService("VBoxSharedClipboard", "VBoxSharedClipboard");
-
                 if (RT_FAILURE(rc))
                 {
-                    LogRel(("VBoxSharedClipboard is not available. rc = %Rrc\n", rc));
+                    LogRel(("Shared clipboard is not available, rc=%Rrc\n", rc));
                     /* That is not a fatal failure. */
                     rc = VINF_SUCCESS;
                 }
                 else
                 {
-                    changeClipboardMode(mode);
+                    LogRel(("Shared clipboard service loaded\n"));
+
+                    i_changeClipboardMode(mode);
 
                     /* Setup the service. */
                     VBOXHGCMSVCPARM parm;
                     parm.type = VBOX_HGCM_SVC_PARM_32BIT;
-                    parm.setUInt32(!useHostClipboard());
-                    pVMMDev->hgcmHostCall("VBoxSharedClipboard", VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS, 1, &parm);
-
-                    Log(("Set VBoxSharedClipboard mode\n"));
+                    parm.setUInt32(!i_useHostClipboard());
+                    pVMMDev->hgcmHostCall("VBoxSharedClipboard",
+                                          VBOX_SHARED_CLIPBOARD_HOST_FN_SET_HEADLESS, 1, &parm);
                 }
             }
         }
 
         /*
-         * HGCM HostChannel
+         * HGCM HostChannel.
          */
         {
             Bstr value;
@@ -2628,10 +2918,9 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                 && value == "1")
             {
                 rc = pVMMDev->hgcmLoadService("VBoxHostChannel", "VBoxHostChannel");
-
                 if (RT_FAILURE(rc))
                 {
-                    LogRel(("VBoxHostChannel is not available. rc = %Rrc\n", rc));
+                    LogRel(("VBoxHostChannel is not available, rc=%Rrc\n", rc));
                     /* That is not a fatal failure. */
                     rc = VINF_SUCCESS;
                 }
@@ -2640,18 +2929,17 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
         /*
-         * Drag & Drop
+         * Drag and Drop.
          */
         {
-            DragAndDropMode_T mode = DragAndDropMode_Disabled;
-            hrc = pMachine->COMGETTER(DragAndDropMode)(&mode);                              H();
+            DnDMode_T enmMode = DnDMode_Disabled;
+            hrc = pMachine->COMGETTER(DnDMode)(&enmMode);                                   H();
 
             /* Load the service */
             rc = pVMMDev->hgcmLoadService("VBoxDragAndDropSvc", "VBoxDragAndDropSvc");
-
             if (RT_FAILURE(rc))
             {
-                LogRel(("VBoxDragAndDropService is not available. rc = %Rrc\n", rc));
+                LogRel(("Drag and drop service is not available, rc=%Rrc\n", rc));
                 /* That is not a fatal failure. */
                 rc = VINF_SUCCESS;
             }
@@ -2659,14 +2947,14 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
             {
                 HGCMSVCEXTHANDLE hDummy;
                 rc = HGCMHostRegisterServiceExtension(&hDummy, "VBoxDragAndDropSvc",
-                                                      &GuestDnD::notifyGuestDragAndDropEvent,
-                                                      getGuest());
+                                                      &GuestDnD::notifyDnDDispatcher,
+                                                      GuestDnDInst());
                 if (RT_FAILURE(rc))
-                    Log(("Cannot register VBoxDragAndDropSvc extension!\n"));
+                    Log(("Cannot register VBoxDragAndDropSvc extension, rc=%Rrc\n", rc));
                 else
                 {
-                    changeDragAndDropMode(mode);
-                    Log(("VBoxDragAndDropSvc loaded\n"));
+                    LogRel(("Drag and drop service loaded\n"));
+                    rc = i_changeDnDMode(enmMode);
                 }
             }
         }
@@ -2674,11 +2962,11 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
 
 #ifdef VBOX_WITH_CROGL
         /*
-         * crOpenGL
+         * crOpenGL.
          */
         {
             BOOL fEnabled3D = false;
-            hrc = pMachine->COMGETTER(Accelerate3DEnabled)(&fEnabled3D); H();
+            hrc = pMachine->COMGETTER(Accelerate3DEnabled)(&fEnabled3D);                    H();
 
             if (   fEnabled3D
 # ifdef VBOX_WITH_VMSVGA3D
@@ -2695,17 +2983,17 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                                "fix the host 3D support (update the host graphics driver?) "
                                "or disable 3D acceleration in the VM settings"));
 
-                /* Load the service */
+                /* Load the service. */
                 rc = pVMMDev->hgcmLoadService("VBoxSharedCrOpenGL", "VBoxSharedCrOpenGL");
                 if (RT_FAILURE(rc))
                 {
-                    LogRel(("Failed to load Shared OpenGL service %Rrc\n", rc));
+                    LogRel(("Failed to load Shared OpenGL service, rc=%Rrc\n", rc));
                     /* That is not a fatal failure. */
                     rc = VINF_SUCCESS;
                 }
                 else
                 {
-                    LogRel(("Shared crOpenGL service loaded.\n"));
+                    LogRel(("Shared crOpenGL service loaded\n"));
 
                     /* Setup the service. */
                     VBOXHGCMSVCPARM parm;
@@ -2714,35 +3002,34 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
                     parm.u.pointer.addr = (IConsole *)(Console *)this;
                     parm.u.pointer.size = sizeof(IConsole *);
 
-                    rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_SET_CONSOLE, SHCRGL_CPARMS_SET_CONSOLE, &parm);
+                    rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_SET_CONSOLE,
+                                               SHCRGL_CPARMS_SET_CONSOLE, &parm);
                     if (!RT_SUCCESS(rc))
                         AssertMsgFailed(("SHCRGL_HOST_FN_SET_CONSOLE failed with %Rrc\n", rc));
 
                     parm.u.pointer.addr = pVM;
                     parm.u.pointer.size = sizeof(pVM);
-                    rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL", SHCRGL_HOST_FN_SET_VM, SHCRGL_CPARMS_SET_VM, &parm);
+                    rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL",
+                                               SHCRGL_HOST_FN_SET_VM, SHCRGL_CPARMS_SET_VM, &parm);
                     if (!RT_SUCCESS(rc))
                         AssertMsgFailed(("SHCRGL_HOST_FN_SET_VM failed with %Rrc\n", rc));
                 }
-
             }
         }
 #endif
 
 #ifdef VBOX_WITH_GUEST_PROPS
         /*
-         * Guest property service
+         * Guest property service.
          */
-
-        rc = configGuestProperties(this, pUVM);
+        rc = i_configGuestProperties(this, pUVM);
 #endif /* VBOX_WITH_GUEST_PROPS defined */
 
 #ifdef VBOX_WITH_GUEST_CONTROL
         /*
-         * Guest control service
+         * Guest control service.
          */
-
-        rc = configGuestControl(this);
+        rc = i_configGuestControl(this);
 #endif /* VBOX_WITH_GUEST_CONTROL defined */
 
         /*
@@ -2890,7 +3177,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
     if (RT_SUCCESS(rc))
     {
         pAlock->release();
-        rc = mptrExtPackManager->callAllVmConfigureVmmHooks(this, pVM);
+        rc = mptrExtPackManager->i_callAllVmConfigureVmmHooks(this, pVM);
         pAlock->acquire();
     }
 #endif
@@ -2899,13 +3186,13 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
      * Apply the CFGM overlay.
      */
     if (RT_SUCCESS(rc))
-        rc = configCfgmOverlay(pRoot, virtualBox, pMachine);
+        rc = i_configCfgmOverlay(pRoot, virtualBox, pMachine);
 
     /*
      * Dump all extradata API settings tweaks, both global and per VM.
      */
     if (RT_SUCCESS(rc))
-        rc = configDumpAPISettingsTweaks(virtualBox, pMachine);
+        rc = i_configDumpAPISettingsTweaks(virtualBox, pMachine);
 
 #undef H
 
@@ -2914,7 +3201,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
     /*
      * Register VM state change handler.
      */
-    int rc2 = VMR3AtStateRegister(pUVM, Console::vmstateChangeCallback, this);
+    int rc2 = VMR3AtStateRegister(pUVM, Console::i_vmstateChangeCallback, this);
     AssertRC(rc2);
     if (RT_SUCCESS(rc))
         rc = rc2;
@@ -2922,7 +3209,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
     /*
      * Register VM runtime error handler.
      */
-    rc2 = VMR3AtRuntimeErrorRegister(pUVM, Console::setVMRuntimeErrorCallback, this);
+    rc2 = VMR3AtRuntimeErrorRegister(pUVM, Console::i_setVMRuntimeErrorCallback, this);
     AssertRC(rc2);
     if (RT_SUCCESS(rc))
         rc = rc2;
@@ -2945,7 +3232,7 @@ int Console::configConstructorInner(PUVM pUVM, PVM pVM, AutoWriteLock *pAlock)
  * @param   pMachine        Pointer to the IMachine interface.
  */
 /* static */
-int Console::configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine)
+int Console::i_configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachine *pMachine)
 {
     /*
      * CFGM overlay handling.
@@ -3099,7 +3386,8 @@ int Console::configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachi
                     rc = CFGMR3InsertInteger(pNode, pszCFGMValueName, u64Value);
                 else
                     InsertConfigString(pNode, pszCFGMValueName, strCFGMValueUtf8);
-                AssertLogRelMsgRCBreak(rc, ("failed to insert CFGM value '%s' to key '%s'\n", strCFGMValueUtf8.c_str(), pszExtraDataKey));
+                AssertLogRelMsgRCBreak(rc, ("failed to insert CFGM value '%s' to key '%s'\n",
+                                            strCFGMValueUtf8.c_str(), pszExtraDataKey));
             }
         }
     }
@@ -3120,7 +3408,7 @@ int Console::configCfgmOverlay(PCFGMNODE pRoot, IVirtualBox *pVirtualBox, IMachi
  * @param   pMachine        Pointer to the IMachine interface.
  */
 /* static */
-int Console::configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine)
+int Console::i_configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMachine)
 {
     {
         SafeArray<BSTR> aGlobalExtraDataKeys;
@@ -3171,12 +3459,12 @@ int Console::configDumpAPISettingsTweaks(IVirtualBox *pVirtualBox, IMachine *pMa
     return VINF_SUCCESS;
 }
 
-int Console::configGraphicsController(PCFGMNODE pDevices,
-                                      const GraphicsControllerType_T enmGraphicsController,
-                                      BusAssignmentManager *pBusMgr,
-                                      const ComPtr<IMachine> &pMachine,
-                                      const ComPtr<IBIOSSettings> &biosSettings,
-                                      bool fHMEnabled)
+int Console::i_configGraphicsController(PCFGMNODE pDevices,
+                                        const GraphicsControllerType_T enmGraphicsController,
+                                        BusAssignmentManager *pBusMgr,
+                                        const ComPtr<IMachine> &ptrMachine,
+                                        const ComPtr<IBIOSSettings> &ptrBiosSettings,
+                                        bool fHMEnabled)
 {
     // InsertConfig* throws
     try
@@ -3194,10 +3482,10 @@ int Console::configGraphicsController(PCFGMNODE pDevices,
         hrc = pBusMgr->assignPCIDevice(pcszDevice, pInst);                                  H();
         InsertConfigNode(pInst,    "Config", &pCfg);
         ULONG cVRamMBs;
-        hrc = pMachine->COMGETTER(VRAMSize)(&cVRamMBs);                                     H();
+        hrc = ptrMachine->COMGETTER(VRAMSize)(&cVRamMBs);                                   H();
         InsertConfigInteger(pCfg,  "VRamSize",             cVRamMBs * _1M);
         ULONG cMonitorCount;
-        hrc = pMachine->COMGETTER(MonitorCount)(&cMonitorCount);                            H();
+        hrc = ptrMachine->COMGETTER(MonitorCount)(&cMonitorCount);                          H();
         InsertConfigInteger(pCfg,  "MonitorCount",         cMonitorCount);
 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
         InsertConfigInteger(pCfg,  "R0Enabled",            fHMEnabled);
@@ -3205,22 +3493,26 @@ int Console::configGraphicsController(PCFGMNODE pDevices,
         NOREF(fHMEnabled);
 #endif
 
+        i_attachStatusDriver(pInst, &mapCrOglLed, 0, 0, NULL, NULL, 0);
+
 #ifdef VBOX_WITH_VMSVGA
         if (enmGraphicsController == GraphicsControllerType_VMSVGA)
         {
             InsertConfigInteger(pCfg, "VMSVGAEnabled", true);
 #ifdef VBOX_WITH_VMSVGA3D
-            IFramebuffer *pFramebuffer = getDisplay()->getFramebuffer();
-            if (pFramebuffer)
+            IFramebuffer *pFramebuffer = NULL;
+            hrc = i_getDisplay()->QueryFramebuffer(0, &pFramebuffer);
+            if (SUCCEEDED(hrc) && pFramebuffer)
             {
                 LONG64 winId = 0;
                 /* @todo deal with multimonitor setup */
                 Assert(cMonitorCount == 1);
                 hrc = pFramebuffer->COMGETTER(WinId)(&winId);
                 InsertConfigInteger(pCfg, "HostWindowId", winId);
+                pFramebuffer->Release();
             }
             BOOL f3DEnabled;
-            pMachine->COMGETTER(Accelerate3DEnabled)(&f3DEnabled);
+            hrc = ptrMachine->COMGETTER(Accelerate3DEnabled)(&f3DEnabled);                  H();
             InsertConfigInteger(pCfg, "VMSVGA3dEnabled", f3DEnabled);
 #endif
         }
@@ -3232,7 +3524,7 @@ int Console::configGraphicsController(PCFGMNODE pDevices,
         {
             char szExtraDataKey[sizeof("CustomVideoModeXX")];
             RTStrPrintf(szExtraDataKey, sizeof(szExtraDataKey), "CustomVideoMode%u", iMode);
-            hrc = pMachine->GetExtraData(Bstr(szExtraDataKey).raw(), bstr.asOutParam());    H();
+            hrc = ptrMachine->GetExtraData(Bstr(szExtraDataKey).raw(), bstr.asOutParam());  H();
             if (bstr.isEmpty())
                 break;
             InsertConfigString(pCfg, szExtraDataKey, bstr);
@@ -3242,10 +3534,13 @@ int Console::configGraphicsController(PCFGMNODE pDevices,
 
         /* VESA height reduction */
         ULONG ulHeightReduction;
-        IFramebuffer *pFramebuffer = getDisplay()->getFramebuffer();
-        if (pFramebuffer)
+        IFramebuffer *pFramebuffer = NULL;
+        hrc = i_getDisplay()->QueryFramebuffer(0, &pFramebuffer);
+        if (SUCCEEDED(hrc) && pFramebuffer)
         {
             hrc = pFramebuffer->COMGETTER(HeightReduction)(&ulHeightReduction);             H();
+            pFramebuffer->Release();
+            pFramebuffer = NULL;
         }
         else
         {
@@ -3258,16 +3553,16 @@ int Console::configGraphicsController(PCFGMNODE pDevices,
          * BIOS logo
          */
         BOOL fFadeIn;
-        hrc = biosSettings->COMGETTER(LogoFadeIn)(&fFadeIn);                                H();
+        hrc = ptrBiosSettings->COMGETTER(LogoFadeIn)(&fFadeIn);                             H();
         InsertConfigInteger(pCfg,  "FadeIn",  fFadeIn ? 1 : 0);
         BOOL fFadeOut;
-        hrc = biosSettings->COMGETTER(LogoFadeOut)(&fFadeOut);                              H();
+        hrc = ptrBiosSettings->COMGETTER(LogoFadeOut)(&fFadeOut);                           H();
         InsertConfigInteger(pCfg,  "FadeOut", fFadeOut ? 1: 0);
         ULONG logoDisplayTime;
-        hrc = biosSettings->COMGETTER(LogoDisplayTime)(&logoDisplayTime);                   H();
+        hrc = ptrBiosSettings->COMGETTER(LogoDisplayTime)(&logoDisplayTime);                H();
         InsertConfigInteger(pCfg,  "LogoTime", logoDisplayTime);
         Bstr logoImagePath;
-        hrc = biosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam());           H();
+        hrc = ptrBiosSettings->COMGETTER(LogoImagePath)(logoImagePath.asOutParam());        H();
         InsertConfigString(pCfg,   "LogoFile", Utf8Str(!logoImagePath.isEmpty() ? logoImagePath : "") );
 
         /*
@@ -3275,7 +3570,7 @@ int Console::configGraphicsController(PCFGMNODE pDevices,
          */
         BIOSBootMenuMode_T eBootMenuMode;
         int iShowBootMenu;
-        biosSettings->COMGETTER(BootMenuMode)(&eBootMenuMode);
+        hrc = ptrBiosSettings->COMGETTER(BootMenuMode)(&eBootMenuMode);                     H();
         switch (eBootMenuMode)
         {
             case BIOSBootMenuMode_Disabled: iShowBootMenu = 0;  break;
@@ -3306,11 +3601,11 @@ int Console::configGraphicsController(PCFGMNODE pDevices,
 /**
  * Ellipsis to va_list wrapper for calling setVMRuntimeErrorCallback.
  */
-void Console::setVMRuntimeErrorCallbackF(uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
+void Console::i_setVMRuntimeErrorCallbackF(uint32_t fFlags, const char *pszErrorId, const char *pszFormat, ...)
 {
     va_list va;
     va_start(va, pszFormat);
-    setVMRuntimeErrorCallback(NULL, this, fFlags, pszErrorId, pszFormat, va);
+    i_setVMRuntimeErrorCallback(NULL, this, fFlags, pszErrorId, pszFormat, va);
     va_end(va);
 }
 
@@ -3334,24 +3629,23 @@ static uint64_t formatDiskSize(uint64_t u64Size, const char **pszUnit)
     }
 }
 
-int Console::configMediumAttachment(PCFGMNODE pCtlInst,
-                                    const char *pcszDevice,
-                                    unsigned uInstance,
-                                    StorageBus_T enmBus,
-                                    bool fUseHostIOCache,
-                                    bool fBuiltinIOCache,
-                                    bool fSetupMerge,
-                                    unsigned uMergeSource,
-                                    unsigned uMergeTarget,
-                                    IMediumAttachment *pMediumAtt,
-                                    MachineState_T aMachineState,
-                                    HRESULT *phrc,
-                                    bool fAttachDetach,
-                                    bool fForceUnmount,
-                                    bool fHotplug,
-                                    PUVM pUVM,
-                                    DeviceType_T *paLedDevType,
-                                    PCFGMNODE *ppLunL0)
+int Console::i_configMediumAttachment(const char *pcszDevice,
+                                      unsigned uInstance,
+                                      StorageBus_T enmBus,
+                                      bool fUseHostIOCache,
+                                      bool fBuiltinIOCache,
+                                      bool fSetupMerge,
+                                      unsigned uMergeSource,
+                                      unsigned uMergeTarget,
+                                      IMediumAttachment *pMediumAtt,
+                                      MachineState_T aMachineState,
+                                      HRESULT *phrc,
+                                      bool fAttachDetach,
+                                      bool fForceUnmount,
+                                      bool fHotplug,
+                                      PUVM pUVM,
+                                      DeviceType_T *paLedDevType,
+                                      PCFGMNODE *ppLunL0)
 {
     // InsertConfig* throws
     try
@@ -3359,6 +3653,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
         int rc = VINF_SUCCESS;
         HRESULT hrc;
         Bstr    bstr;
+        PCFGMNODE pCtlInst = NULL;
 
 // #define RC_CHECK()  AssertMsgReturn(RT_SUCCESS(rc), ("rc=%Rrc\n", rc), rc)
 #define H()         AssertLogRelMsgReturn(!FAILED(hrc), ("hrc=%Rhrc\n", hrc), VERR_MAIN_CONFIG_CONSTRUCTOR_COM_ERROR)
@@ -3376,7 +3671,63 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
 
         unsigned uLUN;
         PCFGMNODE pLunL0 = NULL;
-        hrc = Console::convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);                H();
+        hrc = Console::i_convertBusPortDeviceToLun(enmBus, lPort, lDev, uLUN);                H();
+
+        /* Determine the base path for the device instance. */
+        if (enmBus != StorageBus_USB)
+            pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "Devices/%s/%u/", pcszDevice, uInstance);
+        else
+        {
+            /* If we hotplug a USB device create a new CFGM tree. */
+            if (!fHotplug)
+                pCtlInst = CFGMR3GetChildF(CFGMR3GetRootU(pUVM), "USB/%s/", pcszDevice, uInstance);
+            else
+                pCtlInst = CFGMR3CreateTree(pUVM);
+        }
+        AssertReturn(pCtlInst, VERR_INTERNAL_ERROR);
+
+        if (enmBus == StorageBus_USB)
+        {
+            PCFGMNODE pCfg = NULL;
+
+            /* Create correct instance. */
+            if (!fHotplug)
+            {
+                if (!fAttachDetach)
+                    InsertConfigNode(pCtlInst, Utf8StrFmt("%d", lPort).c_str(), &pCtlInst);
+                else
+                    pCtlInst = CFGMR3GetChildF(pCtlInst, "%d/", lPort);
+            }
+
+            if (!fAttachDetach)
+                InsertConfigNode(pCtlInst, "Config", &pCfg);
+
+            uInstance = lPort; /* Overwrite uInstance with the correct one. */
+
+            if (!fHotplug && !fAttachDetach)
+            {
+                char aszUuid[RTUUID_STR_LENGTH + 1];
+                USBStorageDevice UsbMsd = USBStorageDevice();
+
+                memset(aszUuid, 0, sizeof(aszUuid));
+                rc = RTUuidCreate(&UsbMsd.mUuid);
+                AssertRCReturn(rc, rc);
+                rc = RTUuidToStr(&UsbMsd.mUuid, aszUuid, sizeof(aszUuid));
+                AssertRCReturn(rc, rc);
+
+                UsbMsd.iPort = uInstance;
+
+                InsertConfigString(pCtlInst, "UUID", aszUuid);
+                mUSBStorageDevices.push_back(UsbMsd);
+
+                /** @todo: No LED after hotplugging. */
+                /* Attach the status driver */
+                Assert(cLedUsb >= 8);
+                i_attachStatusDriver(pCtlInst, &mapStorageLeds[iLedUsb], 0, 7,
+                                   &mapMediumAttachments, pcszDevice, 0);
+                paLedDevType = &maStorageDevType[iLedUsb];
+            }
+        }
 
         /* First check if the LUN already exists. */
         pLunL0 = CFGMR3GetChildF(pCtlInst, "LUN#%u", uLUN);
@@ -3388,7 +3739,10 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                 {
                     /* Unmount existing media only for floppy and DVD drives. */
                     PPDMIBASE pBase;
-                    rc = PDMR3QueryLun(pUVM, pcszDevice, uInstance, uLUN, &pBase);
+                    if (enmBus == StorageBus_USB)
+                        rc = PDMR3UsbQueryLun(pUVM, pcszDevice, uInstance, uLUN, &pBase);
+                    else
+                        rc = PDMR3QueryLun(pUVM, pcszDevice, uInstance, uLUN, &pBase);
                     if (RT_FAILURE(rc))
                     {
                         if (rc == VERR_PDM_LUN_NOT_FOUND || rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN)
@@ -3410,7 +3764,11 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                     }
                 }
 
-                rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG);
+                if (enmBus == StorageBus_USB)
+                    rc = PDMR3UsbDriverDetach(pUVM, pcszDevice, uInstance, uLUN, NULL, 0,
+                                              fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG);
+                else
+                    rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG);
                 if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN)
                     rc = VINF_SUCCESS;
                 AssertRCReturn(rc, rc);
@@ -3455,7 +3813,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
         mapMediumAttachments[devicePath] = pMediumAtt;
 
         /* SCSI has a another driver between device and block. */
-        if (enmBus == StorageBus_SCSI || enmBus == StorageBus_SAS)
+        if (enmBus == StorageBus_SCSI || enmBus == StorageBus_SAS || enmBus == StorageBus_USB)
         {
             InsertConfigString(pLunL0, "Driver", "SCSI");
             PCFGMNODE pL1Cfg = NULL;
@@ -3495,7 +3853,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                 hrc = pMedium->COMGETTER(Location)(strFile.asOutParam());                   H();
                 Utf8Str utfFile = Utf8Str(strFile);
                 Bstr strSnap;
-                ComPtr<IMachine> pMachine = machine();
+                ComPtr<IMachine> pMachine = i_machine();
                 hrc = pMachine->COMGETTER(SnapshotFolder)(strSnap.asOutParam());            H();
                 Utf8Str utfSnap = Utf8Str(strSnap);
                 RTFSTYPE enmFsTypeFile = RTFSTYPE_UNKNOWN;
@@ -3521,7 +3879,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                 {
                     const char *pszUnit;
                     uint64_t u64Print = formatDiskSize((uint64_t)i64Size, &pszUnit);
-                    setVMRuntimeErrorCallbackF(0, "FatPartitionDetected",
+                    i_setVMRuntimeErrorCallbackF(0, "FatPartitionDetected",
                             N_("The medium '%ls' has a logical size of %RU64%s "
                             "but the file system the medium is located on seems "
                             "to be FAT(32) which cannot handle files bigger than 4GB.\n"
@@ -3552,7 +3910,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                             const char *pszUnitMax;
                             uint64_t u64PrintSiz = formatDiskSize((LONG64)i64Size, &pszUnitSiz);
                             uint64_t u64PrintMax = formatDiskSize(maxSize, &pszUnitMax);
-                            setVMRuntimeErrorCallbackF(0, "FatPartitionDetected", /* <= not exact but ... */
+                            i_setVMRuntimeErrorCallbackF(0, "FatPartitionDetected", /* <= not exact but ... */
                                     N_("The medium '%ls' has a logical size of %RU64%s "
                                     "but the file system the medium is located on can "
                                     "only handle files up to %RU64%s in theory.\n"
@@ -3575,7 +3933,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                 {
                     const char *pszUnit;
                     uint64_t u64Print = formatDiskSize(i64Size, &pszUnit);
-                    setVMRuntimeErrorCallbackF(0, "FatPartitionDetected",
+                    i_setVMRuntimeErrorCallbackF(0, "FatPartitionDetected",
 #ifdef RT_OS_WINDOWS
                             N_("The snapshot folder of this VM '%ls' seems to be located on "
                             "a FAT(32) file system. The logical size of the medium '%ls' "
@@ -3616,7 +3974,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                     if (   enmFsTypeFile == RTFSTYPE_EXT4
                         || enmFsTypeFile == RTFSTYPE_XFS)
                     {
-                        setVMRuntimeErrorCallbackF(0, "Ext4PartitionDetected",
+                        i_setVMRuntimeErrorCallbackF(0, "Ext4PartitionDetected",
                                 N_("The host I/O cache for at least one controller is disabled "
                                    "and the medium '%ls' for this VM "
                                    "is located on an %s partition. There is a known Linux "
@@ -3633,7 +3991,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                                 || enmFsTypeSnap == RTFSTYPE_XFS)
                              && !mfSnapshotFolderExt4WarningShown)
                     {
-                        setVMRuntimeErrorCallbackF(0, "Ext4PartitionDetected",
+                        i_setVMRuntimeErrorCallbackF(0, "Ext4PartitionDetected",
                                 N_("The host I/O cache for at least one controller is disabled "
                                    "and the snapshot folder for this VM "
                                    "is located on an %s partition. There is a known Linux "
@@ -3686,27 +4044,43 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
             hrc = pBwGroup->COMGETTER(Name)(strBwGroup.asOutParam());                       H();
         }
 
-        rc = configMedium(pLunL0,
-                          !!fPassthrough,
-                          lType,
-                          fUseHostIOCache,
-                          fBuiltinIOCache,
-                          fSetupMerge,
-                          uMergeSource,
-                          uMergeTarget,
-                          strBwGroup.isEmpty() ? NULL : Utf8Str(strBwGroup).c_str(),
-                          !!fDiscard,
-                          pMedium,
-                          aMachineState,
-                          phrc);
+        rc = i_configMedium(pLunL0,
+                            !!fPassthrough,
+                            lType,
+                            fUseHostIOCache,
+                            fBuiltinIOCache,
+                            fSetupMerge,
+                            uMergeSource,
+                            uMergeTarget,
+                            strBwGroup.isEmpty() ? NULL : Utf8Str(strBwGroup).c_str(),
+                            !!fDiscard,
+                            pMedium,
+                            aMachineState,
+                            phrc);
         if (RT_FAILURE(rc))
             return rc;
 
         if (fAttachDetach)
         {
             /* Attach the new driver. */
-            rc = PDMR3DeviceAttach(pUVM, pcszDevice, uInstance, uLUN,
-                                   fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/);
+            if (enmBus == StorageBus_USB)
+            {
+                if (fHotplug)
+                {
+                    USBStorageDevice UsbMsd = USBStorageDevice();
+                    RTUuidCreate(&UsbMsd.mUuid);
+                    UsbMsd.iPort = uInstance;
+                    rc = PDMR3UsbCreateEmulatedDevice(pUVM, pcszDevice, pCtlInst, &UsbMsd.mUuid, NULL);
+                    if (RT_SUCCESS(rc))
+                        mUSBStorageDevices.push_back(UsbMsd);
+                }
+                else
+                    rc = PDMR3UsbDriverAttach(pUVM, pcszDevice, uInstance, uLUN,
+                                              fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/);
+            }
+            else
+                rc = PDMR3DeviceAttach(pUVM, pcszDevice, uInstance, uLUN,
+                                       fHotplug ? 0 : PDM_TACH_FLAGS_NOT_HOT_PLUG, NULL /*ppBase*/);
             AssertRCReturn(rc, rc);
 
             /*
@@ -3720,7 +4094,7 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
                 PPDMIMEDIA pIMedium = (PPDMIMEDIA)pIBase->pfnQueryInterface(pIBase, PDMIMEDIA_IID);
                 if (pIMedium)
                 {
-                    rc = pIMedium->pfnSetSecKeyIf(pIMedium, NULL, mpIfSecKeyHlp);
+                    rc = pIMedium->pfnSetSecKeyIf(pIMedium, mpIfSecKey, mpIfSecKeyHlp);
                     Assert(RT_SUCCESS(rc) || rc == VERR_NOT_SUPPORTED);
                 }
             }
@@ -3732,6 +4106,11 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
 
         if (paLedDevType)
             paLedDevType[uLUN] = lType;
+
+        /* Dump the changed LUN if possible, dump the complete device otherwise */
+        if (   aMachineState != MachineState_Starting
+            && aMachineState != MachineState_Restoring)
+            CFGMR3Dump(pLunL0 ? pLunL0 : pCtlInst);
     }
     catch (ConfigError &x)
     {
@@ -3744,19 +4123,19 @@ int Console::configMediumAttachment(PCFGMNODE pCtlInst,
     return VINF_SUCCESS;
 }
 
-int Console::configMedium(PCFGMNODE pLunL0,
-                          bool fPassthrough,
-                          DeviceType_T enmType,
-                          bool fUseHostIOCache,
-                          bool fBuiltinIOCache,
-                          bool fSetupMerge,
-                          unsigned uMergeSource,
-                          unsigned uMergeTarget,
-                          const char *pcszBwGroup,
-                          bool fDiscard,
-                          IMedium *pMedium,
-                          MachineState_T aMachineState,
-                          HRESULT *phrc)
+int Console::i_configMedium(PCFGMNODE pLunL0,
+                            bool fPassthrough,
+                            DeviceType_T enmType,
+                            bool fUseHostIOCache,
+                            bool fBuiltinIOCache,
+                            bool fSetupMerge,
+                            unsigned uMergeSource,
+                            unsigned uMergeTarget,
+                            const char *pcszBwGroup,
+                            bool fDiscard,
+                            IMedium *pMedium,
+                            MachineState_T aMachineState,
+                            HRESULT *phrc)
 {
     // InsertConfig* throws
     try
@@ -3838,10 +4217,11 @@ int Console::configMedium(PCFGMNODE pLunL0,
                 {
                     Bstr loc;
                     hrc = pMedium->COMGETTER(Location)(loc.asOutParam());                   H();
-                    setVMRuntimeErrorCallbackF(0, "DvdOrFloppyImageInaccessible",
-                                               "The image file '%ls' is inaccessible and is being ignored. Please select a different image file for the virtual %s drive.",
-                                               loc.raw(),
-                                               enmType == DeviceType_DVD ? "DVD" : "floppy");
+                    i_setVMRuntimeErrorCallbackF(0, "DvdOrFloppyImageInaccessible",
+                                                 "The image file '%ls' is inaccessible and is being ignored. "
+                                                 "Please select a different image file for the virtual %s drive.",
+                                                 loc.raw(),
+                                                 enmType == DeviceType_DVD ? "DVD" : "floppy");
                     pMedium = NULL;
                 }
             }
@@ -3874,13 +4254,13 @@ int Console::configMedium(PCFGMNODE pLunL0,
 # ifdef VBOX_WITH_EXTPACK
                 static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
                 static const char *s_pszVDPlugin = "VDPluginCrypt";
-                if (mptrExtPackManager->isExtPackUsable(strExtPackPuel.c_str()))
+                if (mptrExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
                 {
                     /* Configure loading the VDPlugin. */
                     PCFGMNODE pCfgPlugins = NULL;
                     PCFGMNODE pCfgPlugin = NULL;
                     Utf8Str strPlugin;
-                    hrc = mptrExtPackManager->getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+                    hrc = mptrExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
                     // Don't fail, this is optional!
                     if (SUCCEEDED(hrc))
                     {
@@ -3965,7 +4345,8 @@ int Console::configMedium(PCFGMNODE pLunL0,
 
                 /* Pass all custom parameters. */
                 bool fHostIP = true;
-                hrc = configMediumProperties(pCfg, pMedium, &fHostIP); H();
+                bool fEncrypted = false;
+                hrc = i_configMediumProperties(pCfg, pMedium, &fHostIP, &fEncrypted); H();
 
                 /* Create an inverted list of parents. */
                 uImage--;
@@ -3993,7 +4374,7 @@ int Console::configMedium(PCFGMNODE pLunL0,
                     }
 
                     /* Configure medium properties. */
-                    hrc = configMediumProperties(pCur, pMedium, &fHostIP); H();
+                    hrc = i_configMediumProperties(pCur, pMedium, &fHostIP, &fEncrypted); H();
 
                     /* next */
                     pParent = pCur;
@@ -4004,6 +4385,9 @@ int Console::configMedium(PCFGMNODE pLunL0,
                  * configuration node. Simplifies life of DrvVD a bit. */
                 if (!fHostIP)
                     InsertConfigInteger(pCfg, "HostIPStack", 0);
+
+                if (fEncrypted)
+                    m_cDisksEncrypted++;
             }
         }
 #undef H
@@ -4021,11 +4405,12 @@ int Console::configMedium(PCFGMNODE pLunL0,
  * Adds the medium properties to the CFGM tree.
  *
  * @returns VBox status code.
- * @param   pCur       The current CFGM node.
- * @param   pMedium    The medium object to configure.
- * @param   pfHostIP   Where to return the value of the \"HostIPStack\" property if found.
+ * @param   pCur        The current CFGM node.
+ * @param   pMedium     The medium object to configure.
+ * @param   pfHostIP    Where to return the value of the \"HostIPStack\" property if found.
+ * @param   pfEncrypted Where to return whether the medium is encrypted.
  */
-int Console::configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHostIP)
+int Console::i_configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHostIP, bool *pfEncrypted)
 {
     /* Pass all custom parameters. */
     SafeArray<BSTR> aNames;
@@ -4072,6 +4457,10 @@ int Console::configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHo
                         &&  value.compare("0") == 0)
                         *pfHostIP = false;
                 }
+
+                if (   name.compare("CRYPT/KeyId") == 0
+                    && pfEncrypted)
+                    *pfEncrypted = true;
             }
         }
     }
@@ -4101,15 +4490,15 @@ int Console::configMediumProperties(PCFGMNODE pCur, IMedium *pMedium, bool *pfHo
  *  @note   Locks this object for writing.
  *  @thread EMT
  */
-int Console::configNetwork(const char *pszDevice,
-                           unsigned uInstance,
-                           unsigned uLun,
-                           INetworkAdapter *aNetworkAdapter,
-                           PCFGMNODE pCfg,
-                           PCFGMNODE pLunL0,
-                           PCFGMNODE pInst,
-                           bool fAttachDetach,
-                           bool fIgnoreConnectFailure)
+int Console::i_configNetwork(const char *pszDevice,
+                             unsigned uInstance,
+                             unsigned uLun,
+                             INetworkAdapter *aNetworkAdapter,
+                             PCFGMNODE pCfg,
+                             PCFGMNODE pLunL0,
+                             PCFGMNODE pInst,
+                             bool fAttachDetach,
+                             bool fIgnoreConnectFailure)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), VERR_ACCESS_DENIED);
@@ -4130,7 +4519,7 @@ int Console::configNetwork(const char *pszDevice,
          */
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        ComPtr<IMachine> pMachine = machine();
+        ComPtr<IMachine> pMachine = i_machine();
 
         ComPtr<IVirtualBox> virtualBox;
         hrc = pMachine->COMGETTER(Parent)(virtualBox.asOutParam());                         H();
@@ -4358,7 +4747,7 @@ int Console::configNetwork(const char *pszDevice,
             case NetworkAttachmentType_Bridged:
             {
 #if (defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)) && !defined(VBOX_WITH_NETFLT)
-                hrc = attachToTapInterface(aNetworkAdapter);
+                hrc = i_attachToTapInterface(aNetworkAdapter);
                 if (FAILED(hrc))
                 {
                     switch (hrc)
@@ -4377,12 +4766,12 @@ int Console::configNetwork(const char *pszDevice,
                     }
                 }
 
-                Assert((int)maTapFD[uInstance] >= 0);
-                if ((int)maTapFD[uInstance] >= 0)
+                Assert((intptr_t)maTapFD[uInstance] >= 0);
+                if ((intptr_t)maTapFD[uInstance] >= 0)
                 {
                     InsertConfigString(pLunL0, "Driver", "HostInterface");
                     InsertConfigNode(pLunL0, "Config", &pCfg);
-                    InsertConfigInteger(pCfg, "FileHandle", maTapFD[uInstance]);
+                    InsertConfigInteger(pCfg, "FileHandle", (intptr_t)maTapFD[uInstance]);
                 }
 
 #elif defined(VBOX_WITH_NETFLT)
@@ -4492,7 +4881,8 @@ int Console::configNetwork(const char *pszDevice,
                 }
 
                 /* get the adapter's INetCfgComponent*/
-                hrc = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.raw(), pAdaptorComponent.asOutParam());
+                hrc = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.raw(),
+                                                      pAdaptorComponent.asOutParam());
                 if (hrc != S_OK)
                 {
                     VBoxNetCfgWinReleaseINetCfg(pNc, FALSE /*fHasWriteLock*/);
@@ -4519,7 +4909,8 @@ int Console::configNetwork(const char *pszDevice,
                             DWORD err = GetLastError();
                             hrc = HRESULT_FROM_WIN32(err);
                             AssertMsgFailed(("%hrc=%Rhrc %#x\n", hrc, hrc));
-                            AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: WideCharToMultiByte failed, hr=%Rhrc (0x%x) err=%u\n", hrc, hrc, err));
+                            AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: WideCharToMultiByte failed, hr=%Rhrc (0x%x) err=%u\n",
+                                                   hrc, hrc, err));
                         }
                     }
                     else
@@ -4542,7 +4933,8 @@ int Console::configNetwork(const char *pszDevice,
                 else
                 {
                     VBoxNetCfgWinReleaseINetCfg(pNc, FALSE /*fHasWriteLock*/);
-                    AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: VBoxNetCfgWinGetComponentByGuid failed, hrc (0x%x)", hrc));
+                    AssertLogRelMsgFailed(("NetworkAttachmentType_Bridged: VBoxNetCfgWinGetComponentByGuid failed, hrc (0x%x)",
+                                           hrc));
                     H();
                 }
 
@@ -4557,7 +4949,7 @@ int Console::configNetwork(const char *pszDevice,
                  * interface via the current FreeBSD vboxnetflt implementation.
                  */
                 if (!strncmp(pszBridgedIfName, RT_STR_TUPLE("tap"))) {
-                    hrc = attachToTapInterface(aNetworkAdapter);
+                    hrc = i_attachToTapInterface(aNetworkAdapter);
                     if (FAILED(hrc))
                     {
                         switch (hrc)
@@ -4568,7 +4960,8 @@ int Console::configNetwork(const char *pszDevice,
                                                 "permissions of that node, and that the net.link.tap.user_open "
                                                 "sysctl is set.  Either run 'chmod 0666 /dev/%s' or "
                                                 "change the group of that node to vboxusers and make yourself "
-                                                "a member of that group.  Make sure that these changes are permanent."), pszBridgedIfName, pszBridgedIfName);
+                                                "a member of that group.  Make sure that these changes are permanent."),
+                                                pszBridgedIfName, pszBridgedIfName);
                             default:
                                 AssertMsgFailed(("Could not attach to tap interface! Bad!\n"));
                                 return VMSetError(VMR3GetVM(mpUVM), VERR_HOSTIF_INIT_FAILED, RT_SRC_POS, N_(
@@ -4576,12 +4969,12 @@ int Console::configNetwork(const char *pszDevice,
                         }
                     }
 
-                    Assert((int)maTapFD[uInstance] >= 0);
-                    if ((int)maTapFD[uInstance] >= 0)
+                    Assert((intptr_t)maTapFD[uInstance] >= 0);
+                    if ((intptr_t)maTapFD[uInstance] >= 0)
                     {
                         InsertConfigString(pLunL0, "Driver", "HostInterface");
                         InsertConfigNode(pLunL0, "Config", &pCfg);
-                        InsertConfigInteger(pCfg, "FileHandle", maTapFD[uInstance]);
+                        InsertConfigInteger(pCfg, "FileHandle", (intptr_t)maTapFD[uInstance]);
                     }
                     break;
                 }
@@ -4599,9 +4992,9 @@ int Console::configNetwork(const char *pszDevice,
                         RTStrCopy(Req.ifr_name, sizeof(Req.ifr_name), pszBridgedIfName);
                         if (ioctl(iSock, SIOCGIFFLAGS, &Req) >= 0)
                             if ((Req.ifr_flags & IFF_UP) == 0)
-                                setVMRuntimeErrorCallbackF(0, "BridgedInterfaceDown",
-                                    N_("Bridged interface %s is down. Guest will not be able to use this interface"),
-                                    pszBridgedIfName);
+                                i_setVMRuntimeErrorCallbackF(0, "BridgedInterfaceDown",
+                                     N_("Bridged interface %s is down. Guest will not be able to use this interface"),
+                                     pszBridgedIfName);
 
                         close(iSock);
                     }
@@ -4871,7 +5264,8 @@ int Console::configNetwork(const char *pszDevice,
                 }
 
                 /* get the adapter's INetCfgComponent*/
-                hrc = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.raw(), pAdaptorComponent.asOutParam());
+                hrc = VBoxNetCfgWinGetComponentByGuid(pNc, &GUID_DEVCLASS_NET, (GUID*)hostIFGuid.raw(),
+                                                      pAdaptorComponent.asOutParam());
                 if (hrc != S_OK)
                 {
                     VBoxNetCfgWinReleaseINetCfg(pNc, FALSE /*fHasWriteLock*/);
@@ -4897,7 +5291,8 @@ int Console::configNetwork(const char *pszDevice,
                         {
                             DWORD err = GetLastError();
                             hrc = HRESULT_FROM_WIN32(err);
-                            AssertLogRelMsgFailed(("NetworkAttachmentType_HostOnly: WideCharToMultiByte failed, hr=%Rhrc (0x%x) err=%u\n", hrc, hrc, err));
+                            AssertLogRelMsgFailed(("NetworkAttachmentType_HostOnly: WideCharToMultiByte failed, hr=%Rhrc (0x%x) err=%u\n",
+                                                   hrc, hrc, err));
                         }
                     }
                     else
@@ -4918,26 +5313,59 @@ int Console::configNetwork(const char *pszDevice,
                 else
                 {
                     VBoxNetCfgWinReleaseINetCfg(pNc, FALSE /*fHasWriteLock*/);
-                    AssertLogRelMsgFailed(("NetworkAttachmentType_HostOnly: VBoxNetCfgWinGetComponentByGuid failed, hrc=%Rhrc (0x%x)\n", hrc, hrc));
+                    AssertLogRelMsgFailed(("NetworkAttachmentType_HostOnly: VBoxNetCfgWinGetComponentByGuid failed, hrc=%Rhrc (0x%x)\n",
+                                           hrc, hrc));
                     H();
                 }
 
 
                 CoTaskMemFree(pswzBindName);
 
+                /* Assume we should use the old NDIS5.1 version of driver which uses TRUNKTYPE_NETADP */
+                trunkType = TRUNKTYPE_NETADP;
+
+                HKEY hkParams;
+                hrc = pAdaptorComponent->OpenParamKey(&hkParams);
+                Assert(hrc == S_OK);
+                if (hrc == S_OK)
+                {
+                    WCHAR swzInfSection[16];
+                    DWORD dwSize = sizeof(swzInfSection);
+                    hrc = RegQueryValueExW(hkParams, L"InfSection", NULL, NULL, (LPBYTE)swzInfSection, &dwSize);
+                    if (hrc == S_OK)
+                    {
+                        if (!_wcsnicmp(swzInfSection, L"VBoxNetAdp6.ndi", sizeof(L"VBoxNetAdp6.ndi")/2))
+                        {
+                            /*
+                             * This is NDIS 6.x miniport, it relies on NetLwf filter to
+                             * run actual traffic. We use netflt attachment instead of
+                             * netadp, which is used in case of NDIS 5.x.
+                             */
+                            trunkType = TRUNKTYPE_NETFLT;
+                        }
+                    }
+                    RegCloseKey(hkParams);
+                }
+                else
+                {
+                    LogRel(("Console::i_configNetwork: INetCfgComponent::GetId(%s) failed, err (0x%x), "
+                            "falling back to NDIS5 attachment\n", pszTrunkName, hrc));
+                    /* Nothing to do here as the trunk type defaults to NETADP */
+                }
+                InsertConfigInteger(pCfg, "TrunkType", trunkType == TRUNKTYPE_NETFLT ? kIntNetTrunkType_NetFlt : kIntNetTrunkType_NetAdp);
+
                 pAdaptorComponent.setNull();
                 /* release the pNc finally */
                 VBoxNetCfgWinReleaseINetCfg(pNc, FALSE /*fHasWriteLock*/);
 
                 const char *pszTrunk = szTrunkName;
 
-                InsertConfigInteger(pCfg, "TrunkType", kIntNetTrunkType_NetAdp);
                 InsertConfigString(pCfg, "Trunk", pszTrunk);
                 InsertConfigString(pCfg, "Network", szNetwork);
-                InsertConfigInteger(pCfg, "IgnoreConnectFailure", (uint64_t)fIgnoreConnectFailure); /** @todo why is this windows only?? */
+                InsertConfigInteger(pCfg, "IgnoreConnectFailure", (uint64_t)fIgnoreConnectFailure); /** @todo why is this
+                                                                                                        windows only?? */
                 networkName = Bstr(szNetwork);
                 trunkName   = Bstr(pszTrunk);
-                trunkType   = TRUNKTYPE_NETADP;
 # endif /* defined VBOX_WITH_NETFLT*/
 #elif defined(RT_OS_DARWIN)
                 InsertConfigString(pCfg, "Trunk", pszHostOnlyName);
@@ -5220,7 +5648,7 @@ int configSetGlobalPropertyFlags(VMMDev * const pVMMDev,
  * Set up the Guest Property service, populate it with properties read from
  * the machine XML and set a couple of initial properties.
  */
-/* static */ int Console::configGuestProperties(void *pvConsole, PUVM pUVM)
+/* static */ int Console::i_configGuestProperties(void *pvConsole, PUVM pUVM)
 {
 #ifdef VBOX_WITH_GUEST_PROPS
     AssertReturn(pvConsole, VERR_INVALID_POINTER);
@@ -5296,7 +5724,7 @@ int configSetGlobalPropertyFlags(VMMDev * const pVMMDev,
         {
             for (unsigned i = 0; RT_SUCCESS(rc) && i < cProps; ++i)
             {
-                AssertPtrReturn(namesOut[i], VERR_INVALID_PARAMETER);
+                AssertPtrBreakStmt(namesOut[i], rc = VERR_INVALID_PARAMETER);
                 rc = RTUtf16ToUtf8(namesOut[i], &papszNames[i]);
                 if (RT_FAILURE(rc))
                     break;
@@ -5357,7 +5785,7 @@ int configSetGlobalPropertyFlags(VMMDev * const pVMMDev,
          */
         HGCMSVCEXTHANDLE hDummy;
         HGCMHostRegisterServiceExtension(&hDummy, "VBoxGuestPropSvc",
-                                         Console::doGuestPropNotification,
+                                         Console::i_doGuestPropNotification,
                                          pvConsole);
 
 #ifdef VBOX_WITH_GUEST_PROPS_RDONLY_GUEST
@@ -5377,7 +5805,7 @@ int configSetGlobalPropertyFlags(VMMDev * const pVMMDev,
 /**
  * Set up the Guest Control service.
  */
-/* static */ int Console::configGuestControl(void *pvConsole)
+/* static */ int Console::i_configGuestControl(void *pvConsole)
 {
 #ifdef VBOX_WITH_GUEST_CONTROL
     AssertReturn(pvConsole, VERR_INVALID_POINTER);
@@ -5396,12 +5824,12 @@ int configSetGlobalPropertyFlags(VMMDev * const pVMMDev,
     {
         HGCMSVCEXTHANDLE hDummy;
         rc = HGCMHostRegisterServiceExtension(&hDummy, "VBoxGuestControlSvc",
-                                              &Guest::notifyCtrlDispatcher,
-                                              pConsole->getGuest());
+                                              &Guest::i_notifyCtrlDispatcher,
+                                              pConsole->i_getGuest());
         if (RT_FAILURE(rc))
             Log(("Cannot register VBoxGuestControlSvc extension!\n"));
         else
-            Log(("VBoxGuestControlSvc loaded\n"));
+            LogRel(("Guest Control service loaded\n"));
     }
 
     return rc;
diff --git a/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp b/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
index e5666f3..988ddd4 100644
--- a/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
+++ b/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -228,8 +228,8 @@ static int teleporterTcpReadLine(TeleporterState *pState, char *pszBuf, size_t c
  * @remarks the setError laziness forces this to be a Console member.
  */
 HRESULT
-Console::teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich,
-                              const char *pszNAckMsg /*= NULL*/)
+Console::i_teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich,
+                                const char *pszNAckMsg /*= NULL*/)
 {
     char szMsg[256];
     int vrc = teleporterTcpReadLine(pState, szMsg, sizeof(szMsg));
@@ -292,15 +292,14 @@ Console::teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich,
  *
  * @remarks the setError laziness forces this to be a Console member.
  */
-HRESULT
-Console::teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck /*= true*/)
+HRESULT Console::i_teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck /*= true*/)
 {
     int vrc = RTTcpSgWriteL(pState->mhSocket, 2, pszCommand, strlen(pszCommand), "\n", sizeof("\n") - 1);
     if (RT_FAILURE(vrc))
         return setError(E_FAIL, tr("Failed writing command '%s': %Rrc"), pszCommand, vrc);
     if (!fWaitForAck)
         return S_OK;
-    return teleporterSrcReadACK(pState, pszCommand);
+    return i_teleporterSrcReadACK(pState, pszCommand);
 }
 
 
@@ -624,8 +623,7 @@ static DECLCALLBACK(void) teleporterDstTimeout(RTTIMERLR hTimerLR, void *pvUser,
  * @returns VBox status code.
  * @param   pState              The teleporter state.
  */
-HRESULT
-Console::teleporterSrc(TeleporterStateSrc *pState)
+HRESULT Console::i_teleporterSrc(TeleporterStateSrc *pState)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -669,7 +667,7 @@ Console::teleporterSrc(TeleporterStateSrc *pState)
         return setError(E_FAIL, tr("Failed to send password: %Rrc"), vrc);
 
     /* ACK */
-    hrc = teleporterSrcReadACK(pState, "password", tr("Invalid password"));
+    hrc = i_teleporterSrcReadACK(pState, "password", tr("Invalid password"));
     if (FAILED(hrc))
         return hrc;
 
@@ -680,7 +678,7 @@ Console::teleporterSrc(TeleporterStateSrc *pState)
      *       verified against the VM config on the other end.  This is all done
      *       in the first pass, so we should fail pretty promptly on misconfig.
      */
-    hrc = teleporterSrcSubmitCommand(pState, "load");
+    hrc = i_teleporterSrcSubmitCommand(pState, "load");
     if (FAILED(hrc))
         return hrc;
 
@@ -697,23 +695,23 @@ Console::teleporterSrc(TeleporterStateSrc *pState)
         if (   vrc == VERR_SSM_CANCELLED
             && RT_SUCCESS(RTTcpSelectOne(pState->mhSocket, 1)))
         {
-            hrc = teleporterSrcReadACK(pState, "load-complete");
+            hrc = i_teleporterSrcReadACK(pState, "load-complete");
             if (FAILED(hrc))
                 return hrc;
         }
         return setError(E_FAIL, tr("VMR3Teleport -> %Rrc"), vrc);
     }
 
-    hrc = teleporterSrcReadACK(pState, "load-complete");
+    hrc = i_teleporterSrcReadACK(pState, "load-complete");
     if (FAILED(hrc))
         return hrc;
 
     /*
      * We're at the point of no return.
      */
-    if (!pState->mptrProgress->notifyPointOfNoReturn())
+    if (!pState->mptrProgress->i_notifyPointOfNoReturn())
     {
-        teleporterSrcSubmitCommand(pState, "cancel", false /*fWaitForAck*/);
+        i_teleporterSrcSubmitCommand(pState, "cancel", false /*fWaitForAck*/);
         return E_FAIL;
     }
 
@@ -728,7 +726,7 @@ Console::teleporterSrc(TeleporterStateSrc *pState)
         return hrc;
     pState->mfUnlockedMedia = true;
 
-    hrc = teleporterSrcSubmitCommand(pState, "lock-media");
+    hrc = i_teleporterSrcSubmitCommand(pState, "lock-media");
     if (FAILED(hrc))
         return hrc;
 
@@ -737,9 +735,9 @@ Console::teleporterSrc(TeleporterStateSrc *pState)
      */
     if (    vrc == VINF_SSM_LIVE_SUSPENDED
         ||  pState->menmOldMachineState == MachineState_Paused)
-        hrc = teleporterSrcSubmitCommand(pState, "hand-over-paused");
+        hrc = i_teleporterSrcSubmitCommand(pState, "hand-over-paused");
     else
-        hrc = teleporterSrcSubmitCommand(pState, "hand-over-resume");
+        hrc = i_teleporterSrcSubmitCommand(pState, "hand-over-resume");
     if (FAILED(hrc))
         return hrc;
 
@@ -759,7 +757,7 @@ Console::teleporterSrc(TeleporterStateSrc *pState)
  * @param   pvUser              Pointer to a TeleporterStateSrc instance.
  */
 /*static*/ DECLCALLBACK(int)
-Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
+Console::i_teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
 {
     TeleporterStateSrc *pState = (TeleporterStateSrc *)pvUser;
 
@@ -771,7 +769,7 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
     HRESULT hrc = ptrVM.rc();
 
     if (SUCCEEDED(hrc))
-        hrc = pState->mptrConsole->teleporterSrc(pState);
+        hrc = pState->mptrConsole->i_teleporterSrc(pState);
 
     /* Close the connection ASAP on so that the other side can complete. */
     if (pState->mhSocket != NIL_RTSOCKET)
@@ -783,10 +781,10 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
     /* Aaarg! setMachineState trashes error info on Windows, so we have to
        complete things here on failure instead of right before cleanup. */
     if (FAILED(hrc))
-        pState->mptrProgress->notifyComplete(hrc);
+        pState->mptrProgress->i_notifyComplete(hrc);
 
     /* We can no longer be canceled (success), or it doesn't matter any longer (failure). */
-    pState->mptrProgress->setCancelCallback(NULL, NULL);
+    pState->mptrProgress->i_setCancelCallback(NULL, NULL);
 
     /*
      * Write lock the console before resetting mptrCancelableProgress and
@@ -806,19 +804,20 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
          *       powerDown.
          */
         AssertLogRelMsg(enmVMState == VMSTATE_SUSPENDED, ("%s\n", VMR3GetStateName(enmVMState)));
-        AssertLogRelMsg(enmMachineState == MachineState_TeleportingPausedVM, ("%s\n", Global::stringifyMachineState(enmMachineState)));
+        AssertLogRelMsg(enmMachineState == MachineState_TeleportingPausedVM,
+                        ("%s\n", Global::stringifyMachineState(enmMachineState)));
 
         ptrVM.release();
 
         pState->mptrConsole->mVMIsAlreadyPoweringOff = true; /* (Make sure we stick in the TeleportingPausedVM state.) */
         autoLock.release();
 
-        hrc = pState->mptrConsole->powerDown();
+        hrc = pState->mptrConsole->i_powerDown();
 
         autoLock.acquire();
         pState->mptrConsole->mVMIsAlreadyPoweringOff = false;
 
-        pState->mptrProgress->notifyComplete(hrc);
+        pState->mptrProgress->i_notifyComplete(hrc);
     }
     else
     {
@@ -865,17 +864,17 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
                 case VMSTATE_RESETTING_LS:
                     Assert(!pState->mfSuspendedByUs);
                     Assert(!pState->mfUnlockedMedia);
-                    pState->mptrConsole->setMachineState(MachineState_Running);
+                    pState->mptrConsole->i_setMachineState(MachineState_Running);
                     break;
 
                 case VMSTATE_GURU_MEDITATION:
                 case VMSTATE_GURU_MEDITATION_LS:
-                    pState->mptrConsole->setMachineState(MachineState_Stuck);
+                    pState->mptrConsole->i_setMachineState(MachineState_Stuck);
                     break;
 
                 case VMSTATE_FATAL_ERROR:
                 case VMSTATE_FATAL_ERROR_LS:
-                    pState->mptrConsole->setMachineState(MachineState_Paused);
+                    pState->mptrConsole->i_setMachineState(MachineState_Paused);
                     break;
 
                 default:
@@ -887,7 +886,7 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
                 case VMSTATE_SUSPENDING_EXT_LS:
                     if (!pState->mfUnlockedMedia)
                     {
-                        pState->mptrConsole->setMachineState(MachineState_Paused);
+                        pState->mptrConsole->i_setMachineState(MachineState_Paused);
                         if (pState->mfSuspendedByUs)
                         {
                             autoLock.release();
@@ -899,7 +898,7 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
                     else
                     {
                         /* Faking a guru meditation is the best I can think of doing here... */
-                        pState->mptrConsole->setMachineState(MachineState_Stuck);
+                        pState->mptrConsole->i_setMachineState(MachineState_Stuck);
                     }
                     break;
             }
@@ -928,19 +927,13 @@ Console::teleporterSrcThreadWrapper(RTTHREAD hThread, void *pvUser)
  * @param   aMaxDowntime    Max allowed "downtime" in milliseconds.
  * @param   aProgress       Where to return the progress object.
  */
-STDMETHODIMP
-Console::Teleport(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress)
+HRESULT Console::teleport(const com::Utf8Str &aHostname, ULONG aTcpport, const com::Utf8Str &aPassword,
+                          ULONG aMaxDowntime, ComPtr<IProgress> &aProgress)
 {
     /*
      * Validate parameters, check+hold object status, write lock the object
      * and validate the state.
      */
-    CheckComArgOutPointerValid(aProgress);
-    CheckComArgStrNotEmptyOrNull(aHostname);
-    CheckComArgNotNull(aPassword);
-    CheckComArgExprMsg(aPort, aPort > 0 && aPort <= 65535, ("is %u", aPort));
-    CheckComArgExprMsg(aMaxDowntime, aMaxDowntime > 0, ("is %u", aMaxDowntime));
-
     Utf8Str strPassword(aPassword);
     if (!strPassword.isEmpty())
     {
@@ -986,31 +979,31 @@ Console::Teleport(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxD
     TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpUVM, ptrProgress, mMachineState);
     pState->mstrPassword    = strPassword;
     pState->mstrHostname    = aHostname;
-    pState->muPort          = aPort;
+    pState->muPort          = aTcpport;
     pState->mcMsMaxDowntime = aMaxDowntime;
 
     void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState));
-    ptrProgress->setCancelCallback(teleporterProgressCancelCallback, pvUser);
+    ptrProgress->i_setCancelCallback(teleporterProgressCancelCallback, pvUser);
 
-    int vrc = RTThreadCreate(NULL, Console::teleporterSrcThreadWrapper, (void *)pState, 0 /*cbStack*/,
+    int vrc = RTThreadCreate(NULL, Console::i_teleporterSrcThreadWrapper, (void *)pState, 0 /*cbStack*/,
                              RTTHREADTYPE_EMULATION, 0 /*fFlags*/, "Teleport");
     if (RT_SUCCESS(vrc))
     {
         if (mMachineState == MachineState_Running)
-            hrc = setMachineState(MachineState_Teleporting);
+            hrc = i_setMachineState(MachineState_Teleporting);
         else
-            hrc = setMachineState(MachineState_TeleportingPausedVM);
+            hrc = i_setMachineState(MachineState_TeleportingPausedVM);
         if (SUCCEEDED(hrc))
         {
-            ptrProgress.queryInterfaceTo(aProgress);
-            mptrCancelableProgress = ptrProgress;
+            ptrProgress.queryInterfaceTo(aProgress.asOutParam());
+            mptrCancelableProgress = aProgress;
         }
         else
             ptrProgress->Cancel();
     }
     else
     {
-        ptrProgress->setCancelCallback(NULL, NULL);
+        ptrProgress->i_setCancelCallback(NULL, NULL);
         delete pState;
         hrc = setError(E_FAIL, tr("RTThreadCreate -> %Rrc"), vrc);
     }
@@ -1036,9 +1029,8 @@ Console::Teleport(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxD
  * @remarks The caller expects error information to be set on failure.
  * @todo    Check that all the possible failure paths sets error info...
  */
-HRESULT
-Console::teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
-                       Progress *pProgress, bool *pfPowerOffOnFailure)
+HRESULT Console::i_teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused,
+                                 Progress *pProgress, bool *pfPowerOffOnFailure)
 {
     LogThisFunc(("pUVM=%p pMachine=%p fStartPaused=%RTbool pProgress=%p\n", pUVM, pMachine, fStartPaused, pProgress));
 
@@ -1114,14 +1106,14 @@ Console::teleporterTrg(PUVM pUVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool f
             theState.mhServer          = hServer;
 
             void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(&theState));
-            if (pProgress->setCancelCallback(teleporterProgressCancelCallback, pvUser))
+            if (pProgress->i_setCancelCallback(teleporterProgressCancelCallback, pvUser))
             {
                 LogRel(("Teleporter: Waiting for incoming VM...\n"));
                 hrc = pProgress->SetNextOperation(Bstr(tr("Waiting for incoming VM")).raw(), 1);
                 if (SUCCEEDED(hrc))
                 {
-                    vrc = RTTcpServerListen(hServer, Console::teleporterTrgServeConnection, &theState);
-                    pProgress->setCancelCallback(NULL, NULL);
+                    vrc = RTTcpServerListen(hServer, Console::i_teleporterTrgServeConnection, &theState);
+                    pProgress->i_setCancelCallback(NULL, NULL);
 
                     if (vrc == VERR_TCP_SERVER_STOP)
                     {
@@ -1255,7 +1247,7 @@ static int teleporterTcpWriteNACK(TeleporterStateTrg *pState, int32_t rc2, const
  * @returns VINF_SUCCESS or VERR_TCP_SERVER_STOP.
  */
 /*static*/ DECLCALLBACK(int)
-Console::teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser)
+Console::i_teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser)
 {
     TeleporterStateTrg *pState = (TeleporterStateTrg *)pvUser;
     pState->mhSocket = Sock;
@@ -1343,7 +1335,7 @@ Console::teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser)
                 break;
 
             int vrc2 = VMR3AtErrorRegister(pState->mpUVM,
-                                           Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2);
+                                           Console::i_genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2);
             RTSocketRetain(pState->mhSocket); /* For concurrent access by I/O thread and EMT. */
             pState->moffStream = 0;
 
@@ -1353,7 +1345,8 @@ Console::teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser)
                                      teleporterProgressCallback, pvUser2);
 
             RTSocketRelease(pState->mhSocket);
-            vrc2 = VMR3AtErrorDeregister(pState->mpUVM, Console::genericVMSetErrorCallback, &pState->mErrorText); AssertRC(vrc2);
+            vrc2 = VMR3AtErrorDeregister(pState->mpUVM, Console::i_genericVMSetErrorCallback, &pState->mErrorText);
+            AssertRC(vrc2);
 
             if (RT_FAILURE(vrc))
             {
@@ -1409,7 +1402,7 @@ Console::teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser)
              *       NACK) the request since this would reduce latency and
              *       make it possible to recover from some VMR3Resume failures.
              */
-            if (   pState->mptrProgress->notifyPointOfNoReturn()
+            if (   pState->mptrProgress->i_notifyPointOfNoReturn()
                 && pState->mfLockedMedia)
             {
                 vrc = teleporterTcpWriteACK(pState);
@@ -1418,7 +1411,7 @@ Console::teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser)
                     if (!strcmp(szCmd, "hand-over-resume"))
                         vrc = VMR3Resume(pState->mpUVM, VMRESUMEREASON_TELEPORTED);
                     else
-                        pState->mptrConsole->setMachineState(MachineState_Paused);
+                        pState->mptrConsole->i_setMachineState(MachineState_Paused);
                     fDone = true;
                     break;
                 }
diff --git a/src/VBox/Main/src-client/ConsoleVRDPServer.cpp b/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
index 4247f2f..0f61397 100644
--- a/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
+++ b/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
@@ -1,10 +1,10 @@
 /* $Id: ConsoleVRDPServer.cpp $ */
 /** @file
- * VBox Console VRDP Helper class
+ * VBox Console VRDP helper class.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,7 +20,11 @@
 #include "DisplayImpl.h"
 #include "KeyboardImpl.h"
 #include "MouseImpl.h"
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+#include "DrvAudioVRDE.h"
+#else
 #include "AudioSnifferInterface.h"
+#endif
 #ifdef VBOX_WITH_EXTPACK
 # include "ExtPackManagerImpl.h"
 #endif
@@ -83,7 +87,7 @@ public:
                 mpscev->COMGETTER(Height)(&height);
                 mpscev->COMGETTER(Shape)(ComSafeArrayAsOutParam(shape));
 
-                OnMousePointerShapeChange(visible, alpha, xHot, yHot, width, height, ComSafeArrayAsInParam(shape));
+                m_server->onMousePointerShapeChange(visible, alpha, xHot, yHot, width, height, ComSafeArrayAsInParam(shape));
                 break;
             }
             case VBoxEventType_OnMouseCapabilityChanged:
@@ -122,8 +126,6 @@ public:
     }
 
 private:
-    STDMETHOD(OnMousePointerShapeChange)(BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot,
-                                         ULONG width, ULONG height, ComSafeArrayIn(BYTE,shape));
     ConsoleVRDPServer *m_server;
 };
 
@@ -192,7 +194,8 @@ void dumpPointer(const uint8_t *pu8Shape, uint32_t width, uint32_t height, bool
 #define dumpPointer(a, b, c, d) do {} while (0)
 #endif /* DEBUG_sunlover */
 
-static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMask, uint32_t width, uint32_t height, uint32_t *pxSkip, uint32_t *pySkip)
+static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMask, uint32_t width,
+                              uint32_t height, uint32_t *pxSkip, uint32_t *pySkip)
 {
     /*
      * Find the top border of the AND mask. First assign to special value.
@@ -352,175 +355,174 @@ static void mousePointerGenerateANDMask(uint8_t *pu8DstAndMask, int cbDstAndMask
     }
 }
 
-STDMETHODIMP VRDPConsoleListener::OnMousePointerShapeChange(BOOL visible,
-                                                            BOOL alpha,
-                                                            ULONG xHot,
-                                                            ULONG yHot,
-                                                            ULONG width,
-                                                            ULONG height,
-                                                            ComSafeArrayIn(BYTE,inShape))
+void ConsoleVRDPServer::onMousePointerShapeChange(BOOL visible,
+                                                  BOOL alpha,
+                                                  ULONG xHot,
+                                                  ULONG yHot,
+                                                  ULONG width,
+                                                  ULONG height,
+                                                  ComSafeArrayIn(BYTE,inShape))
 {
-    LogSunlover(("VRDPConsoleListener::OnMousePointerShapeChange: %d, %d, %lux%lu, @%lu,%lu\n", visible, alpha, width, height, xHot, yHot));
+    LogSunlover(("VRDPConsoleListener::OnMousePointerShapeChange: %d, %d, %lux%lu, @%lu,%lu\n",
+                 visible, alpha, width, height, xHot, yHot));
 
-    if (m_server)
+    com::SafeArray <BYTE> aShape(ComSafeArrayInArg(inShape));
+    if (aShape.size() == 0)
     {
-        com::SafeArray <BYTE> aShape(ComSafeArrayInArg(inShape));
-        if (aShape.size() == 0)
+        if (!visible)
         {
-            if (!visible)
-            {
-                m_server->MousePointerHide();
-            }
+            MousePointerHide();
         }
-        else if (width != 0 && height != 0)
-        {
-            uint8_t* shape = aShape.raw();
+    }
+    else if (width != 0 && height != 0)
+    {
+        uint8_t* shape = aShape.raw();
 
-            dumpPointer(shape, width, height, true);
+        dumpPointer(shape, width, height, true);
 
-            if (m_server->MousePointer(alpha, xHot, yHot, width, height, shape) == VINF_SUCCESS)
-            {
-                return S_OK;
-            }
+        /* Try the new interface. */
+        if (MousePointer(alpha, xHot, yHot, width, height, shape) == VINF_SUCCESS)
+        {
+            return;
+        }
 
-            /* Pointer consists of 1 bpp AND and 24 BPP XOR masks.
-             * 'shape' AND mask followed by XOR mask.
-             * XOR mask contains 32 bit (lsb)BGR0(msb) values.
-             *
-             * We convert this to RDP color format which consist of
-             * one bpp AND mask and 24 BPP (BGR) color XOR image.
-             *
-             * RDP clients expect 8 aligned width and height of
-             * pointer (preferably 32x32).
-             *
-             * They even contain bugs which do not appear for
-             * 32x32 pointers but would appear for a 41x32 one.
-             *
-             * So set pointer size to 32x32. This can be done safely
-             * because most pointers are 32x32.
-             */
+        /* Continue with the old interface. */
 
-            int cbDstAndMask = (((width + 7) / 8) * height + 3) & ~3;
+        /* Pointer consists of 1 bpp AND and 24 BPP XOR masks.
+         * 'shape' AND mask followed by XOR mask.
+         * XOR mask contains 32 bit (lsb)BGR0(msb) values.
+         *
+         * We convert this to RDP color format which consist of
+         * one bpp AND mask and 24 BPP (BGR) color XOR image.
+         *
+         * RDP clients expect 8 aligned width and height of
+         * pointer (preferably 32x32).
+         *
+         * They even contain bugs which do not appear for
+         * 32x32 pointers but would appear for a 41x32 one.
+         *
+         * So set pointer size to 32x32. This can be done safely
+         * because most pointers are 32x32.
+         */
 
-            uint8_t *pu8AndMask = shape;
-            uint8_t *pu8XorMask = shape + cbDstAndMask;
+        int cbDstAndMask = (((width + 7) / 8) * height + 3) & ~3;
 
-            if (alpha)
-            {
-                pu8AndMask = (uint8_t*)alloca(cbDstAndMask);
+        uint8_t *pu8AndMask = shape;
+        uint8_t *pu8XorMask = shape + cbDstAndMask;
 
-                mousePointerGenerateANDMask(pu8AndMask, cbDstAndMask, pu8XorMask, width, height);
-            }
+        if (alpha)
+        {
+            pu8AndMask = (uint8_t*)alloca(cbDstAndMask);
 
-            /* Windows guest alpha pointers are wider than 32 pixels.
-             * Try to find out the top-left border of the pointer and
-             * then copy only meaningful bits. All complete top rows
-             * and all complete left columns where (AND == 1 && XOR == 0)
-             * are skipped. Hot spot is adjusted.
-             */
-            uint32_t ySkip = 0; /* How many rows to skip at the top. */
-            uint32_t xSkip = 0; /* How many columns to skip at the left. */
+            mousePointerGenerateANDMask(pu8AndMask, cbDstAndMask, pu8XorMask, width, height);
+        }
 
-            findTopLeftBorder(pu8AndMask, pu8XorMask, width, height, &xSkip, &ySkip);
+        /* Windows guest alpha pointers are wider than 32 pixels.
+         * Try to find out the top-left border of the pointer and
+         * then copy only meaningful bits. All complete top rows
+         * and all complete left columns where (AND == 1 && XOR == 0)
+         * are skipped. Hot spot is adjusted.
+         */
+        uint32_t ySkip = 0; /* How many rows to skip at the top. */
+        uint32_t xSkip = 0; /* How many columns to skip at the left. */
 
-            /* Must not skip the hot spot. */
-            xSkip = RT_MIN(xSkip, xHot);
-            ySkip = RT_MIN(ySkip, yHot);
+        findTopLeftBorder(pu8AndMask, pu8XorMask, width, height, &xSkip, &ySkip);
 
-            /*
-             * Compute size and allocate memory for the pointer.
-             */
-            const uint32_t dstwidth = 32;
-            const uint32_t dstheight = 32;
+        /* Must not skip the hot spot. */
+        xSkip = RT_MIN(xSkip, xHot);
+        ySkip = RT_MIN(ySkip, yHot);
+
+        /*
+         * Compute size and allocate memory for the pointer.
+         */
+        const uint32_t dstwidth = 32;
+        const uint32_t dstheight = 32;
 
-            VRDECOLORPOINTER *pointer = NULL;
+        VRDECOLORPOINTER *pointer = NULL;
 
-            uint32_t dstmaskwidth = (dstwidth + 7) / 8;
+        uint32_t dstmaskwidth = (dstwidth + 7) / 8;
 
-            uint32_t rdpmaskwidth = dstmaskwidth;
-            uint32_t rdpmasklen = dstheight * rdpmaskwidth;
+        uint32_t rdpmaskwidth = dstmaskwidth;
+        uint32_t rdpmasklen = dstheight * rdpmaskwidth;
 
-            uint32_t rdpdatawidth = dstwidth * 3;
-            uint32_t rdpdatalen = dstheight * rdpdatawidth;
+        uint32_t rdpdatawidth = dstwidth * 3;
+        uint32_t rdpdatalen = dstheight * rdpdatawidth;
 
-            pointer = (VRDECOLORPOINTER *)RTMemTmpAlloc(sizeof(VRDECOLORPOINTER) + rdpmasklen + rdpdatalen);
+        pointer = (VRDECOLORPOINTER *)RTMemTmpAlloc(sizeof(VRDECOLORPOINTER) + rdpmasklen + rdpdatalen);
 
-            if (pointer)
-            {
-                uint8_t *maskarray = (uint8_t*)pointer + sizeof(VRDECOLORPOINTER);
-                uint8_t *dataarray = maskarray + rdpmasklen;
+        if (pointer)
+        {
+            uint8_t *maskarray = (uint8_t*)pointer + sizeof(VRDECOLORPOINTER);
+            uint8_t *dataarray = maskarray + rdpmasklen;
 
-                memset(maskarray, 0xFF, rdpmasklen);
-                memset(dataarray, 0x00, rdpdatalen);
+            memset(maskarray, 0xFF, rdpmasklen);
+            memset(dataarray, 0x00, rdpdatalen);
 
-                uint32_t srcmaskwidth = (width + 7) / 8;
-                uint32_t srcdatawidth = width * 4;
+            uint32_t srcmaskwidth = (width + 7) / 8;
+            uint32_t srcdatawidth = width * 4;
 
-                /* Copy AND mask. */
-                uint8_t *src = pu8AndMask + ySkip * srcmaskwidth;
-                uint8_t *dst = maskarray + (dstheight - 1) * rdpmaskwidth;
+            /* Copy AND mask. */
+            uint8_t *src = pu8AndMask + ySkip * srcmaskwidth;
+            uint8_t *dst = maskarray + (dstheight - 1) * rdpmaskwidth;
 
-                uint32_t minheight = RT_MIN(height - ySkip, dstheight);
-                uint32_t minwidth = RT_MIN(width - xSkip, dstwidth);
+            uint32_t minheight = RT_MIN(height - ySkip, dstheight);
+            uint32_t minwidth = RT_MIN(width - xSkip, dstwidth);
 
-                unsigned x, y;
+            unsigned x, y;
 
-                for (y = 0; y < minheight; y++)
+            for (y = 0; y < minheight; y++)
+            {
+                for (x = 0; x < minwidth; x++)
                 {
-                    for (x = 0; x < minwidth; x++)
-                    {
-                        uint32_t byteIndex = (x + xSkip) / 8;
-                        uint32_t bitIndex = (x + xSkip) % 8;
+                    uint32_t byteIndex = (x + xSkip) / 8;
+                    uint32_t bitIndex = (x + xSkip) % 8;
 
-                        bool bit = (src[byteIndex] & (1 << (7 - bitIndex))) != 0;
+                    bool bit = (src[byteIndex] & (1 << (7 - bitIndex))) != 0;
 
-                        if (!bit)
-                        {
-                            byteIndex = x / 8;
-                            bitIndex = x % 8;
+                    if (!bit)
+                    {
+                        byteIndex = x / 8;
+                        bitIndex = x % 8;
 
-                            dst[byteIndex] &= ~(1 << (7 - bitIndex));
-                        }
+                        dst[byteIndex] &= ~(1 << (7 - bitIndex));
                     }
-
-                    src += srcmaskwidth;
-                    dst -= rdpmaskwidth;
                 }
 
-                /* Point src to XOR mask */
-                src = pu8XorMask + ySkip * srcdatawidth;
-                dst = dataarray + (dstheight - 1) * rdpdatawidth;
+                src += srcmaskwidth;
+                dst -= rdpmaskwidth;
+            }
 
-                for (y = 0; y < minheight ; y++)
-                {
-                    for (x = 0; x < minwidth; x++)
-                    {
-                        memcpy(dst + x * 3, &src[4 * (x + xSkip)], 3);
-                    }
+            /* Point src to XOR mask */
+            src = pu8XorMask + ySkip * srcdatawidth;
+            dst = dataarray + (dstheight - 1) * rdpdatawidth;
 
-                    src += srcdatawidth;
-                    dst -= rdpdatawidth;
+            for (y = 0; y < minheight ; y++)
+            {
+                for (x = 0; x < minwidth; x++)
+                {
+                    memcpy(dst + x * 3, &src[4 * (x + xSkip)], 3);
                 }
 
-                pointer->u16HotX = (uint16_t)(xHot - xSkip);
-                pointer->u16HotY = (uint16_t)(yHot - ySkip);
+                src += srcdatawidth;
+                dst -= rdpdatawidth;
+            }
+
+            pointer->u16HotX = (uint16_t)(xHot - xSkip);
+            pointer->u16HotY = (uint16_t)(yHot - ySkip);
 
-                pointer->u16Width = (uint16_t)dstwidth;
-                pointer->u16Height = (uint16_t)dstheight;
+            pointer->u16Width = (uint16_t)dstwidth;
+            pointer->u16Height = (uint16_t)dstheight;
 
-                pointer->u16MaskLen = (uint16_t)rdpmasklen;
-                pointer->u16DataLen = (uint16_t)rdpdatalen;
+            pointer->u16MaskLen = (uint16_t)rdpmasklen;
+            pointer->u16DataLen = (uint16_t)rdpdatalen;
 
-                dumpPointer((uint8_t*)pointer + sizeof(*pointer), dstwidth, dstheight, false);
+            dumpPointer((uint8_t*)pointer + sizeof(*pointer), dstwidth, dstheight, false);
 
-                m_server->MousePointerUpdate(pointer);
+            MousePointerUpdate(pointer);
 
-                RTMemTmpFree(pointer);
-            }
+            RTMemTmpFree(pointer);
         }
     }
-
-    return S_OK;
 }
 
 
@@ -552,7 +554,8 @@ VRDECALLBACKS_4 ConsoleVRDPServer::mCallbacks =
     ConsoleVRDPServer::VRDECallbackAudioIn
 };
 
-DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut)
+DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback, uint32_t index, void *pvBuffer,
+                                                               uint32_t cbBuffer, uint32_t *pcbOut)
 {
     ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
 
@@ -581,7 +584,7 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
         case VRDE_QP_NETWORK_ADDRESS:
         {
             com::Bstr bstr;
-            server->mConsole->getVRDEServer()->GetVRDEProperty(Bstr("TCP/Address").raw(), bstr.asOutParam());
+            server->mConsole->i_getVRDEServer()->GetVRDEProperty(Bstr("TCP/Address").raw(), bstr.asOutParam());
 
             /* The server expects UTF8. */
             com::Utf8Str address = bstr;
@@ -612,7 +615,7 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
         {
             ULONG cMonitors = 1;
 
-            server->mConsole->machine()->COMGETTER(MonitorCount)(&cMonitors);
+            server->mConsole->i_machine()->COMGETTER(MonitorCount)(&cMonitors);
 
             if (cbBuffer >= sizeof(uint32_t))
             {
@@ -630,7 +633,7 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
         case VRDE_QP_NETWORK_PORT_RANGE:
         {
             com::Bstr bstr;
-            HRESULT hrc = server->mConsole->getVRDEServer()->GetVRDEProperty(Bstr("TCP/Ports").raw(), bstr.asOutParam());
+            HRESULT hrc = server->mConsole->i_getVRDEServer()->GetVRDEProperty(Bstr("TCP/Ports").raw(), bstr.asOutParam());
 
             if (hrc != S_OK)
             {
@@ -647,9 +650,9 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
 
             size_t cbPortRange = portRange.length() + 1;
 
-            if (cbPortRange >= 0x10000)
+            if (cbPortRange >= _64K)
             {
-                /* More than 64K seems to be an  invalid port range string. */
+                /* More than 64K seems to be an invalid port range string. */
                 rc = VERR_TOO_MUCH_DATA;
                 break;
             }
@@ -670,7 +673,8 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
         case VRDE_QP_VIDEO_CHANNEL:
         {
             com::Bstr bstr;
-            HRESULT hrc = server->mConsole->getVRDEServer()->GetVRDEProperty(Bstr("VideoChannel/Enabled").raw(), bstr.asOutParam());
+            HRESULT hrc = server->mConsole->i_getVRDEServer()->GetVRDEProperty(Bstr("VideoChannel/Enabled").raw(),
+                                                                             bstr.asOutParam());
 
             if (hrc != S_OK)
             {
@@ -698,7 +702,8 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
         case VRDE_QP_VIDEO_CHANNEL_QUALITY:
         {
             com::Bstr bstr;
-            HRESULT hrc = server->mConsole->getVRDEServer()->GetVRDEProperty(Bstr("VideoChannel/Quality").raw(), bstr.asOutParam());
+            HRESULT hrc = server->mConsole->i_getVRDEServer()->GetVRDEProperty(Bstr("VideoChannel/Quality").raw(),
+                                                                             bstr.asOutParam());
 
             if (hrc != S_OK)
             {
@@ -727,7 +732,7 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
             ULONG ulSunFlsh = 1;
 
             com::Bstr bstr;
-            HRESULT hrc = server->mConsole->machine()->GetExtraData(Bstr("VRDP/SunFlsh").raw(),
+            HRESULT hrc = server->mConsole->i_machine()->GetExtraData(Bstr("VRDP/SunFlsh").raw(),
                                                                     bstr.asOutParam());
             if (hrc == S_OK && !bstr.isEmpty())
             {
@@ -790,16 +795,16 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
                 com::Utf8Str extraData("VRDE/Feature/");
                 extraData += pFeature->achInfo;
 
-                HRESULT hrc = server->mConsole->machine()->GetExtraData(com::Bstr(extraData).raw(),
-                                                                        bstrValue.asOutParam());
+                HRESULT hrc = server->mConsole->i_machine()->GetExtraData(com::Bstr(extraData).raw(),
+                                                                          bstrValue.asOutParam());
                 if (FAILED(hrc) || bstrValue.isEmpty())
                 {
                     /* Also try the old "VRDP/Feature/NAME" */
                     extraData = "VRDP/Feature/";
                     extraData += pFeature->achInfo;
 
-                    hrc = server->mConsole->machine()->GetExtraData(com::Bstr(extraData).raw(),
-                                                                    bstrValue.asOutParam());
+                    hrc = server->mConsole->i_machine()->GetExtraData(com::Bstr(extraData).raw(),
+                                                                      bstrValue.asOutParam());
                     if (FAILED(hrc))
                     {
                         rc = VERR_NOT_SUPPORTED;
@@ -810,7 +815,8 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
             {
                 /* Generic properties. */
                 const char *pszPropertyName = &pFeature->achInfo[9];
-                HRESULT hrc = server->mConsole->getVRDEServer()->GetVRDEProperty(Bstr(pszPropertyName).raw(), bstrValue.asOutParam());
+                HRESULT hrc = server->mConsole->i_getVRDEServer()->GetVRDEProperty(Bstr(pszPropertyName).raw(),
+                                                                                   bstrValue.asOutParam());
                 if (FAILED(hrc))
                 {
                     rc = VERR_NOT_SUPPORTED;
@@ -860,7 +866,7 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
                 *pcbOut = sizeof(uint32_t);
             }
 
-            server->mConsole->onVRDEServerInfoChange();
+            server->mConsole->i_onVRDEServerInfoChange();
         } break;
 
         case VRDE_SP_CLIENT_STATUS:
@@ -892,7 +898,7 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
 
             Log(("VRDE_SP_CLIENT_STATUS [%s]\n", pStatus->achStatus));
 
-            server->mConsole->VRDPClientStatusChange(pStatus->u32ClientId, pStatus->achStatus);
+            server->mConsole->i_VRDPClientStatusChange(pStatus->u32ClientId, pStatus->achStatus);
 
             rc = VINF_SUCCESS;
 
@@ -901,7 +907,7 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
                 *pcbOut = cbBuffer;
             }
 
-            server->mConsole->onVRDEServerInfoChange();
+            server->mConsole->i_onVRDEServerInfoChange();
         } break;
 
         default:
@@ -911,18 +917,19 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback
     return rc;
 }
 
-DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon(void *pvCallback, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain)
+DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon(void *pvCallback, uint32_t u32ClientId, const char *pszUser,
+                                                             const char *pszPassword, const char *pszDomain)
 {
     ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
 
-    return server->mConsole->VRDPClientLogon(u32ClientId, pszUser, pszPassword, pszDomain);
+    return server->mConsole->i_VRDPClientLogon(u32ClientId, pszUser, pszPassword, pszDomain);
 }
 
 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientConnect(void *pvCallback, uint32_t u32ClientId)
 {
     ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
 
-    server->mConsole->VRDPClientConnect(u32ClientId);
+    server->mConsole->i_VRDPClientConnect(u32ClientId);
 
     /* Should the server report usage of an interface for each client?
      * Similar to Intercept.
@@ -935,18 +942,25 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientConnect(void *pvCallback
     }
 }
 
-DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect(void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercepted)
+DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect(void *pvCallback, uint32_t u32ClientId,
+                                                                   uint32_t fu32Intercepted)
 {
-    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
+    ConsoleVRDPServer *pServer = static_cast<ConsoleVRDPServer*>(pvCallback);
+    AssertPtrReturnVoid(pServer);
 
-    server->mConsole->VRDPClientDisconnect(u32ClientId, fu32Intercepted);
+    pServer->mConsole->i_VRDPClientDisconnect(u32ClientId, fu32Intercepted);
 
-    if (ASMAtomicReadU32(&server->mu32AudioInputClientId) == u32ClientId)
+    if (ASMAtomicReadU32(&pServer->mu32AudioInputClientId) == u32ClientId)
     {
-        Log(("AUDIOIN: disconnected client %u\n", u32ClientId));
-        ASMAtomicWriteU32(&server->mu32AudioInputClientId, 0);
+        LogFunc(("Disconnected client %u\n", u32ClientId));
+        ASMAtomicWriteU32(&pServer->mu32AudioInputClientId, 0);
 
-        PPDMIAUDIOSNIFFERPORT pPort = server->mConsole->getAudioSniffer()->getAudioSnifferPort();
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+        AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE();
+        if (pVRDE)
+            pVRDE->onVRDEInputIntercept(false /* fIntercept */);
+#else
+        PPDMIAUDIOSNIFFERPORT pPort = pServer->mConsole->i_getAudioSniffer()->getAudioSnifferPort();
         if (pPort)
         {
              pPort->pfnAudioInputIntercept(pPort, false);
@@ -955,19 +969,22 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect(void *pvCallb
         {
             AssertFailed();
         }
+#endif
     }
 
-    int c = ASMAtomicDecS32(&server->mcClients);
-    if (c == 0)
+    int32_t cClients = ASMAtomicDecS32(&pServer->mcClients);
+    if (cClients == 0)
     {
         /* Features which should be enabled only if there is a client. */
-        server->remote3DRedirect(false);
+        pServer->remote3DRedirect(false);
     }
 }
 
-DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackIntercept(void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercept, void **ppvIntercept)
+DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackIntercept(void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercept,
+                                                           void **ppvIntercept)
 {
-    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
+    ConsoleVRDPServer *pServer = static_cast<ConsoleVRDPServer*>(pvCallback);
+    AssertPtrReturn(pServer, VERR_INVALID_POINTER);
 
     LogFlowFunc(("%x\n", fu32Intercept));
 
@@ -977,58 +994,62 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackIntercept(void *pvCallback, ui
     {
         case VRDE_CLIENT_INTERCEPT_AUDIO:
         {
-            server->mConsole->VRDPInterceptAudio(u32ClientId);
+            pServer->mConsole->i_VRDPInterceptAudio(u32ClientId);
             if (ppvIntercept)
             {
-                *ppvIntercept = server;
+                *ppvIntercept = pServer;
             }
             rc = VINF_SUCCESS;
         } break;
 
         case VRDE_CLIENT_INTERCEPT_USB:
         {
-            server->mConsole->VRDPInterceptUSB(u32ClientId, ppvIntercept);
+            pServer->mConsole->i_VRDPInterceptUSB(u32ClientId, ppvIntercept);
             rc = VINF_SUCCESS;
         } break;
 
         case VRDE_CLIENT_INTERCEPT_CLIPBOARD:
         {
-            server->mConsole->VRDPInterceptClipboard(u32ClientId);
+            pServer->mConsole->i_VRDPInterceptClipboard(u32ClientId);
             if (ppvIntercept)
             {
-                *ppvIntercept = server;
+                *ppvIntercept = pServer;
             }
             rc = VINF_SUCCESS;
         } break;
 
         case VRDE_CLIENT_INTERCEPT_AUDIO_INPUT:
         {
-            /* This request is processed internally by the ConsoleVRDPServer.
+            /*
+             * This request is processed internally by the ConsoleVRDPServer.
              * Only one client is allowed to intercept audio input.
              */
-            if (ASMAtomicCmpXchgU32(&server->mu32AudioInputClientId, u32ClientId, 0) == true)
+            if (ASMAtomicCmpXchgU32(&pServer->mu32AudioInputClientId, u32ClientId, 0) == true)
             {
-                Log(("AUDIOIN: connected client %u\n", u32ClientId));
-
-                PPDMIAUDIOSNIFFERPORT pPort = server->mConsole->getAudioSniffer()->getAudioSnifferPort();
+                LogFunc(("Intercepting audio input by client %RU32\n", u32ClientId));
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+                AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE();
+                if (pVRDE)
+                    pVRDE->onVRDEInputIntercept(true /* fIntercept */);
+#else
+                PPDMIAUDIOSNIFFERPORT pPort = pServer->mConsole->i_getAudioSniffer()->getAudioSnifferPort();
                 if (pPort)
                 {
                      pPort->pfnAudioInputIntercept(pPort, true);
                      if (ppvIntercept)
-                     {
-                         *ppvIntercept = server;
-                     }
+                         *ppvIntercept = pServer;
                 }
                 else
                 {
                     AssertFailed();
-                    ASMAtomicWriteU32(&server->mu32AudioInputClientId, 0);
+                    ASMAtomicWriteU32(&pServer->mu32AudioInputClientId, 0);
                     rc = VERR_NOT_SUPPORTED;
                 }
+#endif
             }
             else
             {
-                Log(("AUDIOIN: ignored client %u, active client %u\n", u32ClientId, server->mu32AudioInputClientId));
+                Log(("AUDIOIN: ignored client %RU32, active client %RU32\n", u32ClientId, pServer->mu32AudioInputClientId));
                 rc = VERR_NOT_SUPPORTED;
             }
         } break;
@@ -1040,7 +1061,8 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackIntercept(void *pvCallback, ui
     return rc;
 }
 
-DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackUSB(void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint8_t u8Code, const void *pvRet, uint32_t cbRet)
+DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackUSB(void *pvCallback, void *pvIntercept, uint32_t u32ClientId,
+                                                     uint8_t u8Code, const void *pvRet, uint32_t cbRet)
 {
 #ifdef VBOX_WITH_USB
     return USBClientResponseCallback(pvIntercept, u32ClientId, u8Code, pvRet, cbRet);
@@ -1049,84 +1071,78 @@ DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackUSB(void *pvCallback, void *pv
 #endif
 }
 
-DECLCALLBACK(int)  ConsoleVRDPServer::VRDPCallbackClipboard(void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData)
+DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClipboard(void *pvCallback, void *pvIntercept, uint32_t u32ClientId,
+                                                           uint32_t u32Function, uint32_t u32Format,
+                                                           const void *pvData, uint32_t cbData)
 {
     return ClipboardCallback(pvIntercept, u32ClientId, u32Function, u32Format, pvData, cbData);
 }
 
-DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery(void *pvCallback, unsigned uScreenId, VRDEFRAMEBUFFERINFO *pInfo)
+DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery(void *pvCallback, unsigned uScreenId,
+                                                                   VRDEFRAMEBUFFERINFO *pInfo)
 {
     ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
 
     bool fAvailable = false;
 
-    IFramebuffer *pfb = NULL;
-    LONG xOrigin = 0;
-    LONG yOrigin = 0;
-
-    server->mConsole->getDisplay()->GetFramebuffer(uScreenId, &pfb, &xOrigin, &yOrigin);
-
-    if (pfb)
-    {
-        pfb->Lock ();
-
-        /* Query framebuffer parameters. */
-        ULONG lineSize = 0;
-        pfb->COMGETTER(BytesPerLine)(&lineSize);
-
-        ULONG bitsPerPixel = 0;
-        pfb->COMGETTER(BitsPerPixel)(&bitsPerPixel);
-
-        BYTE *address = NULL;
-        pfb->COMGETTER(Address)(&address);
-
-        ULONG height = 0;
-        pfb->COMGETTER(Height)(&height);
-
-        ULONG width = 0;
-        pfb->COMGETTER(Width)(&width);
-
-        /* Now fill the information as requested by the caller. */
-        pInfo->pu8Bits = address;
-        pInfo->xOrigin = xOrigin;
-        pInfo->yOrigin = yOrigin;
-        pInfo->cWidth = width;
-        pInfo->cHeight = height;
-        pInfo->cBitsPerPixel = bitsPerPixel;
-        pInfo->cbLine = lineSize;
-
-        pfb->Unlock();
-
-        fAvailable = true;
-    }
+    /* Obtain the new screen bitmap. */
+    HRESULT hr = server->mConsole->i_getDisplay()->QuerySourceBitmap(uScreenId, server->maSourceBitmaps[uScreenId].asOutParam());
+    if (SUCCEEDED(hr))
+    {
+        LONG xOrigin = 0;
+        LONG yOrigin = 0;
+        BYTE *pAddress = NULL;
+        ULONG ulWidth = 0;
+        ULONG ulHeight = 0;
+        ULONG ulBitsPerPixel = 0;
+        ULONG ulBytesPerLine = 0;
+        BitmapFormat_T bitmapFormat = BitmapFormat_Opaque;
+
+        hr = server->maSourceBitmaps[uScreenId]->QueryBitmapInfo(&pAddress,
+                                                                 &ulWidth,
+                                                                 &ulHeight,
+                                                                 &ulBitsPerPixel,
+                                                                 &ulBytesPerLine,
+                                                                 &bitmapFormat);
+
+        if (SUCCEEDED(hr))
+        {
+            ULONG dummy;
+            GuestMonitorStatus_T monitorStatus;
+            hr = server->mConsole->i_getDisplay()->GetScreenResolution(uScreenId, &dummy, &dummy, &dummy,
+                                                                       &xOrigin, &yOrigin, &monitorStatus);
 
-    if (server->maFramebuffers[uScreenId])
-    {
-        server->maFramebuffers[uScreenId]->Release();
+            if (SUCCEEDED(hr))
+            {
+                /* Now fill the information as requested by the caller. */
+                pInfo->pu8Bits = pAddress;
+                pInfo->xOrigin = xOrigin;
+                pInfo->yOrigin = yOrigin;
+                pInfo->cWidth = ulWidth;
+                pInfo->cHeight = ulHeight;
+                pInfo->cBitsPerPixel = ulBitsPerPixel;
+                pInfo->cbLine = ulBytesPerLine;
+
+                fAvailable = true;
+            }
+        }
     }
-    server->maFramebuffers[uScreenId] = pfb;
 
     return fAvailable;
 }
 
 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock(void *pvCallback, unsigned uScreenId)
 {
-    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
-
-    if (server->maFramebuffers[uScreenId])
-    {
-        server->maFramebuffers[uScreenId]->Lock();
-    }
+    NOREF(pvCallback);
+    NOREF(uScreenId);
+    /* Do nothing */
 }
 
 DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferUnlock(void *pvCallback, unsigned uScreenId)
 {
-    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
-
-    if (server->maFramebuffers[uScreenId])
-    {
-        server->maFramebuffers[uScreenId]->Unlock();
-    }
+    NOREF(pvCallback);
+    NOREF(uScreenId);
+    /* Do nothing */
 }
 
 static void fixKbdLockStatus(VRDPInputSynch *pInputSynch, IKeyboard *pKeyboard)
@@ -1158,7 +1174,7 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput(void *pvCallback, int ty
         {
             if (cbInput == sizeof(VRDEINPUTSCANCODE))
             {
-                IKeyboard *pKeyboard = pConsole->getKeyboard();
+                IKeyboard *pKeyboard = pConsole->i_getKeyboard();
 
                 const VRDEINPUTSCANCODE *pInputScancode = (VRDEINPUTSCANCODE *)pvInput;
 
@@ -1219,12 +1235,13 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput(void *pvCallback, int ty
 
                 if (server->m_fGuestWantsAbsolute)
                 {
-                    pConsole->getMouse()->PutMouseEventAbsolute(pInputPoint->x + 1, pInputPoint->y + 1, iWheel, 0 /* Horizontal wheel */, mouseButtons);
+                    pConsole->i_getMouse()->PutMouseEventAbsolute(pInputPoint->x + 1, pInputPoint->y + 1, iWheel,
+                                                                  0 /* Horizontal wheel */, mouseButtons);
                 } else
                 {
-                    pConsole->getMouse()->PutMouseEvent(pInputPoint->x - server->m_mousex,
-                                                         pInputPoint->y - server->m_mousey,
-                                                         iWheel, 0 /* Horizontal wheel */, mouseButtons);
+                    pConsole->i_getMouse()->PutMouseEvent(pInputPoint->x - server->m_mousex,
+                                                          pInputPoint->y - server->m_mousey,
+                                                          iWheel, 0 /* Horizontal wheel */, mouseButtons);
                     server->m_mousex = pInputPoint->x;
                     server->m_mousey = pInputPoint->y;
                 }
@@ -1233,7 +1250,7 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput(void *pvCallback, int ty
 
         case VRDE_INPUT_CAD:
         {
-            pConsole->getKeyboard()->PutCAD();
+            pConsole->i_getKeyboard()->PutCAD();
         } break;
 
         case VRDE_INPUT_RESET:
@@ -1245,7 +1262,7 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput(void *pvCallback, int ty
         {
             if (cbInput == sizeof(VRDEINPUTSYNCH))
             {
-                IKeyboard *pKeyboard = pConsole->getKeyboard();
+                IKeyboard *pKeyboard = pConsole->i_getKeyboard();
 
                 const VRDEINPUTSYNCH *pInputSynch = (VRDEINPUTSYNCH *)pvInput;
 
@@ -1276,13 +1293,14 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput(void *pvCallback, int ty
     }
 }
 
-DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint(void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId)
+DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint(void *pvCallback, unsigned cWidth, unsigned cHeight,
+                                                                unsigned cBitsPerPixel, unsigned uScreenId)
 {
     ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
 
-    server->mConsole->getDisplay()->SetVideoModeHint(uScreenId, TRUE /*=enabled*/,
-                                                     FALSE /*=changeOrigin*/, 0/*=OriginX*/, 0/*=OriginY*/,
-                                                     cWidth, cHeight, cBitsPerPixel);
+    server->mConsole->i_getDisplay()->SetVideoModeHint(uScreenId, TRUE /*=enabled*/,
+                                                       FALSE /*=changeOrigin*/, 0/*=OriginX*/, 0/*=OriginY*/,
+                                                       cWidth, cHeight, cBitsPerPixel);
 }
 
 DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackAudioIn(void *pvCallback,
@@ -1292,40 +1310,55 @@ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackAudioIn(void *pvCallback,
                                                           const void *pvData,
                                                           uint32_t cbData)
 {
-    ConsoleVRDPServer *server = static_cast<ConsoleVRDPServer*>(pvCallback);
-
-    PPDMIAUDIOSNIFFERPORT pPort = server->mConsole->getAudioSniffer()->getAudioSnifferPort();
+    ConsoleVRDPServer *pServer = static_cast<ConsoleVRDPServer*>(pvCallback);
+    AssertPtrReturnVoid(pServer);
+#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
+    PPDMIAUDIOSNIFFERPORT pPort = pServer->mConsole->i_getAudioSniffer()->getAudioSnifferPort();
+#else
+    AudioVRDE *pVRDE = pServer->mConsole->i_getAudioVRDE();
+    if (!pVRDE) /* Nothing to do, bail out early. */
+        return;
+#endif
 
     switch (u32Event)
     {
         case VRDE_AUDIOIN_BEGIN:
         {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            pVRDE->onVRDEInputBegin(pvCtx, (PVRDEAUDIOINBEGIN)pvData);
+#else
             const VRDEAUDIOINBEGIN *pParms = (const VRDEAUDIOINBEGIN *)pvData;
-
             pPort->pfnAudioInputEventBegin (pPort, pvCtx,
                                             VRDE_AUDIO_FMT_SAMPLE_FREQ(pParms->fmt),
                                             VRDE_AUDIO_FMT_CHANNELS(pParms->fmt),
                                             VRDE_AUDIO_FMT_BITS_PER_SAMPLE(pParms->fmt),
                                             VRDE_AUDIO_FMT_SIGNED(pParms->fmt)
                                            );
-        } break;
+#endif
+            break;
+        }
 
         case VRDE_AUDIOIN_DATA:
-        {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            pVRDE->onVRDEInputData(pvCtx, pvData, cbData);
+#else
             pPort->pfnAudioInputEventData (pPort, pvCtx, pvData, cbData);
-        } break;
+#endif
+            break;
 
         case VRDE_AUDIOIN_END:
-        {
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            pVRDE->onVRDEInputEnd(pvCtx);
+#else
             pPort->pfnAudioInputEventEnd (pPort, pvCtx);
-        } break;
+#endif
+            break;
 
         default:
-            return;
+            break;
     }
 }
 
-
 ConsoleVRDPServer::ConsoleVRDPServer(Console *console)
 {
     mConsole = console;
@@ -1335,7 +1368,6 @@ ConsoleVRDPServer::ConsoleVRDPServer(Console *console)
 
     mcClipboardRefs = 0;
     mpfnClipboardCallback = NULL;
-
 #ifdef VBOX_WITH_USB
     mUSBBackends.pHead = NULL;
     mUSBBackends.pTail = NULL;
@@ -1365,8 +1397,6 @@ ConsoleVRDPServer::ConsoleVRDPServer(Console *console)
     m_InputSynch.fClientCapsLock   = false;
     m_InputSynch.fClientScrollLock = false;
 
-    RT_ZERO(maFramebuffers);
-
     {
         ComPtr<IEventSource> es;
         console->COMGETTER(EventSource)(es.asOutParam());
@@ -1424,13 +1454,9 @@ ConsoleVRDPServer::~ConsoleVRDPServer()
     }
 
     unsigned i;
-    for (i = 0; i < RT_ELEMENTS(maFramebuffers); i++)
+    for (i = 0; i < RT_ELEMENTS(maSourceBitmaps); i++)
     {
-        if (maFramebuffers[i])
-        {
-            maFramebuffers[i]->Release();
-            maFramebuffers[i] = NULL;
-        }
+        maSourceBitmaps[i].setNull();
     }
 
     if (mEmWebcam)
@@ -1456,7 +1482,7 @@ int ConsoleVRDPServer::Launch(void)
 {
     LogFlowThisFunc(("\n"));
 
-    IVRDEServer *server = mConsole->getVRDEServer();
+    IVRDEServer *server = mConsole->i_getVRDEServer();
     AssertReturn(server, VERR_INTERNAL_ERROR_2);
 
     /*
@@ -1487,8 +1513,8 @@ int ConsoleVRDPServer::Launch(void)
     else
     {
 #ifdef VBOX_WITH_EXTPACK
-        ExtPackManager *pExtPackMgr = mConsole->getExtPackManager();
-        vrc = pExtPackMgr->getVrdeLibraryPathForExtPack(&strExtPack, &strVrdeLibrary);
+        ExtPackManager *pExtPackMgr = mConsole->i_getExtPackManager();
+        vrc = pExtPackMgr->i_getVrdeLibraryPathForExtPack(&strExtPack, &strVrdeLibrary);
 #else
         vrc = VERR_FILE_NOT_FOUND;
 #endif
@@ -1749,6 +1775,11 @@ int ConsoleVRDPServer::Launch(void)
 #ifdef VBOX_WITH_USB
                 remoteUSBThreadStart();
 #endif
+
+                /*
+                 * Re-init the server current state, which is usually obtained from events.
+                 */
+                fetchCurrentState();
             }
             else
             {
@@ -1763,6 +1794,28 @@ int ConsoleVRDPServer::Launch(void)
     return vrc;
 }
 
+void ConsoleVRDPServer::fetchCurrentState(void)
+{
+    ComPtr<IMousePointerShape> mps;
+    mConsole->i_getMouse()->COMGETTER(PointerShape)(mps.asOutParam());
+    if (!mps.isNull())
+    {
+        BOOL  visible, alpha;
+        ULONG hotX, hotY, width, height;
+        com::SafeArray <BYTE> shape;
+
+        mps->COMGETTER(Visible)(&visible);
+        mps->COMGETTER(Alpha)(&alpha);
+        mps->COMGETTER(HotX)(&hotX);
+        mps->COMGETTER(HotY)(&hotY);
+        mps->COMGETTER(Width)(&width);
+        mps->COMGETTER(Height)(&height);
+        mps->COMGETTER(Shape)(ComSafeArrayAsOutParam(shape));
+
+        onMousePointerShapeChange(visible, alpha, hotX, hotY, width, height, ComSafeArrayAsInParam(shape));
+    }
+}
+
 typedef struct H3DORInstance
 {
     ConsoleVRDPServer *pThis;
@@ -1773,6 +1826,7 @@ typedef struct H3DORInstance
     uint32_t h;
     bool fCreated;
     bool fFallback;
+    bool fTopDown;
 } H3DORInstance;
 
 #define H3DORLOG Log
@@ -1801,6 +1855,12 @@ typedef struct H3DORInstance
         if (RTStrICmp(pszFormat, H3DOR_FMT_RGBA_TOPDOWN) == 0)
         {
             /* Accept it. */
+            p->fTopDown = true;
+        }
+        else if (RTStrICmp(pszFormat, H3DOR_FMT_RGBA) == 0)
+        {
+            /* Accept it. */
+            p->fTopDown = false;
         }
         else
         {
@@ -1986,7 +2046,11 @@ typedef struct H3DORInstance
     image.pvData = pvData;
     image.cbData = cbData;
     image.pvScanLine0 = (uint8_t *)pvData + (p->h - 1) * p->w * 4;
-    image.iScanDelta = -4 * p->w;
+    image.iScanDelta = 4 * p->w;
+    if (p->fTopDown)
+    {
+        image.iScanDelta = -image.iScanDelta;
+    }
 
     p->pThis->m_interfaceImage.VRDEImageUpdate (p->hImageBitmap,
                                                 p->x,
@@ -2024,11 +2088,17 @@ typedef struct H3DORInstance
     if (index == H3DOR_PROP_FORMATS)
     {
         /* Return a comma separated list of supported formats. */
-        static const char *pszSupportedFormats = H3DOR_FMT_RGBA_TOPDOWN;
-        uint32_t cbOut = (uint32_t)strlen(pszSupportedFormats) + 1;
+        uint32_t cbOut =   (uint32_t)strlen(H3DOR_FMT_RGBA_TOPDOWN) + 1
+                         + (uint32_t)strlen(H3DOR_FMT_RGBA) + 1;
         if (cbOut <= cbBuffer)
         {
-            memcpy(pvBuffer, pszSupportedFormats, cbOut);
+            char *pch = (char *)pvBuffer;
+            memcpy(pch, H3DOR_FMT_RGBA_TOPDOWN, strlen(H3DOR_FMT_RGBA_TOPDOWN));
+            pch += strlen(H3DOR_FMT_RGBA_TOPDOWN);
+            *pch++ = ',';
+            memcpy(pch, H3DOR_FMT_RGBA, strlen(H3DOR_FMT_RGBA));
+            pch += strlen(H3DOR_FMT_RGBA);
+            *pch++ = '\0';
         }
         else
         {
@@ -2055,7 +2125,7 @@ void ConsoleVRDPServer::remote3DRedirect(bool fEnable)
 
     /* Check if 3D redirection has been enabled. It is enabled by default. */
     com::Bstr bstr;
-    HRESULT hrc = mConsole->getVRDEServer()->GetVRDEProperty(Bstr("H3DRedirect/Enabled").raw(), bstr.asOutParam());
+    HRESULT hrc = mConsole->i_getVRDEServer()->GetVRDEProperty(Bstr("H3DRedirect/Enabled").raw(), bstr.asOutParam());
 
     com::Utf8Str value = hrc == S_OK? bstr: "";
 
@@ -2086,25 +2156,16 @@ void ConsoleVRDPServer::remote3DRedirect(bool fEnable)
         RT_ZERO(outputRedirect);
     }
 
-    VBOXHGCMSVCPARM parm;
-
-    parm.type = VBOX_HGCM_SVC_PARM_PTR;
-    parm.u.pointer.addr = &outputRedirect;
-    parm.u.pointer.size = sizeof(outputRedirect);
-
-    VMMDev *pVMMDev = mConsole->getVMMDev();
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+    VBOXCRCMDCTL_HGCM data;
+    data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM;
+    data.Hdr.u32Function = SHCRGL_HOST_FN_SET_OUTPUT_REDIRECT;
 
-    if (!pVMMDev)
-    {
-        AssertMsgFailed(("remote3DRedirect no vmmdev\n"));
-        return;
-    }
-
-    int rc = pVMMDev->hgcmHostCall("VBoxSharedCrOpenGL",
-                                   SHCRGL_HOST_FN_SET_OUTPUT_REDIRECT,
-                                   SHCRGL_CPARMS_SET_OUTPUT_REDIRECT,
-                                   &parm);
+    data.aParms[0].type = VBOX_HGCM_SVC_PARM_PTR;
+    data.aParms[0].u.pointer.addr = &outputRedirect;
+    data.aParms[0].u.pointer.size = sizeof(outputRedirect);
 
+    int rc = mConsole->i_getDisplay()->i_crCtlSubmitSync(&data.Hdr, sizeof (data));
     if (!RT_SUCCESS(rc))
     {
         Log(("SHCRGL_HOST_FN_SET_CONSOLE failed with %Rrc\n", rc));
@@ -2112,6 +2173,10 @@ void ConsoleVRDPServer::remote3DRedirect(bool fEnable)
     }
 
     LogRel(("VRDE: %s 3D redirect.\n", fEnable? "Enabled": "Disabled"));
+# ifdef DEBUG_misha
+    AssertFailed();
+# endif
+#endif
 
     return;
 }
@@ -2166,7 +2231,7 @@ void ConsoleVRDPServer::remote3DRedirect(bool fEnable)
 {
 #ifdef VBOX_WITH_USB_CARDREADER
     ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvContext);
-    UsbCardReader *pReader = pThis->mConsole->getUsbCardReader();
+    UsbCardReader *pReader = pThis->mConsole->i_getUsbCardReader();
     return pReader->VRDENotify(u32Id, pvData, cbData);
 #else
     NOREF(pvContext);
@@ -2186,7 +2251,7 @@ void ConsoleVRDPServer::remote3DRedirect(bool fEnable)
 {
 #ifdef VBOX_WITH_USB_CARDREADER
     ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvContext);
-    UsbCardReader *pReader = pThis->mConsole->getUsbCardReader();
+    UsbCardReader *pReader = pThis->mConsole->i_getUsbCardReader();
     return pReader->VRDEResponse(rcRequest, pvUser, u32Function, pvData, cbData);
 #else
     NOREF(pvContext);
@@ -2486,7 +2551,7 @@ void ConsoleVRDPServer::setupTSMF(void)
     parms.iface.u.pointer.addr = &hostChannelInterface;
     parms.iface.u.pointer.size = sizeof(hostChannelInterface);
 
-    VMMDev *pVMMDev = mConsole->getVMMDev();
+    VMMDev *pVMMDev = mConsole->i_getVMMDev();
 
     if (!pVMMDev)
     {
@@ -2796,7 +2861,7 @@ int ConsoleVRDPServer::VideoInControl(void *pvUser, const VRDEVIDEOINDEVICEHANDL
 
             if (pHeader->u16EventId == VRDEINPUT_EVENTID_TOUCH)
             {
-                IMouse *pMouse = pThis->mConsole->getMouse();
+                IMouse *pMouse = pThis->mConsole->i_getMouse();
 
                 VRDEINPUT_TOUCH_EVENT_PDU *p = (VRDEINPUT_TOUCH_EVENT_PDU *)pHeader;
 
@@ -3207,7 +3272,7 @@ AuthResult ConsoleVRDPServer::Authenticate(const Guid &uuid, AuthGuestJudgement
     {
         /* Load the external authentication library. */
         Bstr authLibrary;
-        mConsole->getVRDEServer()->COMGETTER(AuthLibrary)(authLibrary.asOutParam());
+        mConsole->i_getVRDEServer()->COMGETTER(AuthLibrary)(authLibrary.asOutParam());
 
         Utf8Str filename = authLibrary;
 
@@ -3843,7 +3908,6 @@ void ConsoleVRDPServer::SendUSBRequest(uint32_t u32ClientId, void *pvParms, uint
     }
 }
 
-/* @todo rc not needed? */
 int ConsoleVRDPServer::SendAudioInputBegin(void **ppvUserCtx,
                                            void *pvContext,
                                            uint32_t cSamples,
@@ -3851,25 +3915,30 @@ int ConsoleVRDPServer::SendAudioInputBegin(void **ppvUserCtx,
                                            uint32_t cChannels,
                                            uint32_t cBits)
 {
-    if (mpEntryPoints && mhServer && mpEntryPoints->VRDEAudioInOpen)
+    if (   mhServer
+        && mpEntryPoints && mpEntryPoints->VRDEAudioInOpen)
     {
         uint32_t u32ClientId = ASMAtomicReadU32(&mu32AudioInputClientId);
         if (u32ClientId != 0) /* 0 would mean broadcast to all clients. */
         {
             VRDEAUDIOFORMAT audioFormat = VRDE_AUDIO_FMT_MAKE(iSampleHz, cChannels, cBits, 0);
-            mpEntryPoints->VRDEAudioInOpen (mhServer,
-                                            pvContext,
-                                            u32ClientId,
-                                            audioFormat,
-                                            cSamples);
-            *ppvUserCtx = NULL; /* This is the ConsoleVRDPServer context.
-                                 * Currently not used because only one client is allowed to
-                                 * do audio input and the client id is saved by the ConsoleVRDPServer.
-                                 */
-
+            mpEntryPoints->VRDEAudioInOpen(mhServer,
+                                           pvContext,
+                                           u32ClientId,
+                                           audioFormat,
+                                           cSamples);
+            if (ppvUserCtx)
+                *ppvUserCtx = NULL; /* This is the ConsoleVRDPServer context.
+                                     * Currently not used because only one client is allowed to
+                                     * do audio input and the client ID is saved by the ConsoleVRDPServer.
+                                     */
             return VINF_SUCCESS;
         }
     }
+
+    /*
+     * Not supported or no client connected.
+     */
     return VERR_NOT_SUPPORTED;
 }
 
@@ -3885,7 +3954,6 @@ void ConsoleVRDPServer::SendAudioInputEnd(void *pvUserCtx)
     }
 }
 
-
 void ConsoleVRDPServer::QueryInfo(uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) const
 {
     if (index == VRDE_QI_PORT)
@@ -4039,21 +4107,15 @@ void VRDEServerInfo::uninit()
 /////////////////////////////////////////////////////////////////////////////
 
 #define IMPL_GETTER_BOOL(_aType, _aName, _aIndex)                         \
-    STDMETHODIMP VRDEServerInfo::COMGETTER(_aName)(_aType *a##_aName)  \
+    HRESULT VRDEServerInfo::get##_aName(_aType *a##_aName)                \
     {                                                                     \
-        if (!a##_aName)                                                   \
-            return E_POINTER;                                             \
-                                                                          \
-        AutoCaller autoCaller(this);                                      \
-        if (FAILED(autoCaller.rc())) return autoCaller.rc();              \
-                                                                          \
         /* todo: Not sure if a AutoReadLock would be sufficient. */       \
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);                  \
                                                                           \
         uint32_t value;                                                   \
         uint32_t cbOut = 0;                                               \
                                                                           \
-        mParent->consoleVRDPServer()->QueryInfo                           \
+        mParent->i_consoleVRDPServer()->QueryInfo                         \
             (_aIndex, &value, sizeof(value), &cbOut);                     \
                                                                           \
         *a##_aName = cbOut? !!value: FALSE;                               \
@@ -4063,21 +4125,15 @@ void VRDEServerInfo::uninit()
     extern void IMPL_GETTER_BOOL_DUMMY(void)
 
 #define IMPL_GETTER_SCALAR(_aType, _aName, _aIndex, _aValueMask)          \
-    STDMETHODIMP VRDEServerInfo::COMGETTER(_aName)(_aType *a##_aName)  \
+    HRESULT VRDEServerInfo::get##_aName(_aType *a##_aName)                \
     {                                                                     \
-        if (!a##_aName)                                                   \
-            return E_POINTER;                                             \
-                                                                          \
-        AutoCaller autoCaller(this);                                      \
-        if (FAILED(autoCaller.rc())) return autoCaller.rc();              \
-                                                                          \
         /* todo: Not sure if a AutoReadLock would be sufficient. */       \
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);                  \
                                                                           \
         _aType value;                                                     \
         uint32_t cbOut = 0;                                               \
                                                                           \
-        mParent->consoleVRDPServer()->QueryInfo                           \
+        mParent->i_consoleVRDPServer()->QueryInfo                         \
             (_aIndex, &value, sizeof(value), &cbOut);                     \
                                                                           \
         if (_aValueMask) value &= (_aValueMask);                          \
@@ -4087,27 +4143,20 @@ void VRDEServerInfo::uninit()
     }                                                                     \
     extern void IMPL_GETTER_SCALAR_DUMMY(void)
 
-#define IMPL_GETTER_BSTR(_aType, _aName, _aIndex)                         \
-    STDMETHODIMP VRDEServerInfo::COMGETTER(_aName)(_aType *a##_aName)  \
+#define IMPL_GETTER_UTF8STR(_aType, _aName, _aIndex)                      \
+    HRESULT VRDEServerInfo::get##_aName(_aType &a##_aName)                \
     {                                                                     \
-        if (!a##_aName)                                                   \
-            return E_POINTER;                                             \
-                                                                          \
-        AutoCaller autoCaller(this);                                      \
-        if (FAILED(autoCaller.rc())) return autoCaller.rc();              \
-                                                                          \
         /* todo: Not sure if a AutoReadLock would be sufficient. */       \
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);                  \
                                                                           \
         uint32_t cbOut = 0;                                               \
                                                                           \
-        mParent->consoleVRDPServer()->QueryInfo                           \
+        mParent->i_consoleVRDPServer()->QueryInfo                         \
             (_aIndex, NULL, 0, &cbOut);                                   \
                                                                           \
         if (cbOut == 0)                                                   \
         {                                                                 \
-            Bstr str("");                                                 \
-            str.cloneTo(a##_aName);                                       \
+            a##_aName = Utf8Str::Empty;                                   \
             return S_OK;                                                  \
         }                                                                 \
                                                                           \
@@ -4121,12 +4170,10 @@ void VRDEServerInfo::uninit()
             return E_OUTOFMEMORY;                                         \
         }                                                                 \
                                                                           \
-        mParent->consoleVRDPServer()->QueryInfo                           \
+        mParent->i_consoleVRDPServer()->QueryInfo                         \
             (_aIndex, pchBuffer, cbOut, &cbOut);                          \
                                                                           \
-        Bstr str(pchBuffer);                                              \
-                                                                          \
-        str.cloneTo(a##_aName);                                           \
+        a##_aName = pchBuffer;                                            \
                                                                           \
         RTMemTmpFree(pchBuffer);                                          \
                                                                           \
@@ -4143,14 +4190,14 @@ IMPL_GETTER_SCALAR (LONG64,  BytesSent,          VRDE_QI_BYTES_SENT,
 IMPL_GETTER_SCALAR (LONG64,  BytesSentTotal,     VRDE_QI_BYTES_SENT_TOTAL,      INT64_MAX);
 IMPL_GETTER_SCALAR (LONG64,  BytesReceived,      VRDE_QI_BYTES_RECEIVED,        INT64_MAX);
 IMPL_GETTER_SCALAR (LONG64,  BytesReceivedTotal, VRDE_QI_BYTES_RECEIVED_TOTAL,  INT64_MAX);
-IMPL_GETTER_BSTR   (BSTR,    User,               VRDE_QI_USER);
-IMPL_GETTER_BSTR   (BSTR,    Domain,             VRDE_QI_DOMAIN);
-IMPL_GETTER_BSTR   (BSTR,    ClientName,         VRDE_QI_CLIENT_NAME);
-IMPL_GETTER_BSTR   (BSTR,    ClientIP,           VRDE_QI_CLIENT_IP);
+IMPL_GETTER_UTF8STR(Utf8Str, User,               VRDE_QI_USER);
+IMPL_GETTER_UTF8STR(Utf8Str, Domain,             VRDE_QI_DOMAIN);
+IMPL_GETTER_UTF8STR(Utf8Str, ClientName,         VRDE_QI_CLIENT_NAME);
+IMPL_GETTER_UTF8STR(Utf8Str, ClientIP,           VRDE_QI_CLIENT_IP);
 IMPL_GETTER_SCALAR (ULONG,   ClientVersion,      VRDE_QI_CLIENT_VERSION,        0);
 IMPL_GETTER_SCALAR (ULONG,   EncryptionStyle,    VRDE_QI_ENCRYPTION_STYLE,      0);
 
-#undef IMPL_GETTER_BSTR
+#undef IMPL_GETTER_UTF8STR
 #undef IMPL_GETTER_SCALAR
 #undef IMPL_GETTER_BOOL
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-client/DisplayImpl.cpp b/src/VBox/Main/src-client/DisplayImpl.cpp
index 2aa362a..b5e759b 100644
--- a/src/VBox/Main/src-client/DisplayImpl.cpp
+++ b/src/VBox/Main/src-client/DisplayImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -87,11 +87,6 @@ typedef struct DRVMAINDISPLAY
 /** Converts PDMIDISPLAYCONNECTOR pointer to a DRVMAINDISPLAY pointer. */
 #define PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface)  RT_FROM_MEMBER(pInterface, DRVMAINDISPLAY, IConnector)
 
-#ifdef DEBUG_sunlover
-static STAMPROFILE g_StatDisplayRefresh;
-static int g_stam = 0;
-#endif /* DEBUG_sunlover */
-
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
@@ -107,41 +102,24 @@ Display::~Display()
 
 HRESULT Display::FinalConstruct()
 {
-    mpVbvaMemory = NULL;
-    mfVideoAccelEnabled = false;
+    int rc = videoAccelConstruct(&mVideoAccelLegacy);
+    AssertRC(rc);
+
     mfVideoAccelVRDP = false;
     mfu32SupportedOrders = 0;
     mcVideoAccelVRDPRefs = 0;
 
-    mpPendingVbvaMemory = NULL;
-    mfPendingVideoAccelEnable = false;
-
-    mfMachineRunning = false;
 #ifdef VBOX_WITH_CROGL
     mfCrOglDataHidden = false;
 #endif
 
-    mpu8VbvaPartial = NULL;
-    mcbVbvaPartial = 0;
-
     mpDrv = NULL;
     mpVMMDev = NULL;
     mfVMMDevInited = false;
 
-    mLastAddress = NULL;
-    mLastBytesPerLine = 0;
-    mLastBitsPerPixel = 0,
-    mLastWidth = 0;
-    mLastHeight = 0;
-
-    int rc = RTCritSectInit(&mVBVALock);
+    rc = RTCritSectInit(&mVideoAccelLock);
     AssertRC(rc);
 
-    rc = RTCritSectInit(&mSaveSeamlessRectLock);
-    AssertRC(rc);
-
-    mfu32PendingVideoAccelDisable = false;
-
 #ifdef VBOX_WITH_HGSMI
     mu32UpdateVBVAFlags = 0;
     mfVMMDevSupportsGraphics = false;
@@ -165,9 +143,9 @@ HRESULT Display::FinalConstruct()
     mfCrOglVideoRecState = CRVREC_STATE_IDLE;
     mCrOglScreenshotData.u32Screen = CRSCREEN_ALL;
     mCrOglScreenshotData.pvContext = this;
-    mCrOglScreenshotData.pfnScreenshotBegin = displayCrVRecScreenshotBegin;
-    mCrOglScreenshotData.pfnScreenshotPerform = displayCrVRecScreenshotPerform;
-    mCrOglScreenshotData.pfnScreenshotEnd = displayCrVRecScreenshotEnd;
+    mCrOglScreenshotData.pfnScreenshotBegin = i_displayCrVRecScreenshotBegin;
+    mCrOglScreenshotData.pfnScreenshotPerform = i_displayCrVRecScreenshotPerform;
+    mCrOglScreenshotData.pfnScreenshotEnd = i_displayCrVRecScreenshotEnd;
 #endif
 
     return BaseFinalConstruct();
@@ -177,16 +155,12 @@ void Display::FinalRelease()
 {
     uninit();
 
-    if (RTCritSectIsInitialized (&mVBVALock))
-    {
-        RTCritSectDelete (&mVBVALock);
-        RT_ZERO(mVBVALock);
-    }
+    videoAccelDestroy(&mVideoAccelLegacy);
 
-    if (RTCritSectIsInitialized(&mSaveSeamlessRectLock))
+    if (RTCritSectIsInitialized(&mVideoAccelLock))
     {
-        RTCritSectDelete(&mSaveSeamlessRectLock);
-        RT_ZERO(mSaveSeamlessRectLock);
+        RTCritSectDelete(&mVideoAccelLock);
+        RT_ZERO(mVideoAccelLock);
     }
 
 #ifdef VBOX_WITH_CRHGSMI
@@ -243,11 +217,11 @@ static int displayMakeThumbnail(uint8_t *pu8Data, uint32_t cx, uint32_t cy,
         int srcH = cy;
         int iDeltaLine = cx * 4;
 
-        BitmapScale32 (dst,
-                       dstW, dstH,
-                       src,
-                       iDeltaLine,
-                       srcW, srcH);
+        BitmapScale32(dst,
+                      dstW, dstH,
+                      src,
+                      iDeltaLine,
+                      srcW, srcH);
 
         *ppu8Thumbnail = pu8Thumbnail;
         *pcbThumbnail = cbThumbnail;
@@ -281,16 +255,18 @@ typedef struct
 } VBOX_DISPLAY_SAVESCREENSHOT_DATA;
 
 static DECLCALLBACK(void) displaySaveScreenshotReport(void *pvCtx, uint32_t uScreen,
-        uint32_t x, uint32_t y, uint32_t uBitsPerPixel,
-        uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
-        uint8_t *pu8BufferAddress, uint64_t u64TimeStamp)
+                                                      uint32_t x, uint32_t y, uint32_t uBitsPerPixel,
+                                                      uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
+                                                      uint8_t *pu8BufferAddress, uint64_t u64TimeStamp)
 {
     VBOX_DISPLAY_SAVESCREENSHOT_DATA *pData = (VBOX_DISPLAY_SAVESCREENSHOT_DATA*)pvCtx;
-    displayMakeThumbnail(pu8BufferAddress, uGuestWidth, uGuestHeight, &pData->pu8Thumbnail, &pData->cbThumbnail, &pData->cxThumbnail, &pData->cyThumbnail);
-    int rc = DisplayMakePNG(pu8BufferAddress, uGuestWidth, uGuestHeight, &pData->pu8PNG, &pData->cbPNG, &pData->cxPNG, &pData->cyPNG, 1);
+    displayMakeThumbnail(pu8BufferAddress, uGuestWidth, uGuestHeight, &pData->pu8Thumbnail,
+                         &pData->cbThumbnail, &pData->cxThumbnail, &pData->cyThumbnail);
+    int rc = DisplayMakePNG(pu8BufferAddress, uGuestWidth, uGuestHeight, &pData->pu8PNG,
+                            &pData->cbPNG, &pData->cxPNG, &pData->cyPNG, 1);
     if (RT_FAILURE(rc))
     {
-        AssertMsgFailed(("DisplayMakePNG failed %d\n", rc));
+        AssertMsgFailed(("DisplayMakePNG failed (rc=%Rrc)\n", rc));
         if (pData->pu8PNG)
         {
             RTMemFree(pData->pu8PNG);
@@ -303,8 +279,7 @@ static DECLCALLBACK(void) displaySaveScreenshotReport(void *pvCtx, uint32_t uScr
 }
 #endif
 
-DECLCALLBACK(void)
-Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
+DECLCALLBACK(void) Display::i_displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
 {
     Display *that = static_cast<Display*>(pvUser);
 
@@ -335,11 +310,11 @@ Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
             && that->mCrOglCallbacks.pfnHasData
             && that->mCrOglCallbacks.pfnHasData())
         {
-            VMMDev *pVMMDev = that->mParent->getVMMDev();
+            VMMDev *pVMMDev = that->mParent->i_getVMMDev();
             if (pVMMDev)
             {
                 VBOX_DISPLAY_SAVESCREENSHOT_DATA *pScreenshot =
-                    (VBOX_DISPLAY_SAVESCREENSHOT_DATA*)RTMemAllocZ(sizeof (*pScreenshot));
+                    (VBOX_DISPLAY_SAVESCREENSHOT_DATA*)RTMemAllocZ(sizeof(*pScreenshot));
                 if (pScreenshot)
                 {
                     /* screen id or CRSCREEN_ALL to specify all enabled */
@@ -359,9 +334,9 @@ Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
 
                     data.aParms[0].type = VBOX_HGCM_SVC_PARM_PTR;
                     data.aParms[0].u.pointer.addr = &pScreenshot->Base;
-                    data.aParms[0].u.pointer.size = sizeof (pScreenshot->Base);
+                    data.aParms[0].u.pointer.size = sizeof(pScreenshot->Base);
 
-                    int rc = that->crCtlSubmitSync(&data.Hdr, sizeof (data));
+                    int rc = that->i_crCtlSubmitSync(&data.Hdr, sizeof(data));
                     if (RT_SUCCESS(rc))
                     {
                         if (pScreenshot->pu8PNG)
@@ -382,7 +357,7 @@ Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
                             AssertMsgFailed(("no png\n"));
                     }
                     else
-                        AssertMsgFailed(("SHCRGL_HOST_FN_TAKE_SCREENSHOT failed %d\n", rc));
+                        AssertMsgFailed(("SHCRGL_HOST_FN_TAKE_SCREENSHOT failed (rc=%Rrc)\n", rc));
 
 
                     RTMemFree(pScreenshot);
@@ -394,7 +369,7 @@ Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
 #endif
         {
             /* SSM code is executed on EMT(0), therefore no need to use VMR3ReqCallWait. */
-            int rc = Display::displayTakeScreenshotEMT(that, VBOX_VIDEO_PRIMARY_SCREEN, &pu8Data, &cbData, &cx, &cy);
+            int rc = Display::i_displayTakeScreenshotEMT(that, VBOX_VIDEO_PRIMARY_SCREEN, &pu8Data, &cbData, &cx, &cy);
 
             /*
              * It is possible that success is returned but everything is 0 or NULL.
@@ -447,7 +422,7 @@ Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
     SSMR3PutU32(pSSM, 2); /* Write thumbnail and PNG screenshot. */
 
     /* First block. */
-    SSMR3PutU32(pSSM, cbThumbnail + 2 * sizeof (uint32_t));
+    SSMR3PutU32(pSSM, cbThumbnail + 2 * sizeof(uint32_t));
     SSMR3PutU32(pSSM, 0); /* Block type: thumbnail. */
 
     if (cbThumbnail)
@@ -458,7 +433,7 @@ Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
     }
 
     /* Second block. */
-    SSMR3PutU32(pSSM, cbPNG + 2 * sizeof (uint32_t));
+    SSMR3PutU32(pSSM, cbPNG + 2 * sizeof(uint32_t));
     SSMR3PutU32(pSSM, 1); /* Block type: png. */
 
     if (cbPNG)
@@ -473,7 +448,7 @@ Display::displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser)
 }
 
 DECLCALLBACK(int)
-Display::displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass)
+Display::i_displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass)
 {
     Display *that = static_cast<Display*>(pvUser);
 
@@ -502,7 +477,7 @@ Display::displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersi
          * do not write any data if the image size was 0.
          * @todo Fix and increase saved state version.
          */
-        if (cbBlock > 2 * sizeof (uint32_t))
+        if (cbBlock > 2 * sizeof(uint32_t))
         {
             rc = SSMR3Skip(pSSM, cbBlock);
             AssertRCBreak(rc);
@@ -516,7 +491,7 @@ Display::displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersi
  * Save/Load some important guest state
  */
 DECLCALLBACK(void)
-Display::displaySSMSave(PSSMHANDLE pSSM, void *pvUser)
+Display::i_displaySSMSave(PSSMHANDLE pSSM, void *pvUser)
 {
     Display *that = static_cast<Display*>(pvUser);
 
@@ -541,7 +516,7 @@ Display::displaySSMSave(PSSMHANDLE pSSM, void *pvUser)
 }
 
 DECLCALLBACK(int)
-Display::displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass)
+Display::i_displaySSMLoad(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass)
 {
     Display *that = static_cast<Display*>(pvUser);
 
@@ -624,8 +599,11 @@ HRESULT Display::init(Console *aParent)
 
     unconst(mParent) = aParent;
 
+    mfSourceBitmapEnabled = true;
+    fVGAResizing = false;
+
     ULONG ul;
-    mParent->machine()->COMGETTER(MonitorCount)(&ul);
+    mParent->i_machine()->COMGETTER(MonitorCount)(&ul);
     mcMonitors = ul;
     xInputMappingOrigin = 0;
     yInputMappingOrigin = 0;
@@ -642,6 +620,11 @@ HRESULT Display::init(Console *aParent)
         /* All secondary monitors are disabled at startup. */
         maFramebuffers[ul].fDisabled = ul > 0;
 
+        maFramebuffers[ul].u32Caps = 0;
+
+        maFramebuffers[ul].updateImage.pu8Address = NULL;
+        maFramebuffers[ul].updateImage.cbLine = 0;
+
         maFramebuffers[ul].xOrigin = 0;
         maFramebuffers[ul].yOrigin = 0;
 
@@ -656,20 +639,12 @@ HRESULT Display::init(Console *aParent)
 
         maFramebuffers[ul].pHostEvents = NULL;
 
-        maFramebuffers[ul].u32ResizeStatus = ResizeStatus_Void;
-
         maFramebuffers[ul].fDefaultFormat = false;
 
-        maFramebuffers[ul].mcSavedVisibleRegion = 0;
-        maFramebuffers[ul].mpSavedVisibleRegion = NULL;
-
-        RT_ZERO(maFramebuffers[ul].dirtyRect);
-        RT_ZERO(maFramebuffers[ul].pendingResize);
 #ifdef VBOX_WITH_HGSMI
         maFramebuffers[ul].fVBVAEnabled = false;
+        maFramebuffers[ul].fVBVAForceResize = false;
         maFramebuffers[ul].fRenderThreadMode = false;
-        maFramebuffers[ul].cVBVASkipUpdate = 0;
-        RT_ZERO(maFramebuffers[ul].vbvaSkippedRect);
         maFramebuffers[ul].pVBVAHostFlags = NULL;
 #endif /* VBOX_WITH_HGSMI */
 #ifdef VBOX_WITH_CROGL
@@ -681,16 +656,16 @@ HRESULT Display::init(Console *aParent)
         // register listener for state change events
         ComPtr<IEventSource> es;
         mParent->COMGETTER(EventSource)(es.asOutParam());
-        com::SafeArray <VBoxEventType_T> eventTypes;
+        com::SafeArray<VBoxEventType_T> eventTypes;
         eventTypes.push_back(VBoxEventType_OnStateChanged);
         es->RegisterListener(this, ComSafeArrayAsInParam(eventTypes), true);
     }
 
     /* Cache the 3D settings. */
     BOOL fIs3DEnabled = FALSE;
-    mParent->machine()->COMGETTER(Accelerate3DEnabled)(&fIs3DEnabled);
+    mParent->i_machine()->COMGETTER(Accelerate3DEnabled)(&fIs3DEnabled);
     GraphicsControllerType_T enmGpuType = (GraphicsControllerType_T)GraphicsControllerType_VBoxVGA;
-    mParent->machine()->COMGETTER(GraphicsControllerType)(&enmGpuType);
+    mParent->i_machine()->COMGETTER(GraphicsControllerType)(&enmGpuType);
     mfIsCr3DEnabled = fIs3DEnabled && enmGpuType == GraphicsControllerType_VBoxVGA;
 
     /* Confirm a successful initialization */
@@ -712,9 +687,15 @@ void Display::uninit()
     if (autoUninitSpan.uninitDone())
         return;
 
-    ULONG ul;
-    for (ul = 0; ul < mcMonitors; ul++)
-        maFramebuffers[ul].pFramebuffer = NULL;
+    unsigned uScreenId;
+    for (uScreenId = 0; uScreenId < mcMonitors; uScreenId++)
+    {
+        maFramebuffers[uScreenId].pSourceBitmap.setNull();
+        maFramebuffers[uScreenId].updateImage.pSourceBitmap.setNull();
+        maFramebuffers[uScreenId].updateImage.pu8Address = NULL;
+        maFramebuffers[uScreenId].updateImage.cbLine = 0;
+        maFramebuffers[uScreenId].pFramebuffer.setNull();
+    }
 
     if (mParent)
     {
@@ -737,7 +718,7 @@ void Display::uninit()
  * Register the SSM methods. Called by the power up thread to be able to
  * pass pVM
  */
-int Display::registerSSM(PUVM pUVM)
+int Display::i_registerSSM(PUVM pUVM)
 {
     /* Version 2 adds width and height of the framebuffer; version 3 adds
      * the framebuffer offset in the virtual desktop and the framebuffer flags;
@@ -747,8 +728,8 @@ int Display::registerSSM(PUVM pUVM)
     int rc = SSMR3RegisterExternal(pUVM, "DisplayData", 0, sSSMDisplayVer5,
                                    mcMonitors * sizeof(uint32_t) * 8 + sizeof(uint32_t),
                                    NULL, NULL, NULL,
-                                   NULL, displaySSMSave, NULL,
-                                   NULL, displaySSMLoad, NULL, this);
+                                   NULL, i_displaySSMSave, NULL,
+                                   NULL, i_displaySSMLoad, NULL, this);
     AssertRCReturn(rc, rc);
 
     /*
@@ -758,34 +739,34 @@ int Display::registerSSM(PUVM pUVM)
     rc = SSMR3RegisterExternal(pUVM, "DisplayData", 12 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,
                                NULL, NULL, NULL,
                                NULL, NULL, NULL,
-                               NULL, displaySSMLoad, NULL, this);
+                               NULL, i_displaySSMLoad, NULL, this);
     AssertRCReturn(rc, rc);
 
     rc = SSMR3RegisterExternal(pUVM, "DisplayData", 24 /*uInstance*/, sSSMDisplayVer, 0 /*cbGuess*/,
                                NULL, NULL, NULL,
                                NULL, NULL, NULL,
-                               NULL, displaySSMLoad, NULL, this);
+                               NULL, i_displaySSMLoad, NULL, this);
     AssertRCReturn(rc, rc);
 
     /* uInstance is an arbitrary value greater than 1024. Such a value will ensure a quick seek in saved state file. */
     rc = SSMR3RegisterExternal(pUVM, "DisplayScreenshot", 1100 /*uInstance*/, sSSMDisplayScreenshotVer, 0 /*cbGuess*/,
                                NULL, NULL, NULL,
-                               NULL, displaySSMSaveScreenshot, NULL,
-                               NULL, displaySSMLoadScreenshot, NULL, this);
+                               NULL, i_displaySSMSaveScreenshot, NULL,
+                               NULL, i_displaySSMLoadScreenshot, NULL, this);
 
     AssertRCReturn(rc, rc);
 
     return VINF_SUCCESS;
 }
 
-DECLCALLBACK(void) Display::displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion)
+DECLCALLBACK(void) Display::i_displayCrCmdFree(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion)
 {
     Assert(pvCompletion);
     RTMemFree(pvCompletion);
 }
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-int Display::crOglWindowsShow(bool fShow)
+int Display::i_crOglWindowsShow(bool fShow)
 {
     if (!mfCrOglDataHidden == !!fShow)
         return VINF_SUCCESS;
@@ -797,14 +778,14 @@ int Display::crOglWindowsShow(bool fShow)
         return VERR_INVALID_STATE;
     }
 
-    VMMDev *pVMMDev = mParent->getVMMDev();
+    VMMDev *pVMMDev = mParent->i_getVMMDev();
     if (!pVMMDev)
     {
         AssertMsgFailed(("no vmmdev\n"));
         return VERR_INVALID_STATE;
     }
 
-    VBOXCRCMDCTL_HGCM *pData = (VBOXCRCMDCTL_HGCM*)RTMemAlloc(sizeof (VBOXCRCMDCTL_HGCM));
+    VBOXCRCMDCTL_HGCM *pData = (VBOXCRCMDCTL_HGCM*)RTMemAlloc(sizeof(VBOXCRCMDCTL_HGCM));
     if (!pData)
     {
         AssertMsgFailed(("RTMemAlloc failed\n"));
@@ -817,12 +798,12 @@ int Display::crOglWindowsShow(bool fShow)
     pData->aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT;
     pData->aParms[0].u.uint32 = (uint32_t)fShow;
 
-    int rc = crCtlSubmit(&pData->Hdr, sizeof (*pData), displayCrCmdFree, pData);
+    int rc = i_crCtlSubmit(&pData->Hdr, sizeof(*pData), i_displayCrCmdFree, pData);
     if (RT_SUCCESS(rc))
         mfCrOglDataHidden = !fShow;
     else
     {
-        AssertMsgFailed(("crCtlSubmit failed rc %d\n", rc));
+        AssertMsgFailed(("crCtlSubmit failed (rc=%Rrc)\n", rc));
         RTMemFree(pData);
     }
 
@@ -831,80 +812,10 @@ int Display::crOglWindowsShow(bool fShow)
 #endif
 
 
-// IEventListener method
-STDMETHODIMP Display::HandleEvent(IEvent * aEvent)
-{
-    VBoxEventType_T aType = VBoxEventType_Invalid;
-
-    aEvent->COMGETTER(Type)(&aType);
-    switch (aType)
-    {
-        case VBoxEventType_OnStateChanged:
-        {
-            ComPtr<IStateChangedEvent> scev = aEvent;
-            Assert(scev);
-            MachineState_T machineState;
-            scev->COMGETTER(State)(&machineState);
-            if (   machineState == MachineState_Running
-                   || machineState == MachineState_Teleporting
-                   || machineState == MachineState_LiveSnapshotting
-                   )
-            {
-                LogRelFlowFunc(("Machine is running.\n"));
-
-                mfMachineRunning = true;
-
-#ifdef VBOX_WITH_CROGL
-                crOglWindowsShow(true);
-#endif
-            }
-            else
-            {
-                mfMachineRunning = false;
-
-#ifdef VBOX_WITH_CROGL
-                if (machineState == MachineState_Paused)
-                    crOglWindowsShow(false);
-#endif
-            }
-            break;
-        }
-        default:
-            AssertFailed();
-    }
-
-    return S_OK;
-}
-
 // public methods only for internal purposes
 /////////////////////////////////////////////////////////////////////////////
 
-/**
- *  @thread EMT
- */
-static int callFramebufferResize (IFramebuffer *pFramebuffer, unsigned uScreenId,
-                                  ULONG pixelFormat, void *pvVRAM,
-                                  uint32_t bpp, uint32_t cbLine,
-                                  uint32_t w, uint32_t h)
-{
-    Assert (pFramebuffer);
-
-    /* Call the framebuffer to try and set required pixelFormat. */
-    BOOL finished = TRUE;
-
-    pFramebuffer->RequestResize (uScreenId, pixelFormat, (BYTE *) pvVRAM,
-                                 bpp, cbLine, w, h, &finished);
-
-    if (!finished)
-    {
-        LogRelFlowFunc(("External framebuffer wants us to wait!\n"));
-        return VINF_VGA_RESIZE_IN_PROGRESS;
-    }
-
-    return VINF_SUCCESS;
-}
-
-int Display::notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM)
+int Display::i_notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM)
 {
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     if (maFramebuffers[pScreen->u32ViewIndex].fRenderThreadMode)
@@ -915,7 +826,7 @@ int Display::notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN
         int rc = VERR_INVALID_STATE;
         if (mhCrOglSvc)
         {
-            VMMDev *pVMMDev = mParent->getVMMDev();
+            VMMDev *pVMMDev = mParent->i_getVMMDev();
             if (pVMMDev)
             {
                 VBOXCRCMDCTL_HGCM *pCtl;
@@ -930,12 +841,12 @@ int Display::notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN
                     pCtl->Hdr.u32Function = SHCRGL_HOST_FN_DEV_RESIZE;
                     pCtl->aParms[0].type = VBOX_HGCM_SVC_PARM_PTR;
                     pCtl->aParms[0].u.pointer.addr = pData;
-                    pCtl->aParms[0].u.pointer.size = sizeof (*pData);
+                    pCtl->aParms[0].u.pointer.size = sizeof(*pData);
 
-                    rc = crCtlSubmit(&pCtl->Hdr, sizeof (*pCtl), displayCrCmdFree, pCtl);
+                    rc = i_crCtlSubmit(&pCtl->Hdr, sizeof(*pCtl), i_displayCrCmdFree, pCtl);
                     if (RT_FAILURE(rc))
                     {
-                        AssertMsgFailed(("crCtlSubmit failed rc %d\n", rc));
+                        AssertMsgFailed(("crCtlSubmit failed (rc=%Rrc)\n", rc));
                         RTMemFree(pCtl);
                     }
                 }
@@ -952,232 +863,102 @@ int Display::notifyCroglResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN
 
 /**
  *  Handles display resize event.
- *  Disables access to VGA device;
- *  calls the framebuffer RequestResize method;
- *  if framebuffer resizes synchronously,
- *      updates the display connector data and enables access to the VGA device.
  *
  *  @param w New display width
  *  @param h New display height
  *
  *  @thread EMT
  */
-int Display::handleDisplayResize (unsigned uScreenId, uint32_t bpp, void *pvVRAM,
-                                  uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags)
+int Display::i_handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM,
+                                   uint32_t cbLine, uint32_t w, uint32_t h, uint16_t flags)
 {
     LogRel(("Display::handleDisplayResize(): uScreenId = %d, pvVRAM=%p "
             "w=%d h=%d bpp=%d cbLine=0x%X, flags=0x%X\n",
             uScreenId, pvVRAM, w, h, bpp, cbLine, flags));
 
-    /* If there is no framebuffer, this call is not interesting. */
-    if (   uScreenId >= mcMonitors
-        || maFramebuffers[uScreenId].pFramebuffer.isNull())
+    if (uScreenId >= mcMonitors)
     {
         return VINF_SUCCESS;
     }
 
-    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
-    {
-        mLastAddress = pvVRAM;
-        mLastBytesPerLine = cbLine;
-        mLastBitsPerPixel = bpp;
-        mLastWidth = w;
-        mLastHeight = h;
-        mLastFlags = flags;
-    }
+    DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
 
-    ULONG pixelFormat;
+    /* Reset the update mode. */
+    pFBInfo->updateImage.pSourceBitmap.setNull();
+    pFBInfo->updateImage.pu8Address = NULL;
+    pFBInfo->updateImage.cbLine = 0;
 
-    switch (bpp)
+    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
     {
-        case 32:
-        case 24:
-        case 16:
-            pixelFormat = FramebufferPixelFormat_FOURCC_RGB;
-            break;
-        default:
-            pixelFormat = FramebufferPixelFormat_Opaque;
-            bpp = cbLine = 0;
-            break;
+        pFBInfo->w = w;
+        pFBInfo->h = h;
+
+        pFBInfo->u16BitsPerPixel = (uint16_t)bpp;
+        pFBInfo->pu8FramebufferVRAM = (uint8_t *)pvVRAM;
+        pFBInfo->u32LineSize = cbLine;
+        pFBInfo->flags = flags;
     }
 
-    /* Atomically set the resize status before calling the framebuffer. The new InProgress status will
-     * disable access to the VGA device by the EMT thread.
-     */
-    bool f = ASMAtomicCmpXchgU32 (&maFramebuffers[uScreenId].u32ResizeStatus,
-                                  ResizeStatus_InProgress, ResizeStatus_Void);
-    if (!f)
+    /* Guest screen image will be invalid during resize, make sure that it is not updated. */
+    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
     {
-        /* This could be a result of the screenshot taking call Display::TakeScreenShot:
-         * if the framebuffer is processing the resize request and GUI calls the TakeScreenShot
-         * and the guest has reprogrammed the virtual VGA devices again so a new resize is required.
-         *
-         * Save the resize information and return the pending status code.
-         *
-         * Note: the resize information is only accessed on EMT so no serialization is required.
-         */
-        LogRel(("Display::handleDisplayResize(): Warning: resize postponed.\n"));
-
-        maFramebuffers[uScreenId].pendingResize.fPending    = true;
-        maFramebuffers[uScreenId].pendingResize.pixelFormat = pixelFormat;
-        maFramebuffers[uScreenId].pendingResize.pvVRAM      = pvVRAM;
-        maFramebuffers[uScreenId].pendingResize.bpp         = bpp;
-        maFramebuffers[uScreenId].pendingResize.cbLine      = cbLine;
-        maFramebuffers[uScreenId].pendingResize.w           = w;
-        maFramebuffers[uScreenId].pendingResize.h           = h;
-        maFramebuffers[uScreenId].pendingResize.flags       = flags;
+        mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, false);
 
-        return VINF_VGA_RESIZE_IN_PROGRESS;
+        mpDrv->IConnector.pu8Data    = NULL;
+        mpDrv->IConnector.cbScanline = 0;
+        mpDrv->IConnector.cBits      = 32; /* DevVGA does not work with cBits == 0. */
+        mpDrv->IConnector.cx         = 0;
+        mpDrv->IConnector.cy         = 0;
     }
 
-    /* Framebuffer will be invalid during resize, make sure that it is not accessed. */
-    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
-        mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort, false);
+    maFramebuffers[uScreenId].pSourceBitmap.setNull();
 
-    int rc = callFramebufferResize (maFramebuffers[uScreenId].pFramebuffer, uScreenId,
-                                    pixelFormat, pvVRAM, bpp, cbLine, w, h);
-    if (rc == VINF_VGA_RESIZE_IN_PROGRESS)
+    if (!maFramebuffers[uScreenId].pFramebuffer.isNull())
     {
-        /* Immediately return to the caller. ResizeCompleted will be called back by the
-         * GUI thread. The ResizeCompleted callback will change the resize status from
-         * InProgress to UpdateDisplayData. The latter status will be checked by the
-         * display timer callback on EMT and all required adjustments will be done there.
-         */
-        return rc;
+        HRESULT hr = maFramebuffers[uScreenId].pFramebuffer->NotifyChange(uScreenId, 0, 0, w, h); /* @todo origin */
+        LogFunc(("NotifyChange hr %08X\n", hr));
+        NOREF(hr);
     }
 
-    /* Set the status so the 'handleResizeCompleted' would work.  */
-    f = ASMAtomicCmpXchgU32 (&maFramebuffers[uScreenId].u32ResizeStatus,
-                             ResizeStatus_UpdateDisplayData, ResizeStatus_InProgress);
-    AssertRelease(f);NOREF(f);
-
-    AssertRelease(!maFramebuffers[uScreenId].pendingResize.fPending);
-
-    /* The method also unlocks the framebuffer. */
-    handleResizeCompletedEMT(TRUE);
-
-    return VINF_SUCCESS;
-}
-
-/**
- *  Framebuffer has been resized.
- *  Read the new display data and unlock the framebuffer.
- *
- *  @thread EMT
- */
-void Display::handleResizeCompletedEMT(BOOL fResizeContext)
-{
-    LogRelFlowFunc(("\n"));
-
-    unsigned uScreenId;
-    for (uScreenId = 0; uScreenId < mcMonitors; uScreenId++)
+    bool fUpdateImage = RT_BOOL(pFBInfo->u32Caps & FramebufferCapabilities_UpdateImage);
+    if (fUpdateImage && !pFBInfo->pFramebuffer.isNull())
     {
-        DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
-
-        /* Try to into non resizing state. */
-        bool f = ASMAtomicCmpXchgU32 (&pFBInfo->u32ResizeStatus, ResizeStatus_Void, ResizeStatus_UpdateDisplayData);
-
-        if (f == false)
-        {
-            /* This is not the display that has completed resizing. */
-            continue;
-        }
-
-        /* Check whether a resize is pending for this framebuffer. */
-        if (pFBInfo->pendingResize.fPending)
-        {
-            /* Reset the condition, call the display resize with saved data and continue.
-             *
-             * Note: handleDisplayResize can call handleResizeCompletedEMT back,
-             *       but infinite recursion is not possible, because when the handleResizeCompletedEMT
-             *       is called, the pFBInfo->pendingResize.fPending is equal to false.
-             */
-            pFBInfo->pendingResize.fPending = false;
-            handleDisplayResize (uScreenId, pFBInfo->pendingResize.bpp, pFBInfo->pendingResize.pvVRAM,
-                                 pFBInfo->pendingResize.cbLine, pFBInfo->pendingResize.w, pFBInfo->pendingResize.h, pFBInfo->pendingResize.flags);
-            continue;
-        }
-
-        /* Inform VRDP server about the change of display parameters.
-         * Must be done before calling NotifyUpdate below.
-         */
-        LogRelFlowFunc(("Calling VRDP\n"));
-        mParent->consoleVRDPServer()->SendResize();
-
-        /* @todo Merge these two 'if's within one 'if (!pFBInfo->pFramebuffer.isNull())' */
-        if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && !pFBInfo->pFramebuffer.isNull())
+        ComPtr<IDisplaySourceBitmap> pSourceBitmap;
+        HRESULT hr = QuerySourceBitmap(uScreenId, pSourceBitmap.asOutParam());
+        if (SUCCEEDED(hr))
         {
-            /* Primary framebuffer has completed the resize. Update the connector data for VGA device. */
-            int rc2 = updateDisplayData();
-
-            /* Check the framebuffer pixel format to setup the rendering in VGA device. */
-            BOOL usesGuestVRAM = FALSE;
-            pFBInfo->pFramebuffer->COMGETTER(UsesGuestVRAM) (&usesGuestVRAM);
-
-            pFBInfo->fDefaultFormat = (usesGuestVRAM == FALSE);
-
-            /* If the primary framebuffer is disabled, tell the VGA device to not to copy
-             * pixels from VRAM to the framebuffer.
-             */
-            if (pFBInfo->fDisabled || RT_FAILURE(rc2))
-                mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort, false);
-            else
-                mpDrv->pUpPort->pfnSetRenderVRAM (mpDrv->pUpPort,
-                                                  pFBInfo->fDefaultFormat);
-
-            /* If the screen resize was because of disabling, tell framebuffer to repaint.
-             * The framebuffer if now in default format so it will not use guest VRAM
-             * and will show usually black image which is there after framebuffer resize.
-             */
-            if (pFBInfo->fDisabled)
-                pFBInfo->pFramebuffer->NotifyUpdate(0, 0, mpDrv->IConnector.cx, mpDrv->IConnector.cy);
+            BYTE *pAddress = NULL;
+            ULONG ulWidth = 0;
+            ULONG ulHeight = 0;
+            ULONG ulBitsPerPixel = 0;
+            ULONG ulBytesPerLine = 0;
+            BitmapFormat_T bitmapFormat = BitmapFormat_Opaque;
+
+            hr = pSourceBitmap->QueryBitmapInfo(&pAddress,
+                                                &ulWidth,
+                                                &ulHeight,
+                                                &ulBitsPerPixel,
+                                                &ulBytesPerLine,
+                                                &bitmapFormat);
+            if (SUCCEEDED(hr))
+            {
+                pFBInfo->updateImage.pSourceBitmap = pSourceBitmap;
+                pFBInfo->updateImage.pu8Address = pAddress;
+                pFBInfo->updateImage.cbLine = ulBytesPerLine;
+            }
         }
-        else if (!pFBInfo->pFramebuffer.isNull())
-        {
-            BOOL usesGuestVRAM = FALSE;
-            pFBInfo->pFramebuffer->COMGETTER(UsesGuestVRAM) (&usesGuestVRAM);
-
-            pFBInfo->fDefaultFormat = (usesGuestVRAM == FALSE);
+    }
 
-            /* If the screen resize was because of disabling, tell framebuffer to repaint.
-             * The framebuffer if now in default format so it will not use guest VRAM
-             * and will show usually black image which is there after framebuffer resize.
-             */
-            if (pFBInfo->fDisabled)
-                pFBInfo->pFramebuffer->NotifyUpdate(0, 0, pFBInfo->w, pFBInfo->h);
-        }
-        LogRelFlow(("[%d]: default format %d\n", uScreenId, pFBInfo->fDefaultFormat));
+    /* Inform the VRDP server about the change of display parameters. */
+    LogRelFlowFunc(("Calling VRDP\n"));
+    mParent->i_consoleVRDPServer()->SendResize();
 
-        /* Handle the case if there are some saved visible region that needs to be
-         * applied after the resize of the framebuffer is completed
-         */
-        SaveSeamlessRectLock();
-        PRTRECT pSavedVisibleRegion = pFBInfo->mpSavedVisibleRegion;
-        uint32_t cSavedVisibleRegion = pFBInfo->mcSavedVisibleRegion;
-        pFBInfo->mpSavedVisibleRegion = NULL;
-        pFBInfo->mcSavedVisibleRegion = 0;
-        SaveSeamlessRectUnLock();
-
-        if (pSavedVisibleRegion)
-        {
-            handleSetVisibleRegion(cSavedVisibleRegion, pSavedVisibleRegion);
-            RTMemFree(pSavedVisibleRegion);
-        }
+    LogRelFlowFunc(("[%d]: default format %d\n", uScreenId, pFBInfo->fDefaultFormat));
 
-#ifdef DEBUG_sunlover
-        if (!g_stam)
-        {
-            Console::SafeVMPtr ptrVM(mParent);
-            AssertComRC(ptrVM.rc());
-            STAMR3RegisterU(ptrVM.rawUVM(), &g_StatDisplayRefresh, STAMTYPE_PROFILE, STAMVISIBILITY_ALWAYS,
-                            "/PROF/Display/Refresh", STAMUNIT_TICKS_PER_CALL, "Time spent in EMT for display updates.");
-            g_stam = 1;
-        }
-#endif /* DEBUG_sunlover */
-    }
+    return VINF_SUCCESS;
 }
 
-static void checkCoordBounds (int *px, int *py, int *pw, int *ph, int cx, int cy)
+static void i_checkCoordBounds(int *px, int *py, int *pw, int *ph, int cx, int cy)
 {
     /* Correct negative x and y coordinates. */
     if (*px < 0)
@@ -1210,56 +991,7 @@ static void checkCoordBounds (int *px, int *py, int *pw, int *ph, int cx, int cy
     }
 }
 
-unsigned mapCoordsToScreen(DISPLAYFBINFO *pInfos, unsigned cInfos, int *px, int *py, int *pw, int *ph)
-{
-    DISPLAYFBINFO *pInfo = pInfos;
-    unsigned uScreenId;
-    LogSunlover(("mapCoordsToScreen: %d,%d %dx%d\n", *px, *py, *pw, *ph));
-    for (uScreenId = 0; uScreenId < cInfos; uScreenId++, pInfo++)
-    {
-        LogSunlover(("    [%d] %d,%d %dx%d\n", uScreenId, pInfo->xOrigin, pInfo->yOrigin, pInfo->w, pInfo->h));
-        if (   (pInfo->xOrigin <= *px && *px < pInfo->xOrigin + (int)pInfo->w)
-            && (pInfo->yOrigin <= *py && *py < pInfo->yOrigin + (int)pInfo->h))
-        {
-            /* The rectangle belongs to the screen. Correct coordinates. */
-            *px -= pInfo->xOrigin;
-            *py -= pInfo->yOrigin;
-            LogSunlover(("    -> %d,%d", *px, *py));
-            break;
-        }
-    }
-    if (uScreenId == cInfos)
-    {
-        /* Map to primary screen. */
-        uScreenId = 0;
-    }
-    LogSunlover((" scr %d\n", uScreenId));
-    return uScreenId;
-}
-
-
-/**
- *  Handles display update event.
- *
- *  @param x Update area x coordinate
- *  @param y Update area y coordinate
- *  @param w Update area width
- *  @param h Update area height
- *
- *  @thread EMT
- */
-void Display::handleDisplayUpdateLegacy (int x, int y, int w, int h)
-{
-    unsigned uScreenId = mapCoordsToScreen(maFramebuffers, mcMonitors, &x, &y, &w, &h);
-
-#ifdef DEBUG_sunlover
-    LogFlowFunc(("%d,%d %dx%d (checked)\n", x, y, w, h));
-#endif /* DEBUG_sunlover */
-
-    handleDisplayUpdate (uScreenId, x, y, w, h);
-}
-
-void Display::handleDisplayUpdate (unsigned uScreenId, int x, int y, int w, int h)
+void Display::i_handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h)
 {
     /*
      * Always runs under either VBVA lock or, for HGSMI, DevVGA lock.
@@ -1267,48 +999,81 @@ void Display::handleDisplayUpdate (unsigned uScreenId, int x, int y, int w, int
      */
 
 #ifdef DEBUG_sunlover
-    LogFlowFunc(("[%d] %d,%d %dx%d (%d,%d)\n",
-                 uScreenId, x, y, w, h, mpDrv->IConnector.cx, mpDrv->IConnector.cy));
+    LogFlowFunc(("[%d] %d,%d %dx%d\n",
+                 uScreenId, x, y, w, h));
 #endif /* DEBUG_sunlover */
 
+    /* No updates for a disabled guest screen. */
+    if (maFramebuffers[uScreenId].fDisabled)
+        return;
+
+    /* No updates for a blank guest screen. */
+    /** @note Disabled for now, as the GUI does not update the picture when we
+     * first blank. */
+    /* if (maFramebuffers[uScreenId].flags & VBVA_SCREEN_F_BLANK)
+        return; */
+
+    i_checkCoordBounds (&x, &y, &w, &h, maFramebuffers[uScreenId].w,
+                                        maFramebuffers[uScreenId].h);
+
     IFramebuffer *pFramebuffer = maFramebuffers[uScreenId].pFramebuffer;
+    if (pFramebuffer != NULL)
+    {
+        if (w != 0 && h != 0)
+        {
+            bool fUpdateImage = RT_BOOL(maFramebuffers[uScreenId].u32Caps & FramebufferCapabilities_UpdateImage);
+            if (RT_LIKELY(!fUpdateImage))
+            {
+                pFramebuffer->NotifyUpdate(x, y, w, h);
+            }
+            else
+            {
+                AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    // if there is no framebuffer, this call is not interesting
-    if (   pFramebuffer == NULL
-        || maFramebuffers[uScreenId].fDisabled)
-        return;
+                DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
 
-    pFramebuffer->Lock();
+                if (!pFBInfo->updateImage.pSourceBitmap.isNull())
+                {
+                    Assert(pFBInfo->updateImage.pu8Address);
 
-    if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
-        checkCoordBounds (&x, &y, &w, &h, mpDrv->IConnector.cx, mpDrv->IConnector.cy);
-    else
-        checkCoordBounds (&x, &y, &w, &h, maFramebuffers[uScreenId].w,
-                                          maFramebuffers[uScreenId].h);
+                    size_t cbData = w * h * 4;
+                    com::SafeArray<BYTE> image(cbData);
+
+                    uint8_t *pu8Dst = image.raw();
+                    const uint8_t *pu8Src = pFBInfo->updateImage.pu8Address + pFBInfo->updateImage.cbLine * y + x * 4;
 
-    if (w != 0 && h != 0)
-        pFramebuffer->NotifyUpdate(x, y, w, h);
+                    int i;
+                    for (i = y; i < y + h; ++i)
+                    {
+                        memcpy(pu8Dst, pu8Src, w * 4);
+                        pu8Dst += w * 4;
+                        pu8Src += pFBInfo->updateImage.cbLine;
+                    }
 
-    pFramebuffer->Unlock();
+                    pFramebuffer->NotifyUpdateImage(x, y, w, h, ComSafeArrayAsInParam(image));
+                }
+            }
+        }
+    }
 
 #ifndef VBOX_WITH_HGSMI
-    if (!mfVideoAccelEnabled)
+    if (!mVideoAccelLegacy.fVideoAccelEnabled)
     {
 #else
-    if (!mfVideoAccelEnabled && !maFramebuffers[uScreenId].fVBVAEnabled)
+    if (!mVideoAccelLegacy.fVideoAccelEnabled && !maFramebuffers[uScreenId].fVBVAEnabled)
     {
 #endif /* VBOX_WITH_HGSMI */
-        /* When VBVA is enabled, the VRDP server is informed in the VideoAccelFlush.
+        /* When VBVA is enabled, the VRDP server is informed
+         * either in VideoAccelFlush or displayVBVAUpdateProcess.
          * Inform the server here only if VBVA is disabled.
          */
-        if (maFramebuffers[uScreenId].u32ResizeStatus == ResizeStatus_Void)
-            mParent->consoleVRDPServer()->SendUpdateBitmap(uScreenId, x, y, w, h);
+        mParent->i_consoleVRDPServer()->SendUpdateBitmap(uScreenId, x, y, w, h);
     }
 }
 
 void Display::i_updateGuestGraphicsFacility(void)
 {
-    Guest* pGuest = mParent->getGuest();
+    Guest* pGuest = mParent->i_getGuest();
     AssertPtrReturnVoid(pGuest);
     /* The following is from GuestImpl.cpp. */
     /** @todo A nit: The timestamp is wrong on saved state restore. Would be better
@@ -1319,13 +1084,13 @@ void Display::i_updateGuestGraphicsFacility(void)
 
     if (   mfVMMDevSupportsGraphics
         || (mfGuestVBVACapabilities & VBVACAPS_VIDEO_MODE_HINTS) != 0)
-        pGuest->setAdditionsStatus(VBoxGuestFacilityType_Graphics,
-                                   VBoxGuestFacilityStatus_Active,
-                                   0 /*fFlags*/, &TimeSpecTS);
+        pGuest->i_setAdditionsStatus(VBoxGuestFacilityType_Graphics,
+                                     VBoxGuestFacilityStatus_Active,
+                                     0 /*fFlags*/, &TimeSpecTS);
     else
-        pGuest->setAdditionsStatus(VBoxGuestFacilityType_Graphics,
-                                   VBoxGuestFacilityStatus_Inactive,
-                                   0 /*fFlags*/, &TimeSpecTS);
+        pGuest->i_setAdditionsStatus(VBoxGuestFacilityType_Graphics,
+                                     VBoxGuestFacilityStatus_Inactive,
+                                     0 /*fFlags*/, &TimeSpecTS);
 }
 
 void Display::i_handleUpdateVMMDevSupportsGraphics(bool fSupportsGraphics)
@@ -1348,7 +1113,7 @@ void Display::i_handleUpdateGuestVBVACapabilities(uint32_t fNewCapabilities)
         return;
     i_updateGuestGraphicsFacility();
     /* Tell the console about it */
-    mParent->onAdditionsStateChange();
+    mParent->i_onAdditionsStateChange();
 }
 
 void Display::i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, uint32_t cx, uint32_t cy)
@@ -1366,8 +1131,8 @@ void Display::i_handleUpdateVBVAInputMapping(int32_t xOrigin, int32_t yOrigin, u
  * The lower right is "exclusive" (i.e. first pixel beyond the framebuffer),
  * and the origin is (0, 0), not (1, 1) like the GUI returns.
  */
-void Display::getFramebufferDimensions(int32_t *px1, int32_t *py1,
-                                       int32_t *px2, int32_t *py2)
+void Display::i_getFramebufferDimensions(int32_t *px1, int32_t *py1,
+                                         int32_t *px2, int32_t *py2)
 {
     int32_t x1 = 0, y1 = 0, x2 = 0, y2 = 0;
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -1386,8 +1151,8 @@ void Display::getFramebufferDimensions(int32_t *px1, int32_t *py1,
     {
         x1 = (int32_t)maFramebuffers[0].xOrigin;
         y1 = (int32_t)maFramebuffers[0].yOrigin;
-        x2 = mpDrv->IConnector.cx + (int32_t)maFramebuffers[0].xOrigin;
-        y2 = mpDrv->IConnector.cy + (int32_t)maFramebuffers[0].yOrigin;
+        x2 = (int32_t)maFramebuffers[0].w + (int32_t)maFramebuffers[0].xOrigin;
+        y2 = (int32_t)maFramebuffers[0].h + (int32_t)maFramebuffers[0].yOrigin;
     }
     if (cxInputMapping && cyInputMapping)
     {
@@ -1455,7 +1220,7 @@ static bool displayIntersectRect(RTRECT *prectResult,
                                  const RTRECT *prect2)
 {
     /* Initialize result to an empty record. */
-    memset (prectResult, 0, sizeof (RTRECT));
+    memset(prectResult, 0, sizeof(RTRECT));
 
     int xLeftResult = RT_MAX(prect1->xLeft, prect2->xLeft);
     int xRightResult = RT_MIN(prect1->xRight, prect2->xRight);
@@ -1483,10 +1248,10 @@ static bool displayIntersectRect(RTRECT *prectResult,
     return false;
 }
 
-int Display::handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect)
+int Display::i_handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect)
 {
     RTRECT *pVisibleRegion = (RTRECT *)RTMemTmpAlloc(  RT_MAX(cRect, 1)
-                                                     * sizeof (RTRECT));
+                                                     * sizeof(RTRECT));
     if (!pVisibleRegion)
     {
         return VERR_NO_TMP_MEMORY;
@@ -1497,65 +1262,16 @@ int Display::handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect)
     {
         DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
 
-        if (!pFBInfo->pFramebuffer.isNull())
+        if (  !pFBInfo->pFramebuffer.isNull()
+            & RT_BOOL(pFBInfo->u32Caps & FramebufferCapabilities_VisibleRegion))
         {
-            if (pFBInfo->u32ResizeStatus != ResizeStatus_Void)
-            {
-                /* handle the case where new rectangles are received from the GA
-                 * when framebuffer resizing is in progress.
-                 * Just save the rectangles to be applied for later time when FB resizing is complete
-                 * (from handleResizeCompletedEMT).
-                 * This is done to prevent a race condition where a new rectangles are received
-                 * from the GA after a resize event and framebuffer resizing is still in progress
-                 * As a result the coordinates of the framebuffer are still
-                 * not updated and hence there is no intersection with the new rectangles passed
-                 * for the new region (THis is checked in the above if condition ). With 0 intersection,
-                 * cRectVisibleRegions = 0  is returned to the GUI and if GUI has invalidated its
-                 * earlier region then it draws nothihing and seamless mode doesn't display the
-                 * guest desktop.
-                 */
-                SaveSeamlessRectLock();
-                RTMemFree(pFBInfo->mpSavedVisibleRegion);
-
-                pFBInfo->mpSavedVisibleRegion = (RTRECT *)RTMemAlloc( RT_MAX(cRect, 1)
-                                                                     * sizeof (RTRECT));
-                if (pFBInfo->mpSavedVisibleRegion)
-                {
-                    memcpy(pFBInfo->mpSavedVisibleRegion, pRect, cRect * sizeof(RTRECT));
-                    pFBInfo->mcSavedVisibleRegion = cRect;
-                }
-                else
-                {
-                    pFBInfo->mcSavedVisibleRegion = 0;
-                }
-                SaveSeamlessRectUnLock();
-                continue;
-            }
             /* Prepare a new array of rectangles which intersect with the framebuffer.
              */
             RTRECT rectFramebuffer;
-            if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
-            {
-                rectFramebuffer.xLeft   = 0;
-                rectFramebuffer.yTop    = 0;
-                if (mpDrv)
-                {
-                    rectFramebuffer.xRight  = mpDrv->IConnector.cx;
-                    rectFramebuffer.yBottom = mpDrv->IConnector.cy;
-                }
-                else
-                {
-                    rectFramebuffer.xRight  = 0;
-                    rectFramebuffer.yBottom = 0;
-                }
-            }
-            else
-            {
-                rectFramebuffer.xLeft   = pFBInfo->xOrigin;
-                rectFramebuffer.yTop    = pFBInfo->yOrigin;
-                rectFramebuffer.xRight  = pFBInfo->xOrigin + pFBInfo->w;
-                rectFramebuffer.yBottom = pFBInfo->yOrigin + pFBInfo->h;
-            }
+            rectFramebuffer.xLeft   = pFBInfo->xOrigin;
+            rectFramebuffer.yTop    = pFBInfo->yOrigin;
+            rectFramebuffer.xRight  = pFBInfo->xOrigin + pFBInfo->w;
+            rectFramebuffer.yBottom = pFBInfo->yOrigin + pFBInfo->h;
 
             uint32_t cRectVisibleRegion = 0;
 
@@ -1577,7 +1293,7 @@ int Display::handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect)
     }
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    VMMDev *vmmDev = mParent->getVMMDev();
+    VMMDev *vmmDev = mParent->i_getVMMDev();
     if (mfIsCr3DEnabled && vmmDev)
     {
         if (mhCrOglSvc)
@@ -1587,19 +1303,19 @@ int Display::handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect)
             if (pCtl)
             {
                 RTRECT *pRectsCopy = (RTRECT*)(pCtl+1);
-                memcpy(pRectsCopy, pRect, cRect * sizeof (RTRECT));
+                memcpy(pRectsCopy, pRect, cRect * sizeof(RTRECT));
 
                 pCtl->Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM;
                 pCtl->Hdr.u32Function = SHCRGL_HOST_FN_SET_VISIBLE_REGION;
 
                 pCtl->aParms[0].type = VBOX_HGCM_SVC_PARM_PTR;
                 pCtl->aParms[0].u.pointer.addr = pRectsCopy;
-                pCtl->aParms[0].u.pointer.size = cRect * sizeof (RTRECT);
+                pCtl->aParms[0].u.pointer.size = cRect * sizeof(RTRECT);
 
-                int rc = crCtlSubmit(&pCtl->Hdr, sizeof (*pCtl), displayCrCmdFree, pCtl);
+                int rc = i_crCtlSubmit(&pCtl->Hdr, sizeof(*pCtl), i_displayCrCmdFree, pCtl);
                 if (!RT_SUCCESS(rc))
                 {
-                    AssertMsgFailed(("crCtlSubmit failed rc %d\n", rc));
+                    AssertMsgFailed(("crCtlSubmit failed (rc=%Rrc)\n", rc));
                     RTMemFree(pCtl);
                 }
             }
@@ -1616,356 +1332,110 @@ int Display::handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect)
     return VINF_SUCCESS;
 }
 
-int Display::handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect)
+int Display::i_handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect)
 {
     // @todo Currently not used by the guest and is not implemented in framebuffers. Remove?
     return VERR_NOT_SUPPORTED;
 }
 
-typedef struct _VBVADIRTYREGION
+#ifdef VBOX_WITH_HGSMI
+static void vbvaSetMemoryFlagsHGSMI(unsigned uScreenId,
+                                    uint32_t fu32SupportedOrders,
+                                    bool fVideoAccelVRDP,
+                                    DISPLAYFBINFO *pFBInfo)
 {
-    /* Copies of object's pointers used by vbvaRgn functions. */
-    DISPLAYFBINFO    *paFramebuffers;
-    unsigned          cMonitors;
-    Display          *pDisplay;
-    PPDMIDISPLAYPORT  pPort;
+    LogRelFlowFunc(("HGSMI[%d]: %p\n", uScreenId, pFBInfo->pVBVAHostFlags));
 
-} VBVADIRTYREGION;
+    if (pFBInfo->pVBVAHostFlags)
+    {
+        uint32_t fu32HostEvents = VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET;
 
-static void vbvaRgnInit (VBVADIRTYREGION *prgn, DISPLAYFBINFO *paFramebuffers, unsigned cMonitors, Display *pd, PPDMIDISPLAYPORT pp)
-{
-    prgn->paFramebuffers = paFramebuffers;
-    prgn->cMonitors = cMonitors;
-    prgn->pDisplay = pd;
-    prgn->pPort = pp;
+        if (pFBInfo->fVBVAEnabled)
+        {
+            fu32HostEvents |= VBVA_F_MODE_ENABLED;
 
-    unsigned uScreenId;
-    for (uScreenId = 0; uScreenId < cMonitors; uScreenId++)
-    {
-        DISPLAYFBINFO *pFBInfo = &prgn->paFramebuffers[uScreenId];
+            if (fVideoAccelVRDP)
+            {
+                fu32HostEvents |= VBVA_F_MODE_VRDP;
+            }
+        }
+
+        ASMAtomicWriteU32(&pFBInfo->pVBVAHostFlags->u32HostEvents, fu32HostEvents);
+        ASMAtomicWriteU32(&pFBInfo->pVBVAHostFlags->u32SupportedOrders, fu32SupportedOrders);
 
-        RT_ZERO(pFBInfo->dirtyRect);
+        LogRelFlowFunc(("    fu32HostEvents = 0x%08X, fu32SupportedOrders = 0x%08X\n", fu32HostEvents, fu32SupportedOrders));
     }
 }
 
-static void vbvaRgnDirtyRect (VBVADIRTYREGION *prgn, unsigned uScreenId, VBVACMDHDR *phdr)
+static void vbvaSetMemoryFlagsAllHGSMI(uint32_t fu32SupportedOrders,
+                                       bool fVideoAccelVRDP,
+                                       DISPLAYFBINFO *paFBInfos,
+                                       unsigned cFBInfos)
 {
-    LogSunlover(("x = %d, y = %d, w = %d, h = %d\n",
-                 phdr->x, phdr->y, phdr->w, phdr->h));
+    unsigned uScreenId;
 
-    /*
-     * Here update rectangles are accumulated to form an update area.
-     * @todo
-     * Now the simplest method is used which builds one rectangle that
-     * includes all update areas. A bit more advanced method can be
-     * employed here. The method should be fast however.
-     */
-    if (phdr->w == 0 || phdr->h == 0)
+    for (uScreenId = 0; uScreenId < cFBInfos; uScreenId++)
     {
-        /* Empty rectangle. */
-        return;
+        vbvaSetMemoryFlagsHGSMI(uScreenId, fu32SupportedOrders, fVideoAccelVRDP, &paFBInfos[uScreenId]);
     }
+}
+#endif /* VBOX_WITH_HGSMI */
 
-    int32_t xRight  = phdr->x + phdr->w;
-    int32_t yBottom = phdr->y + phdr->h;
-
-    DISPLAYFBINFO *pFBInfo = &prgn->paFramebuffers[uScreenId];
-
-    if (pFBInfo->dirtyRect.xRight == 0)
+int Display::VideoAccelEnableVMMDev(bool fEnable, VBVAMEMORY *pVbvaMemory)
+{
+    LogFlowFunc(("%d %p\n", fEnable, pVbvaMemory));
+    int rc = videoAccelEnterVMMDev(&mVideoAccelLegacy);
+    if (RT_SUCCESS(rc))
     {
-        /* This is the first rectangle to be added. */
-        pFBInfo->dirtyRect.xLeft   = phdr->x;
-        pFBInfo->dirtyRect.yTop    = phdr->y;
-        pFBInfo->dirtyRect.xRight  = xRight;
-        pFBInfo->dirtyRect.yBottom = yBottom;
+        rc = i_VideoAccelEnable(fEnable, pVbvaMemory, mpDrv->pUpPort);
+        videoAccelLeaveVMMDev(&mVideoAccelLegacy);
     }
-    else
+    LogFlowFunc(("leave %Rrc\n", rc));
+    return rc;
+}
+
+int Display::VideoAccelEnableVGA(bool fEnable, VBVAMEMORY *pVbvaMemory)
+{
+    LogFlowFunc(("%d %p\n", fEnable, pVbvaMemory));
+    int rc = videoAccelEnterVGA(&mVideoAccelLegacy);
+    if (RT_SUCCESS(rc))
     {
-        /* Adjust region coordinates. */
-        if (pFBInfo->dirtyRect.xLeft > phdr->x)
-        {
-            pFBInfo->dirtyRect.xLeft = phdr->x;
-        }
+        rc = i_VideoAccelEnable(fEnable, pVbvaMemory, mpDrv->pUpPort);
+        videoAccelLeaveVGA(&mVideoAccelLegacy);
+    }
+    LogFlowFunc(("leave %Rrc\n", rc));
+    return rc;
+}
 
-        if (pFBInfo->dirtyRect.yTop > phdr->y)
-        {
-            pFBInfo->dirtyRect.yTop = phdr->y;
-        }
-
-        if (pFBInfo->dirtyRect.xRight < xRight)
-        {
-            pFBInfo->dirtyRect.xRight = xRight;
-        }
-
-        if (pFBInfo->dirtyRect.yBottom < yBottom)
-        {
-            pFBInfo->dirtyRect.yBottom = yBottom;
-        }
-    }
-
-    if (pFBInfo->fDefaultFormat)
-    {
-        //@todo pfnUpdateDisplayRect must take the vram offset parameter for the framebuffer
-        prgn->pPort->pfnUpdateDisplayRect (prgn->pPort, phdr->x, phdr->y, phdr->w, phdr->h);
-        prgn->pDisplay->handleDisplayUpdateLegacy (phdr->x + pFBInfo->xOrigin,
-                                             phdr->y + pFBInfo->yOrigin, phdr->w, phdr->h);
-    }
-
-    return;
-}
-
-static void vbvaRgnUpdateFramebuffer (VBVADIRTYREGION *prgn, unsigned uScreenId)
-{
-    DISPLAYFBINFO *pFBInfo = &prgn->paFramebuffers[uScreenId];
-
-    uint32_t w = pFBInfo->dirtyRect.xRight - pFBInfo->dirtyRect.xLeft;
-    uint32_t h = pFBInfo->dirtyRect.yBottom - pFBInfo->dirtyRect.yTop;
-
-    if (!pFBInfo->fDefaultFormat && pFBInfo->pFramebuffer && w != 0 && h != 0)
-    {
-        //@todo pfnUpdateDisplayRect must take the vram offset parameter for the framebuffer
-        prgn->pPort->pfnUpdateDisplayRect (prgn->pPort, pFBInfo->dirtyRect.xLeft, pFBInfo->dirtyRect.yTop, w, h);
-        prgn->pDisplay->handleDisplayUpdateLegacy (pFBInfo->dirtyRect.xLeft + pFBInfo->xOrigin,
-                                             pFBInfo->dirtyRect.yTop + pFBInfo->yOrigin, w, h);
-    }
-}
-
-static void vbvaSetMemoryFlags (VBVAMEMORY *pVbvaMemory,
-                                bool fVideoAccelEnabled,
-                                bool fVideoAccelVRDP,
-                                uint32_t fu32SupportedOrders,
-                                DISPLAYFBINFO *paFBInfos,
-                                unsigned cFBInfos)
-{
-    if (pVbvaMemory)
-    {
-        /* This called only on changes in mode. So reset VRDP always. */
-        uint32_t fu32Flags = VBVA_F_MODE_VRDP_RESET;
-
-        if (fVideoAccelEnabled)
-        {
-            fu32Flags |= VBVA_F_MODE_ENABLED;
-
-            if (fVideoAccelVRDP)
-            {
-                fu32Flags |= VBVA_F_MODE_VRDP | VBVA_F_MODE_VRDP_ORDER_MASK;
-
-                pVbvaMemory->fu32SupportedOrders = fu32SupportedOrders;
-            }
-        }
-
-        pVbvaMemory->fu32ModeFlags = fu32Flags;
-    }
-
-    unsigned uScreenId;
-    for (uScreenId = 0; uScreenId < cFBInfos; uScreenId++)
-    {
-        if (paFBInfos[uScreenId].pHostEvents)
-        {
-            paFBInfos[uScreenId].pHostEvents->fu32Events |= VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET;
-        }
-    }
-}
-
-#ifdef VBOX_WITH_HGSMI
-static void vbvaSetMemoryFlagsHGSMI (unsigned uScreenId,
-                                     uint32_t fu32SupportedOrders,
-                                     bool fVideoAccelVRDP,
-                                     DISPLAYFBINFO *pFBInfo)
+void Display::VideoAccelFlushVMMDev(void)
 {
-    LogRelFlowFunc(("HGSMI[%d]: %p\n", uScreenId, pFBInfo->pVBVAHostFlags));
-
-    if (pFBInfo->pVBVAHostFlags)
-    {
-        uint32_t fu32HostEvents = VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET;
-
-        if (pFBInfo->fVBVAEnabled)
-        {
-            fu32HostEvents |= VBVA_F_MODE_ENABLED;
-
-            if (fVideoAccelVRDP)
-            {
-                fu32HostEvents |= VBVA_F_MODE_VRDP;
-            }
-        }
-
-        ASMAtomicWriteU32(&pFBInfo->pVBVAHostFlags->u32HostEvents, fu32HostEvents);
-        ASMAtomicWriteU32(&pFBInfo->pVBVAHostFlags->u32SupportedOrders, fu32SupportedOrders);
-
-        LogRelFlowFunc(("    fu32HostEvents = 0x%08X, fu32SupportedOrders = 0x%08X\n", fu32HostEvents, fu32SupportedOrders));
-    }
-}
-
-static void vbvaSetMemoryFlagsAllHGSMI (uint32_t fu32SupportedOrders,
-                                        bool fVideoAccelVRDP,
-                                        DISPLAYFBINFO *paFBInfos,
-                                        unsigned cFBInfos)
-{
-    unsigned uScreenId;
-
-    for (uScreenId = 0; uScreenId < cFBInfos; uScreenId++)
-    {
-        vbvaSetMemoryFlagsHGSMI(uScreenId, fu32SupportedOrders, fVideoAccelVRDP, &paFBInfos[uScreenId]);
-    }
-}
-#endif /* VBOX_WITH_HGSMI */
-
-bool Display::VideoAccelAllowed (void)
-{
-    return true;
-}
-
-int Display::vbvaLock(void)
-{
-    return RTCritSectEnter(&mVBVALock);
-}
-
-void Display::vbvaUnlock(void)
-{
-    RTCritSectLeave(&mVBVALock);
-}
-
-int Display::SaveSeamlessRectLock(void)
-{
-    return RTCritSectEnter(&mSaveSeamlessRectLock);
-}
-
-void Display::SaveSeamlessRectUnLock(void)
-{
-    RTCritSectLeave(&mSaveSeamlessRectLock);
-}
-
-
-/**
- * @thread EMT
- */
-int Display::VideoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory)
-{
-    int rc;
-    vbvaLock();
-    rc = videoAccelEnable (fEnable, pVbvaMemory);
-    vbvaUnlock();
-    return rc;
-}
-
-int Display::videoAccelEnable (bool fEnable, VBVAMEMORY *pVbvaMemory)
-{
-    int rc = VINF_SUCCESS;
-
-    /* Called each time the guest wants to use acceleration,
-     * or when the VGA device disables acceleration,
-     * or when restoring the saved state with accel enabled.
-     *
-     * VGA device disables acceleration on each video mode change
-     * and on reset.
-     *
-     * Guest enabled acceleration at will. And it has to enable
-     * acceleration after a mode change.
-     */
-    LogRelFlowFunc(("mfVideoAccelEnabled = %d, fEnable = %d, pVbvaMemory = %p\n",
-                  mfVideoAccelEnabled, fEnable, pVbvaMemory));
-
-    /* Strictly check parameters. Callers must not pass anything in the case. */
-    Assert((fEnable && pVbvaMemory) || (!fEnable && pVbvaMemory == NULL));
-
-    if (!VideoAccelAllowed ())
-        return VERR_NOT_SUPPORTED;
-
-    /*
-     * Verify that the VM is in running state. If it is not,
-     * then this must be postponed until it goes to running.
-     */
-    if (!mfMachineRunning)
-    {
-        Assert (!mfVideoAccelEnabled);
-
-        LogRelFlowFunc(("Machine is not yet running.\n"));
-
-        if (fEnable)
-        {
-            mfPendingVideoAccelEnable = fEnable;
-            mpPendingVbvaMemory = pVbvaMemory;
-        }
-
-        return rc;
-    }
-
-    /* Check that current status is not being changed */
-    if (mfVideoAccelEnabled == fEnable)
-        return rc;
-
-    if (mfVideoAccelEnabled)
-    {
-        /* Process any pending orders and empty the VBVA ring buffer. */
-        videoAccelFlush ();
-    }
-
-    if (!fEnable && mpVbvaMemory)
-        mpVbvaMemory->fu32ModeFlags &= ~VBVA_F_MODE_ENABLED;
-
-    /* Safety precaution. There is no more VBVA until everything is setup! */
-    mpVbvaMemory = NULL;
-    mfVideoAccelEnabled = false;
-
-    /* Update entire display. */
-    if (maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].u32ResizeStatus == ResizeStatus_Void)
-        mpDrv->pUpPort->pfnUpdateDisplayAll(mpDrv->pUpPort);
-
-    /* Everything OK. VBVA status can be changed. */
-
-    /* Notify the VMMDev, which saves VBVA status in the saved state,
-     * and needs to know current status.
-     */
-    VMMDev *pVMMDev = mParent->getVMMDev();
-    if (pVMMDev)
-    {
-        PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
-        if (pVMMDevPort)
-            pVMMDevPort->pfnVBVAChange(pVMMDevPort, fEnable);
-    }
-
-    if (fEnable)
-    {
-        mpVbvaMemory = pVbvaMemory;
-        mfVideoAccelEnabled = true;
-
-        /* Initialize the hardware memory. */
-        vbvaSetMemoryFlags(mpVbvaMemory, mfVideoAccelEnabled, mfVideoAccelVRDP, mfu32SupportedOrders, maFramebuffers, mcMonitors);
-        mpVbvaMemory->off32Data = 0;
-        mpVbvaMemory->off32Free = 0;
-
-        memset(mpVbvaMemory->aRecords, 0, sizeof (mpVbvaMemory->aRecords));
-        mpVbvaMemory->indexRecordFirst = 0;
-        mpVbvaMemory->indexRecordFree = 0;
-
-        mfu32PendingVideoAccelDisable = false;
-
-        LogRel(("VBVA: Enabled.\n"));
-    }
-    else
+    LogFlowFunc(("enter\n"));
+    int rc = videoAccelEnterVMMDev(&mVideoAccelLegacy);
+    if (RT_SUCCESS(rc))
     {
-        LogRel(("VBVA: Disabled.\n"));
+        i_VideoAccelFlush(mpDrv->pUpPort);
+        videoAccelLeaveVMMDev(&mVideoAccelLegacy);
     }
-
-    LogRelFlowFunc(("VideoAccelEnable: rc = %Rrc.\n", rc));
-
-    return rc;
+    LogFlowFunc(("leave\n"));
 }
 
 /* Called always by one VRDP server thread. Can be thread-unsafe.
  */
-void Display::VideoAccelVRDP (bool fEnable)
+void Display::i_VideoAccelVRDP(bool fEnable)
 {
     LogRelFlowFunc(("fEnable = %d\n", fEnable));
 
-    vbvaLock();
+    VIDEOACCEL *pVideoAccel = &mVideoAccelLegacy;
 
     int c = fEnable?
-                ASMAtomicIncS32 (&mcVideoAccelVRDPRefs):
-                ASMAtomicDecS32 (&mcVideoAccelVRDPRefs);
+                ASMAtomicIncS32(&mcVideoAccelVRDPRefs):
+                ASMAtomicDecS32(&mcVideoAccelVRDPRefs);
 
     Assert (c >= 0);
 
+    /* This can run concurrently with Display videoaccel state change. */
+    RTCritSectEnter(&mVideoAccelLock);
+
     if (c == 0)
     {
         /* The last client has disconnected, and the accel can be
@@ -1976,7 +1446,8 @@ void Display::VideoAccelVRDP (bool fEnable)
         mfVideoAccelVRDP = false;
         mfu32SupportedOrders = 0;
 
-        vbvaSetMemoryFlags (mpVbvaMemory, mfVideoAccelEnabled, mfVideoAccelVRDP, mfu32SupportedOrders, maFramebuffers, mcMonitors);
+        i_vbvaSetMemoryFlags(pVideoAccel->pVbvaMemory, pVideoAccel->fVideoAccelEnabled, mfVideoAccelVRDP, mfu32SupportedOrders,
+                             maFramebuffers, mcMonitors);
 #ifdef VBOX_WITH_HGSMI
         /* Here is VRDP-IN thread. Process the request in vbvaUpdateBegin under DevVGA lock on an EMT. */
         ASMAtomicIncU32(&mu32UpdateVBVAFlags);
@@ -1995,7 +1466,8 @@ void Display::VideoAccelVRDP (bool fEnable)
         /* Supporting all orders. */
         mfu32SupportedOrders = ~0;
 
-        vbvaSetMemoryFlags (mpVbvaMemory, mfVideoAccelEnabled, mfVideoAccelVRDP, mfu32SupportedOrders, maFramebuffers, mcMonitors);
+        i_vbvaSetMemoryFlags(pVideoAccel->pVbvaMemory, pVideoAccel->fVideoAccelEnabled, mfVideoAccelVRDP, mfu32SupportedOrders,
+                             maFramebuffers, mcMonitors);
 #ifdef VBOX_WITH_HGSMI
         /* Here is VRDP-IN thread. Process the request in vbvaUpdateBegin under DevVGA lock on an EMT. */
         ASMAtomicIncU32(&mu32UpdateVBVAFlags);
@@ -2008,641 +1480,241 @@ void Display::VideoAccelVRDP (bool fEnable)
         /* A client is connected or disconnected but there is no change in the
          * accel state. It remains enabled.
          */
-        Assert (mfVideoAccelVRDP == true);
+        Assert(mfVideoAccelVRDP == true);
     }
-    vbvaUnlock();
-}
-
-static bool vbvaVerifyRingBuffer (VBVAMEMORY *pVbvaMemory)
-{
-    return true;
-}
-
-static void vbvaFetchBytes (VBVAMEMORY *pVbvaMemory, uint8_t *pu8Dst, uint32_t cbDst)
-{
-    if (cbDst >= VBVA_RING_BUFFER_SIZE)
-    {
-        AssertMsgFailed (("cbDst = 0x%08X, ring buffer size 0x%08X\n", cbDst, VBVA_RING_BUFFER_SIZE));
-        return;
-    }
-
-    uint32_t u32BytesTillBoundary = VBVA_RING_BUFFER_SIZE - pVbvaMemory->off32Data;
-    uint8_t  *src                 = &pVbvaMemory->au8RingBuffer[pVbvaMemory->off32Data];
-    int32_t i32Diff               = cbDst - u32BytesTillBoundary;
-
-    if (i32Diff <= 0)
-    {
-        /* Chunk will not cross buffer boundary. */
-        memcpy (pu8Dst, src, cbDst);
-    }
-    else
-    {
-        /* Chunk crosses buffer boundary. */
-        memcpy (pu8Dst, src, u32BytesTillBoundary);
-        memcpy (pu8Dst + u32BytesTillBoundary, &pVbvaMemory->au8RingBuffer[0], i32Diff);
-    }
-
-    /* Advance data offset. */
-    pVbvaMemory->off32Data = (pVbvaMemory->off32Data + cbDst) % VBVA_RING_BUFFER_SIZE;
 
-    return;
+    RTCritSectLeave(&mVideoAccelLock);
 }
 
-
-static bool vbvaPartialRead (uint8_t **ppu8, uint32_t *pcb, uint32_t cbRecord, VBVAMEMORY *pVbvaMemory)
+void Display::i_notifyPowerDown(void)
 {
-    uint8_t *pu8New;
-
-    LogFlow(("MAIN::DisplayImpl::vbvaPartialRead: p = %p, cb = %d, cbRecord 0x%08X\n",
-             *ppu8, *pcb, cbRecord));
-
-    if (*ppu8)
-    {
-        Assert (*pcb);
-        pu8New = (uint8_t *)RTMemRealloc (*ppu8, cbRecord);
-    }
-    else
-    {
-        Assert (!*pcb);
-        pu8New = (uint8_t *)RTMemAlloc (cbRecord);
-    }
-
-    if (!pu8New)
-    {
-        /* Memory allocation failed, fail the function. */
-        Log(("MAIN::vbvaPartialRead: failed to (re)alocate memory for partial record!!! cbRecord 0x%08X\n",
-             cbRecord));
-
-        if (*ppu8)
-        {
-            RTMemFree (*ppu8);
-        }
-
-        *ppu8 = NULL;
-        *pcb = 0;
-
-        return false;
-    }
-
-    /* Fetch data from the ring buffer. */
-    vbvaFetchBytes (pVbvaMemory, pu8New + *pcb, cbRecord - *pcb);
-
-    *ppu8 = pu8New;
-    *pcb = cbRecord;
-
-    return true;
-}
-
-/* For contiguous chunks just return the address in the buffer.
- * For crossing boundary - allocate a buffer from heap.
- */
-bool Display::vbvaFetchCmd (VBVACMDHDR **ppHdr, uint32_t *pcbCmd)
-{
-    uint32_t indexRecordFirst = mpVbvaMemory->indexRecordFirst;
-    uint32_t indexRecordFree = mpVbvaMemory->indexRecordFree;
-
-#ifdef DEBUG_sunlover
-    LogFlowFunc(("first = %d, free = %d\n",
-                 indexRecordFirst, indexRecordFree));
-#endif /* DEBUG_sunlover */
-
-    if (!vbvaVerifyRingBuffer (mpVbvaMemory))
-    {
-        return false;
-    }
-
-    if (indexRecordFirst == indexRecordFree)
-    {
-        /* No records to process. Return without assigning output variables. */
-        return true;
-    }
-
-    VBVARECORD *pRecord = &mpVbvaMemory->aRecords[indexRecordFirst];
-
-#ifdef DEBUG_sunlover
-    LogFlowFunc(("cbRecord = 0x%08X\n", pRecord->cbRecord));
-#endif /* DEBUG_sunlover */
-
-    uint32_t cbRecord = pRecord->cbRecord & ~VBVA_F_RECORD_PARTIAL;
-
-    if (mcbVbvaPartial)
-    {
-        /* There is a partial read in process. Continue with it. */
-
-        Assert (mpu8VbvaPartial);
-
-        LogFlowFunc(("continue partial record mcbVbvaPartial = %d cbRecord 0x%08X, first = %d, free = %d\n",
-                      mcbVbvaPartial, pRecord->cbRecord, indexRecordFirst, indexRecordFree));
-
-        if (cbRecord > mcbVbvaPartial)
-        {
-            /* New data has been added to the record. */
-            if (!vbvaPartialRead (&mpu8VbvaPartial, &mcbVbvaPartial, cbRecord, mpVbvaMemory))
-            {
-                return false;
-            }
-        }
-
-        if (!(pRecord->cbRecord & VBVA_F_RECORD_PARTIAL))
-        {
-            /* The record is completed by guest. Return it to the caller. */
-            *ppHdr = (VBVACMDHDR *)mpu8VbvaPartial;
-            *pcbCmd = mcbVbvaPartial;
-
-            mpu8VbvaPartial = NULL;
-            mcbVbvaPartial = 0;
-
-            /* Advance the record index. */
-            mpVbvaMemory->indexRecordFirst = (indexRecordFirst + 1) % VBVA_MAX_RECORDS;
-
-#ifdef DEBUG_sunlover
-            LogFlowFunc(("partial done ok, data = %d, free = %d\n",
-                          mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
-#endif /* DEBUG_sunlover */
-        }
-
-        return true;
-    }
+    LogRelFlowFunc(("\n"));
 
-    /* A new record need to be processed. */
-    if (pRecord->cbRecord & VBVA_F_RECORD_PARTIAL)
-    {
-        /* Current record is being written by guest. '=' is important here. */
-        if (cbRecord >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD)
-        {
-            /* Partial read must be started. */
-            if (!vbvaPartialRead (&mpu8VbvaPartial, &mcbVbvaPartial, cbRecord, mpVbvaMemory))
-            {
-                return false;
-            }
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-            LogFlowFunc(("started partial record mcbVbvaPartial = 0x%08X cbRecord 0x%08X, first = %d, free = %d\n",
-                          mcbVbvaPartial, pRecord->cbRecord, indexRecordFirst, indexRecordFree));
-        }
+    /* Source bitmaps are not available anymore. */
+    mfSourceBitmapEnabled = false;
 
-        return true;
-    }
+    alock.release();
 
-    /* Current record is complete. If it is not empty, process it. */
-    if (cbRecord)
+    /* Resize all displays to tell framebuffers to forget current source bitmap. */
+    unsigned uScreenId = mcMonitors;
+    while (uScreenId > 0)
     {
-        /* The size of largest contiguous chunk in the ring biffer. */
-        uint32_t u32BytesTillBoundary = VBVA_RING_BUFFER_SIZE - mpVbvaMemory->off32Data;
+        --uScreenId;
 
-        /* The ring buffer pointer. */
-        uint8_t *au8RingBuffer = &mpVbvaMemory->au8RingBuffer[0];
-
-        /* The pointer to data in the ring buffer. */
-        uint8_t *src = &au8RingBuffer[mpVbvaMemory->off32Data];
-
-        /* Fetch or point the data. */
-        if (u32BytesTillBoundary >= cbRecord)
-        {
-            /* The command does not cross buffer boundary. Return address in the buffer. */
-            *ppHdr = (VBVACMDHDR *)src;
-
-            /* Advance data offset. */
-            mpVbvaMemory->off32Data = (mpVbvaMemory->off32Data + cbRecord) % VBVA_RING_BUFFER_SIZE;
-        }
-        else
+        DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
+        if (!pFBInfo->fDisabled)
         {
-            /* The command crosses buffer boundary. Rare case, so not optimized. */
-            uint8_t *dst = (uint8_t *)RTMemAlloc (cbRecord);
-
-            if (!dst)
-            {
-                LogRelFlowFunc(("could not allocate %d bytes from heap!!!\n", cbRecord));
-                mpVbvaMemory->off32Data = (mpVbvaMemory->off32Data + cbRecord) % VBVA_RING_BUFFER_SIZE;
-                return false;
-            }
-
-            vbvaFetchBytes (mpVbvaMemory, dst, cbRecord);
-
-            *ppHdr = (VBVACMDHDR *)dst;
-
-#ifdef DEBUG_sunlover
-            LogFlowFunc(("Allocated from heap %p\n", dst));
-#endif /* DEBUG_sunlover */
+            i_handleDisplayResize(uScreenId, 32,
+                                  pFBInfo->pu8FramebufferVRAM,
+                                  pFBInfo->u32LineSize,
+                                  pFBInfo->w,
+                                  pFBInfo->h,
+                                  pFBInfo->flags);
         }
     }
-
-    *pcbCmd = cbRecord;
-
-    /* Advance the record index. */
-    mpVbvaMemory->indexRecordFirst = (indexRecordFirst + 1) % VBVA_MAX_RECORDS;
-
-#ifdef DEBUG_sunlover
-    LogFlowFunc(("done ok, data = %d, free = %d\n",
-                 mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
-#endif /* DEBUG_sunlover */
-
-    return true;
 }
 
-void Display::vbvaReleaseCmd (VBVACMDHDR *pHdr, int32_t cbCmd)
+// Wrapped IDisplay methods
+/////////////////////////////////////////////////////////////////////////////
+HRESULT Display::getScreenResolution(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel,
+                                     LONG *aXOrigin, LONG *aYOrigin, GuestMonitorStatus_T *aGuestMonitorStatus)
 {
-    uint8_t *au8RingBuffer = mpVbvaMemory->au8RingBuffer;
+    LogRelFlowFunc(("aScreenId=%RU32\n", aScreenId));
 
-    if (   (uint8_t *)pHdr >= au8RingBuffer
-        && (uint8_t *)pHdr < &au8RingBuffer[VBVA_RING_BUFFER_SIZE])
-    {
-        /* The pointer is inside ring buffer. Must be continuous chunk. */
-        Assert (VBVA_RING_BUFFER_SIZE - ((uint8_t *)pHdr - au8RingBuffer) >= cbCmd);
-
-        /* Do nothing. */
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        Assert (!mpu8VbvaPartial && mcbVbvaPartial == 0);
-    }
-    else
-    {
-        /* The pointer is outside. It is then an allocated copy. */
+    if (aScreenId >= mcMonitors)
+        return E_INVALIDARG;
 
-#ifdef DEBUG_sunlover
-        LogFlowFunc(("Free heap %p\n", pHdr));
-#endif /* DEBUG_sunlover */
+    DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
 
-        if ((uint8_t *)pHdr == mpu8VbvaPartial)
-        {
-            mpu8VbvaPartial = NULL;
-            mcbVbvaPartial = 0;
-        }
-        else
-        {
-            Assert (!mpu8VbvaPartial && mcbVbvaPartial == 0);
-        }
+    GuestMonitorStatus_T guestMonitorStatus = GuestMonitorStatus_Enabled;
+    if (pFBInfo->flags & VBVA_SCREEN_F_DISABLED)
+        guestMonitorStatus = GuestMonitorStatus_Disabled;
 
-        RTMemFree (pHdr);
-    }
+    if (aWidth)
+        *aWidth = pFBInfo->w;
+    if (aHeight)
+        *aHeight = pFBInfo->h;
+    if (aBitsPerPixel)
+        *aBitsPerPixel = pFBInfo->u16BitsPerPixel;
+    if (aXOrigin)
+        *aXOrigin = pFBInfo->xOrigin;
+    if (aYOrigin)
+        *aYOrigin = pFBInfo->yOrigin;
+    if (aGuestMonitorStatus)
+        *aGuestMonitorStatus = guestMonitorStatus;
 
-    return;
+    return S_OK;
 }
 
 
-/**
- * Called regularly on the DisplayRefresh timer.
- * Also on behalf of guest, when the ring buffer is full.
- *
- * @thread EMT
- */
-void Display::VideoAccelFlush (void)
-{
-    vbvaLock();
-    videoAccelFlush();
-    vbvaUnlock();
-}
-
-/* Under VBVA lock. DevVGA is not taken. */
-void Display::videoAccelFlush (void)
+HRESULT Display::attachFramebuffer(ULONG aScreenId, const ComPtr<IFramebuffer> &aFramebuffer, com::Guid &aId)
 {
-#ifdef DEBUG_sunlover_2
-    LogFlowFunc(("mfVideoAccelEnabled = %d\n", mfVideoAccelEnabled));
-#endif /* DEBUG_sunlover_2 */
+    LogRelFlowFunc(("aScreenId = %d\n", aScreenId));
 
-    if (!mfVideoAccelEnabled)
-    {
-        Log(("Display::VideoAccelFlush: called with disabled VBVA!!! Ignoring.\n"));
-        return;
-    }
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    /* Here VBVA is enabled and we have the accelerator memory pointer. */
-    Assert(mpVbvaMemory);
+    if (aScreenId >= mcMonitors)
+        return setError(E_INVALIDARG, tr("AttachFramebuffer: Invalid screen %d (total %d)"),
+                        aScreenId, mcMonitors);
 
-#ifdef DEBUG_sunlover_2
-    LogFlowFunc(("indexRecordFirst = %d, indexRecordFree = %d, off32Data = %d, off32Free = %d\n",
-                  mpVbvaMemory->indexRecordFirst, mpVbvaMemory->indexRecordFree, mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
-#endif /* DEBUG_sunlover_2 */
+    DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
+    if (!pFBInfo->pFramebuffer.isNull())
+        return setError(E_FAIL, tr("AttachFramebuffer: Framebuffer already attached to %d"),
+                        aScreenId);
 
-    /* Quick check for "nothing to update" case. */
-    if (mpVbvaMemory->indexRecordFirst == mpVbvaMemory->indexRecordFree)
-    {
-        return;
-    }
+    pFBInfo->pFramebuffer = aFramebuffer;
+    pFBInfo->framebufferId.create();
+    aId = pFBInfo->framebufferId;
 
-    /* Process the ring buffer */
-    unsigned uScreenId;
+    SafeArray<FramebufferCapabilities_T> caps;
+    pFBInfo->pFramebuffer->COMGETTER(Capabilities)(ComSafeArrayAsOutParam(caps));
+    pFBInfo->u32Caps = 0;
+    size_t i;
+    for (i = 0; i < caps.size(); ++i)
+        pFBInfo->u32Caps |= caps[i];
 
-    /* Initialize dirty rectangles accumulator. */
-    VBVADIRTYREGION rgn;
-    vbvaRgnInit (&rgn, maFramebuffers, mcMonitors, this, mpDrv->pUpPort);
+    alock.release();
 
-    for (;;)
+    /* The driver might not have been constructed yet */
+    if (mpDrv)
     {
-        VBVACMDHDR *phdr = NULL;
-        uint32_t cbCmd = ~0;
-
-        /* Fetch the command data. */
-        if (!vbvaFetchCmd (&phdr, &cbCmd))
-        {
-            Log(("Display::VideoAccelFlush: unable to fetch command. off32Data = %d, off32Free = %d. Disabling VBVA!!!\n",
-                  mpVbvaMemory->off32Data, mpVbvaMemory->off32Free));
-
-            /* Disable VBVA on those processing errors. */
-            videoAccelEnable (false, NULL);
-
-            break;
-        }
-
-        if (cbCmd == uint32_t(~0))
-        {
-            /* No more commands yet in the queue. */
-            break;
-        }
-
-        if (cbCmd != 0)
-        {
-#ifdef DEBUG_sunlover
-            LogFlowFunc(("hdr: cbCmd = %d, x=%d, y=%d, w=%d, h=%d\n",
-                         cbCmd, phdr->x, phdr->y, phdr->w, phdr->h));
-#endif /* DEBUG_sunlover */
-
-            VBVACMDHDR hdrSaved = *phdr;
-
-            int x = phdr->x;
-            int y = phdr->y;
-            int w = phdr->w;
-            int h = phdr->h;
-
-            uScreenId = mapCoordsToScreen(maFramebuffers, mcMonitors, &x, &y, &w, &h);
-
-            phdr->x = (int16_t)x;
-            phdr->y = (int16_t)y;
-            phdr->w = (uint16_t)w;
-            phdr->h = (uint16_t)h;
-
-            DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
-
-            if (pFBInfo->u32ResizeStatus == ResizeStatus_Void)
-            {
-                /* Handle the command.
-                 *
-                 * Guest is responsible for updating the guest video memory.
-                 * The Windows guest does all drawing using Eng*.
-                 *
-                 * For local output, only dirty rectangle information is used
-                 * to update changed areas.
-                 *
-                 * Dirty rectangles are accumulated to exclude overlapping updates and
-                 * group small updates to a larger one.
-                 */
-
-                /* Accumulate the update. */
-                vbvaRgnDirtyRect (&rgn, uScreenId, phdr);
-
-                /* Forward the command to VRDP server. */
-                mParent->consoleVRDPServer()->SendUpdate (uScreenId, phdr, cbCmd);
-
-                *phdr = hdrSaved;
-            }
-        }
-
-        vbvaReleaseCmd (phdr, cbCmd);
+        /* Setup the new framebuffer. */
+        i_handleDisplayResize(aScreenId, pFBInfo->u16BitsPerPixel,
+                              pFBInfo->pu8FramebufferVRAM,
+                              pFBInfo->u32LineSize,
+                              pFBInfo->w,
+                              pFBInfo->h,
+                              pFBInfo->flags);
     }
 
-    for (uScreenId = 0; uScreenId < mcMonitors; uScreenId++)
+    Console::SafeVMPtrQuiet ptrVM(mParent);
+    if (ptrVM.isOk())
     {
-        if (maFramebuffers[uScreenId].u32ResizeStatus == ResizeStatus_Void)
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+        if (mfIsCr3DEnabled)
         {
-            /* Draw the framebuffer. */
-            vbvaRgnUpdateFramebuffer (&rgn, uScreenId);
-        }
-    }
-}
+            VBOXCRCMDCTL_HGCM data;
+            RT_ZERO(data);
+            data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM;
+            data.Hdr.u32Function = SHCRGL_HOST_FN_SCREEN_CHANGED;
 
-int Display::videoAccelRefreshProcess(void)
-{
-    int rc = VWRN_INVALID_STATE; /* Default is to do a display update in VGA device. */
-
-    vbvaLock();
-
-    if (ASMAtomicCmpXchgU32(&mfu32PendingVideoAccelDisable, false, true))
-    {
-        videoAccelEnable (false, NULL);
-    }
-    else if (mfPendingVideoAccelEnable)
-    {
-        /* Acceleration was enabled while machine was not yet running
-         * due to restoring from saved state. Update entire display and
-         * actually enable acceleration.
-         */
-        Assert(mpPendingVbvaMemory);
+            data.aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT;
+            data.aParms[0].u.uint32 = aScreenId;
 
-        /* Acceleration can not be yet enabled.*/
-        Assert(mpVbvaMemory == NULL);
-        Assert(!mfVideoAccelEnabled);
-
-        if (mfMachineRunning)
-        {
-            videoAccelEnable (mfPendingVideoAccelEnable,
-                              mpPendingVbvaMemory);
-
-            /* Reset the pending state. */
-            mfPendingVideoAccelEnable = false;
-            mpPendingVbvaMemory = NULL;
+            int vrc = i_crCtlSubmitSync(&data.Hdr, sizeof(data));
+            AssertRC(vrc);
         }
+#endif /* defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) */
 
-        rc = VINF_TRY_AGAIN;
-    }
-    else
-    {
-        Assert(mpPendingVbvaMemory == NULL);
-
-        if (mfVideoAccelEnabled)
-        {
-            Assert(mpVbvaMemory);
-            videoAccelFlush ();
-
-            rc = VINF_SUCCESS; /* VBVA processed, no need to a display update. */
-        }
+        VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT,
+                           3, this, aScreenId, false);
     }
 
-    vbvaUnlock();
-
-    return rc;
+    LogRelFlowFunc(("Attached to %d %RTuuid\n", aScreenId, aId.raw()));
+    return S_OK;
 }
 
-
-// IDisplay methods
-/////////////////////////////////////////////////////////////////////////////
-STDMETHODIMP Display::GetScreenResolution (ULONG aScreenId,
-    ULONG *aWidth, ULONG *aHeight, ULONG *aBitsPerPixel,
-    LONG *aXOrigin, LONG *aYOrigin)
+HRESULT Display::detachFramebuffer(ULONG aScreenId, const com::Guid &aId)
 {
-    LogRelFlowFunc(("aScreenId = %d\n", aScreenId));
+    LogRelFlowFunc(("aScreenId = %d %RTuuid\n", aScreenId, aId.raw()));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    if (aScreenId >= mcMonitors)
+        return setError(E_INVALIDARG, tr("DetachFramebuffer: Invalid screen %d (total %d)"),
+                        aScreenId, mcMonitors);
 
-    uint32_t u32Width = 0;
-    uint32_t u32Height = 0;
-    uint32_t u32BitsPerPixel = 0;
-    int32_t xOrigin = 0;
-    int32_t yOrigin = 0;
+    DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
 
-    if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
+    if (pFBInfo->framebufferId != aId)
     {
-        CHECK_CONSOLE_DRV(mpDrv);
-
-        u32Width = mpDrv->IConnector.cx;
-        u32Height = mpDrv->IConnector.cy;
-        int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &u32BitsPerPixel);
-        AssertRC(rc);
+        LogRelFlowFunc(("Invalid framebuffer aScreenId = %d, attached %p\n", aScreenId, pFBInfo->framebufferId.raw()));
+        return setError(E_FAIL, tr("DetachFramebuffer: Invalid framebuffer object"));
     }
-    else if (aScreenId < mcMonitors)
-    {
-        DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
-        u32Width = pFBInfo->w;
-        u32Height = pFBInfo->h;
-        u32BitsPerPixel = pFBInfo->u16BitsPerPixel;
-        xOrigin = pFBInfo->xOrigin;
-        yOrigin = pFBInfo->yOrigin;
-    }
-    else
-    {
-        return E_INVALIDARG;
-    }
-
-    if (aWidth)
-        *aWidth = u32Width;
-    if (aHeight)
-        *aHeight = u32Height;
-    if (aBitsPerPixel)
-        *aBitsPerPixel = u32BitsPerPixel;
-    if (aXOrigin)
-        *aXOrigin = xOrigin;
-    if (aYOrigin)
-        *aYOrigin = yOrigin;
 
-    return S_OK;
-}
+    pFBInfo->pFramebuffer.setNull();
+    pFBInfo->framebufferId.clear();
 
-STDMETHODIMP Display::SetFramebuffer(ULONG aScreenId, IFramebuffer *aFramebuffer)
-{
-    LogRelFlowFunc(("\n"));
-
-    if (aFramebuffer != NULL)
-        CheckComArgOutPointerValid(aFramebuffer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    alock.release();
 
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     Console::SafeVMPtrQuiet ptrVM(mParent);
     if (ptrVM.isOk())
     {
-        /* Must release the lock here because the changeFramebuffer will
-         * also obtain it. */
-        alock.release();
-
-        /* send request to the EMT thread */
-        int vrc = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY,
-                                   (PFNRT)changeFramebuffer, 3, this, aFramebuffer, aScreenId);
-
-        alock.acquire();
-
-        ComAssertRCRet (vrc, E_FAIL);
-
-#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+        if (mfIsCr3DEnabled)
         {
-            if (mfIsCr3DEnabled)
-            {
-                VBOXCRCMDCTL_HGCM data;
-                data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM;
-                data.Hdr.u32Function = SHCRGL_HOST_FN_SCREEN_CHANGED;
-
-                data.aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT;
-                data.aParms[0].u.uint32 = aScreenId;
+            VBOXCRCMDCTL_HGCM data;
+            RT_ZERO(data);
+            data.Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM;
+            data.Hdr.u32Function = SHCRGL_HOST_FN_SCREEN_CHANGED;
 
-                alock.release();
+            data.aParms[0].type = VBOX_HGCM_SVC_PARM_32BIT;
+            data.aParms[0].u.uint32 = aScreenId;
 
-                crCtlSubmitSync(&data.Hdr, sizeof (data));
-
-                alock.acquire();
-            }
+            int vrc = i_crCtlSubmitSync(&data.Hdr, sizeof(data));
+            AssertRC(vrc);
         }
-#endif /* #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) */
-    }
-    else
-    {
-        /* No VM is created (VM is powered off), do a direct call */
-        int vrc = changeFramebuffer (this, aFramebuffer, aScreenId);
-        ComAssertRCRet (vrc, E_FAIL);
     }
+#endif /* defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) */
 
     return S_OK;
 }
 
-STDMETHODIMP Display::GetFramebuffer(ULONG aScreenId,
-                                     IFramebuffer **aFramebuffer, LONG *aXOrigin, LONG *aYOrigin)
+HRESULT Display::queryFramebuffer(ULONG aScreenId, ComPtr<IFramebuffer> &aFramebuffer)
 {
     LogRelFlowFunc(("aScreenId = %d\n", aScreenId));
 
-    CheckComArgOutPointerValid(aFramebuffer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (aScreenId != 0 && aScreenId >= mcMonitors)
-        return E_INVALIDARG;
+    if (aScreenId >= mcMonitors)
+        return setError(E_INVALIDARG, tr("QueryFramebuffer: Invalid screen %d (total %d)"),
+                        aScreenId, mcMonitors);
 
-    /* @todo this should be actually done on EMT. */
     DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
 
-    *aFramebuffer = pFBInfo->pFramebuffer;
-    if (*aFramebuffer)
-        (*aFramebuffer)->AddRef ();
-    if (aXOrigin)
-        *aXOrigin = pFBInfo->xOrigin;
-    if (aYOrigin)
-        *aYOrigin = pFBInfo->yOrigin;
+    pFBInfo->pFramebuffer.queryInterfaceTo(aFramebuffer.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Display::SetVideoModeHint(ULONG aDisplay, BOOL aEnabled,
-                                       BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY,
-                                       ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel)
+HRESULT Display::setVideoModeHint(ULONG aDisplay, BOOL aEnabled,
+                                  BOOL aChangeOrigin, LONG aOriginX, LONG aOriginY,
+                                  ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (aWidth == 0 || aHeight == 0 || aBitsPerPixel == 0)
+    {
+        /* Some of parameters must not change. Query current mode. */
+        ULONG ulWidth        = 0;
+        ULONG ulHeight       = 0;
+        ULONG ulBitsPerPixel = 0;
+        HRESULT hr = getScreenResolution(aDisplay, &ulWidth, &ulHeight, &ulBitsPerPixel, NULL, NULL, NULL);
+        if (FAILED(hr))
+            return hr;
 
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+        /* Assign current values to not changing parameters. */
+        if (aWidth == 0)
+            aWidth = ulWidth;
+        if (aHeight == 0)
+            aHeight = ulHeight;
+        if (aBitsPerPixel == 0)
+             aBitsPerPixel = ulBitsPerPixel;
+    }
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (aDisplay >= mcMonitors)
+        return E_INVALIDARG;
 
     CHECK_CONSOLE_DRV(mpDrv);
 
     /*
-     * Do some rough checks for valid input
+     * It is up to the guest to decide whether the hint is
+     * valid. Therefore don't do any VRAM sanity checks here.
      */
-    ULONG width  = aWidth;
-    if (!width)
-        width    = mpDrv->IConnector.cx;
-    ULONG height = aHeight;
-    if (!height)
-        height   = mpDrv->IConnector.cy;
-    ULONG bpp    = aBitsPerPixel;
-    if (!bpp)
-    {
-        uint32_t cBits = 0;
-        int rc = mpDrv->pUpPort->pfnQueryColorDepth(mpDrv->pUpPort, &cBits);
-        AssertRC(rc);
-        bpp = cBits;
-    }
-    ULONG cMonitors;
-    mParent->machine()->COMGETTER(MonitorCount)(&cMonitors);
-    if (cMonitors == 0 && aDisplay > 0)
-        return E_INVALIDARG;
-    if (aDisplay >= cMonitors)
-        return E_INVALIDARG;
-
-   /*
-    * sunlover 20070614: It is up to the guest to decide whether the hint is
-    * valid. Therefore don't do any VRAM sanity checks here!
-    */
 
     /* Have to release the lock because the pfnRequestDisplayChange
      * will call EMT.  */
@@ -2660,16 +1732,14 @@ STDMETHODIMP Display::SetVideoModeHint(ULONG aDisplay, BOOL aEnabled,
     if (   mfGuestVBVACapabilities & VBVACAPS_VIDEO_MODE_HINTS
         && !(mfGuestVBVACapabilities & VBVACAPS_IRQ))
     {
-        HRESULT hrc = mParent->i_sendACPIMonitorHotPlugEvent();
-        if (FAILED(hrc))
-            return hrc;
+        mParent->i_sendACPIMonitorHotPlugEvent();
     }
 
     /* We currently never suppress the VMMDev hint if the guest has requested
      * it.  Specifically the video graphics driver may not be responsible for
      * screen positioning in the guest virtual desktop, and the component
      * responsible may want to get the hint from VMMDev. */
-    VMMDev *pVMMDev = mParent->getVMMDev();
+    VMMDev *pVMMDev = mParent->i_getVMMDev();
     if (pVMMDev)
     {
         PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
@@ -2681,17 +1751,14 @@ STDMETHODIMP Display::SetVideoModeHint(ULONG aDisplay, BOOL aEnabled,
     return S_OK;
 }
 
-STDMETHODIMP Display::SetSeamlessMode (BOOL enabled)
+HRESULT Display::setSeamlessMode(BOOL enabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Have to release the lock because the pfnRequestSeamlessChange will call EMT.  */
     alock.release();
 
-    VMMDev *pVMMDev = mParent->getVMMDev();
+    VMMDev *pVMMDev = mParent->i_getVMMDev();
     if (pVMMDev)
     {
         PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
@@ -2702,10 +1769,10 @@ STDMETHODIMP Display::SetSeamlessMode (BOOL enabled)
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     if (!enabled)
     {
-        VMMDev *vmmDev = mParent->getVMMDev();
+        VMMDev *vmmDev = mParent->i_getVMMDev();
         if (mfIsCr3DEnabled && vmmDev)
         {
-            VBOXCRCMDCTL_HGCM *pData = (VBOXCRCMDCTL_HGCM*)RTMemAlloc(sizeof (VBOXCRCMDCTL_HGCM));
+            VBOXCRCMDCTL_HGCM *pData = (VBOXCRCMDCTL_HGCM*)RTMemAlloc(sizeof(VBOXCRCMDCTL_HGCM));
             if (!pData)
             {
                 AssertMsgFailed(("RTMemAlloc failed\n"));
@@ -2719,10 +1786,10 @@ STDMETHODIMP Display::SetSeamlessMode (BOOL enabled)
             pData->aParms[0].u.pointer.addr = NULL;
             pData->aParms[0].u.pointer.size = 0; /* <- means null rects, NULL pRects address and 0 rects means "disable" */
 
-            int rc = crCtlSubmit(&pData->Hdr, sizeof (*pData), displayCrCmdFree, pData);
+            int rc = i_crCtlSubmit(&pData->Hdr, sizeof(*pData), i_displayCrCmdFree, pData);
             if (!RT_SUCCESS(rc))
             {
-                AssertMsgFailed(("crCtlSubmit failed rc %d\n", rc));
+                AssertMsgFailed(("crCtlSubmit failed (rc=%Rrc)\n", rc));
                 RTMemFree(pData);
             }
         }
@@ -2732,17 +1799,17 @@ STDMETHODIMP Display::SetSeamlessMode (BOOL enabled)
 }
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-BOOL Display::displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data,
-                                              uint32_t u32Width, uint32_t u32Height)
+BOOL Display::i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pu8Data,
+                                                uint32_t u32Width, uint32_t u32Height)
 {
     if (   pDisplay->mfIsCr3DEnabled
         && pDisplay->mCrOglCallbacks.pfnHasData
         && pDisplay->mCrOglCallbacks.pfnHasData())
     {
-        VMMDev *pVMMDev = pDisplay->mParent->getVMMDev();
+        VMMDev *pVMMDev = pDisplay->mParent->i_getVMMDev();
         if (pVMMDev)
         {
-            CRVBOXHGCMTAKESCREENSHOT *pScreenshot = (CRVBOXHGCMTAKESCREENSHOT*)RTMemAlloc(sizeof (*pScreenshot));
+            CRVBOXHGCMTAKESCREENSHOT *pScreenshot = (CRVBOXHGCMTAKESCREENSHOT*)RTMemAlloc(sizeof(*pScreenshot));
             if (pScreenshot)
             {
                 /* screen id or CRSCREEN_ALL to specify all enabled */
@@ -2762,19 +1829,16 @@ BOOL Display::displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId
 
                 data.aParms[0].type = VBOX_HGCM_SVC_PARM_PTR;
                 data.aParms[0].u.pointer.addr = pScreenshot;
-                data.aParms[0].u.pointer.size = sizeof (*pScreenshot);
+                data.aParms[0].u.pointer.size = sizeof(*pScreenshot);
 
-                int rc = pDisplay->crCtlSubmitSync(&data.Hdr, sizeof (data));
+                int rc = pDisplay->i_crCtlSubmitSync(&data.Hdr, sizeof(data));
 
                 RTMemFree(pScreenshot);
 
                 if (RT_SUCCESS(rc))
                     return TRUE;
-                else
-                {
-                    AssertMsgFailed(("failed to get screenshot data from crOgl %d\n", rc));
-                    /* fall back to the non-3d mechanism */
-                }
+                AssertMsgFailed(("failed to get screenshot data from crOgl (rc=%Rrc)\n", rc));
+                /* fall back to the non-3d mechanism */
             }
         }
     }
@@ -2782,10 +1846,11 @@ BOOL Display::displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId
 }
 #endif
 
-int Display::displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height)
+int Display::i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData,
+                                        uint32_t *pu32Width, uint32_t *pu32Height)
 {
     int rc;
-    pDisplay->vbvaLock();
+
     if (   aScreenId == VBOX_VIDEO_PRIMARY_SCREEN
         && pDisplay->maFramebuffers[aScreenId].fVBVAEnabled == false) /* A non-VBVA mode. */
     {
@@ -2873,12 +1938,12 @@ int Display::displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_
     {
         rc = VERR_INVALID_PARAMETER;
     }
-    pDisplay->vbvaUnlock();
+
     return rc;
 }
 
-static int displayTakeScreenshot(PUVM pUVM, Display *pDisplay, struct DRVMAINDISPLAY *pDrv, ULONG aScreenId,
-                                 BYTE *address, ULONG width, ULONG height)
+static int i_displayTakeScreenshot(PUVM pUVM, Display *pDisplay, struct DRVMAINDISPLAY *pDrv, ULONG aScreenId,
+                                   BYTE *address, ULONG width, ULONG height)
 {
     uint8_t *pu8Data = NULL;
     size_t cbData = 0;
@@ -2887,7 +1952,7 @@ static int displayTakeScreenshot(PUVM pUVM, Display *pDisplay, struct DRVMAINDIS
     int vrc = VINF_SUCCESS;
 
 # if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    if (Display::displayCheckTakeScreenshotCrOgl(pDisplay, aScreenId, (uint8_t*)address, width, height))
+    if (Display::i_displayCheckTakeScreenshotCrOgl(pDisplay, aScreenId, (uint8_t*)address, width, height))
         return VINF_SUCCESS;
 #endif
 
@@ -2898,7 +1963,7 @@ static int displayTakeScreenshot(PUVM pUVM, Display *pDisplay, struct DRVMAINDIS
         /* Note! Not sure if the priority call is such a good idea here, but
                  it would be nice to have an accurate screenshot for the bug
                  report if the VM deadlocks. */
-        vrc = VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)Display::displayTakeScreenshotEMT, 6,
+        vrc = VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)Display::i_displayTakeScreenshotEMT, 6,
                                        pDisplay, aScreenId, &pu8Data, &cbData, &cx, &cy);
         if (vrc != VERR_TRY_AGAIN)
         {
@@ -2935,242 +2000,175 @@ static int displayTakeScreenshot(PUVM pUVM, Display *pDisplay, struct DRVMAINDIS
                           srcW, srcH);
         }
 
-        if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
-        {
-            /* This can be called from any thread. */
-            pDrv->pUpPort->pfnFreeScreenshot(pDrv->pUpPort, pu8Data);
-        }
-        else
-        {
-            RTMemFree(pu8Data);
-        }
-    }
-
-    return vrc;
-}
-
-STDMETHODIMP Display::TakeScreenShot(ULONG aScreenId, BYTE *address, ULONG width, ULONG height)
-{
-    /// @todo (r=dmik) this function may take too long to complete if the VM
-    //  is doing something like saving state right now. Which, in case if it
-    //  is called on the GUI thread, will make it unresponsive. We should
-    //  check the machine state here (by enclosing the check and VMRequCall
-    //  within the Console lock to make it atomic).
-
-    LogRelFlowFunc(("address=%p, width=%d, height=%d\n",
-                    address, width, height));
-
-    CheckComArgNotNull(address);
-    CheckComArgExpr(width, width != 0);
-    CheckComArgExpr(height, height != 0);
-
-    /* Do not allow too large screenshots. This also filters out negative
-     * values passed as either 'width' or 'height'.
-     */
-    CheckComArgExpr(width, width <= 32767);
-    CheckComArgExpr(height, height <= 32767);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (!mpDrv)
-        return E_FAIL;
-
-    Console::SafeVMPtr ptrVM(mParent);
-    if (!ptrVM.isOk())
-        return ptrVM.rc();
-
-    HRESULT rc = S_OK;
-
-    LogRelFlowFunc(("Sending SCREENSHOT request\n"));
-
-    /* Release lock because other thread (EMT) is called and it may initiate a resize
-     * which also needs lock.
-     *
-     * This method does not need the lock anymore.
-     */
-    alock.release();
-
-    int vrc = displayTakeScreenshot(ptrVM.rawUVM(), this, mpDrv, aScreenId, address, width, height);
-
-    if (vrc == VERR_NOT_IMPLEMENTED)
-        rc = setError(E_NOTIMPL,
-                      tr("This feature is not implemented"));
-    else if (vrc == VERR_TRY_AGAIN)
-        rc = setError(E_UNEXPECTED,
-                      tr("This feature is not available at this time"));
-    else if (RT_FAILURE(vrc))
-        rc = setError(VBOX_E_IPRT_ERROR,
-                      tr("Could not take a screenshot (%Rrc)"), vrc);
+        if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
+        {
+            /* This can be called from any thread. */
+            pDrv->pUpPort->pfnFreeScreenshot(pDrv->pUpPort, pu8Data);
+        }
+        else
+        {
+            RTMemFree(pu8Data);
+        }
+    }
 
-    LogRelFlowFunc(("rc=%Rhrc\n", rc));
-    return rc;
+    return vrc;
 }
 
-STDMETHODIMP Display::TakeScreenShotToArray(ULONG aScreenId, ULONG width, ULONG height,
-                                            ComSafeArrayOut(BYTE, aScreenData))
+HRESULT Display::takeScreenShotWorker(ULONG aScreenId,
+                                      BYTE *aAddress,
+                                      ULONG aWidth,
+                                      ULONG aHeight,
+                                      BitmapFormat_T aBitmapFormat,
+                                      ULONG *pcbOut)
 {
-    LogRelFlowFunc(("width=%d, height=%d\n", width, height));
-
-    CheckComArgOutSafeArrayPointerValid(aScreenData);
-    CheckComArgExpr(width, width != 0);
-    CheckComArgExpr(height, height != 0);
+    HRESULT rc = S_OK;
 
-    /* Do not allow too large screenshots. This also filters out negative
-     * values passed as either 'width' or 'height'.
+    /* Do not allow too small and too large screenshots. This also filters out negative
+     * values passed as either 'aWidth' or 'aHeight'.
      */
-    CheckComArgExpr(width, width <= 32767);
-    CheckComArgExpr(height, height <= 32767);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    CheckComArgExpr(aWidth, aWidth != 0 && aWidth <= 32767);
+    CheckComArgExpr(aHeight, aHeight != 0 && aHeight <= 32767);
 
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (!mpDrv)
-        return E_FAIL;
+    if (   aBitmapFormat != BitmapFormat_BGR0
+        && aBitmapFormat != BitmapFormat_BGRA
+        && aBitmapFormat != BitmapFormat_RGBA
+        && aBitmapFormat != BitmapFormat_PNG)
+    {
+        return setError(E_NOTIMPL,
+                        tr("Unsupported screenshot format 0x%08X"), aBitmapFormat);
+    }
 
     Console::SafeVMPtr ptrVM(mParent);
     if (!ptrVM.isOk())
         return ptrVM.rc();
 
-    HRESULT rc = S_OK;
-
-    LogRelFlowFunc(("Sending SCREENSHOT request\n"));
-
-    /* Release lock because other thread (EMT) is called and it may initiate a resize
-     * which also needs lock.
-     *
-     * This method does not need the lock anymore.
-     */
-    alock.release();
-
-    size_t cbData = width * 4 * height;
-    uint8_t *pu8Data = (uint8_t *)RTMemAlloc(cbData);
-
-    if (!pu8Data)
-        return E_OUTOFMEMORY;
-
-    int vrc = displayTakeScreenshot(ptrVM.rawUVM(), this, mpDrv, aScreenId, pu8Data, width, height);
+    int vrc = i_displayTakeScreenshot(ptrVM.rawUVM(), this, mpDrv, aScreenId, aAddress, aWidth, aHeight);
 
     if (RT_SUCCESS(vrc))
     {
-        /* Convert pixels to format expected by the API caller: [0] R, [1] G, [2] B, [3] A. */
-        uint8_t *pu8 = pu8Data;
-        unsigned cPixels = width * height;
-        while (cPixels)
+        const size_t cbData = aWidth * 4 * aHeight;
+
+        /* Most of uncompressed formats. */
+        *pcbOut = (ULONG)cbData;
+
+        if (aBitmapFormat == BitmapFormat_BGR0)
+        {
+            /* Do nothing. */
+        }
+        else if (aBitmapFormat == BitmapFormat_BGRA)
+        {
+            uint32_t *pu32 = (uint32_t *)aAddress;
+            size_t cPixels = aWidth * aHeight;
+            while (cPixels--)
+            {
+                *pu32++ |= UINT32_C(0xFF000000);
+            }
+        }
+        else if (aBitmapFormat == BitmapFormat_RGBA)
         {
-            uint8_t u8 = pu8[0];
-            pu8[0] = pu8[2];
-            pu8[2] = u8;
-            pu8[3] = 0xff;
-            cPixels--;
-            pu8 += 4;
+            uint8_t *pu8 = aAddress;
+            size_t cPixels = aWidth * aHeight;
+            while (cPixels--)
+            {
+                uint8_t u8 = pu8[0];
+                pu8[0] = pu8[2];
+                pu8[2] = u8;
+                pu8[3] = 0xFF;
+
+                pu8 += 4;
+            }
         }
+        else if (aBitmapFormat == BitmapFormat_PNG)
+        {
+            uint8_t *pu8PNG = NULL;
+            uint32_t cbPNG = 0;
+            uint32_t cxPNG = 0;
+            uint32_t cyPNG = 0;
 
-        com::SafeArray<BYTE> screenData(cbData);
-        screenData.initFrom(pu8Data, cbData);
-        screenData.detachTo(ComSafeArrayOutArg(aScreenData));
+            vrc = DisplayMakePNG(aAddress, aWidth, aHeight, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 0);
+            if (RT_SUCCESS(vrc))
+            {
+                if (cbPNG <= cbData)
+                {
+                    memcpy(aAddress, pu8PNG, cbPNG);
+                    *pcbOut = cbPNG;
+                }
+                else
+                {
+                    rc = setError(E_FAIL,
+                                  tr("PNG is larger than 32bpp bitmap"));
+                }
+            }
+            else
+            {
+                rc = setError(VBOX_E_IPRT_ERROR,
+                              tr("Could not convert screenshot to PNG (%Rrc)"), vrc);
+            }
+            RTMemFree(pu8PNG);
+        }
     }
-    else if (vrc == VERR_NOT_IMPLEMENTED)
-        rc = setError(E_NOTIMPL,
-                      tr("This feature is not implemented"));
-    else
+    else if (vrc == VERR_TRY_AGAIN)
+        rc = setError(E_UNEXPECTED,
+                      tr("Screenshot is not available at this time"));
+    else if (RT_FAILURE(vrc))
         rc = setError(VBOX_E_IPRT_ERROR,
                       tr("Could not take a screenshot (%Rrc)"), vrc);
 
-    RTMemFree(pu8Data);
-
-    LogRelFlowFunc(("rc=%Rhrc\n", rc));
     return rc;
 }
 
-STDMETHODIMP Display::TakeScreenShotPNGToArray(ULONG aScreenId, ULONG width, ULONG height,
-                                               ComSafeArrayOut(BYTE, aScreenData))
+HRESULT Display::takeScreenShot(ULONG aScreenId,
+                                BYTE *aAddress,
+                                ULONG aWidth,
+                                ULONG aHeight,
+                                BitmapFormat_T aBitmapFormat)
 {
-    LogRelFlowFunc(("width=%d, height=%d\n", width, height));
-
-    CheckComArgOutSafeArrayPointerValid(aScreenData);
-    CheckComArgExpr(width, width != 0);
-    CheckComArgExpr(height, height != 0);
-
-    /* Do not allow too large screenshots. This also filters out negative
-     * values passed as either 'width' or 'height'.
-     */
-    CheckComArgExpr(width, width <= 32767);
-    CheckComArgExpr(height, height <= 32767);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    HRESULT rc = S_OK;
 
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    LogRelFlowFunc(("[%d] address=%p, width=%d, height=%d, format 0x%08X\n",
+                     aScreenId, aAddress, aWidth, aHeight, aBitmapFormat));
 
-    CHECK_CONSOLE_DRV(mpDrv);
+    ULONG cbOut = 0;
+    rc = takeScreenShotWorker(aScreenId, aAddress, aWidth, aHeight, aBitmapFormat, &cbOut);
+    NOREF(cbOut);
 
-    Console::SafeVMPtr ptrVM(mParent);
-    if (!ptrVM.isOk())
-        return ptrVM.rc();
+    LogRelFlowFunc(("%Rhrc\n", rc));
+    return rc;
+}
 
+HRESULT Display::takeScreenShotToArray(ULONG aScreenId,
+                                       ULONG aWidth,
+                                       ULONG aHeight,
+                                       BitmapFormat_T aBitmapFormat,
+                                       std::vector<BYTE> &aScreenData)
+{
     HRESULT rc = S_OK;
 
-    LogRelFlowFunc(("Sending SCREENSHOT request\n"));
+    LogRelFlowFunc(("[%d] width=%d, height=%d, format 0x%08X\n",
+                     aScreenId, aWidth, aHeight, aBitmapFormat));
 
-    /* Release lock because other thread (EMT) is called and it may initiate a resize
-     * which also needs lock.
-     *
-     * This method does not need the lock anymore.
+    /* Do not allow too small and too large screenshots. This also filters out negative
+     * values passed as either 'aWidth' or 'aHeight'.
      */
-    alock.release();
-
-    size_t cbData = width * 4 * height;
-    uint8_t *pu8Data = (uint8_t *)RTMemAlloc(cbData);
-
-    if (!pu8Data)
-        return E_OUTOFMEMORY;
-
-    int vrc = displayTakeScreenshot(ptrVM.rawUVM(), this, mpDrv, aScreenId, pu8Data, width, height);
-
-    if (RT_SUCCESS(vrc))
-    {
-        uint8_t *pu8PNG = NULL;
-        uint32_t cbPNG = 0;
-        uint32_t cxPNG = 0;
-        uint32_t cyPNG = 0;
+    CheckComArgExpr(aWidth, aWidth != 0 && aWidth <= 32767);
+    CheckComArgExpr(aHeight, aHeight != 0 && aHeight <= 32767);
 
-        vrc = DisplayMakePNG(pu8Data, width, height, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 0);
-        if (RT_SUCCESS(vrc))
-        {
-            com::SafeArray<BYTE> screenData(cbPNG);
-            screenData.initFrom(pu8PNG, cbPNG);
-            if (pu8PNG)
-                RTMemFree(pu8PNG);
+    const size_t cbData = aWidth * 4 * aHeight;
+    aScreenData.resize(cbData);
 
-            screenData.detachTo(ComSafeArrayOutArg(aScreenData));
-        }
-        else
-        {
-            if (pu8PNG)
-                RTMemFree(pu8PNG);
-            rc = setError(VBOX_E_IPRT_ERROR,
-                          tr("Could not convert screenshot to PNG (%Rrc)"), vrc);
-        }
-    }
-    else if (vrc == VERR_NOT_IMPLEMENTED)
-        rc = setError(E_NOTIMPL,
-                      tr("This feature is not implemented"));
-    else
-        rc = setError(VBOX_E_IPRT_ERROR,
-                      tr("Could not take a screenshot (%Rrc)"), vrc);
+    ULONG cbOut = 0;
+    rc = takeScreenShotWorker(aScreenId, &aScreenData.front(), aWidth, aHeight, aBitmapFormat, &cbOut);
+    if (FAILED(rc))
+        cbOut = 0;
 
-    RTMemFree(pu8Data);
+    aScreenData.resize(cbOut);
 
-    LogRelFlowFunc(("rc=%Rhrc\n", rc));
+    LogRelFlowFunc(("%Rhrc\n", rc));
     return rc;
 }
 
-int Display::VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens))
+
+int Display::i_VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens))
 {
 #ifdef VBOX_WITH_VPX
     com::SafeArray<BOOL> Screens(ComSafeArrayInArg(aScreens));
@@ -3185,7 +2183,7 @@ int Display::VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens))
 /**
  * Start video capturing. Does nothing if capturing is already active.
  */
-int Display::VideoCaptureStart()
+int Display::i_VideoCaptureStart()
 {
 #ifdef VBOX_WITH_VPX
     if (VideoRecIsEnabled(mpVideoRecCtx))
@@ -3197,7 +2195,7 @@ int Display::VideoCaptureStart()
         LogFlow(("Failed to create video recording context (%Rrc)!\n", rc));
         return rc;
     }
-    ComPtr<IMachine> pMachine = mParent->machine();
+    ComPtr<IMachine> pMachine = mParent->i_machine();
     com::SafeArray<BOOL> screens;
     HRESULT hrc = pMachine->COMGETTER(VideoCaptureScreens)(ComSafeArrayAsOutParam(screens));
     AssertComRCReturn(hrc, VERR_COM_UNEXPECTED);
@@ -3218,6 +2216,16 @@ int Display::VideoCaptureStart()
     BSTR strFile;
     hrc = pMachine->COMGETTER(VideoCaptureFile)(&strFile);
     AssertComRCReturn(hrc, VERR_COM_UNEXPECTED);
+    ULONG ulMaxTime;
+    hrc = pMachine->COMGETTER(VideoCaptureMaxTime)(&ulMaxTime);
+    AssertComRCReturn(hrc, VERR_COM_UNEXPECTED);
+    ULONG ulMaxSize;
+    hrc = pMachine->COMGETTER(VideoCaptureMaxFileSize)(&ulMaxSize);
+    AssertComRCReturn(hrc, VERR_COM_UNEXPECTED);
+    BSTR strOptions;
+    hrc = pMachine->COMGETTER(VideoCaptureOptions)(&strOptions);
+    AssertComRCReturn(hrc, VERR_COM_UNEXPECTED);
+
     RTTIMESPEC ts;
     RTTimeNow(&ts);
     RTTIME time;
@@ -3225,26 +2233,28 @@ int Display::VideoCaptureStart()
     for (unsigned uScreen = 0; uScreen < mcMonitors; uScreen++)
     {
         char *pszAbsPath = RTPathAbsDup(com::Utf8Str(strFile).c_str());
-        char *pszExt = RTPathExt(pszAbsPath);
-        if (pszExt)
-            pszExt = RTStrDup(pszExt);
-        RTPathStripExt(pszAbsPath);
+        char *pszSuff = RTPathSuffix(pszAbsPath);
+        if (pszSuff)
+            pszSuff = RTStrDup(pszSuff);
+        RTPathStripSuffix(pszAbsPath);
         if (!pszAbsPath)
             rc = VERR_INVALID_PARAMETER;
-        if (!pszExt)
-            pszExt = RTStrDup(".webm");
+        if (!pszSuff)
+            pszSuff = RTStrDup(".webm");
         char *pszName = NULL;
         if (RT_SUCCESS(rc))
         {
             if (mcMonitors > 1)
-                rc = RTStrAPrintf(&pszName, "%s-%u%s", pszAbsPath, uScreen+1, pszExt);
+                rc = RTStrAPrintf(&pszName, "%s-%u%s", pszAbsPath, uScreen+1, pszSuff);
             else
-                rc = RTStrAPrintf(&pszName, "%s%s", pszAbsPath, pszExt);
+                rc = RTStrAPrintf(&pszName, "%s%s", pszAbsPath, pszSuff);
         }
         if (RT_SUCCESS(rc))
         {
             rc = VideoRecStrmInit(mpVideoRecCtx, uScreen,
-                                  pszName, ulWidth, ulHeight, ulRate, ulFPS);
+                                  pszName, ulWidth, ulHeight,
+                                  ulRate, ulFPS, ulMaxTime,
+                                  ulMaxSize, com::Utf8Str(strOptions).c_str());
             if (rc == VERR_ALREADY_EXISTS)
             {
                 RTStrFree(pszName);
@@ -3254,15 +2264,17 @@ int Display::VideoCaptureStart()
                     rc = RTStrAPrintf(&pszName, "%s-%04d-%02u-%02uT%02u-%02u-%02u-%09uZ-%u%s",
                                       pszAbsPath, time.i32Year, time.u8Month, time.u8MonthDay,
                                       time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond,
-                                      uScreen+1, pszExt);
+                                      uScreen+1, pszSuff);
                 else
                     rc = RTStrAPrintf(&pszName, "%s-%04d-%02u-%02uT%02u-%02u-%02u-%09uZ%s",
                                       pszAbsPath, time.i32Year, time.u8Month, time.u8MonthDay,
                                       time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond,
-                                      pszExt);
+                                      pszSuff);
                 if (RT_SUCCESS(rc))
                     rc = VideoRecStrmInit(mpVideoRecCtx, uScreen,
-                                          pszName, ulWidth, ulHeight, ulRate, ulFPS);
+                                          pszName, ulWidth, ulHeight, ulRate,
+                                          ulFPS, ulMaxTime,
+                                          ulMaxSize, com::Utf8Str(strOptions).c_str());
             }
         }
 
@@ -3272,7 +2284,7 @@ int Display::VideoCaptureStart()
         else
             LogRel(("Failed to initialize video recording context #%u (%Rrc)!\n", uScreen, rc));
         RTStrFree(pszName);
-        RTStrFree(pszExt);
+        RTStrFree(pszSuff);
         RTStrFree(pszAbsPath);
     }
     return rc;
@@ -3284,7 +2296,7 @@ int Display::VideoCaptureStart()
 /**
  * Stop video capturing. Does nothing if video capturing is not active.
  */
-void Display::VideoCaptureStop()
+void Display::i_VideoCaptureStop()
 {
 #ifdef VBOX_WITH_VPX
     if (VideoRecIsEnabled(mpVideoRecCtx))
@@ -3294,20 +2306,16 @@ void Display::VideoCaptureStop()
 #endif
 }
 
-int Display::drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address,
-                             ULONG x, ULONG y, ULONG width, ULONG height)
+int Display::i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address,
+                               ULONG x, ULONG y, ULONG width, ULONG height)
 {
     int rc = VINF_SUCCESS;
-    pDisplay->vbvaLock();
 
     DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[aScreenId];
 
     if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
     {
-        if (pFBInfo->u32ResizeStatus == ResizeStatus_Void)
-        {
-            rc = pDisplay->mpDrv->pUpPort->pfnDisplayBlt(pDisplay->mpDrv->pUpPort, address, x, y, width, height);
-        }
+        rc = pDisplay->mpDrv->pUpPort->pfnDisplayBlt(pDisplay->mpDrv->pUpPort, address, x, y, width, height);
     }
     else if (aScreenId < pDisplay->mcMonitors)
     {
@@ -3340,17 +2348,28 @@ int Display::drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address,
                                                    u32DstLineSize, u32DstBitsPerPixel);
         if (RT_SUCCESS(rc))
         {
-            if (!pFBInfo->pFramebuffer.isNull())
+            if (!pFBInfo->pSourceBitmap.isNull())
             {
-                /* Update the changed screen area. When framebuffer uses VRAM directly, just notify
-                 * it to update. And for default format, render the guest VRAM to framebuffer.
+                /* Update the changed screen area. When source bitmap uses VRAM directly, just notify
+                 * frontend to update. And for default format, render the guest VRAM to the source bitmap.
                  */
                 if (   pFBInfo->fDefaultFormat
                     && !pFBInfo->fDisabled)
                 {
-                    address = NULL;
-                    HRESULT hrc = pFBInfo->pFramebuffer->COMGETTER(Address) (&address);
-                    if (SUCCEEDED(hrc) && address != NULL)
+                    BYTE *pAddress = NULL;
+                    ULONG ulWidth = 0;
+                    ULONG ulHeight = 0;
+                    ULONG ulBitsPerPixel = 0;
+                    ULONG ulBytesPerLine = 0;
+                    BitmapFormat_T bitmapFormat = BitmapFormat_Opaque;
+
+                    HRESULT hrc = pFBInfo->pSourceBitmap->QueryBitmapInfo(&pAddress,
+                                                                          &ulWidth,
+                                                                          &ulHeight,
+                                                                          &ulBitsPerPixel,
+                                                                          &ulBytesPerLine,
+                                                                          &bitmapFormat);
+                    if (SUCCEEDED(hrc))
                     {
                         pu8Src       = pFBInfo->pu8FramebufferVRAM;
                         xSrc                = x;
@@ -3361,7 +2380,7 @@ int Display::drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address,
                         u32SrcBitsPerPixel = pFBInfo->u16BitsPerPixel;
 
                         /* Default format is 32 bpp. */
-                        pu8Dst             = address;
+                        pu8Dst             = pAddress;
                         xDst                = xSrc;
                         yDst                = ySrc;
                         u32DstWidth        = u32SrcWidth;
@@ -3381,9 +2400,9 @@ int Display::drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address,
                                                               u32DstLineSize, u32DstBitsPerPixel);
                     }
                 }
-
-                pDisplay->handleDisplayUpdate(aScreenId, x, y, width, height);
             }
+
+            pDisplay->i_handleDisplayUpdate(aScreenId, x, y, width, height);
         }
     }
     else
@@ -3391,16 +2410,13 @@ int Display::drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address,
         rc = VERR_INVALID_PARAMETER;
     }
 
-    if (   RT_SUCCESS(rc)
-        && pDisplay->maFramebuffers[aScreenId].u32ResizeStatus == ResizeStatus_Void)
-        pDisplay->mParent->consoleVRDPServer()->SendUpdateBitmap(aScreenId, x, y, width, height);
+    if (RT_SUCCESS(rc))
+        pDisplay->mParent->i_consoleVRDPServer()->SendUpdateBitmap(aScreenId, x, y, width, height);
 
-    pDisplay->vbvaUnlock();
     return rc;
 }
 
-STDMETHODIMP Display::DrawToScreen(ULONG aScreenId, BYTE *address,
-                                   ULONG x, ULONG y, ULONG width, ULONG height)
+HRESULT Display::drawToScreen(ULONG aScreenId, BYTE *aAddress, ULONG aX, ULONG aY, ULONG aWidth, ULONG aHeight)
 {
     /// @todo (r=dmik) this function may take too long to complete if the VM
     //  is doing something like saving state right now. Which, in case if it
@@ -3408,15 +2424,11 @@ STDMETHODIMP Display::DrawToScreen(ULONG aScreenId, BYTE *address,
     //  check the machine state here (by enclosing the check and VMRequCall
     //  within the Console lock to make it atomic).
 
-    LogRelFlowFunc(("address=%p, x=%d, y=%d, width=%d, height=%d\n",
-                  (void *)address, x, y, width, height));
-
-    CheckComArgNotNull(address);
-    CheckComArgExpr(width, width != 0);
-    CheckComArgExpr(height, height != 0);
+    LogRelFlowFunc(("aAddress=%p, x=%d, y=%d, width=%d, height=%d\n",
+                   (void *)aAddress, aX, aY, aWidth, aHeight));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    CheckComArgExpr(aWidth, aWidth != 0);
+    CheckComArgExpr(aHeight, aHeight != 0);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -3433,8 +2445,8 @@ STDMETHODIMP Display::DrawToScreen(ULONG aScreenId, BYTE *address,
      * Again we're lazy and make the graphics device do all the
      * dirty conversion work.
      */
-    int rcVBox = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::drawToScreenEMT, 7,
-                                  this, aScreenId, address, x, y, width, height);
+    int rcVBox = VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_drawToScreenEMT, 7,
+                                  this, aScreenId, aAddress, aX, aY, aWidth, aHeight);
 
     /*
      * If the function returns not supported, we'll have to do all the
@@ -3460,36 +2472,43 @@ STDMETHODIMP Display::DrawToScreen(ULONG aScreenId, BYTE *address,
     return rc;
 }
 
-void Display::InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll)
+int Display::i_InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll)
 {
-    pDisplay->vbvaLock();
+    LogRelFlowFunc(("uId=%d, fUpdateAll %d\n", uId, fUpdateAll));
+
     unsigned uScreenId;
     for (uScreenId = (fUpdateAll ? 0 : uId); uScreenId < pDisplay->mcMonitors; uScreenId++)
     {
         DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId];
 
-        if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && !pFBInfo->pFramebuffer.isNull())
+        if (   !pFBInfo->fVBVAEnabled
+            && uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
         {
-            pDisplay->mpDrv->pUpPort->pfnUpdateDisplayAll(pDisplay->mpDrv->pUpPort);
+            pDisplay->mpDrv->pUpPort->pfnUpdateDisplayAll(pDisplay->mpDrv->pUpPort, /* fFailOnResize = */ true);
         }
         else
         {
-            if (   !pFBInfo->pFramebuffer.isNull()
-                && !pFBInfo->fDisabled
-                && pFBInfo->u32ResizeStatus == ResizeStatus_Void)
+            if (!pFBInfo->fDisabled)
             {
                 /* Render complete VRAM screen to the framebuffer.
                  * When framebuffer uses VRAM directly, just notify it to update.
                  */
-                if (pFBInfo->fDefaultFormat)
+                if (pFBInfo->fDefaultFormat && !pFBInfo->pSourceBitmap.isNull())
                 {
-                    BYTE *address = NULL;
-                    ULONG uWidth = 0;
-                    ULONG uHeight = 0;
-                    pFBInfo->pFramebuffer->COMGETTER(Width) (&uWidth);
-                    pFBInfo->pFramebuffer->COMGETTER(Height) (&uHeight);
-                    HRESULT hrc = pFBInfo->pFramebuffer->COMGETTER(Address) (&address);
-                    if (SUCCEEDED(hrc) && address != NULL)
+                    BYTE *pAddress = NULL;
+                    ULONG ulWidth = 0;
+                    ULONG ulHeight = 0;
+                    ULONG ulBitsPerPixel = 0;
+                    ULONG ulBytesPerLine = 0;
+                    BitmapFormat_T bitmapFormat = BitmapFormat_Opaque;
+
+                    HRESULT hrc = pFBInfo->pSourceBitmap->QueryBitmapInfo(&pAddress,
+                                                                          &ulWidth,
+                                                                          &ulHeight,
+                                                                          &ulBitsPerPixel,
+                                                                          &ulBytesPerLine,
+                                                                          &bitmapFormat);
+                    if (SUCCEEDED(hrc))
                     {
                         uint32_t width              = pFBInfo->w;
                         uint32_t height             = pFBInfo->h;
@@ -3503,7 +2522,7 @@ void Display::InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpda
                         uint32_t u32SrcBitsPerPixel = pFBInfo->u16BitsPerPixel;
 
                         /* Default format is 32 bpp. */
-                        uint8_t *pu8Dst             = address;
+                        uint8_t *pu8Dst             = pAddress;
                         int32_t xDst                = xSrc;
                         int32_t yDst                = ySrc;
                         uint32_t u32DstWidth        = u32SrcWidth;
@@ -3515,9 +2534,8 @@ void Display::InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpda
                          * implies resize of Framebuffer is in progress and
                          * copyrect should not be called.
                          */
-                        if (uWidth == pFBInfo->w && uHeight == pFBInfo->h)
+                        if (ulWidth == pFBInfo->w && ulHeight == pFBInfo->h)
                         {
-
                             pDisplay->mpDrv->pUpPort->pfnCopyRect(pDisplay->mpDrv->pUpPort,
                                                                   width, height,
                                                                   pu8Src,
@@ -3532,13 +2550,14 @@ void Display::InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpda
                     }
                 }
 
-                pDisplay->handleDisplayUpdate (uScreenId, 0, 0, pFBInfo->w, pFBInfo->h);
+                pDisplay->i_handleDisplayUpdate(uScreenId, 0, 0, pFBInfo->w, pFBInfo->h);
             }
         }
         if (!fUpdateAll)
             break;
     }
-    pDisplay->vbvaUnlock();
+    LogRelFlowFunc(("done\n"));
+    return VINF_SUCCESS;
 }
 
 /**
@@ -3547,13 +2566,11 @@ void Display::InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpda
  *
  * @returns COM status code
  */
-STDMETHODIMP Display::InvalidateAndUpdate()
+
+HRESULT Display::invalidateAndUpdate()
 {
     LogRelFlowFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     CHECK_CONSOLE_DRV(mpDrv);
@@ -3569,9 +2586,8 @@ STDMETHODIMP Display::InvalidateAndUpdate()
     /* Have to release the lock when calling EMT.  */
     alock.release();
 
-    /* pdm.h says that this has to be called from the EMT thread */
-    int rcVBox = VMR3ReqCallVoidWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::InvalidateAndUpdateEMT,
-                                      3, this, 0, true);
+    int rcVBox = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT,
+                                    3, this, 0, true);
     alock.acquire();
 
     if (RT_FAILURE(rcVBox))
@@ -3582,66 +2598,52 @@ STDMETHODIMP Display::InvalidateAndUpdate()
     return rc;
 }
 
-/**
- * Notification that the framebuffer has completed the
- * asynchronous resize processing
- *
- * @returns COM status code
- */
-STDMETHODIMP Display::ResizeCompleted(ULONG aScreenId)
+HRESULT Display::invalidateAndUpdateScreen(ULONG aScreenId)
 {
     LogRelFlowFunc(("\n"));
 
-    /// @todo (dmik) can we AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); here?
-    //  This will require general code review and may add some details.
-    //  In particular, we may want to check whether EMT is really waiting for
-    //  this notification, etc. It might be also good to obey the caller to make
-    //  sure this method is not called from more than one thread at a time
-    //  (and therefore don't use Display lock at all here to save some
-    //  milliseconds).
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    /* this is only valid for external framebuffers */
-    if (maFramebuffers[aScreenId].pFramebuffer == NULL)
-        return setError(VBOX_E_NOT_SUPPORTED,
-                        tr("Resize completed notification is valid only for external framebuffers"));
-
-    /* Set the flag indicating that the resize has completed and display
-     * data need to be updated. */
-    bool f = ASMAtomicCmpXchgU32 (&maFramebuffers[aScreenId].u32ResizeStatus,
-        ResizeStatus_UpdateDisplayData, ResizeStatus_InProgress);
-    AssertRelease(f);NOREF(f);
+    HRESULT rc = S_OK;
+
+    Console::SafeVMPtr ptrVM(mParent);
+    if (!ptrVM.isOk())
+        return ptrVM.rc();
+
+    int rcVBox = VMR3ReqCallNoWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT,
+                                    3, this, aScreenId, false);
+    if (RT_FAILURE(rcVBox))
+        rc = setError(VBOX_E_IPRT_ERROR,
+                      tr("Could not invalidate and update the screen %d (%Rrc)"), aScreenId, rcVBox);
 
-    return S_OK;
+    LogRelFlowFunc(("rc=%Rhrc\n", rc));
+    return rc;
 }
 
-STDMETHODIMP Display::CompleteVHWACommand(BYTE *pCommand)
+HRESULT Display::completeVHWACommand(BYTE *aCommand)
 {
 #ifdef VBOX_WITH_VIDEOHWACCEL
-    mpDrv->pVBVACallbacks->pfnVHWACommandCompleteAsync(mpDrv->pVBVACallbacks, (PVBOXVHWACMD)pCommand);
+    mpDrv->pVBVACallbacks->pfnVHWACommandCompleteAsync(mpDrv->pVBVACallbacks, (PVBOXVHWACMD)aCommand);
     return S_OK;
 #else
     return E_NOTIMPL;
 #endif
 }
 
-STDMETHODIMP Display::ViewportChanged(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height)
+HRESULT Display::viewportChanged(ULONG aScreenId, ULONG aX, ULONG aY, ULONG aWidth, ULONG aHeight)
 {
     AssertMsgReturn(aScreenId < mcMonitors, ("aScreendId=%d mcMonitors=%d\n", aScreenId, mcMonitors), E_INVALIDARG);
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
     if (mfIsCr3DEnabled)
     {
-        int rc = crViewportNotify(aScreenId, x, y, width, height);
+        int rc = i_crViewportNotify(aScreenId, aX, aY, aWidth, aHeight);
         if (RT_FAILURE(rc))
         {
             DISPLAYFBINFO *pFb = &maFramebuffers[aScreenId];
             pFb->pendingViewportInfo.fPending = true;
-            pFb->pendingViewportInfo.x = x;
-            pFb->pendingViewportInfo.y = y;
-            pFb->pendingViewportInfo.width = width;
-            pFb->pendingViewportInfo.height = height;
+            pFb->pendingViewportInfo.x = aX;
+            pFb->pendingViewportInfo.y = aY;
+            pFb->pendingViewportInfo.width = aWidth;
+            pFb->pendingViewportInfo.height = aHeight;
         }
     }
 #endif /* VBOX_WITH_CROGL && VBOX_WITH_HGCM */
@@ -3649,98 +2651,167 @@ STDMETHODIMP Display::ViewportChanged(ULONG aScreenId, ULONG x, ULONG y, ULONG w
 #ifdef VBOX_WITH_VMSVGA
     /* The driver might not have been constructed yet */
     if (mpDrv)
-        mpDrv->pUpPort->pfnSetViewPort(mpDrv->pUpPort, aScreenId, x, y, width, height);
+        mpDrv->pUpPort->pfnSetViewPort(mpDrv->pUpPort, aScreenId, aX, aY, aWidth, aHeight);
 #endif
 
     return S_OK;
 }
 
-// private methods
-/////////////////////////////////////////////////////////////////////////////
-
-/**
- *  Helper to update the display information from the framebuffer.
- *
- *  @thread EMT
- */
-int Display::updateDisplayData(void)
+HRESULT Display::querySourceBitmap(ULONG aScreenId,
+                                   ComPtr<IDisplaySourceBitmap> &aDisplaySourceBitmap)
 {
-    LogRelFlowFunc(("\n"));
+    LogRelFlowFunc(("aScreenId = %d\n", aScreenId));
 
-    /* the driver might not have been constructed yet */
-    if (!mpDrv)
-        return VINF_SUCCESS;
+    Console::SafeVMPtr ptrVM(mParent);
+    if (!ptrVM.isOk())
+        return ptrVM.rc();
 
-#ifdef VBOX_STRICT
-    /*
-     *  Sanity check. Note that this method may be called on EMT after Console
-     *  has started the power down procedure (but before our #drvDestruct() is
-     *  called, in which case pVM will already be NULL but mpDrv will not). Since
-     *  we don't really need pVM to proceed, we avoid this check in the release
-     *  build to save some ms (necessary to construct SafeVMPtrQuiet) in this
-     *  time-critical method.
-     */
-    Console::SafeVMPtrQuiet ptrVM(mParent);
-    if (ptrVM.isOk())
+    bool fSetRenderVRAM = false;
+    bool fInvalidate = false;
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (aScreenId >= mcMonitors)
+        return setError(E_INVALIDARG, tr("QuerySourceBitmap: Invalid screen %d (total %d)"),
+                        aScreenId, mcMonitors);
+
+    if (!mfSourceBitmapEnabled)
     {
-        PVM pVM = VMR3GetVM(ptrVM.rawUVM());
-        Assert(VM_IS_EMT(pVM));
+        aDisplaySourceBitmap = NULL;
+        return E_FAIL;
+    }
+
+    DISPLAYFBINFO *pFBInfo = &maFramebuffers[aScreenId];
+
+    /* No source bitmap for a blank guest screen. */
+    if (pFBInfo->flags & VBVA_SCREEN_F_BLANK)
+    {
+        aDisplaySourceBitmap = NULL;
+        return E_FAIL;
     }
-#endif
 
-    /* The method is only relevant to the primary framebuffer. */
-    IFramebuffer *pFramebuffer = maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer;
+    HRESULT hr = S_OK;
 
-    if (pFramebuffer)
+    if (pFBInfo->pSourceBitmap.isNull())
     {
-        HRESULT rc;
-        BYTE *address = 0;
-        rc = pFramebuffer->COMGETTER(Address) (&address);
-        AssertComRC (rc);
-        ULONG bytesPerLine = 0;
-        rc = pFramebuffer->COMGETTER(BytesPerLine) (&bytesPerLine);
-        AssertComRC (rc);
-        ULONG bitsPerPixel = 0;
-        rc = pFramebuffer->COMGETTER(BitsPerPixel) (&bitsPerPixel);
-        AssertComRC (rc);
-        ULONG width = 0;
-        rc = pFramebuffer->COMGETTER(Width) (&width);
-        AssertComRC (rc);
-        ULONG height = 0;
-        rc = pFramebuffer->COMGETTER(Height) (&height);
-        AssertComRC (rc);
-
-        if (   (width  != mLastWidth  && mLastWidth != 0)
-            || (height != mLastHeight && mLastHeight != 0))
+        /* Create a new object. */
+        ComObjPtr<DisplaySourceBitmap> obj;
+        hr = obj.createObject();
+        if (SUCCEEDED(hr))
+            hr = obj->init(this, aScreenId, pFBInfo);
+
+        if (SUCCEEDED(hr))
         {
-            LogRel(("updateDisplayData: size mismatch w %d(%d) h %d(%d)\n",
-                    width, mLastWidth, height, mLastHeight));
-            return VERR_INVALID_STATE;
+            bool fDefaultFormat = !obj->i_usesVRAM();
+
+            if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
+            {
+                /* Start buffer updates. */
+                BYTE *pAddress = NULL;
+                ULONG ulWidth = 0;
+                ULONG ulHeight = 0;
+                ULONG ulBitsPerPixel = 0;
+                ULONG ulBytesPerLine = 0;
+                BitmapFormat_T bitmapFormat = BitmapFormat_Opaque;
+
+                obj->QueryBitmapInfo(&pAddress,
+                                     &ulWidth,
+                                     &ulHeight,
+                                     &ulBitsPerPixel,
+                                     &ulBytesPerLine,
+                                     &bitmapFormat);
+
+                mpDrv->IConnector.pu8Data    = pAddress;
+                mpDrv->IConnector.cbScanline = ulBytesPerLine;
+                mpDrv->IConnector.cBits      = ulBitsPerPixel;
+                mpDrv->IConnector.cx         = ulWidth;
+                mpDrv->IConnector.cy         = ulHeight;
+
+                fSetRenderVRAM = fDefaultFormat;
+            }
+
+            /* Make sure that the bitmap contains the latest image. */
+            fInvalidate = fDefaultFormat;
+
+            pFBInfo->pSourceBitmap = obj;
+            pFBInfo->fDefaultFormat = fDefaultFormat;
         }
+    }
 
-        mpDrv->IConnector.pu8Data = (uint8_t *) address;
-        mpDrv->IConnector.cbScanline = bytesPerLine;
-        mpDrv->IConnector.cBits = bitsPerPixel;
-        mpDrv->IConnector.cx = width;
-        mpDrv->IConnector.cy = height;
+    if (SUCCEEDED(hr))
+    {
+        pFBInfo->pSourceBitmap.queryInterfaceTo(aDisplaySourceBitmap.asOutParam());
     }
-    else
+
+    /* Leave the IDisplay lock because the VGA device must not be called under it. */
+    alock.release();
+
+    if (SUCCEEDED(hr))
     {
-        /* black hole */
-        mpDrv->IConnector.pu8Data = NULL;
-        mpDrv->IConnector.cbScanline = 0;
-        mpDrv->IConnector.cBits = 0;
-        mpDrv->IConnector.cx = 0;
-        mpDrv->IConnector.cy = 0;
+        if (fSetRenderVRAM)
+        {
+            mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, true);
+        }
+
+        if (fInvalidate)
+            VMR3ReqCallWaitU(ptrVM.rawUVM(), VMCPUID_ANY, (PFNRT)Display::i_InvalidateAndUpdateEMT,
+                             3, this, aScreenId, false);
     }
-    LogRelFlowFunc(("leave\n"));
-    return VINF_SUCCESS;
+
+    LogRelFlowFunc(("%Rhrc\n", hr));
+    return hr;
+}
+
+// wrapped IEventListener method
+HRESULT Display::handleEvent(const ComPtr<IEvent> &aEvent)
+{
+    VBoxEventType_T aType = VBoxEventType_Invalid;
+
+    aEvent->COMGETTER(Type)(&aType);
+    switch (aType)
+    {
+        case VBoxEventType_OnStateChanged:
+        {
+            ComPtr<IStateChangedEvent> scev = aEvent;
+            Assert(scev);
+            MachineState_T machineState;
+            scev->COMGETTER(State)(&machineState);
+            if (   machineState == MachineState_Running
+                || machineState == MachineState_Teleporting
+                || machineState == MachineState_LiveSnapshotting
+                || machineState == MachineState_DeletingSnapshotOnline
+                   )
+            {
+                LogRelFlowFunc(("Machine is running.\n"));
+
+#ifdef VBOX_WITH_CROGL
+                i_crOglWindowsShow(true);
+#endif
+            }
+            else
+            {
+#ifdef VBOX_WITH_CROGL
+                if (machineState == MachineState_Paused)
+                    i_crOglWindowsShow(false);
+#endif
+            }
+            break;
+        }
+        default:
+            AssertFailed();
+    }
+
+    return S_OK;
 }
 
+
+// private methods
+/////////////////////////////////////////////////////////////////////////////
+
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-int Display::crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height)
+int Display::i_crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, ULONG height)
 {
-    VMMDev *pVMMDev = mParent->getVMMDev();
+    VMMDev *pVMMDev = mParent->i_getVMMDev();
     if (!pVMMDev)
         return VERR_INVALID_STATE;
 
@@ -3765,14 +2836,14 @@ int Display::crViewportNotify(ULONG aScreenId, ULONG x, ULONG y, ULONG width, UL
     pData->aParms[4].type = VBOX_HGCM_SVC_PARM_32BIT;
     pData->aParms[4].u.uint32 = height;
 
-    return crCtlSubmitSyncIfHasDataForScreen(aScreenId, &pData->Hdr, cbData);
+    return i_crCtlSubmitSyncIfHasDataForScreen(aScreenId, &pData->Hdr, (uint32_t)cbData);
 }
 #endif
 
 #ifdef VBOX_WITH_CRHGSMI
-void Display::setupCrHgsmiData(void)
+void Display::i_setupCrHgsmiData(void)
 {
-    VMMDev *pVMMDev = mParent->getVMMDev();
+    VMMDev *pVMMDev = mParent->i_getVMMDev();
     Assert(pVMMDev);
     int rc = RTCritSectRwEnterExcl(&mCrOglLock);
     AssertRC(rc);
@@ -3788,7 +2859,7 @@ void Display::setupCrHgsmiData(void)
         /* setup command completion callback */
         VBOXVDMACMD_CHROMIUM_CTL_CRHGSMI_SETUP_MAINCB Completion;
         Completion.Hdr.enmType = VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_MAINCB;
-        Completion.Hdr.cbCmd = sizeof (Completion);
+        Completion.Hdr.cbCmd = sizeof(Completion);
         Completion.hCompletion = mpDrv->pVBVACallbacks;
         Completion.pfnCompletion = mpDrv->pVBVACallbacks->pfnCrHgsmiCommandCompleteAsync;
 
@@ -3801,7 +2872,7 @@ void Display::setupCrHgsmiData(void)
         if (RT_SUCCESS(rc))
             mCrOglCallbacks = Completion.MainInterface;
         else
-            AssertMsgFailed(("VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_COMPLETION failed rc %d", rc));
+            AssertMsgFailed(("VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP_COMPLETION failed (rc=%Rrc)\n", rc));
     }
 
     if (RT_FAILURE(rc))
@@ -3810,7 +2881,7 @@ void Display::setupCrHgsmiData(void)
     RTCritSectRwLeaveExcl(&mCrOglLock);
 }
 
-void Display::destructCrHgsmiData(void)
+void Display::i_destructCrHgsmiData(void)
 {
     int rc = RTCritSectRwEnterExcl(&mCrOglLock);
     AssertRC(rc);
@@ -3820,92 +2891,39 @@ void Display::destructCrHgsmiData(void)
 #endif /* VBOX_WITH_CRHGSMI */
 
 /**
- *  Changes the current frame buffer. Called on EMT to avoid both
- *  race conditions and excessive locking.
- *
- *  @note locks this object for writing
- *  @thread EMT
- */
-/* static */
-DECLCALLBACK(int) Display::changeFramebuffer (Display *that, IFramebuffer *aFB,
-                                              unsigned uScreenId)
-{
-    LogRelFlowFunc(("uScreenId = %d\n", uScreenId));
-
-    AssertReturn(that, VERR_INVALID_PARAMETER);
-    AssertReturn(uScreenId < that->mcMonitors, VERR_INVALID_PARAMETER);
-
-    AutoCaller autoCaller(that);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(that COMMA_LOCKVAL_SRC_POS);
-
-    DISPLAYFBINFO *pDisplayFBInfo = &that->maFramebuffers[uScreenId];
-    pDisplayFBInfo->pFramebuffer = aFB;
-
-    that->mParent->consoleVRDPServer()->SendResize ();
-
-    /* The driver might not have been constructed yet */
-    if (that->mpDrv)
-    {
-        /* Setup the new framebuffer, the resize will lead to an updateDisplayData call. */
-        DISPLAYFBINFO *pFBInfo = &that->maFramebuffers[uScreenId];
-
-#if defined(VBOX_WITH_CROGL)
-        /* Release the lock, because SHCRGL_HOST_FN_SCREEN_CHANGED will read current framebuffer */
-        {
-            BOOL is3denabled;
-            that->mParent->machine()->COMGETTER(Accelerate3DEnabled)(&is3denabled);
-
-            if (is3denabled)
-            {
-                alock.release();
-            }
-        }
-#endif
-
-        if (pFBInfo->fVBVAEnabled && pFBInfo->pu8FramebufferVRAM)
-        {
-            /* This display in VBVA mode. Resize it to the last guest resolution,
-             * if it has been reported.
-             */
-            that->handleDisplayResize(uScreenId, pFBInfo->u16BitsPerPixel,
-                                      pFBInfo->pu8FramebufferVRAM,
-                                      pFBInfo->u32LineSize,
-                                      pFBInfo->w,
-                                      pFBInfo->h,
-                                      pFBInfo->flags);
-        }
-        else if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
-        {
-            /* VGA device mode, only for the primary screen. */
-            that->handleDisplayResize(VBOX_VIDEO_PRIMARY_SCREEN, that->mLastBitsPerPixel,
-                                      that->mLastAddress,
-                                      that->mLastBytesPerLine,
-                                      that->mLastWidth,
-                                      that->mLastHeight,
-                                      that->mLastFlags);
-        }
-    }
-
-    LogRelFlowFunc(("leave\n"));
-    return VINF_SUCCESS;
-}
-
-/**
  * Handle display resize event issued by the VGA device for the primary screen.
  *
  * @see PDMIDISPLAYCONNECTOR::pfnResize
  */
-DECLCALLBACK(int) Display::displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface,
-                                                 uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy)
+DECLCALLBACK(int) Display::i_displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterface,
+                                                   uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
+    Display *pThis = pDrv->pDisplay;
 
     LogRelFlowFunc(("bpp %d, pvVRAM %p, cbLine %d, cx %d, cy %d\n",
                   bpp, pvVRAM, cbLine, cx, cy));
 
-    return pDrv->pDisplay->handleDisplayResize(VBOX_VIDEO_PRIMARY_SCREEN, bpp, pvVRAM, cbLine, cx, cy, VBVA_SCREEN_F_ACTIVE);
+    bool f = ASMAtomicCmpXchgBool(&pThis->fVGAResizing, true, false);
+    if (!f)
+    {
+        /* This is a result of recursive call when the source bitmap is being updated
+         * during a VGA resize. Tell the VGA device to ignore the call.
+         *
+         * @todo It is a workaround, actually pfnUpdateDisplayAll must
+         * fail on resize.
+         */
+        LogRel(("displayResizeCallback: already processing\n"));
+        return VINF_VGA_RESIZE_IN_PROGRESS;
+    }
+
+    int rc = pThis->i_handleDisplayResize(VBOX_VIDEO_PRIMARY_SCREEN, bpp, pvVRAM, cbLine, cx, cy, VBVA_SCREEN_F_ACTIVE);
+
+    /* Restore the flag.  */
+    f = ASMAtomicCmpXchgBool(&pThis->fVGAResizing, false, true);
+    AssertRelease(f);
+
+    return rc;
 }
 
 /**
@@ -3913,14 +2931,14 @@ DECLCALLBACK(int) Display::displayResizeCallback(PPDMIDISPLAYCONNECTOR pInterfac
  *
  * @see PDMIDISPLAYCONNECTOR::pfnUpdateRect
  */
-DECLCALLBACK(void) Display::displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
-                                                  uint32_t x, uint32_t y, uint32_t cx, uint32_t cy)
+DECLCALLBACK(void) Display::i_displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterface,
+                                                    uint32_t x, uint32_t y, uint32_t cx, uint32_t cy)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
 
 #ifdef DEBUG_sunlover
-    LogFlowFunc(("mfVideoAccelEnabled = %d, %d,%d %dx%d\n",
-                 pDrv->pDisplay->mfVideoAccelEnabled, x, y, cx, cy));
+    LogFlowFunc(("fVideoAccelEnabled = %d, %d,%d %dx%d\n",
+                 pDrv->pDisplay->mVideoAccelLegacy.fVideoAccelEnabled, x, y, cx, cy));
 #endif /* DEBUG_sunlover */
 
     /* This call does update regardless of VBVA status.
@@ -3928,7 +2946,7 @@ DECLCALLBACK(void) Display::displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterfa
      * pfnUpdateDisplayAll in the VGA device.
      */
 
-    pDrv->pDisplay->handleDisplayUpdate(VBOX_VIDEO_PRIMARY_SCREEN, x, y, cx, cy);
+    pDrv->pDisplay->i_handleDisplayUpdate(VBOX_VIDEO_PRIMARY_SCREEN, x, y, cx, cy);
 }
 
 /**
@@ -3937,13 +2955,9 @@ DECLCALLBACK(void) Display::displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterfa
  * @see PDMIDISPLAYCONNECTOR::pfnRefresh
  * @thread EMT
  */
-/*static */DECLCALLBACK(void) Display::displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface)
-{
-    PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
-
-#ifdef DEBUG_sunlover
-    STAM_PROFILE_START(&g_StatDisplayRefresh, a);
-#endif /* DEBUG_sunlover */
+/*static*/ DECLCALLBACK(void) Display::i_displayRefreshCallback(PPDMIDISPLAYCONNECTOR pInterface)
+{
+    PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
 
 #ifdef DEBUG_sunlover_2
     LogFlowFunc(("pDrv->pDisplay->mfVideoAccelEnabled = %d\n",
@@ -3951,78 +2965,30 @@ DECLCALLBACK(void) Display::displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterfa
 #endif /* DEBUG_sunlover_2 */
 
     Display *pDisplay = pDrv->pDisplay;
-    bool fNoUpdate = false; /* Do not update the display if any of the framebuffers is being resized. */
     unsigned uScreenId;
 
-    Log2(("DisplayRefreshCallback\n"));
-    for (uScreenId = 0; uScreenId < pDisplay->mcMonitors; uScreenId++)
+    int rc = pDisplay->i_videoAccelRefreshProcess(pDrv->pUpPort);
+    if (rc != VINF_TRY_AGAIN) /* Means 'do nothing' here. */
     {
-        DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId];
-
-        /* Check the resize status. The status can be checked normally because
-         * the status affects only the EMT.
-         */
-        uint32_t u32ResizeStatus = pFBInfo->u32ResizeStatus;
-
-        if (u32ResizeStatus == ResizeStatus_UpdateDisplayData)
-        {
-            LogRelFlowFunc(("ResizeStatus_UpdateDisplayData %d\n", uScreenId));
-            fNoUpdate = true; /* Always set it here, because pfnUpdateDisplayAll can cause a new resize. */
-            /* The framebuffer was resized and display data need to be updated. */
-            pDisplay->handleResizeCompletedEMT(FALSE);
-            if (pFBInfo->u32ResizeStatus != ResizeStatus_Void)
-            {
-                /* The resize status could be not Void here because a pending resize is issued. */
-                continue;
-            }
-            /* Continue with normal processing because the status here is ResizeStatus_Void.
-             * Repaint all displays because VM continued to run during the framebuffer resize.
-             */
-            pDisplay->InvalidateAndUpdateEMT(pDisplay, uScreenId, false);
-        }
-        else if (u32ResizeStatus == ResizeStatus_InProgress)
+        if (rc == VWRN_INVALID_STATE)
         {
-            /* The framebuffer is being resized. Do not call the VGA device back. Immediately return. */
-            LogRelFlowFunc(("ResizeStatus_InProcess\n"));
-            fNoUpdate = true;
-            continue;
+            /* No VBVA do a display update. */
+            DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN];
+            pDrv->pUpPort->pfnUpdateDisplay(pDrv->pUpPort);
         }
-    }
 
-    if (!fNoUpdate)
-    {
-        int rc = pDisplay->videoAccelRefreshProcess();
-        if (rc != VINF_TRY_AGAIN) /* Means 'do nothing' here. */
+        /* Inform the VRDP server that the current display update sequence is
+         * completed. At this moment the framebuffer memory contains a definite
+         * image, that is synchronized with the orders already sent to VRDP client.
+         * The server can now process redraw requests from clients or initial
+         * fullscreen updates for new clients.
+         */
+        for (uScreenId = 0; uScreenId < pDisplay->mcMonitors; uScreenId++)
         {
-            if (rc == VWRN_INVALID_STATE)
-            {
-                /* No VBVA do a display update. */
-                DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN];
-                if (!pFBInfo->pFramebuffer.isNull() && pFBInfo->u32ResizeStatus == ResizeStatus_Void)
-                {
-                    Assert(pDrv->IConnector.pu8Data);
-                    pDisplay->vbvaLock();
-                    pDrv->pUpPort->pfnUpdateDisplay(pDrv->pUpPort);
-                    pDisplay->vbvaUnlock();
-                }
-            }
-
-            /* Inform the VRDP server that the current display update sequence is
-             * completed. At this moment the framebuffer memory contains a definite
-             * image, that is synchronized with the orders already sent to VRDP client.
-             * The server can now process redraw requests from clients or initial
-             * fullscreen updates for new clients.
-             */
-            for (uScreenId = 0; uScreenId < pDisplay->mcMonitors; uScreenId++)
-            {
-                DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId];
+            DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId];
 
-                if (!pFBInfo->pFramebuffer.isNull() && pFBInfo->u32ResizeStatus == ResizeStatus_Void)
-                {
-                    Assert (pDisplay->mParent && pDisplay->mParent->consoleVRDPServer());
-                    pDisplay->mParent->consoleVRDPServer()->SendUpdate (uScreenId, NULL, 0);
-                }
-            }
+            Assert(pDisplay->mParent && pDisplay->mParent->i_consoleVRDPServer());
+            pDisplay->mParent->i_consoleVRDPServer()->SendUpdate(uScreenId, NULL, 0);
         }
     }
 
@@ -4046,11 +3012,11 @@ DECLCALLBACK(void) Display::displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterfa
 
                         pData->aParms[0].type = VBOX_HGCM_SVC_PARM_PTR;
                         pData->aParms[0].u.pointer.addr = &pDisplay->mCrOglScreenshotData;
-                        pData->aParms[0].u.pointer.size = sizeof (pDisplay->mCrOglScreenshotData);
-                        int rc = pDisplay->crCtlSubmit(&pData->Hdr, sizeof (*pData), Display::displayVRecCompletion, pDisplay);
+                        pData->aParms[0].u.pointer.size = sizeof(pDisplay->mCrOglScreenshotData);
+                        rc = pDisplay->i_crCtlSubmit(&pData->Hdr, sizeof(*pData), Display::i_displayVRecCompletion, pDisplay);
                         if (RT_SUCCESS(rc))
                             break;
-                        AssertMsgFailed(("crCtlSubmit failed rc %d\n", rc));
+                        AssertMsgFailed(("crCtlSubmit failed (rc=%Rrc)\n", rc));
                     }
 
                     /* no 3D data available, or error has occured,
@@ -4071,26 +3037,32 @@ DECLCALLBACK(void) Display::displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterfa
                 if (!pDisplay->maVideoRecEnabled[uScreenId])
                     continue;
 
+                if (VideoRecIsFull(pDisplay->mpVideoRecCtx, uScreenId, u64Now))
+                {
+                    pDisplay->i_VideoCaptureStop();
+                    pDisplay->mParent->i_machine()->COMSETTER(VideoCaptureEnabled)(false);
+                    break;
+                }
+
                 DISPLAYFBINFO *pFBInfo = &pDisplay->maFramebuffers[uScreenId];
 
                 if (   !pFBInfo->pFramebuffer.isNull()
-                    && !pFBInfo->fDisabled
-                    && pFBInfo->u32ResizeStatus == ResizeStatus_Void)
+                    && !pFBInfo->fDisabled)
                 {
-                    int rc;
+                    rc = VERR_NOT_SUPPORTED;
                     if (   pFBInfo->fVBVAEnabled
                         && pFBInfo->pu8FramebufferVRAM)
                     {
                         rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0,
-                                                  FramebufferPixelFormat_FOURCC_RGB,
+                                                  BitmapFormat_BGR,
                                                   pFBInfo->u16BitsPerPixel,
                                                   pFBInfo->u32LineSize, pFBInfo->w, pFBInfo->h,
                                                   pFBInfo->pu8FramebufferVRAM, u64Now);
                     }
-                    else
+                    else if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && pDrv->IConnector.pu8Data)
                     {
                         rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0,
-                                                  FramebufferPixelFormat_FOURCC_RGB,
+                                                  BitmapFormat_BGR,
                                                   pDrv->IConnector.cBits,
                                                   pDrv->IConnector.cbScanline, pDrv->IConnector.cx,
                                                   pDrv->IConnector.cy, pDrv->IConnector.pu8Data, u64Now);
@@ -4103,9 +3075,6 @@ DECLCALLBACK(void) Display::displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterfa
     }
 #endif /* VBOX_WITH_VPX */
 
-#ifdef DEBUG_sunlover
-    STAM_PROFILE_STOP(&g_StatDisplayRefresh, a);
-#endif /* DEBUG_sunlover */
 #ifdef DEBUG_sunlover_2
     LogFlowFunc(("leave\n"));
 #endif /* DEBUG_sunlover_2 */
@@ -4116,14 +3085,14 @@ DECLCALLBACK(void) Display::displayUpdateCallback(PPDMIDISPLAYCONNECTOR pInterfa
  *
  * @see PDMIDISPLAYCONNECTOR::pfnReset
  */
-DECLCALLBACK(void) Display::displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface)
+DECLCALLBACK(void) Display::i_displayResetCallback(PPDMIDISPLAYCONNECTOR pInterface)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
 
     LogRelFlowFunc(("\n"));
 
    /* Disable VBVA mode. */
-    pDrv->pDisplay->VideoAccelEnable (false, NULL);
+    pDrv->pDisplay->VideoAccelEnableVGA(false, NULL);
 }
 
 /**
@@ -4131,7 +3100,7 @@ DECLCALLBACK(void) Display::displayResetCallback(PPDMIDISPLAYCONNECTOR pInterfac
  *
  * @see PDMIDISPLAYCONNECTOR::pfnLFBModeChange
  */
-DECLCALLBACK(void) Display::displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled)
+DECLCALLBACK(void) Display::i_displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
 
@@ -4140,8 +3109,7 @@ DECLCALLBACK(void) Display::displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR p
     NOREF(fEnabled);
 
     /* Disable VBVA mode in any case. The guest driver reenables VBVA mode if necessary. */
-    /* The LFBModeChange function is called under DevVGA lock. Postpone disabling VBVA, do it in the refresh timer. */
-    ASMAtomicWriteU32(&pDrv->pDisplay->mfu32PendingVideoAccelDisable, true);
+    pDrv->pDisplay->VideoAccelEnableVGA(false, NULL);
 }
 
 /**
@@ -4149,114 +3117,11 @@ DECLCALLBACK(void) Display::displayLFBModeChangeCallback(PPDMIDISPLAYCONNECTOR p
  *
  * @see PDMIDISPLAYCONNECTOR::pfnProcessAdapterData
  */
-DECLCALLBACK(void) Display::displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize)
+DECLCALLBACK(void) Display::i_displayProcessAdapterDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM,
+                                                                uint32_t u32VRAMSize)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
-
-    if (pvVRAM == NULL)
-    {
-        unsigned i;
-        for (i = 0; i < pDrv->pDisplay->mcMonitors; i++)
-        {
-            DISPLAYFBINFO *pFBInfo = &pDrv->pDisplay->maFramebuffers[i];
-
-            pFBInfo->u32Offset = 0;
-            pFBInfo->u32MaxFramebufferSize = 0;
-            pFBInfo->u32InformationSize = 0;
-        }
-    }
-#ifndef VBOX_WITH_HGSMI
-    else
-    {
-         uint8_t *pu8 = (uint8_t *)pvVRAM;
-         pu8 += u32VRAMSize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE;
-
-         // @todo
-         uint8_t *pu8End = pu8 + VBOX_VIDEO_ADAPTER_INFORMATION_SIZE;
-
-         VBOXVIDEOINFOHDR *pHdr;
-
-         for (;;)
-         {
-             pHdr = (VBOXVIDEOINFOHDR *)pu8;
-             pu8 += sizeof (VBOXVIDEOINFOHDR);
-
-             if (pu8 >= pu8End)
-             {
-                 LogRel(("VBoxVideo: Guest adapter information overflow!!!\n"));
-                 break;
-             }
-
-             if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_DISPLAY)
-             {
-                 if (pHdr->u16Length != sizeof (VBOXVIDEOINFODISPLAY))
-                 {
-                     LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "DISPLAY", pHdr->u16Length));
-                     break;
-                 }
-
-                 VBOXVIDEOINFODISPLAY *pDisplay = (VBOXVIDEOINFODISPLAY *)pu8;
-
-                 if (pDisplay->u32Index >= pDrv->pDisplay->mcMonitors)
-                 {
-                     LogRel(("VBoxVideo: Guest adapter information invalid display index %d!!!\n", pDisplay->u32Index));
-                     break;
-                 }
-
-                 DISPLAYFBINFO *pFBInfo = &pDrv->pDisplay->maFramebuffers[pDisplay->u32Index];
-
-                 pFBInfo->u32Offset = pDisplay->u32Offset;
-                 pFBInfo->u32MaxFramebufferSize = pDisplay->u32FramebufferSize;
-                 pFBInfo->u32InformationSize = pDisplay->u32InformationSize;
-
-                 LogRelFlow(("VBOX_VIDEO_INFO_TYPE_DISPLAY: %d: at 0x%08X, size 0x%08X, info 0x%08X\n", pDisplay->u32Index, pDisplay->u32Offset, pDisplay->u32FramebufferSize, pDisplay->u32InformationSize));
-             }
-             else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_QUERY_CONF32)
-             {
-                 if (pHdr->u16Length != sizeof (VBOXVIDEOINFOQUERYCONF32))
-                 {
-                     LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "CONF32", pHdr->u16Length));
-                     break;
-                 }
-
-                 VBOXVIDEOINFOQUERYCONF32 *pConf32 = (VBOXVIDEOINFOQUERYCONF32 *)pu8;
-
-                 switch (pConf32->u32Index)
-                 {
-                     case VBOX_VIDEO_QCI32_MONITOR_COUNT:
-                     {
-                         pConf32->u32Value = pDrv->pDisplay->mcMonitors;
-                     } break;
-
-                     case VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE:
-                     {
-                         /* @todo make configurable. */
-                         pConf32->u32Value = _1M;
-                     } break;
-
-                     default:
-                         LogRel(("VBoxVideo: CONF32 %d not supported!!! Skipping.\n", pConf32->u32Index));
-                 }
-             }
-             else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_END)
-             {
-                 if (pHdr->u16Length != 0)
-                 {
-                     LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "END", pHdr->u16Length));
-                     break;
-                 }
-
-                 break;
-             }
-             else if (pHdr->u8Type != VBOX_VIDEO_INFO_TYPE_NV_HEAP) /** @todo why is Additions/WINNT/Graphics/Miniport/VBoxVideo.cpp pushing this to us? */
-             {
-                 LogRel(("Guest adapter information contains unsupported type %d. The block has been skipped.\n", pHdr->u8Type));
-             }
-
-             pu8 += pHdr->u16Length;
-         }
-    }
-#endif /* !VBOX_WITH_HGSMI */
+    pDrv->pDisplay->processAdapterData(pvVRAM, u32VRAMSize);
 }
 
 /**
@@ -4264,116 +3129,11 @@ DECLCALLBACK(void) Display::displayProcessAdapterDataCallback(PPDMIDISPLAYCONNEC
  *
  * @see PDMIDISPLAYCONNECTOR::pfnProcessDisplayData
  */
-DECLCALLBACK(void) Display::displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId)
+DECLCALLBACK(void) Display::i_displayProcessDisplayDataCallback(PPDMIDISPLAYCONNECTOR pInterface,
+                                                                void *pvVRAM, unsigned uScreenId)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
-
-    if (uScreenId >= pDrv->pDisplay->mcMonitors)
-    {
-        LogRel(("VBoxVideo: Guest display information invalid display index %d!!!\n", uScreenId));
-        return;
-    }
-
-    /* Get the display information structure. */
-    DISPLAYFBINFO *pFBInfo = &pDrv->pDisplay->maFramebuffers[uScreenId];
-
-    uint8_t *pu8 = (uint8_t *)pvVRAM;
-    pu8 += pFBInfo->u32Offset + pFBInfo->u32MaxFramebufferSize;
-
-    // @todo
-    uint8_t *pu8End = pu8 + pFBInfo->u32InformationSize;
-
-    VBOXVIDEOINFOHDR *pHdr;
-
-    for (;;)
-    {
-        pHdr = (VBOXVIDEOINFOHDR *)pu8;
-        pu8 += sizeof (VBOXVIDEOINFOHDR);
-
-        if (pu8 >= pu8End)
-        {
-            LogRel(("VBoxVideo: Guest display information overflow!!!\n"));
-            break;
-        }
-
-        if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_SCREEN)
-        {
-            if (pHdr->u16Length != sizeof (VBOXVIDEOINFOSCREEN))
-            {
-                LogRel(("VBoxVideo: Guest display information %s invalid length %d!!!\n", "SCREEN", pHdr->u16Length));
-                break;
-            }
-
-            VBOXVIDEOINFOSCREEN *pScreen = (VBOXVIDEOINFOSCREEN *)pu8;
-
-            pFBInfo->xOrigin = pScreen->xOrigin;
-            pFBInfo->yOrigin = pScreen->yOrigin;
-
-            pFBInfo->w = pScreen->u16Width;
-            pFBInfo->h = pScreen->u16Height;
-
-            LogRelFlow(("VBOX_VIDEO_INFO_TYPE_SCREEN: (%p) %d: at %d,%d, linesize 0x%X, size %dx%d, bpp %d, flags 0x%02X\n",
-                     pHdr, uScreenId, pScreen->xOrigin, pScreen->yOrigin, pScreen->u32LineSize, pScreen->u16Width, pScreen->u16Height, pScreen->bitsPerPixel, pScreen->u8Flags));
-
-            if (uScreenId != VBOX_VIDEO_PRIMARY_SCREEN)
-            {
-                /* Primary screen resize is eeeeeeeee by the VGA device. */
-                if (pFBInfo->fDisabled)
-                {
-                    pFBInfo->fDisabled = false;
-                    fireGuestMonitorChangedEvent(pDrv->pDisplay->mParent->getEventSource(),
-                                                 GuestMonitorChangedEventType_Enabled,
-                                                 uScreenId,
-                                                 pFBInfo->xOrigin, pFBInfo->yOrigin,
-                                                 pFBInfo->w, pFBInfo->h);
-                }
-
-                pDrv->pDisplay->handleDisplayResize(uScreenId, pScreen->bitsPerPixel, (uint8_t *)pvVRAM + pFBInfo->u32Offset, pScreen->u32LineSize, pScreen->u16Width, pScreen->u16Height, VBVA_SCREEN_F_ACTIVE);
-            }
-        }
-        else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_END)
-        {
-            if (pHdr->u16Length != 0)
-            {
-                LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "END", pHdr->u16Length));
-                break;
-            }
-
-            break;
-        }
-        else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_HOST_EVENTS)
-        {
-            if (pHdr->u16Length != sizeof (VBOXVIDEOINFOHOSTEVENTS))
-            {
-                LogRel(("VBoxVideo: Guest display information %s invalid length %d!!!\n", "HOST_EVENTS", pHdr->u16Length));
-                break;
-            }
-
-            VBOXVIDEOINFOHOSTEVENTS *pHostEvents = (VBOXVIDEOINFOHOSTEVENTS *)pu8;
-
-            pFBInfo->pHostEvents = pHostEvents;
-
-            LogFlow(("VBOX_VIDEO_INFO_TYPE_HOSTEVENTS: (%p)\n",
-                     pHostEvents));
-        }
-        else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_LINK)
-        {
-            if (pHdr->u16Length != sizeof (VBOXVIDEOINFOLINK))
-            {
-                LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "LINK", pHdr->u16Length));
-                break;
-            }
-
-            VBOXVIDEOINFOLINK *pLink = (VBOXVIDEOINFOLINK *)pu8;
-            pu8 += pLink->i32Offset;
-        }
-        else
-        {
-            LogRel(("Guest display information contains unsupported type %d\n", pHdr->u8Type));
-        }
-
-        pu8 += pHdr->u16Length;
-    }
+    pDrv->pDisplay->processDisplayData(pvVRAM, uScreenId);
 }
 
 #ifdef VBOX_WITH_VIDEOHWACCEL
@@ -4382,7 +3142,7 @@ DECLCALLBACK(void) Display::displayProcessDisplayDataCallback(PPDMIDISPLAYCONNEC
 # define S_FALSE ((HRESULT)1L)
 #endif
 
-int Display::handleVHWACommandProcess(PVBOXVHWACMD pCommand)
+int Display::i_handleVHWACommandProcess(PVBOXVHWACMD pCommand)
 {
     unsigned id = (unsigned)pCommand->iDisplay;
     int rc = VINF_SUCCESS;
@@ -4392,10 +3152,11 @@ int Display::handleVHWACommandProcess(PVBOXVHWACMD pCommand)
     ComPtr<IFramebuffer> pFramebuffer;
     AutoReadLock arlock(this COMMA_LOCKVAL_SRC_POS);
     pFramebuffer = maFramebuffers[id].pFramebuffer;
+    bool fVHWASupported = RT_BOOL(maFramebuffers[id].u32Caps & FramebufferCapabilities_VHWA);
     arlock.release();
 
-    if (pFramebuffer == NULL)
-        return VERR_INVALID_STATE; /* notify we can not handle request atm */
+    if (pFramebuffer == NULL || !fVHWASupported)
+        return VERR_NOT_IMPLEMENTED; /* Implementation is not available. */
 
     HRESULT hr = pFramebuffer->ProcessVHWACommand((BYTE*)pCommand);
     if (hr == S_FALSE)
@@ -4409,28 +3170,28 @@ int Display::handleVHWACommandProcess(PVBOXVHWACMD pCommand)
     return VERR_GENERAL_FAILURE;
 }
 
-DECLCALLBACK(int) Display::displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand)
+DECLCALLBACK(int) Display::i_displayVHWACommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCommand)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
 
-    return pDrv->pDisplay->handleVHWACommandProcess(pCommand);
+    return pDrv->pDisplay->i_handleVHWACommandProcess(pCommand);
 }
 #endif
 
 #ifdef VBOX_WITH_CRHGSMI
-void Display::handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam)
+void Display::i_handleCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam)
 {
     mpDrv->pVBVACallbacks->pfnCrHgsmiCommandCompleteAsync(mpDrv->pVBVACallbacks,
                                                           (PVBOXVDMACMD_CHROMIUM_CMD)pParam->u.pointer.addr, result);
 }
 
-void Display::handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam)
+void Display::i_handleCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam)
 {
     PVBOXVDMACMD_CHROMIUM_CTL pCtl = (PVBOXVDMACMD_CHROMIUM_CTL)pParam->u.pointer.addr;
     mpDrv->pVBVACallbacks->pfnCrHgsmiControlCompleteAsync(mpDrv->pVBVACallbacks, pCtl, result);
 }
 
-void Display::handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd)
+void Display::i_handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32_t cbCmd)
 {
     int rc = VERR_NOT_SUPPORTED;
     VBOXHGCMSVCPARM parm;
@@ -4440,7 +3201,7 @@ void Display::handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32
 
     if (mhCrOglSvc)
     {
-        VMMDev *pVMMDev = mParent->getVMMDev();
+        VMMDev *pVMMDev = mParent->i_getVMMDev();
         if (pVMMDev)
         {
             /* no completion callback is specified with this call,
@@ -4455,10 +3216,10 @@ void Display::handleCrHgsmiCommandProcess(PVBOXVDMACMD_CHROMIUM_CMD pCmd, uint32
     }
 
     /* we are here because something went wrong with command processing, complete it */
-    handleCrHgsmiCommandCompletion(rc, SHCRGL_HOST_FN_CRHGSMI_CMD, &parm);
+    i_handleCrHgsmiCommandCompletion(rc, SHCRGL_HOST_FN_CRHGSMI_CMD, &parm);
 }
 
-void Display::handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl)
+void Display::i_handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl)
 {
     int rc = VERR_NOT_SUPPORTED;
     VBOXHGCMSVCPARM parm;
@@ -4468,12 +3229,12 @@ void Display::handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32
 
     if (mhCrOglSvc)
     {
-        VMMDev *pVMMDev = mParent->getVMMDev();
+        VMMDev *pVMMDev = mParent->i_getVMMDev();
         if (pVMMDev)
         {
             bool fCheckPendingViewport = (pCtl->enmType == VBOXVDMACMD_CHROMIUM_CTL_TYPE_CRHGSMI_SETUP);
             rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_CRHGSMI_CTL, &parm,
-                                                Display::displayCrHgsmiControlCompletion, this);
+                                                Display::i_displayCrHgsmiControlCompletion, this);
             AssertRC(rc);
             if (RT_SUCCESS(rc))
             {
@@ -4486,13 +3247,13 @@ void Display::handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32
                         if (!pFb->pendingViewportInfo.fPending)
                             continue;
 
-                        rc = crViewportNotify(ul, pFb->pendingViewportInfo.x, pFb->pendingViewportInfo.y,
+                        rc = i_crViewportNotify(ul, pFb->pendingViewportInfo.x, pFb->pendingViewportInfo.y,
                                               pFb->pendingViewportInfo.width, pFb->pendingViewportInfo.height);
                         if (RT_SUCCESS(rc))
                             pFb->pendingViewportInfo.fPending = false;
                         else
                         {
-                            AssertMsgFailed(("crViewportNotify failed %d\n", rc));
+                            AssertMsgFailed(("crViewportNotify failed (rc=%Rrc)\n", rc));
                             rc = VINF_SUCCESS;
                         }
                     }
@@ -4505,56 +3266,56 @@ void Display::handleCrHgsmiControlProcess(PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32
     }
 
     /* we are here because something went wrong with command processing, complete it */
-    handleCrHgsmiControlCompletion(rc, SHCRGL_HOST_FN_CRHGSMI_CTL, &parm);
+    i_handleCrHgsmiControlCompletion(rc, SHCRGL_HOST_FN_CRHGSMI_CTL, &parm);
 }
 
-DECLCALLBACK(void) Display::displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd,
-                                                         uint32_t cbCmd)
+DECLCALLBACK(void) Display::i_displayCrHgsmiCommandProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CMD pCmd,
+                                                           uint32_t cbCmd)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
 
-    pDrv->pDisplay->handleCrHgsmiCommandProcess(pCmd, cbCmd);
+    pDrv->pDisplay->i_handleCrHgsmiCommandProcess(pCmd, cbCmd);
 }
 
-DECLCALLBACK(void) Display::displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd,
-                                                         uint32_t cbCmd)
+DECLCALLBACK(void) Display::i_displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCmd,
+                                                           uint32_t cbCmd)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
 
-    pDrv->pDisplay->handleCrHgsmiControlProcess(pCmd, cbCmd);
+    pDrv->pDisplay->i_handleCrHgsmiControlProcess(pCmd, cbCmd);
 }
 
-DECLCALLBACK(void) Display::displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
-                                                            void *pvContext)
+DECLCALLBACK(void) Display::i_displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
+                                                              void *pvContext)
 {
-    AssertMsgFailed(("not expected!"));
+    AssertMsgFailed(("not expected!\n"));
     Display *pDisplay = (Display *)pvContext;
-    pDisplay->handleCrHgsmiCommandCompletion(result, u32Function, pParam);
+    pDisplay->i_handleCrHgsmiCommandCompletion(result, u32Function, pParam);
 }
 
-DECLCALLBACK(void) Display::displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
-                                                            void *pvContext)
+DECLCALLBACK(void) Display::i_displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
+                                                              void *pvContext)
 {
     Display *pDisplay = (Display *)pvContext;
-    pDisplay->handleCrHgsmiControlCompletion(result, u32Function, pParam);
+    pDisplay->i_handleCrHgsmiControlCompletion(result, u32Function, pParam);
 
 }
 #endif
 
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-DECLCALLBACK(void)  Display::displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
-                                                              void *pvContext)
+DECLCALLBACK(void)  Display::i_displayCrHgcmCtlSubmitCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam,
+                                                                void *pvContext)
 {
     VBOXCRCMDCTL *pCmd = (VBOXCRCMDCTL*)pParam->u.pointer.addr;
     if (pCmd->u.pfnInternal)
         ((PFNCRCTLCOMPLETION)pCmd->u.pfnInternal)(pCmd, pParam->u.pointer.size, result, pvContext);
 }
 
-int  Display::handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
+int  Display::i_handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
                                     PFNCRCTLCOMPLETION pfnCompletion,
                                     void *pvCompletion)
 {
-    VMMDev *pVMMDev = mParent ? mParent->getVMMDev() : NULL;
+    VMMDev *pVMMDev = mParent ? mParent->i_getVMMDev() : NULL;
     if (!pVMMDev)
     {
         AssertMsgFailed(("no vmmdev\n"));
@@ -4568,25 +3329,25 @@ int  Display::handleCrHgcmCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
     parm.u.pointer.size = cbCmd;
 
     pCmd->u.pfnInternal = (void(*)())pfnCompletion;
-    int rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_CTL, &parm, displayCrHgcmCtlSubmitCompletion,
+    int rc = pVMMDev->hgcmHostFastCallAsync(mhCrOglSvc, SHCRGL_HOST_FN_CTL, &parm, i_displayCrHgcmCtlSubmitCompletion,
                                             pvCompletion);
     if (!RT_SUCCESS(rc))
-        AssertMsgFailed(("hgcmHostFastCallAsync failed rc %d\n", rc));
+        AssertMsgFailed(("hgcmHostFastCallAsync failed (rc=%Rrc)\n", rc));
 
     return rc;
 }
 
-DECLCALLBACK(int)  Display::displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
-                                    struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
-                                    PFNCRCTLCOMPLETION pfnCompletion,
-                                    void *pvCompletion)
+DECLCALLBACK(int)  Display::i_displayCrHgcmCtlSubmit(PPDMIDISPLAYCONNECTOR pInterface,
+                                                     struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd,
+                                                     PFNCRCTLCOMPLETION pfnCompletion,
+                                                     void *pvCompletion)
 {
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
     Display *pThis = pDrv->pDisplay;
-    return pThis->handleCrHgcmCtlSubmit(pCmd, cbCmd, pfnCompletion, pvCompletion);
+    return pThis->i_handleCrHgcmCtlSubmit(pCmd, cbCmd, pfnCompletion, pvCompletion);
 }
 
-int Display::crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion)
+int Display::i_crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion)
 {
     int rc = RTCritSectRwEnterShared(&mCrOglLock);
     if (RT_SUCCESS(rc))
@@ -4601,7 +3362,7 @@ int Display::crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMP
     return rc;
 }
 
-int Display::crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
+int Display::i_crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
 {
     int rc = RTCritSectRwEnterShared(&mCrOglLock);
     if (RT_SUCCESS(rc))
@@ -4616,7 +3377,7 @@ int Display::crCtlSubmitSync(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
     return rc;
 }
 
-int Display::crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
+int Display::i_crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
 {
     VBOXCRCMDCTL* pCmdCopy = (VBOXCRCMDCTL*)RTMemAlloc(cbCmd);
     if (!pCmdCopy)
@@ -4627,10 +3388,10 @@ int Display::crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
 
     memcpy(pCmdCopy, pCmd, cbCmd);
 
-    int rc = crCtlSubmit(pCmdCopy, cbCmd, displayCrCmdFree, pCmdCopy);
+    int rc = i_crCtlSubmit(pCmdCopy, cbCmd, i_displayCrCmdFree, pCmdCopy);
     if (RT_FAILURE(rc))
     {
-        LogRel(("crCtlSubmit failed %d\n", rc));
+        LogRel(("crCtlSubmit failed (rc=%Rrc)\n", rc));
         RTMemFree(pCmdCopy);
         return rc;
     }
@@ -4638,23 +3399,23 @@ int Display::crCtlSubmitAsyncCmdCopy(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
     return VINF_SUCCESS;
 }
 
-int Display::crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
+int Display::i_crCtlSubmitSyncIfHasDataForScreen(uint32_t u32ScreenID, struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd)
 {
     int rc = RTCritSectRwEnterShared(&mCrOglLock);
     AssertRCReturn(rc, rc);
 
     if (   mCrOglCallbacks.pfnHasDataForScreen
         && mCrOglCallbacks.pfnHasDataForScreen(u32ScreenID))
-        rc = crCtlSubmitSync(pCmd, cbCmd);
+        rc = i_crCtlSubmitSync(pCmd, cbCmd);
     else
-        rc = crCtlSubmitAsyncCmdCopy(pCmd, cbCmd);
+        rc = i_crCtlSubmitAsyncCmdCopy(pCmd, cbCmd);
 
     RTCritSectRwLeaveShared(&mCrOglLock);
 
     return rc;
 }
 
-bool  Display::handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp)
+bool  Display::i_handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeStamp)
 {
 # if VBOX_WITH_VPX
     return VideoRecIsReady(mpVideoRecCtx, uScreen, u64TimeStamp);
@@ -4663,15 +3424,15 @@ bool  Display::handleCrVRecScreenshotBegin(uint32_t uScreen, uint64_t u64TimeSta
 # endif
 }
 
-void  Display::handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp)
+void  Display::i_handleCrVRecScreenshotEnd(uint32_t uScreen, uint64_t u64TimeStamp)
 {
 }
 
-void  Display::handleCrVRecScreenshotPerform(uint32_t uScreen,
-                                             uint32_t x, uint32_t y, uint32_t uPixelFormat,
-                                             uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
-                                             uint32_t uGuestWidth, uint32_t uGuestHeight,
-                                             uint8_t *pu8BufferAddress, uint64_t u64TimeStamp)
+void  Display::i_handleCrVRecScreenshotPerform(uint32_t uScreen,
+                                               uint32_t x, uint32_t y, uint32_t uPixelFormat,
+                                               uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
+                                               uint32_t uGuestWidth, uint32_t uGuestHeight,
+                                               uint8_t *pu8BufferAddress, uint64_t u64TimeStamp)
 {
     Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED);
 # if VBOX_WITH_VPX
@@ -4684,47 +3445,191 @@ void  Display::handleCrVRecScreenshotPerform(uint32_t uScreen,
 # endif
 }
 
-void  Display::handleVRecCompletion()
+void  Display::i_handleVRecCompletion()
 {
     Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED);
     ASMAtomicWriteU32(&mfCrOglVideoRecState, CRVREC_STATE_IDLE);
 }
 
-DECLCALLBACK(void) Display::displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
-                                                           uint32_t x, uint32_t y,
-                                                           uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
-                                                           uint32_t uGuestWidth, uint32_t uGuestHeight,
-                                                           uint8_t *pu8BufferAddress, uint64_t u64TimeStamp)
+#endif /* VBOX_WITH_HGCM && VBOX_WITH_CROGL */
+
+HRESULT Display::notifyScaleFactorChange(ULONG aScreenId, ULONG aScaleFactorWMultiplied, ULONG aScaleFactorHMultiplied)
+{
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+    HRESULT hr = E_UNEXPECTED;
+
+    if (aScreenId >= mcMonitors)
+        return E_INVALIDARG;
+
+    /* 3D acceleration enabled in VM config. */
+    if (mfIsCr3DEnabled)
+    {
+        /* VBoxSharedCrOpenGL HGCM host service is running. */
+        if (mhCrOglSvc)
+        {
+            VMMDev *pVMMDev = mParent->i_getVMMDev();
+            if (pVMMDev)
+            {
+                VBOXCRCMDCTL_HGCM *pCtl;
+                pCtl = (VBOXCRCMDCTL_HGCM *)RTMemAlloc(sizeof(CRVBOXHGCMSETSCALEFACTOR) + sizeof(VBOXCRCMDCTL_HGCM));
+                if (pCtl)
+                {
+                    CRVBOXHGCMSETSCALEFACTOR *pData = (CRVBOXHGCMSETSCALEFACTOR *)(pCtl + 1);
+                    int rc;
+
+                    pData->u32Screen                 = aScreenId;
+                    pData->u32ScaleFactorWMultiplied = aScaleFactorWMultiplied;
+                    pData->u32ScaleFactorHMultiplied = aScaleFactorHMultiplied;
+
+                    pCtl->Hdr.enmType              = VBOXCRCMDCTL_TYPE_HGCM;
+                    pCtl->Hdr.u32Function          = SHCRGL_HOST_FN_SET_SCALE_FACTOR;
+                    pCtl->aParms[0].type           = VBOX_HGCM_SVC_PARM_PTR;
+                    pCtl->aParms[0].u.pointer.addr = pData;
+                    pCtl->aParms[0].u.pointer.size = sizeof(*pData);
+
+                    rc = i_crCtlSubmitSync(&pCtl->Hdr, sizeof(*pCtl));
+                    if (RT_FAILURE(rc))
+                        AssertMsgFailed(("crCtlSubmitSync failed (rc=%Rrc)\n", rc));
+                    else
+                        hr = S_OK;
+
+                    RTMemFree(pCtl);
+                }
+                else
+                {
+                    LogRel(("Running out of memory on attempt to set OpenGL content scale factor. Ignored.\n"));
+                    hr = E_OUTOFMEMORY;
+                }
+            }
+            else
+                LogRel(("Internal error occurred on attempt to set OpenGL content scale factor. Ignored.\n"));
+        }
+        else
+            LogRel(("Attempt to specify OpenGL content scale factor while corresponding HGCM host service not yet runing. Ignored.\n"));
+    }
+    else
+# if 0 /** @todo Thank you so very much from anyone using VMSVGA3d!  */
+        AssertMsgFailed(("Attempt to specify OpenGL content scale factor while 3D acceleration is disabled in VM config. Ignored.\n"));
+# else
+    {
+        hr = S_OK;
+        /* Need an interface like this here (and the #ifdefs needs adjusting):
+        PPDMIDISPLAYPORT pUpPort = mpDrv ? mpDrv->pUpPort : NULL;
+        if (pUpPort && pUpPort->pfnSetScaleFactor)
+            pUpPort->pfnSetScaleFactor(pUpPort, aScreeId, aScaleFactorWMultiplied, aScaleFactorHMultiplied); */
+    }
+# endif
+
+    return hr;
+#else
+    AssertMsgFailed(("Attempt to specify OpenGL content scale factor while corresponding functionality is disabled."));
+    return E_UNEXPECTED;
+#endif /* VBOX_WITH_HGCM && VBOX_WITH_CROGL */
+}
+
+HRESULT Display::notifyHiDPIOutputPolicyChange(BOOL fUnscaledHiDPI)
+{
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+    HRESULT hr = E_UNEXPECTED;
+
+    /* 3D acceleration enabled in VM config. */
+    if (mfIsCr3DEnabled)
+    {
+        /* VBoxSharedCrOpenGL HGCM host service is running. */
+        if (mhCrOglSvc)
+        {
+            VMMDev *pVMMDev = mParent->i_getVMMDev();
+            if (pVMMDev)
+            {
+                VBOXCRCMDCTL_HGCM *pCtl;
+                pCtl = (VBOXCRCMDCTL_HGCM *)RTMemAlloc(sizeof(CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT) + sizeof(VBOXCRCMDCTL_HGCM));
+                if (pCtl)
+                {
+                    CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT *pData = (CRVBOXHGCMSETUNSCALEDHIDPIOUTPUT *)(pCtl + 1);
+                    int rc;
+
+                    pData->fUnscaledHiDPI          = RT_BOOL(fUnscaledHiDPI);
+
+                    pCtl->Hdr.enmType              = VBOXCRCMDCTL_TYPE_HGCM;
+                    pCtl->Hdr.u32Function          = SHCRGL_HOST_FN_SET_UNSCALED_HIDPI;
+                    pCtl->aParms[0].type           = VBOX_HGCM_SVC_PARM_PTR;
+                    pCtl->aParms[0].u.pointer.addr = pData;
+                    pCtl->aParms[0].u.pointer.size = sizeof(*pData);
+
+                    rc = i_crCtlSubmitSync(&pCtl->Hdr, sizeof(*pCtl));
+                    if (RT_FAILURE(rc))
+                        AssertMsgFailed(("crCtlSubmitSync failed (rc=%Rrc)\n", rc));
+                    else
+                        hr = S_OK;
+
+                    RTMemFree(pCtl);
+                }
+                else
+                {
+                    LogRel(("Running out of memory on attempt to notify OpenGL about HiDPI output scaling policy change. Ignored.\n"));
+                    hr = E_OUTOFMEMORY;
+                }
+            }
+            else
+                LogRel(("Internal error occurred on attempt to notify OpenGL about HiDPI output scaling policy change. Ignored.\n"));
+        }
+        else
+            LogRel(("Attempt to notify OpenGL about HiDPI output scaling policy change while corresponding HGCM host service not yet runing. Ignored.\n"));
+    }
+    else
+    {
+        hr = S_OK;
+        /* Need an interface like this here (and the #ifdefs needs adjusting):
+        PPDMIDISPLAYPORT pUpPort = mpDrv ? mpDrv->pUpPort : NULL;
+        if (pUpPort && pUpPort->pfnSetScaleFactor)
+            pUpPort->pfnSetScaleFactor(pUpPort, aScreeId, aScaleFactorWMultiplied, aScaleFactorHMultiplied); */
+    }
+
+    return hr;
+#else
+    AssertMsgFailed(("Attempt to notify OpenGL about HiDPI output scaling policy change while corresponding functionality is disabled."));
+    return E_UNEXPECTED;
+#endif /* VBOX_WITH_HGCM && VBOX_WITH_CROGL */
+}
+
+#if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
+DECLCALLBACK(void) Display::i_displayCrVRecScreenshotPerform(void *pvCtx, uint32_t uScreen,
+                                                             uint32_t x, uint32_t y,
+                                                             uint32_t uBitsPerPixel, uint32_t uBytesPerLine,
+                                                             uint32_t uGuestWidth, uint32_t uGuestHeight,
+                                                             uint8_t *pu8BufferAddress, uint64_t u64TimeStamp)
 {
     Display *pDisplay = (Display *)pvCtx;
-    pDisplay->handleCrVRecScreenshotPerform(uScreen,
-                                            x, y, FramebufferPixelFormat_FOURCC_RGB, uBitsPerPixel,
-                                            uBytesPerLine, uGuestWidth, uGuestHeight,
-                                            pu8BufferAddress, u64TimeStamp);
+    pDisplay->i_handleCrVRecScreenshotPerform(uScreen,
+                                              x, y, BitmapFormat_BGR, uBitsPerPixel,
+                                              uBytesPerLine, uGuestWidth, uGuestHeight,
+                                              pu8BufferAddress, u64TimeStamp);
 }
 
-DECLCALLBACK(bool) Display::displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp)
+DECLCALLBACK(bool) Display::i_displayCrVRecScreenshotBegin(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp)
 {
     Display *pDisplay = (Display *)pvCtx;
-    return pDisplay->handleCrVRecScreenshotBegin(uScreen, u64TimeStamp);
+    return pDisplay->i_handleCrVRecScreenshotBegin(uScreen, u64TimeStamp);
 }
 
-DECLCALLBACK(void) Display::displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp)
+DECLCALLBACK(void) Display::i_displayCrVRecScreenshotEnd(void *pvCtx, uint32_t uScreen, uint64_t u64TimeStamp)
 {
     Display *pDisplay = (Display *)pvCtx;
-    pDisplay->handleCrVRecScreenshotEnd(uScreen, u64TimeStamp);
+    pDisplay->i_handleCrVRecScreenshotEnd(uScreen, u64TimeStamp);
 }
 
-DECLCALLBACK(void)  Display::displayVRecCompletion(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion)
+DECLCALLBACK(void) Display::i_displayVRecCompletion(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, int rc, void *pvCompletion)
 {
     Display *pDisplay = (Display *)pvCompletion;
-    pDisplay->handleVRecCompletion();
+    pDisplay->i_handleVRecCompletion();
 }
 
 #endif
 
+
 #ifdef VBOX_WITH_HGSMI
-DECLCALLBACK(int) Display::displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode)
+DECLCALLBACK(int) Display::i_displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags,
+                                               bool fRenderThreadMode)
 {
     LogRelFlowFunc(("uScreenId %d\n", uScreenId));
 
@@ -4733,9 +3638,9 @@ DECLCALLBACK(int) Display::displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, u
 
     if (pThis->maFramebuffers[uScreenId].fVBVAEnabled && pThis->maFramebuffers[uScreenId].fRenderThreadMode != fRenderThreadMode)
     {
-        LogRel(("enabling different vbva mode"));
+        LogRel(("Enabling different vbva mode\n"));
 #ifdef DEBUG_misha
-        AssertMsgFailed(("enabling different vbva mode"));
+        AssertMsgFailed(("enabling different vbva mode\n"));
 #endif
         return VERR_INVALID_STATE;
     }
@@ -4743,13 +3648,14 @@ DECLCALLBACK(int) Display::displayVBVAEnable(PPDMIDISPLAYCONNECTOR pInterface, u
     pThis->maFramebuffers[uScreenId].fVBVAEnabled = true;
     pThis->maFramebuffers[uScreenId].pVBVAHostFlags = pHostFlags;
     pThis->maFramebuffers[uScreenId].fRenderThreadMode = fRenderThreadMode;
+    pThis->maFramebuffers[uScreenId].fVBVAForceResize = true;
 
     vbvaSetMemoryFlagsHGSMI(uScreenId, pThis->mfu32SupportedOrders, pThis->mfVideoAccelVRDP, &pThis->maFramebuffers[uScreenId]);
 
     return VINF_SUCCESS;
 }
 
-DECLCALLBACK(void) Display::displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId)
+DECLCALLBACK(void) Display::i_displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId)
 {
     LogRelFlowFunc(("uScreenId %d\n", uScreenId));
 
@@ -4758,6 +3664,8 @@ DECLCALLBACK(void) Display::displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface,
 
     DISPLAYFBINFO *pFBInfo = &pThis->maFramebuffers[uScreenId];
 
+    bool fRenderThreadMode = pFBInfo->fRenderThreadMode;
+
     if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
     {
         /* Make sure that the primary screen is visible now.
@@ -4766,7 +3674,7 @@ DECLCALLBACK(void) Display::displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface,
         if (pFBInfo->fDisabled)
         {
             pFBInfo->fDisabled = false;
-            fireGuestMonitorChangedEvent(pThis->mParent->getEventSource(),
+            fireGuestMonitorChangedEvent(pThis->mParent->i_getEventSource(),
                                          GuestMonitorChangedEventType_Enabled,
                                          uScreenId,
                                          pFBInfo->xOrigin, pFBInfo->yOrigin,
@@ -4775,28 +3683,21 @@ DECLCALLBACK(void) Display::displayVBVADisable(PPDMIDISPLAYCONNECTOR pInterface,
     }
 
     pFBInfo->fVBVAEnabled = false;
+    pFBInfo->fVBVAForceResize = false;
     pFBInfo->fRenderThreadMode = false;
 
     vbvaSetMemoryFlagsHGSMI(uScreenId, 0, false, pFBInfo);
 
     pFBInfo->pVBVAHostFlags = NULL;
 
-    pFBInfo->u32Offset = 0; /* Not used in HGSMI. */
-    pFBInfo->u32MaxFramebufferSize = 0; /* Not used in HGSMI. */
-    pFBInfo->u32InformationSize = 0; /* Not used in HGSMI. */
-
-    pFBInfo->xOrigin = 0;
-    pFBInfo->yOrigin = 0;
-
-    pFBInfo->w = 0;
-    pFBInfo->h = 0;
-
-    pFBInfo->u16BitsPerPixel = 0;
-    pFBInfo->pu8FramebufferVRAM = NULL;
-    pFBInfo->u32LineSize = 0;
+    if (!fRenderThreadMode && uScreenId == VBOX_VIDEO_PRIMARY_SCREEN)
+    {
+        /* Force full screen update, because VGA device must take control, do resize, etc. */
+        pThis->mpDrv->pUpPort->pfnUpdateDisplayAll(pThis->mpDrv->pUpPort, /* fFailOnResize = */ false);
+    }
 }
 
-DECLCALLBACK(void) Display::displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId)
+DECLCALLBACK(void) Display::i_displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId)
 {
     LogFlowFunc(("uScreenId %d\n", uScreenId));
 
@@ -4806,32 +3707,14 @@ DECLCALLBACK(void) Display::displayVBVAUpdateBegin(PPDMIDISPLAYCONNECTOR pInterf
 
     if (ASMAtomicReadU32(&pThis->mu32UpdateVBVAFlags) > 0)
     {
-        vbvaSetMemoryFlagsAllHGSMI(pThis->mfu32SupportedOrders, pThis->mfVideoAccelVRDP, pThis->maFramebuffers, pThis->mcMonitors);
+        vbvaSetMemoryFlagsAllHGSMI(pThis->mfu32SupportedOrders, pThis->mfVideoAccelVRDP, pThis->maFramebuffers,
+                                   pThis->mcMonitors);
         ASMAtomicDecU32(&pThis->mu32UpdateVBVAFlags);
     }
-
-    if (RT_LIKELY(pFBInfo->u32ResizeStatus == ResizeStatus_Void))
-    {
-        if (RT_UNLIKELY(pFBInfo->cVBVASkipUpdate != 0))
-        {
-            /* Some updates were skipped. Note: displayVBVAUpdate* callbacks are called
-             * under display device lock, so thread safe.
-             */
-            pFBInfo->cVBVASkipUpdate = 0;
-            pThis->handleDisplayUpdate(uScreenId, pFBInfo->vbvaSkippedRect.xLeft - pFBInfo->xOrigin,
-                                       pFBInfo->vbvaSkippedRect.yTop - pFBInfo->yOrigin,
-                                       pFBInfo->vbvaSkippedRect.xRight - pFBInfo->vbvaSkippedRect.xLeft,
-                                       pFBInfo->vbvaSkippedRect.yBottom - pFBInfo->vbvaSkippedRect.yTop);
-        }
-    }
-    else
-    {
-        /* The framebuffer is being resized. */
-        pFBInfo->cVBVASkipUpdate++;
-    }
 }
 
-DECLCALLBACK(void) Display::displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd)
+DECLCALLBACK(void) Display::i_displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId,
+                                                       const PVBVACMDHDR pCmd, size_t cbCmd)
 {
     LogFlowFunc(("uScreenId %d pCmd %p cbCmd %d, @%d,%d %dx%d\n", uScreenId, pCmd, cbCmd, pCmd->x, pCmd->y, pCmd->w, pCmd->h));
 
@@ -4839,73 +3722,81 @@ DECLCALLBACK(void) Display::displayVBVAUpdateProcess(PPDMIDISPLAYCONNECTOR pInte
     Display *pThis = pDrv->pDisplay;
     DISPLAYFBINFO *pFBInfo = &pThis->maFramebuffers[uScreenId];
 
-    if (RT_LIKELY(pFBInfo->cVBVASkipUpdate == 0))
+    if (pFBInfo->fDefaultFormat)
     {
-        if (pFBInfo->fDefaultFormat)
+        /* Make sure that framebuffer contains the same image as the guest VRAM. */
+        if (   uScreenId == VBOX_VIDEO_PRIMARY_SCREEN
+            && !pFBInfo->fDisabled)
         {
-            /* Make sure that framebuffer contains the same image as the guest VRAM. */
-            if (   uScreenId == VBOX_VIDEO_PRIMARY_SCREEN
-                && !pFBInfo->pFramebuffer.isNull()
-                && !pFBInfo->fDisabled)
-            {
-                pDrv->pUpPort->pfnUpdateDisplayRect (pDrv->pUpPort, pCmd->x, pCmd->y, pCmd->w, pCmd->h);
-            }
-            else if (   !pFBInfo->pFramebuffer.isNull()
-                     && !pFBInfo->fDisabled)
+            pDrv->pUpPort->pfnUpdateDisplayRect(pDrv->pUpPort, pCmd->x, pCmd->y, pCmd->w, pCmd->h);
+        }
+        else if (   !pFBInfo->pSourceBitmap.isNull()
+                 && !pFBInfo->fDisabled)
+        {
+            /* Render VRAM content to the framebuffer. */
+            BYTE *pAddress = NULL;
+            ULONG ulWidth = 0;
+            ULONG ulHeight = 0;
+            ULONG ulBitsPerPixel = 0;
+            ULONG ulBytesPerLine = 0;
+            BitmapFormat_T bitmapFormat = BitmapFormat_Opaque;
+
+            HRESULT hrc = pFBInfo->pSourceBitmap->QueryBitmapInfo(&pAddress,
+                                                                  &ulWidth,
+                                                                  &ulHeight,
+                                                                  &ulBitsPerPixel,
+                                                                  &ulBytesPerLine,
+                                                                  &bitmapFormat);
+            if (SUCCEEDED(hrc))
             {
-                /* Render VRAM content to the framebuffer. */
-                BYTE *address = NULL;
-                HRESULT hrc = pFBInfo->pFramebuffer->COMGETTER(Address) (&address);
-                if (SUCCEEDED(hrc) && address != NULL)
-                {
-                    uint32_t width              = pCmd->w;
-                    uint32_t height             = pCmd->h;
-
-                    const uint8_t *pu8Src       = pFBInfo->pu8FramebufferVRAM;
-                    int32_t xSrc                = pCmd->x - pFBInfo->xOrigin;
-                    int32_t ySrc                = pCmd->y - pFBInfo->yOrigin;
-                    uint32_t u32SrcWidth        = pFBInfo->w;
-                    uint32_t u32SrcHeight       = pFBInfo->h;
-                    uint32_t u32SrcLineSize     = pFBInfo->u32LineSize;
-                    uint32_t u32SrcBitsPerPixel = pFBInfo->u16BitsPerPixel;
-
-                    uint8_t *pu8Dst             = address;
-                    int32_t xDst                = xSrc;
-                    int32_t yDst                = ySrc;
-                    uint32_t u32DstWidth        = u32SrcWidth;
-                    uint32_t u32DstHeight       = u32SrcHeight;
-                    uint32_t u32DstLineSize     = u32DstWidth * 4;
-                    uint32_t u32DstBitsPerPixel = 32;
-
-                    pDrv->pUpPort->pfnCopyRect(pDrv->pUpPort,
-                                               width, height,
-                                               pu8Src,
-                                               xSrc, ySrc,
-                                               u32SrcWidth, u32SrcHeight,
-                                               u32SrcLineSize, u32SrcBitsPerPixel,
-                                               pu8Dst,
-                                               xDst, yDst,
-                                               u32DstWidth, u32DstHeight,
-                                               u32DstLineSize, u32DstBitsPerPixel);
-                }
+                uint32_t width              = pCmd->w;
+                uint32_t height             = pCmd->h;
+
+                const uint8_t *pu8Src       = pFBInfo->pu8FramebufferVRAM;
+                int32_t xSrc                = pCmd->x - pFBInfo->xOrigin;
+                int32_t ySrc                = pCmd->y - pFBInfo->yOrigin;
+                uint32_t u32SrcWidth        = pFBInfo->w;
+                uint32_t u32SrcHeight       = pFBInfo->h;
+                uint32_t u32SrcLineSize     = pFBInfo->u32LineSize;
+                uint32_t u32SrcBitsPerPixel = pFBInfo->u16BitsPerPixel;
+
+                uint8_t *pu8Dst             = pAddress;
+                int32_t xDst                = xSrc;
+                int32_t yDst                = ySrc;
+                uint32_t u32DstWidth        = u32SrcWidth;
+                uint32_t u32DstHeight       = u32SrcHeight;
+                uint32_t u32DstLineSize     = u32DstWidth * 4;
+                uint32_t u32DstBitsPerPixel = 32;
+
+                pDrv->pUpPort->pfnCopyRect(pDrv->pUpPort,
+                                           width, height,
+                                           pu8Src,
+                                           xSrc, ySrc,
+                                           u32SrcWidth, u32SrcHeight,
+                                           u32SrcLineSize, u32SrcBitsPerPixel,
+                                           pu8Dst,
+                                           xDst, yDst,
+                                           u32DstWidth, u32DstHeight,
+                                           u32DstLineSize, u32DstBitsPerPixel);
             }
         }
+    }
 
-        VBVACMDHDR hdrSaved = *pCmd;
+    VBVACMDHDR hdrSaved = *pCmd;
 
-        VBVACMDHDR *pHdrUnconst = (VBVACMDHDR *)pCmd;
+    VBVACMDHDR *pHdrUnconst = (VBVACMDHDR *)pCmd;
 
-        pHdrUnconst->x -= (int16_t)pFBInfo->xOrigin;
-        pHdrUnconst->y -= (int16_t)pFBInfo->yOrigin;
+    pHdrUnconst->x -= (int16_t)pFBInfo->xOrigin;
+    pHdrUnconst->y -= (int16_t)pFBInfo->yOrigin;
 
-        /* @todo new SendUpdate entry which can get a separate cmd header or coords. */
-        pThis->mParent->consoleVRDPServer()->SendUpdate (uScreenId, pCmd, (uint32_t)cbCmd);
+    /* @todo new SendUpdate entry which can get a separate cmd header or coords. */
+    pThis->mParent->i_consoleVRDPServer()->SendUpdate(uScreenId, pCmd, (uint32_t)cbCmd);
 
-        *pHdrUnconst = hdrSaved;
-    }
+    *pHdrUnconst = hdrSaved;
 }
 
-DECLCALLBACK(void) Display::displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y, uint32_t cx, uint32_t cy)
+DECLCALLBACK(void) Display::i_displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, int32_t x, int32_t y,
+                                                   uint32_t cx, uint32_t cy)
 {
     LogFlowFunc(("uScreenId %d %d,%d %dx%d\n", uScreenId, x, y, cx, cy));
 
@@ -4918,43 +3809,7 @@ DECLCALLBACK(void) Display::displayVBVAUpdateEnd(PPDMIDISPLAYCONNECTOR pInterfac
      *                                y - pThis->maFramebuffers[uScreenId].yOrigin,
      *                                cx, cy);
      */
-    if (RT_LIKELY(pFBInfo->cVBVASkipUpdate == 0))
-    {
-        pThis->handleDisplayUpdate(uScreenId, x - pFBInfo->xOrigin, y - pFBInfo->yOrigin, cx, cy);
-    }
-    else
-    {
-        /* Save the updated rectangle. */
-        int32_t xRight = x + cx;
-        int32_t yBottom = y + cy;
-
-        if (pFBInfo->cVBVASkipUpdate == 1)
-        {
-            pFBInfo->vbvaSkippedRect.xLeft = x;
-            pFBInfo->vbvaSkippedRect.yTop = y;
-            pFBInfo->vbvaSkippedRect.xRight = xRight;
-            pFBInfo->vbvaSkippedRect.yBottom = yBottom;
-        }
-        else
-        {
-            if (pFBInfo->vbvaSkippedRect.xLeft > x)
-            {
-                pFBInfo->vbvaSkippedRect.xLeft = x;
-            }
-            if (pFBInfo->vbvaSkippedRect.yTop > y)
-            {
-                pFBInfo->vbvaSkippedRect.yTop = y;
-            }
-            if (pFBInfo->vbvaSkippedRect.xRight < xRight)
-            {
-                pFBInfo->vbvaSkippedRect.xRight = xRight;
-            }
-            if (pFBInfo->vbvaSkippedRect.yBottom < yBottom)
-            {
-                pFBInfo->vbvaSkippedRect.yBottom = yBottom;
-            }
-        }
-    }
+    pThis->i_handleDisplayUpdate(uScreenId, x - pFBInfo->xOrigin, y - pFBInfo->yOrigin, cx, cy);
 }
 
 #ifdef DEBUG_sunlover
@@ -4983,19 +3838,9 @@ static void logVBVAResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScre
             "    pFBInfo->u32LineSize           0x%08X\n"
             "    pFBInfo->flags                 0x%04X\n"
             "    pFBInfo->pHostEvents           %p\n"
-            "    pFBInfo->u32ResizeStatus       %d\n"
             "    pFBInfo->fDefaultFormat        %d\n"
-            "    dirtyRect                      %d-%d %d-%d\n"
-            "    pFBInfo->pendingResize.fPending    %d\n"
-            "    pFBInfo->pendingResize.pixelFormat %d\n"
-            "    pFBInfo->pendingResize.pvVRAM      %p\n"
-            "    pFBInfo->pendingResize.bpp         %d\n"
-            "    pFBInfo->pendingResize.cbLine      0x%08X\n"
-            "    pFBInfo->pendingResize.w,h         %dx%d\n"
-            "    pFBInfo->pendingResize.flags       0x%04X\n"
             "    pFBInfo->fVBVAEnabled    %d\n"
-            "    pFBInfo->cVBVASkipUpdate %d\n"
-            "    pFBInfo->vbvaSkippedRect %d-%d %d-%d\n"
+            "    pFBInfo->fVBVAForceResize %d\n"
             "    pFBInfo->pVBVAHostFlags  %p\n"
             "",
             pScreen->u32ViewIndex,
@@ -5025,32 +3870,16 @@ static void logVBVAResize(const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScre
             pFBInfo->u32LineSize,
             pFBInfo->flags,
             pFBInfo->pHostEvents,
-            pFBInfo->u32ResizeStatus,
             pFBInfo->fDefaultFormat,
-            pFBInfo->dirtyRect.xLeft,
-            pFBInfo->dirtyRect.xRight,
-            pFBInfo->dirtyRect.yTop,
-            pFBInfo->dirtyRect.yBottom,
-            pFBInfo->pendingResize.fPending,
-            pFBInfo->pendingResize.pixelFormat,
-            pFBInfo->pendingResize.pvVRAM,
-            pFBInfo->pendingResize.bpp,
-            pFBInfo->pendingResize.cbLine,
-            pFBInfo->pendingResize.w,
-            pFBInfo->pendingResize.h,
-            pFBInfo->pendingResize.flags,
             pFBInfo->fVBVAEnabled,
-            pFBInfo->cVBVASkipUpdate,
-            pFBInfo->vbvaSkippedRect.xLeft,
-            pFBInfo->vbvaSkippedRect.yTop,
-            pFBInfo->vbvaSkippedRect.xRight,
-            pFBInfo->vbvaSkippedRect.yBottom,
+            pFBInfo->fVBVAForceResize,
             pFBInfo->pVBVAHostFlags
           ));
 }
 #endif /* DEBUG_sunlover */
 
-DECLCALLBACK(int) Display::displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView, const PVBVAINFOSCREEN pScreen, void *pvVRAM)
+DECLCALLBACK(int) Display::i_displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, const PVBVAINFOVIEW pView,
+                                               const PVBVAINFOSCREEN pScreen, void *pvVRAM)
 {
     LogRelFlowFunc(("pScreen %p, pvVRAM %p\n", pScreen, pvVRAM));
 
@@ -5061,7 +3890,7 @@ DECLCALLBACK(int) Display::displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, c
 
     if (pScreen->u16Flags & VBVA_SCREEN_F_DISABLED)
     {
-        pThis->notifyCroglResize(pView, pScreen, pvVRAM);
+        pThis->i_notifyCroglResize(pView, pScreen, pvVRAM);
 
         pFBInfo->fDisabled = true;
         pFBInfo->flags = pScreen->u16Flags;
@@ -5071,10 +3900,10 @@ DECLCALLBACK(int) Display::displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, c
          * the VM window will be black. */
         uint32_t u32Width = pFBInfo->w ? pFBInfo->w : 640;
         uint32_t u32Height = pFBInfo->h ? pFBInfo->h : 480;
-        pThis->handleDisplayResize(pScreen->u32ViewIndex, 0, (uint8_t *)NULL, 0,
-                                   u32Width, u32Height, pScreen->u16Flags);
+        pThis->i_handleDisplayResize(pScreen->u32ViewIndex, 0, (uint8_t *)NULL, 0,
+                                     u32Width, u32Height, pScreen->u16Flags);
 
-        fireGuestMonitorChangedEvent(pThis->mParent->getEventSource(),
+        fireGuestMonitorChangedEvent(pThis->mParent->i_getEventSource(),
                                      GuestMonitorChangedEventType_Disabled,
                                      pScreen->u32ViewIndex,
                                      0, 0, 0, 0);
@@ -5086,6 +3915,18 @@ DECLCALLBACK(int) Display::displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, c
      */
     bool fResize = pFBInfo->fDisabled || pFBInfo->pFramebuffer.isNull();
 
+    if (pFBInfo->fVBVAForceResize)
+    {
+        /* VBVA was just enabled. Do the resize. */
+        fResize = true;
+        pFBInfo->fVBVAForceResize = false;
+    }
+
+    /* If the screen if blanked, then do a resize request to make sure that the framebuffer
+     * switches to the default format.
+     */
+    fResize = fResize || RT_BOOL((pScreen->u16Flags ^ pFBInfo->flags) & VBVA_SCREEN_F_BLANK);
+
     /* Check if this is a real resize or a notification about the screen origin.
      * The guest uses this VBVAResize call for both.
      */
@@ -5100,12 +3941,12 @@ DECLCALLBACK(int) Display::displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, c
                       || pFBInfo->yOrigin != pScreen->i32OriginY;
 
     if (fNewOrigin || fResize)
-        pThis->notifyCroglResize(pView, pScreen, pvVRAM);
+        pThis->i_notifyCroglResize(pView, pScreen, pvVRAM);
 
     if (pFBInfo->fDisabled)
     {
         pFBInfo->fDisabled = false;
-        fireGuestMonitorChangedEvent(pThis->mParent->getEventSource(),
+        fireGuestMonitorChangedEvent(pThis->mParent->i_getEventSource(),
                                      GuestMonitorChangedEventType_Enabled,
                                      pScreen->u32ViewIndex,
                                      pScreen->i32OriginX, pScreen->i32OriginY,
@@ -5136,7 +3977,7 @@ DECLCALLBACK(int) Display::displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, c
 
     if (fNewOrigin)
     {
-        fireGuestMonitorChangedEvent(pThis->mParent->getEventSource(),
+        fireGuestMonitorChangedEvent(pThis->mParent->i_getEventSource(),
                                      GuestMonitorChangedEventType_NewOrigin,
                                      pScreen->u32ViewIndex,
                                      pScreen->i32OriginX, pScreen->i32OriginY,
@@ -5150,48 +3991,37 @@ DECLCALLBACK(int) Display::displayVBVAResize(PPDMIDISPLAYCONNECTOR pInterface, c
         {
             /* VRDP server still need this notification. */
             LogRelFlowFunc(("Calling VRDP\n"));
-            pThis->mParent->consoleVRDPServer()->SendResize();
+            pThis->mParent->i_consoleVRDPServer()->SendResize();
         }
         return VINF_SUCCESS;
     }
 
-    if (pFBInfo->pFramebuffer.isNull())
-    {
-        /* If no framebuffer, the resize will be done later when a new framebuffer will be set in changeFramebuffer. */
-        return VINF_SUCCESS;
-    }
-
-    /* If the framebuffer already set for the screen, do a regular resize. */
-    return pThis->handleDisplayResize(pScreen->u32ViewIndex, pScreen->u16BitsPerPixel,
-                                      (uint8_t *)pvVRAM + pScreen->u32StartOffset,
-                                      pScreen->u32LineSize, pScreen->u32Width, pScreen->u32Height, pScreen->u16Flags);
+    /* Do a regular resize. */
+    return pThis->i_handleDisplayResize(pScreen->u32ViewIndex, pScreen->u16BitsPerPixel,
+                                        (uint8_t *)pvVRAM + pScreen->u32StartOffset,
+                                        pScreen->u32LineSize, pScreen->u32Width, pScreen->u32Height, pScreen->u16Flags);
 }
 
-DECLCALLBACK(int) Display::displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
-                                                        uint32_t xHot, uint32_t yHot,
-                                                        uint32_t cx, uint32_t cy,
-                                                        const void *pvShape)
+DECLCALLBACK(int) Display::i_displayVBVAMousePointerShape(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha,
+                                                          uint32_t xHot, uint32_t yHot,
+                                                          uint32_t cx, uint32_t cy,
+                                                          const void *pvShape)
 {
     LogFlowFunc(("\n"));
 
     PDRVMAINDISPLAY pDrv = PDMIDISPLAYCONNECTOR_2_MAINDISPLAY(pInterface);
     Display *pThis = pDrv->pDisplay;
 
-    size_t cbShapeSize = 0;
-
+    uint32_t cbShape = 0;
     if (pvShape)
     {
-        cbShapeSize = (cx + 7) / 8 * cy; /* size of the AND mask */
-        cbShapeSize = ((cbShapeSize + 3) & ~3) + cx * 4 * cy; /* + gap + size of the XOR mask */
+        cbShape = (cx + 7) / 8 * cy; /* size of the AND mask */
+        cbShape = ((cbShape + 3) & ~3) + cx * 4 * cy; /* + gap + size of the XOR mask */
     }
-    com::SafeArray<BYTE> shapeData(cbShapeSize);
-
-    if (pvShape)
-        ::memcpy(shapeData.raw(), pvShape, cbShapeSize);
 
     /* Tell the console about it */
-    pDrv->pDisplay->mParent->onMousePointerShapeChange(fVisible, fAlpha,
-                                                       xHot, yHot, cx, cy, ComSafeArrayAsInParam(shapeData));
+    pDrv->pDisplay->mParent->i_onMousePointerShapeChange(fVisible, fAlpha,
+                                                         xHot, yHot, cx, cy, (uint8_t *)pvShape, cbShape);
 
     return VINF_SUCCESS;
 }
@@ -5222,7 +4052,7 @@ DECLCALLBACK(void) Display::i_displayVBVAInputMappingUpdate(PPDMIDISPLAYCONNECTO
 /**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
-DECLCALLBACK(void *)  Display::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+DECLCALLBACK(void *)  Display::i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
 {
     PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     PDRVMAINDISPLAY pDrv = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY);
@@ -5238,28 +4068,31 @@ DECLCALLBACK(void *)  Display::drvQueryInterface(PPDMIBASE pInterface, const cha
  * @returns VBox status.
  * @param   pDrvIns     The driver instance data.
  */
-DECLCALLBACK(void) Display::drvDestruct(PPDMDRVINS pDrvIns)
+DECLCALLBACK(void) Display::i_drvDestruct(PPDMDRVINS pDrvIns)
 {
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINDISPLAY pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY);
     LogRelFlowFunc(("iInstance=%d\n", pDrvIns->iInstance));
 
+    pThis->pUpPort->pfnSetRenderVRAM(pThis->pUpPort, false);
+
+    pThis->IConnector.pu8Data    = NULL;
+    pThis->IConnector.cbScanline = 0;
+    pThis->IConnector.cBits      = 32;
+    pThis->IConnector.cx         = 0;
+    pThis->IConnector.cy         = 0;
+
     if (pThis->pDisplay)
     {
         AutoWriteLock displayLock(pThis->pDisplay COMMA_LOCKVAL_SRC_POS);
 #ifdef VBOX_WITH_VPX
-        pThis->pDisplay->VideoCaptureStop();
+        pThis->pDisplay->i_VideoCaptureStop();
 #endif
 #ifdef VBOX_WITH_CRHGSMI
-        pThis->pDisplay->destructCrHgsmiData();
+        pThis->pDisplay->i_destructCrHgsmiData();
 #endif
         pThis->pDisplay->mpDrv = NULL;
         pThis->pDisplay->mpVMMDev = NULL;
-        pThis->pDisplay->mLastAddress = NULL;
-        pThis->pDisplay->mLastBytesPerLine = 0;
-        pThis->pDisplay->mLastBitsPerPixel = 0,
-        pThis->pDisplay->mLastWidth = 0;
-        pThis->pDisplay->mLastHeight = 0;
     }
 }
 
@@ -5269,7 +4102,7 @@ DECLCALLBACK(void) Display::drvDestruct(PPDMDRVINS pDrvIns)
  *
  * @copydoc FNPDMDRVCONSTRUCT
  */
-DECLCALLBACK(int) Display::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+DECLCALLBACK(int) Display::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
     PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINDISPLAY pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINDISPLAY);
@@ -5287,33 +4120,33 @@ DECLCALLBACK(int) Display::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint
     /*
      * Init Interfaces.
      */
-    pDrvIns->IBase.pfnQueryInterface           = Display::drvQueryInterface;
-
-    pThis->IConnector.pfnResize                = Display::displayResizeCallback;
-    pThis->IConnector.pfnUpdateRect            = Display::displayUpdateCallback;
-    pThis->IConnector.pfnRefresh               = Display::displayRefreshCallback;
-    pThis->IConnector.pfnReset                 = Display::displayResetCallback;
-    pThis->IConnector.pfnLFBModeChange         = Display::displayLFBModeChangeCallback;
-    pThis->IConnector.pfnProcessAdapterData    = Display::displayProcessAdapterDataCallback;
-    pThis->IConnector.pfnProcessDisplayData    = Display::displayProcessDisplayDataCallback;
+    pDrvIns->IBase.pfnQueryInterface           = Display::i_drvQueryInterface;
+
+    pThis->IConnector.pfnResize                = Display::i_displayResizeCallback;
+    pThis->IConnector.pfnUpdateRect            = Display::i_displayUpdateCallback;
+    pThis->IConnector.pfnRefresh               = Display::i_displayRefreshCallback;
+    pThis->IConnector.pfnReset                 = Display::i_displayResetCallback;
+    pThis->IConnector.pfnLFBModeChange         = Display::i_displayLFBModeChangeCallback;
+    pThis->IConnector.pfnProcessAdapterData    = Display::i_displayProcessAdapterDataCallback;
+    pThis->IConnector.pfnProcessDisplayData    = Display::i_displayProcessDisplayDataCallback;
 #ifdef VBOX_WITH_VIDEOHWACCEL
-    pThis->IConnector.pfnVHWACommandProcess    = Display::displayVHWACommandProcess;
+    pThis->IConnector.pfnVHWACommandProcess    = Display::i_displayVHWACommandProcess;
 #endif
 #ifdef VBOX_WITH_CRHGSMI
-    pThis->IConnector.pfnCrHgsmiCommandProcess = Display::displayCrHgsmiCommandProcess;
-    pThis->IConnector.pfnCrHgsmiControlProcess = Display::displayCrHgsmiControlProcess;
+    pThis->IConnector.pfnCrHgsmiCommandProcess = Display::i_displayCrHgsmiCommandProcess;
+    pThis->IConnector.pfnCrHgsmiControlProcess = Display::i_displayCrHgsmiControlProcess;
 #endif
 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)
-    pThis->IConnector.pfnCrHgcmCtlSubmit       = Display::displayCrHgcmCtlSubmit;
+    pThis->IConnector.pfnCrHgcmCtlSubmit       = Display::i_displayCrHgcmCtlSubmit;
 #endif
 #ifdef VBOX_WITH_HGSMI
-    pThis->IConnector.pfnVBVAEnable            = Display::displayVBVAEnable;
-    pThis->IConnector.pfnVBVADisable           = Display::displayVBVADisable;
-    pThis->IConnector.pfnVBVAUpdateBegin       = Display::displayVBVAUpdateBegin;
-    pThis->IConnector.pfnVBVAUpdateProcess     = Display::displayVBVAUpdateProcess;
-    pThis->IConnector.pfnVBVAUpdateEnd         = Display::displayVBVAUpdateEnd;
-    pThis->IConnector.pfnVBVAResize            = Display::displayVBVAResize;
-    pThis->IConnector.pfnVBVAMousePointerShape = Display::displayVBVAMousePointerShape;
+    pThis->IConnector.pfnVBVAEnable            = Display::i_displayVBVAEnable;
+    pThis->IConnector.pfnVBVADisable           = Display::i_displayVBVADisable;
+    pThis->IConnector.pfnVBVAUpdateBegin       = Display::i_displayVBVAUpdateBegin;
+    pThis->IConnector.pfnVBVAUpdateProcess     = Display::i_displayVBVAUpdateProcess;
+    pThis->IConnector.pfnVBVAUpdateEnd         = Display::i_displayVBVAUpdateEnd;
+    pThis->IConnector.pfnVBVAResize            = Display::i_displayVBVAResize;
+    pThis->IConnector.pfnVBVAMousePointerShape = Display::i_displayVBVAMousePointerShape;
     pThis->IConnector.pfnVBVAGuestCapabilityUpdate = Display::i_displayVBVAGuestCapabilityUpdate;
     pThis->IConnector.pfnVBVAInputMappingUpdate = Display::i_displayVBVAInputMappingUpdate;
 #endif
@@ -5348,10 +4181,10 @@ DECLCALLBACK(int) Display::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint
     Display *pDisplay = (Display *)pv;      /** @todo Check this cast! */
     pThis->pDisplay = pDisplay;
     pThis->pDisplay->mpDrv = pThis;
-    /*
-     * Update our display information according to the framebuffer
-     */
-    pDisplay->updateDisplayData();
+
+    /* Disable VRAM to a buffer copy initially. */
+    pThis->pUpPort->pfnSetRenderVRAM(pThis->pUpPort, false);
+    pThis->IConnector.cBits = 32; /* DevVGA does nothing otherwise. */
 
     /*
      * Start periodic screen refreshes
@@ -5359,18 +4192,18 @@ DECLCALLBACK(int) Display::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint
     pThis->pUpPort->pfnSetRefreshRate(pThis->pUpPort, 20);
 
 #ifdef VBOX_WITH_CRHGSMI
-    pDisplay->setupCrHgsmiData();
+    pDisplay->i_setupCrHgsmiData();
 #endif
 
 #ifdef VBOX_WITH_VPX
-    ComPtr<IMachine> pMachine = pDisplay->mParent->machine();
+    ComPtr<IMachine> pMachine = pDisplay->mParent->i_machine();
     BOOL fEnabled = false;
     HRESULT hrc = pMachine->COMGETTER(VideoCaptureEnabled)(&fEnabled);
     AssertComRCReturn(hrc, VERR_COM_UNEXPECTED);
     if (fEnabled)
     {
-        rc = pDisplay->VideoCaptureStart();
-        fireVideoCaptureChangedEvent(pDisplay->mParent->getEventSource());
+        rc = pDisplay->i_VideoCaptureStart();
+        fireVideoCaptureChangedEvent(pDisplay->mParent->i_getEventSource());
     }
 #endif
 
@@ -5402,9 +4235,9 @@ const PDMDRVREG Display::DrvReg =
     /* cbInstance */
     sizeof(DRVMAINDISPLAY),
     /* pfnConstruct */
-    Display::drvConstruct,
+    Display::i_drvConstruct,
     /* pfnDestruct */
-    Display::drvDestruct,
+    Display::i_drvDestruct,
     /* pfnRelocate */
     NULL,
     /* pfnIOCtl */
@@ -5428,4 +4261,5 @@ const PDMDRVREG Display::DrvReg =
     /* u32EndVersion */
     PDM_DRVREG_VERSION
 };
+
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-client/DisplayImplLegacy.cpp b/src/VBox/Main/src-client/DisplayImplLegacy.cpp
new file mode 100644
index 0000000..ee5a94c
--- /dev/null
+++ b/src/VBox/Main/src-client/DisplayImplLegacy.cpp
@@ -0,0 +1,1008 @@
+/* $Id: DisplayImplLegacy.cpp $ */
+/** @file
+ * VirtualBox IDisplay implementation
+ *
+ * Methods and helpers to support old guest additions 3.x or older.
+ * This is not used by the current guest additions.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "DisplayImpl.h"
+#include "ConsoleImpl.h"
+#include "ConsoleVRDPServer.h"
+#include "VMMDev.h"
+
+#include "Logging.h"
+
+/* generated header */
+#include "VBoxEvents.h"
+
+
+int videoAccelConstruct(VIDEOACCEL *pVideoAccel)
+{
+    pVideoAccel->pVbvaMemory = NULL;
+    pVideoAccel->fVideoAccelEnabled = false;
+
+    pVideoAccel->pu8VbvaPartial = NULL;
+    pVideoAccel->cbVbvaPartial = 0;
+
+    pVideoAccel->hXRoadsVideoAccel = NIL_RTSEMXROADS;
+    int rc = RTSemXRoadsCreate(&pVideoAccel->hXRoadsVideoAccel);
+    AssertRC(rc);
+
+    return rc;
+}
+
+void videoAccelDestroy(VIDEOACCEL *pVideoAccel)
+{
+    RTSemXRoadsDestroy(pVideoAccel->hXRoadsVideoAccel);
+    RT_ZERO(*pVideoAccel);
+}
+
+static unsigned mapCoordsToScreen(DISPLAYFBINFO *pInfos, unsigned cInfos, int *px, int *py, int *pw, int *ph)
+{
+    DISPLAYFBINFO *pInfo = pInfos;
+    unsigned uScreenId;
+    LogSunlover(("mapCoordsToScreen: %d,%d %dx%d\n", *px, *py, *pw, *ph));
+    for (uScreenId = 0; uScreenId < cInfos; uScreenId++, pInfo++)
+    {
+        LogSunlover(("    [%d] %d,%d %dx%d\n", uScreenId, pInfo->xOrigin, pInfo->yOrigin, pInfo->w, pInfo->h));
+        if (   (pInfo->xOrigin <= *px && *px < pInfo->xOrigin + (int)pInfo->w)
+            && (pInfo->yOrigin <= *py && *py < pInfo->yOrigin + (int)pInfo->h))
+        {
+            /* The rectangle belongs to the screen. Correct coordinates. */
+            *px -= pInfo->xOrigin;
+            *py -= pInfo->yOrigin;
+            LogSunlover(("    -> %d,%d", *px, *py));
+            break;
+        }
+    }
+    if (uScreenId == cInfos)
+    {
+        /* Map to primary screen. */
+        uScreenId = 0;
+    }
+    LogSunlover((" scr %d\n", uScreenId));
+    return uScreenId;
+}
+
+
+typedef struct _VBVADIRTYREGION
+{
+    /* Copies of object's pointers used by vbvaRgn functions. */
+    DISPLAYFBINFO    *paFramebuffers;
+    unsigned          cMonitors;
+    Display          *pDisplay;
+    PPDMIDISPLAYPORT  pPort;
+
+    /* The rectangle that includes all dirty rectangles. */
+    RTRECT aDirtyRects[SchemaDefs::MaxGuestMonitors];
+
+} VBVADIRTYREGION;
+
+static void vbvaRgnInit(VBVADIRTYREGION *prgn, DISPLAYFBINFO *paFramebuffers, unsigned cMonitors,
+                        Display *pd, PPDMIDISPLAYPORT pp)
+{
+    prgn->paFramebuffers = paFramebuffers;
+    prgn->cMonitors = cMonitors;
+    prgn->pDisplay = pd;
+    prgn->pPort = pp;
+
+    RT_ZERO(prgn->aDirtyRects);
+}
+
+static void vbvaRgnDirtyRect(VBVADIRTYREGION *prgn, unsigned uScreenId, VBVACMDHDR *phdr)
+{
+    LogSunlover(("x = %d, y = %d, w = %d, h = %d\n",
+                 phdr->x, phdr->y, phdr->w, phdr->h));
+
+    /*
+     * Here update rectangles are accumulated to form an update area.
+     * @todo
+     * Now the simplest method is used which builds one rectangle that
+     * includes all update areas. A bit more advanced method can be
+     * employed here. The method should be fast however.
+     */
+    if (phdr->w == 0 || phdr->h == 0)
+    {
+        /* Empty rectangle. */
+        return;
+    }
+
+    int32_t xRight  = phdr->x + phdr->w;
+    int32_t yBottom = phdr->y + phdr->h;
+
+    RTRECT *pDirtyRect = &prgn->aDirtyRects[uScreenId];
+    DISPLAYFBINFO *pFBInfo = &prgn->paFramebuffers[uScreenId];
+
+    if (pDirtyRect->xRight == 0)
+    {
+        /* This is the first rectangle to be added. */
+        pDirtyRect->xLeft   = phdr->x;
+        pDirtyRect->yTop    = phdr->y;
+        pDirtyRect->xRight  = xRight;
+        pDirtyRect->yBottom = yBottom;
+    }
+    else
+    {
+        /* Adjust region coordinates. */
+        if (pDirtyRect->xLeft > phdr->x)
+        {
+            pDirtyRect->xLeft = phdr->x;
+        }
+
+        if (pDirtyRect->yTop > phdr->y)
+        {
+            pDirtyRect->yTop = phdr->y;
+        }
+
+        if (pDirtyRect->xRight < xRight)
+        {
+            pDirtyRect->xRight = xRight;
+        }
+
+        if (pDirtyRect->yBottom < yBottom)
+        {
+            pDirtyRect->yBottom = yBottom;
+        }
+    }
+
+    if (pFBInfo->fDefaultFormat)
+    {
+        //@todo pfnUpdateDisplayRect must take the vram offset parameter for the framebuffer
+        prgn->pPort->pfnUpdateDisplayRect(prgn->pPort, phdr->x, phdr->y, phdr->w, phdr->h);
+        prgn->pDisplay->i_handleDisplayUpdate(uScreenId, phdr->x, phdr->y, phdr->w, phdr->h);
+    }
+
+    return;
+}
+
+static void vbvaRgnUpdateFramebuffer(VBVADIRTYREGION *prgn, unsigned uScreenId)
+{
+    RTRECT *pDirtyRect = &prgn->aDirtyRects[uScreenId];
+    DISPLAYFBINFO *pFBInfo = &prgn->paFramebuffers[uScreenId];
+
+    uint32_t w = pDirtyRect->xRight - pDirtyRect->xLeft;
+    uint32_t h = pDirtyRect->yBottom - pDirtyRect->yTop;
+
+    if (!pFBInfo->fDefaultFormat && w != 0 && h != 0)
+    {
+        //@todo pfnUpdateDisplayRect must take the vram offset parameter for the framebuffer
+        prgn->pPort->pfnUpdateDisplayRect(prgn->pPort, pDirtyRect->xLeft, pDirtyRect->yTop, w, h);
+        prgn->pDisplay->i_handleDisplayUpdate(uScreenId, pDirtyRect->xLeft, pDirtyRect->yTop, w, h);
+    }
+}
+
+void i_vbvaSetMemoryFlags(VBVAMEMORY *pVbvaMemory,
+                          bool fVideoAccelEnabled,
+                          bool fVideoAccelVRDP,
+                          uint32_t fu32SupportedOrders,
+                          DISPLAYFBINFO *paFBInfos,
+                          unsigned cFBInfos)
+{
+    if (pVbvaMemory)
+    {
+        /* This called only on changes in mode. So reset VRDP always. */
+        uint32_t fu32Flags = VBVA_F_MODE_VRDP_RESET;
+
+        if (fVideoAccelEnabled)
+        {
+            fu32Flags |= VBVA_F_MODE_ENABLED;
+
+            if (fVideoAccelVRDP)
+            {
+                fu32Flags |= VBVA_F_MODE_VRDP | VBVA_F_MODE_VRDP_ORDER_MASK;
+
+                pVbvaMemory->fu32SupportedOrders = fu32SupportedOrders;
+            }
+        }
+
+        pVbvaMemory->fu32ModeFlags = fu32Flags;
+    }
+
+    unsigned uScreenId;
+    for (uScreenId = 0; uScreenId < cFBInfos; uScreenId++)
+    {
+        if (paFBInfos[uScreenId].pHostEvents)
+        {
+            paFBInfos[uScreenId].pHostEvents->fu32Events |= VBOX_VIDEO_INFO_HOST_EVENTS_F_VRDP_RESET;
+        }
+    }
+}
+
+bool Display::i_VideoAccelAllowed(void)
+{
+    return true;
+}
+
+int videoAccelEnterVGA(VIDEOACCEL *pVideoAccel)
+{
+    return RTSemXRoadsNSEnter(pVideoAccel->hXRoadsVideoAccel);
+}
+
+void videoAccelLeaveVGA(VIDEOACCEL *pVideoAccel)
+{
+    RTSemXRoadsNSLeave(pVideoAccel->hXRoadsVideoAccel);
+}
+
+int videoAccelEnterVMMDev(VIDEOACCEL *pVideoAccel)
+{
+    return RTSemXRoadsEWEnter(pVideoAccel->hXRoadsVideoAccel);
+}
+
+void videoAccelLeaveVMMDev(VIDEOACCEL *pVideoAccel)
+{
+    RTSemXRoadsEWLeave(pVideoAccel->hXRoadsVideoAccel);
+}
+
+/**
+ * @thread EMT
+ */
+int Display::i_VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort)
+{
+    int rc;
+    LogRelFlowFunc(("fEnable = %d\n", fEnable));
+
+    rc = i_videoAccelEnable(fEnable, pVbvaMemory, pUpPort);
+
+    LogRelFlowFunc(("%Rrc.\n", rc));
+    return rc;
+}
+
+int Display::i_videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory, PPDMIDISPLAYPORT pUpPort)
+{
+    int rc = VINF_SUCCESS;
+
+    VIDEOACCEL *pVideoAccel = &mVideoAccelLegacy;
+
+    /* Called each time the guest wants to use acceleration,
+     * or when the VGA device disables acceleration,
+     * or when restoring the saved state with accel enabled.
+     *
+     * VGA device disables acceleration on each video mode change
+     * and on reset.
+     *
+     * Guest enabled acceleration at will. And it has to enable
+     * acceleration after a mode change.
+     */
+    LogRelFlowFunc(("mfVideoAccelEnabled = %d, fEnable = %d, pVbvaMemory = %p\n",
+                  pVideoAccel->fVideoAccelEnabled, fEnable, pVbvaMemory));
+
+    /* Strictly check parameters. Callers must not pass anything in the case. */
+    Assert((fEnable && pVbvaMemory) || (!fEnable && pVbvaMemory == NULL));
+
+    if (!i_VideoAccelAllowed ())
+        return VERR_NOT_SUPPORTED;
+
+    /* Check that current status is not being changed */
+    if (pVideoAccel->fVideoAccelEnabled == fEnable)
+        return rc;
+
+    if (pVideoAccel->fVideoAccelEnabled)
+    {
+        /* Process any pending orders and empty the VBVA ring buffer. */
+        i_videoAccelFlush (pUpPort);
+    }
+
+    if (!fEnable && pVideoAccel->pVbvaMemory)
+        pVideoAccel->pVbvaMemory->fu32ModeFlags &= ~VBVA_F_MODE_ENABLED;
+
+    if (fEnable)
+    {
+        /* Process any pending VGA device changes, resize. */
+        pUpPort->pfnUpdateDisplayAll(pUpPort, /* fFailOnResize = */ false);
+    }
+
+    /* Protect the videoaccel state transition. */
+    RTCritSectEnter(&mVideoAccelLock);
+
+    if (fEnable)
+    {
+        /* Initialize the hardware memory. */
+        i_vbvaSetMemoryFlags(pVbvaMemory, true, mfVideoAccelVRDP,
+                             mfu32SupportedOrders, maFramebuffers, mcMonitors);
+        pVbvaMemory->off32Data = 0;
+        pVbvaMemory->off32Free = 0;
+
+        memset(pVbvaMemory->aRecords, 0, sizeof(pVbvaMemory->aRecords));
+        pVbvaMemory->indexRecordFirst = 0;
+        pVbvaMemory->indexRecordFree = 0;
+
+        pVideoAccel->pVbvaMemory = pVbvaMemory;
+        pVideoAccel->fVideoAccelEnabled = true;
+
+        LogRel(("VBVA: Enabled.\n"));
+    }
+    else
+    {
+        pVideoAccel->pVbvaMemory = NULL;
+        pVideoAccel->fVideoAccelEnabled = false;
+
+        LogRel(("VBVA: Disabled.\n"));
+    }
+
+    RTCritSectLeave(&mVideoAccelLock);
+
+    if (!fEnable)
+    {
+        pUpPort->pfnUpdateDisplayAll(pUpPort, /* fFailOnResize = */ false);
+    }
+
+    /* Notify the VMMDev, which saves VBVA status in the saved state,
+     * and needs to know current status.
+     */
+    VMMDev *pVMMDev = mParent->i_getVMMDev();
+    if (pVMMDev)
+    {
+        PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
+        if (pVMMDevPort)
+            pVMMDevPort->pfnVBVAChange(pVMMDevPort, fEnable);
+    }
+
+    LogRelFlowFunc(("%Rrc.\n", rc));
+    return rc;
+}
+
+static bool i_vbvaVerifyRingBuffer(VBVAMEMORY *pVbvaMemory)
+{
+    return true;
+}
+
+static void i_vbvaFetchBytes(VBVAMEMORY *pVbvaMemory, uint8_t *pu8Dst, uint32_t cbDst)
+{
+    if (cbDst >= VBVA_RING_BUFFER_SIZE)
+    {
+        AssertMsgFailed(("cbDst = 0x%08X, ring buffer size 0x%08X\n", cbDst, VBVA_RING_BUFFER_SIZE));
+        return;
+    }
+
+    uint32_t u32BytesTillBoundary = VBVA_RING_BUFFER_SIZE - pVbvaMemory->off32Data;
+    uint8_t  *src                 = &pVbvaMemory->au8RingBuffer[pVbvaMemory->off32Data];
+    int32_t i32Diff               = cbDst - u32BytesTillBoundary;
+
+    if (i32Diff <= 0)
+    {
+        /* Chunk will not cross buffer boundary. */
+        memcpy (pu8Dst, src, cbDst);
+    }
+    else
+    {
+        /* Chunk crosses buffer boundary. */
+        memcpy(pu8Dst, src, u32BytesTillBoundary);
+        memcpy(pu8Dst + u32BytesTillBoundary, &pVbvaMemory->au8RingBuffer[0], i32Diff);
+    }
+
+    /* Advance data offset. */
+    pVbvaMemory->off32Data = (pVbvaMemory->off32Data + cbDst) % VBVA_RING_BUFFER_SIZE;
+
+    return;
+}
+
+
+static bool i_vbvaPartialRead(uint8_t **ppu8, uint32_t *pcb, uint32_t cbRecord, VBVAMEMORY *pVbvaMemory)
+{
+    uint8_t *pu8New;
+
+    LogFlow(("MAIN::DisplayImpl::vbvaPartialRead: p = %p, cb = %d, cbRecord 0x%08X\n",
+             *ppu8, *pcb, cbRecord));
+
+    if (*ppu8)
+    {
+        Assert (*pcb);
+        pu8New = (uint8_t *)RTMemRealloc(*ppu8, cbRecord);
+    }
+    else
+    {
+        Assert (!*pcb);
+        pu8New = (uint8_t *)RTMemAlloc(cbRecord);
+    }
+
+    if (!pu8New)
+    {
+        /* Memory allocation failed, fail the function. */
+        Log(("MAIN::vbvaPartialRead: failed to (re)alocate memory for partial record!!! cbRecord 0x%08X\n",
+             cbRecord));
+
+        if (*ppu8)
+        {
+            RTMemFree(*ppu8);
+        }
+
+        *ppu8 = NULL;
+        *pcb = 0;
+
+        return false;
+    }
+
+    /* Fetch data from the ring buffer. */
+    i_vbvaFetchBytes(pVbvaMemory, pu8New + *pcb, cbRecord - *pcb);
+
+    *ppu8 = pu8New;
+    *pcb = cbRecord;
+
+    return true;
+}
+
+/* For contiguous chunks just return the address in the buffer.
+ * For crossing boundary - allocate a buffer from heap.
+ */
+static bool i_vbvaFetchCmd(VIDEOACCEL *pVideoAccel, VBVACMDHDR **ppHdr, uint32_t *pcbCmd)
+{
+    VBVAMEMORY *pVbvaMemory = pVideoAccel->pVbvaMemory;
+
+    uint32_t indexRecordFirst = pVbvaMemory->indexRecordFirst;
+    uint32_t indexRecordFree = pVbvaMemory->indexRecordFree;
+
+#ifdef DEBUG_sunlover
+    LogFlowFunc(("first = %d, free = %d\n",
+                 indexRecordFirst, indexRecordFree));
+#endif /* DEBUG_sunlover */
+
+    if (!i_vbvaVerifyRingBuffer(pVbvaMemory))
+    {
+        return false;
+    }
+
+    if (indexRecordFirst == indexRecordFree)
+    {
+        /* No records to process. Return without assigning output variables. */
+        return true;
+    }
+
+    uint32_t cbRecordCurrent = ASMAtomicReadU32(&pVbvaMemory->aRecords[indexRecordFirst].cbRecord);
+
+#ifdef DEBUG_sunlover
+    LogFlowFunc(("cbRecord = 0x%08X\n", cbRecordCurrent));
+#endif /* DEBUG_sunlover */
+
+    uint32_t cbRecord = cbRecordCurrent & ~VBVA_F_RECORD_PARTIAL;
+
+    if (pVideoAccel->cbVbvaPartial)
+    {
+        /* There is a partial read in process. Continue with it. */
+
+        Assert(pVideoAccel->pu8VbvaPartial);
+
+        LogFlowFunc(("continue partial record cbVbvaPartial = %d cbRecord 0x%08X, first = %d, free = %d\n",
+                      pVideoAccel->cbVbvaPartial, cbRecordCurrent, indexRecordFirst, indexRecordFree));
+
+        if (cbRecord > pVideoAccel->cbVbvaPartial)
+        {
+            /* New data has been added to the record. */
+            if (!i_vbvaPartialRead(&pVideoAccel->pu8VbvaPartial, &pVideoAccel->cbVbvaPartial, cbRecord, pVbvaMemory))
+            {
+                return false;
+            }
+        }
+
+        if (!(cbRecordCurrent & VBVA_F_RECORD_PARTIAL))
+        {
+            /* The record is completed by guest. Return it to the caller. */
+            *ppHdr = (VBVACMDHDR *)pVideoAccel->pu8VbvaPartial;
+            *pcbCmd = pVideoAccel->cbVbvaPartial;
+
+            pVideoAccel->pu8VbvaPartial = NULL;
+            pVideoAccel->cbVbvaPartial = 0;
+
+            /* Advance the record index. */
+            pVbvaMemory->indexRecordFirst = (indexRecordFirst + 1) % VBVA_MAX_RECORDS;
+
+#ifdef DEBUG_sunlover
+            LogFlowFunc(("partial done ok, data = %d, free = %d\n",
+                         pVbvaMemory->off32Data, pVbvaMemory->off32Free));
+#endif /* DEBUG_sunlover */
+        }
+
+        return true;
+    }
+
+    /* A new record need to be processed. */
+    if (cbRecordCurrent & VBVA_F_RECORD_PARTIAL)
+    {
+        /* Current record is being written by guest. '=' is important here. */
+        if (cbRecord >= VBVA_RING_BUFFER_SIZE - VBVA_RING_BUFFER_THRESHOLD)
+        {
+            /* Partial read must be started. */
+            if (!i_vbvaPartialRead(&pVideoAccel->pu8VbvaPartial, &pVideoAccel->cbVbvaPartial, cbRecord, pVbvaMemory))
+            {
+                return false;
+            }
+
+            LogFlowFunc(("started partial record cbVbvaPartial = 0x%08X cbRecord 0x%08X, first = %d, free = %d\n",
+                          pVideoAccel->cbVbvaPartial, cbRecordCurrent, indexRecordFirst, indexRecordFree));
+        }
+
+        return true;
+    }
+
+    /* Current record is complete. If it is not empty, process it. */
+    if (cbRecord)
+    {
+        /* The size of largest contiguous chunk in the ring biffer. */
+        uint32_t u32BytesTillBoundary = VBVA_RING_BUFFER_SIZE - pVbvaMemory->off32Data;
+
+        /* The ring buffer pointer. */
+        uint8_t *au8RingBuffer = &pVbvaMemory->au8RingBuffer[0];
+
+        /* The pointer to data in the ring buffer. */
+        uint8_t *src = &au8RingBuffer[pVbvaMemory->off32Data];
+
+        /* Fetch or point the data. */
+        if (u32BytesTillBoundary >= cbRecord)
+        {
+            /* The command does not cross buffer boundary. Return address in the buffer. */
+            *ppHdr = (VBVACMDHDR *)src;
+
+            /* Advance data offset. */
+            pVbvaMemory->off32Data = (pVbvaMemory->off32Data + cbRecord) % VBVA_RING_BUFFER_SIZE;
+        }
+        else
+        {
+            /* The command crosses buffer boundary. Rare case, so not optimized. */
+            uint8_t *dst = (uint8_t *)RTMemAlloc(cbRecord);
+
+            if (!dst)
+            {
+                LogRelFlowFunc(("could not allocate %d bytes from heap!!!\n", cbRecord));
+                pVbvaMemory->off32Data = (pVbvaMemory->off32Data + cbRecord) % VBVA_RING_BUFFER_SIZE;
+                return false;
+            }
+
+            i_vbvaFetchBytes(pVbvaMemory, dst, cbRecord);
+
+            *ppHdr = (VBVACMDHDR *)dst;
+
+#ifdef DEBUG_sunlover
+            LogFlowFunc(("Allocated from heap %p\n", dst));
+#endif /* DEBUG_sunlover */
+        }
+    }
+
+    *pcbCmd = cbRecord;
+
+    /* Advance the record index. */
+    pVbvaMemory->indexRecordFirst = (indexRecordFirst + 1) % VBVA_MAX_RECORDS;
+
+#ifdef DEBUG_sunlover
+    LogFlowFunc(("done ok, data = %d, free = %d\n",
+                 pVbvaMemory->off32Data, pVbvaMemory->off32Free));
+#endif /* DEBUG_sunlover */
+
+    return true;
+}
+
+static void i_vbvaReleaseCmd(VIDEOACCEL *pVideoAccel, VBVACMDHDR *pHdr, int32_t cbCmd)
+{
+    uint8_t *au8RingBuffer = pVideoAccel->pVbvaMemory->au8RingBuffer;
+
+    if (   (uint8_t *)pHdr >= au8RingBuffer
+        && (uint8_t *)pHdr < &au8RingBuffer[VBVA_RING_BUFFER_SIZE])
+    {
+        /* The pointer is inside ring buffer. Must be continuous chunk. */
+        Assert(VBVA_RING_BUFFER_SIZE - ((uint8_t *)pHdr - au8RingBuffer) >= cbCmd);
+
+        /* Do nothing. */
+
+        Assert(!pVideoAccel->pu8VbvaPartial && pVideoAccel->cbVbvaPartial == 0);
+    }
+    else
+    {
+        /* The pointer is outside. It is then an allocated copy. */
+
+#ifdef DEBUG_sunlover
+        LogFlowFunc(("Free heap %p\n", pHdr));
+#endif /* DEBUG_sunlover */
+
+        if ((uint8_t *)pHdr == pVideoAccel->pu8VbvaPartial)
+        {
+            pVideoAccel->pu8VbvaPartial = NULL;
+            pVideoAccel->cbVbvaPartial = 0;
+        }
+        else
+        {
+            Assert(!pVideoAccel->pu8VbvaPartial && pVideoAccel->cbVbvaPartial == 0);
+        }
+
+        RTMemFree(pHdr);
+    }
+
+    return;
+}
+
+
+/**
+ * Called regularly on the DisplayRefresh timer.
+ * Also on behalf of guest, when the ring buffer is full.
+ *
+ * @thread EMT
+ */
+void Display::i_VideoAccelFlush(PPDMIDISPLAYPORT pUpPort)
+{
+    int rc = i_videoAccelFlush(pUpPort);
+    if (RT_FAILURE(rc))
+    {
+        /* Disable on errors. */
+        i_videoAccelEnable(false, NULL, pUpPort);
+    }
+}
+
+int Display::i_videoAccelFlush(PPDMIDISPLAYPORT pUpPort)
+{
+    VIDEOACCEL *pVideoAccel = &mVideoAccelLegacy;
+    VBVAMEMORY *pVbvaMemory = pVideoAccel->pVbvaMemory;
+
+#ifdef DEBUG_sunlover_2
+    LogFlowFunc(("fVideoAccelEnabled = %d\n", pVideoAccel->fVideoAccelEnabled));
+#endif /* DEBUG_sunlover_2 */
+
+    if (!pVideoAccel->fVideoAccelEnabled)
+    {
+        Log(("Display::VideoAccelFlush: called with disabled VBVA!!! Ignoring.\n"));
+        return VINF_SUCCESS;
+    }
+
+    /* Here VBVA is enabled and we have the accelerator memory pointer. */
+    Assert(pVbvaMemory);
+
+#ifdef DEBUG_sunlover_2
+    LogFlowFunc(("indexRecordFirst = %d, indexRecordFree = %d, off32Data = %d, off32Free = %d\n",
+                  pVbvaMemory->indexRecordFirst, pVbvaMemory->indexRecordFree,
+                  pVbvaMemory->off32Data, pVbvaMemory->off32Free));
+#endif /* DEBUG_sunlover_2 */
+
+    /* Quick check for "nothing to update" case. */
+    if (pVbvaMemory->indexRecordFirst == pVbvaMemory->indexRecordFree)
+    {
+        return VINF_SUCCESS;
+    }
+
+    /* Process the ring buffer */
+    unsigned uScreenId;
+
+    /* Initialize dirty rectangles accumulator. */
+    VBVADIRTYREGION rgn;
+    vbvaRgnInit(&rgn, maFramebuffers, mcMonitors, this, pUpPort);
+
+    for (;;)
+    {
+        VBVACMDHDR *phdr = NULL;
+        uint32_t cbCmd = ~0;
+
+        /* Fetch the command data. */
+        if (!i_vbvaFetchCmd(pVideoAccel, &phdr, &cbCmd))
+        {
+            Log(("Display::VideoAccelFlush: unable to fetch command. off32Data = %d, off32Free = %d. Disabling VBVA!!!\n",
+                  pVbvaMemory->off32Data, pVbvaMemory->off32Free));
+            return VERR_INVALID_STATE;
+        }
+
+        if (cbCmd == uint32_t(~0))
+        {
+            /* No more commands yet in the queue. */
+#ifdef DEBUG_sunlover
+            LogFlowFunc(("no command\n"));
+#endif /* DEBUG_sunlover */
+            break;
+        }
+
+        if (cbCmd != 0)
+        {
+#ifdef DEBUG_sunlover
+            LogFlowFunc(("hdr: cbCmd = %d, x=%d, y=%d, w=%d, h=%d\n",
+                         cbCmd, phdr->x, phdr->y, phdr->w, phdr->h));
+#endif /* DEBUG_sunlover */
+
+            VBVACMDHDR hdrSaved = *phdr;
+
+            int x = phdr->x;
+            int y = phdr->y;
+            int w = phdr->w;
+            int h = phdr->h;
+
+            uScreenId = mapCoordsToScreen(maFramebuffers, mcMonitors, &x, &y, &w, &h);
+
+            phdr->x = (int16_t)x;
+            phdr->y = (int16_t)y;
+            phdr->w = (uint16_t)w;
+            phdr->h = (uint16_t)h;
+
+            DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
+
+            /* Handle the command.
+             *
+             * Guest is responsible for updating the guest video memory.
+             * The Windows guest does all drawing using Eng*.
+             *
+             * For local output, only dirty rectangle information is used
+             * to update changed areas.
+             *
+             * Dirty rectangles are accumulated to exclude overlapping updates and
+             * group small updates to a larger one.
+             */
+
+            /* Accumulate the update. */
+            vbvaRgnDirtyRect(&rgn, uScreenId, phdr);
+
+            /* Forward the command to VRDP server. */
+            mParent->i_consoleVRDPServer()->SendUpdate(uScreenId, phdr, cbCmd);
+
+            *phdr = hdrSaved;
+        }
+
+        i_vbvaReleaseCmd(pVideoAccel, phdr, cbCmd);
+    }
+
+    for (uScreenId = 0; uScreenId < mcMonitors; uScreenId++)
+    {
+        /* Draw the framebuffer. */
+        vbvaRgnUpdateFramebuffer(&rgn, uScreenId);
+    }
+    return VINF_SUCCESS;
+}
+
+int Display::i_videoAccelRefreshProcess(PPDMIDISPLAYPORT pUpPort)
+{
+    int rc = VWRN_INVALID_STATE; /* Default is to do a display update in VGA device. */
+
+    VIDEOACCEL *pVideoAccel = &mVideoAccelLegacy;
+
+    videoAccelEnterVGA(pVideoAccel);
+
+    if (pVideoAccel->fVideoAccelEnabled)
+    {
+        Assert(pVideoAccel->pVbvaMemory);
+        rc = i_videoAccelFlush(pUpPort);
+        if (RT_FAILURE(rc))
+        {
+            /* Disable on errors. */
+            i_videoAccelEnable(false, NULL, pUpPort);
+            rc = VWRN_INVALID_STATE; /* Do a display update in VGA device. */
+        }
+        else
+        {
+            rc = VINF_SUCCESS;
+        }
+    }
+
+    videoAccelLeaveVGA(pVideoAccel);
+
+    return rc;
+}
+
+void Display::processAdapterData(void *pvVRAM, uint32_t u32VRAMSize)
+{
+    if (pvVRAM == NULL)
+    {
+        unsigned i;
+        for (i = 0; i < mcMonitors; i++)
+        {
+            DISPLAYFBINFO *pFBInfo = &maFramebuffers[i];
+
+            pFBInfo->u32Offset = 0;
+            pFBInfo->u32MaxFramebufferSize = 0;
+            pFBInfo->u32InformationSize = 0;
+        }
+    }
+#ifndef VBOX_WITH_HGSMI
+    else
+    {
+         uint8_t *pu8 = (uint8_t *)pvVRAM;
+         pu8 += u32VRAMSize - VBOX_VIDEO_ADAPTER_INFORMATION_SIZE;
+
+         // @todo
+         uint8_t *pu8End = pu8 + VBOX_VIDEO_ADAPTER_INFORMATION_SIZE;
+
+         VBOXVIDEOINFOHDR *pHdr;
+
+         for (;;)
+         {
+             pHdr = (VBOXVIDEOINFOHDR *)pu8;
+             pu8 += sizeof(VBOXVIDEOINFOHDR);
+
+             if (pu8 >= pu8End)
+             {
+                 LogRel(("VBoxVideo: Guest adapter information overflow!!!\n"));
+                 break;
+             }
+
+             if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_DISPLAY)
+             {
+                 if (pHdr->u16Length != sizeof(VBOXVIDEOINFODISPLAY))
+                 {
+                     LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "DISPLAY", pHdr->u16Length));
+                     break;
+                 }
+
+                 VBOXVIDEOINFODISPLAY *pDisplay = (VBOXVIDEOINFODISPLAY *)pu8;
+
+                 if (pDisplay->u32Index >= mcMonitors)
+                 {
+                     LogRel(("VBoxVideo: Guest adapter information invalid display index %d!!!\n", pDisplay->u32Index));
+                     break;
+                 }
+
+                 DISPLAYFBINFO *pFBInfo = &maFramebuffers[pDisplay->u32Index];
+
+                 pFBInfo->u32Offset = pDisplay->u32Offset;
+                 pFBInfo->u32MaxFramebufferSize = pDisplay->u32FramebufferSize;
+                 pFBInfo->u32InformationSize = pDisplay->u32InformationSize;
+
+                 LogRelFlow(("VBOX_VIDEO_INFO_TYPE_DISPLAY: %d: at 0x%08X, size 0x%08X, info 0x%08X\n", pDisplay->u32Index,
+                             pDisplay->u32Offset, pDisplay->u32FramebufferSize, pDisplay->u32InformationSize));
+             }
+             else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_QUERY_CONF32)
+             {
+                 if (pHdr->u16Length != sizeof(VBOXVIDEOINFOQUERYCONF32))
+                 {
+                     LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "CONF32", pHdr->u16Length));
+                     break;
+                 }
+
+                 VBOXVIDEOINFOQUERYCONF32 *pConf32 = (VBOXVIDEOINFOQUERYCONF32 *)pu8;
+
+                 switch (pConf32->u32Index)
+                 {
+                     case VBOX_VIDEO_QCI32_MONITOR_COUNT:
+                     {
+                         pConf32->u32Value = mcMonitors;
+                     } break;
+
+                     case VBOX_VIDEO_QCI32_OFFSCREEN_HEAP_SIZE:
+                     {
+                         /* @todo make configurable. */
+                         pConf32->u32Value = _1M;
+                     } break;
+
+                     default:
+                         LogRel(("VBoxVideo: CONF32 %d not supported!!! Skipping.\n", pConf32->u32Index));
+                 }
+             }
+             else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_END)
+             {
+                 if (pHdr->u16Length != 0)
+                 {
+                     LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "END", pHdr->u16Length));
+                     break;
+                 }
+
+                 break;
+             }
+             else if (pHdr->u8Type != VBOX_VIDEO_INFO_TYPE_NV_HEAP)
+             {
+                 /** @todo why is Additions/WINNT/Graphics/Miniport/VBoxVideo. cpp pushing this to us? */
+                 LogRel(("Guest adapter information contains unsupported type %d. The block has been skipped.\n", pHdr->u8Type));
+             }
+
+             pu8 += pHdr->u16Length;
+         }
+    }
+#endif /* !VBOX_WITH_HGSMI */
+}
+
+void Display::processDisplayData(void *pvVRAM, unsigned uScreenId)
+{
+    if (uScreenId >= mcMonitors)
+    {
+        LogRel(("VBoxVideo: Guest display information invalid display index %d!!!\n", uScreenId));
+        return;
+    }
+
+    /* Get the display information structure. */
+    DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId];
+
+    uint8_t *pu8 = (uint8_t *)pvVRAM;
+    pu8 += pFBInfo->u32Offset + pFBInfo->u32MaxFramebufferSize;
+
+    // @todo
+    uint8_t *pu8End = pu8 + pFBInfo->u32InformationSize;
+
+    VBOXVIDEOINFOHDR *pHdr;
+
+    for (;;)
+    {
+        pHdr = (VBOXVIDEOINFOHDR *)pu8;
+        pu8 += sizeof(VBOXVIDEOINFOHDR);
+
+        if (pu8 >= pu8End)
+        {
+            LogRel(("VBoxVideo: Guest display information overflow!!!\n"));
+            break;
+        }
+
+        if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_SCREEN)
+        {
+            if (pHdr->u16Length != sizeof(VBOXVIDEOINFOSCREEN))
+            {
+                LogRel(("VBoxVideo: Guest display information %s invalid length %d!!!\n", "SCREEN", pHdr->u16Length));
+                break;
+            }
+
+            VBOXVIDEOINFOSCREEN *pScreen = (VBOXVIDEOINFOSCREEN *)pu8;
+
+            pFBInfo->xOrigin = pScreen->xOrigin;
+            pFBInfo->yOrigin = pScreen->yOrigin;
+
+            pFBInfo->w = pScreen->u16Width;
+            pFBInfo->h = pScreen->u16Height;
+
+            LogRelFlow(("VBOX_VIDEO_INFO_TYPE_SCREEN: (%p) %d: at %d,%d, linesize 0x%X, size %dx%d, bpp %d, flags 0x%02X\n",
+                     pHdr, uScreenId, pScreen->xOrigin, pScreen->yOrigin, pScreen->u32LineSize, pScreen->u16Width,
+                     pScreen->u16Height, pScreen->bitsPerPixel, pScreen->u8Flags));
+
+            if (uScreenId != VBOX_VIDEO_PRIMARY_SCREEN)
+            {
+                /* Primary screen resize is eeeeeeeee by the VGA device. */
+                if (pFBInfo->fDisabled)
+                {
+                    pFBInfo->fDisabled = false;
+                    fireGuestMonitorChangedEvent(mParent->i_getEventSource(),
+                                                 GuestMonitorChangedEventType_Enabled,
+                                                 uScreenId,
+                                                 pFBInfo->xOrigin, pFBInfo->yOrigin,
+                                                 pFBInfo->w, pFBInfo->h);
+                }
+
+                i_handleDisplayResize(uScreenId, pScreen->bitsPerPixel,
+                                                      (uint8_t *)pvVRAM + pFBInfo->u32Offset,
+                                                      pScreen->u32LineSize,
+                                                      pScreen->u16Width, pScreen->u16Height,
+                                                      VBVA_SCREEN_F_ACTIVE);
+            }
+        }
+        else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_END)
+        {
+            if (pHdr->u16Length != 0)
+            {
+                LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "END", pHdr->u16Length));
+                break;
+            }
+
+            break;
+        }
+        else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_HOST_EVENTS)
+        {
+            if (pHdr->u16Length != sizeof(VBOXVIDEOINFOHOSTEVENTS))
+            {
+                LogRel(("VBoxVideo: Guest display information %s invalid length %d!!!\n", "HOST_EVENTS", pHdr->u16Length));
+                break;
+            }
+
+            VBOXVIDEOINFOHOSTEVENTS *pHostEvents = (VBOXVIDEOINFOHOSTEVENTS *)pu8;
+
+            pFBInfo->pHostEvents = pHostEvents;
+
+            LogFlow(("VBOX_VIDEO_INFO_TYPE_HOSTEVENTS: (%p)\n",
+                     pHostEvents));
+        }
+        else if (pHdr->u8Type == VBOX_VIDEO_INFO_TYPE_LINK)
+        {
+            if (pHdr->u16Length != sizeof(VBOXVIDEOINFOLINK))
+            {
+                LogRel(("VBoxVideo: Guest adapter information %s invalid length %d!!!\n", "LINK", pHdr->u16Length));
+                break;
+            }
+
+            VBOXVIDEOINFOLINK *pLink = (VBOXVIDEOINFOLINK *)pu8;
+            pu8 += pLink->i32Offset;
+        }
+        else
+        {
+            LogRel(("Guest display information contains unsupported type %d\n", pHdr->u8Type));
+        }
+
+        pu8 += pHdr->u16Length;
+    }
+}
+
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-client/DisplaySourceBitmapImpl.cpp b/src/VBox/Main/src-client/DisplaySourceBitmapImpl.cpp
new file mode 100644
index 0000000..cf4734a
--- /dev/null
+++ b/src/VBox/Main/src-client/DisplaySourceBitmapImpl.cpp
@@ -0,0 +1,185 @@
+/* $Id: DisplaySourceBitmapImpl.cpp $ */
+/** @file
+ *
+ * Bitmap of a guest screen implementation.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "DisplayImpl.h"
+#include "Logging.h"
+
+/*
+ * DisplaySourceBitmap implementation.
+ */
+DEFINE_EMPTY_CTOR_DTOR(DisplaySourceBitmap)
+
+HRESULT DisplaySourceBitmap::FinalConstruct()
+{
+    return BaseFinalConstruct();
+}
+
+void DisplaySourceBitmap::FinalRelease()
+{
+    uninit();
+
+    BaseFinalRelease();
+}
+
+HRESULT DisplaySourceBitmap::init(ComObjPtr<Display> pDisplay, unsigned uScreenId, DISPLAYFBINFO *pFBInfo)
+{
+    LogFlowThisFunc(("[%u]\n", uScreenId));
+
+    ComAssertRet(!pDisplay.isNull(), E_INVALIDARG);
+
+    /* Enclose the state transition NotReady->InInit->Ready */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+
+    m.pDisplay = pDisplay;
+    m.uScreenId = uScreenId;
+    m.pFBInfo = pFBInfo;
+
+    m.pu8Allocated = NULL;
+
+    m.pu8Address = NULL;
+    m.ulWidth = 0;
+    m.ulHeight = 0;
+    m.ulBitsPerPixel = 0;
+    m.ulBytesPerLine = 0;
+    m.bitmapFormat = BitmapFormat_Opaque;
+
+    int rc = initSourceBitmap(uScreenId, pFBInfo);
+
+    if (RT_FAILURE(rc))
+        return E_FAIL;
+
+    /* Confirm a successful initialization */
+    autoInitSpan.setSucceeded();
+
+    return S_OK;
+}
+
+void DisplaySourceBitmap::uninit()
+{
+    /* Enclose the state transition Ready->InUninit->NotReady */
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
+
+    LogFlowThisFunc(("[%u]\n", m.uScreenId));
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    m.pDisplay.setNull();
+    RTMemFree(m.pu8Allocated);
+}
+
+HRESULT DisplaySourceBitmap::getScreenId(ULONG *aScreenId)
+{
+    HRESULT hr = S_OK;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aScreenId = m.uScreenId;
+    return hr;
+}
+
+HRESULT DisplaySourceBitmap::queryBitmapInfo(BYTE **aAddress,
+                                             ULONG *aWidth,
+                                             ULONG *aHeight,
+                                             ULONG *aBitsPerPixel,
+                                             ULONG *aBytesPerLine,
+                                             BitmapFormat_T *aBitmapFormat)
+{
+    HRESULT hr = S_OK;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aAddress      = m.pu8Address;
+    *aWidth        = m.ulWidth;
+    *aHeight       = m.ulHeight;
+    *aBitsPerPixel = m.ulBitsPerPixel;
+    *aBytesPerLine = m.ulBytesPerLine;
+    *aBitmapFormat  = m.bitmapFormat;
+
+    return hr;
+}
+
+int DisplaySourceBitmap::initSourceBitmap(unsigned aScreenId,
+                                          DISPLAYFBINFO *pFBInfo)
+{
+    int rc = VINF_SUCCESS;
+
+    if (pFBInfo->w == 0 || pFBInfo->h == 0)
+    {
+        return VERR_NOT_SUPPORTED;
+    }
+
+    BYTE *pAddress = NULL;
+    ULONG ulWidth = 0;
+    ULONG ulHeight = 0;
+    ULONG ulBitsPerPixel = 0;
+    ULONG ulBytesPerLine = 0;
+    BitmapFormat_T bitmapFormat = BitmapFormat_Opaque;
+
+    if (pFBInfo->pu8FramebufferVRAM && pFBInfo->u16BitsPerPixel == 32 && !pFBInfo->fDisabled)
+    {
+        /* From VRAM. */
+        LogFunc(("%d from VRAM\n", aScreenId));
+        pAddress       = pFBInfo->pu8FramebufferVRAM;
+        ulWidth        = pFBInfo->w;
+        ulHeight       = pFBInfo->h;
+        ulBitsPerPixel = pFBInfo->u16BitsPerPixel;
+        ulBytesPerLine = pFBInfo->u32LineSize;
+        bitmapFormat   = BitmapFormat_BGR;
+        m.pu8Allocated = NULL;
+    }
+    else
+    {
+        /* Allocated byffer */
+        LogFunc(("%d allocated\n", aScreenId));
+        pAddress       = NULL;
+        ulWidth        = pFBInfo->w;
+        ulHeight       = pFBInfo->h;
+        ulBitsPerPixel = 32;
+        ulBytesPerLine = ulWidth * 4;
+        bitmapFormat   = BitmapFormat_BGR;
+
+        m.pu8Allocated = (uint8_t *)RTMemAlloc(ulBytesPerLine * ulHeight);
+        if (m.pu8Allocated == NULL)
+        {
+            rc = VERR_NO_MEMORY;
+        }
+        else
+        {
+            pAddress = m.pu8Allocated;
+        }
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        m.pu8Address = pAddress;
+        m.ulWidth = ulWidth;
+        m.ulHeight = ulHeight;
+        m.ulBitsPerPixel = ulBitsPerPixel;
+        m.ulBytesPerLine = ulBytesPerLine;
+        m.bitmapFormat = bitmapFormat;
+        if (pFBInfo->fDisabled)
+        {
+            RT_BZERO(pAddress, ulBytesPerLine * ulHeight);
+        }
+    }
+
+    return rc;
+}
+
+/* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-client/DrvAudioVRDE.cpp b/src/VBox/Main/src-client/DrvAudioVRDE.cpp
new file mode 100644
index 0000000..1de44ab
--- /dev/null
+++ b/src/VBox/Main/src-client/DrvAudioVRDE.cpp
@@ -0,0 +1,616 @@
+/* $Id: DrvAudioVRDE.cpp $ */
+/** @file
+ * VRDE audio backend for Main.
+ */
+
+/*
+ * Copyright (C) 2013-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "DrvAudioVRDE.h"
+#include "ConsoleImpl.h"
+#include "ConsoleVRDPServer.h"
+
+#include "Logging.h"
+
+#include "../../Devices/Audio/DrvAudio.h"
+#include "../../Devices/Audio/AudioMixBuffer.h"
+
+#include <iprt/mem.h>
+#include <iprt/cdefs.h>
+#include <iprt/circbuf.h>
+
+#include <VBox/vmm/pdmaudioifs.h>
+#include <VBox/vmm/pdmdrv.h>
+#include <VBox/RemoteDesktop/VRDE.h>
+#include <VBox/vmm/cfgm.h>
+#include <VBox/err.h>
+
+#undef LOG_GROUP
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * Audio VRDE driver instance data.
+ */
+typedef struct DRVAUDIOVRDE
+{
+    /** Pointer to audio VRDE object. */
+    AudioVRDE           *pAudioVRDE;
+    PPDMDRVINS           pDrvIns;
+    /** Pointer to the driver instance structure. */
+    PDMIHOSTAUDIO        IHostAudio;
+    /** Pointer to the VRDP's console object. */
+    ConsoleVRDPServer   *pConsoleVRDPServer;
+    /** Pointer to the DrvAudio port interface that is above us. */
+    PPDMIAUDIOCONNECTOR  pDrvAudio;
+    /** Whether this driver is enabled or not. */
+    bool                 fEnabled;
+} DRVAUDIOVRDE, *PDRVAUDIOVRDE;
+
+typedef struct VRDESTREAMIN
+{
+    /** Associated host input stream. */
+    PDMAUDIOHSTSTRMIN    HstStrmIn;
+    /** Number of samples captured asynchronously in the
+     *  onVRDEInputXXX callbacks. */
+    uint32_t             cSamplesCaptured;
+    /** Critical section. */
+    RTCRITSECT           CritSect;
+} VRDESTREAMIN, *PVRDESTREAMIN;
+
+typedef struct VRDESTREAMOUT
+{
+    /** Associated host output stream. */
+    PDMAUDIOHSTSTRMOUT HstStrmOut;
+    uint64_t old_ticks;
+    uint64_t cSamplesSentPerSec;
+} VRDESTREAMOUT, *PVRDESTREAMOUT;
+
+
+
+static DECLCALLBACK(int) drvAudioVRDEInit(PPDMIHOSTAUDIO pInterface)
+{
+    LogFlowFuncEnter();
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVRDEInitIn(PPDMIHOSTAUDIO pInterface,
+                                            PPDMAUDIOHSTSTRMIN pHstStrmIn, PPDMAUDIOSTREAMCFG pCfg,
+                                            PDMAUDIORECSOURCE enmRecSource,
+                                            uint32_t *pcSamples)
+{
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
+
+    PVRDESTREAMIN pVRDEStrmIn = (PVRDESTREAMIN)pHstStrmIn;
+    AssertPtrReturn(pVRDEStrmIn, VERR_INVALID_POINTER);
+
+    if (pcSamples)
+        *pcSamples = _4K; /** @todo Make this configurable. */
+
+    return drvAudioStreamCfgToProps(pCfg, &pVRDEStrmIn->HstStrmIn.Props);
+}
+
+static DECLCALLBACK(int) drvAudioVRDEInitOut(PPDMIHOSTAUDIO pInterface,
+                                             PPDMAUDIOHSTSTRMOUT pHstStrmOut, PPDMAUDIOSTREAMCFG pCfg,
+                                             uint32_t *pcSamples)
+{
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("pHstStrmOut=%p, pCfg=%p\n", pHstStrmOut, pCfg));
+
+    PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pHstStrmOut;
+    AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);
+
+    if (pcSamples)
+        *pcSamples = _4K; /** @todo Make this configurable. */
+
+    return drvAudioStreamCfgToProps(pCfg, &pVRDEStrmOut->HstStrmOut.Props);
+}
+
+static DECLCALLBACK(bool) drvAudioVRDEIsEnabled(PPDMIHOSTAUDIO pInterface, PDMAUDIODIR enmDir)
+{
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, false);
+
+    NOREF(enmDir);
+
+    if (!pDrv->fEnabled)
+        return false;
+
+    return true;
+}
+
+/**
+ * <Missing brief description>
+ *
+ * Transfers audio input formerly sent by a connected RDP client / VRDE backend
+ * (using the onVRDEInputXXX methods) over to the VRDE host (VM). The audio device
+ * emulation then will read and send the data to the guest.
+ *
+ * @return  IPRT status code.
+ * @param   pInterface
+ * @param   pHstStrmIn
+ * @param   pcSamplesCaptured
+ */
+static DECLCALLBACK(int) drvAudioVRDECaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                               uint32_t *pcSamplesCaptured)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+    AssertPtrReturn(pcSamplesCaptured, VERR_INVALID_POINTER);
+
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
+
+    PVRDESTREAMIN pVRDEStrmIn = (PVRDESTREAMIN)pHstStrmIn;
+    AssertPtrReturn(pVRDEStrmIn, VERR_INVALID_POINTER);
+
+    /** @todo Use CritSect! */
+
+    int rc;
+
+    uint32_t cProcessed = 0;
+    if (pVRDEStrmIn->cSamplesCaptured)
+    {
+        rc = audioMixBufMixToParent(&pVRDEStrmIn->HstStrmIn.MixBuf, pVRDEStrmIn->cSamplesCaptured,
+                                    &cProcessed);
+    }
+    else
+        rc = VINF_SUCCESS;
+
+    if (RT_SUCCESS(rc))
+    {
+        *pcSamplesCaptured = cProcessed;
+
+        Assert(pVRDEStrmIn->cSamplesCaptured >= cProcessed);
+        pVRDEStrmIn->cSamplesCaptured -= cProcessed;
+    }
+
+    LogFlowFunc(("cSamplesCaptured=%RU32, cProcessed=%RU32\n",
+                 pVRDEStrmIn->cSamplesCaptured, cProcessed, rc));
+    return rc;
+}
+
+/**
+ * Transfers VM audio output to remote client.
+ *
+ * Transfers VM audio output over to the VRDE instance for playing remotely
+ * on the client.
+ *
+ * @return  IPRT status code.
+ * @param   pInterface
+ * @param   pHstStrmOut
+ * @param   pcSamplesPlayed
+ */
+static DECLCALLBACK(int) drvAudioVRDEPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                             uint32_t *pcSamplesPlayed)
+{
+    AssertPtrReturn(pInterface, VERR_INVALID_POINTER);
+    AssertPtrReturn(pHstStrmOut, VERR_INVALID_POINTER);
+    /* pcSamplesPlayed is optional. */
+
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
+
+    PVRDESTREAMOUT pVRDEStrmOut = (PVRDESTREAMOUT)pHstStrmOut;
+    AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);
+
+    uint32_t live = drvAudioHstOutSamplesLive(pHstStrmOut, NULL /* pcStreamsLive */);
+    uint64_t now = PDMDrvHlpTMGetVirtualTime(pDrv->pDrvIns);
+    uint64_t ticks = now  - pVRDEStrmOut->old_ticks;
+    uint64_t ticks_per_second = PDMDrvHlpTMGetVirtualFreq(pDrv->pDrvIns);
+
+    /* Minimize the rounding error: samples = int((ticks * freq) / ticks_per_second + 0.5). */
+    uint32_t cSamplesPlayed = (int)((2 * ticks * pHstStrmOut->Props.uHz + ticks_per_second) / ticks_per_second / 2);
+
+    /* Don't play more than available. */
+    if (cSamplesPlayed > live)
+        cSamplesPlayed = live;
+
+    /* Remember when samples were consumed. */
+    pVRDEStrmOut->old_ticks = now;
+
+    VRDEAUDIOFORMAT format = VRDE_AUDIO_FMT_MAKE(pHstStrmOut->Props.uHz,
+                                                 pHstStrmOut->Props.cChannels,
+                                                 pHstStrmOut->Props.cBits,
+                                                 pHstStrmOut->Props.fSigned);
+
+    int cSamplesToSend = cSamplesPlayed;
+
+    LogFlowFunc(("uFreq=%RU32, cChan=%RU8, cBits=%RU8, fSigned=%RTbool, enmFormat=%ld, cSamplesToSend=%RU32\n",
+                 pHstStrmOut->Props.uHz, pHstStrmOut->Props.cChannels,
+                 pHstStrmOut->Props.cBits, pHstStrmOut->Props.fSigned,
+                 format, cSamplesToSend));
+
+    /*
+     * Call the VRDP server with the data.
+     */
+    uint32_t cReadTotal = 0;
+
+    PPDMAUDIOSAMPLE pSamples;
+    uint32_t cRead;
+    int rc = audioMixBufAcquire(&pHstStrmOut->MixBuf, cSamplesToSend,
+                                &pSamples, &cRead);
+    if (   RT_SUCCESS(rc)
+        && cRead)
+    {
+        cReadTotal = cRead;
+        pDrv->pConsoleVRDPServer->SendAudioSamples(pSamples, cRead, format);
+
+        if (rc == VINF_TRY_AGAIN)
+        {
+            rc = audioMixBufAcquire(&pHstStrmOut->MixBuf, cSamplesToSend - cRead,
+                                    &pSamples, &cRead);
+            if (RT_SUCCESS(rc))
+                pDrv->pConsoleVRDPServer->SendAudioSamples(pSamples, cRead, format);
+
+            cReadTotal += cRead;
+        }
+    }
+
+    audioMixBufFinish(&pHstStrmOut->MixBuf, cSamplesToSend);
+
+    /*
+     * Always report back all samples acquired, regardless of whether the
+     * VRDP server actually did process those.
+     */
+    if (pcSamplesPlayed)
+        *pcSamplesPlayed = cReadTotal;
+
+    LogFlowFunc(("cReadTotal=%RU32, rc=%Rrc\n", cReadTotal, rc));
+    return rc;
+}
+
+static DECLCALLBACK(int) drvAudioVRDEFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn)
+{
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
+
+    if (pDrv->pConsoleVRDPServer)
+        pDrv->pConsoleVRDPServer->SendAudioInputEnd(NULL);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVRDEFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut)
+{
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVRDEControlOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHstStrmOut,
+                                                PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
+
+    PVRDESTREAMIN pVRDEStrmOut = (PVRDESTREAMIN)pHstStrmOut;
+    AssertPtrReturn(pVRDEStrmOut, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    audioMixBufReset(&pHstStrmOut->MixBuf);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVRDEControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHstStrmIn,
+                                               PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturn(pDrv, VERR_INVALID_POINTER);
+
+    PVRDESTREAMIN pVRDEStrmIn = (PVRDESTREAMIN)pHstStrmIn;
+    AssertPtrReturn(pVRDEStrmIn, VERR_INVALID_POINTER);
+
+    PPDMAUDIOHSTSTRMIN pThisStrmIn = &pVRDEStrmIn->HstStrmIn;
+
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    if (!pDrv->pConsoleVRDPServer)
+        return VINF_SUCCESS;
+
+    audioMixBufReset(&pThisStrmIn->MixBuf);
+
+    /* Initialize only if not already done. */
+    int rc;
+    if (enmStreamCmd == PDMAUDIOSTREAMCMD_ENABLE)
+    {
+        rc = pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pVRDEStrmIn, audioMixBufSize(&pThisStrmIn->MixBuf),
+                                                           pThisStrmIn->Props.uHz,
+                                                           pThisStrmIn->Props.cChannels, pThisStrmIn->Props.cBits);
+        if (rc == VERR_NOT_SUPPORTED)
+        {
+            LogFlowFunc(("No RDP client connected, so no input recording supported\n"));
+            rc = VINF_SUCCESS;
+        }
+    }
+    else if (enmStreamCmd == PDMAUDIOSTREAMCMD_DISABLE)
+    {
+        pDrv->pConsoleVRDPServer->SendAudioInputEnd(NULL /* pvUserCtx */);
+        rc = VINF_SUCCESS;
+    }
+    else
+        rc = VERR_INVALID_PARAMETER;
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvAudioVRDEGetConf(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pCfg)
+{
+    pCfg->cbStreamOut     = sizeof(VRDESTREAMOUT);
+    pCfg->cbStreamIn      = sizeof(VRDESTREAMIN);
+    pCfg->cMaxHstStrmsOut = 1;
+    pCfg->cMaxHstStrmsIn  = 2; /* Microphone in + Line in. */
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(void) drvAudioVRDEShutdown(PPDMIHOSTAUDIO pInterface)
+{
+    PDRVAUDIOVRDE pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVRDE, IHostAudio);
+    AssertPtrReturnVoid(pDrv);
+
+    if (pDrv->pConsoleVRDPServer)
+        pDrv->pConsoleVRDPServer->SendAudioInputEnd(NULL);
+}
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) drvAudioVRDEQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVAUDIOVRDE pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVRDE);
+
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+    return NULL;
+}
+
+AudioVRDE::AudioVRDE(Console *pConsole)
+    : mpDrv(NULL),
+      mParent(pConsole)
+{
+}
+
+AudioVRDE::~AudioVRDE(void)
+{
+    if (mpDrv)
+    {
+        mpDrv->pAudioVRDE = NULL;
+        mpDrv = NULL;
+    }
+}
+
+int AudioVRDE::onVRDEControl(bool fEnable, uint32_t uFlags)
+{
+    LogFlowThisFunc(("fEnable=%RTbool, uFlags=0x%x\n", fEnable, uFlags));
+
+    if (mpDrv == NULL)
+        return VERR_INVALID_STATE;
+
+    mpDrv->fEnabled = fEnable;
+
+    return VINF_SUCCESS; /* Never veto. */
+}
+
+/**
+ * Marks the beginning of sending captured audio data from a connected
+ * RDP client.
+ *
+ * @return  IPRT status code.
+ * @param   pvContext               The context; in this case a pointer to a
+ *                                  VRDESTREAMIN structure.
+ * @param   pVRDEAudioBegin         Pointer to a VRDEAUDIOINBEGIN structure.
+ */
+int AudioVRDE::onVRDEInputBegin(void *pvContext, PVRDEAUDIOINBEGIN pVRDEAudioBegin)
+{
+    AssertPtrReturn(pvContext, VERR_INVALID_POINTER);
+    AssertPtrReturn(pVRDEAudioBegin, VERR_INVALID_POINTER);
+
+    PVRDESTREAMIN pVRDEStrmIn = (PVRDESTREAMIN)pvContext;
+    AssertPtrReturn(pVRDEStrmIn, VERR_INVALID_POINTER);
+
+    VRDEAUDIOFORMAT audioFmt = pVRDEAudioBegin->fmt;
+
+    int iSampleHz  = VRDE_AUDIO_FMT_SAMPLE_FREQ(audioFmt);
+    int cChannels  = VRDE_AUDIO_FMT_CHANNELS(audioFmt);
+    int cBits      = VRDE_AUDIO_FMT_BITS_PER_SAMPLE(audioFmt);
+    bool fUnsigned = VRDE_AUDIO_FMT_SIGNED(audioFmt);
+
+    LogFlowFunc(("cbSample=%RU32, iSampleHz=%d, cChannels=%d, cBits=%d, fUnsigned=%RTbool\n",
+                 VRDE_AUDIO_FMT_BYTES_PER_SAMPLE(audioFmt), iSampleHz, cChannels, cBits, fUnsigned));
+
+    return VINF_SUCCESS;
+}
+
+int AudioVRDE::onVRDEInputData(void *pvContext, const void *pvData, uint32_t cbData)
+{
+    PVRDESTREAMIN pVRDEStrmIn = (PVRDESTREAMIN)pvContext;
+    AssertPtrReturn(pVRDEStrmIn, VERR_INVALID_POINTER);
+
+    PPDMAUDIOHSTSTRMIN pHstStrmIn = &pVRDEStrmIn->HstStrmIn;
+    AssertPtrReturn(pHstStrmIn, VERR_INVALID_POINTER);
+
+    /** @todo Use CritSect! */
+
+    uint32_t cWritten;
+    int rc = audioMixBufWriteCirc(&pHstStrmIn->MixBuf, pvData, cbData, &cWritten);
+    if (RT_SUCCESS(rc))
+        pVRDEStrmIn->cSamplesCaptured += cWritten;
+
+    LogFlowFunc(("cbData=%RU32, cWritten=%RU32, cSamplesCaptured=%RU32, rc=%Rrc\n",
+                 cbData, cWritten, pVRDEStrmIn->cSamplesCaptured, rc));
+    return rc;
+}
+
+int AudioVRDE::onVRDEInputEnd(void *pvContext)
+{
+    NOREF(pvContext);
+
+    return VINF_SUCCESS;
+}
+
+int AudioVRDE::onVRDEInputIntercept(bool fEnabled)
+{
+    return VINF_SUCCESS; /* Never veto. */
+}
+
+/**
+ * Construct a VRDE audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+/* static */
+DECLCALLBACK(int) AudioVRDE::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
+    PDRVAUDIOVRDE pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVRDE);
+    AssertPtrReturn(pDrvIns, VERR_INVALID_POINTER);
+    AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
+
+    LogRel(("Audio: Initializing VRDE driver\n"));
+    LogFlowFunc(("fFlags=0x%x\n", fFlags));
+
+    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
+                    ("Configuration error: Not possible to attach anything to this driver!\n"),
+                    VERR_PDM_DRVINS_NO_ATTACH);
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                   = pDrvIns;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface = drvAudioVRDEQueryInterface;
+    /* IHostAudio */
+    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvAudioVRDE);
+
+    /* Init defaults. */
+    pThis->fEnabled = false;
+
+    /*
+     * Get the ConsoleVRDPServer object pointer.
+     */
+    void *pvUser;
+    int rc = CFGMR3QueryPtr(pCfg, "ObjectVRDPServer", &pvUser);
+    AssertMsgRCReturn(rc, ("Confguration error: No/bad \"ObjectVRDPServer\" value, rc=%Rrc\n", rc), rc);
+
+    /* CFGM tree saves the pointer to ConsoleVRDPServer in the Object node of AudioVRDE. */
+    pThis->pConsoleVRDPServer = (ConsoleVRDPServer *)pvUser;
+
+    /*
+     * Get the AudioVRDE object pointer.
+     */
+    pvUser = NULL;
+    rc = CFGMR3QueryPtr(pCfg, "Object", &pvUser);
+    AssertMsgRCReturn(rc, ("Confguration error: No/bad \"Object\" value, rc=%Rrc\n", rc), rc);
+
+    pThis->pAudioVRDE = (AudioVRDE *)pvUser;
+    pThis->pAudioVRDE->mpDrv = pThis;
+
+    /*
+     * Get the interface for the above driver (DrvAudio) to make mixer/conversion calls.
+     * Described in CFGM tree.
+     */
+    pThis->pDrvAudio = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIAUDIOCONNECTOR);
+    AssertMsgReturn(pThis->pDrvAudio, ("Configuration error: No upper interface specified!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * @interface_method_impl{PDMDRVREG,pfnDestruct}
+ */
+/* static */
+DECLCALLBACK(void) AudioVRDE::drvDestruct(PPDMDRVINS pDrvIns)
+{
+    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
+    PDRVAUDIOVRDE pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVRDE);
+    LogFlowFuncEnter();
+
+    /*
+     * If the AudioVRDE object is still alive, we must clear it's reference to
+     * us since we'll be invalid when we return from this method.
+     */
+    if (pThis->pAudioVRDE)
+    {
+        pThis->pAudioVRDE->mpDrv = NULL;
+        pThis->pAudioVRDE = NULL;
+    }
+}
+
+
+/**
+ * VRDE audio driver registration record.
+ */
+const PDMDRVREG AudioVRDE::DrvReg =
+{
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "AudioVRDE",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "Audio driver for VRDE backend",
+    /* fFlags */
+    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVAUDIOVRDE),
+    /* pfnConstruct */
+    AudioVRDE::drvConstruct,
+    /* pfnDestruct */
+    AudioVRDE::drvDestruct,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
+
diff --git a/src/VBox/Main/src-client/DrvAudioVideoRec.cpp b/src/VBox/Main/src-client/DrvAudioVideoRec.cpp
new file mode 100644
index 0000000..770970c
--- /dev/null
+++ b/src/VBox/Main/src-client/DrvAudioVideoRec.cpp
@@ -0,0 +1,911 @@
+/* $Id: DrvAudioVideoRec.cpp $ */
+/** @file
+ * Video recording audio backend for Main.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+#include "DrvAudioVideoRec.h"
+#include "ConsoleImpl.h"
+#include "ConsoleVRDPServer.h"
+
+#include "Logging.h"
+
+#include <iprt/mem.h>
+#include <iprt/cdefs.h>
+#include <iprt/circbuf.h>
+
+#include <VBox/vmm/pdmaudioifs.h>
+#include <VBox/vmm/pdmdrv.h>
+#include <VBox/RemoteDesktop/VRDE.h>
+#include <VBox/vmm/cfgm.h>
+#include <VBox/err.h>
+
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_DEV_AUDIO
+#include <VBox/log.h>
+
+/* Initialization status indicator used for the recreation of the AudioUnits. */
+#define CA_STATUS_UNINIT    UINT32_C(0) /* The device is uninitialized */
+#define CA_STATUS_IN_INIT   UINT32_C(1) /* The device is currently initializing */
+#define CA_STATUS_INIT      UINT32_C(2) /* The device is initialized */
+#define CA_STATUS_IN_UNINIT UINT32_C(3) /* The device is currently uninitializing */
+
+//@todo move t_sample as a PDM interface
+//typedef struct { int mute;  uint32_t r; uint32_t l; } volume_t;
+
+#define INT_MAX         0x7fffffff
+volume_t videorec_nominal_volume = {
+    0,
+    INT_MAX,
+    INT_MAX
+};
+
+/* The desired buffer length in milliseconds. Will be the target total stream
+ * latency on newer version of pulse. Apparent latency can be less (or more.)
+ * In case its need to be used. Currently its not used.
+ */
+#if 0
+static struct
+{
+    int         buffer_msecs_out;
+    int         buffer_msecs_in;
+} confAudioVideoRec
+=
+{
+    INIT_FIELD (.buffer_msecs_out = ) 100,
+    INIT_FIELD (.buffer_msecs_in  = ) 100,
+};
+#endif
+
+/**
+ * Audio video recording driver instance data.
+ *
+ * @extends PDMIAUDIOSNIFFERCONNECTOR
+ */
+typedef struct DRVAUDIOVIDEOREC
+{
+    /** Pointer to audio video recording object. */
+    AudioVideoRec      *pAudioVideoRec;
+    PPDMDRVINS          pDrvIns;
+    /** Pointer to the driver instance structure. */
+    PDMIHOSTAUDIO       IHostAudio;
+    ConsoleVRDPServer *pConsoleVRDPServer;
+    /** Pointer to the DrvAudio port interface that is above it. */
+    PPDMIAUDIOCONNECTOR       pUpPort;
+} DRVAUDIOVIDEOREC, *PDRVAUDIOVIDEOREC;
+typedef struct PDMAUDIOHSTSTRMOUT PDMAUDIOHSTSTRMOUT;
+typedef PDMAUDIOHSTSTRMOUT *PPDMAUDIOHSTSTRMOUT;
+
+typedef struct VIDEORECAUDIOIN
+{
+    /* Audio and audio details for recording */
+    PDMAUDIOHSTSTRMIN   pHostVoiceIn;
+    void * pvUserCtx;
+    /* Number of bytes per frame (bitsPerSample * channels) of the actual input format. */
+    uint32_t cBytesPerFrame;
+    /* Frequency of the actual audio format. */
+    uint32_t uFrequency;
+    /* If the actual format frequence differs from the requested format, this is not NULL. */
+    void *rate;
+    /* Temporary buffer for st_sample_t representation of the input audio data. */
+    void *pvSamplesBuffer;
+    /* buffer for bytes of samples (not rate converted) */
+    uint32_t cbSamplesBufferAllocated;
+    /* Temporary buffer for frequency conversion. */
+    void *pvRateBuffer;
+    /* buffer for bytes rate converted samples */
+    uint32_t cbRateBufferAllocated;
+    /* A ring buffer for transferring data to the playback thread */
+    PRTCIRCBUF pRecordedVoiceBuf;
+    t_sample * convAudioDevFmtToStSampl;
+    uint32_t fIsInit;
+    uint32_t status;
+} VIDEORECAUDIOIN, *PVIDEORECAUDIOIN;
+
+typedef struct VIDEORECAUDIOOUT
+{
+    PDMAUDIOHSTSTRMOUT pHostVoiceOut;
+    uint64_t old_ticks;
+    uint64_t cSamplesSentPerSec;
+} VIDEORECAUDIOOUT, *PVIDEORECAUDIOOUT;
+
+static DECLCALLBACK(int) drvAudioVideoRecInit(PPDMIHOSTAUDIO pInterface)
+{
+    LogFlowFuncEnter();
+
+    return VINF_SUCCESS;
+}
+
+/** @todo Replace this with drvAudioHlpPcmPropsFromCfg(). */
+static int drvAudioVideoRecPcmInitInfo(PDMPCMPROPS * pProps, PPDMAUDIOSTREAMCFG as)
+{
+    int rc = VINF_SUCCESS;
+
+    uint8_t cBits = 8, cShift = 0;
+    bool fSigned = false;
+
+    switch (as->enmFormat)
+    {
+        case AUD_FMT_S8:
+            fSigned = 1;
+        case AUD_FMT_U8:
+            break;
+
+        case AUD_FMT_S16:
+            fSigned = 1;
+        case AUD_FMT_U16:
+            cBits = 16;
+            cShift = 1;
+            break;
+
+        case AUD_FMT_S32:
+            fSigned = 1;
+        case AUD_FMT_U32:
+            cBits = 32;
+            cShift = 2;
+            break;
+
+        default:
+            rc = VERR_NOT_SUPPORTED;
+            break;
+    }
+
+    pProps->uHz = as->uHz;
+    pProps->cBits = cBits;
+    pProps->fSigned = fSigned;
+    pProps->cChannels = as->cChannels;
+    pProps->cShift = (as->cChannels == 2) + cShift;
+    pProps->uAlign = (1 << pProps->cShift) - 1;
+    pProps->cbPerSec = pProps->uHz << pProps->cShift;
+    pProps->fSwapEndian = (as->enmEndianness != PDMAUDIOHOSTENDIANESS);
+
+    return rc;
+}
+
+/*
+ * Hard voice (playback)
+ */
+static int audio_pcm_hw_find_min_out (PPDMAUDIOHSTSTRMOUT hw, int *nb_livep)
+{
+    PPDMAUDIOGSTSTRMOUT sw;
+    PPDMAUDIOGSTSTRMOUT pIter;
+    int m = INT_MAX;
+    int nb_live = 0;
+
+    RTListForEach(&hw->lstGstStrmOut, pIter, PDMAUDIOGSTSTRMOUT, Node)
+    {
+        sw = pIter;
+        if (sw->State.fActive || !sw->State.fEmpty)
+        {
+            m = RT_MIN (m, sw->cTotalSamplesWritten);
+            nb_live += 1;
+        }
+    }
+
+    *nb_livep = nb_live;
+    return m;
+}
+
+static int audio_pcm_hw_get_live_out2 (PPDMAUDIOHSTSTRMOUT hw, int *nb_live)
+{
+    int smin;
+
+    smin = audio_pcm_hw_find_min_out (hw, nb_live);
+
+    if (!*nb_live) {
+        return 0;
+    }
+    else
+    {
+        int live = smin;
+
+        if (live < 0 || live > hw->cSamples)
+        {
+            LogFlowFunc(("Error: live=%d hw->samples=%d\n", live, hw->cSamples));
+            return 0;
+        }
+        return live;
+    }
+}
+
+
+static int audio_pcm_hw_get_live_out (PPDMAUDIOHSTSTRMOUT hw)
+{
+    int nb_live;
+    int live;
+
+    live = audio_pcm_hw_get_live_out2 (hw, &nb_live);
+    if (live < 0 || live > hw->cSamples)
+    {
+        LogFlowFunc(("Error: live=%d hw->samples=%d\n", live, hw->cSamples));
+        return 0;
+    }
+    return live;
+}
+
+/*
+ * Hard voice (capture)
+ */
+static int audio_pcm_hw_find_min_in (PPDMAUDIOHSTSTRMIN hw)
+{
+    PPDMAUDIOGSTSTRMIN pIter;
+    int m = hw->cTotalSamplesCaptured;
+
+    RTListForEach(&hw->lstGstStreamsIn, pIter, PDMAUDIOGSTSTRMIN, Node)
+    {
+        if (pIter->State.fActive)
+        {
+            m = RT_MIN (m, pIter->cTotalHostSamplesRead);
+        }
+    }
+    return m;
+}
+
+int audio_pcm_hw_get_live_in (PPDMAUDIOHSTSTRMIN hw)
+{
+    int live = hw->cTotalSamplesCaptured - audio_pcm_hw_find_min_in (hw);
+    if (live < 0 || live > hw->cSamples)
+    {
+        LogFlowFunc(("Error: live=%d hw->samples=%d\n", live, hw->cSamples));
+        return 0;
+    }
+    return live;
+}
+
+static inline void *advance (void *p, int incr)
+{
+    uint8_t *d = (uint8_t*)p;
+    return (d + incr);
+}
+
+static int vrdeReallocSampleBuf(PVIDEORECAUDIOIN pVRDEVoice, uint32_t cSamples)
+{
+    uint32_t cbBuffer = cSamples * sizeof(PDMAUDIOSAMPLE);
+    if (cbBuffer > pVRDEVoice->cbSamplesBufferAllocated)
+    {
+        /** @todo r=andy Why not using RTMemReAlloc? */
+        if (pVRDEVoice->pvSamplesBuffer)
+        {
+            RTMemFree(pVRDEVoice->pvSamplesBuffer);
+            pVRDEVoice->pvSamplesBuffer = NULL;
+        }
+        pVRDEVoice->pvSamplesBuffer = RTMemAlloc(cbBuffer);
+        if (pVRDEVoice->pvSamplesBuffer)
+            pVRDEVoice->cbSamplesBufferAllocated = cbBuffer;
+        else
+            pVRDEVoice->cbSamplesBufferAllocated = 0;
+    }
+
+    return VINF_SUCCESS;
+}
+
+static int vrdeReallocRateAdjSampleBuf(PVIDEORECAUDIOIN pVRDEVoice, uint32_t cSamples)
+{
+    uint32_t cbBuffer = cSamples * sizeof(PDMAUDIOSAMPLE);
+    if (cbBuffer > pVRDEVoice->cbRateBufferAllocated)
+    {
+        RTMemFree(pVRDEVoice->pvRateBuffer);
+        pVRDEVoice->pvRateBuffer = RTMemAlloc(cbBuffer);
+        if (pVRDEVoice->pvRateBuffer)
+            pVRDEVoice->cbRateBufferAllocated = cbBuffer;
+        else
+            pVRDEVoice->cbRateBufferAllocated = 0;
+    }
+
+    return VINF_SUCCESS;
+}
+
+/*******************************************************************************
+ *
+ * AudioVideoRec input section
+ *
+ ******************************************************************************/
+
+/*
+ * Callback to feed audio input buffer. Samples format is be the same as
+ * in the voice. The caller prepares st_sample_t.
+ *
+ * @param cbSamples Size of pvSamples array in bytes.
+ * @param pvSamples Points to an array of samples.
+ *
+ * @return IPRT status code.
+ */
+static int vrdeRecordingCallback(PVIDEORECAUDIOIN pVRDEVoice, uint32_t cbSamples, const void *pvSamples)
+{
+    int rc = VINF_SUCCESS;
+    size_t csWritten = 0;
+
+    Assert((cbSamples % sizeof(PDMAUDIOSAMPLE)) == 0);
+
+    if (!pVRDEVoice->fIsInit)
+        return VINF_SUCCESS;
+
+    /* If nothing is pending return immediately. */
+    if (cbSamples == 0)
+        return VINF_SUCCESS;
+
+    /* How much space is free in the ring buffer? */
+    size_t csAvail = RTCircBufFree(pVRDEVoice->pRecordedVoiceBuf) / sizeof(PDMAUDIOSAMPLE); /* bytes -> samples */
+
+    /* How much space is used in the audio buffer. Use the smaller size of the too. */
+    csAvail = RT_MIN(csAvail, cbSamples / sizeof(PDMAUDIOSAMPLE));
+
+    /* Iterate as long as data is available. */
+    while (csWritten < csAvail)
+    {
+        /* How much is left? */
+        size_t csToWrite = csAvail - csWritten;
+        size_t cbToWrite = csToWrite * sizeof(PDMAUDIOSAMPLE);
+
+        /* Try to acquire the necessary space from the ring buffer. */
+        void *pcDst;
+        RTCircBufAcquireWriteBlock(pVRDEVoice->pRecordedVoiceBuf, cbToWrite, &pcDst, &cbToWrite);
+
+        /* How much do we get? */
+        csToWrite = cbToWrite / sizeof(PDMAUDIOSAMPLE);
+
+        /* Copy the data from the audio buffer to the ring buffer in PVRDEVoice. */
+        if (csToWrite)
+        {
+            memcpy(pcDst, (uint8_t *)pvSamples + (csWritten * sizeof(PDMAUDIOSAMPLE)), cbToWrite);
+            csWritten += csToWrite;
+        }
+
+        /* Release the ring buffer, so the main thread could start reading this data. */
+        RTCircBufReleaseWriteBlock(pVRDEVoice->pRecordedVoiceBuf, cbToWrite);
+
+        if (RT_UNLIKELY(csToWrite == 0))
+            break;
+    }
+
+    LogFlowFunc(("Finished writing buffer with %RU32 samples (%RU32 bytes)\n",
+                 csWritten, csWritten * sizeof(PDMAUDIOSAMPLE)));
+
+    return rc;
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecInitOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHostVoiceOut, PPDMAUDIOSTREAMCFG pCfg)
+{
+    LogFlowFuncEnter();
+    PDRVAUDIOVIDEOREC pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVIDEOREC, IHostAudio);
+
+    PVIDEORECAUDIOOUT pVRDEVoiceOut = (PVIDEORECAUDIOOUT)pHostVoiceOut;
+    pHostVoiceOut->cSamples = _4K; /* 4096 samples * 4 = 16K bytes total. */
+
+    return drvAudioVideoRecPcmInitInfo(&pVRDEVoiceOut->pHostVoiceOut.Props, pCfg);
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecInitIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHostVoiceIn, PPDMAUDIOSTREAMCFG pCfg)
+{
+    LogFlowFuncEnter();
+    PDRVAUDIOVIDEOREC pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVIDEOREC, IHostAudio);
+
+    PVIDEORECAUDIOIN pVRDEVoice = (PVIDEORECAUDIOIN)pHostVoiceIn;
+    pHostVoiceIn->cSamples = _4K; /* 4096 samples * 4 = 16K bytes total. */
+
+    return drvAudioVideoRecPcmInitInfo(&pVRDEVoice->pHostVoiceIn.Props, pCfg);
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecCaptureIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHostVoiceIn,
+                                                   uint32_t *pcSamplesCaptured)
+{
+    /** @todo Take care of the size of the buffer allocated to pHostVoiceIn. */
+    PVIDEORECAUDIOIN pVRDEVoice = (PVIDEORECAUDIOIN)pHostVoiceIn;
+
+    /* use this from DrvHostCoreAudio.c */
+    if (ASMAtomicReadU32(&pVRDEVoice->status) != CA_STATUS_INIT)
+    {
+        LogFlowFunc(("VRDE voice not initialized\n"));
+
+        *pcSamplesCaptured = 0;
+        return VERR_GENERAL_FAILURE; /** @todo Fudge! */
+    }
+
+    /* how much space is used in the ring buffer in pRecordedVocieBuf with pAudioVideoRec . Bytes-> samples*/
+    size_t cSamplesRingBuffer = RTCircBufUsed(pVRDEVoice->pRecordedVoiceBuf) / sizeof(PDMAUDIOSAMPLE);
+
+    /* How much space is available in the mix buffer. Use the smaller size of the too. */
+    cSamplesRingBuffer = RT_MIN(cSamplesRingBuffer, (uint32_t)(pVRDEVoice->pHostVoiceIn.cSamples -
+                                audio_pcm_hw_get_live_in (&pVRDEVoice->pHostVoiceIn)));
+
+    LogFlowFunc(("Start reading buffer with %d samples (%d bytes)\n", cSamplesRingBuffer,
+                 cSamplesRingBuffer * sizeof(PDMAUDIOSAMPLE)));
+
+    /* Iterate as long as data is available */
+    size_t cSamplesRead = 0;
+    while (cSamplesRead < cSamplesRingBuffer)
+    {
+        /* How much is left? Split request at the end of our samples buffer. */
+        size_t cSamplesToRead = RT_MIN(cSamplesRingBuffer - cSamplesRead,
+                                       (uint32_t)(pVRDEVoice->pHostVoiceIn.cSamples - pVRDEVoice->pHostVoiceIn.offSamplesWritten));
+        size_t cbToRead = cSamplesToRead * sizeof(PDMAUDIOSAMPLE);
+        LogFlowFunc(("Try reading %zu samples (%zu bytes)\n", cSamplesToRead, cbToRead));
+
+        /* Try to acquire the necessary block from the ring buffer. Remeber in fltRecrodCallback we
+         * we are filling this buffer with the audio data available from VRDP. Here we are reading it
+         */
+        /*todo do I need to introduce a thread to fill the buffer in fltRecordcallback. So that
+         * filling is in separate thread and the reading of that buffer is in separate thread
+         */
+        void *pvSrc;
+        RTCircBufAcquireReadBlock(pVRDEVoice->pRecordedVoiceBuf, cbToRead, &pvSrc, &cbToRead);
+
+        /* How much to we get? */
+        cSamplesToRead = cbToRead / sizeof(PDMAUDIOSAMPLE);
+        LogFlowFunc(("AuderVRDE: There are %d samples (%d bytes) available\n", cSamplesToRead, cbToRead));
+
+        /* Break if nothing is used anymore. */
+        if (cSamplesToRead)
+        {
+            /* Copy the data from our ring buffer to the mix buffer. */
+            PPDMAUDIOSAMPLE psDst = pVRDEVoice->pHostVoiceIn.paSamples + pVRDEVoice->pHostVoiceIn.offSamplesWritten;
+            memcpy(psDst, pvSrc, cbToRead);
+        }
+
+        /* Release the read buffer, so it could be used for new data. */
+        RTCircBufReleaseReadBlock(pVRDEVoice->pRecordedVoiceBuf, cbToRead);
+
+        if (!cSamplesToRead)
+            break;
+
+        pVRDEVoice->pHostVoiceIn.offSamplesWritten = (pVRDEVoice->pHostVoiceIn.offSamplesWritten + cSamplesToRead)
+                                              % pVRDEVoice->pHostVoiceIn.cSamples;
+
+        /* How much have we reads so far. */
+        cSamplesRead += cSamplesToRead;
+    }
+
+    LogFlowFunc(("Finished reading buffer with %zu samples (%zu bytes)\n",
+                 cSamplesRead, cSamplesRead * sizeof(PDMAUDIOSAMPLE)));
+
+    *pcSamplesCaptured = cSamplesRead;
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecPlayOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHostVoiceOut,
+                                                 uint32_t *pcSamplesPlayed)
+{
+    PDRVAUDIOVIDEOREC pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVIDEOREC, IHostAudio);
+    PVIDEORECAUDIOOUT pVRDEVoiceOut = (PVIDEORECAUDIOOUT)pHostVoiceOut;
+
+    /*
+     * Just call the VRDP server with the data.
+     */
+    int live = audio_pcm_hw_get_live_out(pHostVoiceOut);
+    uint64_t now = PDMDrvHlpTMGetVirtualTime(pDrv->pDrvIns);
+    uint64_t ticks = now  - pVRDEVoiceOut->old_ticks;
+    uint64_t ticks_per_second = PDMDrvHlpTMGetVirtualFreq(pDrv->pDrvIns);
+
+    int cSamplesPlayed = (int)((2 * ticks * pHostVoiceOut->Props.uHz + ticks_per_second) / ticks_per_second / 2);
+    if (cSamplesPlayed < 0)
+        cSamplesPlayed = live;
+
+    pHostVoiceOut->Props.cBits = 128; /** @todo Make this configurable (or at least a define)? */
+    VRDEAUDIOFORMAT format = VRDE_AUDIO_FMT_MAKE(pHostVoiceOut->Props.uHz,
+                                                 pHostVoiceOut->Props.cChannels,
+                                                 pHostVoiceOut->Props.cBits, /* bits per sample */
+                                                 !pHostVoiceOut->Props.fSigned);
+
+    LogFlowFunc(("freq=%d, chan=%d, cBits = %d, fsigned = %d, cSamples=%d format=%d\n",
+                 pHostVoiceOut->Props.uHz, pHostVoiceOut->Props.cChannels,
+                 pHostVoiceOut->Props.cBits, pHostVoiceOut->Props.fSigned,
+                 pHostVoiceOut->cSamples, format));
+
+    pVRDEVoiceOut->old_ticks = now;
+    int cSamplesToSend = RT_MIN(live, cSamplesPlayed);
+
+    if (pHostVoiceOut->cOffSamplesRead + cSamplesToSend > pHostVoiceOut->cSamples)
+    {
+        /* send the samples till the end of pHostStereoSampleBuf */
+        pDrv->pConsoleVRDPServer->SendAudioSamples(&pHostVoiceOut->paSamples[pHostVoiceOut->cOffSamplesRead],
+                                                   (pHostVoiceOut->cSamples - pHostVoiceOut->cOffSamplesRead), format);
+        /*pHostStereoSampleBuff already has the samples which exceeded its space. They have overwriten the old
+         * played sampled starting from offset 0. So based on the number of samples that we had to play,
+         * read the number of samples from offset 0 .
+         */
+        pDrv->pConsoleVRDPServer->SendAudioSamples(&pHostVoiceOut->paSamples[0],
+                                                   (cSamplesToSend - (pHostVoiceOut->cSamples -
+                                                                      pHostVoiceOut->cOffSamplesRead)),
+                                                   format);
+    }
+    else
+    {
+        pDrv->pConsoleVRDPServer->SendAudioSamples(&pHostVoiceOut->paSamples[pHostVoiceOut->cOffSamplesRead],
+                                                   cSamplesToSend, format);
+    }
+
+    pHostVoiceOut->cOffSamplesRead = (pHostVoiceOut->cOffSamplesRead + cSamplesToSend) % pHostVoiceOut->cSamples;
+
+    *pcSamplesPlayed = cSamplesToSend;
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecFiniIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN hw)
+{
+    PDRVAUDIOVIDEOREC pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVIDEOREC, IHostAudio);
+    LogFlowFuncEnter();
+    pDrv->pConsoleVRDPServer->SendAudioInputEnd(NULL);
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecFiniOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT pHostVoiceOut)
+{
+    PDRVAUDIOVIDEOREC pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVIDEOREC, IHostAudio);
+    LogFlowFuncEnter();
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecControlOut(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMOUT hw,
+                                                    PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    PDRVAUDIOVIDEOREC pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVIDEOREC, IHostAudio);
+    LogFlowFuncEnter();
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecControlIn(PPDMIHOSTAUDIO pInterface, PPDMAUDIOHSTSTRMIN pHostVoiceIn,
+                                                   PDMAUDIOSTREAMCMD enmStreamCmd)
+{
+    PDRVAUDIOVIDEOREC pDrv = RT_FROM_MEMBER(pInterface, DRVAUDIOVIDEOREC, IHostAudio);
+
+    /* Initialize  VRDEVoice and return to VRDP server which returns this struct back to us
+     * in the form void * pvContext
+     */
+    PVIDEORECAUDIOIN pVRDEVoice = (PVIDEORECAUDIOIN)pHostVoiceIn;
+    LogFlowFunc(("enmStreamCmd=%ld\n", enmStreamCmd));
+
+    /* initialize only if not already done */
+    if (enmStreamCmd == PDMAUDIOSTREAMCMD_ENABLE)
+    {
+        //@todo if (!pVRDEVoice->fIsInit)
+        //    RTCircBufReset(pVRDEVoice->pRecordedVoiceBuf);
+        pVRDEVoice->fIsInit = 1;
+        pVRDEVoice->pHostVoiceIn = *pHostVoiceIn;
+        pVRDEVoice->cBytesPerFrame = 1;
+        pVRDEVoice->uFrequency = 0;
+        pVRDEVoice->rate = NULL;
+        pVRDEVoice->cbSamplesBufferAllocated = 0;
+        pVRDEVoice->pvRateBuffer = NULL;
+        pVRDEVoice->cbRateBufferAllocated = 0;
+
+        pVRDEVoice->pHostVoiceIn.cSamples = 2048;
+        /* Initialize the hardware info section with the audio settings */
+
+        ASMAtomicWriteU32(&pVRDEVoice->status, CA_STATUS_IN_INIT);
+
+        /* Create the internal ring buffer. */
+        RTCircBufCreate(&pVRDEVoice->pRecordedVoiceBuf,
+                        pVRDEVoice->pHostVoiceIn.cSamples * sizeof(PDMAUDIOSAMPLE));
+
+        if (!RT_VALID_PTR(pVRDEVoice->pRecordedVoiceBuf))
+        {
+            LogRel(("Failed to create internal ring buffer\n"));
+            return  VERR_NO_MEMORY;
+        }
+
+        ASMAtomicWriteU32(&pVRDEVoice->status, CA_STATUS_INIT);
+        return pDrv->pConsoleVRDPServer->SendAudioInputBegin(NULL, pVRDEVoice, pHostVoiceIn->cSamples,
+                                                             pHostVoiceIn->Props.uHz,
+                                                             pHostVoiceIn->Props.cChannels, pHostVoiceIn->Props.cBits);
+    }
+    else if (enmStreamCmd == PDMAUDIOSTREAMCMD_DISABLE)
+    {
+        pVRDEVoice->fIsInit = 0;
+        ASMAtomicWriteU32(&pVRDEVoice->status, CA_STATUS_IN_UNINIT);
+        RTCircBufDestroy(pVRDEVoice->pRecordedVoiceBuf);
+        pVRDEVoice->pRecordedVoiceBuf = NULL;
+        ASMAtomicWriteU32(&pVRDEVoice->status, CA_STATUS_UNINIT);
+        pDrv->pConsoleVRDPServer->SendAudioInputEnd(NULL);
+    }
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(int) drvAudioVideoRecGetConf(PPDMIHOSTAUDIO pInterface, PPDMAUDIOBACKENDCFG pAudioConf)
+{
+    LogFlowFunc(("pAudioConf=%p\n", pAudioConf));
+
+    pAudioConf->cbStreamOut = sizeof(VIDEORECAUDIOOUT);
+    pAudioConf->cbStreamIn = sizeof(VIDEORECAUDIOIN);
+    pAudioConf->cMaxHstStrmsOut = 1;
+    pAudioConf->cMaxHstStrmsIn = 1;
+
+    return VINF_SUCCESS;
+}
+
+static DECLCALLBACK(void) drvAudioVideoRecShutdown(PPDMIHOSTAUDIO pInterface)
+{
+    NOREF(pInterface);
+}
+
+/**
+ * @interface_method_impl{PDMIBASE,pfnQueryInterface}
+ */
+static DECLCALLBACK(void *) drvAudioVideoRecQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+{
+    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
+    PDRVAUDIOVIDEOREC  pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVIDEOREC);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
+    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIHOSTAUDIO, &pThis->IHostAudio);
+    return NULL;
+}
+
+AudioVideoRec::AudioVideoRec(Console *pConsole)
+    : mpDrv(NULL),
+      mParent(pConsole)
+{
+}
+
+AudioVideoRec::~AudioVideoRec(void)
+{
+    if (mpDrv)
+    {
+        mpDrv->pAudioVideoRec = NULL;
+        mpDrv = NULL;
+    }
+}
+
+int AudioVideoRec::handleVideoRecSvrCmdAudioInputIntercept(bool fIntercept)
+{
+    LogFlowThisFunc(("fIntercept=%RTbool\n", fIntercept));
+    return VINF_SUCCESS;
+}
+
+int AudioVideoRec::handleVideoRecSvrCmdAudioInputEventBegin(void *pvContext, int iSampleHz, int cChannels,
+                                                            int cBits, bool fUnsigned)
+{
+    int bitIdx;
+    PVIDEORECAUDIOIN pVRDEVoice = (PVIDEORECAUDIOIN)pvContext;
+    LogFlowFunc(("handleVRDPCmdInputEventBegin\n"));
+    /* Prepare a format convertion for the actually used format. */
+    pVRDEVoice->cBytesPerFrame = ((cBits + 7) / 8) * cChannels;
+    if (cBits == 16)
+    {
+        bitIdx = 1;
+    }
+    else if (cBits == 32)
+    {
+        bitIdx = 2;
+    }
+    else
+    {
+        bitIdx = 0;
+    }
+
+    //PPDMIAUDIOCONNECTOR pPort = server->mConsole->getAudioVideoRec()->getDrvAudioPort();
+    /* Call DrvAudio interface to get the t_sample type conversion function */
+    /*mpDrv->pUpPort->pfnConvDevFmtToStSample(mpDrv->pUpPort,
+                                            (cChannels == 2) ? 1 : 0,
+                                            !fUnsigned, 0, bitIdx,
+                                            pVRDEVoice->convAudioDevFmtToStSampl);*/
+    if (pVRDEVoice->convAudioDevFmtToStSampl)
+    {
+        LogFlowFunc(("Failed to get the conversion function \n"));
+    }
+    LogFlowFunc(("Required freq as requested by VRDP Server = %d\n", iSampleHz));
+    //if (iSampleHz && iSampleHz != pVRDEVoice->pHostVoiceIn.Props.uFrequency)
+    {
+        /* @todo if the above condition is false then pVRDEVoice->uFrequency will remain 0 */
+        /*mpDrv->pUpPort->pfnPrepareAudioConversion(mpDrv->pUpPort, iSampleHz,
+                                                  pVRDEVoice->pHostVoiceIn.Props.uFrequency,
+                                                  &pVRDEVoice->rate);*/
+        pVRDEVoice->uFrequency = iSampleHz;
+        LogFlowFunc(("pVRDEVoice assigned requested freq =%d\n", pVRDEVoice->uFrequency));
+    }
+    return VINF_SUCCESS;
+}
+
+/*
+ * pvContext: pointer to VRDP voice returned by the VRDP server. The is same pointer that we initialized in
+ *            drvAudioVideoRecDisableEnableIn VOICE_ENABLE case.
+ */
+int AudioVideoRec::handleVideoRecSvrCmdAudioInputEventData(void *pvContext, const void *pvData, uint32_t cbData)
+{
+    PVIDEORECAUDIOIN pVRDEVoice = (PVIDEORECAUDIOIN)pvContext;
+    PPDMAUDIOSAMPLE pHostStereoSampleBuf; /* target sample buffer */
+    PPDMAUDIOSAMPLE pConvertedSampleBuf; /* samples adjusted for rate */
+    uint32_t cSamples = cbData / pVRDEVoice->cBytesPerFrame; /* Count of samples */
+    void * pTmpSampleBuf = NULL;
+    uint32_t cConvertedSamples; /* samples adjusted for rate */
+    uint32_t cbSamples = 0; /* count of bytes occupied by samples */
+    int rc = VINF_SUCCESS;
+
+    LogFlowFunc(("handleVRDPCmdInputEventData cbData = %d, bytesperfram=%d\n",
+              cbData, pVRDEVoice->cBytesPerFrame));
+
+    vrdeReallocSampleBuf(pVRDEVoice, cSamples);
+    pHostStereoSampleBuf = (PPDMAUDIOSAMPLE)pVRDEVoice->pvSamplesBuffer;
+    pVRDEVoice->convAudioDevFmtToStSampl(pHostStereoSampleBuf, pvData, cSamples, &videorec_nominal_volume);
+
+    /* count of rate adjusted samples */
+    pVRDEVoice->uFrequency = 22100; /* @todo handle this. How pVRDEVoice will get proper value */
+    cConvertedSamples = (cSamples * pVRDEVoice->pHostVoiceIn.Props.uHz) / pVRDEVoice->uFrequency;
+    vrdeReallocRateAdjSampleBuf(pVRDEVoice, cConvertedSamples);
+
+    pConvertedSampleBuf = (PPDMAUDIOSAMPLE)pVRDEVoice->pvRateBuffer;
+    if (pConvertedSampleBuf)
+    {
+        uint32_t cSampleSrc = cSamples;
+        uint32_t cSampleDst = cConvertedSamples;
+        /*mpDrv->pUpPort->pfnDoRateConversion(mpDrv->pUpPort, pVRDEVoice->rate, pHostStereoSampleBuf,
+                                            pConvertedSampleBuf, &cSampleSrc, &cConvertedSamples);*/
+        pTmpSampleBuf = pConvertedSampleBuf;
+        cbSamples =  cConvertedSamples * sizeof(PDMAUDIOSAMPLE);
+    }
+
+    if (cbSamples)
+        rc = vrdeRecordingCallback(pVRDEVoice, cbSamples, pTmpSampleBuf);
+
+    return rc;
+}
+
+/*
+ * pvContext: pointer to VRDP voice returned by the VRDP server. The is same pointer that we initialized in
+ *            drvAudioVideoRecDisableEnableIn VOICE_ENABLE case.
+ */
+int AudioVideoRec::handleVideoRecSvrCmdAudioInputEventEnd(void *pvContext)
+{
+    LogFlowFuncEnter();
+
+    PVIDEORECAUDIOIN pVRDEVoice = (PVIDEORECAUDIOIN)pvContext;
+    AssertPtrReturn(pVRDEVoice, VERR_INVALID_POINTER);
+
+    /* The caller will not use this context anymore. */
+    if (pVRDEVoice->rate)
+    {
+        //mpDrv->pUpPort->pfnEndAudioConversion(mpDrv->pUpPort, pVRDEVoice->rate);
+    }
+
+    if (pVRDEVoice->pvSamplesBuffer)
+    {
+        RTMemFree(pVRDEVoice->pvSamplesBuffer);
+        pVRDEVoice->pvSamplesBuffer = NULL;
+    }
+
+    if (pVRDEVoice->pvRateBuffer)
+    {
+        RTMemFree(pVRDEVoice->pvRateBuffer);
+        pVRDEVoice->pvRateBuffer = NULL;
+    }
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Construct a VRDE audio driver instance.
+ *
+ * @copydoc FNPDMDRVCONSTRUCT
+ */
+/* static */
+DECLCALLBACK(int) AudioVideoRec::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+{
+    PDRVAUDIOVIDEOREC pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVIDEOREC);
+    LogRel(("Audio: Initializing VRDE driver\n"));
+    LogFlowFunc(("fFlags=0x%x\n", fFlags));
+
+    /* we save the address of AudioVideoRec in Object node in CFGM tree and address of VRDP server in
+     * ObjectVRDPServer node. So presence of both is necessary.
+     */
+    //if (!CFGMR3AreValuesValid(pCfg, "Object\0") || !CFGMR3AreValuesValid(pCfg, "ObjectVRDPServer\0"))
+    //   return VERR_PDM_DRVINS_UNKNOWN_CFG_VALUES;
+    AssertMsgReturn(PDMDrvHlpNoAttach(pDrvIns) == VERR_PDM_NO_ATTACHED_DRIVER,
+                    ("Configuration error: Not possible to attach anything to this driver!\n"),
+                    VERR_PDM_DRVINS_NO_ATTACH);
+
+    /*
+     * Init the static parts.
+     */
+    pThis->pDrvIns                   = pDrvIns;
+    /* IBase */
+    pDrvIns->IBase.pfnQueryInterface = drvAudioVideoRecQueryInterface;
+    /* IHostAudio */
+    PDMAUDIO_IHOSTAUDIO_CALLBACKS(drvAudioVideoRec);
+
+    /* Get VRDPServer pointer. */
+    void *pvUser;
+    int rc = CFGMR3QueryPtr(pCfg, "ObjectVRDPServer", &pvUser);
+    if (RT_FAILURE(rc))
+    {
+        AssertMsgFailed(("Confguration error: No/bad \"ObjectVRDPServer\" value, rc=%Rrc\n", rc));
+        return rc;
+    }
+
+    /* CFGM tree saves the pointer to ConsoleVRDPServer in the Object node of AudioVideoRec. */
+    pThis->pConsoleVRDPServer = (ConsoleVRDPServer *)pvUser;
+
+    pvUser = NULL;
+    rc = CFGMR3QueryPtr(pCfg, "Object", &pvUser);
+    if (RT_FAILURE(rc))
+    {
+        AssertMsgFailed(("Confguration error: No/bad \"Object\" value, rc=%Rrc\n", rc));
+        return rc;
+    }
+
+    pThis->pAudioVideoRec = (AudioVideoRec *)pvUser;
+    pThis->pAudioVideoRec->mpDrv = pThis;
+
+    /*
+     * Get the interface for the above driver (DrvAudio) to make mixer/conversion calls.
+     * Described in CFGM tree.
+     */
+    pThis->pUpPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIAUDIOCONNECTOR);
+    if (!pThis->pUpPort)
+    {
+        AssertMsgFailed(("Configuration error: No upper interface specified!\n"));
+        return VERR_PDM_MISSING_INTERFACE_ABOVE;
+    }
+
+    return VINF_SUCCESS;
+}
+
+/* static */
+DECLCALLBACK(void) AudioVideoRec::drvDestruct(PPDMDRVINS pDrvIns)
+{
+    LogFlowFuncEnter();
+}
+
+/**
+ * VRDE audio driver registration record.
+ */
+const PDMDRVREG AudioVideoRec::DrvReg =
+{
+    PDM_DRVREG_VERSION,
+    /* szName */
+    "AudioVideoRec",
+    /* szRCMod */
+    "",
+    /* szR0Mod */
+    "",
+    /* pszDescription */
+    "Audio driver for video recording",
+    /* fFlags */
+    PDM_DRVREG_FLAGS_HOST_BITS_DEFAULT,
+    /* fClass. */
+    PDM_DRVREG_CLASS_AUDIO,
+    /* cMaxInstances */
+    ~0U,
+    /* cbInstance */
+    sizeof(DRVAUDIOVIDEOREC),
+    /* pfnConstruct */
+    AudioVideoRec::drvConstruct,
+    /* pfnDestruct */
+    AudioVideoRec::drvDestruct,
+    /* pfnRelocate */
+    NULL,
+    /* pfnIOCtl */
+    NULL,
+    /* pfnPowerOn */
+    NULL,
+    /* pfnReset */
+    NULL,
+    /* pfnSuspend */
+    NULL,
+    /* pfnResume */
+    NULL,
+    /* pfnAttach */
+    NULL,
+    /* pfnDetach */
+    NULL,
+    /* pfnPowerOff */
+    NULL,
+    /* pfnSoftReset */
+    NULL,
+    /* u32EndVersion */
+    PDM_DRVREG_VERSION
+};
+
diff --git a/src/VBox/Main/src-client/EbmlWriter.cpp b/src/VBox/Main/src-client/EbmlWriter.cpp
index a5568c6..b156d98 100644
--- a/src/VBox/Main/src-client/EbmlWriter.cpp
+++ b/src/VBox/Main/src-client/EbmlWriter.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +19,7 @@
  * This code is based on:
  *
  * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
+ *
  * Use of this source code is governed by a BSD-style license
  * that can be found in the LICENSE file in the root of the source
  * tree. An additional intellectual property rights grant can be found
@@ -26,479 +27,705 @@
  * be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "EbmlWriter.h"
-#include <iprt/asm.h>
-#include <iprt/mem.h>
+#include <list>
+#include <stack>
 #include <iprt/string.h>
+#include <iprt/file.h>
+#include <iprt/asm.h>
+#include <iprt/cdefs.h>
+#include <iprt/err.h>
 #include <VBox/log.h>
+#include "EbmlWriter.h"
 
-static int ebml_Write(EbmlGlobal *glob, const void *pv, size_t cb)
+/* Matroska EBML Class IDs supported by WebM */
+ enum Mkv
+ {
+     EBML = 0x1A45DFA3,
+     EBMLVersion = 0x4286,
+     EBMLReadVersion = 0x42F7,
+     EBMLMaxIDLength = 0x42F2,
+     EBMLMaxSizeLength = 0x42F3,
+     DocType = 0x4282,
+     DocTypeVersion = 0x4287,
+     DocTypeReadVersion = 0x4285,
+ //  CRC_32 = 0xBF,
+     Void = 0xEC,
+     SignatureSlot = 0x1B538667,
+     SignatureAlgo = 0x7E8A,
+     SignatureHash = 0x7E9A,
+     SignaturePublicKey = 0x7EA5,
+     Signature = 0x7EB5,
+     SignatureElements = 0x7E5B,
+     SignatureElementList = 0x7E7B,
+     SignedElement = 0x6532,
+     //segment
+     Segment = 0x18538067,
+     //Meta Seek Information
+     SeekHead = 0x114D9B74,
+     Seek = 0x4DBB,
+     SeekID = 0x53AB,
+     SeekPosition = 0x53AC,
+     //Segment Information
+     Info = 0x1549A966,
+ //  SegmentUID = 0x73A4,
+ //  SegmentFilename = 0x7384,
+ //  PrevUID = 0x3CB923,
+ //  PrevFilename = 0x3C83AB,
+ //  NextUID = 0x3EB923,
+ //  NextFilename = 0x3E83BB,
+ //  SegmentFamily = 0x4444,
+ //  ChapterTranslate = 0x6924,
+ //  ChapterTranslateEditionUID = 0x69FC,
+ //  ChapterTranslateCodec = 0x69BF,
+ //  ChapterTranslateID = 0x69A5,
+     TimecodeScale = 0x2AD7B1,
+     Segment_Duration = 0x4489,
+     DateUTC = 0x4461,
+ //  Title = 0x7BA9,
+     MuxingApp = 0x4D80,
+     WritingApp = 0x5741,
+     //Cluster
+     Cluster = 0x1F43B675,
+     Timecode = 0xE7,
+ //  SilentTracks = 0x5854,
+ //  SilentTrackNumber = 0x58D7,
+ //  Position = 0xA7,
+     PrevSize = 0xAB,
+     BlockGroup = 0xA0,
+     Block = 0xA1,
+ //  BlockVirtual = 0xA2,
+ //  BlockAdditions = 0x75A1,
+ //  BlockMore = 0xA6,
+ //  BlockAddID = 0xEE,
+ //  BlockAdditional = 0xA5,
+     BlockDuration = 0x9B,
+ //  ReferencePriority = 0xFA,
+     ReferenceBlock = 0xFB,
+ //  ReferenceVirtual = 0xFD,
+ //  CodecState = 0xA4,
+ //  Slices = 0x8E,
+ //  TimeSlice = 0xE8,
+     LaceNumber = 0xCC,
+ //  FrameNumber = 0xCD,
+ //  BlockAdditionID = 0xCB,
+ //  MkvDelay = 0xCE,
+ //  Cluster_Duration = 0xCF,
+     SimpleBlock = 0xA3,
+ //  EncryptedBlock = 0xAF,
+     //Track
+     Tracks = 0x1654AE6B,
+     TrackEntry = 0xAE,
+     TrackNumber = 0xD7,
+     TrackUID = 0x73C5,
+     TrackType = 0x83,
+     FlagEnabled = 0xB9,
+     FlagDefault = 0x88,
+     FlagForced = 0x55AA,
+     FlagLacing = 0x9C,
+ //  MinCache = 0x6DE7,
+ //  MaxCache = 0x6DF8,
+     DefaultDuration = 0x23E383,
+ //  TrackTimecodeScale = 0x23314F,
+ //  TrackOffset = 0x537F,
+ //  MaxBlockAdditionID = 0x55EE,
+     Name = 0x536E,
+     Language = 0x22B59C,
+     CodecID = 0x86,
+     CodecPrivate = 0x63A2,
+     CodecName = 0x258688,
+ //  AttachmentLink = 0x7446,
+ //  CodecSettings = 0x3A9697,
+ //  CodecInfoURL = 0x3B4040,
+ //  CodecDownloadURL = 0x26B240,
+ //  CodecDecodeAll = 0xAA,
+ //  TrackOverlay = 0x6FAB,
+ //  TrackTranslate = 0x6624,
+ //  TrackTranslateEditionUID = 0x66FC,
+ //  TrackTranslateCodec = 0x66BF,
+ //  TrackTranslateTrackID = 0x66A5,
+     //video
+     Video = 0xE0,
+     FlagInterlaced = 0x9A,
+ //  StereoMode = 0x53B8,
+     PixelWidth = 0xB0,
+     PixelHeight = 0xBA,
+     PixelCropBottom = 0x54AA,
+     PixelCropTop = 0x54BB,
+     PixelCropLeft = 0x54CC,
+     PixelCropRight = 0x54DD,
+     DisplayWidth = 0x54B0,
+     DisplayHeight = 0x54BA,
+     DisplayUnit = 0x54B2,
+     AspectRatioType = 0x54B3,
+ //  ColourSpace = 0x2EB524,
+ //  GammaValue = 0x2FB523,
+     FrameRate = 0x2383E3,
+     //end video
+     //audio
+     Audio = 0xE1,
+     SamplingFrequency = 0xB5,
+     OutputSamplingFrequency = 0x78B5,
+     Channels = 0x9F,
+ //  ChannelPositions = 0x7D7B,
+     BitDepth = 0x6264,
+     //end audio
+     //content encoding
+ //  ContentEncodings = 0x6d80,
+ //  ContentEncoding = 0x6240,
+ //  ContentEncodingOrder = 0x5031,
+ //  ContentEncodingScope = 0x5032,
+ //  ContentEncodingType = 0x5033,
+ //  ContentCompression = 0x5034,
+ //  ContentCompAlgo = 0x4254,
+ //  ContentCompSettings = 0x4255,
+ //  ContentEncryption = 0x5035,
+ //  ContentEncAlgo = 0x47e1,
+ //  ContentEncKeyID = 0x47e2,
+ //  ContentSignature = 0x47e3,
+ //  ContentSigKeyID = 0x47e4,
+ //  ContentSigAlgo = 0x47e5,
+ //  ContentSigHashAlgo = 0x47e6,
+     //end content encoding
+     //Cueing Data
+     Cues = 0x1C53BB6B,
+     CuePoint = 0xBB,
+     CueTime = 0xB3,
+     CueTrackPositions = 0xB7,
+     CueTrack = 0xF7,
+     CueClusterPosition = 0xF1,
+     CueBlockNumber = 0x5378
+ //  CueCodecState = 0xEA,
+ //  CueReference = 0xDB,
+ //  CueRefTime = 0x96,
+ //  CueRefCluster = 0x97,
+ //  CueRefNumber = 0x535F,
+ //  CueRefCodecState = 0xEB,
+     //Attachment
+ //  Attachments = 0x1941A469,
+ //  AttachedFile = 0x61A7,
+ //  FileDescription = 0x467E,
+ //  FileName = 0x466E,
+ //  FileMimeType = 0x4660,
+ //  FileData = 0x465C,
+ //  FileUID = 0x46AE,
+ //  FileReferral = 0x4675,
+     //Chapters
+ //  Chapters = 0x1043A770,
+ //  EditionEntry = 0x45B9,
+ //  EditionUID = 0x45BC,
+ //  EditionFlagHidden = 0x45BD,
+ //  EditionFlagDefault = 0x45DB,
+ //  EditionFlagOrdered = 0x45DD,
+ //  ChapterAtom = 0xB6,
+ //  ChapterUID = 0x73C4,
+ //  ChapterTimeStart = 0x91,
+ //  ChapterTimeEnd = 0x92,
+ //  ChapterFlagHidden = 0x98,
+ //  ChapterFlagEnabled = 0x4598,
+ //  ChapterSegmentUID = 0x6E67,
+ //  ChapterSegmentEditionUID = 0x6EBC,
+ //  ChapterPhysicalEquiv = 0x63C3,
+ //  ChapterTrack = 0x8F,
+ //  ChapterTrackNumber = 0x89,
+ //  ChapterDisplay = 0x80,
+ //  ChapString = 0x85,
+ //  ChapLanguage = 0x437C,
+ //  ChapCountry = 0x437E,
+ //  ChapProcess = 0x6944,
+ //  ChapProcessCodecID = 0x6955,
+ //  ChapProcessPrivate = 0x450D,
+ //  ChapProcessCommand = 0x6911,
+ //  ChapProcessTime = 0x6922,
+ //  ChapProcessData = 0x6933,
+     //Tagging
+ //  Tags = 0x1254C367,
+ //  Tag = 0x7373,
+ //  Targets = 0x63C0,
+ //  TargetTypeValue = 0x68CA,
+ //  TargetType = 0x63CA,
+ //  Tagging_TrackUID = 0x63C5,
+ //  Tagging_EditionUID = 0x63C9,
+ //  Tagging_ChapterUID = 0x63C4,
+ //  AttachmentUID = 0x63C6,
+ //  SimpleTag = 0x67C8,
+ //  TagName = 0x45A3,
+ //  TagLanguage = 0x447A,
+ //  TagDefault = 0x4484,
+ //  TagString = 0x4487,
+ //  TagBinary = 0x4485,
+ };
+
+class Ebml
 {
-    return RTFileWrite(glob->file, pv, cb, NULL);
-}
+public:
+    typedef uint32_t EbmlClassId;
 
-static int ebml_WriteU8(EbmlGlobal *glob, uint8_t u8)
-{
-    return ebml_Write(glob, &u8, 1);
-}
+private:
 
-static int ebml_WriteU16(EbmlGlobal *glob, uint16_t u16)
-{
-    return ebml_Write(glob, &u16, 2);
-}
+    struct EbmlSubElement
+    {
+        uint64_t offset;
+        EbmlClassId classId;
+        EbmlSubElement(uint64_t offs, EbmlClassId cid) : offset(offs), classId(cid) {}
+    };
 
-static int ebml_WriteU32(EbmlGlobal *glob, uint32_t u32)
-{
-    return ebml_Write(glob, &u32, 4);
-}
+    std::stack<EbmlSubElement> m_Elements;
+    RTFILE m_File;
 
-static int ebml_WriteU64(EbmlGlobal *glob, uint64_t u64)
-{
-    return ebml_Write(glob, &u64, 8);
-}
+public:
 
-static int ebml_Serialize(EbmlGlobal *glob, const uint8_t *pb, size_t cb)
-{
-    for (; cb; cb--)
+    /* Creates EBML output file. */
+    inline int create(const char *a_pszFilename)
     {
-        int rc = ebml_WriteU8(glob, pb[cb-1]);
-        if (RT_FAILURE(rc))
-            return rc;
+      return RTFileOpen(&m_File, a_pszFilename, RTFILE_O_CREATE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
     }
-    return VINF_SUCCESS;
-}
 
-static int ebml_WriteID(EbmlGlobal *glob, uint32_t class_id)
-{
-    int rc;
-    if (class_id >= 0x01000000)
-        rc = ebml_WriteU32(glob, RT_H2BE_U32(class_id));
-    else if (class_id >= 0x00010000)
-        rc = ebml_Serialize(glob, (uint8_t*)&class_id, 3);
-    else if (class_id >= 0x00000100)
-        rc = ebml_WriteU16(glob, RT_H2BE_U16((uint16_t)class_id));
-    else
-        rc = ebml_WriteU8(glob, (uint8_t)class_id);
-    return rc;
-}
+    /* Returns file size. */
+    inline uint64_t getFileSize()
+    {
+        return RTFileTell(m_File);
+    }
 
-static int ebml_SerializeUnsigned32(EbmlGlobal *glob, uint32_t class_id, uint32_t ui)
-{
-    int rc = ebml_WriteID(glob, class_id);
-    rc = ebml_WriteU8(glob, 4 | 0x80);
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU32(glob, RT_H2BE_U32(ui));
-    return rc;
-}
+    /* Get reference to file descriptor */
+    inline const RTFILE &getFile()
+    {
+        return m_File;
+    }
 
-static int ebml_StartSubElement(EbmlGlobal *glob, uint64_t *ebmlLoc, uint32_t class_id)
-{
-    // todo this is always taking 8 bytes, this may need later optimization
-    // this is a key that says lenght unknown
-    uint64_t unknownLen =  UINT64_C(0x01FFFFFFFFFFFFFF);
+    /* Returns available space on storage. */
+    inline uint64_t getAvailableSpace()
+    {
+        RTFOFF pcbFree;
+        int rc = RTFileQueryFsSizes(m_File, NULL, &pcbFree, 0, 0);
+        return (RT_SUCCESS(rc)? (uint64_t)pcbFree : UINT64_MAX);
+    }
 
-    ebml_WriteID(glob, class_id);
-    *ebmlLoc = RTFileTell(glob->file);
-    return ebml_WriteU64(glob, RT_H2BE_U64(unknownLen));
-}
+    /* Closes the file. */
+    inline void close()
+    {
+        RTFileClose(m_File);
+    }
 
-static int ebml_EndSubElement(EbmlGlobal *glob, uint64_t ebmlLoc)
-{
-    /* Save the current file pointer */
-    uint64_t pos = RTFileTell(glob->file);
+    /* Starts an EBML sub-element. */
+    inline Ebml &subStart(EbmlClassId classId)
+    {
+        writeClassId(classId);
+        /* store the current file offset. */
+        m_Elements.push(EbmlSubElement(RTFileTell(m_File), classId));
+        /* Indicates that size of the element
+         * is unkown (as according to EBML specs).
+         */
+        writeUnsignedInteger(UINT64_C(0x01FFFFFFFFFFFFFF));
+        return *this;
+    }
 
-    /* Calculate the size of this element */
-    uint64_t size  = pos - ebmlLoc - 8;
-    size |= UINT64_C(0x0100000000000000);
+    /* Ends an EBML sub-element. */
+    inline Ebml &subEnd(EbmlClassId classId)
+    {
+        /* Class ID on the top of the stack should match the class ID passed
+         * to the function. Otherwise it may mean that we have a bug in the code.
+         */
+        if(m_Elements.empty() || m_Elements.top().classId != classId) throw VERR_INTERNAL_ERROR;
+
+        uint64_t uPos = RTFileTell(m_File);
+        uint64_t uSize = uPos - m_Elements.top().offset - 8;
+        RTFileSeek(m_File, m_Elements.top().offset, RTFILE_SEEK_BEGIN, NULL);
+
+        /* make sure that size will be serialized as uint64 */
+        writeUnsignedInteger(uSize | UINT64_C(0x0100000000000000));
+        RTFileSeek(m_File, uPos, RTFILE_SEEK_BEGIN, NULL);
+        m_Elements.pop();
+        return *this;
+    }
 
-    /* Seek back to the beginning of the element and write the new size */
-    RTFileSeek(glob->file, ebmlLoc, RTFILE_SEEK_BEGIN, NULL);
-    int rc = ebml_WriteU64(glob, RT_H2BE_U64(size));
+    /* Serializes a null-terminated string. */
+    inline Ebml &serializeString(EbmlClassId classId, const char *str)
+    {
+        writeClassId(classId);
+        uint64_t size = strlen(str);
+        writeSize(size);
+        write(str, size);
+        return *this;
+    }
 
-    /* Reset the file pointer */
-    RTFileSeek(glob->file, pos, RTFILE_SEEK_BEGIN, NULL);
+    /* Serializes an UNSIGNED integer
+     * If size is zero then it will be detected automatically. */
+    inline Ebml &serializeUnsignedInteger(EbmlClassId classId, uint64_t parm, size_t size = 0)
+    {
+        writeClassId(classId);
+        if (!size) size = getSizeOfUInt(parm);
+        writeSize(size);
+        writeUnsignedInteger(parm, size);
+        return *this;
+    }
 
-    return rc;
-}
+    /* Serializes a floating point value.
+     * Only 8-bytes double precision values are supported
+     * by this function.
+     */
+    inline Ebml &serializeFloat(EbmlClassId classId, double value)
+    {
+        writeClassId(classId);
+        writeSize(sizeof(double));
+        writeUnsignedInteger(*reinterpret_cast<uint64_t*>(&value));
+        return *this;
+    }
 
-static int ebml_WriteLen(EbmlGlobal *glob, uint64_t val)
-{
-    //TODO check and make sure we are not > than 0x0100000000000000LLU
-    size_t size = 8;
-    uint64_t minVal = UINT64_C(0x000000000000007f); //mask to compare for byte size
+    /* Writes raw data to file. */
+    inline void write(const void *data, size_t size)
+    {
+        int rc = RTFileWrite(m_File, data, size, NULL);
+        if (!RT_SUCCESS(rc)) throw rc;
+    }
 
-    for (size = 1; size < 8; size ++)
+    /* Writes an unsigned integer of variable of fixed size. */
+    inline void writeUnsignedInteger(uint64_t value, size_t size = sizeof(uint64_t))
     {
-        if (val < minVal)
-            break;
+        /* convert to big-endian */
+        value = RT_H2BE_U64(value);
+        write(reinterpret_cast<uint8_t*>(&value) + sizeof(value) - size, size);
+    }
 
-        minVal = (minVal << 7) | 0x7f;
+    /* Writes EBML class ID to file.
+     * EBML ID already has a UTF8-like represenation
+     * so getSizeOfUInt is used to determine
+     * the number of its bytes.
+     */
+    inline void writeClassId(EbmlClassId parm)
+    {
+        writeUnsignedInteger(parm, getSizeOfUInt(parm));
     }
 
-    val |= (UINT64_C(0x000000000000080) << ((size - 1) * 7));
+    /* Writes data size value. */
+    inline void writeSize(uint64_t parm)
+    {
+        /* The following expression defines the size of the value that will be serialized
+         * as an EBML UTF-8 like integer (with trailing bits represeting its size):
+          1xxx xxxx                                                                              - value 0 to  2^7-2
+          01xx xxxx  xxxx xxxx                                                                   - value 0 to 2^14-2
+          001x xxxx  xxxx xxxx  xxxx xxxx                                                        - value 0 to 2^21-2
+          0001 xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                             - value 0 to 2^28-2
+          0000 1xxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                                  - value 0 to 2^35-2
+          0000 01xx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx                       - value 0 to 2^42-2
+          0000 001x  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx            - value 0 to 2^49-2
+          0000 0001  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx  xxxx xxxx - value 0 to 2^56-2
+         */
+        size_t size = 8 - ! (parm & (UINT64_MAX << 49)) - ! (parm & (UINT64_MAX << 42)) -
+                          ! (parm & (UINT64_MAX << 35)) - ! (parm & (UINT64_MAX << 28)) -
+                          ! (parm & (UINT64_MAX << 21)) - ! (parm & (UINT64_MAX << 14)) -
+                          ! (parm & (UINT64_MAX << 7));
+        /* One is subtracted in order to avoid loosing significant bit when size = 8. */
+        uint64_t mask = RT_BIT_64(size * 8 - 1);
+        writeUnsignedInteger((parm & (((mask << 1) - 1) >> size)) | (mask >> (size - 1)), size);
+    }
+    /* Size calculation for variable size UNSIGNED integer.
+     * The function defines the size of the number by trimming
+     * consequent trailing zero bytes starting from the most significant.
+     * The following statement is always true:
+     * 1 <= getSizeOfUInt(arg) <= 8.
+     *
+     * Every !(arg & (UINT64_MAX << X)) expression gives one
+     * if an only if all the bits from X to 63 are set to zero.
+     */
+    static inline size_t getSizeOfUInt(uint64_t arg)
+    {
+        return 8 - ! (arg & (UINT64_MAX << 56)) - ! (arg & (UINT64_MAX << 48)) -
+                   ! (arg & (UINT64_MAX << 40)) - ! (arg & (UINT64_MAX << 32)) -
+                   ! (arg & (UINT64_MAX << 24)) - ! (arg & (UINT64_MAX << 16)) -
+                   ! (arg & (UINT64_MAX << 8));
+    }
 
-    return ebml_Serialize(glob, (uint8_t *)&val, size);
-}
+private:
+    void operator=(const Ebml &);
 
-static int ebml_WriteString(EbmlGlobal *glob, const char *str)
-{
-    const size_t cb = strlen(str);
-    int rc = ebml_WriteLen(glob, cb);
-    //TODO: it's not clear from the spec whether the nul terminator
-    //should be serialized too.  For now we omit the null terminator.
-    if (RT_SUCCESS(rc))
-        rc = ebml_Write(glob, str, cb);
-    return rc;
-}
+};
 
-int Ebml_SerializeUnsigned64(EbmlGlobal *glob, uint32_t class_id, uint64_t ui)
+class WebMWriter_Impl
 {
-    int rc = ebml_WriteID(glob, class_id);
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU8(glob, 8 | 0x80);
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU64(glob, RT_H2BE_U64(ui));
-    return rc;
-}
 
-int Ebml_SerializeUnsigned(EbmlGlobal *glob, uint32_t class_id, uint32_t ui)
-{
-    int rc = ebml_WriteID(glob, class_id);
-    if (RT_FAILURE(rc))
-        return rc;
+    struct CueEntry
+    {
+        uint32_t    time;
+        uint64_t    loc;
+        CueEntry(uint32_t t, uint64_t l) : time(t), loc(l) {}
+    };
+
+    bool            m_bDebug;
+    int64_t         m_iLastPtsMs;
+    int64_t         m_iInitialPtsMs;
+    vpx_rational_t  m_Framerate;
+
+    uint64_t        m_uPositionReference;
+    uint64_t        m_uSeekInfoPos;
+    uint64_t        m_uSegmentInfoPos;
+    uint64_t        m_uTrackPos;
+    uint64_t        m_uCuePos;
+    uint64_t        m_uClusterPos;
+
+    uint64_t        m_uTrackIdPos;
+
+    uint64_t        m_uStartSegment;
+
+    uint32_t        m_uClusterTimecode;
+    bool            m_bClusterOpen;
+
+    std::list<CueEntry> m_CueList;
+
+    Ebml m_Ebml;
+
+public:
+
+    WebMWriter_Impl() :
+        m_bDebug(false),
+        m_iLastPtsMs(-1),
+        m_iInitialPtsMs(-1),
+        m_Framerate(),
+        m_uPositionReference(0),
+        m_uSeekInfoPos(0),
+        m_uSegmentInfoPos(0),
+        m_uTrackPos(0),
+        m_uCuePos(0),
+        m_uClusterPos(0),
+        m_uTrackIdPos(0),
+        m_uStartSegment(0),
+        m_uClusterTimecode(0),
+        m_bClusterOpen(false) {}
+
+    void writeHeader(const vpx_codec_enc_cfg_t *a_pCfg,
+                     const struct vpx_rational *a_pFps)
+    {
+        m_Ebml.subStart(EBML)
+              .serializeUnsignedInteger(EBMLVersion, 1)
+              .serializeUnsignedInteger(EBMLReadVersion, 1)
+              .serializeUnsignedInteger(EBMLMaxIDLength, 4)
+              .serializeUnsignedInteger(EBMLMaxSizeLength, 8)
+              .serializeString(DocType, "webm")
+              .serializeUnsignedInteger(DocTypeVersion, 2)
+              .serializeUnsignedInteger(DocTypeReadVersion, 2)
+              .subEnd(EBML);
+
+        m_Ebml.subStart(Segment);
+
+        m_uPositionReference = RTFileTell(m_Ebml.getFile());
+        m_Framerate = *a_pFps;
+
+        writeSeekInfo();
+
+        m_uTrackPos = RTFileTell(m_Ebml.getFile());
+
+        m_Ebml.subStart(Tracks)
+              .subStart(TrackEntry)
+              .serializeUnsignedInteger(TrackNumber, 1);
+
+        m_uTrackIdPos = RTFileTell(m_Ebml.getFile());
+
+        m_Ebml.serializeUnsignedInteger(TrackUID, 0, 4)
+              .serializeUnsignedInteger(TrackType, 1)
+              .serializeString(CodecID, "V_VP8")
+              .subStart(Video)
+              .serializeUnsignedInteger(PixelWidth, a_pCfg->g_w)
+              .serializeUnsignedInteger(PixelHeight, a_pCfg->g_h)
+              .serializeFloat(FrameRate, (double) a_pFps->num / a_pFps->den)
+              .subEnd(Video)
+              .subEnd(TrackEntry)
+              .subEnd(Tracks);
+    }
+
+    void writeBlock(const vpx_codec_enc_cfg_t *a_pCfg,
+                                const vpx_codec_cx_pkt_t *a_pPkt)
+    {
+        uint16_t uBlockTimecode = 0;
+        int64_t  iPtsMs;
+        bool     bStartCluster = false;
+
+        /* Calculate the PTS of this frame in milliseconds */
+        iPtsMs = a_pPkt->data.frame.pts * 1000
+                 * (uint64_t) a_pCfg->g_timebase.num / a_pCfg->g_timebase.den;
+        if (iPtsMs <= m_iLastPtsMs)
+            iPtsMs = m_iLastPtsMs + 1;
+        m_iLastPtsMs = iPtsMs;
+
+        if (m_iInitialPtsMs < 0)
+          m_iInitialPtsMs = m_iLastPtsMs;
+
+        /* Calculate the relative time of this block */
+        if (iPtsMs - m_uClusterTimecode > 65536)
+            bStartCluster = 1;
+        else
+            uBlockTimecode = static_cast<uint16_t>(iPtsMs - m_uClusterTimecode);
+
+        int fKeyframe = (a_pPkt->data.frame.flags & VPX_FRAME_IS_KEY);
+        if (bStartCluster || fKeyframe)
+        {
+            if (m_bClusterOpen)
+                m_Ebml.subEnd(Cluster);
+
+            /* Open a new cluster */
+            uBlockTimecode = 0;
+            m_bClusterOpen = true;
+            m_uClusterTimecode = (uint32_t)iPtsMs;
+            m_uClusterPos = RTFileTell(m_Ebml.getFile());
+            m_Ebml.subStart(Cluster)
+                  .serializeUnsignedInteger(Timecode, m_uClusterTimecode);
+
+            /* Save a cue point if this is a keyframe. */
+            if (fKeyframe)
+            {
+                CueEntry cue(m_uClusterTimecode, m_uClusterPos);
+                m_CueList.push_back(cue);
+            }
+        }
 
-    uint32_t minVal = 0x7fLU; //mask to compare for byte size
-    size_t size = 8; //size in bytes to output
-    for (size = 1; size < 4; size ++)
+        /* Write a Simple Block */
+        m_Ebml.writeClassId(SimpleBlock);
+        m_Ebml.writeUnsignedInteger(0x10000000u | (4 + a_pPkt->data.frame.sz), 4);
+        m_Ebml.writeSize(1);
+        m_Ebml.writeUnsignedInteger(uBlockTimecode, 2);
+        m_Ebml.writeUnsignedInteger((fKeyframe ? 0x80 : 0) | (a_pPkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE ? 0x08 : 0), 1);
+        m_Ebml.write(a_pPkt->data.frame.buf, a_pPkt->data.frame.sz);
+    }
+
+    void writeFooter(uint32_t a_u64Hash)
     {
-        if (ui < minVal)
-            break;
+        if (m_bClusterOpen)
+            m_Ebml.subEnd(Cluster);
+
+        m_uCuePos = RTFileTell(m_Ebml.getFile());
+        m_Ebml.subStart(Cues);
+        for (std::list<CueEntry>::iterator it = m_CueList.begin(); it != m_CueList.end(); ++it)
+        {
+          m_Ebml.subStart(CuePoint)
+                .serializeUnsignedInteger(CueTime, it->time)
+                .subStart(CueTrackPositions)
+                .serializeUnsignedInteger(CueTrack, 1)
+                .serializeUnsignedInteger(CueClusterPosition, it->loc - m_uPositionReference, 8)
+                .subEnd(CueTrackPositions)
+                .subEnd(CuePoint);
+        }
+
+        m_Ebml.subEnd(Cues)
+              .subEnd(Segment);
+
+        writeSeekInfo();
 
-        minVal <<= 7;
+        int rc = RTFileSeek(m_Ebml.getFile(), m_uTrackIdPos, RTFILE_SEEK_BEGIN, NULL);
+        if (!RT_SUCCESS(rc)) throw rc;
+
+        m_Ebml.serializeUnsignedInteger(TrackUID, (m_bDebug ? 0xDEADBEEF : a_u64Hash), 4);
+
+        rc = RTFileSeek(m_Ebml.getFile(), 0, RTFILE_SEEK_END, NULL);
+        if (!RT_SUCCESS(rc)) throw rc;
     }
 
-    rc = ebml_WriteU8(glob, 0x80 | size);
-    if (RT_SUCCESS(rc))
-        rc = ebml_Serialize(glob, (uint8_t*)&ui, size);
-    return rc;
-}
+    friend class WebMWriter;
 
-//TODO: perhaps this is a poor name for this id serializer helper function
-int Ebml_SerializeBinary(EbmlGlobal *glob, uint32_t class_id, uint32_t bin)
-{
-    int size;
-    for (size = 4; size > 1; size--)
+private:
+
+    void writeSeekInfo()
     {
-        if (bin & 0x000000ff << ((size-1) * 8))
-            break;
+        uint64_t uPos = RTFileTell(m_Ebml.getFile());
+        if (m_uSeekInfoPos)
+            RTFileSeek(m_Ebml.getFile(), m_uSeekInfoPos, RTFILE_SEEK_BEGIN, NULL);
+        else
+            m_uSeekInfoPos = uPos;
+
+        m_Ebml.subStart(SeekHead)
+
+              .subStart(Seek)
+              .serializeUnsignedInteger(SeekID, Tracks)
+              .serializeUnsignedInteger(SeekPosition, m_uTrackPos - m_uPositionReference, 8)
+              .subEnd(Seek)
+
+              .subStart(Seek)
+              .serializeUnsignedInteger(SeekID, Cues)
+              .serializeUnsignedInteger(SeekPosition, m_uCuePos - m_uPositionReference, 8)
+              .subEnd(Seek)
+
+              .subStart(Seek)
+              .serializeUnsignedInteger(SeekID, Info)
+              .serializeUnsignedInteger(SeekPosition, m_uSegmentInfoPos - m_uPositionReference, 8)
+              .subEnd(Seek)
+
+              .subEnd(SeekHead);
+
+        int64_t iFrameTime = (int64_t)1000 * m_Framerate.den / m_Framerate.num;
+        m_uSegmentInfoPos = RTFileTell(m_Ebml.getFile());
+
+        char szVersion[64];
+        RTStrPrintf(szVersion, sizeof(szVersion), "vpxenc%s",
+                    m_bDebug ? "" : vpx_codec_version_str());
+
+        m_Ebml.subStart(Info)
+              .serializeUnsignedInteger(TimecodeScale, 1000000)
+              .serializeFloat(Segment_Duration, m_iLastPtsMs + iFrameTime - m_iInitialPtsMs)
+              .serializeString(MuxingApp, szVersion)
+              .serializeString(WritingApp, szVersion)
+              .subEnd(Info);
     }
-    int rc = ebml_WriteID(glob, class_id);
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteLen(glob, size);
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteID(glob, bin);
-    return rc;
-}
+};
+
+WebMWriter::WebMWriter() : m_Impl(new WebMWriter_Impl()) {}
 
-int Ebml_SerializeFloat(EbmlGlobal *glob, uint32_t class_id, double d)
+WebMWriter::~WebMWriter()
 {
-    int rc = ebml_WriteID(glob, class_id);
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU8(glob, 0x80 | 8);
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU64(glob, RT_H2BE_U64(*(uint64_t*)&d));
-    return rc;
+    delete m_Impl;
 }
 
-int Ebml_SerializeString(EbmlGlobal *glob, uint32_t class_id, const char *s)
+int WebMWriter::create(const char *a_pszFilename)
 {
-    int rc = ebml_WriteID(glob, class_id);
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteString(glob, s);
-    return rc;
+    return m_Impl->m_Ebml.create(a_pszFilename);
 }
 
-int Ebml_WriteWebMSeekElement(EbmlGlobal *ebml, uint32_t id, uint64_t pos)
+void WebMWriter::close()
 {
-    uint64_t offset = pos - ebml->position_reference;
-    uint64_t start;
-    int rc = ebml_StartSubElement(ebml, &start, Seek);
-    if (RT_SUCCESS(rc))
-        rc = Ebml_SerializeBinary(ebml, SeekID, id);
-    if (RT_SUCCESS(rc))
-        rc = Ebml_SerializeUnsigned64(ebml, SeekPosition, offset);
-    if (RT_SUCCESS(rc))
-        rc = ebml_EndSubElement(ebml, start);
-    return rc;
+    m_Impl->m_Ebml.close();
 }
 
-int Ebml_WriteWebMSeekInfo(EbmlGlobal *ebml)
+int WebMWriter::writeHeader(const vpx_codec_enc_cfg_t *a_pCfg, const vpx_rational *a_pFps)
 {
-    int rc = VINF_SUCCESS;
-
-    /* Save the current file pointer */
-    uint64_t pos = RTFileTell(ebml->file);
-
-    if (ebml->seek_info_pos)
-        rc = RTFileSeek(ebml->file, ebml->seek_info_pos, RTFILE_SEEK_BEGIN, NULL);
-    else
-        ebml->seek_info_pos = pos;
-
+    try
     {
-        uint64_t start;
-
-        if (RT_SUCCESS(rc))
-            rc = ebml_StartSubElement(ebml, &start, SeekHead);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_WriteWebMSeekElement(ebml, Tracks, ebml->track_pos);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_WriteWebMSeekElement(ebml, Cues, ebml->cue_pos);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_WriteWebMSeekElement(ebml, Info, ebml->segment_info_pos);
-        if (RT_SUCCESS(rc))
-            rc = ebml_EndSubElement(ebml, start);
+        m_Impl->writeHeader(a_pCfg, a_pFps);
     }
+    catch(int rc)
     {
-        //segment info
-        uint64_t startInfo;
-        uint64_t frame_time;
-
-        frame_time = (uint64_t)1000 * ebml->framerate.den / ebml->framerate.num;
-        ebml->segment_info_pos = RTFileTell(ebml->file);
-        if (RT_SUCCESS(rc))
-            rc = ebml_StartSubElement(ebml, &startInfo, Info);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeUnsigned(ebml, TimecodeScale, 1000000);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeFloat(ebml, Segment_Duration,
-                                     (double)(ebml->last_pts_ms + frame_time));
-        char szVersion[64];
-        RTStrPrintf(szVersion, sizeof(szVersion), "vpxenc%s",
-                    ebml->debug ? "" : vpx_codec_version_str());
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeString(ebml, MuxingApp, szVersion);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeString(ebml, WritingApp, szVersion);
-        if (RT_SUCCESS(rc))
-            rc = ebml_EndSubElement(ebml, startInfo);
+        return rc;
     }
-    return rc;
+    return VINF_SUCCESS;
 }
 
-int Ebml_WriteWebMFileHeader(EbmlGlobal                *glob,
-                             const vpx_codec_enc_cfg_t *cfg,
-                             const struct vpx_rational *fps)
+int WebMWriter::writeBlock(const vpx_codec_enc_cfg_t *a_pCfg, const vpx_codec_cx_pkt_t *a_pPkt)
 {
-    int rc = VINF_SUCCESS;
+    try
     {
-        uint64_t start;
-        rc = ebml_StartSubElement(glob, &start, EBML);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeUnsigned(glob, EBMLVersion, 1);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeUnsigned(glob, EBMLReadVersion, 1);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeUnsigned(glob, EBMLMaxIDLength, 4);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeUnsigned(glob, EBMLMaxSizeLength, 8);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeString(glob, DocType, "webm");
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeUnsigned(glob, DocTypeVersion, 2);
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeUnsigned(glob, DocTypeReadVersion, 2);
-        if (RT_SUCCESS(rc))
-            rc = ebml_EndSubElement(glob, start);
+        m_Impl->writeBlock(a_pCfg, a_pPkt);
     }
+    catch(int rc)
     {
-        if (RT_SUCCESS(rc))
-            rc = ebml_StartSubElement(glob, &glob->startSegment, Segment);
-        glob->position_reference = RTFileTell(glob->file);
-        glob->framerate = *fps;
-        if (RT_SUCCESS(rc))
-            rc = Ebml_WriteWebMSeekInfo(glob);
-        {
-            uint64_t trackStart;
-            glob->track_pos = RTFileTell(glob->file);
-            if (RT_SUCCESS(rc))
-                rc = ebml_StartSubElement(glob, &trackStart, Tracks);
-            {
-                uint32_t trackNumber = 1;
-                uint32_t trackID = 0;
-
-                uint64_t start;
-                if (RT_SUCCESS(rc))
-                    rc = ebml_StartSubElement(glob, &start, TrackEntry);
-                if (RT_SUCCESS(rc))
-                    rc = Ebml_SerializeUnsigned(glob, TrackNumber, trackNumber);
-                glob->track_id_pos = RTFileTell(glob->file);
-                ebml_SerializeUnsigned32(glob, TrackUID, trackID);
-                Ebml_SerializeUnsigned(glob, TrackType, 1); //video is always 1
-                Ebml_SerializeString(glob, CodecID, "V_VP8");
-                {
-                    uint64_t videoStart;
-                    if (RT_SUCCESS(rc))
-                        rc = ebml_StartSubElement(glob, &videoStart, Video);
-                    uint32_t pixelWidth = cfg->g_w;
-                    if (RT_SUCCESS(rc))
-                        rc = Ebml_SerializeUnsigned(glob, PixelWidth, pixelWidth);
-                    uint32_t pixelHeight = cfg->g_h;
-                    if (RT_SUCCESS(rc))
-                        rc = Ebml_SerializeUnsigned(glob, PixelHeight, pixelHeight);
-                    double   frameRate   = (double)fps->num / (double)fps->den;
-                    if (RT_SUCCESS(rc))
-                        rc = Ebml_SerializeFloat(glob, FrameRate, frameRate);
-                    if (RT_SUCCESS(rc))
-                        rc = ebml_EndSubElement(glob, videoStart);
-                }
-                if (RT_SUCCESS(rc))
-                    rc = ebml_EndSubElement(glob, start); //Track Entry
-            }
-            if (RT_SUCCESS(rc))
-                rc = ebml_EndSubElement(glob, trackStart);
-        }
-        // segment element is open
+        return rc;
     }
-    return rc;
+    return VINF_SUCCESS;
 }
 
-int Ebml_WriteWebMBlock(EbmlGlobal                *glob,
-                        const vpx_codec_enc_cfg_t *cfg,
-                        const vpx_codec_cx_pkt_t  *pkt)
+int WebMWriter::writeFooter(uint32_t a_u64Hash)
 {
-    uint16_t block_timecode = 0;
-    int64_t  pts_ms;
-    int      start_cluster = 0;
-    int      rc = VINF_SUCCESS;
-
-    /* Calculate the PTS of this frame in milliseconds */
-    pts_ms = pkt->data.frame.pts * 1000
-             * (uint64_t)cfg->g_timebase.num / (uint64_t)cfg->g_timebase.den;
-    if (pts_ms <= glob->last_pts_ms)
-        pts_ms = glob->last_pts_ms + 1;
-    glob->last_pts_ms = pts_ms;
-
-    /* Calculate the relative time of this block */
-    if (pts_ms - glob->cluster_timecode > 65536)
-        start_cluster = 1;
-    else
-        block_timecode = (uint16_t)(pts_ms - glob->cluster_timecode);
-
-    int fKeyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY);
-    if (start_cluster || fKeyframe)
+    try
     {
-        if (glob->cluster_open)
-            rc = ebml_EndSubElement(glob, glob->startCluster);
-
-        /* Open the new cluster */
-        block_timecode = 0;
-        glob->cluster_open = 1;
-        glob->cluster_timecode = (uint32_t)pts_ms;
-        glob->cluster_pos = RTFileTell(glob->file);
-        if (RT_SUCCESS(rc))
-            rc = ebml_StartSubElement(glob, &glob->startCluster, Cluster); //cluster
-        if (RT_SUCCESS(rc))
-            rc = Ebml_SerializeUnsigned(glob, Timecode, glob->cluster_timecode);
-
-        /* Save a cue point if this is a keyframe. */
-        if (fKeyframe)
-        {
-            struct cue_entry *cue;
-
-            glob->cue_list = (cue_entry*)RTMemRealloc(glob->cue_list, (glob->cues+1) * sizeof(cue_entry));
-            cue = &glob->cue_list[glob->cues];
-            cue->time = glob->cluster_timecode;
-            cue->loc = glob->cluster_pos;
-            glob->cues++;
-        }
+        m_Impl->writeFooter(a_u64Hash);
     }
-
-    /* Write the Simple Block */
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteID(glob, SimpleBlock);
-
-    uint32_t block_length = pkt->data.frame.sz + 4;
-    block_length |= 0x10000000;
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU32(glob, RT_H2BE_U32(block_length));
-
-    uint8_t track_number = 0x80 | 1;
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU8(glob, track_number);
-
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU16(glob, RT_H2BE_U16(block_timecode));
-
-    uint8_t flags = 0;
-    if (fKeyframe)
-        flags |= 0x80;
-    if (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE)
-        flags |= 0x08;
-    if (RT_SUCCESS(rc))
-        rc = ebml_WriteU8(glob, flags);
-
-    if (RT_SUCCESS(rc))
-        rc = ebml_Write(glob, pkt->data.frame.buf, pkt->data.frame.sz);
-
-    return rc;
-}
-
-int Ebml_WriteWebMFileFooter(EbmlGlobal *glob, long hash)
-{
-    int rc = VINF_SUCCESS;
-    if (glob->cluster_open)
-        rc = ebml_EndSubElement(glob, glob->startCluster);
-
+    catch(int rc)
     {
-        uint64_t start;
-
-        glob->cue_pos = RTFileTell(glob->file);
-        if (RT_SUCCESS(rc))
-            rc = ebml_StartSubElement(glob, &start, Cues);
-        for (unsigned i = 0;  i < glob->cues; i++)
-        {
-            struct cue_entry *cue = &glob->cue_list[i];
-            uint64_t startSub;
-
-            if (RT_SUCCESS(rc))
-                rc = ebml_StartSubElement(glob, &startSub, CuePoint);
-            {
-                uint64_t startSubsub;
-
-                if (RT_SUCCESS(rc))
-                    rc = Ebml_SerializeUnsigned(glob, CueTime, cue->time);
-                if (RT_SUCCESS(rc))
-                    rc = ebml_StartSubElement(glob, &startSubsub, CueTrackPositions);
-                if (RT_SUCCESS(rc))
-                    rc = Ebml_SerializeUnsigned(glob, CueTrack, 1);
-                if (RT_SUCCESS(rc))
-                    rc = Ebml_SerializeUnsigned64(glob, CueClusterPosition,
-                                                  cue->loc - glob->position_reference);
-                //Ebml_SerializeUnsigned(glob, CueBlockNumber, cue->blockNumber);
-                if (RT_SUCCESS(rc))
-                    rc = ebml_EndSubElement(glob, startSubsub);
-            }
-            if (RT_SUCCESS(rc))
-                rc = ebml_EndSubElement(glob, startSub);
-        }
-        if (RT_SUCCESS(rc))
-            rc = ebml_EndSubElement(glob, start);
+        return rc;
     }
+    return VINF_SUCCESS;
+}
 
-    if (RT_SUCCESS(rc))
-        rc = ebml_EndSubElement(glob, glob->startSegment);
-
-    /* Patch up the seek info block */
-    if (RT_SUCCESS(rc))
-        rc = Ebml_WriteWebMSeekInfo(glob);
-
-    /* Patch up the track id */
-    if (RT_SUCCESS(rc))
-        rc = RTFileSeek(glob->file, glob->track_id_pos, RTFILE_SEEK_BEGIN, NULL);
-    if (RT_SUCCESS(rc))
-        rc  = ebml_SerializeUnsigned32(glob, TrackUID, glob->debug ? 0xDEADBEEF : hash);
+uint64_t WebMWriter::getFileSize()
+{
+    return m_Impl->m_Ebml.getFileSize();
+}
 
-    if (RT_SUCCESS(rc))
-        rc = RTFileSeek(glob->file, 0, RTFILE_SEEK_END, NULL);
-    return rc;
+uint64_t WebMWriter::getAvailableSpace()
+{
+    return m_Impl->m_Ebml.getAvailableSpace();
 }
diff --git a/src/VBox/Main/src-client/EbmlWriter.h b/src/VBox/Main/src-client/EbmlWriter.h
index e24740c..85e29db 100644
--- a/src/VBox/Main/src-client/EbmlWriter.h
+++ b/src/VBox/Main/src-client/EbmlWriter.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -30,262 +30,73 @@
 #ifndef ____EBMLWRITER
 #define ____EBMLWRITER
 
-#include <iprt/file.h>
 #include <vpx/vpx_encoder.h>
 
-enum mkv
-{
-    EBML = 0x1A45DFA3,
-    EBMLVersion = 0x4286,
-    EBMLReadVersion = 0x42F7,
-    EBMLMaxIDLength = 0x42F2,
-    EBMLMaxSizeLength = 0x42F3,
-    DocType = 0x4282,
-    DocTypeVersion = 0x4287,
-    DocTypeReadVersion = 0x4285,
-//  CRC_32 = 0xBF,
-    Void = 0xEC,
-    SignatureSlot = 0x1B538667,
-    SignatureAlgo = 0x7E8A,
-    SignatureHash = 0x7E9A,
-    SignaturePublicKey = 0x7EA5,
-    Signature = 0x7EB5,
-    SignatureElements = 0x7E5B,
-    SignatureElementList = 0x7E7B,
-    SignedElement = 0x6532,
-    //segment
-    Segment = 0x18538067,
-    //Meta Seek Information
-    SeekHead = 0x114D9B74,
-    Seek = 0x4DBB,
-    SeekID = 0x53AB,
-    SeekPosition = 0x53AC,
-    //Segment Information
-    Info = 0x1549A966,
-//  SegmentUID = 0x73A4,
-//  SegmentFilename = 0x7384,
-//  PrevUID = 0x3CB923,
-//  PrevFilename = 0x3C83AB,
-//  NextUID = 0x3EB923,
-//  NextFilename = 0x3E83BB,
-//  SegmentFamily = 0x4444,
-//  ChapterTranslate = 0x6924,
-//  ChapterTranslateEditionUID = 0x69FC,
-//  ChapterTranslateCodec = 0x69BF,
-//  ChapterTranslateID = 0x69A5,
-    TimecodeScale = 0x2AD7B1,
-    Segment_Duration = 0x4489,
-    DateUTC = 0x4461,
-//  Title = 0x7BA9,
-    MuxingApp = 0x4D80,
-    WritingApp = 0x5741,
-    //Cluster
-    Cluster = 0x1F43B675,
-    Timecode = 0xE7,
-//  SilentTracks = 0x5854,
-//  SilentTrackNumber = 0x58D7,
-//  Position = 0xA7,
-    PrevSize = 0xAB,
-    BlockGroup = 0xA0,
-    Block = 0xA1,
-//  BlockVirtual = 0xA2,
-//  BlockAdditions = 0x75A1,
-//  BlockMore = 0xA6,
-//  BlockAddID = 0xEE,
-//  BlockAdditional = 0xA5,
-    BlockDuration = 0x9B,
-//  ReferencePriority = 0xFA,
-    ReferenceBlock = 0xFB,
-//  ReferenceVirtual = 0xFD,
-//  CodecState = 0xA4,
-//  Slices = 0x8E,
-//  TimeSlice = 0xE8,
-    LaceNumber = 0xCC,
-//  FrameNumber = 0xCD,
-//  BlockAdditionID = 0xCB,
-//  MkvDelay = 0xCE,
-//  Cluster_Duration = 0xCF,
-    SimpleBlock = 0xA3,
-//  EncryptedBlock = 0xAF,
-    //Track
-    Tracks = 0x1654AE6B,
-    TrackEntry = 0xAE,
-    TrackNumber = 0xD7,
-    TrackUID = 0x73C5,
-    TrackType = 0x83,
-    FlagEnabled = 0xB9,
-    FlagDefault = 0x88,
-    FlagForced = 0x55AA,
-    FlagLacing = 0x9C,
-//  MinCache = 0x6DE7,
-//  MaxCache = 0x6DF8,
-    DefaultDuration = 0x23E383,
-//  TrackTimecodeScale = 0x23314F,
-//  TrackOffset = 0x537F,
-//  MaxBlockAdditionID = 0x55EE,
-    Name = 0x536E,
-    Language = 0x22B59C,
-    CodecID = 0x86,
-    CodecPrivate = 0x63A2,
-    CodecName = 0x258688,
-//  AttachmentLink = 0x7446,
-//  CodecSettings = 0x3A9697,
-//  CodecInfoURL = 0x3B4040,
-//  CodecDownloadURL = 0x26B240,
-//  CodecDecodeAll = 0xAA,
-//  TrackOverlay = 0x6FAB,
-//  TrackTranslate = 0x6624,
-//  TrackTranslateEditionUID = 0x66FC,
-//  TrackTranslateCodec = 0x66BF,
-//  TrackTranslateTrackID = 0x66A5,
-    //video
-    Video = 0xE0,
-    FlagInterlaced = 0x9A,
-//  StereoMode = 0x53B8,
-    PixelWidth = 0xB0,
-    PixelHeight = 0xBA,
-    PixelCropBottom = 0x54AA,
-    PixelCropTop = 0x54BB,
-    PixelCropLeft = 0x54CC,
-    PixelCropRight = 0x54DD,
-    DisplayWidth = 0x54B0,
-    DisplayHeight = 0x54BA,
-    DisplayUnit = 0x54B2,
-    AspectRatioType = 0x54B3,
-//  ColourSpace = 0x2EB524,
-//  GammaValue = 0x2FB523,
-    FrameRate = 0x2383E3,
-    //end video
-    //audio
-    Audio = 0xE1,
-    SamplingFrequency = 0xB5,
-    OutputSamplingFrequency = 0x78B5,
-    Channels = 0x9F,
-//  ChannelPositions = 0x7D7B,
-    BitDepth = 0x6264,
-    //end audio
-    //content encoding
-//  ContentEncodings = 0x6d80,
-//  ContentEncoding = 0x6240,
-//  ContentEncodingOrder = 0x5031,
-//  ContentEncodingScope = 0x5032,
-//  ContentEncodingType = 0x5033,
-//  ContentCompression = 0x5034,
-//  ContentCompAlgo = 0x4254,
-//  ContentCompSettings = 0x4255,
-//  ContentEncryption = 0x5035,
-//  ContentEncAlgo = 0x47e1,
-//  ContentEncKeyID = 0x47e2,
-//  ContentSignature = 0x47e3,
-//  ContentSigKeyID = 0x47e4,
-//  ContentSigAlgo = 0x47e5,
-//  ContentSigHashAlgo = 0x47e6,
-    //end content encoding
-    //Cueing Data
-    Cues = 0x1C53BB6B,
-    CuePoint = 0xBB,
-    CueTime = 0xB3,
-    CueTrackPositions = 0xB7,
-    CueTrack = 0xF7,
-    CueClusterPosition = 0xF1,
-    CueBlockNumber = 0x5378
-//  CueCodecState = 0xEA,
-//  CueReference = 0xDB,
-//  CueRefTime = 0x96,
-//  CueRefCluster = 0x97,
-//  CueRefNumber = 0x535F,
-//  CueRefCodecState = 0xEB,
-    //Attachment
-//  Attachments = 0x1941A469,
-//  AttachedFile = 0x61A7,
-//  FileDescription = 0x467E,
-//  FileName = 0x466E,
-//  FileMimeType = 0x4660,
-//  FileData = 0x465C,
-//  FileUID = 0x46AE,
-//  FileReferral = 0x4675,
-    //Chapters
-//  Chapters = 0x1043A770,
-//  EditionEntry = 0x45B9,
-//  EditionUID = 0x45BC,
-//  EditionFlagHidden = 0x45BD,
-//  EditionFlagDefault = 0x45DB,
-//  EditionFlagOrdered = 0x45DD,
-//  ChapterAtom = 0xB6,
-//  ChapterUID = 0x73C4,
-//  ChapterTimeStart = 0x91,
-//  ChapterTimeEnd = 0x92,
-//  ChapterFlagHidden = 0x98,
-//  ChapterFlagEnabled = 0x4598,
-//  ChapterSegmentUID = 0x6E67,
-//  ChapterSegmentEditionUID = 0x6EBC,
-//  ChapterPhysicalEquiv = 0x63C3,
-//  ChapterTrack = 0x8F,
-//  ChapterTrackNumber = 0x89,
-//  ChapterDisplay = 0x80,
-//  ChapString = 0x85,
-//  ChapLanguage = 0x437C,
-//  ChapCountry = 0x437E,
-//  ChapProcess = 0x6944,
-//  ChapProcessCodecID = 0x6955,
-//  ChapProcessPrivate = 0x450D,
-//  ChapProcessCommand = 0x6911,
-//  ChapProcessTime = 0x6922,
-//  ChapProcessData = 0x6933,
-    //Tagging
-//  Tags = 0x1254C367,
-//  Tag = 0x7373,
-//  Targets = 0x63C0,
-//  TargetTypeValue = 0x68CA,
-//  TargetType = 0x63CA,
-//  Tagging_TrackUID = 0x63C5,
-//  Tagging_EditionUID = 0x63C9,
-//  Tagging_ChapterUID = 0x63C4,
-//  AttachmentUID = 0x63C6,
-//  SimpleTag = 0x67C8,
-//  TagName = 0x45A3,
-//  TagLanguage = 0x447A,
-//  TagDefault = 0x4484,
-//  TagString = 0x4487,
-//  TagBinary = 0x4485,
-};
+class WebMWriter_Impl;
 
-struct cue_entry
+class WebMWriter
 {
-    uint32_t    time;
-    uint64_t    loc;
-};
+public:
+    WebMWriter();
+    virtual ~WebMWriter();
 
-struct EbmlGlobal
-{
-    int        debug;
-    RTFILE     file;
-    int64_t    last_pts_ms;
-    vpx_rational_t framerate;
+    /* Creates output file
+     *
+     * @param   a_pszFilename   Name of the file to create.
+     *
+     * @returns VBox status code. */
+    int create(const char *a_pszFilename);
 
-    uint64_t    position_reference;
-    uint64_t    seek_info_pos;
-    uint64_t    segment_info_pos;
-    uint64_t    track_pos;
-    uint64_t    cue_pos;
-    uint64_t    cluster_pos;
+    /* Closes output file. */
+    void close();
 
-    uint64_t    track_id_pos;
+    /* Writes WebM header to file.
+     * Should be called before any writeBlock call.
+     *
+     * @param a_pCfg Pointer to VPX Codec configuration structure.
+     * @param a_pFps Framerate information (frames per second).
+     *
+     * @returns VBox status code.
+     */
+    int writeHeader(const vpx_codec_enc_cfg_t *a_pCfg, const vpx_rational *a_pFps);
 
-    uint64_t    startSegment;
-    uint64_t    startCluster;
+    /* Writes a block of compressed data
+     *
+     * @param a_pCfg Pointer to VPX Codec configuration structure.
+     * @param a_pPkt VPX data packet.
+     *
+     * @returns VBox status code.
+     */
+    int writeBlock(const vpx_codec_enc_cfg_t *a_pCfg, const vpx_codec_cx_pkt_t *a_pPkt);
 
-    uint32_t    cluster_timecode;
-    int         cluster_open;
+    /* Writes WebM footer.
+     * No other write functions should be called after this one.
+     * @param a_u64Hash Hash value for the data written.
+     *
+     * @returns VBox status code.
+     */
+    int writeFooter(uint32_t a_u64Hash);
 
-    struct cue_entry *cue_list;
-    unsigned int cues;
-};
+    /* Gets current output file size.
+     * @returns File size in bytes.
+     */
+    uint64_t getFileSize();
+
+    /* Gets current free storage space
+     * available for the file.
+     *
+     * @returns Available storage free space.
+     */
+    uint64_t getAvailableSpace();
 
-int Ebml_WriteWebMSeekElement(EbmlGlobal *ebml, uint32_t id, uint64_t pos);
-int Ebml_WriteWebMSeekInfo(EbmlGlobal *ebml);
-int Ebml_WriteWebMFileHeader(EbmlGlobal *glob, const vpx_codec_enc_cfg_t *cfg, const struct vpx_rational *fps);
-int Ebml_WriteWebMBlock(EbmlGlobal *glob, const vpx_codec_enc_cfg_t *cfg, const vpx_codec_cx_pkt_t *pkt);
-int Ebml_WriteWebMFileFooter(EbmlGlobal *glob, long hash);
+private:
+    /* WebMWriter implementation.
+     * To isolate some include files */
+    WebMWriter_Impl *m_Impl;
+
+    /* Not defined */
+    void operator=(const WebMWriter &);
+    WebMWriter(const WebMWriter &);
+};
 
 #endif
diff --git a/src/VBox/Main/src-client/EmulatedUSBImpl.cpp b/src/VBox/Main/src-client/EmulatedUSBImpl.cpp
index 8c8aa8f..a71feea 100644
--- a/src/VBox/Main/src-client/EmulatedUSBImpl.cpp
+++ b/src/VBox/Main/src-client/EmulatedUSBImpl.cpp
@@ -156,7 +156,7 @@ static int emulatedWebcamInsertSettings(PCFGMNODE pConfig, EUSBSettingsMap *pSet
     PCFGMNODE pEUSB;
     CFGMR3InsertNode(pConfig,       "EmulatedUSB", &pEUSB);
     CFGMR3InsertString(pEUSB,         "Id", pThis->mszUuid);
-    CFGMR3InsertInteger(pEUSB,        "pfnCallback", (uintptr_t)EmulatedUSB::eusbCallback);
+    CFGMR3InsertInteger(pEUSB,        "pfnCallback", (uintptr_t)EmulatedUSB::i_eusbCallback);
     CFGMR3InsertInteger(pEUSB,        "pvCallback", (uintptr_t)pThis->mpEmulatedUSB);
 
     PCFGMNODE pLunL0;
@@ -170,7 +170,7 @@ static int emulatedWebcamInsertSettings(PCFGMNODE pConfig, EUSBSettingsMap *pSet
         return rc;
 
     /* pInstance will be used by PDM and deallocated on error. */
-    rc = PDMR3UsbCreateEmulatedDevice(pUVM, "Webcam", pInstance, &pThis->mUuid);
+    rc = PDMR3UsbCreateEmulatedDevice(pUVM, "Webcam", pInstance, &pThis->mUuid, NULL);
     LogRelFlowFunc(("PDMR3UsbCreateEmulatedDevice %Rrc\n", rc));
     return rc;
 }
@@ -441,13 +441,13 @@ static const Utf8Str s_pathDefault(".0");
 HRESULT EmulatedUSB::webcamAttach(const com::Utf8Str &aPath,
                                   const com::Utf8Str &aSettings)
 {
-    return webcamAttachInternal(aPath, aSettings, "HostWebcam", NULL);
+    return i_webcamAttachInternal(aPath, aSettings, "HostWebcam", NULL);
 }
 
-HRESULT EmulatedUSB::webcamAttachInternal(const com::Utf8Str &aPath,
-                                          const com::Utf8Str &aSettings,
-                                          const char *pszDriver,
-                                          void *pvObject)
+HRESULT EmulatedUSB::i_webcamAttachInternal(const com::Utf8Str &aPath,
+                                            const com::Utf8Str &aSettings,
+                                            const char *pszDriver,
+                                            void *pvObject)
 {
     HRESULT hrc = S_OK;
 
@@ -523,10 +523,10 @@ HRESULT EmulatedUSB::webcamAttachInternal(const com::Utf8Str &aPath,
 
 HRESULT EmulatedUSB::webcamDetach(const com::Utf8Str &aPath)
 {
-    return webcamDetachInternal(aPath);
+    return i_webcamDetachInternal(aPath);
 }
 
-HRESULT EmulatedUSB::webcamDetachInternal(const com::Utf8Str &aPath)
+HRESULT EmulatedUSB::i_webcamDetachInternal(const com::Utf8Str &aPath)
 {
     HRESULT hrc = S_OK;
 
@@ -604,8 +604,8 @@ HRESULT EmulatedUSB::webcamDetachInternal(const com::Utf8Str &aPath)
     return rc;
 }
 
-/* static */ DECLCALLBACK(int) EmulatedUSB::eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
-                                                         const void *pvData, uint32_t cbData)
+/* static */ DECLCALLBACK(int) EmulatedUSB::i_eusbCallback(void *pv, const char *pszId, uint32_t iEvent,
+                                                           const void *pvData, uint32_t cbData)
 {
     /* Make a copy of parameters, forward to EMT and leave the callback to not hold any lock in the device. */
     int rc = VINF_SUCCESS;
diff --git a/src/VBox/Main/src-client/GuestCtrlImpl.cpp b/src/VBox/Main/src-client/GuestCtrlImpl.cpp
index 384d5f5..a94cffd 100644
--- a/src/VBox/Main/src-client/GuestCtrlImpl.cpp
+++ b/src/VBox/Main/src-client/GuestCtrlImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,8 +16,10 @@
  */
 
 #include "GuestImpl.h"
-#include "GuestSessionImpl.h"
-#include "GuestCtrlImplPrivate.h"
+#ifdef VBOX_WITH_GUEST_CONTROL
+# include "GuestSessionImpl.h"
+# include "GuestCtrlImplPrivate.h"
+#endif
 
 #include "Global.h"
 #include "ConsoleImpl.h"
@@ -49,10 +51,16 @@
 #include <VBox/log.h>
 
 
+/*
+ * This #ifdef goes almost to the end of the file where there are a couple of
+ * IGuest method implementations.
+ */
+#ifdef VBOX_WITH_GUEST_CONTROL
+
+
 // public methods only for internal purposes
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef VBOX_WITH_GUEST_CONTROL
 /**
  * Static callback function for receiving updates on guest control commands
  * from the guest. Acts as a dispatcher for the actual class instance.
@@ -63,10 +71,10 @@
  *
  */
 /* static */
-DECLCALLBACK(int) Guest::notifyCtrlDispatcher(void    *pvExtension,
-                                              uint32_t u32Function,
-                                              void    *pvData,
-                                              uint32_t cbData)
+DECLCALLBACK(int) Guest::i_notifyCtrlDispatcher(void    *pvExtension,
+                                                uint32_t u32Function,
+                                                void    *pvData,
+                                                uint32_t cbData)
 {
     using namespace guestControl;
 
@@ -106,130 +114,16 @@ DECLCALLBACK(int) Guest::notifyCtrlDispatcher(void    *pvExtension,
 #endif
 
     VBOXGUESTCTRLHOSTCBCTX ctxCb = { u32Function, uContextID };
-    rc = pGuest->dispatchToSession(&ctxCb, pSvcCb);
+    rc = pGuest->i_dispatchToSession(&ctxCb, pSvcCb);
 
     LogFlowFunc(("Returning rc=%Rrc\n", rc));
     return rc;
 }
-#endif /* VBOX_WITH_GUEST_CONTROL */
-
-STDMETHODIMP Guest::UpdateGuestAdditions(IN_BSTR aSource, ComSafeArrayIn(IN_BSTR, aArguments),
-                                         ComSafeArrayIn(AdditionsUpdateFlag_T, aFlags), IProgress **aProgress)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else /* VBOX_WITH_GUEST_CONTROL */
-    CheckComArgStrNotEmptyOrNull(aSource);
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    /* Validate flags. */
-    uint32_t fFlags = AdditionsUpdateFlag_None;
-    if (aFlags)
-    {
-        com::SafeArray<AdditionsUpdateFlag_T> flags(ComSafeArrayInArg(aFlags));
-        for (size_t i = 0; i < flags.size(); i++)
-            fFlags |= flags[i];
-    }
-
-    if (fFlags)
-    {
-        if (!(fFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly))
-            return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags);
-    }
-
-    int rc = VINF_SUCCESS;
-
-    ProcessArguments aArgs;
-    if (aArguments)
-    {
-        try
-        {
-            com::SafeArray<IN_BSTR> arguments(ComSafeArrayInArg(aArguments));
-            for (size_t i = 0; i < arguments.size(); i++)
-                aArgs.push_back(Utf8Str(arguments[i]));
-        }
-        catch(std::bad_alloc &)
-        {
-            rc = VERR_NO_MEMORY;
-        }
-    }
-
-    HRESULT hr = S_OK;
-
-    /*
-     * Create an anonymous session. This is required to run the Guest Additions
-     * update process with administrative rights.
-     */
-    GuestSessionStartupInfo startupInfo;
-    startupInfo.mName = "Updating Guest Additions";
-
-    GuestCredentials guestCreds;
-    RT_ZERO(guestCreds);
-
-    ComObjPtr<GuestSession> pSession;
-    if (RT_SUCCESS(rc))
-        rc = sessionCreate(startupInfo, guestCreds, pSession);
-    if (RT_FAILURE(rc))
-    {
-        switch (rc)
-        {
-            case VERR_MAX_PROCS_REACHED:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of concurrent guest sessions (%ld) reached"),
-                              VBOX_GUESTCTRL_MAX_SESSIONS);
-                break;
-
-            /** @todo Add more errors here. */
-
-           default:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Could not create guest session: %Rrc"), rc);
-                break;
-        }
-    }
-    else
-    {
-        Assert(!pSession.isNull());
-        int guestRc;
-        rc = pSession->startSessionInternal(&guestRc);
-        if (RT_FAILURE(rc))
-        {
-            /** @todo Handle guestRc! */
-
-            hr = setError(VBOX_E_IPRT_ERROR, tr("Could not open guest session: %Rrc"), rc);
-        }
-        else
-        {
-            try
-            {
-                ComObjPtr<Progress> pProgress;
-                SessionTaskUpdateAdditions *pTask = new SessionTaskUpdateAdditions(pSession /* GuestSession */,
-                                                                                   Utf8Str(aSource), aArgs, fFlags);
-                rc = pSession->startTaskAsync(tr("Updating Guest Additions"), pTask, pProgress);
-                if (RT_SUCCESS(rc))
-                {
-                    /* Return progress to the caller. */
-                    hr = pProgress.queryInterfaceTo(aProgress);
-                }
-                else
-                    hr = setError(VBOX_E_IPRT_ERROR,
-                                  tr("Starting task for updating Guest Additions on the guest failed: %Rrc"), rc);
-            }
-            catch(std::bad_alloc &)
-            {
-                hr = E_OUTOFMEMORY;
-            }
-        }
-    }
-    return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
-}
 
 // private methods
 /////////////////////////////////////////////////////////////////////////////
 
-int Guest::dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int Guest::i_dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     LogFlowFunc(("pCtxCb=%p, pSvcCb=%p\n", pCtxCb, pSvcCb));
 
@@ -293,22 +187,22 @@ int Guest::dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTC
             switch (pCtxCb->uFunction)
             {
                 case GUEST_DISCONNECTED:
-                    rc = pSession->dispatchToThis(pCtxCb, pSvcCb);
+                    rc = pSession->i_dispatchToThis(pCtxCb, pSvcCb);
                     break;
 
                 case GUEST_EXEC_STATUS:
                 case GUEST_EXEC_OUTPUT:
                 case GUEST_EXEC_INPUT_STATUS:
                 case GUEST_EXEC_IO_NOTIFY:
-                    rc = pSession->dispatchToProcess(pCtxCb, pSvcCb);
+                    rc = pSession->i_dispatchToProcess(pCtxCb, pSvcCb);
                     break;
 
                 case GUEST_FILE_NOTIFY:
-                    rc = pSession->dispatchToFile(pCtxCb, pSvcCb);
+                    rc = pSession->i_dispatchToFile(pCtxCb, pSvcCb);
                     break;
 
                 case GUEST_SESSION_NOTIFY:
-                    rc = pSession->dispatchToThis(pCtxCb, pSvcCb);
+                    rc = pSession->i_dispatchToThis(pCtxCb, pSvcCb);
                     break;
 
                 default:
@@ -319,7 +213,7 @@ int Guest::dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTC
                      * by the approprirate object, try handling it
                      * in this session object.
                      */
-                    rc = pSession->dispatchToObject(pCtxCb, pSvcCb);
+                    rc = pSession->i_dispatchToObject(pCtxCb, pSvcCb);
                     if (   rc == VERR_NOT_FOUND
                         || rc == VERR_NOT_SUPPORTED)
                     {
@@ -344,7 +238,7 @@ int Guest::dispatchToSession(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTC
     return rc;
 }
 
-int Guest::sessionRemove(GuestSession *pSession)
+int Guest::i_sessionRemove(GuestSession *pSession)
 {
     AssertPtrReturn(pSession, VERR_INVALID_POINTER);
 
@@ -354,7 +248,7 @@ int Guest::sessionRemove(GuestSession *pSession)
 
     int rc = VERR_NOT_FOUND;
 
-    LogFlowThisFunc(("Removing session (ID=%RU32) ...\n", pSession->getId()));
+    LogFlowThisFunc(("Removing session (ID=%RU32) ...\n", pSession->i_getId()));
 
     GuestSessions::iterator itSessions = mData.mGuestSessions.begin();
     while (itSessions != mData.mGuestSessions.end())
@@ -372,9 +266,9 @@ int Guest::sessionRemove(GuestSession *pSession)
             ComObjPtr<GuestSession> pCurSession = pSession;
 
             LogFlowThisFunc(("Removing session (pSession=%p, ID=%RU32) (now total %ld sessions)\n",
-                             pSession, pSession->getId(), mData.mGuestSessions.size() - 1));
+                             pSession, pSession->i_getId(), mData.mGuestSessions.size() - 1));
 
-            rc = pSession->onRemove();
+            rc = pSession->i_onRemove();
             mData.mGuestSessions.erase(itSessions);
 
             alock.release(); /* Release lock before firing off event. */
@@ -392,8 +286,8 @@ int Guest::sessionRemove(GuestSession *pSession)
     return rc;
 }
 
-int Guest::sessionCreate(const GuestSessionStartupInfo &ssInfo,
-                         const GuestCredentials &guestCreds, ComObjPtr<GuestSession> &pGuestSession)
+int Guest::i_sessionCreate(const GuestSessionStartupInfo &ssInfo,
+                           const GuestCredentials &guestCreds, ComObjPtr<GuestSession> &pGuestSession)
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -410,7 +304,7 @@ int Guest::sessionCreate(const GuestSessionStartupInfo &ssInfo,
         for (;;)
         {
             /* Is the context ID already used? */
-            if (!sessionExists(uNewSessionID))
+            if (!i_sessionExists(uNewSessionID))
             {
                 rc = VINF_SUCCESS;
                 break;
@@ -473,17 +367,20 @@ int Guest::sessionCreate(const GuestSessionStartupInfo &ssInfo,
     return rc;
 }
 
-inline bool Guest::sessionExists(uint32_t uSessionID)
+inline bool Guest::i_sessionExists(uint32_t uSessionID)
 {
     GuestSessions::const_iterator itSessions = mData.mGuestSessions.find(uSessionID);
     return (itSessions == mData.mGuestSessions.end()) ? false : true;
 }
 
+#endif /* VBOX_WITH_GUEST_CONTROL */
+
+
 // implementation of public methods
 /////////////////////////////////////////////////////////////////////////////
+HRESULT Guest::createSession(const com::Utf8Str &aUser, const com::Utf8Str &aPassword, const com::Utf8Str &aDomain,
+                             const com::Utf8Str &aSessionName, ComPtr<IGuestSession> &aGuestSession)
 
-STDMETHODIMP Guest::CreateSession(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDomain,
-                                  IN_BSTR aSessionName, IGuestSession **aGuestSession)
 {
 #ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
@@ -492,15 +389,8 @@ STDMETHODIMP Guest::CreateSession(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDom
     LogFlowFuncEnter();
 
     /* Do not allow anonymous sessions (with system rights) with public API. */
-    if (RT_UNLIKELY((aUser) == NULL || *(aUser) == '\0'))
+    if (RT_UNLIKELY(!aUser.length()))
         return setError(E_INVALIDARG, tr("No user name specified"));
-    if (RT_UNLIKELY((aPassword) == NULL)) /* Allow empty passwords. */
-        return setError(E_INVALIDARG, tr("No password specified"));
-    CheckComArgOutPointerValid(aGuestSession);
-    /* Rest is optional. */
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     GuestSessionStartupInfo startupInfo;
     startupInfo.mName = aSessionName;
@@ -511,21 +401,19 @@ STDMETHODIMP Guest::CreateSession(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDom
     guestCreds.mDomain = aDomain;
 
     ComObjPtr<GuestSession> pSession;
-    int rc = sessionCreate(startupInfo, guestCreds, pSession);
+    int rc = i_sessionCreate(startupInfo, guestCreds, pSession);
     if (RT_SUCCESS(rc))
     {
         /* Return guest session to the caller. */
-        HRESULT hr2 = pSession.queryInterfaceTo(aGuestSession);
+        HRESULT hr2 = pSession.queryInterfaceTo(aGuestSession.asOutParam());
         if (FAILED(hr2))
             rc = VERR_COM_OBJECT_NOT_FOUND;
     }
 
     if (RT_SUCCESS(rc))
-    {
         /* Start (fork) the session asynchronously
          * on the guest. */
-        rc = pSession->startSessionAsync();
-    }
+        rc = pSession->i_startSessionAsync();
 
     HRESULT hr = S_OK;
 
@@ -551,14 +439,12 @@ STDMETHODIMP Guest::CreateSession(IN_BSTR aUser, IN_BSTR aPassword, IN_BSTR aDom
 #endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP Guest::FindSession(IN_BSTR aSessionName, ComSafeArrayOut(IGuestSession *, aSessions))
+HRESULT Guest::findSession(const com::Utf8Str &aSessionName, std::vector<ComPtr<IGuestSession> > &aSessions)
 {
 #ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
 #else /* VBOX_WITH_GUEST_CONTROL */
 
-    CheckComArgOutSafeArrayPointerValid(aSessions);
-
     LogFlowFuncEnter();
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -569,25 +455,131 @@ STDMETHODIMP Guest::FindSession(IN_BSTR aSessionName, ComSafeArrayOut(IGuestSess
     GuestSessions::const_iterator itSessions = mData.mGuestSessions.begin();
     while (itSessions != mData.mGuestSessions.end())
     {
-        if (strName.contains(itSessions->second->getName())) /** @todo Use a (simple) pattern match (IPRT?). */
+        if (strName.contains(itSessions->second->i_getName())) /** @todo Use a (simple) pattern match (IPRT?). */
             listSessions.push_back(itSessions->second);
         itSessions++;
     }
 
-    LogFlowFunc(("Sessions with \"%ls\" = %RU32\n",
-                 aSessionName, listSessions.size()));
+    LogFlowFunc(("Sessions with \"%s\" = %RU32\n",
+                 aSessionName.c_str(), listSessions.size()));
 
+    aSessions.resize(listSessions.size());
     if (listSessions.size())
     {
-        SafeIfaceArray<IGuestSession> sessionIfacs(listSessions);
-        sessionIfacs.detachTo(ComSafeArrayOutArg(aSessions));
+        size_t i = 0;
+        for (std::list < ComObjPtr<GuestSession> >::const_iterator it = listSessions.begin(); it != listSessions.end(); ++it, ++i)
+            (*it).queryInterfaceTo(aSessions[i].asOutParam());
 
         return S_OK;
+
     }
 
     return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND,
-                         tr("Could not find sessions with name '%ls'"),
-                         aSessionName);
+                         tr("Could not find sessions with name '%s'"),
+                         aSessionName.c_str());
+#endif /* VBOX_WITH_GUEST_CONTROL */
+}
+
+HRESULT Guest::updateGuestAdditions(const com::Utf8Str &aSource, const std::vector<com::Utf8Str> &aArguments,
+                                    const std::vector<AdditionsUpdateFlag_T> &aFlags, ComPtr<IProgress> &aProgress)
+{
+#ifndef VBOX_WITH_GUEST_CONTROL
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_GUEST_CONTROL */
+
+    /* Validate flags. */
+    uint32_t fFlags = AdditionsUpdateFlag_None;
+    if (aFlags.size())
+        for (size_t i = 0; i < aFlags.size(); ++i)
+            fFlags |= aFlags[i];
+
+    if (fFlags && !(fFlags & AdditionsUpdateFlag_WaitForUpdateStartOnly))
+        return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), fFlags);
+
+    int rc = VINF_SUCCESS;
+
+    ProcessArguments aArgs;
+    aArgs.resize(0);
+
+    if (aArguments.size())
+    {
+        try
+        {
+            for (size_t i = 0; i < aArguments.size(); ++i)
+                aArgs.push_back(aArguments[i]);
+        }
+        catch(std::bad_alloc &)
+        {
+            rc = VERR_NO_MEMORY;
+        }
+    }
+
+    HRESULT hr = S_OK;
+
+    /*
+     * Create an anonymous session. This is required to run the Guest Additions
+     * update process with administrative rights.
+     */
+    GuestSessionStartupInfo startupInfo;
+    startupInfo.mName = "Updating Guest Additions";
+
+    GuestCredentials guestCreds;
+    RT_ZERO(guestCreds);
+
+    ComObjPtr<GuestSession> pSession;
+    if (RT_SUCCESS(rc))
+        rc = i_sessionCreate(startupInfo, guestCreds, pSession);
+    if (RT_FAILURE(rc))
+    {
+        switch (rc)
+        {
+            case VERR_MAX_PROCS_REACHED:
+                hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of concurrent guest sessions (%ld) reached"),
+                              VBOX_GUESTCTRL_MAX_SESSIONS);
+                break;
+
+            /** @todo Add more errors here. */
+
+           default:
+                hr = setError(VBOX_E_IPRT_ERROR, tr("Could not create guest session: %Rrc"), rc);
+                break;
+        }
+    }
+    else
+    {
+        Assert(!pSession.isNull());
+        int guestRc;
+        rc = pSession->i_startSessionInternal(&guestRc);
+        if (RT_FAILURE(rc))
+        {
+            /** @todo Handle guestRc! */
+
+            hr = setError(VBOX_E_IPRT_ERROR, tr("Could not open guest session: %Rrc"), rc);
+        }
+        else
+        {
+            try
+            {
+                ComObjPtr<Progress> pProgress;
+                SessionTaskUpdateAdditions *pTask = new SessionTaskUpdateAdditions(pSession /* GuestSession */,
+                                                                                   aSource, aArgs, fFlags);
+                rc = pSession->i_startTaskAsync(tr("Updating Guest Additions"), pTask, pProgress);
+                if (RT_SUCCESS(rc))
+                {
+                    /* Return progress to the caller. */
+                    hr = pProgress.queryInterfaceTo(aProgress.asOutParam());
+                }
+                else
+                    hr = setError(VBOX_E_IPRT_ERROR,
+                                  tr("Starting task for updating Guest Additions on the guest failed: %Rrc"), rc);
+            }
+            catch(std::bad_alloc &)
+            {
+                hr = E_OUTOFMEMORY;
+            }
+        }
+    }
+    return hr;
 #endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
diff --git a/src/VBox/Main/src-client/GuestCtrlPrivate.cpp b/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
index 3c1e233..ac18c9a 100644
--- a/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
+++ b/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
@@ -1,11 +1,10 @@
 /* $Id: GuestCtrlPrivate.cpp $ */
 /** @file
- *
  * Internal helpers/structures for guest control functionality.
  */
 
 /*
- * Copyright (C) 2011-2013 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +18,9 @@
 /******************************************************************************
  *   Header Files                                                             *
  ******************************************************************************/
+#ifndef VBOX_WITH_GUEST_CONTROL
+# error "VBOX_WITH_GUEST_CONTROL must defined in this file"
+#endif
 #include "GuestCtrlImplPrivate.h"
 #include "GuestSessionImpl.h"
 #include "VMMDev.h"
@@ -36,258 +38,7 @@
 #define LOG_GROUP LOG_GROUP_GUEST_CONTROL
 #include <VBox/log.h>
 
-/******************************************************************************
- *   Structures and Typedefs                                                  *
- ******************************************************************************/
-
-int GuestEnvironment::BuildEnvironmentBlock(void **ppvEnv, size_t *pcbEnv, uint32_t *pcEnvVars)
-{
-    AssertPtrReturn(ppvEnv, VERR_INVALID_POINTER);
-    /* Rest is optional. */
-
-    size_t cbEnv = 0;
-    uint32_t cEnvVars = 0;
-
-    int rc = VINF_SUCCESS;
-
-    size_t cEnv = mEnvironment.size();
-    if (cEnv)
-    {
-        std::map<Utf8Str, Utf8Str>::const_iterator itEnv = mEnvironment.begin();
-        for (; itEnv != mEnvironment.end() && RT_SUCCESS(rc); itEnv++)
-        {
-            char *pszEnv;
-            if (!RTStrAPrintf(&pszEnv, "%s=%s", itEnv->first.c_str(), itEnv->second.c_str()))
-            {
-                rc = VERR_NO_MEMORY;
-                break;
-            }
-            AssertPtr(pszEnv);
-            rc = appendToEnvBlock(pszEnv, ppvEnv, &cbEnv, &cEnvVars);
-            RTStrFree(pszEnv);
-        }
-        Assert(cEnv == cEnvVars);
-    }
-
-    if (pcbEnv)
-        *pcbEnv = cbEnv;
-    if (pcEnvVars)
-        *pcEnvVars = cEnvVars;
-
-    return rc;
-}
-
-void GuestEnvironment::Clear(void)
-{
-    mEnvironment.clear();
-}
-
-int GuestEnvironment::CopyFrom(const GuestEnvironmentArray &environment)
-{
-    int rc = VINF_SUCCESS;
-
-    for (GuestEnvironmentArray::const_iterator it = environment.begin();
-         it != environment.end() && RT_SUCCESS(rc);
-         ++it)
-    {
-        rc = Set((*it));
-    }
-
-    return rc;
-}
-
-int GuestEnvironment::CopyTo(GuestEnvironmentArray &environment)
-{
-    size_t s = 0;
-    for (std::map<Utf8Str, Utf8Str>::const_iterator it = mEnvironment.begin();
-         it != mEnvironment.end();
-         ++it, ++s)
-    {
-        environment[s] = Bstr(it->first + "=" + it->second).raw();
-    }
-
-    return VINF_SUCCESS;
-}
-
-/* static */
-void GuestEnvironment::FreeEnvironmentBlock(void *pvEnv)
-{
-    if (pvEnv)
-        RTMemFree(pvEnv);
-}
-
-Utf8Str GuestEnvironment::Get(size_t nPos)
-{
-    size_t curPos = 0;
-    std::map<Utf8Str, Utf8Str>::const_iterator it = mEnvironment.begin();
-    for (; it != mEnvironment.end() && curPos < nPos;
-         ++it, ++curPos) { }
-
-    if (it != mEnvironment.end())
-        return Utf8Str(it->first + "=" + it->second);
-
-    return Utf8Str("");
-}
-
-Utf8Str GuestEnvironment::Get(const Utf8Str &strKey)
-{
-    std::map <Utf8Str, Utf8Str>::const_iterator itEnv = mEnvironment.find(strKey);
-    Utf8Str strRet;
-    if (itEnv != mEnvironment.end())
-        strRet = itEnv->second;
-    return strRet;
-}
-
-bool GuestEnvironment::Has(const Utf8Str &strKey)
-{
-    std::map <Utf8Str, Utf8Str>::const_iterator itEnv = mEnvironment.find(strKey);
-    return (itEnv != mEnvironment.end());
-}
-
-int GuestEnvironment::Set(const Utf8Str &strKey, const Utf8Str &strValue)
-{
-    /** @todo Do some validation using regex. */
-    if (strKey.isEmpty())
-        return VERR_INVALID_PARAMETER;
-
-    int rc = VINF_SUCCESS;
-    const char *pszString = strKey.c_str();
-    while (*pszString != '\0' && RT_SUCCESS(rc))
-    {
-         if (   !RT_C_IS_ALNUM(*pszString)
-             && !RT_C_IS_GRAPH(*pszString))
-             rc = VERR_INVALID_PARAMETER;
-         *pszString++;
-    }
-
-    if (RT_SUCCESS(rc))
-        mEnvironment[strKey] = strValue;
-
-    return rc;
-}
-
-int GuestEnvironment::Set(const Utf8Str &strPair)
-{
-    RTCList<RTCString> listPair = strPair.split("=", RTCString::KeepEmptyParts);
-    /* Skip completely empty pairs. Note that we still need pairs with a valid
-     * (set) key and an empty value. */
-    if (listPair.size() <= 1)
-        return VINF_SUCCESS;
-
-    int rc = VINF_SUCCESS;
-    size_t p = 0;
-    while (p < listPair.size() && RT_SUCCESS(rc))
-    {
-        Utf8Str strKey = listPair.at(p++);
-        if (   strKey.isEmpty()
-            || strKey.equals("=")) /* Skip pairs with empty keys (e.g. "=FOO"). */
-        {
-            break;
-        }
-        Utf8Str strValue;
-        if (p < listPair.size()) /* Does the list also contain a value? */
-            strValue = listPair.at(p++);
-
-#ifdef DEBUG
-        LogFlowFunc(("strKey=%s, strValue=%s\n",
-                     strKey.c_str(), strValue.c_str()));
-#endif
-        rc = Set(strKey, strValue);
-    }
-
-    return rc;
-}
-
-size_t GuestEnvironment::Size(void)
-{
-    return mEnvironment.size();
-}
-
-int GuestEnvironment::Unset(const Utf8Str &strKey)
-{
-    std::map <Utf8Str, Utf8Str>::iterator itEnv = mEnvironment.find(strKey);
-    if (itEnv != mEnvironment.end())
-    {
-        mEnvironment.erase(itEnv);
-        return VINF_SUCCESS;
-    }
 
-    return VERR_NOT_FOUND;
-}
-
-GuestEnvironment& GuestEnvironment::operator=(const GuestEnvironmentArray &that)
-{
-    CopyFrom(that);
-    return *this;
-}
-
-GuestEnvironment& GuestEnvironment::operator=(const GuestEnvironment &that)
-{
-    for (std::map<Utf8Str, Utf8Str>::const_iterator it = that.mEnvironment.begin();
-         it != that.mEnvironment.end();
-         ++it)
-    {
-        mEnvironment[it->first] = it->second;
-    }
-
-    return *this;
-}
-
-/**
- * Appends environment variables to the environment block.
- *
- * Each var=value pair is separated by the null character ('\\0').  The whole
- * block will be stored in one blob and disassembled on the guest side later to
- * fit into the HGCM param structure.
- *
- * @returns VBox status code.
- *
- * @param   pszEnvVar       The environment variable=value to append to the
- *                          environment block.
- * @param   ppvList         This is actually a pointer to a char pointer
- *                          variable which keeps track of the environment block
- *                          that we're constructing.
- * @param   pcbList         Pointer to the variable holding the current size of
- *                          the environment block.  (List is a misnomer, go
- *                          ahead a be confused.)
- * @param   pcEnvVars       Pointer to the variable holding count of variables
- *                          stored in the environment block.
- */
-int GuestEnvironment::appendToEnvBlock(const char *pszEnv, void **ppvList, size_t *pcbList, uint32_t *pcEnvVars)
-{
-    int rc = VINF_SUCCESS;
-    size_t cchEnv = strlen(pszEnv); Assert(cchEnv >= 2);
-    if (*ppvList)
-    {
-        size_t cbNewLen = *pcbList + cchEnv + 1; /* Include zero termination. */
-        char *pvTmp = (char *)RTMemRealloc(*ppvList, cbNewLen);
-        if (pvTmp == NULL)
-            rc = VERR_NO_MEMORY;
-        else
-        {
-            memcpy(pvTmp + *pcbList, pszEnv, cchEnv);
-            pvTmp[cbNewLen - 1] = '\0'; /* Add zero termination. */
-            *ppvList = (void **)pvTmp;
-        }
-    }
-    else
-    {
-        char *pszTmp;
-        if (RTStrAPrintf(&pszTmp, "%s", pszEnv) >= 0)
-        {
-            *ppvList = (void **)pszTmp;
-            /* Reset counters. */
-            *pcEnvVars = 0;
-            *pcbList = 0;
-        }
-    }
-    if (RT_SUCCESS(rc))
-    {
-        *pcbList += cchEnv + 1; /* Include zero termination. */
-        *pcEnvVars += 1;        /* Increase env variable count. */
-    }
-    return rc;
-}
 
 int GuestFsObjData::FromLs(const GuestProcessStreamBlock &strmBlk)
 {
@@ -311,7 +62,7 @@ int GuestFsObjData::FromLs(const GuestProcessStreamBlock &strmBlk)
             mType = FsObjType_Directory;
         /** @todo Add more types! */
         else
-            mType = FsObjType_Undefined;
+            mType = FsObjType_Unknown;
         /* Object size. */
         rc = strmBlk.GetInt64Ex("st_size", &mObjectSize);
         if (RT_FAILURE(rc)) throw rc;
@@ -377,7 +128,7 @@ int GuestFsObjData::FromStat(const GuestProcessStreamBlock &strmBlk)
             mType = FsObjType_Directory;
         /** @todo Add more types! */
         else
-            mType = FsObjType_Undefined;
+            mType = FsObjType_Unknown;
         /* Object size. */
         rc = strmBlk.GetInt64Ex("st_size", &mObjectSize);
         if (RT_FAILURE(rc)) throw rc;
@@ -406,7 +157,7 @@ GuestProcessStreamBlock::GuestProcessStreamBlock(void)
 GuestProcessStreamBlock::GuestProcessStreamBlock(const GuestProcessStreamBlock &otherBlock)
 {
     for (GuestCtrlStreamPairsIter it = otherBlock.mPairs.begin();
-         it != otherBlock.end(); it++)
+         it != otherBlock.end(); ++it)
     {
         mPairs[it->first] = new
         if (it->second.pszValue)
@@ -439,7 +190,7 @@ void GuestProcessStreamBlock::DumpToLog(void) const
                  this, mPairs.size()));
 
     for (GuestCtrlStreamPairMapIterConst it = mPairs.begin();
-         it != mPairs.end(); it++)
+         it != mPairs.end(); ++it)
     {
         LogFlowFunc(("\t%s=%s\n", it->first.c_str(), it->second.mValue.c_str()));
     }
@@ -1225,7 +976,7 @@ int GuestObject::registerWaitEvent(const GuestEventTypes &lstEvents,
                                    GuestWaitEvent **ppEvent)
 {
     AssertPtr(mSession);
-    return GuestBase::registerWaitEvent(mSession->getId(), mObjectID, lstEvents, ppEvent);
+    return GuestBase::registerWaitEvent(mSession->i_getId(), mObjectID, lstEvents, ppEvent);
 }
 
 int GuestObject::sendCommand(uint32_t uFunction,
@@ -1238,7 +989,7 @@ int GuestObject::sendCommand(uint32_t uFunction,
     int vrc = VERR_HGCM_SERVICE_NOT_FOUND;
 
     /* Forward the information to the VMM device. */
-    VMMDev *pVMMDev = pConsole->getVMMDev();
+    VMMDev *pVMMDev = pConsole->i_getVMMDev();
     if (pVMMDev)
     {
         LogFlowThisFunc(("uFunction=%RU32, uParms=%RU32\n", uFunction, uParms));
diff --git a/src/VBox/Main/src-client/GuestDirectoryImpl.cpp b/src/VBox/Main/src-client/GuestDirectoryImpl.cpp
index 3ee8368..9db7f3a 100644
--- a/src/VBox/Main/src-client/GuestDirectoryImpl.cpp
+++ b/src/VBox/Main/src-client/GuestDirectoryImpl.cpp
@@ -1,11 +1,10 @@
-
 /* $Id: GuestDirectoryImpl.cpp $ */
 /** @file
  * VirtualBox Main - Guest directory handling.
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,6 +19,9 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
+#ifndef VBOX_WITH_GUEST_CONTROL
+# error "VBOX_WITH_GUEST_CONTROL must defined in this file"
+#endif
 #include "GuestDirectoryImpl.h"
 #include "GuestSessionImpl.h"
 #include "GuestCtrlImplPrivate.h"
@@ -72,10 +74,6 @@ int GuestDirectory::init(Console *pConsole, GuestSession *pSession,
     AutoInitSpan autoInitSpan(this);
     AssertReturn(autoInitSpan.isOk(), E_FAIL);
 
-#ifndef VBOX_WITH_GUEST_CONTROL
-    autoInitSpan.setSucceeded();
-    return VINF_SUCCESS;
-#else
     int vrc = bindToSession(pConsole, pSession, uDirID /* Object ID */);
     if (RT_SUCCESS(vrc))
     {
@@ -90,7 +88,7 @@ int GuestDirectory::init(Console *pConsole, GuestSession *pSession,
         /* Start the directory process on the guest. */
         GuestProcessStartupInfo procInfo;
         procInfo.mName      = Utf8StrFmt(tr("Reading directory \"%s\""), openInfo.mPath.c_str());
-        procInfo.mCommand   = Utf8Str(VBOXSERVICE_TOOL_LS);
+        procInfo.mExecutable= Utf8Str(VBOXSERVICE_TOOL_LS);
         procInfo.mTimeoutMS = 5 * 60 * 1000; /* 5 minutes timeout. */
         procInfo.mFlags     = ProcessCreateFlag_WaitForStdOut;
 
@@ -123,7 +121,6 @@ int GuestDirectory::init(Console *pConsole, GuestSession *pSession,
         autoInitSpan.setFailed();
 
     return vrc;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
 /**
@@ -142,37 +139,27 @@ void GuestDirectory::uninit(void)
     LogFlowThisFuncLeave();
 }
 
-// implementation of public getters/setters for attributes
+// implementation of private wrapped getters/setters for attributes
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP GuestDirectory::COMGETTER(DirectoryName)(BSTR *aName)
+HRESULT GuestDirectory::getDirectoryName(com::Utf8Str &aDirectoryName)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mOpenInfo.mPath.cloneTo(aName);
+    aDirectoryName = mData.mOpenInfo.mPath;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestDirectory::COMGETTER(Filter)(BSTR *aFilter)
+HRESULT GuestDirectory::getFilter(com::Utf8Str &aFilter)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aFilter);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mOpenInfo.mFilter.cloneTo(aFilter);
+    aFilter = mData.mOpenInfo.mFilter;
 
     return S_OK;
 }
@@ -180,7 +167,7 @@ STDMETHODIMP GuestDirectory::COMGETTER(Filter)(BSTR *aFilter)
 // private methods
 /////////////////////////////////////////////////////////////////////////////
 
-int GuestDirectory::callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int GuestDirectory::i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCb, VERR_INVALID_POINTER);
@@ -228,7 +215,7 @@ int GuestDirectory::callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUES
 }
 
 /* static */
-Utf8Str GuestDirectory::guestErrorToString(int guestRc)
+Utf8Str GuestDirectory::i_guestErrorToString(int guestRc)
 {
     Utf8Str strError;
 
@@ -251,7 +238,7 @@ Utf8Str GuestDirectory::guestErrorToString(int guestRc)
  * Called by IGuestSession right before this directory gets
  * removed from the public directory list.
  */
-int GuestDirectory::onRemove(void)
+int GuestDirectory::i_onRemove(void)
 {
     LogFlowThisFuncEnter();
 
@@ -262,22 +249,18 @@ int GuestDirectory::onRemove(void)
 }
 
 /* static */
-HRESULT GuestDirectory::setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
+HRESULT GuestDirectory::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
 {
     AssertPtr(pInterface);
     AssertMsg(RT_FAILURE(guestRc), ("Guest rc does not indicate a failure when setting error\n"));
 
-    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestDirectory::guestErrorToString(guestRc).c_str());
+    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestDirectory::i_guestErrorToString(guestRc).c_str());
 }
 
 // implementation of public methods
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP GuestDirectory::Close(void)
+HRESULT GuestDirectory::close()
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
     AutoCaller autoCaller(this);
@@ -286,13 +269,13 @@ STDMETHODIMP GuestDirectory::Close(void)
     HRESULT hr = S_OK;
 
     int guestRc;
-    int rc = mData.mProcessTool.Terminate(30 * 1000, &guestRc);
+    int rc = mData.mProcessTool.i_terminate(30 * 1000, &guestRc);
     if (RT_FAILURE(rc))
     {
         switch (rc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             case VERR_NOT_SUPPORTED:
@@ -309,20 +292,16 @@ STDMETHODIMP GuestDirectory::Close(void)
     }
 
     AssertPtr(mSession);
-    int rc2 = mSession->directoryRemoveFromList(this);
+    int rc2 = mSession->i_directoryRemoveFromList(this);
     if (RT_SUCCESS(rc))
         rc = rc2;
 
     LogFlowThisFunc(("Returning rc=%Rrc\n", rc));
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestDirectory::Read(IFsObjInfo **aInfo)
+HRESULT GuestDirectory::read(ComPtr<IFsObjInfo> &aObjInfo)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
     AutoCaller autoCaller(this);
@@ -331,17 +310,17 @@ STDMETHODIMP GuestDirectory::Read(IFsObjInfo **aInfo)
     GuestProcessStreamBlock curBlock;
     int guestRc;
 
-    int rc = mData.mProcessTool.WaitEx(GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK,
-                                       &curBlock, &guestRc);
+    int rc = mData.mProcessTool.i_waitEx(GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK,
+                                         &curBlock, &guestRc);
 
     /*
      * Note: The guest process can still be around to serve the next
      *       upcoming stream block next time.
      */
     if (   RT_SUCCESS(rc)
-        && !mData.mProcessTool.IsRunning())
+        && !mData.mProcessTool.i_isRunning())
     {
-        rc = mData.mProcessTool.TerminatedOk(NULL /* Exit code */);
+        rc = mData.mProcessTool.i_terminatedOk(NULL /* Exit code */);
         if (rc == VERR_NOT_EQUAL)
             rc = VERR_ACCESS_DENIED;
     }
@@ -369,7 +348,7 @@ STDMETHODIMP GuestDirectory::Read(IFsObjInfo **aInfo)
                 if (RT_SUCCESS(rc))
                 {
                     /* Return info object to the caller. */
-                    hr2 = pFsObjInfo.queryInterfaceTo(aInfo);
+                    hr2 = pFsObjInfo.queryInterfaceTo(aObjInfo.asOutParam());
                     if (FAILED(hr2))
                         rc = VERR_COM_UNEXPECTED;
                 }
@@ -389,7 +368,7 @@ STDMETHODIMP GuestDirectory::Read(IFsObjInfo **aInfo)
         switch (rc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             case VERR_ACCESS_DENIED:
@@ -417,6 +396,5 @@ STDMETHODIMP GuestDirectory::Read(IFsObjInfo **aInfo)
 
     LogFlowThisFunc(("Returning rc=%Rrc\n", rc));
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
diff --git a/src/VBox/Main/src-client/GuestDnDImpl.cpp b/src/VBox/Main/src-client/GuestDnDImpl.cpp
deleted file mode 100644
index 6732e16..0000000
--- a/src/VBox/Main/src-client/GuestDnDImpl.cpp
+++ /dev/null
@@ -1,995 +0,0 @@
-/* $Id: GuestDnDImpl.cpp $ */
-/** @file
- * VirtualBox COM class implementation: Guest Drag and Drop parts
- */
-
-/*
- * Copyright (C) 2011-2012 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include "GuestImpl.h"
-#include "AutoCaller.h"
-
-#ifdef VBOX_WITH_DRAG_AND_DROP
-# include "ConsoleImpl.h"
-# include "ProgressImpl.h"
-# include "GuestDnDImpl.h"
-
-# include <VMMDev.h>
-
-# include <VBox/com/list.h>
-# include <VBox/HostServices/DragAndDropSvc.h>
-
-# include <iprt/stream.h>
-# include <iprt/semaphore.h>
-# include <iprt/cpp/utils.h>
-
-/* How does this work:
- *
- * Drag and Drop is handled over the internal HGCM service for the host <->
- * guest communication. Beside that we need to map the Drag and Drop protocols
- * of the various OS's we support to our internal channels, this is also highly
- * communicative in both directions. Unfortunately HGCM isn't really designed
- * for that. Next we have to foul some of the components. This includes to
- * trick X11 on the guest side, but also Qt needs to be tricked on the host
- * side a little bit.
- *
- * The following components are involved:
- *
- * 1. GUI: Uses the Qt classes for Drag and Drop and mainly forward the content
- *    of it to the Main IGuest interface (see UIDnDHandler.cpp).
- * 2. Main: Public interface for doing Drag and Drop. Also manage the IProgress
- *    interfaces for blocking the caller by showing a progress dialog. (see
- *    this file)
- * 3. HGCM service: Handle all messages from the host to the guest at once and
- *    encapsulate the internal communication details. (see dndmanager.cpp and
- *    friends)
- * 4. Guest additions: Split into the platform neutral part (see
- *    VBoxGuestR3LibDragAndDrop.cpp) and the guest OS specific parts.
- *    Receive/send message from/to the HGCM service and does all guest specific
- *    operations. Currently only X11 is supported. (see draganddrop.cpp within
- *    VBoxClient)
- *
- * Host  -> Guest:
- * 1. There are DnD Enter, Move, Leave events which are send exactly like this
- *    to the guest. The info includes the pos, mimetypes and allowed actions.
- *    The guest has to respond with an action it would accept, so the GUI could
- *    change the cursor.
- * 2. On drop, first a drop event is send. If this is accepted a drop data
- *    event follows. This blocks the GUI and shows some progress indicator.
- *
- * Guest -> Host:
- * 1. The GUI is asking the guest if a DnD event is pending when the user moves
- *    the cursor out of the view window. If so, this returns the mimetypes and
- *    allowed actions.
- * (2. On every mouse move this is asked again, to make sure the DnD event is
- *     still valid.)
- * 3. On drop the host request the data from the guest. This blocks the GUI and
- *    shows some progress indicator.
- *
- * Some hints:
- * m_sstrAllowedMimeTypes here in this file defines the allowed mime-types.
- * This is necessary because we need special handling for some of the
- * mime-types. E.g. for URI lists we need to transfer the actual dirs and
- * files. Text EOL may to be changed. Also unknown mime-types may need special
- * handling as well, which may lead to undefined behavior in the host/guest, if
- * not done.
- *
- * Dropping of a directory, means recursively transferring _all_ the content.
- *
- * Directories and files are placed into a public visible user directory on the
- * guest (~/Documents/VirtualBox Dropped Files). We can't delete them after the
- * DnD operation, because we didn't know what the DnD target does with it. E.g.
- * it could just be opened in place. This could lead ofc to filling up the disk
- * within the guest. To inform the user about this, a small app could be
- * developed which scans this directory regularly and inform the user with a
- * tray icon hint (and maybe the possibility to clean this up instantly). The
- * same has to be done in the G->H direction when it is implemented.
- *
- * Of course only regularly files are supported. Symlinks are resolved and
- * transfered as regularly files. First we don't know if the other side support
- * symlinks at all and second they could point to somewhere in a directory tree
- * which not exists on the other side.
- *
- * The code tries to preserve the file modes of the transfered dirs/files. This
- * is useful (and maybe necessary) for two things:
- * 1. If a file is executable, it should be also after the transfer, so the
- *    user can just execute it, without manually tweaking the modes first.
- * 2. If a dir/file is not accessible by group/others in the host, it shouldn't
- *    be in the guest.
- * In any case, the user mode is always set to rwx (so that we can access it
- * ourself, in e.g. for a cleanup case after cancel).
- *
- * Cancel is supported in both directions and cleans up all previous steps
- * (thats is: deleting already transfered dirs/files).
- *
- * There are a lot of DO (debug output) calls in the code. This could be
- * disabled, but should be removed (or replaced by Log calls) when this is
- * nearly finished.
- *
- * For Windows guests there could be different communication become necessary.
- * So the current interface isn't set in stone and should be made public only,
- * after someone had deeply looked into the Win guest support. See
- * http://www.catch22.net/tuts/dragdrop for a start.
- *
- * How to test:
- * First set VBOX_WITH_DRAG_AND_DROP=1 in LocalConfig.kmk. The best is if the
- * host match the guest OS arch. Just build the tree and point a shared folder
- * within the guest to the additions subfolder in bin. Start the guest and
- * execute ./VBoxClient --dragandrop --nodaemon within this shared folder. You
- * should now be able of dragging text or files to the guest. I used a 64bit
- * Linux for both the host and the guest. If the archs don't match, you need to
- * first setup a build environment in the guest ofc.
- *
- * In general I propose the following changes in the VBox HGCM infrastructure
- * for the future:
- * - Currently it isn't really possible to send messages to the guest from the
- *   host. The host informs the guest just that there is something, the guest
- *   than has to ask which message and depending on that send the appropriate
- *   message to the host, which is filled with the right data.
- * - There is no generic interface for sending bigger memory blocks to/from the
- *   guest. This is now done here, but I guess was also necessary for e.g.
- *   guest execution. So something generic which brake this up into smaller
- *   blocks and send it would be nice (with all the error handling and such
- *   ofc).
- * - I developed a "protocol" for the DnD communication here. So the host and
- *   the guest have always to match in the revision. This is ofc bad, because
- *   the additions could be outdated easily. So some generic protocol number
- *   support in HGCM for asking the host and the guest of the support version,
- *   would be nice. Ofc at least the host should be able to talk to the guest,
- *   even when the version is below the host one.
- * All this stuff would be useful for the current services, but also for future
- * onces.
- *
- * Todo:
- * - Dragging out of the guest (partly done)
- *   - ESC doesn't really work
- *   - transfer of URIs (that is the files and patching of the data)
- *   - testing in a multi monitor setup
- *   ... in any case it seems a little bit difficult to handle from the Qt
- *   side. Maybe also a host specific implementation becomes necessary ...
- *   this would be really worst ofc.
- * - Win guest support (maybe there have to be done a mapping between the
- *   official mime-types and Win Clipboard formats (see QWindowsMime, for an
- *   idea), for VBox internally only mime-types should be used)
- * - EOL handling on text (should be shared with the clipboard code)
- * - add configuration (GH, HG, Bidirectional, None), like for the clipboard
- * - HG->GH and GH->HG-switch: Handle the case the user drags something out of
- *   the guest and than return to the source view (or another window in the
- *   multiple guest screen scenario).
- * - add support for more mime-types (especially images, csv)
- * - test unusual behavior:
- *   - DnD service crash in the guest during a DnD op (e.g. crash of VBoxClient or X11)
- *   - not expected order of the events between HGCM and the guest
- * - Security considerations: We transfer a lot of memory between the guest and
- *   the host and even allow the creation of dirs/files. Maybe there should be
- *   limits introduced to preventing DOS attacks or filling up all the memory
- *   (both in the host and the guest).
- * - test, test, test ...
- */
-
-class DnDGuestResponse
-{
-public:
-    DnDGuestResponse(const ComObjPtr<Guest>& pGuest);
-    ~DnDGuestResponse();
-
-    int notifyAboutGuestResponse();
-    int waitForGuestResponse();
-
-    void setDefAction(uint32_t a) { m_defAction = a; }
-    uint32_t defAction() const { return m_defAction; }
-
-    void setAllActions(uint32_t a) { m_allActions = a; }
-    uint32_t allActions() const { return m_allActions; }
-
-    void setFormat(const Utf8Str &strFormat) { m_strFormat = strFormat; }
-    Utf8Str format() const { return m_strFormat; }
-
-    int addData(void *pvData, uint32_t cbData, uint32_t *pcbCurSize);
-    void resetData();
-    void data(void **ppvData, uint32_t *pcbData) const { *ppvData = m_pvData; *pcbData = m_cbData; }
-    bool hasData() const { return m_pvData != NULL; }
-
-    int setProgress(unsigned uPercentage, uint32_t uState, int rcOp = VINF_SUCCESS);
-    HRESULT resetProgress(const ComObjPtr<Guest>& pParent);
-    HRESULT queryProgressTo(IProgress **ppProgress);
-
-private:
-    RTSEMEVENT           m_EventSem;
-    uint32_t             m_defAction;
-    uint32_t             m_allActions;
-    Utf8Str              m_strFormat;
-    void                *m_pvData;
-    uint32_t             m_cbData;
-
-    ComObjPtr<Guest>     m_parent;
-    ComObjPtr<Progress>  m_progress;
-};
-
-class GuestDnDPrivate
-{
-private:
-    /* todo: currently we only support one response. Maybe this needs to be extended at some time. */
-    GuestDnDPrivate(GuestDnD *q, const ComObjPtr<Guest>& pGuest)
-        : q_ptr(q)
-        , p(pGuest)
-        , m_pDnDResponse(new DnDGuestResponse(pGuest))
-    {}
-    ~GuestDnDPrivate() { delete m_pDnDResponse; }
-
-    DnDGuestResponse *response() const { return m_pDnDResponse; }
-
-    void adjustCoords(ULONG uScreenId, ULONG *puX, ULONG *puY) const;
-    void hostCall(const char* psczFunction, uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms) const;
-
-    /* Static helper */
-    static RTCString           toFormatString(ComSafeArrayIn(IN_BSTR, formats));
-    static void                toFormatSafeArray(const RTCString &strFormats, ComSafeArrayOut(BSTR, formats));
-
-    static DragAndDropAction_T toMainAction(uint32_t uAction);
-    static void                toMainActions(uint32_t uActions, ComSafeArrayOut(DragAndDropAction_T, actions));
-    static uint32_t            toHGCMAction(DragAndDropAction_T action);
-    static void                toHGCMActions(DragAndDropAction_T inDefAction, uint32_t *pOutDefAction, ComSafeArrayIn(DragAndDropAction_T, inAllowedActions), uint32_t *pOutAllowedActions);
-
-    /* Private q and parent pointer */
-    GuestDnD                        *q_ptr;
-    ComObjPtr<Guest>                 p;
-
-    /* Private helper members */
-    static const RTCList<RTCString>  m_sstrAllowedMimeTypes;
-    DnDGuestResponse                *m_pDnDResponse;
-
-    friend class GuestDnD;
-};
-
-/* What mime-types are supported by VirtualBox.
- * Note: If you add something here, make sure you test it with all guest OS's!
- */
-/* static */
-const RTCList<RTCString> GuestDnDPrivate::m_sstrAllowedMimeTypes = RTCList<RTCString>()
-    /* Uri's */
-    << "text/uri-list"
-    /* Text */
-    << "text/plain;charset=utf-8"
-    << "UTF8_STRING"
-    << "text/plain"
-    << "COMPOUND_TEXT"
-    << "TEXT"
-    << "STRING"
-    /* OpenOffice formates */
-    << "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\""
-    << "application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"";
-
-DnDGuestResponse::DnDGuestResponse(const ComObjPtr<Guest>& pGuest)
-  : m_EventSem(NIL_RTSEMEVENT)
-  , m_defAction(0)
-  , m_allActions(0)
-  , m_pvData(0)
-  , m_cbData(0)
-  , m_parent(pGuest)
-{
-    int rc = RTSemEventCreate(&m_EventSem);
-    AssertRC(rc);
-}
-
-DnDGuestResponse::~DnDGuestResponse()
-{
-    resetData();
-    int rc = RTSemEventDestroy(m_EventSem);
-    AssertRC(rc);
-}
-
-int DnDGuestResponse::notifyAboutGuestResponse()
-{
-    return RTSemEventSignal(m_EventSem);
-}
-
-int DnDGuestResponse::waitForGuestResponse()
-{
-    return RTSemEventWait(m_EventSem, 300);
-}
-
-int DnDGuestResponse::addData(void *pvData, uint32_t cbData, uint32_t *pcbCurSize)
-{
-    int rc = VINF_SUCCESS;
-    m_pvData = RTMemRealloc(m_pvData, m_cbData + cbData);
-    if (m_pvData)
-    {
-        memcpy(&static_cast<uint8_t*>(m_pvData)[m_cbData], pvData, cbData);
-        m_cbData    += cbData;
-        *pcbCurSize  = m_cbData;
-    }
-    else
-        rc = VERR_NO_MEMORY;
-
-    return rc;
-}
-
-void DnDGuestResponse::resetData()
-{
-    if (m_pvData)
-    {
-        RTMemFree(m_pvData);
-        m_pvData = NULL;
-    }
-    m_cbData = 0;
-}
-
-HRESULT DnDGuestResponse::resetProgress(const ComObjPtr<Guest>& pParent)
-{
-    m_progress.setNull();
-    HRESULT rc = m_progress.createObject();
-    if (SUCCEEDED(rc))
-    {
-        rc = m_progress->init(static_cast<IGuest*>(pParent),
-                              Bstr(pParent->tr("Dropping data")).raw(),
-                              TRUE);
-    }
-    return rc;
-}
-
-int DnDGuestResponse::setProgress(unsigned uPercentage, uint32_t uState, int rcOp /* = VINF_SUCCESS */)
-{
-    int vrc = VINF_SUCCESS;
-    HRESULT rc;
-    if (!m_progress.isNull())
-    {
-        BOOL fCompleted;
-        rc = m_progress->COMGETTER(Completed)(&fCompleted);
-        if (!fCompleted)
-        {
-            if (uState == DragAndDropSvc::DND_PROGRESS_ERROR)
-                rc = m_progress->notifyComplete(E_FAIL,
-                                                COM_IIDOF(IGuest),
-                                                m_parent->getComponentName(),
-                                                m_parent->tr("Guest error (%Rrc)"), rcOp);
-            else if (uState == DragAndDropSvc::DND_PROGRESS_CANCELLED)
-                rc = m_progress->notifyComplete(S_OK);
-            else
-            {
-                rc = m_progress->SetCurrentOperationProgress(uPercentage);
-                if (   uState      == DragAndDropSvc::DND_PROGRESS_COMPLETE
-                    || uPercentage >= 100)
-                    rc = m_progress->notifyComplete(S_OK);
-            }
-        }
-        BOOL fCanceled = FALSE;
-        rc = m_progress->COMGETTER(Canceled)(&fCanceled);
-        if (fCanceled)
-            vrc = VERR_CANCELLED;
-    }
-    return vrc;
-}
-
-HRESULT DnDGuestResponse::queryProgressTo(IProgress **ppProgress)
-{
-    return m_progress.queryInterfaceTo(ppProgress);
-}
-
-void GuestDnDPrivate::adjustCoords(ULONG uScreenId, ULONG *puX, ULONG *puY) const
-{
-    /* For multi-monitor support we need to add shift values to the coordinates
-     * (depending on the screen number). */
-    ComPtr<IDisplay> pDisplay;
-    HRESULT rc = p->mParent->COMGETTER(Display)(pDisplay.asOutParam());
-    if (FAILED(rc)) throw rc;
-    ComPtr<IFramebuffer> pFramebuffer;
-    LONG xShift, yShift;
-    rc = pDisplay->GetFramebuffer(uScreenId, pFramebuffer.asOutParam(), &xShift, &yShift);
-    if (FAILED(rc)) throw rc;
-    *puX += xShift;
-    *puY += yShift;
-}
-
-void GuestDnDPrivate::hostCall(const char* psczFunction, uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms) const
-{
-    VMMDev *vmmDev = 0;
-    {
-        /* Make sure mParent is valid, so set the read lock while using.
-         * Do not keep this lock while doing the actual call, because in the meanwhile
-         * another thread could request a write lock which would be a bad idea ... */
-        AutoReadLock alock(p COMMA_LOCKVAL_SRC_POS);
-
-        /* Forward the information to the VMM device. */
-        AssertPtr(p->mParent);
-        vmmDev = p->mParent->getVMMDev();
-    }
-
-    if (!vmmDev)
-        throw p->setError(VBOX_E_VM_ERROR,
-                          p->tr("VMM device is not available (is the VM running?)"));
-
-    LogFlowFunc(("hgcmHostCall msg=%s; numParms=%u\n", psczFunction, u32Function));
-    int vrc = vmmDev->hgcmHostCall("VBoxDragAndDropSvc",
-                                   u32Function,
-                                   cParms, paParms);
-    if (RT_FAILURE(vrc))
-    {
-        LogFlowFunc(("hgcmHostCall error: %Rrc\n", vrc));
-        throw p->setError(VBOX_E_VM_ERROR,
-                          p->tr("hgcmHostCall failed (%Rrc)"), vrc);
-    }
-}
-
-/* static */
-RTCString GuestDnDPrivate::toFormatString(ComSafeArrayIn(IN_BSTR, formats))
-{
-    const RTCList<Utf8Str> formatList(ComSafeArrayInArg(formats));
-    RTCString strFormat;
-    for (size_t i = 0; i < formatList.size(); ++i)
-    {
-        const RTCString &f = formatList.at(i);
-        /* Only keep allowed format types. */
-        if (m_sstrAllowedMimeTypes.contains(f))
-            strFormat += f + "\r\n";
-    }
-    return strFormat;
-}
-
-/* static */
-void GuestDnDPrivate::toFormatSafeArray(const RTCString &strFormats, ComSafeArrayOut(BSTR, formats))
-{
-    RTCList<RTCString> list = strFormats.split("\r\n");
-    size_t i = 0;
-    while (i < list.size())
-    {
-        /* Only keep allowed format types. */
-        if (!m_sstrAllowedMimeTypes.contains(list.at(i)))
-            list.removeAt(i);
-        else
-            ++i;
-    }
-    /* Create a safe array out of the cleaned list. */
-    com::SafeArray<BSTR> sfaFormats(list.size());
-    for (i = 0; i < list.size(); ++i)
-    {
-        const RTCString &f = list.at(i);
-        if (m_sstrAllowedMimeTypes.contains(f))
-        {
-            Bstr bstr(f);
-            bstr.detachTo(&sfaFormats[i]);
-        }
-    }
-    sfaFormats.detachTo(ComSafeArrayOutArg(formats));
-}
-
-/* static */
-uint32_t GuestDnDPrivate::toHGCMAction(DragAndDropAction_T action)
-{
-    uint32_t a = DND_IGNORE_ACTION;
-    switch (action)
-    {
-        case DragAndDropAction_Copy:   a = DND_COPY_ACTION; break;
-        case DragAndDropAction_Move:   a = DND_MOVE_ACTION; break;
-        case DragAndDropAction_Link:   /* For now it doesn't seems useful to allow a link action between host & guest. Maybe later! */
-        case DragAndDropAction_Ignore: /* Ignored */ break;
-        default: AssertMsgFailed(("Action %u not recognized!\n", action)); break;
-    }
-    return a;
-}
-
-/* static */
-void GuestDnDPrivate::toHGCMActions(DragAndDropAction_T inDefAction, uint32_t *pOutDefAction, ComSafeArrayIn(DragAndDropAction_T, inAllowedActions), uint32_t *pOutAllowedActions)
-{
-    const com::SafeArray<DragAndDropAction_T> sfaInActions(ComSafeArrayInArg(inAllowedActions));
-
-    /* Defaults */
-    *pOutDefAction = toHGCMAction(inDefAction);;
-    *pOutAllowedActions = DND_IGNORE_ACTION;
-
-    /* First convert the allowed actions to a bit array. */
-    for (size_t i = 0; i < sfaInActions.size(); ++i)
-        *pOutAllowedActions |= toHGCMAction(sfaInActions[i]);
-
-    /* Second check if the default action is a valid action and if not so try
-     * to find an allowed action. */
-    if (isDnDIgnoreAction(*pOutDefAction))
-    {
-        if (hasDnDCopyAction(*pOutAllowedActions))
-            *pOutDefAction = DND_COPY_ACTION;
-        else if (hasDnDMoveAction(*pOutAllowedActions))
-            *pOutDefAction = DND_MOVE_ACTION;
-    }
-}
-
-/* static */
-DragAndDropAction_T GuestDnDPrivate::toMainAction(uint32_t uAction)
-{
-    /* For now it doesn't seems useful to allow a link action between host & guest. Maybe later! */
-    return (isDnDCopyAction(uAction) ? (DragAndDropAction_T)DragAndDropAction_Copy :
-            isDnDMoveAction(uAction) ? (DragAndDropAction_T)DragAndDropAction_Move :
-            (DragAndDropAction_T)DragAndDropAction_Ignore);
-}
-
-/* static */
-void GuestDnDPrivate::toMainActions(uint32_t uActions, ComSafeArrayOut(DragAndDropAction_T, actions))
-{
-    /* For now it doesn't seems useful to allow a link action between host & guest. Maybe later! */
-    RTCList<DragAndDropAction_T> list;
-    if (hasDnDCopyAction(uActions))
-        list.append(DragAndDropAction_Copy);
-    if (hasDnDMoveAction(uActions))
-        list.append(DragAndDropAction_Move);
-
-    com::SafeArray<DragAndDropAction_T> sfaActions(list.size());
-    for (size_t i = 0; i < list.size(); ++i)
-        sfaActions[i] = list.at(i);
-    sfaActions.detachTo(ComSafeArrayOutArg(actions));
-}
-
-GuestDnD::GuestDnD(const ComObjPtr<Guest>& pGuest)
-    : d_ptr(new GuestDnDPrivate(this, pGuest))
-{
-}
-
-GuestDnD::~GuestDnD()
-{
-    delete d_ptr;
-}
-
-HRESULT GuestDnD::dragHGEnter(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), DragAndDropAction_T *pResultAction)
-{
-    DPTR(GuestDnD);
-    const ComObjPtr<Guest> &p = d->p;
-
-    /* Default is ignoring */
-    *pResultAction = DragAndDropAction_Ignore;
-
-    /* Check & convert the drag & drop actions */
-    uint32_t uDefAction      = 0;
-    uint32_t uAllowedActions = 0;
-    d->toHGCMActions(defaultAction, &uDefAction, ComSafeArrayInArg(allowedActions), &uAllowedActions);
-    /* If there is no usable action, ignore this request. */
-    if (isDnDIgnoreAction(uDefAction))
-        return S_OK;
-
-    /* Make a flat data string out of the mime-type list. */
-    RTCString strFormats = d->toFormatString(ComSafeArrayInArg(formats));
-    /* If there is no valid mime-type, ignore this request. */
-    if (strFormats.isEmpty())
-        return S_OK;
-
-    HRESULT rc = S_OK;
-
-    try
-    {
-        /* Adjust the coordinates in a multi-monitor setup. */
-        d->adjustCoords(uScreenId, &uX, &uY);
-
-        VBOXHGCMSVCPARM paParms[7];
-        int i = 0;
-        paParms[i++].setUInt32(uScreenId);
-        paParms[i++].setUInt32(uX);
-        paParms[i++].setUInt32(uY);
-        paParms[i++].setUInt32(uDefAction);
-        paParms[i++].setUInt32(uAllowedActions);
-        paParms[i++].setPointer((void*)strFormats.c_str(), strFormats.length() + 1);
-        paParms[i++].setUInt32(strFormats.length() + 1);
-
-        d->hostCall("HOST_DND_HG_EVT_ENTER",
-                    DragAndDropSvc::HOST_DND_HG_EVT_ENTER,
-                    i,
-                    paParms);
-
-        DnDGuestResponse *pDnD = d->response();
-        /* This blocks until the request is answered (or timeout). */
-        if (pDnD->waitForGuestResponse() == VERR_TIMEOUT)
-            return S_OK;
-
-        /* Copy the response info */
-        *pResultAction = d->toMainAction(pDnD->defAction());
-    }
-    catch (HRESULT rc2)
-    {
-        rc = rc2;
-    }
-
-    return rc;
-}
-
-HRESULT GuestDnD::dragHGMove(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), DragAndDropAction_T *pResultAction)
-{
-    DPTR(GuestDnD);
-    const ComObjPtr<Guest> &p = d->p;
-
-    /* Default is ignoring */
-    *pResultAction = DragAndDropAction_Ignore;
-
-    /* Check & convert the drag & drop actions */
-    uint32_t uDefAction      = 0;
-    uint32_t uAllowedActions = 0;
-    d->toHGCMActions(defaultAction, &uDefAction, ComSafeArrayInArg(allowedActions), &uAllowedActions);
-    /* If there is no usable action, ignore this request. */
-    if (isDnDIgnoreAction(uDefAction))
-        return S_OK;
-
-    /* Make a flat data string out of the mime-type list. */
-    RTCString strFormats = d->toFormatString(ComSafeArrayInArg(formats));
-    /* If there is no valid mime-type, ignore this request. */
-    if (strFormats.isEmpty())
-        return S_OK;
-
-    HRESULT rc = S_OK;
-
-    try
-    {
-        /* Adjust the coordinates in a multi-monitor setup. */
-        d->adjustCoords(uScreenId, &uX, &uY);
-
-        VBOXHGCMSVCPARM paParms[7];
-        int i = 0;
-        paParms[i++].setUInt32(uScreenId);
-        paParms[i++].setUInt32(uX);
-        paParms[i++].setUInt32(uY);
-        paParms[i++].setUInt32(uDefAction);
-        paParms[i++].setUInt32(uAllowedActions);
-        paParms[i++].setPointer((void*)strFormats.c_str(), strFormats.length() + 1);
-        paParms[i++].setUInt32(strFormats.length() + 1);
-
-        d->hostCall("HOST_DND_HG_EVT_MOVE",
-                    DragAndDropSvc::HOST_DND_HG_EVT_MOVE,
-                    i,
-                    paParms);
-
-        DnDGuestResponse *pDnD = d->response();
-        /* This blocks until the request is answered (or timeout). */
-        if (pDnD->waitForGuestResponse() == VERR_TIMEOUT)
-            return S_OK;
-
-        /* Copy the response info */
-        *pResultAction = d->toMainAction(pDnD->defAction());
-    }
-    catch (HRESULT rc2)
-    {
-        rc = rc2;
-    }
-
-    return rc;
-}
-
-HRESULT GuestDnD::dragHGLeave(ULONG uScreenId)
-{
-    DPTR(GuestDnD);
-    const ComObjPtr<Guest> &p = d->p;
-
-    HRESULT rc = S_OK;
-
-    try
-    {
-        d->hostCall("HOST_DND_HG_EVT_LEAVE",
-                    DragAndDropSvc::HOST_DND_HG_EVT_LEAVE,
-                    0,
-                    NULL);
-
-        DnDGuestResponse *pDnD = d->response();
-        /* This blocks until the request is answered (or timeout). */
-        pDnD->waitForGuestResponse();
-    }
-    catch (HRESULT rc2)
-    {
-        rc = rc2;
-    }
-
-    return rc;
-}
-
-HRESULT GuestDnD::dragHGDrop(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), BSTR *pstrFormat, DragAndDropAction_T *pResultAction)
-{
-    DPTR(GuestDnD);
-    const ComObjPtr<Guest> &p = d->p;
-
-    /* Default is ignoring */
-    *pResultAction = DragAndDropAction_Ignore;
-
-    /* Check & convert the drag & drop actions */
-    uint32_t uDefAction      = 0;
-    uint32_t uAllowedActions = 0;
-    d->toHGCMActions(defaultAction, &uDefAction, ComSafeArrayInArg(allowedActions), &uAllowedActions);
-    /* If there is no usable action, ignore this request. */
-    if (isDnDIgnoreAction(uDefAction))
-        return S_OK;
-
-    /* Make a flat data string out of the mime-type list. */
-    RTCString strFormats = d->toFormatString(ComSafeArrayInArg(formats));
-    /* If there is no valid mime-type, ignore this request. */
-    if (strFormats.isEmpty())
-        return S_OK;
-
-    HRESULT rc = S_OK;
-
-    try
-    {
-        /* Adjust the coordinates in a multi-monitor setup. */
-        d->adjustCoords(uScreenId, &uX, &uY);
-
-        VBOXHGCMSVCPARM paParms[7];
-        int i = 0;
-        paParms[i++].setUInt32(uScreenId);
-        paParms[i++].setUInt32(uX);
-        paParms[i++].setUInt32(uY);
-        paParms[i++].setUInt32(uDefAction);
-        paParms[i++].setUInt32(uAllowedActions);
-        paParms[i++].setPointer((void*)strFormats.c_str(), strFormats.length() + 1);
-        paParms[i++].setUInt32(strFormats.length() + 1);
-
-        d->hostCall("HOST_DND_HG_EVT_DROPPED",
-                    DragAndDropSvc::HOST_DND_HG_EVT_DROPPED,
-                    i,
-                    paParms);
-
-        DnDGuestResponse *pDnD = d->response();
-        /* This blocks until the request is answered (or timeout). */
-        if (pDnD->waitForGuestResponse() == VERR_TIMEOUT)
-            return S_OK;
-
-        /* Copy the response info */
-        *pResultAction = d->toMainAction(pDnD->defAction());
-        Bstr(pDnD->format()).cloneTo(pstrFormat);
-    }
-    catch (HRESULT rc2)
-    {
-        rc = rc2;
-    }
-
-    return rc;
-}
-
-HRESULT GuestDnD::dragHGPutData(ULONG uScreenId, IN_BSTR bstrFormat, ComSafeArrayIn(BYTE, data), IProgress **ppProgress)
-{
-    DPTR(GuestDnD);
-    const ComObjPtr<Guest> &p = d->p;
-
-    HRESULT rc = S_OK;
-
-    try
-    {
-        Utf8Str strFormat(bstrFormat);
-        com::SafeArray<BYTE> sfaData(ComSafeArrayInArg(data));
-
-        VBOXHGCMSVCPARM paParms[5];
-        int i = 0;
-        paParms[i++].setUInt32(uScreenId);
-        paParms[i++].setPointer((void*)strFormat.c_str(), (uint32_t)strFormat.length() + 1);
-        paParms[i++].setUInt32((uint32_t)strFormat.length() + 1);
-        paParms[i++].setPointer((void*)sfaData.raw(), (uint32_t)sfaData.size());
-        paParms[i++].setUInt32((uint32_t)sfaData.size());
-
-        DnDGuestResponse *pDnD = d->response();
-        /* Reset any old progress status. */
-        pDnD->resetProgress(p);
-
-        d->hostCall("HOST_DND_HG_SND_DATA",
-                    DragAndDropSvc::HOST_DND_HG_SND_DATA,
-                    i,
-                    paParms);
-
-        /* Query the progress object to the caller. */
-        pDnD->queryProgressTo(ppProgress);
-    }
-    catch (HRESULT rc2)
-    {
-        rc = rc2;
-    }
-
-    return rc;
-}
-
-# ifdef VBOX_WITH_DRAG_AND_DROP_GH
-HRESULT GuestDnD::dragGHPending(ULONG uScreenId, ComSafeArrayOut(BSTR, formats), ComSafeArrayOut(DragAndDropAction_T, allowedActions), DragAndDropAction_T *pDefaultAction)
-{
-    DPTR(GuestDnD);
-    const ComObjPtr<Guest> &p = d->p;
-
-    /* Default is ignoring */
-    *pDefaultAction = DragAndDropAction_Ignore;
-
-    HRESULT rc = S_OK;
-
-    try
-    {
-        VBOXHGCMSVCPARM paParms[1];
-        int i = 0;
-        paParms[i++].setUInt32(uScreenId);
-
-        d->hostCall("HOST_DND_GH_REQ_PENDING",
-                    DragAndDropSvc::HOST_DND_GH_REQ_PENDING,
-                    i,
-                    paParms);
-
-        DnDGuestResponse *pDnD = d->response();
-        /* This blocks until the request is answered (or timeout). */
-        if (pDnD->waitForGuestResponse() == VERR_TIMEOUT)
-            return S_OK;
-
-        if (isDnDIgnoreAction(pDnD->defAction()))
-            return S_OK;
-
-        /* Fetch the default action to use. */
-        *pDefaultAction = d->toMainAction(pDnD->defAction());
-        /* Convert the formats strings to a vector of strings. */
-        d->toFormatSafeArray(pDnD->format(), ComSafeArrayOutArg(formats));
-        /* Convert the action bit field to a vector of actions. */
-        d->toMainActions(pDnD->allActions(), ComSafeArrayOutArg(allowedActions));
-    }
-    catch (HRESULT rc2)
-    {
-        rc = rc2;
-    }
-
-    return rc;
-}
-
-HRESULT GuestDnD::dragGHDropped(IN_BSTR bstrFormat, DragAndDropAction_T action, IProgress **ppProgress)
-{
-    DPTR(GuestDnD);
-    const ComObjPtr<Guest> &p = d->p;
-
-    Utf8Str strFormat(bstrFormat);
-    HRESULT rc = S_OK;
-
-    uint32_t uAction = d->toHGCMAction(action);
-    /* If there is no usable action, ignore this request. */
-    if (isDnDIgnoreAction(uAction))
-        return S_OK;
-
-    try
-    {
-        VBOXHGCMSVCPARM paParms[3];
-        int i = 0;
-        paParms[i++].setPointer((void*)strFormat.c_str(), (uint32_t)strFormat.length() + 1);
-        paParms[i++].setUInt32((uint32_t)strFormat.length() + 1);
-        paParms[i++].setUInt32(uAction);
-
-        DnDGuestResponse *pDnD = d->response();
-        /* Reset any old data and the progress status. */
-        pDnD->resetData();
-        pDnD->resetProgress(p);
-
-        d->hostCall("HOST_DND_GH_EVT_DROPPED",
-                    DragAndDropSvc::HOST_DND_GH_EVT_DROPPED,
-                    i,
-                    paParms);
-
-        /* Query the progress object to the caller. */
-        pDnD->queryProgressTo(ppProgress);
-    }
-    catch (HRESULT rc2)
-    {
-        rc = rc2;
-    }
-
-    return rc;
-}
-
-HRESULT GuestDnD::dragGHGetData(ComSafeArrayOut(BYTE, data))
-{
-    DPTR(GuestDnD);
-    const ComObjPtr<Guest> &p = d->p;
-
-    HRESULT rc = S_OK;
-
-    DnDGuestResponse *pDnD = d->response();
-    /* Is there data at all? */
-    if (pDnD->hasData())
-    {
-        /* Copy the data into an safe array of bytes. */
-        void     *pvData = 0;
-        uint32_t  cbData = 0;
-        pDnD->data(&pvData, &cbData);
-        com::SafeArray<BYTE> sfaData(cbData);
-        memcpy(sfaData.raw(), pvData, cbData);
-        sfaData.detachTo(ComSafeArrayOutArg(data));
-        /* Delete the data. */
-        pDnD->resetData();
-    }
-    else
-        rc = VBOX_E_INVALID_OBJECT_STATE;
-
-    return rc;
-}
-
-# endif /* VBOX_WITH_DRAG_AND_DROP_GH */
-
-DECLCALLBACK(int) GuestDnD::notifyGuestDragAndDropEvent(void *pvExtension, uint32_t u32Function, void *pvParms, uint32_t cbParms)
-{
-    ComObjPtr<Guest> pGuest = reinterpret_cast<Guest*>(pvExtension);
-    if (!pGuest->m_pGuestDnD)
-        return VINF_SUCCESS;
-
-    GuestDnDPrivate *d = static_cast<GuestDnDPrivate*>(pGuest->m_pGuestDnD->d_ptr);
-    const ComObjPtr<Guest> &p = d->p;
-
-    DnDGuestResponse *pDnD = d->response();
-    if (pDnD == NULL)
-        return VERR_INVALID_PARAMETER;
-
-    int rc = VINF_SUCCESS;
-    switch (u32Function)
-    {
-        case DragAndDropSvc::GUEST_DND_HG_ACK_OP:
-        {
-            DragAndDropSvc::PVBOXDNDCBHGACKOPDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBHGACKOPDATA>(pvParms);
-            AssertPtr(pCBData);
-            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGACKOPDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
-            pDnD->setDefAction(pCBData->uAction);
-            rc = pDnD->notifyAboutGuestResponse();
-            break;
-        }
-        case DragAndDropSvc::GUEST_DND_HG_REQ_DATA:
-        {
-            DragAndDropSvc::PVBOXDNDCBHGREQDATADATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBHGREQDATADATA>(pvParms);
-            AssertPtr(pCBData);
-            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGREQDATADATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_REQ_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
-            pDnD->setFormat(pCBData->pszFormat);
-            rc = pDnD->notifyAboutGuestResponse();
-            break;
-        }
-        case DragAndDropSvc::GUEST_DND_HG_EVT_PROGRESS:
-        {
-            DragAndDropSvc::PVBOXDNDCBHGEVTPROGRESSDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBHGEVTPROGRESSDATA>(pvParms);
-            AssertPtr(pCBData);
-            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGEVTPROGRESSDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_EVT_PROGRESS == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
-            rc = pDnD->setProgress(pCBData->uPercentage, pCBData->uState);
-            break;
-        }
-#ifdef VBOX_WITH_DRAG_AND_DROP_GH
-        case DragAndDropSvc::GUEST_DND_GH_ACK_PENDING:
-        {
-            DragAndDropSvc::PVBOXDNDCBGHACKPENDINGDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBGHACKPENDINGDATA>(pvParms);
-            AssertPtr(pCBData);
-            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBGHACKPENDINGDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_ACK_PENDING == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
-            pDnD->setFormat(pCBData->pszFormat);
-            pDnD->setDefAction(pCBData->uDefAction);
-            pDnD->setAllActions(pCBData->uAllActions);
-            rc = pDnD->notifyAboutGuestResponse();
-            break;
-        }
-        case DragAndDropSvc::GUEST_DND_GH_SND_DATA:
-        {
-            DragAndDropSvc::PVBOXDNDCBSNDDATADATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBSNDDATADATA>(pvParms);
-            AssertPtr(pCBData);
-            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBSNDDATADATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
-            uint32_t cbCurSize = 0;
-            pDnD->addData(pCBData->pvData, pCBData->cbData, &cbCurSize);
-            rc = pDnD->setProgress(100.0 / pCBData->cbAllSize * cbCurSize, (pCBData->cbAllSize == cbCurSize ? DragAndDropSvc::DND_PROGRESS_COMPLETE : DragAndDropSvc::DND_PROGRESS_RUNNING));
-            /* Todo: for now we instantly confirm the cancel. Check if the
-             * guest should first clean up stuff itself and than really confirm
-             * the cancel request by an extra message. */
-            if (rc == VERR_CANCELLED)
-                pDnD->setProgress(100, DragAndDropSvc::DND_PROGRESS_CANCELLED);
-            break;
-        }
-        case DragAndDropSvc::GUEST_DND_GH_EVT_ERROR:
-        {
-            DragAndDropSvc::PVBOXDNDCBEVTERRORDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBEVTERRORDATA>(pvParms);
-            AssertPtr(pCBData);
-            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER);
-            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
-            /* Cleanup */
-            pDnD->resetData();
-            rc = pDnD->setProgress(100, DragAndDropSvc::DND_PROGRESS_ERROR, pCBData->rc);
-            break;
-        }
-#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
-        default: AssertMsgFailedReturn(("Function %u not recognized!\n", u32Function), VERR_INVALID_PARAMETER); break;
-    }
-
-    return rc;
-}
-
-#endif /* VBOX_WITH_DRAG_AND_DROP */
-
diff --git a/src/VBox/Main/src-client/GuestDnDPrivate.cpp b/src/VBox/Main/src-client/GuestDnDPrivate.cpp
new file mode 100644
index 0000000..d9499a4
--- /dev/null
+++ b/src/VBox/Main/src-client/GuestDnDPrivate.cpp
@@ -0,0 +1,929 @@
+/* $Id: GuestDnDPrivate.cpp $ */
+/** @file
+ * Private guest drag and drop code, used by GuestDnDTarget +
+ * GuestDnDSource.
+ */
+
+/*
+ * Copyright (C) 2011-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "GuestImpl.h"
+#include "AutoCaller.h"
+
+#ifdef VBOX_WITH_DRAG_AND_DROP
+# include "ConsoleImpl.h"
+# include "ProgressImpl.h"
+# include "GuestDnDPrivate.h"
+
+# include <algorithm>
+
+# include <iprt/dir.h>
+# include <iprt/path.h>
+# include <iprt/stream.h>
+# include <iprt/semaphore.h>
+# include <iprt/cpp/utils.h>
+
+# include <VMMDev.h>
+
+# include <VBox/GuestHost/DragAndDrop.h>
+# include <VBox/HostServices/DragAndDropSvc.h>
+# include <VBox/version.h>
+
+# ifdef LOG_GROUP
+#  undef LOG_GROUP
+# endif
+# define LOG_GROUP LOG_GROUP_GUEST_DND
+# include <VBox/log.h>
+
+/**
+ * Overview:
+ *
+ * Drag and Drop is handled over the internal HGCM service for the host <->
+ * guest communication. Beside that we need to map the Drag and Drop protocols
+ * of the various OS's we support to our internal channels, this is also highly
+ * communicative in both directions. Unfortunately HGCM isn't really designed
+ * for that. Next we have to foul some of the components. This includes to
+ * trick X11 on the guest side, but also Qt needs to be tricked on the host
+ * side a little bit.
+ *
+ * The following components are involved:
+ *
+ * 1. GUI: Uses the Qt classes for Drag and Drop and mainly forward the content
+ *    of it to the Main IGuest interface (see UIDnDHandler.cpp).
+ * 2. Main: Public interface for doing Drag and Drop. Also manage the IProgress
+ *    interfaces for blocking the caller by showing a progress dialog (see
+ *    this file).
+ * 3. HGCM service: Handle all messages from the host to the guest at once and
+ *    encapsulate the internal communication details (see dndmanager.cpp and
+ *    friends).
+ * 4. Guest additions: Split into the platform neutral part (see
+ *    VBoxGuestR3LibDragAndDrop.cpp) and the guest OS specific parts.
+ *    Receive/send message from/to the HGCM service and does all guest specific
+ *    operations. Currently only X11 is supported (see draganddrop.cpp within
+ *    VBoxClient).
+ *
+ * Host -> Guest:
+ * 1. There are DnD Enter, Move, Leave events which are send exactly like this
+ *    to the guest. The info includes the pos, mimetypes and allowed actions.
+ *    The guest has to respond with an action it would accept, so the GUI could
+ *    change the cursor.
+ * 2. On drop, first a drop event is sent. If this is accepted a drop data
+ *    event follows. This blocks the GUI and shows some progress indicator.
+ *
+ * Guest -> Host:
+ * 1. The GUI is asking the guest if a DnD event is pending when the user moves
+ *    the cursor out of the view window. If so, this returns the mimetypes and
+ *    allowed actions.
+ * (2. On every mouse move this is asked again, to make sure the DnD event is
+ *     still valid.)
+ * 3. On drop the host request the data from the guest. This blocks the GUI and
+ *    shows some progress indicator.
+ *
+ * Some hints:
+ * m_strSupportedFormats here in this file defines the allowed mime-types.
+ * This is necessary because we need special handling for some of the
+ * mime-types. E.g. for URI lists we need to transfer the actual dirs and
+ * files. Text EOL may to be changed. Also unknown mime-types may need special
+ * handling as well, which may lead to undefined behavior in the host/guest, if
+ * not done.
+ *
+ * Dropping of a directory, means recursively transferring _all_ the content.
+ *
+ * Directories and files are placed into the user's temporary directory on the
+ * guest (e.g. /tmp/VirtualBox Dropped Files). We can't delete them after the
+ * DnD operation, because we didn't know what the DnD target does with it. E.g.
+ * it could just be opened in place. This could lead ofc to filling up the disk
+ * within the guest. To inform the user about this, a small app could be
+ * developed which scans this directory regularly and inform the user with a
+ * tray icon hint (and maybe the possibility to clean this up instantly). The
+ * same has to be done in the G->H direction when it is implemented.
+ *
+ * Of course only regularly files are supported. Symlinks are resolved and
+ * transfered as regularly files. First we don't know if the other side support
+ * symlinks at all and second they could point to somewhere in a directory tree
+ * which not exists on the other side.
+ *
+ * The code tries to preserve the file modes of the transfered dirs/files. This
+ * is useful (and maybe necessary) for two things:
+ * 1. If a file is executable, it should be also after the transfer, so the
+ *    user can just execute it, without manually tweaking the modes first.
+ * 2. If a dir/file is not accessible by group/others in the host, it shouldn't
+ *    be in the guest.
+ * In any case, the user mode is always set to rwx (so that we can access it
+ * ourself, in e.g. for a cleanup case after cancel).
+ *
+ * Cancel is supported in both directions and cleans up all previous steps
+ * (thats is: deleting already transfered dirs/files).
+ *
+ * In general I propose the following changes in the VBox HGCM infrastructure
+ * for the future:
+ * - Currently it isn't really possible to send messages to the guest from the
+ *   host. The host informs the guest just that there is something, the guest
+ *   than has to ask which message and depending on that send the appropriate
+ *   message to the host, which is filled with the right data.
+ * - There is no generic interface for sending bigger memory blocks to/from the
+ *   guest. This is now done here, but I guess was also necessary for e.g.
+ *   guest execution. So something generic which brake this up into smaller
+ *   blocks and send it would be nice (with all the error handling and such
+ *   ofc).
+ * - I developed a "protocol" for the DnD communication here. So the host and
+ *   the guest have always to match in the revision. This is ofc bad, because
+ *   the additions could be outdated easily. So some generic protocol number
+ *   support in HGCM for asking the host and the guest of the support version,
+ *   would be nice. Ofc at least the host should be able to talk to the guest,
+ *   even when the version is below the host one.
+ * All this stuff would be useful for the current services, but also for future
+ * onces.
+ *
+ ** @todo
+ * - ESC doesn't really work (on Windows guests it's already implemented)
+ *   ... in any case it seems a little bit difficult to handle from the Qt
+ *   side. Maybe also a host specific implementation becomes necessary ...
+ *   this would be really worst ofc.
+ * - Add support for more mime-types (especially images, csv)
+ * - Test unusual behavior:
+ *   - DnD service crash in the guest during a DnD op (e.g. crash of VBoxClient or X11)
+ *   - Not expected order of the events between HGCM and the guest
+ * - Security considerations: We transfer a lot of memory between the guest and
+ *   the host and even allow the creation of dirs/files. Maybe there should be
+ *   limits introduced to preventing DOS attacks or filling up all the memory
+ *   (both in the host and the guest).
+ */
+
+GuestDnDCallbackEvent::~GuestDnDCallbackEvent(void)
+{
+    if (NIL_RTSEMEVENT != mSemEvent)
+        RTSemEventDestroy(mSemEvent);
+}
+
+int GuestDnDCallbackEvent::Reset(void)
+{
+    int rc = VINF_SUCCESS;
+
+    if (NIL_RTSEMEVENT == mSemEvent)
+        rc = RTSemEventCreate(&mSemEvent);
+
+    mRc = VINF_SUCCESS;
+    return rc;
+}
+
+int GuestDnDCallbackEvent::Notify(int rc)
+{
+    mRc = rc;
+    return RTSemEventSignal(mSemEvent);
+}
+
+int GuestDnDCallbackEvent::Wait(RTMSINTERVAL msTimeout)
+{
+    return RTSemEventWait(mSemEvent, msTimeout);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+GuestDnDResponse::GuestDnDResponse(const ComObjPtr<Guest>& pGuest)
+    : m_EventSem(NIL_RTSEMEVENT)
+    , m_defAction(0)
+    , m_allActions(0)
+    , m_parent(pGuest)
+{
+    int rc = RTSemEventCreate(&m_EventSem);
+    if (RT_FAILURE(rc))
+        throw rc;
+}
+
+GuestDnDResponse::~GuestDnDResponse(void)
+{
+    reset();
+
+    int rc = RTSemEventDestroy(m_EventSem);
+    AssertRC(rc);
+}
+
+/* static */
+Utf8Str GuestDnDResponse::errorToString(const ComObjPtr<Guest>& pGuest, int guestRc)
+{
+    Utf8Str strError;
+
+    switch (guestRc)
+    {
+        case VERR_ACCESS_DENIED:
+            strError += Utf8StrFmt(pGuest->tr("For one or more guest files or directories selected for transferring to the host your guest "
+                                              "user does not have the appropriate access rights for. Please make sure that all selected "
+                                              "elements can be accessed and that your guest user has the appropriate rights."));
+            break;
+
+        case VERR_NOT_FOUND:
+            /* Should not happen due to file locking on the guest, but anyway ... */
+            strError += Utf8StrFmt(pGuest->tr("One or more guest files or directories selected for transferring to the host were not"
+                                              "found on the guest anymore. This can be the case if the guest files were moved and/or"
+                                              "altered while the drag and drop operation was in progress."));
+            break;
+
+        case VERR_SHARING_VIOLATION:
+            strError += Utf8StrFmt(pGuest->tr("One or more guest files or directories selected for transferring to the host were locked. "
+                                              "Please make sure that all selected elements can be accessed and that your guest user has "
+                                              "the appropriate rights."));
+            break;
+
+        default:
+            strError += Utf8StrFmt("Drag and drop guest error (%Rrc)", guestRc);
+            break;
+    }
+
+    return strError;
+}
+
+int GuestDnDResponse::notifyAboutGuestResponse(void) const
+{
+    return RTSemEventSignal(m_EventSem);
+}
+
+void GuestDnDResponse::reset(void)
+{
+    LogFlowThisFuncEnter();
+
+    m_defAction  = 0;
+    m_allActions = 0;
+
+    m_strFormat  = "";
+}
+
+HRESULT GuestDnDResponse::resetProgress(const ComObjPtr<Guest>& pParent)
+{
+    m_progress.setNull();
+
+    HRESULT hr = m_progress.createObject();
+    if (SUCCEEDED(hr))
+    {
+        hr = m_progress->init(static_cast<IGuest *>(pParent),
+                              Bstr(pParent->tr("Dropping data")).raw(),
+                              TRUE /* aCancelable */);
+    }
+
+    return hr;
+}
+
+bool GuestDnDResponse::isProgressCanceled(void) const
+{
+    BOOL fCanceled;
+    if (!m_progress.isNull())
+    {
+        HRESULT hr = m_progress->COMGETTER(Canceled)(&fCanceled);
+        AssertComRC(hr);
+    }
+    else
+        fCanceled = TRUE;
+
+    return RT_BOOL(fCanceled);
+}
+
+int GuestDnDResponse::setCallback(uint32_t uMsg, PFNGUESTDNDCALLBACK pfnCallback, void *pvUser /* = NULL */)
+{
+    GuestDnDCallbackMap::iterator it = m_mapCallbacks.find(uMsg);
+
+    /* Add. */
+    if (pfnCallback)
+    {
+        if (it == m_mapCallbacks.end())
+        {
+            m_mapCallbacks[uMsg] = GuestDnDCallback(pfnCallback, uMsg, pvUser);
+            return VINF_SUCCESS;
+        }
+
+        AssertMsgFailed(("Callback for message %RU32 already registered\n", uMsg));
+        return VERR_ALREADY_EXISTS;
+    }
+
+    /* Remove. */
+    if (it != m_mapCallbacks.end())
+        m_mapCallbacks.erase(it);
+
+    return VINF_SUCCESS;
+}
+
+int GuestDnDResponse::setProgress(unsigned uPercentage,
+                                  uint32_t uStatus, int rcOp /* = VINF_SUCCESS */)
+{
+    LogFlowFunc(("uStatus=%RU32, uPercentage=%RU32, rcOp=%Rrc\n",
+                 uStatus, uPercentage, rcOp));
+
+    int rc = VINF_SUCCESS;
+    if (!m_progress.isNull())
+    {
+        BOOL fCompleted;
+        HRESULT hr = m_progress->COMGETTER(Completed)(&fCompleted);
+        AssertComRC(hr);
+
+        BOOL fCanceled;
+        hr = m_progress->COMGETTER(Canceled)(&fCanceled);
+        AssertComRC(hr);
+
+        LogFlowFunc(("Current: fCompleted=%RTbool, fCanceled=%RTbool\n", fCompleted, fCanceled));
+
+        if (!fCompleted)
+        {
+            switch (uStatus)
+            {
+                case DragAndDropSvc::DND_PROGRESS_ERROR:
+                {
+                    hr = m_progress->i_notifyComplete(VBOX_E_IPRT_ERROR,
+                                                      COM_IIDOF(IGuest),
+                                                      m_parent->getComponentName(),
+                                                      GuestDnDResponse::errorToString(m_parent, rcOp).c_str());
+                    reset();
+                    break;
+                }
+
+                case DragAndDropSvc::DND_PROGRESS_CANCELLED:
+                {
+                    hr = m_progress->i_notifyComplete(S_OK);
+                    AssertComRC(hr);
+
+                    reset();
+                    break;
+                }
+
+                case DragAndDropSvc::DND_PROGRESS_RUNNING:
+                case DragAndDropSvc::DND_PROGRESS_COMPLETE:
+                {
+                    if (!fCanceled)
+                    {
+                        hr = m_progress->SetCurrentOperationProgress(uPercentage);
+                        AssertComRC(hr);
+                        if (   uStatus     == DragAndDropSvc::DND_PROGRESS_COMPLETE
+                            || uPercentage >= 100)
+                        {
+                            hr = m_progress->i_notifyComplete(S_OK);
+                            AssertComRC(hr);
+                        }
+                    }
+                    break;
+                }
+
+                default:
+                    break;
+            }
+        }
+
+        hr = m_progress->COMGETTER(Completed)(&fCompleted);
+        AssertComRC(hr);
+        hr = m_progress->COMGETTER(Canceled)(&fCanceled);
+        AssertComRC(hr);
+
+        LogFlowFunc(("New: fCompleted=%RTbool, fCanceled=%RTbool\n", fCompleted, fCanceled));
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDResponse::onDispatch(uint32_t u32Function, void *pvParms, uint32_t cbParms)
+{
+    LogFlowFunc(("u32Function=%RU32, pvParms=%p, cbParms=%RU32\n", u32Function, pvParms, cbParms));
+
+    int rc = VERR_WRONG_ORDER; /* Play safe. */
+    bool fTryCallbacks = false;
+
+    switch (u32Function)
+    {
+        case DragAndDropSvc::GUEST_DND_HG_ACK_OP:
+        {
+            DragAndDropSvc::PVBOXDNDCBHGACKOPDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBHGACKOPDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGACKOPDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_ACK_OP == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            setDefAction(pCBData->uAction);
+            rc = notifyAboutGuestResponse();
+            break;
+        }
+
+        case DragAndDropSvc::GUEST_DND_HG_REQ_DATA:
+        {
+            DragAndDropSvc::PVBOXDNDCBHGREQDATADATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBHGREQDATADATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGREQDATADATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_REQ_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            if (   pCBData->cbFormat == 0
+                || pCBData->cbFormat >  _64K)
+            {
+                rc = VERR_INVALID_PARAMETER;
+            }
+            else
+            {
+                setFormat(pCBData->pszFormat);
+
+                rc = VINF_SUCCESS;
+            }
+
+            int rc2 = notifyAboutGuestResponse();
+            if (RT_SUCCESS(rc))
+                rc = rc2;
+            break;
+        }
+
+        case DragAndDropSvc::GUEST_DND_HG_EVT_PROGRESS:
+        {
+            DragAndDropSvc::PVBOXDNDCBHGEVTPROGRESSDATA pCBData =
+               reinterpret_cast<DragAndDropSvc::PVBOXDNDCBHGEVTPROGRESSDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGEVTPROGRESSDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_EVT_PROGRESS == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            rc = setProgress(pCBData->uPercentage, pCBData->uStatus, pCBData->rc);
+            if (RT_SUCCESS(rc))
+                rc = notifyAboutGuestResponse();
+            break;
+        }
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+        case DragAndDropSvc::GUEST_DND_GH_ACK_PENDING:
+        {
+            DragAndDropSvc::PVBOXDNDCBGHACKPENDINGDATA pCBData =
+               reinterpret_cast<DragAndDropSvc::PVBOXDNDCBGHACKPENDINGDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBGHACKPENDINGDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_ACK_PENDING == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            if (   pCBData->cbFormat == 0
+                || pCBData->cbFormat >  _64K)
+            {
+                rc = VERR_INVALID_PARAMETER;
+            }
+            else
+            {
+                setFormat    (pCBData->pszFormat);
+                setDefAction (pCBData->uDefAction);
+                setAllActions(pCBData->uAllActions);
+
+                rc = VINF_SUCCESS;
+            }
+
+            int rc2 = notifyAboutGuestResponse();
+            if (RT_SUCCESS(rc))
+                rc = rc2;
+            break;
+        }
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
+        default:
+            /* * Try if the event is covered by a registered callback. */
+            fTryCallbacks = true;
+            break;
+    }
+
+    /*
+     * Try the host's installed callbacks (if any).
+     */
+    if (fTryCallbacks)
+    {
+        GuestDnDCallbackMap::const_iterator it = m_mapCallbacks.find(u32Function);
+        if (it != m_mapCallbacks.end())
+        {
+            AssertPtr(it->second.pfnCallback);
+            rc = it->second.pfnCallback(u32Function, pvParms, cbParms, it->second.pvUser);
+        }
+        else
+            rc = VERR_NO_DATA; /* Tell the guest. */
+    }
+
+    LogFlowFunc(("Returning rc=%Rrc\n", rc));
+    return rc;
+}
+
+HRESULT GuestDnDResponse::queryProgressTo(IProgress **ppProgress)
+{
+    return m_progress.queryInterfaceTo(ppProgress);
+}
+
+int GuestDnDResponse::waitForGuestResponse(RTMSINTERVAL msTimeout /*= 500 */) const
+{
+    int rc = RTSemEventWait(m_EventSem, msTimeout);
+#ifdef DEBUG_andy
+    LogFlowFunc(("msTimeout=%RU32, rc=%Rrc\n", msTimeout, rc));
+#endif
+    return rc;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+GuestDnD* GuestDnD::s_pInstance = NULL;
+
+GuestDnD::GuestDnD(const ComObjPtr<Guest> &pGuest)
+    : m_pGuest(pGuest)
+{
+    LogFlowFuncEnter();
+
+    m_pResponse = new GuestDnDResponse(pGuest);
+
+    /* List of supported default MIME types. */
+    const com::Utf8Str arrEntries[] = { VBOX_DND_FORMATS_DEFAULT };
+    for (size_t i = 0; i < RT_ELEMENTS(arrEntries); i++)
+        m_strDefaultFormats.push_back(arrEntries[i]);
+}
+
+GuestDnD::~GuestDnD(void)
+{
+    LogFlowFuncEnter();
+
+    if (m_pResponse)
+        delete m_pResponse;
+}
+
+int GuestDnD::adjustScreenCoordinates(ULONG uScreenId, ULONG *puX, ULONG *puY) const
+{
+    /** @todo r=andy Save the current screen's shifting coordinates to speed things up.
+     *               Only query for new offsets when the screen ID has changed. */
+
+    /* For multi-monitor support we need to add shift values to the coordinates
+     * (depending on the screen number). */
+    ComObjPtr<Console> pConsole = m_pGuest->i_getConsole();
+    ComPtr<IDisplay> pDisplay;
+    HRESULT hr = pConsole->COMGETTER(Display)(pDisplay.asOutParam());
+    if (FAILED(hr))
+        return hr;
+
+    ULONG dummy;
+    LONG xShift, yShift;
+    GuestMonitorStatus_T monitorStatus;
+    hr = pDisplay->GetScreenResolution(uScreenId, &dummy, &dummy, &dummy,
+                                       &xShift, &yShift, &monitorStatus);
+    if (FAILED(hr))
+        return hr;
+
+    if (puX)
+        *puX += xShift;
+    if (puY)
+        *puY += yShift;
+
+#ifdef DEBUG_andy
+    LogFlowFunc(("uScreenId=%RU32, x=%RU32, y=%RU32\n",
+                 uScreenId, puX ? *puX : 0, puY ? *puY : 0));
+#endif
+    return VINF_SUCCESS;
+}
+
+int GuestDnD::hostCall(uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms) const
+{
+    Assert(!m_pGuest.isNull());
+    ComObjPtr<Console> pConsole = m_pGuest->i_getConsole();
+
+    /* Forward the information to the VMM device. */
+    Assert(!pConsole.isNull());
+    VMMDev *pVMMDev = pConsole->i_getVMMDev();
+    if (!pVMMDev)
+        return VERR_COM_OBJECT_NOT_FOUND;
+
+    int rc = pVMMDev->hgcmHostCall("VBoxDragAndDropSvc", u32Function, cParms, paParms);
+    LogFlowFunc(("uMsg=%RU32, cParms=%RU32, rc=%Rrc\n", u32Function, cParms, rc));
+    return rc;
+}
+
+/* static */
+DECLCALLBACK(int) GuestDnD::notifyDnDDispatcher(void *pvExtension, uint32_t u32Function,
+                                                void *pvParms, uint32_t cbParms)
+{
+    LogFlowFunc(("pvExtension=%p, u32Function=%RU32, pvParms=%p, cbParms=%RU32\n",
+                 pvExtension, u32Function, pvParms, cbParms));
+
+    GuestDnD *pGuestDnD = reinterpret_cast<GuestDnD*>(pvExtension);
+    AssertPtrReturn(pGuestDnD, VERR_INVALID_POINTER);
+
+    /** @todo In case we need to handle multiple guest DnD responses at a time this
+     *        would be the place to lookup and dispatch to those. For the moment we
+     *        only have one response -- simple. */
+    GuestDnDResponse *pResp = pGuestDnD->m_pResponse;
+    if (pResp)
+        return pResp->onDispatch(u32Function, pvParms, cbParms);
+
+    return VERR_NOT_SUPPORTED;
+}
+
+
+/* static */
+com::Utf8Str GuestDnD::toFormatString(const std::vector<com::Utf8Str> &lstSupportedFormats,
+                                      const std::vector<com::Utf8Str> &lstFormats)
+{
+    com::Utf8Str strFormat;
+    for (size_t i = 0; i < lstFormats.size(); ++i)
+    {
+        const com::Utf8Str &f = lstFormats.at(i);
+        /* Only keep allowed format types. */
+        if (std::find(lstSupportedFormats.begin(),
+                      lstSupportedFormats.end(), f) != lstSupportedFormats.end())
+            strFormat += f + "\r\n";
+    }
+
+    return strFormat;
+}
+
+/* static */
+void GuestDnD::toFormatVector(const std::vector<com::Utf8Str> &lstSupportedFormats,
+                              const com::Utf8Str &strFormats,
+                              std::vector<com::Utf8Str> &vecformats)
+{
+    RTCList<RTCString> lstFormats = strFormats.split("\r\n");
+    size_t i = 0;
+    while (i < lstFormats.size())
+    {
+        /* Only keep allowed format types. */
+        if (std::find(lstSupportedFormats.begin(),
+                      lstSupportedFormats.end(), lstFormats.at(i)) == lstSupportedFormats.end())
+            lstFormats.removeAt(i);
+        else
+            ++i;
+    }
+
+    for (i = 0; i < lstFormats.size(); i++)
+    {
+        const Utf8Str &f = lstFormats.at(i);
+        if (std::find(lstSupportedFormats.begin(),
+                      lstSupportedFormats.end(), f) != lstSupportedFormats.end())
+            vecformats.push_back(lstFormats[i]);
+    }
+}
+
+/* static */
+uint32_t GuestDnD::toHGCMAction(DnDAction_T enmAction)
+{
+    uint32_t uAction = DND_IGNORE_ACTION;
+    switch (enmAction)
+    {
+        case DnDAction_Copy:
+            uAction = DND_COPY_ACTION;
+            break;
+        case DnDAction_Move:
+            uAction = DND_MOVE_ACTION;
+            break;
+        case DnDAction_Link:
+            /* For now it doesn't seems useful to allow a link
+               action between host & guest. Later? */
+        case DnDAction_Ignore:
+            /* Ignored. */
+            break;
+        default:
+            AssertMsgFailed(("Action %RU32 not recognized!\n", enmAction));
+            break;
+    }
+
+    return uAction;
+}
+
+/* static */
+void GuestDnD::toHGCMActions(DnDAction_T enmDefAction,
+                             uint32_t *puDefAction,
+                             const std::vector<DnDAction_T> vecAllowedActions,
+                             uint32_t *puAllowedActions)
+{
+    if (puDefAction)
+        *puDefAction = toHGCMAction(enmDefAction);
+    if (puAllowedActions)
+    {
+        *puAllowedActions = DND_IGNORE_ACTION;
+
+        /* First convert the allowed actions to a bit array. */
+        for (size_t i = 0; i < vecAllowedActions.size(); ++i)
+            *puAllowedActions |= toHGCMAction(vecAllowedActions[i]);
+
+        /* Second check if the default action is a valid action and if not so try
+         * to find an allowed action. */
+        if (isDnDIgnoreAction(*puAllowedActions))
+        {
+            if (hasDnDCopyAction(*puAllowedActions))
+                *puAllowedActions = DND_COPY_ACTION;
+            else if (hasDnDMoveAction(*puAllowedActions))
+                *puAllowedActions = DND_MOVE_ACTION;
+        }
+    }
+}
+
+/* static */
+DnDAction_T GuestDnD::toMainAction(uint32_t uAction)
+{
+    /* For now it doesn't seems useful to allow a
+     * link action between host & guest. Maybe later! */
+    return (isDnDCopyAction(uAction) ? (DnDAction_T)DnDAction_Copy :
+            isDnDMoveAction(uAction) ? (DnDAction_T)DnDAction_Move :
+            (DnDAction_T)DnDAction_Ignore);
+}
+
+/* static */
+void GuestDnD::toMainActions(uint32_t uActions,
+                             std::vector<DnDAction_T> &vecActions)
+{
+    /* For now it doesn't seems useful to allow a
+     * link action between host & guest. Maybe later! */
+    RTCList<DnDAction_T> lstActions;
+    if (hasDnDCopyAction(uActions))
+        lstActions.append(DnDAction_Copy);
+    if (hasDnDMoveAction(uActions))
+        lstActions.append(DnDAction_Move);
+
+    for (size_t i = 0; i < lstActions.size(); ++i)
+        vecActions.push_back(lstActions.at(i));
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+GuestDnDBase::GuestDnDBase(void)
+{
+    mDataBase.mfTransferIsPending = false;
+
+    /*
+     * Initialize public attributes.
+     */
+    m_strFormats = GuestDnDInst()->defaultFormats();
+}
+
+HRESULT GuestDnDBase::i_isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported)
+{
+    *aSupported = std::find(m_strFormats.begin(),
+                            m_strFormats.end(), aFormat) != m_strFormats.end()
+                ? TRUE : FALSE;
+    return S_OK;
+}
+
+HRESULT GuestDnDBase::i_getFormats(std::vector<com::Utf8Str> &aFormats)
+{
+    aFormats = m_strFormats;
+
+    return S_OK;
+}
+
+HRESULT GuestDnDBase::i_addFormats(const std::vector<com::Utf8Str> &aFormats)
+{
+    for (size_t i = 0; i < aFormats.size(); ++i)
+    {
+        Utf8Str strFormat = aFormats.at(i);
+        if (std::find(m_strFormats.begin(),
+                      m_strFormats.end(), strFormat) == m_strFormats.end())
+        {
+            m_strFormats.push_back(strFormat);
+        }
+    }
+
+    return S_OK;
+}
+
+HRESULT GuestDnDBase::i_removeFormats(const std::vector<com::Utf8Str> &aFormats)
+{
+    for (size_t i = 0; i < aFormats.size(); ++i)
+    {
+        Utf8Str strFormat = aFormats.at(i);
+        std::vector<com::Utf8Str>::iterator itFormat = std::find(m_strFormats.begin(),
+                                                                 m_strFormats.end(), strFormat);
+        if (itFormat != m_strFormats.end())
+            m_strFormats.erase(itFormat);
+    }
+
+    return S_OK;
+}
+
+HRESULT GuestDnDBase::i_getProtocolVersion(ULONG *puVersion)
+{
+    int rc = getProtocolVersion((uint32_t *)puVersion);
+    return RT_SUCCESS(rc) ? S_OK : E_FAIL;
+}
+
+int GuestDnDBase::getProtocolVersion(uint32_t *puVersion)
+{
+    AssertPtrReturn(puVersion, VERR_INVALID_POINTER);
+
+    int rc;
+
+    uint32_t uVer, uVerAdditions = 0;
+    if (   m_pGuest
+        && (uVerAdditions = m_pGuest->i_getAdditionsVersion()) > 0)
+    {
+        uint32_t uVBoxMajor = VBOX_FULL_VERSION_GET_MAJOR(uVerAdditions);
+        uint32_t uVBoxMinor = VBOX_FULL_VERSION_GET_MINOR(uVerAdditions);
+
+#if 0 /*def DEBUG_andy*/
+        /* Hardcode the to-used protocol version; nice for testing side effects. */
+        uVer = 2;
+#else
+        uVer = (  uVBoxMajor  >= 5)
+             ? 2  /* VBox 5.0 and up: Protocol version 2. */
+             : 1; /* VBox <= 4.3:     Protocol version 1. */
+        /* Build revision is ignored. */
+#endif
+
+        LogFlowThisFunc(("uVerAdditions=%RU32 (%RU32.%RU32)\n", uVerAdditions, uVBoxMajor, uVBoxMinor));
+        rc = VINF_SUCCESS;
+    }
+    else
+    {
+        uVer = 1; /* Fallback. */
+        rc = VERR_NOT_FOUND;
+    }
+
+    LogFlowThisFunc(("uVer=%RU32, uVerAdditions=%RU32, rc=%Rrc\n", uVer, uVerAdditions, rc));
+
+    *puVersion = uVer;
+    return rc;
+}
+
+int GuestDnDBase::msgQueueAdd(GuestDnDMsg *pMsg)
+{
+    mDataBase.mListOutgoing.push_back(pMsg);
+    return VINF_SUCCESS;
+}
+
+GuestDnDMsg *GuestDnDBase::msgQueueGetNext(void)
+{
+    if (mDataBase.mListOutgoing.empty())
+        return NULL;
+    return mDataBase.mListOutgoing.front();
+}
+
+void GuestDnDBase::msgQueueRemoveNext(void)
+{
+    if (!mDataBase.mListOutgoing.empty())
+    {
+        GuestDnDMsg *pMsg = mDataBase.mListOutgoing.front();
+        if (pMsg)
+            delete pMsg;
+        mDataBase.mListOutgoing.pop_front();
+    }
+}
+
+void GuestDnDBase::msgQueueClear(void)
+{
+    GuestDnDMsgList::iterator itMsg = mDataBase.mListOutgoing.begin();
+    while (itMsg != mDataBase.mListOutgoing.end())
+    {
+        delete *itMsg;
+    }
+
+    mDataBase.mListOutgoing.clear();
+}
+
+int GuestDnDBase::sendCancel(void)
+{
+    LogFlowFunc(("Generating cancel request ...\n"));
+
+    int rc;
+    try
+    {
+        GuestDnDMsg *pMsgCancel = new GuestDnDMsg();
+        pMsgCancel->setType(DragAndDropSvc::HOST_DND_HG_EVT_CANCEL);
+
+        rc = msgQueueAdd(pMsgCancel);
+    }
+    catch(std::bad_alloc & /*e*/)
+    {
+        rc = VERR_NO_MEMORY;
+    }
+
+    return rc;
+}
+
+/** @todo GuestDnDResponse *pResp needs to go. */
+int GuestDnDBase::waitForEvent(RTMSINTERVAL msTimeout, GuestDnDCallbackEvent &Event, GuestDnDResponse *pResp)
+{
+    int rc;
+
+    uint64_t tsStart = RTTimeMilliTS();
+    do
+    {
+        /*
+         * Wait until our desired callback triggered the
+         * wait event. As we don't want to block if the guest does not
+         * respond, so do busy waiting here.
+         */
+        rc = Event.Wait(500 /* ms */);
+        if (RT_SUCCESS(rc))
+        {
+            rc = Event.Result();
+            LogFlowFunc(("Callback done, result is %Rrc\n", rc));
+            break;
+        }
+        else if (rc == VERR_TIMEOUT) /* Continue waiting. */
+            rc = VINF_SUCCESS;
+
+        if (   msTimeout != RT_INDEFINITE_WAIT
+            && RTTimeMilliTS() - tsStart > msTimeout)
+        {
+            rc = VERR_TIMEOUT;
+        }
+        else if (pResp->isProgressCanceled())
+        {
+            pResp->setProgress(100 /* Percent */, DragAndDropSvc::DND_PROGRESS_CANCELLED);
+            rc = VERR_CANCELLED;
+        }
+
+    } while (RT_SUCCESS(rc));
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+
diff --git a/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp b/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
new file mode 100644
index 0000000..9432e83
--- /dev/null
+++ b/src/VBox/Main/src-client/GuestDnDSourceImpl.cpp
@@ -0,0 +1,1156 @@
+/* $Id: GuestDnDSourceImpl.cpp $ */
+/** @file
+ * VBox Console COM Class implementation - Guest drag and drop source.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "GuestImpl.h"
+#include "GuestDnDSourceImpl.h"
+#include "GuestDnDPrivate.h"
+#include "ConsoleImpl.h"
+
+#include "Global.h"
+#include "AutoCaller.h"
+
+#include <iprt/asm.h>
+#include <iprt/dir.h>
+#include <iprt/file.h>
+#include <iprt/path.h>
+#include <iprt/uri.h>
+
+#include <iprt/cpp/utils.h> /* For unconst(). */
+
+#include <VBox/com/array.h>
+#include <VBox/GuestHost/DragAndDrop.h>
+#include <VBox/HostServices/DragAndDropSvc.h>
+
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+/**
+ * Base class for a source task.
+ */
+class GuestDnDSourceTask
+{
+public:
+
+    GuestDnDSourceTask(GuestDnDSource *pSource)
+        : mSource(pSource),
+          mRC(VINF_SUCCESS) { }
+
+    virtual ~GuestDnDSourceTask(void) { }
+
+    int getRC(void) const { return mRC; }
+    bool isOk(void) const { return RT_SUCCESS(mRC); }
+    const ComObjPtr<GuestDnDSource> &getSource(void) const { return mSource; }
+
+protected:
+
+    const ComObjPtr<GuestDnDSource>     mSource;
+    int                                 mRC;
+};
+
+/**
+ * Task structure for receiving data from a source using
+ * a worker thread.
+ */
+class RecvDataTask : public GuestDnDSourceTask
+{
+public:
+
+    RecvDataTask(GuestDnDSource *pSource, PRECVDATACTX pCtx)
+        : GuestDnDSourceTask(pSource)
+        , mpCtx(pCtx) { }
+
+    virtual ~RecvDataTask(void) { }
+
+    PRECVDATACTX getCtx(void) { return mpCtx; }
+
+protected:
+
+    /** Pointer to receive data context. */
+    PRECVDATACTX mpCtx;
+};
+
+// constructor / destructor
+/////////////////////////////////////////////////////////////////////////////
+
+DEFINE_EMPTY_CTOR_DTOR(GuestDnDSource)
+
+HRESULT GuestDnDSource::FinalConstruct(void)
+{
+    /* Set the maximum block size this source can handle to 64K. This always has
+     * been hardcoded until now. */
+    /* Note: Never ever rely on information from the guest; the host dictates what and
+     *       how to do something, so try to negogiate a sensible value here later. */
+    mData.mcbBlockSize    = _64K; /** @todo Make this configurable. */
+
+    LogFlowThisFunc(("\n"));
+    return BaseFinalConstruct();
+}
+
+void GuestDnDSource::FinalRelease(void)
+{
+    LogFlowThisFuncEnter();
+    uninit();
+    BaseFinalRelease();
+    LogFlowThisFuncLeave();
+}
+
+// public initializer/uninitializer for internal purposes only
+/////////////////////////////////////////////////////////////////////////////
+
+int GuestDnDSource::init(const ComObjPtr<Guest>& pGuest)
+{
+    LogFlowThisFuncEnter();
+
+    /* Enclose the state transition NotReady->InInit->Ready. */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+
+    unconst(m_pGuest) = pGuest;
+
+    /* Confirm a successful initialization when it's the case. */
+    autoInitSpan.setSucceeded();
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Uninitializes the instance.
+ * Called from FinalRelease().
+ */
+void GuestDnDSource::uninit(void)
+{
+    LogFlowThisFunc(("\n"));
+
+    /* Enclose the state transition Ready->InUninit->NotReady. */
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
+}
+
+// implementation of wrapped IDnDBase methods.
+/////////////////////////////////////////////////////////////////////////////
+
+HRESULT GuestDnDSource::isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_isFormatSupported(aFormat, aSupported);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDSource::getFormats(std::vector<com::Utf8Str> &aFormats)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_getFormats(aFormats);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDSource::addFormats(const std::vector<com::Utf8Str> &aFormats)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_addFormats(aFormats);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDSource::removeFormats(const std::vector<com::Utf8Str> &aFormats)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_removeFormats(aFormats);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDSource::getProtocolVersion(ULONG *aProtocolVersion)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_getProtocolVersion(aProtocolVersion);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+// implementation of wrapped IDnDSource methods.
+/////////////////////////////////////////////////////////////////////////////
+
+HRESULT GuestDnDSource::dragIsPending(ULONG uScreenId, std::vector<com::Utf8Str> &aFormats,
+                                      std::vector<DnDAction_T> &aAllowedActions, DnDAction_T *aDefaultAction)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* Determine guest DnD protocol to use. */
+    GuestDnDBase::getProtocolVersion(&mDataBase.mProtocolVersion);
+
+    /* Default is ignoring the action. */
+    DnDAction_T defaultAction = DnDAction_Ignore;
+
+    HRESULT hr = S_OK;
+
+    GuestDnDMsg Msg;
+    Msg.setType(DragAndDropSvc::HOST_DND_GH_REQ_PENDING);
+    Msg.setNextUInt32(uScreenId);
+
+    int rc = GuestDnDInst()->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
+    if (RT_SUCCESS(rc))
+    {
+        bool fFetchResult = true;
+        GuestDnDResponse *pResp = GuestDnDInst()->response();
+        if (pResp)
+        {
+            if (pResp->waitForGuestResponse() == VERR_TIMEOUT)
+                fFetchResult = false;
+
+            if (isDnDIgnoreAction(pResp->defAction()))
+                fFetchResult = false;
+
+            /* Fetch the default action to use. */
+            if (fFetchResult)
+            {
+                defaultAction = GuestDnD::toMainAction(pResp->defAction());
+
+                GuestDnD::toFormatVector(m_strFormats, pResp->format(), aFormats);
+                GuestDnD::toMainActions(pResp->allActions(), aAllowedActions);
+            }
+        }
+
+        if (aDefaultAction)
+            *aDefaultAction = defaultAction;
+    }
+
+    LogFlowFunc(("hr=%Rhrc, defaultAction=0x%x\n", hr, defaultAction));
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDSource::drop(const com::Utf8Str &aFormat, DnDAction_T aAction, ComPtr<IProgress> &aProgress)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* Input validation. */
+    if (RT_UNLIKELY((aFormat.c_str()) == NULL || *(aFormat.c_str()) == '\0'))
+        return setError(E_INVALIDARG, tr("No drop format specified"));
+
+    uint32_t uAction = GuestDnD::toHGCMAction(aAction);
+    if (isDnDIgnoreAction(uAction)) /* If there is no usable action, ignore this request. */
+        return S_OK;
+
+    /* Note: At the moment we only support one transfer at a time. */
+    if (ASMAtomicReadBool(&mDataBase.mfTransferIsPending))
+        return setError(E_INVALIDARG, tr("Another drop operation already is in progress"));
+
+    /* Gets reset when the thread is finished. */
+    ASMAtomicWriteBool(&mDataBase.mfTransferIsPending, true);
+
+    /* Dito. */
+    GuestDnDResponse *pResp = GuestDnDInst()->response();
+    AssertPtr(pResp);
+
+    HRESULT hr = pResp->resetProgress(m_pGuest);
+    if (FAILED(hr))
+        return hr;
+
+    try
+    {
+        mData.mRecvCtx.mIsActive = false;
+        mData.mRecvCtx.mpSource  = this;
+        mData.mRecvCtx.mpResp    = pResp;
+        mData.mRecvCtx.mFormat   = aFormat;
+
+        RecvDataTask *pTask = new RecvDataTask(this, &mData.mRecvCtx);
+        AssertReturn(pTask->isOk(), pTask->getRC());
+        
+        LogFlowFunc(("Starting thread ...\n"));
+
+        int rc = RTThreadCreate(NULL, GuestDnDSource::i_receiveDataThread,
+                                (void *)pTask, 0, RTTHREADTYPE_MAIN_WORKER, 0, "dndSrcRcvData");
+        if (RT_SUCCESS(rc))
+        {
+            hr = pResp->queryProgressTo(aProgress.asOutParam());
+            ComAssertComRC(hr);
+
+            /* Note: pTask is now owned by the worker thread. */
+        }
+        else
+            hr = setError(VBOX_E_IPRT_ERROR, tr("Starting thread failed (%Rrc)"), rc);
+    }
+    catch(std::bad_alloc &)
+    {
+        hr = setError(E_OUTOFMEMORY);
+    }
+
+    /* Note: mDataBase.mfTransferIsPending will be set to false again by i_receiveDataThread. */
+
+    LogFlowFunc(("Returning hr=%Rhrc\n", hr));
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDSource::receiveData(std::vector<BYTE> &aData)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP) || !defined(VBOX_WITH_DRAG_AND_DROP_GH)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    /* Input validation. */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* Don't allow receiving the actual data until our transfer
+     * actually is complete. */
+    if (ASMAtomicReadBool(&mDataBase.mfTransferIsPending))
+        return setError(E_INVALIDARG, tr("Current drop operation still in progress"));
+
+    PRECVDATACTX pCtx = &mData.mRecvCtx;
+
+    if (pCtx->mData.vecData.empty())
+    {
+        aData.resize(0);
+        return S_OK;
+    }
+
+    HRESULT hr = S_OK;
+    size_t cbData;
+
+    try
+    {
+        bool fHasURIList = DnDMIMENeedsDropDir(pCtx->mFormat.c_str(), pCtx->mFormat.length());
+        if (fHasURIList)
+        {
+            Utf8Str strURIs = pCtx->mURI.lstURI.RootToString(RTCString(DnDDirDroppedFilesGetDirAbs(&pCtx->mURI.mDropDir)));
+            cbData = strURIs.length();
+
+            LogFlowFunc(("Found %zu root URIs (%zu bytes)\n", pCtx->mURI.lstURI.RootCount(), cbData));
+
+            aData.resize(cbData + 1 /* Include termination */);
+            memcpy(&aData.front(), strURIs.c_str(), cbData);
+        }
+        else
+        {
+            cbData = pCtx->mData.vecData.size();
+
+            /* Copy the data into a safe array of bytes. */
+            aData.resize(cbData);
+            memcpy(&aData.front(), &pCtx->mData.vecData[0], cbData);
+        }
+    }
+    catch (std::bad_alloc &)
+    {
+        hr = E_OUTOFMEMORY;
+    }
+
+    LogFlowFunc(("Returning cbData=%zu, hr=%Rhrc\n", cbData, hr));
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+// implementation of internal methods.
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+int GuestDnDSource::i_onReceiveData(PRECVDATACTX pCtx, const void *pvData, uint32_t cbData, uint64_t cbTotalSize)
+{
+    AssertPtrReturn(pCtx,     VERR_INVALID_POINTER);
+    AssertPtrReturn(pvData,   VERR_INVALID_POINTER);
+    AssertReturn(cbData,      VERR_INVALID_PARAMETER);
+    AssertReturn(cbTotalSize, VERR_INVALID_PARAMETER);
+
+    LogFlowFunc(("cbData=%RU32, cbTotalSize=%RU64\n", cbData, cbTotalSize));
+
+    int rc = VINF_SUCCESS;
+
+    try
+    {
+        if (   cbData > cbTotalSize
+            || cbData > mData.mcbBlockSize)
+        {
+            LogFlowFunc(("Data sizes invalid: cbData=%RU32, cbTotalSize=%RU64\n", cbData, cbTotalSize));
+            rc = VERR_INVALID_PARAMETER;
+        }
+        else if (cbData < pCtx->mData.vecData.size())
+        {
+            AssertMsgFailed(("New size (%RU64) is smaller than current size (%zu)\n", cbTotalSize, pCtx->mData.vecData.size()));
+            rc = VERR_INVALID_PARAMETER;
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            pCtx->mData.vecData.insert(pCtx->mData.vecData.begin(), (BYTE *)pvData, (BYTE *)pvData + cbData);
+
+            LogFlowFunc(("vecDataSize=%zu, cbData=%RU32, cbTotalSize=%RU64\n", pCtx->mData.vecData.size(), cbData, cbTotalSize));
+
+            /* Data transfer complete? */
+            Assert(cbData <= pCtx->mData.vecData.size());
+            if (cbData == pCtx->mData.vecData.size())
+            {
+                bool fHasURIList = DnDMIMENeedsDropDir(pCtx->mFormat.c_str(), pCtx->mFormat.length());
+                LogFlowFunc(("fHasURIList=%RTbool, cbTotalSize=%RU32\n", fHasURIList, cbTotalSize));
+                if (fHasURIList)
+                {
+                    /* Try parsing the data as URI list. */
+                    rc = pCtx->mURI.lstURI.RootFromURIData(&pCtx->mData.vecData[0], pCtx->mData.vecData.size(), 0 /* uFlags */);
+                    if (RT_SUCCESS(rc))
+                    {
+                        pCtx->mData.cbProcessed = 0;
+
+                        /*
+                         * Assign new total size which also includes all file data to receive
+                         * from the guest.
+                         */
+                        pCtx->mData.cbToProcess = cbTotalSize;
+
+                        LogFlowFunc(("URI data => cbToProcess=%RU64\n", pCtx->mData.cbToProcess));
+                    }
+                }
+            }
+        }
+    }
+    catch (std::bad_alloc &)
+    {
+        rc = VERR_NO_MEMORY;
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDSource::i_onReceiveDir(PRECVDATACTX pCtx, const char *pszPath, uint32_t cbPath, uint32_t fMode)
+{
+    AssertPtrReturn(pCtx,    VERR_INVALID_POINTER);
+    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
+    AssertReturn(cbPath,     VERR_INVALID_PARAMETER);
+
+    LogFlowFunc(("pszPath=%s, cbPath=%RU32, fMode=0x%x\n", pszPath, cbPath, fMode));
+
+    int rc;
+    char *pszDir = RTPathJoinA(DnDDirDroppedFilesGetDirAbs(&pCtx->mURI.mDropDir), pszPath);
+    if (pszDir)
+    {
+        rc = RTDirCreateFullPath(pszDir, fMode);
+        if (RT_FAILURE(rc))
+            LogRel2(("DnD: Error creating guest directory \"%s\" on the host, rc=%Rrc\n", pszDir, rc));
+
+        RTStrFree(pszDir);
+    }
+    else
+         rc = VERR_NO_MEMORY;
+
+    if (RT_SUCCESS(rc))
+    {
+        if (mDataBase.mProtocolVersion <= 2)
+        {
+            /*
+             * Protocols v1/v2 do *not* send root element names (files/directories)
+             * in URI format. The initial GUEST_DND_GH_SND_DATA message(s) however
+             * did take those element names into account, but *with* URI decoration
+             * when it comes to communicating the total bytes being sent.
+             *
+             * So translate the path into a valid URI path and add the resulting
+             * length (+ "\r\n" and termination) to the total bytes received
+             * to keep the accounting right.
+             */
+            char *pszPathURI = RTUriCreate("file" /* pszScheme */, "/" /* pszAuthority */,
+                                           pszPath /* pszPath */,
+                                           NULL /* pszQuery */, NULL /* pszFragment */);
+            if (pszPathURI)
+            {
+                bool fHasPath = RTPathHasPath(pszPath); /* Use original data received. */
+                if (!fHasPath) /* Root path? */
+                {
+                    cbPath  = strlen(pszPathURI);
+                    cbPath += 3;                  /* Include "\r" + "\n" + termination -- see above. */
+
+                    rc = i_updateProcess(pCtx, cbPath);
+                }
+
+                LogFlowFunc(("URI pszPathURI=%s, fHasPath=%RTbool, cbPath=%RU32\n", pszPathURI, fHasPath, cbPath));
+                RTStrFree(pszPathURI);
+            }
+            else
+                rc = VERR_NO_MEMORY;
+        }
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDSource::i_onReceiveFileHdr(PRECVDATACTX pCtx, const char *pszPath, uint32_t cbPath,
+                                       uint64_t cbSize, uint32_t fMode, uint32_t fFlags)
+{
+    AssertPtrReturn(pCtx,    VERR_INVALID_POINTER);
+    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
+    AssertReturn(cbPath,     VERR_INVALID_PARAMETER);
+    AssertReturn(fMode,      VERR_INVALID_PARAMETER);
+    /* fFlags are optional. */
+
+    LogFlowFunc(("pszPath=%s, cbPath=%RU32, cbSize=%RU64, fMode=0x%x, fFlags=0x%x\n", pszPath, cbPath, cbSize, fMode, fFlags));
+
+    int rc = VINF_SUCCESS;
+
+    do
+    {
+        if (!pCtx->mURI.objURI.IsComplete())
+        {
+            LogFlowFunc(("Warning: Object \"%s\" not complete yet\n", pCtx->mURI.objURI.GetDestPath().c_str()));
+            rc = VERR_INVALID_PARAMETER;
+            break;
+        }
+
+        if (pCtx->mURI.objURI.IsOpen()) /* File already opened? */
+        {
+            LogFlowFunc(("Warning: Current opened object is \"%s\"\n", pCtx->mURI.objURI.GetDestPath().c_str()));
+            rc = VERR_WRONG_ORDER;
+            break;
+        }
+
+        char pszPathAbs[RTPATH_MAX];
+        rc = RTPathJoin(pszPathAbs, sizeof(pszPathAbs), DnDDirDroppedFilesGetDirAbs(&pCtx->mURI.mDropDir), pszPath);
+        if (RT_FAILURE(rc))
+        {
+            LogFlowFunc(("Warning: Rebasing current file failed with rc=%Rrc\n", rc));
+            break;
+        }
+
+        rc = DnDPathSanitize(pszPathAbs, sizeof(pszPathAbs));
+        if (RT_FAILURE(rc))
+        {
+            LogFlowFunc(("Warning: Rebasing current file failed with rc=%Rrc\n", rc));
+            break;
+        }
+
+        LogFunc(("Rebased to: %s\n", pszPathAbs));
+
+        /** @todo Add sparse file support based on fFlags? (Use Open(..., fFlags | SPARSE). */
+        rc = pCtx->mURI.objURI.OpenEx(pszPathAbs, DnDURIObject::File, DnDURIObject::Target,
+                                      RTFILE_O_CREATE_REPLACE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE,
+                                      (fMode & RTFS_UNIX_MASK) | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR);
+        if (RT_SUCCESS(rc))
+        {
+            /* Note: Protocol v1 does not send any file sizes, so always 0. */
+            if (mDataBase.mProtocolVersion >= 2)
+                rc = pCtx->mURI.objURI.SetSize(cbSize);
+
+            /** @todo Unescpae path before printing. */
+            LogRel2(("DnD: Transferring guest file to host: %s (%RU64 bytes, mode 0x%x)\n",
+                     pCtx->mURI.objURI.GetDestPath().c_str(), pCtx->mURI.objURI.GetSize(), pCtx->mURI.objURI.GetMode()));
+
+            /** @todo Set progress object title to current file being transferred? */
+
+            if (!cbSize) /* 0-byte file? Close again. */
+                pCtx->mURI.objURI.Close();
+        }
+        else
+        {
+            LogRel2(("DnD: Error opening/creating guest file '%s' on host, rc=%Rrc\n",
+                     pCtx->mURI.objURI.GetDestPath().c_str(), rc));
+            break;
+        }
+
+        if (mDataBase.mProtocolVersion <= 2)
+        {
+            /*
+             * Protocols v1/v2 do *not* send root element names (files/directories)
+             * in URI format. The initial GUEST_DND_GH_SND_DATA message(s) however
+             * did take those element names into account, but *with* URI decoration
+             * when it comes to communicating the total bytes being sent.
+             *
+             * So translate the path into a valid URI path and add the resulting
+             * length (+ "\r\n" and termination) to the total bytes received
+             * to keep the accounting right.
+             */
+            char *pszPathURI = RTUriCreate("file" /* pszScheme */, "/" /* pszAuthority */,
+                                           pszPath /* pszPath */,
+                                           NULL /* pszQuery */, NULL /* pszFragment */);
+            if (pszPathURI)
+            {
+                bool fHasPath = RTPathHasPath(pszPath); /* Use original data received. */
+                if (!fHasPath) /* Root path? */
+                {
+                    cbPath  = strlen(pszPathURI);
+                    cbPath += 3;                  /* Include "\r" + "\n" + termination -- see above. */
+
+                    rc = i_updateProcess(pCtx, cbPath);
+                }
+
+                LogFlowFunc(("URI pszPathURI=%s, fHasPath=%RTbool, cbPath=%RU32\n", pszPathURI, fHasPath, cbPath));
+                RTStrFree(pszPathURI);
+            }
+            else
+            {
+                rc = VERR_NO_MEMORY;
+                break;
+            }
+        }
+
+    } while (0);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDSource::i_onReceiveFileData(PRECVDATACTX pCtx, const void *pvData, uint32_t cbData)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvData, VERR_INVALID_POINTER);
+    AssertReturn(cbData, VERR_INVALID_PARAMETER);
+
+    int rc = VINF_SUCCESS;
+
+    do
+    {
+        if (pCtx->mURI.objURI.IsComplete())
+        {
+            LogFlowFunc(("Warning: Object \"%s\" already completed\n", pCtx->mURI.objURI.GetDestPath().c_str()));
+            rc = VERR_WRONG_ORDER;
+            break;
+        }
+
+        if (!pCtx->mURI.objURI.IsOpen()) /* File opened on host? */
+        {
+            LogFlowFunc(("Warning: Object \"%s\" not opened\n", pCtx->mURI.objURI.GetDestPath().c_str()));
+            rc = VERR_WRONG_ORDER;
+            break;
+        }
+
+        uint32_t cbWritten;
+        rc = pCtx->mURI.objURI.Write(pvData, cbData, &cbWritten);
+        if (RT_SUCCESS(rc))
+        {
+            Assert(cbWritten <= cbData);
+            if (cbWritten < cbData)
+            {
+                /** @todo What to do when the host's disk is full? */
+                rc = VERR_DISK_FULL;
+            }
+
+            if (RT_SUCCESS(rc))
+                rc = i_updateProcess(pCtx, cbWritten);
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            if (pCtx->mURI.objURI.IsComplete())
+            {
+                /** @todo Sanitize path. */
+                LogRel2(("DnD: File transfer to host complete: %s\n", pCtx->mURI.objURI.GetDestPath().c_str()));
+                rc = VINF_EOF;
+
+                /* Prepare URI object for next use. */
+                pCtx->mURI.objURI.Reset();
+            }
+        }
+        else
+            LogRel(("DnD: Error writing guest file to host to \"%s\": %Rrc\n", pCtx->mURI.objURI.GetDestPath().c_str(), rc));
+
+    } while (0);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
+
+int GuestDnDSource::i_receiveData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    GuestDnD *pInst = GuestDnDInst();
+    if (!pInst)
+        return VERR_INVALID_POINTER;
+
+    GuestDnDResponse *pResp = pCtx->mpResp;
+    AssertPtr(pCtx->mpResp);
+
+    /* Is this context already in receiving state? */
+    if (ASMAtomicReadBool(&pCtx->mIsActive))
+        return VERR_WRONG_ORDER;
+
+    ASMAtomicWriteBool(&pCtx->mIsActive, true);
+
+    int rc = pCtx->mCallback.Reset();
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /*
+     * Reset any old data.
+     */
+    pCtx->mData.Reset();
+    pCtx->mURI.Reset();
+
+    /* Set the format we are going to retrieve to have it around
+     * when retrieving the data later. */
+    pResp->reset();
+    pResp->setFormat(pCtx->mFormat);
+
+    bool fHasURIList = DnDMIMENeedsDropDir(pCtx->mFormat.c_str(), pCtx->mFormat.length());
+    LogFlowFunc(("strFormat=%s, uAction=0x%x, fHasURIList=%RTbool\n", pCtx->mFormat.c_str(), pCtx->mAction, fHasURIList));
+    if (fHasURIList)
+    {
+        rc = i_receiveURIData(pCtx, msTimeout);
+    }
+    else
+    {
+        rc = i_receiveRawData(pCtx, msTimeout);
+    }
+
+    ASMAtomicWriteBool(&pCtx->mIsActive, false);
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/* static */
+DECLCALLBACK(int) GuestDnDSource::i_receiveDataThread(RTTHREAD Thread, void *pvUser)
+{
+    LogFlowFunc(("pvUser=%p\n", pvUser));
+
+    RecvDataTask *pTask = (RecvDataTask *)pvUser;
+    AssertPtrReturn(pTask, VERR_INVALID_POINTER);
+
+    const ComObjPtr<GuestDnDSource> pSource(pTask->getSource());
+    Assert(!pSource.isNull());
+
+    int rc;
+
+    AutoCaller autoCaller(pSource);
+    if (SUCCEEDED(autoCaller.rc()))
+    {
+        rc = pSource->i_receiveData(pTask->getCtx(), RT_INDEFINITE_WAIT /* msTimeout */);
+    }
+    else
+        rc = VERR_COM_INVALID_OBJECT_STATE;
+
+    ASMAtomicWriteBool(&pSource->mDataBase.mfTransferIsPending, false);
+
+    if (pTask)
+        delete pTask;
+
+    LogFlowFunc(("pSource=%p returning rc=%Rrc\n", (GuestDnDSource *)pSource, rc));
+    return rc;
+}
+
+int GuestDnDSource::i_receiveRawData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    int rc;
+
+    GuestDnDResponse *pResp = pCtx->mpResp;
+    AssertPtr(pCtx->mpResp);
+
+    GuestDnD *pInst = GuestDnDInst();
+    if (!pInst)
+        return VERR_INVALID_POINTER;
+
+#define REGISTER_CALLBACK(x) \
+    rc = pResp->setCallback(x, i_receiveRawDataCallback, pCtx); \
+    if (RT_FAILURE(rc)) \
+        return rc;
+
+#define UNREGISTER_CALLBACK(x) \
+    rc = pCtx->mpResp->setCallback(x, NULL); \
+    AssertRC(rc);
+
+    /*
+     * Register callbacks.
+     */
+    REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_EVT_ERROR);
+    REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_DATA);
+
+    do
+    {
+        /*
+         * Receive the raw data.
+         */
+        GuestDnDMsg Msg;
+        Msg.setType(DragAndDropSvc::HOST_DND_GH_EVT_DROPPED);
+        Msg.setNextPointer((void*)pCtx->mFormat.c_str(), (uint32_t)pCtx->mFormat.length() + 1);
+        Msg.setNextUInt32((uint32_t)pCtx->mFormat.length() + 1);
+        Msg.setNextUInt32(pCtx->mAction);
+
+        /* Make the initial call to the guest by telling that we initiated the "dropped" event on
+         * the host and therefore now waiting for the actual raw data. */
+        rc = pInst->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
+        if (RT_SUCCESS(rc))
+            rc = waitForEvent(msTimeout, pCtx->mCallback, pCtx->mpResp);
+
+    } while (0);
+
+    /*
+     * Unregister callbacks.
+     */
+    UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_EVT_ERROR);
+    UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_DATA);
+
+#undef REGISTER_CALLBACK
+#undef UNREGISTER_CALLBACK
+
+    if (rc == VERR_CANCELLED)
+    {
+        int rc2 = sendCancel();
+        AssertRC(rc2);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDSource::i_receiveURIData(PRECVDATACTX pCtx, RTMSINTERVAL msTimeout)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    int rc;
+
+    GuestDnDResponse *pResp = pCtx->mpResp;
+    AssertPtr(pCtx->mpResp);
+
+    GuestDnD *pInst = GuestDnDInst();
+    if (!pInst)
+        return VERR_INVALID_POINTER;
+
+#define REGISTER_CALLBACK(x)                                    \
+    rc = pResp->setCallback(x, i_receiveURIDataCallback, pCtx); \
+    if (RT_FAILURE(rc))                                         \
+        return rc;
+
+#define UNREGISTER_CALLBACK(x)                                  \
+    {                                                           \
+        int rc2 = pResp->setCallback(x, NULL);                  \
+        AssertRC(rc2);                                          \
+    }
+
+    /*
+     * Register callbacks.
+     */
+    /* Guest callbacks. */
+    REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_EVT_ERROR);
+    REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_DATA);
+    REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_DIR);
+    if (mDataBase.mProtocolVersion >= 2)
+        REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_FILE_HDR);
+    REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_FILE_DATA);
+
+    do
+    {
+        rc = DnDDirDroppedFilesCreateAndOpenTemp(&pCtx->mURI.mDropDir);
+        if (RT_FAILURE(rc))
+            break;
+        LogFlowFunc(("rc=%Rrc, strDropDir=%s\n", rc, DnDDirDroppedFilesGetDirAbs(&pCtx->mURI.mDropDir)));
+        if (RT_FAILURE(rc))
+            break;
+
+        /*
+         * Receive the URI list.
+         */
+        GuestDnDMsg Msg;
+        Msg.setType(DragAndDropSvc::HOST_DND_GH_EVT_DROPPED);
+        Msg.setNextPointer((void*)pCtx->mFormat.c_str(), (uint32_t)pCtx->mFormat.length() + 1);
+        Msg.setNextUInt32((uint32_t)pCtx->mFormat.length() + 1);
+        Msg.setNextUInt32(pCtx->mAction);
+
+        /* Make the initial call to the guest by telling that we initiated the "dropped" event on
+         * the host and therefore now waiting for the actual URI data. */
+        rc = pInst->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
+        if (RT_SUCCESS(rc))
+            rc = waitForEvent(msTimeout, pCtx->mCallback, pCtx->mpResp);
+
+    } while (0);
+
+    /*
+     * Unregister callbacks.
+     */
+    UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_EVT_ERROR);
+    UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_DATA);
+    UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_DIR);
+    if (mDataBase.mProtocolVersion >= 2)
+        UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_FILE_HDR);
+    UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_SND_FILE_DATA);
+
+#undef REGISTER_CALLBACK
+#undef UNREGISTER_CALLBACK
+
+    int rc2;
+
+    if (rc == VERR_CANCELLED)
+    {
+        rc2 = sendCancel();
+        AssertRC(rc2);
+    }
+
+    if (RT_FAILURE(rc))
+    {
+        rc2 = DnDDirDroppedFilesRollback(&pCtx->mURI.mDropDir); /** @todo Inform user on rollback failure? */
+        LogFlowFunc(("Rolling back ended with rc=%Rrc\n", rc2));
+    }
+
+    rc2 = DnDDirDroppedFilesClose(&pCtx->mURI.mDropDir, RT_FAILURE(rc) ? true : false /* fRemove */);
+    if (RT_SUCCESS(rc))
+        rc = rc2;
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/* static */
+DECLCALLBACK(int) GuestDnDSource::i_receiveRawDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser)
+{
+    PRECVDATACTX pCtx = (PRECVDATACTX)pvUser;
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    GuestDnDSource *pThis = pCtx->mpSource;
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("pThis=%p, uMsg=%RU32\n", pThis, uMsg));
+
+    int rc = VINF_SUCCESS;
+
+    switch (uMsg)
+    {
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+        case DragAndDropSvc::GUEST_DND_GH_SND_DATA:
+        {
+            DragAndDropSvc::PVBOXDNDCBSNDDATADATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBSNDDATADATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBSNDDATADATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            rc = pThis->i_onReceiveData(pCtx, pCBData->pvData, pCBData->cbData, pCBData->cbTotalSize);
+            break;
+        }
+        case DragAndDropSvc::GUEST_DND_GH_EVT_ERROR:
+        {
+            DragAndDropSvc::PVBOXDNDCBEVTERRORDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBEVTERRORDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            pCtx->mpResp->reset();
+            rc = pCtx->mpResp->setProgress(100, DragAndDropSvc::DND_PROGRESS_ERROR, pCBData->rc);
+            if (RT_SUCCESS(rc))
+                rc = pCBData->rc;
+            break;
+        }
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
+        default:
+            rc = VERR_NOT_SUPPORTED;
+            break;
+    }
+
+    if (RT_FAILURE(rc))
+    {
+        int rc2 = pCtx->mCallback.Notify(rc);
+        AssertRC(rc2);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc; /* Tell the guest. */
+}
+
+/* static */
+DECLCALLBACK(int) GuestDnDSource::i_receiveURIDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser)
+{
+    PRECVDATACTX pCtx = (PRECVDATACTX)pvUser;
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    GuestDnDSource *pThis = pCtx->mpSource;
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("pThis=%p, uMsg=%RU32\n", pThis, uMsg));
+
+    int rc = VINF_SUCCESS;
+
+    int rcCallback = VINF_SUCCESS; /* rc for the callback. */
+    bool fNotify = false;
+
+    switch (uMsg)
+    {
+#ifdef VBOX_WITH_DRAG_AND_DROP_GH
+        case DragAndDropSvc::GUEST_DND_GH_SND_DATA:
+        {
+            DragAndDropSvc::PVBOXDNDCBSNDDATADATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBSNDDATADATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBSNDDATADATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_SND_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            rc = pThis->i_onReceiveData(pCtx, pCBData->pvData, pCBData->cbData, pCBData->cbTotalSize);
+            break;
+        }
+        case DragAndDropSvc::GUEST_DND_GH_SND_DIR:
+        {
+            DragAndDropSvc::PVBOXDNDCBSNDDIRDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBSNDDIRDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBSNDDIRDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_SND_DIR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            rc = pThis->i_onReceiveDir(pCtx, pCBData->pszPath, pCBData->cbPath, pCBData->fMode);
+            break;
+        }
+        case DragAndDropSvc::GUEST_DND_GH_SND_FILE_HDR:
+        {
+            DragAndDropSvc::PVBOXDNDCBSNDFILEHDRDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBSNDFILEHDRDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBSNDFILEHDRDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_SND_FILE_HDR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            rc = pThis->i_onReceiveFileHdr(pCtx, pCBData->pszFilePath, pCBData->cbFilePath,
+                                           pCBData->cbSize, pCBData->fMode, pCBData->fFlags);
+            break;
+        }
+        case DragAndDropSvc::GUEST_DND_GH_SND_FILE_DATA:
+        {
+            DragAndDropSvc::PVBOXDNDCBSNDFILEDATADATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBSNDFILEDATADATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBSNDFILEDATADATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_SND_FILE_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            if (pThis->mDataBase.mProtocolVersion <= 1)
+            {
+                /**
+                 * Notes for protocol v1 (< VBox 5.0):
+                 * - Every time this command is being sent it includes the file header,
+                 *   so just process both calls here.
+                 * - There was no information whatsoever about the total file size; the old code only
+                 *   appended data to the desired file. So just pass 0 as cbSize.
+                 */
+                rc = pThis->i_onReceiveFileHdr(pCtx,
+                                               pCBData->u.v1.pszFilePath, pCBData->u.v1.cbFilePath,
+                                               0 /* cbSize */, pCBData->u.v1.fMode, 0 /* fFlags */);
+                if (RT_SUCCESS(rc))
+                    rc = pThis->i_onReceiveFileData(pCtx, pCBData->pvData, pCBData->cbData);
+            }
+            else /* Protocol v2 and up. */
+                rc = pThis->i_onReceiveFileData(pCtx, pCBData->pvData, pCBData->cbData);
+            break;
+        }
+        case DragAndDropSvc::GUEST_DND_GH_EVT_ERROR:
+        {
+            DragAndDropSvc::PVBOXDNDCBEVTERRORDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBEVTERRORDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            pCtx->mpResp->reset();
+            if (RT_SUCCESS(pCBData->rc))
+                pCBData->rc = VERR_GENERAL_FAILURE; /* Make sure some error is set. */
+            rc = pCtx->mpResp->setProgress(100, DragAndDropSvc::DND_PROGRESS_ERROR, pCBData->rc);
+            if (RT_SUCCESS(rc))
+                rcCallback = pCBData->rc;
+            break;
+        }
+#endif /* VBOX_WITH_DRAG_AND_DROP_GH */
+        default:
+            rc = VERR_NOT_SUPPORTED;
+            break;
+    }
+
+    if (   RT_FAILURE(rc)
+        || RT_FAILURE(rcCallback))
+    {
+        fNotify = true;
+        if (RT_SUCCESS(rcCallback))
+            rcCallback = rc;
+    }
+
+    /* All URI data processed? */
+    if (pCtx->mData.cbProcessed >= pCtx->mData.cbToProcess)
+    {
+        Assert(pCtx->mData.cbProcessed == pCtx->mData.cbToProcess);
+        fNotify = true;
+    }
+
+    LogFlowFunc(("cbProcessed=%RU64, cbToProcess=%RU64, fNotify=%RTbool, rcCallback=%Rrc, rc=%Rrc\n",
+                 pCtx->mData.cbProcessed, pCtx->mData.cbToProcess, fNotify, rcCallback, rc));
+
+    if (fNotify)
+    {
+        int rc2 = pCtx->mCallback.Notify(rcCallback);
+        AssertRC(rc2);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc; /* Tell the guest. */
+}
+
+int GuestDnDSource::i_updateProcess(PRECVDATACTX pCtx, uint32_t cbDataAdd)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    pCtx->mData.cbProcessed += cbDataAdd;
+    Assert(pCtx->mData.cbProcessed <= pCtx->mData.cbToProcess);
+
+    int64_t cbTotal  = pCtx->mData.cbToProcess;
+    uint8_t uPercent = pCtx->mData.cbProcessed * 100 / (cbTotal ? cbTotal : 1);
+
+    int rc = pCtx->mpResp->setProgress(uPercent,
+                                         uPercent >= 100
+                                       ? DragAndDropSvc::DND_PROGRESS_COMPLETE
+                                       : DragAndDropSvc::DND_PROGRESS_RUNNING);
+    return rc;
+}
+
diff --git a/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp b/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
new file mode 100644
index 0000000..7644aa0
--- /dev/null
+++ b/src/VBox/Main/src-client/GuestDnDTargetImpl.cpp
@@ -0,0 +1,1199 @@
+/* $Id: GuestDnDTargetImpl.cpp $ */
+/** @file
+ * VBox Console COM Class implementation - Guest drag'n drop target.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "GuestImpl.h"
+#include "GuestDnDTargetImpl.h"
+#include "ConsoleImpl.h"
+
+#include "Global.h"
+#include "AutoCaller.h"
+
+#include <algorithm>        /* For std::find(). */
+
+#include <iprt/asm.h>
+#include <iprt/file.h>
+#include <iprt/dir.h>
+#include <iprt/path.h>
+#include <iprt/uri.h>
+#include <iprt/cpp/utils.h> /* For unconst(). */
+
+#include <VBox/com/array.h>
+
+#include <VBox/GuestHost/DragAndDrop.h>
+#include <VBox/HostServices/Service.h>
+
+#ifdef LOG_GROUP
+ #undef LOG_GROUP
+#endif
+#define LOG_GROUP LOG_GROUP_GUEST_DND
+#include <VBox/log.h>
+
+
+/**
+ * Base class for a target task.
+ */
+class GuestDnDTargetTask
+{
+public:
+
+    GuestDnDTargetTask(GuestDnDTarget *pTarget)
+        : mTarget(pTarget),
+          mRC(VINF_SUCCESS) { }
+
+    virtual ~GuestDnDTargetTask(void) { }
+
+    int getRC(void) const { return mRC; }
+    bool isOk(void) const { return RT_SUCCESS(mRC); }
+    const ComObjPtr<GuestDnDTarget> &getTarget(void) const { return mTarget; }
+
+protected:
+
+    const ComObjPtr<GuestDnDTarget>     mTarget;
+    int                                 mRC;
+};
+
+/**
+ * Task structure for sending data to a target using
+ * a worker thread.
+ */
+class SendDataTask : public GuestDnDTargetTask
+{
+public:
+
+    SendDataTask(GuestDnDTarget *pTarget, PSENDDATACTX pCtx)
+        : GuestDnDTargetTask(pTarget),
+          mpCtx(pCtx) { }
+
+    virtual ~SendDataTask(void)
+    {
+        if (mpCtx)
+        {
+            delete mpCtx;
+            mpCtx = NULL;
+        }
+    }
+
+
+    PSENDDATACTX getCtx(void) { return mpCtx; }
+
+protected:
+
+    /** Pointer to send data context. */
+    PSENDDATACTX mpCtx;
+};
+
+// constructor / destructor
+/////////////////////////////////////////////////////////////////////////////
+
+DEFINE_EMPTY_CTOR_DTOR(GuestDnDTarget)
+
+HRESULT GuestDnDTarget::FinalConstruct(void)
+{
+    /* Set the maximum block size our guests can handle to 64K. This always has
+     * been hardcoded until now. */
+    /* Note: Never ever rely on information from the guest; the host dictates what and
+     *       how to do something, so try to negogiate a sensible value here later. */
+    mData.mcbBlockSize = _64K; /** @todo Make this configurable. */
+
+    LogFlowThisFunc(("\n"));
+    return BaseFinalConstruct();
+}
+
+void GuestDnDTarget::FinalRelease(void)
+{
+    LogFlowThisFuncEnter();
+    uninit();
+    BaseFinalRelease();
+    LogFlowThisFuncLeave();
+}
+
+// public initializer/uninitializer for internal purposes only
+/////////////////////////////////////////////////////////////////////////////
+
+int GuestDnDTarget::init(const ComObjPtr<Guest>& pGuest)
+{
+    LogFlowThisFuncEnter();
+
+    /* Enclose the state transition NotReady->InInit->Ready. */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+
+    unconst(m_pGuest) = pGuest;
+
+    /* Confirm a successful initialization when it's the case. */
+    autoInitSpan.setSucceeded();
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Uninitializes the instance.
+ * Called from FinalRelease().
+ */
+void GuestDnDTarget::uninit(void)
+{
+    LogFlowThisFunc(("\n"));
+
+    /* Enclose the state transition Ready->InUninit->NotReady. */
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
+}
+
+// implementation of wrapped IDnDBase methods.
+/////////////////////////////////////////////////////////////////////////////
+
+HRESULT GuestDnDTarget::isFormatSupported(const com::Utf8Str &aFormat, BOOL *aSupported)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_isFormatSupported(aFormat, aSupported);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDTarget::getFormats(std::vector<com::Utf8Str> &aFormats)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_getFormats(aFormats);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDTarget::addFormats(const std::vector<com::Utf8Str> &aFormats)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_addFormats(aFormats);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDTarget::removeFormats(const std::vector<com::Utf8Str> &aFormats)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_removeFormats(aFormats);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDTarget::getProtocolVersion(ULONG *aProtocolVersion)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    return GuestDnDBase::i_getProtocolVersion(aProtocolVersion);
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+// implementation of wrapped IDnDTarget methods.
+/////////////////////////////////////////////////////////////////////////////
+
+HRESULT GuestDnDTarget::enter(ULONG aScreenId, ULONG aX, ULONG aY,
+                              DnDAction_T aDefaultAction,
+                              const std::vector<DnDAction_T> &aAllowedActions,
+                              const std::vector<com::Utf8Str> &aFormats,
+                              DnDAction_T *aResultAction)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    /* Input validation. */
+    if (aDefaultAction == DnDAction_Ignore)
+        return setError(E_INVALIDARG, tr("No default action specified"));
+    if (!aAllowedActions.size())
+        return setError(E_INVALIDARG, tr("Number of allowed actions is empty"));
+    if (!aFormats.size())
+        return setError(E_INVALIDARG, tr("Number of supported formats is empty"));
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* Determine guest DnD protocol to use. */
+    GuestDnDBase::getProtocolVersion(&mDataBase.mProtocolVersion);
+
+    /* Default action is ignoring. */
+    DnDAction_T resAction = DnDAction_Ignore;
+
+    /* Check & convert the drag & drop actions */
+    uint32_t uDefAction      = 0;
+    uint32_t uAllowedActions = 0;
+    GuestDnD::toHGCMActions(aDefaultAction, &uDefAction,
+                            aAllowedActions, &uAllowedActions);
+    /* If there is no usable action, ignore this request. */
+    if (isDnDIgnoreAction(uDefAction))
+        return S_OK;
+
+    /* Make a flat data string out of the supported format list. */
+    Utf8Str strFormats = GuestDnD::toFormatString(m_strFormats, aFormats);
+    /* If there is no valid supported format, ignore this request. */
+    if (strFormats.isEmpty())
+        return S_OK;
+
+    HRESULT hr = S_OK;
+
+    /* Adjust the coordinates in a multi-monitor setup. */
+    int rc = GuestDnDInst()->adjustScreenCoordinates(aScreenId, &aX, &aY);
+    if (RT_SUCCESS(rc))
+    {
+        GuestDnDMsg Msg;
+        Msg.setType(DragAndDropSvc::HOST_DND_HG_EVT_ENTER);
+        Msg.setNextUInt32(aScreenId);
+        Msg.setNextUInt32(aX);
+        Msg.setNextUInt32(aY);
+        Msg.setNextUInt32(uDefAction);
+        Msg.setNextUInt32(uAllowedActions);
+        Msg.setNextPointer((void*)strFormats.c_str(), strFormats.length() + 1);
+        Msg.setNextUInt32(strFormats.length() + 1);
+
+        rc = GuestDnDInst()->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
+        if (RT_SUCCESS(rc))
+        {
+            GuestDnDResponse *pResp = GuestDnDInst()->response();
+            if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
+                resAction = GuestDnD::toMainAction(pResp->defAction());
+        }
+    }
+
+    if (aResultAction)
+        *aResultAction = resAction;
+
+    LogFlowFunc(("hr=%Rhrc, resAction=%ld\n", hr, resAction));
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDTarget::move(ULONG aScreenId, ULONG aX, ULONG aY,
+                             DnDAction_T aDefaultAction,
+                             const std::vector<DnDAction_T> &aAllowedActions,
+                             const std::vector<com::Utf8Str> &aFormats,
+                             DnDAction_T *aResultAction)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    /* Input validation. */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* Default action is ignoring. */
+    DnDAction_T resAction = DnDAction_Ignore;
+
+    /* Check & convert the drag & drop actions. */
+    uint32_t uDefAction      = 0;
+    uint32_t uAllowedActions = 0;
+    GuestDnD::toHGCMActions(aDefaultAction, &uDefAction,
+                            aAllowedActions, &uAllowedActions);
+    /* If there is no usable action, ignore this request. */
+    if (isDnDIgnoreAction(uDefAction))
+        return S_OK;
+
+    /* Make a flat data string out of the supported format list. */
+    RTCString strFormats = GuestDnD::toFormatString(m_strFormats, aFormats);
+    /* If there is no valid supported format, ignore this request. */
+    if (strFormats.isEmpty())
+        return S_OK;
+
+    HRESULT hr = S_OK;
+
+    int rc = GuestDnDInst()->adjustScreenCoordinates(aScreenId, &aX, &aY);
+    if (RT_SUCCESS(rc))
+    {
+        GuestDnDMsg Msg;
+        Msg.setType(DragAndDropSvc::HOST_DND_HG_EVT_MOVE);
+        Msg.setNextUInt32(aScreenId);
+        Msg.setNextUInt32(aX);
+        Msg.setNextUInt32(aY);
+        Msg.setNextUInt32(uDefAction);
+        Msg.setNextUInt32(uAllowedActions);
+        Msg.setNextPointer((void*)strFormats.c_str(), strFormats.length() + 1);
+        Msg.setNextUInt32(strFormats.length() + 1);
+
+        rc = GuestDnDInst()->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
+        if (RT_SUCCESS(rc))
+        {
+            GuestDnDResponse *pResp = GuestDnDInst()->response();
+            if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
+                resAction = GuestDnD::toMainAction(pResp->defAction());
+        }
+    }
+
+    if (aResultAction)
+        *aResultAction = resAction;
+
+    LogFlowFunc(("hr=%Rhrc, *pResultAction=%ld\n", hr, resAction));
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDTarget::leave(ULONG uScreenId)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    HRESULT hr = S_OK;
+    int rc = GuestDnDInst()->hostCall(DragAndDropSvc::HOST_DND_HG_EVT_LEAVE,
+                                      0 /* cParms */, NULL /* paParms */);
+    if (RT_SUCCESS(rc))
+    {
+        GuestDnDResponse *pResp = GuestDnDInst()->response();
+        if (pResp)
+            pResp->waitForGuestResponse();
+    }
+
+    LogFlowFunc(("hr=%Rhrc\n", hr));
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+HRESULT GuestDnDTarget::drop(ULONG aScreenId, ULONG aX, ULONG aY,
+                             DnDAction_T aDefaultAction,
+                             const std::vector<DnDAction_T> &aAllowedActions,
+                             const std::vector<com::Utf8Str> &aFormats,
+                             com::Utf8Str &aFormat, DnDAction_T *aResultAction)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    /* Input validation. */
+
+    /* Everything else is optional. */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* Default action is ignoring. */
+    DnDAction_T resAction = DnDAction_Ignore;
+
+    /* Check & convert the drag & drop actions. */
+    uint32_t uDefAction      = 0;
+    uint32_t uAllowedActions = 0;
+    GuestDnD::toHGCMActions(aDefaultAction, &uDefAction,
+                            aAllowedActions, &uAllowedActions);
+    /* If there is no usable action, ignore this request. */
+    if (isDnDIgnoreAction(uDefAction))
+        return S_OK;
+
+    /* Make a flat data string out of the supported format list. */
+    Utf8Str strFormats = GuestDnD::toFormatString(m_strFormats, aFormats);
+    /* If there is no valid supported format, ignore this request. */
+    if (strFormats.isEmpty())
+        return S_OK;
+
+    HRESULT hr = S_OK;
+
+    /* Adjust the coordinates in a multi-monitor setup. */
+    int rc = GuestDnDInst()->adjustScreenCoordinates(aScreenId, &aX, &aY);
+    if (RT_SUCCESS(rc))
+    {
+        GuestDnDMsg Msg;
+        Msg.setType(DragAndDropSvc::HOST_DND_HG_EVT_DROPPED);
+        Msg.setNextUInt32(aScreenId);
+        Msg.setNextUInt32(aX);
+        Msg.setNextUInt32(aY);
+        Msg.setNextUInt32(uDefAction);
+        Msg.setNextUInt32(uAllowedActions);
+        Msg.setNextPointer((void*)strFormats.c_str(), strFormats.length() + 1);
+        Msg.setNextUInt32(strFormats.length() + 1);
+
+        rc = GuestDnDInst()->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
+        if (RT_SUCCESS(rc))
+        {
+            GuestDnDResponse *pResp = GuestDnDInst()->response();
+            if (pResp && RT_SUCCESS(pResp->waitForGuestResponse()))
+            {
+                resAction = GuestDnD::toMainAction(pResp->defAction());
+                aFormat = pResp->format();
+
+                LogFlowFunc(("resFormat=%s, resAction=%RU32\n",
+                             pResp->format().c_str(), pResp->defAction()));
+            }
+        }
+    }
+
+    if (aResultAction)
+        *aResultAction = resAction;
+
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+/* static */
+DECLCALLBACK(int) GuestDnDTarget::i_sendDataThread(RTTHREAD Thread, void *pvUser)
+{
+    LogFlowFunc(("pvUser=%p\n", pvUser));
+
+    SendDataTask *pTask = (SendDataTask *)pvUser;
+    AssertPtrReturn(pTask, VERR_INVALID_POINTER);
+
+    const ComObjPtr<GuestDnDTarget> pTarget(pTask->getTarget());
+    Assert(!pTarget.isNull());
+
+    int rc;
+
+    AutoCaller autoCaller(pTarget);
+    if (SUCCEEDED(autoCaller.rc()))
+    {
+        rc = pTarget->i_sendData(pTask->getCtx(), RT_INDEFINITE_WAIT /* msTimeout */);
+        /* Nothing to do here anymore. */
+    }
+    else
+        rc = VERR_COM_INVALID_OBJECT_STATE;
+
+    ASMAtomicWriteBool(&pTarget->mDataBase.mfTransferIsPending, false);
+
+    if (pTask)
+        delete pTask;
+
+    LogFlowFunc(("pTarget=%p returning rc=%Rrc\n", (GuestDnDTarget *)pTarget, rc));
+    return rc;
+}
+
+/**
+ * Initiates a data transfer from the host to the guest. The source is the host whereas the target is the
+ * guest in this case.
+ *
+ * @return  HRESULT
+ * @param   aScreenId
+ * @param   aFormat
+ * @param   aData
+ * @param   aProgress
+ */
+HRESULT GuestDnDTarget::sendData(ULONG aScreenId, const com::Utf8Str &aFormat, const std::vector<BYTE> &aData,
+                                 ComPtr<IProgress> &aProgress)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* Input validation. */
+    if (RT_UNLIKELY((aFormat.c_str()) == NULL || *(aFormat.c_str()) == '\0'))
+        return setError(E_INVALIDARG, tr("No data format specified"));
+    if (RT_UNLIKELY(!aData.size()))
+        return setError(E_INVALIDARG, tr("No data to send specified"));
+
+    /* Note: At the moment we only support one transfer at a time. */
+    if (ASMAtomicReadBool(&mDataBase.mfTransferIsPending))
+        return setError(E_INVALIDARG, tr("Another send operation already is in progress"));
+
+    ASMAtomicWriteBool(&mDataBase.mfTransferIsPending, true);
+
+    /* Dito. */
+    GuestDnDResponse *pResp = GuestDnDInst()->response();
+    AssertPtr(pResp);
+
+    HRESULT hr = pResp->resetProgress(m_pGuest);
+    if (FAILED(hr))
+        return hr;
+
+    try
+    {
+        PSENDDATACTX pSendCtx = new SENDDATACTX;
+        RT_BZERO(pSendCtx, sizeof(SENDDATACTX));
+
+        pSendCtx->mpTarget      = this;
+        pSendCtx->mpResp        = pResp;
+        pSendCtx->mScreenID     = aScreenId;
+        pSendCtx->mFormat       = aFormat;
+        pSendCtx->mData.vecData = aData;
+
+        SendDataTask *pTask = new SendDataTask(this, pSendCtx);
+        AssertReturn(pTask->isOk(), pTask->getRC());
+
+        LogFlowFunc(("Starting thread ...\n"));
+
+        int rc = RTThreadCreate(NULL, GuestDnDTarget::i_sendDataThread,
+                                (void *)pTask, 0, RTTHREADTYPE_MAIN_WORKER, 0, "dndTgtSndData");
+        if (RT_SUCCESS(rc))
+        {
+            hr = pResp->queryProgressTo(aProgress.asOutParam());
+            ComAssertComRC(hr);
+
+            /* Note: pTask is now owned by the worker thread. */
+        }
+        else
+            hr = setError(VBOX_E_IPRT_ERROR, tr("Starting thread failed (%Rrc)"), rc);
+
+        if (RT_FAILURE(rc))
+            delete pSendCtx;
+    }
+    catch(std::bad_alloc &)
+    {
+        hr = setError(E_OUTOFMEMORY);
+    }
+
+    /* Note: mDataBase.mfTransferIsPending will be set to false again by i_sendDataThread. */
+
+    LogFlowFunc(("Returning hr=%Rhrc\n", hr));
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
+int GuestDnDTarget::i_cancelOperation(void)
+{
+    /** @todo Check for pending cancel requests. */
+
+#if 0 /** @todo Later. */
+    /* Cancel any outstanding waits for guest responses first. */
+    if (pResp)
+        pResp->notifyAboutGuestResponse();
+#endif
+
+    LogFlowFunc(("Cancelling operation, telling guest ...\n"));
+    return GuestDnDInst()->hostCall(DragAndDropSvc::HOST_DND_HG_EVT_CANCEL, 0 /* cParms */, NULL /*paParms*/);
+}
+
+int GuestDnDTarget::i_sendData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout)
+{
+    AssertPtrReturn(pCtx,  VERR_INVALID_POINTER);
+
+    GuestDnD *pInst = GuestDnDInst();
+    if (!pInst)
+        return VERR_INVALID_POINTER;
+
+    int rc;
+
+    ASMAtomicWriteBool(&pCtx->mIsActive, true);
+
+    /* Clear all remaining outgoing messages. */
+    mDataBase.mListOutgoing.clear();
+
+    const char *pszFormat = pCtx->mFormat.c_str();
+    uint32_t cbFormat = pCtx->mFormat.length() + 1;
+
+    /* Do we need to build up a file tree? */
+    bool fHasURIList = DnDMIMEHasFileURLs(pszFormat, cbFormat);
+    if (fHasURIList)
+    {
+        rc = i_sendURIData(pCtx, msTimeout);
+    }
+    else
+    {
+        rc = i_sendRawData(pCtx, msTimeout);
+    }
+
+    ASMAtomicWriteBool(&pCtx->mIsActive, false);
+
+#undef DATA_IS_VALID_BREAK
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDTarget::i_sendDirectory(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aDirectory)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    RTCString strPath = aDirectory.GetDestPath();
+    if (strPath.isEmpty())
+        return VERR_INVALID_PARAMETER;
+    if (strPath.length() >= RTPATH_MAX) /* Note: Maximum is RTPATH_MAX on guest side. */
+        return VERR_BUFFER_OVERFLOW;
+
+    LogFlowFunc(("Sending directory \"%s\" using protocol v%RU32 ...\n", strPath.c_str(), mDataBase.mProtocolVersion));
+
+    pMsg->setType(DragAndDropSvc::HOST_DND_HG_SND_DIR);
+    pMsg->setNextString(strPath.c_str());                  /* path */
+    pMsg->setNextUInt32((uint32_t)(strPath.length() + 1)); /* path length - note: Maximum is RTPATH_MAX on guest side. */
+    pMsg->setNextUInt32(aDirectory.GetMode());             /* mode */
+
+    return VINF_SUCCESS;
+}
+
+int GuestDnDTarget::i_sendFile(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aFile)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    RTCString strPathSrc = aFile.GetSourcePath();
+    if (strPathSrc.isEmpty())
+        return VERR_INVALID_PARAMETER;
+
+    int rc = VINF_SUCCESS;
+
+    LogFlowFunc(("Sending \"%s\" (%RU32 bytes buffer) using protocol v%RU32 ...\n",
+                 strPathSrc.c_str(), mData.mcbBlockSize, mDataBase.mProtocolVersion));
+
+    bool fOpen = aFile.IsOpen();
+    if (!fOpen)
+    {
+        LogFlowFunc(("Opening \"%s\" ...\n", strPathSrc.c_str()));
+        rc = aFile.OpenEx(strPathSrc, DnDURIObject::File, DnDURIObject::Source,
+                          RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE, 0 /* fFlags */);
+        if (RT_FAILURE(rc))
+            LogRel2(("DnD: Error opening host file \"%s\", rc=%Rrc\n", strPathSrc.c_str(), rc));
+    }
+
+    bool fSendFileData = false;
+    if (RT_SUCCESS(rc))
+    {
+        if (mDataBase.mProtocolVersion >= 2)
+        {
+            if (!fOpen)
+            {
+                /*
+                 * Since protocol v2 the file header and the actual file contents are
+                 * separate messages, so send the file header first.
+                 * The just registered callback will be called by the guest afterwards.
+                 */
+                pMsg->setType(DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR);
+                pMsg->setNextUInt32(0);                                            /* context ID */
+                rc = pMsg->setNextString(aFile.GetDestPath().c_str());             /* pvName */
+                AssertRC(rc);
+                pMsg->setNextUInt32((uint32_t)(aFile.GetDestPath().length() + 1)); /* cbName */
+                pMsg->setNextUInt32(0);                                            /* uFlags */
+                pMsg->setNextUInt32(aFile.GetMode());                              /* fMode */
+                pMsg->setNextUInt64(aFile.GetSize());                              /* uSize */
+
+                LogFlowFunc(("Sending file header ...\n"));
+                LogRel2(("DnD: Transferring host file to guest: %s (%RU64 bytes, mode 0x%x)\n",
+                         strPathSrc.c_str(), aFile.GetSize(), aFile.GetMode()));
+
+                /** @todo Set progress object title to current file being transferred? */
+            }
+            else
+            {
+                /* File header was sent, so only send the actual file data. */
+                fSendFileData = true;
+            }
+        }
+        else /* Protocol v1. */
+        {
+            /* Always send the file data, every time. */
+            fSendFileData = true;
+        }
+    }
+
+    if (   RT_SUCCESS(rc)
+        && fSendFileData)
+    {
+        rc = i_sendFileData(pCtx, pMsg, aFile);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDTarget::i_sendFileData(PSENDDATACTX pCtx, GuestDnDMsg *pMsg, DnDURIObject &aFile)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+    AssertPtrReturn(pMsg, VERR_INVALID_POINTER);
+
+    GuestDnDResponse *pResp = pCtx->mpResp;
+    AssertPtr(pResp);
+
+    /** @todo Don't allow concurrent reads per context! */
+
+    /* Something to transfer? */
+    if (   pCtx->mURI.lstURI.IsEmpty()
+        || !pCtx->mIsActive)
+    {
+        return VERR_WRONG_ORDER;
+    }
+
+    /*
+     * Start sending stuff.
+     */
+
+    /* Set the message type. */
+    pMsg->setType(DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA);
+
+    /* Protocol version 1 sends the file path *every* time with a new file chunk.
+     * In protocol version 2 we only do this once with HOST_DND_HG_SND_FILE_HDR. */
+    if (mDataBase.mProtocolVersion <= 1)
+    {
+        pMsg->setNextString(aFile.GetSourcePath().c_str());                  /* pvName */
+        pMsg->setNextUInt32((uint32_t)(aFile.GetSourcePath().length() + 1)); /* cbName */
+    }
+    else
+    {
+        /* Protocol version 2 also sends the context ID. Currently unused. */
+        pMsg->setNextUInt32(0);                                              /* context ID */
+    }
+
+    uint32_t cbRead = 0;
+
+    int rc = aFile.Read(pCtx->mURI.pvScratchBuf, pCtx->mURI.cbScratchBuf, &cbRead);
+    if (RT_SUCCESS(rc))
+    {
+        pCtx->mData.cbProcessed += cbRead;
+
+        if (mDataBase.mProtocolVersion <= 1)
+        {
+            pMsg->setNextPointer(pCtx->mURI.pvScratchBuf, cbRead);  /* pvData */
+            pMsg->setNextUInt32(cbRead);                            /* cbData */
+            pMsg->setNextUInt32(aFile.GetMode());                   /* fMode */
+        }
+        else
+        {
+            pMsg->setNextPointer(pCtx->mURI.pvScratchBuf, cbRead); /* pvData */
+            pMsg->setNextUInt32(cbRead);                           /* cbData */
+        }
+
+        if (aFile.IsComplete()) /* Done reading? */
+        {
+            LogRel2(("DnD: File transfer to guest complete: %s\n", aFile.GetSourcePath().c_str()));
+            LogFlowFunc(("File \"%s\" complete\n", aFile.GetSourcePath().c_str()));
+            rc = VINF_EOF;
+        }
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+/* static */
+DECLCALLBACK(int) GuestDnDTarget::i_sendURIDataCallback(uint32_t uMsg, void *pvParms, size_t cbParms, void *pvUser)
+{
+    PSENDDATACTX pCtx = (PSENDDATACTX)pvUser;
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    GuestDnDTarget *pThis = pCtx->mpTarget;
+    AssertPtrReturn(pThis, VERR_INVALID_POINTER);
+
+    LogFlowFunc(("pThis=%p, uMsg=%RU32\n", pThis, uMsg));
+
+    int rc = VINF_SUCCESS;
+
+    switch (uMsg)
+    {
+        case DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG:
+        {
+            DragAndDropSvc::PVBOXDNDCBHGGETNEXTHOSTMSG pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBHGGETNEXTHOSTMSG>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGGETNEXTHOSTMSG) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            try
+            {
+                GuestDnDMsg *pMsg = new GuestDnDMsg();
+
+                rc = pThis->i_sendURIDataLoop(pCtx, pMsg);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = pThis->msgQueueAdd(pMsg);
+                    if (RT_SUCCESS(rc)) /* Return message type & required parameter count to the guest. */
+                    {
+                        LogFlowFunc(("GUEST_DND_GET_NEXT_HOST_MSG -> %RU32 (%RU32 params)\n", pMsg->getType(), pMsg->getCount()));
+                        pCBData->uMsg   = pMsg->getType();
+                        pCBData->cParms = pMsg->getCount();
+                    }
+                }
+
+                if (RT_FAILURE(rc))
+                    delete pMsg;
+            }
+            catch(std::bad_alloc & /*e*/)
+            {
+                rc = VERR_NO_MEMORY;
+            }
+            break;
+        }
+        case DragAndDropSvc::GUEST_DND_GH_EVT_ERROR:
+        {
+            DragAndDropSvc::PVBOXDNDCBEVTERRORDATA pCBData = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBEVTERRORDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBEVTERRORDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_GH_EVT_ERROR == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            pCtx->mpResp->reset();
+            rc = pCtx->mpResp->setProgress(100, DragAndDropSvc::DND_PROGRESS_ERROR, pCBData->rc);
+            if (RT_SUCCESS(rc))
+                rc = pCBData->rc;
+            break;
+        }
+        case DragAndDropSvc::HOST_DND_HG_SND_DIR:
+        case DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR:
+        case DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA:
+        {
+            DragAndDropSvc::PVBOXDNDCBHGGETNEXTHOSTMSGDATA pCBData
+                = reinterpret_cast<DragAndDropSvc::PVBOXDNDCBHGGETNEXTHOSTMSGDATA>(pvParms);
+            AssertPtr(pCBData);
+            AssertReturn(sizeof(DragAndDropSvc::VBOXDNDCBHGGETNEXTHOSTMSGDATA) == cbParms, VERR_INVALID_PARAMETER);
+            AssertReturn(DragAndDropSvc::CB_MAGIC_DND_HG_GET_NEXT_HOST_MSG_DATA == pCBData->hdr.u32Magic, VERR_INVALID_PARAMETER);
+
+            LogFlowFunc(("pCBData->uMsg=%RU32, paParms=%p, cParms=%RU32\n", pCBData->uMsg, pCBData->paParms, pCBData->cParms));
+
+            GuestDnDMsg *pMsg = pThis->msgQueueGetNext();
+            if (pMsg)
+            {
+                /*
+                 * Sanity checks.
+                 */
+                if (   pCBData->uMsg    != uMsg
+                    || pCBData->paParms == NULL
+                    || pCBData->cParms  != pMsg->getCount())
+                {
+                    /* Start over. */
+                    pThis->msgQueueClear();
+
+                    rc = VERR_INVALID_PARAMETER;
+                }
+
+                if (RT_SUCCESS(rc))
+                {
+                    LogFlowFunc(("Returning uMsg=%RU32\n", uMsg));
+                    rc = HGCM::Message::copyParms(pMsg->getCount(), pMsg->getParms(), pCBData->paParms);
+                    if (RT_SUCCESS(rc))
+                    {
+                        pCBData->cParms = pMsg->getCount();
+                        pThis->msgQueueRemoveNext();
+                    }
+                    else
+                        LogFlowFunc(("Copying parameters failed with rc=%Rrc\n", rc));
+                }
+            }
+            else
+                rc = VERR_NO_DATA;
+
+            LogFlowFunc(("Processing next message ended with rc=%Rrc\n", rc));
+            break;
+        }
+        default:
+            rc = VERR_NOT_SUPPORTED;
+            break;
+    }
+
+    if (RT_FAILURE(rc))
+    {
+        switch (rc)
+        {
+            case VERR_NO_DATA:
+                LogRel2(("DnD: Transfer complete\n"));
+                break;
+
+            case VERR_CANCELLED:
+                LogRel2(("DnD: Transfer canceled\n"));
+                break;
+
+            default:
+                LogRel(("DnD: Error %Rrc occurred, aborting transfer\n", rc));
+                break;
+        }
+
+        /* Unregister this callback. */
+        AssertPtr(pCtx->mpResp);
+        int rc2 = pCtx->mpResp->setCallback(uMsg, NULL /* PFNGUESTDNDCALLBACK */);
+        AssertRC(rc2);
+
+        /* Notify waiters. */
+        rc2 = pCtx->mCallback.Notify(rc);
+        AssertRC(rc2);
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc; /* Tell the guest. */
+}
+
+int GuestDnDTarget::i_sendURIData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+    AssertPtr(pCtx->mpResp);
+
+#define URI_DATA_IS_VALID_BREAK(x) \
+    if (!x) \
+    { \
+        LogFlowFunc(("Invalid URI data value for \"" #x "\"\n")); \
+        rc = VERR_INVALID_PARAMETER; \
+        break; \
+    }
+
+    void *pvBuf = RTMemAlloc(mData.mcbBlockSize);
+    if (!pvBuf)
+        return VERR_NO_MEMORY;
+
+    int rc;
+
+#define REGISTER_CALLBACK(x)                                        \
+    rc = pCtx->mpResp->setCallback(x, i_sendURIDataCallback, pCtx); \
+    if (RT_FAILURE(rc))                                             \
+        return rc;
+
+#define UNREGISTER_CALLBACK(x)                        \
+    {                                                 \
+        int rc2 = pCtx->mpResp->setCallback(x, NULL); \
+        AssertRC(rc2);                                \
+    }
+
+    rc = pCtx->mCallback.Reset();
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /*
+     * Register callbacks.
+     */
+    /* Guest callbacks. */
+    REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG);
+    REGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_EVT_ERROR);
+    /* Host callbacks. */
+    REGISTER_CALLBACK(DragAndDropSvc::HOST_DND_HG_SND_DIR);
+    if (mDataBase.mProtocolVersion >= 2)
+        REGISTER_CALLBACK(DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR);
+    REGISTER_CALLBACK(DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA);
+
+    do
+    {
+        /*
+         * Set our scratch buffer.
+         */
+        pCtx->mURI.pvScratchBuf = pvBuf;
+        pCtx->mURI.cbScratchBuf = mData.mcbBlockSize;
+
+        /*
+         * Extract URI list from byte data.
+         */
+        DnDURIList &lstURI = pCtx->mURI.lstURI; /* Use the URI list from the context. */
+
+        const char *pszList = (const char *)&pCtx->mData.vecData.front();
+        URI_DATA_IS_VALID_BREAK(pszList);
+
+        uint32_t cbList = pCtx->mData.vecData.size();
+        URI_DATA_IS_VALID_BREAK(cbList);
+
+        RTCList<RTCString> lstURIOrg = RTCString(pszList, cbList).split("\r\n");
+        URI_DATA_IS_VALID_BREAK(!lstURIOrg.isEmpty());
+
+        rc = lstURI.AppendURIPathsFromList(lstURIOrg, 0 /* fFlags */);
+        if (RT_SUCCESS(rc))
+            LogFlowFunc(("URI root objects: %zu, total bytes (raw data to transfer): %zu\n",
+                         lstURI.RootCount(), lstURI.TotalBytes()));
+        else
+            break;
+
+        pCtx->mData.cbProcessed = 0;
+        pCtx->mData.cbToProcess = lstURI.TotalBytes();
+
+        /*
+         * The first message always is the meta info for the data. The meta
+         * info *only* contains the root elements of an URI list.
+         *
+         * After the meta data we generate the messages required to send the data itself.
+         */
+        Assert(!lstURI.IsEmpty());
+        RTCString strData = lstURI.RootToString().c_str();
+        size_t    cbData  = strData.length() + 1; /* Include terminating zero. */
+
+        GuestDnDMsg MsgSndData;
+        MsgSndData.setType(DragAndDropSvc::HOST_DND_HG_SND_DATA);
+        MsgSndData.setNextUInt32(pCtx->mScreenID);
+        MsgSndData.setNextPointer((void *)pCtx->mFormat.c_str(), (uint32_t)pCtx->mFormat.length() + 1);
+        MsgSndData.setNextUInt32((uint32_t)pCtx->mFormat.length() + 1);
+        MsgSndData.setNextPointer((void*)strData.c_str(), (uint32_t)cbData);
+        MsgSndData.setNextUInt32((uint32_t)cbData);
+
+        rc = GuestDnDInst()->hostCall(MsgSndData.getType(), MsgSndData.getCount(), MsgSndData.getParms());
+        if (RT_SUCCESS(rc))
+            rc = waitForEvent(msTimeout, pCtx->mCallback, pCtx->mpResp);
+
+    } while (0);
+
+    /*
+     * Unregister callbacks.
+     */
+    /* Guest callbacks. */
+    UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GET_NEXT_HOST_MSG);
+    UNREGISTER_CALLBACK(DragAndDropSvc::GUEST_DND_GH_EVT_ERROR);
+    /* Host callbacks. */
+    UNREGISTER_CALLBACK(DragAndDropSvc::HOST_DND_HG_SND_DIR);
+    if (mDataBase.mProtocolVersion >= 2)
+        UNREGISTER_CALLBACK(DragAndDropSvc::HOST_DND_HG_SND_FILE_HDR);
+    UNREGISTER_CALLBACK(DragAndDropSvc::HOST_DND_HG_SND_FILE_DATA);
+
+#undef REGISTER_CALLBACK
+#undef UNREGISTER_CALLBACK
+
+    /*
+     * Now that we've cleaned up tell the guest side to cancel.
+     */
+    if (rc == VERR_CANCELLED)
+    {
+        int rc2 = sendCancel();
+        AssertRC(rc2);
+    }
+
+    /* Destroy temporary scratch buffer. */
+    if (pvBuf)
+        RTMemFree(pvBuf);
+
+#undef URI_DATA_IS_VALID_BREAK
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDTarget::i_sendURIDataLoop(PSENDDATACTX pCtx, GuestDnDMsg *pMsg)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+
+    DnDURIList &lstURI = pCtx->mURI.lstURI;
+
+    int rc;
+
+    uint64_t cbTotal = pCtx->mData.cbToProcess;
+    uint8_t uPercent = pCtx->mData.cbProcessed * 100 / (cbTotal ? cbTotal : 1);
+
+    LogFlowFunc(("%RU64 / %RU64 -- %RU8%%\n", pCtx->mData.cbProcessed, cbTotal, uPercent));
+
+    bool fComplete = (uPercent >= 100) || lstURI.IsEmpty();
+
+    if (pCtx->mpResp)
+    {
+        int rc2 = pCtx->mpResp->setProgress(uPercent,
+                                              fComplete
+                                            ? DragAndDropSvc::DND_PROGRESS_COMPLETE
+                                            : DragAndDropSvc::DND_PROGRESS_RUNNING);
+        AssertRC(rc2);
+    }
+
+    if (fComplete)
+    {
+        LogFlowFunc(("Last URI item processed, bailing out\n"));
+        return VERR_NO_DATA;
+    }
+
+    Assert(!lstURI.IsEmpty());
+    DnDURIObject &curObj = lstURI.First();
+
+    uint32_t fMode = curObj.GetMode();
+    LogFlowFunc(("Processing srcPath=%s, dstPath=%s, fMode=0x%x, cbSize=%RU32, fIsDir=%RTbool, fIsFile=%RTbool\n",
+                 curObj.GetSourcePath().c_str(), curObj.GetDestPath().c_str(),
+                 fMode, curObj.GetSize(),
+                 RTFS_IS_DIRECTORY(fMode), RTFS_IS_FILE(fMode)));
+
+    if (RTFS_IS_DIRECTORY(fMode))
+    {
+        rc = i_sendDirectory(pCtx, pMsg, curObj);
+    }
+    else if (RTFS_IS_FILE(fMode))
+    {
+        rc = i_sendFile(pCtx, pMsg, curObj);
+    }
+    else
+    {
+        AssertMsgFailed(("fMode=0x%x is not supported for srcPath=%s, dstPath=%s\n",
+                         fMode, curObj.GetSourcePath().c_str(), curObj.GetDestPath().c_str()));
+        rc = VERR_NOT_SUPPORTED;
+    }
+
+    bool fRemove = false; /* Remove current entry? */
+    if (   curObj.IsComplete()
+        || RT_FAILURE(rc))
+    {
+        fRemove = true;
+    }
+
+    if (fRemove)
+    {
+        LogFlowFunc(("Removing \"%s\" from list, rc=%Rrc\n", curObj.GetSourcePath().c_str(), rc));
+        lstURI.RemoveFirst();
+    }
+
+    LogFlowFuncLeaveRC(rc);
+    return rc;
+}
+
+int GuestDnDTarget::i_sendRawData(PSENDDATACTX pCtx, RTMSINTERVAL msTimeout)
+{
+    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
+    NOREF(msTimeout);
+
+    GuestDnD *pInst = GuestDnDInst();
+    AssertPtr(pInst);
+
+    /* At the moment we only allow up to 64K raw data. */
+    size_t cbDataTotal = pCtx->mData.vecData.size();
+    if (   !cbDataTotal
+        || cbDataTotal > _64K)
+    {
+        return VERR_INVALID_PARAMETER;
+    }
+
+    /* Just copy over the raw data. */
+    GuestDnDMsg Msg;
+    Msg.setType(DragAndDropSvc::HOST_DND_HG_SND_DATA);
+    Msg.setNextUInt32(pCtx->mScreenID);
+    Msg.setNextPointer((void *)pCtx->mFormat.c_str(), (uint32_t)pCtx->mFormat.length() + 1);
+    Msg.setNextUInt32((uint32_t)pCtx->mFormat.length() + 1);
+    Msg.setNextPointer((void*)&pCtx->mData.vecData.front(), (uint32_t)cbDataTotal);
+    Msg.setNextUInt32(cbDataTotal);
+
+    LogFlowFunc(("%zu total bytes of raw data to transfer\n", cbDataTotal));
+
+    return pInst->hostCall(Msg.getType(), Msg.getCount(), Msg.getParms());
+}
+
+HRESULT GuestDnDTarget::cancel(BOOL *aVeto)
+{
+#if !defined(VBOX_WITH_DRAG_AND_DROP)
+    ReturnComNotImplemented();
+#else /* VBOX_WITH_DRAG_AND_DROP */
+
+    int rc = i_cancelOperation();
+
+    if (aVeto)
+        *aVeto = FALSE; /** @todo */
+
+    return RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
+
diff --git a/src/VBox/Main/src-client/GuestFileImpl.cpp b/src/VBox/Main/src-client/GuestFileImpl.cpp
index 8a0ce53..1c1fca0 100644
--- a/src/VBox/Main/src-client/GuestFileImpl.cpp
+++ b/src/VBox/Main/src-client/GuestFileImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +19,9 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
+#ifndef VBOX_WITH_GUEST_CONTROL
+# error "VBOX_WITH_GUEST_CONTROL must defined in this file"
+#endif
 #include "GuestFileImpl.h"
 #include "GuestSessionImpl.h"
 #include "GuestCtrlImplPrivate.h"
@@ -145,10 +148,6 @@ int GuestFile::init(Console *pConsole, GuestSession *pSession,
     AutoInitSpan autoInitSpan(this);
     AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
 
-#ifndef VBOX_WITH_GUEST_CONTROL
-    autoInitSpan.setSucceeded();
-    return VINF_SUCCESS;
-#else
     int vrc = bindToSession(pConsole, pSession, uFileID /* Object ID */);
     if (RT_SUCCESS(vrc))
     {
@@ -215,7 +214,6 @@ int GuestFile::init(Console *pConsole, GuestSession *pSession,
 
     LogFlowFuncLeaveRC(vrc);
     return vrc;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
 /**
@@ -231,180 +229,99 @@ void GuestFile::uninit(void)
 
     LogFlowThisFuncEnter();
 
-#ifdef VBOX_WITH_GUEST_CONTROL
     baseUninit();
-#endif
     LogFlowThisFuncLeave();
 }
 
 // implementation of public getters/setters for attributes
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP GuestFile::COMGETTER(CreationMode)(ULONG *aCreationMode)
+HRESULT GuestFile::getCreationMode(ULONG *aCreationMode)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aCreationMode);
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aCreationMode = mData.mOpenInfo.mCreationMode;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::COMGETTER(Disposition)(BSTR *aDisposition)
+HRESULT GuestFile::getOpenAction(FileOpenAction_T *aOpenAction)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aDisposition);
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mOpenInfo.mDisposition.cloneTo(aDisposition);
+    *aOpenAction = mData.mOpenInfo.mOpenAction;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::COMGETTER(EventSource)(IEventSource ** aEventSource)
+HRESULT GuestFile::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* No need to lock - lifetime constant. */
-    mEventSource.queryInterfaceTo(aEventSource);
+    mEventSource.queryInterfaceTo(aEventSource.asOutParam());
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::COMGETTER(FileName)(BSTR *aFileName)
+HRESULT GuestFile::getFileName(com::Utf8Str &aFileName)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aFileName);
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mOpenInfo.mFileName.cloneTo(aFileName);
+    aFileName = mData.mOpenInfo.mFileName;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::COMGETTER(Id)(ULONG *aID)
+HRESULT GuestFile::getId(ULONG *aId)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aID);
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aID = mData.mID;
+    *aId = mData.mID;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::COMGETTER(InitialSize)(LONG64 *aInitialSize)
+HRESULT GuestFile::getInitialSize(LONG64 *aInitialSize)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aInitialSize);
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aInitialSize = mData.mInitialSize;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::COMGETTER(Offset)(LONG64 *aOffset)
+HRESULT GuestFile::getOffset(LONG64 *aOffset)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aOffset);
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aOffset = mData.mOffCurrent;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::COMGETTER(OpenMode)(BSTR *aOpenMode)
+HRESULT GuestFile::getAccessMode(FileAccessMode_T *aAccessMode)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aOpenMode);
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mOpenInfo.mOpenMode.cloneTo(aOpenMode);
+    *aAccessMode = mData.mOpenInfo.mAccessMode;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::COMGETTER(Status)(FileStatus_T *aStatus)
+HRESULT GuestFile::getStatus(FileStatus_T *aStatus)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aStatus = mData.mStatus;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
 // private methods
 /////////////////////////////////////////////////////////////////////////////
 
-int GuestFile::callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int GuestFile::i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCb, VERR_INVALID_POINTER);
@@ -416,11 +333,11 @@ int GuestFile::callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRL
     switch (pCbCtx->uFunction)
     {
         case GUEST_DISCONNECTED:
-            vrc = onGuestDisconnected(pCbCtx, pSvcCb);
+            vrc = i_onGuestDisconnected(pCbCtx, pSvcCb);
             break;
 
         case GUEST_FILE_NOTIFY:
-            vrc = onFileNotify(pCbCtx, pSvcCb);
+            vrc = i_onFileNotify(pCbCtx, pSvcCb);
             break;
 
         default:
@@ -435,7 +352,7 @@ int GuestFile::callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRL
     return vrc;
 }
 
-int GuestFile::closeFile(int *pGuestRc)
+int GuestFile::i_closeFile(int *pGuestRc)
 {
     LogFlowThisFunc(("strFile=%s\n", mData.mOpenInfo.mFileName.c_str()));
 
@@ -465,8 +382,8 @@ int GuestFile::closeFile(int *pGuestRc)
 
     vrc = sendCommand(HOST_FILE_CLOSE, i, paParms);
     if (RT_SUCCESS(vrc))
-        vrc = waitForStatusChange(pEvent, 30 * 1000 /* Timeout in ms */,
-                                  NULL /* FileStatus */, pGuestRc);
+        vrc = i_waitForStatusChange(pEvent, 30 * 1000 /* Timeout in ms */,
+                                    NULL /* FileStatus */, pGuestRc);
     unregisterWaitEvent(pEvent);
 
     LogFlowFuncLeaveRC(vrc);
@@ -474,7 +391,7 @@ int GuestFile::closeFile(int *pGuestRc)
 }
 
 /* static */
-Utf8Str GuestFile::guestErrorToString(int guestRc)
+Utf8Str GuestFile::i_guestErrorToString(int guestRc)
 {
     Utf8Str strError;
 
@@ -505,7 +422,7 @@ Utf8Str GuestFile::guestErrorToString(int guestRc)
     return strError;
 }
 
-int GuestFile::onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
+int GuestFile::i_onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER);
@@ -531,7 +448,7 @@ int GuestFile::onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCA
 
     if (RT_FAILURE(guestRc))
     {
-        int rc2 = setFileStatus(FileStatus_Error, guestRc);
+        int rc2 = i_setFileStatus(FileStatus_Error, guestRc);
         AssertRC(rc2);
 
         rc2 = signalWaitEventInternal(pCbCtx,
@@ -545,7 +462,7 @@ int GuestFile::onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCA
     {
         case GUEST_FILE_NOTIFYTYPE_ERROR:
         {
-            int rc2 = setFileStatus(FileStatus_Error, guestRc);
+            int rc2 = i_setFileStatus(FileStatus_Error, guestRc);
             AssertRC(rc2);
 
             break;
@@ -557,19 +474,12 @@ int GuestFile::onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCA
             {
                 pSvcCbData->mpaParms[idx++].getUInt32(&dataCb.u.open.uHandle);
 
-                {
-                    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-                    AssertMsg(mData.mID == VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID),
-                              ("File ID %RU32 does not match context ID %RU32\n", mData.mID,
-                              VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID)));
-
-                    /* Set the initial offset. On the guest the whole opening operation
-                     * would fail if an initial seek isn't possible. */
-                    mData.mOffCurrent = mData.mOpenInfo.mInitialOffset;
-                }
+                AssertMsg(mData.mID == VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID),
+                          ("File ID %RU32 does not match context ID %RU32\n", mData.mID,
+                           VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID)));
 
                 /* Set the process status. */
-                int rc2 = setFileStatus(FileStatus_Open, guestRc);
+                int rc2 = i_setFileStatus(FileStatus_Open, guestRc);
                 AssertRC(rc2);
             }
             else
@@ -580,7 +490,7 @@ int GuestFile::onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCA
 
         case GUEST_FILE_NOTIFYTYPE_CLOSE:
         {
-            int rc2 = setFileStatus(FileStatus_Closed, guestRc);
+            int rc2 = i_setFileStatus(FileStatus_Closed, guestRc);
             AssertRC(rc2);
 
             break;
@@ -691,12 +601,12 @@ int GuestFile::onFileNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCA
     return vrc;
 }
 
-int GuestFile::onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
+int GuestFile::i_onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER);
 
-    int vrc = setFileStatus(FileStatus_Down, VINF_SUCCESS);
+    int vrc = i_setFileStatus(FileStatus_Down, VINF_SUCCESS);
 
     LogFlowFuncLeaveRC(vrc);
     return vrc;
@@ -706,7 +616,7 @@ int GuestFile::onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTR
  * Called by IGuestSession right before this file gets removed
  * from the public file list.
  */
-int GuestFile::onRemove(void)
+int GuestFile::i_onRemove(void)
 {
     LogFlowThisFuncEnter();
 
@@ -730,15 +640,16 @@ int GuestFile::onRemove(void)
     return vrc;
 }
 
-int GuestFile::openFile(uint32_t uTimeoutMS, int *pGuestRc)
+int GuestFile::i_openFile(uint32_t uTimeoutMS, int *pGuestRc)
 {
     LogFlowThisFuncEnter();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    LogFlowThisFunc(("strFile=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%RU32, uOffset=%RU64\n",
-                     mData.mOpenInfo.mFileName.c_str(), mData.mOpenInfo.mOpenMode.c_str(),
-                     mData.mOpenInfo.mDisposition.c_str(), mData.mOpenInfo.mCreationMode, mData.mOpenInfo.mInitialOffset));
+    LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32, mfOpenEx=%RU32\n",
+                     mData.mOpenInfo.mFileName.c_str(), mData.mOpenInfo.mAccessMode, mData.mOpenInfo.mpszAccessMode,
+                     mData.mOpenInfo.mOpenAction, mData.mOpenInfo.mpszOpenAction, mData.mOpenInfo.mCreationMode,
+                     mData.mOpenInfo.mfOpenEx));
     int vrc;
 
     GuestWaitEvent *pEvent = NULL;
@@ -763,21 +674,19 @@ int GuestFile::openFile(uint32_t uTimeoutMS, int *pGuestRc)
     paParms[i++].setUInt32(pEvent->ContextID());
     paParms[i++].setPointer((void*)mData.mOpenInfo.mFileName.c_str(),
                             (ULONG)mData.mOpenInfo.mFileName.length() + 1);
-    paParms[i++].setPointer((void*)mData.mOpenInfo.mOpenMode.c_str(),
-                            (ULONG)mData.mOpenInfo.mOpenMode.length() + 1);
-    paParms[i++].setPointer((void*)mData.mOpenInfo.mDisposition.c_str(),
-                            (ULONG)mData.mOpenInfo.mDisposition.length() + 1);
-    paParms[i++].setPointer((void*)mData.mOpenInfo.mSharingMode.c_str(),
-                            (ULONG)mData.mOpenInfo.mSharingMode.length() + 1);
+    paParms[i++].setString(mData.mOpenInfo.mpszAccessMode);
+    paParms[i++].setString(mData.mOpenInfo.mpszOpenAction);
+    paParms[i++].setString(""); /** @todo sharing mode. */
     paParms[i++].setUInt32(mData.mOpenInfo.mCreationMode);
-    paParms[i++].setUInt64(mData.mOpenInfo.mInitialOffset);
+    paParms[i++].setUInt64(0 /* initial offset */);
+    /** @todo Next protocol version: add flags, replace strings, remove initial offset. */
 
     alock.release(); /* Drop write lock before sending. */
 
     vrc = sendCommand(HOST_FILE_OPEN, i, paParms);
     if (RT_SUCCESS(vrc))
-        vrc = waitForStatusChange(pEvent, uTimeoutMS,
-                                  NULL /* FileStatus */, pGuestRc);
+        vrc = i_waitForStatusChange(pEvent, uTimeoutMS,
+                                    NULL /* FileStatus */, pGuestRc);
 
     unregisterWaitEvent(pEvent);
 
@@ -785,8 +694,8 @@ int GuestFile::openFile(uint32_t uTimeoutMS, int *pGuestRc)
     return vrc;
 }
 
-int GuestFile::readData(uint32_t uSize, uint32_t uTimeoutMS,
-                        void* pvData, uint32_t cbData, uint32_t* pcbRead)
+int GuestFile::i_readData(uint32_t uSize, uint32_t uTimeoutMS,
+                          void* pvData, uint32_t cbData, uint32_t* pcbRead)
 {
     AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     AssertReturn(cbData, VERR_INVALID_PARAMETER);
@@ -827,7 +736,7 @@ int GuestFile::readData(uint32_t uSize, uint32_t uTimeoutMS,
     uint32_t cbRead;
     vrc = sendCommand(HOST_FILE_READ, i, paParms);
     if (RT_SUCCESS(vrc))
-        vrc = waitForRead(pEvent, uTimeoutMS, pvData, cbData, &cbRead);
+        vrc = i_waitForRead(pEvent, uTimeoutMS, pvData, cbData, &cbRead);
 
     if (RT_SUCCESS(vrc))
     {
@@ -843,8 +752,8 @@ int GuestFile::readData(uint32_t uSize, uint32_t uTimeoutMS,
     return vrc;
 }
 
-int GuestFile::readDataAt(uint64_t uOffset, uint32_t uSize, uint32_t uTimeoutMS,
-                          void* pvData, size_t cbData, size_t* pcbRead)
+int GuestFile::i_readDataAt(uint64_t uOffset, uint32_t uSize, uint32_t uTimeoutMS,
+                            void* pvData, size_t cbData, size_t* pcbRead)
 {
     LogFlowThisFunc(("uOffset=%RU64, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%zu\n",
                      uOffset, uSize, uTimeoutMS, pvData, cbData));
@@ -883,7 +792,7 @@ int GuestFile::readDataAt(uint64_t uOffset, uint32_t uSize, uint32_t uTimeoutMS,
     uint32_t cbRead;
     vrc = sendCommand(HOST_FILE_READ_AT, i, paParms);
     if (RT_SUCCESS(vrc))
-        vrc = waitForRead(pEvent, uTimeoutMS, pvData, cbData, &cbRead);
+        vrc = i_waitForRead(pEvent, uTimeoutMS, pvData, cbData, &cbRead);
 
     if (RT_SUCCESS(vrc))
     {
@@ -899,8 +808,8 @@ int GuestFile::readDataAt(uint64_t uOffset, uint32_t uSize, uint32_t uTimeoutMS,
     return vrc;
 }
 
-int GuestFile::seekAt(int64_t iOffset, GUEST_FILE_SEEKTYPE eSeekType,
-                      uint32_t uTimeoutMS, uint64_t *puOffset)
+int GuestFile::i_seekAt(int64_t iOffset, GUEST_FILE_SEEKTYPE eSeekType,
+                        uint32_t uTimeoutMS, uint64_t *puOffset)
 {
     LogFlowThisFunc(("iOffset=%RI64, uTimeoutMS=%RU32\n",
                      iOffset, uTimeoutMS));
@@ -939,7 +848,7 @@ int GuestFile::seekAt(int64_t iOffset, GUEST_FILE_SEEKTYPE eSeekType,
 
     vrc = sendCommand(HOST_FILE_SEEK, i, paParms);
     if (RT_SUCCESS(vrc))
-        vrc = waitForOffsetChange(pEvent, uTimeoutMS, puOffset);
+        vrc = i_waitForOffsetChange(pEvent, uTimeoutMS, puOffset);
 
     unregisterWaitEvent(pEvent);
 
@@ -948,15 +857,15 @@ int GuestFile::seekAt(int64_t iOffset, GUEST_FILE_SEEKTYPE eSeekType,
 }
 
 /* static */
-HRESULT GuestFile::setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
+HRESULT GuestFile::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
 {
     AssertPtr(pInterface);
     AssertMsg(RT_FAILURE(guestRc), ("Guest rc does not indicate a failure when setting error\n"));
 
-    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestFile::guestErrorToString(guestRc).c_str());
+    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestFile::i_guestErrorToString(guestRc).c_str());
 }
 
-int GuestFile::setFileStatus(FileStatus_T fileStatus, int fileRc)
+int GuestFile::i_setFileStatus(FileStatus_T fileStatus, int fileRc)
 {
     LogFlowThisFuncEnter();
 
@@ -986,7 +895,7 @@ int GuestFile::setFileStatus(FileStatus_T fileStatus, int fileRc)
         {
             hr = errorInfo->initEx(VBOX_E_IPRT_ERROR, fileRc,
                                    COM_IIDOF(IGuestFile), getComponentName(),
-                                   guestErrorToString(fileRc));
+                                   i_guestErrorToString(fileRc));
             ComAssertComRC(hr);
         }
 
@@ -999,8 +908,8 @@ int GuestFile::setFileStatus(FileStatus_T fileStatus, int fileRc)
     return VINF_SUCCESS;
 }
 
-int GuestFile::waitForOffsetChange(GuestWaitEvent *pEvent,
-                                   uint32_t uTimeoutMS, uint64_t *puOffset)
+int GuestFile::i_waitForOffsetChange(GuestWaitEvent *pEvent,
+                                     uint32_t uTimeoutMS, uint64_t *puOffset)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
 
@@ -1028,9 +937,8 @@ int GuestFile::waitForOffsetChange(GuestWaitEvent *pEvent,
     return vrc;
 }
 
-int GuestFile::waitForRead(GuestWaitEvent *pEvent,
-                           uint32_t uTimeoutMS,
-                           void *pvData, size_t cbData, uint32_t *pcbRead)
+int GuestFile::i_waitForRead(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
+                             void *pvData, size_t cbData, uint32_t *pcbRead)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
 
@@ -1073,8 +981,8 @@ int GuestFile::waitForRead(GuestWaitEvent *pEvent,
     return vrc;
 }
 
-int GuestFile::waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
-                                   FileStatus_T *pFileStatus, int *pGuestRc)
+int GuestFile::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
+                                     FileStatus_T *pFileStatus, int *pGuestRc)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
     /* pFileStatus is optional. */
@@ -1117,8 +1025,8 @@ int GuestFile::waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
     return vrc;
 }
 
-int GuestFile::waitForWrite(GuestWaitEvent *pEvent,
-                            uint32_t uTimeoutMS, uint32_t *pcbWritten)
+int GuestFile::i_waitForWrite(GuestWaitEvent *pEvent,
+                              uint32_t uTimeoutMS, uint32_t *pcbWritten)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
 
@@ -1146,8 +1054,8 @@ int GuestFile::waitForWrite(GuestWaitEvent *pEvent,
     return vrc;
 }
 
-int GuestFile::writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData,
-                         uint32_t *pcbWritten)
+int GuestFile::i_writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData,
+                           uint32_t *pcbWritten)
 {
     AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     AssertReturn(cbData, VERR_INVALID_PARAMETER);
@@ -1189,7 +1097,7 @@ int GuestFile::writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData,
     uint32_t cbWritten;
     vrc = sendCommand(HOST_FILE_WRITE, i, paParms);
     if (RT_SUCCESS(vrc))
-        vrc = waitForWrite(pEvent, uTimeoutMS, &cbWritten);
+        vrc = i_waitForWrite(pEvent, uTimeoutMS, &cbWritten);
 
     if (RT_SUCCESS(vrc))
     {
@@ -1205,8 +1113,8 @@ int GuestFile::writeData(uint32_t uTimeoutMS, void *pvData, uint32_t cbData,
     return vrc;
 }
 
-int GuestFile::writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS,
-                           void *pvData, uint32_t cbData, uint32_t *pcbWritten)
+int GuestFile::i_writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS,
+                             void *pvData, uint32_t cbData, uint32_t *pcbWritten)
 {
     AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     AssertReturn(cbData, VERR_INVALID_PARAMETER);
@@ -1249,7 +1157,7 @@ int GuestFile::writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS,
     uint32_t cbWritten;
     vrc = sendCommand(HOST_FILE_WRITE_AT, i, paParms);
     if (RT_SUCCESS(vrc))
-        vrc = waitForWrite(pEvent, uTimeoutMS, &cbWritten);
+        vrc = i_waitForWrite(pEvent, uTimeoutMS, &cbWritten);
 
     if (RT_SUCCESS(vrc))
     {
@@ -1265,34 +1173,27 @@ int GuestFile::writeDataAt(uint64_t uOffset, uint32_t uTimeoutMS,
     return vrc;
 }
 
-// implementation of public methods
+// Wrapped IGuestFile methods
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP GuestFile::Close(void)
+HRESULT GuestFile::close()
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* Close file on guest. */
     int guestRc;
-    int rc = closeFile(&guestRc);
+    int rc = i_closeFile(&guestRc);
     /* On failure don't return here, instead do all the cleanup
      * work first and then return an error. */
 
     AssertPtr(mSession);
-    int rc2 = mSession->fileRemoveFromList(this);
+    int rc2 = mSession->i_fileRemoveFromList(this);
     if (RT_SUCCESS(rc))
         rc = rc2;
 
     if (RT_FAILURE(rc))
     {
         if (rc == VERR_GSTCTL_GUEST_ERROR)
-            return GuestFile::setErrorExternal(this, guestRc);
+            return GuestFile::i_setErrorExternal(this, guestRc);
 
         return setError(VBOX_E_IPRT_ERROR,
                         tr("Closing guest file failed with %Rrc\n"), rc);
@@ -1300,49 +1201,40 @@ STDMETHODIMP GuestFile::Close(void)
 
     LogFlowThisFunc(("Returning rc=%Rrc\n", rc));
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::QueryInfo(IFsObjInfo **aInfo)
+HRESULT GuestFile::queryInfo(ComPtr<IFsObjInfo> &aObjInfo)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+}
 
+HRESULT GuestFile::querySize(LONG64 *aSize)
+{
     ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::Read(ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData))
+HRESULT GuestFile::read(ULONG aToRead, ULONG aTimeoutMS, std::vector<BYTE> &aData)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     if (aToRead == 0)
         return setError(E_INVALIDARG, tr("The size to read is zero"));
-    CheckComArgOutSafeArrayPointerValid(aData);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    com::SafeArray<BYTE> data((size_t)aToRead);
-    Assert(data.size() >= aToRead);
+    aData.resize(aToRead);
 
     HRESULT hr = S_OK;
 
     uint32_t cbRead;
-    int vrc = readData(aToRead, aTimeoutMS,
-                       data.raw(), aToRead, &cbRead);
+    int vrc = i_readData(aToRead, aTimeoutMS,
+                         &aData.front(), aToRead, &cbRead);
+
     if (RT_SUCCESS(vrc))
     {
-        if (data.size() != cbRead)
-            data.resize(cbRead);
-        data.detachTo(ComSafeArrayOutArg(aData));
+        if (aData.size() != cbRead)
+            aData.resize(cbRead);
     }
     else
     {
+        aData.resize(0);
+
         switch (vrc)
         {
             default:
@@ -1355,37 +1247,29 @@ STDMETHODIMP GuestFile::Read(ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BY
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
+HRESULT GuestFile::readAt(LONG64 aOffset, ULONG aToRead, ULONG aTimeoutMS, std::vector<BYTE> &aData)
 
-STDMETHODIMP GuestFile::ReadAt(LONG64 aOffset, ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData))
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     if (aToRead == 0)
         return setError(E_INVALIDARG, tr("The size to read is zero"));
-    CheckComArgOutSafeArrayPointerValid(aData);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    com::SafeArray<BYTE> data((size_t)aToRead);
-    Assert(data.size() >= aToRead);
+    aData.resize(aToRead);
 
     HRESULT hr = S_OK;
 
     size_t cbRead;
-    int vrc = readDataAt(aOffset, aToRead, aTimeoutMS,
-                         data.raw(), aToRead, &cbRead);
+    int vrc = i_readDataAt(aOffset, aToRead, aTimeoutMS,
+                           &aData.front(), aToRead, &cbRead);
     if (RT_SUCCESS(vrc))
     {
-        if (data.size() != cbRead)
-            data.resize(cbRead);
-        data.detachTo(ComSafeArrayOutArg(aData));
+        if (aData.size() != cbRead)
+            aData.resize(cbRead);
     }
     else
     {
+        aData.resize(0);
+
         switch (vrc)
         {
             default:
@@ -1398,40 +1282,40 @@ STDMETHODIMP GuestFile::ReadAt(LONG64 aOffset, ULONG aToRead, ULONG aTimeoutMS,
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::Seek(LONG64 aOffset, FileSeekType_T aType)
+HRESULT GuestFile::seek(LONG64 aOffset, FileSeekOrigin_T aWhence, LONG64 *aNewOffset)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT hr = S_OK;
 
     GUEST_FILE_SEEKTYPE eSeekType;
-    switch (aType)
+    switch (aWhence)
     {
-        case FileSeekType_Set:
+        case FileSeekOrigin_Begin:
             eSeekType = GUEST_FILE_SEEKTYPE_BEGIN;
             break;
 
-        case FileSeekType_Current:
+        case FileSeekOrigin_Current:
             eSeekType = GUEST_FILE_SEEKTYPE_CURRENT;
             break;
 
+        case FileSeekOrigin_End:
+            eSeekType = GUEST_FILE_SEEKTYPE_END;
+            break;
+
         default:
             return setError(E_INVALIDARG, tr("Invalid seek type specified"));
             break; /* Never reached. */
     }
 
-    int vrc = seekAt(aOffset, eSeekType,
-                     30 * 1000 /* 30s timeout */, NULL /* puOffset */);
-    if (RT_FAILURE(vrc))
+    uint64_t uNewOffset;
+    int vrc = i_seekAt(aOffset, eSeekType,
+                       30 * 1000 /* 30s timeout */, &uNewOffset);
+    if (RT_SUCCESS(vrc))
+        *aNewOffset = RT_MIN(uNewOffset, (uint64_t)INT64_MAX);
+    else
     {
         switch (vrc)
         {
@@ -1445,39 +1329,28 @@ STDMETHODIMP GuestFile::Seek(LONG64 aOffset, FileSeekType_T aType)
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::SetACL(IN_BSTR aACL)
+HRESULT GuestFile::setACL(const com::Utf8Str &aAcl, ULONG aMode)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+}
 
+HRESULT GuestFile::setSize(LONG64 aSize)
+{
     ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::Write(ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten)
+HRESULT GuestFile::write(const std::vector<BYTE> &aData, ULONG aTimeoutMS, ULONG *aWritten)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgSafeArrayNotNull(aData);
-    CheckComArgOutPointerValid(aWritten);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT hr = S_OK;
 
-    com::SafeArray<BYTE> data(ComSafeArrayInArg(aData));
-    int vrc = writeData(aTimeoutMS, data.raw(), (uint32_t)data.size(),
-                        (uint32_t*)aWritten);
+    uint32_t cbData = (uint32_t)aData.size();
+    void *pvData = cbData > 0? (void *)&aData.front(): NULL;
+    int vrc = i_writeData(aTimeoutMS, pvData, cbData,
+                          (uint32_t*)aWritten);
     if (RT_FAILURE(vrc))
     {
         switch (vrc)
@@ -1485,34 +1358,26 @@ STDMETHODIMP GuestFile::Write(ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULO
             default:
                 hr = setError(VBOX_E_IPRT_ERROR,
                               tr("Writing %zubytes to file \"%s\" failed: %Rrc"),
-                              data.size(), mData.mOpenInfo.mFileName.c_str(), vrc);
+                              aData.size(), mData.mOpenInfo.mFileName.c_str(), vrc);
                 break;
         }
     }
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFile::WriteAt(LONG64 aOffset, ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten)
+HRESULT GuestFile::writeAt(LONG64 aOffset, const std::vector<BYTE> &aData, ULONG aTimeoutMS, ULONG *aWritten)
+
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgSafeArrayNotNull(aData);
-    CheckComArgOutPointerValid(aWritten);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT hr = S_OK;
 
-    com::SafeArray<BYTE> data(ComSafeArrayInArg(aData));
-    int vrc = writeData(aTimeoutMS, data.raw(), (uint32_t)data.size(),
-                         (uint32_t*)aWritten);
+    uint32_t cbData = (uint32_t)aData.size();
+    void *pvData = cbData > 0? (void *)&aData.front(): NULL;
+    int vrc = i_writeData(aTimeoutMS, pvData, cbData,
+                          (uint32_t*)aWritten);
     if (RT_FAILURE(vrc))
     {
         switch (vrc)
@@ -1520,13 +1385,12 @@ STDMETHODIMP GuestFile::WriteAt(LONG64 aOffset, ComSafeArrayIn(BYTE, aData), ULO
             default:
                 hr = setError(VBOX_E_IPRT_ERROR,
                               tr("Writing %zubytes to file \"%s\" (at offset %RU64) failed: %Rrc"),
-                              data.size(), mData.mOpenInfo.mFileName.c_str(), aOffset, vrc);
+                              aData.size(), mData.mOpenInfo.mFileName.c_str(), aOffset, vrc);
                 break;
         }
     }
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
diff --git a/src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp b/src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp
index 64547ed..8112cab 100644
--- a/src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp
+++ b/src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,6 +19,9 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
+#ifndef VBOX_WITH_GUEST_CONTROL
+# error "VBOX_WITH_GUEST_CONTROL must defined in this file"
+#endif
 #include "GuestFsObjInfoImpl.h"
 #include "GuestCtrlImplPrivate.h"
 
@@ -62,7 +65,7 @@ int GuestFsObjInfo::init(const GuestFsObjData &objData)
 
     /* Enclose the state transition NotReady->InInit->Ready. */
     AutoInitSpan autoInitSpan(this);
-    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL); /** @todo r=bird: returning COM or IPRT status codes here?*/
 
     mData = objData;
 
@@ -86,326 +89,141 @@ void GuestFsObjInfo::uninit(void)
         return;
 }
 
-// implementation of public getters/setters for attributes
+// implementation of wrapped private getters/setters for attributes
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(AccessTime)(LONG64 *aAccessTime)
+HRESULT GuestFsObjInfo::getAccessTime(LONG64 *aAccessTime)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aAccessTime);
-
     *aAccessTime = mData.mAccessTime;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(AllocatedSize)(LONG64 *aAllocatedSize)
+HRESULT GuestFsObjInfo::getAllocatedSize(LONG64 *aAllocatedSize)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aAllocatedSize);
-
     *aAllocatedSize = mData.mAllocatedSize;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(BirthTime)(LONG64 *aBirthTime)
+HRESULT GuestFsObjInfo::getBirthTime(LONG64 *aBirthTime)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aBirthTime);
-
     *aBirthTime = mData.mBirthTime;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(ChangeTime)(LONG64 *aChangeTime)
+HRESULT GuestFsObjInfo::getChangeTime(LONG64 *aChangeTime)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aChangeTime);
-
     *aChangeTime = mData.mChangeTime;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(DeviceNumber)(ULONG *aDeviceNumber)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    CheckComArgOutPointerValid(aDeviceNumber);
 
+HRESULT GuestFsObjInfo::getDeviceNumber(ULONG *aDeviceNumber)
+{
     *aDeviceNumber = mData.mDeviceNumber;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(FileAttributes)(BSTR *aAttributes)
+HRESULT GuestFsObjInfo::getFileAttributes(com::Utf8Str &aFileAttributes)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aAttributes);
-
-    mData.mFileAttrs.cloneTo(aAttributes);
+    aFileAttributes = mData.mFileAttrs;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(GenerationId)(ULONG *aGenerationId)
+HRESULT GuestFsObjInfo::getGenerationId(ULONG *aGenerationId)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aGenerationId);
-
     *aGenerationId = mData.mGenerationID;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(GID)(ULONG *aGID)
+HRESULT GuestFsObjInfo::getGID(ULONG *aGID)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aGID);
-
     *aGID = mData.mGID;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(GroupName)(BSTR *aGroupName)
+HRESULT GuestFsObjInfo::getGroupName(com::Utf8Str &aGroupName)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aGroupName);
-
-    mData.mGroupName.cloneTo(aGroupName);
+    aGroupName = mData.mGroupName;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(HardLinks)(ULONG *aHardLinks)
+HRESULT GuestFsObjInfo::getHardLinks(ULONG *aHardLinks)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aHardLinks);
-
     *aHardLinks = mData.mNumHardLinks;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(ModificationTime)(LONG64 *aModificationTime)
+HRESULT GuestFsObjInfo::getModificationTime(LONG64 *aModificationTime)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aModificationTime);
-
     *aModificationTime = mData.mModificationTime;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(Name)(BSTR *aName)
+HRESULT GuestFsObjInfo::getName(com::Utf8Str &aName)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aName);
-
-    mData.mName.cloneTo(aName);
+    aName = mData.mName;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(NodeId)(LONG64 *aNodeId)
+HRESULT GuestFsObjInfo::getNodeId(LONG64 *aNodeId)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aNodeId);
-
     *aNodeId = mData.mNodeID;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(NodeIdDevice)(ULONG *aNodeIdDevice)
+HRESULT GuestFsObjInfo::getNodeIdDevice(ULONG *aNodeIdDevice)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aNodeIdDevice);
-
     *aNodeIdDevice = mData.mNodeIDDevice;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(ObjectSize)(LONG64 *aObjectSize)
+HRESULT GuestFsObjInfo::getObjectSize(LONG64 *aObjectSize)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aObjectSize);
-
     *aObjectSize = mData.mObjectSize;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(Type)(FsObjType_T *aType)
+HRESULT GuestFsObjInfo::getType(FsObjType_T *aType)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aType);
-
     *aType = mData.mType;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(UID)(ULONG *aUID)
+HRESULT GuestFsObjInfo::getUID(ULONG *aUID)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aUID);
-
     *aUID = mData.mUID;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(UserFlags)(ULONG *aUserFlags)
+HRESULT GuestFsObjInfo::getUserFlags(ULONG *aUserFlags)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aUserFlags);
-
     *aUserFlags = mData.mUserFlags;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
-}
-
-STDMETHODIMP GuestFsObjInfo::COMGETTER(UserName)(BSTR *aUserName)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aUserName);
-
-    mData.mUserName.cloneTo(aUserName);
-
-    return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestFsObjInfo::COMGETTER(ACL)(BSTR *aACL)
+HRESULT GuestFsObjInfo::getUserName(com::Utf8Str &aUserName)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    CheckComArgOutPointerValid(aACL);
-
-    mData.mACL.cloneTo(aACL);
+    aUserName = mData.mUserName;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
diff --git a/src/VBox/Main/src-client/GuestImpl.cpp b/src/VBox/Main/src-client/GuestImpl.cpp
index fcc9b26..4f26b2a 100644
--- a/src/VBox/Main/src-client/GuestImpl.cpp
+++ b/src/VBox/Main/src-client/GuestImpl.cpp
@@ -1,10 +1,10 @@
 /* $Id: GuestImpl.cpp $ */
 /** @file
- * VirtualBox COM class implementation: Guest
+ * VirtualBox COM class implementation: Guest features.
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,13 +16,14 @@
  */
 
 #include "GuestImpl.h"
-#include "GuestSessionImpl.h"
-
+#ifdef VBOX_WITH_GUEST_CONTROL
+# include "GuestSessionImpl.h"
+#endif
 #include "Global.h"
 #include "ConsoleImpl.h"
 #include "ProgressImpl.h"
 #ifdef VBOX_WITH_DRAG_AND_DROP
-# include "GuestDnDImpl.h"
+# include "GuestDnDPrivate.h"
 #endif
 #include "VMMDev.h"
 
@@ -80,14 +81,14 @@ HRESULT Guest::init(Console *aParent)
     autoInitSpan.setSucceeded();
 
     ULONG aMemoryBalloonSize;
-    HRESULT hr = mParent->machine()->COMGETTER(MemoryBalloonSize)(&aMemoryBalloonSize);
+    HRESULT hr = mParent->i_machine()->COMGETTER(MemoryBalloonSize)(&aMemoryBalloonSize);
     if (hr == S_OK) /** @todo r=andy SUCCEEDED? */
         mMemoryBalloonSize = aMemoryBalloonSize;
     else
         mMemoryBalloonSize = 0; /* Default is no ballooning */
 
     BOOL fPageFusionEnabled;
-    hr = mParent->machine()->COMGETTER(PageFusionEnabled)(&fPageFusionEnabled);
+    hr = mParent->i_machine()->COMGETTER(PageFusionEnabled)(&fPageFusionEnabled);
     if (hr == S_OK) /** @todo r=andy SUCCEEDED? */
         mfPageFusionEnabled = fPageFusionEnabled;
     else
@@ -105,29 +106,36 @@ HRESULT Guest::init(Console *aParent)
 
     mMagic = GUEST_MAGIC;
     int vrc = RTTimerLRCreate(&mStatTimer, 1000 /* ms */,
-                              &Guest::staticUpdateStats, this);
+                              &Guest::i_staticUpdateStats, this);
     AssertMsgRC(vrc, ("Failed to create guest statistics update timer (%Rrc)\n", vrc));
 
-#ifdef VBOX_WITH_GUEST_CONTROL
     hr = unconst(mEventSource).createObject();
     if (SUCCEEDED(hr))
         hr = mEventSource->init();
-#else
-    hr = S_OK;
-#endif
 
+#ifdef VBOX_WITH_DRAG_AND_DROP
     try
     {
-#ifdef VBOX_WITH_DRAG_AND_DROP
-        m_pGuestDnD = new GuestDnD(this);
-        AssertPtr(m_pGuestDnD);
-#endif
+        GuestDnD::createInstance(this /* pGuest */);
+        hr = unconst(mDnDSource).createObject();
+        if (SUCCEEDED(hr))
+            hr = mDnDSource->init(this /* pGuest */);
+        if (SUCCEEDED(hr))
+        {
+            hr = unconst(mDnDTarget).createObject();
+            if (SUCCEEDED(hr))
+                hr = mDnDTarget->init(this /* pGuest */);
+        }
+
+        LogFlowFunc(("Drag and drop initializied with hr=%Rhrc\n", hr));
     }
-    catch(std::bad_alloc &)
+    catch (std::bad_alloc &)
     {
         hr = E_OUTOFMEMORY;
     }
+#endif
 
+    LogFlowFunc(("hr=%Rhrc\n", hr));
     return hr;
 }
 
@@ -156,11 +164,11 @@ void Guest::uninit()
     GuestSessions::iterator itSessions = mData.mGuestSessions.begin();
     while (itSessions != mData.mGuestSessions.end())
     {
-#ifdef DEBUG
+# ifdef DEBUG
         ULONG cRefs = itSessions->second->AddRef();
         LogFlowThisFunc(("sessionID=%RU32, cRefs=%RU32\n", itSessions->first, cRefs > 1 ? cRefs - 1 : 0));
         itSessions->second->Release();
-#endif
+# endif
         itSessions->second->uninit();
         itSessions++;
     }
@@ -168,36 +176,32 @@ void Guest::uninit()
 #endif
 
 #ifdef VBOX_WITH_DRAG_AND_DROP
-    if (m_pGuestDnD)
-    {
-        delete m_pGuestDnD;
-        m_pGuestDnD = NULL;
-    }
+    GuestDnD::destroyInstance();
+    unconst(mDnDSource).setNull();
+    unconst(mDnDTarget).setNull();
 #endif
 
-#ifdef VBOX_WITH_GUEST_CONTROL
     unconst(mEventSource).setNull();
-#endif
     unconst(mParent) = NULL;
 
     LogFlowFuncLeave();
 }
 
 /* static */
-DECLCALLBACK(void) Guest::staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick)
+DECLCALLBACK(void) Guest::i_staticUpdateStats(RTTIMERLR hTimerLR, void *pvUser, uint64_t iTick)
 {
     AssertReturnVoid(pvUser != NULL);
     Guest *guest = static_cast<Guest *>(pvUser);
     Assert(guest->mMagic == GUEST_MAGIC);
     if (guest->mMagic == GUEST_MAGIC)
-        guest->updateStats(iTick);
+        guest->i_updateStats(iTick);
 
     NOREF(hTimerLR);
 }
 
 /* static */
-int Guest::staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,
-                                   STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser)
+int Guest::i_staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *pvSample, STAMUNIT enmUnit,
+                                     STAMVISIBILITY enmVisiblity, const char *pszDesc, void *pvUser)
 {
     AssertLogRelMsgReturn(enmType == STAMTYPE_COUNTER, ("Unexpected sample type %d ('%s')\n", enmType, pszName), VINF_SUCCESS);
     AssertLogRelMsgReturn(enmUnit == STAMUNIT_BYTES, ("Unexpected sample unit %d ('%s')\n", enmUnit, pszName), VINF_SUCCESS);
@@ -245,7 +249,7 @@ int Guest::staticEnumStatsCallback(const char *pszName, STAMTYPE enmType, void *
     return VINF_SUCCESS;
 }
 
-void Guest::updateStats(uint64_t iTick)
+void Guest::i_updateStats(uint64_t iTick)
 {
     uint64_t cbFreeTotal      = 0;
     uint64_t cbAllocTotal     = 0;
@@ -303,7 +307,7 @@ void Guest::updateStats(uint64_t iTick)
         uint64_t uRxPrev = mNetStatRx;
         uint64_t uTxPrev = mNetStatTx;
         mNetStatRx = mNetStatTx = 0;
-        rc = STAMR3Enum(ptrVM.rawUVM(), "/Public/Net/*/Bytes*", staticEnumStatsCallback, this);
+        rc = STAMR3Enum(ptrVM.rawUVM(), "/Public/Net/*/Bytes*", i_staticEnumStatsCallback, this);
         AssertRC(rc);
 
         uint64_t uTsNow = RTTimeNanoTS();
@@ -327,240 +331,232 @@ void Guest::updateStats(uint64_t iTick)
         }
     }
 
-    mParent->reportVmStatistics(validStats,
-                                aGuestStats[GUESTSTATTYPE_CPUUSER],
-                                aGuestStats[GUESTSTATTYPE_CPUKERNEL],
-                                aGuestStats[GUESTSTATTYPE_CPUIDLE],
-                                /* Convert the units for RAM usage stats: page (4K) -> 1KB units */
-                                mCurrentGuestStat[GUESTSTATTYPE_MEMTOTAL] * (_4K/_1K),
-                                mCurrentGuestStat[GUESTSTATTYPE_MEMFREE] * (_4K/_1K),
-                                mCurrentGuestStat[GUESTSTATTYPE_MEMBALLOON] * (_4K/_1K),
-                                (ULONG)(cbSharedMem / _1K), /* bytes -> KB */
-                                mCurrentGuestStat[GUESTSTATTYPE_MEMCACHE] * (_4K/_1K),
-                                mCurrentGuestStat[GUESTSTATTYPE_PAGETOTAL] * (_4K/_1K),
-                                (ULONG)(cbAllocTotal / _1K), /* bytes -> KB */
-                                (ULONG)(cbFreeTotal / _1K),
-                                (ULONG)(cbBalloonedTotal / _1K),
-                                (ULONG)(cbSharedTotal / _1K),
-                                uNetStatRx,
-                                uNetStatTx);
+    mParent->i_reportVmStatistics(validStats,
+                                  aGuestStats[GUESTSTATTYPE_CPUUSER],
+                                  aGuestStats[GUESTSTATTYPE_CPUKERNEL],
+                                  aGuestStats[GUESTSTATTYPE_CPUIDLE],
+                                  /* Convert the units for RAM usage stats: page (4K) -> 1KB units */
+                                  mCurrentGuestStat[GUESTSTATTYPE_MEMTOTAL] * (_4K/_1K),
+                                  mCurrentGuestStat[GUESTSTATTYPE_MEMFREE] * (_4K/_1K),
+                                  mCurrentGuestStat[GUESTSTATTYPE_MEMBALLOON] * (_4K/_1K),
+                                  (ULONG)(cbSharedMem / _1K), /* bytes -> KB */
+                                  mCurrentGuestStat[GUESTSTATTYPE_MEMCACHE] * (_4K/_1K),
+                                  mCurrentGuestStat[GUESTSTATTYPE_PAGETOTAL] * (_4K/_1K),
+                                  (ULONG)(cbAllocTotal / _1K), /* bytes -> KB */
+                                  (ULONG)(cbFreeTotal / _1K),
+                                  (ULONG)(cbBalloonedTotal / _1K),
+                                  (ULONG)(cbSharedTotal / _1K),
+                                  uNetStatRx,
+                                  uNetStatTx);
 }
 
 // IGuest properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP Guest::COMGETTER(OSTypeId)(BSTR *a_pbstrOSTypeId)
+HRESULT Guest::getOSTypeId(com::Utf8Str &aOSTypeId)
 {
-    CheckComArgOutPointerValid(a_pbstrOSTypeId);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    HRESULT hrc = S_OK;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    if (!mData.mInterfaceVersion.isEmpty())
+        aOSTypeId = mData.mOSTypeId;
+    else
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        if (!mData.mInterfaceVersion.isEmpty())
-            mData.mOSTypeId.cloneTo(a_pbstrOSTypeId);
-        else
-        {
-            /* Redirect the call to IMachine if no additions are installed. */
-            ComPtr<IMachine> ptrMachine(mParent->machine());
-            alock.release();
-            hrc = ptrMachine->COMGETTER(OSTypeId)(a_pbstrOSTypeId);
-        }
+        /* Redirect the call to IMachine if no additions are installed. */
+        ComPtr<IMachine> ptrMachine(mParent->i_machine());
+        alock.release();
+        BSTR bstr;
+        hrc = ptrMachine->COMGETTER(OSTypeId)(&bstr);
+        aOSTypeId = bstr;
     }
     return hrc;
 }
 
-STDMETHODIMP Guest::COMGETTER(AdditionsRunLevel)(AdditionsRunLevelType_T *aRunLevel)
+HRESULT Guest::getAdditionsRunLevel(AdditionsRunLevelType_T *aAdditionsRunLevel)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aRunLevel = mData.mAdditionsRunLevel;
+    *aAdditionsRunLevel = mData.mAdditionsRunLevel;
 
     return S_OK;
 }
 
-STDMETHODIMP Guest::COMGETTER(AdditionsVersion)(BSTR *a_pbstrAdditionsVersion)
+HRESULT Guest::getAdditionsVersion(com::Utf8Str &aAdditionsVersion)
 {
-    CheckComArgOutPointerValid(a_pbstrAdditionsVersion);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = S_OK;
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    /*
+     * Return the ReportGuestInfo2 version info if available.
+     */
+    if (   !mData.mAdditionsVersionNew.isEmpty()
+         || mData.mAdditionsRunLevel <= AdditionsRunLevelType_None)
+        aAdditionsVersion = mData.mAdditionsVersionNew;
+    else
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
         /*
-         * Return the ReportGuestInfo2 version info if available.
+         * If we're running older guest additions (< 3.2.0) try get it from
+         * the guest properties.  Detected switched around Version and
+         * Revision in early 3.1.x releases (see r57115).
          */
-        if (   !mData.mAdditionsVersionNew.isEmpty()
-            || mData.mAdditionsRunLevel <= AdditionsRunLevelType_None)
-            mData.mAdditionsVersionNew.cloneTo(a_pbstrAdditionsVersion);
-        else
-        {
-            /*
-             * If we're running older guest additions (< 3.2.0) try get it from
-             * the guest properties.  Detected switched around Version and
-             * Revision in early 3.1.x releases (see r57115).
-             */
-            ComPtr<IMachine> ptrMachine = mParent->machine();
-            alock.release(); /* No need to hold this during the IPC fun. */
+        ComPtr<IMachine> ptrMachine = mParent->i_machine();
+        alock.release(); /* No need to hold this during the IPC fun. */
 
-            Bstr bstr;
-            hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Version").raw(), bstr.asOutParam());
-            if (   SUCCEEDED(hrc)
-                && !bstr.isEmpty())
-            {
-                Utf8Str str(bstr);
-                if (str.count('.') == 0)
-                    hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Revision").raw(), bstr.asOutParam());
-                str = bstr;
-                if (str.count('.') != 2)
-                    hrc = E_FAIL;
-            }
+        Bstr bstr;
+        hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Version").raw(), bstr.asOutParam());
+        if (   SUCCEEDED(hrc)
+            && !bstr.isEmpty())
+        {
+            Utf8Str str(bstr);
+            if (str.count('.') == 0)
+                hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Revision").raw(), bstr.asOutParam());
+            str = bstr;
+            if (str.count('.') != 2)
+                hrc = E_FAIL;
+        }
 
-            if (SUCCEEDED(hrc))
-                bstr.detachTo(a_pbstrAdditionsVersion);
-            else
-            {
-                /* Returning 1.4 is better than nothing. */
-                alock.acquire();
-                mData.mInterfaceVersion.cloneTo(a_pbstrAdditionsVersion);
-                hrc = S_OK;
-            }
+        if (SUCCEEDED(hrc))
+            aAdditionsVersion = bstr;
+        else
+        {
+            /* Returning 1.4 is better than nothing. */
+            alock.acquire();
+            aAdditionsVersion = mData.mInterfaceVersion;
+            hrc = S_OK;
         }
     }
     return hrc;
 }
 
-STDMETHODIMP Guest::COMGETTER(AdditionsRevision)(ULONG *a_puAdditionsRevision)
+HRESULT Guest::getAdditionsRevision(ULONG *aAdditionsRevision)
 {
-    CheckComArgOutPointerValid(a_puAdditionsRevision);
+    HRESULT hrc = S_OK;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    /*
+     * Return the ReportGuestInfo2 version info if available.
+     */
+    if (   !mData.mAdditionsVersionNew.isEmpty()
+        || mData.mAdditionsRunLevel <= AdditionsRunLevelType_None)
+        *aAdditionsRevision = mData.mAdditionsRevision;
+    else
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
         /*
-         * Return the ReportGuestInfo2 version info if available.
+         * If we're running older guest additions (< 3.2.0) try get it from
+         * the guest properties. Detected switched around Version and
+         * Revision in early 3.1.x releases (see r57115).
          */
-        if (   !mData.mAdditionsVersionNew.isEmpty()
-            || mData.mAdditionsRunLevel <= AdditionsRunLevelType_None)
-            *a_puAdditionsRevision = mData.mAdditionsRevision;
-        else
-        {
-            /*
-             * If we're running older guest additions (< 3.2.0) try get it from
-             * the guest properties. Detected switched around Version and
-             * Revision in early 3.1.x releases (see r57115).
-             */
-            ComPtr<IMachine> ptrMachine = mParent->machine();
-            alock.release(); /* No need to hold this during the IPC fun. */
+        ComPtr<IMachine> ptrMachine = mParent->i_machine();
+        alock.release(); /* No need to hold this during the IPC fun. */
 
-            Bstr bstr;
-            hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Revision").raw(), bstr.asOutParam());
-            if (SUCCEEDED(hrc))
+        Bstr bstr;
+        hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Revision").raw(), bstr.asOutParam());
+        if (SUCCEEDED(hrc))
+        {
+            Utf8Str str(bstr);
+            uint32_t uRevision;
+            int vrc = RTStrToUInt32Full(str.c_str(), 0, &uRevision);
+            if (vrc != VINF_SUCCESS && str.count('.') == 2)
             {
-                Utf8Str str(bstr);
-                uint32_t uRevision;
-                int vrc = RTStrToUInt32Full(str.c_str(), 0, &uRevision);
-                if (vrc != VINF_SUCCESS && str.count('.') == 2)
+                hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Version").raw(), bstr.asOutParam());
+                if (SUCCEEDED(hrc))
                 {
-                    hrc = ptrMachine->GetGuestPropertyValue(Bstr("/VirtualBox/GuestAdd/Version").raw(), bstr.asOutParam());
-                    if (SUCCEEDED(hrc))
-                    {
-                        str = bstr;
-                        vrc = RTStrToUInt32Full(str.c_str(), 0, &uRevision);
-                    }
+                    str = bstr;
+                    vrc = RTStrToUInt32Full(str.c_str(), 0, &uRevision);
                 }
-                if (vrc == VINF_SUCCESS)
-                    *a_puAdditionsRevision = uRevision;
-                else
-                    hrc = VBOX_E_IPRT_ERROR;
-            }
-            if (FAILED(hrc))
-            {
-                /* Return 0 if we don't know. */
-                *a_puAdditionsRevision = 0;
-                hrc = S_OK;
             }
+            if (vrc == VINF_SUCCESS)
+                *aAdditionsRevision = uRevision;
+            else
+                hrc = VBOX_E_IPRT_ERROR;
+        }
+        if (FAILED(hrc))
+        {
+            /* Return 0 if we don't know. */
+            *aAdditionsRevision = 0;
+            hrc = S_OK;
         }
     }
     return hrc;
 }
 
-STDMETHODIMP Guest::COMGETTER(EventSource)(IEventSource ** aEventSource)
+HRESULT Guest::getDnDSource(ComPtr<IGuestDnDSource> &aDnDSource)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
+#ifndef VBOX_WITH_DRAG_AND_DROP
     ReturnComNotImplemented();
 #else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aEventSource);
+    /* No need to lock - lifetime constant. */
+    HRESULT hr = mDnDSource.queryInterfaceTo(aDnDSource.asOutParam());
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowFuncLeaveRC(hr);
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
+}
 
-    // no need to lock - lifetime constant
-    mEventSource.queryInterfaceTo(aEventSource);
+HRESULT Guest::getDnDTarget(ComPtr<IGuestDnDTarget> &aDnDTarget)
+{
+#ifndef VBOX_WITH_DRAG_AND_DROP
+    ReturnComNotImplemented();
+#else
+    LogFlowThisFuncEnter();
 
-    LogFlowFuncLeaveRC(S_OK);
-    return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    /* No need to lock - lifetime constant. */
+    HRESULT hr = mDnDTarget.queryInterfaceTo(aDnDTarget.asOutParam());
+
+    LogFlowFuncLeaveRC(hr);
+    return hr;
+#endif /* VBOX_WITH_DRAG_AND_DROP */
 }
 
-STDMETHODIMP Guest::COMGETTER(Facilities)(ComSafeArrayOut(IAdditionsFacility *, aFacilities))
+HRESULT Guest::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-    CheckComArgOutSafeArrayPointerValid(aFacilities);
+    LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    /* No need to lock - lifetime constant. */
+    mEventSource.queryInterfaceTo(aEventSource.asOutParam());
 
+    LogFlowFuncLeaveRC(S_OK);
+    return S_OK;
+}
+
+HRESULT Guest::getFacilities(std::vector<ComPtr<IAdditionsFacility> > &aFacilities)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IAdditionsFacility> fac(mData.mFacilityMap);
-    fac.detachTo(ComSafeArrayOutArg(aFacilities));
+    aFacilities.resize(mData.mFacilityMap.size());
+    size_t i = 0;
+    for (FacilityMapIter it = mData.mFacilityMap.begin(); it != mData.mFacilityMap.end(); ++it, ++i)
+        it->second.queryInterfaceTo(aFacilities[i].asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Guest::COMGETTER(Sessions)(ComSafeArrayOut(IGuestSession *, aSessions))
+HRESULT Guest::getSessions(std::vector<ComPtr<IGuestSession> > &aSessions)
 {
-    CheckComArgOutSafeArrayPointerValid(aSessions);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
+#ifdef VBOX_WITH_GUEST_CONTROL
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IGuestSession> collection(mData.mGuestSessions);
-    collection.detachTo(ComSafeArrayOutArg(aSessions));
+    aSessions.resize(mData.mGuestSessions.size());
+    size_t i = 0;
+    for (GuestSessions::iterator it = mData.mGuestSessions.begin(); it != mData.mGuestSessions.end(); ++it, ++i)
+        it->second.queryInterfaceTo(aSessions[i].asOutParam());
 
     return S_OK;
+#else
+    ReturnComNotImplemented();
+#endif
 }
 
-BOOL Guest::isPageFusionEnabled()
+BOOL Guest::i_isPageFusionEnabled()
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return false;
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     return mfPageFusionEnabled;
 }
 
-STDMETHODIMP Guest::COMGETTER(MemoryBalloonSize)(ULONG *aMemoryBalloonSize)
+HRESULT Guest::getMemoryBalloonSize(ULONG *aMemoryBalloonSize)
 {
-    CheckComArgOutPointerValid(aMemoryBalloonSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aMemoryBalloonSize = mMemoryBalloonSize;
@@ -568,21 +564,18 @@ STDMETHODIMP Guest::COMGETTER(MemoryBalloonSize)(ULONG *aMemoryBalloonSize)
     return S_OK;
 }
 
-STDMETHODIMP Guest::COMSETTER(MemoryBalloonSize)(ULONG aMemoryBalloonSize)
+HRESULT Guest::setMemoryBalloonSize(ULONG aMemoryBalloonSize)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* We must be 100% sure that IMachine::COMSETTER(MemoryBalloonSize)
      * does not call us back in any way! */
-    HRESULT ret = mParent->machine()->COMSETTER(MemoryBalloonSize)(aMemoryBalloonSize);
+    HRESULT ret = mParent->i_machine()->COMSETTER(MemoryBalloonSize)(aMemoryBalloonSize);
     if (ret == S_OK)
     {
         mMemoryBalloonSize = aMemoryBalloonSize;
         /* forward the information to the VMM device */
-        VMMDev *pVMMDev = mParent->getVMMDev();
+        VMMDev *pVMMDev = mParent->i_getVMMDev();
         /* MUST release all locks before calling VMM device as its critsect
          * has higher lock order than anything in Main. */
         alock.release();
@@ -597,40 +590,32 @@ STDMETHODIMP Guest::COMSETTER(MemoryBalloonSize)(ULONG aMemoryBalloonSize)
     return ret;
 }
 
-STDMETHODIMP Guest::COMGETTER(StatisticsUpdateInterval)(ULONG *aUpdateInterval)
+HRESULT Guest::getStatisticsUpdateInterval(ULONG *aStatisticsUpdateInterval)
 {
-    CheckComArgOutPointerValid(aUpdateInterval);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aUpdateInterval = mStatUpdateInterval;
+    *aStatisticsUpdateInterval = mStatUpdateInterval;
     return S_OK;
 }
 
-STDMETHODIMP Guest::COMSETTER(StatisticsUpdateInterval)(ULONG aUpdateInterval)
+HRESULT Guest::setStatisticsUpdateInterval(ULONG aStatisticsUpdateInterval)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mStatUpdateInterval)
-        if (aUpdateInterval == 0)
+        if (aStatisticsUpdateInterval == 0)
             RTTimerLRStop(mStatTimer);
         else
-            RTTimerLRChangeInterval(mStatTimer, aUpdateInterval);
+            RTTimerLRChangeInterval(mStatTimer, aStatisticsUpdateInterval);
     else
-        if (aUpdateInterval != 0)
+        if (aStatisticsUpdateInterval != 0)
         {
-            RTTimerLRChangeInterval(mStatTimer, aUpdateInterval);
+            RTTimerLRChangeInterval(mStatTimer, aStatisticsUpdateInterval);
             RTTimerLRStart(mStatTimer, 0);
         }
-    mStatUpdateInterval = aUpdateInterval;
+    mStatUpdateInterval = aStatisticsUpdateInterval;
     /* forward the information to the VMM device */
-    VMMDev *pVMMDev = mParent->getVMMDev();
+    VMMDev *pVMMDev = mParent->i_getVMMDev();
     /* MUST release all locks before calling VMM device as its critsect
      * has higher lock order than anything in Main. */
     alock.release();
@@ -638,34 +623,19 @@ STDMETHODIMP Guest::COMSETTER(StatisticsUpdateInterval)(ULONG aUpdateInterval)
     {
         PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
         if (pVMMDevPort)
-            pVMMDevPort->pfnSetStatisticsInterval(pVMMDevPort, aUpdateInterval);
+            pVMMDevPort->pfnSetStatisticsInterval(pVMMDevPort, aStatisticsUpdateInterval);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP Guest::InternalGetStatistics(ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle,
-                                          ULONG *aMemTotal, ULONG *aMemFree, ULONG *aMemBalloon, ULONG *aMemShared,
-                                          ULONG *aMemCache, ULONG *aPageTotal,
-                                          ULONG *aMemAllocTotal, ULONG *aMemFreeTotal, ULONG *aMemBalloonTotal, ULONG *aMemSharedTotal)
-{
-    CheckComArgOutPointerValid(aCpuUser);
-    CheckComArgOutPointerValid(aCpuKernel);
-    CheckComArgOutPointerValid(aCpuIdle);
-    CheckComArgOutPointerValid(aMemTotal);
-    CheckComArgOutPointerValid(aMemFree);
-    CheckComArgOutPointerValid(aMemBalloon);
-    CheckComArgOutPointerValid(aMemShared);
-    CheckComArgOutPointerValid(aMemCache);
-    CheckComArgOutPointerValid(aPageTotal);
-    CheckComArgOutPointerValid(aMemAllocTotal);
-    CheckComArgOutPointerValid(aMemFreeTotal);
-    CheckComArgOutPointerValid(aMemBalloonTotal);
-    CheckComArgOutPointerValid(aMemSharedTotal);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT Guest::internalGetStatistics(ULONG *aCpuUser, ULONG *aCpuKernel, ULONG *aCpuIdle,
+                                     ULONG *aMemTotal, ULONG *aMemFree, ULONG *aMemBalloon,
+                                     ULONG *aMemShared, ULONG *aMemCache, ULONG *aPageTotal,
+                                     ULONG *aMemAllocTotal, ULONG *aMemFreeTotal,
+                                     ULONG *aMemBalloonTotal, ULONG *aMemSharedTotal)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aCpuUser    = mCurrentGuestStat[GUESTSTATTYPE_CPUUSER];
@@ -710,7 +680,7 @@ STDMETHODIMP Guest::InternalGetStatistics(ULONG *aCpuUser, ULONG *aCpuKernel, UL
     return S_OK;
 }
 
-HRESULT Guest::setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal)
+HRESULT Guest::i_setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal)
 {
     static ULONG indexToPerfMask[] =
     {
@@ -744,24 +714,19 @@ HRESULT Guest::setStatistic(ULONG aCpuId, GUESTSTATTYPE enmType, ULONG aVal)
  * @param   aType           Facility to get the status from.
  * @param   aTimestamp      Timestamp of last facility status update in ms (optional).
  */
-STDMETHODIMP Guest::GetFacilityStatus(AdditionsFacilityType_T aType, LONG64 *aTimestamp, AdditionsFacilityStatus_T *aStatus)
+HRESULT Guest::getFacilityStatus(AdditionsFacilityType_T aFacility, LONG64 *aTimestamp, AdditionsFacilityStatus_T *aStatus)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    CheckComArgNotNull(aStatus);
     /* Not checking for aTimestamp is intentional; it's optional. */
-
-    FacilityMapIterConst it = mData.mFacilityMap.find(aType);
+    FacilityMapIterConst it = mData.mFacilityMap.find(aFacility);
     if (it != mData.mFacilityMap.end())
     {
         AdditionsFacility *pFacility = it->second;
         ComAssert(pFacility);
-        *aStatus = pFacility->getStatus();
+        *aStatus = pFacility->i_getStatus();
         if (aTimestamp)
-            *aTimestamp = pFacility->getLastUpdated();
+            *aTimestamp = pFacility->i_getLastUpdated();
     }
     else
     {
@@ -776,11 +741,8 @@ STDMETHODIMP Guest::GetFacilityStatus(AdditionsFacilityType_T aType, LONG64 *aTi
     return S_OK;
 }
 
-STDMETHODIMP Guest::GetAdditionsStatus(AdditionsRunLevelType_T aLevel, BOOL *aActive)
+HRESULT Guest::getAdditionsStatus(AdditionsRunLevelType_T aLevel, BOOL *aActive)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
@@ -806,25 +768,21 @@ STDMETHODIMP Guest::GetAdditionsStatus(AdditionsRunLevelType_T aLevel, BOOL *aAc
 
     return rc;
 }
-
-STDMETHODIMP Guest::SetCredentials(IN_BSTR aUserName, IN_BSTR aPassword,
-                                   IN_BSTR aDomain, BOOL aAllowInteractiveLogon)
+HRESULT Guest::setCredentials(const com::Utf8Str &aUserName, const com::Utf8Str &aPassword,
+                              const com::Utf8Str &aDomain, BOOL aAllowInteractiveLogon)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* Check for magic domain names which are used to pass encryption keys to the disk. */
     if (Utf8Str(aDomain) == "@@disk")
-        return mParent->setDiskEncryptionKeys(Utf8Str(aPassword));
+        return mParent->i_setDiskEncryptionKeys(aPassword);
     else if (Utf8Str(aDomain) == "@@mem")
     {
         /** @todo */
-        return E_NOTIMPL;    
+        return E_NOTIMPL;
     }
     else
     {
         /* forward the information to the VMM device */
-        VMMDev *pVMMDev = mParent->getVMMDev();
+        VMMDev *pVMMDev = mParent->i_getVMMDev();
         if (pVMMDev)
         {
             PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
@@ -833,11 +791,11 @@ STDMETHODIMP Guest::SetCredentials(IN_BSTR aUserName, IN_BSTR aPassword,
                 uint32_t u32Flags = VMMDEV_SETCREDENTIALS_GUESTLOGON;
                 if (!aAllowInteractiveLogon)
                     u32Flags = VMMDEV_SETCREDENTIALS_NOLOCALLOGON;
-    
+
                 pVMMDevPort->pfnSetCredentials(pVMMDevPort,
-                                               Utf8Str(aUserName).c_str(),
-                                               Utf8Str(aPassword).c_str(),
-                                               Utf8Str(aDomain).c_str(),
+                                               aUserName.c_str(),
+                                               aPassword.c_str(),
+                                               aDomain.c_str(),
                                                u32Flags);
                 return S_OK;
             }
@@ -848,135 +806,6 @@ STDMETHODIMP Guest::SetCredentials(IN_BSTR aUserName, IN_BSTR aPassword,
                     tr("VMM device is not available (is the VM running?)"));
 }
 
-STDMETHODIMP Guest::DragHGEnter(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), DragAndDropAction_T *pResultAction)
-{
-    /* Input validation */
-    CheckComArgSafeArrayNotNull(allowedActions);
-    CheckComArgSafeArrayNotNull(formats);
-    CheckComArgOutPointerValid(pResultAction);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-#ifdef VBOX_WITH_DRAG_AND_DROP
-    return m_pGuestDnD->dragHGEnter(uScreenId, uX, uY, defaultAction, ComSafeArrayInArg(allowedActions), ComSafeArrayInArg(formats), pResultAction);
-#else /* VBOX_WITH_DRAG_AND_DROP */
-    ReturnComNotImplemented();
-#endif /* !VBOX_WITH_DRAG_AND_DROP */
-}
-
-STDMETHODIMP Guest::DragHGMove(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), DragAndDropAction_T *pResultAction)
-{
-    /* Input validation */
-    CheckComArgSafeArrayNotNull(allowedActions);
-    CheckComArgSafeArrayNotNull(formats);
-    CheckComArgOutPointerValid(pResultAction);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-#ifdef VBOX_WITH_DRAG_AND_DROP
-    return m_pGuestDnD->dragHGMove(uScreenId, uX, uY, defaultAction, ComSafeArrayInArg(allowedActions), ComSafeArrayInArg(formats), pResultAction);
-#else /* VBOX_WITH_DRAG_AND_DROP */
-    ReturnComNotImplemented();
-#endif /* !VBOX_WITH_DRAG_AND_DROP */
-}
-
-STDMETHODIMP Guest::DragHGLeave(ULONG uScreenId)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-#ifdef VBOX_WITH_DRAG_AND_DROP
-    return m_pGuestDnD->dragHGLeave(uScreenId);
-#else /* VBOX_WITH_DRAG_AND_DROP */
-    ReturnComNotImplemented();
-#endif /* !VBOX_WITH_DRAG_AND_DROP */
-}
-
-STDMETHODIMP Guest::DragHGDrop(ULONG uScreenId, ULONG uX, ULONG uY, DragAndDropAction_T defaultAction, ComSafeArrayIn(DragAndDropAction_T, allowedActions), ComSafeArrayIn(IN_BSTR, formats), BSTR *pstrFormat, DragAndDropAction_T *pResultAction)
-{
-    /* Input validation */
-    CheckComArgSafeArrayNotNull(allowedActions);
-    CheckComArgSafeArrayNotNull(formats);
-    CheckComArgOutPointerValid(pstrFormat);
-    CheckComArgOutPointerValid(pResultAction);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-#ifdef VBOX_WITH_DRAG_AND_DROP
-    return m_pGuestDnD->dragHGDrop(uScreenId, uX, uY, defaultAction, ComSafeArrayInArg(allowedActions), ComSafeArrayInArg(formats), pstrFormat, pResultAction);
-#else /* VBOX_WITH_DRAG_AND_DROP */
-    ReturnComNotImplemented();
-#endif /* !VBOX_WITH_DRAG_AND_DROP */
-}
-
-STDMETHODIMP Guest::DragHGPutData(ULONG uScreenId, IN_BSTR bstrFormat, ComSafeArrayIn(BYTE, data), IProgress **ppProgress)
-{
-    /* Input validation */
-    CheckComArgStrNotEmptyOrNull(bstrFormat);
-    CheckComArgSafeArrayNotNull(data);
-    CheckComArgOutPointerValid(ppProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-#ifdef VBOX_WITH_DRAG_AND_DROP
-    return m_pGuestDnD->dragHGPutData(uScreenId, bstrFormat, ComSafeArrayInArg(data), ppProgress);
-#else /* VBOX_WITH_DRAG_AND_DROP */
-    ReturnComNotImplemented();
-#endif /* !VBOX_WITH_DRAG_AND_DROP */
-}
-
-STDMETHODIMP Guest::DragGHPending(ULONG uScreenId, ComSafeArrayOut(BSTR, formats), ComSafeArrayOut(DragAndDropAction_T, allowedActions), DragAndDropAction_T *pDefaultAction)
-{
-    /* Input validation */
-    CheckComArgSafeArrayNotNull(formats);
-    CheckComArgSafeArrayNotNull(allowedActions);
-    CheckComArgOutPointerValid(pDefaultAction);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-#if defined(VBOX_WITH_DRAG_AND_DROP) && defined(VBOX_WITH_DRAG_AND_DROP_GH)
-    return m_pGuestDnD->dragGHPending(uScreenId, ComSafeArrayOutArg(formats), ComSafeArrayOutArg(allowedActions), pDefaultAction);
-#else /* VBOX_WITH_DRAG_AND_DROP */
-    ReturnComNotImplemented();
-#endif /* !VBOX_WITH_DRAG_AND_DROP */
-}
-
-STDMETHODIMP Guest::DragGHDropped(IN_BSTR bstrFormat, DragAndDropAction_T action, IProgress **ppProgress)
-{
-    /* Input validation */
-    CheckComArgStrNotEmptyOrNull(bstrFormat);
-    CheckComArgOutPointerValid(ppProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-#if defined(VBOX_WITH_DRAG_AND_DROP) && defined(VBOX_WITH_DRAG_AND_DROP_GH)
-    return m_pGuestDnD->dragGHDropped(bstrFormat, action, ppProgress);
-#else /* VBOX_WITH_DRAG_AND_DROP */
-    ReturnComNotImplemented();
-#endif /* !VBOX_WITH_DRAG_AND_DROP */
-}
-
-STDMETHODIMP Guest::DragGHGetData(ComSafeArrayOut(BYTE, data))
-{
-    /* Input validation */
-    CheckComArgSafeArrayNotNull(data);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-#if defined(VBOX_WITH_DRAG_AND_DROP) && defined(VBOX_WITH_DRAG_AND_DROP_GH)
-    return m_pGuestDnD->dragGHGetData(ComSafeArrayOutArg(data));
-#else /* VBOX_WITH_DRAG_AND_DROP */
-    ReturnComNotImplemented();
-#endif /* !VBOX_WITH_DRAG_AND_DROP */
-}
-
 // public methods only for internal purposes
 /////////////////////////////////////////////////////////////////////////////
 
@@ -988,7 +817,7 @@ STDMETHODIMP Guest::DragGHGetData(ComSafeArrayOut(BYTE, data))
  * @param aInterfaceVersion
  * @param aOsType
  */
-void Guest::setAdditionsInfo(Bstr aInterfaceVersion, VBOXOSTYPE aOsType)
+void Guest::i_setAdditionsInfo(com::Utf8Str aInterfaceVersion, VBOXOSTYPE aOsType)
 {
     RTTIMESPEC TimeSpecTS;
     RTTimeNow(&TimeSpecTS);
@@ -1033,7 +862,7 @@ void Guest::setAdditionsInfo(Bstr aInterfaceVersion, VBOXOSTYPE aOsType)
              * "graphics" (feature) facility to active as soon as we got the Guest Additions
              * interface version.
              */
-            facilityUpdate(VBoxGuestFacilityType_Graphics, VBoxGuestFacilityStatus_Active,  0 /*fFlags*/, &TimeSpecTS);
+            i_facilityUpdate(VBoxGuestFacilityType_Graphics, VBoxGuestFacilityStatus_Active,  0 /*fFlags*/, &TimeSpecTS);
         }
     }
 
@@ -1053,16 +882,17 @@ void Guest::setAdditionsInfo(Bstr aInterfaceVersion, VBOXOSTYPE aOsType)
      * PS. There is the VMMDEV_GUEST_SUPPORTS_GRAPHICS capability* report... It
      * should come in pretty quickly after this update, normally.
      */
-    facilityUpdate(VBoxGuestFacilityType_Graphics,
-                   facilityIsActive(VBoxGuestFacilityType_VBoxGuestDriver)
-                   ? VBoxGuestFacilityStatus_Active : VBoxGuestFacilityStatus_Inactive,
-                   0 /*fFlags*/, &TimeSpecTS); /** @todo the timestamp isn't gonna be right here on saved state restore. */
+    i_facilityUpdate(VBoxGuestFacilityType_Graphics,
+                     i_facilityIsActive(VBoxGuestFacilityType_VBoxGuestDriver)
+                     ? VBoxGuestFacilityStatus_Active : VBoxGuestFacilityStatus_Inactive,
+                     0 /*fFlags*/, &TimeSpecTS); /** @todo the timestamp isn't gonna be right here on saved state restore. */
 
     /*
      * Note! There is a race going on between setting mAdditionsRunLevel and
      * mSupportsGraphics here and disabling/enabling it later according to
      * its real status when using new(er) Guest Additions.
      */
+    mData.mOSType = aOsType;
     mData.mOSTypeId = Global::OSTypeId(aOsType);
 }
 
@@ -1085,20 +915,17 @@ void Guest::setAdditionsInfo(Bstr aInterfaceVersion, VBOXOSTYPE aOsType)
  * @param   a_uRevision             See VBoxGuestInfo2::additionsRevision.
  * @param   a_fFeatures             See VBoxGuestInfo2::additionsFeatures.
  */
-void Guest::setAdditionsInfo2(uint32_t a_uFullVersion, const char *a_pszName, uint32_t a_uRevision, uint32_t a_fFeatures)
+void Guest::i_setAdditionsInfo2(uint32_t a_uFullVersion, const char *a_pszName, uint32_t a_uRevision, uint32_t a_fFeatures)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnVoid(autoCaller.rc());
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (a_uFullVersion)
     {
-        mData.mAdditionsVersionNew  = BstrFmt(*a_pszName ? "%u.%u.%u_%s" : "%u.%u.%u",
-                                              VBOX_FULL_VERSION_GET_MAJOR(a_uFullVersion),
-                                              VBOX_FULL_VERSION_GET_MINOR(a_uFullVersion),
-                                              VBOX_FULL_VERSION_GET_BUILD(a_uFullVersion),
-                                              a_pszName);
+        mData.mAdditionsVersionNew  = Utf8StrFmt(*a_pszName ? "%u.%u.%u_%s" : "%u.%u.%u",
+                                                 VBOX_FULL_VERSION_GET_MAJOR(a_uFullVersion),
+                                                 VBOX_FULL_VERSION_GET_MINOR(a_uFullVersion),
+                                                 VBOX_FULL_VERSION_GET_BUILD(a_uFullVersion),
+                                                 a_pszName);
         mData.mAdditionsVersionFull = a_uFullVersion;
         mData.mAdditionsRevision    = a_uRevision;
         mData.mAdditionsFeatures    = a_fFeatures;
@@ -1113,20 +940,20 @@ void Guest::setAdditionsInfo2(uint32_t a_uFullVersion, const char *a_pszName, ui
     }
 }
 
-bool Guest::facilityIsActive(VBoxGuestFacilityType enmFacility)
+bool Guest::i_facilityIsActive(VBoxGuestFacilityType enmFacility)
 {
     Assert(enmFacility < INT32_MAX);
     FacilityMapIterConst it = mData.mFacilityMap.find((AdditionsFacilityType_T)enmFacility);
     if (it != mData.mFacilityMap.end())
     {
         AdditionsFacility *pFac = it->second;
-        return (pFac->getStatus() == AdditionsFacilityStatus_Active);
+        return (pFac->i_getStatus() == AdditionsFacilityStatus_Active);
     }
     return false;
 }
 
-void Guest::facilityUpdate(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus,
-                           uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS)
+void Guest::i_facilityUpdate(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus,
+                             uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS)
 {
     AssertReturnVoid(   a_enmFacility < VBoxGuestFacilityType_All
                      && a_enmFacility > VBoxGuestFacilityType_Unknown);
@@ -1135,7 +962,7 @@ void Guest::facilityUpdate(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilit
     if (it != mData.mFacilityMap.end())
     {
         AdditionsFacility *pFac = it->second;
-        pFac->update((AdditionsFacilityStatus_T)a_enmStatus, a_fFlags, a_pTimeSpecTS);
+        pFac->i_update((AdditionsFacilityStatus_T)a_enmStatus, a_fFlags, a_pTimeSpecTS);
     }
     else
     {
@@ -1164,11 +991,11 @@ void Guest::facilityUpdate(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilit
  * @param   aUser               Guest user name.
  * @param   aDomain             Domain of guest user account. Optional.
  * @param   enmState            New state to indicate.
- * @param   puDetails           Pointer to state details. Optional.
+ * @param   pbDetails           Pointer to state details. Optional.
  * @param   cbDetails           Size (in bytes) of state details. Pass 0 if not used.
  */
-void Guest::onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmState,
-                              const uint8_t *puDetails, uint32_t cbDetails)
+void Guest::i_onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmState,
+                                const uint8_t *pbDetails, uint32_t cbDetails)
 {
     LogFlowThisFunc(("\n"));
 
@@ -1196,8 +1023,8 @@ void Guest::onUserStateChange(Bstr aUser, Bstr aDomain, VBoxGuestUserState enmSt
  * @sa      PDMIVMMDEVCONNECTOR::pfnUpdateGuestStatus, vmmdevUpdateGuestStatus
  * @thread  The emulation thread.
  */
-void Guest::setAdditionsStatus(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus,
-                               uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS)
+void Guest::i_setAdditionsStatus(VBoxGuestFacilityType a_enmFacility, VBoxGuestFacilityStatus a_enmStatus,
+                                 uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS)
 {
     Assert(   a_enmFacility > VBoxGuestFacilityType_Unknown
            && a_enmFacility <= VBoxGuestFacilityType_All); /* Paranoia, VMMDev checks for this. */
@@ -1212,18 +1039,18 @@ void Guest::setAdditionsStatus(VBoxGuestFacilityType a_enmFacility, VBoxGuestFac
      */
     if (a_enmFacility == VBoxGuestFacilityType_All)
         for (FacilityMapIter it = mData.mFacilityMap.begin(); it != mData.mFacilityMap.end(); ++it)
-            facilityUpdate((VBoxGuestFacilityType)it->first, a_enmStatus, a_fFlags, a_pTimeSpecTS);
+            i_facilityUpdate((VBoxGuestFacilityType)it->first, a_enmStatus, a_fFlags, a_pTimeSpecTS);
     else /* Update one facility only. */
-        facilityUpdate(a_enmFacility, a_enmStatus, a_fFlags, a_pTimeSpecTS);
+        i_facilityUpdate(a_enmFacility, a_enmStatus, a_fFlags, a_pTimeSpecTS);
 
     /*
      * Recalc the runlevel.
      */
-    if (facilityIsActive(VBoxGuestFacilityType_VBoxTrayClient))
+    if (i_facilityIsActive(VBoxGuestFacilityType_VBoxTrayClient))
         mData.mAdditionsRunLevel = AdditionsRunLevelType_Desktop;
-    else if (facilityIsActive(VBoxGuestFacilityType_VBoxService))
+    else if (i_facilityIsActive(VBoxGuestFacilityType_VBoxService))
         mData.mAdditionsRunLevel = AdditionsRunLevelType_Userland;
-    else if (facilityIsActive(VBoxGuestFacilityType_VBoxGuestDriver))
+    else if (i_facilityIsActive(VBoxGuestFacilityType_VBoxGuestDriver))
         mData.mAdditionsRunLevel = AdditionsRunLevelType_System;
     else
         mData.mAdditionsRunLevel = AdditionsRunLevelType_None;
@@ -1234,7 +1061,7 @@ void Guest::setAdditionsStatus(VBoxGuestFacilityType a_enmFacility, VBoxGuestFac
  *
  * @param   fCaps       Guest capability bit mask (VMMDEV_GUEST_SUPPORTS_XXX).
  */
-void Guest::setSupportedFeatures(uint32_t aCaps)
+void Guest::i_setSupportedFeatures(uint32_t aCaps)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -1247,9 +1074,9 @@ void Guest::setSupportedFeatures(uint32_t aCaps)
     RTTIMESPEC TimeSpecTS;
     RTTimeNow(&TimeSpecTS);
 
-    facilityUpdate(VBoxGuestFacilityType_Seamless,
-                   aCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS ? VBoxGuestFacilityStatus_Active : VBoxGuestFacilityStatus_Inactive,
-                   0 /*fFlags*/, &TimeSpecTS);
+    i_facilityUpdate(VBoxGuestFacilityType_Seamless,
+                     aCaps & VMMDEV_GUEST_SUPPORTS_SEAMLESS ? VBoxGuestFacilityStatus_Active : VBoxGuestFacilityStatus_Inactive,
+                     0 /*fFlags*/, &TimeSpecTS);
     /** @todo Add VMMDEV_GUEST_SUPPORTS_GUEST_HOST_WINDOW_MAPPING */
 }
 
diff --git a/src/VBox/Main/src-client/GuestProcessImpl.cpp b/src/VBox/Main/src-client/GuestProcessImpl.cpp
index 85c3d99..e1b9036 100644
--- a/src/VBox/Main/src-client/GuestProcessImpl.cpp
+++ b/src/VBox/Main/src-client/GuestProcessImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -27,6 +27,9 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
+#ifndef VBOX_WITH_GUEST_CONTROL
+# error "VBOX_WITH_GUEST_CONTROL must defined in this file"
+#endif
 #include "GuestProcessImpl.h"
 #include "GuestSessionImpl.h"
 #include "GuestCtrlImplPrivate.h"
@@ -64,9 +67,9 @@ public:
 
     virtual ~GuestProcessTask(void) { }
 
-    int rc(void) const { return mRC; }
-    bool isOk(void) const { return RT_SUCCESS(mRC); }
-    const ComObjPtr<GuestProcess> &Process(void) const { return mProcess; }
+    int i_rc(void) const { return mRC; }
+    bool i_isOk(void) const { return RT_SUCCESS(mRC); }
+    const ComObjPtr<GuestProcess> &i_process(void) const { return mProcess; }
 
 protected:
 
@@ -161,11 +164,11 @@ void GuestProcess::FinalRelease(void)
 // public initializer/uninitializer for internal purposes only
 /////////////////////////////////////////////////////////////////////////////
 
-int GuestProcess::init(Console *aConsole, GuestSession *aSession,
-                       ULONG aProcessID, const GuestProcessStartupInfo &aProcInfo)
+int GuestProcess::init(Console *aConsole, GuestSession *aSession, ULONG aProcessID,
+                       const GuestProcessStartupInfo &aProcInfo, const GuestEnvironment *pBaseEnv)
 {
-    LogFlowThisFunc(("aConsole=%p, aSession=%p, aProcessID=%RU32\n",
-                     aConsole, aSession, aProcessID));
+    LogFlowThisFunc(("aConsole=%p, aSession=%p, aProcessID=%RU32 pBaseEnv=%p\n",
+                     aConsole, aSession, aProcessID, pBaseEnv));
 
     AssertPtrReturn(aConsole, VERR_INVALID_POINTER);
     AssertPtrReturn(aSession, VERR_INVALID_POINTER);
@@ -174,10 +177,6 @@ int GuestProcess::init(Console *aConsole, GuestSession *aSession,
     AutoInitSpan autoInitSpan(this);
     AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
 
-#ifndef VBOX_WITH_GUEST_CONTROL
-    autoInitSpan.setSucceeded();
-    return VINF_SUCCESS;
-#else
     HRESULT hr;
 
     int vrc = bindToSession(aConsole, aSession, aProcessID /* Object ID */);
@@ -236,6 +235,9 @@ int GuestProcess::init(Console *aConsole, GuestSession *aSession,
     if (RT_SUCCESS(vrc))
     {
         mData.mProcess = aProcInfo;
+        mData.mpSessionBaseEnv = pBaseEnv;
+        if (pBaseEnv)
+            pBaseEnv->retainConst();
         mData.mExitCode = 0;
         mData.mPID = 0;
         mData.mLastError = VINF_SUCCESS;
@@ -250,7 +252,6 @@ int GuestProcess::init(Console *aConsole, GuestSession *aSession,
 
     autoInitSpan.setFailed();
     return vrc;
-#endif
 }
 
 /**
@@ -264,204 +265,139 @@ void GuestProcess::uninit(void)
     if (autoUninitSpan.uninitDone())
         return;
 
-#ifdef VBOX_WITH_GUEST_CONTROL
-    LogFlowThisFunc(("mCmd=%s, PID=%RU32\n",
-                     mData.mProcess.mCommand.c_str(), mData.mPID));
+    LogFlowThisFunc(("mExe=%s, PID=%RU32\n", mData.mProcess.mExecutable.c_str(), mData.mPID));
 
     /* Terminate process if not already done yet. */
     int guestRc = VINF_SUCCESS;
-    int vrc = terminateProcess(30 * 1000, &guestRc); /** @todo Make timeouts configurable. */
+    int vrc = i_terminateProcess(30 * 1000, &guestRc); /** @todo Make timeouts configurable. */
     /* Note: Don't return here yet; first uninit all other stuff in
      *       case of failure. */
 
+    if (mData.mpSessionBaseEnv)
+    {
+        mData.mpSessionBaseEnv->releaseConst();
+        mData.mpSessionBaseEnv = NULL;
+    }
+
     baseUninit();
 
     LogFlowThisFunc(("Returning rc=%Rrc, guestRc=%Rrc\n",
                      vrc, guestRc));
-#endif
 }
 
 // implementation of public getters/setters for attributes
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP GuestProcess::COMGETTER(Arguments)(ComSafeArrayOut(BSTR, aArguments))
+HRESULT GuestProcess::getArguments(std::vector<com::Utf8Str> &aArguments)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutSafeArrayPointerValid(aArguments);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    com::SafeArray<BSTR> collection(mData.mProcess.mArguments.size());
-    size_t s = 0;
-    for (ProcessArguments::const_iterator it = mData.mProcess.mArguments.begin();
-         it != mData.mProcess.mArguments.end();
-         it++, s++)
-    {
-        Bstr tmp = *it;
-        tmp.cloneTo(&collection[s]);
-    }
-
-    collection.detachTo(ComSafeArrayOutArg(aArguments));
-
+    aArguments = mData.mProcess.mArguments;
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::COMGETTER(Environment)(ComSafeArrayOut(BSTR, aEnvironment))
+HRESULT GuestProcess::getEnvironment(std::vector<com::Utf8Str> &aEnvironment)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
+#ifndef VBOX_WTIH_GUEST_CONTROL
     ReturnComNotImplemented();
 #else
-    LogFlowThisFuncEnter();
-
-    CheckComArgOutSafeArrayPointerValid(aEnvironment);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    com::SafeArray<BSTR> arguments(mData.mProcess.mEnvironment.Size());
-    for (size_t i = 0; i < arguments.size(); i++)
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);  /* (Paranoia since both environment objects are immutable.) */
+    HRESULT hrc;
+    if (mData.mpSessionBaseEnv)
     {
-        Bstr tmp = mData.mProcess.mEnvironment.Get(i);
-        tmp.cloneTo(&arguments[i]);
+        int vrc;
+        if (mData.mProcess.mEnvironmentChanges.count() == 0)
+            vrc = mData.mpSessionBaseEnv->queryPutEnvArray(&aEnvironment);
+        else
+        {
+            GuestEnvironment TmpEnv;
+            vrc = TmpEnv.copy(*mData.mpSessionBaseEnv);
+            if (RT_SUCCESS(vrc))
+            {
+                vrc = TmpEnv.applyChanges(mData.mProcess.mEnvironmentChanges);
+                if (RT_SUCCESS(rc))
+                    vrc = TmpEnv.queryPutEnvArray(&aEnvironment);
+            }
+        }
+        hrc = Global::vboxStatusCodeToCOM(vrc);
     }
-    arguments.detachTo(ComSafeArrayOutArg(aEnvironment));
-
-    return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    else
+        hrc = setError(VBOX_E_NOT_SUPPORTED, tr("The base environment feature is not supported by the guest additions"));
+    LogFlowThisFuncLeave();
+    return hrc;
+#endif
 }
 
-STDMETHODIMP GuestProcess::COMGETTER(EventSource)(IEventSource ** aEventSource)
+HRESULT GuestProcess::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // no need to lock - lifetime constant
-    mEventSource.queryInterfaceTo(aEventSource);
+    mEventSource.queryInterfaceTo(aEventSource.asOutParam());
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::COMGETTER(ExecutablePath)(BSTR *aExecutablePath)
+HRESULT GuestProcess::getExecutablePath(com::Utf8Str &aExecutablePath)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aExecutablePath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mProcess.mCommand.cloneTo(aExecutablePath);
+    aExecutablePath = mData.mProcess.mExecutable;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::COMGETTER(ExitCode)(LONG *aExitCode)
+HRESULT GuestProcess::getExitCode(LONG *aExitCode)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aExitCode);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aExitCode = mData.mExitCode;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::COMGETTER(Name)(BSTR *aName)
+HRESULT GuestProcess::getName(com::Utf8Str &aName)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mProcess.mName.cloneTo(aName);
+    aName = mData.mProcess.mName;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::COMGETTER(PID)(ULONG *aPID)
+HRESULT GuestProcess::getPID(ULONG *aPID)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aPID);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aPID = mData.mPID;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::COMGETTER(Status)(ProcessStatus_T *aStatus)
+HRESULT GuestProcess::getStatus(ProcessStatus_T *aStatus)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aStatus = mData.mStatus;
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
 // private methods
 /////////////////////////////////////////////////////////////////////////////
 
-int GuestProcess::callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int GuestProcess::i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCb, VERR_INVALID_POINTER);
@@ -475,25 +411,25 @@ int GuestProcess::callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTC
     {
         case GUEST_DISCONNECTED:
         {
-            vrc = onGuestDisconnected(pCbCtx, pSvcCb);
+            vrc = i_onGuestDisconnected(pCbCtx, pSvcCb);
             break;
         }
 
         case GUEST_EXEC_STATUS:
         {
-            vrc = onProcessStatusChange(pCbCtx, pSvcCb);
+            vrc = i_onProcessStatusChange(pCbCtx, pSvcCb);
             break;
         }
 
         case GUEST_EXEC_OUTPUT:
         {
-            vrc = onProcessOutput(pCbCtx, pSvcCb);
+            vrc = i_onProcessOutput(pCbCtx, pSvcCb);
             break;
         }
 
         case GUEST_EXEC_INPUT_STATUS:
         {
-            vrc = onProcessInputStatus(pCbCtx, pSvcCb);
+            vrc = i_onProcessInputStatus(pCbCtx, pSvcCb);
             break;
         }
 
@@ -525,7 +461,7 @@ int GuestProcess::callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTC
  * @return  IPRT status code.
  * @param   uPID                    PID to check.
  */
-inline int GuestProcess::checkPID(uint32_t uPID)
+inline int GuestProcess::i_checkPID(uint32_t uPID)
 {
     int rc = VINF_SUCCESS;
 
@@ -544,7 +480,7 @@ inline int GuestProcess::checkPID(uint32_t uPID)
 }
 
 /* static */
-Utf8Str GuestProcess::guestErrorToString(int guestRc)
+Utf8Str GuestProcess::i_guestErrorToString(int guestRc)
 {
     Utf8Str strError;
 
@@ -611,14 +547,14 @@ Utf8Str GuestProcess::guestErrorToString(int guestRc)
     return strError;
 }
 
-inline bool GuestProcess::isAlive(void)
+inline bool GuestProcess::i_isAlive(void)
 {
     return (   mData.mStatus == ProcessStatus_Started
             || mData.mStatus == ProcessStatus_Paused
             || mData.mStatus == ProcessStatus_Terminating);
 }
 
-inline bool GuestProcess::hasEnded(void)
+inline bool GuestProcess::i_hasEnded(void)
 {
     return (   mData.mStatus == ProcessStatus_TerminatedNormally
             || mData.mStatus == ProcessStatus_TerminatedSignal
@@ -629,18 +565,18 @@ inline bool GuestProcess::hasEnded(void)
             || mData.mStatus == ProcessStatus_Error);
 }
 
-int GuestProcess::onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
+int GuestProcess::i_onGuestDisconnected(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER);
 
-    int vrc = setProcessStatus(ProcessStatus_Down, VINF_SUCCESS);
+    int vrc = i_setProcessStatus(ProcessStatus_Down, VINF_SUCCESS);
 
     LogFlowFuncLeaveRC(vrc);
     return vrc;
 }
 
-int GuestProcess::onProcessInputStatus(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
+int GuestProcess::i_onProcessInputStatus(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER);
@@ -663,7 +599,7 @@ int GuestProcess::onProcessInputStatus(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUES
     LogFlowThisFunc(("uPID=%RU32, uStatus=%RU32, uFlags=%RI32, cbProcessed=%RU32\n",
                      dataCb.uPID, dataCb.uStatus, dataCb.uFlags, dataCb.uProcessed));
 
-    vrc = checkPID(dataCb.uPID);
+    vrc = i_checkPID(dataCb.uPID);
     if (RT_SUCCESS(vrc))
     {
         ProcessInputStatus_T inputStatus = ProcessInputStatus_Undefined;
@@ -707,7 +643,7 @@ int GuestProcess::onProcessInputStatus(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUES
     return vrc;
 }
 
-int GuestProcess::onProcessNotifyIO(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
+int GuestProcess::i_onProcessNotifyIO(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER);
@@ -715,7 +651,7 @@ int GuestProcess::onProcessNotifyIO(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCT
     return VERR_NOT_IMPLEMENTED;
 }
 
-int GuestProcess::onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
+int GuestProcess::i_onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER);
@@ -737,7 +673,7 @@ int GuestProcess::onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUE
     LogFlowThisFunc(("uPID=%RU32, uStatus=%RU32, uFlags=%RU32\n",
                      dataCb.uPID, dataCb.uStatus, dataCb.uFlags));
 
-    vrc = checkPID(dataCb.uPID);
+    vrc = i_checkPID(dataCb.uPID);
     if (RT_SUCCESS(vrc))
     {
         ProcessStatus_T procStatus = ProcessStatus_Undefined;
@@ -816,7 +752,7 @@ int GuestProcess::onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUE
                          vrc, procStatus, procRc));
 
         /* Set the process status. */
-        int rc2 = setProcessStatus(procStatus, procRc);
+        int rc2 = i_setProcessStatus(procStatus, procRc);
         if (RT_SUCCESS(vrc))
             vrc = rc2;
     }
@@ -825,7 +761,7 @@ int GuestProcess::onProcessStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUE
     return vrc;
 }
 
-int GuestProcess::onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
+int GuestProcess::i_onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
 {
     AssertPtrReturn(pSvcCbData, VERR_INVALID_POINTER);
 
@@ -846,7 +782,7 @@ int GuestProcess::onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRL
     LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RI32, pvData=%p, cbData=%RU32\n",
                      dataCb.uPID, dataCb.uHandle, dataCb.uFlags, dataCb.pvData, dataCb.cbData));
 
-    vrc = checkPID(dataCb.uPID);
+    vrc = i_checkPID(dataCb.uPID);
     if (RT_SUCCESS(vrc))
     {
         com::SafeArray<BYTE> data((size_t)dataCb.cbData);
@@ -865,7 +801,7 @@ int GuestProcess::onProcessOutput(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRL
  * Called by IGuestSession right before this process gets
  * removed from the public process list.
  */
-int GuestProcess::onRemove(void)
+int GuestProcess::i_onRemove(void)
 {
     LogFlowThisFuncEnter();
 
@@ -889,8 +825,8 @@ int GuestProcess::onRemove(void)
     return vrc;
 }
 
-int GuestProcess::readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS,
-                           void *pvData, size_t cbData, uint32_t *pcbRead, int *pGuestRc)
+int GuestProcess::i_readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS,
+                             void *pvData, size_t cbData, uint32_t *pcbRead, int *pGuestRc)
 {
     LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uSize=%RU32, uTimeoutMS=%RU32, pvData=%p, cbData=%RU32, pGuestRc=%p\n",
                      mData.mPID, uHandle, uSize, uTimeoutMS, pvData, cbData, pGuestRc));
@@ -931,7 +867,7 @@ int GuestProcess::readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS
          * So just skip checking for process status change and only wait for the
          * output event.
          */
-        if (mSession->getProtocolVersion() >= 2)
+        if (mSession->i_getProtocolVersion() >= 2)
             eventTypes.push_back(VBoxEventType_OnGuestProcessStateChanged);
         eventTypes.push_back(VBoxEventType_OnGuestProcessOutput);
 
@@ -960,8 +896,8 @@ int GuestProcess::readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS
     }
 
     if (RT_SUCCESS(vrc))
-        vrc = waitForOutput(pEvent, uHandle, uTimeoutMS,
-                            pvData, cbData, pcbRead);
+        vrc = i_waitForOutput(pEvent, uHandle, uTimeoutMS,
+                              pvData, cbData, pcbRead);
 
     unregisterWaitEvent(pEvent);
 
@@ -970,7 +906,7 @@ int GuestProcess::readData(uint32_t uHandle, uint32_t uSize, uint32_t uTimeoutMS
 }
 
 /* Does not do locking; caller is responsible for that! */
-int GuestProcess::setProcessStatus(ProcessStatus_T procStatus, int procRc)
+int GuestProcess::i_setProcessStatus(ProcessStatus_T procStatus, int procRc)
 {
     LogFlowThisFuncEnter();
 
@@ -1003,7 +939,7 @@ int GuestProcess::setProcessStatus(ProcessStatus_T procStatus, int procRc)
         {
             hr = errorInfo->initEx(VBOX_E_IPRT_ERROR, mData.mLastError,
                                    COM_IIDOF(IGuestProcess), getComponentName(),
-                                   guestErrorToString(mData.mLastError));
+                                   i_guestErrorToString(mData.mLastError));
             ComAssertComRC(hr);
         }
 
@@ -1035,19 +971,19 @@ int GuestProcess::setProcessStatus(ProcessStatus_T procStatus, int procRc)
 }
 
 /* static */
-HRESULT GuestProcess::setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
+HRESULT GuestProcess::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
 {
     AssertPtr(pInterface);
     AssertMsg(RT_FAILURE(guestRc), ("Guest rc does not indicate a failure when setting error\n"));
 
-    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestProcess::guestErrorToString(guestRc).c_str());
+    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestProcess::i_guestErrorToString(guestRc).c_str());
 }
 
-int GuestProcess::startProcess(uint32_t uTimeoutMS, int *pGuestRc)
+int GuestProcess::i_startProcess(uint32_t uTimeoutMS, int *pGuestRc)
 {
-    LogFlowThisFunc(("uTimeoutMS=%RU32, procCmd=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n",
-                     uTimeoutMS, mData.mProcess.mCommand.c_str(), mData.mProcess.mTimeoutMS, mData.mProcess.mFlags,
-                     mSession->getId()));
+    LogFlowThisFunc(("uTimeoutMS=%RU32, procExe=%s, procTimeoutMS=%RU32, procFlags=%x, sessionID=%RU32\n",
+                     uTimeoutMS, mData.mProcess.mExecutable.c_str(), mData.mProcess.mTimeoutMS, mData.mProcess.mFlags,
+                     mSession->i_getId()));
 
     /* Wait until the caller function (if kicked off by a thread)
      * has returned and continue operation. */
@@ -1075,8 +1011,10 @@ int GuestProcess::startProcess(uint32_t uTimeoutMS, int *pGuestRc)
 
     GuestSession *pSession = mSession;
     AssertPtr(pSession);
+    uint32_t const uProtocol = pSession->i_getProtocolVersion();
+
+    const GuestCredentials &sessionCreds = pSession->i_getCredentials();
 
-    const GuestCredentials &sessionCreds = pSession->getCredentials();
 
     /* Prepare arguments. */
     char *pszArgs = NULL;
@@ -1087,27 +1025,22 @@ int GuestProcess::startProcess(uint32_t uTimeoutMS, int *pGuestRc)
     if (   RT_SUCCESS(vrc)
         && cArgs)
     {
-        char **papszArgv = (char**)RTMemAlloc((cArgs + 1) * sizeof(char*));
+        char const **papszArgv = (char const **)RTMemAlloc((cArgs + 1) * sizeof(papszArgv[0]));
         AssertReturn(papszArgv, VERR_NO_MEMORY);
 
-        for (size_t i = 0; i < cArgs && RT_SUCCESS(vrc); i++)
+        for (size_t i = 0; i < cArgs; i++)
         {
-            const char *pszCurArg = mData.mProcess.mArguments[i].c_str();
-            AssertPtr(pszCurArg);
-            vrc = RTStrDupEx(&papszArgv[i], pszCurArg);
+            papszArgv[i] = mData.mProcess.mArguments[i].c_str();
+            AssertPtr(papszArgv[i]);
         }
         papszArgv[cArgs] = NULL;
 
-        if (RT_SUCCESS(vrc))
+        if (uProtocol < UINT32_C(0xdeadbeef) ) /** @todo implement a way of sending argv[0], best idea is a new command. */
+            vrc = RTGetOptArgvToString(&pszArgs, papszArgv + 1, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH);
+        else
             vrc = RTGetOptArgvToString(&pszArgs, papszArgv, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH);
 
-        if (papszArgv)
-        {
-            size_t i = 0;
-            while (papszArgv[i])
-                RTStrFree(papszArgv[i++]);
-            RTMemFree(papszArgv);
-        }
+        RTMemFree(papszArgv);
     }
 
     /* Calculate arguments size (in bytes). */
@@ -1115,36 +1048,34 @@ int GuestProcess::startProcess(uint32_t uTimeoutMS, int *pGuestRc)
     if (RT_SUCCESS(vrc))
         cbArgs = pszArgs ? strlen(pszArgs) + 1 : 0; /* Include terminating zero. */
 
-    /* Prepare environment. */
-    void *pvEnv = NULL;
-    size_t cbEnv = 0;
+    /* Prepare environment.  The guest service dislikes the empty string at the end, so drop it. */
+    size_t  cbEnvBlock;
+    char   *pszzEnvBlock;
     if (RT_SUCCESS(vrc))
-        vrc = mData.mProcess.mEnvironment.BuildEnvironmentBlock(&pvEnv, &cbEnv, NULL /* cEnv */);
-
+        vrc = mData.mProcess.mEnvironmentChanges.queryUtf8Block(&pszzEnvBlock, &cbEnvBlock);
     if (RT_SUCCESS(vrc))
     {
-        AssertPtr(mSession);
-        uint32_t uProtocol = mSession->getProtocolVersion();
+        Assert(cbEnvBlock > 0);
+        cbEnvBlock--;
 
         /* Prepare HGCM call. */
         VBOXHGCMSVCPARM paParms[16];
         int i = 0;
         paParms[i++].setUInt32(pEvent->ContextID());
-        paParms[i++].setPointer((void*)mData.mProcess.mCommand.c_str(),
-                                (ULONG)mData.mProcess.mCommand.length() + 1);
+        paParms[i++].setCppString(mData.mProcess.mExecutable);
         paParms[i++].setUInt32(mData.mProcess.mFlags);
         paParms[i++].setUInt32((uint32_t)mData.mProcess.mArguments.size());
-        paParms[i++].setPointer((void*)pszArgs, (uint32_t)cbArgs);
-        paParms[i++].setUInt32((uint32_t)mData.mProcess.mEnvironment.Size());
-        paParms[i++].setUInt32((uint32_t)cbEnv);
-        paParms[i++].setPointer((void*)pvEnv, (uint32_t)cbEnv);
+        paParms[i++].setPointer(pszArgs, (uint32_t)cbArgs);
+        paParms[i++].setUInt32(mData.mProcess.mEnvironmentChanges.count());
+        paParms[i++].setUInt32((uint32_t)cbEnvBlock);
+        paParms[i++].setPointer(pszzEnvBlock, (uint32_t)cbEnvBlock);
         if (uProtocol < 2)
         {
             /* In protocol v1 (VBox < 4.3) the credentials were part of the execution
              * call. In newer protocols these credentials are part of the opened guest
              * session, so not needed anymore here. */
-            paParms[i++].setPointer((void*)sessionCreds.mUser.c_str(), (ULONG)sessionCreds.mUser.length() + 1);
-            paParms[i++].setPointer((void*)sessionCreds.mPassword.c_str(), (ULONG)sessionCreds.mPassword.length() + 1);
+            paParms[i++].setCppString(sessionCreds.mUser);
+            paParms[i++].setCppString(sessionCreds.mPassword);
         }
         /*
          * If the WaitForProcessStartOnly flag is set, we only want to define and wait for a timeout
@@ -1163,7 +1094,7 @@ int GuestProcess::startProcess(uint32_t uTimeoutMS, int *pGuestRc)
              * so that makes up to 64 CPUs total. This can be more in the future. */
             paParms[i++].setUInt32(1);
             /* The actual CPU affinity blocks. */
-            paParms[i++].setPointer((void*)&mData.mProcess.mAffinity, sizeof(mData.mProcess.mAffinity));
+            paParms[i++].setPointer((void *)&mData.mProcess.mAffinity, sizeof(mData.mProcess.mAffinity));
         }
 
         alock.release(); /* Drop the write lock before sending. */
@@ -1171,25 +1102,26 @@ int GuestProcess::startProcess(uint32_t uTimeoutMS, int *pGuestRc)
         vrc = sendCommand(HOST_EXEC_CMD, i, paParms);
         if (RT_FAILURE(vrc))
         {
-            int rc2 = setProcessStatus(ProcessStatus_Error, vrc);
+            int rc2 = i_setProcessStatus(ProcessStatus_Error, vrc);
             AssertRC(rc2);
         }
+
+        mData.mProcess.mEnvironmentChanges.freeUtf8Block(pszzEnvBlock);
     }
 
-    GuestEnvironment::FreeEnvironmentBlock(pvEnv);
     if (pszArgs)
         RTStrFree(pszArgs);
 
     if (RT_SUCCESS(vrc))
-        vrc = waitForStatusChange(pEvent, uTimeoutMS,
-                                  NULL /* Process status */, pGuestRc);
+        vrc = i_waitForStatusChange(pEvent, uTimeoutMS,
+                                    NULL /* Process status */, pGuestRc);
     unregisterWaitEvent(pEvent);
 
     LogFlowFuncLeaveRC(vrc);
     return vrc;
 }
 
-int GuestProcess::startProcessAsync(void)
+int GuestProcess::i_startProcessAsync(void)
 {
     LogFlowThisFuncEnter();
 
@@ -1200,9 +1132,9 @@ int GuestProcess::startProcessAsync(void)
         /* Asynchronously start the process on the guest by kicking off a
          * worker thread. */
         std::auto_ptr<GuestProcessStartTask> pTask(new GuestProcessStartTask(this));
-        AssertReturn(pTask->isOk(), pTask->rc());
+        AssertReturn(pTask->i_isOk(), pTask->i_rc());
 
-        vrc = RTThreadCreate(NULL, GuestProcess::startProcessThread,
+        vrc = RTThreadCreate(NULL, GuestProcess::i_startProcessThread,
                              (void *)pTask.get(), 0,
                              RTTHREADTYPE_MAIN_WORKER, 0,
                              "gctlPrcStart");
@@ -1222,28 +1154,28 @@ int GuestProcess::startProcessAsync(void)
 }
 
 /* static */
-DECLCALLBACK(int) GuestProcess::startProcessThread(RTTHREAD Thread, void *pvUser)
+DECLCALLBACK(int) GuestProcess::i_startProcessThread(RTTHREAD Thread, void *pvUser)
 {
     LogFlowFunc(("pvUser=%p\n", pvUser));
 
     std::auto_ptr<GuestProcessStartTask> pTask(static_cast<GuestProcessStartTask*>(pvUser));
     AssertPtr(pTask.get());
 
-    const ComObjPtr<GuestProcess> pProcess(pTask->Process());
+    const ComObjPtr<GuestProcess> pProcess(pTask->i_process());
     Assert(!pProcess.isNull());
 
     AutoCaller autoCaller(pProcess);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    int vrc = pProcess->startProcess(30 * 1000 /* 30s timeout */,
-                                     NULL /* Guest rc, ignored */);
+    int vrc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */,
+                                       NULL /* Guest rc, ignored */);
     /* Nothing to do here anymore. */
 
     LogFlowFunc(("pProcess=%p returning rc=%Rrc\n", (GuestProcess *)pProcess, vrc));
     return vrc;
 }
 
-int GuestProcess::terminateProcess(uint32_t uTimeoutMS, int *pGuestRc)
+int GuestProcess::i_terminateProcess(uint32_t uTimeoutMS, int *pGuestRc)
 {
     /* pGuestRc is optional. */
     LogFlowThisFunc(("uTimeoutMS=%RU32\n", uTimeoutMS));
@@ -1262,7 +1194,7 @@ int GuestProcess::terminateProcess(uint32_t uTimeoutMS, int *pGuestRc)
         AssertPtr(mSession);
         /* Note: VBox < 4.3 (aka protocol version 1) does not
          *       support this, so just skip. */
-        if (mSession->getProtocolVersion() < 2)
+        if (mSession->i_getProtocolVersion() < 2)
             vrc = VERR_NOT_SUPPORTED;
 
         if (RT_SUCCESS(vrc))
@@ -1292,8 +1224,8 @@ int GuestProcess::terminateProcess(uint32_t uTimeoutMS, int *pGuestRc)
 
             vrc = sendCommand(HOST_EXEC_TERMINATE, i, paParms);
             if (RT_SUCCESS(vrc))
-                vrc = waitForStatusChange(pEvent, uTimeoutMS,
-                                          NULL /* ProcessStatus */, pGuestRc);
+                vrc = i_waitForStatusChange(pEvent, uTimeoutMS,
+                                            NULL /* ProcessStatus */, pGuestRc);
             unregisterWaitEvent(pEvent);
         }
     }
@@ -1303,9 +1235,9 @@ int GuestProcess::terminateProcess(uint32_t uTimeoutMS, int *pGuestRc)
 }
 
 /* static */
-ProcessWaitResult_T GuestProcess::waitFlagsToResultEx(uint32_t fWaitFlags,
-                                                      ProcessStatus_T oldStatus, ProcessStatus_T newStatus,
-                                                      uint32_t uProcFlags, uint32_t uProtocol)
+ProcessWaitResult_T GuestProcess::i_waitFlagsToResultEx(uint32_t fWaitFlags,
+                                                        ProcessStatus_T oldStatus, ProcessStatus_T newStatus,
+                                                        uint32_t uProcFlags, uint32_t uProtocol)
 {
     ProcessWaitResult_T waitResult = ProcessWaitResult_None;
 
@@ -1336,10 +1268,10 @@ ProcessWaitResult_T GuestProcess::waitFlagsToResultEx(uint32_t fWaitFlags,
                     else
                     {
                         /*
-                             * If ProcessCreateFlag_WaitForProcessStartOnly was specified on process creation the
-                             * caller is not interested in getting further process statuses -- so just don't notify
-                             * anything here anymore and return.
-                             */
+                         * If ProcessCreateFlag_WaitForProcessStartOnly was specified on process creation the
+                         * caller is not interested in getting further process statuses -- so just don't notify
+                         * anything here anymore and return.
+                         */
                         if (uProcFlags & ProcessCreateFlag_WaitForProcessStartOnly)
                             waitResult = ProcessWaitResult_Start;
                     }
@@ -1373,7 +1305,8 @@ ProcessWaitResult_T GuestProcess::waitFlagsToResultEx(uint32_t fWaitFlags,
 
     if (newStatus == ProcessStatus_Started)
     {
-        /* Filter out waits which are *not* supported using
+        /**
+         * Filter out waits which are *not* supported using
          * older guest control Guest Additions.
          *
          ** @todo ProcessWaitForFlag_Std* flags are not implemented yet.
@@ -1402,16 +1335,16 @@ ProcessWaitResult_T GuestProcess::waitFlagsToResultEx(uint32_t fWaitFlags,
     return waitResult;
 }
 
-ProcessWaitResult_T GuestProcess::waitFlagsToResult(uint32_t fWaitFlags)
+ProcessWaitResult_T GuestProcess::i_waitFlagsToResult(uint32_t fWaitFlags)
 {
     AssertPtr(mSession);
-    return GuestProcess::waitFlagsToResultEx(fWaitFlags,
-                                             mData.mStatus /* curStatus */, mData.mStatus /* newStatus */,
-                                             mData.mProcess.mFlags, mSession->getProtocolVersion());
+    return GuestProcess::i_waitFlagsToResultEx(fWaitFlags,
+                                               mData.mStatus /* curStatus */, mData.mStatus /* newStatus */,
+                                               mData.mProcess.mFlags, mSession->i_getProtocolVersion());
 }
 
-int GuestProcess::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS,
-                          ProcessWaitResult_T &waitResult, int *pGuestRc)
+int GuestProcess::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS,
+                            ProcessWaitResult_T &waitResult, int *pGuestRc)
 {
     AssertReturn(fWaitFlags, VERR_INVALID_PARAMETER);
 
@@ -1425,14 +1358,15 @@ int GuestProcess::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS,
     if (curStatus == ProcessStatus_Error)
     {
         waitResult = ProcessWaitResult_Error;
-        AssertMsg(RT_FAILURE(mData.mLastError), ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mLastError));
+        AssertMsg(RT_FAILURE(mData.mLastError),
+                             ("No error rc (%Rrc) set when guest process indicated an error\n", mData.mLastError));
         if (pGuestRc)
             *pGuestRc = mData.mLastError; /* Return last set error. */
         LogFlowThisFunc(("Process is in error state (guestRc=%Rrc)\n", mData.mLastError));
         return VERR_GSTCTL_GUEST_ERROR;
     }
 
-    waitResult = waitFlagsToResult(fWaitFlags);
+    waitResult = i_waitFlagsToResult(fWaitFlags);
 
     /* No waiting needed? Return immediately using the last set error. */
     if (waitResult != ProcessWaitResult_None)
@@ -1482,16 +1416,16 @@ int GuestProcess::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS,
             break;
         }
 
-        vrc = waitForStatusChange(pEvent,
+        vrc = i_waitForStatusChange(pEvent,
                                     uTimeoutMS == RT_INDEFINITE_WAIT
-                                  ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS,
-                                  &newStatus, pGuestRc);
+                                    ? RT_INDEFINITE_WAIT : uTimeoutMS - (uint32_t)u64ElapsedMS,
+                                    &newStatus, pGuestRc);
         if (RT_SUCCESS(vrc))
         {
             alock.acquire();
 
-            waitResult = waitFlagsToResultEx(fWaitFlags, curStatus, newStatus,
-                                             mData.mProcess.mFlags, mSession->getProtocolVersion());
+            waitResult = i_waitFlagsToResultEx(fWaitFlags, curStatus, newStatus,
+                                               mData.mProcess.mFlags, mSession->i_getProtocolVersion());
 #ifdef DEBUG
             LogFlowThisFunc(("Got new status change: fWaitFlags=0x%x, newStatus=%RU32, waitResult=%RU32\n",
                              fWaitFlags, newStatus, waitResult));
@@ -1512,8 +1446,8 @@ int GuestProcess::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS,
     return vrc;
 }
 
-int GuestProcess::waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS,
-                                     ProcessInputStatus_T *pInputStatus, uint32_t *pcbProcessed)
+int GuestProcess::i_waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS,
+                                       ProcessInputStatus_T *pInputStatus, uint32_t *pcbProcessed)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
 
@@ -1548,8 +1482,8 @@ int GuestProcess::waitForInputNotify(GuestWaitEvent *pEvent, uint32_t uHandle, u
     return vrc;
 }
 
-int GuestProcess::waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS,
-                                void *pvData, size_t cbData, uint32_t *pcbRead)
+int GuestProcess::i_waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32_t uTimeoutMS,
+                                  void *pvData, size_t cbData, uint32_t *pcbRead)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
     /* pvData is optional. */
@@ -1630,8 +1564,8 @@ int GuestProcess::waitForOutput(GuestWaitEvent *pEvent, uint32_t uHandle, uint32
     return vrc;
 }
 
-int GuestProcess::waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
-                                      ProcessStatus_T *pProcessStatus, int *pGuestRc)
+int GuestProcess::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutMS,
+                                        ProcessStatus_T *pProcessStatus, int *pGuestRc)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
     /* pProcessStatus is optional. */
@@ -1676,9 +1610,9 @@ int GuestProcess::waitForStatusChange(GuestWaitEvent *pEvent, uint32_t uTimeoutM
 }
 
 /* static */
-bool GuestProcess::waitResultImpliesEx(ProcessWaitResult_T waitResult,
-                                       ProcessStatus_T procStatus, uint32_t uProcFlags,
-                                       uint32_t uProtocol)
+bool GuestProcess::i_waitResultImpliesEx(ProcessWaitResult_T waitResult,
+                                         ProcessStatus_T procStatus, uint32_t uProcFlags,
+                                         uint32_t uProtocol)
 {
     bool fImplies;
 
@@ -1706,13 +1640,12 @@ bool GuestProcess::waitResultImpliesEx(ProcessWaitResult_T waitResult,
     return fImplies;
 }
 
-int GuestProcess::writeData(uint32_t uHandle, uint32_t uFlags,
-                            void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc)
+int GuestProcess::i_writeData(uint32_t uHandle, uint32_t uFlags,
+                              void *pvData, size_t cbData, uint32_t uTimeoutMS, uint32_t *puWritten, int *pGuestRc)
 {
     LogFlowThisFunc(("uPID=%RU32, uHandle=%RU32, uFlags=%RU32, pvData=%p, cbData=%RU32, uTimeoutMS=%RU32, puWritten=%p, pGuestRc=%p\n",
                      mData.mPID, uHandle, uFlags, pvData, cbData, uTimeoutMS, puWritten, pGuestRc));
     /* All is optional. There can be 0 byte writes. */
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mData.mStatus != ProcessStatus_Started)
@@ -1737,7 +1670,7 @@ int GuestProcess::writeData(uint32_t uHandle, uint32_t uFlags,
          * So just skip checking for process status change and only wait for the
          * input event.
          */
-        if (mSession->getProtocolVersion() >= 2)
+        if (mSession->i_getProtocolVersion() >= 2)
             eventTypes.push_back(VBoxEventType_OnGuestProcessStateChanged);
         eventTypes.push_back(VBoxEventType_OnGuestProcessInputNotify);
 
@@ -1766,8 +1699,8 @@ int GuestProcess::writeData(uint32_t uHandle, uint32_t uFlags,
     if (RT_SUCCESS(vrc))
     {
         ProcessInputStatus_T inputStatus;
-        vrc = waitForInputNotify(pEvent, uHandle, uTimeoutMS,
-                                 &inputStatus, &cbProcessed);
+        vrc = i_waitForInputNotify(pEvent, uHandle, uTimeoutMS,
+                                   &inputStatus, &cbProcessed);
         if (RT_SUCCESS(vrc))
         {
             /** @todo Set guestRc. */
@@ -1788,45 +1721,38 @@ int GuestProcess::writeData(uint32_t uHandle, uint32_t uFlags,
 // implementation of public methods
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP GuestProcess::Read(ULONG aHandle, ULONG aToRead, ULONG aTimeoutMS, ComSafeArrayOut(BYTE, aData))
+HRESULT GuestProcess::read(ULONG aHandle, ULONG aToRead, ULONG aTimeoutMS, std::vector<BYTE> &aData)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
     if (aToRead == 0)
         return setError(E_INVALIDARG, tr("The size to read is zero"));
-    CheckComArgOutSafeArrayPointerValid(aData);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    com::SafeArray<BYTE> data((size_t)aToRead);
-    Assert(data.size() >= aToRead);
+    aData.resize(aToRead);
 
     HRESULT hr = S_OK;
 
     uint32_t cbRead; int guestRc;
-    int vrc = readData(aHandle, aToRead, aTimeoutMS, data.raw(), aToRead, &cbRead, &guestRc);
+    int vrc = i_readData(aHandle, aToRead, aTimeoutMS, &aData.front(), aToRead, &cbRead, &guestRc);
     if (RT_SUCCESS(vrc))
     {
-        if (data.size() != cbRead)
-            data.resize(cbRead);
-        data.detachTo(ComSafeArrayOutArg(aData));
+        if (aData.size() != cbRead)
+            aData.resize(cbRead);
     }
     else
     {
+        aData.resize(0);
+
         switch (vrc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
                 hr = setError(VBOX_E_IPRT_ERROR,
                               tr("Reading from process \"%s\" (PID %RU32) failed: %Rrc"),
-                              mData.mProcess.mCommand.c_str(), mData.mPID, vrc);
+                              mData.mProcess.mExecutable.c_str(), mData.mPID, vrc);
                 break;
         }
     }
@@ -1835,42 +1761,33 @@ STDMETHODIMP GuestProcess::Read(ULONG aHandle, ULONG aToRead, ULONG aTimeoutMS,
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::Terminate(void)
+HRESULT GuestProcess::terminate()
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT hr = S_OK;
 
     int guestRc;
-    int vrc = terminateProcess(30 * 1000 /* Timeout in ms */,
-                               &guestRc);
+    int vrc = i_terminateProcess(30 * 1000 /* Timeout in ms */,
+                                 &guestRc);
     if (RT_FAILURE(vrc))
     {
         switch (vrc)
         {
            case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             case VERR_NOT_SUPPORTED:
                 hr = setError(VBOX_E_IPRT_ERROR,
                               tr("Terminating process \"%s\" (PID %RU32) not supported by installed Guest Additions"),
-                              mData.mProcess.mCommand.c_str(), mData.mPID);
+                              mData.mProcess.mExecutable.c_str(), mData.mPID);
                 break;
 
             default:
                 hr = setError(VBOX_E_IPRT_ERROR,
                               tr("Terminating process \"%s\" (PID %RU32) failed: %Rrc"),
-                              mData.mProcess.mCommand.c_str(), mData.mPID, vrc);
+                              mData.mProcess.mExecutable.c_str(), mData.mPID, vrc);
                 break;
         }
     }
@@ -1878,34 +1795,26 @@ STDMETHODIMP GuestProcess::Terminate(void)
     /* Remove process from guest session list. Now only API clients
      * still can hold references to it. */
     AssertPtr(mSession);
-    int rc2 = mSession->processRemoveFromList(this);
+    int rc2 = mSession->i_processRemoveFromList(this);
     if (RT_SUCCESS(vrc))
         vrc = rc2;
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::WaitFor(ULONG aWaitFlags, ULONG aTimeoutMS, ProcessWaitResult_T *aReason)
+HRESULT GuestProcess::waitFor(ULONG aWaitFor,
+                              ULONG aTimeoutMS,
+                              ProcessWaitResult_T *aReason)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    CheckComArgOutPointerValid(aReason);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /*
      * Note: Do not hold any locks here while waiting!
      */
     HRESULT hr = S_OK;
 
-    int guestRc; ProcessWaitResult_T waitResult;
-    int vrc = waitFor(aWaitFlags, aTimeoutMS, waitResult, &guestRc);
+    int guestRc;
+    ProcessWaitResult_T waitResult;
+    int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &guestRc);
     if (RT_SUCCESS(vrc))
     {
         *aReason = waitResult;
@@ -1915,7 +1824,7 @@ STDMETHODIMP GuestProcess::WaitFor(ULONG aWaitFlags, ULONG aTimeoutMS, ProcessWa
         switch (vrc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             case VERR_TIMEOUT:
@@ -1925,72 +1834,51 @@ STDMETHODIMP GuestProcess::WaitFor(ULONG aWaitFlags, ULONG aTimeoutMS, ProcessWa
             default:
                 hr = setError(VBOX_E_IPRT_ERROR,
                               tr("Waiting for process \"%s\" (PID %RU32) failed: %Rrc"),
-                              mData.mProcess.mCommand.c_str(), mData.mPID, vrc);
+                              mData.mProcess.mExecutable.c_str(), mData.mPID, vrc);
                 break;
         }
     }
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::WaitForArray(ComSafeArrayIn(ProcessWaitForFlag_T, aFlags), ULONG aTimeoutMS, ProcessWaitResult_T *aReason)
+HRESULT GuestProcess::waitForArray(const std::vector<ProcessWaitForFlag_T> &aWaitFor,
+                                   ULONG aTimeoutMS, ProcessWaitResult_T *aReason)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    CheckComArgOutPointerValid(aReason);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /*
      * Note: Do not hold any locks here while waiting!
      */
     uint32_t fWaitFor = ProcessWaitForFlag_None;
-    com::SafeArray<ProcessWaitForFlag_T> flags(ComSafeArrayInArg(aFlags));
-    for (size_t i = 0; i < flags.size(); i++)
-        fWaitFor |= flags[i];
+    for (size_t i = 0; i < aWaitFor.size(); i++)
+        fWaitFor |= aWaitFor[i];
 
     return WaitFor(fWaitFor, aTimeoutMS, aReason);
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::Write(ULONG aHandle, ULONG aFlags,
-                                 ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten)
+HRESULT GuestProcess::write(ULONG aHandle, ULONG aFlags, const std::vector<BYTE> &aData,
+                            ULONG aTimeoutMS, ULONG *aWritten)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgSafeArrayNotNull(aData);
-    CheckComArgOutPointerValid(aWritten);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    com::SafeArray<BYTE> data(ComSafeArrayInArg(aData));
-
     HRESULT hr = S_OK;
 
     uint32_t cbWritten; int guestRc;
-    int vrc = writeData(aHandle, aFlags, data.raw(), data.size(), aTimeoutMS, &cbWritten, &guestRc);
+    uint32_t cbData = (uint32_t)aData.size();
+    void *pvData = cbData > 0? (void *)&aData.front(): NULL;
+    int vrc = i_writeData(aHandle, aFlags, pvData, cbData, aTimeoutMS, &cbWritten, &guestRc);
     if (RT_FAILURE(vrc))
     {
         switch (vrc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
                 hr = setError(VBOX_E_IPRT_ERROR,
                               tr("Writing to process \"%s\" (PID %RU32) failed: %Rrc"),
-                              mData.mProcess.mCommand.c_str(), mData.mPID, vrc);
+                              mData.mProcess.mExecutable.c_str(), mData.mPID, vrc);
                 break;
         }
     }
@@ -2001,33 +1889,21 @@ STDMETHODIMP GuestProcess::Write(ULONG aHandle, ULONG aFlags,
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestProcess::WriteArray(ULONG aHandle, ComSafeArrayIn(ProcessInputFlag_T, aFlags),
-                                      ComSafeArrayIn(BYTE, aData), ULONG aTimeoutMS, ULONG *aWritten)
+HRESULT GuestProcess::writeArray(ULONG aHandle, const std::vector<ProcessInputFlag_T> &aFlags,
+                                 const std::vector<BYTE> &aData, ULONG aTimeoutMS, ULONG *aWritten)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgSafeArrayNotNull(aData);
-    CheckComArgOutPointerValid(aWritten);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /*
      * Note: Do not hold any locks here while writing!
      */
     ULONG fWrite = ProcessInputFlag_None;
-    com::SafeArray<ProcessInputFlag_T> flags(ComSafeArrayInArg(aFlags));
-    for (size_t i = 0; i < flags.size(); i++)
-        fWrite |= flags[i];
+    for (size_t i = 0; i < aFlags.size(); i++)
+        fWrite |= aFlags[i];
 
-    return Write(aHandle, fWrite, ComSafeArrayInArg(aData), aTimeoutMS, aWritten);
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    return write(aHandle, fWrite, aData, aTimeoutMS, aWritten);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -2040,14 +1916,14 @@ GuestProcessTool::GuestProcessTool(void)
 
 GuestProcessTool::~GuestProcessTool(void)
 {
-    Terminate(30 * 1000, NULL /* pGuestRc */);
+    i_terminate(30 * 1000, NULL /* pGuestRc */);
 }
 
 int GuestProcessTool::Init(GuestSession *pGuestSession, const GuestProcessStartupInfo &startupInfo,
                            bool fAsync, int *pGuestRc)
 {
-    LogFlowThisFunc(("pGuestSession=%p, szCmd=%s, fAsync=%RTbool\n",
-                     pGuestSession, startupInfo.mCommand.c_str(), fAsync));
+    LogFlowThisFunc(("pGuestSession=%p, exe=%s, fAsync=%RTbool\n",
+                     pGuestSession, startupInfo.mExecutable.c_str(), fAsync));
 
     AssertPtrReturn(pGuestSession, VERR_INVALID_POINTER);
 
@@ -2057,11 +1933,11 @@ int GuestProcessTool::Init(GuestSession *pGuestSession, const GuestProcessStartu
     /* Make sure the process is hidden. */
     mStartupInfo.mFlags |= ProcessCreateFlag_Hidden;
 
-    int vrc = pSession->processCreateExInteral(mStartupInfo, pProcess);
+    int vrc = pSession->i_processCreateExInternal(mStartupInfo, pProcess);
     if (RT_SUCCESS(vrc))
         vrc = fAsync
-            ? pProcess->startProcessAsync()
-            : pProcess->startProcess(30 * 1000 /* 30s timeout */, pGuestRc);
+            ? pProcess->i_startProcessAsync()
+            : pProcess->i_startProcess(30 * 1000 /* 30s timeout */, pGuestRc);
 
     if (   RT_SUCCESS(vrc)
         && !fAsync
@@ -2077,7 +1953,7 @@ int GuestProcessTool::Init(GuestSession *pGuestSession, const GuestProcessStartu
     return vrc;
 }
 
-int GuestProcessTool::GetCurrentBlock(uint32_t uHandle, GuestProcessStreamBlock &strmBlock)
+int GuestProcessTool::i_getCurrentBlock(uint32_t uHandle, GuestProcessStreamBlock &strmBlock)
 {
     const GuestProcessStream *pStream = NULL;
     if (uHandle == OUTPUT_HANDLE_ID_STDOUT)
@@ -2102,7 +1978,7 @@ int GuestProcessTool::GetCurrentBlock(uint32_t uHandle, GuestProcessStreamBlock
     return vrc;
 }
 
-bool GuestProcessTool::IsRunning(void)
+bool GuestProcessTool::i_isRunning(void)
 {
     AssertReturn(!pProcess.isNull(), false);
 
@@ -2121,21 +1997,29 @@ bool GuestProcessTool::IsRunning(void)
 }
 
 /* static */
-int GuestProcessTool::Run(      GuestSession            *pGuestSession,
-                          const GuestProcessStartupInfo &startupInfo,
-                                int                     *pGuestRc)
+int GuestProcessTool::i_run(      GuestSession            *pGuestSession,
+                            const GuestProcessStartupInfo &startupInfo,
+                            int                           *pGuestRc)
 {
-    return RunEx(pGuestSession, startupInfo,
-                 NULL /* pStrmOutObjects */, 0 /* cStrmOutObjects */,
-                 pGuestRc);
+    return i_runEx(pGuestSession, startupInfo,
+                   NULL /* pStrmOutObjects */, 0 /* cStrmOutObjects */,
+                   pGuestRc);
 }
 
+/**
+ * <Someone write documentation, pretty please!>
+ *
+ * @param   pGuestRc        Optional.  Will be set to VINF_SUCCESS,
+ *                          VERR_NOT_EQUAL or VERR_INVALID_STATE if the
+ *                          process completed.  Should it fail earlier that,
+ *                          you're feel free to enlighten the rest of us...
+ */
 /* static */
-int GuestProcessTool::RunEx(      GuestSession            *pGuestSession,
-                            const GuestProcessStartupInfo &startupInfo,
-                                  GuestCtrlStreamObjects  *pStrmOutObjects,
-                                  uint32_t                 cStrmOutObjects,
-                                  int                     *pGuestRc)
+int GuestProcessTool::i_runEx(      GuestSession            *pGuestSession,
+                              const GuestProcessStartupInfo &startupInfo,
+                                    GuestCtrlStreamObjects  *pStrmOutObjects,
+                                    uint32_t                 cStrmOutObjects,
+                                    int                     *pGuestRc)
 {
     GuestProcessTool procTool; int guestRc;
     int vrc = procTool.Init(pGuestSession, startupInfo, false /* Async */, &guestRc);
@@ -2146,9 +2030,9 @@ int GuestProcessTool::RunEx(      GuestSession            *pGuestSession,
             try
             {
                 GuestProcessStreamBlock strmBlk;
-                vrc = procTool.WaitEx(  pStrmOutObjects
-                                      ? GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK
-                                      : GUESTPROCESSTOOL_FLAG_NONE, &strmBlk, &guestRc);
+                vrc = procTool.i_waitEx(  pStrmOutObjects
+                                        ? GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK
+                                        : GUESTPROCESSTOOL_FLAG_NONE, &strmBlk, &guestRc);
                 if (pStrmOutObjects)
                     pStrmOutObjects->push_back(strmBlk);
             }
@@ -2162,10 +2046,10 @@ int GuestProcessTool::RunEx(      GuestSession            *pGuestSession,
     if (RT_SUCCESS(vrc))
     {
         /* Make sure the process runs until completion. */
-        vrc = procTool.Wait(GUESTPROCESSTOOL_FLAG_NONE, &guestRc);
+        vrc = procTool.i_wait(GUESTPROCESSTOOL_FLAG_NONE, &guestRc);
         if (RT_SUCCESS(vrc))
         {
-            guestRc = procTool.TerminatedOk(NULL /* Exit code */);
+            guestRc = procTool.i_terminatedOk(NULL /* Exit code */);
             if (RT_FAILURE(guestRc))
                 vrc = VERR_GSTCTL_GUEST_ERROR;
         }
@@ -2178,13 +2062,13 @@ int GuestProcessTool::RunEx(      GuestSession            *pGuestSession,
     return vrc;
 }
 
-int GuestProcessTool::TerminatedOk(LONG *pExitCode)
+int GuestProcessTool::i_terminatedOk(LONG *pExitCode)
 {
     Assert(!pProcess.isNull());
     /* pExitCode is optional. */
 
     int vrc;
-    if (!IsRunning())
+    if (!i_isRunning())
     {
         LONG exitCode;
         HRESULT hr = pProcess->COMGETTER(ExitCode(&exitCode));
@@ -2204,12 +2088,12 @@ int GuestProcessTool::TerminatedOk(LONG *pExitCode)
     return vrc;
 }
 
-int GuestProcessTool::Wait(uint32_t fFlags, int *pGuestRc)
+int GuestProcessTool::i_wait(uint32_t fFlags, int *pGuestRc)
 {
-    return WaitEx(fFlags, NULL /* pStrmBlkOut */, pGuestRc);
+    return i_waitEx(fFlags, NULL /* pStrmBlkOut */, pGuestRc);
 }
 
-int GuestProcessTool::WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkOut, int *pGuestRc)
+int GuestProcessTool::i_waitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkOut, int *pGuestRc)
 {
     LogFlowThisFunc(("fFlags=0x%x, pStreamBlock=%p, pGuestRc=%p\n",
                      fFlags, pStrmBlkOut, pGuestRc));
@@ -2219,7 +2103,7 @@ int GuestProcessTool::WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkO
     if (fFlags & GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK)
     {
         AssertPtr(pStrmBlkOut);
-        vrc = GetCurrentBlock(OUTPUT_HANDLE_ID_STDOUT, *pStrmBlkOut);
+        vrc = i_getCurrentBlock(OUTPUT_HANDLE_ID_STDOUT, *pStrmBlkOut);
         if (RT_SUCCESS(vrc))
             return vrc;
         /* else do the the waiting below. */
@@ -2271,8 +2155,8 @@ int GuestProcessTool::WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkO
         uint64_t u64ElapsedMS;
         UPDATE_AND_CHECK_ELAPSED_TIME();
 
-        vrc = pProcess->waitFor(fWaitFlags, GET_REMAINING_TIME,
-                                waitRes, &guestRc);
+        vrc = pProcess->i_waitFor(fWaitFlags, GET_REMAINING_TIME,
+                                  waitRes, &guestRc);
         if (RT_FAILURE(vrc))
             break;
 
@@ -2330,10 +2214,10 @@ int GuestProcessTool::WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkO
             UPDATE_AND_CHECK_ELAPSED_TIME();
 
             cbRead = 0;
-            vrc = pProcess->readData(OUTPUT_HANDLE_ID_STDOUT, sizeof(byBuf),
-                                     GET_REMAINING_TIME,
-                                     byBuf, sizeof(byBuf),
-                                     &cbRead, &guestRc);
+            vrc = pProcess->i_readData(OUTPUT_HANDLE_ID_STDOUT, sizeof(byBuf),
+                                       GET_REMAINING_TIME,
+                                       byBuf, sizeof(byBuf),
+                                       &cbRead, &guestRc);
             if (   RT_FAILURE(vrc)
                 || vrc == VWRN_GSTCTL_OBJECTSTATE_CHANGED)
                 break;
@@ -2347,7 +2231,7 @@ int GuestProcessTool::WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkO
                     && (fFlags & GUESTPROCESSTOOL_FLAG_STDOUT_BLOCK))
                 {
                     AssertPtr(pStrmBlkOut);
-                    vrc = GetCurrentBlock(OUTPUT_HANDLE_ID_STDOUT, *pStrmBlkOut);
+                    vrc = i_getCurrentBlock(OUTPUT_HANDLE_ID_STDOUT, *pStrmBlkOut);
 
                     /* When successful, break out of the loop because we're done
                      * with reading the first stream block. */
@@ -2364,10 +2248,10 @@ int GuestProcessTool::WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkO
             UPDATE_AND_CHECK_ELAPSED_TIME();
 
             cbRead = 0;
-            vrc = pProcess->readData(OUTPUT_HANDLE_ID_STDERR, sizeof(byBuf),
-                                     GET_REMAINING_TIME,
-                                     byBuf, sizeof(byBuf),
-                                     &cbRead, &guestRc);
+            vrc = pProcess->i_readData(OUTPUT_HANDLE_ID_STDERR, sizeof(byBuf),
+                                       GET_REMAINING_TIME,
+                                       byBuf, sizeof(byBuf),
+                                       &cbRead, &guestRc);
             if (   RT_FAILURE(vrc)
                 || vrc == VWRN_GSTCTL_OBJECTSTATE_CHANGED)
                 break;
@@ -2398,14 +2282,14 @@ int GuestProcessTool::WaitEx(uint32_t fFlags, GuestProcessStreamBlock *pStrmBlkO
     return vrc;
 }
 
-int GuestProcessTool::Terminate(uint32_t uTimeoutMS, int *pGuestRc)
+int GuestProcessTool::i_terminate(uint32_t uTimeoutMS, int *pGuestRc)
 {
     LogFlowThisFuncEnter();
 
     int rc = VINF_SUCCESS;
     if (!pProcess.isNull())
     {
-        rc = pProcess->terminateProcess(uTimeoutMS, pGuestRc);
+        rc = pProcess->i_terminateProcess(uTimeoutMS, pGuestRc);
         pProcess.setNull();
     }
     else
diff --git a/src/VBox/Main/src-client/GuestSessionImpl.cpp b/src/VBox/Main/src-client/GuestSessionImpl.cpp
index 63682f6..eb20355 100644
--- a/src/VBox/Main/src-client/GuestSessionImpl.cpp
+++ b/src/VBox/Main/src-client/GuestSessionImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,6 +20,9 @@
 *   Header Files                                                               *
 *******************************************************************************/
 #include "GuestImpl.h"
+#ifndef VBOX_WITH_GUEST_CONTROL
+# error "VBOX_WITH_GUEST_CONTROL must defined in this file"
+#endif
 #include "GuestSessionImpl.h"
 #include "GuestCtrlImplPrivate.h"
 #include "VirtualBoxErrorInfoImpl.h"
@@ -176,12 +179,11 @@ int GuestSession::init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo,
     AutoInitSpan autoInitSpan(this);
     AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
 
-#ifndef VBOX_WITH_GUEST_CONTROL
-    autoInitSpan.setSucceeded();
-    return VINF_SUCCESS;
-#else
     AssertPtrReturn(pGuest, VERR_INVALID_POINTER);
 
+    /*
+     * Initialize our data members from the input.
+     */
     mParent = pGuest;
 
     /* Copy over startup info. */
@@ -197,74 +199,69 @@ int GuestSession::init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo,
     mData.mCredentials.mPassword = guestCreds.mPassword;
     mData.mCredentials.mDomain = guestCreds.mDomain;
 
+    /* Initialize the remainder of the data. */
     mData.mRC = VINF_SUCCESS;
     mData.mStatus = GuestSessionStatus_Undefined;
     mData.mNumObjects = 0;
-
-    HRESULT hr;
-
-    int rc = queryInfo();
+    mData.mpBaseEnvironment = NULL;
+    int rc = mData.mEnvironmentChanges.initChangeRecord();
     if (RT_SUCCESS(rc))
     {
-        hr = unconst(mEventSource).createObject();
-        if (FAILED(hr))
-            rc = VERR_NO_MEMORY;
-        else
-        {
-            hr = mEventSource->init();
-            if (FAILED(hr))
-                rc = VERR_COM_UNEXPECTED;
-        }
+        rc = RTCritSectInit(&mWaitEventCritSect);
+        AssertRC(rc);
     }
-
+    if (RT_SUCCESS(rc))
+        rc = i_determineProtocolVersion();
     if (RT_SUCCESS(rc))
     {
-        try
+        /*
+         * <Replace this if you figure out what the code is doing.>
+         */
+        HRESULT hr = unconst(mEventSource).createObject();
+        if (SUCCEEDED(hr))
+            hr = mEventSource->init();
+        if (SUCCEEDED(hr))
         {
-            GuestSessionListener *pListener = new GuestSessionListener();
-            ComObjPtr<GuestSessionListenerImpl> thisListener;
-            hr = thisListener.createObject();
-            if (SUCCEEDED(hr))
-                hr = thisListener->init(pListener, this);
-
-            if (SUCCEEDED(hr))
+            try
             {
-                com::SafeArray <VBoxEventType_T> eventTypes;
-                eventTypes.push_back(VBoxEventType_OnGuestSessionStateChanged);
-                hr = mEventSource->RegisterListener(thisListener,
-                                                    ComSafeArrayAsInParam(eventTypes),
-                                                    TRUE /* Active listener */);
+                GuestSessionListener *pListener = new GuestSessionListener();
+                ComObjPtr<GuestSessionListenerImpl> thisListener;
+                hr = thisListener.createObject();
+                if (SUCCEEDED(hr))
+                    hr = thisListener->init(pListener, this);
                 if (SUCCEEDED(hr))
                 {
-                    mLocalListener = thisListener;
-
-                    rc = RTCritSectInit(&mWaitEventCritSect);
-                    AssertRC(rc);
+                    com::SafeArray <VBoxEventType_T> eventTypes;
+                    eventTypes.push_back(VBoxEventType_OnGuestSessionStateChanged);
+                    hr = mEventSource->RegisterListener(thisListener,
+                                                        ComSafeArrayAsInParam(eventTypes),
+                                                        TRUE /* Active listener */);
+                    if (SUCCEEDED(hr))
+                    {
+                        mLocalListener = thisListener;
+
+                        /*
+                         * Mark this object as operational and return success.
+                         */
+                        autoInitSpan.setSucceeded();
+                        LogFlowThisFunc(("mName=%s mID=%RU32 mIsInternal=%RTbool rc=VINF_SUCCESS\n",
+                                         mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal));
+                        return VINF_SUCCESS;
+                    }
                 }
-                else
-                    rc = VERR_COM_UNEXPECTED;
             }
-            else
-                rc = VERR_COM_UNEXPECTED;
-        }
-        catch(std::bad_alloc &)
-        {
-            rc = VERR_NO_MEMORY;
+            catch (std::bad_alloc &)
+            {
+                hr = E_OUTOFMEMORY;
+            }
         }
+        rc = Global::vboxStatusCodeFromCOM(hr);
     }
 
-    if (RT_SUCCESS(rc))
-    {
-        /* Confirm a successful initialization when it's the case. */
-        autoInitSpan.setSucceeded();
-    }
-    else
-        autoInitSpan.setFailed();
-
-    LogFlowThisFunc(("mName=%s, mID=%RU32, mIsInternal=%RTbool, rc=%Rrc\n",
-                     mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal, rc));
+    autoInitSpan.setFailed();
+    LogThisFunc(("Failed! mName=%s mID=%RU32 mIsInternal=%RTbool => rc=%Rrc\n",
+                 mData.mSession.mName.c_str(), mData.mSession.mID, mData.mSession.mIsInternal, rc));
     return rc;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
 /**
@@ -282,7 +279,6 @@ void GuestSession::uninit(void)
 
     int rc = VINF_SUCCESS;
 
-#ifdef VBOX_WITH_GUEST_CONTROL
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     LogFlowThisFunc(("Closing directories (%zu total)\n",
@@ -292,7 +288,7 @@ void GuestSession::uninit(void)
     {
         Assert(mData.mNumObjects);
         mData.mNumObjects--;
-        itDirs->second->onRemove();
+        itDirs->second->i_onRemove();
         itDirs->second->uninit();
     }
     mData.mDirectories.clear();
@@ -304,7 +300,7 @@ void GuestSession::uninit(void)
     {
         Assert(mData.mNumObjects);
         mData.mNumObjects--;
-        itFiles->second->onRemove();
+        itFiles->second->i_onRemove();
         itFiles->second->uninit();
     }
     mData.mFiles.clear();
@@ -316,337 +312,271 @@ void GuestSession::uninit(void)
     {
         Assert(mData.mNumObjects);
         mData.mNumObjects--;
-        itProcs->second->onRemove();
+        itProcs->second->i_onRemove();
         itProcs->second->uninit();
     }
     mData.mProcesses.clear();
 
+    mData.mEnvironmentChanges.reset();
+
+    if (mData.mpBaseEnvironment)
+    {
+        mData.mpBaseEnvironment->releaseConst();
+        mData.mpBaseEnvironment = NULL;
+    }
+
     AssertMsg(mData.mNumObjects == 0,
               ("mNumObjects=%RU32 when it should be 0\n", mData.mNumObjects));
 
     baseUninit();
-#endif /* VBOX_WITH_GUEST_CONTROL */
+
     LogFlowFuncLeaveRC(rc);
 }
 
 // implementation of public getters/setters for attributes
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP GuestSession::COMGETTER(User)(BSTR *aUser)
+HRESULT GuestSession::getUser(com::Utf8Str &aUser)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aUser);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mCredentials.mUser.cloneTo(aUser);
+    aUser = mData.mCredentials.mUser;
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Domain)(BSTR *aDomain)
+HRESULT GuestSession::getDomain(com::Utf8Str &aDomain)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aDomain);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mCredentials.mDomain.cloneTo(aDomain);
+    aDomain = mData.mCredentials.mDomain;
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Name)(BSTR *aName)
+HRESULT GuestSession::getName(com::Utf8Str &aName)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.mSession.mName.cloneTo(aName);
+    aName = mData.mSession.mName;
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Id)(ULONG *aId)
+HRESULT GuestSession::getId(ULONG *aId)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aId = mData.mSession.mID;
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Status)(GuestSessionStatus_T *aStatus)
+HRESULT GuestSession::getStatus(GuestSessionStatus_T *aStatus)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aStatus);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aStatus = mData.mStatus;
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Timeout)(ULONG *aTimeout)
+HRESULT GuestSession::getTimeout(ULONG *aTimeout)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aTimeout);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aTimeout = mData.mTimeout;
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMSETTER(Timeout)(ULONG aTimeout)
+HRESULT GuestSession::setTimeout(ULONG aTimeout)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     mData.mTimeout = aTimeout;
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(ProtocolVersion)(ULONG *aVersion)
+HRESULT GuestSession::getProtocolVersion(ULONG *aProtocolVersion)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aVersion);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aVersion = mData.mProtocolVersion;
+    *aProtocolVersion = mData.mProtocolVersion;
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Environment)(ComSafeArrayOut(BSTR, aEnvironment))
+HRESULT GuestSession::getEnvironmentChanges(std::vector<com::Utf8Str> &aEnvironmentChanges)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutSafeArrayPointerValid(aEnvironment);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    size_t cEnvVars = mData.mEnvironment.Size();
-    LogFlowThisFunc(("[%s]: cEnvVars=%RU32\n",
-                     mData.mSession.mName.c_str(), cEnvVars));
-    com::SafeArray<BSTR> environment(cEnvVars);
-
-    for (size_t i = 0; i < cEnvVars; i++)
-    {
-        Bstr strEnv(mData.mEnvironment.Get(i));
-        strEnv.cloneTo(&environment[i]);
-    }
-    environment.detachTo(ComSafeArrayOutArg(aEnvironment));
+    int vrc = mData.mEnvironmentChanges.queryPutEnvArray(&aEnvironmentChanges);
 
-    LogFlowThisFuncLeave();
-    return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    LogFlowFuncLeaveRC(vrc);
+    return Global::vboxStatusCodeToCOM(vrc);
 }
 
-STDMETHODIMP GuestSession::COMSETTER(Environment)(ComSafeArrayIn(IN_BSTR, aValues))
+HRESULT GuestSession::setEnvironmentChanges(const std::vector<com::Utf8Str> &aEnvironmentChanges)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<IN_BSTR> environment(ComSafeArrayInArg(aValues));
+    mData.mEnvironmentChanges.reset();
+    int vrc = mData.mEnvironmentChanges.applyPutEnvArray(aEnvironmentChanges);
 
-    int rc = VINF_SUCCESS;
-    for (size_t i = 0; i < environment.size() && RT_SUCCESS(rc); i++)
+    LogFlowFuncLeaveRC(vrc);
+    return Global::vboxStatusCodeToCOM(vrc);
+}
+
+HRESULT GuestSession::getEnvironmentBase(std::vector<com::Utf8Str> &aEnvironmentBase)
+{
+    LogFlowThisFuncEnter();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc;
+    if (mData.mpBaseEnvironment)
     {
-        Utf8Str strEnv(environment[i]);
-        if (!strEnv.isEmpty()) /* Silently skip empty entries. */
-            rc = mData.mEnvironment.Set(strEnv);
+        int vrc = mData.mpBaseEnvironment->queryPutEnvArray(&aEnvironmentBase);
+        hrc = Global::vboxStatusCodeToCOM(vrc);
     }
+    else if (mData.mProtocolVersion < 99999)
+        hrc = setError(VBOX_E_NOT_SUPPORTED, tr("The base environment feature is not supported by the guest additions"));
+    else
+        hrc = setError(VBOX_E_INVALID_OBJECT_STATE, tr("The base environment has not yet been reported by the guest"));
 
-    HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
-    LogFlowFuncLeaveRC(hr);
-    return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    LogFlowFuncLeave();
+    return hrc;
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Processes)(ComSafeArrayOut(IGuestProcess *, aProcesses))
+HRESULT GuestSession::getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutSafeArrayPointerValid(aProcesses);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IGuestProcess> collection(mData.mProcesses);
-    collection.detachTo(ComSafeArrayOutArg(aProcesses));
+    aProcesses.resize(mData.mProcesses.size());
+    size_t i = 0;
+    for(SessionProcesses::iterator it  = mData.mProcesses.begin();
+                                   it != mData.mProcesses.end();
+                                   ++it, ++i)
+    {
+        it->second.queryInterfaceTo(aProcesses[i].asOutParam());
+    }
 
-    LogFlowFunc(("mProcesses=%zu\n", collection.size()));
+    LogFlowFunc(("mProcesses=%zu\n", aProcesses.size()));
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Directories)(ComSafeArrayOut(IGuestDirectory *, aDirectories))
+HRESULT GuestSession::getPathStyle(PathStyle_T *aPathStyle)
+{
+    VBOXOSTYPE enmOsType = mParent->i_getGuestOSType();
+    if (    enmOsType < VBOXOSTYPE_DOS)
+    {
+        *aPathStyle = PathStyle_Unknown;
+        LogFlowFunc(("returns PathStyle_Unknown\n"));
+    }
+    else if (enmOsType < VBOXOSTYPE_Linux)
+    {
+        *aPathStyle = PathStyle_DOS;
+        LogFlowFunc(("returns PathStyle_DOS\n"));
+    }
+    else
+    {
+        *aPathStyle = PathStyle_UNIX;
+        LogFlowFunc(("returns PathStyle_UNIX\n"));
+    }
+    return S_OK;
+}
+
+HRESULT GuestSession::getCurrentDirectory(com::Utf8Str &aCurrentDirectory)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
+}
 
-    CheckComArgOutSafeArrayPointerValid(aDirectories);
+HRESULT GuestSession::setCurrentDirectory(const com::Utf8Str &aCurrentDirectory)
+{
+    ReturnComNotImplemented();
+}
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT GuestSession::getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories)
+{
+    LogFlowThisFuncEnter();
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IGuestDirectory> collection(mData.mDirectories);
-    collection.detachTo(ComSafeArrayOutArg(aDirectories));
+    aDirectories.resize(mData.mDirectories.size());
+    size_t i = 0;
+    for(SessionDirectories::iterator it  = mData.mDirectories.begin();
+                                     it != mData.mDirectories.end();
+                                     ++it, ++i)
+    {
+        it->second.queryInterfaceTo(aDirectories[i].asOutParam());
+    }
 
-    LogFlowFunc(("mDirectories=%zu\n", collection.size()));
+    LogFlowFunc(("mDirectories=%zu\n", aDirectories.size()));
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(Files)(ComSafeArrayOut(IGuestFile *, aFiles))
+HRESULT GuestSession::getFiles(std::vector<ComPtr<IGuestFile> > &aFiles)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutSafeArrayPointerValid(aFiles);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IGuestFile> collection(mData.mFiles);
-    collection.detachTo(ComSafeArrayOutArg(aFiles));
+    aFiles.resize(mData.mFiles.size());
+    size_t i = 0;
+    for(SessionFiles::iterator it = mData.mFiles.begin(); it != mData.mFiles.end(); ++it, ++i)
+        it->second.queryInterfaceTo(aFiles[i].asOutParam());
+
+    LogFlowFunc(("mDirectories=%zu\n", aFiles.size()));
 
-    LogFlowFunc(("mFiles=%zu\n", collection.size()));
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::COMGETTER(EventSource)(IEventSource ** aEventSource)
+HRESULT GuestSession::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // no need to lock - lifetime constant
-    mEventSource.queryInterfaceTo(aEventSource);
+    mEventSource.queryInterfaceTo(aEventSource.asOutParam());
 
     LogFlowThisFuncLeave();
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
 // private methods
 ///////////////////////////////////////////////////////////////////////////////
 
-int GuestSession::closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc)
+int GuestSession::i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc)
 {
     LogFlowThisFunc(("uFlags=%x, uTimeoutMS=%RU32\n", uFlags, uTimeoutMS));
 
@@ -698,9 +628,9 @@ int GuestSession::closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuest
 
     alock.release(); /* Drop the write lock before waiting. */
 
-    vrc = sendCommand(HOST_SESSION_CLOSE, i, paParms);
+    vrc = i_sendCommand(HOST_SESSION_CLOSE, i, paParms);
     if (RT_SUCCESS(vrc))
-        vrc = waitForStatusChange(pEvent, GuestSessionWaitForFlag_Terminate, uTimeoutMS,
+        vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Terminate, uTimeoutMS,
                                   NULL /* Session status */, pGuestRc);
 
     unregisterWaitEvent(pEvent);
@@ -709,7 +639,7 @@ int GuestSession::closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuest
     return vrc;
 }
 
-int GuestSession::directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode,
+int GuestSession::i_directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode,
                                           uint32_t uFlags, int *pGuestRc)
 {
     LogFlowThisFunc(("strPath=%s, uMode=%x, uFlags=%x\n",
@@ -718,8 +648,8 @@ int GuestSession::directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode
     int vrc = VINF_SUCCESS;
 
     GuestProcessStartupInfo procInfo;
-    procInfo.mCommand = Utf8Str(VBOXSERVICE_TOOL_MKDIR);
-    procInfo.mFlags   = ProcessCreateFlag_Hidden;
+    procInfo.mExecutable = Utf8Str(VBOXSERVICE_TOOL_MKDIR);
+    procInfo.mFlags      = ProcessCreateFlag_Hidden;
 
     try
     {
@@ -744,6 +674,7 @@ int GuestSession::directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode
             else
                 vrc = VERR_BUFFER_OVERFLOW;
         }
+        procInfo.mArguments.push_back("--"); /* '--version' is a valid directory name. */
         procInfo.mArguments.push_back(strPath); /* The directory we want to create. */
     }
     catch (std::bad_alloc)
@@ -752,13 +683,13 @@ int GuestSession::directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode
     }
 
     if (RT_SUCCESS(vrc))
-        vrc = GuestProcessTool::Run(this, procInfo, pGuestRc);
+        vrc = GuestProcessTool::i_run(this, procInfo, pGuestRc);
 
     LogFlowFuncLeaveRC(vrc);
     return vrc;
 }
 
-inline bool GuestSession::directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir)
+inline bool GuestSession::i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir)
 {
     SessionDirectories::const_iterator it = mData.mDirectories.find(uDirID);
     if (it != mData.mDirectories.end())
@@ -770,11 +701,12 @@ inline bool GuestSession::directoryExists(uint32_t uDirID, ComObjPtr<GuestDirect
     return false;
 }
 
-int GuestSession::directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc)
+int GuestSession::i_directoryQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks,
+                                               GuestFsObjData &objData, int *pGuestRc)
 {
-    LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
+    LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks));
 
-    int vrc = fsQueryInfoInternal(strPath, objData, pGuestRc);
+    int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc);
     if (RT_SUCCESS(vrc))
     {
         vrc = objData.mType == FsObjType_Directory
@@ -785,7 +717,7 @@ int GuestSession::directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjD
     return vrc;
 }
 
-int GuestSession::directoryRemoveFromList(GuestDirectory *pDirectory)
+int GuestSession::i_directoryRemoveFromList(GuestDirectory *pDirectory)
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -809,7 +741,7 @@ int GuestSession::directoryRemoveFromList(GuestDirectory *pDirectory)
             LogFlowFunc(("Removing directory \"%s\" (Session: %RU32) (now total %zu processes, %RU32 objects)\n",
                          Utf8Str(strName).c_str(), mData.mSession.mID, mData.mDirectories.size() - 1, mData.mNumObjects - 1));
 
-            rc = pDirectory->onRemove();
+            rc = pDirectory->i_onRemove();
             mData.mDirectories.erase(itDirs);
             mData.mNumObjects--;
 
@@ -824,8 +756,8 @@ int GuestSession::directoryRemoveFromList(GuestDirectory *pDirectory)
     return rc;
 }
 
-int GuestSession::directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags,
-                                          int *pGuestRc)
+int GuestSession::i_directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags,
+                                            int *pGuestRc)
 {
     AssertReturn(!(uFlags & ~DIRREMOVE_FLAG_VALID_MASK), VERR_INVALID_PARAMETER);
 
@@ -849,7 +781,7 @@ int GuestSession::directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlag
 
     alock.release(); /* Drop write lock before sending. */
 
-    vrc = sendCommand(HOST_DIR_REMOVE, i, paParms);
+    vrc = i_sendCommand(HOST_DIR_REMOVE, i, paParms);
     if (RT_SUCCESS(vrc))
     {
         vrc = pEvent->Wait(30 * 1000);
@@ -864,8 +796,8 @@ int GuestSession::directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlag
     return vrc;
 }
 
-int GuestSession::objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath,
-                                           bool fDirectory, Utf8Str &strName, int *pGuestRc)
+int GuestSession::i_objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath,
+                                             bool fDirectory, Utf8Str &strName, int *pGuestRc)
 {
     LogFlowThisFunc(("strTemplate=%s, strPath=%s, fDirectory=%RTbool\n",
                      strTemplate.c_str(), strPath.c_str(), fDirectory));
@@ -873,8 +805,8 @@ int GuestSession::objectCreateTempInternal(const Utf8Str &strTemplate, const Utf
     int vrc = VINF_SUCCESS;
 
     GuestProcessStartupInfo procInfo;
-    procInfo.mCommand = Utf8Str(VBOXSERVICE_TOOL_MKTEMP);
-    procInfo.mFlags   = ProcessCreateFlag_WaitForStdOut;
+    procInfo.mExecutable = Utf8Str(VBOXSERVICE_TOOL_MKTEMP);
+    procInfo.mFlags      = ProcessCreateFlag_WaitForStdOut;
 
     try
     {
@@ -886,6 +818,7 @@ int GuestSession::objectCreateTempInternal(const Utf8Str &strTemplate, const Utf
             procInfo.mArguments.push_back(Utf8Str("-t"));
             procInfo.mArguments.push_back(strPath);
         }
+        procInfo.mArguments.push_back("--"); /* strTemplate could be '--help'. */
         procInfo.mArguments.push_back(strTemplate);
     }
     catch (std::bad_alloc)
@@ -897,9 +830,9 @@ int GuestSession::objectCreateTempInternal(const Utf8Str &strTemplate, const Utf
      *        we now can run in a user-dedicated session. */
     int guestRc; GuestCtrlStreamObjects stdOut;
     if (RT_SUCCESS(vrc))
-        vrc = GuestProcessTool::RunEx(this, procInfo,
-                                      &stdOut, 1 /* cStrmOutObjects */,
-                                      &guestRc);
+        vrc = GuestProcessTool::i_runEx(this, procInfo,
+                                        &stdOut, 1 /* cStrmOutObjects */,
+                                        &guestRc);
     if (   RT_SUCCESS(vrc)
         && RT_SUCCESS(guestRc))
     {
@@ -927,8 +860,8 @@ int GuestSession::objectCreateTempInternal(const Utf8Str &strTemplate, const Utf
     return vrc;
 }
 
-int GuestSession::directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
-                                        ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc)
+int GuestSession::i_directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
+                                          ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc)
 {
     LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n",
                      openInfo.mPath.c_str(), openInfo.mFilter.c_str(), openInfo.mFlags));
@@ -946,7 +879,7 @@ int GuestSession::directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
     for (;;)
     {
         /* Is the directory ID already used? */
-        if (!directoryExists(uNewDirID, NULL /* pDirectory */))
+        if (!i_directoryExists(uNewDirID, NULL /* pDirectory */))
         {
             /* Callback with context ID was not found. This means
              * we can use this context ID for our new callback we want
@@ -970,7 +903,7 @@ int GuestSession::directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
     if (FAILED(hr))
         return VERR_COM_UNEXPECTED;
 
-    Console *pConsole = mParent->getConsole();
+    Console *pConsole = mParent->i_getConsole();
     AssertPtr(pConsole);
 
     int vrc = pDirectory->init(pConsole, this /* Parent */,
@@ -1015,7 +948,7 @@ int GuestSession::directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
     return vrc;
 }
 
-int GuestSession::dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int GuestSession::i_dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     LogFlowFunc(("pCtxCb=%p, pSvcCb=%p\n", pCtxCb, pSvcCb));
 
@@ -1042,7 +975,7 @@ int GuestSession::dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUEST
 
         alock.release();
 
-        rc = pDirectory->callbackDispatcher(pCtxCb, pSvcCb);
+        rc = pDirectory->i_callbackDispatcher(pCtxCb, pSvcCb);
     }
     else
         rc = VERR_NOT_FOUND;
@@ -1051,7 +984,7 @@ int GuestSession::dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUEST
     return rc;
 }
 
-int GuestSession::dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int GuestSession::i_dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     LogFlowFunc(("pCtxCb=%p, pSvcCb=%p\n", pCtxCb, pSvcCb));
 
@@ -1075,7 +1008,7 @@ int GuestSession::dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLH
 
         alock.release();
 
-        rc = pFile->callbackDispatcher(pCtxCb, pSvcCb);
+        rc = pFile->i_callbackDispatcher(pCtxCb, pSvcCb);
     }
     else
         rc = VERR_NOT_FOUND;
@@ -1084,7 +1017,7 @@ int GuestSession::dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLH
     return rc;
 }
 
-int GuestSession::dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int GuestSession::i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     LogFlowFunc(("pCtxCb=%p, pSvcCb=%p\n", pCtxCb, pSvcCb));
 
@@ -1107,7 +1040,7 @@ int GuestSession::dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTR
         {
             alock.release();
 
-            rc = dispatchToFile(pCtxCb, pSvcCb);
+            rc = i_dispatchToFile(pCtxCb, pSvcCb);
         }
         else
         {
@@ -1116,7 +1049,7 @@ int GuestSession::dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTR
             {
                 alock.release();
 
-                rc = dispatchToDirectory(pCtxCb, pSvcCb);
+                rc = i_dispatchToDirectory(pCtxCb, pSvcCb);
             }
             else
                 rc = VERR_NOT_FOUND;
@@ -1126,14 +1059,14 @@ int GuestSession::dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTR
     {
         alock.release();
 
-        rc = dispatchToProcess(pCtxCb, pSvcCb);
+        rc = i_dispatchToProcess(pCtxCb, pSvcCb);
     }
 
     LogFlowFuncLeaveRC(rc);
     return rc;
 }
 
-int GuestSession::dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int GuestSession::i_dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     LogFlowFunc(("pCtxCb=%p, pSvcCb=%p\n", pCtxCb, pSvcCb));
 
@@ -1166,7 +1099,7 @@ int GuestSession::dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCT
         pCtxCb->uProtocol = mData.mProtocolVersion;
 
         alock.release();
-        rc = pProcess->callbackDispatcher(pCtxCb, pSvcCb);
+        rc = pProcess->i_callbackDispatcher(pCtxCb, pSvcCb);
     }
     else
         rc = VERR_NOT_FOUND;
@@ -1175,7 +1108,7 @@ int GuestSession::dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCT
     return rc;
 }
 
-int GuestSession::dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
+int GuestSession::i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     AssertPtrReturn(pSvcCb, VERR_INVALID_POINTER);
@@ -1197,7 +1130,7 @@ int GuestSession::dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLH
 
         case GUEST_SESSION_NOTIFY: /* Guest Additions >= 4.3.0. */
         {
-            rc = onSessionStatusChange(pCbCtx, pSvcCb);
+            rc = i_onSessionStatusChange(pCbCtx, pSvcCb);
             break;
         }
 
@@ -1211,7 +1144,7 @@ int GuestSession::dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLH
     return rc;
 }
 
-inline bool GuestSession::fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile)
+inline bool GuestSession::i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile)
 {
     SessionFiles::const_iterator it = mData.mFiles.find(uFileID);
     if (it != mData.mFiles.end())
@@ -1223,7 +1156,7 @@ inline bool GuestSession::fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFi
     return false;
 }
 
-int GuestSession::fileRemoveFromList(GuestFile *pFile)
+int GuestSession::i_fileRemoveFromList(GuestFile *pFile)
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -1246,7 +1179,7 @@ int GuestSession::fileRemoveFromList(GuestFile *pFile)
             LogFlowThisFunc(("Removing guest file \"%s\" (Session: %RU32) (now total %zu files, %RU32 objects)\n",
                              Utf8Str(strName).c_str(), mData.mSession.mID, mData.mFiles.size() - 1, mData.mNumObjects - 1));
 
-            rc = pFile->onRemove();
+            rc = pFile->i_onRemove();
             mData.mFiles.erase(itFiles);
             mData.mNumObjects--;
 
@@ -1265,7 +1198,7 @@ int GuestSession::fileRemoveFromList(GuestFile *pFile)
     return rc;
 }
 
-int GuestSession::fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc)
+int GuestSession::i_fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc)
 {
     LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
 
@@ -1274,12 +1207,13 @@ int GuestSession::fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc)
     GuestProcessStartupInfo procInfo;
     GuestProcessStream      streamOut;
 
-    procInfo.mCommand = Utf8Str(VBOXSERVICE_TOOL_RM);
-    procInfo.mFlags   = ProcessCreateFlag_WaitForStdOut;
+    procInfo.mExecutable = Utf8Str(VBOXSERVICE_TOOL_RM);
+    procInfo.mFlags      = ProcessCreateFlag_WaitForStdOut;
 
     try
     {
         procInfo.mArguments.push_back(Utf8Str("--machinereadable"));
+        procInfo.mArguments.push_back("--"); /* strPath could be '--help', which is a valid filename. */
         procInfo.mArguments.push_back(strPath); /* The file we want to remove. */
     }
     catch (std::bad_alloc)
@@ -1288,18 +1222,18 @@ int GuestSession::fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc)
     }
 
     if (RT_SUCCESS(vrc))
-        vrc = GuestProcessTool::Run(this, procInfo, pGuestRc);
+        vrc = GuestProcessTool::i_run(this, procInfo, pGuestRc);
 
     LogFlowFuncLeaveRC(vrc);
     return vrc;
 }
 
-int GuestSession::fileOpenInternal(const GuestFileOpenInfo &openInfo,
-                                   ComObjPtr<GuestFile> &pFile, int *pGuestRc)
+int GuestSession::i_fileOpenInternal(const GuestFileOpenInfo &openInfo,
+                                     ComObjPtr<GuestFile> &pFile, int *pGuestRc)
 {
-    LogFlowThisFunc(("strPath=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%x, uOffset=%RU64\n",
-                     openInfo.mFileName.c_str(), openInfo.mOpenMode.c_str(), openInfo.mDisposition.c_str(),
-                     openInfo.mCreationMode, openInfo.mInitialOffset));
+    LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32 mfOpenEx=%RU32\n",
+                     openInfo.mFileName.c_str(), openInfo.mAccessMode, openInfo.mpszAccessMode,
+                     openInfo.mOpenAction, openInfo.mpszOpenAction, openInfo.mCreationMode, openInfo.mfOpenEx));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -1322,7 +1256,7 @@ int GuestSession::fileOpenInternal(const GuestFileOpenInfo &openInfo,
     for (;;)
     {
         /* Is the file ID already used? */
-        if (!fileExists(uNewFileID, NULL /* pFile */))
+        if (!i_fileExists(uNewFileID, NULL /* pFile */))
         {
             /* Callback with context ID was not found. This means
              * we can use this context ID for our new callback we want
@@ -1346,7 +1280,7 @@ int GuestSession::fileOpenInternal(const GuestFileOpenInfo &openInfo,
     if (FAILED(hr))
         return VERR_COM_UNEXPECTED;
 
-    Console *pConsole = mParent->getConsole();
+    Console *pConsole = mParent->i_getConsole();
     AssertPtr(pConsole);
 
     rc = pFile->init(pConsole, this /* GuestSession */,
@@ -1384,7 +1318,7 @@ int GuestSession::fileOpenInternal(const GuestFileOpenInfo &openInfo,
     if (RT_SUCCESS(rc))
     {
         int guestRc;
-        rc = pFile->openFile(30 * 1000 /* 30s timeout */, &guestRc);
+        rc = pFile->i_openFile(30 * 1000 /* 30s timeout */, &guestRc);
         if (   rc == VERR_GSTCTL_GUEST_ERROR
             && pGuestRc)
         {
@@ -1396,11 +1330,11 @@ int GuestSession::fileOpenInternal(const GuestFileOpenInfo &openInfo,
     return rc;
 }
 
-int GuestSession::fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc)
+int GuestSession::i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc)
 {
-    LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
+    LogFlowThisFunc(("strPath=%s fFollowSymlinks=%RTbool\n", strPath.c_str(), fFollowSymlinks));
 
-    int vrc = fsQueryInfoInternal(strPath, objData, pGuestRc);
+    int vrc = i_fsQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc);
     if (RT_SUCCESS(vrc))
     {
         vrc = objData.mType == FsObjType_File
@@ -1411,19 +1345,28 @@ int GuestSession::fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &
     return vrc;
 }
 
-int GuestSession::fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc)
+int GuestSession::i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc)
 {
     AssertPtrReturn(pllSize, VERR_INVALID_POINTER);
 
     GuestFsObjData objData;
-    int vrc = fileQueryInfoInternal(strPath, objData, pGuestRc);
+    int vrc = i_fileQueryInfoInternal(strPath, fFollowSymlinks, objData, pGuestRc);
     if (RT_SUCCESS(vrc))
         *pllSize = objData.mObjectSize;
 
     return vrc;
 }
 
-int GuestSession::fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc)
+/**
+ * <Someone write documentation, pretty please!>
+ *
+ * @param   pGuestRc        Optional.  Will be set to VINF_SUCCESS,
+ *                          VERR_NOT_EQUAL or VERR_INVALID_STATE if the
+ *                          process completed.  May probably be set to a lot of
+ *                          other things.  Not sure if these things are related
+ *                          to the process we ran or what, really.  :-(
+ */
+int GuestSession::i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc)
 {
     LogFlowThisFunc(("strPath=%s\n", strPath.c_str()));
 
@@ -1431,13 +1374,16 @@ int GuestSession::fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &ob
 
     /** @todo Merge this with IGuestFile::queryInfo(). */
     GuestProcessStartupInfo procInfo;
-    procInfo.mCommand = Utf8Str(VBOXSERVICE_TOOL_STAT);
-    procInfo.mFlags   = ProcessCreateFlag_WaitForStdOut;
+    procInfo.mExecutable = Utf8Str(VBOXSERVICE_TOOL_STAT);
+    procInfo.mFlags      = ProcessCreateFlag_WaitForStdOut;
 
     try
     {
         /* Construct arguments. */
         procInfo.mArguments.push_back(Utf8Str("--machinereadable"));
+        if (fFollowSymlinks)
+            procInfo.mArguments.push_back(Utf8Str("-L"));
+        procInfo.mArguments.push_back("--"); /* strPath could be '--help', which is a valid filename. */
         procInfo.mArguments.push_back(strPath);
     }
     catch (std::bad_alloc)
@@ -1445,11 +1391,12 @@ int GuestSession::fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &ob
         vrc = VERR_NO_MEMORY;
     }
 
-    int guestRc; GuestCtrlStreamObjects stdOut;
+    int guestRc;
+    GuestCtrlStreamObjects stdOut;
     if (RT_SUCCESS(vrc))
-        vrc = GuestProcessTool::RunEx(this, procInfo,
-                                      &stdOut, 1 /* cStrmOutObjects */,
-                                      &guestRc);
+        vrc = GuestProcessTool::i_runEx(this, procInfo,
+                                        &stdOut, 1 /* cStrmOutObjects */,
+                                        &guestRc);
     if (   RT_SUCCESS(vrc)
         && RT_SUCCESS(guestRc))
     {
@@ -1468,23 +1415,18 @@ int GuestSession::fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &ob
     return vrc;
 }
 
-const GuestCredentials& GuestSession::getCredentials(void)
+const GuestCredentials& GuestSession::i_getCredentials(void)
 {
     return mData.mCredentials;
 }
 
-const GuestEnvironment& GuestSession::getEnvironment(void)
-{
-    return mData.mEnvironment;
-}
-
-Utf8Str GuestSession::getName(void)
+Utf8Str GuestSession::i_getName(void)
 {
     return mData.mSession.mName;
 }
 
 /* static */
-Utf8Str GuestSession::guestErrorToString(int guestRc)
+Utf8Str GuestSession::i_guestErrorToString(int guestRc)
 {
     Utf8Str strError;
 
@@ -1541,7 +1483,7 @@ Utf8Str GuestSession::guestErrorToString(int guestRc)
  * Only used by official API methods. Will set an external
  * error when not ready.
  */
-HRESULT GuestSession::isReadyExternal(void)
+HRESULT GuestSession::i_isReadyExternal(void)
 {
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -1556,7 +1498,7 @@ HRESULT GuestSession::isReadyExternal(void)
  * Called by IGuest right before this session gets removed from
  * the public session list.
  */
-int GuestSession::onRemove(void)
+int GuestSession::i_onRemove(void)
 {
     LogFlowThisFuncEnter();
 
@@ -1581,7 +1523,7 @@ int GuestSession::onRemove(void)
 }
 
 /** No locking! */
-int GuestSession::onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
+int GuestSession::i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData)
 {
     AssertPtrReturn(pCbCtx, VERR_INVALID_POINTER);
     /* pCallback is optional. */
@@ -1611,6 +1553,25 @@ int GuestSession::onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUE
 
         case GUEST_SESSION_NOTIFYTYPE_STARTED:
             sessionStatus = GuestSessionStatus_Started;
+#if 0 /** @todo If we get some environment stuff along with this kind notification: */
+            const char *pszzEnvBlock = ...;
+            uint32_t    cbEnvBlock   = ...;
+            if (!mData.mpBaseEnvironment)
+            {
+                GuestEnvironment *pBaseEnv;
+                try { pBaseEnv = new GuestEnvironment(); } catch (std::bad_alloc &) { pBaseEnv = NULL; }
+                if (pBaseEnv)
+                {
+                    int vrc = pBaseEnv->initNormal();
+                    if (RT_SUCCESS(vrc))
+                        vrc = pBaseEnv->copyUtf8Block(pszzEnvBlock, cbEnvBlock);
+                    if (RT_SUCCESS(vrc))
+                        mData.mpBaseEnvironment = pBaseEnv;
+                    else
+                        pBaseEnv->release();
+                }
+            }
+#endif
             break;
 
         case GUEST_SESSION_NOTIFYTYPE_TEN:
@@ -1645,7 +1606,7 @@ int GuestSession::onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUE
 
     /* Set the session status. */
     if (RT_SUCCESS(vrc))
-        vrc = setSessionStatus(sessionStatus, guestRc);
+        vrc = i_setSessionStatus(sessionStatus, guestRc);
 
     LogFlowThisFunc(("ID=%RU32, guestRc=%Rrc\n", mData.mSession.mID, guestRc));
 
@@ -1653,7 +1614,7 @@ int GuestSession::onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUE
     return vrc;
 }
 
-int GuestSession::startSessionInternal(int *pGuestRc)
+int GuestSession::i_startSessionInternal(int *pGuestRc)
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -1714,12 +1675,12 @@ int GuestSession::startSessionInternal(int *pGuestRc)
 
     alock.release(); /* Drop write lock before sending. */
 
-    vrc = sendCommand(HOST_SESSION_CREATE, i, paParms);
+    vrc = i_sendCommand(HOST_SESSION_CREATE, i, paParms);
     if (RT_SUCCESS(vrc))
     {
-        vrc = waitForStatusChange(pEvent, GuestSessionWaitForFlag_Start,
-                                  30 * 1000 /* 30s timeout */,
-                                  NULL /* Session status */, pGuestRc);
+        vrc = i_waitForStatusChange(pEvent, GuestSessionWaitForFlag_Start,
+                                    30 * 1000 /* 30s timeout */,
+                                    NULL /* Session status */, pGuestRc);
     }
     else
     {
@@ -1739,7 +1700,7 @@ int GuestSession::startSessionInternal(int *pGuestRc)
     return vrc;
 }
 
-int GuestSession::startSessionAsync(void)
+int GuestSession::i_startSessionAsync(void)
 {
     LogFlowThisFuncEnter();
 
@@ -1752,7 +1713,7 @@ int GuestSession::startSessionAsync(void)
         std::auto_ptr<GuestSessionTaskInternalOpen> pTask(new GuestSessionTaskInternalOpen(this));
         AssertReturn(pTask->isOk(), pTask->rc());
 
-        vrc = RTThreadCreate(NULL, GuestSession::startSessionThread,
+        vrc = RTThreadCreate(NULL, GuestSession::i_startSessionThread,
                              (void *)pTask.get(), 0,
                              RTTHREADTYPE_MAIN_WORKER, 0,
                              "gctlSesStart");
@@ -1772,7 +1733,7 @@ int GuestSession::startSessionAsync(void)
 }
 
 /* static */
-DECLCALLBACK(int) GuestSession::startSessionThread(RTTHREAD Thread, void *pvUser)
+DECLCALLBACK(int) GuestSession::i_startSessionThread(RTTHREAD Thread, void *pvUser)
 {
     LogFlowFunc(("pvUser=%p\n", pvUser));
 
@@ -1785,14 +1746,14 @@ DECLCALLBACK(int) GuestSession::startSessionThread(RTTHREAD Thread, void *pvUser
     AutoCaller autoCaller(pSession);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    int vrc = pSession->startSessionInternal(NULL /* Guest rc, ignored */);
+    int vrc = pSession->i_startSessionInternal(NULL /* Guest rc, ignored */);
     /* Nothing to do here anymore. */
 
     LogFlowFuncLeaveRC(vrc);
     return vrc;
 }
 
-int GuestSession::pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest,
+int GuestSession::i_pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest,
                                      uint32_t uFlags, int *pGuestRc)
 {
     AssertReturn(!(uFlags & ~PATHRENAME_FLAG_VALID_MASK), VERR_INVALID_PARAMETER);
@@ -1820,7 +1781,7 @@ int GuestSession::pathRenameInternal(const Utf8Str &strSource, const Utf8Str &st
 
     alock.release(); /* Drop write lock before sending. */
 
-    vrc = sendCommand(HOST_PATH_RENAME, i, paParms);
+    vrc = i_sendCommand(HOST_PATH_RENAME, i, paParms);
     if (RT_SUCCESS(vrc))
     {
         vrc = pEvent->Wait(30 * 1000);
@@ -1835,7 +1796,7 @@ int GuestSession::pathRenameInternal(const Utf8Str &strSource, const Utf8Str &st
     return vrc;
 }
 
-int GuestSession::processRemoveFromList(GuestProcess *pProcess)
+int GuestSession::i_processRemoveFromList(GuestProcess *pProcess)
 {
     AssertPtrReturn(pProcess, VERR_INVALID_POINTER);
 
@@ -1874,7 +1835,7 @@ int GuestSession::processRemoveFromList(GuestProcess *pProcess)
             LogFlowFunc(("Removing process ID=%RU32 (Session: %RU32), guest PID=%RU32 (now total %zu processes, %RU32 objects)\n",
                          pProcess->getObjectID(), mData.mSession.mID, uPID, mData.mProcesses.size() - 1, mData.mNumObjects - 1));
 
-            rc = pProcess->onRemove();
+            rc = pProcess->i_onRemove();
             mData.mProcesses.erase(itProcs);
             mData.mNumObjects--;
 
@@ -1894,17 +1855,19 @@ int GuestSession::processRemoveFromList(GuestProcess *pProcess)
 }
 
 /**
- * Creates but does *not* start the process yet. See GuestProcess::startProcess() or
- * GuestProcess::startProcessAsync() for that.
+ * Creates but does *not* start the process yet.
+ *
+ * See GuestProcess::startProcess() or GuestProcess::startProcessAsync() for
+ * starting the process.
  *
  * @return  IPRT status code.
  * @param   procInfo
  * @param   pProcess
  */
-int GuestSession::processCreateExInteral(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProcess)
+int GuestSession::i_processCreateExInternal(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProcess)
 {
-    LogFlowFunc(("mCmd=%s, mFlags=%x, mTimeoutMS=%RU32\n",
-                 procInfo.mCommand.c_str(), procInfo.mFlags, procInfo.mTimeoutMS));
+    LogFlowFunc(("mExe=%s, mFlags=%x, mTimeoutMS=%RU32\n",
+                 procInfo.mExecutable.c_str(), procInfo.mFlags, procInfo.mTimeoutMS));
 #ifdef DEBUG
     if (procInfo.mArguments.size())
     {
@@ -1913,7 +1876,7 @@ int GuestSession::processCreateExInteral(GuestProcessStartupInfo &procInfo, ComO
         while (it != procInfo.mArguments.end())
         {
             LogFlow((" %s", (*it).c_str()));
-            it++;
+            ++it;
         }
         LogFlow(("\n"));
     }
@@ -1962,7 +1925,7 @@ int GuestSession::processCreateExInteral(GuestProcessStartupInfo &procInfo, ComO
     for (;;)
     {
         /* Is the context ID already used? */
-        if (!processExists(uNewProcessID, NULL /* pProcess */))
+        if (!i_processExists(uNewProcessID, NULL /* pProcess */))
         {
             /* Callback with context ID was not found. This means
              * we can use this context ID for our new callback we want
@@ -1986,8 +1949,8 @@ int GuestSession::processCreateExInteral(GuestProcessStartupInfo &procInfo, ComO
     if (FAILED(hr))
         return VERR_COM_UNEXPECTED;
 
-    rc = pProcess->init(mParent->getConsole() /* Console */, this /* Session */,
-                        uNewProcessID, procInfo);
+    rc = pProcess->init(mParent->i_getConsole() /* Console */, this /* Session */,
+                        uNewProcessID, procInfo, mData.mpBaseEnvironment);
     if (RT_FAILURE(rc))
         return rc;
 
@@ -2014,7 +1977,7 @@ int GuestSession::processCreateExInteral(GuestProcessStartupInfo &procInfo, ComO
     return rc;
 }
 
-inline bool GuestSession::processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess)
+inline bool GuestSession::i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess)
 {
     SessionProcesses::const_iterator it = mData.mProcesses.find(uProcessID);
     if (it != mData.mProcesses.end())
@@ -2026,7 +1989,7 @@ inline bool GuestSession::processExists(uint32_t uProcessID, ComObjPtr<GuestProc
     return false;
 }
 
-inline int GuestSession::processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess)
+inline int GuestSession::i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess)
 {
     AssertReturn(uPID, false);
     /* pProcess is optional. */
@@ -2054,17 +2017,17 @@ inline int GuestSession::processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pP
     return VERR_NOT_FOUND;
 }
 
-int GuestSession::sendCommand(uint32_t uFunction,
-                              uint32_t uParms, PVBOXHGCMSVCPARM paParms)
+int GuestSession::i_sendCommand(uint32_t uFunction,
+                                uint32_t uParms, PVBOXHGCMSVCPARM paParms)
 {
     LogFlowThisFuncEnter();
 
 #ifndef VBOX_GUESTCTRL_TEST_CASE
-    ComObjPtr<Console> pConsole = mParent->getConsole();
+    ComObjPtr<Console> pConsole = mParent->i_getConsole();
     Assert(!pConsole.isNull());
 
     /* Forward the information to the VMM device. */
-    VMMDev *pVMMDev = pConsole->getVMMDev();
+    VMMDev *pVMMDev = pConsole->i_getVMMDev();
     AssertPtr(pVMMDev);
 
     LogFlowThisFunc(("uFunction=%RU32, uParms=%RU32\n", uFunction, uParms));
@@ -2082,16 +2045,16 @@ int GuestSession::sendCommand(uint32_t uFunction,
 }
 
 /* static */
-HRESULT GuestSession::setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
+HRESULT GuestSession::i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc)
 {
     AssertPtr(pInterface);
     AssertMsg(RT_FAILURE(guestRc), ("Guest rc does not indicate a failure when setting error\n"));
 
-    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestSession::guestErrorToString(guestRc).c_str());
+    return pInterface->setError(VBOX_E_IPRT_ERROR, GuestSession::i_guestErrorToString(guestRc).c_str());
 }
 
 /* Does not do locking; caller is responsible for that! */
-int GuestSession::setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc)
+int GuestSession::i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc)
 {
     LogFlowThisFunc(("oldStatus=%RU32, newStatus=%RU32, sessionRc=%Rrc\n",
                      mData.mStatus, sessionStatus, sessionRc));
@@ -2116,7 +2079,7 @@ int GuestSession::setSessionStatus(GuestSessionStatus_T sessionStatus, int sessi
         ComAssertComRC(hr);
         int rc2 = errorInfo->initEx(VBOX_E_IPRT_ERROR, sessionRc,
                                     COM_IIDOF(IGuestSession), getComponentName(),
-                                    guestErrorToString(sessionRc));
+                                    i_guestErrorToString(sessionRc));
         AssertRC(rc2);
 
         fireGuestSessionStateChangedEvent(mEventSource, this,
@@ -2126,7 +2089,7 @@ int GuestSession::setSessionStatus(GuestSessionStatus_T sessionStatus, int sessi
     return VINF_SUCCESS;
 }
 
-int GuestSession::signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */)
+int GuestSession::i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */)
 {
     /*LogFlowThisFunc(("enmWaitResult=%d, rc=%Rrc, mWaitCount=%RU32, mWaitEvent=%p\n",
                      enmWaitResult, rc, mData.mWaitCount, mData.mWaitEvent));*/
@@ -2140,8 +2103,8 @@ int GuestSession::signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /
     return vrc;
 }
 
-int GuestSession::startTaskAsync(const Utf8Str &strTaskDesc,
-                                 GuestSessionTask *pTask, ComObjPtr<Progress> &pProgress)
+int GuestSession::i_startTaskAsync(const Utf8Str &strTaskDesc,
+                                   GuestSessionTask *pTask, ComObjPtr<Progress> &pProgress)
 {
     LogFlowThisFunc(("strTaskDesc=%s, pTask=%p\n", strTaskDesc.c_str(), pTask));
 
@@ -2173,53 +2136,47 @@ int GuestSession::startTaskAsync(const Utf8Str &strTaskDesc,
 }
 
 /**
- * Queries/collects information prior to establishing a guest session.
- * This is necessary to know which guest control protocol version to use,
- * among other things (later).
+ * Determines the protocol version (sets mData.mProtocolVersion).
+ *
+ * This is called from the init method prior to to establishing a guest
+ * session.
  *
  * @return  IPRT status code.
  */
-int GuestSession::queryInfo(void)
+int GuestSession::i_determineProtocolVersion(void)
 {
     /*
-     * Try querying the guest control protocol version running on the guest.
-     * This is done using the Guest Additions version
+     * We currently do this based on the reported guest additions version,
+     * ASSUMING that VBoxService and VBoxDrv are at the same version.
      */
     ComObjPtr<Guest> pGuest = mParent;
-    Assert(!pGuest.isNull());
+    AssertReturn(!pGuest.isNull(), VERR_NOT_SUPPORTED);
+    uint32_t uGaVersion = pGuest->i_getAdditionsVersion();
 
-    uint32_t uVerAdditions = pGuest->getAdditionsVersion();
-    uint32_t uVBoxMajor    = VBOX_FULL_VERSION_GET_MAJOR(uVerAdditions);
-    uint32_t uVBoxMinor    = VBOX_FULL_VERSION_GET_MINOR(uVerAdditions);
+    /* Everyone supports version one, if they support anything at all. */
+    mData.mProtocolVersion = 1;
 
-#ifdef DEBUG_andy
-    /* Hardcode the to-used protocol version; nice for testing side effects. */
-    mData.mProtocolVersion = 2;
-#else
-    mData.mProtocolVersion = (
-                              /* VBox 5.0 and up. */
-                                 uVBoxMajor  >= 5
-                              /* VBox 4.3 and up. */
-                              || (uVBoxMajor == 4 && uVBoxMinor >= 3))
-                           ? 2  /* Guest control 2.0. */
-                           : 1; /* Legacy guest control (VBox < 4.3). */
-    /* Build revision is ignored. */
-#endif
+    /* Guest control 2.0 was introduced with 4.3.0. */
+    if (uGaVersion >= VBOX_FULL_VERSION_MAKE(4,3,0))
+        mData.mProtocolVersion = 2; /* Guest control 2.0. */
 
-    LogFlowThisFunc(("uVerAdditions=%RU32 (%RU32.%RU32), mProtocolVersion=%RU32\n",
-                     uVerAdditions, uVBoxMajor, uVBoxMinor, mData.mProtocolVersion));
+    LogFlowThisFunc(("uGaVersion=%u.%u.%u => mProtocolVersion=%u\n",
+                     VBOX_FULL_VERSION_GET_MAJOR(uGaVersion), VBOX_FULL_VERSION_GET_MINOR(uGaVersion),
+                     VBOX_FULL_VERSION_GET_BUILD(uGaVersion), mData.mProtocolVersion));
 
-    /* Tell the user but don't bitch too often. */
-    static short s_gctrlLegacyWarning = 0;
-    if (   mData.mProtocolVersion < 2
-        && s_gctrlLegacyWarning++ < 3) /** @todo Find a bit nicer text. */
-        LogRel((tr("Warning: Guest Additions are older (%ld.%ld) than host capabilities for guest control, please upgrade them. Using protocol version %ld now\n"),
-                uVBoxMajor, uVBoxMinor, mData.mProtocolVersion));
+    /*
+     * Inform the user about outdated guest additions (VM release log).
+     */
+    if (mData.mProtocolVersion < 2)
+        LogRelMax(3, (tr("Warning: Guest Additions v%u.%u.%u only supports the older guest control protocol version %u.\n"
+                         "         Please upgrade GAs to the current version to get full guest control capabilities.\n"),
+                      VBOX_FULL_VERSION_GET_MAJOR(uGaVersion), VBOX_FULL_VERSION_GET_MINOR(uGaVersion),
+                      VBOX_FULL_VERSION_GET_BUILD(uGaVersion), mData.mProtocolVersion));
 
     return VINF_SUCCESS;
 }
 
-int GuestSession::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc)
+int GuestSession::i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc)
 {
     LogFlowThisFuncEnter();
 
@@ -2346,8 +2303,8 @@ int GuestSession::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWai
     alock.release(); /* Release lock before waiting. */
 
     GuestSessionStatus_T sessionStatus;
-    vrc = waitForStatusChange(pEvent, fWaitFlags,
-                              uTimeoutMS, &sessionStatus, pGuestRc);
+    vrc = i_waitForStatusChange(pEvent, fWaitFlags,
+                                uTimeoutMS, &sessionStatus, pGuestRc);
     if (RT_SUCCESS(vrc))
     {
         switch (sessionStatus)
@@ -2385,8 +2342,8 @@ int GuestSession::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWai
     return vrc;
 }
 
-int GuestSession::waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
-                                      GuestSessionStatus_T *pSessionStatus, int *pGuestRc)
+int GuestSession::i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
+                                        GuestSessionStatus_T *pSessionStatus, int *pGuestRc)
 {
     AssertPtrReturn(pEvent, VERR_INVALID_POINTER);
 
@@ -2430,11 +2387,8 @@ int GuestSession::waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlag
 // implementation of public methods
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP GuestSession::Close(void)
+HRESULT GuestSession::close()
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
     AutoCaller autoCaller(this);
@@ -2442,13 +2396,13 @@ STDMETHODIMP GuestSession::Close(void)
 
     /* Close session on guest. */
     int guestRc = VINF_SUCCESS;
-    int rc = closeSession(0 /* Flags */, 30 * 1000 /* Timeout */,
-                          &guestRc);
+    int rc = i_closeSession(0 /* Flags */, 30 * 1000 /* Timeout */,
+                            &guestRc);
     /* On failure don't return here, instead do all the cleanup
      * work first and then return an error. */
 
     /* Remove ourselves from the session list. */
-    int rc2 = mParent->sessionRemove(this);
+    int rc2 = mParent->i_sessionRemove(this);
     if (rc2 == VERR_NOT_FOUND) /* Not finding the session anymore isn't critical. */
         rc2 = VINF_SUCCESS;
 
@@ -2460,42 +2414,39 @@ STDMETHODIMP GuestSession::Close(void)
     if (RT_FAILURE(rc))
     {
         if (rc == VERR_GSTCTL_GUEST_ERROR)
-            return GuestSession::setErrorExternal(this, guestRc);
+            return GuestSession::i_setErrorExternal(this, guestRc);
 
         return setError(VBOX_E_IPRT_ERROR,
                         tr("Closing guest session failed with %Rrc"), rc);
     }
 
     return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::CopyFrom(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(CopyFileFlag_T, aFlags), IProgress **aProgress)
+HRESULT GuestSession::fileCopy(const com::Utf8Str &aSource, const com::Utf8Str &aDestination,
+                               const std::vector<FileCopyFlag_T> &aFlags, ComPtr<IProgress> &aProgress)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
-    CheckComArgStrNotEmptyOrNull(aSource);
-    CheckComArgStrNotEmptyOrNull(aDest);
-    CheckComArgOutPointerValid(aProgress);
+}
 
+HRESULT GuestSession::fileCopyFromGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDest,
+                                        const std::vector<FileCopyFlag_T> &aFlags,
+                                        ComPtr<IProgress> &aProgress)
+{
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aSource) == NULL || *(aSource) == '\0'))
+    if (RT_UNLIKELY((aSource.c_str()) == NULL || *(aSource.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No source specified"));
-    if (RT_UNLIKELY((aDest) == NULL || *(aDest) == '\0'))
+    if (RT_UNLIKELY((aDest.c_str()) == NULL || *(aDest.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No destination specified"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    uint32_t fFlags = CopyFileFlag_None;
-    if (aFlags)
+    uint32_t fFlags = FileCopyFlag_None;
+    if (aFlags.size())
     {
-        com::SafeArray<CopyFileFlag_T> flags(ComSafeArrayInArg(aFlags));
-        for (size_t i = 0; i < flags.size(); i++)
-            fFlags |= flags[i];
+        for (size_t i = 0; i < aFlags.size(); i++)
+            fFlags |= aFlags[i];
     }
+/** @todo r=bird: fend off flags we don't implement here!  */
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -2505,17 +2456,15 @@ STDMETHODIMP GuestSession::CopyFrom(IN_BSTR aSource, IN_BSTR aDest, ComSafeArray
     {
         ComObjPtr<Progress> pProgress;
         SessionTaskCopyFrom *pTask = new SessionTaskCopyFrom(this /* GuestSession */,
-                                                             Utf8Str(aSource), Utf8Str(aDest), fFlags);
-        int rc = startTaskAsync(Utf8StrFmt(tr("Copying \"%ls\" from guest to \"%ls\" on the host"), aSource, aDest),
-                                pTask, pProgress);
+                                                             aSource, aDest, fFlags);
+        int rc = i_startTaskAsync(Utf8StrFmt(tr("Copying \"%s\" from guest to \"%s\" on the host"), aSource.c_str(),
+                                  aDest.c_str()), pTask, pProgress);
         if (RT_SUCCESS(rc))
-        {
             /* Return progress to the caller. */
-            hr = pProgress.queryInterfaceTo(aProgress);
-        }
+            hr = pProgress.queryInterfaceTo(aProgress.asOutParam());
         else
             hr = setError(VBOX_E_IPRT_ERROR,
-                          tr("Starting task for copying file \"%ls\" from guest to \"%ls\" on the host failed: %Rrc"), rc);
+                          tr("Starting task for copying file \"%s\" from guest to \"%s\" on the host failed: %Rrc"), rc);
     }
     catch(std::bad_alloc &)
     {
@@ -2523,35 +2472,25 @@ STDMETHODIMP GuestSession::CopyFrom(IN_BSTR aSource, IN_BSTR aDest, ComSafeArray
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::CopyTo(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(CopyFileFlag_T, aFlags), IProgress **aProgress)
+HRESULT GuestSession::fileCopyToGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDest,
+                                      const std::vector<FileCopyFlag_T> &aFlags, ComPtr<IProgress> &aProgress)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    CheckComArgStrNotEmptyOrNull(aSource);
-    CheckComArgStrNotEmptyOrNull(aDest);
-    CheckComArgOutPointerValid(aProgress);
-
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aSource) == NULL || *(aSource) == '\0'))
+    if (RT_UNLIKELY((aSource.c_str()) == NULL || *(aSource.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No source specified"));
-    if (RT_UNLIKELY((aDest) == NULL || *(aDest) == '\0'))
+    if (RT_UNLIKELY((aDest.c_str()) == NULL || *(aDest.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No destination specified"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    uint32_t fFlags = CopyFileFlag_None;
-    if (aFlags)
+    uint32_t fFlags = FileCopyFlag_None;
+    if (aFlags.size())
     {
-        com::SafeArray<CopyFileFlag_T> flags(ComSafeArrayInArg(aFlags));
-        for (size_t i = 0; i < flags.size(); i++)
-            fFlags |= flags[i];
+        for (size_t i = 0; i < aFlags.size(); i++)
+            fFlags |= aFlags[i];
     }
+/** @todo r=bird: fend off flags we don't implement here!  */
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -2561,18 +2500,18 @@ STDMETHODIMP GuestSession::CopyTo(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn
     {
         ComObjPtr<Progress> pProgress;
         SessionTaskCopyTo *pTask = new SessionTaskCopyTo(this /* GuestSession */,
-                                                         Utf8Str(aSource), Utf8Str(aDest), fFlags);
+                                                         aSource, aDest, fFlags);
         AssertPtrReturn(pTask, E_OUTOFMEMORY);
-        int rc = startTaskAsync(Utf8StrFmt(tr("Copying \"%ls\" from host to \"%ls\" on the guest"), aSource, aDest),
-                                pTask, pProgress);
+        int rc = i_startTaskAsync(Utf8StrFmt(tr("Copying \"%s\" from host to \"%s\" on the guest"), aSource.c_str(),
+                                  aDest.c_str()), pTask, pProgress);
         if (RT_SUCCESS(rc))
         {
             /* Return progress to the caller. */
-            hr = pProgress.queryInterfaceTo(aProgress);
+            hr = pProgress.queryInterfaceTo(aProgress.asOutParam());
         }
         else
             hr = setError(VBOX_E_IPRT_ERROR,
-                          tr("Starting task for copying file \"%ls\" from host to \"%ls\" on the guest failed: %Rrc"), rc);
+                          tr("Starting task for copying file \"%s\" from host to \"%s\" on the guest failed: %Rrc"), rc);
     }
     catch(std::bad_alloc &)
     {
@@ -2580,41 +2519,49 @@ STDMETHODIMP GuestSession::CopyTo(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::DirectoryCreate(IN_BSTR aPath, ULONG aMode,
-                                           ComSafeArrayIn(DirectoryCreateFlag_T, aFlags))
+HRESULT GuestSession::directoryCopy(const com::Utf8Str &aSource, const com::Utf8Str &aDestination,
+                                    const std::vector<DirectoryCopyFlags_T> &aFlags, ComPtr<IProgress> &aProgress)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
+}
+
+HRESULT GuestSession::directoryCopyFromGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDestination,
+                                             const std::vector<DirectoryCopyFlags_T> &aFlags, ComPtr<IProgress> &aProgress)
+{
+    ReturnComNotImplemented();
+}
+
+HRESULT GuestSession::directoryCopyToGuest(const com::Utf8Str &aSource, const com::Utf8Str &aDestination,
+                                           const std::vector<DirectoryCopyFlags_T> &aFlags, ComPtr<IProgress> &aProgress)
+{
+    ReturnComNotImplemented();
+}
+
+HRESULT GuestSession::directoryCreate(const com::Utf8Str &aPath, ULONG aMode,
+                                      const std::vector<DirectoryCreateFlag_T> &aFlags)
+{
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No directory to create specified"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     uint32_t fFlags = DirectoryCreateFlag_None;
-    if (aFlags)
+    if (aFlags.size())
     {
-        com::SafeArray<DirectoryCreateFlag_T> flags(ComSafeArrayInArg(aFlags));
-        for (size_t i = 0; i < flags.size(); i++)
-            fFlags |= flags[i];
+        for (size_t i = 0; i < aFlags.size(); i++)
+            fFlags |= aFlags[i];
 
         if (fFlags)
-        {
             if (!(fFlags & DirectoryCreateFlag_Parents))
                 return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), fFlags);
-        }
     }
 
     HRESULT hr = S_OK;
 
     ComObjPtr <GuestDirectory> pDirectory; int guestRc;
-    int rc = directoryCreateInternal(Utf8Str(aPath), (uint32_t)aMode, fFlags, &guestRc);
+    int rc = i_directoryCreateInternal(aPath, (uint32_t)aMode, fFlags, &guestRc);
     if (RT_FAILURE(rc))
     {
         switch (rc)
@@ -2639,117 +2586,90 @@ STDMETHODIMP GuestSession::DirectoryCreate(IN_BSTR aPath, ULONG aMode,
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::DirectoryCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, BSTR *aDirectory)
+HRESULT GuestSession::directoryCreateTemp(const com::Utf8Str &aTemplateName, ULONG aMode, const com::Utf8Str &aPath,
+                                          BOOL aSecure, com::Utf8Str &aDirectory)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aTemplate) == NULL || *(aTemplate) == '\0'))
+    if (RT_UNLIKELY((aTemplateName.c_str()) == NULL || *(aTemplateName.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No template specified"));
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No directory name specified"));
-    CheckComArgOutPointerValid(aDirectory);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     HRESULT hr = S_OK;
 
-    Utf8Str strName; int guestRc;
-    int rc = objectCreateTempInternal(Utf8Str(aTemplate),
-                                      Utf8Str(aPath),
-                                      true /* Directory */, strName, &guestRc);
-    if (RT_SUCCESS(rc))
-    {
-        strName.cloneTo(aDirectory);
-    }
-    else
+    int guestRc;
+    int rc = i_objectCreateTempInternal(aTemplateName,
+                                        aPath,
+                                        true /* Directory */, aDirectory, &guestRc);
+    if (!RT_SUCCESS(rc))
     {
         switch (rc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
                hr = setError(VBOX_E_IPRT_ERROR, tr("Temporary directory creation \"%s\" with template \"%s\" failed: %Rrc"),
-                             Utf8Str(aPath).c_str(), Utf8Str(aTemplate).c_str(), rc);
+                             aPath.c_str(), aTemplateName.c_str(), rc);
                break;
         }
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::DirectoryExists(IN_BSTR aPath, BOOL *aExists)
+HRESULT GuestSession::directoryExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No directory to check existence for specified"));
-    CheckComArgOutPointerValid(aExists);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     HRESULT hr = S_OK;
 
     GuestFsObjData objData; int guestRc;
-    int rc = directoryQueryInfoInternal(Utf8Str(aPath), objData, &guestRc);
+    int rc = i_directoryQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &guestRc);
     if (RT_SUCCESS(rc))
-    {
         *aExists = objData.mType == FsObjType_Directory;
-    }
     else
     {
+        /** @todo r=bird: Looks like this code raises errors if the directory doesn't
+         *        exist... That's of course not right. */
         switch (rc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
                hr = setError(VBOX_E_IPRT_ERROR, tr("Querying directory existence \"%s\" failed: %Rrc"),
-                             Utf8Str(aPath).c_str(), rc);
+                             aPath.c_str(), rc);
                break;
         }
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::DirectoryOpen(IN_BSTR aPath, IN_BSTR aFilter, ComSafeArrayIn(DirectoryOpenFlag_T, aFlags), IGuestDirectory **aDirectory)
+HRESULT GuestSession::directoryOpen(const com::Utf8Str &aPath, const com::Utf8Str &aFilter,
+                                    const std::vector<DirectoryOpenFlag_T> &aFlags, ComPtr<IGuestDirectory> &aDirectory)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No directory to open specified"));
-    if (RT_UNLIKELY((aFilter) != NULL && *(aFilter) != '\0'))
+    if (RT_UNLIKELY((aFilter.c_str()) != NULL && *(aFilter.c_str()) != '\0'))
         return setError(E_INVALIDARG, tr("Directory filters are not implemented yet"));
-    CheckComArgOutPointerValid(aDirectory);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     uint32_t fFlags = DirectoryOpenFlag_None;
-    if (aFlags)
+    if (aFlags.size())
     {
-        com::SafeArray<DirectoryOpenFlag_T> flags(ComSafeArrayInArg(aFlags));
-        for (size_t i = 0; i < flags.size(); i++)
-            fFlags |= flags[i];
+        for (size_t i = 0; i < aFlags.size(); i++)
+            fFlags |= aFlags[i];
 
         if (fFlags)
             return setError(E_INVALIDARG, tr("Open flags (%#x) not implemented yet"), fFlags);
@@ -2758,16 +2678,16 @@ STDMETHODIMP GuestSession::DirectoryOpen(IN_BSTR aPath, IN_BSTR aFilter, ComSafe
     HRESULT hr = S_OK;
 
     GuestDirectoryOpenInfo openInfo;
-    openInfo.mPath = Utf8Str(aPath);
-    openInfo.mFilter = Utf8Str(aFilter);
+    openInfo.mPath = aPath;
+    openInfo.mFilter = aFilter;
     openInfo.mFlags = fFlags;
 
     ComObjPtr <GuestDirectory> pDirectory; int guestRc;
-    int rc = directoryOpenInternal(openInfo, pDirectory, &guestRc);
+    int rc = i_directoryOpenInternal(openInfo, pDirectory, &guestRc);
     if (RT_SUCCESS(rc))
     {
         /* Return directory object to the caller. */
-        hr = pDirectory.queryInterfaceTo(aDirectory);
+        hr = pDirectory.queryInterfaceTo(aDirectory.asOutParam());
     }
     else
     {
@@ -2775,97 +2695,31 @@ STDMETHODIMP GuestSession::DirectoryOpen(IN_BSTR aPath, IN_BSTR aFilter, ComSafe
         {
             case VERR_INVALID_PARAMETER:
                hr = setError(VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed; invalid parameters given"),
-                                                   Utf8Str(aPath).c_str());
+                                                   aPath.c_str());
                break;
 
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestDirectory::setErrorExternal(this, guestRc);
+                hr = GuestDirectory::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
                hr = setError(VBOX_E_IPRT_ERROR, tr("Opening directory \"%s\" failed: %Rrc"),
-                             Utf8Str(aPath).c_str(),rc);
+                             aPath.c_str(),rc);
                break;
         }
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
-}
-
-STDMETHODIMP GuestSession::DirectoryQueryInfo(IN_BSTR aPath, IGuestFsObjInfo **aInfo)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
-        return setError(E_INVALIDARG, tr("No directory to query information for specified"));
-    CheckComArgOutPointerValid(aInfo);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    HRESULT hr = S_OK;
-
-    GuestFsObjData objData; int guestRc;
-    int vrc = directoryQueryInfoInternal(Utf8Str(aPath), objData, &guestRc);
-    if (RT_SUCCESS(vrc))
-    {
-        if (objData.mType == FsObjType_Directory)
-        {
-            ComObjPtr<GuestFsObjInfo> pFsObjInfo;
-            hr = pFsObjInfo.createObject();
-            if (FAILED(hr)) return hr;
-
-            vrc = pFsObjInfo->init(objData);
-            if (RT_SUCCESS(vrc))
-            {
-                hr = pFsObjInfo.queryInterfaceTo(aInfo);
-                if (FAILED(hr)) return hr;
-            }
-        }
-    }
-
-    if (RT_FAILURE(vrc))
-    {
-        switch (vrc)
-        {
-            case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
-                break;
-
-            case VERR_NOT_A_DIRECTORY:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Element \"%s\" exists but is not a directory"),
-                                                    Utf8Str(aPath).c_str());
-                break;
-
-            default:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Querying directory information for \"%s\" failed: %Rrc"),
-                              Utf8Str(aPath).c_str(), vrc);
-                break;
-        }
-    }
-
-    return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::DirectoryRemove(IN_BSTR aPath)
+HRESULT GuestSession::directoryRemove(const com::Utf8Str &aPath)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No directory to remove specified"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    HRESULT hr = isReadyExternal();
+    HRESULT hr = i_isReadyExternal();
     if (FAILED(hr))
         return hr;
 
@@ -2873,7 +2727,7 @@ STDMETHODIMP GuestSession::DirectoryRemove(IN_BSTR aPath)
     uint32_t uFlags = 0;
 
     int guestRc;
-    int vrc = directoryRemoveInternal(Utf8Str(aPath), uFlags, &guestRc);
+    int vrc = i_directoryRemoveInternal(aPath, uFlags, &guestRc);
     if (RT_FAILURE(vrc))
     {
         switch (vrc)
@@ -2884,34 +2738,31 @@ STDMETHODIMP GuestSession::DirectoryRemove(IN_BSTR aPath)
                 break;
 
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestDirectory::setErrorExternal(this, guestRc);
+                hr = GuestDirectory::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
                 hr = setError(VBOX_E_IPRT_ERROR, tr("Removing guest directory \"%s\" failed: %Rrc"),
-                              Utf8Str(aPath).c_str(), vrc);
+                              aPath.c_str(), vrc);
                 break;
         }
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress)
+HRESULT GuestSession::directoryRemoveRecursive(const com::Utf8Str &aPath, const std::vector<DirectoryRemoveRecFlag_T> &aFlags,
+                                               ComPtr<IProgress> &aProgress)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No directory to remove recursively specified"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+/** @todo r=bird: Must check that the flags matches the hardcoded behavior
+ *        further down!! */
 
-    HRESULT hr = isReadyExternal();
+    HRESULT hr = i_isReadyExternal();
     if (FAILED(hr))
         return hr;
 
@@ -2928,7 +2779,7 @@ STDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayI
      *       deleting a guest directory recursively. So just complete
      *       the progress object right now. */
      /** @todo Implement progress reporting on guest directory deletion! */
-    hr = pProgress->notifyComplete(S_OK);
+    hr = pProgress->i_notifyComplete(S_OK);
     if (FAILED(hr))
         return hr;
 
@@ -2936,7 +2787,7 @@ STDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayI
     uint32_t uFlags = DIRREMOVE_FLAG_RECURSIVE
                     | DIRREMOVE_FLAG_CONTENT_AND_DIR;
     int guestRc;
-    int vrc = directoryRemoveInternal(Utf8Str(aPath), uFlags, &guestRc);
+    int vrc = i_directoryRemoveInternal(aPath, uFlags, &guestRc);
     if (RT_FAILURE(vrc))
     {
         switch (vrc)
@@ -2947,204 +2798,152 @@ STDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayI
                 break;
 
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestFile::setErrorExternal(this, guestRc);
+                hr = GuestFile::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
                 hr = setError(VBOX_E_IPRT_ERROR, tr("Recursively removing guest directory \"%s\" failed: %Rrc"),
-                              Utf8Str(aPath).c_str(), vrc);
+                              aPath.c_str(), vrc);
                 break;
         }
     }
     else
     {
-        pProgress.queryInterfaceTo(aProgress);
+        pProgress.queryInterfaceTo(aProgress.asOutParam());
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::DirectoryRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
+HRESULT GuestSession::environmentScheduleSet(const com::Utf8Str &aName, const com::Utf8Str &aValue)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aSource) == NULL || *(aSource) == '\0'))
-        return setError(E_INVALIDARG, tr("No source directory to rename specified"));
-
-    if (RT_UNLIKELY((aDest) == NULL || *(aDest) == '\0'))
-        return setError(E_INVALIDARG, tr("No destination directory to rename the source to specified"));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    HRESULT hr = isReadyExternal();
-    if (FAILED(hr))
-        return hr;
-
-    /* No flags; only remove the directory when empty. */
-    uint32_t uFlags = 0;
-
-    int guestRc;
-    int vrc = pathRenameInternal(Utf8Str(aSource), Utf8Str(aDest), uFlags, &guestRc);
-    if (RT_FAILURE(vrc))
+    HRESULT hrc;
+    if (RT_LIKELY(aName.isNotEmpty()))
     {
-        switch (vrc)
+        if (RT_LIKELY(strchr(aName.c_str(), '=') == NULL))
         {
-            case VERR_NOT_SUPPORTED:
-                hr = setError(VBOX_E_IPRT_ERROR,
-                              tr("Handling renaming guest directories not supported by installed Guest Additions"));
-                break;
-
-            case VERR_GSTCTL_GUEST_ERROR:
-                hr = setError(VBOX_E_IPRT_ERROR,
-                              tr("Renaming guest directory failed: %Rrc"), guestRc);
-                break;
-
-            default:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest directory \"%s\" failed: %Rrc"),
-                              Utf8Str(aSource).c_str(), vrc);
-                break;
+            AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+            int vrc = mData.mEnvironmentChanges.setVariable(aName, aValue);
+            if (RT_SUCCESS(vrc))
+                hrc = S_OK;
+            else
+                hrc = setErrorVrc(vrc);
         }
+        else
+            hrc = setError(E_INVALIDARG, tr("The equal char is not allowed in environment variable names"));
     }
-
-    return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
-}
-
-STDMETHODIMP GuestSession::DirectorySetACL(IN_BSTR aPath, IN_BSTR aACL)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
-}
-
-STDMETHODIMP GuestSession::EnvironmentClear(void)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    mData.mEnvironment.Clear();
+    else
+        hrc = setError(E_INVALIDARG, tr("No variable name specified"));
 
     LogFlowThisFuncLeave();
-    return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    return hrc;
 }
 
-STDMETHODIMP GuestSession::EnvironmentGet(IN_BSTR aName, BSTR *aValue)
+HRESULT GuestSession::environmentScheduleUnset(const com::Utf8Str &aName)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
-
-    if (RT_UNLIKELY((aName) == NULL || *(aName) == '\0'))
-        return setError(E_INVALIDARG, tr("No value name specified"));
-
-    CheckComArgOutPointerValid(aValue);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    Bstr strValue(mData.mEnvironment.Get(Utf8Str(aName)));
-    strValue.cloneTo(aValue);
+    HRESULT hrc;
+    if (RT_LIKELY(aName.isNotEmpty()))
+    {
+        if (RT_LIKELY(strchr(aName.c_str(), '=') == NULL))
+        {
+            AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+            int vrc = mData.mEnvironmentChanges.unsetVariable(aName);
+            if (RT_SUCCESS(vrc))
+                hrc = S_OK;
+            else
+                hrc = setErrorVrc(vrc);
+        }
+        else
+            hrc = setError(E_INVALIDARG, tr("The equal char is not allowed in environment variable names"));
+    }
+    else
+        hrc = setError(E_INVALIDARG, tr("No variable name specified"));
 
     LogFlowThisFuncLeave();
-    return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    return hrc;
 }
 
-STDMETHODIMP GuestSession::EnvironmentSet(IN_BSTR aName, IN_BSTR aValue)
+HRESULT GuestSession::environmentGetBaseVariable(const com::Utf8Str &aName, com::Utf8Str &aValue)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
+    HRESULT hrc;
+    if (RT_LIKELY(aName.isNotEmpty()))
+    {
+        if (RT_LIKELY(strchr(aName.c_str(), '=') == NULL))
+        {
+            AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+            if (mData.mpBaseEnvironment)
+            {
+                int vrc = mData.mpBaseEnvironment->getVariable(aName, &aValue);
+                if (RT_SUCCESS(vrc))
+                    hrc = S_OK;
+                else
+                    hrc = setErrorVrc(vrc);
+            }
+            else if (mData.mProtocolVersion < 99999)
+                hrc = setError(VBOX_E_NOT_SUPPORTED, tr("The base environment feature is not supported by the guest additions"));
+            else
+                hrc = setError(VBOX_E_INVALID_OBJECT_STATE, tr("The base environment has not yet been reported by the guest"));
+        }
+        else
+            hrc = setError(E_INVALIDARG, tr("The equal char is not allowed in environment variable names"));
+    }
+    else
+        hrc = setError(E_INVALIDARG, tr("No variable name specified"));
 
-    if (RT_UNLIKELY((aName) == NULL || *(aName) == '\0'))
-        return setError(E_INVALIDARG, tr("No value name specified"));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    int rc = mData.mEnvironment.Set(Utf8Str(aName), Utf8Str(aValue));
-
-    HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
-    LogFlowFuncLeaveRC(hr);
-    return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    LogFlowThisFuncLeave();
+    return hrc;
 }
 
-STDMETHODIMP GuestSession::EnvironmentUnset(IN_BSTR aName)
+HRESULT GuestSession::environmentDoesBaseVariableExist(const com::Utf8Str &aName, BOOL *aExists)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    mData.mEnvironment.Unset(Utf8Str(aName));
+    *aExists = FALSE;
+    HRESULT hrc;
+    if (RT_LIKELY(aName.isNotEmpty()))
+    {
+        if (RT_LIKELY(strchr(aName.c_str(), '=') == NULL))
+        {
+            AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+            if (mData.mpBaseEnvironment)
+            {
+                hrc = S_OK;
+                *aExists = mData.mpBaseEnvironment->doesVariableExist(aName);
+            }
+            else if (mData.mProtocolVersion < 99999)
+                hrc = setError(VBOX_E_NOT_SUPPORTED, tr("The base environment feature is not supported by the guest additions"));
+            else
+                hrc = setError(VBOX_E_INVALID_OBJECT_STATE, tr("The base environment has not yet been reported by the guest"));
+        }
+        else
+            hrc = setError(E_INVALIDARG, tr("The equal char is not allowed in environment variable names"));
+    }
+    else
+        hrc = setError(E_INVALIDARG, tr("No variable name specified"));
 
     LogFlowThisFuncLeave();
-    return S_OK;
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    return hrc;
 }
 
-STDMETHODIMP GuestSession::FileCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, IGuestFile **aFile)
+HRESULT GuestSession::fileCreateTemp(const com::Utf8Str &aTemplateName, ULONG aMode, const com::Utf8Str &aPath, BOOL aSecure,
+                                     ComPtr<IGuestFile> &aFile)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::FileExists(IN_BSTR aPath, BOOL *aExists)
+HRESULT GuestSession::fileExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+/** @todo r=bird: Treat empty file with a FALSE return. */
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No file to check existence for specified"));
-    CheckComArgOutPointerValid(aExists);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     GuestFsObjData objData; int guestRc;
-    int vrc = fileQueryInfoInternal(Utf8Str(aPath), objData, &guestRc);
+    int vrc = i_fileQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &guestRc);
     if (RT_SUCCESS(vrc))
     {
         *aExists = TRUE;
@@ -3156,124 +2955,111 @@ STDMETHODIMP GuestSession::FileExists(IN_BSTR aPath, BOOL *aExists)
     switch (vrc)
     {
         case VERR_GSTCTL_GUEST_ERROR:
-            hr = GuestProcess::setErrorExternal(this, guestRc);
+            hr = GuestProcess::i_setErrorExternal(this, guestRc);
             break;
 
+/** @todo r=bird: what about VERR_PATH_NOT_FOUND and VERR_FILE_NOT_FOUND?
+ *        Where does that get converted to *aExists = FALSE? */
         case VERR_NOT_A_FILE:
             *aExists = FALSE;
             break;
 
         default:
             hr = setError(VBOX_E_IPRT_ERROR, tr("Querying file information for \"%s\" failed: %Rrc"),
-                          Utf8Str(aPath).c_str(), vrc);
+                          aPath.c_str(), vrc);
             break;
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::FileRemove(IN_BSTR aPath)
+HRESULT GuestSession::fileOpen(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
+                               ULONG aCreationMode, ComPtr<IGuestFile> &aFile)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
-
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
-        return setError(E_INVALIDARG, tr("No file to remove specified"));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    HRESULT hr = S_OK;
-
-    int guestRc;
-    int vrc = fileRemoveInternal(Utf8Str(aPath), &guestRc);
-    if (RT_FAILURE(vrc))
-    {
-        switch (vrc)
-        {
-            case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
-                break;
-
-            default:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Removing file \"%s\" failed: %Rrc"),
-                              Utf8Str(aPath).c_str(), vrc);
-                break;
-        }
-    }
-
-    return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
-}
-
-STDMETHODIMP GuestSession::FileOpen(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, IGuestFile **aFile)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    Bstr strSharingMode = ""; /* Sharing mode is ignored. */
-
-    return FileOpenEx(aPath, aOpenMode, aDisposition, strSharingMode.raw(), aCreationMode,
-                      0 /* aOffset */, aFile);
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    const std::vector<FileOpenExFlags_T> EmptyFlags;
+    return fileOpenEx(aPath, aAccessMode, aOpenAction, FileSharingMode_All, aCreationMode, EmptyFlags, aFile);
 }
 
-STDMETHODIMP GuestSession::FileOpenEx(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, IN_BSTR aSharingMode,
-                                      ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile)
+HRESULT GuestSession::fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
+                                 FileSharingMode_T aSharingMode, ULONG aCreationMode,
+                                 const std::vector<FileOpenExFlags_T> &aFlags, ComPtr<IGuestFile> &aFile)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
         return setError(E_INVALIDARG, tr("No file to open specified"));
-    if (RT_UNLIKELY((aOpenMode) == NULL || *(aOpenMode) == '\0'))
-        return setError(E_INVALIDARG, tr("No open mode specified"));
-    if (RT_UNLIKELY((aDisposition) == NULL || *(aDisposition) == '\0'))
-        return setError(E_INVALIDARG, tr("No disposition mode specified"));
-    /* aSharingMode is optional. */
 
-    CheckComArgOutPointerValid(aFile);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    HRESULT hr = isReadyExternal();
+    HRESULT hr = i_isReadyExternal();
     if (FAILED(hr))
         return hr;
 
-    /** @todo Validate creation mode. */
-    uint32_t uCreationMode = 0;
-
     GuestFileOpenInfo openInfo;
-    openInfo.mFileName = Utf8Str(aPath);
-    openInfo.mOpenMode = Utf8Str(aOpenMode);
-    openInfo.mDisposition = Utf8Str(aDisposition);
-    openInfo.mSharingMode = Utf8Str(aSharingMode);
+    openInfo.mFileName = aPath;
     openInfo.mCreationMode = aCreationMode;
-    openInfo.mInitialOffset = aOffset;
 
-    uint64_t uFlagsIgnored;
-    int vrc = RTFileModeToFlagsEx(openInfo.mOpenMode.c_str(),
-                                  openInfo.mDisposition.c_str(),
-                                  openInfo.mSharingMode.c_str(),
-                                  &uFlagsIgnored);
-    if (RT_FAILURE(vrc))
-        return setError(E_INVALIDARG, tr("Invalid open mode / disposition / sharing mode specified"));
+    /* convert + validate aAccessMode to the old format. */
+    openInfo.mAccessMode = aAccessMode;
+    switch (aAccessMode)
+    {
+        case (FileAccessMode_T)FileAccessMode_ReadOnly:  openInfo.mpszAccessMode = "r"; break;
+        case (FileAccessMode_T)FileAccessMode_WriteOnly: openInfo.mpszAccessMode = "w"; break;
+        case (FileAccessMode_T)FileAccessMode_ReadWrite: openInfo.mpszAccessMode = "r+"; break;
+        case (FileAccessMode_T)FileAccessMode_AppendOnly:
+            /* fall thru */
+        case (FileAccessMode_T)FileAccessMode_AppendRead:
+            return setError(E_NOTIMPL, tr("Append access modes are not yet implemented"));
+        default:
+            return setError(E_INVALIDARG, tr("Unknown FileAccessMode value %u (%#x)"), aAccessMode, aAccessMode);
+    }
 
-    ComObjPtr <GuestFile> pFile; int guestRc;
-    vrc = fileOpenInternal(openInfo, pFile, &guestRc);
-    if (RT_SUCCESS(vrc))
+    /* convert + validate aOpenAction to the old format. */
+    openInfo.mOpenAction = aOpenAction;
+    switch (aOpenAction)
     {
-        /* Return directory object to the caller. */
-        hr = pFile.queryInterfaceTo(aFile);
+        case (FileOpenAction_T)FileOpenAction_OpenExisting:          openInfo.mpszOpenAction = "oe"; break;
+        case (FileOpenAction_T)FileOpenAction_OpenOrCreate:          openInfo.mpszOpenAction = "oc"; break;
+        case (FileOpenAction_T)FileOpenAction_CreateNew:             openInfo.mpszOpenAction = "ce"; break;
+        case (FileOpenAction_T)FileOpenAction_CreateOrReplace:       openInfo.mpszOpenAction = "ca"; break;
+        case (FileOpenAction_T)FileOpenAction_OpenExistingTruncated: openInfo.mpszOpenAction = "ot"; break;
+        case (FileOpenAction_T)FileOpenAction_AppendOrCreate:
+            openInfo.mpszOpenAction = "oa"; /** @todo get rid of this one and implement AppendOnly/AppendRead. */
+            break;
+        default:
+            return setError(E_INVALIDARG, tr("Unknown FileOpenAction value %u (%#x)"), aAccessMode, aAccessMode);
     }
+
+    /* validate aSharingMode */
+    openInfo.mSharingMode = aSharingMode;
+    switch (aSharingMode)
+    {
+        case (FileSharingMode_T)FileSharingMode_All: /* OK */ break;
+        case (FileSharingMode_T)FileSharingMode_Read:
+        case (FileSharingMode_T)FileSharingMode_Write:
+        case (FileSharingMode_T)FileSharingMode_ReadWrite:
+        case (FileSharingMode_T)FileSharingMode_Delete:
+        case (FileSharingMode_T)FileSharingMode_ReadDelete:
+        case (FileSharingMode_T)FileSharingMode_WriteDelete:
+            return setError(E_NOTIMPL, tr("Only FileSharingMode_All is currently implemented"));
+
+        default:
+            return setError(E_INVALIDARG, tr("Unknown FileOpenAction value %u (%#x)"), aAccessMode, aAccessMode);
+    }
+
+    /* Combine and validate flags. */
+    uint32_t fOpenEx = 0;
+    for (size_t i = 0; i < aFlags.size(); i++)
+        fOpenEx = aFlags[i];
+    if (fOpenEx)
+        return setError(E_INVALIDARG, tr("Unsupported FileOpenExFlags values in aFlags (%#x)"), fOpenEx);
+    openInfo.mfOpenEx = fOpenEx;
+
+    ComObjPtr <GuestFile> pFile;
+    int guestRc;
+    int vrc = i_fileOpenInternal(openInfo, pFile, &guestRc);
+    if (RT_SUCCESS(vrc))
+        /* Return directory object to the caller. */
+        hr = pFile.queryInterfaceTo(aFile.asOutParam());
     else
     {
         switch (vrc)
@@ -3284,433 +3070,392 @@ STDMETHODIMP GuestSession::FileOpenEx(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR
                 break;
 
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestFile::setErrorExternal(this, guestRc);
+                hr = GuestFile::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
                 hr = setError(VBOX_E_IPRT_ERROR, tr("Opening guest file \"%s\" failed: %Rrc"),
-                              Utf8Str(aPath).c_str(), vrc);
+                              aPath.c_str(), vrc);
                 break;
         }
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::FileQueryInfo(IN_BSTR aPath, IGuestFsObjInfo **aInfo)
+HRESULT GuestSession::fileQuerySize(const com::Utf8Str &aPath, BOOL aFollowSymlinks, LONG64 *aSize)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
-        return setError(E_INVALIDARG, tr("No file to query information for specified"));
-    CheckComArgOutPointerValid(aInfo);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (RT_UNLIKELY((aPath.c_str()) == NULL || *(aPath.c_str()) == '\0'))
+        return setError(E_INVALIDARG, tr("No file to query size for specified"));
 
     HRESULT hr = S_OK;
 
-    GuestFsObjData objData; int guestRc;
-    int vrc = fileQueryInfoInternal(Utf8Str(aPath), objData, &guestRc);
+    int64_t llSize; int guestRc;
+    int vrc = i_fileQuerySizeInternal(aPath, aFollowSymlinks != FALSE,  &llSize, &guestRc);
     if (RT_SUCCESS(vrc))
-    {
-        ComObjPtr<GuestFsObjInfo> pFsObjInfo;
-        hr = pFsObjInfo.createObject();
-        if (FAILED(hr)) return hr;
-
-        vrc = pFsObjInfo->init(objData);
-        if (RT_SUCCESS(vrc))
-        {
-            hr = pFsObjInfo.queryInterfaceTo(aInfo);
-            if (FAILED(hr)) return hr;
-        }
-    }
-
-    if (RT_FAILURE(vrc))
+        *aSize = llSize;
+    else
     {
         switch (vrc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
-                break;
-
-            case VERR_NOT_A_FILE:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Element exists but is not a file"));
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
-               hr = setError(VBOX_E_IPRT_ERROR, tr("Querying file information failed: %Rrc"), vrc);
+               hr = setError(VBOX_E_IPRT_ERROR, tr("Querying file size failed: %Rrc"), vrc);
                break;
         }
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::FileQuerySize(IN_BSTR aPath, LONG64 *aSize)
+HRESULT GuestSession::fsObjExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aPath) == NULL || *(aPath) == '\0'))
-        return setError(E_INVALIDARG, tr("No file to query size for specified"));
-    CheckComArgOutPointerValid(aSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    HRESULT hrc = S_OK;
+    *aExists = false;
+    if (RT_LIKELY(aPath.isNotEmpty()))
+    {
+        GuestFsObjData objData;
+        int rcGuest;
+        int vrc = i_fsQueryInfoInternal(aPath, aFollowSymlinks != FALSE, objData, &rcGuest);
+        if (RT_SUCCESS(vrc))
+            *aExists = TRUE;
+        else if (   vrc == VERR_NOT_A_FILE
+                 || vrc == VERR_PATH_NOT_FOUND
+                 || vrc == VERR_FILE_NOT_FOUND
+                 || vrc == VERR_INVALID_NAME)
+            hrc = S_OK; /* Ignore these vrc values. */
+        else if (vrc == VERR_GSTCTL_GUEST_ERROR) /** @todo What _is_ rcGuest, really? Stuff like VERR_NOT_A_FILE too?? */
+            hrc = GuestProcess::i_setErrorExternal(this, rcGuest);
+        else
+            hrc = setErrorVrc(vrc, tr("Querying file information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc);
+    }
+    /* else: If the file name is empty, there is no way it can exists. So, don't
+       be a tedious and return E_INVALIDARG, simply return FALSE. */
+    LogFlowThisFuncLeave();
+    return hrc;
+}
 
-    HRESULT hr = S_OK;
+HRESULT GuestSession::fsObjQueryInfo(const com::Utf8Str &aPath, BOOL aFollowSymlinks, ComPtr<IGuestFsObjInfo> &aInfo)
+{
+    LogFlowThisFuncEnter();
 
-    int64_t llSize; int guestRc;
-    int vrc = fileQuerySizeInternal(Utf8Str(aPath), &llSize, &guestRc);
-    if (RT_SUCCESS(vrc))
+    HRESULT hrc = S_OK;
+    if (RT_LIKELY(aPath.isNotEmpty()))
     {
-        *aSize = llSize;
+        GuestFsObjData Info;
+        int rcGuest;
+        int vrc = i_fsQueryInfoInternal(aPath, aFollowSymlinks != FALSE, Info, &rcGuest);
+        if (RT_SUCCESS(vrc))
+        {
+            ComObjPtr<GuestFsObjInfo> ptrFsObjInfo;
+            hrc = ptrFsObjInfo.createObject();
+            if (SUCCEEDED(hrc))
+            {
+                vrc = ptrFsObjInfo->init(Info);
+                if (RT_SUCCESS(vrc))
+                    hrc = ptrFsObjInfo.queryInterfaceTo(aInfo.asOutParam());
+                else
+                    hrc = setErrorVrc(vrc);
+            }
+        }
+        else if (vrc == VERR_GSTCTL_GUEST_ERROR)
+            hrc = GuestProcess::i_setErrorExternal(this, rcGuest);
+        else
+            hrc = setErrorVrc(vrc, tr("Querying file information for \"%s\" failed: %Rrc"), aPath.c_str(), vrc);
     }
-    else
+    /* else: If the file name is empty, there is no way it can exists. So, don't
+       be a tedious and return E_INVALIDARG, simply return FALSE. */
+    LogFlowThisFuncLeave();
+    return hrc;
+}
+
+HRESULT GuestSession::fsObjRemove(const com::Utf8Str &aPath)
+{
+    LogFlowThisFuncEnter();
+
+    if (RT_UNLIKELY(aPath.isEmpty()))
+        return setError(E_INVALIDARG, tr("Empty path specified"));
+
+    HRESULT hr = S_OK;
+
+    int guestRc;
+    int vrc = i_fileRemoveInternal(aPath, &guestRc);
+    if (RT_FAILURE(vrc))
     {
         switch (vrc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestProcess::setErrorExternal(this, guestRc);
+                hr = GuestProcess::i_setErrorExternal(this, guestRc);
                 break;
 
             default:
-               hr = setError(VBOX_E_IPRT_ERROR, tr("Querying file size failed: %Rrc"), vrc);
-               break;
+                hr = setError(VBOX_E_IPRT_ERROR, tr("Removing file \"%s\" failed: %Rrc"),
+                              aPath.c_str(), vrc);
+                break;
         }
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::FileRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
+HRESULT GuestSession::fsObjRename(const com::Utf8Str &aSource,
+                                  const com::Utf8Str &aDestination,
+                                  const std::vector<FsObjRenameFlag_T> &aFlags)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aSource) == NULL || *(aSource) == '\0'))
-        return setError(E_INVALIDARG, tr("No source file to rename specified"));
-
-    if (RT_UNLIKELY((aDest) == NULL || *(aDest) == '\0'))
-        return setError(E_INVALIDARG, tr("No destination file to rename the source to specified"));
+    if (RT_UNLIKELY(aSource.isEmpty()))
+        return setError(E_INVALIDARG, tr("No source path specified"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (RT_UNLIKELY(aDestination.isEmpty()))
+        return setError(E_INVALIDARG, tr("No destination path specified"));
 
-    HRESULT hr = isReadyExternal();
+    HRESULT hr = i_isReadyExternal();
     if (FAILED(hr))
         return hr;
 
-    /* No flags; only remove the directory when empty. */
-    uint32_t uFlags = 0;
+    /* Combine, validate and convert flags. */
+    uint32_t fApiFlags = 0;
+    for (size_t i = 0; i < aFlags.size(); i++)
+        fApiFlags |= aFlags[i];
+    if (fApiFlags & ~((uint32_t)FsObjRenameFlag_NoReplace | (uint32_t)FsObjRenameFlag_Replace))
+        return setError(E_INVALIDARG, tr("Unknown rename flag: %#x"), fApiFlags);
+
+    AssertCompile(FsObjRenameFlag_NoReplace == 0);
+    AssertCompile(FsObjRenameFlag_Replace != 0);
+    uint32_t fBackend;
+    if ((fApiFlags & ((uint32_t)FsObjRenameFlag_NoReplace | (uint32_t)FsObjRenameFlag_Replace)) == FsObjRenameFlag_Replace)
+        fBackend = PATHRENAME_FLAG_REPLACE;
+    else
+        fBackend = PATHRENAME_FLAG_NO_REPLACE;
 
+    /* Call worker to do the job. */
     int guestRc;
-    int vrc = pathRenameInternal(Utf8Str(aSource), Utf8Str(aDest), uFlags, &guestRc);
+    int vrc = i_pathRenameInternal(aSource, aDestination, fBackend, &guestRc);
     if (RT_FAILURE(vrc))
     {
         switch (vrc)
         {
             case VERR_NOT_SUPPORTED:
                 hr = setError(VBOX_E_IPRT_ERROR,
-                              tr("Handling renaming guest files not supported by installed Guest Additions"));
+                              tr("Handling renaming guest directories not supported by installed Guest Additions"));
                 break;
 
             case VERR_GSTCTL_GUEST_ERROR:
-                /** @todo Proper guestRc to text translation needed. */
                 hr = setError(VBOX_E_IPRT_ERROR,
-                              tr("Renaming guest file failed: %Rrc"), guestRc);
+                              tr("Renaming guest directory failed: %Rrc"), guestRc);
                 break;
 
             default:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest file \"%s\" failed: %Rrc"),
-                              Utf8Str(aSource).c_str(), vrc);
+                hr = setError(VBOX_E_IPRT_ERROR, tr("Renaming guest directory \"%s\" failed: %Rrc"),
+                              aSource.c_str(), vrc);
                 break;
         }
     }
 
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::FileSetACL(IN_BSTR aPath, IN_BSTR aACL)
+HRESULT GuestSession::fsObjMove(const com::Utf8Str &aSource, const com::Utf8Str &aDestination,
+                                const std::vector<FsObjMoveFlags_T> &aFlags, ComPtr<IProgress> &aProgress)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+}
 
+HRESULT GuestSession::fsObjSetACL(const com::Utf8Str &aPath, BOOL aFollowSymlinks, const com::Utf8Str &aAcl, ULONG aMode)
+{
     ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::ProcessCreate(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
-                                         ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **aProcess)
+
+HRESULT GuestSession::processCreate(const com::Utf8Str &aExecutable, const std::vector<com::Utf8Str> &aArguments,
+                                    const std::vector<com::Utf8Str> &aEnvironment,
+                                    const std::vector<ProcessCreateFlag_T> &aFlags,
+                                    ULONG aTimeoutMS, ComPtr<IGuestProcess> &aGuestProcess)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    com::SafeArray<LONG> affinityIgnored;
+    std::vector<LONG> affinityIgnored;
 
-    return ProcessCreateEx(aCommand, ComSafeArrayInArg(aArguments), ComSafeArrayInArg(aEnvironment),
-                           ComSafeArrayInArg(aFlags), aTimeoutMS, ProcessPriority_Default, ComSafeArrayAsInParam(affinityIgnored), aProcess);
-#endif /* VBOX_WITH_GUEST_CONTROL */
+    return processCreateEx(aExecutable, aArguments, aEnvironment, aFlags, aTimeoutMS, ProcessPriority_Default,
+                           affinityIgnored, aGuestProcess);
 }
 
-STDMETHODIMP GuestSession::ProcessCreateEx(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
-                                           ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
-                                           ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
-                                           IGuestProcess **aProcess)
+HRESULT GuestSession::processCreateEx(const com::Utf8Str &aExecutable, const std::vector<com::Utf8Str> &aArguments,
+                                      const std::vector<com::Utf8Str> &aEnvironment,
+                                      const std::vector<ProcessCreateFlag_T> &aFlags, ULONG aTimeoutMS,
+                                      ProcessPriority_T aPriority, const std::vector<LONG> &aAffinity,
+                                      ComPtr<IGuestProcess> &aGuestProcess)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    if (RT_UNLIKELY((aCommand) == NULL || *(aCommand) == '\0'))
-        return setError(E_INVALIDARG, tr("No command to execute specified"));
-    CheckComArgOutPointerValid(aProcess);
+    /** @todo r=bird: Check input better? aPriority is passed on to the guest
+     * without any validation.  Flags not existing in this vbox version are
+     * ignored, potentially doing something entirely different than what the
+     * caller had in mind. */
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    HRESULT hr = isReadyExternal();
-    if (FAILED(hr))
-        return hr;
-
-    GuestProcessStartupInfo procInfo;
-    procInfo.mCommand = Utf8Str(aCommand);
-
-    if (aArguments)
+    /*
+     * Must have an executable to execute.  If none is given, we try use the
+     * zero'th argument.
+     */
+    const char *pszExecutable = aExecutable.c_str();
+    if (RT_UNLIKELY(pszExecutable == NULL || *pszExecutable == '\0'))
     {
-        com::SafeArray<IN_BSTR> arguments(ComSafeArrayInArg(aArguments));
-        for (size_t i = 0; i < arguments.size(); i++)
-            procInfo.mArguments.push_back(Utf8Str(arguments[i]));
+        if (aArguments.size() > 0)
+            pszExecutable = aArguments[0].c_str();
+        if (pszExecutable == NULL || *pszExecutable == '\0')
+            return setError(E_INVALIDARG, tr("No command to execute specified"));
     }
 
-    int rc = VINF_SUCCESS;
+    /*
+     * Check the session.
+     */
+    HRESULT hr = i_isReadyExternal();
+    if (FAILED(hr))
+        return hr;
 
     /*
-     * Create the process environment:
-     * - Apply the session environment in a first step, and
-     * - Apply environment variables specified by this call to
-     *   have the chance of overwriting/deleting session entries.
+     * Build the process startup info.
      */
-    procInfo.mEnvironment = mData.mEnvironment; /* Apply original session environment. */
+    GuestProcessStartupInfo procInfo;
 
-    if (aEnvironment)
-    {
-        com::SafeArray<IN_BSTR> environment(ComSafeArrayInArg(aEnvironment));
-        for (size_t i = 0; i < environment.size() && RT_SUCCESS(rc); i++)
-            rc = procInfo.mEnvironment.Set(Utf8Str(environment[i]));
-    }
+    /* Executable and arguments. */
+    procInfo.mExecutable = pszExecutable;
+    if (aArguments.size())
+        for (size_t i = 0; i < aArguments.size(); i++)
+            procInfo.mArguments.push_back(aArguments[i]);
 
-    if (RT_SUCCESS(rc))
+    /* Combine the environment changes associated with the ones passed in by
+       the caller, giving priority to the latter.  The changes are putenv style
+       and will be applied to the standard environment for the guest user. */
+    int vrc = procInfo.mEnvironmentChanges.copy(mData.mEnvironmentChanges);
+    if (RT_SUCCESS(vrc))
+        vrc = procInfo.mEnvironmentChanges.applyPutEnvArray(aEnvironment);
+    if (RT_SUCCESS(vrc))
     {
-        if (aFlags)
-        {
-            com::SafeArray<ProcessCreateFlag_T> flags(ComSafeArrayInArg(aFlags));
-            for (size_t i = 0; i < flags.size(); i++)
-                procInfo.mFlags |= flags[i];
-        }
+        /* Convert the flag array into a mask. */
+        if (aFlags.size())
+            for (size_t i = 0; i < aFlags.size(); i++)
+                procInfo.mFlags |= aFlags[i];
 
         procInfo.mTimeoutMS = aTimeoutMS;
 
-        if (aAffinity)
-        {
-            com::SafeArray<LONG> affinity(ComSafeArrayInArg(aAffinity));
-            for (size_t i = 0; i < affinity.size(); i++)
-            {
-                if (affinity[i])
+        /** @todo use RTCPUSET instead of archaic 64-bit variables! */
+        if (aAffinity.size())
+            for (size_t i = 0; i < aAffinity.size(); i++)
+                if (aAffinity[i])
                     procInfo.mAffinity |= (uint64_t)1 << i;
-            }
-        }
 
         procInfo.mPriority = aPriority;
 
+        /*
+         * Create a guest process object.
+         */
         ComObjPtr<GuestProcess> pProcess;
-        rc = processCreateExInteral(procInfo, pProcess);
-        if (RT_SUCCESS(rc))
+        vrc = i_processCreateExInternal(procInfo, pProcess);
+        if (RT_SUCCESS(vrc))
         {
             /* Return guest session to the caller. */
-            HRESULT hr2 = pProcess.queryInterfaceTo(aProcess);
-            if (FAILED(hr2))
-                rc = VERR_COM_OBJECT_NOT_FOUND;
-
-            if (RT_SUCCESS(rc))
-                rc = pProcess->startProcessAsync();
-        }
-    }
-
-    if (RT_FAILURE(rc))
-    {
-        switch (rc)
-        {
-            case VERR_MAX_PROCS_REACHED:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of concurrent guest processes per session (%ld) reached"),
-                                                    VBOX_GUESTCTRL_MAX_OBJECTS);
-                break;
-
-            /** @todo Add more errors here. */
+            hr = pProcess.queryInterfaceTo(aGuestProcess.asOutParam());
+            if (SUCCEEDED(hr))
+            {
+                /*
+                 * Start the process.
+                 */
+                vrc = pProcess->i_startProcessAsync();
+                if (RT_SUCCESS(vrc))
+                {
+                    LogFlowFuncLeaveRC(vrc);
+                    return S_OK;
+                }
 
-            default:
-                hr = setError(VBOX_E_IPRT_ERROR, tr("Could not create guest process, rc=%Rrc"), rc);
-                break;
+                hr = setErrorVrc(vrc, tr("Failed to start guest process: %Rrc"), vrc);
+                /** @todo r=bird: What happens to the interface that *aGuestProcess points to
+                 *        now?  Looks like a leak or an undocument hack of sorts... */
+            }
         }
+        else if (vrc == VERR_MAX_PROCS_REACHED)
+            hr = setErrorVrc(vrc, tr("Maximum number of concurrent guest processes per session (%u) reached"),
+                             VBOX_GUESTCTRL_MAX_OBJECTS);
+        else
+            hr = setErrorVrc(vrc, tr("Failed to create guest process object: %Rrc"), vrc);
     }
+    else
+        hr = setErrorVrc(vrc, tr("Failed to set up the environment: %Rrc"), vrc);
 
-    LogFlowFuncLeaveRC(rc);
+    LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::ProcessGet(ULONG aPID, IGuestProcess **aProcess)
+HRESULT GuestSession::processGet(ULONG aPid, ComPtr<IGuestProcess> &aGuestProcess)
+
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFunc(("PID=%RU32\n", aPID));
+    LogFlowThisFunc(("PID=%RU32\n", aPid));
 
-    CheckComArgOutPointerValid(aProcess);
-    if (aPID == 0)
+    if (aPid == 0)
         return setError(E_INVALIDARG, tr("No valid process ID (PID) specified"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HRESULT hr = S_OK;
 
     ComObjPtr<GuestProcess> pProcess;
-    int rc = processGetByPID(aPID, &pProcess);
+    int rc = i_processGetByPID(aPid, &pProcess);
     if (RT_FAILURE(rc))
-        hr = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPID);
+        hr = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPid);
 
     /* This will set (*aProcess) to NULL if pProgress is NULL. */
-    HRESULT hr2 = pProcess.queryInterfaceTo(aProcess);
+    HRESULT hr2 = pProcess.queryInterfaceTo(aGuestProcess.asOutParam());
     if (SUCCEEDED(hr))
         hr = hr2;
 
-    LogFlowThisFunc(("aProcess=%p, hr=%Rhrc\n", *aProcess, hr));
+    LogFlowThisFunc(("aProcess=%p, hr=%Rhrc\n", (IGuestProcess*)aGuestProcess, hr));
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::SymlinkCreate(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType)
+HRESULT GuestSession::symlinkCreate(const com::Utf8Str &aSource, const com::Utf8Str &aTarget, SymlinkType_T aType)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::SymlinkExists(IN_BSTR aSymlink, BOOL *aExists)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
+HRESULT GuestSession::symlinkExists(const com::Utf8Str &aSymlink, BOOL *aExists)
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
-}
-
-STDMETHODIMP GuestSession::SymlinkRead(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
     ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::SymlinkRemoveDirectory(IN_BSTR aPath)
+HRESULT GuestSession::symlinkRead(const com::Utf8Str &aSymlink, const std::vector<SymlinkReadFlag_T> &aFlags,
+                                  com::Utf8Str &aTarget)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::SymlinkRemoveFile(IN_BSTR aFile)
+HRESULT GuestSession::waitFor(ULONG aWaitFor, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ReturnComNotImplemented();
-#endif /* VBOX_WITH_GUEST_CONTROL */
-}
-
-STDMETHODIMP GuestSession::WaitFor(ULONG aWaitFlags, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason)
-{
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aReason);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /*
      * Note: Do not hold any locks here while waiting!
      */
     HRESULT hr = S_OK;
 
     int guestRc; GuestSessionWaitResult_T waitResult;
-    int vrc = waitFor(aWaitFlags, aTimeoutMS, waitResult, &guestRc);
+    int vrc = i_waitFor(aWaitFor, aTimeoutMS, waitResult, &guestRc);
     if (RT_SUCCESS(vrc))
-    {
         *aReason = waitResult;
-    }
     else
     {
         switch (vrc)
         {
             case VERR_GSTCTL_GUEST_ERROR:
-                hr = GuestSession::setErrorExternal(this, guestRc);
+                hr = GuestSession::i_setErrorExternal(this, guestRc);
                 break;
 
             case VERR_TIMEOUT:
@@ -3730,30 +3475,20 @@ STDMETHODIMP GuestSession::WaitFor(ULONG aWaitFlags, ULONG aTimeoutMS, GuestSess
 
     LogFlowFuncLeaveRC(vrc);
     return hr;
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
-STDMETHODIMP GuestSession::WaitForArray(ComSafeArrayIn(GuestSessionWaitForFlag_T, aFlags), ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason)
+HRESULT GuestSession::waitForArray(const std::vector<GuestSessionWaitForFlag_T> &aWaitFor, ULONG aTimeoutMS,
+                                   GuestSessionWaitResult_T *aReason)
 {
-#ifndef VBOX_WITH_GUEST_CONTROL
-    ReturnComNotImplemented();
-#else
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aReason);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /*
      * Note: Do not hold any locks here while waiting!
      */
     uint32_t fWaitFor = GuestSessionWaitForFlag_None;
-    com::SafeArray<GuestSessionWaitForFlag_T> flags(ComSafeArrayInArg(aFlags));
-    for (size_t i = 0; i < flags.size(); i++)
-        fWaitFor |= flags[i];
+    for (size_t i = 0; i < aWaitFor.size(); i++)
+        fWaitFor |= aWaitFor[i];
 
     return WaitFor(fWaitFor, aTimeoutMS, aReason);
-#endif /* VBOX_WITH_GUEST_CONTROL */
 }
 
diff --git a/src/VBox/Main/src-client/GuestSessionImplTasks.cpp b/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
index 759020d..66c93a4 100644
--- a/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
+++ b/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,13 +20,15 @@
 *   Header Files                                                               *
 *******************************************************************************/
 #include "GuestImpl.h"
+#ifndef VBOX_WITH_GUEST_CONTROL
+# error "VBOX_WITH_GUEST_CONTROL must defined in this file"
+#endif
 #include "GuestSessionImpl.h"
 #include "GuestCtrlImplPrivate.h"
 
 #include "Global.h"
 #include "AutoCaller.h"
 #include "ConsoleImpl.h"
-#include "MachineImpl.h"
 #include "ProgressImpl.h"
 
 #include <memory> /* For auto_ptr. */
@@ -75,8 +77,8 @@ GuestSessionTask::~GuestSessionTask(void)
 int GuestSessionTask::getGuestProperty(const ComObjPtr<Guest> &pGuest,
                                        const Utf8Str &strPath, Utf8Str &strValue)
 {
-    ComObjPtr<Console> pConsole = pGuest->getConsole();
-    const ComPtr<IMachine> pMachine = pConsole->machine();
+    ComObjPtr<Console> pConsole = pGuest->i_getConsole();
+    const ComPtr<IMachine> pMachine = pConsole->i_machine();
 
     Assert(!pMachine.isNull());
     Bstr strTemp, strFlags;
@@ -127,7 +129,7 @@ int GuestSessionTask::setProgressSuccess(void)
         && SUCCEEDED(mProgress->COMGETTER(Completed(&fCompleted)))
         && !fCompleted)
     {
-        HRESULT hr = mProgress->notifyComplete(S_OK);
+        HRESULT hr = mProgress->i_notifyComplete(S_OK);
         if (FAILED(hr))
             return VERR_COM_UNEXPECTED; /** @todo Find a better rc. */
     }
@@ -150,10 +152,10 @@ HRESULT GuestSessionTask::setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg)
         && SUCCEEDED(mProgress->COMGETTER(Completed(&fCompleted)))
         && !fCompleted)
     {
-        HRESULT hr2 = mProgress->notifyComplete(hr,
-                                                COM_IIDOF(IGuestSession),
-                                                GuestSession::getStaticComponentName(),
-                                                strMsg.c_str());
+        HRESULT hr2 = mProgress->i_notifyComplete(hr,
+                                                  COM_IIDOF(IGuestSession),
+                                                  GuestSession::getStaticComponentName(),
+                                                  strMsg.c_str());
         if (FAILED(hr2))
             return hr2;
     }
@@ -185,7 +187,7 @@ int SessionTaskOpen::Run(int *pGuestRc)
     AutoCaller autoCaller(pSession);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    int vrc = pSession->startSessionInternal(pGuestRc);
+    int vrc = pSession->i_startSessionInternal(pGuestRc);
     /* Nothing to do here anymore. */
 
     LogFlowFuncLeaveRC(vrc);
@@ -309,8 +311,8 @@ int SessionTaskCopyTo::Run(void)
     }
 
     GuestProcessStartupInfo procInfo;
-    procInfo.mCommand = Utf8Str(VBOXSERVICE_TOOL_CAT);
-    procInfo.mFlags   = ProcessCreateFlag_Hidden;
+    procInfo.mExecutable = Utf8Str(VBOXSERVICE_TOOL_CAT);
+    procInfo.mFlags      = ProcessCreateFlag_Hidden;
 
     /* Set arguments.*/
     procInfo.mArguments.push_back(Utf8StrFmt("--output=%s", mDest.c_str())); /** @todo Do we need path conversion? */
@@ -318,12 +320,12 @@ int SessionTaskCopyTo::Run(void)
     /* Startup process. */
     ComObjPtr<GuestProcess> pProcess; int guestRc;
     if (RT_SUCCESS(rc))
-        rc = pSession->processCreateExInteral(procInfo, pProcess);
+        rc = pSession->i_processCreateExInternal(procInfo, pProcess);
     if (RT_SUCCESS(rc))
     {
         Assert(!pProcess.isNull());
-        rc = pProcess->startProcess(30 * 1000 /* 30s timeout */,
-                                    &guestRc);
+        rc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */,
+                                      &guestRc);
     }
 
     if (RT_FAILURE(rc))
@@ -332,12 +334,13 @@ int SessionTaskCopyTo::Run(void)
         {
             case VERR_GSTCTL_GUEST_ERROR:
                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                    GuestProcess::guestErrorToString(guestRc));
+                                    GuestProcess::i_guestErrorToString(guestRc));
                 break;
 
             default:
                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                    Utf8StrFmt(GuestSession::tr("Error while creating guest process for copying file \"%s\" from guest to host: %Rrc"),
+                                    Utf8StrFmt(GuestSession::tr(
+                                    "Error while creating guest process for copying file \"%s\" from guest to host: %Rrc"),
                                                mSource.c_str(), rc));
                 break;
         }
@@ -354,8 +357,8 @@ int SessionTaskCopyTo::Run(void)
 
         for (;;)
         {
-            rc = pProcess->waitFor(ProcessWaitForFlag_StdIn,
-                                   30 * 1000 /* Timeout */, waitRes, &guestRc);
+            rc = pProcess->i_waitFor(ProcessWaitForFlag_StdIn,
+                                     30 * 1000 /* Timeout */, waitRes, &guestRc);
             if (   RT_FAILURE(rc)
                 || (   waitRes != ProcessWaitResult_StdIn
                     && waitRes != ProcessWaitResult_WaitFlagNotSupported))
@@ -418,16 +421,16 @@ int SessionTaskCopyTo::Run(void)
 
             uint32_t cbWritten;
             Assert(sizeof(byBuf) >= cbRead);
-            rc = pProcess->writeData(0 /* StdIn */, fFlags,
-                                     byBuf, cbRead,
-                                     30 * 1000 /* Timeout */, &cbWritten, &guestRc);
+            rc = pProcess->i_writeData(0 /* StdIn */, fFlags,
+                                       byBuf, cbRead,
+                                       30 * 1000 /* Timeout */, &cbWritten, &guestRc);
             if (RT_FAILURE(rc))
             {
                 switch (rc)
                 {
                     case VERR_GSTCTL_GUEST_ERROR:
                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                            GuestProcess::guestErrorToString(guestRc));
+                                            GuestProcess::i_guestErrorToString(guestRc));
                         break;
 
                     default:
@@ -498,19 +501,21 @@ int SessionTaskCopyTo::Run(void)
             }
             else
             {
-                rc = pProcess->waitFor(ProcessWaitForFlag_Terminate,
-                                       30 * 1000 /* Timeout */, waitRes, &guestRc);
+                rc = pProcess->i_waitFor(ProcessWaitForFlag_Terminate,
+                                         30 * 1000 /* Timeout */, waitRes, &guestRc);
                 if (   RT_FAILURE(rc)
                     || waitRes != ProcessWaitResult_Terminate)
                 {
                     if (RT_FAILURE(rc))
                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                            Utf8StrFmt(GuestSession::tr("Waiting on termination for copying file \"%s\" failed: %Rrc"),
+                                            Utf8StrFmt(
+                                            GuestSession::tr("Waiting on termination for copying file \"%s\" failed: %Rrc"),
                                                        mSource.c_str(), rc));
                     else
                     {
                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                            Utf8StrFmt(GuestSession::tr("Waiting on termination for copying file \"%s\" failed with wait result %ld"),
+                                            Utf8StrFmt(GuestSession::tr(
+                                            "Waiting on termination for copying file \"%s\" failed with wait result %ld"),
                                                        mSource.c_str(), waitRes));
                         rc = VERR_GENERAL_FAILURE; /* Fudge. */
                     }
@@ -527,12 +532,14 @@ int SessionTaskCopyTo::Run(void)
                        )
                     {
                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                            Utf8StrFmt(GuestSession::tr("Copying file \"%s\" failed with status %ld, exit code %ld"),
+                                            Utf8StrFmt(GuestSession::tr(
+                                            "Copying file \"%s\" failed with status %ld, exit code %ld"),
                                                        mSource.c_str(), procStatus, exitCode)); /**@todo Add stringify methods! */
                         rc = VERR_GENERAL_FAILURE; /* Fudge. */
                     }
                 }
 
+
                 if (RT_SUCCESS(rc))
                     rc = setProgressSuccess();
             }
@@ -602,12 +609,12 @@ int SessionTaskCopyFrom::Run(void)
      ** @todo Use the IGuestFile API for locking down the file on the guest!
      */
     GuestFsObjData objData; int guestRc;
-    int rc = pSession->fileQueryInfoInternal(Utf8Str(mSource), objData, &guestRc);
+    int rc = pSession->i_fileQueryInfoInternal(Utf8Str(mSource), false /*fFollowSymlinks*/, objData, &guestRc);
     if (RT_FAILURE(rc))
     {
         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                             Utf8StrFmt(GuestSession::tr("Querying guest file information for \"%s\" failed: %Rrc"),
-                            mSource.c_str(), rc));
+                                       mSource.c_str(), rc));
     }
     else if (objData.mType != FsObjType_File) /* Only single files are supported at the moment. */
     {
@@ -630,32 +637,33 @@ int SessionTaskCopyFrom::Run(void)
         else
         {
             GuestProcessStartupInfo procInfo;
-            procInfo.mName      = Utf8StrFmt(GuestSession::tr("Copying file \"%s\" from guest to the host to \"%s\" (%RI64 bytes)"),
-                                                              mSource.c_str(), mDest.c_str(), objData.mObjectSize);
-            procInfo.mCommand   = Utf8Str(VBOXSERVICE_TOOL_CAT);
-            procInfo.mFlags     = ProcessCreateFlag_Hidden | ProcessCreateFlag_WaitForStdOut;
+            procInfo.mName = Utf8StrFmt(GuestSession::tr("Copying file \"%s\" from guest to the host to \"%s\" (%RI64 bytes)"),
+                                        mSource.c_str(), mDest.c_str(), objData.mObjectSize);
+            procInfo.mExecutable = Utf8Str(VBOXSERVICE_TOOL_CAT);
+            procInfo.mFlags      = ProcessCreateFlag_Hidden | ProcessCreateFlag_WaitForStdOut;
 
             /* Set arguments.*/
             procInfo.mArguments.push_back(mSource); /* Which file to output? */
 
             /* Startup process. */
             ComObjPtr<GuestProcess> pProcess;
-            rc = pSession->processCreateExInteral(procInfo, pProcess);
+            rc = pSession->i_processCreateExInternal(procInfo, pProcess);
             if (RT_SUCCESS(rc))
-                rc = pProcess->startProcess(30 * 1000 /* 30s timeout */,
-                                            &guestRc);
+                rc = pProcess->i_startProcess(30 * 1000 /* 30s timeout */,
+                                              &guestRc);
             if (RT_FAILURE(rc))
             {
                 switch (rc)
                 {
                     case VERR_GSTCTL_GUEST_ERROR:
                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                            GuestProcess::guestErrorToString(guestRc));
+                                            GuestProcess::i_guestErrorToString(guestRc));
                         break;
 
                     default:
                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                            Utf8StrFmt(GuestSession::tr("Error while creating guest process for copying file \"%s\" from guest to host: %Rrc"),
+                                            Utf8StrFmt(GuestSession::tr(
+                                           "Error while creating guest process for copying file \"%s\" from guest to host: %Rrc"),
                                                        mSource.c_str(), rc));
                         break;
                 }
@@ -671,15 +679,15 @@ int SessionTaskCopyFrom::Run(void)
 
                 for (;;)
                 {
-                    rc = pProcess->waitFor(ProcessWaitForFlag_StdOut,
-                                           30 * 1000 /* Timeout */, waitRes, &guestRc);
+                    rc = pProcess->i_waitFor(ProcessWaitForFlag_StdOut,
+                                             30 * 1000 /* Timeout */, waitRes, &guestRc);
                     if (RT_FAILURE(rc))
                     {
                         switch (rc)
                         {
                             case VERR_GSTCTL_GUEST_ERROR:
                                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                                    GuestProcess::guestErrorToString(guestRc));
+                                                    GuestProcess::i_guestErrorToString(guestRc));
                                 break;
 
                             default:
@@ -701,16 +709,16 @@ int SessionTaskCopyFrom::Run(void)
                             RTThreadYield(); /* Optional, don't check rc. */
 
                         uint32_t cbRead = 0; /* readData can return with VWRN_GSTCTL_OBJECTSTATE_CHANGED. */
-                        rc = pProcess->readData(OUTPUT_HANDLE_ID_STDOUT, sizeof(byBuf),
-                                                30 * 1000 /* Timeout */, byBuf, sizeof(byBuf),
-                                                &cbRead, &guestRc);
+                        rc = pProcess->i_readData(OUTPUT_HANDLE_ID_STDOUT, sizeof(byBuf),
+                                                  30 * 1000 /* Timeout */, byBuf, sizeof(byBuf),
+                                                  &cbRead, &guestRc);
                         if (RT_FAILURE(rc))
                         {
                             switch (rc)
                             {
                                 case VERR_GSTCTL_GUEST_ERROR:
                                     setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                                        GuestProcess::guestErrorToString(guestRc));
+                                                        GuestProcess::i_guestErrorToString(guestRc));
                                     break;
 
                                 default:
@@ -730,7 +738,7 @@ int SessionTaskCopyFrom::Run(void)
                             {
                                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                                                     Utf8StrFmt(GuestSession::tr("Error writing to file \"%s\" (%RU64 bytes left): %Rrc"),
-                                                    mDest.c_str(), cbToRead, rc));
+                                                                mDest.c_str(), cbToRead, rc));
                                 break;
                             }
 
@@ -784,7 +792,7 @@ int SessionTaskCopyFrom::Run(void)
                         /* If we did not copy all let the user know. */
                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                                             Utf8StrFmt(GuestSession::tr("Copying file \"%s\" failed (%RU64/%RI64 bytes transfered)"),
-                                            mSource.c_str(), cbWrittenTotal, objData.mObjectSize));
+                                                       mSource.c_str(), cbWrittenTotal, objData.mObjectSize));
                         rc = VERR_GENERAL_FAILURE; /* Fudge. */
                     }
                     else
@@ -799,7 +807,8 @@ int SessionTaskCopyFrom::Run(void)
                         {
                             setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                                                 Utf8StrFmt(GuestSession::tr("Copying file \"%s\" failed with status %ld, exit code %d"),
-                                                mSource.c_str(), procStatus, exitCode)); /**@todo Add stringify methods! */
+                                                           mSource.c_str(), procStatus, exitCode)); /**@todo Add
+                                                                                                       stringify methods! */
                             rc = VERR_GENERAL_FAILURE; /* Fudge. */
                         }
                         else /* Yay, success! */
@@ -857,8 +866,8 @@ SessionTaskUpdateAdditions::~SessionTaskUpdateAdditions(void)
 
 }
 
-int SessionTaskUpdateAdditions::addProcessArguments(ProcessArguments &aArgumentsDest,
-                                                    const ProcessArguments &aArgumentsSource)
+int SessionTaskUpdateAdditions::i_addProcessArguments(ProcessArguments &aArgumentsDest,
+                                                      const ProcessArguments &aArgumentsSource)
 {
     int rc = VINF_SUCCESS;
 
@@ -896,9 +905,9 @@ int SessionTaskUpdateAdditions::addProcessArguments(ProcessArguments &aArguments
     return rc;
 }
 
-int SessionTaskUpdateAdditions::copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO,
-                                                Utf8Str const &strFileSource, const Utf8Str &strFileDest,
-                                                bool fOptional, uint32_t *pcbSize)
+int SessionTaskUpdateAdditions::i_copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO,
+                                                  Utf8Str const &strFileSource, const Utf8Str &strFileDest,
+                                                  bool fOptional, uint32_t *pcbSize)
 {
     AssertPtrReturn(pSession, VERR_INVALID_POINTER);
     AssertPtrReturn(pISO, VERR_INVALID_POINTER);
@@ -930,13 +939,13 @@ int SessionTaskUpdateAdditions::copyFileToGuest(GuestSession *pSession, PRTISOFS
         {
             SessionTaskCopyTo *pTask = new SessionTaskCopyTo(pSession /* GuestSession */,
                                                              &pISO->file, cbOffset, cbSize,
-                                                             strFileDest, CopyFileFlag_None);
+                                                             strFileDest, FileCopyFlag_None);
             AssertPtrReturn(pTask, VERR_NO_MEMORY);
 
             ComObjPtr<Progress> pProgressCopyTo;
-            rc = pSession->startTaskAsync(Utf8StrFmt(GuestSession::tr("Copying Guest Additions installer file \"%s\" to \"%s\" on guest"),
-                                                     mSource.c_str(), strFileDest.c_str()),
-                                                     pTask, pProgressCopyTo);
+            rc = pSession->i_startTaskAsync(Utf8StrFmt(GuestSession::tr("Copying Guest Additions installer file \"%s\" to \"%s\" on guest"),
+                                                       mSource.c_str(), strFileDest.c_str()),
+                                                       pTask, pProgressCopyTo);
             if (RT_SUCCESS(rc))
             {
                 BOOL fCanceled = FALSE;
@@ -966,7 +975,7 @@ int SessionTaskUpdateAdditions::copyFileToGuest(GuestSession *pSession, PRTISOFS
 
         GuestFsObjData objData;
         int64_t cbSizeOnGuest; int guestRc;
-        rc = pSession->fileQuerySizeInternal(strFileDest, &cbSizeOnGuest, &guestRc);
+        rc = pSession->i_fileQuerySizeInternal(strFileDest, false /*fFollowSymlinks*/, &cbSizeOnGuest, &guestRc);
         if (   RT_SUCCESS(rc)
             && cbSize == (uint64_t)cbSizeOnGuest)
         {
@@ -987,7 +996,7 @@ int SessionTaskUpdateAdditions::copyFileToGuest(GuestSession *pSession, PRTISOFS
                 {
                     case VERR_GSTCTL_GUEST_ERROR:
                         setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                            GuestProcess::guestErrorToString(guestRc));
+                                            GuestProcess::i_guestErrorToString(guestRc));
                         break;
 
                     default:
@@ -1009,7 +1018,7 @@ int SessionTaskUpdateAdditions::copyFileToGuest(GuestSession *pSession, PRTISOFS
     return rc;
 }
 
-int SessionTaskUpdateAdditions::runFileOnGuest(GuestSession *pSession, GuestProcessStartupInfo &procInfo)
+int SessionTaskUpdateAdditions::i_runFileOnGuest(GuestSession *pSession, GuestProcessStartupInfo &procInfo)
 {
     AssertPtrReturn(pSession, VERR_INVALID_POINTER);
 
@@ -1021,9 +1030,9 @@ int SessionTaskUpdateAdditions::runFileOnGuest(GuestSession *pSession, GuestProc
     if (RT_SUCCESS(vrc))
     {
         if (RT_SUCCESS(guestRc))
-            vrc = procTool.Wait(GUESTPROCESSTOOL_FLAG_NONE, &guestRc);
+            vrc = procTool.i_wait(GUESTPROCESSTOOL_FLAG_NONE, &guestRc);
         if (RT_SUCCESS(vrc))
-            vrc = procTool.TerminatedOk(&exitCode);
+            vrc = procTool.i_terminatedOk(&exitCode);
     }
 
     if (RT_FAILURE(vrc))
@@ -1033,24 +1042,24 @@ int SessionTaskUpdateAdditions::runFileOnGuest(GuestSession *pSession, GuestProc
             case VERR_NOT_EQUAL: /** @todo Special guest control rc needed! */
                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                                     Utf8StrFmt(GuestSession::tr("Running update file \"%s\" on guest terminated with exit code %ld"),
-                                               procInfo.mCommand.c_str(), exitCode));
+                                               procInfo.mExecutable.c_str(), exitCode));
                 break;
 
             case VERR_GSTCTL_GUEST_ERROR:
                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                    GuestProcess::guestErrorToString(guestRc));
+                                    GuestProcess::i_guestErrorToString(guestRc));
                 break;
 
             case VERR_INVALID_STATE: /** @todo Special guest control rc needed! */
                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                                     Utf8StrFmt(GuestSession::tr("Update file \"%s\" reported invalid running state"),
-                                               procInfo.mCommand.c_str()));
+                                               procInfo.mExecutable.c_str()));
                 break;
 
             default:
                 setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                                     Utf8StrFmt(GuestSession::tr("Error while running update file \"%s\" on guest: %Rrc"),
-                                               procInfo.mCommand.c_str(), vrc));
+                                               procInfo.mExecutable.c_str(), vrc));
                 break;
         }
     }
@@ -1076,7 +1085,7 @@ int SessionTaskUpdateAdditions::Run(void)
 
     LogRel(("Automatic update of Guest Additions started, using \"%s\"\n", mSource.c_str()));
 
-    ComObjPtr<Guest> pGuest(mSession->getParent());
+    ComObjPtr<Guest> pGuest(mSession->i_getParent());
 #if 0
     /*
      * Wait for the guest being ready within 30 seconds.
@@ -1161,7 +1170,7 @@ int SessionTaskUpdateAdditions::Run(void)
                 if (RT_FAILURE(rc))
                 {
                     hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED,
-                                         Utf8StrFmt(GuestSession::tr("Unable to detected guest OS version, please update manually")));
+                                             Utf8StrFmt(GuestSession::tr("Unable to detected guest OS version, please update manually")));
                     rc = VERR_NOT_SUPPORTED;
                 }
 
@@ -1279,21 +1288,21 @@ int SessionTaskUpdateAdditions::Run(void)
 
             /* Create the installation directory. */
             int guestRc;
-            rc = pSession->directoryCreateInternal(strUpdateDir,
-                                                   755 /* Mode */, DirectoryCreateFlag_Parents, &guestRc);
+            rc = pSession->i_directoryCreateInternal(strUpdateDir,
+                                                     755 /* Mode */, DirectoryCreateFlag_Parents, &guestRc);
             if (RT_FAILURE(rc))
             {
                 switch (rc)
                 {
                     case VERR_GSTCTL_GUEST_ERROR:
                         hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
-                                                 GuestProcess::guestErrorToString(guestRc));
+                                                 GuestProcess::i_guestErrorToString(guestRc));
                         break;
 
                     default:
                         hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
                                                  Utf8StrFmt(GuestSession::tr("Error creating installation directory \"%s\" on the guest: %Rrc"),
-                                                 strUpdateDir.c_str(), rc));
+                                                            strUpdateDir.c_str(), rc));
                         break;
                 }
             }
@@ -1337,7 +1346,8 @@ int SessionTaskUpdateAdditions::Run(void)
                             siCertUtilRem.mArguments.push_back(Utf8Str(strUpdateDir + "oracle-vbox.cer"));
                             mFiles.push_back(InstallerFile("CERT/VBOXCERTUTIL.EXE",
                                                            strUpdateDir + "VBoxCertUtil.exe",
-                                                           UPDATEFILE_FLAG_COPY_FROM_ISO | UPDATEFILE_FLAG_EXECUTE | UPDATEFILE_FLAG_OPTIONAL,
+                                                           UPDATEFILE_FLAG_COPY_FROM_ISO | UPDATEFILE_FLAG_EXECUTE |
+                                                           UPDATEFILE_FLAG_OPTIONAL,
                                                            siCertUtilRem));
                             /* Second pass: Only execute (but don't copy) again, this time installng the
                              *              recent certificates just copied over. */
@@ -1377,7 +1387,7 @@ int SessionTaskUpdateAdditions::Run(void)
                         siInstaller.mArguments.push_back(Utf8Str("/post_installstatus"));
                         /* Add optional installer command line arguments from the API to the
                          * installer's startup info. */
-                        rc = addProcessArguments(siInstaller.mArguments, mArguments);
+                        rc = i_addProcessArguments(siInstaller.mArguments, mArguments);
                         AssertRC(rc);
                         /* If the caller does not want to wait for out guest update process to end,
                          * complete the progress object now so that the caller can do other work. */
@@ -1405,7 +1415,7 @@ int SessionTaskUpdateAdditions::Run(void)
                 /* We want to spend 40% total for all copying operations. So roughly
                  * calculate the specific percentage step of each copied file. */
                 uint8_t uOffset = 20; /* Start at 20%. */
-                uint8_t uStep = 40 / mFiles.size();
+                uint8_t uStep = 40 / (uint8_t)mFiles.size(); Assert(mFiles.size() <= 10);
 
                 LogRel(("Copying over Guest Additions update files to the guest ...\n"));
 
@@ -1417,8 +1427,8 @@ int SessionTaskUpdateAdditions::Run(void)
                         bool fOptional = false;
                         if (itFiles->fFlags & UPDATEFILE_FLAG_OPTIONAL)
                             fOptional = true;
-                        rc = copyFileToGuest(pSession, &iso, itFiles->strSource, itFiles->strDest,
-                                             fOptional, NULL /* cbSize */);
+                        rc = i_copyFileToGuest(pSession, &iso, itFiles->strSource, itFiles->strDest,
+                                               fOptional, NULL /* cbSize */);
                         if (RT_FAILURE(rc))
                         {
                             hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR,
@@ -1445,7 +1455,7 @@ int SessionTaskUpdateAdditions::Run(void)
                 /* We want to spend 35% total for all copying operations. So roughly
                  * calculate the specific percentage step of each copied file. */
                 uint8_t uOffset = 60; /* Start at 60%. */
-                uint8_t uStep = 35 / mFiles.size();
+                uint8_t uStep = 35 / (uint8_t)mFiles.size(); Assert(mFiles.size() <= 10);
 
                 LogRel(("Executing Guest Additions update files ...\n"));
 
@@ -1454,7 +1464,7 @@ int SessionTaskUpdateAdditions::Run(void)
                 {
                     if (itFiles->fFlags & UPDATEFILE_FLAG_EXECUTE)
                     {
-                        rc = runFileOnGuest(pSession, itFiles->mProcInfo);
+                        rc = i_runFileOnGuest(pSession, itFiles->mProcInfo);
                         if (RT_FAILURE(rc))
                             break;
                     }
diff --git a/src/VBox/Main/src-client/HGCM.cpp b/src/VBox/Main/src-client/HGCM.cpp
index 722333f..4363488 100644
--- a/src/VBox/Main/src-client/HGCM.cpp
+++ b/src/VBox/Main/src-client/HGCM.cpp
@@ -1,3 +1,4 @@
+/* $Id: HGCM.cpp $ */
 /** @file
  *
  * HGCM (Host-Guest Communication Manager)
@@ -89,7 +90,7 @@ class HGCMService
         static int sm_cServices;
 
         HGCMTHREADHANDLE m_thread;
-        friend DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUser);
+        friend DECLCALLBACK(void) hgcmServiceThread(HGCMTHREADHANDLE ThreadHandle, void *pvUser);
 
         uint32_t volatile m_u32RefCnt;
 
@@ -115,75 +116,77 @@ class HGCMService
 
         HGCMSVCEXTHANDLE m_hExtension;
 
-        int loadServiceDLL (void);
-        void unloadServiceDLL (void);
+        int loadServiceDLL(void);
+        void unloadServiceDLL(void);
 
         /*
          * Main HGCM thread methods.
          */
-        int instanceCreate (const char *pszServiceLibrary, const char *pszServiceName);
-        void instanceDestroy (void);
+        int instanceCreate(const char *pszServiceLibrary, const char *pszServiceName);
+        void instanceDestroy(void);
 
         int saveClientState(uint32_t u32ClientId, PSSMHANDLE pSSM);
         int loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM);
 
-        HGCMService ();
-        ~HGCMService () {};
+        HGCMService();
+        ~HGCMService() {};
 
-        static DECLCALLBACK(void) svcHlpCallComplete (VBOXHGCMCALLHANDLE callHandle, int32_t rc);
-        static DECLCALLBACK(void) svcHlpDisconnectClient (void *pvInstance, uint32_t u32ClientId);
+        static DECLCALLBACK(void) svcHlpCallComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc);
+        static DECLCALLBACK(void) svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId);
 
     public:
 
         /*
          * Main HGCM thread methods.
          */
-        static int LoadService (const char *pszServiceLibrary, const char *pszServiceName);
-        void UnloadService (void);
+        static int LoadService(const char *pszServiceLibrary, const char *pszServiceName);
+        void UnloadService(void);
 
-        static void UnloadAll (void);
+        static void UnloadAll(void);
 
-        static int ResolveService (HGCMService **ppsvc, const char *pszServiceName);
-        void ReferenceService (void);
-        void ReleaseService (void);
+        static int ResolveService(HGCMService **ppsvc, const char *pszServiceName);
+        void ReferenceService(void);
+        void ReleaseService(void);
 
-        static void Reset (void);
+        static void Reset(void);
 
-        static int SaveState (PSSMHANDLE pSSM);
-        static int LoadState (PSSMHANDLE pSSM);
+        static int SaveState(PSSMHANDLE pSSM);
+        static int LoadState(PSSMHANDLE pSSM);
 
-        int CreateAndConnectClient (uint32_t *pu32ClientIdOut, uint32_t u32ClientIdIn);
-        int DisconnectClient (uint32_t u32ClientId, bool fFromService);
+        int CreateAndConnectClient(uint32_t *pu32ClientIdOut, uint32_t u32ClientIdIn);
+        int DisconnectClient(uint32_t u32ClientId, bool fFromService);
 
-        int HostCall (uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM *paParms);
+        int HostCall(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM *paParms);
 
 #ifdef VBOX_WITH_CRHGSMI
         int HandleAcquired();
         int HandleReleased();
-        int HostFastCallAsync (uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion);
+        int HostFastCallAsync(uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion,
+                              void *pvCompletion);
 #endif
 
-        uint32_t SizeOfClient (void) { return m_fntable.cbClient; };
+        uint32_t SizeOfClient(void) { return m_fntable.cbClient; };
 
-        int RegisterExtension (HGCMSVCEXTHANDLE handle, PFNHGCMSVCEXT pfnExtension, void *pvExtension);
-        void UnregisterExtension (HGCMSVCEXTHANDLE handle);
+        int RegisterExtension(HGCMSVCEXTHANDLE handle, PFNHGCMSVCEXT pfnExtension, void *pvExtension);
+        void UnregisterExtension(HGCMSVCEXTHANDLE handle);
 
         /*
          * The service thread methods.
          */
 
-        int GuestCall (PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t u32ClientId, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM aParms[]);
+        int GuestCall(PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t u32ClientId,
+                      uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM aParms[]);
 };
 
 
 class HGCMClient: public HGCMObject
 {
     public:
-        HGCMClient () : HGCMObject(HGCMOBJ_CLIENT), pService(NULL),
+        HGCMClient() : HGCMObject(HGCMOBJ_CLIENT), pService(NULL),
                         pvData(NULL) {};
-        ~HGCMClient ();
+        ~HGCMClient();
 
-        int Init (HGCMService *pSvc);
+        int Init(HGCMService *pSvc);
 
         /** Service that the client is connected to. */
         HGCMService *pService;
@@ -192,19 +195,19 @@ class HGCMClient: public HGCMObject
         void *pvData;
 };
 
-HGCMClient::~HGCMClient ()
+HGCMClient::~HGCMClient()
 {
-    if (pService->SizeOfClient () > 0)
-        RTMemFree (pvData);
+    if (pService->SizeOfClient() > 0)
+        RTMemFree(pvData);
 }
 
-int HGCMClient::Init (HGCMService *pSvc)
+int HGCMClient::Init(HGCMService *pSvc)
 {
     pService = pSvc;
 
-    if (pService->SizeOfClient () > 0)
+    if (pService->SizeOfClient() > 0)
     {
-        pvData = RTMemAllocZ (pService->SizeOfClient ());
+        pvData = RTMemAllocZ(pService->SizeOfClient());
 
         if (!pvData)
         {
@@ -216,7 +219,7 @@ int HGCMClient::Init (HGCMService *pSvc)
 }
 
 
-#define HGCM_CLIENT_DATA(pService, pClient) (pClient->pvData)
+#define HGCM_CLIENT_DATA(pService, pClient)(pClient->pvData)
 
 
 
@@ -224,7 +227,7 @@ HGCMService *HGCMService::sm_pSvcListHead = NULL;
 HGCMService *HGCMService::sm_pSvcListTail = NULL;
 int HGCMService::sm_cServices = 0;
 
-HGCMService::HGCMService ()
+HGCMService::HGCMService()
     :
     m_thread     (0),
     m_u32RefCnt  (0),
@@ -283,7 +286,8 @@ int HGCMService::loadServiceDLL(void)
 
         if (RT_FAILURE(rc) || !m_pfnLoad)
         {
-            Log(("HGCMService::loadServiceDLL: Error resolving the service entry point %s, rc = %d, m_pfnLoad = %p\n", VBOX_HGCM_SVCLOAD_NAME, rc, m_pfnLoad));
+            Log(("HGCMService::loadServiceDLL: Error resolving the service entry point %s, rc = %d, m_pfnLoad = %p\n",
+                 VBOX_HGCM_SVCLOAD_NAME, rc, m_pfnLoad));
 
             if (RT_SUCCESS(rc))
             {
@@ -399,7 +403,7 @@ class HGCMMsgSvcDisconnect: public HGCMMsgCore
 class HGCMMsgHeader: public HGCMMsgCore
 {
     public:
-        HGCMMsgHeader () : pCmd (NULL), pHGCMPort (NULL) {};
+        HGCMMsgHeader() : pCmd(NULL), pHGCMPort(NULL) {};
 
         /* Command pointer/identifier. */
         PVBOXHGCMCMD pCmd;
@@ -475,23 +479,23 @@ class HGCMMsgHostFastCallAsyncSvc: public HGCMMsgCore
 };
 #endif
 
-static HGCMMsgCore *hgcmMessageAllocSvc (uint32_t u32MsgId)
+static HGCMMsgCore *hgcmMessageAllocSvc(uint32_t u32MsgId)
 {
     switch (u32MsgId)
     {
 #ifdef VBOX_WITH_CRHGSMI
-        case SVC_MSG_HOSTFASTCALLASYNC: return new HGCMMsgHostFastCallAsyncSvc ();
+        case SVC_MSG_HOSTFASTCALLASYNC: return new HGCMMsgHostFastCallAsyncSvc();
 #endif
-        case SVC_MSG_LOAD:        return new HGCMMsgSvcLoad ();
-        case SVC_MSG_UNLOAD:      return new HGCMMsgSvcUnload ();
-        case SVC_MSG_CONNECT:     return new HGCMMsgSvcConnect ();
-        case SVC_MSG_DISCONNECT:  return new HGCMMsgSvcDisconnect ();
-        case SVC_MSG_HOSTCALL:    return new HGCMMsgHostCallSvc ();
-        case SVC_MSG_GUESTCALL:   return new HGCMMsgCall ();
+        case SVC_MSG_LOAD:        return new HGCMMsgSvcLoad();
+        case SVC_MSG_UNLOAD:      return new HGCMMsgSvcUnload();
+        case SVC_MSG_CONNECT:     return new HGCMMsgSvcConnect();
+        case SVC_MSG_DISCONNECT:  return new HGCMMsgSvcDisconnect();
+        case SVC_MSG_HOSTCALL:    return new HGCMMsgHostCallSvc();
+        case SVC_MSG_GUESTCALL:   return new HGCMMsgCall();
         case SVC_MSG_LOADSTATE:
-        case SVC_MSG_SAVESTATE:   return new HGCMMsgLoadSaveStateClient ();
-        case SVC_MSG_REGEXT:      return new HGCMMsgSvcRegisterExtension ();
-        case SVC_MSG_UNREGEXT:    return new HGCMMsgSvcUnregisterExtension ();
+        case SVC_MSG_SAVESTATE:   return new HGCMMsgLoadSaveStateClient();
+        case SVC_MSG_REGEXT:      return new HGCMMsgSvcRegisterExtension();
+        case SVC_MSG_UNREGEXT:    return new HGCMMsgSvcUnregisterExtension();
         default:
             AssertReleaseMsgFailed(("Msg id = %08X\n", u32MsgId));
     }
@@ -502,7 +506,7 @@ static HGCMMsgCore *hgcmMessageAllocSvc (uint32_t u32MsgId)
 /*
  * The service thread. Loads the service library and calls the service entry points.
  */
-DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUser)
+DECLCALLBACK(void) hgcmServiceThread(HGCMTHREADHANDLE ThreadHandle, void *pvUser)
 {
     HGCMService *pSvc = (HGCMService *)pvUser;
     AssertRelease(pSvc != NULL);
@@ -512,17 +516,17 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
     while (!fQuit)
     {
         HGCMMsgCore *pMsgCore;
-        int rc = hgcmMsgGet (ThreadHandle, &pMsgCore);
+        int rc = hgcmMsgGet(ThreadHandle, &pMsgCore);
 
         if (RT_FAILURE(rc))
         {
             /* The error means some serious unrecoverable problem in the hgcmMsg/hgcmThread layer. */
-            AssertMsgFailed (("%Rrc\n", rc));
+            AssertMsgFailed(("%Rrc\n", rc));
             break;
         }
 
         /* Cache required information to avoid unnecessary pMsgCore access. */
-        uint32_t u32MsgId = pMsgCore->MsgId ();
+        uint32_t u32MsgId = pMsgCore->MsgId();
 
         switch (u32MsgId)
         {
@@ -533,13 +537,13 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 LogFlowFunc(("SVC_MSG_HOSTFASTCALLASYNC u32Function = %d, pParm = %p\n", pMsg->u32Function, &pMsg->Param));
 
-                rc = pSvc->m_fntable.pfnHostCall (pSvc->m_fntable.pvService, pMsg->u32Function, 1, &pMsg->Param);
+                rc = pSvc->m_fntable.pfnHostCall(pSvc->m_fntable.pvService, pMsg->u32Function, 1, &pMsg->Param);
             } break;
 #endif
             case SVC_MSG_LOAD:
             {
                 LogFlowFunc(("SVC_MSG_LOAD\n"));
-                rc = pSvc->loadServiceDLL ();
+                rc = pSvc->loadServiceDLL();
             } break;
 
             case SVC_MSG_UNLOAD:
@@ -547,10 +551,10 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 LogFlowFunc(("SVC_MSG_UNLOAD\n"));
                 if (pSvc->m_fntable.pfnUnload)
                 {
-                    pSvc->m_fntable.pfnUnload (pSvc->m_fntable.pvService);
+                    pSvc->m_fntable.pfnUnload(pSvc->m_fntable.pvService);
                 }
 
-                pSvc->unloadServiceDLL ();
+                pSvc->unloadServiceDLL();
                 fQuit = true;
             } break;
 
@@ -560,13 +564,14 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 LogFlowFunc(("SVC_MSG_CONNECT u32ClientId = %d\n", pMsg->u32ClientId));
 
-                HGCMClient *pClient = (HGCMClient *)hgcmObjReference (pMsg->u32ClientId, HGCMOBJ_CLIENT);
+                HGCMClient *pClient = (HGCMClient *)hgcmObjReference(pMsg->u32ClientId, HGCMOBJ_CLIENT);
 
                 if (pClient)
                 {
-                    rc = pSvc->m_fntable.pfnConnect (pSvc->m_fntable.pvService, pMsg->u32ClientId, HGCM_CLIENT_DATA(pSvc, pClient));
+                    rc = pSvc->m_fntable.pfnConnect(pSvc->m_fntable.pvService, pMsg->u32ClientId,
+                                                    HGCM_CLIENT_DATA(pSvc, pClient));
 
-                    hgcmObjDereference (pClient);
+                    hgcmObjDereference(pClient);
                 }
                 else
                 {
@@ -580,13 +585,14 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 LogFlowFunc(("SVC_MSG_DISCONNECT u32ClientId = %d\n", pMsg->u32ClientId));
 
-                HGCMClient *pClient = (HGCMClient *)hgcmObjReference (pMsg->u32ClientId, HGCMOBJ_CLIENT);
+                HGCMClient *pClient = (HGCMClient *)hgcmObjReference(pMsg->u32ClientId, HGCMOBJ_CLIENT);
 
                 if (pClient)
                 {
-                    rc = pSvc->m_fntable.pfnDisconnect (pSvc->m_fntable.pvService, pMsg->u32ClientId, HGCM_CLIENT_DATA(pSvc, pClient));
+                    rc = pSvc->m_fntable.pfnDisconnect(pSvc->m_fntable.pvService, pMsg->u32ClientId,
+                                                       HGCM_CLIENT_DATA(pSvc, pClient));
 
-                    hgcmObjDereference (pClient);
+                    hgcmObjDereference(pClient);
                 }
                 else
                 {
@@ -601,13 +607,15 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 LogFlowFunc(("SVC_MSG_GUESTCALL u32ClientId = %d, u32Function = %d, cParms = %d, paParms = %p\n",
                              pMsg->u32ClientId, pMsg->u32Function, pMsg->cParms, pMsg->paParms));
 
-                HGCMClient *pClient = (HGCMClient *)hgcmObjReference (pMsg->u32ClientId, HGCMOBJ_CLIENT);
+                HGCMClient *pClient = (HGCMClient *)hgcmObjReference(pMsg->u32ClientId, HGCMOBJ_CLIENT);
 
                 if (pClient)
                 {
-                    pSvc->m_fntable.pfnCall (pSvc->m_fntable.pvService, (VBOXHGCMCALLHANDLE)pMsg, pMsg->u32ClientId, HGCM_CLIENT_DATA(pSvc, pClient), pMsg->u32Function, pMsg->cParms, pMsg->paParms);
+                    pSvc->m_fntable.pfnCall(pSvc->m_fntable.pvService, (VBOXHGCMCALLHANDLE)pMsg, pMsg->u32ClientId,
+                                            HGCM_CLIENT_DATA(pSvc, pClient), pMsg->u32Function,
+                                            pMsg->cParms, pMsg->paParms);
 
-                    hgcmObjDereference (pClient);
+                    hgcmObjDereference(pClient);
                 }
                 else
                 {
@@ -619,9 +627,10 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
             {
                 HGCMMsgHostCallSvc *pMsg = (HGCMMsgHostCallSvc *)pMsgCore;
 
-                LogFlowFunc(("SVC_MSG_HOSTCALL u32Function = %d, cParms = %d, paParms = %p\n", pMsg->u32Function, pMsg->cParms, pMsg->paParms));
+                LogFlowFunc(("SVC_MSG_HOSTCALL u32Function = %d, cParms = %d, paParms = %p\n",
+                             pMsg->u32Function, pMsg->cParms, pMsg->paParms));
 
-                rc = pSvc->m_fntable.pfnHostCall (pSvc->m_fntable.pvService, pMsg->u32Function, pMsg->cParms, pMsg->paParms);
+                rc = pSvc->m_fntable.pfnHostCall(pSvc->m_fntable.pvService, pMsg->u32Function, pMsg->cParms, pMsg->paParms);
             } break;
 
             case SVC_MSG_LOADSTATE:
@@ -630,16 +639,17 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 LogFlowFunc(("SVC_MSG_LOADSTATE\n"));
 
-                HGCMClient *pClient = (HGCMClient *)hgcmObjReference (pMsg->u32ClientId, HGCMOBJ_CLIENT);
+                HGCMClient *pClient = (HGCMClient *)hgcmObjReference(pMsg->u32ClientId, HGCMOBJ_CLIENT);
 
                 if (pClient)
                 {
                     if (pSvc->m_fntable.pfnLoadState)
                     {
-                        rc = pSvc->m_fntable.pfnLoadState (pSvc->m_fntable.pvService, pMsg->u32ClientId, HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM);
+                        rc = pSvc->m_fntable.pfnLoadState(pSvc->m_fntable.pvService, pMsg->u32ClientId,
+                                                          HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM);
                     }
 
-                    hgcmObjDereference (pClient);
+                    hgcmObjDereference(pClient);
                 }
                 else
                 {
@@ -653,7 +663,7 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 LogFlowFunc(("SVC_MSG_SAVESTATE\n"));
 
-                HGCMClient *pClient = (HGCMClient *)hgcmObjReference (pMsg->u32ClientId, HGCMOBJ_CLIENT);
+                HGCMClient *pClient = (HGCMClient *)hgcmObjReference(pMsg->u32ClientId, HGCMOBJ_CLIENT);
 
                 rc = VINF_SUCCESS;
 
@@ -662,11 +672,12 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                     if (pSvc->m_fntable.pfnSaveState)
                     {
                         g_fSaveState = true;
-                        rc = pSvc->m_fntable.pfnSaveState (pSvc->m_fntable.pvService, pMsg->u32ClientId, HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM);
+                        rc = pSvc->m_fntable.pfnSaveState(pSvc->m_fntable.pvService, pMsg->u32ClientId,
+                                                          HGCM_CLIENT_DATA(pSvc, pClient), pMsg->pSSM);
                         g_fSaveState = false;
                     }
 
-                    hgcmObjDereference (pClient);
+                    hgcmObjDereference(pClient);
                 }
                 else
                 {
@@ -688,7 +699,8 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 {
                     if (pSvc->m_fntable.pfnRegisterExtension)
                     {
-                        rc = pSvc->m_fntable.pfnRegisterExtension (pSvc->m_fntable.pvService, pMsg->pfnExtension, pMsg->pvExtension);
+                        rc = pSvc->m_fntable.pfnRegisterExtension(pSvc->m_fntable.pvService, pMsg->pfnExtension,
+                                                                  pMsg->pvExtension);
                     }
                     else
                     {
@@ -716,7 +728,7 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 {
                     if (pSvc->m_fntable.pfnRegisterExtension)
                     {
-                        rc = pSvc->m_fntable.pfnRegisterExtension (pSvc->m_fntable.pvService, NULL, NULL);
+                        rc = pSvc->m_fntable.pfnRegisterExtension(pSvc->m_fntable.pvService, NULL, NULL);
                     }
                     else
                     {
@@ -744,7 +756,7 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
     }
 }
 
-/* static */ DECLCALLBACK(void) HGCMService::svcHlpCallComplete (VBOXHGCMCALLHANDLE callHandle, int32_t rc)
+/* static */ DECLCALLBACK(void) HGCMService::svcHlpCallComplete(VBOXHGCMCALLHANDLE callHandle, int32_t rc)
 {
    HGCMMsgCore *pMsgCore = (HGCMMsgCore *)callHandle;
 
@@ -754,25 +766,25 @@ DECLCALLBACK(void) hgcmServiceThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
         * is called by the service, and the service does not get
         * any other messages.
         */
-       hgcmMsgComplete (pMsgCore, rc);
+       hgcmMsgComplete(pMsgCore, rc);
    }
    else
    {
-       AssertFailed ();
+       AssertFailed();
    }
 }
 
-/* static */ DECLCALLBACK(void) HGCMService::svcHlpDisconnectClient (void *pvInstance, uint32_t u32ClientId)
+/* static */ DECLCALLBACK(void) HGCMService::svcHlpDisconnectClient(void *pvInstance, uint32_t u32ClientId)
 {
      HGCMService *pService = static_cast <HGCMService *> (pvInstance);
 
      if (pService)
      {
-         pService->DisconnectClient (u32ClientId, true);
+         pService->DisconnectClient(u32ClientId, true);
      }
 }
 
-static DECLCALLBACK(void) hgcmMsgCompletionCallback (int32_t result, HGCMMsgCore *pMsgCore)
+static DECLCALLBACK(void) hgcmMsgCompletionCallback(int32_t result, HGCMMsgCore *pMsgCore)
 {
     /* Call the VMMDev port interface to issue IRQ notification. */
     HGCMMsgHeader *pMsgHdr = (HGCMMsgHeader *)pMsgCore;
@@ -781,7 +793,7 @@ static DECLCALLBACK(void) hgcmMsgCompletionCallback (int32_t result, HGCMMsgCore
 
     if (pMsgHdr->pHGCMPort && !g_fResetting)
     {
-        pMsgHdr->pHGCMPort->pfnCompleted (pMsgHdr->pHGCMPort, g_fSaveState? VINF_HGCM_SAVE_STATE: result, pMsgHdr->pCmd);
+        pMsgHdr->pHGCMPort->pfnCompleted(pMsgHdr->pHGCMPort, g_fSaveState? VINF_HGCM_SAVE_STATE: result, pMsgHdr->pCmd);
     }
 }
 
@@ -789,32 +801,32 @@ static DECLCALLBACK(void) hgcmMsgCompletionCallback (int32_t result, HGCMMsgCore
  * The main HGCM methods of the service.
  */
 
-int HGCMService::instanceCreate (const char *pszServiceLibrary, const char *pszServiceName)
+int HGCMService::instanceCreate(const char *pszServiceLibrary, const char *pszServiceName)
 {
     LogFlowFunc(("name %s, lib %s\n", pszServiceName, pszServiceLibrary));
 
     /* The maximum length of the thread name, allowed by the RT is 15. */
     char szThreadName[16];
-    if (!strncmp (pszServiceName, RT_STR_TUPLE("VBoxShared")))
-        RTStrPrintf (szThreadName, sizeof (szThreadName), "Sh%s", pszServiceName + 10);
-    else if (!strncmp (pszServiceName, RT_STR_TUPLE("VBox")))
-        RTStrCopy (szThreadName, sizeof (szThreadName), pszServiceName + 4);
+    if (!strncmp(pszServiceName, RT_STR_TUPLE("VBoxShared")))
+        RTStrPrintf(szThreadName, sizeof(szThreadName), "Sh%s", pszServiceName + 10);
+    else if (!strncmp(pszServiceName, RT_STR_TUPLE("VBox")))
+        RTStrCopy(szThreadName, sizeof(szThreadName), pszServiceName + 4);
     else
-        RTStrCopy (szThreadName, sizeof (szThreadName), pszServiceName);
+        RTStrCopy(szThreadName, sizeof(szThreadName), pszServiceName);
 
-    int rc = hgcmThreadCreate (&m_thread, szThreadName, hgcmServiceThread, this);
+    int rc = hgcmThreadCreate(&m_thread, szThreadName, hgcmServiceThread, this);
 
     if (RT_SUCCESS(rc))
     {
-        m_pszSvcName    = RTStrDup (pszServiceName);
-        m_pszSvcLibrary = RTStrDup (pszServiceLibrary);
+        m_pszSvcName    = RTStrDup(pszServiceName);
+        m_pszSvcLibrary = RTStrDup(pszServiceLibrary);
 
         if (!m_pszSvcName || !m_pszSvcLibrary)
         {
-            RTStrFree (m_pszSvcLibrary);
+            RTStrFree(m_pszSvcLibrary);
             m_pszSvcLibrary = NULL;
 
-            RTStrFree (m_pszSvcName);
+            RTStrFree(m_pszSvcName);
             m_pszSvcName = NULL;
 
             rc = VERR_NO_MEMORY;
@@ -828,45 +840,45 @@ int HGCMService::instanceCreate (const char *pszServiceLibrary, const char *pszS
 
             /* Execute the load request on the service thread. */
             HGCMMSGHANDLE hMsg;
-            rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_LOAD, hgcmMessageAllocSvc);
+            rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_LOAD, hgcmMessageAllocSvc);
 
             if (RT_SUCCESS(rc))
             {
-                rc = hgcmMsgSend (hMsg);
+                rc = hgcmMsgSend(hMsg);
             }
         }
     }
 
     if (RT_FAILURE(rc))
     {
-        instanceDestroy ();
+        instanceDestroy();
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
     return rc;
 }
 
-void HGCMService::instanceDestroy (void)
+void HGCMService::instanceDestroy(void)
 {
     LogFlowFunc(("%s\n", m_pszSvcName));
 
     HGCMMSGHANDLE hMsg;
-    int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_UNLOAD, hgcmMessageAllocSvc);
+    int rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_UNLOAD, hgcmMessageAllocSvc);
 
     if (RT_SUCCESS(rc))
     {
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
 
         if (RT_SUCCESS(rc))
         {
-            hgcmThreadWait (m_thread);
+            hgcmThreadWait(m_thread);
         }
     }
 
-    RTStrFree (m_pszSvcLibrary);
+    RTStrFree(m_pszSvcLibrary);
     m_pszSvcLibrary = NULL;
 
-    RTStrFree (m_pszSvcName);
+    RTStrFree(m_pszSvcName);
     m_pszSvcName = NULL;
 }
 
@@ -875,44 +887,44 @@ int HGCMService::saveClientState(uint32_t u32ClientId, PSSMHANDLE pSSM)
     LogFlowFunc(("%s\n", m_pszSvcName));
 
     HGCMMSGHANDLE hMsg;
-    int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_SAVESTATE, hgcmMessageAllocSvc);
+    int rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_SAVESTATE, hgcmMessageAllocSvc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgLoadSaveStateClient *pMsg = (HGCMMsgLoadSaveStateClient *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgLoadSaveStateClient *pMsg = (HGCMMsgLoadSaveStateClient *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->u32ClientId = u32ClientId;
         pMsg->pSSM        = pSSM;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
     return rc;
 }
 
-int HGCMService::loadClientState (uint32_t u32ClientId, PSSMHANDLE pSSM)
+int HGCMService::loadClientState(uint32_t u32ClientId, PSSMHANDLE pSSM)
 {
     LogFlowFunc(("%s\n", m_pszSvcName));
 
     HGCMMSGHANDLE hMsg;
-    int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_LOADSTATE, hgcmMessageAllocSvc);
+    int rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_LOADSTATE, hgcmMessageAllocSvc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgLoadSaveStateClient *pMsg = (HGCMMsgLoadSaveStateClient *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgLoadSaveStateClient *pMsg = (HGCMMsgLoadSaveStateClient *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
 
         AssertRelease(pMsg);
 
         pMsg->u32ClientId = u32ClientId;
         pMsg->pSSM        = pSSM;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -927,25 +939,25 @@ int HGCMService::loadClientState (uint32_t u32ClientId, PSSMHANDLE pSSM)
  * @return VBox rc.
  * @thread main HGCM
  */
-/* static */ int HGCMService::LoadService (const char *pszServiceLibrary, const char *pszServiceName)
+/* static */ int HGCMService::LoadService(const char *pszServiceLibrary, const char *pszServiceName)
 {
     LogFlowFunc(("lib %s, name = %s\n", pszServiceLibrary, pszServiceName));
 
     /* Look at already loaded services to avoid double loading. */
 
     HGCMService *pSvc;
-    int rc = HGCMService::ResolveService (&pSvc, pszServiceName);
+    int rc = HGCMService::ResolveService(&pSvc, pszServiceName);
 
     if (RT_SUCCESS(rc))
     {
         /* The service is already loaded. */
-        pSvc->ReleaseService ();
+        pSvc->ReleaseService();
         rc = VERR_HGCM_SERVICE_EXISTS;
     }
     else
     {
         /* Create the new service. */
-        pSvc = new HGCMService ();
+        pSvc = new HGCMService();
 
         if (!pSvc)
         {
@@ -954,7 +966,7 @@ int HGCMService::loadClientState (uint32_t u32ClientId, PSSMHANDLE pSSM)
         else
         {
             /* Load the library and call the initialization entry point. */
-            rc = pSvc->instanceCreate (pszServiceLibrary, pszServiceName);
+            rc = pSvc->instanceCreate(pszServiceLibrary, pszServiceName);
 
             if (RT_SUCCESS(rc))
             {
@@ -976,8 +988,8 @@ int HGCMService::loadClientState (uint32_t u32ClientId, PSSMHANDLE pSSM)
                 sm_cServices++;
 
                 /* Reference the service (for first time) until it is unloaded on HGCM termination. */
-                AssertRelease (pSvc->m_u32RefCnt == 0);
-                pSvc->ReferenceService ();
+                AssertRelease(pSvc->m_u32RefCnt == 0);
+                pSvc->ReferenceService();
 
                 LogFlowFunc(("service %p\n", pSvc));
             }
@@ -992,7 +1004,7 @@ int HGCMService::loadClientState (uint32_t u32ClientId, PSSMHANDLE pSSM)
  *
  * @thread main HGCM
  */
-void HGCMService::UnloadService (void)
+void HGCMService::UnloadService(void)
 {
     LogFlowFunc(("name = %s\n", m_pszSvcName));
 
@@ -1019,21 +1031,21 @@ void HGCMService::UnloadService (void)
 
     /* The service must be unloaded only if all clients were disconnected. */
     LogFlowFunc(("m_u32RefCnt = %d\n", m_u32RefCnt));
-    AssertRelease (m_u32RefCnt == 1);
+    AssertRelease(m_u32RefCnt == 1);
 
     /* Now the service can be released. */
-    ReleaseService ();
+    ReleaseService();
 }
 
 /** The method unloads all services.
  *
  * @thread main HGCM
  */
-/* static */ void HGCMService::UnloadAll (void)
+/* static */ void HGCMService::UnloadAll(void)
 {
     while (sm_pSvcListHead)
     {
-        sm_pSvcListHead->UnloadService ();
+        sm_pSvcListHead->UnloadService();
     }
 }
 
@@ -1046,7 +1058,7 @@ void HGCMService::UnloadService (void)
  * @return VBox rc.
  * @thread main HGCM
  */
-/* static */ int HGCMService::ResolveService (HGCMService **ppSvc, const char *pszServiceName)
+/* static */ int HGCMService::ResolveService(HGCMService **ppSvc, const char *pszServiceName)
 {
     LogFlowFunc(("ppSvc = %p name = %s\n",
                  ppSvc, pszServiceName));
@@ -1060,7 +1072,7 @@ void HGCMService::UnloadService (void)
 
     while (pSvc)
     {
-        if (strcmp (pSvc->m_pszSvcName, pszServiceName) == 0)
+        if (strcmp(pSvc->m_pszSvcName, pszServiceName) == 0)
         {
             break;
         }
@@ -1076,7 +1088,7 @@ void HGCMService::UnloadService (void)
         return VERR_HGCM_SERVICE_NOT_FOUND;
     }
 
-    pSvc->ReferenceService ();
+    pSvc->ReferenceService();
 
     *ppSvc = pSvc;
 
@@ -1087,9 +1099,9 @@ void HGCMService::UnloadService (void)
  *
  * @thread main HGCM
  */
-void HGCMService::ReferenceService (void)
+void HGCMService::ReferenceService(void)
 {
-    ASMAtomicIncU32 (&m_u32RefCnt);
+    ASMAtomicIncU32(&m_u32RefCnt);
     LogFlowFunc(("[%s] m_u32RefCnt = %d\n", m_pszSvcName, m_u32RefCnt));
 }
 
@@ -1097,17 +1109,17 @@ void HGCMService::ReferenceService (void)
  *
  * @thread main HGCM
  */
-void HGCMService::ReleaseService (void)
+void HGCMService::ReleaseService(void)
 {
     LogFlowFunc(("m_u32RefCnt = %d\n", m_u32RefCnt));
-    uint32_t u32RefCnt = ASMAtomicDecU32 (&m_u32RefCnt);
+    uint32_t u32RefCnt = ASMAtomicDecU32(&m_u32RefCnt);
     AssertRelease(u32RefCnt != ~0U);
 
     LogFlowFunc(("u32RefCnt = %d, name %s\n", u32RefCnt, m_pszSvcName));
 
     if (u32RefCnt == 0)
     {
-        instanceDestroy ();
+        instanceDestroy();
         delete this;
     }
 }
@@ -1117,7 +1129,7 @@ void HGCMService::ReleaseService (void)
  *
  * @thread main HGCM
  */
-/* static */ void HGCMService::Reset (void)
+/* static */ void HGCMService::Reset(void)
 {
     g_fResetting = true;
 
@@ -1128,7 +1140,7 @@ void HGCMService::ReleaseService (void)
         while (pSvc->m_cClients && pSvc->m_paClientIds)
         {
             LogFlowFunc(("handle %d\n", pSvc->m_paClientIds[0]));
-            pSvc->DisconnectClient (pSvc->m_paClientIds[0], false);
+            pSvc->DisconnectClient(pSvc->m_paClientIds[0], false);
         }
 
 #ifdef VBOX_WITH_CRHGSMI
@@ -1136,8 +1148,8 @@ void HGCMService::ReleaseService (void)
         HGCMService *pNextSvc = pSvc->m_pSvcNext;
         while (pSvc->m_cHandleAcquires)
         {
-            pSvc->HandleReleased ();
-            pSvc->ReleaseService ();
+            pSvc->HandleReleased();
+            pSvc->ReleaseService();
         }
         pSvc = pNextSvc;
 #else
@@ -1154,7 +1166,7 @@ void HGCMService::ReleaseService (void)
  * @return VBox rc.
  * @thread main HGCM
  */
-/* static */ int HGCMService::SaveState (PSSMHANDLE pSSM)
+/* static */ int HGCMService::SaveState(PSSMHANDLE pSSM)
 {
     /* Save the current handle count and restore afterwards to avoid client id conflicts. */
     int rc = SSMR3PutU32(pSSM, hgcmObjQueryHandleCount());
@@ -1202,7 +1214,7 @@ void HGCMService::ReleaseService (void)
             AssertRCReturn(rc, rc);
 
             /* Call the service, so the operation is executed by the service thread. */
-            rc = pSvc->saveClientState (u32ClientId, pSSM);
+            rc = pSvc->saveClientState(u32ClientId, pSSM);
             AssertRCReturn(rc, rc);
         }
 
@@ -1218,7 +1230,7 @@ void HGCMService::ReleaseService (void)
  * @return VBox rc.
  * @thread main HGCM
  */
-/* static */ int HGCMService::LoadState (PSSMHANDLE pSSM)
+/* static */ int HGCMService::LoadState(PSSMHANDLE pSSM)
 {
     /* Restore handle count to avoid client id conflicts. */
     uint32_t u32;
@@ -1243,7 +1255,7 @@ void HGCMService::ReleaseService (void)
         AssertRCReturn(rc, rc);
         AssertReturn(u32 <= VBOX_HGCM_SVC_NAME_MAX_BYTES, VERR_SSM_UNEXPECTED_DATA);
 
-        char *pszServiceName = (char *)alloca (u32);
+        char *pszServiceName = (char *)alloca(u32);
 
         /* Get the service name. */
         rc = SSMR3GetStrZ(pSSM, pszServiceName, u32);
@@ -1253,7 +1265,7 @@ void HGCMService::ReleaseService (void)
 
         /* Resolve the service instance. */
         HGCMService *pSvc;
-        rc = ResolveService (&pSvc, pszServiceName);
+        rc = ResolveService(&pSvc, pszServiceName);
         AssertLogRelMsgReturn(pSvc, ("rc=%Rrc, %s\n", rc, pszServiceName), VERR_SSM_UNEXPECTED_DATA);
 
         /* Get the number of clients. */
@@ -1261,7 +1273,7 @@ void HGCMService::ReleaseService (void)
         rc = SSMR3GetU32(pSSM, &cClients);
         if (RT_FAILURE(rc))
         {
-            pSvc->ReleaseService ();
+            pSvc->ReleaseService();
             AssertFailed();
             return rc;
         }
@@ -1273,31 +1285,31 @@ void HGCMService::ReleaseService (void)
             rc = SSMR3GetU32(pSSM, &u32ClientId);
             if (RT_FAILURE(rc))
             {
-                pSvc->ReleaseService ();
+                pSvc->ReleaseService();
                 AssertFailed();
                 return rc;
             }
 
             /* Connect the client. */
-            rc = pSvc->CreateAndConnectClient (NULL, u32ClientId);
+            rc = pSvc->CreateAndConnectClient(NULL, u32ClientId);
             if (RT_FAILURE(rc))
             {
-                pSvc->ReleaseService ();
+                pSvc->ReleaseService();
                 AssertLogRelMsgFailed(("rc=%Rrc %s\n", rc, pszServiceName));
                 return rc;
             }
 
             /* Call the service, so the operation is executed by the service thread. */
-            rc = pSvc->loadClientState (u32ClientId, pSSM);
+            rc = pSvc->loadClientState(u32ClientId, pSSM);
             if (RT_FAILURE(rc))
             {
-                pSvc->ReleaseService ();
+                pSvc->ReleaseService();
                 AssertLogRelMsgFailed(("rc=%Rrc %s\n", rc, pszServiceName));
                 return rc;
             }
         }
 
-        pSvc->ReleaseService ();
+        pSvc->ReleaseService();
     }
 
     return VINF_SUCCESS;
@@ -1310,12 +1322,12 @@ void HGCMService::ReleaseService (void)
  * @param u32ClientIdIn   The handle for the client, when 'pu32ClientIdOut' is NULL.
  * @return VBox rc.
  */
-int HGCMService::CreateAndConnectClient (uint32_t *pu32ClientIdOut, uint32_t u32ClientIdIn)
+int HGCMService::CreateAndConnectClient(uint32_t *pu32ClientIdOut, uint32_t u32ClientIdIn)
 {
     LogFlowFunc(("pu32ClientIdOut = %p, u32ClientIdIn = %d\n", pu32ClientIdOut, u32ClientIdIn));
 
     /* Allocate a client information structure. */
-    HGCMClient *pClient = new HGCMClient ();
+    HGCMClient *pClient = new HGCMClient();
 
     if (!pClient)
     {
@@ -1327,11 +1339,11 @@ int HGCMService::CreateAndConnectClient (uint32_t *pu32ClientIdOut, uint32_t u32
 
     if (pu32ClientIdOut != NULL)
     {
-        handle = hgcmObjGenerateHandle (pClient);
+        handle = hgcmObjGenerateHandle(pClient);
     }
     else
     {
-        handle = hgcmObjAssignHandle (pClient, u32ClientIdIn);
+        handle = hgcmObjAssignHandle(pClient, u32ClientIdIn);
     }
 
     LogFlowFunc(("client id = %d\n", handle));
@@ -1339,32 +1351,33 @@ int HGCMService::CreateAndConnectClient (uint32_t *pu32ClientIdOut, uint32_t u32
     AssertRelease(handle);
 
     /* Initialize the HGCM part of the client. */
-    int rc = pClient->Init (this);
+    int rc = pClient->Init(this);
 
     if (RT_SUCCESS(rc))
     {
         /* Call the service. */
         HGCMMSGHANDLE hMsg;
 
-        rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_CONNECT, hgcmMessageAllocSvc);
+        rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_CONNECT, hgcmMessageAllocSvc);
 
         if (RT_SUCCESS(rc))
         {
-            HGCMMsgSvcConnect *pMsg = (HGCMMsgSvcConnect *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+            HGCMMsgSvcConnect *pMsg = (HGCMMsgSvcConnect *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
             AssertRelease(pMsg);
 
             pMsg->u32ClientId = handle;
 
-            hgcmObjDereference (pMsg);
+            hgcmObjDereference(pMsg);
 
-            rc = hgcmMsgSend (hMsg);
+            rc = hgcmMsgSend(hMsg);
 
             if (RT_SUCCESS(rc))
             {
                 /* Add the client Id to the array. */
                 if (m_cClients == m_cClientsAllocated)
                 {
-                    m_paClientIds = (uint32_t *)RTMemRealloc (m_paClientIds, (m_cClientsAllocated + 64) * sizeof (m_paClientIds[0]));
+                    m_paClientIds = (uint32_t *)RTMemRealloc(m_paClientIds, (m_cClientsAllocated + 64) *
+                                                             sizeof(m_paClientIds[0]));
                     Assert(m_paClientIds);
                     m_cClientsAllocated += 64;
                 }
@@ -1377,7 +1390,7 @@ int HGCMService::CreateAndConnectClient (uint32_t *pu32ClientIdOut, uint32_t u32
 
     if (RT_FAILURE(rc))
     {
-        hgcmObjDeleteHandle (handle);
+        hgcmObjDeleteHandle(handle);
     }
     else
     {
@@ -1386,7 +1399,7 @@ int HGCMService::CreateAndConnectClient (uint32_t *pu32ClientIdOut, uint32_t u32
             *pu32ClientIdOut = handle;
         }
 
-        ReferenceService ();
+        ReferenceService();
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -1398,7 +1411,7 @@ int HGCMService::CreateAndConnectClient (uint32_t *pu32ClientIdOut, uint32_t u32
  * @param u32ClientId  The handle of the client.
  * @return VBox rc.
  */
-int HGCMService::DisconnectClient (uint32_t u32ClientId, bool fFromService)
+int HGCMService::DisconnectClient(uint32_t u32ClientId, bool fFromService)
 {
     int rc = VINF_SUCCESS;
 
@@ -1409,18 +1422,18 @@ int HGCMService::DisconnectClient (uint32_t u32ClientId, bool fFromService)
         /* Call the service. */
         HGCMMSGHANDLE hMsg;
 
-        rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_DISCONNECT, hgcmMessageAllocSvc);
+        rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_DISCONNECT, hgcmMessageAllocSvc);
 
         if (RT_SUCCESS(rc))
         {
-            HGCMMsgSvcDisconnect *pMsg = (HGCMMsgSvcDisconnect *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+            HGCMMsgSvcDisconnect *pMsg = (HGCMMsgSvcDisconnect *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
             AssertRelease(pMsg);
 
             pMsg->u32ClientId = u32ClientId;
 
-            hgcmObjDereference (pMsg);
+            hgcmObjDereference(pMsg);
 
-            rc = hgcmMsgSend (hMsg);
+            rc = hgcmMsgSend(hMsg);
         }
         else
         {
@@ -1440,14 +1453,14 @@ int HGCMService::DisconnectClient (uint32_t u32ClientId, bool fFromService)
 
             if (m_cClients > i)
             {
-                memmove (&m_paClientIds[i], &m_paClientIds[i + 1], sizeof (m_paClientIds[0]) * (m_cClients - i));
+                memmove (&m_paClientIds[i], &m_paClientIds[i + 1], sizeof(m_paClientIds[0]) * (m_cClients - i));
             }
 
             /* Delete the client handle. */
-            hgcmObjDeleteHandle (u32ClientId);
+            hgcmObjDeleteHandle(u32ClientId);
 
             /* The service must be released. */
-            ReleaseService ();
+            ReleaseService();
 
             break;
         }
@@ -1457,50 +1470,50 @@ int HGCMService::DisconnectClient (uint32_t u32ClientId, bool fFromService)
     return rc;
 }
 
-int HGCMService::RegisterExtension (HGCMSVCEXTHANDLE handle,
-                                    PFNHGCMSVCEXT pfnExtension,
-                                    void *pvExtension)
+int HGCMService::RegisterExtension(HGCMSVCEXTHANDLE handle,
+                                   PFNHGCMSVCEXT pfnExtension,
+                                   void *pvExtension)
 {
     LogFlowFunc(("%s\n", handle->pszServiceName));
 
     /* Forward the message to the service thread. */
     HGCMMSGHANDLE hMsg = 0;
-    int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_REGEXT, hgcmMessageAllocSvc);
+    int rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_REGEXT, hgcmMessageAllocSvc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgSvcRegisterExtension *pMsg = (HGCMMsgSvcRegisterExtension *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgSvcRegisterExtension *pMsg = (HGCMMsgSvcRegisterExtension *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->handle       = handle;
         pMsg->pfnExtension = pfnExtension;
         pMsg->pvExtension  = pvExtension;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
     return rc;
 }
 
-void HGCMService::UnregisterExtension (HGCMSVCEXTHANDLE handle)
+void HGCMService::UnregisterExtension(HGCMSVCEXTHANDLE handle)
 {
     /* Forward the message to the service thread. */
     HGCMMSGHANDLE hMsg = 0;
-    int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_UNREGEXT, hgcmMessageAllocSvc);
+    int rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_UNREGEXT, hgcmMessageAllocSvc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgSvcUnregisterExtension *pMsg = (HGCMMsgSvcUnregisterExtension *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgSvcUnregisterExtension *pMsg = (HGCMMsgSvcUnregisterExtension *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->handle = handle;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -1516,17 +1529,18 @@ void HGCMService::UnregisterExtension (HGCMSVCEXTHANDLE handle)
  * @param paParms        Pointer to array of parameters.
  * @return VBox rc.
  */
-int HGCMService::GuestCall (PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t u32ClientId, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[])
+int HGCMService::GuestCall(PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t u32ClientId, uint32_t u32Function,
+                           uint32_t cParms, VBOXHGCMSVCPARM paParms[])
 {
     HGCMMSGHANDLE hMsg = 0;
 
     LogFlow(("MAIN::HGCMService::Call\n"));
 
-    int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_GUESTCALL, hgcmMessageAllocSvc);
+    int rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_GUESTCALL, hgcmMessageAllocSvc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgCall *pMsg = (HGCMMsgCall *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgCall *pMsg = (HGCMMsgCall *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
 
         AssertRelease(pMsg);
 
@@ -1538,9 +1552,9 @@ int HGCMService::GuestCall (PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t
         pMsg->cParms      = cParms;
         pMsg->paParms     = paParms;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgPost (hMsg, hgcmMsgCompletionCallback);
+        rc = hgcmMsgPost(hMsg, hgcmMsgCompletionCallback);
     }
     else
     {
@@ -1558,26 +1572,26 @@ int HGCMService::GuestCall (PPDMIHGCMPORT pHGCMPort, PVBOXHGCMCMD pCmd, uint32_t
  * @param paParms        Pointer to array of parameters.
  * @return VBox rc.
  */
-int HGCMService::HostCall (uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM *paParms)
+int HGCMService::HostCall(uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM *paParms)
 {
     LogFlowFunc(("%s u32Function = %d, cParms = %d, paParms = %p\n",
                  m_pszSvcName, u32Function, cParms, paParms));
 
     HGCMMSGHANDLE hMsg = 0;
-    int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_HOSTCALL, hgcmMessageAllocSvc);
+    int rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_HOSTCALL, hgcmMessageAllocSvc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgHostCallSvc *pMsg = (HGCMMsgHostCallSvc *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgHostCallSvc *pMsg = (HGCMMsgHostCallSvc *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->u32Function      = u32Function;
         pMsg->cParms           = cParms;
         pMsg->paParms          = paParms;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -1585,7 +1599,7 @@ int HGCMService::HostCall (uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPAR
 }
 
 #ifdef VBOX_WITH_CRHGSMI
-static DECLCALLBACK(void) hgcmMsgFastCallCompletionCallback (int32_t result, HGCMMsgCore *pMsgCore)
+static DECLCALLBACK(void) hgcmMsgFastCallCompletionCallback(int32_t result, HGCMMsgCore *pMsgCore)
 {
     /* Call the VMMDev port interface to issue IRQ notification. */
     LogFlow(("MAIN::hgcmMsgFastCallCompletionCallback: message %p\n", pMsgCore));
@@ -1593,7 +1607,7 @@ static DECLCALLBACK(void) hgcmMsgFastCallCompletionCallback (int32_t result, HGC
     HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)pMsgCore;
     if (pMsg->pfnCompletion)
     {
-        pMsg->pfnCompletion (result, pMsg->u32Function, &pMsg->Param, pMsg->pvCompletion);
+        pMsg->pfnCompletion(result, pMsg->u32Function, &pMsg->Param, pMsg->pvCompletion);
     }
 }
 
@@ -1614,17 +1628,18 @@ int HGCMService::HandleReleased()
     return VERR_INVALID_STATE;
 }
 
-int HGCMService::HostFastCallAsync (uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion)
+int HGCMService::HostFastCallAsync(uint32_t u32Function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion,
+                                   void *pvCompletion)
 {
     LogFlowFunc(("%s u32Function = %d, pParm = %p\n",
                  m_pszSvcName, u32Function, pParm));
 
     HGCMMSGHANDLE hMsg = 0;
-    int rc = hgcmMsgAlloc (m_thread, &hMsg, SVC_MSG_HOSTFASTCALLASYNC, hgcmMessageAllocSvc);
+    int rc = hgcmMsgAlloc(m_thread, &hMsg, SVC_MSG_HOSTFASTCALLASYNC, hgcmMessageAllocSvc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgHostFastCallAsyncSvc *pMsg = (HGCMMsgHostFastCallAsyncSvc *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->u32Function      = u32Function;
@@ -1632,7 +1647,7 @@ int HGCMService::HostFastCallAsync (uint32_t u32Function, VBOXHGCMSVCPARM *pParm
         pMsg->pfnCompletion = pfnCompletion;
         pMsg->pvCompletion = pvCompletion;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
         rc = hgcmMsgPost(hMsg, hgcmMsgFastCallCompletionCallback);
     }
@@ -1758,16 +1773,16 @@ static HGCMMsgCore *hgcmMainMessageAlloc (uint32_t u32MsgId)
 {
     switch (u32MsgId)
     {
-        case HGCM_MSG_CONNECT:    return new HGCMMsgMainConnect ();
-        case HGCM_MSG_DISCONNECT: return new HGCMMsgMainDisconnect ();
-        case HGCM_MSG_LOAD:       return new HGCMMsgMainLoad ();
-        case HGCM_MSG_HOSTCALL:   return new HGCMMsgMainHostCall ();
+        case HGCM_MSG_CONNECT:    return new HGCMMsgMainConnect();
+        case HGCM_MSG_DISCONNECT: return new HGCMMsgMainDisconnect();
+        case HGCM_MSG_LOAD:       return new HGCMMsgMainLoad();
+        case HGCM_MSG_HOSTCALL:   return new HGCMMsgMainHostCall();
         case HGCM_MSG_LOADSTATE:
-        case HGCM_MSG_SAVESTATE:  return new HGCMMsgMainLoadSaveState ();
-        case HGCM_MSG_RESET:      return new HGCMMsgMainReset ();
-        case HGCM_MSG_QUIT:       return new HGCMMsgMainQuit ();
-        case HGCM_MSG_REGEXT:     return new HGCMMsgMainRegisterExtension ();
-        case HGCM_MSG_UNREGEXT:   return new HGCMMsgMainUnregisterExtension ();
+        case HGCM_MSG_SAVESTATE:  return new HGCMMsgMainLoadSaveState();
+        case HGCM_MSG_RESET:      return new HGCMMsgMainReset();
+        case HGCM_MSG_QUIT:       return new HGCMMsgMainQuit();
+        case HGCM_MSG_REGEXT:     return new HGCMMsgMainRegisterExtension();
+        case HGCM_MSG_UNREGEXT:   return new HGCMMsgMainUnregisterExtension();
 #ifdef VBOX_WITH_CRHGSMI
         case HGCM_MSG_SVCAQUIRE: return new HGCMMsgMainSvcAcquire();
         case HGCM_MSG_SVCRELEASE: return new HGCMMsgMainSvcRelease();
@@ -1782,7 +1797,7 @@ static HGCMMsgCore *hgcmMainMessageAlloc (uint32_t u32MsgId)
 
 
 /* The main HGCM thread handler. */
-static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUser)
+static DECLCALLBACK(void) hgcmThread(HGCMTHREADHANDLE ThreadHandle, void *pvUser)
 {
     LogFlowFunc(("ThreadHandle = %p, pvUser = %p\n",
                  ThreadHandle, pvUser));
@@ -1794,16 +1809,16 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
     while (!fQuit)
     {
         HGCMMsgCore *pMsgCore;
-        int rc = hgcmMsgGet (ThreadHandle, &pMsgCore);
+        int rc = hgcmMsgGet(ThreadHandle, &pMsgCore);
 
         if (RT_FAILURE(rc))
         {
             /* The error means some serious unrecoverable problem in the hgcmMsg/hgcmThread layer. */
-            AssertMsgFailed (("%Rrc\n", rc));
+            AssertMsgFailed(("%Rrc\n", rc));
             break;
         }
 
-        uint32_t u32MsgId = pMsgCore->MsgId ();
+        uint32_t u32MsgId = pMsgCore->MsgId();
 
         switch (u32MsgId)
         {
@@ -1817,15 +1832,15 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 /* Resolve the service name to the pointer to service instance.
                  */
                 HGCMService *pService;
-                rc = HGCMService::ResolveService (&pService, pMsg->pszServiceName);
+                rc = HGCMService::ResolveService(&pService, pMsg->pszServiceName);
 
                 if (RT_SUCCESS(rc))
                 {
                     /* Call the service instance method. */
-                    rc = pService->CreateAndConnectClient (pMsg->pu32ClientId, 0);
+                    rc = pService->CreateAndConnectClient(pMsg->pu32ClientId, 0);
 
                     /* Release the service after resolve. */
-                    pService->ReleaseService ();
+                    pService->ReleaseService();
                 }
             } break;
 
@@ -1836,7 +1851,7 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 LogFlowFunc(("HGCM_MSG_DISCONNECT u32ClientId = %d\n",
                              pMsg->u32ClientId));
 
-                HGCMClient *pClient = (HGCMClient *)hgcmObjReference (pMsg->u32ClientId, HGCMOBJ_CLIENT);
+                HGCMClient *pClient = (HGCMClient *)hgcmObjReference(pMsg->u32ClientId, HGCMOBJ_CLIENT);
 
                 if (!pClient)
                 {
@@ -1848,9 +1863,9 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 HGCMService *pService = pClient->pService;
 
                 /* Call the service instance to disconnect the client. */
-                rc = pService->DisconnectClient (pMsg->u32ClientId, false);
+                rc = pService->DisconnectClient(pMsg->u32ClientId, false);
 
-                hgcmObjDereference (pClient);
+                hgcmObjDereference(pClient);
             } break;
 
             case HGCM_MSG_LOAD:
@@ -1860,7 +1875,7 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 LogFlowFunc(("HGCM_MSG_LOAD pszServiceName = %s, pMsg->pszServiceLibrary = %s\n",
                              pMsg->pszServiceName, pMsg->pszServiceLibrary));
 
-                rc = HGCMService::LoadService (pMsg->pszServiceLibrary, pMsg->pszServiceName);
+                rc = HGCMService::LoadService(pMsg->pszServiceLibrary, pMsg->pszServiceName);
             } break;
 
             case HGCM_MSG_HOSTCALL:
@@ -1872,13 +1887,13 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 /* Resolve the service name to the pointer to service instance. */
                 HGCMService *pService;
-                rc = HGCMService::ResolveService (&pService, pMsg->pszServiceName);
+                rc = HGCMService::ResolveService(&pService, pMsg->pszServiceName);
 
                 if (RT_SUCCESS(rc))
                 {
-                    rc = pService->HostCall (pMsg->u32Function, pMsg->cParms, pMsg->paParms);
+                    rc = pService->HostCall(pMsg->u32Function, pMsg->cParms, pMsg->paParms);
 
-                    pService->ReleaseService ();
+                    pService->ReleaseService();
                 }
             } break;
 
@@ -1891,17 +1906,17 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 /* Resolve the service name to the pointer to service instance. */
                 HGCMService *pService;
-                rc = HGCMService::ResolveService (&pService, pMsg->pszServiceName);
+                rc = HGCMService::ResolveService(&pService, pMsg->pszServiceName);
                 if (RT_SUCCESS(rc))
                 {
-                    rc = pService->HandleAcquired ();
+                    rc = pService->HandleAcquired();
                     if (RT_SUCCESS(rc))
                     {
                         pMsg->pService = pService;
                     }
                     else
                     {
-                        pService->ReleaseService ();
+                        pService->ReleaseService();
                     }
                 }
             } break;
@@ -1914,10 +1929,10 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 /* Resolve the service name to the pointer to service instance. */
 
-                rc = pMsg->pService->HandleReleased ();
+                rc = pMsg->pService->HandleReleased();
                 if (RT_SUCCESS(rc))
                 {
-                    pMsg->pService->ReleaseService ();
+                    pMsg->pService->ReleaseService();
                 }
             } break;
 #endif
@@ -1926,7 +1941,7 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
             {
                 LogFlowFunc(("HGCM_MSG_RESET\n"));
 
-                HGCMService::Reset ();
+                HGCMService::Reset();
             } break;
 
             case HGCM_MSG_LOADSTATE:
@@ -1935,7 +1950,7 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 LogFlowFunc(("HGCM_MSG_LOADSTATE\n"));
 
-                rc = HGCMService::LoadState (pMsg->pSSM);
+                rc = HGCMService::LoadState(pMsg->pSSM);
             } break;
 
             case HGCM_MSG_SAVESTATE:
@@ -1944,14 +1959,14 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
 
                 LogFlowFunc(("HGCM_MSG_SAVESTATE\n"));
 
-                rc = HGCMService::SaveState (pMsg->pSSM);
+                rc = HGCMService::SaveState(pMsg->pSSM);
             } break;
 
             case HGCM_MSG_QUIT:
             {
                 LogFlowFunc(("HGCM_MSG_QUIT\n"));
 
-                HGCMService::UnloadAll ();
+                HGCMService::UnloadAll();
 
                 fQuit = true;
             } break;
@@ -1963,9 +1978,9 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 LogFlowFunc(("HGCM_MSG_REGEXT\n"));
 
                 /* Allocate the handle data. */
-                HGCMSVCEXTHANDLE handle = (HGCMSVCEXTHANDLE)RTMemAllocZ (sizeof (struct _HGCMSVCEXTHANDLEDATA)
-                                                                         + strlen (pMsg->pszServiceName)
-                                                                         + sizeof (char));
+                HGCMSVCEXTHANDLE handle = (HGCMSVCEXTHANDLE)RTMemAllocZ(sizeof(struct _HGCMSVCEXTHANDLEDATA)
+                                                                        + strlen(pMsg->pszServiceName)
+                                                                        + sizeof(char));
 
                 if (handle == NULL)
                 {
@@ -1973,22 +1988,22 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 }
                 else
                 {
-                    handle->pszServiceName = (char *)((uint8_t *)handle + sizeof (struct _HGCMSVCEXTHANDLEDATA));
-                    strcpy (handle->pszServiceName, pMsg->pszServiceName);
+                    handle->pszServiceName = (char *)((uint8_t *)handle + sizeof(struct _HGCMSVCEXTHANDLEDATA));
+                    strcpy(handle->pszServiceName, pMsg->pszServiceName);
 
                     HGCMService *pService;
-                    rc = HGCMService::ResolveService (&pService, handle->pszServiceName);
+                    rc = HGCMService::ResolveService(&pService, handle->pszServiceName);
 
                     if (RT_SUCCESS(rc))
                     {
-                        pService->RegisterExtension (handle, pMsg->pfnExtension, pMsg->pvExtension);
+                        pService->RegisterExtension(handle, pMsg->pfnExtension, pMsg->pvExtension);
 
-                        pService->ReleaseService ();
+                        pService->ReleaseService();
                     }
 
                     if (RT_FAILURE(rc))
                     {
-                        RTMemFree (handle);
+                        RTMemFree(handle);
                     }
                     else
                     {
@@ -2004,16 +2019,16 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
                 LogFlowFunc(("HGCM_MSG_UNREGEXT\n"));
 
                 HGCMService *pService;
-                rc = HGCMService::ResolveService (&pService, pMsg->handle->pszServiceName);
+                rc = HGCMService::ResolveService(&pService, pMsg->handle->pszServiceName);
 
                 if (RT_SUCCESS(rc))
                 {
-                    pService->UnregisterExtension (pMsg->handle);
+                    pService->UnregisterExtension(pMsg->handle);
 
-                    pService->ReleaseService ();
+                    pService->ReleaseService();
                 }
 
-                RTMemFree (pMsg->handle);
+                RTMemFree(pMsg->handle);
             } break;
 
             default:
@@ -2024,7 +2039,7 @@ static DECLCALLBACK(void) hgcmThread (HGCMTHREADHANDLE ThreadHandle, void *pvUse
         }
 
         /* Complete the message processing. */
-        hgcmMsgComplete (pMsgCore, rc);
+        hgcmMsgComplete(pMsgCore, rc);
 
         LogFlowFunc(("message processed %Rrc\n", rc));
     }
@@ -2052,8 +2067,8 @@ static HGCMTHREADHANDLE g_hgcmThread = 0;
  * @param pszServiceName     The name to be assigned to the service.
  * @return VBox rc.
  */
-int HGCMHostLoad (const char *pszServiceLibrary,
-                  const char *pszServiceName)
+int HGCMHostLoad(const char *pszServiceLibrary,
+                 const char *pszServiceName)
 {
     LogFlowFunc(("lib = %s, name = %s\n", pszServiceLibrary, pszServiceName));
 
@@ -2065,20 +2080,20 @@ int HGCMHostLoad (const char *pszServiceLibrary,
     /* Forward the request to the main hgcm thread. */
     HGCMMSGHANDLE hMsg = 0;
 
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_LOAD, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_LOAD, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
         /* Initialize the message. Since the message is synchronous, use the supplied pointers. */
-        HGCMMsgMainLoad *pMsg = (HGCMMsgMainLoad *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainLoad *pMsg = (HGCMMsgMainLoad *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->pszServiceLibrary = pszServiceLibrary;
         pMsg->pszServiceName    = pszServiceName;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -2093,10 +2108,10 @@ int HGCMHostLoad (const char *pszServiceLibrary,
  * @param pvExtension        The extension pointer.
  * @return VBox rc.
  */
-int HGCMHostRegisterServiceExtension (HGCMSVCEXTHANDLE *pHandle,
-                                      const char *pszServiceName,
-                                      PFNHGCMSVCEXT pfnExtension,
-                                      void *pvExtension)
+int HGCMHostRegisterServiceExtension(HGCMSVCEXTHANDLE *pHandle,
+                                     const char *pszServiceName,
+                                     PFNHGCMSVCEXT pfnExtension,
+                                     void *pvExtension)
 {
     LogFlowFunc(("pHandle = %p, name = %s, pfn = %p, rv = %p\n", pHandle, pszServiceName, pfnExtension, pvExtension));
 
@@ -2108,12 +2123,12 @@ int HGCMHostRegisterServiceExtension (HGCMSVCEXTHANDLE *pHandle,
     /* Forward the request to the main hgcm thread. */
     HGCMMSGHANDLE hMsg = 0;
 
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_REGEXT, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_REGEXT, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
         /* Initialize the message. Since the message is synchronous, use the supplied pointers. */
-        HGCMMsgMainRegisterExtension *pMsg = (HGCMMsgMainRegisterExtension *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainRegisterExtension *pMsg = (HGCMMsgMainRegisterExtension *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->pHandle        = pHandle;
@@ -2121,35 +2136,35 @@ int HGCMHostRegisterServiceExtension (HGCMSVCEXTHANDLE *pHandle,
         pMsg->pfnExtension   = pfnExtension;
         pMsg->pvExtension    = pvExtension;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("*pHandle = %p, rc = %Rrc\n", *pHandle, rc));
     return rc;
 }
 
-void HGCMHostUnregisterServiceExtension (HGCMSVCEXTHANDLE handle)
+void HGCMHostUnregisterServiceExtension(HGCMSVCEXTHANDLE handle)
 {
     LogFlowFunc(("handle = %p\n", handle));
 
     /* Forward the request to the main hgcm thread. */
     HGCMMSGHANDLE hMsg = 0;
 
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_UNREGEXT, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_UNREGEXT, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
         /* Initialize the message. */
-        HGCMMsgMainUnregisterExtension *pMsg = (HGCMMsgMainUnregisterExtension *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainUnregisterExtension *pMsg = (HGCMMsgMainUnregisterExtension *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->handle = handle;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -2164,10 +2179,10 @@ void HGCMHostUnregisterServiceExtension (HGCMSVCEXTHANDLE handle)
  * @param pu32ClientId   Where the store the created client handle.
  * @return VBox rc.
  */
-int HGCMGuestConnect (PPDMIHGCMPORT pHGCMPort,
-                      PVBOXHGCMCMD pCmd,
-                      const char *pszServiceName,
-                      uint32_t *pu32ClientId)
+int HGCMGuestConnect(PPDMIHGCMPORT pHGCMPort,
+                     PVBOXHGCMCMD pCmd,
+                     const char *pszServiceName,
+                     uint32_t *pu32ClientId)
 {
     LogFlowFunc(("pHGCMPort = %p, pCmd = %p, name = %s, pu32ClientId = %p\n",
                  pHGCMPort, pCmd, pszServiceName, pu32ClientId));
@@ -2180,7 +2195,7 @@ int HGCMGuestConnect (PPDMIHGCMPORT pHGCMPort,
     /* Forward the request to the main hgcm thread. */
     HGCMMSGHANDLE hMsg = 0;
 
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_CONNECT, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_CONNECT, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
@@ -2188,7 +2203,7 @@ int HGCMGuestConnect (PPDMIHGCMPORT pHGCMPort,
          * will not be deallocated by the caller until the message is completed,
          * use the supplied pointers.
          */
-        HGCMMsgMainConnect *pMsg = (HGCMMsgMainConnect *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainConnect *pMsg = (HGCMMsgMainConnect *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->pHGCMPort      = pHGCMPort;
@@ -2196,9 +2211,9 @@ int HGCMGuestConnect (PPDMIHGCMPORT pHGCMPort,
         pMsg->pszServiceName = pszServiceName;
         pMsg->pu32ClientId   = pu32ClientId;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgPost (hMsg, hgcmMsgCompletionCallback);
+        rc = hgcmMsgPost(hMsg, hgcmMsgCompletionCallback);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -2212,9 +2227,9 @@ int HGCMGuestConnect (PPDMIHGCMPORT pHGCMPort,
  * @param u32ClientId    The client handle to be disconnected and deleted.
  * @return VBox rc.
  */
-int HGCMGuestDisconnect (PPDMIHGCMPORT pHGCMPort,
-                         PVBOXHGCMCMD pCmd,
-                         uint32_t u32ClientId)
+int HGCMGuestDisconnect(PPDMIHGCMPORT pHGCMPort,
+                        PVBOXHGCMCMD pCmd,
+                        uint32_t u32ClientId)
 {
     LogFlowFunc(("pHGCMPort = %p, pCmd = %p, u32ClientId = %d\n",
                   pHGCMPort, pCmd, u32ClientId));
@@ -2227,21 +2242,21 @@ int HGCMGuestDisconnect (PPDMIHGCMPORT pHGCMPort,
     /* Forward the request to the main hgcm thread. */
     HGCMMSGHANDLE hMsg = 0;
 
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_DISCONNECT, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_DISCONNECT, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
         /* Initialize the message. */
-        HGCMMsgMainDisconnect *pMsg = (HGCMMsgMainDisconnect *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainDisconnect *pMsg = (HGCMMsgMainDisconnect *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->pCmd        = pCmd;
         pMsg->pHGCMPort   = pHGCMPort;
         pMsg->u32ClientId = u32ClientId;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgPost (hMsg, hgcmMsgCompletionCallback);
+        rc = hgcmMsgPost(hMsg, hgcmMsgCompletionCallback);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -2254,25 +2269,25 @@ int HGCMGuestDisconnect (PPDMIHGCMPORT pHGCMPort,
  * @param u32MsgId The message to be sent: HGCM_MSG_SAVESTATE or HGCM_MSG_LOADSTATE.
  * @return VBox rc.
  */
-static int hgcmHostLoadSaveState (PSSMHANDLE pSSM,
-                                  uint32_t u32MsgId)
+static int hgcmHostLoadSaveState(PSSMHANDLE pSSM,
+                                 uint32_t u32MsgId)
 {
     LogFlowFunc(("pSSM = %p, u32MsgId = %d\n", pSSM, u32MsgId));
 
     HGCMMSGHANDLE hMsg = 0;
 
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, u32MsgId, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, u32MsgId, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgMainLoadSaveState *pMsg = (HGCMMsgMainLoadSaveState *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainLoadSaveState *pMsg = (HGCMMsgMainLoadSaveState *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->pSSM = pSSM;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -2284,9 +2299,9 @@ static int hgcmHostLoadSaveState (PSSMHANDLE pSSM,
  * @param pSSM     The SSM handle.
  * @return VBox rc.
  */
-int HGCMHostSaveState (PSSMHANDLE pSSM)
+int HGCMHostSaveState(PSSMHANDLE pSSM)
 {
-    return hgcmHostLoadSaveState (pSSM, HGCM_MSG_SAVESTATE);
+    return hgcmHostLoadSaveState(pSSM, HGCM_MSG_SAVESTATE);
 }
 
 /* Load the state of services.
@@ -2294,9 +2309,9 @@ int HGCMHostSaveState (PSSMHANDLE pSSM)
  * @param pSSM     The SSM handle.
  * @return VBox rc.
  */
-int HGCMHostLoadState (PSSMHANDLE pSSM)
+int HGCMHostLoadState(PSSMHANDLE pSSM)
 {
-    return hgcmHostLoadSaveState (pSSM, HGCM_MSG_LOADSTATE);
+    return hgcmHostLoadSaveState(pSSM, HGCM_MSG_LOADSTATE);
 }
 
 /* The guest calls the service.
@@ -2309,12 +2324,12 @@ int HGCMHostLoadState (PSSMHANDLE pSSM)
  * @param paParms        Pointer to array of parameters.
  * @return VBox rc.
  */
-int HGCMGuestCall (PPDMIHGCMPORT pHGCMPort,
-                   PVBOXHGCMCMD pCmd,
-                   uint32_t u32ClientId,
-                   uint32_t u32Function,
-                   uint32_t cParms,
-                   VBOXHGCMSVCPARM *paParms)
+int HGCMGuestCall(PPDMIHGCMPORT pHGCMPort,
+                  PVBOXHGCMCMD pCmd,
+                  uint32_t u32ClientId,
+                  uint32_t u32Function,
+                  uint32_t cParms,
+                  VBOXHGCMSVCPARM *paParms)
 {
     LogFlowFunc(("pHGCMPort = %p, pCmd = %p, u32ClientId = %d, u32Function = %d, cParms = %d, paParms = %p\n",
                   pHGCMPort, pCmd, u32ClientId, u32Function, cParms, paParms));
@@ -2327,16 +2342,16 @@ int HGCMGuestCall (PPDMIHGCMPORT pHGCMPort,
     int rc = VERR_HGCM_INVALID_CLIENT_ID;
 
     /* Resolve the client handle to the client instance pointer. */
-    HGCMClient *pClient = (HGCMClient *)hgcmObjReference (u32ClientId, HGCMOBJ_CLIENT);
+    HGCMClient *pClient = (HGCMClient *)hgcmObjReference(u32ClientId, HGCMOBJ_CLIENT);
 
     if (pClient)
     {
         AssertRelease(pClient->pService);
 
         /* Forward the message to the service thread. */
-        rc = pClient->pService->GuestCall (pHGCMPort, pCmd, u32ClientId, u32Function, cParms, paParms);
+        rc = pClient->pService->GuestCall(pHGCMPort, pCmd, u32ClientId, u32Function, cParms, paParms);
 
-        hgcmObjDereference (pClient);
+        hgcmObjDereference(pClient);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -2351,10 +2366,10 @@ int HGCMGuestCall (PPDMIHGCMPORT pHGCMPort,
  * @param paParms        Pointer to array of parameters.
  * @return VBox rc.
  */
-int HGCMHostCall (const char *pszServiceName,
-                  uint32_t u32Function,
-                  uint32_t cParms,
-                  VBOXHGCMSVCPARM *paParms)
+int HGCMHostCall(const char *pszServiceName,
+                 uint32_t u32Function,
+                 uint32_t cParms,
+                 VBOXHGCMSVCPARM *paParms)
 {
     LogFlowFunc(("name = %s, u32Function = %d, cParms = %d, paParms = %p\n",
                  pszServiceName, u32Function, cParms, paParms));
@@ -2372,11 +2387,11 @@ int HGCMHostCall (const char *pszServiceName,
      * So it is slow but host calls are intended mostly for configuration and
      * other non-time-critical functions.
      */
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_HOSTCALL, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_HOSTCALL, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgMainHostCall *pMsg = (HGCMMsgMainHostCall *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainHostCall *pMsg = (HGCMMsgMainHostCall *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->pszServiceName = (char *)pszServiceName;
@@ -2384,9 +2399,9 @@ int HGCMHostCall (const char *pszServiceName,
         pMsg->cParms         = cParms;
         pMsg->paParms        = paParms;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
@@ -2394,7 +2409,7 @@ int HGCMHostCall (const char *pszServiceName,
 }
 
 #ifdef VBOX_WITH_CRHGSMI
-int HGCMHostSvcHandleCreate (const char *pszServiceName, HGCMCVSHANDLE * phSvc)
+int HGCMHostSvcHandleCreate(const char *pszServiceName, HGCMCVSHANDLE * phSvc)
 {
     LogFlowFunc(("name = %s\n", pszServiceName));
 
@@ -2416,31 +2431,31 @@ int HGCMHostSvcHandleCreate (const char *pszServiceName, HGCMCVSHANDLE * phSvc)
      * So it is slow but host calls are intended mostly for configuration and
      * other non-time-critical functions.
      */
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_SVCAQUIRE, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_SVCAQUIRE, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgMainSvcAcquire *pMsg = (HGCMMsgMainSvcAcquire *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainSvcAcquire *pMsg = (HGCMMsgMainSvcAcquire *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->pszServiceName = (char *)pszServiceName;
         pMsg->pService = NULL;
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
         if (RT_SUCCESS(rc))
         {
             /* for simplicity just use a svc ptr as handle for now */
             *phSvc = (HGCMCVSHANDLE)pMsg->pService;
         }
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
     return rc;
 }
 
-int HGCMHostSvcHandleDestroy (HGCMCVSHANDLE hSvc)
+int HGCMHostSvcHandleDestroy(HGCMCVSHANDLE hSvc)
 {
     LogFlowFunc(("hSvc = %p\n", hSvc));
 
@@ -2457,25 +2472,26 @@ int HGCMHostSvcHandleDestroy (HGCMCVSHANDLE hSvc)
      * So it is slow but host calls are intended mostly for configuration and
      * other non-time-critical functions.
      */
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_SVCRELEASE, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_SVCRELEASE, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
-        HGCMMsgMainSvcRelease *pMsg = (HGCMMsgMainSvcRelease *)hgcmObjReference (hMsg, HGCMOBJ_MSG);
+        HGCMMsgMainSvcRelease *pMsg = (HGCMMsgMainSvcRelease *)hgcmObjReference(hMsg, HGCMOBJ_MSG);
         AssertRelease(pMsg);
 
         pMsg->pService = (HGCMService *)hSvc;
 
-        hgcmObjDereference (pMsg);
+        hgcmObjDereference(pMsg);
 
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
     return rc;
 }
 
-int HGCMHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion)
+int HGCMHostFastCallAsync(HGCMCVSHANDLE hSvc, uint32_t function, VBOXHGCMSVCPARM *pParm, PHGCMHOSTFASTCALLCB pfnCompletion,
+                          void *pvCompletion)
 {
     LogFlowFunc(("hSvc = %p, u32Function = %d, pParm = %p\n",
             hSvc, function, pParm));
@@ -2486,14 +2502,14 @@ int HGCMHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, VBOXHGCMSVCPAR
     }
 
     HGCMService *pService = (HGCMService *)hSvc;
-    int rc = pService->HostFastCallAsync (function, pParm, pfnCompletion, pvCompletion);
+    int rc = pService->HostFastCallAsync(function, pParm, pfnCompletion, pvCompletion);
 
     LogFlowFunc(("rc = %Rrc\n", rc));
     return rc;
 }
 #endif
 
-int HGCMHostReset (void)
+int HGCMHostReset(void)
 {
     LogFlowFunc(("\n"));
 
@@ -2502,22 +2518,22 @@ int HGCMHostReset (void)
 
     HGCMMSGHANDLE hMsg = 0;
 
-    int rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_RESET, hgcmMainMessageAlloc);
+    int rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_RESET, hgcmMainMessageAlloc);
 
     if (RT_SUCCESS(rc))
     {
-        rc = hgcmMsgSend (hMsg);
+        rc = hgcmMsgSend(hMsg);
     }
 
     LogFlowFunc(("rc = %Rrc\n", rc));
     return rc;
 }
 
-int HGCMHostInit (void)
+int HGCMHostInit(void)
 {
     LogFlowFunc(("\n"));
 
-    int rc = hgcmThreadInit ();
+    int rc = hgcmThreadInit();
 
     if (RT_SUCCESS(rc))
     {
@@ -2525,7 +2541,7 @@ int HGCMHostInit (void)
          * Start main HGCM thread.
          */
 
-        rc = hgcmThreadCreate (&g_hgcmThread, "MainHGCMthread", hgcmThread, NULL);
+        rc = hgcmThreadCreate(&g_hgcmThread, "MainHGCMthread", hgcmThread, NULL);
 
         if (RT_FAILURE(rc))
         {
@@ -2537,7 +2553,7 @@ int HGCMHostInit (void)
     return rc;
 }
 
-int HGCMHostShutdown (void)
+int HGCMHostShutdown(void)
 {
     LogFlowFunc(("\n"));
 
@@ -2545,26 +2561,26 @@ int HGCMHostShutdown (void)
      * Do HGCMReset and then unload all services.
      */
 
-    int rc = HGCMHostReset ();
+    int rc = HGCMHostReset();
 
     if (RT_SUCCESS(rc))
     {
         /* Send the quit message to the main hgcmThread. */
         HGCMMSGHANDLE hMsg = 0;
 
-        rc = hgcmMsgAlloc (g_hgcmThread, &hMsg, HGCM_MSG_QUIT, hgcmMainMessageAlloc);
+        rc = hgcmMsgAlloc(g_hgcmThread, &hMsg, HGCM_MSG_QUIT, hgcmMainMessageAlloc);
 
         if (RT_SUCCESS(rc))
         {
-            rc = hgcmMsgSend (hMsg);
+            rc = hgcmMsgSend(hMsg);
 
             if (RT_SUCCESS(rc))
             {
                 /* Wait for the thread termination. */
-                hgcmThreadWait (g_hgcmThread);
+                hgcmThreadWait(g_hgcmThread);
                 g_hgcmThread = 0;
 
-                hgcmThreadUninit ();
+                hgcmThreadUninit();
             }
         }
     }
diff --git a/src/VBox/Main/src-client/HGCMThread.cpp b/src/VBox/Main/src-client/HGCMThread.cpp
index d0e046a..426752c 100644
--- a/src/VBox/Main/src-client/HGCMThread.cpp
+++ b/src/VBox/Main/src-client/HGCMThread.cpp
@@ -286,7 +286,8 @@ int HGCMThread::Initialize (HGCMTHREADHANDLE handle, const char *pszThreadName,
                 m_fu32ThreadFlags = HGCMMSG_TF_INITIALIZING;
 
                 RTTHREAD thread;
-                rc = RTThreadCreate (&thread, hgcmWorkerThreadFunc, this, 0, /* default stack size; some service may need quite a bit */
+                rc = RTThreadCreate (&thread, hgcmWorkerThreadFunc, this, 0, /* default stack size; some service
+                                                                                may need quite a bit */
                                      RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE,
                                      pszThreadName);
 
@@ -695,7 +696,8 @@ int hgcmThreadWait (HGCMTHREADHANDLE hThread)
 
 int hgcmMsgAlloc (HGCMTHREADHANDLE hThread, HGCMMSGHANDLE *pHandle, uint32_t u32MsgId, PFNHGCMNEWMSGALLOC pfnNewMessage)
 {
-    LogFlow(("hgcmMsgAlloc: thread handle = 0x%08X, pHandle = %p, sizeof (HGCMMsgCore) = %d\n", hThread, pHandle, sizeof (HGCMMsgCore)));
+    LogFlow(("hgcmMsgAlloc: thread handle = 0x%08X, pHandle = %p, sizeof (HGCMMsgCore) = %d\n",
+             hThread, pHandle, sizeof (HGCMMsgCore)));
 
     if (!pHandle)
     {
diff --git a/src/VBox/Main/src-client/KeyboardImpl.cpp b/src/VBox/Main/src-client/KeyboardImpl.cpp
index 74154da..b796cab 100644
--- a/src/VBox/Main/src-client/KeyboardImpl.cpp
+++ b/src/VBox/Main/src-client/KeyboardImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -60,9 +60,6 @@ typedef struct DRVMAINKEYBOARD
     uint32_t                    u32DevCaps;
 } DRVMAINKEYBOARD, *PDRVMAINKEYBOARD;
 
-/** Converts PDMIVMMDEVCONNECTOR pointer to a DRVMAINVMMDEV pointer. */
-#define PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD(pInterface) ( (PDRVMAINKEYBOARD) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINKEYBOARD, IConnector)) )
-
 
 // constructor / destructor
 ////////////////////////////////////////////////////////////////////////////////
@@ -81,6 +78,7 @@ HRESULT Keyboard::FinalConstruct()
     RT_ZERO(mpDrv);
     mpVMMDev = NULL;
     mfVMMDevInited = false;
+    menmLeds = PDMKEYBLEDS_NONE;
     return BaseFinalConstruct();
 }
 
@@ -144,6 +142,8 @@ void Keyboard::uninit()
     mpVMMDev = NULL;
     mfVMMDevInited = true;
 
+    menmLeds = PDMKEYBLEDS_NONE;
+
     unconst(mParent) = NULL;
     unconst(mEventSource).setNull();
 }
@@ -152,36 +152,28 @@ void Keyboard::uninit()
  * Sends a scancode to the keyboard.
  *
  * @returns COM status code
- * @param scancode The scancode to send
+ * @param aScancode The scancode to send
  */
-STDMETHODIMP Keyboard::PutScancode(LONG scancode)
+HRESULT Keyboard::putScancode(LONG aScancode)
 {
-    com::SafeArray<LONG> scancodes(1);
-    scancodes[0] = scancode;
-    return PutScancodes(ComSafeArrayAsInParam(scancodes), NULL);
+    std::vector<LONG> scancodes;
+    scancodes.resize(1);
+    scancodes[0] = aScancode;
+    return putScancodes(scancodes, NULL);
 }
 
 /**
  * Sends a list of scancodes to the keyboard.
  *
  * @returns COM status code
- * @param scancodes   Pointer to the first scancode
- * @param count       Number of scancodes
- * @param codesStored Address of variable to store the number
- *                    of scancodes that were sent to the keyboard.
-                      This value can be NULL.
+ * @param aScancodes   Pointer to the first scancode
+ * @param aCodesStored Address of variable to store the number
+ *                     of scancodes that were sent to the keyboard.
+                       This value can be NULL.
  */
-STDMETHODIMP Keyboard::PutScancodes(ComSafeArrayIn(LONG, scancodes),
-                                    ULONG *codesStored)
+HRESULT Keyboard::putScancodes(const std::vector<LONG> &aScancodes,
+                               ULONG *aCodesStored)
 {
-    if (ComSafeArrayInIsNull(scancodes))
-        return E_INVALIDARG;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    com::SafeArray<LONG> keys(ComSafeArrayInArg(scancodes));
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     CHECK_CONSOLE_DRV(mpDrv[0]);
@@ -198,26 +190,27 @@ STDMETHODIMP Keyboard::PutScancodes(ComSafeArrayIn(LONG, scancodes),
             break;
         }
     }
+
     /* No enabled keyboard - throw the input away. */
     if (!pUpPort)
     {
-        if (codesStored)
-            *codesStored = (uint32_t)keys.size();
+        if (aCodesStored)
+            *aCodesStored = (uint32_t)aScancodes.size();
         return S_OK;
     }
 
     int vrc = VINF_SUCCESS;
 
     uint32_t sent;
-    for (sent = 0; (sent < keys.size()) && RT_SUCCESS(vrc); sent++)
-        vrc = pUpPort->pfnPutEvent(pUpPort, (uint8_t)keys[sent]);
+    for (sent = 0; (sent < aScancodes.size()) && RT_SUCCESS(vrc); ++sent)
+        vrc = pUpPort->pfnPutEventScan(pUpPort, (uint8_t)aScancodes[sent]);
 
-    if (codesStored)
-        *codesStored = sent;
+    if (aCodesStored)
+        *aCodesStored = sent;
 
-    /* Only signal the keys in the event which have been actually sent. */
-    com::SafeArray<LONG> keysSent(sent);
-    memcpy(keysSent.raw(), keys.raw(), sent*sizeof(LONG));
+    com::SafeArray<LONG> keys(aScancodes.size());
+    for (size_t i = 0; i < aScancodes.size(); ++i)
+        keys[i] = aScancodes[i];
 
     VBoxEventDesc evDesc;
     evDesc.init(mEventSource, VBoxEventType_OnGuestKeyboard, ComSafeArrayAsInParam(keys));
@@ -238,9 +231,10 @@ STDMETHODIMP Keyboard::PutScancodes(ComSafeArrayIn(LONG, scancodes),
  * @returns COM status code
  *
  */
-STDMETHODIMP Keyboard::PutCAD()
+HRESULT Keyboard::putCAD()
 {
-    static com::SafeArray<LONG> cadSequence(8);
+    static std::vector<LONG> cadSequence;
+    cadSequence.resize(8);
 
     cadSequence[0] = 0x1d; // Ctrl down
     cadSequence[1] = 0x38; // Alt down
@@ -251,18 +245,40 @@ STDMETHODIMP Keyboard::PutCAD()
     cadSequence[6] = 0xb8; // Alt up
     cadSequence[7] = 0x9d; // Ctrl up
 
-    return PutScancodes(ComSafeArrayAsInParam(cadSequence), NULL);
+    return putScancodes(cadSequence, NULL);
 }
 
-STDMETHODIMP Keyboard::COMGETTER(EventSource)(IEventSource ** aEventSource)
+/**
+ * Releases all currently held keys in the virtual keyboard.
+ *
+ * @returns COM status code
+ *
+ */
+HRESULT Keyboard::releaseKeys()
 {
-    CheckComArgOutPointerValid(aEventSource);
+    std::vector<LONG> scancodes;
+    scancodes.resize(1);
+    scancodes[0] = 0xFC;    /* Magic scancode, see PS/2 and USB keyboard devices. */
+    return putScancodes(scancodes, NULL);
+}
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT Keyboard::getKeyboardLEDs(std::vector<KeyboardLED_T> &aKeyboardLEDs)
+{
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    // no need to lock - lifetime constant
-    mEventSource.queryInterfaceTo(aEventSource);
+    aKeyboardLEDs.resize(0);
+
+    if (menmLeds & PDMKEYBLEDS_NUMLOCK)    aKeyboardLEDs.push_back(KeyboardLED_NumLock);
+    if (menmLeds & PDMKEYBLEDS_CAPSLOCK)   aKeyboardLEDs.push_back(KeyboardLED_CapsLock);
+    if (menmLeds & PDMKEYBLEDS_SCROLLLOCK) aKeyboardLEDs.push_back(KeyboardLED_ScrollLock);
+
+    return S_OK;
+}
+
+HRESULT Keyboard::getEventSource(ComPtr<IEventSource> &aEventSource)
+{
+    // No need to lock - lifetime constant
+    mEventSource.queryInterfaceTo(aEventSource.asOutParam());
 
     return S_OK;
 }
@@ -270,21 +286,32 @@ STDMETHODIMP Keyboard::COMGETTER(EventSource)(IEventSource ** aEventSource)
 //
 // private methods
 //
+void Keyboard::onKeyboardLedsChange(PDMKEYBLEDS enmLeds)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    /* Save the current status. */
+    menmLeds = enmLeds;
+
+    alock.release();
+
+    i_getParent()->i_onKeyboardLedsChange(RT_BOOL(enmLeds & PDMKEYBLEDS_NUMLOCK),
+                                          RT_BOOL(enmLeds & PDMKEYBLEDS_CAPSLOCK),
+                                          RT_BOOL(enmLeds & PDMKEYBLEDS_SCROLLLOCK));
+}
 
-DECLCALLBACK(void) Keyboard::keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds)
+DECLCALLBACK(void) Keyboard::i_keyboardLedStatusChange(PPDMIKEYBOARDCONNECTOR pInterface, PDMKEYBLEDS enmLeds)
 {
-    PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD(pInterface);
-    pDrv->pKeyboard->getParent()->onKeyboardLedsChange(RT_BOOL(enmLeds & PDMKEYBLEDS_NUMLOCK),
-                                                       RT_BOOL(enmLeds & PDMKEYBLEDS_CAPSLOCK),
-                                                       RT_BOOL(enmLeds & PDMKEYBLEDS_SCROLLLOCK));
+    PDRVMAINKEYBOARD pDrv = RT_FROM_MEMBER(pInterface, DRVMAINKEYBOARD, IConnector);
+    pDrv->pKeyboard->onKeyboardLedsChange(enmLeds);
 }
 
 /**
  * @interface_method_impl{PDMIKEYBOARDCONNECTOR,pfnSetActive}
  */
-DECLCALLBACK(void) Keyboard::keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive)
+DECLCALLBACK(void) Keyboard::i_keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface, bool fActive)
 {
-    PDRVMAINKEYBOARD pDrv = PPDMIKEYBOARDCONNECTOR_2_MAINKEYBOARD(pInterface);
+    PDRVMAINKEYBOARD pDrv = RT_FROM_MEMBER(pInterface, DRVMAINKEYBOARD, IConnector);
     if (fActive)
         pDrv->u32DevCaps |= KEYBOARD_DEVCAP_ENABLED;
     else
@@ -295,7 +322,7 @@ DECLCALLBACK(void) Keyboard::keyboardSetActive(PPDMIKEYBOARDCONNECTOR pInterface
 /**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
-DECLCALLBACK(void *) Keyboard::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+DECLCALLBACK(void *) Keyboard::i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
 {
     PPDMDRVINS          pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     PDRVMAINKEYBOARD    pDrv    = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD);
@@ -312,7 +339,7 @@ DECLCALLBACK(void *) Keyboard::drvQueryInterface(PPDMIBASE pInterface, const cha
  * @returns VBox status.
  * @param   pDrvIns     The driver instance data.
  */
-DECLCALLBACK(void) Keyboard::drvDestruct(PPDMDRVINS pDrvIns)
+DECLCALLBACK(void) Keyboard::i_drvDestruct(PPDMDRVINS pDrvIns)
 {
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINKEYBOARD pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD);
@@ -327,7 +354,7 @@ DECLCALLBACK(void) Keyboard::drvDestruct(PPDMDRVINS pDrvIns)
                 pThis->pKeyboard->mpDrv[cDev] = NULL;
                 break;
             }
-        pThis->pKeyboard->mpVMMDev = NULL;
+            pThis->pKeyboard->mpVMMDev = NULL;
     }
 }
 
@@ -336,7 +363,7 @@ DECLCALLBACK(void) Keyboard::drvDestruct(PPDMDRVINS pDrvIns)
  *
  * @copydoc FNPDMDRVCONSTRUCT
  */
-DECLCALLBACK(int) Keyboard::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+DECLCALLBACK(int) Keyboard::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
     PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINKEYBOARD pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINKEYBOARD);
@@ -354,10 +381,10 @@ DECLCALLBACK(int) Keyboard::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
     /*
      * IBase.
      */
-    pDrvIns->IBase.pfnQueryInterface        = Keyboard::drvQueryInterface;
+    pDrvIns->IBase.pfnQueryInterface      = Keyboard::i_drvQueryInterface;
 
-    pThis->IConnector.pfnLedStatusChange    = keyboardLedStatusChange;
-    pThis->IConnector.pfnSetActive          = Keyboard::keyboardSetActive;
+    pThis->IConnector.pfnLedStatusChange  = i_keyboardLedStatusChange;
+    pThis->IConnector.pfnSetActive        = Keyboard::i_keyboardSetActive;
 
     /*
      * Get the IKeyboardPort interface of the above driver/device.
@@ -418,9 +445,9 @@ const PDMDRVREG Keyboard::DrvReg =
     /* cbInstance */
     sizeof(DRVMAINKEYBOARD),
     /* pfnConstruct */
-    Keyboard::drvConstruct,
+    Keyboard::i_drvConstruct,
     /* pfnDestruct */
-    Keyboard::drvDestruct,
+    Keyboard::i_drvDestruct,
     /* pfnRelocate */
     NULL,
     /* pfnIOCtl */
diff --git a/src/VBox/Main/src-client/MachineDebuggerImpl.cpp b/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
index 1520bb5..cb43a80 100644
--- a/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
+++ b/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
@@ -124,22 +124,15 @@ void MachineDebugger::uninit()
  * @returns COM status code
  * @param   a_fEnabled      Where to store the result.
  */
-STDMETHODIMP MachineDebugger::COMGETTER(SingleStep)(BOOL *a_fEnabled)
+HRESULT MachineDebugger::getSingleStep(BOOL *aSingleStep)
 {
-    CheckComArgOutPointerValid(a_fEnabled);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-        {
-            /** @todo */
-            ReturnComNotImplemented();
-        }
+        /** @todo */
+        ReturnComNotImplemented();
     }
     return hrc;
 }
@@ -150,20 +143,15 @@ STDMETHODIMP MachineDebugger::COMGETTER(SingleStep)(BOOL *a_fEnabled)
  * @returns COM status code
  * @param   a_fEnable       The new state.
  */
-STDMETHODIMP MachineDebugger::COMSETTER(SingleStep)(BOOL a_fEnable)
+HRESULT MachineDebugger::setSingleStep(BOOL aSingleStep)
 {
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-        {
-            /** @todo */
-            ReturnComNotImplemented();
-        }
+        /** @todo */
+        ReturnComNotImplemented();
     }
     return hrc;
 }
@@ -175,7 +163,7 @@ STDMETHODIMP MachineDebugger::COMSETTER(SingleStep)(BOOL a_fEnable)
  * @param   enmPolicy           Which EM policy.
  * @param   pfEnforced          Where to return the policy setting.
  */
-HRESULT MachineDebugger::getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced)
+HRESULT MachineDebugger::i_getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *pfEnforced)
 {
     CheckComArgOutPointerValid(pfEnforced);
 
@@ -184,7 +172,7 @@ HRESULT MachineDebugger::getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *p
     if (SUCCEEDED(hrc))
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        if (queueSettings())
+        if (i_queueSettings())
             *pfEnforced = maiQueuedEmExecPolicyParams[enmPolicy] == 1;
         else
         {
@@ -206,14 +194,14 @@ HRESULT MachineDebugger::getEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL *p
  * @param   enmPolicy           Which policy to change.
  * @param   fEnforce            Whether to enforce the policy or not.
  */
-HRESULT MachineDebugger::setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce)
+HRESULT MachineDebugger::i_setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fEnforce)
 {
     AutoCaller autoCaller(this);
     HRESULT hrc = autoCaller.rc();
     if (SUCCEEDED(hrc))
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        if (queueSettings())
+        if (i_queueSettings())
             maiQueuedEmExecPolicyParams[enmPolicy] = fEnforce ? 1 : 0;
         else
         {
@@ -236,9 +224,9 @@ HRESULT MachineDebugger::setEmExecPolicyProperty(EMEXECPOLICY enmPolicy, BOOL fE
  * @returns COM status code
  * @param   a_fEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(RecompileUser) (BOOL *aEnabled)
+HRESULT MachineDebugger::getRecompileUser(BOOL *aRecompileUser)
 {
-    return getEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING3, aEnabled);
+    return i_getEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING3, aRecompileUser);
 }
 
 /**
@@ -247,10 +235,10 @@ STDMETHODIMP MachineDebugger::COMGETTER(RecompileUser) (BOOL *aEnabled)
  * @returns COM status
  * @param   aEnable new user mode code recompile flag.
  */
-STDMETHODIMP MachineDebugger::COMSETTER(RecompileUser)(BOOL aEnable)
+HRESULT MachineDebugger::setRecompileUser(BOOL aRecompileUser)
 {
-    LogFlowThisFunc(("enable=%d\n", aEnable));
-    return setEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING3, aEnable);
+    LogFlowThisFunc(("enable=%d\n", aRecompileUser));
+    return i_setEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING3, aRecompileUser);
 }
 
 /**
@@ -259,9 +247,9 @@ STDMETHODIMP MachineDebugger::COMSETTER(RecompileUser)(BOOL aEnable)
  * @returns COM status code
  * @param   aEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(RecompileSupervisor) (BOOL *aEnabled)
+HRESULT MachineDebugger::getRecompileSupervisor(BOOL *aRecompileSupervisor)
 {
-    return getEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING0, aEnabled);
+    return i_getEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING0, aRecompileSupervisor);
 }
 
 /**
@@ -270,10 +258,10 @@ STDMETHODIMP MachineDebugger::COMGETTER(RecompileSupervisor) (BOOL *aEnabled)
  * @returns COM status code
  * @param   aEnable new recompile supervisor code flag
  */
-STDMETHODIMP MachineDebugger::COMSETTER(RecompileSupervisor)(BOOL aEnable)
+HRESULT MachineDebugger::setRecompileSupervisor(BOOL aRecompileSupervisor)
 {
-    LogFlowThisFunc(("enable=%d\n", aEnable));
-    return setEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING0, aEnable);
+    LogFlowThisFunc(("enable=%d\n", aRecompileSupervisor));
+    return i_setEmExecPolicyProperty(EMEXECPOLICY_RECOMPILE_RING0, aRecompileSupervisor);
 }
 
 /**
@@ -282,9 +270,9 @@ STDMETHODIMP MachineDebugger::COMSETTER(RecompileSupervisor)(BOOL aEnable)
  * @returns COM status code
  * @param   aEnabled    Address of result variable.
  */
-STDMETHODIMP MachineDebugger::COMGETTER(ExecuteAllInIEM) (BOOL *aEnabled)
+HRESULT MachineDebugger::getExecuteAllInIEM(BOOL *aExecuteAllInIEM)
 {
-    return getEmExecPolicyProperty(EMEXECPOLICY_IEM_ALL, aEnabled);
+    return i_getEmExecPolicyProperty(EMEXECPOLICY_IEM_ALL, aExecuteAllInIEM);
 }
 
 /**
@@ -293,10 +281,10 @@ STDMETHODIMP MachineDebugger::COMGETTER(ExecuteAllInIEM) (BOOL *aEnabled)
  * @returns COM status code
  * @param   aEnable     New setting.
  */
-STDMETHODIMP MachineDebugger::COMSETTER(ExecuteAllInIEM)(BOOL aEnable)
+HRESULT MachineDebugger::setExecuteAllInIEM(BOOL aExecuteAllInIEM)
 {
-    LogFlowThisFunc(("enable=%d\n", aEnable));
-    return setEmExecPolicyProperty(EMEXECPOLICY_IEM_ALL, aEnable);
+    LogFlowThisFunc(("enable=%d\n", aExecuteAllInIEM));
+    return i_setEmExecPolicyProperty(EMEXECPOLICY_IEM_ALL, aExecuteAllInIEM);
 }
 
 /**
@@ -305,23 +293,17 @@ STDMETHODIMP MachineDebugger::COMSETTER(ExecuteAllInIEM)(BOOL aEnable)
  * @returns COM status code
  * @param   aEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(PATMEnabled) (BOOL *aEnabled)
+HRESULT MachineDebugger::getPATMEnabled(BOOL *aPATMEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
 #ifdef VBOX_WITH_RAW_MODE
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Console::SafeVMPtrQuiet ptrVM(mParent);
     if (ptrVM.isOk())
-        *aEnabled = PATMR3IsEnabled (ptrVM.rawUVM());
+        *aPATMEnabled = PATMR3IsEnabled (ptrVM.rawUVM());
     else
 #endif
-        *aEnabled = false;
+        *aPATMEnabled = false;
 
     return S_OK;
 }
@@ -332,20 +314,17 @@ STDMETHODIMP MachineDebugger::COMGETTER(PATMEnabled) (BOOL *aEnabled)
  * @returns COM status code
  * @param   aEnable new patch manager enabled flag
  */
-STDMETHODIMP MachineDebugger::COMSETTER(PATMEnabled) (BOOL aEnable)
+HRESULT MachineDebugger::setPATMEnabled(BOOL aPATMEnabled)
 {
-    LogFlowThisFunc(("enable=%d\n", aEnable));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("enable=%d\n", aPATMEnabled));
 
 #ifdef VBOX_WITH_RAW_MODE
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (queueSettings())
+    if (i_queueSettings())
     {
         // queue the request
-        mPatmEnabledQueued = aEnable;
+        mPatmEnabledQueued = aPATMEnabled;
         return S_OK;
     }
 
@@ -353,12 +332,12 @@ STDMETHODIMP MachineDebugger::COMSETTER(PATMEnabled) (BOOL aEnable)
     if (FAILED(ptrVM.rc()))
         return ptrVM.rc();
 
-    int vrc = PATMR3AllowPatching(ptrVM.rawUVM(), RT_BOOL(aEnable));
+    int vrc = PATMR3AllowPatching(ptrVM.rawUVM(), RT_BOOL(aPATMEnabled));
     if (RT_FAILURE(vrc))
         return setError(VBOX_E_VM_ERROR, tr("PATMR3AllowPatching returned %Rrc"), vrc);
 
 #else  /* !VBOX_WITH_RAW_MODE */
-    if (aEnable)
+    if (aPATMEnabled)
         return setError(VBOX_E_VM_ERROR, tr("PATM not present"), VERR_NOT_SUPPORTED);
 #endif /* !VBOX_WITH_RAW_MODE */
     return S_OK;
@@ -370,23 +349,18 @@ STDMETHODIMP MachineDebugger::COMSETTER(PATMEnabled) (BOOL aEnable)
  * @returns COM status code
  * @param   aEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(CSAMEnabled) (BOOL *aEnabled)
+HRESULT MachineDebugger::getCSAMEnabled(BOOL *aCSAMEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
 #ifdef VBOX_WITH_RAW_MODE
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Console::SafeVMPtrQuiet ptrVM(mParent);
 
     if (ptrVM.isOk())
-        *aEnabled = CSAMR3IsEnabled(ptrVM.rawUVM());
+        *aCSAMEnabled = CSAMR3IsEnabled(ptrVM.rawUVM());
     else
 #endif /* VBOX_WITH_RAW_MODE */
-        *aEnabled = false;
+        *aCSAMEnabled = false;
 
     return S_OK;
 }
@@ -397,20 +371,17 @@ STDMETHODIMP MachineDebugger::COMGETTER(CSAMEnabled) (BOOL *aEnabled)
  * @returns COM status code
  * @param   aEnable new code scanner enabled flag
  */
-STDMETHODIMP MachineDebugger::COMSETTER(CSAMEnabled) (BOOL aEnable)
+HRESULT MachineDebugger::setCSAMEnabled(BOOL aCSAMEnabled)
 {
-    LogFlowThisFunc(("enable=%d\n", aEnable));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("enable=%d\n", aCSAMEnabled));
 
 #ifdef VBOX_WITH_RAW_MODE
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (queueSettings())
+    if (i_queueSettings())
     {
         // queue the request
-        mCsamEnabledQueued = aEnable;
+        mCsamEnabledQueued = aCSAMEnabled;
         return S_OK;
     }
 
@@ -418,12 +389,12 @@ STDMETHODIMP MachineDebugger::COMSETTER(CSAMEnabled) (BOOL aEnable)
     if (FAILED(ptrVM.rc()))
         return ptrVM.rc();
 
-    int vrc = CSAMR3SetScanningEnabled(ptrVM.rawUVM(), aEnable != FALSE);
+    int vrc = CSAMR3SetScanningEnabled(ptrVM.rawUVM(), aCSAMEnabled != FALSE);
     if (RT_FAILURE(vrc))
         return setError(VBOX_E_VM_ERROR, tr("CSAMR3SetScanningEnabled returned %Rrc"), vrc);
 
 #else  /* !VBOX_WITH_RAW_MODE */
-    if (aEnable)
+    if (aCSAMEnabled)
         return setError(VBOX_E_VM_ERROR, tr("CASM not present"), VERR_NOT_SUPPORTED);
 #endif /* !VBOX_WITH_RAW_MODE */
     return S_OK;
@@ -435,20 +406,15 @@ STDMETHODIMP MachineDebugger::COMSETTER(CSAMEnabled) (BOOL aEnable)
  * @returns COM status code
  * @param   aEnabled     address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(LogEnabled) (BOOL *aEnabled)
+HRESULT MachineDebugger::getLogEnabled(BOOL *aLogEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
 #ifdef LOG_ENABLED
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     const PRTLOGGER pLogInstance = RTLogDefaultInstance();
-    *aEnabled = pLogInstance && !(pLogInstance->fFlags & RTLOGFLAGS_DISABLED);
+    *aLogEnabled = pLogInstance && !(pLogInstance->fFlags & RTLOGFLAGS_DISABLED);
 #else
-    *aEnabled = false;
+    *aLogEnabled = false;
 #endif
 
     return S_OK;
@@ -460,19 +426,16 @@ STDMETHODIMP MachineDebugger::COMGETTER(LogEnabled) (BOOL *aEnabled)
  * @returns COM status code
  * @param   aEnabled    The new code log state.
  */
-STDMETHODIMP MachineDebugger::COMSETTER(LogEnabled) (BOOL aEnabled)
+HRESULT MachineDebugger::setLogEnabled(BOOL aLogEnabled)
 {
-    LogFlowThisFunc(("aEnabled=%d\n", aEnabled));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aLogEnabled=%d\n", aLogEnabled));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (queueSettings())
+    if (i_queueSettings())
     {
         // queue the request
-        mLogEnabledQueued = aEnabled;
+        mLogEnabledQueued = aLogEnabled;
         return S_OK;
     }
 
@@ -480,7 +443,7 @@ STDMETHODIMP MachineDebugger::COMSETTER(LogEnabled) (BOOL aEnabled)
     if (FAILED(ptrVM.rc())) return ptrVM.rc();
 
 #ifdef LOG_ENABLED
-    int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), aEnabled ? "enabled" : "disabled");
+    int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), aLogEnabled ? "enabled" : "disabled");
     if (RT_FAILURE(vrc))
     {
         /** @todo handle error code. */
@@ -490,9 +453,12 @@ STDMETHODIMP MachineDebugger::COMSETTER(LogEnabled) (BOOL aEnabled)
     return S_OK;
 }
 
-HRESULT MachineDebugger::logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr,
-                                        const char *pszLogGetStr, BSTR *a_pbstrSettings)
+HRESULT MachineDebugger::i_logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr,
+                                          const char *pszLogGetStr, Utf8Str astrSettings)
 {
+    BSTR *a_pbstrSettings = new BSTR;
+    astrSettings.cloneTo(a_pbstrSettings);
+
     /* Make sure the VM is powered up. */
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     Console::SafeVMPtr ptrVM(mParent);
@@ -540,76 +506,43 @@ HRESULT MachineDebugger::logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGe
     }
 }
 
-
-STDMETHODIMP MachineDebugger::COMGETTER(LogDbgFlags)(BSTR *a_pbstrSettings)
+HRESULT MachineDebugger::getLogDbgFlags(com::Utf8Str &aLogDbgFlags)
 {
-    CheckComArgOutPointerValid(a_pbstrSettings);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        hrc = logStringProps(RTLogGetDefaultInstance(), RTLogGetFlags, "RTGetFlags", a_pbstrSettings);
+    HRESULT hrc = i_logStringProps(RTLogGetDefaultInstance(), RTLogGetFlags, "RTGetFlags", aLogDbgFlags);
 
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::COMGETTER(LogDbgGroups)(BSTR *a_pbstrSettings)
+HRESULT MachineDebugger::getLogDbgGroups(com::Utf8Str &aLogDbgGroups)
 {
-    CheckComArgOutPointerValid(a_pbstrSettings);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        hrc = logStringProps(RTLogGetDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", a_pbstrSettings);
+    HRESULT hrc = i_logStringProps(RTLogGetDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", aLogDbgGroups);
 
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::COMGETTER(LogDbgDestinations)(BSTR *a_pbstrSettings)
+HRESULT MachineDebugger::getLogDbgDestinations(com::Utf8Str &aLogDbgDestinations)
 {
-    CheckComArgOutPointerValid(a_pbstrSettings);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        hrc = logStringProps(RTLogGetDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", a_pbstrSettings);
-
+    HRESULT hrc = i_logStringProps(RTLogGetDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", aLogDbgDestinations);
     return hrc;
 }
 
-
-STDMETHODIMP MachineDebugger::COMGETTER(LogRelFlags)(BSTR *a_pbstrSettings)
+HRESULT MachineDebugger::getLogRelFlags(com::Utf8Str &aLogRelFlags)
 {
-    CheckComArgOutPointerValid(a_pbstrSettings);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetFlags, "RTGetFlags", a_pbstrSettings);
+    HRESULT hrc = i_logStringProps(RTLogRelDefaultInstance(), RTLogGetFlags, "RTGetFlags", aLogRelFlags);
 
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::COMGETTER(LogRelGroups)(BSTR *a_pbstrSettings)
+HRESULT MachineDebugger::getLogRelGroups(com::Utf8Str &aLogRelGroups)
 {
-    CheckComArgOutPointerValid(a_pbstrSettings);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", a_pbstrSettings);
+    HRESULT hrc = i_logStringProps(RTLogRelDefaultInstance(), RTLogGetGroupSettings, "RTLogGetGroupSettings", aLogRelGroups);
 
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::COMGETTER(LogRelDestinations)(BSTR *a_pbstrSettings)
+HRESULT MachineDebugger::getLogRelDestinations(com::Utf8Str &aLogRelDestinations)
 {
-    CheckComArgOutPointerValid(a_pbstrSettings);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-        hrc = logStringProps(RTLogRelDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", a_pbstrSettings);
+    HRESULT hrc = i_logStringProps(RTLogRelDefaultInstance(), RTLogGetDestinations, "RTLogGetDestinations", aLogRelDestinations);
 
     return hrc;
 }
@@ -620,21 +553,16 @@ STDMETHODIMP MachineDebugger::COMGETTER(LogRelDestinations)(BSTR *a_pbstrSetting
  * @returns COM status code
  * @param   aEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExEnabled) (BOOL *aEnabled)
+HRESULT MachineDebugger::getHWVirtExEnabled(BOOL *aHWVirtExEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Console::SafeVMPtrQuiet ptrVM(mParent);
 
     if (ptrVM.isOk())
-        *aEnabled = HMR3IsEnabled(ptrVM.rawUVM());
+        *aHWVirtExEnabled = HMR3IsEnabled(ptrVM.rawUVM());
     else
-        *aEnabled = false;
+        *aHWVirtExEnabled = false;
 
     return S_OK;
 }
@@ -645,22 +573,16 @@ STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExEnabled) (BOOL *aEnabled)
  * @returns COM status code
  * @param   aEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExNestedPagingEnabled)(BOOL *aEnabled)
+HRESULT MachineDebugger::getHWVirtExNestedPagingEnabled(BOOL *aHWVirtExNestedPagingEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Console::SafeVMPtrQuiet ptrVM(mParent);
 
     if (ptrVM.isOk())
-        *aEnabled = HMR3IsNestedPagingActive(ptrVM.rawUVM());
+        *aHWVirtExNestedPagingEnabled = HMR3IsNestedPagingActive(ptrVM.rawUVM());
     else
-        *aEnabled = false;
+        *aHWVirtExNestedPagingEnabled = false;
 
     return S_OK;
 }
@@ -671,22 +593,16 @@ STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExNestedPagingEnabled)(BOOL *aEnab
  * @returns COM status code
  * @param   aEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExVPIDEnabled) (BOOL *aEnabled)
+HRESULT MachineDebugger::getHWVirtExVPIDEnabled(BOOL *aHWVirtExVPIDEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Console::SafeVMPtrQuiet ptrVM(mParent);
 
     if (ptrVM.isOk())
-        *aEnabled = HMR3IsVpidActive(ptrVM.rawUVM());
+        *aHWVirtExVPIDEnabled = HMR3IsVpidActive(ptrVM.rawUVM());
     else
-        *aEnabled = false;
+        *aHWVirtExVPIDEnabled = false;
 
     return S_OK;
 }
@@ -697,96 +613,78 @@ STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExVPIDEnabled) (BOOL *aEnabled)
  * @returns COM status code
  * @param   aEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(HWVirtExUXEnabled) (BOOL *aEnabled)
+HRESULT MachineDebugger::getHWVirtExUXEnabled(BOOL *aHWVirtExUXEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Console::SafeVMPtrQuiet ptrVM(mParent);
 
     if (ptrVM.isOk())
-        *aEnabled = HMR3IsUXActive(ptrVM.rawUVM());
+        *aHWVirtExUXEnabled = HMR3IsUXActive(ptrVM.rawUVM());
     else
-        *aEnabled = false;
+        *aHWVirtExUXEnabled = false;
 
     return S_OK;
 }
 
-STDMETHODIMP MachineDebugger::COMGETTER(OSName)(BSTR *a_pbstrName)
+HRESULT MachineDebugger::getOSName(com::Utf8Str &aOSName)
 {
     LogFlowThisFunc(("\n"));
-    CheckComArgNotNull(a_pbstrName);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
+        /*
+         * Do the job and try convert the name.
+         */
+        char szName[64];
+        int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), szName, sizeof(szName), NULL, 0);
+        if (RT_SUCCESS(vrc))
         {
-            /*
-             * Do the job and try convert the name.
-             */
-            char szName[64];
-            int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), szName, sizeof(szName), NULL, 0);
-            if (RT_SUCCESS(vrc))
+            try
             {
-                try
-                {
-                    Bstr bstrName(szName);
-                    bstrName.detachTo(a_pbstrName);
-                }
-                catch (std::bad_alloc)
-                {
-                    hrc = E_OUTOFMEMORY;
-                }
+                Bstr bstrName(szName);
+                aOSName = Utf8Str(bstrName);
+            }
+            catch (std::bad_alloc)
+            {
+                hrc = E_OUTOFMEMORY;
             }
-            else
-                hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc);
         }
+        else
+            hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc);
     }
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::COMGETTER(OSVersion)(BSTR *a_pbstrVersion)
+HRESULT MachineDebugger::getOSVersion(com::Utf8Str &aOSVersion)
 {
     LogFlowThisFunc(("\n"));
-    CheckComArgNotNull(a_pbstrVersion);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
+        /*
+         * Do the job and try convert the name.
+         */
+        char szVersion[256];
+        int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), NULL, 0, szVersion, sizeof(szVersion));
+        if (RT_SUCCESS(vrc))
         {
-            /*
-             * Do the job and try convert the name.
-             */
-            char szVersion[256];
-            int vrc = DBGFR3OSQueryNameAndVersion(ptrVM.rawUVM(), NULL, 0, szVersion, sizeof(szVersion));
-            if (RT_SUCCESS(vrc))
+            try
             {
-                try
-                {
-                    Bstr bstrVersion(szVersion);
-                    bstrVersion.detachTo(a_pbstrVersion);
-                }
-                catch (std::bad_alloc)
-                {
-                    hrc = E_OUTOFMEMORY;
-                }
+                Bstr bstrVersion(szVersion);
+                aOSVersion = Utf8Str(bstrVersion);
+            }
+            catch (std::bad_alloc)
+            {
+                hrc = E_OUTOFMEMORY;
             }
-            else
-                hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc);
         }
+        else
+            hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSQueryNameAndVersion failed with %Rrc"), vrc);
     }
     return hrc;
 }
@@ -797,13 +695,8 @@ STDMETHODIMP MachineDebugger::COMGETTER(OSVersion)(BSTR *a_pbstrVersion)
  * @returns COM status code
  * @param   aEnabled address of result variable
  */
-STDMETHODIMP MachineDebugger::COMGETTER(PAEEnabled) (BOOL *aEnabled)
+HRESULT MachineDebugger::getPAEEnabled(BOOL *aPAEEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Console::SafeVMPtrQuiet ptrVM(mParent);
@@ -812,10 +705,10 @@ STDMETHODIMP MachineDebugger::COMGETTER(PAEEnabled) (BOOL *aEnabled)
     {
         uint32_t cr4;
         int rc = DBGFR3RegCpuQueryU32(ptrVM.rawUVM(), 0 /*idCpu*/,  DBGFREG_CR4, &cr4); AssertRC(rc);
-        *aEnabled = RT_BOOL(cr4 & X86_CR4_PAE);
+        *aPAEEnabled = RT_BOOL(cr4 & X86_CR4_PAE);
     }
     else
-        *aEnabled = false;
+        *aPAEEnabled = false;
 
     return S_OK;
 }
@@ -826,21 +719,14 @@ STDMETHODIMP MachineDebugger::COMGETTER(PAEEnabled) (BOOL *aEnabled)
  * @returns COM status code.
  * @param   a_puPct      Where to store the rate.
  */
-STDMETHODIMP MachineDebugger::COMGETTER(VirtualTimeRate)(ULONG *a_puPct)
+HRESULT MachineDebugger::getVirtualTimeRate(ULONG *aVirtualTimeRate)
 {
-    CheckComArgOutPointerValid(a_puPct);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-            *a_puPct = TMR3GetWarpDrive(ptrVM.rawUVM());
-    }
+        *aVirtualTimeRate = TMR3GetWarpDrive(ptrVM.rawUVM());
 
     return hrc;
 }
@@ -851,28 +737,25 @@ STDMETHODIMP MachineDebugger::COMGETTER(VirtualTimeRate)(ULONG *a_puPct)
  * @returns COM status code.
  * @param   aPct     Where to store the rate.
  */
-STDMETHODIMP MachineDebugger::COMSETTER(VirtualTimeRate)(ULONG a_uPct)
+HRESULT MachineDebugger::setVirtualTimeRate(ULONG aVirtualTimeRate)
 {
-    if (a_uPct < 2 || a_uPct > 20000)
-        return setError(E_INVALIDARG, tr("%u is out of range [2..20000]"), a_uPct);
+    HRESULT hrc = S_OK;
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    if (aVirtualTimeRate < 2 || aVirtualTimeRate > 20000)
+        return setError(E_INVALIDARG, tr("%u is out of range [2..20000]"), aVirtualTimeRate);
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    if (i_queueSettings())
+        mVirtualTimeRateQueued = aVirtualTimeRate;
+    else
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        if (queueSettings())
-            mVirtualTimeRateQueued = a_uPct;
-        else
+        Console::SafeVMPtr ptrVM(mParent);
+        hrc = ptrVM.rc();
+        if (SUCCEEDED(hrc))
         {
-            Console::SafeVMPtr ptrVM(mParent);
-            hrc = ptrVM.rc();
-            if (SUCCEEDED(hrc))
-            {
-                int vrc = TMR3SetWarpDrive(ptrVM.rawUVM(), a_uPct);
-                if (RT_FAILURE(vrc))
-                    hrc = setError(VBOX_E_VM_ERROR, tr("TMR3SetWarpDrive(, %u) failed with rc=%Rrc"), a_uPct, vrc);
-            }
+            int vrc = TMR3SetWarpDrive(ptrVM.rawUVM(), aVirtualTimeRate);
+            if (RT_FAILURE(vrc))
+                hrc = setError(VBOX_E_VM_ERROR, tr("TMR3SetWarpDrive(, %u) failed with rc=%Rrc"), aVirtualTimeRate, vrc);
         }
     }
 
@@ -891,64 +774,49 @@ STDMETHODIMP MachineDebugger::COMSETTER(VirtualTimeRate)(ULONG a_uPct)
  * @remarks The returned handle must be passed to VMR3ReleaseUVM()!
  * @remarks Prior to 4.3 this returned PVM.
  */
-STDMETHODIMP MachineDebugger::COMGETTER(VM)(LONG64 *a_i64Vm)
+HRESULT MachineDebugger::getVM(LONG64 *aVM)
 {
-    CheckComArgOutPointerValid(a_i64Vm);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-        {
-            VMR3RetainUVM(ptrVM.rawUVM());
-            *a_i64Vm = (intptr_t)ptrVM.rawUVM();
-        }
-
-        /*
-         * Note! ptrVM protection provided by SafeVMPtr is no long effective
-         *       after we return from this method.
-         */
+        VMR3RetainUVM(ptrVM.rawUVM());
+        *aVM = (intptr_t)ptrVM.rawUVM();
     }
 
+    /*
+     * Note! ptrVM protection provided by SafeVMPtr is no long effective
+     *       after we return from this method.
+     */
     return hrc;
 }
 
 // IMachineDebugger methods
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP MachineDebugger::DumpGuestCore(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression)
+HRESULT MachineDebugger::dumpGuestCore(const com::Utf8Str &aFilename, const com::Utf8Str &aCompression)
 {
-    CheckComArgStrNotEmptyOrNull(a_bstrFilename);
-    Utf8Str strFilename(a_bstrFilename);
-    if (a_bstrCompression && *a_bstrCompression)
+    if (aCompression.length())
         return setError(E_INVALIDARG, tr("The compression parameter must be empty"));
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-        {
-            int vrc = DBGFR3CoreWrite(ptrVM.rawUVM(), strFilename.c_str(), false /*fReplaceFile*/);
-            if (RT_SUCCESS(vrc))
-                hrc = S_OK;
-            else
-                hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc);
-        }
+        int vrc = DBGFR3CoreWrite(ptrVM.rawUVM(), aFilename.c_str(), false /*fReplaceFile*/);
+        if (RT_SUCCESS(vrc))
+            hrc = S_OK;
+        else
+            hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc);
     }
 
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::DumpHostProcessCore(IN_BSTR a_bstrFilename, IN_BSTR a_bstrCompression)
+HRESULT MachineDebugger::dumpHostProcessCore(const com::Utf8Str &aFilename, const com::Utf8Str &aCompression)
 {
     ReturnComNotImplemented();
 }
@@ -1061,26 +929,11 @@ static void MachineDebuggerInfoDelete(PMACHINEDEBUGGERINOFHLP pHlp)
     pHlp->pszBuf = NULL;
 }
 
-STDMETHODIMP MachineDebugger::Info(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR *a_pbstrInfo)
+HRESULT MachineDebugger::info(const com::Utf8Str &aName, const com::Utf8Str &aArgs, com::Utf8Str &aInfo)
 {
     LogFlowThisFunc(("\n"));
 
     /*
-     * Validate and convert input.
-     */
-    CheckComArgStrNotEmptyOrNull(a_bstrName);
-    Utf8Str strName, strArgs;
-    try
-    {
-        strName = a_bstrName;
-        strArgs = a_bstrArgs;
-    }
-    catch (std::bad_alloc)
-    {
-        return E_OUTOFMEMORY;
-    }
-
-    /*
      * Do the autocaller and lock bits.
      */
     AutoCaller autoCaller(this);
@@ -1097,7 +950,7 @@ STDMETHODIMP MachineDebugger::Info(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR
              */
             MACHINEDEBUGGERINOFHLP Hlp;
             MachineDebuggerInfoInit(&Hlp);
-            int vrc = DBGFR3Info(ptrVM.rawUVM(),  strName.c_str(),  strArgs.c_str(), &Hlp.Core);
+            int vrc = DBGFR3Info(ptrVM.rawUVM(),  aName.c_str(),  aArgs.c_str(), &Hlp.Core);
             if (RT_SUCCESS(vrc))
             {
                 if (!Hlp.fOutOfMemory)
@@ -1108,7 +961,7 @@ STDMETHODIMP MachineDebugger::Info(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR
                     try
                     {
                         Bstr bstrInfo(Hlp.pszBuf);
-                        bstrInfo.detachTo(a_pbstrInfo);
+                        aInfo = bstrInfo;
                     }
                     catch (std::bad_alloc)
                     {
@@ -1126,153 +979,132 @@ STDMETHODIMP MachineDebugger::Info(IN_BSTR a_bstrName, IN_BSTR a_bstrArgs, BSTR
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::InjectNMI()
+HRESULT MachineDebugger::injectNMI()
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-        {
-            int vrc = DBGFR3InjectNMI(ptrVM.rawUVM(), 0);
-            if (RT_SUCCESS(vrc))
-                hrc = S_OK;
-            else
-                hrc = setError(E_FAIL, tr("DBGFR3InjectNMI failed with %Rrc"), vrc);
-        }
+        int vrc = DBGFR3InjectNMI(ptrVM.rawUVM(), 0);
+        if (RT_SUCCESS(vrc))
+            hrc = S_OK;
+        else
+            hrc = setError(E_FAIL, tr("DBGFR3InjectNMI failed with %Rrc"), vrc);
     }
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::ModifyLogFlags(IN_BSTR a_bstrSettings)
+HRESULT MachineDebugger::modifyLogFlags(const com::Utf8Str &aSettings)
 {
-    CheckComArgStrNotEmptyOrNull(a_bstrSettings);
-    Utf8Str strSettings(a_bstrSettings);
-
-    LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str()));
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    LogFlowThisFunc(("aSettings=%s\n", aSettings.c_str()));
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-        {
-            int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), strSettings.c_str());
-            if (RT_SUCCESS(vrc))
-                hrc = S_OK;
-            else
-                hrc = setError(E_FAIL, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc);
-        }
+        int vrc = DBGFR3LogModifyFlags(ptrVM.rawUVM(), aSettings.c_str());
+        if (RT_SUCCESS(vrc))
+            hrc = S_OK;
+        else
+            hrc = setError(E_FAIL, tr("DBGFR3LogModifyFlags failed with %Rrc"), vrc);
     }
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::ModifyLogGroups(IN_BSTR a_bstrSettings)
+HRESULT MachineDebugger::modifyLogGroups(const com::Utf8Str &aSettings)
 {
-    CheckComArgStrNotEmptyOrNull(a_bstrSettings);
-    Utf8Str strSettings(a_bstrSettings);
-
-    LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str()));
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    LogFlowThisFunc(("aSettings=%s\n", aSettings.c_str()));
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-        {
-            int vrc = DBGFR3LogModifyGroups(ptrVM.rawUVM(), strSettings.c_str());
-            if (RT_SUCCESS(vrc))
-                hrc = S_OK;
-            else
-                hrc = setError(E_FAIL, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc);
-        }
+        int vrc = DBGFR3LogModifyGroups(ptrVM.rawUVM(), aSettings.c_str());
+        if (RT_SUCCESS(vrc))
+            hrc = S_OK;
+        else
+            hrc = setError(E_FAIL, tr("DBGFR3LogModifyGroups failed with %Rrc"), vrc);
     }
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::ModifyLogDestinations(IN_BSTR a_bstrSettings)
+HRESULT MachineDebugger::modifyLogDestinations(const com::Utf8Str &aSettings)
 {
-    CheckComArgStrNotEmptyOrNull(a_bstrSettings);
-    Utf8Str strSettings(a_bstrSettings);
-
-    LogFlowThisFunc(("a_bstrSettings=%s\n", strSettings.c_str()));
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    LogFlowThisFunc(("aSettings=%s\n", aSettings.c_str()));
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
-        {
-            int vrc = DBGFR3LogModifyDestinations(ptrVM.rawUVM(), strSettings.c_str());
-            if (RT_SUCCESS(vrc))
-                hrc = S_OK;
-            else
-                hrc = setError(E_FAIL, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc);
-        }
+        int vrc = DBGFR3LogModifyDestinations(ptrVM.rawUVM(), aSettings.c_str());
+        if (RT_SUCCESS(vrc))
+            hrc = S_OK;
+        else
+            hrc = setError(E_FAIL, tr("DBGFR3LogModifyDestinations failed with %Rrc"), vrc);
     }
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::ReadPhysicalMemory(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData))
+HRESULT MachineDebugger::readPhysicalMemory(LONG64 aAddress, ULONG aSize, std::vector<BYTE> &aBytes)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP MachineDebugger::WritePhysicalMemory(LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData))
+HRESULT MachineDebugger::writePhysicalMemory(LONG64 aAddress, ULONG aSize, const std::vector<BYTE> &aBytes)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP MachineDebugger::ReadVirtualMemory(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayOut(BYTE, a_abData))
+HRESULT MachineDebugger::readVirtualMemory(ULONG aCpuId, LONG64 aAddress, ULONG aSize, std::vector<BYTE> &aBytes)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP MachineDebugger::WriteVirtualMemory(ULONG a_idCpu, LONG64 a_Address, ULONG a_cbRead, ComSafeArrayIn(BYTE, a_abData))
+HRESULT MachineDebugger::writeVirtualMemory(ULONG aCpuId, LONG64 aAddress, ULONG aSize, const std::vector<BYTE> &aBytes)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP MachineDebugger::DetectOS(BSTR *a_pbstrName)
+HRESULT MachineDebugger::loadPlugIn(const com::Utf8Str &aName, com::Utf8Str &aPlugInName)
 {
-    LogFlowThisFunc(("\n"));
-    CheckComArgNotNull(a_pbstrName);
-
     /*
-     * Do the autocaller and lock bits.
+     * Lock the debugger and get the VM pointer
      */
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
+        /*
+         * Do the job and try convert the name.
+         */
+        if (aName.equals("all"))
         {
-            /*
-             * Do the job and try convert the name.
-             */
-/** @todo automatically load the DBGC plugins or this is a waste of time. */
-            char szName[64];
-            int vrc = DBGFR3OSDetect(ptrVM.rawUVM(), szName, sizeof(szName));
-            if (RT_SUCCESS(vrc) && vrc != VINF_DBGF_OS_NOT_DETCTED)
+            DBGFR3PlugInLoadAll(ptrVM.rawUVM());
+            try
+            {
+                aPlugInName = "all";
+                hrc = S_OK;
+            }
+            catch (std::bad_alloc)
+            {
+                hrc = E_OUTOFMEMORY;
+            }
+        }
+        else
+        {
+            RTERRINFOSTATIC ErrInfo;
+            char            szName[80];
+            int vrc = DBGFR3PlugInLoad(ptrVM.rawUVM(), aName.c_str(), szName, sizeof(szName), RTErrInfoInitStatic(&ErrInfo));
+            if (RT_SUCCESS(vrc))
             {
                 try
                 {
-                    Bstr bstrName(szName);
-                    bstrName.detachTo(a_pbstrName);
+                    aPlugInName = "all";
+                    hrc = S_OK;
                 }
                 catch (std::bad_alloc)
                 {
@@ -1280,10 +1112,125 @@ STDMETHODIMP MachineDebugger::DetectOS(BSTR *a_pbstrName)
                 }
             }
             else
-                hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSDetect failed with %Rrc"), vrc);
+                hrc = setErrorVrc(vrc, "%s", ErrInfo.szMsg);
+        }
+    }
+    return hrc;
+
+}
+
+HRESULT MachineDebugger::unloadPlugIn(const com::Utf8Str &aName)
+{
+    /*
+     * Lock the debugger and get the VM pointer
+     */
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
+    if (SUCCEEDED(hrc))
+    {
+        /*
+         * Do the job and try convert the name.
+         */
+        if (aName.equals("all"))
+        {
+            DBGFR3PlugInUnloadAll(ptrVM.rawUVM());
+            hrc = S_OK;
+        }
+        else
+        {
+            int vrc = DBGFR3PlugInUnload(ptrVM.rawUVM(), aName.c_str());
+            if (RT_SUCCESS(vrc))
+                hrc = S_OK;
+            else if (vrc == VERR_NOT_FOUND)
+                hrc = setErrorBoth(E_FAIL, vrc, "Plug-in '%s' was not found", aName.c_str());
+            else
+                hrc = setErrorVrc(vrc, "Error unloading '%s': %Rrc", aName.c_str(), vrc);
         }
     }
     return hrc;
+
+}
+
+HRESULT MachineDebugger::detectOS(com::Utf8Str &aOs)
+{
+    LogFlowThisFunc(("\n"));
+
+    /*
+     * Lock the debugger and get the VM pointer
+     */
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
+    if (SUCCEEDED(hrc))
+    {
+        /*
+         * Do the job.
+         */
+        char szName[64];
+        int vrc = DBGFR3OSDetect(ptrVM.rawUVM(), szName, sizeof(szName));
+        if (RT_SUCCESS(vrc) && vrc != VINF_DBGF_OS_NOT_DETCTED)
+        {
+            try
+            {
+                aOs = szName;
+            }
+            catch (std::bad_alloc)
+            {
+                hrc = E_OUTOFMEMORY;
+            }
+        }
+        else
+            hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSDetect failed with %Rrc"), vrc);
+    }
+    return hrc;
+}
+
+HRESULT MachineDebugger::queryOSKernelLog(ULONG aMaxMessages, com::Utf8Str &aDmesg)
+{
+    /*
+     * Lock the debugger and get the VM pointer
+     */
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
+    if (SUCCEEDED(hrc))
+    {
+        PDBGFOSIDMESG pDmesg = (PDBGFOSIDMESG)DBGFR3OSQueryInterface(ptrVM.rawUVM(), DBGFOSINTERFACE_DMESG);
+        if (pDmesg)
+        {
+            size_t   cbActual;
+            size_t   cbBuf  = _512K;
+            int vrc = aDmesg.reserveNoThrow(cbBuf);
+            if (RT_SUCCESS(vrc))
+            {
+                uint32_t cMessages = aMaxMessages == 0 ? UINT32_MAX : aMaxMessages;
+                vrc = pDmesg->pfnQueryKernelLog(pDmesg, ptrVM.rawUVM(), 0 /*fFlags*/, cMessages,
+                                                aDmesg.mutableRaw(), cbBuf, &cbActual);
+
+                uint32_t cTries = 10;
+                while (vrc == VERR_BUFFER_OVERFLOW && cbBuf < 16*_1M && cTries-- > 0)
+                {
+                    cbBuf = RT_ALIGN_Z(cbActual + _4K, _4K);
+                    int vrc = aDmesg.reserveNoThrow(cbBuf);
+                    if (RT_SUCCESS(vrc))
+                        vrc = pDmesg->pfnQueryKernelLog(pDmesg, ptrVM.rawUVM(), 0 /*fFlags*/, cMessages,
+                                                        aDmesg.mutableRaw(), cbBuf, &cbActual);
+                }
+                if (RT_SUCCESS(vrc))
+                    aDmesg.jolt();
+                else if (vrc == VERR_BUFFER_OVERFLOW)
+                    hrc = setError(E_FAIL, "Too much log available, must use the maxMessages parameter to restrict.");
+                else
+                    hrc = setErrorVrc(vrc);
+            }
+            else
+                hrc = setErrorBoth(E_OUTOFMEMORY, vrc);
+        }
+        else
+            hrc = setError(E_FAIL, "The dmesg interface isn't implemented by guest OS digger, or detectOS() has not been called.");
+    }
+    return hrc;
 }
 
 /**
@@ -1306,149 +1253,120 @@ DECLINLINE(HRESULT) formatRegisterValue(Bstr *a_pbstr, PCDBGFREGVAL a_pValue, DB
     return S_OK;
 }
 
-STDMETHODIMP MachineDebugger::GetRegister(ULONG a_idCpu, IN_BSTR a_bstrName, BSTR *a_pbstrValue)
+HRESULT MachineDebugger::getRegister(ULONG aCpuId, const com::Utf8Str &aName, com::Utf8Str &aValue)
 {
     /*
-     * Validate and convert input.
-     */
-    CheckComArgStrNotEmptyOrNull(a_bstrName);
-    CheckComArgNotNull(a_pbstrValue);
-    Utf8Str strName;
-    try
-    {
-        strName = a_bstrName;
-    }
-    catch (std::bad_alloc)
-    {
-        return E_OUTOFMEMORY;
-    }
-
-    /*
      * The prologue.
      */
     LogFlowThisFunc(("\n"));
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
+        /*
+         * Real work.
+         */
+        DBGFREGVAL      Value;
+        DBGFREGVALTYPE  enmType;
+        int vrc = DBGFR3RegNmQuery(ptrVM.rawUVM(), aCpuId, aName.c_str(), &Value, &enmType);
+        if (RT_SUCCESS(vrc))
         {
-            /*
-             * Real work.
-             */
-            DBGFREGVAL      Value;
-            DBGFREGVALTYPE  enmType;
-            int vrc = DBGFR3RegNmQuery(ptrVM.rawUVM(), a_idCpu, strName.c_str(), &Value, &enmType);
-            if (RT_SUCCESS(vrc))
+            try
             {
-                try
-                {
-                    Bstr bstrValue;
-                    hrc = formatRegisterValue(&bstrValue, &Value, enmType);
-                    if (SUCCEEDED(hrc))
-                        bstrValue.detachTo(a_pbstrValue);
-                }
-                catch (std::bad_alloc)
-                {
-                    hrc = E_OUTOFMEMORY;
-                }
+                Bstr bstrValue;
+                hrc = formatRegisterValue(&bstrValue, &Value, enmType);
+                if (SUCCEEDED(hrc))
+                    aValue = Utf8Str(bstrValue);
+            }
+            catch (std::bad_alloc)
+            {
+                hrc = E_OUTOFMEMORY;
             }
-            else if (vrc == VERR_DBGF_REGISTER_NOT_FOUND)
-                hrc = setError(E_FAIL, tr("Register '%s' was not found"), strName.c_str());
-            else if (vrc == VERR_INVALID_CPU_ID)
-                hrc = setError(E_FAIL, tr("Invalid CPU ID: %u"), a_idCpu);
-            else
-                hrc = setError(VBOX_E_VM_ERROR,
-                               tr("DBGFR3RegNmQuery failed with rc=%Rrc querying register '%s' with default cpu set to %u"),
-                               vrc, strName.c_str(), a_idCpu);
         }
+        else if (vrc == VERR_DBGF_REGISTER_NOT_FOUND)
+            hrc = setError(E_FAIL, tr("Register '%s' was not found"), aName.c_str());
+        else if (vrc == VERR_INVALID_CPU_ID)
+            hrc = setError(E_FAIL, tr("Invalid CPU ID: %u"), aCpuId);
+        else
+            hrc = setError(VBOX_E_VM_ERROR,
+                           tr("DBGFR3RegNmQuery failed with rc=%Rrc querying register '%s' with default cpu set to %u"),
+                           vrc, aName.c_str(), aCpuId);
     }
 
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::GetRegisters(ULONG a_idCpu, ComSafeArrayOut(BSTR, a_bstrNames), ComSafeArrayOut(BSTR, a_bstrValues))
+HRESULT MachineDebugger::getRegisters(ULONG aCpuId, std::vector<com::Utf8Str> &aNames, std::vector<com::Utf8Str> &aValues)
 {
     /*
      * The prologue.
      */
     LogFlowThisFunc(("\n"));
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Console::SafeVMPtr ptrVM(mParent);
+    HRESULT hrc = ptrVM.rc();
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Console::SafeVMPtr ptrVM(mParent);
-        hrc = ptrVM.rc();
-        if (SUCCEEDED(hrc))
+        /*
+         * Real work.
+         */
+        size_t cRegs;
+        int vrc = DBGFR3RegNmQueryAllCount(ptrVM.rawUVM(), &cRegs);
+        if (RT_SUCCESS(vrc))
         {
-            /*
-             * Real work.
-             */
-            size_t cRegs;
-            int vrc = DBGFR3RegNmQueryAllCount(ptrVM.rawUVM(), &cRegs);
-            if (RT_SUCCESS(vrc))
+            PDBGFREGENTRYNM paRegs = (PDBGFREGENTRYNM)RTMemAllocZ(sizeof(paRegs[0]) * cRegs);
+            if (paRegs)
             {
-                PDBGFREGENTRYNM paRegs = (PDBGFREGENTRYNM)RTMemAllocZ(sizeof(paRegs[0]) * cRegs);
-                if (paRegs)
+                vrc = DBGFR3RegNmQueryAll(ptrVM.rawUVM(), paRegs, cRegs);
+                if (RT_SUCCESS(vrc))
                 {
-                    vrc = DBGFR3RegNmQueryAll(ptrVM.rawUVM(), paRegs, cRegs);
-                    if (RT_SUCCESS(vrc))
+                    try
                     {
-                        try
+                        aValues.resize(cRegs);
+                        aNames.resize(cRegs);
+                        for (uint32_t iReg = 0; iReg < cRegs; iReg++)
                         {
-                            com::SafeArray<BSTR> abstrNames(cRegs);
-                            com::SafeArray<BSTR> abstrValues(cRegs);
-
-                            for (uint32_t iReg = 0; iReg < cRegs; iReg++)
-                            {
-                                Bstr bstrValue;
-
-                                hrc = formatRegisterValue(&bstrValue, &paRegs[iReg].Val, paRegs[iReg].enmType);
-                                AssertComRC(hrc);
-                                bstrValue.detachTo(&abstrValues[iReg]);
-
-                                Bstr bstrName(paRegs[iReg].pszName);
-                                bstrName.detachTo(&abstrNames[iReg]);
-                            }
-
-                            abstrNames.detachTo(ComSafeArrayOutArg(a_bstrNames));
-                            abstrValues.detachTo(ComSafeArrayOutArg(a_bstrValues));
-                        }
-                        catch (std::bad_alloc)
-                        {
-                            hrc = E_OUTOFMEMORY;
+                            char szHex[160];
+                            szHex[159] = szHex[0] = '\0';
+                            ssize_t cch = DBGFR3RegFormatValue(szHex, sizeof(szHex), &paRegs[iReg].Val,
+                                                               paRegs[iReg].enmType, true /*fSpecial*/);
+                            Assert(cch > 0);
+                            aNames[iReg] = Utf8Str(paRegs[iReg].pszName);
+                            aValues[iReg] = Utf8Str(szHex);
                         }
                     }
-                    else
-                        hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAll failed with %Rrc"), vrc);
-
-                    RTMemFree(paRegs);
+                    catch (std::bad_alloc)
+                    {
+                        hrc = E_OUTOFMEMORY;
+                    }
                 }
                 else
-                    hrc = E_OUTOFMEMORY;
+                    hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAll failed with %Rrc"), vrc);
+
+                RTMemFree(paRegs);
             }
             else
-                hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAllCount failed with %Rrc"), vrc);
+                hrc = E_OUTOFMEMORY;
         }
+        else
+            hrc = setError(E_FAIL, tr("DBGFR3RegNmQueryAllCount failed with %Rrc"), vrc);
     }
     return hrc;
 }
 
-STDMETHODIMP MachineDebugger::SetRegister(ULONG a_idCpu, IN_BSTR a_bstrName, IN_BSTR a_bstrValue)
+HRESULT MachineDebugger::setRegister(ULONG aCpuId, const com::Utf8Str &aName, const com::Utf8Str &aValue)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP MachineDebugger::SetRegisters(ULONG a_idCpu, ComSafeArrayIn(IN_BSTR, a_bstrNames), ComSafeArrayIn(IN_BSTR, a_bstrValues))
+HRESULT MachineDebugger::setRegisters(ULONG aCpuId, const std::vector<com::Utf8Str> &aNames,
+                                      const std::vector<com::Utf8Str> &aValues)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP MachineDebugger::DumpGuestStack(ULONG a_idCpu, BSTR *a_pbstrStack)
+HRESULT MachineDebugger::dumpGuestStack(ULONG aCpuId, com::Utf8Str &aStack)
 {
     ReturnComNotImplemented();
 }
@@ -1459,14 +1377,14 @@ STDMETHODIMP MachineDebugger::DumpGuestStack(ULONG a_idCpu, BSTR *a_pbstrStack)
  * @returns COM status code.
  * @param   aPattern            The selection pattern. A bit similar to filename globbing.
  */
-STDMETHODIMP MachineDebugger::ResetStats(IN_BSTR aPattern)
+HRESULT MachineDebugger::resetStats(const com::Utf8Str &aPattern)
 {
     Console::SafeVMPtrQuiet ptrVM(mParent);
 
     if (!ptrVM.isOk())
         return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running");
 
-    STAMR3Reset(ptrVM.rawUVM(), Utf8Str(aPattern).c_str());
+    STAMR3Reset(ptrVM.rawUVM(), aPattern.c_str());
 
     return S_OK;
 }
@@ -1477,14 +1395,14 @@ STDMETHODIMP MachineDebugger::ResetStats(IN_BSTR aPattern)
  * @returns COM status code.
  * @param   aPattern            The selection pattern. A bit similar to filename globbing.
  */
-STDMETHODIMP MachineDebugger::DumpStats(IN_BSTR aPattern)
+HRESULT MachineDebugger::dumpStats(const com::Utf8Str &aPattern)
 {
     Console::SafeVMPtrQuiet ptrVM(mParent);
 
     if (!ptrVM.isOk())
         return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running");
 
-    STAMR3Dump(ptrVM.rawUVM(), Utf8Str(aPattern).c_str());
+    STAMR3Dump(ptrVM.rawUVM(), aPattern.c_str());
 
     return S_OK;
 }
@@ -1497,7 +1415,7 @@ STDMETHODIMP MachineDebugger::DumpStats(IN_BSTR aPattern)
  * @param   aWithDescriptions   Whether to include the descriptions.
  * @param   aStats              The XML document containing the statistics.
  */
-STDMETHODIMP MachineDebugger::GetStats (IN_BSTR aPattern, BOOL aWithDescriptions, BSTR *aStats)
+HRESULT MachineDebugger::getStats(const com::Utf8Str &aPattern, BOOL aWithDescriptions, com::Utf8Str &aStats)
 {
     Console::SafeVMPtrQuiet ptrVM (mParent);
 
@@ -1505,7 +1423,7 @@ STDMETHODIMP MachineDebugger::GetStats (IN_BSTR aPattern, BOOL aWithDescriptions
         return setError(VBOX_E_INVALID_VM_STATE, "Machine is not running");
 
     char *pszSnapshot;
-    int vrc = STAMR3Snapshot(ptrVM.rawUVM(), Utf8Str(aPattern).c_str(), &pszSnapshot, NULL,
+    int vrc = STAMR3Snapshot(ptrVM.rawUVM(), aPattern.c_str(), &pszSnapshot, NULL,
                              !!aWithDescriptions);
     if (RT_FAILURE(vrc))
         return vrc == VERR_NO_MEMORY ? E_OUTOFMEMORY : E_FAIL;
@@ -1514,7 +1432,7 @@ STDMETHODIMP MachineDebugger::GetStats (IN_BSTR aPattern, BOOL aWithDescriptions
      * Must use UTF-8 or ASCII here and completely avoid these two extra copy operations.
      * Until that's done, this method is kind of useless for debugger statistics GUI because
      * of the amount statistics in a debug build. */
-    Bstr(pszSnapshot).detachTo(aStats);
+    aStats = Utf8Str(pszSnapshot);
     STAMR3SnapshotFree(ptrVM.rawUVM(), pszSnapshot);
 
     return S_OK;
@@ -1524,7 +1442,7 @@ STDMETHODIMP MachineDebugger::GetStats (IN_BSTR aPattern, BOOL aWithDescriptions
 // public methods only for internal purposes
 /////////////////////////////////////////////////////////////////////////////
 
-void MachineDebugger::flushQueuedSettings()
+void MachineDebugger::i_flushQueuedSettings()
 {
     mFlushMode = true;
     if (mSingleStepQueued != ~0)
@@ -1535,7 +1453,7 @@ void MachineDebugger::flushQueuedSettings()
     for (unsigned i = 0; i < EMEXECPOLICY_END; i++)
         if (maiQueuedEmExecPolicyParams[i] != UINT8_MAX)
         {
-            setEmExecPolicyProperty((EMEXECPOLICY)i, RT_BOOL(maiQueuedEmExecPolicyParams[i]));
+            i_setEmExecPolicyProperty((EMEXECPOLICY)i, RT_BOOL(maiQueuedEmExecPolicyParams[i]));
             maiQueuedEmExecPolicyParams[i] = UINT8_MAX;
         }
     if (mPatmEnabledQueued != ~0)
@@ -1564,7 +1482,7 @@ void MachineDebugger::flushQueuedSettings()
 // private methods
 /////////////////////////////////////////////////////////////////////////////
 
-bool MachineDebugger::queueSettings() const
+bool MachineDebugger::i_queueSettings() const
 {
     if (!mFlushMode)
     {
diff --git a/src/VBox/Main/src-client/MouseImpl.cpp b/src/VBox/Main/src-client/MouseImpl.cpp
index 37e7bfc..9535af3 100644
--- a/src/VBox/Main/src-client/MouseImpl.cpp
+++ b/src/VBox/Main/src-client/MouseImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,6 +20,7 @@
 #include "MouseImpl.h"
 #include "DisplayImpl.h"
 #include "VMMDev.h"
+#include "MousePointerShapeWrap.h"
 
 #include "AutoCaller.h"
 #include "Logging.h"
@@ -29,6 +30,154 @@
 
 #include <iprt/asm.h>
 
+class ATL_NO_VTABLE MousePointerShape:
+    public MousePointerShapeWrap
+{
+public:
+
+    DECLARE_EMPTY_CTOR_DTOR(MousePointerShape)
+
+    HRESULT FinalConstruct();
+    void FinalRelease();
+
+    /* Public initializer/uninitializer for internal purposes only. */
+    HRESULT init(ComObjPtr<Mouse> pMouse,
+                 bool fVisible, bool fAlpha,
+                 uint32_t hotX, uint32_t hotY,
+                 uint32_t width, uint32_t height,
+                 const uint8_t *pu8Shape, uint32_t cbShape);
+    void uninit();
+
+private:
+    // wrapped IMousePointerShape properties
+    virtual HRESULT getVisible(BOOL *aVisible);
+    virtual HRESULT getAlpha(BOOL *aAlpha);
+    virtual HRESULT getHotX(ULONG *aHotX);
+    virtual HRESULT getHotY(ULONG *aHotY);
+    virtual HRESULT getWidth(ULONG *aWidth);
+    virtual HRESULT getHeight(ULONG *aHeight);
+    virtual HRESULT getShape(std::vector<BYTE> &aShape);
+
+    struct Data
+    {
+        ComObjPtr<Mouse> pMouse;
+        bool fVisible;
+        bool fAlpha;
+        uint32_t hotX;
+        uint32_t hotY;
+        uint32_t width;
+        uint32_t height;
+        std::vector<BYTE> shape;
+    };
+
+    Data m;
+};
+
+/*
+ * MousePointerShape implementation.
+ */
+DEFINE_EMPTY_CTOR_DTOR(MousePointerShape)
+
+HRESULT MousePointerShape::FinalConstruct()
+{
+    return BaseFinalConstruct();
+}
+
+void MousePointerShape::FinalRelease()
+{
+    uninit();
+
+    BaseFinalRelease();
+}
+
+HRESULT MousePointerShape::init(ComObjPtr<Mouse> pMouse,
+                                bool fVisible, bool fAlpha,
+                                uint32_t hotX, uint32_t hotY,
+                                uint32_t width, uint32_t height,
+                                const uint8_t *pu8Shape, uint32_t cbShape)
+{
+    LogFlowThisFunc(("v %d, a %d, h %d,%d, %dx%d, cb %d\n",
+                     fVisible, fAlpha, hotX, hotY, width, height, cbShape));
+
+    /* Enclose the state transition NotReady->InInit->Ready */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+
+    m.pMouse = pMouse;
+    m.fVisible = fVisible;
+    m.fAlpha   = fAlpha;
+    m.hotX     = hotX;
+    m.hotY     = hotY;
+    m.width    = width;
+    m.height   = height;
+    m.shape.resize(cbShape);
+    if (cbShape)
+    {
+        memcpy(&m.shape.front(), pu8Shape, cbShape);
+    }
+
+    /* Confirm a successful initialization */
+    autoInitSpan.setSucceeded();
+
+    return S_OK;
+}
+
+void MousePointerShape::uninit()
+{
+    LogFlowThisFunc(("\n"));
+
+    /* Enclose the state transition Ready->InUninit->NotReady */
+    AutoUninitSpan autoUninitSpan(this);
+    if (autoUninitSpan.uninitDone())
+        return;
+
+    m.pMouse.setNull();
+}
+
+HRESULT MousePointerShape::getVisible(BOOL *aVisible)
+{
+    *aVisible = m.fVisible;
+    return S_OK;
+}
+
+HRESULT MousePointerShape::getAlpha(BOOL *aAlpha)
+{
+    *aAlpha = m.fAlpha;
+    return S_OK;
+}
+
+HRESULT MousePointerShape::getHotX(ULONG *aHotX)
+{
+    *aHotX = m.hotX;
+    return S_OK;
+}
+
+HRESULT MousePointerShape::getHotY(ULONG *aHotY)
+{
+    *aHotY = m.hotY;
+    return S_OK;
+}
+
+HRESULT MousePointerShape::getWidth(ULONG *aWidth)
+{
+    *aWidth = m.width;
+    return S_OK;
+}
+
+HRESULT MousePointerShape::getHeight(ULONG *aHeight)
+{
+    *aHeight = m.height;
+    return S_OK;
+}
+
+HRESULT MousePointerShape::getShape(std::vector<BYTE> &aShape)
+{
+    aShape.resize(m.shape.size());
+    memcpy(&aShape.front(), &m.shape.front(), aShape.size());
+    return S_OK;
+}
+
+
 /** @name Mouse device capabilities bitfield
  * @{ */
 enum
@@ -77,6 +226,7 @@ Mouse::~Mouse()
 HRESULT Mouse::FinalConstruct()
 {
     RT_ZERO(mpDrv);
+    RT_ZERO(mPointerData);
     mcLastX = 0x8000;
     mcLastY = 0x8000;
     mfLastButtons = 0;
@@ -143,11 +293,45 @@ void Mouse::uninit()
         mpDrv[i] = NULL;
     }
 
+    mPointerShape.setNull();
+
+    RTMemFree(mPointerData.pu8Shape);
+    mPointerData.pu8Shape = NULL;
+    mPointerData.cbShape = 0;
+
     mMouseEvent.uninit();
     unconst(mEventSource).setNull();
     unconst(mParent) = NULL;
 }
 
+void Mouse::updateMousePointerShape(bool fVisible, bool fAlpha,
+                                    uint32_t hotX, uint32_t hotY,
+                                    uint32_t width, uint32_t height,
+                                    const uint8_t *pu8Shape, uint32_t cbShape)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    RTMemFree(mPointerData.pu8Shape);
+    mPointerData.pu8Shape = NULL;
+    mPointerData.cbShape = 0;
+
+    mPointerData.fVisible = fVisible;
+    mPointerData.fAlpha   = fAlpha;
+    mPointerData.hotX     = hotX;
+    mPointerData.hotY     = hotY;
+    mPointerData.width    = width;
+    mPointerData.height   = height;
+    if (cbShape)
+    {
+        mPointerData.pu8Shape = (uint8_t *)RTMemDup(pu8Shape, cbShape);
+        if (mPointerData.pu8Shape)
+        {
+            mPointerData.cbShape = cbShape;
+        }
+    }
+
+    mPointerShape.setNull();
+}
 
 // IMouse properties
 /////////////////////////////////////////////////////////////////////////////
@@ -155,14 +339,14 @@ void Mouse::uninit()
 /** Report the front-end's mouse handling capabilities to the VMM device and
  * thus to the guest.
  * @note all calls out of this object are made with no locks held! */
-HRESULT Mouse::updateVMMDevMouseCaps(uint32_t fCapsAdded,
-                                     uint32_t fCapsRemoved)
+HRESULT Mouse::i_updateVMMDevMouseCaps(uint32_t fCapsAdded,
+                                       uint32_t fCapsRemoved)
 {
-    VMMDevMouseInterface *pVMMDev = mParent->getVMMDevMouseInterface();
+    VMMDevMouseInterface *pVMMDev = mParent->i_getVMMDevMouseInterface();
     if (!pVMMDev)
         return E_FAIL;  /* No assertion, as the front-ends can send events
                          * at all sorts of inconvenient times. */
-    DisplayMouseInterface *pDisplay = mParent->getDisplayMouseInterface();
+    DisplayMouseInterface *pDisplay = mParent->i_getDisplayMouseInterface();
     if (pDisplay == NULL)
         return E_FAIL;
     PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
@@ -183,15 +367,9 @@ HRESULT Mouse::updateVMMDevMouseCaps(uint32_t fCapsAdded,
  * @returns COM status code
  * @param absoluteSupported address of result variable
  */
-STDMETHODIMP Mouse::COMGETTER(AbsoluteSupported) (BOOL *absoluteSupported)
+HRESULT Mouse::getAbsoluteSupported(BOOL *aAbsoluteSupported)
 {
-    if (!absoluteSupported)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *absoluteSupported = supportsAbs();
+    *aAbsoluteSupported = i_supportsAbs();
     return S_OK;
 }
 
@@ -202,15 +380,9 @@ STDMETHODIMP Mouse::COMGETTER(AbsoluteSupported) (BOOL *absoluteSupported)
  * @returns COM status code
  * @param relativeSupported address of result variable
  */
-STDMETHODIMP Mouse::COMGETTER(RelativeSupported) (BOOL *relativeSupported)
+HRESULT Mouse::getRelativeSupported(BOOL *aRelativeSupported)
 {
-    if (!relativeSupported)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *relativeSupported = supportsRel();
+    *aRelativeSupported = i_supportsRel();
     return S_OK;
 }
 
@@ -221,15 +393,9 @@ STDMETHODIMP Mouse::COMGETTER(RelativeSupported) (BOOL *relativeSupported)
  * @returns COM status code
  * @param multiTouchSupported address of result variable
  */
-STDMETHODIMP Mouse::COMGETTER(MultiTouchSupported) (BOOL *multiTouchSupported)
+HRESULT Mouse::getMultiTouchSupported(BOOL *aMultiTouchSupported)
 {
-    if (!multiTouchSupported)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *multiTouchSupported = supportsMT();
+    *aMultiTouchSupported = i_supportsMT();
     return S_OK;
 }
 
@@ -240,16 +406,42 @@ STDMETHODIMP Mouse::COMGETTER(MultiTouchSupported) (BOOL *multiTouchSupported)
  * @returns COM status code
  * @param pfNeedsHostCursor address of result variable
  */
-STDMETHODIMP Mouse::COMGETTER(NeedsHostCursor) (BOOL *pfNeedsHostCursor)
+HRESULT Mouse::getNeedsHostCursor(BOOL *aNeedsHostCursor)
 {
-    if (!pfNeedsHostCursor)
-        return E_POINTER;
+    *aNeedsHostCursor = i_guestNeedsHostCursor();
+    return S_OK;
+}
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT Mouse::getPointerShape(ComPtr<IMousePointerShape> &aPointerShape)
+{
+    HRESULT hr = S_OK;
 
-    *pfNeedsHostCursor = guestNeedsHostCursor();
-    return S_OK;
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (mPointerShape.isNull())
+    {
+        ComObjPtr<MousePointerShape> obj;
+        hr = obj.createObject();
+        if (SUCCEEDED(hr))
+        {
+            hr = obj->init(this, mPointerData.fVisible, mPointerData.fAlpha,
+                           mPointerData.hotX, mPointerData.hotY,
+                           mPointerData.width, mPointerData.height,
+                           mPointerData.pu8Shape, mPointerData.cbShape);
+        }
+
+        if (SUCCEEDED(hr))
+        {
+            mPointerShape = obj;
+        }
+    }
+
+    if (SUCCEEDED(hr))
+    {
+        aPointerShape = mPointerShape;
+    }
+
+    return hr;
 }
 
 // IMouse methods
@@ -258,7 +450,7 @@ STDMETHODIMP Mouse::COMGETTER(NeedsHostCursor) (BOOL *pfNeedsHostCursor)
 /** Converts a bitfield containing information about mouse buttons currently
  * held down from the format used by the front-end to the format used by PDM
  * and the emulated pointing devices. */
-static uint32_t mouseButtonsToPDM(LONG buttonState)
+static uint32_t i_mouseButtonsToPDM(LONG buttonState)
 {
     uint32_t fButtons = 0;
     if (buttonState & MouseButtonState_LeftButton)
@@ -274,16 +466,10 @@ static uint32_t mouseButtonsToPDM(LONG buttonState)
     return fButtons;
 }
 
-STDMETHODIMP Mouse::COMGETTER(EventSource)(IEventSource ** aEventSource)
+HRESULT Mouse::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // no need to lock - lifetime constant
-    mEventSource.queryInterfaceTo(aEventSource);
-
+    mEventSource.queryInterfaceTo(aEventSource.asOutParam());
     return S_OK;
 }
 
@@ -293,8 +479,8 @@ STDMETHODIMP Mouse::COMGETTER(EventSource)(IEventSource ** aEventSource)
  *
  * @returns   COM status code
  */
-HRESULT Mouse::reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
-                                        int32_t dw, uint32_t fButtons)
+HRESULT Mouse::i_reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
+                                          int32_t dw, uint32_t fButtons)
 {
     if (dx || dy || dz || dw || fButtons != mfLastButtons)
     {
@@ -329,8 +515,8 @@ HRESULT Mouse::reportRelEventToMouseDev(int32_t dx, int32_t dy, int32_t dz,
  *
  * @returns   COM status code
  */
-HRESULT Mouse::reportAbsEventToMouseDev(int32_t x, int32_t y,
-                                        int32_t dz, int32_t dw, uint32_t fButtons)
+HRESULT Mouse::i_reportAbsEventToMouseDev(int32_t x, int32_t y,
+                                          int32_t dz, int32_t dw, uint32_t fButtons)
 {
     if (   x < VMMDEV_MOUSE_RANGE_MIN
         || x > VMMDEV_MOUSE_RANGE_MAX)
@@ -366,9 +552,9 @@ HRESULT Mouse::reportAbsEventToMouseDev(int32_t x, int32_t y,
     return S_OK;
 }
 
-HRESULT Mouse::reportMultiTouchEventToDevice(uint8_t cContacts,
-                                             const uint64_t *pau64Contacts,
-                                             uint32_t u32ScanTime)
+HRESULT Mouse::i_reportMultiTouchEventToDevice(uint8_t cContacts,
+                                               const uint64_t *pau64Contacts,
+                                               uint32_t u32ScanTime)
 {
     HRESULT hrc = S_OK;
 
@@ -411,9 +597,9 @@ HRESULT Mouse::reportMultiTouchEventToDevice(uint8_t cContacts,
  *
  * @returns   COM status code
  */
-HRESULT Mouse::reportAbsEventToVMMDev(int32_t x, int32_t y)
+HRESULT Mouse::i_reportAbsEventToVMMDev(int32_t x, int32_t y)
 {
-    VMMDevMouseInterface *pVMMDev = mParent->getVMMDevMouseInterface();
+    VMMDevMouseInterface *pVMMDev = mParent->i_getVMMDevMouseInterface();
     ComAssertRet(pVMMDev, E_FAIL);
     PPDMIVMMDEVPORT pVMMDevPort = pVMMDev->getVMMDevPort();
     ComAssertRet(pVMMDevPort, E_FAIL);
@@ -446,20 +632,20 @@ HRESULT Mouse::i_reportAbsEventToInputDevices(int32_t x, int32_t y, int32_t dz,
      * relative mouse device to alert the guest to changes. */
     LONG cJiggle = 0;
 
-    if (vmmdevCanAbs())
+    if (i_vmmdevCanAbs())
     {
         /*
          * Send the absolute mouse position to the VMM device.
          */
         if (x != mcLastX || y != mcLastY)
         {
-            rc = reportAbsEventToVMMDev(x, y);
+            rc = i_reportAbsEventToVMMDev(x, y);
             cJiggle = !fUsesVMMDevEvent;
         }
-        rc = reportRelEventToMouseDev(cJiggle, 0, dz, dw, fButtons);
+        rc = i_reportRelEventToMouseDev(cJiggle, 0, dz, dw, fButtons);
     }
     else
-        rc = reportAbsEventToMouseDev(x, y, dz, dw, fButtons);
+        rc = i_reportAbsEventToMouseDev(x, y, dz, dw, fButtons);
 
     mcLastX = x;
     mcLastY = y;
@@ -477,7 +663,7 @@ HRESULT Mouse::i_reportAbsEventToInputDevices(int32_t x, int32_t y, int32_t dz,
  */
 HRESULT Mouse::i_reportAbsEventToDisplayDevice(int32_t x, int32_t y)
 {
-    DisplayMouseInterface *pDisplay = mParent->getDisplayMouseInterface();
+    DisplayMouseInterface *pDisplay = mParent->i_getDisplayMouseInterface();
     ComAssertRet(pDisplay, E_FAIL);
 
     if (x != mcLastX || y != mcLastY)
@@ -488,8 +674,8 @@ HRESULT Mouse::i_reportAbsEventToDisplayDevice(int32_t x, int32_t y)
 }
 
 
-void Mouse::fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
-                           LONG fButtons)
+void Mouse::i_fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
+                             LONG fButtons)
 {
     /* If mouse button is pressed, we generate new event, to avoid reusable events coalescing and thus
        dropping key press events */
@@ -514,9 +700,9 @@ void Mouse::fireMouseEvent(bool fAbsolute, LONG x, LONG y, LONG dz, LONG dw,
     }
 }
 
-void Mouse::fireMultiTouchEvent(uint8_t cContacts,
-                                const LONG64 *paContacts,
-                                uint32_t u32ScanTime)
+void Mouse::i_fireMultiTouchEvent(uint8_t cContacts,
+                                  const LONG64 *paContacts,
+                                  uint32_t u32ScanTime)
 {
     com::SafeArray<SHORT> xPositions(cContacts);
     com::SafeArray<SHORT> yPositions(cContacts);
@@ -553,24 +739,22 @@ void Mouse::fireMultiTouchEvent(uint8_t cContacts,
  * @param dz          Z movement
  * @param fButtons    The mouse button state
  */
-STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG dw,
-                                  LONG fButtons)
+HRESULT Mouse::putMouseEvent(LONG dx, LONG dy, LONG dz, LONG dw,
+                             LONG aButtonState)
 {
     HRESULT rc;
     uint32_t fButtonsAdj;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     LogRel3(("%s: dx=%d, dy=%d, dz=%d, dw=%d\n", __PRETTY_FUNCTION__,
                  dx, dy, dz, dw));
 
-    fButtonsAdj = mouseButtonsToPDM(fButtons);
+    fButtonsAdj = i_mouseButtonsToPDM(aButtonState);
     /* Make sure that the guest knows that we are sending real movement
      * events to the PS/2 device and not just dummy wake-up ones. */
-    updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE);
-    rc = reportRelEventToMouseDev(dx, dy, dz, dw, fButtonsAdj);
+    i_updateVMMDevMouseCaps(0, VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE);
+    rc = i_reportRelEventToMouseDev(dx, dy, dz, dw, fButtonsAdj);
 
-    fireMouseEvent(false, dx, dy, dz, dw, fButtons);
+    i_fireMouseEvent(false, dx, dy, dz, dw, aButtonState);
 
     return rc;
 }
@@ -590,13 +774,13 @@ STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG dw,
  *
  * @returns   COM status value
  */
-HRESULT Mouse::convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
-                                 bool *pfValid)
+HRESULT Mouse::i_convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
+                                   bool *pfValid)
 {
     AssertPtrReturn(pxAdj, E_POINTER);
     AssertPtrReturn(pyAdj, E_POINTER);
     AssertPtrNullReturn(pfValid, E_POINTER);
-    DisplayMouseInterface *pDisplay = mParent->getDisplayMouseInterface();
+    DisplayMouseInterface *pDisplay = mParent->i_getDisplayMouseInterface();
     ComAssertRet(pDisplay, E_FAIL);
     /** The amount to add to the result (multiplied by the screen width/height)
      * to compensate for differences in guest methods for mapping back to
@@ -608,9 +792,11 @@ HRESULT Mouse::convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
     if (!(mfVMMDevGuestCaps & VMMDEV_MOUSE_NEW_PROTOCOL) && !pDisplay->i_isInputMappingSet())
     {
         ULONG displayWidth, displayHeight;
+        ULONG ulDummy;
+        LONG lDummy;
         /* Takes the display lock */
-        HRESULT rc = pDisplay->getScreenResolution(0, &displayWidth,
-                                                   &displayHeight, NULL, NULL, NULL);
+        HRESULT rc = pDisplay->i_getScreenResolution(0, &displayWidth,
+                                                     &displayHeight, &ulDummy, &lDummy, &lDummy);
         if (FAILED(rc))
             return rc;
 
@@ -623,7 +809,7 @@ HRESULT Mouse::convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
     {
         int32_t x1, y1, x2, y2;
         /* Takes the display lock */
-        pDisplay->getFramebufferDimensions(&x1, &y1, &x2, &y2);
+        pDisplay->i_getFramebufferDimensions(&x1, &y1, &x2, &y2);
         *pxAdj = x1 < x2 ?   ((x - x1) * VMMDEV_MOUSE_RANGE + ADJUST_RANGE)
                            / (x2 - x1) : 0;
         *pyAdj = y1 < y2 ?   ((y - y1) * VMMDEV_MOUSE_RANGE + ADJUST_RANGE)
@@ -654,14 +840,11 @@ HRESULT Mouse::convertDisplayRes(LONG x, LONG y, int32_t *pxAdj, int32_t *pyAdj,
  * @param dz         Z movement
  * @param fButtons   The mouse button state
  */
-STDMETHODIMP Mouse::PutMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw,
-                                          LONG fButtons)
+HRESULT Mouse::putMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw,
+                                     LONG aButtonState)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     LogRel3(("%s: x=%d, y=%d, dz=%d, dw=%d, fButtons=0x%x\n",
-             __PRETTY_FUNCTION__, x, y, dz, dw, fButtons));
+             __PRETTY_FUNCTION__, x, y, dz, dw, aButtonState));
 
     int32_t xAdj, yAdj;
     uint32_t fButtonsAdj;
@@ -670,21 +853,21 @@ STDMETHODIMP Mouse::PutMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw,
     /** @todo the front end should do this conversion to avoid races */
     /** @note Or maybe not... races are pretty inherent in everything done in
      *        this object and not really bad as far as I can see. */
-    HRESULT rc = convertDisplayRes(x, y, &xAdj, &yAdj, &fValid);
+    HRESULT rc = i_convertDisplayRes(x, y, &xAdj, &yAdj, &fValid);
     if (FAILED(rc)) return rc;
 
-    fButtonsAdj = mouseButtonsToPDM(fButtons);
+    fButtonsAdj = i_mouseButtonsToPDM(aButtonState);
     /* If we are doing old-style (IRQ-less) absolute reporting to the VMM
      * device then make sure the guest is aware of it, so that it knows to
      * ignore relative movement on the PS/2 device. */
-    updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE, 0);
+    i_updateVMMDevMouseCaps(VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE, 0);
     if (fValid)
     {
         rc = i_reportAbsEventToInputDevices(xAdj, yAdj, dz, dw, fButtonsAdj,
                                             RT_BOOL(mfVMMDevGuestCaps & VMMDEV_MOUSE_NEW_PROTOCOL));
         if (FAILED(rc)) return rc;
 
-        fireMouseEvent(true, x, y, dz, dw, fButtons);
+        i_fireMouseEvent(true, x, y, dz, dw, aButtonState);
     }
     rc = i_reportAbsEventToDisplayDevice(x, y);
 
@@ -700,25 +883,20 @@ STDMETHODIMP Mouse::PutMouseEventAbsolute(LONG x, LONG y, LONG dz, LONG dw,
  * @param aContacts  Information about each contact.
  * @param aScanTime  Timestamp.
  */
-STDMETHODIMP Mouse::PutEventMultiTouch(LONG aCount,
-                                       ComSafeArrayIn(LONG64, aContacts),
-                                       ULONG aScanTime)
+HRESULT Mouse::putEventMultiTouch(LONG aCount,
+                                  const std::vector<LONG64> &aContacts,
+                                  ULONG aScanTime)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    com::SafeArray <LONG64> arrayContacts(ComSafeArrayInArg(aContacts));
-
     LogRel3(("%s: aCount %d(actual %d), aScanTime %u\n",
-             __FUNCTION__, aCount, arrayContacts.size(), aScanTime));
+             __FUNCTION__, aCount, aContacts.size(), aScanTime));
 
     HRESULT rc = S_OK;
 
-    if ((LONG)arrayContacts.size() >= aCount)
+    if ((LONG)aContacts.size() >= aCount)
     {
-        LONG64* paContacts = arrayContacts.raw();
+        const LONG64 *paContacts = aCount > 0? &aContacts.front(): NULL;
 
-        rc = putEventMultiTouch(aCount, paContacts, aScanTime);
+        rc = i_putEventMultiTouch(aCount, paContacts, aScanTime);
     }
     else
     {
@@ -736,9 +914,9 @@ STDMETHODIMP Mouse::PutEventMultiTouch(LONG aCount,
  * @param aContacts  Information about each contact.
  * @param aScanTime  Timestamp.
  */
-STDMETHODIMP Mouse::PutEventMultiTouchString(LONG aCount,
-                                             IN_BSTR aContacts,
-                                             ULONG aScanTime)
+HRESULT Mouse::putEventMultiTouchString(LONG aCount,
+                                        const com::Utf8Str &aContacts,
+                                        ULONG aScanTime)
 {
     /** @todo implement: convert the string to LONG64 array and call putEventMultiTouch. */
     NOREF(aCount);
@@ -752,16 +930,16 @@ STDMETHODIMP Mouse::PutEventMultiTouchString(LONG aCount,
 /////////////////////////////////////////////////////////////////////////////
 
 /* Used by PutEventMultiTouch and PutEventMultiTouchString. */
-HRESULT Mouse::putEventMultiTouch(LONG aCount,
-                                  LONG64 *paContacts,
-                                  ULONG aScanTime)
+HRESULT Mouse::i_putEventMultiTouch(LONG aCount,
+                                    const LONG64 *paContacts,
+                                    ULONG aScanTime)
 {
     if (aCount >= 256)
     {
          return E_INVALIDARG;
     }
 
-    DisplayMouseInterface *pDisplay = mParent->getDisplayMouseInterface();
+    DisplayMouseInterface *pDisplay = mParent->i_getDisplayMouseInterface();
     ComAssertRet(pDisplay, E_FAIL);
 
     /* Touch events are mapped to the primary monitor, because the emulated USB
@@ -771,9 +949,11 @@ HRESULT Mouse::putEventMultiTouch(LONG aCount,
 
     ULONG cWidth  = 0;
     ULONG cHeight = 0;
+    ULONG cBPP    = 0;
     LONG  xOrigin = 0;
     LONG  yOrigin = 0;
-    HRESULT rc = pDisplay->getScreenResolution(uScreenId, &cWidth, &cHeight, NULL, &xOrigin, &yOrigin);
+    HRESULT rc = pDisplay->i_getScreenResolution(uScreenId, &cWidth, &cHeight, &cBPP, &xOrigin, &yOrigin);
+    NOREF(cBPP);
     ComAssertComRCRetRC(rc);
 
     uint64_t* pau64Contacts = NULL;
@@ -845,10 +1025,10 @@ HRESULT Mouse::putEventMultiTouch(LONG aCount,
 
     if (SUCCEEDED(rc))
     {
-        rc = reportMultiTouchEventToDevice(cContacts, cContacts? pau64Contacts: NULL, (uint32_t)aScanTime);
+        rc = i_reportMultiTouchEventToDevice(cContacts, cContacts? pau64Contacts: NULL, (uint32_t)aScanTime);
 
         /* Send the original contact information. */
-        fireMultiTouchEvent(cContacts, cContacts? paContacts: NULL, (uint32_t)aScanTime);
+        i_fireMultiTouchEvent(cContacts, cContacts? paContacts: NULL, (uint32_t)aScanTime);
     }
 
     RTMemTmpFree(pau64Contacts);
@@ -859,7 +1039,7 @@ HRESULT Mouse::putEventMultiTouch(LONG aCount,
 
 /** Does the guest currently rely on the host to draw the mouse cursor or
  * can it switch to doing it itself in software? */
-bool Mouse::guestNeedsHostCursor(void)
+bool Mouse::i_guestNeedsHostCursor(void)
 {
     return RT_BOOL(mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR);
 }
@@ -867,7 +1047,7 @@ bool Mouse::guestNeedsHostCursor(void)
 
 /** Check what sort of reporting can be done using the devices currently
  * enabled.  Does not consider the VMM device. */
-void Mouse::getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfMT)
+void Mouse::i_getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfMT)
 {
     bool fAbsDev = false;
     bool fRelDev = false;
@@ -895,52 +1075,52 @@ void Mouse::getDeviceCaps(bool *pfAbs, bool *pfRel, bool *pfMT)
 
 
 /** Does the VMM device currently support absolute reporting? */
-bool Mouse::vmmdevCanAbs(void)
+bool Mouse::i_vmmdevCanAbs(void)
 {
     bool fRelDev;
 
-    getDeviceCaps(NULL, &fRelDev, NULL);
+    i_getDeviceCaps(NULL, &fRelDev, NULL);
     return    (mfVMMDevGuestCaps & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE)
            && fRelDev;
 }
 
 
 /** Does the VMM device currently support absolute reporting? */
-bool Mouse::deviceCanAbs(void)
+bool Mouse::i_deviceCanAbs(void)
 {
     bool fAbsDev;
 
-    getDeviceCaps(&fAbsDev, NULL, NULL);
+    i_getDeviceCaps(&fAbsDev, NULL, NULL);
     return fAbsDev;
 }
 
 
 /** Can we currently send relative events to the guest? */
-bool Mouse::supportsRel(void)
+bool Mouse::i_supportsRel(void)
 {
     bool fRelDev;
 
-    getDeviceCaps(NULL, &fRelDev, NULL);
+    i_getDeviceCaps(NULL, &fRelDev, NULL);
     return fRelDev;
 }
 
 
 /** Can we currently send absolute events to the guest? */
-bool Mouse::supportsAbs(void)
+bool Mouse::i_supportsAbs(void)
 {
     bool fAbsDev;
 
-    getDeviceCaps(&fAbsDev, NULL, NULL);
-    return fAbsDev || vmmdevCanAbs();
+    i_getDeviceCaps(&fAbsDev, NULL, NULL);
+    return fAbsDev || i_vmmdevCanAbs();
 }
 
 
 /** Can we currently send absolute events to the guest? */
-bool Mouse::supportsMT(void)
+bool Mouse::i_supportsMT(void)
 {
     bool fMTDev;
 
-    getDeviceCaps(NULL, NULL, &fMTDev);
+    i_getDeviceCaps(NULL, NULL, &fMTDev);
     return fMTDev;
 }
 
@@ -948,18 +1128,18 @@ bool Mouse::supportsMT(void)
 /** Check what sort of reporting can be done using the devices currently
  * enabled (including the VMM device) and notify the guest and the front-end.
  */
-void Mouse::sendMouseCapsNotifications(void)
+void Mouse::i_sendMouseCapsNotifications(void)
 {
     bool fRelDev, fMTDev, fCanAbs, fNeedsHostCursor;
 
     {
         AutoReadLock aLock(this COMMA_LOCKVAL_SRC_POS);
 
-        getDeviceCaps(NULL, &fRelDev, &fMTDev);
-        fCanAbs = supportsAbs();
-        fNeedsHostCursor = guestNeedsHostCursor();
+        i_getDeviceCaps(NULL, &fRelDev, &fMTDev);
+        fCanAbs = i_supportsAbs();
+        fNeedsHostCursor = i_guestNeedsHostCursor();
     }
-    mParent->onMouseCapabilityChange(fCanAbs, fRelDev, fMTDev, fNeedsHostCursor);
+    mParent->i_onMouseCapabilityChange(fCanAbs, fRelDev, fMTDev, fNeedsHostCursor);
 }
 
 
@@ -967,7 +1147,7 @@ void Mouse::sendMouseCapsNotifications(void)
  * @interface_method_impl{PDMIMOUSECONNECTOR,pfnReportModes}
  * A virtual device is notifying us about its current state and capabilities
  */
-DECLCALLBACK(void) Mouse::mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT)
+DECLCALLBACK(void) Mouse::i_mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool fRel, bool fAbs, bool fMT)
 {
     PDRVMAINMOUSE pDrv = RT_FROM_MEMBER(pInterface, DRVMAINMOUSE, IConnector);
     if (fRel)
@@ -983,14 +1163,14 @@ DECLCALLBACK(void) Mouse::mouseReportModes(PPDMIMOUSECONNECTOR pInterface, bool
     else
         pDrv->u32DevCaps &= ~MOUSE_DEVCAP_MULTI_TOUCH;
 
-    pDrv->pMouse->sendMouseCapsNotifications();
+    pDrv->pMouse->i_sendMouseCapsNotifications();
 }
 
 
 /**
  * @interface_method_impl{PDMIBASE,pfnQueryInterface}
  */
-DECLCALLBACK(void *)  Mouse::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
+DECLCALLBACK(void *)  Mouse::i_drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
 {
     PPDMDRVINS      pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
     PDRVMAINMOUSE   pDrv    = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
@@ -1007,7 +1187,7 @@ DECLCALLBACK(void *)  Mouse::drvQueryInterface(PPDMIBASE pInterface, const char
  * @returns VBox status.
  * @param   pDrvIns     The driver instance data.
  */
-DECLCALLBACK(void) Mouse::drvDestruct(PPDMDRVINS pDrvIns)
+DECLCALLBACK(void) Mouse::i_drvDestruct(PPDMDRVINS pDrvIns)
 {
     PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
     PDRVMAINMOUSE pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
@@ -1031,7 +1211,7 @@ DECLCALLBACK(void) Mouse::drvDestruct(PPDMDRVINS pDrvIns)
  *
  * @copydoc FNPDMDRVCONSTRUCT
  */
-DECLCALLBACK(int) Mouse::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
+DECLCALLBACK(int) Mouse::i_drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
 {
     PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
     PDRVMAINMOUSE pThis = PDMINS_2_DATA(pDrvIns, PDRVMAINMOUSE);
@@ -1049,9 +1229,9 @@ DECLCALLBACK(int) Mouse::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32
     /*
      * IBase.
      */
-    pDrvIns->IBase.pfnQueryInterface        = Mouse::drvQueryInterface;
+    pDrvIns->IBase.pfnQueryInterface        = Mouse::i_drvQueryInterface;
 
-    pThis->IConnector.pfnReportModes        = Mouse::mouseReportModes;
+    pThis->IConnector.pfnReportModes        = Mouse::i_mouseReportModes;
 
     /*
      * Get the IMousePort interface of the above driver/device.
@@ -1116,9 +1296,9 @@ const PDMDRVREG Mouse::DrvReg =
     /* cbInstance */
     sizeof(DRVMAINMOUSE),
     /* pfnConstruct */
-    Mouse::drvConstruct,
+    Mouse::i_drvConstruct,
     /* pfnDestruct */
-    Mouse::drvDestruct,
+    Mouse::i_drvDestruct,
     /* pfnRelocate */
     NULL,
     /* pfnIOCtl */
diff --git a/src/VBox/Main/src-client/Nvram.cpp b/src/VBox/Main/src-client/Nvram.cpp
index d3d4200..9a24c81 100644
--- a/src/VBox/Main/src-client/Nvram.cpp
+++ b/src/VBox/Main/src-client/Nvram.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -173,7 +173,7 @@ DECLCALLBACK(int) drvNvram_VarStoreSeqPut(PPDMINVRAMCONNECTOR pInterface, int id
                 strcpy(szExtraName + offValueNm, apszTodo[i]);
                 try
                 {
-                    HRESULT hrc = pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraName).raw(),
+                    HRESULT hrc = pThis->pNvram->getParent()->i_machine()->SetExtraData(Bstr(szExtraName).raw(),
                                                                                       Bstr(apszTodo[i + 1]).raw());
                     if (FAILED(hrc))
                     {
@@ -215,7 +215,7 @@ static void drvNvram_deleteVar(PNVRAM pThis, const char *pszVarNodeNm)
         strcpy(szExtraName + offValue, s_apszValueNames[i]);
         try
         {
-            HRESULT hrc = pThis->pNvram->getParent()->machine()->SetExtraData(Bstr(szExtraName).raw(), Bstr().raw());
+            HRESULT hrc = pThis->pNvram->getParent()->i_machine()->SetExtraData(Bstr(szExtraName).raw(), Bstr().raw());
             if (FAILED(hrc))
                 LogRel(("drvNvram_deleteVar: SetExtraData(%s,) returned %Rhrc\n", szExtraName, hrc));
         }
diff --git a/src/VBox/Main/src-client/PCIRawDevImpl.cpp b/src/VBox/Main/src-client/PCIRawDevImpl.cpp
index b60adf4..110e21c 100644
--- a/src/VBox/Main/src-client/PCIRawDevImpl.cpp
+++ b/src/VBox/Main/src-client/PCIRawDevImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,7 +19,6 @@
 #include "PCIRawDevImpl.h"
 #include "PCIDeviceAttachmentImpl.h"
 #include "ConsoleImpl.h"
-#include "MachineImpl.h"
 
 // generated header for events
 #include "VBoxEvents.h"
@@ -75,7 +74,7 @@ DECLCALLBACK(int) PCIRawDev::drvDeviceConstructComplete(PPDMIPCIRAWCONNECTOR pIn
 {
     PDRVMAINPCIRAWDEV pThis = RT_FROM_CPP_MEMBER(pInterface, DRVMAINPCIRAWDEV, IConnector);
     Console *pConsole = pThis->pPCIRawDev->getParent();
-    const ComPtr<IMachine>& machine = pConsole->machine();
+    const ComPtr<IMachine>& machine = pConsole->i_machine();
     ComPtr<IVirtualBox> vbox;
 
     HRESULT hrc = machine->COMGETTER(Parent)(vbox.asOutParam());
diff --git a/src/VBox/Main/src-client/RemoteUSBBackend.cpp b/src/VBox/Main/src-client/RemoteUSBBackend.cpp
index 604e530..ff62599 100644
--- a/src/VBox/Main/src-client/RemoteUSBBackend.cpp
+++ b/src/VBox/Main/src-client/RemoteUSBBackend.cpp
@@ -1,10 +1,11 @@
+/* $Id: RemoteUSBBackend.cpp $ */
 /** @file
  *
  * VirtualBox Remote USB backend
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -152,7 +153,7 @@ static void qurbFree (REMOTEUSBQURB *pQURB)
 
 
 /* Called by VRDP server when the client responds to a request on USB channel. */
-DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uint8_t code, const void *pvRet, uint32_t cbRet)
+DECLCALLBACK(int) USBClientResponseCallback(void *pv, uint32_t u32ClientId, uint8_t code, const void *pvRet, uint32_t cbRet)
 {
     int rc = VINF_SUCCESS;
 
@@ -165,21 +166,21 @@ DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uin
     {
         case VRDE_USB_REQ_DEVICE_LIST:
         {
-            rc = pThis->saveDeviceList (pvRet, cbRet);
+            rc = pThis->saveDeviceList(pvRet, cbRet);
         } break;
 
         case VRDE_USB_REQ_NEGOTIATE:
         {
-            if (pvRet && cbRet >= sizeof (VRDEUSBREQNEGOTIATERET))
+            if (pvRet && cbRet >= sizeof(VRDEUSBREQNEGOTIATERET))
             {
                 VRDEUSBREQNEGOTIATERET *pret = (VRDEUSBREQNEGOTIATERET *)pvRet;
 
-                rc = pThis->negotiateResponse (pret, cbRet);
+                rc = pThis->negotiateResponse(pret, cbRet);
             }
             else
             {
                 Log(("USBClientResponseCallback: WARNING: not enough data in response: pv = %p, cb = %d, expected %d.\n",
-                     pvRet, cbRet, sizeof (VRDEUSBREQNEGOTIATERET)));
+                     pvRet, cbRet, sizeof(VRDEUSBREQNEGOTIATERET)));
 
                 rc = VERR_INVALID_PARAMETER;
             }
@@ -187,7 +188,7 @@ DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uin
 
         case VRDE_USB_REQ_REAP_URB:
         {
-            rc = pThis->reapURB (pvRet, cbRet);
+            rc = pThis->reapURB(pvRet, cbRet);
 
             LogFlow(("USBClientResponseCallback: reap URB, rc = %Rrc.\n", rc));
         } break;
@@ -211,13 +212,13 @@ DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uin
             /*
              * Device specific responses with status codes.
              */
-            if (pvRet && cbRet >= sizeof (VRDEUSBREQRETHDR))
+            if (pvRet && cbRet >= sizeof(VRDEUSBREQRETHDR))
             {
                 VRDEUSBREQRETHDR *pret = (VRDEUSBREQRETHDR *)pvRet;
 
                 if (pret->status != VRDE_USB_STATUS_SUCCESS)
                 {
-                    REMOTEUSBDEVICE *pDevice = pThis->deviceFromId (pret->id);
+                    REMOTEUSBDEVICE *pDevice = pThis->deviceFromId(pret->id);
 
                     if (!pDevice)
                     {
@@ -234,7 +235,7 @@ DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uin
             else
             {
                 Log(("USBClientResponseCallback: WARNING: not enough data in response: pv = %p, cb = %d, expected %d.\n",
-                     pvRet, cbRet, sizeof (VRDEUSBREQRETHDR)));
+                     pvRet, cbRet, sizeof(VRDEUSBREQRETHDR)));
             }
         } break;
 
@@ -250,13 +251,14 @@ DECLCALLBACK(int) USBClientResponseCallback (void *pv, uint32_t u32ClientId, uin
 /*
  * Backend entry points.
  */
-static DECLCALLBACK(int) iface_Open (PREMOTEUSBBACKEND pInstance, const char *pszAddress, size_t cbAddress, PREMOTEUSBDEVICE *ppDevice)
+static DECLCALLBACK(int) iface_Open(PREMOTEUSBBACKEND pInstance, const char *pszAddress,
+                                    size_t cbAddress, PREMOTEUSBDEVICE *ppDevice)
 {
     int rc = VINF_SUCCESS;
 
     RemoteUSBBackend *pThis = (RemoteUSBBackend *)pInstance;
 
-    REMOTEUSBDEVICE *pDevice = (REMOTEUSBDEVICE *)RTMemAllocZ (sizeof (REMOTEUSBDEVICE));
+    REMOTEUSBDEVICE *pDevice = (REMOTEUSBDEVICE *)RTMemAllocZ(sizeof(REMOTEUSBDEVICE));
 
     if (!pDevice)
     {
@@ -268,7 +270,7 @@ static DECLCALLBACK(int) iface_Open (PREMOTEUSBBACKEND pInstance, const char *ps
          * The format is "REMOTEUSB0xAAAABBBB&0xCCCCDDDD", where AAAABBBB is hex device identifier
          * and CCCCDDDD is hex client id.
          */
-        if (strncmp (pszAddress, REMOTE_USB_BACKEND_PREFIX_S, REMOTE_USB_BACKEND_PREFIX_LEN) != 0)
+        if (strncmp(pszAddress, REMOTE_USB_BACKEND_PREFIX_S, REMOTE_USB_BACKEND_PREFIX_LEN) != 0)
         {
             AssertFailed();
             rc = VERR_INVALID_PARAMETER;
@@ -284,26 +286,26 @@ static DECLCALLBACK(int) iface_Open (PREMOTEUSBBACKEND pInstance, const char *ps
 
             if (RT_SUCCESS(rc))
             {
-                pDevice->id = RTStrToUInt32 (&pszAddress[REMOTE_USB_BACKEND_PREFIX_LEN]);
+                pDevice->id = RTStrToUInt32(&pszAddress[REMOTE_USB_BACKEND_PREFIX_LEN]);
 
-                size_t l = strlen (pszAddress);
+                size_t l = strlen(pszAddress);
 
-                if (l >= REMOTE_USB_BACKEND_PREFIX_LEN + strlen ("0x12345678&0x87654321"))
+                if (l >= REMOTE_USB_BACKEND_PREFIX_LEN + strlen("0x12345678&0x87654321"))
                 {
-                    const char *p = &pszAddress[REMOTE_USB_BACKEND_PREFIX_LEN + strlen ("0x12345678")];
+                    const char *p = &pszAddress[REMOTE_USB_BACKEND_PREFIX_LEN + strlen("0x12345678")];
                     if (*p == '&')
                     {
-                        pDevice->u32ClientId = RTStrToUInt32 (p + 1);
+                        pDevice->u32ClientId = RTStrToUInt32(p + 1);
                     }
                     else
                     {
-                        AssertFailed ();
+                        AssertFailed();
                         rc = VERR_INVALID_PARAMETER;
                     }
                 }
                 else
                 {
-                    AssertFailed ();
+                    AssertFailed();
                     rc = VERR_INVALID_PARAMETER;
                 }
 
@@ -314,7 +316,7 @@ static DECLCALLBACK(int) iface_Open (PREMOTEUSBBACKEND pInstance, const char *ps
                     parm.code = VRDE_USB_REQ_OPEN;
                     parm.id = pDevice->id;
 
-                    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+                    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
                 }
             }
         }
@@ -324,17 +326,17 @@ static DECLCALLBACK(int) iface_Open (PREMOTEUSBBACKEND pInstance, const char *ps
     {
         *ppDevice = pDevice;
 
-        pThis->addDevice (pDevice);
+        pThis->addDevice(pDevice);
     }
     else
     {
-        RTMemFree (pDevice);
+        RTMemFree(pDevice);
     }
 
     return rc;
 }
 
-static DECLCALLBACK(void) iface_Close (PREMOTEUSBDEVICE pDevice)
+static DECLCALLBACK(void) iface_Close(PREMOTEUSBDEVICE pDevice)
 {
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
@@ -343,21 +345,21 @@ static DECLCALLBACK(void) iface_Close (PREMOTEUSBDEVICE pDevice)
     parm.code = VRDE_USB_REQ_CLOSE;
     parm.id = pDevice->id;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
-    pThis->removeDevice (pDevice);
+    pThis->removeDevice(pDevice);
 
-    if (RTCritSectIsInitialized (&pDevice->critsect))
+    if (RTCritSectIsInitialized(&pDevice->critsect))
     {
-        RTCritSectDelete (&pDevice->critsect);
+        RTCritSectDelete(&pDevice->critsect);
     }
 
-    RTMemFree (pDevice);
+    RTMemFree(pDevice);
 
     return;
 }
 
-static DECLCALLBACK(int) iface_Reset (PREMOTEUSBDEVICE pDevice)
+static DECLCALLBACK(int) iface_Reset(PREMOTEUSBDEVICE pDevice)
 {
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
@@ -371,12 +373,12 @@ static DECLCALLBACK(int) iface_Reset (PREMOTEUSBDEVICE pDevice)
     parm.code = VRDE_USB_REQ_RESET;
     parm.id = pDevice->id;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(int) iface_SetConfig (PREMOTEUSBDEVICE pDevice, uint8_t u8Cfg)
+static DECLCALLBACK(int) iface_SetConfig(PREMOTEUSBDEVICE pDevice, uint8_t u8Cfg)
 {
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
@@ -391,12 +393,12 @@ static DECLCALLBACK(int) iface_SetConfig (PREMOTEUSBDEVICE pDevice, uint8_t u8Cf
     parm.id = pDevice->id;
     parm.configuration = u8Cfg;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(int) iface_ClaimInterface (PREMOTEUSBDEVICE pDevice, uint8_t u8Ifnum)
+static DECLCALLBACK(int) iface_ClaimInterface(PREMOTEUSBDEVICE pDevice, uint8_t u8Ifnum)
 {
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
@@ -411,12 +413,12 @@ static DECLCALLBACK(int) iface_ClaimInterface (PREMOTEUSBDEVICE pDevice, uint8_t
     parm.id = pDevice->id;
     parm.iface = u8Ifnum;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(int) iface_ReleaseInterface (PREMOTEUSBDEVICE pDevice, uint8_t u8Ifnum)
+static DECLCALLBACK(int) iface_ReleaseInterface(PREMOTEUSBDEVICE pDevice, uint8_t u8Ifnum)
 {
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
@@ -431,12 +433,12 @@ static DECLCALLBACK(int) iface_ReleaseInterface (PREMOTEUSBDEVICE pDevice, uint8
     parm.id = pDevice->id;
     parm.iface = u8Ifnum;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(int) iface_InterfaceSetting (PREMOTEUSBDEVICE pDevice, uint8_t u8Ifnum, uint8_t u8Setting)
+static DECLCALLBACK(int) iface_InterfaceSetting(PREMOTEUSBDEVICE pDevice, uint8_t u8Ifnum, uint8_t u8Setting)
 {
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
@@ -452,12 +454,12 @@ static DECLCALLBACK(int) iface_InterfaceSetting (PREMOTEUSBDEVICE pDevice, uint8
     parm.iface = u8Ifnum;
     parm.setting = u8Setting;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(int) iface_ClearHaltedEP (PREMOTEUSBDEVICE pDevice, uint8_t u8Ep)
+static DECLCALLBACK(int) iface_ClearHaltedEP(PREMOTEUSBDEVICE pDevice, uint8_t u8Ep)
 {
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
@@ -472,12 +474,12 @@ static DECLCALLBACK(int) iface_ClearHaltedEP (PREMOTEUSBDEVICE pDevice, uint8_t
     parm.id = pDevice->id;
     parm.ep = u8Ep;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(void) iface_CancelURB (PREMOTEUSBDEVICE pDevice, PREMOTEUSBQURB pRemoteURB)
+static DECLCALLBACK(void) iface_CancelURB(PREMOTEUSBDEVICE pDevice, PREMOTEUSBQURB pRemoteURB)
 {
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
@@ -487,9 +489,9 @@ static DECLCALLBACK(void) iface_CancelURB (PREMOTEUSBDEVICE pDevice, PREMOTEUSBQ
     parm.id = pDevice->id;
     parm.handle = pRemoteURB->u32Handle;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
-    requestDevice (pDevice);
+    requestDevice(pDevice);
 
     /* Remove this urb from the queue. It is safe because if
      * client will return the URB, it will be just ignored
@@ -513,19 +515,21 @@ static DECLCALLBACK(void) iface_CancelURB (PREMOTEUSBDEVICE pDevice, PREMOTEUSBQ
         pDevice->pTailQURBs = pRemoteURB->prev;
     }
 
-    qurbFree (pRemoteURB);
+    qurbFree(pRemoteURB);
 
-    releaseDevice (pDevice);
+    releaseDevice(pDevice);
 
     return;
 }
 
-static DECLCALLBACK(int) iface_QueueURB (PREMOTEUSBDEVICE pDevice, uint8_t u8Type, uint8_t u8Ep, uint8_t u8Direction, uint32_t u32Len, void *pvData, void *pvURB, PREMOTEUSBQURB *ppRemoteURB)
+static DECLCALLBACK(int) iface_QueueURB(PREMOTEUSBDEVICE pDevice, uint8_t u8Type, uint8_t u8Ep, uint8_t u8Direction,
+                                        uint32_t u32Len, void *pvData, void *pvURB, PREMOTEUSBQURB *ppRemoteURB)
 {
     int rc = VINF_SUCCESS;
 
 #ifdef DEBUG_sunlover
-    LogFlow(("RemoteUSBBackend::iface_QueueURB: u8Type = %d, u8Ep = %d, u8Direction = %d, data\n%.*Rhxd\n", u8Type, u8Ep, u8Direction, u32Len, pvData));
+    LogFlow(("RemoteUSBBackend::iface_QueueURB: u8Type = %d, u8Ep = %d, u8Direction = %d, data\n%.*Rhxd\n",
+             u8Type, u8Ep, u8Direction, u32Len, pvData));
 #endif /* DEBUG_sunlover */
 
     if (pDevice->fFailed)
@@ -539,7 +543,7 @@ static DECLCALLBACK(int) iface_QueueURB (PREMOTEUSBDEVICE pDevice, uint8_t u8Typ
     uint32_t u32Handle = 0;
     uint32_t u32DataLen = 0;
 
-    REMOTEUSBQURB *qurb = qurbAlloc (pDevice);
+    REMOTEUSBQURB *qurb = qurbAlloc(pDevice);
 
     if (qurb == NULL)
     {
@@ -643,16 +647,16 @@ static DECLCALLBACK(int) iface_QueueURB (PREMOTEUSBDEVICE pDevice, uint8_t u8Typ
 
     pDevice->pTailQURBs = qurb;
 
-    releaseDevice (pDevice);
+    releaseDevice(pDevice);
 
     *ppRemoteURB = qurb;
 
-    pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+    pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
 
 l_leave:
     if (RT_FAILURE(rc))
     {
-        qurbFree (qurb);
+        qurbFree(qurb);
     }
 
     return rc;
@@ -661,7 +665,8 @@ l_leave:
 /* The function checks the URB queue for completed URBs. Also if the client
  * has requested URB polling, the function will send URB poll requests.
  */
-static DECLCALLBACK(int) iface_ReapURB (PREMOTEUSBDEVICE pDevice, uint32_t u32Millies, void **ppvURB, uint32_t *pu32Len, uint32_t *pu32Err)
+static DECLCALLBACK(int) iface_ReapURB(PREMOTEUSBDEVICE pDevice, uint32_t u32Millies, void **ppvURB,
+                                       uint32_t *pu32Len, uint32_t *pu32Err)
 {
     int rc = VINF_SUCCESS;
 
@@ -675,15 +680,15 @@ static DECLCALLBACK(int) iface_ReapURB (PREMOTEUSBDEVICE pDevice, uint32_t u32Mi
     RemoteUSBBackend *pThis = pDevice->pOwner;
 
     /* Wait for transaction completion. */
-    uint64_t u64StartTime = RTTimeMilliTS ();
+    uint64_t u64StartTime = RTTimeMilliTS();
 
-    if (pThis->pollingEnabledURB ())
+    if (pThis->pollingEnabledURB())
     {
         VRDE_USB_REQ_REAP_URB_PARM parm;
 
         parm.code = VRDE_USB_REQ_REAP_URB;
 
-        pThis->VRDPServer()->SendUSBRequest (pDevice->u32ClientId, &parm, sizeof (parm));
+        pThis->VRDPServer()->SendUSBRequest(pDevice->u32ClientId, &parm, sizeof(parm));
     }
 
     REMOTEUSBQURB *qurb = NULL;
@@ -696,7 +701,7 @@ static DECLCALLBACK(int) iface_ReapURB (PREMOTEUSBDEVICE pDevice, uint32_t u32Mi
             break;
 
         /* Scan queued URBs, look for completed. */
-        requestDevice (pDevice);
+        requestDevice(pDevice);
 
         u32ClientId = pDevice->u32ClientId;
 
@@ -734,13 +739,13 @@ static DECLCALLBACK(int) iface_ReapURB (PREMOTEUSBDEVICE pDevice, uint32_t u32Mi
             qurb = qurb->next;
         }
 
-        releaseDevice (pDevice);
+        releaseDevice(pDevice);
 
         if (   qurb
             || !pDevice->pHeadQURBs
             || u32Millies == 0
             || pDevice->fFailed
-            || (RTTimeMilliTS () - u64StartTime >= (uint64_t)u32Millies))
+            || (RTTimeMilliTS() - u64StartTime >= (uint64_t)u32Millies))
         {
             /* Got an URB or do not have to wait for an URB. */
             break;
@@ -748,15 +753,15 @@ static DECLCALLBACK(int) iface_ReapURB (PREMOTEUSBDEVICE pDevice, uint32_t u32Mi
 
         LogFlow(("RemoteUSBBackend::iface_ReapURB iteration.\n"));
 
-        RTThreadSleep (10);
+        RTThreadSleep(10);
 
-        if (pThis->pollingEnabledURB ())
+        if (pThis->pollingEnabledURB())
         {
             VRDE_USB_REQ_REAP_URB_PARM parm;
 
             parm.code = VRDE_USB_REQ_REAP_URB;
 
-            pThis->VRDPServer()->SendUSBRequest (u32ClientId, &parm, sizeof (parm));
+            pThis->VRDPServer()->SendUSBRequest(u32ClientId, &parm, sizeof(parm));
         }
     }
 
@@ -782,24 +787,24 @@ static DECLCALLBACK(int) iface_ReapURB (PREMOTEUSBDEVICE pDevice, uint32_t u32Mi
         }
 #endif
 
-        qurbFree (qurb);
+        qurbFree(qurb);
     }
 
     return rc;
 }
 
-static DECLCALLBACK(int) iface_Wakeup (PREMOTEUSBDEVICE pDevice)
+static DECLCALLBACK(int) iface_Wakeup(PREMOTEUSBDEVICE pDevice)
 {
     ASMAtomicXchgBool(&pDevice->fWokenUp, true);
     return VINF_SUCCESS;
 }
 
-void RemoteUSBBackend::AddRef (void)
+void RemoteUSBBackend::AddRef(void)
 {
     cRefs++;
 }
 
-void RemoteUSBBackend::Release (void)
+void RemoteUSBBackend::Release(void)
 {
     cRefs--;
 
@@ -809,22 +814,22 @@ void RemoteUSBBackend::Release (void)
     }
 }
 
-void RemoteUSBBackend::PollRemoteDevices (void)
+void RemoteUSBBackend::PollRemoteDevices(void)
 {
     if (   mfWillBeDeleted
         && menmPollRemoteDevicesStatus != PollRemoteDevicesStatus_Dereferenced)
     {
         /* Unmount all remote USB devices. */
-        mConsole->processRemoteUSBDevices (mu32ClientId, NULL, 0, false);
+        mConsole->i_processRemoteUSBDevices(mu32ClientId, NULL, 0, false);
 
         menmPollRemoteDevicesStatus = PollRemoteDevicesStatus_Dereferenced;
 
-        Release ();
+        Release();
 
         return;
     }
 
-    switch (menmPollRemoteDevicesStatus)
+    switch(menmPollRemoteDevicesStatus)
     {
         case PollRemoteDevicesStatus_Negotiate:
         {
@@ -835,13 +840,13 @@ void RemoteUSBBackend::PollRemoteDevices (void)
             /* VRDE_USB_VERSION_3: support VRDE_USB_REQ_DEVICE_LIST_EXT_RET. */
             parm.flags = VRDE_USB_SERVER_CAPS_PORT_VERSION;
 
-            mServer->SendUSBRequest (mu32ClientId, &parm, sizeof (parm));
+            mServer->SendUSBRequest(mu32ClientId, &parm, sizeof(parm));
 
             /* Reference the object. When the client disconnects and
              * the backend is about to be deleted, the method must be called
              * to disconnect the USB devices (as stated above).
              */
-            AddRef ();
+            AddRef();
 
             /* Goto the disabled state. When a response will be received
              * the state will be changed to the SendRequest.
@@ -864,7 +869,7 @@ void RemoteUSBBackend::PollRemoteDevices (void)
 
             parm.code = VRDE_USB_REQ_DEVICE_LIST;
 
-            mServer->SendUSBRequest (mu32ClientId, &parm, sizeof (parm));
+            mServer->SendUSBRequest(mu32ClientId, &parm, sizeof(parm));
 
             menmPollRemoteDevicesStatus = PollRemoteDevicesStatus_WaitResponse;
         } break;
@@ -875,7 +880,7 @@ void RemoteUSBBackend::PollRemoteDevices (void)
 
             if (mfHasDeviceList)
             {
-                mConsole->processRemoteUSBDevices (mu32ClientId, (VRDEUSBDEVICEDESC *)mpvDeviceList, mcbDeviceList, mfDescExt);
+                mConsole->i_processRemoteUSBDevices(mu32ClientId, (VRDEUSBDEVICEDESC *)mpvDeviceList, mcbDeviceList, mfDescExt);
                 LogFlow(("USB::PollRemoteDevices: WaitResponse after process\n"));
 
                 menmPollRemoteDevicesStatus = PollRemoteDevicesStatus_SendRequest;
@@ -892,12 +897,12 @@ void RemoteUSBBackend::PollRemoteDevices (void)
 
         default:
         {
-           AssertFailed ();
+           AssertFailed();
         } break;
     }
 }
 
-void RemoteUSBBackend::NotifyDelete (void)
+void RemoteUSBBackend::NotifyDelete(void)
 {
     mfWillBeDeleted = true;
 }
@@ -906,7 +911,7 @@ void RemoteUSBBackend::NotifyDelete (void)
  * The backend maintains a list of UUIDs of devices
  * which are managed by the backend.
  */
-bool RemoteUSBBackend::addUUID (const Guid *pUuid)
+bool RemoteUSBBackend::addUUID(const Guid *pUuid)
 {
     unsigned i;
     for (i = 0; i < RT_ELEMENTS(aGuids); i++)
@@ -921,7 +926,7 @@ bool RemoteUSBBackend::addUUID (const Guid *pUuid)
     return false;
 }
 
-bool RemoteUSBBackend::findUUID (const Guid *pUuid)
+bool RemoteUSBBackend::findUUID(const Guid *pUuid)
 {
     unsigned i;
     for (i = 0; i < RT_ELEMENTS(aGuids); i++)
@@ -935,14 +940,14 @@ bool RemoteUSBBackend::findUUID (const Guid *pUuid)
     return false;
 }
 
-void RemoteUSBBackend::removeUUID (const Guid *pUuid)
+void RemoteUSBBackend::removeUUID(const Guid *pUuid)
 {
     unsigned i;
     for (i = 0; i < RT_ELEMENTS(aGuids); i++)
     {
         if (aGuids[i] == *pUuid)
         {
-            aGuids[i].clear ();
+            aGuids[i].clear();
             break;
         }
     }
@@ -950,28 +955,28 @@ void RemoteUSBBackend::removeUUID (const Guid *pUuid)
 
 RemoteUSBBackend::RemoteUSBBackend(Console *console, ConsoleVRDPServer *server, uint32_t u32ClientId)
     :
-    mConsole (console),
-    mServer (server),
-    cRefs (0),
-    mu32ClientId (u32ClientId),
-    mfHasDeviceList (false),
-    mpvDeviceList (NULL),
-    mcbDeviceList (0),
-    menmPollRemoteDevicesStatus (PollRemoteDevicesStatus_Negotiate),
-    mfPollURB (true),
-    mpDevices (NULL),
-    mfWillBeDeleted (false),
-    mClientVersion (0),                   /* VRDE_USB_VERSION_2: the client version. */
-    mfDescExt (false)                     /* VRDE_USB_VERSION_3: VRDE_USB_REQ_DEVICE_LIST_EXT_RET. */
+    mConsole(console),
+    mServer(server),
+    cRefs(0),
+    mu32ClientId(u32ClientId),
+    mfHasDeviceList(false),
+    mpvDeviceList(NULL),
+    mcbDeviceList(0),
+    menmPollRemoteDevicesStatus(PollRemoteDevicesStatus_Negotiate),
+    mfPollURB(true),
+    mpDevices(NULL),
+    mfWillBeDeleted(false),
+    mClientVersion(0),                   /* VRDE_USB_VERSION_2: the client version. */
+    mfDescExt(false)                     /* VRDE_USB_VERSION_3: VRDE_USB_REQ_DEVICE_LIST_EXT_RET. */
 {
     Assert(console);
     Assert(server);
 
-    int rc = RTCritSectInit (&mCritsect);
+    int rc = RTCritSectInit(&mCritsect);
 
     if (RT_FAILURE(rc))
     {
-        AssertFailed ();
+        AssertFailed();
         RT_ZERO(mCritsect);
     }
 
@@ -994,17 +999,17 @@ RemoteUSBBackend::~RemoteUSBBackend()
 {
     Assert(cRefs == 0);
 
-    if (RTCritSectIsInitialized (&mCritsect))
+    if (RTCritSectIsInitialized(&mCritsect))
     {
-        RTCritSectDelete (&mCritsect);
+        RTCritSectDelete(&mCritsect);
     }
 
-    RTMemFree (mpvDeviceList);
+    RTMemFree(mpvDeviceList);
 
-    mServer->usbBackendRemoveFromList (this);
+    mServer->usbBackendRemoveFromList(this);
 }
 
-int RemoteUSBBackend::negotiateResponse (const VRDEUSBREQNEGOTIATERET *pret, uint32_t cbRet)
+int RemoteUSBBackend::negotiateResponse(const VRDEUSBREQNEGOTIATERET *pret, uint32_t cbRet)
 {
     int rc = VINF_SUCCESS;
 
@@ -1027,7 +1032,7 @@ int RemoteUSBBackend::negotiateResponse (const VRDEUSBREQNEGOTIATERET *pret, uin
     if (pret->flags & VRDE_USB_CAPS2_FLAG_VERSION)
     {
         /* This could be a client version > 1. */
-        if (cbRet >= sizeof (VRDEUSBREQNEGOTIATERET_2))
+        if (cbRet >= sizeof(VRDEUSBREQNEGOTIATERET_2))
         {
             VRDEUSBREQNEGOTIATERET_2 *pret2 = (VRDEUSBREQNEGOTIATERET_2 *)pret;
 
@@ -1061,7 +1066,7 @@ int RemoteUSBBackend::negotiateResponse (const VRDEUSBREQNEGOTIATERET *pret, uin
         /* VRDE_USB_VERSION_3: check the client capabilities: VRDE_USB_CLIENT_CAPS_*. */
         if (mClientVersion == VRDE_USB_VERSION_3)
         {
-            if (cbRet >= sizeof (VRDEUSBREQNEGOTIATERET_3))
+            if (cbRet >= sizeof(VRDEUSBREQNEGOTIATERET_3))
             {
                 VRDEUSBREQNEGOTIATERET_3 *pret3 = (VRDEUSBREQNEGOTIATERET_3 *)pret;
 
@@ -1080,21 +1085,21 @@ int RemoteUSBBackend::negotiateResponse (const VRDEUSBREQNEGOTIATERET *pret, uin
     return rc;
 }
 
-int RemoteUSBBackend::saveDeviceList (const void *pvList, uint32_t cbList)
+int RemoteUSBBackend::saveDeviceList(const void *pvList, uint32_t cbList)
 {
     Log(("RemoteUSBBackend::saveDeviceList: pvList = %p, cbList = %d\n", pvList, cbList));
 
     if (!mfHasDeviceList)
     {
-        RTMemFree (mpvDeviceList);
+        RTMemFree(mpvDeviceList);
         mpvDeviceList = NULL;
 
         mcbDeviceList = cbList;
 
         if (cbList > 0)
         {
-            mpvDeviceList = RTMemAlloc (cbList);
-            memcpy (mpvDeviceList, pvList, cbList);
+            mpvDeviceList = RTMemAlloc(cbList);
+            memcpy(mpvDeviceList, pvList, cbList);
         }
 
         mfHasDeviceList = true;
@@ -1103,20 +1108,20 @@ int RemoteUSBBackend::saveDeviceList (const void *pvList, uint32_t cbList)
     return VINF_SUCCESS;
 }
 
-void RemoteUSBBackend::request (void)
+void RemoteUSBBackend::request(void)
 {
     int rc = RTCritSectEnter(&mCritsect);
     AssertRC(rc);
 }
 
-void RemoteUSBBackend::release (void)
+void RemoteUSBBackend::release(void)
 {
     RTCritSectLeave(&mCritsect);
 }
 
-PREMOTEUSBDEVICE RemoteUSBBackend::deviceFromId (VRDEUSBDEVID id)
+PREMOTEUSBDEVICE RemoteUSBBackend::deviceFromId(VRDEUSBDEVID id)
 {
-    request ();
+    request();
 
     REMOTEUSBDEVICE *pDevice = mpDevices;
 
@@ -1125,14 +1130,14 @@ PREMOTEUSBDEVICE RemoteUSBBackend::deviceFromId (VRDEUSBDEVID id)
         pDevice = pDevice->next;
     }
 
-    release ();
+    release();
 
     return pDevice;
 }
 
-void RemoteUSBBackend::addDevice (PREMOTEUSBDEVICE pDevice)
+void RemoteUSBBackend::addDevice(PREMOTEUSBDEVICE pDevice)
 {
-    request ();
+    request();
 
     pDevice->next = mpDevices;
 
@@ -1143,12 +1148,12 @@ void RemoteUSBBackend::addDevice (PREMOTEUSBDEVICE pDevice)
 
     mpDevices = pDevice;
 
-    release ();
+    release();
 }
 
-void RemoteUSBBackend::removeDevice (PREMOTEUSBDEVICE pDevice)
+void RemoteUSBBackend::removeDevice(PREMOTEUSBDEVICE pDevice)
 {
-    request ();
+    request();
 
     if (pDevice->prev)
     {
@@ -1164,10 +1169,10 @@ void RemoteUSBBackend::removeDevice (PREMOTEUSBDEVICE pDevice)
         pDevice->next->prev = pDevice->prev;
     }
 
-    release ();
+    release();
 }
 
-int RemoteUSBBackend::reapURB (const void *pvBody, uint32_t cbBody)
+int RemoteUSBBackend::reapURB(const void *pvBody, uint32_t cbBody)
 {
     int rc = VINF_SUCCESS;
 
@@ -1175,7 +1180,7 @@ int RemoteUSBBackend::reapURB (const void *pvBody, uint32_t cbBody)
 
     VRDEUSBREQREAPURBBODY *pBody = (VRDEUSBREQREAPURBBODY *)pvBody;
 
-    while (cbBody >= sizeof (VRDEUSBREQREAPURBBODY))
+    while (cbBody >= sizeof(VRDEUSBREQREAPURBBODY))
     {
         Log(("RemoteUSBBackend::reapURB: id = %d,  flags = %02X, error = %d, handle %d, len = %d.\n",
              pBody->id, pBody->flags, pBody->error, pBody->handle, pBody->len));
@@ -1193,7 +1198,7 @@ int RemoteUSBBackend::reapURB (const void *pvBody, uint32_t cbBody)
 
         /* Verify client's data. */
         if (   (pBody->flags & ~fu8ReapValidFlags) != 0
-            || sizeof (VRDEUSBREQREAPURBBODY) > cbBody
+            || sizeof(VRDEUSBREQREAPURBBODY) > cbBody
             || pBody->handle == 0)
         {
             LogFlow(("RemoteUSBBackend::reapURB: WARNING: invalid reply data. Skipping the reply.\n"));
@@ -1201,7 +1206,7 @@ int RemoteUSBBackend::reapURB (const void *pvBody, uint32_t cbBody)
             break;
         }
 
-        PREMOTEUSBDEVICE pDevice = deviceFromId (pBody->id);
+        PREMOTEUSBDEVICE pDevice = deviceFromId(pBody->id);
 
         if (!pDevice)
         {
@@ -1212,7 +1217,7 @@ int RemoteUSBBackend::reapURB (const void *pvBody, uint32_t cbBody)
 
         uint32_t cbBodyData = 0; /* Data contained in the URB body structure for input URBs. */
 
-        requestDevice (pDevice);
+        requestDevice(pDevice);
 
         /* Search the queued URB for given handle. */
         REMOTEUSBQURB *qurb = pDevice->pHeadQURBs;
diff --git a/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp b/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp
index 9998669..8409640 100644
--- a/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp
+++ b/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp
@@ -88,18 +88,28 @@ HRESULT RemoteUSBDevice::init (uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevDesc
             case VRDE_USBDEVICESPEED_LOW:
             case VRDE_USBDEVICESPEED_FULL:
                 unconst(mData.portVersion) = 1;
+                unconst(mData.speed) = USBConnectionSpeed_Full;
                 break;
 
             case VRDE_USBDEVICESPEED_HIGH:
             case VRDE_USBDEVICESPEED_VARIABLE:
-            case VRDE_USBDEVICESPEED_SUPERSPEED:
                 unconst(mData.portVersion) = 2;
+                unconst(mData.speed) = USBConnectionSpeed_High;
+                break;
+
+            case VRDE_USBDEVICESPEED_SUPERSPEED:
+                unconst(mData.portVersion) = 3;
+                unconst(mData.speed) = USBConnectionSpeed_Super;
                 break;
         }
     }
     else
     {
         unconst(mData.portVersion)  = mData.version;
+        unconst(mData.speed) = mData.version == 3
+                             ? (USBConnectionSpeed_T)USBConnectionSpeed_Super
+                             : mData.version == 2 ? (USBConnectionSpeed_T)USBConnectionSpeed_High
+                                                  : (USBConnectionSpeed_T)USBConnectionSpeed_Full;
     }
 
     mData.state                  = USBDeviceState_Available;
@@ -297,6 +307,19 @@ STDMETHODIMP RemoteUSBDevice::COMGETTER(PortVersion) (USHORT *aPortVersion)
     return S_OK;
 }
 
+STDMETHODIMP RemoteUSBDevice::COMGETTER(Speed) (USBConnectionSpeed_T *aSpeed)
+{
+    CheckComArgOutPointerValid(aSpeed);
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* this is const, no need to lock */
+    *aSpeed = mData.speed;
+
+    return S_OK;
+}
+
 STDMETHODIMP RemoteUSBDevice::COMGETTER(Remote) (BOOL *aRemote)
 {
     CheckComArgOutPointerValid(aRemote);
diff --git a/src/VBox/Main/src-client/SessionImpl.cpp b/src/VBox/Main/src-client/SessionImpl.cpp
index 6ea10d3..2db0565 100644
--- a/src/VBox/Main/src-client/SessionImpl.cpp
+++ b/src/VBox/Main/src-client/SessionImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -34,12 +34,21 @@
 #define CHECK_OPEN() \
     do { \
         if (mState != SessionState_Locked) \
-            return setError(E_UNEXPECTED, tr ("The session is not locked (session state: %s)"), Global::stringifySessionState(mState)); \
+            return setError(E_UNEXPECTED, tr ("The session is not locked (session state: %s)"), \
+                            Global::stringifySessionState(mState)); \
     } while (0)
 
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
+Session::Session()
+{
+}
+
+Session::~Session()
+{
+}
+
 HRESULT Session::FinalConstruct()
 {
     LogFlowThisFunc(("\n"));
@@ -105,7 +114,7 @@ void Session::uninit()
         return;
     }
 
-    /* unlockMachine() needs write lock */
+    /* close() needs write lock */
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mState != SessionState_Unlocked)
@@ -113,7 +122,7 @@ void Session::uninit()
         Assert(mState == SessionState_Locked ||
                mState == SessionState_Spawning);
 
-        HRESULT rc = unlockMachine(true /* aFinalRelease */, false /* aFromServer */, alock);
+        HRESULT rc = i_unlockMachine(true /* aFinalRelease */, false /* aFromServer */);
         AssertComRC(rc);
     }
 
@@ -123,13 +132,8 @@ void Session::uninit()
 // ISession properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP Session::COMGETTER(State)(SessionState_T *aState)
+HRESULT Session::getState(SessionState_T *aState)
 {
-    CheckComArgOutPointerValid(aState);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aState = mState;
@@ -137,13 +141,8 @@ STDMETHODIMP Session::COMGETTER(State)(SessionState_T *aState)
     return S_OK;
 }
 
-STDMETHODIMP Session::COMGETTER(Type)(SessionType_T *aType)
+HRESULT Session::getType(SessionType_T *aType)
 {
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     CHECK_OPEN();
@@ -152,13 +151,27 @@ STDMETHODIMP Session::COMGETTER(Type)(SessionType_T *aType)
     return S_OK;
 }
 
-STDMETHODIMP Session::COMGETTER(Machine)(IMachine **aMachine)
+HRESULT Session::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aMachine);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    aName = mName;
+    return S_OK;
+}
+
+HRESULT Session::setName(const com::Utf8Str &aName)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (mState != SessionState_Unlocked)
+        return setError(VBOX_E_INVALID_OBJECT_STATE, tr("Trying to set name for a session which is not in state \"unlocked\""));
 
+    mName = aName;
+    return S_OK;
+}
+
+HRESULT Session::getMachine(ComPtr<IMachine> &aMachine)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     CHECK_OPEN();
@@ -166,58 +179,51 @@ STDMETHODIMP Session::COMGETTER(Machine)(IMachine **aMachine)
     HRESULT rc;
 #ifndef VBOX_COM_INPROC_API_CLIENT
     if (mConsole)
-       rc = mConsole->machine().queryInterfaceTo(aMachine);
+        rc = mConsole->i_machine().queryInterfaceTo(aMachine.asOutParam());
     else
 #endif
-       rc = mRemoteMachine.queryInterfaceTo(aMachine);
+        rc = mRemoteMachine.queryInterfaceTo(aMachine.asOutParam());
     if (FAILED(rc))
     {
-        /** @todo VBox 3.3: replace E_FAIL with rc here. */
 #ifndef VBOX_COM_INPROC_API_CLIENT
         if (mConsole)
-            setError(E_FAIL, tr("Failed to query the session machine (%Rhrc)"), rc);
+            setError(rc, tr("Failed to query the session machine"));
         else
 #endif
         if (FAILED_DEAD_INTERFACE(rc))
-            setError(E_FAIL, tr("Peer process crashed"));
+            setError(rc, tr("Peer process crashed"));
         else
-            setError(E_FAIL, tr("Failed to query the remote session machine (%Rhrc)"), rc);
+            setError(rc, tr("Failed to query the remote session machine"));
     }
 
     return rc;
 }
 
-STDMETHODIMP Session::COMGETTER(Console)(IConsole **aConsole)
+HRESULT Session::getConsole(ComPtr<IConsole> &aConsole)
 {
-    CheckComArgOutPointerValid(aConsole);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     CHECK_OPEN();
 
-    HRESULT rc;
+    HRESULT rc = S_OK;
 #ifndef VBOX_COM_INPROC_API_CLIENT
     if (mConsole)
-        rc = mConsole.queryInterfaceTo(aConsole);
+        rc = mConsole.queryInterfaceTo(aConsole.asOutParam());
     else
 #endif
-        rc = mRemoteConsole.queryInterfaceTo(aConsole);
+        rc = mRemoteConsole.queryInterfaceTo(aConsole.asOutParam());
 
     if (FAILED(rc))
     {
-        /** @todo VBox 3.3: replace E_FAIL with rc here. */
 #ifndef VBOX_COM_INPROC_API_CLIENT
         if (mConsole)
-            setError(E_FAIL, tr("Failed to query the console (%Rhrc)"), rc);
+            setError(rc, tr("Failed to query the console"));
         else
 #endif
         if (FAILED_DEAD_INTERFACE(rc))
-            setError(E_FAIL, tr("Peer process crashed"));
+            setError(rc, tr("Peer process crashed"));
         else
-            setError(E_FAIL, tr("Failed to query the remote console (%Rhrc)"), rc);
+            setError(rc, tr("Failed to query the remote console"));
     }
 
     return rc;
@@ -225,32 +231,22 @@ STDMETHODIMP Session::COMGETTER(Console)(IConsole **aConsole)
 
 // ISession methods
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP Session::UnlockMachine()
+HRESULT Session::unlockMachine()
 {
     LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    /* unlockMachine() needs write lock */
+    /* close() needs write lock */
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     CHECK_OPEN();
 
-    return unlockMachine(false /* aFinalRelease */, false /* aFromServer */, alock);
+    return i_unlockMachine(false /* aFinalRelease */, false /* aFromServer */);
 }
 
 // IInternalSessionControl methods
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP Session::GetPID(ULONG *aPid)
+HRESULT Session::getPID(ULONG *aPid)
 {
-    AssertReturn(aPid, E_POINTER);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aPid = (ULONG)RTProcSelf();
@@ -259,18 +255,12 @@ STDMETHODIMP Session::GetPID(ULONG *aPid)
     return S_OK;
 }
 
-STDMETHODIMP Session::GetRemoteConsole(IConsole **aConsole)
+HRESULT Session::getRemoteConsole(ComPtr<IConsole> &aConsole)
 {
     LogFlowThisFuncEnter();
-    AssertReturn(aConsole, E_POINTER);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AssertReturn(mState != SessionState_Unlocked, VBOX_E_INVALID_VM_STATE);
-
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertMsgReturn(mType == SessionType_WriteLock && !!mConsole,
                     ("This is not a direct session!\n"),
@@ -281,7 +271,7 @@ STDMETHODIMP Session::GetRemoteConsole(IConsole **aConsole)
     if (mState != SessionState_Locked)
         return VBOX_E_INVALID_VM_STATE;
 
-    mConsole.queryInterfaceTo(aConsole);
+    mConsole.queryInterfaceTo(aConsole.asOutParam());
 
     LogFlowThisFuncLeave();
 
@@ -293,20 +283,31 @@ STDMETHODIMP Session::GetRemoteConsole(IConsole **aConsole)
 #endif /* VBOX_COM_INPROC_API_CLIENT */
 }
 
-#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
-STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType,
-                                    IN_BSTR aTokenId)
-#else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType,
-                                    IToken *aToken)
-#endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
+HRESULT Session::getNominalState(MachineState_T *aNominalState)
 {
-    LogFlowThisFuncEnter();
-    LogFlowThisFunc(("aMachine=%p\n", aMachine));
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
+    AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
+#ifndef VBOX_COM_INPROC_API_CLIENT
+    AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+    return mConsole->i_getNominalState(*aNominalState);
+#else
+    AssertFailed();
+    return E_NOTIMPL;
+#endif
+}
 
+#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
+HRESULT Session::assignMachine(const ComPtr<IMachine> &aMachine,
+                               LockType_T aLockType,
+                               const com::Utf8Str &aTokenId)
+#else
+HRESULT Session::assignMachine(const ComPtr<IMachine> &aMachine,
+                               LockType_T aLockType,
+                               const ComPtr<IToken> &aToken)
+#endif /* !VBOX_WITH_GENERIC_SESSION_WATCHER */
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     AssertReturn(mState == SessionState_Unlocked, VBOX_E_INVALID_VM_STATE);
@@ -323,7 +324,6 @@ STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType,
         mType = SessionType_Remote;
         mState = SessionState_Spawning;
 
-        LogFlowThisFuncLeave();
         return S_OK;
     }
 
@@ -331,14 +331,21 @@ STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType,
     mControl = aMachine;
     AssertReturn(!!mControl, E_FAIL);
 
+    HRESULT rc = S_OK;
 #ifndef VBOX_COM_INPROC_API_CLIENT
-    HRESULT rc = mConsole.createObject();
-    AssertComRCReturn(rc, rc);
+    if (aLockType == LockType_VM)
+    {
+        /* This is what is special about VM processes: they have a Console
+         * object which is the root of all VM related activity. */
+        rc = mConsole.createObject();
+        AssertComRCReturn(rc, rc);
 
-    rc = mConsole->init(aMachine, mControl, aLockType);
-    AssertComRCReturn(rc, rc);
+        rc = mConsole->init(aMachine, mControl, aLockType);
+        AssertComRCReturn(rc, rc);
+    }
+    else
+        mRemoteMachine = aMachine;
 #else
-    HRESULT rc = S_OK;
     mRemoteMachine = aMachine;
 #endif
 
@@ -346,7 +353,7 @@ STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType,
     Utf8Str strTokenId(aTokenId);
     Assert(!strTokenId.isEmpty());
 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-    AssertPtr(aToken);
+    Assert(!aToken.isNull());
 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
     /* create the machine client token */
     try
@@ -393,26 +400,19 @@ STDMETHODIMP Session::AssignMachine(IMachine *aMachine, LockType_T aLockType,
 #endif
     }
 
-    LogFlowThisFunc(("rc=%08X\n", rc));
-    LogFlowThisFuncLeave();
-
     return rc;
 }
 
-STDMETHODIMP Session::AssignRemoteMachine(IMachine *aMachine, IConsole *aConsole)
-{
-    LogFlowThisFuncEnter();
-    LogFlowThisFunc(("aMachine=%p, aConsole=%p\n", aMachine, aConsole));
-
-    AssertReturn(aMachine && aConsole, E_INVALIDARG);
+HRESULT Session::assignRemoteMachine(const ComPtr<IMachine> &aMachine,
+                                     const ComPtr<IConsole> &aConsole)
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+{
+    AssertReturn(aMachine, E_INVALIDARG);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     AssertReturn(mState == SessionState_Unlocked ||
-                  mState == SessionState_Spawning, VBOX_E_INVALID_VM_STATE);
+                 mState == SessionState_Spawning, VBOX_E_INVALID_VM_STATE);
 
     HRESULT rc = E_FAIL;
 
@@ -472,11 +472,10 @@ STDMETHODIMP Session::AssignRemoteMachine(IMachine *aMachine, IConsole *aConsole
     return rc;
 }
 
-STDMETHODIMP Session::UpdateMachineState(MachineState_T aMachineState)
+HRESULT Session::updateMachineState(MachineState_T aMachineState)
 {
-    AutoCaller autoCaller(this);
 
-    if (autoCaller.state() != Ready)
+    if (getObjectState().getState() != ObjectState::Ready)
     {
         /*
          *  We might have already entered Session::uninit() at this point, so
@@ -501,13 +500,13 @@ STDMETHODIMP Session::UpdateMachineState(MachineState_T aMachineState)
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(!mConsole.isNull(), E_FAIL);
 
-    return mConsole->updateMachineState(aMachineState);
+    return mConsole->i_updateMachineState(aMachineState);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::Uninitialize()
+HRESULT Session::uninitialize()
 {
     LogFlowThisFuncEnter();
 
@@ -515,9 +514,9 @@ STDMETHODIMP Session::Uninitialize()
 
     HRESULT rc = S_OK;
 
-    if (autoCaller.state() == Ready)
+    if (getObjectState().getState() == ObjectState::Ready)
     {
-        /* unlockMachine() needs write lock */
+        /* close() needs write lock */
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
         LogFlowThisFunc(("mState=%s, mType=%d\n", Global::stringifySessionState(mState), mType));
@@ -534,9 +533,10 @@ STDMETHODIMP Session::Uninitialize()
                          mState, SessionState_Locked, SessionState_Spawning),
                         VBOX_E_INVALID_VM_STATE);
 
-        rc = unlockMachine(false /* aFinalRelease */, true /* aFromServer */, alock);
+        /* close ourselves */
+        rc = i_unlockMachine(false /* aFinalRelease */, true /* aFromServer */);
     }
-    else if (autoCaller.state() == InUninit)
+    else if (getObjectState().getState() == ObjectState::InUninit)
     {
         /*
          *  We might have already entered Session::uninit() at this point,
@@ -556,298 +556,255 @@ STDMETHODIMP Session::Uninitialize()
     return rc;
 }
 
-STDMETHODIMP Session::OnNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter)
+HRESULT Session::onNetworkAdapterChange(const ComPtr<INetworkAdapter> &aNetworkAdapter,
+                                        BOOL aChangeAdapter)
+
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onNetworkAdapterChange(networkAdapter, changeAdapter);
+    return mConsole->i_onNetworkAdapterChange(aNetworkAdapter, aChangeAdapter);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnSerialPortChange(ISerialPort *serialPort)
+HRESULT Session::onSerialPortChange(const ComPtr<ISerialPort> &aSerialPort)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onSerialPortChange(serialPort);
+    return mConsole->i_onSerialPortChange(aSerialPort);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnParallelPortChange(IParallelPort *parallelPort)
+HRESULT Session::onParallelPortChange(const ComPtr<IParallelPort> &aParallelPort)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onParallelPortChange(parallelPort);
+    return mConsole->i_onParallelPortChange(aParallelPort);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnStorageControllerChange()
+HRESULT Session::onStorageControllerChange()
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onStorageControllerChange();
+    return mConsole->i_onStorageControllerChange();
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce)
+HRESULT Session::onMediumChange(const ComPtr<IMediumAttachment> &aMediumAttachment,
+                                BOOL aForce)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onMediumChange(aMediumAttachment, aForce);
+    return mConsole->i_onMediumChange(aMediumAttachment, aForce);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnCPUChange(ULONG aCPU, BOOL aRemove)
+HRESULT Session::onCPUChange(ULONG aCpu, BOOL aAdd)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onCPUChange(aCPU, aRemove);
+    return mConsole->i_onCPUChange(aCpu, aAdd);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnCPUExecutionCapChange(ULONG aExecutionCap)
+HRESULT Session::onCPUExecutionCapChange(ULONG aExecutionCap)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onCPUExecutionCapChange(aExecutionCap);
+    return mConsole->i_onCPUExecutionCapChange(aExecutionCap);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnVRDEServerChange(BOOL aRestart)
+HRESULT Session::onVRDEServerChange(BOOL aRestart)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onVRDEServerChange(aRestart);
+    return mConsole->i_onVRDEServerChange(aRestart);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnVideoCaptureChange()
+HRESULT Session::onVideoCaptureChange()
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onVideoCaptureChange();
+    return mConsole->i_onVideoCaptureChange();
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnUSBControllerChange()
+HRESULT Session::onUSBControllerChange()
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onUSBControllerChange();
+    return mConsole->i_onUSBControllerChange();
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnSharedFolderChange(BOOL aGlobal)
+HRESULT Session::onSharedFolderChange(BOOL aGlobal)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onSharedFolderChange(aGlobal);
+    return mConsole->i_onSharedFolderChange(aGlobal);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnClipboardModeChange(ClipboardMode_T aClipboardMode)
+HRESULT Session::onClipboardModeChange(ClipboardMode_T aClipboardMode)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onClipboardModeChange(aClipboardMode);
+    return mConsole->i_onClipboardModeChange(aClipboardMode);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode)
+HRESULT Session::onDnDModeChange(DnDMode_T aDndMode)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
+    AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onDragAndDropModeChange(aDragAndDropMode);
+    return mConsole->i_onDnDModeChange(aDndMode);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnUSBDeviceAttach(IUSBDevice *aDevice,
-                                        IVirtualBoxErrorInfo *aError,
-                                        ULONG aMaskedIfs)
+HRESULT Session::onUSBDeviceAttach(const ComPtr<IUSBDevice> &aDevice,
+                                   const ComPtr<IVirtualBoxErrorInfo> &aError,
+                                   ULONG aMaskedInterfaces,
+                                   const com::Utf8Str &aCaptureFilename)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onUSBDeviceAttach(aDevice, aError, aMaskedIfs);
+    return mConsole->i_onUSBDeviceAttach(aDevice, aError, aMaskedInterfaces, aCaptureFilename);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnUSBDeviceDetach(IN_BSTR aId,
-                                        IVirtualBoxErrorInfo *aError)
+HRESULT Session::onUSBDeviceDetach(const com::Guid &aId,
+                                   const ComPtr<IVirtualBoxErrorInfo> &aError)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onUSBDeviceDetach(aId, aError);
+    return mConsole->i_onUSBDeviceDetach(aId.toUtf16().raw(), aError);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId)
+HRESULT Session::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
@@ -867,87 +824,75 @@ STDMETHODIMP Session::OnShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId)
     }
 
 #ifndef VBOX_COM_INPROC_API_CLIENT
-    return mConsole->onShowWindow(aCheck, aCanShow, aWinId);
+    return mConsole->i_onShowWindow(aCheck, aCanShow, aWinId);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
+HRESULT Session::onBandwidthGroupChange(const ComPtr<IBandwidthGroup> &aBandwidthGroup)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onBandwidthGroupChange(aBandwidthGroup);
+    return mConsole->i_onBandwidthGroupChange(aBandwidthGroup);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::OnStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent)
+HRESULT Session::onStorageDeviceChange(const ComPtr<IMediumAttachment> &aMediumAttachment, BOOL aRemove, BOOL aSilent)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onStorageDeviceChange(aMediumAttachment, aRemove, aSilent);
+    return mConsole->i_onStorageDeviceChange(aMediumAttachment, aRemove, aSilent);
 #else
     return S_OK;
 #endif
 }
 
-STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
-                                          BOOL aIsSetter, BSTR *aRetValue, LONG64 *aRetTimestamp, BSTR *aRetFlags)
+HRESULT Session::accessGuestProperty(const com::Utf8Str &aName, const com::Utf8Str &aValue, const com::Utf8Str &aFlags,
+                                     ULONG aAccessMode, com::Utf8Str &aRetValue, LONG64 *aRetTimestamp, com::Utf8Str &aRetFlags)
 {
 #ifdef VBOX_WITH_GUEST_PROPS
 # ifndef VBOX_COM_INPROC_API_CLIENT
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     if (mState != SessionState_Locked)
         return setError(VBOX_E_INVALID_VM_STATE,
                         tr("Machine is not locked by session (session state: %s)."),
                         Global::stringifySessionState(mState));
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
-    CheckComArgStrNotEmptyOrNull(aName);
-    if (!aIsSetter && !VALID_PTR(aRetValue))
-        return E_POINTER;
-    if (!aIsSetter && !VALID_PTR(aRetTimestamp))
-        return E_POINTER;
-    if (!aIsSetter && !VALID_PTR(aRetFlags))
+    if (aName.isEmpty())
+        return E_INVALIDARG;
+    if (aAccessMode == 0 && !RT_VALID_PTR(aRetTimestamp))
         return E_POINTER;
-    /* aValue can be NULL for a setter call if the property is to be deleted. */
-    if (aIsSetter && (aValue != NULL) && !VALID_PTR(aValue))
-        return setError(E_INVALIDARG, tr("Invalid value pointer"));
-    /* aFlags can be null if it is to be left as is */
-    if (aIsSetter && (aFlags != NULL) && !VALID_PTR(aFlags))
-        return setError(E_INVALIDARG, tr("Invalid flags pointer"));
 
     /* If this session is not in a VM process fend off the call. The caller
      * handles this correctly, by doing the operation in VBoxSVC. */
     if (!mConsole)
         return E_ACCESSDENIED;
 
-    if (!aIsSetter)
-        return mConsole->getGuestProperty(aName, aRetValue, aRetTimestamp, aRetFlags);
+    HRESULT hr;
+    if (aAccessMode == 2)
+        hr = mConsole->i_deleteGuestProperty(aName);
+    else if (aAccessMode == 1)
+        hr = mConsole->i_setGuestProperty(aName, aValue, aFlags);
+    else if (aAccessMode == 0)
+        hr = mConsole->i_getGuestProperty(aName, &aRetValue, aRetTimestamp, &aRetFlags);
     else
-        return mConsole->setGuestProperty(aName, aValue, aFlags);
+        hr = E_INVALIDARG;
 
+    return hr;
 # else  /* VBOX_COM_INPROC_API_CLIENT */
     /** @todo This is nonsense, non-VM API users shouldn't need to deal with this
      *        method call, VBoxSVC should be clever enough to see that the
@@ -960,54 +905,34 @@ STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTR
 #endif /* VBOX_WITH_GUEST_PROPS */
 }
 
-STDMETHODIMP Session::EnumerateGuestProperties(IN_BSTR aPatterns,
-                                               ComSafeArrayOut(BSTR, aNames),
-                                               ComSafeArrayOut(BSTR, aValues),
-                                               ComSafeArrayOut(LONG64, aTimestamps),
-                                               ComSafeArrayOut(BSTR, aFlags))
+HRESULT Session::enumerateGuestProperties(const com::Utf8Str &aPatterns,
+                                          std::vector<com::Utf8Str> &aKeys,
+                                          std::vector<com::Utf8Str> &aValues,
+                                          std::vector<LONG64> &aTimestamps,
+                                          std::vector<com::Utf8Str> &aFlags)
 {
 #if defined(VBOX_WITH_GUEST_PROPS) && !defined(VBOX_COM_INPROC_API_CLIENT)
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     if (mState != SessionState_Locked)
         return setError(VBOX_E_INVALID_VM_STATE,
                         tr("Machine is not locked by session (session state: %s)."),
                         Global::stringifySessionState(mState));
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
-    if (!VALID_PTR(aPatterns) && (aPatterns != NULL))
-        return E_POINTER;
-    if (ComSafeArrayOutIsNull(aNames))
-        return E_POINTER;
-    if (ComSafeArrayOutIsNull(aValues))
-        return E_POINTER;
-    if (ComSafeArrayOutIsNull(aTimestamps))
-        return E_POINTER;
-    if (ComSafeArrayOutIsNull(aFlags))
-        return E_POINTER;
 
     /* If this session is not in a VM process fend off the call. The caller
      * handles this correctly, by doing the operation in VBoxSVC. */
     if (!mConsole)
         return E_ACCESSDENIED;
 
-    return mConsole->enumerateGuestProperties(aPatterns,
-                                              ComSafeArrayOutArg(aNames),
-                                              ComSafeArrayOutArg(aValues),
-                                              ComSafeArrayOutArg(aTimestamps),
-                                              ComSafeArrayOutArg(aFlags));
+    return mConsole->i_enumerateGuestProperties(aPatterns, aKeys, aValues, aTimestamps, aFlags);
+
 #else /* VBOX_WITH_GUEST_PROPS not defined */
     ReturnComNotImplemented();
 #endif /* VBOX_WITH_GUEST_PROPS not defined */
 }
 
-STDMETHODIMP Session::OnlineMergeMedium(IMediumAttachment *aMediumAttachment,
-                                        ULONG aSourceIdx, ULONG aTargetIdx,
-                                        IProgress *aProgress)
+HRESULT Session::onlineMergeMedium(const ComPtr<IMediumAttachment> &aMediumAttachment, ULONG aSourceIdx,
+                                   ULONG aTargetIdx, const ComPtr<IProgress> &aProgress)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     if (mState != SessionState_Locked)
         return setError(VBOX_E_INVALID_VM_STATE,
                         tr("Machine is not locked by session (session state: %s)."),
@@ -1015,29 +940,42 @@ STDMETHODIMP Session::OnlineMergeMedium(IMediumAttachment *aMediumAttachment,
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
-    CheckComArgNotNull(aMediumAttachment);
 
-    return mConsole->onlineMergeMedium(aMediumAttachment,
-                                       aSourceIdx, aTargetIdx,
-                                       aProgress);
+    return mConsole->i_onlineMergeMedium(aMediumAttachment,
+                                         aSourceIdx, aTargetIdx,
+                                         aProgress);
 #else
     AssertFailed();
     return E_NOTIMPL;
 #endif
 }
 
-STDMETHODIMP Session::EnableVMMStatistics(BOOL aEnable)
+HRESULT Session::reconfigureMediumAttachments(const std::vector<ComPtr<IMediumAttachment> > &aAttachments)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+    if (mState != SessionState_Locked)
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("Machine is not locked by session (session state: %s)."),
+                        Global::stringifySessionState(mState));
+#ifndef VBOX_COM_INPROC_API_CLIENT
+    AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
+    AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
+
+    return mConsole->i_reconfigureMediumAttachments(aAttachments);
+#else
+    AssertFailed();
+    return E_NOTIMPL;
+#endif
+}
 
+HRESULT Session::enableVMMStatistics(BOOL aEnable)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    mConsole->enableVMMStatistics(aEnable);
+    mConsole->i_enableVMMStatistics(aEnable);
 
     return S_OK;
 #else
@@ -1046,54 +984,65 @@ STDMETHODIMP Session::EnableVMMStatistics(BOOL aEnable)
 #endif
 }
 
-STDMETHODIMP Session::PauseWithReason(Reason_T aReason)
+HRESULT Session::pauseWithReason(Reason_T aReason)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->pause(aReason);
+    return mConsole->i_pause(aReason);
 #else
     AssertFailed();
     return E_NOTIMPL;
 #endif
 }
 
-STDMETHODIMP Session::ResumeWithReason(Reason_T aReason)
+HRESULT Session::resumeWithReason(Reason_T aReason)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->resume(aReason);
+    AutoWriteLock dummyLock(mConsole COMMA_LOCKVAL_SRC_POS);
+    return mConsole->i_resume(aReason, dummyLock);
 #else
     AssertFailed();
     return E_NOTIMPL;
 #endif
 }
 
-STDMETHODIMP Session::SaveStateWithReason(Reason_T aReason, IProgress **aProgress)
+HRESULT Session::saveStateWithReason(Reason_T aReason, const ComPtr<IProgress> &aProgress, const Utf8Str &aStateFilePath, BOOL aPauseVM, BOOL *aLeftPaused)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
+    AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
+#ifndef VBOX_COM_INPROC_API_CLIENT
+    AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
+    bool fLeftPaused = false;
+    HRESULT rc = mConsole->i_saveState(aReason, aProgress, aStateFilePath, !!aPauseVM, fLeftPaused);
+    if (aLeftPaused)
+        *aLeftPaused = fLeftPaused;
+    return rc;
+#else
+    AssertFailed();
+    return E_NOTIMPL;
+#endif
+}
+
+HRESULT Session::cancelSaveStateWithReason()
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
 #ifndef VBOX_COM_INPROC_API_CLIENT
     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->saveState(aReason, aProgress);
+    return mConsole->i_cancelSaveState();
 #else
     AssertFailed();
     return E_NOTIMPL;
@@ -1108,20 +1057,17 @@ STDMETHODIMP Session::SaveStateWithReason(Reason_T aReason, IProgress **aProgres
  *
  *  @param aFinalRelease    called as a result of FinalRelease()
  *  @param aFromServer      called as a result of Uninitialize()
- *  @param alock            Write lock to be used in this method,
- *                          to unlock it at the right time.
  *
  *  @note To be called only from #uninit(), #UnlockMachine() or #Uninitialize().
  *  @note Locks this object for writing.
  */
-HRESULT Session::unlockMachine(bool aFinalRelease, bool aFromServer, AutoWriteLock &alock)
+HRESULT Session::i_unlockMachine(bool aFinalRelease, bool aFromServer)
 {
     LogFlowThisFuncEnter();
     LogFlowThisFunc(("aFinalRelease=%d, isFromServer=%d\n",
                       aFinalRelease, aFromServer));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     LogFlowThisFunc(("mState=%s, mType=%d\n", Global::stringifySessionState(mState), mType));
 
@@ -1131,12 +1077,12 @@ HRESULT Session::unlockMachine(bool aFinalRelease, bool aFromServer, AutoWriteLo
 
         /* The session object is going to be uninitialized before it has been
          * assigned a direct console of the machine the client requested to open
-         * a remote session to using IMachine::launchVMProcess(). It is OK
-         * only if this unlock request comes from the server (for example, it
+         * a remote session to using IVirtualBox:: openRemoteSession(). It is OK
+         * only if this close request comes from the server (for example, it
          * detected that the VM process it started terminated before opening a
          * direct session). Otherwise, it means that the client is too fast and
-         * trying to unlock the session before waiting for the progress object it
-         * got from IMachine::launchVMProcess() to complete, so assert. */
+         * trying to close the session before waiting for the progress object it
+         * got from IVirtualBox:: openRemoteSession() to complete, so assert. */
         Assert(aFromServer);
 
         mState = SessionState_Unlocked;
diff --git a/src/VBox/Main/src-client/USBDeviceImpl.cpp b/src/VBox/Main/src-client/USBDeviceImpl.cpp
index 023b697..c8ecc98 100644
--- a/src/VBox/Main/src-client/USBDeviceImpl.cpp
+++ b/src/VBox/Main/src-client/USBDeviceImpl.cpp
@@ -67,17 +67,24 @@ HRESULT OUSBDevice::init(IUSBDevice *aUSBDevice)
     hrc = aUSBDevice->COMGETTER(Revision)(&unconst(mData.revision));
     ComAssertComRCRet(hrc, hrc);
 
-    hrc = aUSBDevice->COMGETTER(Manufacturer)(unconst(mData.manufacturer).asOutParam());
+    BSTR tmp;
+    BSTR *bptr = &tmp;
+
+    hrc = aUSBDevice->COMGETTER(Manufacturer)(bptr);
     ComAssertComRCRet(hrc, hrc);
+    unconst(mData.manufacturer) = Utf8Str(tmp);
 
-    hrc = aUSBDevice->COMGETTER(Product)(unconst(mData.product).asOutParam());
+    hrc = aUSBDevice->COMGETTER(Product)(bptr);
     ComAssertComRCRet(hrc, hrc);
+    unconst(mData.product) = Utf8Str(tmp);
 
-    hrc = aUSBDevice->COMGETTER(SerialNumber)(unconst(mData.serialNumber).asOutParam());
+    hrc = aUSBDevice->COMGETTER(SerialNumber)(bptr);
     ComAssertComRCRet(hrc, hrc);
+    unconst(mData.serialNumber) = Utf8Str(tmp);
 
-    hrc = aUSBDevice->COMGETTER(Address)(unconst(mData.address).asOutParam());
+    hrc = aUSBDevice->COMGETTER(Address)(bptr);
     ComAssertComRCRet(hrc, hrc);
+    unconst(mData.address) = Utf8Str(tmp);
 
     hrc = aUSBDevice->COMGETTER(Port)(&unconst(mData.port));
     ComAssertComRCRet(hrc, hrc);
@@ -88,6 +95,9 @@ HRESULT OUSBDevice::init(IUSBDevice *aUSBDevice)
     hrc = aUSBDevice->COMGETTER(PortVersion)(&unconst(mData.portVersion));
     ComAssertComRCRet(hrc, hrc);
 
+    hrc = aUSBDevice->COMGETTER(Speed)(&unconst(mData.speed));
+    ComAssertComRCRet(hrc, hrc);
+
     hrc = aUSBDevice->COMGETTER(Remote)(&unconst(mData.remote));
     ComAssertComRCRet(hrc, hrc);
 
@@ -143,15 +153,10 @@ void OUSBDevice::uninit()
  * @returns COM status code
  * @param   aId   Address of result variable.
  */
-STDMETHODIMP OUSBDevice::COMGETTER(Id)(BSTR *aId)
+HRESULT OUSBDevice::getId(com::Guid &aId)
 {
-    CheckComArgOutPointerValid(aId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
-    Guid(mData.id).toUtf16().detachTo(aId);
+    aId = mData.id;
 
     return S_OK;
 }
@@ -163,13 +168,8 @@ STDMETHODIMP OUSBDevice::COMGETTER(Id)(BSTR *aId)
  * @returns COM status code
  * @param   aVendorId   Where to store the vendor id.
  */
-STDMETHODIMP OUSBDevice::COMGETTER(VendorId)(USHORT *aVendorId)
+HRESULT OUSBDevice::getVendorId(USHORT *aVendorId)
 {
-    CheckComArgOutPointerValid(aVendorId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
     *aVendorId = mData.vendorId;
 
@@ -183,13 +183,8 @@ STDMETHODIMP OUSBDevice::COMGETTER(VendorId)(USHORT *aVendorId)
  * @returns COM status code
  * @param   aProductId  Where to store the product id.
  */
-STDMETHODIMP OUSBDevice::COMGETTER(ProductId)(USHORT *aProductId)
+HRESULT OUSBDevice::getProductId(USHORT *aProductId)
 {
-    CheckComArgOutPointerValid(aProductId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
     *aProductId = mData.productId;
 
@@ -203,13 +198,8 @@ STDMETHODIMP OUSBDevice::COMGETTER(ProductId)(USHORT *aProductId)
  * @returns COM status code
  * @param   aRevision  Where to store the revision BCD.
  */
-STDMETHODIMP OUSBDevice::COMGETTER(Revision)(USHORT *aRevision)
+HRESULT OUSBDevice::getRevision(USHORT *aRevision)
 {
-    CheckComArgOutPointerValid(aRevision);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
     *aRevision = mData.revision;
 
@@ -222,15 +212,10 @@ STDMETHODIMP OUSBDevice::COMGETTER(Revision)(USHORT *aRevision)
  * @returns COM status code
  * @param   aManufacturer     Where to put the return string.
  */
-STDMETHODIMP OUSBDevice::COMGETTER(Manufacturer)(BSTR *aManufacturer)
+HRESULT OUSBDevice::getManufacturer(com::Utf8Str &aManufacturer)
 {
-    CheckComArgOutPointerValid(aManufacturer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
-    mData.manufacturer.cloneTo(aManufacturer);
+    aManufacturer = mData.manufacturer;
 
     return S_OK;
 }
@@ -242,15 +227,10 @@ STDMETHODIMP OUSBDevice::COMGETTER(Manufacturer)(BSTR *aManufacturer)
  * @returns COM status code
  * @param   aProduct          Where to put the return string.
  */
-STDMETHODIMP OUSBDevice::COMGETTER(Product)(BSTR *aProduct)
+HRESULT OUSBDevice::getProduct(com::Utf8Str &aProduct)
 {
-    CheckComArgOutPointerValid(aProduct);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
-    mData.product.cloneTo(aProduct);
+    aProduct = mData.product;
 
     return S_OK;
 }
@@ -262,15 +242,10 @@ STDMETHODIMP OUSBDevice::COMGETTER(Product)(BSTR *aProduct)
  * @returns COM status code
  * @param   aSerialNumber     Where to put the return string.
  */
-STDMETHODIMP OUSBDevice::COMGETTER(SerialNumber)(BSTR *aSerialNumber)
+HRESULT OUSBDevice::getSerialNumber(com::Utf8Str &aSerialNumber)
 {
-    CheckComArgOutPointerValid(aSerialNumber);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
-    mData.serialNumber.cloneTo(aSerialNumber);
+    aSerialNumber = mData.serialNumber;
 
     return S_OK;
 }
@@ -282,65 +257,48 @@ STDMETHODIMP OUSBDevice::COMGETTER(SerialNumber)(BSTR *aSerialNumber)
  * @returns COM status code
  * @param   aAddress          Where to put the return string.
  */
-STDMETHODIMP OUSBDevice::COMGETTER(Address)(BSTR *aAddress)
+HRESULT OUSBDevice::getAddress(com::Utf8Str &aAddress)
 {
-    CheckComArgOutPointerValid(aAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
-    mData.address.cloneTo(aAddress);
+    aAddress = mData.address;
 
     return S_OK;
 }
 
-STDMETHODIMP OUSBDevice::COMGETTER(Port)(USHORT *aPort)
+HRESULT OUSBDevice::getPort(USHORT *aPort)
 {
-    CheckComArgOutPointerValid(aPort);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
     *aPort = mData.port;
 
     return S_OK;
 }
 
-STDMETHODIMP OUSBDevice::COMGETTER(Version)(USHORT *aVersion)
+HRESULT OUSBDevice::getVersion(USHORT *aVersion)
 {
-    CheckComArgOutPointerValid(aVersion);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
     *aVersion = mData.version;
 
     return S_OK;
 }
 
-STDMETHODIMP OUSBDevice::COMGETTER(PortVersion)(USHORT *aPortVersion)
+HRESULT OUSBDevice::getPortVersion(USHORT *aPortVersion)
 {
-    CheckComArgOutPointerValid(aPortVersion);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
     *aPortVersion = mData.portVersion;
 
     return S_OK;
 }
 
-STDMETHODIMP OUSBDevice::COMGETTER(Remote)(BOOL *aRemote)
+HRESULT OUSBDevice::getSpeed(USBConnectionSpeed_T *aSpeed)
 {
-    CheckComArgOutPointerValid(aRemote);
+    /* this is const, no need to lock */
+    *aSpeed = mData.speed;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    return S_OK;
+}
 
+HRESULT OUSBDevice::getRemote(BOOL *aRemote)
+{
     /* this is const, no need to lock */
     *aRemote = mData.remote;
 
diff --git a/src/VBox/Main/src-client/UsbCardReader.cpp b/src/VBox/Main/src-client/UsbCardReader.cpp
index 477beef..da0d61e 100644
--- a/src/VBox/Main/src-client/UsbCardReader.cpp
+++ b/src/VBox/Main/src-client/UsbCardReader.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2012 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -549,7 +549,7 @@ static DECLCALLBACK(int) drvCardReaderDownControl(PPDMICARDREADERDOWN pInterface
         && cbInBuffer)
     {
         pvInBufferCopy = RTMemDup(pvInBuffer, cbInBuffer);
-        AssertPtrReturn(pvInBufferCopy, VERR_NO_MEMORY);
+        AssertReturn(pvInBufferCopy, VERR_NO_MEMORY);
     }
     int rc = RTReqQueueCallEx(pThis->hReqQCardReaderCmd, NULL, 0, RTREQFLAGS_VOID | RTREQFLAGS_NO_WAIT,
                               (PFNRT)drvCardReaderCmdControl, 6,
@@ -692,7 +692,7 @@ typedef struct UCRREQCTX
 
 int UsbCardReader::vrdeSCardRequest(void *pvUser, uint32_t u32Function, const void *pvData, uint32_t cbData)
 {
-    int rc = mParent->consoleVRDPServer()->SCardRequest(pvUser, u32Function, pvData, cbData);
+    int rc = mParent->i_consoleVRDPServer()->SCardRequest(pvUser, u32Function, pvData, cbData);
     LogFlowFunc(("%d %Rrc\n", u32Function, rc));
     return rc;
 }
diff --git a/src/VBox/Main/src-client/UsbWebcamInterface.cpp b/src/VBox/Main/src-client/UsbWebcamInterface.cpp
index 5a924eb..f01fdba 100644
--- a/src/VBox/Main/src-client/UsbWebcamInterface.cpp
+++ b/src/VBox/Main/src-client/UsbWebcamInterface.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2013 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -257,8 +257,8 @@ void EmWebcam::EmWebcamCbDeviceDesc(int rcRequest, void *pDeviceCtx, void *pvUse
         pRemote->cbDeviceDesc = cbDeviceDesc;
 
         /* Try to attach the device. */
-        EmulatedUSB *pEUSB = mParent->getConsole()->getEmulatedUSB();
-        pEUSB->webcamAttachInternal("", "", "EmWebcam", pRemote);
+        EmulatedUSB *pEUSB = mParent->getConsole()->i_getEmulatedUSB();
+        pEUSB->i_webcamAttachInternal("", "", "EmWebcam", pRemote);
     }
     else
     {
diff --git a/src/VBox/Main/src-client/VBoxDriversRegister.cpp b/src/VBox/Main/src-client/VBoxDriversRegister.cpp
index 7fa0f99..d321e71 100644
--- a/src/VBox/Main/src-client/VBoxDriversRegister.cpp
+++ b/src/VBox/Main/src-client/VBoxDriversRegister.cpp
@@ -1,3 +1,4 @@
+/* $Id: VBoxDriversRegister.cpp $ */
 /** @file
  *
  * Main driver registration.
@@ -23,7 +24,11 @@
 #include "KeyboardImpl.h"
 #include "DisplayImpl.h"
 #include "VMMDev.h"
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+#include "DrvAudioVRDE.h"
+#else
 #include "AudioSnifferInterface.h"
+#endif
 #include "Nvram.h"
 #include "UsbWebcamInterface.h"
 #ifdef VBOX_WITH_USB_CARDREADER
@@ -67,7 +72,11 @@ extern "C" DECLEXPORT(int) VBoxDriversRegister(PCPDMDRVREGCB pCallbacks, uint32_
     if (RT_FAILURE(rc))
         return rc;
 
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+    rc = pCallbacks->pfnRegister(pCallbacks, &AudioVRDE::DrvReg);
+#else
     rc = pCallbacks->pfnRegister(pCallbacks, &AudioSniffer::DrvReg);
+#endif
     if (RT_FAILURE(rc))
         return rc;
 
diff --git a/src/VBox/Main/src-client/VMMDevInterface.cpp b/src/VBox/Main/src-client/VMMDevInterface.cpp
index 42be327..97280b5 100644
--- a/src/VBox/Main/src-client/VMMDevInterface.cpp
+++ b/src/VBox/Main/src-client/VMMDevInterface.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -73,14 +73,6 @@ typedef struct DRVMAINVMMDEV
 #endif
 } DRVMAINVMMDEV, *PDRVMAINVMMDEV;
 
-/** Converts PDMIVMMDEVCONNECTOR pointer to a DRVMAINVMMDEV pointer. */
-#define PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface) ( (PDRVMAINVMMDEV) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINVMMDEV, Connector)) )
-
-#ifdef VBOX_WITH_HGCM
-/** Converts PDMIHGCMCONNECTOR pointer to a DRVMAINVMMDEV pointer. */
-#define PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface) ( (PDRVMAINVMMDEV) ((uintptr_t)pInterface - RT_OFFSETOF(DRVMAINVMMDEV, HGCMConnector)) )
-#endif
-
 //
 // constructor / destructor
 //
@@ -163,17 +155,15 @@ int VMMDev::SetCredentialsJudgementResult(uint32_t u32Flags)
 DECLCALLBACK(void) vmmdevUpdateGuestStatus(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFacility, uint16_t uStatus,
                                            uint32_t fFlags, PCRTTIMESPEC pTimeSpecTS)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     /* Store that information in IGuest */
-    Guest* guest = pConsole->getGuest();
-    Assert(guest);
-    if (!guest)
-        return;
+    Guest* guest = pConsole->i_getGuest();
+    AssertPtrReturnVoid(guest);
 
-    guest->setAdditionsStatus((VBoxGuestFacilityType)uFacility, (VBoxGuestFacilityStatus)uStatus, fFlags, pTimeSpecTS);
-    pConsole->onAdditionsStateChange();
+    guest->i_setAdditionsStatus((VBoxGuestFacilityType)uFacility, (VBoxGuestFacilityStatus)uStatus, fFlags, pTimeSpecTS);
+    pConsole->i_onAdditionsStateChange();
 }
 
 
@@ -185,19 +175,17 @@ DECLCALLBACK(void) vmmdevUpdateGuestUserState(PPDMIVMMDEVCONNECTOR pInterface,
                                               uint32_t uState,
                                               const uint8_t *puDetails, uint32_t cbDetails)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     AssertPtr(pDrv);
     Console *pConsole = pDrv->pVMMDev->getParent();
     AssertPtr(pConsole);
 
     /* Store that information in IGuest. */
-    Guest* pGuest = pConsole->getGuest();
-    AssertPtr(pGuest);
-    if (!pGuest)
-        return;
+    Guest* pGuest = pConsole->i_getGuest();
+    AssertPtrReturnVoid(pGuest);
 
-    pGuest->onUserStateChange(Bstr(pszUser), Bstr(pszDomain), (VBoxGuestUserState)uState,
-                              puDetails, cbDetails);
+    pGuest->i_onUserStateChange(Bstr(pszUser), Bstr(pszDomain), (VBoxGuestUserState)uState,
+                                puDetails, cbDetails);
 }
 
 
@@ -213,34 +201,29 @@ DECLCALLBACK(void) vmmdevUpdateGuestUserState(PPDMIVMMDEVCONNECTOR pInterface,
  */
 DECLCALLBACK(void) vmmdevUpdateGuestInfo(PPDMIVMMDEVCONNECTOR pInterface, const VBoxGuestInfo *guestInfo)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
-
-    Assert(guestInfo);
-    if (!guestInfo)
-        return;
+    AssertPtrReturnVoid(guestInfo);
 
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     /* Store that information in IGuest */
-    Guest* guest = pConsole->getGuest();
-    Assert(guest);
-    if (!guest)
-        return;
+    Guest* guest = pConsole->i_getGuest();
+    AssertPtrReturnVoid(guest);
 
     if (guestInfo->interfaceVersion != 0)
     {
         char version[16];
         RTStrPrintf(version, sizeof(version), "%d", guestInfo->interfaceVersion);
-        guest->setAdditionsInfo(Bstr(version), guestInfo->osType);
+        guest->i_setAdditionsInfo(Bstr(version), guestInfo->osType);
 
         /*
          * Tell the console interface about the event
          * so that it can notify its consumers.
          */
-        pConsole->onAdditionsStateChange();
+        pConsole->i_onAdditionsStateChange();
 
         if (guestInfo->interfaceVersion < VMMDEV_VERSION)
-            pConsole->onAdditionsOutdated();
+            pConsole->i_onAdditionsOutdated();
     }
     else
     {
@@ -248,14 +231,14 @@ DECLCALLBACK(void) vmmdevUpdateGuestInfo(PPDMIVMMDEVCONNECTOR pInterface, const
          * The guest additions was disabled because of a reset
          * or driver unload.
          */
-        guest->setAdditionsInfo(Bstr(), guestInfo->osType); /* Clear interface version + OS type. */
+        guest->i_setAdditionsInfo(Bstr(), guestInfo->osType); /* Clear interface version + OS type. */
         /** @todo Would be better if GuestImpl.cpp did all this in the above method call
          *        while holding down the. */
-        guest->setAdditionsInfo2(0, "", 0,  0); /* Clear Guest Additions version. */
+        guest->i_setAdditionsInfo2(0, "", 0,  0); /* Clear Guest Additions version. */
         RTTIMESPEC TimeSpecTS;
         RTTimeNow(&TimeSpecTS);
-        guest->setAdditionsStatus(VBoxGuestFacilityType_All, VBoxGuestFacilityStatus_Inactive, 0 /*fFlags*/, &TimeSpecTS);
-        pConsole->onAdditionsStateChange();
+        guest->i_setAdditionsStatus(VBoxGuestFacilityType_All, VBoxGuestFacilityStatus_Inactive, 0 /*fFlags*/, &TimeSpecTS);
+        pConsole->i_onAdditionsStateChange();
     }
 }
 
@@ -265,18 +248,16 @@ DECLCALLBACK(void) vmmdevUpdateGuestInfo(PPDMIVMMDEVCONNECTOR pInterface, const
 DECLCALLBACK(void) vmmdevUpdateGuestInfo2(PPDMIVMMDEVCONNECTOR pInterface, uint32_t uFullVersion,
                                           const char *pszName, uint32_t uRevision, uint32_t fFeatures)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     AssertPtr(pszName);
     Assert(uFullVersion);
 
     /* Store that information in IGuest. */
-    Guest *pGuest = pDrv->pVMMDev->getParent()->getGuest();
-    Assert(pGuest);
-    if (!pGuest)
-        return;
+    Guest *pGuest = pDrv->pVMMDev->getParent()->i_getGuest();
+    AssertPtrReturnVoid(pGuest);
 
     /* Just pass it on... */
-    pGuest->setAdditionsInfo2(uFullVersion, pszName, uRevision, fFeatures);
+    pGuest->i_setAdditionsInfo2(uFullVersion, pszName, uRevision, fFeatures);
 
     /*
      * No need to tell the console interface about the update;
@@ -296,35 +277,32 @@ DECLCALLBACK(void) vmmdevUpdateGuestInfo2(PPDMIVMMDEVCONNECTOR pInterface, uint3
  */
 DECLCALLBACK(void) vmmdevUpdateGuestCapabilities(PPDMIVMMDEVCONNECTOR pInterface, uint32_t newCapabilities)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     AssertPtr(pDrv);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     /* store that information in IGuest */
-    Guest* pGuest = pConsole->getGuest();
-    AssertPtr(pGuest);
-    if (!pGuest)
-        return;
+    Guest* pGuest = pConsole->i_getGuest();
+    AssertPtrReturnVoid(pGuest);
 
     /*
      * Report our current capabilities (and assume none is active yet).
      */
-    pGuest->setSupportedFeatures(newCapabilities);
+    pGuest->i_setSupportedFeatures(newCapabilities);
 
     /*
      * Tell the Display, so that it can update the "supports graphics"
      * capability if the graphics card has not asserted it.
      */
-    Display* pDisplay = pConsole->getDisplay();
+    Display* pDisplay = pConsole->i_getDisplay();
     AssertPtrReturnVoid(pDisplay);
-    pDisplay->i_handleUpdateVMMDevSupportsGraphics(newCapabilities
-                                             & VMMDEV_GUEST_SUPPORTS_GRAPHICS);
+    pDisplay->i_handleUpdateVMMDevSupportsGraphics(RT_BOOL(newCapabilities & VMMDEV_GUEST_SUPPORTS_GRAPHICS));
 
     /*
      * Tell the console interface about the event
      * so that it can notify its consumers.
      */
-    pConsole->onAdditionsStateChange();
+    pConsole->i_onAdditionsStateChange();
 }
 
 /**
@@ -338,16 +316,16 @@ DECLCALLBACK(void) vmmdevUpdateGuestCapabilities(PPDMIVMMDEVCONNECTOR pInterface
  */
 DECLCALLBACK(void) vmmdevUpdateMouseCapabilities(PPDMIVMMDEVCONNECTOR pInterface, uint32_t fNewCaps)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     /*
      * Tell the console interface about the event
      * so that it can notify its consumers.
      */
-    Mouse *pMouse = pConsole->getMouse();
+    Mouse *pMouse = pConsole->i_getMouse();
     if (pMouse)  /** @todo and if not?  Can that actually happen? */
-        pMouse->onVMMDevGuestCapsChange(fNewCaps & VMMDEV_MOUSE_GUEST_MASK);
+        pMouse->i_onVMMDevGuestCapsChange(fNewCaps & VMMDEV_MOUSE_GUEST_MASK);
 }
 
 /**
@@ -371,56 +349,52 @@ DECLCALLBACK(void) vmmdevUpdatePointerShape(PPDMIVMMDEVCONNECTOR pInterface, boo
                                             uint32_t width, uint32_t height,
                                             void *pShape)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     /* tell the console about it */
-    size_t cbShapeSize = 0;
-
+    uint32_t cbShape = 0;
     if (pShape)
     {
-        cbShapeSize = (width + 7) / 8 * height; /* size of the AND mask */
-        cbShapeSize = ((cbShapeSize + 3) & ~3) + width * 4 * height; /* + gap + size of the XOR mask */
+        cbShape = (width + 7) / 8 * height; /* size of the AND mask */
+        cbShape = ((cbShape + 3) & ~3) + width * 4 * height; /* + gap + size of the XOR mask */
     }
-    com::SafeArray<BYTE> shapeData(cbShapeSize);
-    if (pShape)
-        ::memcpy(shapeData.raw(), pShape, cbShapeSize);
-    pConsole->onMousePointerShapeChange(fVisible, fAlpha, xHot, yHot, width, height, ComSafeArrayAsInParam(shapeData));
+    pConsole->i_onMousePointerShapeChange(fVisible, fAlpha, xHot, yHot, width, height, (uint8_t *)pShape, cbShape);
 }
 
 DECLCALLBACK(int) iface_VideoAccelEnable(PPDMIVMMDEVCONNECTOR pInterface, bool fEnable, VBVAMEMORY *pVbvaMemory)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
-    Display *display = pConsole->getDisplay();
+    Display *display = pConsole->i_getDisplay();
 
     if (display)
     {
         LogSunlover(("MAIN::VMMDevInterface::iface_VideoAccelEnable: %d, %p\n", fEnable, pVbvaMemory));
-        return display->VideoAccelEnable(fEnable, pVbvaMemory);
+        return display->VideoAccelEnableVMMDev(fEnable, pVbvaMemory);
     }
 
     return VERR_NOT_SUPPORTED;
 }
 DECLCALLBACK(void) iface_VideoAccelFlush(PPDMIVMMDEVCONNECTOR pInterface)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
-    Display *display = pConsole->getDisplay();
+    Display *display = pConsole->i_getDisplay();
 
     if (display)
     {
         LogSunlover(("MAIN::VMMDevInterface::iface_VideoAccelFlush\n"));
-        display->VideoAccelFlush ();
+        display->VideoAccelFlushVMMDev();
     }
 }
 
 DECLCALLBACK(int) vmmdevVideoModeSupported(PPDMIVMMDEVCONNECTOR pInterface, uint32_t display, uint32_t width, uint32_t height,
                                            uint32_t bpp, bool *fSupported)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     if (!fSupported)
@@ -429,9 +403,7 @@ DECLCALLBACK(int) vmmdevVideoModeSupported(PPDMIVMMDEVCONNECTOR pInterface, uint
     Log(("vmmdevVideoModeSupported: [%d]: %dx%dx%d\n", display, width, height, bpp));
 #endif
     IFramebuffer *framebuffer = NULL;
-    LONG xOrigin = 0;
-    LONG yOrigin = 0;
-    HRESULT hrc = pConsole->getDisplay()->GetFramebuffer(display, &framebuffer, &xOrigin, &yOrigin);
+    HRESULT hrc = pConsole->i_getDisplay()->QueryFramebuffer(display, &framebuffer);
     if (SUCCEEDED(hrc) && framebuffer)
     {
         framebuffer->VideoModeSupported(width, height, bpp, (BOOL*)fSupported);
@@ -449,14 +421,18 @@ DECLCALLBACK(int) vmmdevVideoModeSupported(PPDMIVMMDEVCONNECTOR pInterface, uint
 
 DECLCALLBACK(int) vmmdevGetHeightReduction(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *heightReduction)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     if (!heightReduction)
         return VERR_INVALID_PARAMETER;
-    IFramebuffer *framebuffer = pConsole->getDisplay()->getFramebuffer();
-    if (framebuffer)
+    IFramebuffer *framebuffer = NULL;
+    HRESULT hrc = pConsole->i_getDisplay()->QueryFramebuffer(0, &framebuffer);
+    if (SUCCEEDED(hrc) && framebuffer)
+    {
         framebuffer->COMGETTER(HeightReduction)((ULONG*)heightReduction);
+        framebuffer->Release();
+    }
     else
         *heightReduction = 0;
     return VINF_SUCCESS;
@@ -464,7 +440,7 @@ DECLCALLBACK(int) vmmdevGetHeightReduction(PPDMIVMMDEVCONNECTOR pInterface, uint
 
 DECLCALLBACK(int) vmmdevSetCredentialsJudgementResult(PPDMIVMMDEVCONNECTOR pInterface, uint32_t u32Flags)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
 
     if (pDrv->pVMMDev)
         return pDrv->pVMMDev->SetCredentialsJudgementResult (u32Flags);
@@ -474,22 +450,22 @@ DECLCALLBACK(int) vmmdevSetCredentialsJudgementResult(PPDMIVMMDEVCONNECTOR pInte
 
 DECLCALLBACK(int) vmmdevSetVisibleRegion(PPDMIVMMDEVCONNECTOR pInterface, uint32_t cRect, PRTRECT pRect)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     /* Forward to Display, which calls corresponding framebuffers. */
-    pConsole->getDisplay()->handleSetVisibleRegion(cRect, pRect);
+    pConsole->i_getDisplay()->i_handleSetVisibleRegion(cRect, pRect);
 
     return VINF_SUCCESS;
 }
 
 DECLCALLBACK(int) vmmdevQueryVisibleRegion(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcRect, PRTRECT pRect)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
     /* Forward to Display, which calls corresponding framebuffers. */
-    pConsole->getDisplay()->handleQueryVisibleRegion(pcRect, pRect);
+    pConsole->i_getDisplay()->i_handleQueryVisibleRegion(pcRect, pRect);
 
     return VINF_SUCCESS;
 }
@@ -504,7 +480,7 @@ DECLCALLBACK(int) vmmdevQueryVisibleRegion(PPDMIVMMDEVCONNECTOR pInterface, uint
  */
 DECLCALLBACK(int) vmmdevQueryStatisticsInterval(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pulInterval)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
     ULONG          val = 0;
 
@@ -512,10 +488,8 @@ DECLCALLBACK(int) vmmdevQueryStatisticsInterval(PPDMIVMMDEVCONNECTOR pInterface,
         return VERR_INVALID_POINTER;
 
     /* store that information in IGuest */
-    Guest* guest = pConsole->getGuest();
-    Assert(guest);
-    if (!guest)
-        return VERR_GENERAL_FAILURE;
+    Guest* guest = pConsole->i_getGuest();
+    AssertPtrReturn(guest, VERR_GENERAL_FAILURE);
 
     guest->COMGETTER(StatisticsUpdateInterval)(&val);
     *pulInterval = val;
@@ -532,7 +506,7 @@ DECLCALLBACK(int) vmmdevQueryStatisticsInterval(PPDMIVMMDEVCONNECTOR pInterface,
  */
 DECLCALLBACK(int) vmmdevQueryBalloonSize(PPDMIVMMDEVCONNECTOR pInterface, uint32_t *pcbBalloon)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
     ULONG          val = 0;
 
@@ -540,10 +514,8 @@ DECLCALLBACK(int) vmmdevQueryBalloonSize(PPDMIVMMDEVCONNECTOR pInterface, uint32
         return VERR_INVALID_POINTER;
 
     /* store that information in IGuest */
-    Guest* guest = pConsole->getGuest();
-    Assert(guest);
-    if (!guest)
-        return VERR_GENERAL_FAILURE;
+    Guest* guest = pConsole->i_getGuest();
+    AssertPtrReturn(guest, VERR_GENERAL_FAILURE);
 
     guest->COMGETTER(MemoryBalloonSize)(&val);
     *pcbBalloon = val;
@@ -560,7 +532,7 @@ DECLCALLBACK(int) vmmdevQueryBalloonSize(PPDMIVMMDEVCONNECTOR pInterface, uint32
  */
 DECLCALLBACK(int) vmmdevIsPageFusionEnabled(PPDMIVMMDEVCONNECTOR pInterface, bool *pfPageFusionEnabled)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
     BOOL           val = 0;
 
@@ -568,12 +540,10 @@ DECLCALLBACK(int) vmmdevIsPageFusionEnabled(PPDMIVMMDEVCONNECTOR pInterface, boo
         return VERR_INVALID_POINTER;
 
     /* store that information in IGuest */
-    Guest* guest = pConsole->getGuest();
-    Assert(guest);
-    if (!guest)
-        return VERR_GENERAL_FAILURE;
+    Guest* guest = pConsole->i_getGuest();
+    AssertPtrReturn(guest, VERR_GENERAL_FAILURE);
 
-    *pfPageFusionEnabled = !!guest->isPageFusionEnabled();
+    *pfPageFusionEnabled = !!guest->i_isPageFusionEnabled();
     return VINF_SUCCESS;
 }
 
@@ -587,46 +557,42 @@ DECLCALLBACK(int) vmmdevIsPageFusionEnabled(PPDMIVMMDEVCONNECTOR pInterface, boo
  */
 DECLCALLBACK(int) vmmdevReportStatistics(PPDMIVMMDEVCONNECTOR pInterface, VBoxGuestStatistics *pGuestStats)
 {
-    PDRVMAINVMMDEV pDrv = PDMIVMMDEVCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, Connector);
     Console *pConsole = pDrv->pVMMDev->getParent();
 
-    Assert(pGuestStats);
-    if (!pGuestStats)
-        return VERR_INVALID_POINTER;
+    AssertPtrReturn(pGuestStats, VERR_INVALID_POINTER);
 
     /* store that information in IGuest */
-    Guest* guest = pConsole->getGuest();
-    Assert(guest);
-    if (!guest)
-        return VERR_GENERAL_FAILURE;
+    Guest* guest = pConsole->i_getGuest();
+    AssertPtrReturn(guest, VERR_GENERAL_FAILURE);
 
     if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_CPU_LOAD_IDLE)
-        guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_CPUIDLE, pGuestStats->u32CpuLoad_Idle);
+        guest->i_setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_CPUIDLE, pGuestStats->u32CpuLoad_Idle);
 
     if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_CPU_LOAD_KERNEL)
-        guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_CPUKERNEL, pGuestStats->u32CpuLoad_Kernel);
+        guest->i_setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_CPUKERNEL, pGuestStats->u32CpuLoad_Kernel);
 
     if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_CPU_LOAD_USER)
-        guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_CPUUSER, pGuestStats->u32CpuLoad_User);
+        guest->i_setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_CPUUSER, pGuestStats->u32CpuLoad_User);
 
 
     /** @todo r=bird: Convert from 4KB to 1KB units?
-     *        CollectorGuestHAL::getGuestMemLoad says it returns KB units to
+     *        CollectorGuestHAL::i_getGuestMemLoad says it returns KB units to
      *        preCollect().  I might be wrong ofc, this is convoluted code... */
     if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_PHYS_MEM_TOTAL)
-        guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMTOTAL, pGuestStats->u32PhysMemTotal);
+        guest->i_setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMTOTAL, pGuestStats->u32PhysMemTotal);
 
     if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_PHYS_MEM_AVAIL)
-        guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMFREE, pGuestStats->u32PhysMemAvail);
+        guest->i_setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMFREE, pGuestStats->u32PhysMemAvail);
 
     if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_PHYS_MEM_BALLOON)
-        guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMBALLOON, pGuestStats->u32PhysMemBalloon);
+        guest->i_setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMBALLOON, pGuestStats->u32PhysMemBalloon);
 
     if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_MEM_SYSTEM_CACHE)
-        guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMCACHE, pGuestStats->u32MemSystemCache);
+        guest->i_setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_MEMCACHE, pGuestStats->u32MemSystemCache);
 
     if (pGuestStats->u32StatCaps & VBOX_GUEST_STAT_PAGE_FILE_SIZE)
-        guest->setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_PAGETOTAL, pGuestStats->u32PageFileSize);
+        guest->i_setStatistic(pGuestStats->u32CpuId, GUESTSTATTYPE_PAGETOTAL, pGuestStats->u32PageFileSize);
 
     return VINF_SUCCESS;
 }
@@ -635,11 +601,13 @@ DECLCALLBACK(int) vmmdevReportStatistics(PPDMIVMMDEVCONNECTOR pInterface, VBoxGu
 
 /* HGCM connector interface */
 
-static DECLCALLBACK(int) iface_hgcmConnect (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, PHGCMSERVICELOCATION pServiceLocation, uint32_t *pu32ClientID)
+static DECLCALLBACK(int) iface_hgcmConnect(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd,
+                                           PHGCMSERVICELOCATION pServiceLocation,
+                                           uint32_t *pu32ClientID)
 {
     LogSunlover(("Enter\n"));
 
-    PDRVMAINVMMDEV pDrv = PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, HGCMConnector);
 
     if (    !pServiceLocation
         || (   pServiceLocation->type != VMMDevHGCMLoc_LocalHost
@@ -654,11 +622,11 @@ static DECLCALLBACK(int) iface_hgcmConnect (PPDMIHGCMCONNECTOR pInterface, PVBOX
     return HGCMGuestConnect(pDrv->pHGCMPort, pCmd, pServiceLocation->u.host.achName, pu32ClientID);
 }
 
-static DECLCALLBACK(int) iface_hgcmDisconnect (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID)
+static DECLCALLBACK(int) iface_hgcmDisconnect(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID)
 {
     LogSunlover(("Enter\n"));
 
-    PDRVMAINVMMDEV pDrv = PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, HGCMConnector);
 
     if (!pDrv->pVMMDev || !pDrv->pVMMDev->hgcmIsActive())
         return VERR_INVALID_STATE;
@@ -666,12 +634,12 @@ static DECLCALLBACK(int) iface_hgcmDisconnect (PPDMIHGCMCONNECTOR pInterface, PV
     return HGCMGuestDisconnect(pDrv->pHGCMPort, pCmd, u32ClientID);
 }
 
-static DECLCALLBACK(int) iface_hgcmCall (PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID, uint32_t u32Function,
-                                         uint32_t cParms, PVBOXHGCMSVCPARM paParms)
+static DECLCALLBACK(int) iface_hgcmCall(PPDMIHGCMCONNECTOR pInterface, PVBOXHGCMCMD pCmd, uint32_t u32ClientID,
+                                        uint32_t u32Function, uint32_t cParms, PVBOXHGCMSVCPARM paParms)
 {
     LogSunlover(("Enter\n"));
 
-    PDRVMAINVMMDEV pDrv = PDMIHGCMCONNECTOR_2_MAINVMMDEV(pInterface);
+    PDRVMAINVMMDEV pDrv = RT_FROM_MEMBER(pInterface, DRVMAINVMMDEV, HGCMConnector);
 
     if (!pDrv->pVMMDev || !pDrv->pVMMDev->hgcmIsActive())
         return VERR_INVALID_STATE;
@@ -726,7 +694,7 @@ int VMMDev::hgcmHostCall(const char *pszServiceName, uint32_t u32Function,
 {
     if (!hgcmIsActive())
         return VERR_INVALID_STATE;
-    return HGCMHostCall (pszServiceName, u32Function, cParms, paParms);
+    return HGCMHostCall(pszServiceName, u32Function, cParms, paParms);
 }
 
 void VMMDev::hgcmShutdown(void)
@@ -736,21 +704,22 @@ void VMMDev::hgcmShutdown(void)
 }
 
 # ifdef VBOX_WITH_CRHGSMI
-int VMMDev::hgcmHostSvcHandleCreate (const char *pszServiceName, HGCMCVSHANDLE * phSvc)
+int VMMDev::hgcmHostSvcHandleCreate(const char *pszServiceName, HGCMCVSHANDLE * phSvc)
 {
     if (!hgcmIsActive())
         return VERR_INVALID_STATE;
     return HGCMHostSvcHandleCreate(pszServiceName, phSvc);
 }
 
-int VMMDev::hgcmHostSvcHandleDestroy (HGCMCVSHANDLE hSvc)
+int VMMDev::hgcmHostSvcHandleDestroy(HGCMCVSHANDLE hSvc)
 {
     if (!hgcmIsActive())
         return VERR_INVALID_STATE;
     return HGCMHostSvcHandleDestroy(hSvc);
 }
 
-int VMMDev::hgcmHostFastCallAsync (HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm, PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion)
+int VMMDev::hgcmHostFastCallAsync(HGCMCVSHANDLE hSvc, uint32_t function, PVBOXHGCMSVCPARM pParm,
+                                  PHGCMHOSTFASTCALLCB pfnCompletion, void *pvCompletion)
 {
     if (!hgcmIsActive())
         return VERR_INVALID_STATE;
@@ -886,7 +855,7 @@ DECLCALLBACK(int) VMMDev::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfgHandle,
         PPDMLED       pLed;
         PPDMILEDPORTS pLedPort;
 
-        LogRel(("Shared Folders service loaded.\n"));
+        LogRel(("Shared Folders service loaded\n"));
         pLedPort = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMILEDPORTS);
         AssertMsgReturn(pLedPort, ("Configuration error: No LED port interface above!\n"), VERR_PDM_MISSING_INTERFACE_ABOVE);
         rc = pLedPort->pfnQueryStatusLed(pLedPort, 0, &pLed);
diff --git a/src/VBox/Main/src-client/VideoRec.cpp b/src/VBox/Main/src-client/VideoRec.cpp
index f47527e..dbdb355 100644
--- a/src/VBox/Main/src-client/VideoRec.cpp
+++ b/src/VBox/Main/src-client/VideoRec.cpp
@@ -21,6 +21,7 @@
 #include <iprt/assert.h>
 #include <iprt/semaphore.h>
 #include <iprt/thread.h>
+#include <iprt/time.h>
 
 #include <VBox/com/VirtualBox.h>
 #include <VBox/com/com.h>
@@ -58,7 +59,7 @@ static uint32_t g_enmState = VIDREC_UNINITIALIZED;
 typedef struct VIDEORECSTREAM
 {
     /* container context */
-    EbmlGlobal          Ebml;
+    WebMWriter          Ebml;
     /* VPX codec context */
     vpx_codec_ctx_t     VpxCodec;
     /* VPX configuration */
@@ -91,6 +92,8 @@ typedef struct VIDEORECSTREAM
     uint64_t            u64LastTimeStamp;
     /* time stamp of the current frame */
     uint64_t            u64TimeStamp;
+    /* encoder deadline */
+    unsigned int        uEncoderDeadline;
 } VIDEORECSTREAM;
 
 typedef struct VIDEORECCONTEXT
@@ -105,6 +108,10 @@ typedef struct VIDEORECCONTEXT
     RTTHREAD            Thread;
     /* number of stream contexts */
     uint32_t            cScreens;
+    /* maximal time stamp */
+    uint64_t            u64MaxTimeStamp;
+    /* maximal file size in MB */
+    uint32_t            uMaxFileSize;
     /* video recording stream contexts */
     VIDEORECSTREAM      Strm[1];
 } VIDEORECCONTEXT;
@@ -435,7 +442,12 @@ int VideoRecContextCreate(PVIDEORECCONTEXT *ppCtx, uint32_t cScreens)
 
     pCtx->cScreens = cScreens;
     for (unsigned uScreen = 0; uScreen < cScreens; uScreen++)
-        pCtx->Strm[uScreen].Ebml.last_pts_ms = -1;
+    {
+        /* Since we allocate without using standard C++ new mechanism
+         * it is required to call placement new for correct initialization
+         * of the object. */
+        new (&pCtx->Strm[uScreen] + RT_OFFSETOF(VIDEORECSTREAM, Ebml)) WebMWriter();
+    }
 
     int rc = RTSemEventCreate(&pCtx->WaitEvent);
     AssertRCReturn(rc, rc);
@@ -462,22 +474,27 @@ int VideoRecContextCreate(PVIDEORECCONTEXT *ppCtx, uint32_t cScreens)
  * @param   uTargetHeight       Height of the target image in video recording file.
  */
 int VideoRecStrmInit(PVIDEORECCONTEXT pCtx, uint32_t uScreen, const char *pszFile,
-                     uint32_t uWidth, uint32_t uHeight, uint32_t uRate, uint32_t uFps)
+                     uint32_t uWidth, uint32_t uHeight, uint32_t uRate, uint32_t uFps,
+                     uint32_t uMaxTime, uint32_t uMaxFileSize, const char *pszOptions)
 {
     AssertPtrReturn(pCtx, VERR_INVALID_PARAMETER);
     AssertReturn(uScreen < pCtx->cScreens, VERR_INVALID_PARAMETER);
 
+    pCtx->u64MaxTimeStamp = (uMaxTime > 0 ? RTTimeProgramMilliTS() + uMaxTime * 1000 : 0);
+    pCtx->uMaxFileSize = uMaxFileSize;
+
     PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
     pStrm->uTargetWidth  = uWidth;
     pStrm->uTargetHeight = uHeight;
     pStrm->pu8RgbBuf = (uint8_t *)RTMemAllocZ(uWidth * uHeight * 4);
     AssertReturn(pStrm->pu8RgbBuf, VERR_NO_MEMORY);
+    pStrm->uEncoderDeadline = VPX_DL_REALTIME;
 
     /* Play safe: the file must not exist, overwriting is potentially
      * hazardous as nothing prevents the user from picking a file name of some
      * other important file, causing unintentional data loss. */
-    int rc = RTFileOpen(&pStrm->Ebml.file, pszFile,
-                        RTFILE_O_CREATE | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
+
+    int rc = pStrm->Ebml.create(pszFile);
     if (RT_FAILURE(rc))
     {
         LogRel(("Failed to create the video capture output file \"%s\" (%Rrc)\n", pszFile, rc));
@@ -491,6 +508,38 @@ int VideoRecStrmInit(PVIDEORECCONTEXT pCtx, uint32_t uScreen, const char *pszFil
         return VERR_INVALID_PARAMETER;
     }
 
+    com::Utf8Str options(pszOptions);
+    size_t pos = 0;
+
+    do {
+
+        com::Utf8Str key, value;
+        pos = options.parseKeyValue(key, value, pos);
+
+        if (key == "quality")
+        {
+            if (value == "realtime")
+            {
+                pStrm->uEncoderDeadline = VPX_DL_REALTIME;
+            }
+            else if (value == "good")
+            {
+                pStrm->uEncoderDeadline = 1000000 / uFps;
+            }
+            else if (value == "best")
+            {
+                pStrm->uEncoderDeadline = VPX_DL_BEST_QUALITY;
+            }
+            else
+            {
+                LogRel(("Settings quality deadline to = %s\n", value.c_str()));
+                pStrm->uEncoderDeadline = value.toUInt32();
+            }
+        }
+        else LogRel(("Getting unknown option: %s=%s\n", key.c_str(), value.c_str()));
+
+    } while(pos != com::Utf8Str::npos);
+
     /* target bitrate in kilobits per second */
     pStrm->VpxConfig.rc_target_bitrate = uRate;
     /* frame width */
@@ -505,8 +554,8 @@ int VideoRecStrmInit(PVIDEORECCONTEXT pCtx, uint32_t uScreen, const char *pszFil
 
     pStrm->uDelay = 1000 / uFps;
 
-    struct vpx_rational arg_framerate = { 30, 1 };
-    rc = Ebml_WriteWebMFileHeader(&pStrm->Ebml, &pStrm->VpxConfig, &arg_framerate);
+    struct vpx_rational arg_framerate = { (int)uFps, 1 };
+    rc = pStrm->Ebml.writeHeader(&pStrm->VpxConfig, &arg_framerate);
     AssertRCReturn(rc, rc);
 
     /* Initialize codec */
@@ -563,24 +612,17 @@ void VideoRecContextClose(PVIDEORECCONTEXT pCtx)
         PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
         if (pStrm->fEnabled)
         {
-            if (pStrm->Ebml.file != NIL_RTFILE)
-            {
-                int rc = Ebml_WriteWebMFileFooter(&pStrm->Ebml, 0);
-                AssertRC(rc);
-                RTFileClose(pStrm->Ebml.file);
-                pStrm->Ebml.file = NIL_RTFILE;
-            }
-            if (pStrm->Ebml.cue_list)
-            {
-                RTMemFree(pStrm->Ebml.cue_list);
-                pStrm->Ebml.cue_list = NULL;
-            }
+            int rc = pStrm->Ebml.writeFooter(0);
+            AssertRC(rc);
+            pStrm->Ebml.close();
             vpx_img_free(&pStrm->VpxRawImage);
             vpx_codec_err_t rcv = vpx_codec_destroy(&pStrm->VpxCodec);
             Assert(rcv == VPX_CODEC_OK);
             RTMemFree(pStrm->pu8RgbBuf);
             pStrm->pu8RgbBuf = NULL;
         }
+        /* Explicitly deinitilize Ebml object since it was created using placement new. */
+        pStrm->Ebml.~WebMWriter();
     }
 
     RTMemFree(pCtx);
@@ -630,6 +672,41 @@ bool VideoRecIsReady(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t u64TimeSt
 }
 
 /**
+ * VideoRec utility function to check if the file size has reached
+ * specified limits (if any).
+ *
+ * @returns true if any limit has been reached
+ * @param   pCtx Pointer to video recording context
+ * @param   uScreen screen id
+ * @param   u64TimeStamp current time stamp
+ */
+
+bool VideoRecIsFull(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t u64TimeStamp)
+{
+    PVIDEORECSTREAM pStrm = &pCtx->Strm[uScreen];
+    if(!pStrm->fEnabled)
+        return false;
+
+    if(pCtx->u64MaxTimeStamp > 0 && u64TimeStamp >= pCtx->u64MaxTimeStamp)
+        return true;
+
+    if (pCtx->uMaxFileSize > 0)
+    {
+        uint64_t sizeInMB = pStrm->Ebml.getFileSize() / (1024 * 1024);
+        if(sizeInMB >= pCtx->uMaxFileSize)
+            return true;
+    }
+    /* Check for available free disk space */
+    if (pStrm->Ebml.getAvailableSpace() < 0x100000)
+    {
+        LogRel(("Storage has not enough free space available, stopping video capture\n"));
+        return true;
+    }
+
+    return false;
+}
+
+/**
  * VideoRec utility function to encode the source image and write the encoded
  * image to target file.
  *
@@ -645,9 +722,9 @@ static int videoRecEncodeAndWrite(PVIDEORECSTREAM pStrm)
     vpx_codec_err_t rcv = vpx_codec_encode(&pStrm->VpxCodec,
                                            &pStrm->VpxRawImage,
                                            pts /* time stamp */,
-                                           10  /* how long to show this frame */,
+                                           pStrm->uDelay  /* how long to show this frame */,
                                            0   /* flags */,
-                                           VPX_DL_REALTIME /* deadline */);
+                                           pStrm->uEncoderDeadline /* quality setting */);
     if (rcv != VPX_CODEC_OK)
     {
         LogFlow(("Failed to encode:%s\n", vpx_codec_err_to_string(rcv)));
@@ -664,7 +741,7 @@ static int videoRecEncodeAndWrite(PVIDEORECSTREAM pStrm)
         switch (pkt->kind)
         {
             case VPX_CODEC_CX_FRAME_PKT:
-                rc = Ebml_WriteWebMBlock(&pStrm->Ebml, &pStrm->VpxConfig, pkt);
+                rc = pStrm->Ebml.writeBlock(&pStrm->VpxConfig, pkt);
                 break;
             default:
                 LogFlow(("Unexpected CODEC Packet.\n"));
@@ -822,7 +899,7 @@ int VideoRecCopyToIntBuf(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint32_t x, ui
 
         /* Calculate bytes per pixel */
         uint32_t bpp = 1;
-        if (uPixelFormat == FramebufferPixelFormat_FOURCC_RGB)
+        if (uPixelFormat == BitmapFormat_BGR)
         {
             switch (uBitsPerPixel)
             {
diff --git a/src/VBox/Main/src-client/VideoRec.h b/src/VBox/Main/src-client/VideoRec.h
index 7d0d6fa..02ed56a 100644
--- a/src/VBox/Main/src-client/VideoRec.h
+++ b/src/VBox/Main/src-client/VideoRec.h
@@ -26,7 +26,8 @@ typedef struct VIDEORECSTREAM *PVIDEORECSTREAM;
 
 int  VideoRecContextCreate(PVIDEORECCONTEXT *ppCtx, uint32_t cScreens);
 int  VideoRecStrmInit(PVIDEORECCONTEXT pCtx, uint32_t uScreen, const char *pszFile,
-                      uint32_t uWidth, uint32_t uHeight, uint32_t uRate, uint32_t uFps);
+                      uint32_t uWidth, uint32_t uHeight, uint32_t uRate, uint32_t uFps,
+                      uint32_t uMaxTime, uint32_t uMaxFileSize, const char *pszOptions);
 void VideoRecContextClose(PVIDEORECCONTEXT pCtx);
 bool VideoRecIsEnabled(PVIDEORECCONTEXT pCtx);
 int  VideoRecCopyToIntBuf(PVIDEORECCONTEXT pCtx, uint32_t uScreen,
@@ -34,6 +35,7 @@ int  VideoRecCopyToIntBuf(PVIDEORECCONTEXT pCtx, uint32_t uScreen,
                           uint32_t uBytesPerLine, uint32_t uGuestWidth, uint32_t uGuestHeight,
                           uint8_t *pu8BufferAddress, uint64_t u64TimeStamp);
 bool VideoRecIsReady(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t u64TimeStamp);
+bool VideoRecIsFull(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t u64TimeStamp);
 
 #endif /* !____H_VIDEOREC */
 
diff --git a/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp b/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
index 0e2405a..10b50a0 100644
--- a/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
+++ b/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -147,15 +147,10 @@ void VirtualBoxClient::uninit()
  * @returns COM status code
  * @param   aVirtualBox Address of result variable.
  */
-STDMETHODIMP VirtualBoxClient::COMGETTER(VirtualBox)(IVirtualBox **aVirtualBox)
+HRESULT VirtualBoxClient::getVirtualBox(ComPtr<IVirtualBox> &aVirtualBox)
 {
-    CheckComArgOutPointerValid(aVirtualBox);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    mData.m_pVirtualBox.queryInterfaceTo(aVirtualBox);
+    aVirtualBox = mData.m_pVirtualBox;
     return S_OK;
 }
 
@@ -165,20 +160,13 @@ STDMETHODIMP VirtualBoxClient::COMGETTER(VirtualBox)(IVirtualBox **aVirtualBox)
  * @returns COM status code
  * @param   aSession    Address of result variable.
  */
-STDMETHODIMP VirtualBoxClient::COMGETTER(Session)(ISession **aSession)
+HRESULT VirtualBoxClient::getSession(ComPtr<ISession> &aSession)
 {
-    HRESULT rc;
-    CheckComArgOutPointerValid(aSession);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is not stored in this object, no need to lock */
     ComPtr<ISession> pSession;
-    rc = pSession.createInprocObject(CLSID_Session);
+    HRESULT rc = pSession.createInprocObject(CLSID_Session);
     if (SUCCEEDED(rc))
-        pSession.queryInterfaceTo(aSession);
-
+        aSession = pSession;
     return rc;
 }
 
@@ -188,32 +176,26 @@ STDMETHODIMP VirtualBoxClient::COMGETTER(Session)(ISession **aSession)
  * @returns COM status code
  * @param   aEventSource    Address of result variable.
  */
-STDMETHODIMP VirtualBoxClient::COMGETTER(EventSource)(IEventSource **aEventSource)
+HRESULT VirtualBoxClient::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* this is const, no need to lock */
-    mData.m_pEventSource.queryInterfaceTo(aEventSource);
-
-    return mData.m_pEventSource.isNull() ? E_FAIL : S_OK;
+    aEventSource = mData.m_pEventSource;
+    return aEventSource.isNull() ? E_FAIL : S_OK;
 }
 
+// IVirtualBoxClient methods
+/////////////////////////////////////////////////////////////////////////////
+
 /**
  * Checks a Machine object for any pending errors.
  *
  * @returns COM status code
  * @param   aMachine    Machine object to check.
  */
-STDMETHODIMP VirtualBoxClient::CheckMachineError(IMachine *aMachine)
+HRESULT VirtualBoxClient::checkMachineError(const ComPtr<IMachine> &aMachine)
 {
-    HRESULT rc;
-    CheckComArgNotNull(aMachine);
-
     BOOL fAccessible = FALSE;
-    rc = aMachine->COMGETTER(Accessible)(&fAccessible);
+    HRESULT rc = aMachine->COMGETTER(Accessible)(&fAccessible);
     if (FAILED(rc))
         return setError(rc, tr("Could not check the accessibility status of the VM"));
     else if (!fAccessible)
@@ -281,8 +263,8 @@ DECLCALLBACK(int) VirtualBoxClient::SVCWatcherThread(RTTHREAD ThreadSelf,
                  * this fails use an increased waiting time as very frequent
                  * restart attempts in some wedged config can cause high CPU
                  * and disk load. */
-                ComPtr<IVirtualBox> pVBox;
-                rc = pVBox.createLocalObject(CLSID_VirtualBox);
+                ComPtr<IVirtualBox> pVirtualBox;
+                rc = pVirtualBox.createLocalObject(CLSID_VirtualBox);
                 if (FAILED(rc))
                     cMillies = 3 * VBOXCLIENT_DEFAULT_INTERVAL;
                 else
@@ -292,7 +274,7 @@ DECLCALLBACK(int) VirtualBoxClient::SVCWatcherThread(RTTHREAD ThreadSelf,
                         AutoWriteLock alock(pThis COMMA_LOCKVAL_SRC_POS);
                         /* Update the VirtualBox reference, there's a working
                          * VBoxSVC again from now on. */
-                        pThis->mData.m_pVirtualBox = pVBox;
+                        pThis->mData.m_pVirtualBox = pVirtualBox;
                     }
                     fireVBoxSVCAvailabilityChangedEvent(pThis->mData.m_pEventSource, TRUE);
                     cMillies = VBOXCLIENT_DEFAULT_INTERVAL;
diff --git a/src/VBox/Main/src-client/win/VBoxC.rc b/src/VBox/Main/src-client/win/VBoxC.rc
index a3593fd..e8dff9c 100644
--- a/src/VBox/Main/src-client/win/VBoxC.rc
+++ b/src/VBox/Main/src-client/win/VBoxC.rc
@@ -21,30 +21,27 @@
 #include "win/resource.h"
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
-  FILEFLAGS        VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
-#else
-  FILEFLAGS        0 // final version
-#endif
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      0   // not used
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
+  FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Interface\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxC\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxC.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
 
       VALUE "OLESelfRegister",  "\0"
     END
diff --git a/src/VBox/Main/src-client/win/VBoxClient-x86.rc b/src/VBox/Main/src-client/win/VBoxClient-x86.rc
index 262b1ea..2a0785e 100644
--- a/src/VBox/Main/src-client/win/VBoxClient-x86.rc
+++ b/src/VBox/Main/src-client/win/VBoxClient-x86.rc
@@ -21,30 +21,27 @@
 #include "win/resource.h"
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
-  FILEFLAGS        VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
-#else
-  FILEFLAGS        0 // final version
-#endif
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      0   // not used
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
+  FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Interface (32-bit)\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxClient-x86\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxClient-x86.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
 
       VALUE "OLESelfRegister",  "\0"
     END
diff --git a/src/VBox/Main/src-client/xpcom/module.cpp b/src/VBox/Main/src-client/xpcom/module.cpp
index f66603d..5f6ad5c 100644
--- a/src/VBox/Main/src-client/xpcom/module.cpp
+++ b/src/VBox/Main/src-client/xpcom/module.cpp
@@ -1,10 +1,11 @@
+/* $Id: module.cpp $ */
 /** @file
  *
  * XPCOM module implementation functions
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -28,92 +29,36 @@
 // generated file
 #include "VirtualBox_XPCOM.h"
 
-#include "AdditionsFacilityImpl.h"
-#include "ConsoleImpl.h"
-#include "ConsoleVRDPServer.h"
-#include "DisplayImpl.h"
-#ifdef VBOX_WITH_EXTPACK
-# include "ExtPackManagerImpl.h"
-#endif
-#include "GuestImpl.h"
-#ifdef VBOX_WITH_GUEST_CONTROL
-# include "GuestDirectoryImpl.h"
-# include "GuestFileImpl.h"
-# include "GuestFsObjInfoImpl.h"
-# include "GuestProcessImpl.h"
-# include "GuestSessionImpl.h"
-#endif
-#include "KeyboardImpl.h"
-#include "MachineDebuggerImpl.h"
-#include "MouseImpl.h"
-#include "NATEngineImpl.h"
-#include "NetworkAdapterImpl.h"
-#include "ProgressImpl.h"
-#include "RemoteUSBDeviceImpl.h"
 #include "SessionImpl.h"
-#include "SharedFolderImpl.h"
-#include "USBDeviceImpl.h"
 #include "VirtualBoxClientImpl.h"
+#include "RemoteUSBDeviceImpl.h"
+#include "USBDeviceImpl.h"
 
 #include "Logging.h"
 
 // XPCOM glue code unfolding
 
-NS_DECL_CLASSINFO(VirtualBoxClient)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient)
-NS_DECL_CLASSINFO(Session)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Session, ISession, IInternalSessionControl)
-
 #ifndef VBOX_COM_INPROC_API_CLIENT
-NS_DECL_CLASSINFO(Guest)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Guest, IGuest)
- #ifdef VBOX_WITH_GUEST_CONTROL
-NS_DECL_CLASSINFO(GuestDirectory)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestDirectory, IGuestDirectory, IDirectory)
-NS_DECL_CLASSINFO(GuestFile)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestFile, IGuestFile, IFile)
-NS_DECL_CLASSINFO(GuestFsObjInfo)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestFsObjInfo, IGuestFsObjInfo, IFsObjInfo)
-NS_DECL_CLASSINFO(GuestProcess)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(GuestProcess, IGuestProcess, IProcess)
-NS_DECL_CLASSINFO(GuestSession)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestSession, IGuestSession)
- #endif
-NS_DECL_CLASSINFO(Keyboard)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Keyboard, IKeyboard)
-NS_DECL_CLASSINFO(Mouse)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Mouse, IMouse)
-NS_DECL_CLASSINFO(Display)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Display, IDisplay, IEventListener)
-NS_DECL_CLASSINFO(MachineDebugger)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MachineDebugger, IMachineDebugger)
-NS_DECL_CLASSINFO(Progress)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Progress, IProgress)
-NS_DECL_CLASSINFO(OUSBDevice)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(OUSBDevice, IUSBDevice)
 NS_DECL_CLASSINFO(RemoteUSBDevice)
 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(RemoteUSBDevice, IHostUSBDevice, IUSBDevice)
-NS_DECL_CLASSINFO(SharedFolder)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
-NS_DECL_CLASSINFO(VRDEServerInfo)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo)
- #ifdef VBOX_WITH_EXTPACK
-// deliberately omit ExtPackFile as it's unusable in the client context
-// NS_DECL_CLASSINFO(ExtPackFile)
-// NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPackFile, IExtPackFile, IExtPackBase)
-NS_DECL_CLASSINFO(ExtPack)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPack, IExtPack, IExtPackBase)
-NS_DECL_CLASSINFO(ExtPackManager)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackManager, IExtPackManager)
- #endif
-NS_DECL_CLASSINFO(AdditionsFacility)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(AdditionsFacility, IAdditionsFacility)
-
-NS_DECL_CLASSINFO(Console)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole)
-
 #endif /* VBOX_COM_INPROC_API_CLIENT */
 
+/*
+ * Declare extern variables here to tell the compiler that
+ * NS_DECL_CLASSINFO(SessionWrap)
+ * already exists in the VBoxAPIWrap library.
+ */
+NS_DECL_CI_INTERFACE_GETTER(SessionWrap)
+extern nsIClassInfo *NS_CLASSINFO_NAME(SessionWrap);
+
+/*
+ * Declare extern variables here to tell the compiler that
+ * NS_DECL_CLASSINFO(VirtualBoxClientWrap)
+ * already exists in the VBoxAPIWrap library.
+ */
+NS_DECL_CI_INTERFACE_GETTER(VirtualBoxClientWrap)
+extern nsIClassInfo *NS_CLASSINFO_NAME(VirtualBoxClientWrap);
+
 /**
  *  Singleton class factory that holds a reference to the created instance
  *  (preventing it from being destroyed) until the module is explicitly
@@ -185,9 +130,9 @@ static const nsModuleComponentInfo components[] =
 /** @note this is for singleton; disabled for now */
 //        SessionClassFactory::releaseInstance,
         NULL, // destructor function
-        NS_CI_INTERFACE_GETTER_NAME(Session), // interfaces function
+        NS_CI_INTERFACE_GETTER_NAME(SessionWrap), // interfaces function
         NULL, // language helper
-        &NS_CLASSINFO_NAME(Session) // global class info & flags
+        &NS_CLASSINFO_NAME(SessionWrap) // global class info & flags
     },
     {
         "VirtualBoxClient component", // description
@@ -196,9 +141,9 @@ static const nsModuleComponentInfo components[] =
         NULL, // registration function
         NULL, // deregistration function
         NULL, // destructor function
-        NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClient), // interfaces function
+        NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClientWrap), // interfaces function
         NULL, // language helper
-        &NS_CLASSINFO_NAME(VirtualBoxClient) // global class info & flags
+        &NS_CLASSINFO_NAME(VirtualBoxClientWrap) // global class info & flags
     },
 };
 
diff --git a/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp b/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp
index 4118569..062dcba 100644
--- a/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp
+++ b/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp
@@ -294,7 +294,7 @@ static RTEXITCODE SetExtPackPermissions(const char *pszDir)
      if (RT_FAILURE(rc))
          return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to set directory permissions: %Rrc ('%s')", rc, pszDir);
 #else
-        /** @todo  */
+     /** @todo TrustedInstaller? */
 #endif
 
     return RTEXITCODE_SUCCESS;
diff --git a/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.rc b/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.rc
index dfaadcf..7e58e17 100644
--- a/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.rc
+++ b/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_APP
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_APP
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox ExtPack Helper\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxExtPackHelperApp\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxExtPackHelperApp.exe\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Main/src-server/ApplianceImpl.cpp b/src/VBox/Main/src-server/ApplianceImpl.cpp
index 8d1e601..93c4463 100644
--- a/src/VBox/Main/src-server/ApplianceImpl.cpp
+++ b/src/VBox/Main/src-server/ApplianceImpl.cpp
@@ -27,7 +27,6 @@
 #include "Global.h"
 #include "ProgressImpl.h"
 #include "MachineImpl.h"
-#include "MediumFormatImpl.h"
 #include "SystemPropertiesImpl.h"
 #include "AutoCaller.h"
 #include "Logging.h"
@@ -38,6 +37,49 @@ using namespace std;
 
 ////////////////////////////////////////////////////////////////////////////////
 //
+// Appliance constructor / destructor
+//
+// ////////////////////////////////////////////////////////////////////////////////
+
+DEFINE_EMPTY_CTOR_DTOR(VirtualSystemDescription)
+
+HRESULT VirtualSystemDescription::FinalConstruct()
+{
+    return BaseFinalConstruct();
+}
+
+void VirtualSystemDescription::FinalRelease()
+{
+    uninit();
+
+    BaseFinalRelease();
+}
+
+Appliance::Appliance()
+    : mVirtualBox(NULL)
+{
+}
+
+Appliance::~Appliance()
+{
+}
+
+
+HRESULT Appliance::FinalConstruct()
+{
+    return BaseFinalConstruct();
+}
+
+void Appliance::FinalRelease()
+{
+    uninit();
+
+    BaseFinalRelease();
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+//
 // Internal helpers
 //
 ////////////////////////////////////////////////////////////////////////////////
@@ -97,7 +139,7 @@ g_osTypes[] =
     { ovf::CIMOSType_CIMOS_MicrosoftWindowsServer2008_64,        VBOXOSTYPE_Win2k8_x64 },
     { ovf::CIMOSType_CIMOS_FreeBSD_64,                           VBOXOSTYPE_FreeBSD_x64 },
     { ovf::CIMOSType_CIMOS_MACOS,                                VBOXOSTYPE_MacOS },
-    { ovf::CIMOSType_CIMOS_MACOS,                                VBOXOSTYPE_MacOS_x64 },            // there is no CIM 64-bit type for this
+    { ovf::CIMOSType_CIMOS_MACOS,                                VBOXOSTYPE_MacOS_x64 }, // there is no CIM 64-bit type for this
     { ovf::CIMOSType_CIMOS_MACOS,                                VBOXOSTYPE_MacOS106 },
     { ovf::CIMOSType_CIMOS_MACOS,                                VBOXOSTYPE_MacOS106_x64 },
     { ovf::CIMOSType_CIMOS_MACOS,                                VBOXOSTYPE_MacOS107_x64 },
@@ -146,7 +188,8 @@ g_osTypes[] =
     { ovf::CIMOSType_CIMOS_WindowsServer2008R2,                  VBOXOSTYPE_Win2k8 },           // duplicate, see above
 //     { ovf::CIMOSType_CIMOS_VMwareESXi = 104,                                                 // we can't run ESX in a VM
     { ovf::CIMOSType_CIMOS_Windows7,                             VBOXOSTYPE_Win7 },
-    { ovf::CIMOSType_CIMOS_Windows7,                             VBOXOSTYPE_Win7_x64 },         // there is no CIM 64-bit type for this
+    { ovf::CIMOSType_CIMOS_Windows7,                             VBOXOSTYPE_Win7_x64 },         // there is no
+                                                                                                // CIM 64-bit type for this
     { ovf::CIMOSType_CIMOS_CentOS,                               VBOXOSTYPE_RedHat },
     { ovf::CIMOSType_CIMOS_CentOS_64,                            VBOXOSTYPE_RedHat_x64 },
     { ovf::CIMOSType_CIMOS_OracleEnterpriseLinux,                VBOXOSTYPE_Oracle },
@@ -329,7 +372,7 @@ Utf8Str convertNetworkAttachmentTypeToString(NetworkAttachmentType_T type)
  * @param anAppliance IAppliance object created if S_OK is returned.
  * @return S_OK or error.
  */
-STDMETHODIMP VirtualBox::CreateAppliance(IAppliance** anAppliance)
+HRESULT VirtualBox::createAppliance(ComPtr<IAppliance> &aAppliance)
 {
     HRESULT rc;
 
@@ -338,26 +381,11 @@ STDMETHODIMP VirtualBox::CreateAppliance(IAppliance** anAppliance)
     rc = appliance->init(this);
 
     if (SUCCEEDED(rc))
-        appliance.queryInterfaceTo(anAppliance);
+        appliance.queryInterfaceTo(aAppliance.asOutParam());
 
     return rc;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-//
-// Appliance constructor / destructor
-//
-////////////////////////////////////////////////////////////////////////////////
-
-Appliance::Appliance()
-    : mVirtualBox(NULL)
-{
-}
-
-Appliance::~Appliance()
-{
-}
-
 /**
  * Appliance COM initializer.
  * @param
@@ -375,10 +403,12 @@ HRESULT Appliance::init(VirtualBox *aVirtualBox)
 
     // initialize data
     m = new Data;
+    m->m_pSecretKeyStore = new SecretKeyStore(false /* fRequireNonPageable*/);
+    AssertReturn(m->m_pSecretKeyStore, E_FAIL);
 
-    initApplianceIONameMap();
+    i_initApplianceIONameMap();
 
-    rc = initSetOfSupportedStandardsURI();
+    rc = i_initSetOfSupportedStandardsURI();
 
     /* Confirm a successful initialization */
     autoInitSpan.setSucceeded();
@@ -397,6 +427,9 @@ void Appliance::uninit()
     if (autoUninitSpan.uninitDone())
         return;
 
+    if (m->m_pSecretKeyStore)
+        delete m->m_pSecretKeyStore;
+
     delete m;
     m = NULL;
 }
@@ -412,21 +445,14 @@ void Appliance::uninit()
  * @param
  * @return
  */
-STDMETHODIMP Appliance::COMGETTER(Path)(BSTR *aPath)
+HRESULT Appliance::getPath(com::Utf8Str &aPath)
 {
-    if (!aPath)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (!isApplianceIdle())
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
 
-    Bstr bstrPath(m->locInfo.strPath);
-    bstrPath.cloneTo(aPath);
+    aPath = m->locInfo.strPath;
 
     return S_OK;
 }
@@ -436,22 +462,17 @@ STDMETHODIMP Appliance::COMGETTER(Path)(BSTR *aPath)
  * @param
  * @return
  */
-STDMETHODIMP Appliance::COMGETTER(Disks)(ComSafeArrayOut(BSTR, aDisks))
+HRESULT Appliance::getDisks(std::vector<com::Utf8Str> &aDisks)
 {
-    CheckComArgOutSafeArrayPointerValid(aDisks);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (!isApplianceIdle())
+    aDisks.resize(0);
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
 
     if (m->pReader) // OVFReader instantiated?
     {
-        size_t c = m->pReader->m_mapDisks.size();
-        com::SafeArray<BSTR> sfaDisks(c);
+        aDisks.resize(m->pReader->m_mapDisks.size());
 
         ovf::DiskImagesMap::const_iterator it;
         size_t i = 0;
@@ -480,13 +501,9 @@ STDMETHODIMP Appliance::COMGETTER(Disks)(ComSafeArrayOut(BSTR, aDisks))
                          d.iChunkSize,
                          d.strCompression.c_str());
             Utf8Str utf(psz);
-            Bstr bstr(utf);
-            // push to safearray
-            bstr.cloneTo(&sfaDisks[i]);
+            aDisks[i] = utf;
             RTStrFree(psz);
         }
-
-        sfaDisks.detachTo(ComSafeArrayOutArg(aDisks));
     }
 
     return S_OK;
@@ -497,21 +514,20 @@ STDMETHODIMP Appliance::COMGETTER(Disks)(ComSafeArrayOut(BSTR, aDisks))
  * @param
  * @return
  */
-STDMETHODIMP Appliance::COMGETTER(VirtualSystemDescriptions)(ComSafeArrayOut(IVirtualSystemDescription*, aVirtualSystemDescriptions))
+HRESULT Appliance::getVirtualSystemDescriptions(std::vector<ComPtr<IVirtualSystemDescription> > &aVirtualSystemDescriptions)
 {
-    CheckComArgOutSafeArrayPointerValid(aVirtualSystemDescriptions);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (!isApplianceIdle())
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
 
-    SafeIfaceArray<IVirtualSystemDescription> sfaVSD(m->virtualSystemDescriptions);
-    sfaVSD.detachTo(ComSafeArrayOutArg(aVirtualSystemDescriptions));
-
+    aVirtualSystemDescriptions.resize(m->virtualSystemDescriptions.size());
+    std::list< ComObjPtr<VirtualSystemDescription> > vsds(m->virtualSystemDescriptions);
+    size_t i = 0;
+    for (std::list< ComObjPtr<VirtualSystemDescription> >::iterator it = vsds.begin(); it != vsds.end(); ++it, ++i)
+    {
+         (*it).queryInterfaceTo(aVirtualSystemDescriptions[i].asOutParam());
+    }
     return S_OK;
 }
 
@@ -520,42 +536,27 @@ STDMETHODIMP Appliance::COMGETTER(VirtualSystemDescriptions)(ComSafeArrayOut(IVi
  * @param aDisks
  * @return
  */
-STDMETHODIMP Appliance::COMGETTER(Machines)(ComSafeArrayOut(BSTR, aMachines))
+HRESULT Appliance::getMachines(std::vector<com::Utf8Str> &aMachines)
 {
-    CheckComArgOutSafeArrayPointerValid(aMachines);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (!isApplianceIdle())
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
 
-    com::SafeArray<BSTR> sfaMachines(m->llGuidsMachinesCreated.size());
-    size_t u = 0;
+    aMachines.resize(m->llGuidsMachinesCreated.size());
+    size_t i = 0;
     for (std::list<Guid>::const_iterator it = m->llGuidsMachinesCreated.begin();
          it != m->llGuidsMachinesCreated.end();
-         ++it)
+         ++it, ++i)
     {
         const Guid &uuid = *it;
-        Bstr bstr(uuid.toUtf16());
-        bstr.detachTo(&sfaMachines[u]);
-        ++u;
+        aMachines[i] = uuid.toUtf16();
     }
-
-    sfaMachines.detachTo(ComSafeArrayOutArg(aMachines));
-
     return S_OK;
 }
 
-STDMETHODIMP Appliance::CreateVFSExplorer(IN_BSTR aURI, IVFSExplorer **aExplorer)
+HRESULT Appliance::createVFSExplorer(const com::Utf8Str &aURI, ComPtr<IVFSExplorer> &aExplorer)
 {
-    CheckComArgOutPointerValid(aExplorer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<VFSExplorer> explorer;
@@ -565,7 +566,7 @@ STDMETHODIMP Appliance::CreateVFSExplorer(IN_BSTR aURI, IVFSExplorer **aExplorer
         Utf8Str uri(aURI);
         /* Check which kind of export the user has requested */
         LocationInfo li;
-        parseURI(uri, li);
+        i_parseURI(aURI, li);
         /* Create the explorer object */
         explorer.createObject();
         rc = explorer->init(li.storageType, li.strPath, li.strHostname, li.strUsername, li.strPassword, mVirtualBox);
@@ -577,7 +578,7 @@ STDMETHODIMP Appliance::CreateVFSExplorer(IN_BSTR aURI, IVFSExplorer **aExplorer
 
     if (SUCCEEDED(rc))
         /* Return explorer to the caller */
-        explorer.queryInterfaceTo(aExplorer);
+        explorer.queryInterfaceTo(aExplorer.asOutParam());
 
     return rc;
 }
@@ -586,17 +587,11 @@ STDMETHODIMP Appliance::CreateVFSExplorer(IN_BSTR aURI, IVFSExplorer **aExplorer
 * Public method implementation.
  * @return
  */
-STDMETHODIMP Appliance::GetWarnings(ComSafeArrayOut(BSTR, aWarnings))
+HRESULT Appliance::getWarnings(std::vector<com::Utf8Str> &aWarnings)
 {
-    if (ComSafeArrayOutIsNull(aWarnings))
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<BSTR> sfaWarnings(m->llWarnings.size());
+    aWarnings.resize(m->llWarnings.size());
 
     list<Utf8Str>::const_iterator it;
     size_t i = 0;
@@ -604,31 +599,88 @@ STDMETHODIMP Appliance::GetWarnings(ComSafeArrayOut(BSTR, aWarnings))
          it != m->llWarnings.end();
          ++it, ++i)
     {
-        Bstr bstr = *it;
-        bstr.cloneTo(&sfaWarnings[i]);
+        aWarnings[i] = *it;
     }
 
-    sfaWarnings.detachTo(ComSafeArrayOutArg(aWarnings));
+    return S_OK;
+}
+
+HRESULT Appliance::getPasswordIds(std::vector<com::Utf8Str> &aIdentifiers)
+{
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
+    aIdentifiers = m->m_vecPasswordIdentifiers;
     return S_OK;
 }
 
+HRESULT Appliance::getMediumIdsForPasswordId(const com::Utf8Str &aPasswordId, std::vector<com::Guid> &aIdentifiers)
+{
+    HRESULT hrc = S_OK;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    std::map<com::Utf8Str, GUIDVEC>::const_iterator it = m->m_mapPwIdToMediumIds.find(aPasswordId);
+    if (it != m->m_mapPwIdToMediumIds.end())
+        aIdentifiers = it->second;
+    else
+        hrc = setError(E_FAIL, tr("The given password identifier is not associated with any medium"));
+
+    return hrc;
+}
+
+HRESULT Appliance::addPasswords(const std::vector<com::Utf8Str> &aIdentifiers,
+                                const std::vector<com::Utf8Str> &aPasswords)
+{
+    HRESULT hrc = S_OK;
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    /* Check that the IDs do not exist already before changing anything. */
+    for (unsigned i = 0; i < aIdentifiers.size(); i++)
+    {
+        SecretKey *pKey = NULL;
+        int rc = m->m_pSecretKeyStore->retainSecretKey(aIdentifiers[i], &pKey);
+        if (rc != VERR_NOT_FOUND)
+        {
+            AssertPtr(pKey);
+            if (pKey)
+                pKey->release();
+            return setError(VBOX_E_OBJECT_IN_USE, tr("A password with the given ID already exists"));
+        }
+    }
+
+    for (unsigned i = 0; i < aIdentifiers.size() && SUCCEEDED(hrc); i++)
+    {
+        size_t cbKey = aPasswords[i].length() + 1; /* Include terminator */
+        const uint8_t *pbKey = (const uint8_t *)aPasswords[i].c_str();
+
+        int rc = m->m_pSecretKeyStore->addSecretKey(aIdentifiers[i], pbKey, cbKey);
+        if (RT_SUCCESS(rc))
+            m->m_cPwProvided++;
+        else if (rc == VERR_NO_MEMORY)
+            hrc = setError(E_OUTOFMEMORY, tr("Failed to allocate enough secure memory for the key"));
+        else
+            hrc = setError(E_FAIL, tr("Unknown error happened while adding a password (%Rrc)"), rc);
+    }
+
+    return hrc;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // Appliance private methods
 //
 ////////////////////////////////////////////////////////////////////////////////
-
-HRESULT Appliance::initSetOfSupportedStandardsURI()
+//
+HRESULT Appliance::i_initSetOfSupportedStandardsURI()
 {
     HRESULT rc = S_OK;
     if (!supportedStandardsURI.empty())
         return rc;
 
     /* Get the system properties. */
-    SystemProperties *pSysProps = mVirtualBox->getSystemProperties();
+    SystemProperties *pSysProps = mVirtualBox->i_getSystemProperties();
     {
-        ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension("iso");
+        ComObjPtr<MediumFormat> trgFormat = pSysProps->i_mediumFormatFromExtension("iso");
         if (trgFormat.isNull())
             return setError(E_FAIL, tr("Can't find appropriate medium format for ISO type of a virtual disk."));
 
@@ -642,7 +694,7 @@ HRESULT Appliance::initSetOfSupportedStandardsURI()
     }
 
     {
-        ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension("vmdk");
+        ComObjPtr<MediumFormat> trgFormat = pSysProps->i_mediumFormatFromExtension("vmdk");
         if (trgFormat.isNull())
             return setError(E_FAIL, tr("Can't find appropriate medium format for VMDK type of a virtual disk."));
 
@@ -659,7 +711,7 @@ HRESULT Appliance::initSetOfSupportedStandardsURI()
     }
 
     {
-        ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension("vhd");
+        ComObjPtr<MediumFormat> trgFormat = pSysProps->i_mediumFormatFromExtension("vhd");
         if (trgFormat.isNull())
             return setError(E_FAIL, tr("Can't find appropriate medium format for VHD type of a virtual disk."));
 
@@ -675,7 +727,7 @@ HRESULT Appliance::initSetOfSupportedStandardsURI()
     return rc;
 }
 
-Utf8Str Appliance::typeOfVirtualDiskFormatFromURI(Utf8Str uri) const
+Utf8Str Appliance::i_typeOfVirtualDiskFormatFromURI(Utf8Str uri) const
 {
     Utf8Str type;
     std::map<Utf8Str, Utf8Str>::const_iterator cit = supportedStandardsURI.find(uri);
@@ -687,7 +739,7 @@ Utf8Str Appliance::typeOfVirtualDiskFormatFromURI(Utf8Str uri) const
     return type;
 }
 
-std::set<Utf8Str> Appliance::URIFromTypeOfVirtualDiskFormat(Utf8Str type)
+std::set<Utf8Str> Appliance::i_URIFromTypeOfVirtualDiskFormat(Utf8Str type)
 {
     std::set<Utf8Str> uri;
     std::map<Utf8Str, Utf8Str>::const_iterator cit = supportedStandardsURI.begin();
@@ -701,7 +753,7 @@ std::set<Utf8Str> Appliance::URIFromTypeOfVirtualDiskFormat(Utf8Str type)
     return uri;
 }
 
-HRESULT Appliance::initApplianceIONameMap()
+HRESULT Appliance::i_initApplianceIONameMap()
 {
     HRESULT rc = S_OK;
     if (!applianceIONameMap.empty())
@@ -714,7 +766,7 @@ HRESULT Appliance::initApplianceIONameMap()
     return rc;
 }
 
-Utf8Str Appliance::applianceIOName(APPLIANCEIONAME type) const
+Utf8Str Appliance::i_applianceIOName(APPLIANCEIONAME type) const
 {
     Utf8Str name;
     std::map<APPLIANCEIONAME, Utf8Str>::const_iterator cit = applianceIONameMap.find(type);
@@ -726,6 +778,79 @@ Utf8Str Appliance::applianceIOName(APPLIANCEIONAME type) const
     return name;
 }
 
+
+/**
+ * Returns a medium format object corresponding to the given
+ * disk image or null if no such format.
+ *
+ * @param di   Disk Image
+ * @param mf   Medium Format
+ *
+ * @return ComObjPtr<MediumFormat>
+ */
+
+HRESULT Appliance::i_findMediumFormatFromDiskImage(const ovf::DiskImage &di, ComObjPtr<MediumFormat>& mf)
+{
+    HRESULT rc = S_OK;
+
+    /* Get the system properties. */
+    SystemProperties *pSysProps = mVirtualBox->i_getSystemProperties();
+
+    /* We need a proper source format description */
+    /* Which format to use? */
+    Utf8Str strSrcFormat = i_typeOfVirtualDiskFormatFromURI(di.strFormat);
+
+    /*
+     * fallback, if we can't determine virtual disk format using URI from the attribute ovf:format
+     * in the corresponding section <Disk> in the OVF file.
+     */
+    if (strSrcFormat.isEmpty())
+    {
+        strSrcFormat = di.strHref;
+
+        /* check either file gzipped or not
+         * if "yes" then remove last extension,
+         * i.e. "image.vmdk.gz"->"image.vmdk"
+         */
+        if (di.strCompression == "gzip")
+        {
+            if (RTPathHasSuffix(strSrcFormat.c_str()))
+            {
+                strSrcFormat.stripSuffix();
+            }
+            else
+            {
+                mf.setNull();
+                rc = setError(E_FAIL,
+                              tr("Internal inconsistency looking up medium format for the disk image '%s'"),
+                              di.strHref.c_str());
+                return rc;
+            }
+        }
+        /* Figure out from extension which format the image of disk has. */
+        if (RTPathHasSuffix(strSrcFormat.c_str()))
+        {
+            const char *pszExt = RTPathSuffix(strSrcFormat.c_str());
+            if (pszExt)
+                pszExt++;
+            mf = pSysProps->i_mediumFormatFromExtension(pszExt);
+        }
+        else
+            mf.setNull();
+    }
+    else
+        mf = pSysProps->i_mediumFormat(strSrcFormat);
+
+    if (mf.isNull())
+    {
+        rc = setError(E_FAIL,
+               tr("Internal inconsistency looking up medium format for the disk image '%s'"),
+               di.strHref.c_str());
+    }
+
+    return rc;
+}
+
 /**
  * Returns true if the appliance is in "idle" state. This should always be the
  * case unless an import or export is currently in progress. Similar to machine
@@ -740,7 +865,7 @@ Utf8Str Appliance::applianceIOName(APPLIANCEIONAME type) const
  *
  * @return
  */
-bool Appliance::isApplianceIdle()
+bool Appliance::i_isApplianceIdle()
 {
     if (m->state == Data::ApplianceImporting)
         setError(VBOX_E_INVALID_OBJECT_STATE, tr("The appliance is busy importing files"));
@@ -752,7 +877,7 @@ bool Appliance::isApplianceIdle()
     return false;
 }
 
-HRESULT Appliance::searchUniqueVMName(Utf8Str& aName) const
+HRESULT Appliance::i_searchUniqueVMName(Utf8Str& aName) const
 {
     IMachine *machine = NULL;
     char *tmpName = RTStrDup(aName.c_str());
@@ -770,7 +895,7 @@ HRESULT Appliance::searchUniqueVMName(Utf8Str& aName) const
     return S_OK;
 }
 
-HRESULT Appliance::searchUniqueDiskImageFilePath(Utf8Str& aName) const
+HRESULT Appliance::i_searchUniqueDiskImageFilePath(Utf8Str& aName) const
 {
     IMedium *harddisk = NULL;
     char *tmpName = RTStrDup(aName.c_str());
@@ -779,16 +904,16 @@ HRESULT Appliance::searchUniqueDiskImageFilePath(Utf8Str& aName) const
      * already */
     /** @todo: Maybe too cost-intensive; try to find a lighter way */
     while (    RTPathExists(tmpName)
-            || mVirtualBox->OpenMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, AccessMode_ReadWrite, FALSE /* fForceNewUuid */,  &harddisk) != VBOX_E_OBJECT_NOT_FOUND
-          )
+            || mVirtualBox->OpenMedium(Bstr(tmpName).raw(), DeviceType_HardDisk, AccessMode_ReadWrite,
+                                       FALSE /* fForceNewUuid */,  &harddisk) != VBOX_E_OBJECT_NOT_FOUND)
     {
         RTStrFree(tmpName);
         char *tmpDir = RTStrDup(aName.c_str());
         RTPathStripFilename(tmpDir);;
         char *tmpFile = RTStrDup(RTPathFilename(aName.c_str()));
-        RTPathStripExt(tmpFile);
-        const char *tmpExt = RTPathExt(aName.c_str());
-        RTStrAPrintf(&tmpName, "%s%c%s_%d%s", tmpDir, RTPATH_DELIMITER, tmpFile, i, tmpExt);
+        RTPathStripSuffix(tmpFile);
+        const char *pszTmpSuff = RTPathSuffix(aName.c_str());
+        RTStrAPrintf(&tmpName, "%s%c%s_%d%s", tmpDir, RTPATH_DELIMITER, tmpFile, i, pszTmpSuff);
         RTStrFree(tmpFile);
         RTStrFree(tmpDir);
         ++i;
@@ -808,9 +933,9 @@ HRESULT Appliance::searchUniqueDiskImageFilePath(Utf8Str& aName) const
  * @param mode
  * @return
  */
-HRESULT Appliance::setUpProgress(ComObjPtr<Progress> &pProgress,
-                                 const Bstr &bstrDescription,
-                                 SetUpProgressMode mode)
+HRESULT Appliance::i_setUpProgress(ComObjPtr<Progress> &pProgress,
+                                   const Bstr &bstrDescription,
+                                   SetUpProgressMode mode)
 {
     HRESULT rc;
 
@@ -818,7 +943,7 @@ HRESULT Appliance::setUpProgress(ComObjPtr<Progress> &pProgress,
     pProgress.createObject();
 
     // compute the disks weight (this sets ulTotalDisksMB and cDisks in the instance data)
-    disksWeight();
+    i_disksWeight();
 
     m->ulWeightForManifestOperation = 0;
 
@@ -852,7 +977,8 @@ HRESULT Appliance::setUpProgress(ComObjPtr<Progress> &pProgress,
             {
                 ++cOperations;          // another one for creating the manifest
 
-                m->ulWeightForManifestOperation = (ULONG)((double)m->ulTotalDisksMB * .1 / 100);    // use .5% of the progress for the manifest
+                m->ulWeightForManifestOperation = (ULONG)((double)m->ulTotalDisksMB * .1 / 100);    // use .5% of the
+                                                                                                    // progress for the manifest
                 ulTotalOperationsWeight += m->ulWeightForManifestOperation;
             }
             break;
@@ -880,7 +1006,10 @@ HRESULT Appliance::setUpProgress(ComObjPtr<Progress> &pProgress,
 
             if (m->ulTotalDisksMB)
             {
-                m->ulWeightForXmlOperation = (ULONG)((double)m->ulTotalDisksMB * 1  / 100);    // use 1% of the progress for OVF file upload (we didn't know the size at this point)
+                m->ulWeightForXmlOperation = (ULONG)((double)m->ulTotalDisksMB * 1  / 100);    // use 1% of the progress
+                                                                                               // for OVF file upload
+                                                                                               // (we didn't know the
+                                                                                               // size at this point)
                 ulTotalOperationsWeight = m->ulTotalDisksMB + m->ulWeightForXmlOperation;
             }
             else
@@ -889,12 +1018,13 @@ HRESULT Appliance::setUpProgress(ComObjPtr<Progress> &pProgress,
                 ulTotalOperationsWeight = 1;
                 m->ulWeightForXmlOperation = 1;
             }
-            ULONG ulOVFCreationWeight = (ULONG)((double)ulTotalOperationsWeight * 50.0 / 100.0); /* Use 50% for the creation of the OVF & the disks */
+            ULONG ulOVFCreationWeight = (ULONG)((double)ulTotalOperationsWeight * 50.0 / 100.0); /* Use 50% for the
+                                                                                                    creation of the OVF
+                                                                                                    & the disks */
             ulTotalOperationsWeight += ulOVFCreationWeight;
             break;
         }
     }
-
     Log(("Setting up progress object: ulTotalMB = %d, cDisks = %d, => cOperations = %d, ulTotalOperationsWeight = %d, m->ulWeightForXmlOperation = %d\n",
          m->ulTotalDisksMB, m->cDisks, cOperations, ulTotalOperationsWeight, m->ulWeightForXmlOperation));
 
@@ -916,8 +1046,8 @@ HRESULT Appliance::setUpProgress(ComObjPtr<Progress> &pProgress,
  * @param pProgressThis Progress object of the current thread.
  * @param pProgressAsync Progress object of asynchronous task running in background.
  */
-void Appliance::waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis,
-                                     ComPtr<IProgress> &pProgressAsync)
+void Appliance::i_waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis,
+                                       ComPtr<IProgress> &pProgressAsync)
 {
     HRESULT rc;
 
@@ -984,7 +1114,7 @@ void Appliance::waitForAsyncProgress(ComObjPtr<Progress> &pProgressThis,
     }
 }
 
-void Appliance::addWarning(const char* aWarning, ...)
+void Appliance::i_addWarning(const char* aWarning, ...)
 {
     va_list args;
     va_start(args, aWarning);
@@ -997,7 +1127,7 @@ void Appliance::addWarning(const char* aWarning, ...)
  * Refreshes the cDisks and ulTotalDisksMB members in the instance data.
  * Requires that virtual system descriptions are present.
  */
-void Appliance::disksWeight()
+void Appliance::i_disksWeight()
 {
     m->ulTotalDisksMB = 0;
     m->cDisks = 0;
@@ -1009,7 +1139,7 @@ void Appliance::disksWeight()
     {
         ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
         /* One for every hard disk of the Virtual System */
-        std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
+        std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
         std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
         for (itH = avsdeHDs.begin();
              itH != avsdeHDs.end();
@@ -1020,7 +1150,7 @@ void Appliance::disksWeight()
             ++m->cDisks;
         }
 
-        avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_CDROM);
+        avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_CDROM);
         for (itH = avsdeHDs.begin();
              itH != avsdeHDs.end();
              ++itH)
@@ -1033,7 +1163,7 @@ void Appliance::disksWeight()
 
 }
 
-void Appliance::parseBucket(Utf8Str &aPath, Utf8Str &aBucket)
+void Appliance::i_parseBucket(Utf8Str &aPath, Utf8Str &aBucket)
 {
     /* Buckets are S3 specific. So parse the bucket out of the file path */
     if (!aPath.startsWith("/"))
@@ -1052,20 +1182,27 @@ void Appliance::parseBucket(Utf8Str &aPath, Utf8Str &aBucket)
 }
 
 /**
+ * Starts the worker thread for the task.
  *
- * @return
+ * @return COM status code.
  */
-int Appliance::TaskOVF::startThread()
+HRESULT Appliance::TaskOVF::startThread()
 {
-    int vrc = RTThreadCreate(NULL, Appliance::taskThreadImportOrExport, this,
-                             0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0,
-                             "Appliance::Task");
-
-    if (RT_FAILURE(vrc))
-        return Appliance::setErrorStatic(E_FAIL,
-                                         Utf8StrFmt("Could not create OVF task thread (%Rrc)\n", vrc));
+    /* Pick a thread name suitable for logging (<= 8 chars). */
+    const char *pszTaskNm;
+    switch (taskType)
+    {
+        case TaskOVF::Read:     pszTaskNm = "ApplRead"; break;
+        case TaskOVF::Import:   pszTaskNm = "ApplImp"; break;
+        case TaskOVF::Write:    pszTaskNm = "ApplWrit"; break;
+        default:                pszTaskNm = "ApplTask"; break;
+    }
 
-    return S_OK;
+    int vrc = RTThreadCreate(NULL, Appliance::i_taskThreadImportOrExport, this,
+                             0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0, pszTaskNm);
+    if (RT_SUCCESS(vrc))
+        return S_OK;
+    return Appliance::i_setErrorStatic(E_FAIL, Utf8StrFmt("Could not create OVF task thread (%Rrc)\n", vrc));
 }
 
 /**
@@ -1078,7 +1215,7 @@ int Appliance::TaskOVF::startThread()
  * @param pvUser
  */
 /* static */
-DECLCALLBACK(int) Appliance::taskThreadImportOrExport(RTTHREAD /* aThread */, void *pvUser)
+DECLCALLBACK(int) Appliance::i_taskThreadImportOrExport(RTTHREAD /* aThread */, void *pvUser)
 {
     std::auto_ptr<TaskOVF> task(static_cast<TaskOVF*>(pvUser));
     AssertReturn(task.get(), VERR_GENERAL_FAILURE);
@@ -1086,7 +1223,7 @@ DECLCALLBACK(int) Appliance::taskThreadImportOrExport(RTTHREAD /* aThread */, vo
     Appliance *pAppliance = task->pAppliance;
 
     LogFlowFuncEnter();
-    LogFlowFunc(("Appliance %p\n", pAppliance));
+    LogFlowFunc(("Appliance %p taskType=%d\n", pAppliance, task->taskType));
 
     HRESULT taskrc = S_OK;
 
@@ -1094,10 +1231,10 @@ DECLCALLBACK(int) Appliance::taskThreadImportOrExport(RTTHREAD /* aThread */, vo
     {
         case TaskOVF::Read:
             if (task->locInfo.storageType == VFSType_File)
-                taskrc = pAppliance->readFS(task.get());
+                taskrc = pAppliance->i_readFS(task.get());
             else if (task->locInfo.storageType == VFSType_S3)
 #ifdef VBOX_WITH_S3
-                taskrc = pAppliance->readS3(task.get());
+                taskrc = pAppliance->i_readS3(task.get());
 #else
                 taskrc = VERR_NOT_IMPLEMENTED;
 #endif
@@ -1105,10 +1242,10 @@ DECLCALLBACK(int) Appliance::taskThreadImportOrExport(RTTHREAD /* aThread */, vo
 
         case TaskOVF::Import:
             if (task->locInfo.storageType == VFSType_File)
-                taskrc = pAppliance->importFS(task.get());
+                taskrc = pAppliance->i_importFS(task.get());
             else if (task->locInfo.storageType == VFSType_S3)
 #ifdef VBOX_WITH_S3
-                taskrc = pAppliance->importS3(task.get());
+                taskrc = pAppliance->i_importS3(task.get());
 #else
                 taskrc = VERR_NOT_IMPLEMENTED;
 #endif
@@ -1116,10 +1253,10 @@ DECLCALLBACK(int) Appliance::taskThreadImportOrExport(RTTHREAD /* aThread */, vo
 
         case TaskOVF::Write:
             if (task->locInfo.storageType == VFSType_File)
-                taskrc = pAppliance->writeFS(task.get());
+                taskrc = pAppliance->i_writeFS(task.get());
             else if (task->locInfo.storageType == VFSType_S3)
 #ifdef VBOX_WITH_S3
-                taskrc = pAppliance->writeS3(task.get());
+                taskrc = pAppliance->i_writeS3(task.get());
 #else
                 taskrc = VERR_NOT_IMPLEMENTED;
 #endif
@@ -1129,7 +1266,7 @@ DECLCALLBACK(int) Appliance::taskThreadImportOrExport(RTTHREAD /* aThread */, vo
     task->rc = taskrc;
 
     if (!task->pProgress.isNull())
-        task->pProgress->notifyComplete(taskrc);
+        task->pProgress->i_notifyComplete(taskrc);
 
     LogFlowFuncLeave();
 
@@ -1153,7 +1290,7 @@ int Appliance::TaskOVF::updateProgress(unsigned uPercent, void *pvUser)
     return VINF_SUCCESS;
 }
 
-void parseURI(Utf8Str strUri, LocationInfo &locInfo)
+void i_parseURI(Utf8Str strUri, LocationInfo &locInfo)
 {
     /* Check the URI for the protocol */
     if (strUri.startsWith("file://", Utf8Str::CaseInsensitive)) /* File based */
@@ -1206,7 +1343,6 @@ void parseURI(Utf8Str strUri, LocationInfo &locInfo)
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-DEFINE_EMPTY_CTOR_DTOR(VirtualSystemDescription)
 
 /**
  * COM initializer.
@@ -1250,18 +1386,14 @@ void VirtualSystemDescription::uninit()
  * @param
  * @return
  */
-STDMETHODIMP VirtualSystemDescription::COMGETTER(Count)(ULONG *aCount)
+HRESULT VirtualSystemDescription::getCount(ULONG *aCount)
 {
     if (!aCount)
         return E_POINTER;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aCount = (ULONG)m->llDescriptions.size();
-
+    *aCount = (ULONG)m->maDescriptions.size();
     return S_OK;
 }
 
@@ -1269,60 +1401,30 @@ STDMETHODIMP VirtualSystemDescription::COMGETTER(Count)(ULONG *aCount)
  * Public method implementation.
  * @return
  */
-STDMETHODIMP VirtualSystemDescription::GetDescription(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
-                                                      ComSafeArrayOut(BSTR, aRefs),
-                                                      ComSafeArrayOut(BSTR, aOrigValues),
-                                                      ComSafeArrayOut(BSTR, aVBoxValues),
-                                                      ComSafeArrayOut(BSTR, aExtraConfigValues))
-{
-    if (ComSafeArrayOutIsNull(aTypes) ||
-        ComSafeArrayOutIsNull(aRefs) ||
-        ComSafeArrayOutIsNull(aOrigValues) ||
-        ComSafeArrayOutIsNull(aVBoxValues) ||
-        ComSafeArrayOutIsNull(aExtraConfigValues))
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT VirtualSystemDescription::getDescription(std::vector<VirtualSystemDescriptionType_T> &aTypes,
+                                                 std::vector<com::Utf8Str> &aRefs,
+                                                 std::vector<com::Utf8Str> &aOVFValues,
+                                                 std::vector<com::Utf8Str> &aVBoxValues,
+                                                 std::vector<com::Utf8Str> &aExtraConfigValues)
 
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    ULONG c = (ULONG)m->llDescriptions.size();
-    com::SafeArray<VirtualSystemDescriptionType_T> sfaTypes(c);
-    com::SafeArray<BSTR> sfaRefs(c);
-    com::SafeArray<BSTR> sfaOrigValues(c);
-    com::SafeArray<BSTR> sfaVBoxValues(c);
-    com::SafeArray<BSTR> sfaExtraConfigValues(c);
-
-    list<VirtualSystemDescriptionEntry>::const_iterator it;
-    size_t i = 0;
-    for (it = m->llDescriptions.begin();
-         it != m->llDescriptions.end();
-         ++it, ++i)
+    size_t c = m->maDescriptions.size();
+    aTypes.resize(c);
+    aRefs.resize(c);
+    aOVFValues.resize(c);
+    aVBoxValues.resize(c);
+    aExtraConfigValues.resize(c);
+
+    for (size_t i = 0; i < c; i++)
     {
-        const VirtualSystemDescriptionEntry &vsde = (*it);
-
-        sfaTypes[i] = vsde.type;
-
-        Bstr bstr = vsde.strRef;
-        bstr.cloneTo(&sfaRefs[i]);
-
-        bstr = vsde.strOvf;
-        bstr.cloneTo(&sfaOrigValues[i]);
-
-        bstr = vsde.strVBoxCurrent;
-        bstr.cloneTo(&sfaVBoxValues[i]);
-
-        bstr = vsde.strExtraConfigCurrent;
-        bstr.cloneTo(&sfaExtraConfigValues[i]);
+        const VirtualSystemDescriptionEntry &vsde = m->maDescriptions[i];
+        aTypes[i] = vsde.type;
+        aRefs[i] = vsde.strRef;
+        aOVFValues[i] = vsde.strOvf;
+        aVBoxValues[i] = vsde.strVBoxCurrent;
+        aExtraConfigValues[i] = vsde.strExtraConfigCurrent;
     }
-
-    sfaTypes.detachTo(ComSafeArrayOutArg(aTypes));
-    sfaRefs.detachTo(ComSafeArrayOutArg(aRefs));
-    sfaOrigValues.detachTo(ComSafeArrayOutArg(aOrigValues));
-    sfaVBoxValues.detachTo(ComSafeArrayOutArg(aVBoxValues));
-    sfaExtraConfigValues.detachTo(ComSafeArrayOutArg(aExtraConfigValues));
-
     return S_OK;
 }
 
@@ -1330,62 +1432,34 @@ STDMETHODIMP VirtualSystemDescription::GetDescription(ComSafeArrayOut(VirtualSys
  * Public method implementation.
  * @return
  */
-STDMETHODIMP VirtualSystemDescription::GetDescriptionByType(VirtualSystemDescriptionType_T aType,
-                                                            ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
-                                                            ComSafeArrayOut(BSTR, aRefs),
-                                                            ComSafeArrayOut(BSTR, aOrigValues),
-                                                            ComSafeArrayOut(BSTR, aVBoxValues),
-                                                            ComSafeArrayOut(BSTR, aExtraConfigValues))
+HRESULT VirtualSystemDescription::getDescriptionByType(VirtualSystemDescriptionType_T aType,
+                                                       std::vector<VirtualSystemDescriptionType_T> &aTypes,
+                                                       std::vector<com::Utf8Str> &aRefs,
+                                                       std::vector<com::Utf8Str> &aOVFValues,
+                                                       std::vector<com::Utf8Str> &aVBoxValues,
+                                                       std::vector<com::Utf8Str> &aExtraConfigValues)
 {
-    if (ComSafeArrayOutIsNull(aTypes) ||
-        ComSafeArrayOutIsNull(aRefs) ||
-        ComSafeArrayOutIsNull(aOrigValues) ||
-        ComSafeArrayOutIsNull(aVBoxValues) ||
-        ComSafeArrayOutIsNull(aExtraConfigValues))
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    std::list<VirtualSystemDescriptionEntry*> vsd = i_findByType(aType);
 
-    std::list<VirtualSystemDescriptionEntry*> vsd = findByType (aType);
-    ULONG c = (ULONG)vsd.size();
-    com::SafeArray<VirtualSystemDescriptionType_T> sfaTypes(c);
-    com::SafeArray<BSTR> sfaRefs(c);
-    com::SafeArray<BSTR> sfaOrigValues(c);
-    com::SafeArray<BSTR> sfaVBoxValues(c);
-    com::SafeArray<BSTR> sfaExtraConfigValues(c);
+    size_t c = vsd.size();
+    aTypes.resize(c);
+    aRefs.resize(c);
+    aOVFValues.resize(c);
+    aVBoxValues.resize(c);
+    aExtraConfigValues.resize(c);
 
-    list<VirtualSystemDescriptionEntry*>::const_iterator it;
     size_t i = 0;
-    for (it = vsd.begin();
-         it != vsd.end();
-         ++it, ++i)
+    for (list<VirtualSystemDescriptionEntry*>::const_iterator it = vsd.begin(); it != vsd.end(); ++it, ++i)
     {
         const VirtualSystemDescriptionEntry *vsde = (*it);
-
-        sfaTypes[i] = vsde->type;
-
-        Bstr bstr = vsde->strRef;
-        bstr.cloneTo(&sfaRefs[i]);
-
-        bstr = vsde->strOvf;
-        bstr.cloneTo(&sfaOrigValues[i]);
-
-        bstr = vsde->strVBoxCurrent;
-        bstr.cloneTo(&sfaVBoxValues[i]);
-
-        bstr = vsde->strExtraConfigCurrent;
-        bstr.cloneTo(&sfaExtraConfigValues[i]);
+        aTypes[i] = vsde->type;
+        aRefs[i] = vsde->strRef;
+        aOVFValues[i] = vsde->strOvf;
+        aVBoxValues[i] = vsde->strVBoxCurrent;
+        aExtraConfigValues[i] = vsde->strExtraConfigCurrent;
     }
 
-    sfaTypes.detachTo(ComSafeArrayOutArg(aTypes));
-    sfaRefs.detachTo(ComSafeArrayOutArg(aRefs));
-    sfaOrigValues.detachTo(ComSafeArrayOutArg(aOrigValues));
-    sfaVBoxValues.detachTo(ComSafeArrayOutArg(aVBoxValues));
-    sfaExtraConfigValues.detachTo(ComSafeArrayOutArg(aExtraConfigValues));
-
     return S_OK;
 }
 
@@ -1393,20 +1467,14 @@ STDMETHODIMP VirtualSystemDescription::GetDescriptionByType(VirtualSystemDescrip
  * Public method implementation.
  * @return
  */
-STDMETHODIMP VirtualSystemDescription::GetValuesByType(VirtualSystemDescriptionType_T aType,
-                                                       VirtualSystemDescriptionValueType_T aWhich,
-                                                       ComSafeArrayOut(BSTR, aValues))
+HRESULT VirtualSystemDescription::getValuesByType(VirtualSystemDescriptionType_T aType,
+                                                  VirtualSystemDescriptionValueType_T aWhich,
+                                                  std::vector<com::Utf8Str> &aValues)
 {
-    if (ComSafeArrayOutIsNull(aValues))
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    std::list<VirtualSystemDescriptionEntry*> vsd = findByType (aType);
-    com::SafeArray<BSTR> sfaValues((ULONG)vsd.size());
+    std::list<VirtualSystemDescriptionEntry*> vsd = i_findByType (aType);
+    aValues.resize((ULONG)vsd.size());
 
     list<VirtualSystemDescriptionEntry*>::const_iterator it;
     size_t i = 0;
@@ -1419,17 +1487,13 @@ STDMETHODIMP VirtualSystemDescription::GetValuesByType(VirtualSystemDescriptionT
         Bstr bstr;
         switch (aWhich)
         {
-            case VirtualSystemDescriptionValueType_Reference: bstr = vsde->strRef; break;
-            case VirtualSystemDescriptionValueType_Original: bstr = vsde->strOvf; break;
-            case VirtualSystemDescriptionValueType_Auto: bstr = vsde->strVBoxCurrent; break;
-            case VirtualSystemDescriptionValueType_ExtraConfig: bstr = vsde->strExtraConfigCurrent; break;
+            case VirtualSystemDescriptionValueType_Reference: aValues[i]  = vsde->strRef; break;
+            case VirtualSystemDescriptionValueType_Original: aValues[i]  = vsde->strOvf; break;
+            case VirtualSystemDescriptionValueType_Auto: aValues[i]  = vsde->strVBoxCurrent; break;
+            case VirtualSystemDescriptionValueType_ExtraConfig: aValues[i] = vsde->strExtraConfigCurrent; break;
         }
-
-        bstr.cloneTo(&sfaValues[i]);
     }
 
-    sfaValues.detachTo(ComSafeArrayOutArg(aValues));
-
     return S_OK;
 }
 
@@ -1437,45 +1501,32 @@ STDMETHODIMP VirtualSystemDescription::GetValuesByType(VirtualSystemDescriptionT
  * Public method implementation.
  * @return
  */
-STDMETHODIMP VirtualSystemDescription::SetFinalValues(ComSafeArrayIn(BOOL, aEnabled),
-                                                      ComSafeArrayIn(IN_BSTR, argVBoxValues),
-                                                      ComSafeArrayIn(IN_BSTR, argExtraConfigValues))
+HRESULT VirtualSystemDescription::setFinalValues(const std::vector<BOOL> &aEnabled,
+                                                 const std::vector<com::Utf8Str> &aVBoxValues,
+                                                 const std::vector<com::Utf8Str> &aExtraConfigValues)
 {
 #ifndef RT_OS_WINDOWS
-    NOREF(aEnabledSize);
+    // NOREF(aEnabledSize);
 #endif /* RT_OS_WINDOWS */
-
-    CheckComArgSafeArrayNotNull(aEnabled);
-    CheckComArgSafeArrayNotNull(argVBoxValues);
-    CheckComArgSafeArrayNotNull(argExtraConfigValues);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<BOOL> sfaEnabled(ComSafeArrayInArg(aEnabled));
-    com::SafeArray<IN_BSTR> sfaVBoxValues(ComSafeArrayInArg(argVBoxValues));
-    com::SafeArray<IN_BSTR> sfaExtraConfigValues(ComSafeArrayInArg(argExtraConfigValues));
-
-    if (    (sfaEnabled.size() != m->llDescriptions.size())
-         || (sfaVBoxValues.size() != m->llDescriptions.size())
-         || (sfaExtraConfigValues.size() != m->llDescriptions.size())
+    if (    (aEnabled.size() != m->maDescriptions.size())
+         || (aVBoxValues.size() != m->maDescriptions.size())
+         || (aExtraConfigValues.size() != m->maDescriptions.size())
        )
         return E_INVALIDARG;
 
-    list<VirtualSystemDescriptionEntry>::iterator it;
     size_t i = 0;
-    for (it = m->llDescriptions.begin();
-         it != m->llDescriptions.end();
+    for (vector<VirtualSystemDescriptionEntry>::iterator it = m->maDescriptions.begin();
+         it != m->maDescriptions.end();
          ++it, ++i)
     {
         VirtualSystemDescriptionEntry& vsde = *it;
 
-        if (sfaEnabled[i])
+        if (aEnabled[i])
         {
-            vsde.strVBoxCurrent = sfaVBoxValues[i];
-            vsde.strExtraConfigCurrent = sfaExtraConfigValues[i];
+            vsde.strVBoxCurrent = aVBoxValues[i];
+            vsde.strExtraConfigCurrent = aExtraConfigValues[i];
         }
         else
             vsde.type = VirtualSystemDescriptionType_Ignore;
@@ -1488,17 +1539,13 @@ STDMETHODIMP VirtualSystemDescription::SetFinalValues(ComSafeArrayIn(BOOL, aEnab
  * Public method implementation.
  * @return
  */
-STDMETHODIMP VirtualSystemDescription::AddDescription(VirtualSystemDescriptionType_T aType,
-                                                      IN_BSTR aVBoxValue,
-                                                      IN_BSTR aExtraConfigValue)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT VirtualSystemDescription::addDescription(VirtualSystemDescriptionType_T aType,
+                                                 const com::Utf8Str &aVBoxValue,
+                                                 const com::Utf8Str &aExtraConfigValue)
 
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    addEntry(aType, "", aVBoxValue, aVBoxValue, 0, aExtraConfigValue);
-
+    i_addEntry(aType, "", aVBoxValue, aVBoxValue, 0, aExtraConfigValue);
     return S_OK;
 }
 
@@ -1511,15 +1558,15 @@ STDMETHODIMP VirtualSystemDescription::AddDescription(VirtualSystemDescriptionTy
  * @param ulSizeMB Weight for IProgress
  * @param strExtraConfig Extra configuration; meaning dependent on type.
  */
-void VirtualSystemDescription::addEntry(VirtualSystemDescriptionType_T aType,
-                                        const Utf8Str &strRef,
-                                        const Utf8Str &aOvfValue,
-                                        const Utf8Str &aVBoxValue,
-                                        uint32_t ulSizeMB,
-                                        const Utf8Str &strExtraConfig /*= ""*/)
+void VirtualSystemDescription::i_addEntry(VirtualSystemDescriptionType_T aType,
+                                          const Utf8Str &strRef,
+                                          const Utf8Str &aOvfValue,
+                                          const Utf8Str &aVBoxValue,
+                                          uint32_t ulSizeMB,
+                                          const Utf8Str &strExtraConfig /*= ""*/)
 {
     VirtualSystemDescriptionEntry vsde;
-    vsde.ulIndex = (uint32_t)m->llDescriptions.size();      // each entry gets an index so the client side can reference them
+    vsde.ulIndex = (uint32_t)m->maDescriptions.size();      // each entry gets an index so the client side can reference them
     vsde.type = aType;
     vsde.strRef = strRef;
     vsde.strOvf = aOvfValue;
@@ -1530,10 +1577,10 @@ void VirtualSystemDescription::addEntry(VirtualSystemDescriptionType_T aType,
         = vsde.strExtraConfigCurrent
         = strExtraConfig;
     vsde.ulSizeMB = ulSizeMB;
-    vsde.skipIt = false;
 
-    m->llDescriptions.push_back(vsde);
+    vsde.skipIt = false;
 
+    m->maDescriptions.push_back(vsde);
 }
 
 /**
@@ -1542,13 +1589,11 @@ void VirtualSystemDescription::addEntry(VirtualSystemDescriptionType_T aType,
  * @param aType
  * @return
  */
-std::list<VirtualSystemDescriptionEntry*> VirtualSystemDescription::findByType(VirtualSystemDescriptionType_T aType)
+std::list<VirtualSystemDescriptionEntry*> VirtualSystemDescription::i_findByType(VirtualSystemDescriptionType_T aType)
 {
     std::list<VirtualSystemDescriptionEntry*> vsd;
-
-    list<VirtualSystemDescriptionEntry>::iterator it;
-    for (it = m->llDescriptions.begin();
-         it != m->llDescriptions.end();
+    for (vector<VirtualSystemDescriptionEntry>::iterator it = m->maDescriptions.begin();
+         it != m->maDescriptions.end();
          ++it)
     {
         if (it->type == aType)
@@ -1558,21 +1603,18 @@ std::list<VirtualSystemDescriptionEntry*> VirtualSystemDescription::findByType(V
     return vsd;
 }
 
-/**
- * Private method; delete all records from the list
+/* Private method; delete all records from the list
  * m->llDescriptions that match the given type.
  * @param aType
  * @return
  */
-void VirtualSystemDescription::removeByType(VirtualSystemDescriptionType_T aType)
+void VirtualSystemDescription::i_removeByType(VirtualSystemDescriptionType_T aType)
 {
-    std::list<VirtualSystemDescriptionEntry*> vsd;
-
-    list<VirtualSystemDescriptionEntry>::iterator it = m->llDescriptions.begin();
-    while (it != m->llDescriptions.end())
+    std::vector<VirtualSystemDescriptionEntry>::iterator it = m->maDescriptions.begin();
+    while (it != m->maDescriptions.end())
     {
         if (it->type == aType)
-            it = m->llDescriptions.erase(it);
+            it = m->maDescriptions.erase(it);
         else
             ++it;
     }
@@ -1585,12 +1627,12 @@ void VirtualSystemDescription::removeByType(VirtualSystemDescriptionType_T aType
  * @param id
  * @return
  */
-const VirtualSystemDescriptionEntry* VirtualSystemDescription::findControllerFromID(uint32_t id)
+const VirtualSystemDescriptionEntry* VirtualSystemDescription::i_findControllerFromID(uint32_t id)
 {
     Utf8Str strRef = Utf8StrFmt("%RI32", id);
-    list<VirtualSystemDescriptionEntry>::const_iterator it;
-    for (it = m->llDescriptions.begin();
-         it != m->llDescriptions.end();
+    vector<VirtualSystemDescriptionEntry>::const_iterator it;
+    for (it = m->maDescriptions.begin();
+         it != m->maDescriptions.end();
          ++it)
     {
         const VirtualSystemDescriptionEntry &d = *it;
@@ -1622,7 +1664,7 @@ const VirtualSystemDescriptionEntry* VirtualSystemDescription::findControllerFro
  * @param elmMachine <vbox:Machine> element with attributes and subelements from some
  *                  DOM tree.
  */
-void VirtualSystemDescription::importVBoxMachineXML(const xml::ElementNode &elmMachine)
+void VirtualSystemDescription::i_importVBoxMachineXML(const xml::ElementNode &elmMachine)
 {
     settings::MachineConfigFile *pConfig = NULL;
 
@@ -1647,7 +1689,7 @@ void VirtualSystemDescription::importVBoxMachineXML(const xml::ElementNode &elmM
  * Returns the machine config created by importVBoxMachineXML() or NULL if there's none.
  * @return
  */
-const settings::MachineConfigFile* VirtualSystemDescription::getMachineConfig() const
+const settings::MachineConfigFile* VirtualSystemDescription::i_getMachineConfig() const
 {
     return m->pConfig;
 }
diff --git a/src/VBox/Main/src-server/ApplianceImplExport.cpp b/src/VBox/Main/src-server/ApplianceImplExport.cpp
index a814909..b91bd85 100644
--- a/src/VBox/Main/src-server/ApplianceImplExport.cpp
+++ b/src/VBox/Main/src-server/ApplianceImplExport.cpp
@@ -56,26 +56,23 @@ using namespace std;
 * @param appliance
 * @return
 */
-STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtualSystemDescription **aDescription)
+HRESULT Machine::exportTo(const ComPtr<IAppliance> &aAppliance, const com::Utf8Str &aLocation,
+                          ComPtr<IVirtualSystemDescription> &aDescription)
 {
     HRESULT rc = S_OK;
 
     if (!aAppliance)
         return E_POINTER;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     ComObjPtr<VirtualSystemDescription> pNewDesc;
 
     try
     {
-        Appliance *pAppliance = static_cast<Appliance*>(aAppliance);
-        AutoCaller autoCaller1(pAppliance);
-        if (FAILED(autoCaller1.rc())) return autoCaller1.rc();
+        IAppliance *iAppliance = aAppliance;
+        Appliance *pAppliance = static_cast<Appliance*>(iAppliance);
 
         LocationInfo locInfo;
-        parseURI(location, locInfo);
+        i_parseURI(aLocation, locInfo);
         // create a new virtual system to store in the appliance
         rc = pNewDesc.createObject();
         if (FAILED(rc)) throw rc;
@@ -91,7 +88,7 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
         rc = COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbControllers));
         if (SUCCEEDED(rc))
         {
-            for (unsigned i = 0; i < usbControllers.size(); i++)
+            for (unsigned i = 0; i < usbControllers.size(); ++i)
             {
                 USBControllerType_T enmType;
 
@@ -141,36 +138,36 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
 
         /* Guest OS type */
         ovf::CIMOSType_T cim = convertVBoxOSType2CIMOSType(strOsTypeVBox.c_str(), fLongMode);
-        pNewDesc->addEntry(VirtualSystemDescriptionType_OS,
-                           "",
-                           Utf8StrFmt("%RI32", cim),
-                           strOsTypeVBox);
+        pNewDesc->i_addEntry(VirtualSystemDescriptionType_OS,
+                             "",
+                             Utf8StrFmt("%RI32", cim),
+                             strOsTypeVBox);
 
         /* VM name */
-        pNewDesc->addEntry(VirtualSystemDescriptionType_Name,
-                           "",
-                           strVMName,
-                           strVMName);
+        pNewDesc->i_addEntry(VirtualSystemDescriptionType_Name,
+                             "",
+                             strVMName,
+                             strVMName);
 
         // description
-        pNewDesc->addEntry(VirtualSystemDescriptionType_Description,
-                           "",
-                           strDescription,
-                           strDescription);
+        pNewDesc->i_addEntry(VirtualSystemDescriptionType_Description,
+                             "",
+                             strDescription,
+                             strDescription);
 
         /* CPU count*/
         Utf8Str strCpuCount = Utf8StrFmt("%RI32", cCPUs);
-        pNewDesc->addEntry(VirtualSystemDescriptionType_CPU,
-                           "",
-                           strCpuCount,
-                           strCpuCount);
+        pNewDesc->i_addEntry(VirtualSystemDescriptionType_CPU,
+                             "",
+                             strCpuCount,
+                             strCpuCount);
 
         /* Memory */
         Utf8Str strMemory = Utf8StrFmt("%RI64", (uint64_t)ulMemSizeMB * _1M);
-        pNewDesc->addEntry(VirtualSystemDescriptionType_Memory,
-                           "",
-                           strMemory,
-                           strMemory);
+        pNewDesc->i_addEntry(VirtualSystemDescriptionType_Memory,
+                             "",
+                             strMemory,
+                             strMemory);
 
         // the one VirtualBox IDE controller has two channels with two ports each, which is
         // considered two IDE controllers with two ports each by OVF, so export it as two
@@ -223,16 +220,16 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
 
             if (strVBox.length())
             {
-                lIDEControllerPrimaryIndex = (int32_t)pNewDesc->m->llDescriptions.size();
-                pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
-                                   Utf8StrFmt("%d", lIDEControllerPrimaryIndex),        // strRef
-                                   strVBox,     // aOvfValue
-                                   strVBox);    // aVBoxValue
+                lIDEControllerPrimaryIndex = (int32_t)pNewDesc->m->maDescriptions.size();
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
+                                     Utf8StrFmt("%d", lIDEControllerPrimaryIndex),        // strRef
+                                     strVBox,     // aOvfValue
+                                     strVBox);    // aVBoxValue
                 lIDEControllerSecondaryIndex = lIDEControllerPrimaryIndex + 1;
-                pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
-                                   Utf8StrFmt("%d", lIDEControllerSecondaryIndex),
-                                   strVBox,
-                                   strVBox);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
+                                     Utf8StrFmt("%d", lIDEControllerSecondaryIndex),
+                                     strVBox,
+                                     strVBox);
             }
         }
 
@@ -240,11 +237,11 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
         if (!pSATAController.isNull())
         {
             Utf8Str strVBox = "AHCI";
-            lSATAControllerIndex = (int32_t)pNewDesc->m->llDescriptions.size();
-            pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
-                               Utf8StrFmt("%d", lSATAControllerIndex),
-                               strVBox,
-                               strVBox);
+            lSATAControllerIndex = (int32_t)pNewDesc->m->maDescriptions.size();
+            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
+                                 Utf8StrFmt("%d", lSATAControllerIndex),
+                                 strVBox,
+                                 strVBox);
         }
 
 //     <const name="HardDiskControllerSCSI" value="8" />
@@ -260,11 +257,11 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
                     case StorageControllerType_LsiLogic: strVBox = "LsiLogic"; break;
                     case StorageControllerType_BusLogic: strVBox = "BusLogic"; break;
                 }
-                lSCSIControllerIndex = (int32_t)pNewDesc->m->llDescriptions.size();
-                pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSCSI,
-                                   Utf8StrFmt("%d", lSCSIControllerIndex),
-                                   strVBox,
-                                   strVBox);
+                lSCSIControllerIndex = (int32_t)pNewDesc->m->maDescriptions.size();
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSCSI,
+                                     Utf8StrFmt("%d", lSCSIControllerIndex),
+                                     strVBox,
+                                     strVBox);
             }
             else
                 throw rc;
@@ -275,11 +272,11 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
             // VirtualBox considers the SAS controller a class of its own but in OVF
             // it should be a SCSI controller
             Utf8Str strVBox = "LsiLogicSas";
-            lSCSIControllerIndex = (int32_t)pNewDesc->m->llDescriptions.size();
-            pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSAS,
-                               Utf8StrFmt("%d", lSCSIControllerIndex),
-                               strVBox,
-                               strVBox);
+            lSCSIControllerIndex = (int32_t)pNewDesc->m->maDescriptions.size();
+            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSAS,
+                                 Utf8StrFmt("%d", lSCSIControllerIndex),
+                                 strVBox,
+                                 strVBox);
         }
 
 //     <const name="HardDiskImage" value="9" />
@@ -347,7 +344,7 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
                         // returns pMedium if there are no diff images
                 if (FAILED(rc)) throw rc;
 
-                Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripExt();
+                Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripSuffix();
                 strTargetImageName = Utf8StrFmt("%s-disk%d.vmdk", strName.c_str(), ++pAppliance->m->cDisks);
                 if (strTargetImageName.length() > RTTAR_NAME_MAX)
                     throw setError(VBOX_E_NOT_SUPPORTED,
@@ -360,6 +357,44 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
 
                 rc = pBaseMedium->COMGETTER(Size)(&llSize);
                 if (FAILED(rc)) throw rc;
+
+                /* If the medium is encrypted add the key identifier to the list. */
+                IMedium *iBaseMedium = pBaseMedium;
+                Medium *pBase = static_cast<Medium*>(iBaseMedium);
+                const com::Utf8Str strKeyId = pBase->i_getKeyId();
+                if (!strKeyId.isEmpty())
+                {
+                    IMedium *iMedium = pMedium;
+                    Medium *pMed = static_cast<Medium*>(iMedium);
+                    com::Guid mediumUuid = pMed->i_getId();
+                    bool fKnown = false;
+
+                    /* Check whether the ID is already in our sequence, add it otherwise. */
+                    for (unsigned i = 0; i < pAppliance->m->m_vecPasswordIdentifiers.size(); i++)
+                    {
+                        if (strKeyId.equals(pAppliance->m->m_vecPasswordIdentifiers[i]))
+                        {
+                            fKnown = true;
+                            break;
+                        }
+                    }
+
+                    if (!fKnown)
+                    {
+                        GUIDVEC vecMediumIds;
+
+                        vecMediumIds.push_back(mediumUuid);
+                        pAppliance->m->m_vecPasswordIdentifiers.push_back(strKeyId);
+                        pAppliance->m->m_mapPwIdToMediumIds.insert(std::pair<com::Utf8Str, GUIDVEC>(strKeyId, vecMediumIds));
+                    }
+                    else
+                    {
+                        std::map<com::Utf8Str, GUIDVEC>::iterator it = pAppliance->m->m_mapPwIdToMediumIds.find(strKeyId);
+                        if (it == pAppliance->m->m_mapPwIdToMediumIds.end())
+                            throw setError(E_FAIL, tr("Internal error adding a medium UUID to the map"));
+                        it->second.push_back(mediumUuid);
+                    }
+                }
             }
             else if (   deviceType == DeviceType_DVD
                      && pMedium)
@@ -395,13 +430,13 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
                 strLocation = bstrLocation;
 
                 Utf8Str ext = strLocation;
-                ext.assignEx(RTPathExt(ext.c_str()));//returns extension with dot (".iso")
+                ext.assignEx(RTPathSuffix(ext.c_str()));//returns extension with dot (".iso")
 
                 int eq = ext.compare(".iso", Utf8Str::CaseInsensitive);
                 if (eq != 0)
                     continue;
 
-                Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripExt();
+                Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripSuffix();
                 strTargetImageName = Utf8StrFmt("%s-disk%d.iso", strName.c_str(), ++pAppliance->m->cDisks);
                 if (strTargetImageName.length() > RTTAR_NAME_MAX)
                     throw setError(VBOX_E_NOT_SUPPORTED,
@@ -432,7 +467,8 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
                         lControllerVsys = lIDEControllerPrimaryIndex;
                         lChannelVsys = 1;
                     }
-                    else if (lChannel == 1 && lDevice == 0) // secondary master; by default this is the CD-ROM but as of VirtualBox 3.1 that can change
+                    else if (lChannel == 1 && lDevice == 0) // secondary master; by default this is the CD-ROM but
+                                                            // as of VirtualBox 3.1 that can change
                     {
                         lControllerVsys = lIDEControllerSecondaryIndex;
                         lChannelVsys = 0;
@@ -444,7 +480,7 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
                     }
                     else
                         throw setError(VBOX_E_NOT_SUPPORTED,
-                                    tr("Cannot handle medium attachment: channel is %d, device is %d"), lChannel, lDevice);
+                                       tr("Cannot handle medium attachment: channel is %d, device is %d"), lChannel, lDevice);
                 break;
 
                 case StorageBus_SATA:
@@ -465,7 +501,8 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
 
                 default:
                     throw setError(VBOX_E_NOT_SUPPORTED,
-                                tr("Cannot handle medium attachment: storageBus is %d, channel is %d, device is %d"), storageBus, lChannel, lDevice);
+                                   tr("Cannot handle medium attachment: storageBus is %d, channel is %d, device is %d"),
+                                   storageBus, lChannel, lDevice);
                 break;
             }
 
@@ -476,37 +513,37 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
             {
                 case DeviceType_HardDisk:
                     Log(("Adding VirtualSystemDescriptionType_HardDiskImage, disk size: %RI64\n", llSize));
-                    pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskImage,
-                                       strTargetImageName,   // disk ID: let's use the name
-                                       strTargetImageName,   // OVF value:
-                                       strLocation, // vbox value: media path
-                                       (uint32_t)(llSize / _1M),
-                                       strExtra);
+                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskImage,
+                                         strTargetImageName,   // disk ID: let's use the name
+                                         strTargetImageName,   // OVF value:
+                                         strLocation, // vbox value: media path
+                                        (uint32_t)(llSize / _1M),
+                                         strExtra);
                 break;
 
                 case DeviceType_DVD:
                     Log(("Adding VirtualSystemDescriptionType_CDROM, disk size: %RI64\n", llSize));
-                    pNewDesc->addEntry(VirtualSystemDescriptionType_CDROM,
-                                       strTargetImageName,   // disk ID
-                                       strTargetImageName,   // OVF value
-                                       strLocation, // vbox value
-                                       (uint32_t)(llSize / _1M),// ulSize
-                                       strExtra);
+                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_CDROM,
+                                         strTargetImageName,   // disk ID
+                                         strTargetImageName,   // OVF value
+                                         strLocation, // vbox value
+                                         (uint32_t)(llSize / _1M),// ulSize
+                                         strExtra);
                 break;
 
                 case DeviceType_Floppy:
-                    pNewDesc->addEntry(VirtualSystemDescriptionType_Floppy,
-                                       strEmpty,      // disk ID
-                                       strEmpty,      // OVF value
-                                       strEmpty,      // vbox value
-                                       1,       // ulSize
-                                       strExtra);
+                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_Floppy,
+                                         strEmpty,      // disk ID
+                                         strEmpty,      // OVF value
+                                         strEmpty,      // vbox value
+                                         1,       // ulSize
+                                         strExtra);
                 break;
             }
         }
 
 //     <const name="NetworkAdapter" />
-        uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(getChipsetType());
+        uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(i_getChipsetType());
         size_t a;
         for (a = 0; a < maxNetworkAdapters; ++a)
         {
@@ -530,7 +567,7 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
                 if (FAILED(rc)) throw rc;
 
                 Utf8Str strAttachmentType = convertNetworkAttachmentTypeToString(attachmentType);
-                pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter,
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_NetworkAdapter,
                                    "",      // ref
                                    strAttachmentType,      // orig
                                    Utf8StrFmt("%RI32", (uint32_t)adapterType),   // conf
@@ -542,19 +579,19 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
 //     <const name="USBController"  />
 #ifdef VBOX_WITH_USB
         if (fUSBEnabled)
-            pNewDesc->addEntry(VirtualSystemDescriptionType_USBController, "", "", "");
+            pNewDesc->i_addEntry(VirtualSystemDescriptionType_USBController, "", "", "");
 #endif /* VBOX_WITH_USB */
 
 //     <const name="SoundCard"  />
         if (fAudioEnabled)
-            pNewDesc->addEntry(VirtualSystemDescriptionType_SoundCard,
-                               "",
-                               "ensoniq1371",       // this is what OVFTool writes and VMware supports
-                               Utf8StrFmt("%RI32", audioController));
+            pNewDesc->i_addEntry(VirtualSystemDescriptionType_SoundCard,
+                                 "",
+                                 "ensoniq1371",       // this is what OVFTool writes and VMware supports
+                                 Utf8StrFmt("%RI32", audioController));
 
         /* We return the new description to the caller */
         ComPtr<IVirtualSystemDescription> copy(pNewDesc);
-        copy.queryInterfaceTo(aDescription);
+        copy.queryInterfaceTo(aDescription.asOutParam());
 
         AutoWriteLock alock(pAppliance COMMA_LOCKVAL_SRC_POS);
         // finally, add the virtual system to the appliance
@@ -582,20 +619,24 @@ STDMETHODIMP Machine::ExportTo(IAppliance *aAppliance, IN_BSTR location, IVirtua
  * @param aProgress
  * @return
  */
-STDMETHODIMP Appliance::Write(IN_BSTR format, ComSafeArrayIn(ImportOptions_T, options), IN_BSTR path, IProgress **aProgress)
+HRESULT Appliance::write(const com::Utf8Str &aFormat,
+                         const std::vector<ExportOptions_T> &aOptions,
+                         const com::Utf8Str &aPath,
+                         ComPtr<IProgress> &aProgress)
 {
-    if (!path) return E_POINTER;
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (options != NULL)
-        m->optListExport = com::SafeArray<ExportOptions_T>(ComSafeArrayInArg(options)).toList();
+    m->optListExport.clear();
+    if (aOptions.size())
+    {
+        for (size_t i = 0; i < aOptions.size(); ++i)
+        {
+            m->optListExport.insert(i, aOptions[i]);
+        }
+    }
 
-//    AssertReturn(!(m->optListExport.contains(ExportOptions_CreateManifest) && m->optListExport.contains(ExportOptions_ExportDVDImages)), E_INVALIDARG);
+//  AssertReturn(!(m->optListExport.contains(ExportOptions_CreateManifest)
+//  && m->optListExport.contains(ExportOptions_ExportDVDImages)), E_INVALIDARG);
 
     m->fExportISOImages = m->optListExport.contains(ExportOptions_ExportDVDImages);
 
@@ -607,7 +648,7 @@ STDMETHODIMP Appliance::Write(IN_BSTR format, ComSafeArrayIn(ImportOptions_T, op
              ++it)
         {
             ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
-            std::list<VirtualSystemDescriptionEntry*> skipped = vsdescThis->findByType(VirtualSystemDescriptionType_CDROM);
+            std::list<VirtualSystemDescriptionEntry*> skipped = vsdescThis->i_findByType(VirtualSystemDescriptionType_CDROM);
             std::list<VirtualSystemDescriptionEntry*>:: iterator pItSkipped = skipped.begin();
             while (pItSkipped != skipped.end())
             {
@@ -618,35 +659,38 @@ STDMETHODIMP Appliance::Write(IN_BSTR format, ComSafeArrayIn(ImportOptions_T, op
     }
 
     // do not allow entering this method if the appliance is busy reading or writing
-    if (!isApplianceIdle())
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
 
     // see if we can handle this file; for now we insist it has an ".ovf" extension
-    Utf8Str strPath = path;
-    if (!(   strPath.endsWith(".ovf", Utf8Str::CaseInsensitive)
-          || strPath.endsWith(".ova", Utf8Str::CaseInsensitive)))
+    if (!(   aPath.endsWith(".ovf", Utf8Str::CaseInsensitive)
+          || aPath.endsWith(".ova", Utf8Str::CaseInsensitive)))
         return setError(VBOX_E_FILE_ERROR,
                         tr("Appliance file must have .ovf or .ova extension"));
 
     m->fManifest = m->optListExport.contains(ExportOptions_CreateManifest);
-    Utf8Str strFormat(format);
 
     ovf::OVFVersion_T ovfF;
-    if (strFormat == "ovf-0.9")
+    if (aFormat == "ovf-0.9")
     {
         ovfF = ovf::OVFVersion_0_9;
     }
-    else if (strFormat == "ovf-1.0")
+    else if (aFormat == "ovf-1.0")
     {
         ovfF = ovf::OVFVersion_1_0;
     }
-    else if (strFormat == "ovf-2.0")
+    else if (aFormat == "ovf-2.0")
     {
         ovfF = ovf::OVFVersion_2_0;
     }
     else
         return setError(VBOX_E_FILE_ERROR,
-                        tr("Invalid format \"%s\" specified"), strFormat.c_str());
+                        tr("Invalid format \"%s\" specified"), aFormat.c_str());
+
+    /* Check whether all passwords are supplied or error out. */
+    if (m->m_cPwProvided < m->m_vecPasswordIdentifiers.size())
+        return setError(VBOX_E_INVALID_OBJECT_STATE,
+                        tr("Appliance export failed because not all passwords were provided for all encrypted media"));
 
     /* as of OVF 2.0 we have to use SHA256 */
     m->fSha256 = ovfF >= ovf::OVFVersion_2_0;
@@ -656,8 +700,8 @@ STDMETHODIMP Appliance::Write(IN_BSTR format, ComSafeArrayIn(ImportOptions_T, op
     try
     {
         /* Parse all necessary info out of the URI */
-        parseURI(strPath, m->locInfo);
-        rc = writeImpl(ovfF, m->locInfo, progress);
+        i_parseURI(aPath, m->locInfo);
+        rc = i_writeImpl(ovfF, m->locInfo, progress);
     }
     catch (HRESULT aRC)
     {
@@ -666,7 +710,7 @@ STDMETHODIMP Appliance::Write(IN_BSTR format, ComSafeArrayIn(ImportOptions_T, op
 
     if (SUCCEEDED(rc))
         /* Return progress to the caller */
-        progress.queryInterfaceTo(aProgress);
+        progress.queryInterfaceTo(aProgress.asOutParam());
 
     return rc;
 }
@@ -689,24 +733,24 @@ STDMETHODIMP Appliance::Write(IN_BSTR format, ComSafeArrayIn(ImportOptions_T, op
  *
  * 1) from the public Appliance::Write().
  *
- * 2) in a second worker thread; in that case, Appliance::Write() called Appliance::writeImpl(), which
- *    called Appliance::writeFSOVA(), which called Appliance::writeImpl(), which then called this again.
+ * 2) in a second worker thread; in that case, Appliance::Write() called Appliance::i_writeImpl(), which
+ *    called Appliance::i_writeFSOVA(), which called Appliance::i_writeImpl(), which then called this again.
  *
- * 3) from Appliance::writeS3(), which got called from a previous instance of Appliance::taskThreadWriteOVF().
+ * 3) from Appliance::i_writeS3(), which got called from a previous instance of Appliance::taskThreadWriteOVF().
  *
  * @param aFormat
  * @param aLocInfo
  * @param aProgress
  * @return
  */
-HRESULT Appliance::writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
+HRESULT Appliance::i_writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
 {
     HRESULT rc = S_OK;
     try
     {
-        rc = setUpProgress(aProgress,
-                           BstrFmt(tr("Export appliance '%s'"), aLocInfo.strPath.c_str()),
-                           (aLocInfo.storageType == VFSType_File) ? WriteFile : WriteS3);
+        rc = i_setUpProgress(aProgress,
+                             BstrFmt(tr("Export appliance '%s'"), aLocInfo.strPath.c_str()),
+                             (aLocInfo.storageType == VFSType_File) ? WriteFile : WriteS3);
 
         /* Initialize our worker task */
         std::auto_ptr<TaskOVF> task(new TaskOVF(this, TaskOVF::Write, aLocInfo, aProgress));
@@ -728,7 +772,7 @@ HRESULT Appliance::writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLoc
 }
 
 /**
- * Called from Appliance::writeFS() for creating a XML document for this
+ * Called from Appliance::i_writeFS() for creating a XML document for this
  * Appliance.
  *
  * @param writeLock                          The current write lock.
@@ -739,11 +783,11 @@ HRESULT Appliance::writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLoc
  *                                           instance for which to write XML.
  * @param enFormat                           OVF format (0.9 or 1.0).
  */
-void Appliance::buildXML(AutoWriteLockBase& writeLock,
-                         xml::Document &doc,
-                         XMLStack &stack,
-                         const Utf8Str &strPath,
-                         ovf::OVFVersion_T enFormat)
+void Appliance::i_buildXML(AutoWriteLockBase& writeLock,
+                           xml::Document &doc,
+                           XMLStack &stack,
+                           const Utf8Str &strPath,
+                           ovf::OVFVersion_T enFormat)
 {
     xml::ElementNode *pelmRoot = doc.createRootElement("Envelope");
 
@@ -855,12 +899,12 @@ void Appliance::buildXML(AutoWriteLockBase& writeLock,
          ++it)
     {
         ComObjPtr<VirtualSystemDescription> vsdescThis = *it;
-        buildXMLForOneVirtualSystem(writeLock,
-                                    *pelmToAddVirtualSystemsTo,
-                                    &llElementsWithUuidAttributes,
-                                    vsdescThis,
-                                    enFormat,
-                                    stack);         // disks and networks stack
+        i_buildXMLForOneVirtualSystem(writeLock,
+                                      *pelmToAddVirtualSystemsTo,
+                                      &llElementsWithUuidAttributes,
+                                      vsdescThis,
+                                      enFormat,
+                                      stack);         // disks and networks stack
     }
 
     // now, fill in the network section we set up empty above according
@@ -1015,7 +1059,7 @@ void Appliance::buildXML(AutoWriteLockBase& writeLock,
 }
 
 /**
- * Called from Appliance::buildXML() for each virtual system (machine) that
+ * Called from Appliance::i_buildXML() for each virtual system (machine) that
  * needs XML written out.
  *
  * @param writeLock                          The current write lock.
@@ -1029,12 +1073,12 @@ void Appliance::buildXML(AutoWriteLockBase& writeLock,
  * @param stack                              Structure for temporary private
  *                                           data shared with caller.
  */
-void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
-                                            xml::ElementNode &elmToAddVirtualSystemsTo,
-                                            std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
-                                            ComObjPtr<VirtualSystemDescription> &vsdescThis,
-                                            ovf::OVFVersion_T enFormat,
-                                            XMLStack &stack)
+void Appliance::i_buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
+                                              xml::ElementNode &elmToAddVirtualSystemsTo,
+                                              std::list<xml::ElementNode*> *pllElementsWithUuidAttributes,
+                                              ComObjPtr<VirtualSystemDescription> &vsdescThis,
+                                              ovf::OVFVersion_T enFormat,
+                                              XMLStack &stack)
 {
     LogFlowFunc(("ENTER appliance %p\n", this));
 
@@ -1050,18 +1094,18 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
 
     /*xml::ElementNode *pelmVirtualSystemInfo =*/ pelmVirtualSystem->createChild("Info")->addContent("A virtual machine");
 
-    std::list<VirtualSystemDescriptionEntry*> llName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
+    std::list<VirtualSystemDescriptionEntry*> llName = vsdescThis->i_findByType(VirtualSystemDescriptionType_Name);
     if (!llName.size())
         throw setError(VBOX_E_NOT_SUPPORTED, tr("Missing VM name"));
     Utf8Str &strVMName = llName.back()->strVBoxCurrent;
     pelmVirtualSystem->setAttribute("ovf:id", strVMName);
 
     // product info
-    std::list<VirtualSystemDescriptionEntry*> llProduct    = vsdescThis->findByType(VirtualSystemDescriptionType_Product);
-    std::list<VirtualSystemDescriptionEntry*> llProductUrl = vsdescThis->findByType(VirtualSystemDescriptionType_ProductUrl);
-    std::list<VirtualSystemDescriptionEntry*> llVendor     = vsdescThis->findByType(VirtualSystemDescriptionType_Vendor);
-    std::list<VirtualSystemDescriptionEntry*> llVendorUrl  = vsdescThis->findByType(VirtualSystemDescriptionType_VendorUrl);
-    std::list<VirtualSystemDescriptionEntry*> llVersion    = vsdescThis->findByType(VirtualSystemDescriptionType_Version);
+    std::list<VirtualSystemDescriptionEntry*> llProduct    = vsdescThis->i_findByType(VirtualSystemDescriptionType_Product);
+    std::list<VirtualSystemDescriptionEntry*> llProductUrl = vsdescThis->i_findByType(VirtualSystemDescriptionType_ProductUrl);
+    std::list<VirtualSystemDescriptionEntry*> llVendor     = vsdescThis->i_findByType(VirtualSystemDescriptionType_Vendor);
+    std::list<VirtualSystemDescriptionEntry*> llVendorUrl  = vsdescThis->i_findByType(VirtualSystemDescriptionType_VendorUrl);
+    std::list<VirtualSystemDescriptionEntry*> llVersion    = vsdescThis->i_findByType(VirtualSystemDescriptionType_Version);
     bool fProduct    = llProduct.size()    && !llProduct.back()->strVBoxCurrent.isEmpty();
     bool fProductUrl = llProductUrl.size() && !llProductUrl.back()->strVBoxCurrent.isEmpty();
     bool fVendor     = llVendor.size()     && !llVendor.back()->strVBoxCurrent.isEmpty();
@@ -1101,7 +1145,7 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
     }
 
     // description
-    std::list<VirtualSystemDescriptionEntry*> llDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description);
+    std::list<VirtualSystemDescriptionEntry*> llDescription = vsdescThis->i_findByType(VirtualSystemDescriptionType_Description);
     if (llDescription.size() &&
         !llDescription.back()->strVBoxCurrent.isEmpty())
     {
@@ -1124,7 +1168,7 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
     }
 
     // license
-    std::list<VirtualSystemDescriptionEntry*> llLicense = vsdescThis->findByType(VirtualSystemDescriptionType_License);
+    std::list<VirtualSystemDescriptionEntry*> llLicense = vsdescThis->i_findByType(VirtualSystemDescriptionType_License);
     if (llLicense.size() &&
         !llLicense.back()->strVBoxCurrent.isEmpty())
     {
@@ -1146,7 +1190,7 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
     }
 
     // operating system
-    std::list<VirtualSystemDescriptionEntry*> llOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS);
+    std::list<VirtualSystemDescriptionEntry*> llOS = vsdescThis->i_findByType(VirtualSystemDescriptionType_OS);
     if (!llOS.size())
         throw setError(VBOX_E_NOT_SUPPORTED, tr("Missing OS type"));
     /*  <OperatingSystemSection ovf:id="82">
@@ -1234,9 +1278,9 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
     for (size_t uLoop = 1; uLoop <= 2; ++uLoop)
     {
         int32_t lIndexThis = 0;
-        list<VirtualSystemDescriptionEntry>::const_iterator itD;
-        for (itD = vsdescThis->m->llDescriptions.begin();
-            itD != vsdescThis->m->llDescriptions.end();
+        vector<VirtualSystemDescriptionEntry>::const_iterator itD;
+        for (itD = vsdescThis->m->maDescriptions.begin();
+            itD != vsdescThis->m->maDescriptions.end();
             ++itD, ++lIndexThis)
         {
             const VirtualSystemDescriptionEntry &desc = *itD;
@@ -1297,7 +1341,8 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
                         type = ovf::ResourceType_Processor; // 3
                         desc.strVBoxCurrent.toInt(uTemp);
                         lVirtualQuantity = (int32_t)uTemp;
-                        strCaption = Utf8StrFmt("%d virtual CPU", lVirtualQuantity);     // without this ovftool won't eat the item
+                        strCaption = Utf8StrFmt("%d virtual CPU", lVirtualQuantity);     // without this ovftool
+                                                                                         // won't eat the item
                     }
                 break;
 
@@ -1318,7 +1363,8 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
                         desc.strVBoxCurrent.toInt(uTemp);
                         lVirtualQuantity = (int32_t)(uTemp / _1M);
                         strAllocationUnits = "MegaBytes";
-                        strCaption = Utf8StrFmt("%d MB of memory", lVirtualQuantity);     // without this ovftool won't eat the item
+                        strCaption = Utf8StrFmt("%d MB of memory", lVirtualQuantity);     // without this ovftool
+                                                                                          // won't eat the item
                     }
                 break;
 
@@ -1427,7 +1473,8 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
                             strResourceSubType = "lsilogicsas";
                         else
                             throw setError(VBOX_E_NOT_SUPPORTED,
-                                            tr("Invalid config string \"%s\" in SCSI/SAS controller"), desc.strVBoxCurrent.c_str());
+                                           tr("Invalid config string \"%s\" in SCSI/SAS controller"),
+                                           desc.strVBoxCurrent.c_str());
 
                         // remember this ID
                         idSCSIController = ulInstanceID;
@@ -1446,7 +1493,7 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
                         </Item> */
                     if (uLoop == 2)
                     {
-                        uint32_t cDisks = stack.mapDisks.size();
+                        uint32_t cDisks = (uint32_t)stack.mapDisks.size();
                         Utf8Str strDiskID = Utf8StrFmt("vmdisk%RI32", ++cDisks);
 
                         strDescription = "Disk Image";
@@ -1476,13 +1523,15 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
                             RTStrToInt32Ex(desc.strExtraConfigCurrent.c_str() + pos2 + 8, NULL, 0, &lAddressOnParent);
 
                         LogFlowFunc(("HardDiskImage details: pos1=%d, pos2=%d, lControllerIndex=%d, lIDEPrimaryControllerIndex=%d, lIDESecondaryControllerIndex=%d, ulParent=%d, lAddressOnParent=%d\n",
-                                     pos1, pos2, lControllerIndex, lIDEPrimaryControllerIndex, lIDESecondaryControllerIndex, ulParent, lAddressOnParent));
+                                     pos1, pos2, lControllerIndex, lIDEPrimaryControllerIndex, lIDESecondaryControllerIndex,
+                                     ulParent, lAddressOnParent));
 
                         if (    !ulParent
                              || lAddressOnParent == -1
                            )
                             throw setError(VBOX_E_NOT_SUPPORTED,
-                                            tr("Missing or bad extra config string in hard disk image: \"%s\""), desc.strExtraConfigCurrent.c_str());
+                                           tr("Missing or bad extra config string in hard disk image: \"%s\""),
+                                           desc.strExtraConfigCurrent.c_str());
 
                         stack.mapDisks[strDiskID] = &desc;
                     }
@@ -1546,13 +1595,15 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
                             RTStrToInt32Ex(desc.strExtraConfigCurrent.c_str() + pos2 + 8, NULL, 0, &lAddressOnParent);
 
                         LogFlowFunc(("DVD drive details: pos1=%d, pos2=%d, lControllerIndex=%d, lIDEPrimaryControllerIndex=%d, lIDESecondaryControllerIndex=%d, ulParent=%d, lAddressOnParent=%d\n",
-                                     pos1, pos2, lControllerIndex, lIDEPrimaryControllerIndex, lIDESecondaryControllerIndex, ulParent, lAddressOnParent));
+                                     pos1, pos2, lControllerIndex, lIDEPrimaryControllerIndex,
+                                     lIDESecondaryControllerIndex, ulParent, lAddressOnParent));
 
                         if (    !ulParent
                              || lAddressOnParent == -1
                            )
                             throw setError(VBOX_E_NOT_SUPPORTED,
-                                            tr("Missing or bad extra config string in DVD drive medium: \"%s\""), desc.strExtraConfigCurrent.c_str());
+                                           tr("Missing or bad extra config string in DVD drive medium: \"%s\""),
+                                           desc.strExtraConfigCurrent.c_str());
 
                         stack.mapDisks[strDiskID] = &desc;
                         // there is no DVD drive map to update because it is
@@ -1828,7 +1879,7 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
     {
         AutoWriteLock machineLock(vsdescThis->m->pMachine COMMA_LOCKVAL_SRC_POS);
         // fill the machine config
-        vsdescThis->m->pMachine->copyMachineDataToSettings(*pConfig);
+        vsdescThis->m->pMachine->i_copyMachineDataToSettings(*pConfig);
 
         // Apply export tweaks to machine settings
         bool fStripAllMACs = m->optListExport.contains(ExportOptions_StripAllMACs);
@@ -1867,17 +1918,17 @@ void Appliance::buildXMLForOneVirtualSystem(AutoWriteLockBase& writeLock,
  * Actual worker code for writing out OVF/OVA to disk. This is called from Appliance::taskThreadWriteOVF()
  * and therefore runs on the OVF/OVA write worker thread. This runs in two contexts:
  *
- * 1) in a first worker thread; in that case, Appliance::Write() called Appliance::writeImpl();
+ * 1) in a first worker thread; in that case, Appliance::Write() called Appliance::i_writeImpl();
  *
- * 2) in a second worker thread; in that case, Appliance::Write() called Appliance::writeImpl(), which
- *    called Appliance::writeS3(), which called Appliance::writeImpl(), which then called this. In other
+ * 2) in a second worker thread; in that case, Appliance::Write() called Appliance::i_writeImpl(), which
+ *    called Appliance::i_writeS3(), which called Appliance::i_writeImpl(), which then called this. In other
  *    words, to write to the cloud, the first worker thread first starts a second worker thread to create
  *    temporary files and then uploads them to the S3 cloud server.
  *
  * @param pTask
  * @return
  */
-HRESULT Appliance::writeFS(TaskOVF *pTask)
+HRESULT Appliance::i_writeFS(TaskOVF *pTask)
 {
     LogFlowFuncEnter();
     LogFlowFunc(("ENTER appliance %p\n", this));
@@ -1889,16 +1940,16 @@ HRESULT Appliance::writeFS(TaskOVF *pTask)
 
     // Lock the media tree early to make sure nobody else tries to make changes
     // to the tree. Also lock the IAppliance object for writing.
-    AutoMultiWriteLock2 multiLock(&mVirtualBox->getMediaTreeLockHandle(), this->lockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoMultiWriteLock2 multiLock(&mVirtualBox->i_getMediaTreeLockHandle(), this->lockHandle() COMMA_LOCKVAL_SRC_POS);
     // Additional protect the IAppliance object, cause we leave the lock
     // when starting the disk export and we don't won't block other
     // callers on this lengthy operations.
     m->state = Data::ApplianceExporting;
 
     if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive))
-        rc = writeFSOVF(pTask, multiLock);
+        rc = i_writeFSOVF(pTask, multiLock);
     else
-        rc = writeFSOVA(pTask, multiLock);
+        rc = i_writeFSOVA(pTask, multiLock);
 
     // reset the state so others can call methods again
     m->state = Data::ApplianceIdle;
@@ -1908,7 +1959,7 @@ HRESULT Appliance::writeFS(TaskOVF *pTask)
     return rc;
 }
 
-HRESULT Appliance::writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
+HRESULT Appliance::i_writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
 {
     LogFlowFuncEnter();
 
@@ -1937,7 +1988,7 @@ HRESULT Appliance::writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
         storage.fSha256 = m->fSha256;
 
 
-        Utf8Str name = applianceIOName(applianceIOFile);
+        Utf8Str name = i_applianceIOName(applianceIOFile);
 
         int vrc = VDInterfaceAdd(&pFileIo->Core, name.c_str(),
                                  VDINTERFACETYPE_IO, 0, sizeof(VDINTERFACEIO),
@@ -1947,7 +1998,7 @@ HRESULT Appliance::writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
             rc = E_FAIL;
             break;
         }
-        rc = writeFSImpl(pTask, writeLock, pShaIo, &storage);
+        rc = i_writeFSImpl(pTask, writeLock, pShaIo, &storage);
     } while (0);
 
     /* Cleanup */
@@ -1960,12 +2011,12 @@ HRESULT Appliance::writeFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
     return rc;
 }
 
-HRESULT Appliance::writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
+HRESULT Appliance::i_writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
 {
     LogFlowFuncEnter();
 
     RTTAR tar;
-    int vrc = RTTarOpen(&tar, pTask->locInfo.strPath.c_str(), RTFILE_O_CREATE | RTFILE_O_WRITE | RTFILE_O_DENY_ALL, false);
+    int vrc = RTTarOpen(&tar, pTask->locInfo.strPath.c_str(), RTFILE_O_CREATE | RTFILE_O_WRITE | RTFILE_O_DENY_ALL);
     if (RT_FAILURE(vrc))
         return setError(VBOX_E_FILE_ERROR,
                         tr("Could not create OVA file '%s' (%Rrc)"),
@@ -1983,7 +2034,7 @@ HRESULT Appliance::writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
             rc = E_OUTOFMEMORY;
             break;
         }
-        pTarIo = TarCreateInterface();
+        pTarIo = tarWriterCreateInterface();
         if (!pTarIo)
         {
             rc = E_OUTOFMEMORY;
@@ -1994,7 +2045,7 @@ HRESULT Appliance::writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
         storage.fCreateDigest = m->fManifest;
         storage.fSha256 = m->fSha256;
 
-        Utf8Str name = applianceIOName(applianceIOTar);
+        Utf8Str name = i_applianceIOName(applianceIOTar);
 
         vrc = VDInterfaceAdd(&pTarIo->Core, name.c_str(),
                              VDINTERFACETYPE_IO, tar, sizeof(VDINTERFACEIO),
@@ -2005,7 +2056,7 @@ HRESULT Appliance::writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
             rc = E_FAIL;
             break;
         }
-        rc = writeFSImpl(pTask, writeLock, pShaIo, &storage);
+        rc = i_writeFSImpl(pTask, writeLock, pShaIo, &storage);
     } while (0);
 
     RTTarClose(tar);
@@ -2024,7 +2075,7 @@ HRESULT Appliance::writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
     return rc;
 }
 
-HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
+HRESULT Appliance::i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
 {
     LogFlowFuncEnter();
 
@@ -2043,11 +2094,11 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
             // Create a xml document
             xml::Document doc;
             // Now fully build a valid ovf document in memory
-            buildXML(writeLock, doc, stack, pTask->locInfo.strPath, pTask->enFormat);
+            i_buildXML(writeLock, doc, stack, pTask->locInfo.strPath, pTask->enFormat);
             /* Extract the OVA file name */
             Utf8Str strOvaFile = pTask->locInfo.strPath;
             /* Extract the path */
-            Utf8Str strOvfFile = strOvaFile.stripExt().append(".ovf");
+            Utf8Str strOvfFile = strOvaFile.stripSuffix().append(".ovf");
             // Create a memory buffer containing the XML. */
             void *pvBuf = 0;
             size_t cbSize;
@@ -2058,7 +2109,7 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
                                tr("Could not create OVF file '%s'"),
                                strOvfFile.c_str());
             /* Write the ovf file to disk. */
-            vrc = ShaWriteBuf(strOvfFile.c_str(), pvBuf, cbSize, pIfIo, pStorage);
+            vrc = writeBufferToFile(strOvfFile.c_str(), pvBuf, cbSize, pIfIo, pStorage);
             if (RT_FAILURE(vrc))
                 throw setError(VBOX_E_FILE_ERROR,
                                tr("Could not create OVF file '%s' (%Rrc)"),
@@ -2072,12 +2123,12 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
         ComObjPtr<MediumFormat> format;
         // Scope for the AutoReadLock
         {
-            SystemProperties *pSysProps = mVirtualBox->getSystemProperties();
+            SystemProperties *pSysProps = mVirtualBox->i_getSystemProperties();
             AutoReadLock propsLock(pSysProps COMMA_LOCKVAL_SRC_POS);
             // We are always exporting to VMDK stream optimized for now
-            formatTemp = pSysProps->mediumFormatFromExtension("iso");
+            formatTemp = pSysProps->i_mediumFormatFromExtension("iso");
 
-            format = pSysProps->mediumFormat("VMDK");
+            format = pSysProps->i_mediumFormat("VMDK");
             if (format.isNull())
                 throw setError(VBOX_E_NOT_SUPPORTED,
                                tr("Invalid medium storage format"));
@@ -2110,16 +2161,16 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
 
             if (pDiskEntry->type == VirtualSystemDescriptionType_HardDiskImage)
             {
-                rc = mVirtualBox->findHardDiskByLocation(strSrcFilePath, true, &pSourceDisk);
+                rc = mVirtualBox->i_findHardDiskByLocation(strSrcFilePath, true, &pSourceDisk);
                 if (FAILED(rc)) throw rc;
             }
             else//may be CD or DVD
             {
-                rc = mVirtualBox->findDVDOrFloppyImage(DeviceType_DVD,
-                                                       NULL,
-                                                       strSrcFilePath,
-                                                       true,
-                                                       &pSourceDisk);
+                rc = mVirtualBox->i_findDVDOrFloppyImage(DeviceType_DVD,
+                                                         NULL,
+                                                         strSrcFilePath,
+                                                         true,
+                                                         &pSourceDisk);
                 if (FAILED(rc)) throw rc;
             }
 
@@ -2141,32 +2192,39 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
             try
             {
                 // advance to the next operation
-                pTask->pProgress->SetNextOperation(BstrFmt(tr("Exporting to disk image '%s'"), RTPathFilename(strTargetFilePath.c_str())).raw(),
-                                                   pDiskEntry->ulSizeMB);     // operation's weight, as set up with the IProgress originally
+                pTask->pProgress->SetNextOperation(BstrFmt(tr("Exporting to disk image '%s'"),
+                                                           RTPathFilename(strTargetFilePath.c_str())).raw(),
+                                                   pDiskEntry->ulSizeMB);     // operation's weight, as set up
+                                                                              // with the IProgress originally
 
                 // create a flat copy of the source disk image
                 if (pDiskEntry->type == VirtualSystemDescriptionType_HardDiskImage)
                 {
                     ComObjPtr<Progress> pProgress2;
                     pProgress2.createObject();
-                    rc = pProgress2->init(mVirtualBox, static_cast<IAppliance*>(this), BstrFmt(tr("Creating medium '%s'"), strTargetFilePath.c_str()).raw(), TRUE);
+                    rc = pProgress2->init(mVirtualBox, static_cast<IAppliance*>(this),
+                                          BstrFmt(tr("Creating medium '%s'"),
+                                          strTargetFilePath.c_str()).raw(), TRUE);
                     if (FAILED(rc)) throw rc;
 
-                    rc = pSourceDisk->exportFile(strTargetFilePath.c_str(),
-                                                 format,
-                                                 MediumVariant_VmdkStreamOptimized,
-                                                 pIfIo,
-                                                 pStorage,
-                                                 pProgress2);
+                    rc = pSourceDisk->i_exportFile(strTargetFilePath.c_str(),
+                                                   format,
+                                                   MediumVariant_VmdkStreamOptimized,
+                                                   m->m_pSecretKeyStore,
+                                                   pIfIo,
+                                                   pStorage,
+                                                   pProgress2);
                     if (FAILED(rc)) throw rc;
 
                     ComPtr<IProgress> pProgress3(pProgress2);
                     // now wait for the background disk operation to complete; this throws HRESULTs on error
-                    waitForAsyncProgress(pTask->pProgress, pProgress3);
+                    i_waitForAsyncProgress(pTask->pProgress, pProgress3);
                 }
-                else//pDiskEntry->type == VirtualSystemDescriptionType_CDROM
+                else
                 {
                     //copy/clone CD/DVD image
+                    Assert(pDiskEntry->type == VirtualSystemDescriptionType_CDROM);
+
                     /* Read the ISO file and add one to OVA/OVF package */
                     {
                         void *pvStorage;
@@ -2194,53 +2252,46 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
                                            strSrcFilePath.c_str(), vrc);
                         }
 
-                        void *pvTmpBuf = 0;
-                        size_t cbTmpSize = _1M;
-                        uint64_t cbAllWritten = 0;
                         uint64_t cbFile = 0;
-                        size_t cbSize = 0;
-
                         vrc = RTFileGetSize(pFile, &cbFile);
-
-                        do
+                        if (RT_SUCCESS(vrc))
                         {
-                            pvTmpBuf = RTMemAlloc(cbTmpSize);
-                            if (!pvTmpBuf)
-                            {
-                                vrc = VERR_NO_MEMORY;
-                                break;
-                            }
-
-                            for (;;)
+                            size_t const cbTmpSize = _1M;
+                            void *pvTmpBuf = RTMemAlloc(cbTmpSize);
+                            if (pvTmpBuf)
                             {
-                                // copy raw data into the buffer pvTmpBuf
-                                vrc = RTFileRead(pFile, pvTmpBuf, cbTmpSize, &cbSize);
-
-                                if (RT_FAILURE(vrc) || cbSize == 0)
-                                    break;
-
-                                size_t cbToWrite = cbSize;
-                                size_t cbWritten = 0;
-
-                                vrc = pIfIo->pfnWriteSync(pvUser,
-                                                         pvStorage,
-                                                         cbAllWritten,
-                                                         pvTmpBuf,
-                                                         cbToWrite,&cbWritten);
-
-                                if (RT_FAILURE(vrc))
-                                    break;
-
-                                cbAllWritten += cbWritten;
+                                /* The copy loop. */
+                                uint64_t offDstFile = 0;
+                                for (;;)
+                                {
+                                    size_t cbChunk = 0;
+                                    vrc = RTFileRead(pFile, pvTmpBuf, cbTmpSize, &cbChunk);
+                                    if (RT_FAILURE(vrc) || cbChunk == 0)
+                                        break;
+
+                                    size_t cbWritten = 0;
+                                    vrc = pIfIo->pfnWriteSync(pvUser,
+                                                              pvStorage,
+                                                              offDstFile,
+                                                              pvTmpBuf,
+                                                              cbChunk,
+                                                              &cbWritten);
+                                    if (RT_FAILURE(vrc))
+                                        break;
+                                    Assert(cbWritten == cbChunk);
+
+                                    offDstFile += cbWritten;
+                                }
+
+                                RTMemFree(pvTmpBuf);
                             }
-                        } while (0);
+                            else
+                                vrc = VERR_NO_MEMORY;
+                        }
 
                         pIfIo->pfnClose(pvUser, pvStorage);
                         RTFileClose(pFile);
 
-                        if (pvTmpBuf)
-                            RTMemFree(pvTmpBuf);
-
                         if (RT_FAILURE(vrc))
                         {
                             if (vrc == VERR_EOF)
@@ -2268,10 +2319,11 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
         if (m->fManifest)
         {
             // Create & write the manifest file
-            Utf8Str strMfFilePath = Utf8Str(pTask->locInfo.strPath).stripExt().append(".mf");
+            Utf8Str strMfFilePath = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf");
             Utf8Str strMfFileName = Utf8Str(strMfFilePath).stripPath();
             pTask->pProgress->SetNextOperation(BstrFmt(tr("Creating manifest file '%s'"), strMfFileName.c_str()).raw(),
-                                               m->ulWeightForManifestOperation);     // operation's weight, as set up with the IProgress originally);
+                                               m->ulWeightForManifestOperation);     // operation's weight, as set up
+                                                                                     // with the IProgress originally);
             PRTMANIFESTTEST paManifestFiles = (PRTMANIFESTTEST)RTMemAlloc(sizeof(RTMANIFESTTEST) * fileList.size());
             size_t i = 0;
             list<STRPAIR>::const_iterator it1;
@@ -2294,7 +2346,7 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
             /* Disable digest creation for the manifest file. */
             pStorage->fCreateDigest = false;
             /* Write the manifest file to disk. */
-            vrc = ShaWriteBuf(strMfFilePath.c_str(), pvBuf, cbSize, pIfIo, pStorage);
+            vrc = writeBufferToFile(strMfFilePath.c_str(), pvBuf, cbSize, pIfIo, pStorage);
             RTMemFree(pvBuf);
             if (RT_FAILURE(vrc))
                 throw setError(VBOX_E_FILE_ERROR,
@@ -2332,12 +2384,12 @@ HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVD
 /**
  * Worker code for writing out OVF to the cloud. This is called from Appliance::taskThreadWriteOVF()
  * in S3 mode and therefore runs on the OVF write worker thread. This then starts a second worker
- * thread to create temporary files (see Appliance::writeFS()).
+ * thread to create temporary files (see Appliance::i_writeFS()).
  *
  * @param pTask
  * @return
  */
-HRESULT Appliance::writeS3(TaskOVF *pTask)
+HRESULT Appliance::i_writeS3(TaskOVF *pTask)
 {
     LogFlowFuncEnter();
     LogFlowFunc(("Appliance %p\n", this));
@@ -2365,7 +2417,7 @@ HRESULT Appliance::writeS3(TaskOVF *pTask)
         /* Extract the bucket */
         Utf8Str tmpPath = pTask->locInfo.strPath;
         Utf8Str bucket;
-        parseBucket(tmpPath, bucket);
+        i_parseBucket(tmpPath, bucket);
 
         /* We need a temporary directory which we can put the OVF file & all
          * disk images in */
@@ -2382,7 +2434,7 @@ HRESULT Appliance::writeS3(TaskOVF *pTask)
         /* Create a temporary file based location info for the sub task */
         LocationInfo li;
         li.strPath = strTmpOvf;
-        rc = writeImpl(pTask->enFormat, li, progress);
+        rc = i_writeImpl(pTask->enFormat, li, progress);
         if (FAILED(rc)) throw rc;
 
         /* Unlock the appliance for the writing thread */
@@ -2390,7 +2442,7 @@ HRESULT Appliance::writeS3(TaskOVF *pTask)
         /* Wait until the writing is done, but report the progress back to the
            caller */
         ComPtr<IProgress> progressInt(progress);
-        waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
+        i_waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
 
         /* Again lock the appliance for the next steps */
         appLock.acquire();
@@ -2400,12 +2452,14 @@ HRESULT Appliance::writeS3(TaskOVF *pTask)
             throw setError(VBOX_E_FILE_ERROR,
                            tr("Cannot find source file '%s' (%Rrc)"), strTmpOvf.c_str(), vrc);
         /* Add the OVF file */
-        filesList.push_back(pair<Utf8Str, ULONG>(strTmpOvf, m->ulWeightForXmlOperation)); /* Use 1% of the total for the OVF file upload */
+        filesList.push_back(pair<Utf8Str, ULONG>(strTmpOvf, m->ulWeightForXmlOperation)); /* Use 1% of the
+                                                                                             total for the OVF file upload */
         /* Add the manifest file */
         if (m->fManifest)
         {
-            Utf8Str strMfFile = Utf8Str(strTmpOvf).stripExt().append(".mf");
-            filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total for the manifest file upload */
+            Utf8Str strMfFile = Utf8Str(strTmpOvf).stripSuffix().append(".mf");
+            filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total
+                                                                                                  for the manifest file upload */
         }
 
         /* Now add every disks of every virtual system */
@@ -2415,7 +2469,8 @@ HRESULT Appliance::writeS3(TaskOVF *pTask)
              ++it)
         {
             ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
-            std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
+            std::list<VirtualSystemDescriptionEntry*> avsdeHDs =
+                vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
             std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
             for (itH = avsdeHDs.begin();
                  itH != avsdeHDs.end();
@@ -2435,7 +2490,8 @@ HRESULT Appliance::writeS3(TaskOVF *pTask)
             }
         }
         /* Next we have to upload the OVF & all disk images */
-        vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(), pTask->locInfo.strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
+        vrc = RTS3Create(&hS3, pTask->locInfo.strUsername.c_str(), pTask->locInfo.strPassword.c_str(),
+                         pTask->locInfo.strHostname.c_str(), "virtualbox-agent/" VBOX_VERSION_STRING);
         if (RT_FAILURE(vrc))
             throw setError(VBOX_E_IPRT_ERROR,
                            tr("Cannot create S3 service handler"));
diff --git a/src/VBox/Main/src-server/ApplianceImplIO.cpp b/src/VBox/Main/src-server/ApplianceImplIO.cpp
index 1a9ac12..10b22c9 100644
--- a/src/VBox/Main/src-server/ApplianceImplIO.cpp
+++ b/src/VBox/Main/src-server/ApplianceImplIO.cpp
@@ -36,6 +36,9 @@
 #include <VBox/vd-ifs.h>
 #include <VBox/vd.h>
 
+#include "Logging.h"
+
+
 /******************************************************************************
  *   Structures and Typedefs                                                  *
  ******************************************************************************/
@@ -50,11 +53,12 @@ typedef struct FILESTORAGEINTERNAL
 typedef struct TARSTORAGEINTERNAL
 {
     /** Tar handle. */
-    RTTARFILE      file;
+    RTTARFILE      hTarFile;
     /** Completion callback. */
     PFNVDCOMPLETED pfnCompleted;
 } TARSTORAGEINTERNAL, *PTARSTORAGEINTERNAL;
 
+
 typedef struct SHASTORAGEINTERNAL
 {
     /** Completion callback. */
@@ -118,6 +122,70 @@ typedef struct SHASTORAGEINTERNAL
  ******************************************************************************/
 
 
+/** @name VDINTERFACEIO stubs returning not-implemented.
+ * @{
+ */
+
+/** @interface_method_impl{VDINTERFACEIO,pfnDelete}  */
+static DECLCALLBACK(int) notImpl_Delete(void *pvUser, const char *pcszFilename)
+{
+    NOREF(pvUser); NOREF(pcszFilename);
+    Log(("%s\n",  __FUNCTION__)); DEBUG_PRINT_FLOW();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+/** @interface_method_impl{VDINTERFACEIO,pfnMove}  */
+static DECLCALLBACK(int) notImpl_Move(void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned fMove)
+{
+    NOREF(pvUser); NOREF(pcszSrc); NOREF(pcszDst); NOREF(fMove);
+    Log(("%s\n",  __FUNCTION__)); DEBUG_PRINT_FLOW();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+/** @interface_method_impl{VDINTERFACEIO,pfnGetFreeSpace}  */
+static DECLCALLBACK(int) notImpl_GetFreeSpace(void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace)
+{
+    NOREF(pvUser); NOREF(pcszFilename); NOREF(pcbFreeSpace);
+    Log(("%s\n",  __FUNCTION__)); DEBUG_PRINT_FLOW();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+/** @interface_method_impl{VDINTERFACEIO,pfnGetModificationTime}  */
+static DECLCALLBACK(int) notImpl_GetModificationTime(void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime)
+{
+    NOREF(pvUser); NOREF(pcszFilename); NOREF(pModificationTime);
+    Log(("%s\n",  __FUNCTION__)); DEBUG_PRINT_FLOW();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+/** @interface_method_impl{VDINTERFACEIO,pfnSetSize}  */
+static DECLCALLBACK(int) notImpl_SetSize(void *pvUser, void *pvStorage, uint64_t cb)
+{
+    NOREF(pvUser); NOREF(pvStorage); NOREF(cb);
+    Log(("%s\n",  __FUNCTION__)); DEBUG_PRINT_FLOW();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+/** @interface_method_impl{VDINTERFACEIO,pfnWriteSync}  */
+static DECLCALLBACK(int) notImpl_WriteSync(void *pvUser, void *pvStorage, uint64_t off, const void *pvBuf,
+                                           size_t cbWrite, size_t *pcbWritten)
+{
+    NOREF(pvUser); NOREF(pvStorage); NOREF(off); NOREF(pvBuf); NOREF(cbWrite); NOREF(pcbWritten);
+    Log(("%s\n",  __FUNCTION__)); DEBUG_PRINT_FLOW();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+/** @interface_method_impl{VDINTERFACEIO,pfnFlushSync}  */
+static DECLCALLBACK(int) notImpl_FlushSync(void *pvUser, void *pvStorage)
+{
+    NOREF(pvUser); NOREF(pvStorage);
+    Log(("%s\n",  __FUNCTION__)); DEBUG_PRINT_FLOW();
+    return VERR_NOT_IMPLEMENTED;
+}
+
+/** @} */
+
+
 /******************************************************************************
  *   Internal: RTFile interface
  ******************************************************************************/
@@ -260,91 +328,45 @@ static int fileFlushSyncCallback(void * /* pvUser */, void *pvStorage)
     return RTFileFlush(pInt->file);
 }
 
-/******************************************************************************
- *   Internal: RTTar interface
- ******************************************************************************/
 
-static int tarOpenCallback(void *pvUser, const char *pszLocation, uint32_t fOpen,
-                             PFNVDCOMPLETED pfnCompleted, void **ppInt)
+/** @name VDINTERFACEIO implementation that writes TAR files via RTTar.
+ * @{ */
+
+static DECLCALLBACK(int) tarWriter_Open(void *pvUser, const char *pszLocation, uint32_t fOpen,
+                                        PFNVDCOMPLETED pfnCompleted, void **ppInt)
 {
     /* Validate input. */
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     AssertPtrReturn(ppInt, VERR_INVALID_POINTER);
     AssertPtrNullReturn(pfnCompleted, VERR_INVALID_PARAMETER);
-//    AssertReturn(!(fOpen & RTFILE_O_READWRITE), VERR_INVALID_PARAMETER);
-
-    RTTAR tar = (RTTAR)pvUser;
+    AssertReturn(fOpen & RTFILE_O_WRITE, VERR_INVALID_PARAMETER); /* Only for writing. */
 
     DEBUG_PRINT_FLOW();
 
+    /*
+     * Allocate a storage handle.
+     */
+    int rc;
     PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)RTMemAllocZ(sizeof(TARSTORAGEINTERNAL));
-    if (!pInt)
-        return VERR_NO_MEMORY;
-
-    pInt->pfnCompleted = pfnCompleted;
-
-    int rc = VINF_SUCCESS;
-
-    if (fOpen & RTFILE_O_READ
-        && !(fOpen & RTFILE_O_WRITE))
+    if (pInt)
     {
-        /* Read only is a little bit more complicated than writing, cause we
-         * need streaming functionality. First try to open the file on the
-         * current file position. If this is the file the caller requested, we
-         * are fine. If not seek to the next file in the stream and check
-         * again. This is repeated until EOF of the OVA. */
+        pInt->pfnCompleted = pfnCompleted;
+
         /*
-         *
-         *
-         *  TODO: recheck this with more VDMKs (or what else) in an test OVA.
-         *
-         *
+         * Try open the file.
          */
-        bool fFound = false;
-
-        for (;;)
-        {
-            char *pszFilename = 0;
-            rc = RTTarCurrentFile(tar, &pszFilename);
-            if (RT_SUCCESS(rc))
-            {
-                if (rc == VINF_TAR_DIR_PATH)
-                {
-                    break;
-                }
-
-                fFound = !RTStrICmp(pszFilename, pszLocation);
-
-                RTStrFree(pszFilename);
-                if (fFound)
-                    break;
-                else
-                {
-                    rc = RTTarSeekNextFile(tar);
-                    if (RT_FAILURE(rc))
-                    {
-                        break;
-                    }
-                }
-            }
-            else
-                break;
-        }
-        if (fFound)
-            rc = RTTarFileOpenCurrentFile(tar, &pInt->file, 0, fOpen);
+        rc = RTTarFileOpen((RTTAR)pvUser, &pInt->hTarFile, RTPathFilename(pszLocation), fOpen);
+        if (RT_SUCCESS(rc))
+            *ppInt = pInt;
+        else
+            RTMemFree(pInt);
     }
     else
-        rc = RTTarFileOpen(tar, &pInt->file, RTPathFilename(pszLocation), fOpen);
-
-    if (RT_FAILURE(rc))
-        RTMemFree(pInt);
-    else
-        *ppInt = pInt;
-
+        rc = VERR_NO_MEMORY;
     return rc;
 }
 
-static int tarCloseCallback(void *pvUser, void *pvStorage)
+static DECLCALLBACK(int) tarWriter_Close(void *pvUser, void *pvStorage)
 {
     /* Validate input. */
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
@@ -354,7 +376,8 @@ static int tarCloseCallback(void *pvUser, void *pvStorage)
 
     DEBUG_PRINT_FLOW();
 
-    int rc = RTTarFileClose(pInt->file);
+    int rc = RTTarFileClose(pInt->hTarFile);
+    pInt->hTarFile = NIL_RTTARFILE;
 
     /* Cleanup */
     RTMemFree(pInt);
@@ -362,118 +385,431 @@ static int tarCloseCallback(void *pvUser, void *pvStorage)
     return rc;
 }
 
-static int tarDeleteCallback(void *pvUser, const char *pcszFilename)
+static DECLCALLBACK(int) tarWriter_GetSize(void *pvUser, void *pvStorage, uint64_t *pcbSize)
 {
+    /** @todo Not sure if this is really required, but it's not a biggie to keep
+     *        around. */
     /* Validate input. */
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pcszFilename, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
+
+    PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)pvStorage;
 
     DEBUG_PRINT_FLOW();
 
-    return VERR_NOT_IMPLEMENTED;
+    return RTTarFileGetSize(pInt->hTarFile, pcbSize);
 }
 
-static int tarMoveCallback(void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned /* fMove */)
+static DECLCALLBACK(int) tarWriter_SetSize(void *pvUser, void *pvStorage, uint64_t cbSize)
 {
     /* Validate input. */
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pcszSrc, VERR_INVALID_POINTER);
-    AssertPtrReturn(pcszDst, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
+
+    PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)pvStorage;
 
     DEBUG_PRINT_FLOW();
 
-    return VERR_NOT_IMPLEMENTED;
+    return RTTarFileSetSize(pInt->hTarFile, cbSize);
 }
 
-static int tarGetFreeSpaceCallback(void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace)
+static DECLCALLBACK(int) tarWriter_WriteSync(void *pvUser, void *pvStorage, uint64_t uOffset,
+                                             const void *pvBuf, size_t cbWrite, size_t *pcbWritten)
 {
     /* Validate input. */
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pcszFilename, VERR_INVALID_POINTER);
-    AssertPtrReturn(pcbFreeSpace, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
+
+    PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)pvStorage;
 
     DEBUG_PRINT_FLOW();
 
-    return VERR_NOT_IMPLEMENTED;
+    return RTTarFileWriteAt(pInt->hTarFile, uOffset, pvBuf, cbWrite, pcbWritten);
 }
 
-static int tarGetModificationTimeCallback(void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime)
+static DECLCALLBACK(int) tarWriter_ReadSync(void *pvUser, void *pvStorage, uint64_t uOffset,
+                                            void *pvBuf, size_t cbRead, size_t *pcbRead)
 {
+    /** @todo Not sure if this is really required, but it's not a biggie to keep
+     *        around. */
     /* Validate input. */
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pcszFilename, VERR_INVALID_POINTER);
-    AssertPtrReturn(pModificationTime, VERR_INVALID_POINTER);
+    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
 
-    DEBUG_PRINT_FLOW();
+    PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)pvStorage;
 
-    return VERR_NOT_IMPLEMENTED;
+//    DEBUG_PRINT_FLOW();
+
+    return RTTarFileReadAt(pInt->hTarFile, uOffset, pvBuf, cbRead, pcbRead);
 }
 
-static int tarGetSizeCallback(void *pvUser, void *pvStorage, uint64_t *pcbSize)
+
+PVDINTERFACEIO tarWriterCreateInterface(void)
 {
-    /* Validate input. */
-    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
+    PVDINTERFACEIO pCallbacks = (PVDINTERFACEIO)RTMemAllocZ(sizeof(VDINTERFACEIO));
+    if (!pCallbacks)
+        return NULL;
 
-    PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)pvStorage;
+    pCallbacks->pfnOpen                = tarWriter_Open;
+    pCallbacks->pfnClose               = tarWriter_Close;
+    pCallbacks->pfnDelete              = notImpl_Delete;
+    pCallbacks->pfnMove                = notImpl_Move;
+    pCallbacks->pfnGetFreeSpace        = notImpl_GetFreeSpace;
+    pCallbacks->pfnGetModificationTime = notImpl_GetModificationTime;
+    pCallbacks->pfnGetSize             = tarWriter_GetSize;
+    pCallbacks->pfnSetSize             = tarWriter_SetSize;
+    pCallbacks->pfnReadSync            = tarWriter_ReadSync;
+    pCallbacks->pfnWriteSync           = tarWriter_WriteSync;
+    pCallbacks->pfnFlushSync           = notImpl_FlushSync;
+
+    return pCallbacks;
+}
+
+/** @} */
+
+
+/** @name VDINTERFACEIO implementation on top of an IPRT file system stream.
+ * @{ */
+
+/**
+ * Internal data for read only I/O stream (related to FSSRDONLYINTERFACEIO).
+ */
+typedef struct IOSRDONLYINTERNAL
+{
+    /** The I/O stream. */
+    RTVFSIOSTREAM   hVfsIos;
+    /** Completion callback. */
+    PFNVDCOMPLETED  pfnCompleted;
+} IOSRDONLYINTERNAL, *PIOSRDONLYINTERNAL;
+
+/**
+ * Extended VD I/O interface structure that fssRdOnly uses.
+ *
+ * It's passed as pvUser to each call.
+ */
+typedef struct FSSRDONLYINTERFACEIO
+{
+    VDINTERFACEIO   CoreIo;
+
+    /** The file system stream object. */
+    RTVFSFSSTREAM   hVfsFss;
+    /** Set if we've seen VERR_EOF on the file system stream already. */
+    bool            fEndOfFss;
+
+    /** The current object in the stream. */
+    RTVFSOBJ        hVfsCurObj;
+    /** The name of the current object. */
+    char           *pszCurName;
+    /** The type of the current object. */
+    RTVFSOBJTYPE    enmCurType;
+
+} FSSRDONLYINTERFACEIO;
+
+
+/** @interface_method_impl{VDINTERFACEIO,pfnOpen}  */
+static DECLCALLBACK(int) fssRdOnly_Open(void *pvUser, const char *pszLocation, uint32_t fOpen,
+                                        PFNVDCOMPLETED pfnCompleted, void **ppInt)
+{
+    PFSSRDONLYINTERFACEIO pThis = (PFSSRDONLYINTERFACEIO)pvUser;
+
+    /*
+     * Validate input.
+     */
+    AssertPtrReturn(ppInt, VERR_INVALID_POINTER);
+    AssertPtrNullReturn(pfnCompleted, VERR_INVALID_PARAMETER);
+    AssertReturn((fOpen & RTFILE_O_ACCESS_MASK) == RTFILE_O_READ, VERR_INVALID_PARAMETER);
 
     DEBUG_PRINT_FLOW();
 
-    return RTTarFileGetSize(pInt->file, pcbSize);
+    /*
+     * Scan the stream until a matching file is found.
+     */
+    for (;;)
+    {
+        if (pThis->hVfsCurObj != NIL_RTVFSOBJ)
+        {
+            if (RTStrICmp(pThis->pszCurName, pszLocation) == 0)
+            {
+                switch (pThis->enmCurType)
+                {
+                    case RTVFSOBJTYPE_IO_STREAM:
+                    case RTVFSOBJTYPE_FILE:
+                    {
+                        PIOSRDONLYINTERNAL pFile = (PIOSRDONLYINTERNAL)RTMemAlloc(sizeof(*pFile));
+                        if (!pFile)
+                            return VERR_NO_MEMORY;
+                        pFile->hVfsIos      = RTVfsObjToIoStream(pThis->hVfsCurObj);
+                        pFile->pfnCompleted = pfnCompleted;
+                        *ppInt = pFile;
+
+                        /* Force stream to be advanced on next open call. */
+                        RTVfsObjRelease(pThis->hVfsCurObj);
+                        pThis->hVfsCurObj = NIL_RTVFSOBJ;
+                        RTStrFree(pThis->pszCurName);
+                        pThis->pszCurName = NULL;
+
+                        return VINF_SUCCESS;
+                    }
+
+                    case RTVFSOBJTYPE_DIR:
+                        return VERR_IS_A_DIRECTORY;
+                    default:
+                        return VERR_UNEXPECTED_FS_OBJ_TYPE;
+                }
+            }
+
+            /*
+             * Drop the current stream object.
+             */
+            RTVfsObjRelease(pThis->hVfsCurObj);
+            pThis->hVfsCurObj = NIL_RTVFSOBJ;
+            RTStrFree(pThis->pszCurName);
+            pThis->pszCurName = NULL;
+        }
+
+        /*
+         * Fetch the next object in the stream.
+         */
+        if (pThis->fEndOfFss)
+            return VERR_FILE_NOT_FOUND;
+        int rc = RTVfsFsStrmNext(pThis->hVfsFss, &pThis->pszCurName, &pThis->enmCurType, &pThis->hVfsCurObj);
+        if (RT_FAILURE(rc))
+        {
+            pThis->fEndOfFss = rc == VERR_EOF;
+            return rc == VERR_EOF ? VERR_FILE_NOT_FOUND : rc;
+        }
+    }
 }
 
-static int tarSetSizeCallback(void *pvUser, void *pvStorage, uint64_t cbSize)
+/** @interface_method_impl{VDINTERFACEIO,pfnClose}  */
+static int fssRdOnly_Close(void *pvUser, void *pvStorage)
 {
-    /* Validate input. */
+    PIOSRDONLYINTERNAL      pFile = (PIOSRDONLYINTERNAL)pvStorage;
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
+    AssertPtrReturn(pFile, VERR_INVALID_POINTER);
+    DEBUG_PRINT_FLOW();
+
+    uint32_t cRefs = RTVfsIoStrmRelease(pFile->hVfsIos);
+    pFile->hVfsIos = NIL_RTVFSIOSTREAM;
+    RTMemFree(pFile);
+
+    return cRefs != UINT32_MAX ? VINF_SUCCESS : VERR_INTERNAL_ERROR_3;
+}
 
-    PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)pvStorage;
 
+/** @interface_method_impl{VDINTERFACEIO,pfnGetSize}  */
+static DECLCALLBACK(int) fssRdOnly_GetSize(void *pvUser, void *pvStorage, uint64_t *pcb)
+{
+    PIOSRDONLYINTERNAL      pFile = (PIOSRDONLYINTERNAL)pvStorage;
+    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
+    AssertPtrReturn(pFile, VERR_INVALID_POINTER);
+    AssertPtrReturn(pcb, VERR_INVALID_POINTER);
     DEBUG_PRINT_FLOW();
 
-    return RTTarFileSetSize(pInt->file, cbSize);
+    RTFSOBJINFO ObjInfo;
+    int rc = RTVfsIoStrmQueryInfo(pFile->hVfsIos, &ObjInfo, RTFSOBJATTRADD_NOTHING);
+    if (RT_SUCCESS(rc))
+        *pcb = ObjInfo.cbObject;
+    return rc;
 }
 
-static int tarWriteSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
-                                  const void *pvBuf, size_t cbWrite, size_t *pcbWritten)
+/** @interface_method_impl{VDINTERFACEIO,pfnRead}  */
+static DECLCALLBACK(int) fssRdOnly_ReadSync(void *pvUser, void *pvStorage, uint64_t off, void *pvBuf,
+                                            size_t cbToRead, size_t *pcbRead)
 {
-    /* Validate input. */
+    PIOSRDONLYINTERNAL      pFile = (PIOSRDONLYINTERNAL)pvStorage;
     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
+    AssertPtrReturn(pFile, VERR_INVALID_POINTER);
+    AssertPtrNullReturn(pcbRead, VERR_INVALID_POINTER);
+    DEBUG_PRINT_FLOW();
 
-    PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)pvStorage;
+    return RTVfsIoStrmReadAt(pFile->hVfsIos, off, pvBuf, cbToRead, true /*fBlocking*/, pcbRead);
+}
 
-    DEBUG_PRINT_FLOW();
 
-    return RTTarFileWriteAt(pInt->file, uOffset, pvBuf, cbWrite, pcbWritten);
+/**
+ * Opens the specified tar file for stream-like reading, returning a VD I/O
+ * interface to it.
+ *
+ * @returns VBox status code.
+ * @param   pszFilename         The path to the TAR file.
+ * @param   ppTarIo             Where to return the VD I/O interface.  This
+ *                              shall be passed as pvUser when using the
+ *                              interface.
+ *
+ *                              Pass to fssRdOnlyDestroyInterface for cleaning
+ *                              up!
+ */
+int fssRdOnlyCreateInterfaceForTarFile(const char *pszFilename, PFSSRDONLYINTERFACEIO *ppTarIo)
+{
+    /*
+     * Open the tar file first.
+     */
+    RTVFSFILE hVfsFile;
+    int rc = RTVfsFileOpenNormal(pszFilename, RTFILE_O_READ | RTFILE_O_DENY_NONE | RTFILE_O_OPEN, &hVfsFile);
+    if (RT_SUCCESS(rc))
+    {
+        RTVFSIOSTREAM hVfsIos = RTVfsFileToIoStream(hVfsFile);
+        RTVFSFSSTREAM hVfsFss;
+        rc = RTZipTarFsStreamFromIoStream(hVfsIos, 0 /*fFlags*/, &hVfsFss);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Allocate and init a callback + instance data structure.
+             */
+            PFSSRDONLYINTERFACEIO pThis = (PFSSRDONLYINTERFACEIO)RTMemAllocZ(sizeof(*pThis));
+            if (pThis)
+            {
+                pThis->CoreIo.pfnOpen                = fssRdOnly_Open;
+                pThis->CoreIo.pfnClose               = fssRdOnly_Close;
+                pThis->CoreIo.pfnDelete              = notImpl_Delete;
+                pThis->CoreIo.pfnMove                = notImpl_Move;
+                pThis->CoreIo.pfnGetFreeSpace        = notImpl_GetFreeSpace;
+                pThis->CoreIo.pfnGetModificationTime = notImpl_GetModificationTime;
+                pThis->CoreIo.pfnGetSize             = fssRdOnly_GetSize;
+                pThis->CoreIo.pfnSetSize             = notImpl_SetSize;
+                pThis->CoreIo.pfnReadSync            = fssRdOnly_ReadSync;
+                pThis->CoreIo.pfnWriteSync           = notImpl_WriteSync;
+                pThis->CoreIo.pfnFlushSync           = notImpl_FlushSync;
+
+                pThis->hVfsFss    = hVfsFss;
+                pThis->fEndOfFss  = false;
+                pThis->hVfsCurObj = NIL_RTVFSOBJ;
+                pThis->pszCurName = NULL;
+                pThis->enmCurType = RTVFSOBJTYPE_INVALID;
+
+                *ppTarIo = pThis;
+                return VINF_SUCCESS;
+            }
+
+            RTVfsFsStrmRelease(hVfsFss);
+        }
+        RTVfsIoStrmRelease(hVfsIos);
+        RTVfsFileRelease(hVfsFile);
+    }
+
+    *ppTarIo = NULL;
+    return rc;
 }
 
-static int tarReadSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
-                                 void *pvBuf, size_t cbRead, size_t *pcbRead)
+/**
+ * Destroys a read-only FSS interface.
+ *
+ * @param   pFssIo              What TarFssCreateReadOnlyInterfaceForFile
+ *                              returned.
+ */
+void fssRdOnlyDestroyInterface(PFSSRDONLYINTERFACEIO pFssIo)
 {
-    /* Validate input. */
-    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
+    AssertPtr(pFssIo); AssertPtr(pFssIo->hVfsFss);
 
-    PTARSTORAGEINTERNAL pInt = (PTARSTORAGEINTERNAL)pvStorage;
+    RTVfsFsStrmRelease(pFssIo->hVfsFss);
+    pFssIo->hVfsFss = NIL_RTVFSFSSTREAM;
 
-//    DEBUG_PRINT_FLOW();
+    RTVfsObjRelease(pFssIo->hVfsCurObj);
+    pFssIo->hVfsCurObj = NIL_RTVFSOBJ;
+
+    RTStrFree(pFssIo->pszCurName);
+    pFssIo->pszCurName = NULL;
 
-    return RTTarFileReadAt(pInt->file, uOffset, pvBuf, cbRead, pcbRead);
+    RTMemFree(pFssIo);
 }
 
-static int tarFlushSyncCallback(void *pvUser, void *pvStorage)
+
+/**
+ * Returns the read-only name of the current stream object.
+ *
+ * @returns VBox status code.
+ * @param   pFssIo              What TarFssCreateReadOnlyInterfaceForFile
+ *                              returned.
+ * @param   ppszName            Where to return the filename.  DO NOT FREE!
+ */
+int fssRdOnlyGetCurrentName(PFSSRDONLYINTERFACEIO pFssIo, const char **ppszName)
 {
-    /* Validate input. */
-    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
-    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
+    AssertPtr(pFssIo); AssertPtr(pFssIo->hVfsFss);
 
-    DEBUG_PRINT_FLOW();
+    if (pFssIo->hVfsCurObj == NIL_RTVFSOBJ)
+    {
+        if (pFssIo->fEndOfFss)
+            return VERR_EOF;
+        int rc = RTVfsFsStrmNext(pFssIo->hVfsFss, &pFssIo->pszCurName, &pFssIo->enmCurType, &pFssIo->hVfsCurObj);
+        if (RT_FAILURE(rc))
+        {
+            pFssIo->fEndOfFss = rc == VERR_EOF;
+            *ppszName = NULL;
+            return rc;
+        }
+    }
 
-    return VERR_NOT_IMPLEMENTED;
+    *ppszName = pFssIo->pszCurName;
+    return VINF_SUCCESS;
 }
 
+
+/**
+ * Skips the current object.
+ *
+ * @returns VBox status code.
+ * @param   pFssIo              What TarFssCreateReadOnlyInterfaceForFile
+ *                              returned.
+ */
+int  fssRdOnlySkipCurrent(PFSSRDONLYINTERFACEIO pFssIo)
+{
+    AssertPtr(pFssIo); AssertPtr(pFssIo->hVfsFss);
+
+    if (pFssIo->hVfsCurObj == NIL_RTVFSOBJ)
+    {
+        if (pFssIo->fEndOfFss)
+            return VERR_EOF;
+        int rc = RTVfsFsStrmNext(pFssIo->hVfsFss, &pFssIo->pszCurName, &pFssIo->enmCurType, &pFssIo->hVfsCurObj);
+        if (RT_FAILURE(rc))
+        {
+            pFssIo->fEndOfFss = rc == VERR_EOF;
+            return rc;
+        }
+    }
+
+    /* Force a RTVfsFsStrmNext call the next time around. */
+    RTVfsObjRelease(pFssIo->hVfsCurObj);
+    pFssIo->hVfsCurObj = NIL_RTVFSOBJ;
+
+    RTStrFree(pFssIo->pszCurName);
+    pFssIo->pszCurName = NULL;
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Checks if the current file is a directory.
+ *
+ * @returns true if directory, false if not (or error).
+ * @param   pFssIo              What TarFssCreateReadOnlyInterfaceForFile
+ *                              returned.
+ */
+bool fssRdOnlyIsCurrentDirectory(PFSSRDONLYINTERFACEIO pFssIo)
+{
+    AssertPtr(pFssIo); AssertPtr(pFssIo->hVfsFss);
+
+    if (pFssIo->hVfsCurObj == NIL_RTVFSOBJ)
+    {
+        if (pFssIo->fEndOfFss)
+            return false;
+        int rc = RTVfsFsStrmNext(pFssIo->hVfsFss, &pFssIo->pszCurName, &pFssIo->enmCurType, &pFssIo->hVfsCurObj);
+        if (RT_FAILURE(rc))
+        {
+            pFssIo->fEndOfFss = rc == VERR_EOF;
+            return false;
+        }
+    }
+
+    return pFssIo->enmCurType == RTVFSOBJTYPE_DIR;
+}
+
+
+
+/** @} */
+
+
 /******************************************************************************
  *   Internal: RTSha interface
  ******************************************************************************/
@@ -533,7 +869,8 @@ DECLCALLBACK(int) shaCalcWorkerThread(RTTHREAD /* aThread */, void *pvUser)
                             break;
                         size_t cbToWrite = cbMemRead - cbAllWritten;
                         size_t cbWritten = 0;
-                        rc = vdIfIoFileWriteSync(pIfIo, pInt->pvStorage, pInt->cbCurFile, &pcBuf[cbAllWritten], cbToWrite, &cbWritten);
+                        rc = vdIfIoFileWriteSync(pIfIo, pInt->pvStorage, pInt->cbCurFile, &pcBuf[cbAllWritten],
+                                                 cbToWrite, &cbWritten);
 //                        RTPrintf ("%lu %lu %lu %Rrc\n", pInt->cbCurFile, cbToRead, cbRead, rc);
                         if (RT_FAILURE(rc))
                         {
@@ -743,7 +1080,8 @@ static int shaOpenCallback(void *pvUser, const char *pszLocation, uint32_t fOpen
         if (RT_FAILURE(rc))
             break;
         /* Create the worker thread. */
-        rc = RTThreadCreate(&pInt->pWorkerThread, shaCalcWorkerThread, pInt, 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, RTTHREADFLAGS_WAITABLE, "SHA-Worker");
+        rc = RTThreadCreate(&pInt->pWorkerThread, shaCalcWorkerThread, pInt, 0, RTTHREADTYPE_MAIN_HEAVY_WORKER,
+                            RTTHREADFLAGS_WAITABLE, "SHA-Worker");
         if (RT_FAILURE(rc))
             break;
 
@@ -984,7 +1322,8 @@ static int shaWriteSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
     DEBUG_PRINT_FLOW();
 
     /* Check that the write is linear */
-    AssertMsgReturn(pInt->cbCurAll <= uOffset, ("Backward seeking is not allowed (uOffset: %7lu cbCurAll: %7lu)!", uOffset, pInt->cbCurAll), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(pInt->cbCurAll <= uOffset, ("Backward seeking is not allowed (uOffset: %7lu cbCurAll: %7lu)!",
+                    uOffset, pInt->cbCurAll), VERR_INVALID_PARAMETER);
 
     int rc = VINF_SUCCESS;
 
@@ -1225,28 +1564,7 @@ PVDINTERFACEIO FileCreateInterface()
     return pCallbacks;
 }
 
-PVDINTERFACEIO TarCreateInterface()
-{
-    PVDINTERFACEIO pCallbacks = (PVDINTERFACEIO)RTMemAllocZ(sizeof(VDINTERFACEIO));
-    if (!pCallbacks)
-        return NULL;
-
-    pCallbacks->pfnOpen                = tarOpenCallback;
-    pCallbacks->pfnClose               = tarCloseCallback;
-    pCallbacks->pfnDelete              = tarDeleteCallback;
-    pCallbacks->pfnMove                = tarMoveCallback;
-    pCallbacks->pfnGetFreeSpace        = tarGetFreeSpaceCallback;
-    pCallbacks->pfnGetModificationTime = tarGetModificationTimeCallback;
-    pCallbacks->pfnGetSize             = tarGetSizeCallback;
-    pCallbacks->pfnSetSize             = tarSetSizeCallback;
-    pCallbacks->pfnReadSync            = tarReadSyncCallback;
-    pCallbacks->pfnWriteSync           = tarWriteSyncCallback;
-    pCallbacks->pfnFlushSync           = tarFlushSyncCallback;
-
-    return pCallbacks;
-}
-
-int ShaReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pIfIo, void *pvUser)
+int readFileIntoBuffer(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pIfIo, void *pvUser)
 {
     /* Validate input. */
     AssertPtrReturn(ppvBuf, VERR_INVALID_POINTER);
@@ -1313,7 +1631,7 @@ int ShaReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTE
     return rc;
 }
 
-int ShaWriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pIfIo, void *pvUser)
+int writeBufferToFile(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pIfIo, void *pvUser)
 {
     /* Validate input. */
     AssertPtrReturn(pvBuf, VERR_INVALID_POINTER);
@@ -1376,7 +1694,7 @@ int decompressImageAndSave(const char *pcszFullFilenameIn, const char *pcszFullF
              * Create the output file, including necessary paths.
              * Any existing file will be overwritten.
              */
-            rc = VirtualBox::ensureFilePathExists(Utf8Str(pcszFullFilenameOut), true /*fCreate*/);
+            rc = VirtualBox::i_ensureFilePathExists(Utf8Str(pcszFullFilenameOut), true /*fCreate*/);
             if (RT_SUCCESS(rc))
             {
                 RTVFSIOSTREAM hVfsIosDst;
@@ -1445,7 +1763,7 @@ int copyFileAndCalcShaDigest(const char *pcszSourceFilename, const char *pcszTar
          * Create the output file, including necessary paths.
          * Any existing file will be overwritten.
          */
-        rc = VirtualBox::ensureFilePathExists(Utf8Str(pcszTargetFilename), true /*fCreate*/);
+        rc = VirtualBox::i_ensureFilePathExists(Utf8Str(pcszTargetFilename), true /*fCreate*/);
         if (RT_SUCCESS(rc))
         {
             RTVFSIOSTREAM hVfsIosDst;
diff --git a/src/VBox/Main/src-server/ApplianceImplImport.cpp b/src/VBox/Main/src-server/ApplianceImplImport.cpp
index 6077aea..a7d4988 100644
--- a/src/VBox/Main/src-server/ApplianceImplImport.cpp
+++ b/src/VBox/Main/src-server/ApplianceImplImport.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2013 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -46,6 +46,7 @@
 #include <VBox/version.h>
 #include <VBox/settings.h>
 
+#include <iprt/x509-branch-collision.h>
 #include <set>
 
 using namespace std;
@@ -60,20 +61,15 @@ using namespace std;
  * Public method implementation. This opens the OVF with ovfreader.cpp.
  * Thread implementation is in Appliance::readImpl().
  *
- * @param path
+ * @param aFile
  * @return
  */
-STDMETHODIMP Appliance::Read(IN_BSTR path, IProgress **aProgress)
+HRESULT Appliance::read(const com::Utf8Str &aFile,
+                        ComPtr<IProgress> &aProgress)
 {
-    if (!path) return E_POINTER;
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (!isApplianceIdle())
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
 
     if (m->pReader)
@@ -83,9 +79,8 @@ STDMETHODIMP Appliance::Read(IN_BSTR path, IProgress **aProgress)
     }
 
     // see if we can handle this file; for now we insist it has an ovf/ova extension
-    Utf8Str strPath (path);
-    if (!(   strPath.endsWith(".ovf", Utf8Str::CaseInsensitive)
-          || strPath.endsWith(".ova", Utf8Str::CaseInsensitive)))
+    if (!(   aFile.endsWith(".ovf", Utf8Str::CaseInsensitive)
+          || aFile.endsWith(".ova", Utf8Str::CaseInsensitive)))
         return setError(VBOX_E_FILE_ERROR,
                         tr("Appliance file must have .ovf extension"));
 
@@ -94,8 +89,8 @@ STDMETHODIMP Appliance::Read(IN_BSTR path, IProgress **aProgress)
     try
     {
         /* Parse all necessary info out of the URI */
-        parseURI(strPath, m->locInfo);
-        rc = readImpl(m->locInfo, progress);
+        i_parseURI(aFile, m->locInfo);
+        rc = i_readImpl(m->locInfo, progress);
     }
     catch (HRESULT aRC)
     {
@@ -104,7 +99,7 @@ STDMETHODIMP Appliance::Read(IN_BSTR path, IProgress **aProgress)
 
     if (SUCCEEDED(rc))
         /* Return progress to the caller */
-        progress.queryInterfaceTo(aProgress);
+        progress.queryInterfaceTo(aProgress.asOutParam());
 
     return S_OK;
 }
@@ -114,18 +109,15 @@ STDMETHODIMP Appliance::Read(IN_BSTR path, IProgress **aProgress)
  * VirtualSystemDescription instances.
  * @return
  */
-STDMETHODIMP Appliance::Interpret()
+HRESULT Appliance::interpret()
 {
     // @todo:
     //  - don't use COM methods but the methods directly (faster, but needs appropriate
     // locking of that objects itself (s. HardDisk))
     //  - Appropriate handle errors like not supported file formats
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (!isApplianceIdle())
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
 
     HRESULT rc = S_OK;
@@ -163,7 +155,7 @@ STDMETHODIMP Appliance::Interpret()
             // if the virtual system in OVF had a <vbox:Machine> element, have the
             // VirtualBox settings code parse that XML now
             if (vsysThis.pelmVBoxMachine)
-                pNewDesc->importVBoxMachineXML(*vsysThis.pelmVBoxMachine);
+                pNewDesc->i_importVBoxMachineXML(*vsysThis.pelmVBoxMachine);
 
             // Guest OS type
             // This is taken from one of three places, in this order:
@@ -180,10 +172,10 @@ STDMETHODIMP Appliance::Interpret()
             // 3) Otherwise, make a best guess what the vbox type is from the OVF (CIM) OS type.
             else
                 convertCIMOSType2VBoxOSType(strOsTypeVBox, vsysThis.cimos, vsysThis.strCimosDesc);
-            pNewDesc->addEntry(VirtualSystemDescriptionType_OS,
-                               "",
-                               strCIMOSType,
-                               strOsTypeVBox);
+            pNewDesc->i_addEntry(VirtualSystemDescriptionType_OS,
+                                 "",
+                                 strCIMOSType,
+                                 strOsTypeVBox);
 
             /* VM name */
             Utf8Str nameVBox;
@@ -197,11 +189,11 @@ STDMETHODIMP Appliance::Interpret()
              * of the OS type */
             if (nameVBox.isEmpty())
                 nameVBox = strOsTypeVBox;
-            searchUniqueVMName(nameVBox);
-            pNewDesc->addEntry(VirtualSystemDescriptionType_Name,
-                               "",
-                               vsysThis.strName,
-                               nameVBox);
+            i_searchUniqueVMName(nameVBox);
+            pNewDesc->i_addEntry(VirtualSystemDescriptionType_Name,
+                                 "",
+                                 vsysThis.strName,
+                                 nameVBox);
 
             /* Based on the VM name, create a target machine path. */
             Bstr bstrMachineFilename;
@@ -216,52 +208,52 @@ STDMETHODIMP Appliance::Interpret()
 
             /* VM Product */
             if (!vsysThis.strProduct.isEmpty())
-                pNewDesc->addEntry(VirtualSystemDescriptionType_Product,
-                                    "",
-                                    vsysThis.strProduct,
-                                    vsysThis.strProduct);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Product,
+                                      "",
+                                      vsysThis.strProduct,
+                                      vsysThis.strProduct);
 
             /* VM Vendor */
             if (!vsysThis.strVendor.isEmpty())
-                pNewDesc->addEntry(VirtualSystemDescriptionType_Vendor,
-                                    "",
-                                    vsysThis.strVendor,
-                                    vsysThis.strVendor);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Vendor,
+                                     "",
+                                     vsysThis.strVendor,
+                                     vsysThis.strVendor);
 
             /* VM Version */
             if (!vsysThis.strVersion.isEmpty())
-                pNewDesc->addEntry(VirtualSystemDescriptionType_Version,
-                                    "",
-                                    vsysThis.strVersion,
-                                    vsysThis.strVersion);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Version,
+                                     "",
+                                     vsysThis.strVersion,
+                                     vsysThis.strVersion);
 
             /* VM ProductUrl */
             if (!vsysThis.strProductUrl.isEmpty())
-                pNewDesc->addEntry(VirtualSystemDescriptionType_ProductUrl,
-                                    "",
-                                    vsysThis.strProductUrl,
-                                    vsysThis.strProductUrl);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_ProductUrl,
+                                     "",
+                                     vsysThis.strProductUrl,
+                                     vsysThis.strProductUrl);
 
             /* VM VendorUrl */
             if (!vsysThis.strVendorUrl.isEmpty())
-                pNewDesc->addEntry(VirtualSystemDescriptionType_VendorUrl,
-                                    "",
-                                    vsysThis.strVendorUrl,
-                                    vsysThis.strVendorUrl);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_VendorUrl,
+                                     "",
+                                     vsysThis.strVendorUrl,
+                                     vsysThis.strVendorUrl);
 
             /* VM description */
             if (!vsysThis.strDescription.isEmpty())
-                pNewDesc->addEntry(VirtualSystemDescriptionType_Description,
-                                    "",
-                                    vsysThis.strDescription,
-                                    vsysThis.strDescription);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Description,
+                                     "",
+                                     vsysThis.strDescription,
+                                     vsysThis.strDescription);
 
             /* VM license */
             if (!vsysThis.strLicenseText.isEmpty())
-                pNewDesc->addEntry(VirtualSystemDescriptionType_License,
-                                    "",
-                                    vsysThis.strLicenseText,
-                                    vsysThis.strLicenseText);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_License,
+                                     "",
+                                     vsysThis.strLicenseText,
+                                     vsysThis.strLicenseText);
 
             /* Now that we know the OS type, get our internal defaults based on that. */
             ComPtr<IGuestOSType> pGuestOSType;
@@ -279,17 +271,17 @@ STDMETHODIMP Appliance::Interpret()
             /* Check for the constraints */
             if (cpuCountVBox > SchemaDefs::MaxCPUCount)
             {
-                addWarning(tr("The virtual system \"%s\" claims support for %u CPU's, but VirtualBox has support for "
-                              "max %u CPU's only."),
-                           vsysThis.strName.c_str(), cpuCountVBox, SchemaDefs::MaxCPUCount);
+                i_addWarning(tr("The virtual system \"%s\" claims support for %u CPU's, but VirtualBox has support for "
+                                "max %u CPU's only."),
+                                vsysThis.strName.c_str(), cpuCountVBox, SchemaDefs::MaxCPUCount);
                 cpuCountVBox = SchemaDefs::MaxCPUCount;
             }
             if (vsysThis.cCPUs == 0)
                 cpuCountVBox = 1;
-            pNewDesc->addEntry(VirtualSystemDescriptionType_CPU,
-                               "",
-                               Utf8StrFmt("%RU32", (uint32_t)vsysThis.cCPUs),
-                               Utf8StrFmt("%RU32", (uint32_t)cpuCountVBox));
+            pNewDesc->i_addEntry(VirtualSystemDescriptionType_CPU,
+                                "",
+                                Utf8StrFmt("%RU32", (uint32_t)vsysThis.cCPUs),
+                                Utf8StrFmt("%RU32", (uint32_t)cpuCountVBox));
 
             /* RAM */
             uint64_t ullMemSizeVBox;
@@ -306,9 +298,9 @@ STDMETHODIMP Appliance::Interpret()
                     )
                )
             {
-                addWarning(tr("The virtual system \"%s\" claims support for %llu MB RAM size, but VirtualBox has "
-                              "support for min %u & max %u MB RAM size only."),
-                              vsysThis.strName.c_str(), ullMemSizeVBox, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB);
+                i_addWarning(tr("The virtual system \"%s\" claims support for %llu MB RAM size, but VirtualBox has "
+                                "support for min %u & max %u MB RAM size only."),
+                                vsysThis.strName.c_str(), ullMemSizeVBox, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB);
                 ullMemSizeVBox = RT_MIN(RT_MAX(ullMemSizeVBox, MM_RAM_MIN_IN_MB), MM_RAM_MAX_IN_MB);
             }
             if (vsysThis.ullMemorySize == 0)
@@ -320,10 +312,10 @@ STDMETHODIMP Appliance::Interpret()
                 /* VBox stores that in MByte */
                 ullMemSizeVBox = (uint64_t)memSizeVBox2;
             }
-            pNewDesc->addEntry(VirtualSystemDescriptionType_Memory,
-                               "",
-                               Utf8StrFmt("%RU64", (uint64_t)vsysThis.ullMemorySize),
-                               Utf8StrFmt("%RU64", (uint64_t)ullMemSizeVBox));
+            pNewDesc->i_addEntry(VirtualSystemDescriptionType_Memory,
+                                 "",
+                                 Utf8StrFmt("%RU64", (uint64_t)vsysThis.ullMemorySize),
+                                 Utf8StrFmt("%RU64", (uint64_t)ullMemSizeVBox));
 
             /* Audio */
             Utf8Str strSoundCard;
@@ -343,10 +335,10 @@ STDMETHODIMP Appliance::Interpret()
                 strSoundCardOrig = vsysThis.strSoundCardType;
             }
             if (strSoundCard.isNotEmpty())
-                pNewDesc->addEntry(VirtualSystemDescriptionType_SoundCard,
-                                   "",
-                                   strSoundCardOrig,
-                                   strSoundCard);
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_SoundCard,
+                                     "",
+                                     strSoundCardOrig,
+                                     strSoundCard);
 
 #ifdef VBOX_WITH_USB
             /* USB Controller */
@@ -354,7 +346,7 @@ STDMETHODIMP Appliance::Interpret()
             if (   (   vsysThis.pelmVBoxMachine
                     && pNewDesc->m->pConfig->hardwareMachine.usbSettings.llUSBControllers.size() > 0)
                 || vsysThis.fHasUsbController)
-                pNewDesc->addEntry(VirtualSystemDescriptionType_USBController, "", "", "");
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_USBController, "", "", "");
 #endif /* VBOX_WITH_USB */
 
             /* Network Controller */
@@ -366,9 +358,9 @@ STDMETHODIMP Appliance::Interpret()
                 const settings::NetworkAdaptersList &llNetworkAdapters = pNewDesc->m->pConfig->hardwareMachine.llNetworkAdapters;
                 /* Check for the constrains */
                 if (llNetworkAdapters.size() > maxNetworkAdapters)
-                    addWarning(tr("The virtual system \"%s\" claims support for %zu network adapters, but VirtualBox "
-                                  "has support for max %u network adapter only."),
-                                  vsysThis.strName.c_str(), llNetworkAdapters.size(), maxNetworkAdapters);
+                    i_addWarning(tr("The virtual system \"%s\" claims support for %zu network adapters, but VirtualBox "
+                                    "has support for max %u network adapter only."),
+                                    vsysThis.strName.c_str(), llNetworkAdapters.size(), maxNetworkAdapters);
                 /* Iterate through all network adapters. */
                 settings::NetworkAdaptersList::const_iterator it1;
                 size_t a = 0;
@@ -379,12 +371,12 @@ STDMETHODIMP Appliance::Interpret()
                     if (it1->fEnabled)
                     {
                         Utf8Str strMode = convertNetworkAttachmentTypeToString(it1->mode);
-                        pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter,
-                                           "", // ref
-                                           strMode, // orig
-                                           Utf8StrFmt("%RU32", (uint32_t)it1->type), // conf
-                                           0,
-                                           Utf8StrFmt("slot=%RU32;type=%s", it1->ulSlot, strMode.c_str())); // extra conf
+                        pNewDesc->i_addEntry(VirtualSystemDescriptionType_NetworkAdapter,
+                                             "", // ref
+                                             strMode, // orig
+                                             Utf8StrFmt("%RU32", (uint32_t)it1->type), // conf
+                                             0,
+                                             Utf8StrFmt("slot=%RU32;type=%s", it1->ulSlot, strMode.c_str())); // extra conf
                     }
                 }
             }
@@ -396,9 +388,9 @@ STDMETHODIMP Appliance::Interpret()
 
                 /* Check for the constrains */
                 if (cEthernetAdapters > maxNetworkAdapters)
-                    addWarning(tr("The virtual system \"%s\" claims support for %zu network adapters, but VirtualBox "
-                                  "has support for max %u network adapter only."),
-                                  vsysThis.strName.c_str(), cEthernetAdapters, maxNetworkAdapters);
+                    i_addWarning(tr("The virtual system \"%s\" claims support for %zu network adapters, but VirtualBox "
+                                    "has support for max %u network adapter only."),
+                                    vsysThis.strName.c_str(), cEthernetAdapters, maxNetworkAdapters);
 
                 /* Get the default network adapter type for the selected guest OS */
                 NetworkAdapterType_T defaultAdapterVBox = NetworkAdapterType_Am79C970A;
@@ -460,12 +452,12 @@ STDMETHODIMP Appliance::Interpret()
                     }
 #endif /* VBOX_WITH_E1000 */
 
-                    pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter,
-                                       "",      // ref
-                                       ea.strNetworkName,      // orig
-                                       Utf8StrFmt("%RU32", (uint32_t)nwAdapterVBox),   // conf
-                                       0,
-                                       Utf8StrFmt("type=%s", strNetwork.c_str()));       // extra conf
+                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_NetworkAdapter,
+                                         "",      // ref
+                                         ea.strNetworkName,      // orig
+                                         Utf8StrFmt("%RU32", (uint32_t)nwAdapterVBox),   // conf
+                                         0,
+                                         Utf8StrFmt("type=%s", strNetwork.c_str()));       // extra conf
                 }
             }
 
@@ -502,10 +494,10 @@ STDMETHODIMP Appliance::Interpret()
             }
             /* Floppy Drive */
             if (fFloppy)
-                pNewDesc->addEntry(VirtualSystemDescriptionType_Floppy, "", "", "");
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_Floppy, "", "", "");
             /* CD Drive */
             if (fDVD)
-                pNewDesc->addEntry(VirtualSystemDescriptionType_CDROM, "", "", "");
+                pNewDesc->i_addEntry(VirtualSystemDescriptionType_CDROM, "", "", "");
 
             /* Hard disk Controller */
             uint16_t cIDEused = 0;
@@ -533,17 +525,17 @@ STDMETHODIMP Appliance::Interpret()
                                 strType = "PIIX3";
                             else if (!hdc.strControllerType.compare("ICH6", Utf8Str::CaseInsensitive))
                                 strType = "ICH6";
-                            pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
-                                               strControllerID,         // strRef
-                                               hdc.strControllerType,   // aOvfValue
-                                               strType);                // aVBoxValue
+                            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
+                                                 strControllerID,         // strRef
+                                                 hdc.strControllerType,   // aOvfValue
+                                                 strType);                // aVBoxValue
                         }
                         else
                             /* Warn only once */
                             if (cIDEused == 2)
-                                addWarning(tr("The virtual \"%s\" system requests support for more than two "
+                                i_addWarning(tr("The virtual \"%s\" system requests support for more than two "
                                               "IDE controller channels, but VirtualBox supports only two."),
-                                            vsysThis.strName.c_str());
+                                              vsysThis.strName.c_str());
 
                         ++cIDEused;
                     break;
@@ -554,18 +546,18 @@ STDMETHODIMP Appliance::Interpret()
                         {
                             // @todo: figure out the SATA types
                             /* We only support a plain AHCI controller, so use them always */
-                            pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
-                                                strControllerID,
-                                                hdc.strControllerType,
-                                                "AHCI");
+                            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
+                                                 strControllerID,
+                                                 hdc.strControllerType,
+                                                 "AHCI");
                         }
                         else
                         {
                             /* Warn only once */
                             if (cSATAused == 1)
-                                addWarning(tr("The virtual system \"%s\" requests support for more than one "
-                                              "SATA controller, but VirtualBox has support for only one"),
-                                            vsysThis.strName.c_str());
+                                i_addWarning(tr("The virtual system \"%s\" requests support for more than one "
+                                                "SATA controller, but VirtualBox has support for only one"),
+                                                vsysThis.strName.c_str());
 
                         }
                         ++cSATAused;
@@ -585,18 +577,18 @@ STDMETHODIMP Appliance::Interpret()
                             }
                             else if (!hdc.strControllerType.compare("BusLogic", Utf8Str::CaseInsensitive))
                                 hdcController = "BusLogic";
-                            pNewDesc->addEntry(vsdet,
-                                               strControllerID,
-                                               hdc.strControllerType,
-                                               hdcController);
+                            pNewDesc->i_addEntry(vsdet,
+                                                 strControllerID,
+                                                 hdc.strControllerType,
+                                                 hdcController);
                         }
                         else
-                            addWarning(tr("The virtual system \"%s\" requests support for an additional "
-                                          "SCSI controller of type \"%s\" with ID %s, but VirtualBox presently "
-                                          "supports only one SCSI controller."),
-                                        vsysThis.strName.c_str(),
-                                        hdc.strControllerType.c_str(),
-                                        strControllerID.c_str());
+                            i_addWarning(tr("The virtual system \"%s\" requests support for an additional "
+                                            "SCSI controller of type \"%s\" with ID %s, but VirtualBox presently "
+                                            "supports only one SCSI controller."),
+                                            vsysThis.strName.c_str(),
+                                            hdc.strControllerType.c_str(),
+                                            strControllerID.c_str());
                         ++cSCSIused;
                     break;
                 }
@@ -630,35 +622,17 @@ STDMETHODIMP Appliance::Interpret()
                      * But there aren't strong requirements about correspondence one URI for one disk virtual format.
                      * So possibly, we aren't able to recognize some URIs.
                      */
-                    Utf8Str vdf = typeOfVirtualDiskFormatFromURI(di.strFormat);
 
-                    /*
-                     * fallback, if we can't determine virtual disk format using URI from the attribute ovf:format
-                     * in the corresponding section <Disk> in the OVF file.
-                     */
-                    if (vdf.isEmpty())
-                    {
-                        /* Figure out from extension which format the image of disk has. */
-                        {
-                            char *pszExt = RTPathExt(di.strHref.c_str());
-                            /* Get the system properties. */
-                            SystemProperties *pSysProps = mVirtualBox->getSystemProperties();
-                            ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&pszExt[1]);
-                            if (trgFormat.isNull())
-                            {
-                                throw setError(E_FAIL,
-                                       tr("Internal inconsistency looking up medium format for the disk image '%s'"),
-                                       di.strHref.c_str());
-                            }
-
-                            Bstr bstrFormatName;
-                            rc = trgFormat->COMGETTER(Name)(bstrFormatName.asOutParam());
-                            if (FAILED(rc))
-                                throw rc;
+                    ComObjPtr<MediumFormat> mediumFormat;
+                    rc = i_findMediumFormatFromDiskImage(di, mediumFormat);
+                    if (FAILED(rc))
+                        throw rc;
 
-                            vdf = Utf8Str(bstrFormatName);
-                        }
-                    }
+                    Bstr bstrFormatName;
+                    rc = mediumFormat->COMGETTER(Name)(bstrFormatName.asOutParam());
+                    if (FAILED(rc))
+                        throw rc;
+                    Utf8Str vdf = Utf8Str(bstrFormatName);
 
                     // @todo:
                     //  - figure out all possible vmdk formats we also support
@@ -674,12 +648,20 @@ STDMETHODIMP Appliance::Interpret()
 
                         Utf8Str strTargetPath = Utf8Str(strMachineFolder);
                         strTargetPath.append(RTPATH_DELIMITER).append(di.strHref);
-                        searchUniqueDiskImageFilePath(strTargetPath);
+                        /*
+                         * Remove last extension from the file name if the file is compressed
+                        */
+                        if (di.strCompression.compare("gzip", Utf8Str::CaseInsensitive)==0)
+                        {
+                            strTargetPath.stripSuffix();
+                        }
+
+                        i_searchUniqueDiskImageFilePath(strTargetPath);
 
                         /* find the description for the hard disk controller
                          * that has the same ID as hd.idController */
                         const VirtualSystemDescriptionEntry *pController;
-                        if (!(pController = pNewDesc->findControllerFromID(hd.idController)))
+                        if (!(pController = pNewDesc->i_findControllerFromID(hd.idController)))
                             throw setError(E_FAIL,
                                            tr("Cannot find hard disk controller with OVF instance ID %RI32 "
                                               "to which disk \"%s\" should be attached"),
@@ -690,12 +672,12 @@ STDMETHODIMP Appliance::Interpret()
                         Utf8StrFmt strExtraConfig("controller=%RI16;channel=%RI16",
                                                   pController->ulIndex,
                                                   hd.ulAddressOnParent);
-                        pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskImage,
-                                           hd.strDiskId,
-                                           di.strHref,
-                                           strTargetPath,
-                                           di.ulSuggestedSizeMB,
-                                           strExtraConfig);
+                        pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskImage,
+                                             hd.strDiskId,
+                                             di.strHref,
+                                             strTargetPath,
+                                             di.ulSuggestedSizeMB,
+                                             strExtraConfig);
                     }
                     else if (vdf.compare("RAW", Utf8Str::CaseInsensitive) == 0)
                     {
@@ -707,12 +689,20 @@ STDMETHODIMP Appliance::Interpret()
                         Utf8Str strTargetPath = Utf8Str(strMachineFolder)
                             .append(RTPATH_DELIMITER)
                             .append(di.strHref);
-                        searchUniqueDiskImageFilePath(strTargetPath);
+                        /*
+                         * Remove last extension from the file name if the file is compressed
+                        */
+                        if (di.strCompression.compare("gzip", Utf8Str::CaseInsensitive)==0)
+                        {
+                            strTargetPath.stripSuffix();
+                        }
+
+                        i_searchUniqueDiskImageFilePath(strTargetPath);
 
                         /* find the description for the hard disk controller
                          * that has the same ID as hd.idController */
                         const VirtualSystemDescriptionEntry *pController;
-                        if (!(pController = pNewDesc->findControllerFromID(hd.idController)))
+                        if (!(pController = pNewDesc->i_findControllerFromID(hd.idController)))
                             throw setError(E_FAIL,
                                            tr("Cannot find disk controller with OVF instance ID %RI32 "
                                               "to which disk \"%s\" should be attached"),
@@ -723,12 +713,12 @@ STDMETHODIMP Appliance::Interpret()
                         Utf8StrFmt strExtraConfig("controller=%RI16;channel=%RI16",
                                                   pController->ulIndex,
                                                   hd.ulAddressOnParent);
-                        pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskImage,
-                                           hd.strDiskId,
-                                           di.strHref,
-                                           strTargetPath,
-                                           di.ulSuggestedSizeMB,
-                                           strExtraConfig);
+                        pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskImage,
+                                             hd.strDiskId,
+                                             di.strHref,
+                                             strTargetPath,
+                                             di.ulSuggestedSizeMB,
+                                             strExtraConfig);
                     }
                     else
                         throw setError(VBOX_E_FILE_ERROR,
@@ -758,37 +748,42 @@ STDMETHODIMP Appliance::Interpret()
 /**
  * Public method implementation. This creates one or more new machines according to the
  * VirtualSystemScription instances created by Appliance::Interpret().
- * Thread implementation is in Appliance::importImpl().
+ * Thread implementation is in Appliance::i_importImpl().
  * @param aProgress
  * @return
  */
-STDMETHODIMP Appliance::ImportMachines(ComSafeArrayIn(ImportOptions_T, options), IProgress **aProgress)
+HRESULT Appliance::importMachines(const std::vector<ImportOptions_T> &aOptions,
+                                  ComPtr<IProgress> &aProgress)
 {
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (options != NULL)
-        m->optListImport = com::SafeArray<ImportOptions_T>(ComSafeArrayInArg(options)).toList();
+    if (aOptions.size())
+    {
+        m->optListImport.setCapacity(aOptions.size());
+        for (size_t i = 0; i < aOptions.size(); ++i)
+        {
+            m->optListImport.insert(i, aOptions[i]);
+        }
+    }
 
-    AssertReturn(!(m->optListImport.contains(ImportOptions_KeepAllMACs) && m->optListImport.contains(ImportOptions_KeepNATMACs)), E_INVALIDARG);
+    AssertReturn(!(m->optListImport.contains
+                   (ImportOptions_KeepAllMACs)
+                   && m->optListImport.contains(ImportOptions_KeepNATMACs)
+                  ), E_INVALIDARG);
 
     // do not allow entering this method if the appliance is busy reading or writing
-    if (!isApplianceIdle())
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
 
     if (!m->pReader)
         return setError(E_FAIL,
-                        tr("Cannot import machines without reading it first (call read() before importMachines())"));
+                        tr("Cannot import machines without reading it first (call read() before i_importMachines())"));
 
     ComObjPtr<Progress> progress;
     HRESULT rc = S_OK;
     try
     {
-        rc = importImpl(m->locInfo, progress);
+        rc = i_importImpl(m->locInfo, progress);
     }
     catch (HRESULT aRC)
     {
@@ -797,7 +792,7 @@ STDMETHODIMP Appliance::ImportMachines(ComSafeArrayIn(ImportOptions_T, options),
 
     if (SUCCEEDED(rc))
         /* Return progress to the caller */
-        progress.queryInterfaceTo(aProgress);
+        progress.queryInterfaceTo(aProgress.asOutParam());
 
     return rc;
 }
@@ -808,34 +803,25 @@ STDMETHODIMP Appliance::ImportMachines(ComSafeArrayIn(ImportOptions_T, options),
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-HRESULT Appliance::preCheckImageAvailability(PSHASTORAGE pSHAStorage,
+HRESULT Appliance::i_preCheckImageAvailability(PSHASTORAGE pSHAStorage,
                                                RTCString &availableImage)
 {
-    HRESULT rc = S_OK;
-    RTTAR tar = (RTTAR)pSHAStorage->pVDImageIfaces->pvUser;
-    char *pszFilename = 0;
-
-    int vrc = RTTarCurrentFile(tar, &pszFilename);
-
-    if (RT_FAILURE(vrc))
-    {
-        throw setError(VBOX_E_FILE_ERROR,
-               tr("Could not open the current file in the OVA package (%Rrc)"), vrc);
-    }
-    else
+    PFSSRDONLYINTERFACEIO pTarIo = (PFSSRDONLYINTERFACEIO)pSHAStorage->pVDImageIfaces->pvUser;
+    const char *pszFilename;
+    int vrc = fssRdOnlyGetCurrentName(pTarIo, &pszFilename);
+    if (RT_SUCCESS(vrc))
     {
-        if (vrc == VINF_TAR_DIR_PATH)
+        if (!fssRdOnlyIsCurrentDirectory(pTarIo))
         {
-            throw setError(VBOX_E_FILE_ERROR,
-                   tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"),
-                      pszFilename,
-                      vrc);
+            availableImage = pszFilename;
+            return S_OK;
         }
-    }
 
-    availableImage = pszFilename;
+        throw setError(VBOX_E_FILE_ERROR, tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"),
+                       pszFilename, VERR_IS_A_DIRECTORY);
+    }
 
-    return rc;
+    throw setError(VBOX_E_FILE_ERROR, tr("Could not open the current file in the OVA package (%Rrc)"), vrc);
 }
 
 /*******************************************************************************
@@ -843,24 +829,26 @@ HRESULT Appliance::preCheckImageAvailability(PSHASTORAGE pSHAStorage,
  ******************************************************************************/
 
 /**
- * Implementation for reading an OVF. This starts a new thread which will call
- * Appliance::taskThreadImportOrExport() which will then call readFS() or readS3().
- * This will then open the OVF with ovfreader.cpp.
+ * Implementation for reading an OVF (via task).
+ *
+ * This starts a new thread which will call
+ * Appliance::taskThreadImportOrExport() which will then call readFS() or
+ * readS3(). This will then open the OVF with ovfreader.cpp.
  *
  * This is in a separate private method because it is used from three locations:
  *
  * 1) from the public Appliance::Read().
  *
- * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl(), which
- *    called Appliance::readFSOVA(), which called Appliance::importImpl(), which then called this again.
+ * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::i_importImpl(), which
+ *    called Appliance::readFSOVA(), which called Appliance::i_importImpl(), which then called this again.
  *
  * 3) from Appliance::readS3(), which got called from a previous instance of Appliance::taskThreadImportOrExport().
  *
- * @param aLocInfo
- * @param aProgress
- * @return
+ * @param   aLocInfo    The OVF location.
+ * @param   aProgress   Where to return the progress object.
+ * @return  COM success status code. COM error codes will be thrown.
  */
-HRESULT Appliance::readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
+HRESULT Appliance::i_readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)
 {
     BstrFmt bstrDesc = BstrFmt(tr("Reading appliance '%s'"),
                                aLocInfo.strPath.c_str());
@@ -910,7 +898,7 @@ HRESULT Appliance::readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &a
  * @param pTask
  * @return
  */
-HRESULT Appliance::readFS(TaskOVF *pTask)
+HRESULT Appliance::i_readFS(TaskOVF *pTask)
 {
     LogFlowFuncEnter();
     LogFlowFunc(("Appliance %p\n", this));
@@ -923,9 +911,9 @@ HRESULT Appliance::readFS(TaskOVF *pTask)
     HRESULT rc = S_OK;
 
     if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive))
-        rc = readFSOVF(pTask);
+        rc = i_readFSOVF(pTask);
     else
-        rc = readFSOVA(pTask);
+        rc = i_readFSOVA(pTask);
 
     LogFlowFunc(("rc=%Rhrc\n", rc));
     LogFlowFuncLeave();
@@ -933,7 +921,7 @@ HRESULT Appliance::readFS(TaskOVF *pTask)
     return rc;
 }
 
-HRESULT Appliance::readFSOVF(TaskOVF *pTask)
+HRESULT Appliance::i_readFSOVF(TaskOVF *pTask)
 {
     LogFlowFuncEnter();
 
@@ -954,7 +942,7 @@ HRESULT Appliance::readFSOVF(TaskOVF *pTask)
                 break;
             }
 
-            Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripExt().append(".mf");
+            Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf");
 
             SHASTORAGE storage;
             RT_ZERO(storage);
@@ -1024,7 +1012,7 @@ HRESULT Appliance::readFSOVF(TaskOVF *pTask)
                         storage.fSha256 = true;
                     }
 
-                    Utf8Str name = applianceIOName(applianceIOFile);
+                    Utf8Str name = i_applianceIOName(applianceIOFile);
 
                     vrc = VDInterfaceAdd(&pFileIo->Core, name.c_str(),
                                              VDINTERFACETYPE_IO, 0, sizeof(VDINTERFACEIO),
@@ -1032,7 +1020,7 @@ HRESULT Appliance::readFSOVF(TaskOVF *pTask)
                     if (RT_FAILURE(vrc))
                         throw setError(VBOX_E_IPRT_ERROR, "Creation of the VD interface failed (%Rrc)", vrc);
 
-                    rc = readFSImpl(pTask, pTask->locInfo.strPath, pShaIo, &storage);
+                    rc = i_readFSImpl(pTask, pTask->locInfo.strPath, pShaIo, &storage);
                     if (FAILED(rc))
                         break;
                 }
@@ -1046,7 +1034,7 @@ HRESULT Appliance::readFSOVF(TaskOVF *pTask)
             else
             {
                 storage.fCreateDigest = false;
-                rc = readFSImpl(pTask, pTask->locInfo.strPath, pFileIo, &storage);
+                rc = i_readFSImpl(pTask, pTask->locInfo.strPath, pFileIo, &storage);
                 if (FAILED(rc))
                     break;
             }
@@ -1070,100 +1058,71 @@ HRESULT Appliance::readFSOVF(TaskOVF *pTask)
     return rc;
 }
 
-HRESULT Appliance::readFSOVA(TaskOVF *pTask)
+HRESULT Appliance::i_readFSOVA(TaskOVF *pTask)
 {
     LogFlowFuncEnter();
 
-    RTTAR tar;
-    HRESULT rc = S_OK;
-    int vrc = 0;
-    PVDINTERFACEIO pShaIo = 0;
-    PVDINTERFACEIO pTarIo = 0;
-    char *pszFilename = 0;
-    SHASTORAGE storage;
-
-    RT_ZERO(storage);
-
-    vrc = RTTarOpen(&tar, pTask->locInfo.strPath.c_str(), RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, true);
-    if (RT_FAILURE(vrc))
-        rc = setError(VBOX_E_FILE_ERROR,
-                        tr("Could not open the OVA file '%s' (%Rrc)"),
-                        pTask->locInfo.strPath.c_str(), vrc);
-    else
+    /*
+     * Open the tar file and get a VD I/O interface for it.
+     */
+    HRESULT hrc;
+    PFSSRDONLYINTERFACEIO pTarIo;
+    int vrc = fssRdOnlyCreateInterfaceForTarFile(pTask->locInfo.strPath.c_str(), &pTarIo);
+    if (RT_SUCCESS(vrc))
     {
-        do
+        /*
+         * Check that the first file is has an .ovf suffix.
+         */
+        const char *pszName;
+        vrc = fssRdOnlyGetCurrentName(pTarIo, &pszName);
+        if (RT_SUCCESS(vrc))
         {
-            vrc = RTTarCurrentFile(tar, &pszFilename);
-            if (RT_FAILURE(vrc))
-            {
-                rc = VBOX_E_FILE_ERROR;
-                break;
-            }
-
-            Utf8Str extension(RTPathExt(pszFilename));
-
-            if (!extension.endsWith(".ovf",Utf8Str::CaseInsensitive))
-            {
-                vrc = VERR_FILE_NOT_FOUND;
-                rc = setError(VBOX_E_FILE_ERROR,
-                              tr("First file in the OVA package must have the extension 'ovf'. "
-                                 "But the file '%s' has the different extension (%Rrc)"),
-                                 pszFilename,
-                                 vrc);
-                break;
-            }
-
-            pTarIo = TarCreateInterface();
-            if (!pTarIo)
-            {
-                rc = E_OUTOFMEMORY;
-                break;
-            }
-
-            pShaIo = ShaCreateInterface();
-            if (!pShaIo)
-            {
-                rc = E_OUTOFMEMORY;
-                break ;
-            }
-
-            Utf8Str name = applianceIOName(applianceIOTar);
-
-            vrc = VDInterfaceAdd(&pTarIo->Core, name.c_str(),
-                                 VDINTERFACETYPE_IO, tar, sizeof(VDINTERFACEIO),
-                                 &storage.pVDImageIfaces);
-            if (RT_FAILURE(vrc))
+            size_t cchName = strlen(pszName);
+            if (   cchName >= sizeof(".ovf")
+                && RTStrICmp(&pszName[cchName - sizeof(".ovf") + 1], ".ovf") == 0)
             {
-                rc = setError(VBOX_E_IPRT_ERROR, "Creation of the VD interface failed (%Rrc)", vrc);
-                break;
+                /*
+                 * Stack the rest of the expected VD I/O stuff.
+                 */
+                PVDINTERFACEIO pShaIo = ShaCreateInterface();
+                if (pShaIo)
+                {
+                    Utf8Str     IoName = i_applianceIOName(applianceIOTar);
+                    SHASTORAGE  ShaStorage;
+                    RT_ZERO(ShaStorage);
+                    vrc = VDInterfaceAdd((PVDINTERFACE)pTarIo, IoName.c_str(),
+                                         VDINTERFACETYPE_IO, pTarIo, sizeof(VDINTERFACEIO),
+                                         &ShaStorage.pVDImageIfaces);
+                    if (RT_SUCCESS(vrc))
+                        /*
+                         * Read and parse the OVF.
+                         */
+                        hrc = i_readFSImpl(pTask, pszName, pShaIo, &ShaStorage);
+                    else
+                        hrc = setError(VBOX_E_IPRT_ERROR, "Creation of the VD interface failed (%Rrc)", vrc);
+                    RTMemFree(pShaIo);
+                }
+                else
+                    hrc = E_OUTOFMEMORY;
             }
-
-            rc = readFSImpl(pTask, pszFilename, pShaIo, &storage);
-            if (FAILED(rc))
-                break;
-
-        } while (0);
-
-        RTTarClose(tar);
+            else
+                hrc = setError(VBOX_E_FILE_ERROR,
+                               tr("First file in the OVA package must have the extension 'ovf'. But the file '%s' has a different extension."),
+                               pszName);
+        }
+        else
+            hrc = setError(VBOX_E_FILE_ERROR, tr("Error reading OVA file '%s' (%Rrc)"), pTask->locInfo.strPath.c_str(), vrc);
+        fssRdOnlyDestroyInterface(pTarIo);
     }
+    else
+        hrc = setError(VBOX_E_FILE_ERROR, tr("Could not open the OVA file '%s' (%Rrc)"), pTask->locInfo.strPath.c_str(), vrc);
 
-
-
-    /* Cleanup */
-    if (pszFilename)
-        RTMemFree(pszFilename);
-    if (pShaIo)
-        RTMemFree(pShaIo);
-    if (pTarIo)
-        RTMemFree(pTarIo);
-
-    LogFlowFunc(("rc=%Rhrc\n", rc));
+    LogFlowFunc(("rc=%Rhrc\n", hrc));
     LogFlowFuncLeave();
-
-    return rc;
+    return hrc;
 }
 
-HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
+HRESULT Appliance::i_readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
 {
     LogFlowFuncEnter();
 
@@ -1176,7 +1135,7 @@ HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDI
     {
         /* Read the OVF into a memory buffer */
         size_t cbSize = 0;
-        int vrc = ShaReadBuf(strFilename.c_str(), &pvTmpBuf, &cbSize, pIfIo, pStorage);
+        int vrc = readFileIntoBuffer(strFilename.c_str(), &pvTmpBuf, &cbSize, pIfIo, pStorage);
         if (RT_FAILURE(vrc)
             || !pvTmpBuf)
             throw setError(VBOX_E_FILE_ERROR,
@@ -1191,24 +1150,21 @@ HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDI
             m->fSha256 = true;
 
             uint8_t digest[RTSHA256_HASH_SIZE];
-            size_t cbDigest = RTSHA256_DIGEST_LEN;
+            size_t cchDigest = RTSHA256_DIGEST_LEN;
             char *pszDigest;
 
             RTSha256(pvTmpBuf, cbSize, &digest[0]);
 
-            vrc = RTStrAllocEx(&pszDigest, cbDigest + 1);
-            if (RT_SUCCESS(vrc))
-                vrc = RTSha256ToString(digest, pszDigest, cbDigest + 1);
-            else
-                throw setError(VBOX_E_FILE_ERROR,
-                           tr("Could not allocate string for SHA256 digest (%Rrc)"), vrc);
+            vrc = RTStrAllocEx(&pszDigest, cchDigest + 1);
+            if (RT_FAILURE(vrc))
+                throw setError(E_OUTOFMEMORY, tr("Could not allocate string for SHA256 digest (%Rrc)"), vrc);
 
+            vrc = RTSha256ToString(digest, pszDigest, cchDigest + 1);
             if (RT_SUCCESS(vrc))
                 /* Copy the SHA256 sum of the OVF file for later validation */
                 m->strOVFSHADigest = pszDigest;
             else
-                throw setError(VBOX_E_FILE_ERROR,
-                           tr("Converting SHA256 digest to a string was failed (%Rrc)"), vrc);
+                throw setError(VBOX_E_FILE_ERROR, tr("Converting SHA256 digest to a string was failed (%Rrc)"), vrc);
 
             RTStrFree(pszDigest);
 
@@ -1250,7 +1206,7 @@ HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDI
  * @param pTask
  * @return
  */
-HRESULT Appliance::readS3(TaskOVF *pTask)
+HRESULT Appliance::i_readS3(TaskOVF *pTask)
 {
     LogFlowFuncEnter();
     LogFlowFunc(("Appliance %p\n", this));
@@ -1275,7 +1231,7 @@ HRESULT Appliance::readS3(TaskOVF *pTask)
         /* Extract the bucket */
         Utf8Str tmpPath = pTask->locInfo.strPath;
         Utf8Str bucket;
-        parseBucket(tmpPath, bucket);
+        i_parseBucket(tmpPath, bucket);
 
         /* We need a temporary directory which we can put the OVF file & all
          * disk images in */
@@ -1292,7 +1248,7 @@ HRESULT Appliance::readS3(TaskOVF *pTask)
                          pTask->locInfo.strUsername.c_str(),
                          pTask->locInfo.strPassword.c_str(),
                          pTask->locInfo.strHostname.c_str(),
-                         "virtualbox-agent/"VBOX_VERSION_STRING);
+                         "virtualbox-agent/" VBOX_VERSION_STRING);
         if (RT_FAILURE(vrc))
             throw setError(VBOX_E_IPRT_ERROR,
                            tr("Cannot create S3 service handler"));
@@ -1330,7 +1286,7 @@ HRESULT Appliance::readS3(TaskOVF *pTask)
         LocationInfo li;
         li.strPath = strTmpOvf;
         /* Start the reading from the fs */
-        rc = readImpl(li, progress);
+        rc = i_readImpl(li, progress);
         if (FAILED(rc)) throw rc;
 
         /* Unlock the appliance for the reading thread */
@@ -1338,7 +1294,7 @@ HRESULT Appliance::readS3(TaskOVF *pTask)
         /* Wait until the reading is done, but report the progress back to the
            caller */
         ComPtr<IProgress> progressInt(progress);
-        waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
+        i_waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
 
         /* Again lock the appliance for the next steps */
         appLock.acquire();
@@ -1389,14 +1345,14 @@ HRESULT Appliance::readS3(TaskOVF *pTask)
  * This is in a separate private method because it is used from two locations:
  *
  * 1) from the public Appliance::ImportMachines().
- * 2) from Appliance::importS3(), which got called from a previous instance of Appliance::taskThreadImportOrExport().
+ * 2) from Appliance::i_importS3(), which got called from a previous instance of Appliance::taskThreadImportOrExport().
  *
  * @param aLocInfo
  * @param aProgress
  * @return
  */
-HRESULT Appliance::importImpl(const LocationInfo &locInfo,
-                              ComObjPtr<Progress> &progress)
+HRESULT Appliance::i_importImpl(const LocationInfo &locInfo,
+                                ComObjPtr<Progress> &progress)
 {
     HRESULT rc = S_OK;
 
@@ -1406,9 +1362,9 @@ HRESULT Appliance::importImpl(const LocationInfo &locInfo,
     else
         mode = ImportS3;
 
-    rc = setUpProgress(progress,
-                       BstrFmt(tr("Importing appliance '%s'"), locInfo.strPath.c_str()),
-                       mode);
+    rc = i_setUpProgress(progress,
+                         BstrFmt(tr("Importing appliance '%s'"), locInfo.strPath.c_str()),
+                         mode);
     if (FAILED(rc)) throw rc;
 
     /* Initialize our worker task */
@@ -1433,32 +1389,29 @@ HRESULT Appliance::importImpl(const LocationInfo &locInfo,
  *
  * This runs in three contexts:
  *
- * 1) in a first worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl();
+ * 1) in a first worker thread; in that case, Appliance::ImportMachines() called Appliance::i_importImpl();
  *
- * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl(), which
- *    called Appliance::importFSOVA(), which called Appliance::importImpl(), which then called this again.
+ * 2) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::i_importImpl(), which
+ *    called Appliance::i_i_importFSOVA(), which called Appliance::i_importImpl(), which then called this again.
  *
- * 3) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::importImpl(), which
- *    called Appliance::importS3(), which called Appliance::importImpl(), which then called this again.
+ * 3) in a second worker thread; in that case, Appliance::ImportMachines() called Appliance::i_importImpl(), which
+ *    called Appliance::i_importS3(), which called Appliance::i_importImpl(), which then called this again.
  *
  * @param   pTask       The OVF task data.
  * @return  COM status code.
  */
-HRESULT Appliance::importFS(TaskOVF *pTask)
+HRESULT Appliance::i_importFS(TaskOVF *pTask)
 {
 
     LogFlowFuncEnter();
     LogFlowFunc(("Appliance %p\n", this));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* Change the appliance state so we can safely leave the lock while doing
      * time-consuming disk imports; also the below method calls do all kinds of
      * locking which conflicts with the appliance object lock. */
     AutoWriteLock writeLock(this COMMA_LOCKVAL_SRC_POS);
     /* Check if the appliance is currently busy. */
-    if (!isApplianceIdle())
+    if (!i_isApplianceIdle())
         return E_ACCESSDENIED;
     /* Set the internal state to importing. */
     m->state = Data::ApplianceImporting;
@@ -1469,9 +1422,9 @@ HRESULT Appliance::importFS(TaskOVF *pTask)
     m->llGuidsMachinesCreated.clear();
 
     if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive))
-        rc = importFSOVF(pTask, writeLock);
+        rc = i_importFSOVF(pTask, writeLock);
     else
-        rc = importFSOVA(pTask, writeLock);
+        rc = i_importFSOVA(pTask, writeLock);
 
     if (FAILED(rc))
     {
@@ -1508,7 +1461,7 @@ HRESULT Appliance::importFS(TaskOVF *pTask)
     return rc;
 }
 
-HRESULT Appliance::importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
+HRESULT Appliance::i_importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
 {
     LogFlowFuncEnter();
 
@@ -1519,6 +1472,10 @@ HRESULT Appliance::importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
     void *pvMfBuf = NULL;
     void *pvCertBuf = NULL;
     writeLock.release();
+
+    /* Create the import stack for the rollback on errors. */
+    ImportStack stack(pTask->locInfo, m->pReader->m_mapDisks, pTask->pProgress);
+
     try
     {
         /* Create the necessary file access interfaces. */
@@ -1526,12 +1483,12 @@ HRESULT Appliance::importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
         if (!pFileIo)
             throw setError(E_OUTOFMEMORY);
 
-        Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripExt().append(".mf");
+        Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf");
 
         SHASTORAGE storage;
         RT_ZERO(storage);
 
-        Utf8Str name = applianceIOName(applianceIOFile);
+        Utf8Str name = i_applianceIOName(applianceIOFile);
 
         int vrc = VDInterfaceAdd(&pFileIo->Core, name.c_str(),
                                  VDINTERFACETYPE_IO, 0, sizeof(VDINTERFACEIO),
@@ -1539,16 +1496,13 @@ HRESULT Appliance::importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
         if (RT_FAILURE(vrc))
             throw setError(VBOX_E_IPRT_ERROR, "Creation of the VD interface failed (%Rrc)", vrc);
 
-        /* Create the import stack for the rollback on errors. */
-        ImportStack stack(pTask->locInfo, m->pReader->m_mapDisks, pTask->pProgress);
-
         if (RTFileExists(strMfFile.c_str()))
         {
             pShaIo = ShaCreateInterface();
             if (!pShaIo)
                 throw setError(E_OUTOFMEMORY);
 
-            Utf8Str nameSha = applianceIOName(applianceIOSha);
+            Utf8Str nameSha = i_applianceIOName(applianceIOSha);
             /* Fill out interface descriptor. */
             pShaIo->Core.u32Magic         = VDINTERFACE_MAGIC;
             pShaIo->Core.cbSize           = sizeof(VDINTERFACEIO);
@@ -1559,41 +1513,64 @@ HRESULT Appliance::importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
 
             storage.fCreateDigest = true;
 
-            size_t cbMfSize = 0;
+            size_t cbMfFile = 0;
 
             /* Now import the appliance. */
-            importMachines(stack, pShaIo, &storage);
+            i_importMachines(stack, pShaIo, &storage);
             /* Read & verify the manifest file. */
             /* Add the ovf file to the digest list. */
             stack.llSrcDisksDigest.push_front(STRPAIR(pTask->locInfo.strPath, m->strOVFSHADigest));
-            rc = readFileToBuf(strMfFile, &pvMfBuf, &cbMfSize, true, pShaIo, &storage);
+            rc = i_readFileToBuf(strMfFile, &pvMfBuf, &cbMfFile, true, pShaIo, &storage);
             if (FAILED(rc)) throw rc;
-            rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
+            rc = i_verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfFile);
             if (FAILED(rc)) throw rc;
 
-            size_t cbCertSize = 0;
+            size_t cbCertFile = 0;
 
             /* Save the SHA digest of the manifest file for the next validation */
             Utf8Str manifestShaDigest = storage.strDigest;
 
-            Utf8Str strCertFile = Utf8Str(pTask->locInfo.strPath).stripExt().append(".cert");
+            Utf8Str strCertFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".cert");
             if (RTFileExists(strCertFile.c_str()))
             {
-                rc = readFileToBuf(strCertFile, &pvCertBuf, &cbCertSize, false, pShaIo, &storage);
+                rc = i_readFileToBuf(strCertFile, &pvCertBuf, &cbCertFile, false, pShaIo, &storage);
                 if (FAILED(rc)) throw rc;
 
                 /* verify Certificate */
+                rc = i_verifyCertificateFile(pvCertBuf, cbCertFile, &storage);
+                if (FAILED(rc)) throw rc;
             }
         }
         else
         {
             storage.fCreateDigest = false;
-            importMachines(stack, pFileIo, &storage);
+            i_importMachines(stack, pFileIo, &storage);
         }
     }
     catch (HRESULT rc2)
     {
         rc = rc2;
+        /*
+         * Restoring original UUID from OVF description file.
+         * During import VBox creates new UUIDs for imported images and
+         * assigns them to the images. In case of failure we have to restore
+         * the original UUIDs because those new UUIDs are obsolete now and
+         * won't be used anymore.
+         */
+        {
+            ErrorInfoKeeper eik; /* paranoia */
+            list< ComObjPtr<VirtualSystemDescription> >::const_iterator itvsd;
+            /* Iterate through all virtual systems of that appliance */
+            for (itvsd = m->virtualSystemDescriptions.begin();
+                 itvsd != m->virtualSystemDescriptions.end();
+                 ++itvsd)
+            {
+                ComObjPtr<VirtualSystemDescription> vsdescThis = (*itvsd);
+                settings::MachineConfigFile *pConfig = vsdescThis->m->pConfig;
+                if(vsdescThis->m->pConfig!=NULL)
+                    stack.restoreOriginalUUIDOfAttachedDevice(pConfig);
+            }
+        }
     }
     writeLock.acquire();
 
@@ -1613,53 +1590,51 @@ HRESULT Appliance::importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock)
     return rc;
 }
 
-HRESULT Appliance::importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
+HRESULT Appliance::i_importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
 {
     LogFlowFuncEnter();
+    HRESULT rc = S_OK;
 
-    RTTAR tar;
-    int vrc = RTTarOpen(&tar,
-                        pTask->locInfo.strPath.c_str(),
-                        RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, true);
+    /*
+     * Open the OVA (TAR) file.
+     */
+    PFSSRDONLYINTERFACEIO pTarIo;
+    int vrc = fssRdOnlyCreateInterfaceForTarFile(pTask->locInfo.strPath.c_str(), &pTarIo);
     if (RT_FAILURE(vrc))
         return setError(VBOX_E_FILE_ERROR,
                         tr("Could not open OVA file '%s' (%Rrc)"),
                         pTask->locInfo.strPath.c_str(), vrc);
 
-    HRESULT rc = S_OK;
 
     PVDINTERFACEIO pShaIo = 0;
-    PVDINTERFACEIO pTarIo = 0;
-    char *pszFilename = 0;
-    void *pvMfBuf = 0;
-    void *pvCertBuf = 0;
+    void *pvMfBuf = NULL;
+    void *pvCertBuf = NULL;
     Utf8Str OVFfilename;
 
     writeLock.release();
+
+    /* Create the import stack for the rollback on errors. */
+    ImportStack stack(pTask->locInfo, m->pReader->m_mapDisks, pTask->pProgress);
+
     try
     {
         /* Create the necessary file access interfaces. */
         pShaIo = ShaCreateInterface();
         if (!pShaIo)
             throw setError(E_OUTOFMEMORY);
-        pTarIo = TarCreateInterface();
-        if (!pTarIo)
-            throw setError(E_OUTOFMEMORY);
 
+        Utf8Str nameTar = i_applianceIOName(applianceIOTar);
         SHASTORAGE storage;
         RT_ZERO(storage);
-
-        Utf8Str nameTar = applianceIOName(applianceIOTar);
-
-        vrc = VDInterfaceAdd(&pTarIo->Core, nameTar.c_str(),
-                             VDINTERFACETYPE_IO, tar, sizeof(VDINTERFACEIO),
+        vrc = VDInterfaceAdd((PVDINTERFACE)pTarIo, nameTar.c_str(),
+                             VDINTERFACETYPE_IO, pTarIo, sizeof(VDINTERFACEIO),
                              &storage.pVDImageIfaces);
         if (RT_FAILURE(vrc))
             throw setError(VBOX_E_IPRT_ERROR,
                            tr("Creation of the VD interface failed (%Rrc)"), vrc);
 
-        Utf8Str nameSha = applianceIOName(applianceIOSha);
         /* Fill out interface descriptor. */
+        Utf8Str nameSha = i_applianceIOName(applianceIOSha);
         pShaIo->Core.u32Magic         = VDINTERFACE_MAGIC;
         pShaIo->Core.cbSize           = sizeof(VDINTERFACEIO);
         pShaIo->Core.pszInterfaceName = nameSha.c_str();
@@ -1667,101 +1642,102 @@ HRESULT Appliance::importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
         pShaIo->Core.pvUser           = &storage;
         pShaIo->Core.pNext            = NULL;
 
-        /* Read the file name of the first file (need to be the ovf file). This
-         * is how all internal files are named. */
-        vrc = RTTarCurrentFile(tar, &pszFilename);
+        /*
+         * File #1 - the .ova file.
+         *
+         * Read the name of the first file. This is how all internal files
+         * are named.
+         */
+        const char *pszFilename;
+        vrc = fssRdOnlyGetCurrentName(pTarIo, &pszFilename);
         if (RT_FAILURE(vrc))
             throw setError(VBOX_E_IPRT_ERROR,
                            tr("Getting the OVF file within the archive failed (%Rrc)"), vrc);
-        else
-        {
-            if (vrc == VINF_TAR_DIR_PATH)
-            {
-                throw setError(VBOX_E_FILE_ERROR,
-                       tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"),
-                          pszFilename,
-                          vrc);
-            }
-        }
+        if (vrc == VINF_TAR_DIR_PATH)
+            throw setError(VBOX_E_FILE_ERROR,
+                           tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"),
+                           pszFilename, vrc);
 
         /* save original OVF filename */
         OVFfilename = pszFilename;
-        size_t cbMfSize = 0;
-        size_t cbCertSize = 0;
-        Utf8Str strMfFile = (Utf8Str(pszFilename)).stripExt().append(".mf");
-        Utf8Str strCertFile = (Utf8Str(pszFilename)).stripExt().append(".cert");
+        Utf8Str strMfFile = (Utf8Str(pszFilename)).stripSuffix().append(".mf");
+        Utf8Str strCertFile = (Utf8Str(pszFilename)).stripSuffix().append(".cert");
 
         /* Skip the OVF file, cause this was read in IAppliance::Read already. */
-        vrc = RTTarSeekNextFile(tar);
+        vrc = fssRdOnlySkipCurrent(pTarIo);
+        if (RT_SUCCESS(vrc))
+            vrc = fssRdOnlyGetCurrentName(pTarIo, &pszFilename);
         if (   RT_FAILURE(vrc)
-            && vrc != VERR_TAR_END_OF_FILE)
-            throw setError(VBOX_E_IPRT_ERROR,
-                           tr("Seeking within the archive failed (%Rrc)"), vrc);
-        else
-        {
-            RTTarCurrentFile(tar, &pszFilename);
-            if (vrc == VINF_TAR_DIR_PATH)
-            {
-                throw setError(VBOX_E_FILE_ERROR,
-                       tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"),
-                          pszFilename,
-                          vrc);
-            }
-        }
+            && vrc != VERR_EOF)
+            throw setError(VBOX_E_IPRT_ERROR, tr("Seeking within the archive failed (%Rrc)"), vrc);
 
         PVDINTERFACEIO pCallbacks = pShaIo;
         PSHASTORAGE pStorage = &storage;
 
-        /* We always need to create the digest, cause we didn't know if there
+        /* We always need to create the digest, cause we don't know if there
          * is a manifest file in the stream. */
         pStorage->fCreateDigest = true;
 
-        /* Create the import stack for the rollback on errors. */
-        ImportStack stack(pTask->locInfo, m->pReader->m_mapDisks, pTask->pProgress);
         /*
-         * Try to read the manifest file. First try.
+         * File #2 - the manifest file (.mf), optional.
          *
          * Note: This isn't fatal if the file is not found. The standard
-         * defines 3 cases.
-         * 1. no manifest file
-         * 2. manifest file after the OVF file
-         * 3. manifest file after all disk files
+         * defines 3 cases:
+         *  1. no manifest file
+         *  2. manifest file after the OVF file
+         *  3. manifest file after all disk files
+         *
          * If we want streaming capabilities, we can't check if it is there by
          * searching for it. We have to try to open it on all possible places.
          * If it fails here, we will try it again after all disks where read.
          */
-        rc = readTarFileToBuf(tar, strMfFile, &pvMfBuf, &cbMfSize, true, pCallbacks, pStorage);
-        if (FAILED(rc)) throw rc;
+        size_t cbMfFile = 0;
+        rc = i_readTarFileToBuf(pTarIo, strMfFile, &pvMfBuf, &cbMfFile, true, pCallbacks, pStorage);
+        if (FAILED(rc))
+            throw rc;
 
         /*
-         * Try to read the certificate file. First try.
-         * Logic is the same as with manifest file
-         * Only if the manifest file had been read successfully before
+         * File #3 - certificate file (.cer), optional.
+         *
+         * Logic is the same as with manifest file.  This only makes sense if
+         * there is a manifest file.
          */
-        vrc = RTTarCurrentFile(tar, &pszFilename);
+        size_t cbCertFile = 0;
+        vrc = fssRdOnlyGetCurrentName(pTarIo, &pszFilename);
         if (RT_SUCCESS(vrc))
         {
             if (pvMfBuf)
             {
                 if (strCertFile.compare(pszFilename) == 0)
                 {
-                    rc = readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
+                    rc = i_readTarFileToBuf(pTarIo, strCertFile, &pvCertBuf, &cbCertFile, false, pCallbacks, pStorage);
                     if (FAILED(rc)) throw rc;
 
                     if (pvCertBuf)
                     {
-                    /* verify the certificate */
+                        /* verify the certificate */
+                        rc = i_verifyCertificateFile(pvCertBuf, cbCertFile, pStorage);
+                        if (FAILED(rc)) throw rc;
                     }
                 }
             }
         }
 
-        /* Now import the appliance. */
-        importMachines(stack, pCallbacks, pStorage);
-        /* Try to read the manifest file. Second try. */
+        /*
+         * Now import the appliance.
+         */
+        i_importMachines(stack, pCallbacks, pStorage);
+
+        /*
+         * The certificate and mainifest files may alternatively be stored
+         * after the disk files, so look again if we didn't find them already.
+         */
         if (!pvMfBuf)
         {
-            rc = readTarFileToBuf(tar, strMfFile, &pvMfBuf, &cbMfSize, true, pCallbacks, pStorage);
+            /*
+             * File #N-1 - The manifest file, optional.
+             */
+            rc = i_readTarFileToBuf(pTarIo, strMfFile, &pvMfBuf, &cbMfFile, true, pCallbacks, pStorage);
             if (FAILED(rc)) throw rc;
 
             /* If we were able to read a manifest file we can check it now. */
@@ -1769,48 +1745,65 @@ HRESULT Appliance::importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
             {
                 /* Add the ovf file to the digest list. */
                 stack.llSrcDisksDigest.push_front(STRPAIR(OVFfilename, m->strOVFSHADigest));
-                rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
+                rc = i_verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfFile);
                 if (FAILED(rc)) throw rc;
 
                 /*
-                 * Try to read the certificate file. Second try.
-                 * Only if the manifest file had been read successfully before
+                 * File #N - The certificate file, optional.
+                 * (Requires mainfest, as mention before.)
                  */
-
-                vrc = RTTarCurrentFile(tar, &pszFilename);
+                vrc = fssRdOnlyGetCurrentName(pTarIo, &pszFilename);
                 if (RT_SUCCESS(vrc))
                 {
                     if (strCertFile.compare(pszFilename) == 0)
                     {
-                        rc = readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
+                        rc = i_readTarFileToBuf(pTarIo, strCertFile, &pvCertBuf, &cbCertFile, false, pCallbacks, pStorage);
                         if (FAILED(rc)) throw rc;
 
                         if (pvCertBuf)
                         {
-                        /* verify the certificate */
+                            /* verify the certificate */
+                            rc = i_verifyCertificateFile(pvCertBuf, cbCertFile, pStorage);
+                            if (FAILED(rc)) throw rc;
                         }
                     }
                 }
             }
         }
+        /** @todo else: Verify the manifest! */
     }
     catch (HRESULT rc2)
     {
         rc = rc2;
+
+        /*
+         * Restoring original UUID from OVF description file.
+         * During import VBox creates new UUIDs for imported images and
+         * assigns them to the images. In case of failure we have to restore
+         * the original UUIDs because those new UUIDs are obsolete now and
+         * won't be used anymore.
+         */
+        ErrorInfoKeeper eik; /* paranoia */
+        list< ComObjPtr<VirtualSystemDescription> >::const_iterator itvsd;
+        /* Iterate through all virtual systems of that appliance */
+        for (itvsd = m->virtualSystemDescriptions.begin();
+             itvsd != m->virtualSystemDescriptions.end();
+             ++itvsd)
+        {
+            ComObjPtr<VirtualSystemDescription> vsdescThis = (*itvsd);
+            settings::MachineConfigFile *pConfig = vsdescThis->m->pConfig;
+            if(vsdescThis->m->pConfig!=NULL)
+              stack.restoreOriginalUUIDOfAttachedDevice(pConfig);
+        }
     }
     writeLock.acquire();
 
-    RTTarClose(tar);
-
     /* Cleanup */
-    if (pszFilename)
-        RTMemFree(pszFilename);
+    fssRdOnlyDestroyInterface(pTarIo);
     if (pvMfBuf)
         RTMemFree(pvMfBuf);
     if (pShaIo)
         RTMemFree(pShaIo);
-    if (pTarIo)
-        RTMemFree(pTarIo);
     if (pvCertBuf)
         RTMemFree(pvCertBuf);
 
@@ -1824,18 +1817,15 @@ HRESULT Appliance::importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock)
 /**
  * Worker code for importing OVF from the cloud. This is called from Appliance::taskThreadImportOrExport()
  * in S3 mode and therefore runs on the OVF import worker thread. This then starts a second worker
- * thread to import from temporary files (see Appliance::importFS()).
+ * thread to import from temporary files (see Appliance::i_importFS()).
  * @param pTask
  * @return
  */
-HRESULT Appliance::importS3(TaskOVF *pTask)
+HRESULT Appliance::i_importS3(TaskOVF *pTask)
 {
     LogFlowFuncEnter();
     LogFlowFunc(("Appliance %p\n", this));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock appLock(this COMMA_LOCKVAL_SRC_POS);
 
     int vrc = VINF_SUCCESS;
@@ -1852,7 +1842,7 @@ HRESULT Appliance::importS3(TaskOVF *pTask)
         /* Extract the bucket */
         Utf8Str tmpPath = pTask->locInfo.strPath;
         Utf8Str bucket;
-        parseBucket(tmpPath, bucket);
+        i_parseBucket(tmpPath, bucket);
 
         /* We need a temporary directory which we can put the all disk images
          * in */
@@ -1868,7 +1858,8 @@ HRESULT Appliance::importS3(TaskOVF *pTask)
              ++it)
         {
             ComObjPtr<VirtualSystemDescription> vsdescThis = (*it);
-            std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
+            std::list<VirtualSystemDescriptionEntry*> avsdeHDs =
+                vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
             std::list<VirtualSystemDescriptionEntry*>::const_iterator itH;
             for (itH = avsdeHDs.begin();
                  itH != avsdeHDs.end();
@@ -1889,7 +1880,7 @@ HRESULT Appliance::importS3(TaskOVF *pTask)
                          pTask->locInfo.strUsername.c_str(),
                          pTask->locInfo.strPassword.c_str(),
                          pTask->locInfo.strHostname.c_str(),
-                         "virtualbox-agent/"VBOX_VERSION_STRING);
+                         "virtualbox-agent/" VBOX_VERSION_STRING);
         if (RT_FAILURE(vrc))
             throw setError(VBOX_E_IPRT_ERROR,
                            tr("Cannot create S3 service handler"));
@@ -1970,7 +1961,7 @@ HRESULT Appliance::importS3(TaskOVF *pTask)
         /* Import the whole temporary OVF & the disk images */
         LocationInfo li;
         li.strPath = strTmpOvf;
-        rc = importImpl(li, progress);
+        rc = i_importImpl(li, progress);
         if (FAILED(rc)) throw rc;
 
         /* Unlock the appliance for the fs import thread */
@@ -1978,7 +1969,7 @@ HRESULT Appliance::importS3(TaskOVF *pTask)
         /* Wait until the import is done, but report the progress back to the
            caller */
         ComPtr<IProgress> progressInt(progress);
-        waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
+        i_waitForAsyncProgress(pTask->pProgress, progressInt); /* Any errors will be thrown */
 
         /* Again lock the appliance for the next steps */
         appLock.acquire();
@@ -2019,18 +2010,18 @@ HRESULT Appliance::importS3(TaskOVF *pTask)
 }
 #endif /* VBOX_WITH_S3 */
 
-HRESULT Appliance::readFileToBuf(const Utf8Str &strFile,
-                                 void **ppvBuf,
-                                 size_t *pcbSize,
-                                 bool fCreateDigest,
-                                 PVDINTERFACEIO pCallbacks,
-                                 PSHASTORAGE pStorage)
+HRESULT Appliance::i_readFileToBuf(const Utf8Str &strFile,
+                                   void **ppvBuf,
+                                   size_t *pcbSize,
+                                   bool fCreateDigest,
+                                   PVDINTERFACEIO pCallbacks,
+                                   PSHASTORAGE pStorage)
 {
     HRESULT rc = S_OK;
 
     bool fOldDigest = pStorage->fCreateDigest;/* Save the old digest property */
     pStorage->fCreateDigest = fCreateDigest;
-    int vrc = ShaReadBuf(strFile.c_str(), ppvBuf, pcbSize, pCallbacks, pStorage);
+    int vrc = readFileIntoBuffer(strFile.c_str(), ppvBuf, pcbSize, pCallbacks, pStorage);
     if (   RT_FAILURE(vrc)
         && vrc != VERR_FILE_NOT_FOUND)
         rc = setError(VBOX_E_FILE_ERROR,
@@ -2041,42 +2032,40 @@ HRESULT Appliance::readFileToBuf(const Utf8Str &strFile,
     return rc;
 }
 
-HRESULT Appliance::readTarFileToBuf(RTTAR tar,
-                                    const Utf8Str &strFile,
-                                    void **ppvBuf,
-                                    size_t *pcbSize,
-                                    bool fCreateDigest,
-                                    PVDINTERFACEIO pCallbacks,
-                                    PSHASTORAGE pStorage)
+HRESULT Appliance::i_readTarFileToBuf(PFSSRDONLYINTERFACEIO pTarIo,
+                                      const Utf8Str &strFile,
+                                      void **ppvBuf,
+                                      size_t *pcbSize,
+                                      bool fCreateDigest,
+                                      PVDINTERFACEIO pCallbacks,
+                                      PSHASTORAGE pStorage)
 {
     HRESULT rc = S_OK;
 
-    char *pszCurFile;
-    int vrc = RTTarCurrentFile(tar, &pszCurFile);
+    const char *pszCurFile;
+    int vrc = fssRdOnlyGetCurrentName(pTarIo, &pszCurFile);
     if (RT_SUCCESS(vrc))
     {
-        if (vrc == VINF_TAR_DIR_PATH)
-        {
-            rc = setError(VBOX_E_FILE_ERROR,
-                          tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"),
-                             pszCurFile,
-                             vrc);
-        }
-        else
+        if (vrc != VINF_TAR_DIR_PATH)
         {
             if (!strcmp(pszCurFile, RTPathFilename(strFile.c_str())))
-                rc = readFileToBuf(strFile, ppvBuf, pcbSize, fCreateDigest, pCallbacks, pStorage);
-            RTStrFree(pszCurFile);
+                rc = i_readFileToBuf(strFile, ppvBuf, pcbSize, fCreateDigest, pCallbacks, pStorage);
         }
+        else
+            rc = setError(VBOX_E_FILE_ERROR,
+                          tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"),
+                          pszCurFile, vrc);
     }
-    else if (vrc != VERR_TAR_END_OF_FILE)
+    else if (vrc != VERR_EOF)
         rc = setError(VBOX_E_IPRT_ERROR, "Seeking within the archive failed (%Rrc)", vrc);
 
     return rc;
 }
 
-HRESULT Appliance::verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize)
+HRESULT Appliance::i_verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, void *pvBuf, size_t cbSize)
 {
+    LogFlowFuncEnter();
+    LogFlowFunc(("Appliance %p\n", this));
     HRESULT rc = S_OK;
 
     PRTMANIFESTTEST paTests = (PRTMANIFESTTEST)RTMemAlloc(sizeof(RTMANIFESTTEST) * stack.llSrcDisksDigest.size());
@@ -2104,7 +2093,112 @@ HRESULT Appliance::verifyManifestFile(const Utf8Str &strFile, ImportStack &stack
                       RTPathFilename(strFile.c_str()), vrc);
 
     RTMemFree(paTests);
+    LogFlowFuncLeave();
+
+    return rc;
+}
+
+HRESULT Appliance::i_verifyCertificateFile(void *pvBuf, size_t cbSize, PSHASTORAGE pStorage)
+{
+    LogFlowFuncEnter();
+    LogFlowFunc(("Appliance %p\n", this));
+    HRESULT rc = S_OK;
+
+    int vrc = 0;
+    RTDIGESTTYPE digestType;
+    void * pvCertBuf = pvBuf;
+    size_t cbCertSize = cbSize;
+    Utf8Str manifestDigest = pStorage->strDigest;
+
+    vrc = RTManifestVerifyDigestType(pvCertBuf, cbCertSize, &digestType);
+    if (RT_FAILURE(vrc))
+    {
+        rc = setError(VBOX_E_FILE_ERROR, tr("Digest type of certificate is unknown"));
+    }
+    else
+    {
+        RTX509PrepareOpenSSL();
+
+        vrc = RTRSAVerify(pvCertBuf, (unsigned int)cbCertSize, manifestDigest.c_str(), digestType);
+        if (RT_SUCCESS(vrc))
+        {
+            /*
+             * possible step in the future. Not obligatory due to OVF2.0 standard
+             * OVF2.0:"A consumer of the OVF package shall verify the signature and should validate the certificate"
+             */
+            vrc = RTX509CertificateVerify(pvCertBuf, (unsigned int)cbCertSize);
+        }
+
+        /* After first unsuccessful operation */
+        if (RT_FAILURE(vrc))
+        {
+            {
+                /* first stage for getting possible error code and it's description using native openssl method */
+                char* errStrDesc = NULL;
+                unsigned long errValue = RTX509GetErrorDescription(&errStrDesc);
+
+                if(errValue != 0)
+                {
+                    rc = setError(VBOX_E_FILE_ERROR, tr(errStrDesc));
+                    LogFlowFunc(("Error during verifying X509 certificate(internal openssl description): %s\n", errStrDesc));
+                }
+
+                RTMemFree(errStrDesc);
+            }
+
+            {
+                /* second stage for getting possible error code using our defined errors codes. The original error description
+                   will be replaced by our description */
+
+                Utf8Str errStrDesc;
+                switch(vrc)
+                {
+                    case VERR_X509_READING_CERT_FROM_BIO:
+                        errStrDesc = "Error during reading a certificate in PEM format from BIO ";
+                        break;
+                    case VERR_X509_EXTRACT_PUBKEY_FROM_CERT:
+                        errStrDesc = "Error during extraction a public key from the certificate ";
+                        break;
+                    case VERR_X509_EXTRACT_RSA_FROM_PUBLIC_KEY:
+                        errStrDesc = "Error during extraction RSA from the public key ";
+                        break;
+                    case VERR_X509_RSA_VERIFICATION_FUILURE:
+                        errStrDesc = "RSA verification failure ";
+                        break;
+                    case VERR_X509_NO_BASIC_CONSTARAINTS:
+                        errStrDesc = "Basic constraints were not found ";
+                        break;
+                    case VERR_X509_GETTING_EXTENSION_FROM_CERT:
+                        errStrDesc = "Error during getting extensions from the certificate ";
+                        break;
+                    case VERR_X509_GETTING_DATA_FROM_EXTENSION:
+                        errStrDesc = "Error during extraction data from the extension ";
+                        break;
+                    case VERR_X509_PRINT_EXTENSION_TO_BIO:
+                        errStrDesc = "Error during print out an extension to BIO ";
+                        break;
+                    case VERR_X509_CERTIFICATE_VERIFICATION_FAILURE:
+                        errStrDesc = "X509 certificate verification failure ";
+                        break;
+                    default:
+                        errStrDesc = "Unknown error during X509 certificate verification";
+                }
+                rc = setError(VBOX_E_FILE_ERROR, tr(errStrDesc.c_str()));
+            }
+        }
+        else
+        {
+            if(vrc == VINF_X509_NOT_SELFSIGNED_CERTIFICATE)
+            {
+                setWarning(VBOX_E_FILE_ERROR,
+                           tr("Signature from the X509 certificate has been verified. "
+                              "But VirtualBox can't validate the given X509 certificate. "
+                              "Only self signed X509 certificates are supported at moment. \n"));
+            }
+        }
+    }
 
+    LogFlowFuncLeave();
     return rc;
 }
 
@@ -2118,13 +2212,13 @@ HRESULT Appliance::verifyManifestFile(const Utf8Str &strFile, ImportStack &stack
  * @param lControllerPort out: the channel (controller port) of the controller to attach to.
  * @param lDevice out: the device number to attach to.
  */
-void Appliance::convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
+void Appliance::i_convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
                                             uint32_t ulAddressOnParent,
                                             Bstr &controllerType,
                                             int32_t &lControllerPort,
                                             int32_t &lDevice)
 {
-    Log(("Appliance::convertDiskAttachmentValues: hdc.system=%d, hdc.fPrimary=%d, ulAddressOnParent=%d\n",
+    Log(("Appliance::i_convertDiskAttachmentValues: hdc.system=%d, hdc.fPrimary=%d, ulAddressOnParent=%d\n",
          hdc.system,
          hdc.fPrimary,
          ulAddressOnParent));
@@ -2195,9 +2289,14 @@ void Appliance::convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
         break;
 
         case ovf::HardDiskController::SCSI:
-            controllerType = Bstr("SCSI Controller");
+        {
+            if(hdc.strControllerType.compare("lsilogicsas")==0)
+                controllerType = Bstr("SAS Controller");
+            else
+                controllerType = Bstr("SCSI Controller");
             lControllerPort = (long)ulAddressOnParent;
             lDevice = (long)0;
+        }
         break;
 
         default: break;
@@ -2208,9 +2307,9 @@ void Appliance::convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
 
 /**
  * Imports one disk image. This is common code shared between
- *  --  importMachineGeneric() for the OVF case; in that case the information comes from
+ *  --  i_importMachineGeneric() for the OVF case; in that case the information comes from
  *      the OVF virtual systems;
- *  --  importVBoxMachine(); in that case, the information comes from the <vbox:Machine>
+ *  --  i_importVBoxMachine(); in that case, the information comes from the <vbox:Machine>
  *      tag.
  *
  * Both ways of describing machines use the OVF disk references section, so in both cases
@@ -2227,12 +2326,12 @@ void Appliance::convertDiskAttachmentValues(const ovf::HardDiskController &hdc,
  * @param pTargetHD out: The newly created target disk. This also gets pushed on stack.llHardDisksCreated for cleanup.
  * @param stack
  */
-void Appliance::importOneDiskImage(const ovf::DiskImage &di,
-                                   Utf8Str *strTargetPath,
-                                   ComObjPtr<Medium> &pTargetHD,
-                                   ImportStack &stack,
-                                   PVDINTERFACEIO pCallbacks,
-                                   PSHASTORAGE pStorage)
+void Appliance::i_importOneDiskImage(const ovf::DiskImage &di,
+                                     Utf8Str *strTargetPath,
+                                     ComObjPtr<Medium> &pTargetHD,
+                                     ImportStack &stack,
+                                     PVDINTERFACEIO pCallbacks,
+                                     PSHASTORAGE pStorage)
 {
     SHASTORAGE finalStorage;
     PSHASTORAGE pRealUsedStorage = pStorage;/* may be changed later to finalStorage */
@@ -2247,7 +2346,7 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
     if (FAILED(rc)) throw rc;
 
     /* Get the system properties. */
-    SystemProperties *pSysProps = mVirtualBox->getSystemProperties();
+    SystemProperties *pSysProps = mVirtualBox->i_getSystemProperties();
 
     /*
      * we put strSourceOVF into the stack.llSrcDisksDigest in the end of this
@@ -2259,7 +2358,7 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
     Utf8Str strTargetDir(*strTargetPath);
 
     /* Construct source file path */
-    Utf8Str name = applianceIOName(applianceIOTar);
+    Utf8Str name = i_applianceIOName(applianceIOTar);
 
     if (RTStrNICmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
         strSrcFilePath = strSourceOVF;
@@ -2276,7 +2375,7 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
     int vrc = RTUuidFromStr(&uuid, strTargetPath->c_str());
     if (vrc == VINF_SUCCESS)
     {
-        rc = mVirtualBox->findHardDiskById(Guid(uuid), true, &pTargetHD);
+        rc = mVirtualBox->i_findHardDiskById(Guid(uuid), true, &pTargetHD);
         if (FAILED(rc)) throw rc;
     }
     else
@@ -2297,12 +2396,11 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
 
                 /* Decompress the GZIP file and save a new file in the target path */
                 strTargetDir = strTargetDir.stripFilename();
-                strTargetDir.append("/temp_");
+                strTargetDir.append(RTPATH_SLASH_STR);
+                strTargetDir.append("temp_");
 
-                Utf8Str strTempTargetFilename(*strTargetPath);
+                Utf8Str strTempTargetFilename(strSrcFilePath);
                 strTempTargetFilename = strTempTargetFilename.stripPath();
-                strTempTargetFilename = strTempTargetFilename.stripExt();
-                Utf8Str vdf = typeOfVirtualDiskFormatFromURI(di.strFormat);
 
                 strTargetDir.append(strTempTargetFilename);
 
@@ -2318,7 +2416,7 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
                 if (!pFileIo)
                     throw setError(E_OUTOFMEMORY);
 
-                name = applianceIOName(applianceIOFile);
+                name = i_applianceIOName(applianceIOFile);
 
                 vrc = VDInterfaceAdd(&pFileIo->Core, name.c_str(),
                                      VDINTERFACETYPE_IO, NULL, sizeof(VDINTERFACEIO),
@@ -2329,27 +2427,59 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
 
                 /* Correct the source and the target with the actual values */
                 strSrcFilePath = strTargetDir;
-                strTargetDir = strTargetDir.stripFilename();
-                strTargetDir.append(RTPATH_SLASH_STR);
-                strTargetDir.append(strTempTargetFilename.c_str());
-                *strTargetPath = strTargetDir.c_str();
 
                 pRealUsedStorage = &finalStorage;
             }
 
             Utf8Str strTrgFormat = "VMDK";
+            ComObjPtr<MediumFormat> trgFormat;
+            Bstr bstrFormatName;
             ULONG lCabs = 0;
-            char *pszExt = NULL;
 
-            if (RTPathHaveExt(strTargetPath->c_str()))
+            //check existence of option "ImportToVDI", in this case all imported disks will be converted to VDI images
+            bool chExt = m->optListImport.contains(ImportOptions_ImportToVDI);
+
+            char *pszSuff = NULL;
+
+            if ((pszSuff = RTPathSuffix(strTargetPath->c_str()))!=NULL)
             {
-                pszExt = RTPathExt(strTargetPath->c_str());
-                /* Figure out which format the user like to have. Default is VMDK. */
-                ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&pszExt[1]);
+                /* 
+                 * Figure out which format the user like to have. Default is VMDK
+                 * or it can be VDI if according command-line option is set
+                 */
+
+                /*
+                 * We need a proper target format
+                 * if target format has been changed by user via GUI import wizard
+                 * or via VBoxManage import command (option --importtovdi)
+                 * then we need properly process such format like ISO
+                 * Because there is no conversion ISO to VDI
+                 */
+
+                pszSuff++;
+                trgFormat = pSysProps->i_mediumFormatFromExtension(pszSuff);
                 if (trgFormat.isNull())
-                    throw setError(VBOX_E_NOT_SUPPORTED,
-                                   tr("Could not find a valid medium format for the target disk '%s'"),
-                                   strTargetPath->c_str());
+                {
+                    rc = setError(E_FAIL,
+                           tr("Internal inconsistency looking up medium format for the disk image '%s'"),
+                           di.strHref.c_str());
+                }
+
+                rc = trgFormat->COMGETTER(Name)(bstrFormatName.asOutParam());
+                if (FAILED(rc)) throw rc;
+
+                strTrgFormat = Utf8Str(bstrFormatName);
+
+                if(chExt && strTrgFormat.compare("RAW", Utf8Str::CaseInsensitive) != 0)
+                {
+                    /* change the target extension */
+                    strTrgFormat = "vdi";
+                    trgFormat = pSysProps->i_mediumFormatFromExtension(strTrgFormat);
+                    *strTargetPath = strTargetPath->stripSuffix();
+                    *strTargetPath = strTargetPath->append(".");
+                    *strTargetPath = strTargetPath->append(strTrgFormat.c_str());
+                }
+
                 /* Check the capabilities. We need create capabilities. */
                 lCabs = 0;
                 com::SafeArray <MediumFormatCapabilities_T> mediumFormatCap;
@@ -2368,10 +2498,6 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
                     throw setError(VBOX_E_NOT_SUPPORTED,
                                    tr("Could not find a valid medium format for the target disk '%s'"),
                                    strTargetPath->c_str());
-                Bstr bstrFormatName;
-                rc = trgFormat->COMGETTER(Name)(bstrFormatName.asOutParam());
-                if (FAILED(rc)) throw rc;
-                strTrgFormat = Utf8Str(bstrFormatName);
             }
             else
             {
@@ -2434,13 +2560,15 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
                 rc = pTargetHD->init(mVirtualBox,
                                      strTrgFormat,
                                      *strTargetPath,
-                                     Guid::Empty /* media registry: none yet */);
+                                     Guid::Empty /* media registry: none yet */,
+                                     DeviceType_HardDisk);
                 if (FAILED(rc)) throw rc;
 
                 /* Now create an empty hard disk. */
-                rc = mVirtualBox->CreateHardDisk(Bstr(strTrgFormat).raw(),
-                                                 Bstr(*strTargetPath).raw(),
-                                                 ComPtr<IMedium>(pTargetHD).asOutParam());
+                rc = mVirtualBox->CreateMedium(Bstr(strTrgFormat).raw(),
+                                               Bstr(*strTargetPath).raw(),
+                                               AccessMode_ReadWrite, DeviceType_HardDisk,
+                                               ComPtr<IMedium>(pTargetHD).asOutParam());
                 if (FAILED(rc)) throw rc;
 
                 /* If strHref is empty we have to create a new file. */
@@ -2464,25 +2592,27 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
                 {
                     /* We need a proper source format description */
                     /* Which format to use? */
-                    Utf8Str strSrcFormat = typeOfVirtualDiskFormatFromURI(di.strFormat);
-
-                    ComObjPtr<MediumFormat> srcFormat = pSysProps->mediumFormat(strSrcFormat);
-                    if (srcFormat.isNull())
+                    ComObjPtr<MediumFormat> srcFormat;
+                    rc = i_findMediumFormatFromDiskImage(di, srcFormat);
+                    if (FAILED(rc))
                         throw setError(VBOX_E_NOT_SUPPORTED,
                                        tr("Could not find a valid medium format for the source disk '%s' "
-                                          "Check correctness of the image format URL in the OVF description file."),
+                                          "Check correctness of the image format URL in the OVF description file "
+                                          "or extension of the image"),
                                        RTPathFilename(strSourceOVF.c_str()));
 
                     /* Clone the source disk image */
                     ComObjPtr<Medium> nullParent;
-                    rc = pTargetHD->importFile(strSrcFilePath.c_str(),
-                                               srcFormat,
-                                               MediumVariant_Standard,
-                                               pCallbacks, pRealUsedStorage,
-                                               nullParent,
-                                               pProgress);
+                    rc = pTargetHD->i_importFile(strSrcFilePath.c_str(),
+                                                 srcFormat,
+                                                 MediumVariant_Standard,
+                                                 pCallbacks, pRealUsedStorage,
+                                                 nullParent,
+                                                 pProgress);
                     if (FAILED(rc)) throw rc;
 
+
+
                     /* Advance to the next operation. */
                     /* operation's weight, as set up with the IProgress originally */
                     stack.pProgress->SetNextOperation(BstrFmt(tr("Importing virtual disk image '%s'"),
@@ -2493,7 +2623,7 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
                 /* Now wait for the background disk operation to complete; this throws
                  * HRESULTs on error. */
                 ComPtr<IProgress> pp(pProgress);
-                waitForAsyncProgress(stack.pProgress, pp);
+                i_waitForAsyncProgress(stack.pProgress, pp);
 
                 if (fGzipUsed == true)
                 {
@@ -2538,12 +2668,12 @@ void Appliance::importOneDiskImage(const ovf::DiskImage &di,
  * @param pNewMachine out: Newly created machine.
  * @param stack Cleanup stack for when this throws.
  */
-void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
-                                     ComObjPtr<VirtualSystemDescription> &vsdescThis,
-                                     ComPtr<IMachine> &pNewMachine,
-                                     ImportStack &stack,
-                                     PVDINTERFACEIO pCallbacks,
-                                     PSHASTORAGE pStorage)
+void Appliance::i_importMachineGeneric(const ovf::VirtualSystem &vsysThis,
+                                       ComObjPtr<VirtualSystemDescription> &vsdescThis,
+                                       ComPtr<IMachine> &pNewMachine,
+                                       ImportStack &stack,
+                                       PVDINTERFACEIO pCallbacks,
+                                       PSHASTORAGE pStorage)
 {
     LogFlowFuncEnter();
     HRESULT rc;
@@ -2644,7 +2774,7 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     /* Change the network adapters */
     uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(ChipsetType_PIIX3);
 
-    std::list<VirtualSystemDescriptionEntry*> vsdeNW = vsdescThis->findByType(VirtualSystemDescriptionType_NetworkAdapter);
+    std::list<VirtualSystemDescriptionEntry*> vsdeNW = vsdescThis->i_findByType(VirtualSystemDescriptionType_NetworkAdapter);
     if (vsdeNW.size() == 0)
     {
         /* No network adapters, so we have to disable our default one */
@@ -2760,6 +2890,7 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
                 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Generic);
                 if (FAILED(rc)) throw rc;
             }
+
             /* Next test for NAT network interfaces */
             else if (pvsys->strExtraConfigCurrent.endsWith("type=NATNetwork", Utf8Str::CaseInsensitive))
             {
@@ -2785,7 +2916,8 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     }
 
     // IDE Hard disk controller
-    std::list<VirtualSystemDescriptionEntry*> vsdeHDCIDE = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerIDE);
+    std::list<VirtualSystemDescriptionEntry*> vsdeHDCIDE =
+        vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerIDE);
     /*
      * In OVF (at least VMware's version of it), an IDE controller has two ports,
      * so VirtualBox's single IDE controller with two channels and two ports each counts as
@@ -2817,7 +2949,8 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     }
 
     /* Hard disk controller SATA */
-    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSATA = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSATA);
+    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSATA =
+        vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerSATA);
     if (vsdeHDCSATA.size() > 1)
         throw setError(VBOX_E_FILE_ERROR,
                        tr("Too many SATA controllers in OVF; import facility only supports one"));
@@ -2839,7 +2972,8 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     }
 
     /* Hard disk controller SCSI */
-    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSCSI = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSCSI);
+    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSCSI =
+        vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerSCSI);
     if (vsdeHDCSCSI.size() > 1)
         throw setError(VBOX_E_FILE_ERROR,
                        tr("Too many SCSI controllers in OVF; import facility only supports one"));
@@ -2873,7 +3007,8 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     }
 
     /* Hard disk controller SAS */
-    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSAS = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskControllerSAS);
+    std::list<VirtualSystemDescriptionEntry*> vsdeHDCSAS =
+        vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerSAS);
     if (vsdeHDCSAS.size() > 1)
         throw setError(VBOX_E_FILE_ERROR,
                        tr("Too many SAS controllers in OVF; import facility only supports one"));
@@ -2900,11 +3035,11 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     m->llGuidsMachinesCreated.push_back(uuidNewMachine);
 
     // Add floppies and CD-ROMs to the appropriate controllers.
-    std::list<VirtualSystemDescriptionEntry*> vsdeFloppy = vsdescThis->findByType(VirtualSystemDescriptionType_Floppy);
+    std::list<VirtualSystemDescriptionEntry*> vsdeFloppy = vsdescThis->i_findByType(VirtualSystemDescriptionType_Floppy);
     if (vsdeFloppy.size() > 1)
         throw setError(VBOX_E_FILE_ERROR,
                        tr("Too many floppy controllers in OVF; import facility only supports one"));
-    std::list<VirtualSystemDescriptionEntry*> vsdeCDROM = vsdescThis->findByType(VirtualSystemDescriptionType_CDROM);
+    std::list<VirtualSystemDescriptionEntry*> vsdeCDROM = vsdescThis->i_findByType(VirtualSystemDescriptionType_CDROM);
     if (    (vsdeFloppy.size() > 0)
          || (vsdeCDROM.size() > 0)
        )
@@ -2978,7 +3113,7 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
     }
 
     // create the hard disks & connect them to the appropriate controllers
-    std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
+    std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
     if (avsdeHDs.size() > 0)
     {
         // If there's an error here we need to close the session, so
@@ -2989,8 +3124,14 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
             if (LogIsEnabled())
             {
                 size_t i = 0;
-                for (list<VirtualSystemDescriptionEntry*>::const_iterator itHD = avsdeHDs.begin(); itHD != avsdeHDs.end(); ++itHD, i++)
-                    Log(("avsdeHDs[%zu]: strRef=%s\n", i, (*itHD)->strRef.c_str()));
+                for (list<VirtualSystemDescriptionEntry*>::const_iterator itHD = avsdeHDs.begin();
+                     itHD != avsdeHDs.end(); ++itHD, i++)
+                     Log(("avsdeHDs[%zu]: strRef=%s strOvf=%s\n", i, (*itHD)->strRef.c_str(), (*itHD)->strOvf.c_str()));
+                i = 0;
+                for (ovf::DiskImagesMap::const_iterator itDisk = stack.mapDisks.begin(); itDisk != stack.mapDisks.end(); ++itDisk)
+                    Log(("mapDisks[%zu]: strDiskId=%s strHref=%s\n",
+                         i, itDisk->second.strDiskId.c_str(), itDisk->second.strHref.c_str()));
+
             }
 #endif
 
@@ -3000,22 +3141,23 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
             stack.fSessionOpen = true;
 
             /* get VM name from virtual system description. Only one record is possible (size of list is equal 1). */
-            std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
+            std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->i_findByType(VirtualSystemDescriptionType_Name);
             std::list<VirtualSystemDescriptionEntry*>::iterator vmNameIt = vmName.begin();
             VirtualSystemDescriptionEntry* vmNameEntry = *vmNameIt;
 
+
             ovf::DiskImagesMap::const_iterator oit = stack.mapDisks.begin();
             std::set<RTCString>  disksResolvedNames;
 
             uint32_t cImportedDisks = 0;
 
-            while(oit != stack.mapDisks.end() && cImportedDisks != avsdeHDs.size())
+            while (oit != stack.mapDisks.end() && cImportedDisks != avsdeHDs.size())
             {
                 ovf::DiskImage diCurrent = oit->second;
                 ovf::VirtualDisksMap::const_iterator itVDisk = vsysThis.mapVirtualDisks.begin();
 
                 VirtualSystemDescriptionEntry *vsdeTargetHD = 0;
-                Log(("diCurrent.strDiskId=%s\n", diCurrent.strDiskId.c_str()));
+                Log(("diCurrent.strDiskId=%s diCurrent.strHref=%s\n", diCurrent.strDiskId.c_str(), diCurrent.strHref.c_str()));
 
                 /*
                  *
@@ -3042,6 +3184,7 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
                         /* possible case if a disk image belongs to other virtual system (OVF package with multiple VMs inside) */
                         LogWarning(("OVA/OVF import: Disk image %s was missed during import of VM %s\n",
                                     oit->first.c_str(), vmNameEntry->strOvf.c_str()));
+                        NOREF(vmNameEntry);
                         ++oit;
                         continue;
                     }
@@ -3060,7 +3203,7 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
                  * This step is useful if image is placed in the OVA (TAR) package
                  */
 
-                Utf8Str name = applianceIOName(applianceIOTar);
+                Utf8Str name = i_applianceIOName(applianceIOTar);
 
                 if (strncmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
                 {
@@ -3075,14 +3218,12 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
 
                     RTCString availableImage(diCurrent.strHref);
 
-                    rc = preCheckImageAvailability(pStorage,
-                                                   availableImage
-                                                  );
+                    rc = i_preCheckImageAvailability(pStorage, availableImage);
 
                     if (SUCCEEDED(rc))
                     {
                         /* current opened file isn't the same as passed one */
-                        if(availableImage.compare(diCurrent.strHref, Utf8Str::CaseInsensitive) != 0)
+                        if (availableImage.compare(diCurrent.strHref, Utf8Str::CaseInsensitive) != 0)
                         {
                             /*
                              * availableImage contains the disk file reference (e.g. "disk1.vmdk"), which should exist
@@ -3098,11 +3239,13 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
                                         break;
                                 }
                                 if (itDiskImage == stack.mapDisks.end())
+                                {
                                     throw setError(E_FAIL,
                                                    tr("Internal inconsistency looking up disk image '%s'. "
                                                       "Check compliance OVA package structure and file names "
-                                                      "references in the section <References> in the OVF file"),
+                                                      "references in the section <References> in the OVF file."),
                                                    availableImage.c_str());
+                                }
 
                                 /* replace with a new found disk image */
                                 diCurrent = *(&itDiskImage->second);
@@ -3126,6 +3269,7 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
                                     }
                                 }
                                 if (!vsdeTargetHD)
+                                {
                                     /*
                                      * in this case it's an error because something wrong with OVF description file.
                                      * May be VBox imports OVA package with wrong file sequence inside the archive.
@@ -3133,6 +3277,7 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
                                     throw setError(E_FAIL,
                                                    tr("Internal inconsistency looking up disk image '%s'"),
                                                    diCurrent.strHref.c_str());
+                                }
 
                                 itVDisk = vsysThis.mapVirtualDisks.find(diCurrent.strDiskId);
                                 if (itVDisk == vsysThis.mapVirtualDisks.end())
@@ -3167,12 +3312,12 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
 
                 Utf8Str savedVBoxCurrent = vsdeTargetHD->strVBoxCurrent;
 
-                importOneDiskImage(diCurrent,
-                                   &vsdeTargetHD->strVBoxCurrent,
-                                   pTargetHD,
-                                   stack,
-                                   pCallbacks,
-                                   pStorage);
+                i_importOneDiskImage(diCurrent,
+                                     &vsdeTargetHD->strVBoxCurrent,
+                                     pTargetHD,
+                                     stack,
+                                     pCallbacks,
+                                     pStorage);
 
                 // now use the new uuid to attach the disk image to our new machine
                 ComPtr<IMachine> sMachine;
@@ -3187,16 +3332,26 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
                 MyHardDiskAttachment mhda;
                 mhda.pMachine = pNewMachine;
 
-                convertDiskAttachmentValues(hdc,
-                                            ovfVdisk.ulAddressOnParent,
-                                            mhda.controllerType,        // Bstr
-                                            mhda.lControllerPort,
-                                            mhda.lDevice);
+                i_convertDiskAttachmentValues(hdc,
+                                              ovfVdisk.ulAddressOnParent,
+                                              mhda.controllerType,        // Bstr
+                                              mhda.lControllerPort,
+                                              mhda.lDevice);
 
                 Log(("Attaching disk %s to port %d on device %d\n",
                 vsdeTargetHD->strVBoxCurrent.c_str(), mhda.lControllerPort, mhda.lDevice));
 
-                Utf8Str vdf = typeOfVirtualDiskFormatFromURI(diCurrent.strFormat);
+                ComObjPtr<MediumFormat> mediumFormat;
+                rc = i_findMediumFormatFromDiskImage(diCurrent, mediumFormat);
+                if (FAILED(rc))
+                    throw rc;
+
+                Bstr bstrFormatName;
+                rc = mediumFormat->COMGETTER(Name)(bstrFormatName.asOutParam());
+                if (FAILED(rc))
+                    throw rc;
+
+                Utf8Str vdf = Utf8Str(bstrFormatName);
 
                 if (vdf.compare("RAW", Utf8Str::CaseInsensitive) == 0)
                 {
@@ -3255,16 +3410,13 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
 
             // only now that we're done with all disks, close the session
             rc = stack.pSession->UnlockMachine();
-
             if (FAILED(rc))
                 throw rc;
-
             stack.fSessionOpen = false;
         }
-        catch(HRESULT  aRC)
+        catch(HRESULT aRC)
         {
             com::ErrorInfo info;
-
             if (stack.fSessionOpen)
                 stack.pSession->UnlockMachine();
 
@@ -3306,11 +3458,11 @@ void Appliance::importMachineGeneric(const ovf::VirtualSystem &vsysThis,
  * @param pNewMachine
  * @param stack
  */
-void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
-                                  ComPtr<IMachine> &pReturnNewMachine,
-                                  ImportStack &stack,
-                                  PVDINTERFACEIO pCallbacks,
-                                  PSHASTORAGE pStorage)
+void Appliance::i_importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
+                                    ComPtr<IMachine> &pReturnNewMachine,
+                                    ImportStack &stack,
+                                    PVDINTERFACEIO pCallbacks,
+                                    PSHASTORAGE pStorage)
 {
     LogFlowFuncEnter();
     Assert(vsdescThis->m->pConfig);
@@ -3348,8 +3500,8 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
     /* USB controller */
     if (stack.fUSBEnabled)
     {
-        /** @todo r=klaus add support for arbitrary USB controller types, this can't handle multiple controllers due to its design anyway */
-
+        /** @todo r=klaus add support for arbitrary USB controller types, this can't handle
+         *  multiple controllers due to its design anyway */
         /* usually the OHCI controller is enabled already, need to check */
         bool fOHCIEnabled = false;
         settings::USBControllerList &llUSBControllers = config.hardwareMachine.usbSettings.llUSBControllers;
@@ -3395,10 +3547,10 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
         if (!(   fKeepAllMACs
               || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NAT)
               || (fKeepNATMACs && it1->mode == NetworkAttachmentType_NATNetwork)))
-            Host::generateMACAddress(it1->strMACAddress);
+            Host::i_generateMACAddress(it1->strMACAddress);
     }
     /* Now iterate over all network entries. */
-    std::list<VirtualSystemDescriptionEntry*> avsdeNWs = vsdescThis->findByType(VirtualSystemDescriptionType_NetworkAdapter);
+    std::list<VirtualSystemDescriptionEntry*> avsdeNWs = vsdescThis->i_findByType(VirtualSystemDescriptionType_NetworkAdapter);
     if (avsdeNWs.size() > 0)
     {
         /* Iterate through all network adapter entries and search for the
@@ -3432,9 +3584,9 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
     }
 
     /* Floppy controller */
-    bool fFloppy = vsdescThis->findByType(VirtualSystemDescriptionType_Floppy).size() > 0;
+    bool fFloppy = vsdescThis->i_findByType(VirtualSystemDescriptionType_Floppy).size() > 0;
     /* DVD controller */
-    bool fDVD = vsdescThis->findByType(VirtualSystemDescriptionType_CDROM).size() > 0;
+    bool fDVD = vsdescThis->i_findByType(VirtualSystemDescriptionType_CDROM).size() > 0;
     /* Iterate over all storage controller check the attachments and remove
      * them when necessary. Also detect broken configs with more than one
      * attachment. Old VirtualBox versions (prior to 3.2.10) had all disk
@@ -3492,14 +3644,13 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
     /*
      * step 2: scan the machine config for media attachments
      */
-
     /* get VM name from virtual system description. Only one record is possible (size of list is equal 1). */
-    std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
+    std::list<VirtualSystemDescriptionEntry*> vmName = vsdescThis->i_findByType(VirtualSystemDescriptionType_Name);
     std::list<VirtualSystemDescriptionEntry*>::iterator vmNameIt = vmName.begin();
     VirtualSystemDescriptionEntry* vmNameEntry = *vmNameIt;
 
     /* Get all hard disk descriptions. */
-    std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->findByType(VirtualSystemDescriptionType_HardDiskImage);
+    std::list<VirtualSystemDescriptionEntry*> avsdeHDs = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage);
     std::list<VirtualSystemDescriptionEntry*>::iterator avsdeHDsIt = avsdeHDs.begin();
     /* paranoia - if there is no 1:1 match do not try to repair. */
     if (cDisks != avsdeHDs.size())
@@ -3534,12 +3685,12 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
                     break;
                 }
             }
-
             if (!vsdeTargetHD)
             {
                 /* possible case if a disk image belongs to other virtual system (OVF package with multiple VMs inside) */
                 LogWarning(("OVA/OVF import: Disk image %s was missed during import of VM %s\n",
                             oit->first.c_str(), vmNameEntry->strOvf.c_str()));
+                NOREF(vmNameEntry);
                 ++oit;
                 continue;
             }
@@ -3550,7 +3701,7 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
          * This step is useful if image is placed in the OVA (TAR) package
          */
 
-        Utf8Str name = applianceIOName(applianceIOTar);
+        Utf8Str name = i_applianceIOName(applianceIOTar);
 
         if (strncmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
         {
@@ -3565,9 +3716,7 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
 
             RTCString availableImage(diCurrent.strHref);
 
-            rc = preCheckImageAvailability(pStorage,
-                                           availableImage
-                                          );
+            rc = i_preCheckImageAvailability(pStorage, availableImage);
 
             if (SUCCEEDED(rc))
             {
@@ -3703,16 +3852,27 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
                  */
                 Utf8Str savedVBoxCurrent = vsdeTargetHD->strVBoxCurrent;
                 ComObjPtr<Medium> pTargetHD;
-                importOneDiskImage(diCurrent,
-                                   &vsdeTargetHD->strVBoxCurrent,
-                                   pTargetHD,
-                                   stack,
-                                   pCallbacks,
-                                   pStorage);
+
+                i_importOneDiskImage(diCurrent,
+                                     &vsdeTargetHD->strVBoxCurrent,
+                                     pTargetHD,
+                                     stack,
+                                     pCallbacks,
+                                     pStorage);
 
                 Bstr hdId;
 
-                Utf8Str vdf = typeOfVirtualDiskFormatFromURI(diCurrent.strFormat);
+                ComObjPtr<MediumFormat> mediumFormat;
+                rc = i_findMediumFormatFromDiskImage(diCurrent, mediumFormat);
+                if (FAILED(rc))
+                    throw rc;
+
+                Bstr bstrFormatName;
+                rc = mediumFormat->COMGETTER(Name)(bstrFormatName.asOutParam());
+                if (FAILED(rc))
+                    throw rc;
+
+                Utf8Str vdf = Utf8Str(bstrFormatName);
 
                 if (vdf.compare("RAW", Utf8Str::CaseInsensitive) == 0)
                 {
@@ -3742,7 +3902,15 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
                 /* restore */
                 vsdeTargetHD->strVBoxCurrent = savedVBoxCurrent;
 
-                d.uuid = hdId;
+                /*
+                 * 1. saving original UUID for restoring in case of failure.
+                 * 2. replacement of original UUID by new UUID in the current VM config (settings::MachineConfigFile).
+                 */
+                {
+                    rc = stack.saveOriginalUUIDOfAttachedDevice(d, Utf8Str(hdId));
+                    d.uuid = hdId;
+                }
+
                 fFound = true;
                 break;
             } // for (settings::AttachedDevicesList::const_iterator dit = sc.llAttachedDevices.begin();
@@ -3759,6 +3927,7 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
 
     }// while(oit != stack.mapDisks.end())
 
+
     /*
      * quantity of the imported disks isn't equal to the size of the avsdeHDs list.
      */
@@ -3798,9 +3967,9 @@ void Appliance::importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThi
     LogFlowFuncLeave();
 }
 
-void Appliance::importMachines(ImportStack &stack,
-                               PVDINTERFACEIO pCallbacks,
-                               PSHASTORAGE pStorage)
+void Appliance::i_importMachines(ImportStack &stack,
+                                 PVDINTERFACEIO pCallbacks,
+                                 PSHASTORAGE pStorage)
 {
     HRESULT rc = S_OK;
 
@@ -3841,7 +4010,7 @@ void Appliance::importMachines(ImportStack &stack,
         // the OVF because otherwise the "override import parameters" mechanism in the GUI won't work.
 
         // VM name
-        std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
+        std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->i_findByType(VirtualSystemDescriptionType_Name);
         if (vsdeName.size() < 1)
             throw setError(VBOX_E_FILE_ERROR,
                            tr("Missing VM name"));
@@ -3863,14 +4032,14 @@ void Appliance::importMachines(ImportStack &stack,
 
         // guest OS type
         std::list<VirtualSystemDescriptionEntry*> vsdeOS;
-        vsdeOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS);
+        vsdeOS = vsdescThis->i_findByType(VirtualSystemDescriptionType_OS);
         if (vsdeOS.size() < 1)
             throw setError(VBOX_E_FILE_ERROR,
                            tr("Missing guest OS type"));
         stack.strOsTypeVBox = vsdeOS.front()->strVBoxCurrent;
 
         // CPU count
-        std::list<VirtualSystemDescriptionEntry*> vsdeCPU = vsdescThis->findByType(VirtualSystemDescriptionType_CPU);
+        std::list<VirtualSystemDescriptionEntry*> vsdeCPU = vsdescThis->i_findByType(VirtualSystemDescriptionType_CPU);
         if (vsdeCPU.size() != 1)
             throw setError(VBOX_E_FILE_ERROR, tr("CPU count missing"));
 
@@ -3883,37 +4052,80 @@ void Appliance::importMachines(ImportStack &stack,
         }
 
         // RAM
-        std::list<VirtualSystemDescriptionEntry*> vsdeRAM = vsdescThis->findByType(VirtualSystemDescriptionType_Memory);
+        std::list<VirtualSystemDescriptionEntry*> vsdeRAM = vsdescThis->i_findByType(VirtualSystemDescriptionType_Memory);
         if (vsdeRAM.size() != 1)
             throw setError(VBOX_E_FILE_ERROR, tr("RAM size missing"));
         stack.ulMemorySizeMB = (ULONG)vsdeRAM.front()->strVBoxCurrent.toUInt64();
 
 #ifdef VBOX_WITH_USB
         // USB controller
-        std::list<VirtualSystemDescriptionEntry*> vsdeUSBController = vsdescThis->findByType(VirtualSystemDescriptionType_USBController);
+        std::list<VirtualSystemDescriptionEntry*> vsdeUSBController =
+            vsdescThis->i_findByType(VirtualSystemDescriptionType_USBController);
         // USB support is enabled if there's at least one such entry; to disable USB support,
         // the type of the USB item would have been changed to "ignore"
         stack.fUSBEnabled = vsdeUSBController.size() > 0;
 #endif
         // audio adapter
-        std::list<VirtualSystemDescriptionEntry*> vsdeAudioAdapter = vsdescThis->findByType(VirtualSystemDescriptionType_SoundCard);
+        std::list<VirtualSystemDescriptionEntry*> vsdeAudioAdapter =
+            vsdescThis->i_findByType(VirtualSystemDescriptionType_SoundCard);
         /* @todo: we support one audio adapter only */
         if (vsdeAudioAdapter.size() > 0)
             stack.strAudioAdapter = vsdeAudioAdapter.front()->strVBoxCurrent;
 
         // for the description of the new machine, always use the OVF entry, the user may have changed it in the import config
-        std::list<VirtualSystemDescriptionEntry*> vsdeDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description);
+        std::list<VirtualSystemDescriptionEntry*> vsdeDescription =
+            vsdescThis->i_findByType(VirtualSystemDescriptionType_Description);
         if (vsdeDescription.size())
             stack.strDescription = vsdeDescription.front()->strVBoxCurrent;
 
         // import vbox:machine or OVF now
         if (vsdescThis->m->pConfig)
             // vbox:Machine config
-            importVBoxMachine(vsdescThis, pNewMachine, stack, pCallbacks, pStorage);
+            i_importVBoxMachine(vsdescThis, pNewMachine, stack, pCallbacks, pStorage);
         else
             // generic OVF config
-            importMachineGeneric(vsysThis, vsdescThis, pNewMachine, stack, pCallbacks, pStorage);
+            i_importMachineGeneric(vsysThis, vsdescThis, pNewMachine, stack, pCallbacks, pStorage);
 
     } // for (it = pAppliance->m->llVirtualSystems.begin() ...
 }
 
+HRESULT Appliance::ImportStack::saveOriginalUUIDOfAttachedDevice(settings::AttachedDevice &device,
+                                                     const Utf8Str &newlyUuid)
+{
+    HRESULT rc = S_OK;
+
+    /* save for restoring */
+    mapNewUUIDsToOriginalUUIDs.insert(std::make_pair(newlyUuid, device.uuid.toString()));
+
+    return rc;
+}
+
+HRESULT Appliance::ImportStack::restoreOriginalUUIDOfAttachedDevice(settings::MachineConfigFile *config)
+{
+    HRESULT rc = S_OK;
+
+    settings::StorageControllersList &llControllers = config->storageMachine.llStorageControllers;
+    settings::StorageControllersList::iterator itscl;
+    for (itscl = llControllers.begin();
+         itscl != llControllers.end();
+         ++itscl)
+    {
+        settings::AttachedDevicesList &llAttachments = itscl->llAttachedDevices;
+        settings::AttachedDevicesList::iterator itadl = llAttachments.begin();
+        while (itadl != llAttachments.end())
+        {
+            std::map<Utf8Str , Utf8Str>::iterator it =
+                mapNewUUIDsToOriginalUUIDs.find(itadl->uuid.toString());
+            if(it!=mapNewUUIDsToOriginalUUIDs.end())
+            {
+                Utf8Str uuidOriginal = it->second;
+                itadl->uuid = Guid(uuidOriginal);
+                mapNewUUIDsToOriginalUUIDs.erase(it->first);
+            }
+            ++itadl;
+        }
+    }
+
+    return rc;
+}
+
diff --git a/src/VBox/Main/src-server/AudioAdapterImpl.cpp b/src/VBox/Main/src-server/AudioAdapterImpl.cpp
index 089359b..28e9cee 100644
--- a/src/VBox/Main/src-server/AudioAdapterImpl.cpp
+++ b/src/VBox/Main/src-server/AudioAdapterImpl.cpp
@@ -1,10 +1,11 @@
+/* $Id: AudioAdapterImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -26,11 +27,30 @@
 #include "AutoCaller.h"
 #include "Logging.h"
 
+struct AudioAdapterData
+{
+    AudioAdapterData() :
+        mEnabled(false),
+        mAudioDriver(AudioDriverType_Null),
+        mAudioController(AudioControllerType_AC97)
+    {}
+
+    BOOL mEnabled;
+    AudioDriverType_T mAudioDriver;
+    AudioControllerType_T mAudioController;
+};
+
+struct AudioAdapter::Data
+{
+    Backupable<AudioAdapterData> m;
+};
+
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
 AudioAdapter::AudioAdapter()
-    : mParent(NULL)
+    : mParent(NULL),
+      mData(NULL)
 {
 }
 
@@ -81,8 +101,9 @@ HRESULT AudioAdapter::init (Machine *aParent)
     unconst(mParent) = aParent;
     /* mPeer is left null */
 
-    mData.allocate();
-    mData->mAudioDriver = defaultAudioDriver;
+    mData = new Data();
+    mData->m.allocate();
+    mData->m->mAudioDriver = defaultAudioDriver;
 
     /* Confirm a successful initialization */
     autoInitSpan.setSucceeded();
@@ -117,7 +138,8 @@ HRESULT AudioAdapter::init (Machine *aParent, AudioAdapter *aThat)
     AssertComRCReturnRC(thatCaller.rc());
 
     AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
-    mData.share (aThat->mData);
+    mData = new Data();
+    mData->m.share (aThat->mData->m);
 
     /* Confirm a successful initialization */
     autoInitSpan.setSucceeded();
@@ -149,7 +171,8 @@ HRESULT AudioAdapter::initCopy (Machine *aParent, AudioAdapter *aThat)
     AssertComRCReturnRC(thatCaller.rc());
 
     AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
-    mData.attachCopy (aThat->mData);
+    mData = new Data();
+    mData->m.attachCopy (aThat->mData->m);
 
     /* Confirm a successful initialization */
     autoInitSpan.setSucceeded();
@@ -170,7 +193,9 @@ void AudioAdapter::uninit()
     if (autoUninitSpan.uninitDone())
         return;
 
-    mData.free();
+    mData->m.free();
+    delete mData;
+    mData = NULL;
 
     unconst(mPeer) = NULL;
     unconst(mParent) = NULL;
@@ -179,81 +204,89 @@ void AudioAdapter::uninit()
 // IAudioAdapter properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP AudioAdapter::COMGETTER(Enabled)(BOOL *aEnabled)
+HRESULT AudioAdapter::getEnabled(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mData->mEnabled;
+    *aEnabled = mData->m->mEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP AudioAdapter::COMSETTER(Enabled)(BOOL aEnabled)
+HRESULT AudioAdapter::setEnabled(BOOL aEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (mData->mEnabled != aEnabled)
+    if (mData->m->mEnabled != aEnabled)
     {
-        mData.backup();
-        mData->mEnabled = aEnabled;
+        mData->m.backup();
+        mData->m->mEnabled = aEnabled;
 
         alock.release();
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-        mParent->setModified(Machine::IsModified_AudioAdapter);
+        mParent->i_setModified(Machine::IsModified_AudioAdapter);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP AudioAdapter::COMGETTER(AudioDriver)(AudioDriverType_T *aAudioDriver)
+HRESULT AudioAdapter::getEnabledIn(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aAudioDriver);
+    NOREF(aEnabled);
+    return E_NOTIMPL;
+}
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT AudioAdapter::setEnabledIn(BOOL aEnabled)
+{
+    NOREF(aEnabled);
+    return E_NOTIMPL;
+}
 
+HRESULT AudioAdapter::getEnabledOut(BOOL *aEnabled)
+{
+    NOREF(aEnabled);
+    return E_NOTIMPL;
+}
+
+HRESULT AudioAdapter::setEnabledOut(BOOL aEnabled)
+{
+    NOREF(aEnabled);
+    return E_NOTIMPL;
+}
+
+HRESULT AudioAdapter::getAudioDriver(AudioDriverType_T *aAudioDriver)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aAudioDriver = mData->mAudioDriver;
+    *aAudioDriver = mData->m->mAudioDriver;
 
     return S_OK;
 }
 
-STDMETHODIMP AudioAdapter::COMSETTER(AudioDriver)(AudioDriverType_T aAudioDriver)
+HRESULT AudioAdapter::setAudioDriver(AudioDriverType_T aAudioDriver)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
 
-    if (mData->mAudioDriver != aAudioDriver)
+    if (mData->m->mAudioDriver != aAudioDriver)
     {
         if (settings::MachineConfigFile::isAudioDriverAllowedOnThisHost(aAudioDriver))
         {
-            mData.backup();
-            mData->mAudioDriver = aAudioDriver;
-
+            mData->m.backup();
+            mData->m->mAudioDriver = aAudioDriver;
             alock.release();
             AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-            mParent->setModified(Machine::IsModified_AudioAdapter);
+            mParent->i_setModified(Machine::IsModified_AudioAdapter);
         }
         else
         {
@@ -265,25 +298,17 @@ STDMETHODIMP AudioAdapter::COMSETTER(AudioDriver)(AudioDriverType_T aAudioDriver
     return rc;
 }
 
-STDMETHODIMP AudioAdapter::COMGETTER(AudioController)(AudioControllerType_T *aAudioController)
+HRESULT AudioAdapter::getAudioController(AudioControllerType_T *aAudioController)
 {
-    CheckComArgOutPointerValid(aAudioController);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aAudioController = mData->mAudioController;
+    *aAudioController = mData->m->mAudioController;
 
     return S_OK;
 }
 
-STDMETHODIMP AudioAdapter::COMSETTER(AudioController)(AudioControllerType_T aAudioController)
+HRESULT AudioAdapter::setAudioController(AudioControllerType_T aAudioController)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
@@ -292,7 +317,7 @@ STDMETHODIMP AudioAdapter::COMSETTER(AudioController)(AudioControllerType_T aAud
 
     HRESULT rc = S_OK;
 
-    if (mData->mAudioController != aAudioController)
+    if (mData->m->mAudioController != aAudioController)
     {
         /*
          * which audio hardware type are we supposed to use?
@@ -303,12 +328,11 @@ STDMETHODIMP AudioAdapter::COMSETTER(AudioController)(AudioControllerType_T aAud
             case AudioControllerType_SB16:
             case AudioControllerType_HDA:
             {
-                mData.backup();
-                mData->mAudioController = aAudioController;
-
+                mData->m.backup();
+                mData->m->mAudioController = aAudioController;
                 alock.release();
                 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-                mParent->setModified(Machine::IsModified_AudioAdapter);
+                mParent->i_setModified(Machine::IsModified_AudioAdapter);
                 break;
             }
 
@@ -328,15 +352,6 @@ STDMETHODIMP AudioAdapter::COMSETTER(AudioController)(AudioControllerType_T aAud
 // public methods only for internal purposes
 /////////////////////////////////////////////////////////////////////////////
 
-AudioAdapter::Data::Data()
-{
-    /* Generic defaults */
-    mEnabled = false;
-    mAudioController = AudioControllerType_AC97;
-    /* Driver defaults to the null audio driver */
-    mAudioDriver = AudioDriverType_Null;
-}
-
 /**
  *  Loads settings from the given machine node.
  *  May be called once right after this object creation.
@@ -345,7 +360,7 @@ AudioAdapter::Data::Data()
  *
  *  @note Locks this object for writing.
  */
-HRESULT AudioAdapter::loadSettings(const settings::AudioAdapter &data)
+HRESULT AudioAdapter::i_loadSettings(const settings::AudioAdapter &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -363,9 +378,9 @@ HRESULT AudioAdapter::loadSettings(const settings::AudioAdapter &data)
      * the same setting of an object loaded from the old settings file must
      * default to B. */
 
-    mData->mEnabled = data.fEnabled;
-    mData->mAudioController = data.controllerType;
-    mData->mAudioDriver = data.driverType;
+    mData->m->mEnabled = data.fEnabled;
+    mData->m->mAudioController = data.controllerType;
+    mData->m->mAudioDriver = data.driverType;
 
     return S_OK;
 }
@@ -377,23 +392,23 @@ HRESULT AudioAdapter::loadSettings(const settings::AudioAdapter &data)
  *
  *  @note Locks this object for reading.
  */
-HRESULT AudioAdapter::saveSettings(settings::AudioAdapter &data)
+HRESULT AudioAdapter::i_saveSettings(settings::AudioAdapter &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    data.fEnabled = !!mData->mEnabled;
-    data.controllerType = mData->mAudioController;
-    data.driverType = mData->mAudioDriver;
+    data.fEnabled = !!mData->m->mEnabled;
+    data.controllerType = mData->m->mAudioController;
+    data.driverType = mData->m->mAudioDriver;
     return S_OK;
 }
 
 /**
  *  @note Locks this object for writing.
  */
-void AudioAdapter::rollback()
+void AudioAdapter::i_rollback()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -401,14 +416,14 @@ void AudioAdapter::rollback()
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData.rollback();
+    mData->m.rollback();
 }
 
 /**
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void AudioAdapter::commit()
+void AudioAdapter::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -422,13 +437,13 @@ void AudioAdapter::commit()
      * first) */
     AutoMultiWriteLock2 alock(mPeer, this COMMA_LOCKVAL_SRC_POS);
 
-    if (mData.isBackedUp())
+    if (mData->m.isBackedUp())
     {
-        mData.commit();
+        mData->m.commit();
         if (mPeer)
         {
             /* attach new data to the peer and reshare it */
-            mPeer->mData.attach (mData);
+            mPeer->mData->m.attach (mData->m);
         }
     }
 }
@@ -437,7 +452,7 @@ void AudioAdapter::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void AudioAdapter::copyFrom(AudioAdapter *aThat)
+void AudioAdapter::i_copyFrom(AudioAdapter *aThat)
 {
     AssertReturnVoid (aThat != NULL);
 
@@ -455,6 +470,6 @@ void AudioAdapter::copyFrom(AudioAdapter *aThat)
     AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS);
 
     /* this will back up current data */
-    mData.assignCopy(aThat->mData);
+    mData->m.assignCopy(aThat->mData->m);
 }
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-server/BIOSSettingsImpl.cpp b/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
index 1cc0a5e..dc3236c 100644
--- a/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
+++ b/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
@@ -1,10 +1,11 @@
+/* $Id: BIOSSettingsImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -48,6 +49,8 @@ struct BIOSSettings::Data
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
+DEFINE_EMPTY_CTOR_DTOR(BIOSSettings)
+
 HRESULT BIOSSettings::FinalConstruct()
 {
     return BaseFinalConstruct();
@@ -181,14 +184,9 @@ void BIOSSettings::uninit()
 // IBIOSSettings properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP BIOSSettings::COMGETTER(LogoFadeIn)(BOOL *enabled)
-{
-    if (!enabled)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::getLogoFadeIn(BOOL *enabled)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *enabled = m->bd->fLogoFadeIn;
@@ -196,11 +194,8 @@ STDMETHODIMP BIOSSettings::COMGETTER(LogoFadeIn)(BOOL *enabled)
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(LogoFadeIn)(BOOL enable)
+HRESULT BIOSSettings::setLogoFadeIn(BOOL enable)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -212,19 +207,14 @@ STDMETHODIMP BIOSSettings::COMSETTER(LogoFadeIn)(BOOL enable)
 
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(LogoFadeOut)(BOOL *enabled)
-{
-    if (!enabled)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::getLogoFadeOut(BOOL *enabled)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *enabled = m->bd->fLogoFadeOut;
@@ -232,11 +222,9 @@ STDMETHODIMP BIOSSettings::COMGETTER(LogoFadeOut)(BOOL *enabled)
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(LogoFadeOut)(BOOL enable)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::setLogoFadeOut(BOOL enable)
+{
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -248,19 +236,17 @@ STDMETHODIMP BIOSSettings::COMSETTER(LogoFadeOut)(BOOL enable)
 
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(LogoDisplayTime)(ULONG *displayTime)
+
+HRESULT BIOSSettings::getLogoDisplayTime(ULONG *displayTime)
 {
     if (!displayTime)
         return E_POINTER;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *displayTime = m->bd->ulLogoDisplayTime;
@@ -268,11 +254,9 @@ STDMETHODIMP BIOSSettings::COMGETTER(LogoDisplayTime)(ULONG *displayTime)
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(LogoDisplayTime)(ULONG displayTime)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::setLogoDisplayTime(ULONG displayTime)
+{
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -284,34 +268,23 @@ STDMETHODIMP BIOSSettings::COMSETTER(LogoDisplayTime)(ULONG displayTime)
 
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(LogoImagePath)(BSTR *imagePath)
-{
-    if (!imagePath)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::getLogoImagePath(com::Utf8Str &imagePath)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->bd->strLogoImagePath.cloneTo(imagePath);
+    imagePath = m->bd->strLogoImagePath;
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(LogoImagePath)(IN_BSTR imagePath)
-{
-    /* NULL strings are not allowed */
-    if (!imagePath)
-        return E_INVALIDARG;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::setLogoImagePath(const com::Utf8Str &imagePath)
+{
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -323,30 +296,22 @@ STDMETHODIMP BIOSSettings::COMSETTER(LogoImagePath)(IN_BSTR imagePath)
 
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(BootMenuMode)(BIOSBootMenuMode_T *bootMenuMode)
+HRESULT BIOSSettings::getBootMenuMode(BIOSBootMenuMode_T *bootMenuMode)
 {
-    if (!bootMenuMode)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *bootMenuMode = m->bd->biosBootMenuMode;
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(BootMenuMode)(BIOSBootMenuMode_T bootMenuMode)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::setBootMenuMode(BIOSBootMenuMode_T bootMenuMode)
+{
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -358,19 +323,14 @@ STDMETHODIMP BIOSSettings::COMSETTER(BootMenuMode)(BIOSBootMenuMode_T bootMenuMo
 
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(ACPIEnabled)(BOOL *enabled)
-{
-    if (!enabled)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::getACPIEnabled(BOOL *enabled)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *enabled = m->bd->fACPIEnabled;
@@ -378,11 +338,9 @@ STDMETHODIMP BIOSSettings::COMGETTER(ACPIEnabled)(BOOL *enabled)
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(ACPIEnabled)(BOOL enable)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::setACPIEnabled(BOOL enable)
+{
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -394,31 +352,24 @@ STDMETHODIMP BIOSSettings::COMSETTER(ACPIEnabled)(BOOL enable)
 
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(IOAPICEnabled)(BOOL *enabled)
-{
-    if (!enabled)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::getIOAPICEnabled(BOOL *aIOAPICEnabled)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *enabled = m->bd->fIOAPICEnabled;
+    *aIOAPICEnabled = m->bd->fIOAPICEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(IOAPICEnabled)(BOOL enable)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::setIOAPICEnabled(BOOL aIOAPICEnabled)
+{
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -426,23 +377,18 @@ STDMETHODIMP BIOSSettings::COMSETTER(IOAPICEnabled)(BOOL enable)
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     m->bd.backup();
-    m->bd->fIOAPICEnabled = !!enable;
 
+    m->bd->fIOAPICEnabled = !!aIOAPICEnabled;
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(PXEDebugEnabled)(BOOL *enabled)
-{
-    if (!enabled)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::getPXEDebugEnabled(BOOL *enabled)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *enabled = m->bd->fPXEDebugEnabled;
@@ -450,11 +396,9 @@ STDMETHODIMP BIOSSettings::COMGETTER(PXEDebugEnabled)(BOOL *enabled)
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(PXEDebugEnabled)(BOOL enable)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::setPXEDebugEnabled(BOOL enable)
+{
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -466,19 +410,13 @@ STDMETHODIMP BIOSSettings::COMSETTER(PXEDebugEnabled)(BOOL enable)
 
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(TimeOffset)(LONG64 *offset)
+HRESULT BIOSSettings::getTimeOffset(LONG64 *offset)
 {
-    if (!offset)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *offset = m->bd->llTimeOffset;
@@ -486,11 +424,9 @@ STDMETHODIMP BIOSSettings::COMGETTER(TimeOffset)(LONG64 *offset)
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMSETTER(TimeOffset)(LONG64 offset)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT BIOSSettings::setTimeOffset(LONG64 offset)
+{
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -502,25 +438,18 @@ STDMETHODIMP BIOSSettings::COMSETTER(TimeOffset)(LONG64 offset)
 
     alock.release();
     AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
-    m->pMachine->setModified(Machine::IsModified_BIOS);
+    m->pMachine->i_setModified(Machine::IsModified_BIOS);
 
     return S_OK;
 }
 
-STDMETHODIMP BIOSSettings::COMGETTER(NonVolatileStorageFile)(BSTR *pbstrPath)
+HRESULT BIOSSettings::getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile)
 {
-    CheckComArgOutPointerValid(pbstrPath);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Bstr bstrEmpty("");
-        hrc = bstrEmpty.cloneToEx(pbstrPath);
-    }
+    aNonVolatileStorageFile = "";
 
-    return hrc;
+    return S_OK;
 }
 
 
@@ -539,7 +468,7 @@ STDMETHODIMP BIOSSettings::COMGETTER(NonVolatileStorageFile)(BSTR *pbstrPath)
  *
  *  @note Locks this object for writing.
  */
-HRESULT BIOSSettings::loadSettings(const settings::BIOSSettings &data)
+HRESULT BIOSSettings::i_loadSettings(const settings::BIOSSettings &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -559,7 +488,7 @@ HRESULT BIOSSettings::loadSettings(const settings::BIOSSettings &data)
  *
  *  @note Locks this object for reading.
  */
-HRESULT BIOSSettings::saveSettings(settings::BIOSSettings &data)
+HRESULT BIOSSettings::i_saveSettings(settings::BIOSSettings &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -571,13 +500,13 @@ HRESULT BIOSSettings::saveSettings(settings::BIOSSettings &data)
     return S_OK;
 }
 
-void BIOSSettings::rollback()
+void BIOSSettings::i_rollback()
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     m->bd.rollback();
 }
 
-void BIOSSettings::commit()
+void BIOSSettings::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -603,7 +532,7 @@ void BIOSSettings::commit()
     }
 }
 
-void BIOSSettings::copyFrom (BIOSSettings *aThat)
+void BIOSSettings::i_copyFrom (BIOSSettings *aThat)
 {
     AssertReturnVoid (aThat != NULL);
 
@@ -624,7 +553,7 @@ void BIOSSettings::copyFrom (BIOSSettings *aThat)
     m->bd.assignCopy(aThat->m->bd);
 }
 
-void BIOSSettings::applyDefaults (GuestOSType *aOsType)
+void BIOSSettings::i_applyDefaults (GuestOSType *aOsType)
 {
     AssertReturnVoid (aOsType != NULL);
 
@@ -635,7 +564,7 @@ void BIOSSettings::applyDefaults (GuestOSType *aOsType)
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Initialize default BIOS settings here */
-    m->bd->fIOAPICEnabled = aOsType->recommendedIOAPIC();
+    m->bd->fIOAPICEnabled = aOsType->i_recommendedIOAPIC();
 }
 
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-server/BandwidthControlImpl.cpp b/src/VBox/Main/src-server/BandwidthControlImpl.cpp
index 5235bb6..1a6b62d 100644
--- a/src/VBox/Main/src-server/BandwidthControlImpl.cpp
+++ b/src/VBox/Main/src-server/BandwidthControlImpl.cpp
@@ -1,10 +1,11 @@
+/* $Id: BandwidthControlImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -31,29 +32,10 @@
 // defines
 /////////////////////////////////////////////////////////////////////////////
 
-typedef std::list< ComObjPtr<BandwidthGroup> > BandwidthGroupList;
-
-struct BandwidthControl::Data
-{
-    Data(Machine *pMachine)
-        : pParent(pMachine)
-    { }
-
-    ~Data()
-    {};
-
-    Machine * const                 pParent;
-
-    // peer machine's bandwidth control
-    const ComObjPtr<BandwidthControl>  pPeer;
-
-    // the following fields need special backup/rollback/commit handling,
-    // so they cannot be a part of BackupableData
-    Backupable<BandwidthGroupList>    llBandwidthGroups;
-};
-
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
+DEFINE_EMPTY_CTOR_DTOR(BandwidthControl)
+
 
 HRESULT BandwidthControl::FinalConstruct()
 {
@@ -130,14 +112,15 @@ HRESULT BandwidthControl::init(Machine *aParent,
 
     /* create copies of all groups */
     m->llBandwidthGroups.allocate();
-    BandwidthGroupList::const_iterator it = aThat->m->llBandwidthGroups->begin();
-    while (it != aThat->m->llBandwidthGroups->end())
+    BandwidthGroupList::const_iterator it;
+    for (it = aThat->m->llBandwidthGroups->begin();
+         it != aThat->m->llBandwidthGroups->end();
+         ++it)
     {
         ComObjPtr<BandwidthGroup> group;
         group.createObject();
         group->init(this, *it);
         m->llBandwidthGroups->push_back(group);
-        ++ it;
     }
 
     /* Confirm successful initialization */
@@ -171,14 +154,15 @@ HRESULT BandwidthControl::initCopy(Machine *aParent, BandwidthControl *aThat)
 
     /* create copies of all groups */
     m->llBandwidthGroups.allocate();
-    BandwidthGroupList::const_iterator it = aThat->m->llBandwidthGroups->begin();
-    while (it != aThat->m->llBandwidthGroups->end())
+    BandwidthGroupList::const_iterator it;
+    for (it = aThat->m->llBandwidthGroups->begin();
+         it != aThat->m->llBandwidthGroups->end();
+         ++it)
     {
         ComObjPtr<BandwidthGroup> group;
         group.createObject();
         group->initCopy(this, *it);
         m->llBandwidthGroups->push_back(group);
-        ++ it;
     }
 
     /* Confirm a successful initialization */
@@ -192,23 +176,23 @@ HRESULT BandwidthControl::initCopy(Machine *aParent, BandwidthControl *aThat)
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void BandwidthControl::copyFrom (BandwidthControl *aThat)
+void BandwidthControl::i_copyFrom(BandwidthControl *aThat)
 {
-    AssertReturnVoid (aThat != NULL);
+    AssertReturnVoid(aThat != NULL);
 
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     /* sanity too */
-    AutoCaller thatCaller (aThat);
-    AssertComRCReturnVoid (thatCaller.rc());
+    AutoCaller thatCaller(aThat);
+    AssertComRCReturnVoid(thatCaller.rc());
 
     /* even more sanity */
     AutoAnyStateDependency adep(m->pParent);
-    AssertComRCReturnVoid (adep.rc());
+    AssertComRCReturnVoid(adep.rc());
     /* Machine::copyFrom() may not be called when the VM is running */
-    AssertReturnVoid (!Global::IsOnline (adep.machineState()));
+    AssertReturnVoid(!Global::IsOnline(adep.machineState()));
 
     /* peer is not modified, lock it for reading (aThat is "master" so locked
      * first) */
@@ -218,19 +202,20 @@ void BandwidthControl::copyFrom (BandwidthControl *aThat)
     /* create private copies of all bandwidth groups */
     m->llBandwidthGroups.backup();
     m->llBandwidthGroups->clear();
-    for (BandwidthGroupList::const_iterator it = aThat->m->llBandwidthGroups->begin();
-        it != aThat->m->llBandwidthGroups->end();
-        ++ it)
+    BandwidthGroupList::const_iterator it;
+    for (it = aThat->m->llBandwidthGroups->begin();
+         it != aThat->m->llBandwidthGroups->end();
+         ++it)
     {
         ComObjPtr<BandwidthGroup> group;
         group.createObject();
-        group->initCopy (this, *it);
-        m->llBandwidthGroups->push_back (group);
+        group->initCopy(this, *it);
+        m->llBandwidthGroups->push_back(group);
     }
 }
 
 /** @note Locks objects for writing! */
-void BandwidthControl::rollback()
+void BandwidthControl::i_rollback()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -240,23 +225,21 @@ void BandwidthControl::rollback()
     AssertComRCReturnVoid(adep.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    BandwidthGroupList::const_iterator it;
 
     if (!m->llBandwidthGroups.isNull())
     {
         if (m->llBandwidthGroups.isBackedUp())
         {
             /* unitialize all new groups (absent in the backed up list). */
-            BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin();
             BandwidthGroupList *backedList = m->llBandwidthGroups.backedUpData();
-            while (it != m->llBandwidthGroups->end())
+            for (it  = m->llBandwidthGroups->begin();
+                 it != m->llBandwidthGroups->end();
+                 ++it)
             {
                 if (   std::find(backedList->begin(), backedList->end(), *it)
-                    == backedList->end()
-                   )
-                {
+                    == backedList->end())
                     (*it)->uninit();
-                }
-                ++it;
             }
 
             /* restore the list */
@@ -264,18 +247,17 @@ void BandwidthControl::rollback()
         }
 
         /* rollback any changes to groups after restoring the list */
-        BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin();
-        while (it != m->llBandwidthGroups->end())
-        {
-            (*it)->rollback();
-            ++it;
-        }
+        for (it = m->llBandwidthGroups->begin();
+             it != m->llBandwidthGroups->end();
+             ++it)
+            (*it)->i_rollback();
     }
 }
 
-void BandwidthControl::commit()
+void BandwidthControl::i_commit()
 {
     bool commitBandwidthGroups = false;
+    BandwidthGroupList::const_iterator it;
 
     if (m->llBandwidthGroups.isBackedUp())
     {
@@ -288,13 +270,14 @@ void BandwidthControl::commit()
             /* Commit all changes to new groups (this will reshare data with
              * peers for those who have peers) */
             BandwidthGroupList *newList = new BandwidthGroupList();
-            BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin();
-            while (it != m->llBandwidthGroups->end())
+            for (it = m->llBandwidthGroups->begin();
+                 it != m->llBandwidthGroups->end();
+                 ++it)
             {
-                (*it)->commit();
+                (*it)->i_commit();
 
                 /* look if this group has a peer group */
-                ComObjPtr<BandwidthGroup> peer = (*it)->getPeer();
+                ComObjPtr<BandwidthGroup> peer = (*it)->i_getPeer();
                 if (!peer)
                 {
                     /* no peer means the device is a newly created one;
@@ -309,17 +292,13 @@ void BandwidthControl::commit()
                 }
                 /* and add it to the new list */
                 newList->push_back(peer);
-
-                ++it;
             }
 
             /* uninit old peer's groups that are left */
-            it = m->pPeer->m->llBandwidthGroups->begin();
-            while (it != m->pPeer->m->llBandwidthGroups->end())
-            {
+            for (it = m->pPeer->m->llBandwidthGroups->begin();
+                 it != m->pPeer->m->llBandwidthGroups->end();
+                 ++it)
                 (*it)->uninit();
-                ++it;
-            }
 
             /* attach new list of groups to our peer */
             m->pPeer->m->llBandwidthGroups.attach(newList);
@@ -340,12 +319,10 @@ void BandwidthControl::commit()
 
     if (commitBandwidthGroups)
     {
-        BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin();
-        while (it != m->llBandwidthGroups->end())
-        {
-            (*it)->commit();
-            ++it;
-        }
+        for (it = m->llBandwidthGroups->begin();
+             it != m->llBandwidthGroups->end();
+             ++it)
+            (*it)->i_commit();
     }
 }
 
@@ -364,7 +341,8 @@ void BandwidthControl::uninit()
 
     // uninit all groups on the list (it's a standard std::list not an ObjectsList
     // so we must uninit() manually)
-    for (BandwidthGroupList::iterator it = m->llBandwidthGroups->begin();
+    BandwidthGroupList::iterator it;
+    for (it = m->llBandwidthGroups->begin();
          it != m->llBandwidthGroups->end();
          ++it)
         (*it)->uninit();
@@ -385,9 +363,9 @@ void BandwidthControl::uninit()
  *  @param aBandwidthGroup where to return the found bandwidth group
  *  @param aSetError             true to set extended error info on failure
  */
-HRESULT BandwidthControl::getBandwidthGroupByName(const Utf8Str &aName,
-                                                  ComObjPtr<BandwidthGroup> &aBandwidthGroup,
-                                                  bool aSetError /* = false */)
+HRESULT BandwidthControl::i_getBandwidthGroupByName(const com::Utf8Str &aName,
+                                                    ComObjPtr<BandwidthGroup> &aBandwidthGroup,
+                                                    bool aSetError /* = false */)
 {
     AssertReturn(!aName.isEmpty(), E_INVALIDARG);
 
@@ -395,7 +373,7 @@ HRESULT BandwidthControl::getBandwidthGroupByName(const Utf8Str &aName,
          it != m->llBandwidthGroups->end();
          ++it)
     {
-        if ((*it)->getName() == aName)
+        if ((*it)->i_getName() == aName)
         {
             aBandwidthGroup = (*it);
             return S_OK;
@@ -408,69 +386,63 @@ HRESULT BandwidthControl::getBandwidthGroupByName(const Utf8Str &aName,
                         aName.c_str());
     return VBOX_E_OBJECT_NOT_FOUND;
 }
-
-STDMETHODIMP BandwidthControl::CreateBandwidthGroup(IN_BSTR aName, BandwidthGroupType_T aType, LONG64 aMaxBytesPerSec)
+// To do
+HRESULT BandwidthControl::createBandwidthGroup(const com::Utf8Str &aName,
+                                               BandwidthGroupType_T aType,
+                                               LONG64 aMaxBytesPerSec)
 {
     if (aMaxBytesPerSec < 0)
         return setError(E_INVALIDARG,
                         tr("Bandwidth group limit cannot be negative"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pParent);
+    AutoMutableOrSavedStateDependency adep(m->pParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* try to find one with the name first. */
     ComObjPtr<BandwidthGroup> group;
+    HRESULT rc = i_getBandwidthGroupByName(aName, group, false /* aSetError */);
 
-    HRESULT rc = getBandwidthGroupByName(aName, group, false /* aSetError */);
     if (SUCCEEDED(rc))
         return setError(VBOX_E_OBJECT_IN_USE,
-                        tr("Bandwidth group named '%ls' already exists"),
-                        aName);
+                        tr("Bandwidth group named '%s' already exists"),
+                        aName.c_str());
 
     group.createObject();
 
     rc = group->init(this, aName, aType, aMaxBytesPerSec);
     if (FAILED(rc)) return rc;
 
-    m->pParent->setModified(Machine::IsModified_BandwidthControl);
+    m->pParent->i_setModified(Machine::IsModified_BandwidthControl);
     m->llBandwidthGroups.backup();
     m->llBandwidthGroups->push_back(group);
 
     return S_OK;
 }
 
-STDMETHODIMP BandwidthControl::DeleteBandwidthGroup(IN_BSTR aName)
+HRESULT BandwidthControl::deleteBandwidthGroup(const com::Utf8Str &aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pParent);
+    AutoMutableOrSavedStateDependency adep(m->pParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<BandwidthGroup> group;
-    HRESULT rc = getBandwidthGroupByName(aName, group, true /* aSetError */);
+    HRESULT rc = i_getBandwidthGroupByName(aName, group, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
-    if (group->getReferences() != 0)
+    if (group->i_getReferences() != 0)
         return setError(VBOX_E_OBJECT_IN_USE,
-                        tr("The bandwidth group '%ls' is still in use"), aName);
+                        tr("The bandwidth group '%s' is still in use"), aName.c_str());
 
     /* We can remove it now. */
-    m->pParent->setModified(Machine::IsModified_BandwidthControl);
+    m->pParent->i_setModified(Machine::IsModified_BandwidthControl);
     m->llBandwidthGroups.backup();
 
-    group->unshare();
+    group->i_unshare();
 
     m->llBandwidthGroups->remove(group);
 
@@ -481,91 +453,78 @@ STDMETHODIMP BandwidthControl::DeleteBandwidthGroup(IN_BSTR aName)
     return S_OK;
 }
 
-STDMETHODIMP BandwidthControl::COMGETTER(NumGroups)(ULONG *aGroups)
+HRESULT BandwidthControl::getNumGroups(ULONG *aNumGroups)
 {
-    CheckComArgNotNull(aGroups);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aGroups = m->llBandwidthGroups->size();
+    *aNumGroups = (ULONG)m->llBandwidthGroups->size();
 
     return S_OK;
 }
 
-STDMETHODIMP BandwidthControl::GetBandwidthGroup(IN_BSTR aName, IBandwidthGroup **aBandwidthGroup)
+HRESULT BandwidthControl::getBandwidthGroup(const com::Utf8Str &aName, ComPtr<IBandwidthGroup> &aBandwidthGroup)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<BandwidthGroup> group;
+    HRESULT rc = i_getBandwidthGroupByName(aName, group, true /* aSetError */);
 
-    HRESULT rc = getBandwidthGroupByName(aName, group, true /* aSetError */);
     if (SUCCEEDED(rc))
-        group.queryInterfaceTo(aBandwidthGroup);
+        group.queryInterfaceTo(aBandwidthGroup.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP BandwidthControl::GetAllBandwidthGroups(ComSafeArrayOut(IBandwidthGroup *, aBandwidthGroups))
+HRESULT BandwidthControl::getAllBandwidthGroups(std::vector<ComPtr<IBandwidthGroup> > &aBandwidthGroups)
 {
-    CheckComArgOutSafeArrayPointerValid(aBandwidthGroups);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    SafeIfaceArray<IBandwidthGroup> collection (*m->llBandwidthGroups.data());
-    collection.detachTo(ComSafeArrayOutArg(aBandwidthGroups));
+    aBandwidthGroups.resize(0);
+    BandwidthGroupList::const_iterator it;
+    for (it = m->llBandwidthGroups->begin();
+         it != m->llBandwidthGroups->end();
+         ++it)
+        aBandwidthGroups.push_back(*it);
 
     return S_OK;
 }
 
-HRESULT BandwidthControl::loadSettings(const settings::IOSettings &data)
+HRESULT BandwidthControl::i_loadSettings(const settings::IOSettings &data)
 {
     HRESULT rc = S_OK;
 
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
-
-    for (settings::BandwidthGroupList::const_iterator it = data.llBandwidthGroups.begin();
-        it != data.llBandwidthGroups.end();
-        ++it)
+    settings::BandwidthGroupList::const_iterator it;
+    for (it = data.llBandwidthGroups.begin();
+         it != data.llBandwidthGroups.end();
+         ++it)
     {
         const settings::BandwidthGroup &gr = *it;
-        rc = CreateBandwidthGroup(Bstr(gr.strName).raw(), gr.enmType, gr.cMaxBytesPerSec);
+        rc = createBandwidthGroup(gr.strName, gr.enmType, gr.cMaxBytesPerSec);
         if (FAILED(rc)) break;
     }
 
     return rc;
 }
 
-HRESULT BandwidthControl::saveSettings(settings::IOSettings &data)
+HRESULT BandwidthControl::i_saveSettings(settings::IOSettings &data)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     data.llBandwidthGroups.clear();
-
-    for (BandwidthGroupList::const_iterator it = m->llBandwidthGroups->begin();
+    BandwidthGroupList::const_iterator it;
+    for (it = m->llBandwidthGroups->begin();
          it != m->llBandwidthGroups->end();
          ++it)
     {
         AutoWriteLock groupLock(*it COMMA_LOCKVAL_SRC_POS);
         settings::BandwidthGroup group;
 
-        group.strName      = (*it)->getName();
-        group.enmType      = (*it)->getType();
-        group.cMaxBytesPerSec = (*it)->getMaxBytesPerSec();
+        group.strName      = (*it)->i_getName();
+        group.enmType      = (*it)->i_getType();
+        group.cMaxBytesPerSec = (*it)->i_getMaxBytesPerSec();
 
         data.llBandwidthGroups.push_back(group);
     }
@@ -573,7 +532,7 @@ HRESULT BandwidthControl::saveSettings(settings::IOSettings &data)
     return S_OK;
 }
 
-Machine * BandwidthControl::getMachine() const
+Machine * BandwidthControl::i_getMachine() const
 {
     return m->pParent;
 }
diff --git a/src/VBox/Main/src-server/BandwidthGroupImpl.cpp b/src/VBox/Main/src-server/BandwidthGroupImpl.cpp
index 22ba0c1..d183b9e 100644
--- a/src/VBox/Main/src-server/BandwidthGroupImpl.cpp
+++ b/src/VBox/Main/src-server/BandwidthGroupImpl.cpp
@@ -1,3 +1,4 @@
+/* $Id: BandwidthGroupImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
@@ -24,42 +25,10 @@
 
 #include <iprt/cpp/utils.h>
 
-////////////////////////////////////////////////////////////////////////////////
-//
-// private member data definition
-//
-////////////////////////////////////////////////////////////////////////////////
-
-struct BackupableBandwidthGroupData
-{
-    BackupableBandwidthGroupData()
-        : enmType(BandwidthGroupType_Null),
-          aMaxBytesPerSec(0),
-          cReferences(0)
-    { }
-
-    Utf8Str                 strName;
-    BandwidthGroupType_T    enmType;
-    LONG64                  aMaxBytesPerSec;
-    ULONG                   cReferences;
-};
-
-struct BandwidthGroup::Data
-{
-    Data(BandwidthControl * const aBandwidthControl)
-        : pParent(aBandwidthControl),
-          pPeer(NULL)
-    { }
-
-    BandwidthControl * const    pParent;
-    ComObjPtr<BandwidthGroup>   pPeer;
-
-    // use the XML settings structure in the members for simplicity
-    Backupable<BackupableBandwidthGroupData> bd;
-};
-
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
+//
+DEFINE_EMPTY_CTOR_DTOR(BandwidthGroup)
 
 HRESULT BandwidthGroup::FinalConstruct()
 {
@@ -159,14 +128,14 @@ HRESULT BandwidthGroup::init(BandwidthControl *aParent,
         AutoWriteLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
 
         unconst(aThat->m->pPeer) = this;
-        m->bd.attach (aThat->m->bd);
+        m->bd.attach(aThat->m->bd);
     }
     else
     {
         unconst(m->pPeer) = aThat;
 
         AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
-        m->bd.share (aThat->m->bd);
+        m->bd.share(aThat->m->bd);
     }
 
     /* Confirm successful initialization */
@@ -228,39 +197,24 @@ void BandwidthGroup::uninit()
     m = NULL;
 }
 
-STDMETHODIMP BandwidthGroup::COMGETTER(Name)(BSTR *aName)
+HRESULT BandwidthGroup::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mName is constant during life time, no need to lock */
-    m->bd.data()->strName.cloneTo(aName);
+    aName = m->bd.data()->strName;
 
     return S_OK;
 }
 
-STDMETHODIMP BandwidthGroup::COMGETTER(Type)(BandwidthGroupType_T *aType)
+HRESULT BandwidthGroup::getType(BandwidthGroupType_T *aType)
 {
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* type is constant during life time, no need to lock */
     *aType = m->bd->enmType;
 
     return S_OK;
 }
 
-STDMETHODIMP BandwidthGroup::COMGETTER(Reference)(ULONG *aReferences)
+HRESULT BandwidthGroup::getReference(ULONG *aReferences)
 {
-    CheckComArgOutPointerValid(aReferences);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aReferences = m->bd->cReferences;
@@ -268,13 +222,8 @@ STDMETHODIMP BandwidthGroup::COMGETTER(Reference)(ULONG *aReferences)
     return S_OK;
 }
 
-STDMETHODIMP BandwidthGroup::COMGETTER(MaxBytesPerSec)(LONG64 *aMaxBytesPerSec)
+HRESULT BandwidthGroup::getMaxBytesPerSec(LONG64 *aMaxBytesPerSec)
 {
-    CheckComArgOutPointerValid(aMaxBytesPerSec);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aMaxBytesPerSec = m->bd->aMaxBytesPerSec;
@@ -282,24 +231,21 @@ STDMETHODIMP BandwidthGroup::COMGETTER(MaxBytesPerSec)(LONG64 *aMaxBytesPerSec)
     return S_OK;
 }
 
-STDMETHODIMP BandwidthGroup::COMSETTER(MaxBytesPerSec)(LONG64 aMaxBytesPerSec)
+HRESULT BandwidthGroup::setMaxBytesPerSec(LONG64 aMaxBytesPerSec)
 {
     if (aMaxBytesPerSec < 0)
         return setError(E_INVALIDARG,
                         tr("Bandwidth group limit cannot be negative"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     m->bd.backup();
     m->bd->aMaxBytesPerSec = aMaxBytesPerSec;
 
     /* inform direct session if any. */
-    ComObjPtr<Machine> pMachine = m->pParent->getMachine();
+    ComObjPtr<Machine> pMachine = m->pParent->i_getMachine();
     alock.release();
-    pMachine->onBandwidthGroupChange(this);
+    pMachine->i_onBandwidthGroupChange(this);
 
     return S_OK;
 }
@@ -308,7 +254,7 @@ STDMETHODIMP BandwidthGroup::COMSETTER(MaxBytesPerSec)(LONG64 aMaxBytesPerSec)
 /////////////////////////////////////////////////////////////////////////////
 
 /** @note Locks objects for writing! */
-void BandwidthGroup::rollback()
+void BandwidthGroup::i_rollback()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -322,15 +268,15 @@ void BandwidthGroup::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void BandwidthGroup::commit()
+void BandwidthGroup::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     /* sanity too */
-    AutoCaller peerCaller (m->pPeer);
-    AssertComRCReturnVoid (peerCaller.rc());
+    AutoCaller peerCaller(m->pPeer);
+    AssertComRCReturnVoid(peerCaller.rc());
 
     /* lock both for writing since we modify both (m->pPeer is "master" so locked
      * first) */
@@ -342,7 +288,7 @@ void BandwidthGroup::commit()
         if (m->pPeer)
         {
             // attach new data to the peer and reshare it
-            m->pPeer->m->bd.attach (m->bd);
+            m->pPeer->m->bd.attach(m->bd);
         }
     }
 }
@@ -355,15 +301,15 @@ void BandwidthGroup::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void BandwidthGroup::unshare()
+void BandwidthGroup::i_unshare()
 {
     /* sanity */
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid (autoCaller.rc());
+    AssertComRCReturnVoid(autoCaller.rc());
 
     /* sanity too */
-    AutoCaller peerCaller (m->pPeer);
-    AssertComRCReturnVoid (peerCaller.rc());
+    AutoCaller peerCaller(m->pPeer);
+    AssertComRCReturnVoid(peerCaller.rc());
 
     /* peer is not modified, lock it for reading (m->pPeer is "master" so locked
      * first) */
@@ -381,39 +327,14 @@ void BandwidthGroup::unshare()
     unconst(m->pPeer) = NULL;
 }
 
-ComObjPtr<BandwidthGroup> BandwidthGroup::getPeer()
-{
-    return m->pPeer;
-}
-
-const Utf8Str& BandwidthGroup::getName() const
-{
-    return m->bd->strName;
-}
-
-BandwidthGroupType_T BandwidthGroup::getType() const
-{
-    return m->bd->enmType;
-}
-
-LONG64 BandwidthGroup::getMaxBytesPerSec() const
-{
-    return m->bd->aMaxBytesPerSec;
-}
-
-ULONG BandwidthGroup::getReferences() const
-{
-    return m->bd->cReferences;
-}
-
-void BandwidthGroup::reference()
+void BandwidthGroup::i_reference()
 {
     AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS);
     m->bd.backup();
     m->bd->cReferences++;
 }
 
-void BandwidthGroup::release()
+void BandwidthGroup::i_release()
 {
     AutoWriteLock wl(this COMMA_LOCKVAL_SRC_POS);
     m->bd.backup();
diff --git a/src/VBox/Main/src-server/ClientToken.cpp b/src/VBox/Main/src-server/ClientToken.cpp
index be0afb8..173d19b 100644
--- a/src/VBox/Main/src-server/ClientToken.cpp
+++ b/src/VBox/Main/src-server/ClientToken.cpp
@@ -1,3 +1,4 @@
+/* $Id: ClientToken.cpp $ */
 /** @file
  *
  * VirtualBox API client session crash token handling
diff --git a/src/VBox/Main/src-server/ClientWatcher.cpp b/src/VBox/Main/src-server/ClientWatcher.cpp
index 6d2cd3f..7ad7f8d 100644
--- a/src/VBox/Main/src-server/ClientWatcher.cpp
+++ b/src/VBox/Main/src-server/ClientWatcher.cpp
@@ -1,10 +1,11 @@
+/* $Id: ClientWatcher.cpp $ */
 /** @file
  *
  * VirtualBox API client session crash watcher
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -210,20 +211,20 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
             else if (rc > WAIT_OBJECT_0 && rc <= (WAIT_OBJECT_0 + cnt))
             {
                 /* machine mutex is released */
-                (machines[rc - WAIT_OBJECT_0 - 1])->checkForDeath();
+                (machines[rc - WAIT_OBJECT_0 - 1])->i_checkForDeath();
                 update = true;
             }
             else if (rc > WAIT_ABANDONED_0 && rc <= (WAIT_ABANDONED_0 + cnt))
             {
                 /* machine mutex is abandoned due to client process termination */
-                (machines[rc - WAIT_ABANDONED_0 - 1])->checkForDeath();
+                (machines[rc - WAIT_ABANDONED_0 - 1])->i_checkForDeath();
                 update = true;
             }
             else if (rc > WAIT_OBJECT_0 + cnt && rc <= (WAIT_OBJECT_0 + cntSpawned))
             {
                 /* spawned VM process has terminated (normally or abnormally) */
                 (spawnedMachines[rc - WAIT_OBJECT_0 - cnt - 1])->
-                    checkForSpawnFailure();
+                    i_checkForSpawnFailure();
                 update = true;
             }
 
@@ -234,7 +235,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                     CloseHandle(handles[i]);
 
                 // get reference to the machines list in VirtualBox
-                VirtualBox::MachinesOList &allMachines = that->mVirtualBox->getMachinesList();
+                VirtualBox::MachinesOList &allMachines = that->mVirtualBox->i_getMachinesList();
 
                 // lock the machines list for reading
                 AutoReadLock thatLock(allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS);
@@ -252,13 +253,13 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                                    ("MAXIMUM_WAIT_OBJECTS reached"));
 
                     ComObjPtr<SessionMachine> sm;
-                    if ((*it)->isSessionOpenOrClosing(sm))
+                    if ((*it)->i_isSessionOpenOrClosing(sm))
                     {
                         AutoCaller smCaller(sm);
                         if (smCaller.isOk())
                         {
                             AutoReadLock smLock(sm COMMA_LOCKVAL_SRC_POS);
-                            Machine::ClientToken *ct = sm->getClientToken();
+                            Machine::ClientToken *ct = sm->i_getClientToken();
                             if (ct)
                             {
                                 HANDLE ipcSem = ct->getToken();
@@ -284,7 +285,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                     AssertMsgBreak((1 + cnt + cntSpawned) <= MAXIMUM_WAIT_OBJECTS,
                                    ("MAXIMUM_WAIT_OBJECTS reached"));
 
-                    if ((*it)->isSessionSpawning())
+                    if ((*it)->i_isSessionSpawning())
                     {
                         ULONG pid;
                         HRESULT hrc = (*it)->COMGETTER(SessionPID)(&pid);
@@ -387,7 +388,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                                              machines[semId]->name().raw()));
                             }
 #endif
-                            machines[semId]->checkForDeath();
+                            machines[semId]->i_checkForDeath();
                         }
                         update = true;
                     }
@@ -416,7 +417,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                                                      machines[i]->name().raw()));
                                     }
 #endif
-                                    machines[i]->checkForDeath();
+                                    machines[i]->i_checkForDeath();
                                 }
                             }
                         }
@@ -432,14 +433,14 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                 {
                     for (size_t i = 0; i < cntSpawned; ++i)
                         updateSpawned |= (spawnedMachines[i])->
-                            checkForSpawnFailure();
+                            i_checkForSpawnFailure();
                 }
             }
 
             if (update || updateSpawned)
             {
                 // get reference to the machines list in VirtualBox
-                VirtualBox::MachinesOList &allMachines = that->mVirtualBox->getMachinesList();
+                VirtualBox::MachinesOList &allMachines = that->mVirtualBox->i_getMachinesList();
 
                 // lock the machines list for reading
                 AutoReadLock thatLock(allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS);
@@ -463,13 +464,13 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                                    cnt));
 
                         ComObjPtr<SessionMachine> sm;
-                        if ((*it)->isSessionOpenOrClosing(sm))
+                        if ((*it)->i_isSessionOpenOrClosing(sm))
                         {
                             AutoCaller smCaller(sm);
                             if (smCaller.isOk())
                             {
                                 AutoReadLock smLock(sm COMMA_LOCKVAL_SRC_POS);
-                                ClientToken *ct = sm->getClientToken();
+                                ClientToken *ct = sm->i_getClientToken();
                                 if (ct)
                                 {
                                     HMTX ipcSem = ct->getToken();
@@ -504,7 +505,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                     for (MachinesOList::iterator it = allMachines.begin();
                          it != allMachines.end(); ++it)
                     {
-                        if ((*it)->isSessionSpawning())
+                        if ((*it)->i_isSessionSpawning())
                             spawnedMachines.push_back(*it);
                     }
 
@@ -573,7 +574,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                 /* RT_SUCCESS(rc) means an update event is signaled */
 
                 // get reference to the machines list in VirtualBox
-                VirtualBox::MachinesOList &allMachines = that->mVirtualBox->getMachinesList();
+                VirtualBox::MachinesOList &allMachines = that->mVirtualBox->i_getMachinesList();
 
                 // lock the machines list for reading
                 AutoReadLock thatLock(allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS);
@@ -588,7 +589,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                          ++it)
                     {
                         ComObjPtr<SessionMachine> sm;
-                        if ((*it)->isSessionOpenOrClosing(sm))
+                        if ((*it)->i_isSessionOpenOrClosing(sm))
                             machines.push_back(sm);
                     }
 
@@ -605,7 +606,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                          it != allMachines.end();
                          ++it)
                     {
-                        if ((*it)->isSessionSpawning())
+                        if ((*it)->i_isSessionSpawning())
                             spawnedMachines.push_back(*it);
                     }
 
@@ -618,11 +619,11 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
 
             update = false;
             for (size_t i = 0; i < cnt; ++i)
-                update |= (machines[i])->checkForDeath();
+                update |= (machines[i])->i_checkForDeath();
 
             updateSpawned = false;
             for (size_t i = 0; i < cntSpawned; ++i)
-                updateSpawned |= (spawnedMachines[i])->checkForSpawnFailure();
+                updateSpawned |= (spawnedMachines[i])->i_checkForSpawnFailure();
 
             /* reap child processes */
             {
@@ -742,7 +743,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                 /* RT_SUCCESS(rc) means an update event is signaled */
 
                 // get reference to the machines list in VirtualBox
-                VirtualBox::MachinesOList &allMachines = that->mVirtualBox->getMachinesList();
+                VirtualBox::MachinesOList &allMachines = that->mVirtualBox->i_getMachinesList();
 
                 // lock the machines list for reading
                 AutoReadLock thatLock(allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS);
@@ -756,7 +757,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
                          it != allMachines.end();
                          ++it)
                     {
-                        if ((*it)->isSessionSpawning())
+                        if ((*it)->i_isSessionSpawning())
                             spawnedMachines.push_back(*it);
                     }
 
@@ -770,7 +771,7 @@ DECLCALLBACK(int) VirtualBox::ClientWatcher::worker(RTTHREAD /* thread */, void
 
             updateSpawned = false;
             for (size_t i = 0; i < cntSpawned; ++i)
-                updateSpawned |= (spawnedMachines[i])->checkForSpawnFailure();
+                updateSpawned |= (spawnedMachines[i])->i_checkForSpawnFailure();
 
             /* reap child processes */
             {
diff --git a/src/VBox/Main/src-server/DHCPServerImpl.cpp b/src/VBox/Main/src-server/DHCPServerImpl.cpp
index c9ed096..3e22d1d 100644
--- a/src/VBox/Main/src-server/DHCPServerImpl.cpp
+++ b/src/VBox/Main/src-server/DHCPServerImpl.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -155,7 +155,7 @@ HRESULT DHCPServer::init(VirtualBox *aVirtualBox,
 }
 
 
-HRESULT DHCPServer::saveSettings(settings::DHCPServer &data)
+HRESULT DHCPServer::i_saveSettings(settings::DHCPServer &data)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -181,27 +181,17 @@ HRESULT DHCPServer::saveSettings(settings::DHCPServer &data)
 }
 
 
-STDMETHODIMP DHCPServer::COMGETTER(NetworkName) (BSTR *aName)
+HRESULT DHCPServer::getNetworkName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mName.cloneTo(aName);
+    aName = mName;
     return S_OK;
 }
 
 
-STDMETHODIMP DHCPServer::COMGETTER(Enabled) (BOOL *aEnabled)
+HRESULT DHCPServer::getEnabled(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aEnabled = m->enabled;
@@ -209,92 +199,69 @@ STDMETHODIMP DHCPServer::COMGETTER(Enabled) (BOOL *aEnabled)
 }
 
 
-STDMETHODIMP DHCPServer::COMSETTER(Enabled) (BOOL aEnabled)
+HRESULT DHCPServer::setEnabled(BOOL aEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     m->enabled = aEnabled;
 
     // save the global settings; for that we should hold only the VirtualBox lock
     alock.release();
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mVirtualBox->saveSettings();
+    HRESULT rc = mVirtualBox->i_saveSettings();
 
     return rc;
 }
 
 
-STDMETHODIMP DHCPServer::COMGETTER(IPAddress) (BSTR *aIPAddress)
+HRESULT DHCPServer::getIPAddress(com::Utf8Str &aIPAddress)
 {
-    CheckComArgOutPointerValid(aIPAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->IPAddress.cloneTo(aIPAddress);
+    aIPAddress = Utf8Str(m->IPAddress);
     return S_OK;
 }
 
 
-STDMETHODIMP DHCPServer::COMGETTER(NetworkMask) (BSTR *aNetworkMask)
+HRESULT DHCPServer::getNetworkMask(com::Utf8Str &aNetworkMask)
 {
-    CheckComArgOutPointerValid(aNetworkMask);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->GlobalDhcpOptions[DhcpOpt_SubnetMask].text.cloneTo(aNetworkMask);
+    aNetworkMask = m->GlobalDhcpOptions[DhcpOpt_SubnetMask].text;
     return S_OK;
 }
 
 
-STDMETHODIMP DHCPServer::COMGETTER(LowerIP) (BSTR *aIPAddress)
+HRESULT DHCPServer::getLowerIP(com::Utf8Str &aIPAddress)
 {
-    CheckComArgOutPointerValid(aIPAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->lowerIP.cloneTo(aIPAddress);
+    aIPAddress = Utf8Str(m->lowerIP);
     return S_OK;
 }
 
 
-STDMETHODIMP DHCPServer::COMGETTER(UpperIP) (BSTR *aIPAddress)
+HRESULT DHCPServer::getUpperIP(com::Utf8Str &aIPAddress)
 {
-    CheckComArgOutPointerValid(aIPAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->upperIP.cloneTo(aIPAddress);
+    aIPAddress = Utf8Str(m->upperIP);
     return S_OK;
 }
 
 
-STDMETHODIMP DHCPServer::SetConfiguration (IN_BSTR aIPAddress, IN_BSTR aNetworkMask, IN_BSTR aLowerIP, IN_BSTR aUpperIP)
+HRESULT DHCPServer::setConfiguration(const com::Utf8Str &aIPAddress,
+                                     const com::Utf8Str &aNetworkMask,
+                                     const com::Utf8Str &aLowerIP,
+                                     const com::Utf8Str &aUpperIP)
 {
-    AssertReturn(aIPAddress != NULL, E_INVALIDARG);
-    AssertReturn(aNetworkMask != NULL, E_INVALIDARG);
-    AssertReturn(aLowerIP != NULL, E_INVALIDARG);
-    AssertReturn(aUpperIP != NULL, E_INVALIDARG);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    AssertReturn(!aIPAddress.isEmpty(), E_INVALIDARG);
+    AssertReturn(!aNetworkMask.isEmpty(), E_INVALIDARG);
+    AssertReturn(!aLowerIP.isEmpty(), E_INVALIDARG);
+    AssertReturn(!aUpperIP.isEmpty(), E_INVALIDARG);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     m->IPAddress = aIPAddress;
-    m->GlobalDhcpOptions[DhcpOpt_SubnetMask] = DhcpOptValue(aNetworkMask);
+    m->GlobalDhcpOptions[DhcpOpt_SubnetMask] = aNetworkMask;
 
     m->lowerIP = aLowerIP;
     m->upperIP = aUpperIP;
@@ -302,7 +269,7 @@ STDMETHODIMP DHCPServer::SetConfiguration (IN_BSTR aIPAddress, IN_BSTR aNetworkM
     // save the global settings; for that we should hold only the VirtualBox lock
     alock.release();
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    return mVirtualBox->saveSettings();
+    return mVirtualBox->i_saveSettings();
 }
 
 
@@ -418,13 +385,8 @@ int DHCPServer::addOption(DhcpOptionMap &aMap,
 }
 
 
-STDMETHODIMP DHCPServer::AddGlobalOption(DhcpOpt_T aOption, IN_BSTR aValue)
+HRESULT DHCPServer::addGlobalOption(DhcpOpt_T aOption, const com::Utf8Str &aValue)
 {
-    CheckComArgStr(aValue);
-    /* store global option */
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     int rc = addOption(m->GlobalDhcpOptions, aOption, aValue);
@@ -441,73 +403,50 @@ STDMETHODIMP DHCPServer::AddGlobalOption(DhcpOpt_T aOption, IN_BSTR aValue)
     alock.release();
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    return mVirtualBox->saveSettings();
+    return mVirtualBox->i_saveSettings();
 }
 
 
-STDMETHODIMP DHCPServer::COMGETTER(GlobalOptions)(ComSafeArrayOut(BSTR, aValues))
+HRESULT DHCPServer::getGlobalOptions(std::vector<com::Utf8Str> &aValues)
 {
-    CheckComArgOutSafeArrayPointerValid(aValues);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    SafeArray<BSTR> sf(m->GlobalDhcpOptions.size());
-    int i = 0;
-
-    for (DhcpOptIterator it = m->GlobalDhcpOptions.begin();
-         it != m->GlobalDhcpOptions.end(); ++it)
+    aValues.resize(m->GlobalDhcpOptions.size());
+    DhcpOptionMap::const_iterator it;
+    size_t i = 0;
+    for (it = m->GlobalDhcpOptions.begin(); it != m->GlobalDhcpOptions.end(); ++it, ++i)
     {
         uint32_t OptCode = (*it).first;
         const DhcpOptValue &OptValue = (*it).second;
 
-        com::Utf8Str value;
-        encodeOption(value, OptCode, OptValue);
-        Bstr(value).detachTo(&sf[i]);
-        i++;
+        encodeOption(aValues[i], OptCode, OptValue);
     }
 
-    sf.detachTo(ComSafeArrayOutArg(aValues));
-
     return S_OK;
 }
 
-
-STDMETHODIMP DHCPServer::COMGETTER(VmConfigs)(ComSafeArrayOut(BSTR, aValues))
+HRESULT DHCPServer::getVmConfigs(std::vector<com::Utf8Str> &aValues)
 {
-    CheckComArgOutSafeArrayPointerValid(aValues);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    SafeArray<BSTR> sf(m->VmSlot2Options.size());
-    VmSlot2OptionsIterator it = m->VmSlot2Options.begin();
-    int i = 0;
-    for (;it != m->VmSlot2Options.end(); ++it)
+    aValues.resize(m->VmSlot2Options.size());
+    VmSlot2OptionsMap::const_iterator it;
+    size_t i = 0;
+    for (it = m->VmSlot2Options.begin(); it != m->VmSlot2Options.end(); ++it, ++i)
     {
-        Bstr(Utf8StrFmt("[%s]:%d",
-                        it->first.VmName.c_str(),
-                        it->first.Slot)).detachTo(&sf[i]);
-        i++;
+        aValues[i] = Utf8StrFmt("[%s]:%d", it->first.VmName.c_str(), it->first.Slot);
     }
 
-    sf.detachTo(ComSafeArrayOutArg(aValues));
-
     return S_OK;
 }
 
 
-STDMETHODIMP DHCPServer::AddVmSlotOption(IN_BSTR aVmName, LONG aSlot, DhcpOpt_T aOption, IN_BSTR aValue)
+HRESULT DHCPServer::addVmSlotOption(const com::Utf8Str &aVmName,
+                                    LONG aSlot,
+                                    DhcpOpt_T aOption,
+                                    const com::Utf8Str &aValue)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    DhcpOptionMap &map = m->VmSlot2Options[VmNameSlotKey(com::Utf8Str(aVmName), aSlot)];
+    DhcpOptionMap &map = m->VmSlot2Options[VmNameSlotKey(aVmName, aSlot)];
     int rc = addOption(map, aOption, aValue);
     if (!RT_SUCCESS(rc))
         return E_INVALIDARG;
@@ -515,82 +454,56 @@ STDMETHODIMP DHCPServer::AddVmSlotOption(IN_BSTR aVmName, LONG aSlot, DhcpOpt_T
     alock.release();
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    return mVirtualBox->saveSettings();
+    return mVirtualBox->i_saveSettings();
 }
 
 
-STDMETHODIMP DHCPServer::RemoveVmSlotOptions(IN_BSTR aVmName, LONG aSlot)
+HRESULT DHCPServer::removeVmSlotOptions(const com::Utf8Str &aVmName, LONG aSlot)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    DhcpOptionMap& map = findOptMapByVmNameSlot(com::Utf8Str(aVmName), aSlot);
-
+    DhcpOptionMap& map = i_findOptMapByVmNameSlot(aVmName, aSlot);
     map.clear();
 
     alock.release();
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    return mVirtualBox->saveSettings();
+    return mVirtualBox->i_saveSettings();
 }
 
-
 /**
  * this is mapping (vm, slot)
  */
-STDMETHODIMP DHCPServer::GetVmSlotOptions(IN_BSTR aVmName,
-                                          LONG aSlot,
-                                          ComSafeArrayOut(BSTR, aValues))
+HRESULT DHCPServer::getVmSlotOptions(const com::Utf8Str &aVmName,
+                                     LONG aSlot,
+                                     std::vector<com::Utf8Str> &aValues)
 {
-    CheckComArgOutSafeArrayPointerValid(aValues);
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    DhcpOptionMap& map = findOptMapByVmNameSlot(com::Utf8Str(aVmName), aSlot);
-
-    SafeArray<BSTR> sf(map.size());
-    int i = 0;
-
-    for (DhcpOptIterator it = map.begin();
-         it != map.end(); ++it)
+    DhcpOptionMap& map = i_findOptMapByVmNameSlot(aVmName, aSlot);
+    aValues.resize(map.size());
+    size_t i = 0;
+    DhcpOptionMap::const_iterator it;
+    for (it = map.begin(); it != map.end(); ++it, ++i)
     {
         uint32_t OptCode = (*it).first;
         const DhcpOptValue &OptValue = (*it).second;
 
-        com::Utf8Str value;
-        encodeOption(value, OptCode, OptValue);
-        Bstr(value).detachTo(&sf[i]);
-        i++;
+        encodeOption(aValues[i], OptCode, OptValue);
     }
 
-    sf.detachTo(ComSafeArrayOutArg(aValues));
-
     return S_OK;
 }
 
 
-STDMETHODIMP DHCPServer::GetMacOptions(IN_BSTR aMAC, ComSafeArrayOut(BSTR, aValues))
+HRESULT DHCPServer::getMacOptions(const com::Utf8Str &aMAC, std::vector<com::Utf8Str> &aOption)
 {
-    CheckComArgOutSafeArrayPointerValid(aValues);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     HRESULT hrc = S_OK;
-
     ComPtr<IMachine> machine;
     ComPtr<INetworkAdapter> nic;
-
     VmSlot2OptionsIterator it;
-    for(it = m->VmSlot2Options.begin();
-        it != m->VmSlot2Options.end();
-        ++it)
+    for(it = m->VmSlot2Options.begin(); it != m->VmSlot2Options.end(); ++it)
     {
-
         alock.release();
         hrc = mVirtualBox->FindMachine(Bstr(it->first.VmName).raw(), machine.asOutParam());
         alock.acquire();
@@ -613,38 +526,37 @@ STDMETHODIMP DHCPServer::GetMacOptions(IN_BSTR aMAC, ComSafeArrayOut(BSTR, aValu
 
         if (FAILED(hrc)) /* no MAC address ??? */
             break;
-
-        if (!RTStrICmp(com::Utf8Str(mac).c_str(), com::Utf8Str(aMAC).c_str()))
-            return GetVmSlotOptions(Bstr(it->first.VmName).raw(),
+        if (!RTStrICmp(com::Utf8Str(mac).c_str(), aMAC.c_str()))
+            return getVmSlotOptions(it->first.VmName,
                                     it->first.Slot,
-                                    ComSafeArrayOutArg(aValues));
+                                    aOption);
     } /* end of for */
 
     return hrc;
 }
 
-
-STDMETHODIMP DHCPServer::COMGETTER(EventSource)(IEventSource **aEventSource)
+HRESULT DHCPServer::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
     NOREF(aEventSource);
     ReturnComNotImplemented();
 }
 
 
-STDMETHODIMP DHCPServer::Start(IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR aTrunkType)
+HRESULT DHCPServer::start(const com::Utf8Str &aNetworkName,
+                          const com::Utf8Str &aTrunkName,
+                          const com::Utf8Str &aTrunkType)
 {
     /* Silently ignore attempts to run disabled servers. */
     if (!m->enabled)
         return S_OK;
 
     /* Commmon Network Settings */
-    m->dhcp.setOption(NetworkServiceRunner::kNsrKeyNetwork, Utf8Str(aNetworkName).c_str());
+    m->dhcp.setOption(NetworkServiceRunner::kNsrKeyNetwork, aNetworkName.c_str());
 
-    Bstr tmp(aTrunkName);
+    if (!aTrunkName.isEmpty())
+        m->dhcp.setOption(NetworkServiceRunner::kNsrTrunkName, aTrunkName.c_str());
 
-    if (!tmp.isEmpty())
-        m->dhcp.setOption(NetworkServiceRunner::kNsrTrunkName, Utf8Str(tmp).c_str());
-    m->dhcp.setOption(NetworkServiceRunner::kNsrKeyTrunkType, Utf8Str(aTrunkType).c_str());
+    m->dhcp.setOption(NetworkServiceRunner::kNsrKeyTrunkType, aTrunkType.c_str());
 
     /* XXX: should this MAC default initialization moved to NetworkServiceRunner? */
     char strMAC[32];
@@ -666,16 +578,14 @@ STDMETHODIMP DHCPServer::Start(IN_BSTR aNetworkName, IN_BSTR aTrunkName, IN_BSTR
 }
 
 
-STDMETHODIMP DHCPServer::Stop (void)
+HRESULT DHCPServer::stop (void)
 {
     return RT_FAILURE(m->dhcp.stop()) ? E_FAIL : S_OK;
 }
 
 
-DhcpOptionMap& DHCPServer::findOptMapByVmNameSlot(const com::Utf8Str& aVmName,
+DhcpOptionMap& DHCPServer::i_findOptMapByVmNameSlot(const com::Utf8Str& aVmName,
                                                   LONG aSlot)
 {
-    return m->VmSlot2Options[settings::VmNameSlotKey(
-          com::Utf8Str(aVmName),
-          aSlot)];
+    return m->VmSlot2Options[settings::VmNameSlotKey(aVmName, aSlot)];
 }
diff --git a/src/VBox/Main/src-server/GuestOSTypeImpl.cpp b/src/VBox/Main/src-server/GuestOSTypeImpl.cpp
index 3495471..a13bb45 100644
--- a/src/VBox/Main/src-server/GuestOSTypeImpl.cpp
+++ b/src/VBox/Main/src-server/GuestOSTypeImpl.cpp
@@ -1,10 +1,11 @@
+/* $Id: GuestOSTypeImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -146,195 +147,130 @@ void GuestOSType::uninit()
 // IGuestOSType properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP GuestOSType::COMGETTER(FamilyId)(BSTR *aFamilyId)
+HRESULT GuestOSType::getFamilyId(com::Utf8Str &aFamilyId)
 {
-    CheckComArgOutPointerValid(aFamilyId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mFamilyID is constant during life time, no need to lock */
-    mFamilyID.cloneTo(aFamilyId);
-
+    aFamilyId = mFamilyID;
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(FamilyDescription)(BSTR *aFamilyDescription)
-{
-    CheckComArgOutPointerValid(aFamilyDescription);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getFamilyDescription(com::Utf8Str &aFamilyDescription)
+{
     /* mFamilyDescription is constant during life time, no need to lock */
-    mFamilyDescription.cloneTo(aFamilyDescription);
+    aFamilyDescription = mFamilyDescription;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(Id)(BSTR *aId)
-{
-    CheckComArgOutPointerValid(aId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getId(com::Utf8Str &aId)
+{
     /* mID is constant during life time, no need to lock */
-    mID.cloneTo(aId);
+    aId = mID;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(Description)(BSTR *aDescription)
-{
-    CheckComArgOutPointerValid(aDescription);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getDescription(com::Utf8Str &aDescription)
+{
     /* mDescription is constant during life time, no need to lock */
-    mDescription.cloneTo(aDescription);
+    aDescription = mDescription;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(Is64Bit)(BOOL *aIs64Bit)
+HRESULT GuestOSType::getIs64Bit(BOOL *aIs64Bit)
 {
-    CheckComArgOutPointerValid(aIs64Bit);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mIs64Bit is constant during life time, no need to lock */
     *aIs64Bit = !!(mOSHint & VBOXOSHINT_64BIT);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedIOAPIC)(BOOL *aRecommendedIOAPIC)
+HRESULT GuestOSType::getRecommendedIOAPIC(BOOL *aRecommendedIOAPIC)
 {
-    CheckComArgOutPointerValid(aRecommendedIOAPIC);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mRecommendedIOAPIC is constant during life time, no need to lock */
     *aRecommendedIOAPIC = !!(mOSHint & VBOXOSHINT_IOAPIC);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedVirtEx)(BOOL *aRecommendedVirtEx)
-{
-    CheckComArgOutPointerValid(aRecommendedVirtEx);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedVirtEx(BOOL *aRecommendedVirtEx)
+{
     /* mRecommendedVirtEx is constant during life time, no need to lock */
     *aRecommendedVirtEx = !!(mOSHint & VBOXOSHINT_HWVIRTEX);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedRAM)(ULONG *aRAMSize)
-{
-    CheckComArgOutPointerValid(aRAMSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedRAM(ULONG *aRAMSize)
+{
     /* mRAMSize is constant during life time, no need to lock */
     *aRAMSize = mRAMSize;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedVRAM)(ULONG *aVRAMSize)
-{
-    CheckComArgOutPointerValid(aVRAMSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedVRAM(ULONG *aVRAMSize)
+{
     /* mVRAMSize is constant during life time, no need to lock */
     *aVRAMSize = mVRAMSize;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(Recommended2DVideoAcceleration)(BOOL *aRecommended2DVideoAcceleration)
-{
-    CheckComArgOutPointerValid(aRecommended2DVideoAcceleration);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommended2DVideoAcceleration(BOOL *aRecommended2DVideoAcceleration)
+{
     /* Constant during life time, no need to lock */
     *aRecommended2DVideoAcceleration = !!(mOSHint & VBOXOSHINT_ACCEL2D);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(Recommended3DAcceleration)(BOOL *aRecommended3DAcceleration)
-{
-    CheckComArgOutPointerValid(aRecommended3DAcceleration);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommended3DAcceleration(BOOL *aRecommended3DAcceleration)
+{
     /* Constant during life time, no need to lock */
     *aRecommended3DAcceleration = !!(mOSHint & VBOXOSHINT_ACCEL3D);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedHDD)(LONG64 *aHDDSize)
-{
-    CheckComArgOutPointerValid(aHDDSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedHDD(LONG64 *aHDDSize)
+{
     /* mHDDSize is constant during life time, no need to lock */
     *aHDDSize = mHDDSize;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(AdapterType)(NetworkAdapterType_T *aNetworkAdapterType)
-{
-    CheckComArgOutPointerValid(aNetworkAdapterType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getAdapterType(NetworkAdapterType_T *aNetworkAdapterType)
+{
     /* mNetworkAdapterType is constant during life time, no need to lock */
     *aNetworkAdapterType = mNetworkAdapterType;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedPAE)(BOOL *aRecommendedPAE)
+HRESULT GuestOSType::getRecommendedPAE(BOOL *aRecommendedPAE)
 {
-    CheckComArgOutPointerValid(aRecommendedPAE);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* recommended PAE is constant during life time, no need to lock */
     *aRecommendedPAE = !!(mOSHint & VBOXOSHINT_PAE);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedFirmware)(FirmwareType_T *aFirmwareType)
-{
-    CheckComArgOutPointerValid(aFirmwareType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedFirmware(FirmwareType_T *aFirmwareType)
+{
     /* firmware type is constant during life time, no need to lock */
     if (mOSHint & VBOXOSHINT_EFI)
         *aFirmwareType = FirmwareType_EFI;
@@ -344,159 +280,118 @@ STDMETHODIMP GuestOSType::COMGETTER(RecommendedFirmware)(FirmwareType_T *aFirmwa
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedDVDStorageController)(StorageControllerType_T * aStorageControllerType)
-{
-    CheckComArgOutPointerValid(aStorageControllerType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedDVDStorageController(StorageControllerType_T *aStorageControllerType)
+{
     /* storage controller type is constant during life time, no need to lock */
     *aStorageControllerType = mDVDStorageControllerType;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedDVDStorageBus)(StorageBus_T * aStorageBusType)
-{
-    CheckComArgOutPointerValid(aStorageBusType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedDVDStorageBus(StorageBus_T *aStorageBusType)
+{
     /* storage controller type is constant during life time, no need to lock */
     *aStorageBusType = mDVDStorageBusType;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedHDStorageController)(StorageControllerType_T * aStorageControllerType)
-{
-    CheckComArgOutPointerValid(aStorageControllerType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedHDStorageController(StorageControllerType_T *aStorageControllerType)
+{
     /* storage controller type is constant during life time, no need to lock */
     *aStorageControllerType = mHDStorageControllerType;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedHDStorageBus)(StorageBus_T * aStorageBusType)
-{
-    CheckComArgOutPointerValid(aStorageBusType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedHDStorageBus(StorageBus_T *aStorageBusType)
+{
     /* storage controller type is constant during life time, no need to lock */
     *aStorageBusType = mHDStorageBusType;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedUSBHID)(BOOL *aRecommendedUSBHID)
-{
-    CheckComArgOutPointerValid(aRecommendedUSBHID);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedUSBHID(BOOL *aRecommendedUSBHID)
+{
     /* HID type is constant during life time, no need to lock */
     *aRecommendedUSBHID = !!(mOSHint & VBOXOSHINT_USBHID);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedHPET)(BOOL *aRecommendedHPET)
-{
-    CheckComArgOutPointerValid(aRecommendedHPET);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedHPET(BOOL *aRecommendedHPET)
+{
     /* HPET recommendation is constant during life time, no need to lock */
     *aRecommendedHPET = !!(mOSHint & VBOXOSHINT_HPET);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedUSBTablet)(BOOL *aRecommendedUSBTablet)
-{
-    CheckComArgOutPointerValid(aRecommendedUSBTablet);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedUSBTablet(BOOL *aRecommendedUSBTablet)
+{
     /* HID type is constant during life time, no need to lock */
     *aRecommendedUSBTablet = !!(mOSHint & VBOXOSHINT_USBTABLET);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedRTCUseUTC)(BOOL *aRecommendedRTCUseUTC)
-{
-    CheckComArgOutPointerValid(aRecommendedRTCUseUTC);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedRTCUseUTC(BOOL *aRecommendedRTCUseUTC)
+{
     /* Value is constant during life time, no need to lock */
     *aRecommendedRTCUseUTC = !!(mOSHint & VBOXOSHINT_RTCUTC);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedChipset) (ChipsetType_T *aChipsetType)
-{
-    CheckComArgOutPointerValid(aChipsetType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedChipset(ChipsetType_T *aChipsetType)
+{
     /* chipset type is constant during life time, no need to lock */
     *aChipsetType = mChipsetType;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedAudioController) (AudioControllerType_T *aAudioController)
-{
-    CheckComArgOutPointerValid(aAudioController);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedAudioController(AudioControllerType_T *aAudioController)
+{
     *aAudioController = mAudioControllerType;
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedFloppy)(BOOL *aRecommendedFloppy)
-{
-    CheckComArgOutPointerValid(aRecommendedFloppy);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedFloppy(BOOL *aRecommendedFloppy)
+{
     /* Value is constant during life time, no need to lock */
     *aRecommendedFloppy = !!(mOSHint & VBOXOSHINT_FLOPPY);
 
     return S_OK;
 }
 
-STDMETHODIMP GuestOSType::COMGETTER(RecommendedUSB)(BOOL *aRecommendedUSB)
-{
-    CheckComArgOutPointerValid(aRecommendedUSB);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT GuestOSType::getRecommendedUSB(BOOL *aRecommendedUSB)
+{
     /* Value is constant during life time, no need to lock */
     *aRecommendedUSB = !(mOSHint & VBOXOSHINT_NOUSB);
 
     return S_OK;
 }
 
+HRESULT GuestOSType::getRecommendedTFReset(BOOL *aRecommendedTFReset)
+{
+    /* recommended triple fault behavior is constant during life time, no need to lock */
+    *aRecommendedTFReset = !!(mOSHint & VBOXOSHINT_TFRESET);
+
+    return S_OK;
+}
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-server/HostDnsService.cpp b/src/VBox/Main/src-server/HostDnsService.cpp
index 8a78c1f..eb56bcd 100644
--- a/src/VBox/Main/src-server/HostDnsService.cpp
+++ b/src/VBox/Main/src-server/HostDnsService.cpp
@@ -70,18 +70,12 @@ bool HostDnsInformation::equals(const HostDnsInformation &info, uint32_t fLaxCom
 }
 
 inline static void detachVectorOfString(const std::vector<std::string>& v,
-                                        ComSafeArrayOut(BSTR, aBstrArray))
+                                        std::vector<com::Utf8Str> &aArray)
 {
-    com::SafeArray<BSTR> aBstr(v.size());
-
-    std::vector<std::string>::const_iterator it;
-
-    int i = 0;
-    it = v.begin();
-    for (; it != v.end(); ++it, ++i)
-        Utf8Str(it->c_str()).cloneTo(&aBstr[i]);
-
-    aBstr.detachTo(ComSafeArrayOutArg(aBstrArray));
+    aArray.resize(v.size());
+    size_t i = 0;
+    for (std::vector<std::string>::const_iterator it = v.begin(); it != v.end(); ++it, ++i)
+        aArray[i] = Utf8Str(it->c_str());
 }
 
 struct HostDnsMonitor::Data
@@ -347,10 +341,10 @@ void HostDnsMonitorProxy::notify() const
 {
     LogRel(("HostDnsMonitorProxy::notify\n"));
     m->fModified = true;
-    m->virtualbox->onHostNameResolutionConfigurationChange();
+    m->virtualbox->i_onHostNameResolutionConfigurationChange();
 }
 
-HRESULT HostDnsMonitorProxy::GetNameServers(ComSafeArrayOut(BSTR, aNameServers))
+HRESULT HostDnsMonitorProxy::GetNameServers(std::vector<com::Utf8Str> &aNameServers)
 {
     AssertReturn(m && m->info, E_FAIL);
     RTCLock grab(m_LockMtx);
@@ -361,12 +355,12 @@ HRESULT HostDnsMonitorProxy::GetNameServers(ComSafeArrayOut(BSTR, aNameServers))
     LogRel(("HostDnsMonitorProxy::GetNameServers:\n"));
     dumpHostDnsStrVector("name server", m->info->servers);
 
-    detachVectorOfString(m->info->servers, ComSafeArrayOutArg(aNameServers));
+    detachVectorOfString(m->info->servers, aNameServers);
 
     return S_OK;
 }
 
-HRESULT HostDnsMonitorProxy::GetDomainName(BSTR *aDomainName)
+HRESULT HostDnsMonitorProxy::GetDomainName(com::Utf8Str *pDomainName)
 {
     AssertReturn(m && m->info, E_FAIL);
     RTCLock grab(m_LockMtx);
@@ -377,12 +371,12 @@ HRESULT HostDnsMonitorProxy::GetDomainName(BSTR *aDomainName)
     LogRel(("HostDnsMonitorProxy::GetDomainName: %s\n",
             m->info->domain.empty() ? "no domain set" : m->info->domain.c_str()));
 
-    Utf8Str(m->info->domain.c_str()).cloneTo(aDomainName);
+    *pDomainName = m->info->domain.c_str();
 
     return S_OK;
 }
 
-HRESULT HostDnsMonitorProxy::GetSearchStrings(ComSafeArrayOut(BSTR, aSearchStrings))
+HRESULT HostDnsMonitorProxy::GetSearchStrings(std::vector<com::Utf8Str> &aSearchStrings)
 {
     AssertReturn(m && m->info, E_FAIL);
     RTCLock grab(m_LockMtx);
@@ -393,7 +387,7 @@ HRESULT HostDnsMonitorProxy::GetSearchStrings(ComSafeArrayOut(BSTR, aSearchStrin
     LogRel(("HostDnsMonitorProxy::GetSearchStrings:\n"));
     dumpHostDnsStrVector("search string", m->info->searchList);
 
-    detachVectorOfString(m->info->searchList, ComSafeArrayOutArg(aSearchStrings));
+    detachVectorOfString(m->info->searchList, aSearchStrings);
 
     return S_OK;
 }
diff --git a/src/VBox/Main/src-server/HostDnsService.h b/src/VBox/Main/src-server/HostDnsService.h
index ff4c04b..6531df7 100644
--- a/src/VBox/Main/src-server/HostDnsService.h
+++ b/src/VBox/Main/src-server/HostDnsService.h
@@ -98,9 +98,9 @@ class HostDnsMonitorProxy
     void init(const HostDnsMonitor *aMonitor, VirtualBox *virtualbox);
     void notify() const;
 
-    HRESULT GetNameServers(ComSafeArrayOut(BSTR, aNameServers));
-    HRESULT GetDomainName(BSTR *aDomainName);
-    HRESULT GetSearchStrings(ComSafeArrayOut(BSTR, aSearchStrings));
+    HRESULT GetNameServers(std::vector<com::Utf8Str> &aNameServers);
+    HRESULT GetDomainName(com::Utf8Str *pDomainName);
+    HRESULT GetSearchStrings(std::vector<com::Utf8Str> &aSearchStrings);
 
     bool operator==(PCHostDnsMonitorProxy&);
 
diff --git a/src/VBox/Main/src-server/HostImpl.cpp b/src/VBox/Main/src-server/HostImpl.cpp
index bb473d2..1f9f7bb 100644
--- a/src/VBox/Main/src-server/HostImpl.cpp
+++ b/src/VBox/Main/src-server/HostImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2004-2014 Oracle Corporation
+ * Copyright (C) 2004-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -107,6 +107,8 @@ typedef struct SOLARISDVD
 /** Pointer to a Solaris DVD descriptor. */
 typedef SOLARISDVD *PSOLARISDVD;
 
+
+
 #endif /* RT_OS_SOLARIS */
 
 #ifdef RT_OS_WINDOWS
@@ -128,7 +130,7 @@ typedef SOLARISDVD *PSOLARISDVD;
 #endif
 
 #ifdef VBOX_WITH_CROGL
-#include <VBox/VBoxOGLTest.h>
+#include <VBox/VBoxOGL.h>
 #endif /* VBOX_WITH_CROGL */
 
 #include <iprt/asm-amd64-x86.h>
@@ -212,6 +214,7 @@ struct Host::Data
     /** Object with information about host drives */
     VBoxMainDriveInfo       hostDrives;
 #endif
+
     /** @name Features that can be queried with GetProcessorFeature.
      * @{ */
     bool                    fVTSupported,
@@ -230,11 +233,13 @@ struct Host::Data
     HostDnsMonitorProxy     hostDnsMonitorProxy;
 };
 
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // Constructor / destructor
 //
 ////////////////////////////////////////////////////////////////////////////////
+DEFINE_EMPTY_CTOR_DTOR(Host)
 
 HRESULT Host::FinalConstruct()
 {
@@ -269,17 +274,17 @@ HRESULT Host::init(VirtualBox *aParent)
     /*
      * Create and initialize the USB Proxy Service.
      */
-# if defined (RT_OS_DARWIN)
+# if defined(RT_OS_DARWIN)
     m->pUSBProxyService = new USBProxyServiceDarwin(this);
-# elif defined (RT_OS_LINUX)
+# elif defined(RT_OS_LINUX)
     m->pUSBProxyService = new USBProxyServiceLinux(this);
-# elif defined (RT_OS_OS2)
+# elif defined(RT_OS_OS2)
     m->pUSBProxyService = new USBProxyServiceOs2(this);
-# elif defined (RT_OS_SOLARIS)
+# elif defined(RT_OS_SOLARIS)
     m->pUSBProxyService = new USBProxyServiceSolaris(this);
-# elif defined (RT_OS_WINDOWS)
+# elif defined(RT_OS_WINDOWS)
     m->pUSBProxyService = new USBProxyServiceWindows(this);
-# elif defined (RT_OS_FREEBSD)
+# elif defined(RT_OS_FREEBSD)
     m->pUSBProxyService = new USBProxyServiceFreeBSD(this);
 # else
     m->pUSBProxyService = new USBProxyService(this);
@@ -289,16 +294,18 @@ HRESULT Host::init(VirtualBox *aParent)
 #endif /* VBOX_WITH_USB */
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
-    registerMetrics(aParent->performanceCollector());
+    i_registerMetrics(aParent->i_performanceCollector());
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
     /* Create the list of network interfaces so their metrics get registered. */
-    updateNetIfList();
+    i_updateNetIfList();
 
     m->hostDnsMonitorProxy.init(HostDnsMonitor::getHostDnsMonitor(m->pParent), m->pParent);
 
-#if defined (RT_OS_WINDOWS)
+#if defined(RT_OS_WINDOWS)
     m->pHostPowerService = new HostPowerServiceWin(m->pParent);
-#elif defined (RT_OS_DARWIN)
+#elif defined(RT_OS_LINUX) && defined(VBOX_WITH_DBUS)
+    m->pHostPowerService = new HostPowerServiceLinux(m->pParent);
+#elif defined(RT_OS_DARWIN)
     m->pHostPowerService = new HostPowerServiceDarwin(m->pParent);
 #else
     m->pHostPowerService = new HostPowerService(m->pParent);
@@ -408,7 +415,7 @@ HRESULT Host::init(VirtualBox *aParent)
     m->f3DAccelerationSupported = false;
 #endif
 
-#if defined (RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
+#if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
     /* Extract the list of configured host-only interfaces */
     std::set<Utf8Str> aConfiguredNames;
     SafeArray<BSTR> aGlobalExtraDataKeys;
@@ -442,7 +449,7 @@ HRESULT Host::init(VirtualBox *aParent)
             LogRel(("failed to create %s, error (0x%x)\n", it->c_str(), r));
     }
 
-#endif /* defined (RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) */
+#endif /* defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD) */
 
     /* Confirm a successful initialization */
     autoInitSpan.setSucceeded();
@@ -464,15 +471,22 @@ void Host::uninit()
         return;
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
-    PerformanceCollector *aCollector = m->pParent->performanceCollector();
-    unregisterMetrics (aCollector);
+    PerformanceCollector *aCollector = m->pParent->i_performanceCollector();
+    i_unregisterMetrics(aCollector);
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
     /*
      * Note that unregisterMetrics() has unregistered all metrics associated
      * with Host including network interface ones. We can destroy network
-     * interface objects now.
+     * interface objects now. Don't forget the uninit call, otherwise this
+     * causes a race with crashing API clients getting their stale references
+     * cleaned up and VirtualBox shutting down.
      */
-    m->llNetIfs.clear();
+    while (!m->llNetIfs.empty())
+    {
+        ComObjPtr<HostNetworkInterface> &pNet = m->llNetIfs.front();
+        pNet->uninit();
+        m->llNetIfs.pop_front();
+    }
 
 #ifdef VBOX_WITH_USB
     /* wait for USB proxy service to terminate before we uninit all USB
@@ -487,24 +501,42 @@ void Host::uninit()
 
 #ifdef VBOX_WITH_USB
     /* uninit all USB device filters still referenced by clients
-     * Note! HostUSBDeviceFilter::uninit() will modify llChildren. */
+     * Note! HostUSBDeviceFilter::uninit() will modify llChildren.
+     * This list should be already empty, but better be safe than sorry. */
     while (!m->llChildren.empty())
     {
         ComObjPtr<HostUSBDeviceFilter> &pChild = m->llChildren.front();
-        m->llChildren.pop_front();
         pChild->uninit();
+        m->llChildren.pop_front();
     }
 
+    /* No need to uninit these, as either Machine::uninit() or the above loop
+     * already covered them all. Subset of llChildren. */
     m->llUSBDeviceFilters.clear();
 #endif
 
+    /* uninit all host DVD medium objects */
+    while (!m->llDVDDrives.empty())
+    {
+        ComObjPtr<Medium> &pMedium = m->llDVDDrives.front();
+        pMedium->uninit();
+        m->llDVDDrives.pop_front();
+    }
+    /* uninit all host floppy medium objects */
+    while (!m->llFloppyDrives.empty())
+    {
+        ComObjPtr<Medium> &pMedium = m->llFloppyDrives.front();
+        pMedium->uninit();
+        m->llFloppyDrives.pop_front();
+    }
+
     delete m;
     m = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //
-// ISnapshot public methods
+// IHost public methods
 //
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -514,24 +546,22 @@ void Host::uninit()
  * @returns COM status code
  * @param drives address of result pointer
  */
-STDMETHODIMP Host::COMGETTER(DVDDrives)(ComSafeArrayOut(IMedium *, aDrives))
-{
-    CheckComArgOutSafeArrayPointerValid(aDrives);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    AutoWriteLock treeLock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+HRESULT Host::getDVDDrives(std::vector<ComPtr<IMedium> > &aDVDDrives)
+{
+    AutoWriteLock treeLock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     MediaList *pList;
-    HRESULT rc = getDrives(DeviceType_DVD, true /* fRefresh */, pList, treeLock);
-    if (SUCCEEDED(rc))
-    {
-        SafeIfaceArray<IMedium> array(*pList);
-        array.detachTo(ComSafeArrayOutArg(aDrives));
-    }
+    HRESULT rc = i_getDrives(DeviceType_DVD, true /* fRefresh */, pList, treeLock);
+    if (FAILED(rc))
+        return rc;
 
-    return rc;
+    aDVDDrives.resize(pList->size());
+    size_t i = 0;
+    for (MediaList::const_iterator it = pList->begin(); it != pList->end(); ++it, ++i)
+        (*it).queryInterfaceTo(aDVDDrives[i].asOutParam());
+
+    return S_OK;
 }
 
 /**
@@ -540,24 +570,21 @@ STDMETHODIMP Host::COMGETTER(DVDDrives)(ComSafeArrayOut(IMedium *, aDrives))
  * @returns COM status code
  * @param drives address of result pointer
  */
-STDMETHODIMP Host::COMGETTER(FloppyDrives)(ComSafeArrayOut(IMedium *, aDrives))
+HRESULT Host::getFloppyDrives(std::vector<ComPtr<IMedium> > &aFloppyDrives)
 {
-    CheckComArgOutPointerValid(aDrives);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock treeLock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock treeLock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     MediaList *pList;
-    HRESULT rc = getDrives(DeviceType_Floppy, true /* fRefresh */, pList, treeLock);
-    if (SUCCEEDED(rc))
-    {
-        SafeIfaceArray<IMedium> collection(*pList);
-        collection.detachTo(ComSafeArrayOutArg(aDrives));
-    }
+    HRESULT rc = i_getDrives(DeviceType_Floppy, true /* fRefresh */, pList, treeLock);
+    if (FAILED(rc))
+        return rc;
 
-    return rc;
+    aFloppyDrives.resize(pList->size());
+    size_t i = 0;
+    for (MediaList::const_iterator it = pList->begin(); it != pList->end(); ++it, ++i)
+        (*it).queryInterfaceTo(aFloppyDrives[i].asOutParam());
+
+    return S_OK;
 }
 
 
@@ -567,8 +594,8 @@ STDMETHODIMP Host::COMGETTER(FloppyDrives)(ComSafeArrayOut(IMedium *, aDrives))
 static int vboxNetWinAddComponent(std::list< ComObjPtr<HostNetworkInterface> > *pPist,
                                   INetCfgComponent *pncc)
 {
-    LPWSTR              lpszName;
-    GUID                IfGuid;
+    LPWSTR lpszName;
+    GUID IfGuid;
     HRESULT hr;
     int rc = VERR_GENERAL_FAILURE;
 
@@ -586,7 +613,7 @@ static int vboxNetWinAddComponent(std::list< ComObjPtr<HostNetworkInterface> > *
             ComObjPtr<HostNetworkInterface> iface;
             iface.createObject();
             /* remove the curly bracket at the end */
-            if (SUCCEEDED(iface->init (name, name, Guid (IfGuid), HostNetworkInterfaceType_Bridged)))
+            if (SUCCEEDED(iface->init(name, name, Guid(IfGuid), HostNetworkInterfaceType_Bridged)))
             {
 //                iface->setVirtualBox(m->pParent);
                 pPist->push_back(iface);
@@ -610,28 +637,25 @@ static int vboxNetWinAddComponent(std::list< ComObjPtr<HostNetworkInterface> > *
  * @returns COM status code
  * @param drives address of result pointer
  */
-STDMETHODIMP Host::COMGETTER(NetworkInterfaces)(ComSafeArrayOut(IHostNetworkInterface*, aNetworkInterfaces))
+HRESULT Host::getNetworkInterfaces(std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces)
 {
-#if defined(RT_OS_WINDOWS) ||  defined(VBOX_WITH_NETFLT) /*|| defined(RT_OS_OS2)*/
-    if (ComSafeArrayOutIsNull(aNetworkInterfaces))
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+#if defined(RT_OS_WINDOWS) || defined(VBOX_WITH_NETFLT) /*|| defined(RT_OS_OS2)*/
 # ifdef VBOX_WITH_HOSTNETIF_API
-    int rc = updateNetIfList();
-    if (rc)
+    HRESULT rc = i_updateNetIfList();
+    if (FAILED(rc))
     {
-        Log(("Failed to get host network interface list with rc=%Rrc\n", rc));
+        Log(("Failed to update host network interface list with rc=%Rhrc\n", rc));
+        return rc;
     }
 
-    SafeIfaceArray<IHostNetworkInterface> networkInterfaces (m->llNetIfs);
-    networkInterfaces.detachTo(ComSafeArrayOutArg(aNetworkInterfaces));
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    return S_OK;
+    aNetworkInterfaces.resize(m->llNetIfs.size());
+    size_t i = 0;
+    for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aNetworkInterfaces[i].asOutParam());
 
+    return S_OK;
 # else
     std::list<ComObjPtr<HostNetworkInterface> > list;
 
@@ -676,8 +700,13 @@ STDMETHODIMP Host::COMGETTER(NetworkInterfaces)(ComSafeArrayOut(IHostNetworkInte
         /* for the protocol-based approach for now we just get all miniports the MS_TCPIP protocol binds to */
         hr = pNc->FindComponent(L"MS_TCPIP", &pTcpIpNcc);
 #    else
-        /* for the filter-based approach we get all miniports our filter (sun_VBoxNetFlt)is bound to */
-        hr = pNc->FindComponent(L"sun_VBoxNetFlt", &pTcpIpNcc);
+        /* for the filter-based approach we get all miniports our filter (oracle_VBoxNetLwf)is bound to */
+        hr = pNc->FindComponent(L"oracle_VBoxNetLwf", &pTcpIpNcc);
+        if (hr != S_OK)
+        {
+            /* fall back to NDIS5 miniport lookup (sun_VBoxNetFlt) */
+            hr = pNc->FindComponent(L"sun_VBoxNetFlt", &pTcpIpNcc);
+        }
 #     ifndef VBOX_WITH_HARDENING
         if (hr != S_OK)
         {
@@ -741,7 +770,7 @@ STDMETHODIMP Host::COMGETTER(NetworkInterfaces)(ComSafeArrayOut(IHostNetworkInte
         }
         else
         {
-            LogRel(("failed to get the sun_VBoxNetFlt component, error (0x%x)\n", hr));
+            LogRel(("failed to get the oracle_VBoxNetLwf(sun_VBoxNetFlt) component, error (0x%x)\n", hr));
         }
 
         VBoxNetCfgWinReleaseINetCfg(pNc, FALSE);
@@ -781,11 +810,12 @@ STDMETHODIMP Host::COMGETTER(NetworkInterfaces)(ComSafeArrayOut(IHostNetworkInte
     }
 #  endif /* RT_OS_LINUX */
 
-    SafeIfaceArray<IHostNetworkInterface> networkInterfaces (list);
-    networkInterfaces.detachTo(ComSafeArrayOutArg(aNetworkInterfaces));
+    aNetworkInterfaces.resize(list.size());
+    size_t i = 0;
+    for (std::list<ComObjPtr<HostNetworkInterface> >::const_iterator it = list.begin(); it != list.end(); ++it, ++i)
+        aNetworkInterfaces[i] = *it;
 
     return S_OK;
-
 # endif
 #else
     /* Not implemented / supported on this platform. */
@@ -793,96 +823,71 @@ STDMETHODIMP Host::COMGETTER(NetworkInterfaces)(ComSafeArrayOut(IHostNetworkInte
 #endif
 }
 
-STDMETHODIMP Host::COMGETTER(USBDevices)(ComSafeArrayOut(IHostUSBDevice*, aUSBDevices))
+HRESULT Host::getUSBDevices(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgOutSafeArrayPointerValid(aUSBDevices);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkUSBProxyService();
-    if (FAILED(rc)) return rc;
-
-    return m->pUSBProxyService->getDeviceCollection(ComSafeArrayOutArg(aUSBDevices));
+    MultiResult rc = i_checkUSBProxyService();
+    if (FAILED(rc))
+        return rc;
 
+    return m->pUSBProxyService->getDeviceCollection(aUSBDevices);
 #else
     /* Note: The GUI depends on this method returning E_NOTIMPL with no
      * extended error info to indicate that USB is simply not available
      * (w/o treating it as a failure), for example, as in OSE. */
     NOREF(aUSBDevices);
 # ifndef RT_OS_WINDOWS
-    NOREF(aUSBDevicesSize);
+    NOREF(aUSBDevices);
 # endif
     ReturnComNotImplemented();
 #endif
 }
 
-
 /**
  * This method return the list of registered name servers
  */
-STDMETHODIMP Host::COMGETTER(NameServers)(ComSafeArrayOut(BSTR, aNameServers))
+HRESULT Host::getNameServers(std::vector<com::Utf8Str> &aNameServers)
 {
-    CheckComArgOutSafeArrayPointerValid(aNameServers);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    return m->hostDnsMonitorProxy.GetNameServers(ComSafeArrayOutArg(aNameServers));
+    return m->hostDnsMonitorProxy.GetNameServers(aNameServers);
 }
 
 
 /**
  * This method returns the domain name of the host
  */
-STDMETHODIMP Host::COMGETTER(DomainName)(BSTR *aDomainName)
+HRESULT Host::getDomainName(com::Utf8Str &aDomainName)
 {
     /* XXX: note here should be synchronization with thread polling state
      * changes in name resoving system on host */
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    return m->hostDnsMonitorProxy.GetDomainName(aDomainName);
+    return m->hostDnsMonitorProxy.GetDomainName(&aDomainName);
 }
 
 
 /**
  * This method returns the search string.
  */
-STDMETHODIMP Host::COMGETTER(SearchStrings)(ComSafeArrayOut(BSTR, aSearchStrings))
+HRESULT Host::getSearchStrings(std::vector<com::Utf8Str> &aSearchStrings)
 {
-    CheckComArgOutSafeArrayPointerValid(aSearchStrings);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    return m->hostDnsMonitorProxy.GetSearchStrings(ComSafeArrayOutArg(aSearchStrings));
+    return m->hostDnsMonitorProxy.GetSearchStrings(aSearchStrings);
 }
 
-
-STDMETHODIMP Host::COMGETTER(USBDeviceFilters)(ComSafeArrayOut(IHostUSBDeviceFilter*, aUSBDeviceFilters))
+HRESULT Host::getUSBDeviceFilters(std::vector<ComPtr<IHostUSBDeviceFilter> > &aUSBDeviceFilters)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgOutSafeArrayPointerValid(aUSBDeviceFilters);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkUSBProxyService();
-    if (FAILED(rc)) return rc;
+    MultiResult rc = i_checkUSBProxyService();
+    if (FAILED(rc))
+        return rc;
 
-    SafeIfaceArray<IHostUSBDeviceFilter> collection(m->llUSBDeviceFilters);
-    collection.detachTo(ComSafeArrayOutArg(aUSBDeviceFilters));
+    aUSBDeviceFilters.resize(m->llUSBDeviceFilters.size());
+    size_t i = 0;
+    for (USBDeviceFilterList::iterator it = m->llUSBDeviceFilters.begin(); it != m->llUSBDeviceFilters.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aUSBDeviceFilters[i].asOutParam());
 
     return rc;
 #else
@@ -891,7 +896,7 @@ STDMETHODIMP Host::COMGETTER(USBDeviceFilters)(ComSafeArrayOut(IHostUSBDeviceFil
      * (w/o treating it as a failure), for example, as in OSE. */
     NOREF(aUSBDeviceFilters);
 # ifndef RT_OS_WINDOWS
-    NOREF(aUSBDeviceFiltersSize);
+    NOREF(aUSBDeviceFilters);
 # endif
     ReturnComNotImplemented();
 #endif
@@ -903,9 +908,9 @@ STDMETHODIMP Host::COMGETTER(USBDeviceFilters)(ComSafeArrayOut(IHostUSBDeviceFil
  * @returns COM status code
  * @param   count address of result variable
  */
-STDMETHODIMP Host::COMGETTER(ProcessorCount)(ULONG *aCount)
+
+HRESULT Host::getProcessorCount(ULONG *aCount)
 {
-    CheckComArgOutPointerValid(aCount);
     // no locking required
 
     *aCount = RTMpGetPresentCount();
@@ -918,9 +923,8 @@ STDMETHODIMP Host::COMGETTER(ProcessorCount)(ULONG *aCount)
  * @returns COM status code
  * @param   count address of result variable
  */
-STDMETHODIMP Host::COMGETTER(ProcessorOnlineCount)(ULONG *aCount)
+HRESULT Host::getProcessorOnlineCount(ULONG *aCount)
 {
-    CheckComArgOutPointerValid(aCount);
     // no locking required
 
     *aCount = RTMpGetOnlineCount();
@@ -933,9 +937,8 @@ STDMETHODIMP Host::COMGETTER(ProcessorOnlineCount)(ULONG *aCount)
  * @returns COM status code
  * @param   count address of result variable
  */
-STDMETHODIMP Host::COMGETTER(ProcessorCoreCount)(ULONG *aCount)
+HRESULT Host::getProcessorCoreCount(ULONG *aCount)
 {
-    CheckComArgOutPointerValid(aCount);
     // no locking required
 
     *aCount = RTMpGetPresentCoreCount();
@@ -948,9 +951,8 @@ STDMETHODIMP Host::COMGETTER(ProcessorCoreCount)(ULONG *aCount)
  * @returns COM status code
  * @param   count address of result variable
  */
-STDMETHODIMP Host::COMGETTER(ProcessorOnlineCoreCount)(ULONG *aCount)
+HRESULT Host::getProcessorOnlineCoreCount(ULONG *aCount)
 {
-    CheckComArgOutPointerValid(aCount);
     // no locking required
 
     *aCount = RTMpGetOnlineCoreCount();
@@ -964,9 +966,9 @@ STDMETHODIMP Host::COMGETTER(ProcessorOnlineCoreCount)(ULONG *aCount)
  * @param   cpu id to get info for.
  * @param   speed address of result variable, speed is 0 if unknown or aCpuId is invalid.
  */
-STDMETHODIMP Host::GetProcessorSpeed(ULONG aCpuId, ULONG *aSpeed)
+HRESULT Host::getProcessorSpeed(ULONG aCpuId,
+                                ULONG *aSpeed)
 {
-    CheckComArgOutPointerValid(aSpeed);
     // no locking required
 
     *aSpeed = RTMpGetMaxFrequency(aCpuId);
@@ -980,16 +982,18 @@ STDMETHODIMP Host::GetProcessorSpeed(ULONG aCpuId, ULONG *aSpeed)
  * @param   cpu id to get info for.
  * @param   description address of result variable, empty string if not known or aCpuId is invalid.
  */
-STDMETHODIMP Host::GetProcessorDescription(ULONG aCpuId, BSTR *aDescription)
+HRESULT Host::getProcessorDescription(ULONG aCpuId, com::Utf8Str &aDescription)
 {
-    CheckComArgOutPointerValid(aDescription);
     // no locking required
 
     char szCPUModel[80];
+    szCPUModel[0] = 0;
     int vrc = RTMpGetDescription(aCpuId, szCPUModel, sizeof(szCPUModel));
     if (RT_FAILURE(vrc))
         return E_FAIL; /** @todo error reporting? */
-    Bstr (szCPUModel).cloneTo(aDescription);
+
+    aDescription = Utf8Str(szCPUModel);
+
     return S_OK;
 }
 
@@ -1000,10 +1004,9 @@ STDMETHODIMP Host::GetProcessorDescription(ULONG aCpuId, BSTR *aDescription)
  * @param   Feature to query.
  * @param   address of supported bool result variable
  */
-STDMETHODIMP Host::GetProcessorFeature(ProcessorFeature_T aFeature, BOOL *aSupported)
+HRESULT Host::getProcessorFeature(ProcessorFeature_T aFeature, BOOL *aSupported)
 {
     /* Validate input. */
-    CheckComArgOutPointerValid(aSupported);
     switch (aFeature)
     {
         case ProcessorFeature_HWVirtEx:
@@ -1092,13 +1095,9 @@ STDMETHODIMP Host::GetProcessorFeature(ProcessorFeature_T aFeature, BOOL *aSuppo
  * @param   aValECX             Where to return ECX.
  * @param   aValEDX             Where to return EDX.
  */
-STDMETHODIMP Host::GetProcessorCPUIDLeaf(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf,
-                                         ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX)
+HRESULT Host::getProcessorCPUIDLeaf(ULONG aCpuId, ULONG aLeaf, ULONG aSubLeaf,
+                                    ULONG *aValEAX, ULONG *aValEBX, ULONG *aValECX, ULONG *aValEDX)
 {
-    CheckComArgOutPointerValid(aValEAX);
-    CheckComArgOutPointerValid(aValEBX);
-    CheckComArgOutPointerValid(aValECX);
-    CheckComArgOutPointerValid(aValEDX);
     // no locking required
 
     /* Check that the CPU is online. */
@@ -1124,9 +1123,8 @@ STDMETHODIMP Host::GetProcessorCPUIDLeaf(ULONG aCpuId, ULONG aLeaf, ULONG aSubLe
  * @returns COM status code
  * @param   size address of result variable
  */
-STDMETHODIMP Host::COMGETTER(MemorySize)(ULONG *aSize)
+HRESULT Host::getMemorySize(ULONG *aSize)
 {
-    CheckComArgOutPointerValid(aSize);
     // no locking required
 
     uint64_t cb;
@@ -1143,9 +1141,8 @@ STDMETHODIMP Host::COMGETTER(MemorySize)(ULONG *aSize)
  * @returns COM status code
  * @param   available address of result variable
  */
-STDMETHODIMP Host::COMGETTER(MemoryAvailable)(ULONG *aAvailable)
+HRESULT Host::getMemoryAvailable(ULONG *aAvailable)
 {
-    CheckComArgOutPointerValid(aAvailable);
     // no locking required
 
     uint64_t cb;
@@ -1162,16 +1159,15 @@ STDMETHODIMP Host::COMGETTER(MemoryAvailable)(ULONG *aAvailable)
  * @returns COM status code
  * @param   os address of result variable
  */
-STDMETHODIMP Host::COMGETTER(OperatingSystem)(BSTR *aOs)
+HRESULT Host::getOperatingSystem(com::Utf8Str &aOperatingSystem)
 {
-    CheckComArgOutPointerValid(aOs);
     // no locking required
 
     char szOSName[80];
     int vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szOSName, sizeof(szOSName));
     if (RT_FAILURE(vrc))
         return E_FAIL; /** @todo error reporting? */
-    Bstr (szOSName).cloneTo(aOs);
+    aOperatingSystem = Utf8Str(szOSName);
     return S_OK;
 }
 
@@ -1181,9 +1177,8 @@ STDMETHODIMP Host::COMGETTER(OperatingSystem)(BSTR *aOs)
  * @returns COM status code
  * @param   os address of result variable
  */
-STDMETHODIMP Host::COMGETTER(OSVersion)(BSTR *aVersion)
+HRESULT Host::getOSVersion(com::Utf8Str &aVersion)
 {
-    CheckComArgOutPointerValid(aVersion);
     // no locking required
 
     /* Get the OS release. Reserve some buffer space for the service pack. */
@@ -1207,7 +1202,7 @@ STDMETHODIMP Host::COMGETTER(OSVersion)(BSTR *aVersion)
         RTStrPrintf(psz, &szOSRelease[sizeof(szOSRelease)] - psz, "sp%s", szOSServicePack);
     }
 
-    Bstr(szOSRelease).cloneTo(aVersion);
+    aVersion = szOSRelease;
     return S_OK;
 }
 
@@ -1217,9 +1212,8 @@ STDMETHODIMP Host::COMGETTER(OSVersion)(BSTR *aVersion)
  * @returns COM status code
  * @param   time address of result variable
  */
-STDMETHODIMP Host::COMGETTER(UTCTime)(LONG64 *aUTCTime)
+HRESULT Host::getUTCTime(LONG64 *aUTCTime)
 {
-    CheckComArgOutPointerValid(aUTCTime);
     // no locking required
 
     RTTIMESPEC now;
@@ -1228,30 +1222,27 @@ STDMETHODIMP Host::COMGETTER(UTCTime)(LONG64 *aUTCTime)
     return S_OK;
 }
 
-STDMETHODIMP Host::COMGETTER(Acceleration3DAvailable)(BOOL *aSupported)
+
+HRESULT Host::getAcceleration3DAvailable(BOOL *aSupported)
 {
-    CheckComArgOutPointerValid(aSupported);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    HRESULT hrc = S_OK;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    if (m->f3DAccelerationSupported != -1)
+        *aSupported = m->f3DAccelerationSupported;
+    else
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        if (m->f3DAccelerationSupported != -1)
-            *aSupported = m->f3DAccelerationSupported;
-        else
-        {
-            alock.release();
+        alock.release();
+
 #ifdef VBOX_WITH_CROGL
-            bool fSupported = VBoxOglIs3DAccelerationSupported();
+        bool fSupported = VBoxOglIs3DAccelerationSupported();
 #else
-            bool fSupported = false; /* shoudn't get here, but just in case. */
+        bool fSupported = false; /* shoudn't get here, but just in case. */
 #endif
-            AutoWriteLock alock2(this COMMA_LOCKVAL_SRC_POS);
-            m->f3DAccelerationSupported = fSupported;
-            alock2.release();
+        AutoWriteLock alock2(this COMMA_LOCKVAL_SRC_POS);
 
-            *aSupported = fSupported;
-        }
+        m->f3DAccelerationSupported = fSupported;
+        alock2.release();
+        *aSupported = fSupported;
     }
 
 #ifdef DEBUG_misha
@@ -1261,34 +1252,29 @@ STDMETHODIMP Host::COMGETTER(Acceleration3DAvailable)(BOOL *aSupported)
     return hrc;
 }
 
-STDMETHODIMP Host::CreateHostOnlyNetworkInterface(IHostNetworkInterface **aHostNetworkInterface,
-                                                  IProgress **aProgress)
-{
-    CheckComArgOutPointerValid(aHostNetworkInterface);
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT Host::createHostOnlyNetworkInterface(ComPtr<IHostNetworkInterface> &aHostInterface,
+                                             ComPtr<IProgress> &aProgress)
 
+{
 #ifdef VBOX_WITH_HOSTNETIF_API
     /* No need to lock anything. If there ever will - watch out, the function
      * called below grabs the VirtualBox lock. */
 
-    int r = NetIfCreateHostOnlyNetworkInterface(m->pParent, aHostNetworkInterface, aProgress);
+    int r = NetIfCreateHostOnlyNetworkInterface(m->pParent, aHostInterface.asOutParam(), aProgress.asOutParam());
     if (RT_SUCCESS(r))
     {
-        if (!*aHostNetworkInterface)
+        if (aHostInterface.isNull())
             return setError(E_FAIL,
                             tr("Unable to create a host network interface"));
 
 #if !defined(RT_OS_WINDOWS)
         Bstr tmpAddr, tmpMask, tmpName;
         HRESULT hrc;
-        hrc = (*aHostNetworkInterface)->COMGETTER(Name)(tmpName.asOutParam());
+        hrc = aHostInterface->COMGETTER(Name)(tmpName.asOutParam());
         ComAssertComRCRet(hrc, hrc);
-        hrc = (*aHostNetworkInterface)->COMGETTER(IPAddress)(tmpAddr.asOutParam());
+        hrc = aHostInterface->COMGETTER(IPAddress)(tmpAddr.asOutParam());
         ComAssertComRCRet(hrc, hrc);
-        hrc = (*aHostNetworkInterface)->COMGETTER(NetworkMask)(tmpMask.asOutParam());
+        hrc = aHostInterface->COMGETTER(NetworkMask)(tmpMask.asOutParam());
         ComAssertComRCRet(hrc, hrc);
         /*
          * We need to write the default IP address and mask to extra data now,
@@ -1299,12 +1285,12 @@ STDMETHODIMP Host::CreateHostOnlyNetworkInterface(IHostNetworkInterface **aHostN
          */
         hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress",
                                                tmpName.raw()).raw(),
-                                       tmpAddr.raw());
+                                               tmpAddr.raw());
         ComAssertComRCRet(hrc, hrc);
 
         hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask",
                                                tmpName.raw()).raw(),
-                                       tmpMask.raw());
+                                               tmpMask.raw());
         ComAssertComRCRet(hrc, hrc);
 #endif
     }
@@ -1315,14 +1301,10 @@ STDMETHODIMP Host::CreateHostOnlyNetworkInterface(IHostNetworkInterface **aHostN
 #endif
 }
 
-STDMETHODIMP Host::RemoveHostOnlyNetworkInterface(IN_BSTR aId,
-                                                  IProgress **aProgress)
-{
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT Host::removeHostOnlyNetworkInterface(const com::Guid &aId,
+                                             ComPtr<IProgress> &aProgress)
 
+{
 #ifdef VBOX_WITH_HOSTNETIF_API
     /* No need to lock anything, the code below does not touch the state
      * of the host object. If that ever changes then check for lock order
@@ -1334,16 +1316,16 @@ STDMETHODIMP Host::RemoveHostOnlyNetworkInterface(IN_BSTR aId,
     /* first check whether an interface with the given name already exists */
     {
         ComPtr<IHostNetworkInterface> iface;
-        if (FAILED(FindHostNetworkInterfaceById(aId,
-                                                iface.asOutParam())))
+        rc = findHostNetworkInterfaceById(aId, iface);
+        if (FAILED(rc))
             return setError(VBOX_E_OBJECT_NOT_FOUND,
                             tr("Host network interface with UUID {%RTuuid} does not exist"),
-                            Guid (aId).raw());
+                            Guid(aId).raw());
         rc = iface->COMGETTER(Name)(name.asOutParam());
         ComAssertComRCRet(rc, rc);
     }
 
-    int r = NetIfRemoveHostOnlyNetworkInterface(m->pParent, Guid(aId).ref(), aProgress);
+    int r = NetIfRemoveHostOnlyNetworkInterface(m->pParent, Guid(aId).ref(), aProgress.asOutParam());
     if (RT_SUCCESS(r))
     {
         /* Drop configuration parameters for removed interface */
@@ -1361,23 +1343,18 @@ STDMETHODIMP Host::RemoveHostOnlyNetworkInterface(IN_BSTR aId,
 #endif
 }
 
-STDMETHODIMP Host::CreateUSBDeviceFilter(IN_BSTR aName,
-                                         IHostUSBDeviceFilter **aFilter)
+HRESULT Host::createUSBDeviceFilter(const com::Utf8Str &aName,
+                                    ComPtr<IHostUSBDeviceFilter> &aFilter)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgOutPointerValid(aFilter);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<HostUSBDeviceFilter> filter;
     filter.createObject();
-    HRESULT rc = filter->init(this, aName);
+    HRESULT rc = filter->init(this, Bstr(aName).raw());
     ComAssertComRCRet(rc, rc);
-    rc = filter.queryInterfaceTo(aFilter);
+    rc = filter.queryInterfaceTo(aFilter.asOutParam());
     AssertComRCReturn(rc, rc);
     return S_OK;
 #else
@@ -1390,21 +1367,17 @@ STDMETHODIMP Host::CreateUSBDeviceFilter(IN_BSTR aName,
 #endif
 }
 
-STDMETHODIMP Host::InsertUSBDeviceFilter(ULONG aPosition,
-                                         IHostUSBDeviceFilter *aFilter)
+HRESULT Host::insertUSBDeviceFilter(ULONG aPosition,
+                                    const ComPtr<IHostUSBDeviceFilter> &aFilter)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgNotNull(aFilter);
-
     /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    clearError();
-    MultiResult rc = checkUSBProxyService();
-    if (FAILED(rc)) return rc;
+    MultiResult rc = i_checkUSBProxyService();
+    if (FAILED(rc))
+        return rc;
 
     ComObjPtr<HostUSBDeviceFilter> pFilter;
     for (USBDeviceFilterList::iterator it = m->llChildren.begin();
@@ -1434,17 +1407,18 @@ STDMETHODIMP Host::InsertUSBDeviceFilter(ULONG aPosition,
 
     /* notify the proxy (only when the filter is active) */
     if (    m->pUSBProxyService->isActive()
-         && pFilter->getData().mActive)
+         && pFilter->i_getData().mActive)
     {
-        ComAssertRet(pFilter->getId() == NULL, E_FAIL);
-        pFilter->getId() = m->pUSBProxyService->insertFilter(&pFilter->getData().mUSBFilter);
+        ComAssertRet(pFilter->i_getId() == NULL, E_FAIL);
+        pFilter->i_getId() = m->pUSBProxyService->insertFilter(&pFilter->i_getData().mUSBFilter);
     }
 
     // save the global settings; for that we should hold only the VirtualBox lock
     alock.release();
     AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS);
-    return rc = m->pParent->saveSettings();
+    return rc = m->pParent->i_saveSettings();
 #else
+
     /* Note: The GUI depends on this method returning E_NOTIMPL with no
      * extended error info to indicate that USB is simply not available
      * (w/o treating it as a failure), for example, as in OSE. */
@@ -1454,19 +1428,16 @@ STDMETHODIMP Host::InsertUSBDeviceFilter(ULONG aPosition,
 #endif
 }
 
-STDMETHODIMP Host::RemoveUSBDeviceFilter(ULONG aPosition)
+HRESULT Host::removeUSBDeviceFilter(ULONG aPosition)
 {
 #ifdef VBOX_WITH_USB
 
     /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    clearError();
-    MultiResult rc = checkUSBProxyService();
-    if (FAILED(rc)) return rc;
+    MultiResult rc = i_checkUSBProxyService();
+    if (FAILED(rc))
+        return rc;
 
     if (!m->llUSBDeviceFilters.size())
         return setError(E_INVALIDARG,
@@ -1481,7 +1452,7 @@ STDMETHODIMP Host::RemoveUSBDeviceFilter(ULONG aPosition)
     {
         /* iterate to the position... */
         USBDeviceFilterList::iterator it = m->llUSBDeviceFilters.begin();
-        std::advance (it, aPosition);
+        std::advance(it, aPosition);
         /* ...get an element from there... */
         filter = *it;
         /* ...and remove */
@@ -1490,17 +1461,17 @@ STDMETHODIMP Host::RemoveUSBDeviceFilter(ULONG aPosition)
     }
 
     /* notify the proxy (only when the filter is active) */
-    if (m->pUSBProxyService->isActive() && filter->getData().mActive)
+    if (m->pUSBProxyService->isActive() && filter->i_getData().mActive)
     {
-        ComAssertRet(filter->getId() != NULL, E_FAIL);
-        m->pUSBProxyService->removeFilter(filter->getId());
-        filter->getId() = NULL;
+        ComAssertRet(filter->i_getId() != NULL, E_FAIL);
+        m->pUSBProxyService->removeFilter(filter->i_getId());
+        filter->i_getId() = NULL;
     }
 
     // save the global settings; for that we should hold only the VirtualBox lock
     alock.release();
     AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS);
-    return rc = m->pParent->saveSettings();
+    return rc = m->pParent->i_saveSettings();
 #else
     /* Note: The GUI depends on this method returning E_NOTIMPL with no
      * extended error info to indicate that USB is simply not available
@@ -1510,60 +1481,55 @@ STDMETHODIMP Host::RemoveUSBDeviceFilter(ULONG aPosition)
 #endif
 }
 
-STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IMedium **aDrive)
+HRESULT Host::findHostDVDDrive(const com::Utf8Str &aName,
+                               ComPtr<IMedium> &aDrive)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgOutPointerValid(aDrive);
-
-    ComObjPtr<Medium>medium;
-    HRESULT rc = findHostDriveByNameOrId(DeviceType_DVD, Utf8Str(aName), medium);
+    ComObjPtr<Medium> medium;
+    HRESULT rc = i_findHostDriveByNameOrId(DeviceType_DVD, aName, medium);
     if (SUCCEEDED(rc))
-        return medium.queryInterfaceTo(aDrive);
+        rc = medium.queryInterfaceTo(aDrive.asOutParam());
     else
-        return setError(rc, Medium::tr("The host DVD drive named '%ls' could not be found"), aName);
+        rc = setError(rc, Medium::tr("The host DVD drive named '%s' could not be found"), aName.c_str());
+    return rc;
 }
 
-STDMETHODIMP Host::FindHostFloppyDrive(IN_BSTR aName, IMedium **aDrive)
+HRESULT Host::findHostFloppyDrive(const com::Utf8Str &aName, ComPtr<IMedium> &aDrive)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgOutPointerValid(aDrive);
-
-    *aDrive = NULL;
+    aDrive = NULL;
 
     ComObjPtr<Medium>medium;
-    HRESULT rc = findHostDriveByNameOrId(DeviceType_Floppy, Utf8Str(aName), medium);
+
+    HRESULT rc = i_findHostDriveByNameOrId(DeviceType_Floppy, aName, medium);
     if (SUCCEEDED(rc))
-        return medium.queryInterfaceTo(aDrive);
+        return medium.queryInterfaceTo(aDrive.asOutParam());
     else
-        return setError(rc, Medium::tr("The host floppy drive named '%ls' could not be found"), aName);
+        return setError(rc, Medium::tr("The host floppy drive named '%s' could not be found"), aName.c_str());
 }
 
-STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR name, IHostNetworkInterface **networkInterface)
+HRESULT Host::findHostNetworkInterfaceByName(const com::Utf8Str &aName,
+                                             ComPtr<IHostNetworkInterface> &aNetworkInterface)
 {
 #ifndef VBOX_WITH_HOSTNETIF_API
     return E_NOTIMPL;
 #else
-    if (!name)
+    if (!aName.length())
         return E_INVALIDARG;
-    if (!networkInterface)
-        return E_POINTER;
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *networkInterface = NULL;
-    ComObjPtr<HostNetworkInterface> found;
-    int rc = updateNetIfList();
-    if (RT_FAILURE(rc))
+    HRESULT rc = i_updateNetIfList();
+    if (FAILED(rc))
     {
-        Log(("Failed to get host network interface list with rc=%Rrc\n", rc));
-        return E_FAIL;
+        Log(("Failed to update host network interface list with rc=%Rhrc\n", rc));
+        return rc;
     }
-    HostNetworkInterfaceList::iterator it;
-    for (it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    ComObjPtr<HostNetworkInterface> found;
+    for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
     {
         Bstr n;
-        (*it)->COMGETTER(Name) (n.asOutParam());
-        if (n == name)
+        (*it)->COMGETTER(Name)(n.asOutParam());
+        if (n == aName)
             found = *it;
     }
 
@@ -1571,73 +1537,75 @@ STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR name, IHostNetworkInte
         return setError(E_INVALIDARG,
                         HostNetworkInterface::tr("The host network interface with the given name could not be found"));
 
-    return found.queryInterfaceTo(networkInterface);
+    return found.queryInterfaceTo(aNetworkInterface.asOutParam());
 #endif
 }
 
-STDMETHODIMP Host::FindHostNetworkInterfaceById(IN_BSTR id, IHostNetworkInterface **networkInterface)
+HRESULT Host::findHostNetworkInterfaceById(const com::Guid &aId,
+                                           ComPtr<IHostNetworkInterface> &aNetworkInterface)
 {
 #ifndef VBOX_WITH_HOSTNETIF_API
     return E_NOTIMPL;
 #else
-    if (!Guid(id).isValid())
+    if (!aId.isValid())
         return E_INVALIDARG;
-    if (!networkInterface)
-        return E_POINTER;
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *networkInterface = NULL;
-    ComObjPtr<HostNetworkInterface> found;
-    int rc = updateNetIfList();
-    if (RT_FAILURE(rc))
+    HRESULT rc = i_updateNetIfList();
+    if (FAILED(rc))
     {
-        Log(("Failed to get host network interface list with rc=%Rrc\n", rc));
-        return E_FAIL;
+        Log(("Failed to update host network interface list with rc=%Rhrc\n", rc));
+        return rc;
     }
-    HostNetworkInterfaceList::iterator it;
-    for (it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    ComObjPtr<HostNetworkInterface> found;
+    for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
     {
         Bstr g;
-        (*it)->COMGETTER(Id) (g.asOutParam());
-        if (g == id)
+        (*it)->COMGETTER(Id)(g.asOutParam());
+        if (Guid(g) == aId)
             found = *it;
     }
 
     if (!found)
         return setError(E_INVALIDARG,
                         HostNetworkInterface::tr("The host network interface with the given GUID could not be found"));
+    return found.queryInterfaceTo(aNetworkInterface.asOutParam());
 
-    return found.queryInterfaceTo(networkInterface);
 #endif
 }
 
-STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_T type,
-                                                   ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces))
+HRESULT Host::findHostNetworkInterfacesOfType(HostNetworkInterfaceType_T aType,
+                                              std::vector<ComPtr<IHostNetworkInterface> > &aNetworkInterfaces)
 {
 #ifdef VBOX_WITH_HOSTNETIF_API
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT rc = i_updateNetIfList();
+    if (FAILED(rc))
+    {
+        Log(("Failed to update host network interface list with rc=%Rhrc\n", rc));
+        return rc;
+    }
 
-    int rc = updateNetIfList();
-    if (RT_FAILURE(rc))
-        return E_FAIL;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HostNetworkInterfaceList resultList;
-
-    HostNetworkInterfaceList::iterator it;
-    for (it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
+    for (HostNetworkInterfaceList::iterator it = m->llNetIfs.begin(); it != m->llNetIfs.end(); ++it)
     {
         HostNetworkInterfaceType_T t;
         HRESULT hr = (*it)->COMGETTER(InterfaceType)(&t);
         if (FAILED(hr))
             return hr;
 
-        if (t == type)
-            resultList.push_back (*it);
+        if (t == aType)
+            resultList.push_back(*it);
+    }
+    aNetworkInterfaces.resize(resultList.size());
+    size_t i = 0;
+    for (HostNetworkInterfaceList::iterator it = resultList.begin(); it != resultList.end(); ++it, ++i)
+    {
+        (*it).queryInterfaceTo(aNetworkInterfaces[i].asOutParam());
     }
-
-    SafeIfaceArray<IHostNetworkInterface> filteredNetworkInterfaces (resultList);
-    filteredNetworkInterfaces.detachTo(ComSafeArrayOutArg(aNetworkInterfaces));
 
     return S_OK;
 #else
@@ -1645,33 +1613,32 @@ STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_T ty
 #endif
 }
 
-STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress,
-                                          IHostUSBDevice **aDevice)
+HRESULT Host::findUSBDeviceByAddress(const com::Utf8Str &aName,
+                                     ComPtr<IHostUSBDevice> &aDevice)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgStrNotEmptyOrNull(aAddress);
-    CheckComArgOutPointerValid(aDevice);
-
-    *aDevice = NULL;
 
+    aDevice = NULL;
     SafeIfaceArray<IHostUSBDevice> devsvec;
-    HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec));
-    if (FAILED(rc)) return rc;
+    HRESULT rc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));
+    if (FAILED(rc))
+        return rc;
 
     for (size_t i = 0; i < devsvec.size(); ++i)
     {
         Bstr address;
-        rc = devsvec[i]->COMGETTER(Address) (address.asOutParam());
-        if (FAILED(rc)) return rc;
-        if (address == aAddress)
+        rc = devsvec[i]->COMGETTER(Address)(address.asOutParam());
+        if (FAILED(rc))
+            return rc;
+        if (address == aName)
         {
-            return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo(aDevice);
+            return (ComPtr<IHostUSBDevice>(devsvec[i]).queryInterfaceTo(aDevice.asOutParam()));
         }
     }
 
     return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND,
-                         tr("Could not find a USB device with address '%ls'"),
-                         aAddress);
+                         tr("Could not find a USB device with address '%s'"),
+                         aName.c_str());
 
 #else   /* !VBOX_WITH_USB */
     NOREF(aAddress);
@@ -1679,34 +1646,34 @@ STDMETHODIMP Host::FindUSBDeviceByAddress(IN_BSTR aAddress,
     return E_NOTIMPL;
 #endif  /* !VBOX_WITH_USB */
 }
-
-STDMETHODIMP Host::FindUSBDeviceById(IN_BSTR aId,
-                                     IHostUSBDevice **aDevice)
+HRESULT Host::findUSBDeviceById(const com::Guid &aId,
+                                ComPtr<IHostUSBDevice> &aDevice)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgExpr(aId, Guid (aId).isValid());
-    CheckComArgOutPointerValid(aDevice);
+    if (!aId.isValid())
+        return E_INVALIDARG;
 
-    *aDevice = NULL;
+    aDevice = NULL;
 
     SafeIfaceArray<IHostUSBDevice> devsvec;
-    HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec));
-    if (FAILED(rc)) return rc;
+    HRESULT rc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));
+    if (FAILED(rc))
+        return rc;
 
     for (size_t i = 0; i < devsvec.size(); ++i)
     {
         Bstr id;
-        rc = devsvec[i]->COMGETTER(Id) (id.asOutParam());
-        if (FAILED(rc)) return rc;
-        if (id == aId)
+        rc = devsvec[i]->COMGETTER(Id)(id.asOutParam());
+        if (FAILED(rc))
+            return rc;
+        if (Guid(id) == aId)
         {
-            return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo(aDevice);
+            return (ComPtr<IHostUSBDevice>(devsvec[i]).queryInterfaceTo(aDevice.asOutParam()));
         }
     }
-
-    return setErrorNoLog (VBOX_E_OBJECT_NOT_FOUND, tr (
-        "Could not find a USB device with uuid {%RTuuid}"),
-        Guid (aId).raw());
+    return setErrorNoLog(VBOX_E_OBJECT_NOT_FOUND,
+                         tr("Could not find a USB device with uuid {%RTuuid}"),
+                         aId.raw());
 
 #else   /* !VBOX_WITH_USB */
     NOREF(aId);
@@ -1715,13 +1682,10 @@ STDMETHODIMP Host::FindUSBDeviceById(IN_BSTR aId,
 #endif  /* !VBOX_WITH_USB */
 }
 
-STDMETHODIMP Host::GenerateMACAddress(BSTR *aAddress)
+HRESULT Host::generateMACAddress(com::Utf8Str &aAddress)
 {
-    CheckComArgOutPointerValid(aAddress);
     // no locking required
-    Utf8Str mac;
-    generateMACAddress(mac);
-    Bstr(mac).cloneTo(aAddress);
+    i_generateMACAddress(aAddress);
     return S_OK;
 }
 
@@ -1731,37 +1695,33 @@ STDMETHODIMP Host::GenerateMACAddress(BSTR *aAddress)
  * @returns COM status code
  * @param aVideoInputDevices Array of interface pointers to be filled.
  */
-STDMETHODIMP Host::COMGETTER(VideoInputDevices)(ComSafeArrayOut(IHostVideoInputDevice*, aVideoInputDevices))
+HRESULT Host::getVideoInputDevices(std::vector<ComPtr<IHostVideoInputDevice> > &aVideoInputDevices)
 {
-    if (ComSafeArrayOutIsNull(aVideoInputDevices))
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     HostVideoInputDeviceList list;
 
-    HRESULT hr = HostVideoInputDevice::queryHostDevices(m->pParent, &list);
+    HRESULT rc = HostVideoInputDevice::queryHostDevices(m->pParent, &list);
+    if (FAILED(rc))
+        return rc;
 
-    if (SUCCEEDED(hr))
-    {
-        SafeIfaceArray<IHostVideoInputDevice> devices(list);
-        devices.detachTo(ComSafeArrayOutArg(aVideoInputDevices));
-    }
+    aVideoInputDevices.resize(list.size());
+    size_t i = 0;
+    for (HostVideoInputDeviceList::const_iterator it = list.begin(); it != list.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aVideoInputDevices[i].asOutParam());
 
-    return hr;
+    return S_OK;
 }
 
 // public methods only for internal purposes
 ////////////////////////////////////////////////////////////////////////////////
 
-HRESULT Host::loadSettings(const settings::Host &data)
+HRESULT Host::i_loadSettings(const settings::Host &data)
 {
     HRESULT rc = S_OK;
 #ifdef VBOX_WITH_USB
     AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (FAILED(autoCaller.rc()))
+        return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -1773,16 +1733,17 @@ HRESULT Host::loadSettings(const settings::Host &data)
         ComObjPtr<HostUSBDeviceFilter> pFilter;
         pFilter.createObject();
         rc = pFilter->init(this, f);
-        if (FAILED(rc)) break;
+        if (FAILED(rc))
+            break;
 
         m->llUSBDeviceFilters.push_back(pFilter);
         pFilter->mInList = true;
 
         /* notify the proxy (only when the filter is active) */
-        if (pFilter->getData().mActive)
+        if (pFilter->i_getData().mActive)
         {
             HostUSBDeviceFilter *flt = pFilter; /* resolve ambiguity */
-            flt->getId() = m->pUSBProxyService->insertFilter(&pFilter->getData().mUSBFilter);
+            flt->i_getId() = m->pUSBProxyService->insertFilter(&pFilter->i_getData().mUSBFilter);
         }
     }
 #else
@@ -1791,11 +1752,12 @@ HRESULT Host::loadSettings(const settings::Host &data)
     return rc;
 }
 
-HRESULT Host::saveSettings(settings::Host &data)
+HRESULT Host::i_saveSettings(settings::Host &data)
 {
 #ifdef VBOX_WITH_USB
     AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (FAILED(autoCaller.rc()))
+        return autoCaller.rc();
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -1807,7 +1769,7 @@ HRESULT Host::saveSettings(settings::Host &data)
     {
         ComObjPtr<HostUSBDeviceFilter> pFilter = *it;
         settings::USBDeviceFilter f;
-        pFilter->saveSettings(f);
+        pFilter->i_saveSettings(f);
         data.llUSBDeviceFilters.push_back(f);
     }
 #else
@@ -1833,15 +1795,15 @@ HRESULT Host::saveSettings(settings::Host &data)
  * @param fRefresh Whether to refresh the host drives list even if this is not the first call.
  * @param pll Caller's pointer which gets set to the static list of host drives.
  * @param treeLock Reference to media tree lock, need to drop it temporarily.
- * @return
+ * @returns COM status code
  */
-HRESULT Host::getDrives(DeviceType_T mediumType,
-                        bool fRefresh,
-                        MediaList *&pll,
-                        AutoWriteLock &treeLock)
+HRESULT Host::i_getDrives(DeviceType_T mediumType,
+                          bool fRefresh,
+                          MediaList *&pll,
+                          AutoWriteLock &treeLock)
 {
     HRESULT rc = S_OK;
-    Assert(m->pParent->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
     MediaList llNew;
     MediaList *pllCached;
@@ -1852,7 +1814,7 @@ HRESULT Host::getDrives(DeviceType_T mediumType,
         case DeviceType_DVD:
             if (!m->fDVDDrivesListBuilt || fRefresh)
             {
-                rc = buildDVDDrivesList(llNew);
+                rc = i_buildDVDDrivesList(llNew);
                 if (FAILED(rc))
                     return rc;
                 pfListBuilt = &m->fDVDDrivesListBuilt;
@@ -1863,7 +1825,7 @@ HRESULT Host::getDrives(DeviceType_T mediumType,
         case DeviceType_Floppy:
             if (!m->fFloppyDrivesListBuilt || fRefresh)
             {
-                rc = buildFloppyDrivesList(llNew);
+                rc = i_buildFloppyDrivesList(llNew);
                 if (FAILED(rc))
                     return rc;
                 pfListBuilt = &m->fFloppyDrivesListBuilt;
@@ -1895,14 +1857,14 @@ HRESULT Host::getDrives(DeviceType_T mediumType,
                  /*nothing */)
             {
                 Medium *pCached = *itCached;
-                const Utf8Str strLocationCached = pCached->getLocationFull();
+                const Utf8Str strLocationCached = pCached->i_getLocationFull();
                 bool fFound = false;
                 for (MediaList::iterator itNew = llNew.begin();
                      itNew != llNew.end();
                      ++itNew)
                 {
                     Medium *pNew = *itNew;
-                    const Utf8Str strLocationNew = pNew->getLocationFull();
+                    const Utf8Str strLocationNew = pNew->i_getLocationFull();
                     if (strLocationNew == strLocationCached)
                     {
                         fFound = true;
@@ -1910,7 +1872,10 @@ HRESULT Host::getDrives(DeviceType_T mediumType,
                     }
                 }
                 if (!fFound)
+                {
+                    pCached->uninit();
                     itCached = pllCached->erase(itCached);
+                }
                 else
                     ++itCached;
             }
@@ -1921,14 +1886,14 @@ HRESULT Host::getDrives(DeviceType_T mediumType,
                  ++itNew)
             {
                 Medium *pNew = *itNew;
-                const Utf8Str strLocationNew = pNew->getLocationFull();
+                const Utf8Str strLocationNew = pNew->i_getLocationFull();
                 bool fFound = false;
                 for (MediaList::iterator itCached = pllCached->begin();
                      itCached != pllCached->end();
                      ++itCached)
                 {
                     Medium *pCached = *itCached;
-                    const Utf8Str strLocationCached = pCached->getLocationFull();
+                    const Utf8Str strLocationCached = pCached->i_getLocationFull();
                     if (strLocationNew == strLocationCached)
                     {
                         fFound = true;
@@ -1967,15 +1932,15 @@ HRESULT Host::getDrives(DeviceType_T mediumType,
  * @param pMedium Medium object, if found...
  * @return VBOX_E_OBJECT_NOT_FOUND if not found, or S_OK if found, or errors from getDrives().
  */
-HRESULT Host::findHostDriveById(DeviceType_T mediumType,
-                                const Guid &uuid,
-                                bool fRefresh,
-                                ComObjPtr<Medium> &pMedium)
+HRESULT Host::i_findHostDriveById(DeviceType_T mediumType,
+                                  const Guid &uuid,
+                                  bool fRefresh,
+                                  ComObjPtr<Medium> &pMedium)
 {
     MediaList *pllMedia;
 
-    AutoWriteLock treeLock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = getDrives(mediumType, fRefresh, pllMedia, treeLock);
+    AutoWriteLock treeLock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    HRESULT rc = i_getDrives(mediumType, fRefresh, pllMedia, treeLock);
     if (SUCCEEDED(rc))
     {
         for (MediaList::iterator it = pllMedia->begin();
@@ -1985,7 +1950,7 @@ HRESULT Host::findHostDriveById(DeviceType_T mediumType,
             Medium *pThis = *it;
             AutoCaller mediumCaller(pThis);
             AutoReadLock mediumLock(pThis COMMA_LOCKVAL_SRC_POS);
-            if (pThis->getId() == uuid)
+            if (pThis->i_getId() == uuid)
             {
                 pMedium = pThis;
                 return S_OK;
@@ -2004,18 +1969,18 @@ HRESULT Host::findHostDriveById(DeviceType_T mediumType,
  * @param mediumType Must be DeviceType_DVD or DeviceType_Floppy.
  * @param strLocationFull Name (path) of host drive to look for.
  * @param fRefresh Whether to refresh the host drives list (see getDrives())
- * @param pMedium Medium object, if found...
+ * @param pMedium Medium object, if found
  * @return VBOX_E_OBJECT_NOT_FOUND if not found, or S_OK if found, or errors from getDrives().
  */
-HRESULT Host::findHostDriveByName(DeviceType_T mediumType,
-                                  const Utf8Str &strLocationFull,
-                                  bool fRefresh,
-                                  ComObjPtr<Medium> &pMedium)
+HRESULT Host::i_findHostDriveByName(DeviceType_T mediumType,
+                                    const Utf8Str &strLocationFull,
+                                    bool fRefresh,
+                                    ComObjPtr<Medium> &pMedium)
 {
     MediaList *pllMedia;
 
-    AutoWriteLock treeLock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = getDrives(mediumType, fRefresh, pllMedia, treeLock);
+    AutoWriteLock treeLock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    HRESULT rc = i_getDrives(mediumType, fRefresh, pllMedia, treeLock);
     if (SUCCEEDED(rc))
     {
         for (MediaList::iterator it = pllMedia->begin();
@@ -2025,7 +1990,7 @@ HRESULT Host::findHostDriveByName(DeviceType_T mediumType,
             Medium *pThis = *it;
             AutoCaller mediumCaller(pThis);
             AutoReadLock mediumLock(pThis COMMA_LOCKVAL_SRC_POS);
-            if (pThis->getLocationFull() == strLocationFull)
+            if (pThis->i_getLocationFull() == strLocationFull)
             {
                 pMedium = pThis;
                 return S_OK;
@@ -2046,18 +2011,18 @@ HRESULT Host::findHostDriveByName(DeviceType_T mediumType,
  * @param pMedium     Medium object, if found...
  * @return VBOX_E_OBJECT_NOT_FOUND if not found, or S_OK if found, or errors from getDrives().
  */
-HRESULT Host::findHostDriveByNameOrId(DeviceType_T mediumType,
-                                      const Utf8Str &strNameOrId,
-                                      ComObjPtr<Medium> &pMedium)
+HRESULT Host::i_findHostDriveByNameOrId(DeviceType_T mediumType,
+                                        const Utf8Str &strNameOrId,
+                                        ComObjPtr<Medium> &pMedium)
 {
-    AutoWriteLock wlock(m->pParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock wlock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     Guid uuid(strNameOrId);
     if (uuid.isValid() && !uuid.isZero())
-        return findHostDriveById(mediumType, uuid, true /* fRefresh */, pMedium);
+        return i_findHostDriveById(mediumType, uuid, true /* fRefresh */, pMedium);
 
     // string is not a syntactically valid UUID: try a name then
-    return findHostDriveByName(mediumType, strNameOrId, true /* fRefresh */, pMedium);
+    return i_findHostDriveByName(mediumType, strNameOrId, true /* fRefresh */, pMedium);
 }
 
 /**
@@ -2065,11 +2030,11 @@ HRESULT Host::findHostDriveByNameOrId(DeviceType_T mediumType,
  * @param pll
  * @return
  */
-HRESULT Host::buildDVDDrivesList(MediaList &list)
+HRESULT Host::i_buildDVDDrivesList(MediaList &list)
 {
     HRESULT rc = S_OK;
 
-    Assert(m->pParent->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
     try
     {
@@ -2096,10 +2061,10 @@ HRESULT Host::buildDVDDrivesList(MediaList &list)
 
 #elif defined(RT_OS_SOLARIS)
 # ifdef VBOX_USE_LIBHAL
-        if (!getDVDInfoFromHal(list))
+        if (!i_getDVDInfoFromHal(list))
 # endif
         {
-            getDVDInfoFromDevTree(list);
+            i_getDVDInfoFromDevTree(list);
         }
 
 #elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
@@ -2147,11 +2112,11 @@ HRESULT Host::buildDVDDrivesList(MediaList &list)
  * @param list
  * @return
  */
-HRESULT Host::buildFloppyDrivesList(MediaList &list)
+HRESULT Host::i_buildFloppyDrivesList(MediaList &list)
 {
     HRESULT rc = S_OK;
 
-    Assert(m->pParent->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
     try
     {
@@ -2204,15 +2169,16 @@ HRESULT Host::buildFloppyDrivesList(MediaList &list)
 }
 
 #ifdef VBOX_WITH_USB
-USBProxyService* Host::usbProxyService()
+USBProxyService* Host::i_usbProxyService()
 {
     return m->pUSBProxyService;
 }
 
-HRESULT Host::addChild(HostUSBDeviceFilter *pChild)
+HRESULT Host::i_addChild(HostUSBDeviceFilter *pChild)
 {
     AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (FAILED(autoCaller.rc()))
+        return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -2221,10 +2187,11 @@ HRESULT Host::addChild(HostUSBDeviceFilter *pChild)
     return S_OK;
 }
 
-HRESULT Host::removeChild(HostUSBDeviceFilter *pChild)
+HRESULT Host::i_removeChild(HostUSBDeviceFilter *pChild)
 {
     AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (FAILED(autoCaller.rc()))
+        return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -2242,7 +2209,7 @@ HRESULT Host::removeChild(HostUSBDeviceFilter *pChild)
     return S_OK;
 }
 
-VirtualBox* Host::parent()
+VirtualBox* Host::i_parent()
 {
     return m->pParent;
 }
@@ -2250,11 +2217,12 @@ VirtualBox* Host::parent()
 /**
  *  Called by setter methods of all USB device filters.
  */
-HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter,
-                                      BOOL aActiveChanged /* = FALSE */)
+HRESULT Host::i_onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter,
+                                        BOOL aActiveChanged /* = FALSE */)
 {
     AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (FAILED(autoCaller.rc()))
+        return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -2263,26 +2231,26 @@ HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter,
         if (aActiveChanged)
         {
             // insert/remove the filter from the proxy
-            if (aFilter->getData().mActive)
+            if (aFilter->i_getData().mActive)
             {
-                ComAssertRet(aFilter->getId() == NULL, E_FAIL);
-                aFilter->getId() = m->pUSBProxyService->insertFilter(&aFilter->getData().mUSBFilter);
+                ComAssertRet(aFilter->i_getId() == NULL, E_FAIL);
+                aFilter->i_getId() = m->pUSBProxyService->insertFilter(&aFilter->i_getData().mUSBFilter);
             }
             else
             {
-                ComAssertRet(aFilter->getId() != NULL, E_FAIL);
-                m->pUSBProxyService->removeFilter(aFilter->getId());
-                aFilter->getId() = NULL;
+                ComAssertRet(aFilter->i_getId() != NULL, E_FAIL);
+                m->pUSBProxyService->removeFilter(aFilter->i_getId());
+                aFilter->i_getId() = NULL;
             }
         }
         else
         {
-            if (aFilter->getData().mActive)
+            if (aFilter->i_getData().mActive)
             {
                 // update the filter in the proxy
-                ComAssertRet(aFilter->getId() != NULL, E_FAIL);
-                m->pUSBProxyService->removeFilter(aFilter->getId());
-                aFilter->getId() = m->pUSBProxyService->insertFilter(&aFilter->getData().mUSBFilter);
+                ComAssertRet(aFilter->i_getId() != NULL, E_FAIL);
+                m->pUSBProxyService->removeFilter(aFilter->i_getId());
+                aFilter->i_getId() = m->pUSBProxyService->insertFilter(&aFilter->i_getData().mUSBFilter);
             }
         }
 
@@ -2290,7 +2258,7 @@ HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter,
         // for that we should hold only the VirtualBox lock
         alock.release();
         AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS);
-        return m->pParent->saveSettings();
+        return m->pParent->i_saveSettings();
     }
 
     return S_OK;
@@ -2304,7 +2272,7 @@ HRESULT Host::onUSBDeviceFilterChange(HostUSBDeviceFilter *aFilter,
  * @param   aGlobalFilters      Where to put the global filter list copy.
  * @param   aMachines           Where to put the machine vector.
  */
-void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters)
+void Host::i_getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters)
 {
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -2421,7 +2389,8 @@ static int solarisWalkDeviceNodeForDVD(di_node_t Node, void *pvArg)
                                     PSOLARISDVD pDrive = (PSOLARISDVD)RTMemAllocZ(sizeof(SOLARISDVD));
                                     if (RT_LIKELY(pDrive))
                                     {
-                                        RTStrPrintf(pDrive->szDescription, sizeof(pDrive->szDescription), "%s %s", pszVendor, pszProduct);
+                                        RTStrPrintf(pDrive->szDescription, sizeof(pDrive->szDescription),
+                                                    "%s %s", pszVendor, pszProduct);
                                         RTStrCopy(pDrive->szRawDiskPath, sizeof(pDrive->szRawDiskPath), pszDevLinkPath);
                                         if (*ppDrives)
                                             pDrive->pNext = *ppDrives;
@@ -2448,7 +2417,7 @@ static int solarisWalkDeviceNodeForDVD(di_node_t Node, void *pvArg)
  * Solaris specific function to enumerate CD/DVD drives via the device tree.
  * Works on Solaris 10 as well as OpenSolaris without depending on libhal.
  */
-void Host::getDVDInfoFromDevTree(std::list<ComObjPtr<Medium> > &list)
+void Host::i_getDVDInfoFromDevTree(std::list<ComObjPtr<Medium> > &list)
 {
     PSOLARISDVD pDrives = NULL;
     di_node_t RootNode = di_init("/", DINFOCPYALL);
@@ -2479,20 +2448,20 @@ void Host::getDVDInfoFromDevTree(std::list<ComObjPtr<Medium> > &list)
  * @returns true if information was successfully obtained, false otherwise
  * @retval  list drives found will be attached to this list
  */
-bool Host::getDVDInfoFromHal(std::list<ComObjPtr<Medium> > &list)
+bool Host::i_getDVDInfoFromHal(std::list<ComObjPtr<Medium> > &list)
 {
     bool halSuccess = false;
     DBusError dbusError;
     if (!gLibHalCheckPresence())
         return false;
-    gDBusErrorInit (&dbusError);
+    gDBusErrorInit(&dbusError);
     DBusConnection *dbusConnection = gDBusBusGet(DBUS_BUS_SYSTEM, &dbusError);
     if (dbusConnection != 0)
     {
         LibHalContext *halContext = gLibHalCtxNew();
         if (halContext != 0)
         {
-            if (gLibHalCtxSetDBusConnection (halContext, dbusConnection))
+            if (gLibHalCtxSetDBusConnection(halContext, dbusConnection))
             {
                 if (gLibHalCtxInit(halContext, &dbusError))
                 {
@@ -2532,8 +2501,8 @@ bool Host::getDVDInfoFromHal(std::list<ComObjPtr<Medium> > &list)
                                     {
                                         if ((vendor != 0) && (vendor[0] != 0))
                                         {
-                                            description = Utf8StrFmt ("%s %s",
-                                                                      vendor, product);
+                                            description = Utf8StrFmt("%s %s",
+                                                                     vendor, product);
                                         }
                                         else
                                         {
@@ -2543,7 +2512,7 @@ bool Host::getDVDInfoFromHal(std::list<ComObjPtr<Medium> > &list)
                                         hostDVDDriveObj.createObject();
                                         hostDVDDriveObj->init(m->pParent, DeviceType_DVD,
                                                               Bstr(devNode), Bstr(description));
-                                        list.push_back (hostDVDDriveObj);
+                                        list.push_back(hostDVDDriveObj);
                                     }
                                     else
                                     {
@@ -2557,7 +2526,7 @@ bool Host::getDVDInfoFromHal(std::list<ComObjPtr<Medium> > &list)
                                         hostDVDDriveObj.createObject();
                                         hostDVDDriveObj->init(m->pParent, DeviceType_DVD,
                                                               Bstr(devNode));
-                                        list.push_back (hostDVDDriveObj);
+                                        list.push_back(hostDVDDriveObj);
                                     }
                                     if (vendor != 0)
                                     {
@@ -2594,13 +2563,15 @@ bool Host::getDVDInfoFromHal(std::list<ComObjPtr<Medium> > &list)
                     }
                     if (!gLibHalCtxShutdown(halContext, &dbusError))  /* what now? */
                     {
-                        LogRel(("Host::COMGETTER(DVDDrives): failed to shutdown the libhal context.  dbus error: %s (%s)\n", dbusError.name, dbusError.message));
+                        LogRel(("Host::COMGETTER(DVDDrives): failed to shutdown the libhal context.  dbus error: %s (%s)\n",
+                                dbusError.name, dbusError.message));
                         gDBusErrorFree(&dbusError);
                     }
                 }
                 else
                 {
-                    LogRel(("Host::COMGETTER(DVDDrives): failed to initialise libhal context.  dbus error: %s (%s)\n", dbusError.name, dbusError.message));
+                    LogRel(("Host::COMGETTER(DVDDrives): failed to initialise libhal context.  dbus error: %s (%s)\n",
+                            dbusError.name, dbusError.message));
                     gDBusErrorFree(&dbusError);
                 }
                 gLibHalCtxFree(halContext);
@@ -2618,7 +2589,8 @@ bool Host::getDVDInfoFromHal(std::list<ComObjPtr<Medium> > &list)
     }
     else
     {
-        LogRel(("Host::COMGETTER(DVDDrives): failed to connect to dbus.  dbus error: %s (%s)\n", dbusError.name, dbusError.message));
+        LogRel(("Host::COMGETTER(DVDDrives): failed to connect to dbus.  dbus error: %s (%s)\n",
+                dbusError.name, dbusError.message));
         gDBusErrorFree(&dbusError);
     }
     return halSuccess;
@@ -2632,20 +2604,20 @@ bool Host::getDVDInfoFromHal(std::list<ComObjPtr<Medium> > &list)
  * @returns true if information was successfully obtained, false otherwise
  * @retval  list drives found will be attached to this list
  */
-bool Host::getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list)
+bool Host::i_getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list)
 {
     bool halSuccess = false;
     DBusError dbusError;
     if (!gLibHalCheckPresence())
         return false;
-    gDBusErrorInit (&dbusError);
+    gDBusErrorInit(&dbusError);
     DBusConnection *dbusConnection = gDBusBusGet(DBUS_BUS_SYSTEM, &dbusError);
     if (dbusConnection != 0)
     {
         LibHalContext *halContext = gLibHalCtxNew();
         if (halContext != 0)
         {
-            if (gLibHalCtxSetDBusConnection (halContext, dbusConnection))
+            if (gLibHalCtxSetDBusConnection(halContext, dbusConnection))
             {
                 if (gLibHalCtxInit(halContext, &dbusError))
                 {
@@ -2695,8 +2667,8 @@ bool Host::getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list)
                                     {
                                         if ((vendor != 0) && (vendor[0] != 0))
                                         {
-                                            description = Utf8StrFmt ("%s %s",
-                                                                      vendor, product);
+                                            description = Utf8StrFmt("%s %s",
+                                                                     vendor, product);
                                         }
                                         else
                                         {
@@ -2706,7 +2678,7 @@ bool Host::getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list)
                                         hostFloppyDrive.createObject();
                                         hostFloppyDrive->init(m->pParent, DeviceType_DVD,
                                                               Bstr(devNode), Bstr(description));
-                                        list.push_back (hostFloppyDrive);
+                                        list.push_back(hostFloppyDrive);
                                     }
                                     else
                                     {
@@ -2720,7 +2692,7 @@ bool Host::getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list)
                                         hostFloppyDrive.createObject();
                                         hostFloppyDrive->init(m->pParent, DeviceType_DVD,
                                                               Bstr(devNode));
-                                        list.push_back (hostFloppyDrive);
+                                        list.push_back(hostFloppyDrive);
                                     }
                                     if (vendor != 0)
                                     {
@@ -2753,13 +2725,15 @@ bool Host::getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list)
                     }
                     if (!gLibHalCtxShutdown(halContext, &dbusError))  /* what now? */
                     {
-                        LogRel(("Host::COMGETTER(FloppyDrives): failed to shutdown the libhal context.  dbus error: %s (%s)\n", dbusError.name, dbusError.message));
+                        LogRel(("Host::COMGETTER(FloppyDrives): failed to shutdown the libhal context.  dbus error: %s (%s)\n",
+                                dbusError.name, dbusError.message));
                         gDBusErrorFree(&dbusError);
                     }
                 }
                 else
                 {
-                    LogRel(("Host::COMGETTER(FloppyDrives): failed to initialise libhal context.  dbus error: %s (%s)\n", dbusError.name, dbusError.message));
+                    LogRel(("Host::COMGETTER(FloppyDrives): failed to initialise libhal context.  dbus error: %s (%s)\n",
+                            dbusError.name, dbusError.message));
                     gDBusErrorFree(&dbusError);
                 }
                 gLibHalCtxFree(halContext);
@@ -2777,7 +2751,8 @@ bool Host::getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list)
     }
     else
     {
-        LogRel(("Host::COMGETTER(FloppyDrives): failed to connect to dbus.  dbus error: %s (%s)\n", dbusError.name, dbusError.message));
+        LogRel(("Host::COMGETTER(FloppyDrives): failed to connect to dbus.  dbus error: %s (%s)\n",
+                dbusError.name, dbusError.message));
         gDBusErrorFree(&dbusError);
     }
     return halSuccess;
@@ -2790,7 +2765,7 @@ bool Host::getFloppyInfoFromHal(std::list< ComObjPtr<Medium> > &list)
 /**
  * Helper function to parse the given mount file and add found entries
  */
-void Host::parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list)
+void Host::i_parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &list)
 {
 #ifdef RT_OS_LINUX
     FILE *mtab = setmntent(mountTable, "r");
@@ -2838,7 +2813,7 @@ void Host::parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &lis
             if (strstr(mnt_type, "iso9660") == 0)
             {
                 /** @todo check whether we've already got the drive in our list! */
-                if (validateDevice(mnt_dev, true))
+                if (i_validateDevice(mnt_dev, true))
                 {
                     ComObjPtr<Medium> hostDVDDriveObj;
                     hostDVDDriveObj.createObject();
@@ -2864,18 +2839,20 @@ void Host::parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &lis
             if (mountName && mountPoint && mountFSType)
             {
                 // skip devices we are not interested in
-                if ((*mountName && mountName[0] == '/') &&                      // skip 'fake' devices (like -hosts, proc, fd, swap)
-                    (*mountFSType && (strncmp(mountFSType, RT_STR_TUPLE("devfs")) != 0 &&  // skip devfs (i.e. /devices)
+                if ((*mountName && mountName[0] == '/') &&                      // skip 'fake' devices (like -hosts,
+                                                                                // proc, fd, swap)
+                    (*mountFSType && (strncmp(mountFSType, RT_STR_TUPLE("devfs")) != 0 &&  // skip devfs
+                                                                                           // (i.e. /devices)
                                       strncmp(mountFSType, RT_STR_TUPLE("dev")) != 0 &&    // skip dev (i.e. /dev)
                                       strncmp(mountFSType, RT_STR_TUPLE("lofs")) != 0)))   // skip loop-back file-system (lofs)
                 {
                     char *rawDevName = getfullrawname((char *)mountName);
-                    if (validateDevice(rawDevName, true))
+                    if (i_validateDevice(rawDevName, true))
                     {
                         ComObjPtr<Medium> hostDVDDriveObj;
                         hostDVDDriveObj.createObject();
                         hostDVDDriveObj->init(m->pParent, DeviceType_DVD, Bstr(rawDevName));
-                        list.push_back (hostDVDDriveObj);
+                        list.push_back(hostDVDDriveObj);
                     }
                     free(rawDevName);
                 }
@@ -2890,7 +2867,7 @@ void Host::parseMountTable(char *mountTable, std::list< ComObjPtr<Medium> > &lis
 /**
  * Helper function to check whether the given device node is a valid drive
  */
-bool Host::validateDevice(const char *deviceNode, bool isCDROM)
+bool Host::i_validateDevice(const char *deviceNode, bool isCDROM)
 {
     struct stat statInfo;
     bool retValue = false;
@@ -2964,10 +2941,11 @@ bool Host::validateDevice(const char *deviceNode, bool isCDROM)
  *
  *  @note Locks this object for reading.
  */
-HRESULT Host::checkUSBProxyService()
+HRESULT Host::i_checkUSBProxyService()
 {
     AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (FAILED(autoCaller.rc()))
+        return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -2992,9 +2970,9 @@ HRESULT Host::checkUSBProxyService()
                 return setWarning(E_FAIL,
                                   tr("The USB Proxy Service has not yet been ported to this host"));
             default:
-                return setWarning (E_FAIL, "%s: %Rrc",
-                                   tr ("Could not load the Host USB Proxy service"),
-                                   m->pUSBProxyService->getLastError());
+                return setWarning(E_FAIL, "%s: %Rrc",
+                                  tr("Could not load the Host USB Proxy service"),
+                                  m->pUSBProxyService->getLastError());
         }
     }
 
@@ -3002,38 +2980,46 @@ HRESULT Host::checkUSBProxyService()
 }
 #endif /* VBOX_WITH_USB */
 
-HRESULT Host::updateNetIfList()
+HRESULT Host::i_updateNetIfList()
 {
 #ifdef VBOX_WITH_HOSTNETIF_API
-    AssertReturn(AutoCaller(this).state() == InInit ||
-                 isWriteLockOnCurrentThread(), E_FAIL);
-
-    HostNetworkInterfaceList list, listCopy;
+    AssertReturn(!isWriteLockOnCurrentThread(), E_FAIL);
+
+    /** @todo r=klaus it would save lots of clock cycles if for concurrent
+     * threads executing this code we'd only do one interface enumeration
+     * and update, and let the other threads use the result as is. However
+     * if there's a constant hammering of this method, we don't want this
+     * to cause update starvation. */
+    HostNetworkInterfaceList list;
     int rc = NetIfList(list);
     if (rc)
     {
         Log(("Failed to get host network interface list with rc=%Rrc\n", rc));
         return E_FAIL;
     }
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
     AssertReturn(m->pParent, E_FAIL);
     /* Make a copy as the original may be partially destroyed later. */
-    listCopy = list;
+    HostNetworkInterfaceList listCopy(list);
     HostNetworkInterfaceList::iterator itOld, itNew;
 # ifdef VBOX_WITH_RESOURCE_USAGE_API
-    PerformanceCollector *aCollector = m->pParent->performanceCollector();
+    PerformanceCollector *aCollector = m->pParent->i_performanceCollector();
 # endif
     for (itOld = m->llNetIfs.begin(); itOld != m->llNetIfs.end(); ++itOld)
     {
         bool fGone = true;
         Bstr nameOld;
-        (*itOld)->COMGETTER(Name) (nameOld.asOutParam());
+        (*itOld)->COMGETTER(Name)(nameOld.asOutParam());
         for (itNew = listCopy.begin(); itNew != listCopy.end(); ++itNew)
         {
             Bstr nameNew;
-            (*itNew)->COMGETTER(Name) (nameNew.asOutParam());
+            (*itNew)->COMGETTER(Name)(nameNew.asOutParam());
             if (nameNew == nameOld)
             {
                 fGone = false;
+                (*itNew)->uninit();
                 listCopy.erase(itNew);
                 break;
             }
@@ -3041,7 +3027,8 @@ HRESULT Host::updateNetIfList()
         if (fGone)
         {
 # ifdef VBOX_WITH_RESOURCE_USAGE_API
-            (*itOld)->unregisterMetrics(aCollector, this);
+            (*itOld)->i_unregisterMetrics(aCollector, this);
+            (*itOld)->uninit();
 # endif
         }
     }
@@ -3050,22 +3037,22 @@ HRESULT Host::updateNetIfList()
      * (see @bugref{6439}).
      */
     for (itNew = list.begin(); itNew != list.end(); ++itNew)
-        (*itNew)->setVirtualBox(m->pParent);
+        (*itNew)->i_setVirtualBox(m->pParent);
     /* At this point listCopy will contain newly discovered interfaces only. */
     for (itNew = listCopy.begin(); itNew != listCopy.end(); ++itNew)
     {
         HostNetworkInterfaceType_T t;
-        HRESULT hr = (*itNew)->COMGETTER(InterfaceType)(&t);
-        if (FAILED(hr))
+        HRESULT hrc = (*itNew)->COMGETTER(InterfaceType)(&t);
+        if (FAILED(hrc))
         {
             Bstr n;
-            (*itNew)->COMGETTER(Name) (n.asOutParam());
+            (*itNew)->COMGETTER(Name)(n.asOutParam());
             LogRel(("Host::updateNetIfList: failed to get interface type for %ls\n", n.raw()));
         }
         else if (t == HostNetworkInterfaceType_Bridged)
         {
 # ifdef VBOX_WITH_RESOURCE_USAGE_API
-            (*itNew)->registerMetrics(aCollector, this);
+            (*itNew)->i_registerMetrics(aCollector, this);
 # endif
         }
     }
@@ -3078,7 +3065,7 @@ HRESULT Host::updateNetIfList()
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
 
-void Host::registerDiskMetrics(PerformanceCollector *aCollector)
+void Host::i_registerDiskMetrics(PerformanceCollector *aCollector)
 {
     pm::CollectorHAL *hal = aCollector->getHAL();
     /* Create sub metrics */
@@ -3096,7 +3083,7 @@ void Host::registerDiskMetrics(PerformanceCollector *aCollector)
                                                               fsRootUsageTotal,
                                                               fsRootUsageUsed,
                                                               fsRootUsageFree);
-    aCollector->registerBaseMetric (fsRootUsage);
+    aCollector->registerBaseMetric(fsRootUsage);
 
     aCollector->registerMetric(new pm::Metric(fsRootUsage, fsRootUsageTotal, 0));
     aCollector->registerMetric(new pm::Metric(fsRootUsage, fsRootUsageTotal,
@@ -3135,7 +3122,7 @@ void Host::registerDiskMetrics(PerformanceCollector *aCollector)
             "Percentage of time disk was busy serving I/O requests.");
         pm::BaseMetric *fsLoad  = new pm::HostDiskLoadRaw(hal, this, strName + "/Load",
                                                          *it, fsLoadUtil);
-        aCollector->registerBaseMetric (fsLoad);
+        aCollector->registerBaseMetric(fsLoad);
 
         aCollector->registerMetric(new pm::Metric(fsLoad, fsLoadUtil, 0));
         aCollector->registerMetric(new pm::Metric(fsLoad, fsLoadUtil,
@@ -3152,7 +3139,7 @@ void Host::registerDiskMetrics(PerformanceCollector *aCollector)
             "Disk size.");
         pm::BaseMetric *fsUsage = new pm::HostDiskUsage(hal, this, strName + "/Usage",
                                                         *it, fsUsageTotal);
-        aCollector->registerBaseMetric (fsUsage);
+        aCollector->registerBaseMetric(fsUsage);
 
         aCollector->registerMetric(new pm::Metric(fsUsage, fsUsageTotal, 0));
         aCollector->registerMetric(new pm::Metric(fsUsage, fsUsageTotal,
@@ -3164,7 +3151,7 @@ void Host::registerDiskMetrics(PerformanceCollector *aCollector)
     }
 }
 
-void Host::registerMetrics(PerformanceCollector *aCollector)
+void Host::i_registerMetrics(PerformanceCollector *aCollector)
 {
     pm::CollectorHAL *hal = aCollector->getHAL();
     /* Create sub metrics */
@@ -3195,20 +3182,20 @@ void Host::registerMetrics(PerformanceCollector *aCollector)
     /* Create and register base metrics */
     pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw(hal, this, cpuLoadUser, cpuLoadKernel,
                                           cpuLoadIdle);
-    aCollector->registerBaseMetric (cpuLoad);
+    aCollector->registerBaseMetric(cpuLoad);
     pm::BaseMetric *cpuMhz = new pm::HostCpuMhz(hal, this, cpuMhzSM);
-    aCollector->registerBaseMetric (cpuMhz);
+    aCollector->registerBaseMetric(cpuMhz);
     pm::BaseMetric *ramUsage = new pm::HostRamUsage(hal, this,
                                                     ramUsageTotal,
                                                     ramUsageUsed,
                                                     ramUsageFree);
-    aCollector->registerBaseMetric (ramUsage);
+    aCollector->registerBaseMetric(ramUsage);
     pm::BaseMetric *ramVmm = new pm::HostRamVmm(aCollector->getGuestManager(), this,
                                                 ramVMMUsed,
                                                 ramVMMFree,
                                                 ramVMMBallooned,
                                                 ramVMMShared);
-    aCollector->registerBaseMetric (ramVmm);
+    aCollector->registerBaseMetric(ramVmm);
 
     aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser, 0));
     aCollector->registerMetric(new pm::Metric(cpuLoad, cpuLoadUser,
@@ -3297,10 +3284,10 @@ void Host::registerMetrics(PerformanceCollector *aCollector)
                                               new pm::AggregateMin()));
     aCollector->registerMetric(new pm::Metric(ramVmm, ramVMMShared,
                                               new pm::AggregateMax()));
-    registerDiskMetrics(aCollector);
+    i_registerDiskMetrics(aCollector);
 }
 
-void Host::unregisterMetrics (PerformanceCollector *aCollector)
+void Host::i_unregisterMetrics(PerformanceCollector *aCollector)
 {
     aCollector->unregisterMetricsFor(this);
     aCollector->unregisterBaseMetricsFor(this);
@@ -3310,7 +3297,7 @@ void Host::unregisterMetrics (PerformanceCollector *aCollector)
 
 
 /* static */
-void Host::generateMACAddress(Utf8Str &mac)
+void Host::i_generateMACAddress(Utf8Str &mac)
 {
     /*
      * Our strategy is as follows: the first three bytes are our fixed
diff --git a/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp b/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
index 58c5fd3..6e321d3 100644
--- a/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
+++ b/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -16,7 +16,6 @@
  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
-
 #include "HostNetworkInterfaceImpl.h"
 #include "AutoCaller.h"
 #include "Logging.h"
@@ -32,11 +31,13 @@
 # include <netinet/in.h> /* INADDR_NONE */
 #endif /* RT_OS_FREEBSD */
 
+#include "VirtualBoxImpl.h"
+
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
 HostNetworkInterface::HostNetworkInterface()
-    : mVBox(NULL)
+    : mVirtualBox(NULL)
 {
 }
 
@@ -78,7 +79,7 @@ HRESULT HostNetworkInterface::init(Bstr aInterfaceName, Bstr aShortName, Guid aG
     AssertReturn(autoInitSpan.isOk(), E_FAIL);
 
     unconst(mInterfaceName) = aInterfaceName;
-    unconst(mNetworkName) = composeNetworkName(aShortName);
+    unconst(mNetworkName) = i_composeNetworkName(aShortName);
     unconst(mShortName) = aShortName;
     unconst(mGuid) = aGuid;
     mIfType = ifType;
@@ -91,7 +92,7 @@ HRESULT HostNetworkInterface::init(Bstr aInterfaceName, Bstr aShortName, Guid aG
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
 
-void HostNetworkInterface::registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr)
+void HostNetworkInterface::i_registerMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr)
 {
     LogFlowThisFunc(("mShortName={%ls}, mInterfaceName={%ls}, mGuid={%s}, mSpeedMbits=%u\n",
                      mShortName.raw(), mInterfaceName.raw(), mGuid.toString().c_str(), m.speedMbits));
@@ -106,9 +107,13 @@ void HostNetworkInterface::registerMetrics(PerformanceCollector *aCollector, Com
         "Physical link speed.");
 
     /* Create and register base metrics */
-    pm::BaseMetric *networkSpeed = new pm::HostNetworkSpeed(hal, objptr, strName + "/LinkSpeed", Utf8Str(mShortName), Utf8Str(mInterfaceName), m.speedMbits, networkLinkSpeed);
+    pm::BaseMetric *networkSpeed = new pm::HostNetworkSpeed(hal, objptr, strName + "/LinkSpeed",
+                                                            Utf8Str(mShortName), Utf8Str(mInterfaceName),
+                                                            m.speedMbits, networkLinkSpeed);
     aCollector->registerBaseMetric(networkSpeed);
-    pm::BaseMetric *networkLoad = new pm::HostNetworkLoadRaw(hal, objptr, strName + "/Load", Utf8Str(mShortName), Utf8Str(mInterfaceName), m.speedMbits, networkLoadRx, networkLoadTx);
+    pm::BaseMetric *networkLoad = new pm::HostNetworkLoadRaw(hal, objptr, strName + "/Load",
+                                                             Utf8Str(mShortName), Utf8Str(mInterfaceName),
+                                                             m.speedMbits, networkLoadRx, networkLoadTx);
     aCollector->registerBaseMetric(networkLoad);
 
     aCollector->registerMetric(new pm::Metric(networkSpeed, networkLinkSpeed, 0));
@@ -136,7 +141,7 @@ void HostNetworkInterface::registerMetrics(PerformanceCollector *aCollector, Com
                                               new pm::AggregateMax()));
 }
 
-void HostNetworkInterface::unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr)
+void HostNetworkInterface::i_unregisterMetrics(PerformanceCollector *aCollector, ComPtr<IUnknown> objptr)
 {
     LogFlowThisFunc(("mShortName={%ls}, mInterfaceName={%ls}, mGuid={%s}\n",
                      mShortName.raw(), mInterfaceName.raw(), mGuid.toString().c_str()));
@@ -174,7 +179,7 @@ HRESULT HostNetworkInterface::updateConfig()
     return rc == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL;
 }
 
-Bstr HostNetworkInterface::composeNetworkName(const Utf8Str aShortName)
+Bstr HostNetworkInterface::i_composeNetworkName(const Utf8Str aShortName)
 {
     return Utf8Str("HostInterfaceNetworking-").append(aShortName);
 }
@@ -202,12 +207,12 @@ HRESULT HostNetworkInterface::init(Bstr aInterfaceName, HostNetworkInterfaceType
     unconst(mGuid) = pIf->Uuid;
     if (pIf->szShortName[0])
     {
-        unconst(mNetworkName) = composeNetworkName(pIf->szShortName);
+        unconst(mNetworkName) = i_composeNetworkName(pIf->szShortName);
         unconst(mShortName)   = pIf->szShortName;
     }
     else
     {
-        unconst(mNetworkName) = composeNetworkName(aInterfaceName);
+        unconst(mNetworkName) = i_composeNetworkName(aInterfaceName);
         unconst(mShortName)   = aInterfaceName;
     }
     mIfType = ifType;
@@ -234,41 +239,31 @@ HRESULT HostNetworkInterface::init(Bstr aInterfaceName, HostNetworkInterfaceType
 }
 #endif
 
-// IHostNetworkInterface properties
+// wrapped IHostNetworkInterface properties
 /////////////////////////////////////////////////////////////////////////////
-
 /**
  * Returns the name of the host network interface.
  *
  * @returns COM status code
- * @param   aInterfaceName address of result pointer
+ * @param   aInterfaceName - Interface Name
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(Name)(BSTR *aInterfaceName)
-{
-    CheckComArgOutPointerValid(aInterfaceName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    mInterfaceName.cloneTo(aInterfaceName);
 
+HRESULT HostNetworkInterface::getName(com::Utf8Str &aInterfaceName)
+{
+    aInterfaceName = mInterfaceName;
     return S_OK;
 }
 
 /**
  * Returns the short name of the host network interface.
  *
- * @returns COM status code
- * @param   aShortName address of result pointer
+ * @returns  COM status code
+ * @param   aShortName Short Name
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(ShortName)(BSTR *aShortName)
-{
-    CheckComArgOutPointerValid(aShortName);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    mShortName.cloneTo(aShortName);
+HRESULT HostNetworkInterface::getShortName(com::Utf8Str &aShortName)
+{
+    aShortName = mShortName;
 
     return S_OK;
 }
@@ -277,27 +272,17 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(ShortName)(BSTR *aShortName)
  * Returns the GUID of the host network interface.
  *
  * @returns COM status code
- * @param   aGuid address of result pointer
+ * @param   aGuid GUI Id
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(Id)(BSTR *aGuid)
+HRESULT HostNetworkInterface::getId(com::Guid &aGuiId)
 {
-    CheckComArgOutPointerValid(aGuid);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    mGuid.toUtf16().cloneTo(aGuid);
+    aGuiId = mGuid;
 
     return S_OK;
 }
 
-STDMETHODIMP HostNetworkInterface::COMGETTER(DHCPEnabled)(BOOL *aDHCPEnabled)
+HRESULT HostNetworkInterface::getDHCPEnabled(BOOL *aDHCPEnabled)
 {
-    CheckComArgOutPointerValid(aDHCPEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aDHCPEnabled = m.dhcpEnabled;
 
     return S_OK;
@@ -308,15 +293,10 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(DHCPEnabled)(BOOL *aDHCPEnabled)
  * Returns the IP address of the host network interface.
  *
  * @returns COM status code
- * @param   aIPAddress address of result pointer
+ * @param   aIPAddress  Address name
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(IPAddress)(BSTR *aIPAddress)
+HRESULT HostNetworkInterface::getIPAddress(com::Utf8Str &aIPAddress)
 {
-    CheckComArgOutPointerValid(aIPAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     in_addr tmp;
 #if defined(RT_OS_WINDOWS)
     tmp.S_un.S_addr = m.IPAddress;
@@ -326,7 +306,7 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(IPAddress)(BSTR *aIPAddress)
     char *addr = inet_ntoa(tmp);
     if (addr)
     {
-        Bstr(addr).detachTo(aIPAddress);
+        aIPAddress = addr;
         return S_OK;
     }
 
@@ -337,14 +317,10 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(IPAddress)(BSTR *aIPAddress)
  * Returns the netwok mask of the host network interface.
  *
  * @returns COM status code
- * @param   aNetworkMask address of result pointer
+ * @param   aNetworkMask name.
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(NetworkMask)(BSTR *aNetworkMask)
+HRESULT HostNetworkInterface::getNetworkMask(com::Utf8Str &aNetworkMask)
 {
-    CheckComArgOutPointerValid(aNetworkMask);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     in_addr tmp;
 #if defined(RT_OS_WINDOWS)
@@ -355,16 +331,15 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(NetworkMask)(BSTR *aNetworkMask)
     char *addr = inet_ntoa(tmp);
     if (addr)
     {
-        Bstr(addr).detachTo(aNetworkMask);
+        aNetworkMask = Utf8Str(addr);
         return S_OK;
     }
 
     return E_FAIL;
 }
 
-STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6Supported)(BOOL *aIPV6Supported)
+HRESULT HostNetworkInterface::getIPV6Supported(BOOL *aIPV6Supported)
 {
-    CheckComArgOutPointerValid(aIPV6Supported);
 #if defined(RT_OS_WINDOWS)
     *aIPV6Supported = FALSE;
 #else
@@ -378,17 +353,11 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6Supported)(BOOL *aIPV6Supported
  * Returns the IP V6 address of the host network interface.
  *
  * @returns COM status code
- * @param   aIPV6Address address of result pointer
+ * @param   aIPV6Address
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6Address)(BSTR *aIPV6Address)
+HRESULT HostNetworkInterface::getIPV6Address(com::Utf8Str &aIPV6Address)
 {
-    CheckComArgOutPointerValid(aIPV6Address);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    m.IPV6Address.cloneTo(aIPV6Address);
-
+    aIPV6Address = m.IPV6Address;
     return S_OK;
 }
 
@@ -398,13 +367,8 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6Address)(BSTR *aIPV6Address)
  * @returns COM status code
  * @param   aIPV6Mask address of result pointer
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6NetworkMaskPrefixLength)(ULONG *aIPV6NetworkMaskPrefixLength)
+HRESULT HostNetworkInterface::getIPV6NetworkMaskPrefixLength(ULONG *aIPV6NetworkMaskPrefixLength)
 {
-    CheckComArgOutPointerValid(aIPV6NetworkMaskPrefixLength);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aIPV6NetworkMaskPrefixLength = m.IPV6NetworkMaskPrefixLength;
 
     return S_OK;
@@ -414,17 +378,11 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(IPV6NetworkMaskPrefixLength)(ULONG
  * Returns the hardware address of the host network interface.
  *
  * @returns COM status code
- * @param   aHardwareAddress address of result pointer
+ * @param   aHardwareAddress hardware address
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(HardwareAddress)(BSTR *aHardwareAddress)
+HRESULT HostNetworkInterface::getHardwareAddress(com::Utf8Str &aHardwareAddress)
 {
-    CheckComArgOutPointerValid(aHardwareAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    m.hardwareAddress.cloneTo(aHardwareAddress);
-
+    aHardwareAddress = m.hardwareAddress;
     return S_OK;
 }
 
@@ -434,13 +392,8 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(HardwareAddress)(BSTR *aHardwareAdd
  * @returns COM status code
  * @param   aType address of result pointer
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(MediumType)(HostNetworkInterfaceMediumType_T *aType)
+HRESULT HostNetworkInterface::getMediumType(HostNetworkInterfaceMediumType_T *aType)
 {
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aType = m.mediumType;
 
     return S_OK;
@@ -452,13 +405,8 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(MediumType)(HostNetworkInterfaceMed
  * @returns COM status code
  * @param   aStatus address of result pointer
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(Status)(HostNetworkInterfaceStatus_T *aStatus)
+HRESULT HostNetworkInterface::getStatus(HostNetworkInterfaceStatus_T *aStatus)
 {
-    CheckComArgOutPointerValid(aStatus);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aStatus = m.status;
 
     return S_OK;
@@ -470,50 +418,40 @@ STDMETHODIMP HostNetworkInterface::COMGETTER(Status)(HostNetworkInterfaceStatus_
  * @returns COM status code
  * @param   aType address of result pointer
  */
-STDMETHODIMP HostNetworkInterface::COMGETTER(InterfaceType)(HostNetworkInterfaceType_T *aType)
+HRESULT HostNetworkInterface::getInterfaceType(HostNetworkInterfaceType_T *aType)
 {
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aType = mIfType;
 
     return S_OK;
 
 }
 
-STDMETHODIMP HostNetworkInterface::COMGETTER(NetworkName)(BSTR *aNetworkName)
+HRESULT HostNetworkInterface::getNetworkName(com::Utf8Str &aNetworkName)
 {
-    CheckComArgOutPointerValid(aNetworkName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    mNetworkName.cloneTo(aNetworkName);
+    aNetworkName = mNetworkName;
 
     return S_OK;
 }
 
-STDMETHODIMP HostNetworkInterface::EnableStaticIPConfig(IN_BSTR aIPAddress, IN_BSTR aNetMask)
+HRESULT HostNetworkInterface::enableStaticIPConfig(const com::Utf8Str &aIPAddress,
+                                                   const com::Utf8Str &aNetworkMask)
 {
 #ifndef VBOX_WITH_HOSTNETIF_API
     return E_NOTIMPL;
 #else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    if (Bstr(aIPAddress).isEmpty())
+    if (aIPAddress.isEmpty())
     {
         if (m.IPAddress)
         {
-            int rc = NetIfEnableStaticIpConfig(mVBox, this, m.IPAddress, 0, 0);
+            int rc = NetIfEnableStaticIpConfig(mVirtualBox, this, m.IPAddress, 0, 0);
             if (RT_SUCCESS(rc))
             {
                 m.realIPAddress = 0;
-                if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()).raw(), NULL)))
+                if (FAILED(mVirtualBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress",
+                                                             mInterfaceName.raw()).raw(), NULL)))
                     return E_FAIL;
-                if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()).raw(), NULL)))
+                if (FAILED(mVirtualBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask",
+                                                             mInterfaceName.raw()).raw(), NULL)))
                     return E_FAIL;
                 return S_OK;
             }
@@ -523,27 +461,29 @@ STDMETHODIMP HostNetworkInterface::EnableStaticIPConfig(IN_BSTR aIPAddress, IN_B
     }
 
     ULONG ip, mask;
-    ip = inet_addr(Utf8Str(aIPAddress).c_str());
+    ip = inet_addr(aIPAddress.c_str());
     if (ip != INADDR_NONE)
     {
-        if (Bstr(aNetMask).isEmpty())
+        if (aNetworkMask.isEmpty())
             mask = 0xFFFFFF;
         else
-            mask = inet_addr(Utf8Str(aNetMask).c_str());
+            mask = inet_addr(aNetworkMask.c_str());
         if (mask != INADDR_NONE)
         {
             if (m.realIPAddress == ip && m.realNetworkMask == mask)
                 return S_OK;
-            int rc = NetIfEnableStaticIpConfig(mVBox, this, m.IPAddress, ip, mask);
+            int rc = NetIfEnableStaticIpConfig(mVirtualBox, this, m.IPAddress, ip, mask);
             if (RT_SUCCESS(rc))
             {
                 m.realIPAddress   = ip;
                 m.realNetworkMask = mask;
-                if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()).raw(),
-                                                       Bstr(aIPAddress).raw())))
+                if (FAILED(mVirtualBox->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress",
+                                                             mInterfaceName.raw()).raw(),
+                                                     Bstr(aIPAddress).raw())))
                     return E_FAIL;
-                if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()).raw(),
-                                               Bstr(aNetMask).raw())))
+                if (FAILED(mVirtualBox->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask",
+                                                             mInterfaceName.raw()).raw(),
+                                                     Bstr(aNetworkMask).raw())))
                     return E_FAIL;
                 return S_OK;
             }
@@ -559,25 +499,25 @@ STDMETHODIMP HostNetworkInterface::EnableStaticIPConfig(IN_BSTR aIPAddress, IN_B
 #endif
 }
 
-STDMETHODIMP HostNetworkInterface::EnableStaticIPConfigV6(IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
+HRESULT HostNetworkInterface::enableStaticIPConfigV6(const com::Utf8Str &aIPV6Address,
+                                                     ULONG aIPV6NetworkMaskPrefixLength)
 {
 #ifndef VBOX_WITH_HOSTNETIF_API
     return E_NOTIMPL;
 #else
-    if (!aIPV6Address)
+    if (aIPV6NetworkMaskPrefixLength > 128)
         return E_INVALIDARG;
-    if (aIPV6MaskPrefixLength > 128)
-        return E_INVALIDARG;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     int rc = S_OK;
-    if (m.realIPV6Address != aIPV6Address || m.realIPV6PrefixLength != aIPV6MaskPrefixLength)
+    if (   m.realIPV6Address      != aIPV6Address
+        || m.realIPV6PrefixLength != aIPV6NetworkMaskPrefixLength)
     {
-        if (aIPV6MaskPrefixLength == 0)
-            aIPV6MaskPrefixLength = 64;
-        rc = NetIfEnableStaticIpConfigV6(mVBox, this, m.IPV6Address.raw(), aIPV6Address, aIPV6MaskPrefixLength);
+        BSTR bstr;
+        aIPV6Address.cloneTo(&bstr);
+        if (aIPV6NetworkMaskPrefixLength == 0)
+            aIPV6NetworkMaskPrefixLength = 64;
+        rc = NetIfEnableStaticIpConfigV6(mVirtualBox, this, m.IPV6Address.raw(),
+                                         bstr, aIPV6NetworkMaskPrefixLength);
         if (RT_FAILURE(rc))
         {
             LogRel(("Failed to EnableStaticIpConfigV6 with rc=%Rrc\n", rc));
@@ -586,12 +526,14 @@ STDMETHODIMP HostNetworkInterface::EnableStaticIPConfigV6(IN_BSTR aIPV6Address,
         else
         {
             m.realIPV6Address = aIPV6Address;
-            m.realIPV6PrefixLength = aIPV6MaskPrefixLength;
-            if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPV6Address", mInterfaceName.raw()).raw(),
-                                           Bstr(aIPV6Address).raw())))
+            m.realIPV6PrefixLength = aIPV6NetworkMaskPrefixLength;
+            if (FAILED(mVirtualBox->SetExtraData(BstrFmt("HostOnly/%ls/IPV6Address",
+                                                         mInterfaceName.raw()).raw(),
+                                                 Bstr(aIPV6Address).raw())))
                 return E_FAIL;
-            if (FAILED(mVBox->SetExtraData(BstrFmt("HostOnly/%ls/IPV6NetMask", mInterfaceName.raw()).raw(),
-                                           BstrFmt("%u", aIPV6MaskPrefixLength).raw())))
+            if (FAILED(mVirtualBox->SetExtraData(BstrFmt("HostOnly/%ls/IPV6NetMask",
+                                                         mInterfaceName.raw()).raw(),
+                                                 BstrFmt("%u", aIPV6NetworkMaskPrefixLength).raw())))
                 return E_FAIL;
         }
 
@@ -600,15 +542,12 @@ STDMETHODIMP HostNetworkInterface::EnableStaticIPConfigV6(IN_BSTR aIPV6Address,
 #endif
 }
 
-STDMETHODIMP HostNetworkInterface::EnableDynamicIPConfig()
+HRESULT HostNetworkInterface::enableDynamicIPConfig()
 {
 #ifndef VBOX_WITH_HOSTNETIF_API
     return E_NOTIMPL;
 #else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    int rc = NetIfEnableDynamicIpConfig(mVBox, this);
+    int rc = NetIfEnableDynamicIpConfig(mVirtualBox, this);
     if (RT_FAILURE(rc))
     {
         LogRel(("Failed to EnableDynamicIpConfig with rc=%Rrc\n", rc));
@@ -618,15 +557,12 @@ STDMETHODIMP HostNetworkInterface::EnableDynamicIPConfig()
 #endif
 }
 
-STDMETHODIMP HostNetworkInterface::DHCPRediscover()
+HRESULT HostNetworkInterface::dHCPRediscover()
 {
 #ifndef VBOX_WITH_HOSTNETIF_API
     return E_NOTIMPL;
 #else
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    int rc = NetIfDhcpRediscover(mVBox, this);
+    int rc = NetIfDhcpRediscover(mVirtualBox, this);
     if (RT_FAILURE(rc))
     {
         LogRel(("Failed to DhcpRediscover with rc=%Rrc\n", rc));
@@ -636,26 +572,29 @@ STDMETHODIMP HostNetworkInterface::DHCPRediscover()
 #endif
 }
 
-HRESULT HostNetworkInterface::setVirtualBox(VirtualBox *pVBox)
+HRESULT HostNetworkInterface::i_setVirtualBox(VirtualBox *pVirtualBox)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
-    AssertReturn(mVBox != pVBox, S_OK);
 
-    unconst(mVBox) = pVBox;
+    AssertReturn(mVirtualBox != pVirtualBox, S_OK);
+
+    unconst(mVirtualBox) = pVirtualBox;
 
 #if !defined(RT_OS_WINDOWS)
     /* If IPv4 address hasn't been initialized */
     if (m.IPAddress == 0 && mIfType == HostNetworkInterfaceType_HostOnly)
     {
         Bstr tmpAddr, tmpMask;
-        HRESULT hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPAddress", mInterfaceName.raw()).raw(),
-                                          tmpAddr.asOutParam());
+        HRESULT hrc = mVirtualBox->GetExtraData(BstrFmt("HostOnly/%ls/IPAddress",
+                                                        mInterfaceName.raw()).raw(),
+                                                tmpAddr.asOutParam());
         if (FAILED(hrc) || tmpAddr.isEmpty())
             tmpAddr = getDefaultIPv4Address(mInterfaceName);
 
-        hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", mInterfaceName.raw()).raw(),
-                                  tmpMask.asOutParam());
+        hrc = mVirtualBox->GetExtraData(BstrFmt("HostOnly/%ls/IPNetMask",
+                                                mInterfaceName.raw()).raw(),
+                                        tmpMask.asOutParam());
         if (FAILED(hrc) || tmpMask.isEmpty())
             tmpMask = Bstr(VBOXNET_IPV4MASK_DEFAULT);
 
@@ -666,12 +605,14 @@ HRESULT HostNetworkInterface::setVirtualBox(VirtualBox *pVBox)
     if (m.IPV6Address.isEmpty())
     {
         Bstr tmpPrefixLen;
-        HRESULT hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPV6Address", mInterfaceName.raw()).raw(),
-                                          m.IPV6Address.asOutParam());
+        HRESULT hrc = mVirtualBox->GetExtraData(BstrFmt("HostOnly/%ls/IPV6Address",
+                                                        mInterfaceName.raw()).raw(),
+                                                m.IPV6Address.asOutParam());
         if (SUCCEEDED(hrc) && !m.IPV6Address.isEmpty())
         {
-            hrc = mVBox->GetExtraData(BstrFmt("HostOnly/%ls/IPV6PrefixLen", mInterfaceName.raw()).raw(),
-                                      tmpPrefixLen.asOutParam());
+            hrc = mVirtualBox->GetExtraData(BstrFmt("HostOnly/%ls/IPV6PrefixLen",
+                                                    mInterfaceName.raw()).raw(),
+                                            tmpPrefixLen.asOutParam());
             if (SUCCEEDED(hrc) && !tmpPrefixLen.isEmpty())
                 m.IPV6NetworkMaskPrefixLength = Utf8Str(tmpPrefixLen).toUInt32();
             else
diff --git a/src/VBox/Main/src-server/HostPower.cpp b/src/VBox/Main/src-server/HostPower.cpp
index 3146a7a..4dfae2f 100644
--- a/src/VBox/Main/src-server/HostPower.cpp
+++ b/src/VBox/Main/src-server/HostPower.cpp
@@ -1,10 +1,11 @@
+/* $Id: HostPower.cpp $ */
 /** @file
  *
  * VirtualBox interface to host's power notification service
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -29,10 +30,11 @@
 #include "MachineImpl.h"
 
 #include <iprt/mem.h>
+#include <iprt/cpp/utils.h>
 
 HostPowerService::HostPowerService(VirtualBox *aVirtualBox)
 {
-    Assert(aVirtualBox != NULL);
+    AssertPtr(aVirtualBox);
     mVirtualBox = aVirtualBox;
 }
 
@@ -55,12 +57,12 @@ void HostPowerService::notify(Reason_T aReason)
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
             /* Suspend performance sampling to avoid unnecessary callbacks due to jumps in time. */
-            PerformanceCollector *perfcollector = mVirtualBox->performanceCollector();
+            PerformanceCollector *perfcollector = mVirtualBox->i_performanceCollector();
 
             if (perfcollector)
                 perfcollector->suspendSampling();
 #endif
-            mVirtualBox->getOpenedMachines(machines, &controls);
+            mVirtualBox->i_getOpenedMachines(machines, &controls);
 
             /* pause running VMs */
             for (VirtualBox::InternalControlList::const_iterator it = controls.begin();
@@ -107,7 +109,7 @@ void HostPowerService::notify(Reason_T aReason)
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
             /* Resume the performance sampling. */
-            PerformanceCollector *perfcollector = mVirtualBox->performanceCollector();
+            PerformanceCollector *perfcollector = mVirtualBox->i_performanceCollector();
 
             if (perfcollector)
                 perfcollector->resumeSampling();
@@ -133,16 +135,15 @@ void HostPowerService::notify(Reason_T aReason)
                     fGlobal = -1;
             }
 
-            mVirtualBox->getOpenedMachines(machines, &controls);
+            mVirtualBox->i_getOpenedMachines(machines, &controls);
             size_t saved = 0;
 
             /* save running VMs */
-            SessionMachinesList::const_iterator it2 = machines.begin();
-            for (VirtualBox::InternalControlList::const_iterator it = controls.begin();
-                 it != controls.end() && it2 != machines.end();
-                 ++it, ++it2)
+            for (SessionMachinesList::const_iterator it = machines.begin();
+                 it != machines.end();
+                 ++it)
             {
-                ComPtr<SessionMachine> pMachine = *it2;
+                ComPtr<SessionMachine> pMachine = *it;
                 rc = pMachine->GetExtraData(Bstr("VBoxInternal2/SavestateOnBatteryLow").raw(),
                                             value.asOutParam());
                 int fPerVM = 0;
@@ -158,15 +159,14 @@ void HostPowerService::notify(Reason_T aReason)
                 /* default is true */
                 if (fGlobal + fPerVM >= 0)
                 {
-                    ComPtr<IInternalSessionControl> pControl = *it;
                     ComPtr<IProgress> progress;
 
-                    /* note that SaveStateWithReason() will simply return a failure
-                     * if the VM is in an inappropriate state */
-                    rc = pControl->SaveStateWithReason(Reason_HostBatteryLow, progress.asOutParam());
+                    /* SessionMachine::i_saveStateWithReason() will return
+                     * a failure if the VM is in an inappropriate state */
+                    rc = pMachine->i_saveStateWithReason(Reason_HostBatteryLow, progress);
                     if (FAILED(rc))
                     {
-                        LogRel(("SaveState '%s' failed with %Rhrc\n", pMachine->getName().c_str(), rc));
+                        LogRel(("SaveState '%s' failed with %Rhrc\n", pMachine->i_getName().c_str(), rc));
                         continue;
                     }
 
@@ -183,7 +183,7 @@ void HostPowerService::notify(Reason_T aReason)
 
                     if (SUCCEEDED(rc))
                     {
-                        LogRel(("SaveState '%s' succeeded\n", pMachine->getName().c_str()));
+                        LogRel(("SaveState '%s' succeeded\n", pMachine->i_getName().c_str()));
                         ++saved;
                     }
                 }
diff --git a/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp b/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
index 582d623..789c27c 100644
--- a/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
+++ b/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2005-2012 Oracle Corporation
+ * Copyright (C) 2005-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,6 +15,7 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
+
 #include <iprt/types.h> /* for UINT64_C */
 
 #include "HostUSBDeviceImpl.h"
@@ -91,7 +92,7 @@ HRESULT HostUSBDevice::init(PUSBDEVICE aUsb, USBProxyService *aUSBProxyService)
     mUsb = aUsb;
 
     /* Set the name. */
-    mNameObj = getName();
+    mNameObj = i_getName();
     mName = mNameObj.c_str();
 
     /* Confirm the successful initialization */
@@ -121,29 +122,19 @@ void HostUSBDevice::uninit()
     mUniState = kHostUSBDeviceState_Invalid;
 }
 
-// IUSBDevice properties
+// Wrapped IUSBDevice properties
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP HostUSBDevice::COMGETTER(Id)(BSTR *aId)
+HRESULT HostUSBDevice::getId(com::Guid &aId)
 {
-    CheckComArgOutPointerValid(aId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mId is constant during life time, no need to lock */
-    mId.toUtf16().cloneTo(aId);
+    aId = mId;
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(VendorId)(USHORT *aVendorId)
-{
-    CheckComArgOutPointerValid(aVendorId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDevice::getVendorId(USHORT *aVendorId)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aVendorId = mUsb->idVendor;
@@ -151,13 +142,8 @@ STDMETHODIMP HostUSBDevice::COMGETTER(VendorId)(USHORT *aVendorId)
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(ProductId)(USHORT *aProductId)
+HRESULT HostUSBDevice::getProductId(USHORT *aProductId)
 {
-    CheckComArgOutPointerValid(aProductId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aProductId = mUsb->idProduct;
@@ -165,13 +151,9 @@ STDMETHODIMP HostUSBDevice::COMGETTER(ProductId)(USHORT *aProductId)
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(Revision)(USHORT *aRevision)
-{
-    CheckComArgOutPointerValid(aRevision);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDevice::getRevision(USHORT *aRevision)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aRevision = mUsb->bcdDevice;
@@ -179,69 +161,45 @@ STDMETHODIMP HostUSBDevice::COMGETTER(Revision)(USHORT *aRevision)
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(Manufacturer)(BSTR *aManufacturer)
+HRESULT HostUSBDevice::getManufacturer(com::Utf8Str &aManufacturer)
 {
-    CheckComArgOutPointerValid(aManufacturer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Bstr(mUsb->pszManufacturer).cloneTo(aManufacturer);
+    aManufacturer = mUsb->pszManufacturer;
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(Product)(BSTR *aProduct)
-{
-    CheckComArgOutPointerValid(aProduct);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDevice::getProduct(com::Utf8Str &aProduct)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Bstr(mUsb->pszProduct).cloneTo(aProduct);
+    aProduct = mUsb->pszProduct;
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(SerialNumber)(BSTR *aSerialNumber)
-{
-    CheckComArgOutPointerValid(aSerialNumber);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDevice::getSerialNumber(com::Utf8Str &aSerialNumber)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Bstr(mUsb->pszSerialNumber).cloneTo(aSerialNumber);
+    aSerialNumber = mUsb->pszSerialNumber;
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(Address)(BSTR *aAddress)
+HRESULT HostUSBDevice::getAddress(com::Utf8Str &aAddress)
 {
-    CheckComArgOutPointerValid(aAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    Bstr(mUsb->pszAddress).cloneTo(aAddress);
-
+    aAddress = mUsb->pszAddress;
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(Port)(USHORT *aPort)
-{
-    CheckComArgOutPointerValid(aPort);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDevice::getPort(USHORT *aPort)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
 #if !defined(RT_OS_WINDOWS) /// @todo check up the bPort value on Windows before enabling this.
@@ -253,13 +211,9 @@ STDMETHODIMP HostUSBDevice::COMGETTER(Port)(USHORT *aPort)
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(Version)(USHORT *aVersion)
-{
-    CheckComArgOutPointerValid(aVersion);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDevice::getVersion(USHORT *aVersion)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aVersion = mUsb->bcdUSB >> 8;
@@ -267,33 +221,70 @@ STDMETHODIMP HostUSBDevice::COMGETTER(Version)(USHORT *aVersion)
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(PortVersion)(USHORT *aPortVersion)
+
+HRESULT HostUSBDevice::getSpeed(USBConnectionSpeed_T *aSpeed)
 {
-    CheckComArgOutPointerValid(aPortVersion);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    /* If the speed is unknown (which it shouldn't be), make a guess
+     * which will be correct for USB 1 and 3 devices, but may be wrong
+     * for USB 2.0 devices
+     */
+    switch (mUsb->enmSpeed)
+    {
+        case USBDEVICESPEED_LOW:        *aSpeed = USBConnectionSpeed_Low;       break;
+        case USBDEVICESPEED_FULL:       *aSpeed = USBConnectionSpeed_Full;      break;
+        case USBDEVICESPEED_HIGH:       *aSpeed = USBConnectionSpeed_High;      break;
+        case USBDEVICESPEED_SUPER:      *aSpeed = USBConnectionSpeed_Super;     break;
+//        case USBDEVICESPEED_SUPERPLUS:  *aSpeed = USBConnectionSpeed_SuperPlus; break;
+        default:
+            switch (mUsb->bcdUSB >> 8)
+            {
+                case 3:     *aSpeed = USBConnectionSpeed_Super; break;
+                case 2:     *aSpeed = USBConnectionSpeed_High;  break;
+                default:    *aSpeed = USBConnectionSpeed_Full;
+            }
+    }
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    return S_OK;
+}
 
+
+HRESULT HostUSBDevice::getPortVersion(USHORT *aPortVersion)
+{
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     /* Port version is 2 (EHCI) if and only if the device runs at high speed;
      * if speed is unknown, fall back to the old and inaccurate method.
      */
     if (mUsb->enmSpeed == USBDEVICESPEED_UNKNOWN)
         *aPortVersion = mUsb->bcdUSB >> 8;
     else
-        *aPortVersion = (mUsb->enmSpeed == USBDEVICESPEED_HIGH) ? 2 : 1;
+    {
+        switch (mUsb->enmSpeed)
+        {
+            case USBDEVICESPEED_SUPER:
+                *aPortVersion = 3;
+                break;
+            case USBDEVICESPEED_HIGH:
+                *aPortVersion = 2;
+                break;
+            case USBDEVICESPEED_FULL:
+            case USBDEVICESPEED_LOW:
+            case USBDEVICESPEED_VARIABLE:
+                *aPortVersion = 1;
+                break;
+            default:
+                AssertMsgFailed(("Invalid USB speed: %d\n", mUsb->enmSpeed));
+                *aPortVersion = 1;
+        }
+    }
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDevice::COMGETTER(Remote)(BOOL *aRemote)
-{
-    CheckComArgOutPointerValid(aRemote);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDevice::getRemote(BOOL *aRemote)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aRemote = FALSE;
@@ -301,19 +292,12 @@ STDMETHODIMP HostUSBDevice::COMGETTER(Remote)(BOOL *aRemote)
     return S_OK;
 }
 
-// IHostUSBDevice properties
-/////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP HostUSBDevice::COMGETTER(State)(USBDeviceState_T *aState)
+HRESULT HostUSBDevice::getState(USBDeviceState_T *aState)
 {
-    CheckComArgOutPointerValid(aState);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aState = canonicalState();
+    *aState = i_canonicalState();
 
     return S_OK;
 }
@@ -325,7 +309,7 @@ STDMETHODIMP HostUSBDevice::COMGETTER(State)(USBDeviceState_T *aState)
 /**
  * @note Locks this object for reading.
  */
-Utf8Str HostUSBDevice::getName()
+com::Utf8Str HostUSBDevice::i_getName()
 {
     Utf8Str name;
 
@@ -356,16 +340,18 @@ Utf8Str HostUSBDevice::getName()
  * is already held by the proxy. Note that it will then perform IPC to the VM
  * process, which means it will temporarily release all locks. (Is this a good idea?)
  *
- * @param   aMachine    Machine this device should be attach to.
- * @param   aSetError   Whether to set full error message or not to bother.
- * @param   aMaskedIfs  The interfaces to hide from the guest.
+ * @param   aMachine         Machine this device should be attach to.
+ * @param   aSetError        Whether to set full error message or not to bother.
+ * @param   aCaptureFilename The filename to capture the USB traffic to.
+ * @param   aMaskedIfs       The interfaces to hide from the guest.
  *
  * @returns Status indicating whether it was successfully captured and/or attached.
  * @retval  S_OK on success.
  * @retval  E_UNEXPECTED if the device state doesn't permit for any attaching.
  * @retval  E_* as appropriate.
  */
-HRESULT HostUSBDevice::requestCaptureForVM(SessionMachine *aMachine, bool aSetError, ULONG aMaskedIfs /* = 0*/)
+HRESULT HostUSBDevice::i_requestCaptureForVM(SessionMachine *aMachine, bool aSetError,
+                                             const com::Utf8Str &aCaptureFilename, ULONG aMaskedIfs /* = 0*/)
 {
     /*
      * Validate preconditions and input.
@@ -394,7 +380,7 @@ HRESULT HostUSBDevice::requestCaptureForVM(SessionMachine *aMachine, bool aSetEr
             AutoReadLock machLock(mMachine COMMA_LOCKVAL_SRC_POS);
             return setError(E_INVALIDARG,
                             tr("USB device '%s' with UUID {%RTuuid} is already captured by the virtual machine '%s'"),
-                            mName, mId.raw(), mMachine->getName().c_str());
+                            mName, mId.raw(), mMachine->i_getName().c_str());
         }
         if (mUniState >= kHostUSBDeviceState_FirstTransitional)
             return setError(E_INVALIDARG,
@@ -405,7 +391,7 @@ HRESULT HostUSBDevice::requestCaptureForVM(SessionMachine *aMachine, bool aSetEr
             &&  mUniState != kHostUSBDeviceState_Capturable)
             return setError(E_INVALIDARG,
                             tr("USB device '%s' with UUID {%RTuuid} is not in the right state for capturing (%s)"),
-                            mName, mId.raw(), getStateName());
+                            mName, mId.raw(), i_getStateName());
     }
 
     AssertReturn(   mUniState == kHostUSBDeviceState_HeldByProxy
@@ -421,7 +407,7 @@ HRESULT HostUSBDevice::requestCaptureForVM(SessionMachine *aMachine, bool aSetEr
     if (mUniState == kHostUSBDeviceState_HeldByProxy)
     {
         alock.release();
-        HRESULT hrc = attachToVM(aMachine, aMaskedIfs);
+        HRESULT hrc = i_attachToVM(aMachine, aCaptureFilename, aMaskedIfs);
         return SUCCEEDED(hrc);
     }
 
@@ -434,18 +420,19 @@ HRESULT HostUSBDevice::requestCaptureForVM(SessionMachine *aMachine, bool aSetEr
     LogFlowThisFunc(("{%s} capturing the device.\n", mName));
 #if (defined(RT_OS_DARWIN) && defined(VBOX_WITH_NEW_USB_CODE_ON_DARWIN)) /* PORTME */ \
  || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS)
-    setState(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_UsedByVM, kHostUSBDeviceSubState_AwaitingDetach);
+    i_setState(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_UsedByVM, kHostUSBDeviceSubState_AwaitingDetach);
 #else
-    setState(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_UsedByVM);
+    i_setState(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_UsedByVM);
 #endif
     mMachine = aMachine;
     mMaskedIfs = aMaskedIfs;
+    mCaptureFilename = aCaptureFilename;
     alock.release();
     int rc = mUSBProxyService->captureDevice(this);
     if (RT_FAILURE(rc))
     {
         alock.acquire();
-        failTransition();
+        i_failTransition();
         mMachine.setNull();
         if (rc == VERR_SHARING_VIOLATION)
             return setError(E_FAIL,
@@ -474,7 +461,8 @@ HRESULT HostUSBDevice::requestCaptureForVM(SessionMachine *aMachine, bool aSetEr
  * @param   aMachine        Machine this device should be attach to.
  * @param   aMaskedIfs      The interfaces to hide from the guest.
  */
-HRESULT HostUSBDevice::attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs /* = 0*/)
+HRESULT HostUSBDevice::i_attachToVM(SessionMachine *aMachine, const com::Utf8Str &aCaptureFilename,
+                                    ULONG aMaskedIfs /* = 0*/)
 {
     AssertReturn(!isWriteLockOnCurrentThread(), E_FAIL);
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -485,7 +473,7 @@ HRESULT HostUSBDevice::attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs /*
                  || mUniState == kHostUSBDeviceState_HeldByProxy
                  || mUniState == kHostUSBDeviceState_AttachingToVM,
                  E_UNEXPECTED);
-    setState(kHostUSBDeviceState_AttachingToVM, kHostUSBDeviceState_UsedByVM);
+    i_setState(kHostUSBDeviceState_AttachingToVM, kHostUSBDeviceState_UsedByVM);
 
     /*
      * The VM process will query the object, so grab a reference to ourselves and release the locks.
@@ -501,7 +489,7 @@ HRESULT HostUSBDevice::attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs /*
      */
     LogFlowThisFunc(("{%s} Calling machine->onUSBDeviceAttach()...\n", mName));
     alock.release();
-    HRESULT hrc = aMachine->onUSBDeviceAttach(d, NULL, aMaskedIfs);
+    HRESULT hrc = aMachine->i_onUSBDeviceAttach(d, NULL, aMaskedIfs, aCaptureFilename);
     LogFlowThisFunc(("{%s} Done machine->onUSBDeviceAttach()=%08X\n", mName, hrc));
 
     /*
@@ -514,11 +502,11 @@ HRESULT HostUSBDevice::attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs /*
     {
         mMachine = aMachine;
         if (!mIsPhysicallyDetached)
-            setState(kHostUSBDeviceState_UsedByVM);
+            i_setState(kHostUSBDeviceState_UsedByVM);
         else
         {
             alock.release();
-            detachFromVM(kHostUSBDeviceState_PhysDetached);
+            i_detachFromVM(kHostUSBDeviceState_PhysDetached);
             hrc = E_UNEXPECTED;
         }
     }
@@ -527,14 +515,14 @@ HRESULT HostUSBDevice::attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs /*
         mMachine.setNull();
         if (!mIsPhysicallyDetached)
         {
-            setState(kHostUSBDeviceState_HeldByProxy);
+            i_setState(kHostUSBDeviceState_HeldByProxy);
             if (hrc == E_UNEXPECTED)
                 hrc = E_FAIL; /* No confusion. */
         }
         else
         {
             alock.release();
-            onPhysicalDetachedInternal();
+            i_onPhysicalDetachedInternal();
             hrc = E_UNEXPECTED;
         }
     }
@@ -550,7 +538,7 @@ HRESULT HostUSBDevice::attachToVM(SessionMachine *aMachine, ULONG aMaskedIfs /*
  *
  * @param   aFinalState     The final state (PhysDetached).
  */
-void HostUSBDevice::detachFromVM(HostUSBDeviceState aFinalState)
+void HostUSBDevice::i_detachFromVM(HostUSBDeviceState aFinalState)
 {
     NOREF(aFinalState);
 
@@ -569,7 +557,7 @@ void HostUSBDevice::detachFromVM(HostUSBDeviceState aFinalState)
      * data and we don't want to deadlock - the state protects us,
      * so, it's not a bit issue here.
      */
-    setState(kHostUSBDeviceState_PhysDetachingFromVM, kHostUSBDeviceState_PhysDetached);
+    i_setState(kHostUSBDeviceState_PhysDetachingFromVM, kHostUSBDeviceState_PhysDetached);
 
     /*
      * Call the VM process (IPC) and request it to detach the device.
@@ -580,7 +568,7 @@ void HostUSBDevice::detachFromVM(HostUSBDeviceState aFinalState)
      */
     alock.release();
     LogFlowThisFunc(("{%s} Calling machine->onUSBDeviceDetach()...\n", mName));
-    HRESULT hrc = mMachine->onUSBDeviceDetach(mId.toUtf16().raw(), NULL);
+    HRESULT hrc = mMachine->i_onUSBDeviceDetach(mId.toUtf16().raw(), NULL);
     LogFlowThisFunc(("{%s} Done machine->onUSBDeviceDetach()=%Rhrc\n", mName, hrc));
     NOREF(hrc);
 
@@ -588,7 +576,7 @@ void HostUSBDevice::detachFromVM(HostUSBDeviceState aFinalState)
      * Re-acquire the locks and complete the transition.
      */
     alock.acquire();
-    advanceTransition();
+    i_advanceTransition();
 }
 
 /**
@@ -611,9 +599,9 @@ void HostUSBDevice::detachFromVM(HostUSBDeviceState aFinalState)
  *
  * @note    Must be called from under the object write lock.
  */
-HRESULT HostUSBDevice::onDetachFromVM(SessionMachine *aMachine, bool aDone, bool *aRunFilters, bool aAbnormal /*= true*/)
+HRESULT HostUSBDevice::i_onDetachFromVM(SessionMachine *aMachine, bool aDone, bool *aRunFilters, bool aAbnormal /*= true*/)
 {
-    LogFlowThisFunc(("{%s} state=%s aDone=%RTbool aAbnormal=%RTbool\n", mName, getStateName(), aDone, aAbnormal));
+    LogFlowThisFunc(("{%s} state=%s aDone=%RTbool aAbnormal=%RTbool\n", mName, i_getStateName(), aDone, aAbnormal));
 
     /*
      * Validate preconditions.
@@ -625,12 +613,13 @@ HRESULT HostUSBDevice::onDetachFromVM(SessionMachine *aMachine, bool aDone, bool
         if (mUniState != kHostUSBDeviceState_UsedByVM)
             return setError(E_INVALIDARG,
                             tr("USB device '%s' with UUID {%RTuuid} is busy (state '%s'). Please try again later"),
-                            mName, mId.raw(), getStateName());
+                            mName, mId.raw(), i_getStateName());
     }
     else
-        AssertMsgReturn(    mUniState == kHostUSBDeviceState_DetachingFromVM /** @todo capturing for VM ends up here on termination. */
+        AssertMsgReturn(    mUniState == kHostUSBDeviceState_DetachingFromVM /** @todo capturing for VM
+                                                                                 ends up here on termination. */
                         ||  (mUniState == kHostUSBDeviceState_UsedByVM && aAbnormal),
-                        ("{%s} %s\n", mName, getStateName()), E_UNEXPECTED);
+                        ("{%s} %s\n", mName, i_getStateName()), E_UNEXPECTED);
     AssertMsgReturn((mMachine == aMachine), ("%p != %p\n", (void *)mMachine, aMachine), E_FAIL);
 
     /*
@@ -638,15 +627,15 @@ HRESULT HostUSBDevice::onDetachFromVM(SessionMachine *aMachine, bool aDone, bool
      */
     if (!aDone)
     {
-        *aRunFilters = startTransition(kHostUSBDeviceState_DetachingFromVM, kHostUSBDeviceState_HeldByProxy);
+        *aRunFilters = i_startTransition(kHostUSBDeviceState_DetachingFromVM, kHostUSBDeviceState_HeldByProxy);
         /* PORTME: This might require host specific changes if you re-enumerate the device. */
     }
     else if (aAbnormal && mUniState == kHostUSBDeviceState_UsedByVM)
     {
         /* Fast forward thru the DetachingFromVM state and on to HeldByProxy. */
         /** @todo need to update the state machine to handle crashed VMs. */
-        startTransition(kHostUSBDeviceState_DetachingFromVM, kHostUSBDeviceState_HeldByProxy);
-        *aRunFilters = advanceTransition();
+        i_startTransition(kHostUSBDeviceState_DetachingFromVM, kHostUSBDeviceState_HeldByProxy);
+        *aRunFilters = i_advanceTransition();
         mMachine.setNull();
         /* PORTME: ditto / trouble if you depend on the VM process to do anything. */
     }
@@ -654,7 +643,7 @@ HRESULT HostUSBDevice::onDetachFromVM(SessionMachine *aMachine, bool aDone, bool
     {
         /* normal completion. */
         Assert(mUniSubState == kHostUSBDeviceSubState_Default); /* PORTME: ditto */
-        *aRunFilters = advanceTransition();
+        *aRunFilters = i_advanceTransition();
         mMachine.setNull();
     }
 
@@ -674,7 +663,7 @@ HRESULT HostUSBDevice::onDetachFromVM(SessionMachine *aMachine, bool aDone, bool
  *
  * @note Must be called without holding the object lock.
  */
-HRESULT HostUSBDevice::requestReleaseToHost()
+HRESULT HostUSBDevice::i_requestReleaseToHost()
 {
     /*
      * Validate preconditions.
@@ -687,23 +676,23 @@ HRESULT HostUSBDevice::requestReleaseToHost()
     if (    mUniState == kHostUSBDeviceState_Unused
         ||  mUniState == kHostUSBDeviceState_Capturable)
         return S_OK;
-    AssertMsgReturn(mUniState == kHostUSBDeviceState_HeldByProxy, ("{%s} %s\n", mName, getStateName()), E_UNEXPECTED);
+    AssertMsgReturn(mUniState == kHostUSBDeviceState_HeldByProxy, ("{%s} %s\n", mName, i_getStateName()), E_UNEXPECTED);
 
     /*
      * Try release it.
      */
 #if (defined(RT_OS_DARWIN) && defined(VBOX_WITH_NEW_USB_CODE_ON_DARWIN)) /* PORTME */ \
  || defined(RT_OS_WINDOWS)
-    startTransition(kHostUSBDeviceState_ReleasingToHost, kHostUSBDeviceState_Unused, kHostUSBDeviceSubState_AwaitingDetach);
+    i_startTransition(kHostUSBDeviceState_ReleasingToHost, kHostUSBDeviceState_Unused, kHostUSBDeviceSubState_AwaitingDetach);
 #else
-    startTransition(kHostUSBDeviceState_ReleasingToHost, kHostUSBDeviceState_Unused);
+    i_startTransition(kHostUSBDeviceState_ReleasingToHost, kHostUSBDeviceState_Unused);
 #endif
     alock.release();
     int rc = mUSBProxyService->releaseDevice(this);
     if (RT_FAILURE(rc))
     {
         alock.acquire();
-        failTransition();
+        i_failTransition();
         return E_FAIL;
     }
     return S_OK;
@@ -723,7 +712,7 @@ HRESULT HostUSBDevice::requestReleaseToHost()
  *
  * @note Must be called without holding the object lock.
  */
-HRESULT HostUSBDevice::requestHold()
+HRESULT HostUSBDevice::i_requestHold()
 {
     /*
      * Validate preconditions.
@@ -734,7 +723,7 @@ HRESULT HostUSBDevice::requestHold()
     AssertMsgReturn(   mUniState == kHostUSBDeviceState_Unused
                     || mUniState == kHostUSBDeviceState_Capturable
                     || mUniState == kHostUSBDeviceState_HeldByProxy,
-                    ("{%s} %s\n", mName, getStateName()),
+                    ("{%s} %s\n", mName, i_getStateName()),
                     E_UNEXPECTED);
 
     Assert(mMachine.isNull());
@@ -748,16 +737,16 @@ HRESULT HostUSBDevice::requestHold()
      */
 #if (defined(RT_OS_DARWIN) && defined(VBOX_WITH_NEW_USB_CODE_ON_DARWIN)) /* PORTME */ \
  || defined(RT_OS_WINDOWS)
-    startTransition(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_HeldByProxy, kHostUSBDeviceSubState_AwaitingDetach);
+    i_startTransition(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_HeldByProxy, kHostUSBDeviceSubState_AwaitingDetach);
 #else
-    startTransition(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_HeldByProxy);
+    i_startTransition(kHostUSBDeviceState_Capturing, kHostUSBDeviceState_HeldByProxy);
 #endif
     alock.release();
     int rc = mUSBProxyService->captureDevice(this);
     if (RT_FAILURE(rc))
     {
         alock.acquire();
-        failTransition();
+        i_failTransition();
         return E_FAIL;
     }
     return S_OK;
@@ -773,7 +762,7 @@ HRESULT HostUSBDevice::requestHold()
  *
  * @returns true if it was actually detached, false if it's just a re-enumeration.
  */
-bool HostUSBDevice::wasActuallyDetached()
+bool HostUSBDevice::i_wasActuallyDetached()
 {
     /*
      * This only applies to the detach and re-attach states.
@@ -791,7 +780,7 @@ bool HostUSBDevice::wasActuallyDetached()
                  * and the state should be advanced.
                  */
                 case kHostUSBDeviceSubState_AwaitingDetach:
-                    advanceTransition();
+                    i_advanceTransition();
                     return false; /* not physically detached. */
 
                 /*
@@ -803,8 +792,8 @@ bool HostUSBDevice::wasActuallyDetached()
                     uint64_t elapsedNanoseconds = RTTimeNanoTS() - mLastStateChangeTS;
                     if (elapsedNanoseconds > UINT64_C(60000000000)) /* 60 seconds */
                     {
-                        LogRel(("USB: Async operation timed out for device %s (state: %s)\n", mName, getStateName()));
-                        failTransition();
+                        LogRel(("USB: Async operation timed out for device %s (state: %s)\n", mName, i_getStateName()));
+                        i_failTransition();
                     }
 #endif
                     return false; /* not physically detached. */
@@ -828,7 +817,7 @@ bool HostUSBDevice::wasActuallyDetached()
             break;
 
         default:
-            AssertLogRelMsgFailed(("this=%p %s\n", this, getStateName()));
+            AssertLogRelMsgFailed(("this=%p %s\n", this, i_getStateName()));
             break;
     }
 
@@ -846,7 +835,7 @@ bool HostUSBDevice::wasActuallyDetached()
  * involves IPC and will temporarily abandon locks - and all the device data
  * reset.
  */
-void HostUSBDevice::onPhysicalDetached()
+void HostUSBDevice::i_onPhysicalDetached()
 {
     AssertReturnVoid(!isWriteLockOnCurrentThread());
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -856,7 +845,7 @@ void HostUSBDevice::onPhysicalDetached()
     if (mUniState < kHostUSBDeviceState_FirstTransitional)
     {
         alock.release();
-        onPhysicalDetachedInternal();
+        i_onPhysicalDetachedInternal();
     }
 }
 
@@ -867,7 +856,7 @@ void HostUSBDevice::onPhysicalDetached()
  *
  * See onPhysicalDetach() for details.
  */
-void HostUSBDevice::onPhysicalDetachedInternal()
+void HostUSBDevice::i_onPhysicalDetachedInternal()
 {
     AssertReturnVoid(!isWriteLockOnCurrentThread());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -882,17 +871,17 @@ void HostUSBDevice::onPhysicalDetachedInternal()
              || mUniState == kHostUSBDeviceState_AttachingToVM))
     {
         alock.release();
-        detachFromVM(kHostUSBDeviceState_PhysDetached);
+        i_detachFromVM(kHostUSBDeviceState_PhysDetached);
         alock.acquire();
     }
     else
-        AssertMsg(mMachine.isNull(), ("%s\n", getStateName()));
+        AssertMsg(mMachine.isNull(), ("%s\n", i_getStateName()));
 
     /*
      * Reset the data and enter the final state.
      */
     mMachine.setNull();
-    setState(kHostUSBDeviceState_PhysDetached);
+    i_setState(kHostUSBDeviceState_PhysDetached);
 }
 
 
@@ -909,7 +898,7 @@ void HostUSBDevice::onPhysicalDetachedInternal()
  *
  *  @note Locks this object for reading.
  */
-bool HostUSBDevice::isMatch(const USBDeviceFilter::Data &aData)
+bool HostUSBDevice::i_isMatch(const USBDeviceFilter::Data &aData)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), false);
@@ -949,13 +938,13 @@ bool HostUSBDevice::isMatch(const USBDeviceFilter::Data &aData)
  *
  * @note Must be called from under the object write lock.
  */
-int HostUSBDevice::compare(PCUSBDEVICE aDev2)
+int HostUSBDevice::i_compare(PCUSBDEVICE aDev2)
 {
     AssertReturn(isWriteLockOnCurrentThread(), -1);
     //Log3(("%Rfn: %p {%s}\n", __PRETTY_FUNCTION__, this, mName));
-    return compare(mUsb, aDev2,
-                      mUniSubState == kHostUSBDeviceSubState_AwaitingDetach /* (In case we don't get the detach notice.) */
-                   || mUniSubState == kHostUSBDeviceSubState_AwaitingReAttach);
+    return i_compare(mUsb, aDev2,
+                        mUniSubState == kHostUSBDeviceSubState_AwaitingDetach /* (In case we don't get the detach notice.) */
+                     || mUniSubState == kHostUSBDeviceSubState_AwaitingReAttach);
 }
 
 /**
@@ -971,7 +960,7 @@ int HostUSBDevice::compare(PCUSBDEVICE aDev2)
  * @returns > 0 if aDev1 should come after aDev2.
  */
 /*static*/
-int HostUSBDevice::compare(PCUSBDEVICE aDev1, PCUSBDEVICE aDev2, bool aIsAwaitingReAttach /*= false */)
+int HostUSBDevice::i_compare(PCUSBDEVICE aDev1, PCUSBDEVICE aDev2, bool aIsAwaitingReAttach /*= false */)
 {
     /*
      * Things that stays the same everywhere.
@@ -1074,7 +1063,7 @@ int HostUSBDevice::compare(PCUSBDEVICE aDev1, PCUSBDEVICE aDev2, bool aIsAwaitin
  * @todo    Just do everything here, that is, call filter runners and everything that
  *          works by state change. Using 3 return codes/parameters is just plain ugly.
  */
-bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool HostUSBDevice::i_updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMachine **aIgnoreMachine)
 {
     *aRunFilters = false;
     *aIgnoreMachine = NULL;
@@ -1166,7 +1155,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
     bool fIsImportant = false;
     if (enmOldState != mUsb->enmState)
     {
-        LogFlowThisFunc(("%p {%s} %s\n", this, mName, getStateName()));
+        LogFlowThisFunc(("%p {%s} %s\n", this, mName, i_getStateName()));
         switch (mUsb->enmState)
         {
             /*
@@ -1178,8 +1167,8 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     /* Host drivers installed, that's fine. */
                     case kHostUSBDeviceState_Capturable:
                     case kHostUSBDeviceState_Unused:
-                        LogThisFunc(("{%s} %s -> %s\n", mName, getStateName(), stateName(kHostUSBDeviceState_UsedByHost)));
-                        *aRunFilters = setState(kHostUSBDeviceState_UsedByHost);
+                        LogThisFunc(("{%s} %s -> %s\n", mName, i_getStateName(), i_stateName(kHostUSBDeviceState_UsedByHost)));
+                        *aRunFilters = i_setState(kHostUSBDeviceState_UsedByHost);
                         break;
                     case kHostUSBDeviceState_UsedByHost:
                         break;
@@ -1188,29 +1177,29 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_Capturing:
                         LogThisFunc(("{%s} capture failed!\n", mName));
                         mUSBProxyService->captureDeviceCompleted(this, false /* aSuccess */);
-                        *aRunFilters = failTransition();
+                        *aRunFilters = i_failTransition();
                         mMachine.setNull();
                         break;
 
                     /* Guess we've successfully released it. */
                     case kHostUSBDeviceState_ReleasingToHost:
-                        LogThisFunc(("{%s} %s -> %s\n", mName, getStateName(), stateName(kHostUSBDeviceState_UsedByHost)));
+                        LogThisFunc(("{%s} %s -> %s\n", mName, i_getStateName(), i_stateName(kHostUSBDeviceState_UsedByHost)));
                         mUSBProxyService->releaseDeviceCompleted(this, true /* aSuccess */);
-                        *aRunFilters = setState(kHostUSBDeviceState_UsedByHost);
+                        *aRunFilters = i_setState(kHostUSBDeviceState_UsedByHost);
                         break;
 
                     /* These are IPC states and should be left alone. */
                     case kHostUSBDeviceState_AttachingToVM:
                     case kHostUSBDeviceState_DetachingFromVM:
                     case kHostUSBDeviceState_PhysDetachingFromVM:
-                        LogThisFunc(("{%s} %s - changed to USED_BY_HOST...\n", mName, getStateName()));
+                        LogThisFunc(("{%s} %s - changed to USED_BY_HOST...\n", mName, i_getStateName()));
                         break;
 
 #ifdef HOSTUSBDEVICE_FUZZY_STATE
                     /* Fake: We can't prevent anyone from grabbing it. */
                     case kHostUSBDeviceState_HeldByProxy:
-                        LogThisFunc(("{%s} %s -> %s!\n", mName, getStateName(), stateName(kHostUSBDeviceState_UsedByHost)));
-                        *aRunFilters = setState(kHostUSBDeviceState_UsedByHost);
+                        LogThisFunc(("{%s} %s -> %s!\n", mName, i_getStateName(), i_stateName(kHostUSBDeviceState_UsedByHost)));
+                        *aRunFilters = i_setState(kHostUSBDeviceState_UsedByHost);
                         break;
                     //case kHostUSBDeviceState_UsedByVM:
                     //    /** @todo needs to be detached from the VM. */
@@ -1224,7 +1213,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_PhysDetached:
                     case kHostUSBDeviceState_Unsupported:
                     default:
-                        AssertMsgFailed(("{%s} %s\n", mName, getStateName()));
+                        AssertMsgFailed(("{%s} %s\n", mName, i_getStateName()));
                         break;
                 }
                 break;
@@ -1248,30 +1237,30 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_UsedByHost:
                         fIsImportant = true;
                     case kHostUSBDeviceState_Unused:
-                        LogThisFunc(("{%s} %s -> %s\n", mName, getStateName(), stateName(kHostUSBDeviceState_Capturable)));
-                        *aRunFilters = setState(kHostUSBDeviceState_Capturable);
+                        LogThisFunc(("{%s} %s -> %s\n", mName, i_getStateName(), i_stateName(kHostUSBDeviceState_Capturable)));
+                        *aRunFilters = i_setState(kHostUSBDeviceState_Capturable);
                         break;
 
                     /* Can only mean that we've failed capturing it. */
                     case kHostUSBDeviceState_Capturing:
                         LogThisFunc(("{%s} capture failed!\n", mName));
                         mUSBProxyService->captureDeviceCompleted(this, false /* aSuccess */);
-                        *aRunFilters = failTransition();
+                        *aRunFilters = i_failTransition();
                         mMachine.setNull();
                         break;
 
                     /* Guess we've successfully released it. */
                     case kHostUSBDeviceState_ReleasingToHost:
-                        LogThisFunc(("{%s} %s -> %s\n", mName, getStateName(), stateName(kHostUSBDeviceState_Capturable)));
+                        LogThisFunc(("{%s} %s -> %s\n", mName, i_getStateName(), i_stateName(kHostUSBDeviceState_Capturable)));
                         mUSBProxyService->releaseDeviceCompleted(this, true /* aSuccess */);
-                        *aRunFilters = setState(kHostUSBDeviceState_Capturable);
+                        *aRunFilters = i_setState(kHostUSBDeviceState_Capturable);
                         break;
 
                     /* These are IPC states and should be left alone. */
                     case kHostUSBDeviceState_AttachingToVM:
                     case kHostUSBDeviceState_DetachingFromVM:
                     case kHostUSBDeviceState_PhysDetachingFromVM:
-                        LogThisFunc(("{%s} %s - changed to USED_BY_HOST_CAPTURABLE...\n", mName, getStateName()));
+                        LogThisFunc(("{%s} %s - changed to USED_BY_HOST_CAPTURABLE...\n", mName, i_getStateName()));
                         break;
 
                     /* Not supposed to happen*/
@@ -1282,7 +1271,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_Unsupported:
                     case kHostUSBDeviceState_PhysDetached:
                     default:
-                        AssertMsgFailed(("{%s} %s\n", mName, getStateName()));
+                        AssertMsgFailed(("{%s} %s\n", mName, i_getStateName()));
                         break;
                 }
                 break;
@@ -1307,8 +1296,8 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_UsedByHost:
                     case kHostUSBDeviceState_Capturable:
                         fIsImportant = true;
-                        LogThisFunc(("{%s} %s -> %s\n", mName, getStateName(), stateName(kHostUSBDeviceState_Unused)));
-                        *aRunFilters = setState(kHostUSBDeviceState_Unused);
+                        LogThisFunc(("{%s} %s -> %s\n", mName, i_getStateName(), i_stateName(kHostUSBDeviceState_Unused)));
+                        *aRunFilters = i_setState(kHostUSBDeviceState_Unused);
                         break;
 
                     /* Can mean that we've failed capturing it, but on windows it is the detach signal. */
@@ -1317,30 +1306,30 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                         if (mUniSubState == kHostUSBDeviceSubState_AwaitingDetach)
                         {
                             LogThisFunc(("{%s} capture advancing thru UNUSED...\n", mName));
-                            *aRunFilters = advanceTransition();
+                            *aRunFilters = i_advanceTransition();
                         }
                         else
 #endif
                         {
                             LogThisFunc(("{%s} capture failed!\n", mName));
                             mUSBProxyService->captureDeviceCompleted(this, false /* aSuccess */);
-                            *aRunFilters = failTransition();
+                            *aRunFilters = i_failTransition();
                             mMachine.setNull();
                         }
                         break;
 
                     /* Guess we've successfully released it. */
                     case kHostUSBDeviceState_ReleasingToHost:
-                        LogThisFunc(("{%s} %s -> %s\n", mName, getStateName(), stateName(kHostUSBDeviceState_Unused)));
+                        LogThisFunc(("{%s} %s -> %s\n", mName, i_getStateName(), i_stateName(kHostUSBDeviceState_Unused)));
                         mUSBProxyService->releaseDeviceCompleted(this, true /* aSuccess */);
-                        *aRunFilters = setState(kHostUSBDeviceState_Unused);
+                        *aRunFilters = i_setState(kHostUSBDeviceState_Unused);
                         break;
 
                     /* These are IPC states and should be left alone. */
                     case kHostUSBDeviceState_AttachingToVM:
                     case kHostUSBDeviceState_DetachingFromVM:
                     case kHostUSBDeviceState_PhysDetachingFromVM:
-                        LogThisFunc(("{%s} %s - changed to UNUSED...\n", mName, getStateName()));
+                        LogThisFunc(("{%s} %s - changed to UNUSED...\n", mName, i_getStateName()));
                         break;
 
                     /* Not supposed to happen*/
@@ -1351,7 +1340,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_Unsupported:
                     case kHostUSBDeviceState_PhysDetached:
                     default:
-                        AssertMsgFailed(("{%s} %s\n", mName, getStateName()));
+                        AssertMsgFailed(("{%s} %s\n", mName, i_getStateName()));
                         break;
                 }
                 break;
@@ -1367,36 +1356,36 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_HeldByProxy:
                         break;
                     case kHostUSBDeviceState_UsedByVM:
-                        LogThisFunc(("{%s} %s - changed to HELD_BY_PROXY...\n", mName, getStateName()));
+                        LogThisFunc(("{%s} %s - changed to HELD_BY_PROXY...\n", mName, i_getStateName()));
                         break;
 
                     /* Guess we've successfully captured it. */
                     case kHostUSBDeviceState_Capturing:
                         LogThisFunc(("{%s} capture succeeded!\n", mName));
                         mUSBProxyService->captureDeviceCompleted(this, true /* aSuccess */);
-                        *aRunFilters = advanceTransition(true /* fast forward thru re-attach */);
+                        *aRunFilters = i_advanceTransition(true /* fast forward thru re-attach */);
 
                         /* Take action if we're supposed to attach it to a VM. */
                         if (mUniState == kHostUSBDeviceState_AttachingToVM)
                         {
                             alock.release();
-                            attachToVM(mMachine, mMaskedIfs);
+                            i_attachToVM(mMachine, mCaptureFilename, mMaskedIfs);
                             alock.acquire();
                         }
                         break;
 
                     /* Can only mean that we've failed capturing it. */
                     case kHostUSBDeviceState_ReleasingToHost:
-                        LogThisFunc(("{%s} %s failed!\n", mName, getStateName()));
+                        LogThisFunc(("{%s} %s failed!\n", mName, i_getStateName()));
                         mUSBProxyService->releaseDeviceCompleted(this, false /* aSuccess */);
-                        *aRunFilters = setState(kHostUSBDeviceState_HeldByProxy);
+                        *aRunFilters = i_setState(kHostUSBDeviceState_HeldByProxy);
                         break;
 
                     /* These are IPC states and should be left alone. */
                     case kHostUSBDeviceState_AttachingToVM:
                     case kHostUSBDeviceState_DetachingFromVM:
                     case kHostUSBDeviceState_PhysDetachingFromVM:
-                        LogThisFunc(("{%s} %s - changed to HELD_BY_PROXY...\n", mName, getStateName()));
+                        LogThisFunc(("{%s} %s - changed to HELD_BY_PROXY...\n", mName, i_getStateName()));
                         break;
 
                     /* Not supposed to happen. */
@@ -1406,7 +1395,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_Unused:
                     case kHostUSBDeviceState_PhysDetached:
                     default:
-                        AssertMsgFailed(("{%s} %s\n", mName, getStateName()));
+                        AssertMsgFailed(("{%s} %s\n", mName, i_getStateName()));
                         break;
                 }
                 break;
@@ -1419,7 +1408,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                 {
                     /* No change. */
                     case kHostUSBDeviceState_HeldByProxy:
-                        LogThisFunc(("{%s} %s - changed to USED_BY_GUEST...\n", mName, getStateName()));
+                        LogThisFunc(("{%s} %s - changed to USED_BY_GUEST...\n", mName, i_getStateName()));
                         break;
                     case kHostUSBDeviceState_UsedByVM:
                         break;
@@ -1428,7 +1417,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_AttachingToVM:
                     case kHostUSBDeviceState_DetachingFromVM:
                     case kHostUSBDeviceState_PhysDetachingFromVM:
-                        LogThisFunc(("{%s} %s - changed to USED_BY_GUEST...\n", mName, getStateName()));
+                        LogThisFunc(("{%s} %s - changed to USED_BY_GUEST...\n", mName, i_getStateName()));
                         break;
 
                     /* Not supposed to happen. */
@@ -1440,7 +1429,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
                     case kHostUSBDeviceState_ReleasingToHost:
                     case kHostUSBDeviceState_Capturing:
                     default:
-                        AssertMsgFailed(("{%s} %s\n", mName, getStateName()));
+                        AssertMsgFailed(("{%s} %s\n", mName, i_getStateName()));
                         break;
                 }
                 break;
@@ -1449,25 +1438,26 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
              * This is not supposed to happen and indicates a bug in the backend!
              */
             case USBDEVICESTATE_UNSUPPORTED:
-                AssertMsgFailed(("enmOldState=%d {%s} %s\n", enmOldState, mName, getStateName()));
+                AssertMsgFailed(("enmOldState=%d {%s} %s\n", enmOldState, mName, i_getStateName()));
                 break;
             default:
-                AssertMsgFailed(("enmState=%d {%s} %s\n", mUsb->enmState, mName, getStateName()));
+                AssertMsgFailed(("enmState=%d {%s} %s\n", mUsb->enmState, mName, i_getStateName()));
                 break;
         }
     }
     else if (   mUniSubState == kHostUSBDeviceSubState_AwaitingDetach
-             && hasAsyncOperationTimedOut())
+             && i_hasAsyncOperationTimedOut())
     {
         LogRel(("USB: timeout in %s for {%RTuuid} / {%s}\n",
-                getStateName(), mId.raw(), mName));
-        *aRunFilters = failTransition();
+                i_getStateName(), mId.raw(), mName));
+        *aRunFilters = i_failTransition();
         fIsImportant = true;
     }
     else
     {
-        LogFlowThisFunc(("%p {%s} %s - no change %d\n", this, mName, getStateName(), enmOldState));
-        /** @todo might have to handle some stuff here too if we cannot make the release/capture handling deal with that above ... */
+        LogFlowThisFunc(("%p {%s} %s - no change %d\n", this, mName, i_getStateName(), enmOldState));
+        /** @todo might have to handle some stuff here too if we cannot make the release/capture
+         *  handling deal with that above ... */
     }
 
     return fIsImportant;
@@ -1485,7 +1475,7 @@ bool HostUSBDevice::updateState(PCUSBDEVICE aDev, bool *aRunFilters, SessionMach
  *
  * @returns See HostUSBDevice::updateState()
  */
-bool HostUSBDevice::updateStateFake(PCUSBDEVICE aDev, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool HostUSBDevice::i_updateStateFake(PCUSBDEVICE aDev, bool *aRunFilters, SessionMachine **aIgnoreMachine)
 {
     Assert(!isWriteLockOnCurrentThread());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -1496,8 +1486,8 @@ bool HostUSBDevice::updateStateFake(PCUSBDEVICE aDev, bool *aRunFilters, Session
         case kHostUSBDeviceState_ReleasingToHost:
         {
             *aIgnoreMachine = mUniState == kHostUSBDeviceState_ReleasingToHost ? mMachine : NULL;
-            *aRunFilters = advanceTransition();
-            LogThisFunc(("{%s} %s\n", mName, getStateName()));
+            *aRunFilters = i_advanceTransition();
+            LogThisFunc(("{%s} %s\n", mName, i_getStateName()));
 
             if (mUsb != aDev)
             {
@@ -1517,14 +1507,14 @@ bool HostUSBDevice::updateStateFake(PCUSBDEVICE aDev, bool *aRunFilters, Session
             if (mUniState == kHostUSBDeviceState_AttachingToVM)
             {
                 alock.release();
-                attachToVM(mMachine, mMaskedIfs);
+                i_attachToVM(mMachine, mCaptureFilename, mMaskedIfs);
             }
             return true;
         }
 
         default:
             alock.release();
-            return updateState(aDev, aRunFilters, aIgnoreMachine);
+            return i_updateState(aDev, aRunFilters, aIgnoreMachine);
     }
 }
 
@@ -1537,7 +1527,7 @@ bool HostUSBDevice::updateStateFake(PCUSBDEVICE aDev, bool *aRunFilters, Session
  *
  * @note    Caller must have read or write locked the object before calling.
  */
-bool HostUSBDevice::hasAsyncOperationTimedOut() const
+bool HostUSBDevice::i_hasAsyncOperationTimedOut() const
 {
     switch (mUniSubState)
     {
@@ -1563,9 +1553,9 @@ bool HostUSBDevice::hasAsyncOperationTimedOut() const
  * @param   aSubState
  * @param   aPendingState
  */
-/*static*/ const char *HostUSBDevice::stateName(HostUSBDeviceState aState,
-                                                HostUSBDeviceState aPendingState /*= kHostUSBDeviceState_Invalid*/,
-                                                HostUSBDeviceSubState aSubState /*= kHostUSBDeviceSubState_Default*/)
+/*static*/ const char *HostUSBDevice::i_stateName(HostUSBDeviceState aState,
+                                                  HostUSBDeviceState aPendingState /*= kHostUSBDeviceState_Invalid*/,
+                                                  HostUSBDeviceSubState aSubState /*= kHostUSBDeviceSubState_Default*/)
 {
     switch (aState)
     {
@@ -1761,8 +1751,9 @@ bool HostUSBDevice::hasAsyncOperationTimedOut() const
  *
  * @note    The caller must own the write lock for this object.
  */
-bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aNewPendingState /*= kHostUSBDeviceState_Invalid*/,
-                             HostUSBDeviceSubState aNewSubState /*= kHostUSBDeviceSubState_Default*/)
+bool HostUSBDevice::i_setState(HostUSBDeviceState aNewState,
+                               HostUSBDeviceState aNewPendingState /*= kHostUSBDeviceState_Invalid*/,
+                               HostUSBDeviceSubState aNewSubState /*= kHostUSBDeviceSubState_Default*/)
 {
     Assert(isWriteLockOnCurrentThread());
     Assert(    aNewSubState == kHostUSBDeviceSubState_Default
@@ -1781,7 +1772,7 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
     /*
      * Welcome to the switch orgies!
      * You're welcome to check out the ones in startTransition(),
-     * advanceTransition(), failTransition() and getStateName() too. Enjoy!
+     * advanceTransition(), failTransition() and i_getStateName() too. Enjoy!
      */
 
     bool fFilters = false;
@@ -1799,8 +1790,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                     Assert(aNewSubState == kHostUSBDeviceSubState_Default);
                     break;
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -1819,8 +1810,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                     Assert(aNewSubState == kHostUSBDeviceSubState_Default);
                     break;
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -1847,13 +1838,13 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                         case kHostUSBDeviceState_UsedByVM:
                             break;
                         default:
-                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                         stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                         i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
                     }
                     break;
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -1876,13 +1867,13 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                         case kHostUSBDeviceState_UsedByVM:
                             break;
                         default:
-                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                         stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                         i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
                     }
                     break;
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -1905,8 +1896,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                         case kHostUSBDeviceState_UsedByVM:
                             break;
                         default:
-                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                         stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                         i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
                     }
                     break;
                 case kHostUSBDeviceState_ReleasingToHost:
@@ -1915,13 +1906,13 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                         case kHostUSBDeviceState_Unused: /* Only this! */
                             break;
                         default:
-                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                         stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                         i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
                     }
                     break;
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -1943,13 +1934,13 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                         case kHostUSBDeviceState_Unused: /* Only this! */
                             break;
                         default:
-                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                         stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                            AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                         i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
                     }
                     break;
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -1973,8 +1964,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                 case kHostUSBDeviceState_AttachingToVM: // ??
                 case kHostUSBDeviceState_UsedByVM:
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -2025,8 +2016,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                     break;
 
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -2069,8 +2060,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                     break;
 
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -2098,8 +2089,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                     break;
 
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -2134,8 +2125,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                     break;
 
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -2151,8 +2142,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
                     Assert(aNewSubState == kHostUSBDeviceSubState_Default);
                     break;
                 default:
-                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, getStateName(),
-                                                 stateName(aNewState, aNewPendingState, aNewSubState)), false);
+                    AssertLogRelMsgFailedReturn(("this=%p %s -X-> %s\n", this, i_getStateName(),
+                                                 i_stateName(aNewState, aNewPendingState, aNewSubState)), false);
             }
             break;
 
@@ -2165,11 +2156,12 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
      */
     if (NewPrevState != mPrevUniState)
         LogFlowThisFunc(("%s -> %s (prev: %s -> %s) [%s]\n",
-                         getStateName(), stateName(aNewState, aNewPendingState, aNewSubState),
-                         stateName(mPrevUniState), stateName(NewPrevState), mName));
+                         i_getStateName(), i_stateName(aNewState, aNewPendingState, aNewSubState),
+                         i_stateName(mPrevUniState), i_stateName(NewPrevState), mName));
     else
         LogFlowThisFunc(("%s -> %s (prev: %s) [%s]\n",
-                         getStateName(), stateName(aNewState, aNewPendingState, aNewSubState), stateName(NewPrevState), mName));
+                         i_getStateName(), i_stateName(aNewState, aNewPendingState, aNewSubState),
+                         i_stateName(NewPrevState), mName));
     mPrevUniState = NewPrevState;
     mUniState = aNewState;
     mUniSubState = aNewSubState;
@@ -2191,8 +2183,8 @@ bool HostUSBDevice::setState(HostUSBDeviceState aNewState, HostUSBDeviceState aN
  *
  * @note    The caller must own the write lock for this object.
  */
-bool HostUSBDevice::startTransition(HostUSBDeviceState aNewState, HostUSBDeviceState aFinalState,
-                                    HostUSBDeviceSubState aNewSubState /*= kHostUSBDeviceSubState_Default*/)
+bool HostUSBDevice::i_startTransition(HostUSBDeviceState aNewState, HostUSBDeviceState aFinalState,
+                                      HostUSBDeviceSubState aNewSubState /*= kHostUSBDeviceSubState_Default*/)
 {
     AssertReturn(isWriteLockOnCurrentThread(), false);
     /*
@@ -2214,14 +2206,14 @@ bool HostUSBDevice::startTransition(HostUSBDeviceState aNewState, HostUSBDeviceS
         case kHostUSBDeviceState_ReleasingToHost:
         case kHostUSBDeviceState_AttachingToVM:
         case kHostUSBDeviceState_PhysDetachingFromVM:
-            AssertMsgFailedReturn(("this=%p %s is a transitional state.\n", this, getStateName()), false);
+            AssertMsgFailedReturn(("this=%p %s is a transitional state.\n", this, i_getStateName()), false);
 
         case kHostUSBDeviceState_PhysDetached:
         default:
             AssertReleaseMsgFailedReturn(("this=%p mUniState=%d\n", this, mUniState), false);
     }
 
-    return setState(aNewState, aFinalState, aNewSubState);
+    return i_setState(aNewState, aFinalState, aNewSubState);
 }
 
 
@@ -2235,7 +2227,7 @@ bool HostUSBDevice::startTransition(HostUSBDeviceState aNewState, HostUSBDeviceS
  *
  * @note    The caller must own the write lock for this object.
  */
-bool HostUSBDevice::advanceTransition(bool aSkipReAttach /* = false */)
+bool HostUSBDevice::i_advanceTransition(bool aSkipReAttach /* = false */)
 {
     AssertReturn(isWriteLockOnCurrentThread(), false);
     HostUSBDeviceState enmPending = mPendingUniState;
@@ -2263,7 +2255,8 @@ bool HostUSBDevice::advanceTransition(bool aSkipReAttach /* = false */)
                             enmPending = kHostUSBDeviceState_Invalid;
                             break;
                         default:
-                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n", this, enmPending, getStateName()), false);
+                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n",
+                                                   this, enmPending, i_getStateName()), false);
                     }
                     break;
                 default:
@@ -2291,7 +2284,8 @@ bool HostUSBDevice::advanceTransition(bool aSkipReAttach /* = false */)
                             enmPending = kHostUSBDeviceState_Invalid;
                             break;
                         default:
-                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n", this, enmPending, getStateName()), false);
+                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n",
+                                                   this, enmPending, i_getStateName()), false);
                     }
                     break;
                 default:
@@ -2316,7 +2310,8 @@ bool HostUSBDevice::advanceTransition(bool aSkipReAttach /* = false */)
                             enmPending = kHostUSBDeviceState_Invalid;
                             break;
                         default:
-                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n", this, enmPending, getStateName()), false);
+                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n",
+                                                   this, enmPending, i_getStateName()), false);
                     }
                     break;
                 default:
@@ -2344,7 +2339,8 @@ bool HostUSBDevice::advanceTransition(bool aSkipReAttach /* = false */)
                             enmState = kHostUSBDeviceState_ReleasingToHost;
                             break;
                         default:
-                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n", this, enmPending, getStateName()), false);
+                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n",
+                                                   this, enmPending, i_getStateName()), false);
                     }
                     break;
                 default:
@@ -2363,7 +2359,8 @@ bool HostUSBDevice::advanceTransition(bool aSkipReAttach /* = false */)
                             enmPending = kHostUSBDeviceState_Invalid;
                             break;
                         default:
-                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n", this, enmPending, getStateName()), false);
+                            AssertMsgFailedReturn(("this=%p invalid pending state %d: %s\n",
+                                                   this, enmPending, i_getStateName()), false);
                     }
                     break;
                 default:
@@ -2377,16 +2374,16 @@ bool HostUSBDevice::advanceTransition(bool aSkipReAttach /* = false */)
         case kHostUSBDeviceState_Unused:
         case kHostUSBDeviceState_HeldByProxy:
         case kHostUSBDeviceState_UsedByVM:
-            AssertMsgFailedReturn(("this=%p %s is not transitional\n", this, getStateName()), false);
+            AssertMsgFailedReturn(("this=%p %s is not transitional\n", this, i_getStateName()), false);
         case kHostUSBDeviceState_PhysDetached:
         default:
             AssertReleaseMsgFailedReturn(("this=%p mUniState=%d\n", this, enmState), false);
 
     }
 
-    bool fRc = setState(enmState, enmPending, enmSub);
+    bool fRc = i_setState(enmState, enmPending, enmSub);
     if (aSkipReAttach && mUniSubState == kHostUSBDeviceSubState_AwaitingReAttach)
-        fRc |= advanceTransition(false /* don't fast forward re-attach */);
+        fRc |= i_advanceTransition(false /* don't fast forward re-attach */);
     return fRc;
 }
 
@@ -2397,7 +2394,7 @@ bool HostUSBDevice::advanceTransition(bool aSkipReAttach /* = false */)
  *
  * @note    The caller must own the write lock for this object.
  */
-bool HostUSBDevice::failTransition()
+bool HostUSBDevice::i_failTransition()
 {
     AssertReturn(isWriteLockOnCurrentThread(), false);
     HostUSBDeviceSubState enmSub = mUniSubState;
@@ -2431,7 +2428,7 @@ bool HostUSBDevice::failTransition()
             break;
 
         case kHostUSBDeviceState_PhysDetachingFromVM:
-            AssertMsgFailedReturn(("this=%p %s shall not fail\n", this, getStateName()), false);
+            AssertMsgFailedReturn(("this=%p %s shall not fail\n", this, i_getStateName()), false);
 
         case kHostUSBDeviceState_Unsupported:
         case kHostUSBDeviceState_UsedByHost:
@@ -2439,14 +2436,14 @@ bool HostUSBDevice::failTransition()
         case kHostUSBDeviceState_Unused:
         case kHostUSBDeviceState_HeldByProxy:
         case kHostUSBDeviceState_UsedByVM:
-            AssertMsgFailedReturn(("this=%p %s is not transitional\n", this, getStateName()), false);
+            AssertMsgFailedReturn(("this=%p %s is not transitional\n", this, i_getStateName()), false);
         case kHostUSBDeviceState_PhysDetached:
         default:
             AssertReleaseMsgFailedReturn(("this=%p mUniState=%d\n", this, mUniState), false);
 
     }
 
-    return setState(enmState, kHostUSBDeviceState_Invalid, enmSub);
+    return i_setState(enmState, kHostUSBDeviceState_Invalid, enmSub);
 }
 
 
@@ -2457,7 +2454,7 @@ bool HostUSBDevice::failTransition()
  *
  * @note    The caller must own the read (or write) lock for this object.
  */
-USBDeviceState_T HostUSBDevice::canonicalState() const
+USBDeviceState_T HostUSBDevice::i_canonicalState() const
 {
     switch (mUniState)
     {
diff --git a/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp b/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
index 1e7a53d..1d84b3d 100644
--- a/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
+++ b/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
@@ -74,14 +74,14 @@ void HostVideoInputDevice::uninit()
 {
     LogFlowThisFunc(("\n"));
 
-    m.name.setNull();
-    m.path.setNull();
-    m.alias.setNull();
-
     /* Enclose the state transition Ready->InUninit->NotReady */
     AutoUninitSpan autoUninitSpan(this);
     if (autoUninitSpan.uninitDone())
         return;
+
+    m.name.setNull();
+    m.path.setNull();
+    m.alias.setNull();
 }
 
 static HRESULT hostVideoInputDeviceAdd(HostVideoInputDeviceList *pList,
@@ -181,8 +181,8 @@ static HRESULT fillDeviceList(VirtualBox *pVirtualBox, HostVideoInputDeviceList
     Utf8Str strLibrary;
 
 #ifdef VBOX_WITH_EXTPACK
-    ExtPackManager *pExtPackMgr = pVirtualBox->getExtPackManager();
-    hr = pExtPackMgr->getLibraryPathForExtPack("VBoxHostWebcam", &strExtPackPuel, &strLibrary);
+    ExtPackManager *pExtPackMgr = pVirtualBox->i_getExtPackManager();
+    hr = pExtPackMgr->i_getLibraryPathForExtPack("VBoxHostWebcam", &strExtPackPuel, &strLibrary);
 #else
     hr = E_NOTIMPL;
 #endif
diff --git a/src/VBox/Main/src-server/MachineImpl.cpp b/src/VBox/Main/src-server/MachineImpl.cpp
index cc9c44d..cde3774 100644
--- a/src/VBox/Main/src-server/MachineImpl.cpp
+++ b/src/VBox/Main/src-server/MachineImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2004-2014 Oracle Corporation
+ * Copyright (C) 2004-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -38,7 +38,6 @@
 #include "SharedFolderImpl.h"
 #include "GuestOSTypeImpl.h"
 #include "VirtualBoxErrorInfoImpl.h"
-#include "GuestImpl.h"
 #include "StorageControllerImpl.h"
 #include "DisplayImpl.h"
 #include "DisplayUtils.h"
@@ -86,6 +85,10 @@
 
 #include <algorithm>
 
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+# include "dtrace/VBoxAPI.h"
+#endif
+
 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
 # define HOSTSUFF_EXE ".exe"
 #else /* !RT_OS_WINDOWS */
@@ -126,6 +129,7 @@ Machine::Data::Data()
     mGuestPropertiesModified   = FALSE;
 
     mSession.mPID              = NIL_RTPROCESS;
+    mSession.mLockType         = LockType_Null;
     mSession.mState            = SessionState_Unlocked;
 }
 
@@ -165,8 +169,10 @@ Machine::HWData::HWData()
     mVideoCaptureHeight = 768;
     mVideoCaptureRate = 512;
     mVideoCaptureFPS = 25;
+    mVideoCaptureMaxTime = 0;
+    mVideoCaptureMaxFileSize = 0;
     mVideoCaptureEnabled = false;
-    for (unsigned i = 0; i < RT_ELEMENTS(maVideoCaptureScreens); i++)
+    for (unsigned i = 0; i < RT_ELEMENTS(maVideoCaptureScreens); ++i)
         maVideoCaptureScreens[i] = true;
 
     mHWVirtExEnabled = true;
@@ -186,9 +192,10 @@ Machine::HWData::HWData()
     mPAEEnabled = false;
 #endif
     mLongMode =  HC_ARCH_BITS == 64 ? settings::Hardware::LongMode_Enabled : settings::Hardware::LongMode_Disabled;
-    mSyntheticCpu = false;
     mTripleFaultReset = false;
     mHPETEnabled = false;
+    mCpuExecutionCap = 100; /* Maximum CPU execution cap by default. */
+    mCpuIdPortabilityLevel = 0;
 
     /* default boot order: floppy - DVD - HDD */
     mBootOrder[0] = DeviceType_Floppy;
@@ -198,23 +205,21 @@ Machine::HWData::HWData()
         mBootOrder[i] = DeviceType_Null;
 
     mClipboardMode = ClipboardMode_Disabled;
-    mDragAndDropMode = DragAndDropMode_Disabled;
+    mDnDMode = DnDMode_Disabled;
     mGuestPropertyNotificationPatterns = "";
 
     mFirmwareType = FirmwareType_BIOS;
     mKeyboardHIDType = KeyboardHIDType_PS2Keyboard;
     mPointingHIDType = PointingHIDType_PS2Mouse;
     mChipsetType = ChipsetType_PIIX3;
+    mParavirtProvider = ParavirtProvider_Default;
     mEmulatedUSBCardReaderEnabled = FALSE;
 
-    for (size_t i = 0; i < RT_ELEMENTS(mCPUAttached); i++)
+    for (size_t i = 0; i < RT_ELEMENTS(mCPUAttached); ++i)
         mCPUAttached[i] = false;
 
     mIOCacheEnabled = true;
     mIOCacheSize    = 5; /* 5MB */
-
-    /* Maximum CPU execution cap by default. */
-    mCpuExecutionCap = 100;
 }
 
 Machine::HWData::~HWData()
@@ -301,7 +306,7 @@ HRESULT Machine::init(VirtualBox *aParent,
     HRESULT rc = initImpl(aParent, strConfigFile);
     if (FAILED(rc)) return rc;
 
-    rc = tryCreateMachineConfigFile(fForceOverwrite);
+    rc = i_tryCreateMachineConfigFile(fForceOverwrite);
     if (FAILED(rc)) return rc;
 
     if (SUCCEEDED(rc))
@@ -327,7 +332,7 @@ HRESULT Machine::init(VirtualBox *aParent,
         // the "name sync" flag determines whether the machine directory gets renamed along
         // with the machine file; say so if the settings file name is the same as the
         // settings file parent directory (machine directory)
-        mUserData->s.fNameSync = isInOwnDir();
+        mUserData->s.fNameSync = i_isInOwnDir();
 
         // initialize the default snapshots folder
         rc = COMSETTER(SnapshotFolder)(NULL);
@@ -336,30 +341,30 @@ HRESULT Machine::init(VirtualBox *aParent,
         if (aOsType)
         {
             /* Store OS type */
-            mUserData->s.strOsType = aOsType->id();
+            mUserData->s.strOsType = aOsType->i_id();
 
             /* Apply BIOS defaults */
-            mBIOSSettings->applyDefaults(aOsType);
+            mBIOSSettings->i_applyDefaults(aOsType);
 
             /* Apply network adapters defaults */
             for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot)
-                mNetworkAdapters[slot]->applyDefaults(aOsType);
+                mNetworkAdapters[slot]->i_applyDefaults(aOsType);
 
             /* Apply serial port defaults */
             for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
-                mSerialPorts[slot]->applyDefaults(aOsType);
+                mSerialPorts[slot]->i_applyDefaults(aOsType);
 
             /* Let the OS type select 64-bit ness. */
-            mHWData->mLongMode = aOsType->is64Bit()
+            mHWData->mLongMode = aOsType->i_is64Bit()
                                ? settings::Hardware::LongMode_Enabled : settings::Hardware::LongMode_Disabled;
         }
 
         /* At this point the changing of the current state modification
          * flag is allowed. */
-        allowStateModification();
+        i_allowStateModification();
 
         /* commit all changes made during the initialization */
-        commit();
+        i_commit();
     }
 
     /* Confirm a successful initialization when it's the case */
@@ -419,7 +424,7 @@ HRESULT Machine::initFromSettings(VirtualBox *aParent,
         unconst(mData->mUuid) = *aId;
         mData->mRegistered = TRUE;
         // now load the settings from XML:
-        rc = registeredInit();
+        rc = i_registeredInit();
             // this calls initDataAndChildObjects() and loadSettings()
     }
     else
@@ -439,10 +444,10 @@ HRESULT Machine::initFromSettings(VirtualBox *aParent,
 
                 // reject VM UUID duplicates, they can happen if someone
                 // tries to register an already known VM config again
-                if (aParent->findMachine(mData->pMachineConfigFile->uuid,
-                                         true /* fPermitInaccessible */,
-                                         false /* aDoSetError */,
-                                         NULL) != VBOX_E_OBJECT_NOT_FOUND)
+                if (aParent->i_findMachine(mData->pMachineConfigFile->uuid,
+                                           true /* fPermitInaccessible */,
+                                           false /* aDoSetError */,
+                                           NULL) != VBOX_E_OBJECT_NOT_FOUND)
                 {
                     throw setError(E_FAIL,
                                    tr("Trying to open a VM config '%s' which has the same UUID as an existing virtual machine"),
@@ -452,15 +457,15 @@ HRESULT Machine::initFromSettings(VirtualBox *aParent,
                 // use UUID from machine config
                 unconst(mData->mUuid) = mData->pMachineConfigFile->uuid;
 
-                rc = loadMachineDataFromSettings(*mData->pMachineConfigFile,
+                rc = i_loadMachineDataFromSettings(*mData->pMachineConfigFile,
                                                  NULL /* puuidRegistry */);
                 if (FAILED(rc)) throw rc;
 
                 /* At this point the changing of the current state modification
                  * flag is allowed. */
-                allowStateModification();
+                i_allowStateModification();
 
-                commit();
+                i_commit();
             }
             catch (HRESULT err)
             {
@@ -485,7 +490,7 @@ HRESULT Machine::initFromSettings(VirtualBox *aParent,
 
             // uninit media from this machine's media registry, or else
             // reloading the settings will fail
-            mParent->unregisterMachineMedia(getId());
+            mParent->i_unregisterMachineMedia(i_getId());
         }
     }
 
@@ -521,7 +526,7 @@ HRESULT Machine::init(VirtualBox *aParent,
     AssertReturn(autoInitSpan.isOk(), E_FAIL);
 
     Utf8Str strConfigFile;
-    aParent->getDefaultMachineFolder(strConfigFile);
+    aParent->i_getDefaultMachineFolder(strConfigFile);
     strConfigFile.append(RTPATH_DELIMITER);
     strConfigFile.append(strName);
     strConfigFile.append(RTPATH_DELIMITER);
@@ -531,7 +536,7 @@ HRESULT Machine::init(VirtualBox *aParent,
     HRESULT rc = initImpl(aParent, strConfigFile);
     if (FAILED(rc)) return rc;
 
-    rc = tryCreateMachineConfigFile(false /* fForceOverwrite */);
+    rc = i_tryCreateMachineConfigFile(false /* fForceOverwrite */);
     if (FAILED(rc)) return rc;
 
     rc = initDataAndChildObjects();
@@ -547,8 +552,8 @@ HRESULT Machine::init(VirtualBox *aParent,
         // generate fresh UUID, ignore machine config
         unconst(mData->mUuid).create();
 
-        rc = loadMachineDataFromSettings(config,
-                                         &mData->mUuid); // puuidRegistry: initialize media with this registry ID
+        rc = i_loadMachineDataFromSettings(config,
+                                           &mData->mUuid); // puuidRegistry: initialize media with this registry ID
 
         // override VM name as well, it may be different
         mUserData->s.strName = strName;
@@ -557,10 +562,10 @@ HRESULT Machine::init(VirtualBox *aParent,
         {
             /* At this point the changing of the current state modification
              * flag is allowed. */
-            allowStateModification();
+            i_allowStateModification();
 
             /* commit all changes made during the initialization */
-            commit();
+            i_commit();
         }
     }
 
@@ -572,14 +577,15 @@ HRESULT Machine::init(VirtualBox *aParent,
         else
         {
             /* Ignore all errors from unregistering, they would destroy
-             * the more interesting error information we already have,
-             * pinpointing the issue with the VM config. */
+-            * the more interesting error information we already have,
+-            * pinpointing the issue with the VM config. */
             ErrorInfoKeeper eik;
+
             autoInitSpan.setLimited();
 
             // uninit media from this machine's media registry, or else
             // reloading the settings will fail
-            mParent->unregisterMachineMedia(getId());
+            mParent->i_unregisterMachineMedia(i_getId());
         }
     }
 
@@ -619,7 +625,7 @@ HRESULT Machine::initImpl(VirtualBox *aParent,
     mData->m_strConfigFile = strConfigFile;
 
     /* get the full file name */
-    int vrc1 = mParent->calculateFullPath(strConfigFile, mData->m_strConfigFileFull);
+    int vrc1 = mParent->i_calculateFullPath(strConfigFile, mData->m_strConfigFileFull);
     if (RT_FAILURE(vrc1))
         return setError(VBOX_E_FILE_ERROR,
                         tr("Invalid machine settings file name '%s' (%Rrc)"),
@@ -637,7 +643,7 @@ HRESULT Machine::initImpl(VirtualBox *aParent,
  * the settings file could not be written (e.g. because machine dir is read-only).
  * @return
  */
-HRESULT Machine::tryCreateMachineConfigFile(bool fForceOverwrite)
+HRESULT Machine::i_tryCreateMachineConfigFile(bool fForceOverwrite)
 {
     HRESULT rc = S_OK;
 
@@ -687,10 +693,10 @@ HRESULT Machine::tryCreateMachineConfigFile(bool fForceOverwrite)
  *  @note Locks the mUSBController method for writing.
  *  @note Subclasses must not call this method.
  */
-HRESULT Machine::registeredInit()
+HRESULT Machine::i_registeredInit()
 {
-    AssertReturn(!isSessionMachine(), E_FAIL);
-    AssertReturn(!isSnapshotMachine(), E_FAIL);
+    AssertReturn(!i_isSessionMachine(), E_FAIL);
+    AssertReturn(!i_isSnapshotMachine(), E_FAIL);
     AssertReturn(mData->mUuid.isValid(), E_FAIL);
     AssertReturn(!mData->mAccessible, E_FAIL);
 
@@ -715,10 +721,10 @@ HRESULT Machine::registeredInit()
                                mData->pMachineConfigFile->uuid.raw(),
                                mData->m_strConfigFileFull.c_str(),
                                mData->mUuid.toString().c_str(),
-                               mParent->settingsFilePath().c_str());
+                               mParent->i_settingsFilePath().c_str());
 
-            rc = loadMachineDataFromSettings(*mData->pMachineConfigFile,
-                                             NULL /* const Guid *puuidRegistry */);
+            rc = i_loadMachineDataFromSettings(*mData->pMachineConfigFile,
+                                               NULL /* const Guid *puuidRegistry */);
             if (FAILED(rc)) throw rc;
         }
         catch (HRESULT err)
@@ -742,7 +748,7 @@ HRESULT Machine::registeredInit()
         mData->mAccessible = TRUE;
 
         /* commit all changes made during loading the settings file */
-        commit(); // @todo r=dj why do we need a commit during init?!? this is very expensive
+        i_commit(); // @todo r=dj why do we need a commit during init?!? this is very expensive
         /// @todo r=klaus for some reason the settings loading logic backs up
         // the settings, and therefore a commit is needed. Should probably be changed.
     }
@@ -759,11 +765,11 @@ HRESULT Machine::registeredInit()
                     mData->mAccessError.getText().raw()));
 
         /* rollback all changes */
-        rollback(false /* aNotify */);
+        i_rollback(false /* aNotify */);
 
         // uninit media from this machine's media registry, or else
         // reloading the settings will fail
-        mParent->unregisterMachineMedia(getId());
+        mParent->i_unregisterMachineMedia(i_getId());
 
         /* uninitialize the common part to make sure all data is reset to
          * default (null) values */
@@ -799,7 +805,7 @@ void Machine::uninit()
         if (SUCCEEDED(autoCaller.rc()))
         {
             AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-            saveSettings(NULL, Machine::SaveS_Force);
+            i_saveSettings(NULL, Machine::SaveS_Force);
         }
     }
 
@@ -808,8 +814,8 @@ void Machine::uninit()
     if (autoUninitSpan.uninitDone())
         return;
 
-    Assert(!isSnapshotMachine());
-    Assert(!isSessionMachine());
+    Assert(!i_isSnapshotMachine());
+    Assert(!i_isSessionMachine());
     Assert(!!mData);
 
     LogFlowThisFunc(("initFailed()=%d\n", autoUninitSpan.initFailed()));
@@ -838,7 +844,7 @@ void Machine::uninit()
         {
             LogWarningThisFunc(("Setting state to Aborted!\n"));
             /* set machine state using SessionMachine reimplementation */
-            static_cast<Machine*>(mData->mSession.mMachine)->setMachineState(MachineState_Aborted);
+            static_cast<Machine*>(mData->mSession.mMachine)->i_setMachineState(MachineState_Aborted);
         }
 
         /*
@@ -851,7 +857,7 @@ void Machine::uninit()
     }
 
     // uninit media from this machine's media registry, if they're still there
-    Guid uuidMachine(getId());
+    Guid uuidMachine(i_getId());
 
     /* the lock is no more necessary (SessionMachine is uninitialized) */
     alock.release();
@@ -862,13 +868,13 @@ void Machine::uninit()
      * and therefore also removeBackReference() for all these mediums was not called! */
 
     if (uuidMachine.isValid() && !uuidMachine.isZero())     // can be empty if we're called from a failure of Machine::init
-        mParent->unregisterMachineMedia(uuidMachine);
+        mParent->i_unregisterMachineMedia(uuidMachine);
 
     // has machine been modified?
     if (mData->flModifications)
     {
         LogWarningThisFunc(("Discarding unsaved settings changes!\n"));
-        rollback(false /* aNotify */);
+        i_rollback(false /* aNotify */);
     }
 
     if (mData->mAccessible)
@@ -880,36 +886,24 @@ void Machine::uninit()
     LogFlowThisFuncLeave();
 }
 
-// IMachine properties
+// Wrapped IMachine properties
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP Machine::COMGETTER(Parent)(IVirtualBox **aParent)
+HRESULT Machine::getParent(ComPtr<IVirtualBox> &aParent)
 {
-    CheckComArgOutPointerValid(aParent);
-
-    AutoLimitedCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mParent is constant during life time, no need to lock */
     ComObjPtr<VirtualBox> pVirtualBox(mParent);
-    pVirtualBox.queryInterfaceTo(aParent);
+    aParent = pVirtualBox;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(Accessible)(BOOL *aAccessible)
-{
-    CheckComArgOutPointerValid(aAccessible);
-
-    AutoLimitedCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    LogFlowThisFunc(("ENTER\n"));
 
+HRESULT Machine::getAccessible(BOOL *aAccessible)
+{
     /* In some cases (medium registry related), it is necessary to be able to
      * go through the list of all machines. Happens when an inaccessible VM
      * has a sensible medium registry. */
-    AutoReadLock mllock(mParent->getMachinesListLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoReadLock mllock(mParent->i_getMachinesListLockHandle() COMMA_LOCKVAL_SRC_POS);
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
@@ -923,7 +917,7 @@ STDMETHODIMP Machine::COMGETTER(Accessible)(BOOL *aAccessible)
 
 #ifdef DEBUG
         LogFlowThisFunc(("Dumping media backreferences\n"));
-        mParent->dumpAllBackRefs();
+        mParent->i_dumpAllBackRefs();
 #endif
 
         if (mData->pMachineConfigFile)
@@ -934,7 +928,7 @@ STDMETHODIMP Machine::COMGETTER(Accessible)(BOOL *aAccessible)
             mData->pMachineConfigFile = NULL;
         }
 
-        rc = registeredInit();
+        rc = i_registeredInit();
 
         if (SUCCEEDED(rc) && mData->mAccessible)
         {
@@ -942,8 +936,8 @@ STDMETHODIMP Machine::COMGETTER(Accessible)(BOOL *aAccessible)
 
             /* make sure interesting parties will notice the accessibility
              * state change */
-            mParent->onMachineStateChange(mData->mUuid, mData->mMachineState);
-            mParent->onMachineDataChange(mData->mUuid);
+            mParent->i_onMachineStateChange(mData->mUuid, mData->mMachineState);
+            mParent->i_onMachineDataChange(mData->mUuid);
         }
     }
 
@@ -955,13 +949,8 @@ STDMETHODIMP Machine::COMGETTER(Accessible)(BOOL *aAccessible)
     return rc;
 }
 
-STDMETHODIMP Machine::COMGETTER(AccessError)(IVirtualBoxErrorInfo **aAccessError)
+HRESULT Machine::getAccessError(ComPtr<IVirtualBoxErrorInfo> &aAccessError)
 {
-    CheckComArgOutPointerValid(aAccessError);
-
-    AutoLimitedCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mData->mAccessible || !mData->mAccessError.isBasicAvailable())
@@ -981,33 +970,23 @@ STDMETHODIMP Machine::COMGETTER(AccessError)(IVirtualBoxErrorInfo **aAccessError
                         mData->mAccessError.getInterfaceID().ref(),
                         Utf8Str(mData->mAccessError.getComponent()).c_str(),
                         Utf8Str(mData->mAccessError.getText()));
-        rc = errorInfo.queryInterfaceTo(aAccessError);
+        aAccessError = errorInfo;
     }
 
     return rc;
 }
 
-STDMETHODIMP Machine::COMGETTER(Name)(BSTR *aName)
+HRESULT Machine::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mUserData->s.strName.cloneTo(aName);
+    aName = mUserData->s.strName;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(Name)(IN_BSTR aName)
+HRESULT Machine::setName(const com::Utf8Str &aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // prohibit setting a UUID only as the machine name, or else it can
     // never be found by findMachine()
     Guid test(aName);
@@ -1017,133 +996,96 @@ STDMETHODIMP Machine::COMSETTER(Name)(IN_BSTR aName)
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
     mUserData->s.strName = aName;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(Description)(BSTR *aDescription)
+HRESULT Machine::getDescription(com::Utf8Str &aDescription)
 {
-    CheckComArgOutPointerValid(aDescription);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mUserData->s.strDescription.cloneTo(aDescription);
+    aDescription = mUserData->s.strDescription;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(Description)(IN_BSTR aDescription)
+HRESULT Machine::setDescription(const com::Utf8Str &aDescription)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     // this can be done in principle in any state as it doesn't affect the VM
     // significantly, but play safe by not messing around while complex
     // activities are going on
-    HRESULT rc = checkStateDependency(MutableOrSavedStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
     mUserData->s.strDescription = aDescription;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(Id)(BSTR *aId)
+HRESULT Machine::getId(com::Guid &aId)
 {
-    CheckComArgOutPointerValid(aId);
-
-    AutoLimitedCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mUuid.toUtf16().cloneTo(aId);
+    aId = mData->mUuid;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(Groups)(ComSafeArrayOut(BSTR, aGroups))
+HRESULT Machine::getGroups(std::vector<com::Utf8Str> &aGroups)
 {
-    CheckComArgOutSafeArrayPointerValid(aGroups);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    SafeArray<BSTR> groups(mUserData->s.llGroups.size());
+    aGroups.resize(mUserData->s.llGroups.size());
     size_t i = 0;
     for (StringsList::const_iterator it = mUserData->s.llGroups.begin();
-         it != mUserData->s.llGroups.end();
-         ++it, i++)
-    {
-        Bstr tmp = *it;
-        tmp.cloneTo(&groups[i]);
-    }
-    groups.detachTo(ComSafeArrayOutArg(aGroups));
+         it != mUserData->s.llGroups.end(); ++it, ++i)
+        aGroups[i] = (*it);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(Groups)(ComSafeArrayIn(IN_BSTR, aGroups))
+HRESULT Machine::setGroups(const std::vector<com::Utf8Str> &aGroups)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     StringsList llGroups;
-    HRESULT rc = mParent->convertMachineGroups(ComSafeArrayInArg(aGroups), &llGroups);
+    HRESULT rc = mParent->i_convertMachineGroups(aGroups, &llGroups);
     if (FAILED(rc))
         return rc;
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    // changing machine groups is possible while the VM is offline
-    rc = checkStateDependency(OfflineStateDep);
+    rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
     mUserData->s.llGroups = llGroups;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(OSTypeId)(BSTR *aOSTypeId)
+HRESULT Machine::getOSTypeId(com::Utf8Str &aOSTypeId)
 {
-    CheckComArgOutPointerValid(aOSTypeId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mUserData->s.strOsType.cloneTo(aOSTypeId);
+    aOSTypeId = mUserData->s.strOsType;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(OSTypeId)(IN_BSTR aOSTypeId)
+HRESULT Machine::setOSTypeId(const com::Utf8Str &aOSTypeId)
 {
-    CheckComArgStrNotEmptyOrNull(aOSTypeId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* look up the object by Id to check it is valid */
     ComPtr<IGuestOSType> guestOSType;
-    HRESULT rc = mParent->GetGuestOSType(aOSTypeId, guestOSType.asOutParam());
+    HRESULT rc = mParent->GetGuestOSType(Bstr(aOSTypeId).raw(), guestOSType.asOutParam());
     if (FAILED(rc)) return rc;
 
     /* when setting, always use the "etalon" value for consistency -- lookup
@@ -1154,24 +1096,18 @@ STDMETHODIMP Machine::COMSETTER(OSTypeId)(IN_BSTR aOSTypeId)
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    rc = checkStateDependency(MutableStateDep);
+    rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
     mUserData->s.strOsType = osTypeId;
 
     return S_OK;
 }
 
-
-STDMETHODIMP Machine::COMGETTER(FirmwareType)(FirmwareType_T *aFirmwareType)
+HRESULT Machine::getFirmwareType(FirmwareType_T *aFirmwareType)
 {
-    CheckComArgOutPointerValid(aFirmwareType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aFirmwareType = mHWData->mFirmwareType;
@@ -1179,29 +1115,22 @@ STDMETHODIMP Machine::COMGETTER(FirmwareType)(FirmwareType_T *aFirmwareType)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(FirmwareType)(FirmwareType_T aFirmwareType)
+HRESULT Machine::setFirmwareType(FirmwareType_T aFirmwareType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mFirmwareType = aFirmwareType;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(KeyboardHIDType)(KeyboardHIDType_T *aKeyboardHIDType)
+HRESULT Machine::getKeyboardHIDType(KeyboardHIDType_T *aKeyboardHIDType)
 {
-    CheckComArgOutPointerValid(aKeyboardHIDType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aKeyboardHIDType = mHWData->mKeyboardHIDType;
@@ -1209,29 +1138,22 @@ STDMETHODIMP Machine::COMGETTER(KeyboardHIDType)(KeyboardHIDType_T *aKeyboardHID
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(KeyboardHIDType)(KeyboardHIDType_T  aKeyboardHIDType)
+HRESULT Machine::setKeyboardHIDType(KeyboardHIDType_T aKeyboardHIDType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mKeyboardHIDType = aKeyboardHIDType;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(PointingHIDType)(PointingHIDType_T *aPointingHIDType)
+HRESULT Machine::getPointingHIDType(PointingHIDType_T *aPointingHIDType)
 {
-    CheckComArgOutPointerValid(aPointingHIDType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aPointingHIDType = mHWData->mPointingHIDType;
@@ -1239,29 +1161,22 @@ STDMETHODIMP Machine::COMGETTER(PointingHIDType)(PointingHIDType_T *aPointingHID
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(PointingHIDType)(PointingHIDType_T  aPointingHIDType)
+HRESULT Machine::setPointingHIDType(PointingHIDType_T aPointingHIDType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mPointingHIDType = aPointingHIDType;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(ChipsetType)(ChipsetType_T *aChipsetType)
+HRESULT Machine::getChipsetType(ChipsetType_T *aChipsetType)
 {
-    CheckComArgOutPointerValid(aChipsetType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aChipsetType = mHWData->mChipsetType;
@@ -1269,18 +1184,16 @@ STDMETHODIMP Machine::COMGETTER(ChipsetType)(ChipsetType_T *aChipsetType)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(ChipsetType)(ChipsetType_T aChipsetType)
+HRESULT Machine::setChipsetType(ChipsetType_T aChipsetType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     if (aChipsetType != mHWData->mChipsetType)
     {
-        setModified(IsModified_MachineData);
+        i_setModified(IsModified_MachineData);
         mHWData.backup();
         mHWData->mChipsetType = aChipsetType;
 
@@ -1292,10 +1205,10 @@ STDMETHODIMP Machine::COMSETTER(ChipsetType)(ChipsetType_T aChipsetType)
         if (newCount > oldCount)
         {
             mNetworkAdapters.resize(newCount);
-            for (ULONG slot = oldCount; slot < mNetworkAdapters.size(); slot++)
+            for (size_t slot = oldCount; slot < mNetworkAdapters.size(); slot++)
             {
                 unconst(mNetworkAdapters[slot]).createObject();
-                mNetworkAdapters[slot]->init(this, slot);
+                mNetworkAdapters[slot]->init(this, (ULONG)slot);
             }
         }
     }
@@ -1303,262 +1216,338 @@ STDMETHODIMP Machine::COMSETTER(ChipsetType)(ChipsetType_T aChipsetType)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(HardwareVersion)(BSTR *aHWVersion)
+HRESULT Machine::getParavirtProvider(ParavirtProvider_T *aParavirtProvider)
 {
-    CheckComArgOutPointerValid(aHWVersion);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    *aParavirtProvider = mHWData->mParavirtProvider;
+
+    return S_OK;
+}
+
+HRESULT Machine::setParavirtProvider(ParavirtProvider_T aParavirtProvider)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
+    if (FAILED(rc)) return rc;
+
+    if (aParavirtProvider != mHWData->mParavirtProvider)
+    {
+        i_setModified(IsModified_MachineData);
+        mHWData.backup();
+        mHWData->mParavirtProvider = aParavirtProvider;
+    }
+
+    return S_OK;
+}
+
+HRESULT Machine::getEffectiveParavirtProvider(ParavirtProvider_T *aParavirtProvider)
+{
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aParavirtProvider = mHWData->mParavirtProvider;
+    switch (mHWData->mParavirtProvider)
+    {
+        case ParavirtProvider_None:
+        case ParavirtProvider_HyperV:
+        case ParavirtProvider_KVM:
+        case ParavirtProvider_Minimal:
+            break;
+
+        /* Resolve dynamic provider types to the effective types. */
+        default:
+        {
+            ComPtr<IGuestOSType> ptrGuestOSType;
+            HRESULT hrc2 = mParent->GetGuestOSType(Bstr(mUserData->s.strOsType).raw(), ptrGuestOSType.asOutParam());
+            AssertMsgReturn(SUCCEEDED(hrc2), ("Failed to get guest OS type. hrc2=%Rhrc\n", hrc2), hrc2);
+
+            Bstr guestTypeFamilyId;
+            hrc2 = ptrGuestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam());
+            AssertMsgReturn(SUCCEEDED(hrc2), ("Failed to get guest family. hrc2=%Rhrc\n", hrc2), hrc2);
+            BOOL fOsXGuest = guestTypeFamilyId == Bstr("MacOS");
+
+            switch (mHWData->mParavirtProvider)
+            {
+                case ParavirtProvider_Legacy:
+                {
+                    if (fOsXGuest)
+                        *aParavirtProvider = ParavirtProvider_Minimal;
+                    else
+                        *aParavirtProvider = ParavirtProvider_None;
+                    break;
+                }
+
+                case ParavirtProvider_Default:
+                {
+                    if (fOsXGuest)
+                        *aParavirtProvider = ParavirtProvider_Minimal;
+                    else if (   mUserData->s.strOsType == "Windows10"
+                             || mUserData->s.strOsType == "Windows10_64"
+                             || mUserData->s.strOsType == "Windows81"
+                             || mUserData->s.strOsType == "Windows81_64"
+                             || mUserData->s.strOsType == "Windows8"
+                             || mUserData->s.strOsType == "Windows8_64"
+                             || mUserData->s.strOsType == "Windows7"
+                             || mUserData->s.strOsType == "Windows7_64"
+                             || mUserData->s.strOsType == "WindowsVista"
+                             || mUserData->s.strOsType == "WindowsVista_64"
+                             || mUserData->s.strOsType == "Windows2012"
+                             || mUserData->s.strOsType == "Windows2012_64"
+                             || mUserData->s.strOsType == "Windows2008"
+                             || mUserData->s.strOsType == "Windows2008_64")
+                    {
+                        *aParavirtProvider = ParavirtProvider_HyperV;
+                    }
+                    else if (   mUserData->s.strOsType == "Linux26"      // Linux22 and Linux24 omitted as they're too old
+                             || mUserData->s.strOsType == "Linux26_64"   // for having any KVM paravirtualization support.
+                             || mUserData->s.strOsType == "Linux"
+                             || mUserData->s.strOsType == "Linux_64"
+                             || mUserData->s.strOsType == "ArchLinux"
+                             || mUserData->s.strOsType == "ArchLinux_64"
+                             || mUserData->s.strOsType == "Debian"
+                             || mUserData->s.strOsType == "Debian_64"
+                             || mUserData->s.strOsType == "Fedora"
+                             || mUserData->s.strOsType == "Fedora_64"
+                             || mUserData->s.strOsType == "Gentoo"
+                             || mUserData->s.strOsType == "Gentoo_64"
+                             || mUserData->s.strOsType == "Mandriva"
+                             || mUserData->s.strOsType == "Mandriva_64"
+                             || mUserData->s.strOsType == "OpenSUSE"
+                             || mUserData->s.strOsType == "OpenSUSE_64"
+                             || mUserData->s.strOsType == "Oracle"
+                             || mUserData->s.strOsType == "Oracle_64"
+                             || mUserData->s.strOsType == "RedHat"
+                             || mUserData->s.strOsType == "RedHat_64"
+                             || mUserData->s.strOsType == "Turbolinux"
+                             || mUserData->s.strOsType == "Turbolinux_64"
+                             || mUserData->s.strOsType == "Ubuntu"
+                             || mUserData->s.strOsType == "Ubuntu_64"
+                             || mUserData->s.strOsType == "Xandros"
+                             || mUserData->s.strOsType == "Xandros_64")
+                    {
+                        *aParavirtProvider = ParavirtProvider_KVM;
+                    }
+                    else
+                        *aParavirtProvider = ParavirtProvider_None;
+                    break;
+                }
+            }
+            break;
+        }
+    }
+
+    Assert(   *aParavirtProvider == ParavirtProvider_None
+           || *aParavirtProvider == ParavirtProvider_Minimal
+           || *aParavirtProvider == ParavirtProvider_HyperV
+           || *aParavirtProvider == ParavirtProvider_KVM);
+    return S_OK;
+}
 
+HRESULT Machine::getHardwareVersion(com::Utf8Str &aHardwareVersion)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mHWData->mHWVersion.cloneTo(aHWVersion);
+    aHardwareVersion = mHWData->mHWVersion;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(HardwareVersion)(IN_BSTR aHWVersion)
+HRESULT Machine::setHardwareVersion(const com::Utf8Str &aHardwareVersion)
 {
     /* check known version */
-    Utf8Str hwVersion = aHWVersion;
+    Utf8Str hwVersion = aHardwareVersion;
     if (    hwVersion.compare("1") != 0
         &&  hwVersion.compare("2") != 0)
         return setError(E_INVALIDARG,
-                        tr("Invalid hardware version: %ls\n"), aHWVersion);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+                        tr("Invalid hardware version: %s\n"), aHardwareVersion.c_str());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mHWVersion = hwVersion;
+    mHWData->mHWVersion = aHardwareVersion;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(HardwareUUID)(BSTR *aUUID)
+HRESULT Machine::getHardwareUUID(com::Guid &aHardwareUUID)
 {
-    CheckComArgOutPointerValid(aUUID);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (!mHWData->mHardwareUUID.isZero())
-        mHWData->mHardwareUUID.toUtf16().cloneTo(aUUID);
+        aHardwareUUID = mHWData->mHardwareUUID;
     else
-        mData->mUuid.toUtf16().cloneTo(aUUID);
+        aHardwareUUID = mData->mUuid;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(HardwareUUID)(IN_BSTR aUUID)
+HRESULT Machine::setHardwareUUID(const com::Guid &aHardwareUUID)
 {
-    Guid hardwareUUID(aUUID);
-    if (!hardwareUUID.isValid())
+    if (!aHardwareUUID.isValid())
         return E_INVALIDARG;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    if (hardwareUUID == mData->mUuid)
+    if (aHardwareUUID == mData->mUuid)
         mHWData->mHardwareUUID.clear();
     else
-        mHWData->mHardwareUUID = hardwareUUID;
+        mHWData->mHardwareUUID = aHardwareUUID;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(MemorySize)(ULONG *memorySize)
+HRESULT Machine::getMemorySize(ULONG *aMemorySize)
 {
-    CheckComArgOutPointerValid(memorySize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *memorySize = mHWData->mMemorySize;
+    *aMemorySize = mHWData->mMemorySize;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(MemorySize)(ULONG memorySize)
+HRESULT Machine::setMemorySize(ULONG aMemorySize)
 {
     /* check RAM limits */
-    if (    memorySize < MM_RAM_MIN_IN_MB
-         || memorySize > MM_RAM_MAX_IN_MB
+    if (    aMemorySize < MM_RAM_MIN_IN_MB
+         || aMemorySize > MM_RAM_MAX_IN_MB
        )
         return setError(E_INVALIDARG,
                         tr("Invalid RAM size: %lu MB (must be in range [%lu, %lu] MB)"),
-                        memorySize, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+                        aMemorySize, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mMemorySize = memorySize;
+    mHWData->mMemorySize = aMemorySize;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(CPUCount)(ULONG *CPUCount)
+HRESULT Machine::getCPUCount(ULONG *aCPUCount)
 {
-    CheckComArgOutPointerValid(CPUCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *CPUCount = mHWData->mCPUCount;
+    *aCPUCount = mHWData->mCPUCount;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(CPUCount)(ULONG CPUCount)
+HRESULT Machine::setCPUCount(ULONG aCPUCount)
 {
     /* check CPU limits */
-    if (    CPUCount < SchemaDefs::MinCPUCount
-         || CPUCount > SchemaDefs::MaxCPUCount
+    if (    aCPUCount < SchemaDefs::MinCPUCount
+         || aCPUCount > SchemaDefs::MaxCPUCount
        )
         return setError(E_INVALIDARG,
                         tr("Invalid virtual CPU count: %lu (must be in range [%lu, %lu])"),
-                        CPUCount, SchemaDefs::MinCPUCount, SchemaDefs::MaxCPUCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+                        aCPUCount, SchemaDefs::MinCPUCount, SchemaDefs::MaxCPUCount);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* We cant go below the current number of CPUs attached if hotplug is enabled*/
     if (mHWData->mCPUHotPlugEnabled)
     {
-        for (unsigned idx = CPUCount; idx < SchemaDefs::MaxCPUCount; idx++)
+        for (unsigned idx = aCPUCount; idx < SchemaDefs::MaxCPUCount; idx++)
         {
             if (mHWData->mCPUAttached[idx])
                 return setError(E_INVALIDARG,
                                 tr("There is still a CPU attached to socket %lu."
                                    "Detach the CPU before removing the socket"),
-                                CPUCount, idx+1);
+                                aCPUCount, idx+1);
         }
     }
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mCPUCount = CPUCount;
+    mHWData->mCPUCount = aCPUCount;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(CPUExecutionCap)(ULONG *aExecutionCap)
+HRESULT Machine::getCPUExecutionCap(ULONG *aCPUExecutionCap)
 {
-    CheckComArgOutPointerValid(aExecutionCap);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aExecutionCap = mHWData->mCpuExecutionCap;
+    *aCPUExecutionCap = mHWData->mCpuExecutionCap;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(CPUExecutionCap)(ULONG aExecutionCap)
+HRESULT Machine::setCPUExecutionCap(ULONG aCPUExecutionCap)
 {
     HRESULT rc = S_OK;
 
     /* check throttle limits */
-    if (    aExecutionCap < 1
-         || aExecutionCap > 100
+    if (    aCPUExecutionCap < 1
+         || aCPUExecutionCap > 100
        )
         return setError(E_INVALIDARG,
                         tr("Invalid CPU execution cap value: %lu (must be in range [%lu, %lu])"),
-                        aExecutionCap, 1, 100);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+                        aCPUExecutionCap, 1, 100);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     alock.release();
-    rc = onCPUExecutionCapChange(aExecutionCap);
+    rc = i_onCPUExecutionCapChange(aCPUExecutionCap);
     alock.acquire();
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mCpuExecutionCap = aExecutionCap;
+    mHWData->mCpuExecutionCap = aCPUExecutionCap;
 
     /** Save settings if online - @todo why is this required? -- @bugref{6818} */
     if (Global::IsOnline(mData->mMachineState))
-        saveSettings(NULL);
+        i_saveSettings(NULL);
 
     return S_OK;
 }
 
-
-STDMETHODIMP Machine::COMGETTER(CPUHotPlugEnabled)(BOOL *aEnabled)
+HRESULT Machine::getCPUHotPlugEnabled(BOOL *aCPUHotPlugEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mHWData->mCPUHotPlugEnabled;
+    *aCPUHotPlugEnabled = mHWData->mCPUHotPlugEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(CPUHotPlugEnabled)(BOOL aEnabled)
+HRESULT Machine::setCPUHotPlugEnabled(BOOL aCPUHotPlugEnabled)
 {
     HRESULT rc = S_OK;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    rc = checkStateDependency(MutableStateDep);
+    rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    if (mHWData->mCPUHotPlugEnabled != aEnabled)
+    if (mHWData->mCPUHotPlugEnabled != aCPUHotPlugEnabled)
     {
-        if (aEnabled)
+        if (aCPUHotPlugEnabled)
         {
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
 
             /* Add the amount of CPUs currently attached */
-            for (unsigned i = 0; i < mHWData->mCPUCount; i++)
-            {
+            for (unsigned i = 0; i < mHWData->mCPUCount; ++i)
                 mHWData->mCPUAttached[i] = true;
-            }
         }
         else
         {
@@ -1569,7 +1558,7 @@ STDMETHODIMP Machine::COMSETTER(CPUHotPlugEnabled)(BOOL aEnabled)
             unsigned cCpusAttached = 0;
             unsigned iHighestId = 0;
 
-            for (unsigned i = 0; i < SchemaDefs::MaxCPUCount; i++)
+            for (unsigned i = 0; i < SchemaDefs::MaxCPUCount; ++i)
             {
                 if (mHWData->mCPUAttached[i])
                 {
@@ -1583,118 +1572,123 @@ STDMETHODIMP Machine::COMSETTER(CPUHotPlugEnabled)(BOOL aEnabled)
                 return setError(E_INVALIDARG,
                                 tr("CPU hotplugging can't be disabled because the maximum number of CPUs is not equal to the amount of CPUs attached"));
 
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
         }
     }
 
-    mHWData->mCPUHotPlugEnabled = aEnabled;
+    mHWData->mCPUHotPlugEnabled = aCPUHotPlugEnabled;
 
     return rc;
 }
 
-STDMETHODIMP Machine::COMGETTER(EmulatedUSBCardReaderEnabled)(BOOL *aEnabled)
+HRESULT Machine::getCPUIDPortabilityLevel(ULONG *aCPUIDPortabilityLevel)
 {
-#ifdef VBOX_WITH_USB_CARDREADER
-    CheckComArgOutPointerValid(aEnabled);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    *aCPUIDPortabilityLevel = mHWData->mCpuIdPortabilityLevel;
 
+    return S_OK;
+}
+
+HRESULT Machine::setCPUIDPortabilityLevel(ULONG aCPUIDPortabilityLevel)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT hrc = i_checkStateDependency(MutableStateDep);
+    if (SUCCEEDED(hrc))
+    {
+        i_setModified(IsModified_MachineData);
+        mHWData.backup();
+        mHWData->mCpuIdPortabilityLevel = aCPUIDPortabilityLevel;
+    }
+    return hrc;
+}
+
+HRESULT Machine::getEmulatedUSBCardReaderEnabled(BOOL *aEmulatedUSBCardReaderEnabled)
+{
+#ifdef VBOX_WITH_USB_CARDREADER
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mHWData->mEmulatedUSBCardReaderEnabled;
+    *aEmulatedUSBCardReaderEnabled = mHWData->mEmulatedUSBCardReaderEnabled;
 
     return S_OK;
 #else
-    NOREF(aEnabled);
+    NOREF(aEmulatedUSBCardReaderEnabled);
     return E_NOTIMPL;
 #endif
 }
 
-STDMETHODIMP Machine::COMSETTER(EmulatedUSBCardReaderEnabled)(BOOL aEnabled)
+HRESULT Machine::setEmulatedUSBCardReaderEnabled(BOOL aEmulatedUSBCardReaderEnabled)
 {
 #ifdef VBOX_WITH_USB_CARDREADER
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mEmulatedUSBCardReaderEnabled = aEnabled;
+    mHWData->mEmulatedUSBCardReaderEnabled = aEmulatedUSBCardReaderEnabled;
 
     return S_OK;
 #else
-    NOREF(aEnabled);
+    NOREF(aEmulatedUSBCardReaderEnabled);
     return E_NOTIMPL;
 #endif
 }
 
-STDMETHODIMP Machine::COMGETTER(HPETEnabled)(BOOL *aEnabled)
+HRESULT Machine::getHPETEnabled(BOOL *aHPETEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mHWData->mHPETEnabled;
+    *aHPETEnabled = mHWData->mHPETEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(HPETEnabled)(BOOL aEnabled)
+HRESULT Machine::setHPETEnabled(BOOL aHPETEnabled)
 {
     HRESULT rc = S_OK;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    rc = checkStateDependency(MutableStateDep);
+    rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
 
-    mHWData->mHPETEnabled = aEnabled;
+    mHWData->mHPETEnabled = aHPETEnabled;
 
     return rc;
 }
 
-STDMETHODIMP Machine::COMGETTER(VideoCaptureEnabled)(BOOL *fEnabled)
+HRESULT Machine::getVideoCaptureEnabled(BOOL *aVideoCaptureEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *fEnabled = mHWData->mVideoCaptureEnabled;
+    *aVideoCaptureEnabled = mHWData->mVideoCaptureEnabled;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(VideoCaptureEnabled)(BOOL fEnabled)
+HRESULT Machine::setVideoCaptureEnabled(BOOL aVideoCaptureEnabled)
 {
     HRESULT rc = S_OK;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mVideoCaptureEnabled = fEnabled;
+    mHWData->mVideoCaptureEnabled = aVideoCaptureEnabled;
 
     alock.release();
-    rc = onVideoCaptureChange();
+    rc = i_onVideoCaptureChange();
     alock.acquire();
     if (FAILED(rc))
     {
         /*
-         * Normally we would do the actual change _after_ onVideoCaptureChange() succeeded.
+         * Normally we would do the actual change _after_ i_onVideoCaptureChange() succeeded.
          * We cannot do this because that function uses Machine::GetVideoCaptureEnabled to
          * determine if it should start or stop capturing. Therefore we need to manually
          * undo change.
@@ -1705,82 +1699,64 @@ STDMETHODIMP Machine::COMSETTER(VideoCaptureEnabled)(BOOL fEnabled)
 
     /** Save settings if online - @todo why is this required? -- @bugref{6818} */
     if (Global::IsOnline(mData->mMachineState))
-        saveSettings(NULL);
+        i_saveSettings(NULL);
 
     return rc;
 }
 
-STDMETHODIMP Machine::COMGETTER(VideoCaptureScreens)(ComSafeArrayOut(BOOL, aScreens))
+HRESULT Machine::getVideoCaptureScreens(std::vector<BOOL> &aVideoCaptureScreens)
 {
-    CheckComArgOutSafeArrayPointerValid(aScreens);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    SafeArray<BOOL> screens(mHWData->mMonitorCount);
-    for (unsigned i = 0; i < screens.size(); i++)
-        screens[i] = mHWData->maVideoCaptureScreens[i];
-    screens.detachTo(ComSafeArrayOutArg(aScreens));
+    aVideoCaptureScreens.resize(mHWData->mMonitorCount);
+    for (unsigned i = 0; i < mHWData->mMonitorCount; ++i)
+        aVideoCaptureScreens[i] = mHWData->maVideoCaptureScreens[i];
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(VideoCaptureScreens)(ComSafeArrayIn(BOOL, aScreens))
+HRESULT Machine::setVideoCaptureScreens(const std::vector<BOOL> &aVideoCaptureScreens)
 {
-    SafeArray<BOOL> screens(ComSafeArrayInArg(aScreens));
-    AssertReturn(screens.size() <= RT_ELEMENTS(mHWData->maVideoCaptureScreens), E_INVALIDARG);
+    AssertReturn(aVideoCaptureScreens.size() <= RT_ELEMENTS(mHWData->maVideoCaptureScreens), E_INVALIDARG);
     bool fChanged = false;
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    for (unsigned i = 0; i < screens.size(); i++)
+    for (unsigned i = 0; i < aVideoCaptureScreens.size(); ++i)
     {
-        if (mHWData->maVideoCaptureScreens[i] != RT_BOOL(screens[i]))
+        if (mHWData->maVideoCaptureScreens[i] != RT_BOOL(aVideoCaptureScreens[i]))
         {
-            mHWData->maVideoCaptureScreens[i] = RT_BOOL(screens[i]);
+            mHWData->maVideoCaptureScreens[i] = RT_BOOL(aVideoCaptureScreens[i]);
             fChanged = true;
         }
     }
     if (fChanged)
     {
         alock.release();
-        HRESULT rc = onVideoCaptureChange();
+        HRESULT rc = i_onVideoCaptureChange();
         alock.acquire();
         if (FAILED(rc)) return rc;
-        setModified(IsModified_MachineData);
+        i_setModified(IsModified_MachineData);
 
         /** Save settings if online - @todo why is this required? -- @bugref{6818} */
         if (Global::IsOnline(mData->mMachineState))
-            saveSettings(NULL);
+            i_saveSettings(NULL);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(VideoCaptureFile)(BSTR *apFile)
+HRESULT Machine::getVideoCaptureFile(com::Utf8Str &aVideoCaptureFile)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     if (mHWData->mVideoCaptureFile.isEmpty())
-    {
-        Utf8Str defaultFile;
-        getDefaultVideoCaptureFile(defaultFile);
-        defaultFile.cloneTo(apFile);
-    }
+        i_getDefaultVideoCaptureFile(aVideoCaptureFile);
     else
-        mHWData->mVideoCaptureFile.cloneTo(apFile);
+        aVideoCaptureFile = mHWData->mVideoCaptureFile;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(VideoCaptureFile)(IN_BSTR aFile)
+HRESULT Machine::setVideoCaptureFile(const com::Utf8Str &aVideoCaptureFile)
 {
-    Utf8Str strFile(aFile);
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
+    Utf8Str strFile(aVideoCaptureFile);
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   Global::IsOnline(mData->mMachineState)
@@ -1793,148 +1769,186 @@ STDMETHODIMP Machine::COMSETTER(VideoCaptureFile)(IN_BSTR aFile)
     if (!strFile.isEmpty())
     {
         Utf8Str defaultFile;
-        getDefaultVideoCaptureFile(defaultFile);
+        i_getDefaultVideoCaptureFile(defaultFile);
         if (!RTPathCompare(strFile.c_str(), defaultFile.c_str()))
             strFile.setNull();
     }
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mVideoCaptureFile = strFile;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(VideoCaptureWidth)(ULONG *aHorzRes)
+HRESULT Machine::getVideoCaptureWidth(ULONG *aVideoCaptureWidth)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    *aHorzRes = mHWData->mVideoCaptureWidth;
+    *aVideoCaptureWidth = mHWData->mVideoCaptureWidth;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(VideoCaptureWidth)(ULONG aHorzRes)
+HRESULT Machine::setVideoCaptureWidth(ULONG aVideoCaptureWidth)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   Global::IsOnline(mData->mMachineState)
         && mHWData->mVideoCaptureEnabled)
         return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled"));
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mVideoCaptureWidth = aHorzRes;
+    mHWData->mVideoCaptureWidth = aVideoCaptureWidth;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(VideoCaptureHeight)(ULONG *aVertRes)
+HRESULT Machine::getVideoCaptureHeight(ULONG *aVideoCaptureHeight)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-     *aVertRes = mHWData->mVideoCaptureHeight;
+    *aVideoCaptureHeight = mHWData->mVideoCaptureHeight;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(VideoCaptureHeight)(ULONG aVertRes)
+HRESULT Machine::setVideoCaptureHeight(ULONG aVideoCaptureHeight)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   Global::IsOnline(mData->mMachineState)
         && mHWData->mVideoCaptureEnabled)
         return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled"));
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mVideoCaptureHeight = aVertRes;
+    mHWData->mVideoCaptureHeight = aVideoCaptureHeight;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(VideoCaptureRate)(ULONG *aRate)
+HRESULT Machine::getVideoCaptureRate(ULONG *aVideoCaptureRate)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-     *aRate = mHWData->mVideoCaptureRate;
+    *aVideoCaptureRate = mHWData->mVideoCaptureRate;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(VideoCaptureRate)(ULONG aRate)
+HRESULT Machine::setVideoCaptureRate(ULONG aVideoCaptureRate)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   Global::IsOnline(mData->mMachineState)
         && mHWData->mVideoCaptureEnabled)
         return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled"));
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mVideoCaptureRate = aRate;
+    mHWData->mVideoCaptureRate = aVideoCaptureRate;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(VideoCaptureFPS)(ULONG *aFPS)
+HRESULT Machine::getVideoCaptureFPS(ULONG *aVideoCaptureFPS)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-     *aFPS = mHWData->mVideoCaptureFPS;
+    *aVideoCaptureFPS = mHWData->mVideoCaptureFPS;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(VideoCaptureFPS)(ULONG aFPS)
+HRESULT Machine::setVideoCaptureFPS(ULONG aVideoCaptureFPS)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (   Global::IsOnline(mData->mMachineState)
         && mHWData->mVideoCaptureEnabled)
         return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled"));
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mVideoCaptureFPS = aFPS;
+    mHWData->mVideoCaptureFPS = aVideoCaptureFPS;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(GraphicsControllerType)(GraphicsControllerType_T *aGraphicsControllerType)
+HRESULT Machine::getVideoCaptureMaxTime(ULONG *aVideoCaptureMaxTime)
 {
-    CheckComArgOutPointerValid(aGraphicsControllerType);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    *aVideoCaptureMaxTime = mHWData->mVideoCaptureMaxTime;
+    return S_OK;
+}
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT Machine::setVideoCaptureMaxTime(ULONG aVideoCaptureMaxTime)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    if (   Global::IsOnline(mData->mMachineState)
+        && mHWData->mVideoCaptureEnabled)
+        return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled"));
 
-    *aGraphicsControllerType = mHWData->mGraphicsControllerType;
+    i_setModified(IsModified_MachineData);
+    mHWData.backup();
+    mHWData->mVideoCaptureMaxTime = aVideoCaptureMaxTime;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(GraphicsControllerType)(GraphicsControllerType_T aGraphicsControllerType)
+HRESULT Machine::getVideoCaptureMaxFileSize(ULONG *aVideoCaptureMaxFileSize)
 {
-    switch (aGraphicsControllerType)
-    {
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    *aVideoCaptureMaxFileSize = mHWData->mVideoCaptureMaxFileSize;
+    return S_OK;
+}
+
+HRESULT Machine::setVideoCaptureMaxFileSize(ULONG aVideoCaptureMaxFileSize)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (   Global::IsOnline(mData->mMachineState)
+        && mHWData->mVideoCaptureEnabled)
+        return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled"));
+
+    i_setModified(IsModified_MachineData);
+    mHWData.backup();
+    mHWData->mVideoCaptureMaxFileSize = aVideoCaptureMaxFileSize;
+
+    return S_OK;
+}
+
+HRESULT Machine::getVideoCaptureOptions(com::Utf8Str &aVideoCaptureOptions)
+{
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    aVideoCaptureOptions = mHWData->mVideoCaptureOptions;
+    return S_OK;
+}
+
+HRESULT Machine::setVideoCaptureOptions(const com::Utf8Str &aVideoCaptureOptions)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    if (   Global::IsOnline(mData->mMachineState)
+        && mHWData->mVideoCaptureEnabled)
+        return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled"));
+
+    i_setModified(IsModified_MachineData);
+    mHWData.backup();
+    mHWData->mVideoCaptureOptions = aVideoCaptureOptions;
+
+    return S_OK;
+}
+
+HRESULT Machine::getGraphicsControllerType(GraphicsControllerType_T *aGraphicsControllerType)
+{
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aGraphicsControllerType = mHWData->mGraphicsControllerType;
+
+    return S_OK;
+}
+
+HRESULT Machine::setGraphicsControllerType(GraphicsControllerType_T aGraphicsControllerType)
+{
+    switch (aGraphicsControllerType)
+    {
         case GraphicsControllerType_Null:
         case GraphicsControllerType_VBoxVGA:
 #ifdef VBOX_WITH_VMSVGA
@@ -1945,70 +1959,54 @@ STDMETHODIMP Machine::COMSETTER(GraphicsControllerType)(GraphicsControllerType_T
             return setError(E_INVALIDARG, tr("The graphics controller type (%d) is invalid"), aGraphicsControllerType);
     }
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mGraphicsControllerType = aGraphicsControllerType;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(VRAMSize)(ULONG *memorySize)
+HRESULT Machine::getVRAMSize(ULONG *aVRAMSize)
 {
-    CheckComArgOutPointerValid(memorySize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *memorySize = mHWData->mVRAMSize;
+    *aVRAMSize = mHWData->mVRAMSize;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(VRAMSize)(ULONG memorySize)
+HRESULT Machine::setVRAMSize(ULONG aVRAMSize)
 {
     /* check VRAM limits */
-    if (memorySize < SchemaDefs::MinGuestVRAM ||
-        memorySize > SchemaDefs::MaxGuestVRAM)
+    if (aVRAMSize < SchemaDefs::MinGuestVRAM ||
+        aVRAMSize > SchemaDefs::MaxGuestVRAM)
         return setError(E_INVALIDARG,
                         tr("Invalid VRAM size: %lu MB (must be in range [%lu, %lu] MB)"),
-                        memorySize, SchemaDefs::MinGuestVRAM, SchemaDefs::MaxGuestVRAM);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+                        aVRAMSize, SchemaDefs::MinGuestVRAM, SchemaDefs::MaxGuestVRAM);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mVRAMSize = memorySize;
+    mHWData->mVRAMSize = aVRAMSize;
 
     return S_OK;
 }
 
 /** @todo this method should not be public */
-STDMETHODIMP Machine::COMGETTER(MemoryBalloonSize)(ULONG *memoryBalloonSize)
+HRESULT Machine::getMemoryBalloonSize(ULONG *aMemoryBalloonSize)
 {
-    CheckComArgOutPointerValid(memoryBalloonSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *memoryBalloonSize = mHWData->mMemoryBalloonSize;
+    *aMemoryBalloonSize = mHWData->mMemoryBalloonSize;
 
     return S_OK;
 }
@@ -2019,212 +2017,162 @@ STDMETHODIMP Machine::COMGETTER(MemoryBalloonSize)(ULONG *memoryBalloonSize)
  * This method is also called from IGuest::COMSETTER(MemoryBalloonSize) so
  * we have to make sure that we never call IGuest from here.
  */
-STDMETHODIMP Machine::COMSETTER(MemoryBalloonSize)(ULONG memoryBalloonSize)
+HRESULT Machine::setMemoryBalloonSize(ULONG aMemoryBalloonSize)
 {
     /* This must match GMMR0Init; currently we only support memory ballooning on all 64-bit hosts except Mac OS X */
 #if HC_ARCH_BITS == 64 && (defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD))
     /* check limits */
-    if (memoryBalloonSize >= VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize))
+    if (aMemoryBalloonSize >= VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize))
         return setError(E_INVALIDARG,
                         tr("Invalid memory balloon size: %lu MB (must be in range [%lu, %lu] MB)"),
-                        memoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+                        aMemoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON(mHWData->mMemorySize));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mMemoryBalloonSize = memoryBalloonSize;
+    mHWData->mMemoryBalloonSize = aMemoryBalloonSize;
 
     return S_OK;
 #else
-    NOREF(memoryBalloonSize);
+    NOREF(aMemoryBalloonSize);
     return setError(E_NOTIMPL, tr("Memory ballooning is only supported on 64-bit hosts"));
 #endif
 }
 
-STDMETHODIMP Machine::COMGETTER(PageFusionEnabled) (BOOL *aEnabled)
+HRESULT Machine::getPageFusionEnabled(BOOL *aPageFusionEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mHWData->mPageFusionEnabled;
+    *aPageFusionEnabled = mHWData->mPageFusionEnabled;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(PageFusionEnabled) (BOOL aEnabled)
+HRESULT Machine::setPageFusionEnabled(BOOL aPageFusionEnabled)
 {
 #ifdef VBOX_WITH_PAGE_SHARING
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /** @todo must support changes for running vms and keep this in sync with IGuest. */
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mPageFusionEnabled = aEnabled;
+    mHWData->mPageFusionEnabled = aPageFusionEnabled;
     return S_OK;
 #else
-    NOREF(aEnabled);
+    NOREF(aPageFusionEnabled);
     return setError(E_NOTIMPL, tr("Page fusion is only supported on 64-bit hosts"));
 #endif
 }
 
-STDMETHODIMP Machine::COMGETTER(Accelerate3DEnabled)(BOOL *aEnabled)
+HRESULT Machine::getAccelerate3DEnabled(BOOL *aAccelerate3DEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mHWData->mAccelerate3DEnabled;
+    *aAccelerate3DEnabled = mHWData->mAccelerate3DEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(Accelerate3DEnabled)(BOOL enable)
+HRESULT Machine::setAccelerate3DEnabled(BOOL aAccelerate3DEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     /** @todo check validity! */
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mAccelerate3DEnabled = enable;
+    mHWData->mAccelerate3DEnabled = aAccelerate3DEnabled;
 
     return S_OK;
 }
 
 
-STDMETHODIMP Machine::COMGETTER(Accelerate2DVideoEnabled)(BOOL *aEnabled)
+HRESULT Machine::getAccelerate2DVideoEnabled(BOOL *aAccelerate2DVideoEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mHWData->mAccelerate2DVideoEnabled;
+    *aAccelerate2DVideoEnabled = mHWData->mAccelerate2DVideoEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(Accelerate2DVideoEnabled)(BOOL enable)
+HRESULT Machine::setAccelerate2DVideoEnabled(BOOL aAccelerate2DVideoEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     /** @todo check validity! */
-
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mAccelerate2DVideoEnabled = enable;
+    mHWData->mAccelerate2DVideoEnabled = aAccelerate2DVideoEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(MonitorCount)(ULONG *monitorCount)
+HRESULT Machine::getMonitorCount(ULONG *aMonitorCount)
 {
-    CheckComArgOutPointerValid(monitorCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *monitorCount = mHWData->mMonitorCount;
+    *aMonitorCount = mHWData->mMonitorCount;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(MonitorCount)(ULONG monitorCount)
+HRESULT Machine::setMonitorCount(ULONG aMonitorCount)
 {
     /* make sure monitor count is a sensible number */
-    if (monitorCount < 1 || monitorCount > SchemaDefs::MaxGuestMonitors)
+    if (aMonitorCount < 1 || aMonitorCount > SchemaDefs::MaxGuestMonitors)
         return setError(E_INVALIDARG,
                         tr("Invalid monitor count: %lu (must be in range [%lu, %lu])"),
-                        monitorCount, 1, SchemaDefs::MaxGuestMonitors);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+                        aMonitorCount, 1, SchemaDefs::MaxGuestMonitors);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mMonitorCount = monitorCount;
+    mHWData->mMonitorCount = aMonitorCount;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(BIOSSettings)(IBIOSSettings **biosSettings)
+HRESULT Machine::getBIOSSettings(ComPtr<IBIOSSettings> &aBIOSSettings)
 {
-    CheckComArgOutPointerValid(biosSettings);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mBIOSSettings is constant during life time, no need to lock */
-    mBIOSSettings.queryInterfaceTo(biosSettings);
+    aBIOSSettings = mBIOSSettings;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetCPUProperty(CPUPropertyType_T property, BOOL *aVal)
+HRESULT Machine::getCPUProperty(CPUPropertyType_T aProperty, BOOL *aValue)
 {
-    CheckComArgOutPointerValid(aVal);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    switch (property)
+    switch (aProperty)
     {
         case CPUPropertyType_PAE:
-            *aVal = mHWData->mPAEEnabled;
-            break;
-
-        case CPUPropertyType_Synthetic:
-            *aVal = mHWData->mSyntheticCpu;
+            *aValue = mHWData->mPAEEnabled;
             break;
 
         case CPUPropertyType_LongMode:
             if (mHWData->mLongMode == settings::Hardware::LongMode_Enabled)
-                *aVal = TRUE;
+                *aValue = TRUE;
             else if (mHWData->mLongMode == settings::Hardware::LongMode_Disabled)
-                *aVal = FALSE;
+                *aValue = FALSE;
 #if HC_ARCH_BITS == 64
             else
-                *aVal = TRUE;
+                *aValue = TRUE;
 #else
             else
             {
-                *aVal = FALSE;
+                *aValue = FALSE;
 
                 ComPtr<IGuestOSType> ptrGuestOSType;
                 HRESULT hrc2 = mParent->GetGuestOSType(Bstr(mUserData->s.strOsType).raw(), ptrGuestOSType.asOutParam());
@@ -2234,12 +2182,12 @@ STDMETHODIMP Machine::GetCPUProperty(CPUPropertyType_T property, BOOL *aVal)
                     hrc2 = ptrGuestOSType->COMGETTER(Is64Bit)(&fIs64Bit); AssertComRC(hrc2);
                     if (SUCCEEDED(hrc2) && fIs64Bit)
                     {
-                        ComObjPtr<Host> ptrHost = mParent->host();
+                        ComObjPtr<Host> ptrHost = mParent->i_host();
                         alock.release();
 
-                        hrc2 = ptrHost->GetProcessorFeature(ProcessorFeature_LongMode, aVal); AssertComRC(hrc2);
+                        hrc2 = ptrHost->GetProcessorFeature(ProcessorFeature_LongMode, aValue); AssertComRC(hrc2);
                         if (FAILED(hrc2))
-                            *aVal = FALSE;
+                            *aValue = FALSE;
                     }
                 }
             }
@@ -2247,7 +2195,7 @@ STDMETHODIMP Machine::GetCPUProperty(CPUPropertyType_T property, BOOL *aVal)
             break;
 
         case CPUPropertyType_TripleFaultReset:
-            *aVal = mHWData->mTripleFaultReset;
+            *aValue = mHWData->mTripleFaultReset;
             break;
 
         default:
@@ -2256,40 +2204,31 @@ STDMETHODIMP Machine::GetCPUProperty(CPUPropertyType_T property, BOOL *aVal)
     return S_OK;
 }
 
-STDMETHODIMP Machine::SetCPUProperty(CPUPropertyType_T property, BOOL aVal)
+HRESULT Machine::setCPUProperty(CPUPropertyType_T aProperty, BOOL aValue)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    switch (property)
+    switch (aProperty)
     {
         case CPUPropertyType_PAE:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mPAEEnabled = !!aVal;
-            break;
-
-        case CPUPropertyType_Synthetic:
-            setModified(IsModified_MachineData);
-            mHWData.backup();
-            mHWData->mSyntheticCpu = !!aVal;
+            mHWData->mPAEEnabled = !!aValue;
             break;
 
         case CPUPropertyType_LongMode:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mLongMode = !aVal ? settings::Hardware::LongMode_Disabled : settings::Hardware::LongMode_Enabled;
+            mHWData->mLongMode = !aValue ? settings::Hardware::LongMode_Disabled : settings::Hardware::LongMode_Enabled;
             break;
 
         case CPUPropertyType_TripleFaultReset:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mTripleFaultReset = !!aVal;
+            mHWData->mTripleFaultReset = !!aValue;
             break;
 
         default:
@@ -2298,16 +2237,8 @@ STDMETHODIMP Machine::SetCPUProperty(CPUPropertyType_T property, BOOL aVal)
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetCPUIDLeaf(ULONG aId, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx)
+HRESULT Machine::getCPUIDLeaf(ULONG aId, ULONG *aValEax, ULONG *aValEbx, ULONG *aValEcx, ULONG *aValEdx)
 {
-    CheckComArgOutPointerValid(aValEax);
-    CheckComArgOutPointerValid(aValEbx);
-    CheckComArgOutPointerValid(aValEcx);
-    CheckComArgOutPointerValid(aValEdx);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     switch(aId)
@@ -2358,14 +2289,12 @@ STDMETHODIMP Machine::GetCPUIDLeaf(ULONG aId, ULONG *aValEax, ULONG *aValEbx, UL
     return S_OK;
 }
 
-STDMETHODIMP Machine::SetCPUIDLeaf(ULONG aId, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT Machine::setCPUIDLeaf(ULONG aId, ULONG aValEax, ULONG aValEbx, ULONG aValEcx, ULONG aValEdx)
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     switch(aId)
@@ -2383,7 +2312,7 @@ STDMETHODIMP Machine::SetCPUIDLeaf(ULONG aId, ULONG aValEax, ULONG aValEbx, ULON
         case 0xA:
             AssertCompile(RT_ELEMENTS(mHWData->mCpuIdStdLeafs) == 0xB);
             AssertRelease(aId < RT_ELEMENTS(mHWData->mCpuIdStdLeafs));
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
             mHWData->mCpuIdStdLeafs[aId].ulId  = aId;
             mHWData->mCpuIdStdLeafs[aId].ulEax = aValEax;
@@ -2405,7 +2334,7 @@ STDMETHODIMP Machine::SetCPUIDLeaf(ULONG aId, ULONG aValEax, ULONG aValEbx, ULON
         case 0x8000000A:
             AssertCompile(RT_ELEMENTS(mHWData->mCpuIdExtLeafs) == 0xB);
             AssertRelease(aId - 0x80000000 < RT_ELEMENTS(mHWData->mCpuIdExtLeafs));
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
             mHWData->mCpuIdExtLeafs[aId - 0x80000000].ulId  = aId;
             mHWData->mCpuIdExtLeafs[aId - 0x80000000].ulEax = aValEax;
@@ -2420,14 +2349,11 @@ STDMETHODIMP Machine::SetCPUIDLeaf(ULONG aId, ULONG aValEax, ULONG aValEbx, ULON
     return S_OK;
 }
 
-STDMETHODIMP Machine::RemoveCPUIDLeaf(ULONG aId)
+HRESULT Machine::removeCPUIDLeaf(ULONG aId)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     switch(aId)
@@ -2445,7 +2371,7 @@ STDMETHODIMP Machine::RemoveCPUIDLeaf(ULONG aId)
         case 0xA:
             AssertCompile(RT_ELEMENTS(mHWData->mCpuIdStdLeafs) == 0xB);
             AssertRelease(aId < RT_ELEMENTS(mHWData->mCpuIdStdLeafs));
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
             /* Invalidate leaf. */
             mHWData->mCpuIdStdLeafs[aId].ulId = UINT32_MAX;
@@ -2464,7 +2390,7 @@ STDMETHODIMP Machine::RemoveCPUIDLeaf(ULONG aId)
         case 0x8000000A:
             AssertCompile(RT_ELEMENTS(mHWData->mCpuIdExtLeafs) == 0xB);
             AssertRelease(aId - 0x80000000 < RT_ELEMENTS(mHWData->mCpuIdExtLeafs));
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
             /* Invalidate leaf. */
             mHWData->mCpuIdExtLeafs[aId - 0x80000000].ulId = UINT32_MAX;
@@ -2476,66 +2402,57 @@ STDMETHODIMP Machine::RemoveCPUIDLeaf(ULONG aId)
     return S_OK;
 }
 
-STDMETHODIMP Machine::RemoveAllCPUIDLeaves()
+HRESULT Machine::removeAllCPUIDLeaves()
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
 
     /* Invalidate all standard leafs. */
-    for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); i++)
+    for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); ++i)
         mHWData->mCpuIdStdLeafs[i].ulId = UINT32_MAX;
 
     /* Invalidate all extended leafs. */
-    for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); i++)
+    for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); ++i)
         mHWData->mCpuIdExtLeafs[i].ulId = UINT32_MAX;
 
     return S_OK;
 }
-
-STDMETHODIMP Machine::GetHWVirtExProperty(HWVirtExPropertyType_T property, BOOL *aVal)
+HRESULT Machine::getHWVirtExProperty(HWVirtExPropertyType_T aProperty, BOOL *aValue)
 {
-    CheckComArgOutPointerValid(aVal);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    switch(property)
+    switch(aProperty)
     {
         case HWVirtExPropertyType_Enabled:
-            *aVal = mHWData->mHWVirtExEnabled;
+            *aValue = mHWData->mHWVirtExEnabled;
             break;
 
         case HWVirtExPropertyType_VPID:
-            *aVal = mHWData->mHWVirtExVPIDEnabled;
+            *aValue = mHWData->mHWVirtExVPIDEnabled;
             break;
 
         case HWVirtExPropertyType_NestedPaging:
-            *aVal = mHWData->mHWVirtExNestedPagingEnabled;
+            *aValue = mHWData->mHWVirtExNestedPagingEnabled;
             break;
 
         case HWVirtExPropertyType_UnrestrictedExecution:
-            *aVal = mHWData->mHWVirtExUXEnabled;
+            *aValue = mHWData->mHWVirtExUXEnabled;
             break;
 
         case HWVirtExPropertyType_LargePages:
-            *aVal = mHWData->mHWVirtExLargePagesEnabled;
+            *aValue = mHWData->mHWVirtExLargePagesEnabled;
 #if defined(DEBUG_bird) && defined(RT_OS_LINUX) /* This feature is deadly here */
-            *aVal = FALSE;
+            *aValue = FALSE;
 #endif
             break;
 
         case HWVirtExPropertyType_Force:
-            *aVal = mHWData->mHWVirtExForceEnabled;
+            *aValue = mHWData->mHWVirtExForceEnabled;
             break;
 
         default:
@@ -2544,52 +2461,49 @@ STDMETHODIMP Machine::GetHWVirtExProperty(HWVirtExPropertyType_T property, BOOL
     return S_OK;
 }
 
-STDMETHODIMP Machine::SetHWVirtExProperty(HWVirtExPropertyType_T property, BOOL aVal)
+HRESULT Machine::setHWVirtExProperty(HWVirtExPropertyType_T aProperty, BOOL aValue)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    switch(property)
+    switch(aProperty)
     {
         case HWVirtExPropertyType_Enabled:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mHWVirtExEnabled = !!aVal;
+            mHWData->mHWVirtExEnabled = !!aValue;
             break;
 
         case HWVirtExPropertyType_VPID:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mHWVirtExVPIDEnabled = !!aVal;
+            mHWData->mHWVirtExVPIDEnabled = !!aValue;
             break;
 
         case HWVirtExPropertyType_NestedPaging:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mHWVirtExNestedPagingEnabled = !!aVal;
+            mHWData->mHWVirtExNestedPagingEnabled = !!aValue;
             break;
 
         case HWVirtExPropertyType_UnrestrictedExecution:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mHWVirtExUXEnabled = !!aVal;
+            mHWData->mHWVirtExUXEnabled = !!aValue;
             break;
 
         case HWVirtExPropertyType_LargePages:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mHWVirtExLargePagesEnabled = !!aVal;
+            mHWData->mHWVirtExLargePagesEnabled = !!aValue;
             break;
 
         case HWVirtExPropertyType_Force:
-            setModified(IsModified_MachineData);
+            i_setModified(IsModified_MachineData);
             mHWData.backup();
-            mHWData->mHWVirtExForceEnabled = !!aVal;
+            mHWData->mHWVirtExForceEnabled = !!aValue;
             break;
 
         default:
@@ -2599,23 +2513,16 @@ STDMETHODIMP Machine::SetHWVirtExProperty(HWVirtExPropertyType_T property, BOOL
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(SnapshotFolder)(BSTR *aSnapshotFolder)
+HRESULT Machine::getSnapshotFolder(com::Utf8Str &aSnapshotFolder)
 {
-    CheckComArgOutPointerValid(aSnapshotFolder);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Utf8Str strFullSnapshotFolder;
-    calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);
-    strFullSnapshotFolder.cloneTo(aSnapshotFolder);
+    i_calculateFullPath(mUserData->s.strSnapshotFolder, aSnapshotFolder);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(SnapshotFolder)(IN_BSTR aSnapshotFolder)
+HRESULT Machine::setSnapshotFolder(const com::Utf8Str &aSnapshotFolder)
 {
     /* @todo (r=dmik):
      *  1. Allow to change the name of the snapshot folder containing snapshots
@@ -2625,101 +2532,86 @@ STDMETHODIMP Machine::COMSETTER(SnapshotFolder)(IN_BSTR aSnapshotFolder)
      *     place is #saveSettings().
      */
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     if (!mData->mCurrentSnapshot.isNull())
         return setError(E_FAIL,
                         tr("The snapshot folder of a machine with snapshots cannot be changed (please delete all snapshots first)"));
 
-    Utf8Str strSnapshotFolder0(aSnapshotFolder);       // keep original
+    Utf8Str strSnapshotFolder(aSnapshotFolder);       // keep original
 
-    Utf8Str strSnapshotFolder(strSnapshotFolder0);
     if (strSnapshotFolder.isEmpty())
         strSnapshotFolder = "Snapshots";
-    int vrc = calculateFullPath(strSnapshotFolder,
+    int vrc = i_calculateFullPath(strSnapshotFolder,
                                 strSnapshotFolder);
     if (RT_FAILURE(vrc))
         return setError(E_FAIL,
-                        tr("Invalid snapshot folder '%ls' (%Rrc)"),
-                        aSnapshotFolder, vrc);
+                        tr("Invalid snapshot folder '%s' (%Rrc)"),
+                        strSnapshotFolder.c_str(), vrc);
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
 
-    copyPathRelativeToMachine(strSnapshotFolder, mUserData->s.strSnapshotFolder);
+    i_copyPathRelativeToMachine(strSnapshotFolder, mUserData->s.strSnapshotFolder);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(MediumAttachments)(ComSafeArrayOut(IMediumAttachment*, aAttachments))
+HRESULT Machine::getMediumAttachments(std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments)
 {
-    CheckComArgOutSafeArrayPointerValid(aAttachments);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IMediumAttachment> attachments(mMediaData->mAttachments);
-    attachments.detachTo(ComSafeArrayOutArg(aAttachments));
+    aMediumAttachments.resize(mMediaData->mAttachments.size());
+    size_t i = 0;
+    for (MediaData::AttachmentList::iterator it = mMediaData->mAttachments.begin();
+         it != mMediaData->mAttachments.end(); ++it, ++i)
+        aMediumAttachments[i] = *it;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(VRDEServer)(IVRDEServer **vrdeServer)
+HRESULT Machine::getVRDEServer(ComPtr<IVRDEServer> &aVRDEServer)
 {
-    CheckComArgOutPointerValid(vrdeServer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     Assert(!!mVRDEServer);
-    mVRDEServer.queryInterfaceTo(vrdeServer);
+
+    aVRDEServer = mVRDEServer;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(AudioAdapter)(IAudioAdapter **audioAdapter)
+HRESULT Machine::getAudioAdapter(ComPtr<IAudioAdapter> &aAudioAdapter)
 {
-    CheckComArgOutPointerValid(audioAdapter);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mAudioAdapter.queryInterfaceTo(audioAdapter);
+    aAudioAdapter = mAudioAdapter;
+
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(USBControllers)(ComSafeArrayOut(IUSBController *, aUSBControllers))
+HRESULT Machine::getUSBControllers(std::vector<ComPtr<IUSBController> > &aUSBControllers)
 {
 #ifdef VBOX_WITH_VUSB
-    CheckComArgOutPointerValid(aUSBControllers);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     clearError();
     MultiResult rc(S_OK);
 
 # ifdef VBOX_WITH_USB
-    rc = mParent->host()->checkUSBProxyService();
+    rc = mParent->i_host()->i_checkUSBProxyService();
     if (FAILED(rc)) return rc;
 # endif
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IUSBController> ctrls(*mUSBControllers.data());
-    ctrls.detachTo(ComSafeArrayOutArg(aUSBControllers));
+    USBControllerList data = *mUSBControllers.data();
+    aUSBControllers.resize(data.size());
+    size_t i = 0;
+    for (USBControllerList::iterator it = data.begin(); it != data.end(); ++i, ++it)
+        aUSBControllers[i] = *it;
+
     return S_OK;
 #else
     /* Note: The GUI depends on this method returning E_NOTIMPL with no
@@ -2730,25 +2622,21 @@ STDMETHODIMP Machine::COMGETTER(USBControllers)(ComSafeArrayOut(IUSBController *
 #endif /* VBOX_WITH_VUSB */
 }
 
-STDMETHODIMP Machine::COMGETTER(USBDeviceFilters)(IUSBDeviceFilters **aUSBDeviceFilters)
+HRESULT Machine::getUSBDeviceFilters(ComPtr<IUSBDeviceFilters> &aUSBDeviceFilters)
 {
 #ifdef VBOX_WITH_VUSB
-    CheckComArgOutPointerValid(aUSBDeviceFilters);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     clearError();
     MultiResult rc(S_OK);
 
 # ifdef VBOX_WITH_USB
-    rc = mParent->host()->checkUSBProxyService();
+    rc = mParent->i_host()->i_checkUSBProxyService();
     if (FAILED(rc)) return rc;
 # endif
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    return rc = mUSBDeviceFilters.queryInterfaceTo(aUSBDeviceFilters);
+    aUSBDeviceFilters = mUSBDeviceFilters;
+    return rc;
 #else
     /* Note: The GUI depends on this method returning E_NOTIMPL with no
      * extended error info to indicate that USB is simply not available
@@ -2758,47 +2646,33 @@ STDMETHODIMP Machine::COMGETTER(USBDeviceFilters)(IUSBDeviceFilters **aUSBDevice
 #endif /* VBOX_WITH_VUSB */
 }
 
-STDMETHODIMP Machine::COMGETTER(SettingsFilePath)(BSTR *aFilePath)
+HRESULT Machine::getSettingsFilePath(com::Utf8Str &aSettingsFilePath)
 {
-    CheckComArgOutPointerValid(aFilePath);
-
-    AutoLimitedCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->m_strConfigFileFull.cloneTo(aFilePath);
+    aSettingsFilePath = mData->m_strConfigFileFull;
+
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(SettingsModified)(BOOL *aModified)
+HRESULT Machine::getSettingsModified(BOOL *aSettingsModified)
 {
-    CheckComArgOutPointerValid(aModified);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
     if (!mData->pMachineConfigFile->fileExists())
         // this is a new machine, and no config file exists yet:
-        *aModified = TRUE;
+        *aSettingsModified = TRUE;
     else
-        *aModified = (mData->flModifications != 0);
+        *aSettingsModified = (mData->flModifications != 0);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(SessionState)(SessionState_T *aSessionState)
+HRESULT Machine::getSessionState(SessionState_T *aSessionState)
 {
-    CheckComArgOutPointerValid(aSessionState);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aSessionState = mData->mSession.mState;
@@ -2806,27 +2680,17 @@ STDMETHODIMP Machine::COMGETTER(SessionState)(SessionState_T *aSessionState)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(SessionType)(BSTR *aSessionType)
+HRESULT Machine::getSessionName(com::Utf8Str &aSessionName)
 {
-    CheckComArgOutPointerValid(aSessionType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mSession.mType.cloneTo(aSessionType);
+    aSessionName = mData->mSession.mName;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(SessionPID)(ULONG *aSessionPID)
+HRESULT Machine::getSessionPID(ULONG *aSessionPID)
 {
-    CheckComArgOutPointerValid(aSessionPID);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aSessionPID = mData->mSession.mPID;
@@ -2834,27 +2698,18 @@ STDMETHODIMP Machine::COMGETTER(SessionPID)(ULONG *aSessionPID)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(State)(MachineState_T *machineState)
+HRESULT Machine::getState(MachineState_T *aState)
 {
-    CheckComArgOutPointerValid(machineState);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *machineState = mData->mMachineState;
+    *aState = mData->mMachineState;
+    Assert(mData->mMachineState != MachineState_Null);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(LastStateChange)(LONG64 *aLastStateChange)
+HRESULT Machine::getLastStateChange(LONG64 *aLastStateChange)
 {
-    CheckComArgOutPointerValid(aLastStateChange);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aLastStateChange = RTTimeSpecGetMilli(&mData->mLastStateChange);
@@ -2862,73 +2717,46 @@ STDMETHODIMP Machine::COMGETTER(LastStateChange)(LONG64 *aLastStateChange)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(StateFilePath)(BSTR *aStateFilePath)
+HRESULT Machine::getStateFilePath(com::Utf8Str &aStateFilePath)
 {
-    CheckComArgOutPointerValid(aStateFilePath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mSSData->strStateFilePath.cloneTo(aStateFilePath);
+    aStateFilePath = mSSData->strStateFilePath;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(LogFolder)(BSTR *aLogFolder)
+HRESULT Machine::getLogFolder(com::Utf8Str &aLogFolder)
 {
-    CheckComArgOutPointerValid(aLogFolder);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Utf8Str logFolder;
-    getLogFolder(logFolder);
-    logFolder.cloneTo(aLogFolder);
+    i_getLogFolder(aLogFolder);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(CurrentSnapshot) (ISnapshot **aCurrentSnapshot)
+HRESULT Machine::getCurrentSnapshot(ComPtr<ISnapshot> &aCurrentSnapshot)
 {
-    CheckComArgOutPointerValid(aCurrentSnapshot);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mCurrentSnapshot.queryInterfaceTo(aCurrentSnapshot);
+    aCurrentSnapshot = mData->mCurrentSnapshot;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(SnapshotCount)(ULONG *aSnapshotCount)
+HRESULT Machine::getSnapshotCount(ULONG *aSnapshotCount)
 {
-    CheckComArgOutPointerValid(aSnapshotCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aSnapshotCount = mData->mFirstSnapshot.isNull()
                           ? 0
-                          : mData->mFirstSnapshot->getAllChildrenCount() + 1;
+                          : mData->mFirstSnapshot->i_getAllChildrenCount() + 1;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(CurrentStateModified)(BOOL *aCurrentStateModified)
+HRESULT Machine::getCurrentStateModified(BOOL *aCurrentStateModified)
 {
-    CheckComArgOutPointerValid(aCurrentStateModified);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Note: for machines with no snapshots, we always return FALSE
@@ -2942,28 +2770,21 @@ STDMETHODIMP Machine::COMGETTER(CurrentStateModified)(BOOL *aCurrentStateModifie
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders))
+HRESULT Machine::getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders)
 {
-    CheckComArgOutSafeArrayPointerValid(aSharedFolders);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<ISharedFolder> folders(mHWData->mSharedFolders);
-    folders.detachTo(ComSafeArrayOutArg(aSharedFolders));
+    aSharedFolders.resize(mHWData->mSharedFolders.size());
+    size_t i = 0;
+    for (std::list<ComObjPtr<SharedFolder> >::iterator it = mHWData->mSharedFolders.begin();
+         it != mHWData->mSharedFolders.end(); ++i, ++it)
+        aSharedFolders[i] = *it;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(ClipboardMode)(ClipboardMode_T *aClipboardMode)
+HRESULT Machine::getClipboardMode(ClipboardMode_T *aClipboardMode)
 {
-    CheckComArgOutPointerValid(aClipboardMode);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aClipboardMode = mHWData->mClipboardMode;
@@ -2971,82 +2792,67 @@ STDMETHODIMP Machine::COMGETTER(ClipboardMode)(ClipboardMode_T *aClipboardMode)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(ClipboardMode)(ClipboardMode_T aClipboardMode)
+HRESULT Machine::setClipboardMode(ClipboardMode_T aClipboardMode)
 {
     HRESULT rc = S_OK;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     alock.release();
-    rc = onClipboardModeChange(aClipboardMode);
+    rc = i_onClipboardModeChange(aClipboardMode);
     alock.acquire();
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mClipboardMode = aClipboardMode;
 
     /** Save settings if online - @todo why is this required? -- @bugref{6818} */
     if (Global::IsOnline(mData->mMachineState))
-        saveSettings(NULL);
+        i_saveSettings(NULL);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(DragAndDropMode)(DragAndDropMode_T *aDragAndDropMode)
+HRESULT Machine::getDnDMode(DnDMode_T *aDnDMode)
 {
-    CheckComArgOutPointerValid(aDragAndDropMode);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aDragAndDropMode = mHWData->mDragAndDropMode;
+    *aDnDMode = mHWData->mDnDMode;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(DragAndDropMode)(DragAndDropMode_T aDragAndDropMode)
+HRESULT Machine::setDnDMode(DnDMode_T aDnDMode)
 {
     HRESULT rc = S_OK;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     alock.release();
-    rc = onDragAndDropModeChange(aDragAndDropMode);
+    rc = i_onDnDModeChange(aDnDMode);
+
     alock.acquire();
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mDragAndDropMode = aDragAndDropMode;
+    mHWData->mDnDMode = aDnDMode;
 
     /** Save settings if online - @todo why is this required? -- @bugref{6818} */
     if (Global::IsOnline(mData->mMachineState))
-        saveSettings(NULL);
+        i_saveSettings(NULL);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(GuestPropertyNotificationPatterns)(BSTR *aPatterns)
+HRESULT Machine::getGuestPropertyNotificationPatterns(com::Utf8Str &aGuestPropertyNotificationPatterns)
 {
-    CheckComArgOutPointerValid(aPatterns);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     try
     {
-        mHWData->mGuestPropertyNotificationPatterns.cloneTo(aPatterns);
+        aGuestPropertyNotificationPatterns = mHWData->mGuestPropertyNotificationPatterns;
     }
     catch (...)
     {
@@ -3056,44 +2862,32 @@ STDMETHODIMP Machine::COMGETTER(GuestPropertyNotificationPatterns)(BSTR *aPatter
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns)
+HRESULT Machine::setGuestPropertyNotificationPatterns(const com::Utf8Str &aGuestPropertyNotificationPatterns)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mGuestPropertyNotificationPatterns = aPatterns;
+    mHWData->mGuestPropertyNotificationPatterns = aGuestPropertyNotificationPatterns;
     return rc;
 }
 
-STDMETHODIMP Machine::COMGETTER(StorageControllers)(ComSafeArrayOut(IStorageController *, aStorageControllers))
+HRESULT Machine::getStorageControllers(std::vector<ComPtr<IStorageController> > &aStorageControllers)
 {
-    CheckComArgOutSafeArrayPointerValid(aStorageControllers);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    SafeIfaceArray<IStorageController> ctrls(*mStorageControllers.data());
-    ctrls.detachTo(ComSafeArrayOutArg(aStorageControllers));
-
+    StorageControllerList data = *mStorageControllers.data();
+    size_t i = 0;
+    aStorageControllers.resize(data.size());
+    for (StorageControllerList::iterator it = data.begin(); it != data.end(); ++it, ++i)
+        aStorageControllers[i] = *it;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(TeleporterEnabled)(BOOL *aEnabled)
+HRESULT Machine::getTeleporterEnabled(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aEnabled = mUserData->s.fTeleporterEnabled;
@@ -3101,18 +2895,15 @@ STDMETHODIMP Machine::COMGETTER(TeleporterEnabled)(BOOL *aEnabled)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(TeleporterEnabled)(BOOL aEnabled)
+HRESULT Machine::setTeleporterEnabled(BOOL aTeleporterEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Only allow it to be set to true when PoweredOff or Aborted.
        (Clearing it is always permitted.) */
-    if (    aEnabled
+    if (    aTeleporterEnabled
         &&  mData->mRegistered
-        &&  (   !isSessionMachine()
+        &&  (   !i_isSessionMachine()
              || (   mData->mMachineState != MachineState_PoweredOff
                  && mData->mMachineState != MachineState_Teleported
                  && mData->mMachineState != MachineState_Aborted
@@ -3123,304 +2914,229 @@ STDMETHODIMP Machine::COMSETTER(TeleporterEnabled)(BOOL aEnabled)
                         tr("The machine is not powered off (state is %s)"),
                         Global::stringifyMachineState(mData->mMachineState));
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.fTeleporterEnabled = !!aEnabled;
+    mUserData->s.fTeleporterEnabled = !! aTeleporterEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(TeleporterPort)(ULONG *aPort)
+HRESULT Machine::getTeleporterPort(ULONG *aTeleporterPort)
 {
-    CheckComArgOutPointerValid(aPort);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    *aPort = (ULONG)mUserData->s.uTeleporterPort;
+    *aTeleporterPort = (ULONG)mUserData->s.uTeleporterPort;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(TeleporterPort)(ULONG aPort)
+HRESULT Machine::setTeleporterPort(ULONG aTeleporterPort)
 {
-    if (aPort >= _64K)
-        return setError(E_INVALIDARG, tr("Invalid port number %d"), aPort);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (aTeleporterPort >= _64K)
+        return setError(E_INVALIDARG, tr("Invalid port number %d"), aTeleporterPort);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.uTeleporterPort = (uint32_t)aPort;
+    mUserData->s.uTeleporterPort = (uint32_t)aTeleporterPort;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(TeleporterAddress)(BSTR *aAddress)
+HRESULT Machine::getTeleporterAddress(com::Utf8Str &aTeleporterAddress)
 {
-    CheckComArgOutPointerValid(aAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mUserData->s.strTeleporterAddress.cloneTo(aAddress);
+    aTeleporterAddress = mUserData->s.strTeleporterAddress;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(TeleporterAddress)(IN_BSTR aAddress)
+HRESULT Machine::setTeleporterAddress(const com::Utf8Str &aTeleporterAddress)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.strTeleporterAddress = aAddress;
+    mUserData->s.strTeleporterAddress = aTeleporterAddress;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(TeleporterPassword)(BSTR *aPassword)
+HRESULT Machine::getTeleporterPassword(com::Utf8Str &aTeleporterPassword)
 {
-    CheckComArgOutPointerValid(aPassword);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        mUserData->s.strTeleporterPassword.cloneTo(aPassword);
-    }
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    aTeleporterPassword =  mUserData->s.strTeleporterPassword;
 
-    return hrc;
+    return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(TeleporterPassword)(IN_BSTR aPassword)
+HRESULT Machine::setTeleporterPassword(const com::Utf8Str &aTeleporterPassword)
 {
     /*
      * Hash the password first.
      */
-    Utf8Str strPassword(aPassword);
-    if (!strPassword.isEmpty())
+    com::Utf8Str aT = aTeleporterPassword;
+
+    if (!aT.isEmpty())
     {
-        if (VBoxIsPasswordHashed(&strPassword))
+        if (VBoxIsPasswordHashed(&aT))
             return setError(E_INVALIDARG, tr("Cannot set an already hashed password, only plain text password please"));
-        VBoxHashPassword(&strPassword);
+        VBoxHashPassword(&aT);
     }
 
     /*
      * Do the update.
      */
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep);
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableStateDep);
-        if (SUCCEEDED(hrc))
-        {
-            setModified(IsModified_MachineData);
-            mUserData.backup();
-            mUserData->s.strTeleporterPassword = strPassword;
-        }
+        i_setModified(IsModified_MachineData);
+        mUserData.backup();
+        mUserData->s.strTeleporterPassword = aT;
     }
 
     return hrc;
 }
 
-STDMETHODIMP Machine::COMGETTER(FaultToleranceState)(FaultToleranceState_T *aState)
+HRESULT Machine::getFaultToleranceState(FaultToleranceState_T *aFaultToleranceState)
 {
-    CheckComArgOutPointerValid(aState);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aState = mUserData->s.enmFaultToleranceState;
+    *aFaultToleranceState = mUserData->s.enmFaultToleranceState;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(FaultToleranceState)(FaultToleranceState_T aState)
+HRESULT Machine::setFaultToleranceState(FaultToleranceState_T aFaultToleranceState)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* @todo deal with running state change. */
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.enmFaultToleranceState = aState;
+    mUserData->s.enmFaultToleranceState = aFaultToleranceState;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(FaultToleranceAddress)(BSTR *aAddress)
+HRESULT Machine::getFaultToleranceAddress(com::Utf8Str &aFaultToleranceAddress)
 {
-    CheckComArgOutPointerValid(aAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mUserData->s.strFaultToleranceAddress.cloneTo(aAddress);
+    aFaultToleranceAddress = mUserData->s.strFaultToleranceAddress;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(FaultToleranceAddress)(IN_BSTR aAddress)
+HRESULT Machine::setFaultToleranceAddress(const com::Utf8Str &aFaultToleranceAddress)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* @todo deal with running state change. */
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.strFaultToleranceAddress = aAddress;
+    mUserData->s.strFaultToleranceAddress = aFaultToleranceAddress;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(FaultTolerancePort)(ULONG *aPort)
+HRESULT Machine::getFaultTolerancePort(ULONG *aFaultTolerancePort)
 {
-    CheckComArgOutPointerValid(aPort);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aPort = mUserData->s.uFaultTolerancePort;
+    *aFaultTolerancePort = mUserData->s.uFaultTolerancePort;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(FaultTolerancePort)(ULONG aPort)
+HRESULT Machine::setFaultTolerancePort(ULONG aFaultTolerancePort)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* @todo deal with running state change. */
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.uFaultTolerancePort = aPort;
+    mUserData->s.uFaultTolerancePort = aFaultTolerancePort;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(FaultTolerancePassword)(BSTR *aPassword)
+HRESULT Machine::getFaultTolerancePassword(com::Utf8Str &aFaultTolerancePassword)
 {
-    CheckComArgOutPointerValid(aPassword);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mUserData->s.strFaultTolerancePassword.cloneTo(aPassword);
+    aFaultTolerancePassword = mUserData->s.strFaultTolerancePassword;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(FaultTolerancePassword)(IN_BSTR aPassword)
+HRESULT Machine::setFaultTolerancePassword(const com::Utf8Str &aFaultTolerancePassword)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* @todo deal with running state change. */
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.strFaultTolerancePassword = aPassword;
+    mUserData->s.strFaultTolerancePassword = aFaultTolerancePassword;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(FaultToleranceSyncInterval)(ULONG *aInterval)
+HRESULT Machine::getFaultToleranceSyncInterval(ULONG *aFaultToleranceSyncInterval)
 {
-    CheckComArgOutPointerValid(aInterval);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aInterval = mUserData->s.uFaultToleranceInterval;
+    *aFaultToleranceSyncInterval = mUserData->s.uFaultToleranceInterval;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(FaultToleranceSyncInterval)(ULONG aInterval)
+HRESULT Machine::setFaultToleranceSyncInterval(ULONG aFaultToleranceSyncInterval)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* @todo deal with running state change. */
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.uFaultToleranceInterval = aInterval;
+    mUserData->s.uFaultToleranceInterval = aFaultToleranceSyncInterval;
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(RTCUseUTC)(BOOL *aEnabled)
+HRESULT Machine::getRTCUseUTC(BOOL *aRTCUseUTC)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mUserData->s.fRTCUseUTC;
+    *aRTCUseUTC = mUserData->s.fRTCUseUTC;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(RTCUseUTC)(BOOL aEnabled)
+HRESULT Machine::setRTCUseUTC(BOOL aRTCUseUTC)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Only allow it to be set to true when PoweredOff or Aborted.
        (Clearing it is always permitted.) */
-    if (    aEnabled
+    if (    aRTCUseUTC
         &&  mData->mRegistered
-        &&  (   !isSessionMachine()
+        &&  (   !i_isSessionMachine()
              || (   mData->mMachineState != MachineState_PoweredOff
                  && mData->mMachineState != MachineState_Teleported
                  && mData->mMachineState != MachineState_Aborted
@@ -3431,51 +3147,38 @@ STDMETHODIMP Machine::COMSETTER(RTCUseUTC)(BOOL aEnabled)
                         tr("The machine is not powered off (state is %s)"),
                         Global::stringifyMachineState(mData->mMachineState));
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mUserData.backup();
-    mUserData->s.fRTCUseUTC = !!aEnabled;
+    mUserData->s.fRTCUseUTC = !!aRTCUseUTC;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(IOCacheEnabled)(BOOL *aEnabled)
+HRESULT Machine::getIOCacheEnabled(BOOL *aIOCacheEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aEnabled = mHWData->mIOCacheEnabled;
+    *aIOCacheEnabled = mHWData->mIOCacheEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(IOCacheEnabled)(BOOL aEnabled)
+HRESULT Machine::setIOCacheEnabled(BOOL aIOCacheEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
-    mHWData->mIOCacheEnabled = aEnabled;
+    mHWData->mIOCacheEnabled = aIOCacheEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(IOCacheSize)(ULONG *aIOCacheSize)
+HRESULT Machine::getIOCacheSize(ULONG *aIOCacheSize)
 {
-    CheckComArgOutPointerValid(aIOCacheSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aIOCacheSize = mHWData->mIOCacheSize;
@@ -3483,17 +3186,14 @@ STDMETHODIMP Machine::COMGETTER(IOCacheSize)(ULONG *aIOCacheSize)
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(IOCacheSize)(ULONG  aIOCacheSize)
+HRESULT Machine::setIOCacheSize(ULONG aIOCacheSize)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mIOCacheSize = aIOCacheSize;
 
@@ -3504,14 +3204,9 @@ STDMETHODIMP Machine::COMSETTER(IOCacheSize)(ULONG  aIOCacheSize)
 /**
  *  @note Locks objects!
  */
-STDMETHODIMP Machine::LockMachine(ISession *aSession,
-                                  LockType_T lockType)
+HRESULT Machine::lockMachine(const ComPtr<ISession> &aSession,
+                             LockType_T aLockType)
 {
-    CheckComArgNotNull(aSession);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* check the session state */
     SessionState_T state;
     HRESULT rc = aSession->COMGETTER(State)(&state);
@@ -3526,6 +3221,9 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
     ComAssertMsgRet(!!pSessionControl, ("No IInternalSessionControl interface"),
                     E_INVALIDARG);
 
+    // session name (only used in some code paths)
+    Utf8Str strSessionName;
+
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (!mData->mRegistered)
@@ -3550,8 +3248,10 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
     }
 
     // try again now
-    if (    (mData->mSession.mState == SessionState_Locked)         // machine is write-locked already (i.e. session machine exists)
-         && (lockType == LockType_Shared)                           // caller wants a shared link to the existing session that holds the write lock:
+    if (    (mData->mSession.mState == SessionState_Locked)         // machine is write-locked already
+                                                                    // (i.e. session machine exists)
+         && (aLockType == LockType_Shared)                          // caller wants a shared link to the
+                                                                    // existing session that holds the write lock:
        )
     {
         // OK, share the session... we are now dealing with three processes:
@@ -3575,15 +3275,17 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
 
         // get the console of the session holding the write lock (this is a remote call)
         ComPtr<IConsole> pConsoleW;
-        LogFlowThisFunc(("Calling GetRemoteConsole()...\n"));
-        rc = pSessionW->GetRemoteConsole(pConsoleW.asOutParam());
-        LogFlowThisFunc(("GetRemoteConsole() returned %08X\n", rc));
-        if (FAILED(rc))
-            // the failure may occur w/o any error info (from RPC), so provide one
-            return setError(VBOX_E_VM_ERROR,
-                            tr("Failed to get a console object from the direct session (%Rhrc)"), rc);
-
-        ComAssertRet(!pConsoleW.isNull(), E_FAIL);
+        if (mData->mSession.mLockType == LockType_VM)
+        {
+            LogFlowThisFunc(("Calling GetRemoteConsole()...\n"));
+            rc = pSessionW->COMGETTER(RemoteConsole)(pConsoleW.asOutParam());
+            LogFlowThisFunc(("GetRemoteConsole() returned %08X\n", rc));
+            if (FAILED(rc))
+                // the failure may occur w/o any error info (from RPC), so provide one
+                return setError(VBOX_E_VM_ERROR,
+                                tr("Failed to get a console object from the direct session (%Rhrc)"), rc);
+            ComAssertRet(!pConsoleW.isNull(), E_FAIL);
+        }
 
         // share the session machine and W's console with the caller's session
         LogFlowThisFunc(("Calling AssignRemoteMachine()...\n"));
@@ -3627,7 +3329,7 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
         // get the caller's session PID
         RTPROCESS pid = NIL_RTPROCESS;
         AssertCompile(sizeof(ULONG) == sizeof(RTPROCESS));
-        pSessionControl->GetPID((ULONG*)&pid);
+        pSessionControl->COMGETTER(PID)((ULONG*)&pid);
         Assert(pid != NIL_RTPROCESS);
 
         bool fLaunchingVMProcess = (mData->mSession.mState == SessionState_Spawning);
@@ -3699,11 +3401,11 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
             /* Get the client token ID to be passed to the client process */
             Utf8Str strTokenId;
-            sessionMachine->getTokenId(strTokenId);
+            sessionMachine->i_getTokenId(strTokenId);
             Assert(!strTokenId.isEmpty());
 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
             /* Get the client token to be passed to the client process */
-            ComPtr<IToken> pToken(sessionMachine->getToken());
+            ComPtr<IToken> pToken(sessionMachine->i_getToken());
             /* The token is now "owned" by pToken, fix refcount */
             if (!pToken.isNull())
                 pToken->Release();
@@ -3723,9 +3425,9 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
 
             LogFlowThisFunc(("Calling AssignMachine()...\n"));
 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
-            rc = pSessionControl->AssignMachine(sessionMachine, lockType, Bstr(strTokenId).raw());
+            rc = pSessionControl->AssignMachine(sessionMachine, aLockType, Bstr(strTokenId).raw());
 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-            rc = pSessionControl->AssignMachine(sessionMachine, lockType, pToken);
+            rc = pSessionControl->AssignMachine(sessionMachine, aLockType, pToken);
             /* Now the token is owned by the client process. */
             pToken.setNull();
 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
@@ -3736,6 +3438,15 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
                 setError(VBOX_E_VM_ERROR,
                          tr("Failed to assign the machine to the session (%Rhrc)"), rc);
 
+            // get session name, either to remember or to compare against
+            // the already known session name.
+            {
+                Bstr bstrSessionName;
+                HRESULT rc2 = aSession->COMGETTER(Name)(bstrSessionName.asOutParam());
+                if (SUCCEEDED(rc2))
+                    strSessionName = bstrSessionName;
+            }
+
             if (    SUCCEEDED(rc)
                  && fLaunchingVMProcess
                )
@@ -3744,7 +3455,7 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
 
                 /* get the console from the direct session */
                 ComPtr<IConsole> console;
-                rc = pSessionControl->GetRemoteConsole(console.asOutParam());
+                rc = pSessionControl->COMGETTER(RemoteConsole)(console.asOutParam());
                 ComAssertComRC(rc);
 
                 if (SUCCEEDED(rc) && !console)
@@ -3784,6 +3495,7 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
         // finalize spawning anyway (this is why we don't return on errors above)
         if (fLaunchingVMProcess)
         {
+            Assert(mData->mSession.mName == strSessionName);
             /* Note that the progress object is finalized later */
             /** @todo Consider checking mData->mSession.mProgress for cancellation
              *        around here.  */
@@ -3817,9 +3529,12 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
 
         if (SUCCEEDED(rc))
         {
+            mData->mSession.mLockType = aLockType;
             /* memorize the direct session control and cache IUnknown for it */
             mData->mSession.mDirectControl = pSessionControl;
             mData->mSession.mState = SessionState_Locked;
+            if (!fLaunchingVMProcess)
+                mData->mSession.mName = strSessionName;
             /* associate the SessionMachine with this Machine */
             mData->mSession.mMachine = sessionMachine;
 
@@ -3837,7 +3552,6 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
         /* uninitialize the created session machine on failure */
         if (FAILED(rc))
             sessionMachine->uninit();
-
     }
 
     if (SUCCEEDED(rc))
@@ -3846,11 +3560,11 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
          *  tell the client watcher thread to update the set of
          *  machines that have open sessions
          */
-        mParent->updateClientWatcher();
+        mParent->i_updateClientWatcher();
 
         if (oldState != SessionState_Locked)
             /* fire an event */
-            mParent->onSessionStateChange(getId(), SessionState_Locked);
+            mParent->i_onSessionStateChange(i_getId(), SessionState_Locked);
     }
 
     return rc;
@@ -3859,24 +3573,18 @@ STDMETHODIMP Machine::LockMachine(ISession *aSession,
 /**
  *  @note Locks objects!
  */
-STDMETHODIMP Machine::LaunchVMProcess(ISession *aSession,
-                                      IN_BSTR aFrontend,
-                                      IN_BSTR aEnvironment,
-                                      IProgress **aProgress)
-{
-    CheckComArgStr(aFrontend);
-    Utf8Str strFrontend(aFrontend);
-    Utf8Str strEnvironment(aEnvironment);
+HRESULT Machine::launchVMProcess(const ComPtr<ISession> &aSession,
+                                 const com::Utf8Str &aName,
+                                 const com::Utf8Str &aEnvironment,
+                                 ComPtr<IProgress> &aProgress)
+{
+    Utf8Str strFrontend(aName);
     /* "emergencystop" doesn't need the session, so skip the checks/interface
      * retrieval. This code doesn't quite fit in here, but introducing a
      * special API method would be even more effort, and would require explicit
      * support by every API client. It's better to hide the feature a bit. */
     if (strFrontend != "emergencystop")
         CheckComArgNotNull(aSession);
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     HRESULT rc = S_OK;
     if (strFrontend.isEmpty())
@@ -3937,29 +3645,30 @@ STDMETHODIMP Machine::LaunchVMProcess(ISession *aSession,
                             Bstr(tr("Starting VM")).raw(),
                             TRUE /* aCancelable */,
                             fTeleporterEnabled ? 20 : 10 /* uTotalOperationsWeight */,
-                            BstrFmt(tr("Creating process for virtual machine \"%s\" (%s)"), mUserData->s.strName.c_str(), strFrontend.c_str()).raw(),
+                            BstrFmt(tr("Creating process for virtual machine \"%s\" (%s)"),
+                            mUserData->s.strName.c_str(), strFrontend.c_str()).raw(),
                             2 /* uFirstOperationWeight */,
                             fTeleporterEnabled ? 3 : 1 /* cOtherProgressObjectOperations */);
 
         if (SUCCEEDED(rc))
         {
-            rc = launchVMProcess(control, strFrontend, strEnvironment, progress);
+            rc = i_launchVMProcess(control, strFrontend, aEnvironment, progress);
             if (SUCCEEDED(rc))
             {
-                progress.queryInterfaceTo(aProgress);
+                aProgress = progress;
 
                 /* signal the client watcher thread */
-                mParent->updateClientWatcher();
+                mParent->i_updateClientWatcher();
 
                 /* fire an event */
-                mParent->onSessionStateChange(getId(), SessionState_Spawning);
+                mParent->i_onSessionStateChange(i_getId(), SessionState_Spawning);
             }
         }
     }
     else
     {
         /* no progress object - either instant success or failure */
-        *aProgress = NULL;
+        aProgress = NULL;
 
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -3981,13 +3690,13 @@ STDMETHODIMP Machine::LaunchVMProcess(ISession *aSession,
 
         /* signal the client watcher thread, as most likely the client has
          * been terminated */
-        mParent->updateClientWatcher();
+        mParent->i_updateClientWatcher();
     }
 
     return rc;
 }
 
-STDMETHODIMP Machine::SetBootOrder(ULONG aPosition, DeviceType_T aDevice)
+HRESULT Machine::setBootOrder(ULONG aPosition, DeviceType_T aDevice)
 {
     if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition)
         return setError(E_INVALIDARG,
@@ -3998,31 +3707,25 @@ STDMETHODIMP Machine::SetBootOrder(ULONG aPosition, DeviceType_T aDevice)
         return setError(E_NOTIMPL,
                         tr("Booting from USB device is currently not supported"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mBootOrder[aPosition - 1] = aDevice;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetBootOrder(ULONG aPosition, DeviceType_T *aDevice)
+HRESULT Machine::getBootOrder(ULONG aPosition, DeviceType_T *aDevice)
 {
     if (aPosition < 1 || aPosition > SchemaDefs::MaxBootPosition)
         return setError(E_INVALIDARG,
                        tr("Invalid boot position: %lu (must be in range [1, %lu])"),
                        aPosition, SchemaDefs::MaxBootPosition);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aDevice = mHWData->mBootOrder[aPosition - 1];
@@ -4030,26 +3733,22 @@ STDMETHODIMP Machine::GetBootOrder(ULONG aPosition, DeviceType_T *aDevice)
     return S_OK;
 }
 
-STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
-                                   LONG aControllerPort,
-                                   LONG aDevice,
-                                   DeviceType_T aType,
-                                   IMedium *aMedium)
+HRESULT Machine::attachDevice(const com::Utf8Str &aName,
+                              LONG aControllerPort,
+                              LONG aDevice,
+                              DeviceType_T aType,
+                              const ComPtr<IMedium> &aMedium)
 {
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aType=%d aMedium=%p\n",
-                     aControllerName, aControllerPort, aDevice, aType, aMedium));
-
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    IMedium *aM = aMedium;
+    LogFlowThisFunc(("aControllerName=\"%s\" aControllerPort=%d aDevice=%d aType=%d aMedium=%p\n",
+                     aName.c_str(), aControllerPort, aDevice, aType, aM));
 
     // request the host lock first, since might be calling Host methods for getting host drives;
     // next, protect the media tree all the while we're in here, as well as our member variables
-    AutoMultiWriteLock2 alock(mParent->host(), this COMMA_LOCKVAL_SRC_POS);
-    AutoWriteLock treeLock(&mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoMultiWriteLock2 alock(mParent->i_host(), this COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock treeLock(&mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
     /// @todo NEWMEDIA implicit machine registration
@@ -4061,21 +3760,21 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
 
     /* Check for an existing controller. */
     ComObjPtr<StorageController> ctl;
-    rc = getStorageControllerByName(aControllerName, ctl, true /* aSetError */);
+    rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
     StorageControllerType_T ctrlType;
     rc = ctl->COMGETTER(ControllerType)(&ctrlType);
     if (FAILED(rc))
         return setError(E_FAIL,
-                        tr("Could not get type of controller '%ls'"),
-                        aControllerName);
+                        tr("Could not get type of controller '%s'"),
+                        aName.c_str());
 
     bool fSilent = false;
     Utf8Str strReconfig;
 
     /* Check whether the flag to allow silent storage attachment reconfiguration is set. */
-    strReconfig = getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused"));
+    strReconfig = i_getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused"));
     if (   mData->mMachineState == MachineState_Paused
         && strReconfig == "1")
         fSilent = true;
@@ -4085,40 +3784,40 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
     if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
         fHotplug = true;
 
-    if (fHotplug && !isControllerHotplugCapable(ctrlType))
+    if (fHotplug && !i_isControllerHotplugCapable(ctrlType))
         return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Controller '%ls' does not support hotplugging"),
-                        aControllerName);
+                        tr("Controller '%s' does not support hotplugging"),
+                        aName.c_str());
 
     // check that the port and device are not out of range
-    rc = ctl->checkPortAndDeviceValid(aControllerPort, aDevice);
+    rc = ctl->i_checkPortAndDeviceValid(aControllerPort, aDevice);
     if (FAILED(rc)) return rc;
 
     /* check if the device slot is already busy */
     MediumAttachment *pAttachTemp;
-    if ((pAttachTemp = findAttachment(mMediaData->mAttachments,
-                                      aControllerName,
-                                      aControllerPort,
-                                      aDevice)))
+    if ((pAttachTemp = i_findAttachment(mMediaData->mAttachments,
+                                        Bstr(aName).raw(),
+                                        aControllerPort,
+                                        aDevice)))
     {
-        Medium *pMedium = pAttachTemp->getMedium();
+        Medium *pMedium = pAttachTemp->i_getMedium();
         if (pMedium)
         {
             AutoReadLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS);
             return setError(VBOX_E_OBJECT_IN_USE,
-                            tr("Medium '%s' is already attached to port %d, device %d of controller '%ls' of this virtual machine"),
-                            pMedium->getLocationFull().c_str(),
+                            tr("Medium '%s' is already attached to port %d, device %d of controller '%s' of this virtual machine"),
+                            pMedium->i_getLocationFull().c_str(),
                             aControllerPort,
                             aDevice,
-                            aControllerName);
+                            aName.c_str());
         }
         else
             return setError(VBOX_E_OBJECT_IN_USE,
-                            tr("Device is already attached to port %d, device %d of controller '%ls' of this virtual machine"),
-                            aControllerPort, aDevice, aControllerName);
+                            tr("Device is already attached to port %d, device %d of controller '%s' of this virtual machine"),
+                            aControllerPort, aDevice, aName.c_str());
     }
 
-    ComObjPtr<Medium> medium = static_cast<Medium*>(aMedium);
+    ComObjPtr<Medium> medium = static_cast<Medium*>(aM);
     if (aMedium && medium.isNull())
         return setError(E_INVALIDARG, "The given medium pointer is invalid");
 
@@ -4127,16 +3826,16 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
 
     AutoWriteLock mediumLock(medium COMMA_LOCKVAL_SRC_POS);
 
-    if (    (pAttachTemp = findAttachment(mMediaData->mAttachments, medium))
+    if (    (pAttachTemp = i_findAttachment(mMediaData->mAttachments, medium))
          && !medium.isNull()
        )
         return setError(VBOX_E_OBJECT_IN_USE,
                         tr("Medium '%s' is already attached to this virtual machine"),
-                        medium->getLocationFull().c_str());
+                        medium->i_getLocationFull().c_str());
 
     if (!medium.isNull())
     {
-        MediumType_T mtype = medium->getType();
+        MediumType_T mtype = medium->i_getType();
         // MediumType_Readonly is also new, but only applies to DVDs and floppies.
         // For DVDs it's not written to the config file, so needs no global config
         // version bump. For floppies it's a new attribute "type", which is ignored
@@ -4153,20 +3852,20 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
             // because that might make downgrading to pre-4.0 impossible.
             // As a result, we can only use these two new types if the medium is NOT in the
             // global registry:
-            const Guid &uuidGlobalRegistry = mParent->getGlobalRegistryId();
-            if (    medium->isInRegistry(uuidGlobalRegistry)
+            const Guid &uuidGlobalRegistry = mParent->i_getGlobalRegistryId();
+            if (    medium->i_isInRegistry(uuidGlobalRegistry)
                  || !mData->pMachineConfigFile->canHaveOwnMediaRegistry()
                )
                 return setError(VBOX_E_INVALID_OBJECT_STATE,
                                 tr("Cannot attach medium '%s': the media type 'MultiAttach' can only be attached "
                                    "to machines that were created with VirtualBox 4.0 or later"),
-                                medium->getLocationFull().c_str());
+                                medium->i_getLocationFull().c_str());
         }
     }
 
     bool fIndirect = false;
     if (!medium.isNull())
-        fIndirect = medium->isReadOnly();
+        fIndirect = medium->i_isReadOnly();
     bool associate = true;
 
     do
@@ -4179,12 +3878,12 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
             /* check if the medium was attached to the VM before we started
              * changing attachments in which case the attachment just needs to
              * be restored */
-            if ((pAttachTemp = findAttachment(oldAtts, medium)))
+            if ((pAttachTemp = i_findAttachment(oldAtts, medium)))
             {
                 AssertReturn(!fIndirect, E_FAIL);
 
                 /* see if it's the same bus/channel/device */
-                if (pAttachTemp->matches(aControllerName, aControllerPort, aDevice))
+                if (pAttachTemp->i_matches(Bstr(aName).raw(), aControllerPort, aDevice))
                 {
                     /* the simplest case: restore the whole attachment
                      * and return, nothing else to do */
@@ -4199,10 +3898,11 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
 
                         MediumLockList *pMediumLockList(new MediumLockList());
 
-                        rc = medium->createMediumLockList(true /* fFailIfInaccessible */,
-                                                          true /* fMediumLockWrite */,
-                                                          NULL,
-                                                          *pMediumLockList);
+                        rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                                            true /* fMediumLockWrite */,
+                                                            false /* fMediumLockWriteAll */,
+                                                            NULL,
+                                                            *pMediumLockList);
                         alock.acquire();
                         if (FAILED(rc))
                             delete pMediumLockList;
@@ -4218,7 +3918,7 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
 
                         if (SUCCEEDED(rc))
                         {
-                            rc = onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent);
+                            rc = i_onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent);
                             /* Remove lock list in case of error. */
                             if (FAILED(rc))
                             {
@@ -4247,7 +3947,7 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
          * attachments. Note that smart attachment is only applicable to base
          * hard disks. */
 
-        if (medium->getParent().isNull())
+        if (medium->i_getParent().isNull())
         {
             /* first, investigate the backup copy of the current hard disk
              * attachments to make it possible to re-attach existing diffs to
@@ -4259,23 +3959,21 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
                 MediaData::AttachmentList::const_iterator foundIt = oldAtts.end();
                 uint32_t foundLevel = 0;
 
-                for (MediaData::AttachmentList::const_iterator it = oldAtts.begin();
-                     it != oldAtts.end();
-                     ++it)
+                for (MediaData::AttachmentList::const_iterator it = oldAtts.begin(); it != oldAtts.end(); ++it)
                 {
                     uint32_t level = 0;
                     MediumAttachment *pAttach = *it;
-                    ComObjPtr<Medium> pMedium = pAttach->getMedium();
-                    Assert(!pMedium.isNull() || pAttach->getType() != DeviceType_HardDisk);
+                    ComObjPtr<Medium> pMedium = pAttach->i_getMedium();
+                    Assert(!pMedium.isNull() || pAttach->i_getType() != DeviceType_HardDisk);
                     if (pMedium.isNull())
                         continue;
 
-                    if (pMedium->getBase(&level) == medium)
+                    if (pMedium->i_getBase(&level) == medium)
                     {
                         /* skip the hard disk if its currently attached (we
                          * cannot attach the same hard disk twice) */
-                        if (findAttachment(mMediaData->mAttachments,
-                                           pMedium))
+                        if (i_findAttachment(mMediaData->mAttachments,
+                                             pMedium))
                             continue;
 
                         /* matched device, channel and bus (i.e. attached to the
@@ -4283,7 +3981,7 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
                          * otherwise the attachment that has the youngest
                          * descendant of medium will be used
                          */
-                        if (pAttach->matches(aControllerName, aControllerPort, aDevice))
+                        if (pAttach->i_matches(Bstr(aName).raw(), aControllerPort, aDevice))
                         {
                             /* the simplest case: restore the whole attachment
                              * and return, nothing else to do */
@@ -4298,10 +3996,11 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
 
                                 MediumLockList *pMediumLockList(new MediumLockList());
 
-                                rc = medium->createMediumLockList(true /* fFailIfInaccessible */,
-                                                                  true /* fMediumLockWrite */,
-                                                                  NULL,
-                                                                  *pMediumLockList);
+                                rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                                                    true /* fMediumLockWrite */,
+                                                                    false /* fMediumLockWriteAll */,
+                                                                    NULL,
+                                                                    *pMediumLockList);
                                 alock.acquire();
                                 if (FAILED(rc))
                                     delete pMediumLockList;
@@ -4317,7 +4016,7 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
 
                                 if (SUCCEEDED(rc))
                                 {
-                                    rc = onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent);
+                                    rc = i_onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent);
                                     /* Remove lock list in case of error. */
                                     if (FAILED(rc))
                                     {
@@ -4343,7 +4042,7 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
                 if (foundIt != oldAtts.end())
                 {
                     /* use the previously attached hard disk */
-                    medium = (*foundIt)->getMedium();
+                    medium = (*foundIt)->i_getMedium();
                     mediumCaller.attach(medium);
                     if (FAILED(mediumCaller.rc())) return mediumCaller.rc();
                     mediumLock.attach(medium);
@@ -4369,32 +4068,30 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
             {
                 AutoReadLock snapLock(snap COMMA_LOCKVAL_SRC_POS);
 
-                const MediaData::AttachmentList &snapAtts = snap->getSnapshotMachine()->mMediaData->mAttachments;
+                const MediaData::AttachmentList &snapAtts = snap->i_getSnapshotMachine()->mMediaData->mAttachments;
 
                 MediumAttachment *pAttachFound = NULL;
                 uint32_t foundLevel = 0;
 
-                for (MediaData::AttachmentList::const_iterator it = snapAtts.begin();
-                     it != snapAtts.end();
-                     ++it)
+                for (MediaData::AttachmentList::const_iterator it = snapAtts.begin(); it != snapAtts.end(); ++it)
                 {
                     MediumAttachment *pAttach = *it;
-                    ComObjPtr<Medium> pMedium = pAttach->getMedium();
-                    Assert(!pMedium.isNull() || pAttach->getType() != DeviceType_HardDisk);
+                    ComObjPtr<Medium> pMedium = pAttach->i_getMedium();
+                    Assert(!pMedium.isNull() || pAttach->i_getType() != DeviceType_HardDisk);
                     if (pMedium.isNull())
                         continue;
 
                     uint32_t level = 0;
-                    if (pMedium->getBase(&level) == medium)
+                    if (pMedium->i_getBase(&level) == medium)
                     {
                         /* matched device, channel and bus (i.e. attached to the
                          * same place) will win and immediately stop the search;
                          * otherwise the attachment that has the youngest
                          * descendant of medium will be used
                          */
-                        if (    pAttach->getDevice() == aDevice
-                             && pAttach->getPort() == aControllerPort
-                             && pAttach->getControllerName() == aControllerName
+                        if (    pAttach->i_getDevice() == aDevice
+                             && pAttach->i_getPort() == aControllerPort
+                             && pAttach->i_getControllerName() == aName
                            )
                         {
                             pAttachFound = pAttach;
@@ -4412,11 +4109,11 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
 
                 if (pAttachFound)
                 {
-                    base = pAttachFound->getMedium();
+                    base = pAttachFound->i_getMedium();
                     break;
                 }
 
-                snap = snap->getParent();
+                snap = snap->i_getParent();
             }
 
             /* re-lock medium tree and the medium, as we need it below */
@@ -4434,13 +4131,13 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
         }
 
         Utf8Str strFullSnapshotFolder;
-        calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);
+        i_calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);
 
         ComObjPtr<Medium> diff;
         diff.createObject();
         // store this diff in the same registry as the parent
         Guid uuidRegistryParent;
-        if (!medium->getFirstRegistryMachineId(uuidRegistryParent))
+        if (!medium->i_getFirstRegistryMachineId(uuidRegistryParent))
         {
             // parent image has no registry: this can happen if we're attaching a new immutable
             // image that has not yet been attached (medium then points to the base and we're
@@ -4449,26 +4146,28 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
             mediumLock.release();
             treeLock.release();
             alock.release();
-            addMediumToRegistry(medium);
+            i_addMediumToRegistry(medium);
             alock.acquire();
             treeLock.acquire();
             mediumLock.acquire();
-            medium->getFirstRegistryMachineId(uuidRegistryParent);
+            medium->i_getFirstRegistryMachineId(uuidRegistryParent);
         }
         rc = diff->init(mParent,
-                        medium->getPreferredDiffFormat(),
+                        medium->i_getPreferredDiffFormat(),
                         strFullSnapshotFolder.append(RTPATH_SLASH_STR),
-                        uuidRegistryParent);
+                        uuidRegistryParent,
+                        DeviceType_HardDisk);
         if (FAILED(rc)) return rc;
 
         /* Apply the normal locking logic to the entire chain. */
         MediumLockList *pMediumLockList(new MediumLockList());
         mediumLock.release();
         treeLock.release();
-        rc = diff->createMediumLockList(true /* fFailIfInaccessible */,
-                                        true /* fMediumLockWrite */,
-                                        medium,
-                                        *pMediumLockList);
+        rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                          true /* fMediumLockWrite */,
+                                          false /* fMediumLockWriteAll */,
+                                          medium,
+                                          *pMediumLockList);
         treeLock.acquire();
         mediumLock.acquire();
         if (SUCCEEDED(rc))
@@ -4481,29 +4180,29 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
             if (FAILED(rc))
                 setError(rc,
                          tr("Could not lock medium when creating diff '%s'"),
-                         diff->getLocationFull().c_str());
+                         diff->i_getLocationFull().c_str());
             else
             {
                 /* will release the lock before the potentially lengthy
                  * operation, so protect with the special state */
                 MachineState_T oldState = mData->mMachineState;
-                setMachineState(MachineState_SettingUp);
+                i_setMachineState(MachineState_SettingUp);
 
                 mediumLock.release();
                 treeLock.release();
                 alock.release();
 
-                rc = medium->createDiffStorage(diff,
-                                               MediumVariant_Standard,
-                                               pMediumLockList,
-                                               NULL /* aProgress */,
-                                               true /* aWait */);
+                rc = medium->i_createDiffStorage(diff,
+                                                 MediumVariant_Standard,
+                                                 pMediumLockList,
+                                                 NULL /* aProgress */,
+                                                 true /* aWait */);
 
                 alock.acquire();
                 treeLock.acquire();
                 mediumLock.acquire();
 
-                setMachineState(oldState);
+                i_setMachineState(oldState);
             }
         }
 
@@ -4524,7 +4223,7 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
     attachment.createObject();
     rc = attachment->init(this,
                           medium,
-                          aControllerName,
+                          aName,
                           aControllerPort,
                           aDevice,
                           aType,
@@ -4533,28 +4232,28 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
                           false /* fTempEject */,
                           false /* fNonRotational */,
                           false /* fDiscard */,
-                          false /* fHotPluggable */,
+                          fHotplug /* fHotPluggable */,
                           Utf8Str::Empty);
     if (FAILED(rc)) return rc;
 
     if (associate && !medium.isNull())
     {
         // as the last step, associate the medium to the VM
-        rc = medium->addBackReference(mData->mUuid);
+        rc = medium->i_addBackReference(mData->mUuid);
         // here we can fail because of Deleting, or being in process of creating a Diff
         if (FAILED(rc)) return rc;
 
         mediumLock.release();
         treeLock.release();
         alock.release();
-        addMediumToRegistry(medium);
+        i_addMediumToRegistry(medium);
         alock.acquire();
         treeLock.acquire();
         mediumLock.acquire();
     }
 
     /* success: finally remember the attachment */
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
     mMediaData->mAttachments.push_back(attachment);
 
@@ -4568,10 +4267,11 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
         {
             MediumLockList *pMediumLockList(new MediumLockList());
 
-            rc = medium->createMediumLockList(true /* fFailIfInaccessible */,
-                                              true /* fMediumLockWrite */,
-                                              NULL,
-                                              *pMediumLockList);
+            rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                                true /* fMediumLockWrite */,
+                                                false /* fMediumLockWriteAll */,
+                                                NULL,
+                                                *pMediumLockList);
             alock.acquire();
             if (FAILED(rc))
                 delete pMediumLockList;
@@ -4588,7 +4288,7 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
 
         if (SUCCEEDED(rc))
         {
-            rc = onStorageDeviceChange(attachment, FALSE /* aRemove */, fSilent);
+            rc = i_onStorageDeviceChange(attachment, FALSE /* aRemove */, fSilent);
             /* Remove lock list in case of error. */
             if (FAILED(rc))
             {
@@ -4599,46 +4299,44 @@ STDMETHODIMP Machine::AttachDevice(IN_BSTR aControllerName,
         }
     }
 
-    mParent->saveModifiedRegistries();
+    /* Save modified registries, but skip this machine as it's the caller's
+     * job to save its settings like all other settings changes. */
+    mParent->i_unmarkRegistryModified(i_getId());
+    mParent->i_saveModifiedRegistries();
 
     return rc;
 }
 
-STDMETHODIMP Machine::DetachDevice(IN_BSTR aControllerName, LONG aControllerPort,
-                                   LONG aDevice)
+HRESULT Machine::detachDevice(const com::Utf8Str &aName, LONG aControllerPort,
+                              LONG aDevice)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n",
-                     aControllerName, aControllerPort, aDevice));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aControllerName=\"%s\" aControllerPort=%d aDevice=%d\n",
+                     aName.c_str(), aControllerPort, aDevice));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
     AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL);
 
     /* Check for an existing controller. */
     ComObjPtr<StorageController> ctl;
-    rc = getStorageControllerByName(aControllerName, ctl, true /* aSetError */);
+    rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
     StorageControllerType_T ctrlType;
     rc = ctl->COMGETTER(ControllerType)(&ctrlType);
     if (FAILED(rc))
         return setError(E_FAIL,
-                        tr("Could not get type of controller '%ls'"),
-                        aControllerName);
+                        tr("Could not get type of controller '%s'"),
+                        aName.c_str());
 
     bool fSilent = false;
     Utf8Str strReconfig;
 
     /* Check whether the flag to allow silent storage attachment reconfiguration is set. */
-    strReconfig = getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused"));
+    strReconfig = i_getExtraData(Utf8Str("VBoxInternal2/SilentReconfigureWhilePaused"));
     if (   mData->mMachineState == MachineState_Paused
         && strReconfig == "1")
         fSilent = true;
@@ -4648,19 +4346,24 @@ STDMETHODIMP Machine::DetachDevice(IN_BSTR aControllerName, LONG aControllerPort
     if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
         fHotplug = true;
 
-    if (fHotplug && !isControllerHotplugCapable(ctrlType))
+    if (fHotplug && !i_isControllerHotplugCapable(ctrlType))
         return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Controller '%ls' does not support hotplugging"),
-                        aControllerName);
+                        tr("Controller '%s' does not support hotplugging"),
+                        aName.c_str());
 
-    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
-                                               aControllerName,
-                                               aControllerPort,
-                                               aDevice);
+    MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                 Bstr(aName).raw(),
+                                                 aControllerPort,
+                                                 aDevice);
     if (!pAttach)
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
+
+    if (fHotplug && !pAttach->i_getHotPluggable())
+        return setError(VBOX_E_NOT_SUPPORTED,
+                        tr("The device slot %d on port %d of controller '%s' does not support hotplugging"),
+                        aDevice, aControllerPort, aName.c_str());
 
     /*
      * The VM has to detach the device before we delete any implicit diffs.
@@ -4669,35 +4372,33 @@ STDMETHODIMP Machine::DetachDevice(IN_BSTR aControllerName, LONG aControllerPort
     if (fHotplug || fSilent)
     {
         alock.release();
-        rc = onStorageDeviceChange(pAttach, TRUE /* aRemove */, fSilent);
+        rc = i_onStorageDeviceChange(pAttach, TRUE /* aRemove */, fSilent);
         alock.acquire();
     }
     if (FAILED(rc)) return rc;
 
     /* If we are here everything went well and we can delete the implicit now. */
-    rc = detachDevice(pAttach, alock, NULL /* pSnapshot */);
+    rc = i_detachDevice(pAttach, alock, NULL /* pSnapshot */);
 
     alock.release();
 
-    mParent->saveModifiedRegistries();
+    /* Save modified registries, but skip this machine as it's the caller's
+     * job to save its settings like all other settings changes. */
+    mParent->i_unmarkRegistryModified(i_getId());
+    mParent->i_saveModifiedRegistries();
 
     return rc;
 }
 
-STDMETHODIMP Machine::PassthroughDevice(IN_BSTR aControllerName, LONG aControllerPort,
-                                        LONG aDevice, BOOL aPassthrough)
+HRESULT Machine::passthroughDevice(const com::Utf8Str &aName, LONG aControllerPort,
+                                   LONG aDevice, BOOL aPassthrough)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aPassthrough=%d\n",
-                     aControllerName, aControllerPort, aDevice, aPassthrough));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aPassthrough=%d\n",
+                     aName.c_str(), aControllerPort, aDevice, aPassthrough));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL);
@@ -4707,84 +4408,76 @@ STDMETHODIMP Machine::PassthroughDevice(IN_BSTR aControllerName, LONG aControlle
                         tr("Invalid machine state: %s"),
                         Global::stringifyMachineState(mData->mMachineState));
 
-    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
-                                               aControllerName,
-                                               aControllerPort,
-                                               aDevice);
+    MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                 Bstr(aName).raw(),
+                                                 aControllerPort,
+                                                 aDevice);
     if (!pAttach)
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
 
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
 
     AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
 
-    if (pAttach->getType() != DeviceType_DVD)
+    if (pAttach->i_getType() != DeviceType_DVD)
         return setError(E_INVALIDARG,
-                        tr("Setting passthrough rejected as the device attached to device slot %d on port %d of controller '%ls' is not a DVD"),
-                        aDevice, aControllerPort, aControllerName);
-    pAttach->updatePassthrough(!!aPassthrough);
+                        tr("Setting passthrough rejected as the device attached to device slot %d on port %d of controller '%s' is not a DVD"),
+                        aDevice, aControllerPort, aName.c_str());
+    pAttach->i_updatePassthrough(!!aPassthrough);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::TemporaryEjectDevice(IN_BSTR aControllerName, LONG aControllerPort,
-                                           LONG aDevice, BOOL aTemporaryEject)
+HRESULT Machine::temporaryEjectDevice(const com::Utf8Str &aName, LONG aControllerPort,
+                                      LONG aDevice, BOOL aTemporaryEject)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
 
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aTemporaryEject=%d\n",
-                     aControllerName, aControllerPort, aDevice, aTemporaryEject));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aTemporaryEject=%d\n",
+                     aName.c_str(), aControllerPort, aDevice, aTemporaryEject));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
-    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
-                                               aControllerName,
-                                               aControllerPort,
-                                               aDevice);
+    MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                 Bstr(aName).raw(),
+                                                 aControllerPort,
+                                                 aDevice);
     if (!pAttach)
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
 
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
 
     AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
 
-    if (pAttach->getType() != DeviceType_DVD)
+    if (pAttach->i_getType() != DeviceType_DVD)
         return setError(E_INVALIDARG,
-                        tr("Setting temporary eject flag rejected as the device attached to device slot %d on port %d of controller '%ls' is not a DVD"),
-                        aDevice, aControllerPort, aControllerName);
-    pAttach->updateTempEject(!!aTemporaryEject);
+                        tr("Setting temporary eject flag rejected as the device attached to device slot %d on port %d of controller '%s' is not a DVD"),
+                        aDevice, aControllerPort, aName.c_str());
+    pAttach->i_updateTempEject(!!aTemporaryEject);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::NonRotationalDevice(IN_BSTR aControllerName, LONG aControllerPort,
-                                          LONG aDevice, BOOL aNonRotational)
+HRESULT Machine::nonRotationalDevice(const com::Utf8Str &aName, LONG aControllerPort,
+                                     LONG aDevice, BOOL aNonRotational)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aNonRotational=%d\n",
-                     aControllerName, aControllerPort, aDevice, aNonRotational));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aNonRotational=%d\n",
+                     aName.c_str(), aControllerPort, aDevice, aNonRotational));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL);
@@ -4794,44 +4487,40 @@ STDMETHODIMP Machine::NonRotationalDevice(IN_BSTR aControllerName, LONG aControl
                         tr("Invalid machine state: %s"),
                         Global::stringifyMachineState(mData->mMachineState));
 
-    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
-                                               aControllerName,
-                                               aControllerPort,
-                                               aDevice);
+    MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                 Bstr(aName).raw(),
+                                                 aControllerPort,
+                                                 aDevice);
     if (!pAttach)
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
 
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
 
     AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
 
-    if (pAttach->getType() != DeviceType_HardDisk)
+    if (pAttach->i_getType() != DeviceType_HardDisk)
         return setError(E_INVALIDARG,
-                        tr("Setting the non-rotational medium flag rejected as the device attached to device slot %d on port %d of controller '%ls' is not a hard disk"),
-                        aDevice, aControllerPort, aControllerName);
-    pAttach->updateNonRotational(!!aNonRotational);
+                        tr("Setting the non-rotational medium flag rejected as the device attached to device slot %d on port %d of controller '%s' is not a hard disk"),
+                        aDevice, aControllerPort, aName.c_str());
+    pAttach->i_updateNonRotational(!!aNonRotational);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::SetAutoDiscardForDevice(IN_BSTR aControllerName, LONG aControllerPort,
-                                              LONG aDevice, BOOL aDiscard)
+HRESULT Machine::setAutoDiscardForDevice(const com::Utf8Str &aName, LONG aControllerPort,
+                                         LONG aDevice, BOOL aDiscard)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
 
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aDiscard=%d\n",
-                     aControllerName, aControllerPort, aDevice, aDiscard));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aDiscard=%d\n",
+                     aName.c_str(), aControllerPort, aDevice, aDiscard));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL);
@@ -4841,44 +4530,39 @@ STDMETHODIMP Machine::SetAutoDiscardForDevice(IN_BSTR aControllerName, LONG aCon
                         tr("Invalid machine state: %s"),
                         Global::stringifyMachineState(mData->mMachineState));
 
-    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
-                                               aControllerName,
-                                               aControllerPort,
-                                               aDevice);
+    MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                 Bstr(aName).raw(),
+                                                 aControllerPort,
+                                                 aDevice);
     if (!pAttach)
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
 
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
 
     AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
 
-    if (pAttach->getType() != DeviceType_HardDisk)
+    if (pAttach->i_getType() != DeviceType_HardDisk)
         return setError(E_INVALIDARG,
-                        tr("Setting the discard medium flag rejected as the device attached to device slot %d on port %d of controller '%ls' is not a hard disk"),
-                        aDevice, aControllerPort, aControllerName);
-    pAttach->updateDiscard(!!aDiscard);
+                        tr("Setting the discard medium flag rejected as the device attached to device slot %d on port %d of controller '%s' is not a hard disk"),
+                        aDevice, aControllerPort, aName.c_str());
+    pAttach->i_updateDiscard(!!aDiscard);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::SetHotPluggableForDevice(IN_BSTR aControllerName, LONG aControllerPort,
-                                               LONG aDevice, BOOL aHotPluggable)
+HRESULT Machine::setHotPluggableForDevice(const com::Utf8Str &aName, LONG aControllerPort,
+                                          LONG aDevice, BOOL aHotPluggable)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aHotPluggable=%d\n",
-                     aControllerName, aControllerPort, aDevice, aHotPluggable));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aHotPluggable=%d\n",
+                     aName.c_str(), aControllerPort, aDevice, aHotPluggable));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL);
@@ -4888,177 +4572,177 @@ STDMETHODIMP Machine::SetHotPluggableForDevice(IN_BSTR aControllerName, LONG aCo
                         tr("Invalid machine state: %s"),
                         Global::stringifyMachineState(mData->mMachineState));
 
-    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
-                                               aControllerName,
-                                               aControllerPort,
-                                               aDevice);
+    MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                 Bstr(aName).raw(),
+                                                 aControllerPort,
+                                                 aDevice);
     if (!pAttach)
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
+
+    /* Check for an existing controller. */
+    ComObjPtr<StorageController> ctl;
+    rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */);
+    if (FAILED(rc)) return rc;
+
+    StorageControllerType_T ctrlType;
+    rc = ctl->COMGETTER(ControllerType)(&ctrlType);
+    if (FAILED(rc))
+        return setError(E_FAIL,
+                        tr("Could not get type of controller '%s'"),
+                        aName.c_str());
 
-    /** @todo remove this blocker and add the missing code to support this
-     * flag properly in all code areas, with proper support checks below. */
+    if (!i_isControllerHotplugCapable(ctrlType))
     return setError(VBOX_E_NOT_SUPPORTED,
-                    tr("Controller '%ls' does not support changing the hot-pluggable device flag"),
-                    aControllerName);
+                    tr("Controller '%s' does not support changing the hot-pluggable device flag"),
+                    aName.c_str());
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
 
     AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
 
-    if (pAttach->getType() == DeviceType_Floppy)
+    if (pAttach->i_getType() == DeviceType_Floppy)
         return setError(E_INVALIDARG,
-                        tr("Setting the hot-pluggable device flag rejected as the device attached to device slot %d on port %d of controller '%ls' is a floppy drive"),
-                        aDevice, aControllerPort, aControllerName);
-    pAttach->updateHotPluggable(!!aHotPluggable);
+                        tr("Setting the hot-pluggable device flag rejected as the device attached to device slot %d on port %d of controller '%s' is a floppy drive"),
+                        aDevice, aControllerPort, aName.c_str());
+    pAttach->i_updateHotPluggable(!!aHotPluggable);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::SetNoBandwidthGroupForDevice(IN_BSTR aControllerName, LONG aControllerPort,
-                                                   LONG aDevice)
+HRESULT Machine::setNoBandwidthGroupForDevice(const com::Utf8Str &aName, LONG aControllerPort,
+                                              LONG aDevice)
 {
     int rc = S_OK;
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n",
-                     aControllerName, aControllerPort, aDevice));
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d\n",
+                     aName.c_str(), aControllerPort, aDevice));
 
-    rc = SetBandwidthGroupForDevice(aControllerName, aControllerPort, aDevice, NULL);
+    rc = setBandwidthGroupForDevice(aName, aControllerPort, aDevice, NULL);
 
     return rc;
 }
 
-STDMETHODIMP Machine::SetBandwidthGroupForDevice(IN_BSTR aControllerName, LONG aControllerPort,
-                                                 LONG aDevice, IBandwidthGroup *aBandwidthGroup)
+HRESULT Machine::setBandwidthGroupForDevice(const com::Utf8Str &aName, LONG aControllerPort,
+                                            LONG aDevice, const ComPtr<IBandwidthGroup> &aBandwidthGroup)
 {
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n",
-                     aControllerName, aControllerPort, aDevice));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d\n",
+                     aName.c_str(), aControllerPort, aDevice));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
-    AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL);
-
     if (Global::IsOnlineOrTransient(mData->mMachineState))
         return setError(VBOX_E_INVALID_VM_STATE,
                         tr("Invalid machine state: %s"),
                         Global::stringifyMachineState(mData->mMachineState));
 
-    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
-                                               aControllerName,
-                                               aControllerPort,
-                                               aDevice);
+    MediumAttachment *pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                 Bstr(aName).raw(),
+                                                 aControllerPort,
+                                                 aDevice);
     if (!pAttach)
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
 
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
 
-    ComObjPtr<BandwidthGroup> group = static_cast<BandwidthGroup*>(aBandwidthGroup);
+    IBandwidthGroup *iB = aBandwidthGroup;
+    ComObjPtr<BandwidthGroup> group = static_cast<BandwidthGroup*>(iB);
     if (aBandwidthGroup && group.isNull())
         return setError(E_INVALIDARG, "The given bandwidth group pointer is invalid");
 
     AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
 
-    const Utf8Str strBandwidthGroupOld = pAttach->getBandwidthGroup();
+    const Utf8Str strBandwidthGroupOld = pAttach->i_getBandwidthGroup();
     if (strBandwidthGroupOld.isNotEmpty())
     {
         /* Get the bandwidth group object and release it - this must not fail. */
         ComObjPtr<BandwidthGroup> pBandwidthGroupOld;
-        rc = getBandwidthGroup(strBandwidthGroupOld, pBandwidthGroupOld, false);
+        rc = i_getBandwidthGroup(strBandwidthGroupOld, pBandwidthGroupOld, false);
         Assert(SUCCEEDED(rc));
 
-        pBandwidthGroupOld->release();
-        pAttach->updateBandwidthGroup(Utf8Str::Empty);
+        pBandwidthGroupOld->i_release();
+        pAttach->i_updateBandwidthGroup(Utf8Str::Empty);
     }
 
     if (!group.isNull())
     {
-        group->reference();
-        pAttach->updateBandwidthGroup(group->getName());
+        group->i_reference();
+        pAttach->i_updateBandwidthGroup(group->i_getName());
     }
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::AttachDeviceWithoutMedium(IN_BSTR aControllerName,
-                                                LONG    aControllerPort,
-                                                LONG    aDevice,
-                                                DeviceType_T aType)
+HRESULT Machine::attachDeviceWithoutMedium(const com::Utf8Str &aName,
+                                           LONG aControllerPort,
+                                           LONG aDevice,
+                                           DeviceType_T aType)
 {
      HRESULT rc = S_OK;
 
-     LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aType=%d aMedium=%p\n",
-                      aControllerName, aControllerPort, aDevice, aType));
+     LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aType=%d aMedium=%p\n",
+                      aName.c_str(), aControllerPort, aDevice, aType));
 
-     rc = AttachDevice(aControllerName, aControllerPort, aDevice, aType, NULL);
+     rc = AttachDevice(Bstr(aName).raw(), aControllerPort, aDevice, aType, NULL);
 
      return rc;
 }
 
 
-
-STDMETHODIMP Machine::UnmountMedium(IN_BSTR aControllerName,
-                                    LONG    aControllerPort,
-                                    LONG    aDevice,
-                                    BOOL    aForce)
+HRESULT Machine::unmountMedium(const com::Utf8Str &aName,
+                               LONG aControllerPort,
+                               LONG aDevice,
+                               BOOL aForce)
 {
      int rc = S_OK;
-     LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d",
-                      aControllerName, aControllerPort, aForce));
+     LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d",
+                      aName.c_str(), aControllerPort, aForce));
 
-     rc = MountMedium(aControllerName, aControllerPort, aDevice, NULL, aForce);
+     rc = mountMedium(aName, aControllerPort, aDevice, NULL, aForce);
 
      return rc;
 }
 
-STDMETHODIMP Machine::MountMedium(IN_BSTR aControllerName,
-                                  LONG aControllerPort,
-                                  LONG aDevice,
-                                  IMedium *aMedium,
-                                  BOOL aForce)
+HRESULT Machine::mountMedium(const com::Utf8Str &aName,
+                             LONG aControllerPort,
+                             LONG aDevice,
+                             const ComPtr<IMedium> &aMedium,
+                             BOOL aForce)
 {
     int rc = S_OK;
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aForce=%d\n",
-                     aControllerName, aControllerPort, aDevice, aForce));
-
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d aForce=%d\n",
+                     aName.c_str(), aControllerPort, aDevice, aForce));
 
     // request the host lock first, since might be calling Host methods for getting host drives;
     // next, protect the media tree all the while we're in here, as well as our member variables
-    AutoMultiWriteLock3 multiLock(mParent->host()->lockHandle(),
+    AutoMultiWriteLock3 multiLock(mParent->i_host()->lockHandle(),
                                   this->lockHandle(),
-                                  &mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+                                  &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
-    ComObjPtr<MediumAttachment> pAttach = findAttachment(mMediaData->mAttachments,
-                                                         aControllerName,
-                                                         aControllerPort,
-                                                         aDevice);
+    ComObjPtr<MediumAttachment> pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                           Bstr(aName).raw(),
+                                                           aControllerPort,
+                                                           aDevice);
     if (pAttach.isNull())
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No drive attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No drive attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
 
     /* Remember previously mounted medium. The medium before taking the
      * backup is not necessarily the same thing. */
     ComObjPtr<Medium> oldmedium;
-    oldmedium = pAttach->getMedium();
+    oldmedium = pAttach->i_getMedium();
 
-    ComObjPtr<Medium> pMedium = static_cast<Medium*>(aMedium);
+    IMedium *iM = aMedium;
+    ComObjPtr<Medium> pMedium = static_cast<Medium*>(iM);
     if (aMedium && pMedium.isNull())
         return setError(E_INVALIDARG, "The given medium pointer is invalid");
 
@@ -5068,7 +4752,7 @@ STDMETHODIMP Machine::MountMedium(IN_BSTR aControllerName,
     AutoWriteLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS);
     if (pMedium)
     {
-        DeviceType_T mediumType = pAttach->getType();
+        DeviceType_T mediumType = pAttach->i_getType();
         switch (mediumType)
         {
             case DeviceType_DVD:
@@ -5077,45 +4761,45 @@ STDMETHODIMP Machine::MountMedium(IN_BSTR aControllerName,
 
             default:
                 return setError(VBOX_E_INVALID_OBJECT_STATE,
-                                tr("The device at port %d, device %d of controller '%ls' of this virtual machine is not removeable"),
+                                tr("The device at port %d, device %d of controller '%s' of this virtual machine is not removeable"),
                                 aControllerPort,
                                 aDevice,
-                                aControllerName);
+                                aName.c_str());
         }
     }
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
 
     {
         // The backup operation makes the pAttach reference point to the
         // old settings. Re-get the correct reference.
-        pAttach = findAttachment(mMediaData->mAttachments,
-                                 aControllerName,
-                                 aControllerPort,
-                                 aDevice);
+        pAttach = i_findAttachment(mMediaData->mAttachments,
+                                   Bstr(aName).raw(),
+                                   aControllerPort,
+                                   aDevice);
         if (!oldmedium.isNull())
-            oldmedium->removeBackReference(mData->mUuid);
+            oldmedium->i_removeBackReference(mData->mUuid);
         if (!pMedium.isNull())
         {
-            pMedium->addBackReference(mData->mUuid);
+            pMedium->i_addBackReference(mData->mUuid);
 
             mediumLock.release();
             multiLock.release();
-            addMediumToRegistry(pMedium);
+            i_addMediumToRegistry(pMedium);
             multiLock.acquire();
             mediumLock.acquire();
         }
 
         AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
-        pAttach->updateMedium(pMedium);
+        pAttach->i_updateMedium(pMedium);
     }
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
 
     mediumLock.release();
     multiLock.release();
-    rc = onMediumChange(pAttach, aForce);
+    rc = i_onMediumChange(pAttach, aForce);
     multiLock.acquire();
     mediumLock.acquire();
 
@@ -5123,173 +4807,130 @@ STDMETHODIMP Machine::MountMedium(IN_BSTR aControllerName,
     if (FAILED(rc))
     {
         if (!pMedium.isNull())
-            pMedium->removeBackReference(mData->mUuid);
-        pAttach = findAttachment(mMediaData->mAttachments,
-                                 aControllerName,
-                                 aControllerPort,
-                                 aDevice);
+            pMedium->i_removeBackReference(mData->mUuid);
+        pAttach = i_findAttachment(mMediaData->mAttachments,
+                                   Bstr(aName).raw(),
+                                   aControllerPort,
+                                   aDevice);
         /* If the attachment is gone in the meantime, bail out. */
         if (pAttach.isNull())
             return rc;
         AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
         if (!oldmedium.isNull())
-            oldmedium->addBackReference(mData->mUuid);
-        pAttach->updateMedium(oldmedium);
+            oldmedium->i_addBackReference(mData->mUuid);
+        pAttach->i_updateMedium(oldmedium);
     }
 
     mediumLock.release();
     multiLock.release();
 
-    mParent->saveModifiedRegistries();
+    /* Save modified registries, but skip this machine as it's the caller's
+     * job to save its settings like all other settings changes. */
+    mParent->i_unmarkRegistryModified(i_getId());
+    mParent->i_saveModifiedRegistries();
 
     return rc;
 }
-
-STDMETHODIMP Machine::GetMedium(IN_BSTR aControllerName,
-                                LONG aControllerPort,
-                                LONG aDevice,
-                                IMedium **aMedium)
+HRESULT Machine::getMedium(const com::Utf8Str &aName,
+                           LONG aControllerPort,
+                           LONG aDevice,
+                           ComPtr<IMedium> &aMedium)
 {
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n",
-                     aControllerName, aControllerPort, aDevice));
-
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-    CheckComArgOutPointerValid(aMedium);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\" aControllerPort=%d aDevice=%d\n",
+                     aName.c_str(), aControllerPort, aDevice));
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aMedium = NULL;
+    aMedium = NULL;
 
-    ComObjPtr<MediumAttachment> pAttach = findAttachment(mMediaData->mAttachments,
-                                                         aControllerName,
-                                                         aControllerPort,
-                                                         aDevice);
+    ComObjPtr<MediumAttachment> pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                           Bstr(aName).raw(),
+                                                           aControllerPort,
+                                                           aDevice);
     if (pAttach.isNull())
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
 
-    pAttach->getMedium().queryInterfaceTo(aMedium);
+    aMedium = pAttach->i_getMedium();
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetSerialPort(ULONG slot, ISerialPort **port)
+HRESULT Machine::getSerialPort(ULONG aSlot, ComPtr<ISerialPort> &aPort)
 {
-    CheckComArgOutPointerValid(port);
-    CheckComArgExpr(slot, slot < RT_ELEMENTS(mSerialPorts));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mSerialPorts[slot].queryInterfaceTo(port);
+    mSerialPorts[aSlot].queryInterfaceTo(aPort.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetParallelPort(ULONG slot, IParallelPort **port)
+HRESULT Machine::getParallelPort(ULONG aSlot, ComPtr<IParallelPort> &aPort)
 {
-    CheckComArgOutPointerValid(port);
-    CheckComArgExpr(slot, slot < RT_ELEMENTS(mParallelPorts));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mParallelPorts[slot].queryInterfaceTo(port);
+    mParallelPorts[aSlot].queryInterfaceTo(aPort.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetNetworkAdapter(ULONG slot, INetworkAdapter **adapter)
+HRESULT Machine::getNetworkAdapter(ULONG aSlot, ComPtr<INetworkAdapter> &aAdapter)
 {
-    CheckComArgOutPointerValid(adapter);
     /* Do not assert if slot is out of range, just return the advertised
        status.  testdriver/vbox.py triggers this in logVmInfo. */
-    if (slot >= mNetworkAdapters.size())
+    if (aSlot >= mNetworkAdapters.size())
         return setError(E_INVALIDARG,
                         tr("No network adapter in slot %RU32 (total %RU32 adapters)"),
-                        slot, mNetworkAdapters.size());
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+                        aSlot, mNetworkAdapters.size());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mNetworkAdapters[slot].queryInterfaceTo(adapter);
+    mNetworkAdapters[aSlot].queryInterfaceTo(aAdapter.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetExtraDataKeys(ComSafeArrayOut(BSTR, aKeys))
+HRESULT Machine::getExtraDataKeys(std::vector<com::Utf8Str> &aKeys)
 {
-    CheckComArgOutSafeArrayPointerValid(aKeys);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<BSTR> saKeys(mData->pMachineConfigFile->mapExtraDataItems.size());
-    int i = 0;
+    aKeys.resize(mData->pMachineConfigFile->mapExtraDataItems.size());
+    size_t i = 0;
     for (settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.begin();
          it != mData->pMachineConfigFile->mapExtraDataItems.end();
          ++it, ++i)
-    {
-        const Utf8Str &strKey = it->first;
-        strKey.cloneTo(&saKeys[i]);
-    }
-    saKeys.detachTo(ComSafeArrayOutArg(aKeys));
+        aKeys[i] = it->first;
 
     return S_OK;
-  }
+}
 
   /**
    *  @note Locks this object for reading.
    */
-STDMETHODIMP Machine::GetExtraData(IN_BSTR aKey,
-                                   BSTR *aValue)
+HRESULT Machine::getExtraData(const com::Utf8Str &aKey,
+                              com::Utf8Str &aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aKey);
-    CheckComArgOutPointerValid(aValue);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* start with nothing found */
-    Bstr bstrResult("");
+    aValue = "";
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find(Utf8Str(aKey));
+    settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find(aKey);
     if (it != mData->pMachineConfigFile->mapExtraDataItems.end())
         // found:
-        bstrResult = it->second; // source is a Utf8Str
+        aValue = it->second; // source is a Utf8Str
 
     /* return the result to caller (may be empty) */
-    bstrResult.cloneTo(aValue);
-
     return S_OK;
 }
 
   /**
    *  @note Locks mParent for writing + this object for writing.
    */
-STDMETHODIMP Machine::SetExtraData(IN_BSTR aKey, IN_BSTR aValue)
+HRESULT Machine::setExtraData(const com::Utf8Str &aKey, const com::Utf8Str &aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aKey);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    Utf8Str strKey(aKey);
-    Utf8Str strValue(aValue);
     Utf8Str strOldValue;            // empty
 
     // locking note: we only hold the read lock briefly to look up the old value,
@@ -5302,30 +4943,42 @@ STDMETHODIMP Machine::SetExtraData(IN_BSTR aKey, IN_BSTR aValue)
     // look up the old value first; if nothing has changed then we need not do anything
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); // hold read lock only while looking up
-        settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find(strKey);
+
+        // For snapshots don't even think about allowing changes, extradata
+        // is global for a machine, so there is nothing snapshot specific.
+        if (i_isSnapshotMachine())
+            return setError(VBOX_E_INVALID_VM_STATE,
+                            tr("Cannot set extradata for a snapshot"));
+
+        // check if the right IMachine instance is used
+        if (mData->mRegistered && !i_isSessionMachine())
+            return setError(VBOX_E_INVALID_VM_STATE,
+                            tr("Cannot set extradata for an immutable machine"));
+
+        settings::StringsMap::const_iterator it = mData->pMachineConfigFile->mapExtraDataItems.find(aKey);
         if (it != mData->pMachineConfigFile->mapExtraDataItems.end())
             strOldValue = it->second;
     }
 
     bool fChanged;
-    if ((fChanged = (strOldValue != strValue)))
+    if ((fChanged = (strOldValue != aValue)))
     {
         // ask for permission from all listeners outside the locks;
-        // onExtraDataCanChange() only briefly requests the VirtualBox
+        // i_onExtraDataCanChange() only briefly requests the VirtualBox
         // lock to copy the list of callbacks to invoke
         Bstr error;
         Bstr bstrValue(aValue);
 
-        if (!mParent->onExtraDataCanChange(mData->mUuid, aKey, bstrValue.raw(), error))
+        if (!mParent->i_onExtraDataCanChange(mData->mUuid, Bstr(aKey).raw(), bstrValue.raw(), error))
         {
             const char *sep = error.isEmpty() ? "" : ": ";
             CBSTR err = error.raw();
             LogWarningFunc(("Someone vetoed! Change refused%s%ls\n",
                             sep, err));
             return setError(E_ACCESSDENIED,
-                            tr("Could not set extra data because someone refused the requested change of '%ls' to '%ls'%s%ls"),
-                            aKey,
-                            bstrValue.raw(),
+                            tr("Could not set extra data because someone refused the requested change of '%s' to '%s'%s%ls"),
+                            aKey.c_str(),
+                            aValue.c_str(),
                             sep,
                             err);
         }
@@ -5333,62 +4986,46 @@ STDMETHODIMP Machine::SetExtraData(IN_BSTR aKey, IN_BSTR aValue)
         // data is changing and change not vetoed: then write it out under the lock
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        if (isSnapshotMachine())
-        {
-            HRESULT rc = checkStateDependency(MutableStateDep);
-            if (FAILED(rc)) return rc;
-        }
-
-        if (strValue.isEmpty())
-            mData->pMachineConfigFile->mapExtraDataItems.erase(strKey);
+        if (aValue.isEmpty())
+            mData->pMachineConfigFile->mapExtraDataItems.erase(aKey);
         else
-            mData->pMachineConfigFile->mapExtraDataItems[strKey] = strValue;
+            mData->pMachineConfigFile->mapExtraDataItems[aKey] = aValue;
                 // creates a new key if needed
 
         bool fNeedsGlobalSaveSettings = false;
         // This saving of settings is tricky: there is no "old state" for the
         // extradata items at all (unlike all other settings), so the old/new
         // settings comparison would give a wrong result!
-        saveSettings(&fNeedsGlobalSaveSettings, SaveS_Force);
+        i_saveSettings(&fNeedsGlobalSaveSettings, SaveS_Force);
 
         if (fNeedsGlobalSaveSettings)
         {
             // save the global settings; for that we should hold only the VirtualBox lock
             alock.release();
             AutoWriteLock vboxlock(mParent COMMA_LOCKVAL_SRC_POS);
-            mParent->saveSettings();
+            mParent->i_saveSettings();
         }
     }
 
     // fire notification outside the lock
     if (fChanged)
-        mParent->onExtraDataChange(mData->mUuid, aKey, aValue);
+        mParent->i_onExtraDataChange(mData->mUuid, Bstr(aKey).raw(), Bstr(aValue).raw());
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::SetSettingsFilePath(IN_BSTR aFilePath, IProgress **aProgress)
+HRESULT Machine::setSettingsFilePath(const com::Utf8Str &aSettingsFilePath, ComPtr<IProgress> &aProgress)
 {
-    CheckComArgStrNotEmptyOrNull(aFilePath);
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *aProgress = NULL;
+    aProgress = NULL;
+    NOREF(aSettingsFilePath);
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP Machine::SaveSettings()
+HRESULT Machine::saveSettings()
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS);
 
-    /* when there was auto-conversion, we want to save the file even if
-     * the VM is saved */
-    HRESULT rc = checkStateDependency(MutableOrSavedStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
     /* the settings file path may never be null */
@@ -5396,49 +5033,44 @@ STDMETHODIMP Machine::SaveSettings()
 
     /* save all VM data excluding snapshots */
     bool fNeedsGlobalSaveSettings = false;
-    rc = saveSettings(&fNeedsGlobalSaveSettings);
+    rc = i_saveSettings(&fNeedsGlobalSaveSettings);
     mlock.release();
 
     if (SUCCEEDED(rc) && fNeedsGlobalSaveSettings)
     {
         // save the global settings; for that we should hold only the VirtualBox lock
         AutoWriteLock vlock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     return rc;
 }
 
-STDMETHODIMP Machine::DiscardSettings()
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT Machine::discardSettings()
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
     /*
      *  during this rollback, the session will be notified if data has
      *  been actually changed
      */
-    rollback(true /* aNotify */);
+    i_rollback(true /* aNotify */);
 
     return S_OK;
 }
 
 /** @note Locks objects! */
-STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,
-                                 ComSafeArrayOut(IMedium*, aMedia))
+HRESULT Machine::unregister(AutoCaller &autoCaller,
+                            CleanupMode_T aCleanupMode,
+                            std::vector<ComPtr<IMedium> > &aMedia)
 {
-    // use AutoLimitedCaller because this call is valid on inaccessible machines as well
-    AutoLimitedCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Guid id(getId());
+    Guid id(i_getId());
 
     if (mData->mSession.mState != SessionState_Unlocked)
         return setError(VBOX_E_INVALID_OBJECT_STATE,
@@ -5446,7 +5078,7 @@ STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,
                         mUserData->s.strName.c_str());
 
     // wait for state dependents to drop to zero
-    ensureNoStateDependencies();
+    i_ensureNoStateDependencies();
 
     if (!mData->mAccessible)
     {
@@ -5459,14 +5091,15 @@ STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,
 
         uninit();
 
-        mParent->unregisterMachine(this, id);
-            // calls VirtualBox::saveSettings()
+        mParent->i_unregisterMachine(this, id);
+            // calls VirtualBox::i_saveSettings()
 
         return S_OK;
     }
 
     HRESULT rc = S_OK;
 
+    /// @todo r=klaus this is stupid... why is the saved state always deleted?
     // discard saved state
     if (mData->mMachineState == MachineState_Saved)
     {
@@ -5483,8 +5116,8 @@ STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,
 
     size_t cSnapshots = 0;
     if (mData->mFirstSnapshot)
-        cSnapshots = mData->mFirstSnapshot->getAllChildrenCount() + 1;
-    if (cSnapshots && cleanupMode == CleanupMode_UnregisterOnly)
+        cSnapshots = mData->mFirstSnapshot->i_getAllChildrenCount() + 1;
+    if (cSnapshots && aCleanupMode == CleanupMode_UnregisterOnly)
         // fail now before we start detaching media
         return setError(VBOX_E_INVALID_OBJECT_STATE,
                         tr("Cannot unregister the machine '%s' because it has %d snapshots"),
@@ -5506,8 +5139,8 @@ STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,
        )
     {
         // we have media attachments: detach them all and add the Medium objects to our list
-        if (cleanupMode != CleanupMode_UnregisterOnly)
-            detachAllMedia(alock, NULL /* pSnapshot */, cleanupMode, llMedia);
+        if (aCleanupMode != CleanupMode_UnregisterOnly)
+            i_detachAllMedia(alock, NULL /* pSnapshot */, aCleanupMode, llMedia);
         else
             return setError(VBOX_E_INVALID_OBJECT_STATE,
                             tr("Cannot unregister the machine '%s' because it has %d media attachments"),
@@ -5516,8 +5149,6 @@ STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,
 
     if (cSnapshots)
     {
-        // autoCleanup must be true here, or we would have failed above
-
         // add the media from the medium attachments of the snapshots to llMedia
         // as well, after the "main" machine media; Snapshot::uninitRecursively()
         // calls Machine::detachAllMedia() for the snapshot machine, recursing
@@ -5533,19 +5164,19 @@ STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,
         ComObjPtr<Snapshot> pFirstSnapshot = mData->mFirstSnapshot;
 
         // GO!
-        pFirstSnapshot->uninitRecursively(alock, cleanupMode, llMedia, mData->llFilesToDelete);
+        pFirstSnapshot->i_uninitRecursively(alock, aCleanupMode, llMedia, mData->llFilesToDelete);
 
         mData->mMachineState = oldState;
     }
 
     if (FAILED(rc))
     {
-        rollbackMedia();
+        i_rollbackMedia();
         return rc;
     }
 
     // commit all the media changes made above
-    commitMedia();
+    i_commitMedia();
 
     mData->mRegistered = false;
 
@@ -5553,137 +5184,73 @@ STDMETHODIMP Machine::Unregister(CleanupMode_T cleanupMode,
     alock.release();
 
     // return media to caller
-    SafeIfaceArray<IMedium> sfaMedia(llMedia);
-    sfaMedia.detachTo(ComSafeArrayOutArg(aMedia));
+    size_t i = 0;
+    aMedia.resize(llMedia.size());
+    for (MediaList::iterator it = llMedia.begin(); it != llMedia.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aMedia[i].asOutParam());
 
-    mParent->unregisterMachine(this, id);
-            // calls VirtualBox::saveSettings() and VirtualBox::saveModifiedRegistries()
+    mParent->i_unregisterMachine(this, id);
+            // calls VirtualBox::i_saveSettings() and VirtualBox::saveModifiedRegistries()
 
     return S_OK;
 }
 
-struct Machine::DeleteTask
+/**
+ * Task record for deleting a machine config.
+ */
+struct Machine::DeleteConfigTask
+    : public Machine::Task
 {
-    ComObjPtr<Machine>          pMachine;
-    RTCList<ComPtr<IMedium> >   llMediums;
-    StringsList                 llFilesToDelete;
-    ComObjPtr<Progress>         pProgress;
+    DeleteConfigTask(Machine *m,
+                     Progress *p,
+                     const Utf8Str &t,
+                     const RTCList<ComPtr<IMedium> > &llMediums,
+                     const StringsList &llFilesToDelete)
+        : Task(m, p, t),
+          m_llMediums(llMediums),
+          m_llFilesToDelete(llFilesToDelete)
+    {}
+
+    void handler()
+    {
+        m_pMachine->i_deleteConfigHandler(*this);
+    }
+
+    RTCList<ComPtr<IMedium> >   m_llMediums;
+    StringsList                 m_llFilesToDelete;
 };
 
-STDMETHODIMP Machine::DeleteConfig(ComSafeArrayIn(IMedium*, aMedia), IProgress **aProgress)
+/**
+ * Task thread implementation for SessionMachine::DeleteConfig(), called from
+ * SessionMachine::taskHandler().
+ *
+ * @note Locks this object for writing.
+ *
+ * @param task
+ * @return
+ */
+void Machine::i_deleteConfigHandler(DeleteConfigTask &task)
 {
-    LogFlowFuncEnter();
+    LogFlowThisFuncEnter();
 
     AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("state=%d\n", getObjectState().getState()));
+    if (FAILED(autoCaller.rc()))
+    {
+        /* we might have been uninitialized because the session was accidentally
+         * closed by the client, so don't assert */
+        HRESULT rc = setError(E_FAIL,
+                              tr("The session has been accidentally closed"));
+        task.m_pProgress->i_notifyComplete(rc);
+        LogFlowThisFuncLeave();
+        return;
+    }
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
-    if (FAILED(rc)) return rc;
-
-    if (mData->mRegistered)
-        return setError(VBOX_E_INVALID_VM_STATE,
-                        tr("Cannot delete settings of a registered machine"));
-
-    DeleteTask *pTask = new DeleteTask;
-    pTask->pMachine = this;
-    com::SafeIfaceArray<IMedium> sfaMedia(ComSafeArrayInArg(aMedia));
-
-    // collect files to delete
-    pTask->llFilesToDelete = mData->llFilesToDelete;            // saved states pushed here by Unregister()
+    HRESULT rc = S_OK;
 
-    for (size_t i = 0; i < sfaMedia.size(); ++i)
-    {
-        IMedium *pIMedium(sfaMedia[i]);
-        ComObjPtr<Medium> pMedium = static_cast<Medium*>(pIMedium);
-        if (pMedium.isNull())
-            return setError(E_INVALIDARG, "The given medium pointer with index %d is invalid", i);
-        SafeArray<BSTR> ids;
-        rc = pMedium->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(ids));
-        if (FAILED(rc)) return rc;
-        /* At this point the medium should not have any back references
-         * anymore. If it has it is attached to another VM and *must* not
-         * deleted. */
-        if (ids.size() < 1)
-            pTask->llMediums.append(pMedium);
-    }
-    if (mData->pMachineConfigFile->fileExists())
-        pTask->llFilesToDelete.push_back(mData->m_strConfigFileFull);
-
-    pTask->pProgress.createObject();
-    pTask->pProgress->init(getVirtualBox(),
-                           static_cast<IMachine*>(this) /* aInitiator */,
-                           Bstr(tr("Deleting files")).raw(),
-                           true /* fCancellable */,
-                           pTask->llFilesToDelete.size() + pTask->llMediums.size() + 1,   // cOperations
-                           BstrFmt(tr("Deleting '%s'"), pTask->llFilesToDelete.front().c_str()).raw());
-
-    int vrc = RTThreadCreate(NULL,
-                             Machine::deleteThread,
-                             (void*)pTask,
-                             0,
-                             RTTHREADTYPE_MAIN_WORKER,
-                             0,
-                             "MachineDelete");
-
-    pTask->pProgress.queryInterfaceTo(aProgress);
-
-    if (RT_FAILURE(vrc))
-    {
-        delete pTask;
-        return setError(E_FAIL, "Could not create MachineDelete thread (%Rrc)", vrc);
-    }
-
-    LogFlowFuncLeave();
-
-    return S_OK;
-}
-
-/**
- * Static task wrapper passed to RTThreadCreate() in Machine::Delete() which then
- * calls Machine::deleteTaskWorker() on the actual machine object.
- * @param Thread
- * @param pvUser
- * @return
- */
-/*static*/
-DECLCALLBACK(int) Machine::deleteThread(RTTHREAD Thread, void *pvUser)
-{
-    LogFlowFuncEnter();
-
-    DeleteTask *pTask = (DeleteTask*)pvUser;
-    Assert(pTask);
-    Assert(pTask->pMachine);
-    Assert(pTask->pProgress);
-
-    HRESULT rc = pTask->pMachine->deleteTaskWorker(*pTask);
-    pTask->pProgress->notifyComplete(rc);
-
-    delete pTask;
-
-    LogFlowFuncLeave();
-
-    NOREF(Thread);
-
-    return VINF_SUCCESS;
-}
-
-/**
- * Task thread implementation for Machine::Delete(), called from Machine::deleteThread().
- * @param task
- * @return
- */
-HRESULT Machine::deleteTaskWorker(DeleteTask &task)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    HRESULT rc = S_OK;
-
-    try
+    try
     {
         ULONG uLogHistoryCount = 3;
         ComPtr<ISystemProperties> systemProperties;
@@ -5697,25 +5264,25 @@ HRESULT Machine::deleteTaskWorker(DeleteTask &task)
         }
 
         MachineState_T oldState = mData->mMachineState;
-        setMachineState(MachineState_SettingUp);
+        i_setMachineState(MachineState_SettingUp);
         alock.release();
-        for (size_t i = 0; i < task.llMediums.size(); ++i)
+        for (size_t i = 0; i < task.m_llMediums.size(); ++i)
         {
-            ComObjPtr<Medium> pMedium = (Medium*)(IMedium*)task.llMediums.at(i);
+            ComObjPtr<Medium> pMedium = (Medium*)(IMedium*)(task.m_llMediums.at(i));
             {
                 AutoCaller mac(pMedium);
                 if (FAILED(mac.rc())) throw mac.rc();
-                Utf8Str strLocation = pMedium->getLocationFull();
-                rc = task.pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), strLocation.c_str()).raw(), 1);
+                Utf8Str strLocation = pMedium->i_getLocationFull();
+                rc = task.m_pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), strLocation.c_str()).raw(), 1);
                 if (FAILED(rc)) throw rc;
                 LogFunc(("Deleting file %s\n", strLocation.c_str()));
             }
-            if (pMedium->isMediumFormatFile())
+            if (pMedium->i_isMediumFormatFile())
             {
                 ComPtr<IProgress> pProgress2;
                 rc = pMedium->DeleteStorage(pProgress2.asOutParam());
                 if (FAILED(rc)) throw rc;
-                rc = task.pProgress->WaitForAsyncProgressCompletion(pProgress2);
+                rc = task.m_pProgress->WaitForAsyncProgressCompletion(pProgress2);
                 if (FAILED(rc)) throw rc;
                 /* Check the result of the asynchronous process. */
                 LONG iRc;
@@ -5736,15 +5303,15 @@ HRESULT Machine::deleteTaskWorker(DeleteTask &task)
                 pMedium->Close();
             }
         }
-        setMachineState(oldState);
+        i_setMachineState(oldState);
         alock.acquire();
 
         // delete the files pushed on the task list by Machine::Delete()
         // (this includes saved states of the machine and snapshots and
         // medium storage files from the IMedium list passed in, and the
         // machine XML file)
-        StringsList::const_iterator it = task.llFilesToDelete.begin();
-        while (it != task.llFilesToDelete.end())
+        StringsList::const_iterator it = task.m_llFilesToDelete.begin();
+        while (it != task.m_llFilesToDelete.end())
         {
             const Utf8Str &strFile = *it;
             LogFunc(("Deleting file %s\n", strFile.c_str()));
@@ -5754,14 +5321,14 @@ HRESULT Machine::deleteTaskWorker(DeleteTask &task)
                                tr("Could not delete file '%s' (%Rrc)"), strFile.c_str(), vrc);
 
             ++it;
-            if (it == task.llFilesToDelete.end())
+            if (it == task.m_llFilesToDelete.end())
             {
-                rc = task.pProgress->SetNextOperation(Bstr(tr("Cleaning up machine directory")).raw(), 1);
+                rc = task.m_pProgress->SetNextOperation(Bstr(tr("Cleaning up machine directory")).raw(), 1);
                 if (FAILED(rc)) throw rc;
                 break;
             }
 
-            rc = task.pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), it->c_str()).raw(), 1);
+            rc = task.m_pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), it->c_str()).raw(), 1);
             if (FAILED(rc)) throw rc;
         }
 
@@ -5816,7 +5383,7 @@ HRESULT Machine::deleteTaskWorker(DeleteTask &task)
              * there (we don't check for errors because the user might have
              * some private files there that we don't want to delete) */
             Utf8Str strFullSnapshotFolder;
-            calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);
+            i_calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);
             Assert(!strFullSnapshotFolder.isEmpty());
             if (RTDirExists(strFullSnapshotFolder.c_str()))
                 RTDirRemove(strFullSnapshotFolder.c_str());
@@ -5824,126 +5391,163 @@ HRESULT Machine::deleteTaskWorker(DeleteTask &task)
             // delete the directory that contains the settings file, but only
             // if it matches the VM name
             Utf8Str settingsDir;
-            if (isInOwnDir(&settingsDir))
+            if (i_isInOwnDir(&settingsDir))
                 RTDirRemove(settingsDir.c_str());
         }
 
         alock.release();
 
-        mParent->saveModifiedRegistries();
+        mParent->i_saveModifiedRegistries();
     }
     catch (HRESULT aRC) { rc = aRC; }
 
-    return rc;
+    task.m_pProgress->i_notifyComplete(rc);
+
+    LogFlowThisFuncLeave();
 }
 
-STDMETHODIMP Machine::FindSnapshot(IN_BSTR aNameOrId, ISnapshot **aSnapshot)
+HRESULT Machine::deleteConfig(const std::vector<ComPtr<IMedium> > &aMedia, ComPtr<IProgress> &aProgress)
 {
-    CheckComArgOutPointerValid(aSnapshot);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
+    if (FAILED(rc)) return rc;
+
+    if (mData->mRegistered)
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("Cannot delete settings of a registered machine"));
+
+    // collect files to delete
+    StringsList llFilesToDelete(mData->llFilesToDelete);    // saved states pushed here by Unregister()
+    if (mData->pMachineConfigFile->fileExists())
+        llFilesToDelete.push_back(mData->m_strConfigFileFull);
+
+    RTCList<ComPtr<IMedium> > llMediums;
+    for (size_t i = 0; i < aMedia.size(); ++i)
+    {
+        IMedium *pIMedium(aMedia[i]);
+        ComObjPtr<Medium> pMedium = static_cast<Medium*>(pIMedium);
+        if (pMedium.isNull())
+            return setError(E_INVALIDARG, "The given medium pointer with index %d is invalid", i);
+        SafeArray<BSTR> ids;
+        rc = pMedium->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(ids));
+        if (FAILED(rc)) return rc;
+        /* At this point the medium should not have any back references
+         * anymore. If it has it is attached to another VM and *must* not
+         * deleted. */
+        if (ids.size() < 1)
+            llMediums.append(pMedium);
+    }
+
+    ComObjPtr<Progress> pProgress;
+    pProgress.createObject();
+    rc = pProgress->init(i_getVirtualBox(),
+                         static_cast<IMachine*>(this) /* aInitiator */,
+                         Bstr(tr("Deleting files")).raw(),
+                         true /* fCancellable */,
+                         (ULONG)(llFilesToDelete.size() + llMediums.size() + 1),   // cOperations
+                         BstrFmt(tr("Deleting '%s'"), llFilesToDelete.front().c_str()).raw());
+    if (FAILED(rc))
+        return rc;
 
+    /* create and start the task on a separate thread (note that it will not
+     * start working until we release alock) */
+    DeleteConfigTask *pTask = new DeleteConfigTask(this, pProgress, "DeleteVM", llMediums, llFilesToDelete);
+    rc = pTask->createThread();
+    if (FAILED(rc))
+        return rc;
+
+    pProgress.queryInterfaceTo(aProgress.asOutParam());
+
+    LogFlowFuncLeave();
+
+    return S_OK;
+}
+
+HRESULT Machine::findSnapshot(const com::Utf8Str &aNameOrId, ComPtr<ISnapshot> &aSnapshot)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<Snapshot> pSnapshot;
     HRESULT rc;
 
-    if (!aNameOrId || !*aNameOrId)
-        // null case (caller wants root snapshot): findSnapshotById() handles this
-        rc = findSnapshotById(Guid(), pSnapshot, true /* aSetError */);
+    if (aNameOrId.isEmpty())
+        // null case (caller wants root snapshot): i_findSnapshotById() handles this
+        rc = i_findSnapshotById(Guid(), pSnapshot, true /* aSetError */);
     else
     {
         Guid uuid(aNameOrId);
         if (uuid.isValid())
-            rc = findSnapshotById(uuid, pSnapshot, true /* aSetError */);
+            rc = i_findSnapshotById(uuid, pSnapshot, true /* aSetError */);
         else
-            rc = findSnapshotByName(Utf8Str(aNameOrId), pSnapshot, true /* aSetError */);
+            rc = i_findSnapshotByName(aNameOrId, pSnapshot, true /* aSetError */);
     }
-    pSnapshot.queryInterfaceTo(aSnapshot);
+    pSnapshot.queryInterfaceTo(aSnapshot.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP Machine::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, BOOL aWritable, BOOL aAutoMount)
+HRESULT Machine::createSharedFolder(const com::Utf8Str &aName, const com::Utf8Str &aHostPath, BOOL  aWritable, BOOL  aAutomount)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgStrNotEmptyOrNull(aHostPath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
-    Utf8Str strName(aName);
-
     ComObjPtr<SharedFolder> sharedFolder;
-    rc = findSharedFolder(strName, sharedFolder, false /* aSetError */);
+    rc = i_findSharedFolder(aName, sharedFolder, false /* aSetError */);
     if (SUCCEEDED(rc))
         return setError(VBOX_E_OBJECT_IN_USE,
                         tr("Shared folder named '%s' already exists"),
-                        strName.c_str());
+                        aName.c_str());
 
     sharedFolder.createObject();
-    rc = sharedFolder->init(getMachine(),
-                            strName,
+    rc = sharedFolder->init(i_getMachine(),
+                            aName,
                             aHostPath,
                             !!aWritable,
-                            !!aAutoMount,
+                            !!aAutomount,
                             true /* fFailOnError */);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_SharedFolders);
+    i_setModified(IsModified_SharedFolders);
     mHWData.backup();
     mHWData->mSharedFolders.push_back(sharedFolder);
 
     /* inform the direct session if any */
     alock.release();
-    onSharedFolderChange();
+    i_onSharedFolderChange();
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::RemoveSharedFolder(IN_BSTR aName)
+HRESULT Machine::removeSharedFolder(const com::Utf8Str &aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);
     if (FAILED(rc)) return rc;
 
     ComObjPtr<SharedFolder> sharedFolder;
-    rc = findSharedFolder(aName, sharedFolder, true /* aSetError */);
+    rc = i_findSharedFolder(aName, sharedFolder, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_SharedFolders);
+    i_setModified(IsModified_SharedFolders);
     mHWData.backup();
     mHWData->mSharedFolders.remove(sharedFolder);
 
     /* inform the direct session if any */
     alock.release();
-    onSharedFolderChange();
+    i_onSharedFolderChange();
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::CanShowConsoleWindow(BOOL *aCanShow)
+HRESULT Machine::canShowConsoleWindow(BOOL *aCanShow)
 {
-    CheckComArgOutPointerValid(aCanShow);
-
     /* start with No */
     *aCanShow = FALSE;
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -5953,7 +5557,8 @@ STDMETHODIMP Machine::CanShowConsoleWindow(BOOL *aCanShow)
                             tr("Machine is not locked for session (session state: %s)"),
                             Global::stringifySessionState(mData->mSession.mState));
 
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore calls made after #OnSessionEnd() is called */
@@ -5964,13 +5569,8 @@ STDMETHODIMP Machine::CanShowConsoleWindow(BOOL *aCanShow)
     return directControl->OnShowWindow(TRUE /* aCheck */, aCanShow, &dummy);
 }
 
-STDMETHODIMP Machine::ShowConsoleWindow(LONG64 *aWinId)
+HRESULT Machine::showConsoleWindow(LONG64 *aWinId)
 {
-    CheckComArgOutPointerValid(aWinId);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -5980,7 +5580,8 @@ STDMETHODIMP Machine::ShowConsoleWindow(LONG64 *aWinId)
                             tr("Machine is not locked for session (session state: %s)"),
                             Global::stringifySessionState(mData->mSession.mState));
 
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore calls made after #OnSessionEnd() is called */
@@ -5995,24 +5596,23 @@ STDMETHODIMP Machine::ShowConsoleWindow(LONG64 *aWinId)
 /**
  * Look up a guest property in VBoxSVC's internal structures.
  */
-HRESULT Machine::getGuestPropertyFromService(IN_BSTR aName,
-                                             BSTR *aValue,
-                                             LONG64 *aTimestamp,
-                                             BSTR *aFlags) const
+HRESULT Machine::i_getGuestPropertyFromService(const com::Utf8Str &aName,
+                                               com::Utf8Str &aValue,
+                                               LONG64 *aTimestamp,
+                                               com::Utf8Str &aFlags) const
 {
     using namespace guestProp;
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    Utf8Str strName(aName);
-    HWData::GuestPropertyMap::const_iterator it = mHWData->mGuestProperties.find(strName);
+    HWData::GuestPropertyMap::const_iterator it = mHWData->mGuestProperties.find(aName);
 
     if (it != mHWData->mGuestProperties.end())
     {
         char szFlags[MAX_FLAGS_LEN + 1];
-        it->second.strValue.cloneTo(aValue);
+        aValue = it->second.strValue;
         *aTimestamp = it->second.mTimestamp;
         writeFlags(it->second.mFlags, szFlags);
-        Bstr(szFlags).cloneTo(aFlags);
+        aFlags = Utf8Str(szFlags);
     }
 
     return S_OK;
@@ -6024,128 +5624,122 @@ HRESULT Machine::getGuestPropertyFromService(IN_BSTR aName,
  *          currently handling queries and the lookup should then be done in
  *          VBoxSVC.
  */
-HRESULT Machine::getGuestPropertyFromVM(IN_BSTR aName,
-                                        BSTR *aValue,
-                                        LONG64 *aTimestamp,
-                                        BSTR *aFlags) const
+HRESULT Machine::i_getGuestPropertyFromVM(const com::Utf8Str &aName,
+                                          com::Utf8Str &aValue,
+                                          LONG64 *aTimestamp,
+                                          com::Utf8Str &aFlags) const
 {
-    HRESULT rc;
-    ComPtr<IInternalSessionControl> directControl;
-    directControl = mData->mSession.mDirectControl;
+    HRESULT rc = S_OK;
+    BSTR bValue = NULL;
+    BSTR bFlags = NULL;
 
-    /* fail if we were called after #OnSessionEnd() is called.  This is a
-     * silly race condition. */
+    ComPtr<IInternalSessionControl> directControl;
+    {
+        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
+    }
 
-    /** @todo This code is bothering API clients (like python script clients) with
-     *        the AccessGuestProperty call, creating unncessary IPC.  Need to
-     *        have a way of figuring out which kind of direct session it is... */
+    /* ignore calls made after #OnSessionEnd() is called */
     if (!directControl)
         rc = E_ACCESSDENIED;
     else
-        rc = directControl->AccessGuestProperty(aName, NULL, NULL,
-                                                false /* isSetter */,
-                                                aValue, aTimestamp, aFlags);
+        rc = directControl->AccessGuestProperty(Bstr(aName).raw(), Bstr("").raw(), Bstr("").raw(),
+                                                0 /* accessMode */,
+                                                &bValue, aTimestamp, &bFlags);
+
+    aValue = bValue;
+    aFlags = bFlags;
+
     return rc;
 }
 #endif // VBOX_WITH_GUEST_PROPS
 
-STDMETHODIMP Machine::GetGuestProperty(IN_BSTR aName,
-                                       BSTR *aValue,
-                                       LONG64 *aTimestamp,
-                                       BSTR *aFlags)
+HRESULT Machine::getGuestProperty(const com::Utf8Str &aName,
+                                  com::Utf8Str &aValue,
+                                  LONG64 *aTimestamp,
+                                  com::Utf8Str &aFlags)
 {
 #ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
 #else // VBOX_WITH_GUEST_PROPS
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgOutPointerValid(aValue);
-    CheckComArgOutPointerValid(aTimestamp);
-    CheckComArgOutPointerValid(aFlags);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    HRESULT rc = i_getGuestPropertyFromVM(aName, aValue, aTimestamp, aFlags);
 
-    HRESULT rc = getGuestPropertyFromVM(aName, aValue, aTimestamp, aFlags);
     if (rc == E_ACCESSDENIED)
         /* The VM is not running or the service is not (yet) accessible */
-        rc = getGuestPropertyFromService(aName, aValue, aTimestamp, aFlags);
+        rc = i_getGuestPropertyFromService(aName, aValue, aTimestamp, aFlags);
     return rc;
 #endif // VBOX_WITH_GUEST_PROPS
 }
 
-STDMETHODIMP Machine::GetGuestPropertyValue(IN_BSTR aName, BSTR *aValue)
+HRESULT Machine::getGuestPropertyValue(const com::Utf8Str &aProperty, com::Utf8Str &aValue)
 {
     LONG64 dummyTimestamp;
-    Bstr dummyFlags;
-    return GetGuestProperty(aName, aValue, &dummyTimestamp, dummyFlags.asOutParam());
-}
+    com::Utf8Str dummyFlags;
+    HRESULT rc = getGuestProperty(aProperty, aValue, &dummyTimestamp, dummyFlags);
+    return rc;
 
-STDMETHODIMP Machine::GetGuestPropertyTimestamp(IN_BSTR aName, LONG64 *aTimestamp)
+}
+HRESULT Machine::getGuestPropertyTimestamp(const com::Utf8Str &aProperty, LONG64 *aValue)
 {
-    Bstr dummyValue;
-    Bstr dummyFlags;
-    return GetGuestProperty(aName, dummyValue.asOutParam(), aTimestamp, dummyFlags.asOutParam());
+    com::Utf8Str dummyFlags;
+    com::Utf8Str dummyValue;
+    HRESULT rc = getGuestProperty(aProperty, dummyValue, aValue, dummyFlags);
+    return rc;
 }
 
 #ifdef VBOX_WITH_GUEST_PROPS
 /**
  * Set a guest property in VBoxSVC's internal structures.
  */
-HRESULT Machine::setGuestPropertyToService(IN_BSTR aName, IN_BSTR aValue,
-                                           IN_BSTR aFlags)
+HRESULT Machine::i_setGuestPropertyToService(const com::Utf8Str &aName, const com::Utf8Str &aValue,
+                                             const com::Utf8Str &aFlags, bool fDelete)
 {
     using namespace guestProp;
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     HRESULT rc = S_OK;
 
-    rc = checkStateDependency(MutableStateDep);
+    rc = i_checkStateDependency(MutableOrSavedStateDep);
     if (FAILED(rc)) return rc;
 
     try
     {
-        Utf8Str utf8Name(aName);
-        Utf8Str utf8Flags(aFlags);
         uint32_t fFlags = NILFLAG;
-        if (   aFlags != NULL
-            && RT_FAILURE(validateFlags(utf8Flags.c_str(), &fFlags)))
-            return setError(E_INVALIDARG,
-                            tr("Invalid guest property flag values: '%ls'"),
-                            aFlags);
+        if (aFlags.length() && RT_FAILURE(validateFlags(aFlags.c_str(), &fFlags)))
+            return setError(E_INVALIDARG, tr("Invalid guest property flag values: '%s'"), aFlags.c_str());
 
-        bool fDelete = !RT_VALID_PTR(aValue) || *(aValue) == '\0';
-        HWData::GuestPropertyMap::iterator it = mHWData->mGuestProperties.find(utf8Name);
+        HWData::GuestPropertyMap::iterator it = mHWData->mGuestProperties.find(aName);
         if (it == mHWData->mGuestProperties.end())
         {
             if (!fDelete)
             {
-                setModified(IsModified_MachineData);
+                i_setModified(IsModified_MachineData);
                 mHWData.backupEx();
 
                 RTTIMESPEC time;
                 HWData::GuestProperty prop;
-                prop.strValue   = aValue;
+                prop.strValue   = Bstr(aValue).raw();
                 prop.mTimestamp = RTTimeSpecGetNano(RTTimeNow(&time));
                 prop.mFlags     = fFlags;
-                mHWData->mGuestProperties[Utf8Str(aName)] = prop;
+                mHWData->mGuestProperties[aName] = prop;
             }
         }
         else
         {
             if (it->second.mFlags & (RDONLYHOST))
             {
-                rc = setError(E_ACCESSDENIED,
-                              tr("The property '%ls' cannot be changed by the host"),
-                              aName);
+                rc = setError(E_ACCESSDENIED, tr("The property '%s' cannot be changed by the host"), aName.c_str());
             }
             else
             {
-                setModified(IsModified_MachineData);
+                i_setModified(IsModified_MachineData);
                 mHWData.backupEx();
 
                 /* The backupEx() operation invalidates our iterator,
                  * so get a new one. */
-                it = mHWData->mGuestProperties.find(utf8Name);
+                it = mHWData->mGuestProperties.find(aName);
                 Assert(it != mHWData->mGuestProperties.end());
 
                 if (!fDelete)
@@ -6164,7 +5758,7 @@ HRESULT Machine::setGuestPropertyToService(IN_BSTR aName, IN_BSTR aValue,
             && (   mHWData->mGuestPropertyNotificationPatterns.isEmpty()
                 || RTStrSimplePatternMultiMatch(mHWData->mGuestPropertyNotificationPatterns.c_str(),
                                                 RTSTR_MAX,
-                                                utf8Name.c_str(),
+                                                aName.c_str(),
                                                 RTSTR_MAX,
                                                 NULL)
                )
@@ -6172,9 +5766,10 @@ HRESULT Machine::setGuestPropertyToService(IN_BSTR aName, IN_BSTR aValue,
         {
             alock.release();
 
-            mParent->onGuestPropertyChange(mData->mUuid, aName,
-                                           aValue ? aValue : Bstr("").raw(),
-                                           aFlags ? aFlags : Bstr("").raw());
+            mParent->i_onGuestPropertyChange(mData->mUuid,
+                                             Bstr(aName).raw(),
+                                             Bstr(aValue).raw(),
+                                             Bstr(aFlags).raw());
         }
     }
     catch (std::bad_alloc &)
@@ -6191,14 +5786,19 @@ HRESULT Machine::setGuestPropertyToService(IN_BSTR aName, IN_BSTR aValue,
  *          currently handling queries and the setting should then be done in
  *          VBoxSVC.
  */
-HRESULT Machine::setGuestPropertyToVM(IN_BSTR aName, IN_BSTR aValue,
-                                      IN_BSTR aFlags)
+HRESULT Machine::i_setGuestPropertyToVM(const com::Utf8Str &aName, const com::Utf8Str &aValue,
+                                        const com::Utf8Str &aFlags, bool fDelete)
 {
     HRESULT rc;
 
     try
     {
-        ComPtr<IInternalSessionControl> directControl = mData->mSession.mDirectControl;
+        ComPtr<IInternalSessionControl> directControl;
+        {
+            AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+            if (mData->mSession.mLockType == LockType_VM)
+                directControl = mData->mSession.mDirectControl;
+        }
 
         BSTR dummy = NULL; /* will not be changed (setter) */
         LONG64 dummy64;
@@ -6206,8 +5806,8 @@ HRESULT Machine::setGuestPropertyToVM(IN_BSTR aName, IN_BSTR aValue,
             rc = E_ACCESSDENIED;
         else
             /** @todo Fix when adding DeleteGuestProperty(), see defect. */
-            rc = directControl->AccessGuestProperty(aName, aValue, aFlags,
-                                                    true /* isSetter */,
+            rc = directControl->AccessGuestProperty(Bstr(aName).raw(), Bstr(aValue).raw(), Bstr(aFlags).raw(),
+                                                    fDelete? 2: 1 /* accessMode */,
                                                     &dummy, &dummy64, &dummy);
     }
     catch (std::bad_alloc &)
@@ -6219,47 +5819,47 @@ HRESULT Machine::setGuestPropertyToVM(IN_BSTR aName, IN_BSTR aValue,
 }
 #endif // VBOX_WITH_GUEST_PROPS
 
-STDMETHODIMP Machine::SetGuestProperty(IN_BSTR aName, IN_BSTR aValue,
-                                       IN_BSTR aFlags)
+HRESULT Machine::setGuestProperty(const com::Utf8Str &aProperty, const com::Utf8Str &aValue,
+                                  const com::Utf8Str &aFlags)
 {
 #ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
 #else // VBOX_WITH_GUEST_PROPS
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgMaybeNull(aFlags);
-    CheckComArgMaybeNull(aValue);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
-    HRESULT rc = setGuestPropertyToVM(aName, aValue, aFlags);
+    HRESULT rc = i_setGuestPropertyToVM(aProperty, aValue, aFlags, /* fDelete = */ false);
     if (rc == E_ACCESSDENIED)
         /* The VM is not running or the service is not (yet) accessible */
-        rc = setGuestPropertyToService(aName, aValue, aFlags);
+        rc = i_setGuestPropertyToService(aProperty, aValue, aFlags, /* fDelete = */ false);
     return rc;
 #endif // VBOX_WITH_GUEST_PROPS
 }
 
-STDMETHODIMP Machine::SetGuestPropertyValue(IN_BSTR aName, IN_BSTR aValue)
+HRESULT Machine::setGuestPropertyValue(const com::Utf8Str &aProperty, const com::Utf8Str &aValue)
 {
-    return SetGuestProperty(aName, aValue, NULL);
+    return setGuestProperty(aProperty, aValue, "");
 }
 
-STDMETHODIMP Machine::DeleteGuestProperty(IN_BSTR aName)
+HRESULT Machine::deleteGuestProperty(const com::Utf8Str &aName)
 {
-    return SetGuestProperty(aName, NULL, NULL);
+#ifndef VBOX_WITH_GUEST_PROPS
+    ReturnComNotImplemented();
+#else // VBOX_WITH_GUEST_PROPS
+    HRESULT rc = i_setGuestPropertyToVM(aName, "", "", /* fDelete = */ true);
+    if (rc == E_ACCESSDENIED)
+        /* The VM is not running or the service is not (yet) accessible */
+        rc = i_setGuestPropertyToService(aName, "", "", /* fDelete = */ true);
+    return rc;
+#endif // VBOX_WITH_GUEST_PROPS
 }
 
 #ifdef VBOX_WITH_GUEST_PROPS
 /**
  * Enumerate the guest properties in VBoxSVC's internal structures.
  */
-HRESULT Machine::enumerateGuestPropertiesInService
-                (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames),
-                 ComSafeArrayOut(BSTR, aValues),
-                 ComSafeArrayOut(LONG64, aTimestamps),
-                 ComSafeArrayOut(BSTR, aFlags))
+HRESULT Machine::i_enumerateGuestPropertiesInService(const com::Utf8Str &aPatterns,
+                                                     std::vector<com::Utf8Str> &aNames,
+                                                     std::vector<com::Utf8Str> &aValues,
+                                                     std::vector<LONG64> &aTimestamps,
+                                                     std::vector<com::Utf8Str> &aFlags)
 {
     using namespace guestProp;
 
@@ -6281,11 +5881,8 @@ HRESULT Machine::enumerateGuestPropertiesInService
                                             RTSTR_MAX,
                                             NULL)
            )
-        {
             propMap.insert(*it);
-        }
-
-        it++;
+        ++it;
     }
 
     alock.release();
@@ -6294,27 +5891,23 @@ HRESULT Machine::enumerateGuestPropertiesInService
      * And build up the arrays for returning the property information.
      */
     size_t cEntries = propMap.size();
-    SafeArray<BSTR> names(cEntries);
-    SafeArray<BSTR> values(cEntries);
-    SafeArray<LONG64> timestamps(cEntries);
-    SafeArray<BSTR> flags(cEntries);
-    size_t iProp = 0;
 
-    it = propMap.begin();
-    while (it != propMap.end())
+    aNames.resize(cEntries);
+    aValues.resize(cEntries);
+    aTimestamps.resize(cEntries);
+    aFlags.resize(cEntries);
+
+    char szFlags[MAX_FLAGS_LEN + 1];
+    size_t i= 0;
+    for (it = propMap.begin(); it != propMap.end(); ++i, ++it)
     {
-         char szFlags[MAX_FLAGS_LEN + 1];
-         it->first.cloneTo(&names[iProp]);
-         it->second.strValue.cloneTo(&values[iProp]);
-         timestamps[iProp] = it->second.mTimestamp;
-         writeFlags(it->second.mFlags, szFlags);
-         Bstr(szFlags).cloneTo(&flags[iProp++]);
-         it++;
+        aNames[i] = it->first;
+        aValues[i] = it->second.strValue;
+        aTimestamps[i] = it->second.mTimestamp;
+        writeFlags(it->second.mFlags, szFlags);
+        aFlags[i] = Utf8Str(szFlags);
     }
-    names.detachTo(ComSafeArrayOutArg(aNames));
-    values.detachTo(ComSafeArrayOutArg(aValues));
-    timestamps.detachTo(ComSafeArrayOutArg(aTimestamps));
-    flags.detachTo(ComSafeArrayOutArg(aFlags));
+
     return S_OK;
 }
 
@@ -6324,136 +5917,135 @@ HRESULT Machine::enumerateGuestPropertiesInService
  *          currently handling queries and the setting should then be done in
  *          VBoxSVC.
  */
-HRESULT Machine::enumerateGuestPropertiesOnVM
-                (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames),
-                 ComSafeArrayOut(BSTR, aValues),
-                 ComSafeArrayOut(LONG64, aTimestamps),
-                 ComSafeArrayOut(BSTR, aFlags))
+HRESULT Machine::i_enumerateGuestPropertiesOnVM(const com::Utf8Str &aPatterns,
+                                                std::vector<com::Utf8Str> &aNames,
+                                                std::vector<com::Utf8Str> &aValues,
+                                                std::vector<LONG64> &aTimestamps,
+                                                std::vector<com::Utf8Str> &aFlags)
 {
     HRESULT rc;
     ComPtr<IInternalSessionControl> directControl;
-    directControl = mData->mSession.mDirectControl;
+    {
+        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
+    }
+
+    com::SafeArray<BSTR> bNames;
+    com::SafeArray<BSTR> bValues;
+    com::SafeArray<LONG64> bTimestamps;
+    com::SafeArray<BSTR> bFlags;
 
     if (!directControl)
         rc = E_ACCESSDENIED;
     else
-        rc = directControl->EnumerateGuestProperties
-                     (aPatterns, ComSafeArrayOutArg(aNames),
-                      ComSafeArrayOutArg(aValues),
-                      ComSafeArrayOutArg(aTimestamps),
-                      ComSafeArrayOutArg(aFlags));
+        rc = directControl->EnumerateGuestProperties(Bstr(aPatterns).raw(),
+                                                     ComSafeArrayAsOutParam(bNames),
+                                                     ComSafeArrayAsOutParam(bValues),
+                                                     ComSafeArrayAsOutParam(bTimestamps),
+                                                     ComSafeArrayAsOutParam(bFlags));
+    size_t i;
+    aNames.resize(bNames.size());
+    for (i = 0; i < bNames.size(); ++i)
+        aNames[i] = Utf8Str(bNames[i]);
+    aValues.resize(bValues.size());
+    for (i = 0; i < bValues.size(); ++i)
+        aValues[i] = Utf8Str(bValues[i]);
+    aTimestamps.resize(bTimestamps.size());
+    for (i = 0; i < bTimestamps.size(); ++i)
+        aTimestamps[i] = bTimestamps[i];
+    aFlags.resize(bFlags.size());
+    for (i = 0; i < bFlags.size(); ++i)
+        aFlags[i] = Utf8Str(bFlags[i]);
+
     return rc;
 }
 #endif // VBOX_WITH_GUEST_PROPS
-
-STDMETHODIMP Machine::EnumerateGuestProperties(IN_BSTR aPatterns,
-                                               ComSafeArrayOut(BSTR, aNames),
-                                               ComSafeArrayOut(BSTR, aValues),
-                                               ComSafeArrayOut(LONG64, aTimestamps),
-                                               ComSafeArrayOut(BSTR, aFlags))
+HRESULT Machine::enumerateGuestProperties(const com::Utf8Str &aPatterns,
+                                          std::vector<com::Utf8Str> &aNames,
+                                          std::vector<com::Utf8Str> &aValues,
+                                          std::vector<LONG64> &aTimestamps,
+                                          std::vector<com::Utf8Str> &aFlags)
 {
 #ifndef VBOX_WITH_GUEST_PROPS
     ReturnComNotImplemented();
 #else // VBOX_WITH_GUEST_PROPS
-    CheckComArgMaybeNull(aPatterns);
-    CheckComArgOutSafeArrayPointerValid(aNames);
-    CheckComArgOutSafeArrayPointerValid(aValues);
-    CheckComArgOutSafeArrayPointerValid(aTimestamps);
-    CheckComArgOutSafeArrayPointerValid(aFlags);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    HRESULT rc = i_enumerateGuestPropertiesOnVM(aPatterns, aNames, aValues, aTimestamps, aFlags);
 
-    HRESULT rc = enumerateGuestPropertiesOnVM
-                     (aPatterns, ComSafeArrayOutArg(aNames),
-                      ComSafeArrayOutArg(aValues),
-                      ComSafeArrayOutArg(aTimestamps),
-                      ComSafeArrayOutArg(aFlags));
     if (rc == E_ACCESSDENIED)
         /* The VM is not running or the service is not (yet) accessible */
-        rc = enumerateGuestPropertiesInService
-                     (aPatterns, ComSafeArrayOutArg(aNames),
-                      ComSafeArrayOutArg(aValues),
-                      ComSafeArrayOutArg(aTimestamps),
-                      ComSafeArrayOutArg(aFlags));
+        rc = i_enumerateGuestPropertiesInService(aPatterns, aNames, aValues, aTimestamps, aFlags);
     return rc;
 #endif // VBOX_WITH_GUEST_PROPS
 }
 
-STDMETHODIMP Machine::GetMediumAttachmentsOfController(IN_BSTR aName,
-                                                       ComSafeArrayOut(IMediumAttachment*, aAttachments))
+HRESULT Machine::getMediumAttachmentsOfController(const com::Utf8Str &aName,
+                                                  std::vector<ComPtr<IMediumAttachment> > &aMediumAttachments)
 {
     MediaData::AttachmentList atts;
 
-    HRESULT rc = getMediumAttachmentsOfController(aName, atts);
+    HRESULT rc = i_getMediumAttachmentsOfController(aName, atts);
     if (FAILED(rc)) return rc;
 
-    SafeIfaceArray<IMediumAttachment> attachments(atts);
-    attachments.detachTo(ComSafeArrayOutArg(aAttachments));
+    size_t i = 0;
+    aMediumAttachments.resize(atts.size());
+    for (MediaData::AttachmentList::iterator it = atts.begin(); it != atts.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aMediumAttachments[i].asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetMediumAttachment(IN_BSTR aControllerName,
-                                          LONG aControllerPort,
-                                          LONG aDevice,
-                                          IMediumAttachment **aAttachment)
+HRESULT Machine::getMediumAttachment(const com::Utf8Str &aName,
+                                     LONG aControllerPort,
+                                     LONG aDevice,
+                                     ComPtr<IMediumAttachment> &aAttachment)
 {
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d\n",
-                     aControllerName, aControllerPort, aDevice));
-
-    CheckComArgStrNotEmptyOrNull(aControllerName);
-    CheckComArgOutPointerValid(aAttachment);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aControllerName=\"%s\" aControllerPort=%d aDevice=%d\n",
+                     aName.c_str(), aControllerPort, aDevice));
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aAttachment = NULL;
+    aAttachment = NULL;
 
-    ComObjPtr<MediumAttachment> pAttach = findAttachment(mMediaData->mAttachments,
-                                                         aControllerName,
-                                                         aControllerPort,
-                                                         aDevice);
+    ComObjPtr<MediumAttachment> pAttach = i_findAttachment(mMediaData->mAttachments,
+                                                           Bstr(aName).raw(),
+                                                           aControllerPort,
+                                                           aDevice);
     if (pAttach.isNull())
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
-                        aDevice, aControllerPort, aControllerName);
+                        tr("No storage device attached to device slot %d on port %d of controller '%s'"),
+                        aDevice, aControllerPort, aName.c_str());
 
-    pAttach.queryInterfaceTo(aAttachment);
+    pAttach.queryInterfaceTo(aAttachment.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::AddStorageController(IN_BSTR aName,
-                                           StorageBus_T aConnectionType,
-                                           IStorageController **controller)
-{
-    CheckComArgStrNotEmptyOrNull(aName);
 
+HRESULT Machine::addStorageController(const com::Utf8Str &aName,
+                                      StorageBus_T aConnectionType,
+                                      ComPtr<IStorageController> &aController)
+{
     if (   (aConnectionType <= StorageBus_Null)
-        || (aConnectionType >  StorageBus_SAS))
+        || (aConnectionType >  StorageBus_USB))
         return setError(E_INVALIDARG,
                         tr("Invalid connection type: %d"),
                         aConnectionType);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     /* try to find one with the name first. */
     ComObjPtr<StorageController> ctrl;
 
-    rc = getStorageControllerByName(aName, ctrl, false /* aSetError */);
+    rc = i_getStorageControllerByName(aName, ctrl, false /* aSetError */);
     if (SUCCEEDED(rc))
         return setError(VBOX_E_OBJECT_IN_USE,
-                        tr("Storage controller named '%ls' already exists"),
-                        aName);
+                        tr("Storage controller named '%s' already exists"),
+                        aName.c_str());
 
     ctrl.createObject();
 
@@ -6464,15 +6056,15 @@ STDMETHODIMP Machine::AddStorageController(IN_BSTR aName,
          it != mStorageControllers->end();
          ++it)
     {
-        if ((*it)->getStorageBus() == aConnectionType)
+        if ((*it)->i_getStorageBus() == aConnectionType)
         {
-            ULONG ulCurInst = (*it)->getInstance();
+            ULONG ulCurInst = (*it)->i_getInstance();
 
             if (ulCurInst >= ulInstance)
                 ulInstance = ulCurInst + 1;
 
             /* Only one controller of each type can be marked as bootable. */
-            if ((*it)->getBootable())
+            if ((*it)->i_getBootable())
                 fBootable = false;
         }
     }
@@ -6480,53 +6072,45 @@ STDMETHODIMP Machine::AddStorageController(IN_BSTR aName,
     rc = ctrl->init(this, aName, aConnectionType, ulInstance, fBootable);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mStorageControllers.backup();
     mStorageControllers->push_back(ctrl);
 
-    ctrl.queryInterfaceTo(controller);
+    ctrl.queryInterfaceTo(aController.asOutParam());
 
     /* inform the direct session if any */
     alock.release();
-    onStorageControllerChange();
+    i_onStorageControllerChange();
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetStorageControllerByName(IN_BSTR aName,
-                                                 IStorageController **aStorageController)
+HRESULT Machine::getStorageControllerByName(const com::Utf8Str &aName,
+                                            ComPtr<IStorageController> &aStorageController)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<StorageController> ctrl;
 
-    HRESULT rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);
+    HRESULT rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */);
     if (SUCCEEDED(rc))
-        ctrl.queryInterfaceTo(aStorageController);
+        ctrl.queryInterfaceTo(aStorageController.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP Machine::GetStorageControllerByInstance(ULONG aInstance,
-                                                     IStorageController **aStorageController)
+HRESULT Machine::getStorageControllerByInstance(ULONG aInstance,
+                                                ComPtr<IStorageController> &aStorageController)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     for (StorageControllerList::const_iterator it = mStorageControllers->begin();
          it != mStorageControllers->end();
          ++it)
     {
-        if ((*it)->getInstance() == aInstance)
+        if ((*it)->i_getInstance() == aInstance)
         {
-            (*it).queryInterfaceTo(aStorageController);
+            (*it).queryInterfaceTo(aStorageController.asOutParam());
             return S_OK;
         }
     }
@@ -6536,23 +6120,20 @@ STDMETHODIMP Machine::GetStorageControllerByInstance(ULONG aInstance,
                     aInstance);
 }
 
-STDMETHODIMP Machine::SetStorageControllerBootable(IN_BSTR aName, BOOL fBootable)
+HRESULT Machine::setStorageControllerBootable(const com::Utf8Str &aName, BOOL aBootable)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     ComObjPtr<StorageController> ctrl;
 
-    rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);
+    rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */);
     if (SUCCEEDED(rc))
     {
         /* Ensure that only one controller of each type is marked as bootable. */
-        if (fBootable == TRUE)
+        if (aBootable == TRUE)
         {
             for (StorageControllerList::const_iterator it = mStorageControllers->begin();
                  it != mStorageControllers->end();
@@ -6560,12 +6141,12 @@ STDMETHODIMP Machine::SetStorageControllerBootable(IN_BSTR aName, BOOL fBootable
             {
                 ComObjPtr<StorageController> aCtrl = (*it);
 
-                if (   (aCtrl->getName() != Utf8Str(aName))
-                    && aCtrl->getBootable() == TRUE
-                    && aCtrl->getStorageBus() == ctrl->getStorageBus()
-                    && aCtrl->getControllerType() == ctrl->getControllerType())
+                if (   (aCtrl->i_getName() != aName)
+                    && aCtrl->i_getBootable() == TRUE
+                    && aCtrl->i_getStorageBus() == ctrl->i_getStorageBus()
+                    && aCtrl->i_getControllerType() == ctrl->i_getControllerType())
                 {
-                    aCtrl->setBootable(FALSE);
+                    aCtrl->i_setBootable(FALSE);
                     break;
                 }
             }
@@ -6573,8 +6154,8 @@ STDMETHODIMP Machine::SetStorageControllerBootable(IN_BSTR aName, BOOL fBootable
 
         if (SUCCEEDED(rc))
         {
-            ctrl->setBootable(fBootable);
-            setModified(IsModified_Storage);
+            ctrl->i_setBootable(aBootable);
+            i_setModified(IsModified_Storage);
         }
     }
 
@@ -6582,26 +6163,21 @@ STDMETHODIMP Machine::SetStorageControllerBootable(IN_BSTR aName, BOOL fBootable
     {
         /* inform the direct session if any */
         alock.release();
-        onStorageControllerChange();
+        i_onStorageControllerChange();
     }
 
     return rc;
 }
 
-STDMETHODIMP Machine::RemoveStorageController(IN_BSTR aName)
+HRESULT Machine::removeStorageController(const com::Utf8Str &aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     ComObjPtr<StorageController> ctrl;
-    rc = getStorageControllerByName(aName, ctrl, true /* aSetError */);
+    rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
     {
@@ -6621,31 +6197,31 @@ STDMETHODIMP Machine::RemoveStorageController(IN_BSTR aName)
 
             AutoReadLock local_alock(pAttachTemp COMMA_LOCKVAL_SRC_POS);
 
-            if (pAttachTemp->getControllerName() == aName)
+            if (pAttachTemp->i_getControllerName() == aName)
             {
-                rc = detachDevice(pAttachTemp, alock, NULL);
+                rc = i_detachDevice(pAttachTemp, alock, NULL);
                 if (FAILED(rc)) return rc;
             }
         }
     }
 
     /* We can remove it now. */
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mStorageControllers.backup();
 
-    ctrl->unshare();
+    ctrl->i_unshare();
 
     mStorageControllers->remove(ctrl);
 
     /* inform the direct session if any */
     alock.release();
-    onStorageControllerChange();
+    i_onStorageControllerChange();
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::AddUSBController(IN_BSTR aName, USBControllerType_T aType,
-                                       IUSBController **controller)
+HRESULT Machine::addUSBController(const com::Utf8Str &aName, USBControllerType_T aType,
+                                  ComPtr<IUSBController> &aController)
 {
     if (   (aType <= USBControllerType_Null)
         || (aType >= USBControllerType_Last))
@@ -6653,30 +6229,27 @@ STDMETHODIMP Machine::AddUSBController(IN_BSTR aName, USBControllerType_T aType,
                         tr("Invalid USB controller type: %d"),
                         aType);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     /* try to find one with the same type first. */
     ComObjPtr<USBController> ctrl;
 
-    rc = getUSBControllerByName(aName, ctrl, false /* aSetError */);
+    rc = i_getUSBControllerByName(aName, ctrl, false /* aSetError */);
     if (SUCCEEDED(rc))
         return setError(VBOX_E_OBJECT_IN_USE,
-                        tr("USB controller named '%ls' already exists"),
-                        aName);
+                        tr("USB controller named '%s' already exists"),
+                        aName.c_str());
 
     /* Check that we don't exceed the maximum number of USB controllers for the given type. */
     ULONG maxInstances;
-    rc = mParent->getSystemProperties()->GetMaxInstancesOfUSBControllerType(mHWData->mChipsetType, aType, &maxInstances);
+    rc = mParent->i_getSystemProperties()->GetMaxInstancesOfUSBControllerType(mHWData->mChipsetType, aType, &maxInstances);
     if (FAILED(rc))
         return rc;
 
-    ULONG cInstances = getUSBControllerCountByType(aType);
+    ULONG cInstances = i_getUSBControllerCountByType(aType);
     if (cInstances >= maxInstances)
         return setError(E_INVALIDARG,
                         tr("Too many USB controllers of this type"));
@@ -6686,112 +6259,90 @@ STDMETHODIMP Machine::AddUSBController(IN_BSTR aName, USBControllerType_T aType,
     rc = ctrl->init(this, aName, aType);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_USB);
+    i_setModified(IsModified_USB);
     mUSBControllers.backup();
     mUSBControllers->push_back(ctrl);
 
-    ctrl.queryInterfaceTo(controller);
+    ctrl.queryInterfaceTo(aController.asOutParam());
 
     /* inform the direct session if any */
     alock.release();
-    onUSBControllerChange();
+    i_onUSBControllerChange();
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetUSBControllerByName(IN_BSTR aName, IUSBController **aUSBController)
+HRESULT Machine::getUSBControllerByName(const com::Utf8Str &aName, ComPtr<IUSBController> &aController)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<USBController> ctrl;
 
-    HRESULT rc = getUSBControllerByName(aName, ctrl, true /* aSetError */);
+    HRESULT rc = i_getUSBControllerByName(aName, ctrl, true /* aSetError */);
     if (SUCCEEDED(rc))
-        ctrl.queryInterfaceTo(aUSBController);
+        ctrl.queryInterfaceTo(aController.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP Machine::GetUSBControllerCountByType(USBControllerType_T aType,
-                                                  ULONG *aControllers)
+HRESULT Machine::getUSBControllerCountByType(USBControllerType_T aType,
+                                             ULONG *aControllers)
 {
-    CheckComArgOutPointerValid(aControllers);
-
     if (   (aType <= USBControllerType_Null)
         || (aType >= USBControllerType_Last))
         return setError(E_INVALIDARG,
                         tr("Invalid USB controller type: %d"),
                         aType);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<USBController> ctrl;
 
-    *aControllers = getUSBControllerCountByType(aType);
+    *aControllers = i_getUSBControllerCountByType(aType);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::RemoveUSBController(IN_BSTR aName)
+HRESULT Machine::removeUSBController(const com::Utf8Str &aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(MutableStateDep);
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
     if (FAILED(rc)) return rc;
 
     ComObjPtr<USBController> ctrl;
-    rc = getUSBControllerByName(aName, ctrl, true /* aSetError */);
+    rc = i_getUSBControllerByName(aName, ctrl, true /* aSetError */);
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_USB);
+    i_setModified(IsModified_USB);
     mUSBControllers.backup();
 
-    ctrl->unshare();
+    ctrl->i_unshare();
 
     mUSBControllers->remove(ctrl);
 
     /* inform the direct session if any */
     alock.release();
-    onUSBControllerChange();
+    i_onUSBControllerChange();
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::QuerySavedGuestScreenInfo(ULONG uScreenId,
-                                                ULONG *puOriginX,
-                                                ULONG *puOriginY,
-                                                ULONG *puWidth,
-                                                ULONG *puHeight,
-                                                BOOL *pfEnabled)
+HRESULT Machine::querySavedGuestScreenInfo(ULONG aScreenId,
+                                           ULONG *aOriginX,
+                                           ULONG *aOriginY,
+                                           ULONG *aWidth,
+                                           ULONG *aHeight,
+                                           BOOL  *aEnabled)
 {
-    LogFlowThisFunc(("\n"));
-
-    CheckComArgNotNull(puOriginX);
-    CheckComArgNotNull(puOriginY);
-    CheckComArgNotNull(puWidth);
-    CheckComArgNotNull(puHeight);
-    CheckComArgNotNull(pfEnabled);
-
     uint32_t u32OriginX= 0;
     uint32_t u32OriginY= 0;
     uint32_t u32Width = 0;
     uint32_t u32Height = 0;
     uint16_t u16Flags = 0;
 
-    int vrc = readSavedGuestScreenInfo(mSSData->strStateFilePath, uScreenId,
+    int vrc = readSavedGuestScreenInfo(mSSData->strStateFilePath, aScreenId,
                                        &u32OriginX, &u32OriginY, &u32Width, &u32Height, &u16Flags);
     if (RT_FAILURE(vrc))
     {
@@ -6802,35 +6353,34 @@ STDMETHODIMP Machine::QuerySavedGuestScreenInfo(ULONG uScreenId,
          * The right fix would be to change GUI API wrappers to make sure that parameters
          * are changed only if API succeeds.
          */
-        *pfEnabled = TRUE;
+        *aEnabled = TRUE;
 #endif
         return setError(VBOX_E_IPRT_ERROR,
                         tr("Saved guest size is not available (%Rrc)"),
                         vrc);
     }
 
-    *puOriginX = u32OriginX;
-    *puOriginY = u32OriginY;
-    *puWidth = u32Width;
-    *puHeight = u32Height;
-    *pfEnabled = (u16Flags & VBVA_SCREEN_F_DISABLED) == 0;
+    *aOriginX = u32OriginX;
+    *aOriginY = u32OriginY;
+    *aWidth = u32Width;
+    *aHeight = u32Height;
+    *aEnabled = (u16Flags & VBVA_SCREEN_F_DISABLED) == 0;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::QuerySavedThumbnailSize(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight)
+HRESULT Machine::readSavedThumbnailToArray(ULONG aScreenId, BitmapFormat_T aBitmapFormat,
+                                           ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData)
 {
-    LogFlowThisFunc(("\n"));
-
-    CheckComArgNotNull(aSize);
-    CheckComArgNotNull(aWidth);
-    CheckComArgNotNull(aHeight);
-
     if (aScreenId != 0)
         return E_NOTIMPL;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (   aBitmapFormat != BitmapFormat_BGR0
+        && aBitmapFormat != BitmapFormat_BGRA
+        && aBitmapFormat != BitmapFormat_RGBA
+        && aBitmapFormat != BitmapFormat_PNG)
+        return setError(E_NOTIMPL,
+                        tr("Unsupported saved thumbnail format 0x%08X"), aBitmapFormat);
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -6843,32 +6393,84 @@ STDMETHODIMP Machine::QuerySavedThumbnailSize(ULONG aScreenId, ULONG *aSize, ULO
 
     if (RT_FAILURE(vrc))
         return setError(VBOX_E_IPRT_ERROR,
-                        tr("Saved screenshot data is not available (%Rrc)"),
+                        tr("Saved thumbnail data is not available (%Rrc)"),
                         vrc);
 
-    *aSize = cbData;
+    HRESULT hr = S_OK;
+
     *aWidth = u32Width;
     *aHeight = u32Height;
 
+    if (cbData > 0)
+    {
+        /* Convert pixels to the format expected by the API caller. */
+        if (aBitmapFormat == BitmapFormat_BGR0)
+        {
+            /* [0] B, [1] G, [2] R, [3] 0. */
+            aData.resize(cbData);
+            memcpy(&aData.front(), pu8Data, cbData);
+        }
+        else if (aBitmapFormat == BitmapFormat_BGRA)
+        {
+            /* [0] B, [1] G, [2] R, [3] A. */
+            aData.resize(cbData);
+            for (uint32_t i = 0; i < cbData; i += 4)
+            {
+                aData[i]     = pu8Data[i];
+                aData[i + 1] = pu8Data[i + 1];
+                aData[i + 2] = pu8Data[i + 2];
+                aData[i + 3] = 0xff;
+            }
+        }
+        else if (aBitmapFormat == BitmapFormat_RGBA)
+        {
+            /* [0] R, [1] G, [2] B, [3] A. */
+            aData.resize(cbData);
+            for (uint32_t i = 0; i < cbData; i += 4)
+            {
+                aData[i]     = pu8Data[i + 2];
+                aData[i + 1] = pu8Data[i + 1];
+                aData[i + 2] = pu8Data[i];
+                aData[i + 3] = 0xff;
+            }
+        }
+        else if (aBitmapFormat == BitmapFormat_PNG)
+        {
+            uint8_t *pu8PNG = NULL;
+            uint32_t cbPNG = 0;
+            uint32_t cxPNG = 0;
+            uint32_t cyPNG = 0;
+
+            vrc = DisplayMakePNG(pu8Data, u32Width, u32Height, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 0);
+
+            if (RT_SUCCESS(vrc))
+            {
+                aData.resize(cbPNG);
+                if (cbPNG)
+                    memcpy(&aData.front(), pu8PNG, cbPNG);
+            }
+            else
+                hr = setError(VBOX_E_IPRT_ERROR,
+                              tr("Could not convert saved thumbnail to PNG (%Rrc)"),
+                              vrc);
+
+            RTMemFree(pu8PNG);
+        }
+    }
+
     freeSavedDisplayScreenshot(pu8Data);
 
-    return S_OK;
+    return hr;
 }
 
-STDMETHODIMP Machine::ReadSavedThumbnailToArray(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData))
+HRESULT Machine::querySavedScreenshotInfo(ULONG aScreenId,
+                                          ULONG *aWidth,
+                                          ULONG *aHeight,
+                                          std::vector<BitmapFormat_T> &aBitmapFormats)
 {
-    LogFlowThisFunc(("\n"));
-
-    CheckComArgNotNull(aWidth);
-    CheckComArgNotNull(aHeight);
-    CheckComArgOutSafeArrayPointerValid(aData);
-
     if (aScreenId != 0)
         return E_NOTIMPL;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     uint8_t *pu8Data = NULL;
@@ -6876,7 +6478,7 @@ STDMETHODIMP Machine::ReadSavedThumbnailToArray(ULONG aScreenId, BOOL aBGR, ULON
     uint32_t u32Width = 0;
     uint32_t u32Height = 0;
 
-    int vrc = readSavedDisplayScreenshot(mSSData->strStateFilePath, 0 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height);
+    int vrc = readSavedDisplayScreenshot(mSSData->strStateFilePath, 1 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height);
 
     if (RT_FAILURE(vrc))
         return setError(VBOX_E_IPRT_ERROR,
@@ -6885,150 +6487,25 @@ STDMETHODIMP Machine::ReadSavedThumbnailToArray(ULONG aScreenId, BOOL aBGR, ULON
 
     *aWidth = u32Width;
     *aHeight = u32Height;
-
-    com::SafeArray<BYTE> bitmap(cbData);
-    /* Convert pixels to format expected by the API caller. */
-    if (aBGR)
-    {
-        /* [0] B, [1] G, [2] R, [3] A. */
-        for (unsigned i = 0; i < cbData; i += 4)
-        {
-            bitmap[i]     = pu8Data[i];
-            bitmap[i + 1] = pu8Data[i + 1];
-            bitmap[i + 2] = pu8Data[i + 2];
-            bitmap[i + 3] = 0xff;
-        }
-    }
-    else
-    {
-        /* [0] R, [1] G, [2] B, [3] A. */
-        for (unsigned i = 0; i < cbData; i += 4)
-        {
-            bitmap[i]     = pu8Data[i + 2];
-            bitmap[i + 1] = pu8Data[i + 1];
-            bitmap[i + 2] = pu8Data[i];
-            bitmap[i + 3] = 0xff;
-        }
-    }
-    bitmap.detachTo(ComSafeArrayOutArg(aData));
+    aBitmapFormats.resize(1);
+    aBitmapFormats[0] = BitmapFormat_PNG;
 
     freeSavedDisplayScreenshot(pu8Data);
 
     return S_OK;
 }
 
-
-STDMETHODIMP Machine::ReadSavedThumbnailPNGToArray(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData))
+HRESULT Machine::readSavedScreenshotToArray(ULONG aScreenId,
+                                            BitmapFormat_T aBitmapFormat,
+                                            ULONG *aWidth,
+                                            ULONG *aHeight,
+                                            std::vector<BYTE> &aData)
 {
-    LogFlowThisFunc(("\n"));
-
-    CheckComArgNotNull(aWidth);
-    CheckComArgNotNull(aHeight);
-    CheckComArgOutSafeArrayPointerValid(aData);
-
     if (aScreenId != 0)
         return E_NOTIMPL;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    uint8_t *pu8Data = NULL;
-    uint32_t cbData = 0;
-    uint32_t u32Width = 0;
-    uint32_t u32Height = 0;
-
-    int vrc = readSavedDisplayScreenshot(mSSData->strStateFilePath, 0 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height);
-
-    if (RT_FAILURE(vrc))
-        return setError(VBOX_E_IPRT_ERROR,
-                        tr("Saved screenshot data is not available (%Rrc)"),
-                        vrc);
-
-    *aWidth = u32Width;
-    *aHeight = u32Height;
-
-    HRESULT rc = S_OK;
-    uint8_t *pu8PNG = NULL;
-    uint32_t cbPNG = 0;
-    uint32_t cxPNG = 0;
-    uint32_t cyPNG = 0;
-
-    vrc = DisplayMakePNG(pu8Data, u32Width, u32Height, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 0);
-
-    if (RT_SUCCESS(vrc))
-    {
-        com::SafeArray<BYTE> screenData(cbPNG);
-        screenData.initFrom(pu8PNG, cbPNG);
-        if (pu8PNG)
-            RTMemFree(pu8PNG);
-        screenData.detachTo(ComSafeArrayOutArg(aData));
-    }
-    else
-    {
-        if (pu8PNG)
-            RTMemFree(pu8PNG);
-        return setError(VBOX_E_IPRT_ERROR,
-                        tr("Could not convert screenshot to PNG (%Rrc)"),
-                        vrc);
-    }
-
-    freeSavedDisplayScreenshot(pu8Data);
-
-    return rc;
-}
-
-STDMETHODIMP Machine::QuerySavedScreenshotPNGSize(ULONG aScreenId, ULONG *aSize, ULONG *aWidth, ULONG *aHeight)
-{
-    LogFlowThisFunc(("\n"));
-
-    CheckComArgNotNull(aSize);
-    CheckComArgNotNull(aWidth);
-    CheckComArgNotNull(aHeight);
-
-    if (aScreenId != 0)
-        return E_NOTIMPL;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    uint8_t *pu8Data = NULL;
-    uint32_t cbData = 0;
-    uint32_t u32Width = 0;
-    uint32_t u32Height = 0;
-
-    int vrc = readSavedDisplayScreenshot(mSSData->strStateFilePath, 1 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height);
-
-    if (RT_FAILURE(vrc))
-        return setError(VBOX_E_IPRT_ERROR,
-                        tr("Saved screenshot data is not available (%Rrc)"),
-                        vrc);
-
-    *aSize = cbData;
-    *aWidth = u32Width;
-    *aHeight = u32Height;
-
-    freeSavedDisplayScreenshot(pu8Data);
-
-    return S_OK;
-}
-
-STDMETHODIMP Machine::ReadSavedScreenshotPNGToArray(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, ComSafeArrayOut(BYTE, aData))
-{
-    LogFlowThisFunc(("\n"));
-
-    CheckComArgNotNull(aWidth);
-    CheckComArgNotNull(aHeight);
-    CheckComArgOutSafeArrayPointerValid(aData);
-
-    if (aScreenId != 0)
-        return E_NOTIMPL;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    if (aBitmapFormat != BitmapFormat_PNG)
+        return E_NOTIMPL;
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -7047,23 +6524,18 @@ STDMETHODIMP Machine::ReadSavedScreenshotPNGToArray(ULONG aScreenId, ULONG *aWid
     *aWidth = u32Width;
     *aHeight = u32Height;
 
-    com::SafeArray<BYTE> png(cbData);
-    png.initFrom(pu8Data, cbData);
-    png.detachTo(ComSafeArrayOutArg(aData));
+    aData.resize(cbData);
+    if (cbData)
+        memcpy(&aData.front(), pu8Data, cbData);
 
     freeSavedDisplayScreenshot(pu8Data);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::HotPlugCPU(ULONG aCpu)
+HRESULT Machine::hotPlugCPU(ULONG aCpu)
 {
     HRESULT rc = S_OK;
-    LogFlowThisFunc(("\n"));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (!mHWData->mCPUHotPlugEnabled)
@@ -7076,28 +6548,24 @@ STDMETHODIMP Machine::HotPlugCPU(ULONG aCpu)
         return setError(VBOX_E_OBJECT_IN_USE, tr("CPU %lu is already attached"), aCpu);
 
     alock.release();
-    rc = onCPUChange(aCpu, false);
+    rc = i_onCPUChange(aCpu, false);
     alock.acquire();
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mCPUAttached[aCpu] = true;
 
     /** Save settings if online - @todo why is this required? -- @bugref{6818} */
     if (Global::IsOnline(mData->mMachineState))
-        saveSettings(NULL);
+        i_saveSettings(NULL);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::HotUnplugCPU(ULONG aCpu)
+HRESULT Machine::hotUnplugCPU(ULONG aCpu)
 {
     HRESULT rc = S_OK;
-    LogFlowThisFunc(("\n"));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -7117,31 +6585,24 @@ STDMETHODIMP Machine::HotUnplugCPU(ULONG aCpu)
         return setError(E_INVALIDARG, tr("It is not possible to detach CPU 0"));
 
     alock.release();
-    rc = onCPUChange(aCpu, true);
+    rc = i_onCPUChange(aCpu, true);
     alock.acquire();
     if (FAILED(rc)) return rc;
 
-    setModified(IsModified_MachineData);
+    i_setModified(IsModified_MachineData);
     mHWData.backup();
     mHWData->mCPUAttached[aCpu] = false;
 
     /** Save settings if online - @todo why is this required? -- @bugref{6818} */
     if (Global::IsOnline(mData->mMachineState))
-        saveSettings(NULL);
+        i_saveSettings(NULL);
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::GetCPUStatus(ULONG aCpu, BOOL *aCpuAttached)
+HRESULT Machine::getCPUStatus(ULONG aCpu, BOOL *aAttached)
 {
-    LogFlowThisFunc(("\n"));
-
-    CheckComArgNotNull(aCpuAttached);
-
-    *aCpuAttached = false;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    *aAttached = false;
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -7149,48 +6610,38 @@ STDMETHODIMP Machine::GetCPUStatus(ULONG aCpu, BOOL *aCpuAttached)
     if (!mHWData->mCPUHotPlugEnabled)
     {
         if (aCpu < mHWData->mCPUCount)
-            *aCpuAttached = true;
+            *aAttached = true;
     }
     else
     {
         if (aCpu < SchemaDefs::MaxCPUCount)
-            *aCpuAttached = mHWData->mCPUAttached[aCpu];
+            *aAttached = mHWData->mCPUAttached[aCpu];
     }
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::QueryLogFilename(ULONG aIdx, BSTR *aName)
+HRESULT Machine::queryLogFilename(ULONG aIdx, com::Utf8Str &aFilename)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Utf8Str log = queryLogFilename(aIdx);
+    Utf8Str log = i_queryLogFilename(aIdx);
     if (!RTFileExists(log.c_str()))
         log.setNull();
-    log.cloneTo(aName);
+    aFilename = log;
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeArrayOut(BYTE, aData))
+HRESULT Machine::readLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, std::vector<BYTE> &aData)
 {
-    LogFlowThisFunc(("\n"));
-    CheckComArgOutSafeArrayPointerValid(aData);
     if (aSize < 0)
         return setError(E_INVALIDARG, tr("The size argument (%lld) is negative"), aSize);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
-    Utf8Str log = queryLogFilename(aIdx);
+    Utf8Str log = i_queryLogFilename(aIdx);
 
     /* do not unnecessarily hold the lock while doing something which does
      * not need the lock and potentially takes a long time. */
@@ -7200,16 +6651,16 @@ STDMETHODIMP Machine::ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeA
      * over (XP)COM, and keeps the SOAP reply size under 1M for the webservice.
      * One byte expands to approx. 25 bytes of breathtaking XML. */
     size_t cbData = (size_t)RT_MIN(aSize, 32768);
-    com::SafeArray<BYTE> logData(cbData);
+    aData.resize(cbData);
 
     RTFILE LogFile;
     int vrc = RTFileOpen(&LogFile, log.c_str(),
                          RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE);
     if (RT_SUCCESS(vrc))
     {
-        vrc = RTFileReadAt(LogFile, aOffset, logData.raw(), cbData, &cbData);
+        vrc = RTFileReadAt(LogFile, aOffset, cbData? &aData.front(): NULL, cbData, &cbData);
         if (RT_SUCCESS(vrc))
-            logData.resize(cbData);
+            aData.resize(cbData);
         else
             rc = setError(VBOX_E_IPRT_ERROR,
                           tr("Could not read log file '%s' (%Rrc)"),
@@ -7222,8 +6673,7 @@ STDMETHODIMP Machine::ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeA
                       log.c_str(), vrc);
 
     if (FAILED(rc))
-        logData.resize(0);
-    logData.detachTo(ComSafeArrayOutArg(aData));
+        aData.resize(0);
 
     return rc;
 }
@@ -7233,16 +6683,13 @@ STDMETHODIMP Machine::ReadLog(ULONG aIdx, LONG64 aOffset, LONG64 aSize, ComSafeA
  * Currently this method doesn't attach device to the running VM,
  * just makes sure it's plugged on next VM start.
  */
-STDMETHODIMP Machine::AttachHostPCIDevice(LONG hostAddress, LONG desiredGuestAddress, BOOL /*tryToUnbind*/)
+HRESULT Machine::attachHostPCIDevice(LONG aHostAddress, LONG aDesiredGuestAddress, BOOL /* aTryToUnbind */)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // lock scope
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        HRESULT rc = checkStateDependency(MutableStateDep);
+        HRESULT rc = i_checkStateDependency(MutableStateDep);
         if (FAILED(rc)) return rc;
 
         ChipsetType_T aChipset = ChipsetType_PIIX3;
@@ -7263,7 +6710,7 @@ STDMETHODIMP Machine::AttachHostPCIDevice(LONG hostAddress, LONG desiredGuestAdd
             ComPtr<PCIDeviceAttachment> pAttach;
             pAttach = *it;
             pAttach->COMGETTER(HostAddress)(&iHostAddress);
-            if (iHostAddress == hostAddress)
+            if (iHostAddress == aHostAddress)
                 return setError(E_INVALIDARG,
                                 tr("Device with host PCI address already attached to this VM"));
         }
@@ -7271,11 +6718,12 @@ STDMETHODIMP Machine::AttachHostPCIDevice(LONG hostAddress, LONG desiredGuestAdd
         ComObjPtr<PCIDeviceAttachment> pda;
         char name[32];
 
-        RTStrPrintf(name, sizeof(name), "host%02x:%02x.%x", (hostAddress>>8) & 0xff, (hostAddress & 0xf8) >> 3, hostAddress & 7);
+        RTStrPrintf(name, sizeof(name), "host%02x:%02x.%x", (aHostAddress>>8) & 0xff,
+                    (aHostAddress & 0xf8) >> 3, aHostAddress & 7);
         Bstr bname(name);
         pda.createObject();
-        pda->init(this, bname,  hostAddress, desiredGuestAddress, TRUE);
-        setModified(IsModified_MachineData);
+        pda->init(this, bname,  aHostAddress, aDesiredGuestAddress, TRUE);
+        i_setModified(IsModified_MachineData);
         mHWData.backup();
         mHWData->mPCIDeviceAssignments.push_back(pda);
     }
@@ -7287,11 +6735,8 @@ STDMETHODIMP Machine::AttachHostPCIDevice(LONG hostAddress, LONG desiredGuestAdd
  * Currently this method doesn't detach device from the running VM,
  * just makes sure it's not plugged on next VM start.
  */
-STDMETHODIMP Machine::DetachHostPCIDevice(LONG hostAddress)
+HRESULT Machine::detachHostPCIDevice(LONG aHostAddress)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     ComObjPtr<PCIDeviceAttachment> pAttach;
     bool fRemoved = false;
     HRESULT rc;
@@ -7300,7 +6745,7 @@ STDMETHODIMP Machine::DetachHostPCIDevice(LONG hostAddress)
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-        rc = checkStateDependency(MutableStateDep);
+        rc = i_checkStateDependency(MutableStateDep);
         if (FAILED(rc)) return rc;
 
         for (HWData::PCIDeviceAssignmentList::iterator it =  mHWData->mPCIDeviceAssignments.begin();
@@ -7310,9 +6755,9 @@ STDMETHODIMP Machine::DetachHostPCIDevice(LONG hostAddress)
             LONG iHostAddress = -1;
             pAttach = *it;
             pAttach->COMGETTER(HostAddress)(&iHostAddress);
-            if (iHostAddress  != -1  && iHostAddress == hostAddress)
+            if (iHostAddress  != -1  && iHostAddress == aHostAddress)
             {
-                setModified(IsModified_MachineData);
+                i_setModified(IsModified_MachineData);
                 mHWData.backup();
                 mHWData->mPCIDeviceAssignments.remove(pAttach);
                 fRemoved = true;
@@ -7337,411 +6782,361 @@ STDMETHODIMP Machine::DetachHostPCIDevice(LONG hostAddress)
 
     return fRemoved ? S_OK : setError(VBOX_E_OBJECT_NOT_FOUND,
                                       tr("No host PCI device %08x attached"),
-                                      hostAddress
+                                      aHostAddress
                                       );
 }
 
-STDMETHODIMP Machine::COMGETTER(PCIDeviceAssignments)(ComSafeArrayOut(IPCIDeviceAttachment *, aAssignments))
+HRESULT Machine::getPCIDeviceAssignments(std::vector<ComPtr<IPCIDeviceAttachment> > &aPCIDeviceAssignments)
 {
-    CheckComArgOutSafeArrayPointerValid(aAssignments);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IPCIDeviceAttachment> assignments(mHWData->mPCIDeviceAssignments);
-    assignments.detachTo(ComSafeArrayOutArg(aAssignments));
+    aPCIDeviceAssignments.resize(mHWData->mPCIDeviceAssignments.size());
+
+    size_t i = 0;
+    for (std::list<ComObjPtr<PCIDeviceAttachment> >::const_iterator it = mHWData->mPCIDeviceAssignments.begin();
+         it != mHWData->mPCIDeviceAssignments.end();
+         ++i, ++it)
+        (*it).queryInterfaceTo(aPCIDeviceAssignments[i].asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(BandwidthControl)(IBandwidthControl **aBandwidthControl)
+HRESULT Machine::getBandwidthControl(ComPtr<IBandwidthControl> &aBandwidthControl)
 {
-    CheckComArgOutPointerValid(aBandwidthControl);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    mBandwidthControl.queryInterfaceTo(aBandwidthControl);
+    mBandwidthControl.queryInterfaceTo(aBandwidthControl.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(TracingEnabled)(BOOL *pfEnabled)
+HRESULT Machine::getTracingEnabled(BOOL *aTracingEnabled)
 {
-    CheckComArgOutPointerValid(pfEnabled);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        *pfEnabled = mHWData->mDebugging.fTracingEnabled;
-    }
-    return hrc;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aTracingEnabled = mHWData->mDebugging.fTracingEnabled;
+
+    return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(TracingEnabled)(BOOL fEnabled)
+HRESULT Machine::setTracingEnabled(BOOL aTracingEnabled)
 {
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = i_checkStateDependency(MutableStateDep);
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableStateDep);
+        hrc = mHWData.backupEx();
         if (SUCCEEDED(hrc))
         {
-            hrc = mHWData.backupEx();
-            if (SUCCEEDED(hrc))
-            {
-                setModified(IsModified_MachineData);
-                mHWData->mDebugging.fTracingEnabled = fEnabled != FALSE;
-            }
+            i_setModified(IsModified_MachineData);
+            mHWData->mDebugging.fTracingEnabled = aTracingEnabled != FALSE;
         }
     }
     return hrc;
 }
 
-STDMETHODIMP Machine::COMGETTER(TracingConfig)(BSTR *pbstrConfig)
+HRESULT Machine::getTracingConfig(com::Utf8Str &aTracingConfig)
 {
-    CheckComArgOutPointerValid(pbstrConfig);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = mHWData->mDebugging.strTracingConfig.cloneToEx(pbstrConfig);
-    }
-    return hrc;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    aTracingConfig = mHWData->mDebugging.strTracingConfig;
+    return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(TracingConfig)(IN_BSTR bstrConfig)
+HRESULT Machine::setTracingConfig(const com::Utf8Str &aTracingConfig)
 {
-    CheckComArgStr(bstrConfig);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = i_checkStateDependency(MutableStateDep);
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableStateDep);
+        hrc = mHWData.backupEx();
         if (SUCCEEDED(hrc))
         {
-            hrc = mHWData.backupEx();
+            mHWData->mDebugging.strTracingConfig = aTracingConfig;
             if (SUCCEEDED(hrc))
-            {
-                hrc = mHWData->mDebugging.strTracingConfig.cloneEx(bstrConfig);
-                if (SUCCEEDED(hrc))
-                    setModified(IsModified_MachineData);
-            }
+                i_setModified(IsModified_MachineData);
         }
     }
     return hrc;
-
 }
 
-STDMETHODIMP Machine::COMGETTER(AllowTracingToAccessVM)(BOOL *pfAllow)
+HRESULT Machine::getAllowTracingToAccessVM(BOOL *aAllowTracingToAccessVM)
 {
-    CheckComArgOutPointerValid(pfAllow);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        *pfAllow = mHWData->mDebugging.fAllowTracingToAccessVM;
-    }
-    return hrc;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aAllowTracingToAccessVM = mHWData->mDebugging.fAllowTracingToAccessVM;
+
+    return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(AllowTracingToAccessVM)(BOOL fAllow)
+HRESULT Machine::setAllowTracingToAccessVM(BOOL aAllowTracingToAccessVM)
 {
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = i_checkStateDependency(MutableStateDep);
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableStateDep);
+        hrc = mHWData.backupEx();
         if (SUCCEEDED(hrc))
         {
-            hrc = mHWData.backupEx();
-            if (SUCCEEDED(hrc))
-            {
-                setModified(IsModified_MachineData);
-                mHWData->mDebugging.fAllowTracingToAccessVM = fAllow != FALSE;
-            }
+            i_setModified(IsModified_MachineData);
+            mHWData->mDebugging.fAllowTracingToAccessVM = aAllowTracingToAccessVM != FALSE;
         }
     }
     return hrc;
 }
 
-STDMETHODIMP Machine::COMGETTER(AutostartEnabled)(BOOL *pfEnabled)
+HRESULT Machine::getAutostartEnabled(BOOL *aAutostartEnabled)
 {
-    CheckComArgOutPointerValid(pfEnabled);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        *pfEnabled = mHWData->mAutostart.fAutostartEnabled;
-    }
-    return hrc;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aAutostartEnabled = mHWData->mAutostart.fAutostartEnabled;
+
+    return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(AutostartEnabled)(BOOL fEnabled)
+HRESULT Machine::setAutostartEnabled(BOOL aAutostartEnabled)
 {
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
+    if (   SUCCEEDED(hrc)
+        && mHWData->mAutostart.fAutostartEnabled != !!aAutostartEnabled)
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableStateDep);
-        if (   SUCCEEDED(hrc)
-            && mHWData->mAutostart.fAutostartEnabled != !!fEnabled)
-        {
-            AutostartDb *autostartDb = mParent->getAutostartDb();
-            int vrc;
+        AutostartDb *autostartDb = mParent->i_getAutostartDb();
+        int vrc;
 
-            if (fEnabled)
-                vrc = autostartDb->addAutostartVM(mUserData->s.strName.c_str());
-            else
-                vrc = autostartDb->removeAutostartVM(mUserData->s.strName.c_str());
+        if (aAutostartEnabled)
+            vrc = autostartDb->addAutostartVM(mUserData->s.strName.c_str());
+        else
+            vrc = autostartDb->removeAutostartVM(mUserData->s.strName.c_str());
 
-            if (RT_SUCCESS(vrc))
+        if (RT_SUCCESS(vrc))
+        {
+            hrc = mHWData.backupEx();
+            if (SUCCEEDED(hrc))
             {
-                hrc = mHWData.backupEx();
-                if (SUCCEEDED(hrc))
-                {
-                    setModified(IsModified_MachineData);
-                    mHWData->mAutostart.fAutostartEnabled = fEnabled != FALSE;
-                }
+                i_setModified(IsModified_MachineData);
+                mHWData->mAutostart.fAutostartEnabled = aAutostartEnabled != FALSE;
             }
-            else if (vrc == VERR_NOT_SUPPORTED)
-                hrc = setError(VBOX_E_NOT_SUPPORTED,
-                               tr("The VM autostart feature is not supported on this platform"));
-            else if (vrc == VERR_PATH_NOT_FOUND)
-                hrc = setError(E_FAIL,
-                               tr("The path to the autostart database is not set"));
-            else
-                hrc = setError(E_UNEXPECTED,
-                               tr("%s machine '%s' to the autostart database failed with %Rrc"),
-                               fEnabled ? "Adding" : "Removing",
-                               mUserData->s.strName.c_str(), vrc);
         }
+        else if (vrc == VERR_NOT_SUPPORTED)
+            hrc = setError(VBOX_E_NOT_SUPPORTED,
+                           tr("The VM autostart feature is not supported on this platform"));
+        else if (vrc == VERR_PATH_NOT_FOUND)
+            hrc = setError(E_FAIL,
+                           tr("The path to the autostart database is not set"));
+        else
+            hrc = setError(E_UNEXPECTED,
+                           tr("%s machine '%s' to the autostart database failed with %Rrc"),
+                           aAutostartEnabled ? "Adding" : "Removing",
+                           mUserData->s.strName.c_str(), vrc);
     }
     return hrc;
 }
 
-STDMETHODIMP Machine::COMGETTER(AutostartDelay)(ULONG *puDelay)
+HRESULT Machine::getAutostartDelay(ULONG *aAutostartDelay)
 {
-    CheckComArgOutPointerValid(puDelay);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        *puDelay = mHWData->mAutostart.uAutostartDelay;
-    }
-    return hrc;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aAutostartDelay = mHWData->mAutostart.uAutostartDelay;
+
+    return S_OK;
 }
 
-STDMETHODIMP Machine::COMSETTER(AutostartDelay)(ULONG uDelay)
+HRESULT Machine::setAutostartDelay(ULONG aAutostartDelay)
 {
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableStateDep);
+        hrc = mHWData.backupEx();
         if (SUCCEEDED(hrc))
         {
-            hrc = mHWData.backupEx();
-            if (SUCCEEDED(hrc))
-            {
-                setModified(IsModified_MachineData);
-                mHWData->mAutostart.uAutostartDelay = uDelay;
-            }
+            i_setModified(IsModified_MachineData);
+            mHWData->mAutostart.uAutostartDelay = aAutostartDelay;
         }
     }
     return hrc;
 }
 
-STDMETHODIMP Machine::COMGETTER(AutostopType)(AutostopType_T *penmAutostopType)
+HRESULT Machine::getAutostopType(AutostopType_T *aAutostopType)
 {
-    CheckComArgOutPointerValid(penmAutostopType);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        *penmAutostopType = mHWData->mAutostart.enmAutostopType;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aAutostopType = mHWData->mAutostart.enmAutostopType;
+
+    return S_OK;
+}
+
+HRESULT Machine::setAutostopType(AutostopType_T aAutostopType)
+{
+   AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+   HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
+   if (   SUCCEEDED(hrc)
+       && mHWData->mAutostart.enmAutostopType != aAutostopType)
+   {
+       AutostartDb *autostartDb = mParent->i_getAutostartDb();
+       int vrc;
+
+       if (aAutostopType != AutostopType_Disabled)
+           vrc = autostartDb->addAutostopVM(mUserData->s.strName.c_str());
+       else
+           vrc = autostartDb->removeAutostopVM(mUserData->s.strName.c_str());
+
+       if (RT_SUCCESS(vrc))
+       {
+           hrc = mHWData.backupEx();
+           if (SUCCEEDED(hrc))
+           {
+               i_setModified(IsModified_MachineData);
+               mHWData->mAutostart.enmAutostopType = aAutostopType;
+           }
+       }
+       else if (vrc == VERR_NOT_SUPPORTED)
+           hrc = setError(VBOX_E_NOT_SUPPORTED,
+                          tr("The VM autostop feature is not supported on this platform"));
+       else if (vrc == VERR_PATH_NOT_FOUND)
+           hrc = setError(E_FAIL,
+                          tr("The path to the autostart database is not set"));
+       else
+           hrc = setError(E_UNEXPECTED,
+                          tr("%s machine '%s' to the autostop database failed with %Rrc"),
+                          aAutostopType != AutostopType_Disabled ? "Adding" : "Removing",
+                          mUserData->s.strName.c_str(), vrc);
     }
     return hrc;
 }
 
-STDMETHODIMP Machine::COMSETTER(AutostopType)(AutostopType_T enmAutostopType)
+HRESULT Machine::getDefaultFrontend(com::Utf8Str &aDefaultFrontend)
 {
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableStateDep);
-        if (   SUCCEEDED(hrc)
-            && mHWData->mAutostart.enmAutostopType != enmAutostopType)
-        {
-            AutostartDb *autostartDb = mParent->getAutostartDb();
-            int vrc;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-            if (enmAutostopType != AutostopType_Disabled)
-                vrc = autostartDb->addAutostopVM(mUserData->s.strName.c_str());
-            else
-                vrc = autostartDb->removeAutostopVM(mUserData->s.strName.c_str());
+    aDefaultFrontend = mHWData->mDefaultFrontend;
 
-            if (RT_SUCCESS(vrc))
-            {
-                hrc = mHWData.backupEx();
-                if (SUCCEEDED(hrc))
-                {
-                    setModified(IsModified_MachineData);
-                    mHWData->mAutostart.enmAutostopType = enmAutostopType;
-                }
-            }
-            else if (vrc == VERR_NOT_SUPPORTED)
-                hrc = setError(VBOX_E_NOT_SUPPORTED,
-                               tr("The VM autostop feature is not supported on this platform"));
-            else if (vrc == VERR_PATH_NOT_FOUND)
-                hrc = setError(E_FAIL,
-                               tr("The path to the autostart database is not set"));
-            else
-                hrc = setError(E_UNEXPECTED,
-                               tr("%s machine '%s' to the autostop database failed with %Rrc"),
-                               enmAutostopType != AutostopType_Disabled ? "Adding" : "Removing",
-                               mUserData->s.strName.c_str(), vrc);
-        }
-    }
-    return hrc;
+    return S_OK;
 }
 
-STDMETHODIMP Machine::COMGETTER(DefaultFrontend)(BSTR *aDefaultFrontend)
+HRESULT Machine::setDefaultFrontend(const com::Utf8Str &aDefaultFrontend)
 {
-    CheckComArgOutPointerValid(aDefaultFrontend);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep);
     if (SUCCEEDED(hrc))
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        mHWData->mDefaultFrontend.cloneTo(aDefaultFrontend);
+        hrc = mHWData.backupEx();
+        if (SUCCEEDED(hrc))
+        {
+            i_setModified(IsModified_MachineData);
+            mHWData->mDefaultFrontend = aDefaultFrontend;
+        }
     }
     return hrc;
 }
 
-STDMETHODIMP Machine::COMSETTER(DefaultFrontend)(IN_BSTR aDefaultFrontend)
+HRESULT Machine::getIcon(std::vector<BYTE> &aIcon)
 {
-    CheckComArgStr(aDefaultFrontend);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    size_t cbIcon = mUserData->mIcon.size();
+    aIcon.resize(cbIcon);
+    if (cbIcon)
+        memcpy(&aIcon.front(), &mUserData->mIcon[0], cbIcon);
+    return S_OK;
+}
+
+HRESULT Machine::setIcon(const std::vector<BYTE> &aIcon)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep);
     if (SUCCEEDED(hrc))
     {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableOrSavedStateDep);
-        if (SUCCEEDED(hrc))
-        {
-            hrc = mHWData.backupEx();
-            if (SUCCEEDED(hrc))
-            {
-                setModified(IsModified_MachineData);
-                mHWData->mDefaultFrontend = aDefaultFrontend;
-            }
-        }
+        i_setModified(IsModified_MachineData);
+        mUserData.backup();
+        size_t cbIcon = aIcon.size();
+        mUserData->mIcon.resize(cbIcon);
+        if (cbIcon)
+            memcpy(&mUserData->mIcon[0], &aIcon.front(), cbIcon);
     }
     return hrc;
 }
 
-STDMETHODIMP Machine::COMGETTER(Icon)(ComSafeArrayOut(BYTE, aIcon))
+HRESULT Machine::getUSBProxyAvailable(BOOL *aUSBProxyAvailable)
 {
-    CheckComArgSafeArrayNotNull(aIcon);
-    CheckComArgOutSafeArrayPointerValid(aIcon);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        com::SafeArray<BYTE> icon(mUserData->mIcon.size());
-        memcpy(icon.raw(), &mUserData->mIcon[0], mUserData->mIcon.size());
-        icon.detachTo(ComSafeArrayOutArg(aIcon));
-    }
-    return hrc;
-}
-
-STDMETHODIMP Machine::COMSETTER(Icon)(ComSafeArrayIn(BYTE, aIcon))
-{
-    CheckComArgSafeArrayNotNull(aIcon);
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        hrc = checkStateDependency(MutableOrSavedStateDep);
-        if (SUCCEEDED(hrc))
-        {
-            setModified(IsModified_MachineData);
-            mUserData.backup();
-            com::SafeArray<BYTE> icon(ComSafeArrayInArg(aIcon));
-            mUserData->mIcon.resize(icon.size());
-            memcpy(&mUserData->mIcon[0], icon.raw(), mUserData->mIcon.size());
-         }
-    }
-    return hrc;
-}
-
-STDMETHODIMP Machine::COMGETTER(USBProxyAvailable)(BOOL *aAvailable)
-{
-    CheckComArgOutPointerValid(aAvailable);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
 #ifdef VBOX_WITH_USB
-    *aAvailable = true;
+    *aUSBProxyAvailable = true;
 #else
-    *aAvailable = false;
+    *aUSBProxyAvailable = false;
 #endif
     return S_OK;
 }
 
-STDMETHODIMP Machine::CloneTo(IMachine *pTarget, CloneMode_T mode, ComSafeArrayIn(CloneOptions_T, options), IProgress **pProgress)
+HRESULT Machine::cloneTo(const ComPtr<IMachine> &aTarget, CloneMode_T aMode, const std::vector<CloneOptions_T> &aOptions,
+                         ComPtr<IProgress> &aProgress)
 {
-    LogFlowFuncEnter();
+    ComObjPtr<Progress> pP;
+    Progress  *ppP = pP;
+    IProgress *iP  = static_cast<IProgress *>(ppP);
+    IProgress **pProgress = &iP;
 
-    CheckComArgNotNull(pTarget);
-    CheckComArgOutPointerValid(pProgress);
+    IMachine  *pTarget    = aTarget;
 
     /* Convert the options. */
     RTCList<CloneOptions_T> optList;
-    if (options != NULL)
-        optList = com::SafeArray<CloneOptions_T>(ComSafeArrayInArg(options)).toList();
+    if (aOptions.size())
+        for (size_t i = 0; i < aOptions.size(); ++i)
+            optList.append(aOptions[i]);
 
     if (optList.contains(CloneOptions_Link))
     {
-        if (!isSnapshotMachine())
+        if (!i_isSnapshotMachine())
             return setError(E_INVALIDARG,
                             tr("Linked clone can only be created from a snapshot"));
-        if (mode != CloneMode_MachineState)
+        if (aMode != CloneMode_MachineState)
             return setError(E_INVALIDARG,
                             tr("Linked clone can only be created for a single machine state"));
     }
     AssertReturn(!(optList.contains(CloneOptions_KeepAllMACs) && optList.contains(CloneOptions_KeepNATMACs)), E_INVALIDARG);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-
-    MachineCloneVM *pWorker = new MachineCloneVM(this, static_cast<Machine*>(pTarget), mode, optList);
+    MachineCloneVM *pWorker = new MachineCloneVM(this, static_cast<Machine*>(pTarget), aMode, optList);
 
     HRESULT rc = pWorker->start(pProgress);
 
-    LogFlowFuncLeave();
+    pP = static_cast<Progress *>(*pProgress);
+    pP.queryInterfaceTo(aProgress.asOutParam());
 
     return rc;
+
+}
+
+HRESULT Machine::saveState(ComPtr<IProgress> &aProgress)
+{
+    NOREF(aProgress);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    // This check should always fail.
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
+    if (FAILED(rc)) return rc;
+
+    AssertFailedReturn(E_NOTIMPL);
+}
+
+HRESULT Machine::adoptSavedState(const com::Utf8Str &aSavedStateFile)
+{
+    NOREF(aSavedStateFile);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    // This check should always fail.
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
+    if (FAILED(rc)) return rc;
+
+    AssertFailedReturn(E_NOTIMPL);
+}
+
+HRESULT Machine::discardSavedState(BOOL aFRemoveFile)
+{
+    NOREF(aFRemoveFile);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    // This check should always fail.
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
+    if (FAILED(rc)) return rc;
+
+    AssertFailedReturn(E_NOTIMPL);
 }
 
 // public methods for internal purposes
@@ -7749,13 +7144,13 @@ STDMETHODIMP Machine::CloneTo(IMachine *pTarget, CloneMode_T mode, ComSafeArrayI
 
 /**
  * Adds the given IsModified_* flag to the dirty flags of the machine.
- * This must be called either during loadSettings or under the machine write lock.
+ * This must be called either during i_loadSettings or under the machine write lock.
  * @param fl
  */
-void Machine::setModified(uint32_t fl, bool fAllowStateModification /* = true */)
+void Machine::i_setModified(uint32_t fl, bool fAllowStateModification /* = true */)
 {
     mData->flModifications |= fl;
-    if (fAllowStateModification && isStateModificationAllowed())
+    if (fAllowStateModification && i_isStateModificationAllowed())
         mData->mCurrentStateModified = true;
 }
 
@@ -7765,10 +7160,10 @@ void Machine::setModified(uint32_t fl, bool fAllowStateModification /* = true */
  *
  * @param   fModifications      The flag to add.
  */
-void Machine::setModifiedLock(uint32_t fModification, bool fAllowStateModification /* = true */)
+void Machine::i_setModifiedLock(uint32_t fModification, bool fAllowStateModification /* = true */)
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    setModified(fModification, fAllowStateModification);
+    i_setModified(fModification, fAllowStateModification);
 }
 
 /**
@@ -7778,7 +7173,7 @@ void Machine::setModifiedLock(uint32_t fModification, bool fAllowStateModificati
  *
  *  @note locks this object for reading.
  */
-HRESULT Machine::saveRegistryEntry(settings::MachineRegistryEntry &data)
+HRESULT Machine::i_saveRegistryEntry(settings::MachineRegistryEntry &data)
 {
     AutoLimitedCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -7802,7 +7197,7 @@ HRESULT Machine::saveRegistryEntry(settings::MachineRegistryEntry &data)
  *
  * @note Locks this object for reading.
  */
-int Machine::calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult)
+int Machine::i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
@@ -7831,8 +7226,8 @@ int Machine::calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult)
  *
  * @note Locks this object for reading.
  */
-void Machine::copyPathRelativeToMachine(const Utf8Str &strSource,
-                                        Utf8Str &strTarget)
+void Machine::i_copyPathRelativeToMachine(const Utf8Str &strSource,
+                                          Utf8Str &strTarget)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), (void)0);
@@ -7861,7 +7256,7 @@ void Machine::copyPathRelativeToMachine(const Utf8Str &strSource,
  *  Returns the full path to the machine's log folder in the
  *  \a aLogFolder argument.
  */
-void Machine::getLogFolder(Utf8Str &aLogFolder)
+void Machine::i_getLogFolder(Utf8Str &aLogFolder)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -7899,7 +7294,8 @@ void Machine::getLogFolder(Utf8Str &aLogFolder)
 /**
  *  Returns the full path to the machine's log file for an given index.
  */
-Utf8Str Machine::queryLogFilename(ULONG idx)
+Utf8Str Machine::i_queryLogFilename(ULONG idx) /** @todo r=bird: Misnamed. Should be i_getLogFilename as it cannot fail.
+                                                   See VBox-CodingGuidelines.cpp, Compulsory seciont, line 79. */
 {
     Utf8Str logFolder;
     getLogFolder(logFolder);
@@ -7944,14 +7340,15 @@ Utf8Str Machine::i_getStartupLogFilename(void)
  *
  * @param str
  */
-void Machine::composeSavedStateFilename(Utf8Str &strStateFilePath)
+
+void Machine::i_composeSavedStateFilename(Utf8Str &strStateFilePath)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
 
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        calculateFullPath(mUserData->s.strSnapshotFolder, strStateFilePath);
+        i_calculateFullPath(mUserData->s.strSnapshotFolder, strStateFilePath);
     }
 
     RTTIMESPEC ts;
@@ -7968,7 +7365,7 @@ void Machine::composeSavedStateFilename(Utf8Str &strStateFilePath)
 /**
  *  Returns the full path to the default video capture file.
  */
-void Machine::getDefaultVideoCaptureFile(Utf8Str &strFile)
+void Machine::i_getDefaultVideoCaptureFile(Utf8Str &strFile)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -7976,14 +7373,14 @@ void Machine::getDefaultVideoCaptureFile(Utf8Str &strFile)
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     strFile = mData->m_strConfigFileFull;       // path/to/machinesfolder/vmname/vmname.vbox
-    strFile.stripExt();                         // path/to/machinesfolder/vmname/vmname
+    strFile.stripSuffix();                      // path/to/machinesfolder/vmname/vmname
     strFile.append(".webm");                    // path/to/machinesfolder/vmname/vmname.webm
 }
 
 /**
  * Returns whether at least one USB controller is present for the VM.
  */
-bool Machine::isUSBControllerPresent()
+bool Machine::i_isUSBControllerPresent()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), false);
@@ -7997,10 +7394,10 @@ bool Machine::isUSBControllerPresent()
  *  @note Locks this object for writing, calls the client process
  *        (inside the lock).
  */
-HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
-                                 const Utf8Str &strFrontend,
-                                 const Utf8Str &strEnvironment,
-                                 ProgressProxy *aProgress)
+HRESULT Machine::i_launchVMProcess(IInternalSessionControl *aControl,
+                                   const Utf8Str &strFrontend,
+                                   const Utf8Str &strEnvironment,
+                                   ProgressProxy *aProgress)
 {
     LogFlowThisFuncEnter();
 
@@ -8020,15 +7417,29 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
 
     LogFlowThisFunc(("mSession.mState=%s\n", Global::stringifySessionState(mData->mSession.mState)));
 
-    if (    mData->mSession.mState == SessionState_Locked
-         || mData->mSession.mState == SessionState_Spawning
-         || mData->mSession.mState == SessionState_Unlocking)
-        return setError(VBOX_E_INVALID_OBJECT_STATE,
-                        tr("The machine '%s' is already locked by a session (or being locked or unlocked)"),
-                        mUserData->s.strName.c_str());
+    /* The process started when launching a VM with separate UI/VM processes is always
+     * the UI process, i.e. needs special handling as it won't claim the session. */
+    bool fSeparate = strFrontend.endsWith("separate", Utf8Str::CaseInsensitive);
 
-    /* may not be busy */
-    AssertReturn(!Global::IsOnlineOrTransient(mData->mMachineState), E_FAIL);
+    if (fSeparate)
+    {
+        if (mData->mSession.mState != SessionState_Unlocked && mData->mSession.mName == "headless")
+            return setError(VBOX_E_INVALID_OBJECT_STATE,
+                            tr("The machine '%s' is in a state which is incompatible with launching a separate UI process"),
+                            mUserData->s.strName.c_str());
+    }
+    else
+    {
+        if (    mData->mSession.mState == SessionState_Locked
+             || mData->mSession.mState == SessionState_Spawning
+             || mData->mSession.mState == SessionState_Unlocking)
+            return setError(VBOX_E_INVALID_OBJECT_STATE,
+                            tr("The machine '%s' is already locked by a session (or being locked or unlocked)"),
+                            mUserData->s.strName.c_str());
+
+        /* may not be busy */
+        AssertReturn(!Global::IsOnlineOrTransient(mData->mMachineState), E_FAIL);
+    }
 
     /* get the path to the executable */
     char szPath[RTPATH_MAX];
@@ -8103,7 +7514,8 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
         {
             Utf8Str strStartupLogDir = strStartupLogFile;
             strStartupLogDir.stripFilename();
-            RTDirCreateFullPath(strStartupLogDir.c_str(), 0755); /** @todo add a variant for creating the path to a file without stripping the file. */
+            RTDirCreateFullPath(strStartupLogDir.c_str(), 0755); /** @todo add a variant for creating the path to a
+                                                                     file without stripping the file. */
         }
         strSupStartLogArg.append(strStartupLogFile);
     }
@@ -8112,10 +7524,16 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
     const char *pszSupStartupLogArg = NULL;
 #endif
 
+    Utf8Str strCanonicalName;
 
 #ifdef VBOX_WITH_QTGUI
-    if (strFrontend == "gui" || strFrontend == "GUI/Qt")
+    if (   !strFrontend.compare("gui", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("GUI/Qt", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("separate", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("gui/separate", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("GUI/Qt/separate", Utf8Str::CaseInsensitive))
     {
+        strCanonicalName = "GUI/Qt";
 # ifdef RT_OS_DARWIN /* Avoid Launch Services confusing this with the selector by using a helper app. */
         /* Modify the base path so that we don't need to use ".." below. */
         RTPathStripTrailingSlash(szPath);
@@ -8127,7 +7545,7 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
 #  define OSX_APP_NAME "VirtualBoxVM"
 #  define OSX_APP_PATH_FMT "/Resources/%s.app/Contents/MacOS/VirtualBoxVM"
 
-        Utf8Str strAppOverride = getExtraData(Utf8Str("VBoxInternal2/VirtualBoxVMAppOverride"));
+        Utf8Str strAppOverride = i_getExtraData(Utf8Str("VBoxInternal2/VirtualBoxVMAppOverride"));
         if (   strAppOverride.contains(".")
             || strAppOverride.contains("/")
             || strAppOverride.contains("\\")
@@ -8160,9 +7578,15 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
             "--comment", mUserData->s.strName.c_str(),
             "--startvm", idStr.c_str(),
             "--no-startvm-errormsgbox",
-            pszSupStartupLogArg,
+            NULL, /* For "--separate". */
+            NULL, /* For "--sup-startup-log". */
             NULL
         };
+        unsigned iArg = 6;
+        if (fSeparate)
+            apszArgs[iArg++] = "--separate";
+        apszArgs[iArg++] = pszSupStartupLogArg;
+
         vrc = RTProcCreate(szPath, apszArgs, env, 0, &pid);
     }
 #else /* !VBOX_WITH_QTGUI */
@@ -8173,8 +7597,12 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
     else
 
 #ifdef VBOX_WITH_VBOXSDL
-    if (strFrontend == "sdl" || strFrontend == "GUI/SDL")
+    if (   !strFrontend.compare("sdl", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("GUI/SDL", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("sdl/separate", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("GUI/SDL/separate", Utf8Str::CaseInsensitive))
     {
+        strCanonicalName = "GUI/SDL";
         static const char s_szVBoxSDL_exe[] = "VBoxSDL" HOSTSUFF_EXE;
         Assert(cchBufLeft >= sizeof(s_szVBoxSDL_exe));
         strcpy(pszNamePart, s_szVBoxSDL_exe);
@@ -8185,9 +7613,15 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
             szPath,
             "--comment", mUserData->s.strName.c_str(),
             "--startvm", idStr.c_str(),
-            pszSupStartupLogArg,
+            NULL, /* For "--separate". */
+            NULL, /* For "--sup-startup-log". */
             NULL
         };
+        unsigned iArg = 5;
+        if (fSeparate)
+            apszArgs[iArg++] = "--separate";
+        apszArgs[iArg++] = pszSupStartupLogArg;
+
         vrc = RTProcCreate(szPath, apszArgs, env, 0, &pid);
     }
 #else /* !VBOX_WITH_VBOXSDL */
@@ -8198,11 +7632,12 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
     else
 
 #ifdef VBOX_WITH_HEADLESS
-    if (   strFrontend == "headless"
-        || strFrontend == "capture"
-        || strFrontend == "vrdp" /* Deprecated. Same as headless. */
+    if (   !strFrontend.compare("headless", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("capture", Utf8Str::CaseInsensitive)
+        || !strFrontend.compare("vrdp", Utf8Str::CaseInsensitive) /* Deprecated. Same as headless. */
        )
     {
+        strCanonicalName = "headless";
         /* On pre-4.0 the "headless" type was used for passing "--vrdp off" to VBoxHeadless to let it work in OSE,
          * which did not contain VRDP server. In VBox 4.0 the remote desktop server (VRDE) is optional,
          * and a VM works even if the server has not been installed.
@@ -8221,12 +7656,12 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
             "--comment", mUserData->s.strName.c_str(),
             "--startvm", idStr.c_str(),
             "--vrde", "config",
-            0, /* For "--capture". */
-            0, /* For "--sup-startup-log". */
-            0
+            NULL, /* For "--capture". */
+            NULL, /* For "--sup-startup-log". */
+            NULL
         };
         unsigned iArg = 7;
-        if (strFrontend == "capture")
+        if (!strFrontend.compare("capture", Utf8Str::CaseInsensitive))
             apszArgs[iArg++] = "--capture";
         apszArgs[iArg++] = pszSupStartupLogArg;
 
@@ -8257,45 +7692,56 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
 
     LogFlowThisFunc(("launched.pid=%d(0x%x)\n", pid, pid));
 
-    /*
-     *  Note that we don't release the lock here before calling the client,
-     *  because it doesn't need to call us back if called with a NULL argument.
-     *  Releasing the lock here is dangerous because we didn't prepare the
-     *  launch data yet, but the client we've just started may happen to be
-     *  too fast and call LockMachine() that will fail (because of PID, etc.),
-     *  so that the Machine will never get out of the Spawning session state.
-     */
+    if (!fSeparate)
+    {
+        /*
+         *  Note that we don't release the lock here before calling the client,
+         *  because it doesn't need to call us back if called with a NULL argument.
+         *  Releasing the lock here is dangerous because we didn't prepare the
+         *  launch data yet, but the client we've just started may happen to be
+         *  too fast and call LockMachine() that will fail (because of PID, etc.),
+         *  so that the Machine will never get out of the Spawning session state.
+         */
 
-    /* inform the session that it will be a remote one */
-    LogFlowThisFunc(("Calling AssignMachine (NULL)...\n"));
+        /* inform the session that it will be a remote one */
+        LogFlowThisFunc(("Calling AssignMachine (NULL)...\n"));
 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
-    HRESULT rc = aControl->AssignMachine(NULL, LockType_Write, Bstr::Empty.raw());
+        HRESULT rc = aControl->AssignMachine(NULL, LockType_Write, Bstr::Empty.raw());
 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-    HRESULT rc = aControl->AssignMachine(NULL, LockType_Write, NULL);
+        HRESULT rc = aControl->AssignMachine(NULL, LockType_Write, NULL);
 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-    LogFlowThisFunc(("AssignMachine (NULL) returned %08X\n", rc));
+        LogFlowThisFunc(("AssignMachine (NULL) returned %08X\n", rc));
 
-    if (FAILED(rc))
+        if (FAILED(rc))
+        {
+            /* restore the session state */
+            mData->mSession.mState = SessionState_Unlocked;
+            alock.release();
+            mParent->i_addProcessToReap(pid);
+            /* The failure may occur w/o any error info (from RPC), so provide one */
+            return setError(VBOX_E_VM_ERROR,
+                            tr("Failed to assign the machine to the session (%Rhrc)"), rc);
+        }
+
+        /* attach launch data to the machine */
+        Assert(mData->mSession.mPID == NIL_RTPROCESS);
+        mData->mSession.mRemoteControls.push_back(aControl);
+        mData->mSession.mProgress = aProgress;
+        mData->mSession.mPID = pid;
+        mData->mSession.mState = SessionState_Spawning;
+        Assert(strCanonicalName.isNotEmpty());
+        mData->mSession.mName = strCanonicalName;
+    }
+    else
     {
-        /* restore the session state */
-        mData->mSession.mState = SessionState_Unlocked;
-        alock.release();
-        mParent->addProcessToReap(pid);
-        /* The failure may occur w/o any error info (from RPC), so provide one */
-        return setError(VBOX_E_VM_ERROR,
-                        tr("Failed to assign the machine to the session (%Rhrc)"), rc);
+        /* For separate UI process we declare the launch as completed instantly, as the
+         * actual headless VM start may or may not come. No point in remembering anything
+         * yet, as what matters for us is when the headless VM gets started. */
+        aProgress->i_notifyComplete(S_OK);
     }
 
-    /* attach launch data to the machine */
-    Assert(mData->mSession.mPID == NIL_RTPROCESS);
-    mData->mSession.mRemoteControls.push_back(aControl);
-    mData->mSession.mProgress = aProgress;
-    mData->mSession.mPID = pid;
-    mData->mSession.mState = SessionState_Spawning;
-    mData->mSession.mType = strFrontend;
-
     alock.release();
-    mParent->addProcessToReap(pid);
+    mParent->i_addProcessToReap(pid);
 
     LogFlowThisFuncLeave();
     return S_OK;
@@ -8315,20 +7761,21 @@ HRESULT Machine::launchVMProcess(IInternalSessionControl *aControl,
  *
  * @note locks this object for reading.
  */
-bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
-                            ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
-                            bool aAllowClosing /*= false*/)
+bool Machine::i_isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
+                              ComPtr<IInternalSessionControl> *aControl /*= NULL*/,
+                              bool aAllowClosing /*= false*/)
 {
     AutoLimitedCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), false);
 
     /* just return false for inaccessible machines */
-    if (autoCaller.state() != Ready)
+    if (getObjectState().getState() != ObjectState::Ready)
         return false;
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (    mData->mSession.mState == SessionState_Locked
+    if (    (   mData->mSession.mState == SessionState_Locked
+             && mData->mSession.mLockType == LockType_VM)
          || (aAllowClosing && mData->mSession.mState == SessionState_Unlocking)
        )
     {
@@ -8350,13 +7797,13 @@ bool Machine::isSessionOpen(ComObjPtr<SessionMachine> &aMachine,
  *
  * @note locks this object for reading.
  */
-bool Machine::isSessionSpawning()
+bool Machine::i_isSessionSpawning()
 {
     AutoLimitedCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), false);
 
     /* just return false for inaccessible machines */
-    if (autoCaller.state() != Ready)
+    if (getObjectState().getState() != ObjectState::Ready)
         return false;
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -8381,7 +7828,7 @@ bool Machine::isSessionSpawning()
  *
  * @note Locks this object for writing.
  */
-bool Machine::checkForSpawnFailure()
+bool Machine::i_checkForSpawnFailure()
 {
     AutoCaller autoCaller(this);
     if (!autoCaller.isOk())
@@ -8427,19 +7874,19 @@ bool Machine::checkForSpawnFailure()
         if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_NORMAL)
             rc = setError(E_FAIL,
                           tr("The virtual machine '%s' has terminated unexpectedly during startup with exit code %d (%#x)%s"),
-                          getName().c_str(), status.iStatus, status.iStatus, strExtraInfo.c_str());
+                          i_getName().c_str(), status.iStatus, status.iStatus, strExtraInfo.c_str());
         else if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_SIGNAL)
             rc = setError(E_FAIL,
                           tr("The virtual machine '%s' has terminated unexpectedly during startup because of signal %d%s"),
-                          getName().c_str(), status.iStatus, strExtraInfo.c_str());
+                          i_getName().c_str(), status.iStatus, strExtraInfo.c_str());
         else if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_ABEND)
             rc = setError(E_FAIL,
                           tr("The virtual machine '%s' has terminated abnormally (iStatus=%#x)%s"),
-                          getName().c_str(), status.iStatus, strExtraInfo.c_str());
+                          i_getName().c_str(), status.iStatus, strExtraInfo.c_str());
         else
             rc = setError(E_FAIL,
                           tr("The virtual machine '%s' has terminated unexpectedly during startup (%Rrc)%s"),
-                          getName().c_str(), vrc, strExtraInfo.c_str());
+                          i_getName().c_str(), vrc, strExtraInfo.c_str());
     }
 
     if (FAILED(rc))
@@ -8467,7 +7914,7 @@ bool Machine::checkForSpawnFailure()
 
         mData->mSession.mPID = NIL_RTPROCESS;
 
-        mParent->onSessionStateChange(mData->mUuid, SessionState_Unlocked);
+        mParent->i_onSessionStateChange(mData->mUuid, SessionState_Unlocked);
         return true;
     }
 
@@ -8481,7 +7928,7 @@ bool Machine::checkForSpawnFailure()
  *  @note Must be called from mParent's write lock. Locks this object and
  *  children for writing.
  */
-HRESULT Machine::prepareRegister()
+HRESULT Machine::i_prepareRegister()
 {
     AssertReturn(mParent->isWriteLockOnCurrentThread(), E_FAIL);
 
@@ -8491,7 +7938,7 @@ HRESULT Machine::prepareRegister()
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* wait for state dependents to drop to zero */
-    ensureNoStateDependencies();
+    i_ensureNoStateDependencies();
 
     if (!mData->mAccessible)
         return setError(VBOX_E_INVALID_OBJECT_STATE,
@@ -8499,7 +7946,7 @@ HRESULT Machine::prepareRegister()
                         mUserData->s.strName.c_str(),
                         mData->mUuid.toString().c_str());
 
-    AssertReturn(autoCaller.state() == Ready, E_FAIL);
+    AssertReturn(getObjectState().getState() == ObjectState::Ready, E_FAIL);
 
     if (mData->mRegistered)
         return setError(VBOX_E_INVALID_OBJECT_STATE,
@@ -8510,12 +7957,12 @@ HRESULT Machine::prepareRegister()
     HRESULT rc = S_OK;
 
     // Ensure the settings are saved. If we are going to be registered and
-    // no config file exists yet, create it by calling saveSettings() too.
+    // no config file exists yet, create it by calling i_saveSettings() too.
     if (    (mData->flModifications)
          || (!mData->pMachineConfigFile->fileExists())
        )
     {
-        rc = saveSettings(NULL);
+        rc = i_saveSettings(NULL);
                 // no need to check whether VirtualBox.xml needs saving too since
                 // we can't have a machine XML file rename pending
         if (FAILED(rc)) return rc;
@@ -8526,14 +7973,14 @@ HRESULT Machine::prepareRegister()
     if (SUCCEEDED(rc))
     {
         /* we may have had implicit modifications we want to fix on success */
-        commit();
+        i_commit();
 
         mData->mRegistered = true;
     }
     else
     {
         /* we may have had implicit modifications we want to cancel on failure*/
-        rollback(false /* aNotify */);
+        i_rollback(false /* aNotify */);
     }
 
     return rc;
@@ -8558,22 +8005,22 @@ HRESULT Machine::prepareRegister()
  *
  * @note Locks this object for writing.
  */
-HRESULT Machine::addStateDependency(StateDependency aDepType /* = AnyStateDep */,
-                                    MachineState_T *aState /* = NULL */,
-                                    BOOL *aRegistered /* = NULL */)
+HRESULT Machine::i_addStateDependency(StateDependency aDepType /* = AnyStateDep */,
+                                      MachineState_T *aState /* = NULL */,
+                                      BOOL *aRegistered /* = NULL */)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    HRESULT rc = checkStateDependency(aDepType);
+    HRESULT rc = i_checkStateDependency(aDepType);
     if (FAILED(rc)) return rc;
 
     {
         if (mData->mMachineStateChangePending != 0)
         {
-            /* ensureNoStateDependencies() is waiting for state dependencies to
+            /* i_ensureNoStateDependencies() is waiting for state dependencies to
              * drop to zero so don't add more. It may make sense to wait a bit
              * and retry before reporting an error (since the pending state
              * transition should be really quick) but let's just assert for
@@ -8602,7 +8049,7 @@ HRESULT Machine::addStateDependency(StateDependency aDepType /* = AnyStateDep */
  * Must always complete the #addStateDependency() call after the state
  * dependency is no more necessary.
  */
-void Machine::releaseStateDependency()
+void Machine::i_releaseStateDependency()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -8615,7 +8062,7 @@ void Machine::releaseStateDependency()
 
     if (mData->mMachineStateDeps == 0)
     {
-        /* inform ensureNoStateDependencies() that there are no more deps */
+        /* inform i_ensureNoStateDependencies() that there are no more deps */
         if (mData->mMachineStateChangePending != 0)
         {
             Assert(mData->mMachineStateDepsSem != NIL_RTSEMEVENTMULTI);
@@ -8624,7 +8071,7 @@ void Machine::releaseStateDependency()
     }
 }
 
-Utf8Str Machine::getExtraData(const Utf8Str &strKey)
+Utf8Str Machine::i_getExtraData(const Utf8Str &strKey)
 {
     /* start with nothing found */
     Utf8Str strResult("");
@@ -8661,9 +8108,17 @@ Utf8Str Machine::getExtraData(const Utf8Str &strKey)
  *  returned. This is useful in setters which allow changing machine
  *  properties when it is in the saved state.
  *
- *  When @a aDepType is OfflineStateDep, this method returns S_OK if the
- *  state is one of the 4 offline states (PoweredOff, Saved, Teleported,
- *  Aborted).
+ *  When @a aDepType is MutableOrRunningStateDep, this method returns S_OK only
+ *  if the current state of this machine object allows to change runtime
+ *  changeable settings of the machine (i.e. the machine is not registered, or
+ *  registered but either running or not running and not saved). It is useful
+ *  to call this method from Machine setters before performing any changes to
+ *  runtime changeable settings.
+ *
+ *  When @a aDepType is MutableOrSavedOrRunningStateDep, this method behaves
+ *  the same as for MutableOrRunningStateDep except that if the machine is
+ *  saved, S_OK is also returned. This is useful in setters which allow
+ *  changing runtime and saved state changeable machine properties.
  *
  *  @param aDepType     Dependency type to check.
  *
@@ -8674,7 +8129,7 @@ Utf8Str Machine::getExtraData(const Utf8Str &strKey)
  *  @note This method must be called from under this object's read or write
  *        lock.
  */
-HRESULT Machine::checkStateDependency(StateDependency aDepType)
+HRESULT Machine::i_checkStateDependency(StateDependency aDepType)
 {
     switch (aDepType)
     {
@@ -8685,10 +8140,8 @@ HRESULT Machine::checkStateDependency(StateDependency aDepType)
         case MutableStateDep:
         {
             if (   mData->mRegistered
-                && (   !isSessionMachine()  /** @todo This was just converted raw; Check if Running and Paused should actually be included here... (Live Migration) */
-                    || (   mData->mMachineState != MachineState_Paused
-                        && mData->mMachineState != MachineState_Running
-                        && mData->mMachineState != MachineState_Aborted
+                && (   !i_isSessionMachine()
+                    || (   mData->mMachineState != MachineState_Aborted
                         && mData->mMachineState != MachineState_Teleported
                         && mData->mMachineState != MachineState_PoweredOff
                        )
@@ -8702,10 +8155,8 @@ HRESULT Machine::checkStateDependency(StateDependency aDepType)
         case MutableOrSavedStateDep:
         {
             if (   mData->mRegistered
-                && (   !isSessionMachine() /** @todo This was just converted raw; Check if Running and Paused should actually be included here... (Live Migration) */
-                    || (   mData->mMachineState != MachineState_Paused
-                        && mData->mMachineState != MachineState_Running
-                        && mData->mMachineState != MachineState_Aborted
+                && (   !i_isSessionMachine()
+                    || (   mData->mMachineState != MachineState_Aborted
                         && mData->mMachineState != MachineState_Teleported
                         && mData->mMachineState != MachineState_Saved
                         && mData->mMachineState != MachineState_PoweredOff
@@ -8717,19 +8168,36 @@ HRESULT Machine::checkStateDependency(StateDependency aDepType)
                                 Global::stringifyMachineState(mData->mMachineState));
             break;
         }
-        case OfflineStateDep:
+        case MutableOrRunningStateDep:
         {
             if (   mData->mRegistered
-                && (   !isSessionMachine()
-                    || (   mData->mMachineState != MachineState_PoweredOff
-                        && mData->mMachineState != MachineState_Saved
-                        && mData->mMachineState != MachineState_Aborted
+                && (   !i_isSessionMachine()
+                    || (   mData->mMachineState != MachineState_Aborted
                         && mData->mMachineState != MachineState_Teleported
+                        && mData->mMachineState != MachineState_PoweredOff
+                        && !Global::IsOnline(mData->mMachineState)
                        )
                    )
                )
                 return setError(VBOX_E_INVALID_VM_STATE,
-                                tr("The machine is not offline (state is %s)"),
+                                tr("The machine is not mutable (state is %s)"),
+                                Global::stringifyMachineState(mData->mMachineState));
+            break;
+        }
+        case MutableOrSavedOrRunningStateDep:
+        {
+            if (   mData->mRegistered
+                && (   !i_isSessionMachine()
+                    || (   mData->mMachineState != MachineState_Aborted
+                        && mData->mMachineState != MachineState_Teleported
+                        && mData->mMachineState != MachineState_Saved
+                        && mData->mMachineState != MachineState_PoweredOff
+                        && !Global::IsOnline(mData->mMachineState)
+                       )
+                   )
+               )
+                return setError(VBOX_E_INVALID_VM_STATE,
+                                tr("The machine is not mutable (state is %s)"),
                                 Global::stringifyMachineState(mData->mMachineState));
             break;
         }
@@ -8751,8 +8219,8 @@ HRESULT Machine::initDataAndChildObjects()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
-    AssertComRCReturn(autoCaller.state() == InInit ||
-                      autoCaller.state() == Limited, E_FAIL);
+    AssertComRCReturn(   getObjectState().getState() == ObjectState::InInit
+                      || getObjectState().getState() == ObjectState::Limited, E_FAIL);
 
     AssertReturn(!mData->mAccessible, E_FAIL);
 
@@ -8765,7 +8233,7 @@ HRESULT Machine::initDataAndChildObjects()
     mUSBControllers.allocate();
 
     /* initialize mOSTypeId */
-    mUserData->s.strOsType = mParent->getUnknownOSType()->id();
+    mUserData->s.strOsType = mParent->i_getUnknownOSType()->i_id();
 
     /* create associated BIOS settings object */
     unconst(mBIOSSettings).createObject();
@@ -8776,14 +8244,14 @@ HRESULT Machine::initDataAndChildObjects()
     mVRDEServer->init(this);
 
     /* create associated serial port objects */
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
     {
         unconst(mSerialPorts[slot]).createObject();
         mSerialPorts[slot]->init(this, slot);
     }
 
     /* create associated parallel port objects */
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
     {
         unconst(mParallelPorts[slot]).createObject();
         mParallelPorts[slot]->init(this, slot);
@@ -8799,7 +8267,7 @@ HRESULT Machine::initDataAndChildObjects()
 
     /* create associated network adapter objects */
     mNetworkAdapters.resize(Global::getMaxNetworkAdapters(mHWData->mChipsetType));
-    for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)
+    for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot)
     {
         unconst(mNetworkAdapters[slot]).createObject();
         mNetworkAdapters[slot]->init(this, slot);
@@ -8825,8 +8293,8 @@ void Machine::uninitDataAndChildObjects()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
-    AssertComRCReturnVoid(    autoCaller.state() == InUninit
-                           || autoCaller.state() == Limited);
+    AssertComRCReturnVoid(   getObjectState().getState() == ObjectState::InUninit
+                          || getObjectState().getState() == ObjectState::Limited);
 
     /* tell all our other child objects we've been uninitialized */
     if (mBandwidthControl)
@@ -8835,7 +8303,7 @@ void Machine::uninitDataAndChildObjects()
         unconst(mBandwidthControl).setNull();
     }
 
-    for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)
+    for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot)
     {
         if (mNetworkAdapters[slot])
         {
@@ -8856,7 +8324,7 @@ void Machine::uninitDataAndChildObjects()
         unconst(mAudioAdapter).setNull();
     }
 
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
     {
         if (mParallelPorts[slot])
         {
@@ -8865,7 +8333,7 @@ void Machine::uninitDataAndChildObjects()
         }
     }
 
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
     {
         if (mSerialPorts[slot])
         {
@@ -8895,22 +8363,22 @@ void Machine::uninitDataAndChildObjects()
      * attachments will already be uninitialized and deleted, so this
      * code will not affect them. */
     if (    !!mMediaData
-         && (!isSessionMachine())
+         && (!i_isSessionMachine())
        )
     {
         for (MediaData::AttachmentList::const_iterator it = mMediaData->mAttachments.begin();
              it != mMediaData->mAttachments.end();
              ++it)
         {
-            ComObjPtr<Medium> pMedium = (*it)->getMedium();
+            ComObjPtr<Medium> pMedium = (*it)->i_getMedium();
             if (pMedium.isNull())
                 continue;
-            HRESULT rc = pMedium->removeBackReference(mData->mUuid, getSnapshotId());
+            HRESULT rc = pMedium->i_removeBackReference(mData->mUuid, i_getSnapshotId());
             AssertComRC(rc);
         }
     }
 
-    if (!isSessionMachine() && !isSnapshotMachine())
+    if (!i_isSessionMachine() && !i_isSnapshotMachine())
     {
         // clean up the snapshots list (Snapshot::uninit() will handle the snapshot's children recursively)
         if (mData->mFirstSnapshot)
@@ -8944,9 +8412,9 @@ void Machine::uninitDataAndChildObjects()
  *  object's pointer itself. For SessionMachine objects, returns the peer
  *  (primary) machine pointer.
  */
-Machine* Machine::getMachine()
+Machine* Machine::i_getMachine()
 {
-    if (isSessionMachine())
+    if (i_isSessionMachine())
         return (Machine*)mPeer;
     return this;
 }
@@ -8964,7 +8432,7 @@ Machine* Machine::getMachine()
  *
  * @warning To be used only in methods that change the machine state!
  */
-void Machine::ensureNoStateDependencies()
+void Machine::i_ensureNoStateDependencies()
 {
     AssertReturnVoid(isWriteLockOnCurrentThread());
 
@@ -9004,10 +8472,11 @@ void Machine::ensureNoStateDependencies()
  *
  * @note Locks this object for writing.
  */
-HRESULT Machine::setMachineState(MachineState_T aMachineState)
+HRESULT Machine::i_setMachineState(MachineState_T aMachineState)
 {
     LogFlowThisFuncEnter();
     LogFlowThisFunc(("aMachineState=%s\n", Global::stringifyMachineState(aMachineState) ));
+    Assert(aMachineState != MachineState_Null);
 
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
@@ -9015,15 +8484,18 @@ HRESULT Machine::setMachineState(MachineState_T aMachineState)
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* wait for state dependents to drop to zero */
-    ensureNoStateDependencies();
+    i_ensureNoStateDependencies();
 
-    if (mData->mMachineState != aMachineState)
+    MachineState_T const enmOldState = mData->mMachineState;
+    if (enmOldState != aMachineState)
     {
         mData->mMachineState = aMachineState;
-
         RTTimeNow(&mData->mLastStateChange);
 
-        mParent->onMachineStateChange(mData->mUuid, aMachineState);
+#ifdef VBOX_WITH_DTRACE_R3_MAIN
+        VBOXAPI_MACHINE_STATE_CHANGED(this, aMachineState, enmOldState, mData->mUuid.toStringCurly().c_str());
+#endif
+        mParent->i_onMachineStateChange(mData->mUuid, aMachineState);
     }
 
     LogFlowThisFuncLeave();
@@ -9044,9 +8516,9 @@ HRESULT Machine::setMachineState(MachineState_T aMachineState)
  *  @note
  *      must be called from under the object's lock!
  */
-HRESULT Machine::findSharedFolder(const Utf8Str &aName,
-                                  ComObjPtr<SharedFolder> &aSharedFolder,
-                                  bool aSetError /* = false */)
+HRESULT Machine::i_findSharedFolder(const Utf8Str &aName,
+                                    ComObjPtr<SharedFolder> &aSharedFolder,
+                                    bool aSetError /* = false */)
 {
     HRESULT rc = VBOX_E_OBJECT_NOT_FOUND;
     for (HWData::SharedFolderList::const_iterator it = mHWData->mSharedFolders.begin();
@@ -9055,7 +8527,7 @@ HRESULT Machine::findSharedFolder(const Utf8Str &aName,
     {
         SharedFolder *pSF = *it;
         AutoCaller autoCaller(pSF);
-        if (pSF->getName() == aName)
+        if (pSF->i_getName() == aName)
         {
             aSharedFolder = pSF;
             rc = S_OK;
@@ -9089,11 +8561,12 @@ HRESULT Machine::findSharedFolder(const Utf8Str &aName,
  * -- During VM cloning.
  *
  * @param config Machine settings from XML.
- * @param puuidRegistry If != NULL, Medium::setRegistryIdIfFirst() gets called with this registry ID for each attached medium in the config.
+ * @param puuidRegistry If != NULL, Medium::setRegistryIdIfFirst() gets called with this registry ID
+ * for each attached medium in the config.
  * @return
  */
-HRESULT Machine::loadMachineDataFromSettings(const settings::MachineConfigFile &config,
-                                             const Guid *puuidRegistry)
+HRESULT Machine::i_loadMachineDataFromSettings(const settings::MachineConfigFile &config,
+                                               const Guid *puuidRegistry)
 {
     // copy name, description, OS type, teleporter, UTC etc.
     mUserData->s = config.machineUserData;
@@ -9107,19 +8580,22 @@ HRESULT Machine::loadMachineDataFromSettings(const settings::MachineConfigFile &
                         tr("Icon Data too long.'%d' > '%d'"),
                         cbOut,
                         DECODE_STR_MAX);
-    com::SafeArray<BYTE> iconByte(cbOut);
-    HRESULT rc = RTBase64Decode(pszStr, iconByte.raw(), cbOut, NULL, NULL);
-    if (FAILED(rc))
+    mUserData->mIcon.resize(cbOut);
+    int vrc = VINF_SUCCESS;
+    if (cbOut)
+        vrc = RTBase64Decode(pszStr, &mUserData->mIcon.front(), cbOut, NULL, NULL);
+    if (RT_FAILURE(vrc))
+    {
+        mUserData->mIcon.resize(0);
         return setError(E_FAIL,
-                        tr("Failure to Decode Icon Data. '%s' (%d)"),
+                        tr("Failure to Decode Icon Data. '%s' (%Rrc)"),
                         pszStr,
-                        rc);
-    mUserData->mIcon.resize(iconByte.size());
-    memcpy(&mUserData->mIcon[0], iconByte.raw(), mUserData->mIcon.size());
+                        vrc);
+    }
 
     // look up the object by Id to check it is valid
     ComPtr<IGuestOSType> guestOSType;
-    rc = mParent->GetGuestOSType(Bstr(mUserData->s.strOsType).raw(),
+    HRESULT rc = mParent->GetGuestOSType(Bstr(mUserData->s.strOsType).raw(),
                                          guestOSType.asOutParam());
     if (FAILED(rc)) return rc;
 
@@ -9129,7 +8605,7 @@ HRESULT Machine::loadMachineDataFromSettings(const settings::MachineConfigFile &
     else
     {
         Utf8Str stateFilePathFull(config.strStateFile);
-        int vrc = calculateFullPath(stateFilePathFull, stateFilePathFull);
+        vrc = i_calculateFullPath(stateFilePathFull, stateFilePathFull);
         if (RT_FAILURE(vrc))
             return setError(E_FAIL,
                             tr("Invalid saved state file path '%s' (%Rrc)"),
@@ -9163,9 +8639,9 @@ HRESULT Machine::loadMachineDataFromSettings(const settings::MachineConfigFile &
     if (config.canHaveOwnMediaRegistry())
     {
         // determine machine folder
-        Utf8Str strMachineFolder = getSettingsFileFull();
+        Utf8Str strMachineFolder = i_getSettingsFileFull();
         strMachineFolder.stripFilename();
-        rc = mParent->initMedia(getId(),         // media registry ID == machine UUID
+        rc = mParent->initMedia(i_getId(),       // media registry ID == machine UUID
                                 config.mediaRegistry,
                                 strMachineFolder);
         if (FAILED(rc)) return rc;
@@ -9180,27 +8656,27 @@ HRESULT Machine::loadMachineDataFromSettings(const settings::MachineConfigFile &
 
         const settings::Snapshot &snap = config.llFirstSnapshot.front();
 
-        rc = loadSnapshot(snap,
-                          config.uuidCurrentSnapshot,
-                          NULL);        // no parent == first snapshot
+        rc = i_loadSnapshot(snap,
+                            config.uuidCurrentSnapshot,
+                            NULL);        // no parent == first snapshot
         if (FAILED(rc)) return rc;
     }
 
     // hardware data
-    rc = loadHardware(config.hardwareMachine, &config.debugging, &config.autostart);
+    rc = i_loadHardware(config.hardwareMachine, &config.debugging, &config.autostart);
     if (FAILED(rc)) return rc;
 
     // load storage controllers
-    rc = loadStorageControllers(config.storageMachine,
-                                puuidRegistry,
-                                NULL /* puuidSnapshot */);
+    rc = i_loadStorageControllers(config.storageMachine,
+                                  puuidRegistry,
+                                  NULL /* puuidSnapshot */);
     if (FAILED(rc)) return rc;
 
     /*
      *  NOTE: the assignment below must be the last thing to do,
      *  otherwise it will be not possible to change the settings
      *  somewhere in the code above because all setters will be
-     *  blocked by checkStateDependency(MutableStateDep).
+     *  blocked by i_checkStateDependency(MutableStateDep).
      */
 
     /* set the machine state to Aborted or Saved when appropriate */
@@ -9208,12 +8684,12 @@ HRESULT Machine::loadMachineDataFromSettings(const settings::MachineConfigFile &
     {
         mSSData->strStateFilePath.setNull();
 
-        /* no need to use setMachineState() during init() */
+        /* no need to use i_setMachineState() during init() */
         mData->mMachineState = MachineState_Aborted;
     }
     else if (!mSSData->strStateFilePath.isEmpty())
     {
-        /* no need to use setMachineState() during init() */
+        /* no need to use i_setMachineState() during init() */
         mData->mMachineState = MachineState_Saved;
     }
 
@@ -9230,12 +8706,12 @@ HRESULT Machine::loadMachineDataFromSettings(const settings::MachineConfigFile &
  *  @param aCurSnapshotId   Current snapshot ID from the settings file.
  *  @param aParentSnapshot  Parent snapshot.
  */
-HRESULT Machine::loadSnapshot(const settings::Snapshot &data,
-                              const Guid &aCurSnapshotId,
-                              Snapshot *aParentSnapshot)
+HRESULT Machine::i_loadSnapshot(const settings::Snapshot &data,
+                                const Guid &aCurSnapshotId,
+                                Snapshot *aParentSnapshot)
 {
-    AssertReturn(!isSnapshotMachine(), E_FAIL);
-    AssertReturn(!isSessionMachine(), E_FAIL);
+    AssertReturn(!i_isSnapshotMachine(), E_FAIL);
+    AssertReturn(!i_isSessionMachine(), E_FAIL);
 
     HRESULT rc = S_OK;
 
@@ -9244,7 +8720,7 @@ HRESULT Machine::loadSnapshot(const settings::Snapshot &data,
     {
         /* optional */
         strStateFile = data.strStateFile;
-        int vrc = calculateFullPath(strStateFile, strStateFile);
+        int vrc = i_calculateFullPath(strStateFile, strStateFile);
         if (RT_FAILURE(vrc))
             return setError(E_FAIL,
                             tr("Invalid saved state file path '%s' (%Rrc)"),
@@ -9283,7 +8759,7 @@ HRESULT Machine::loadSnapshot(const settings::Snapshot &data,
 
     /* memorize the current snapshot when appropriate */
     if (    !mData->mCurrentSnapshot
-         && pSnapshot->getId() == aCurSnapshotId
+         && pSnapshot->i_getId() == aCurSnapshotId
        )
         mData->mCurrentSnapshot = pSnapshot;
 
@@ -9294,9 +8770,9 @@ HRESULT Machine::loadSnapshot(const settings::Snapshot &data,
     {
         const settings::Snapshot &childData = *it;
         // recurse
-        rc = loadSnapshot(childData,
-                          aCurSnapshotId,
-                          pSnapshot);       // parent = the one we created above
+        rc = i_loadSnapshot(childData,
+                            aCurSnapshotId,
+                            pSnapshot);       // parent = the one we created above
         if (FAILED(rc)) return rc;
     }
 
@@ -9310,10 +8786,10 @@ HRESULT Machine::loadSnapshot(const settings::Snapshot &data,
  *  @param pDbg           Pointer to the debugging settings.
  *  @param pAutostart     Pointer to the autostart settings.
  */
-HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg,
-                              const settings::Autostart *pAutostart)
+HRESULT Machine::i_loadHardware(const settings::Hardware &data, const settings::Debugging *pDbg,
+                                const settings::Autostart *pAutostart)
 {
-    AssertReturn(!isSessionMachine(), E_FAIL);
+    AssertReturn(!i_isSessionMachine(), E_FAIL);
 
     HRESULT rc = S_OK;
 
@@ -9330,12 +8806,12 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
         mHWData->mHWVirtExUXEnabled           = data.fUnrestrictedExecution;
         mHWData->mHWVirtExForceEnabled        = data.fHardwareVirtForce;
         mHWData->mPAEEnabled                  = data.fPAE;
-        mHWData->mSyntheticCpu                = data.fSyntheticCpu;
         mHWData->mLongMode                    = data.enmLongMode;
         mHWData->mTripleFaultReset            = data.fTripleFaultReset;
         mHWData->mCPUCount                    = data.cCPUs;
         mHWData->mCPUHotPlugEnabled           = data.fCpuHotPlug;
         mHWData->mCpuExecutionCap             = data.ulCpuExecutionCap;
+        mHWData->mCpuIdPortabilityLevel       = data.uCpuIdPortabilityLevel;
 
         // cpu
         if (mHWData->mCPUHotPlugEnabled)
@@ -9397,9 +8873,7 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
         mHWData->mPageFusionEnabled = data.fPageFusionEnabled;
 
         // boot order
-        for (size_t i = 0;
-             i < RT_ELEMENTS(mHWData->mBootOrder);
-             i++)
+        for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mBootOrder); ++i)
         {
             settings::BootOrderMap::const_iterator it = data.mapBootOrder.find(i);
             if (it == data.mapBootOrder.end())
@@ -9416,32 +8890,33 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
         mHWData->mVideoCaptureWidth = data.ulVideoCaptureHorzRes;
         mHWData->mVideoCaptureHeight = data.ulVideoCaptureVertRes;
         mHWData->mVideoCaptureEnabled = data.fVideoCaptureEnabled;
-        for (unsigned i = 0; i < RT_ELEMENTS(mHWData->maVideoCaptureScreens); i++)
+        for (unsigned i = 0; i < RT_ELEMENTS(mHWData->maVideoCaptureScreens); ++i)
             mHWData->maVideoCaptureScreens[i] = ASMBitTest(&data.u64VideoCaptureScreens, i);
         AssertCompile(RT_ELEMENTS(mHWData->maVideoCaptureScreens) == sizeof(data.u64VideoCaptureScreens) * 8);
         mHWData->mVideoCaptureRate = data.ulVideoCaptureRate;
         mHWData->mVideoCaptureFPS = data.ulVideoCaptureFPS;
         if (!data.strVideoCaptureFile.isEmpty())
-            calculateFullPath(data.strVideoCaptureFile, mHWData->mVideoCaptureFile);
+            i_calculateFullPath(data.strVideoCaptureFile, mHWData->mVideoCaptureFile);
         else
             mHWData->mVideoCaptureFile.setNull();
         mHWData->mFirmwareType = data.firmwareType;
         mHWData->mPointingHIDType = data.pointingHIDType;
         mHWData->mKeyboardHIDType = data.keyboardHIDType;
         mHWData->mChipsetType = data.chipsetType;
+        mHWData->mParavirtProvider = data.paravirtProvider;
         mHWData->mEmulatedUSBCardReaderEnabled = data.fEmulatedUSBCardReader;
         mHWData->mHPETEnabled = data.fHPETEnabled;
 
         /* VRDEServer */
-        rc = mVRDEServer->loadSettings(data.vrdeSettings);
+        rc = mVRDEServer->i_loadSettings(data.vrdeSettings);
         if (FAILED(rc)) return rc;
 
         /* BIOS */
-        rc = mBIOSSettings->loadSettings(data.biosSettings);
+        rc = mBIOSSettings->i_loadSettings(data.biosSettings);
         if (FAILED(rc)) return rc;
 
         // Bandwidth control (must come before network adapters)
-        rc = mBandwidthControl->loadSettings(data.ioSettings);
+        rc = mBandwidthControl->i_loadSettings(data.ioSettings);
         if (FAILED(rc)) return rc;
 
         /* Shared folders */
@@ -9458,19 +8933,19 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
         }
 
         /* USB device filters */
-        rc = mUSBDeviceFilters->loadSettings(data.usbSettings);
+        rc = mUSBDeviceFilters->i_loadSettings(data.usbSettings);
         if (FAILED(rc)) return rc;
 
         // network adapters
-        uint32_t newCount = Global::getMaxNetworkAdapters(mHWData->mChipsetType);
-        uint32_t oldCount = mNetworkAdapters.size();
+        size_t newCount = Global::getMaxNetworkAdapters(mHWData->mChipsetType);
+        size_t oldCount = mNetworkAdapters.size();
         if (newCount > oldCount)
         {
             mNetworkAdapters.resize(newCount);
-            for (ULONG slot = oldCount; slot < mNetworkAdapters.size(); slot++)
+            for (size_t slot = oldCount; slot < mNetworkAdapters.size(); ++slot)
             {
                 unconst(mNetworkAdapters[slot]).createObject();
-                mNetworkAdapters[slot]->init(this, slot);
+                mNetworkAdapters[slot]->init(this, (ULONG)slot);
             }
         }
         else if (newCount < oldCount)
@@ -9483,7 +8958,7 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
 
             /* slot unicity is guaranteed by XML Schema */
             AssertBreak(nic.ulSlot < mNetworkAdapters.size());
-            rc = mNetworkAdapters[nic.ulSlot]->loadSettings(mBandwidthControl, nic);
+            rc = mNetworkAdapters[nic.ulSlot]->i_loadSettings(mBandwidthControl, nic);
             if (FAILED(rc)) return rc;
         }
 
@@ -9495,7 +8970,7 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
             const settings::SerialPort &s = *it;
 
             AssertBreak(s.ulSlot < RT_ELEMENTS(mSerialPorts));
-            rc = mSerialPorts[s.ulSlot]->loadSettings(s);
+            rc = mSerialPorts[s.ulSlot]->i_loadSettings(s);
             if (FAILED(rc)) return rc;
         }
 
@@ -9507,12 +8982,12 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
             const settings::ParallelPort &p = *it;
 
             AssertBreak(p.ulSlot < RT_ELEMENTS(mParallelPorts));
-            rc = mParallelPorts[p.ulSlot]->loadSettings(p);
+            rc = mParallelPorts[p.ulSlot]->i_loadSettings(p);
             if (FAILED(rc)) return rc;
         }
 
         /* AudioAdapter */
-        rc = mAudioAdapter->loadSettings(data.audioAdapter);
+        rc = mAudioAdapter->i_loadSettings(data.audioAdapter);
         if (FAILED(rc)) return rc;
 
         /* Shared folders */
@@ -9524,7 +8999,7 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
 
             ComObjPtr<SharedFolder> sharedFolder;
             /* Check for double entries. Not allowed! */
-            rc = findSharedFolder(sf.strName, sharedFolder, false /* aSetError */);
+            rc = i_findSharedFolder(sf.strName, sharedFolder, false /* aSetError */);
             if (SUCCEEDED(rc))
                 return setError(VBOX_E_OBJECT_IN_USE,
                                 tr("Shared folder named '%s' already exists"),
@@ -9533,7 +9008,7 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
             /* Create the new shared folder. Don't break on error. This will be
              * reported when the machine starts. */
             sharedFolder.createObject();
-            rc = sharedFolder->init(getMachine(),
+            rc = sharedFolder->init(i_getMachine(),
                                     sf.strName,
                                     sf.strHostPath,
                                     RT_BOOL(sf.fWritable),
@@ -9547,7 +9022,7 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
         mHWData->mClipboardMode = data.clipboardMode;
 
         // drag'n'drop
-        mHWData->mDragAndDropMode = data.dragAndDropMode;
+        mHWData->mDnDMode = data.dndMode;
 
         // guest settings
         mHWData->mMemoryBalloonSize = data.ulMemoryBalloonSize;
@@ -9565,7 +9040,7 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
             ComObjPtr<PCIDeviceAttachment> pda;
 
             pda.createObject();
-            pda->loadSettings(this, hpda);
+            pda->i_loadSettings(this, hpda);
             mHWData->mPCIDeviceAssignments.push_back(pda);
         }
 
@@ -9576,21 +9051,42 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
 
 #ifdef VBOX_WITH_GUEST_PROPS
         /* Guest properties (optional) */
-        for (settings::GuestPropertiesList::const_iterator it = data.llGuestProperties.begin();
-            it != data.llGuestProperties.end();
-            ++it)
+
+        /* Only load transient guest properties for configs which have saved
+         * state, because there shouldn't be any for powered off VMs. The same
+         * logic applies for snapshots, as offline snapshots shouldn't have
+         * any such properties. They confuse the code in various places.
+         * Note: can't rely on the machine state, as it isn't set yet. */
+        bool fSkipTransientGuestProperties = mSSData->strStateFilePath.isEmpty();
+        /* apologies for the hacky unconst() usage, but this needs hacking
+         * actually inconsistent settings into consistency, otherwise there
+         * will be some corner cases where the inconsistency survives
+         * surprisingly long without getting fixed, especially for snapshots
+         * as there are no config changes. */
+        settings::GuestPropertiesList &llGuestProperties = unconst(data.llGuestProperties);
+        for (settings::GuestPropertiesList::iterator it = llGuestProperties.begin();
+            it != llGuestProperties.end();
+            /*nothing*/)
         {
             const settings::GuestProperty &prop = *it;
             uint32_t fFlags = guestProp::NILFLAG;
             guestProp::validateFlags(prop.strFlags.c_str(), &fFlags);
+            if (   fSkipTransientGuestProperties
+                && (   fFlags & guestProp::TRANSIENT
+                    || fFlags & guestProp::TRANSRESET))
+            {
+                it = llGuestProperties.erase(it);
+                continue;
+            }
             HWData::GuestProperty property = { prop.strValue, (LONG64) prop.timestamp, fFlags };
             mHWData->mGuestProperties[prop.strName] = property;
+            ++it;
         }
 
         mHWData->mGuestPropertyNotificationPatterns = data.strNotificationPatterns;
 #endif /* VBOX_WITH_GUEST_PROPS defined */
 
-        rc = loadDebugging(pDbg);
+        rc = i_loadDebugging(pDbg);
         if (FAILED(rc))
             return rc;
 
@@ -9614,7 +9110,7 @@ HRESULT Machine::loadHardware(const settings::Hardware &data, const settings::De
  *
  * @param   pDbg        Pointer to the settings.
  */
-HRESULT Machine::loadDebugging(const settings::Debugging *pDbg)
+HRESULT Machine::i_loadDebugging(const settings::Debugging *pDbg)
 {
     mHWData->mDebugging = *pDbg;
     /* no more processing currently required, this will probably change. */
@@ -9622,18 +9118,18 @@ HRESULT Machine::loadDebugging(const settings::Debugging *pDbg)
 }
 
 /**
- *  Called from loadMachineDataFromSettings() for the storage controller data, including media.
+ *  Called from i_loadMachineDataFromSettings() for the storage controller data, including media.
  *
  * @param data
- * @param puuidRegistry media registry ID to set media to or NULL; see Machine::loadMachineDataFromSettings()
+ * @param puuidRegistry media registry ID to set media to or NULL; see Machine::i_loadMachineDataFromSettings()
  * @param puuidSnapshot
  * @return
  */
-HRESULT Machine::loadStorageControllers(const settings::Storage &data,
-                                        const Guid *puuidRegistry,
-                                        const Guid *puuidSnapshot)
+HRESULT Machine::i_loadStorageControllers(const settings::Storage &data,
+                                          const Guid *puuidRegistry,
+                                          const Guid *puuidSnapshot)
 {
-    AssertReturn(!isSessionMachine(), E_FAIL);
+    AssertReturn(!i_isSessionMachine(), E_FAIL);
 
     HRESULT rc = S_OK;
 
@@ -9645,7 +9141,7 @@ HRESULT Machine::loadStorageControllers(const settings::Storage &data,
 
         ComObjPtr<StorageController> pCtl;
         /* Try to find one with the name first. */
-        rc = getStorageControllerByName(ctlData.strName, pCtl, false /* aSetError */);
+        rc = i_getStorageControllerByName(ctlData.strName, pCtl, false /* aSetError */);
         if (SUCCEEDED(rc))
             return setError(VBOX_E_OBJECT_IN_USE,
                             tr("Storage controller named '%s' already exists"),
@@ -9673,19 +9169,19 @@ HRESULT Machine::loadStorageControllers(const settings::Storage &data,
         /* Set IDE emulation settings (only for AHCI controller). */
         if (ctlData.controllerType == StorageControllerType_IntelAhci)
         {
-            if (    (FAILED(rc = pCtl->setIDEEmulationPort(0, ctlData.lIDE0MasterEmulationPort)))
-                 || (FAILED(rc = pCtl->setIDEEmulationPort(1, ctlData.lIDE0SlaveEmulationPort)))
-                 || (FAILED(rc = pCtl->setIDEEmulationPort(2, ctlData.lIDE1MasterEmulationPort)))
-                 || (FAILED(rc = pCtl->setIDEEmulationPort(3, ctlData.lIDE1SlaveEmulationPort)))
+            if (    (FAILED(rc = pCtl->i_setIDEEmulationPort(0, ctlData.lIDE0MasterEmulationPort)))
+                 || (FAILED(rc = pCtl->i_setIDEEmulationPort(1, ctlData.lIDE0SlaveEmulationPort)))
+                 || (FAILED(rc = pCtl->i_setIDEEmulationPort(2, ctlData.lIDE1MasterEmulationPort)))
+                 || (FAILED(rc = pCtl->i_setIDEEmulationPort(3, ctlData.lIDE1SlaveEmulationPort)))
                )
                 return rc;
         }
 
         /* Load the attached devices now. */
-        rc = loadStorageDevices(pCtl,
-                                ctlData,
-                                puuidRegistry,
-                                puuidSnapshot);
+        rc = i_loadStorageDevices(pCtl,
+                                  ctlData,
+                                  puuidRegistry,
+                                  puuidSnapshot);
         if (FAILED(rc)) return rc;
     }
 
@@ -9693,18 +9189,18 @@ HRESULT Machine::loadStorageControllers(const settings::Storage &data,
 }
 
 /**
- * Called from loadStorageControllers for a controller's devices.
+ * Called from i_loadStorageControllers for a controller's devices.
  *
  * @param aStorageController
  * @param data
- * @param puuidRegistry media registry ID to set media to or NULL; see Machine::loadMachineDataFromSettings()
+ * @param puuidRegistry media registry ID to set media to or NULL; see Machine::i_loadMachineDataFromSettings()
  * @param aSnapshotId  pointer to the snapshot ID if this is a snapshot machine
  * @return
  */
-HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
-                                    const settings::StorageController &data,
-                                    const Guid *puuidRegistry,
-                                    const Guid *puuidSnapshot)
+HRESULT Machine::i_loadStorageDevices(StorageController *aStorageController,
+                                      const settings::StorageController &data,
+                                      const Guid *puuidRegistry,
+                                      const Guid *puuidSnapshot)
 {
     HRESULT rc = S_OK;
 
@@ -9729,7 +9225,7 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
             {
                 return setError(E_FAIL,
                                 tr("Duplicate attachments for storage controller '%s', port %d, device %d of the virtual machine '%s'"),
-                                aStorageController->getName().c_str(),
+                                aStorageController->i_getName().c_str(),
                                 ad.lPort,
                                 ad.lDevice,
                                 mUserData->s.strName.c_str());
@@ -9749,25 +9245,27 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
             case DeviceType_Floppy:
             case DeviceType_DVD:
                 if (dev.strHostDriveSrc.isNotEmpty())
-                    rc = mParent->host()->findHostDriveByName(dev.deviceType, dev.strHostDriveSrc, false /* fRefresh */, medium);
+                    rc = mParent->i_host()->i_findHostDriveByName(dev.deviceType, dev.strHostDriveSrc,
+                                                                  false /* fRefresh */, medium);
                 else
-                    rc = mParent->findRemoveableMedium(dev.deviceType,
-                                                       dev.uuid,
-                                                       false /* fRefresh */,
-                                                       false /* aSetError */,
-                                                       medium);
+                    rc = mParent->i_findRemoveableMedium(dev.deviceType,
+                                                         dev.uuid,
+                                                         false /* fRefresh */,
+                                                         false /* aSetError */,
+                                                         medium);
                 if (rc == VBOX_E_OBJECT_NOT_FOUND)
-                    // This is not an error. The host drive or UUID might have vanished, so just go ahead without this removeable medium attachment
+                    // This is not an error. The host drive or UUID might have vanished, so just go
+                    // ahead without this removeable medium attachment
                     rc = S_OK;
             break;
 
             case DeviceType_HardDisk:
             {
                 /* find a hard disk by UUID */
-                rc = mParent->findHardDiskById(dev.uuid, true /* aDoSetError */, &medium);
+                rc = mParent->i_findHardDiskById(dev.uuid, true /* aDoSetError */, &medium);
                 if (FAILED(rc))
                 {
-                    if (isSnapshotMachine())
+                    if (i_isSnapshotMachine())
                     {
                         // wrap another error message around the "cannot find hard disk" set by findHardDisk
                         // so the user knows that the bad disk is in a snapshot somewhere
@@ -9783,13 +9281,13 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
 
                 AutoWriteLock hdLock(medium COMMA_LOCKVAL_SRC_POS);
 
-                if (medium->getType() == MediumType_Immutable)
+                if (medium->i_getType() == MediumType_Immutable)
                 {
-                    if (isSnapshotMachine())
+                    if (i_isSnapshotMachine())
                         return setError(E_FAIL,
                                         tr("Immutable hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} "
                                            "of the virtual machine '%s' ('%s')"),
-                                        medium->getLocationFull().c_str(),
+                                        medium->i_getLocationFull().c_str(),
                                         dev.uuid.raw(),
                                         puuidSnapshot->raw(),
                                         mUserData->s.strName.c_str(),
@@ -9797,19 +9295,19 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
 
                     return setError(E_FAIL,
                                     tr("Immutable hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%s' ('%s')"),
-                                    medium->getLocationFull().c_str(),
+                                    medium->i_getLocationFull().c_str(),
                                     dev.uuid.raw(),
                                     mUserData->s.strName.c_str(),
                                     mData->m_strConfigFileFull.c_str());
                 }
 
-                if (medium->getType() == MediumType_MultiAttach)
+                if (medium->i_getType() == MediumType_MultiAttach)
                 {
-                    if (isSnapshotMachine())
+                    if (i_isSnapshotMachine())
                         return setError(E_FAIL,
                                         tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} "
                                            "of the virtual machine '%s' ('%s')"),
-                                        medium->getLocationFull().c_str(),
+                                        medium->i_getLocationFull().c_str(),
                                         dev.uuid.raw(),
                                         puuidSnapshot->raw(),
                                         mUserData->s.strName.c_str(),
@@ -9817,29 +9315,29 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
 
                     return setError(E_FAIL,
                                     tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%s' ('%s')"),
-                                    medium->getLocationFull().c_str(),
+                                    medium->i_getLocationFull().c_str(),
                                     dev.uuid.raw(),
                                     mUserData->s.strName.c_str(),
                                     mData->m_strConfigFileFull.c_str());
                 }
 
-                if (    !isSnapshotMachine()
-                     && medium->getChildren().size() != 0
+                if (    !i_isSnapshotMachine()
+                     && medium->i_getChildren().size() != 0
                    )
                     return setError(E_FAIL,
                                     tr("Hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%s' ('%s') "
                                        "because it has %d differencing child hard disks"),
-                                    medium->getLocationFull().c_str(),
+                                    medium->i_getLocationFull().c_str(),
                                     dev.uuid.raw(),
                                     mUserData->s.strName.c_str(),
                                     mData->m_strConfigFileFull.c_str(),
-                                    medium->getChildren().size());
+                                    medium->i_getChildren().size());
 
-                if (findAttachment(mMediaData->mAttachments,
-                                   medium))
+                if (i_findAttachment(mMediaData->mAttachments,
+                                     medium))
                     return setError(E_FAIL,
                                     tr("Hard disk '%s' with UUID {%RTuuid} is already attached to the virtual machine '%s' ('%s')"),
-                                    medium->getLocationFull().c_str(),
+                                    medium->i_getLocationFull().c_str(),
                                     dev.uuid.raw(),
                                     mUserData->s.strName.c_str(),
                                     mData->m_strConfigFileFull.c_str());
@@ -9850,7 +9348,7 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
             default:
                 return setError(E_FAIL,
                                 tr("Device '%s' with unknown type is attached to the virtual machine '%s' ('%s')"),
-                                medium->getLocationFull().c_str(),
+                                medium->i_getLocationFull().c_str(),
                                 mUserData->s.strName.c_str(),
                                 mData->m_strConfigFileFull.c_str());
         }
@@ -9863,18 +9361,18 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
 
         if (!dev.strBwGroup.isEmpty())
         {
-            rc = mBandwidthControl->getBandwidthGroupByName(dev.strBwGroup, pBwGroup, false /* aSetError */);
+            rc = mBandwidthControl->i_getBandwidthGroupByName(dev.strBwGroup, pBwGroup, false /* aSetError */);
             if (FAILED(rc))
                 return setError(E_FAIL,
                                 tr("Device '%s' with unknown bandwidth group '%s' is attached to the virtual machine '%s' ('%s')"),
-                                medium->getLocationFull().c_str(),
+                                medium->i_getLocationFull().c_str(),
                                 dev.strBwGroup.c_str(),
                                 mUserData->s.strName.c_str(),
                                 mData->m_strConfigFileFull.c_str());
-            pBwGroup->reference();
+            pBwGroup->i_reference();
         }
 
-        const Bstr controllerName = aStorageController->getName();
+        const Bstr controllerName = aStorageController->i_getName();
         ComObjPtr<MediumAttachment> pAttachment;
         pAttachment.createObject();
         rc = pAttachment->init(this,
@@ -9888,9 +9386,8 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
                                dev.fTempEject,
                                dev.fNonRotational,
                                dev.fDiscard,
-        /// @todo load setting once the hot-pluggable flag works
-                               false /*dev.fHotPluggable*/,
-                               pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->getName());
+                               dev.fHotPluggable,
+                               pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->i_getName());
         if (FAILED(rc)) break;
 
         /* associate the medium with this machine and snapshot */
@@ -9900,16 +9397,16 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
             if (FAILED(medCaller.rc())) return medCaller.rc();
             AutoWriteLock mlock(medium COMMA_LOCKVAL_SRC_POS);
 
-            if (isSnapshotMachine())
-                rc = medium->addBackReference(mData->mUuid, *puuidSnapshot);
+            if (i_isSnapshotMachine())
+                rc = medium->i_addBackReference(mData->mUuid, *puuidSnapshot);
             else
-                rc = medium->addBackReference(mData->mUuid);
+                rc = medium->i_addBackReference(mData->mUuid);
             /* If the medium->addBackReference fails it sets an appropriate
              * error message, so no need to do any guesswork here. */
 
             if (puuidRegistry)
                 // caller wants registry ID to be set on all attached media (OVF import case)
-                medium->addRegistry(*puuidRegistry, false /* fRecurse */);
+                medium->i_addRegistry(*puuidRegistry);
         }
 
         if (FAILED(rc))
@@ -9917,7 +9414,7 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
 
         /* back up mMediaData to let registeredInit() properly rollback on failure
          * (= limited accessibility) */
-        setModified(IsModified_Storage);
+        i_setModified(IsModified_Storage);
         mMediaData.backup();
         mMediaData->mAttachments.push_back(pAttachment);
     }
@@ -9932,9 +9429,9 @@ HRESULT Machine::loadStorageDevices(StorageController *aStorageController,
  *  @param aSnapshot    where to return the found snapshot
  *  @param aSetError    true to set extended error info on failure
  */
-HRESULT Machine::findSnapshotById(const Guid &aId,
-                                  ComObjPtr<Snapshot> &aSnapshot,
-                                  bool aSetError /* = false */)
+HRESULT Machine::i_findSnapshotById(const Guid &aId,
+                                    ComObjPtr<Snapshot> &aSnapshot,
+                                    bool aSetError /* = false */)
 {
     AutoReadLock chlock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -9948,7 +9445,7 @@ HRESULT Machine::findSnapshotById(const Guid &aId,
     if (aId.isZero())
         aSnapshot = mData->mFirstSnapshot;
     else
-        aSnapshot = mData->mFirstSnapshot->findChildOrSelf(aId.ref());
+        aSnapshot = mData->mFirstSnapshot->i_findChildOrSelf(aId.ref());
 
     if (!aSnapshot)
     {
@@ -9969,9 +9466,9 @@ HRESULT Machine::findSnapshotById(const Guid &aId,
  *  @param aSnapshot    where to return the found snapshot
  *  @param aSetError    true to set extended error info on failure
  */
-HRESULT Machine::findSnapshotByName(const Utf8Str &strName,
-                                    ComObjPtr<Snapshot> &aSnapshot,
-                                    bool aSetError /* = false */)
+HRESULT Machine::i_findSnapshotByName(const Utf8Str &strName,
+                                      ComObjPtr<Snapshot> &aSnapshot,
+                                      bool aSetError /* = false */)
 {
     AssertReturn(!strName.isEmpty(), E_INVALIDARG);
 
@@ -9985,7 +9482,7 @@ HRESULT Machine::findSnapshotByName(const Utf8Str &strName,
         return VBOX_E_OBJECT_NOT_FOUND;
     }
 
-    aSnapshot = mData->mFirstSnapshot->findChildOrSelf(strName);
+    aSnapshot = mData->mFirstSnapshot->i_findChildOrSelf(strName);
 
     if (!aSnapshot)
     {
@@ -10005,9 +9502,9 @@ HRESULT Machine::findSnapshotByName(const Utf8Str &strName,
  *  @param aStorageController    where to return the found storage controller
  *  @param aSetError             true to set extended error info on failure
  */
-HRESULT Machine::getStorageControllerByName(const Utf8Str &aName,
-                                            ComObjPtr<StorageController> &aStorageController,
-                                            bool aSetError /* = false */)
+HRESULT Machine::i_getStorageControllerByName(const Utf8Str &aName,
+                                              ComObjPtr<StorageController> &aStorageController,
+                                              bool aSetError /* = false */)
 {
     AssertReturn(!aName.isEmpty(), E_INVALIDARG);
 
@@ -10015,7 +9512,7 @@ HRESULT Machine::getStorageControllerByName(const Utf8Str &aName,
          it != mStorageControllers->end();
          ++it)
     {
-        if ((*it)->getName() == aName)
+        if ((*it)->i_getName() == aName)
         {
             aStorageController = (*it);
             return S_OK;
@@ -10036,9 +9533,9 @@ HRESULT Machine::getStorageControllerByName(const Utf8Str &aName,
  *  @param aUSBController        where to return the found USB controller
  *  @param aSetError             true to set extended error info on failure
  */
-HRESULT Machine::getUSBControllerByName(const Utf8Str &aName,
-                                        ComObjPtr<USBController> &aUSBController,
-                                        bool aSetError /* = false */)
+HRESULT Machine::i_getUSBControllerByName(const Utf8Str &aName,
+                                          ComObjPtr<USBController> &aUSBController,
+                                          bool aSetError /* = false */)
 {
     AssertReturn(!aName.isEmpty(), E_INVALIDARG);
 
@@ -10046,7 +9543,7 @@ HRESULT Machine::getUSBControllerByName(const Utf8Str &aName,
          it != mUSBControllers->end();
          ++it)
     {
-        if ((*it)->getName() == aName)
+        if ((*it)->i_getName() == aName)
         {
             aUSBController = (*it);
             return S_OK;
@@ -10065,7 +9562,7 @@ HRESULT Machine::getUSBControllerByName(const Utf8Str &aName,
  *
  * @param enmType                USB controller type.
  */
-ULONG Machine::getUSBControllerCountByType(USBControllerType_T enmType)
+ULONG Machine::i_getUSBControllerCountByType(USBControllerType_T enmType)
 {
     ULONG cCtrls = 0;
 
@@ -10073,15 +9570,15 @@ ULONG Machine::getUSBControllerCountByType(USBControllerType_T enmType)
          it != mUSBControllers->end();
          ++it)
     {
-        if ((*it)->getControllerType() == enmType)
+        if ((*it)->i_getControllerType() == enmType)
             cCtrls++;
     }
 
     return cCtrls;
 }
 
-HRESULT Machine::getMediumAttachmentsOfController(CBSTR aName,
-                                                  MediaData::AttachmentList &atts)
+HRESULT Machine::i_getMediumAttachmentsOfController(const Utf8Str &aName,
+                                                    MediaData::AttachmentList &atts)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -10093,7 +9590,6 @@ HRESULT Machine::getMediumAttachmentsOfController(CBSTR aName,
          ++it)
     {
         const ComObjPtr<MediumAttachment> &pAtt = *it;
-
         // should never happen, but deal with NULL pointers in the list.
         AssertStmt(!pAtt.isNull(), continue);
 
@@ -10106,21 +9602,22 @@ HRESULT Machine::getMediumAttachmentsOfController(CBSTR aName,
         }
         AutoReadLock attLock(pAtt COMMA_LOCKVAL_SRC_POS);
 
-        if (pAtt->getControllerName() == aName)
+        if (pAtt->i_getControllerName() == Bstr(aName).raw())
             atts.push_back(pAtt);
     }
 
     return S_OK;
 }
 
+
 /**
- *  Helper for #saveSettings. Cares about renaming the settings directory and
+ *  Helper for #i_saveSettings. Cares about renaming the settings directory and
  *  file if the machine name was changed and about creating a new settings file
  *  if this is a new machine.
  *
  *  @note Must be never called directly but only from #saveSettings().
  */
-HRESULT Machine::prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)
+HRESULT Machine::i_prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)
 {
     AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
 
@@ -10174,7 +9671,8 @@ HRESULT Machine::prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)
             configDir.stripFilename();
             newConfigDir = configDir;
             if (   configDir.length() >= groupPlusName.length()
-                && !RTPathCompare(configDir.substr(configDir.length() - groupPlusName.length(), groupPlusName.length()).c_str(), groupPlusName.c_str()))
+                && !RTPathCompare(configDir.substr(configDir.length() - groupPlusName.length(), groupPlusName.length()).c_str(),
+                                  groupPlusName.c_str()))
             {
                 newConfigDir = newConfigDir.substr(0, configDir.length() - groupPlusName.length());
                 Utf8Str newConfigBaseDir(newConfigDir);
@@ -10256,14 +9754,14 @@ HRESULT Machine::prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)
             // update m_strConfigFileFull amd mConfigFile
             mData->m_strConfigFileFull = newConfigFile;
             // compute the relative path too
-            mParent->copyPathRelativeToConfig(newConfigFile, mData->m_strConfigFile);
+            mParent->i_copyPathRelativeToConfig(newConfigFile, mData->m_strConfigFile);
 
-            // store the old and new so that VirtualBox::saveSettings() can update
+            // store the old and new so that VirtualBox::i_saveSettings() can update
             // the media registry
             if (    mData->mRegistered
                  && (configDir != newConfigDir || configFile != newConfigFile))
             {
-                mParent->rememberMachineNameChangeForMedia(configDir, newConfigDir);
+                mParent->i_rememberMachineNameChangeForMedia(configDir, newConfigDir);
 
                 if (pfNeedsGlobalSaveSettings)
                     *pfNeedsGlobalSaveSettings = true;
@@ -10275,8 +9773,8 @@ HRESULT Machine::prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)
 
             // and do the same thing for the saved state file paths of all the online snapshots
             if (mData->mFirstSnapshot)
-                mData->mFirstSnapshot->updateSavedStatePaths(configDir.c_str(),
-                                                             newConfigDir.c_str());
+                mData->mFirstSnapshot->i_updateSavedStatePaths(configDir.c_str(),
+                                                               newConfigDir.c_str());
         }
         while (0);
 
@@ -10353,13 +9851,13 @@ HRESULT Machine::prepareSaveSettings(bool *pfNeedsGlobalSaveSettings)
  *
  * @param pfNeedsGlobalSaveSettings Optional pointer to a bool that must have been
  *          initialized to false and that will be set to true by this function if
- *          the caller must invoke VirtualBox::saveSettings() because the global
+ *          the caller must invoke VirtualBox::i_saveSettings() because the global
  *          settings have changed. This will happen if a machine rename has been
  *          saved and the global machine and media registries will therefore need
  *          updating.
  */
-HRESULT Machine::saveSettings(bool *pfNeedsGlobalSaveSettings,
-                              int aFlags /*= 0*/)
+HRESULT Machine::i_saveSettings(bool *pfNeedsGlobalSaveSettings,
+                                int  aFlags /*= 0*/)
 {
     LogFlowThisFuncEnter();
 
@@ -10367,9 +9865,9 @@ HRESULT Machine::saveSettings(bool *pfNeedsGlobalSaveSettings,
 
     /* make sure child objects are unable to modify the settings while we are
      * saving them */
-    ensureNoStateDependencies();
+    i_ensureNoStateDependencies();
 
-    AssertReturn(!isSnapshotMachine(),
+    AssertReturn(!i_isSnapshotMachine(),
                  E_FAIL);
 
     HRESULT rc = S_OK;
@@ -10378,7 +9876,7 @@ HRESULT Machine::saveSettings(bool *pfNeedsGlobalSaveSettings,
     /* First, prepare to save settings. It will care about renaming the
      * settings directory and file if the machine name was changed and about
      * creating a new settings file if this is a new machine. */
-    rc = prepareSaveSettings(pfNeedsGlobalSaveSettings);
+    rc = i_prepareSaveSettings(pfNeedsGlobalSaveSettings);
     if (FAILED(rc)) return rc;
 
     // keep a pointer to the current settings structures
@@ -10392,8 +9890,8 @@ HRESULT Machine::saveSettings(bool *pfNeedsGlobalSaveSettings,
         pNewConfig->copyBaseFrom(*mData->pMachineConfigFile);
 
         // now go and copy all the settings data from COM to the settings structures
-        // (this calles saveSettings() on all the COM objects in the machine)
-        copyMachineDataToSettings(*pNewConfig);
+        // (this calles i_saveSettings() on all the COM objects in the machine)
+        i_copyMachineDataToSettings(*pNewConfig);
 
         if (aFlags & SaveS_ResetCurStateModified)
         {
@@ -10432,7 +9930,7 @@ HRESULT Machine::saveSettings(bool *pfNeedsGlobalSaveSettings,
 
         mData->pMachineConfigFile = pNewConfig;
         delete pOldConfig;
-        commit();
+        i_commit();
 
         // after saving settings, we are no longer different from the XML on disk
         mData->flModifications = 0;
@@ -10458,8 +9956,8 @@ HRESULT Machine::saveSettings(bool *pfNeedsGlobalSaveSettings,
          * mutable Machine instances are always not registered (i.e. private
          * to the client process that creates them) and thus don't need to
          * inform callbacks. */
-        if (isSessionMachine())
-            mParent->onMachineDataChange(mData->mUuid);
+        if (i_isSessionMachine())
+            mParent->i_onMachineDataChange(mData->mUuid);
     }
 
     LogFlowThisFunc(("rc=%08X\n", rc));
@@ -10474,7 +9972,7 @@ HRESULT Machine::saveSettings(bool *pfNeedsGlobalSaveSettings,
  *
  * This gets called from two locations:
  *
- *  --  Machine::saveSettings(), during the regular XML writing;
+ *  --  Machine::i_saveSettings(), during the regular XML writing;
  *
  *  --  Appliance::buildXMLForOneVirtualSystem(), when a machine gets
  *      exported to OVF and we write the VirtualBox proprietary XML
@@ -10492,7 +9990,7 @@ HRESULT Machine::saveSettings(bool *pfNeedsGlobalSaveSettings,
  *
  * This throws XML errors and HRESULT, so the caller must have a catch block!
  */
-void Machine::copyMachineDataToSettings(settings::MachineConfigFile &config)
+void Machine::i_copyMachineDataToSettings(settings::MachineConfigFile &config)
 {
     // deep copy extradata
     config.mapExtraDataItems = mData->pMachineConfigFile->mapExtraDataItems;
@@ -10503,15 +10001,15 @@ void Machine::copyMachineDataToSettings(settings::MachineConfigFile &config)
     config.machineUserData = mUserData->s;
 
     // Encode the Icon Override data from Machine and store on config userdata.
-    com::SafeArray<BYTE> iconByte;
-    COMGETTER(Icon)(ComSafeArrayAsOutParam(iconByte));
+    std::vector<BYTE> iconByte;
+    getIcon(iconByte);
     ssize_t cbData = iconByte.size();
     if (cbData > 0)
     {
         ssize_t cchOut = RTBase64EncodedLength(cbData);
         Utf8Str strIconData;
         strIconData.reserve(cchOut+1);
-        int vrc = RTBase64Encode(iconByte.raw(), cbData,
+        int vrc = RTBase64Encode(&iconByte.front(), cbData,
                                  strIconData.mutableRaw(), strIconData.capacity(),
                                  NULL);
         if (RT_FAILURE(vrc))
@@ -10524,18 +10022,18 @@ void Machine::copyMachineDataToSettings(settings::MachineConfigFile &config)
 
     if (    mData->mMachineState == MachineState_Saved
          || mData->mMachineState == MachineState_Restoring
-            // when deleting a snapshot we may or may not have a saved state in the current state,
-            // so let's not assert here please
-         || (    (   mData->mMachineState == MachineState_DeletingSnapshot
-                  || mData->mMachineState == MachineState_DeletingSnapshotOnline
-                  || mData->mMachineState == MachineState_DeletingSnapshotPaused)
+            // when doing certain snapshot operations we may or may not have
+            // a saved state in the current state, so keep everything as is
+         || (    (   mData->mMachineState == MachineState_Snapshotting
+                  || mData->mMachineState == MachineState_DeletingSnapshot
+                  || mData->mMachineState == MachineState_RestoringSnapshot)
               && (!mSSData->strStateFilePath.isEmpty())
             )
         )
     {
         Assert(!mSSData->strStateFilePath.isEmpty());
         /* try to make the file name relative to the settings file dir */
-        copyPathRelativeToMachine(mSSData->strStateFilePath, config.strStateFile);
+        i_copyPathRelativeToMachine(mSSData->strStateFilePath, config.strStateFile);
     }
     else
     {
@@ -10544,7 +10042,7 @@ void Machine::copyMachineDataToSettings(settings::MachineConfigFile &config)
     }
 
     if (mData->mCurrentSnapshot)
-        config.uuidCurrentSnapshot = mData->mCurrentSnapshot->getId();
+        config.uuidCurrentSnapshot = mData->mCurrentSnapshot->i_getId();
     else
         config.uuidCurrentSnapshot.clear();
 
@@ -10552,26 +10050,26 @@ void Machine::copyMachineDataToSettings(settings::MachineConfigFile &config)
     config.fAborted = (mData->mMachineState == MachineState_Aborted);
     /// @todo Live Migration:        config.fTeleported = (mData->mMachineState == MachineState_Teleported);
 
-    HRESULT rc = saveHardware(config.hardwareMachine, &config.debugging, &config.autostart);
+    HRESULT rc = i_saveHardware(config.hardwareMachine, &config.debugging, &config.autostart);
     if (FAILED(rc)) throw rc;
 
-    rc = saveStorageControllers(config.storageMachine);
+    rc = i_saveStorageControllers(config.storageMachine);
     if (FAILED(rc)) throw rc;
 
     // save machine's media registry if this is VirtualBox 4.0 or later
     if (config.canHaveOwnMediaRegistry())
     {
         // determine machine folder
-        Utf8Str strMachineFolder = getSettingsFileFull();
+        Utf8Str strMachineFolder = i_getSettingsFileFull();
         strMachineFolder.stripFilename();
-        mParent->saveMediaRegistry(config.mediaRegistry,
-                                   getId(),             // only media with registry ID == machine UUID
-                                   strMachineFolder);
+        mParent->i_saveMediaRegistry(config.mediaRegistry,
+                                     i_getId(),             // only media with registry ID == machine UUID
+                                     strMachineFolder);
             // this throws HRESULT
     }
 
     // save snapshots
-    rc = saveAllSnapshots(config);
+    rc = i_saveAllSnapshots(config);
     if (FAILED(rc)) throw rc;
 }
 
@@ -10581,7 +10079,7 @@ void Machine::copyMachineDataToSettings(settings::MachineConfigFile &config)
  * @param config
  * @return
  */
-HRESULT Machine::saveAllSnapshots(settings::MachineConfigFile &config)
+HRESULT Machine::i_saveAllSnapshots(settings::MachineConfigFile &config)
 {
     AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
 
@@ -10593,14 +10091,12 @@ HRESULT Machine::saveAllSnapshots(settings::MachineConfigFile &config)
 
         if (mData->mFirstSnapshot)
         {
-            settings::Snapshot snapNew;
-            config.llFirstSnapshot.push_back(snapNew);
+            // the settings use a list for "the first snapshot"
+            config.llFirstSnapshot.push_back(settings::g_SnapshotEmpty);
 
-            // get reference to the fresh copy of the snapshot on the list and
-            // work on that copy directly to avoid excessive copying later
-            settings::Snapshot &snap = config.llFirstSnapshot.front();
-
-            rc = mData->mFirstSnapshot->saveSnapshot(snap, false /*aAttrsOnly*/);
+            // get reference to the snapshot on the list and work on that
+            // element straight in the list to avoid excessive copying later
+            rc = mData->mFirstSnapshot->i_saveSnapshot(config.llFirstSnapshot.back());
             if (FAILED(rc)) throw rc;
         }
 
@@ -10631,8 +10127,8 @@ HRESULT Machine::saveAllSnapshots(settings::MachineConfigFile &config)
  *  @param pAutostart     Pointer to the settings object for the autostart config
  *                        which happens to live in mHWData.
  */
-HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDbg,
-                              settings::Autostart *pAutostart)
+HRESULT Machine::i_saveHardware(settings::Hardware &data, settings::Debugging *pDbg,
+                                settings::Autostart *pAutostart)
 {
     HRESULT rc = S_OK;
 
@@ -10643,7 +10139,8 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
         if (    mHWData->mHWVersion == "1"
              && mSSData->strStateFilePath.isEmpty()
            )
-            mHWData->mHWVersion = "2";  /** @todo Is this safe, to update mHWVersion here? If not some other point needs to be found where this can be done. */
+            mHWData->mHWVersion = "2";  /** @todo Is this safe, to update mHWVersion here? If not some
+                                            other point needs to be found where this can be done. */
 
         data.strVersion = mHWData->mHWVersion;
         data.uuid = mHWData->mHardwareUUID;
@@ -10657,30 +10154,16 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
         data.fHardwareVirtForce     = !!mHWData->mHWVirtExForceEnabled;
         data.fPAE                   = !!mHWData->mPAEEnabled;
         data.enmLongMode            = mHWData->mLongMode;
-        data.fSyntheticCpu          = !!mHWData->mSyntheticCpu;
         data.fTripleFaultReset      = !!mHWData->mTripleFaultReset;
-
-        /* Standard and Extended CPUID leafs. */
-        data.llCpuIdLeafs.clear();
-        for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); idx++)
-        {
-            if (mHWData->mCpuIdStdLeafs[idx].ulId != UINT32_MAX)
-                data.llCpuIdLeafs.push_back(mHWData->mCpuIdStdLeafs[idx]);
-        }
-        for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); idx++)
-        {
-            if (mHWData->mCpuIdExtLeafs[idx].ulId != UINT32_MAX)
-                data.llCpuIdLeafs.push_back(mHWData->mCpuIdExtLeafs[idx]);
-        }
-
-        data.cCPUs             = mHWData->mCPUCount;
-        data.fCpuHotPlug       = !!mHWData->mCPUHotPlugEnabled;
-        data.ulCpuExecutionCap = mHWData->mCpuExecutionCap;
+        data.cCPUs                  = mHWData->mCPUCount;
+        data.fCpuHotPlug            = !!mHWData->mCPUHotPlugEnabled;
+        data.ulCpuExecutionCap      = mHWData->mCpuExecutionCap;
+        data.uCpuIdPortabilityLevel = mHWData->mCpuIdPortabilityLevel;
 
         data.llCpus.clear();
         if (data.fCpuHotPlug)
         {
-            for (unsigned idx = 0; idx < data.cCPUs; idx++)
+            for (unsigned idx = 0; idx < data.cCPUs; ++idx)
             {
                 if (mHWData->mCPUAttached[idx])
                 {
@@ -10691,6 +10174,15 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
             }
         }
 
+        /* Standard and Extended CPUID leafs. */
+        data.llCpuIdLeafs.clear();
+        for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdStdLeafs); ++idx)
+            if (mHWData->mCpuIdStdLeafs[idx].ulId != UINT32_MAX)
+                data.llCpuIdLeafs.push_back(mHWData->mCpuIdStdLeafs[idx]);
+        for (unsigned idx = 0; idx < RT_ELEMENTS(mHWData->mCpuIdExtLeafs); ++idx)
+            if (mHWData->mCpuIdExtLeafs[idx].ulId != UINT32_MAX)
+                data.llCpuIdLeafs.push_back(mHWData->mCpuIdExtLeafs[idx]);
+
         // memory
         data.ulMemorySizeMB = mHWData->mMemorySize;
         data.fPageFusionEnabled = !!mHWData->mPageFusionEnabled;
@@ -10705,6 +10197,10 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
         // chipset
         data.chipsetType = mHWData->mChipsetType;
 
+        // paravirt
+        data.paravirtProvider = mHWData->mParavirtProvider;
+
+
         data.fEmulatedUSBCardReader = !!mHWData->mEmulatedUSBCardReaderEnabled;
 
         // HPET
@@ -10712,9 +10208,7 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
 
         // boot order
         data.mapBootOrder.clear();
-        for (size_t i = 0;
-             i < RT_ELEMENTS(mHWData->mBootOrder);
-             ++i)
+        for (unsigned i = 0; i < RT_ELEMENTS(mHWData->mBootOrder); ++i)
             data.mapBootOrder[i] = mHWData->mBootOrder[i];
 
         // display
@@ -10728,7 +10222,7 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
         data.ulVideoCaptureRate = mHWData->mVideoCaptureRate;
         data.ulVideoCaptureFPS = mHWData->mVideoCaptureFPS;
         data.fVideoCaptureEnabled  = !!mHWData->mVideoCaptureEnabled;
-        for (unsigned i = 0; i < sizeof(data.u64VideoCaptureScreens) * 8; i++)
+        for (unsigned i = 0; i < sizeof(data.u64VideoCaptureScreens) * 8; ++i)
         {
             if (mHWData->maVideoCaptureScreens[i])
                 ASMBitSet(&data.u64VideoCaptureScreens, i);
@@ -10736,48 +10230,46 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
                 ASMBitClear(&data.u64VideoCaptureScreens, i);
         }
         /* store relative video capture file if possible */
-        copyPathRelativeToMachine(mHWData->mVideoCaptureFile, data.strVideoCaptureFile);
+        i_copyPathRelativeToMachine(mHWData->mVideoCaptureFile, data.strVideoCaptureFile);
 
         /* VRDEServer settings (optional) */
-        rc = mVRDEServer->saveSettings(data.vrdeSettings);
+        rc = mVRDEServer->i_saveSettings(data.vrdeSettings);
         if (FAILED(rc)) throw rc;
 
         /* BIOS (required) */
-        rc = mBIOSSettings->saveSettings(data.biosSettings);
+        rc = mBIOSSettings->i_saveSettings(data.biosSettings);
         if (FAILED(rc)) throw rc;
 
         /* USB Controller (required) */
-        for (USBControllerList::const_iterator it = mUSBControllers->begin();
-             it != mUSBControllers->end();
-             ++it)
+        for (USBControllerList::const_iterator it = mUSBControllers->begin(); it != mUSBControllers->end(); ++it)
         {
             ComObjPtr<USBController> ctrl = *it;
             settings::USBController settingsCtrl;
 
-            settingsCtrl.strName = ctrl->getName();
-            settingsCtrl.enmType = ctrl->getControllerType();
+            settingsCtrl.strName = ctrl->i_getName();
+            settingsCtrl.enmType = ctrl->i_getControllerType();
 
             data.usbSettings.llUSBControllers.push_back(settingsCtrl);
         }
 
         /* USB device filters (required) */
-        rc = mUSBDeviceFilters->saveSettings(data.usbSettings);
+        rc = mUSBDeviceFilters->i_saveSettings(data.usbSettings);
         if (FAILED(rc)) throw rc;
 
         /* Network adapters (required) */
-        uint32_t uMaxNICs = RT_MIN(Global::getMaxNetworkAdapters(mHWData->mChipsetType), mNetworkAdapters.size());
+        size_t uMaxNICs = RT_MIN(Global::getMaxNetworkAdapters(mHWData->mChipsetType), mNetworkAdapters.size());
         data.llNetworkAdapters.clear();
         /* Write out only the nominal number of network adapters for this
          * chipset type. Since Machine::commit() hasn't been called there
          * may be extra NIC settings in the vector. */
-        for (ULONG slot = 0; slot < uMaxNICs; ++slot)
+        for (size_t slot = 0; slot < uMaxNICs; ++slot)
         {
             settings::NetworkAdapter nic;
-            nic.ulSlot = slot;
+            nic.ulSlot = (uint32_t)slot;
             /* paranoia check... must not be NULL, but must not crash either. */
             if (mNetworkAdapters[slot])
             {
-                rc = mNetworkAdapters[slot]->saveSettings(nic);
+                rc = mNetworkAdapters[slot]->i_saveSettings(nic);
                 if (FAILED(rc)) throw rc;
 
                 data.llNetworkAdapters.push_back(nic);
@@ -10786,13 +10278,11 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
 
         /* Serial ports */
         data.llSerialPorts.clear();
-        for (ULONG slot = 0;
-             slot < RT_ELEMENTS(mSerialPorts);
-             ++slot)
+        for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
         {
             settings::SerialPort s;
             s.ulSlot = slot;
-            rc = mSerialPorts[slot]->saveSettings(s);
+            rc = mSerialPorts[slot]->i_saveSettings(s);
             if (FAILED(rc)) return rc;
 
             data.llSerialPorts.push_back(s);
@@ -10800,20 +10290,18 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
 
         /* Parallel ports */
         data.llParallelPorts.clear();
-        for (ULONG slot = 0;
-             slot < RT_ELEMENTS(mParallelPorts);
-             ++slot)
+        for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
         {
             settings::ParallelPort p;
             p.ulSlot = slot;
-            rc = mParallelPorts[slot]->saveSettings(p);
+            rc = mParallelPorts[slot]->i_saveSettings(p);
             if (FAILED(rc)) return rc;
 
             data.llParallelPorts.push_back(p);
         }
 
         /* Audio adapter */
-        rc = mAudioAdapter->saveSettings(data.audioAdapter);
+        rc = mAudioAdapter->i_saveSettings(data.audioAdapter);
         if (FAILED(rc)) return rc;
 
         /* Shared folders */
@@ -10826,10 +10314,10 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
             AutoCaller sfCaller(pSF);
             AutoReadLock sfLock(pSF COMMA_LOCKVAL_SRC_POS);
             settings::SharedFolder sf;
-            sf.strName = pSF->getName();
-            sf.strHostPath = pSF->getHostPath();
-            sf.fWritable = !!pSF->isWritable();
-            sf.fAutoMount = !!pSF->isAutoMounted();
+            sf.strName = pSF->i_getName();
+            sf.strHostPath = pSF->i_getHostPath();
+            sf.fWritable = !!pSF->i_isWritable();
+            sf.fAutoMount = !!pSF->i_isAutoMounted();
 
             data.llSharedFolders.push_back(sf);
         }
@@ -10838,7 +10326,7 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
         data.clipboardMode = mHWData->mClipboardMode;
 
         // drag'n'drop
-        data.dragAndDropMode = mHWData->mDragAndDropMode;
+        data.dndMode = mHWData->mDnDMode;
 
         /* Guest */
         data.ulMemoryBalloonSize = mHWData->mMemoryBalloonSize;
@@ -10848,7 +10336,7 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
         data.ioSettings.ulIOCacheSize = mHWData->mIOCacheSize;
 
         /* BandwidthControl (required) */
-        rc = mBandwidthControl->saveSettings(data.ioSettings);
+        rc = mBandwidthControl->i_saveSettings(data.ioSettings);
         if (FAILED(rc)) throw rc;
 
         /* Host PCI devices */
@@ -10859,7 +10347,7 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
             ComObjPtr<PCIDeviceAttachment> pda = *it;
             settings::HostPCIDeviceAttachment hpda;
 
-            rc = pda->saveSettings(hpda);
+            rc = pda->i_saveSettings(hpda);
             if (FAILED(rc)) throw rc;
 
             data.pciAttachments.push_back(hpda);
@@ -10876,7 +10364,9 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
             HWData::GuestProperty property = it->second;
 
             /* Remove transient guest properties at shutdown unless we
-             * are saving state */
+             * are saving state. Note that restoring snapshot intentionally
+             * keeps them, they will be removed if appropriate once the final
+             * machine state is set (as crashes etc. need to work). */
             if (   (   mData->mMachineState == MachineState_PoweredOff
                     || mData->mMachineState == MachineState_Aborted
                     || mData->mMachineState == MachineState_Teleported)
@@ -10918,7 +10408,7 @@ HRESULT Machine::saveHardware(settings::Hardware &data, settings::Debugging *pDb
  *
  *  @param aNode    <StorageControllers> node to save the VM hardware configuration to.
  */
-HRESULT Machine::saveStorageControllers(settings::Storage &data)
+HRESULT Machine::i_saveStorageControllers(settings::Storage &data)
 {
     data.llStorageControllers.clear();
 
@@ -10930,11 +10420,11 @@ HRESULT Machine::saveStorageControllers(settings::Storage &data)
         ComObjPtr<StorageController> pCtl = *it;
 
         settings::StorageController ctl;
-        ctl.strName = pCtl->getName();
-        ctl.controllerType = pCtl->getControllerType();
-        ctl.storageBus = pCtl->getStorageBus();
-        ctl.ulInstance = pCtl->getInstance();
-        ctl.fBootable = pCtl->getBootable();
+        ctl.strName = pCtl->i_getName();
+        ctl.controllerType = pCtl->i_getControllerType();
+        ctl.storageBus = pCtl->i_getStorageBus();
+        ctl.ulInstance = pCtl->i_getInstance();
+        ctl.fBootable = pCtl->i_getBootable();
 
         /* Save the port count. */
         ULONG portCount;
@@ -10951,16 +10441,16 @@ HRESULT Machine::saveStorageControllers(settings::Storage &data)
         /* Save IDE emulation settings. */
         if (ctl.controllerType == StorageControllerType_IntelAhci)
         {
-            if (    (FAILED(rc = pCtl->getIDEEmulationPort(0, (LONG*)&ctl.lIDE0MasterEmulationPort)))
-                 || (FAILED(rc = pCtl->getIDEEmulationPort(1, (LONG*)&ctl.lIDE0SlaveEmulationPort)))
-                 || (FAILED(rc = pCtl->getIDEEmulationPort(2, (LONG*)&ctl.lIDE1MasterEmulationPort)))
-                 || (FAILED(rc = pCtl->getIDEEmulationPort(3, (LONG*)&ctl.lIDE1SlaveEmulationPort)))
+            if (    (FAILED(rc = pCtl->i_getIDEEmulationPort(0, (LONG*)&ctl.lIDE0MasterEmulationPort)))
+                 || (FAILED(rc = pCtl->i_getIDEEmulationPort(1, (LONG*)&ctl.lIDE0SlaveEmulationPort)))
+                 || (FAILED(rc = pCtl->i_getIDEEmulationPort(2, (LONG*)&ctl.lIDE1MasterEmulationPort)))
+                 || (FAILED(rc = pCtl->i_getIDEEmulationPort(3, (LONG*)&ctl.lIDE1SlaveEmulationPort)))
                )
                 ComAssertComRCRet(rc, rc);
         }
 
         /* save the devices now. */
-        rc = saveStorageDevices(pCtl, ctl);
+        rc = i_saveStorageDevices(pCtl, ctl);
         ComAssertComRCRet(rc, rc);
 
         data.llStorageControllers.push_back(ctl);
@@ -10972,12 +10462,12 @@ HRESULT Machine::saveStorageControllers(settings::Storage &data)
 /**
  *  Saves the hard disk configuration.
  */
-HRESULT Machine::saveStorageDevices(ComObjPtr<StorageController> aStorageController,
-                                    settings::StorageController &data)
+HRESULT Machine::i_saveStorageDevices(ComObjPtr<StorageController> aStorageController,
+                                      settings::StorageController &data)
 {
     MediaData::AttachmentList atts;
 
-    HRESULT rc = getMediumAttachmentsOfController(Bstr(aStorageController->getName()).raw(), atts);
+    HRESULT rc = i_getMediumAttachmentsOfController(aStorageController->i_getName(), atts);
     if (FAILED(rc)) return rc;
 
     data.llAttachedDevices.clear();
@@ -10986,28 +10476,27 @@ HRESULT Machine::saveStorageDevices(ComObjPtr<StorageController> aStorageControl
          ++it)
     {
         settings::AttachedDevice dev;
-
-        MediumAttachment *pAttach = *it;
-        Medium *pMedium = pAttach->getMedium();
-
-        dev.deviceType = pAttach->getType();
-        dev.lPort = pAttach->getPort();
-        dev.lDevice = pAttach->getDevice();
-        dev.fPassThrough = pAttach->getPassthrough();
-        /// @todo save setting once the hot-pluggable flag works
-        dev.fHotPluggable = false /* pAttach->getHotPluggable()*/;
+        IMediumAttachment *iA = *it;
+        MediumAttachment *pAttach = static_cast<MediumAttachment *>(iA);
+        Medium *pMedium = pAttach->i_getMedium();
+
+        dev.deviceType = pAttach->i_getType();
+        dev.lPort = pAttach->i_getPort();
+        dev.lDevice = pAttach->i_getDevice();
+        dev.fPassThrough = pAttach->i_getPassthrough();
+        dev.fHotPluggable = pAttach->i_getHotPluggable();
         if (pMedium)
         {
-            if (pMedium->isHostDrive())
-                dev.strHostDriveSrc = pMedium->getLocationFull();
+            if (pMedium->i_isHostDrive())
+                dev.strHostDriveSrc = pMedium->i_getLocationFull();
             else
-                dev.uuid = pMedium->getId();
-            dev.fTempEject = pAttach->getTempEject();
-            dev.fNonRotational = pAttach->getNonRotational();
-            dev.fDiscard = pAttach->getDiscard();
+                dev.uuid = pMedium->i_getId();
+            dev.fTempEject = pAttach->i_getTempEject();
+            dev.fNonRotational = pAttach->i_getNonRotational();
+            dev.fDiscard = pAttach->i_getDiscard();
         }
 
-        dev.strBwGroup = pAttach->getBandwidthGroup();
+        dev.strBwGroup = pAttach->i_getBandwidthGroup();
 
         data.llAttachedDevices.push_back(dev);
     }
@@ -11023,7 +10512,7 @@ HRESULT Machine::saveStorageDevices(ComObjPtr<StorageController> aStorageControl
  *
  *  @note Locks objects for writing.
  */
-HRESULT Machine::saveStateSettings(int aFlags)
+HRESULT Machine::i_saveStateSettings(int aFlags)
 {
     if (aFlags == 0)
         return S_OK;
@@ -11048,7 +10537,7 @@ HRESULT Machine::saveStateSettings(int aFlags)
         {
             if (!mSSData->strStateFilePath.isEmpty())
                 /* try to make the file name relative to the settings file dir */
-                copyPathRelativeToMachine(mSSData->strStateFilePath, mData->pMachineConfigFile->strStateFile);
+                i_copyPathRelativeToMachine(mSSData->strStateFilePath, mData->pMachineConfigFile->strStateFile);
             else
                 mData->pMachineConfigFile->strStateFile.setNull();
         }
@@ -11083,16 +10572,16 @@ HRESULT Machine::saveStateSettings(int aFlags)
  *
  * @param pMedium
  */
-void Machine::addMediumToRegistry(ComObjPtr<Medium> &pMedium)
+void Machine::i_addMediumToRegistry(ComObjPtr<Medium> &pMedium)
 {
     /* Paranoia checks: do not hold machine or media tree locks. */
     AssertReturnVoid(!isWriteLockOnCurrentThread());
-    AssertReturnVoid(!mParent->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    AssertReturnVoid(!mParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
     ComObjPtr<Medium> pBase;
     {
-        AutoReadLock treeLock(&mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
-        pBase = pMedium->getBase();
+        AutoReadLock treeLock(&mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        pBase = pMedium->i_getBase();
     }
 
     /* Paranoia checks: do not hold medium locks. */
@@ -11103,19 +10592,24 @@ void Machine::addMediumToRegistry(ComObjPtr<Medium> &pMedium)
     Guid uuid;
     if (mData->pMachineConfigFile->canHaveOwnMediaRegistry())
         // machine XML is VirtualBox 4.0 or higher:
-        uuid = getId();     // machine UUID
+        uuid = i_getId();     // machine UUID
     else
-        uuid = mParent->getGlobalRegistryId(); // VirtualBox global registry UUID
+        uuid = mParent->i_getGlobalRegistryId(); // VirtualBox global registry UUID
 
-    if (pMedium->addRegistry(uuid, false /* fRecurse */))
-        mParent->markRegistryModified(uuid);
+    if (pMedium->i_addRegistry(uuid))
+        mParent->i_markRegistryModified(uuid);
 
     /* For more complex hard disk structures it can happen that the base
      * medium isn't yet associated with any medium registry. Do that now. */
     if (pMedium != pBase)
     {
-        if (pBase->addRegistry(uuid, true /* fRecurse */))
-            mParent->markRegistryModified(uuid);
+        /* Tree lock needed by Medium::addRegistry when recursing. */
+        AutoReadLock treeLock(&mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        if (pBase->i_addRegistryRecursive(uuid))
+        {
+            treeLock.release();
+            mParent->i_markRegistryModified(uuid);
+        }
     }
 }
 
@@ -11150,9 +10644,9 @@ void Machine::addMediumToRegistry(ComObjPtr<Medium> &pMedium)
  *
  * @note Locks this object and the media tree for writing.
  */
-HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
-                                     ULONG aWeight,
-                                     bool aOnline)
+HRESULT Machine::i_createImplicitDiffs(IProgress *aProgress,
+                                       ULONG aWeight,
+                                       bool aOnline)
 {
     LogFlowThisFunc(("aOnline=%d\n", aOnline));
 
@@ -11160,10 +10654,11 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoMultiWriteLock2 alock(this->lockHandle(),
-                              &mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+                              &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     /* must be in a protective state because we release the lock below */
-    AssertReturn(   mData->mMachineState == MachineState_Saving
+    AssertReturn(   mData->mMachineState == MachineState_Snapshotting
+                 || mData->mMachineState == MachineState_OnlineSnapshotting
                  || mData->mMachineState == MachineState_LiveSnapshotting
                  || mData->mMachineState == MachineState_RestoringSnapshot
                  || mData->mMachineState == MachineState_DeletingSnapshot
@@ -11190,17 +10685,18 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
                  ++it)
             {
                 MediumAttachment* pAtt = *it;
-                if (pAtt->getType() == DeviceType_HardDisk)
+                if (pAtt->i_getType() == DeviceType_HardDisk)
                 {
-                    Medium* pMedium = pAtt->getMedium();
+                    Medium* pMedium = pAtt->i_getMedium();
                     Assert(pMedium);
 
                     MediumLockList *pMediumLockList(new MediumLockList());
                     alock.release();
-                    rc = pMedium->createMediumLockList(true /* fFailIfInaccessible */,
-                                                       false /* fMediumLockWrite */,
-                                                       NULL,
-                                                       *pMediumLockList);
+                    rc = pMedium->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                                         false /* fMediumLockWrite */,
+                                                         false /* fMediumLockWriteAll */,
+                                                         NULL,
+                                                         *pMediumLockList);
                     alock.acquire();
                     if (FAILED(rc))
                     {
@@ -11242,16 +10738,16 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
         {
             MediumAttachment* pAtt = *it;
 
-            DeviceType_T devType = pAtt->getType();
-            Medium* pMedium = pAtt->getMedium();
+            DeviceType_T devType = pAtt->i_getType();
+            Medium* pMedium = pAtt->i_getMedium();
 
             if (   devType != DeviceType_HardDisk
                 || pMedium == NULL
-                || pMedium->getType() != MediumType_Normal)
+                || pMedium->i_getType() != MediumType_Normal)
             {
                 /* copy the attachment as is */
 
-                /** @todo the progress object created in Console::TakeSnaphot
+                /** @todo the progress object created in SessionMachine::TakeSnaphot
                  * only expects operations for hard disks. Later other
                  * device types need to show up in the progress as well. */
                 if (devType == DeviceType_HardDisk)
@@ -11261,7 +10757,7 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
                                                     aWeight);        // weight
                     else
                         aProgress->SetNextOperation(BstrFmt(tr("Skipping medium '%s'"),
-                                                            pMedium->getBase()->getName().c_str()).raw(),
+                                                            pMedium->i_getBase()->i_getName().c_str()).raw(),
                                                     aWeight);        // weight
                 }
 
@@ -11271,11 +10767,11 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
 
             /* need a diff */
             aProgress->SetNextOperation(BstrFmt(tr("Creating differencing hard disk for '%s'"),
-                                                pMedium->getBase()->getName().c_str()).raw(),
+                                                pMedium->i_getBase()->i_getName().c_str()).raw(),
                                         aWeight);        // weight
 
             Utf8Str strFullSnapshotFolder;
-            calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);
+            i_calculateFullPath(mUserData->s.strSnapshotFolder, strFullSnapshotFolder);
 
             ComObjPtr<Medium> diff;
             diff.createObject();
@@ -11283,12 +10779,13 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
             // (this cannot fail here because we can't create implicit diffs for
             // unregistered images)
             Guid uuidRegistryParent;
-            bool fInRegistry = pMedium->getFirstRegistryMachineId(uuidRegistryParent);
+            bool fInRegistry = pMedium->i_getFirstRegistryMachineId(uuidRegistryParent);
             Assert(fInRegistry); NOREF(fInRegistry);
             rc = diff->init(mParent,
-                            pMedium->getPreferredDiffFormat(),
+                            pMedium->i_getPreferredDiffFormat(),
                             strFullSnapshotFolder.append(RTPATH_SLASH_STR),
-                            uuidRegistryParent);
+                            uuidRegistryParent,
+                            DeviceType_HardDisk);
             if (FAILED(rc)) throw rc;
 
             /** @todo r=bird: How is the locking and diff image cleaned up if we fail before
@@ -11312,16 +10809,16 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
 
             /* release the locks before the potentially lengthy operation */
             alock.release();
-            rc = pMedium->createDiffStorage(diff, MediumVariant_Standard,
-                                            pMediumLockList,
-                                            NULL /* aProgress */,
-                                            true /* aWait */);
+            rc = pMedium->i_createDiffStorage(diff, MediumVariant_Standard,
+                                              pMediumLockList,
+                                              NULL /* aProgress */,
+                                              true /* aWait */);
             alock.acquire();
             if (FAILED(rc)) throw rc;
 
             /* actual lock list update is done in Medium::commitMedia */
 
-            rc = diff->addBackReference(mData->mUuid);
+            rc = diff->i_addBackReference(mData->mUuid);
             AssertComRCThrowRC(rc);
 
             /* add a new attachment */
@@ -11329,17 +10826,17 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
             attachment.createObject();
             rc = attachment->init(this,
                                   diff,
-                                  pAtt->getControllerName(),
-                                  pAtt->getPort(),
-                                  pAtt->getDevice(),
+                                  pAtt->i_getControllerName(),
+                                  pAtt->i_getPort(),
+                                  pAtt->i_getDevice(),
                                   DeviceType_HardDisk,
                                   true /* aImplicit */,
                                   false /* aPassthrough */,
                                   false /* aTempEject */,
-                                  pAtt->getNonRotational(),
-                                  pAtt->getDiscard(),
-                                  pAtt->getHotPluggable(),
-                                  pAtt->getBandwidthGroup());
+                                  pAtt->i_getNonRotational(),
+                                  pAtt->i_getDiscard(),
+                                  pAtt->i_getHotPluggable(),
+                                  pAtt->i_getBandwidthGroup());
             if (FAILED(rc)) throw rc;
 
             rc = lockedMediaMap->ReplaceKey(pAtt, attachment);
@@ -11370,7 +10867,7 @@ HRESULT Machine::createImplicitDiffs(IProgress *aProgress,
  *
  * @note Locks this object and the media tree for writing.
  */
-HRESULT Machine::deleteImplicitDiffs(bool aOnline)
+HRESULT Machine::i_deleteImplicitDiffs(bool aOnline)
 {
     LogFlowThisFunc(("aOnline=%d\n", aOnline));
 
@@ -11378,7 +10875,7 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoMultiWriteLock2 alock(this->lockHandle(),
-                              &mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+                              &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     /* We absolutely must have backed up state. */
     AssertReturn(mMediaData.isBackedUp(), E_FAIL);
@@ -11390,7 +10887,7 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
          ++it)
     {
         const ComObjPtr<MediumAttachment> &pAtt = *it;
-        if (pAtt->isImplicit())
+        if (pAtt->i_isImplicit())
         {
             fImplicitDiffs = true;
             break;
@@ -11412,14 +10909,15 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
 
     /* will release the lock before the potentially lengthy operation,
      * so protect with the special state (unless already protected) */
-    if (   oldState != MachineState_Saving
+    if (   oldState != MachineState_Snapshotting
+        && oldState != MachineState_OnlineSnapshotting
         && oldState != MachineState_LiveSnapshotting
         && oldState != MachineState_RestoringSnapshot
         && oldState != MachineState_DeletingSnapshot
         && oldState != MachineState_DeletingSnapshotOnline
         && oldState != MachineState_DeletingSnapshotPaused
        )
-        setMachineState(MachineState_SettingUp);
+           i_setMachineState(MachineState_SettingUp);
 
     // use appropriate locked media map (online or offline)
     MediumLockListMap lockedMediaOffline;
@@ -11440,17 +10938,18 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
                ++it)
             {
                 MediumAttachment* pAtt = *it;
-                if (pAtt->getType() == DeviceType_HardDisk)
+                if (pAtt->i_getType() == DeviceType_HardDisk)
                 {
-                    Medium* pMedium = pAtt->getMedium();
+                    Medium* pMedium = pAtt->i_getMedium();
                     Assert(pMedium);
 
                     MediumLockList *pMediumLockList(new MediumLockList());
                     alock.release();
-                    rc = pMedium->createMediumLockList(true /* fFailIfInaccessible */,
-                                                       false /* fMediumLockWrite */,
-                                                       NULL,
-                                                       *pMediumLockList);
+                    rc = pMedium->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                                         false /* fMediumLockWrite */,
+                                                         false /* fMediumLockWriteAll */,
+                                                         NULL,
+                                                         *pMediumLockList);
                     alock.acquire();
 
                     if (FAILED(rc))
@@ -11480,16 +10979,16 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
              ++it)
         {
             ComObjPtr<MediumAttachment> pAtt = *it;
-            ComObjPtr<Medium> pMedium = pAtt->getMedium();
+            ComObjPtr<Medium> pMedium = pAtt->i_getMedium();
             if (pMedium.isNull())
                 continue;
 
             // Implicit attachments go on the list for deletion and back references are removed.
-            if (pAtt->isImplicit())
+            if (pAtt->i_isImplicit())
             {
                 /* Deassociate and mark for deletion */
-                LogFlowThisFunc(("Detaching '%s', pending deletion\n", pAtt->getLogName()));
-                rc = pMedium->removeBackReference(mData->mUuid);
+                LogFlowThisFunc(("Detaching '%s', pending deletion\n", pAtt->i_getLogName()));
+                rc = pMedium->i_removeBackReference(mData->mUuid);
                 if (FAILED(rc))
                    throw rc;
                 implicitAtts.push_back(pAtt);
@@ -11497,16 +10996,16 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
             }
 
             /* Was this medium attached before? */
-            if (!findAttachment(oldAtts, pMedium))
+            if (!i_findAttachment(oldAtts, pMedium))
             {
                 /* no: de-associate */
-                LogFlowThisFunc(("Detaching '%s', no deletion\n", pAtt->getLogName()));
-                rc = pMedium->removeBackReference(mData->mUuid);
+                LogFlowThisFunc(("Detaching '%s', no deletion\n", pAtt->i_getLogName()));
+                rc = pMedium->i_removeBackReference(mData->mUuid);
                 if (FAILED(rc))
                     throw rc;
                 continue;
             }
-            LogFlowThisFunc(("Not detaching '%s'\n", pAtt->getLogName()));
+            LogFlowThisFunc(("Not detaching '%s'\n", pAtt->i_getLogName()));
         }
 
         /* If there are implicit attachments to delete, throw away the lock
@@ -11533,22 +11032,25 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
         {
             alock.release();
 
-            for (MediaData::AttachmentList::const_iterator it = implicitAtts.begin();
-                 it != implicitAtts.end();
-                 ++it)
+            for (MediaData::AttachmentList::const_iterator it = implicitAtts.begin(); it != implicitAtts.end(); ++it)
             {
                 // Remove medium associated with this attachment.
                 ComObjPtr<MediumAttachment> pAtt = *it;
                 Assert(pAtt);
-                LogFlowThisFunc(("Deleting '%s'\n", pAtt->getLogName()));
-                ComObjPtr<Medium> pMedium = pAtt->getMedium();
+                LogFlowThisFunc(("Deleting '%s'\n", pAtt->i_getLogName()));
+                ComObjPtr<Medium> pMedium = pAtt->i_getMedium();
                 Assert(pMedium);
 
-                rc = pMedium->deleteStorage(NULL /*aProgress*/, true /*aWait*/);
+                rc = pMedium->i_deleteStorage(NULL /*aProgress*/, true /*aWait*/);
                 // continue on delete failure, just collect error messages
-                AssertMsg(SUCCEEDED(rc), ("rc=%Rhrc it=%s hd=%s\n", rc, pAtt->getLogName(), pMedium->getLocationFull().c_str() ));
+                AssertMsg(SUCCEEDED(rc), ("rc=%Rhrc it=%s hd=%s\n", rc, pAtt->i_getLogName(),
+                                          pMedium->i_getLocationFull().c_str() ));
                 mrc = rc;
             }
+            // Clear the list of deleted implicit attachments now, while not
+            // holding the lock, as it will ultimately trigger Medium::uninit()
+            // calls which assume that the media tree lock isn't held.
+            implicitAtts.clear();
 
             alock.acquire();
 
@@ -11561,7 +11063,7 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
                 if (!pMachine.isNull())
                 {
                     alock.release();
-                    rc = mData->mSession.mMachine->lockMedia();
+                    rc = mData->mSession.mMachine->i_lockMedia();
                     alock.acquire();
                     if (FAILED(rc))
                         throw rc;
@@ -11572,7 +11074,7 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
     catch (HRESULT aRC) {rc = aRC;}
 
     if (mData->mMachineState == MachineState_SettingUp)
-        setMachineState(oldState);
+        i_setMachineState(oldState);
 
     /* unlock all hard disks we locked when there is no VM */
     if (!aOnline)
@@ -11598,17 +11100,15 @@ HRESULT Machine::deleteImplicitDiffs(bool aOnline)
  * @param aDevice
  * @return
  */
-MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll,
-                                          IN_BSTR aControllerName,
-                                          LONG aControllerPort,
-                                          LONG aDevice)
+MediumAttachment* Machine::i_findAttachment(const MediaData::AttachmentList &ll,
+                                            IN_BSTR aControllerName,
+                                            LONG aControllerPort,
+                                            LONG aDevice)
 {
-   for (MediaData::AttachmentList::const_iterator it = ll.begin();
-        it != ll.end();
-        ++it)
+   for (MediaData::AttachmentList::const_iterator it = ll.begin(); it != ll.end(); ++it)
     {
         MediumAttachment *pAttach = *it;
-        if (pAttach->matches(aControllerName, aControllerPort, aDevice))
+        if (pAttach->i_matches(aControllerName, aControllerPort, aDevice))
             return pAttach;
     }
 
@@ -11626,15 +11126,13 @@ MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll,
  * @param aDevice
  * @return
  */
-MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll,
-                                          ComObjPtr<Medium> pMedium)
+MediumAttachment* Machine::i_findAttachment(const MediaData::AttachmentList &ll,
+                                            ComObjPtr<Medium> pMedium)
 {
-   for (MediaData::AttachmentList::const_iterator it = ll.begin();
-        it != ll.end();
-        ++it)
+   for (MediaData::AttachmentList::const_iterator it = ll.begin(); it != ll.end(); ++it)
     {
         MediumAttachment *pAttach = *it;
-        ComObjPtr<Medium> pMediumThis = pAttach->getMedium();
+        ComObjPtr<Medium> pMediumThis = pAttach->i_getMedium();
         if (pMediumThis == pMedium)
             return pAttach;
     }
@@ -11653,16 +11151,14 @@ MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll,
  * @param aDevice
  * @return
  */
-MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll,
-                                          Guid &id)
+MediumAttachment* Machine::i_findAttachment(const MediaData::AttachmentList &ll,
+                                            Guid &id)
 {
-   for (MediaData::AttachmentList::const_iterator it = ll.begin();
-         it != ll.end();
-         ++it)
+   for (MediaData::AttachmentList::const_iterator it = ll.begin(); it != ll.end(); ++it)
     {
         MediumAttachment *pAttach = *it;
-        ComObjPtr<Medium> pMediumThis = pAttach->getMedium();
-        if (pMediumThis->getId() == id)
+        ComObjPtr<Medium> pMediumThis = pAttach->i_getMedium();
+        if (pMediumThis->i_getId() == id)
             return pAttach;
     }
 
@@ -11675,19 +11171,20 @@ MediumAttachment* Machine::findAttachment(const MediaData::AttachmentList &ll,
  *
  * @param pAttach Medium attachment to detach.
  * @param writeLock Machine write lock which the caller must have locked once. This may be released temporarily in here.
- * @param pSnapshot If NULL, then the detachment is for the current machine. Otherwise this is for a SnapshotMachine, and this must be its snapshot.
+ * @param pSnapshot If NULL, then the detachment is for the current machine. Otherwise this is for a
+ * SnapshotMachine, and this must be its snapshot.
  * @return
  */
-HRESULT Machine::detachDevice(MediumAttachment *pAttach,
-                              AutoWriteLock &writeLock,
-                              Snapshot *pSnapshot)
+HRESULT Machine::i_detachDevice(MediumAttachment *pAttach,
+                                AutoWriteLock &writeLock,
+                                Snapshot *pSnapshot)
 {
-    ComObjPtr<Medium> oldmedium = pAttach->getMedium();
-    DeviceType_T mediumType = pAttach->getType();
+    ComObjPtr<Medium> oldmedium = pAttach->i_getMedium();
+    DeviceType_T mediumType = pAttach->i_getType();
 
-    LogFlowThisFunc(("Entering, medium of attachment is %s\n", oldmedium ? oldmedium->getLocationFull().c_str() : "NULL"));
+    LogFlowThisFunc(("Entering, medium of attachment is %s\n", oldmedium ? oldmedium->i_getLocationFull().c_str() : "NULL"));
 
-    if (pAttach->isImplicit())
+    if (pAttach->i_isImplicit())
     {
         /* attempt to implicitly delete the implicitly created diff */
 
@@ -11700,21 +11197,21 @@ HRESULT Machine::detachDevice(MediumAttachment *pAttach,
         /* will release the lock before the potentially lengthy operation, so
          * protect with the special state */
         MachineState_T oldState = mData->mMachineState;
-        setMachineState(MachineState_SettingUp);
+        i_setMachineState(MachineState_SettingUp);
 
         writeLock.release();
 
-        HRESULT rc = oldmedium->deleteStorage(NULL /*aProgress*/,
-                                              true /*aWait*/);
+        HRESULT rc = oldmedium->i_deleteStorage(NULL /*aProgress*/,
+                                                true /*aWait*/);
 
         writeLock.acquire();
 
-        setMachineState(oldState);
+        i_setMachineState(oldState);
 
         if (FAILED(rc)) return rc;
     }
 
-    setModified(IsModified_Storage);
+    i_setModified(IsModified_Storage);
     mMediaData.backup();
     mMediaData->mAttachments.remove(pAttach);
 
@@ -11722,10 +11219,10 @@ HRESULT Machine::detachDevice(MediumAttachment *pAttach,
     {
         // if this is from a snapshot, do not defer detachment to commitMedia()
         if (pSnapshot)
-            oldmedium->removeBackReference(mData->mUuid, pSnapshot->getId());
+            oldmedium->i_removeBackReference(mData->mUuid, pSnapshot->i_getId());
         // else if non-hard disk media, do not defer detachment to commitMedia() either
         else if (mediumType != DeviceType_HardDisk)
-            oldmedium->removeBackReference(mData->mUuid);
+            oldmedium->i_removeBackReference(mData->mUuid);
     }
 
     return S_OK;
@@ -11734,7 +11231,7 @@ HRESULT Machine::detachDevice(MediumAttachment *pAttach,
 /**
  * Goes thru all media of the given list and
  *
- * 1) calls detachDevice() on each of them for this machine and
+ * 1) calls i_detachDevice() on each of them for this machine and
  * 2) adds all Medium objects found in the process to the given list,
  *    depending on cleanupMode.
  *
@@ -11746,48 +11243,47 @@ HRESULT Machine::detachDevice(MediumAttachment *pAttach,
  * the SnapshotMachine objects that might be found in the snapshots.
  *
  * Requires caller and locking. The machine lock must be passed in because it
- * will be passed on to detachDevice which needs it for temporary unlocking.
+ * will be passed on to i_detachDevice which needs it for temporary unlocking.
  *
- * @param writeLock Machine lock from top-level caller; this gets passed to detachDevice.
+ * @param writeLock Machine lock from top-level caller; this gets passed to i_detachDevice.
  * @param pSnapshot Must be NULL when called for a "real" Machine or a snapshot object if called for a SnapshotMachine.
- * @param cleanupMode If DetachAllReturnHardDisksOnly, only hard disk media get added to llMedia; if Full, then all media get added;
+ * @param cleanupMode If DetachAllReturnHardDisksOnly, only hard disk media get added to llMedia; if
+ * Full, then all media get added;
  *          otherwise no media get added.
  * @param llMedia Caller's list to receive Medium objects which got detached so caller can close() them, depending on cleanupMode.
  * @return
  */
-HRESULT Machine::detachAllMedia(AutoWriteLock &writeLock,
-                                Snapshot *pSnapshot,
-                                CleanupMode_T cleanupMode,
-                                MediaList &llMedia)
+HRESULT Machine::i_detachAllMedia(AutoWriteLock &writeLock,
+                                  Snapshot *pSnapshot,
+                                  CleanupMode_T cleanupMode,
+                                  MediaList &llMedia)
 {
     Assert(isWriteLockOnCurrentThread());
 
     HRESULT rc;
 
-    // make a temporary list because detachDevice invalidates iterators into
+    // make a temporary list because i_detachDevice invalidates iterators into
     // mMediaData->mAttachments
     MediaData::AttachmentList llAttachments2 = mMediaData->mAttachments;
 
-    for (MediaData::AttachmentList::iterator it = llAttachments2.begin();
-         it != llAttachments2.end();
-         ++it)
+    for (MediaData::AttachmentList::iterator it = llAttachments2.begin(); it != llAttachments2.end(); ++it)
     {
         ComObjPtr<MediumAttachment> &pAttach = *it;
-        ComObjPtr<Medium> pMedium = pAttach->getMedium();
+        ComObjPtr<Medium> pMedium = pAttach->i_getMedium();
 
         if (!pMedium.isNull())
         {
             AutoCaller mac(pMedium);
             if (FAILED(mac.rc())) return mac.rc();
             AutoReadLock lock(pMedium COMMA_LOCKVAL_SRC_POS);
-            DeviceType_T devType = pMedium->getDeviceType();
+            DeviceType_T devType = pMedium->i_getDeviceType();
             if (    (    cleanupMode == CleanupMode_DetachAllReturnHardDisksOnly
                       && devType == DeviceType_HardDisk)
                  || (cleanupMode == CleanupMode_Full)
                )
             {
                 llMedia.push_back(pMedium);
-                ComObjPtr<Medium> pParent = pMedium->getParent();
+                ComObjPtr<Medium> pParent = pMedium->i_getParent();
                 /* Not allowed to keep this lock as below we need the parent
                  * medium lock, and the lock order is parent to child. */
                 lock.release();
@@ -11804,22 +11300,22 @@ HRESULT Machine::detachAllMedia(AutoWriteLock &writeLock,
                     AutoCaller mac1(pParent);
                     if (FAILED(mac1.rc())) return mac1.rc();
                     AutoReadLock lock1(pParent COMMA_LOCKVAL_SRC_POS);
-                    if (pParent->getChildren().size() == 1)
+                    if (pParent->i_getChildren().size() == 1)
                     {
-                        if (   pParent->getMachineBackRefCount() == 0
-                            && pParent->getType() == MediumType_Normal
+                        if (   pParent->i_getMachineBackRefCount() == 0
+                            && pParent->i_getType() == MediumType_Normal
                             && find(llMedia.begin(), llMedia.end(), pParent) == llMedia.end())
                             llMedia.push_back(pParent);
                     }
                     else
                         break;
-                    pParent = pParent->getParent();
+                    pParent = pParent->i_getParent();
                 }
             }
         }
 
         // real machine: then we need to use the proper method
-        rc = detachDevice(pAttach, writeLock, pSnapshot);
+        rc = i_detachDevice(pAttach, writeLock, pSnapshot);
 
         if (FAILED(rc))
             return rc;
@@ -11842,7 +11338,7 @@ HRESULT Machine::detachAllMedia(AutoWriteLock &writeLock,
  *
  * @note Locks this object for writing!
  */
-void Machine::commitMedia(bool aOnline /*= false*/)
+void Machine::i_commitMedia(bool aOnline /*= false*/)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -11867,13 +11363,13 @@ void Machine::commitMedia(bool aOnline /*= false*/)
     {
         MediumAttachment *pAttach = *it;
 
-        pAttach->commit();
+        pAttach->i_commit();
 
-        Medium* pMedium = pAttach->getMedium();
-        bool fImplicit = pAttach->isImplicit();
+        Medium* pMedium = pAttach->i_getMedium();
+        bool fImplicit = pAttach->i_isImplicit();
 
         LogFlowThisFunc(("Examining current medium '%s' (implicit: %d)\n",
-                         (pMedium) ? pMedium->getName().c_str() : "NULL",
+                         (pMedium) ? pMedium->i_getName().c_str() : "NULL",
                          fImplicit));
 
         /** @todo convert all this Machine-based voodoo to MediumAttachment
@@ -11881,11 +11377,11 @@ void Machine::commitMedia(bool aOnline /*= false*/)
         if (fImplicit)
         {
             /* convert implicit attachment to normal */
-            pAttach->setImplicit(false);
+            pAttach->i_setImplicit(false);
 
             if (    aOnline
                  && pMedium
-                 && pAttach->getType() == DeviceType_HardDisk
+                 && pAttach->i_getType() == DeviceType_HardDisk
                )
             {
                 /* update the appropriate lock list */
@@ -11901,7 +11397,7 @@ void Machine::commitMedia(bool aOnline /*= false*/)
                         AssertComRC(rc);
                         fMediaNeedsLocking = true;
                     }
-                    rc = pMediumLockList->Update(pMedium->getParent(), false);
+                    rc = pMediumLockList->Update(pMedium->i_getParent(), false);
                     AssertComRC(rc);
                     rc = pMediumLockList->Append(pMedium, true);
                     AssertComRC(rc);
@@ -11914,14 +11410,12 @@ void Machine::commitMedia(bool aOnline /*= false*/)
         if (pMedium)
         {
             /* was this medium attached before? */
-            for (MediaData::AttachmentList::iterator oldIt = oldAtts.begin();
-                 oldIt != oldAtts.end();
-                 ++oldIt)
+            for (MediaData::AttachmentList::iterator oldIt = oldAtts.begin(); oldIt != oldAtts.end(); ++oldIt)
             {
                 MediumAttachment *pOldAttach = *oldIt;
-                if (pOldAttach->getMedium() == pMedium)
+                if (pOldAttach->i_getMedium() == pMedium)
                 {
-                    LogFlowThisFunc(("--> medium '%s' was attached before, will not remove\n", pMedium->getName().c_str()));
+                    LogFlowThisFunc(("--> medium '%s' was attached before, will not remove\n", pMedium->i_getName().c_str()));
 
                     /* yes: remove from old to avoid de-association */
                     oldAtts.erase(oldIt);
@@ -11933,21 +11427,19 @@ void Machine::commitMedia(bool aOnline /*= false*/)
 
     /* enumerate remaining old attachments and de-associate from the
      * current machine state */
-    for (MediaData::AttachmentList::const_iterator it = oldAtts.begin();
-         it != oldAtts.end();
-         ++it)
+    for (MediaData::AttachmentList::const_iterator it = oldAtts.begin(); it != oldAtts.end(); ++it)
     {
         MediumAttachment *pAttach = *it;
-        Medium* pMedium = pAttach->getMedium();
+        Medium* pMedium = pAttach->i_getMedium();
 
         /* Detach only hard disks, since DVD/floppy media is detached
          * instantly in MountMedium. */
-        if (pAttach->getType() == DeviceType_HardDisk && pMedium)
+        if (pAttach->i_getType() == DeviceType_HardDisk && pMedium)
         {
-            LogFlowThisFunc(("detaching medium '%s' from machine\n", pMedium->getName().c_str()));
+            LogFlowThisFunc(("detaching medium '%s' from machine\n", pMedium->i_getName().c_str()));
 
             /* now de-associate from the current machine state */
-            rc = pMedium->removeBackReference(mData->mUuid);
+            rc = pMedium->i_removeBackReference(mData->mUuid);
             AssertComRC(rc);
 
             if (aOnline)
@@ -11986,7 +11478,7 @@ void Machine::commitMedia(bool aOnline /*= false*/)
     /* commit the hard disk changes */
     mMediaData.commit();
 
-    if (isSessionMachine())
+    if (i_isSessionMachine())
     {
         /*
          * Update the parent machine to point to the new owner.
@@ -12002,9 +11494,7 @@ void Machine::commitMedia(bool aOnline /*= false*/)
         for (MediaData::AttachmentList::const_iterator it = mMediaData->mAttachments.begin();
              it != mMediaData->mAttachments.end();
              ++it)
-        {
-            (*it)->updateParentMachine(mPeer);
-        }
+            (*it)->i_updateParentMachine(mPeer);
 
         /* attach new data to the primary machine and reshare it */
         mPeer->mMediaData.attach(mMediaData);
@@ -12021,7 +11511,7 @@ void Machine::commitMedia(bool aOnline /*= false*/)
  *
  * @note Locks this object for writing!
  */
-void Machine::rollbackMedia()
+void Machine::i_rollbackMedia()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -12042,26 +11532,26 @@ void Machine::rollbackMedia()
     {
         MediumAttachment *pAttach = *it;
         /* Fix up the backrefs for DVD/floppy media. */
-        if (pAttach->getType() != DeviceType_HardDisk)
+        if (pAttach->i_getType() != DeviceType_HardDisk)
         {
-            Medium* pMedium = pAttach->getMedium();
+            Medium* pMedium = pAttach->i_getMedium();
             if (pMedium)
             {
-                rc = pMedium->removeBackReference(mData->mUuid);
+                rc = pMedium->i_removeBackReference(mData->mUuid);
                 AssertComRC(rc);
             }
         }
 
-        (*it)->rollback();
+        (*it)->i_rollback();
 
         pAttach = *it;
         /* Fix up the backrefs for DVD/floppy media. */
-        if (pAttach->getType() != DeviceType_HardDisk)
+        if (pAttach->i_getType() != DeviceType_HardDisk)
         {
-            Medium* pMedium = pAttach->getMedium();
+            Medium* pMedium = pAttach->i_getMedium();
             if (pMedium)
             {
-                rc = pMedium->addBackReference(mData->mUuid);
+                rc = pMedium->i_addBackReference(mData->mUuid);
                 AssertComRC(rc);
             }
         }
@@ -12069,7 +11559,7 @@ void Machine::rollbackMedia()
 
     /** @todo convert all this Machine-based voodoo to MediumAttachment
      * based rollback logic. */
-    deleteImplicitDiffs(Global::IsOnline(mData->mMachineState));
+    i_deleteImplicitDiffs(Global::IsOnline(mData->mMachineState));
 
     return;
 }
@@ -12085,7 +11575,7 @@ void Machine::rollbackMedia()
  *  @note Doesn't lock anything.
  *  @note Not thread safe (must be called from this object's lock).
  */
-bool Machine::isInOwnDir(Utf8Str *aSettingsDir /* = NULL */) const
+bool Machine::i_isInOwnDir(Utf8Str *aSettingsDir /* = NULL */) const
 {
     Utf8Str strMachineDirName(mData->m_strConfigFileFull);  // path/to/machinesfolder/vmname/vmname.vbox
     strMachineDirName.stripFilename();                      // path/to/machinesfolder/vmname
@@ -12094,7 +11584,7 @@ bool Machine::isInOwnDir(Utf8Str *aSettingsDir /* = NULL */) const
     strMachineDirName.stripPath();                          // vmname
     Utf8Str strConfigFileOnly(mData->m_strConfigFileFull);  // path/to/machinesfolder/vmname/vmname.vbox
     strConfigFileOnly.stripPath()                           // vmname.vbox
-                     .stripExt();                           // vmname
+                     .stripSuffix();                        // vmname
     /** @todo hack, make somehow use of ComposeMachineFilename */
     if (mUserData->s.fDirectoryIncludesUUID)
         strConfigFileOnly += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw());
@@ -12112,7 +11602,7 @@ bool Machine::isInOwnDir(Utf8Str *aSettingsDir /* = NULL */) const
  *
  * @note Locks objects for writing!
  */
-void Machine::rollback(bool aNotify)
+void Machine::i_rollback(bool aNotify)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), (void)0);
@@ -12147,7 +11637,7 @@ void Machine::rollback(bool aNotify)
             StorageControllerList::const_iterator it = mStorageControllers->begin();
             while (it != mStorageControllers->end())
             {
-                (*it)->rollback();
+                (*it)->i_rollback();
                 ++it;
             }
         }
@@ -12181,7 +11671,7 @@ void Machine::rollback(bool aNotify)
             USBControllerList::const_iterator it = mUSBControllers->begin();
             while (it != mUSBControllers->end())
             {
-                (*it)->rollback();
+                (*it)->i_rollback();
                 ++it;
             }
         }
@@ -12192,22 +11682,22 @@ void Machine::rollback(bool aNotify)
     mHWData.rollback();
 
     if (mData->flModifications & IsModified_Storage)
-        rollbackMedia();
+        i_rollbackMedia();
 
     if (mBIOSSettings)
-        mBIOSSettings->rollback();
+        mBIOSSettings->i_rollback();
 
     if (mVRDEServer && (mData->flModifications & IsModified_VRDEServer))
-        mVRDEServer->rollback();
+        mVRDEServer->i_rollback();
 
     if (mAudioAdapter)
-        mAudioAdapter->rollback();
+        mAudioAdapter->i_rollback();
 
     if (mUSBDeviceFilters && (mData->flModifications & IsModified_USB))
-        mUSBDeviceFilters->rollback();
+        mUSBDeviceFilters->i_rollback();
 
     if (mBandwidthControl && (mData->flModifications & IsModified_BandwidthControl))
-        mBandwidthControl->rollback();
+        mBandwidthControl->i_rollback();
 
     if (!mHWData.isNull())
         mNetworkAdapters.resize(Global::getMaxNetworkAdapters(mHWData->mChipsetType));
@@ -12216,29 +11706,29 @@ void Machine::rollback(bool aNotify)
     ComPtr<IParallelPort> parallelPorts[RT_ELEMENTS(mParallelPorts)];
 
     if (mData->flModifications & IsModified_NetworkAdapters)
-        for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)
+        for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot)
             if (    mNetworkAdapters[slot]
-                 && mNetworkAdapters[slot]->isModified())
+                 && mNetworkAdapters[slot]->i_isModified())
             {
-                mNetworkAdapters[slot]->rollback();
+                mNetworkAdapters[slot]->i_rollback();
                 networkAdapters[slot] = mNetworkAdapters[slot];
             }
 
     if (mData->flModifications & IsModified_SerialPorts)
-        for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
+        for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
             if (    mSerialPorts[slot]
-                 && mSerialPorts[slot]->isModified())
+                 && mSerialPorts[slot]->i_isModified())
             {
-                mSerialPorts[slot]->rollback();
+                mSerialPorts[slot]->i_rollback();
                 serialPorts[slot] = mSerialPorts[slot];
             }
 
     if (mData->flModifications & IsModified_ParallelPorts)
-        for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
+        for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
             if (    mParallelPorts[slot]
-                 && mParallelPorts[slot]->isModified())
+                 && mParallelPorts[slot]->i_isModified())
             {
-                mParallelPorts[slot]->rollback();
+                mParallelPorts[slot]->i_rollback();
                 parallelPorts[slot] = mParallelPorts[slot];
             }
 
@@ -12251,25 +11741,25 @@ void Machine::rollback(bool aNotify)
         alock.release();
 
         if (flModifications & IsModified_SharedFolders)
-            that->onSharedFolderChange();
+            that->i_onSharedFolderChange();
 
         if (flModifications & IsModified_VRDEServer)
-            that->onVRDEServerChange(/* aRestart */ TRUE);
+            that->i_onVRDEServerChange(/* aRestart */ TRUE);
         if (flModifications & IsModified_USB)
-            that->onUSBControllerChange();
+            that->i_onUSBControllerChange();
 
-        for (ULONG slot = 0; slot < networkAdapters.size(); slot++)
+        for (ULONG slot = 0; slot < networkAdapters.size(); ++slot)
             if (networkAdapters[slot])
-                that->onNetworkAdapterChange(networkAdapters[slot], FALSE);
-        for (ULONG slot = 0; slot < RT_ELEMENTS(serialPorts); slot++)
+                that->i_onNetworkAdapterChange(networkAdapters[slot], FALSE);
+        for (ULONG slot = 0; slot < RT_ELEMENTS(serialPorts); ++slot)
             if (serialPorts[slot])
-                that->onSerialPortChange(serialPorts[slot]);
-        for (ULONG slot = 0; slot < RT_ELEMENTS(parallelPorts); slot++)
+                that->i_onSerialPortChange(serialPorts[slot]);
+        for (ULONG slot = 0; slot < RT_ELEMENTS(parallelPorts); ++slot)
             if (parallelPorts[slot])
-                that->onParallelPortChange(parallelPorts[slot]);
+                that->i_onParallelPortChange(parallelPorts[slot]);
 
         if (flModifications & IsModified_Storage)
-            that->onStorageControllerChange();
+            that->i_onStorageControllerChange();
 
 #if 0
         if (flModifications & IsModified_BandwidthControl)
@@ -12285,7 +11775,7 @@ void Machine::rollback(bool aNotify)
  *
  * @note Locks this object and children for writing.
  */
-void Machine::commit()
+void Machine::i_commit()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -12304,13 +11794,13 @@ void Machine::commit()
     mHWData.commit();
 
     if (mMediaData.isBackedUp())
-        commitMedia(Global::IsOnline(mData->mMachineState));
+        i_commitMedia(Global::IsOnline(mData->mMachineState));
 
-    mBIOSSettings->commit();
-    mVRDEServer->commit();
-    mAudioAdapter->commit();
-    mUSBDeviceFilters->commit();
-    mBandwidthControl->commit();
+    mBIOSSettings->i_commit();
+    mVRDEServer->i_commit();
+    mAudioAdapter->i_commit();
+    mUSBDeviceFilters->i_commit();
+    mBandwidthControl->i_commit();
 
     /* Since mNetworkAdapters is a list which might have been changed (resized)
      * without using the Backupable<> template we need to handle the copying
@@ -12322,13 +11812,13 @@ void Machine::commit()
     {
         /* commit everything, even the ones which will go away */
         for (size_t slot = 0; slot < mNetworkAdapters.size(); slot++)
-            mNetworkAdapters[slot]->commit();
+            mNetworkAdapters[slot]->i_commit();
         /* copy over the new entries, creating a peer and uninit the original */
         mPeer->mNetworkAdapters.resize(RT_MAX(newSize, mPeer->mNetworkAdapters.size()));
         for (size_t slot = 0; slot < newSize; slot++)
         {
             /* look if this adapter has a peer device */
-            ComObjPtr<NetworkAdapter> peer = mNetworkAdapters[slot]->getPeer();
+            ComObjPtr<NetworkAdapter> peer = mNetworkAdapters[slot]->i_getPeer();
             if (!peer)
             {
                 /* no peer means the adapter is a newly created one;
@@ -12339,9 +11829,9 @@ void Machine::commit()
             mPeer->mNetworkAdapters[slot] = peer;
         }
         /* uninit any no longer needed network adapters */
-        for (size_t slot = newSize; slot < mNetworkAdapters.size(); slot++)
+        for (size_t slot = newSize; slot < mNetworkAdapters.size(); ++slot)
             mNetworkAdapters[slot]->uninit();
-        for (size_t slot = newSize; slot < mPeer->mNetworkAdapters.size(); slot++)
+        for (size_t slot = newSize; slot < mPeer->mNetworkAdapters.size(); ++slot)
         {
             if (mPeer->mNetworkAdapters[slot])
                 mPeer->mNetworkAdapters[slot]->uninit();
@@ -12358,15 +11848,13 @@ void Machine::commit()
         commitNetworkAdapters = true;
     }
     if (commitNetworkAdapters)
-    {
-        for (size_t slot = 0; slot < mNetworkAdapters.size(); slot++)
-            mNetworkAdapters[slot]->commit();
-    }
+        for (size_t slot = 0; slot < mNetworkAdapters.size(); ++slot)
+            mNetworkAdapters[slot]->i_commit();
 
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
-        mSerialPorts[slot]->commit();
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
-        mParallelPorts[slot]->commit();
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
+        mSerialPorts[slot]->i_commit();
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
+        mParallelPorts[slot]->i_commit();
 
     bool commitStorageControllers = false;
 
@@ -12382,10 +11870,10 @@ void Machine::commit()
             StorageControllerList::const_iterator it = mStorageControllers->begin();
             while (it != mStorageControllers->end())
             {
-                (*it)->commit();
+                (*it)->i_commit();
 
                 /* look if this controller has a peer device */
-                ComObjPtr<StorageController> peer = (*it)->getPeer();
+                ComObjPtr<StorageController> peer = (*it)->i_getPeer();
                 if (!peer)
                 {
                     /* no peer means the device is a newly created one;
@@ -12434,7 +11922,7 @@ void Machine::commit()
         StorageControllerList::const_iterator it = mStorageControllers->begin();
         while (it != mStorageControllers->end())
         {
-            (*it)->commit();
+            (*it)->i_commit();
             ++it;
         }
     }
@@ -12453,10 +11941,10 @@ void Machine::commit()
             USBControllerList::const_iterator it = mUSBControllers->begin();
             while (it != mUSBControllers->end())
             {
-                (*it)->commit();
+                (*it)->i_commit();
 
                 /* look if this controller has a peer device */
-                ComObjPtr<USBController> peer = (*it)->getPeer();
+                ComObjPtr<USBController> peer = (*it)->i_getPeer();
                 if (!peer)
                 {
                     /* no peer means the device is a newly created one;
@@ -12505,12 +11993,12 @@ void Machine::commit()
         USBControllerList::const_iterator it = mUSBControllers->begin();
         while (it != mUSBControllers->end())
         {
-            (*it)->commit();
+            (*it)->i_commit();
             ++it;
         }
     }
 
-    if (isSessionMachine())
+    if (i_isSessionMachine())
     {
         /* attach new data to the primary machine and reshare it */
         mPeer->mUserData.attach(mUserData);
@@ -12533,10 +12021,10 @@ void Machine::commit()
  * @note This method doesn't call #commit(), so all data remains backed up and
  *       unsaved.
  */
-void Machine::copyFrom(Machine *aThat)
+void Machine::i_copyFrom(Machine *aThat)
 {
-    AssertReturnVoid(!isSnapshotMachine());
-    AssertReturnVoid(aThat->isSnapshotMachine());
+    AssertReturnVoid(!i_isSnapshotMachine());
+    AssertReturnVoid(aThat->i_isSnapshotMachine());
 
     AssertReturnVoid(!Global::IsOnline(mData->mMachineState));
 
@@ -12550,16 +12038,16 @@ void Machine::copyFrom(Machine *aThat)
     {
         ComObjPtr<SharedFolder> folder;
         folder.createObject();
-        HRESULT rc = folder->initCopy(getMachine(), *it);
+        HRESULT rc = folder->initCopy(i_getMachine(), *it);
         AssertComRC(rc);
         *it = folder;
     }
 
-    mBIOSSettings->copyFrom(aThat->mBIOSSettings);
-    mVRDEServer->copyFrom(aThat->mVRDEServer);
-    mAudioAdapter->copyFrom(aThat->mAudioAdapter);
-    mUSBDeviceFilters->copyFrom(aThat->mUSBDeviceFilters);
-    mBandwidthControl->copyFrom(aThat->mBandwidthControl);
+    mBIOSSettings->i_copyFrom(aThat->mBIOSSettings);
+    mVRDEServer->i_copyFrom(aThat->mVRDEServer);
+    mAudioAdapter->i_copyFrom(aThat->mAudioAdapter);
+    mUSBDeviceFilters->i_copyFrom(aThat->mUSBDeviceFilters);
+    mBandwidthControl->i_copyFrom(aThat->mBandwidthControl);
 
     /* create private copies of all controllers */
     mStorageControllers.backup();
@@ -12588,12 +12076,12 @@ void Machine::copyFrom(Machine *aThat)
     }
 
     mNetworkAdapters.resize(aThat->mNetworkAdapters.size());
-    for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)
-        mNetworkAdapters[slot]->copyFrom(aThat->mNetworkAdapters[slot]);
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
-        mSerialPorts[slot]->copyFrom(aThat->mSerialPorts[slot]);
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
-        mParallelPorts[slot]->copyFrom(aThat->mParallelPorts[slot]);
+    for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot)
+        mNetworkAdapters[slot]->i_copyFrom(aThat->mNetworkAdapters[slot]);
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
+        mSerialPorts[slot]->i_copyFrom(aThat->mSerialPorts[slot]);
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
+        mParallelPorts[slot]->i_copyFrom(aThat->mParallelPorts[slot]);
 }
 
 /**
@@ -12603,27 +12091,22 @@ void Machine::copyFrom(Machine *aThat)
  *          false otherwise.
  * @param   enmCtrlType    The controller type to check for.
  */
-bool Machine::isControllerHotplugCapable(StorageControllerType_T enmCtrlType)
+bool Machine::i_isControllerHotplugCapable(StorageControllerType_T enmCtrlType)
 {
-    switch (enmCtrlType)
-    {
-        case StorageControllerType_IntelAhci:
-            return true;
-        case StorageControllerType_LsiLogic:
-        case StorageControllerType_LsiLogicSas:
-        case StorageControllerType_BusLogic:
-        case StorageControllerType_PIIX3:
-        case StorageControllerType_PIIX4:
-        case StorageControllerType_ICH6:
-        case StorageControllerType_I82078:
-        default:
-            return false;
-    }
+    ComPtr<ISystemProperties> systemProperties;
+    HRESULT rc = mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam());
+    if (FAILED(rc))
+        return false;
+
+    BOOL aHotplugCapable = FALSE;
+    systemProperties->GetStorageControllerHotplugCapable(enmCtrlType, &aHotplugCapable);
+
+    return RT_BOOL(aHotplugCapable);
 }
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
 
-void Machine::getDiskList(MediaList &list)
+void Machine::i_getDiskList(MediaList &list)
 {
     for (MediaData::AttachmentList::const_iterator it = mMediaData->mAttachments.begin();
          it != mMediaData->mAttachments.end();
@@ -12638,12 +12121,12 @@ void Machine::getDiskList(MediaList &list)
 
         AutoReadLock local_alockA(pAttach COMMA_LOCKVAL_SRC_POS);
 
-        if (pAttach->getType() == DeviceType_HardDisk)
-            list.push_back(pAttach->getMedium());
+        if (pAttach->i_getType() == DeviceType_HardDisk)
+            list.push_back(pAttach->i_getMedium());
     }
 }
 
-void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid)
+void Machine::i_registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid)
 {
     AssertReturnVoid(isWriteLockOnCurrentThread());
     AssertPtrReturnVoid(aCollector);
@@ -12670,7 +12153,7 @@ void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachin
                                                        ramUsageUsed);
     aCollector->registerBaseMetric(ramUsage);
     MediaList disks;
-    getDiskList(disks);
+    i_getDiskList(disks);
     pm::BaseMetric *diskUsage = new pm::MachineDiskUsage(hal, aMachine, disks,
                                                          diskUsageUsed);
     aCollector->registerBaseMetric(diskUsage);
@@ -12726,9 +12209,11 @@ void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachin
     pm::SubMetric *guestMemFree = new pm::SubMetric("Guest/RAM/Usage/Free",        "Free amount of physical guest RAM.");
     pm::SubMetric *guestMemBalloon = new pm::SubMetric("Guest/RAM/Usage/Balloon",  "Amount of ballooned physical guest RAM.");
     pm::SubMetric *guestMemShared = new pm::SubMetric("Guest/RAM/Usage/Shared",  "Amount of shared physical guest RAM.");
-    pm::SubMetric *guestMemCache = new pm::SubMetric("Guest/RAM/Usage/Cache",        "Total amount of guest (disk) cache memory.");
+    pm::SubMetric *guestMemCache = new pm::SubMetric(
+                                                "Guest/RAM/Usage/Cache",        "Total amount of guest (disk) cache memory.");
 
-    pm::SubMetric *guestPagedTotal = new pm::SubMetric("Guest/Pagefile/Usage/Total",    "Total amount of space in the page file.");
+    pm::SubMetric *guestPagedTotal = new pm::SubMetric(
+                                         "Guest/Pagefile/Usage/Total",    "Total amount of space in the page file.");
 
     /* Create and register base metrics */
     pm::BaseMetric *machineNetRate = new pm::MachineNetRate(mCollectorGuest, aMachine,
@@ -12801,7 +12286,7 @@ void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachin
     aCollector->registerMetric(new pm::Metric(guestCpuMem, guestPagedTotal, new pm::AggregateMax()));
 }
 
-void Machine::unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine)
+void Machine::i_unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine)
 {
     AssertReturnVoid(isWriteLockOnCurrentThread());
 
@@ -12925,13 +12410,13 @@ HRESULT SessionMachine::init(Machine *aMachine)
     unconst(mAudioAdapter).createObject();
     mAudioAdapter->init(this, aMachine->mAudioAdapter);
     /* create a list of serial ports that will be mutable */
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++)
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); ++slot)
     {
         unconst(mSerialPorts[slot]).createObject();
         mSerialPorts[slot]->init(this, aMachine->mSerialPorts[slot]);
     }
     /* create a list of parallel ports that will be mutable */
-    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++)
+    for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); ++slot)
     {
         unconst(mParallelPorts[slot]).createObject();
         mParallelPorts[slot]->init(this, aMachine->mParallelPorts[slot]);
@@ -12943,7 +12428,7 @@ HRESULT SessionMachine::init(Machine *aMachine)
 
     /* create a list of network adapters that will be mutable */
     mNetworkAdapters.resize(aMachine->mNetworkAdapters.size());
-    for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)
+    for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot)
     {
         unconst(mNetworkAdapters[slot]).createObject();
         mNetworkAdapters[slot]->init(this, aMachine->mNetworkAdapters[slot]);
@@ -13037,11 +12522,11 @@ void SessionMachine::uninit(Uninit::Reason aReason)
          *
          * This is identical to SessionMachine::DetachAllUSBDevices except
          * for the aAbnormal argument. */
-        HRESULT rc = mUSBDeviceFilters->notifyProxy(false /* aInsertFilters */);
+        HRESULT rc = mUSBDeviceFilters->i_notifyProxy(false /* aInsertFilters */);
         AssertComRC(rc);
         NOREF(rc);
 
-        USBProxyService *service = mParent->host()->usbProxyService();
+        USBProxyService *service = mParent->i_host()->i_usbProxyService();
         if (service)
             service->detachAllDevicesFromVM(this, true /* aDone */, true /* aAbnormal */);
     }
@@ -13050,21 +12535,21 @@ void SessionMachine::uninit(Uninit::Reason aReason)
     // we need to lock this object in uninit() because the lock is shared
     // with mPeer (as well as data we modify below). mParent lock is needed
     // by several calls to it, and USB needs host lock.
-    AutoMultiWriteLock3 multilock(mParent, mParent->host(), this COMMA_LOCKVAL_SRC_POS);
+    AutoMultiWriteLock3 multilock(mParent, mParent->i_host(), this COMMA_LOCKVAL_SRC_POS);
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
     /*
-     * It is safe to call Machine::unregisterMetrics() here because
+     * It is safe to call Machine::i_unregisterMetrics() here because
      * PerformanceCollector::samplerCallback no longer accesses guest methods
      * holding the lock.
      */
-    unregisterMetrics(mParent->performanceCollector(), mPeer);
+    i_unregisterMetrics(mParent->i_performanceCollector(), mPeer);
     /* The guest must be unregistered after its metrics (@bugref{5949}). */
     LogAleksey(("{%p} " LOG_FN_FMT ": mCollectorGuest=%p\n",
                 this, __PRETTY_FUNCTION__, mCollectorGuest));
     if (mCollectorGuest)
     {
-        mParent->performanceCollector()->unregisterGuest(mCollectorGuest);
+        mParent->i_performanceCollector()->unregisterGuest(mCollectorGuest);
         // delete mCollectorGuest; => CollectorGuestManager::destroyUnregistered()
         mCollectorGuest = NULL;
     }
@@ -13077,37 +12562,14 @@ void SessionMachine::uninit(Uninit::Reason aReason)
 
         /* reset the state to Aborted */
         if (mData->mMachineState != MachineState_Aborted)
-            setMachineState(MachineState_Aborted);
+            i_setMachineState(MachineState_Aborted);
     }
 
     // any machine settings modified?
     if (mData->flModifications)
     {
         LogWarningThisFunc(("Discarding unsaved settings changes!\n"));
-        rollback(false /* aNotify */);
-    }
-
-    Assert(    mConsoleTaskData.strStateFilePath.isEmpty()
-            || !mConsoleTaskData.mSnapshot);
-    if (!mConsoleTaskData.strStateFilePath.isEmpty())
-    {
-        LogWarningThisFunc(("canceling failed save state request!\n"));
-        endSavingState(E_FAIL, tr("Machine terminated with pending save state!"));
-    }
-    else if (!mConsoleTaskData.mSnapshot.isNull())
-    {
-        LogWarningThisFunc(("canceling untaken snapshot!\n"));
-
-        /* delete all differencing hard disks created (this will also attach
-         * their parents back by rolling back mMediaData) */
-        rollbackMedia();
-
-        // delete the saved state file (it might have been already created)
-        // AFTER killing the snapshot so that releaseSavedStateFile() won't
-        // think it's still in use
-        Utf8Str strStateFile = mConsoleTaskData.mSnapshot->getStateFilePath();
-        mConsoleTaskData.mSnapshot->uninit();
-        releaseSavedStateFile(strStateFile, NULL /* pSnapshotToIgnore */ );
+        i_rollback(false /* aNotify */);
     }
 
     mData->mSession.mPID = NIL_RTPROCESS;
@@ -13117,7 +12579,7 @@ void SessionMachine::uninit(Uninit::Reason aReason)
         /* Uninitialization didn't come from #checkForDeath(), so tell the
          * client watcher thread to update the set of machines that have open
          * sessions. */
-        mParent->updateClientWatcher();
+        mParent->i_updateClientWatcher();
     }
 
     /* uninitialize all remote controls */
@@ -13144,28 +12606,28 @@ void SessionMachine::uninit(Uninit::Reason aReason)
      * if all references (also from other VMs) are removed. */
     for (; miNATNetworksStarted > 0; miNATNetworksStarted--)
     {
-        for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)
+        for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot)
         {
             NetworkAttachmentType_T type;
             HRESULT hrc;
 
-            hrc = mNetworkAdapters[slot]->COMGETTER(AttachmentType)(&type);
-            if (   SUCCEEDED(hrc)
-                && type == NetworkAttachmentType_NATNetwork)
-            {
-                Bstr name;
-                hrc = mNetworkAdapters[slot]->COMGETTER(NATNetwork)(name.asOutParam());
-                if (SUCCEEDED(hrc))
-                {
-                    multilock.release();
-                    LogRel(("VM '%s' stops using NAT network '%ls'\n",
-                            mUserData->s.strName.c_str(), name.raw()));
-                    mParent->natNetworkRefDec(name.raw());
-                    multilock.acquire();
+             hrc = mNetworkAdapters[slot]->COMGETTER(AttachmentType)(&type);
+             if (   SUCCEEDED(hrc)
+                 && type == NetworkAttachmentType_NATNetwork)
+             {
+                 Bstr name;
+                 hrc = mNetworkAdapters[slot]->COMGETTER(NATNetwork)(name.asOutParam());
+                 if (SUCCEEDED(hrc))
+                 {
+                     multilock.release();
+                     LogRel(("VM '%s' stops using NAT network '%ls'\n",
+                             mUserData->s.strName.c_str(), name.raw()));
+                     mParent->i_natNetworkRefDec(name.raw());
+                     multilock.acquire();
                 }
-            }
-        }
-    }
+             }
+         }
+     }
 
     /*
      *  An expected uninitialization can come only from #checkForDeath().
@@ -13196,12 +12658,12 @@ void SessionMachine::uninit(Uninit::Reason aReason)
     if (mData->mSession.mProgress)
     {
         if (aReason == Uninit::Normal)
-            mData->mSession.mProgress->notifyComplete(S_OK);
+            mData->mSession.mProgress->i_notifyComplete(S_OK);
         else
-            mData->mSession.mProgress->notifyComplete(E_FAIL,
-                                                      COM_IIDOF(ISession),
-                                                      getComponentName(),
-                                                      tr("The VM session was aborted"));
+            mData->mSession.mProgress->i_notifyComplete(E_FAIL,
+                                                        COM_IIDOF(ISession),
+                                                        getComponentName(),
+                                                        tr("The VM session was aborted"));
         mData->mSession.mProgress.setNull();
     }
 
@@ -13210,9 +12672,10 @@ void SessionMachine::uninit(Uninit::Reason aReason)
             || aReason == Uninit::Unexpected);
 
     /* reset the rest of session data */
+    mData->mSession.mLockType = LockType_Null;
     mData->mSession.mMachine.setNull();
     mData->mSession.mState = SessionState_Unlocked;
-    mData->mSession.mType.setNull();
+    mData->mSession.mName.setNull();
 
     /* destroy the machine client token before leaving the exclusive lock */
     if (mClientToken)
@@ -13222,7 +12685,7 @@ void SessionMachine::uninit(Uninit::Reason aReason)
     }
 
     /* fire an event */
-    mParent->onSessionStateChange(mData->mUuid, SessionState_Unlocked);
+    mParent->i_onSessionStateChange(mData->mUuid, SessionState_Unlocked);
 
     uninitDataAndChildObjects();
 
@@ -13257,14 +12720,14 @@ RWLockHandle *SessionMachine::lockHandle() const
 /**
  *  Passes collected guest statistics to performance collector object
  */
-STDMETHODIMP SessionMachine::ReportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
-                                                ULONG aCpuKernel, ULONG aCpuIdle,
-                                                ULONG aMemTotal, ULONG aMemFree,
-                                                ULONG aMemBalloon, ULONG aMemShared,
-                                                ULONG aMemCache, ULONG aPageTotal,
-                                                ULONG aAllocVMM, ULONG aFreeVMM,
-                                                ULONG aBalloonedVMM, ULONG aSharedVMM,
-                                                ULONG aVmNetRx, ULONG aVmNetTx)
+HRESULT SessionMachine::reportVmStatistics(ULONG aValidStats, ULONG aCpuUser,
+                                           ULONG aCpuKernel, ULONG aCpuIdle,
+                                           ULONG aMemTotal, ULONG aMemFree,
+                                           ULONG aMemBalloon, ULONG aMemShared,
+                                           ULONG aMemCache, ULONG aPageTotal,
+                                           ULONG aAllocVMM, ULONG aFreeVMM,
+                                           ULONG aBalloonedVMM, ULONG aSharedVMM,
+                                           ULONG aVmNetRx, ULONG aVmNetTx)
 {
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
     if (mCollectorGuest)
@@ -13295,37 +12758,239 @@ STDMETHODIMP SessionMachine::ReportVmStatistics(ULONG aValidStats, ULONG aCpuUse
 #endif
 }
 
+////////////////////////////////////////////////////////////////////////////////
+//
+// SessionMachine task records
+//
+////////////////////////////////////////////////////////////////////////////////
+
 /**
- *  @note Locks this object for writing.
+ * Task record for saving the machine state.
+ */
+struct SessionMachine::SaveStateTask
+    : public Machine::Task
+{
+    SaveStateTask(SessionMachine *m,
+                  Progress *p,
+                  const Utf8Str &t,
+                  Reason_T enmReason,
+                  const Utf8Str &strStateFilePath)
+        : Task(m, p, t),
+          m_enmReason(enmReason),
+          m_strStateFilePath(strStateFilePath)
+    {}
+
+    void handler()
+    {
+        ((SessionMachine *)(Machine *)m_pMachine)->i_saveStateHandler(*this);
+    }
+
+    Reason_T m_enmReason;
+    Utf8Str m_strStateFilePath;
+};
+
+/**
+ * Task thread implementation for SessionMachine::SaveState(), called from
+ * SessionMachine::taskHandler().
+ *
+ * @note Locks this object for writing.
+ *
+ * @param task
+ * @return
  */
-STDMETHODIMP SessionMachine::SetRemoveSavedStateFile(BOOL aRemove)
+void SessionMachine::i_saveStateHandler(SaveStateTask &task)
 {
+    LogFlowThisFuncEnter();
+
     AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+    LogFlowThisFunc(("state=%d\n", getObjectState().getState()));
+    if (FAILED(autoCaller.rc()))
+    {
+        /* we might have been uninitialized because the session was accidentally
+         * closed by the client, so don't assert */
+        HRESULT rc = setError(E_FAIL,
+                              tr("The session has been accidentally closed"));
+        task.m_pProgress->i_notifyComplete(rc);
+        LogFlowThisFuncLeave();
+        return;
+    }
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mRemoveSavedState = aRemove;
+    HRESULT rc = S_OK;
+
+    try
+    {
+        ComPtr<IInternalSessionControl> directControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
+        if (directControl.isNull())
+            throw setError(VBOX_E_INVALID_VM_STATE,
+                           tr("Trying to save state without a running VM"));
+        alock.release();
+        BOOL fSuspendedBySave;
+        rc = directControl->SaveStateWithReason(task.m_enmReason, task.m_pProgress, Bstr(task.m_strStateFilePath).raw(), task.m_machineStateBackup != MachineState_Paused, &fSuspendedBySave);
+        Assert(!fSuspendedBySave);
+        alock.acquire();
+
+        AssertStmt(   (SUCCEEDED(rc) && mData->mMachineState == MachineState_Saved)
+                   || (FAILED(rc) && mData->mMachineState == MachineState_Saving),
+                   throw E_FAIL);
+
+        if (SUCCEEDED(rc))
+        {
+            mSSData->strStateFilePath = task.m_strStateFilePath;
+
+            /* save all VM settings */
+            rc = i_saveSettings(NULL);
+                    // no need to check whether VirtualBox.xml needs saving also since
+                    // we can't have a name change pending at this point
+        }
+        else
+        {
+            // On failure, set the state to the state we had at the beginning.
+            i_setMachineState(task.m_machineStateBackup);
+            i_updateMachineStateOnClient();
+
+            // Delete the saved state file (might have been already created).
+            // No need to check whether this is shared with a snapshot here
+            // because we certainly created a fresh saved state file here.
+            RTFileDelete(task.m_strStateFilePath.c_str());
+        }
+    }
+    catch (HRESULT aRC) { rc = aRC; }
+
+    task.m_pProgress->i_notifyComplete(rc);
+
+    LogFlowThisFuncLeave();
+}
+
+/**
+ *  @note Locks this object for writing.
+ */
+HRESULT SessionMachine::saveState(ComPtr<IProgress> &aProgress)
+{
+    return i_saveStateWithReason(Reason_Unspecified, aProgress);
+}
+
+HRESULT SessionMachine::i_saveStateWithReason(Reason_T aReason, ComPtr<IProgress> &aProgress)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);
+    if (FAILED(rc)) return rc;
+
+    if (   mData->mMachineState != MachineState_Running
+        && mData->mMachineState != MachineState_Paused
+       )
+        return setError(VBOX_E_INVALID_VM_STATE,
+            tr("Cannot save the execution state as the machine is not running or paused (machine state: %s)"),
+            Global::stringifyMachineState(mData->mMachineState));
+
+    ComObjPtr<Progress> pProgress;
+    pProgress.createObject();
+    rc = pProgress->init(i_getVirtualBox(),
+                         static_cast<IMachine *>(this) /* aInitiator */,
+                         Bstr(tr("Saving the execution state of the virtual machine")).raw(),
+                         FALSE /* aCancelable */);
+    if (FAILED(rc))
+        return rc;
+
+    Utf8Str strStateFilePath;
+    i_composeSavedStateFilename(strStateFilePath);
+
+    /* create and start the task on a separate thread (note that it will not
+     * start working until we release alock) */
+    SaveStateTask *pTask = new SaveStateTask(this, pProgress, "SaveState", aReason, strStateFilePath);
+    rc = pTask->createThread();
+    if (FAILED(rc))
+        return rc;
+
+    /* set the state to Saving (expected by Session::SaveStateWithReason()) */
+    i_setMachineState(MachineState_Saving);
+    i_updateMachineStateOnClient();
+
+    pProgress.queryInterfaceTo(aProgress.asOutParam());
 
     return S_OK;
 }
 
 /**
- *  @note Locks the same as #setMachineState() does.
+ *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::UpdateState(MachineState_T aMachineState)
+HRESULT SessionMachine::adoptSavedState(const com::Utf8Str &aSavedStateFile)
 {
-    return setMachineState(aMachineState);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT rc = i_checkStateDependency(MutableStateDep);
+    if (FAILED(rc)) return rc;
+
+    if (   mData->mMachineState != MachineState_PoweredOff
+        && mData->mMachineState != MachineState_Teleported
+        && mData->mMachineState != MachineState_Aborted
+       )
+        return setError(VBOX_E_INVALID_VM_STATE,
+            tr("Cannot adopt the saved machine state as the machine is not in Powered Off, Teleported or Aborted state (machine state: %s)"),
+            Global::stringifyMachineState(mData->mMachineState));
+
+    com::Utf8Str stateFilePathFull;
+    int vrc = i_calculateFullPath(aSavedStateFile, stateFilePathFull);
+    if (RT_FAILURE(vrc))
+        return setError(VBOX_E_FILE_ERROR,
+                        tr("Invalid saved state file path '%s' (%Rrc)"),
+                        aSavedStateFile.c_str(),
+                        vrc);
+
+    mSSData->strStateFilePath = stateFilePathFull;
+
+    /* The below i_setMachineState() will detect the state transition and will
+     * update the settings file */
+
+    return i_setMachineState(MachineState_Saved);
 }
 
 /**
  *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::BeginPowerUp(IProgress *aProgress)
+HRESULT SessionMachine::discardSavedState(BOOL aFRemoveFile)
 {
-    LogFlowThisFunc(("aProgress=%p\n", aProgress));
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
+    if (FAILED(rc)) return rc;
+
+    if (mData->mMachineState != MachineState_Saved)
+        return setError(VBOX_E_INVALID_VM_STATE,
+            tr("Cannot delete the machine state as the machine is not in the saved state (machine state: %s)"),
+            Global::stringifyMachineState(mData->mMachineState));
+
+    mRemoveSavedState = RT_BOOL(aFRemoveFile);
+
+    /*
+     * Saved -> PoweredOff transition will be detected in the SessionMachine
+     * and properly handled.
+     */
+    rc = i_setMachineState(MachineState_PoweredOff);
+    return rc;
+}
+
+
+/**
+ *  @note Locks the same as #i_setMachineState() does.
+ */
+HRESULT SessionMachine::updateState(MachineState_T aState)
+{
+    return i_setMachineState(aState);
+}
+
+/**
+ *  @note Locks this object for writing.
+ */
+HRESULT SessionMachine::beginPowerUp(const ComPtr<IProgress> &aProgress)
+{
+    IProgress* pProgress(aProgress);
+
+    LogFlowThisFunc(("aProgress=%p\n", pProgress));
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -13333,13 +12998,13 @@ STDMETHODIMP SessionMachine::BeginPowerUp(IProgress *aProgress)
         return VBOX_E_INVALID_OBJECT_STATE;
 
     if (!mData->mSession.mProgress.isNull())
-        mData->mSession.mProgress->setOtherProgressObject(aProgress);
+        mData->mSession.mProgress->setOtherProgressObject(pProgress);
 
     /* If we didn't reference the NAT network service yet, add a reference to
      * force a start */
     if (miNATNetworksStarted < 1)
     {
-        for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++)
+        for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot)
         {
             NetworkAttachmentType_T type;
             HRESULT hrc;
@@ -13354,7 +13019,7 @@ STDMETHODIMP SessionMachine::BeginPowerUp(IProgress *aProgress)
                     LogRel(("VM '%s' starts using NAT network '%ls'\n",
                             mUserData->s.strName.c_str(), name.raw()));
                     mPeer->lockHandle()->unlockWrite();
-                    mParent->natNetworkRefInc(name.raw());
+                    mParent->i_natNetworkRefInc(name.raw());
 #ifdef RT_LOCK_STRICT
                     mPeer->lockHandle()->lockWrite(RT_SRC_POS);
 #else
@@ -13373,11 +13038,8 @@ STDMETHODIMP SessionMachine::BeginPowerUp(IProgress *aProgress)
 /**
  *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::EndPowerUp(LONG iResult)
+HRESULT SessionMachine::endPowerUp(LONG aResult)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mData->mSession.mState != SessionState_Locked)
@@ -13386,18 +13048,18 @@ STDMETHODIMP SessionMachine::EndPowerUp(LONG iResult)
     /* Finalize the LaunchVMProcess progress object. */
     if (mData->mSession.mProgress)
     {
-        mData->mSession.mProgress->notifyComplete((HRESULT)iResult);
+        mData->mSession.mProgress->notifyComplete((HRESULT)aResult);
         mData->mSession.mProgress.setNull();
     }
 
-    if (SUCCEEDED((HRESULT)iResult))
+    if (SUCCEEDED((HRESULT)aResult))
     {
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
         /* The VM has been powered up successfully, so it makes sense
          * now to offer the performance metrics for a running machine
          * object. Doing it earlier wouldn't be safe. */
-        registerMetrics(mParent->performanceCollector(), mPeer,
-                        mData->mSession.mPID);
+        i_registerMetrics(mParent->i_performanceCollector(), mPeer,
+                          mData->mSession.mPID);
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
     }
 
@@ -13407,15 +13069,10 @@ STDMETHODIMP SessionMachine::EndPowerUp(LONG iResult)
 /**
  *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::BeginPoweringDown(IProgress **aProgress)
+HRESULT SessionMachine::beginPoweringDown(ComPtr<IProgress> &aProgress)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     AssertReturn(mConsoleTaskData.mLastState == MachineState_Null,
@@ -13424,7 +13081,7 @@ STDMETHODIMP SessionMachine::BeginPoweringDown(IProgress **aProgress)
     /* create a progress object to track operation completion */
     ComObjPtr<Progress> pProgress;
     pProgress.createObject();
-    pProgress->init(getVirtualBox(),
+    pProgress->init(i_getVirtualBox(),
                     static_cast<IMachine *>(this) /* aInitiator */,
                     Bstr(tr("Stopping the virtual machine")).raw(),
                     FALSE /* aCancelable */);
@@ -13434,9 +13091,9 @@ STDMETHODIMP SessionMachine::BeginPoweringDown(IProgress **aProgress)
     mConsoleTaskData.mProgress = pProgress;
 
     /* set the state to Stopping (this is expected by Console::PowerDown()) */
-    setMachineState(MachineState_Stopping);
+    i_setMachineState(MachineState_Stopping);
 
-    pProgress.queryInterfaceTo(aProgress);
+    pProgress.queryInterfaceTo(aProgress.asOutParam());
 
     return S_OK;
 }
@@ -13444,17 +13101,15 @@ STDMETHODIMP SessionMachine::BeginPoweringDown(IProgress **aProgress)
 /**
  *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::EndPoweringDown(LONG iResult, IN_BSTR aErrMsg)
+HRESULT SessionMachine::endPoweringDown(LONG aResult,
+                                        const com::Utf8Str &aErrMsg)
 {
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AssertReturn(    (   (SUCCEEDED(iResult) && mData->mMachineState == MachineState_PoweredOff)
-                      || (FAILED(iResult) && mData->mMachineState == MachineState_Stopping))
+    AssertReturn(    (   (SUCCEEDED(aResult) && mData->mMachineState == MachineState_PoweredOff)
+                      || (FAILED(aResult) && mData->mMachineState == MachineState_Stopping))
                   && mConsoleTaskData.mLastState != MachineState_Null,
                  E_FAIL);
 
@@ -13464,23 +13119,22 @@ STDMETHODIMP SessionMachine::EndPoweringDown(LONG iResult, IN_BSTR aErrMsg)
      * task). On success the VM process already changed the state to
      * MachineState_PoweredOff, so no need to do anything.
      */
-    if (FAILED(iResult))
-        setMachineState(mConsoleTaskData.mLastState);
+    if (FAILED(aResult))
+        i_setMachineState(mConsoleTaskData.mLastState);
 
     /* notify the progress object about operation completion */
     Assert(mConsoleTaskData.mProgress);
-    if (SUCCEEDED(iResult))
-        mConsoleTaskData.mProgress->notifyComplete(S_OK);
+    if (SUCCEEDED(aResult))
+        mConsoleTaskData.mProgress->i_notifyComplete(S_OK);
     else
     {
-        Utf8Str strErrMsg(aErrMsg);
-        if (strErrMsg.length())
-            mConsoleTaskData.mProgress->notifyComplete(iResult,
-                                                       COM_IIDOF(ISession),
-                                                       getComponentName(),
-                                                       strErrMsg.c_str());
+        if (aErrMsg.length())
+            mConsoleTaskData.mProgress->i_notifyComplete(aResult,
+                                                         COM_IIDOF(ISession),
+                                                         getComponentName(),
+                                                         aErrMsg.c_str());
         else
-            mConsoleTaskData.mProgress->notifyComplete(iResult);
+            mConsoleTaskData.mProgress->i_notifyComplete(aResult);
     }
 
     /* clear out the temporary saved state data */
@@ -13498,23 +13152,17 @@ STDMETHODIMP SessionMachine::EndPoweringDown(LONG iResult, IN_BSTR aErrMsg)
  *
  *  @note Locks the same as USBController::hasMatchingFilter() does.
  */
-STDMETHODIMP SessionMachine::RunUSBDeviceFilters(IUSBDevice *aUSBDevice,
-                                                 BOOL *aMatched,
-                                                 ULONG *aMaskedIfs)
+HRESULT SessionMachine::runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice,
+                                            BOOL  *aMatched,
+                                            ULONG *aMaskedInterfaces)
 {
     LogFlowThisFunc(("\n"));
 
-    CheckComArgNotNull(aUSBDevice);
-    CheckComArgOutPointerValid(aMatched);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
 #ifdef VBOX_WITH_USB
-    *aMatched = mUSBDeviceFilters->hasMatchingFilter(aUSBDevice, aMaskedIfs);
+    *aMatched = mUSBDeviceFilters->i_hasMatchingFilter(aDevice, aMaskedInterfaces);
 #else
-    NOREF(aUSBDevice);
-    NOREF(aMaskedIfs);
+    NOREF(aDevice);
+    NOREF(aMaskedInterfaces);
     *aMatched = FALSE;
 #endif
 
@@ -13524,22 +13172,19 @@ STDMETHODIMP SessionMachine::RunUSBDeviceFilters(IUSBDevice *aUSBDevice,
 /**
  *  @note Locks the same as Host::captureUSBDevice() does.
  */
-STDMETHODIMP SessionMachine::CaptureUSBDevice(IN_BSTR aId)
+HRESULT SessionMachine::captureUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
 #ifdef VBOX_WITH_USB
     /* if captureDeviceForVM() fails, it must have set extended error info */
     clearError();
-    MultiResult rc = mParent->host()->checkUSBProxyService();
+    MultiResult rc = mParent->i_host()->i_checkUSBProxyService();
     if (FAILED(rc)) return rc;
 
-    USBProxyService *service = mParent->host()->usbProxyService();
+    USBProxyService *service = mParent->i_host()->i_usbProxyService();
     AssertReturn(service, E_FAIL);
-    return service->captureDeviceForVM(this, Guid(aId).ref());
+    return service->captureDeviceForVM(this, aId.ref(), aCaptureFilename);
 #else
     NOREF(aId);
     return E_NOTIMPL;
@@ -13549,17 +13194,15 @@ STDMETHODIMP SessionMachine::CaptureUSBDevice(IN_BSTR aId)
 /**
  *  @note Locks the same as Host::detachUSBDevice() does.
  */
-STDMETHODIMP SessionMachine::DetachUSBDevice(IN_BSTR aId, BOOL aDone)
+HRESULT SessionMachine::detachUSBDevice(const com::Guid &aId,
+                                        BOOL aDone)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
 #ifdef VBOX_WITH_USB
-    USBProxyService *service = mParent->host()->usbProxyService();
+    USBProxyService *service = mParent->i_host()->i_usbProxyService();
     AssertReturn(service, E_FAIL);
-    return service->detachDeviceFromVM(this, Guid(aId).ref(), !!aDone);
+    return service->detachDeviceFromVM(this, aId.ref(), !!aDone);
 #else
     NOREF(aId);
     NOREF(aDone);
@@ -13575,19 +13218,16 @@ STDMETHODIMP SessionMachine::DetachUSBDevice(IN_BSTR aId, BOOL aDone)
  *
  *  @note Locks what called methods lock.
  */
-STDMETHODIMP SessionMachine::AutoCaptureUSBDevices()
+HRESULT SessionMachine::autoCaptureUSBDevices()
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
 #ifdef VBOX_WITH_USB
-    HRESULT rc = mUSBDeviceFilters->notifyProxy(true /* aInsertFilters */);
+    HRESULT rc = mUSBDeviceFilters->i_notifyProxy(true /* aInsertFilters */);
     AssertComRC(rc);
     NOREF(rc);
 
-    USBProxyService *service = mParent->host()->usbProxyService();
+    USBProxyService *service = mParent->i_host()->i_usbProxyService();
     AssertReturn(service, E_FAIL);
     return service->autoCaptureDevicesForVM(this);
 #else
@@ -13605,19 +13245,16 @@ STDMETHODIMP SessionMachine::AutoCaptureUSBDevices()
  *
  *  @note Locks what called methods lock.
  */
-STDMETHODIMP SessionMachine::DetachAllUSBDevices(BOOL aDone)
+HRESULT SessionMachine::detachAllUSBDevices(BOOL aDone)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
 #ifdef VBOX_WITH_USB
-    HRESULT rc = mUSBDeviceFilters->notifyProxy(false /* aInsertFilters */);
+    HRESULT rc = mUSBDeviceFilters->i_notifyProxy(false /* aInsertFilters */);
     AssertComRC(rc);
     NOREF(rc);
 
-    USBProxyService *service = mParent->host()->usbProxyService();
+    USBProxyService *service = mParent->i_host()->i_usbProxyService();
     AssertReturn(service, E_FAIL);
     return service->detachAllDevicesFromVM(this, !!aDone, false /* aAbnormal */);
 #else
@@ -13629,22 +13266,16 @@ STDMETHODIMP SessionMachine::DetachAllUSBDevices(BOOL aDone)
 /**
  *  @note Locks this object for writing.
  */
-STDMETHODIMP SessionMachine::OnSessionEnd(ISession *aSession,
-                                          IProgress **aProgress)
+HRESULT SessionMachine::onSessionEnd(const ComPtr<ISession> &aSession,
+                                     ComPtr<IProgress> &aProgress)
 {
     LogFlowThisFuncEnter();
 
-    AssertReturn(aSession, E_INVALIDARG);
-    AssertReturn(aProgress, E_INVALIDARG);
-
-    AutoCaller autoCaller(this);
-
-    LogFlowThisFunc(("callerstate=%d\n", autoCaller.state()));
+    LogFlowThisFunc(("callerstate=%d\n", getObjectState().getState()));
     /*
      *  We don't assert below because it might happen that a non-direct session
      *  informs us it is closed right after we've been uninitialized -- it's ok.
      */
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     /* get IInternalSessionControl interface */
     ComPtr<IInternalSessionControl> control(aSession);
@@ -13657,272 +13288,141 @@ STDMETHODIMP SessionMachine::OnSessionEnd(ISession *aSession,
 
     if (control == mData->mSession.mDirectControl)
     {
-        ComAssertRet(aProgress, E_POINTER);
-
         /* The direct session is being normally closed by the client process
          * ----------------------------------------------------------------- */
 
         /* go to the closing state (essential for all open*Session() calls and
          * for #checkForDeath()) */
         Assert(mData->mSession.mState == SessionState_Locked);
-        mData->mSession.mState = SessionState_Unlocking;
-
-        /* set direct control to NULL to release the remote instance */
-        mData->mSession.mDirectControl.setNull();
-        LogFlowThisFunc(("Direct control is set to NULL\n"));
-
-        if (mData->mSession.mProgress)
-        {
-            /* finalize the progress, someone might wait if a frontend
-             * closes the session before powering on the VM. */
-            mData->mSession.mProgress->notifyComplete(E_FAIL,
-                                                      COM_IIDOF(ISession),
-                                                      getComponentName(),
-                                                      tr("The VM session was closed before any attempt to power it on"));
-            mData->mSession.mProgress.setNull();
-        }
-
-        /*  Create the progress object the client will use to wait until
-         * #checkForDeath() is called to uninitialize this session object after
-         * it releases the IPC semaphore.
-         * Note! Because we're "reusing" mProgress here, this must be a proxy
-         *       object just like for LaunchVMProcess. */
-        Assert(mData->mSession.mProgress.isNull());
-        ComObjPtr<ProgressProxy> progress;
-        progress.createObject();
-        ComPtr<IUnknown> pPeer(mPeer);
-        progress->init(mParent, pPeer,
-                       Bstr(tr("Closing session")).raw(),
-                       FALSE /* aCancelable */);
-        progress.queryInterfaceTo(aProgress);
-        mData->mSession.mProgress = progress;
-    }
-    else
-    {
-        /* the remote session is being normally closed */
-        Data::Session::RemoteControlList::iterator it =
-            mData->mSession.mRemoteControls.begin();
-        while (it != mData->mSession.mRemoteControls.end())
-        {
-            if (control == *it)
-                break;
-            ++it;
-        }
-        BOOL found = it != mData->mSession.mRemoteControls.end();
-        ComAssertMsgRet(found, ("The session is not found in the session list!"),
-                         E_INVALIDARG);
-        // This MUST be erase(it), not remove(*it) as the latter triggers a
-        // very nasty use after free due to the place where the value "lives".
-        mData->mSession.mRemoteControls.erase(it);
-    }
-
-    /* signal the client watcher thread, because the client is going away */
-    mParent->updateClientWatcher();
-
-    LogFlowThisFuncLeave();
-    return S_OK;
-}
-
-/**
- *  @note Locks this object for writing.
- */
-STDMETHODIMP SessionMachine::BeginSavingState(IProgress **aProgress, BSTR *aStateFilePath)
-{
-    LogFlowThisFuncEnter();
-
-    CheckComArgOutPointerValid(aProgress);
-    CheckComArgOutPointerValid(aStateFilePath);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    AssertReturn(    mData->mMachineState == MachineState_Paused
-                  && mConsoleTaskData.mLastState == MachineState_Null
-                  && mConsoleTaskData.strStateFilePath.isEmpty(),
-                 E_FAIL);
-
-    /* create a progress object to track operation completion */
-    ComObjPtr<Progress> pProgress;
-    pProgress.createObject();
-    pProgress->init(getVirtualBox(),
-                    static_cast<IMachine *>(this) /* aInitiator */,
-                    Bstr(tr("Saving the execution state of the virtual machine")).raw(),
-                    FALSE /* aCancelable */);
-
-    Utf8Str strStateFilePath;
-    /* stateFilePath is null when the machine is not running */
-    if (mData->mMachineState == MachineState_Paused)
-        composeSavedStateFilename(strStateFilePath);
-
-    /* fill in the console task data */
-    mConsoleTaskData.mLastState = mData->mMachineState;
-    mConsoleTaskData.strStateFilePath = strStateFilePath;
-    mConsoleTaskData.mProgress = pProgress;
-
-    /* set the state to Saving (this is expected by Console::SaveState()) */
-    setMachineState(MachineState_Saving);
-
-    strStateFilePath.cloneTo(aStateFilePath);
-    pProgress.queryInterfaceTo(aProgress);
-
-    return S_OK;
-}
-
-/**
- *  @note Locks mParent + this object for writing.
- */
-STDMETHODIMP SessionMachine::EndSavingState(LONG iResult, IN_BSTR aErrMsg)
-{
-    LogFlowThisFunc(("\n"));
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
-    /* endSavingState() need mParent lock */
-    AutoMultiWriteLock2 alock(mParent, this COMMA_LOCKVAL_SRC_POS);
-
-    AssertReturn(    (   (SUCCEEDED(iResult) && mData->mMachineState == MachineState_Saved)
-                      || (FAILED(iResult) && mData->mMachineState == MachineState_Saving))
-                  && mConsoleTaskData.mLastState != MachineState_Null
-                  && !mConsoleTaskData.strStateFilePath.isEmpty(),
-                 E_FAIL);
-
-    /*
-     * On failure, set the state to the state we had when BeginSavingState()
-     * was called (this is expected by Console::SaveState() and the associated
-     * task). On success the VM process already changed the state to
-     * MachineState_Saved, so no need to do anything.
-     */
-    if (FAILED(iResult))
-        setMachineState(mConsoleTaskData.mLastState);
-
-    return endSavingState(iResult, aErrMsg);
-}
-
-/**
- *  @note Locks this object for writing.
- */
-STDMETHODIMP SessionMachine::AdoptSavedState(IN_BSTR aSavedStateFile)
-{
-    LogFlowThisFunc(("\n"));
-
-    CheckComArgStrNotEmptyOrNull(aSavedStateFile);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+        mData->mSession.mState = SessionState_Unlocking;
 
-    AssertReturn(   mData->mMachineState == MachineState_PoweredOff
-                 || mData->mMachineState == MachineState_Teleported
-                 || mData->mMachineState == MachineState_Aborted
-                 , E_FAIL); /** @todo setError. */
+        /* set direct control to NULL to release the remote instance */
+        mData->mSession.mDirectControl.setNull();
+        LogFlowThisFunc(("Direct control is set to NULL\n"));
 
-    Utf8Str stateFilePathFull = aSavedStateFile;
-    int vrc = calculateFullPath(stateFilePathFull, stateFilePathFull);
-    if (RT_FAILURE(vrc))
-        return setError(VBOX_E_FILE_ERROR,
-                        tr("Invalid saved state file path '%ls' (%Rrc)"),
-                        aSavedStateFile,
-                        vrc);
+        if (mData->mSession.mProgress)
+        {
+            /* finalize the progress, someone might wait if a frontend
+             * closes the session before powering on the VM. */
+            mData->mSession.mProgress->notifyComplete(E_FAIL,
+                                                      COM_IIDOF(ISession),
+                                                      getComponentName(),
+                                                      tr("The VM session was closed before any attempt to power it on"));
+            mData->mSession.mProgress.setNull();
+        }
 
-    mSSData->strStateFilePath = stateFilePathFull;
+        /*  Create the progress object the client will use to wait until
+         * #checkForDeath() is called to uninitialize this session object after
+         * it releases the IPC semaphore.
+         * Note! Because we're "reusing" mProgress here, this must be a proxy
+         *       object just like for LaunchVMProcess. */
+        Assert(mData->mSession.mProgress.isNull());
+        ComObjPtr<ProgressProxy> progress;
+        progress.createObject();
+        ComPtr<IUnknown> pPeer(mPeer);
+        progress->init(mParent, pPeer,
+                       Bstr(tr("Closing session")).raw(),
+                       FALSE /* aCancelable */);
+        progress.queryInterfaceTo(aProgress.asOutParam());
+        mData->mSession.mProgress = progress;
+    }
+    else
+    {
+        /* the remote session is being normally closed */
+        Data::Session::RemoteControlList::iterator it =
+            mData->mSession.mRemoteControls.begin();
+        while (it != mData->mSession.mRemoteControls.end())
+        {
+            if (control == *it)
+                break;
+            ++it;
+        }
+        BOOL found = it != mData->mSession.mRemoteControls.end();
+        ComAssertMsgRet(found, ("The session is not found in the session list!"),
+                         E_INVALIDARG);
+        // This MUST be erase(it), not remove(*it) as the latter triggers a
+        // very nasty use after free due to the place where the value "lives".
+        mData->mSession.mRemoteControls.erase(it);
+    }
 
-    /* The below setMachineState() will detect the state transition and will
-     * update the settings file */
+    /* signal the client watcher thread, because the client is going away */
+    mParent->i_updateClientWatcher();
 
-    return setMachineState(MachineState_Saved);
+    LogFlowThisFuncLeave();
+    return S_OK;
 }
 
-STDMETHODIMP SessionMachine::PullGuestProperties(ComSafeArrayOut(BSTR, aNames),
-                                                 ComSafeArrayOut(BSTR, aValues),
-                                                 ComSafeArrayOut(LONG64, aTimestamps),
-                                                 ComSafeArrayOut(BSTR, aFlags))
+HRESULT SessionMachine::pullGuestProperties(std::vector<com::Utf8Str> &aNames,
+                                            std::vector<com::Utf8Str> &aValues,
+                                            std::vector<LONG64>       &aTimestamps,
+                                            std::vector<com::Utf8Str> &aFlags)
 {
     LogFlowThisFunc(("\n"));
 
 #ifdef VBOX_WITH_GUEST_PROPS
     using namespace guestProp;
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    CheckComArgOutSafeArrayPointerValid(aNames);
-    CheckComArgOutSafeArrayPointerValid(aValues);
-    CheckComArgOutSafeArrayPointerValid(aTimestamps);
-    CheckComArgOutSafeArrayPointerValid(aFlags);
-
     size_t cEntries = mHWData->mGuestProperties.size();
-    com::SafeArray<BSTR> names(cEntries);
-    com::SafeArray<BSTR> values(cEntries);
-    com::SafeArray<LONG64> timestamps(cEntries);
-    com::SafeArray<BSTR> flags(cEntries);
-    unsigned i = 0;
+    aNames.resize(cEntries);
+    aValues.resize(cEntries);
+    aTimestamps.resize(cEntries);
+    aFlags.resize(cEntries);
+
+    size_t  i = 0;
     for (HWData::GuestPropertyMap::iterator it = mHWData->mGuestProperties.begin();
          it != mHWData->mGuestProperties.end();
-         ++it)
+         ++it, ++i)
     {
         char szFlags[MAX_FLAGS_LEN + 1];
-        it->first.cloneTo(&names[i]);
-        it->second.strValue.cloneTo(&values[i]);
-        timestamps[i] = it->second.mTimestamp;
+        aNames[i] = it->first;
+        aValues[i] = it->second.strValue;
+        aTimestamps[i] = it->second.mTimestamp;
+
         /* If it is NULL, keep it NULL. */
         if (it->second.mFlags)
         {
             writeFlags(it->second.mFlags, szFlags);
-            Bstr(szFlags).cloneTo(&flags[i]);
+            aFlags[i] = szFlags;
         }
         else
-            flags[i] = NULL;
-        ++i;
+            aFlags[i] = "";
     }
-    names.detachTo(ComSafeArrayOutArg(aNames));
-    values.detachTo(ComSafeArrayOutArg(aValues));
-    timestamps.detachTo(ComSafeArrayOutArg(aTimestamps));
-    flags.detachTo(ComSafeArrayOutArg(aFlags));
     return S_OK;
 #else
     ReturnComNotImplemented();
 #endif
 }
 
-STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
-                                               IN_BSTR aValue,
-                                               LONG64 aTimestamp,
-                                               IN_BSTR aFlags)
+HRESULT SessionMachine::pushGuestProperty(const com::Utf8Str &aName,
+                                          const com::Utf8Str &aValue,
+                                          LONG64 aTimestamp,
+                                          const com::Utf8Str &aFlags,
+                                          BOOL *aNotify)
 {
     LogFlowThisFunc(("\n"));
 
 #ifdef VBOX_WITH_GUEST_PROPS
     using namespace guestProp;
 
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgNotNull(aValue);
-    CheckComArgNotNull(aFlags);
+    *aNotify = FALSE;
 
     try
     {
         /*
          * Convert input up front.
          */
-        Utf8Str  utf8Name(aName);
         uint32_t fFlags = NILFLAG;
-        if (aFlags)
+        if (aFlags.length())
         {
-            Utf8Str utf8Flags(aFlags);
-            int vrc = validateFlags(utf8Flags.c_str(), &fFlags);
+            int vrc = validateFlags(aFlags.c_str(), &fFlags);
             AssertRCReturn(vrc, E_INVALIDARG);
         }
 
         /*
          * Now grab the object lock, validate the state and do the update.
          */
-        AutoCaller autoCaller(this);
-        if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -13932,6 +13432,7 @@ STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
             case MachineState_Running:
             case MachineState_Teleporting:
             case MachineState_TeleportingPausedVM:
+            case MachineState_OnlineSnapshotting:
             case MachineState_LiveSnapshotting:
             case MachineState_DeletingSnapshotOnline:
             case MachineState_DeletingSnapshotPaused:
@@ -13944,11 +13445,11 @@ STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
                                       VBOX_E_INVALID_VM_STATE);
         }
 
-        setModified(IsModified_MachineData);
+        i_setModified(IsModified_MachineData);
         mHWData.backup();
 
-        bool fDelete = !RT_VALID_PTR(aValue) || *(aValue) == '\0';
-        HWData::GuestPropertyMap::iterator it = mHWData->mGuestProperties.find(utf8Name);
+        bool fDelete = !aValue.length();
+        HWData::GuestPropertyMap::iterator it = mHWData->mGuestProperties.find(aName);
         if (it != mHWData->mGuestProperties.end())
         {
             if (!fDelete)
@@ -13969,7 +13470,7 @@ STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
             prop.mTimestamp = aTimestamp;
             prop.mFlags     = fFlags;
 
-            mHWData->mGuestProperties[utf8Name] = prop;
+            mHWData->mGuestProperties[aName] = prop;
             mData->mGuestPropertiesModified = TRUE;
         }
 
@@ -13979,16 +13480,17 @@ STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
         if (    mHWData->mGuestPropertyNotificationPatterns.isEmpty()
              || RTStrSimplePatternMultiMatch(mHWData->mGuestPropertyNotificationPatterns.c_str(),
                                              RTSTR_MAX,
-                                             utf8Name.c_str(),
+                                             aName.c_str(),
                                              RTSTR_MAX, NULL)
            )
         {
             alock.release();
 
-            mParent->onGuestPropertyChange(mData->mUuid,
-                                           aName,
-                                           aValue,
-                                           aFlags);
+            mParent->i_onGuestPropertyChange(mData->mUuid,
+                                             Bstr(aName).raw(),
+                                             Bstr(aValue).raw(),
+                                             Bstr(aFlags).raw());
+            *aNotify = TRUE;
         }
     }
     catch (...)
@@ -14001,13 +13503,11 @@ STDMETHODIMP SessionMachine::PushGuestProperty(IN_BSTR aName,
 #endif
 }
 
-STDMETHODIMP SessionMachine::LockMedia()
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
+HRESULT SessionMachine::lockMedia()
+{
     AutoMultiWriteLock2 alock(this->lockHandle(),
-                              &mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+                              &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     AssertReturn(   mData->mMachineState == MachineState_Starting
                  || mData->mMachineState == MachineState_Restoring
@@ -14015,48 +13515,40 @@ STDMETHODIMP SessionMachine::LockMedia()
 
     clearError();
     alock.release();
-    return lockMedia();
+    return i_lockMedia();
 }
 
-STDMETHODIMP SessionMachine::UnlockMedia()
+HRESULT SessionMachine::unlockMedia()
 {
-    unlockMedia();
-    return S_OK;
+    HRESULT hrc = i_unlockMedia();
+    return hrc;
 }
 
-STDMETHODIMP SessionMachine::EjectMedium(IMediumAttachment *aAttachment,
-                                         IMediumAttachment **aNewAttachment)
+HRESULT SessionMachine::ejectMedium(const ComPtr<IMediumAttachment> &aAttachment,
+                                    ComPtr<IMediumAttachment> &aNewAttachment)
 {
-    CheckComArgNotNull(aAttachment);
-    CheckComArgOutPointerValid(aNewAttachment);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // request the host lock first, since might be calling Host methods for getting host drives;
     // next, protect the media tree all the while we're in here, as well as our member variables
-    AutoMultiWriteLock3 multiLock(mParent->host()->lockHandle(),
+    AutoMultiWriteLock3 multiLock(mParent->i_host()->lockHandle(),
                                   this->lockHandle(),
-                                  &mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+                                  &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
-    ComObjPtr<MediumAttachment> pAttach = static_cast<MediumAttachment *>(aAttachment);
+    IMediumAttachment *iAttach = aAttachment;
+    ComObjPtr<MediumAttachment> pAttach = static_cast<MediumAttachment *>(iAttach);
 
     Bstr ctrlName;
     LONG lPort;
     LONG lDevice;
     bool fTempEject;
     {
-        AutoCaller autoAttachCaller(this);
-        if (FAILED(autoAttachCaller.rc())) return autoAttachCaller.rc();
-
         AutoReadLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
 
         /* Need to query the details first, as the IMediumAttachment reference
          * might be to the original settings, which we are going to change. */
-        ctrlName = pAttach->getControllerName();
-        lPort = pAttach->getPort();
-        lDevice = pAttach->getDevice();
-        fTempEject = pAttach->getTempEject();
+        ctrlName = pAttach->i_getControllerName();
+        lPort = pAttach->i_getPort();
+        lDevice = pAttach->i_getDevice();
+        fTempEject = pAttach->i_getTempEject();
     }
 
     if (!fTempEject)
@@ -14064,17 +13556,17 @@ STDMETHODIMP SessionMachine::EjectMedium(IMediumAttachment *aAttachment,
         /* Remember previously mounted medium. The medium before taking the
          * backup is not necessarily the same thing. */
         ComObjPtr<Medium> oldmedium;
-        oldmedium = pAttach->getMedium();
+        oldmedium = pAttach->i_getMedium();
 
-        setModified(IsModified_Storage);
+        i_setModified(IsModified_Storage);
         mMediaData.backup();
 
         // The backup operation makes the pAttach reference point to the
         // old settings. Re-get the correct reference.
-        pAttach = findAttachment(mMediaData->mAttachments,
-                                 ctrlName.raw(),
-                                 lPort,
-                                 lDevice);
+        pAttach = i_findAttachment(mMediaData->mAttachments,
+                                   ctrlName.raw(),
+                                   lPort,
+                                   lDevice);
 
         {
             AutoCaller autoAttachCaller(this);
@@ -14082,23 +13574,23 @@ STDMETHODIMP SessionMachine::EjectMedium(IMediumAttachment *aAttachment,
 
             AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
             if (!oldmedium.isNull())
-                oldmedium->removeBackReference(mData->mUuid);
+                oldmedium->i_removeBackReference(mData->mUuid);
 
-            pAttach->updateMedium(NULL);
-            pAttach->updateEjected();
+            pAttach->i_updateMedium(NULL);
+            pAttach->i_updateEjected();
         }
 
-        setModified(IsModified_Storage);
+        i_setModified(IsModified_Storage);
     }
     else
     {
         {
             AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
-            pAttach->updateEjected();
+            pAttach->i_updateEjected();
         }
     }
 
-    pAttach.queryInterfaceTo(aNewAttachment);
+    pAttach.queryInterfaceTo(aNewAttachment.asOutParam());
 
     return S_OK;
 }
@@ -14122,7 +13614,7 @@ STDMETHODIMP SessionMachine::EjectMedium(IMediumAttachment *aAttachment,
  *
  * @note Locks this object for writing.
  */
-bool SessionMachine::checkForDeath()
+bool SessionMachine::i_checkForDeath()
 {
     Uninit::Reason reason;
     bool terminated = false;
@@ -14162,7 +13654,7 @@ bool SessionMachine::checkForDeath()
     return terminated;
 }
 
-void SessionMachine::getTokenId(Utf8Str &strTokenId)
+void SessionMachine::i_getTokenId(Utf8Str &strTokenId)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14176,7 +13668,7 @@ void SessionMachine::getTokenId(Utf8Str &strTokenId)
         mClientToken->getId(strTokenId);
 }
 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */
-IToken *SessionMachine::getToken()
+IToken *SessionMachine::i_getToken()
 {
     LogFlowThisFunc(("\n"));
 
@@ -14191,7 +13683,7 @@ IToken *SessionMachine::getToken()
 }
 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */
 
-Machine::ClientToken *SessionMachine::getClientToken()
+Machine::ClientToken *SessionMachine::i_getClientToken()
 {
     LogFlowThisFunc(("\n"));
 
@@ -14205,7 +13697,7 @@ Machine::ClientToken *SessionMachine::getClientToken()
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter)
+HRESULT SessionMachine::i_onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14215,7 +13707,8 @@ HRESULT SessionMachine::onNetworkAdapterChange(INetworkAdapter *networkAdapter,
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14228,8 +13721,9 @@ HRESULT SessionMachine::onNetworkAdapterChange(INetworkAdapter *networkAdapter,
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
-                                 NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort, IN_BSTR aGuestIp, LONG aGuestPort)
+HRESULT SessionMachine::i_onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemove, IN_BSTR aRuleName,
+                                                  NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort,
+                                                  IN_BSTR aGuestIp, LONG aGuestPort)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14239,7 +13733,8 @@ HRESULT SessionMachine::onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemov
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14249,14 +13744,15 @@ HRESULT SessionMachine::onNATRedirectRuleChange(ULONG ulSlot, BOOL aNatRuleRemov
      * instead acting like callback we ask IVirtualBox deliver corresponding event
      */
 
-    mParent->onNatRedirectChange(getId(), ulSlot, RT_BOOL(aNatRuleRemove), aRuleName, aProto, aHostIp, (uint16_t)aHostPort, aGuestIp, (uint16_t)aGuestPort);
+    mParent->i_onNatRedirectChange(i_getId(), ulSlot, RT_BOOL(aNatRuleRemove), aRuleName, aProto, aHostIp,
+                                   (uint16_t)aHostPort, aGuestIp, (uint16_t)aGuestPort);
     return S_OK;
 }
 
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onSerialPortChange(ISerialPort *serialPort)
+HRESULT SessionMachine::i_onSerialPortChange(ISerialPort *serialPort)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14266,7 +13762,8 @@ HRESULT SessionMachine::onSerialPortChange(ISerialPort *serialPort)
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14279,7 +13776,7 @@ HRESULT SessionMachine::onSerialPortChange(ISerialPort *serialPort)
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onParallelPortChange(IParallelPort *parallelPort)
+HRESULT SessionMachine::i_onParallelPortChange(IParallelPort *parallelPort)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14289,7 +13786,8 @@ HRESULT SessionMachine::onParallelPortChange(IParallelPort *parallelPort)
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14302,7 +13800,7 @@ HRESULT SessionMachine::onParallelPortChange(IParallelPort *parallelPort)
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onStorageControllerChange()
+HRESULT SessionMachine::i_onStorageControllerChange()
 {
     LogFlowThisFunc(("\n"));
 
@@ -14312,7 +13810,8 @@ HRESULT SessionMachine::onStorageControllerChange()
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14325,7 +13824,7 @@ HRESULT SessionMachine::onStorageControllerChange()
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onMediumChange(IMediumAttachment *aAttachment, BOOL aForce)
+HRESULT SessionMachine::i_onMediumChange(IMediumAttachment *aAttachment, BOOL aForce)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14335,7 +13834,8 @@ HRESULT SessionMachine::onMediumChange(IMediumAttachment *aAttachment, BOOL aFor
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14348,7 +13848,7 @@ HRESULT SessionMachine::onMediumChange(IMediumAttachment *aAttachment, BOOL aFor
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onCPUChange(ULONG aCPU, BOOL aRemove)
+HRESULT SessionMachine::i_onCPUChange(ULONG aCPU, BOOL aRemove)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14358,7 +13858,8 @@ HRESULT SessionMachine::onCPUChange(ULONG aCPU, BOOL aRemove)
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14368,7 +13869,7 @@ HRESULT SessionMachine::onCPUChange(ULONG aCPU, BOOL aRemove)
     return directControl->OnCPUChange(aCPU, aRemove);
 }
 
-HRESULT SessionMachine::onCPUExecutionCapChange(ULONG aExecutionCap)
+HRESULT SessionMachine::i_onCPUExecutionCapChange(ULONG aExecutionCap)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14378,7 +13879,8 @@ HRESULT SessionMachine::onCPUExecutionCapChange(ULONG aExecutionCap)
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14391,7 +13893,7 @@ HRESULT SessionMachine::onCPUExecutionCapChange(ULONG aExecutionCap)
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onVRDEServerChange(BOOL aRestart)
+HRESULT SessionMachine::i_onVRDEServerChange(BOOL aRestart)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14401,7 +13903,8 @@ HRESULT SessionMachine::onVRDEServerChange(BOOL aRestart)
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14414,7 +13917,7 @@ HRESULT SessionMachine::onVRDEServerChange(BOOL aRestart)
 /**
  * @note Locks this object for reading.
  */
-HRESULT SessionMachine::onVideoCaptureChange()
+HRESULT SessionMachine::i_onVideoCaptureChange()
 {
     LogFlowThisFunc(("\n"));
 
@@ -14424,7 +13927,8 @@ HRESULT SessionMachine::onVideoCaptureChange()
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14437,7 +13941,7 @@ HRESULT SessionMachine::onVideoCaptureChange()
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onUSBControllerChange()
+HRESULT SessionMachine::i_onUSBControllerChange()
 {
     LogFlowThisFunc(("\n"));
 
@@ -14447,7 +13951,8 @@ HRESULT SessionMachine::onUSBControllerChange()
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14460,7 +13965,7 @@ HRESULT SessionMachine::onUSBControllerChange()
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onSharedFolderChange()
+HRESULT SessionMachine::i_onSharedFolderChange()
 {
     LogFlowThisFunc(("\n"));
 
@@ -14470,7 +13975,8 @@ HRESULT SessionMachine::onSharedFolderChange()
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14483,7 +13989,7 @@ HRESULT SessionMachine::onSharedFolderChange()
 /**
  * @note Locks this object for reading.
  */
-HRESULT SessionMachine::onClipboardModeChange(ClipboardMode_T aClipboardMode)
+HRESULT SessionMachine::i_onClipboardModeChange(ClipboardMode_T aClipboardMode)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14493,7 +13999,8 @@ HRESULT SessionMachine::onClipboardModeChange(ClipboardMode_T aClipboardMode)
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14506,7 +14013,7 @@ HRESULT SessionMachine::onClipboardModeChange(ClipboardMode_T aClipboardMode)
 /**
  * @note Locks this object for reading.
  */
-HRESULT SessionMachine::onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode)
+HRESULT SessionMachine::i_onDnDModeChange(DnDMode_T aDnDMode)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14516,20 +14023,21 @@ HRESULT SessionMachine::onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMo
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
     if (!directControl)
         return S_OK;
 
-    return directControl->OnDragAndDropModeChange(aDragAndDropMode);
+    return directControl->OnDnDModeChange(aDnDMode);
 }
 
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
+HRESULT SessionMachine::i_onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14539,7 +14047,8 @@ HRESULT SessionMachine::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14552,7 +14061,7 @@ HRESULT SessionMachine::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup)
 /**
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onStorageDeviceChange(IMediumAttachment *aAttachment, BOOL aRemove, BOOL aSilent)
+HRESULT SessionMachine::i_onStorageDeviceChange(IMediumAttachment *aAttachment, BOOL aRemove, BOOL aSilent)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14562,7 +14071,8 @@ HRESULT SessionMachine::onStorageDeviceChange(IMediumAttachment *aAttachment, BO
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* ignore notifications sent after #OnSessionEnd() is called */
@@ -14578,7 +14088,7 @@ HRESULT SessionMachine::onStorageDeviceChange(IMediumAttachment *aAttachment, BO
  *
  *  @note locks this object for reading.
  */
-bool SessionMachine::hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
+bool SessionMachine::i_hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
 {
     AutoCaller autoCaller(this);
     /* silently return if not ready -- this method may be called after the
@@ -14599,7 +14109,7 @@ bool SessionMachine::hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevic
         /** @todo Live Migration: snapshoting & teleporting. Need to fend things of
          *        elsewhere... */
             alock.release();
-            return mUSBDeviceFilters->hasMatchingFilter(aDevice, aMaskedIfs);
+            return mUSBDeviceFilters->i_hasMatchingFilter(aDevice, aMaskedIfs);
         default: break;
     }
 #else
@@ -14612,9 +14122,10 @@ bool SessionMachine::hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevic
 /**
  *  @note The calls shall hold no locks. Will temporarily lock this object for reading.
  */
-HRESULT SessionMachine::onUSBDeviceAttach(IUSBDevice *aDevice,
-                                          IVirtualBoxErrorInfo *aError,
-                                          ULONG aMaskedIfs)
+HRESULT SessionMachine::i_onUSBDeviceAttach(IUSBDevice *aDevice,
+                                            IVirtualBoxErrorInfo *aError,
+                                            ULONG aMaskedIfs,
+                                            const com::Utf8Str &aCaptureFilename)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14627,7 +14138,8 @@ HRESULT SessionMachine::onUSBDeviceAttach(IUSBDevice *aDevice,
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* fail on notifications sent after #OnSessionEnd() is called, it is
@@ -14639,14 +14151,14 @@ HRESULT SessionMachine::onUSBDeviceAttach(IUSBDevice *aDevice,
     AssertMsg(RTLockValidatorWriteLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorWriteLockGetCount(RTThreadSelf())));
     AssertMsg(RTLockValidatorReadLockGetCount(RTThreadSelf()) == 0, ("%d\n", RTLockValidatorReadLockGetCount(RTThreadSelf())));
 
-    return directControl->OnUSBDeviceAttach(aDevice, aError, aMaskedIfs);
+    return directControl->OnUSBDeviceAttach(aDevice, aError, aMaskedIfs, Bstr(aCaptureFilename).raw());
 }
 
 /**
  *  @note The calls shall hold no locks. Will temporarily lock this object for reading.
  */
-HRESULT SessionMachine::onUSBDeviceDetach(IN_BSTR aId,
-                                          IVirtualBoxErrorInfo *aError)
+HRESULT SessionMachine::i_onUSBDeviceDetach(IN_BSTR aId,
+                                            IVirtualBoxErrorInfo *aError)
 {
     LogFlowThisFunc(("\n"));
 
@@ -14659,7 +14171,8 @@ HRESULT SessionMachine::onUSBDeviceDetach(IN_BSTR aId,
     ComPtr<IInternalSessionControl> directControl;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
     }
 
     /* fail on notifications sent after #OnSessionEnd() is called, it is
@@ -14678,68 +14191,6 @@ HRESULT SessionMachine::onUSBDeviceDetach(IN_BSTR aId,
 /////////////////////////////////////////////////////////////////////////////
 
 /**
- *  Helper method to finalize saving the state.
- *
- *  @note Must be called from under this object's lock.
- *
- *  @param aRc      S_OK if the snapshot has been taken successfully
- *  @param aErrMsg  human readable error message for failure
- *
- *  @note Locks mParent + this objects for writing.
- */
-HRESULT SessionMachine::endSavingState(HRESULT aRc, const Utf8Str &aErrMsg)
-{
-    LogFlowThisFuncEnter();
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    HRESULT rc = S_OK;
-
-    if (SUCCEEDED(aRc))
-    {
-        mSSData->strStateFilePath = mConsoleTaskData.strStateFilePath;
-
-        /* save all VM settings */
-        rc = saveSettings(NULL);
-                // no need to check whether VirtualBox.xml needs saving also since
-                // we can't have a name change pending at this point
-    }
-    else
-    {
-        // delete the saved state file (it might have been already created);
-        // we need not check whether this is shared with a snapshot here because
-        // we certainly created this saved state file here anew
-        RTFileDelete(mConsoleTaskData.strStateFilePath.c_str());
-    }
-
-    /* notify the progress object about operation completion */
-    Assert(mConsoleTaskData.mProgress);
-    if (SUCCEEDED(aRc))
-        mConsoleTaskData.mProgress->notifyComplete(S_OK);
-    else
-    {
-        if (aErrMsg.length())
-            mConsoleTaskData.mProgress->notifyComplete(aRc,
-                                                       COM_IIDOF(ISession),
-                                                       getComponentName(),
-                                                       aErrMsg.c_str());
-        else
-            mConsoleTaskData.mProgress->notifyComplete(aRc);
-    }
-
-    /* clear out the temporary saved state data */
-    mConsoleTaskData.mLastState = MachineState_Null;
-    mConsoleTaskData.strStateFilePath.setNull();
-    mConsoleTaskData.mProgress.setNull();
-
-    LogFlowThisFuncLeave();
-    return rc;
-}
-
-/**
  * Deletes the given file if it is no longer in use by either the current machine state
  * (if the machine is "saved") or any of the machine's snapshots.
  *
@@ -14749,10 +14200,11 @@ HRESULT SessionMachine::endSavingState(HRESULT aRc, const Utf8Str &aErrMsg)
  * is therefore critical. I know, it's all rather messy.
  *
  * @param strStateFile
- * @param pSnapshotToIgnore  Passed to Snapshot::sharesSavedStateFile(); this snapshot is ignored in the test for whether the saved state file is in use.
+ * @param pSnapshotToIgnore  Passed to Snapshot::sharesSavedStateFile(); this snapshot is ignored in
+ * the test for whether the saved state file is in use.
  */
-void SessionMachine::releaseSavedStateFile(const Utf8Str &strStateFile,
-                                           Snapshot *pSnapshotToIgnore)
+void SessionMachine::i_releaseSavedStateFile(const Utf8Str &strStateFile,
+                                             Snapshot *pSnapshotToIgnore)
 {
     // it is safe to delete this saved state file if it is not currently in use by the machine ...
     if (    (strStateFile.isNotEmpty())
@@ -14760,7 +14212,7 @@ void SessionMachine::releaseSavedStateFile(const Utf8Str &strStateFile,
        )
         // ... and it must also not be shared with other snapshots
         if (    !mData->mFirstSnapshot
-             || !mData->mFirstSnapshot->sharesSavedStateFile(strStateFile, pSnapshotToIgnore)
+             || !mData->mFirstSnapshot->i_sharesSavedStateFile(strStateFile, pSnapshotToIgnore)
                                 // this checks the SnapshotMachine's state file paths
            )
             RTFileDelete(strStateFile.c_str());
@@ -14785,13 +14237,13 @@ void SessionMachine::releaseSavedStateFile(const Utf8Str &strStateFile,
  * The locks made by this method must be undone by calling #unlockMedia() when
  * no more needed.
  */
-HRESULT SessionMachine::lockMedia()
+HRESULT SessionMachine::i_lockMedia()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
     AutoMultiWriteLock2 alock(this->lockHandle(),
-                              &mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+                              &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     /* bail out if trying to lock things with already set up locking */
     AssertReturn(mData->mSession.mLockedMedia.IsEmpty(), E_FAIL);
@@ -14804,8 +14256,8 @@ HRESULT SessionMachine::lockMedia()
          ++it)
     {
         MediumAttachment* pAtt = *it;
-        DeviceType_T devType = pAtt->getType();
-        Medium *pMedium = pAtt->getMedium();
+        DeviceType_T devType = pAtt->i_getType();
+        Medium *pMedium = pAtt->i_getMedium();
 
         MediumLockList *pMediumLockList(new MediumLockList());
         // There can be attachments without a medium (floppy/dvd), and thus
@@ -14814,16 +14266,17 @@ HRESULT SessionMachine::lockMedia()
         // attached later.
         if (pMedium != NULL)
         {
-            MediumType_T mediumType = pMedium->getType();
+            MediumType_T mediumType = pMedium->i_getType();
             bool fIsReadOnlyLock =    mediumType == MediumType_Readonly
                                    || mediumType == MediumType_Shareable;
             bool fIsVitalImage = (devType == DeviceType_HardDisk);
 
             alock.release();
-            mrc = pMedium->createMediumLockList(fIsVitalImage /* fFailIfInaccessible */,
-                                                !fIsReadOnlyLock /* fMediumLockWrite */,
-                                                NULL,
-                                                *pMediumLockList);
+            mrc = pMedium->i_createMediumLockList(fIsVitalImage /* fFailIfInaccessible */,
+                                                  !fIsReadOnlyLock /* fMediumLockWrite */,
+                                                  false /* fMediumLockWriteAll */,
+                                                  NULL,
+                                                  *pMediumLockList);
             alock.acquire();
             if (FAILED(mrc))
             {
@@ -14862,10 +14315,10 @@ HRESULT SessionMachine::lockMedia()
 /**
  * Undoes the locks made by by #lockMedia().
  */
-void SessionMachine::unlockMedia()
+HRESULT SessionMachine::i_unlockMedia()
 {
     AutoCaller autoCaller(this);
-    AssertComRCReturnVoid(autoCaller.rc());
+    AssertComRCReturn(autoCaller.rc(),autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -14875,18 +14328,19 @@ void SessionMachine::unlockMedia()
 
     HRESULT rc = mData->mSession.mLockedMedia.Clear();
     AssertComRC(rc);
+    return rc;
 }
 
 /**
  * Helper to change the machine state (reimplementation).
  *
  * @note Locks this object for writing.
- * @note This method must not call saveSettings or SaveSettings, otherwise
+ * @note This method must not call i_saveSettings or SaveSettings, otherwise
  *       it can cause crashes in random places due to unexpectedly committing
  *       the current settings. The caller is responsible for that. The call
  *       to saveStateSettings is fine, because this method does not commit.
  */
-HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
+HRESULT SessionMachine::i_setMachineState(MachineState_T aMachineState)
 {
     LogFlowThisFuncEnter();
     LogFlowThisFunc(("aMachineState=%s\n", Global::stringifyMachineState(aMachineState) ));
@@ -14932,6 +14386,7 @@ HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
     else if (   (   oldMachineState == MachineState_Running
                  || oldMachineState == MachineState_Paused
                  || oldMachineState == MachineState_Teleporting
+                 || oldMachineState == MachineState_OnlineSnapshotting
                  || oldMachineState == MachineState_LiveSnapshotting
                  || oldMachineState == MachineState_Stuck
                  || oldMachineState == MachineState_Starting
@@ -14946,11 +14401,6 @@ HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
                  || aMachineState == MachineState_Teleported
                  || aMachineState == MachineState_Aborted
                 )
-             /* ignore PoweredOff->Saving->PoweredOff transition when taking a
-              * snapshot */
-             && (   mConsoleTaskData.mSnapshot.isNull()
-                 || mConsoleTaskData.mLastState >= MachineState_Running /** @todo Live Migration: clean up (lazy bird) */
-                )
             )
     {
         /* The EMT thread has just stopped, unlock attached media. Note that as
@@ -14983,7 +14433,7 @@ HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
             )
     {
         /*
-         *  delete the saved state after Console::ForgetSavedState() is called
+         *  delete the saved state after SessionMachine::ForgetSavedState() is called
          *  or if the VM process (owning a direct VM session) crashed while the
          *  VM was Saved
          */
@@ -15026,7 +14476,7 @@ HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
 
             // it is safe to delete the saved state file if ...
             if (    !mData->mFirstSnapshot      // ... we have no snapshots or
-                 || !mData->mFirstSnapshot->sharesSavedStateFile(mSSData->strStateFilePath, NULL /* pSnapshotToIgnore */)
+                 || !mData->mFirstSnapshot->i_sharesSavedStateFile(mSSData->strStateFilePath, NULL /* pSnapshotToIgnore */)
                                                 // ... none of the snapshots share the saved state file
                )
                 RTFileDelete(mSSData->strStateFilePath.c_str());
@@ -15037,12 +14487,13 @@ HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
     }
 
     /* redirect to the underlying peer machine */
-    mPeer->setMachineState(aMachineState);
+    mPeer->i_setMachineState(aMachineState);
 
-    if (   aMachineState == MachineState_PoweredOff
-        || aMachineState == MachineState_Teleported
-        || aMachineState == MachineState_Aborted
-        || aMachineState == MachineState_Saved)
+    if (   oldMachineState != MachineState_RestoringSnapshot
+        && (   aMachineState == MachineState_PoweredOff
+            || aMachineState == MachineState_Teleported
+            || aMachineState == MachineState_Aborted
+            || aMachineState == MachineState_Saved))
     {
         /* the machine has stopped execution
          * (or the saved state file was adopted) */
@@ -15067,27 +14518,62 @@ HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
     {
         /* Make sure any transient guest properties get removed from the
          * property store on shutdown. */
-
-        HWData::GuestPropertyMap::const_iterator it;
         BOOL fNeedsSaving = mData->mGuestPropertiesModified;
-        if (!fNeedsSaving)
-            for (it = mHWData->mGuestProperties.begin();
-                 it != mHWData->mGuestProperties.end(); ++it)
-                if (   (it->second.mFlags & guestProp::TRANSIENT)
-                    || (it->second.mFlags & guestProp::TRANSRESET))
-                {
-                    fNeedsSaving = true;
-                    break;
-                }
+
+        /* remove it from the settings representation */
+        settings::GuestPropertiesList &llGuestProperties = mData->pMachineConfigFile->hardwareMachine.llGuestProperties;
+        for (settings::GuestPropertiesList::iterator it = llGuestProperties.begin();
+             it != llGuestProperties.end();
+             /*nothing*/)
+        {
+            const settings::GuestProperty &prop = *it;
+            if (   prop.strFlags.contains("TRANSRESET", Utf8Str::CaseInsensitive)
+                || prop.strFlags.contains("TRANSIENT", Utf8Str::CaseInsensitive))
+            {
+                it = llGuestProperties.erase(it);
+                fNeedsSaving = true;
+            }
+            else
+            {
+                ++it;
+            }
+        }
+
+        /* Additionally remove it from the HWData representation. Required to
+         * keep everything in sync, as this is what the API keeps using. */
+        HWData::GuestPropertyMap &llHWGuestProperties = mHWData->mGuestProperties;
+        for (HWData::GuestPropertyMap::iterator it = llHWGuestProperties.begin();
+             it != llHWGuestProperties.end();
+             /*nothing*/)
+        {
+            uint32_t fFlags = it->second.mFlags;
+            if (   fFlags & guestProp::TRANSIENT
+                || fFlags & guestProp::TRANSRESET)
+            {
+                /* iterator where we need to continue after the erase call
+                 * (C++03 is a fact still, and it doesn't return the iterator
+                 * which would allow continuing) */
+                HWData::GuestPropertyMap::iterator it2 = it;
+                ++it2;
+                llHWGuestProperties.erase(it);
+                it = it2;
+                fNeedsSaving = true;
+            }
+            else
+            {
+                ++it;
+            }
+        }
+
         if (fNeedsSaving)
         {
             mData->mCurrentStateModified = TRUE;
             stsFlags |= SaveSTS_CurStateModified;
         }
     }
-#endif
+#endif /* VBOX_WITH_GUEST_PROPS */
 
-    rc = saveStateSettings(stsFlags);
+    rc = i_saveStateSettings(stsFlags);
 
     if (   (   oldMachineState != MachineState_PoweredOff
             && oldMachineState != MachineState_Aborted
@@ -15113,7 +14599,7 @@ HRESULT SessionMachine::setMachineState(MachineState_T aMachineState)
  *
  *  @note Locks this object for reading, then calls a client process.
  */
-HRESULT SessionMachine::updateMachineStateOnClient()
+HRESULT SessionMachine::i_updateMachineStateOnClient()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
@@ -15122,7 +14608,8 @@ HRESULT SessionMachine::updateMachineStateOnClient()
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
         AssertReturn(!!mData, E_FAIL);
-        directControl = mData->mSession.mDirectControl;
+        if (mData->mSession.mLockType == LockType_VM)
+            directControl = mData->mSession.mDirectControl;
 
         /* directControl may be already set to NULL here in #OnSessionEnd()
          * called too early by the direct session process while there is still
@@ -15135,9 +14622,207 @@ HRESULT SessionMachine::updateMachineStateOnClient()
 
         if (mData->mSession.mState == SessionState_Unlocking)
             return S_OK;
-
-        AssertReturn(!directControl.isNull(), E_FAIL);
     }
 
+    /* ignore notifications sent after #OnSessionEnd() is called */
+    if (!directControl)
+        return S_OK;
+
     return directControl->UpdateMachineState(mData->mMachineState);
 }
+
+
+/**
+ * Static Machine method that can get passed to RTThreadCreate to
+ * have a thread started for a Task. See Machine::Task.
+ */
+/* static */ DECLCALLBACK(int) Machine::taskHandler(RTTHREAD /* thread */, void *pvUser)
+{
+    AssertReturn(pvUser, VERR_INVALID_POINTER);
+
+    Task *pTask = static_cast<Task *>(pvUser);
+    pTask->handler();
+    /** @todo r=klaus it would be safer to update the progress object here,
+     * as it avoids possible races due to scoping issues/tricks in the handler */
+    // it's our responsibility to delete the task
+    delete pTask;
+
+    return 0;
+}
+
+/*static*/
+HRESULT Machine::i_setErrorStatic(HRESULT aResultCode, const char *pcszMsg, ...)
+{
+    va_list args;
+    va_start(args, pcszMsg);
+    HRESULT rc = setErrorInternal(aResultCode,
+                                  getStaticClassIID(),
+                                  getStaticComponentName(),
+                                  Utf8Str(pcszMsg, args),
+                                  false /* aWarning */,
+                                  true /* aLogIt */);
+    va_end(args);
+    return rc;
+}
+
+
+HRESULT Machine::updateState(MachineState_T aState)
+{
+    NOREF(aState);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::beginPowerUp(const ComPtr<IProgress> &aProgress)
+{
+    NOREF(aProgress);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::endPowerUp(LONG aResult)
+{
+    NOREF(aResult);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::beginPoweringDown(ComPtr<IProgress> &aProgress)
+{
+    NOREF(aProgress);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::endPoweringDown(LONG aResult,
+                                 const com::Utf8Str &aErrMsg)
+{
+    NOREF(aResult);
+    NOREF(aErrMsg);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::runUSBDeviceFilters(const ComPtr<IUSBDevice> &aDevice,
+                                     BOOL  *aMatched,
+                                     ULONG *aMaskedInterfaces)
+{
+    NOREF(aDevice);
+    NOREF(aMatched);
+    NOREF(aMaskedInterfaces);
+    ReturnComNotImplemented();
+
+}
+
+HRESULT Machine::captureUSBDevice(const com::Guid &aId, const com::Utf8Str &aCaptureFilename)
+{
+    NOREF(aId); NOREF(aCaptureFilename);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::detachUSBDevice(const com::Guid &aId,
+                                 BOOL aDone)
+{
+    NOREF(aId);
+    NOREF(aDone);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::autoCaptureUSBDevices()
+{
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::detachAllUSBDevices(BOOL aDone)
+{
+    NOREF(aDone);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::onSessionEnd(const ComPtr<ISession> &aSession,
+                              ComPtr<IProgress> &aProgress)
+{
+    NOREF(aSession);
+    NOREF(aProgress);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::finishOnlineMergeMedium()
+{
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::pullGuestProperties(std::vector<com::Utf8Str> &aNames,
+                                     std::vector<com::Utf8Str> &aValues,
+                                     std::vector<LONG64> &aTimestamps,
+                                     std::vector<com::Utf8Str> &aFlags)
+{
+    NOREF(aNames);
+    NOREF(aValues);
+    NOREF(aTimestamps);
+    NOREF(aFlags);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::pushGuestProperty(const com::Utf8Str &aName,
+                                   const com::Utf8Str &aValue,
+                                   LONG64 aTimestamp,
+                                   const com::Utf8Str &aFlags,
+                                   BOOL *aNotify)
+{
+    NOREF(aName);
+    NOREF(aValue);
+    NOREF(aTimestamp);
+    NOREF(aFlags);
+    NOREF(aNotify);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::lockMedia()
+{
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::unlockMedia()
+{
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::ejectMedium(const ComPtr<IMediumAttachment> &aAttachment,
+                             ComPtr<IMediumAttachment> &aNewAttachment)
+{
+    NOREF(aAttachment);
+    NOREF(aNewAttachment);
+    ReturnComNotImplemented();
+}
+
+HRESULT Machine::reportVmStatistics(ULONG aValidStats,
+                                    ULONG aCpuUser,
+                                    ULONG aCpuKernel,
+                                    ULONG aCpuIdle,
+                                    ULONG aMemTotal,
+                                    ULONG aMemFree,
+                                    ULONG aMemBalloon,
+                                    ULONG aMemShared,
+                                    ULONG aMemCache,
+                                    ULONG aPagedTotal,
+                                    ULONG aMemAllocTotal,
+                                    ULONG aMemFreeTotal,
+                                    ULONG aMemBalloonTotal,
+                                    ULONG aMemSharedTotal,
+                                    ULONG aVmNetRx,
+                                    ULONG aVmNetTx)
+{
+    NOREF(aValidStats);
+    NOREF(aCpuUser);
+    NOREF(aCpuKernel);
+    NOREF(aCpuIdle);
+    NOREF(aMemTotal);
+    NOREF(aMemFree);
+    NOREF(aMemBalloon);
+    NOREF(aMemShared);
+    NOREF(aMemCache);
+    NOREF(aPagedTotal);
+    NOREF(aMemAllocTotal);
+    NOREF(aMemFreeTotal);
+    NOREF(aMemBalloonTotal);
+    NOREF(aMemSharedTotal);
+    NOREF(aVmNetRx);
+    NOREF(aVmNetTx);
+    ReturnComNotImplemented();
+}
diff --git a/src/VBox/Main/src-server/MachineImplCloneVM.cpp b/src/VBox/Main/src-server/MachineImplCloneVM.cpp
index 3a7507d..4013389 100644
--- a/src/VBox/Main/src-server/MachineImplCloneVM.cpp
+++ b/src/VBox/Main/src-server/MachineImplCloneVM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2014 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -61,7 +61,8 @@ typedef struct
 
 struct MachineCloneVMPrivate
 {
-    MachineCloneVMPrivate(MachineCloneVM *a_q, ComObjPtr<Machine> &a_pSrcMachine, ComObjPtr<Machine> &a_pTrgMachine, CloneMode_T a_mode, const RTCList<CloneOptions_T> &opts)
+    MachineCloneVMPrivate(MachineCloneVM *a_q, ComObjPtr<Machine> &a_pSrcMachine, ComObjPtr<Machine> &a_pTrgMachine,
+                          CloneMode_T a_mode, const RTCList<CloneOptions_T> &opts)
       : q_ptr(a_q)
       , p(a_pSrcMachine)
       , pSrcMachine(a_pSrcMachine)
@@ -89,7 +90,7 @@ struct MachineCloneVMPrivate
 
         HRESULT rc = pTask->q_ptr->run();
 
-        pTask->pProgress->notifyComplete(rc);
+        pTask->pProgress->i_notifyComplete(rc);
 
         pTask->q_ptr->destroy();
 
@@ -103,9 +104,12 @@ struct MachineCloneVMPrivate
     inline void updateProgressStats(MEDIUMTASKCHAIN &mtc, bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight) const;
     inline HRESULT addSaveState(const ComObjPtr<Machine> &machine, ULONG &uCount, ULONG &uTotalWeight);
     inline HRESULT queryBaseName(const ComPtr<IMedium> &pMedium, Utf8Str &strBaseName) const;
-    HRESULT queryMediasForMachineState(const RTCList<ComObjPtr<Machine> > &machineList, bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight);
-    HRESULT queryMediasForMachineAndChildStates(const RTCList<ComObjPtr<Machine> > &machineList, bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight);
-    HRESULT queryMediasForAllStates(const RTCList<ComObjPtr<Machine> > &machineList, bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight);
+    HRESULT queryMediasForMachineState(const RTCList<ComObjPtr<Machine> > &machineList,
+                                       bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight);
+    HRESULT queryMediasForMachineAndChildStates(const RTCList<ComObjPtr<Machine> > &machineList,
+                                                bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight);
+    HRESULT queryMediasForAllStates(const RTCList<ComObjPtr<Machine> > &machineList, bool fAttachLinked, ULONG &uCount,
+                                    ULONG &uTotalWeight);
 
     /* MachineCloneVM::run helper: */
     bool findSnapshot(const settings::SnapshotsList &snl, const Guid &id, settings::Snapshot &sn) const;
@@ -114,7 +118,9 @@ struct MachineCloneVMPrivate
     void updateStorageLists(settings::StorageControllersList &sc, const Bstr &bstrOldId, const Bstr &bstrNewId) const;
     void updateSnapshotStorageLists(settings::SnapshotsList &sl, const Bstr &bstrOldId, const Bstr &bstrNewId) const;
     void updateStateFile(settings::SnapshotsList &snl, const Guid &id, const Utf8Str &strFile) const;
-    HRESULT createDifferencingMedium(const ComObjPtr<Machine> &pMachine, const ComObjPtr<Medium> &pParent, const Utf8Str &strSnapshotFolder, RTCList<ComObjPtr<Medium> > &newMedia, ComObjPtr<Medium> *ppDiff) const;
+    HRESULT createDifferencingMedium(const ComObjPtr<Machine> &pMachine, const ComObjPtr<Medium> &pParent,
+                                     const Utf8Str &strSnapshotFolder, RTCList<ComObjPtr<Medium> > &newMedia,
+                                     ComObjPtr<Medium> *ppDiff) const;
     static int copyStateFileProgress(unsigned uPercentage, void *pvUser);
 
     /* Private q and parent pointer */
@@ -133,7 +139,8 @@ struct MachineCloneVMPrivate
     RTCList<SAVESTATETASK>      llSaveStateFiles; /* Snapshot UUID -> File path */
 };
 
-HRESULT MachineCloneVMPrivate::createMachineList(const ComPtr<ISnapshot> &pSnapshot, RTCList< ComObjPtr<Machine> > &machineList) const
+HRESULT MachineCloneVMPrivate::createMachineList(const ComPtr<ISnapshot> &pSnapshot,
+                                                 RTCList< ComObjPtr<Machine> > &machineList) const
 {
     HRESULT rc = S_OK;
     Bstr name;
@@ -157,7 +164,8 @@ HRESULT MachineCloneVMPrivate::createMachineList(const ComPtr<ISnapshot> &pSnaps
     return rc;
 }
 
-void MachineCloneVMPrivate::updateProgressStats(MEDIUMTASKCHAIN &mtc, bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight) const
+void MachineCloneVMPrivate::updateProgressStats(MEDIUMTASKCHAIN &mtc, bool fAttachLinked,
+                                                ULONG &uCount, ULONG &uTotalWeight) const
 {
     if (fAttachLinked)
     {
@@ -199,12 +207,13 @@ HRESULT MachineCloneVMPrivate::addSaveState(const ComObjPtr<Machine> &machine, U
     if (!bstrSrcSaveStatePath.isEmpty())
     {
         SAVESTATETASK sst;
-        sst.snapshotUuid     = machine->getSnapshotId();
+        sst.snapshotUuid     = machine->i_getSnapshotId();
         sst.strSaveStateFile = bstrSrcSaveStatePath;
         uint64_t cbSize;
         int vrc = RTFileQuerySize(sst.strSaveStateFile.c_str(), &cbSize);
         if (RT_FAILURE(vrc))
-            return p->setError(VBOX_E_IPRT_ERROR, p->tr("Could not query file size of '%s' (%Rrc)"), sst.strSaveStateFile.c_str(), vrc);
+            return p->setError(VBOX_E_IPRT_ERROR, p->tr("Could not query file size of '%s' (%Rrc)"),
+                               sst.strSaveStateFile.c_str(), vrc);
         /* same rule as above: count both the data which needs to
          * be read and written */
         sst.uWeight = (ULONG)(2 * (cbSize + _1M - 1) / _1M);
@@ -227,7 +236,8 @@ HRESULT MachineCloneVMPrivate::queryBaseName(const ComPtr<IMedium> &pMedium, Utf
     return rc;
 }
 
-HRESULT MachineCloneVMPrivate::queryMediasForMachineState(const RTCList<ComObjPtr<Machine> > &machineList, bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight)
+HRESULT MachineCloneVMPrivate::queryMediasForMachineState(const RTCList<ComObjPtr<Machine> > &machineList,
+                                                          bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight)
 {
     /* This mode is pretty straightforward. We didn't need to know about any
      * parent/children relationship and therefor simply adding all directly
@@ -305,7 +315,8 @@ HRESULT MachineCloneVMPrivate::queryMediasForMachineState(const RTCList<ComObjPt
     return rc;
 }
 
-HRESULT MachineCloneVMPrivate::queryMediasForMachineAndChildStates(const RTCList<ComObjPtr<Machine> > &machineList, bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight)
+HRESULT MachineCloneVMPrivate::queryMediasForMachineAndChildStates(const RTCList<ComObjPtr<Machine> > &machineList,
+                                                                   bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight)
 {
     /* This is basically a three step approach. First select all medias
      * directly or indirectly involved in the clone. Second create a histogram
@@ -467,7 +478,8 @@ HRESULT MachineCloneVMPrivate::queryMediasForMachineAndChildStates(const RTCList
     return rc;
 }
 
-HRESULT MachineCloneVMPrivate::queryMediasForAllStates(const RTCList<ComObjPtr<Machine> > &machineList, bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight)
+HRESULT MachineCloneVMPrivate::queryMediasForAllStates(const RTCList<ComObjPtr<Machine> > &machineList,
+                                                       bool fAttachLinked, ULONG &uCount, ULONG &uTotalWeight)
 {
     /* In this case we create a exact copy of the original VM. This means just
      * adding all directly and indirectly attached disk images to the worker
@@ -581,7 +593,7 @@ void MachineCloneVMPrivate::updateMACAddresses(settings::NetworkAdaptersList &nw
         if (   fNotNAT
             && it->mode == NetworkAttachmentType_NAT)
             continue;
-        Host::generateMACAddress(it->strMACAddress);
+        Host::i_generateMACAddress(it->strMACAddress);
     }
 }
 
@@ -596,7 +608,8 @@ void MachineCloneVMPrivate::updateMACAddresses(settings::SnapshotsList &sl) cons
     }
 }
 
-void MachineCloneVMPrivate::updateStorageLists(settings::StorageControllersList &sc, const Bstr &bstrOldId, const Bstr &bstrNewId) const
+void MachineCloneVMPrivate::updateStorageLists(settings::StorageControllersList &sc,
+                                               const Bstr &bstrOldId, const Bstr &bstrNewId) const
 {
     settings::StorageControllersList::iterator it3;
     for (it3 = sc.begin();
@@ -618,7 +631,8 @@ void MachineCloneVMPrivate::updateStorageLists(settings::StorageControllersList
     }
 }
 
-void MachineCloneVMPrivate::updateSnapshotStorageLists(settings::SnapshotsList &sl, const Bstr &bstrOldId, const Bstr &bstrNewId) const
+void MachineCloneVMPrivate::updateSnapshotStorageLists(settings::SnapshotsList &sl, const Bstr &bstrOldId,
+                                                       const Bstr &bstrNewId) const
 {
     settings::SnapshotsList::iterator it;
     for (  it  = sl.begin();
@@ -643,7 +657,9 @@ void MachineCloneVMPrivate::updateStateFile(settings::SnapshotsList &snl, const
     }
 }
 
-HRESULT MachineCloneVMPrivate::createDifferencingMedium(const ComObjPtr<Machine> &pMachine, const ComObjPtr<Medium> &pParent, const Utf8Str &strSnapshotFolder, RTCList<ComObjPtr<Medium> > &newMedia, ComObjPtr<Medium> *ppDiff) const
+HRESULT MachineCloneVMPrivate::createDifferencingMedium(const ComObjPtr<Machine> &pMachine, const ComObjPtr<Medium> &pParent,
+                                                        const Utf8Str &strSnapshotFolder, RTCList<ComObjPtr<Medium> > &newMedia,
+                                                        ComObjPtr<Medium> *ppDiff) const
 {
     HRESULT rc = S_OK;
     try
@@ -657,26 +673,28 @@ HRESULT MachineCloneVMPrivate::createDifferencingMedium(const ComObjPtr<Machine>
         }
         ComObjPtr<Medium> diff;
         diff.createObject();
-        rc = diff->init(p->getVirtualBox(),
-                        pParent->getPreferredDiffFormat(),
+        rc = diff->init(p->i_getVirtualBox(),
+                        pParent->i_getPreferredDiffFormat(),
                         Utf8StrFmt("%s%c", strSnapshotFolder.c_str(), RTPATH_DELIMITER),
-                        Guid::Empty /* empty media registry */);
+                                   Guid::Empty /* empty media registry */,
+                                   DeviceType_HardDisk);
         if (FAILED(rc)) throw rc;
 
         MediumLockList *pMediumLockList(new MediumLockList());
-        rc = diff->createMediumLockList(true /* fFailIfInaccessible */,
-                                        true /* fMediumLockWrite */,
-                                        pParent,
-                                        *pMediumLockList);
+        rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                          true /* fMediumLockWrite */,
+                                          false /* fMediumLockWriteAll */,
+                                          pParent,
+                                          *pMediumLockList);
         if (FAILED(rc)) throw rc;
         rc = pMediumLockList->Lock();
         if (FAILED(rc)) throw rc;
 
         /* this already registers the new diff image */
-        rc = pParent->createDiffStorage(diff, MediumVariant_Standard,
-                                        pMediumLockList,
-                                        NULL /* aProgress */,
-                                        true /* aWait */);
+        rc = pParent->i_createDiffStorage(diff, MediumVariant_Standard,
+                                          pMediumLockList,
+                                          NULL /* aProgress */,
+                                          true /* aWait */);
         delete pMediumLockList;
         if (FAILED(rc)) throw rc;
         /* Remember created medium. */
@@ -715,8 +733,9 @@ int MachineCloneVMPrivate::copyStateFileProgress(unsigned uPercentage, void *pvU
 // The public class
 /////////////////////////////////////////////////////////////////////////////
 
-MachineCloneVM::MachineCloneVM(ComObjPtr<Machine> pSrcMachine, ComObjPtr<Machine> pTrgMachine, CloneMode_T mode, const RTCList<CloneOptions_T> &opts)
-    : d_ptr(new MachineCloneVMPrivate(this, pSrcMachine, pTrgMachine, mode, opts))
+MachineCloneVM::MachineCloneVM(ComObjPtr<Machine> pSrcMachine, ComObjPtr<Machine> pTrgMachine, CloneMode_T mode,
+                               const RTCList<CloneOptions_T> &opts) :
+                               d_ptr(new MachineCloneVMPrivate(this, pSrcMachine, pTrgMachine, mode, opts))
 {
 }
 
@@ -735,7 +754,7 @@ HRESULT MachineCloneVM::start(IProgress **pProgress)
     {
         /** @todo r=klaus this code cannot deal with someone crazy specifying
          * IMachine corresponding to a mutable machine as d->pSrcMachine */
-        if (d->pSrcMachine->isSessionMachine())
+        if (d->pSrcMachine->i_isSessionMachine())
             throw p->setError(E_INVALIDARG, "The source machine is mutable");
 
         /* Handle the special case that someone is requesting a _full_ clone
@@ -743,13 +762,13 @@ HRESULT MachineCloneVM::start(IProgress **pProgress)
          * machine (and not the current one) as source machine. In this case we
          * just replace the source (snapshot) machine with the current machine. */
         if (   d->mode == CloneMode_AllStates
-            && d->pSrcMachine->isSnapshotMachine())
+            && d->pSrcMachine->i_isSnapshotMachine())
         {
             Bstr bstrSrcMachineId;
             rc = d->pSrcMachine->COMGETTER(Id)(bstrSrcMachineId.asOutParam());
             if (FAILED(rc)) throw rc;
             ComPtr<IMachine> newSrcMachine;
-            rc = d->pSrcMachine->getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), newSrcMachine.asOutParam());
+            rc = d->pSrcMachine->i_getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), newSrcMachine.asOutParam());
             if (FAILED(rc)) throw rc;
             d->pSrcMachine = (Machine*)(IMachine*)newSrcMachine;
         }
@@ -757,14 +776,14 @@ HRESULT MachineCloneVM::start(IProgress **pProgress)
         ComObjPtr<Machine> pCurrState;
         if (d->mode == CloneMode_MachineAndChildStates)
         {
-            if (d->pSrcMachine->isSnapshotMachine())
+            if (d->pSrcMachine->i_isSnapshotMachine())
             {
                 /* find machine object for current snapshot of current state */
                 Bstr bstrSrcMachineId;
                 rc = d->pSrcMachine->COMGETTER(Id)(bstrSrcMachineId.asOutParam());
                 if (FAILED(rc)) throw rc;
                 ComPtr<IMachine> pCurr;
-                rc = d->pSrcMachine->getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), pCurr.asOutParam());
+                rc = d->pSrcMachine->i_getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), pCurr.asOutParam());
                 if (FAILED(rc)) throw rc;
                 if (pCurr.isNull())
                     throw p->setError(VBOX_E_OBJECT_NOT_FOUND);
@@ -809,8 +828,8 @@ HRESULT MachineCloneVM::start(IProgress **pProgress)
         /* Lock the target machine early (so nobody mess around with it in the meantime). */
         AutoWriteLock trgLock(d->pTrgMachine COMMA_LOCKVAL_SRC_POS);
 
-        if (d->pSrcMachine->isSnapshotMachine())
-            d->snapshotId = d->pSrcMachine->getSnapshotId();
+        if (d->pSrcMachine->i_isSnapshotMachine())
+            d->snapshotId = d->pSrcMachine->i_getSnapshotId();
 
         /* Add the current machine and all snapshot machines below this machine
          * in a list for further processing. */
@@ -880,15 +899,21 @@ HRESULT MachineCloneVM::start(IProgress **pProgress)
         bool fAttachLinked = d->options.contains(CloneOptions_Link); /* Linked clones requested? */
         switch (d->mode)
         {
-            case CloneMode_MachineState:          d->queryMediasForMachineState(machineList, fAttachLinked, uCount, uTotalWeight); break;
-            case CloneMode_MachineAndChildStates: d->queryMediasForMachineAndChildStates(machineList, fAttachLinked, uCount, uTotalWeight); break;
-            case CloneMode_AllStates:             d->queryMediasForAllStates(machineList, fAttachLinked, uCount, uTotalWeight); break;
+            case CloneMode_MachineState:          d->queryMediasForMachineState(machineList, fAttachLinked,
+                                                                                uCount, uTotalWeight);
+                                                  break;
+            case CloneMode_MachineAndChildStates: d->queryMediasForMachineAndChildStates(machineList, fAttachLinked,
+                                                                                         uCount, uTotalWeight);
+                                                  break;
+            case CloneMode_AllStates:             d->queryMediasForAllStates(machineList, fAttachLinked, uCount,
+                                                                             uTotalWeight);
+                                                  break;
         }
 
         /* Now create the progress project, so the user knows whats going on. */
         rc = d->pProgress.createObject();
         if (FAILED(rc)) throw rc;
-        rc = d->pProgress->init(p->getVirtualBox(),
+        rc = d->pProgress->init(p->i_getVirtualBox(),
                                 static_cast<IMachine*>(d->pSrcMachine) /* aInitiator */,
                                 Bstr(p->tr("Cloning Machine")).raw(),
                                 true /* fCancellable */,
@@ -934,7 +959,7 @@ HRESULT MachineCloneVM::run()
 
     /* Where should all the media go? */
     Utf8Str strTrgSnapshotFolder;
-    Utf8Str strTrgMachineFolder = d->pTrgMachine->getSettingsFileFull();
+    Utf8Str strTrgMachineFolder = d->pTrgMachine->i_getSettingsFileFull();
     strTrgMachineFolder.stripFilename();
 
     RTCList<ComObjPtr<Medium> > newMedia;   /* All created images */
@@ -1012,7 +1037,8 @@ HRESULT MachineCloneVM::run()
         rc = d->pSrcMachine->COMGETTER(SnapshotFolder)(bstrSrcSnapshotFolder.asOutParam());
         if (FAILED(rc)) throw rc;
         /* The absolute name of the snapshot folder. */
-        strTrgSnapshotFolder = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, trgMCF.machineUserData.strSnapshotFolder.c_str());
+        strTrgSnapshotFolder = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER,
+                                          trgMCF.machineUserData.strSnapshotFolder.c_str());
 
         /* Should we rename the disk names. */
         bool fKeepDiskNames = d->options.contains(CloneOptions_KeepDiskNames);
@@ -1040,7 +1066,8 @@ HRESULT MachineCloneVM::run()
                 rc = pMedium->COMGETTER(Name)(bstrSrcName.asOutParam());
                 if (FAILED(rc)) throw rc;
 
-                rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(), mt.uWeight);
+                rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(),
+                                                    mt.uWeight);
                 if (FAILED(rc)) throw rc;
 
                 Bstr bstrSrcId;
@@ -1053,8 +1080,8 @@ HRESULT MachineCloneVM::run()
                     ComObjPtr<Medium> pLMedium = static_cast<Medium*>(pTmp);
                     if (pLMedium.isNull())
                         throw p->setError(VBOX_E_OBJECT_NOT_FOUND);
-                    ComObjPtr<Medium> pBase = pLMedium->getBase();
-                    if (pBase->isReadOnly())
+                    ComObjPtr<Medium> pBase = pLMedium->i_getBase();
+                    if (pBase->i_isReadOnly())
                     {
                         ComObjPtr<Medium> pDiff;
                         /* create the diff under the snapshot medium */
@@ -1101,7 +1128,7 @@ HRESULT MachineCloneVM::run()
 
                         /* Default format? */
                         Utf8Str strDefaultFormat;
-                        p->mParent->getDefaultHardDiskFormat(strDefaultFormat);
+                        p->mParent->i_getDefaultHardDiskFormat(strDefaultFormat);
                         Bstr bstrSrcFormat(strDefaultFormat);
 
                         ULONG srcVar = MediumVariant_Standard;
@@ -1133,7 +1160,7 @@ HRESULT MachineCloneVM::run()
                             /* Check if we have to use another name. */
                             if (!mt.strBaseName.isEmpty())
                                 strSrcTest = mt.strBaseName;
-                            strSrcTest.stripExt();
+                            strSrcTest.stripSuffix();
                             /* If the old disk name was in {uuid} format we also
                              * want the new name in this format, but with the
                              * updated id of course. If the old disk was called
@@ -1141,7 +1168,8 @@ HRESULT MachineCloneVM::run()
                              * For all other disks we rename them with this
                              * template: "new name-disk1.vdi". */
                             if (strSrcTest == strOldVMName)
-                                strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(), RTPathExt(Utf8Str(bstrSrcName).c_str()));
+                                strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(),
+                                                        RTPathSuffix(Utf8Str(bstrSrcName).c_str()));
                             else if (   strSrcTest.startsWith("{")
                                      && strSrcTest.endsWith("}"))
                             {
@@ -1149,10 +1177,12 @@ HRESULT MachineCloneVM::run()
 
                                 Guid temp_guid(strSrcTest);
                                 if (temp_guid.isValid() && !temp_guid.isZero())
-                                    strNewName = Utf8StrFmt("%s%s", newId.toStringCurly().c_str(), RTPathExt(strNewName.c_str()));
+                                    strNewName = Utf8StrFmt("%s%s", newId.toStringCurly().c_str(),
+                                                            RTPathSuffix(strNewName.c_str()));
                             }
                             else
-                                strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks, RTPathExt(Utf8Str(bstrSrcName).c_str()));
+                                strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks,
+                                                        RTPathSuffix(Utf8Str(bstrSrcName).c_str()));
                         }
 
                         /* Check if this medium comes from the snapshot folder, if
@@ -1175,23 +1205,24 @@ HRESULT MachineCloneVM::run()
                         rc = pTarget->init(p->mParent,
                                            Utf8Str(bstrSrcFormat),
                                            strFile,
-                                           Guid::Empty /* empty media registry */);
+                                           Guid::Empty /* empty media registry */,
+                                           DeviceType_HardDisk);
                         if (FAILED(rc)) throw rc;
 
                         /* Update the new uuid. */
-                        pTarget->updateId(newId);
+                        pTarget->i_updateId(newId);
 
                         srcLock.release();
                         /* Do the disk cloning. */
                         ComPtr<IProgress> progress2;
 
                         ComObjPtr<Medium> pLMedium = static_cast<Medium*>((IMedium*)pMedium);
-                        rc = pLMedium->cloneToEx(pTarget,
-                                                 srcVar,
-                                                 pNewParent,
-                                                 progress2.asOutParam(),
-                                                 uSrcParentIdx,
-                                                 uTrgParentIdx);
+                        rc = pLMedium->i_cloneToEx(pTarget,
+                                                   srcVar,
+                                                   pNewParent,
+                                                   progress2.asOutParam(),
+                                                   uSrcParentIdx,
+                                                   uTrgParentIdx);
                         if (FAILED(rc)) throw rc;
 
                         /* Wait until the async process has finished. */
@@ -1219,9 +1250,8 @@ HRESULT MachineCloneVM::run()
                         map.insert(TStrMediumPair(Utf8Str(bstrSrcId), pTarget));
                         /* register the new harddisk */
                         {
-                            AutoWriteLock tlock(p->mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
-                            rc = p->mParent->registerMedium(pTarget, &pTarget,
-                                                            DeviceType_HardDisk,
+                            AutoWriteLock tlock(p->mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+                            rc = p->mParent->i_registerMedium(pTarget, &pTarget,
                                                             tlock);
                             if (FAILED(rc)) throw rc;
                         }
@@ -1253,8 +1283,8 @@ HRESULT MachineCloneVM::run()
                 ComObjPtr<Medium> pLMedium = static_cast<Medium*>((IMedium*)mt.pMedium);
                 if (pLMedium.isNull())
                     throw p->setError(VBOX_E_OBJECT_NOT_FOUND);
-                ComObjPtr<Medium> pBase = pLMedium->getBase();
-                if (pBase->isReadOnly())
+                ComObjPtr<Medium> pBase = pLMedium->i_getBase();
+                if (pBase->i_isReadOnly())
                 {
                     ComObjPtr<Medium> pDiff;
                     trgLock.release();
@@ -1291,19 +1321,19 @@ HRESULT MachineCloneVM::run()
             Guid uuid = d->pTrgMachine->mData->mUuid;
             if (d->options.contains(CloneOptions_Link))
             {
-                ComObjPtr<Medium> pParent = pMedium->getParent();
+                ComObjPtr<Medium> pParent = pMedium->i_getParent();
                 mlock.release();
                 if (!pParent.isNull())
                 {
                     AutoCaller mac2(pParent);
                     if (FAILED(mac2.rc())) throw mac2.rc();
                     AutoReadLock mlock2(pParent COMMA_LOCKVAL_SRC_POS);
-                    if (pParent->getFirstRegistryMachineId(uuid))
+                    if (pParent->i_getFirstRegistryMachineId(uuid))
                     {
                         mlock2.release();
                         trgLock.release();
                         srcLock.release();
-                        p->mParent->markRegistryModified(uuid);
+                        p->mParent->i_markRegistryModified(uuid);
                         srcLock.acquire();
                         trgLock.acquire();
                         mlock2.acquire();
@@ -1311,7 +1341,7 @@ HRESULT MachineCloneVM::run()
                 }
                 mlock.acquire();
             }
-            pMedium->addRegistry(uuid, false /* fRecurse */);
+            pMedium->i_addRegistry(uuid);
         }
         /* Check if a snapshot folder is necessary and if so doesn't already
          * exists. */
@@ -1321,24 +1351,29 @@ HRESULT MachineCloneVM::run()
             int vrc = RTDirCreateFullPath(strTrgSnapshotFolder.c_str(), 0700);
             if (RT_FAILURE(vrc))
                 throw p->setError(VBOX_E_IPRT_ERROR,
-                                  p->tr("Could not create snapshots folder '%s' (%Rrc)"), strTrgSnapshotFolder.c_str(), vrc);
+                                  p->tr("Could not create snapshots folder '%s' (%Rrc)"),
+                                        strTrgSnapshotFolder.c_str(), vrc);
         }
         /* Clone all save state files. */
         for (size_t i = 0; i < d->llSaveStateFiles.size(); ++i)
         {
             SAVESTATETASK sst = d->llSaveStateFiles.at(i);
-            const Utf8Str &strTrgSaveState = Utf8StrFmt("%s%c%s", strTrgSnapshotFolder.c_str(), RTPATH_DELIMITER, RTPathFilename(sst.strSaveStateFile.c_str()));
+            const Utf8Str &strTrgSaveState = Utf8StrFmt("%s%c%s", strTrgSnapshotFolder.c_str(), RTPATH_DELIMITER,
+                                                        RTPathFilename(sst.strSaveStateFile.c_str()));
 
             /* Move to next sub-operation. */
-            rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Copy save state file '%s' ..."), RTPathFilename(sst.strSaveStateFile.c_str())).raw(), sst.uWeight);
+            rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Copy save state file '%s' ..."),
+                                                        RTPathFilename(sst.strSaveStateFile.c_str())).raw(), sst.uWeight);
             if (FAILED(rc)) throw rc;
             /* Copy the file only if it was not copied already. */
             if (!newFiles.contains(strTrgSaveState.c_str()))
             {
-                int vrc = RTFileCopyEx(sst.strSaveStateFile.c_str(), strTrgSaveState.c_str(), 0, MachineCloneVMPrivate::copyStateFileProgress, &d->pProgress);
+                int vrc = RTFileCopyEx(sst.strSaveStateFile.c_str(), strTrgSaveState.c_str(), 0,
+                                       MachineCloneVMPrivate::copyStateFileProgress, &d->pProgress);
                 if (RT_FAILURE(vrc))
                     throw p->setError(VBOX_E_IPRT_ERROR,
-                                      p->tr("Could not copy state file '%s' to '%s' (%Rrc)"), sst.strSaveStateFile.c_str(), strTrgSaveState.c_str(), vrc);
+                                      p->tr("Could not copy state file '%s' to '%s' (%Rrc)"),
+                                            sst.strSaveStateFile.c_str(), strTrgSaveState.c_str(), vrc);
                 newFiles.append(strTrgSaveState);
             }
             /* Update the path in the configuration either for the current
@@ -1350,19 +1385,19 @@ HRESULT MachineCloneVM::run()
         }
 
         {
-            rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Create Machine Clone '%s' ..."), trgMCF.machineUserData.strName.c_str()).raw(), 1);
+            rc = d->pProgress->SetNextOperation(BstrFmt(p->tr("Create Machine Clone '%s' ..."),
+                                                trgMCF.machineUserData.strName.c_str()).raw(), 1);
             if (FAILED(rc)) throw rc;
             /* After modifying the new machine config, we can copy the stuff
              * over to the new machine. The machine have to be mutable for
              * this. */
-            rc = d->pTrgMachine->checkStateDependency(p->MutableStateDep);
+            rc = d->pTrgMachine->i_checkStateDependency(p->MutableStateDep);
             if (FAILED(rc)) throw rc;
-            rc = d->pTrgMachine->loadMachineDataFromSettings(trgMCF,
-                                                             &d->pTrgMachine->mData->mUuid);
+            rc = d->pTrgMachine->i_loadMachineDataFromSettings(trgMCF, &d->pTrgMachine->mData->mUuid);
             if (FAILED(rc)) throw rc;
             /* save all VM data */
             bool fNeedsGlobalSaveSettings = false;
-            rc = d->pTrgMachine->saveSettings(&fNeedsGlobalSaveSettings, Machine::SaveS_Force);
+            rc = d->pTrgMachine->i_saveSettings(&fNeedsGlobalSaveSettings, Machine::SaveS_Force);
             if (FAILED(rc)) throw rc;
             /* Release all locks */
             trgLock.release();
@@ -1372,13 +1407,13 @@ HRESULT MachineCloneVM::run()
                 /* save the global settings; for that we should hold only the
                  * VirtualBox lock */
                 AutoWriteLock vlock(p->mParent COMMA_LOCKVAL_SRC_POS);
-                rc = p->mParent->saveSettings();
+                rc = p->mParent->i_saveSettings();
                 if (FAILED(rc)) throw rc;
             }
         }
 
         /* Any additional machines need saving? */
-        p->mParent->saveModifiedRegistries();
+        p->mParent->i_saveModifiedRegistries();
     }
     catch (HRESULT rc2)
     {
@@ -1406,7 +1441,7 @@ HRESULT MachineCloneVM::run()
         for (size_t i = newMedia.size(); i > 0; --i)
         {
             const ComObjPtr<Medium> &pMedium = newMedia.at(i - 1);
-            mrc = pMedium->deleteStorage(NULL /* aProgress */,
+            mrc = pMedium->i_deleteStorage(NULL /* aProgress */,
                                          true /* aWait */);
             pMedium->Close();
         }
@@ -1417,7 +1452,7 @@ HRESULT MachineCloneVM::run()
         RTDirRemove(strTrgMachineFolder.c_str());
 
         /* Must save the modified registries */
-        p->mParent->saveModifiedRegistries();
+        p->mParent->i_saveModifiedRegistries();
     }
 
     return mrc;
diff --git a/src/VBox/Main/src-server/Matching.cpp b/src/VBox/Main/src-server/Matching.cpp
index a2e0a4a..7808a21 100644
--- a/src/VBox/Main/src-server/Matching.cpp
+++ b/src/VBox/Main/src-server/Matching.cpp
@@ -1,3 +1,4 @@
+/* $Id: Matching.cpp $ */
 /** @file
  *
  * Definition of template classes that provide simple API to
diff --git a/src/VBox/Main/src-server/MediumAttachmentImpl.cpp b/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
index 6059ced..4a744ab 100644
--- a/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
+++ b/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
@@ -1,10 +1,11 @@
+/* $Id: MediumAttachmentImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,7 +21,6 @@
 #include "MediumImpl.h"
 #include "Global.h"
 
-#include "AutoStateDep.h"
 #include "AutoCaller.h"
 #include "Logging.h"
 
@@ -85,6 +85,8 @@ struct MediumAttachment::Data
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
+DEFINE_EMPTY_CTOR_DTOR(MediumAttachment)
+
 HRESULT MediumAttachment::FinalConstruct()
 {
     LogFlowThisFunc(("\n"));
@@ -168,7 +170,7 @@ HRESULT MediumAttachment::init(Machine *aParent,
                           aPort, aDevice, Global::stringifyDeviceType(aType),
                           m->bd->fImplicit ? ":I" : "");
 
-    LogFlowThisFunc(("LEAVE - %s\n", getLogName()));
+    LogFlowThisFunc(("LEAVE - %s\n", i_getLogName()));
     return S_OK;
 }
 
@@ -208,7 +210,7 @@ HRESULT MediumAttachment::initCopy(Machine *aParent, MediumAttachment *aThat)
  */
 void MediumAttachment::uninit()
 {
-    LogFlowThisFunc(("ENTER - %s\n", getLogName()));
+    LogFlowThisFunc(("ENTER - %s\n", i_getLogName()));
 
     /* Enclose the state transition Ready->InUninit->NotReady */
     AutoUninitSpan autoUninitSpan(this);
@@ -228,48 +230,36 @@ void MediumAttachment::uninit()
 // IHardDiskAttachment properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP MediumAttachment::COMGETTER(Medium)(IMedium **aHardDisk)
+
+HRESULT MediumAttachment::getMedium(ComPtr<IMedium> &aHardDisk)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aHardDisk);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->bd->pMedium.queryInterfaceTo(aHardDisk);
+    aHardDisk = m->bd->pMedium;
 
     LogFlowThisFuncLeave();
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(Controller)(BSTR *aController)
+
+HRESULT MediumAttachment::getController(com::Utf8Str &aController)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aController);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* m->controller is constant during life time, no need to lock */
-    m->bd->bstrControllerName.cloneTo(aController);
+    aController = Utf8Str(m->bd->bstrControllerName);
 
     LogFlowThisFuncLeave();
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(Port)(LONG *aPort)
+
+HRESULT MediumAttachment::getPort(LONG *aPort)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aPort);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* m->bd->port is constant during life time, no need to lock */
     *aPort = m->bd->lPort;
 
@@ -277,15 +267,10 @@ STDMETHODIMP MediumAttachment::COMGETTER(Port)(LONG *aPort)
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(Device)(LONG *aDevice)
+HRESULT  MediumAttachment::getDevice(LONG *aDevice)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aDevice);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* m->bd->device is constant during life time, no need to lock */
     *aDevice = m->bd->lDevice;
 
@@ -293,15 +278,10 @@ STDMETHODIMP MediumAttachment::COMGETTER(Device)(LONG *aDevice)
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(Type)(DeviceType_T *aType)
+HRESULT MediumAttachment::getType(DeviceType_T *aType)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* m->bd->type is constant during life time, no need to lock */
     *aType = m->bd->type;
 
@@ -309,15 +289,11 @@ STDMETHODIMP MediumAttachment::COMGETTER(Type)(DeviceType_T *aType)
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(Passthrough)(BOOL *aPassthrough)
+
+HRESULT MediumAttachment::getPassthrough(BOOL *aPassthrough)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aPassthrough);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
 
     *aPassthrough = m->bd->fPassthrough;
@@ -326,15 +302,11 @@ STDMETHODIMP MediumAttachment::COMGETTER(Passthrough)(BOOL *aPassthrough)
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(TemporaryEject)(BOOL *aTemporaryEject)
+
+HRESULT MediumAttachment::getTemporaryEject(BOOL *aTemporaryEject)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aTemporaryEject);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
 
     *aTemporaryEject = m->bd->fTempEject;
@@ -343,15 +315,11 @@ STDMETHODIMP MediumAttachment::COMGETTER(TemporaryEject)(BOOL *aTemporaryEject)
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(IsEjected)(BOOL *aEjected)
+
+HRESULT MediumAttachment::getIsEjected(BOOL *aEjected)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aEjected);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
 
     *aEjected = m->fIsEjected;
@@ -360,15 +328,11 @@ STDMETHODIMP MediumAttachment::COMGETTER(IsEjected)(BOOL *aEjected)
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(NonRotational)(BOOL *aNonRotational)
+
+HRESULT MediumAttachment::getNonRotational(BOOL *aNonRotational)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aNonRotational);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
 
     *aNonRotational = m->bd->fNonRotational;
@@ -377,15 +341,10 @@ STDMETHODIMP MediumAttachment::COMGETTER(NonRotational)(BOOL *aNonRotational)
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(Discard)(BOOL *aDiscard)
+HRESULT MediumAttachment::getDiscard(BOOL *aDiscard)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aDiscard);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
 
     *aDiscard = m->bd->fDiscard;
@@ -394,13 +353,10 @@ STDMETHODIMP MediumAttachment::COMGETTER(Discard)(BOOL *aDiscard)
     return S_OK;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(BandwidthGroup) (IBandwidthGroup **aBwGroup)
+
+HRESULT MediumAttachment::getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup)
 {
     LogFlowThisFuncEnter();
-    CheckComArgOutPointerValid(aBwGroup);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -408,27 +364,23 @@ STDMETHODIMP MediumAttachment::COMGETTER(BandwidthGroup) (IBandwidthGroup **aBwG
     if (m->bd->strBandwidthGroup.isNotEmpty())
     {
         ComObjPtr<BandwidthGroup> pBwGroup;
-        hrc = m->pMachine->getBandwidthGroup(m->bd->strBandwidthGroup, pBwGroup, true /* fSetError */);
+        hrc = m->pMachine->i_getBandwidthGroup(m->bd->strBandwidthGroup, pBwGroup, true /* fSetError */);
 
-        Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the group was checked when it was attached. */
+        Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the
+                                   group was checked when it was attached. */
 
         if (SUCCEEDED(hrc))
-            pBwGroup.queryInterfaceTo(aBwGroup);
+            pBwGroup.queryInterfaceTo(aBandwidthGroup.asOutParam());
     }
 
     LogFlowThisFuncLeave();
     return hrc;
 }
 
-STDMETHODIMP MediumAttachment::COMGETTER(HotPluggable)(BOOL *aHotPluggable)
+HRESULT MediumAttachment::getHotPluggable(BOOL *aHotPluggable)
 {
     LogFlowThisFuncEnter();
 
-    CheckComArgOutPointerValid(aHotPluggable);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
 
     *aHotPluggable = m->bd->fHotPluggable;
@@ -440,9 +392,9 @@ STDMETHODIMP MediumAttachment::COMGETTER(HotPluggable)(BOOL *aHotPluggable)
 /**
  *  @note Locks this object for writing.
  */
-void MediumAttachment::rollback()
+void MediumAttachment::i_rollback()
 {
-    LogFlowThisFunc(("ENTER - %s\n", getLogName()));
+    LogFlowThisFunc(("ENTER - %s\n", i_getLogName()));
 
     /* sanity */
     AutoCaller autoCaller(this);
@@ -452,15 +404,15 @@ void MediumAttachment::rollback()
 
     m->bd.rollback();
 
-    LogFlowThisFunc(("LEAVE - %s\n", getLogName()));
+    LogFlowThisFunc(("LEAVE - %s\n", i_getLogName()));
 }
 
 /**
  *  @note Locks this object for writing.
  */
-void MediumAttachment::commit()
+void MediumAttachment::i_commit()
 {
-    LogFlowThisFunc(("ENTER - %s\n", getLogName()));
+    LogFlowThisFunc(("ENTER - %s\n", i_getLogName()));
 
     /* sanity */
     AutoCaller autoCaller(this);
@@ -471,80 +423,80 @@ void MediumAttachment::commit()
     if (m->bd.isBackedUp())
         m->bd.commit();
 
-    LogFlowThisFunc(("LEAVE - %s\n", getLogName()));
+    LogFlowThisFunc(("LEAVE - %s\n", i_getLogName()));
 }
 
-bool MediumAttachment::isImplicit() const
+bool MediumAttachment::i_isImplicit() const
 {
     return m->bd->fImplicit;
 }
 
-void MediumAttachment::setImplicit(bool aImplicit)
+void MediumAttachment::i_setImplicit(bool aImplicit)
 {
     m->bd->fImplicit = aImplicit;
 }
 
-const ComObjPtr<Medium>& MediumAttachment::getMedium() const
+const ComObjPtr<Medium>& MediumAttachment::i_getMedium() const
 {
     return m->bd->pMedium;
 }
 
-Bstr MediumAttachment::getControllerName() const
+const Bstr MediumAttachment::i_getControllerName() const
 {
     return m->bd->bstrControllerName;
 }
 
-LONG MediumAttachment::getPort() const
+LONG MediumAttachment::i_getPort() const
 {
     return m->bd->lPort;
 }
 
-LONG MediumAttachment::getDevice() const
+LONG MediumAttachment::i_getDevice() const
 {
     return m->bd->lDevice;
 }
 
-DeviceType_T MediumAttachment::getType() const
+DeviceType_T MediumAttachment::i_getType() const
 {
     return m->bd->type;
 }
 
-bool MediumAttachment::getPassthrough() const
+bool MediumAttachment::i_getPassthrough() const
 {
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
     return m->bd->fPassthrough;
 }
 
-bool MediumAttachment::getTempEject() const
+bool MediumAttachment::i_getTempEject() const
 {
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
     return m->bd->fTempEject;
 }
 
-bool MediumAttachment::getNonRotational() const
+bool MediumAttachment::i_getNonRotational() const
 {
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
     return m->bd->fNonRotational;
 }
 
-bool MediumAttachment::getDiscard() const
+bool MediumAttachment::i_getDiscard() const
 {
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
     return m->bd->fDiscard;
 }
 
-bool MediumAttachment::getHotPluggable() const
+bool MediumAttachment::i_getHotPluggable() const
 {
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
     return m->bd->fHotPluggable;
 }
 
-const Utf8Str& MediumAttachment::getBandwidthGroup() const
+Utf8Str& MediumAttachment::i_getBandwidthGroup() const
 {
     return m->bd->strBandwidthGroup;
 }
 
-bool MediumAttachment::matches(CBSTR aControllerName, LONG aPort, LONG aDevice)
+bool MediumAttachment::i_matches(CBSTR aControllerName, LONG aPort, LONG aDevice)
 {
     return (    aControllerName == m->bd->bstrControllerName
              && aPort == m->bd->lPort
@@ -555,7 +507,7 @@ bool MediumAttachment::matches(CBSTR aControllerName, LONG aPort, LONG aDevice)
  * Sets the medium of this attachment and unsets the "implicit" flag.
  * @param aMedium
  */
-void MediumAttachment::updateMedium(const ComObjPtr<Medium> &aMedium)
+void MediumAttachment::i_updateMedium(const ComObjPtr<Medium> &aMedium)
 {
     Assert(isWriteLockOnCurrentThread());
 
@@ -566,7 +518,7 @@ void MediumAttachment::updateMedium(const ComObjPtr<Medium> &aMedium)
 }
 
 /** Must be called from under this object's write lock. */
-void MediumAttachment::updatePassthrough(bool aPassthrough)
+void MediumAttachment::i_updatePassthrough(bool aPassthrough)
 {
     Assert(isWriteLockOnCurrentThread());
 
@@ -575,7 +527,7 @@ void MediumAttachment::updatePassthrough(bool aPassthrough)
 }
 
 /** Must be called from under this object's write lock. */
-void MediumAttachment::updateTempEject(bool aTempEject)
+void MediumAttachment::i_updateTempEject(bool aTempEject)
 {
     Assert(isWriteLockOnCurrentThread());
 
@@ -584,7 +536,7 @@ void MediumAttachment::updateTempEject(bool aTempEject)
 }
 
 /** Must be called from under this object's write lock. */
-void MediumAttachment::updateEjected()
+void MediumAttachment::i_updateEjected()
 {
     Assert(isWriteLockOnCurrentThread());
 
@@ -592,7 +544,7 @@ void MediumAttachment::updateEjected()
 }
 
 /** Must be called from under this object's write lock. */
-void MediumAttachment::updateNonRotational(bool aNonRotational)
+void MediumAttachment::i_updateNonRotational(bool aNonRotational)
 {
     Assert(isWriteLockOnCurrentThread());
 
@@ -601,7 +553,7 @@ void MediumAttachment::updateNonRotational(bool aNonRotational)
 }
 
 /** Must be called from under this object's write lock. */
-void MediumAttachment::updateDiscard(bool aDiscard)
+void MediumAttachment::i_updateDiscard(bool aDiscard)
 {
     Assert(isWriteLockOnCurrentThread());
 
@@ -610,7 +562,7 @@ void MediumAttachment::updateDiscard(bool aDiscard)
 }
 
 /** Must be called from under this object's write lock. */
-void MediumAttachment::updateHotPluggable(bool aHotPluggable)
+void MediumAttachment::i_updateHotPluggable(bool aHotPluggable)
 {
     Assert(isWriteLockOnCurrentThread());
 
@@ -618,7 +570,7 @@ void MediumAttachment::updateHotPluggable(bool aHotPluggable)
     m->bd->fHotPluggable = aHotPluggable;
 }
 
-void MediumAttachment::updateBandwidthGroup(const Utf8Str &aBandwidthGroup)
+void MediumAttachment::i_updateBandwidthGroup(const Utf8Str &aBandwidthGroup)
 {
     LogFlowThisFuncEnter();
     Assert(isWriteLockOnCurrentThread());
@@ -629,10 +581,9 @@ void MediumAttachment::updateBandwidthGroup(const Utf8Str &aBandwidthGroup)
     LogFlowThisFuncLeave();
 }
 
-void MediumAttachment::updateParentMachine(Machine * const pMachine)
+void MediumAttachment::i_updateParentMachine(Machine * const pMachine)
 {
-    LogFlowThisFunc(("ENTER - %s\n", getLogName()));
-
+    LogFlowThisFunc(("ENTER - %s\n", i_getLogName()));
     /* sanity */
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid (autoCaller.rc());
@@ -641,6 +592,6 @@ void MediumAttachment::updateParentMachine(Machine * const pMachine)
 
     unconst(m->pMachine) = pMachine;
 
-    LogFlowThisFunc(("LEAVE - %s\n", getLogName()));
+    LogFlowThisFunc(("LEAVE - %s\n", i_getLogName()));
 }
 
diff --git a/src/VBox/Main/src-server/MediumImpl.cpp b/src/VBox/Main/src-server/MediumImpl.cpp
index 027a5ab..3acb667 100644
--- a/src/VBox/Main/src-server/MediumImpl.cpp
+++ b/src/VBox/Main/src-server/MediumImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2014 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -14,17 +14,16 @@
  * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
-
 #include "MediumImpl.h"
 #include "TokenImpl.h"
 #include "ProgressImpl.h"
 #include "SystemPropertiesImpl.h"
 #include "VirtualBoxImpl.h"
+#include "ExtPackManagerImpl.h"
 
 #include "AutoCaller.h"
 #include "Logging.h"
 
-#include <VBox/com/array.h>
 #include "VBox/com/MultiResult.h"
 #include "VBox/com/ErrorInfo.h"
 
@@ -36,12 +35,16 @@
 #include <iprt/file.h>
 #include <iprt/tcp.h>
 #include <iprt/cpp/utils.h>
+#include <iprt/memsafer.h>
+#include <iprt/base64.h>
 
 #include <VBox/vd.h>
 
 #include <algorithm>
 #include <list>
 
+#include <openssl/rand.h>
+
 typedef std::list<Guid> GuidList;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -110,9 +113,10 @@ struct Medium::Data
     /** weak VirtualBox parent */
     VirtualBox * const pVirtualBox;
 
-    // pParent and llChildren are protected by VirtualBox::getMediaTreeLockHandle()
+    // pParent and llChildren are protected by VirtualBox::i_getMediaTreeLockHandle()
     ComObjPtr<Medium> pParent;
-    MediaList llChildren;           // to add a child, just call push_back; to remove a child, call child->deparent() which does a lookup
+    MediaList llChildren;           // to add a child, just call push_back; to remove
+                                    // a child, call child->deparent() which does a lookup
 
     GuidList llRegistryIDs;         // media registries in which this medium is listed
 
@@ -130,7 +134,7 @@ struct Medium::Data
     MediumState_T preLockState;
 
     /** Special synchronization for operations which must wait for
-     * Medium::queryInfo in another thread to complete. Using a SemRW is
+     * Medium::i_queryInfo in another thread to complete. Using a SemRW is
      * not quite ideal, but at least it is subject to the lock validator,
      * unlike the SemEventMulti which we had here for many years. Catching
      * possible deadlocks is more important than a tiny bit of efficiency. */
@@ -148,9 +152,9 @@ struct Medium::Data
 
     bool autoReset : 1;
 
-    /** New UUID to be set on the next Medium::queryInfo call. */
+    /** New UUID to be set on the next Medium::i_queryInfo call. */
     const Guid uuidImage;
-    /** New parent UUID to be set on the next Medium::queryInfo call. */
+    /** New parent UUID to be set on the next Medium::i_queryInfo call. */
     const Guid uuidParentImage;
 
     bool hostDrive : 1;
@@ -253,7 +257,7 @@ public:
     const ComObjPtr<Medium> mMedium;
     AutoCaller mMediumCaller;
 
-    friend HRESULT Medium::runNow(Medium::Task*);
+    friend HRESULT Medium::i_runNow(Medium::Task*);
 
 protected:
     HRESULT mRC;
@@ -567,6 +571,7 @@ public:
                const char *aFilename,
                MediumFormat *aFormat,
                MediumVariant_T aVariant,
+               SecretKeyStore *pSecretKeyStore,
                VDINTERFACEIO *aVDImageIOIf,
                void *aVDImageIOUser,
                MediumLockList *aSourceMediumLockList,
@@ -576,6 +581,7 @@ public:
           mFilename(aFilename),
           mFormat(aFormat),
           mVariant(aVariant),
+          m_pSecretKeyStore(pSecretKeyStore),
           mfKeepSourceMediumLockList(fKeepSourceMediumLockList)
     {
         AssertReturnVoidStmt(aSourceMediumLockList != NULL, mRC = E_FAIL);
@@ -601,6 +607,7 @@ public:
     ComObjPtr<MediumFormat> mFormat;
     MediumVariant_T mVariant;
     PVDINTERFACE mVDImageIfaces;
+    SecretKeyStore *m_pSecretKeyStore;
 
 private:
     virtual HRESULT handler();
@@ -666,6 +673,91 @@ private:
     bool mfKeepTargetMediumLockList;
 };
 
+class Medium::EncryptTask : public Medium::Task
+{
+public:
+    EncryptTask(Medium *aMedium,
+                const com::Utf8Str &strNewPassword,
+                const com::Utf8Str &strCurrentPassword,
+                const com::Utf8Str &strCipher,
+                const com::Utf8Str &strNewPasswordId,
+                Progress *aProgress,
+                MediumLockList *aMediumLockList)
+        : Medium::Task(aMedium, aProgress),
+          mstrNewPassword(strNewPassword),
+          mstrCurrentPassword(strCurrentPassword),
+          mstrCipher(strCipher),
+          mstrNewPasswordId(strNewPasswordId),
+          mpMediumLockList(aMediumLockList)
+    {
+        AssertReturnVoidStmt(aMediumLockList != NULL, mRC = E_FAIL);
+        /* aParent may be NULL */
+        mRC = mParentCaller.rc();
+        if (FAILED(mRC))
+            return;
+
+        mVDImageIfaces = aMedium->m->vdImageIfaces;
+    }
+
+    ~EncryptTask()
+    {
+        if (mstrNewPassword.length())
+            RTMemWipeThoroughly(mstrNewPassword.mutableRaw(), mstrNewPassword.length(), 10 /* cPasses */);
+        if (mstrCurrentPassword.length())
+            RTMemWipeThoroughly(mstrCurrentPassword.mutableRaw(), mstrCurrentPassword.length(), 10 /* cPasses */);
+
+        /* Keep any errors which might be set when deleting the lock list. */
+        ErrorInfoKeeper eik;
+        delete mpMediumLockList;
+    }
+
+    Utf8Str mstrNewPassword;
+    Utf8Str mstrCurrentPassword;
+    Utf8Str mstrCipher;
+    Utf8Str mstrNewPasswordId;
+    MediumLockList *mpMediumLockList;
+    PVDINTERFACE    mVDImageIfaces;
+
+private:
+    virtual HRESULT handler();
+
+    AutoCaller mParentCaller;
+};
+
+/**
+ * Settings for a crypto filter instance.
+ */
+struct Medium::CryptoFilterSettings
+{
+    CryptoFilterSettings()
+        : fCreateKeyStore(false),
+          pszPassword(NULL),
+          pszKeyStore(NULL),
+          pszKeyStoreLoad(NULL),
+          pbDek(NULL),
+          cbDek(0),
+          pszCipher(NULL),
+          pszCipherReturned(NULL)
+    { }
+
+    bool              fCreateKeyStore;
+    const char        *pszPassword;
+    char              *pszKeyStore;
+    const char        *pszKeyStoreLoad;
+
+    const uint8_t     *pbDek;
+    size_t            cbDek;
+    const char        *pszCipher;
+
+    /** The cipher returned by the crypto filter. */
+    char              *pszCipherReturned;
+
+    PVDINTERFACE      vdFilterIfaces;
+
+    VDINTERFACECONFIG vdIfCfg;
+    VDINTERFACECRYPTO vdIfCrypto;
+};
+
 /**
  * Thread function for time-consuming medium tasks.
  *
@@ -696,7 +788,7 @@ DECLCALLBACK(int) Medium::Task::fntMediumTask(RTTHREAD aThread, void *pvUser)
 
     /* complete the progress if run asynchronously */
     if (!pProgress.isNull())
-        pProgress->notifyComplete(rc);
+        pProgress->i_notifyComplete(rc);
 
     LogFlowFunc(("rc=%Rhrc\n", rc));
     LogFlowFuncLeave();
@@ -737,7 +829,7 @@ DECLCALLBACK(int) Medium::Task::vdProgressCall(void *pvUser, unsigned uPercent)
  */
 HRESULT Medium::CreateBaseTask::handler()
 {
-    return mMedium->taskCreateBaseHandler(*this);
+    return mMedium->i_taskCreateBaseHandler(*this);
 }
 
 /**
@@ -745,7 +837,7 @@ HRESULT Medium::CreateBaseTask::handler()
  */
 HRESULT Medium::CreateDiffTask::handler()
 {
-    return mMedium->taskCreateDiffHandler(*this);
+    return mMedium->i_taskCreateDiffHandler(*this);
 }
 
 /**
@@ -753,7 +845,7 @@ HRESULT Medium::CreateDiffTask::handler()
  */
 HRESULT Medium::CloneTask::handler()
 {
-    return mMedium->taskCloneHandler(*this);
+    return mMedium->i_taskCloneHandler(*this);
 }
 
 /**
@@ -761,7 +853,7 @@ HRESULT Medium::CloneTask::handler()
  */
 HRESULT Medium::CompactTask::handler()
 {
-    return mMedium->taskCompactHandler(*this);
+    return mMedium->i_taskCompactHandler(*this);
 }
 
 /**
@@ -769,7 +861,7 @@ HRESULT Medium::CompactTask::handler()
  */
 HRESULT Medium::ResizeTask::handler()
 {
-    return mMedium->taskResizeHandler(*this);
+    return mMedium->i_taskResizeHandler(*this);
 }
 
 
@@ -778,7 +870,7 @@ HRESULT Medium::ResizeTask::handler()
  */
 HRESULT Medium::ResetTask::handler()
 {
-    return mMedium->taskResetHandler(*this);
+    return mMedium->i_taskResetHandler(*this);
 }
 
 /**
@@ -786,7 +878,7 @@ HRESULT Medium::ResetTask::handler()
  */
 HRESULT Medium::DeleteTask::handler()
 {
-    return mMedium->taskDeleteHandler(*this);
+    return mMedium->i_taskDeleteHandler(*this);
 }
 
 /**
@@ -794,7 +886,7 @@ HRESULT Medium::DeleteTask::handler()
  */
 HRESULT Medium::MergeTask::handler()
 {
-    return mMedium->taskMergeHandler(*this);
+    return mMedium->i_taskMergeHandler(*this);
 }
 
 /**
@@ -802,7 +894,7 @@ HRESULT Medium::MergeTask::handler()
  */
 HRESULT Medium::ExportTask::handler()
 {
-    return mMedium->taskExportHandler(*this);
+    return mMedium->i_taskExportHandler(*this);
 }
 
 /**
@@ -810,7 +902,15 @@ HRESULT Medium::ExportTask::handler()
  */
 HRESULT Medium::ImportTask::handler()
 {
-    return mMedium->taskImportHandler(*this);
+    return mMedium->i_taskImportHandler(*this);
+}
+
+/**
+ * Implementation code for the "encrypt" task.
+ */
+HRESULT Medium::EncryptTask::handler()
+{
+    return mMedium->i_taskEncryptHandler(*this);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -826,30 +926,30 @@ HRESULT Medium::FinalConstruct()
     m = new Data;
 
     /* Initialize the callbacks of the VD error interface */
-    m->vdIfError.pfnError = vdErrorCall;
+    m->vdIfError.pfnError = i_vdErrorCall;
     m->vdIfError.pfnMessage = NULL;
 
     /* Initialize the callbacks of the VD config interface */
-    m->vdIfConfig.pfnAreKeysValid = vdConfigAreKeysValid;
-    m->vdIfConfig.pfnQuerySize = vdConfigQuerySize;
-    m->vdIfConfig.pfnQuery = vdConfigQuery;
+    m->vdIfConfig.pfnAreKeysValid = i_vdConfigAreKeysValid;
+    m->vdIfConfig.pfnQuerySize = i_vdConfigQuerySize;
+    m->vdIfConfig.pfnQuery = i_vdConfigQuery;
     m->vdIfConfig.pfnQueryBytes = NULL;
 
     /* Initialize the callbacks of the VD TCP interface (we always use the host
      * IP stack for now) */
-    m->vdIfTcpNet.pfnSocketCreate = vdTcpSocketCreate;
-    m->vdIfTcpNet.pfnSocketDestroy = vdTcpSocketDestroy;
-    m->vdIfTcpNet.pfnClientConnect = vdTcpClientConnect;
-    m->vdIfTcpNet.pfnClientClose = vdTcpClientClose;
-    m->vdIfTcpNet.pfnIsClientConnected = vdTcpIsClientConnected;
-    m->vdIfTcpNet.pfnSelectOne = vdTcpSelectOne;
-    m->vdIfTcpNet.pfnRead = vdTcpRead;
-    m->vdIfTcpNet.pfnWrite = vdTcpWrite;
-    m->vdIfTcpNet.pfnSgWrite = vdTcpSgWrite;
-    m->vdIfTcpNet.pfnFlush = vdTcpFlush;
-    m->vdIfTcpNet.pfnSetSendCoalescing = vdTcpSetSendCoalescing;
-    m->vdIfTcpNet.pfnGetLocalAddress = vdTcpGetLocalAddress;
-    m->vdIfTcpNet.pfnGetPeerAddress = vdTcpGetPeerAddress;
+    m->vdIfTcpNet.pfnSocketCreate = i_vdTcpSocketCreate;
+    m->vdIfTcpNet.pfnSocketDestroy = i_vdTcpSocketDestroy;
+    m->vdIfTcpNet.pfnClientConnect = i_vdTcpClientConnect;
+    m->vdIfTcpNet.pfnClientClose = i_vdTcpClientClose;
+    m->vdIfTcpNet.pfnIsClientConnected = i_vdTcpIsClientConnected;
+    m->vdIfTcpNet.pfnSelectOne = i_vdTcpSelectOne;
+    m->vdIfTcpNet.pfnRead = i_vdTcpRead;
+    m->vdIfTcpNet.pfnWrite = i_vdTcpWrite;
+    m->vdIfTcpNet.pfnSgWrite = i_vdTcpSgWrite;
+    m->vdIfTcpNet.pfnFlush = i_vdTcpFlush;
+    m->vdIfTcpNet.pfnSetSendCoalescing = i_vdTcpSetSendCoalescing;
+    m->vdIfTcpNet.pfnGetLocalAddress = i_vdTcpGetLocalAddress;
+    m->vdIfTcpNet.pfnGetPeerAddress = i_vdTcpGetPeerAddress;
     m->vdIfTcpNet.pfnSelectOneEx = NULL;
     m->vdIfTcpNet.pfnPoke = NULL;
 
@@ -891,7 +991,7 @@ void Medium::FinalRelease()
  * Initializes an empty hard disk object without creating or opening an associated
  * storage unit.
  *
- * This gets called by VirtualBox::CreateHardDisk() in which case uuidMachineRegistry
+ * This gets called by VirtualBox::CreateMedium() in which case uuidMachineRegistry
  * is empty since starting with VirtualBox 4.0, we no longer add opened media to a
  * registry automatically (this is deferred until the medium is attached to a machine).
  *
@@ -907,12 +1007,15 @@ void Medium::FinalRelease()
  * @param aVirtualBox   VirtualBox object.
  * @param aFormat
  * @param aLocation     Storage unit location.
- * @param uuidMachineRegistry The registry to which this medium should be added (global registry UUID or machine UUID or empty if none).
+ * @param uuidMachineRegistry The registry to which this medium should be added
+ *                            (global registry UUID or machine UUID or empty if none).
+ * @param deviceType    Device Type.
  */
 HRESULT Medium::init(VirtualBox *aVirtualBox,
                      const Utf8Str &aFormat,
                      const Utf8Str &aLocation,
-                     const Guid &uuidMachineRegistry)
+                     const Guid &uuidMachineRegistry,
+                     const DeviceType_T aDeviceType)
 {
     AssertReturn(aVirtualBox != NULL, E_FAIL);
     AssertReturn(!aFormat.isEmpty(), E_FAIL);
@@ -934,20 +1037,22 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
     /* cannot be a host drive */
     m->hostDrive = false;
 
-    /* No storage unit is created yet, no need to call Medium::queryInfo */
+    m->devType = aDeviceType;
+
+    /* No storage unit is created yet, no need to call Medium::i_queryInfo */
 
-    rc = setFormat(aFormat);
+    rc = i_setFormat(aFormat);
     if (FAILED(rc)) return rc;
 
-    rc = setLocation(aLocation);
+    rc = i_setLocation(aLocation);
     if (FAILED(rc)) return rc;
 
     if (!(m->formatObj->i_getCapabilities() & (  MediumFormatCapabilities_CreateFixed
                                                | MediumFormatCapabilities_CreateDynamic))
        )
     {
-        /* Storage for hard disks of this format can neither be explicitly
-         * created by VirtualBox nor deleted, so we place the hard disk to
+        /* Storage for mediums of this format can neither be explicitly
+         * created by VirtualBox nor deleted, so we place the medium to
          * Inaccessible state here and also add it to the registry. The
          * state means that one has to use RefreshState() to update the
          * medium format specific fields. */
@@ -955,7 +1060,7 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
         // create new UUID
         unconst(m->id).create();
 
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
         ComObjPtr<Medium> pMedium;
 
         /*
@@ -968,7 +1073,7 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
         {
             bool fInUse;
 
-            fInUse = m->pVirtualBox->isMediaUuidInUse(m->id, DeviceType_HardDisk);
+            fInUse = m->pVirtualBox->i_isMediaUuidInUse(m->id, aDeviceType);
             if (fInUse)
             {
                 // create new UUID
@@ -978,7 +1083,7 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
                 break;
         }
 
-        rc = m->pVirtualBox->registerMedium(this, &pMedium, DeviceType_HardDisk, treeLock);
+        rc = m->pVirtualBox->i_registerMedium(this, &pMedium, treeLock);
         Assert(this == pMedium || FAILED(rc));
     }
 
@@ -1049,7 +1154,7 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
         else if (aDeviceType == DeviceType_Floppy)
             m->type = MediumType_Writethrough;
 
-        rc = setLocation(aLocation);
+        rc = i_setLocation(aLocation);
         if (FAILED(rc)) return rc;
 
         /* get all the information about the medium from the storage unit */
@@ -1059,7 +1164,7 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
         m->state = MediumState_Inaccessible;
         m->strLastAccessError = tr("Accessibility check was not yet performed");
 
-        /* Confirm a successful initialization before the call to queryInfo.
+        /* Confirm a successful initialization before the call to i_queryInfo.
          * Otherwise we can end up with a AutoCaller deadlock because the
          * medium becomes visible but is not marked as initialized. Causes
          * locking trouble (e.g. trying to save media registries) which is
@@ -1072,10 +1177,10 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
     if (FAILED(autoCaller.rc()))
         return autoCaller.rc();
 
-    /* need to call queryInfo immediately to correctly place the medium in
+    /* need to call i_queryInfo immediately to correctly place the medium in
      * the respective media tree and update other information such as uuid */
-    rc = queryInfo(fForceNewUuid /* fSetImageId */, false /* fSetParentId */,
-                   autoCaller);
+    rc = i_queryInfo(fForceNewUuid /* fSetImageId */, false /* fSetParentId */,
+                     autoCaller);
     if (SUCCEEDED(rc))
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -1095,7 +1200,7 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
             AssertStmt(!m->id.isZero(),
                        alock.release(); autoCaller.release(); uninit(); return E_FAIL);
 
-            /* storage format must be detected by Medium::queryInfo if the
+            /* storage format must be detected by Medium::i_queryInfo if the
              * medium is accessible */
             AssertStmt(!m->strFormat.isEmpty(),
                        alock.release(); autoCaller.release(); uninit(); return E_FAIL);
@@ -1113,39 +1218,29 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
 
 /**
  * Initializes the medium object by loading its data from the given settings
- * node. In this mode, the medium will always be opened read/write.
+ * node. The medium will always be opened read/write.
  *
  * In this case, since we're loading from a registry, uuidMachineRegistry is
  * always set: it's either the global registry UUID or a machine UUID when
  * loading from a per-machine registry.
  *
- * @param aVirtualBox   VirtualBox object.
  * @param aParent       Parent medium disk or NULL for a root (base) medium.
  * @param aDeviceType   Device type of the medium.
- * @param uuidMachineRegistry The registry to which this medium should be added (global registry UUID or machine UUID).
- * @param aNode         Configuration settings.
- * @param strMachineFolder The machine folder with which to resolve relative paths; if empty, then we use the VirtualBox home directory
+ * @param uuidMachineRegistry The registry to which this medium should be
+ *                            added (global registry UUID or machine UUID).
+ * @param data          Configuration settings.
+ * @param strMachineFolder The machine folder with which to resolve relative paths;
+ *                         if empty, then we use the VirtualBox home directory
  *
  * @note Locks the medium tree for writing.
  */
-HRESULT Medium::init(VirtualBox *aVirtualBox,
-                     Medium *aParent,
-                     DeviceType_T aDeviceType,
-                     const Guid &uuidMachineRegistry,
-                     const settings::Medium &data,
-                     const Utf8Str &strMachineFolder)
+HRESULT Medium::initOne(Medium *aParent,
+                        DeviceType_T aDeviceType,
+                        const Guid &uuidMachineRegistry,
+                        const settings::Medium &data,
+                        const Utf8Str &strMachineFolder)
 {
-    using namespace settings;
-
-    AssertReturn(aVirtualBox, E_INVALIDARG);
-
-    /* Enclose the state transition NotReady->InInit->Ready */
-    AutoInitSpan autoInitSpan(this);
-    AssertReturn(autoInitSpan.isOk(), E_FAIL);
-
-    HRESULT rc = S_OK;
-
-    unconst(m->pVirtualBox) = aVirtualBox;
+    HRESULT rc;
 
     if (uuidMachineRegistry.isValid() && !uuidMachineRegistry.isZero())
         m->llRegistryIDs.push_back(uuidMachineRegistry);
@@ -1155,12 +1250,12 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
     if (aParent)
     {
         // differencing medium: add to parent
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
-        m->pParent = aParent;
-        aParent->m->llChildren.push_back(this);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        // no need to check maximum depth as settings reading did it
+        i_setParent(aParent);
     }
 
-    /* see below why we don't call Medium::queryInfo (and therefore treat
+    /* see below why we don't call Medium::i_queryInfo (and therefore treat
      * the medium as inaccessible for now */
     m->state = MediumState_Inaccessible;
     m->strLastAccessError = tr("Accessibility check was not yet performed");
@@ -1178,16 +1273,16 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
     if (aDeviceType == DeviceType_HardDisk)
     {
         AssertReturn(!data.strFormat.isEmpty(), E_FAIL);
-        rc = setFormat(data.strFormat);
+        rc = i_setFormat(data.strFormat);
         if (FAILED(rc)) return rc;
     }
     else
     {
         /// @todo handle host drive settings here as well?
         if (!data.strFormat.isEmpty())
-            rc = setFormat(data.strFormat);
+            rc = i_setFormat(data.strFormat);
         else
-            rc = setFormat("RAW");
+            rc = i_setFormat("RAW");
         if (FAILED(rc)) return rc;
     }
 
@@ -1218,7 +1313,7 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
         && !itCph->second.isEmpty())
     {
         Utf8Str strPlaintext;
-        int vrc = m->pVirtualBox->decryptSetting(&strPlaintext, itCph->second);
+        int vrc = m->pVirtualBox->i_decryptSetting(&strPlaintext, itCph->second);
         if (RT_SUCCESS(vrc))
             m->mapProperties["InitiatorSecret"] = strPlaintext;
     }
@@ -1240,14 +1335,14 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
         else
         {
             // Otherwise use the old VirtualBox "make absolute path" logic:
-            rc = m->pVirtualBox->calculateFullPath(data.strLocation, strFull);
+            rc = m->pVirtualBox->i_calculateFullPath(data.strLocation, strFull);
             if (FAILED(rc)) return rc;
         }
     }
     else
         strFull = data.strLocation;
 
-    rc = setLocation(strFull);
+    rc = i_setLocation(strFull);
     if (FAILED(rc)) return rc;
 
     if (aDeviceType == DeviceType_HardDisk)
@@ -1267,7 +1362,52 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
     LogFlowThisFunc(("m->strLocationFull='%s', m->strFormat=%s, m->id={%RTuuid}\n",
                      m->strLocationFull.c_str(), m->strFormat.c_str(), m->id.raw()));
 
-    /* Don't call Medium::queryInfo for registered media to prevent the calling
+    return S_OK;
+}
+
+/**
+ * Initializes the medium object and its children by loading its data from the
+ * given settings node. The medium will always be opened read/write.
+ *
+ * In this case, since we're loading from a registry, uuidMachineRegistry is
+ * always set: it's either the global registry UUID or a machine UUID when
+ * loading from a per-machine registry.
+ *
+ * @param aVirtualBox   VirtualBox object.
+ * @param aParent       Parent medium disk or NULL for a root (base) medium.
+ * @param aDeviceType   Device type of the medium.
+ * @param uuidMachineRegistry The registry to which this medium should be added (global registry UUID or machine UUID).
+ * @param data          Configuration settings.
+ * @param strMachineFolder The machine folder with which to resolve relative paths; if empty, then we use the VirtualBox home directory
+ *
+ * @note Locks the medium tree for writing.
+ */
+HRESULT Medium::init(VirtualBox *aVirtualBox,
+                     Medium *aParent,
+                     DeviceType_T aDeviceType,
+                     const Guid &uuidMachineRegistry,
+                     const settings::Medium &data,
+                     const Utf8Str &strMachineFolder,
+                     AutoWriteLock &mediaTreeLock)
+{
+    using namespace settings;
+
+    Assert(aVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    AssertReturn(aVirtualBox, E_INVALIDARG);
+
+    /* Enclose the state transition NotReady->InInit->Ready */
+    AutoInitSpan autoInitSpan(this);
+    AssertReturn(autoInitSpan.isOk(), E_FAIL);
+
+    unconst(m->pVirtualBox) = aVirtualBox;
+
+    // Do not inline this method call, as the purpose of having this separate
+    // is to save on stack size. Less local variables are the key for reaching
+    // deep recursion levels with small stack (XPCOM/g++ without optimization).
+    HRESULT rc = initOne(aParent, aDeviceType, uuidMachineRegistry, data, strMachineFolder);
+
+
+    /* Don't call Medium::i_queryInfo for registered media to prevent the calling
      * thread (i.e. the VirtualBox server startup thread) from an unexpected
      * freeze but mark it as initially inaccessible instead. The vital UUID,
      * location and format properties are read from the registry file above; to
@@ -1281,19 +1421,18 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
     {
         const settings::Medium &med = *it;
 
-        ComObjPtr<Medium> pHD;
-        pHD.createObject();
-        rc = pHD->init(aVirtualBox,
-                       this,            // parent
-                       aDeviceType,
-                       uuidMachineRegistry,
-                       med,               // child data
-                       strMachineFolder);
+        ComObjPtr<Medium> pMedium;
+        pMedium.createObject();
+        rc = pMedium->init(aVirtualBox,
+                           this,            // parent
+                           aDeviceType,
+                           uuidMachineRegistry,
+                           med,               // child data
+                           strMachineFolder,
+                           mediaTreeLock);
         if (FAILED(rc)) break;
 
-        AutoWriteLock treeLock(aVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
-
-        rc = m->pVirtualBox->registerMedium(pHD, &pHD, DeviceType_HardDisk, treeLock);
+        rc = m->pVirtualBox->i_registerMedium(pMedium, &pMedium, mediaTreeLock);
         if (FAILED(rc)) break;
     }
 
@@ -1355,9 +1494,9 @@ HRESULT Medium::init(VirtualBox *aVirtualBox,
     m->devType = aDeviceType;
     m->state = MediumState_Created;
     m->hostDrive = true;
-    HRESULT rc = setFormat("RAW");
+    HRESULT rc = i_setFormat("RAW");
     if (FAILED(rc)) return rc;
-    rc = setLocation(aLocation);
+    rc = i_setLocation(aLocation);
     if (FAILED(rc)) return rc;
     m->strDescription = aDescription;
 
@@ -1380,16 +1519,16 @@ void Medium::uninit()
      * Normally this would be handled through the AutoUninitSpan magic,
      * however this cannot be done at this point as the media tree must be
      * locked before reaching the AutoUninitSpan, otherwise deadlocks can
-     * happen due to lock order violation. */
+     * happen due to*/
     ComObjPtr<VirtualBox> pVirtualBox(m->pVirtualBox);
     if (!pVirtualBox)
         return;
 
     /* Caller must not hold the object or media tree lock over uninit(). */
     Assert(!isWriteLockOnCurrentThread());
-    //Assert(!pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(!pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
-    AutoWriteLock treeLock(pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock treeLock(pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     /* Enclose the state transition Ready->InUninit->NotReady */
     AutoUninitSpan autoUninitSpan(this);
@@ -1397,11 +1536,7 @@ void Medium::uninit()
         return;
 
     if (!m->formatObj.isNull())
-    {
-        /* remove the caller reference we added in setFormat() */
-        m->formatObj->releaseCaller();
         m->formatObj.setNull();
-    }
 
     if (m->state == MediumState_Deleting)
     {
@@ -1428,7 +1563,7 @@ void Medium::uninit()
         if (m->pParent)
         {
             // this is a differencing disk: then remove it from the parent's children list
-            deparent();
+            i_deparent();
         }
     }
 
@@ -1441,7 +1576,7 @@ void Medium::uninit()
  *
  * The caller must hold the medium tree lock!
  */
-void Medium::deparent()
+void Medium::i_deparent()
 {
     MediaList &llParent = m->pParent->m->llChildren;
     for (MediaList::iterator it = llParent.begin();
@@ -1464,7 +1599,7 @@ void Medium::deparent()
  *
  * The caller must hold the medium tree lock!
  */
-void Medium::setParent(const ComObjPtr<Medium> &pParent)
+void Medium::i_setParent(const ComObjPtr<Medium> &pParent)
 {
     m->pParent = pParent;
     if (pParent)
@@ -1478,121 +1613,75 @@ void Medium::setParent(const ComObjPtr<Medium> &pParent)
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP Medium::COMGETTER(Id)(BSTR *aId)
+HRESULT Medium::getId(com::Guid &aId)
 {
-    CheckComArgOutPointerValid(aId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->id.toUtf16().cloneTo(aId);
+    aId = m->id;
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Description)(BSTR *aDescription)
+HRESULT Medium::getDescription(com::Utf8Str &aDescription)
 {
-    CheckComArgOutPointerValid(aDescription);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strDescription.cloneTo(aDescription);
+    aDescription = m->strDescription;
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMSETTER(Description)(IN_BSTR aDescription)
+HRESULT Medium::setDescription(const com::Utf8Str &aDescription)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
 //     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /// @todo update m->description and save the global registry (and local
     /// registries of portable VMs referring to this medium), this will also
     /// require to add the mRegistered flag to data
-
     NOREF(aDescription);
-
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP Medium::COMGETTER(State)(MediumState_T *aState)
+HRESULT Medium::getState(MediumState_T *aState)
 {
-    CheckComArgOutPointerValid(aState);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     *aState = m->state;
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Variant)(ComSafeArrayOut(MediumVariant_T, aVariant))
+HRESULT Medium::getVariant(std::vector<MediumVariant_T> &aVariant)
 {
-    CheckComArgOutSafeArrayPointerValid(aVariant);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeArray<MediumVariant_T> variants(sizeof(MediumVariant_T)*8);
-
-    for (ULONG i = 0; i < variants.size(); ++i)
-    {
-        ULONG temp = m->variant;
-        temp &= 1<<i;
-        variants [i] = (MediumVariant_T)temp;
-    }
-
-    variants.detachTo(ComSafeArrayOutArg(aVariant));
+    const size_t cBits = sizeof(MediumVariant_T) * 8;
+    aVariant.resize(cBits);
+    for (size_t i = 0; i < cBits; ++i)
+        aVariant[i] = (MediumVariant_T)(m->variant & RT_BIT(i));
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Location)(BSTR *aLocation)
+HRESULT Medium::getLocation(com::Utf8Str &aLocation)
 {
-    CheckComArgOutPointerValid(aLocation);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strLocationFull.cloneTo(aLocation);
+    aLocation = m->strLocationFull;
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Name)(BSTR *aName)
+HRESULT Medium::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    getName().cloneTo(aName);
+    aName = i_getName();
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(DeviceType)(DeviceType_T *aDeviceType)
+HRESULT Medium::getDeviceType(DeviceType_T *aDeviceType)
 {
-    CheckComArgOutPointerValid(aDeviceType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aDeviceType = m->devType;
@@ -1600,13 +1689,8 @@ STDMETHODIMP Medium::COMGETTER(DeviceType)(DeviceType_T *aDeviceType)
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(HostDrive)(BOOL *aHostDrive)
+HRESULT Medium::getHostDrive(BOOL *aHostDrive)
 {
-    CheckComArgOutPointerValid(aHostDrive);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aHostDrive = m->hostDrive;
@@ -1614,13 +1698,8 @@ STDMETHODIMP Medium::COMGETTER(HostDrive)(BOOL *aHostDrive)
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Size)(LONG64 *aSize)
+HRESULT Medium::getSize(LONG64 *aSize)
 {
-    CheckComArgOutPointerValid(aSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aSize = m->size;
@@ -1628,39 +1707,24 @@ STDMETHODIMP Medium::COMGETTER(Size)(LONG64 *aSize)
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Format)(BSTR *aFormat)
+HRESULT Medium::getFormat(com::Utf8Str &aFormat)
 {
-    CheckComArgOutPointerValid(aFormat);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, m->strFormat is const */
-    m->strFormat.cloneTo(aFormat);
 
+    aFormat = m->strFormat;
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(MediumFormat)(IMediumFormat **aMediumFormat)
+HRESULT Medium::getMediumFormat(ComPtr<IMediumFormat> &aMediumFormat)
 {
-    CheckComArgOutPointerValid(aMediumFormat);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, m->formatObj is const */
-    m->formatObj.queryInterfaceTo(aMediumFormat);
+    m->formatObj.queryInterfaceTo(aMediumFormat.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Type)(MediumType_T *aType)
+HRESULT Medium::getType(MediumType_T *aType)
 {
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aType = m->type;
@@ -1668,13 +1732,10 @@ STDMETHODIMP Medium::COMGETTER(Type)(MediumType_T *aType)
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMSETTER(Type)(MediumType_T aType)
+HRESULT Medium::setType(MediumType_T aType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // we access mParent and members
-    AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
     AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS);
 
     switch (m->state)
@@ -1683,7 +1744,7 @@ STDMETHODIMP Medium::COMSETTER(Type)(MediumType_T aType)
         case MediumState_Inaccessible:
             break;
         default:
-            return setStateError();
+            return i_setStateError();
     }
 
     if (m->type == aType)
@@ -1692,7 +1753,7 @@ STDMETHODIMP Medium::COMSETTER(Type)(MediumType_T aType)
         return S_OK;
     }
 
-    DeviceType_T devType = getDeviceType();
+    DeviceType_T devType = i_getDeviceType();
     // DVD media can only be readonly.
     if (devType == DeviceType_DVD && aType != MediumType_Readonly)
         return setError(VBOX_E_INVALID_OBJECT_STATE,
@@ -1743,13 +1804,13 @@ STDMETHODIMP Medium::COMSETTER(Type)(MediumType_T aType)
         {
             /* cannot change to writethrough, shareable or readonly
              * if there are children */
-            if (getChildren().size() != 0)
+            if (i_getChildren().size() != 0)
                 return setError(VBOX_E_OBJECT_IN_USE,
                                 tr("Cannot change type for medium '%s' since it has %d child media"),
-                                m->strLocationFull.c_str(), getChildren().size());
+                                m->strLocationFull.c_str(), i_getChildren().size());
             if (aType == MediumType_Shareable)
             {
-                MediumVariant_T variant = getVariant();
+                MediumVariant_T variant = i_getVariant();
                 if (!(variant & MediumVariant_Fixed))
                     return setError(VBOX_E_INVALID_OBJECT_STATE,
                                     tr("Cannot change type for medium '%s' to 'Shareable' since it is a dynamic medium storage unit"),
@@ -1781,8 +1842,8 @@ STDMETHODIMP Medium::COMSETTER(Type)(MediumType_T aType)
         // because that might make downgrading to pre-4.0 impossible.
         // As a result, we can only use these two new types if the medium is NOT in the
         // global registry:
-        const Guid &uuidGlobalRegistry = m->pVirtualBox->getGlobalRegistryId();
-        if (isInRegistry(uuidGlobalRegistry))
+        const Guid &uuidGlobalRegistry = m->pVirtualBox->i_getGlobalRegistryId();
+        if (i_isInRegistry(uuidGlobalRegistry))
             return setError(VBOX_E_INVALID_OBJECT_STATE,
                             tr("Cannot change type for medium '%s': the media type 'MultiAttach' can only be used "
                                "on media registered with a machine that was created with VirtualBox 4.0 or later"),
@@ -1794,99 +1855,81 @@ STDMETHODIMP Medium::COMSETTER(Type)(MediumType_T aType)
     // save the settings
     mlock.release();
     treeLock.release();
-    markRegistriesModified();
-    m->pVirtualBox->saveModifiedRegistries();
+    i_markRegistriesModified();
+    m->pVirtualBox->i_saveModifiedRegistries();
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(AllowedTypes)(ComSafeArrayOut(MediumType_T, aAllowedTypes))
+HRESULT Medium::getAllowedTypes(std::vector<MediumType_T> &aAllowedTypes)
 {
-    CheckComArgOutSafeArrayPointerValid(aAllowedTypes);
     NOREF(aAllowedTypes);
-#ifndef RT_OS_WINDOWS
-    NOREF(aAllowedTypesSize);
-#endif
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP Medium::COMGETTER(Parent)(IMedium **aParent)
+HRESULT Medium::getParent(AutoCaller &autoCaller, ComPtr<IMedium> &aParent)
 {
-    CheckComArgOutPointerValid(aParent);
+    autoCaller.release();
 
     /* It is possible that some previous/concurrent uninit has already cleared
      * the pVirtualBox reference, see #uninit(). */
     ComObjPtr<VirtualBox> pVirtualBox(m->pVirtualBox);
 
-    /* we access mParent, must be before the AutoCaller to avoid deadlocks */
-    AutoReadLock treeLock(!pVirtualBox.isNull() ? &pVirtualBox->getMediaTreeLockHandle() : NULL COMMA_LOCKVAL_SRC_POS);
+    /* we access mParent */
+    AutoReadLock treeLock(!pVirtualBox.isNull() ? &pVirtualBox->i_getMediaTreeLockHandle() : NULL COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
+    autoCaller.add();
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    m->pParent.queryInterfaceTo(aParent);
+    m->pParent.queryInterfaceTo(aParent.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Children)(ComSafeArrayOut(IMedium *, aChildren))
+HRESULT Medium::getChildren(AutoCaller &autoCaller, std::vector<ComPtr<IMedium> > &aChildren)
 {
-    CheckComArgOutSafeArrayPointerValid(aChildren);
+    autoCaller.release();
 
     /* It is possible that some previous/concurrent uninit has already cleared
      * the pVirtualBox reference, see #uninit(). */
     ComObjPtr<VirtualBox> pVirtualBox(m->pVirtualBox);
 
-    /* we access children, must be before the AutoCaller to avoid deadlocks */
-    AutoReadLock treeLock(!pVirtualBox.isNull() ? &pVirtualBox->getMediaTreeLockHandle() : NULL COMMA_LOCKVAL_SRC_POS);
+    /* we access children */
+    AutoReadLock treeLock(!pVirtualBox.isNull() ? &pVirtualBox->i_getMediaTreeLockHandle() : NULL COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
+    autoCaller.add();
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    SafeIfaceArray<IMedium> children(this->getChildren());
-    children.detachTo(ComSafeArrayOutArg(aChildren));
-
+    MediaList children(this->i_getChildren());
+    aChildren.resize(children.size());
+    size_t i = 0;
+    for (MediaList::const_iterator it =  children.begin(); it != children.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aChildren[i].asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(Base)(IMedium **aBase)
+HRESULT Medium::getBase(AutoCaller &autoCaller, ComPtr<IMedium> &aBase)
 {
-    CheckComArgOutPointerValid(aBase);
-
-    /* base() will do callers/locking */
+    autoCaller.release();
 
-    getBase().queryInterfaceTo(aBase);
+    /* i_getBase() will do callers/locking */
+    i_getBase().queryInterfaceTo(aBase.asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(ReadOnly)(BOOL *aReadOnly)
+HRESULT Medium::getReadOnly(BOOL *aReadOnly)
 {
-    CheckComArgOutPointerValid(aReadOnly);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* isReadOnly() will do locking */
-
-    *aReadOnly = isReadOnly();
+    *aReadOnly = i_isReadOnly();
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(LogicalSize)(LONG64 *aLogicalSize)
+HRESULT Medium::getLogicalSize(LONG64 *aLogicalSize)
 {
-    CheckComArgOutPointerValid(aLogicalSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aLogicalSize = m->logicalSize;
@@ -1894,13 +1937,8 @@ STDMETHODIMP Medium::COMGETTER(LogicalSize)(LONG64 *aLogicalSize)
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(AutoReset)(BOOL *aAutoReset)
+HRESULT Medium::getAutoReset(BOOL *aAutoReset)
 {
-    CheckComArgOutPointerValid(aAutoReset);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (m->pParent.isNull())
@@ -1911,11 +1949,8 @@ STDMETHODIMP Medium::COMGETTER(AutoReset)(BOOL *aAutoReset)
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMSETTER(AutoReset)(BOOL aAutoReset)
+HRESULT Medium::setAutoReset(BOOL aAutoReset)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS);
 
     if (m->pParent.isNull())
@@ -1929,63 +1964,44 @@ STDMETHODIMP Medium::COMSETTER(AutoReset)(BOOL aAutoReset)
 
         // save the settings
         mlock.release();
-        markRegistriesModified();
-        m->pVirtualBox->saveModifiedRegistries();
+        i_markRegistriesModified();
+        m->pVirtualBox->i_saveModifiedRegistries();
     }
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(LastAccessError)(BSTR *aLastAccessError)
+HRESULT Medium::getLastAccessError(com::Utf8Str &aLastAccessError)
 {
-    CheckComArgOutPointerValid(aLastAccessError);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strLastAccessError.cloneTo(aLastAccessError);
+    aLastAccessError = m->strLastAccessError;
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::COMGETTER(MachineIds)(ComSafeArrayOut(BSTR,aMachineIds))
+HRESULT Medium::getMachineIds(std::vector<com::Guid> &aMachineIds)
 {
-    CheckComArgOutSafeArrayPointerValid(aMachineIds);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<BSTR> machineIds;
-
     if (m->backRefs.size() != 0)
     {
-        machineIds.reset(m->backRefs.size());
-
+        BackRefList brlist(m->backRefs);
+        aMachineIds.resize(brlist.size());
         size_t i = 0;
-        for (BackRefList::const_iterator it = m->backRefs.begin();
-             it != m->backRefs.end(); ++it, ++i)
-        {
-             it->machineId.toUtf16().detachTo(&machineIds[i]);
-        }
+        for (BackRefList::const_iterator it = brlist.begin(); it != brlist.end(); ++it, ++i)
+             aMachineIds[i] = it->machineId;
     }
 
-    machineIds.detachTo(ComSafeArrayOutArg(aMachineIds));
-
     return S_OK;
 }
 
-STDMETHODIMP Medium::SetIds(BOOL aSetImageId,
-                            IN_BSTR aImageId,
-                            BOOL aSetParentId,
-                            IN_BSTR aParentId)
+HRESULT Medium::setIds(AutoCaller &autoCaller,
+                       BOOL aSetImageId,
+                       const com::Guid &aImageId,
+                       BOOL aSetParentId,
+                       const com::Guid &aParentId)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     switch (m->state)
@@ -1993,49 +2009,44 @@ STDMETHODIMP Medium::SetIds(BOOL aSetImageId,
         case MediumState_Created:
             break;
         default:
-            return setStateError();
+            return i_setStateError();
     }
 
     Guid imageId, parentId;
     if (aSetImageId)
     {
-        if (Bstr(aImageId).isEmpty())
+        if (aImageId.toUtf16().isEmpty())
             imageId.create();
         else
         {
-            imageId = Guid(aImageId);
+            imageId = aImageId;
             if (!imageId.isValid())
                 return setError(E_INVALIDARG, tr("Argument %s is invalid"), "aImageId");
         }
     }
     if (aSetParentId)
     {
-        if (Bstr(aParentId).isEmpty())
+        if (aParentId.toUtf16().isEmpty())
             parentId.create();
         else
-            parentId = Guid(aParentId);
+            parentId = aParentId;
     }
 
     unconst(m->uuidImage) = imageId;
     unconst(m->uuidParentImage) = parentId;
 
-    // must not hold any locks before calling Medium::queryInfo
+    // must not hold any locks before calling Medium::i_queryInfo
     alock.release();
 
-    HRESULT rc = queryInfo(!!aSetImageId /* fSetImageId */,
-                           !!aSetParentId /* fSetParentId */,
-                           autoCaller);
+    HRESULT rc = i_queryInfo(!!aSetImageId /* fSetImageId */,
+                             !!aSetParentId /* fSetParentId */,
+                             autoCaller);
 
     return rc;
 }
 
-STDMETHODIMP Medium::RefreshState(MediumState_T *aState)
+HRESULT Medium::refreshState(AutoCaller &autoCaller, MediumState_T *aState)
 {
-    CheckComArgOutPointerValid(aState);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
@@ -2046,11 +2057,11 @@ STDMETHODIMP Medium::RefreshState(MediumState_T *aState)
         case MediumState_Inaccessible:
         case MediumState_LockedRead:
         {
-            // must not hold any locks before calling Medium::queryInfo
+            // must not hold any locks before calling Medium::i_queryInfo
             alock.release();
 
-            rc = queryInfo(false /* fSetImageId */, false /* fSetParentId */,
-                           autoCaller);
+            rc = i_queryInfo(false /* fSetImageId */, false /* fSetParentId */,
+                             autoCaller);
 
             alock.acquire();
             break;
@@ -2064,24 +2075,15 @@ STDMETHODIMP Medium::RefreshState(MediumState_T *aState)
     return rc;
 }
 
-STDMETHODIMP Medium::GetSnapshotIds(IN_BSTR aMachineId,
-                                    ComSafeArrayOut(BSTR, aSnapshotIds))
+HRESULT Medium::getSnapshotIds(const com::Guid &aMachineId,
+                               std::vector<com::Guid> &aSnapshotIds)
 {
-    CheckComArgExpr(aMachineId, Guid(aMachineId).isValid());
-    CheckComArgOutSafeArrayPointerValid(aSnapshotIds);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<BSTR> snapshotIds;
-
-    Guid id(aMachineId);
     for (BackRefList::const_iterator it = m->backRefs.begin();
          it != m->backRefs.end(); ++it)
     {
-        if (it->machineId == id)
+        if (it->machineId == aMachineId)
         {
             size_t size = it->llSnapshotIds.size();
 
@@ -2092,44 +2094,33 @@ STDMETHODIMP Medium::GetSnapshotIds(IN_BSTR aMachineId,
 
             if (size > 0)
             {
-                snapshotIds.reset(size);
+                aSnapshotIds.resize(size);
 
                 size_t j = 0;
                 if (it->fInCurState)
-                    it->machineId.toUtf16().detachTo(&snapshotIds[j++]);
+                    aSnapshotIds[j++] = it->machineId.toUtf16();
 
-                for (GuidList::const_iterator jt = it->llSnapshotIds.begin();
-                     jt != it->llSnapshotIds.end();
-                     ++jt, ++j)
-                {
-                     (*jt).toUtf16().detachTo(&snapshotIds[j]);
-                }
+                for(GuidList::const_iterator jt = it->llSnapshotIds.begin(); jt != it->llSnapshotIds.end(); ++jt, ++j)
+                    aSnapshotIds[j] = (*jt);
             }
 
             break;
         }
     }
 
-    snapshotIds.detachTo(ComSafeArrayOutArg(aSnapshotIds));
-
     return S_OK;
 }
 
-STDMETHODIMP Medium::LockRead(IToken **aToken)
+HRESULT Medium::lockRead(ComPtr<IToken> &aToken)
 {
-    CheckComArgNotNull(aToken);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    /* Wait for a concurrently running Medium::queryInfo to complete. */
+    /* Wait for a concurrently running Medium::i_queryInfo to complete. */
     if (m->queryInfoRunning)
     {
-        /* Must not hold the media tree lock, as Medium::queryInfo needs this
+        /* Must not hold the media tree lock, as Medium::i_queryInfo needs this
          * lock and thus we would run into a deadlock here. */
-        Assert(!m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+        Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
         while (m->queryInfoRunning)
         {
             alock.release();
@@ -2173,13 +2164,13 @@ STDMETHODIMP Medium::LockRead(IToken **aToken)
                 return rc;
             }
 
-            pToken.queryInterfaceTo(aToken);
+            pToken.queryInterfaceTo(aToken.asOutParam());
             break;
         }
         default:
         {
             LogFlowThisFunc(("Failing - state=%d\n", m->state));
-            rc = setStateError();
+            rc = i_setStateError();
             break;
         }
     }
@@ -2191,7 +2182,7 @@ STDMETHODIMP Medium::LockRead(IToken **aToken)
  * @note @a aState may be NULL if the state value is not needed (only for
  *       in-process calls).
  */
-HRESULT Medium::unlockRead(MediumState_T *aState)
+HRESULT Medium::i_unlockRead(MediumState_T *aState)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -2237,22 +2228,16 @@ HRESULT Medium::unlockRead(MediumState_T *aState)
 
     return rc;
 }
-
-STDMETHODIMP Medium::LockWrite(IToken **aToken)
+HRESULT Medium::lockWrite(ComPtr<IToken> &aToken)
 {
-    CheckComArgNotNull(aToken);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    /* Wait for a concurrently running Medium::queryInfo to complete. */
+    /* Wait for a concurrently running Medium::i_queryInfo to complete. */
     if (m->queryInfoRunning)
     {
-        /* Must not hold the media tree lock, as Medium::queryInfo needs this
+        /* Must not hold the media tree lock, as Medium::i_queryInfo needs this
          * lock and thus we would run into a deadlock here. */
-        Assert(!m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+        Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
         while (m->queryInfoRunning)
         {
             alock.release();
@@ -2274,7 +2259,7 @@ STDMETHODIMP Medium::LockWrite(IToken **aToken)
         {
             m->preLockState = m->state;
 
-            LogFlowThisFunc(("Okay - prev state=%d locationFull=%s\n", m->state, getLocationFull().c_str()));
+            LogFlowThisFunc(("Okay - prev state=%d locationFull=%s\n", m->state, i_getLocationFull().c_str()));
             m->state = MediumState_LockedWrite;
 
             ComObjPtr<MediumLockToken> pToken;
@@ -2287,13 +2272,13 @@ STDMETHODIMP Medium::LockWrite(IToken **aToken)
                 return rc;
             }
 
-            pToken.queryInterfaceTo(aToken);
+            pToken.queryInterfaceTo(aToken.asOutParam());
             break;
         }
         default:
         {
-            LogFlowThisFunc(("Failing - state=%d locationFull=%s\n", m->state, getLocationFull().c_str()));
-            rc = setStateError();
+            LogFlowThisFunc(("Failing - state=%d locationFull=%s\n", m->state, i_getLocationFull().c_str()));
+            rc = i_setStateError();
             break;
         }
     }
@@ -2305,7 +2290,7 @@ STDMETHODIMP Medium::LockWrite(IToken **aToken)
  * @note @a aState may be NULL if the state value is not needed (only for
  *       in-process calls).
  */
-HRESULT Medium::unlockWrite(MediumState_T *aState)
+HRESULT Medium::i_unlockWrite(MediumState_T *aState)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -2324,12 +2309,12 @@ HRESULT Medium::unlockWrite(MediumState_T *aState)
              * gets the right state afterwards. */
             if (m->preLockState == MediumState_Deleting)
                 m->preLockState = MediumState_Created;
-            LogFlowThisFunc(("new state=%d locationFull=%s\n", m->state, getLocationFull().c_str()));
+            LogFlowThisFunc(("new state=%d locationFull=%s\n", m->state, i_getLocationFull().c_str()));
             break;
         }
         default:
         {
-            LogFlowThisFunc(("Failing - state=%d locationFull=%s\n", m->state, getLocationFull().c_str()));
+            LogFlowThisFunc(("Failing - state=%d locationFull=%s\n", m->state, i_getLocationFull().c_str()));
             rc = setError(VBOX_E_INVALID_OBJECT_STATE,
                           tr("Medium '%s' is not locked for writing"),
                           m->strLocationFull.c_str());
@@ -2344,55 +2329,42 @@ HRESULT Medium::unlockWrite(MediumState_T *aState)
     return rc;
 }
 
-STDMETHODIMP Medium::Close()
+HRESULT Medium::close(AutoCaller &aAutoCaller)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // make a copy of VirtualBox pointer which gets nulled by uninit()
     ComObjPtr<VirtualBox> pVirtualBox(m->pVirtualBox);
 
-    MultiResult mrc = close(autoCaller);
+    MultiResult mrc = i_close(aAutoCaller);
 
-    pVirtualBox->saveModifiedRegistries();
+    pVirtualBox->i_saveModifiedRegistries();
 
     return mrc;
 }
 
-STDMETHODIMP Medium::GetProperty(IN_BSTR aName, BSTR *aValue)
+HRESULT Medium::getProperty(const com::Utf8Str &aName,
+                            com::Utf8Str &aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgOutPointerValid(aValue);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    settings::StringsMap::const_iterator it = m->mapProperties.find(Utf8Str(aName));
+    settings::StringsMap::const_iterator it = m->mapProperties.find(aName);
     if (it == m->mapProperties.end())
     {
-     if (   !Utf8Str(aName).startsWith("Special/")
-         && !isPropertyForFilter(aName))
+        if (!aName.startsWith("Special/"))
             return setError(VBOX_E_OBJECT_NOT_FOUND,
-                            tr("Property '%ls' does not exist"), aName);
+                            tr("Property '%s' does not exist"), aName.c_str());
         else
             /* be more silent here */
             return VBOX_E_OBJECT_NOT_FOUND;
     }
 
-    it->second.cloneTo(aValue);
+    aValue = it->second;
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::SetProperty(IN_BSTR aName, IN_BSTR aValue)
+HRESULT Medium::setProperty(const com::Utf8Str &aName,
+                            const com::Utf8Str &aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS);
 
     switch (m->state)
@@ -2401,31 +2373,29 @@ STDMETHODIMP Medium::SetProperty(IN_BSTR aName, IN_BSTR aValue)
         case MediumState_Inaccessible:
             break;
         default:
-            return setStateError();
+            return i_setStateError();
     }
 
-    Utf8Str strName(aName);
-    Utf8Str strValue(aValue);
-    settings::StringsMap::iterator it = m->mapProperties.find(strName);
-    if (   !strName.startsWith("Special/")
-        && !isPropertyForFilter(strName))
+    settings::StringsMap::iterator it = m->mapProperties.find(aName);
+    if (   !aName.startsWith("Special/")
+        && !i_isPropertyForFilter(aName))
     {
         if (it == m->mapProperties.end())
             return setError(VBOX_E_OBJECT_NOT_FOUND,
                             tr("Property '%s' does not exist"),
-                            strName.c_str());
-        it->second = strValue;
+                            aName.c_str());
+        it->second = aValue;
     }
     else
     {
         if (it == m->mapProperties.end())
         {
-            if (!strValue.isEmpty())
-                m->mapProperties[strName] = strValue;
+            if (!aValue.isEmpty())
+                m->mapProperties[aName] = aValue;
         }
         else
         {
-            if (!strValue.isEmpty())
+            if (!aValue.isEmpty())
                 it->second = aValue;
             else
                 m->mapProperties.erase(it);
@@ -2434,68 +2404,47 @@ STDMETHODIMP Medium::SetProperty(IN_BSTR aName, IN_BSTR aValue)
 
     // save the settings
     mlock.release();
-    markRegistriesModified();
-    m->pVirtualBox->saveModifiedRegistries();
+    i_markRegistriesModified();
+    m->pVirtualBox->i_saveModifiedRegistries();
 
     return S_OK;
 }
 
-STDMETHODIMP Medium::GetProperties(IN_BSTR aNames,
-                                   ComSafeArrayOut(BSTR, aReturnNames),
-                                   ComSafeArrayOut(BSTR, aReturnValues))
+HRESULT Medium::getProperties(const com::Utf8Str &aNames,
+                              std::vector<com::Utf8Str> &aReturnNames,
+                              std::vector<com::Utf8Str> &aReturnValues)
 {
-    CheckComArgOutSafeArrayPointerValid(aReturnNames);
-    CheckComArgOutSafeArrayPointerValid(aReturnValues);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /// @todo make use of aNames according to the documentation
     NOREF(aNames);
 
-    com::SafeArray<BSTR> names(m->mapProperties.size());
-    com::SafeArray<BSTR> values(m->mapProperties.size());
+    aReturnNames.resize(m->mapProperties.size());
+    aReturnValues.resize(m->mapProperties.size());
     size_t i = 0;
-
     for (settings::StringsMap::const_iterator it = m->mapProperties.begin();
          it != m->mapProperties.end();
-         ++it)
+         ++it, ++i)
     {
-        it->first.cloneTo(&names[i]);
-        it->second.cloneTo(&values[i]);
-        ++i;
+        aReturnNames[i] = it->first;
+        aReturnValues[i] = it->second;
     }
-
-    names.detachTo(ComSafeArrayOutArg(aReturnNames));
-    values.detachTo(ComSafeArrayOutArg(aReturnValues));
-
     return S_OK;
 }
 
-STDMETHODIMP Medium::SetProperties(ComSafeArrayIn(IN_BSTR, aNames),
-                                   ComSafeArrayIn(IN_BSTR, aValues))
+HRESULT Medium::setProperties(const std::vector<com::Utf8Str> &aNames,
+                              const std::vector<com::Utf8Str> &aValues)
 {
-    CheckComArgSafeArrayNotNull(aNames);
-    CheckComArgSafeArrayNotNull(aValues);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<IN_BSTR> names(ComSafeArrayInArg(aNames));
-    com::SafeArray<IN_BSTR> values(ComSafeArrayInArg(aValues));
-
     /* first pass: validate names */
     for (size_t i = 0;
-         i < names.size();
+         i < aNames.size();
          ++i)
     {
-        Utf8Str strName(names[i]);
+        Utf8Str strName(aNames[i]);
         if (   !strName.startsWith("Special/")
-            && !isPropertyForFilter(strName)
+            && !i_isPropertyForFilter(strName)
             && m->mapProperties.find(strName) == m->mapProperties.end())
             return setError(VBOX_E_OBJECT_NOT_FOUND,
                             tr("Property '%s' does not exist"), strName.c_str());
@@ -2503,14 +2452,14 @@ STDMETHODIMP Medium::SetProperties(ComSafeArrayIn(IN_BSTR, aNames),
 
     /* second pass: assign */
     for (size_t i = 0;
-         i < names.size();
+         i < aNames.size();
          ++i)
     {
-        Utf8Str strName(names[i]);
-        Utf8Str strValue(values[i]);
+        Utf8Str strName(aNames[i]);
+        Utf8Str strValue(aValues[i]);
         settings::StringsMap::iterator it = m->mapProperties.find(strName);
         if (   !strName.startsWith("Special/")
-            && !isPropertyForFilter(strName))
+            && !i_isPropertyForFilter(strName))
         {
             AssertReturn(it != m->mapProperties.end(), E_FAIL);
             it->second = strValue;
@@ -2534,24 +2483,18 @@ STDMETHODIMP Medium::SetProperties(ComSafeArrayIn(IN_BSTR, aNames),
 
     // save the settings
     mlock.release();
-    markRegistriesModified();
-    m->pVirtualBox->saveModifiedRegistries();
+    i_markRegistriesModified();
+    m->pVirtualBox->i_saveModifiedRegistries();
 
     return S_OK;
 }
-
-STDMETHODIMP Medium::CreateBaseStorage(LONG64 aLogicalSize,
-                                       ComSafeArrayIn(MediumVariant_T, aVariant),
-                                       IProgress **aProgress)
+HRESULT Medium::createBaseStorage(LONG64 aLogicalSize,
+                                  const std::vector<MediumVariant_T> &aVariant,
+                                  ComPtr<IProgress> &aProgress)
 {
-    CheckComArgSafeArrayNotNull(aVariant);
-    CheckComArgOutPointerValid(aProgress);
     if (aLogicalSize < 0)
         return setError(E_INVALIDARG, tr("The medium size argument (%lld) is negative"), aLogicalSize);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT rc = S_OK;
     ComObjPtr<Progress> pProgress;
     Medium::Task *pTask = NULL;
@@ -2562,11 +2505,10 @@ STDMETHODIMP Medium::CreateBaseStorage(LONG64 aLogicalSize,
 
         ULONG mediumVariantFlags = 0;
 
-        if (aVariant)
+        if (aVariant.size())
         {
-            com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant));
-            for (size_t i = 0; i < variants.size(); i++)
-                mediumVariantFlags |= variants[i];
+            for (size_t i = 0; i < aVariant.size(); i++)
+                mediumVariantFlags |= (ULONG)aVariant[i];
         }
 
         mediumVariantFlags &= ((unsigned)~MediumVariant_Diff);
@@ -2578,13 +2520,13 @@ STDMETHODIMP Medium::CreateBaseStorage(LONG64 aLogicalSize,
                            m->strFormat.c_str());
 
         if (    (mediumVariantFlags & MediumVariant_Fixed)
-            &&  !(m->formatObj->i_getCapabilities() & MediumFormatCapabilities_CreateDynamic))
+            &&  !(m->formatObj->i_getCapabilities() & MediumFormatCapabilities_CreateFixed))
             throw setError(VBOX_E_NOT_SUPPORTED,
                            tr("Medium format '%s' does not support fixed storage creation"),
                            m->strFormat.c_str());
 
         if (m->state != MediumState_NotCreated)
-            throw setStateError();
+            throw i_setStateError();
 
         pProgress.createObject();
         rc = pProgress->init(m->pVirtualBox,
@@ -2611,10 +2553,10 @@ STDMETHODIMP Medium::CreateBaseStorage(LONG64 aLogicalSize,
 
     if (SUCCEEDED(rc))
     {
-        rc = startThread(pTask);
+        rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc))
-            pProgress.queryInterfaceTo(aProgress);
+            pProgress.queryInterfaceTo(aProgress.asOutParam());
     }
     else if (pTask != NULL)
         delete pTask;
@@ -2622,41 +2564,30 @@ STDMETHODIMP Medium::CreateBaseStorage(LONG64 aLogicalSize,
     return rc;
 }
 
-STDMETHODIMP Medium::DeleteStorage(IProgress **aProgress)
+HRESULT Medium::deleteStorage(ComPtr<IProgress> &aProgress)
 {
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     ComObjPtr<Progress> pProgress;
 
-    MultiResult mrc = deleteStorage(&pProgress,
-                                    false /* aWait */);
+    MultiResult mrc = i_deleteStorage(&pProgress,
+                                      false /* aWait */);
     /* Must save the registries in any case, since an entry was removed. */
-    m->pVirtualBox->saveModifiedRegistries();
+    m->pVirtualBox->i_saveModifiedRegistries();
 
     if (SUCCEEDED(mrc))
-        pProgress.queryInterfaceTo(aProgress);
+        pProgress.queryInterfaceTo(aProgress.asOutParam());
 
     return mrc;
 }
 
-STDMETHODIMP Medium::CreateDiffStorage(IMedium *aTarget,
-                                         ComSafeArrayIn(MediumVariant_T, aVariant),
-                                         IProgress **aProgress)
+HRESULT Medium::createDiffStorage(const ComPtr<IMedium> &aTarget,
+                                  const std::vector<MediumVariant_T> &aVariant,
+                                  ComPtr<IProgress> &aProgress)
 {
-    CheckComArgNotNull(aTarget);
-    CheckComArgOutPointerValid(aProgress);
-    CheckComArgSafeArrayNotNull(aVariant);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ComObjPtr<Medium> diff = static_cast<Medium*>(aTarget);
+    IMedium *aT = aTarget;
+    ComObjPtr<Medium> diff = static_cast<Medium*>(aT);
 
     // locking: we need the tree lock first because we access parent pointers
-    AutoMultiWriteLock3 alock(&m->pVirtualBox->getMediaTreeLockHandle(),
+    AutoMultiWriteLock3 alock(&m->pVirtualBox->i_getMediaTreeLockHandle(),
                               this->lockHandle(), diff->lockHandle() COMMA_LOCKVAL_SRC_POS);
 
     if (m->type == MediumType_Writethrough)
@@ -2675,10 +2606,11 @@ STDMETHODIMP Medium::CreateDiffStorage(IMedium *aTarget,
     /* Apply the normal locking logic to the entire chain. */
     MediumLockList *pMediumLockList(new MediumLockList());
     alock.release();
-    HRESULT rc = diff->createMediumLockList(true /* fFailIfInaccessible */,
-                                            true /* fMediumLockWrite */,
-                                            this,
-                                            *pMediumLockList);
+    HRESULT rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                              true /* fMediumLockWrite */,
+                                              false /* fMediumLockWriteAll */,
+                                              this,
+                                              *pMediumLockList);
     alock.acquire();
     if (FAILED(rc))
     {
@@ -2694,16 +2626,16 @@ STDMETHODIMP Medium::CreateDiffStorage(IMedium *aTarget,
         delete pMediumLockList;
 
         return setError(rc, tr("Could not lock medium when creating diff '%s'"),
-                        diff->getLocationFull().c_str());
+                        diff->i_getLocationFull().c_str());
     }
 
     Guid parentMachineRegistry;
-    if (getFirstRegistryMachineId(parentMachineRegistry))
+    if (i_getFirstRegistryMachineId(parentMachineRegistry))
     {
         /* since this medium has been just created it isn't associated yet */
         diff->m->llRegistryIDs.push_back(parentMachineRegistry);
         alock.release();
-        diff->markRegistriesModified();
+        diff->i_markRegistriesModified();
         alock.acquire();
     }
 
@@ -2713,33 +2645,31 @@ STDMETHODIMP Medium::CreateDiffStorage(IMedium *aTarget,
 
     ULONG mediumVariantFlags = 0;
 
-    if (aVariant)
+    if (aVariant.size())
     {
-        com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant));
-        for (size_t i = 0; i < variants.size(); i++)
-            mediumVariantFlags |= variants[i];
+        for (size_t i = 0; i < aVariant.size(); i++)
+            mediumVariantFlags |= (ULONG)aVariant[i];
     }
 
-    rc = createDiffStorage(diff, (MediumVariant_T)mediumVariantFlags, pMediumLockList,
-                           &pProgress, false /* aWait */);
+    rc = i_createDiffStorage(diff, (MediumVariant_T)mediumVariantFlags, pMediumLockList,
+                             &pProgress, false /* aWait */);
     if (FAILED(rc))
         delete pMediumLockList;
     else
-        pProgress.queryInterfaceTo(aProgress);
+        pProgress.queryInterfaceTo(aProgress.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP Medium::MergeTo(IMedium *aTarget, IProgress **aProgress)
+HRESULT Medium::mergeTo(const ComPtr<IMedium> &aTarget,
+                        ComPtr<IProgress> &aProgress)
 {
-    CheckComArgNotNull(aTarget);
-    CheckComArgOutPointerValid(aProgress);
-    ComAssertRet(aTarget != this, E_INVALIDARG);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    IMedium *aT = aTarget;
 
-    ComObjPtr<Medium> pTarget = static_cast<Medium*>(aTarget);
+    ComAssertRet(aT != this, E_INVALIDARG);
+
+    ComObjPtr<Medium> pTarget = static_cast<Medium*>(aT);
 
     bool fMergeForward = false;
     ComObjPtr<Medium> pParentForTarget;
@@ -2748,55 +2678,47 @@ STDMETHODIMP Medium::MergeTo(IMedium *aTarget, IProgress **aProgress)
 
     HRESULT rc = S_OK;
 
-    rc = prepareMergeTo(pTarget, NULL, NULL, true, fMergeForward,
-                        pParentForTarget, pChildrenToReparent, pMediumLockList);
+    rc = i_prepareMergeTo(pTarget, NULL, NULL, true, fMergeForward,
+                          pParentForTarget, pChildrenToReparent, pMediumLockList);
     if (FAILED(rc)) return rc;
 
     ComObjPtr<Progress> pProgress;
 
-    rc = mergeTo(pTarget, fMergeForward, pParentForTarget, pChildrenToReparent,
-                 pMediumLockList, &pProgress, false /* aWait */);
+    rc = i_mergeTo(pTarget, fMergeForward, pParentForTarget, pChildrenToReparent,
+                   pMediumLockList, &pProgress, false /* aWait */);
     if (FAILED(rc))
-        cancelMergeTo(pChildrenToReparent, pMediumLockList);
+        i_cancelMergeTo(pChildrenToReparent, pMediumLockList);
     else
-        pProgress.queryInterfaceTo(aProgress);
+        pProgress.queryInterfaceTo(aProgress.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP Medium::CloneToBase(IMedium   *aTarget,
-                                  ComSafeArrayIn(MediumVariant_T, aVariant),
-                                  IProgress **aProgress)
+HRESULT Medium::cloneToBase(const ComPtr<IMedium> &aTarget,
+                            const std::vector<MediumVariant_T> &aVariant,
+                            ComPtr<IProgress> &aProgress)
 {
      int rc = S_OK;
-     CheckComArgNotNull(aTarget);
-     CheckComArgOutPointerValid(aProgress);
-     CheckComArgSafeArrayNotNull(aVariant);
-
-     com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant));
 
-     rc =  CloneTo(aTarget, ComSafeArrayAsInParam(variants), NULL, aProgress);
+     rc =  cloneTo(aTarget, aVariant, NULL, aProgress);
      return rc;
 }
 
-STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
-                             ComSafeArrayIn(MediumVariant_T, aVariant),
-                             IMedium *aParent,
-                             IProgress **aProgress)
+HRESULT Medium::cloneTo(const ComPtr<IMedium> &aTarget,
+                        const std::vector<MediumVariant_T> &aVariant,
+                        const ComPtr<IMedium> &aParent,
+                        ComPtr<IProgress> &aProgress)
 {
-    CheckComArgNotNull(aTarget);
-    CheckComArgOutPointerValid(aProgress);
-    CheckComArgSafeArrayNotNull(aVariant);
-
     ComAssertRet(aTarget != this, E_INVALIDARG);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    ComObjPtr<Medium> pTarget = static_cast<Medium*>(aTarget);
+    IMedium *aT = aTarget;
+    ComObjPtr<Medium> pTarget = static_cast<Medium*>(aT);
     ComObjPtr<Medium> pParent;
     if (aParent)
-        pParent = static_cast<Medium*>(aParent);
+    {
+        IMedium *aP = aParent;
+        pParent = static_cast<Medium*>(aP);
+    }
 
     HRESULT rc = S_OK;
     ComObjPtr<Progress> pProgress;
@@ -2807,7 +2729,7 @@ STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
         // locking: we need the tree lock first because we access parent pointers
         // and we need to write-lock the media involved
         uint32_t    cHandles    = 3;
-        LockHandle* pHandles[4] = { &m->pVirtualBox->getMediaTreeLockHandle(),
+        LockHandle* pHandles[4] = { &m->pVirtualBox->i_getMediaTreeLockHandle(),
                                     this->lockHandle(),
                                     pTarget->lockHandle() };
         /* Only add parent to the lock if it is not null */
@@ -2819,15 +2741,16 @@ STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
 
         if (    pTarget->m->state != MediumState_NotCreated
             &&  pTarget->m->state != MediumState_Created)
-            throw pTarget->setStateError();
+            throw pTarget->i_setStateError();
 
         /* Build the source lock list. */
         MediumLockList *pSourceMediumLockList(new MediumLockList());
         alock.release();
-        rc = createMediumLockList(true /* fFailIfInaccessible */,
-                                  false /* fMediumLockWrite */,
-                                  NULL,
-                                  *pSourceMediumLockList);
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */,
+                                    false /* fMediumLockWrite */,
+                                    false /* fMediumLockWriteAll */,
+                                    NULL,
+                                    *pSourceMediumLockList);
         alock.acquire();
         if (FAILED(rc))
         {
@@ -2838,10 +2761,11 @@ STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
         /* Build the target lock list (including the to-be parent chain). */
         MediumLockList *pTargetMediumLockList(new MediumLockList());
         alock.release();
-        rc = pTarget->createMediumLockList(true /* fFailIfInaccessible */,
-                                           true /* fMediumLockWrite */,
-                                           pParent,
-                                           *pTargetMediumLockList);
+        rc = pTarget->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                             true /* fMediumLockWrite */,
+                                             false /* fMediumLockWriteAll */,
+                                             pParent,
+                                             *pTargetMediumLockList);
         alock.acquire();
         if (FAILED(rc))
         {
@@ -2859,7 +2783,7 @@ STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
             delete pTargetMediumLockList;
             throw setError(rc,
                            tr("Failed to lock source media '%s'"),
-                           getLocationFull().c_str());
+                           i_getLocationFull().c_str());
         }
         alock.release();
         rc = pTargetMediumLockList->Lock();
@@ -2870,7 +2794,7 @@ STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
             delete pTargetMediumLockList;
             throw setError(rc,
                            tr("Failed to lock target media '%s'"),
-                           pTarget->getLocationFull().c_str());
+                           pTarget->i_getLocationFull().c_str());
         }
 
         pProgress.createObject();
@@ -2887,11 +2811,10 @@ STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
 
         ULONG mediumVariantFlags = 0;
 
-        if (aVariant)
+        if (aVariant.size())
         {
-            com::SafeArray<MediumVariant_T> variants(ComSafeArrayInArg(aVariant));
-            for (size_t i = 0; i < variants.size(); i++)
-                mediumVariantFlags |= variants[i];
+            for (size_t i = 0; i < aVariant.size(); i++)
+                mediumVariantFlags |= (ULONG)aVariant[i];
         }
 
         /* setup task object to carry out the operation asynchronously */
@@ -2911,10 +2834,10 @@ STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
 
     if (SUCCEEDED(rc))
     {
-        rc = startThread(pTask);
+        rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc))
-            pProgress.queryInterfaceTo(aProgress);
+            pProgress.queryInterfaceTo(aProgress.asOutParam());
     }
     else if (pTask != NULL)
         delete pTask;
@@ -2922,15 +2845,11 @@ STDMETHODIMP Medium::CloneTo(IMedium *aTarget,
     return rc;
 }
 
-STDMETHODIMP Medium::SetLocation(IN_BSTR aLocation, IProgress **aProgress)
+HRESULT Medium::setLocation(const com::Utf8Str &aLocation, ComPtr<IProgress> &aProgress)
 {
-    CheckComArgStrNotEmptyOrNull(aLocation);
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    NOREF(aLocation);
+    NOREF(aProgress);
 
     /// @todo NEWMEDIA for file names, add the default extension if no extension
     /// is present (using the information from the VD backend which also implies
@@ -2941,17 +2860,11 @@ STDMETHODIMP Medium::SetLocation(IN_BSTR aLocation, IProgress **aProgress)
     /// the global registry (and local registries of portable VMs referring to
     /// this medium), this will also require to add the mRegistered flag to data
 
-    *aProgress = NULL;
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP Medium::Compact(IProgress **aProgress)
+HRESULT Medium::compact(ComPtr<IProgress> &aProgress)
 {
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT rc = S_OK;
     ComObjPtr<Progress> pProgress;
     Medium::Task *pTask = NULL;
@@ -2963,10 +2876,11 @@ STDMETHODIMP Medium::Compact(IProgress **aProgress)
         /* Build the medium lock list. */
         MediumLockList *pMediumLockList(new MediumLockList());
         alock.release();
-        rc = createMediumLockList(true /* fFailIfInaccessible */ ,
-                                  true /* fMediumLockWrite */,
-                                  NULL,
-                                  *pMediumLockList);
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */ ,
+                                    true /* fMediumLockWrite */,
+                                    false /* fMediumLockWriteAll */,
+                                    NULL,
+                                    *pMediumLockList);
         alock.acquire();
         if (FAILED(rc))
         {
@@ -2982,7 +2896,7 @@ STDMETHODIMP Medium::Compact(IProgress **aProgress)
             delete pMediumLockList;
             throw setError(rc,
                            tr("Failed to lock media when compacting '%s'"),
-                           getLocationFull().c_str());
+                           i_getLocationFull().c_str());
         }
 
         pProgress.createObject();
@@ -3007,10 +2921,10 @@ STDMETHODIMP Medium::Compact(IProgress **aProgress)
 
     if (SUCCEEDED(rc))
     {
-        rc = startThread(pTask);
+        rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc))
-            pProgress.queryInterfaceTo(aProgress);
+            pProgress.queryInterfaceTo(aProgress.asOutParam());
     }
     else if (pTask != NULL)
         delete pTask;
@@ -3018,13 +2932,9 @@ STDMETHODIMP Medium::Compact(IProgress **aProgress)
     return rc;
 }
 
-STDMETHODIMP Medium::Resize(LONG64 aLogicalSize, IProgress **aProgress)
+HRESULT Medium::resize(LONG64 aLogicalSize,
+                       ComPtr<IProgress> &aProgress)
 {
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT rc = S_OK;
     ComObjPtr<Progress> pProgress;
     Medium::Task *pTask = NULL;
@@ -3036,10 +2946,11 @@ STDMETHODIMP Medium::Resize(LONG64 aLogicalSize, IProgress **aProgress)
         /* Build the medium lock list. */
         MediumLockList *pMediumLockList(new MediumLockList());
         alock.release();
-        rc = createMediumLockList(true /* fFailIfInaccessible */ ,
-                                  true /* fMediumLockWrite */,
-                                  NULL,
-                                  *pMediumLockList);
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */ ,
+                                    true /* fMediumLockWrite */,
+                                    false /* fMediumLockWriteAll */,
+                                    NULL,
+                                    *pMediumLockList);
         alock.acquire();
         if (FAILED(rc))
         {
@@ -3055,7 +2966,7 @@ STDMETHODIMP Medium::Resize(LONG64 aLogicalSize, IProgress **aProgress)
             delete pMediumLockList;
             throw setError(rc,
                            tr("Failed to lock media when compacting '%s'"),
-                           getLocationFull().c_str());
+                           i_getLocationFull().c_str());
         }
 
         pProgress.createObject();
@@ -3080,10 +2991,10 @@ STDMETHODIMP Medium::Resize(LONG64 aLogicalSize, IProgress **aProgress)
 
     if (SUCCEEDED(rc))
     {
-        rc = startThread(pTask);
+        rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc))
-            pProgress.queryInterfaceTo(aProgress);
+            pProgress.queryInterfaceTo(aProgress.asOutParam());
     }
     else if (pTask != NULL)
         delete pTask;
@@ -3091,13 +3002,8 @@ STDMETHODIMP Medium::Resize(LONG64 aLogicalSize, IProgress **aProgress)
     return rc;
 }
 
-STDMETHODIMP Medium::Reset(IProgress **aProgress)
+HRESULT Medium::reset(ComPtr<IProgress> &aProgress)
 {
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT rc = S_OK;
     ComObjPtr<Progress> pProgress;
     Medium::Task *pTask = NULL;
@@ -3105,7 +3011,7 @@ STDMETHODIMP Medium::Reset(IProgress **aProgress)
     try
     {
         /* canClose() needs the tree lock */
-        AutoMultiWriteLock2 multilock(&m->pVirtualBox->getMediaTreeLockHandle(),
+        AutoMultiWriteLock2 multilock(&m->pVirtualBox->i_getMediaTreeLockHandle(),
                                       this->lockHandle()
                                       COMMA_LOCKVAL_SRC_POS);
 
@@ -3116,17 +3022,18 @@ STDMETHODIMP Medium::Reset(IProgress **aProgress)
                            tr("Medium type of '%s' is not differencing"),
                            m->strLocationFull.c_str());
 
-        rc = canClose();
+        rc = i_canClose();
         if (FAILED(rc))
             throw rc;
 
         /* Build the medium lock list. */
         MediumLockList *pMediumLockList(new MediumLockList());
         multilock.release();
-        rc = createMediumLockList(true /* fFailIfInaccessible */,
-                                  true /* fMediumLockWrite */,
-                                  NULL,
-                                  *pMediumLockList);
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */,
+                                    true /* fMediumLockWrite */,
+                                    false /* fMediumLockWriteAll */,
+                                    NULL,
+                                    *pMediumLockList);
         multilock.acquire();
         if (FAILED(rc))
         {
@@ -3142,7 +3049,7 @@ STDMETHODIMP Medium::Reset(IProgress **aProgress)
             delete pMediumLockList;
             throw setError(rc,
                            tr("Failed to lock media when resetting '%s'"),
-                           getLocationFull().c_str());
+                           i_getLocationFull().c_str());
         }
 
         pProgress.createObject();
@@ -3164,10 +3071,10 @@ STDMETHODIMP Medium::Reset(IProgress **aProgress)
 
     if (SUCCEEDED(rc))
     {
-        rc = startThread(pTask);
+        rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc))
-            pProgress.queryInterfaceTo(aProgress);
+            pProgress.queryInterfaceTo(aProgress.asOutParam());
     }
     else if (pTask != NULL)
         delete pTask;
@@ -3177,6 +3084,287 @@ STDMETHODIMP Medium::Reset(IProgress **aProgress)
     return rc;
 }
 
+HRESULT Medium::changeEncryption(const com::Utf8Str &aCurrentPassword, const com::Utf8Str &aCipher,
+                                 const com::Utf8Str &aNewPassword, const com::Utf8Str &aNewPasswordId,
+                                 ComPtr<IProgress> &aProgress)
+{
+    HRESULT rc = S_OK;
+    ComObjPtr<Progress> pProgress;
+    Medium::Task *pTask = NULL;
+
+    try
+    {
+        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+        DeviceType_T devType = i_getDeviceType();
+        /* Cannot encrypt DVD or floppy images so far. */
+        if (   devType == DeviceType_DVD
+            || devType == DeviceType_Floppy)
+            return setError(VBOX_E_INVALID_OBJECT_STATE,
+                            tr("Cannot encrypt DVD or Floppy medium '%s'"),
+                            m->strLocationFull.c_str());
+
+        /* Cannot encrypt media which are attached to more than one virtual machine. */
+        if (m->backRefs.size() > 1)
+            return setError(VBOX_E_INVALID_OBJECT_STATE,
+                            tr("Cannot encrypt medium '%s' because it is attached to %d virtual machines"),
+                            m->strLocationFull.c_str(), m->backRefs.size());
+
+        if (i_getChildren().size() != 0)
+            return setError(VBOX_E_INVALID_OBJECT_STATE,
+                            tr("Cannot encrypt medium '%s' because it has %d children"),
+                            m->strLocationFull.c_str(), i_getChildren().size());
+
+        /* Build the medium lock list. */
+        MediumLockList *pMediumLockList(new MediumLockList());
+        alock.release();
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */ ,
+                                    true /* fMediumLockWrite */,
+                                    true /* fMediumLockAllWrite */,
+                                    NULL,
+                                    *pMediumLockList);
+        alock.acquire();
+        if (FAILED(rc))
+        {
+            delete pMediumLockList;
+            throw rc;
+        }
+
+        alock.release();
+        rc = pMediumLockList->Lock();
+        alock.acquire();
+        if (FAILED(rc))
+        {
+            delete pMediumLockList;
+            throw setError(rc,
+                           tr("Failed to lock media for encryption '%s'"),
+                           i_getLocationFull().c_str());
+        }
+
+        /*
+         * Check all media in the chain to not contain any branches or references to
+         * other virtual machines, we support encrypting only a list of differencing media at the moment.
+         */
+        MediumLockList::Base::const_iterator mediumListBegin = pMediumLockList->GetBegin();
+        MediumLockList::Base::const_iterator mediumListEnd = pMediumLockList->GetEnd();
+        for (MediumLockList::Base::const_iterator it = mediumListBegin;
+             it != mediumListEnd;
+             ++it)
+        {
+            const MediumLock &mediumLock = *it;
+            const ComObjPtr<Medium> &pMedium = mediumLock.GetMedium();
+            AutoReadLock mediumReadLock(pMedium COMMA_LOCKVAL_SRC_POS);
+
+            Assert(pMedium->m->state == MediumState_LockedWrite);
+
+            if (pMedium->m->backRefs.size() > 1)
+            {
+                rc = setError(VBOX_E_INVALID_OBJECT_STATE,
+                              tr("Cannot encrypt medium '%s' because it is attached to %d virtual machines"),
+                              pMedium->m->strLocationFull.c_str(), pMedium->m->backRefs.size());
+                break;
+            }
+            else if (pMedium->i_getChildren().size() > 1)
+            {
+                rc = setError(VBOX_E_INVALID_OBJECT_STATE,
+                              tr("Cannot encrypt medium '%s' because it has %d children"),
+                              pMedium->m->strLocationFull.c_str(), pMedium->i_getChildren().size());
+                break;
+            }
+        }
+
+        if (FAILED(rc))
+        {
+            delete pMediumLockList;
+            throw rc;
+        }
+
+        const char *pszAction = "Encrypting";
+        if (   aCurrentPassword.isNotEmpty()
+            && aCipher.isEmpty())
+            pszAction = "Decrypting";
+
+        pProgress.createObject();
+        rc = pProgress->init(m->pVirtualBox,
+                             static_cast <IMedium *>(this),
+                             BstrFmt(tr("%s medium '%s'"), pszAction, m->strLocationFull.c_str()).raw(),
+                             TRUE /* aCancelable */);
+        if (FAILED(rc))
+        {
+            delete pMediumLockList;
+            throw rc;
+        }
+
+        /* setup task object to carry out the operation asynchronously */
+        pTask = new Medium::EncryptTask(this, aNewPassword, aCurrentPassword,
+                                        aCipher, aNewPasswordId, pProgress, pMediumLockList);
+        rc = pTask->rc();
+        AssertComRC(rc);
+        if (FAILED(rc))
+            throw rc;
+    }
+    catch (HRESULT aRC) { rc = aRC; }
+
+    if (SUCCEEDED(rc))
+    {
+        rc = i_startThread(pTask);
+
+        if (SUCCEEDED(rc))
+            pProgress.queryInterfaceTo(aProgress.asOutParam());
+    }
+    else if (pTask != NULL)
+        delete pTask;
+
+    return rc;
+}
+
+HRESULT Medium::getEncryptionSettings(com::Utf8Str &aCipher, com::Utf8Str &aPasswordId)
+{
+    HRESULT rc = S_OK;
+
+    try
+    {
+        ComObjPtr<Medium> pBase = i_getBase();
+        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+        settings::StringsMap::iterator it = pBase->m->mapProperties.find("CRYPT/KeyStore");
+        if (it == pBase->m->mapProperties.end())
+            throw setError(VBOX_E_NOT_SUPPORTED,
+                           tr("The image is not configured for encryption"));
+
+# ifdef VBOX_WITH_EXTPACK
+        static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
+        static const char *s_pszVDPlugin = "VDPluginCrypt";
+        ExtPackManager *pExtPackManager = m->pVirtualBox->i_getExtPackManager();
+        if (pExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+        {
+            /* Load the plugin */
+            Utf8Str strPlugin;
+            rc = pExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+            if (SUCCEEDED(rc))
+            {
+                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
+                if (RT_FAILURE(vrc))
+                    throw setError(VBOX_E_NOT_SUPPORTED,
+                                   tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),
+                                   i_vdError(vrc).c_str());
+            }
+            else
+                throw setError(VBOX_E_NOT_SUPPORTED,
+                               tr("Encryption is not supported because the extension pack '%s' is missing the encryption plugin (old extension pack installed?)"),
+                               strExtPackPuel.c_str());
+        }
+        else
+            throw setError(VBOX_E_NOT_SUPPORTED,
+                           tr("Encryption is not supported because the extension pack '%s' is missing"),
+                           strExtPackPuel.c_str());
+
+        PVBOXHDD pDisk = NULL;
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &pDisk);
+        ComAssertRCThrow(vrc, E_FAIL);
+
+        Medium::CryptoFilterSettings CryptoSettings;
+
+        i_taskEncryptSettingsSetup(&CryptoSettings, NULL, it->second.c_str(), NULL, false /* fCreateKeyStore */);
+        vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_READ | VD_FILTER_FLAGS_INFO, CryptoSettings.vdFilterIfaces);
+        if (RT_FAILURE(vrc))
+            throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                           tr("Failed to load the encryption filter: %s"),
+                           i_vdError(vrc).c_str());
+
+        it = pBase->m->mapProperties.find("CRYPT/KeyId");
+        if (it == pBase->m->mapProperties.end())
+            throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                           tr("Image is configured for encryption but doesn't has a KeyId set"));
+
+        aPasswordId = it->second.c_str();
+        aCipher = CryptoSettings.pszCipherReturned;
+        RTStrFree(CryptoSettings.pszCipherReturned);
+
+        VDDestroy(pDisk);
+# else
+        throw setError(VBOX_E_NOT_SUPPORTED,
+                       tr("Encryption is not supported because extension pack support is not built in"));
+# endif
+    }
+    catch (HRESULT aRC) { rc = aRC; }
+
+    return rc;
+}
+
+HRESULT Medium::checkEncryptionPassword(const com::Utf8Str &aPassword)
+{
+    HRESULT rc = S_OK;
+
+    try
+    {
+        ComObjPtr<Medium> pBase = i_getBase();
+        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+        settings::StringsMap::iterator it = pBase->m->mapProperties.find("CRYPT/KeyStore");
+        if (it == pBase->m->mapProperties.end())
+            throw setError(VBOX_E_NOT_SUPPORTED,
+                           tr("The image is not configured for encryption"));
+
+        if (aPassword.isEmpty())
+            throw setError(E_INVALIDARG,
+                           tr("The given password must not be empty"));
+
+# ifdef VBOX_WITH_EXTPACK
+        static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
+        static const char *s_pszVDPlugin = "VDPluginCrypt";
+        ExtPackManager *pExtPackManager = m->pVirtualBox->i_getExtPackManager();
+        if (pExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+        {
+            /* Load the plugin */
+            Utf8Str strPlugin;
+            rc = pExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+            if (SUCCEEDED(rc))
+            {
+                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
+                if (RT_FAILURE(vrc))
+                    throw setError(VBOX_E_NOT_SUPPORTED,
+                                   tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),
+                                   i_vdError(vrc).c_str());
+            }
+            else
+                throw setError(VBOX_E_NOT_SUPPORTED,
+                               tr("Encryption is not supported because the extension pack '%s' is missing the encryption plugin (old extension pack installed?)"),
+                               strExtPackPuel.c_str());
+        }
+        else
+            throw setError(VBOX_E_NOT_SUPPORTED,
+                           tr("Encryption is not supported because the extension pack '%s' is missing"),
+                           strExtPackPuel.c_str());
+
+        PVBOXHDD pDisk = NULL;
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &pDisk);
+        ComAssertRCThrow(vrc, E_FAIL);
+
+        Medium::CryptoFilterSettings CryptoSettings;
+
+        i_taskEncryptSettingsSetup(&CryptoSettings, NULL, it->second.c_str(), aPassword.c_str(),
+                                   false /* fCreateKeyStore */);
+        vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_READ, CryptoSettings.vdFilterIfaces);
+        if (vrc == VERR_VD_PASSWORD_INCORRECT)
+            throw setError(VBOX_E_PASSWORD_INCORRECT,
+                           tr("The given password is incorrect"));
+        else if (RT_FAILURE(vrc))
+            throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                           tr("Failed to load the encryption filter: %s"),
+                           i_vdError(vrc).c_str());
+
+        VDDestroy(pDisk);
+# else
+        throw setError(VBOX_E_NOT_SUPPORTED,
+                       tr("Encryption is not supported because extension pack support is not built in"));
+# endif
+    }
+    catch (HRESULT aRC) { rc = aRC; }
+
+    return rc;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // Medium public internal methods
@@ -3187,7 +3375,7 @@ STDMETHODIMP Medium::Reset(IProgress **aProgress)
  * Internal method to return the medium's parent medium. Must have caller + locking!
  * @return
  */
-const ComObjPtr<Medium>& Medium::getParent() const
+const ComObjPtr<Medium>& Medium::i_getParent() const
 {
     return m->pParent;
 }
@@ -3196,7 +3384,7 @@ const ComObjPtr<Medium>& Medium::getParent() const
  * Internal method to return the medium's list of child media. Must have caller + locking!
  * @return
  */
-const MediaList& Medium::getChildren() const
+const MediaList& Medium::i_getChildren() const
 {
     return m->llChildren;
 }
@@ -3205,7 +3393,7 @@ const MediaList& Medium::getChildren() const
  * Internal method to return the medium's GUID. Must have caller + locking!
  * @return
  */
-const Guid& Medium::getId() const
+const Guid& Medium::i_getId() const
 {
     return m->id;
 }
@@ -3214,7 +3402,7 @@ const Guid& Medium::getId() const
  * Internal method to return the medium's state. Must have caller + locking!
  * @return
  */
-MediumState_T Medium::getState() const
+MediumState_T Medium::i_getState() const
 {
     return m->state;
 }
@@ -3223,7 +3411,7 @@ MediumState_T Medium::getState() const
  * Internal method to return the medium's variant. Must have caller + locking!
  * @return
  */
-MediumVariant_T Medium::getVariant() const
+MediumVariant_T Medium::i_getVariant() const
 {
     return m->variant;
 }
@@ -3232,7 +3420,7 @@ MediumVariant_T Medium::getVariant() const
  * Internal method which returns true if this medium represents a host drive.
  * @return
  */
-bool Medium::isHostDrive() const
+bool Medium::i_isHostDrive() const
 {
     return m->hostDrive;
 }
@@ -3241,7 +3429,7 @@ bool Medium::isHostDrive() const
  * Internal method to return the medium's full location. Must have caller + locking!
  * @return
  */
-const Utf8Str& Medium::getLocationFull() const
+const Utf8Str& Medium::i_getLocationFull() const
 {
     return m->strLocationFull;
 }
@@ -3250,7 +3438,7 @@ const Utf8Str& Medium::getLocationFull() const
  * Internal method to return the medium's format string. Must have caller + locking!
  * @return
  */
-const Utf8Str& Medium::getFormat() const
+const Utf8Str& Medium::i_getFormat() const
 {
     return m->strFormat;
 }
@@ -3259,7 +3447,7 @@ const Utf8Str& Medium::getFormat() const
  * Internal method to return the medium's format object. Must have caller + locking!
  * @return
  */
-const ComObjPtr<MediumFormat>& Medium::getMediumFormat() const
+const ComObjPtr<MediumFormat>& Medium::i_getMediumFormat() const
 {
     return m->formatObj;
 }
@@ -3269,7 +3457,7 @@ const ComObjPtr<MediumFormat>& Medium::getMediumFormat() const
  * (and not iSCSI or something).
  * @return
  */
-bool Medium::isMediumFormatFile() const
+bool Medium::i_isMediumFormatFile() const
 {
     if (    m->formatObj
          && (m->formatObj->i_getCapabilities() & MediumFormatCapabilities_File)
@@ -3282,7 +3470,7 @@ bool Medium::isMediumFormatFile() const
  * Internal method to return the medium's size. Must have caller + locking!
  * @return
  */
-uint64_t Medium::getSize() const
+uint64_t Medium::i_getSize() const
 {
     return m->size;
 }
@@ -3291,7 +3479,7 @@ uint64_t Medium::getSize() const
  * Returns the medium device type. Must have caller + locking!
  * @return
  */
-DeviceType_T Medium::getDeviceType() const
+DeviceType_T Medium::i_getDeviceType() const
 {
     return m->devType;
 }
@@ -3300,7 +3488,7 @@ DeviceType_T Medium::getDeviceType() const
  * Returns the medium type. Must have caller + locking!
  * @return
  */
-MediumType_T Medium::getType() const
+MediumType_T Medium::i_getType() const
 {
     return m->type;
 }
@@ -3310,7 +3498,7 @@ MediumType_T Medium::getType() const
  *
  * @note Must be called from under this object's read or write lock.
  */
-Utf8Str Medium::getName()
+Utf8Str Medium::i_getName()
 {
     Utf8Str name = RTPathFilename(m->strLocationFull.c_str());
     return name;
@@ -3327,13 +3515,10 @@ Utf8Str Medium::getName()
  * one registry, which causes trouble with keeping diff images in sync.
  * See getFirstRegistryMachineId() for details.
  *
- * If fRecurse == true, then the media tree lock must be held for reading.
- *
  * @param id
- * @param fRecurse If true, recurses into child media to make sure the whole tree has registries in sync.
  * @return true if the registry was added; false if the given id was already on the list.
  */
-bool Medium::addRegistry(const Guid& id, bool fRecurse)
+bool Medium::i_addRegistry(const Guid& id)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc()))
@@ -3365,35 +3550,52 @@ bool Medium::addRegistry(const Guid& id, bool fRecurse)
     if (fAdd)
         m->llRegistryIDs.push_back(id);
 
-    if (fRecurse)
-    {
-        // Get private list of children and release medium lock straight away.
-        MediaList llChildren(m->llChildren);
-        alock.release();
+    return fAdd;
+}
 
-        for (MediaList::iterator it = llChildren.begin();
-             it != llChildren.end();
-             ++it)
-        {
-            Medium *pChild = *it;
-            fAdd |= pChild->addRegistry(id, true);
-        }
+/**
+ * This adds the given UUID to the list of media registries in which this
+ * medium should be registered. The UUID can either be a machine UUID,
+ * to add a machine registry, or the global registry UUID as returned by
+ * VirtualBox::getGlobalRegistryId(). This recurses over all children.
+ *
+ * Note that for hard disks, this method does nothing if the medium is
+ * already in another registry to avoid having hard disks in more than
+ * one registry, which causes trouble with keeping diff images in sync.
+ * See getFirstRegistryMachineId() for details.
+ *
+ * @note the caller must hold the media tree lock for reading.
+ *
+ * @param id
+ * @return true if the registry was added; false if the given id was already on the list.
+ */
+bool Medium::i_addRegistryRecursive(const Guid &id)
+{
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc()))
+        return false;
+
+    bool fAdd = i_addRegistry(id);
+
+    // protected by the medium tree lock held by our original caller
+    for (MediaList::const_iterator it = i_getChildren().begin();
+         it != i_getChildren().end();
+         ++it)
+    {
+        Medium *pChild = *it;
+        fAdd |= pChild->i_addRegistryRecursive(id);
     }
 
     return fAdd;
 }
 
 /**
- * Removes the given UUID from the list of media registry UUIDs. Returns true
- * if found or false if not.
- *
- * If fRecurse == true, then the media tree lock must be held for reading.
+ * Removes the given UUID from the list of media registry UUIDs of this medium.
  *
  * @param id
- * @param fRecurse If true, recurses into child media to make sure the whole tree has registries in sync.
- * @return
+ * @return true if the UUID was found or false if not.
  */
-bool Medium::removeRegistry(const Guid& id, bool fRecurse)
+bool Medium::i_removeRegistry(const Guid &id)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc()))
@@ -3402,31 +3604,47 @@ bool Medium::removeRegistry(const Guid& id, bool fRecurse)
 
     bool fRemove = false;
 
+    // @todo r=klaus eliminate this code, replace it by using find.
     for (GuidList::iterator it = m->llRegistryIDs.begin();
          it != m->llRegistryIDs.end();
          ++it)
     {
         if ((*it) == id)
         {
+            // getting away with this as the iterator isn't used after
             m->llRegistryIDs.erase(it);
             fRemove = true;
             break;
         }
     }
 
-    if (fRecurse)
-    {
-        // Get private list of children and release medium lock straight away.
-        MediaList llChildren(m->llChildren);
-        alock.release();
+    return fRemove;
+}
 
-        for (MediaList::iterator it = llChildren.begin();
-             it != llChildren.end();
-             ++it)
-        {
-            Medium *pChild = *it;
-            fRemove |= pChild->removeRegistry(id, true);
-        }
+/**
+ * Removes the given UUID from the list of media registry UUIDs, for this
+ * medium and all its children recursively.
+ *
+ * @note the caller must hold the media tree lock for reading.
+ *
+ * @param id
+ * @return true if the UUID was found or false if not.
+ */
+bool Medium::i_removeRegistryRecursive(const Guid &id)
+{
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc()))
+        return false;
+
+    bool fRemove = i_removeRegistry(id);
+
+    // protected by the medium tree lock held by our original caller
+    for (MediaList::const_iterator it = i_getChildren().begin();
+         it != i_getChildren().end();
+         ++it)
+    {
+        Medium *pChild = *it;
+        fRemove |= pChild->i_removeRegistryRecursive(id);
     }
 
     return fRemove;
@@ -3440,8 +3658,9 @@ bool Medium::removeRegistry(const Guid& id, bool fRecurse)
  * @param id
  * @return
  */
-bool Medium::isInRegistry(const Guid& id)
+bool Medium::i_isInRegistry(const Guid &id)
 {
+    // @todo r=klaus eliminate this code, replace it by using find.
     for (GuidList::const_iterator it = m->llRegistryIDs.begin();
          it != m->llRegistryIDs.end();
          ++it)
@@ -3478,7 +3697,7 @@ bool Medium::isInRegistry(const Guid& id)
  * @param uuid Receives first registry machine UUID, if available.
  * @return true if uuid was set.
  */
-bool Medium::getFirstRegistryMachineId(Guid &uuid) const
+bool Medium::i_getFirstRegistryMachineId(Guid &uuid) const
 {
     if (m->llRegistryIDs.size())
     {
@@ -3491,7 +3710,7 @@ bool Medium::getFirstRegistryMachineId(Guid &uuid) const
 /**
  * Marks all the registries in which this medium is registered as modified.
  */
-void Medium::markRegistriesModified()
+void Medium::i_markRegistriesModified()
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return;
@@ -3504,8 +3723,6 @@ void Medium::markRegistriesModified()
         llRegistryIDs = m->llRegistryIDs;
     }
 
-    // avoid lock order trouble with marking the registry modified
-    // below, it needs the media tree lock
     autoCaller.release();
 
     /* Save the error information now, the implicit restore when this goes
@@ -3515,7 +3732,7 @@ void Medium::markRegistriesModified()
          it != llRegistryIDs.end();
          ++it)
     {
-        m->pVirtualBox->markRegistryModified(*it);
+        m->pVirtualBox->i_markRegistryModified(*it);
     }
 }
 
@@ -3526,8 +3743,8 @@ void Medium::markRegistriesModified()
  * @param aMachineId    Machine ID.
  * @param aSnapshotId   Snapshot ID; when non-empty, adds a snapshot attachment.
  */
-HRESULT Medium::addBackReference(const Guid &aMachineId,
-                                 const Guid &aSnapshotId /*= Guid::Empty*/)
+HRESULT Medium::i_addBackReference(const Guid &aMachineId,
+                                   const Guid &aSnapshotId /*= Guid::Empty*/)
 {
     AssertReturn(aMachineId.isValid(), E_FAIL);
 
@@ -3547,7 +3764,7 @@ HRESULT Medium::addBackReference(const Guid &aMachineId,
             break;
 
         default:
-            return setStateError();
+            return i_setStateError();
     }
 
     if (m->numCreateDiffTasks > 0)
@@ -3598,7 +3815,7 @@ HRESULT Medium::addBackReference(const Guid &aMachineId,
         if (idOldSnapshot == aSnapshotId)
         {
 #ifdef DEBUG
-            dumpBackRefs();
+            i_dumpBackRefs();
 #endif
             return setError(VBOX_E_OBJECT_IN_USE,
                             tr("Cannot attach medium '%s' {%RTuuid} from snapshot '%RTuuid': medium is already in use by this snapshot!"),
@@ -3625,8 +3842,8 @@ HRESULT Medium::addBackReference(const Guid &aMachineId,
  * @param aSnapshotId   Snapshot ID; when non-empty, removes the snapshot
  *                      attachment.
  */
-HRESULT Medium::removeBackReference(const Guid &aMachineId,
-                                    const Guid &aSnapshotId /*= Guid::Empty*/)
+HRESULT Medium::i_removeBackReference(const Guid &aMachineId,
+                                      const Guid &aSnapshotId /*= Guid::Empty*/)
 {
     AssertReturn(aMachineId.isValid(), E_FAIL);
 
@@ -3667,7 +3884,7 @@ HRESULT Medium::removeBackReference(const Guid &aMachineId,
  * Internal method to return the medium's list of backrefs. Must have caller + locking!
  * @return
  */
-const Guid* Medium::getFirstMachineBackrefId() const
+const Guid* Medium::i_getFirstMachineBackrefId() const
 {
     if (!m->backRefs.size())
         return NULL;
@@ -3683,26 +3900,26 @@ const Guid* Medium::getFirstMachineBackrefId() const
  * Must have caller + locking, *and* caller must hold the media tree lock!
  * @return
  */
-const Guid* Medium::getAnyMachineBackref() const
+const Guid* Medium::i_getAnyMachineBackref() const
 {
     if (m->backRefs.size())
         return &m->backRefs.front().machineId;
 
-    for (MediaList::iterator it = m->llChildren.begin();
-         it != m->llChildren.end();
+    for (MediaList::const_iterator it = i_getChildren().begin();
+         it != i_getChildren().end();
          ++it)
     {
         Medium *pChild = *it;
         // recurse for this child
         const Guid* puuid;
-        if ((puuid = pChild->getAnyMachineBackref()))
+        if ((puuid = pChild->i_getAnyMachineBackref()))
             return puuid;
     }
 
     return NULL;
 }
 
-const Guid* Medium::getFirstMachineBackrefSnapshotId() const
+const Guid* Medium::i_getFirstMachineBackrefSnapshotId() const
 {
     if (!m->backRefs.size())
         return NULL;
@@ -3714,7 +3931,7 @@ const Guid* Medium::getFirstMachineBackrefSnapshotId() const
     return &ref.llSnapshotIds.front();
 }
 
-size_t Medium::getMachineBackRefCount() const
+size_t Medium::i_getMachineBackRefCount() const
 {
     return m->backRefs.size();
 }
@@ -3724,7 +3941,7 @@ size_t Medium::getMachineBackRefCount() const
  * Debugging helper that gets called after VirtualBox initialization that writes all
  * machine backreferences to the debug log.
  */
-void Medium::dumpBackRefs()
+void Medium::i_dumpBackRefs()
 {
     AutoCaller autoCaller(this);
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -3758,7 +3975,7 @@ void Medium::dumpBackRefs()
  *
  * @note Locks this object for writing.
  */
-HRESULT Medium::updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath)
+HRESULT Medium::i_updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath)
 {
     AssertReturn(!strOldPath.isEmpty(), E_FAIL);
     AssertReturn(!strNewPath.isEmpty(), E_FAIL);
@@ -3799,7 +4016,7 @@ HRESULT Medium::updatePath(const Utf8Str &strOldPath, const Utf8Str &strNewPath)
  *
  * @note Locks medium tree for reading.
  */
-ComObjPtr<Medium> Medium::getBase(uint32_t *aLevel /*= NULL*/)
+ComObjPtr<Medium> Medium::i_getBase(uint32_t *aLevel /*= NULL*/)
 {
     ComObjPtr<Medium> pBase;
 
@@ -3810,7 +4027,7 @@ ComObjPtr<Medium> Medium::getBase(uint32_t *aLevel /*= NULL*/)
         return pBase;
 
     /* we access mParent */
-    AutoReadLock treeLock(pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoReadLock treeLock(pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     AutoCaller autoCaller(this);
     AssertReturn(autoCaller.isOk(), pBase);
@@ -3840,19 +4057,49 @@ ComObjPtr<Medium> Medium::getBase(uint32_t *aLevel /*= NULL*/)
 }
 
 /**
+ * Returns the depth of this medium in the media chain.
+ *
+ * @note Locks medium tree for reading.
+ */
+uint32_t Medium::i_getDepth()
+{
+    /* it is possible that some previous/concurrent uninit has already cleared
+     * the pVirtualBox reference, and in this case we don't need to continue */
+    ComObjPtr<VirtualBox> pVirtualBox(m->pVirtualBox);
+    if (!pVirtualBox)
+        return 1;
+
+    /* we access mParent */
+    AutoReadLock treeLock(pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+
+    uint32_t cDepth = 0;
+    ComObjPtr<Medium> pMedium(this);
+    while (!pMedium.isNull())
+    {
+        AutoCaller autoCaller(this);
+        AssertReturn(autoCaller.isOk(), cDepth + 1);
+
+        pMedium = pMedium->m->pParent;
+        cDepth++;
+    }
+
+    return cDepth;
+}
+
+/**
  * Returns @c true if this medium cannot be modified because it has
  * dependents (children) or is part of the snapshot. Related to the medium
  * type and posterity, not to the current media state.
  *
  * @note Locks this object and medium tree for reading.
  */
-bool Medium::isReadOnly()
+bool Medium::i_isReadOnly()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), false);
 
     /* we access children */
-    AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoReadLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -3860,7 +4107,7 @@ bool Medium::isReadOnly()
     {
         case MediumType_Normal:
         {
-            if (getChildren().size() != 0)
+            if (i_getChildren().size() != 0)
                 return true;
 
             for (BackRefList::const_iterator it = m->backRefs.begin();
@@ -3891,29 +4138,21 @@ bool Medium::isReadOnly()
  * Internal method to return the medium's size. Must have caller + locking!
  * @return
  */
-void Medium::updateId(const Guid &id)
+void Medium::i_updateId(const Guid &id)
 {
     unconst(m->id) = id;
 }
 
 /**
- * Saves medium data by appending a new child node to the given
- * parent XML settings node.
+ * Saves the settings of one medium.
+ *
+ * @note Caller MUST take care of the medium tree lock and caller.
  *
  * @param data      Settings struct to be updated.
  * @param strHardDiskFolder Folder for which paths should be relative.
- *
- * @note Locks this object, medium tree and children for reading.
  */
-HRESULT Medium::saveSettings(settings::Medium &data,
-                             const Utf8Str &strHardDiskFolder)
+void Medium::i_saveSettingsOne(settings::Medium &data, const Utf8Str &strHardDiskFolder)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    /* we access mParent */
-    AutoReadLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     data.uuid = m->id;
@@ -3948,7 +4187,7 @@ HRESULT Medium::saveSettings(settings::Medium &data,
     {
         /* Encrypt the plain secret. If that does not work (i.e. no or wrong settings key
          * specified), just use the encrypted secret (if there is any). */
-        int rc = m->pVirtualBox->encryptSetting(itPln->second, &strCiphertext);
+        int rc = m->pVirtualBox->i_encryptSetting(itPln->second, &strCiphertext);
         if (RT_SUCCESS(rc))
             fHaveInitiatorSecretEncrypted = true;
     }
@@ -3973,16 +4212,45 @@ HRESULT Medium::saveSettings(settings::Medium &data,
     /* only for base media */
     if (m->pParent.isNull())
         data.hdType = m->type;
+}
+
+/**
+ * Saves medium data by putting it into the provided data structure.
+ * Recurses over all children to save their settings, too.
+ *
+ * @param data      Settings struct to be updated.
+ * @param strHardDiskFolder Folder for which paths should be relative.
+ *
+ * @note Locks this object, medium tree and children for reading.
+ */
+HRESULT Medium::i_saveSettings(settings::Medium &data,
+                               const Utf8Str &strHardDiskFolder)
+{
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    /* we access mParent */
+    AutoReadLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+
+    i_saveSettingsOne(data, strHardDiskFolder);
 
     /* save all children */
-    for (MediaList::const_iterator it = getChildren().begin();
-         it != getChildren().end();
+    settings::MediaList &llSettingsChildren = data.llChildren;
+    for (MediaList::const_iterator it = i_getChildren().begin();
+         it != i_getChildren().end();
          ++it)
     {
-        settings::Medium med;
-        HRESULT rc = (*it)->saveSettings(med, strHardDiskFolder);
-        AssertComRCReturnRC(rc);
-        data.llChildren.push_back(med);
+        // Use the element straight in the list to reduce both unnecessary
+        // deep copying (when unwinding the recursion the entire medium
+        // settings sub-tree is copied) and the stack footprint (the settings
+        // need almost 1K, and there can be VMs with long image chains.
+        llSettingsChildren.push_back(settings::g_MediumEmpty);
+        HRESULT rc = (*it)->i_saveSettings(llSettingsChildren.back(), strHardDiskFolder);
+        if (FAILED(rc))
+        {
+            llSettingsChildren.pop_back();
+            return rc;
+        }
     }
 
     return S_OK;
@@ -3996,16 +4264,18 @@ HRESULT Medium::saveSettings(settings::Medium &data,
  * @param fFailIfInaccessible If true, this fails with an error if a medium is inaccessible. If false,
  *          inaccessible media are silently skipped and not locked (i.e. their state remains "Inaccessible");
  *          this is necessary for a VM's removable media VM startup for which we do not want to fail.
- * @param fMediumLockWrite  Whether to associate a write lock with this medium.
- * @param pToBeParent       Medium which will become the parent of this medium.
- * @param mediumLockList    Where to store the resulting list.
+ * @param fMediumLockWrite     Whether to associate a write lock with this medium.
+ * @param fMediumLockWriteAll  Whether to associate a write lock to all other media too.
+ * @param pToBeParent          Medium which will become the parent of this medium.
+ * @param mediumLockList       Where to store the resulting list.
  */
-HRESULT Medium::createMediumLockList(bool fFailIfInaccessible,
-                                     bool fMediumLockWrite,
-                                     Medium *pToBeParent,
-                                     MediumLockList &mediumLockList)
+HRESULT Medium::i_createMediumLockList(bool fFailIfInaccessible,
+                                       bool fMediumLockWrite,
+                                       bool fMediumLockWriteAll,
+                                       Medium *pToBeParent,
+                                       MediumLockList &mediumLockList)
 {
-    Assert(!m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
     Assert(!isWriteLockOnCurrentThread());
 
     AutoCaller autoCaller(this);
@@ -4017,8 +4287,8 @@ HRESULT Medium::createMediumLockList(bool fFailIfInaccessible,
     if (pToBeParent)
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        ComAssertRet(getParent().isNull(), E_FAIL);
-        ComAssertRet(getChildren().size() == 0, E_FAIL);
+        ComAssertRet(i_getParent().isNull(), E_FAIL);
+        ComAssertRet(i_getChildren().size() == 0, E_FAIL);
     }
 
     ErrorInfoKeeper eik;
@@ -4032,17 +4302,16 @@ HRESULT Medium::createMediumLockList(bool fFailIfInaccessible,
         /* Accessibility check must be first, otherwise locking interferes
          * with getting the medium state. Lock lists are not created for
          * fun, and thus getting the medium status is no luxury. */
-        MediumState_T mediumState = pMedium->getState();
+        MediumState_T mediumState = pMedium->i_getState();
         if (mediumState == MediumState_Inaccessible)
         {
             alock.release();
-            rc = pMedium->queryInfo(false /* fSetImageId */,
-                                    false /* fSetParentId */,
-                                    autoCaller);
+            rc = pMedium->i_queryInfo(false /* fSetImageId */, false /* fSetParentId */,
+                                      autoCaller);
             alock.acquire();
             if (FAILED(rc)) return rc;
 
-            mediumState = pMedium->getState();
+            mediumState = pMedium->i_getState();
             if (mediumState == MediumState_Inaccessible)
             {
                 // ignore inaccessible ISO media and silently return S_OK,
@@ -4070,9 +4339,9 @@ HRESULT Medium::createMediumLockList(bool fFailIfInaccessible,
         if (pMedium == this)
             mediumLockList.Prepend(pMedium, fMediumLockWrite);
         else
-            mediumLockList.Prepend(pMedium, false);
+            mediumLockList.Prepend(pMedium, fMediumLockWriteAll);
 
-        pMedium = pMedium->getParent();
+        pMedium = pMedium->i_getParent();
         if (pMedium.isNull() && pToBeParent)
         {
             pMedium = pToBeParent;
@@ -4112,11 +4381,11 @@ HRESULT Medium::createMediumLockList(bool fFailIfInaccessible,
  *
  * @note Locks this object and @a aTarget for writing.
  */
-HRESULT Medium::createDiffStorage(ComObjPtr<Medium> &aTarget,
-                                  MediumVariant_T aVariant,
-                                  MediumLockList *aMediumLockList,
-                                  ComObjPtr<Progress> *aProgress,
-                                  bool aWait)
+HRESULT Medium::i_createDiffStorage(ComObjPtr<Medium> &aTarget,
+                                    MediumVariant_T aVariant,
+                                    MediumLockList *aMediumLockList,
+                                    ComObjPtr<Progress> *aProgress,
+                                    bool aWait)
 {
     AssertReturn(!aTarget.isNull(), E_FAIL);
     AssertReturn(aMediumLockList, E_FAIL);
@@ -4142,7 +4411,7 @@ HRESULT Medium::createDiffStorage(ComObjPtr<Medium> &aTarget,
         ComAssertThrow(m->state == MediumState_LockedRead, E_FAIL);
 
         if (aTarget->m->state != MediumState_NotCreated)
-            throw aTarget->setStateError();
+            throw aTarget->i_setStateError();
 
         /* Check that the medium is not attached to the current state of
          * any VM referring to it. */
@@ -4180,7 +4449,8 @@ HRESULT Medium::createDiffStorage(ComObjPtr<Medium> &aTarget,
                 pProgress.createObject();
                 rc = pProgress->init(m->pVirtualBox,
                                      static_cast<IMedium*>(this),
-                                     BstrFmt(tr("Creating differencing medium storage unit '%s'"), aTarget->m->strLocationFull.c_str()).raw(),
+                                     BstrFmt(tr("Creating differencing medium storage unit '%s'"),
+                                             aTarget->m->strLocationFull.c_str()).raw(),
                                      TRUE /* aCancelable */);
                 if (FAILED(rc))
                     throw rc;
@@ -4207,9 +4477,9 @@ HRESULT Medium::createDiffStorage(ComObjPtr<Medium> &aTarget,
     if (SUCCEEDED(rc))
     {
         if (aWait)
-            rc = runNow(pTask);
+            rc = i_runNow(pTask);
         else
-            rc = startThread(pTask);
+            rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc) && aProgress != NULL)
             *aProgress = pProgress;
@@ -4223,7 +4493,7 @@ HRESULT Medium::createDiffStorage(ComObjPtr<Medium> &aTarget,
 /**
  * Returns a preferred format for differencing media.
  */
-Utf8Str Medium::getPreferredDiffFormat()
+Utf8Str Medium::i_getPreferredDiffFormat()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), Utf8Str::Empty);
@@ -4233,7 +4503,7 @@ Utf8Str Medium::getPreferredDiffFormat()
     {
         /* use the default format if not */
         Utf8Str tmp;
-        m->pVirtualBox->getDefaultHardDiskFormat(tmp);
+        m->pVirtualBox->i_getDefaultHardDiskFormat(tmp);
         return tmp;
     }
 
@@ -4249,24 +4519,25 @@ Utf8Str Medium::getPreferredDiffFormat()
  * After this returns with success, uninit() has been called on the medium, and
  * the object is no longer usable ("not ready" state).
  *
- * @param autoCaller AutoCaller instance which must have been created on the caller's stack for this medium. This gets released here
- *                   upon which the Medium instance gets uninitialized.
+ * @param autoCaller AutoCaller instance which must have been created on the caller's
+ *                              stack for this medium. This gets released hereupon
+ *                              which the Medium instance gets uninitialized.
  * @return
  */
-HRESULT Medium::close(AutoCaller &autoCaller)
+HRESULT Medium::i_close(AutoCaller &autoCaller)
 {
     // must temporarily drop the caller, need the tree lock first
     autoCaller.release();
 
     // we're accessing parent/child and backrefs, so lock the tree first, then ourselves
-    AutoMultiWriteLock2 multilock(&m->pVirtualBox->getMediaTreeLockHandle(),
+    AutoMultiWriteLock2 multilock(&m->pVirtualBox->i_getMediaTreeLockHandle(),
                                   this->lockHandle()
                                   COMMA_LOCKVAL_SRC_POS);
 
     autoCaller.add();
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    LogFlowFunc(("ENTER for %s\n", getLocationFull().c_str()));
+    LogFlowFunc(("ENTER for %s\n", i_getLocationFull().c_str()));
 
     bool wasCreated = true;
 
@@ -4279,7 +4550,7 @@ HRESULT Medium::close(AutoCaller &autoCaller)
         case MediumState_Inaccessible:
             break;
         default:
-            return setStateError();
+            return i_setStateError();
     }
 
     if (m->backRefs.size() != 0)
@@ -4288,7 +4559,7 @@ HRESULT Medium::close(AutoCaller &autoCaller)
                         m->strLocationFull.c_str(), m->backRefs.size());
 
     // perform extra media-dependent close checks
-    HRESULT rc = canClose();
+    HRESULT rc = i_canClose();
     if (FAILED(rc)) return rc;
 
     m->fClosing = true;
@@ -4298,19 +4569,19 @@ HRESULT Medium::close(AutoCaller &autoCaller)
         // remove from the list of known media before performing actual
         // uninitialization (to keep the media registry consistent on
         // failure to do so)
-        rc = unregisterWithVirtualBox();
+        rc = i_unregisterWithVirtualBox();
         if (FAILED(rc)) return rc;
 
         multilock.release();
         // Release the AutoCaller now, as otherwise uninit() will simply hang.
         // Needs to be done before mark the registries as modified and saving
         // the registry, as otherwise there may be a deadlock with someone else
-        // closing this object while we're in saveModifiedRegistries(), which
+        // closing this object while we're in i_saveModifiedRegistries(), which
         // needs the media tree lock, which the other thread holds until after
         // uninit() below.
         autoCaller.release();
-        markRegistriesModified();
-        m->pVirtualBox->saveModifiedRegistries();
+        i_markRegistriesModified();
+        m->pVirtualBox->i_saveModifiedRegistries();
     }
     else
     {
@@ -4350,7 +4621,7 @@ HRESULT Medium::close(AutoCaller &autoCaller)
  * @note Locks mVirtualBox and this object for writing. Locks medium tree for
  *       writing.
  */
-HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
+HRESULT Medium::i_deleteStorage(ComObjPtr<Progress> *aProgress,
                               bool aWait)
 {
     AssertReturn(aProgress != NULL || aWait == true, E_FAIL);
@@ -4365,10 +4636,10 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
     try
     {
         /* we're accessing the media tree, and canClose() needs it too */
-        AutoMultiWriteLock2 multilock(&m->pVirtualBox->getMediaTreeLockHandle(),
+        AutoMultiWriteLock2 multilock(&m->pVirtualBox->i_getMediaTreeLockHandle(),
                                       this->lockHandle()
                                       COMMA_LOCKVAL_SRC_POS);
-        LogFlowThisFunc(("aWait=%RTbool locationFull=%s\n", aWait, getLocationFull().c_str() ));
+        LogFlowThisFunc(("aWait=%RTbool locationFull=%s\n", aWait, i_getLocationFull().c_str() ));
 
         if (    !(m->formatObj->i_getCapabilities() & (  MediumFormatCapabilities_CreateDynamic
                                                        | MediumFormatCapabilities_CreateFixed)))
@@ -4376,6 +4647,26 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
                            tr("Medium format '%s' does not support storage deletion"),
                            m->strFormat.c_str());
 
+        /* Wait for a concurrently running Medium::i_queryInfo to complete. */
+        /** @todo r=klaus would be great if this could be moved to the async
+         * part of the operation as it can take quite a while */
+        if (m->queryInfoRunning)
+        {
+            while (m->queryInfoRunning)
+            {
+                multilock.release();
+                /* Must not hold the media tree lock or the object lock, as
+                 * Medium::i_queryInfo needs this lock and thus we would run
+                 * into a deadlock here. */
+                Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+                Assert(!isWriteLockOnCurrentThread());
+                {
+                    AutoReadLock qlock(m->queryInfoSem COMMA_LOCKVAL_SRC_POS);
+                }
+                multilock.acquire();
+            }
+        }
+
         /* Note that we are fine with Inaccessible state too: a) for symmetry
          * with create calls and b) because it doesn't really harm to try, if
          * it is really inaccessible, the delete operation will fail anyway.
@@ -4391,7 +4682,7 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
             case MediumState_Inaccessible:
                 break;
             default:
-                throw setStateError();
+                throw i_setStateError();
         }
 
         if (m->backRefs.size() != 0)
@@ -4407,7 +4698,7 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
                 strMachines.append(b.machineId.toString().c_str());
             }
 #ifdef DEBUG
-            dumpBackRefs();
+            i_dumpBackRefs();
 #endif
             throw setError(VBOX_E_OBJECT_IN_USE,
                            tr("Cannot delete storage: medium '%s' is still attached to the following %d virtual machine(s): %s"),
@@ -4416,14 +4707,14 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
                            strMachines.c_str());
         }
 
-        rc = canClose();
+        rc = i_canClose();
         if (FAILED(rc))
             throw rc;
 
         /* go to Deleting state, so that the medium is not actually locked */
         if (m->state != MediumState_Deleting)
         {
-            rc = markForDeletion();
+            rc = i_markForDeletion();
             if (FAILED(rc))
                 throw rc;
         }
@@ -4431,10 +4722,11 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
         /* Build the medium lock list. */
         MediumLockList *pMediumLockList(new MediumLockList());
         multilock.release();
-        rc = createMediumLockList(true /* fFailIfInaccessible */,
-                                  true /* fMediumLockWrite */,
-                                  NULL,
-                                  *pMediumLockList);
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */,
+                                    true /* fMediumLockWrite */,
+                                    false /* fMediumLockWriteAll */,
+                                    NULL,
+                                    *pMediumLockList);
         multilock.acquire();
         if (FAILED(rc))
         {
@@ -4450,19 +4742,19 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
             delete pMediumLockList;
             throw setError(rc,
                            tr("Failed to lock media when deleting '%s'"),
-                           getLocationFull().c_str());
+                           i_getLocationFull().c_str());
         }
 
         /* try to remove from the list of known media before performing
          * actual deletion (we favor the consistency of the media registry
          * which would have been broken if unregisterWithVirtualBox() failed
          * after we successfully deleted the storage) */
-        rc = unregisterWithVirtualBox();
+        rc = i_unregisterWithVirtualBox();
         if (FAILED(rc))
             throw rc;
         // no longer need lock
         multilock.release();
-        markRegistriesModified();
+        i_markRegistriesModified();
 
         if (aProgress != NULL)
         {
@@ -4494,9 +4786,9 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
     if (SUCCEEDED(rc))
     {
         if (aWait)
-            rc = runNow(pTask);
+            rc = i_runNow(pTask);
         else
-            rc = startThread(pTask);
+            rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc) && aProgress != NULL)
             *aProgress = pProgress;
@@ -4514,7 +4806,7 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
          * usually is spurious, as in most cases the medium hasn't been marked
          * for deletion when the error was thrown above. */
         ErrorInfoKeeper eik;
-        unmarkForDeletion();
+        i_unmarkForDeletion();
     }
 
     return rc;
@@ -4525,7 +4817,7 @@ HRESULT Medium::deleteStorage(ComObjPtr<Progress> *aProgress,
  *
  * @note Caller must hold the write lock on this medium!
  */
-HRESULT Medium::markForDeletion()
+HRESULT Medium::i_markForDeletion()
 {
     ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL);
     switch (m->state)
@@ -4536,7 +4828,7 @@ HRESULT Medium::markForDeletion()
             m->state = MediumState_Deleting;
             return S_OK;
         default:
-            return setStateError();
+            return i_setStateError();
     }
 }
 
@@ -4545,7 +4837,7 @@ HRESULT Medium::markForDeletion()
  *
  * @note Caller must hold the write lock on this medium!
  */
-HRESULT Medium::unmarkForDeletion()
+HRESULT Medium::i_unmarkForDeletion()
 {
     ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL);
     switch (m->state)
@@ -4554,7 +4846,7 @@ HRESULT Medium::unmarkForDeletion()
             m->state = m->preLockState;
             return S_OK;
         default:
-            return setStateError();
+            return i_setStateError();
     }
 }
 
@@ -4563,7 +4855,7 @@ HRESULT Medium::unmarkForDeletion()
  *
  * @note Caller must hold the write lock on this medium!
  */
-HRESULT Medium::markLockedForDeletion()
+HRESULT Medium::i_markLockedForDeletion()
 {
     ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL);
     if (   (   m->state == MediumState_LockedRead
@@ -4574,7 +4866,7 @@ HRESULT Medium::markLockedForDeletion()
         return S_OK;
     }
     else
-        return setStateError();
+        return i_setStateError();
 }
 
 /**
@@ -4582,7 +4874,7 @@ HRESULT Medium::markLockedForDeletion()
  *
  * @note Caller must hold the write lock on this medium!
  */
-HRESULT Medium::unmarkLockedForDeletion()
+HRESULT Medium::i_unmarkLockedForDeletion()
 {
     ComAssertRet(isWriteLockOnCurrentThread(), E_FAIL);
     if (   (   m->state == MediumState_LockedRead
@@ -4593,7 +4885,7 @@ HRESULT Medium::unmarkLockedForDeletion()
         return S_OK;
     }
     else
-        return setStateError();
+        return i_setStateError();
 }
 
 /**
@@ -4611,8 +4903,8 @@ HRESULT Medium::unmarkLockedForDeletion()
  * @param pOther           The other medium to merge with.
  * @param fMergeForward    Resulting preferred merge direction (out).
  */
-HRESULT Medium::queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
-                                             bool &fMergeForward)
+HRESULT Medium::i_queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
+                                               bool &fMergeForward)
 {
     AssertReturn(pOther != NULL, E_FAIL);
     AssertReturn(pOther != this, E_FAIL);
@@ -4629,19 +4921,19 @@ HRESULT Medium::queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
     try
     {
         // locking: we need the tree lock first because we access parent pointers
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
         /* more sanity checking and figuring out the current merge direction */
-        ComObjPtr<Medium> pMedium = getParent();
+        ComObjPtr<Medium> pMedium = i_getParent();
         while (!pMedium.isNull() && pMedium != pOther)
-            pMedium = pMedium->getParent();
+            pMedium = pMedium->i_getParent();
         if (pMedium == pOther)
             fThisParent = false;
         else
         {
-            pMedium = pOther->getParent();
+            pMedium = pOther->i_getParent();
             while (!pMedium.isNull() && pMedium != this)
-                pMedium = pMedium->getParent();
+                pMedium = pMedium->i_getParent();
             if (pMedium == this)
                 fThisParent = true;
             else
@@ -4649,7 +4941,7 @@ HRESULT Medium::queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
                 Utf8Str tgtLoc;
                 {
                     AutoReadLock alock(pOther COMMA_LOCKVAL_SRC_POS);
-                    tgtLoc = pOther->getLocationFull();
+                    tgtLoc = pOther->i_getLocationFull();
                 }
 
                 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -4671,12 +4963,12 @@ HRESULT Medium::queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
         uint64_t cbMediumThis = 0;
         uint64_t cbMediumOther = 0;
 
-        if (isMediumFormatFile() && pOther->isMediumFormatFile())
+        if (i_isMediumFormatFile() && pOther->i_isMediumFormatFile())
         {
-            vrc = RTFileQuerySize(this->getLocationFull().c_str(), &cbMediumThis);
+            vrc = RTFileQuerySize(this->i_getLocationFull().c_str(), &cbMediumThis);
             if (RT_SUCCESS(vrc))
             {
-                vrc = RTFileQuerySize(pOther->getLocationFull().c_str(),
+                vrc = RTFileQuerySize(pOther->i_getLocationFull().c_str(),
                                       &cbMediumOther);
             }
 
@@ -4730,14 +5022,14 @@ HRESULT Medium::queryPreferredMergeDirection(const ComObjPtr<Medium> &pOther,
  * @note Locks medium tree for reading. Locks this object, aTarget and all
  *       intermediate media for writing.
  */
-HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
-                               const Guid *aMachineId,
-                               const Guid *aSnapshotId,
-                               bool fLockMedia,
-                               bool &fMergeForward,
-                               ComObjPtr<Medium> &pParentForTarget,
-                               MediumLockList * &aChildrenToReparent,
-                               MediumLockList * &aMediumLockList)
+HRESULT Medium::i_prepareMergeTo(const ComObjPtr<Medium> &pTarget,
+                                 const Guid *aMachineId,
+                                 const Guid *aSnapshotId,
+                                 bool fLockMedia,
+                                 bool &fMergeForward,
+                                 ComObjPtr<Medium> &pParentForTarget,
+                                 MediumLockList * &aChildrenToReparent,
+                                 MediumLockList * &aMediumLockList)
 {
     AssertReturn(pTarget != NULL, E_FAIL);
     AssertReturn(pTarget != this, E_FAIL);
@@ -4759,19 +5051,19 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
     try
     {
         // locking: we need the tree lock first because we access parent pointers
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
         /* more sanity checking and figuring out the merge direction */
-        ComObjPtr<Medium> pMedium = getParent();
+        ComObjPtr<Medium> pMedium = i_getParent();
         while (!pMedium.isNull() && pMedium != pTarget)
-            pMedium = pMedium->getParent();
+            pMedium = pMedium->i_getParent();
         if (pMedium == pTarget)
             fMergeForward = false;
         else
         {
-            pMedium = pTarget->getParent();
+            pMedium = pTarget->i_getParent();
             while (!pMedium.isNull() && pMedium != this)
-                pMedium = pMedium->getParent();
+                pMedium = pMedium->i_getParent();
             if (pMedium == this)
                 fMergeForward = true;
             else
@@ -4779,7 +5071,7 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
                 Utf8Str tgtLoc;
                 {
                     AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS);
-                    tgtLoc = pTarget->getLocationFull();
+                    tgtLoc = pTarget->i_getLocationFull();
                 }
 
                 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -4793,15 +5085,17 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
         aMediumLockList = new MediumLockList();
         treeLock.release();
         if (fMergeForward)
-            rc = pTarget->createMediumLockList(true /* fFailIfInaccessible */,
-                                               true /* fMediumLockWrite */,
-                                               NULL,
-                                               *aMediumLockList);
+            rc = pTarget->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                                 true /* fMediumLockWrite */,
+                                                 false /* fMediumLockWriteAll */,
+                                                 NULL,
+                                                 *aMediumLockList);
         else
-            rc = createMediumLockList(true /* fFailIfInaccessible */,
-                                      false /* fMediumLockWrite */,
-                                      NULL,
-                                      *aMediumLockList);
+            rc = i_createMediumLockList(true /* fFailIfInaccessible */,
+                                        false /* fMediumLockWrite */,
+                                        false /* fMediumLockWriteAll */,
+                                        NULL,
+                                        *aMediumLockList);
         treeLock.acquire();
         if (FAILED(rc))
             throw rc;
@@ -4816,12 +5110,12 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
             {
                 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
                 if (m->state != MediumState_Created)
-                    throw setStateError();
+                    throw i_setStateError();
             }
             {
                 AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS);
                 if (pTarget->m->state != MediumState_Created)
-                    throw pTarget->setStateError();
+                    throw pTarget->i_setStateError();
             }
         }
 
@@ -4829,11 +5123,11 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
         if (fMergeForward)
         {
             AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-            if (getChildren().size() > 1)
+            if (i_getChildren().size() > 1)
             {
                 throw setError(VBOX_E_INVALID_OBJECT_STATE,
                                tr("Medium '%s' involved in the merge operation has more than one child medium (%d)"),
-                               m->strLocationFull.c_str(), getChildren().size());
+                               m->strLocationFull.c_str(), i_getChildren().size());
             }
             /* One backreference is only allowed if the machine ID is not empty
              * and it matches the machine the medium is attached to (including
@@ -4842,9 +5136,9 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
                 && (   !aMachineId
                     || m->backRefs.size() != 1
                     || aMachineId->isZero()
-                    || *getFirstMachineBackrefId() != *aMachineId
+                    || *i_getFirstMachineBackrefId() != *aMachineId
                     || (   (!aSnapshotId || !aSnapshotId->isZero())
-                        && *getFirstMachineBackrefSnapshotId() != *aSnapshotId)))
+                        && *i_getFirstMachineBackrefSnapshotId() != *aSnapshotId)))
                 throw setError(VBOX_E_OBJECT_IN_USE,
                                tr("Medium '%s' is attached to %d virtual machines"),
                                m->strLocationFull.c_str(), m->backRefs.size());
@@ -4860,12 +5154,12 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
         else
         {
             AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS);
-            if (pTarget->getChildren().size() > 1)
+            if (pTarget->i_getChildren().size() > 1)
             {
                 throw setError(VBOX_E_OBJECT_IN_USE,
                                tr("Medium '%s' involved in the merge operation has more than one child medium (%d)"),
                                pTarget->m->strLocationFull.c_str(),
-                               pTarget->getChildren().size());
+                               pTarget->i_getChildren().size());
             }
             if (pTarget->m->type == MediumType_Immutable)
                 throw setError(VBOX_E_INVALID_OBJECT_STATE,
@@ -4877,18 +5171,18 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
                                pTarget->m->strLocationFull.c_str());
         }
         ComObjPtr<Medium> pLast(fMergeForward ? (Medium *)pTarget : this);
-        ComObjPtr<Medium> pLastIntermediate = pLast->getParent();
+        ComObjPtr<Medium> pLastIntermediate = pLast->i_getParent();
         for (pLast = pLastIntermediate;
              !pLast.isNull() && pLast != pTarget && pLast != this;
-             pLast = pLast->getParent())
+             pLast = pLast->i_getParent())
         {
             AutoReadLock alock(pLast COMMA_LOCKVAL_SRC_POS);
-            if (pLast->getChildren().size() > 1)
+            if (pLast->i_getChildren().size() > 1)
             {
                 throw setError(VBOX_E_OBJECT_IN_USE,
                                tr("Medium '%s' involved in the merge operation has more than one child medium (%d)"),
                                pLast->m->strLocationFull.c_str(),
-                               pLast->getChildren().size());
+                               pLast->i_getChildren().size());
             }
             if (pLast->m->backRefs.size() != 0)
                 throw setError(VBOX_E_OBJECT_IN_USE,
@@ -4904,40 +5198,40 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
 
             if (m->state == MediumState_Created)
             {
-                rc = markForDeletion();
+                rc = i_markForDeletion();
                 if (FAILED(rc))
                     throw rc;
             }
             else
             {
                 if (fLockMedia)
-                    throw setStateError();
+                    throw i_setStateError();
                 else if (   m->state == MediumState_LockedWrite
                          || m->state == MediumState_LockedRead)
                 {
                     /* Either mark it for deletion in locked state or allow
                      * others to have done so. */
                     if (m->preLockState == MediumState_Created)
-                        markLockedForDeletion();
+                        i_markLockedForDeletion();
                     else if (m->preLockState != MediumState_Deleting)
-                        throw setStateError();
+                        throw i_setStateError();
                 }
                 else
-                    throw setStateError();
+                    throw i_setStateError();
             }
         }
 
         if (fMergeForward)
         {
             /* we will need parent to reparent target */
-            pParentForTarget = getParent();
+            pParentForTarget = i_getParent();
         }
         else
         {
             /* we will need to reparent children of the source */
             aChildrenToReparent = new MediumLockList();
-            for (MediaList::const_iterator it = getChildren().begin();
-                 it != getChildren().end();
+            for (MediaList::const_iterator it = i_getChildren().begin();
+                 it != i_getChildren().end();
                  ++it)
             {
                 pMedium = *it;
@@ -4954,17 +5248,17 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
         }
         for (pLast = pLastIntermediate;
              !pLast.isNull() && pLast != pTarget && pLast != this;
-             pLast = pLast->getParent())
+             pLast = pLast->i_getParent())
         {
             AutoWriteLock alock(pLast COMMA_LOCKVAL_SRC_POS);
             if (pLast->m->state == MediumState_Created)
             {
-                rc = pLast->markForDeletion();
+                rc = pLast->i_markForDeletion();
                 if (FAILED(rc))
                     throw rc;
             }
             else
-                throw pLast->setStateError();
+                throw pLast->i_setStateError();
         }
 
         /* Tweak the lock list in the backward merge case, as the target
@@ -5000,7 +5294,7 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
                 AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS);
                 throw setError(rc,
                                tr("Failed to lock media when merging to '%s'"),
-                               pTarget->getLocationFull().c_str());
+                               pTarget->i_getLocationFull().c_str());
             }
         }
     }
@@ -5099,13 +5393,13 @@ HRESULT Medium::prepareMergeTo(const ComObjPtr<Medium> &pTarget,
  * @note Locks the tree lock for writing. Locks the media from the chain
  *       for writing.
  */
-HRESULT Medium::mergeTo(const ComObjPtr<Medium> &pTarget,
-                        bool fMergeForward,
-                        const ComObjPtr<Medium> &pParentForTarget,
-                        MediumLockList *aChildrenToReparent,
-                        MediumLockList *aMediumLockList,
-                        ComObjPtr<Progress> *aProgress,
-                        bool aWait)
+HRESULT Medium::i_mergeTo(const ComObjPtr<Medium> &pTarget,
+                          bool fMergeForward,
+                          const ComObjPtr<Medium> &pParentForTarget,
+                          MediumLockList *aChildrenToReparent,
+                          MediumLockList *aMediumLockList,
+                          ComObjPtr<Progress> *aProgress,
+                          bool aWait)
 {
     AssertReturn(pTarget != NULL, E_FAIL);
     AssertReturn(pTarget != this, E_FAIL);
@@ -5135,7 +5429,7 @@ HRESULT Medium::mergeTo(const ComObjPtr<Medium> &pTarget,
                 Utf8Str tgtName;
                 {
                     AutoReadLock alock(pTarget COMMA_LOCKVAL_SRC_POS);
-                    tgtName = pTarget->getName();
+                    tgtName = pTarget->i_getName();
                 }
 
                 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -5144,7 +5438,7 @@ HRESULT Medium::mergeTo(const ComObjPtr<Medium> &pTarget,
                 rc = pProgress->init(m->pVirtualBox,
                                      static_cast<IMedium*>(this),
                                      BstrFmt(tr("Merging medium '%s' to '%s'"),
-                                             getName().c_str(),
+                                             i_getName().c_str(),
                                              tgtName.c_str()).raw(),
                                      TRUE /* aCancelable */);
                 if (FAILED(rc))
@@ -5167,9 +5461,9 @@ HRESULT Medium::mergeTo(const ComObjPtr<Medium> &pTarget,
     if (SUCCEEDED(rc))
     {
         if (aWait)
-            rc = runNow(pTask);
+            rc = i_runNow(pTask);
         else
-            rc = startThread(pTask);
+            rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc) && aProgress != NULL)
             *aProgress = pProgress;
@@ -5191,8 +5485,8 @@ HRESULT Medium::mergeTo(const ComObjPtr<Medium> &pTarget,
  *
  * @note Locks the media from the chain for writing.
  */
-void Medium::cancelMergeTo(MediumLockList *aChildrenToReparent,
-                           MediumLockList *aMediumLockList)
+void Medium::i_cancelMergeTo(MediumLockList *aChildrenToReparent,
+                             MediumLockList *aMediumLockList)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -5215,7 +5509,7 @@ void Medium::cancelMergeTo(MediumLockList *aChildrenToReparent,
 
         if (pMedium->m->state == MediumState_Deleting)
         {
-            rc = pMedium->unmarkForDeletion();
+            rc = pMedium->i_unmarkForDeletion();
             AssertComRC(rc);
         }
     }
@@ -5233,21 +5527,22 @@ void Medium::cancelMergeTo(MediumLockList *aChildrenToReparent,
  * Fix the parent UUID of all children to point to this medium as their
  * parent.
  */
-HRESULT Medium::fixParentUuidOfChildren(MediumLockList *pChildrenToReparent)
+HRESULT Medium::i_fixParentUuidOfChildren(MediumLockList *pChildrenToReparent)
 {
     Assert(!isWriteLockOnCurrentThread());
-    Assert(!m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
     MediumLockList mediumLockList;
-    HRESULT rc = createMediumLockList(true /* fFailIfInaccessible */,
-                                      false /* fMediumLockWrite */,
-                                      this,
-                                      mediumLockList);
+    HRESULT rc = i_createMediumLockList(true /* fFailIfInaccessible */,
+                                        false /* fMediumLockWrite */,
+                                        false /* fMediumLockWriteAll */,
+                                        this,
+                                        mediumLockList);
     AssertComRCReturnRC(rc);
 
     try
     {
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         try
@@ -5305,7 +5600,7 @@ HRESULT Medium::fixParentUuidOfChildren(MediumLockList *pChildrenToReparent)
             rc = setError(E_FAIL,
                           tr("Could not update medium UUID references to parent '%s' (%s)"),
                           m->strLocationFull.c_str(),
-                          vdError(aVRC).c_str());
+                          i_vdError(aVRC).c_str());
         }
 
         VDDestroy(hdd);
@@ -5322,6 +5617,8 @@ HRESULT Medium::fixParentUuidOfChildren(MediumLockList *pChildrenToReparent)
  * @param aFormat               Medium format for creating @a aFilename.
  * @param aVariant              Which exact image format variant to use
  *                              for the destination image.
+ * @param pKeyStore             The optional key store for decrypting the data
+ *                              for encrypted media during the export.
  * @param aVDImageIOCallbacks   Pointer to the callback table for a
  *                              VDINTERFACEIO interface. May be NULL.
  * @param aVDImageIOUser        Opaque data for the callbacks.
@@ -5329,11 +5626,12 @@ HRESULT Medium::fixParentUuidOfChildren(MediumLockList *pChildrenToReparent)
  * @return
  * @note The source format is defined by the Medium instance.
  */
-HRESULT Medium::exportFile(const char *aFilename,
-                           const ComObjPtr<MediumFormat> &aFormat,
-                           MediumVariant_T aVariant,
-                           PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,
-                           const ComObjPtr<Progress> &aProgress)
+HRESULT Medium::i_exportFile(const char *aFilename,
+                             const ComObjPtr<MediumFormat> &aFormat,
+                             MediumVariant_T aVariant,
+                             SecretKeyStore *pKeyStore,
+                             PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,
+                             const ComObjPtr<Progress> &aProgress)
 {
     AssertPtrReturn(aFilename, E_INVALIDARG);
     AssertReturn(!aFormat.isNull(), E_INVALIDARG);
@@ -5351,10 +5649,11 @@ HRESULT Medium::exportFile(const char *aFilename,
 
         /* Build the source lock list. */
         MediumLockList *pSourceMediumLockList(new MediumLockList());
-        rc = createMediumLockList(true /* fFailIfInaccessible */,
-                                  false /* fMediumLockWrite */,
-                                  NULL,
-                                  *pSourceMediumLockList);
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */,
+                                    false /* fMediumLockWrite */,
+                                    false /* fMediumLockWriteAll */,
+                                    NULL,
+                                    *pSourceMediumLockList);
         if (FAILED(rc))
         {
             delete pSourceMediumLockList;
@@ -5367,12 +5666,12 @@ HRESULT Medium::exportFile(const char *aFilename,
             delete pSourceMediumLockList;
             throw setError(rc,
                            tr("Failed to lock source media '%s'"),
-                           getLocationFull().c_str());
+                           i_getLocationFull().c_str());
         }
 
         /* setup task object to carry out the operation asynchronously */
         pTask = new Medium::ExportTask(this, aProgress, aFilename, aFormat,
-                                       aVariant, aVDImageIOIf,
+                                       aVariant, pKeyStore, aVDImageIOIf,
                                        aVDImageIOUser, pSourceMediumLockList);
         rc = pTask->rc();
         AssertComRC(rc);
@@ -5382,7 +5681,7 @@ HRESULT Medium::exportFile(const char *aFilename,
     catch (HRESULT aRC) { rc = aRC; }
 
     if (SUCCEEDED(rc))
-        rc = startThread(pTask);
+        rc = i_startThread(pTask);
     else if (pTask != NULL)
         delete pTask;
 
@@ -5404,12 +5703,12 @@ HRESULT Medium::exportFile(const char *aFilename,
  * @return
  * @note The destination format is defined by the Medium instance.
  */
-HRESULT Medium::importFile(const char *aFilename,
-                           const ComObjPtr<MediumFormat> &aFormat,
-                           MediumVariant_T aVariant,
-                           PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,
-                           const ComObjPtr<Medium> &aParent,
-                           const ComObjPtr<Progress> &aProgress)
+HRESULT Medium::i_importFile(const char *aFilename,
+                             const ComObjPtr<MediumFormat> &aFormat,
+                             MediumVariant_T aVariant,
+                             PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,
+                             const ComObjPtr<Medium> &aParent,
+                             const ComObjPtr<Progress> &aProgress)
 {
     AssertPtrReturn(aFilename, E_INVALIDARG);
     AssertReturn(!aFormat.isNull(), E_INVALIDARG);
@@ -5426,7 +5725,7 @@ HRESULT Medium::importFile(const char *aFilename,
         // locking: we need the tree lock first because we access parent pointers
         // and we need to write-lock the media involved
         uint32_t    cHandles    = 2;
-        LockHandle* pHandles[3] = { &m->pVirtualBox->getMediaTreeLockHandle(),
+        LockHandle* pHandles[3] = { &m->pVirtualBox->i_getMediaTreeLockHandle(),
                                     this->lockHandle() };
         /* Only add parent to the lock if it is not null */
         if (!aParent.isNull())
@@ -5437,15 +5736,16 @@ HRESULT Medium::importFile(const char *aFilename,
 
         if (   m->state != MediumState_NotCreated
             && m->state != MediumState_Created)
-            throw setStateError();
+            throw i_setStateError();
 
         /* Build the target lock list. */
         MediumLockList *pTargetMediumLockList(new MediumLockList());
         alock.release();
-        rc = createMediumLockList(true /* fFailIfInaccessible */,
-                                  true /* fMediumLockWrite */,
-                                  aParent,
-                                  *pTargetMediumLockList);
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */,
+                                    true /* fMediumLockWrite */,
+                                    false /* fMediumLockWriteAll */,
+                                    aParent,
+                                    *pTargetMediumLockList);
         alock.acquire();
         if (FAILED(rc))
         {
@@ -5461,7 +5761,7 @@ HRESULT Medium::importFile(const char *aFilename,
             delete pTargetMediumLockList;
             throw setError(rc,
                            tr("Failed to lock target media '%s'"),
-                           getLocationFull().c_str());
+                           i_getLocationFull().c_str());
         }
 
         /* setup task object to carry out the operation asynchronously */
@@ -5480,7 +5780,7 @@ HRESULT Medium::importFile(const char *aFilename,
     catch (HRESULT aRC) { rc = aRC; }
 
     if (SUCCEEDED(rc))
-        rc = startThread(pTask);
+        rc = i_startThread(pTask);
     else if (pTask != NULL)
         delete pTask;
 
@@ -5504,9 +5804,9 @@ HRESULT Medium::importFile(const char *aFilename,
  *                           Use UINT32_MAX to disable this optimization.
  * @return
  */
-HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
-                          const ComObjPtr<Medium> &aParent, IProgress **aProgress,
-                          uint32_t idxSrcImageSame, uint32_t idxDstImageSame)
+HRESULT Medium::i_cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
+                            const ComObjPtr<Medium> &aParent, IProgress **aProgress,
+                            uint32_t idxSrcImageSame, uint32_t idxDstImageSame)
 {
     CheckComArgNotNull(aTarget);
     CheckComArgOutPointerValid(aProgress);
@@ -5524,7 +5824,7 @@ HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
         // locking: we need the tree lock first because we access parent pointers
         // and we need to write-lock the media involved
         uint32_t    cHandles    = 3;
-        LockHandle* pHandles[4] = { &m->pVirtualBox->getMediaTreeLockHandle(),
+        LockHandle* pHandles[4] = { &m->pVirtualBox->i_getMediaTreeLockHandle(),
                                     this->lockHandle(),
                                     aTarget->lockHandle() };
         /* Only add parent to the lock if it is not null */
@@ -5536,15 +5836,16 @@ HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
 
         if (    aTarget->m->state != MediumState_NotCreated
             &&  aTarget->m->state != MediumState_Created)
-            throw aTarget->setStateError();
+            throw aTarget->i_setStateError();
 
         /* Build the source lock list. */
         MediumLockList *pSourceMediumLockList(new MediumLockList());
         alock.release();
-        rc = createMediumLockList(true /* fFailIfInaccessible */,
-                                  false /* fMediumLockWrite */,
-                                  NULL,
-                                  *pSourceMediumLockList);
+        rc = i_createMediumLockList(true /* fFailIfInaccessible */,
+                                    false /* fMediumLockWrite */,
+                                    false /* fMediumLockWriteAll */,
+                                    NULL,
+                                    *pSourceMediumLockList);
         alock.acquire();
         if (FAILED(rc))
         {
@@ -5555,10 +5856,11 @@ HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
         /* Build the target lock list (including the to-be parent chain). */
         MediumLockList *pTargetMediumLockList(new MediumLockList());
         alock.release();
-        rc = aTarget->createMediumLockList(true /* fFailIfInaccessible */,
-                                           true /* fMediumLockWrite */,
-                                           aParent,
-                                           *pTargetMediumLockList);
+        rc = aTarget->i_createMediumLockList(true /* fFailIfInaccessible */,
+                                             true /* fMediumLockWrite */,
+                                             false /* fMediumLockWriteAll */,
+                                             aParent,
+                                             *pTargetMediumLockList);
         alock.acquire();
         if (FAILED(rc))
         {
@@ -5576,7 +5878,7 @@ HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
             delete pTargetMediumLockList;
             throw setError(rc,
                            tr("Failed to lock source media '%s'"),
-                           getLocationFull().c_str());
+                           i_getLocationFull().c_str());
         }
         alock.release();
         rc = pTargetMediumLockList->Lock();
@@ -5587,7 +5889,7 @@ HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
             delete pTargetMediumLockList;
             throw setError(rc,
                            tr("Failed to lock target media '%s'"),
-                           aTarget->getLocationFull().c_str());
+                           aTarget->i_getLocationFull().c_str());
         }
 
         pProgress.createObject();
@@ -5620,7 +5922,7 @@ HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
 
     if (SUCCEEDED(rc))
     {
-        rc = startThread(pTask);
+        rc = i_startThread(pTask);
 
         if (SUCCEEDED(rc))
             pProgress.queryInterfaceTo(aProgress);
@@ -5631,6 +5933,59 @@ HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
     return rc;
 }
 
+/**
+ * Returns the key identifier for this medium if encryption is configured.
+ *
+ * @returns Key identifier or empty string if no encryption is configured.
+ */
+const Utf8Str& Medium::i_getKeyId()
+{
+    ComObjPtr<Medium> pBase = i_getBase();
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    settings::StringsMap::const_iterator it = pBase->m->mapProperties.find("CRYPT/KeyId");
+    if (it == pBase->m->mapProperties.end())
+        return Utf8Str::Empty;
+
+    return it->second;
+}
+
+/**
+ * Returns all filter related properties.
+ *
+ * @returns COM status code.
+ * @param   aReturnNames    Where to store the properties names on success.
+ * @param   aReturnValues   Where to store the properties values on success.
+ */
+HRESULT Medium::i_getFilterProperties(std::vector<com::Utf8Str> &aReturnNames,
+                                      std::vector<com::Utf8Str> &aReturnValues)
+{
+    std::vector<com::Utf8Str> aPropNames;
+    std::vector<com::Utf8Str> aPropValues;
+    HRESULT hrc = getProperties(Utf8Str(""), aPropNames, aPropValues);
+
+    if (SUCCEEDED(hrc))
+    {
+        unsigned cReturnSize = 0;
+        aReturnNames.resize(0);
+        aReturnValues.resize(0);
+        for (unsigned idx = 0; idx < aPropNames.size(); idx++)
+        {
+            if (i_isPropertyForFilter(aPropNames[idx]))
+            {
+                aReturnNames.resize(cReturnSize + 1);
+                aReturnValues.resize(cReturnSize + 1);
+                aReturnNames[cReturnSize] = aPropNames[idx];
+                aReturnValues[cReturnSize] = aPropValues[idx];
+                cReturnSize++;
+            }
+        }
+    }
+
+    return hrc;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // Private methods
@@ -5651,10 +6006,11 @@ HRESULT Medium::cloneToEx(const ComObjPtr<Medium> &aTarget, ULONG aVariant,
  * @note Locks mParent for reading. Locks this object for writing.
  *
  * @param fSetImageId Whether to reset the UUID contained in the image file to the UUID in the medium instance data (see SetIDs())
- * @param fSetParentId Whether to reset the parent UUID contained in the image file to the parent UUID in the medium instance data (see SetIDs())
+ * @param fSetParentId Whether to reset the parent UUID contained in the image file to the parent
+ *                     UUID in the medium instance data (see SetIDs())
  * @return
  */
-HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoCaller)
+HRESULT Medium::i_queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoCaller)
 {
     Assert(!isWriteLockOnCurrentThread());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -5669,7 +6025,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
 
     int vrc = VINF_SUCCESS;
 
-    /* check if a blocking queryInfo() call is in progress on some other thread,
+    /* check if a blocking i_queryInfo() call is in progress on some other thread,
      * and wait for it to finish if so instead of querying data ourselves */
     if (m->queryInfoRunning)
     {
@@ -5751,7 +6107,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
     autoCaller.release();
 
     /* Note that taking the queryInfoSem after leaving the object lock above
-     * can lead to short spinning of the loops waiting for queryInfo() to
+     * can lead to short spinning of the loops waiting for i_queryInfo() to
      * complete. This is unavoidable since the other order causes a lock order
      * violation: here it would be requesting the object lock (at the beginning
      * of the method), then queryInfoSem, and below the other way round. */
@@ -5759,8 +6115,8 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
 
     /* take the opportunity to have a media tree lock, released initially */
     Assert(!isWriteLockOnCurrentThread());
-    Assert(!pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
-    AutoWriteLock treeLock(pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    Assert(!pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    AutoWriteLock treeLock(pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
     treeLock.release();
 
     /* re-take the caller, but not the object lock, to keep uninit away */
@@ -5781,7 +6137,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
         }
 
         PVBOXHDD hdd;
-        vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         try
@@ -5797,7 +6153,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
             if (RT_FAILURE(vrc))
             {
                 lastAccessError = Utf8StrFmt(tr("Could not open the medium '%s'%s"),
-                                             location.c_str(), vdError(vrc).c_str());
+                                             location.c_str(), i_vdError(vrc).c_str());
                 throw S_OK;
             }
 
@@ -5813,7 +6169,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
                     if (RT_FAILURE(vrc))
                     {
                         lastAccessError = Utf8StrFmt(tr("Could not update the UUID of medium '%s'%s"),
-                                         location.c_str(), vdError(vrc).c_str());
+                                         location.c_str(), i_vdError(vrc).c_str());
                         throw S_OK;
                     }
                     mediumId = m->uuidImage;
@@ -5826,7 +6182,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
                     if (RT_FAILURE(vrc))
                     {
                         lastAccessError = Utf8StrFmt(tr("Could not update the parent UUID of medium '%s'%s"),
-                                         location.c_str(), vdError(vrc).c_str());
+                                         location.c_str(), i_vdError(vrc).c_str());
                         throw S_OK;
                     }
                 }
@@ -5861,7 +6217,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
                                 &uuid,
                                 location.c_str(),
                                 mediumId.raw(),
-                                pVirtualBox->settingsFilePath().c_str());
+                                pVirtualBox->i_settingsFilePath().c_str());
                         throw S_OK;
                     }
                 }
@@ -5927,7 +6283,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
                     if (RTUuidIsNull(&parentId))
                         rc = VBOX_E_OBJECT_NOT_FOUND;
                     else
-                        rc = pVirtualBox->findHardDiskById(Guid(parentId), false /* aSetError */, &pParent);
+                        rc = pVirtualBox->i_findHardDiskById(Guid(parentId), false /* aSetError */, &pParent);
                     if (FAILED(rc))
                     {
                         if (fSetImageId && !fSetParentId)
@@ -5949,7 +6305,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
                         {
                             lastAccessError = Utf8StrFmt(tr("Parent medium with UUID {%RTuuid} of the medium '%s' is not found in the media registry ('%s')"),
                                                          &parentId, location.c_str(),
-                                                         pVirtualBox->settingsFilePath().c_str());
+                                                         pVirtualBox->i_settingsFilePath().c_str());
                             throw S_OK;
                         }
                     }
@@ -5963,8 +6319,17 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
                         throw autoCaller.rc();
 
                     if (m->pParent)
-                        deparent();
-                    setParent(pParent);
+                        i_deparent();
+
+                    if (!pParent.isNull())
+                        if (pParent->i_getDepth() >= SETTINGS_MEDIUM_DEPTH_MAX)
+                        {
+                            AutoReadLock plock(pParent COMMA_LOCKVAL_SRC_POS);
+                            throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                           tr("Cannot open differencing image for medium '%s', because it exceeds the medium tree depth limit. Please merge some images which you no longer need"),
+                                           pParent->m->strLocationFull.c_str());
+                        }
+                    i_setParent(pParent);
 
                     treeLock.release();
                 }
@@ -6012,15 +6377,15 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
                             throw autoCaller.rc();
 
                         if (   !fRepairImageZeroParentUuid
-                            && m->pParent->getState() != MediumState_Inaccessible
-                            && m->pParent->getId() != parentId)
+                            && m->pParent->i_getState() != MediumState_Inaccessible
+                            && m->pParent->i_getId() != parentId)
                         {
                             /** @todo r=klaus this always refers to VirtualBox.xml as the medium registry, even for new VMs */
                             lastAccessError = Utf8StrFmt(
                                     tr("Parent UUID {%RTuuid} of the medium '%s' does not match UUID {%RTuuid} of its parent medium stored in the media registry ('%s')"),
                                     &parentId, location.c_str(),
-                                    m->pParent->getId().raw(),
-                                    pVirtualBox->settingsFilePath().c_str());
+                                    m->pParent->i_getId().raw(),
+                                    pVirtualBox->i_settingsFilePath().c_str());
                             parentLock.release();
                             treeLock.release();
                             throw S_OK;
@@ -6049,7 +6414,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
         if (RT_FAILURE(vrc))
         {
             lastAccessError = Utf8StrFmt(tr("Could not update and close the medium '%s'%s"),
-                                         location.c_str(), vdError(vrc).c_str());
+                                         location.c_str(), i_vdError(vrc).c_str());
             success = false;
             throw S_OK;
         }
@@ -6089,7 +6454,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
     else
         m->preLockState = MediumState_Inaccessible;
 
-    /* unblock anyone waiting for the queryInfo results */
+    /* unblock anyone waiting for the i_queryInfo results */
     qlock.release();
     m->queryInfoRunning = false;
 
@@ -6114,7 +6479,7 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
         try
         {
             PVBOXHDD hdd;
-            vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+            vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
             ComAssertRCThrow(vrc, E_FAIL);
 
             try
@@ -6161,14 +6526,14 @@ HRESULT Medium::queryInfo(bool fSetImageId, bool fSetParentId, AutoCaller &autoC
  *
  * @note Caller must hold the media tree write lock!
  */
-HRESULT Medium::canClose()
+HRESULT Medium::i_canClose()
 {
-    Assert(m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
-    if (getChildren().size() != 0)
+    if (i_getChildren().size() != 0)
         return setError(VBOX_E_OBJECT_IN_USE,
                         tr("Cannot close medium '%s' because it has %d child media"),
-                        m->strLocationFull.c_str(), getChildren().size());
+                        m->strLocationFull.c_str(), i_getChildren().size());
 
     return S_OK;
 }
@@ -6178,27 +6543,26 @@ HRESULT Medium::canClose()
  *
  * @note Caller must have locked the media tree lock for writing!
  */
-HRESULT Medium::unregisterWithVirtualBox()
+HRESULT Medium::i_unregisterWithVirtualBox()
 {
     /* Note that we need to de-associate ourselves from the parent to let
-     * unregisterMedium() properly save the registry */
+     * VirtualBox::i_unregisterMedium() properly save the registry */
 
     /* we modify mParent and access children */
-    Assert(m->pVirtualBox->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
     Medium *pParentBackup = m->pParent;
-    AssertReturn(getChildren().size() == 0, E_FAIL);
+    AssertReturn(i_getChildren().size() == 0, E_FAIL);
     if (m->pParent)
-        deparent();
+        i_deparent();
 
-    HRESULT rc = m->pVirtualBox->unregisterMedium(this);
+    HRESULT rc = m->pVirtualBox->i_unregisterMedium(this);
     if (FAILED(rc))
     {
         if (pParentBackup)
         {
             // re-associate with the parent as we are still relatives in the registry
-            m->pParent = pParentBackup;
-            m->pParent->m->llChildren.push_back(this);
+            i_setParent(pParentBackup);
         }
     }
 
@@ -6208,7 +6572,7 @@ HRESULT Medium::unregisterWithVirtualBox()
 /**
  * Like SetProperty but do not trigger a settings store. Only for internal use!
  */
-HRESULT Medium::setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue)
+HRESULT Medium::i_setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -6221,7 +6585,7 @@ HRESULT Medium::setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue)
         case MediumState_Inaccessible:
             break;
         default:
-            return setStateError();
+            return i_setStateError();
     }
 
     m->mapProperties[aName] = aValue;
@@ -6234,7 +6598,7 @@ HRESULT Medium::setPropertyDirect(const Utf8Str &aName, const Utf8Str &aValue)
  *
  * @note Must be called from under this object's write or read lock.
  */
-HRESULT Medium::setStateError()
+HRESULT Medium::i_setStateError()
 {
     HRESULT rc = E_FAIL;
 
@@ -6323,8 +6687,8 @@ HRESULT Medium::setStateError()
  *
  * @note Must be called from under this object's write lock.
  */
-HRESULT Medium::setLocation(const Utf8Str &aLocation,
-                            const Utf8Str &aFormat /* = Utf8Str::Empty */)
+HRESULT Medium::i_setLocation(const Utf8Str &aLocation,
+                              const Utf8Str &aFormat /* = Utf8Str::Empty */)
 {
     AssertReturn(!aLocation.isEmpty(), E_FAIL);
 
@@ -6334,7 +6698,7 @@ HRESULT Medium::setLocation(const Utf8Str &aLocation,
     /* formatObj may be null only when initializing from an existing path and
      * no format is known yet */
     AssertReturn(    (!m->strFormat.isEmpty() && !m->formatObj.isNull())
-                  || (    autoCaller.state() == InInit
+                  || (    getObjectState().getState() == ObjectState::InInit
                        && m->state != MediumState_NotCreated
                        && m->id.isZero()
                        && m->strFormat.isEmpty()
@@ -6435,14 +6799,14 @@ HRESULT Medium::setLocation(const Utf8Str &aLocation,
                                     locationFull.c_str(), vrc);
                 else
                 {
-                    HRESULT rc = setFormat(aFormat);
+                    HRESULT rc = i_setFormat(aFormat);
                     /* setFormat() must not fail since we've just used the backend so
                      * the format object must be there */
                     AssertComRCReturnRC(rc);
                 }
             }
             else if (   enmType == VDTYPE_INVALID
-                     || m->devType != convertToDeviceType(enmType))
+                     || m->devType != i_convertToDeviceType(enmType))
             {
                 /*
                  * The user tried to use a image as a device which is not supported
@@ -6456,7 +6820,7 @@ HRESULT Medium::setLocation(const Utf8Str &aLocation,
             {
                 ComAssertRet(backendName != NULL && *backendName != '\0', E_FAIL);
 
-                HRESULT rc = setFormat(backendName);
+                HRESULT rc = i_setFormat(backendName);
                 RTStrFree(backendName);
 
                 /* setFormat() must not fail since we've just used the backend so
@@ -6492,24 +6856,19 @@ HRESULT Medium::setLocation(const Utf8Str &aLocation,
  *
  * @note Must be called from under this object's write lock.
  */
-HRESULT Medium::setFormat(const Utf8Str &aFormat)
+HRESULT Medium::i_setFormat(const Utf8Str &aFormat)
 {
     /* get the format object first */
     {
-        SystemProperties *pSysProps = m->pVirtualBox->getSystemProperties();
+        SystemProperties *pSysProps = m->pVirtualBox->i_getSystemProperties();
         AutoReadLock propsLock(pSysProps COMMA_LOCKVAL_SRC_POS);
 
-        unconst(m->formatObj) = pSysProps->mediumFormat(aFormat);
+        unconst(m->formatObj) = pSysProps->i_mediumFormat(aFormat);
         if (m->formatObj.isNull())
             return setError(E_INVALIDARG,
                             tr("Invalid medium storage format '%s'"),
                             aFormat.c_str());
 
-        /* reference the format permanently to prevent its unexpected
-         * uninitialization */
-        HRESULT rc = m->formatObj->addCaller();
-        AssertComRCReturnRC(rc);
-
         /* get properties (preinsert them as keys in the map). Note that the
          * map doesn't grow over the object life time since the set of
          * properties is meant to be constant. */
@@ -6532,7 +6891,7 @@ HRESULT Medium::setFormat(const Utf8Str &aFormat)
 /**
  * Converts the Medium device type to the VD type.
  */
-VDTYPE Medium::convertDeviceType()
+VDTYPE Medium::i_convertDeviceType()
 {
     VDTYPE enmType;
 
@@ -6557,7 +6916,7 @@ VDTYPE Medium::convertDeviceType()
 /**
  * Converts from the VD type to the medium type.
  */
-DeviceType_T Medium::convertToDeviceType(VDTYPE enmType)
+DeviceType_T Medium::i_convertToDeviceType(VDTYPE enmType)
 {
     DeviceType_T devType;
 
@@ -6582,7 +6941,7 @@ DeviceType_T Medium::convertToDeviceType(VDTYPE enmType)
 /**
  * Internal method which checks whether a property name is for a filter plugin.
  */
-bool Medium::isPropertyForFilter(const com::Utf8Str &aName)
+bool Medium::i_isPropertyForFilter(const com::Utf8Str &aName)
 {
     /* If the name contains "/" use the part before as a filter name and lookup the filter. */
     size_t offSlash;
@@ -6617,9 +6976,8 @@ bool Medium::isPropertyForFilter(const com::Utf8Str &aName)
     return false;
 }
 
-
 /**
- * Returns the last error message collected by the vdErrorCall callback and
+ * Returns the last error message collected by the i_vdErrorCall callback and
  * resets it.
  *
  * The error message is returned prepended with a dot and a space, like this:
@@ -6629,7 +6987,7 @@ bool Medium::isPropertyForFilter(const com::Utf8Str &aName)
  * to make it easily appendable to a more general error message. The @c %Rrc
  * format string is given @a aVRC as an argument.
  *
- * If there is no last error message collected by vdErrorCall or if it is a
+ * If there is no last error message collected by i_vdErrorCall or if it is a
  * null or empty string, then this function returns the following text:
  * <code>
  *   " (%Rrc)"
@@ -6640,7 +6998,7 @@ bool Medium::isPropertyForFilter(const com::Utf8Str &aName)
  *
  * @param aVRC  VBox error code to use when no error message is provided.
  */
-Utf8Str Medium::vdError(int aVRC)
+Utf8Str Medium::i_vdError(int aVRC)
 {
     Utf8Str error;
 
@@ -6669,8 +7027,8 @@ Utf8Str Medium::vdError(int aVRC)
  * @param   va              Error message arguments.
  */
 /*static*/
-DECLCALLBACK(void) Medium::vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,
-                                       const char *pszFormat, va_list va)
+DECLCALLBACK(void) Medium::i_vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,
+                                         const char *pszFormat, va_list va)
 {
     NOREF(pszFile); NOREF(iLine); NOREF(pszFunction); /* RT_SRC_POS_DECL */
 
@@ -6687,8 +7045,8 @@ DECLCALLBACK(void) Medium::vdErrorCall(void *pvUser, int rc, RT_SRC_POS_DECL,
 }
 
 /* static */
-DECLCALLBACK(bool) Medium::vdConfigAreKeysValid(void *pvUser,
-                                                const char * /* pszzValid */)
+DECLCALLBACK(bool) Medium::i_vdConfigAreKeysValid(void *pvUser,
+                                                  const char * /* pszzValid */)
 {
     Medium *that = static_cast<Medium*>(pvUser);
     AssertReturn(that != NULL, false);
@@ -6699,9 +7057,9 @@ DECLCALLBACK(bool) Medium::vdConfigAreKeysValid(void *pvUser,
 }
 
 /* static */
-DECLCALLBACK(int) Medium::vdConfigQuerySize(void *pvUser,
-                                            const char *pszName,
-                                            size_t *pcbValue)
+DECLCALLBACK(int) Medium::i_vdConfigQuerySize(void *pvUser,
+                                              const char *pszName,
+                                              size_t *pcbValue)
 {
     AssertReturn(VALID_PTR(pcbValue), VERR_INVALID_POINTER);
 
@@ -6722,10 +7080,10 @@ DECLCALLBACK(int) Medium::vdConfigQuerySize(void *pvUser,
 }
 
 /* static */
-DECLCALLBACK(int) Medium::vdConfigQuery(void *pvUser,
-                                        const char *pszName,
-                                        char *pszValue,
-                                        size_t cchValue)
+DECLCALLBACK(int) Medium::i_vdConfigQuery(void *pvUser,
+                                          const char *pszName,
+                                          char *pszValue,
+                                          size_t cchValue)
 {
     AssertReturn(VALID_PTR(pszValue), VERR_INVALID_POINTER);
 
@@ -6749,7 +7107,7 @@ DECLCALLBACK(int) Medium::vdConfigQuery(void *pvUser,
     return VINF_SUCCESS;
 }
 
-DECLCALLBACK(int) Medium::vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock)
+DECLCALLBACK(int) Medium::i_vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock)
 {
     PVDSOCKETINT pSocketInt = NULL;
 
@@ -6765,88 +7123,218 @@ DECLCALLBACK(int) Medium::vdTcpSocketCreate(uint32_t fFlags, PVDSOCKET pSock)
     return VINF_SUCCESS;
 }
 
-DECLCALLBACK(int) Medium::vdTcpSocketDestroy(VDSOCKET Sock)
+DECLCALLBACK(int) Medium::i_vdTcpSocketDestroy(VDSOCKET Sock)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+
+    if (pSocketInt->hSocket != NIL_RTSOCKET)
+        RTTcpClientCloseEx(pSocketInt->hSocket, false /*fGracefulShutdown*/);
+
+    RTMemFree(pSocketInt);
+
+    return VINF_SUCCESS;
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpClientConnect(VDSOCKET Sock, const char *pszAddress, uint32_t uPort,
+                                               RTMSINTERVAL cMillies)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+
+    return RTTcpClientConnectEx(pszAddress, uPort, &pSocketInt->hSocket, cMillies, NULL);
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpClientClose(VDSOCKET Sock)
+{
+    int rc = VINF_SUCCESS;
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+
+    rc = RTTcpClientCloseEx(pSocketInt->hSocket, false /*fGracefulShutdown*/);
+    pSocketInt->hSocket = NIL_RTSOCKET;
+    return rc;
+}
+
+DECLCALLBACK(bool) Medium::i_vdTcpIsClientConnected(VDSOCKET Sock)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return pSocketInt->hSocket != NIL_RTSOCKET;
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpSelectOne(VDSOCKET Sock, RTMSINTERVAL cMillies)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return RTTcpSelectOne(pSocketInt->hSocket, cMillies);
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return RTTcpRead(pSocketInt->hSocket, pvBuffer, cbBuffer, pcbRead);
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpWrite(VDSOCKET Sock, const void *pvBuffer, size_t cbBuffer)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return RTTcpWrite(pSocketInt->hSocket, pvBuffer, cbBuffer);
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpSgWrite(VDSOCKET Sock, PCRTSGBUF pSgBuf)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return RTTcpSgWrite(pSocketInt->hSocket, pSgBuf);
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpFlush(VDSOCKET Sock)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return RTTcpFlush(pSocketInt->hSocket);
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpSetSendCoalescing(VDSOCKET Sock, bool fEnable)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return RTTcpSetSendCoalescing(pSocketInt->hSocket, fEnable);
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAddr)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return RTTcpGetLocalAddress(pSocketInt->hSocket, pAddr);
+}
+
+DECLCALLBACK(int) Medium::i_vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr)
+{
+    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    return RTTcpGetPeerAddress(pSocketInt->hSocket, pAddr);
+}
+
+DECLCALLBACK(bool) Medium::i_vdCryptoConfigAreKeysValid(void *pvUser, const char *pszzValid)
+{
+    /* Just return always true here. */
+    NOREF(pvUser);
+    NOREF(pszzValid);
+    return true;
+}
+
+DECLCALLBACK(int) Medium::i_vdCryptoConfigQuerySize(void *pvUser, const char *pszName, size_t *pcbValue)
+{
+    Medium::CryptoFilterSettings *pSettings = (Medium::CryptoFilterSettings *)pvUser;
+    AssertPtrReturn(pSettings, VERR_GENERAL_FAILURE);
+    AssertReturn(VALID_PTR(pcbValue), VERR_INVALID_POINTER);
+
+    size_t cbValue = 0;
+    if (!strcmp(pszName, "Algorithm"))
+        cbValue = strlen(pSettings->pszCipher) + 1;
+    else if (!strcmp(pszName, "KeyId"))
+        cbValue = sizeof("irrelevant");
+    else if (!strcmp(pszName, "KeyStore"))
+    {
+        if (!pSettings->pszKeyStoreLoad)
+            return VERR_CFGM_VALUE_NOT_FOUND;
+        cbValue = strlen(pSettings->pszKeyStoreLoad) + 1;
+    }
+    else if (!strcmp(pszName, "CreateKeyStore"))
+        cbValue = 2; /* Single digit + terminator. */
+    else
+        return VERR_CFGM_VALUE_NOT_FOUND;
+
+    *pcbValue = cbValue + 1 /* include terminator */;
+
+    return VINF_SUCCESS;
+}
+
+DECLCALLBACK(int) Medium::i_vdCryptoConfigQuery(void *pvUser, const char *pszName,
+                                                char *pszValue, size_t cchValue)
 {
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
+    Medium::CryptoFilterSettings *pSettings = (Medium::CryptoFilterSettings *)pvUser;
+    AssertPtrReturn(pSettings, VERR_GENERAL_FAILURE);
+    AssertReturn(VALID_PTR(pszValue), VERR_INVALID_POINTER);
 
-    if (pSocketInt->hSocket != NIL_RTSOCKET)
-        RTTcpClientCloseEx(pSocketInt->hSocket, false /*fGracefulShutdown*/);
+    const char *psz = NULL;
+    if (!strcmp(pszName, "Algorithm"))
+        psz = pSettings->pszCipher;
+    else if (!strcmp(pszName, "KeyId"))
+        psz = "irrelevant";
+    else if (!strcmp(pszName, "KeyStore"))
+        psz = pSettings->pszKeyStoreLoad;
+    else if (!strcmp(pszName, "CreateKeyStore"))
+    {
+        if (pSettings->fCreateKeyStore)
+            psz = "1";
+        else
+            psz = "0";
+    }
+    else
+        return VERR_CFGM_VALUE_NOT_FOUND;
 
-    RTMemFree(pSocketInt);
+    size_t cch = strlen(psz);
+    if (cch >= cchValue)
+        return VERR_CFGM_NOT_ENOUGH_SPACE;
 
+    memcpy(pszValue, psz, cch + 1);
     return VINF_SUCCESS;
 }
 
-DECLCALLBACK(int) Medium::vdTcpClientConnect(VDSOCKET Sock, const char *pszAddress, uint32_t uPort,
-                                             RTMSINTERVAL cMillies)
+DECLCALLBACK(int) Medium::i_vdCryptoKeyRetain(void *pvUser, const char *pszId,
+                                              const uint8_t **ppbKey, size_t *pcbKey)
 {
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-
-    return RTTcpClientConnectEx(pszAddress, uPort, &pSocketInt->hSocket, cMillies, NULL);
+    Medium::CryptoFilterSettings *pSettings = (Medium::CryptoFilterSettings *)pvUser;
+    NOREF(pszId);
+    NOREF(ppbKey);
+    NOREF(pcbKey);
+    AssertPtrReturn(pSettings, VERR_GENERAL_FAILURE);
+    AssertMsgFailedReturn(("This method should not be called here!\n"), VERR_INVALID_STATE);
 }
 
-DECLCALLBACK(int) Medium::vdTcpClientClose(VDSOCKET Sock)
+DECLCALLBACK(int) Medium::i_vdCryptoKeyRelease(void *pvUser, const char *pszId)
 {
-    int rc = VINF_SUCCESS;
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-
-    rc = RTTcpClientCloseEx(pSocketInt->hSocket, false /*fGracefulShutdown*/);
-    pSocketInt->hSocket = NIL_RTSOCKET;
-    return rc;
+    Medium::CryptoFilterSettings *pSettings = (Medium::CryptoFilterSettings *)pvUser;
+    NOREF(pszId);
+    AssertPtrReturn(pSettings, VERR_GENERAL_FAILURE);
+    AssertMsgFailedReturn(("This method should not be called here!\n"), VERR_INVALID_STATE);
 }
 
-DECLCALLBACK(bool) Medium::vdTcpIsClientConnected(VDSOCKET Sock)
+DECLCALLBACK(int) Medium::i_vdCryptoKeyStorePasswordRetain(void *pvUser, const char *pszId, const char **ppszPassword)
 {
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return pSocketInt->hSocket != NIL_RTSOCKET;
-}
+    Medium::CryptoFilterSettings *pSettings = (Medium::CryptoFilterSettings *)pvUser;
+    AssertPtrReturn(pSettings, VERR_GENERAL_FAILURE);
 
-DECLCALLBACK(int) Medium::vdTcpSelectOne(VDSOCKET Sock, RTMSINTERVAL cMillies)
-{
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return RTTcpSelectOne(pSocketInt->hSocket, cMillies);
+    NOREF(pszId);
+    *ppszPassword = pSettings->pszPassword;
+    return VINF_SUCCESS;
 }
 
-DECLCALLBACK(int) Medium::vdTcpRead(VDSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead)
+DECLCALLBACK(int) Medium::i_vdCryptoKeyStorePasswordRelease(void *pvUser, const char *pszId)
 {
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return RTTcpRead(pSocketInt->hSocket, pvBuffer, cbBuffer, pcbRead);
+    Medium::CryptoFilterSettings *pSettings = (Medium::CryptoFilterSettings *)pvUser;
+    AssertPtrReturn(pSettings, VERR_GENERAL_FAILURE);
+    NOREF(pszId);
+    return VINF_SUCCESS;
 }
 
-DECLCALLBACK(int) Medium::vdTcpWrite(VDSOCKET Sock, const void *pvBuffer, size_t cbBuffer)
+DECLCALLBACK(int) Medium::i_vdCryptoKeyStoreSave(void *pvUser, const void *pvKeyStore, size_t cbKeyStore)
 {
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return RTTcpWrite(pSocketInt->hSocket, pvBuffer, cbBuffer);
-}
+    Medium::CryptoFilterSettings *pSettings = (Medium::CryptoFilterSettings *)pvUser;
+    AssertPtrReturn(pSettings, VERR_GENERAL_FAILURE);
 
-DECLCALLBACK(int) Medium::vdTcpSgWrite(VDSOCKET Sock, PCRTSGBUF pSgBuf)
-{
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return RTTcpSgWrite(pSocketInt->hSocket, pSgBuf);
-}
+    pSettings->pszKeyStore = (char *)RTMemAllocZ(cbKeyStore);
+    if (!pSettings->pszKeyStore)
+        return VERR_NO_MEMORY;
 
-DECLCALLBACK(int) Medium::vdTcpFlush(VDSOCKET Sock)
-{
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return RTTcpFlush(pSocketInt->hSocket);
+    memcpy(pSettings->pszKeyStore, pvKeyStore, cbKeyStore);
+    return VINF_SUCCESS;
 }
 
-DECLCALLBACK(int) Medium::vdTcpSetSendCoalescing(VDSOCKET Sock, bool fEnable)
+DECLCALLBACK(int) Medium::i_vdCryptoKeyStoreReturnParameters(void *pvUser, const char *pszCipher,
+                                                             const uint8_t *pbDek, size_t cbDek)
 {
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return RTTcpSetSendCoalescing(pSocketInt->hSocket, fEnable);
-}
+    Medium::CryptoFilterSettings *pSettings = (Medium::CryptoFilterSettings *)pvUser;
+    AssertPtrReturn(pSettings, VERR_GENERAL_FAILURE);
 
-DECLCALLBACK(int) Medium::vdTcpGetLocalAddress(VDSOCKET Sock, PRTNETADDR pAddr)
-{
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return RTTcpGetLocalAddress(pSocketInt->hSocket, pAddr);
-}
+    pSettings->pszCipherReturned = RTStrDup(pszCipher);
+    pSettings->pbDek             = pbDek;
+    pSettings->cbDek             = cbDek;
 
-DECLCALLBACK(int) Medium::vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr)
-{
-    PVDSOCKETINT pSocketInt = (PVDSOCKETINT)Sock;
-    return RTTcpGetPeerAddress(pSocketInt->hSocket, pAddr);
+    return pSettings->pszCipherReturned ? VINF_SUCCESS : VERR_NO_MEMORY;
 }
 
 /**
@@ -6857,7 +7345,7 @@ DECLCALLBACK(int) Medium::vdTcpGetPeerAddress(VDSOCKET Sock, PRTNETADDR pAddr)
  *       task when the task is finished to signal the operation completion for
  *       other threads asynchronously waiting for it.
  */
-HRESULT Medium::startThread(Medium::Task *pTask)
+HRESULT Medium::i_startThread(Medium::Task *pTask)
 {
 #ifdef VBOX_WITH_MAIN_LOCK_VALIDATION
     /* Extreme paranoia: The calling thread should not hold the medium
@@ -6895,7 +7383,7 @@ HRESULT Medium::startThread(Medium::Task *pTask)
  *       by this method directly and it's the caller's responsibility to
  *       complete the progress object in this case.
  */
-HRESULT Medium::runNow(Medium::Task *pTask)
+HRESULT Medium::i_runNow(Medium::Task *pTask)
 {
 #ifdef VBOX_WITH_MAIN_LOCK_VALIDATION
     /* Extreme paranoia: The calling thread should not hold the medium
@@ -6919,7 +7407,7 @@ HRESULT Medium::runNow(Medium::Task *pTask)
  * @param task
  * @return
  */
-HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task)
+HRESULT Medium::i_taskCreateBaseHandler(Medium::CreateBaseTask &task)
 {
     HRESULT rc = S_OK;
 
@@ -6940,7 +7428,7 @@ HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task)
         if (fGenerateUuid)
         {
             id.create();
-            /* VirtualBox::registerMedium() will need UUID */
+            /* VirtualBox::i_registerMedium() will need UUID */
             unconst(m->id) = id;
         }
 
@@ -6952,7 +7440,7 @@ HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task)
         Assert(m->state == MediumState_Creating);
 
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         /* unlock before the potentially lengthy operation */
@@ -6963,7 +7451,7 @@ HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task)
             /* ensure the directory exists */
             if (capabilities & MediumFormatCapabilities_File)
             {
-                rc = VirtualBox::ensureFilePathExists(location, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
+                rc = VirtualBox::i_ensureFilePathExists(location, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
                 if (FAILED(rc))
                     throw rc;
             }
@@ -6983,9 +7471,16 @@ HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task)
                                m->vdImageIfaces,
                                task.mVDOperationIfaces);
             if (RT_FAILURE(vrc))
-                throw setError(VBOX_E_FILE_ERROR,
-                               tr("Could not create the medium storage unit '%s'%s"),
-                               location.c_str(), vdError(vrc).c_str());
+            {
+                if (vrc == VERR_VD_INVALID_TYPE)
+                    throw setError(VBOX_E_FILE_ERROR,
+                                   tr("Parameters for creating the medium storage unit '%s' are invalid%s"),
+                                   location.c_str(), i_vdError(vrc).c_str());
+                else
+                    throw setError(VBOX_E_FILE_ERROR,
+                                   tr("Could not create the medium storage unit '%s'%s"),
+                                   location.c_str(), i_vdError(vrc).c_str());
+            }
 
             size = VDGetFileSize(hdd, 0);
             logicalSize = VDGetSize(hdd, 0);
@@ -7005,9 +7500,9 @@ HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task)
         /* register with mVirtualBox as the last step and move to
          * Created state only on success (leaving an orphan file is
          * better than breaking media registry consistency) */
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
         ComObjPtr<Medium> pMedium;
-        rc = m->pVirtualBox->registerMedium(this, &pMedium, DeviceType_HardDisk, treeLock);
+        rc = m->pVirtualBox->i_registerMedium(this, &pMedium, treeLock);
         Assert(this == pMedium);
     }
 
@@ -7023,11 +7518,11 @@ HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task)
         m->variant = variant;
 
         thisLock.release();
-        markRegistriesModified();
+        i_markRegistriesModified();
         if (task.isAsync())
         {
             // in asynchronous mode, save settings now
-            m->pVirtualBox->saveModifiedRegistries();
+            m->pVirtualBox->i_saveModifiedRegistries();
         }
     }
     else
@@ -7055,7 +7550,7 @@ HRESULT Medium::taskCreateBaseHandler(Medium::CreateBaseTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
+HRESULT Medium::i_taskCreateDiffHandler(Medium::CreateDiffTask &task)
 {
     HRESULT rcTmp = S_OK;
 
@@ -7067,6 +7562,14 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
 
     try
     {
+        if (i_getDepth() >= SETTINGS_MEDIUM_DEPTH_MAX)
+        {
+            AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+            throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                           tr("Cannot create differencing image for medium '%s', because it exceeds the medium tree depth limit. Please merge some images which you no longer need"),
+                           m->strLocationFull.c_str());
+        }
+
         /* Lock both in {parent,child} order. */
         AutoMultiWriteLock2 mediaLock(this, pTarget COMMA_LOCKVAL_SRC_POS);
 
@@ -7078,7 +7581,7 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
         if (fGenerateUuid)
         {
             targetId.create();
-            /* VirtualBox::registerMedium() will need UUID */
+            /* VirtualBox::i_registerMedium() will need UUID */
             unconst(pTarget->m->id) = targetId;
         }
 
@@ -7093,7 +7596,7 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
         Assert(m->state == MediumState_LockedRead);
 
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         /* the two media are now protected by their non-default states;
@@ -7133,13 +7636,14 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not open the medium storage unit '%s'%s"),
                                    pMedium->m->strLocationFull.c_str(),
-                                   vdError(vrc).c_str());
+                                   i_vdError(vrc).c_str());
             }
 
             /* ensure the target directory exists */
             if (capabilities & MediumFormatCapabilities_File)
             {
-                HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
+                HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation,
+                                                                !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
                 if (FAILED(rc))
                     throw rc;
             }
@@ -7155,9 +7659,16 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
                                pTarget->m->vdImageIfaces,
                                task.mVDOperationIfaces);
             if (RT_FAILURE(vrc))
-                throw setError(VBOX_E_FILE_ERROR,
-                                tr("Could not create the differencing medium storage unit '%s'%s"),
-                                targetLocation.c_str(), vdError(vrc).c_str());
+            {
+                if (vrc == VERR_VD_INVALID_TYPE)
+                    throw setError(VBOX_E_FILE_ERROR,
+                                   tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"),
+                                   targetLocation.c_str(), i_vdError(vrc).c_str());
+                else
+                    throw setError(VBOX_E_FILE_ERROR,
+                                   tr("Could not create the differencing medium storage unit '%s'%s"),
+                                   targetLocation.c_str(), i_vdError(vrc).c_str());
+            }
 
             size = VDGetFileSize(hdd, VD_LAST_IMAGE);
             logicalSize = VDGetSize(hdd, VD_LAST_IMAGE);
@@ -7176,29 +7687,35 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
 
     if (SUCCEEDED(mrc))
     {
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
         Assert(pTarget->m->pParent.isNull());
 
-        /* associate the child with the parent */
-        pTarget->m->pParent = this;
-        m->llChildren.push_back(pTarget);
+        /* associate child with the parent, maximum depth was checked above */
+        pTarget->i_setParent(this);
 
-        /** @todo r=klaus neither target nor base() are locked,
-            * potential race! */
         /* diffs for immutable media are auto-reset by default */
-        pTarget->m->autoReset = (getBase()->m->type == MediumType_Immutable);
+        bool fAutoReset;
+        {
+            ComObjPtr<Medium> pBase = i_getBase();
+            AutoReadLock block(pBase COMMA_LOCKVAL_SRC_POS);
+            fAutoReset = (pBase->m->type == MediumType_Immutable);
+        }
+        {
+            AutoWriteLock tlock(pTarget COMMA_LOCKVAL_SRC_POS);
+            pTarget->m->autoReset = fAutoReset;
+        }
 
         /* register with mVirtualBox as the last step and move to
          * Created state only on success (leaving an orphan file is
          * better than breaking media registry consistency) */
         ComObjPtr<Medium> pMedium;
-        mrc = m->pVirtualBox->registerMedium(pTarget, &pMedium, DeviceType_HardDisk, treeLock);
+        mrc = m->pVirtualBox->i_registerMedium(pTarget, &pMedium, treeLock);
         Assert(pTarget == pMedium);
 
         if (FAILED(mrc))
             /* break the parent association on failure to register */
-            deparent();
+            i_deparent();
     }
 
     AutoMultiWriteLock2 mediaLock(this, pTarget COMMA_LOCKVAL_SRC_POS);
@@ -7228,11 +7745,11 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
     --m->numCreateDiffTasks;
 
     mediaLock.release();
-    markRegistriesModified();
+    i_markRegistriesModified();
     if (task.isAsync())
     {
         // in asynchronous mode, save settings now
-        m->pVirtualBox->saveModifiedRegistries();
+        m->pVirtualBox->i_saveModifiedRegistries();
     }
 
     /* Note that in sync mode, it's the caller's responsibility to
@@ -7253,7 +7770,7 @@ HRESULT Medium::taskCreateDiffHandler(Medium::CreateDiffTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
+HRESULT Medium::i_taskMergeHandler(Medium::MergeTask &task)
 {
     HRESULT rcTmp = S_OK;
 
@@ -7261,8 +7778,17 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
 
     try
     {
+        if (!task.mParentForTarget.isNull())
+            if (task.mParentForTarget->i_getDepth() >= SETTINGS_MEDIUM_DEPTH_MAX)
+            {
+                AutoReadLock plock(task.mParentForTarget COMMA_LOCKVAL_SRC_POS);
+                throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                               tr("Cannot merge image for medium '%s', because it exceeds the medium tree depth limit. Please merge some images which you no longer need"),
+                               task.mParentForTarget->m->strLocationFull.c_str());
+            }
+
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         try
@@ -7390,7 +7916,7 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
                              tr("Could not merge the medium '%s' to '%s'%s"),
                              m->strLocationFull.c_str(),
                              pTarget->m->strLocationFull.c_str(),
-                             vdError(aVRC).c_str());
+                             i_vdError(aVRC).c_str());
         }
 
         VDDestroy(hdd);
@@ -7406,39 +7932,35 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
         /* all media but the target were successfully deleted by
          * VDMerge; reparent the last one and uninitialize deleted media. */
 
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
         if (task.mfMergeForward)
         {
             /* first, unregister the target since it may become a base
              * medium which needs re-registration */
-            rc2 = m->pVirtualBox->unregisterMedium(pTarget);
+            rc2 = m->pVirtualBox->i_unregisterMedium(pTarget);
             AssertComRC(rc2);
 
-            /* then, reparent it and disconnect the deleted branch at
-             * both ends (chain->parent() is source's parent) */
-            pTarget->deparent();
-            pTarget->m->pParent = task.mParentForTarget;
-            if (pTarget->m->pParent)
-            {
-                pTarget->m->pParent->m->llChildren.push_back(pTarget);
-                deparent();
-            }
+            /* then, reparent it and disconnect the deleted branch at both ends
+             * (chain->parent() is source's parent). Depth check above. */
+            pTarget->i_deparent();
+            pTarget->i_setParent(task.mParentForTarget);
+            if (task.mParentForTarget)
+                i_deparent();
 
             /* then, register again */
             ComObjPtr<Medium> pMedium;
-            rc2 = m->pVirtualBox->registerMedium(pTarget, &pMedium,
-                                                 DeviceType_HardDisk,
-                                                 treeLock);
+            rc2 = m->pVirtualBox->i_registerMedium(pTarget, &pMedium,
+                                                   treeLock);
             AssertComRC(rc2);
         }
         else
         {
-            Assert(pTarget->getChildren().size() == 1);
-            Medium *targetChild = pTarget->getChildren().front();
+            Assert(pTarget->i_getChildren().size() == 1);
+            Medium *targetChild = pTarget->i_getChildren().front();
 
             /* disconnect the deleted branch at the elder end */
-            targetChild->deparent();
+            targetChild->i_deparent();
 
             /* reparent source's children and disconnect the deleted
              * branch at the younger end */
@@ -7456,8 +7978,9 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
                     Medium *pMedium = it->GetMedium();
                     AutoWriteLock childLock(pMedium COMMA_LOCKVAL_SRC_POS);
 
-                    pMedium->deparent();  // removes pMedium from source
-                    pMedium->setParent(pTarget);
+                    pMedium->i_deparent();  // removes pMedium from source
+                    // no depth check, reduces depth
+                    pMedium->i_setParent(pTarget);
                 }
             }
         }
@@ -7484,7 +8007,7 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
                 continue;
             }
 
-            rc2 = pMedium->m->pVirtualBox->unregisterMedium(pMedium);
+            rc2 = pMedium->m->pVirtualBox->i_unregisterMedium(pMedium);
             AssertComRC(rc2);
 
             /* now, uninitialize the deleted medium (note that
@@ -7501,7 +8024,7 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
              * the caller's responsibility) */
             if (pMedium == this)
             {
-                Assert(getChildren().size() == 0);
+                Assert(i_getChildren().size() == 0);
                 Assert(m->backRefs.size() == 0);
                 task.mMediumCaller.release();
             }
@@ -7521,12 +8044,12 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
         }
     }
 
-    markRegistriesModified();
+    i_markRegistriesModified();
     if (task.isAsync())
     {
         // in asynchronous mode, save settings now
         eik.restore();
-        m->pVirtualBox->saveModifiedRegistries();
+        m->pVirtualBox->i_saveModifiedRegistries();
         eik.fetch();
     }
 
@@ -7543,7 +8066,7 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
          * in the mergeTo() docs. The latter also implies that we
          * don't own the merge chain, so release it in this case. */
         if (task.isAsync())
-            cancelMergeTo(task.mpChildrenToReparent, task.mpMediumLockList);
+            i_cancelMergeTo(task.mpChildrenToReparent, task.mpMediumLockList);
     }
 
     return mrc;
@@ -7558,7 +8081,7 @@ HRESULT Medium::taskMergeHandler(Medium::MergeTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
+HRESULT Medium::i_taskCloneHandler(Medium::CloneTask &task)
 {
     HRESULT rcTmp = S_OK;
 
@@ -7573,6 +8096,15 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
 
     try
     {
+        if (!pParent.isNull())
+            if (pParent->i_getDepth() >= SETTINGS_MEDIUM_DEPTH_MAX)
+            {
+                AutoReadLock plock(pParent COMMA_LOCKVAL_SRC_POS);
+                throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                               tr("Cannot clone image for medium '%s', because it exceeds the medium tree depth limit. Please merge some images which you no longer need"),
+                               pParent->m->strLocationFull.c_str());
+            }
+
         /* Lock all in {parent,child} order. The lock is also used as a
          * signal from the task initiator (which releases it only after
          * RTThreadCreate()) that we can start the job. */
@@ -7593,7 +8125,7 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
         }
 
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         try
@@ -7624,7 +8156,7 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not open the medium storage unit '%s'%s"),
                                    pMedium->m->strLocationFull.c_str(),
-                                   vdError(vrc).c_str());
+                                   i_vdError(vrc).c_str());
             }
 
             Utf8Str targetFormat(pTarget->m->strFormat);
@@ -7643,13 +8175,14 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
             /* ensure the target directory exists */
             if (capabilities & MediumFormatCapabilities_File)
             {
-                HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
+                HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation,
+                                                                !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
                 if (FAILED(rc))
                     throw rc;
             }
 
             PVBOXHDD targetHdd;
-            vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &targetHdd);
+            vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &targetHdd);
             ComAssertRCThrow(vrc, E_FAIL);
 
             try
@@ -7693,10 +8226,10 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
                         throw setError(VBOX_E_FILE_ERROR,
                                        tr("Could not open the medium storage unit '%s'%s"),
                                        pMedium->m->strLocationFull.c_str(),
-                                       vdError(vrc).c_str());
+                                       i_vdError(vrc).c_str());
                 }
 
-                /** @todo r=klaus target isn't locked, race getting the state */
+                /* target isn't locked, but no changing data is accessed */
                 if (task.midxSrcImageSame == UINT32_MAX)
                 {
                     vrc = VDCopy(hdd,
@@ -7734,7 +8267,7 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
                 if (RT_FAILURE(vrc))
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not create the clone medium '%s'%s"),
-                                   targetLocation.c_str(), vdError(vrc).c_str());
+                                   targetLocation.c_str(), i_vdError(vrc).c_str());
 
                 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE);
                 logicalSize = VDGetSize(targetHdd, VD_LAST_IMAGE);
@@ -7760,41 +8293,38 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
     if (SUCCEEDED(mrc) && fCreatingTarget)
     {
         /* we set mParent & children() */
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
         Assert(pTarget->m->pParent.isNull());
 
         if (pParent)
         {
-            /* associate the clone with the parent and deassociate
-             * from VirtualBox */
-            pTarget->m->pParent = pParent;
-            pParent->m->llChildren.push_back(pTarget);
+            /* Associate the clone with the parent and deassociate
+             * from VirtualBox. Depth check above. */
+            pTarget->i_setParent(pParent);
 
             /* register with mVirtualBox as the last step and move to
              * Created state only on success (leaving an orphan file is
              * better than breaking media registry consistency) */
             eik.restore();
             ComObjPtr<Medium> pMedium;
-            mrc = pParent->m->pVirtualBox->registerMedium(pTarget, &pMedium,
-                                                          DeviceType_HardDisk,
-                                                          treeLock);
+            mrc = pParent->m->pVirtualBox->i_registerMedium(pTarget, &pMedium,
+                                                            treeLock);
             Assert(   FAILED(mrc)
                    || pTarget == pMedium);
             eik.fetch();
 
             if (FAILED(mrc))
                 /* break parent association on failure to register */
-                pTarget->deparent();     // removes target from parent
+                pTarget->i_deparent();     // removes target from parent
         }
         else
         {
             /* just register  */
             eik.restore();
             ComObjPtr<Medium> pMedium;
-            mrc = m->pVirtualBox->registerMedium(pTarget, &pMedium,
-                                                 DeviceType_HardDisk,
-                                                 treeLock);
+            mrc = m->pVirtualBox->i_registerMedium(pTarget, &pMedium,
+                                                   treeLock);
             Assert(   FAILED(mrc)
                    || pTarget == pMedium);
             eik.fetch();
@@ -7824,15 +8354,35 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
         }
     }
 
-    // now, at the end of this task (always asynchronous), save the settings
+    /* Copy any filter related settings over to the target. */
     if (SUCCEEDED(mrc))
     {
-        // save the settings
-        markRegistriesModified();
-        /* collect multiple errors */
-        eik.restore();
-        m->pVirtualBox->saveModifiedRegistries();
-        eik.fetch();
+        /* Copy any filter related settings over. */
+        ComObjPtr<Medium> pBase = i_getBase();
+        ComObjPtr<Medium> pTargetBase = pTarget->i_getBase();
+        std::vector<com::Utf8Str> aFilterPropNames;
+        std::vector<com::Utf8Str> aFilterPropValues;
+        mrc = pBase->i_getFilterProperties(aFilterPropNames, aFilterPropValues);
+        if (SUCCEEDED(mrc))
+        {
+            /* Go through the properties and add them to the target medium. */
+            for (unsigned idx = 0; idx < aFilterPropNames.size(); idx++)
+            {
+                mrc = pTargetBase->i_setPropertyDirect(aFilterPropNames[idx], aFilterPropValues[idx]);
+                if (FAILED(mrc)) break;
+            }
+
+            // now, at the end of this task (always asynchronous), save the settings
+            if (SUCCEEDED(mrc))
+            {
+                // save the settings
+                i_markRegistriesModified();
+                /* collect multiple errors */
+                eik.restore();
+                m->pVirtualBox->i_saveModifiedRegistries();
+                eik.fetch();
+            }
+        }
     }
 
     /* Everything is explicitly unlocked when the task exits,
@@ -7856,7 +8406,7 @@ HRESULT Medium::taskCloneHandler(Medium::CloneTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskDeleteHandler(Medium::DeleteTask &task)
+HRESULT Medium::i_taskDeleteHandler(Medium::DeleteTask &task)
 {
     NOREF(task);
     HRESULT rc = S_OK;
@@ -7868,7 +8418,7 @@ HRESULT Medium::taskDeleteHandler(Medium::DeleteTask &task)
         AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
 
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         Utf8Str format(m->strFormat);
@@ -7891,7 +8441,7 @@ HRESULT Medium::taskDeleteHandler(Medium::DeleteTask &task)
             if (RT_FAILURE(vrc))
                 throw setError(VBOX_E_FILE_ERROR,
                                tr("Could not delete the medium storage unit '%s'%s"),
-                               location.c_str(), vdError(vrc).c_str());
+                               location.c_str(), i_vdError(vrc).c_str());
 
         }
         catch (HRESULT aRC) { rc = aRC; }
@@ -7922,7 +8472,7 @@ HRESULT Medium::taskDeleteHandler(Medium::DeleteTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskResetHandler(Medium::ResetTask &task)
+HRESULT Medium::i_taskResetHandler(Medium::ResetTask &task)
 {
     HRESULT rc = S_OK;
 
@@ -7940,7 +8490,7 @@ HRESULT Medium::taskResetHandler(Medium::ResetTask &task)
         /// to add a VDResetDiff() API call
 
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         Guid id = m->id;
@@ -7987,7 +8537,7 @@ HRESULT Medium::taskResetHandler(Medium::ResetTask &task)
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not open the medium storage unit '%s'%s"),
                                    pMedium->m->strLocationFull.c_str(),
-                                   vdError(vrc).c_str());
+                                   i_vdError(vrc).c_str());
 
                 /* Done when we hit the media which should be reset */
                 if (pMedium == this)
@@ -7999,7 +8549,7 @@ HRESULT Medium::taskResetHandler(Medium::ResetTask &task)
             if (RT_FAILURE(vrc))
                 throw setError(VBOX_E_FILE_ERROR,
                                tr("Could not delete the medium storage unit '%s'%s"),
-                               location.c_str(), vdError(vrc).c_str());
+                               location.c_str(), i_vdError(vrc).c_str());
 
             /* next, create it again */
             vrc = VDOpen(hdd,
@@ -8010,7 +8560,7 @@ HRESULT Medium::taskResetHandler(Medium::ResetTask &task)
             if (RT_FAILURE(vrc))
                 throw setError(VBOX_E_FILE_ERROR,
                                tr("Could not open the medium storage unit '%s'%s"),
-                               parentLocation.c_str(), vdError(vrc).c_str());
+                               parentLocation.c_str(), i_vdError(vrc).c_str());
 
             vrc = VDCreateDiff(hdd,
                                format.c_str(),
@@ -8024,9 +8574,16 @@ HRESULT Medium::taskResetHandler(Medium::ResetTask &task)
                                m->vdImageIfaces,
                                task.mVDOperationIfaces);
             if (RT_FAILURE(vrc))
-                throw setError(VBOX_E_FILE_ERROR,
-                               tr("Could not create the differencing medium storage unit '%s'%s"),
-                               location.c_str(), vdError(vrc).c_str());
+            {
+                if (vrc == VERR_VD_INVALID_TYPE)
+                    throw setError(VBOX_E_FILE_ERROR,
+                                   tr("Parameters for creating the differencing medium storage unit '%s' are invalid%s"),
+                                   location.c_str(), i_vdError(vrc).c_str());
+                else
+                    throw setError(VBOX_E_FILE_ERROR,
+                                   tr("Could not create the differencing medium storage unit '%s'%s"),
+                                   location.c_str(), i_vdError(vrc).c_str());
+            }
 
             size = VDGetFileSize(hdd, VD_LAST_IMAGE);
             logicalSize = VDGetSize(hdd, VD_LAST_IMAGE);
@@ -8059,7 +8616,7 @@ HRESULT Medium::taskResetHandler(Medium::ResetTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskCompactHandler(Medium::CompactTask &task)
+HRESULT Medium::i_taskCompactHandler(Medium::CompactTask &task)
 {
     HRESULT rc = S_OK;
 
@@ -8071,7 +8628,7 @@ HRESULT Medium::taskCompactHandler(Medium::CompactTask &task)
     try
     {
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         try
@@ -8110,7 +8667,7 @@ HRESULT Medium::taskCompactHandler(Medium::CompactTask &task)
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not open the medium storage unit '%s'%s"),
                                    pMedium->m->strLocationFull.c_str(),
-                                   vdError(vrc).c_str());
+                                   i_vdError(vrc).c_str());
             }
 
             Assert(m->state == MediumState_LockedWrite);
@@ -8135,7 +8692,7 @@ HRESULT Medium::taskCompactHandler(Medium::CompactTask &task)
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not compact medium '%s'%s"),
                                    location.c_str(),
-                                   vdError(vrc).c_str());
+                                   i_vdError(vrc).c_str());
             }
         }
         catch (HRESULT aRC) { rc = aRC; }
@@ -8156,7 +8713,7 @@ HRESULT Medium::taskCompactHandler(Medium::CompactTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskResizeHandler(Medium::ResizeTask &task)
+HRESULT Medium::i_taskResizeHandler(Medium::ResizeTask &task)
 {
     HRESULT rc = S_OK;
 
@@ -8169,7 +8726,7 @@ HRESULT Medium::taskResizeHandler(Medium::ResizeTask &task)
         AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
 
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         try
@@ -8208,7 +8765,7 @@ HRESULT Medium::taskResizeHandler(Medium::ResizeTask &task)
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not open the medium storage unit '%s'%s"),
                                    pMedium->m->strLocationFull.c_str(),
-                                   vdError(vrc).c_str());
+                                   i_vdError(vrc).c_str());
             }
 
             Assert(m->state == MediumState_LockedWrite);
@@ -8234,7 +8791,7 @@ HRESULT Medium::taskResizeHandler(Medium::ResizeTask &task)
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not resize medium '%s'%s"),
                                    location.c_str(),
-                                   vdError(vrc).c_str());
+                                   i_vdError(vrc).c_str());
             }
             size = VDGetFileSize(hdd, VD_LAST_IMAGE);
             logicalSize = VDGetSize(hdd, VD_LAST_IMAGE);
@@ -8268,7 +8825,7 @@ HRESULT Medium::taskResizeHandler(Medium::ResizeTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskExportHandler(Medium::ExportTask &task)
+HRESULT Medium::i_taskExportHandler(Medium::ExportTask &task)
 {
     HRESULT rc = S_OK;
 
@@ -8277,14 +8834,90 @@ HRESULT Medium::taskExportHandler(Medium::ExportTask &task)
         /* Lock all in {parent,child} order. The lock is also used as a
          * signal from the task initiator (which releases it only after
          * RTThreadCreate()) that we can start the job. */
+        ComObjPtr<Medium> pBase = i_getBase();
         AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
 
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         try
         {
+            settings::StringsMap::iterator itKeyStore = pBase->m->mapProperties.find("CRYPT/KeyStore");
+            if (itKeyStore != pBase->m->mapProperties.end())
+            {
+                settings::StringsMap::iterator itKeyId = pBase->m->mapProperties.find("CRYPT/KeyId");
+
+#ifdef VBOX_WITH_EXTPACK
+                static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
+                static const char *s_pszVDPlugin = "VDPluginCrypt";
+                ExtPackManager *pExtPackManager = m->pVirtualBox->i_getExtPackManager();
+                if (pExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+                {
+                    /* Load the plugin */
+                    Utf8Str strPlugin;
+                    rc = pExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+                    if (SUCCEEDED(rc))
+                    {
+                        vrc = VDPluginLoadFromFilename(strPlugin.c_str());
+                        if (RT_FAILURE(vrc))
+                            throw setError(VBOX_E_NOT_SUPPORTED,
+                                           tr("Retrieving encryption settings of the image failed because the encryption plugin could not be loaded (%s)"),
+                                           i_vdError(vrc).c_str());
+                    }
+                    else
+                        throw setError(VBOX_E_NOT_SUPPORTED,
+                                       tr("Encryption is not supported because the extension pack '%s' is missing the encryption plugin (old extension pack installed?)"),
+                                       strExtPackPuel.c_str());
+                }
+                else
+                    throw setError(VBOX_E_NOT_SUPPORTED,
+                                   tr("Encryption is not supported because the extension pack '%s' is missing"),
+                                   strExtPackPuel.c_str());
+#else
+                throw setError(VBOX_E_NOT_SUPPORTED,
+                               tr("Encryption is not supported because extension pack support is not built in"));
+#endif
+
+                if (itKeyId == pBase->m->mapProperties.end())
+                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                   tr("Image '%s' is configured for encryption but doesn't has a key identifier set"),
+                                   pBase->m->strLocationFull.c_str());
+
+                /* Find the proper secret key in the key store. */
+                if (!task.m_pSecretKeyStore)
+                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                   tr("Image '%s' is configured for encryption but there is no key store to retrieve the password from"),
+                                   pBase->m->strLocationFull.c_str());
+
+                SecretKey *pKey = NULL;
+                vrc = task.m_pSecretKeyStore->retainSecretKey(itKeyId->second, &pKey);
+                if (RT_FAILURE(vrc))
+                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                   tr("Failed to retrieve the secret key with ID \"%s\" from the store (%Rrc)"),
+                                   itKeyId->second.c_str(), vrc);
+
+                Medium::CryptoFilterSettings CryptoSettingsRead;
+                i_taskEncryptSettingsSetup(&CryptoSettingsRead, NULL, itKeyStore->second.c_str(), (const char *)pKey->getKeyBuffer(),
+                                           false /* fCreateKeyStore */);
+                vrc = VDFilterAdd(hdd, "CRYPT", VD_FILTER_FLAGS_READ, CryptoSettingsRead.vdFilterIfaces);
+                if (vrc == VERR_VD_PASSWORD_INCORRECT)
+                {
+                    task.m_pSecretKeyStore->releaseSecretKey(itKeyId->second);
+                    throw setError(VBOX_E_PASSWORD_INCORRECT,
+                                   tr("The password to decrypt the image is incorrect"));
+                }
+                else if (RT_FAILURE(vrc))
+                {
+                    task.m_pSecretKeyStore->releaseSecretKey(itKeyId->second);
+                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                   tr("Failed to load the decryption filter: %s"),
+                                   i_vdError(vrc).c_str());
+                }
+
+                task.m_pSecretKeyStore->releaseSecretKey(itKeyId->second);
+            }
+
             /* Open all media in the source chain. */
             MediumLockList::Base::const_iterator sourceListBegin =
                 task.mpSourceMediumLockList->GetBegin();
@@ -8311,7 +8944,7 @@ HRESULT Medium::taskExportHandler(Medium::ExportTask &task)
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not open the medium storage unit '%s'%s"),
                                    pMedium->m->strLocationFull.c_str(),
-                                   vdError(vrc).c_str());
+                                   i_vdError(vrc).c_str());
             }
 
             Utf8Str targetFormat(task.mFormat->i_getId());
@@ -8326,13 +8959,14 @@ HRESULT Medium::taskExportHandler(Medium::ExportTask &task)
             /* ensure the target directory exists */
             if (capabilities & MediumFormatCapabilities_File)
             {
-                rc = VirtualBox::ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
+                rc = VirtualBox::i_ensureFilePathExists(targetLocation,
+                                                        !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
                 if (FAILED(rc))
                     throw rc;
             }
 
             PVBOXHDD targetHdd;
-            vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &targetHdd);
+            vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &targetHdd);
             ComAssertRCThrow(vrc, E_FAIL);
 
             try
@@ -8353,7 +8987,7 @@ HRESULT Medium::taskExportHandler(Medium::ExportTask &task)
                 if (RT_FAILURE(vrc))
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not create the exported medium '%s'%s"),
-                                   targetLocation.c_str(), vdError(vrc).c_str());
+                                   targetLocation.c_str(), i_vdError(vrc).c_str());
             }
             catch (HRESULT aRC) { rc = aRC; }
 
@@ -8385,7 +9019,7 @@ HRESULT Medium::taskExportHandler(Medium::ExportTask &task)
  * @param task
  * @return
  */
-HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
+HRESULT Medium::i_taskImportHandler(Medium::ImportTask &task)
 {
     HRESULT rcTmp = S_OK;
 
@@ -8399,6 +9033,15 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
 
     try
     {
+        if (!pParent.isNull())
+            if (pParent->i_getDepth() >= SETTINGS_MEDIUM_DEPTH_MAX)
+            {
+                AutoReadLock plock(pParent COMMA_LOCKVAL_SRC_POS);
+                throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                               tr("Cannot import image for medium '%s', because it exceeds the medium tree depth limit. Please merge some images which you no longer need"),
+                               pParent->m->strLocationFull.c_str());
+            }
+
         /* Lock all in {parent,child} order. The lock is also used as a
          * signal from the task initiator (which releases it only after
          * RTThreadCreate()) that we can start the job. */
@@ -8414,13 +9057,13 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
         if (fGenerateUuid)
         {
             targetId.create();
-            /* VirtualBox::registerMedium() will need UUID */
+            /* VirtualBox::i_registerMedium() will need UUID */
             unconst(m->id) = targetId;
         }
 
 
         PVBOXHDD hdd;
-        int vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &hdd);
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &hdd);
         ComAssertRCThrow(vrc, E_FAIL);
 
         try
@@ -8435,7 +9078,7 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
                 throw setError(VBOX_E_FILE_ERROR,
                                tr("Could not open the medium storage unit '%s'%s"),
                                task.mFilename.c_str(),
-                               vdError(vrc).c_str());
+                               i_vdError(vrc).c_str());
 
             Utf8Str targetFormat(m->strFormat);
             Utf8Str targetLocation(m->strLocationFull);
@@ -8452,13 +9095,14 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
             /* ensure the target directory exists */
             if (capabilities & MediumFormatCapabilities_File)
             {
-                HRESULT rc = VirtualBox::ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
+                HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation,
+                                                                !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);
                 if (FAILED(rc))
                     throw rc;
             }
 
             PVBOXHDD targetHdd;
-            vrc = VDCreate(m->vdDiskIfaces, convertDeviceType(), &targetHdd);
+            vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &targetHdd);
             ComAssertRCThrow(vrc, E_FAIL);
 
             try
@@ -8502,10 +9146,9 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
                         throw setError(VBOX_E_FILE_ERROR,
                                        tr("Could not open the medium storage unit '%s'%s"),
                                        pMedium->m->strLocationFull.c_str(),
-                                       vdError(vrc).c_str());
+                                       i_vdError(vrc).c_str());
                 }
 
-                /** @todo r=klaus target isn't locked, race getting the state */
                 vrc = VDCopy(hdd,
                              VD_LAST_IMAGE,
                              targetHdd,
@@ -8522,7 +9165,7 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
                 if (RT_FAILURE(vrc))
                     throw setError(VBOX_E_FILE_ERROR,
                                    tr("Could not create the imported medium '%s'%s"),
-                                   targetLocation.c_str(), vdError(vrc).c_str());
+                                   targetLocation.c_str(), i_vdError(vrc).c_str());
 
                 size = VDGetFileSize(targetHdd, VD_LAST_IMAGE);
                 logicalSize = VDGetSize(targetHdd, VD_LAST_IMAGE);
@@ -8548,38 +9191,36 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
     if (SUCCEEDED(mrc) && fCreatingTarget)
     {
         /* we set mParent & children() */
-        AutoWriteLock treeLock(m->pVirtualBox->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
         Assert(m->pParent.isNull());
 
         if (pParent)
         {
-            /* associate the imported medium with the parent and deassociate
-             * from VirtualBox */
-            m->pParent = pParent;
-            pParent->m->llChildren.push_back(this);
+            /* Associate the imported medium with the parent and deassociate
+             * from VirtualBox. Depth check above. */
+            i_setParent(pParent);
 
             /* register with mVirtualBox as the last step and move to
              * Created state only on success (leaving an orphan file is
              * better than breaking media registry consistency) */
             eik.restore();
             ComObjPtr<Medium> pMedium;
-            mrc = pParent->m->pVirtualBox->registerMedium(this, &pMedium,
-                                                          DeviceType_HardDisk,
-                                                          treeLock);
+            mrc = pParent->m->pVirtualBox->i_registerMedium(this, &pMedium,
+                                                            treeLock);
             Assert(this == pMedium);
             eik.fetch();
 
             if (FAILED(mrc))
                 /* break parent association on failure to register */
-                this->deparent();     // removes target from parent
+                this->i_deparent();     // removes target from parent
         }
         else
         {
             /* just register  */
             eik.restore();
             ComObjPtr<Medium> pMedium;
-            mrc = m->pVirtualBox->registerMedium(this, &pMedium, DeviceType_HardDisk, treeLock);
+            mrc = m->pVirtualBox->i_registerMedium(this, &pMedium, treeLock);
             Assert(this == pMedium);
             eik.fetch();
         }
@@ -8611,10 +9252,10 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
     // now, at the end of this task (always asynchronous), save the settings
     {
         // save the settings
-        markRegistriesModified();
+        i_markRegistriesModified();
         /* collect multiple errors */
         eik.restore();
-        m->pVirtualBox->saveModifiedRegistries();
+        m->pVirtualBox->i_saveModifiedRegistries();
         eik.fetch();
     }
 
@@ -8628,4 +9269,258 @@ HRESULT Medium::taskImportHandler(Medium::ImportTask &task)
     return mrc;
 }
 
+/**
+ * Sets up the encryption settings for a filter.
+ */
+void Medium::i_taskEncryptSettingsSetup(CryptoFilterSettings *pSettings, const char *pszCipher,
+                                        const char *pszKeyStore, const char *pszPassword,
+                                        bool fCreateKeyStore)
+{
+    pSettings->pszCipher       = pszCipher;
+    pSettings->pszPassword     = pszPassword;
+    pSettings->pszKeyStoreLoad = pszKeyStore;
+    pSettings->fCreateKeyStore = fCreateKeyStore;
+    pSettings->pbDek           = NULL;
+    pSettings->cbDek           = 0;
+    pSettings->vdFilterIfaces  = NULL;
+
+    pSettings->vdIfCfg.pfnAreKeysValid = i_vdCryptoConfigAreKeysValid;
+    pSettings->vdIfCfg.pfnQuerySize    = i_vdCryptoConfigQuerySize;
+    pSettings->vdIfCfg.pfnQuery        = i_vdCryptoConfigQuery;
+    pSettings->vdIfCfg.pfnQueryBytes   = NULL;
+
+    pSettings->vdIfCrypto.pfnKeyRetain                = i_vdCryptoKeyRetain;
+    pSettings->vdIfCrypto.pfnKeyRelease               = i_vdCryptoKeyRelease;
+    pSettings->vdIfCrypto.pfnKeyStorePasswordRetain   = i_vdCryptoKeyStorePasswordRetain;
+    pSettings->vdIfCrypto.pfnKeyStorePasswordRelease  = i_vdCryptoKeyStorePasswordRelease;
+    pSettings->vdIfCrypto.pfnKeyStoreSave             = i_vdCryptoKeyStoreSave;
+    pSettings->vdIfCrypto.pfnKeyStoreReturnParameters = i_vdCryptoKeyStoreReturnParameters;
+
+    int vrc = VDInterfaceAdd(&pSettings->vdIfCfg.Core,
+                             "Medium::vdInterfaceCfgCrypto",
+                             VDINTERFACETYPE_CONFIG, pSettings,
+                             sizeof(VDINTERFACECONFIG), &pSettings->vdFilterIfaces);
+    AssertRC(vrc);
+
+    vrc = VDInterfaceAdd(&pSettings->vdIfCrypto.Core,
+                         "Medium::vdInterfaceCrypto",
+                         VDINTERFACETYPE_CRYPTO, pSettings,
+                         sizeof(VDINTERFACECRYPTO), &pSettings->vdFilterIfaces);
+    AssertRC(vrc);
+}
+
+/**
+ * Implementation code for the "encrypt" task.
+ *
+ * @param task
+ * @return
+ */
+HRESULT Medium::i_taskEncryptHandler(Medium::EncryptTask &task)
+{
+    HRESULT rc = S_OK;
+
+    /* Lock all in {parent,child} order. The lock is also used as a
+     * signal from the task initiator (which releases it only after
+     * RTThreadCreate()) that we can start the job. */
+    ComObjPtr<Medium> pBase = i_getBase();
+    AutoWriteLock thisLock(this COMMA_LOCKVAL_SRC_POS);
+
+    try
+    {
+# ifdef VBOX_WITH_EXTPACK
+        static const Utf8Str strExtPackPuel("Oracle VM VirtualBox Extension Pack");
+        static const char *s_pszVDPlugin = "VDPluginCrypt";
+        ExtPackManager *pExtPackManager = m->pVirtualBox->i_getExtPackManager();
+        if (pExtPackManager->i_isExtPackUsable(strExtPackPuel.c_str()))
+        {
+            /* Load the plugin */
+            Utf8Str strPlugin;
+            rc = pExtPackManager->i_getLibraryPathForExtPack(s_pszVDPlugin, &strExtPackPuel, &strPlugin);
+            if (SUCCEEDED(rc))
+            {
+                int vrc = VDPluginLoadFromFilename(strPlugin.c_str());
+                if (RT_FAILURE(vrc))
+                    throw setError(VBOX_E_NOT_SUPPORTED,
+                                   tr("Encrypting the image failed because the encryption plugin could not be loaded (%s)"),
+                                   i_vdError(vrc).c_str());
+            }
+            else
+                throw setError(VBOX_E_NOT_SUPPORTED,
+                               tr("Encryption is not supported because the extension pack '%s' is missing the encryption plugin (old extension pack installed?)"),
+                               strExtPackPuel.c_str());
+        }
+        else
+            throw setError(VBOX_E_NOT_SUPPORTED,
+                           tr("Encryption is not supported because the extension pack '%s' is missing"),
+                           strExtPackPuel.c_str());
+
+        PVBOXHDD pDisk = NULL;
+        int vrc = VDCreate(m->vdDiskIfaces, i_convertDeviceType(), &pDisk);
+        ComAssertRCThrow(vrc, E_FAIL);
+
+        Medium::CryptoFilterSettings CryptoSettingsRead;
+        Medium::CryptoFilterSettings CryptoSettingsWrite;
+
+        void *pvBuf = NULL;
+        const char *pszPasswordNew = NULL;
+        try
+        {
+            /* Set up disk encryption filters. */
+            if (task.mstrCurrentPassword.isEmpty())
+            {
+                /*
+                 * Query whether the medium property indicating that encryption is
+                 * configured is existing.
+                 */
+                settings::StringsMap::iterator it = pBase->m->mapProperties.find("CRYPT/KeyStore");
+                if (it != pBase->m->mapProperties.end())
+                    throw setError(VBOX_E_PASSWORD_INCORRECT,
+                                   tr("The password given for the encrypted image is incorrect"));
+            }
+            else
+            {
+                settings::StringsMap::iterator it = pBase->m->mapProperties.find("CRYPT/KeyStore");
+                if (it == pBase->m->mapProperties.end())
+                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                   tr("The image is not configured for encryption"));
+
+                i_taskEncryptSettingsSetup(&CryptoSettingsRead, NULL, it->second.c_str(), task.mstrCurrentPassword.c_str(),
+                                           false /* fCreateKeyStore */);
+                vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_READ, CryptoSettingsRead.vdFilterIfaces);
+                if (vrc == VERR_VD_PASSWORD_INCORRECT)
+                    throw setError(VBOX_E_PASSWORD_INCORRECT,
+                                   tr("The password to decrypt the image is incorrect"));
+                else if (RT_FAILURE(vrc))
+                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                   tr("Failed to load the decryption filter: %s"),
+                                   i_vdError(vrc).c_str());
+            }
+
+            if (task.mstrCipher.isNotEmpty())
+            {
+                if (   task.mstrNewPassword.isEmpty()
+                    && task.mstrNewPasswordId.isEmpty()
+                    && task.mstrCurrentPassword.isNotEmpty())
+                {
+                    /* An empty password and password ID will default to the current password. */
+                    pszPasswordNew = task.mstrCurrentPassword.c_str();
+                }
+                else if (task.mstrNewPassword.isEmpty())
+                    throw setError(VBOX_E_OBJECT_NOT_FOUND,
+                                   tr("A password must be given for the image encryption"));
+                else if (task.mstrNewPasswordId.isEmpty())
+                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                   tr("A valid identifier for the password must be given"));
+                else
+                    pszPasswordNew = task.mstrNewPassword.c_str();
+
+                i_taskEncryptSettingsSetup(&CryptoSettingsWrite, task.mstrCipher.c_str(), NULL,
+                                           pszPasswordNew, true /* fCreateKeyStore */);
+                vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_WRITE, CryptoSettingsWrite.vdFilterIfaces);
+                if (RT_FAILURE(vrc))
+                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                                   tr("Failed to load the encryption filter: %s"),
+                                   i_vdError(vrc).c_str());
+            }
+            else if (task.mstrNewPasswordId.isNotEmpty() || task.mstrNewPassword.isNotEmpty())
+                throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                               tr("The password and password identifier must be empty if the output should be unencrypted"));
+
+            /* Open all media in the chain. */
+            MediumLockList::Base::const_iterator mediumListBegin =
+                task.mpMediumLockList->GetBegin();
+            MediumLockList::Base::const_iterator mediumListEnd =
+                task.mpMediumLockList->GetEnd();
+            MediumLockList::Base::const_iterator mediumListLast =
+                mediumListEnd;
+            mediumListLast--;
+            for (MediumLockList::Base::const_iterator it = mediumListBegin;
+                 it != mediumListEnd;
+                 ++it)
+            {
+                const MediumLock &mediumLock = *it;
+                const ComObjPtr<Medium> &pMedium = mediumLock.GetMedium();
+                AutoReadLock alock(pMedium COMMA_LOCKVAL_SRC_POS);
+
+                Assert(pMedium->m->state == MediumState_LockedWrite);
+
+                /* Open all media but last in read-only mode. Do not handle
+                 * shareable media, as compaction and sharing are mutually
+                 * exclusive. */
+                vrc = VDOpen(pDisk,
+                             pMedium->m->strFormat.c_str(),
+                             pMedium->m->strLocationFull.c_str(),
+                             m->uOpenFlagsDef | (it == mediumListLast ? VD_OPEN_FLAGS_NORMAL : VD_OPEN_FLAGS_READONLY),
+                             pMedium->m->vdImageIfaces);
+                if (RT_FAILURE(vrc))
+                    throw setError(VBOX_E_FILE_ERROR,
+                                   tr("Could not open the medium storage unit '%s'%s"),
+                                   pMedium->m->strLocationFull.c_str(),
+                                   i_vdError(vrc).c_str());
+            }
+
+            Assert(m->state == MediumState_LockedWrite);
+
+            Utf8Str location(m->strLocationFull);
+
+            /* unlock before the potentially lengthy operation */
+            thisLock.release();
+
+            vrc = VDPrepareWithFilters(pDisk, task.mVDOperationIfaces);
+            if (RT_FAILURE(vrc))
+                throw setError(VBOX_E_FILE_ERROR,
+                               tr("Could not prepare disk images for encryption (%Rrc)"),
+                               i_vdError(vrc).c_str());
+
+            thisLock.acquire();
+            /* If everything went well set the new key store. */
+            settings::StringsMap::iterator it = pBase->m->mapProperties.find("CRYPT/KeyStore");
+            if (it != pBase->m->mapProperties.end())
+                pBase->m->mapProperties.erase(it);
+
+            /* Delete KeyId if encryption is removed or the password did change. */
+            if (   task.mstrNewPasswordId.isNotEmpty()
+                || task.mstrCipher.isEmpty())
+            {
+                it = pBase->m->mapProperties.find("CRYPT/KeyId");
+                if (it != pBase->m->mapProperties.end())
+                    pBase->m->mapProperties.erase(it);
+            }
+
+            if (CryptoSettingsWrite.pszKeyStore)
+            {
+                pBase->m->mapProperties["CRYPT/KeyStore"] = Utf8Str(CryptoSettingsWrite.pszKeyStore);
+                if (task.mstrNewPasswordId.isNotEmpty())
+                    pBase->m->mapProperties["CRYPT/KeyId"] = task.mstrNewPasswordId;
+            }
+
+            if (CryptoSettingsRead.pszCipherReturned)
+                RTStrFree(CryptoSettingsRead.pszCipherReturned);
+
+            if (CryptoSettingsWrite.pszCipherReturned)
+                RTStrFree(CryptoSettingsWrite.pszCipherReturned);
+
+            thisLock.release();
+            pBase->i_markRegistriesModified();
+            m->pVirtualBox->i_saveModifiedRegistries();
+        }
+        catch (HRESULT aRC) { rc = aRC; }
+
+        if (pvBuf)
+            RTMemFree(pvBuf);
+
+        VDDestroy(pDisk);
+# else
+        throw setError(VBOX_E_NOT_SUPPORTED,
+                       tr("Encryption is not supported because extension pack support is not built in"));
+# endif
+    }
+    catch (HRESULT aRC) { rc = aRC; }
+
+    /* Everything is explicitly unlocked when the task exits,
+     * as the task destruction also destroys the media chain. */
+
+    return rc;
+}
+
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-server/MediumLock.cpp b/src/VBox/Main/src-server/MediumLock.cpp
index 567973d..e1c023f 100644
--- a/src/VBox/Main/src-server/MediumLock.cpp
+++ b/src/VBox/Main/src-server/MediumLock.cpp
@@ -1,3 +1,4 @@
+/* $Id: MediumLock.cpp $ */
 /** @file
  *
  * Medium lock management helper classes
@@ -95,7 +96,7 @@ HRESULT MediumLock::Lock(bool aIgnoreLockedMedia)
     MediumState_T state;
     {
         AutoReadLock alock(mMedium COMMA_LOCKVAL_SRC_POS);
-        state = mMedium->getState();
+        state = mMedium->i_getState();
     }
     switch (state)
     {
@@ -183,7 +184,7 @@ HRESULT MediumLockList::Update(const ComObjPtr<Medium> &aMedium, bool aLockWrite
 {
     for (MediumLockList::Base::iterator it = mMediumLocks.begin();
          it != mMediumLocks.end();
-         it++)
+         ++it)
     {
         if (it->GetMedium() == aMedium)
             return it->UpdateLock(aLockWrite);
@@ -222,7 +223,7 @@ HRESULT MediumLockList::Lock(bool fSkipOverLockedMedia /* = false */)
     HRESULT rc = S_OK;
     for (MediumLockList::Base::iterator it = mMediumLocks.begin();
          it != mMediumLocks.end();
-         it++)
+         ++it)
     {
         rc = it->Lock(fSkipOverLockedMedia);
         if (FAILED(rc))
@@ -249,7 +250,7 @@ HRESULT MediumLockList::Unlock()
     HRESULT rc = S_OK;
     for (MediumLockList::Base::iterator it = mMediumLocks.begin();
          it != mMediumLocks.end();
-         it++)
+         ++it)
     {
         HRESULT rc2 = it->Unlock();
         if (SUCCEEDED(rc) && FAILED(rc2))
@@ -343,7 +344,7 @@ HRESULT MediumLockListMap::Lock()
     HRESULT rc = S_OK;
     for (MediumLockListMap::Base::const_iterator it = mMediumLocks.begin();
          it != mMediumLocks.end();
-         it++)
+         ++it)
     {
         rc = it->second->Lock();
         if (FAILED(rc))
@@ -370,7 +371,7 @@ HRESULT MediumLockListMap::Unlock()
     HRESULT rc = S_OK;
     for (MediumLockListMap::Base::const_iterator it = mMediumLocks.begin();
          it != mMediumLocks.end();
-         it++)
+         ++it)
     {
         MediumLockList *pMediumLockList = it->second;
         HRESULT rc2 = pMediumLockList->Unlock();
diff --git a/src/VBox/Main/src-server/NATEngineImpl.cpp b/src/VBox/Main/src-server/NATEngineImpl.cpp
index e58e533..8fd272f 100644
--- a/src/VBox/Main/src-server/NATEngineImpl.cpp
+++ b/src/VBox/Main/src-server/NATEngineImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -28,27 +28,72 @@
 #include <VBox/settings.h>
 #include <VBox/com/array.h>
 
+struct NATEngineData
+{
+    NATEngineData() : mMtu(0),
+             mSockRcv(0),
+             mSockSnd(0),
+             mTcpRcv(0),
+             mTcpSnd(0),
+             mDNSPassDomain(TRUE),
+             mDNSProxy(FALSE),
+             mDNSUseHostResolver(FALSE),
+             mAliasMode(0)
+    {}
+
+    com::Utf8Str mNetwork;
+    com::Utf8Str mBindIP;
+    uint32_t mMtu;
+    uint32_t mSockRcv;
+    uint32_t mSockSnd;
+    uint32_t mTcpRcv;
+    uint32_t mTcpSnd;
+    /* TFTP service */
+    Utf8Str mTFTPPrefix;
+    Utf8Str mTFTPBootFile;
+    Utf8Str mTFTPNextServer;
+    /* DNS service */
+    BOOL mDNSPassDomain;
+    BOOL mDNSProxy;
+    BOOL mDNSUseHostResolver;
+    /* Alias service */
+    ULONG mAliasMode;
+};
+
+struct NATEngine::Data
+{
+    Backupable<NATEngineData> m;
+};
+
 
 // constructor / destructor
 ////////////////////////////////////////////////////////////////////////////////
 
-NATEngine::NATEngine():mParent(NULL), mAdapter(NULL){}
+NATEngine::NATEngine():mData(NULL), mParent(NULL), mAdapter(NULL) {}
 NATEngine::~NATEngine(){}
 
 HRESULT NATEngine::FinalConstruct()
 {
-    return S_OK;
+    return BaseFinalConstruct();
+}
+
+void NATEngine::FinalRelease()
+{
+    uninit();
+    BaseFinalRelease();
 }
 
+
 HRESULT NATEngine::init(Machine *aParent, INetworkAdapter *aAdapter)
 {
     AutoInitSpan autoInitSpan(this);
     AssertReturn(autoInitSpan.isOk(), E_FAIL);
     autoInitSpan.setSucceeded();
     m_fModified = false;
-    mData.allocate();
-    mData->mNetwork.setNull();
-    mData->mBindIP.setNull();
+    mData = new Data();
+    mData->m.allocate();
+    mData->m->mNetwork.setNull();
+    mData->m->mBindIP.setNull();
     unconst(mParent) = aParent;
     unconst(mAdapter) = aAdapter;
     return S_OK;
@@ -65,7 +110,8 @@ HRESULT NATEngine::init(Machine *aParent, INetworkAdapter *aAdapter, NATEngine *
 
     AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
 
-    mData.share(aThat->mData);
+    mData = new Data();
+    mData->m.share(aThat->mData->m);
     NATRuleMap::iterator it;
     mNATRules.clear();
     for (it = aThat->mNATRules.begin(); it != aThat->mNATRules.end(); ++it)
@@ -91,7 +137,8 @@ HRESULT NATEngine::initCopy(Machine *aParent, INetworkAdapter *aAdapter, NATEngi
 
     AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
 
-    mData.attachCopy(aThat->mData);
+    mData = new Data();
+    mData->m.attachCopy(aThat->mData->m);
     NATRuleMap::iterator it;
     mNATRules.clear();
     for (it = aThat->mNATRules.begin(); it != aThat->mNATRules.end(); ++it)
@@ -105,12 +152,6 @@ HRESULT NATEngine::initCopy(Machine *aParent, INetworkAdapter *aAdapter, NATEngi
 }
 
 
-void NATEngine::FinalRelease()
-{
-    uninit();
-    BaseFinalRelease();
-}
-
 void NATEngine::uninit()
 {
     AutoUninitSpan autoUninitSpan(this);
@@ -118,19 +159,21 @@ void NATEngine::uninit()
         return;
 
     mNATRules.clear();
-    mData.free();
+    mData->m.free();
+    delete mData;
+    mData = NULL;
     unconst(mPeer) = NULL;
     unconst(mParent) = NULL;
 }
 
-bool NATEngine::isModified()
+bool NATEngine::i_isModified()
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     bool fModified = m_fModified;
     return fModified;
 }
 
-bool NATEngine::rollback()
+bool NATEngine::i_rollback()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), false);
@@ -142,13 +185,13 @@ bool NATEngine::rollback()
     {
         /* we need to check all data to see whether anything will be changed
          * after rollback */
-        mData.rollback();
+        mData->m.rollback();
     }
     m_fModified = false;
     return fChanged;
 }
 
-void NATEngine::commit()
+void NATEngine::i_commit()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -162,10 +205,10 @@ void NATEngine::commit()
     AutoMultiWriteLock2 alock(mPeer, this COMMA_LOCKVAL_SRC_POS);
     if (m_fModified)
     {
-        mData.commit();
+        mData->m.commit();
         if (mPeer)
         {
-            mPeer->mData.attach(mData);
+            mPeer->mData->m.attach(mData->m);
             mPeer->mNATRules.clear();
             NATRuleMap::iterator it;
             for (it = mNATRules.begin(); it != mNATRules.end(); ++it)
@@ -177,95 +220,73 @@ void NATEngine::commit()
     m_fModified = false;
 }
 
-STDMETHODIMP
-NATEngine::GetNetworkSettings(ULONG *aMtu, ULONG *aSockSnd, ULONG *aSockRcv, ULONG *aTcpWndSnd, ULONG *aTcpWndRcv)
+HRESULT NATEngine::getNetworkSettings(ULONG *aMtu, ULONG *aSockSnd, ULONG *aSockRcv, ULONG *aTcpWndSnd, ULONG *aTcpWndRcv)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     if (aMtu)
-        *aMtu = mData->mMtu;
+        *aMtu = mData->m->mMtu;
     if (aSockSnd)
-        *aSockSnd = mData->mSockSnd;
+        *aSockSnd = mData->m->mSockSnd;
     if (aSockRcv)
-         *aSockRcv = mData->mSockRcv;
+        *aSockRcv = mData->m->mSockRcv;
     if (aTcpWndSnd)
-         *aTcpWndSnd = mData->mTcpSnd;
+        *aTcpWndSnd = mData->m->mTcpSnd;
     if (aTcpWndRcv)
-         *aTcpWndRcv = mData->mTcpRcv;
+        *aTcpWndRcv = mData->m->mTcpRcv;
 
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::SetNetworkSettings(ULONG aMtu, ULONG aSockSnd, ULONG aSockRcv, ULONG aTcpWndSnd, ULONG aTcpWndRcv)
+HRESULT NATEngine::setNetworkSettings(ULONG aMtu, ULONG aSockSnd, ULONG aSockRcv, ULONG aTcpWndSnd, ULONG aTcpWndRcv)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     if (   aMtu || aSockSnd || aSockRcv
         || aTcpWndSnd || aTcpWndRcv)
     {
-        mData.backup();
+        mData->m.backup();
         m_fModified = true;
     }
     if (aMtu)
-        mData->mMtu = aMtu;
+        mData->m->mMtu = aMtu;
     if (aSockSnd)
-        mData->mSockSnd = aSockSnd;
+        mData->m->mSockSnd = aSockSnd;
     if (aSockRcv)
-        mData->mSockRcv = aSockSnd;
+        mData->m->mSockRcv = aSockSnd;
     if (aTcpWndSnd)
-        mData->mTcpSnd = aTcpWndSnd;
+        mData->m->mTcpSnd = aTcpWndSnd;
     if (aTcpWndRcv)
-        mData->mTcpRcv = aTcpWndRcv;
+        mData->m->mTcpRcv = aTcpWndRcv;
 
     if (m_fModified)
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::COMGETTER(Redirects)(ComSafeArrayOut(BSTR , aNatRules))
-{
-    CheckComArgOutSafeArrayPointerValid(aNatRules);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT NATEngine::getRedirects(std::vector<com::Utf8Str> &aRedirects)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-
-    SafeArray<BSTR> sf(mNATRules.size());
+    aRedirects.resize(mNATRules.size());
     size_t i = 0;
     NATRuleMap::const_iterator it;
-    for (it = mNATRules.begin();
-         it != mNATRules.end(); ++it, ++i)
+    for (it = mNATRules.begin(); it != mNATRules.end(); ++it, ++i)
     {
         settings::NATRule r = it->second;
-        BstrFmt bstr("%s,%d,%s,%d,%s,%d",
-                     r.strName.c_str(),
-                     r.proto,
-                     r.strHostIP.c_str(),
-                     r.u16HostPort,
-                     r.strGuestIP.c_str(),
-                     r.u16GuestPort);
-        bstr.detachTo(&sf[i]);
+        aRedirects[i] = Utf8StrFmt("%s,%d,%s,%d,%s,%d",
+                                   r.strName.c_str(),
+                                   r.proto,
+                                   r.strHostIP.c_str(),
+                                   r.u16HostPort,
+                                   r.strGuestIP.c_str(),
+                                   r.u16GuestPort);
     }
-    sf.detachTo(ComSafeArrayOutArg(aNatRules));
     return S_OK;
 }
 
-
-STDMETHODIMP
-NATEngine::AddRedirect(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USHORT aHostPort, IN_BSTR aGuestIP, USHORT aGuestPort)
+HRESULT NATEngine::addRedirect(const com::Utf8Str &aName, NATProtocol_T aProto, const com::Utf8Str &aHostIP,
+                               USHORT aHostPort, const com::Utf8Str &aGuestIP, USHORT aGuestPort)
 {
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     Utf8Str name = aName;
     settings::NATRule r;
@@ -291,7 +312,7 @@ NATEngine::AddRedirect(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USH
         if (it->first == name)
             return setError(E_INVALIDARG,
                             tr("A NAT rule of this name already exists"));
-        if (   r.strHostIP == Utf8Str(aBindIp)
+        if (   r.strHostIP == aHostIP
             && r.u16HostPort == aHostPort
             && r.proto == aProto)
             return setError(E_INVALIDARG,
@@ -300,33 +321,30 @@ NATEngine::AddRedirect(IN_BSTR aName, NATProtocol_T aProto, IN_BSTR aBindIp, USH
 
     r.strName = name.c_str();
     r.proto = aProto;
-    r.strHostIP = aBindIp;
+    r.strHostIP = aHostIP;
     r.u16HostPort = aHostPort;
     r.strGuestIP = aGuestIP;
     r.u16GuestPort = aGuestPort;
     mNATRules.insert(std::make_pair(name, r));
-    mParent->setModified(Machine::IsModified_NetworkAdapters);
+    mParent->i_setModified(Machine::IsModified_NetworkAdapters);
     m_fModified = true;
 
     ULONG ulSlot;
     mAdapter->COMGETTER(Slot)(&ulSlot);
 
     alock.release();
-    mParent->onNATRedirectRuleChange(ulSlot, FALSE, Bstr(name).raw(), aProto, Bstr(r.strHostIP).raw(), r.u16HostPort, Bstr(r.strGuestIP).raw(), r.u16GuestPort);
+    mParent->i_onNATRedirectRuleChange(ulSlot, FALSE, Bstr(name).raw(), aProto, Bstr(r.strHostIP).raw(),
+                                       r.u16HostPort, Bstr(r.strGuestIP).raw(), r.u16GuestPort);
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::RemoveRedirect(IN_BSTR aName)
+HRESULT NATEngine::removeRedirect(const com::Utf8Str &aName)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     NATRuleMap::iterator it = mNATRules.find(aName);
     if (it == mNATRules.end())
         return E_INVALIDARG;
-    mData.backup();
+    mData->m.backup();
     settings::NATRule r = it->second;
     Utf8Str strHostIP = r.strHostIP;
     Utf8Str strGuestIP = r.strGuestIP;
@@ -337,39 +355,40 @@ NATEngine::RemoveRedirect(IN_BSTR aName)
     mAdapter->COMGETTER(Slot)(&ulSlot);
 
     mNATRules.erase(it);
-    mParent->setModified(Machine::IsModified_NetworkAdapters);
+    mParent->i_setModified(Machine::IsModified_NetworkAdapters);
     m_fModified = true;
-    mData.commit();
+    mData->m.commit();
     alock.release();
-    mParent->onNATRedirectRuleChange(ulSlot, TRUE, aName, proto, Bstr(strHostIP).raw(), u16HostPort, Bstr(strGuestIP).raw(), u16GuestPort);
+    mParent->i_onNATRedirectRuleChange(ulSlot, TRUE, Bstr(aName).raw(), proto, Bstr(strHostIP).raw(),
+                                       u16HostPort, Bstr(strGuestIP).raw(), u16GuestPort);
     return S_OK;
 }
 
-HRESULT NATEngine::loadSettings(const settings::NAT &data)
+HRESULT NATEngine::i_loadSettings(const settings::NAT &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     HRESULT rc = S_OK;
-    mData->mNetwork = data.strNetwork;
-    mData->mBindIP = data.strBindIP;
-    mData->mMtu = data.u32Mtu;
-    mData->mSockSnd = data.u32SockSnd;
-    mData->mTcpRcv = data.u32TcpRcv;
-    mData->mTcpSnd = data.u32TcpSnd;
+    mData->m->mNetwork = data.strNetwork;
+    mData->m->mBindIP = data.strBindIP;
+    mData->m->mMtu = data.u32Mtu;
+    mData->m->mSockSnd = data.u32SockSnd;
+    mData->m->mTcpRcv = data.u32TcpRcv;
+    mData->m->mTcpSnd = data.u32TcpSnd;
     /* TFTP */
-    mData->mTFTPPrefix = data.strTFTPPrefix;
-    mData->mTFTPBootFile = data.strTFTPBootFile;
-    mData->mTFTPNextServer = data.strTFTPNextServer;
+    mData->m->mTFTPPrefix = data.strTFTPPrefix;
+    mData->m->mTFTPBootFile = data.strTFTPBootFile;
+    mData->m->mTFTPNextServer = data.strTFTPNextServer;
     /* DNS */
-    mData->mDNSPassDomain = data.fDNSPassDomain;
-    mData->mDNSProxy = data.fDNSProxy;
-    mData->mDNSUseHostResolver = data.fDNSUseHostResolver;
+    mData->m->mDNSPassDomain = data.fDNSPassDomain;
+    mData->m->mDNSProxy = data.fDNSProxy;
+    mData->m->mDNSUseHostResolver = data.fDNSUseHostResolver;
     /* Alias */
-    mData->mAliasMode  = (data.fAliasUseSamePorts ? NATAliasMode_AliasUseSamePorts : 0);
-    mData->mAliasMode |= (data.fAliasLog          ? NATAliasMode_AliasLog          : 0);
-    mData->mAliasMode |= (data.fAliasProxyOnly    ? NATAliasMode_AliasProxyOnly    : 0);
+    mData->m->mAliasMode  = (data.fAliasUseSamePorts ? NATAliasMode_AliasUseSamePorts : 0);
+    mData->m->mAliasMode |= (data.fAliasLog          ? NATAliasMode_AliasLog          : 0);
+    mData->m->mAliasMode |= (data.fAliasProxyOnly    ? NATAliasMode_AliasProxyOnly    : 0);
     /* port forwarding */
     mNATRules.clear();
     for (settings::NATRuleList::const_iterator it = data.llRules.begin();
@@ -382,32 +401,32 @@ HRESULT NATEngine::loadSettings(const settings::NAT &data)
 }
 
 
-HRESULT NATEngine::saveSettings(settings::NAT &data)
+HRESULT NATEngine::i_saveSettings(settings::NAT &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     HRESULT rc = S_OK;
-    data.strNetwork = mData->mNetwork;
-    data.strBindIP = mData->mBindIP;
-    data.u32Mtu = mData->mMtu;
-    data.u32SockRcv = mData->mSockRcv;
-    data.u32SockSnd = mData->mSockSnd;
-    data.u32TcpRcv = mData->mTcpRcv;
-    data.u32TcpSnd = mData->mTcpSnd;
+    data.strNetwork = mData->m->mNetwork;
+    data.strBindIP = mData->m->mBindIP;
+    data.u32Mtu = mData->m->mMtu;
+    data.u32SockRcv = mData->m->mSockRcv;
+    data.u32SockSnd = mData->m->mSockSnd;
+    data.u32TcpRcv = mData->m->mTcpRcv;
+    data.u32TcpSnd = mData->m->mTcpSnd;
     /* TFTP */
-    data.strTFTPPrefix = mData->mTFTPPrefix;
-    data.strTFTPBootFile = mData->mTFTPBootFile;
-    data.strTFTPNextServer = mData->mTFTPNextServer;
+    data.strTFTPPrefix = mData->m->mTFTPPrefix;
+    data.strTFTPBootFile = mData->m->mTFTPBootFile;
+    data.strTFTPNextServer = mData->m->mTFTPNextServer;
     /* DNS */
-    data.fDNSPassDomain = !!mData->mDNSPassDomain;
-    data.fDNSProxy = !!mData->mDNSProxy;
-    data.fDNSUseHostResolver = !!mData->mDNSUseHostResolver;
+    data.fDNSPassDomain = !!mData->m->mDNSPassDomain;
+    data.fDNSProxy = !!mData->m->mDNSProxy;
+    data.fDNSUseHostResolver = !!mData->m->mDNSUseHostResolver;
     /* Alias */
-    data.fAliasLog = !!(mData->mAliasMode & NATAliasMode_AliasLog);
-    data.fAliasProxyOnly = !!(mData->mAliasMode & NATAliasMode_AliasProxyOnly);
-    data.fAliasUseSamePorts = !!(mData->mAliasMode & NATAliasMode_AliasUseSamePorts);
+    data.fAliasLog = !!(mData->m->mAliasMode & NATAliasMode_AliasLog);
+    data.fAliasProxyOnly = !!(mData->m->mAliasMode & NATAliasMode_AliasProxyOnly);
+    data.fAliasUseSamePorts = !!(mData->m->mAliasMode & NATAliasMode_AliasUseSamePorts);
 
     for (NATRuleMap::iterator it = mNATRules.begin();
         it != mNATRules.end(); ++it)
@@ -416,261 +435,212 @@ HRESULT NATEngine::saveSettings(settings::NAT &data)
     return rc;
 }
 
-
-STDMETHODIMP
-NATEngine::COMSETTER(Network)(IN_BSTR aNetwork)
+HRESULT NATEngine::setNetwork(const com::Utf8Str &aNetwork)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (Bstr(mData->mNetwork) != aNetwork)
+    if (Bstr(mData->m->mNetwork) != aNetwork)
     {
-        mData.backup();
-        mData->mNetwork = aNetwork;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mNetwork = aNetwork;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::COMGETTER(Network)(BSTR *aNetwork)
-{
-    CheckComArgNotNull(aNetwork);
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
 
+HRESULT NATEngine::getNetwork(com::Utf8Str &aNetwork)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (!mData->mNetwork.isEmpty())
+    if (!mData->m->mNetwork.isEmpty())
     {
-        mData->mNetwork.cloneTo(aNetwork);
-        Log(("Getter (this:%p) Network: %s\n", this, mData->mNetwork.c_str()));
+        aNetwork = mData->m->mNetwork;
+        Log(("Getter (this:%p) Network: %s\n", this, mData->m->mNetwork.c_str()));
     }
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::COMSETTER(HostIP)(IN_BSTR aBindIP)
+HRESULT NATEngine::setHostIP(const com::Utf8Str &aHostIP)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (Bstr(mData->mBindIP) != aBindIP)
+    if (Bstr(mData->m->mBindIP) != aHostIP)
     {
-        mData.backup();
-        mData->mBindIP = aBindIP;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mBindIP = aHostIP;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
-STDMETHODIMP NATEngine::COMGETTER(HostIP)(BSTR *aBindIP)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
 
+HRESULT NATEngine::getHostIP(com::Utf8Str &aBindIP)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (!mData->mBindIP.isEmpty())
-        mData->mBindIP.cloneTo(aBindIP);
+
+    if (!mData->m->mBindIP.isEmpty())
+        aBindIP = mData->m->mBindIP;
     return S_OK;
 }
 
-
-STDMETHODIMP
-NATEngine::COMSETTER(TFTPPrefix)(IN_BSTR aTFTPPrefix)
+HRESULT NATEngine::setTFTPPrefix(const com::Utf8Str &aTFTPPrefix)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (Bstr(mData->mTFTPPrefix) != aTFTPPrefix)
+    if (Bstr(mData->m->mTFTPPrefix) != aTFTPPrefix)
     {
-        mData.backup();
-        mData->mTFTPPrefix = aTFTPPrefix;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mTFTPPrefix = aTFTPPrefix;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::COMGETTER(TFTPPrefix)(BSTR *aTFTPPrefix)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
 
+HRESULT NATEngine::getTFTPPrefix(com::Utf8Str &aTFTPPrefix)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (!mData->mTFTPPrefix.isEmpty())
+
+    if (!mData->m->mTFTPPrefix.isEmpty())
     {
-        mData->mTFTPPrefix.cloneTo(aTFTPPrefix);
-        Log(("Getter (this:%p) TFTPPrefix: %s\n", this, mData->mTFTPPrefix.c_str()));
+        aTFTPPrefix = mData->m->mTFTPPrefix;
+        Log(("Getter (this:%p) TFTPPrefix: %s\n", this, mData->m->mTFTPPrefix.c_str()));
     }
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::COMSETTER(TFTPBootFile)(IN_BSTR aTFTPBootFile)
+HRESULT NATEngine::setTFTPBootFile(const com::Utf8Str &aTFTPBootFile)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (Bstr(mData->mTFTPBootFile) != aTFTPBootFile)
+    if (Bstr(mData->m->mTFTPBootFile) != aTFTPBootFile)
     {
-        mData.backup();
-        mData->mTFTPBootFile = aTFTPBootFile;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mTFTPBootFile = aTFTPBootFile;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::COMGETTER(TFTPBootFile)(BSTR *aTFTPBootFile)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
 
+HRESULT NATEngine::getTFTPBootFile(com::Utf8Str &aTFTPBootFile)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (!mData->mTFTPBootFile.isEmpty())
+    if (!mData->m->mTFTPBootFile.isEmpty())
     {
-        mData->mTFTPBootFile.cloneTo(aTFTPBootFile);
-        Log(("Getter (this:%p) BootFile: %s\n", this, mData->mTFTPBootFile.c_str()));
+        aTFTPBootFile = mData->m->mTFTPBootFile;
+        Log(("Getter (this:%p) BootFile: %s\n", this, mData->m->mTFTPBootFile.c_str()));
     }
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::COMSETTER(TFTPNextServer)(IN_BSTR aTFTPNextServer)
+
+HRESULT NATEngine::setTFTPNextServer(const com::Utf8Str &aTFTPNextServer)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (Bstr(mData->mTFTPNextServer) != aTFTPNextServer)
+    if (Bstr(mData->m->mTFTPNextServer) != aTFTPNextServer)
     {
-        mData.backup();
-        mData->mTFTPNextServer = aTFTPNextServer;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mTFTPNextServer = aTFTPNextServer;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
 
-STDMETHODIMP
-NATEngine::COMGETTER(TFTPNextServer)(BSTR *aTFTPNextServer)
+HRESULT NATEngine::getTFTPNextServer(com::Utf8Str &aTFTPNextServer)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    if (!mData->mTFTPNextServer.isEmpty())
+    if (!mData->m->mTFTPNextServer.isEmpty())
     {
-        mData->mTFTPNextServer.cloneTo(aTFTPNextServer);
-        Log(("Getter (this:%p) NextServer: %s\n", this, mData->mTFTPNextServer.c_str()));
+        aTFTPNextServer =  mData->m->mTFTPNextServer;
+        Log(("Getter (this:%p) NextServer: %s\n", this, mData->m->mTFTPNextServer.c_str()));
     }
     return S_OK;
 }
+
 /* DNS */
-STDMETHODIMP
-NATEngine::COMSETTER(DNSPassDomain) (BOOL aDNSPassDomain)
+HRESULT NATEngine::setDNSPassDomain(BOOL aDNSPassDomain)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (mData->mDNSPassDomain != aDNSPassDomain)
+    if (mData->m->mDNSPassDomain != aDNSPassDomain)
     {
-        mData.backup();
-        mData->mDNSPassDomain = aDNSPassDomain;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mDNSPassDomain = aDNSPassDomain;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
-STDMETHODIMP
-NATEngine::COMGETTER(DNSPassDomain)(BOOL *aDNSPassDomain)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
 
+HRESULT NATEngine::getDNSPassDomain(BOOL *aDNSPassDomain)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    *aDNSPassDomain = mData->mDNSPassDomain;
+    *aDNSPassDomain = mData->m->mDNSPassDomain;
     return S_OK;
 }
-STDMETHODIMP
-NATEngine::COMSETTER(DNSProxy)(BOOL aDNSProxy)
+
+
+HRESULT NATEngine::setDNSProxy(BOOL aDNSProxy)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (mData->mDNSProxy != aDNSProxy)
+    if (mData->m->mDNSProxy != aDNSProxy)
     {
-        mData.backup();
-        mData->mDNSProxy = aDNSProxy;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mDNSProxy = aDNSProxy;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
-STDMETHODIMP
-NATEngine::COMGETTER(DNSProxy)(BOOL *aDNSProxy)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
 
+HRESULT NATEngine::getDNSProxy(BOOL *aDNSProxy)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    *aDNSProxy = mData->mDNSProxy;
+    *aDNSProxy = mData->m->mDNSProxy;
     return S_OK;
 }
-STDMETHODIMP
-NATEngine::COMGETTER(DNSUseHostResolver)(BOOL *aDNSUseHostResolver)
+
+
+HRESULT NATEngine::getDNSUseHostResolver(BOOL *aDNSUseHostResolver)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    *aDNSUseHostResolver = mData->mDNSUseHostResolver;
+    *aDNSUseHostResolver = mData->m->mDNSUseHostResolver;
     return S_OK;
 }
-STDMETHODIMP
-NATEngine::COMSETTER(DNSUseHostResolver)(BOOL aDNSUseHostResolver)
-{
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
 
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (mData->mDNSUseHostResolver != aDNSUseHostResolver)
+HRESULT NATEngine::setDNSUseHostResolver(BOOL aDNSUseHostResolver)
+{
+    if (mData->m->mDNSUseHostResolver != aDNSUseHostResolver)
     {
-        mData.backup();
-        mData->mDNSUseHostResolver = aDNSUseHostResolver;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mDNSUseHostResolver = aDNSUseHostResolver;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
 
-STDMETHODIMP NATEngine::COMSETTER(AliasMode)(ULONG aAliasMode)
+HRESULT NATEngine::setAliasMode(ULONG aAliasMode)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (mData->mAliasMode != aAliasMode)
+    if (mData->m->mAliasMode != aAliasMode)
     {
-        mData.backup();
-        mData->mAliasMode = aAliasMode;
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mData->m.backup();
+        mData->m->mAliasMode = aAliasMode;
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         m_fModified = true;
     }
     return S_OK;
 }
 
-STDMETHODIMP NATEngine::COMGETTER(AliasMode)(ULONG *aAliasMode)
+HRESULT NATEngine::getAliasMode(ULONG *aAliasMode)
 {
-    AutoCaller autoCaller(this);
-    AssertComRCReturnRC(autoCaller.rc());
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    *aAliasMode = mData->mAliasMode;
+    *aAliasMode = mData->m->mAliasMode;
     return S_OK;
 }
 
diff --git a/src/VBox/Main/src-server/NATNetworkImpl.cpp b/src/VBox/Main/src-server/NATNetworkImpl.cpp
index 1ca6e65..7fad744 100644
--- a/src/VBox/Main/src-server/NATNetworkImpl.cpp
+++ b/src/VBox/Main/src-server/NATNetworkImpl.cpp
@@ -31,7 +31,6 @@
 #include <VBox/settings.h>
 
 #include "EventImpl.h"
-#include "VBoxEvents.h"
 
 #include "VirtualBoxImpl.h"
 #include <algorithm>
@@ -46,7 +45,6 @@
 
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
-
 struct NATNetwork::Data
 {
     Data()
@@ -72,20 +70,20 @@ struct NATNetwork::Data
     NATNetworkServiceRunner NATRunner;
     ComObjPtr<IDHCPServer> dhcpServer;
 #endif
-    Bstr IPv4Gateway;
-    Bstr IPv4NetworkCidr;
-    Bstr IPv4NetworkMask;
-    Bstr IPv4DhcpServer;
-    Bstr IPv4DhcpServerLowerIp;
-    Bstr IPv4DhcpServerUpperIp;
+    com::Utf8Str IPv4Gateway;
+    com::Utf8Str IPv4NetworkCidr;
+    com::Utf8Str IPv4NetworkMask;
+    com::Utf8Str IPv4DhcpServer;
+    com::Utf8Str IPv4DhcpServerLowerIp;
+    com::Utf8Str IPv4DhcpServerUpperIp;
     BOOL fEnabled;
     BOOL fIPv6Enabled;
-    Bstr IPv6Prefix;
+    com::Utf8Str IPv6Prefix;
     BOOL fAdvertiseDefaultIPv6Route;
     BOOL fNeedDhcpServer;
     NATRuleMap mapName2PortForwardRule4;
     NATRuleMap mapName2PortForwardRule6;
-    settings::NATLoopbackOffsetList llNATLoopbackOffsetList;
+    settings::NATLoopbackOffsetList maNATLoopbackOffsetList;
     uint32_t u32LoopbackIp6;
     uint32_t offGateway;
     uint32_t offDhcp;
@@ -111,7 +109,7 @@ HRESULT NATNetwork::FinalConstruct()
 
 void NATNetwork::FinalRelease()
 {
-    uninit ();
+    uninit();
 
     BaseFinalRelease();
 }
@@ -128,10 +126,9 @@ void NATNetwork::uninit()
     unconst(mVirtualBox) = NULL;
 }
 
-
-HRESULT NATNetwork::init(VirtualBox *aVirtualBox, IN_BSTR aName)
+HRESULT NATNetwork::init(VirtualBox *aVirtualBox, com::Utf8Str aName)
 {
-    AssertReturn(aName != NULL, E_INVALIDARG);
+    AssertReturn(!aName.isEmpty(), E_INVALIDARG);
 
     AutoInitSpan autoInitSpan(this);
     AssertReturn(autoInitSpan.isOk(), E_FAIL);
@@ -147,9 +144,9 @@ HRESULT NATNetwork::init(VirtualBox *aVirtualBox, IN_BSTR aName)
     settings::NATHostLoopbackOffset off;
     off.strLoopbackHostAddress = "127.0.0.1";
     off.u32Offset = (uint32_t)2;
-    m->llNATLoopbackOffsetList.push_back(off);
+    m->maNATLoopbackOffsetList.push_back(off);
 
-    recalculateIpv4AddressAssignments();
+    i_recalculateIpv4AddressAssignments();
 
     HRESULT hrc = unconst(m->pEventSource).createObject();
     if (FAILED(hrc)) throw hrc;
@@ -184,11 +181,11 @@ HRESULT NATNetwork::init(VirtualBox *aVirtualBox,
 
     m->u32LoopbackIp6 = data.u32HostLoopback6Offset;
 
-    m->llNATLoopbackOffsetList.clear();
-    m->llNATLoopbackOffsetList.assign(data.llHostLoopbackOffsetList.begin(),
+    m->maNATLoopbackOffsetList.clear();
+    m->maNATLoopbackOffsetList.assign(data.llHostLoopbackOffsetList.begin(),
                                data.llHostLoopbackOffsetList.end());
 
-    recalculateIpv4AddressAssignments();
+    i_recalculateIpv4AddressAssignments();
 
     /* IPv4 port-forward rules */
     m->mapName2PortForwardRule4.clear();
@@ -217,8 +214,7 @@ HRESULT NATNetwork::init(VirtualBox *aVirtualBox,
     return S_OK;
 }
 
-
-HRESULT NATNetwork::saveSettings(settings::NATNetwork &data)
+HRESULT NATNetwork::i_saveSettings(settings::NATNetwork &data)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -248,151 +244,97 @@ HRESULT NATNetwork::saveSettings(settings::NATNetwork &data)
     data.u32HostLoopback6Offset = m->u32LoopbackIp6;
 
     data.llHostLoopbackOffsetList.clear();
-    data.llHostLoopbackOffsetList.assign(m->llNATLoopbackOffsetList.begin(),
-                                         m->llNATLoopbackOffsetList.end());
+    data.llHostLoopbackOffsetList.assign(m->maNATLoopbackOffsetList.begin(),
+                                         m->maNATLoopbackOffsetList.end());
 
-    mVirtualBox->onNATNetworkSetting(mName.raw(),
-                                     data.fEnabled ? TRUE : FALSE,
-                                     m->IPv4NetworkCidr.raw(),
-                                     m->IPv4Gateway.raw(),
-                                     data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE,
-                                     data.fNeedDhcpServer ? TRUE : FALSE);
+    mVirtualBox->i_onNATNetworkSetting(Bstr(mName).raw(),
+                                       data.fEnabled ? TRUE : FALSE,
+                                       Bstr(m->IPv4NetworkCidr).raw(),
+                                       Bstr(m->IPv4Gateway).raw(),
+                                       data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE,
+                                       data.fNeedDhcpServer ? TRUE : FALSE);
 
     /* Notify listerners listening on this network only */
     fireNATNetworkSettingEvent(m->pEventSource,
-                                     mName.raw(),
-                                     data.fEnabled ? TRUE : FALSE,
-                                     m->IPv4NetworkCidr.raw(),
-                                     m->IPv4Gateway.raw(),
-                                     data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE,
-                                     data.fNeedDhcpServer ? TRUE : FALSE);
+                               Bstr(mName).raw(),
+                               data.fEnabled ? TRUE : FALSE,
+                               Bstr(m->IPv4NetworkCidr).raw(),
+                               Bstr(m->IPv4Gateway).raw(),
+                               data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE,
+                               data.fNeedDhcpServer ? TRUE : FALSE);
 
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMGETTER(EventSource)(IEventSource ** aEventSource)
+HRESULT NATNetwork::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* event source is const, no need to lock */
-    m->pEventSource.queryInterfaceTo(aEventSource);
-
+    m->pEventSource.queryInterfaceTo(aEventSource.asOutParam());
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMGETTER(NetworkName)(BSTR *aName)
+HRESULT NATNetwork::getNetworkName(com::Utf8Str &aNetworkName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    mName.cloneTo(aName);
-
+    aNetworkName = mName;
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMSETTER(NetworkName)(IN_BSTR aName)
+HRESULT NATNetwork::setNetworkName(const com::Utf8Str &aNetworkName)
 {
-    CheckComArgOutPointerValid(aName);
-    AutoCaller autoCaller(this);
-
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-        if (aName == mName)
+        if (aNetworkName == mName)
             return S_OK;
 
-        unconst(mName) = aName;
+        unconst(mName) = aNetworkName;
     }
-
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mVirtualBox->saveSettings();
+    HRESULT rc = mVirtualBox->i_saveSettings();
     ComAssertComRCRetRC(rc);
 
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMGETTER(Enabled)(BOOL *aEnabled)
+HRESULT NATNetwork::getEnabled(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aEnabled = m->fEnabled;
-    recalculateIpv4AddressAssignments();
 
+    i_recalculateIpv4AddressAssignments();
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMSETTER(Enabled)(BOOL aEnabled)
+HRESULT NATNetwork::setEnabled(const BOOL aEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
         if (aEnabled == m->fEnabled)
             return S_OK;
-
         m->fEnabled = aEnabled;
     }
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mVirtualBox->saveSettings();
+    HRESULT rc = mVirtualBox->i_saveSettings();
     ComAssertComRCRetRC(rc);
-
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMGETTER(Gateway)(BSTR *aIPv4Gateway)
+HRESULT NATNetwork::getGateway(com::Utf8Str &aIPv4Gateway)
 {
-    CheckComArgOutPointerValid(aIPv4Gateway);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    m->IPv4Gateway.cloneTo(aIPv4Gateway);
-
+    aIPv4Gateway = m->IPv4Gateway;
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMGETTER(Network)(BSTR *aIPv4NetworkCidr)
+HRESULT NATNetwork::getNetwork(com::Utf8Str &aNetwork)
 {
-    CheckComArgOutPointerValid(aIPv4NetworkCidr);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-    m->IPv4NetworkCidr.cloneTo(aIPv4NetworkCidr);
+    aNetwork = m->IPv4NetworkCidr;
     return S_OK;
 }
 
 
-STDMETHODIMP NATNetwork::COMSETTER(Network)(IN_BSTR aIPv4NetworkCidr)
+HRESULT NATNetwork::setNetwork(const com::Utf8Str &aIPv4NetworkCidr)
 {
-    CheckComArgOutPointerValid(aIPv4NetworkCidr);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
+
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
         if (aIPv4NetworkCidr == m->IPv4NetworkCidr)
@@ -405,37 +347,28 @@ STDMETHODIMP NATNetwork::COMSETTER(Network)(IN_BSTR aIPv4NetworkCidr)
         if (!m->mapName2PortForwardRule4.empty())
             return S_OK;
 
-        unconst(m->IPv4NetworkCidr) = Bstr(aIPv4NetworkCidr);
-        recalculateIpv4AddressAssignments();
+
+        unconst(m->IPv4NetworkCidr) = aIPv4NetworkCidr;
+        i_recalculateIpv4AddressAssignments();
     }
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mVirtualBox->saveSettings();
+    HRESULT rc = mVirtualBox->i_saveSettings();
     ComAssertComRCRetRC(rc);
-
     return S_OK;
 }
 
 
-STDMETHODIMP NATNetwork::COMGETTER(IPv6Enabled)(BOOL *aIPv6Enabled)
+HRESULT NATNetwork::getIPv6Enabled(BOOL *aIPv6Enabled)
 {
-    CheckComArgOutPointerValid(aIPv6Enabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aIPv6Enabled = m->fIPv6Enabled;
 
     return S_OK;
 }
 
 
-STDMETHODIMP NATNetwork::COMSETTER(IPv6Enabled)(BOOL aIPv6Enabled)
+HRESULT NATNetwork::setIPv6Enabled(const BOOL aIPv6Enabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -446,35 +379,23 @@ STDMETHODIMP NATNetwork::COMSETTER(IPv6Enabled)(BOOL aIPv6Enabled)
     }
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mVirtualBox->saveSettings();
+    HRESULT rc = mVirtualBox->i_saveSettings();
     ComAssertComRCRetRC(rc);
 
     return S_OK;
 }
 
 
-STDMETHODIMP NATNetwork::COMGETTER(IPv6Prefix) (BSTR *aIPv6Prefix)
+HRESULT NATNetwork::getIPv6Prefix(com::Utf8Str &aIPv6Prefix)
 {
-    CheckComArgOutPointerValid(aIPv6Prefix);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->IPv6Prefix.cloneTo(aIPv6Prefix);
-
+    aIPv6Prefix = m->IPv6Prefix;
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMSETTER(IPv6Prefix) (IN_BSTR aIPv6Prefix)
+HRESULT NATNetwork::setIPv6Prefix(const com::Utf8Str &aIPv6Prefix)
 {
-    CheckComArgOutPointerValid(aIPv6Prefix);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -491,32 +412,23 @@ STDMETHODIMP NATNetwork::COMSETTER(IPv6Prefix) (IN_BSTR aIPv6Prefix)
     }
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mVirtualBox->saveSettings();
+    HRESULT rc = mVirtualBox->i_saveSettings();
     ComAssertComRCRetRC(rc);
 
     return S_OK;
 }
 
 
-STDMETHODIMP NATNetwork::COMGETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL *aAdvertiseDefaultIPv6Route)
+HRESULT NATNetwork::getAdvertiseDefaultIPv6RouteEnabled(BOOL *aAdvertiseDefaultIPv6Route)
 {
-    CheckComArgOutPointerValid(aAdvertiseDefaultIPv6Route);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aAdvertiseDefaultIPv6Route = m->fAdvertiseDefaultIPv6Route;
 
     return S_OK;
 }
 
 
-STDMETHODIMP NATNetwork::COMSETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL aAdvertiseDefaultIPv6Route)
+HRESULT NATNetwork::setAdvertiseDefaultIPv6RouteEnabled(const BOOL aAdvertiseDefaultIPv6Route)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -528,32 +440,22 @@ STDMETHODIMP NATNetwork::COMSETTER(AdvertiseDefaultIPv6RouteEnabled)(BOOL aAdver
     }
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mVirtualBox->saveSettings();
+    HRESULT rc = mVirtualBox->i_saveSettings();
     ComAssertComRCRetRC(rc);
 
     return S_OK;
 }
 
 
-STDMETHODIMP NATNetwork::COMGETTER(NeedDhcpServer)(BOOL *aNeedDhcpServer)
+HRESULT NATNetwork::getNeedDhcpServer(BOOL *aNeedDhcpServer)
 {
-    CheckComArgOutPointerValid(aNeedDhcpServer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aNeedDhcpServer = m->fNeedDhcpServer;
 
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMSETTER(NeedDhcpServer)(BOOL aNeedDhcpServer)
+HRESULT NATNetwork::setNeedDhcpServer(const BOOL aNeedDhcpServer)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -562,52 +464,36 @@ STDMETHODIMP NATNetwork::COMSETTER(NeedDhcpServer)(BOOL aNeedDhcpServer)
 
         m->fNeedDhcpServer = aNeedDhcpServer;
 
-        recalculateIpv4AddressAssignments();
+        i_recalculateIpv4AddressAssignments();
 
     }
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mVirtualBox->saveSettings();
+    HRESULT rc = mVirtualBox->i_saveSettings();
     ComAssertComRCRetRC(rc);
 
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::COMGETTER(LocalMappings)(ComSafeArrayOut(BSTR, aLocalMappings))
+HRESULT NATNetwork::getLocalMappings(std::vector<com::Utf8Str> &aLocalMappings)
 {
-    CheckComArgOutSafeArrayPointerValid(aLocalMappings);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<BSTR> sf(m->llNATLoopbackOffsetList.size());
-
+    aLocalMappings.resize(m->maNATLoopbackOffsetList.size());
     size_t i = 0;
-    settings::NATLoopbackOffsetList::const_iterator it;
-
-    for (it = m->llNATLoopbackOffsetList.begin();
-         it != m->llNATLoopbackOffsetList.end(); ++it, ++i)
-      {
-          BstrFmt bstr("%s=%d",
-                       (*it).strLoopbackHostAddress.c_str(),
-                       (*it).u32Offset);
-        bstr.detachTo(&sf[i]);
+    for (settings::NATLoopbackOffsetList::const_iterator it = m->maNATLoopbackOffsetList.begin();
+         it != m->maNATLoopbackOffsetList.end(); ++it, ++i)
+    {
+        aLocalMappings[i] = Utf8StrFmt("%s=%d",
+                            (*it).strLoopbackHostAddress.c_str(),
+                            (*it).u32Offset);
     }
-    sf.detachTo(ComSafeArrayOutArg(aLocalMappings));
 
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::AddLocalMapping(IN_BSTR aHostId, LONG aOffset)
+HRESULT NATNetwork::addLocalMapping(const com::Utf8Str &aHostId, LONG aOffset)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    //AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     RTNETADDRIPV4 addr, net, mask;
 
     int rc = RTNetStrToIPv4Addr(Utf8Str(aHostId).c_str(), &addr);
@@ -628,52 +514,49 @@ STDMETHODIMP NATNetwork::AddLocalMapping(IN_BSTR aHostId, LONG aOffset)
 
     settings::NATLoopbackOffsetList::iterator it;
 
-    it = std::find(m->llNATLoopbackOffsetList.begin(),
-                   m->llNATLoopbackOffsetList.end(),
-                   Utf8Str(aHostId).c_str());
-
-    if (it != m->llNATLoopbackOffsetList.end())
+    it = std::find(m->maNATLoopbackOffsetList.begin(),
+                   m->maNATLoopbackOffsetList.end(),
+                   aHostId);
+    if (it != m->maNATLoopbackOffsetList.end())
     {
         if (aOffset == 0) /* erase */
-            m->llNATLoopbackOffsetList.erase(it, it);
+            m->maNATLoopbackOffsetList.erase(it, it);
         else /* modify */
         {
             settings::NATLoopbackOffsetList::iterator it1;
-            it1 = std::find(m->llNATLoopbackOffsetList.begin(),
-                           m->llNATLoopbackOffsetList.end(),
+            it1 = std::find(m->maNATLoopbackOffsetList.begin(),
+                           m->maNATLoopbackOffsetList.end(),
                            (uint32_t)aOffset);
-            if (it1 != m->llNATLoopbackOffsetList.end())
+            if (it1 != m->maNATLoopbackOffsetList.end())
                 return E_INVALIDARG; /* this offset is already registered. */
 
             (*it).u32Offset = aOffset;
         }
 
         AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-        return mVirtualBox->saveSettings();
+        return mVirtualBox->i_saveSettings();
     }
 
     /* injection */
-    it = std::find(m->llNATLoopbackOffsetList.begin(),
-                   m->llNATLoopbackOffsetList.end(),
+    it = std::find(m->maNATLoopbackOffsetList.begin(),
+                   m->maNATLoopbackOffsetList.end(),
                    (uint32_t)aOffset);
 
-    if (it != m->llNATLoopbackOffsetList.end())
+    if (it != m->maNATLoopbackOffsetList.end())
         return E_INVALIDARG; /* offset is already registered. */
 
     settings::NATHostLoopbackOffset off;
     off.strLoopbackHostAddress = aHostId;
     off.u32Offset = (uint32_t)aOffset;
-    m->llNATLoopbackOffsetList.push_back(off);
+    m->maNATLoopbackOffsetList.push_back(off);
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    return mVirtualBox->saveSettings();
+    return mVirtualBox->i_saveSettings();
 }
 
 
-STDMETHODIMP NATNetwork::COMGETTER(LoopbackIp6)(LONG *aLoopbackIp6)
+HRESULT NATNetwork::getLoopbackIp6(LONG *aLoopbackIp6)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aLoopbackIp6 = m->u32LoopbackIp6;
@@ -681,12 +564,8 @@ STDMETHODIMP NATNetwork::COMGETTER(LoopbackIp6)(LONG *aLoopbackIp6)
 }
 
 
-STDMETHODIMP NATNetwork::COMSETTER(LoopbackIp6)(LONG aLoopbackIp6)
+HRESULT NATNetwork::setLoopbackIp6(LONG aLoopbackIp6)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -700,49 +579,34 @@ STDMETHODIMP NATNetwork::COMSETTER(LoopbackIp6)(LONG aLoopbackIp6)
     }
 
     AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-    return mVirtualBox->saveSettings();
+    return mVirtualBox->i_saveSettings();
 }
 
 
-STDMETHODIMP NATNetwork::COMGETTER(PortForwardRules4)(ComSafeArrayOut(BSTR, aPortForwardRules4))
+HRESULT NATNetwork::getPortForwardRules4(std::vector<com::Utf8Str> &aPortForwardRules4)
 {
-    CheckComArgOutSafeArrayPointerValid(aPortForwardRules4);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    GetPortForwardRulesFromMap(ComSafeArrayInArg(aPortForwardRules4),
-                               m->mapName2PortForwardRule4);
+    i_getPortForwardRulesFromMap(aPortForwardRules4,
+                                 m->mapName2PortForwardRule4);
     return S_OK;
 }
 
-STDMETHODIMP NATNetwork::COMGETTER(PortForwardRules6)(ComSafeArrayOut(BSTR,
-                                                                      aPortForwardRules6))
+HRESULT NATNetwork::getPortForwardRules6(std::vector<com::Utf8Str> &aPortForwardRules6)
 {
-    CheckComArgOutSafeArrayPointerValid(aPortForwardRules6);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    GetPortForwardRulesFromMap(ComSafeArrayInArg(aPortForwardRules6), m->mapName2PortForwardRule6);
+    i_getPortForwardRulesFromMap(aPortForwardRules6,
+                                 m->mapName2PortForwardRule6);
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::AddPortForwardRule(BOOL aIsIpv6,
-                                            IN_BSTR aPortForwardRuleName,
-                                            NATProtocol_T aProto,
-                                            IN_BSTR aHostIp,
-                                            USHORT aHostPort,
-                                            IN_BSTR aGuestIp,
-                                            USHORT aGuestPort)
+HRESULT NATNetwork::addPortForwardRule(BOOL aIsIpv6,
+                                       const com::Utf8Str &aPortForwardRuleName,
+                                       NATProtocol_T aProto,
+                                       const com::Utf8Str &aHostIp,
+                                       USHORT aHostPort,
+                                       const com::Utf8Str &aGuestIp,
+                                       USHORT aGuestPort)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
         Utf8Str name = aPortForwardRuleName;
@@ -762,18 +626,16 @@ STDMETHODIMP NATNetwork::AddPortForwardRule(BOOL aIsIpv6,
         }
         if (name.isEmpty())
             name = Utf8StrFmt("%s_[%s]%%%d_[%s]%%%d", proto.c_str(),
-                              Utf8Str(aHostIp).c_str(), aHostPort,
-                              Utf8Str(aGuestIp).c_str(), aGuestPort);
-
-        NATRuleMap::iterator it;
+                              aHostIp.c_str(), aHostPort,
+                              aGuestIp.c_str(), aGuestPort);
 
-        for (it = mapRules.begin(); it != mapRules.end(); ++it)
+        for (NATRuleMap::iterator it = mapRules.begin(); it != mapRules.end(); ++it)
         {
             r = it->second;
             if (it->first == name)
                 return setError(E_INVALIDARG,
                                 tr("A NAT rule of this name already exists"));
-            if (   r.strHostIP == Utf8Str(aHostIp)
+            if (   r.strHostIP == aHostIp
                    && r.u16HostPort == aHostPort
                    && r.proto == aProto)
                 return setError(E_INVALIDARG,
@@ -788,45 +650,37 @@ STDMETHODIMP NATNetwork::AddPortForwardRule(BOOL aIsIpv6,
         r.u16GuestPort = aGuestPort;
         mapRules.insert(std::make_pair(name, r));
     }
-
     {
         AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-        HRESULT rc = mVirtualBox->saveSettings();
+        HRESULT rc = mVirtualBox->i_saveSettings();
         ComAssertComRCRetRC(rc);
     }
 
-    mVirtualBox->onNATNetworkPortForward(mName.raw(), TRUE, aIsIpv6,
-                                         aPortForwardRuleName, aProto,
-                                         aHostIp, aHostPort,
-                                         aGuestIp, aGuestPort);
+    mVirtualBox->i_onNATNetworkPortForward(Bstr(mName).raw(), TRUE, aIsIpv6,
+                                           Bstr(aPortForwardRuleName).raw(), aProto,
+                                           Bstr(aHostIp).raw(), aHostPort,
+                                           Bstr(aGuestIp).raw(), aGuestPort);
 
     /* Notify listerners listening on this network only */
-    fireNATNetworkPortForwardEvent(m->pEventSource, mName.raw(), TRUE,
-                                   aIsIpv6, aPortForwardRuleName, aProto,
-                                   aHostIp, aHostPort,
-                                   aGuestIp, aGuestPort);
+    fireNATNetworkPortForwardEvent(m->pEventSource, Bstr(mName).raw(), TRUE,
+                                   aIsIpv6, Bstr(aPortForwardRuleName).raw(), aProto,
+                                   Bstr(aHostIp).raw(), aHostPort,
+                                   Bstr(aGuestIp).raw(), aGuestPort);
+
     return S_OK;
 }
 
-
-STDMETHODIMP NATNetwork::RemovePortForwardRule(BOOL aIsIpv6, IN_BSTR aPortForwardRuleName)
+HRESULT NATNetwork::removePortForwardRule(BOOL aIsIpv6, const com::Utf8Str &aPortForwardRuleName)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc()))
-        return autoCaller.rc();
-
     Utf8Str strHostIP;
     Utf8Str strGuestIP;
     uint16_t u16HostPort;
     uint16_t u16GuestPort;
     NATProtocol_T proto;
 
-
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        NATRuleMap& mapRules = aIsIpv6 ? m->mapName2PortForwardRule6
-          : m->mapName2PortForwardRule4;
-
+        NATRuleMap& mapRules = aIsIpv6 ? m->mapName2PortForwardRule6 : m->mapName2PortForwardRule4;
         NATRuleMap::iterator it = mapRules.find(aPortForwardRuleName);
 
         if (it == mapRules.end())
@@ -843,30 +697,27 @@ STDMETHODIMP NATNetwork::RemovePortForwardRule(BOOL aIsIpv6, IN_BSTR aPortForwar
 
     {
         AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
-        HRESULT rc = mVirtualBox->saveSettings();
+        HRESULT rc = mVirtualBox->i_saveSettings();
         ComAssertComRCRetRC(rc);
     }
 
-    mVirtualBox->onNATNetworkPortForward(mName.raw(), FALSE, aIsIpv6,
-                                         aPortForwardRuleName, proto,
-                                         Bstr(strHostIP).raw(), u16HostPort,
-                                         Bstr(strGuestIP).raw(), u16GuestPort);
+    mVirtualBox->i_onNATNetworkPortForward(Bstr(mName).raw(), FALSE, aIsIpv6,
+                                           Bstr(aPortForwardRuleName).raw(), proto,
+                                           Bstr(strHostIP).raw(), u16HostPort,
+                                           Bstr(strGuestIP).raw(), u16GuestPort);
 
     /* Notify listerners listening on this network only */
-    fireNATNetworkPortForwardEvent(m->pEventSource, mName.raw(), FALSE,
-                                   aIsIpv6, aPortForwardRuleName, proto,
+    fireNATNetworkPortForwardEvent(m->pEventSource, Bstr(mName).raw(), FALSE,
+                                   aIsIpv6, Bstr(aPortForwardRuleName).raw(), proto,
                                    Bstr(strHostIP).raw(), u16HostPort,
                                    Bstr(strGuestIP).raw(), u16GuestPort);
     return S_OK;
 }
 
 
-STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType)
+HRESULT  NATNetwork::start(const com::Utf8Str &aTrunkType)
 {
 #ifdef VBOX_WITH_NAT_SERVICE
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     if (!m->fEnabled) return S_OK;
 
     m->NATRunner.setOption(NetworkServiceRunner::kNsrKeyNetwork, Utf8Str(mName).c_str());
@@ -892,13 +743,13 @@ STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType)
          * 5. call setConfiguration() and pass all required parameters
          * 6. start dhcp server.
          */
-        HRESULT hrc = mVirtualBox->FindDHCPServerByNetworkName(mName.raw(),
-                                                      m->dhcpServer.asOutParam());
+        HRESULT hrc = mVirtualBox->FindDHCPServerByNetworkName(Bstr(mName).raw(),
+                                                               m->dhcpServer.asOutParam());
         switch (hrc)
         {
             case E_INVALIDARG:
                 /* server haven't beeen found let create it then */
-                hrc = mVirtualBox->CreateDHCPServer(mName.raw(),
+                hrc = mVirtualBox->CreateDHCPServer(Bstr(mName).raw(),
                                                    m->dhcpServer.asOutParam());
                 if (FAILED(hrc))
                   return E_FAIL;
@@ -906,10 +757,10 @@ STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType)
 
             {
                 LogFunc(("gateway: %s, dhcpserver:%s, dhcplowerip:%s, dhcpupperip:%s\n",
-                         Utf8Str(m->IPv4Gateway.raw()).c_str(),
-                         Utf8Str(m->IPv4DhcpServer.raw()).c_str(),
-                         Utf8Str(m->IPv4DhcpServerLowerIp.raw()).c_str(),
-                         Utf8Str(m->IPv4DhcpServerUpperIp.raw()).c_str()));
+                         m->IPv4Gateway.c_str(),
+                         m->IPv4DhcpServer.c_str(),
+                         m->IPv4DhcpServerLowerIp.c_str(),
+                         m->IPv4DhcpServerUpperIp.c_str()));
 
                 hrc = m->dhcpServer->COMSETTER(Enabled)(true);
 
@@ -935,9 +786,9 @@ STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType)
         }
 
         /* XXX: AddGlobalOption(DhcpOpt_Router,) - enables attachement of DhcpServer to Main. */
-        m->dhcpServer->AddGlobalOption(DhcpOpt_Router, m->IPv4Gateway.raw());
+        m->dhcpServer->AddGlobalOption(DhcpOpt_Router, Bstr(m->IPv4Gateway).raw());
 
-        hrc = m->dhcpServer->Start(mName.raw(), Bstr("").raw(), aTrunkType);
+        hrc = m->dhcpServer->Start(Bstr(mName).raw(), Bstr("").raw(), Bstr(aTrunkType).raw());
         if (FAILED(hrc))
         {
             m->dhcpServer.setNull();
@@ -947,7 +798,7 @@ STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType)
 
     if (RT_SUCCESS(m->NATRunner.start(false /* KillProcOnStop */)))
     {
-        mVirtualBox->onNATNetworkStartStop(mName.raw(), TRUE);
+        mVirtualBox->i_onNATNetworkStartStop(Bstr(mName).raw(), TRUE);
         return S_OK;
     }
     /** @todo missing setError()! */
@@ -958,11 +809,10 @@ STDMETHODIMP NATNetwork::Start(IN_BSTR aTrunkType)
 #endif
 }
 
-
-STDMETHODIMP NATNetwork::Stop()
+HRESULT NATNetwork::stop()
 {
 #ifdef VBOX_WITH_NAT_SERVICE
-    mVirtualBox->onNATNetworkStartStop(mName.raw(), FALSE);
+    mVirtualBox->i_onNATNetworkStartStop(Bstr(mName).raw(), FALSE);
 
     if (!m->dhcpServer.isNull())
         m->dhcpServer->Stop();
@@ -978,45 +828,40 @@ STDMETHODIMP NATNetwork::Stop()
 }
 
 
-void NATNetwork::GetPortForwardRulesFromMap(ComSafeArrayOut(BSTR, aPortForwardRules), NATRuleMap& aRules)
+void NATNetwork::i_getPortForwardRulesFromMap(std::vector<com::Utf8Str> &aPortForwardRules, NATRuleMap& aRules)
 {
-    com::SafeArray<BSTR> sf(aRules.size());
+    aPortForwardRules.resize(aRules.size());
     size_t i = 0;
-    NATRuleMap::const_iterator it;
-    for (it = aRules.begin();
+    for (NATRuleMap::const_iterator it = aRules.begin();
          it != aRules.end(); ++it, ++i)
       {
         settings::NATRule r = it->second;
-        BstrFmt bstr("%s:%s:[%s]:%d:[%s]:%d",
-                     r.strName.c_str(),
-                     (r.proto == NATProtocol_TCP? "tcp" : "udp"),
-                     r.strHostIP.c_str(),
-                     r.u16HostPort,
-                     r.strGuestIP.c_str(),
-                     r.u16GuestPort);
-        bstr.detachTo(&sf[i]);
+        aPortForwardRules[i] =  Utf8StrFmt("%s:%s:[%s]:%d:[%s]:%d",
+                                           r.strName.c_str(),
+                                           (r.proto == NATProtocol_TCP? "tcp" : "udp"),
+                                           r.strHostIP.c_str(),
+                                           r.u16HostPort,
+                                           r.strGuestIP.c_str(),
+                                           r.u16GuestPort);
     }
-    sf.detachTo(ComSafeArrayOutArg(aPortForwardRules));
 }
 
 
-int NATNetwork::findFirstAvailableOffset(ADDRESSLOOKUPTYPE addrType, uint32_t *poff)
+int NATNetwork::i_findFirstAvailableOffset(ADDRESSLOOKUPTYPE addrType, uint32_t *poff)
 {
     RTNETADDRIPV4 network, netmask;
 
-    int rc = RTCidrStrToIPv4(Utf8Str(m->IPv4NetworkCidr.raw()).c_str(),
+    int rc = RTCidrStrToIPv4(m->IPv4NetworkCidr.c_str(),
                              &network,
                              &netmask);
     AssertRCReturn(rc, rc);
 
     uint32_t off;
-    settings::NATLoopbackOffsetList::iterator it;
     for (off = 1; off < ~netmask.u; ++off)
     {
-
         bool skip = false;
-        for (it = m->llNATLoopbackOffsetList.begin();
-             it != m->llNATLoopbackOffsetList.end();
+        for (settings::NATLoopbackOffsetList::iterator it = m->maNATLoopbackOffsetList.begin();
+             it != m->maNATLoopbackOffsetList.end();
              ++it)
         {
             if ((*it).u32Offset == off)
@@ -1056,18 +901,17 @@ int NATNetwork::findFirstAvailableOffset(ADDRESSLOOKUPTYPE addrType, uint32_t *p
     return VINF_SUCCESS;
 }
 
-
-int NATNetwork::recalculateIpv4AddressAssignments()
+int NATNetwork::i_recalculateIpv4AddressAssignments()
 {
     RTNETADDRIPV4 network, netmask;
-    int rc = RTCidrStrToIPv4(Utf8Str(m->IPv4NetworkCidr.raw()).c_str(),
+    int rc = RTCidrStrToIPv4(m->IPv4NetworkCidr.c_str(),
                              &network,
                              &netmask);
     AssertRCReturn(rc, rc);
 
-    findFirstAvailableOffset(ADDR_GATEWAY, &m->offGateway);
+    i_findFirstAvailableOffset(ADDR_GATEWAY, &m->offGateway);
     if (m->fNeedDhcpServer)
-        findFirstAvailableOffset(ADDR_DHCP, &m->offDhcp);
+        i_findFirstAvailableOffset(ADDR_DHCP, &m->offDhcp);
 
     /* I don't remember the reason CIDR calculated on the host. */
     RTNETADDRIPV4 gateway = network;
@@ -1085,7 +929,7 @@ int NATNetwork::recalculateIpv4AddressAssignments()
         /* XXX: adding more services should change the math here */
         RTNETADDRIPV4 dhcplowerip = network;
         uint32_t offDhcpLowerIp;
-        findFirstAvailableOffset(ADDR_DHCPLOWERIP, &offDhcpLowerIp);
+        i_findFirstAvailableOffset(ADDR_DHCPLOWERIP, &offDhcpLowerIp);
         dhcplowerip.u = RT_H2N_U32(dhcplowerip.u + offDhcpLowerIp);
 
         RTNETADDRIPV4 dhcpupperip;
diff --git a/src/VBox/Main/src-server/NetworkAdapterImpl.cpp b/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
index e3908bb..9ff1c55 100644
--- a/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
+++ b/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -47,7 +47,6 @@ NetworkAdapter::~NetworkAdapter()
 
 HRESULT NetworkAdapter::FinalConstruct()
 {
-
     return BaseFinalConstruct();
 }
 
@@ -70,7 +69,7 @@ HRESULT NetworkAdapter::init(Machine *aParent, ULONG aSlot)
     LogFlowThisFunc(("aParent=%p, aSlot=%d\n", aParent, aSlot));
 
     ComAssertRet(aParent, E_INVALIDARG);
-    uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(aParent->getChipsetType());
+    uint32_t maxNetworkAdapters = Global::getMaxNetworkAdapters(aParent->i_getChipsetType());
     ComAssertRet(aSlot < maxNetworkAdapters, E_INVALIDARG);
 
     /* Enclose the state transition NotReady->InInit->Ready */
@@ -95,7 +94,7 @@ HRESULT NetworkAdapter::init(Machine *aParent, ULONG aSlot)
     /* generate the MAC address early to guarantee it is the same both after
      * changing some other property (i.e. after mData.backup()) and after the
      * subsequent mData.rollback(). */
-    generateMACAddress();
+    i_generateMACAddress();
 
     /* Confirm a successful initialization */
     autoInitSpan.setSucceeded();
@@ -212,16 +211,10 @@ void NetworkAdapter::uninit()
     unconst(mParent) = NULL;
 }
 
-// INetworkAdapter properties
+// wrapped INetworkAdapter properties
 ////////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP NetworkAdapter::COMGETTER(AdapterType)(NetworkAdapterType_T *aAdapterType)
+HRESULT NetworkAdapter::getAdapterType(NetworkAdapterType_T *aAdapterType)
 {
-    CheckComArgOutPointerValid(aAdapterType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aAdapterType = mData->mAdapterType;
@@ -229,11 +222,8 @@ STDMETHODIMP NetworkAdapter::COMGETTER(AdapterType)(NetworkAdapterType_T *aAdapt
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(AdapterType)(NetworkAdapterType_T aAdapterType)
+HRESULT NetworkAdapter::setAdapterType(NetworkAdapterType_T aAdapterType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
@@ -270,24 +260,20 @@ STDMETHODIMP NetworkAdapter::COMSETTER(AdapterType)(NetworkAdapterType_T aAdapte
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* Changing the network adapter type during runtime is not allowed,
          * therefore no immediate change in CFGM logic => changeAdapter=FALSE. */
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(Slot)(ULONG *aSlot)
-{
-    CheckComArgOutPointerValid(aSlot);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT NetworkAdapter::getSlot(ULONG *aSlot)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aSlot = mData->mSlot;
@@ -295,13 +281,8 @@ STDMETHODIMP NetworkAdapter::COMGETTER(Slot)(ULONG *aSlot)
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(Enabled)(BOOL *aEnabled)
+HRESULT NetworkAdapter::getEnabled(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aEnabled = mData->mEnabled;
@@ -309,11 +290,8 @@ STDMETHODIMP NetworkAdapter::COMGETTER(Enabled)(BOOL *aEnabled)
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(Enabled)(BOOL aEnabled)
+HRESULT NetworkAdapter::setEnabled(BOOL aEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
@@ -330,34 +308,29 @@ STDMETHODIMP NetworkAdapter::COMSETTER(Enabled)(BOOL aEnabled)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* Disabling the network adapter during runtime is not allowed
          * therefore no immediate change in CFGM logic => changeAdapter=FALSE. */
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(MACAddress)(BSTR *aMACAddress)
+HRESULT NetworkAdapter::getMACAddress(com::Utf8Str &aMACAddress)
 {
-    CheckComArgOutPointerValid(aMACAddress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComAssertRet(!mData->mMACAddress.isEmpty(), E_FAIL);
 
-    mData->mMACAddress.cloneTo(aMACAddress);
+    aMACAddress = mData->mMACAddress;
 
     return S_OK;
 }
 
-HRESULT NetworkAdapter::updateMacAddress(Utf8Str aMACAddress)
+HRESULT NetworkAdapter::i_updateMacAddress(Utf8Str aMACAddress)
 {
     HRESULT rc = S_OK;
 
@@ -365,7 +338,7 @@ HRESULT NetworkAdapter::updateMacAddress(Utf8Str aMACAddress)
      * Are we supposed to generate a MAC?
      */
     if (aMACAddress.isEmpty())
-        generateMACAddress();
+        i_generateMACAddress();
     else
     {
         if (mData->mMACAddress != aMACAddress)
@@ -408,45 +381,37 @@ HRESULT NetworkAdapter::updateMacAddress(Utf8Str aMACAddress)
     return rc;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(MACAddress)(IN_BSTR aMACAddress)
+HRESULT NetworkAdapter::setMACAddress(const com::Utf8Str &aMACAddress)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     mData.backup();
 
-    HRESULT rc = updateMacAddress(aMACAddress);
+    HRESULT rc = i_updateMacAddress(aMACAddress);
     if (SUCCEEDED(rc))
     {
         m_fModified = true;
         // leave the lock before informing callbacks
         alock.release();
 
+
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* Changing the MAC via the Main API during runtime is not allowed,
          * therefore no immediate change in CFGM logic => changeAdapter=FALSE. */
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     return rc;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(AttachmentType)(NetworkAttachmentType_T *aAttachmentType)
+HRESULT NetworkAdapter::getAttachmentType(NetworkAttachmentType_T *aAttachmentType)
 {
-    CheckComArgOutPointerValid(aAttachmentType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aAttachmentType = mData->mAttachmentType;
@@ -454,13 +419,10 @@ STDMETHODIMP NetworkAdapter::COMGETTER(AttachmentType)(NetworkAttachmentType_T *
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(AttachmentType)(NetworkAttachmentType_T aAttachmentType)
+HRESULT NetworkAdapter::setAttachmentType(NetworkAttachmentType_T aAttachmentType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -491,47 +453,35 @@ STDMETHODIMP NetworkAdapter::COMSETTER(AttachmentType)(NetworkAttachmentType_T a
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         if (oldAttachmentType == NetworkAttachmentType_NATNetwork)
-            checkAndSwitchFromNatNetworking(mData->mNATNetwork.raw());
+            i_checkAndSwitchFromNatNetworking(mData->mNATNetwork);
 
         if (aAttachmentType == NetworkAttachmentType_NATNetwork)
-            switchToNatNetworking(mData->mNATNetwork.raw());
+            i_switchToNatNetworking(mData->mNATNetwork);
 
         /* Adapt the CFGM logic and notify the guest => changeAdapter=TRUE. */
-        mParent->onNetworkAdapterChange(this, TRUE);
+        mParent->i_onNetworkAdapterChange(this, TRUE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(BridgedInterface)(BSTR *aBridgedInterface)
+HRESULT NetworkAdapter::getBridgedInterface(com::Utf8Str &aBridgedInterface)
 {
-    CheckComArgOutPointerValid(aBridgedInterface);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mBridgedInterface.cloneTo(aBridgedInterface);
+    aBridgedInterface = mData->mBridgedInterface;
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(BridgedInterface)(IN_BSTR aBridgedInterface)
+HRESULT NetworkAdapter::setBridgedInterface(const com::Utf8Str &aBridgedInterface)
 {
-    Bstr bstrEmpty("");
-    if (!aBridgedInterface)
-        aBridgedInterface = bstrEmpty.raw();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -540,7 +490,7 @@ STDMETHODIMP NetworkAdapter::COMSETTER(BridgedInterface)(IN_BSTR aBridgedInterfa
     {
         /* if an empty/null string is to be set, bridged interface must be
          * turned off */
-        if (   (aBridgedInterface == NULL || *aBridgedInterface == '\0')
+        if (aBridgedInterface.isEmpty()
             && mData->mAttachmentType == NetworkAttachmentType_Bridged)
         {
             return setError(E_FAIL,
@@ -555,43 +505,31 @@ STDMETHODIMP NetworkAdapter::COMSETTER(BridgedInterface)(IN_BSTR aBridgedInterfa
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* When changing the host adapter, adapt the CFGM logic to make this
          * change immediately effect and to notify the guest that the network
          * might have changed, therefore changeAdapter=TRUE. */
-        mParent->onNetworkAdapterChange(this, TRUE);
+        mParent->i_onNetworkAdapterChange(this, TRUE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(HostOnlyInterface)(BSTR *aHostOnlyInterface)
+HRESULT NetworkAdapter::getHostOnlyInterface(com::Utf8Str &aHostOnlyInterface)
 {
-    CheckComArgOutPointerValid(aHostOnlyInterface);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mHostOnlyInterface.cloneTo(aHostOnlyInterface);
+    aHostOnlyInterface = mData->mHostOnlyInterface;
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(HostOnlyInterface)(IN_BSTR aHostOnlyInterface)
+HRESULT NetworkAdapter::setHostOnlyInterface(const com::Utf8Str &aHostOnlyInterface)
 {
-    Bstr bstrEmpty("");
-    if (!aHostOnlyInterface)
-        aHostOnlyInterface = bstrEmpty.raw();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -600,8 +538,8 @@ STDMETHODIMP NetworkAdapter::COMSETTER(HostOnlyInterface)(IN_BSTR aHostOnlyInter
     {
         /* if an empty/null string is to be set, host only interface must be
          * turned off */
-        if (   (aHostOnlyInterface == NULL || *aHostOnlyInterface == '\0')
-            && mData->mAttachmentType == NetworkAttachmentType_HostOnly)
+        if ( aHostOnlyInterface.isEmpty()
+             && mData->mAttachmentType == NetworkAttachmentType_HostOnly)
         {
             return setError(E_FAIL,
                             tr("Empty or null host only interface name is not valid"));
@@ -611,43 +549,37 @@ STDMETHODIMP NetworkAdapter::COMSETTER(HostOnlyInterface)(IN_BSTR aHostOnlyInter
         mData->mHostOnlyInterface = aHostOnlyInterface;
 
         m_fModified = true;
+
         // leave the lock before informing callbacks
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* When changing the host adapter, adapt the CFGM logic to make this
          * change immediately effect and to notify the guest that the network
          * might have changed, therefore changeAdapter=TRUE. */
-        mParent->onNetworkAdapterChange(this, TRUE);
+        mParent->i_onNetworkAdapterChange(this, TRUE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(InternalNetwork)(BSTR *aInternalNetwork)
-{
-    CheckComArgOutPointerValid(aInternalNetwork);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT NetworkAdapter::getInternalNetwork(com::Utf8Str &aInternalNetwork)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mInternalNetwork.cloneTo(aInternalNetwork);
+    aInternalNetwork = mData->mInternalNetwork;
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(InternalNetwork)(IN_BSTR aInternalNetwork)
+HRESULT NetworkAdapter::setInternalNetwork(const com::Utf8Str &aInternalNetwork)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -656,13 +588,11 @@ STDMETHODIMP NetworkAdapter::COMSETTER(InternalNetwork)(IN_BSTR aInternalNetwork
     {
         /* if an empty/null string is to be set, internal networking must be
          * turned off */
-        if (   (aInternalNetwork == NULL || *aInternalNetwork == '\0')
-            && mData->mAttachmentType == NetworkAttachmentType_Internal)
+        if (aInternalNetwork.isEmpty() && mData->mAttachmentType == NetworkAttachmentType_Internal)
         {
             return setError(E_FAIL,
                             tr("Empty or null internal network name is not valid"));
         }
-
         mData.backup();
         mData->mInternalNetwork = aInternalNetwork;
 
@@ -671,58 +601,44 @@ STDMETHODIMP NetworkAdapter::COMSETTER(InternalNetwork)(IN_BSTR aInternalNetwork
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* When changing the internal network, adapt the CFGM logic to make this
          * change immediately effect and to notify the guest that the network
          * might have changed, therefore changeAdapter=TRUE. */
-        mParent->onNetworkAdapterChange(this, TRUE);
+        mParent->i_onNetworkAdapterChange(this, TRUE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(NATNetwork)(BSTR *aNATNetwork)
+HRESULT NetworkAdapter::getNATNetwork(com::Utf8Str &aNATNetwork)
 {
-    CheckComArgOutPointerValid(aNATNetwork);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mNATNetwork.cloneTo(aNATNetwork);
+    aNATNetwork = mData->mNATNetwork;
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(NATNetwork)(IN_BSTR aNATNetwork)
-{
-    Bstr bstrEmpty("");
-    if (!aNATNetwork)
-        aNATNetwork = bstrEmpty.raw();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT NetworkAdapter::setNATNetwork(const com::Utf8Str &aNATNetwork)
+{
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mData->mNATNetwork != aNATNetwork)
     {
-
         /* if an empty/null string is to be set, host only interface must be
          * turned off */
-        if (   (aNATNetwork == NULL || *aNATNetwork == '\0')
+        if (aNATNetwork.isEmpty()
             && mData->mAttachmentType == NetworkAttachmentType_NATNetwork)
-        {
             return setError(E_FAIL,
                             tr("Empty or null NAT network name is not valid"));
-        }
 
         mData.backup();
 
@@ -734,47 +650,33 @@ STDMETHODIMP NetworkAdapter::COMSETTER(NATNetwork)(IN_BSTR aNATNetwork)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
+        i_checkAndSwitchFromNatNetworking(oldNatNetworkName.raw());
 
-        checkAndSwitchFromNatNetworking(oldNatNetworkName.raw());
-
-        switchToNatNetworking(aNATNetwork);
-
+        i_switchToNatNetworking(aNATNetwork);
         /* When changing the host adapter, adapt the CFGM logic to make this
          * change immediately effect and to notify the guest that the network
          * might have changed, therefore changeAdapter=TRUE. */
-        mParent->onNetworkAdapterChange(this, TRUE);
+        mParent->i_onNetworkAdapterChange(this, TRUE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(GenericDriver)(BSTR *aGenericDriver)
+HRESULT NetworkAdapter::getGenericDriver(com::Utf8Str &aGenericDriver)
 {
-    CheckComArgOutPointerValid(aGenericDriver);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mGenericDriver.cloneTo(aGenericDriver);
+    aGenericDriver = mData->mGenericDriver;
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(GenericDriver)(IN_BSTR aGenericDriver)
+HRESULT NetworkAdapter::setGenericDriver(const com::Utf8Str &aGenericDriver)
 {
-    Bstr bstrEmpty("");
-    if (!aGenericDriver)
-        aGenericDriver = bstrEmpty.raw();
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -787,19 +689,15 @@ STDMETHODIMP NetworkAdapter::COMSETTER(GenericDriver)(IN_BSTR aGenericDriver)
         /* leave the lock before informing callbacks */
         alock.release();
 
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(CableConnected)(BOOL *aConnected)
-{
-    CheckComArgOutPointerValid(aConnected);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT NetworkAdapter::getCableConnected(BOOL *aConnected)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aConnected = mData->mCableConnected;
@@ -807,13 +705,11 @@ STDMETHODIMP NetworkAdapter::COMGETTER(CableConnected)(BOOL *aConnected)
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(CableConnected)(BOOL aConnected)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT NetworkAdapter::setCableConnected(BOOL aConnected)
+{
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -828,23 +724,19 @@ STDMETHODIMP NetworkAdapter::COMSETTER(CableConnected)(BOOL aConnected)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* No change in CFGM logic => changeAdapter=FALSE. */
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(LineSpeed)(ULONG *aSpeed)
-{
-    CheckComArgOutPointerValid(aSpeed);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT NetworkAdapter::getLineSpeed(ULONG *aSpeed)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aSpeed = mData->mLineSpeed;
@@ -852,11 +744,8 @@ STDMETHODIMP NetworkAdapter::COMGETTER(LineSpeed)(ULONG *aSpeed)
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(LineSpeed)(ULONG aSpeed)
+HRESULT NetworkAdapter::setLineSpeed(ULONG aSpeed)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
@@ -873,33 +762,31 @@ STDMETHODIMP NetworkAdapter::COMSETTER(LineSpeed)(ULONG aSpeed)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* No change in CFGM logic => changeAdapter=FALSE. */
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     return S_OK;
 }
 
-
-STDMETHODIMP NetworkAdapter::COMGETTER(PromiscModePolicy)(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy)
+HRESULT NetworkAdapter::getPromiscModePolicy(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy)
 {
-    CheckComArgOutPointerValid(aPromiscModePolicy);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        *aPromiscModePolicy = mData->mPromiscModePolicy;
-    }
-    return hrc;
+    *aPromiscModePolicy = mData->mPromiscModePolicy;
+
+    return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(PromiscModePolicy)(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy)
+HRESULT NetworkAdapter::setPromiscModePolicy(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy)
 {
+    /* the machine needs to be mutable */
+    AutoMutableStateDependency adep(mParent);
+    if (FAILED(adep.rc())) return adep.rc();
+
     switch (aPromiscModePolicy)
     {
         case NetworkAdapterPromiscModePolicy_Deny:
@@ -923,34 +810,29 @@ STDMETHODIMP NetworkAdapter::COMSETTER(PromiscModePolicy)(NetworkAdapterPromiscM
             m_fModified = true;
 
             alock.release();
-            mParent->setModifiedLock(Machine::IsModified_NetworkAdapters);
-            mParent->onNetworkAdapterChange(this, TRUE);
+            mParent->i_setModifiedLock(Machine::IsModified_NetworkAdapters);
+            mParent->i_onNetworkAdapterChange(this, TRUE);
         }
     }
 
     return hrc;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(TraceEnabled)(BOOL *aEnabled)
-{
-    CheckComArgOutPointerValid(aEnabled);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+HRESULT NetworkAdapter::getTraceEnabled(BOOL *aEnabled)
+{
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aEnabled = mData->mTraceEnabled;
+
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(TraceEnabled)(BOOL aEnabled)
+HRESULT NetworkAdapter::setTraceEnabled(BOOL aEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -965,37 +847,30 @@ STDMETHODIMP NetworkAdapter::COMSETTER(TraceEnabled)(BOOL aEnabled)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* Adapt the CFGM logic changeAdapter=TRUE */
-        mParent->onNetworkAdapterChange(this, TRUE);
+        mParent->i_onNetworkAdapterChange(this, TRUE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(TraceFile)(BSTR *aTraceFile)
+HRESULT NetworkAdapter::getTraceFile(com::Utf8Str &aTraceFile)
 {
-    CheckComArgOutPointerValid(aTraceFile);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mTraceFile.cloneTo(aTraceFile);
+    aTraceFile = mData->mTraceFile;
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(TraceFile)(IN_BSTR aTraceFile)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT NetworkAdapter::setTraceFile(const com::Utf8Str &aTraceFile)
+{
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -1010,37 +885,27 @@ STDMETHODIMP NetworkAdapter::COMSETTER(TraceFile)(IN_BSTR aTraceFile)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* No change in CFGM logic => changeAdapter=FALSE. */
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(NATEngine)(INATEngine **aNATEngine)
+HRESULT NetworkAdapter::getNATEngine(ComPtr<INATEngine> &aNATEngine)
 {
-    CheckComArgOutPointerValid(aNATEngine);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mNATEngine.queryInterfaceTo(aNATEngine);
+    aNATEngine  = mNATEngine;
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(BootPriority)(ULONG *aBootPriority)
+HRESULT NetworkAdapter::getBootPriority(ULONG *aBootPriority)
 {
-    CheckComArgOutPointerValid(aBootPriority);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aBootPriority = mData->mBootPriority;
@@ -1048,11 +913,8 @@ STDMETHODIMP NetworkAdapter::COMGETTER(BootPriority)(ULONG *aBootPriority)
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(BootPriority)(ULONG aBootPriority)
+HRESULT NetworkAdapter::setBootPriority(ULONG aBootPriority)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
@@ -1069,125 +931,91 @@ STDMETHODIMP NetworkAdapter::COMSETTER(BootPriority)(ULONG aBootPriority)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, no need to lock
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* No change in CFGM logic => changeAdapter=FALSE. */
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     return S_OK;
 }
 
-// INetworkAdapter methods
+// wrapped INetworkAdapter methods
 ////////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP NetworkAdapter::GetProperty(IN_BSTR aKey, BSTR *aValue)
+HRESULT NetworkAdapter::getProperty(const com::Utf8Str &aKey, com::Utf8Str &aValue)
 {
-    CheckComArgOutPointerValid(aValue);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    Bstr key = aKey;
-    Bstr value;
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    Utf8Str strKey(key);
-    settings::StringsMap::const_iterator it = mData->mGenericProperties.find(strKey);
+    aValue = "";
+    settings::StringsMap::const_iterator it = mData->mGenericProperties.find(aKey);
     if (it != mData->mGenericProperties.end())
-    {
-        value = it->second; // source is a Utf8Str
-        value.cloneTo(aValue);
-    }
+        aValue = it->second; // source is a Utf8Str
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::SetProperty(IN_BSTR aKey, IN_BSTR aValue)
+HRESULT NetworkAdapter::setProperty(const com::Utf8Str &aKey, const com::Utf8Str &aValue)
 {
     LogFlowThisFunc(("\n"));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* The machine needs to be mutable. */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
-
-    Bstr key = aKey;
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     bool fGenericChange = (mData->mAttachmentType == NetworkAttachmentType_Generic);
-
     /* Generic properties processing.
      * Look up the old value first; if nothing's changed then do nothing.
      */
-    Utf8Str strValue(aValue);
-    Utf8Str strKey(aKey);
     Utf8Str strOldValue;
-
-    settings::StringsMap::const_iterator it = mData->mGenericProperties.find(strKey);
+    settings::StringsMap::const_iterator it = mData->mGenericProperties.find(aKey);
     if (it != mData->mGenericProperties.end())
         strOldValue = it->second;
 
-    if (strOldValue != strValue)
+    if (strOldValue != aValue)
     {
-        if (strValue.isEmpty())
-            mData->mGenericProperties.erase(strKey);
+        if (aValue.isEmpty())
+            mData->mGenericProperties.erase(aKey);
         else
-            mData->mGenericProperties[strKey] = strValue;
+            mData->mGenericProperties[aKey] = aValue;
 
         /* leave the lock before informing callbacks */
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* Avoid deadlock when the event triggers a call to a method of this
          * interface. */
         adep.release();
 
-        mParent->onNetworkAdapterChange(this, fGenericChange);
+        mParent->i_onNetworkAdapterChange(this, fGenericChange);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP NetworkAdapter::GetProperties(IN_BSTR aNames,
-                                           ComSafeArrayOut(BSTR, aReturnNames),
-                                           ComSafeArrayOut(BSTR, aReturnValues))
+HRESULT NetworkAdapter::getProperties(const com::Utf8Str &aNames,
+                                      std::vector<com::Utf8Str>  &aReturnNames,
+                                      std::vector<com::Utf8Str>  &aReturnValues)
 {
-    CheckComArgOutSafeArrayPointerValid(aReturnNames);
-    CheckComArgOutSafeArrayPointerValid(aReturnValues);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /// @todo make use of aNames according to the documentation
     NOREF(aNames);
+    aReturnNames.resize(mData->mGenericProperties.size());
+    aReturnValues.resize(mData->mGenericProperties.size());
 
-    com::SafeArray<BSTR> names(mData->mGenericProperties.size());
-    com::SafeArray<BSTR> values(mData->mGenericProperties.size());
     size_t i = 0;
 
     for (settings::StringsMap::const_iterator it = mData->mGenericProperties.begin();
          it != mData->mGenericProperties.end();
-         ++it)
+         ++it, ++i)
     {
-        it->first.cloneTo(&names[i]);
-        it->second.cloneTo(&values[i]);
-        ++i;
+        aReturnNames[i] = it->first;
+        aReturnValues[i] = it->second;
     }
 
-    names.detachTo(ComSafeArrayOutArg(aReturnNames));
-    values.detachTo(ComSafeArrayOutArg(aReturnValues));
-
     return S_OK;
 }
 
@@ -1204,8 +1032,8 @@ STDMETHODIMP NetworkAdapter::GetProperties(IN_BSTR aNames,
  *
  *  @note Locks this object for writing.
  */
-HRESULT NetworkAdapter::loadSettings(BandwidthControl *bwctl,
-                                     const settings::NetworkAdapter &data)
+HRESULT NetworkAdapter::i_loadSettings(BandwidthControl *bwctl,
+                                       const settings::NetworkAdapter &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -1228,7 +1056,7 @@ HRESULT NetworkAdapter::loadSettings(BandwidthControl *bwctl,
     mData->mAdapterType = data.type;
     mData->mEnabled = data.fEnabled;
     /* MAC address (can be null) */
-    rc = updateMacAddress(data.strMACAddress);
+    rc = i_updateMacAddress(data.strMACAddress);
     if (FAILED(rc)) return rc;
     /* cable (required) */
     mData->mCableConnected = data.fCableConnected;
@@ -1245,12 +1073,12 @@ HRESULT NetworkAdapter::loadSettings(BandwidthControl *bwctl,
     if (mData->mBandwidthGroup.isNotEmpty())
     {
         ComObjPtr<BandwidthGroup> group;
-        rc = bwctl->getBandwidthGroupByName(data.strBandwidthGroup, group, true);
+        rc = bwctl->i_getBandwidthGroupByName(data.strBandwidthGroup, group, true);
         if (FAILED(rc)) return rc;
-        group->reference();
+        group->i_reference();
     }
 
-    mNATEngine->loadSettings(data.nat);
+    mNATEngine->i_loadSettings(data.nat);
     mData->mBridgedInterface = data.strBridgedName;
     mData->mInternalNetwork = data.strInternalNetworkName;
     mData->mHostOnlyInterface = data.strHostOnlyName;
@@ -1279,7 +1107,7 @@ HRESULT NetworkAdapter::loadSettings(BandwidthControl *bwctl,
  *
  *  @note Locks this object for reading.
  */
-HRESULT NetworkAdapter::saveSettings(settings::NetworkAdapter &data)
+HRESULT NetworkAdapter::i_saveSettings(settings::NetworkAdapter &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -1305,8 +1133,8 @@ HRESULT NetworkAdapter::saveSettings(settings::NetworkAdapter &data)
 
     data.mode = mData->mAttachmentType;
 
-    mNATEngine->commit();
-    mNATEngine->saveSettings(data.nat);
+    mNATEngine->i_commit();
+    mNATEngine->i_saveSettings(data.nat);
 
     data.strBridgedName = mData->mBridgedInterface;
 
@@ -1329,17 +1157,19 @@ HRESULT NetworkAdapter::saveSettings(settings::NetworkAdapter &data)
  * Returns true if any setter method has modified settings of this instance.
  * @return
  */
-bool NetworkAdapter::isModified() {
+bool NetworkAdapter::i_isModified() {
+
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
     bool fChanged = m_fModified;
-    fChanged |= (mData->mAdapterType == NetworkAttachmentType_NAT? mNATEngine->isModified() : false);
+    fChanged |= (mData->mAdapterType == NetworkAttachmentType_NAT? mNATEngine->i_isModified() : false);
     return fChanged;
 }
 
 /**
  *  @note Locks this object for writing.
  */
-void NetworkAdapter::rollback()
+void NetworkAdapter::i_rollback()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -1354,7 +1184,7 @@ void NetworkAdapter::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void NetworkAdapter::commit()
+void NetworkAdapter::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -1383,7 +1213,7 @@ void NetworkAdapter::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void NetworkAdapter::copyFrom(NetworkAdapter *aThat)
+void NetworkAdapter::i_copyFrom(NetworkAdapter *aThat)
 {
     AssertReturnVoid(aThat != NULL);
 
@@ -1404,7 +1234,7 @@ void NetworkAdapter::copyFrom(NetworkAdapter *aThat)
     mData.assignCopy(aThat->mData);
 }
 
-void NetworkAdapter::applyDefaults(GuestOSType *aOsType)
+void NetworkAdapter::i_applyDefaults(GuestOSType *aOsType)
 {
     AssertReturnVoid(aOsType != NULL);
 
@@ -1419,7 +1249,7 @@ void NetworkAdapter::applyDefaults(GuestOSType *aOsType)
     e1000enabled = true;
 #endif // VBOX_WITH_E1000
 
-    NetworkAdapterType_T defaultType = aOsType->networkAdapterType();
+    NetworkAdapterType_T defaultType = aOsType->i_networkAdapterType();
 
     /* Set default network adapter for this OS type */
     if (defaultType == NetworkAdapterType_I82540EM ||
@@ -1439,7 +1269,7 @@ void NetworkAdapter::applyDefaults(GuestOSType *aOsType)
     }
 }
 
-ComObjPtr<NetworkAdapter> NetworkAdapter::getPeer()
+ComObjPtr<NetworkAdapter> NetworkAdapter::i_getPeer()
 {
     return mPeer;
 }
@@ -1455,86 +1285,82 @@ ComObjPtr<NetworkAdapter> NetworkAdapter::getPeer()
  *  @note Must be called from under the object's write lock or within the init
  *  span.
  */
-void NetworkAdapter::generateMACAddress()
+void NetworkAdapter::i_generateMACAddress()
 {
     Utf8Str mac;
-    Host::generateMACAddress(mac);
+    Host::i_generateMACAddress(mac);
     LogFlowThisFunc(("generated MAC: '%s'\n", mac.c_str()));
     mData->mMACAddress = mac;
 }
 
-STDMETHODIMP NetworkAdapter::COMGETTER(BandwidthGroup)(IBandwidthGroup **aBwGroup)
+HRESULT NetworkAdapter::getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup)
 {
     LogFlowThisFuncEnter();
-    CheckComArgOutPointerValid(aBwGroup);
 
     HRESULT hrc = S_OK;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mData->mBandwidthGroup.isNotEmpty())
     {
         ComObjPtr<BandwidthGroup> pBwGroup;
-        hrc = mParent->getBandwidthGroup(mData->mBandwidthGroup, pBwGroup, true /* fSetError */);
-
-        Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the group was checked when it was attached. */
+        hrc = mParent->i_getBandwidthGroup(mData->mBandwidthGroup, pBwGroup, true /* fSetError */);
 
+        Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence
+                                 * of the group was checked when it was attached. */
         if (SUCCEEDED(hrc))
-            pBwGroup.queryInterfaceTo(aBwGroup);
+            pBwGroup.queryInterfaceTo(aBandwidthGroup.asOutParam());
     }
 
     LogFlowThisFuncLeave();
     return hrc;
 }
 
-STDMETHODIMP NetworkAdapter::COMSETTER(BandwidthGroup)(IBandwidthGroup *aBwGroup)
+HRESULT NetworkAdapter::setBandwidthGroup(const ComPtr<IBandwidthGroup> &aBandwidthGroup)
 {
     LogFlowThisFuncEnter();
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent);
+    AutoMutableOrSavedStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
+    IBandwidthGroup *iBw = aBandwidthGroup;
     Utf8Str strBwGroup;
-    if (aBwGroup)
-        strBwGroup = static_cast<BandwidthGroup*>(aBwGroup)->getName();
+    if (aBandwidthGroup)
+        strBwGroup = static_cast<BandwidthGroup *>(iBw)->i_getName();
+
     if (mData->mBandwidthGroup != strBwGroup)
     {
         ComObjPtr<BandwidthGroup> pBwGroup;
         if (!strBwGroup.isEmpty())
         {
-            HRESULT hrc = mParent->getBandwidthGroup(strBwGroup, pBwGroup, false /* fSetError */);
+            HRESULT hrc = mParent->i_getBandwidthGroup(strBwGroup, pBwGroup, false /* fSetError */);
             NOREF(hrc);
-            Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the group was checked when it was attached. */
+            Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence
+                                       of the group was checked when it was attached. */
         }
 
-        updateBandwidthGroup(pBwGroup);
+        i_updateBandwidthGroup(pBwGroup);
 
         m_fModified = true;
         // leave the lock before informing callbacks
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);
-        mParent->setModified(Machine::IsModified_NetworkAdapters);
+        mParent->i_setModified(Machine::IsModified_NetworkAdapters);
         mlock.release();
 
         /* TODO: changeAdapter=???. */
-        mParent->onNetworkAdapterChange(this, FALSE);
+        mParent->i_onNetworkAdapterChange(this, FALSE);
     }
 
     LogFlowThisFuncLeave();
     return S_OK;
 }
 
-void NetworkAdapter::updateBandwidthGroup(BandwidthGroup *aBwGroup)
+void NetworkAdapter::i_updateBandwidthGroup(BandwidthGroup *aBwGroup)
 {
     LogFlowThisFuncEnter();
     Assert(isWriteLockOnCurrentThread());
@@ -1542,33 +1368,35 @@ void NetworkAdapter::updateBandwidthGroup(BandwidthGroup *aBwGroup)
     ComObjPtr<BandwidthGroup> pOldBwGroup;
     if (!mData->mBandwidthGroup.isEmpty())
         {
-            HRESULT hrc = mParent->getBandwidthGroup(mData->mBandwidthGroup, pOldBwGroup, false /* fSetError */);
+            HRESULT hrc = mParent->i_getBandwidthGroup(mData->mBandwidthGroup, pOldBwGroup, false /* fSetError */);
             NOREF(hrc);
-            Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the group was checked when it was attached. */
+            Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of
+                                       the group was checked when it was attached. */
         }
 
     mData.backup();
     if (!pOldBwGroup.isNull())
     {
-        pOldBwGroup->release();
+        pOldBwGroup->i_release();
         mData->mBandwidthGroup = Utf8Str::Empty;
     }
 
     if (aBwGroup)
     {
-        mData->mBandwidthGroup = aBwGroup->getName();
-        aBwGroup->reference();
+        mData->mBandwidthGroup = aBwGroup->i_getName();
+        aBwGroup->i_reference();
     }
 
     LogFlowThisFuncLeave();
 }
 
 
-HRESULT NetworkAdapter::checkAndSwitchFromNatNetworking(IN_BSTR networkName)
+HRESULT NetworkAdapter::i_checkAndSwitchFromNatNetworking(com::Utf8Str networkName)
 {
+    HRESULT hrc;
     MachineState_T state;
 
-    HRESULT hrc = mParent->COMGETTER(State)(&state);
+    hrc = mParent->COMGETTER(State)(&state);
     if (FAILED(hrc))
         return hrc;
 
@@ -1576,8 +1404,8 @@ HRESULT NetworkAdapter::checkAndSwitchFromNatNetworking(IN_BSTR networkName)
     {
         Bstr bstrName;
         hrc = mParent->COMGETTER(Name)(bstrName.asOutParam());
-        LogRel(("VM '%ls' stops using NAT network '%ls'\n", bstrName.raw(), networkName));
-        int natCount = mParent->getVirtualBox()->natNetworkRefDec(networkName);
+        LogRel(("VM '%ls' stops using NAT network '%s'\n", bstrName.raw(), networkName.c_str()));
+        int natCount = mParent->i_getVirtualBox()->i_natNetworkRefDec(Bstr(networkName).raw());
         if (natCount == -1)
             return E_INVALIDARG; /* no such network */
     }
@@ -1586,11 +1414,12 @@ HRESULT NetworkAdapter::checkAndSwitchFromNatNetworking(IN_BSTR networkName)
 }
 
 
-HRESULT NetworkAdapter::switchToNatNetworking(IN_BSTR aNatNetworkName)
+HRESULT NetworkAdapter::i_switchToNatNetworking(const com::Utf8Str &aNatNetworkName)
 {
+    HRESULT hrc;
     MachineState_T state;
 
-    HRESULT hrc = mParent->COMGETTER(State)(&state);
+    hrc = mParent->COMGETTER(State)(&state);
     if (FAILED(hrc))
         return hrc;
 
@@ -1598,8 +1427,8 @@ HRESULT NetworkAdapter::switchToNatNetworking(IN_BSTR aNatNetworkName)
     {
         Bstr bstrName;
         hrc = mParent->COMGETTER(Name)(bstrName.asOutParam());
-        LogRel(("VM '%ls' starts using NAT network '%ls'\n", bstrName.raw(), aNatNetworkName));
-        int natCount = mParent->getVirtualBox()->natNetworkRefInc(aNatNetworkName);
+        LogRel(("VM '%ls' starts using NAT network '%s'\n", bstrName.raw(), aNatNetworkName.c_str()));
+        int natCount = mParent->i_getVirtualBox()->i_natNetworkRefInc(Bstr(aNatNetworkName).raw());
         if (natCount == -1)
             return E_INVALIDARG; /* not found */
     }
diff --git a/src/VBox/Main/src-server/ParallelPortImpl.cpp b/src/VBox/Main/src-server/ParallelPortImpl.cpp
index e9ce1d0..3b2a1ef 100644
--- a/src/VBox/Main/src-server/ParallelPortImpl.cpp
+++ b/src/VBox/Main/src-server/ParallelPortImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -51,6 +51,7 @@ struct ParallelPort::Data
 
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
+DEFINE_EMPTY_CTOR_DTOR(ParallelPort)
 
 HRESULT ParallelPort::FinalConstruct()
 {
@@ -193,13 +194,8 @@ void ParallelPort::uninit()
 // IParallelPort properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP ParallelPort::COMGETTER(Enabled) (BOOL *aEnabled)
+HRESULT ParallelPort::getEnabled(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aEnabled = m->bd->fEnabled;
@@ -207,13 +203,9 @@ STDMETHODIMP ParallelPort::COMGETTER(Enabled) (BOOL *aEnabled)
     return S_OK;
 }
 
-STDMETHODIMP ParallelPort::COMSETTER(Enabled) (BOOL aEnabled)
+HRESULT ParallelPort::setEnabled(BOOL aEnabled)
 {
     LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled));
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -236,22 +228,17 @@ STDMETHODIMP ParallelPort::COMSETTER(Enabled) (BOOL aEnabled)
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_ParallelPorts);
+        m->pMachine->i_setModified(Machine::IsModified_ParallelPorts);
         mlock.release();
 
-        m->pMachine->onParallelPortChange(this);
+        m->pMachine->i_onParallelPortChange(this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP ParallelPort::COMGETTER(Slot) (ULONG *aSlot)
+HRESULT ParallelPort::getSlot(ULONG *aSlot)
 {
-    CheckComArgOutPointerValid(aSlot);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aSlot = m->bd->ulSlot;
@@ -259,13 +246,8 @@ STDMETHODIMP ParallelPort::COMGETTER(Slot) (ULONG *aSlot)
     return S_OK;
 }
 
-STDMETHODIMP ParallelPort::COMGETTER(IRQ) (ULONG *aIRQ)
+HRESULT ParallelPort::getIRQ(ULONG *aIRQ)
 {
-    CheckComArgOutPointerValid(aIRQ);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aIRQ = m->bd->ulIRQ;
@@ -273,7 +255,7 @@ STDMETHODIMP ParallelPort::COMGETTER(IRQ) (ULONG *aIRQ)
     return S_OK;
 }
 
-STDMETHODIMP ParallelPort::COMSETTER(IRQ)(ULONG aIRQ)
+HRESULT ParallelPort::setIRQ(ULONG aIRQ)
 {
     /* check IRQ limits
      * (when changing this, make sure it corresponds to XML schema */
@@ -282,9 +264,6 @@ STDMETHODIMP ParallelPort::COMSETTER(IRQ)(ULONG aIRQ)
                         tr("Invalid IRQ number of the parallel port %d: %lu (must be in range [0, %lu])"),
                         m->bd->ulSlot, aIRQ, 255);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -301,22 +280,17 @@ STDMETHODIMP ParallelPort::COMSETTER(IRQ)(ULONG aIRQ)
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_ParallelPorts);
+        m->pMachine->i_setModified(Machine::IsModified_ParallelPorts);
         mlock.release();
 
-        m->pMachine->onParallelPortChange(this);
+        m->pMachine->i_onParallelPortChange(this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP ParallelPort::COMGETTER(IOBase) (ULONG *aIOBase)
+HRESULT ParallelPort::getIOBase(ULONG *aIOBase)
 {
-    CheckComArgOutPointerValid(aIOBase);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aIOBase = m->bd->ulIOBase;
@@ -324,7 +298,7 @@ STDMETHODIMP ParallelPort::COMGETTER(IOBase) (ULONG *aIOBase)
     return S_OK;
 }
 
-STDMETHODIMP ParallelPort::COMSETTER(IOBase)(ULONG aIOBase)
+HRESULT ParallelPort::setIOBase(ULONG aIOBase)
 {
     /* check IOBase limits
      * (when changing this, make sure it corresponds to XML schema */
@@ -333,9 +307,6 @@ STDMETHODIMP ParallelPort::COMSETTER(IOBase)(ULONG aIOBase)
                         tr("Invalid I/O port base address of the parallel port %d: %lu (must be in range [0, 0x%X])"),
                         m->bd->ulSlot, aIOBase, 0, 0xFFFF);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -352,58 +323,50 @@ STDMETHODIMP ParallelPort::COMSETTER(IOBase)(ULONG aIOBase)
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_ParallelPorts);
+        m->pMachine->i_setModified(Machine::IsModified_ParallelPorts);
         mlock.release();
 
-        m->pMachine->onParallelPortChange(this);
+        m->pMachine->i_onParallelPortChange(this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP ParallelPort::COMGETTER(Path) (BSTR *aPath)
-{
-    CheckComArgOutPointerValid(aPath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT ParallelPort::getPath(com::Utf8Str &aPath)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    m->bd->strPath.cloneTo(aPath);
-
+    aPath = m->bd->strPath;
     return S_OK;
 }
 
-STDMETHODIMP ParallelPort::COMSETTER(Path) (IN_BSTR aPath)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT ParallelPort::setPath(const com::Utf8Str &aPath)
+{
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pMachine);
+    AutoMutableOrSavedStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Utf8Str str(aPath);
-    if (str != m->bd->strPath)
+    if (aPath != m->bd->strPath)
     {
-        HRESULT rc = checkSetPath(str);
+        HRESULT rc = i_checkSetPath(aPath);
         if (FAILED(rc)) return rc;
 
         m->bd.backup();
-        m->bd->strPath = str;
+        m->bd->strPath = aPath;
 
         m->fModified = true;
+
         // leave the lock before informing callbacks
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_ParallelPorts);
+        m->pMachine->i_setModified(Machine::IsModified_ParallelPorts);
         mlock.release();
 
-        return m->pMachine->onParallelPortChange(this);
+        return m->pMachine->i_onParallelPortChange(this);
     }
 
     return S_OK;
@@ -420,7 +383,7 @@ STDMETHODIMP ParallelPort::COMSETTER(Path) (IN_BSTR aPath)
  *
  *  @note Locks this object for writing.
  */
-HRESULT ParallelPort::loadSettings(const settings::ParallelPort &data)
+HRESULT ParallelPort::i_loadSettings(const settings::ParallelPort &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -438,11 +401,11 @@ HRESULT ParallelPort::loadSettings(const settings::ParallelPort &data)
  *
  *  Note that the given Port node is completely empty on input.
  *
- *  @param aPortNode <Port> node.
+ *  @param  <data> node.
  *
  *  @note Locks this object for reading.
  */
-HRESULT ParallelPort::saveSettings(settings::ParallelPort &data)
+HRESULT ParallelPort::i_saveSettings(settings::ParallelPort &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -459,7 +422,7 @@ HRESULT ParallelPort::saveSettings(settings::ParallelPort &data)
  * Returns true if any setter method has modified settings of this instance.
  * @return
  */
-bool ParallelPort::isModified()
+bool ParallelPort::i_isModified()
 {
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     return m->fModified;
@@ -468,7 +431,7 @@ bool ParallelPort::isModified()
 /**
  *  @note Locks this object for writing.
  */
-void ParallelPort::rollback()
+void ParallelPort::i_rollback()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -483,7 +446,7 @@ void ParallelPort::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void ParallelPort::commit()
+void ParallelPort::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -512,7 +475,7 @@ void ParallelPort::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void ParallelPort::copyFrom(ParallelPort *aThat)
+void ParallelPort::i_copyFrom(ParallelPort *aThat)
 {
     AssertReturnVoid (aThat != NULL);
 
@@ -536,7 +499,7 @@ void ParallelPort::copyFrom(ParallelPort *aThat)
 /**
  *  Validates COMSETTER(Path) arguments.
  */
-HRESULT ParallelPort::checkSetPath(const Utf8Str &str)
+HRESULT ParallelPort::i_checkSetPath(const Utf8Str &str)
 {
     AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
 
diff --git a/src/VBox/Main/src-server/Performance.cpp b/src/VBox/Main/src-server/Performance.cpp
index 41ace84..9b5db6c 100644
--- a/src/VBox/Main/src-server/Performance.cpp
+++ b/src/VBox/Main/src-server/Performance.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2013 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -72,7 +72,8 @@ int CollectorHAL::getRawHostDiskLoad(const char * /* name */, uint64_t * /* disk
     return VERR_NOT_IMPLEMENTED;
 }
 
-int CollectorHAL::getRawProcessCpuLoad(RTPROCESS  /* process */, uint64_t * /* user */, uint64_t * /* kernel */, uint64_t * /* total */)
+int CollectorHAL::getRawProcessCpuLoad(RTPROCESS  /* process */, uint64_t * /* user */,
+                                       uint64_t * /* kernel */, uint64_t * /* total */)
 {
     return VERR_NOT_IMPLEMENTED;
 }
@@ -82,7 +83,8 @@ int CollectorHAL::getHostMemoryUsage(ULONG * /* total */, ULONG * /* used */, UL
     return VERR_NOT_IMPLEMENTED;
 }
 
-int CollectorHAL::getHostFilesystemUsage(const char * /* name */, ULONG * /* total */, ULONG * /* used */, ULONG * /* available */)
+int CollectorHAL::getHostFilesystemUsage(const char * /* name */, ULONG * /* total */, ULONG * /* used */,
+                                         ULONG * /* available */)
 {
     return VERR_NOT_IMPLEMENTED;
 }
@@ -257,7 +259,7 @@ int CollectorGuest::enableVMMStats(bool mCollectVMMStats)
 
         ComPtr<IInternalSessionControl> directControl;
 
-        ret = mMachine->getDirectControl(&directControl);
+        ret = mMachine->i_getDirectControl(&directControl);
         if (ret != S_OK)
             return ret;
 
@@ -299,16 +301,16 @@ HRESULT CollectorGuest::enableInternal(ULONG mask)
         AutoCaller autoCaller(mMachine);
         if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-        mMachineName = mMachine->getName();
+        mMachineName = mMachine->i_getName();
 
         ComPtr<IInternalSessionControl> directControl;
 
-        ret = mMachine->getDirectControl(&directControl);
+        ret = mMachine->i_getDirectControl(&directControl);
         if (ret != S_OK)
             return ret;
 
         /* get the associated console; this is a remote call (!) */
-        ret = directControl->GetRemoteConsole(mConsole.asOutParam());
+        ret = directControl->COMGETTER(RemoteConsole)(mConsole.asOutParam());
         if (ret != S_OK)
             return ret;
 
@@ -456,7 +458,7 @@ void CollectorGuestManager::unregisterGuest(CollectorGuest* pGuest)
         /* Assume that nobody can provide VMM stats */
         mVMMStatsProvider = NULL;
 
-        for (it = mGuests.begin(); it != mGuests.end(); it++)
+        for (it = mGuests.begin(); it != mGuests.end(); ++it)
         {
             /* Skip unregistered as they are about to be destroyed */
             if ((*it)->isUnregistered())
@@ -479,7 +481,7 @@ void CollectorGuestManager::unregisterGuest(CollectorGuest* pGuest)
         if (!mVMMStatsProvider)
         {
             /* If nobody collects stats, take the first registered */
-            for (it = mGuests.begin(); it != mGuests.end(); it++)
+            for (it = mGuests.begin(); it != mGuests.end(); ++it)
             {
                 /* Skip unregistered as they are about to be destroyed */
                 if ((*it)->isUnregistered())
@@ -1100,7 +1102,7 @@ void MachineDiskUsage::collect()
 
         AutoReadLock local_alock(pMedium COMMA_LOCKVAL_SRC_POS);
 
-        used += (ULONG)(pMedium->getSize() / _1M);
+        used += (ULONG)(pMedium->i_getSize() / _1M);
     }
 
     mUsed->put(used);
@@ -1530,7 +1532,7 @@ bool Filter::match(const ComPtr<IUnknown> object, const RTCString &name) const
     ElementList::const_iterator it;
 
     //LogAleksey(("Filter::match(%p, %s)\n", static_cast<const IUnknown*> (object), name.c_str()));
-    for (it = mElements.begin(); it != mElements.end(); it++)
+    for (it = mElements.begin(); it != mElements.end(); ++it)
     {
         //LogAleksey(("...matching against(%p, %s)\n", static_cast<const IUnknown*> ((*it).first), (*it).second.c_str()));
         if ((*it).first.isNull() || (*it).first == object)
diff --git a/src/VBox/Main/src-server/PerformanceImpl.cpp b/src/VBox/Main/src-server/PerformanceImpl.cpp
index 87ad1c4..ed20ab3 100644
--- a/src/VBox/Main/src-server/PerformanceImpl.cpp
+++ b/src/VBox/Main/src-server/PerformanceImpl.cpp
@@ -581,7 +581,8 @@ void PerformanceCollector::registerBaseMetric(pm::BaseMetric *baseMetric)
     if (!SUCCEEDED(autoCaller.rc())) return;
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)baseMetric->getObject(), baseMetric->getName()));
+    LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__,
+                (void *)baseMetric->getObject(), baseMetric->getName()));
     m.baseMetrics.push_back (baseMetric);
     //LogFlowThisFuncLeave();
 }
@@ -593,7 +594,8 @@ void PerformanceCollector::registerMetric(pm::Metric *metric)
     if (!SUCCEEDED(autoCaller.rc())) return;
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)metric->getObject(), metric->getName()));
+    LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__,
+                (void *)metric->getObject(), metric->getName()));
     m.metrics.push_back (metric);
     //LogFlowThisFuncLeave();
 }
@@ -667,7 +669,9 @@ void PerformanceCollector::suspendSampling()
     if (!SUCCEEDED(autoCaller.rc())) return;
 
     int rc = RTTimerLRStop(m.sampler);
-    AssertRC(rc);
+    if (   RT_FAILURE(rc)
+        && rc != VERR_TIMER_SUSPENDED)     /* calling suspendSampling() successively shouldn't assert. See @bugref{3495}. */
+        AssertMsgFailed(("PerformanceCollector::suspendSampling(): RTTimerLRStop returned %Rrc\n", rc));
 }
 
 void PerformanceCollector::resumeSampling()
@@ -676,7 +680,9 @@ void PerformanceCollector::resumeSampling()
     if (!SUCCEEDED(autoCaller.rc())) return;
 
     int rc = RTTimerLRStart(m.sampler, 0);
-    AssertRC(rc);
+    if (   RT_FAILURE(rc)
+        && rc != VERR_TIMER_ACTIVE)     /* calling resumeSampling() successively shouldn't assert. See @bugref{3495}. */
+        AssertMsgFailed(("PerformanceCollector::resumeSampling(): RTTimerLRStart returned %Rrc\n", rc));
 }
 
 
@@ -722,7 +728,7 @@ void PerformanceCollector::samplerCallback(uint64_t iTick)
     BaseMetricList toBeCollected;
     BaseMetricList::iterator it;
     /* Compose the list of metrics being collected at this moment */
-    for (it = m.baseMetrics.begin(); it != m.baseMetrics.end(); it++)
+    for (it = m.baseMetrics.begin(); it != m.baseMetrics.end(); ++it)
         if ((*it)->collectorBeat(timestamp))
         {
             (*it)->preCollect(hints, iTick);
@@ -749,10 +755,13 @@ void PerformanceCollector::samplerCallback(uint64_t iTick)
      * again to see if any base metrics are marked as unregistered.
      * Those should be destroyed now.
      */
-    LogAleksey(("{%p} " LOG_FN_FMT ": before remove_if: toBeCollected.size()=%d\n", this, __PRETTY_FUNCTION__, toBeCollected.size()));
+    LogAleksey(("{%p} " LOG_FN_FMT ": before remove_if: toBeCollected.size()=%d\n", this, __PRETTY_FUNCTION__,
+                toBeCollected.size()));
     toBeCollected.remove_if(std::mem_fun(&pm::BaseMetric::isUnregistered));
-    LogAleksey(("{%p} " LOG_FN_FMT ": after remove_if: toBeCollected.size()=%d\n", this, __PRETTY_FUNCTION__, toBeCollected.size()));
-    LogAleksey(("{%p} " LOG_FN_FMT ": before remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size()));
+    LogAleksey(("{%p} " LOG_FN_FMT ": after remove_if: toBeCollected.size()=%d\n", this, __PRETTY_FUNCTION__,
+                toBeCollected.size()));
+    LogAleksey(("{%p} " LOG_FN_FMT ": before remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__,
+                m.baseMetrics.size()));
     for (it = m.baseMetrics.begin(); it != m.baseMetrics.end();)
         if ((*it)->isUnregistered())
         {
@@ -761,7 +770,8 @@ void PerformanceCollector::samplerCallback(uint64_t iTick)
         }
         else
             ++it;
-    LogAleksey(("{%p} " LOG_FN_FMT ": after remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size()));
+    LogAleksey(("{%p} " LOG_FN_FMT ": after remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__,
+                m.baseMetrics.size()));
     /*
      * Now when we have destroyed all base metrics that could
      * try to pull data from unregistered CollectorGuest objects
diff --git a/src/VBox/Main/src-server/ProgressProxyImpl.cpp b/src/VBox/Main/src-server/ProgressProxyImpl.cpp
index 60750d6..b9dcca5 100644
--- a/src/VBox/Main/src-server/ProgressProxyImpl.cpp
+++ b/src/VBox/Main/src-server/ProgressProxyImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2011 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -82,8 +82,7 @@ HRESULT ProgressProxy::init(
                           1 /* cOperations */,
                           1 /* ulTotalOperationsWeight */,
                           bstrDescription /* bstrFirstOperationDescription */,
-                          1 /* ulFirstOperationWeight */,
-                          NULL /* pId */);
+                          1 /* ulFirstOperationWeight */);
 }
 
 /**
@@ -123,8 +122,7 @@ HRESULT ProgressProxy::init(
                           1 + cOtherProgressObjectOperations /* cOperations */,
                           uTotalOperationsWeight,
                           bstrFirstOperationDescription,
-                          uFirstOperationWeight,
-                          NULL);
+                          uFirstOperationWeight);
 }
 
 void ProgressProxy::FinalRelease()
@@ -157,7 +155,7 @@ HRESULT ProgressProxy::notifyComplete(HRESULT aResultCode)
     clearOtherProgressObjectInternal(true /* fEarly */);
     HRESULT hrc = S_OK;
     if (!mCompleted)
-         hrc = Progress::notifyComplete(aResultCode);
+         hrc = Progress::i_notifyComplete(aResultCode);
     return hrc;
 }
 
@@ -177,7 +175,7 @@ HRESULT ProgressProxy::notifyComplete(HRESULT aResultCode,
     {
         va_list va;
         va_start(va, aText);
-        hrc = Progress::notifyCompleteV(aResultCode, aIID, pcszComponent, aText, va);
+        hrc = Progress::i_notifyCompleteV(aResultCode, aIID, pcszComponent, aText, va);
         va_end(va);
     }
     return hrc;
@@ -375,18 +373,18 @@ void ProgressProxy::copyProgressInfo(IProgress *pOtherProgress, bool fEarly)
 
                         Utf8Str strText(bstrText);
                         LogFlowThisFunc(("Got ErrorInfo(%s); hrcResult=%Rhrc\n", strText.c_str(), hrcResult));
-                        Progress::notifyComplete((HRESULT)hrcResult,
-                                                 Guid(bstrIID).ref(),
-                                                 Utf8Str(bstrComponent).c_str(),
-                                                 "%s", strText.c_str());
+                        Progress::i_notifyComplete((HRESULT)hrcResult,
+                                                   Guid(bstrIID).ref(),
+                                                   Utf8Str(bstrComponent).c_str(),
+                                                   "%s", strText.c_str());
                     }
                     else
                     {
                         LogFlowThisFunc(("ErrorInfo failed with hrc=%Rhrc; hrcResult=%Rhrc\n", hrc, hrcResult));
-                        Progress::notifyComplete((HRESULT)hrcResult,
-                                                 COM_IIDOF(IProgress),
-                                                 "ProgressProxy",
-                                                 tr("No error info"));
+                        Progress::i_notifyComplete((HRESULT)hrcResult,
+                                                   COM_IIDOF(IProgress),
+                                                   "ProgressProxy",
+                                                   tr("No error info"));
                     }
                 }
             }
@@ -466,7 +464,8 @@ STDMETHODIMP ProgressProxy::COMGETTER(Percent)(ULONG *aPercent)
             {
                 double rdPercent = ((double)uPct / 100 * muOtherProgressWeight + muOtherProgressStartWeight)
                                  / m_ulTotalOperationsWeight * 100;
-                *aPercent = RT_MIN((ULONG)rdPercent, 99); /* mptrOtherProgress is cleared when its completed, so we can never return 100%. */
+                *aPercent = RT_MIN((ULONG)rdPercent, 99); /* mptrOtherProgress is cleared when its completed,
+                                                             so we can never return 100%. */
             }
         }
     }
diff --git a/src/VBox/Main/src-server/SerialPortImpl.cpp b/src/VBox/Main/src-server/SerialPortImpl.cpp
index 5bbf4ba..7cdfd60 100644
--- a/src/VBox/Main/src-server/SerialPortImpl.cpp
+++ b/src/VBox/Main/src-server/SerialPortImpl.cpp
@@ -1,10 +1,11 @@
+/* $Id: SerialPortImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -29,27 +30,6 @@
 #include "AutoCaller.h"
 #include "Logging.h"
 
-////////////////////////////////////////////////////////////////////////////////
-//
-// SerialPort private data definition
-//
-////////////////////////////////////////////////////////////////////////////////
-
-struct SerialPort::Data
-{
-    Data()
-        : fModified(false),
-          pMachine(NULL)
-    { }
-
-    bool                                fModified;
-
-    Machine * const                     pMachine;
-    const ComObjPtr<SerialPort>         pPeer;
-
-    Backupable<settings::SerialPort>    bd;
-};
-
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
@@ -196,13 +176,8 @@ void SerialPort::uninit()
 // ISerialPort properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP SerialPort::COMGETTER(Enabled) (BOOL *aEnabled)
+HRESULT SerialPort::getEnabled(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aEnabled = m->bd->fEnabled;
@@ -210,13 +185,11 @@ STDMETHODIMP SerialPort::COMGETTER(Enabled) (BOOL *aEnabled)
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMSETTER(Enabled) (BOOL aEnabled)
+
+HRESULT SerialPort::setEnabled(BOOL aEnabled)
 {
     LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -233,22 +206,18 @@ STDMETHODIMP SerialPort::COMSETTER(Enabled) (BOOL aEnabled)
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_SerialPorts);
+        m->pMachine->i_setModified(Machine::IsModified_SerialPorts);
         mlock.release();
 
-        m->pMachine->onSerialPortChange(this);
+        m->pMachine->i_onSerialPortChange(this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMGETTER(HostMode) (PortMode_T *aHostMode)
-{
-    CheckComArgOutPointerValid(aHostMode);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SerialPort::getHostMode(PortMode_T *aHostMode)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aHostMode = m->bd->portMode;
@@ -256,13 +225,10 @@ STDMETHODIMP SerialPort::COMGETTER(HostMode) (PortMode_T *aHostMode)
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMSETTER(HostMode) (PortMode_T aHostMode)
+HRESULT SerialPort::setHostMode(PortMode_T aHostMode)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pMachine);
+    AutoMutableOrSavedStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -292,6 +258,13 @@ STDMETHODIMP SerialPort::COMSETTER(HostMode) (PortMode_T aHostMode)
                                        "because the device path is empty or null"),
                                     m->bd->ulSlot);
                 break;
+            case PortMode_TCP:
+                if (m->bd->strPath.isEmpty())
+                    return setError(E_INVALIDARG,
+                                    tr("Cannot set the host device mode of the serial port %d "
+                                       "because the server address or TCP port is invalid"),
+                                    m->bd->ulSlot);
+                break;
             case PortMode_Disconnected:
                 break;
         }
@@ -304,22 +277,17 @@ STDMETHODIMP SerialPort::COMSETTER(HostMode) (PortMode_T aHostMode)
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_SerialPorts);
+        m->pMachine->i_setModified(Machine::IsModified_SerialPorts);
         mlock.release();
 
-        m->pMachine->onSerialPortChange(this);
+        m->pMachine->i_onSerialPortChange(this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMGETTER(Slot) (ULONG *aSlot)
+HRESULT SerialPort::getSlot(ULONG *aSlot)
 {
-    CheckComArgOutPointerValid(aSlot);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aSlot = m->bd->ulSlot;
@@ -327,13 +295,9 @@ STDMETHODIMP SerialPort::COMGETTER(Slot) (ULONG *aSlot)
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMGETTER(IRQ) (ULONG *aIRQ)
-{
-    CheckComArgOutPointerValid(aIRQ);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SerialPort::getIRQ(ULONG *aIRQ)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aIRQ = m->bd->ulIRQ;
@@ -341,7 +305,8 @@ STDMETHODIMP SerialPort::COMGETTER(IRQ) (ULONG *aIRQ)
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ)
+
+HRESULT SerialPort::setIRQ(ULONG aIRQ)
 {
     /* check IRQ limits
      * (when changing this, make sure it corresponds to XML schema */
@@ -350,9 +315,6 @@ STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ)
                         tr("Invalid IRQ number of the serial port %d: %lu (must be in range [0, %lu])"),
                         m->bd->ulSlot, aIRQ, 255);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
@@ -369,22 +331,18 @@ STDMETHODIMP SerialPort::COMSETTER(IRQ)(ULONG aIRQ)
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_SerialPorts);
+        m->pMachine->i_setModified(Machine::IsModified_SerialPorts);
         mlock.release();
 
-        m->pMachine->onSerialPortChange(this);
+        m->pMachine->i_onSerialPortChange(this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMGETTER(IOBase) (ULONG *aIOBase)
-{
-    CheckComArgOutPointerValid(aIOBase);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SerialPort::getIOBase(ULONG *aIOBase)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aIOBase = m->bd->ulIOBase;
@@ -392,7 +350,7 @@ STDMETHODIMP SerialPort::COMGETTER(IOBase) (ULONG *aIOBase)
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMSETTER(IOBase)(ULONG aIOBase)
+HRESULT SerialPort::setIOBase(ULONG aIOBase)
 {
     /* check IOBase limits
      * (when changing this, make sure it corresponds to XML schema */
@@ -422,74 +380,57 @@ STDMETHODIMP SerialPort::COMSETTER(IOBase)(ULONG aIOBase)
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_SerialPorts);
+        m->pMachine->i_setModified(Machine::IsModified_SerialPorts);
         mlock.release();
 
-        m->pMachine->onSerialPortChange(this);
+        m->pMachine->i_onSerialPortChange(this);
     }
 
     return rc;
 }
 
-STDMETHODIMP SerialPort::COMGETTER(Path) (BSTR *aPath)
+HRESULT SerialPort::getPath(com::Utf8Str &aPath)
 {
-    CheckComArgOutPointerValid(aPath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->bd->strPath.cloneTo(aPath);
+    aPath = m->bd->strPath;
 
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMSETTER(Path) (IN_BSTR aPath)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SerialPort::setPath(const com::Utf8Str &aPath)
+{
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pMachine);
+    AutoMutableOrSavedStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    /* we treat empty as null when e.g. saving to XML, do the same here */
-    if (aPath && *aPath == '\0')
-        aPath = NULL;
-
-    Utf8Str str(aPath);
-    if (str != m->bd->strPath)
+    if (aPath != m->bd->strPath)
     {
-        HRESULT rc = checkSetPath(str);
+        HRESULT rc = i_checkSetPath(aPath);
         if (FAILED(rc)) return rc;
 
         m->bd.backup();
-        m->bd->strPath = str;
+        m->bd->strPath = aPath;
 
         m->fModified = true;
         // leave the lock before informing callbacks
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_SerialPorts);
+        m->pMachine->i_setModified(Machine::IsModified_SerialPorts);
         mlock.release();
 
-        m->pMachine->onSerialPortChange(this);
+        m->pMachine->i_onSerialPortChange(this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMGETTER(Server) (BOOL *aServer)
+HRESULT SerialPort::getServer(BOOL *aServer)
 {
-    CheckComArgOutPointerValid(aServer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aServer = m->bd->fServer;
@@ -497,13 +438,10 @@ STDMETHODIMP SerialPort::COMGETTER(Server) (BOOL *aServer)
     return S_OK;
 }
 
-STDMETHODIMP SerialPort::COMSETTER(Server) (BOOL aServer)
+HRESULT SerialPort::setServer(BOOL aServer)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pMachine);
+    AutoMutableOrSavedStateDependency adep(m->pMachine);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -518,10 +456,10 @@ STDMETHODIMP SerialPort::COMSETTER(Server) (BOOL aServer)
         alock.release();
 
         AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-        m->pMachine->setModified(Machine::IsModified_SerialPorts);
+        m->pMachine->i_setModified(Machine::IsModified_SerialPorts);
         mlock.release();
 
-        m->pMachine->onSerialPortChange(this);
+        m->pMachine->i_onSerialPortChange(this);
     }
 
     return S_OK;
@@ -538,8 +476,9 @@ STDMETHODIMP SerialPort::COMSETTER(Server) (BOOL aServer)
  *
  *  @note Locks this object for writing.
  */
-HRESULT SerialPort::loadSettings(const settings::SerialPort &data)
+HRESULT SerialPort::i_loadSettings(const settings::SerialPort &data)
 {
+
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
 
@@ -560,7 +499,7 @@ HRESULT SerialPort::loadSettings(const settings::SerialPort &data)
  *
  *  @note Locks this object for reading.
  */
-HRESULT SerialPort::saveSettings(settings::SerialPort &data)
+HRESULT SerialPort::i_saveSettings(settings::SerialPort &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -577,7 +516,7 @@ HRESULT SerialPort::saveSettings(settings::SerialPort &data)
  * Returns true if any setter method has modified settings of this instance.
  * @return
  */
-bool SerialPort::isModified()
+bool SerialPort::i_isModified()
 {
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     return m->fModified;
@@ -586,7 +525,7 @@ bool SerialPort::isModified()
 /**
  *  @note Locks this object for writing.
  */
-void SerialPort::rollback()
+void SerialPort::i_rollback()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -601,7 +540,7 @@ void SerialPort::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void SerialPort::commit()
+void SerialPort::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -630,7 +569,7 @@ void SerialPort::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void SerialPort::copyFrom (SerialPort *aThat)
+void SerialPort::i_copyFrom (SerialPort *aThat)
 {
     AssertReturnVoid (aThat != NULL);
 
@@ -651,7 +590,7 @@ void SerialPort::copyFrom (SerialPort *aThat)
     m->bd.assignCopy (aThat->m->bd);
 }
 
-void SerialPort::applyDefaults (GuestOSType *aOsType)
+void SerialPort::i_applyDefaults (GuestOSType *aOsType)
 {
     AssertReturnVoid (aOsType != NULL);
 
@@ -687,7 +626,7 @@ void SerialPort::applyDefaults (GuestOSType *aOsType)
         default: break;
     }
 
-    uint32_t numSerialEnabled = aOsType->numSerialEnabled();
+    uint32_t numSerialEnabled = aOsType->i_numSerialEnabled();
 
     /* Enable port if requested */
     if (m->bd->ulSlot < numSerialEnabled)
@@ -699,18 +638,19 @@ void SerialPort::applyDefaults (GuestOSType *aOsType)
 /**
  *  Validates COMSETTER(Path) arguments.
  */
-HRESULT SerialPort::checkSetPath(const Utf8Str &str)
+HRESULT SerialPort::i_checkSetPath(const Utf8Str &str)
 {
     AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
 
     if (    (    m->bd->portMode == PortMode_HostDevice
               || m->bd->portMode == PortMode_HostPipe
+              || m->bd->portMode == PortMode_TCP
               || m->bd->portMode == PortMode_RawFile
             ) && str.isEmpty()
        )
         return setError(E_INVALIDARG,
                         tr("Path of the serial port %d may not be empty or null in "
-                           "host pipe or host device mode"),
+                           "host pipe, host device or TCP mode"),
                         m->bd->ulSlot);
 
     return S_OK;
diff --git a/src/VBox/Main/src-server/SnapshotImpl.cpp b/src/VBox/Main/src-server/SnapshotImpl.cpp
index a6ea216..da27200 100644
--- a/src/VBox/Main/src-server/SnapshotImpl.cpp
+++ b/src/VBox/Main/src-server/SnapshotImpl.cpp
@@ -1,11 +1,10 @@
 /* $Id: SnapshotImpl.cpp $ */
 /** @file
- *
  * COM class implementation for Snapshot and SnapshotMachine in VBoxSVC.
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -42,7 +41,6 @@
 
 #include <VBox/settings.h>
 
-
 ////////////////////////////////////////////////////////////////////////////////
 //
 // Snapshot private data definition
@@ -81,6 +79,7 @@ struct Snapshot::Data
 // Constructor / destructor
 //
 ////////////////////////////////////////////////////////////////////////////////
+DEFINE_EMPTY_CTOR_DTOR(Snapshot)
 
 HRESULT Snapshot::FinalConstruct()
 {
@@ -174,8 +173,14 @@ void Snapshot::uninit()
     }
     m->llChildren.clear();          // this unsets all the ComPtrs and probably calls delete
 
+    // since there is no guarantee anyone holds a reference to us except the
+    // list of children in our parent, make sure that the reference count
+    // will not drop to 0 before we've declared ourselves as uninitialized,
+    // otherwise there will be another uninit call which causes a self-deadlock
+    // because this uninit isn't complete yet.
+    ComObjPtr<Snapshot> pSnapshot(this);
     if (m->pParent)
-        deparent();
+        i_deparent();
 
     if (m->pMachine)
     {
@@ -185,6 +190,10 @@ void Snapshot::uninit()
 
     delete m;
     m = NULL;
+
+    autoUninitSpan.setSucceeded();
+    // see above, now the refcount may reach 0
+    pSnapshot.setNull();
 }
 
 /**
@@ -199,7 +208,7 @@ void Snapshot::uninit()
  *  (and the snapshots tree) is protected by the caller having requested the machine
  *  lock in write mode AND the machine state must be DeletingSnapshot.
  */
-void Snapshot::beginSnapshotDelete()
+void Snapshot::i_beginSnapshotDelete()
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc()))
@@ -265,7 +274,7 @@ void Snapshot::beginSnapshotDelete()
  *
  * The caller must hold the machine lock in write mode (which protects the snapshots tree)!
  */
-void Snapshot::deparent()
+void Snapshot::i_deparent()
 {
     Assert(m->pMachine->isWriteLockOnCurrentThread());
 
@@ -291,29 +300,19 @@ void Snapshot::deparent()
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP Snapshot::COMGETTER(Id)(BSTR *aId)
+HRESULT Snapshot::getId(com::Guid &aId)
 {
-    CheckComArgOutPointerValid(aId);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->uuid.toUtf16().cloneTo(aId);
+    aId = m->uuid;
+
     return S_OK;
 }
 
-STDMETHODIMP Snapshot::COMGETTER(Name)(BSTR *aName)
+HRESULT Snapshot::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    m->strName.cloneTo(aName);
+    aName = m->strName;
     return S_OK;
 }
 
@@ -321,10 +320,9 @@ STDMETHODIMP Snapshot::COMGETTER(Name)(BSTR *aName)
  *  @note Locks this object for writing, then calls Machine::onSnapshotChange()
  *  (see its lock requirements).
  */
-STDMETHODIMP Snapshot::COMSETTER(Name)(IN_BSTR aName)
+HRESULT Snapshot::setName(const com::Utf8Str &aName)
 {
     HRESULT rc = S_OK;
-    CheckComArgStrNotEmptyOrNull(aName);
 
     // prohibit setting a UUID only as the machine name, or else it can
     // never be found by findMachine()
@@ -333,129 +331,89 @@ STDMETHODIMP Snapshot::COMSETTER(Name)(IN_BSTR aName)
     if (!test.isZero() && test.isValid())
         return setError(E_INVALIDARG,  tr("A machine cannot have a UUID as its name"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    Utf8Str strName(aName);
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (m->strName != strName)
+    if (m->strName != aName)
     {
-        m->strName = strName;
+        m->strName = aName;
         alock.release(); /* Important! (child->parent locks are forbidden) */
-        rc = m->pMachine->onSnapshotChange(this);
+        rc = m->pMachine->i_onSnapshotChange(this);
     }
 
     return rc;
 }
 
-STDMETHODIMP Snapshot::COMGETTER(Description)(BSTR *aDescription)
+HRESULT Snapshot::getDescription(com::Utf8Str &aDescription)
 {
-    CheckComArgOutPointerValid(aDescription);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    m->strDescription.cloneTo(aDescription);
+    aDescription = m->strDescription;
     return S_OK;
 }
 
-STDMETHODIMP Snapshot::COMSETTER(Description)(IN_BSTR aDescription)
+HRESULT Snapshot::setDescription(const com::Utf8Str &aDescription)
 {
     HRESULT rc = S_OK;
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    Utf8Str strDescription(aDescription);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    if (m->strDescription != strDescription)
+    if (m->strDescription != aDescription)
     {
-        m->strDescription = strDescription;
+        m->strDescription = aDescription;
         alock.release(); /* Important! (child->parent locks are forbidden) */
-        rc = m->pMachine->onSnapshotChange(this);
+        rc = m->pMachine->i_onSnapshotChange(this);
     }
 
     return rc;
 }
 
-STDMETHODIMP Snapshot::COMGETTER(TimeStamp)(LONG64 *aTimeStamp)
+HRESULT Snapshot::getTimeStamp(LONG64 *aTimeStamp)
 {
-    CheckComArgOutPointerValid(aTimeStamp);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aTimeStamp = RTTimeSpecGetMilli(&m->timeStamp);
     return S_OK;
 }
 
-STDMETHODIMP Snapshot::COMGETTER(Online)(BOOL *aOnline)
+HRESULT Snapshot::getOnline(BOOL *aOnline)
 {
-    CheckComArgOutPointerValid(aOnline);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    *aOnline = getStateFilePath().isNotEmpty();
+    *aOnline = i_getStateFilePath().isNotEmpty();
     return S_OK;
 }
 
-STDMETHODIMP Snapshot::COMGETTER(Machine)(IMachine **aMachine)
+HRESULT Snapshot::getMachine(ComPtr<IMachine> &aMachine)
 {
-    CheckComArgOutPointerValid(aMachine);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->pMachine.queryInterfaceTo(aMachine);
+    m->pMachine.queryInterfaceTo(aMachine.asOutParam());
+
     return S_OK;
 }
 
-STDMETHODIMP Snapshot::COMGETTER(Parent)(ISnapshot **aParent)
-{
-    CheckComArgOutPointerValid(aParent);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT Snapshot::getParent(ComPtr<ISnapshot> &aParent)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->pParent.queryInterfaceTo(aParent);
+    m->pParent.queryInterfaceTo(aParent.asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP Snapshot::COMGETTER(Children)(ComSafeArrayOut(ISnapshot *, aChildren))
+HRESULT Snapshot::getChildren(std::vector<ComPtr<ISnapshot> > &aChildren)
 {
-    CheckComArgOutSafeArrayPointerValid(aChildren);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     // snapshots tree is protected by machine lock
     AutoReadLock alock(m->pMachine COMMA_LOCKVAL_SRC_POS);
-
-    SafeIfaceArray<ISnapshot> collection(m->llChildren);
-    collection.detachTo(ComSafeArrayOutArg(aChildren));
-
+    aChildren.resize(0);
+    for (SnapshotsList::const_iterator it = m->llChildren.begin();
+         it != m->llChildren.end();
+         ++it)
+        aChildren.push_back(*it);
     return S_OK;
 }
 
-STDMETHODIMP Snapshot::GetChildrenCount(ULONG* count)
+HRESULT Snapshot::getChildrenCount(ULONG *count)
 {
-    CheckComArgOutPointerValid(count);
-
-    *count = getChildrenCount();
+    *count = i_getChildrenCount();
 
     return S_OK;
 }
@@ -470,7 +428,7 @@ STDMETHODIMP Snapshot::GetChildrenCount(ULONG* count)
  * Returns the parent snapshot or NULL if there's none.  Must have caller + locking!
  * @return
  */
-const ComObjPtr<Snapshot>& Snapshot::getParent() const
+const ComObjPtr<Snapshot>& Snapshot::i_getParent() const
 {
     return m->pParent;
 }
@@ -479,7 +437,7 @@ const ComObjPtr<Snapshot>& Snapshot::getParent() const
  * Returns the first child snapshot or NULL if there's none.  Must have caller + locking!
  * @return
  */
-const ComObjPtr<Snapshot> Snapshot::getFirstChild() const
+const ComObjPtr<Snapshot> Snapshot::i_getFirstChild() const
 {
     if (!m->llChildren.size())
         return NULL;
@@ -490,7 +448,7 @@ const ComObjPtr<Snapshot> Snapshot::getFirstChild() const
  *  @note
  *      Must be called from under the object's lock!
  */
-const Utf8Str& Snapshot::getStateFilePath() const
+const Utf8Str& Snapshot::i_getStateFilePath() const
 {
     return m->pMachine->mSSData->strStateFilePath;
 }
@@ -501,7 +459,7 @@ const Utf8Str& Snapshot::getStateFilePath() const
  * @note takes the snapshot tree lock
  */
 
-uint32_t Snapshot::getDepth()
+uint32_t Snapshot::i_getDepth()
 {
     AutoCaller autoCaller(this);
     AssertComRC(autoCaller.rc());
@@ -525,7 +483,7 @@ uint32_t Snapshot::getDepth()
  * Does not recurse.
  * @return
  */
-ULONG Snapshot::getChildrenCount()
+ULONG Snapshot::i_getChildrenCount()
 {
     AutoCaller autoCaller(this);
     AssertComRC(autoCaller.rc());
@@ -541,7 +499,7 @@ ULONG Snapshot::getChildrenCount()
  * tree lock only once before recursing. Don't call directly.
  * @return
  */
-ULONG Snapshot::getAllChildrenCountImpl()
+ULONG Snapshot::i_getAllChildrenCountImpl()
 {
     AutoCaller autoCaller(this);
     AssertComRC(autoCaller.rc());
@@ -551,7 +509,7 @@ ULONG Snapshot::getAllChildrenCountImpl()
          it != m->llChildren.end();
          ++it)
     {
-        count += (*it)->getAllChildrenCountImpl();
+        count += (*it)->i_getAllChildrenCountImpl();
     }
 
     return count;
@@ -562,7 +520,7 @@ ULONG Snapshot::getAllChildrenCountImpl()
  * Recurses into the snapshots tree.
  * @return
  */
-ULONG Snapshot::getAllChildrenCount()
+ULONG Snapshot::i_getAllChildrenCount()
 {
     AutoCaller autoCaller(this);
     AssertComRC(autoCaller.rc());
@@ -570,7 +528,7 @@ ULONG Snapshot::getAllChildrenCount()
     // snapshots tree is protected by machine lock
     AutoReadLock alock(m->pMachine COMMA_LOCKVAL_SRC_POS);
 
-    return getAllChildrenCountImpl();
+    return i_getAllChildrenCountImpl();
 }
 
 /**
@@ -578,7 +536,7 @@ ULONG Snapshot::getAllChildrenCount()
  * Caller must hold the snapshot's object lock!
  * @return
  */
-const ComObjPtr<SnapshotMachine>& Snapshot::getSnapshotMachine() const
+const ComObjPtr<SnapshotMachine>& Snapshot::i_getSnapshotMachine() const
 {
     return m->pMachine;
 }
@@ -588,7 +546,7 @@ const ComObjPtr<SnapshotMachine>& Snapshot::getSnapshotMachine() const
  * Caller must hold the snapshot's object lock!
  * @return
  */
-Guid Snapshot::getId() const
+Guid Snapshot::i_getId() const
 {
     return m->uuid;
 }
@@ -598,7 +556,7 @@ Guid Snapshot::getId() const
  * Caller must hold the snapshot's object lock!
  * @return
  */
-const Utf8Str& Snapshot::getName() const
+const Utf8Str& Snapshot::i_getName() const
 {
     return m->strName;
 }
@@ -608,7 +566,7 @@ const Utf8Str& Snapshot::getName() const
  * Caller must hold the snapshot's object lock!
  * @return
  */
-RTTIMESPEC Snapshot::getTimeStamp() const
+RTTIMESPEC Snapshot::i_getTimeStamp() const
 {
     return m->timeStamp;
 }
@@ -619,7 +577,7 @@ RTTIMESPEC Snapshot::getTimeStamp() const
  *
  *  Caller must hold the machine lock (which protects the snapshots tree!)
  */
-ComObjPtr<Snapshot> Snapshot::findChildOrSelf(IN_GUID aId)
+ComObjPtr<Snapshot> Snapshot::i_findChildOrSelf(IN_GUID aId)
 {
     ComObjPtr<Snapshot> child;
 
@@ -635,7 +593,7 @@ ComObjPtr<Snapshot> Snapshot::findChildOrSelf(IN_GUID aId)
              it != m->llChildren.end();
              ++it)
         {
-            if ((child = (*it)->findChildOrSelf(aId)))
+            if ((child = (*it)->i_findChildOrSelf(aId)))
                 break;
         }
     }
@@ -650,7 +608,7 @@ ComObjPtr<Snapshot> Snapshot::findChildOrSelf(IN_GUID aId)
  *
  *  Caller must hold the machine lock (which protects the snapshots tree!)
  */
-ComObjPtr<Snapshot> Snapshot::findChildOrSelf(const Utf8Str &aName)
+ComObjPtr<Snapshot> Snapshot::i_findChildOrSelf(const Utf8Str &aName)
 {
     ComObjPtr<Snapshot> child;
     AssertReturn(!aName.isEmpty(), child);
@@ -669,7 +627,7 @@ ComObjPtr<Snapshot> Snapshot::findChildOrSelf(const Utf8Str &aName)
              it != m->llChildren.end();
              ++it)
         {
-            if ((child = (*it)->findChildOrSelf(aName)))
+            if ((child = (*it)->i_findChildOrSelf(aName)))
                 break;
         }
     }
@@ -682,8 +640,8 @@ ComObjPtr<Snapshot> Snapshot::findChildOrSelf(const Utf8Str &aName)
  * @param aOldPath
  * @param aNewPath
  */
-void Snapshot::updateSavedStatePathsImpl(const Utf8Str &strOldPath,
-                                         const Utf8Str &strNewPath)
+void Snapshot::i_updateSavedStatePathsImpl(const Utf8Str &strOldPath,
+                                           const Utf8Str &strNewPath)
 {
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -706,7 +664,7 @@ void Snapshot::updateSavedStatePathsImpl(const Utf8Str &strOldPath,
          ++it)
     {
         Snapshot *pChild = *it;
-        pChild->updateSavedStatePathsImpl(strOldPath, strNewPath);
+        pChild->i_updateSavedStatePathsImpl(strOldPath, strNewPath);
     }
 }
 
@@ -722,8 +680,8 @@ void Snapshot::updateSavedStatePathsImpl(const Utf8Str &strOldPath,
  * @param pSnapshotToIgnore If != NULL, this snapshot is ignored during the checks.
  * @return
  */
-bool Snapshot::sharesSavedStateFile(const Utf8Str &strPath,
-                                    Snapshot *pSnapshotToIgnore)
+bool Snapshot::i_sharesSavedStateFile(const Utf8Str &strPath,
+                                      Snapshot *pSnapshotToIgnore)
 {
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     const Utf8Str &path = m->pMachine->mSSData->strStateFilePath;
@@ -740,7 +698,7 @@ bool Snapshot::sharesSavedStateFile(const Utf8Str &strPath,
     {
         Snapshot *pChild = *it;
         if (!pSnapshotToIgnore || pSnapshotToIgnore != pChild)
-            if (pChild->sharesSavedStateFile(strPath, pSnapshotToIgnore))
+            if (pChild->i_sharesSavedStateFile(strPath, pSnapshotToIgnore))
                 return true;
     }
 
@@ -759,8 +717,8 @@ bool Snapshot::sharesSavedStateFile(const Utf8Str &strPath,
  *
  *  @note Locks the machine (for the snapshots tree) +  this object + children for writing.
  */
-void Snapshot::updateSavedStatePaths(const Utf8Str &strOldPath,
-                                     const Utf8Str &strNewPath)
+void Snapshot::i_updateSavedStatePaths(const Utf8Str &strOldPath,
+                                      const Utf8Str &strNewPath)
 {
     LogFlowThisFunc(("aOldPath={%s} aNewPath={%s}\n", strOldPath.c_str(), strNewPath.c_str()));
 
@@ -771,18 +729,16 @@ void Snapshot::updateSavedStatePaths(const Utf8Str &strOldPath,
     AutoWriteLock alock(m->pMachine COMMA_LOCKVAL_SRC_POS);
 
     // call the implementation under the tree lock
-    updateSavedStatePathsImpl(strOldPath, strNewPath);
+    i_updateSavedStatePathsImpl(strOldPath, strNewPath);
 }
 
 /**
- * Internal implementation for Snapshot::saveSnapshot (below). Caller has
- * requested the snapshots tree (machine) lock.
+ * Saves the settings attributes of one snapshot.
  *
- * @param aNode
- * @param aAttrsOnly
+ * @param data      Target for saving snapshot settings.
  * @return
  */
-HRESULT Snapshot::saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly)
+HRESULT Snapshot::i_saveSnapshotImplOne(settings::Snapshot &data) const
 {
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -791,44 +747,50 @@ HRESULT Snapshot::saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly)
     data.timestamp = m->timeStamp;
     data.strDescription = m->strDescription;
 
-    if (aAttrsOnly)
-        return S_OK;
-
     // state file (only if this snapshot is online)
-    if (getStateFilePath().isNotEmpty())
-        m->pMachine->copyPathRelativeToMachine(getStateFilePath(), data.strStateFile);
+    if (i_getStateFilePath().isNotEmpty())
+        m->pMachine->i_copyPathRelativeToMachine(i_getStateFilePath(), data.strStateFile);
     else
         data.strStateFile.setNull();
 
-    HRESULT rc = m->pMachine->saveHardware(data.hardware, &data.debugging, &data.autostart);
+    HRESULT rc = m->pMachine->i_saveHardware(data.hardware, &data.debugging, &data.autostart);
     if (FAILED(rc)) return rc;
 
-    rc = m->pMachine->saveStorageControllers(data.storage);
+    rc = m->pMachine->i_saveStorageControllers(data.storage);
     if (FAILED(rc)) return rc;
 
-    alock.release();
+    return S_OK;
+}
 
-    data.llChildSnapshots.clear();
+/**
+ * Internal implementation for Snapshot::saveSnapshot (below). Caller has
+ * requested the snapshots tree (machine) lock.
+ *
+ * @param data      Target for saving snapshot settings.
+ * @return
+ */
+HRESULT Snapshot::i_saveSnapshotImpl(settings::Snapshot &data) const
+{
+    HRESULT rc = i_saveSnapshotImplOne(data);
+    if (FAILED(rc))
+        return rc;
 
-    if (m->llChildren.size())
+    settings::SnapshotsList &llSettingsChildren = data.llChildSnapshots;
+    for (SnapshotsList::const_iterator it = m->llChildren.begin();
+         it != m->llChildren.end();
+         ++it)
     {
-        for (SnapshotsList::const_iterator it = m->llChildren.begin();
-             it != m->llChildren.end();
-             ++it)
+        // Use the heap (indirectly through the list container) to reduce the
+        // stack footprint, avoiding local settings objects on the stack which
+        // need a lot of stack space. There can be VMs with deeply nested
+        // snapshots. The stack can be quite small, especially with XPCOM.
+        llSettingsChildren.push_back(settings::g_SnapshotEmpty);
+        Snapshot *pSnap = *it;
+        rc = pSnap->i_saveSnapshotImpl(llSettingsChildren.back());
+        if (FAILED(rc))
         {
-           // Use the heap to reduce the stack footprint. Each recursion needs
-           // over 1K, and there can be VMs with deeply nested snapshots. The
-           // stack can be quite small, especially with XPCOM.
-
-            settings::Snapshot *snap = new settings::Snapshot();
-            rc = (*it)->saveSnapshotImpl(*snap, aAttrsOnly);
-            if (FAILED(rc))
-            {
-                delete snap;
-                return rc;
-            }
-            data.llChildSnapshots.push_back(*snap);
-            delete snap;
+            llSettingsChildren.pop_back();
+            return rc;
         }
     }
 
@@ -836,19 +798,70 @@ HRESULT Snapshot::saveSnapshotImpl(settings::Snapshot &data, bool aAttrsOnly)
 }
 
 /**
- *  Saves the given snapshot and all its children (unless \a aAttrsOnly is true).
- *  It is assumed that the given node is empty (unless \a aAttrsOnly is true).
+ * Saves the given snapshot and all its children.
+ * It is assumed that the given node is empty.
  *
- *  @param aNode        <Snapshot> node to save the snapshot to.
- *  @param aSnapshot    Snapshot to save.
- *  @param aAttrsOnly   If true, only update user-changeable attrs.
+ * @param data      Target for saving snapshot settings.
  */
-HRESULT Snapshot::saveSnapshot(settings::Snapshot &data, bool aAttrsOnly)
+HRESULT Snapshot::i_saveSnapshot(settings::Snapshot &data) const
 {
     // snapshots tree is protected by machine lock
     AutoReadLock alock(m->pMachine COMMA_LOCKVAL_SRC_POS);
 
-    return saveSnapshotImpl(data, aAttrsOnly);
+    return i_saveSnapshotImpl(data);
+}
+
+/**
+ * Part of the cleanup engine of Machine::Unregister().
+ *
+ * This removes all medium attachments from the snapshot's machine and returns
+ * the snapshot's saved state file name, if any, and then calls uninit() on
+ * "this" itself.
+ *
+ * Caller must hold the machine write lock (which protects the snapshots tree!)
+ *
+ * @param writeLock Machine write lock, which can get released temporarily here.
+ * @param cleanupMode Cleanup mode; see Machine::detachAllMedia().
+ * @param llMedia List of media returned to caller, depending on cleanupMode.
+ * @param llFilenames
+ * @return
+ */
+HRESULT Snapshot::i_uninitOne(AutoWriteLock &writeLock,
+                              CleanupMode_T cleanupMode,
+                              MediaList &llMedia,
+                              std::list<Utf8Str> &llFilenames)
+{
+    // now call detachAllMedia on the snapshot machine
+    HRESULT rc = m->pMachine->i_detachAllMedia(writeLock,
+                                               this /* pSnapshot */,
+                                               cleanupMode,
+                                               llMedia);
+    if (FAILED(rc))
+        return rc;
+
+    // report the saved state file if it's not on the list yet
+    if (!m->pMachine->mSSData->strStateFilePath.isEmpty())
+    {
+        bool fFound = false;
+        for (std::list<Utf8Str>::const_iterator it = llFilenames.begin();
+             it != llFilenames.end();
+             ++it)
+        {
+            const Utf8Str &str = *it;
+            if (str == m->pMachine->mSSData->strStateFilePath)
+            {
+                fFound = true;
+                break;
+            }
+        }
+        if (!fFound)
+            llFilenames.push_back(m->pMachine->mSSData->strStateFilePath);
+    }
+
+    i_beginSnapshotDelete();
+    uninit();
+
+    return S_OK;
 }
 
 /**
@@ -874,10 +887,10 @@ HRESULT Snapshot::saveSnapshot(settings::Snapshot &data, bool aAttrsOnly)
  * @param llFilenames
  * @return
  */
-HRESULT Snapshot::uninitRecursively(AutoWriteLock &writeLock,
-                                    CleanupMode_T cleanupMode,
-                                    MediaList &llMedia,
-                                    std::list<Utf8Str> &llFilenames)
+HRESULT Snapshot::i_uninitRecursively(AutoWriteLock &writeLock,
+                                      CleanupMode_T cleanupMode,
+                                      MediaList &llMedia,
+                                      std::list<Utf8Str> &llFilenames)
 {
     Assert(m->pMachine->isWriteLockOnCurrentThread());
 
@@ -885,63 +898,35 @@ HRESULT Snapshot::uninitRecursively(AutoWriteLock &writeLock,
 
     // make a copy of the Guid for logging before we uninit ourselves
 #ifdef LOG_ENABLED
-    Guid uuid = getId();
-    Utf8Str name = getName();
+    Guid uuid = i_getId();
+    Utf8Str name = i_getName();
     LogFlowThisFunc(("Entering for snapshot '%s' {%RTuuid}\n", name.c_str(), uuid.raw()));
 #endif
 
-    // recurse into children first so that the child media appear on
-    // the list first; this way caller can close the media from the
-    // beginning to the end because parent media can't be closed if
-    // they have children
-
-    // make a copy of the children list since uninit() modifies it
-    SnapshotsList llChildrenCopy(m->llChildren);
-    for (SnapshotsList::iterator it = llChildrenCopy.begin();
-         it != llChildrenCopy.end();
-         ++it)
+    // Recurse into children first so that the child media appear on the list
+    // first; this way caller can close the media from the beginning to the end
+    // because parent media can't be closed if they have children and
+    // additionally it postpones the uninit() call until we no longer need
+    // anything from the list. Oh, and remember that the child removes itself
+    // from the list, so keep the iterator at the beginning.
+    for (SnapshotsList::const_iterator it = m->llChildren.begin();
+         it != m->llChildren.end();
+         it = m->llChildren.begin())
     {
         Snapshot *pChild = *it;
-        rc = pChild->uninitRecursively(writeLock, cleanupMode, llMedia, llFilenames);
+        rc = pChild->i_uninitRecursively(writeLock, cleanupMode, llMedia, llFilenames);
         if (FAILED(rc))
-            return rc;
-    }
-
-    // now call detachAllMedia on the snapshot machine
-    rc = m->pMachine->detachAllMedia(writeLock,
-                                     this /* pSnapshot */,
-                                     cleanupMode,
-                                     llMedia);
-    if (FAILED(rc))
-        return rc;
-
-    // report the saved state file if it's not on the list yet
-    if (!m->pMachine->mSSData->strStateFilePath.isEmpty())
-    {
-        bool fFound = false;
-        for (std::list<Utf8Str>::const_iterator it = llFilenames.begin();
-             it != llFilenames.end();
-             ++it)
-        {
-            const Utf8Str &str = *it;
-            if (str == m->pMachine->mSSData->strStateFilePath)
-            {
-                fFound = true;
-                break;
-            }
-        }
-        if (!fFound)
-            llFilenames.push_back(m->pMachine->mSSData->strStateFilePath);
+            break;
     }
 
-    this->beginSnapshotDelete();
-    this->uninit();
+    if (SUCCEEDED(rc))
+        rc = i_uninitOne(writeLock, cleanupMode, llMedia, llFilenames);
 
 #ifdef LOG_ENABLED
-    LogFlowThisFunc(("Leaving for snapshot '%s' {%RTuuid}\n", name.c_str(), uuid.raw()));
+    LogFlowThisFunc(("Leaving for snapshot '%s' {%RTuuid}: %Rhrc\n", name.c_str(), uuid.raw(), rc));
 #endif
 
-    return S_OK;
+    return rc;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1044,10 +1029,10 @@ HRESULT SnapshotMachine::init(SessionMachine *aSessionMachine,
          ++it)
     {
         MediumAttachment *pAtt = *it;
-        Medium *pMedium = pAtt->getMedium();
+        Medium *pMedium = pAtt->i_getMedium();
         if (pMedium) // can be NULL for non-harddisk
         {
-            rc = pMedium->addBackReference(mData->mUuid, mSnapshotId);
+            rc = pMedium->i_addBackReference(mData->mUuid, mSnapshotId);
             AssertComRC(rc);
         }
     }
@@ -1218,15 +1203,15 @@ HRESULT SnapshotMachine::initFromSettings(Machine *aMachine,
 
     /* load hardware and harddisk settings */
 
-    HRESULT rc = loadHardware(hardware, pDbg, pAutostart);
+    HRESULT rc = i_loadHardware(hardware, pDbg, pAutostart);
     if (SUCCEEDED(rc))
-        rc = loadStorageControllers(storage,
-                                    NULL, /* puuidRegistry */
-                                    &mSnapshotId);
+        rc = i_loadStorageControllers(storage,
+                                      NULL, /* puuidRegistry */
+                                      &mSnapshotId);
 
     if (SUCCEEDED(rc))
         /* commit all changes made during the initialization */
-        commit();   /// @todo r=dj why do we need a commit in init?!? this is very expensive
+        i_commit();   /// @todo r=dj why do we need a commit in init?!? this is very expensive
         /// @todo r=klaus for some reason the settings loading logic backs up
         // the settings, and therefore a commit is needed. Should probably be changed.
 
@@ -1284,30 +1269,30 @@ RWLockHandle *SnapshotMachine::lockHandle() const
  *
  *  @warning Caller must hold no locks when calling this.
  */
-HRESULT SnapshotMachine::onSnapshotChange(Snapshot *aSnapshot)
+HRESULT SnapshotMachine::i_onSnapshotChange(Snapshot *aSnapshot)
 {
     AutoMultiWriteLock2 mlock(this, aSnapshot COMMA_LOCKVAL_SRC_POS);
     Guid uuidMachine(mData->mUuid),
-         uuidSnapshot(aSnapshot->getId());
+         uuidSnapshot(aSnapshot->i_getId());
     bool fNeedsGlobalSaveSettings = false;
 
     /* Flag the machine as dirty or change won't get saved. We disable the
      * modification of the current state flag, cause this snapshot data isn't
      * related to the current state. */
-    mMachine->setModified(Machine::IsModified_Snapshots, false /* fAllowStateModification */);
-    HRESULT rc = mMachine->saveSettings(&fNeedsGlobalSaveSettings,
-                                        SaveS_Force);        // we know we need saving, no need to check
+    mMachine->i_setModified(Machine::IsModified_Snapshots, false /* fAllowStateModification */);
+    HRESULT rc = mMachine->i_saveSettings(&fNeedsGlobalSaveSettings,
+                                          SaveS_Force);        // we know we need saving, no need to check
     mlock.release();
 
     if (SUCCEEDED(rc) && fNeedsGlobalSaveSettings)
     {
         // save the global settings
         AutoWriteLock vboxlock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     /* inform callbacks */
-    mParent->onSnapshotChange(uuidMachine, uuidSnapshot);
+    mParent->i_onSnapshotChange(uuidMachine, uuidSnapshot);
 
     return rc;
 }
@@ -1319,50 +1304,79 @@ HRESULT SnapshotMachine::onSnapshotChange(Snapshot *aSnapshot)
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
- * Abstract base class for SessionMachine::RestoreSnapshotTask and
- * SessionMachine::DeleteSnapshotTask. This is necessary since
- * RTThreadCreate cannot call a method as its thread function, so
- * instead we have it call the static SessionMachine::taskHandler,
- * which can then call the handler() method in here (implemented
- * by the children).
+ * Still abstract base class for SessionMachine::TakeSnapshotTask,
+ * SessionMachine::RestoreSnapshotTask and SessionMachine::DeleteSnapshotTask.
  */
 struct SessionMachine::SnapshotTask
+    : public SessionMachine::Task
 {
     SnapshotTask(SessionMachine *m,
                  Progress *p,
+                 const Utf8Str &t,
                  Snapshot *s)
-        : pMachine(m),
-          pProgress(p),
-          machineStateBackup(m->mData->mMachineState), // save the current machine state
-          pSnapshot(s)
+        : Task(m, p, t),
+          m_pSnapshot(s)
     {}
 
-    void modifyBackedUpState(MachineState_T s)
-    {
-        *const_cast<MachineState_T*>(&machineStateBackup) = s;
+    ComObjPtr<Snapshot> m_pSnapshot;
+};
+
+/** Take snapshot task */
+struct SessionMachine::TakeSnapshotTask
+    : public SessionMachine::SnapshotTask
+{
+    TakeSnapshotTask(SessionMachine *m,
+                     Progress *p,
+                     const Utf8Str &t,
+                     Snapshot *s,
+                     const Utf8Str &strName,
+                     const Utf8Str &strDescription,
+                     bool fPause,
+                     uint32_t uMemSize,
+                     bool fTakingSnapshotOnline)
+        : SnapshotTask(m, p, t, s),
+          m_strName(strName),
+          m_strDescription(strDescription),
+          m_fPause(fPause),
+          m_uMemSize(uMemSize),
+          m_fTakingSnapshotOnline(fTakingSnapshotOnline)
+    {
+        if (fTakingSnapshotOnline)
+            m_pDirectControl = m->mData->mSession.mDirectControl;
+        // If the VM is already paused then there's no point trying to pause
+        // again during taking an (always online) snapshot.
+        if (m_machineStateBackup == MachineState_Paused)
+            m_fPause = false;
     }
 
-    virtual void handler() = 0;
+    void handler()
+    {
+        ((SessionMachine *)(Machine *)m_pMachine)->i_takeSnapshotHandler(*this);
+    }
 
-    ComObjPtr<SessionMachine>       pMachine;
-    ComObjPtr<Progress>             pProgress;
-    const MachineState_T            machineStateBackup;
-    ComObjPtr<Snapshot>             pSnapshot;
+    Utf8Str m_strName;
+    Utf8Str m_strDescription;
+    Utf8Str m_strStateFilePath;
+    ComPtr<IInternalSessionControl> m_pDirectControl;
+    bool m_fPause;
+    uint32_t m_uMemSize;
+    bool m_fTakingSnapshotOnline;
 };
 
-/** Restore snapshot state task */
+/** Restore snapshot task */
 struct SessionMachine::RestoreSnapshotTask
     : public SessionMachine::SnapshotTask
 {
     RestoreSnapshotTask(SessionMachine *m,
                         Progress *p,
+                        const Utf8Str &t,
                         Snapshot *s)
-        : SnapshotTask(m, p, s)
+        : SnapshotTask(m, p, t, s)
     {}
 
     void handler()
     {
-        pMachine->restoreSnapshotHandler(*this);
+        ((SessionMachine *)(Machine *)m_pMachine)->i_restoreSnapshotHandler(*this);
     }
 };
 
@@ -1372,239 +1386,435 @@ struct SessionMachine::DeleteSnapshotTask
 {
     DeleteSnapshotTask(SessionMachine *m,
                        Progress *p,
+                       const Utf8Str &t,
                        bool fDeleteOnline,
                        Snapshot *s)
-        : SnapshotTask(m, p, s),
+        : SnapshotTask(m, p, t, s),
           m_fDeleteOnline(fDeleteOnline)
     {}
 
     void handler()
     {
-        pMachine->deleteSnapshotHandler(*this);
+        ((SessionMachine *)(Machine *)m_pMachine)->i_deleteSnapshotHandler(*this);
     }
 
     bool m_fDeleteOnline;
 };
 
-/**
- * Static SessionMachine method that can get passed to RTThreadCreate to
- * have a thread started for a SnapshotTask. See SnapshotTask above.
- *
- * This calls either RestoreSnapshotTask::handler() or DeleteSnapshotTask::handler().
- */
-
-/* static */ DECLCALLBACK(int) SessionMachine::taskHandler(RTTHREAD /* thread */, void *pvUser)
-{
-    AssertReturn(pvUser, VERR_INVALID_POINTER);
-
-    SnapshotTask *task = static_cast<SnapshotTask*>(pvUser);
-    task->handler();
-
-    // it's our responsibility to delete the task
-    delete task;
-
-    return 0;
-}
 
 ////////////////////////////////////////////////////////////////////////////////
 //
-// TakeSnapshot methods (SessionMachine and related tasks)
+// TakeSnapshot methods (Machine and related tasks)
 //
 ////////////////////////////////////////////////////////////////////////////////
 
-/**
- * Implementation for IInternalMachineControl::beginTakingSnapshot().
- *
- * Gets called indirectly from Console::TakeSnapshot, which creates a
- * progress object in the client and then starts a thread
- * (Console::fntTakeSnapshotWorker) which then calls this.
- *
- * In other words, the asynchronous work for taking snapshots takes place
- * on the _client_ (in the Console). This is different from restoring
- * or deleting snapshots, which start threads on the server.
- *
- * This does the server-side work of taking a snapshot: it creates differencing
- * images for all hard disks attached to the machine and then creates a
- * Snapshot object with a corresponding SnapshotMachine to save the VM settings.
- *
- * The client's fntTakeSnapshotWorker() blocks while this takes place.
- * After this returns successfully, fntTakeSnapshotWorker() will begin
- * saving the machine state to the snapshot object and reconfigure the
- * hard disks.
- *
- * When the console is done, it calls SessionMachine::EndTakingSnapshot().
- *
- * @note Locks mParent + this object for writing.
- *
- * @param aInitiator in: The console on which Console::TakeSnapshot was called.
- * @param aName  in: The name for the new snapshot.
- * @param aDescription  in: A description for the new snapshot.
- * @param aConsoleProgress  in: The console's (client's) progress object.
- * @param fTakingSnapshotOnline  in: True if an online snapshot is being taken (i.e. machine is running).
- * @param aStateFilePath out: name of file in snapshots folder to which the console should write the VM state.
- * @return
- */
-STDMETHODIMP SessionMachine::BeginTakingSnapshot(IConsole *aInitiator,
-                                                 IN_BSTR aName,
-                                                 IN_BSTR aDescription,
-                                                 IProgress *aConsoleProgress,
-                                                 BOOL fTakingSnapshotOnline,
-                                                 BSTR *aStateFilePath)
-{
-    NOREF(aInitiator);
-    LogFlowThisFuncEnter();
-
-    AssertReturn(aInitiator && aName, E_INVALIDARG);
-    AssertReturn(aStateFilePath, E_POINTER);
+HRESULT Machine::takeSnapshot(const com::Utf8Str &aName,
+                              const com::Utf8Str &aDescription,
+                              BOOL fPause,
+                              ComPtr<IProgress> &aProgress)
+{
+    NOREF(aName);
+    NOREF(aDescription);
+    NOREF(fPause);
+    NOREF(aProgress);
+    ReturnComNotImplemented();
+}
 
-    LogFlowThisFunc(("aName='%ls' fTakingSnapshotOnline=%RTbool\n", aName, fTakingSnapshotOnline));
+HRESULT SessionMachine::takeSnapshot(const com::Utf8Str &aName,
+                                     const com::Utf8Str &aDescription,
+                                     BOOL fPause,
+                                     ComPtr<IProgress> &aProgress)
+{
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    LogFlowThisFunc(("aName='%s' mMachineState=%d\n", aName.c_str(), mData->mMachineState));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+    if (Global::IsTransient(mData->mMachineState))
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("Cannot take a snapshot of the machine while it is changing the state (machine state: %s)"),
+                        Global::stringifyMachineState(mData->mMachineState));
 
-    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
+    if (FAILED(rc))
+        return rc;
 
-    AssertReturn(    !Global::IsOnlineOrTransient(mData->mMachineState)
-                  || mData->mMachineState == MachineState_Running
-                  || mData->mMachineState == MachineState_Paused, E_FAIL);
-    AssertReturn(mConsoleTaskData.mLastState == MachineState_Null, E_FAIL);
-    AssertReturn(mConsoleTaskData.mSnapshot.isNull(), E_FAIL);
+    // prepare the progress object:
+    // a) count the no. of hard disk attachments to get a matching no. of progress sub-operations
+    ULONG cOperations = 2;              // always at least setting up + finishing up
+    ULONG ulTotalOperationsWeight = 2;  // one each for setting up + finishing up
 
-    if (   mData->mCurrentSnapshot
-        && mData->mCurrentSnapshot->getDepth() >= SETTINGS_SNAPSHOT_DEPTH_MAX)
+    for (MediaData::AttachmentList::iterator it = mMediaData->mAttachments.begin();
+         it != mMediaData->mAttachments.end();
+         ++it)
     {
-        return setError(VBOX_E_INVALID_OBJECT_STATE,
-                        tr("Cannot take another snapshot for machine '%s', because it exceeds the maximum snapshot depth limit. Please delete some earlier snapshot which you no longer need"),
-                        mUserData->s.strName.c_str());
+        const ComObjPtr<MediumAttachment> pAtt(*it);
+        AutoReadLock attlock(pAtt COMMA_LOCKVAL_SRC_POS);
+        AutoCaller attCaller(pAtt);
+        if (pAtt->i_getType() == DeviceType_HardDisk)
+        {
+            ++cOperations;
+
+            // assume that creating a diff image takes as long as saving a 1MB state
+            ulTotalOperationsWeight += 1;
+        }
     }
 
-    if (    !fTakingSnapshotOnline
-         && mData->mMachineState != MachineState_Saved
-       )
+    // b) one extra sub-operations for online snapshots OR offline snapshots that have a saved state (needs to be copied)
+    const bool fTakingSnapshotOnline = Global::IsOnline(mData->mMachineState);
+    LogFlowThisFunc(("fTakingSnapshotOnline = %d\n", fTakingSnapshotOnline));
+    if (fTakingSnapshotOnline)
     {
-        /* save all current settings to ensure current changes are committed and
-         * hard disks are fixed up */
-        HRESULT rc = saveSettings(NULL);
-                // no need to check for whether VirtualBox.xml needs changing since
-                // we can't have a machine XML rename pending at this point
-        if (FAILED(rc)) return rc;
+        ++cOperations;
+        ulTotalOperationsWeight += mHWData->mMemorySize;
     }
 
-    /* create an ID for the snapshot */
-    Guid snapshotId;
-    snapshotId.create();
+    // finally, create the progress object
+    ComObjPtr<Progress> pProgress;
+    pProgress.createObject();
+    rc = pProgress->init(mParent,
+                         static_cast<IMachine *>(this),
+                         Bstr(tr("Taking a snapshot of the virtual machine")).raw(),
+                         fTakingSnapshotOnline /* aCancelable */,
+                         cOperations,
+                         ulTotalOperationsWeight,
+                         Bstr(tr("Setting up snapshot operation")).raw(),      // first sub-op description
+                         1);        // ulFirstOperationWeight
+    if (FAILED(rc))
+        return rc;
 
-    Utf8Str strStateFilePath;
-    /* stateFilePath is null when the machine is not online nor saved */
+    /* create and start the task on a separate thread (note that it will not
+     * start working until we release alock) */
+    TakeSnapshotTask *pTask = new TakeSnapshotTask(this,
+                                                   pProgress,
+                                                   "TakeSnap",
+                                                   NULL /* pSnapshot */,
+                                                   aName,
+                                                   aDescription,
+                                                   !!fPause,
+                                                   mHWData->mMemorySize,
+                                                   fTakingSnapshotOnline);
+    rc = pTask->createThread();
+    if (FAILED(rc))
+        return rc;
+
+    /* set the proper machine state (note: after creating a Task instance) */
     if (fTakingSnapshotOnline)
     {
-        Bstr value;
-        HRESULT rc = GetExtraData(Bstr("VBoxInternal2/ForceTakeSnapshotWithoutState").raw(),
-                                  value.asOutParam());
-        if (FAILED(rc) || value != "1")
-        {
-            // creating a new online snapshot: we need a fresh saved state file
-            composeSavedStateFilename(strStateFilePath);
-        }
+        if (pTask->m_machineStateBackup != MachineState_Paused && !fPause)
+            i_setMachineState(MachineState_LiveSnapshotting);
+        else
+            i_setMachineState(MachineState_OnlineSnapshotting);
+        i_updateMachineStateOnClient();
     }
-    else if (mData->mMachineState == MachineState_Saved)
-        // taking an online snapshot from machine in "saved" state: then use existing state file
-        strStateFilePath = mSSData->strStateFilePath;
+    else
+        i_setMachineState(MachineState_Snapshotting);
+
+    pTask->m_pProgress.queryInterfaceTo(aProgress.asOutParam());
+
+    return rc;
+}
+
+/**
+ * Task thread implementation for SessionMachine::TakeSnapshot(), called from
+ * SessionMachine::taskHandler().
+ *
+ * @note Locks this object for writing.
+ *
+ * @param task
+ * @return
+ */
+void SessionMachine::i_takeSnapshotHandler(TakeSnapshotTask &task)
+{
+    LogFlowThisFuncEnter();
+
+    // Taking a snapshot consists of the following:
+    // 1) creating a Snapshot object with the current state of the machine
+    //    (hardware + storage)
+    // 2) creating a diff image for each virtual hard disk, into which write
+    //    operations go after the snapshot has been created
+    // 3) if the machine is online: saving the state of the virtual machine
+    //    (in the VM process)
+    // 4) reattach the hard disks
+    // 5) update the various snapshot/machine objects, save settings
 
-    if (strStateFilePath.isNotEmpty())
+    HRESULT rc = S_OK;
+    AutoCaller autoCaller(this);
+    LogFlowThisFunc(("state=%d\n", getObjectState().getState()));
+    if (FAILED(autoCaller.rc()))
     {
-        // ensure the directory for the saved state file exists
-        HRESULT rc = VirtualBox::ensureFilePathExists(strStateFilePath, true /* fCreate */);
-        if (FAILED(rc)) return rc;
+        /* we might have been uninitialized because the session was accidentally
+         * closed by the client, so don't assert */
+        rc = setError(E_FAIL,
+                      tr("The session has been accidentally closed"));
+        task.m_pProgress->i_notifyComplete(rc);
+        LogFlowThisFuncLeave();
+        return;
     }
 
-    /* create a snapshot machine object */
-    ComObjPtr<SnapshotMachine> snapshotMachine;
-    snapshotMachine.createObject();
-    HRESULT rc = snapshotMachine->init(this, snapshotId.ref(), strStateFilePath);
-    AssertComRCReturn(rc, rc);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    /* create a snapshot object */
-    RTTIMESPEC time;
-    ComObjPtr<Snapshot> pSnapshot;
-    pSnapshot.createObject();
-    rc = pSnapshot->init(mParent,
-                         snapshotId,
-                         aName,
-                         aDescription,
-                         *RTTimeNow(&time),
-                         snapshotMachine,
-                         mData->mCurrentSnapshot);
-    AssertComRCReturnRC(rc);
-
-    /* fill in the snapshot data */
-    mConsoleTaskData.mLastState = mData->mMachineState;
-    mConsoleTaskData.mSnapshot = pSnapshot;
-    /// @todo in the long run the progress object should be moved to
-    // VBoxSVC to avoid trouble with monitoring the progress object state
-    // when the process where it lives is terminating shortly after the
-    // operation completed.
+    bool fBeganTakingSnapshot = false;
+    BOOL fSuspendedBySave     = FALSE;
+    Guid snapshotId;
 
     try
     {
+        // @todo: at this point we have to be in the right state!!!!
+        AssertStmt(   mData->mMachineState == MachineState_Snapshotting
+                   || mData->mMachineState == MachineState_OnlineSnapshotting
+                   || mData->mMachineState == MachineState_LiveSnapshotting, throw E_FAIL);
+        AssertStmt(task.m_machineStateBackup != mData->mMachineState, throw E_FAIL);
+        AssertStmt(task.m_pSnapshot.isNull(), throw E_FAIL);
+
+        if (   mData->mCurrentSnapshot
+            && mData->mCurrentSnapshot->i_getDepth() >= SETTINGS_SNAPSHOT_DEPTH_MAX)
+        {
+            throw setError(VBOX_E_INVALID_OBJECT_STATE,
+                           tr("Cannot take another snapshot for machine '%s', because it exceeds the maximum snapshot depth limit. Please delete some earlier snapshot which you no longer need"),
+                           mUserData->s.strName.c_str());
+        }
+
+        /* save settings to ensure current changes are committed and
+         * hard disks are fixed up */
+        rc = i_saveSettings(NULL);
+            // no need to check for whether VirtualBox.xml needs changing since
+            // we can't have a machine XML rename pending at this point
+        if (FAILED(rc))
+            throw rc;
+
+        /* task.m_strStateFilePath is "" when the machine is offline or saved */
+        if (task.m_fTakingSnapshotOnline)
+        {
+            Bstr value;
+            rc = GetExtraData(Bstr("VBoxInternal2/ForceTakeSnapshotWithoutState").raw(),
+                              value.asOutParam());
+            if (FAILED(rc) || value != "1")
+                // creating a new online snapshot: we need a fresh saved state file
+                i_composeSavedStateFilename(task.m_strStateFilePath);
+        }
+        else if (task.m_machineStateBackup == MachineState_Saved)
+            // taking an offline snapshot from machine in "saved" state: use existing state file
+            task.m_strStateFilePath = mSSData->strStateFilePath;
+
+        if (task.m_strStateFilePath.isNotEmpty())
+        {
+            // ensure the directory for the saved state file exists
+            rc = VirtualBox::i_ensureFilePathExists(task.m_strStateFilePath, true /* fCreate */);
+            if (FAILED(rc))
+                throw rc;
+        }
+
+        /* STEP 1: create the snapshot object */
+
+        /* create an ID for the snapshot */
+        snapshotId.create();
+
+        /* create a snapshot machine object */
+        ComObjPtr<SnapshotMachine> pSnapshotMachine;
+        pSnapshotMachine.createObject();
+        rc = pSnapshotMachine->init(this, snapshotId.ref(), task.m_strStateFilePath);
+        AssertComRCThrowRC(rc);
+
+        /* create a snapshot object */
+        RTTIMESPEC time;
+        RTTimeNow(&time);
+        task.m_pSnapshot.createObject();
+        rc = task.m_pSnapshot->init(mParent,
+                                    snapshotId,
+                                    task.m_strName,
+                                    task.m_strDescription,
+                                    time,
+                                    pSnapshotMachine,
+                                    mData->mCurrentSnapshot);
+        AssertComRCThrowRC(rc);
+
+        /* STEP 2: create the diff images */
         LogFlowThisFunc(("Creating differencing hard disks (online=%d)...\n",
-                         fTakingSnapshotOnline));
+                         task.m_fTakingSnapshotOnline));
 
-        // backup the media data so we can recover if things goes wrong along the day;
-        // the matching commit() is in fixupMedia() during endSnapshot()
-        setModified(IsModified_Storage);
+        // Backup the media data so we can recover if something goes wrong.
+        // The matching commit() is in fixupMedia() during SessionMachine::i_finishTakingSnapshot()
+        i_setModified(IsModified_Storage);
         mMediaData.backup();
 
-        /* Console::fntTakeSnapshotWorker and friends expects this. */
-        if (mConsoleTaskData.mLastState == MachineState_Running)
-            setMachineState(MachineState_LiveSnapshotting);
-        else
-            setMachineState(MachineState_Saving); /** @todo Confusing! Saving is used for both online and offline snapshots. */
-
         alock.release();
         /* create new differencing hard disks and attach them to this machine */
-        rc = createImplicitDiffs(aConsoleProgress,
-                                 1,            // operation weight; must be the same as in Console::TakeSnapshot()
-                                 !!fTakingSnapshotOnline);
+        rc = i_createImplicitDiffs(task.m_pProgress,
+                                   1,            // operation weight; must be the same as in Machine::TakeSnapshot()
+                                   task.m_fTakingSnapshotOnline);
         if (FAILED(rc))
             throw rc;
+        alock.acquire();
 
         // MUST NOT save the settings or the media registry here, because
         // this causes trouble with rolling back settings if the user cancels
         // taking the snapshot after the diff images have been created.
+
+        fBeganTakingSnapshot = true;
+
+        // STEP 3: save the VM state (if online)
+        if (task.m_fTakingSnapshotOnline)
+        {
+            task.m_pProgress->SetNextOperation(Bstr(tr("Saving the machine state")).raw(),
+                                               mHWData->mMemorySize);   // operation weight, same as computed
+                                                                        // when setting up progress object
+
+            if (task.m_strStateFilePath.isNotEmpty())
+            {
+                alock.release();
+                task.m_pProgress->i_setCancelCallback(i_takeSnapshotProgressCancelCallback, &task);
+                rc = task.m_pDirectControl->SaveStateWithReason(Reason_Snapshot,
+                                                                task.m_pProgress,
+                                                                Bstr(task.m_strStateFilePath).raw(),
+                                                                task.m_fPause,
+                                                                &fSuspendedBySave);
+                task.m_pProgress->i_setCancelCallback(NULL, NULL);
+                alock.acquire();
+                if (FAILED(rc))
+                    throw rc;
+            }
+            else
+                LogRel(("Machine: skipped saving state as part of online snapshot\n"));
+
+            if (!task.m_pProgress->i_notifyPointOfNoReturn())
+                throw setError(E_FAIL, tr("Canceled"));
+
+            // STEP 4: reattach hard disks
+            LogFlowThisFunc(("Reattaching new differencing hard disks...\n"));
+
+            task.m_pProgress->SetNextOperation(Bstr(tr("Reconfiguring medium attachments")).raw(),
+                                               1);       // operation weight, same as computed when setting up progress object
+
+            com::SafeIfaceArray<IMediumAttachment> atts;
+            rc = COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(atts));
+            if (FAILED(rc))
+                throw rc;
+
+            alock.release();
+            rc = task.m_pDirectControl->ReconfigureMediumAttachments(ComSafeArrayAsInParam(atts));
+            alock.acquire();
+            if (FAILED(rc))
+                throw rc;
+        }
+
+        /*
+         * Finalize the requested snapshot object. This will reset the
+         * machine state to the state it had at the beginning.
+         */
+        rc = i_finishTakingSnapshot(task, alock, true /*aSuccess*/);
+        // do not throw rc here because we can't call i_finishTakingSnapshot() twice
+        LogFlowThisFunc(("i_finishTakingSnapshot -> %Rhrc [mMachineState=%s]\n", rc, Global::stringifyMachineState(mData->mMachineState)));
     }
-    catch (HRESULT hrc)
+    catch (HRESULT rcThrown)
     {
-        LogThisFunc(("Caught %Rhrc [%s]\n", hrc, Global::stringifyMachineState(mData->mMachineState) ));
-        if (    mConsoleTaskData.mLastState != mData->mMachineState
-             && (   mConsoleTaskData.mLastState == MachineState_Running
-                  ? mData->mMachineState == MachineState_LiveSnapshotting
-                  : mData->mMachineState == MachineState_Saving)
-           )
-            setMachineState(mConsoleTaskData.mLastState);
+        rc = rcThrown;
+        LogThisFunc(("Caught %Rhrc [mMachineState=%s]\n", rc, Global::stringifyMachineState(mData->mMachineState)));
+
+        // @todo r=klaus check that the implicit diffs created above are cleaned up im the relevant error cases
 
-        pSnapshot->uninit();
-        pSnapshot.setNull();
-        mConsoleTaskData.mLastState = MachineState_Null;
-        mConsoleTaskData.mSnapshot.setNull();
+        /* preserve existing error info */
+        ErrorInfoKeeper eik;
 
-        rc = hrc;
+        if (fBeganTakingSnapshot)
+            i_finishTakingSnapshot(task, alock, false /*aSuccess*/);
 
-        // @todo r=dj what with the implicit diff that we created above? this is never cleaned up
+        // have to postpone this to the end as i_finishTakingSnapshot() needs
+        // it for various cleanup steps
+        if (task.m_pSnapshot)
+        {
+            task.m_pSnapshot->uninit();
+            task.m_pSnapshot.setNull();
+        }
     }
+    Assert(alock.isWriteLockOnCurrentThread());
 
-    if (fTakingSnapshotOnline && SUCCEEDED(rc))
-        strStateFilePath.cloneTo(aStateFilePath);
-    else
-        *aStateFilePath = NULL;
+    {
+        // Keep all error information over the cleanup steps
+        ErrorInfoKeeper eik;
 
-    LogFlowThisFunc(("LEAVE - %Rhrc [%s]\n", rc, Global::stringifyMachineState(mData->mMachineState) ));
-    return rc;
+        /*
+         * Fix up the machine state.
+         *
+         * For offline snapshots we just update the local copy, for the other
+         * variants do the entire work. This ensures that the state is in sync
+         * with the VM process (in particular the VM execution state).
+         */
+        bool fNeedClientMachineStateUpdate = false;
+        if (   mData->mMachineState == MachineState_LiveSnapshotting
+            || mData->mMachineState == MachineState_OnlineSnapshotting
+            || mData->mMachineState == MachineState_Snapshotting)
+        {
+            if (!task.m_fTakingSnapshotOnline)
+                i_setMachineState(task.m_machineStateBackup);
+            else
+            {
+                MachineState_T enmMachineState = MachineState_Null;
+                HRESULT rc2 = task.m_pDirectControl->COMGETTER(NominalState)(&enmMachineState);
+                if (FAILED(rc2) || enmMachineState == MachineState_Null)
+                {
+                    AssertMsgFailed(("state=%s\n", Global::stringifyMachineState(enmMachineState)));
+                    // pure nonsense, try to continue somehow
+                    enmMachineState = MachineState_Aborted;
+                }
+                if (enmMachineState == MachineState_Paused)
+                {
+                    if (fSuspendedBySave)
+                    {
+                        alock.release();
+                        rc2 = task.m_pDirectControl->ResumeWithReason(Reason_Snapshot);
+                        alock.acquire();
+                        if (SUCCEEDED(rc2))
+                            enmMachineState = task.m_machineStateBackup;
+                    }
+                    else
+                        enmMachineState = task.m_machineStateBackup;
+                }
+                if (enmMachineState != mData->mMachineState)
+                {
+                    fNeedClientMachineStateUpdate = true;
+                    i_setMachineState(enmMachineState);
+                }
+            }
+        }
+
+        /* check the remote state to see that we got it right. */
+        MachineState_T enmMachineState = MachineState_Null;
+        if (!task.m_pDirectControl.isNull())
+        {
+            ComPtr<IConsole> pConsole;
+            task.m_pDirectControl->COMGETTER(RemoteConsole)(pConsole.asOutParam());
+            if (!pConsole.isNull())
+                pConsole->COMGETTER(State)(&enmMachineState);
+        }
+        LogFlowThisFunc(("local mMachineState=%s remote mMachineState=%s\n",
+                         Global::stringifyMachineState(mData->mMachineState),
+                         Global::stringifyMachineState(enmMachineState)));
+
+        if (fNeedClientMachineStateUpdate)
+            i_updateMachineStateOnClient();
+    }
+
+    task.m_pProgress->i_notifyComplete(rc);
+
+    if (SUCCEEDED(rc))
+        mParent->i_onSnapshotTaken(mData->mUuid, snapshotId);
+    LogFlowThisFuncLeave();
 }
 
+
+/**
+ * Progress cancelation callback employed by SessionMachine::i_takeSnapshotHandler.
+ */
+/*static*/
+void SessionMachine::i_takeSnapshotProgressCancelCallback(void *pvUser)
+{
+    TakeSnapshotTask *pTask = (TakeSnapshotTask *)pvUser;
+    AssertPtrReturnVoid(pTask);
+    AssertReturnVoid(!pTask->m_pDirectControl.isNull());
+    pTask->m_pDirectControl->CancelSaveStateWithReason();
+}
+
+
 /**
- * Implementation for IInternalMachineControl::endTakingSnapshot().
- *
  * Called by the Console when it's done saving the VM state into the snapshot
  * (if online) and reconfiguring the hard disks. See BeginTakingSnapshot() above.
  *
@@ -1616,45 +1826,26 @@ STDMETHODIMP SessionMachine::BeginTakingSnapshot(IConsole *aInitiator,
  * @param aSuccess Whether Console was successful with the client-side snapshot things.
  * @return
  */
-STDMETHODIMP SessionMachine::EndTakingSnapshot(BOOL aSuccess)
+HRESULT SessionMachine::i_finishTakingSnapshot(TakeSnapshotTask &task, AutoWriteLock &alock, bool aSuccess)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
-
-    AutoWriteLock machineLock(this COMMA_LOCKVAL_SRC_POS);
+    Assert(alock.isWriteLockOnCurrentThread());
 
     AssertReturn(   !aSuccess
-                 || (    (    mData->mMachineState == MachineState_Saving
-                           || mData->mMachineState == MachineState_LiveSnapshotting)
-                      && mConsoleTaskData.mLastState != MachineState_Null
-                      && !mConsoleTaskData.mSnapshot.isNull()
-                    )
-                 , E_FAIL);
-
-    /*
-     * Restore the state we had when BeginTakingSnapshot() was called,
-     * Console::fntTakeSnapshotWorker restores its local copy when we return.
-     * If the state was Running, then let Console::fntTakeSnapshotWorker do it
-     * all to avoid races.
-     */
-    if (    mData->mMachineState != mConsoleTaskData.mLastState
-         && mConsoleTaskData.mLastState != MachineState_Running
-       )
-        setMachineState(mConsoleTaskData.mLastState);
+                 || mData->mMachineState == MachineState_Snapshotting
+                 || mData->mMachineState == MachineState_OnlineSnapshotting
+                 || mData->mMachineState == MachineState_LiveSnapshotting, E_FAIL);
 
     ComObjPtr<Snapshot> pOldFirstSnap = mData->mFirstSnapshot;
     ComObjPtr<Snapshot> pOldCurrentSnap = mData->mCurrentSnapshot;
 
-    bool fOnline = Global::IsOnline(mConsoleTaskData.mLastState);
-
     HRESULT rc = S_OK;
 
     if (aSuccess)
     {
         // new snapshot becomes the current one
-        mData->mCurrentSnapshot = mConsoleTaskData.mSnapshot;
+        mData->mCurrentSnapshot = task.m_pSnapshot;
 
         /* memorize the first snapshot if necessary */
         if (!mData->mFirstSnapshot)
@@ -1662,108 +1853,102 @@ STDMETHODIMP SessionMachine::EndTakingSnapshot(BOOL aSuccess)
 
         int flSaveSettings = SaveS_Force;       // do not do a deep compare in machine settings,
                                                 // snapshots change, so we know we need to save
-        if (!fOnline)
+        if (!task.m_fTakingSnapshotOnline)
             /* the machine was powered off or saved when taking a snapshot, so
              * reset the mCurrentStateModified flag */
             flSaveSettings |= SaveS_ResetCurStateModified;
 
-        rc = saveSettings(NULL, flSaveSettings);
+        rc = i_saveSettings(NULL, flSaveSettings);
     }
 
     if (aSuccess && SUCCEEDED(rc))
     {
         /* associate old hard disks with the snapshot and do locking/unlocking*/
-        commitMedia(fOnline);
-
-        /* inform callbacks */
-        mParent->onSnapshotTaken(mData->mUuid,
-                                 mConsoleTaskData.mSnapshot->getId());
-        machineLock.release();
+        i_commitMedia(task.m_fTakingSnapshotOnline);
+        alock.release();
     }
     else
     {
         /* delete all differencing hard disks created (this will also attach
          * their parents back by rolling back mMediaData) */
-        machineLock.release();
+        alock.release();
 
-        rollbackMedia();
+        i_rollbackMedia();
 
         mData->mFirstSnapshot = pOldFirstSnap;      // might have been changed above
         mData->mCurrentSnapshot = pOldCurrentSnap;      // might have been changed above
 
         // delete the saved state file (it might have been already created)
-        if (fOnline)
+        if (task.m_fTakingSnapshotOnline)
             // no need to test for whether the saved state file is shared: an online
             // snapshot means that a new saved state file was created, which we must
             // clean up now
-            RTFileDelete(mConsoleTaskData.mSnapshot->getStateFilePath().c_str());
-            machineLock.acquire();
+            RTFileDelete(task.m_pSnapshot->i_getStateFilePath().c_str());
 
+        alock.acquire();
 
-        mConsoleTaskData.mSnapshot->uninit();
-        machineLock.release();
+        task.m_pSnapshot->uninit();
+        alock.release();
 
     }
 
     /* clear out the snapshot data */
-    mConsoleTaskData.mLastState = MachineState_Null;
-    mConsoleTaskData.mSnapshot.setNull();
+    task.m_pSnapshot.setNull();
 
-    /* machineLock has been released already */
+    /* alock has been released already */
+    mParent->i_saveModifiedRegistries();
 
-    mParent->saveModifiedRegistries();
+    alock.acquire();
 
     return rc;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //
-// RestoreSnapshot methods (SessionMachine and related tasks)
+// RestoreSnapshot methods (Machine and related tasks)
 //
 ////////////////////////////////////////////////////////////////////////////////
 
+HRESULT Machine::restoreSnapshot(const ComPtr<ISnapshot> &aSnapshot,
+                                 ComPtr<IProgress> &aProgress)
+{
+    NOREF(aSnapshot);
+    NOREF(aProgress);
+    ReturnComNotImplemented();
+}
+
 /**
- * Implementation for IInternalMachineControl::restoreSnapshot().
- *
- * Gets called from Console::RestoreSnapshot(), and that's basically the
- * only thing Console does. Restoring a snapshot happens entirely on the
- * server side since the machine cannot be running.
- *
- * This creates a new thread that does the work and returns a progress
- * object to the client which is then returned to the caller of
- * Console::RestoreSnapshot().
+ * Restoring a snapshot happens entirely on the server side, the machine cannot be running.
  *
+ * This creates a new thread that does the work and returns a progress object to the client.
  * Actual work then takes place in RestoreSnapshotTask::handler().
  *
  * @note Locks this + children objects for writing!
  *
- * @param aInitiator in: rhe console on which Console::RestoreSnapshot was called.
  * @param aSnapshot in: the snapshot to restore.
- * @param aMachineState in: client-side machine state.
  * @param aProgress out: progress object to monitor restore thread.
  * @return
  */
-STDMETHODIMP SessionMachine::RestoreSnapshot(IConsole *aInitiator,
-                                             ISnapshot *aSnapshot,
-                                             MachineState_T *aMachineState,
-                                             IProgress **aProgress)
+HRESULT SessionMachine::restoreSnapshot(const ComPtr<ISnapshot> &aSnapshot,
+                                        ComPtr<IProgress> &aProgress)
 {
     LogFlowThisFuncEnter();
 
-    AssertReturn(aInitiator, E_INVALIDARG);
-    AssertReturn(aSnapshot && aMachineState && aProgress, E_POINTER);
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     // machine must not be running
-    ComAssertRet(!Global::IsOnlineOrTransient(mData->mMachineState),
-                 E_FAIL);
+    if (Global::IsOnlineOrTransient(mData->mMachineState))
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("Cannot delete the current state of the running machine (machine state: %s)"),
+                        Global::stringifyMachineState(mData->mMachineState));
+
+    HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);
+    if (FAILED(rc))
+        return rc;
 
-    ComObjPtr<Snapshot> pSnapshot(static_cast<Snapshot*>(aSnapshot));
-    ComObjPtr<SnapshotMachine> pSnapMachine = pSnapshot->getSnapshotMachine();
+    ISnapshot* iSnapshot = aSnapshot;
+    ComObjPtr<Snapshot> pSnapshot(static_cast<Snapshot*>(iSnapshot));
+    ComObjPtr<SnapshotMachine> pSnapMachine = pSnapshot->i_getSnapshotMachine();
 
     // create a progress object. The number of operations is:
     // 1 (preparing) + # of hard disks + 1 (if we need to copy the saved state file) */
@@ -1777,19 +1962,20 @@ STDMETHODIMP SessionMachine::RestoreSnapshot(IConsole *aInitiator,
     {
         ComObjPtr<MediumAttachment> &pAttach = *it;
         AutoReadLock attachLock(pAttach COMMA_LOCKVAL_SRC_POS);
-        if (pAttach->getType() == DeviceType_HardDisk)
+        if (pAttach->i_getType() == DeviceType_HardDisk)
         {
             ++ulOpCount;
             ++ulTotalWeight;         // assume one MB weight for each differencing hard disk to manage
-            Assert(pAttach->getMedium());
-            LogFlowThisFunc(("op %d: considering hard disk attachment %s\n", ulOpCount, pAttach->getMedium()->getName().c_str()));
+            Assert(pAttach->i_getMedium());
+            LogFlowThisFunc(("op %d: considering hard disk attachment %s\n", ulOpCount,
+                             pAttach->i_getMedium()->i_getName().c_str()));
         }
     }
 
     ComObjPtr<Progress> pProgress;
     pProgress.createObject();
-    pProgress->init(mParent, aInitiator,
-                    BstrFmt(tr("Restoring snapshot '%s'"), pSnapshot->getName().c_str()).raw(),
+    pProgress->init(mParent, static_cast<IMachine*>(this),
+                    BstrFmt(tr("Restoring snapshot '%s'"), pSnapshot->i_getName().c_str()).raw(),
                     FALSE /* aCancelable */,
                     ulOpCount,
                     ulTotalWeight,
@@ -1798,30 +1984,19 @@ STDMETHODIMP SessionMachine::RestoreSnapshot(IConsole *aInitiator,
 
     /* create and start the task on a separate thread (note that it will not
      * start working until we release alock) */
-    RestoreSnapshotTask *task = new RestoreSnapshotTask(this,
-                                                        pProgress,
-                                                        pSnapshot);
-    int vrc = RTThreadCreate(NULL,
-                             taskHandler,
-                             (void*)task,
-                             0,
-                             RTTHREADTYPE_MAIN_WORKER,
-                             0,
-                             "RestoreSnap");
-    if (RT_FAILURE(vrc))
-    {
-        delete task;
-        ComAssertRCRet(vrc, E_FAIL);
-    }
+    RestoreSnapshotTask *pTask = new RestoreSnapshotTask(this,
+                                                         pProgress,
+                                                         "RestoreSnap",
+                                                         pSnapshot);
+    rc = pTask->createThread();
+    if (FAILED(rc))
+        return rc;
 
     /* set the proper machine state (note: after creating a Task instance) */
-    setMachineState(MachineState_RestoringSnapshot);
+    i_setMachineState(MachineState_RestoringSnapshot);
 
     /* return the progress to the caller */
-    pProgress.queryInterfaceTo(aProgress);
-
-    /* return the new state to the caller */
-    *aMachineState = mData->mMachineState;
+    pProgress.queryInterfaceTo(aProgress.asOutParam());
 
     LogFlowThisFuncLeave();
 
@@ -1838,23 +2013,23 @@ STDMETHODIMP SessionMachine::RestoreSnapshot(IConsole *aInitiator,
  *
  * @note Locks mParent + this object for writing.
  *
- * @param aTask Task data.
+ * @param pTask Task data.
  */
-void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
+void SessionMachine::i_restoreSnapshotHandler(RestoreSnapshotTask &task)
 {
     LogFlowThisFuncEnter();
 
     AutoCaller autoCaller(this);
 
-    LogFlowThisFunc(("state=%d\n", autoCaller.state()));
+    LogFlowThisFunc(("state=%d\n", getObjectState().getState()));
     if (!autoCaller.isOk())
     {
         /* we might have been uninitialized because the session was accidentally
          * closed by the client, so don't assert */
-        aTask.pProgress->notifyComplete(E_FAIL,
-                                        COM_IIDOF(IMachine),
-                                        getComponentName(),
-                                        tr("The session has been accidentally closed"));
+        task.m_pProgress->i_notifyComplete(E_FAIL,
+                                           COM_IIDOF(IMachine),
+                                           getComponentName(),
+                                           tr("The session has been accidentally closed"));
 
         LogFlowThisFuncLeave();
         return;
@@ -1862,8 +2037,6 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
 
     HRESULT rc = S_OK;
 
-    bool stateRestored = false;
-
     try
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -1872,11 +2045,11 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
          * Note that the machine is powered off, so there is no need to inform
          * the direct session. */
         if (mData->flModifications)
-            rollback(false /* aNotify */);
+            i_rollback(false /* aNotify */);
 
         /* Delete the saved state file if the machine was Saved prior to this
          * operation */
-        if (aTask.machineStateBackup == MachineState_Saved)
+        if (task.m_machineStateBackup == MachineState_Saved)
         {
             Assert(!mSSData->strStateFilePath.isEmpty());
 
@@ -1884,11 +2057,11 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
             // so that releaseSavedStateFile() won't think it's still in use
             Utf8Str strStateFile(mSSData->strStateFilePath);
             mSSData->strStateFilePath.setNull();
-            releaseSavedStateFile(strStateFile, NULL /* pSnapshotToIgnore */ );
+            i_releaseSavedStateFile(strStateFile, NULL /* pSnapshotToIgnore */ );
 
-            aTask.modifyBackedUpState(MachineState_PoweredOff);
+            task.modifyBackedUpState(MachineState_PoweredOff);
 
-            rc = saveStateSettings(SaveSTS_StateFilePath);
+            rc = i_saveStateSettings(SaveSTS_StateFilePath);
             if (FAILED(rc))
                 throw rc;
         }
@@ -1897,20 +2070,20 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
         RTTimeSpecSetMilli(&snapshotTimeStamp, 0);
 
         {
-            AutoReadLock snapshotLock(aTask.pSnapshot COMMA_LOCKVAL_SRC_POS);
+            AutoReadLock snapshotLock(task.m_pSnapshot COMMA_LOCKVAL_SRC_POS);
 
             /* remember the timestamp of the snapshot we're restoring from */
-            snapshotTimeStamp = aTask.pSnapshot->getTimeStamp();
+            snapshotTimeStamp = task.m_pSnapshot->i_getTimeStamp();
 
-            ComPtr<SnapshotMachine> pSnapshotMachine(aTask.pSnapshot->getSnapshotMachine());
+            ComPtr<SnapshotMachine> pSnapshotMachine(task.m_pSnapshot->i_getSnapshotMachine());
 
             /* copy all hardware data from the snapshot */
-            copyFrom(pSnapshotMachine);
+            i_copyFrom(pSnapshotMachine);
 
             LogFlowThisFunc(("Restoring hard disks from the snapshot...\n"));
 
             // restore the attachments from the snapshot
-            setModified(IsModified_Storage);
+            i_setModified(IsModified_Storage);
             mMediaData.backup();
             mMediaData->mAttachments.clear();
             for (MediaData::AttachmentList::const_iterator it = pSnapshotMachine->mMediaData->mAttachments.begin();
@@ -1927,9 +2100,9 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
             snapshotLock.release();
             alock.release();
 
-            rc = createImplicitDiffs(aTask.pProgress,
-                                     1,
-                                     false /* aOnline */);
+            rc = i_createImplicitDiffs(task.m_pProgress,
+                                       1,
+                                       false /* aOnline */);
             if (FAILED(rc))
                 throw rc;
 
@@ -1937,22 +2110,22 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
             snapshotLock.acquire();
 
             /* Note: on success, current (old) hard disks will be
-             * deassociated/deleted on #commit() called from #saveSettings() at
+             * deassociated/deleted on #commit() called from #i_saveSettings() at
              * the end. On failure, newly created implicit diffs will be
              * deleted by #rollback() at the end. */
 
             /* should not have a saved state file associated at this point */
             Assert(mSSData->strStateFilePath.isEmpty());
 
-            const Utf8Str &strSnapshotStateFile = aTask.pSnapshot->getStateFilePath();
+            const Utf8Str &strSnapshotStateFile = task.m_pSnapshot->i_getStateFilePath();
 
             if (strSnapshotStateFile.isNotEmpty())
                 // online snapshot: then share the state file
                 mSSData->strStateFilePath = strSnapshotStateFile;
 
-            LogFlowThisFunc(("Setting new current snapshot {%RTuuid}\n", aTask.pSnapshot->getId().raw()));
+            LogFlowThisFunc(("Setting new current snapshot {%RTuuid}\n", task.m_pSnapshot->i_getId().raw()));
             /* make the snapshot we restored from the current snapshot */
-            mData->mCurrentSnapshot = aTask.pSnapshot;
+            mData->mCurrentSnapshot = task.m_pSnapshot;
         }
 
         /* grab differencing hard disks from the old attachments that will
@@ -1964,17 +2137,17 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
              ++it)
         {
             ComObjPtr<MediumAttachment> pAttach = *it;
-            ComObjPtr<Medium> pMedium = pAttach->getMedium();
+            ComObjPtr<Medium> pMedium = pAttach->i_getMedium();
 
             /* while the hard disk is attached, the number of children or the
              * parent cannot change, so no lock */
             if (    !pMedium.isNull()
-                 && pAttach->getType() == DeviceType_HardDisk
-                 && !pMedium->getParent().isNull()
-                 && pMedium->getChildren().size() == 0
+                 && pAttach->i_getType() == DeviceType_HardDisk
+                 && !pMedium->i_getParent().isNull()
+                 && pMedium->i_getChildren().size() == 0
                )
             {
-                LogFlowThisFunc(("Picked differencing image '%s' for deletion\n", pMedium->getName().c_str()));
+                LogFlowThisFunc(("Picked differencing image '%s' for deletion\n", pMedium->i_getName().c_str()));
 
                 llDiffAttachmentsToDelete.push_back(pAttach);
             }
@@ -1983,12 +2156,9 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
         /* we have already deleted the current state, so set the execution
          * state accordingly no matter of the delete snapshot result */
         if (mSSData->strStateFilePath.isNotEmpty())
-            setMachineState(MachineState_Saved);
+            task.modifyBackedUpState(MachineState_Saved);
         else
-            setMachineState(MachineState_PoweredOff);
-
-        updateMachineStateOnClient();
-        stateRestored = true;
+            task.modifyBackedUpState(MachineState_PoweredOff);
 
         /* Paranoia: no one must have saved the settings in the mean time. If
          * it happens nevertheless we'll close our eyes and continue below. */
@@ -1999,7 +2169,7 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
         mData->mLastStateChange = snapshotTimeStamp;
 
         // detach the current-state diffs that we detected above and build a list of
-        // image files to delete _after_ saveSettings()
+        // image files to delete _after_ i_saveSettings()
 
         MediaList llDiffsToDelete;
 
@@ -2008,44 +2178,43 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
              ++it)
         {
             ComObjPtr<MediumAttachment> pAttach = *it;        // guaranteed to have only attachments where medium != NULL
-            ComObjPtr<Medium> pMedium = pAttach->getMedium();
+            ComObjPtr<Medium> pMedium = pAttach->i_getMedium();
 
             AutoWriteLock mlock(pMedium COMMA_LOCKVAL_SRC_POS);
 
-            LogFlowThisFunc(("Detaching old current state in differencing image '%s'\n", pMedium->getName().c_str()));
+            LogFlowThisFunc(("Detaching old current state in differencing image '%s'\n", pMedium->i_getName().c_str()));
 
             // Normally we "detach" the medium by removing the attachment object
-            // from the current machine data; saveSettings() below would then
+            // from the current machine data; i_saveSettings() below would then
             // compare the current machine data with the one in the backup
             // and actually call Medium::removeBackReference(). But that works only half
             // the time in our case so instead we force a detachment here:
             // remove from machine data
             mMediaData->mAttachments.remove(pAttach);
-            // Remove it from the backup or else saveSettings will try to detach
+            // Remove it from the backup or else i_saveSettings will try to detach
             // it again and assert. The paranoia check avoids crashes (see
             // assert above) if this code is buggy and saves settings in the
             // wrong place.
             if (mMediaData.isBackedUp())
                 mMediaData.backedUpData()->mAttachments.remove(pAttach);
             // then clean up backrefs
-            pMedium->removeBackReference(mData->mUuid);
+            pMedium->i_removeBackReference(mData->mUuid);
 
             llDiffsToDelete.push_back(pMedium);
         }
 
         // save machine settings, reset the modified flag and commit;
         bool fNeedsGlobalSaveSettings = false;
-        rc = saveSettings(&fNeedsGlobalSaveSettings,
-                          SaveS_ResetCurStateModified);
+        rc = i_saveSettings(&fNeedsGlobalSaveSettings,
+                            SaveS_ResetCurStateModified);
         if (FAILED(rc))
             throw rc;
-        // unconditionally add the parent registry. We do similar in SessionMachine::EndTakingSnapshot
-        // (mParent->saveSettings())
 
         // release the locks before updating registry and deleting image files
         alock.release();
 
-        mParent->markRegistryModified(mParent->getGlobalRegistryId());
+        // unconditionally add the parent registry.
+        mParent->i_markRegistryModified(mParent->i_getGlobalRegistryId());
 
         // from here on we cannot roll back on failure any more
 
@@ -2054,11 +2223,11 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
              ++it)
         {
             ComObjPtr<Medium> &pMedium = *it;
-            LogFlowThisFunc(("Deleting old current state in differencing image '%s'\n", pMedium->getName().c_str()));
+            LogFlowThisFunc(("Deleting old current state in differencing image '%s'\n", pMedium->i_getName().c_str()));
 
-            HRESULT rc2 = pMedium->deleteStorage(NULL /* aProgress */,
-                                                 true /* aWait */);
-            // ignore errors here because we cannot roll back after saveSettings() above
+            HRESULT rc2 = pMedium->i_deleteStorage(NULL /* aProgress */,
+                                                   true /* aWait */);
+            // ignore errors here because we cannot roll back after i_saveSettings() above
             if (SUCCEEDED(rc2))
                 pMedium->uninit();
         }
@@ -2074,23 +2243,20 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
         ErrorInfoKeeper eik;
 
         /* undo all changes on failure */
-        rollback(false /* aNotify */);
+        i_rollback(false /* aNotify */);
 
-        if (!stateRestored)
-        {
-            /* restore the machine state */
-            setMachineState(aTask.machineStateBackup);
-            updateMachineStateOnClient();
-        }
     }
 
-    mParent->saveModifiedRegistries();
+    mParent->i_saveModifiedRegistries();
+
+    /* restore the machine state */
+    i_setMachineState(task.m_machineStateBackup);
 
     /* set the result (this will try to fetch current error info on failure) */
-    aTask.pProgress->notifyComplete(rc);
+    task.m_pProgress->i_notifyComplete(rc);
 
     if (SUCCEEDED(rc))
-        mParent->onSnapshotDeleted(mData->mUuid, Guid());
+        mParent->i_onSnapshotRestored(mData->mUuid, Guid());
 
     LogFlowThisFunc(("Done restoring snapshot (rc=%08X)\n", rc));
 
@@ -2103,47 +2269,84 @@ void SessionMachine::restoreSnapshotHandler(RestoreSnapshotTask &aTask)
 //
 ////////////////////////////////////////////////////////////////////////////////
 
+HRESULT Machine::deleteSnapshot(const com::Guid &aId, ComPtr<IProgress> &aProgress)
+{
+    NOREF(aId);
+    NOREF(aProgress);
+    ReturnComNotImplemented();
+}
+
+HRESULT SessionMachine::deleteSnapshot(const com::Guid &aId, ComPtr<IProgress> &aProgress)
+{
+    return i_deleteSnapshot(aId, aId,
+                            FALSE /* fDeleteAllChildren */,
+                            aProgress);
+}
+
+HRESULT Machine::deleteSnapshotAndAllChildren(const com::Guid &aId, ComPtr<IProgress> &aProgress)
+{
+    NOREF(aId);
+    NOREF(aProgress);
+    ReturnComNotImplemented();
+}
+
+HRESULT SessionMachine::deleteSnapshotAndAllChildren(const com::Guid &aId, ComPtr<IProgress> &aProgress)
+{
+    return i_deleteSnapshot(aId, aId,
+                            TRUE /* fDeleteAllChildren */,
+                            aProgress);
+}
+
+HRESULT Machine::deleteSnapshotRange(const com::Guid &aStartId, const com::Guid &aEndId, ComPtr<IProgress> &aProgress)
+{
+    NOREF(aStartId);
+    NOREF(aEndId);
+    NOREF(aProgress);
+    ReturnComNotImplemented();
+}
+
+HRESULT SessionMachine::deleteSnapshotRange(const com::Guid &aStartId, const com::Guid &aEndId, ComPtr<IProgress> &aProgress)
+{
+    return i_deleteSnapshot(aStartId, aEndId,
+                            FALSE /* fDeleteAllChildren */,
+                            aProgress);
+}
+
+
 /**
- * Implementation for IInternalMachineControl::DeleteSnapshot().
+ * Implementation for SessionMachine::i_deleteSnapshot().
  *
- * Gets called from Console::DeleteSnapshot(), and that's basically the
- * only thing Console does initially. Deleting a snapshot happens entirely on
- * the server side if the machine is not running, and if it is running then
- * the individual merges are done via internal session callbacks.
+ * Gets called from SessionMachine::DeleteSnapshot(). Deleting a snapshot
+ * happens entirely on the server side if the machine is not running, and
+ * if it is running then the merges are done via internal session callbacks.
  *
  * This creates a new thread that does the work and returns a progress
- * object to the client which is then returned to the caller of
- * Console::DeleteSnapshot().
+ * object to the client.
  *
- * Actual work then takes place in DeleteSnapshotTask::handler().
+ * Actual work then takes place in SessionMachine::i_deleteSnapshotHandler().
  *
  * @note Locks mParent + this + children objects for writing!
  */
-STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
-                                            IN_BSTR aStartId,
-                                            IN_BSTR aEndId,
-                                            BOOL fDeleteAllChildren,
-                                            MachineState_T *aMachineState,
-                                            IProgress **aProgress)
+HRESULT SessionMachine::i_deleteSnapshot(const com::Guid &aStartId,
+                                         const com::Guid &aEndId,
+                                         BOOL aDeleteAllChildren,
+                                         ComPtr<IProgress> &aProgress)
 {
     LogFlowThisFuncEnter();
 
-    Guid startId(aStartId);
-    Guid endId(aEndId);
-
-    AssertReturn(aInitiator && !startId.isZero() && !endId.isZero() && startId.isValid() && endId.isValid(), E_INVALIDARG);
-
-    AssertReturn(aMachineState && aProgress, E_POINTER);
+    AssertReturn(!aStartId.isZero() && !aEndId.isZero() && aStartId.isValid() && aEndId.isValid(), E_INVALIDARG);
 
     /** @todo implement the "and all children" and "range" variants */
-    if (fDeleteAllChildren || startId != endId)
+    if (aDeleteAllChildren || aStartId != aEndId)
         ReturnComNotImplemented();
 
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
+    if (Global::IsTransient(mData->mMachineState))
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("Cannot delete a snapshot of the machine while it is changing the state (machine state: %s)"),
+                        Global::stringifyMachineState(mData->mMachineState));
+
     // be very picky about machine states
     if (   Global::IsOnlineOrTransient(mData->mMachineState)
         && mData->mMachineState != MachineState_PoweredOff
@@ -2156,23 +2359,30 @@ STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
                         tr("Invalid machine state: %s"),
                         Global::stringifyMachineState(mData->mMachineState));
 
+    HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);
+    if (FAILED(rc))
+        return rc;
+
     ComObjPtr<Snapshot> pSnapshot;
-    HRESULT rc = findSnapshotById(startId, pSnapshot, true /* aSetError */);
-    if (FAILED(rc)) return rc;
+    rc = i_findSnapshotById(aStartId, pSnapshot, true /* aSetError */);
+    if (FAILED(rc))
+        return rc;
 
     AutoWriteLock snapshotLock(pSnapshot COMMA_LOCKVAL_SRC_POS);
+    Utf8Str str;
 
-    size_t childrenCount = pSnapshot->getChildrenCount();
+    size_t childrenCount = pSnapshot->i_getChildrenCount();
     if (childrenCount > 1)
         return setError(VBOX_E_INVALID_OBJECT_STATE,
                         tr("Snapshot '%s' of the machine '%s' cannot be deleted, because it has %d child snapshots, which is more than the one snapshot allowed for deletion"),
-                        pSnapshot->getName().c_str(),
+                        pSnapshot->i_getName().c_str(),
                         mUserData->s.strName.c_str(),
                         childrenCount);
+
     if (pSnapshot == mData->mCurrentSnapshot && childrenCount >= 1)
         return setError(VBOX_E_INVALID_OBJECT_STATE,
                         tr("Snapshot '%s' of the machine '%s' cannot be deleted, because it is the current snapshot and has one child snapshot"),
-                        pSnapshot->getName().c_str(),
+                        pSnapshot->i_getName().c_str(),
                         mUserData->s.strName.c_str());
 
     /* If the snapshot being deleted is the current one, ensure current
@@ -2182,14 +2392,14 @@ STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
     {
         if (mData->flModifications)
         {
-            rc = saveSettings(NULL);
+            rc = i_saveSettings(NULL);
                 // no need to change for whether VirtualBox.xml needs saving since
                 // we can't have a machine XML rename pending at this point
             if (FAILED(rc)) return rc;
         }
     }
 
-    ComObjPtr<SnapshotMachine> pSnapMachine = pSnapshot->getSnapshotMachine();
+    ComObjPtr<SnapshotMachine> pSnapMachine = pSnapshot->i_getSnapshotMachine();
 
     /* create a progress object. The number of operations is:
      *   1 (preparing) + 1 if the snapshot is online + # of normal hard disks
@@ -2199,7 +2409,7 @@ STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
     ULONG ulOpCount = 1;            // one for preparations
     ULONG ulTotalWeight = 1;        // one for preparations
 
-    if (pSnapshot->getStateFilePath().length())
+    if (pSnapshot->i_getStateFilePath().length())
     {
         ++ulOpCount;
         ++ulTotalWeight;            // assume 1 MB for deleting the state file
@@ -2212,13 +2422,13 @@ STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
     {
         ComObjPtr<MediumAttachment> &pAttach = *it;
         AutoReadLock attachLock(pAttach COMMA_LOCKVAL_SRC_POS);
-        if (pAttach->getType() == DeviceType_HardDisk)
+        if (pAttach->i_getType() == DeviceType_HardDisk)
         {
-            ComObjPtr<Medium> pHD = pAttach->getMedium();
+            ComObjPtr<Medium> pHD = pAttach->i_getMedium();
             Assert(pHD);
             AutoReadLock mlock(pHD COMMA_LOCKVAL_SRC_POS);
 
-            MediumType_T type = pHD->getType();
+            MediumType_T type = pHD->i_getType();
             // writethrough and shareable images are unaffected by snapshots,
             // so do nothing for them
             if (   type != MediumType_Writethrough
@@ -2227,16 +2437,16 @@ STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
             {
                 // normal or immutable media need attention
                 ++ulOpCount;
-                ulTotalWeight += (ULONG)(pHD->getSize() / _1M);
+                ulTotalWeight += (ULONG)(pHD->i_getSize() / _1M);
             }
-            LogFlowThisFunc(("op %d: considering hard disk attachment %s\n", ulOpCount, pHD->getName().c_str()));
+            LogFlowThisFunc(("op %d: considering hard disk attachment %s\n", ulOpCount, pHD->i_getName().c_str()));
         }
     }
 
     ComObjPtr<Progress> pProgress;
     pProgress.createObject();
-    pProgress->init(mParent, aInitiator,
-                    BstrFmt(tr("Deleting snapshot '%s'"), pSnapshot->getName().c_str()).raw(),
+    pProgress->init(mParent, static_cast<IMachine*>(this),
+                    BstrFmt(tr("Deleting snapshot '%s'"), pSnapshot->i_getName().c_str()).raw(),
                     FALSE /* aCancelable */,
                     ulOpCount,
                     ulTotalWeight,
@@ -2247,36 +2457,32 @@ STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
                           || (mData->mMachineState == MachineState_Paused));
 
     /* create and start the task on a separate thread */
-    DeleteSnapshotTask *task = new DeleteSnapshotTask(this, pProgress,
-                                                      fDeleteOnline, pSnapshot);
-    int vrc = RTThreadCreate(NULL,
-                             taskHandler,
-                             (void*)task,
-                             0,
-                             RTTHREADTYPE_MAIN_WORKER,
-                             0,
-                             "DeleteSnapshot");
-    if (RT_FAILURE(vrc))
-    {
-        delete task;
-        return E_FAIL;
-    }
+    DeleteSnapshotTask *pTask = new DeleteSnapshotTask(this, pProgress,
+                                                       "DeleteSnap",
+                                                       fDeleteOnline,
+                                                       pSnapshot);
+    rc = pTask->createThread();
+    if (FAILED(rc))
+        return rc;
 
     // the task might start running but will block on acquiring the machine's write lock
     // which we acquired above; once this function leaves, the task will be unblocked;
     // set the proper machine state here now (note: after creating a Task instance)
     if (mData->mMachineState == MachineState_Running)
-        setMachineState(MachineState_DeletingSnapshotOnline);
+    {
+        i_setMachineState(MachineState_DeletingSnapshotOnline);
+        i_updateMachineStateOnClient();
+    }
     else if (mData->mMachineState == MachineState_Paused)
-        setMachineState(MachineState_DeletingSnapshotPaused);
+    {
+        i_setMachineState(MachineState_DeletingSnapshotPaused);
+        i_updateMachineStateOnClient();
+    }
     else
-        setMachineState(MachineState_DeletingSnapshot);
+        i_setMachineState(MachineState_DeletingSnapshot);
 
     /* return the progress to the caller */
-    pProgress.queryInterfaceTo(aProgress);
-
-    /* return the new state to the caller */
-    *aMachineState = mData->mMachineState;
+    pProgress.queryInterfaceTo(aProgress.asOutParam());
 
     LogFlowThisFuncLeave();
 
@@ -2376,29 +2582,26 @@ typedef std::list<MediumDeleteRec> MediumDeleteRecList;
  *
  * @note Locks the machine + the snapshot + the media tree for writing!
  *
- * @param aTask Task data.
+ * @param pTask Task data.
  */
-
-void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
+void SessionMachine::i_deleteSnapshotHandler(DeleteSnapshotTask &task)
 {
     LogFlowThisFuncEnter();
 
+    HRESULT rc = S_OK;
     AutoCaller autoCaller(this);
-
-    LogFlowThisFunc(("state=%d\n", autoCaller.state()));
-    if (!autoCaller.isOk())
+    LogFlowThisFunc(("state=%d\n", getObjectState().getState()));
+    if (FAILED(autoCaller.rc()))
     {
         /* we might have been uninitialized because the session was accidentally
          * closed by the client, so don't assert */
-        aTask.pProgress->notifyComplete(E_FAIL,
-                                        COM_IIDOF(IMachine),
-                                        getComponentName(),
-                                        tr("The session has been accidentally closed"));
+        rc = setError(E_FAIL,
+                      tr("The session has been accidentally closed"));
+        task.m_pProgress->i_notifyComplete(rc);
         LogFlowThisFuncLeave();
         return;
     }
 
-    HRESULT rc = S_OK;
     MediumDeleteRecList toDelete;
     Guid snapshotId;
 
@@ -2406,20 +2609,20 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
     {
         /* Locking order:  */
         AutoMultiWriteLock2 multiLock(this->lockHandle(),                   // machine
-                                      aTask.pSnapshot->lockHandle()         // snapshot
+                                      task.m_pSnapshot->lockHandle()        // snapshot
                                       COMMA_LOCKVAL_SRC_POS);
         // once we have this lock, we know that SessionMachine::DeleteSnapshot()
         // has exited after setting the machine state to MachineState_DeletingSnapshot
 
-        AutoWriteLock treeLock(mParent->getMediaTreeLockHandle()
-                                      COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock treeLock(mParent->i_getMediaTreeLockHandle()
+                               COMMA_LOCKVAL_SRC_POS);
 
-        ComObjPtr<SnapshotMachine> pSnapMachine = aTask.pSnapshot->getSnapshotMachine();
+        ComObjPtr<SnapshotMachine> pSnapMachine = task.m_pSnapshot->i_getSnapshotMachine();
         // no need to lock the snapshot machine since it is const by definition
-        Guid machineId = pSnapMachine->getId();
+        Guid machineId = pSnapMachine->i_getId();
 
         // save the snapshot ID (for callbacks)
-        snapshotId = aTask.pSnapshot->getId();
+        snapshotId = task.m_pSnapshot->i_getId();
 
         // first pass:
         LogFlowThisFunc(("1: Checking hard disk merge prerequisites...\n"));
@@ -2435,17 +2638,17 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
         {
             ComObjPtr<MediumAttachment> &pAttach = *it;
             AutoReadLock attachLock(pAttach COMMA_LOCKVAL_SRC_POS);
-            if (pAttach->getType() != DeviceType_HardDisk)
+            if (pAttach->i_getType() != DeviceType_HardDisk)
                 continue;
 
-            ComObjPtr<Medium> pHD = pAttach->getMedium();
+            ComObjPtr<Medium> pHD = pAttach->i_getMedium();
             Assert(!pHD.isNull());
 
             {
                 // writethrough, shareable and readonly images are
                 // unaffected by snapshots, skip them
                 AutoReadLock medlock(pHD COMMA_LOCKVAL_SRC_POS);
-                MediumType_T type = pHD->getType();
+                MediumType_T type = pHD->i_getType();
                 if (   type == MediumType_Writethrough
                     || type == MediumType_Shareable
                     || type == MediumType_Readonly)
@@ -2453,7 +2656,7 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
             }
 
 #ifdef DEBUG
-            pHD->dumpBackRefs();
+            pHD->i_dumpBackRefs();
 #endif
 
             // needs to be merged with child or deleted, check prerequisites
@@ -2463,7 +2666,7 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
             ComObjPtr<Medium> pParentForTarget;
             MediumLockList *pChildrenToReparent = NULL;
             bool fNeedsOnlineMerge = false;
-            bool fOnlineMergePossible = aTask.m_fDeleteOnline;
+            bool fOnlineMergePossible = task.m_fDeleteOnline;
             MediumLockList *pMediumLockList = NULL;
             MediumLockList *pVMMALockList = NULL;
             ComPtr<IToken> pHDLockToken;
@@ -2476,10 +2679,10 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                 // which are simply moved to a different controller slot do not
                 // prevent online merging in general.
                 pOnlineMediumAttachment =
-                    findAttachment(mMediaData->mAttachments,
-                                   pAttach->getControllerName().raw(),
-                                   pAttach->getPort(),
-                                   pAttach->getDevice());
+                    i_findAttachment(mMediaData->mAttachments,
+                                     pAttach->i_getControllerName().raw(),
+                                     pAttach->i_getPort(),
+                                     pAttach->i_getDevice());
                 if (pOnlineMediumAttachment)
                 {
                     rc = mData->mSession.mLockedMedia.Get(pOnlineMediumAttachment,
@@ -2495,14 +2698,14 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
             attachLock.release();
 
             treeLock.release();
-            rc = prepareDeleteSnapshotMedium(pHD, machineId, snapshotId,
-                                             fOnlineMergePossible,
-                                             pVMMALockList, pSource, pTarget,
-                                             fMergeForward, pParentForTarget,
-                                             pChildrenToReparent,
-                                             fNeedsOnlineMerge,
-                                             pMediumLockList,
-                                             pHDLockToken);
+            rc = i_prepareDeleteSnapshotMedium(pHD, machineId, snapshotId,
+                                               fOnlineMergePossible,
+                                               pVMMALockList, pSource, pTarget,
+                                               fMergeForward, pParentForTarget,
+                                               pChildrenToReparent,
+                                               fNeedsOnlineMerge,
+                                               pMediumLockList,
+                                               pHDLockToken);
             treeLock.acquire();
             if (FAILED(rc))
                 throw rc;
@@ -2525,9 +2728,9 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                 // then do a backward merge, i.e. merge its only child onto the
                 // base disk. Here we need then to update the attachment that
                 // refers to the child and have it point to the parent instead
-                Assert(pHD->getChildren().size() == 1);
+                Assert(pHD->i_getChildren().size() == 1);
 
-                ComObjPtr<Medium> pReplaceHD = pHD->getChildren().front();
+                ComObjPtr<Medium> pReplaceHD = pHD->i_getChildren().front();
 
                 ComAssertThrow(pReplaceHD == pSource, E_FAIL);
             }
@@ -2535,13 +2738,13 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
             Guid replaceMachineId;
             Guid replaceSnapshotId;
 
-            const Guid *pReplaceMachineId = pSource->getFirstMachineBackrefId();
+            const Guid *pReplaceMachineId = pSource->i_getFirstMachineBackrefId();
             // minimal sanity checking
             Assert(!pReplaceMachineId || *pReplaceMachineId == mData->mUuid);
             if (pReplaceMachineId)
                 replaceMachineId = *pReplaceMachineId;
 
-            const Guid *pSnapshotId = pSource->getFirstMachineBackrefSnapshotId();
+            const Guid *pSnapshotId = pSource->i_getFirstMachineBackrefSnapshotId();
             if (pSnapshotId)
                 replaceSnapshotId = *pSnapshotId;
 
@@ -2551,7 +2754,7 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                 // Note that the medium attachment object stays associated
                 // with the snapshot until the merge was successful.
                 HRESULT rc2 = S_OK;
-                rc2 = pSource->removeBackReference(replaceMachineId, replaceSnapshotId);
+                rc2 = pSource->i_removeBackReference(replaceMachineId, replaceSnapshotId);
                 AssertComRC(rc2);
 
                 toDelete.push_back(MediumDeleteRec(pHD, pSource, pTarget,
@@ -2608,14 +2811,14 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                 if (FAILED(rc))
                     throw rc;
 
-                if(pTarget_local->isMediumFormatFile())
+                if(pTarget_local->i_isMediumFormatFile())
                 {
-                    int vrc = RTFsQuerySerial(pTarget_local->getLocationFull().c_str(), &pu32Serial);
+                    int vrc = RTFsQuerySerial(pTarget_local->i_getLocationFull().c_str(), &pu32Serial);
                     if (RT_FAILURE(vrc))
                     {
                         rc = setError(E_FAIL,
                                       tr(" Unable to merge storage '%s'. Can't get storage UID "),
-                                      pTarget_local->getLocationFull().c_str());
+                                      pTarget_local->i_getLocationFull().c_str());
                         throw rc;
                     }
 
@@ -2624,7 +2827,7 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                     /* store needed free space in multimap */
                     neededStorageFreeSpace.insert(std::make_pair(pu32Serial,diskSize));
                     /* linking storage UID with snapshot path, it is a helper container (just for easy finding needed path) */
-                    serialMapToStoragePath.insert(std::make_pair(pu32Serial,pTarget_local->getLocationFull().c_str()));
+                    serialMapToStoragePath.insert(std::make_pair(pu32Serial,pTarget_local->i_getLocationFull().c_str()));
                 }
 
                 ++it_md;
@@ -2701,17 +2904,17 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
             // tree is protected by the machine lock as well
             AutoWriteLock machineLock(this COMMA_LOCKVAL_SRC_POS);
 
-            Utf8Str stateFilePath = aTask.pSnapshot->getStateFilePath();
+            Utf8Str stateFilePath = task.m_pSnapshot->i_getStateFilePath();
             if (!stateFilePath.isEmpty())
             {
-                aTask.pProgress->SetNextOperation(Bstr(tr("Deleting the execution state")).raw(),
-                                                  1);        // weight
+                task.m_pProgress->SetNextOperation(Bstr(tr("Deleting the execution state")).raw(),
+                                                   1);        // weight
 
-                releaseSavedStateFile(stateFilePath, aTask.pSnapshot /* pSnapshotToIgnore */);
+                i_releaseSavedStateFile(stateFilePath, task.m_pSnapshot /* pSnapshotToIgnore */);
 
                 // machine will need saving now
                 machineLock.release();
-                mParent->markRegistryModified(getId());
+                mParent->i_markRegistryModified(i_getId());
             }
         }
 
@@ -2729,12 +2932,12 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
 
             {
                 AutoReadLock alock(pMedium COMMA_LOCKVAL_SRC_POS);
-                ulWeight = (ULONG)(pMedium->getSize() / _1M);
+                ulWeight = (ULONG)(pMedium->i_getSize() / _1M);
             }
 
-            aTask.pProgress->SetNextOperation(BstrFmt(tr("Merging differencing image '%s'"),
-                                              pMedium->getName().c_str()).raw(),
-                                              ulWeight);
+            task.m_pProgress->SetNextOperation(BstrFmt(tr("Merging differencing image '%s'"),
+                                               pMedium->i_getName().c_str()).raw(),
+                                               ulWeight);
 
             bool fNeedSourceUninit = false;
             bool fReparentTarget = false;
@@ -2742,23 +2945,23 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
             {
                 /* no real merge needed, just updating state and delete
                  * diff files if necessary */
-                AutoMultiWriteLock2 mLock(&mParent->getMediaTreeLockHandle(), pMedium->lockHandle() COMMA_LOCKVAL_SRC_POS);
+                AutoMultiWriteLock2 mLock(&mParent->i_getMediaTreeLockHandle(), pMedium->lockHandle() COMMA_LOCKVAL_SRC_POS);
 
                 Assert(   !it->mfMergeForward
-                       || pMedium->getChildren().size() == 0);
+                       || pMedium->i_getChildren().size() == 0);
 
                 /* Delete the differencing hard disk (has no children). Two
                  * exceptions: if it's the last medium in the chain or if it's
                  * a backward merge we don't want to handle due to complexity.
                  * In both cases leave the image in place. If it's the first
                  * exception the user can delete it later if he wants. */
-                if (!pMedium->getParent().isNull())
+                if (!pMedium->i_getParent().isNull())
                 {
-                    Assert(pMedium->getState() == MediumState_Deleting);
+                    Assert(pMedium->i_getState() == MediumState_Deleting);
                     /* No need to hold the lock any longer. */
                     mLock.release();
-                    rc = pMedium->deleteStorage(&aTask.pProgress,
-                                                true /* aWait */);
+                    rc = pMedium->i_deleteStorage(&task.m_pProgress,
+                                                  true /* aWait */);
                     if (FAILED(rc))
                         throw rc;
 
@@ -2775,29 +2978,30 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                     // SessionMachine::FinishOnlineMergeMedium can get at it.
                     // This callback will arrive while onlineMergeMedium is
                     // still executing, and there can't be two tasks.
+                    /// @todo r=klaus this hack needs to go, and the logic needs to be "unconvoluted", putting SessionMachine in charge of coordinating the reconfig/resume.
                     mConsoleTaskData.mDeleteSnapshotInfo = (void *)&(*it);
                     // online medium merge, in the direction decided earlier
-                    rc = onlineMergeMedium(it->mpOnlineMediumAttachment,
-                                           it->mpSource,
-                                           it->mpTarget,
-                                           it->mfMergeForward,
-                                           it->mpParentForTarget,
-                                           it->mpChildrenToReparent,
-                                           it->mpMediumLockList,
-                                           aTask.pProgress,
-                                           &fNeedsSave);
+                    rc = i_onlineMergeMedium(it->mpOnlineMediumAttachment,
+                                             it->mpSource,
+                                             it->mpTarget,
+                                             it->mfMergeForward,
+                                             it->mpParentForTarget,
+                                             it->mpChildrenToReparent,
+                                             it->mpMediumLockList,
+                                             task.m_pProgress,
+                                             &fNeedsSave);
                     mConsoleTaskData.mDeleteSnapshotInfo = NULL;
                 }
                 else
                 {
                     // normal medium merge, in the direction decided earlier
-                    rc = it->mpSource->mergeTo(it->mpTarget,
-                                               it->mfMergeForward,
-                                               it->mpParentForTarget,
-                                               it->mpChildrenToReparent,
-                                               it->mpMediumLockList,
-                                               &aTask.pProgress,
-                                               true /* aWait */);
+                    rc = it->mpSource->i_mergeTo(it->mpTarget,
+                                                 it->mfMergeForward,
+                                                 it->mpParentForTarget,
+                                                 it->mpChildrenToReparent,
+                                                 it->mpMediumLockList,
+                                                 &task.m_pProgress,
+                                                 true /* aWait */);
                 }
 
                 // If the merge failed, we need to do our best to have a usable
@@ -2809,11 +3013,11 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                 if (FAILED(rc))
                 {
                     AutoReadLock mlock(it->mpSource COMMA_LOCKVAL_SRC_POS);
-                    if (!it->mpSource->isMediumFormatFile())
+                    if (!it->mpSource->i_isMediumFormatFile())
                         // Diff medium not backed by a file - cannot get status so
                         // be pessimistic.
                         throw rc;
-                    const Utf8Str &loc = it->mpSource->getLocationFull();
+                    const Utf8Str &loc = it->mpSource->i_getLocationFull();
                     // Source medium is still there, so merge failed early.
                     if (RTFileExists(loc.c_str()))
                         throw rc;
@@ -2846,13 +3050,13 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
             ComObjPtr<MediumAttachment> pAtt;
             if (fReparentTarget)
             {
-                pAtt = findAttachment(pSnapMachine->mMediaData->mAttachments,
-                                      it->mpTarget);
-                it->mpTarget->removeBackReference(machineId, snapshotId);
+                pAtt = i_findAttachment(pSnapMachine->mMediaData->mAttachments,
+                                        it->mpTarget);
+                it->mpTarget->i_removeBackReference(machineId, snapshotId);
             }
             else
-                pAtt = findAttachment(pSnapMachine->mMediaData->mAttachments,
-                                      it->mpSource);
+                pAtt = i_findAttachment(pSnapMachine->mMediaData->mAttachments,
+                                        it->mpSource);
             pSnapMachine->mMediaData->mAttachments.remove(pAtt);
 
             if (fReparentTarget)
@@ -2861,18 +3065,18 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                 // There can be only one child snapshot in this case.
                 ComObjPtr<Machine> pMachine = this;
                 Guid childSnapshotId;
-                ComObjPtr<Snapshot> pChildSnapshot = aTask.pSnapshot->getFirstChild();
+                ComObjPtr<Snapshot> pChildSnapshot = task.m_pSnapshot->i_getFirstChild();
                 if (pChildSnapshot)
                 {
-                    pMachine = pChildSnapshot->getSnapshotMachine();
-                    childSnapshotId = pChildSnapshot->getId();
+                    pMachine = pChildSnapshot->i_getSnapshotMachine();
+                    childSnapshotId = pChildSnapshot->i_getId();
                 }
-                pAtt = findAttachment(pMachine->mMediaData->mAttachments, it->mpSource);
+                pAtt = i_findAttachment(pMachine->mMediaData->mAttachments, it->mpSource);
                 if (pAtt)
                 {
                     AutoWriteLock attLock(pAtt COMMA_LOCKVAL_SRC_POS);
-                    pAtt->updateMedium(it->mpTarget);
-                    it->mpTarget->addBackReference(pMachine->mData->mUuid, childSnapshotId);
+                    pAtt->i_updateMedium(it->mpTarget);
+                    it->mpTarget->i_addBackReference(pMachine->mData->mUuid, childSnapshotId);
                 }
                 else
                 {
@@ -2882,7 +3086,7 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                     // already to allow the VM continue execution immediately.
                     // Needs a bit of special treatment due to this difference.
                     if (it->mfNeedsOnlineMerge)
-                        it->mpTarget->addBackReference(pMachine->mData->mUuid, childSnapshotId);
+                        it->mpTarget->i_addBackReference(pMachine->mData->mUuid, childSnapshotId);
                 }
             }
 
@@ -2890,7 +3094,7 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
                 it->mpSource->uninit();
 
             // One attachment is merged, must save the settings
-            mParent->markRegistryModified(getId());
+            mParent->i_markRegistryModified(i_getId());
 
             // prevent calling cancelDeleteSnapshotMedium() for this attachment
             it = toDelete.erase(it);
@@ -2906,11 +3110,11 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
             // tree is protected by the machine lock as well
             AutoWriteLock machineLock(this COMMA_LOCKVAL_SRC_POS);
 
-            aTask.pSnapshot->beginSnapshotDelete();
-            aTask.pSnapshot->uninit();
+            task.m_pSnapshot->i_beginSnapshotDelete();
+            task.m_pSnapshot->uninit();
 
             machineLock.release();
-            mParent->markRegistryModified(getId());
+            mParent->i_markRegistryModified(i_getId());
         }
     }
     catch (HRESULT aRC) {
@@ -2924,20 +3128,18 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
         ErrorInfoKeeper eik;
 
         AutoMultiWriteLock2 multiLock(this->lockHandle(),                   // machine
-                                      &mParent->getMediaTreeLockHandle()    // media tree
+                                      &mParent->i_getMediaTreeLockHandle()    // media tree
                                       COMMA_LOCKVAL_SRC_POS);
 
         // un-prepare the remaining hard disks
         for (MediumDeleteRecList::const_iterator it = toDelete.begin();
              it != toDelete.end();
              ++it)
-        {
-            cancelDeleteSnapshotMedium(it->mpHD, it->mpSource,
-                                       it->mpChildrenToReparent,
-                                       it->mfNeedsOnlineMerge,
-                                       it->mpMediumLockList, it->mpHDLockToken,
-                                       it->mMachineId, it->mSnapshotId);
-        }
+            i_cancelDeleteSnapshotMedium(it->mpHD, it->mpSource,
+                                         it->mpChildrenToReparent,
+                                         it->mfNeedsOnlineMerge,
+                                         it->mpMediumLockList, it->mpHDLockToken,
+                                         it->mMachineId, it->mSnapshotId);
     }
 
     // whether we were successful or not, we need to set the machine
@@ -2949,17 +3151,18 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
 
         // restore the machine state that was saved when the
         // task was started
-        setMachineState(aTask.machineStateBackup);
-        updateMachineStateOnClient();
+        i_setMachineState(task.m_machineStateBackup);
+        if (Global::IsOnline(mData->mMachineState))
+            i_updateMachineStateOnClient();
 
-        mParent->saveModifiedRegistries();
+        mParent->i_saveModifiedRegistries();
     }
 
     // report the result (this will try to fetch current error info on failure)
-    aTask.pProgress->notifyComplete(rc);
+    task.m_pProgress->i_notifyComplete(rc);
 
     if (SUCCEEDED(rc))
-        mParent->onSnapshotDeleted(mData->mUuid, snapshotId);
+        mParent->i_onSnapshotDeleted(mData->mUuid, snapshotId);
 
     LogFlowThisFunc(("Done deleting snapshot (rc=%08X)\n", rc));
     LogFlowThisFuncLeave();
@@ -3001,27 +3204,27 @@ void SessionMachine::deleteSnapshotHandler(DeleteSnapshotTask &aTask)
  * @note Caller must hold media tree lock for writing. This locks this object
  *       and every medium object on the merge chain for writing.
  */
-HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
-                                                    const Guid &aMachineId,
-                                                    const Guid &aSnapshotId,
-                                                    bool fOnlineMergePossible,
-                                                    MediumLockList *aVMMALockList,
-                                                    ComObjPtr<Medium> &aSource,
-                                                    ComObjPtr<Medium> &aTarget,
-                                                    bool &aMergeForward,
-                                                    ComObjPtr<Medium> &aParentForTarget,
-                                                    MediumLockList * &aChildrenToReparent,
-                                                    bool &fNeedsOnlineMerge,
-                                                    MediumLockList * &aMediumLockList,
-                                                    ComPtr<IToken> &aHDLockToken)
-{
-    Assert(!mParent->getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+HRESULT SessionMachine::i_prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
+                                                      const Guid &aMachineId,
+                                                      const Guid &aSnapshotId,
+                                                      bool fOnlineMergePossible,
+                                                      MediumLockList *aVMMALockList,
+                                                      ComObjPtr<Medium> &aSource,
+                                                      ComObjPtr<Medium> &aTarget,
+                                                      bool &aMergeForward,
+                                                      ComObjPtr<Medium> &aParentForTarget,
+                                                      MediumLockList * &aChildrenToReparent,
+                                                      bool &fNeedsOnlineMerge,
+                                                      MediumLockList * &aMediumLockList,
+                                                      ComPtr<IToken> &aHDLockToken)
+{
+    Assert(!mParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
     Assert(!fOnlineMergePossible || VALID_PTR(aVMMALockList));
 
     AutoWriteLock alock(aHD COMMA_LOCKVAL_SRC_POS);
 
     // Medium must not be writethrough/shareable/readonly at this point
-    MediumType_T type = aHD->getType();
+    MediumType_T type = aHD->i_getType();
     AssertReturn(   type != MediumType_Writethrough
                  && type != MediumType_Shareable
                  && type != MediumType_Readonly, E_FAIL);
@@ -3030,7 +3233,7 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
     aMediumLockList = NULL;
     fNeedsOnlineMerge = false;
 
-    if (aHD->getChildren().size() == 0)
+    if (aHD->i_getChildren().size() == 0)
     {
         /* This technically is no merge, set those values nevertheless.
          * Helps with updating the medium attachments. */
@@ -3038,7 +3241,7 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
         aTarget = aHD;
 
         /* special treatment of the last hard disk in the chain: */
-        if (aHD->getParent().isNull())
+        if (aHD->i_getParent().isNull())
         {
             /* lock only, to prevent any usage until the snapshot deletion
              * is completed */
@@ -3048,26 +3251,26 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
 
         /* the differencing hard disk w/o children will be deleted, protect it
          * from attaching to other VMs (this is why Deleting) */
-        return aHD->markForDeletion();
+        return aHD->i_markForDeletion();
    }
 
     /* not going multi-merge as it's too expensive */
-    if (aHD->getChildren().size() > 1)
+    if (aHD->i_getChildren().size() > 1)
         return setError(E_FAIL,
                         tr("Hard disk '%s' has more than one child hard disk (%d)"),
-                        aHD->getLocationFull().c_str(),
-                        aHD->getChildren().size());
+                        aHD->i_getLocationFull().c_str(),
+                        aHD->i_getChildren().size());
 
-    ComObjPtr<Medium> pChild = aHD->getChildren().front();
+    ComObjPtr<Medium> pChild = aHD->i_getChildren().front();
 
     AutoWriteLock childLock(pChild COMMA_LOCKVAL_SRC_POS);
 
     /* the rest is a normal merge setup */
-    if (aHD->getParent().isNull())
+    if (aHD->i_getParent().isNull())
     {
         /* base hard disk, backward merge */
-        const Guid *pMachineId1 = pChild->getFirstMachineBackrefId();
-        const Guid *pMachineId2 = aHD->getFirstMachineBackrefId();
+        const Guid *pMachineId1 = pChild->i_getFirstMachineBackrefId();
+        const Guid *pMachineId2 = aHD->i_getFirstMachineBackrefId();
         if (pMachineId1 && pMachineId2 && *pMachineId1 != *pMachineId2)
         {
             /* backward merge is too tricky, we'll just detach on snapshot
@@ -3087,7 +3290,7 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
 
         childLock.release();
         alock.release();
-        HRESULT rc = aHD->queryPreferredMergeDirection(pChild, fMergeForward);
+        HRESULT rc = aHD->i_queryPreferredMergeDirection(pChild, fMergeForward);
         alock.acquire();
         childLock.acquire();
 
@@ -3098,23 +3301,23 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
         {
             aSource = aHD;
             aTarget = pChild;
-            LogFlowFunc(("Forward merging selected\n"));
+            LogFlowThisFunc(("Forward merging selected\n"));
         }
         else
         {
             aSource = pChild;
             aTarget = aHD;
-            LogFlowFunc(("Backward merging selected\n"));
+            LogFlowThisFunc(("Backward merging selected\n"));
         }
     }
 
     HRESULT rc;
     childLock.release();
     alock.release();
-    rc = aSource->prepareMergeTo(aTarget, &aMachineId, &aSnapshotId,
-                                 !fOnlineMergePossible /* fLockMedia */,
-                                 aMergeForward, aParentForTarget,
-                                 aChildrenToReparent, aMediumLockList);
+    rc = aSource->i_prepareMergeTo(aTarget, &aMachineId, &aSnapshotId,
+                                   !fOnlineMergePossible /* fLockMedia */,
+                                   aMergeForward, aParentForTarget,
+                                   aChildrenToReparent, aMediumLockList);
     alock.acquire();
     childLock.acquire();
     if (SUCCEEDED(rc) && fOnlineMergePossible)
@@ -3221,10 +3424,10 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
                 childLock.acquire();
                 if (FAILED(rc))
                 {
-                    aSource->cancelMergeTo(aChildrenToReparent, aMediumLockList);
+                    aSource->i_cancelMergeTo(aChildrenToReparent, aMediumLockList);
                     rc = setError(rc,
                                   tr("Cannot lock hard disk '%s' for a live merge"),
-                                  aHD->getLocationFull().c_str());
+                                  aHD->i_getLocationFull().c_str());
                 }
                 else
                 {
@@ -3235,10 +3438,10 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
             }
             else
             {
-                aSource->cancelMergeTo(aChildrenToReparent, aMediumLockList);
+                aSource->i_cancelMergeTo(aChildrenToReparent, aMediumLockList);
                 rc = setError(rc,
                               tr("Failed to construct lock list for a live merge of hard disk '%s'"),
-                              aHD->getLocationFull().c_str());
+                              aHD->i_getLocationFull().c_str());
             }
 
             // fix the VM's lock list if anything failed
@@ -3261,17 +3464,17 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
                     AutoWriteLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS);
                     // blindly apply this, only needed for medium objects which
                     // would be deleted as part of the merge
-                    pMedium->unmarkLockedForDeletion();
+                    pMedium->i_unmarkLockedForDeletion();
                 }
             }
 
         }
         else
         {
-            aSource->cancelMergeTo(aChildrenToReparent, aMediumLockList);
+            aSource->i_cancelMergeTo(aChildrenToReparent, aMediumLockList);
             rc = setError(rc,
                           tr("Cannot lock hard disk '%s' for an offline merge"),
-                          aHD->getLocationFull().c_str());
+                          aHD->i_getLocationFull().c_str());
         }
     }
 
@@ -3294,22 +3497,22 @@ HRESULT SessionMachine::prepareDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD
  *
  * @note Locks the medium tree and the hard disks in the chain for writing.
  */
-void SessionMachine::cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
-                                                const ComObjPtr<Medium> &aSource,
-                                                MediumLockList *aChildrenToReparent,
-                                                bool fNeedsOnlineMerge,
-                                                MediumLockList *aMediumLockList,
-                                                const ComPtr<IToken> &aHDLockToken,
-                                                const Guid &aMachineId,
-                                                const Guid &aSnapshotId)
+void SessionMachine::i_cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
+                                                  const ComObjPtr<Medium> &aSource,
+                                                  MediumLockList *aChildrenToReparent,
+                                                  bool fNeedsOnlineMerge,
+                                                  MediumLockList *aMediumLockList,
+                                                  const ComPtr<IToken> &aHDLockToken,
+                                                  const Guid &aMachineId,
+                                                  const Guid &aSnapshotId)
 {
     if (aMediumLockList == NULL)
     {
-        AutoMultiWriteLock2 mLock(&mParent->getMediaTreeLockHandle(), aHD->lockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoMultiWriteLock2 mLock(&mParent->i_getMediaTreeLockHandle(), aHD->lockHandle() COMMA_LOCKVAL_SRC_POS);
 
-        Assert(aHD->getChildren().size() == 0);
+        Assert(aHD->i_getChildren().size() == 0);
 
-        if (aHD->getParent().isNull())
+        if (aHD->i_getParent().isNull())
         {
             Assert(!aHDLockToken.isNull());
             if (!aHDLockToken.isNull())
@@ -3320,7 +3523,7 @@ void SessionMachine::cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
         }
         else
         {
-            HRESULT rc = aHD->unmarkForDeletion();
+            HRESULT rc = aHD->i_unmarkForDeletion();
             AssertComRC(rc);
         }
     }
@@ -3330,7 +3533,7 @@ void SessionMachine::cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
         {
             // Online merge uses the medium lock list of the VM, so give
             // an empty list to cancelMergeTo so that it works as designed.
-            aSource->cancelMergeTo(aChildrenToReparent, new MediumLockList());
+            aSource->i_cancelMergeTo(aChildrenToReparent, new MediumLockList());
 
             // clean up the VM medium lock list ourselves
             MediumLockList::Base::iterator lockListBegin =
@@ -3345,13 +3548,13 @@ void SessionMachine::cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
             {
                 ComObjPtr<Medium> pMedium = it->GetMedium();
                 AutoWriteLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS);
-                if (pMedium->getState() == MediumState_Deleting)
-                    pMedium->unmarkForDeletion();
+                if (pMedium->i_getState() == MediumState_Deleting)
+                    pMedium->i_unmarkForDeletion();
                 else
                 {
                     // blindly apply this, only needed for medium objects which
                     // would be deleted as part of the merge
-                    pMedium->unmarkLockedForDeletion();
+                    pMedium->i_unmarkLockedForDeletion();
                 }
                 mediumLock.release();
                 it->UpdateLock(it == lockListLast);
@@ -3360,14 +3563,14 @@ void SessionMachine::cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
         }
         else
         {
-            aSource->cancelMergeTo(aChildrenToReparent, aMediumLockList);
+            aSource->i_cancelMergeTo(aChildrenToReparent, aMediumLockList);
         }
     }
 
     if (aMachineId.isValid() && !aMachineId.isZero())
     {
         // reattach the source media to the snapshot
-        HRESULT rc = aSource->addBackReference(aMachineId, aSnapshotId);
+        HRESULT rc = aSource->i_addBackReference(aMachineId, aSnapshotId);
         AssertComRC(rc);
     }
 }
@@ -3390,15 +3593,15 @@ void SessionMachine::cancelDeleteSnapshotMedium(const ComObjPtr<Medium> &aHD,
  * @param aProgress     Progress indicator.
  * @param pfNeedsMachineSaveSettings Whether the VM settings need to be saved (out).
  */
-HRESULT SessionMachine::onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,
-                                          const ComObjPtr<Medium> &aSource,
-                                          const ComObjPtr<Medium> &aTarget,
-                                          bool fMergeForward,
-                                          const ComObjPtr<Medium> &aParentForTarget,
-                                          MediumLockList *aChildrenToReparent,
-                                          MediumLockList *aMediumLockList,
-                                          ComObjPtr<Progress> &aProgress,
-                                          bool *pfNeedsMachineSaveSettings)
+HRESULT SessionMachine::i_onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMediumAttachment,
+                                            const ComObjPtr<Medium> &aSource,
+                                            const ComObjPtr<Medium> &aTarget,
+                                            bool fMergeForward,
+                                            const ComObjPtr<Medium> &aParentForTarget,
+                                            MediumLockList *aChildrenToReparent,
+                                            MediumLockList *aMediumLockList,
+                                            ComObjPtr<Progress> &aProgress,
+                                            bool *pfNeedsMachineSaveSettings)
 {
     AssertReturn(aSource != NULL, E_FAIL);
     AssertReturn(aTarget != NULL, E_FAIL);
@@ -3477,7 +3680,7 @@ HRESULT SessionMachine::onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMe
 }
 
 /**
- * Implementation for IInternalMachineControl::FinishOnlineMergeMedium().
+ * Implementation for IInternalMachineControl::finishOnlineMergeMedium().
  *
  * Gets called after the successful completion of an online merge from
  * Console::onlineMergeMedium(), which gets invoked indirectly above in
@@ -3486,7 +3689,7 @@ HRESULT SessionMachine::onlineMergeMedium(const ComObjPtr<MediumAttachment> &aMe
  * This updates the medium information and medium state so that the VM
  * can continue with the updated state of the medium chain.
  */
-STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
+HRESULT SessionMachine::finishOnlineMergeMedium()
 {
     HRESULT rc = S_OK;
     MediumDeleteRec *pDeleteRec = (MediumDeleteRec *)mConsoleTaskData.mDeleteSnapshotInfo;
@@ -3496,7 +3699,7 @@ STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
     // all hard disks but the target were successfully deleted by
     // the merge; reparent target if necessary and uninitialize media
 
-    AutoWriteLock treeLock(mParent->getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock treeLock(mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     // Declare this here to make sure the object does not get uninitialized
     // before this method completes. Would normally happen as halfway through
@@ -3507,27 +3710,27 @@ STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
     {
         // first, unregister the target since it may become a base
         // hard disk which needs re-registration
-        rc = mParent->unregisterMedium(pDeleteRec->mpTarget);
+        rc = mParent->i_unregisterMedium(pDeleteRec->mpTarget);
         AssertComRC(rc);
 
         // then, reparent it and disconnect the deleted branch at
         // both ends (chain->parent() is source's parent)
-        pDeleteRec->mpTarget->deparent();
-        pDeleteRec->mpTarget->setParent(pDeleteRec->mpParentForTarget);
+        pDeleteRec->mpTarget->i_deparent();
+        pDeleteRec->mpTarget->i_setParent(pDeleteRec->mpParentForTarget);
         if (pDeleteRec->mpParentForTarget)
-            pDeleteRec->mpSource->deparent();
+            pDeleteRec->mpSource->i_deparent();
 
         // then, register again
-        rc = mParent->registerMedium(pDeleteRec->mpTarget, &pDeleteRec->mpTarget, DeviceType_HardDisk, treeLock);
+        rc = mParent->i_registerMedium(pDeleteRec->mpTarget, &pDeleteRec->mpTarget, treeLock);
         AssertComRC(rc);
     }
     else
     {
-        Assert(pDeleteRec->mpTarget->getChildren().size() == 1);
-        targetChild = pDeleteRec->mpTarget->getChildren().front();
+        Assert(pDeleteRec->mpTarget->i_getChildren().size() == 1);
+        targetChild = pDeleteRec->mpTarget->i_getChildren().front();
 
         // disconnect the deleted branch at the elder end
-        targetChild->deparent();
+        targetChild->i_deparent();
 
         // Update parent UUIDs of the source's children, reparent them and
         // disconnect the deleted branch at the younger end
@@ -3540,7 +3743,7 @@ STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
             // we must continue. The worst possible result is that the images
             // need manual fixing via VBoxManage to adjust the parent UUID.
             treeLock.release();
-            pDeleteRec->mpTarget->fixParentUuidOfChildren(pDeleteRec->mpChildrenToReparent);
+            pDeleteRec->mpTarget->i_fixParentUuidOfChildren(pDeleteRec->mpChildrenToReparent);
             // The childen are still write locked, unlock them now and don't
             // rely on the destructor doing it very late.
             pDeleteRec->mpChildrenToReparent->Unlock();
@@ -3558,8 +3761,8 @@ STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
                 Medium *pMedium = it->GetMedium();
                 AutoWriteLock childLock(pMedium COMMA_LOCKVAL_SRC_POS);
 
-                pMedium->deparent();  // removes pMedium from source
-                pMedium->setParent(pDeleteRec->mpTarget);
+                pMedium->i_deparent();  // removes pMedium from source
+                pMedium->i_setParent(pDeleteRec->mpTarget);
             }
         }
     }
@@ -3584,13 +3787,13 @@ STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
 
         /* The target and all images not merged (readonly) are skipped */
         if (   pMedium == pDeleteRec->mpTarget
-            || pMedium->getState() == MediumState_LockedRead)
+            || pMedium->i_getState() == MediumState_LockedRead)
         {
             ++it;
         }
         else
         {
-            rc = mParent->unregisterMedium(pMedium);
+            rc = mParent->i_unregisterMedium(pMedium);
             AssertComRC(rc);
 
             /* now, uninitialize the deleted hard disk (note that
@@ -3607,8 +3810,8 @@ STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
              * the caller's responsibility) */
             if (pMedium == pDeleteRec->mpSource)
             {
-                Assert(pDeleteRec->mpSource->getChildren().size() == 0);
-                Assert(pDeleteRec->mpSource->getFirstMachineBackrefId() == NULL);
+                Assert(pDeleteRec->mpSource->i_getChildren().size() == 0);
+                Assert(pDeleteRec->mpSource->i_getFirstMachineBackrefId() == NULL);
             }
 
             /* Delete the medium lock list entry, which also releases the
@@ -3617,7 +3820,9 @@ STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
             rc = pMediumLockList->RemoveByIterator(it);
             AssertComRC(rc);
 
+            treeLock.release();
             pMedium->uninit();
+            treeLock.acquire();
         }
 
         /* Stop as soon as we reached the last medium affected by the merge.
@@ -3647,7 +3852,7 @@ STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
     if (!pDeleteRec->mfMergeForward && !fSourceHasChildren)
     {
         AutoWriteLock attLock(pDeleteRec->mpOnlineMediumAttachment COMMA_LOCKVAL_SRC_POS);
-        pDeleteRec->mpOnlineMediumAttachment->updateMedium(pDeleteRec->mpTarget);
+        pDeleteRec->mpOnlineMediumAttachment->i_updateMedium(pDeleteRec->mpTarget);
     }
 
     return S_OK;
diff --git a/src/VBox/Main/src-server/StorageControllerImpl.cpp b/src/VBox/Main/src-server/StorageControllerImpl.cpp
index b568693..a25eeb5 100644
--- a/src/VBox/Main/src-server/StorageControllerImpl.cpp
+++ b/src/VBox/Main/src-server/StorageControllerImpl.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -36,6 +36,9 @@
 
 // defines
 /////////////////////////////////////////////////////////////////////////////
+//
+//
+DEFINE_EMPTY_CTOR_DTOR(StorageController)
 
 struct BackupableStorageControllerData
 {
@@ -86,19 +89,19 @@ struct StorageController::Data
           pSystemProperties(NULL),
           pParent(aMachine)
     {
-        unconst(pVirtualBox) = aMachine->getVirtualBox();
-        unconst(pSystemProperties) = pVirtualBox->getSystemProperties();
+        unconst(pVirtualBox) = aMachine->i_getVirtualBox();
+        unconst(pSystemProperties) = pVirtualBox->i_getSystemProperties();
     }
 
     VirtualBox * const                  pVirtualBox;
     SystemProperties * const            pSystemProperties;
-
     Machine * const                     pParent;
     const ComObjPtr<StorageController>  pPeer;
 
     Backupable<BackupableStorageControllerData> bd;
 };
 
+
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
@@ -134,7 +137,7 @@ HRESULT StorageController::init(Machine *aParent,
 
     ComAssertRet(aParent && !aName.isEmpty(), E_INVALIDARG);
     if (   (aStorageBus <= StorageBus_Null)
-        || (aStorageBus >  StorageBus_SAS))
+        || (aStorageBus >  StorageBus_USB))
         return setError(E_INVALIDARG,
                         tr("Invalid storage connection type"));
 
@@ -143,7 +146,8 @@ HRESULT StorageController::init(Machine *aParent,
     HRESULT rc = aParent->COMGETTER(ChipsetType)(&chipsetType);
     if (FAILED(rc))
         return rc;
-    rc = aParent->getVirtualBox()->getSystemProperties()->GetMaxInstancesOfStorageBus(chipsetType, aStorageBus, &maxInstances);
+    rc = aParent->i_getVirtualBox()->i_getSystemProperties()->
+        GetMaxInstancesOfStorageBus(chipsetType, aStorageBus, &maxInstances);
     if (FAILED(rc))
         return rc;
     if (aInstance >= maxInstances)
@@ -191,6 +195,9 @@ HRESULT StorageController::init(Machine *aParent,
         case StorageBus_SAS:
             m->bd->mPortCount = 8;
             m->bd->mStorageControllerType = StorageControllerType_LsiLogicSas;
+        case StorageBus_USB:
+            m->bd->mPortCount = 8;
+            m->bd->mStorageControllerType = StorageControllerType_USB;
             break;
     }
 
@@ -311,27 +318,20 @@ void StorageController::uninit()
 
 
 // IStorageController properties
-/////////////////////////////////////////////////////////////////////////////
-STDMETHODIMP StorageController::COMGETTER(Name) (BSTR *aName)
+HRESULT StorageController::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* mName is constant during life time, no need to lock */
-    m->bd.data()->strName.cloneTo(aName);
+    aName = m->bd.data()->strName;
 
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMGETTER(Bus) (StorageBus_T *aBus)
+HRESULT StorageController::getBus(StorageBus_T *aBus)
 {
     CheckComArgOutPointerValid(aBus);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aBus = m->bd->mStorageBus;
@@ -339,13 +339,10 @@ STDMETHODIMP StorageController::COMGETTER(Bus) (StorageBus_T *aBus)
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMGETTER(ControllerType) (StorageControllerType_T *aControllerType)
+HRESULT StorageController::getControllerType(StorageControllerType_T *aControllerType)
 {
     CheckComArgOutPointerValid(aControllerType);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aControllerType = m->bd->mStorageControllerType;
@@ -353,11 +350,8 @@ STDMETHODIMP StorageController::COMGETTER(ControllerType) (StorageControllerType
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMSETTER(ControllerType) (StorageControllerType_T aControllerType)
+HRESULT StorageController::setControllerType(StorageControllerType_T aControllerType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
@@ -397,6 +391,12 @@ STDMETHODIMP StorageController::COMSETTER(ControllerType) (StorageControllerType
                 rc = E_INVALIDARG;
             break;
         }
+        case StorageBus_USB:
+        {
+            if (aControllerType != StorageControllerType_USB)
+                rc = E_INVALIDARG;
+            break;
+        }
         default:
             AssertMsgFailed(("Invalid controller type %d\n", m->bd->mStorageBus));
     }
@@ -411,53 +411,41 @@ STDMETHODIMP StorageController::COMSETTER(ControllerType) (StorageControllerType
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMGETTER(MaxDevicesPerPortCount) (ULONG *aMaxDevices)
+HRESULT StorageController::getMaxDevicesPerPortCount(ULONG *aMaxDevicesPerPortCount)
 {
-    CheckComArgOutPointerValid(aMaxDevices);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    CheckComArgOutPointerValid(aMaxDevicesPerPortCount);
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->mStorageBus, aMaxDevices);
+
+    HRESULT rc = m->pSystemProperties->GetMaxDevicesPerPortForStorageBus(m->bd->mStorageBus, aMaxDevicesPerPortCount);
 
     return rc;
 }
 
-STDMETHODIMP StorageController::COMGETTER(MinPortCount) (ULONG *aMinPortCount)
+HRESULT StorageController::getMinPortCount(ULONG *aMinPortCount)
 {
     CheckComArgOutPointerValid(aMinPortCount);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = m->pSystemProperties->GetMinPortCountForStorageBus(m->bd->mStorageBus, aMinPortCount);
 
+    HRESULT rc = m->pSystemProperties->GetMinPortCountForStorageBus(m->bd->mStorageBus, aMinPortCount);
     return rc;
 }
 
-STDMETHODIMP StorageController::COMGETTER(MaxPortCount) (ULONG *aMaxPortCount)
+HRESULT StorageController::getMaxPortCount(ULONG *aMaxPortCount)
 {
     CheckComArgOutPointerValid(aMaxPortCount);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     HRESULT rc = m->pSystemProperties->GetMaxPortCountForStorageBus(m->bd->mStorageBus, aMaxPortCount);
 
     return rc;
 }
 
-
-STDMETHODIMP StorageController::COMGETTER(PortCount) (ULONG *aPortCount)
+HRESULT StorageController::getPortCount(ULONG *aPortCount)
 {
     CheckComArgOutPointerValid(aPortCount);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aPortCount = m->bd->mPortCount;
@@ -465,8 +453,7 @@ STDMETHODIMP StorageController::COMGETTER(PortCount) (ULONG *aPortCount)
     return S_OK;
 }
 
-
-STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount)
+HRESULT StorageController::setPortCount(ULONG aPortCount)
 {
     LogFlowThisFunc(("aPortCount=%u\n", aPortCount));
 
@@ -519,6 +506,15 @@ STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount)
         }
         case StorageBus_SAS:
         {
+            /* SAS supports a maximum of 255 ports. */
+            if (aPortCount < 1 || aPortCount > 255)
+                return setError(E_INVALIDARG,
+                                tr("Invalid port count: %lu (must be in range [%lu, %lu])"),
+                                aPortCount, 1, 255);
+            break;
+        }
+        case StorageBus_USB:
+        {
             /*
              * The port count is fixed to 8.
              */
@@ -548,20 +544,17 @@ STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount)
 
         alock.release();
         AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS);        // m->pParent is const, needs no locking
-        m->pParent->setModified(Machine::IsModified_Storage);
+        m->pParent->i_setModified(Machine::IsModified_Storage);
         mlock.release();
 
-        m->pParent->onStorageControllerChange();
+        m->pParent->i_onStorageControllerChange();
     }
 
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMGETTER(Instance) (ULONG *aInstance)
+HRESULT StorageController::getInstance(ULONG *aInstance)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* The machine doesn't need to be mutable. */
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -571,11 +564,8 @@ STDMETHODIMP StorageController::COMGETTER(Instance) (ULONG *aInstance)
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMSETTER(Instance) (ULONG aInstance)
+HRESULT StorageController::setInstance(ULONG aInstance)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* The machine doesn't need to be mutable. */
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -585,11 +575,8 @@ STDMETHODIMP StorageController::COMSETTER(Instance) (ULONG aInstance)
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMGETTER(UseHostIOCache) (BOOL *fUseHostIOCache)
+HRESULT StorageController::getUseHostIOCache(BOOL *fUseHostIOCache)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* The machine doesn't need to be mutable. */
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -599,11 +586,8 @@ STDMETHODIMP StorageController::COMGETTER(UseHostIOCache) (BOOL *fUseHostIOCache
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMSETTER(UseHostIOCache) (BOOL fUseHostIOCache)
+HRESULT StorageController::setUseHostIOCache(BOOL fUseHostIOCache)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
     AutoMutableStateDependency adep(m->pParent);
     if (FAILED(adep.rc())) return adep.rc();
@@ -617,19 +601,17 @@ STDMETHODIMP StorageController::COMSETTER(UseHostIOCache) (BOOL fUseHostIOCache)
 
         alock.release();
         AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS);        // m->pParent is const, needs no locking
-        m->pParent->setModified(Machine::IsModified_Storage);
+        m->pParent->i_setModified(Machine::IsModified_Storage);
         mlock.release();
 
-        m->pParent->onStorageControllerChange();
+        m->pParent->i_onStorageControllerChange();
     }
 
     return S_OK;
 }
 
-STDMETHODIMP StorageController::COMGETTER(Bootable) (BOOL *fBootable)
+HRESULT StorageController::getBootable(BOOL *fBootable)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     /* The machine doesn't need to be mutable. */
 
@@ -643,7 +625,7 @@ STDMETHODIMP StorageController::COMGETTER(Bootable) (BOOL *fBootable)
 // public methods only for internal purposes
 /////////////////////////////////////////////////////////////////////////////
 
-HRESULT StorageController::getIDEEmulationPort(LONG DevicePosition, LONG *aPortNumber)
+HRESULT StorageController::i_getIDEEmulationPort(LONG DevicePosition, LONG *aPortNumber)
 {
     CheckComArgOutPointerValid(aPortNumber);
 
@@ -677,7 +659,7 @@ HRESULT StorageController::getIDEEmulationPort(LONG DevicePosition, LONG *aPortN
     return S_OK;
 }
 
-HRESULT StorageController::setIDEEmulationPort(LONG DevicePosition, LONG aPortNumber)
+HRESULT StorageController::i_setIDEEmulationPort(LONG DevicePosition, LONG aPortNumber)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -717,27 +699,27 @@ HRESULT StorageController::setIDEEmulationPort(LONG DevicePosition, LONG aPortNu
     return S_OK;
 }
 
-const Utf8Str& StorageController::getName() const
+const Utf8Str& StorageController::i_getName() const
 {
     return m->bd->strName;
 }
 
-StorageControllerType_T StorageController::getControllerType() const
+StorageControllerType_T StorageController::i_getControllerType() const
 {
     return m->bd->mStorageControllerType;
 }
 
-StorageBus_T StorageController::getStorageBus() const
+StorageBus_T StorageController::i_getStorageBus() const
 {
     return m->bd->mStorageBus;
 }
 
-ULONG StorageController::getInstance() const
+ULONG StorageController::i_getInstance() const
 {
     return m->bd->mInstance;
 }
 
-bool StorageController::getBootable() const
+bool StorageController::i_getBootable() const
 {
     return !!m->bd->fBootable;
 }
@@ -749,8 +731,8 @@ bool StorageController::getBootable() const
  * @param ulDevice
  * @return
  */
-HRESULT StorageController::checkPortAndDeviceValid(LONG aControllerPort,
-                                                   LONG aDevice)
+HRESULT StorageController::i_checkPortAndDeviceValid(LONG aControllerPort,
+                                                     LONG aDevice)
 {
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -772,7 +754,7 @@ HRESULT StorageController::checkPortAndDeviceValid(LONG aControllerPort,
 }
 
 /** @note Locks objects for writing! */
-void StorageController::setBootable(BOOL fBootable)
+void StorageController::i_setBootable(BOOL fBootable)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -784,7 +766,7 @@ void StorageController::setBootable(BOOL fBootable)
 }
 
 /** @note Locks objects for writing! */
-void StorageController::rollback()
+void StorageController::i_rollback()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -798,7 +780,7 @@ void StorageController::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void StorageController::commit()
+void StorageController::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -830,7 +812,7 @@ void StorageController::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void StorageController::unshare()
+void StorageController::i_unshare()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -856,12 +838,12 @@ void StorageController::unshare()
     unconst(m->pPeer) = NULL;
 }
 
-Machine* StorageController::getMachine()
+Machine* StorageController::i_getMachine()
 {
     return m->pParent;
 }
 
-ComObjPtr<StorageController> StorageController::getPeer()
+ComObjPtr<StorageController> StorageController::i_getPeer()
 {
     return m->pPeer;
 }
diff --git a/src/VBox/Main/src-server/SystemPropertiesImpl.cpp b/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
index 7f0ed6e..f7d40a1 100644
--- a/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
+++ b/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
@@ -89,12 +89,12 @@ HRESULT SystemProperties::init(VirtualBox *aParent)
 
     unconst(mParent) = aParent;
 
-    setDefaultMachineFolder(Utf8Str::Empty);
-    setLoggingLevel(Utf8Str::Empty);
-    setDefaultHardDiskFormat(Utf8Str::Empty);
+    i_setDefaultMachineFolder(Utf8Str::Empty);
+    i_setLoggingLevel(Utf8Str::Empty);
+    i_setDefaultHardDiskFormat(Utf8Str::Empty);
 
-    setVRDEAuthLibrary(Utf8Str::Empty);
-    setDefaultVRDEExtPack(Utf8Str::Empty);
+    i_setVRDEAuthLibrary(Utf8Str::Empty);
+    i_setDefaultVRDEExtPack(Utf8Str::Empty);
 
     m->ulLogHistoryCount = 3;
 
@@ -159,17 +159,12 @@ void SystemProperties::uninit()
     unconst(mParent) = NULL;
 }
 
-// ISystemProperties properties
+// wrapped ISystemProperties properties
 /////////////////////////////////////////////////////////////////////////////
 
+HRESULT SystemProperties::getMinGuestRAM(ULONG *minRAM)
 
-STDMETHODIMP SystemProperties::COMGETTER(MinGuestRAM)(ULONG *minRAM)
 {
-    CheckComArgOutPointerValid(minRAM);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     AssertCompile(MM_RAM_MIN_IN_MB >= SchemaDefs::MinGuestRAM);
     *minRAM = MM_RAM_MIN_IN_MB;
@@ -177,13 +172,8 @@ STDMETHODIMP SystemProperties::COMGETTER(MinGuestRAM)(ULONG *minRAM)
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(MaxGuestRAM)(ULONG *maxRAM)
+HRESULT SystemProperties::getMaxGuestRAM(ULONG *maxRAM)
 {
-    CheckComArgOutPointerValid(maxRAM);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     AssertCompile(MM_RAM_MAX_IN_MB <= SchemaDefs::MaxGuestRAM);
     ULONG maxRAMSys = MM_RAM_MAX_IN_MB;
@@ -193,64 +183,40 @@ STDMETHODIMP SystemProperties::COMGETTER(MaxGuestRAM)(ULONG *maxRAM)
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(MinGuestVRAM)(ULONG *minVRAM)
+HRESULT SystemProperties::getMinGuestVRAM(ULONG *minVRAM)
 {
-    CheckComArgOutPointerValid(minVRAM);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     *minVRAM = SchemaDefs::MinGuestVRAM;
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(MaxGuestVRAM)(ULONG *maxVRAM)
+HRESULT SystemProperties::getMaxGuestVRAM(ULONG *maxVRAM)
 {
-    CheckComArgOutPointerValid(maxVRAM);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     *maxVRAM = SchemaDefs::MaxGuestVRAM;
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(MinGuestCPUCount)(ULONG *minCPUCount)
+HRESULT SystemProperties::getMinGuestCPUCount(ULONG *minCPUCount)
 {
-    CheckComArgOutPointerValid(minCPUCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     *minCPUCount = SchemaDefs::MinCPUCount; // VMM_MIN_CPU_COUNT
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(MaxGuestCPUCount)(ULONG *maxCPUCount)
+HRESULT SystemProperties::getMaxGuestCPUCount(ULONG *maxCPUCount)
 {
-    CheckComArgOutPointerValid(maxCPUCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     *maxCPUCount = SchemaDefs::MaxCPUCount; // VMM_MAX_CPU_COUNT
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(MaxGuestMonitors)(ULONG *maxMonitors)
+HRESULT SystemProperties::getMaxGuestMonitors(ULONG *maxMonitors)
 {
-    CheckComArgOutPointerValid(maxMonitors);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     /* no need to lock, this is const */
     *maxMonitors = SchemaDefs::MaxGuestMonitors;
@@ -258,13 +224,9 @@ STDMETHODIMP SystemProperties::COMGETTER(MaxGuestMonitors)(ULONG *maxMonitors)
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(InfoVDSize)(LONG64 *infoVDSize)
-{
-    CheckComArgOutPointerValid(infoVDSize);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SystemProperties::getInfoVDSize(LONG64 *infoVDSize)
+{
     /*
      * The BIOS supports currently 32 bit LBA numbers (implementing the full
      * 48 bit range is in theory trivial, but the crappy compiler makes things
@@ -286,39 +248,27 @@ STDMETHODIMP SystemProperties::COMGETTER(InfoVDSize)(LONG64 *infoVDSize)
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count)
-{
-    CheckComArgOutPointerValid(count);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SystemProperties::getSerialPortCount(ULONG *count)
+{
     /* no need to lock, this is const */
     *count = SchemaDefs::SerialPortCount;
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(ParallelPortCount)(ULONG *count)
-{
-    CheckComArgOutPointerValid(count);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SystemProperties::getParallelPortCount(ULONG *count)
+{
     /* no need to lock, this is const */
     *count = SchemaDefs::ParallelPortCount;
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(MaxBootPosition)(ULONG *aMaxBootPosition)
-{
-    CheckComArgOutPointerValid(aMaxBootPosition);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SystemProperties::getMaxBootPosition(ULONG *aMaxBootPosition)
+{
     /* no need to lock, this is const */
     *aMaxBootPosition = SchemaDefs::MaxBootPosition;
 
@@ -326,13 +276,8 @@ STDMETHODIMP SystemProperties::COMGETTER(MaxBootPosition)(ULONG *aMaxBootPositio
 }
 
 
-STDMETHODIMP SystemProperties::COMGETTER(ExclusiveHwVirt)(BOOL *aExclusiveHwVirt)
+HRESULT SystemProperties::getExclusiveHwVirt(BOOL *aExclusiveHwVirt)
 {
-    CheckComArgOutPointerValid(aExclusiveHwVirt);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aExclusiveHwVirt = m->fExclusiveHwVirt;
@@ -340,46 +285,31 @@ STDMETHODIMP SystemProperties::COMGETTER(ExclusiveHwVirt)(BOOL *aExclusiveHwVirt
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(ExclusiveHwVirt)(BOOL aExclusiveHwVirt)
+HRESULT SystemProperties::setExclusiveHwVirt(BOOL aExclusiveHwVirt)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     m->fExclusiveHwVirt = !!aExclusiveHwVirt;
     alock.release();
 
-    // VirtualBox::saveSettings() needs vbox write lock
+    // VirtualBox::i_saveSettings() needs vbox write lock
     AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mParent->saveSettings();
+    HRESULT rc = mParent->i_saveSettings();
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::GetMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *count)
+HRESULT SystemProperties::getMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *aMaxNetworkAdapters)
 {
-    CheckComArgOutPointerValid(count);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need for locking, no state */
     uint32_t uResult = Global::getMaxNetworkAdapters(aChipset);
     if (uResult == 0)
         AssertMsgFailed(("Invalid chipset type %d\n", aChipset));
-
-    *count = uResult;
-
+    *aMaxNetworkAdapters = uResult;
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::GetMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *count)
+HRESULT SystemProperties::getMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *count)
 {
-    CheckComArgOutPointerValid(count);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need for locking, no state */
     uint32_t uResult = Global::getMaxNetworkAdapters(aChipset);
     if (uResult == 0)
@@ -408,20 +338,16 @@ STDMETHODIMP SystemProperties::GetMaxNetworkAdaptersOfType(ChipsetType_T aChipse
 }
 
 
-STDMETHODIMP SystemProperties::GetMaxDevicesPerPortForStorageBus(StorageBus_T aBus,
-                                                                 ULONG *aMaxDevicesPerPort)
+HRESULT SystemProperties::getMaxDevicesPerPortForStorageBus(StorageBus_T aBus,
+                                                            ULONG *aMaxDevicesPerPort)
 {
-    CheckComArgOutPointerValid(aMaxDevicesPerPort);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     switch (aBus)
     {
         case StorageBus_SATA:
         case StorageBus_SCSI:
         case StorageBus_SAS:
+        case StorageBus_USB:
         {
             /* SATA and both SCSI controllers only support one device per port. */
             *aMaxDevicesPerPort = 1;
@@ -442,18 +368,14 @@ STDMETHODIMP SystemProperties::GetMaxDevicesPerPortForStorageBus(StorageBus_T aB
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::GetMinPortCountForStorageBus(StorageBus_T aBus,
-                                                            ULONG *aMinPortCount)
+HRESULT SystemProperties::getMinPortCountForStorageBus(StorageBus_T aBus,
+                                                       ULONG *aMinPortCount)
 {
-    CheckComArgOutPointerValid(aMinPortCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     switch (aBus)
     {
         case StorageBus_SATA:
+        case StorageBus_SAS:
         {
             *aMinPortCount = 1;
             break;
@@ -473,7 +395,7 @@ STDMETHODIMP SystemProperties::GetMinPortCountForStorageBus(StorageBus_T aBus,
             *aMinPortCount = 1;
             break;
         }
-        case StorageBus_SAS:
+        case StorageBus_USB:
         {
             *aMinPortCount = 8;
             break;
@@ -485,14 +407,9 @@ STDMETHODIMP SystemProperties::GetMinPortCountForStorageBus(StorageBus_T aBus,
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::GetMaxPortCountForStorageBus(StorageBus_T aBus,
-                                                            ULONG *aMaxPortCount)
+HRESULT SystemProperties::getMaxPortCountForStorageBus(StorageBus_T aBus,
+                                                       ULONG *aMaxPortCount)
 {
-    CheckComArgOutPointerValid(aMaxPortCount);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     switch (aBus)
     {
@@ -518,6 +435,11 @@ STDMETHODIMP SystemProperties::GetMaxPortCountForStorageBus(StorageBus_T aBus,
         }
         case StorageBus_SAS:
         {
+            *aMaxPortCount = 255;
+            break;
+        }
+        case StorageBus_USB:
+        {
             *aMaxPortCount = 8;
             break;
         }
@@ -528,15 +450,10 @@ STDMETHODIMP SystemProperties::GetMaxPortCountForStorageBus(StorageBus_T aBus,
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::GetMaxInstancesOfStorageBus(ChipsetType_T aChipset,
-                                                           StorageBus_T  aBus,
-                                                           ULONG *aMaxInstances)
+HRESULT SystemProperties::getMaxInstancesOfStorageBus(ChipsetType_T aChipset,
+                                                      StorageBus_T  aBus,
+                                                      ULONG *aMaxInstances)
 {
-    CheckComArgOutPointerValid(aMaxInstances);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     ULONG cCtrs = 0;
 
     /* no need to lock, this is const */
@@ -547,6 +464,7 @@ STDMETHODIMP SystemProperties::GetMaxInstancesOfStorageBus(ChipsetType_T aChipse
         case StorageBus_SAS:
             cCtrs = aChipset == ChipsetType_ICH9 ? 8 : 1;
             break;
+        case StorageBus_USB:
         case StorageBus_IDE:
         case StorageBus_Floppy:
         {
@@ -562,13 +480,10 @@ STDMETHODIMP SystemProperties::GetMaxInstancesOfStorageBus(ChipsetType_T aChipse
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::GetDeviceTypesForStorageBus(StorageBus_T aBus,
-                                                           ComSafeArrayOut(DeviceType_T, aDeviceTypes))
+HRESULT SystemProperties::getDeviceTypesForStorageBus(StorageBus_T aBus,
+                                                      std::vector<DeviceType_T> &aDeviceTypes)
 {
-    CheckComArgOutSafeArrayPointerValid(aDeviceTypes);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    aDeviceTypes.resize(0);
 
     /* no need to lock, this is const */
     switch (aBus)
@@ -577,18 +492,17 @@ STDMETHODIMP SystemProperties::GetDeviceTypesForStorageBus(StorageBus_T aBus,
         case StorageBus_SATA:
         case StorageBus_SCSI:
         case StorageBus_SAS:
+        case StorageBus_USB:
         {
-            com::SafeArray<DeviceType_T> saDeviceTypes(2);
-            saDeviceTypes[0] = DeviceType_DVD;
-            saDeviceTypes[1] = DeviceType_HardDisk;
-            saDeviceTypes.detachTo(ComSafeArrayOutArg(aDeviceTypes));
+            aDeviceTypes.resize(2);
+            aDeviceTypes[0] = DeviceType_DVD;
+            aDeviceTypes[1] = DeviceType_HardDisk;
             break;
         }
         case StorageBus_Floppy:
         {
-            com::SafeArray<DeviceType_T> saDeviceTypes(1);
-            saDeviceTypes[0] = DeviceType_Floppy;
-            saDeviceTypes.detachTo(ComSafeArrayOutArg(aDeviceTypes));
+            aDeviceTypes.resize(1);
+            aDeviceTypes[0] = DeviceType_Floppy;
             break;
         }
         default:
@@ -598,13 +512,9 @@ STDMETHODIMP SystemProperties::GetDeviceTypesForStorageBus(StorageBus_T aBus,
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::GetDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType, BOOL *aEnabled)
+HRESULT SystemProperties::getDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType,
+                                                                       BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* no need to lock, this is const */
     switch (aControllerType)
     {
@@ -612,6 +522,7 @@ STDMETHODIMP SystemProperties::GetDefaultIoCacheSettingForStorageController(Stor
         case StorageControllerType_BusLogic:
         case StorageControllerType_IntelAhci:
         case StorageControllerType_LsiLogicSas:
+        case StorageControllerType_USB:
             *aEnabled = false;
             break;
         case StorageControllerType_PIIX3:
@@ -626,16 +537,36 @@ STDMETHODIMP SystemProperties::GetDefaultIoCacheSettingForStorageController(Stor
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::GetMaxInstancesOfUSBControllerType(ChipsetType_T aChipset,
-                                                                  USBControllerType_T aType,
-                                                                  ULONG *aMaxInstances)
+HRESULT SystemProperties::getStorageControllerHotplugCapable(StorageControllerType_T aControllerType,
+                                                             BOOL *aHotplugCapable)
 {
-    NOREF(aChipset);
-    CheckComArgOutPointerValid(aMaxInstances);
+    switch (aControllerType)
+    {
+        case StorageControllerType_IntelAhci:
+        case StorageControllerType_USB:
+            *aHotplugCapable = true;
+            break;
+        case StorageControllerType_LsiLogic:
+        case StorageControllerType_LsiLogicSas:
+        case StorageControllerType_BusLogic:
+        case StorageControllerType_PIIX3:
+        case StorageControllerType_PIIX4:
+        case StorageControllerType_ICH6:
+        case StorageControllerType_I82078:
+            *aHotplugCapable = false;
+            break;
+        default:
+            AssertMsgFailedReturn(("Invalid controller type %d\n", aControllerType), E_FAIL);
+    }
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    return S_OK;
+}
 
+HRESULT SystemProperties::getMaxInstancesOfUSBControllerType(ChipsetType_T aChipset,
+                                                             USBControllerType_T aType,
+                                                             ULONG *aMaxInstances)
+{
+    NOREF(aChipset);
     ULONG cCtrs = 0;
 
     /* no need to lock, this is const */
@@ -643,6 +574,7 @@ STDMETHODIMP SystemProperties::GetMaxInstancesOfUSBControllerType(ChipsetType_T
     {
         case USBControllerType_OHCI:
         case USBControllerType_EHCI:
+        case USBControllerType_XHCI:
         {
             cCtrs = 1;
             break;
@@ -656,336 +588,265 @@ STDMETHODIMP SystemProperties::GetMaxInstancesOfUSBControllerType(ChipsetType_T
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(DefaultMachineFolder)(BSTR *aDefaultMachineFolder)
+HRESULT SystemProperties::getDefaultMachineFolder(com::Utf8Str &aDefaultMachineFolder)
 {
-    CheckComArgOutPointerValid(aDefaultMachineFolder);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    m->strDefaultMachineFolder.cloneTo(aDefaultMachineFolder);
-
+    aDefaultMachineFolder = m->strDefaultMachineFolder;
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(DefaultMachineFolder)(IN_BSTR aDefaultMachineFolder)
+HRESULT SystemProperties::setDefaultMachineFolder(const com::Utf8Str &aDefaultMachineFolder)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = setDefaultMachineFolder(aDefaultMachineFolder);
+    HRESULT rc = i_setDefaultMachineFolder(aDefaultMachineFolder);
     alock.release();
-
     if (SUCCEEDED(rc))
     {
-        // VirtualBox::saveSettings() needs vbox write lock
+        // VirtualBox::i_saveSettings() needs vbox write lock
         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(LoggingLevel)(BSTR *aLoggingLevel)
+HRESULT SystemProperties::getLoggingLevel(com::Utf8Str &aLoggingLevel)
 {
-    CheckComArgOutPointerValid(aLoggingLevel);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Utf8Str useLoggingLevel(m->strLoggingLevel);
-    if (useLoggingLevel.isEmpty())
-        useLoggingLevel = VBOXSVC_LOG_DEFAULT;
+    aLoggingLevel = m->strLoggingLevel;
+
+    if (aLoggingLevel.isEmpty())
+        aLoggingLevel = VBOXSVC_LOG_DEFAULT;
 
-    useLoggingLevel.cloneTo(aLoggingLevel);
     return S_OK;
 }
 
 
-STDMETHODIMP SystemProperties::COMSETTER(LoggingLevel)(IN_BSTR aLoggingLevel)
+HRESULT SystemProperties::setLoggingLevel(const com::Utf8Str &aLoggingLevel)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = setLoggingLevel(aLoggingLevel);
+    HRESULT rc = i_setLoggingLevel(aLoggingLevel);
     alock.release();
 
     if (SUCCEEDED(rc))
     {
         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
     else
-        LogRel(("Cannot set passed logging level=%ls, or the default one - Error=%Rhrc \n", aLoggingLevel, rc));
+        LogRel(("Cannot set passed logging level=%s, or the default one - Error=%Rhrc \n", aLoggingLevel.c_str(), rc));
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(MediumFormats)(ComSafeArrayOut(IMediumFormat *, aMediumFormats))
+HRESULT SystemProperties::getMediumFormats(std::vector<ComPtr<IMediumFormat> > &aMediumFormats)
 {
-    CheckComArgOutSafeArrayPointerValid(aMediumFormats);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    SafeIfaceArray<IMediumFormat> mediumFormats(m_llMediumFormats);
-    mediumFormats.detachTo(ComSafeArrayOutArg(aMediumFormats));
-
+    MediumFormatList mediumFormats(m_llMediumFormats);
+    aMediumFormats.resize(mediumFormats.size());
+    size_t i = 0;
+    for (MediumFormatList::const_iterator it = mediumFormats.begin(); it != mediumFormats.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aMediumFormats[i].asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(DefaultHardDiskFormat)(BSTR *aDefaultHardDiskFormat)
+HRESULT SystemProperties::getDefaultHardDiskFormat(com::Utf8Str &aDefaultHardDiskFormat)
 {
-    CheckComArgOutPointerValid(aDefaultHardDiskFormat);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    m->strDefaultHardDiskFormat.cloneTo(aDefaultHardDiskFormat);
-
+    aDefaultHardDiskFormat = m->strDefaultHardDiskFormat;
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFormat)(IN_BSTR aDefaultHardDiskFormat)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SystemProperties::setDefaultHardDiskFormat(const com::Utf8Str &aDefaultHardDiskFormat)
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = setDefaultHardDiskFormat(aDefaultHardDiskFormat);
+    HRESULT rc = i_setDefaultHardDiskFormat(aDefaultHardDiskFormat);
     alock.release();
-
     if (SUCCEEDED(rc))
     {
-        // VirtualBox::saveSettings() needs vbox write lock
+        // VirtualBox::i_saveSettings() needs vbox write lock
         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpaceWarning)(LONG64 *aFreeSpace)
+HRESULT SystemProperties::getFreeDiskSpaceWarning(LONG64 *aFreeSpace)
 {
-    CheckComArgOutPointerValid(aFreeSpace);
-
+    NOREF(aFreeSpace);
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpaceWarning)(LONG64 /* aFreeSpace */)
+HRESULT SystemProperties::setFreeDiskSpaceWarning(LONG64 /* aFreeSpace */)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpacePercentWarning)(ULONG *aFreeSpacePercent)
+HRESULT SystemProperties::getFreeDiskSpacePercentWarning(ULONG *aFreeSpacePercent)
 {
-    CheckComArgOutPointerValid(aFreeSpacePercent);
-
+    NOREF(aFreeSpacePercent);
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentWarning)(ULONG /* aFreeSpacePercent */)
+HRESULT SystemProperties::setFreeDiskSpacePercentWarning(ULONG /* aFreeSpacePercent */)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpaceError)(LONG64 *aFreeSpace)
+HRESULT SystemProperties::getFreeDiskSpaceError(LONG64 *aFreeSpace)
 {
-    CheckComArgOutPointerValid(aFreeSpace);
-
+    NOREF(aFreeSpace);
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpaceError)(LONG64 /* aFreeSpace */)
+HRESULT SystemProperties::setFreeDiskSpaceError(LONG64 /* aFreeSpace */)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpacePercentError)(ULONG *aFreeSpacePercent)
+HRESULT SystemProperties::getFreeDiskSpacePercentError(ULONG *aFreeSpacePercent)
 {
-    CheckComArgOutPointerValid(aFreeSpacePercent);
-
+    NOREF(aFreeSpacePercent);
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentError)(ULONG /* aFreeSpacePercent */)
+HRESULT SystemProperties::setFreeDiskSpacePercentError(ULONG /* aFreeSpacePercent */)
 {
     ReturnComNotImplemented();
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(VRDEAuthLibrary)(BSTR *aVRDEAuthLibrary)
+HRESULT SystemProperties::getVRDEAuthLibrary(com::Utf8Str &aVRDEAuthLibrary)
 {
-    CheckComArgOutPointerValid(aVRDEAuthLibrary);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strVRDEAuthLibrary.cloneTo(aVRDEAuthLibrary);
+    aVRDEAuthLibrary = m->strVRDEAuthLibrary;
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(VRDEAuthLibrary)(IN_BSTR aVRDEAuthLibrary)
+HRESULT SystemProperties::setVRDEAuthLibrary(const com::Utf8Str &aVRDEAuthLibrary)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = setVRDEAuthLibrary(aVRDEAuthLibrary);
+    HRESULT rc = i_setVRDEAuthLibrary(aVRDEAuthLibrary);
     alock.release();
-
     if (SUCCEEDED(rc))
     {
-        // VirtualBox::saveSettings() needs vbox write lock
+        // VirtualBox::i_saveSettings() needs vbox write lock
         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(WebServiceAuthLibrary)(BSTR *aWebServiceAuthLibrary)
+HRESULT SystemProperties::getWebServiceAuthLibrary(com::Utf8Str &aWebServiceAuthLibrary)
 {
-    CheckComArgOutPointerValid(aWebServiceAuthLibrary);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strWebServiceAuthLibrary.cloneTo(aWebServiceAuthLibrary);
+    aWebServiceAuthLibrary = m->strWebServiceAuthLibrary;
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary)(IN_BSTR aWebServiceAuthLibrary)
+HRESULT SystemProperties::setWebServiceAuthLibrary(const com::Utf8Str &aWebServiceAuthLibrary)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = setWebServiceAuthLibrary(aWebServiceAuthLibrary);
+    HRESULT rc = i_setWebServiceAuthLibrary(aWebServiceAuthLibrary);
     alock.release();
 
     if (SUCCEEDED(rc))
     {
-        // VirtualBox::saveSettings() needs vbox write lock
+        // VirtualBox::i_saveSettings() needs vbox write lock
         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(DefaultVRDEExtPack)(BSTR *aExtPack)
+HRESULT SystemProperties::getDefaultVRDEExtPack(com::Utf8Str &aExtPack)
 {
-    CheckComArgOutPointerValid(aExtPack);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    HRESULT hrc = S_OK;
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Utf8Str strExtPack(m->strDefaultVRDEExtPack);
+    if (strExtPack.isNotEmpty())
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Utf8Str strExtPack(m->strDefaultVRDEExtPack);
-        if (strExtPack.isNotEmpty())
-        {
-            if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
-                hrc = S_OK;
-            else
+        if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
+            hrc = S_OK;
+        else
 #ifdef VBOX_WITH_EXTPACK
-                hrc = mParent->getExtPackManager()->checkVrdeExtPack(&strExtPack);
+            hrc = mParent->i_getExtPackManager()->i_checkVrdeExtPack(&strExtPack);
 #else
-                hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str());
+            hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str());
 #endif
-        }
-        else
-        {
+    }
+    else
+    {
 #ifdef VBOX_WITH_EXTPACK
-            hrc = mParent->getExtPackManager()->getDefaultVrdeExtPack(&strExtPack);
+        hrc = mParent->i_getExtPackManager()->i_getDefaultVrdeExtPack(&strExtPack);
 #endif
-            if (strExtPack.isEmpty())
+        if (strExtPack.isEmpty())
+        {
+            /*
+            * Klugde - check if VBoxVRDP.dll/.so/.dylib is installed.
+            * This is hardcoded uglyness, sorry.
+            */
+            char szPath[RTPATH_MAX];
+            int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath));
+            if (RT_SUCCESS(vrc))
+                vrc = RTPathAppend(szPath, sizeof(szPath), "VBoxVRDP");
+            if (RT_SUCCESS(vrc))
+                vrc = RTStrCat(szPath, sizeof(szPath), RTLdrGetSuff());
+            if (RT_SUCCESS(vrc) && RTFileExists(szPath))
             {
-                /*
-                 * Klugde - check if VBoxVRDP.dll/.so/.dylib is installed.
-                 * This is hardcoded uglyness, sorry.
-                 */
-                char szPath[RTPATH_MAX];
-                int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath));
-                if (RT_SUCCESS(vrc))
-                    vrc = RTPathAppend(szPath, sizeof(szPath), "VBoxVRDP");
-                if (RT_SUCCESS(vrc))
-                    vrc = RTStrCat(szPath, sizeof(szPath), RTLdrGetSuff());
-                if (RT_SUCCESS(vrc) && RTFileExists(szPath))
-                {
-                    /* Illegal extpack name, so no conflict. */
-                    strExtPack = VBOXVRDP_KLUDGE_EXTPACK_NAME;
-                }
+                /* Illegal extpack name, so no conflict. */
+                strExtPack = VBOXVRDP_KLUDGE_EXTPACK_NAME;
             }
         }
-
-        if (SUCCEEDED(hrc))
-            strExtPack.cloneTo(aExtPack);
     }
 
+    if (SUCCEEDED(hrc))
+          aExtPack = strExtPack;
+
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(DefaultVRDEExtPack)(IN_BSTR aExtPack)
-{
-    CheckComArgNotNull(aExtPack);
-    Utf8Str strExtPack(aExtPack);
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+HRESULT SystemProperties::setDefaultVRDEExtPack(const com::Utf8Str &aExtPack)
+{
+    HRESULT hrc = S_OK;
+    if (aExtPack.isNotEmpty())
     {
-        if (strExtPack.isNotEmpty())
-        {
-            if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
-                hrc = S_OK;
-            else
+        if (aExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
+            hrc = S_OK;
+        else
 #ifdef VBOX_WITH_EXTPACK
-                hrc = mParent->getExtPackManager()->checkVrdeExtPack(&strExtPack);
+            hrc = mParent->i_getExtPackManager()->i_checkVrdeExtPack(&aExtPack);
 #else
-                hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str());
+            hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), aExtPack.c_str());
 #endif
-        }
+    }
+    if (SUCCEEDED(hrc))
+    {
+        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+        hrc = i_setDefaultVRDEExtPack(aExtPack);
         if (SUCCEEDED(hrc))
         {
-            AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-            hrc = setDefaultVRDEExtPack(aExtPack);
-            if (SUCCEEDED(hrc))
-            {
-                /* VirtualBox::saveSettings() needs the VirtualBox write lock. */
-                alock.release();
-                AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-                hrc = mParent->saveSettings();
-            }
+            /* VirtualBox::i_saveSettings() needs the VirtualBox write lock. */
+            alock.release();
+            AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
+            hrc = mParent->i_saveSettings();
         }
     }
 
     return hrc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(LogHistoryCount)(ULONG *count)
-{
-    CheckComArgOutPointerValid(count);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SystemProperties::getLogHistoryCount(ULONG *count)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *count = m->ulLogHistoryCount;
@@ -993,29 +854,22 @@ STDMETHODIMP SystemProperties::COMGETTER(LogHistoryCount)(ULONG *count)
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(LogHistoryCount)(ULONG count)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT SystemProperties::setLogHistoryCount(ULONG count)
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     m->ulLogHistoryCount = count;
     alock.release();
 
-    // VirtualBox::saveSettings() needs vbox write lock
+    // VirtualBox::i_saveSettings() needs vbox write lock
     AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = mParent->saveSettings();
+    HRESULT rc = mParent->i_saveSettings();
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(DefaultAudioDriver)(AudioDriverType_T *aAudioDriver)
+HRESULT SystemProperties::getDefaultAudioDriver(AudioDriverType_T *aAudioDriver)
 {
-    CheckComArgOutPointerValid(aAudioDriver);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aAudioDriver = settings::MachineConfigFile::getHostDefaultAudioDriver();
@@ -1023,46 +877,33 @@ STDMETHODIMP SystemProperties::COMGETTER(DefaultAudioDriver)(AudioDriverType_T *
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(AutostartDatabasePath)(BSTR *aAutostartDbPath)
+HRESULT SystemProperties::getAutostartDatabasePath(com::Utf8Str &aAutostartDbPath)
 {
-    CheckComArgOutPointerValid(aAutostartDbPath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    m->strAutostartDatabasePath.cloneTo(aAutostartDbPath);
+    aAutostartDbPath = m->strAutostartDatabasePath;
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(AutostartDatabasePath)(IN_BSTR aAutostartDbPath)
+HRESULT SystemProperties::setAutostartDatabasePath(const com::Utf8Str &aAutostartDbPath)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-    HRESULT rc = setAutostartDatabasePath(aAutostartDbPath);
+    HRESULT rc = i_setAutostartDatabasePath(aAutostartDbPath);
     alock.release();
 
     if (SUCCEEDED(rc))
     {
-        // VirtualBox::saveSettings() needs vbox write lock
+        // VirtualBox::i_saveSettings() needs vbox write lock
         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(DefaultAdditionsISO)(BSTR *aDefaultAdditionsISO)
+HRESULT SystemProperties::getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO)
 {
-    CheckComArgOutPointerValid(aDefaultAdditionsISO);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (m->strDefaultAdditionsISO.isEmpty())
@@ -1076,16 +917,13 @@ STDMETHODIMP SystemProperties::COMGETTER(DefaultAdditionsISO)(BSTR *aDefaultAddi
         }
         alock.acquire();
     }
-    m->strDefaultAdditionsISO.cloneTo(aDefaultAdditionsISO);
+    aDefaultAdditionsISO = m->strDefaultAdditionsISO;
 
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(DefaultAdditionsISO)(IN_BSTR aDefaultAdditionsISO)
+HRESULT SystemProperties::setDefaultAdditionsISO(const com::Utf8Str &aDefaultAdditionsISO)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /** @todo not yet implemented, settings handling is missing */
     ReturnComNotImplemented();
 
@@ -1095,32 +933,23 @@ STDMETHODIMP SystemProperties::COMSETTER(DefaultAdditionsISO)(IN_BSTR aDefaultAd
 
     if (SUCCEEDED(rc))
     {
-        // VirtualBox::saveSettings() needs vbox write lock
+        // VirtualBox::i_saveSettings() needs vbox write lock
         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     return rc;
 }
 
-STDMETHODIMP SystemProperties::COMGETTER(DefaultFrontend)(BSTR *aDefaultFrontend)
+HRESULT SystemProperties::getDefaultFrontend(com::Utf8Str &aDefaultFrontend)
 {
-    CheckComArgOutPointerValid(aDefaultFrontend);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    m->strDefaultFrontend.cloneTo(aDefaultFrontend);
-
+    aDefaultFrontend = m->strDefaultFrontend;
     return S_OK;
 }
 
-STDMETHODIMP SystemProperties::COMSETTER(DefaultFrontend)(IN_BSTR aDefaultFrontend)
+HRESULT SystemProperties::setDefaultFrontend(const com::Utf8Str &aDefaultFrontend)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     if (m->strDefaultFrontend == Utf8Str(aDefaultFrontend))
         return S_OK;
@@ -1129,64 +958,71 @@ STDMETHODIMP SystemProperties::COMSETTER(DefaultFrontend)(IN_BSTR aDefaultFronte
 
     if (SUCCEEDED(rc))
     {
-        // VirtualBox::saveSettings() needs vbox write lock
+        // VirtualBox::i_saveSettings() needs vbox write lock
         AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
-        rc = mParent->saveSettings();
+        rc = mParent->i_saveSettings();
     }
 
     return rc;
 }
 
+HRESULT SystemProperties::getScreenShotFormats(std::vector<BitmapFormat_T> &aBitmapFormats)
+{
+    aBitmapFormats.push_back(BitmapFormat_BGR0);
+    aBitmapFormats.push_back(BitmapFormat_BGRA);
+    aBitmapFormats.push_back(BitmapFormat_RGBA);
+    aBitmapFormats.push_back(BitmapFormat_PNG);
+    return S_OK;
+}
+
 // public methods only for internal purposes
 /////////////////////////////////////////////////////////////////////////////
 
-HRESULT SystemProperties::loadSettings(const settings::SystemProperties &data)
+HRESULT SystemProperties::i_loadSettings(const settings::SystemProperties &data)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     HRESULT rc = S_OK;
-
-    rc = setDefaultMachineFolder(data.strDefaultMachineFolder);
+    rc = i_setDefaultMachineFolder(data.strDefaultMachineFolder);
     if (FAILED(rc)) return rc;
 
-    rc = setLoggingLevel(data.strLoggingLevel);
+    rc = i_setLoggingLevel(data.strLoggingLevel);
     if (FAILED(rc)) return rc;
 
-    rc = setDefaultHardDiskFormat(data.strDefaultHardDiskFormat);
+    rc = i_setDefaultHardDiskFormat(data.strDefaultHardDiskFormat);
     if (FAILED(rc)) return rc;
 
-    rc = setVRDEAuthLibrary(data.strVRDEAuthLibrary);
+    rc = i_setVRDEAuthLibrary(data.strVRDEAuthLibrary);
     if (FAILED(rc)) return rc;
 
-    rc = setWebServiceAuthLibrary(data.strWebServiceAuthLibrary);
+    rc = i_setWebServiceAuthLibrary(data.strWebServiceAuthLibrary);
     if (FAILED(rc)) return rc;
 
-    rc = setDefaultVRDEExtPack(data.strDefaultVRDEExtPack);
+    rc = i_setDefaultVRDEExtPack(data.strDefaultVRDEExtPack);
     if (FAILED(rc)) return rc;
 
     m->ulLogHistoryCount = data.ulLogHistoryCount;
     m->fExclusiveHwVirt  = data.fExclusiveHwVirt;
 
-    rc = setAutostartDatabasePath(data.strAutostartDatabasePath);
+    rc = i_setAutostartDatabasePath(data.strAutostartDatabasePath);
     if (FAILED(rc)) return rc;
 
     {
         /* must ignore errors signalled here, because the guest additions
          * file may not exist, and in this case keep the empty string */
         ErrorInfoKeeper eik;
-        (void)setDefaultAdditionsISO(data.strDefaultAdditionsISO);
+        (void)i_setDefaultAdditionsISO(data.strDefaultAdditionsISO);
     }
 
-    rc = setDefaultFrontend(data.strDefaultFrontend);
+    rc = i_setDefaultFrontend(data.strDefaultFrontend);
     if (FAILED(rc)) return rc;
 
     return S_OK;
 }
 
-HRESULT SystemProperties::saveSettings(settings::SystemProperties &data)
+HRESULT SystemProperties::i_saveSettings(settings::SystemProperties &data)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -1206,7 +1042,7 @@ HRESULT SystemProperties::saveSettings(settings::SystemProperties &data)
  *
  * @return ComObjPtr<MediumFormat>
  */
-ComObjPtr<MediumFormat> SystemProperties::mediumFormat(const Utf8Str &aFormat)
+ComObjPtr<MediumFormat> SystemProperties::i_mediumFormat(const Utf8Str &aFormat)
 {
     ComObjPtr<MediumFormat> format;
 
@@ -1239,7 +1075,7 @@ ComObjPtr<MediumFormat> SystemProperties::mediumFormat(const Utf8Str &aFormat)
  *
  * @return ComObjPtr<MediumFormat>
  */
-ComObjPtr<MediumFormat> SystemProperties::mediumFormatFromExtension(const Utf8Str &aExt)
+ComObjPtr<MediumFormat> SystemProperties::i_mediumFormatFromExtension(const Utf8Str &aExt)
 {
     ComObjPtr<MediumFormat> format;
 
@@ -1275,7 +1111,7 @@ ComObjPtr<MediumFormat> SystemProperties::mediumFormatFromExtension(const Utf8St
 /**
  * VD plugin load
  */
-int SystemProperties::loadVDPlugin(const char *pszPluginLibrary)
+int SystemProperties::i_loadVDPlugin(const char *pszPluginLibrary)
 {
     return VDPluginLoadFromFilename(pszPluginLibrary);
 }
@@ -1283,7 +1119,7 @@ int SystemProperties::loadVDPlugin(const char *pszPluginLibrary)
 /**
  * VD plugin unload
  */
-int SystemProperties::unloadVDPlugin(const char *pszPluginLibrary)
+int SystemProperties::i_unloadVDPlugin(const char *pszPluginLibrary)
 {
     return VDPluginUnloadFromFilename(pszPluginLibrary);
 }
@@ -1296,7 +1132,7 @@ int SystemProperties::unloadVDPlugin(const char *pszPluginLibrary)
  * @param strPath
  * @return
  */
-HRESULT SystemProperties::getUserHomeDirectory(Utf8Str &strPath)
+HRESULT SystemProperties::i_getUserHomeDirectory(Utf8Str &strPath)
 {
     char szHome[RTPATH_MAX];
     int vrc = RTPathUserHome(szHome, sizeof(szHome));
@@ -1316,7 +1152,7 @@ HRESULT SystemProperties::getUserHomeDirectory(Utf8Str &strPath)
  * @param aPath
  * @return
  */
-HRESULT SystemProperties::setDefaultMachineFolder(const Utf8Str &strPath)
+HRESULT SystemProperties::i_setDefaultMachineFolder(const Utf8Str &strPath)
 {
     Utf8Str path(strPath);      // make modifiable
     if (    path.isEmpty()          // used by API calls to reset the default
@@ -1326,7 +1162,7 @@ HRESULT SystemProperties::setDefaultMachineFolder(const Utf8Str &strPath)
        )
     {
         // new default with VirtualBox 4.0: "$HOME/VirtualBox VMs"
-        HRESULT rc = getUserHomeDirectory(path);
+        HRESULT rc = i_getUserHomeDirectory(path);
         if (FAILED(rc)) return rc;
         path += RTPATH_SLASH_STR "VirtualBox VMs";
     }
@@ -1341,7 +1177,7 @@ HRESULT SystemProperties::setDefaultMachineFolder(const Utf8Str &strPath)
     return S_OK;
 }
 
-HRESULT SystemProperties::setLoggingLevel(const Utf8Str &aLoggingLevel)
+HRESULT SystemProperties::i_setLoggingLevel(const com::Utf8Str &aLoggingLevel)
 {
     Utf8Str useLoggingLevel(aLoggingLevel);
     if (useLoggingLevel.isEmpty())
@@ -1368,7 +1204,7 @@ HRESULT SystemProperties::setLoggingLevel(const Utf8Str &aLoggingLevel)
     return RT_SUCCESS(rc) ? S_OK : E_FAIL;
 }
 
-HRESULT SystemProperties::setDefaultHardDiskFormat(const Utf8Str &aFormat)
+HRESULT SystemProperties::i_setDefaultHardDiskFormat(const com::Utf8Str &aFormat)
 {
     if (!aFormat.isEmpty())
         m->strDefaultHardDiskFormat = aFormat;
@@ -1378,7 +1214,7 @@ HRESULT SystemProperties::setDefaultHardDiskFormat(const Utf8Str &aFormat)
     return S_OK;
 }
 
-HRESULT SystemProperties::setVRDEAuthLibrary(const Utf8Str &aPath)
+HRESULT SystemProperties::i_setVRDEAuthLibrary(const com::Utf8Str &aPath)
 {
     if (!aPath.isEmpty())
         m->strVRDEAuthLibrary = aPath;
@@ -1388,7 +1224,7 @@ HRESULT SystemProperties::setVRDEAuthLibrary(const Utf8Str &aPath)
     return S_OK;
 }
 
-HRESULT SystemProperties::setWebServiceAuthLibrary(const Utf8Str &aPath)
+HRESULT SystemProperties::i_setWebServiceAuthLibrary(const com::Utf8Str &aPath)
 {
     if (!aPath.isEmpty())
         m->strWebServiceAuthLibrary = aPath;
@@ -1398,17 +1234,17 @@ HRESULT SystemProperties::setWebServiceAuthLibrary(const Utf8Str &aPath)
     return S_OK;
 }
 
-HRESULT SystemProperties::setDefaultVRDEExtPack(const Utf8Str &aExtPack)
+HRESULT SystemProperties::i_setDefaultVRDEExtPack(const com::Utf8Str &aExtPack)
 {
     m->strDefaultVRDEExtPack = aExtPack;
 
     return S_OK;
 }
 
-HRESULT SystemProperties::setAutostartDatabasePath(const Utf8Str &aPath)
+HRESULT SystemProperties::i_setAutostartDatabasePath(const com::Utf8Str &aPath)
 {
     HRESULT rc = S_OK;
-    AutostartDb *autostartDb = this->mParent->getAutostartDb();
+    AutostartDb *autostartDb = this->mParent->i_getAutostartDb();
 
     if (!aPath.isEmpty())
     {
@@ -1435,9 +1271,9 @@ HRESULT SystemProperties::setAutostartDatabasePath(const Utf8Str &aPath)
     return rc;
 }
 
-HRESULT SystemProperties::setDefaultAdditionsISO(const Utf8Str &aPath)
+HRESULT SystemProperties::i_setDefaultAdditionsISO(const com::Utf8Str &aPath)
 {
-    Utf8Str path(aPath);
+    com::Utf8Str path(aPath);
     if (path.isEmpty())
     {
         char strTemp[RTPATH_MAX];
@@ -1451,7 +1287,7 @@ HRESULT SystemProperties::setDefaultAdditionsISO(const Utf8Str &aPath)
 
         vrc = RTPathUserHome(strTemp, sizeof(strTemp));
         AssertRC(vrc);
-        Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%ls.iso", strTemp, VirtualBox::getVersionNormalized().raw());
+        Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%s.iso", strTemp, VirtualBox::i_getVersionNormalized().c_str());
 
         /* Check the standard image locations */
         if (RTFileExists(strSrc1.c_str()))
@@ -1480,7 +1316,7 @@ HRESULT SystemProperties::setDefaultAdditionsISO(const Utf8Str &aPath)
     return S_OK;
 }
 
-HRESULT SystemProperties::setDefaultFrontend(const Utf8Str &aDefaultFrontend)
+HRESULT SystemProperties::i_setDefaultFrontend(const com::Utf8Str &aDefaultFrontend)
 {
     m->strDefaultFrontend = aDefaultFrontend;
 
diff --git a/src/VBox/Main/src-server/TokenImpl.cpp b/src/VBox/Main/src-server/TokenImpl.cpp
index 29802e7..a55820f 100644
--- a/src/VBox/Main/src-server/TokenImpl.cpp
+++ b/src/VBox/Main/src-server/TokenImpl.cpp
@@ -176,12 +176,12 @@ void MediumLockToken::uninit()
     {
         if (m.fWrite)
         {
-            HRESULT rc = m.pMedium->unlockWrite(NULL);
+            HRESULT rc = m.pMedium->i_unlockWrite(NULL);
             AssertComRC(rc);
         }
         else
         {
-            HRESULT rc = m.pMedium->unlockRead(NULL);
+            HRESULT rc = m.pMedium->i_unlockRead(NULL);
             AssertComRC(rc);
         }
         m.pMedium.setNull();
diff --git a/src/VBox/Main/src-server/USBControllerImpl.cpp b/src/VBox/Main/src-server/USBControllerImpl.cpp
index 18c4f43..32a67a1 100644
--- a/src/VBox/Main/src-server/USBControllerImpl.cpp
+++ b/src/VBox/Main/src-server/USBControllerImpl.cpp
@@ -100,7 +100,7 @@ HRESULT USBController::init(Machine *aParent, const Utf8Str &aName, USBControlle
 
     ComAssertRet(aParent && !aName.isEmpty(), E_INVALIDARG);
     if (   (enmType <= USBControllerType_Null)
-        || (enmType >  USBControllerType_EHCI))
+        || (enmType >  USBControllerType_XHCI))
         return setError(E_INVALIDARG,
                         tr("Invalid USB controller type"));
 
@@ -233,28 +233,18 @@ void USBController::uninit()
 }
 
 
-// IUSBController properties
+// Wrapped IUSBController properties
 /////////////////////////////////////////////////////////////////////////////
-STDMETHODIMP USBController::COMGETTER(Name) (BSTR *aName)
+HRESULT USBController::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* strName is constant during life time, no need to lock */
-    m->bd->strName.cloneTo(aName);
+    aName = m->bd->strName;
 
     return S_OK;
 }
 
-STDMETHODIMP USBController::COMGETTER(Type)(USBControllerType_T *aType)
+HRESULT USBController::getType(USBControllerType_T *aType)
 {
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aType = m->bd->enmType;
@@ -262,13 +252,8 @@ STDMETHODIMP USBController::COMGETTER(Type)(USBControllerType_T *aType)
     return S_OK;
 }
 
-STDMETHODIMP USBController::COMGETTER(USBStandard)(USHORT *aUSBStandard)
+HRESULT USBController::getUSBStandard(USHORT *aUSBStandard)
 {
-    CheckComArgOutPointerValid(aUSBStandard);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     switch (m->bd->enmType)
@@ -279,6 +264,9 @@ STDMETHODIMP USBController::COMGETTER(USBStandard)(USHORT *aUSBStandard)
         case USBControllerType_EHCI:
             *aUSBStandard = 0x0200;
             break;
+        case USBControllerType_XHCI:
+            *aUSBStandard = 0x0200;
+            break;
         default:
             AssertMsgFailedReturn(("Invalid controller type %d\n", m->bd->enmType),
                                   E_FAIL);
@@ -291,7 +279,7 @@ STDMETHODIMP USBController::COMGETTER(USBStandard)(USHORT *aUSBStandard)
 /////////////////////////////////////////////////////////////////////////////
 
 /** @note Locks objects for writing! */
-void USBController::rollback()
+void USBController::i_rollback()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -309,7 +297,7 @@ void USBController::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void USBController::commit()
+void USBController::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -339,7 +327,7 @@ void USBController::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void USBController::copyFrom(USBController *aThat)
+void USBController::i_copyFrom(USBController *aThat)
 {
     AssertReturnVoid(aThat != NULL);
 
@@ -373,7 +361,7 @@ void USBController::copyFrom(USBController *aThat)
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void USBController::unshare()
+void USBController::i_unshare()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -399,21 +387,20 @@ void USBController::unshare()
     unconst(m->pPeer) = NULL;
 }
 
-const Utf8Str& USBController::getName() const
+const Utf8Str &USBController::i_getName() const
 {
     return m->bd->strName;
 }
 
-USBControllerType_T USBController::getControllerType() const
+const USBControllerType_T &USBController::i_getControllerType() const
 {
     return m->bd->enmType;
 }
 
-ComObjPtr<USBController> USBController::getPeer()
+ComObjPtr<USBController> USBController::i_getPeer()
 {
     return m->pPeer;
 }
 
-// private methods
 /////////////////////////////////////////////////////////////////////////////
 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp b/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
index 47857b4..c65df1d 100644
--- a/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
+++ b/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -40,7 +40,7 @@
  *  @param  aIdx        The field index.
  *  @param  aStr        The output string.
  */
-static void usbFilterFieldToString(PCUSBFILTER aFilter, USBFILTERIDX aIdx, Utf8Str &out)
+static void i_usbFilterFieldToString(PCUSBFILTER aFilter, USBFILTERIDX aIdx, Utf8Str &out)
 {
     const USBFILTERMATCH matchingMethod = USBFilterGetMatchingMethod(aFilter, aIdx);
     Assert(matchingMethod != USBFILTERMATCH_INVALID);
@@ -61,7 +61,7 @@ static void usbFilterFieldToString(PCUSBFILTER aFilter, USBFILTERIDX aIdx, Utf8S
 }
 
 /*static*/
-const char* USBDeviceFilter::describeUSBFilterIdx(USBFILTERIDX aIdx)
+const char* USBDeviceFilter::i_describeUSBFilterIdx(USBFILTERIDX aIdx)
 {
     switch (aIdx)
     {
@@ -91,13 +91,12 @@ const char* USBDeviceFilter::describeUSBFilterIdx(USBFILTERIDX aIdx)
  *  @return COM status code.
  *  @remark The idea was to have this as a static function, but tr() doesn't wanna work without a class :-/
  */
-/*static*/ HRESULT USBDeviceFilter::usbFilterFieldFromString(PUSBFILTER aFilter,
-                                                             USBFILTERIDX aIdx,
-                                                             const Utf8Str &aValue,
-                                                             Utf8Str &aErrStr)
+/*static*/ HRESULT USBDeviceFilter::i_usbFilterFieldFromString(PUSBFILTER aFilter,
+                                                               USBFILTERIDX aIdx,
+                                                               const Utf8Str &aValue,
+                                                               Utf8Str &aErrStr)
 {
     int vrc;
-//     Utf8Str str (aStr);
     if (aValue.isEmpty())
         vrc = USBFilterSetIgnore(aFilter, aIdx);
     else
@@ -122,7 +121,8 @@ const char* USBDeviceFilter::describeUSBFilterIdx(USBFILTERIDX aIdx)
                         u64 = 0xffff;
                     else
                     {
-                        aErrStr = Utf8StrFmt(tr("The %s value '%s' is too big (max 0xFFFF)"), describeUSBFilterIdx(aIdx), pcszValue);
+                        aErrStr = Utf8StrFmt(tr("The %s value '%s' is too big (max 0xFFFF)"),
+                                             i_describeUSBFilterIdx(aIdx), pcszValue);
                         return E_INVALIDARG;
                     }
                 }
@@ -150,16 +150,18 @@ const char* USBDeviceFilter::describeUSBFilterIdx(USBFILTERIDX aIdx)
     {
         if (vrc == VERR_INVALID_PARAMETER)
         {
-            aErrStr = Utf8StrFmt(tr("The %s filter expression '%s' is not valid"), describeUSBFilterIdx(aIdx), aValue.c_str());
+            aErrStr = Utf8StrFmt(tr("The %s filter expression '%s' is not valid"), i_describeUSBFilterIdx(aIdx), aValue.c_str());
             return E_INVALIDARG;
         }
         if (vrc == VERR_BUFFER_OVERFLOW)
         {
-            aErrStr = Utf8StrFmt(tr("Insufficient expression space for the '%s' filter expression '%s'"), describeUSBFilterIdx(aIdx), aValue.c_str());
+            aErrStr = Utf8StrFmt(tr("Insufficient expression space for the '%s' filter expression '%s'"),
+                                 i_describeUSBFilterIdx(aIdx), aValue.c_str());
             return E_FAIL;
         }
         AssertRC(vrc);
-        aErrStr = Utf8StrFmt(tr("Encountered unexpected status %Rrc when setting '%s' to '%s'"), vrc, describeUSBFilterIdx(aIdx), aValue.c_str());
+        aErrStr = Utf8StrFmt(tr("Encountered unexpected status %Rrc when setting '%s' to '%s'"),
+                             vrc, i_describeUSBFilterIdx(aIdx), aValue.c_str());
         return E_FAIL;
     }
 
@@ -236,25 +238,25 @@ HRESULT USBDeviceFilter::init(USBDeviceFilters *aParent,
     HRESULT rc = S_OK;
     do
     {
-        rc = usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, data.strVendorId);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, data.strVendorId);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProductId);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProductId);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_DEVICE, data.strRevision);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_DEVICE, data.strRevision);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, data.strProduct);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, data.strProduct);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_PORT, data.strPort);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_PORT, data.strPort);
         if (FAILED(rc)) break;
 
         rc = COMSETTER(Remote)(Bstr(data.strRemote).raw());
@@ -439,29 +441,19 @@ void USBDeviceFilter::uninit()
 // IUSBDeviceFilter properties
 ////////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(Name) (BSTR *aName)
+HRESULT USBDeviceFilter::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mName.cloneTo(aName);
+    aName = mData->mName;
 
     return S_OK;
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(Name) (IN_BSTR aName)
+HRESULT USBDeviceFilter::setName(const com::Utf8Str &aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent->getMachine());
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent->i_getMachine());
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -469,7 +461,7 @@ STDMETHODIMP USBDeviceFilter::COMSETTER(Name) (IN_BSTR aName)
     if (mData->mName != aName)
     {
         m_fModified = true;
-        ComObjPtr<Machine> pMachine = mParent->getMachine();
+        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
 
         mData.backup();
         mData->mName = aName;
@@ -478,22 +470,17 @@ STDMETHODIMP USBDeviceFilter::COMSETTER(Name) (IN_BSTR aName)
         alock.release();
 
         AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
-        pMachine->setModified(Machine::IsModified_USB);
+        pMachine->i_setModified(Machine::IsModified_USB);
         mlock.release();
 
-        return mParent->onDeviceFilterChange(this);
+        return mParent->i_onDeviceFilterChange(this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(Active) (BOOL *aActive)
+HRESULT USBDeviceFilter::getActive(BOOL *aActive)
 {
-    CheckComArgOutPointerValid(aActive);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aActive = mData->mActive;
@@ -501,13 +488,10 @@ STDMETHODIMP USBDeviceFilter::COMGETTER(Active) (BOOL *aActive)
     return S_OK;
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(Active) (BOOL aActive)
+HRESULT USBDeviceFilter::setActive(const BOOL aActive)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent->getMachine());
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent->i_getMachine());
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -515,7 +499,7 @@ STDMETHODIMP USBDeviceFilter::COMSETTER(Active) (BOOL aActive)
     if (mData->mActive != aActive)
     {
         m_fModified = true;
-        ComObjPtr<Machine> pMachine = mParent->getMachine();
+        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
 
         mData.backup();
         mData->mActive = aActive;
@@ -524,121 +508,114 @@ STDMETHODIMP USBDeviceFilter::COMSETTER(Active) (BOOL aActive)
         alock.release();
 
         AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
-        pMachine->setModified(Machine::IsModified_USB);
+        pMachine->i_setModified(Machine::IsModified_USB);
         mlock.release();
 
-        return mParent->onDeviceFilterChange(this, TRUE /* aActiveChanged */);
+        return mParent->i_onDeviceFilterChange(this, TRUE /* aActiveChanged */);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(VendorId) (BSTR *aVendorId)
+HRESULT USBDeviceFilter::getVendorId(com::Utf8Str &aVendorId)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_VENDOR_ID, aVendorId);
+    return i_usbFilterFieldGetter(USBFILTERIDX_VENDOR_ID, aVendorId);
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(VendorId) (IN_BSTR aVendorId)
+HRESULT USBDeviceFilter::setVendorId(const com::Utf8Str &aVendorId)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, aVendorId);
+    return i_usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, aVendorId);
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(ProductId) (BSTR *aProductId)
+HRESULT USBDeviceFilter::getProductId(com::Utf8Str &aProductId)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_PRODUCT_ID, aProductId);
+    return i_usbFilterFieldGetter(USBFILTERIDX_PRODUCT_ID, aProductId);
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(ProductId) (IN_BSTR aProductId)
+HRESULT USBDeviceFilter::setProductId(const com::Utf8Str &aProductId)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, aProductId);
- }
-
-STDMETHODIMP USBDeviceFilter::COMGETTER(Revision) (BSTR *aRevision)
-{
-    return usbFilterFieldGetter(USBFILTERIDX_DEVICE, aRevision);
+    return i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, aProductId);
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(Revision) (IN_BSTR aRevision)
+HRESULT USBDeviceFilter::getRevision(com::Utf8Str &aRevision)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_DEVICE, aRevision);
+    return i_usbFilterFieldGetter(USBFILTERIDX_DEVICE, aRevision);
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(Manufacturer) (BSTR *aManufacturer)
+HRESULT USBDeviceFilter::setRevision(const com::Utf8Str &aRevision)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
+    return i_usbFilterFieldSetter(USBFILTERIDX_DEVICE, aRevision);
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(Manufacturer) (IN_BSTR aManufacturer)
+HRESULT USBDeviceFilter::getManufacturer(com::Utf8Str &aManufacturer)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
+    return i_usbFilterFieldGetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(Product) (BSTR *aProduct)
+HRESULT USBDeviceFilter::setManufacturer(const com::Utf8Str &aManufacturer)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_PRODUCT_STR, aProduct);
+    return i_usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(Product) (IN_BSTR aProduct)
+HRESULT USBDeviceFilter::getProduct(com::Utf8Str &aProduct)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, aProduct);
+    return i_usbFilterFieldGetter(USBFILTERIDX_PRODUCT_STR, aProduct);
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(SerialNumber) (BSTR *aSerialNumber)
+HRESULT USBDeviceFilter::setProduct(const com::Utf8Str &aProduct)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
+    return i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, aProduct);
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(SerialNumber) (IN_BSTR aSerialNumber)
+HRESULT USBDeviceFilter::getSerialNumber(com::Utf8Str &aSerialNumber)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
+    return i_usbFilterFieldGetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(Port) (BSTR *aPort)
+HRESULT USBDeviceFilter::setSerialNumber(const com::Utf8Str &aSerialNumber)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_PORT, aPort);
+    return i_usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(Port) (IN_BSTR aPort)
+HRESULT USBDeviceFilter::getPort(com::Utf8Str &aPort)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_PORT, aPort);
+    return i_usbFilterFieldGetter(USBFILTERIDX_PORT, aPort);
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(Remote) (BSTR *aRemote)
+HRESULT USBDeviceFilter::setPort(const com::Utf8Str &aPort)
 {
-    CheckComArgOutPointerValid(aRemote);
+    return i_usbFilterFieldSetter(USBFILTERIDX_PORT, aPort);
+}
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT USBDeviceFilter::getRemote(com::Utf8Str &aRemote)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mRemote.string().cloneTo(aRemote);
+    aRemote = mData->mRemote.string();
 
     return S_OK;
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(Remote) (IN_BSTR aRemote)
+HRESULT USBDeviceFilter::setRemote(const com::Utf8Str &aRemote)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent->getMachine());
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent->i_getMachine());
     if (FAILED(adep.rc())) return adep.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Bstr bRemote = Bstr(aRemote).raw();
 
-    if (mData->mRemote.string() != aRemote)
+    if (mData->mRemote.string() != bRemote)
     {
-        Data::BOOLFilter flt = aRemote;
+        Data::BOOLFilter flt = bRemote;
         ComAssertRet(!flt.isNull(), E_FAIL);
         if (!flt.isValid())
             return setError(E_INVALIDARG,
-                            tr("Remote state filter string '%ls' is not valid (error at position %d)"),
-                            aRemote, flt.errorPosition() + 1);
+                            tr("Remote state filter string '%s' is not valid (error at position %d)"),
+                            aRemote.c_str(), flt.errorPosition() + 1);
 
         m_fModified = true;
-        ComObjPtr<Machine> pMachine = mParent->getMachine();
+        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
 
         mData.backup();
         mData->mRemote = flt;
@@ -647,22 +624,17 @@ STDMETHODIMP USBDeviceFilter::COMSETTER(Remote) (IN_BSTR aRemote)
         alock.release();
 
         AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
-        pMachine->setModified(Machine::IsModified_USB);
+        pMachine->i_setModified(Machine::IsModified_USB);
         mlock.release();
 
-        return mParent->onDeviceFilterChange(this);
+        return mParent->i_onDeviceFilterChange(this);
     }
-
     return S_OK;
 }
 
-STDMETHODIMP USBDeviceFilter::COMGETTER(MaskedInterfaces) (ULONG *aMaskedIfs)
-{
-    CheckComArgOutPointerValid(aMaskedIfs);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT USBDeviceFilter::getMaskedInterfaces(ULONG *aMaskedIfs)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aMaskedIfs = mData->mMaskedIfs;
@@ -670,13 +642,10 @@ STDMETHODIMP USBDeviceFilter::COMGETTER(MaskedInterfaces) (ULONG *aMaskedIfs)
     return S_OK;
 }
 
-STDMETHODIMP USBDeviceFilter::COMSETTER(MaskedInterfaces) (ULONG aMaskedIfs)
+HRESULT USBDeviceFilter::setMaskedInterfaces(ULONG aMaskedIfs)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent->getMachine());
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent->i_getMachine());
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -684,19 +653,18 @@ STDMETHODIMP USBDeviceFilter::COMSETTER(MaskedInterfaces) (ULONG aMaskedIfs)
     if (mData->mMaskedIfs != aMaskedIfs)
     {
         m_fModified = true;
-        ComObjPtr<Machine> pMachine = mParent->getMachine();
+        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
 
         mData.backup();
         mData->mMaskedIfs = aMaskedIfs;
-
         // leave the lock before informing callbacks
         alock.release();
 
         AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
-        pMachine->setModified(Machine::IsModified_USB);
+        pMachine->i_setModified(Machine::IsModified_USB);
         mlock.release();
 
-        return mParent->onDeviceFilterChange(this);
+        return mParent->i_onDeviceFilterChange(this);
     }
 
     return S_OK;
@@ -705,7 +673,7 @@ STDMETHODIMP USBDeviceFilter::COMSETTER(MaskedInterfaces) (ULONG aMaskedIfs)
 // public methods only for internal purposes
 ////////////////////////////////////////////////////////////////////////////////
 
-bool USBDeviceFilter::isModified()
+bool USBDeviceFilter::i_isModified()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn (autoCaller.rc(), false);
@@ -717,7 +685,7 @@ bool USBDeviceFilter::isModified()
 /**
  *  @note Locks this object for writing.
  */
-void USBDeviceFilter::rollback()
+void USBDeviceFilter::i_rollback()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -732,7 +700,7 @@ void USBDeviceFilter::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void USBDeviceFilter::commit()
+void USBDeviceFilter::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -798,20 +766,11 @@ void USBDeviceFilter::unshare()
  *
  *  @return COM status.
  */
-HRESULT USBDeviceFilter::usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr)
+HRESULT USBDeviceFilter::i_usbFilterFieldGetter(USBFILTERIDX aIdx, com::Utf8Str &aStr)
 {
-    CheckComArgOutPointerValid(aStr);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Utf8Str str;
-    usbFilterFieldToString(&mData->mUSBFilter, aIdx, str);
-
-    str.cloneTo(aStr);
-
+    i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, aStr);
     return S_OK;
 }
 
@@ -823,29 +782,27 @@ HRESULT USBDeviceFilter::usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr)
  *
  *  @return COM status.
  */
-HRESULT USBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx,
-                                              const Utf8Str &strNew)
+HRESULT USBDeviceFilter::i_usbFilterFieldSetter(USBFILTERIDX aIdx,
+                                                const com::Utf8Str &strNew)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(mParent->getMachine());
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent->i_getMachine());
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Utf8Str strOld;
-    usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld);
+
+    com::Utf8Str strOld;
+    i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld);
     if (strOld != strNew)
     {
         m_fModified = true;
-        ComObjPtr<Machine> pMachine = mParent->getMachine();
+        ComObjPtr<Machine> pMachine = mParent->i_getMachine();
 
         mData.backup();
 
-        Utf8Str errStr;
-        HRESULT rc = usbFilterFieldFromString(&mData->mUSBFilter, aIdx, strNew, errStr);
+        com::Utf8Str errStr;
+        HRESULT rc = i_usbFilterFieldFromString(&mData->mUSBFilter, aIdx, strNew, errStr);
         if (FAILED(rc))
         {
             mData.rollback();
@@ -856,29 +813,15 @@ HRESULT USBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx,
         alock.release();
 
         AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
-        pMachine->setModified(Machine::IsModified_USB);
+        pMachine->i_setModified(Machine::IsModified_USB);
         mlock.release();
 
-        return mParent->onDeviceFilterChange(this);
+        return mParent->i_onDeviceFilterChange(this);
     }
 
     return S_OK;
 }
 
-/**
- *  Generic USB filter field setter, expects UTF-16 input.
- *
- *  @param  aIdx    The field index.
- *  @param  aStr    The new value.
- *
- *  @return COM status.
- */
-HRESULT USBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx,
-                                              IN_BSTR aStr)
-{
-    return usbFilterFieldSetter(aIdx, Utf8Str(aStr));
-}
-
 
 ////////////////////////////////////////////////////////////////////////////////
 // HostUSBDeviceFilter
@@ -930,7 +873,7 @@ HRESULT HostUSBDeviceFilter::init(Host *aParent,
 
     /* register with parent early, since uninit() will unconditionally
      * unregister on failure */
-    mParent->addChild(this);
+    mParent->i_addChild(this);
 
     mData.allocate();
     mData->mName = data.strName;
@@ -947,28 +890,28 @@ HRESULT HostUSBDeviceFilter::init(Host *aParent,
     HRESULT rc = S_OK;
     do
     {
-        rc = COMSETTER(Action)(data.action);
+        rc = setAction(data.action);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, data.strVendorId);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, data.strVendorId);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProductId);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProductId);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_DEVICE, data.strRevision);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_DEVICE, data.strRevision);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProduct);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProduct);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);
         if (FAILED(rc)) break;
 
-        rc = usbFilterFieldSetter(USBFILTERIDX_PORT, data.strPort);
+        rc = i_usbFilterFieldSetter(USBFILTERIDX_PORT, data.strPort);
         if (FAILED(rc)) break;
     }
     while (0);
@@ -999,7 +942,7 @@ HRESULT HostUSBDeviceFilter::init (Host *aParent, IN_BSTR aName)
 
     /* register with parent early, since uninit() will unconditionally
      * unregister on failure */
-    mParent->addChild(this);
+    mParent->i_addChild(this);
 
     mData.allocate();
 
@@ -1033,7 +976,7 @@ void HostUSBDeviceFilter::uninit()
 
     mData.free();
 
-    mParent->removeChild(this);
+    mParent->i_removeChild(this);
 
     unconst(mParent) = NULL;
 }
@@ -1051,28 +994,18 @@ RWLockHandle *HostUSBDeviceFilter::lockHandle() const
 
 // IUSBDeviceFilter properties
 ////////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Name) (BSTR *aName)
+HRESULT HostUSBDeviceFilter::getName(com::Utf8Str &aName)
 {
-    CheckComArgOutPointerValid(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mName.cloneTo(aName);
+    aName = mData->mName;
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Name) (IN_BSTR aName)
-{
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDeviceFilter::setName(const com::Utf8Str &aName)
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mData->mName != aName)
@@ -1082,19 +1015,15 @@ STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Name) (IN_BSTR aName)
         /* leave the lock before informing callbacks */
         alock.release();
 
-        return mParent->onUSBDeviceFilterChange (this);
+        return mParent->i_onUSBDeviceFilterChange (this);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Active) (BOOL *aActive)
-{
-    CheckComArgOutPointerValid(aActive);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDeviceFilter::getActive(BOOL *aActive)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aActive = mData->mActive;
@@ -1102,11 +1031,9 @@ STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Active) (BOOL *aActive)
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Active) (BOOL aActive)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDeviceFilter::setActive(BOOL aActive)
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     if (mData->mActive != aActive)
@@ -1116,132 +1043,118 @@ STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Active) (BOOL aActive)
         /* leave the lock before informing callbacks */
         alock.release();
 
-        return mParent->onUSBDeviceFilterChange (this, TRUE /* aActiveChanged  */);
+        return mParent->i_onUSBDeviceFilterChange (this, TRUE /* aActiveChanged  */);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(VendorId) (BSTR *aVendorId)
+HRESULT HostUSBDeviceFilter::getVendorId(com::Utf8Str &aVendorId)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_VENDOR_ID, aVendorId);
+    return i_usbFilterFieldGetter(USBFILTERIDX_VENDOR_ID, aVendorId);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(VendorId) (IN_BSTR aVendorId)
+HRESULT HostUSBDeviceFilter::setVendorId(const com::Utf8Str &aVendorId)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, aVendorId);
+    return i_usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, aVendorId);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(ProductId) (BSTR *aProductId)
+HRESULT HostUSBDeviceFilter::getProductId(com::Utf8Str &aProductId)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_PRODUCT_ID, aProductId);
+    return i_usbFilterFieldGetter(USBFILTERIDX_PRODUCT_ID, aProductId);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(ProductId) (IN_BSTR aProductId)
+HRESULT HostUSBDeviceFilter::setProductId(const com::Utf8Str &aProductId)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, aProductId);
+    return i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, aProductId);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Revision) (BSTR *aRevision)
+HRESULT HostUSBDeviceFilter::getRevision(com::Utf8Str &aRevision)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_DEVICE, aRevision);
+    return i_usbFilterFieldGetter(USBFILTERIDX_DEVICE, aRevision);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Revision) (IN_BSTR aRevision)
+HRESULT HostUSBDeviceFilter::setRevision(const com::Utf8Str &aRevision)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_DEVICE, aRevision);
+    return i_usbFilterFieldSetter(USBFILTERIDX_DEVICE, aRevision);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Manufacturer) (BSTR *aManufacturer)
+HRESULT HostUSBDeviceFilter::getManufacturer(com::Utf8Str &aManufacturer)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
+    return i_usbFilterFieldGetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Manufacturer) (IN_BSTR aManufacturer)
+HRESULT HostUSBDeviceFilter::setManufacturer(const com::Utf8Str &aManufacturer)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
+    return i_usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Product) (BSTR *aProduct)
+HRESULT HostUSBDeviceFilter::getProduct(com::Utf8Str &aProduct)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_PRODUCT_STR, aProduct);
+    return i_usbFilterFieldGetter(USBFILTERIDX_PRODUCT_STR, aProduct);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Product) (IN_BSTR aProduct)
+HRESULT HostUSBDeviceFilter::setProduct(const com::Utf8Str &aProduct)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, aProduct);
+    return i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, aProduct);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(SerialNumber) (BSTR *aSerialNumber)
+HRESULT HostUSBDeviceFilter::getSerialNumber(com::Utf8Str &aSerialNumber)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
+    return i_usbFilterFieldGetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(SerialNumber) (IN_BSTR aSerialNumber)
+HRESULT HostUSBDeviceFilter::setSerialNumber(const com::Utf8Str &aSerialNumber)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
+    return i_usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Port) (BSTR *aPort)
+HRESULT HostUSBDeviceFilter::getPort(com::Utf8Str &aPort)
 {
-    return usbFilterFieldGetter(USBFILTERIDX_PORT, aPort);
+    return i_usbFilterFieldGetter(USBFILTERIDX_PORT, aPort);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Port) (IN_BSTR aPort)
+HRESULT HostUSBDeviceFilter::setPort(const com::Utf8Str &aPort)
 {
-    return usbFilterFieldSetter(USBFILTERIDX_PORT, aPort);
+    return i_usbFilterFieldSetter(USBFILTERIDX_PORT, aPort);
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Remote) (BSTR *aRemote)
+HRESULT HostUSBDeviceFilter::getRemote(com::Utf8Str &aRemote)
 {
-    CheckComArgOutPointerValid(aRemote);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    mData->mRemote.string().cloneTo(aRemote);
+    aRemote = mData->mRemote.string();
 
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Remote) (IN_BSTR /* aRemote */)
+HRESULT HostUSBDeviceFilter::setRemote(const com::Utf8Str & /* aRemote */)
 {
     return setError(E_NOTIMPL,
                     tr("The remote state filter is not supported by IHostUSBDeviceFilter objects"));
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(MaskedInterfaces) (ULONG *aMaskedIfs)
-{
-    CheckComArgOutPointerValid(aMaskedIfs);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDeviceFilter::getMaskedInterfaces(ULONG *aMaskedIfs)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aMaskedIfs = mData->mMaskedIfs;
 
     return S_OK;
 }
-
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(MaskedInterfaces) (ULONG /* aMaskedIfs */)
+HRESULT HostUSBDeviceFilter::setMaskedInterfaces(ULONG /* aMaskedIfs */)
 {
     return setError(E_NOTIMPL,
                     tr("The masked interfaces property is not applicable to IHostUSBDeviceFilter objects"));
 }
 
-// IHostUSBDeviceFilter properties
+// wrapped IHostUSBDeviceFilter properties
 ////////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Action) (USBDeviceFilterAction_T *aAction)
+HRESULT HostUSBDeviceFilter::getAction(USBDeviceFilterAction_T *aAction)
 {
     CheckComArgOutPointerValid(aAction);
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     switch (USBFilterGetFilterType (&mData->mUSBFilter))
@@ -1254,11 +1167,9 @@ STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Action) (USBDeviceFilterAction_T *aA
     return S_OK;
 }
 
-STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Action) (USBDeviceFilterAction_T aAction)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT HostUSBDeviceFilter::setAction(USBDeviceFilterAction_T aAction)
+{
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     USBFILTERTYPE filterType;
@@ -1285,12 +1196,15 @@ STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Action) (USBDeviceFilterAction_T aAc
         /* leave the lock before informing callbacks */
         alock.release();
 
-        return mParent->onUSBDeviceFilterChange (this);
+        return mParent->i_onUSBDeviceFilterChange (this);
     }
 
     return S_OK;
 }
 
+
+// IHostUSBDeviceFilter properties
+////////////////////////////////////////////////////////////////////////////////
 /**
  *  Generic USB filter field getter.
  *
@@ -1299,40 +1213,28 @@ STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Action) (USBDeviceFilterAction_T aAc
  *
  *  @return COM status.
  */
-HRESULT HostUSBDeviceFilter::usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr)
+HRESULT HostUSBDeviceFilter::i_usbFilterFieldGetter(USBFILTERIDX aIdx, com::Utf8Str &aStr)
 {
-    CheckComArgOutPointerValid(aStr);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    Utf8Str str;
-    usbFilterFieldToString(&mData->mUSBFilter, aIdx, str);
-
-    str.cloneTo(aStr);
-
+    i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, aStr);
     return S_OK;
 }
 
-void HostUSBDeviceFilter::saveSettings(settings::USBDeviceFilter &data)
+void HostUSBDeviceFilter::i_saveSettings(settings::USBDeviceFilter &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     data.strName = mData->mName;
     data.fActive = !!mData->mActive;
-
-    usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_VENDOR_ID, data.strVendorId);
-    usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PRODUCT_ID, data.strProductId);
-    usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_DEVICE, data.strRevision);
-    usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);
-    usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PRODUCT_STR, data.strProduct);
-    usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);
-    usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PORT, data.strPort);
+    i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_VENDOR_ID, data.strVendorId);
+    i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PRODUCT_ID, data.strProductId);
+    i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_DEVICE, data.strRevision);
+    i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);
+    i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PRODUCT_STR, data.strProduct);
+    i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);
+    i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PORT, data.strPort);
 
     COMGETTER(Action)(&data.action);
 }
@@ -1347,22 +1249,16 @@ void HostUSBDeviceFilter::saveSettings(settings::USBDeviceFilter &data)
  *
  *  @return COM status.
  */
-HRESULT HostUSBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx, Bstr aStr)
+HRESULT HostUSBDeviceFilter::i_usbFilterFieldSetter(USBFILTERIDX aIdx, const com::Utf8Str &aStr)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     Utf8Str strOld;
-    Utf8Str strNew(aStr);
-    usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld);
-    if (strOld != strNew)
+    i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld);
+    if (strOld != aStr)
     {
         //mData.backup();
-
-        Utf8Str errStr;
-        HRESULT rc = USBDeviceFilter::usbFilterFieldFromString(&mData->mUSBFilter, aIdx, aStr, errStr);
+        com::Utf8Str errStr;
+        HRESULT rc = USBDeviceFilter::i_usbFilterFieldFromString(&mData->mUSBFilter, aIdx, aStr, errStr);
         if (FAILED(rc))
         {
             //mData.rollback();
@@ -1372,7 +1268,7 @@ HRESULT HostUSBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx, Bstr aStr)
         /* leave the lock before informing callbacks */
         alock.release();
 
-        return mParent->onUSBDeviceFilterChange(this);
+        return mParent->i_onUSBDeviceFilterChange(this);
     }
 
     return S_OK;
diff --git a/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp b/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
index 09b42f5..bb1fc37 100644
--- a/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
+++ b/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
@@ -1,10 +1,10 @@
 /* $Id: USBDeviceFiltersImpl.cpp $ */
 /** @file
- * Implementation of IUSBController.
+ * Implementation of IUSBDeviceFilters.
  */
 
 /*
- * Copyright (C) 2005-2013 Oracle Corporation
+ * Copyright (C) 2005-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -50,7 +50,7 @@ struct USBDeviceFilters::Data
 {
     Data(Machine *pMachine)
         : pParent(pMachine),
-          pHost(pMachine->getVirtualBox()->host())
+          pHost(pMachine->i_getVirtualBox()->i_host())
     { }
 
     ~Data()
@@ -289,54 +289,47 @@ public:
 #endif /* !VBOX_WITH_USB */
 
 
-STDMETHODIMP USBDeviceFilters::COMGETTER(DeviceFilters)(ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters))
+HRESULT USBDeviceFilters::getDeviceFilters(std::vector<ComPtr<IUSBDeviceFilter> > &aDeviceFilters)
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgOutSafeArrayPointerValid(aDevicesFilters);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     SafeIfaceArray<IUSBDeviceFilter> collection(*m->llDeviceFilters.data());
-    collection.detachTo(ComSafeArrayOutArg(aDevicesFilters));
+    aDeviceFilters.resize(collection.size());
+    if (collection.size())
+        for (size_t i = 0; i < collection.size(); ++i)
+            aDeviceFilters[i] = collection[i];
 
     return S_OK;
 #else
-    NOREF(aDevicesFilters);
+    NOREF(aDeviceFilters);
 # ifndef RT_OS_WINDOWS
-    NOREF(aDevicesFiltersSize);
+    NOREF(aDeviceFilters);
 # endif
     ReturnComNotImplemented();
 #endif
 }
 
-// IUSBDeviceFilters methods
+// wrapped IUSBDeviceFilters methods
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP USBDeviceFilters::CreateDeviceFilter(IN_BSTR aName,
-                                                  IUSBDeviceFilter **aFilter)
+HRESULT USBDeviceFilters::createDeviceFilter(const com::Utf8Str &aName,
+                                             ComPtr<IUSBDeviceFilter> &aFilter)
+
 {
 #ifdef VBOX_WITH_USB
-    CheckComArgOutPointerValid(aFilter);
-
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(m->pParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     ComObjPtr<USBDeviceFilter> pFilter;
     pFilter.createObject();
-    HRESULT rc = pFilter->init(this, aName);
+    HRESULT rc = pFilter->init(this, Bstr(aName).raw());
     ComAssertComRCRetRC(rc);
-    rc = pFilter.queryInterfaceTo(aFilter);
+    rc = pFilter.queryInterfaceTo(aFilter.asOutParam());
     AssertComRCReturnRC(rc);
 
     return S_OK;
@@ -347,23 +340,20 @@ STDMETHODIMP USBDeviceFilters::CreateDeviceFilter(IN_BSTR aName,
 #endif
 }
 
-STDMETHODIMP USBDeviceFilters::InsertDeviceFilter(ULONG aPosition,
-                                                  IUSBDeviceFilter *aFilter)
+
+HRESULT USBDeviceFilters::insertDeviceFilter(ULONG aPosition,
+                                             const ComPtr<IUSBDeviceFilter> &aFilter)
 {
 #ifdef VBOX_WITH_USB
 
-    CheckComArgNotNull(aFilter);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(m->pParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    ComObjPtr<USBDeviceFilter> pFilter = static_cast<USBDeviceFilter*>(aFilter);
+    IUSBDeviceFilter *iFilter = aFilter;
+    ComObjPtr<USBDeviceFilter> pFilter = static_cast<USBDeviceFilter*>(iFilter);
 
     if (pFilter->mInList)
         return setError(VBOX_E_INVALID_OBJECT_STATE,
@@ -386,19 +376,19 @@ STDMETHODIMP USBDeviceFilters::InsertDeviceFilter(ULONG aPosition,
     pFilter->mInList = true;
 
     /* notify the proxy (only when it makes sense) */
-    if (pFilter->getData().mActive && Global::IsOnline(adep.machineState())
-        && pFilter->getData().mRemote.isMatch(false))
+    if (pFilter->i_getData().mActive && Global::IsOnline(adep.machineState())
+        && pFilter->i_getData().mRemote.isMatch(false))
     {
-        USBProxyService *pProxySvc = m->pHost->usbProxyService();
+        USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
         ComAssertRet(pProxySvc, E_FAIL);
 
-        ComAssertRet(pFilter->getId() == NULL, E_FAIL);
-        pFilter->getId() = pProxySvc->insertFilter(&pFilter->getData().mUSBFilter);
+        ComAssertRet(pFilter->i_getId() == NULL, E_FAIL);
+        pFilter->i_getId() = pProxySvc->insertFilter(&pFilter->i_getData().mUSBFilter);
     }
 
     alock.release();
     AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS);
-    m->pParent->setModified(Machine::IsModified_USB);
+    m->pParent->i_setModified(Machine::IsModified_USB);
     mlock.release();
 
     return S_OK;
@@ -412,18 +402,12 @@ STDMETHODIMP USBDeviceFilters::InsertDeviceFilter(ULONG aPosition,
 #endif /* VBOX_WITH_USB */
 }
 
-STDMETHODIMP USBDeviceFilters::RemoveDeviceFilter(ULONG aPosition,
-                                                  IUSBDeviceFilter **aFilter)
+HRESULT USBDeviceFilters::removeDeviceFilter(ULONG aPosition,
+                                             ComPtr<IUSBDeviceFilter> &aFilter)
 {
 #ifdef VBOX_WITH_USB
-
-    CheckComArgOutPointerValid(aFilter);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine needs to be mutable */
-    AutoMutableStateDependency adep(m->pParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(m->pParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -454,24 +438,24 @@ STDMETHODIMP USBDeviceFilters::RemoveDeviceFilter(ULONG aPosition,
 
     /* cancel sharing (make an independent copy of data) */
     pFilter->unshare();
+    pFilter.queryInterfaceTo(aFilter.asOutParam());
 
-    pFilter.queryInterfaceTo(aFilter);
 
     /* notify the proxy (only when it makes sense) */
-    if (pFilter->getData().mActive && Global::IsOnline(adep.machineState())
-        && pFilter->getData().mRemote.isMatch(false))
+    if (pFilter->i_getData().mActive && Global::IsOnline(adep.machineState())
+        && pFilter->i_getData().mRemote.isMatch(false))
     {
-        USBProxyService *pProxySvc = m->pHost->usbProxyService();
+        USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
         ComAssertRet(pProxySvc, E_FAIL);
 
-        ComAssertRet(pFilter->getId() != NULL, E_FAIL);
-        pProxySvc->removeFilter(pFilter->getId());
-        pFilter->getId() = NULL;
+        ComAssertRet(pFilter->i_getId() != NULL, E_FAIL);
+        pProxySvc->removeFilter(pFilter->i_getId());
+        pFilter->i_getId() = NULL;
     }
 
     alock.release();
     AutoWriteLock mlock(m->pParent COMMA_LOCKVAL_SRC_POS);
-    m->pParent->setModified(Machine::IsModified_USB);
+    m->pParent->i_setModified(Machine::IsModified_USB);
     mlock.release();
 
     return S_OK;
@@ -496,7 +480,7 @@ STDMETHODIMP USBDeviceFilters::RemoveDeviceFilter(ULONG aPosition,
  *
  *  @note Does not lock "this" as Machine::loadHardware, which calls this, does not lock either.
  */
-HRESULT USBDeviceFilters::loadSettings(const settings::USB &data)
+HRESULT USBDeviceFilters::i_loadSettings(const settings::USB &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -539,7 +523,7 @@ HRESULT USBDeviceFilters::loadSettings(const settings::USB &data)
  *
  *  @note Locks this object for reading.
  */
-HRESULT USBDeviceFilters::saveSettings(settings::USB &data)
+HRESULT USBDeviceFilters::i_saveSettings(settings::USB &data)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -554,7 +538,7 @@ HRESULT USBDeviceFilters::saveSettings(settings::USB &data)
          ++it)
     {
         AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS);
-        const USBDeviceFilter::Data &filterData = (*it)->getData();
+        const USBDeviceFilter::Data &filterData = (*it)->i_getData();
 
         Bstr str;
 
@@ -586,7 +570,7 @@ HRESULT USBDeviceFilters::saveSettings(settings::USB &data)
 }
 
 /** @note Locks objects for writing! */
-void USBDeviceFilters::rollback()
+void USBDeviceFilters::i_rollback()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -601,7 +585,7 @@ void USBDeviceFilters::rollback()
 
     if (m->llDeviceFilters.isBackedUp())
     {
-        USBProxyService *pProxySvc = m->pHost->usbProxyService();
+        USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
         Assert(pProxySvc);
 
         /* uninitialize all new filters (absent in the backed up list) */
@@ -613,14 +597,14 @@ void USBDeviceFilters::rollback()
                 backedList->end())
             {
                 /* notify the proxy (only when it makes sense) */
-                if ((*it)->getData().mActive &&
+                if ((*it)->i_getData().mActive &&
                     Global::IsOnline(adep.machineState())
-                    && (*it)->getData().mRemote.isMatch(false))
+                    && (*it)->i_getData().mRemote.isMatch(false))
                 {
                     USBDeviceFilter *pFilter = *it;
-                    Assert(pFilter->getId() != NULL);
-                    pProxySvc->removeFilter(pFilter->getId());
-                    pFilter->getId() = NULL;
+                    Assert(pFilter->i_getId() != NULL);
+                    pProxySvc->removeFilter(pFilter->i_getId());
+                    pFilter->i_getId() = NULL;
                 }
 
                 (*it)->uninit();
@@ -639,12 +623,12 @@ void USBDeviceFilters::rollback()
                     m->llDeviceFilters->end())
                 {
                     /* notify the proxy (only when necessary) */
-                    if ((*it)->getData().mActive
-                            && (*it)->getData().mRemote.isMatch(false))
+                    if ((*it)->i_getData().mActive
+                            && (*it)->i_getData().mRemote.isMatch(false))
                     {
                         USBDeviceFilter *pFilter = *it; /* resolve ambiguity */
-                        Assert(pFilter->getId() == NULL);
-                        pFilter->getId() = pProxySvc->insertFilter(&pFilter->getData().mUSBFilter);
+                        Assert(pFilter->i_getId() == NULL);
+                        pFilter->i_getId() = pProxySvc->insertFilter(&pFilter->i_getData().mUSBFilter);
                     }
                 }
                 ++it;
@@ -662,11 +646,11 @@ void USBDeviceFilters::rollback()
     DeviceFilterList::const_iterator it = m->llDeviceFilters->begin();
     while (it != m->llDeviceFilters->end())
     {
-        if ((*it)->isModified())
+        if ((*it)->i_isModified())
         {
-            (*it)->rollback();
+            (*it)->i_rollback();
             /* call this to notify the USB proxy about changes */
-            onDeviceFilterChange(*it);
+            i_onDeviceFilterChange(*it);
         }
         ++it;
     }
@@ -678,7 +662,7 @@ void USBDeviceFilters::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void USBDeviceFilters::commit()
+void USBDeviceFilters::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -710,10 +694,10 @@ void USBDeviceFilters::commit()
             DeviceFilterList::const_iterator it = m->llDeviceFilters->begin();
             while (it != m->llDeviceFilters->end())
             {
-                (*it)->commit();
+                (*it)->i_commit();
 
                 /* look if this filter has a peer filter */
-                ComObjPtr<USBDeviceFilter> peer = (*it)->peer();
+                ComObjPtr<USBDeviceFilter> peer = (*it)->i_peer();
                 if (!peer)
                 {
                     /* no peer means the filter is a newly created one;
@@ -762,7 +746,7 @@ void USBDeviceFilters::commit()
         DeviceFilterList::const_iterator it = m->llDeviceFilters->begin();
         while (it != m->llDeviceFilters->end())
         {
-            (*it)->commit();
+            (*it)->i_commit();
             ++it;
         }
     }
@@ -773,7 +757,7 @@ void USBDeviceFilters::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void USBDeviceFilters::copyFrom(USBDeviceFilters *aThat)
+void USBDeviceFilters::i_copyFrom(USBDeviceFilters *aThat)
 {
     AssertReturnVoid(aThat != NULL);
 
@@ -824,8 +808,8 @@ void USBDeviceFilters::copyFrom(USBDeviceFilters *aThat)
  *
  *  @note Locks nothing.
  */
-HRESULT USBDeviceFilters::onDeviceFilterChange(USBDeviceFilter *aFilter,
-                                               BOOL aActiveChanged /* = FALSE */)
+HRESULT USBDeviceFilters::i_onDeviceFilterChange(USBDeviceFilter *aFilter,
+                                                 BOOL aActiveChanged /* = FALSE */)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -841,39 +825,39 @@ HRESULT USBDeviceFilters::onDeviceFilterChange(USBDeviceFilter *aFilter,
     /* we don't modify our data fields -- no need to lock */
 
     if (    aFilter->mInList
-         && m->pParent->isRegistered())
+         && m->pParent->i_isRegistered())
     {
-        USBProxyService *pProxySvc = m->pHost->usbProxyService();
+        USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
         ComAssertRet(pProxySvc, E_FAIL);
 
         if (aActiveChanged)
         {
-            if (aFilter->getData().mRemote.isMatch(false))
+            if (aFilter->i_getData().mRemote.isMatch(false))
             {
                 /* insert/remove the filter from the proxy */
-                if (aFilter->getData().mActive)
+                if (aFilter->i_getData().mActive)
                 {
-                    ComAssertRet(aFilter->getId() == NULL, E_FAIL);
-                    aFilter->getId() = pProxySvc->insertFilter(&aFilter->getData().mUSBFilter);
+                    ComAssertRet(aFilter->i_getId() == NULL, E_FAIL);
+                    aFilter->i_getId() = pProxySvc->insertFilter(&aFilter->i_getData().mUSBFilter);
                 }
                 else
                 {
-                    ComAssertRet(aFilter->getId() != NULL, E_FAIL);
-                    pProxySvc->removeFilter(aFilter->getId());
-                    aFilter->getId() = NULL;
+                    ComAssertRet(aFilter->i_getId() != NULL, E_FAIL);
+                    pProxySvc->removeFilter(aFilter->i_getId());
+                    aFilter->i_getId() = NULL;
                 }
             }
         }
         else
         {
-            if (aFilter->getData().mActive)
+            if (aFilter->i_getData().mActive)
             {
                 /* update the filter in the proxy */
-                ComAssertRet(aFilter->getId() != NULL, E_FAIL);
-                pProxySvc->removeFilter(aFilter->getId());
-                if (aFilter->getData().mRemote.isMatch(false))
+                ComAssertRet(aFilter->i_getId() != NULL, E_FAIL);
+                pProxySvc->removeFilter(aFilter->i_getId());
+                if (aFilter->i_getData().mRemote.isMatch(false))
                 {
-                    aFilter->getId() = pProxySvc->insertFilter(&aFilter->getData().mUSBFilter);
+                    aFilter->i_getId() = pProxySvc->insertFilter(&aFilter->i_getData().mUSBFilter);
                 }
             }
         }
@@ -890,13 +874,13 @@ HRESULT USBDeviceFilters::onDeviceFilterChange(USBDeviceFilter *aFilter,
  *
  *  @note Locks this object for reading.
  */
-bool USBDeviceFilters::hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
+bool USBDeviceFilters::i_hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), false);
 
     /* It is not possible to work with USB device if there is no USB controller present. */
-    if (!m->pParent->isUSBControllerPresent())
+    if (!m->pParent->i_isUSBControllerPresent())
         return false;
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -907,9 +891,9 @@ bool USBDeviceFilters::hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice
          ++it)
     {
         AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS);
-        if (aDevice->isMatch((*it)->getData()))
+        if (aDevice->i_isMatch((*it)->i_getData()))
         {
-            *aMaskedIfs = (*it)->getData().mMaskedIfs;
+            *aMaskedIfs = (*it)->i_getData().mMaskedIfs;
             return true;
         }
     }
@@ -929,7 +913,7 @@ bool USBDeviceFilters::hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice
  *
  *  @note Locks this object for reading.
  */
-bool USBDeviceFilters::hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs)
+bool USBDeviceFilters::i_hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs)
 {
     LogFlowThisFuncEnter();
 
@@ -937,7 +921,7 @@ bool USBDeviceFilters::hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedI
     AssertComRCReturn(autoCaller.rc(), false);
 
     /* It is not possible to work with USB device if there is no USB controller present. */
-    if (!m->pParent->isUSBControllerPresent())
+    if (!m->pParent->i_isUSBControllerPresent())
         return false;
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -1004,7 +988,7 @@ bool USBDeviceFilters::hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedI
          ++it)
     {
         AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS);
-        const USBDeviceFilter::Data &aData = (*it)->getData();
+        const USBDeviceFilter::Data &aData = (*it)->i_getData();
 
         if (!aData.mActive)
             continue;
@@ -1032,7 +1016,7 @@ bool USBDeviceFilters::hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedI
  *
  *  @note Locks this object for reading.
  */
-HRESULT USBDeviceFilters::notifyProxy(bool aInsertFilters)
+HRESULT USBDeviceFilters::i_notifyProxy(bool aInsertFilters)
 {
     LogFlowThisFunc(("aInsertFilters=%RTbool\n", aInsertFilters));
 
@@ -1041,7 +1025,7 @@ HRESULT USBDeviceFilters::notifyProxy(bool aInsertFilters)
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    USBProxyService *pProxySvc = m->pHost->usbProxyService();
+    USBProxyService *pProxySvc = m->pHost->i_usbProxyService();
     AssertReturn(pProxySvc, E_FAIL);
 
     DeviceFilterList::const_iterator it = m->llDeviceFilters->begin();
@@ -1050,24 +1034,24 @@ HRESULT USBDeviceFilters::notifyProxy(bool aInsertFilters)
         USBDeviceFilter *pFilter = *it; /* resolve ambiguity (for ComPtr below) */
 
         /* notify the proxy (only if the filter is active) */
-        if (   pFilter->getData().mActive
-            && pFilter->getData().mRemote.isMatch(false) /* and if the filter is NOT remote */
+        if (   pFilter->i_getData().mActive
+            && pFilter->i_getData().mRemote.isMatch(false) /* and if the filter is NOT remote */
            )
         {
             if (aInsertFilters)
             {
-                AssertReturn(pFilter->getId() == NULL, E_FAIL);
-                pFilter->getId() = pProxySvc->insertFilter(&pFilter->getData().mUSBFilter);
+                AssertReturn(pFilter->i_getId() == NULL, E_FAIL);
+                pFilter->i_getId() = pProxySvc->insertFilter(&pFilter->i_getData().mUSBFilter);
             }
             else
             {
                 /* It's possible that the given filter was not inserted the proxy
                  * when this method gets called (as a result of an early VM
                  * process crash for example. So, don't assert that ID != NULL. */
-                if (pFilter->getId() != NULL)
+                if (pFilter->i_getId() != NULL)
                 {
-                    pProxySvc->removeFilter(pFilter->getId());
-                    pFilter->getId() = NULL;
+                    pProxySvc->removeFilter(pFilter->i_getId());
+                    pFilter->i_getId() = NULL;
                 }
             }
         }
@@ -1077,7 +1061,7 @@ HRESULT USBDeviceFilters::notifyProxy(bool aInsertFilters)
     return S_OK;
 }
 
-Machine* USBDeviceFilters::getMachine()
+Machine* USBDeviceFilters::i_getMachine()
 {
     return m->pParent;
 }
diff --git a/src/VBox/Main/src-server/USBProxyService.cpp b/src/VBox/Main/src-server/USBProxyService.cpp
index ddc2103..84de980 100644
--- a/src/VBox/Main/src-server/USBProxyService.cpp
+++ b/src/VBox/Main/src-server/USBProxyService.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -132,15 +132,16 @@ RWLockHandle *USBProxyService::lockHandle() const
  *
  * @remarks The caller must own the write lock of the host object.
  */
-HRESULT USBProxyService::getDeviceCollection(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices))
+HRESULT USBProxyService::getDeviceCollection(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices)
 {
     AssertReturn(isWriteLockOnCurrentThread(), E_FAIL);
-    CheckComArgOutSafeArrayPointerValid(aUSBDevices);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    SafeIfaceArray<IHostUSBDevice> Collection(mDevices);
-    Collection.detachTo(ComSafeArrayOutArg(aUSBDevices));
+    aUSBDevices.resize(mDevices.size());
+    size_t i = 0;
+    for (HostUSBDeviceList::const_iterator it = mDevices.begin(); it != mDevices.end(); ++it, ++i)
+        aUSBDevices[i] = *it;
 
     return S_OK;
 }
@@ -164,7 +165,7 @@ HRESULT USBProxyService::getDeviceCollection(ComSafeArrayOut(IHostUSBDevice *, a
  * @remarks This method may operate synchronously as well as asynchronously. In the
  *          former case it will temporarily abandon locks because of IPC.
  */
-HRESULT USBProxyService::captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId)
+HRESULT USBProxyService::captureDeviceForVM(SessionMachine *aMachine, IN_GUID aId, const com::Utf8Str &aCaptureFilename)
 {
     ComAssertRet(aMachine, E_INVALIDARG);
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -181,7 +182,7 @@ HRESULT USBProxyService::captureDeviceForVM(SessionMachine *aMachine, IN_GUID aI
      * Try to capture the device
      */
     alock.release();
-    return pHostDevice->requestCaptureForVM(aMachine, true /* aSetError */);
+    return pHostDevice->i_requestCaptureForVM(aMachine, true /* aSetError */, aCaptureFilename);
 }
 
 
@@ -210,14 +211,14 @@ HRESULT USBProxyService::detachDeviceFromVM(SessionMachine *aMachine, IN_GUID aI
 {
     LogFlowThisFunc(("aMachine=%p{%s} aId={%RTuuid} aDone=%RTbool\n",
                      aMachine,
-                     aMachine->getName().c_str(),
+                     aMachine->i_getName().c_str(),
                      Guid(aId).raw(),
                      aDone));
 
     // get a list of all running machines while we're outside the lock
     // (getOpenedMachines requests locks which are incompatible with the lock of the machines list)
     SessionMachinesList llOpenedMachines;
-    mHost->parent()->getOpenedMachines(llOpenedMachines);
+    mHost->i_parent()->i_getOpenedMachines(llOpenedMachines);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -229,9 +230,9 @@ HRESULT USBProxyService::detachDeviceFromVM(SessionMachine *aMachine, IN_GUID aI
      * Work the state machine.
      */
     LogFlowThisFunc(("id={%RTuuid} state=%s aDone=%RTbool name={%s}\n",
-                     pHostDevice->getId().raw(), pHostDevice->getStateName(), aDone, pHostDevice->getName().c_str()));
+                     pHostDevice->i_getId().raw(), pHostDevice->i_getStateName(), aDone, pHostDevice->i_getName().c_str()));
     bool fRunFilters = false;
-    HRESULT hrc = pHostDevice->onDetachFromVM(aMachine, aDone, &fRunFilters);
+    HRESULT hrc = pHostDevice->i_onDetachFromVM(aMachine, aDone, &fRunFilters);
 
     /*
      * Run filters if necessary.
@@ -239,7 +240,7 @@ HRESULT USBProxyService::detachDeviceFromVM(SessionMachine *aMachine, IN_GUID aI
     if (    SUCCEEDED(hrc)
         &&  fRunFilters)
     {
-        Assert(aDone && pHostDevice->getUnistate() == kHostUSBDeviceState_HeldByProxy && pHostDevice->getMachine().isNull());
+        Assert(aDone && pHostDevice->i_getUnistate() == kHostUSBDeviceState_HeldByProxy && pHostDevice->i_getMachine().isNull());
         devLock.release();
         alock.release();
         HRESULT hrc2 = runAllFiltersOnDevice(pHostDevice, llOpenedMachines, aMachine);
@@ -273,7 +274,7 @@ HRESULT USBProxyService::autoCaptureDevicesForVM(SessionMachine *aMachine)
 {
     LogFlowThisFunc(("aMachine=%p{%s}\n",
                      aMachine,
-                     aMachine->getName().c_str()));
+                     aMachine->i_getName().c_str()));
 
     /*
      * Make a copy of the list because we cannot hold the lock protecting it.
@@ -289,9 +290,9 @@ HRESULT USBProxyService::autoCaptureDevicesForVM(SessionMachine *aMachine)
     {
         ComObjPtr<HostUSBDevice> device = *it;
         AutoReadLock devLock(device COMMA_LOCKVAL_SRC_POS);
-        if (   device->getUnistate() == kHostUSBDeviceState_HeldByProxy
-            || device->getUnistate() == kHostUSBDeviceState_Unused
-            || device->getUnistate() == kHostUSBDeviceState_Capturable)
+        if (   device->i_getUnistate() == kHostUSBDeviceState_HeldByProxy
+            || device->i_getUnistate() == kHostUSBDeviceState_Unused
+            || device->i_getUnistate() == kHostUSBDeviceState_Capturable)
         {
             devLock.release();
             runMachineFilters(aMachine, device);
@@ -328,7 +329,7 @@ HRESULT USBProxyService::detachAllDevicesFromVM(SessionMachine *aMachine, bool a
     // get a list of all running machines while we're outside the lock
     // (getOpenedMachines requests locks which are incompatible with the host object lock)
     SessionMachinesList llOpenedMachines;
-    mHost->parent()->getOpenedMachines(llOpenedMachines);
+    mHost->i_parent()->i_getOpenedMachines(llOpenedMachines);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -345,17 +346,19 @@ HRESULT USBProxyService::detachAllDevicesFromVM(SessionMachine *aMachine, bool a
     {
         ComObjPtr<HostUSBDevice> pHostDevice = *it;
         AutoWriteLock devLock(pHostDevice COMMA_LOCKVAL_SRC_POS);
-        if (pHostDevice->getMachine() == aMachine)
+        if (pHostDevice->i_getMachine() == aMachine)
         {
             /*
              * Same procedure as in detachUSBDevice().
              */
             bool fRunFilters = false;
-            HRESULT hrc = pHostDevice->onDetachFromVM(aMachine, aDone, &fRunFilters, aAbnormal);
+            HRESULT hrc = pHostDevice->i_onDetachFromVM(aMachine, aDone, &fRunFilters, aAbnormal);
             if (    SUCCEEDED(hrc)
                 &&  fRunFilters)
             {
-                Assert(aDone && pHostDevice->getUnistate() == kHostUSBDeviceState_HeldByProxy && pHostDevice->getMachine().isNull());
+                Assert(   aDone
+                       && pHostDevice->i_getUnistate() == kHostUSBDeviceState_HeldByProxy
+                       && pHostDevice->i_getMachine().isNull());
                 devLock.release();
                 alock.release();
                 HRESULT hrc2 = runAllFiltersOnDevice(pHostDevice, llOpenedMachines, aMachine);
@@ -394,7 +397,7 @@ HRESULT USBProxyService::runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice
                                                SessionMachinesList &llOpenedMachines,
                                                SessionMachine *aIgnoreMachine)
 {
-    LogFlowThisFunc(("{%s} ignoring=%p\n", aDevice->getName().c_str(), aIgnoreMachine));
+    LogFlowThisFunc(("{%s} ignoring=%p\n", aDevice->i_getName().c_str(), aIgnoreMachine));
 
     /*
      * Verify preconditions.
@@ -403,14 +406,15 @@ HRESULT USBProxyService::runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), E_FAIL);
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     AutoWriteLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    AssertMsgReturn(aDevice->isCapturableOrHeld(), ("{%s} %s\n", aDevice->getName().c_str(), aDevice->getStateName()), E_FAIL);
+    AssertMsgReturn(aDevice->i_isCapturableOrHeld(), ("{%s} %s\n", aDevice->i_getName().c_str(),
+                                                      aDevice->i_getStateName()), E_FAIL);
 
     /*
      * Get the lists we'll iterate.
      */
     Host::USBDeviceFilterList globalFilters;
 
-    mHost->getUSBFilters(&globalFilters);
+    mHost->i_getUSBFilters(&globalFilters);
 
     /*
      * Run global filters filters first.
@@ -421,8 +425,8 @@ HRESULT USBProxyService::runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice
          ++it)
     {
         AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS);
-        const HostUSBDeviceFilter::Data &data = (*it)->getData();
-        if (aDevice->isMatch(data))
+        const HostUSBDeviceFilter::Data &data = (*it)->i_getData();
+        if (aDevice->i_isMatch(data))
         {
             USBDeviceFilterAction_T action = USBDeviceFilterAction_Null;
             (*it)->COMGETTER(Action)(&action);
@@ -434,7 +438,7 @@ HRESULT USBProxyService::runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice
                 filterLock.release();
                 devLock.release();
                 alock.release();
-                aDevice->requestReleaseToHost();
+                aDevice->i_requestReleaseToHost();
                 return S_OK;
             }
             if (action == USBDeviceFilterAction_Hold)
@@ -470,7 +474,7 @@ HRESULT USBProxyService::runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice
         alock.release();
         if (runMachineFilters(pMachine, aDevice))
         {
-            LogFlowThisFunc(("{%s} attached to %p\n", aDevice->getName().c_str(), (void *)pMachine));
+            LogFlowThisFunc(("{%s} attached to %p\n", aDevice->i_getName().c_str(), (void *)pMachine));
             return S_OK;
         }
         alock.acquire();
@@ -484,9 +488,9 @@ HRESULT USBProxyService::runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice
     devLock.release();
     alock.release();
     if (fHoldIt)
-        aDevice->requestHold();
+        aDevice->i_requestHold();
     else
-        aDevice->requestReleaseToHost();
+        aDevice->i_requestReleaseToHost();
     return S_OK;
 }
 
@@ -505,7 +509,7 @@ HRESULT USBProxyService::runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice
  */
 bool USBProxyService::runMachineFilters(SessionMachine *aMachine, ComObjPtr<HostUSBDevice> &aDevice)
 {
-    LogFlowThisFunc(("{%s} aMachine=%p \n", aDevice->getName().c_str(), aMachine));
+    LogFlowThisFunc(("{%s} aMachine=%p \n", aDevice->i_getName().c_str(), aMachine));
 
     /*
      * Validate preconditions.
@@ -520,10 +524,10 @@ bool USBProxyService::runMachineFilters(SessionMachine *aMachine, ComObjPtr<Host
      * Do the job.
      */
     ULONG ulMaskedIfs;
-    if (aMachine->hasMatchingUSBFilter(aDevice, &ulMaskedIfs))
+    if (aMachine->i_hasMatchingUSBFilter(aDevice, &ulMaskedIfs))
     {
         /* try to capture the device */
-        HRESULT hrc = aDevice->requestCaptureForVM(aMachine, false /* aSetError */, ulMaskedIfs);
+        HRESULT hrc = aDevice->i_requestCaptureForVM(aMachine, false /* aSetError */, Utf8Str(), ulMaskedIfs);
         return SUCCEEDED(hrc)
             || hrc == E_UNEXPECTED /* bad device state, give up */;
     }
@@ -813,7 +817,7 @@ static PUSBDEVICE sortDevices(PUSBDEVICE pDevices)
         /* find location. */
         PUSBDEVICE pCur = pTail;
         while (     pCur
-               &&   HostUSBDevice::compare(pCur, pDev) > 0)
+               &&   HostUSBDevice::i_compare(pCur, pDev) > 0)
             pCur = pCur->pPrev;
 
         /* insert (after pCur) */
@@ -861,7 +865,7 @@ void USBProxyService::processChanges(void)
     // get a list of all running machines while we're outside the lock
     // (getOpenedMachines requests higher priority locks)
     SessionMachinesList llOpenedMachines;
-    mHost->parent()->getOpenedMachines(llOpenedMachines);
+    mHost->i_parent()->i_getOpenedMachines(llOpenedMachines);
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
@@ -903,7 +907,7 @@ void USBProxyService::processChanges(void)
             if (!pDevices)
                 iDiff = -1;
             else
-                iDiff = pHostDevice->compare(pDevices);
+                iDiff = pHostDevice->i_compare(pDevices);
         }
         if (!iDiff)
         {
@@ -924,7 +928,7 @@ void USBProxyService::processChanges(void)
                               (fRunFilters ? &llOpenedMachines : NULL),
                               pIgnoreMachine);
             alock.acquire();
-            it++;
+            ++it;
         }
         else
         {
@@ -942,8 +946,8 @@ void USBProxyService::processChanges(void)
                 NewObj->init(pNew, this);
                 Log(("USBProxyService::processChanges: attached %p {%s} %s / %p:{.idVendor=%#06x, .idProduct=%#06x, .pszProduct=\"%s\", .pszManufacturer=\"%s\"}\n",
                      (HostUSBDevice *)NewObj,
-                     NewObj->getName().c_str(),
-                     NewObj->getStateName(),
+                     NewObj->i_getName().c_str(),
+                     NewObj->i_getStateName(),
                      pNew,
                      pNew->idVendor,
                      pNew->idProduct,
@@ -963,8 +967,8 @@ void USBProxyService::processChanges(void)
                  * Check if the device was actually detached or logically detached
                  * as the result of a re-enumeration.
                  */
-                if (!pHostDevice->wasActuallyDetached())
-                    it++;
+                if (!pHostDevice->i_wasActuallyDetached())
+                    ++it;
                 else
                 {
                     it = mDevices.erase(it);
@@ -973,7 +977,7 @@ void USBProxyService::processChanges(void)
                     deviceRemoved(pHostDevice);
                     Log(("USBProxyService::processChanges: detached %p {%s}\n",
                          (HostUSBDevice *)pHostDevice,
-                         pHostDevice->getName().c_str()));
+                         pHostDevice->i_getName().c_str()));
 
                     /* from now on, the object is no more valid,
                      * uninitialize to avoid abuse */
@@ -1024,14 +1028,14 @@ void USBProxyService::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice,
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
     LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n",
                      (HostUSBDevice *)aDevice,
-                     aDevice->getName().c_str(),
-                     aDevice->getStateName(),
-                     aDevice->getId().raw()));
+                     aDevice->i_getName().c_str(),
+                     aDevice->i_getStateName(),
+                     aDevice->i_getId().raw()));
 
     /*
      * Run filters on the device.
      */
-    if (aDevice->isCapturableOrHeld())
+    if (aDevice->i_isCapturableOrHeld())
     {
         devLock.release();
         HRESULT rc = runAllFiltersOnDevice(aDevice, llOpenedMachines, NULL /* aIgnoreMachine */);
@@ -1059,16 +1063,16 @@ void USBProxyService::deviceRemoved(ComObjPtr<HostUSBDevice> &aDevice)
     AutoWriteLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
     LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid}\n",
                      (HostUSBDevice *)aDevice,
-                     aDevice->getName().c_str(),
-                     aDevice->getStateName(),
-                     aDevice->getId().raw()));
+                     aDevice->i_getName().c_str(),
+                     aDevice->i_getStateName(),
+                     aDevice->i_getId().raw()));
 
     /*
      * Detach the device from any machine currently using it,
      * reset all data and uninitialize the device object.
      */
     devLock.release();
-    aDevice->onPhysicalDetached();
+    aDevice->i_onPhysicalDetached();
 }
 
 
@@ -1080,7 +1084,8 @@ void USBProxyService::deviceRemoved(ComObjPtr<HostUSBDevice> &aDevice)
  * @param   pUSBDevice  The USB device structure for the last enumeration.
  * @param   aRunFilters Whether or not to run filters.
  */
-bool USBProxyService::updateDeviceStateFake(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool USBProxyService::updateDeviceStateFake(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters,
+                                            SessionMachine **aIgnoreMachine)
 {
     *aRunFilters = false;
     *aIgnoreMachine = NULL;
@@ -1090,7 +1095,7 @@ bool USBProxyService::updateDeviceStateFake(HostUSBDevice *aDevice, PUSBDEVICE a
     /*
      * Just hand it to the device, it knows best what needs to be done.
      */
-    return aDevice->updateStateFake(aUSBDevice, aRunFilters, aIgnoreMachine);
+    return aDevice->i_updateStateFake(aUSBDevice, aRunFilters, aIgnoreMachine);
 }
 
 
@@ -1105,12 +1110,13 @@ bool USBProxyService::updateDeviceStateFake(HostUSBDevice *aDevice, PUSBDEVICE a
  * @param   aRunFilters     Whether or not to run filters.
  * @param   aIgnoreMachine  Machine to ignore when running filters.
  */
-bool USBProxyService::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool USBProxyService::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters,
+                                        SessionMachine **aIgnoreMachine)
 {
     AssertReturn(aDevice, false);
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false);
 
-    return aDevice->updateState(aUSBDevice, aRunFilters, aIgnoreMachine);
+    return aDevice->i_updateState(aUSBDevice, aRunFilters, aIgnoreMachine);
 }
 
 
@@ -1124,7 +1130,8 @@ bool USBProxyService::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBD
  * @param   pllOpenedMachines list of running session machines (VirtualBox::getOpenedMachines()); if NULL, we don't run filters
  * @param   aIgnoreMachine  Machine to ignore when running filters.
  */
-void USBProxyService::deviceChanged(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList *pllOpenedMachines, SessionMachine *aIgnoreMachine)
+void USBProxyService::deviceChanged(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList *pllOpenedMachines,
+                                    SessionMachine *aIgnoreMachine)
 {
     /*
      * Validate preconditions.
@@ -1134,9 +1141,9 @@ void USBProxyService::deviceChanged(ComObjPtr<HostUSBDevice> &aDevice, SessionMa
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
     LogFlowThisFunc(("aDevice=%p name={%s} state=%s id={%RTuuid} aRunFilters=%RTbool aIgnoreMachine=%p\n",
                      (HostUSBDevice *)aDevice,
-                     aDevice->getName().c_str(),
-                     aDevice->getStateName(),
-                     aDevice->getId().raw(),
+                     aDevice->i_getName().c_str(),
+                     aDevice->i_getStateName(),
+                     aDevice->i_getId().raw(),
                      (pllOpenedMachines != NULL),       // used to be "bool aRunFilters"
                      aIgnoreMachine));
     devLock.release();
@@ -1247,7 +1254,7 @@ ComObjPtr<HostUSBDevice> USBProxyService::findDeviceById(IN_GUID aId)
     for (HostUSBDeviceList::iterator it = mDevices.begin();
          it != mDevices.end();
          ++it)
-        if ((*it)->getId() == Id)
+        if ((*it)->i_getId() == Id)
         {
             Dev = (*it);
             break;
diff --git a/src/VBox/Main/src-server/VFSExplorerImpl.cpp b/src/VBox/Main/src-server/VFSExplorerImpl.cpp
index 9f50b66..83cd1bf 100644
--- a/src/VBox/Main/src-server/VFSExplorerImpl.cpp
+++ b/src/VBox/Main/src-server/VFSExplorerImpl.cpp
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2009-2011 Oracle Corporation
+ * Copyright (C) 2009-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -36,25 +36,18 @@
 
 #include <memory>
 
-////////////////////////////////////////////////////////////////////////////////
-//
-// VFSExplorer definitions
-//
-////////////////////////////////////////////////////////////////////////////////
-
-/* opaque private instance data of VFSExplorer class */
 struct VFSExplorer::Data
 {
     struct DirEntry
     {
-        DirEntry(Utf8Str strName, VFSFileType_T fileType, uint64_t cbSize, uint32_t fMode)
-          : name(strName)
-          , type(fileType)
-          , size(cbSize)
-          , mode(fMode) {}
+        DirEntry(Utf8Str strName, FsObjType_T fileType, uint64_t cbSize, uint32_t fMode)
+           : name(strName)
+           , type(fileType)
+           , size(cbSize)
+           , mode(fMode) {}
 
         Utf8Str name;
-        VFSFileType_T type;
+        FsObjType_T type;
         uint64_t size;
         uint32_t mode;
     };
@@ -65,10 +58,10 @@ struct VFSExplorer::Data
     Utf8Str strHostname;
     Utf8Str strPath;
     Utf8Str strBucket;
-
     std::list<DirEntry> entryList;
 };
 
+
 VFSExplorer::VFSExplorer()
     : mVirtualBox(NULL)
 {
@@ -84,7 +77,8 @@ VFSExplorer::~VFSExplorer()
  * @param
  * @return
  */
-HRESULT VFSExplorer::init(VFSType_T aType, Utf8Str aFilePath, Utf8Str aHostname, Utf8Str aUsername, Utf8Str aPassword, VirtualBox *aVirtualBox)
+HRESULT VFSExplorer::init(VFSType_T aType, Utf8Str aFilePath, Utf8Str aHostname, Utf8Str aUsername,
+                          Utf8Str aPassword, VirtualBox *aVirtualBox)
 {
     /* Enclose the state transition NotReady->InInit->Ready */
     AutoInitSpan autoInitSpan(this);
@@ -133,30 +127,21 @@ void VFSExplorer::uninit()
  * @param
  * @return
  */
-STDMETHODIMP VFSExplorer::COMGETTER(Path)(BSTR *aPath)
+HRESULT VFSExplorer::getPath(com::Utf8Str &aPath)
 {
-    if (!aPath)
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    Bstr bstrPath(m->strPath);
-    bstrPath.cloneTo(aPath);
+    aPath = m->strPath;
 
     return S_OK;
 }
 
-STDMETHODIMP VFSExplorer::COMGETTER(Type)(VFSType_T *aType)
+
+HRESULT VFSExplorer::getType(VFSType_T *aType)
 {
     if (!aType)
         return E_POINTER;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aType = m->storageType;
@@ -223,10 +208,10 @@ DECLCALLBACK(int) VFSExplorer::TaskVFSExplorer::taskThread(RTTHREAD /* aThread *
         case TaskVFSExplorer::Update:
         {
             if (pVFSExplorer->m->storageType == VFSType_File)
-                rc = pVFSExplorer->updateFS(task.get());
+                rc = pVFSExplorer->i_updateFS(task.get());
             else if (pVFSExplorer->m->storageType == VFSType_S3)
 #ifdef VBOX_WITH_S3
-                rc = pVFSExplorer->updateS3(task.get());
+                rc = pVFSExplorer->i_updateS3(task.get());
 #else
                 rc = VERR_NOT_IMPLEMENTED;
 #endif
@@ -235,10 +220,10 @@ DECLCALLBACK(int) VFSExplorer::TaskVFSExplorer::taskThread(RTTHREAD /* aThread *
         case TaskVFSExplorer::Delete:
         {
             if (pVFSExplorer->m->storageType == VFSType_File)
-                rc = pVFSExplorer->deleteFS(task.get());
+                rc = pVFSExplorer->i_deleteFS(task.get());
             else if (pVFSExplorer->m->storageType == VFSType_S3)
 #ifdef VBOX_WITH_S3
-                rc = pVFSExplorer->deleteS3(task.get());
+                rc = pVFSExplorer->i_deleteS3(task.get());
 #else
                 rc = VERR_NOT_IMPLEMENTED;
 #endif
@@ -272,31 +257,31 @@ int VFSExplorer::TaskVFSExplorer::uploadProgress(unsigned uPercent, void *pvUser
     return VINF_SUCCESS;
 }
 
-VFSFileType_T VFSExplorer::RTToVFSFileType(int aType) const
+FsObjType_T VFSExplorer::i_iprtToVfsObjType(RTFMODE aType) const
 {
     int a = aType & RTFS_TYPE_MASK;
-    VFSFileType_T t = VFSFileType_Unknown;
+    FsObjType_T t = FsObjType_Unknown;
     if ((a & RTFS_TYPE_DIRECTORY) == RTFS_TYPE_DIRECTORY)
-        t = VFSFileType_Directory;
+        t = FsObjType_Directory;
     else if ((a & RTFS_TYPE_FILE) == RTFS_TYPE_FILE)
-        t = VFSFileType_File;
+        t = FsObjType_File;
     else if ((a & RTFS_TYPE_SYMLINK) == RTFS_TYPE_SYMLINK)
-        t = VFSFileType_SymLink;
+        t = FsObjType_Symlink;
     else if ((a & RTFS_TYPE_FIFO) == RTFS_TYPE_FIFO)
-        t = VFSFileType_Fifo;
+        t = FsObjType_Fifo;
     else if ((a & RTFS_TYPE_DEV_CHAR) == RTFS_TYPE_DEV_CHAR)
-        t = VFSFileType_DevChar;
+        t = FsObjType_DevChar;
     else if ((a & RTFS_TYPE_DEV_BLOCK) == RTFS_TYPE_DEV_BLOCK)
-        t = VFSFileType_DevBlock;
+        t = FsObjType_DevBlock;
     else if ((a & RTFS_TYPE_SOCKET) == RTFS_TYPE_SOCKET)
-        t = VFSFileType_Socket;
+        t = FsObjType_Socket;
     else if ((a & RTFS_TYPE_WHITEOUT) == RTFS_TYPE_WHITEOUT)
-        t = VFSFileType_WhiteOut;
+        t = FsObjType_WhiteOut;
 
     return t;
 }
 
-HRESULT VFSExplorer::updateFS(TaskVFSExplorer *aTask)
+HRESULT VFSExplorer::i_updateFS(TaskVFSExplorer *aTask)
 {
     LogFlowFuncEnter();
 
@@ -327,7 +312,9 @@ HRESULT VFSExplorer::updateFS(TaskVFSExplorer *aTask)
                 Utf8Str name(entry.szName);
                 if (   name != "."
                     && name != "..")
-                    fileList.push_back(VFSExplorer::Data::DirEntry(name, RTToVFSFileType(entry.Info.Attr.fMode), entry.Info.cbObject, entry.Info.Attr.fMode & (RTFS_UNIX_IRWXU | RTFS_UNIX_IRWXG | RTFS_UNIX_IRWXO)));
+                    fileList.push_back(VFSExplorer::Data::DirEntry(name, i_iprtToVfsObjType(entry.Info.Attr.fMode),
+                                       entry.Info.cbObject,
+                                       entry.Info.Attr.fMode & (RTFS_UNIX_IRWXU | RTFS_UNIX_IRWXG | RTFS_UNIX_IRWXO)));
             }
         }
         if (aTask->progress)
@@ -354,7 +341,7 @@ HRESULT VFSExplorer::updateFS(TaskVFSExplorer *aTask)
     aTask->rc = rc;
 
     if (!aTask->progress.isNull())
-        aTask->progress->notifyComplete(rc);
+        aTask->progress->i_notifyComplete(rc);
 
     LogFlowFunc(("rc=%Rhrc\n", rc));
     LogFlowFuncLeave();
@@ -362,7 +349,7 @@ HRESULT VFSExplorer::updateFS(TaskVFSExplorer *aTask)
     return VINF_SUCCESS;
 }
 
-HRESULT VFSExplorer::deleteFS(TaskVFSExplorer *aTask)
+HRESULT VFSExplorer::i_deleteFS(TaskVFSExplorer *aTask)
 {
     LogFlowFuncEnter();
 
@@ -401,7 +388,7 @@ HRESULT VFSExplorer::deleteFS(TaskVFSExplorer *aTask)
     aTask->rc = rc;
 
     if (!aTask->progress.isNull())
-        aTask->progress->notifyComplete(rc);
+        aTask->progress->i_notifyComplete(rc);
 
     LogFlowFunc(("rc=%Rhrc\n", rc));
     LogFlowFuncLeave();
@@ -410,7 +397,7 @@ HRESULT VFSExplorer::deleteFS(TaskVFSExplorer *aTask)
 }
 
 #ifdef VBOX_WITH_S3
-HRESULT VFSExplorer::updateS3(TaskVFSExplorer *aTask)
+HRESULT VFSExplorer::i_updateS3(TaskVFSExplorer *aTask)
 {
     LogFlowFuncEnter();
 
@@ -425,7 +412,8 @@ HRESULT VFSExplorer::updateS3(TaskVFSExplorer *aTask)
     std::list<VFSExplorer::Data::DirEntry> fileList;
     try
     {
-        int vrc = RTS3Create(&hS3, m->strUsername.c_str(), m->strPassword.c_str(), m->strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
+        int vrc = RTS3Create(&hS3, m->strUsername.c_str(), m->strPassword.c_str(),
+                             m->strHostname.c_str(), "virtualbox-agent/" VBOX_VERSION_STRING);
         if (RT_FAILURE(vrc))
             throw setError(E_FAIL, tr ("Can't open S3 storage service (%Rrc)"), vrc);
 
@@ -442,7 +430,8 @@ HRESULT VFSExplorer::updateS3(TaskVFSExplorer *aTask)
             while (pBuckets)
             {
                 /* Set always read/write permissions of the current logged in user. */
-                fileList.push_back(VFSExplorer::Data::DirEntry(pBuckets->pszName, VFSFileType_Directory, 0, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR));
+                fileList.push_back(VFSExplorer::Data::DirEntry(pBuckets->pszName, FsObjType_Directory,
+                                   0, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR));
                 pBuckets = pBuckets->pNext;
             }
             RTS3BucketsDestroy(pTmpBuckets);
@@ -459,7 +448,8 @@ HRESULT VFSExplorer::updateS3(TaskVFSExplorer *aTask)
             {
                 Utf8Str name(pKeys->pszName);
                 /* Set always read/write permissions of the current logged in user. */
-                fileList.push_back(VFSExplorer::Data::DirEntry(pKeys->pszName, VFSFileType_File, pKeys->cbFile, RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR));
+                fileList.push_back(VFSExplorer::Data::DirEntry(pKeys->pszName, FsObjType_File, pKeys->cbFile,
+                                   RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR));
                 pKeys = pKeys->pNext;
             }
             RTS3KeysDestroy(pTmpKeys);
@@ -480,7 +470,7 @@ HRESULT VFSExplorer::updateS3(TaskVFSExplorer *aTask)
     aTask->rc = rc;
 
     if (!aTask->progress.isNull())
-        aTask->progress->notifyComplete(rc);
+        aTask->progress->i_notifyComplete(rc);
 
     LogFlowFunc(("rc=%Rhrc\n", rc));
     LogFlowFuncLeave();
@@ -488,7 +478,7 @@ HRESULT VFSExplorer::updateS3(TaskVFSExplorer *aTask)
     return VINF_SUCCESS;
 }
 
-HRESULT VFSExplorer::deleteS3(TaskVFSExplorer *aTask)
+HRESULT VFSExplorer::i_deleteS3(TaskVFSExplorer *aTask)
 {
     LogFlowFuncEnter();
 
@@ -503,7 +493,8 @@ HRESULT VFSExplorer::deleteS3(TaskVFSExplorer *aTask)
     float fPercentStep = 100.0f / aTask->filenames.size();
     try
     {
-        int vrc = RTS3Create(&hS3, m->strUsername.c_str(), m->strPassword.c_str(), m->strHostname.c_str(), "virtualbox-agent/"VBOX_VERSION_STRING);
+        int vrc = RTS3Create(&hS3, m->strUsername.c_str(), m->strPassword.c_str(),
+                             m->strHostname.c_str(), "virtualbox-agent/" VBOX_VERSION_STRING);
         if (RT_FAILURE(vrc))
             throw setError(E_FAIL, tr ("Can't open S3 storage service (%Rrc)"), vrc);
 
@@ -533,7 +524,7 @@ HRESULT VFSExplorer::deleteS3(TaskVFSExplorer *aTask)
         RTS3Destroy(hS3);
 
     if (!aTask->progress.isNull())
-        aTask->progress->notifyComplete(rc);
+        aTask->progress->i_notifyComplete(rc);
 
     LogFlowFunc(("rc=%Rhrc\n", rc));
     LogFlowFuncLeave();
@@ -542,13 +533,8 @@ HRESULT VFSExplorer::deleteS3(TaskVFSExplorer *aTask)
 }
 #endif /* VBOX_WITH_S3 */
 
-STDMETHODIMP VFSExplorer::Update(IProgress **aProgress)
+HRESULT VFSExplorer::update(ComPtr<IProgress> &aProgress)
 {
-    CheckComArgOutPointerValid(aProgress);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
@@ -581,33 +567,22 @@ STDMETHODIMP VFSExplorer::Update(IProgress **aProgress)
         rc = aRC;
     }
 
-    if (SUCCEEDED(rc))
-        /* Return progress to the caller */
-        progress.queryInterfaceTo(aProgress);
+     if (SUCCEEDED(rc))
+         /* Return progress to the caller */
+         progress.queryInterfaceTo(aProgress.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP VFSExplorer::Cd(IN_BSTR aDir, IProgress **aProgress)
+HRESULT VFSExplorer::cd(const com::Utf8Str &aDir, ComPtr<IProgress> &aProgress)
 {
-    CheckComArgStrNotEmptyOrNull(aDir);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    {
-        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        m->strPath = aDir;
-    }
-
-    return Update(aProgress);
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+    m->strPath = aDir;
+    return update(aProgress);
 }
 
-STDMETHODIMP VFSExplorer::CdUp(IProgress **aProgress)
+HRESULT VFSExplorer::cdUp(ComPtr<IProgress> &aProgress)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     Utf8Str strUpPath;
     {
         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -619,24 +594,19 @@ STDMETHODIMP VFSExplorer::CdUp(IProgress **aProgress)
         RTStrFree(pszNewPath);
     }
 
-    return Cd(Bstr(strUpPath).raw(), aProgress);
+    return cd(strUpPath, aProgress);
 }
 
-STDMETHODIMP VFSExplorer::EntryList(ComSafeArrayOut(BSTR, aNames), ComSafeArrayOut(VFSFileType_T, aTypes), ComSafeArrayOut(LONG64, aSizes), ComSafeArrayOut(ULONG, aModes))
+HRESULT VFSExplorer::entryList(std::vector<com::Utf8Str> &aNames,
+                               std::vector<ULONG> &aTypes,
+                               std::vector<LONG64> &aSizes,
+                               std::vector<ULONG> &aModes)
 {
-    if (ComSafeArrayOutIsNull(aNames) ||
-        ComSafeArrayOutIsNull(aTypes))
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    com::SafeArray<BSTR> sfaNames(m->entryList.size());
-    com::SafeArray<ULONG> sfaTypes(m->entryList.size());
-    com::SafeArray<LONG64> sfaSizes(m->entryList.size());
-    com::SafeArray<ULONG> sfaModes(m->entryList.size());
+    aNames.resize(m->entryList.size());
+    aTypes.resize(m->entryList.size());
+    aSizes.resize(m->entryList.size());
+    aModes.resize(m->entryList.size());
 
     std::list<VFSExplorer::Data::DirEntry>::const_iterator it;
     size_t i = 0;
@@ -645,34 +615,25 @@ STDMETHODIMP VFSExplorer::EntryList(ComSafeArrayOut(BSTR, aNames), ComSafeArrayO
          ++it, ++i)
     {
         const VFSExplorer::Data::DirEntry &entry = (*it);
-        Bstr bstr(entry.name);
-        bstr.cloneTo(&sfaNames[i]);
-        sfaTypes[i] = entry.type;
-        sfaSizes[i] = entry.size;
-        sfaModes[i] = entry.mode;
+        aNames[i] = entry.name;
+        aTypes[i] = entry.type;
+        aSizes[i] = entry.size;
+        aModes[i] = entry.mode;
     }
 
-    sfaNames.detachTo(ComSafeArrayOutArg(aNames));
-    sfaTypes.detachTo(ComSafeArrayOutArg(aTypes));
-    sfaSizes.detachTo(ComSafeArrayOutArg(aSizes));
-    sfaModes.detachTo(ComSafeArrayOutArg(aModes));
-
     return S_OK;
 }
 
-STDMETHODIMP VFSExplorer::Exists(ComSafeArrayIn(IN_BSTR, aNames), ComSafeArrayOut(BSTR, aExists))
+HRESULT VFSExplorer::exists(const std::vector<com::Utf8Str> &aNames,
+                            std::vector<com::Utf8Str> &aExists)
 {
-    CheckComArgSafeArrayNotNull(aNames);
 
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    com::SafeArray<IN_BSTR> sfaNames(ComSafeArrayInArg(aNames));
-    std::list<BSTR> listExists;
-
-    for (size_t a=0; a < sfaNames.size(); ++a)
+    aExists.resize(0);
+    for (size_t i=0; i < aNames.size(); ++i)
     {
         std::list<VFSExplorer::Data::DirEntry>::const_iterator it;
         for (it = m->entryList.begin();
@@ -680,27 +641,17 @@ STDMETHODIMP VFSExplorer::Exists(ComSafeArrayIn(IN_BSTR, aNames), ComSafeArrayOu
              ++it)
         {
             const VFSExplorer::Data::DirEntry &entry = (*it);
-            if (entry.name == RTPathFilename(Utf8Str(sfaNames[a]).c_str()))
-            {
-                BSTR name;
-                Bstr tmp(sfaNames[a]); /* gcc-3.3 cruft */
-                tmp.cloneTo(&name);
-                listExists.push_back(name);
-            }
+            if (entry.name == RTPathFilename(aNames[i].c_str()))
+                aExists.push_back(aNames[i]);
         }
     }
 
-    com::SafeArray<BSTR> sfaExists(listExists);
-    sfaExists.detachTo(ComSafeArrayOutArg(aExists));
-
     return S_OK;
 }
 
-STDMETHODIMP VFSExplorer::Remove(ComSafeArrayIn(IN_BSTR, aNames), IProgress **aProgress)
+HRESULT VFSExplorer::remove(const std::vector<com::Utf8Str> &aNames,
+                            ComPtr<IProgress> &aProgress)
 {
-    CheckComArgSafeArrayNotNull(aNames);
-    CheckComArgOutPointerValid(aProgress);
-
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
@@ -708,8 +659,6 @@ STDMETHODIMP VFSExplorer::Remove(ComSafeArrayIn(IN_BSTR, aNames), IProgress **aP
 
     HRESULT rc = S_OK;
 
-    com::SafeArray<IN_BSTR> sfaNames(ComSafeArrayInArg(aNames));
-
     ComObjPtr<Progress> progress;
     try
     {
@@ -725,8 +674,8 @@ STDMETHODIMP VFSExplorer::Remove(ComSafeArrayIn(IN_BSTR, aNames), IProgress **aP
         std::auto_ptr<TaskVFSExplorer> task(new TaskVFSExplorer(TaskVFSExplorer::Delete, this, progress));
 
         /* Add all filenames to delete as task data */
-        for (size_t a=0; a < sfaNames.size(); ++a)
-            task->filenames.push_back(Utf8Str(sfaNames[a]));
+        for (size_t i = 0; i < aNames.size(); ++i)
+            task->filenames.push_back(aNames[i]);
 
         rc = task->startThread();
         if (FAILED(rc)) throw rc;
@@ -741,7 +690,7 @@ STDMETHODIMP VFSExplorer::Remove(ComSafeArrayIn(IN_BSTR, aNames), IProgress **aP
 
     if (SUCCEEDED(rc))
         /* Return progress to the caller */
-        progress.queryInterfaceTo(aProgress);
+        progress.queryInterfaceTo(aProgress.asOutParam());
 
     return rc;
 }
diff --git a/src/VBox/Main/src-server/VRDEServerImpl.cpp b/src/VBox/Main/src-server/VRDEServerImpl.cpp
index f03f10e..d7f99c6 100644
--- a/src/VBox/Main/src-server/VRDEServerImpl.cpp
+++ b/src/VBox/Main/src-server/VRDEServerImpl.cpp
@@ -1,10 +1,11 @@
+/* $Id: VRDEServerImpl.cpp $ */
 /** @file
  *
  * VirtualBox COM class implementation
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -196,7 +197,7 @@ void VRDEServer::uninit()
  *
  *  @note Locks this object for writing.
  */
-HRESULT VRDEServer::loadSettings(const settings::VRDESettings &data)
+HRESULT VRDEServer::i_loadSettings(const settings::VRDESettings &data)
 {
     using namespace settings;
 
@@ -204,7 +205,6 @@ HRESULT VRDEServer::loadSettings(const settings::VRDESettings &data)
     AssertComRCReturnRC(autoCaller.rc());
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-
     mData->mEnabled = data.fEnabled;
     mData->mAuthType = data.authType;
     mData->mAuthTimeout = data.ulAuthTimeout;
@@ -224,7 +224,7 @@ HRESULT VRDEServer::loadSettings(const settings::VRDESettings &data)
  *
  *  @note Locks this object for reading.
  */
-HRESULT VRDEServer::saveSettings(settings::VRDESettings &data)
+HRESULT VRDEServer::i_saveSettings(settings::VRDESettings &data)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnRC(autoCaller.rc());
@@ -246,25 +246,19 @@ HRESULT VRDEServer::saveSettings(settings::VRDESettings &data)
 // IVRDEServer properties
 /////////////////////////////////////////////////////////////////////////////
 
-STDMETHODIMP VRDEServer::COMGETTER(Enabled)(BOOL *aEnabled)
+HRESULT VRDEServer::getEnabled(BOOL *aEnabled)
 {
-    CheckComArgOutPointerValid(aEnabled);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aEnabled = mData->mEnabled;
 
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMSETTER(Enabled)(BOOL aEnabled)
+HRESULT VRDEServer::setEnabled(BOOL aEnabled)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine can also be in saved state for this property to change */
-    AutoMutableOrSavedStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -280,26 +274,26 @@ STDMETHODIMP VRDEServer::COMSETTER(Enabled)(BOOL aEnabled)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, needs no locking
-        mParent->setModified(Machine::IsModified_VRDEServer);
+        mParent->i_setModified(Machine::IsModified_VRDEServer);
         mlock.release();
 
-        /* Avoid deadlock when onVRDEServerChange eventually calls SetExtraData. */
+        /* Avoid deadlock when i_onVRDEServerChange eventually calls SetExtraData. */
         adep.release();
 
-        rc = mParent->onVRDEServerChange(/* aRestart */ TRUE);
+        rc = mParent->i_onVRDEServerChange(/* aRestart */ TRUE);
     }
 
     return rc;
 }
 
-static int portParseNumber(uint16_t *pu16Port, const char *pszStart, const char *pszEnd)
+static int i_portParseNumber(uint16_t *pu16Port, const char *pszStart, const char *pszEnd)
 {
     /* Gets a string of digits, converts to 16 bit port number.
      * Note: pszStart <= pszEnd is expected, the string contains
      *       only digits and pszEnd points to the char after last
      *       digit.
      */
-    int cch = pszEnd - pszStart;
+    size_t cch = pszEnd - pszStart;
     if (cch > 0 && cch <= 5) /* Port is up to 5 decimal digits. */
     {
         unsigned uPort = 0;
@@ -320,10 +314,8 @@ static int portParseNumber(uint16_t *pu16Port, const char *pszStart, const char
     return VERR_INVALID_PARAMETER;
 }
 
-static int vrdpServerVerifyPortsString(Bstr ports)
+static int i_vrdpServerVerifyPortsString(com::Utf8Str portRange)
 {
-    com::Utf8Str portRange = ports;
-
     const char *pszPortRange = portRange.c_str();
 
     if (!pszPortRange || *pszPortRange == 0) /* Reject empty string. */
@@ -362,12 +354,12 @@ static int vrdpServerVerifyPortsString(Bstr ports)
         int rc;
         if (pszDash)
         {
-            rc = portParseNumber(NULL, pszStart, pszDash);
+            rc = i_portParseNumber(NULL, pszStart, pszDash);
             if (RT_SUCCESS(rc))
-                rc = portParseNumber(NULL, pszDash + 1, pszEnd);
+                rc = i_portParseNumber(NULL, pszDash + 1, pszEnd);
         }
         else
-            rc = portParseNumber(NULL, pszStart, pszEnd);
+            rc = i_portParseNumber(NULL, pszStart, pszEnd);
 
         if (RT_FAILURE(rc))
             return rc;
@@ -376,54 +368,47 @@ static int vrdpServerVerifyPortsString(Bstr ports)
     return VINF_SUCCESS;
 }
 
-STDMETHODIMP VRDEServer::SetVRDEProperty(IN_BSTR aKey, IN_BSTR aValue)
+HRESULT VRDEServer::setVRDEProperty(const com::Utf8Str &aKey, const com::Utf8Str &aValue)
 {
     LogFlowThisFunc(("\n"));
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine can also be in saved state for this property to change */
-    AutoMutableOrSavedStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
-    Bstr key = aKey;
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     /* Special processing for some "standard" properties. */
-    if (key == Bstr("TCP/Ports"))
+    if (aKey == "TCP/Ports")
     {
-        Bstr ports = aValue;
-
-        if (ports == Bstr("0"))
-            ports = VRDP_DEFAULT_PORT_STR;
-
-        /* Verify the string. */
-        int vrc = vrdpServerVerifyPortsString(ports);
+        /* Verify the string. "0" means the default port. */
+        Utf8Str strPorts = aValue == "0"?
+                               VRDP_DEFAULT_PORT_STR:
+                               aValue;
+        int vrc = i_vrdpServerVerifyPortsString(strPorts);
         if (RT_FAILURE(vrc))
             return E_INVALIDARG;
 
-        if (ports != mData->mProperties["TCP/Ports"])
+        if (strPorts != mData->mProperties["TCP/Ports"])
         {
             /* Port value is not verified here because it is up to VRDP transport to
              * use it. Specifying a wrong port number will cause a running server to
              * stop. There is no fool proof here.
              */
             mData.backup();
-            mData->mProperties["TCP/Ports"] = ports;
+            mData->mProperties["TCP/Ports"] = strPorts;
 
             /* leave the lock before informing callbacks */
             alock.release();
 
             AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, needs no locking
-            mParent->setModified(Machine::IsModified_VRDEServer);
+            mParent->i_setModified(Machine::IsModified_VRDEServer);
             mlock.release();
 
-            /* Avoid deadlock when onVRDEServerChange eventually calls SetExtraData. */
+            /* Avoid deadlock when i_onVRDEServerChange eventually calls SetExtraData. */
             adep.release();
 
-            mParent->onVRDEServerChange(/* aRestart */ TRUE);
+            mParent->i_onVRDEServerChange(/* aRestart */ TRUE);
         }
     }
     else
@@ -431,57 +416,44 @@ STDMETHODIMP VRDEServer::SetVRDEProperty(IN_BSTR aKey, IN_BSTR aValue)
         /* Generic properties processing.
          * Look up the old value first; if nothing's changed then do nothing.
          */
-        Utf8Str strValue(aValue);
-        Utf8Str strKey(aKey);
         Utf8Str strOldValue;
 
-        settings::StringsMap::const_iterator it = mData->mProperties.find(strKey);
+        settings::StringsMap::const_iterator it = mData->mProperties.find(aKey);
         if (it != mData->mProperties.end())
             strOldValue = it->second;
 
-        if (strOldValue != strValue)
+        if (strOldValue != aValue)
         {
-            if (strValue.isEmpty())
-                mData->mProperties.erase(strKey);
+            if (aValue.isEmpty())
+                mData->mProperties.erase(aKey);
             else
-                mData->mProperties[strKey] = strValue;
+                mData->mProperties[aKey] = aValue;
 
             /* leave the lock before informing callbacks */
             alock.release();
 
             AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);
-            mParent->setModified(Machine::IsModified_VRDEServer);
+            mParent->i_setModified(Machine::IsModified_VRDEServer);
             mlock.release();
 
-            /* Avoid deadlock when onVRDEServerChange eventually calls SetExtraData. */
+            /* Avoid deadlock when i_onVRDEServerChange eventually calls SetExtraData. */
             adep.release();
 
-            mParent->onVRDEServerChange(/* aRestart */ TRUE);
+            mParent->i_onVRDEServerChange(/* aRestart */ TRUE);
         }
     }
 
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::GetVRDEProperty(IN_BSTR aKey, BSTR *aValue)
+HRESULT VRDEServer::getVRDEProperty(const com::Utf8Str &aKey, com::Utf8Str &aValue)
 {
-    CheckComArgOutPointerValid(aValue);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    Bstr key = aKey;
-    Bstr value;
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    Utf8Str strKey(key);
-    settings::StringsMap::const_iterator it = mData->mProperties.find(strKey);
+    settings::StringsMap::const_iterator it = mData->mProperties.find(aKey);
     if (it != mData->mProperties.end())
-        value = it->second; // source is a Utf8Str
-    else if (strKey == "TCP/Ports")
-        value = VRDP_DEFAULT_PORT_STR;
-    value.cloneTo(aValue);
+        aValue = it->second; // source is a Utf8Str
+    else if (aKey == "TCP/Ports")
+        aValue = VRDP_DEFAULT_PORT_STR;
 
     return S_OK;
 }
@@ -531,21 +503,13 @@ static int loadVRDELibrary(const char *pszLibraryName, RTLDRMOD *phmod, PFNVRDES
     return rc;
 }
 
-STDMETHODIMP VRDEServer::COMGETTER(VRDEProperties)(ComSafeArrayOut(BSTR, aProperties))
+HRESULT VRDEServer::getVRDEProperties(std::vector<com::Utf8Str> &aProperties)
 {
-    if (ComSafeArrayOutIsNull(aProperties))
-        return E_POINTER;
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     size_t cProperties = 0;
-
+    aProperties.resize(0);
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     if (!mData->mEnabled)
     {
-        com::SafeArray<BSTR> properties(cProperties);
-        properties.detachTo(ComSafeArrayOutArg(aProperties));
         return S_OK;
     }
     alock.release();
@@ -570,9 +534,9 @@ STDMETHODIMP VRDEServer::COMGETTER(VRDEProperties)(ComSafeArrayOut(BSTR, aProper
     else
     {
 #ifdef VBOX_WITH_EXTPACK
-        VirtualBox *pVirtualBox = mParent->getVirtualBox();
-        ExtPackManager *pExtPackMgr = pVirtualBox->getExtPackManager();
-        vrc = pExtPackMgr->getVrdeLibraryPathForExtPack(&strExtPack, &strVrdeLibrary);
+        VirtualBox *pVirtualBox = mParent->i_getVirtualBox();
+        ExtPackManager *pExtPackMgr = pVirtualBox->i_getExtPackManager();
+        vrc = pExtPackMgr->i_getVrdeLibraryPathForExtPack(&strExtPack, &strVrdeLibrary);
 #else
         vrc = VERR_FILE_NOT_FOUND;
 #endif
@@ -602,23 +566,18 @@ STDMETHODIMP VRDEServer::COMGETTER(VRDEProperties)(ComSafeArrayOut(BSTR, aProper
             }
             Log(("VRDEPROP: %d properties\n", cProperties));
 
-            com::SafeArray<BSTR> properties(cProperties);
-
             if (cProperties > 0)
             {
-                size_t i;
-                for (i = 0; papszNames[i] != NULL && i < cProperties; ++i)
+                aProperties.resize(cProperties);
+                for (size_t i = 0; papszNames[i] != NULL && i < cProperties; ++i)
                 {
-                    Bstr tmp(papszNames[i]);
-                    tmp.cloneTo(&properties[i]);
+                     aProperties[i] = papszNames[i];
                 }
             }
 
             /* Do not forget to unload the library. */
             RTLdrClose(hmod);
             hmod = NIL_RTLDRMOD;
-
-            properties.detachTo(ComSafeArrayOutArg(aProperties));
         }
     }
 
@@ -630,13 +589,9 @@ STDMETHODIMP VRDEServer::COMGETTER(VRDEProperties)(ComSafeArrayOut(BSTR, aProper
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMGETTER(AuthType)(AuthType_T *aType)
-{
-    CheckComArgOutPointerValid(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT VRDEServer::getAuthType(AuthType_T *aType)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aType = mData->mAuthType;
@@ -644,13 +599,10 @@ STDMETHODIMP VRDEServer::COMGETTER(AuthType)(AuthType_T *aType)
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMSETTER(AuthType)(AuthType_T aType)
+HRESULT VRDEServer::setAuthType(AuthType_T aType)
 {
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* the machine can also be in saved state for this property to change */
-    AutoMutableOrSavedStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -664,22 +616,17 @@ STDMETHODIMP VRDEServer::COMSETTER(AuthType)(AuthType_T aType)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, needs no locking
-        mParent->setModified(Machine::IsModified_VRDEServer);
+        mParent->i_setModified(Machine::IsModified_VRDEServer);
         mlock.release();
 
-        mParent->onVRDEServerChange(/* aRestart */ TRUE);
+        mParent->i_onVRDEServerChange(/* aRestart */ TRUE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMGETTER(AuthTimeout)(ULONG *aTimeout)
+HRESULT VRDEServer::getAuthTimeout(ULONG *aTimeout)
 {
-    CheckComArgOutPointerValid(aTimeout);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aTimeout = mData->mAuthTimeout;
@@ -687,13 +634,11 @@ STDMETHODIMP VRDEServer::COMGETTER(AuthTimeout)(ULONG *aTimeout)
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMSETTER(AuthTimeout)(ULONG aTimeout)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT VRDEServer::setAuthTimeout(ULONG aTimeout)
+{
     /* the machine can also be in saved state for this property to change */
-    AutoMutableOrSavedStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -707,7 +652,7 @@ STDMETHODIMP VRDEServer::COMSETTER(AuthTimeout)(ULONG aTimeout)
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, needs no locking
-        mParent->setModified(Machine::IsModified_VRDEServer);
+        mParent->i_setModified(Machine::IsModified_VRDEServer);
         mlock.release();
 
         /* sunlover 20060131: This setter does not require the notification
@@ -720,75 +665,62 @@ STDMETHODIMP VRDEServer::COMSETTER(AuthTimeout)(ULONG aTimeout)
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMGETTER(AuthLibrary)(BSTR *aLibrary)
+HRESULT VRDEServer::getAuthLibrary(com::Utf8Str &aLibrary)
 {
-    CheckComArgOutPointerValid(aLibrary);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    Bstr bstrLibrary;
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    bstrLibrary = mData->mAuthLibrary;
+    aLibrary = mData->mAuthLibrary;
     alock.release();
 
-    if (bstrLibrary.isEmpty())
+    if (aLibrary.isEmpty())
     {
         /* Get the global setting. */
         ComPtr<ISystemProperties> systemProperties;
-        HRESULT hrc = mParent->getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam());
-
+        HRESULT hrc = mParent->i_getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam());
         if (SUCCEEDED(hrc))
-            hrc = systemProperties->COMGETTER(VRDEAuthLibrary)(bstrLibrary.asOutParam());
+        {
+            Bstr strlib;
+            hrc = systemProperties->COMGETTER(VRDEAuthLibrary)(strlib.asOutParam());
+            if (SUCCEEDED(hrc))
+                aLibrary = Utf8Str(strlib).c_str();
+        }
 
         if (FAILED(hrc))
             return setError(hrc, "failed to query the library setting\n");
     }
 
-    bstrLibrary.cloneTo(aLibrary);
-
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMSETTER(AuthLibrary)(IN_BSTR aLibrary)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT VRDEServer::setAuthLibrary(const com::Utf8Str &aLibrary)
+{
     /* the machine can also be in saved state for this property to change */
-    AutoMutableOrSavedStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
-    Bstr bstrLibrary(aLibrary);
-
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    if (mData->mAuthLibrary != bstrLibrary)
+    if (mData->mAuthLibrary != aLibrary)
     {
         mData.backup();
-        mData->mAuthLibrary = bstrLibrary;
+        mData->mAuthLibrary = aLibrary;
 
         /* leave the lock before informing callbacks */
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);
-        mParent->setModified(Machine::IsModified_VRDEServer);
+        mParent->i_setModified(Machine::IsModified_VRDEServer);
         mlock.release();
 
-        mParent->onVRDEServerChange(/* aRestart */ TRUE);
+        mParent->i_onVRDEServerChange(/* aRestart */ TRUE);
     }
 
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMGETTER(AllowMultiConnection)(BOOL *aAllowMultiConnection)
-{
-    CheckComArgOutPointerValid(aAllowMultiConnection);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT VRDEServer::getAllowMultiConnection(BOOL *aAllowMultiConnection)
+{
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aAllowMultiConnection = mData->mAllowMultiConnection;
@@ -796,13 +728,11 @@ STDMETHODIMP VRDEServer::COMGETTER(AllowMultiConnection)(BOOL *aAllowMultiConnec
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMSETTER(AllowMultiConnection)(BOOL aAllowMultiConnection)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
+HRESULT VRDEServer::setAllowMultiConnection(BOOL aAllowMultiConnection)
+{
     /* the machine can also be in saved state for this property to change */
-    AutoMutableOrSavedStateDependency adep(mParent);
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -816,22 +746,17 @@ STDMETHODIMP VRDEServer::COMSETTER(AllowMultiConnection)(BOOL aAllowMultiConnect
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, needs no locking
-        mParent->setModified(Machine::IsModified_VRDEServer);
+        mParent->i_setModified(Machine::IsModified_VRDEServer);
         mlock.release();
 
-        mParent->onVRDEServerChange(/* aRestart */ TRUE); // @todo does it need a restart?
+        mParent->i_onVRDEServerChange(/* aRestart */ TRUE); // @todo does it need a restart?
     }
 
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMGETTER(ReuseSingleConnection)(BOOL *aReuseSingleConnection)
+HRESULT VRDEServer::getReuseSingleConnection(BOOL *aReuseSingleConnection)
 {
-    CheckComArgOutPointerValid(aReuseSingleConnection);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
     *aReuseSingleConnection = mData->mReuseSingleConnection;
@@ -839,13 +764,10 @@ STDMETHODIMP VRDEServer::COMGETTER(ReuseSingleConnection)(BOOL *aReuseSingleConn
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMSETTER(ReuseSingleConnection)(BOOL aReuseSingleConnection)
-{
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    /* the machine can also be in saved state for this property to change */
-    AutoMutableOrSavedStateDependency adep(mParent);
+HRESULT VRDEServer::setReuseSingleConnection(BOOL aReuseSingleConnection)
+{
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
     if (FAILED(adep.rc())) return adep.rc();
 
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -859,108 +781,101 @@ STDMETHODIMP VRDEServer::COMSETTER(ReuseSingleConnection)(BOOL aReuseSingleConne
         alock.release();
 
         AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);       // mParent is const, needs no locking
-        mParent->setModified(Machine::IsModified_VRDEServer);
+        mParent->i_setModified(Machine::IsModified_VRDEServer);
         mlock.release();
 
-        mParent->onVRDEServerChange(/* aRestart */ TRUE); // @todo needs a restart?
+        mParent->i_onVRDEServerChange(/* aRestart */ TRUE); // @todo needs a restart?
     }
 
     return S_OK;
 }
 
-STDMETHODIMP VRDEServer::COMGETTER(VRDEExtPack)(BSTR *aExtPack)
+HRESULT VRDEServer::getVRDEExtPack(com::Utf8Str &aExtPack)
 {
-    CheckComArgOutPointerValid(aExtPack);
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    Utf8Str strExtPack = mData->mVrdeExtPack;
+    alock.release();
+    HRESULT hrc = S_OK;
 
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
+    if (strExtPack.isNotEmpty())
     {
-        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-        Utf8Str strExtPack = mData->mVrdeExtPack;
-        alock.release();
-
-        if (strExtPack.isNotEmpty())
+        if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
+            hrc = S_OK;
+        else
         {
-            if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
-                hrc = S_OK;
-            else
-            {
 #ifdef VBOX_WITH_EXTPACK
-                ExtPackManager *pExtPackMgr = mParent->getVirtualBox()->getExtPackManager();
-                hrc = pExtPackMgr->checkVrdeExtPack(&strExtPack);
+            ExtPackManager *pExtPackMgr = mParent->i_getVirtualBox()->i_getExtPackManager();
+            hrc = pExtPackMgr->i_checkVrdeExtPack(&strExtPack);
 #else
-                hrc = setError(E_FAIL, tr("Extension pack '%s' does not exist"), strExtPack.c_str());
+            hrc = setError(E_FAIL, tr("Extension pack '%s' does not exist"), strExtPack.c_str());
 #endif
-            }
-            if (SUCCEEDED(hrc))
-                strExtPack.cloneTo(aExtPack);
         }
-        else
+        if (SUCCEEDED(hrc))
+            aExtPack = strExtPack;
+    }
+    else
+    {
+        /* Get the global setting. */
+        ComPtr<ISystemProperties> systemProperties;
+        hrc = mParent->i_getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam());
+        if (SUCCEEDED(hrc))
         {
-            /* Get the global setting. */
-            ComPtr<ISystemProperties> systemProperties;
-            hrc = mParent->getVirtualBox()->COMGETTER(SystemProperties)(systemProperties.asOutParam());
+            BSTR bstr;
+            hrc = systemProperties->COMGETTER(DefaultVRDEExtPack)(&bstr);
             if (SUCCEEDED(hrc))
-                hrc = systemProperties->COMGETTER(DefaultVRDEExtPack)(aExtPack);
+                aExtPack = Utf8Str(bstr);
         }
     }
-
     return hrc;
 }
 
-STDMETHODIMP VRDEServer::COMSETTER(VRDEExtPack)(IN_BSTR aExtPack)
+// public methods only for internal purposes
+/////////////////////////////////////////////////////////////////////////////
+HRESULT VRDEServer::setVRDEExtPack(const com::Utf8Str &aExtPack)
 {
-    CheckComArgNotNull(aExtPack);
-    Utf8Str strExtPack(aExtPack);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
+    HRESULT hrc = S_OK;
+    /* the machine can also be in saved state for this property to change */
+    AutoMutableOrSavedOrRunningStateDependency adep(mParent);
+    hrc = adep.rc();
     if (SUCCEEDED(hrc))
     {
-        /* the machine can also be in saved state for this property to change */
-        AutoMutableOrSavedStateDependency adep(mParent);
-        hrc = adep.rc();
-        if (SUCCEEDED(hrc))
+        /*
+         * If not empty, check the specific extension pack.
+         */
+        if (!aExtPack.isEmpty())
         {
-            /*
-             * If not empty, check the specific extension pack.
-             */
-            if (!strExtPack.isEmpty())
+            if (aExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
+                hrc = S_OK;
+            else
             {
-                if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME))
-                    hrc = S_OK;
-                else
-                {
 #ifdef VBOX_WITH_EXTPACK
-                    ExtPackManager *pExtPackMgr = mParent->getVirtualBox()->getExtPackManager();
-                    hrc = pExtPackMgr->checkVrdeExtPack(&strExtPack);
+                ExtPackManager *pExtPackMgr = mParent->i_getVirtualBox()->i_getExtPackManager();
+                hrc = pExtPackMgr->i_checkVrdeExtPack(&aExtPack);
 #else
-                    hrc = setError(E_FAIL, tr("Extension pack '%s' does not exist"), strExtPack.c_str());
+                hrc = setError(E_FAIL, tr("Extension pack '%s' does not exist"), aExtPack.c_str());
 #endif
-                }
             }
-            if (SUCCEEDED(hrc))
-            {
-                /*
-                 * Update the setting if there is an actual change, post an
-                 * change event to trigger a VRDE server restart.
-                 */
-                AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-                if (strExtPack != mData->mVrdeExtPack)
-                {
-                    mData.backup();
-                    mData->mVrdeExtPack = strExtPack;
+        }
+        if (SUCCEEDED(hrc))
+        {
+            /*
+             * Update the setting if there is an actual change, post an
+             * change event to trigger a VRDE server restart.
+             */
+             AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+             if (aExtPack != mData->mVrdeExtPack)
+             {
+                 mData.backup();
+                 mData->mVrdeExtPack = aExtPack;
 
-                    /* leave the lock before informing callbacks */
-                    alock.release();
+                /* leave the lock before informing callbacks */
+                alock.release();
 
-                    AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);
-                    mParent->setModified(Machine::IsModified_VRDEServer);
-                    mlock.release();
+                AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);
+                mParent->i_setModified(Machine::IsModified_VRDEServer);
+                mlock.release();
 
-                    mParent->onVRDEServerChange(/* aRestart */ TRUE);
-                }
+                mParent->i_onVRDEServerChange(/* aRestart */ TRUE);
             }
         }
     }
@@ -974,7 +889,7 @@ STDMETHODIMP VRDEServer::COMSETTER(VRDEExtPack)(IN_BSTR aExtPack)
 /**
  *  @note Locks this object for writing.
  */
-void VRDEServer::rollback()
+void VRDEServer::i_rollback()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -989,7 +904,7 @@ void VRDEServer::rollback()
  *  @note Locks this object for writing, together with the peer object (also
  *  for writing) if there is one.
  */
-void VRDEServer::commit()
+void VRDEServer::i_commit()
 {
     /* sanity */
     AutoCaller autoCaller(this);
@@ -1018,7 +933,7 @@ void VRDEServer::commit()
  *  @note Locks this object for writing, together with the peer object
  *  represented by @a aThat (locked for reading).
  */
-void VRDEServer::copyFrom(VRDEServer *aThat)
+void VRDEServer::i_copyFrom(VRDEServer *aThat)
 {
     AssertReturnVoid(aThat != NULL);
 
diff --git a/src/VBox/Main/src-server/VirtualBoxImpl.cpp b/src/VBox/Main/src-server/VirtualBoxImpl.cpp
index 500dc52..ba4b8db 100644
--- a/src/VBox/Main/src-server/VirtualBoxImpl.cpp
+++ b/src/VBox/Main/src-server/VirtualBoxImpl.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -56,7 +56,6 @@
 #include "MediumImpl.h"
 #include "SharedFolderImpl.h"
 #include "ProgressImpl.h"
-#include "ProgressProxyImpl.h"
 #include "HostImpl.h"
 #include "USBControllerImpl.h"
 #include "SystemPropertiesImpl.h"
@@ -68,7 +67,6 @@
 # include "PerformanceImpl.h"
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
 #include "EventImpl.h"
-#include "VBoxEvents.h"
 #ifdef VBOX_WITH_EXTPACK
 # include "ExtPackManagerImpl.h"
 #endif
@@ -78,6 +76,8 @@
 #include "AutoCaller.h"
 #include "Logging.h"
 
+#include <QMTranslator.h>
+
 #ifdef RT_OS_WINDOWS
 # include "win/svchlp.h"
 # include "win/VBoxComEvents.h"
@@ -98,22 +98,22 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 // static
-Bstr VirtualBox::sVersion;
+com::Utf8Str VirtualBox::sVersion;
 
 // static
-Bstr VirtualBox::sVersionNormalized;
+com::Utf8Str VirtualBox::sVersionNormalized;
 
 // static
 ULONG VirtualBox::sRevision;
 
 // static
-Bstr VirtualBox::sPackageType;
+com::Utf8Str VirtualBox::sPackageType;
 
 // static
-Bstr VirtualBox::sAPIVersion;
+com::Utf8Str VirtualBox::sAPIVersion;
 
 // static
-std::map<Bstr, int> VirtualBox::sNatNetworkNameToRefCount;
+std::map<com::Utf8Str, int> VirtualBox::sNatNetworkNameToRefCount;
 
 // static leaked (todo: find better place to free it.)
 RWLockHandle *VirtualBox::spMtxNatNetworkNameToRefCountLock;
@@ -305,11 +305,7 @@ struct VirtualBox::Data
 // constructor / destructor
 /////////////////////////////////////////////////////////////////////////////
 
-VirtualBox::VirtualBox()
-{}
-
-VirtualBox::~VirtualBox()
-{}
+DEFINE_EMPTY_CTOR_DTOR(VirtualBox)
 
 HRESULT VirtualBox::FinalConstruct()
 {
@@ -373,7 +369,7 @@ HRESULT VirtualBox::init()
     if (!spMtxNatNetworkNameToRefCountLock)
         spMtxNatNetworkNameToRefCountLock = new RWLockHandle(LOCKCLASS_VIRTUALBOXOBJECT);
 
-    LogFlowThisFunc(("Version: %ls, Package: %ls, API Version: %ls\n", sVersion.raw(), sPackageType.raw(), sAPIVersion.raw()));
+    LogFlowThisFunc(("Version: %s, Package: %s, API Version: %s\n", sVersion.c_str(), sPackageType.c_str(), sAPIVersion.c_str()));
 
     /* Get the VirtualBox home directory. */
     {
@@ -429,7 +425,7 @@ HRESULT VirtualBox::init()
         rc = m->pHost->init(this);
         ComAssertComRCThrowRC(rc);
 
-        rc = m->pHost->loadSettings(m->pMainConfigFile->host);
+        rc = m->pHost->i_loadSettings(m->pMainConfigFile->host);
         if (FAILED(rc)) throw rc;
 
         /*
@@ -455,7 +451,7 @@ HRESULT VirtualBox::init()
         rc = m->pSystemProperties->init(this);
         ComAssertComRCThrowRC(rc);
 
-        rc = m->pSystemProperties->loadSettings(m->pMainConfigFile->systemProperties);
+        rc = m->pSystemProperties->i_loadSettings(m->pMainConfigFile->systemProperties);
         if (FAILED(rc)) throw rc;
 
         /* guest OS type objects, needed by machines */
@@ -484,7 +480,7 @@ HRESULT VirtualBox::init()
 
 #ifdef DEBUG
         LogFlowThisFunc(("Dumping media backreferences\n"));
-        dumpAllBackRefs();
+        i_dumpAllBackRefs();
 #endif
 
         /* net services - dhcp services */
@@ -499,7 +495,7 @@ HRESULT VirtualBox::init()
                 rc = pDhcpServer->init(this, data);
             if (FAILED(rc)) throw rc;
 
-            rc = registerDHCPServer(pDhcpServer, false /* aSaveRegistry */);
+            rc = i_registerDHCPServer(pDhcpServer, false /* aSaveRegistry */);
             if (FAILED(rc)) throw rc;
         }
 
@@ -517,7 +513,7 @@ HRESULT VirtualBox::init()
                 AssertComRCReturnRC(rc);
             }
 
-            rc = registerNATNetwork(pNATNetwork, false /* aSaveRegistry */);
+            rc = i_registerNATNetwork(pNATNetwork, false /* aSaveRegistry */);
             AssertComRCReturnRC(rc);
         }
 
@@ -588,7 +584,7 @@ HRESULT VirtualBox::init()
     if (SUCCEEDED(rc))
     {
         lock.release();
-        m->ptrExtPackManager->callAllVirtualBoxReadyHooks();
+        m->ptrExtPackManager->i_callAllVirtualBoxReadyHooks();
     }
 #endif
 
@@ -608,6 +604,13 @@ HRESULT VirtualBox::initMachines()
         const settings::MachineRegistryEntry &xmlMachine = *it;
         Guid uuid = xmlMachine.uuid;
 
+        /* Check if machine record has valid parameters. */
+        if (xmlMachine.strSettingsFile.isEmpty() || uuid.isZero())
+        {
+            LogRel(("Skipped invalid machine record.\n"));
+            continue;
+        }
+
         ComObjPtr<Machine> pMachine;
         if (SUCCEEDED(rc = pMachine.createObject()))
         {
@@ -615,7 +618,7 @@ HRESULT VirtualBox::initMachines()
                                             xmlMachine.strSettingsFile,
                                             &uuid);
             if (SUCCEEDED(rc))
-                rc = registerMachine(pMachine);
+                rc = i_registerMachine(pMachine);
             if (FAILED(rc))
                 return rc;
         }
@@ -647,14 +650,14 @@ HRESULT VirtualBox::initMachines()
  * @return
  */
 HRESULT VirtualBox::initMedia(const Guid &uuidRegistry,
-                              const settings::MediaRegistry mediaRegistry,
+                              const settings::MediaRegistry &mediaRegistry,
                               const Utf8Str &strMachineFolder)
 {
     LogFlow(("VirtualBox::initMedia ENTERING, uuidRegistry=%s, strMachineFolder=%s\n",
              uuidRegistry.toString().c_str(),
              strMachineFolder.c_str()));
 
-    AutoWriteLock treeLock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock treeLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
     settings::MediaList::const_iterator it;
@@ -671,10 +674,11 @@ HRESULT VirtualBox::initMedia(const Guid &uuidRegistry,
                                  DeviceType_HardDisk,
                                  uuidRegistry,
                                  xmlHD,         // XML data; this recurses to processes the children
-                                 strMachineFolder);
+                                 strMachineFolder,
+                                 treeLock);
         if (FAILED(rc)) return rc;
 
-        rc = registerMedium(pHardDisk, &pHardDisk, DeviceType_HardDisk, treeLock);
+        rc = i_registerMedium(pHardDisk, &pHardDisk, treeLock);
         if (FAILED(rc)) return rc;
     }
 
@@ -691,10 +695,11 @@ HRESULT VirtualBox::initMedia(const Guid &uuidRegistry,
                               DeviceType_DVD,
                               uuidRegistry,
                               xmlDvd,
-                              strMachineFolder);
+                              strMachineFolder,
+                              treeLock);
         if (FAILED(rc)) return rc;
 
-        rc = registerMedium(pImage, &pImage, DeviceType_DVD, treeLock);
+        rc = i_registerMedium(pImage, &pImage, treeLock);
         if (FAILED(rc)) return rc;
     }
 
@@ -711,10 +716,11 @@ HRESULT VirtualBox::initMedia(const Guid &uuidRegistry,
                               DeviceType_Floppy,
                               uuidRegistry,
                               xmlFloppy,
-                              strMachineFolder);
+                              strMachineFolder,
+                              treeLock);
         if (FAILED(rc)) return rc;
 
-        rc = registerMedium(pImage, &pImage, DeviceType_Floppy, treeLock);
+        rc = i_registerMedium(pImage, &pImage, treeLock);
         if (FAILED(rc)) return rc;
     }
 
@@ -727,7 +733,7 @@ void VirtualBox::uninit()
 {
     Assert(!m->uRegistryNeedsSaving);
     if (m->uRegistryNeedsSaving)
-        saveSettings();
+        i_saveSettings();
 
     /* Enclose the state transition Ready->InUninit->NotReady */
     AutoUninitSpan autoUninitSpan(this);
@@ -839,137 +845,80 @@ void VirtualBox::uninit()
     LogFlow(("===========================================================\n"));
 }
 
-// IVirtualBox properties
+// Wrapped IVirtualBox properties
 /////////////////////////////////////////////////////////////////////////////
-
-STDMETHODIMP VirtualBox::COMGETTER(Version)(BSTR *aVersion)
+HRESULT VirtualBox::getVersion(com::Utf8Str &aVersion)
 {
-    CheckComArgNotNull(aVersion);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    sVersion.cloneTo(aVersion);
+    aVersion = sVersion;
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(VersionNormalized)(BSTR *aVersionNormalized)
+HRESULT VirtualBox::getVersionNormalized(com::Utf8Str &aVersionNormalized)
 {
-    CheckComArgNotNull(aVersionNormalized);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    sVersionNormalized.cloneTo(aVersionNormalized);
+    aVersionNormalized = sVersionNormalized;
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(Revision)(ULONG *aRevision)
+HRESULT VirtualBox::getRevision(ULONG *aRevision)
 {
-    CheckComArgNotNull(aRevision);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     *aRevision = sRevision;
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(PackageType)(BSTR *aPackageType)
+HRESULT VirtualBox::getPackageType(com::Utf8Str &aPackageType)
 {
-    CheckComArgNotNull(aPackageType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    sPackageType.cloneTo(aPackageType);
+    aPackageType = sPackageType;
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(APIVersion)(BSTR *aAPIVersion)
+HRESULT VirtualBox::getAPIVersion(com::Utf8Str &aAPIVersion)
 {
-    CheckComArgNotNull(aAPIVersion);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    sAPIVersion.cloneTo(aAPIVersion);
+    aAPIVersion = sAPIVersion;
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(HomeFolder)(BSTR *aHomeFolder)
+HRESULT VirtualBox::getHomeFolder(com::Utf8Str &aHomeFolder)
 {
-    CheckComArgNotNull(aHomeFolder);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mHomeDir is const and doesn't need a lock */
-    m->strHomeDir.cloneTo(aHomeFolder);
+    aHomeFolder = m->strHomeDir;
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(SettingsFilePath)(BSTR *aSettingsFilePath)
+HRESULT VirtualBox::getSettingsFilePath(com::Utf8Str &aSettingsFilePath)
 {
-    CheckComArgNotNull(aSettingsFilePath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mCfgFile.mName is const and doesn't need a lock */
-    m->strSettingsFilePath.cloneTo(aSettingsFilePath);
+    aSettingsFilePath = m->strSettingsFilePath;
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(Host)(IHost **aHost)
+HRESULT VirtualBox::getHost(ComPtr<IHost> &aHost)
 {
-    CheckComArgOutPointerValid(aHost);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mHost is const, no need to lock */
-    m->pHost.queryInterfaceTo(aHost);
+    m->pHost.queryInterfaceTo(aHost.asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP
-VirtualBox::COMGETTER(SystemProperties)(ISystemProperties **aSystemProperties)
+HRESULT VirtualBox::getSystemProperties(ComPtr<ISystemProperties> &aSystemProperties)
 {
-    CheckComArgOutPointerValid(aSystemProperties);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mSystemProperties is const, no need to lock */
-    m->pSystemProperties.queryInterfaceTo(aSystemProperties);
+    m->pSystemProperties.queryInterfaceTo(aSystemProperties.asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP
-VirtualBox::COMGETTER(Machines)(ComSafeArrayOut(IMachine *, aMachines))
+HRESULT VirtualBox::getMachines(std::vector<ComPtr<IMachine> > &aMachines)
 {
-    CheckComArgOutSafeArrayPointerValid(aMachines);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-    SafeIfaceArray<IMachine> machines(m->allMachines.getList());
-    machines.detachTo(ComSafeArrayOutArg(aMachines));
-
+    aMachines.resize(m->allMachines.size());
+    size_t i = 0;
+    for (MachinesOList::const_iterator it= m->allMachines.begin();
+         it!= m->allMachines.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aMachines[i].asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP
-VirtualBox::COMGETTER(MachineGroups)(ComSafeArrayOut(BSTR, aMachineGroups))
+HRESULT VirtualBox::getMachineGroups(std::vector<com::Utf8Str> &aMachineGroups)
 {
-    CheckComArgOutSafeArrayPointerValid(aMachineGroups);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    std::list<Bstr> allGroups;
+    std::list<com::Utf8Str> allGroups;
 
     /* get copy of all machine references, to avoid holding the list lock */
     MachinesOList::MyList allMachines;
@@ -987,12 +936,11 @@ VirtualBox::COMGETTER(MachineGroups)(ComSafeArrayOut(BSTR, aMachineGroups))
             continue;
         AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
 
-        if (pMachine->isAccessible())
+        if (pMachine->i_isAccessible())
         {
-            const StringsList &thisGroups = pMachine->getGroups();
+            const StringsList &thisGroups = pMachine->i_getGroups();
             for (StringsList::const_iterator it2 = thisGroups.begin();
-                 it2 != thisGroups.end();
-                 ++it2)
+                 it2 != thisGroups.end(); ++it2)
                 allGroups.push_back(*it2);
         }
     }
@@ -1000,116 +948,85 @@ VirtualBox::COMGETTER(MachineGroups)(ComSafeArrayOut(BSTR, aMachineGroups))
     /* throw out any duplicates */
     allGroups.sort();
     allGroups.unique();
-    com::SafeArray<BSTR> machineGroups(allGroups.size());
+    aMachineGroups.resize(allGroups.size());
     size_t i = 0;
-    for (std::list<Bstr>::const_iterator it = allGroups.begin();
-         it != allGroups.end();
-         ++it, i++)
-    {
-        const Bstr &tmp = *it;
-        tmp.cloneTo(&machineGroups[i]);
-    }
-    machineGroups.detachTo(ComSafeArrayOutArg(aMachineGroups));
-
+    for (std::list<com::Utf8Str>::const_iterator it = allGroups.begin();
+         it != allGroups.end(); ++it, ++i)
+        aMachineGroups[i] = (*it);
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(HardDisks)(ComSafeArrayOut(IMedium *, aHardDisks))
+HRESULT VirtualBox::getHardDisks(std::vector<ComPtr<IMedium> > &aHardDisks)
 {
-    CheckComArgOutSafeArrayPointerValid(aHardDisks);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock al(m->allHardDisks.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-    SafeIfaceArray<IMedium> hardDisks(m->allHardDisks.getList());
-    hardDisks.detachTo(ComSafeArrayOutArg(aHardDisks));
-
+    aHardDisks.resize(m->allHardDisks.size());
+    size_t i = 0;
+    for (MediaOList::const_iterator it = m->allHardDisks.begin();
+         it !=  m->allHardDisks.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aHardDisks[i].asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(DVDImages)(ComSafeArrayOut(IMedium *, aDVDImages))
+HRESULT VirtualBox::getDVDImages(std::vector<ComPtr<IMedium> > &aDVDImages)
 {
-    CheckComArgOutSafeArrayPointerValid(aDVDImages);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock al(m->allDVDImages.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-    SafeIfaceArray<IMedium> images(m->allDVDImages.getList());
-    images.detachTo(ComSafeArrayOutArg(aDVDImages));
-
+    aDVDImages.resize(m->allDVDImages.size());
+    size_t i = 0;
+    for (MediaOList::const_iterator it = m->allDVDImages.begin();
+         it!= m->allDVDImages.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aDVDImages[i].asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(FloppyImages)(ComSafeArrayOut(IMedium *, aFloppyImages))
+HRESULT VirtualBox::getFloppyImages(std::vector<ComPtr<IMedium> > &aFloppyImages)
 {
-    CheckComArgOutSafeArrayPointerValid(aFloppyImages);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock al(m->allFloppyImages.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-    SafeIfaceArray<IMedium> images(m->allFloppyImages.getList());
-    images.detachTo(ComSafeArrayOutArg(aFloppyImages));
-
+    aFloppyImages.resize(m->allFloppyImages.size());
+    size_t i = 0;
+    for (MediaOList::const_iterator it = m->allFloppyImages.begin();
+         it != m->allFloppyImages.end(); ++it, ++i)
+        (*it).queryInterfaceTo(aFloppyImages[i].asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(ProgressOperations)(ComSafeArrayOut(IProgress *, aOperations))
+HRESULT VirtualBox::getProgressOperations(std::vector<ComPtr<IProgress> > &aProgressOperations)
 {
-    CheckComArgOutPointerValid(aOperations);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* protect mProgressOperations */
     AutoReadLock safeLock(m->mtxProgressOperations COMMA_LOCKVAL_SRC_POS);
-    SafeIfaceArray<IProgress> progress(m->mapProgressOperations);
-    progress.detachTo(ComSafeArrayOutArg(aOperations));
-
+    ProgressMap pmap(m->mapProgressOperations);
+    aProgressOperations.resize(pmap.size());
+    size_t i = 0;
+    for (ProgressMap::iterator it = pmap.begin(); it != pmap.end(); ++it, ++i)
+        it->second.queryInterfaceTo(aProgressOperations[i].asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(GuestOSTypes)(ComSafeArrayOut(IGuestOSType *, aGuestOSTypes))
+HRESULT VirtualBox::getGuestOSTypes(std::vector<ComPtr<IGuestOSType> > &aGuestOSTypes)
 {
-    CheckComArgOutSafeArrayPointerValid(aGuestOSTypes);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock al(m->allGuestOSTypes.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-    SafeIfaceArray<IGuestOSType> ostypes(m->allGuestOSTypes.getList());
-    ostypes.detachTo(ComSafeArrayOutArg(aGuestOSTypes));
-
+    aGuestOSTypes.resize(m->allGuestOSTypes.size());
+    size_t i = 0;
+    for (GuestOSTypesOList::const_iterator it = m->allGuestOSTypes.begin();
+         it != m->allGuestOSTypes.end(); ++it, ++i)
+         (*it).queryInterfaceTo(aGuestOSTypes[i].asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders))
+HRESULT VirtualBox::getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders)
 {
-#ifndef RT_OS_WINDOWS
-    NOREF(aSharedFoldersSize);
-#endif /* RT_OS_WINDOWS */
-
-    CheckComArgOutSafeArrayPointerValid(aSharedFolders);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+ #ifndef RT_OS_WINDOWS
+     NOREF(aSharedFolders);
+ #endif /* RT_OS_WINDOWS */
+     NOREF(aSharedFolders);
 
     return setError(E_NOTIMPL, "Not yet implemented");
 }
 
-STDMETHODIMP
-VirtualBox::COMGETTER(PerformanceCollector)(IPerformanceCollector **aPerformanceCollector)
+HRESULT VirtualBox::getPerformanceCollector(ComPtr<IPerformanceCollector> &aPerformanceCollector)
 {
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
-    CheckComArgOutPointerValid(aPerformanceCollector);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* mPerformanceCollector is const, no need to lock */
-    m->pPerformanceCollector.queryInterfaceTo(aPerformanceCollector);
+    m->pPerformanceCollector.queryInterfaceTo(aPerformanceCollector.asOutParam());
 
     return S_OK;
 #else /* !VBOX_WITH_RESOURCE_USAGE_API */
@@ -1118,88 +1035,61 @@ VirtualBox::COMGETTER(PerformanceCollector)(IPerformanceCollector **aPerformance
 #endif /* !VBOX_WITH_RESOURCE_USAGE_API */
 }
 
-STDMETHODIMP
-VirtualBox::COMGETTER(DHCPServers)(ComSafeArrayOut(IDHCPServer *, aDHCPServers))
+HRESULT VirtualBox::getDHCPServers(std::vector<ComPtr<IDHCPServer> > &aDHCPServers)
 {
-    CheckComArgOutSafeArrayPointerValid(aDHCPServers);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock al(m->allDHCPServers.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-    SafeIfaceArray<IDHCPServer> svrs(m->allDHCPServers.getList());
-    svrs.detachTo(ComSafeArrayOutArg(aDHCPServers));
-
+    aDHCPServers.resize(m->allDHCPServers.size());
+    size_t i = 0;
+    for (DHCPServersOList::const_iterator it= m->allDHCPServers.begin();
+         it!= m->allDHCPServers.end(); ++it, ++i)
+         (*it).queryInterfaceTo(aDHCPServers[i].asOutParam());
     return S_OK;
 }
 
 
-STDMETHODIMP
-VirtualBox::COMGETTER(NATNetworks)(ComSafeArrayOut(INATNetwork *, aNATNetworks))
+HRESULT VirtualBox::getNATNetworks(std::vector<ComPtr<INATNetwork> > &aNATNetworks)
 {
 #ifdef VBOX_WITH_NAT_SERVICE
-    CheckComArgOutSafeArrayPointerValid(aNATNetworks);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock al(m->allNATNetworks.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-    SafeIfaceArray<INATNetwork> nets(m->allNATNetworks.getList());
-    nets.detachTo(ComSafeArrayOutArg(aNATNetworks));
-
+    aNATNetworks.resize(m->allNATNetworks.size());
+    size_t i = 0;
+    for (NATNetworksOList::const_iterator it= m->allNATNetworks.begin();
+         it!= m->allNATNetworks.end(); ++it, ++i)
+         (*it).queryInterfaceTo(aNATNetworks[i].asOutParam());
     return S_OK;
 #else
     NOREF(aNATNetworks);
 # ifndef RT_OS_WINDOWS
-    NOREF(aNATNetworksSize);
+    NOREF(aNATNetworks);
 # endif
+    NOREF(aNATNetworks);
     return E_NOTIMPL;
 #endif
 }
 
-
-STDMETHODIMP
-VirtualBox::COMGETTER(EventSource)(IEventSource ** aEventSource)
+HRESULT VirtualBox::getEventSource(ComPtr<IEventSource> &aEventSource)
 {
-    CheckComArgOutPointerValid(aEventSource);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     /* event source is const, no need to lock */
-    m->pEventSource.queryInterfaceTo(aEventSource);
-
+    m->pEventSource.queryInterfaceTo(aEventSource.asOutParam());
     return S_OK;
 }
 
-STDMETHODIMP
-VirtualBox::COMGETTER(ExtensionPackManager)(IExtPackManager **aExtPackManager)
+HRESULT VirtualBox::getExtensionPackManager(ComPtr<IExtPackManager> &aExtensionPackManager)
 {
-    CheckComArgOutPointerValid(aExtPackManager);
-
-    AutoCaller autoCaller(this);
-    HRESULT hrc = autoCaller.rc();
-    if (SUCCEEDED(hrc))
-    {
+    HRESULT hrc = S_OK;
 #ifdef VBOX_WITH_EXTPACK
-        /* The extension pack manager is const, no need to lock. */
-        hrc = m->ptrExtPackManager.queryInterfaceTo(aExtPackManager);
+    /* The extension pack manager is const, no need to lock. */
+    hrc = m->ptrExtPackManager.queryInterfaceTo(aExtensionPackManager.asOutParam());
 #else
-        hrc = E_NOTIMPL;
+    hrc = E_NOTIMPL;
+    NOREF(aExtensionPackManager);
 #endif
-    }
-
     return hrc;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(InternalNetworks)(ComSafeArrayOut(BSTR, aInternalNetworks))
+HRESULT VirtualBox::getInternalNetworks(std::vector<com::Utf8Str> &aInternalNetworks)
 {
-    CheckComArgOutSafeArrayPointerValid(aInternalNetworks);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    std::list<Bstr> allInternalNetworks;
+    std::list<com::Utf8Str> allInternalNetworks;
 
     /* get copy of all machine references, to avoid holding the list lock */
     MachinesOList::MyList allMachines;
@@ -1208,8 +1098,7 @@ STDMETHODIMP VirtualBox::COMGETTER(InternalNetworks)(ComSafeArrayOut(BSTR, aInte
         allMachines = m->allMachines.getList();
     }
     for (MachinesOList::MyList::const_iterator it = allMachines.begin();
-         it != allMachines.end();
-         ++it)
+         it != allMachines.end(); ++it)
     {
         const ComObjPtr<Machine> &pMachine = *it;
         AutoCaller autoMachineCaller(pMachine);
@@ -1217,9 +1106,9 @@ STDMETHODIMP VirtualBox::COMGETTER(InternalNetworks)(ComSafeArrayOut(BSTR, aInte
             continue;
         AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
 
-        if (pMachine->isAccessible())
+        if (pMachine->i_isAccessible())
         {
-            uint32_t cNetworkAdapters = Global::getMaxNetworkAdapters(pMachine->getChipsetType());
+            uint32_t cNetworkAdapters = Global::getMaxNetworkAdapters(pMachine->i_getChipsetType());
             for (ULONG i = 0; i < cNetworkAdapters; i++)
             {
                 ComPtr<INetworkAdapter> pNet;
@@ -1231,7 +1120,7 @@ STDMETHODIMP VirtualBox::COMGETTER(InternalNetworks)(ComSafeArrayOut(BSTR, aInte
                 if (FAILED(rc) || strInternalNetwork.isEmpty())
                     continue;
 
-                allInternalNetworks.push_back(strInternalNetwork);
+                allInternalNetworks.push_back(Utf8Str(strInternalNetwork));
             }
         }
     }
@@ -1239,28 +1128,18 @@ STDMETHODIMP VirtualBox::COMGETTER(InternalNetworks)(ComSafeArrayOut(BSTR, aInte
     /* throw out any duplicates */
     allInternalNetworks.sort();
     allInternalNetworks.unique();
-    com::SafeArray<BSTR> internalNetworks(allInternalNetworks.size());
     size_t i = 0;
-    for (std::list<Bstr>::const_iterator it = allInternalNetworks.begin();
+    aInternalNetworks.resize(allInternalNetworks.size());
+    for (std::list<com::Utf8Str>::const_iterator it = allInternalNetworks.begin();
          it != allInternalNetworks.end();
-         ++it, i++)
-    {
-        const Bstr &tmp = *it;
-        tmp.cloneTo(&internalNetworks[i]);
-    }
-    internalNetworks.detachTo(ComSafeArrayOutArg(aInternalNetworks));
-
+         ++it, ++i)
+        aInternalNetworks[i] = *it;
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::COMGETTER(GenericNetworkDrivers)(ComSafeArrayOut(BSTR, aGenericNetworkDrivers))
+HRESULT VirtualBox::getGenericNetworkDrivers(std::vector<com::Utf8Str> &aGenericNetworkDrivers)
 {
-    CheckComArgOutSafeArrayPointerValid(aGenericNetworkDrivers);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    std::list<Bstr> allGenericNetworkDrivers;
+    std::list<com::Utf8Str> allGenericNetworkDrivers;
 
     /* get copy of all machine references, to avoid holding the list lock */
     MachinesOList::MyList allMachines;
@@ -1278,9 +1157,9 @@ STDMETHODIMP VirtualBox::COMGETTER(GenericNetworkDrivers)(ComSafeArrayOut(BSTR,
             continue;
         AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
 
-        if (pMachine->isAccessible())
+        if (pMachine->i_isAccessible())
         {
-            uint32_t cNetworkAdapters = Global::getMaxNetworkAdapters(pMachine->getChipsetType());
+            uint32_t cNetworkAdapters = Global::getMaxNetworkAdapters(pMachine->i_getChipsetType());
             for (ULONG i = 0; i < cNetworkAdapters; i++)
             {
                 ComPtr<INetworkAdapter> pNet;
@@ -1292,7 +1171,7 @@ STDMETHODIMP VirtualBox::COMGETTER(GenericNetworkDrivers)(ComSafeArrayOut(BSTR,
                 if (FAILED(rc) || strGenericNetworkDriver.isEmpty())
                     continue;
 
-                allGenericNetworkDrivers.push_back(strGenericNetworkDriver);
+                allGenericNetworkDrivers.push_back(Utf8Str(strGenericNetworkDriver).c_str());
             }
         }
     }
@@ -1300,32 +1179,21 @@ STDMETHODIMP VirtualBox::COMGETTER(GenericNetworkDrivers)(ComSafeArrayOut(BSTR,
     /* throw out any duplicates */
     allGenericNetworkDrivers.sort();
     allGenericNetworkDrivers.unique();
-    com::SafeArray<BSTR> genericNetworks(allGenericNetworkDrivers.size());
+    aGenericNetworkDrivers.resize(allGenericNetworkDrivers.size());
     size_t i = 0;
-    for (std::list<Bstr>::const_iterator it = allGenericNetworkDrivers.begin();
-         it != allGenericNetworkDrivers.end();
-         ++it, i++)
-    {
-        const Bstr &tmp = *it;
-        tmp.cloneTo(&genericNetworks[i]);
-    }
-    genericNetworks.detachTo(ComSafeArrayOutArg(aGenericNetworkDrivers));
+    for (std::list<com::Utf8Str>::const_iterator it = allGenericNetworkDrivers.begin();
+         it != allGenericNetworkDrivers.end(); ++it, ++i)
+        aGenericNetworkDrivers[i] = *it;
 
     return S_OK;
 }
 
-STDMETHODIMP
-VirtualBox::CheckFirmwarePresent(FirmwareType_T aFirmwareType,
-                                 IN_BSTR        aVersion,
-                                 BSTR           *aUrl,
-                                 BSTR           *aFile,
-                                 BOOL           *aResult)
+HRESULT VirtualBox::checkFirmwarePresent(FirmwareType_T aFirmwareType,
+                                         const com::Utf8Str &aVersion,
+                                         com::Utf8Str &aUrl,
+                                         com::Utf8Str &aFile,
+                                         BOOL *aResult)
 {
-    CheckComArgNotNull(aResult);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     NOREF(aVersion);
 
     static const struct
@@ -1368,13 +1236,12 @@ VirtualBox::CheckFirmwarePresent(FirmwareType_T aFirmwareType,
         shortName = Utf8StrFmt("Firmware%c%s",
                                RTPATH_DELIMITER,
                                firmwareDesc[i].fileName);
-        int rc = calculateFullPath(shortName, fullName);
+        int rc = i_calculateFullPath(shortName, fullName);
         AssertRCReturn(rc, rc);
         if (RTFileExists(fullName.c_str()))
         {
             *aResult = TRUE;
-            if (aFile)
-                Utf8Str(fullName).cloneTo(aFile);
+            aFile = fullName;
             break;
         }
 
@@ -1388,17 +1255,12 @@ VirtualBox::CheckFirmwarePresent(FirmwareType_T aFirmwareType,
         if (RTFileExists(fullName.c_str()))
         {
             *aResult = TRUE;
-            if (aFile)
-                Utf8Str(fullName).cloneTo(aFile);
+            aFile = fullName;
             break;
         }
 
         /** @todo: account for version in the URL */
-        if (aUrl != NULL)
-        {
-            Utf8Str strUrl(firmwareDesc[i].url);
-            strUrl.cloneTo(aUrl);
-        }
+        aUrl = firmwareDesc[i].url;
         *aResult = FALSE;
 
         /* Assume single record per firmware type */
@@ -1407,60 +1269,41 @@ VirtualBox::CheckFirmwarePresent(FirmwareType_T aFirmwareType,
 
     return S_OK;
 }
-// IVirtualBox methods
+// Wrapped IVirtualBox methods
 /////////////////////////////////////////////////////////////////////////////
 
 /* Helper for VirtualBox::ComposeMachineFilename */
 static void sanitiseMachineFilename(Utf8Str &aName);
 
-STDMETHODIMP VirtualBox::ComposeMachineFilename(IN_BSTR aName,
-                                                IN_BSTR aGroup,
-                                                IN_BSTR aCreateFlags,
-                                                IN_BSTR aBaseFolder,
-                                                BSTR *aFilename)
+HRESULT VirtualBox::composeMachineFilename(const com::Utf8Str &aName,
+                                           const com::Utf8Str &aGroup,
+                                           const com::Utf8Str &aCreateFlags,
+                                           const com::Utf8Str &aBaseFolder,
+                                           com::Utf8Str       &aFile)
 {
     LogFlowThisFuncEnter();
-    LogFlowThisFunc(("aName=\"%ls\",aBaseFolder=\"%ls\"\n", aName, aBaseFolder));
 
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgOutPointerValid(aFilename);
+    Utf8Str strBase = aBaseFolder;
+    Utf8Str strName = aName;
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aName=\"%s\",aBaseFolder=\"%s\"\n", strName.c_str(), strBase.c_str()));
 
-    Utf8Str strCreateFlags(aCreateFlags);
     Guid id;
     bool fDirectoryIncludesUUID = false;
-    if (!strCreateFlags.isEmpty())
+    if (!aCreateFlags.isEmpty())
     {
-        const char *pcszNext = strCreateFlags.c_str();
-        while (*pcszNext != '\0')
-        {
-            Utf8Str strFlag;
-            const char *pcszComma = RTStrStr(pcszNext, ",");
-            if (!pcszComma)
-                strFlag = pcszNext;
-            else
-                strFlag = Utf8Str(pcszNext, pcszComma - pcszNext);
+        size_t uPos = 0;
+        do {
 
-            const char *pcszEqual = RTStrStr(strFlag.c_str(), "=");
-            /* skip over everything which doesn't contain '=' */
-            if (pcszEqual && pcszEqual != strFlag.c_str())
-            {
-                Utf8Str strKey(strFlag.c_str(), pcszEqual - strFlag.c_str());
-                Utf8Str strValue(strFlag.c_str() + (pcszEqual - strFlag.c_str() + 1));
+            com::Utf8Str strKey, strValue;
+            uPos = aCreateFlags.parseKeyValue(strKey, strValue, uPos);
 
-                if (strKey == "UUID")
-                    id = strValue.c_str();
-                else if (strKey == "directoryIncludesUUID")
-                    fDirectoryIncludesUUID = (strValue == "1");
-            }
+            if (strKey == "UUID")
+                id = strValue.c_str();
+            else if (strKey == "directoryIncludesUUID")
+                fDirectoryIncludesUUID = (strValue == "1");
 
-            if (!pcszComma)
-                pcszNext += strFlag.length();
-            else
-                pcszNext += strFlag.length() + 1;
-        }
+        } while(uPos != com::Utf8Str::npos);
     }
 
     if (id.isZero())
@@ -1469,14 +1312,14 @@ STDMETHODIMP VirtualBox::ComposeMachineFilename(IN_BSTR aName,
     {
         /* do something else */
         return setError(E_INVALIDARG,
-                 tr("'%ls' is not a valid Guid"),
+                 tr("'%s' is not a valid Guid"),
                  id.toStringCurly().c_str());
     }
 
     Utf8Str strGroup(aGroup);
     if (strGroup.isEmpty())
         strGroup = "/";
-    HRESULT rc = validateMachineGroup(strGroup, true);
+    HRESULT rc = i_validateMachineGroup(strGroup, true);
     if (FAILED(rc))
         return rc;
 
@@ -1489,8 +1332,6 @@ STDMETHODIMP VirtualBox::ComposeMachineFilename(IN_BSTR aName,
      * We sanitise the machine name to a safe white list of characters before
      * using it.
      */
-    Utf8Str strBase = aBaseFolder;
-    Utf8Str strName = aName;
     Utf8Str strDirName(strName);
     if (fDirectoryIncludesUUID)
         strDirName += Utf8StrFmt(" (%RTuuid)", id.raw());
@@ -1499,23 +1340,20 @@ STDMETHODIMP VirtualBox::ComposeMachineFilename(IN_BSTR aName,
 
     if (strBase.isEmpty())
         /* we use the non-full folder value below to keep the path relative */
-        getDefaultMachineFolder(strBase);
+        i_getDefaultMachineFolder(strBase);
 
-    calculateFullPath(strBase, strBase);
+    i_calculateFullPath(strBase, strBase);
 
     /* eliminate toplevel group to avoid // in the result */
     if (strGroup == "/")
         strGroup.setNull();
-    Bstr bstrSettingsFile = BstrFmt("%s%s%c%s%c%s.vbox",
-                                    strBase.c_str(),
-                                    strGroup.c_str(),
-                                    RTPATH_DELIMITER,
-                                    strDirName.c_str(),
-                                    RTPATH_DELIMITER,
-                                    strName.c_str());
-
-    bstrSettingsFile.detachTo(aFilename);
-
+    aFile = com::Utf8StrFmt("%s%s%c%s%c%s.vbox",
+                            strBase.c_str(),
+                            strGroup.c_str(),
+                            RTPATH_DELIMITER,
+                            strDirName.c_str(),
+                            RTPATH_DELIMITER,
+                            strName.c_str());
     return S_OK;
 }
 
@@ -1606,29 +1444,24 @@ namespace
 #endif
 
 /** @note Locks mSystemProperties object for reading. */
-STDMETHODIMP VirtualBox::CreateMachine(IN_BSTR aSettingsFile,
-                                       IN_BSTR aName,
-                                       ComSafeArrayIn(IN_BSTR, aGroups),
-                                       IN_BSTR aOsTypeId,
-                                       IN_BSTR aCreateFlags,
-                                       IMachine **aMachine)
+HRESULT VirtualBox::createMachine(const com::Utf8Str &aSettingsFile,
+                                  const com::Utf8Str &aName,
+                                  const std::vector<com::Utf8Str> &aGroups,
+                                  const com::Utf8Str &aOsTypeId,
+                                  const com::Utf8Str &aFlags,
+                                  ComPtr<IMachine> &aMachine)
 {
     LogFlowThisFuncEnter();
-    LogFlowThisFunc(("aSettingsFile=\"%ls\", aName=\"%ls\", aOsTypeId =\"%ls\", aCreateFlags=\"%ls\"\n", aSettingsFile, aName, aOsTypeId, aCreateFlags));
-
-    CheckComArgStrNotEmptyOrNull(aName);
+    LogFlowThisFunc(("aSettingsFile=\"%s\", aName=\"%s\", aOsTypeId =\"%s\", aCreateFlags=\"%s\"\n",
+                     aSettingsFile.c_str(), aName.c_str(), aOsTypeId.c_str(), aFlags.c_str()));
     /** @todo tighten checks on aId? */
-    CheckComArgOutPointerValid(aMachine);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     StringsList llGroups;
-    HRESULT rc = convertMachineGroups(ComSafeArrayInArg(aGroups), &llGroups);
+    HRESULT rc = i_convertMachineGroups(aGroups, &llGroups);
     if (FAILED(rc))
         return rc;
 
-    Utf8Str strCreateFlags(aCreateFlags);
+    Utf8Str strCreateFlags(aFlags);
     Guid id;
     bool fForceOverwrite = false;
     bool fDirectoryIncludesUUID = false;
@@ -1672,7 +1505,7 @@ STDMETHODIMP VirtualBox::CreateMachine(IN_BSTR aSettingsFile,
     {
         /* do something else */
         return setError(E_INVALIDARG,
-                 tr("'%ls' is not a valid Guid"),
+                 tr("'%s' is not a valid Guid"),
                  id.toStringCurly().c_str());
     }
 
@@ -1684,12 +1517,15 @@ STDMETHODIMP VirtualBox::CreateMachine(IN_BSTR aSettingsFile,
         if (fDirectoryIncludesUUID)
             strNewCreateFlags += ",directoryIncludesUUID=1";
 
-        rc = ComposeMachineFilename(aName,
-                                    Bstr(llGroups.front()).raw(),
-                                    Bstr(strNewCreateFlags).raw(),
-                                    NULL /* aBaseFolder */,
-                                    bstrSettingsFile.asOutParam());
+        com::Utf8Str blstr = "";
+        com::Utf8Str sf = aSettingsFile;
+        rc = composeMachineFilename(aName,
+                                    llGroups.front(),
+                                    strNewCreateFlags,
+                                    blstr /* aBaseFolder */,
+                                    sf);
         if (FAILED(rc)) return rc;
+        bstrSettingsFile = Bstr(sf).raw();
     }
 
     /* create a new object */
@@ -1698,7 +1534,7 @@ STDMETHODIMP VirtualBox::CreateMachine(IN_BSTR aSettingsFile,
     if (FAILED(rc)) return rc;
 
     GuestOSType *osType = NULL;
-    rc = findGuestOSType(Bstr(aOsTypeId), osType);
+    rc = i_findGuestOSType(Bstr(aOsTypeId), osType);
     if (FAILED(rc)) return rc;
 
     /* initialize the machine object */
@@ -1713,12 +1549,12 @@ STDMETHODIMP VirtualBox::CreateMachine(IN_BSTR aSettingsFile,
     if (SUCCEEDED(rc))
     {
         /* set the return value */
-        rc = machine.queryInterfaceTo(aMachine);
+        machine.queryInterfaceTo(aMachine.asOutParam());
         AssertComRC(rc);
 
 #ifdef VBOX_WITH_EXTPACK
         /* call the extension pack hooks */
-        m->ptrExtPackManager->callAllVmCreatedHooks(machine);
+        m->ptrExtPackManager->i_callAllVmCreatedHooks(machine);
 #endif
     }
 
@@ -1727,15 +1563,9 @@ STDMETHODIMP VirtualBox::CreateMachine(IN_BSTR aSettingsFile,
     return rc;
 }
 
-STDMETHODIMP VirtualBox::OpenMachine(IN_BSTR aSettingsFile,
-                                     IMachine **aMachine)
+HRESULT VirtualBox::openMachine(const com::Utf8Str &aSettingsFile,
+                                ComPtr<IMachine> &aMachine)
 {
-    CheckComArgStrNotEmptyOrNull(aSettingsFile);
-    CheckComArgOutPointerValid(aMachine);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT rc = E_FAIL;
 
     /* create a new object */
@@ -1750,7 +1580,7 @@ STDMETHODIMP VirtualBox::OpenMachine(IN_BSTR aSettingsFile,
         if (SUCCEEDED(rc))
         {
             /* set the return value */
-            rc = machine.queryInterfaceTo(aMachine);
+            machine.queryInterfaceTo(aMachine.asOutParam());
             ComAssertComRC(rc);
         }
     }
@@ -1759,13 +1589,8 @@ STDMETHODIMP VirtualBox::OpenMachine(IN_BSTR aSettingsFile,
 }
 
 /** @note Locks objects! */
-STDMETHODIMP VirtualBox::RegisterMachine(IMachine *aMachine)
+HRESULT VirtualBox::registerMachine(const ComPtr<IMachine> &aMachine)
 {
-    CheckComArgNotNull(aMachine);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     HRESULT rc;
 
     Bstr name;
@@ -1774,84 +1599,75 @@ STDMETHODIMP VirtualBox::RegisterMachine(IMachine *aMachine)
 
     /* We can safely cast child to Machine * here because only Machine
      * implementations of IMachine can be among our children. */
-    Machine *pMachine = static_cast<Machine*>(aMachine);
+    IMachine *aM = aMachine;
+    Machine *pMachine = static_cast<Machine*>(aM);
 
     AutoCaller machCaller(pMachine);
     ComAssertComRCRetRC(machCaller.rc());
 
-    rc = registerMachine(pMachine);
+    rc = i_registerMachine(pMachine);
     /* fire an event */
     if (SUCCEEDED(rc))
-        onMachineRegistered(pMachine->getId(), TRUE);
+        i_onMachineRegistered(pMachine->i_getId(), TRUE);
 
     return rc;
 }
 
 /** @note Locks this object for reading, then some machine objects for reading. */
-STDMETHODIMP VirtualBox::FindMachine(IN_BSTR aNameOrId, IMachine **aMachine)
+HRESULT VirtualBox::findMachine(const com::Utf8Str &aSettingsFile,
+                                ComPtr<IMachine> &aMachine)
 {
     LogFlowThisFuncEnter();
-    LogFlowThisFunc(("aName=\"%ls\", aMachine={%p}\n", aNameOrId, aMachine));
-
-    CheckComArgStrNotEmptyOrNull(aNameOrId);
-    CheckComArgOutPointerValid(aMachine);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    LogFlowThisFunc(("aSettingsFile=\"%s\", aMachine={%p}\n", aSettingsFile.c_str(), &aMachine));
 
     /* start with not found */
     HRESULT rc = S_OK;
     ComObjPtr<Machine> pMachineFound;
 
-    Guid id(aNameOrId);
+    Guid id(Bstr(aSettingsFile).raw());
+    Utf8Str strFile(aSettingsFile);
     if (id.isValid() && !id.isZero())
 
-        rc = findMachine(id,
-                         true /* fPermitInaccessible */,
-                         true /* setError */,
-                         &pMachineFound);
-                // returns VBOX_E_OBJECT_NOT_FOUND if not found and sets error
+        rc = i_findMachine(id,
+                           true /* fPermitInaccessible */,
+                           true /* setError */,
+                           &pMachineFound);
+        // returns VBOX_E_OBJECT_NOT_FOUND if not found and sets error
     else
     {
-        Utf8Str strName(aNameOrId);
-        rc = findMachineByName(aNameOrId,
-                               true /* setError */,
-                               &pMachineFound);
-                // returns VBOX_E_OBJECT_NOT_FOUND if not found and sets error
+        rc = i_findMachineByName(strFile,
+                                 true /* setError */,
+                                 &pMachineFound);
+        // returns VBOX_E_OBJECT_NOT_FOUND if not found and sets error
     }
 
     /* this will set (*machine) to NULL if machineObj is null */
-    pMachineFound.queryInterfaceTo(aMachine);
+    pMachineFound.queryInterfaceTo(aMachine.asOutParam());
 
-    LogFlowThisFunc(("aName=\"%ls\", aMachine=%p, rc=%08X\n", aNameOrId, *aMachine, rc));
+    LogFlowThisFunc(("aName=\"%s\", aMachine=%p, rc=%08X\n", aSettingsFile.c_str(), &aMachine, rc));
     LogFlowThisFuncLeave();
 
     return rc;
 }
 
-STDMETHODIMP VirtualBox::GetMachinesByGroups(ComSafeArrayIn(IN_BSTR, aGroups), ComSafeArrayOut(IMachine *, aMachines))
+HRESULT VirtualBox::getMachinesByGroups(const std::vector<com::Utf8Str> &aGroups,
+                                        std::vector<ComPtr<IMachine> > &aMachines)
 {
-    CheckComArgSafeArrayNotNull(aGroups);
-    CheckComArgOutSafeArrayPointerValid(aMachines);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     StringsList llGroups;
-    HRESULT rc = convertMachineGroups(ComSafeArrayInArg(aGroups), &llGroups);
+    HRESULT rc = i_convertMachineGroups(aGroups, &llGroups);
     if (FAILED(rc))
         return rc;
+
     /* we want to rely on sorted groups during compare, to save time */
     llGroups.sort();
 
     /* get copy of all machine references, to avoid holding the list lock */
     MachinesOList::MyList allMachines;
-    {
-        AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS);
-        allMachines = m->allMachines.getList();
-    }
+    AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS);
+    allMachines = m->allMachines.getList();
 
-    com::SafeIfaceArray<IMachine> saMachines;
+    std::vector<ComObjPtr<IMachine> > saMachines;
+    saMachines.resize(0);
     for (MachinesOList::MyList::const_iterator it = allMachines.begin();
          it != allMachines.end();
          ++it)
@@ -1862,9 +1678,9 @@ STDMETHODIMP VirtualBox::GetMachinesByGroups(ComSafeArrayIn(IN_BSTR, aGroups), C
             continue;
         AutoReadLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
 
-        if (pMachine->isAccessible())
+        if (pMachine->i_isAccessible())
         {
-            const StringsList &thisGroups = pMachine->getGroups();
+            const StringsList &thisGroups = pMachine->i_getGroups();
             for (StringsList::const_iterator it2 = thisGroups.begin();
                  it2 != thisGroups.end();
                  ++it2)
@@ -1878,7 +1694,7 @@ STDMETHODIMP VirtualBox::GetMachinesByGroups(ComSafeArrayIn(IN_BSTR, aGroups), C
                     int order = it3->compare(group);
                     if (order == 0)
                     {
-                        saMachines.push_back(pMachine);
+                        saMachines.push_back(static_cast<IMachine *>(pMachine));
                         fAppended = true;
                         break;
                     }
@@ -1893,19 +1709,19 @@ STDMETHODIMP VirtualBox::GetMachinesByGroups(ComSafeArrayIn(IN_BSTR, aGroups), C
             }
         }
     }
-
-    saMachines.detachTo(ComSafeArrayOutArg(aMachines));
+    aMachines.resize(saMachines.size());
+    size_t i = 0;
+    for(i = 0; i < saMachines.size(); ++i)
+        saMachines[i].queryInterfaceTo(aMachines[i].asOutParam());
 
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::GetMachineStates(ComSafeArrayIn(IMachine *, aMachines), ComSafeArrayOut(MachineState_T, aStates))
+HRESULT VirtualBox::getMachineStates(const std::vector<ComPtr<IMachine> > &aMachines,
+                                     std::vector<MachineState_T> &aStates)
 {
-    CheckComArgSafeArrayNotNull(aMachines);
-    CheckComArgOutSafeArrayPointerValid(aStates);
-
-    com::SafeIfaceArray<IMachine> saMachines(ComSafeArrayInArg(aMachines));
-    com::SafeArray<MachineState_T> saStates(saMachines.size());
+    com::SafeIfaceArray<IMachine> saMachines(aMachines);
+    aStates.resize(aMachines.size());
     for (size_t i = 0; i < saMachines.size(); i++)
     {
         ComPtr<IMachine> pMachine = saMachines[i];
@@ -1917,91 +1733,116 @@ STDMETHODIMP VirtualBox::GetMachineStates(ComSafeArrayIn(IMachine *, aMachines),
                 rc = S_OK;
             AssertComRC(rc);
         }
-        saStates[i] = state;
+        aStates[i] = state;
     }
-    saStates.detachTo(ComSafeArrayOutArg(aStates));
-
     return S_OK;
 }
 
-STDMETHODIMP VirtualBox::CreateHardDisk(IN_BSTR aFormat,
-                                        IN_BSTR aLocation,
-                                        IMedium **aHardDisk)
+HRESULT VirtualBox::createMedium(const com::Utf8Str &aFormat,
+                                 const com::Utf8Str &aLocation,
+                                 AccessMode_T aAccessMode,
+                                 DeviceType_T aDeviceType,
+                                 ComPtr<IMedium> &aMedium)
 {
-    CheckComArgOutPointerValid(aHardDisk);
+    NOREF(aAccessMode); /**< @todo r=klaus make use of access mode */
 
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    HRESULT rc = S_OK;
+
+    ComObjPtr<Medium> medium;
+    medium.createObject();
+    com::Utf8Str format = aFormat;
 
-    /* we don't access non-const data members so no need to lock */
+    switch (aDeviceType)
+    {
+        case DeviceType_HardDisk:
+        {
 
-    Utf8Str format(aFormat);
-    if (format.isEmpty())
-        getDefaultHardDiskFormat(format);
+            /* we don't access non-const data members so no need to lock */
+            if (format.isEmpty())
+                i_getDefaultHardDiskFormat(format);
 
-    ComObjPtr<Medium> hardDisk;
-    hardDisk.createObject();
-    HRESULT rc = hardDisk->init(this,
-                                format,
-                                aLocation,
-                                Guid::Empty /* media registry: none yet */);
+            rc = medium->init(this,
+                              format,
+                              aLocation,
+                              Guid::Empty /* media registry: none yet */,
+                              aDeviceType);
+        }
+        break;
+
+        case DeviceType_DVD:
+        case DeviceType_Floppy:
+        {
+
+            if (format.isEmpty())
+                return setError(E_INVALIDARG, "Format must be Valid Type%s", format.c_str());
+
+            // enforce read-only for DVDs even if caller specified ReadWrite
+            if (aDeviceType == DeviceType_DVD)
+                aAccessMode = AccessMode_ReadOnly;
+
+             rc = medium->init(this,
+                               format,
+                               aLocation,
+                               Guid::Empty /* media registry: none yet */,
+                               aDeviceType);
+
+         }
+         break;
+
+         default:
+             return setError(E_INVALIDARG, "Device type must be HardDisk, DVD or Floppy %d", aDeviceType);
+    }
 
     if (SUCCEEDED(rc))
-        hardDisk.queryInterfaceTo(aHardDisk);
+        medium.queryInterfaceTo(aMedium.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP VirtualBox::OpenMedium(IN_BSTR aLocation,
-                                    DeviceType_T deviceType,
-                                    AccessMode_T accessMode,
-                                    BOOL fForceNewUuid,
-                                    IMedium **aMedium)
+HRESULT VirtualBox::openMedium(const com::Utf8Str &aLocation,
+                               DeviceType_T aDeviceType,
+                               AccessMode_T aAccessMode,
+                               BOOL aForceNewUuid,
+                               ComPtr<IMedium> &aMedium)
 {
     HRESULT rc = S_OK;
-    CheckComArgStrNotEmptyOrNull(aLocation);
-    CheckComArgOutPointerValid(aMedium);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     Guid id(aLocation);
     ComObjPtr<Medium> pMedium;
 
     // have to get write lock as the whole find/update sequence must be done
     // in one critical section, otherwise there are races which can lead to
     // multiple Medium objects with the same content
-    AutoWriteLock treeLock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock treeLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     // check if the device type is correct, and see if a medium for the
     // given path has already initialized; if so, return that
-    switch (deviceType)
+    switch (aDeviceType)
     {
         case DeviceType_HardDisk:
             if (id.isValid() && !id.isZero())
-                rc = findHardDiskById(id, false /* setError */, &pMedium);
+                rc = i_findHardDiskById(id, false /* setError */, &pMedium);
             else
-                rc = findHardDiskByLocation(aLocation,
-                                            false, /* aSetError */
-                                            &pMedium);
+                rc = i_findHardDiskByLocation(aLocation,
+                                              false, /* aSetError */
+                                              &pMedium);
         break;
 
         case DeviceType_Floppy:
         case DeviceType_DVD:
             if (id.isValid() && !id.isZero())
-                rc = findDVDOrFloppyImage(deviceType, &id, Utf8Str::Empty,
-                                          false /* setError */, &pMedium);
+                rc = i_findDVDOrFloppyImage(aDeviceType, &id, Utf8Str::Empty,
+                                            false /* setError */, &pMedium);
             else
-                rc = findDVDOrFloppyImage(deviceType, NULL, aLocation,
-                                          false /* setError */, &pMedium);
+                rc = i_findDVDOrFloppyImage(aDeviceType, NULL, aLocation,
+                                            false /* setError */, &pMedium);
 
             // enforce read-only for DVDs even if caller specified ReadWrite
-            if (deviceType == DeviceType_DVD)
-                accessMode = AccessMode_ReadOnly;
+            if (aDeviceType == DeviceType_DVD)
+                aAccessMode = AccessMode_ReadOnly;
         break;
 
         default:
-            return setError(E_INVALIDARG, "Device type must be HardDisk, DVD or Floppy %d", deviceType);
+            return setError(E_INVALIDARG, "Device type must be HardDisk, DVD or Floppy %d", aDeviceType);
     }
 
     if (pMedium.isNull())
@@ -2010,14 +1851,14 @@ STDMETHODIMP VirtualBox::OpenMedium(IN_BSTR aLocation,
         treeLock.release();
         rc = pMedium->init(this,
                            aLocation,
-                           (accessMode == AccessMode_ReadWrite) ? Medium::OpenReadWrite : Medium::OpenReadOnly,
-                           !!fForceNewUuid,
-                           deviceType);
+                           (aAccessMode == AccessMode_ReadWrite) ? Medium::OpenReadWrite : Medium::OpenReadOnly,
+                           !!aForceNewUuid,
+                           aDeviceType);
         treeLock.acquire();
 
         if (SUCCEEDED(rc))
         {
-            rc = registerMedium(pMedium, &pMedium, deviceType, treeLock);
+            rc = i_registerMedium(pMedium, &pMedium, treeLock);
 
             treeLock.release();
 
@@ -2032,92 +1873,79 @@ STDMETHODIMP VirtualBox::OpenMedium(IN_BSTR aLocation,
             }
         }
         else
-            rc = VBOX_E_OBJECT_NOT_FOUND;
+        {
+            if (rc != VBOX_E_INVALID_OBJECT_STATE)
+                rc = VBOX_E_OBJECT_NOT_FOUND;
+        }
     }
 
     if (SUCCEEDED(rc))
-        pMedium.queryInterfaceTo(aMedium);
+        pMedium.queryInterfaceTo(aMedium.asOutParam());
 
     return rc;
 }
 
 
 /** @note Locks this object for reading. */
-STDMETHODIMP VirtualBox::GetGuestOSType(IN_BSTR aId, IGuestOSType **aType)
+HRESULT VirtualBox::getGuestOSType(const com::Utf8Str &aId,
+                                   ComPtr<IGuestOSType> &aType)
 {
-    CheckComArgNotNull(aType);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    *aType = NULL;
-
+    aType = NULL;
     AutoReadLock alock(m->allGuestOSTypes.getLockHandle() COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT rc = S_OK;
     for (GuestOSTypesOList::iterator it = m->allGuestOSTypes.begin();
          it != m->allGuestOSTypes.end();
          ++it)
     {
-        const Bstr &typeId = (*it)->id();
+        const Bstr &typeId = (*it)->i_id();
         AssertMsg(!typeId.isEmpty(), ("ID must not be NULL"));
         if (typeId.compare(aId, Bstr::CaseInsensitive) == 0)
         {
-            (*it).queryInterfaceTo(aType);
+            (*it).queryInterfaceTo(aType.asOutParam());
             break;
         }
     }
-
-    return (*aType) ? S_OK :
+    return (aType) ? S_OK :
         setError(E_INVALIDARG,
-                 tr("'%ls' is not a valid Guest OS type"),
-                 aId);
+                 tr("'%s' is not a valid Guest OS type"),
+                 aId.c_str());
+    return rc;
 }
 
-STDMETHODIMP VirtualBox::CreateSharedFolder(IN_BSTR aName,        IN_BSTR aHostPath,
-                                            BOOL /* aWritable */, BOOL /* aAutoMount */)
+HRESULT VirtualBox::createSharedFolder(const com::Utf8Str &aName,
+                                       const com::Utf8Str &aHostPath,
+                                       BOOL aWritable,
+                                       BOOL aAutomount)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgStrNotEmptyOrNull(aHostPath);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    NOREF(aName);
+    NOREF(aHostPath);
+    NOREF(aWritable);
+    NOREF(aAutomount);
 
     return setError(E_NOTIMPL, "Not yet implemented");
 }
 
-STDMETHODIMP VirtualBox::RemoveSharedFolder(IN_BSTR aName)
+HRESULT VirtualBox::removeSharedFolder(const com::Utf8Str &aName)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
+    NOREF(aName);
     return setError(E_NOTIMPL, "Not yet implemented");
 }
 
 /**
  *  @note Locks this object for reading.
  */
-STDMETHODIMP VirtualBox::GetExtraDataKeys(ComSafeArrayOut(BSTR, aKeys))
+HRESULT VirtualBox::getExtraDataKeys(std::vector<com::Utf8Str> &aKeys)
 {
     using namespace settings;
 
-    CheckComArgOutSafeArrayPointerValid(aKeys);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
 
-    com::SafeArray<BSTR> saKeys(m->pMainConfigFile->mapExtraDataItems.size());
-    int i = 0;
+    aKeys.resize(m->pMainConfigFile->mapExtraDataItems.size());
+    size_t i = 0;
     for (StringsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.begin();
-         it != m->pMainConfigFile->mapExtraDataItems.end();
-         ++it, ++i)
-    {
-        const Utf8Str &strName = it->first;     // the key
-        strName.cloneTo(&saKeys[i]);
-    }
-    saKeys.detachTo(ComSafeArrayOutArg(aKeys));
+         it != m->pMainConfigFile->mapExtraDataItems.end(); ++it, ++i)
+        aKeys[i] = it->first;
 
     return S_OK;
 }
@@ -2125,26 +1953,15 @@ STDMETHODIMP VirtualBox::GetExtraDataKeys(ComSafeArrayOut(BSTR, aKeys))
 /**
  *  @note Locks this object for reading.
  */
-STDMETHODIMP VirtualBox::GetExtraData(IN_BSTR aKey,
-                                      BSTR *aValue)
+HRESULT VirtualBox::getExtraData(const com::Utf8Str &aKey,
+                                 com::Utf8Str &aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aKey);
-    CheckComArgNotNull(aValue);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    /* start with nothing found */
-    Utf8Str strKey(aKey);
-    Bstr bstrResult;
-
-    settings::StringsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(strKey);
+    settings::StringsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(aKey);
     if (it != m->pMainConfigFile->mapExtraDataItems.end())
         // found:
-        bstrResult = it->second; // source is a Utf8Str
+        aValue = it->second; // source is a Utf8Str
 
     /* return the result to caller (may be empty) */
-    bstrResult.cloneTo(aValue);
 
     return S_OK;
 }
@@ -2152,17 +1969,14 @@ STDMETHODIMP VirtualBox::GetExtraData(IN_BSTR aKey,
 /**
  *  @note Locks this object for writing.
  */
-STDMETHODIMP VirtualBox::SetExtraData(IN_BSTR aKey,
-                                      IN_BSTR aValue)
+HRESULT VirtualBox::setExtraData(const com::Utf8Str &aKey,
+                                 const com::Utf8Str &aValue)
 {
-    CheckComArgStrNotEmptyOrNull(aKey);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
     Utf8Str strKey(aKey);
     Utf8Str strValue(aValue);
     Utf8Str strOldValue;            // empty
+    HRESULT rc = S_OK;
 
     // locking note: we only hold the read lock briefly to look up the old value,
     // then release it and call the onExtraCanChange callbacks. There is a small
@@ -2186,18 +2000,17 @@ STDMETHODIMP VirtualBox::SetExtraData(IN_BSTR aKey,
         // onExtraDataCanChange() only briefly requests the VirtualBox
         // lock to copy the list of callbacks to invoke
         Bstr error;
-        Bstr bstrValue(aValue);
 
-        if (!onExtraDataCanChange(Guid::Empty, aKey, bstrValue.raw(), error))
+        if (!i_onExtraDataCanChange(Guid::Empty, Bstr(aKey).raw(), Bstr(aValue).raw(), error))
         {
             const char *sep = error.isEmpty() ? "" : ": ";
             CBSTR err = error.raw();
             LogWarningFunc(("Someone vetoed! Change refused%s%ls\n",
                             sep, err));
             return setError(E_ACCESSDENIED,
-                            tr("Could not set extra data because someone refused the requested change of '%ls' to '%ls'%s%ls"),
-                            aKey,
-                            bstrValue.raw(),
+                            tr("Could not set extra data because someone refused the requested change of '%s' to '%s'%s%ls"),
+                            strKey.c_str(),
+                            strValue.c_str(),
                             sep,
                             err);
         }
@@ -2213,28 +2026,28 @@ STDMETHODIMP VirtualBox::SetExtraData(IN_BSTR aKey,
                 // creates a new key if needed
 
         /* save settings on success */
-        HRESULT rc = saveSettings();
+        rc = i_saveSettings();
         if (FAILED(rc)) return rc;
     }
 
     // fire notification outside the lock
     if (fChanged)
-        onExtraDataChange(Guid::Empty, aKey, aValue);
+        i_onExtraDataChange(Guid::Empty, Bstr(aKey).raw(), Bstr(aValue).raw());
 
-    return S_OK;
+    return rc;
 }
 
 /**
  *
  */
-STDMETHODIMP VirtualBox::SetSettingsSecret(IN_BSTR aValue)
+HRESULT VirtualBox::setSettingsSecret(const com::Utf8Str &aPassword)
 {
-    storeSettingsKey(aValue);
-    decryptSettings();
+    i_storeSettingsKey(aPassword);
+    i_decryptSettings();
     return S_OK;
 }
 
-int VirtualBox::decryptMediumSettings(Medium *pMedium)
+int VirtualBox::i_decryptMediumSettings(Medium *pMedium)
 {
     Bstr bstrCipher;
     HRESULT hrc = pMedium->GetProperty(Bstr("InitiatorSecretEncrypted").raw(),
@@ -2242,9 +2055,9 @@ int VirtualBox::decryptMediumSettings(Medium *pMedium)
     if (SUCCEEDED(hrc))
     {
         Utf8Str strPlaintext;
-        int rc = decryptSetting(&strPlaintext, bstrCipher);
+        int rc = i_decryptSetting(&strPlaintext, bstrCipher);
         if (RT_SUCCESS(rc))
-            pMedium->setPropertyDirect("InitiatorSecret", strPlaintext);
+            pMedium->i_setPropertyDirect("InitiatorSecret", strPlaintext);
         else
             return rc;
     }
@@ -2259,7 +2072,7 @@ int VirtualBox::decryptMediumSettings(Medium *pMedium)
  * 'InitiatorSecretEncrypted. The latter is stored as Base64 because medium
  * properties need to be null-terminated strings.
  */
-int VirtualBox::decryptSettings()
+int VirtualBox::i_decryptSettings()
 {
     bool fFailure = false;
     AutoReadLock al(m->allHardDisks.getLockHandle() COMMA_LOCKVAL_SRC_POS);
@@ -2272,7 +2085,7 @@ int VirtualBox::decryptSettings()
         if (FAILED(medCaller.rc()))
             continue;
         AutoWriteLock mlock(pMedium COMMA_LOCKVAL_SRC_POS);
-        int vrc = decryptMediumSettings(pMedium);
+        int vrc = i_decryptMediumSettings(pMedium);
         if (RT_FAILURE(vrc))
             fFailure = true;
     }
@@ -2285,12 +2098,12 @@ int VirtualBox::decryptSettings()
  * @param aPlaintext      plaintext to be encrypted
  * @param aCiphertext     resulting ciphertext (base64-encoded)
  */
-int VirtualBox::encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext)
+int VirtualBox::i_encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext)
 {
     uint8_t abCiphertext[32];
     char    szCipherBase64[128];
     size_t  cchCipherBase64;
-    int rc = encryptSettingBytes((uint8_t*)aPlaintext.c_str(), abCiphertext,
+    int rc = i_encryptSettingBytes((uint8_t*)aPlaintext.c_str(), abCiphertext,
                                  aPlaintext.length()+1, sizeof(abCiphertext));
     if (RT_SUCCESS(rc))
     {
@@ -2309,7 +2122,7 @@ int VirtualBox::encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext)
  * @param aPlaintext      resulting plaintext
  * @param aCiphertext     ciphertext (base64-encoded) to decrypt
  */
-int VirtualBox::decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext)
+int VirtualBox::i_decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext)
 {
     uint8_t abPlaintext[64];
     uint8_t abCiphertext[64];
@@ -2319,7 +2132,7 @@ int VirtualBox::decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext)
                             &cbCiphertext, NULL);
     if (RT_SUCCESS(rc))
     {
-        rc = decryptSettingBytes(abPlaintext, abCiphertext, cbCiphertext);
+        rc = i_decryptSettingBytes(abPlaintext, abCiphertext, cbCiphertext);
         if (RT_SUCCESS(rc))
         {
             for (unsigned i = 0; i < cbCiphertext; i++)
@@ -2349,7 +2162,7 @@ int VirtualBox::decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext)
  * @param aPlaintextSize  size of the plaintext
  * @param aCiphertextSize size of the ciphertext
  */
-int VirtualBox::encryptSettingBytes(const uint8_t *aPlaintext, uint8_t *aCiphertext,
+int VirtualBox::i_encryptSettingBytes(const uint8_t *aPlaintext, uint8_t *aCiphertext,
                                     size_t aPlaintextSize, size_t aCiphertextSize) const
 {
     unsigned i, j;
@@ -2399,8 +2212,8 @@ int VirtualBox::encryptSettingBytes(const uint8_t *aPlaintext, uint8_t *aCiphert
  * @param aCiphertext     ciphertext to be decrypted
  * @param aCiphertextSize size of the ciphertext == size of the plaintext
  */
-int VirtualBox::decryptSettingBytes(uint8_t *aPlaintext,
-                                    const uint8_t *aCiphertext, size_t aCiphertextSize) const
+int VirtualBox::i_decryptSettingBytes(uint8_t *aPlaintext,
+                                      const uint8_t *aCiphertext, size_t aCiphertextSize) const
 {
     unsigned i, j;
 
@@ -2432,7 +2245,7 @@ int VirtualBox::decryptSettingBytes(uint8_t *aPlaintext,
  *
  * @param aKey          the key to store
  */
-void VirtualBox::storeSettingsKey(const Utf8Str &aKey)
+void VirtualBox::i_storeSettingsKey(const Utf8Str &aKey)
 {
     RTSha512(aKey.c_str(), aKey.length(), m->SettingsCipherKey);
     m->fSettingsCipherKeySet = true;
@@ -2442,7 +2255,7 @@ void VirtualBox::storeSettingsKey(const Utf8Str &aKey)
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef DEBUG
-void VirtualBox::dumpAllBackRefs()
+void VirtualBox::i_dumpAllBackRefs()
 {
     {
         AutoReadLock al(m->allHardDisks.getLockHandle() COMMA_LOCKVAL_SRC_POS);
@@ -2451,7 +2264,7 @@ void VirtualBox::dumpAllBackRefs()
              ++mt)
         {
             ComObjPtr<Medium> pMedium = *mt;
-            pMedium->dumpBackRefs();
+            pMedium->i_dumpBackRefs();
         }
     }
     {
@@ -2461,7 +2274,7 @@ void VirtualBox::dumpAllBackRefs()
              ++mt)
         {
             ComObjPtr<Medium> pMedium = *mt;
-            pMedium->dumpBackRefs();
+            pMedium->i_dumpBackRefs();
         }
     }
 }
@@ -2481,7 +2294,7 @@ void VirtualBox::dumpAllBackRefs()
  *
  *  @note Doesn't lock any object.
  */
-HRESULT VirtualBox::postEvent(Event *event)
+HRESULT VirtualBox::i_postEvent(Event *event)
 {
     AssertReturn(event, E_FAIL);
 
@@ -2489,9 +2302,9 @@ HRESULT VirtualBox::postEvent(Event *event)
     AutoCaller autoCaller(this);
     if (SUCCEEDED((rc = autoCaller.rc())))
     {
-        if (autoCaller.state() != Ready)
+        if (getObjectState().getState() != ObjectState::Ready)
             LogWarningFunc(("VirtualBox has been uninitialized (state=%d), the event is discarded!\n",
-                            autoCaller.state()));
+                            getObjectState().getState()));
             // return S_OK
         else if (    (m->pAsyncEventQ)
                   && (m->pAsyncEventQ->postEvent(event))
@@ -2515,7 +2328,7 @@ HRESULT VirtualBox::postEvent(Event *event)
  *
  * @note Doesn't lock objects.
  */
-HRESULT VirtualBox::addProgress(IProgress *aProgress)
+HRESULT VirtualBox::i_addProgress(IProgress *aProgress)
 {
     CheckComArgNotNull(aProgress);
 
@@ -2541,7 +2354,7 @@ HRESULT VirtualBox::addProgress(IProgress *aProgress)
  *
  * @note Doesn't lock objects.
  */
-HRESULT VirtualBox::removeProgress(IN_GUID aId)
+HRESULT VirtualBox::i_removeProgress(IN_GUID aId)
 {
     AutoCaller autoCaller(this);
     if (FAILED(autoCaller.rc())) return autoCaller.rc();
@@ -2617,9 +2430,9 @@ struct StartSVCHelperClientData
  *
  *  @note Doesn't lock anything.
  */
-HRESULT VirtualBox::startSVCHelperClient(bool aPrivileged,
-                                         SVCHelperClientFunc aFunc,
-                                         void *aUser, Progress *aProgress)
+HRESULT VirtualBox::i_startSVCHelperClient(bool aPrivileged,
+                                           SVCHelperClientFunc aFunc,
+                                           void *aUser, Progress *aProgress)
 {
     AssertReturn(aFunc, E_POINTER);
     AssertReturn(aProgress, E_POINTER);
@@ -2789,7 +2602,7 @@ VirtualBox::SVCHelperClientThread(RTTHREAD aThread, void *aUser)
         d->func(NULL, NULL, d->user, NULL);
     }
 
-    d->progress->notifyComplete(rc);
+    d->progress->i_notifyComplete(rc);
 
     LogFlowFuncLeave();
     return 0;
@@ -2803,7 +2616,7 @@ VirtualBox::SVCHelperClientThread(RTTHREAD aThread, void *aUser)
  *
  *  @note Doesn't lock anything.
  */
-void VirtualBox::updateClientWatcher()
+void VirtualBox::i_updateClientWatcher()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -2818,7 +2631,7 @@ void VirtualBox::updateClientWatcher()
  *
  *  @note Doesn't lock anything.
  */
-void VirtualBox::addProcessToReap(RTPROCESS pid)
+void VirtualBox::i_addProcessToReap(RTPROCESS pid)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -2871,41 +2684,41 @@ struct MachineEvent : public VirtualBox::CallbackEvent
 /**
  * VD plugin load
  */
-int VirtualBox::loadVDPlugin(const char *pszPluginLibrary)
+int VirtualBox::i_loadVDPlugin(const char *pszPluginLibrary)
 {
-    return m->pSystemProperties->loadVDPlugin(pszPluginLibrary);
+    return m->pSystemProperties->i_loadVDPlugin(pszPluginLibrary);
 }
 
 /**
  * VD plugin unload
  */
-int VirtualBox::unloadVDPlugin(const char *pszPluginLibrary)
+int VirtualBox::i_unloadVDPlugin(const char *pszPluginLibrary)
 {
-    return m->pSystemProperties->unloadVDPlugin(pszPluginLibrary);
+    return m->pSystemProperties->i_unloadVDPlugin(pszPluginLibrary);
 }
 
 
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onMachineStateChange(const Guid &aId, MachineState_T aState)
+void VirtualBox::i_onMachineStateChange(const Guid &aId, MachineState_T aState)
 {
-    postEvent(new MachineEvent(this, VBoxEventType_OnMachineStateChanged, aId, aState));
+    i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineStateChanged, aId, aState));
 }
 
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onMachineDataChange(const Guid &aId, BOOL aTemporary)
+void VirtualBox::i_onMachineDataChange(const Guid &aId, BOOL aTemporary)
 {
-    postEvent(new MachineEvent(this, VBoxEventType_OnMachineDataChanged, aId, aTemporary));
+    i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineDataChanged, aId, aTemporary));
 }
 
 /**
  *  @note Locks this object for reading.
  */
-BOOL VirtualBox::onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue,
-                                       Bstr &aError)
+BOOL VirtualBox::i_onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue,
+                                        Bstr &aError)
 {
     LogFlowThisFunc(("machine={%s} aKey={%ls} aValue={%ls}\n",
                       aId.toString().c_str(), aKey, aValue));
@@ -2965,17 +2778,17 @@ struct ExtraDataEvent : public VirtualBox::CallbackEvent
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onExtraDataChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue)
+void VirtualBox::i_onExtraDataChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue)
 {
-    postEvent(new ExtraDataEvent(this, aId, aKey, aValue));
+    i_postEvent(new ExtraDataEvent(this, aId, aKey, aValue));
 }
 
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onMachineRegistered(const Guid &aId, BOOL aRegistered)
+void VirtualBox::i_onMachineRegistered(const Guid &aId, BOOL aRegistered)
 {
-    postEvent(new MachineEvent(this, VBoxEventType_OnMachineRegistered, aId, aRegistered));
+    i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineRegistered, aId, aRegistered));
 }
 
 /** Event for onSessionStateChange() */
@@ -2997,12 +2810,12 @@ struct SessionEvent : public VirtualBox::CallbackEvent
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onSessionStateChange(const Guid &aId, SessionState_T aState)
+void VirtualBox::i_onSessionStateChange(const Guid &aId, SessionState_T aState)
 {
-    postEvent(new SessionEvent(this, aId, aState));
+    i_postEvent(new SessionEvent(this, aId, aState));
 }
 
-/** Event for onSnapshotTaken(), onSnapshotDeleted() and onSnapshotChange() */
+/** Event for i_onSnapshotTaken(), i_onSnapshotDeleted(), i_onSnapshotRestored() and i_onSnapshotChange() */
 struct SnapshotEvent : public VirtualBox::CallbackEvent
 {
     SnapshotEvent(VirtualBox *aVB, const Guid &aMachineId, const Guid &aSnapshotId,
@@ -3024,28 +2837,37 @@ struct SnapshotEvent : public VirtualBox::CallbackEvent
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId)
+void VirtualBox::i_onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId)
+{
+    i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
+                                  VBoxEventType_OnSnapshotTaken));
+}
+
+/**
+ *  @note Doesn't lock any object.
+ */
+void VirtualBox::i_onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId)
 {
-    postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
-                                VBoxEventType_OnSnapshotTaken));
+    i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
+                                  VBoxEventType_OnSnapshotDeleted));
 }
 
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId)
+void VirtualBox::i_onSnapshotRestored(const Guid &aMachineId, const Guid &aSnapshotId)
 {
-    postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
-                                VBoxEventType_OnSnapshotDeleted));
+    i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
+                                  VBoxEventType_OnSnapshotRestored));
 }
 
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId)
+void VirtualBox::i_onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId)
 {
-    postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
-                                VBoxEventType_OnSnapshotChanged));
+    i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
+                                  VBoxEventType_OnSnapshotChanged));
 }
 
 /** Event for onGuestPropertyChange() */
@@ -3073,46 +2895,47 @@ struct GuestPropertyEvent : public VirtualBox::CallbackEvent
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName,
-                                       IN_BSTR aValue, IN_BSTR aFlags)
+void VirtualBox::i_onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName,
+                                         IN_BSTR aValue, IN_BSTR aFlags)
 {
-    postEvent(new GuestPropertyEvent(this, aMachineId, aName, aValue, aFlags));
+    i_postEvent(new GuestPropertyEvent(this, aMachineId, aName, aValue, aFlags));
 }
 
 /**
  *  @note Doesn't lock any object.
  */
-void VirtualBox::onNatRedirectChange(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName,
-                               NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort,
-                               IN_BSTR aGuestIp, uint16_t aGuestPort)
+void VirtualBox::i_onNatRedirectChange(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName,
+                                       NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort,
+                                       IN_BSTR aGuestIp, uint16_t aGuestPort)
 {
     fireNATRedirectEvent(m->pEventSource, aMachineId.toUtf16().raw(), ulSlot, fRemove, aName, aProto, aHostIp,
                          aHostPort, aGuestIp, aGuestPort);
 }
 
-void VirtualBox::onNATNetworkChange(IN_BSTR aName)
+void VirtualBox::i_onNATNetworkChange(IN_BSTR aName)
 {
     fireNATNetworkChangedEvent(m->pEventSource, aName);
 }
 
-void VirtualBox::onNATNetworkStartStop(IN_BSTR aName, BOOL fStart)
+void VirtualBox::i_onNATNetworkStartStop(IN_BSTR aName, BOOL fStart)
 {
     fireNATNetworkStartStopEvent(m->pEventSource, aName, fStart);
 }
-void VirtualBox::onNATNetworkSetting(IN_BSTR aNetworkName, BOOL aEnabled,
-                                     IN_BSTR aNetwork, IN_BSTR aGateway,
-                                     BOOL aAdvertiseDefaultIpv6RouteEnabled,
-                                     BOOL fNeedDhcpServer)
+
+void VirtualBox::i_onNATNetworkSetting(IN_BSTR aNetworkName, BOOL aEnabled,
+                                       IN_BSTR aNetwork, IN_BSTR aGateway,
+                                       BOOL aAdvertiseDefaultIpv6RouteEnabled,
+                                       BOOL fNeedDhcpServer)
 {
     fireNATNetworkSettingEvent(m->pEventSource, aNetworkName, aEnabled,
                                aNetwork, aGateway,
                                aAdvertiseDefaultIpv6RouteEnabled, fNeedDhcpServer);
 }
 
-void VirtualBox::onNATNetworkPortForward(IN_BSTR aNetworkName, BOOL create, BOOL fIpv6,
-                                         IN_BSTR aRuleName, NATProtocol_T proto,
-                                         IN_BSTR aHostIp, LONG aHostPort,
-                                         IN_BSTR aGuestIp, LONG aGuestPort)
+void VirtualBox::i_onNATNetworkPortForward(IN_BSTR aNetworkName, BOOL create, BOOL fIpv6,
+                                           IN_BSTR aRuleName, NATProtocol_T proto,
+                                           IN_BSTR aHostIp, LONG aHostPort,
+                                           IN_BSTR aGuestIp, LONG aGuestPort)
 {
     fireNATNetworkPortForwardEvent(m->pEventSource, aNetworkName, create,
                                    fIpv6, aRuleName, proto,
@@ -3121,14 +2944,14 @@ void VirtualBox::onNATNetworkPortForward(IN_BSTR aNetworkName, BOOL create, BOOL
 }
 
 
-void VirtualBox::onHostNameResolutionConfigurationChange()
+void VirtualBox::i_onHostNameResolutionConfigurationChange()
 {
     if (m->pEventSource)
         fireHostNameResolutionConfigurationChangeEvent(m->pEventSource);
 }
 
 
-int VirtualBox::natNetworkRefInc(IN_BSTR aNetworkName)
+int VirtualBox::i_natNetworkRefInc(IN_BSTR aNetworkName)
 {
     AutoWriteLock safeLock(*spMtxNatNetworkNameToRefCountLock COMMA_LOCKVAL_SRC_POS);
     Bstr name(aNetworkName);
@@ -3153,7 +2976,7 @@ int VirtualBox::natNetworkRefInc(IN_BSTR aNetworkName)
 }
 
 
-int VirtualBox::natNetworkRefDec(IN_BSTR aNetworkName)
+int VirtualBox::i_natNetworkRefDec(IN_BSTR aNetworkName)
 {
     AutoWriteLock safeLock(*spMtxNatNetworkNameToRefCountLock COMMA_LOCKVAL_SRC_POS);
     Bstr name(aNetworkName);
@@ -3182,13 +3005,11 @@ int VirtualBox::natNetworkRefDec(IN_BSTR aNetworkName)
 
 
 /**
- *  @note Locks this object for reading.
+ *  @note Locks the list of other objects for reading.
  */
-ComObjPtr<GuestOSType> VirtualBox::getUnknownOSType()
+ComObjPtr<GuestOSType> VirtualBox::i_getUnknownOSType()
 {
     ComObjPtr<GuestOSType> type;
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), type);
 
     /* unknown type must always be the first */
     ComAssertRet(m->allGuestOSTypes.size() > 0, type);
@@ -3212,8 +3033,8 @@ ComObjPtr<GuestOSType> VirtualBox::getUnknownOSType()
  *
  * @note Locks objects for reading.
  */
-void VirtualBox::getOpenedMachines(SessionMachinesList &aMachines,
-                                   InternalControlList *aControls /*= NULL*/)
+void VirtualBox::i_getOpenedMachines(SessionMachinesList &aMachines,
+                                     InternalControlList *aControls /*= NULL*/)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -3230,7 +3051,7 @@ void VirtualBox::getOpenedMachines(SessionMachinesList &aMachines,
     {
         ComObjPtr<SessionMachine> sm;
         ComPtr<IInternalSessionControl> ctl;
-        if ((*it)->isSessionOpen(sm, &ctl))
+        if ((*it)->i_isSessionOpen(sm, &ctl))
         {
             aMachines.push_back(sm);
             if (aControls)
@@ -3247,7 +3068,7 @@ void VirtualBox::getOpenedMachines(SessionMachinesList &aMachines,
  *
  * @note Caller must hold the VirtualBox object lock at least for reading.
  */
-VirtualBox::MachinesOList &VirtualBox::getMachinesList(void)
+VirtualBox::MachinesOList &VirtualBox::i_getMachinesList(void)
 {
     return m->allMachines;
 }
@@ -3263,10 +3084,10 @@ VirtualBox::MachinesOList &VirtualBox::getMachinesList(void)
  * @param aMachine Returned machine, if found.
  * @return
  */
-HRESULT VirtualBox::findMachine(const Guid &aId,
-                                bool fPermitInaccessible,
-                                bool aSetError,
-                                ComObjPtr<Machine> *aMachine /* = NULL */)
+HRESULT VirtualBox::i_findMachine(const Guid &aId,
+                                  bool fPermitInaccessible,
+                                  bool aSetError,
+                                  ComObjPtr<Machine> *aMachine /* = NULL */)
 {
     HRESULT rc = VBOX_E_OBJECT_NOT_FOUND;
 
@@ -3290,7 +3111,7 @@ HRESULT VirtualBox::findMachine(const Guid &aId,
                     continue;
             }
 
-            if (pMachine->getId() == aId)
+            if (pMachine->i_getId() == aId)
             {
                 rc = S_OK;
                 if (aMachine)
@@ -3317,8 +3138,9 @@ HRESULT VirtualBox::findMachine(const Guid &aId,
  * @param aMachine Returned machine, if found.
  * @return
  */
-HRESULT VirtualBox::findMachineByName(const Utf8Str &aName, bool aSetError,
-                                      ComObjPtr<Machine> *aMachine /* = NULL */)
+HRESULT VirtualBox::i_findMachineByName(const Utf8Str &aName,
+                                        bool  aSetError,
+                                        ComObjPtr<Machine> *aMachine /* = NULL */)
 {
     HRESULT rc = VBOX_E_OBJECT_NOT_FOUND;
 
@@ -3333,14 +3155,14 @@ HRESULT VirtualBox::findMachineByName(const Utf8Str &aName, bool aSetError,
             continue;       // we can't ask inaccessible machines for their names
 
         AutoReadLock machLock(pMachine COMMA_LOCKVAL_SRC_POS);
-        if (pMachine->getName() == aName)
+        if (pMachine->i_getName() == aName)
         {
             rc = S_OK;
             if (aMachine)
                 *aMachine = pMachine;
             break;
         }
-        if (!RTPathCompare(pMachine->getSettingsFileFull().c_str(), aName.c_str()))
+        if (!RTPathCompare(pMachine->i_getSettingsFileFull().c_str(), aName.c_str()))
         {
             rc = S_OK;
             if (aMachine)
@@ -3356,7 +3178,7 @@ HRESULT VirtualBox::findMachineByName(const Utf8Str &aName, bool aSetError,
     return rc;
 }
 
-static HRESULT validateMachineGroupHelper(const Utf8Str &aGroup, bool fPrimary, VirtualBox *pVirtualBox)
+static HRESULT i_validateMachineGroupHelper(const Utf8Str &aGroup, bool fPrimary, VirtualBox *pVirtualBox)
 {
     /* empty strings are invalid */
     if (aGroup.isEmpty())
@@ -3392,8 +3214,8 @@ static HRESULT validateMachineGroupHelper(const Utf8Str &aGroup, bool fPrimary,
                 return E_INVALIDARG;
             if (fPrimary)
             {
-                HRESULT rc = pVirtualBox->findMachineByName(tmp,
-                                                            false /* aSetError */);
+                HRESULT rc = pVirtualBox->i_findMachineByName(tmp,
+                                                              false /* aSetError */);
                 if (SUCCEEDED(rc))
                     return VBOX_E_VM_ERROR;
             }
@@ -3422,9 +3244,9 @@ static HRESULT validateMachineGroupHelper(const Utf8Str &aGroup, bool fPrimary,
  *
  * @return S_OK or E_INVALIDARG
  */
-HRESULT VirtualBox::validateMachineGroup(const Utf8Str &aGroup, bool fPrimary)
+HRESULT VirtualBox::i_validateMachineGroup(const Utf8Str &aGroup, bool fPrimary)
 {
-    HRESULT rc = validateMachineGroupHelper(aGroup, fPrimary, this);
+    HRESULT rc = i_validateMachineGroupHelper(aGroup, fPrimary, this);
     if (FAILED(rc))
     {
         if (rc == VBOX_E_VM_ERROR)
@@ -3442,24 +3264,23 @@ HRESULT VirtualBox::validateMachineGroup(const Utf8Str &aGroup, bool fPrimary)
 /**
  * Takes a list of machine groups, and sanitizes/validates it.
  *
- * @param aMachineGroups    Safearray with the machine groups.
+ * @param aMachineGroups    Array with the machine groups.
  * @param pllMachineGroups  Pointer to list of strings for the result.
  *
  * @return S_OK or E_INVALIDARG
  */
-HRESULT VirtualBox::convertMachineGroups(ComSafeArrayIn(IN_BSTR, aMachineGroups), StringsList *pllMachineGroups)
+HRESULT VirtualBox::i_convertMachineGroups(const std::vector<com::Utf8Str> aMachineGroups, StringsList *pllMachineGroups)
 {
     pllMachineGroups->clear();
-    if (aMachineGroups)
+    if (aMachineGroups.size())
     {
-        com::SafeArray<IN_BSTR> machineGroups(ComSafeArrayInArg(aMachineGroups));
-        for (size_t i = 0; i < machineGroups.size(); i++)
+        for (size_t i = 0; i < aMachineGroups.size(); i++)
         {
-            Utf8Str group(machineGroups[i]);
+            Utf8Str group(aMachineGroups[i]);
             if (group.length() == 0)
                 group = "/";
 
-            HRESULT rc = validateMachineGroup(group, i == 0);
+            HRESULT rc = i_validateMachineGroup(group, i == 0);
             if (FAILED(rc))
                 return rc;
 
@@ -3490,9 +3311,9 @@ HRESULT VirtualBox::convertMachineGroups(ComSafeArrayIn(IN_BSTR, aMachineGroups)
  *
  * @note Locks the media tree for reading.
  */
-HRESULT VirtualBox::findHardDiskById(const Guid &id,
-                                     bool aSetError,
-                                     ComObjPtr<Medium> *aHardDisk /*= NULL*/)
+HRESULT VirtualBox::i_findHardDiskById(const Guid &id,
+                                       bool aSetError,
+                                       ComObjPtr<Medium> *aHardDisk /*= NULL*/)
 {
     AssertReturn(!id.isZero(), E_INVALIDARG);
 
@@ -3530,9 +3351,9 @@ HRESULT VirtualBox::findHardDiskById(const Guid &id,
  *
  * @note Locks the media tree for reading.
  */
-HRESULT VirtualBox::findHardDiskByLocation(const Utf8Str &strLocation,
-                                           bool aSetError,
-                                           ComObjPtr<Medium> *aHardDisk /*= NULL*/)
+HRESULT VirtualBox::i_findHardDiskByLocation(const Utf8Str &strLocation,
+                                             bool aSetError,
+                                             ComObjPtr<Medium> *aHardDisk /*= NULL*/)
 {
     AssertReturn(!strLocation.isEmpty(), E_INVALIDARG);
 
@@ -3550,7 +3371,7 @@ HRESULT VirtualBox::findHardDiskByLocation(const Utf8Str &strLocation,
         if (FAILED(autoCaller.rc())) return autoCaller.rc();
         AutoWriteLock mlock(pHD COMMA_LOCKVAL_SRC_POS);
 
-        Utf8Str strLocationFull = pHD->getLocationFull();
+        Utf8Str strLocationFull = pHD->i_getLocationFull();
 
         if (0 == RTPathCompare(strLocationFull.c_str(), strLocation.c_str()))
         {
@@ -3585,18 +3406,18 @@ HRESULT VirtualBox::findHardDiskByLocation(const Utf8Str &strLocation,
  *
  * @note Locks the media tree for reading.
  */
-HRESULT VirtualBox::findDVDOrFloppyImage(DeviceType_T mediumType,
-                                         const Guid *aId,
-                                         const Utf8Str &aLocation,
-                                         bool aSetError,
-                                         ComObjPtr<Medium> *aImage /* = NULL */)
+HRESULT VirtualBox::i_findDVDOrFloppyImage(DeviceType_T mediumType,
+                                           const Guid *aId,
+                                           const Utf8Str &aLocation,
+                                           bool aSetError,
+                                           ComObjPtr<Medium> *aImage /* = NULL */)
 {
     AssertReturn(aId || !aLocation.isEmpty(), E_INVALIDARG);
 
     Utf8Str location;
     if (!aLocation.isEmpty())
     {
-        int vrc = calculateFullPath(aLocation, location);
+        int vrc = i_calculateFullPath(aLocation, location);
         if (RT_FAILURE(vrc))
             return setError(VBOX_E_FILE_ERROR,
                             tr("Invalid image file location '%s' (%Rrc)"),
@@ -3631,16 +3452,16 @@ HRESULT VirtualBox::findDVDOrFloppyImage(DeviceType_T mediumType,
         // no AutoCaller, registered image life time is bound to this
         Medium *pMedium = *it;
         AutoReadLock imageLock(pMedium COMMA_LOCKVAL_SRC_POS);
-        const Utf8Str &strLocationFull = pMedium->getLocationFull();
+        const Utf8Str &strLocationFull = pMedium->i_getLocationFull();
 
         found =     (    aId
-                      && pMedium->getId() == *aId)
+                      && pMedium->i_getId() == *aId)
                  || (    !aLocation.isEmpty()
                       && RTPathCompare(location.c_str(),
                                        strLocationFull.c_str()) == 0);
         if (found)
         {
-            if (pMedium->getDeviceType() != mediumType)
+            if (pMedium->i_getDeviceType() != mediumType)
             {
                 if (mediumType == DeviceType_DVD)
                     return setError(E_INVALIDARG,
@@ -3695,11 +3516,11 @@ HRESULT VirtualBox::findDVDOrFloppyImage(DeviceType_T mediumType,
  * @param pMedium out: IMedium object found.
  * @return
  */
-HRESULT VirtualBox::findRemoveableMedium(DeviceType_T mediumType,
-                                         const Guid &uuid,
-                                         bool fRefresh,
-                                         bool aSetError,
-                                         ComObjPtr<Medium> &pMedium)
+HRESULT VirtualBox::i_findRemoveableMedium(DeviceType_T mediumType,
+                                           const Guid &uuid,
+                                           bool fRefresh,
+                                           bool aSetError,
+                                           ComObjPtr<Medium> &pMedium)
 {
     if (uuid.isZero())
     {
@@ -3711,24 +3532,24 @@ HRESULT VirtualBox::findRemoveableMedium(DeviceType_T mediumType,
     {
         /* handling of case invalid GUID */
         return setError(VBOX_E_OBJECT_NOT_FOUND,
-                            tr("Guid '%ls' is invalid"),
+                            tr("Guid '%s' is invalid"),
                             uuid.toString().c_str());
     }
 
     // first search for host drive with that UUID
-    HRESULT rc = m->pHost->findHostDriveById(mediumType,
-                                             uuid,
-                                             fRefresh,
-                                             pMedium);
+    HRESULT rc = m->pHost->i_findHostDriveById(mediumType,
+                                               uuid,
+                                               fRefresh,
+                                               pMedium);
     if (rc == VBOX_E_OBJECT_NOT_FOUND)
                 // then search for an image with that UUID
-        rc = findDVDOrFloppyImage(mediumType, &uuid, Utf8Str::Empty, aSetError, &pMedium);
+        rc = i_findDVDOrFloppyImage(mediumType, &uuid, Utf8Str::Empty, aSetError, &pMedium);
 
     return rc;
 }
 
-HRESULT VirtualBox::findGuestOSType(const Bstr &bstrOSType,
-                                    GuestOSType*& pGuestOSType)
+HRESULT VirtualBox::i_findGuestOSType(const Bstr &bstrOSType,
+                                      GuestOSType*& pGuestOSType)
 {
     /* Look for a GuestOSType object */
     AssertMsg(m->allGuestOSTypes.size() != 0,
@@ -3745,7 +3566,7 @@ HRESULT VirtualBox::findGuestOSType(const Bstr &bstrOSType,
          it != m->allGuestOSTypes.end();
          ++it)
     {
-        if ((*it)->id() == bstrOSType)
+        if ((*it)->i_id() == bstrOSType)
         {
             pGuestOSType = *it;
             return S_OK;
@@ -3770,17 +3591,17 @@ HRESULT VirtualBox::findGuestOSType(const Bstr &bstrOSType,
  *
  * @return
  */
-const Guid& VirtualBox::getGlobalRegistryId() const
+const Guid& VirtualBox::i_getGlobalRegistryId() const
 {
     return m->uuidMediaRegistry;
 }
 
-const ComObjPtr<Host>& VirtualBox::host() const
+const ComObjPtr<Host>& VirtualBox::i_host() const
 {
     return m->pHost;
 }
 
-SystemProperties* VirtualBox::getSystemProperties() const
+SystemProperties* VirtualBox::i_getSystemProperties() const
 {
     return m->pSystemProperties;
 }
@@ -3790,7 +3611,7 @@ SystemProperties* VirtualBox::getSystemProperties() const
  * Getter that SystemProperties and others can use to talk to the extension
  * pack manager.
  */
-ExtPackManager* VirtualBox::getExtPackManager() const
+ExtPackManager* VirtualBox::i_getExtPackManager() const
 {
     return m->ptrExtPackManager;
 }
@@ -3799,13 +3620,13 @@ ExtPackManager* VirtualBox::getExtPackManager() const
 /**
  * Getter that machines can talk to the autostart database.
  */
-AutostartDb* VirtualBox::getAutostartDb() const
+AutostartDb* VirtualBox::i_getAutostartDb() const
 {
     return m->pAutostartDb;
 }
 
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
-const ComObjPtr<PerformanceCollector>& VirtualBox::performanceCollector() const
+const ComObjPtr<PerformanceCollector>& VirtualBox::i_performanceCollector() const
 {
     return m->pPerformanceCollector;
 }
@@ -3816,7 +3637,7 @@ const ComObjPtr<PerformanceCollector>& VirtualBox::performanceCollector() const
  * with proper locking.
  * @return
  */
-void VirtualBox::getDefaultMachineFolder(Utf8Str &str) const
+void VirtualBox::i_getDefaultMachineFolder(Utf8Str &str) const
 {
     AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS);
     str = m->pSystemProperties->m->strDefaultMachineFolder;
@@ -3827,13 +3648,13 @@ void VirtualBox::getDefaultMachineFolder(Utf8Str &str) const
  * with proper locking.
  * @return
  */
-void VirtualBox::getDefaultHardDiskFormat(Utf8Str &str) const
+void VirtualBox::i_getDefaultHardDiskFormat(Utf8Str &str) const
 {
     AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS);
     str = m->pSystemProperties->m->strDefaultHardDiskFormat;
 }
 
-const Utf8Str& VirtualBox::homeDir() const
+const Utf8Str& VirtualBox::i_homeDir() const
 {
     return m->strHomeDir;
 }
@@ -3849,7 +3670,7 @@ const Utf8Str& VirtualBox::homeDir() const
  *
  * @note Doesn't lock any object.
  */
-int VirtualBox::calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult)
+int VirtualBox::i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), VERR_GENERAL_FAILURE);
@@ -3874,8 +3695,8 @@ int VirtualBox::calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult)
  * @param strSource Path to evalue and copy.
  * @param strTarget Buffer to receive target path.
  */
-void VirtualBox::copyPathRelativeToConfig(const Utf8Str &strSource,
-                                          Utf8Str &strTarget)
+void VirtualBox::i_copyPathRelativeToConfig(const Utf8Str &strSource,
+                                            Utf8Str &strTarget)
 {
     AutoCaller autoCaller(this);
     AssertComRCReturnVoid(autoCaller.rc());
@@ -3910,10 +3731,10 @@ void VirtualBox::copyPathRelativeToConfig(const Utf8Str &strSource,
  *
  * @note Locks the media tree and media objects for reading.
  */
-HRESULT VirtualBox::checkMediaForConflicts(const Guid &aId,
-                                           const Utf8Str &aLocation,
-                                           Utf8Str &aConflict,
-                                           ComObjPtr<Medium> *ppMedium)
+HRESULT VirtualBox::i_checkMediaForConflicts(const Guid &aId,
+                                             const Utf8Str &aLocation,
+                                             Utf8Str &aConflict,
+                                             ComObjPtr<Medium> *ppMedium)
 {
     AssertReturn(!aId.isZero() && !aLocation.isEmpty(), E_FAIL);
     AssertReturn(ppMedium, E_INVALIDARG);
@@ -3921,7 +3742,7 @@ HRESULT VirtualBox::checkMediaForConflicts(const Guid &aId,
     aConflict.setNull();
     ppMedium->setNull();
 
-    AutoReadLock alock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoReadLock alock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
 
@@ -3929,22 +3750,22 @@ HRESULT VirtualBox::checkMediaForConflicts(const Guid &aId,
     const char *pcszType = NULL;
 
     if (aId.isValid() && !aId.isZero())
-        rc = findHardDiskById(aId, false /* aSetError */, &pMediumFound);
+        rc = i_findHardDiskById(aId, false /* aSetError */, &pMediumFound);
     if (FAILED(rc) && !aLocation.isEmpty())
-        rc = findHardDiskByLocation(aLocation, false /* aSetError */, &pMediumFound);
+        rc = i_findHardDiskByLocation(aLocation, false /* aSetError */, &pMediumFound);
     if (SUCCEEDED(rc))
         pcszType = tr("hard disk");
 
     if (!pcszType)
     {
-        rc = findDVDOrFloppyImage(DeviceType_DVD, &aId, aLocation, false /* aSetError */, &pMediumFound);
+        rc = i_findDVDOrFloppyImage(DeviceType_DVD, &aId, aLocation, false /* aSetError */, &pMediumFound);
         if (SUCCEEDED(rc))
             pcszType = tr("CD/DVD image");
     }
 
     if (!pcszType)
     {
-        rc = findDVDOrFloppyImage(DeviceType_Floppy, &aId, aLocation, false /* aSetError */, &pMediumFound);
+        rc = i_findDVDOrFloppyImage(DeviceType_Floppy, &aId, aLocation, false /* aSetError */, &pMediumFound);
         if (SUCCEEDED(rc))
             pcszType = tr("floppy image");
     }
@@ -3954,8 +3775,8 @@ HRESULT VirtualBox::checkMediaForConflicts(const Guid &aId,
         /* Note: no AutoCaller since bound to this */
         AutoReadLock mlock(pMediumFound COMMA_LOCKVAL_SRC_POS);
 
-        Utf8Str strLocFound = pMediumFound->getLocationFull();
-        Guid idFound = pMediumFound->getId();
+        Utf8Str strLocFound = pMediumFound->i_getLocationFull();
+        Guid idFound = pMediumFound->i_getId();
 
         if (    (RTPathCompare(strLocFound.c_str(), aLocation.c_str()) == 0)
              && (idFound == aId)
@@ -3981,12 +3802,12 @@ HRESULT VirtualBox::checkMediaForConflicts(const Guid &aId,
  * @param   deviceType    The device type the UUID is going to be checked for
  *                        conflicts.
  */
-bool VirtualBox::isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType)
+bool VirtualBox::i_isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType)
 {
     /* A zero UUID is invalid here, always claim that it is already used. */
     AssertReturn(!aId.isZero(), true);
 
-    AutoReadLock alock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoReadLock alock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     HRESULT rc = S_OK;
     bool fInUse = false;
@@ -3996,13 +3817,13 @@ bool VirtualBox::isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType)
     switch (deviceType)
     {
         case DeviceType_HardDisk:
-            rc = findHardDiskById(aId, false /* aSetError */, &pMediumFound);
+            rc = i_findHardDiskById(aId, false /* aSetError */, &pMediumFound);
             break;
         case DeviceType_DVD:
-            rc = findDVDOrFloppyImage(DeviceType_DVD, &aId, Utf8Str::Empty, false /* aSetError */, &pMediumFound);
+            rc = i_findDVDOrFloppyImage(DeviceType_DVD, &aId, Utf8Str::Empty, false /* aSetError */, &pMediumFound);
             break;
         case DeviceType_Floppy:
-            rc = findDVDOrFloppyImage(DeviceType_Floppy, &aId, Utf8Str::Empty, false /* aSetError */, &pMediumFound);
+            rc = i_findDVDOrFloppyImage(DeviceType_Floppy, &aId, Utf8Str::Empty, false /* aSetError */, &pMediumFound);
             break;
         default:
             AssertMsgFailed(("Invalid device type %d\n", deviceType));
@@ -4028,10 +3849,10 @@ bool VirtualBox::isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType)
  * such pending name changes with this method so that
  * VirtualBox::saveSettings() can process them properly.
  */
-void VirtualBox::rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir,
-                                                   const Utf8Str &strNewConfigDir)
+void VirtualBox::i_rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir,
+                                                     const Utf8Str &strNewConfigDir)
 {
-    AutoWriteLock mediaLock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock mediaLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     Data::PendingMachineRename pmr;
     pmr.strConfigDirOld = strOldConfigDir;
@@ -4060,10 +3881,10 @@ static int fntSaveMediaRegistries(RTTHREAD ThreadSelf, void *pvUser)
          ++it)
     {
         Medium *pMedium = *it;
-        pMedium->markRegistriesModified();
+        pMedium->i_markRegistriesModified();
     }
 
-    pDesc->pVirtualBox->saveModifiedRegistries();
+    pDesc->pVirtualBox->i_saveModifiedRegistries();
 
     pDesc->llMedia.clear();
     pDesc->pVirtualBox.setNull();
@@ -4098,16 +3919,17 @@ static int fntSaveMediaRegistries(RTTHREAD ThreadSelf, void *pvUser)
  * This locks the media tree. Throws HRESULT on errors!
  *
  * @param mediaRegistry Settings structure to fill.
- * @param uuidRegistry The UUID of the media registry; either a machine UUID (if machine registry) or the UUID of the global registry.
+ * @param uuidRegistry The UUID of the media registry; either a machine UUID
+ *        (if machine registry) or the UUID of the global registry.
  * @param strMachineFolder The machine folder for relative paths, if machine registry, or an empty string otherwise.
  */
-void VirtualBox::saveMediaRegistry(settings::MediaRegistry &mediaRegistry,
-                                   const Guid &uuidRegistry,
-                                   const Utf8Str &strMachineFolder)
+void VirtualBox::i_saveMediaRegistry(settings::MediaRegistry &mediaRegistry,
+                                     const Guid &uuidRegistry,
+                                     const Utf8Str &strMachineFolder)
 {
     // lock all media for the following; use a write lock because we're
     // modifying the PendingMachineRenamesList, which is protected by this
-    AutoWriteLock mediaLock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock mediaLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
     // if a machine was renamed, then we'll need to refresh media paths
     if (m->llPendingMachineRenames.size())
@@ -4133,8 +3955,8 @@ void VirtualBox::saveMediaRegistry(settings::MediaRegistry &mediaRegistry,
                  ++it2)
             {
                 const Data::PendingMachineRename &pmr = *it2;
-                HRESULT rc = pMedium->updatePath(pmr.strConfigDirOld,
-                                                 pmr.strConfigDirNew);
+                HRESULT rc = pMedium->i_updatePath(pmr.strConfigDirOld,
+                                                   pmr.strConfigDirNew);
                 if (SUCCEEDED(rc))
                 {
                     // Remember which medium objects has been changed,
@@ -4205,12 +4027,15 @@ void VirtualBox::saveMediaRegistry(settings::MediaRegistry &mediaRegistry,
             if (FAILED(autoCaller.rc())) throw autoCaller.rc();
             AutoReadLock mlock(pMedium COMMA_LOCKVAL_SRC_POS);
 
-            if (pMedium->isInRegistry(uuidRegistry))
+            if (pMedium->i_isInRegistry(uuidRegistry))
             {
-                settings::Medium med;
-                rc = pMedium->saveSettings(med, strMachineFolder);     // this recurses into child hard disks
-                if (FAILED(rc)) throw rc;
-                llTarget.push_back(med);
+                llTarget.push_back(settings::g_MediumEmpty);
+                rc = pMedium->i_saveSettings(llTarget.back(), strMachineFolder);     // this recurses into child hard disks
+                if (FAILED(rc))
+                {
+                    llTarget.pop_back();
+                    throw rc;
+                }
             }
         }
     }
@@ -4225,7 +4050,7 @@ void VirtualBox::saveMediaRegistry(settings::MediaRegistry &mediaRegistry,
  *    other locks since this locks all kinds of member objects and trees temporarily,
  *    which could cause conflicts.
  */
-HRESULT VirtualBox::saveSettings()
+HRESULT VirtualBox::i_saveSettings()
 {
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
@@ -4248,14 +4073,14 @@ HRESULT VirtualBox::saveSettings()
                 Machine *pMachine = *it;
                 // save actual machine registry entry
                 settings::MachineRegistryEntry mre;
-                rc = pMachine->saveRegistryEntry(mre);
+                rc = pMachine->i_saveRegistryEntry(mre);
                 m->pMainConfigFile->llMachines.push_back(mre);
             }
         }
 
-        saveMediaRegistry(m->pMainConfigFile->mediaRegistry,
-                          m->uuidMediaRegistry,         // global media registry ID
-                          Utf8Str::Empty);              // strMachineFolder
+        i_saveMediaRegistry(m->pMainConfigFile->mediaRegistry,
+                            m->uuidMediaRegistry,         // global media registry ID
+                            Utf8Str::Empty);              // strMachineFolder
 
         m->pMainConfigFile->llDhcpServers.clear();
         {
@@ -4265,7 +4090,7 @@ HRESULT VirtualBox::saveSettings()
                  ++it)
             {
                 settings::DHCPServer d;
-                rc = (*it)->saveSettings(d);
+                rc = (*it)->i_saveSettings(d);
                 if (FAILED(rc)) throw rc;
                 m->pMainConfigFile->llDhcpServers.push_back(d);
             }
@@ -4281,7 +4106,7 @@ HRESULT VirtualBox::saveSettings()
                  ++it)
             {
                 settings::NATNetwork n;
-                rc = (*it)->saveSettings(n);
+                rc = (*it)->i_saveSettings(n);
                 if (FAILED(rc)) throw rc;
                 m->pMainConfigFile->llNATNetworks.push_back(n);
             }
@@ -4291,10 +4116,10 @@ HRESULT VirtualBox::saveSettings()
         // leave extra data alone, it's still in the config file
 
         // host data (USB filters)
-        rc = m->pHost->saveSettings(m->pMainConfigFile->host);
+        rc = m->pHost->i_saveSettings(m->pMainConfigFile->host);
         if (FAILED(rc)) throw rc;
 
-        rc = m->pSystemProperties->saveSettings(m->pMainConfigFile->systemProperties);
+        rc = m->pSystemProperties->i_saveSettings(m->pMainConfigFile->systemProperties);
         if (FAILED(rc)) throw rc;
 
         // and write out the XML, still under the lock
@@ -4328,7 +4153,7 @@ HRESULT VirtualBox::saveSettings()
  *
  *  @note Locks objects!
  */
-HRESULT VirtualBox::registerMachine(Machine *aMachine)
+HRESULT VirtualBox::i_registerMachine(Machine *aMachine)
 {
     ComAssertRet(aMachine, E_INVALIDARG);
 
@@ -4341,10 +4166,10 @@ HRESULT VirtualBox::registerMachine(Machine *aMachine)
 
     {
         ComObjPtr<Machine> pMachine;
-        rc = findMachine(aMachine->getId(),
-                         true /* fPermitInaccessible */,
-                         false /* aDoSetError */,
-                         &pMachine);
+        rc = i_findMachine(aMachine->i_getId(),
+                           true /* fPermitInaccessible */,
+                           false /* aDoSetError */,
+                           &pMachine);
         if (SUCCEEDED(rc))
         {
             /* sanity */
@@ -4353,25 +4178,25 @@ HRESULT VirtualBox::registerMachine(Machine *aMachine)
 
             return setError(E_INVALIDARG,
                             tr("Registered machine with UUID {%RTuuid} ('%s') already exists"),
-                            aMachine->getId().raw(),
-                            pMachine->getSettingsFileFull().c_str());
+                            aMachine->i_getId().raw(),
+                            pMachine->i_getSettingsFileFull().c_str());
         }
 
         ComAssertRet(rc == VBOX_E_OBJECT_NOT_FOUND, rc);
         rc = S_OK;
     }
 
-    if (autoCaller.state() != InInit)
+    if (getObjectState().getState() != ObjectState::InInit)
     {
-        rc = aMachine->prepareRegister();
+        rc = aMachine->i_prepareRegister();
         if (FAILED(rc)) return rc;
     }
 
     /* add to the collection of registered machines */
     m->allMachines.addChild(aMachine);
 
-    if (autoCaller.state() != InInit)
-        rc = saveSettings();
+    if (getObjectState().getState() != ObjectState::InInit)
+        rc = i_saveSettings();
 
     return rc;
 }
@@ -4387,21 +4212,19 @@ HRESULT VirtualBox::registerMachine(Machine *aMachine)
  * @param ppMedium  Actually stored medium object. Can be different if due
  *                  to an unavoidable race there was a duplicate Medium object
  *                  created.
- * @param argType   Either DeviceType_HardDisk, DeviceType_DVD or DeviceType_Floppy.
  * @param mediaTreeLock Reference to the AutoWriteLock holding the media tree
  *                  lock, necessary to release it in the right spot.
  * @return
  */
-HRESULT VirtualBox::registerMedium(const ComObjPtr<Medium> &pMedium,
-                                   ComObjPtr<Medium> *ppMedium,
-                                   DeviceType_T argType,
-                                   AutoWriteLock &mediaTreeLock)
+HRESULT VirtualBox::i_registerMedium(const ComObjPtr<Medium> &pMedium,
+                                     ComObjPtr<Medium> *ppMedium,
+                                     AutoWriteLock &mediaTreeLock)
 {
     AssertReturn(pMedium != NULL, E_INVALIDARG);
     AssertReturn(ppMedium != NULL, E_INVALIDARG);
 
     // caller must hold the media tree write lock
-    Assert(getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
@@ -4411,7 +4234,12 @@ HRESULT VirtualBox::registerMedium(const ComObjPtr<Medium> &pMedium,
 
     const char *pszDevType = NULL;
     ObjectsList<Medium> *pall = NULL;
-    switch (argType)
+    DeviceType_T devType;
+    {
+        AutoReadLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS);
+        devType = pMedium->i_getDeviceType();
+    }
+    switch (devType)
     {
         case DeviceType_HardDisk:
             pall = &m->allHardDisks;
@@ -4426,7 +4254,7 @@ HRESULT VirtualBox::registerMedium(const ComObjPtr<Medium> &pMedium,
             pall = &m->allFloppyImages;
             break;
         default:
-            AssertMsgFailedReturn(("invalid device type %d", argType), E_INVALIDARG);
+            AssertMsgFailedReturn(("invalid device type %d", devType), E_INVALIDARG);
     }
 
     Guid id;
@@ -4434,19 +4262,19 @@ HRESULT VirtualBox::registerMedium(const ComObjPtr<Medium> &pMedium,
     ComObjPtr<Medium> pParent;
     {
         AutoReadLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS);
-        id = pMedium->getId();
-        strLocationFull = pMedium->getLocationFull();
-        pParent = pMedium->getParent();
+        id = pMedium->i_getId();
+        strLocationFull = pMedium->i_getLocationFull();
+        pParent = pMedium->i_getParent();
     }
 
     HRESULT rc;
 
     Utf8Str strConflict;
     ComObjPtr<Medium> pDupMedium;
-    rc = checkMediaForConflicts(id,
-                                strLocationFull,
-                                strConflict,
-                                &pDupMedium);
+    rc = i_checkMediaForConflicts(id,
+                                  strLocationFull,
+                                  strConflict,
+                                  &pDupMedium);
     if (FAILED(rc)) return rc;
 
     if (pDupMedium.isNull())
@@ -4465,7 +4293,7 @@ HRESULT VirtualBox::registerMedium(const ComObjPtr<Medium> &pMedium,
             pall->getList().push_back(pMedium);
 
         // store all hard disks (even differencing images) in the map
-        if (argType == DeviceType_HardDisk)
+        if (devType == DeviceType_HardDisk)
             m->mapHardDisks[id] = pMedium;
 
         mediumCaller.release();
@@ -4482,10 +4310,12 @@ HRESULT VirtualBox::registerMedium(const ComObjPtr<Medium> &pMedium,
         // release media tree lock, must not be held at uninit time.
         mediaTreeLock.release();
         // must not hold the media tree write lock any more
-        Assert(!getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+        Assert(!i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
         *ppMedium = pDupMedium;
     }
 
+    // Restore the initial lock state, so that no unexpected lock changes are
+    // done by this method, which would need adjustments everywhere.
     mediaTreeLock.acquire();
 
     return rc;
@@ -4498,7 +4328,7 @@ HRESULT VirtualBox::registerMedium(const ComObjPtr<Medium> &pMedium,
  *
  * @note Caller must hold the media tree lock for writing; in addition, this locks @a pMedium for reading
  */
-HRESULT VirtualBox::unregisterMedium(Medium *pMedium)
+HRESULT VirtualBox::i_unregisterMedium(Medium *pMedium)
 {
     AssertReturn(pMedium != NULL, E_INVALIDARG);
 
@@ -4509,16 +4339,16 @@ HRESULT VirtualBox::unregisterMedium(Medium *pMedium)
     AssertComRCReturn(mediumCaller.rc(), mediumCaller.rc());
 
     // caller must hold the media tree write lock
-    Assert(getMediaTreeLockHandle().isWriteLockOnCurrentThread());
+    Assert(i_getMediaTreeLockHandle().isWriteLockOnCurrentThread());
 
     Guid id;
     ComObjPtr<Medium> pParent;
     DeviceType_T devType;
     {
         AutoReadLock mediumLock(pMedium COMMA_LOCKVAL_SRC_POS);
-        id = pMedium->getId();
-        pParent = pMedium->getParent();
-        devType = pMedium->getDeviceType();
+        id = pMedium->i_getId();
+        pParent = pMedium->i_getParent();
+        devType = pMedium->i_getDeviceType();
     }
 
     ObjectsList<Medium> *pall = NULL;
@@ -4558,21 +4388,21 @@ HRESULT VirtualBox::unregisterMedium(Medium *pMedium)
  * @param llMedia
  * @param pMedium
  */
-void VirtualBox::pushMediumToListWithChildren(MediaList &llMedia, Medium *pMedium)
+void VirtualBox::i_pushMediumToListWithChildren(MediaList &llMedia, Medium *pMedium)
 {
     // recurse first, then add ourselves; this way children end up on the
     // list before their parents
 
-    const MediaList &llChildren = pMedium->getChildren();
+    const MediaList &llChildren = pMedium->i_getChildren();
     for (MediaList::const_iterator it = llChildren.begin();
          it != llChildren.end();
          ++it)
     {
         Medium *pChild = *it;
-        pushMediumToListWithChildren(llMedia, pChild);
+        i_pushMediumToListWithChildren(llMedia, pChild);
     }
 
-    Log(("Pushing medium %RTuuid\n", pMedium->getId().raw()));
+    Log(("Pushing medium %RTuuid\n", pMedium->i_getId().raw()));
     llMedia.push_back(pMedium);
 }
 
@@ -4586,7 +4416,7 @@ void VirtualBox::pushMediumToListWithChildren(MediaList &llMedia, Medium *pMediu
  * @param uuidMachine Medium registry ID (always a machine UUID)
  * @return
  */
-HRESULT VirtualBox::unregisterMachineMedia(const Guid &uuidMachine)
+HRESULT VirtualBox::i_unregisterMachineMedia(const Guid &uuidMachine)
 {
     Assert(!uuidMachine.isZero() && uuidMachine.isValid());
 
@@ -4598,7 +4428,7 @@ HRESULT VirtualBox::unregisterMachineMedia(const Guid &uuidMachine)
     MediaList llMedia2Close;
 
     {
-        AutoWriteLock tlock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoWriteLock tlock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
 
         for (MediaOList::iterator it = m->allHardDisks.getList().begin();
              it != m->allHardDisks.getList().end();
@@ -4609,9 +4439,9 @@ HRESULT VirtualBox::unregisterMachineMedia(const Guid &uuidMachine)
             if (FAILED(medCaller.rc())) return medCaller.rc();
             AutoReadLock medlock(pMedium COMMA_LOCKVAL_SRC_POS);
 
-            if (pMedium->isInRegistry(uuidMachine))
+            if (pMedium->i_isInRegistry(uuidMachine))
                 // recursively with children first
-                pushMediumToListWithChildren(llMedia2Close, pMedium);
+                i_pushMediumToListWithChildren(llMedia2Close, pMedium);
         }
     }
 
@@ -4620,9 +4450,9 @@ HRESULT VirtualBox::unregisterMachineMedia(const Guid &uuidMachine)
          ++it)
     {
         ComObjPtr<Medium> pMedium = *it;
-        Log(("Closing medium %RTuuid\n", pMedium->getId().raw()));
+        Log(("Closing medium %RTuuid\n", pMedium->i_getId().raw()));
         AutoCaller mac(pMedium);
-        pMedium->close(mac);
+        pMedium->i_close(mac);
     }
 
     LogFlowFuncLeave();
@@ -4637,14 +4467,14 @@ HRESULT VirtualBox::unregisterMachineMedia(const Guid &uuidMachine)
  * @param id  UUID of the machine. Must be passed by caller because machine may be dead by this time.
  * @return
  */
-HRESULT VirtualBox::unregisterMachine(Machine *pMachine,
-                                      const Guid &id)
+HRESULT VirtualBox::i_unregisterMachine(Machine *pMachine,
+                                        const Guid &id)
 {
     // remove from the collection of registered machines
     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     m->allMachines.removeChild(pMachine);
     // save the global registry
-    HRESULT rc = saveSettings();
+    HRESULT rc = i_saveSettings();
     alock.release();
 
     /*
@@ -4659,7 +4489,7 @@ HRESULT VirtualBox::unregisterMachine(Machine *pMachine,
      * become inaccessible.
      */
     {
-        AutoReadLock tlock(getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
+        AutoReadLock tlock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);
         // iterate over the list of *base* images
         for (MediaOList::iterator it = m->allHardDisks.getList().begin();
              it != m->allHardDisks.getList().end();
@@ -4670,31 +4500,31 @@ HRESULT VirtualBox::unregisterMachine(Machine *pMachine,
             if (FAILED(medCaller.rc())) return medCaller.rc();
             AutoWriteLock mlock(pMedium COMMA_LOCKVAL_SRC_POS);
 
-            if (pMedium->removeRegistry(id, true /* fRecurse */))
+            if (pMedium->i_removeRegistryRecursive(id))
             {
                 // machine ID was found in base medium's registry list:
                 // move this base image and all its children to another registry then
                 // 1) first, find a better registry to add things to
-                const Guid *puuidBetter = pMedium->getAnyMachineBackref();
+                const Guid *puuidBetter = pMedium->i_getAnyMachineBackref();
                 if (puuidBetter)
                 {
                     // 2) better registry found: then use that
-                    pMedium->addRegistry(*puuidBetter, true /* fRecurse */);
+                    pMedium->i_addRegistryRecursive(*puuidBetter);
                     // 3) and make sure the registry is saved below
                     mlock.release();
                     tlock.release();
-                    markRegistryModified(*puuidBetter);
+                    i_markRegistryModified(*puuidBetter);
                     tlock.acquire();
-                    mlock.release();
+                    mlock.acquire();
                 }
             }
         }
     }
 
-    saveModifiedRegistries();
+    i_saveModifiedRegistries();
 
     /* fire an event */
-    onMachineRegistered(id, FALSE);
+    i_onMachineRegistered(id, FALSE);
 
     return rc;
 }
@@ -4705,17 +4535,17 @@ HRESULT VirtualBox::unregisterMachine(Machine *pMachine,
  *
  * @param uuid
  */
-void VirtualBox::markRegistryModified(const Guid &uuid)
+void VirtualBox::i_markRegistryModified(const Guid &uuid)
 {
-    if (uuid == getGlobalRegistryId())
+    if (uuid == i_getGlobalRegistryId())
         ASMAtomicIncU64(&m->uRegistryNeedsSaving);
     else
     {
         ComObjPtr<Machine> pMachine;
-        HRESULT rc = findMachine(uuid,
-                                 false /* fPermitInaccessible */,
-                                 false /* aSetError */,
-                                 &pMachine);
+        HRESULT rc = i_findMachine(uuid,
+                                   false /* fPermitInaccessible */,
+                                   false /* aSetError */,
+                                   &pMachine);
         if (SUCCEEDED(rc))
         {
             AutoCaller machineCaller(pMachine);
@@ -4726,6 +4556,53 @@ void VirtualBox::markRegistryModified(const Guid &uuid)
 }
 
 /**
+ * Marks the registry for @a uuid as unmodified, so that it's not saved in
+ * a later call to saveModifiedRegistries().
+ *
+ * @param uuid
+ */
+void VirtualBox::i_unmarkRegistryModified(const Guid &uuid)
+{
+    uint64_t uOld;
+    if (uuid == i_getGlobalRegistryId())
+    {
+        for (;;)
+        {
+            uOld = ASMAtomicReadU64(&m->uRegistryNeedsSaving);
+            if (!uOld)
+                break;
+            if (ASMAtomicCmpXchgU64(&m->uRegistryNeedsSaving, 0, uOld))
+                break;
+            ASMNopPause();
+        }
+    }
+    else
+    {
+        ComObjPtr<Machine> pMachine;
+        HRESULT rc = i_findMachine(uuid,
+                                   false /* fPermitInaccessible */,
+                                   false /* aSetError */,
+                                   &pMachine);
+        if (SUCCEEDED(rc))
+        {
+            AutoCaller machineCaller(pMachine);
+            if (SUCCEEDED(machineCaller.rc()))
+            {
+                for (;;)
+                {
+                    uOld = ASMAtomicReadU64(&pMachine->uRegistryNeedsSaving);
+                    if (!uOld)
+                        break;
+                    if (ASMAtomicCmpXchgU64(&pMachine->uRegistryNeedsSaving, 0, uOld))
+                        break;
+                    ASMNopPause();
+                }
+            }
+        }
+    }
+}
+
+/**
  * Saves all settings files according to the modified flags in the Machine
  * objects and in the VirtualBox object.
  *
@@ -4734,7 +4611,7 @@ void VirtualBox::markRegistryModified(const Guid &uuid)
  *
  * @return
  */
-void VirtualBox::saveModifiedRegistries()
+void VirtualBox::i_saveModifiedRegistries()
 {
     HRESULT rc = S_OK;
     bool fNeedsGlobalSettings = false;
@@ -4763,11 +4640,11 @@ void VirtualBox::saveModifiedRegistries()
                 if (FAILED(autoCaller.rc()))
                     continue;
                 /* object is already dead, no point in saving settings */
-                if (autoCaller.state() != Ready)
+                if (getObjectState().getState() != ObjectState::Ready)
                     continue;
                 AutoWriteLock mlock(pMachine COMMA_LOCKVAL_SRC_POS);
-                rc = pMachine->saveSettings(&fNeedsGlobalSettings,
-                                            Machine::SaveS_Force);           // caller said save, so stop arguing
+                rc = pMachine->i_saveSettings(&fNeedsGlobalSettings,
+                                              Machine::SaveS_Force);           // caller said save, so stop arguing
             }
         }
     }
@@ -4784,14 +4661,14 @@ void VirtualBox::saveModifiedRegistries()
     if (uOld || fNeedsGlobalSettings)
     {
         AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
-        rc = saveSettings();
+        rc = i_saveSettings();
     }
     NOREF(rc); /* XXX */
 }
 
 
 /* static */
-const Bstr &VirtualBox::getVersionNormalized()
+const com::Utf8Str &VirtualBox::i_getVersionNormalized()
 {
     return sVersionNormalized;
 }
@@ -4810,7 +4687,7 @@ const Bstr &VirtualBox::getVersionNormalized()
  * @return Extended error information on failure to check/create the path.
  */
 /* static */
-HRESULT VirtualBox::ensureFilePathExists(const Utf8Str &strFileName, bool fCreate)
+HRESULT VirtualBox::i_ensureFilePathExists(const Utf8Str &strFileName, bool fCreate)
 {
     Utf8Str strDir(strFileName);
     strDir.stripFilename();
@@ -4820,21 +4697,21 @@ HRESULT VirtualBox::ensureFilePathExists(const Utf8Str &strFileName, bool fCreat
         {
             int vrc = RTDirCreateFullPath(strDir.c_str(), 0700);
             if (RT_FAILURE(vrc))
-                return setErrorStatic(VBOX_E_IPRT_ERROR,
-                                      Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"),
-                                                 strDir.c_str(),
-                                                 vrc));
+                return i_setErrorStatic(VBOX_E_IPRT_ERROR,
+                                        Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"),
+                                                   strDir.c_str(),
+                                                   vrc));
         }
         else
-            return setErrorStatic(VBOX_E_IPRT_ERROR,
-                                  Utf8StrFmt(tr("Directory '%s' does not exist"),
-                                             strDir.c_str()));
+            return i_setErrorStatic(VBOX_E_IPRT_ERROR,
+                                    Utf8StrFmt(tr("Directory '%s' does not exist"),
+                                               strDir.c_str()));
     }
 
     return S_OK;
 }
 
-const Utf8Str& VirtualBox::settingsFilePath()
+const Utf8Str& VirtualBox::i_settingsFilePath()
 {
     return m->strSettingsFilePath;
 }
@@ -4846,7 +4723,7 @@ const Utf8Str& VirtualBox::settingsFilePath()
  * order: always request this lock after the VirtualBox object lock but
  * before the locks of any machine object. See AutoLock.h.
  */
-RWLockHandle& VirtualBox::getMachinesListLockHandle()
+RWLockHandle& VirtualBox::i_getMachinesListLockHandle()
 {
     return m->lockMachines;
 }
@@ -4859,7 +4736,7 @@ RWLockHandle& VirtualBox::getMachinesListLockHandle()
  * after the VirtualBox object lock but before the locks of the media
  * objects contained in these lists. See AutoLock.h.
  */
-RWLockHandle& VirtualBox::getMediaTreeLockHandle()
+RWLockHandle& VirtualBox::i_getMediaTreeLockHandle()
 {
     return m->lockMedia;
 }
@@ -4943,7 +4820,7 @@ void *VirtualBox::CallbackEvent::handler()
     if (!autoCaller.isOk())
     {
         LogWarningFunc(("VirtualBox has been uninitialized (state=%d), the callback event is discarded!\n",
-                        autoCaller.state()));
+                        mVirtualBox->getObjectState().getState()));
         /* We don't need mVirtualBox any more, so release it */
         mVirtualBox = NULL;
         return NULL;
@@ -4965,37 +4842,26 @@ void *VirtualBox::CallbackEvent::handler()
 //    return E_NOTIMPL;
 //}
 
-STDMETHODIMP VirtualBox::CreateDHCPServer(IN_BSTR aName, IDHCPServer ** aServer)
+HRESULT VirtualBox::createDHCPServer(const com::Utf8Str &aName,
+                                     ComPtr<IDHCPServer> &aServer)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgNotNull(aServer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     ComObjPtr<DHCPServer> dhcpServer;
     dhcpServer.createObject();
-    HRESULT rc = dhcpServer->init(this, aName);
+    HRESULT rc = dhcpServer->init(this, Bstr(aName).raw());
     if (FAILED(rc)) return rc;
 
-    rc = registerDHCPServer(dhcpServer, true);
+    rc = i_registerDHCPServer(dhcpServer, true);
     if (FAILED(rc)) return rc;
 
-    dhcpServer.queryInterfaceTo(aServer);
+    dhcpServer.queryInterfaceTo(aServer.asOutParam());
 
     return rc;
 }
 
-STDMETHODIMP VirtualBox::FindDHCPServerByNetworkName(IN_BSTR aName, IDHCPServer ** aServer)
+HRESULT VirtualBox::findDHCPServerByNetworkName(const com::Utf8Str &aName,
+                                                ComPtr<IDHCPServer> &aServer)
 {
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgNotNull(aServer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
-    HRESULT rc;
-    Bstr bstr;
+    HRESULT rc = S_OK;
     ComPtr<DHCPServer> found;
 
     AutoReadLock alock(m->allDHCPServers.getLockHandle() COMMA_LOCKVAL_SRC_POS);
@@ -5004,10 +4870,11 @@ STDMETHODIMP VirtualBox::FindDHCPServerByNetworkName(IN_BSTR aName, IDHCPServer
          it != m->allDHCPServers.end();
          ++it)
     {
+        Bstr bstr;
         rc = (*it)->COMGETTER(NetworkName)(bstr.asOutParam());
         if (FAILED(rc)) return rc;
 
-        if (bstr == aName)
+        if (bstr == Bstr(aName).raw())
         {
             found = *it;
             break;
@@ -5017,17 +4884,16 @@ STDMETHODIMP VirtualBox::FindDHCPServerByNetworkName(IN_BSTR aName, IDHCPServer
     if (!found)
         return E_INVALIDARG;
 
-    return found.queryInterfaceTo(aServer);
+    rc = found.queryInterfaceTo(aServer.asOutParam());
+
+    return rc;
 }
 
-STDMETHODIMP VirtualBox::RemoveDHCPServer(IDHCPServer * aServer)
+HRESULT VirtualBox::removeDHCPServer(const ComPtr<IDHCPServer> &aServer)
 {
-    CheckComArgNotNull(aServer);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+    IDHCPServer *aP = aServer;
 
-    HRESULT rc = unregisterDHCPServer(static_cast<DHCPServer *>(aServer), true);
+    HRESULT rc = i_unregisterDHCPServer(static_cast<DHCPServer *>(aP));
 
     return rc;
 }
@@ -5047,39 +4913,53 @@ STDMETHODIMP VirtualBox::RemoveDHCPServer(IDHCPServer * aServer)
  *
  * @note Locks this object for writing and @a aDHCPServer for reading.
  */
-HRESULT VirtualBox::registerDHCPServer(DHCPServer *aDHCPServer,
-                                       bool aSaveSettings /*= true*/)
+HRESULT VirtualBox::i_registerDHCPServer(DHCPServer *aDHCPServer,
+                                         bool aSaveSettings /*= true*/)
 {
     AssertReturn(aDHCPServer != NULL, E_INVALIDARG);
 
     AutoCaller autoCaller(this);
     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
 
+    // Acquire a lock on the VirtualBox object early to avoid lock order issues
+    // when we call i_saveSettings() later on.
+    AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS);
+    // need it below, in findDHCPServerByNetworkName (reading) and in
+    // m->allDHCPServers.addChild, so need to get it here to avoid lock
+    // order trouble with dhcpServerCaller
+    AutoWriteLock alock(m->allDHCPServers.getLockHandle() COMMA_LOCKVAL_SRC_POS);
+
     AutoCaller dhcpServerCaller(aDHCPServer);
     AssertComRCReturn(dhcpServerCaller.rc(), dhcpServerCaller.rc());
 
     Bstr name;
-    HRESULT rc;
+    com::Utf8Str uname;
+    HRESULT rc = S_OK;
     rc = aDHCPServer->COMGETTER(NetworkName)(name.asOutParam());
     if (FAILED(rc)) return rc;
+    uname = Utf8Str(name);
 
     ComPtr<IDHCPServer> existing;
-    rc = FindDHCPServerByNetworkName(name.raw(), existing.asOutParam());
+    rc = findDHCPServerByNetworkName(uname, existing);
     if (SUCCEEDED(rc))
         return E_INVALIDARG;
-
     rc = S_OK;
 
     m->allDHCPServers.addChild(aDHCPServer);
+    // we need to release the list lock before we attempt to acquire locks
+    // on other objects in i_saveSettings (see @bugref{7500})
+    alock.release();
 
     if (aSaveSettings)
     {
-        AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS);
-        rc = saveSettings();
-        vboxLock.release();
+        // we acquired the lock on 'this' earlier to avoid lock order issues
+        rc = i_saveSettings();
 
         if (FAILED(rc))
-            unregisterDHCPServer(aDHCPServer, false /* aSaveSettings */);
+        {
+            alock.acquire();
+            m->allDHCPServers.removeChild(aDHCPServer);
+        }
     }
 
     return rc;
@@ -5089,16 +4969,14 @@ HRESULT VirtualBox::registerDHCPServer(DHCPServer *aDHCPServer,
  * Removes the given DHCP server from the settings.
  *
  * @param aDHCPServer   DHCP server object to remove.
- * @param aSaveSettings @c true to save settings to disk (default).
  *
- * When @a aSaveSettings is @c true, this operation may fail because of the
- * failed #saveSettings() method it calls. In this case, the DHCP server
- * will NOT be removed from the settingsi when this method returns.
+ * This operation may fail because of the failed #saveSettings() method it
+ * calls. In this case, the DHCP server will NOT be removed from the settings
+ * when this method returns.
  *
  * @note Locks this object for writing.
  */
-HRESULT VirtualBox::unregisterDHCPServer(DHCPServer *aDHCPServer,
-                                         bool aSaveSettings /*= true*/)
+HRESULT VirtualBox::i_unregisterDHCPServer(DHCPServer *aDHCPServer)
 {
     AssertReturn(aDHCPServer != NULL, E_INVALIDARG);
 
@@ -5108,18 +4986,20 @@ HRESULT VirtualBox::unregisterDHCPServer(DHCPServer *aDHCPServer,
     AutoCaller dhcpServerCaller(aDHCPServer);
     AssertComRCReturn(dhcpServerCaller.rc(), dhcpServerCaller.rc());
 
+    AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS);
+    AutoWriteLock alock(m->allDHCPServers.getLockHandle() COMMA_LOCKVAL_SRC_POS);
     m->allDHCPServers.removeChild(aDHCPServer);
+    // we need to release the list lock before we attempt to acquire locks
+    // on other objects in i_saveSettings (see @bugref{7500})
+    alock.release();
 
-    HRESULT rc = S_OK;
+    HRESULT rc = i_saveSettings();
 
-    if (aSaveSettings)
+    // undo the changes if we failed to save them
+    if (FAILED(rc))
     {
-        AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS);
-        rc = saveSettings();
-        vboxLock.release();
-
-        if (FAILED(rc))
-            registerDHCPServer(aDHCPServer, false /* aSaveSettings */);
+        alock.acquire();
+        m->allDHCPServers.addChild(aDHCPServer);
     }
 
     return rc;
@@ -5129,27 +5009,22 @@ HRESULT VirtualBox::unregisterDHCPServer(DHCPServer *aDHCPServer,
 /**
  * NAT Network
  */
-
-STDMETHODIMP VirtualBox::CreateNATNetwork(IN_BSTR aName, INATNetwork ** aNatNetwork)
+HRESULT VirtualBox::createNATNetwork(const com::Utf8Str &aNetworkName,
+                                     ComPtr<INATNetwork> &aNetwork)
 {
 #ifdef VBOX_WITH_NAT_SERVICE
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgNotNull(aNatNetwork);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
-
     ComObjPtr<NATNetwork> natNetwork;
     natNetwork.createObject();
-    HRESULT rc = natNetwork->init(this, aName);
+    HRESULT rc = natNetwork->init(this, Bstr(aNetworkName).raw());
     if (FAILED(rc)) return rc;
 
-    rc = registerNATNetwork(natNetwork, true);
+    rc = i_registerNATNetwork(natNetwork, true);
     if (FAILED(rc)) return rc;
 
-    natNetwork.queryInterfaceTo(aNatNetwork);
+    natNetwork.queryInterfaceTo(aNetwork.asOutParam());
+
+    fireNATNetworkCreationDeletionEvent(m->pEventSource, Bstr(aNetworkName).raw(), TRUE);
 
-    fireNATNetworkCreationDeletionEvent(m->pEventSource, aName, TRUE);
     return rc;
 #else
     NOREF(aName);
@@ -5158,17 +5033,12 @@ STDMETHODIMP VirtualBox::CreateNATNetwork(IN_BSTR aName, INATNetwork ** aNatNetw
 #endif
 }
 
-STDMETHODIMP VirtualBox::FindNATNetworkByName(IN_BSTR aName, INATNetwork ** aNetwork)
+HRESULT VirtualBox::findNATNetworkByName(const com::Utf8Str &aNetworkName,
+                                         ComPtr<INATNetwork> &aNetwork)
 {
 #ifdef VBOX_WITH_NAT_SERVICE
-    CheckComArgStrNotEmptyOrNull(aName);
-    CheckComArgNotNull(aNetwork);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
 
-    HRESULT rc;
-    Bstr bstr;
+    HRESULT rc = S_OK;
     ComPtr<NATNetwork> found;
 
     AutoReadLock alock(m->allNATNetworks.getLockHandle() COMMA_LOCKVAL_SRC_POS);
@@ -5177,10 +5047,11 @@ STDMETHODIMP VirtualBox::FindNATNetworkByName(IN_BSTR aName, INATNetwork ** aNet
          it != m->allNATNetworks.end();
          ++it)
     {
+        Bstr bstr;
         rc = (*it)->COMGETTER(NetworkName)(bstr.asOutParam());
         if (FAILED(rc)) return rc;
 
-        if (bstr == aName)
+        if (bstr == Bstr(aNetworkName).raw())
         {
             found = *it;
             break;
@@ -5189,27 +5060,24 @@ STDMETHODIMP VirtualBox::FindNATNetworkByName(IN_BSTR aName, INATNetwork ** aNet
 
     if (!found)
         return E_INVALIDARG;
-
-    return found.queryInterfaceTo(aNetwork);
+    found.queryInterfaceTo(aNetwork.asOutParam());
+    return rc;
 #else
     NOREF(aName);
-    NOREF(aNetwork);
+    NOREF(aNetworkName);
     return E_NOTIMPL;
 #endif
 }
 
-STDMETHODIMP VirtualBox::RemoveNATNetwork(INATNetwork * aNetwork)
+HRESULT VirtualBox::removeNATNetwork(const ComPtr<INATNetwork> &aNetwork)
 {
 #ifdef VBOX_WITH_NAT_SERVICE
-    CheckComArgNotNull(aNetwork);
-
-    AutoCaller autoCaller(this);
-    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     Bstr name;
-    HRESULT rc;
-    NATNetwork *network = static_cast<NATNetwork *>(aNetwork);
+    HRESULT rc = S_OK;
+    INATNetwork *iNw = aNetwork;
+    NATNetwork *network = static_cast<NATNetwork *>(iNw);
     rc = network->COMGETTER(NetworkName)(name.asOutParam());
-    rc = unregisterNATNetwork(network, true);
+    rc = i_unregisterNATNetwork(network, true);
     fireNATNetworkCreationDeletionEvent(m->pEventSource, name.raw(), FALSE);
     return rc;
 #else
@@ -5227,8 +5095,8 @@ STDMETHODIMP VirtualBox::RemoveNATNetwork(INATNetwork * aNetwork)
  *
  * @note Locks this object for writing and @a aNATNetwork for reading.
  */
-HRESULT VirtualBox::registerNATNetwork(NATNetwork *aNATNetwork,
-                                       bool aSaveSettings /*= true*/)
+HRESULT VirtualBox::i_registerNATNetwork(NATNetwork *aNATNetwork,
+                                         bool aSaveSettings /*= true*/)
 {
 #ifdef VBOX_WITH_NAT_SERVICE
     AssertReturn(aNATNetwork != NULL, E_INVALIDARG);
@@ -5260,11 +5128,11 @@ HRESULT VirtualBox::registerNATNetwork(NATNetwork *aNATNetwork,
     if (aSaveSettings)
     {
         AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS);
-        rc = saveSettings();
+        rc = i_saveSettings();
         vboxLock.release();
 
         if (FAILED(rc))
-            unregisterNATNetwork(aNATNetwork, false /* aSaveSettings */);
+            i_unregisterNATNetwork(aNATNetwork, false /* aSaveSettings */);
     }
 
     return rc;
@@ -5288,8 +5156,8 @@ HRESULT VirtualBox::registerNATNetwork(NATNetwork *aNATNetwork,
  *
  * @note Locks this object for writing.
  */
-HRESULT VirtualBox::unregisterNATNetwork(NATNetwork *aNATNetwork,
-                                         bool aSaveSettings /*= true*/)
+HRESULT VirtualBox::i_unregisterNATNetwork(NATNetwork *aNATNetwork,
+                                           bool aSaveSettings /*= true*/)
 {
 #ifdef VBOX_WITH_NAT_SERVICE
     AssertReturn(aNATNetwork != NULL, E_INVALIDARG);
@@ -5311,11 +5179,11 @@ HRESULT VirtualBox::unregisterNATNetwork(NATNetwork *aNATNetwork,
     if (aSaveSettings)
     {
         AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS);
-        rc = saveSettings();
+        rc = i_saveSettings();
         vboxLock.release();
 
         if (FAILED(rc))
-            registerNATNetwork(aNATNetwork, false /* aSaveSettings */);
+            i_registerNATNetwork(aNATNetwork, false /* aSaveSettings */);
     }
 
     return rc;
diff --git a/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp b/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp
index 5e68d02..c588622 100644
--- a/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp
+++ b/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp
@@ -1,3 +1,4 @@
+/* $Id: HostPowerDarwin.cpp $ */
 /** @file
  *
  * VirtualBox interface to host's power notification service
diff --git a/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp b/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
index cfde818..1be1f92 100644
--- a/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
+++ b/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
@@ -409,11 +409,13 @@ int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list)
             ComObjPtr<HostNetworkInterface> IfObj;
             IfObj.createObject();
             if (SUCCEEDED(IfObj->init(Bstr(pNew->szName), enmType, pNew)))
+            {
                 /* Make sure the default interface gets to the beginning. */
                 if (pIfMsg->ifm_index == u16DefaultIface)
                     list.push_front(IfObj);
                 else
                     list.push_back(IfObj);
+            }
         }
         RTMemFree(pNew);
     }
diff --git a/src/VBox/Main/src-server/darwin/USBProxyServiceDarwin.cpp b/src/VBox/Main/src-server/darwin/USBProxyServiceDarwin.cpp
index 5ea0e93..8953a5b 100644
--- a/src/VBox/Main/src-server/darwin/USBProxyServiceDarwin.cpp
+++ b/src/VBox/Main/src-server/darwin/USBProxyServiceDarwin.cpp
@@ -122,9 +122,9 @@ int USBProxyServiceDarwin::captureDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_Capturing);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_Capturing);
 
 #ifndef VBOX_WITH_NEW_USB_CODE_ON_DARWIN
     /*
@@ -169,7 +169,7 @@ void USBProxyServiceDarwin::captureDeviceCompleted(HostUSBDevice *aDevice, bool
     /*
      * Remove the one-shot filter if necessary.
      */
-    LogFlowThisFunc(("aDevice=%s aSuccess=%RTbool mOneShotId=%p\n", aDevice->getName().c_str(), aSuccess, aDevice->mOneShotId));
+    LogFlowThisFunc(("aDevice=%s aSuccess=%RTbool mOneShotId=%p\n", aDevice->i_getName().c_str(), aSuccess, aDevice->mOneShotId));
     if (!aSuccess && aDevice->mOneShotId)
         USBLibRemoveFilter(aDevice->mOneShotId);
     aDevice->mOneShotId = NULL;
@@ -186,9 +186,9 @@ int USBProxyServiceDarwin::releaseDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_ReleasingToHost);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_ReleasingToHost);
 
 #ifndef VBOX_WITH_NEW_USB_CODE_ON_DARWIN
     /*
@@ -235,7 +235,7 @@ void USBProxyServiceDarwin::releaseDeviceCompleted(HostUSBDevice *aDevice, bool
     /*
      * Remove the one-shot filter if necessary.
      */
-    LogFlowThisFunc(("aDevice=%s aSuccess=%RTbool mOneShotId=%p\n", aDevice->getName().c_str(), aSuccess, aDevice->mOneShotId));
+    LogFlowThisFunc(("aDevice=%s aSuccess=%RTbool mOneShotId=%p\n", aDevice->i_getName().c_str(), aSuccess, aDevice->mOneShotId));
     if (!aSuccess && aDevice->mOneShotId)
         USBLibRemoveFilter(aDevice->mOneShotId);
     aDevice->mOneShotId = NULL;
diff --git a/src/VBox/Main/src-server/darwin/iokit.cpp b/src/VBox/Main/src-server/darwin/iokit.cpp
index 3fa8c8f..7bdde5d 100644
--- a/src/VBox/Main/src-server/darwin/iokit.cpp
+++ b/src/VBox/Main/src-server/darwin/iokit.cpp
@@ -972,8 +972,9 @@ PUSBDEVICE DarwinGetUSBDevices(void)
                 AssertBreak(darwinDictGetU8(PropsRef,  CFSTR("PortNum"),                &pCur->bPort));
                 uint8_t bSpeed;
                 AssertBreak(darwinDictGetU8(PropsRef,  CFSTR(kUSBDevicePropertySpeed),  &bSpeed));
-                Assert(bSpeed <= 2);
-                pCur->enmSpeed = bSpeed == 2 ? USBDEVICESPEED_HIGH
+                Assert(bSpeed <= 3);
+                pCur->enmSpeed = bSpeed == 3 ? USBDEVICESPEED_SUPER
+                               : bSpeed == 2 ? USBDEVICESPEED_HIGH
                                : bSpeed == 1 ? USBDEVICESPEED_FULL
                                : bSpeed == 0 ? USBDEVICESPEED_LOW
                                              : USBDEVICESPEED_UNKNOWN;
diff --git a/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp b/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp
index c65e47c..a6511b6 100644
--- a/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp
+++ b/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp
@@ -38,6 +38,7 @@
 # include <sys/types.h>
 # include <sys/stat.h>
 # include <unistd.h>
+# include <stdio.h>
 # include <sys/ioctl.h>
 # include <fcntl.h>
 # include <cam/cam.h>
@@ -250,7 +251,8 @@ static int getDVDInfoFromCAM(DriveInfoList *pList, bool *pfSuccess)
                         PeriphMatchPattern.pattern.periph_pattern.path_id    = paMatches[i].result.device_result.path_id;
                         PeriphMatchPattern.pattern.periph_pattern.target_id  = paMatches[i].result.device_result.target_id;
                         PeriphMatchPattern.pattern.periph_pattern.target_lun = paMatches[i].result.device_result.target_lun;
-                        PeriphMatchPattern.pattern.periph_pattern.flags      = PERIPH_MATCH_PATH | PERIPH_MATCH_TARGET | PERIPH_MATCH_LUN;
+                        PeriphMatchPattern.pattern.periph_pattern.flags      = PERIPH_MATCH_PATH | PERIPH_MATCH_TARGET |
+                                                                               PERIPH_MATCH_LUN;
                         PeriphCCB.cdm.num_patterns    = 1;
                         PeriphCCB.cdm.pattern_buf_len = sizeof(struct dev_match_result);
                         PeriphCCB.cdm.patterns        = &PeriphMatchPattern;
diff --git a/src/VBox/Main/src-server/freebsd/USBProxyServiceFreeBSD.cpp b/src/VBox/Main/src-server/freebsd/USBProxyServiceFreeBSD.cpp
index 9853531..da509e3 100644
--- a/src/VBox/Main/src-server/freebsd/USBProxyServiceFreeBSD.cpp
+++ b/src/VBox/Main/src-server/freebsd/USBProxyServiceFreeBSD.cpp
@@ -114,12 +114,12 @@ int USBProxyServiceFreeBSD::captureDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
     /*
      * Don't think we need to do anything when the device is held... fake it.
      */
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_Capturing);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_Capturing);
     devLock.release();
     interruptWait();
 
@@ -133,12 +133,12 @@ int USBProxyServiceFreeBSD::releaseDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
     /*
      * We're not really holding it atm., just fake it.
      */
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_ReleasingToHost);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_ReleasingToHost);
     devLock.release();
     interruptWait();
 
@@ -146,7 +146,8 @@ int USBProxyServiceFreeBSD::releaseDevice(HostUSBDevice *aDevice)
 }
 
 
-bool USBProxyServiceFreeBSD::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool USBProxyServiceFreeBSD::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters,
+                                               SessionMachine **aIgnoreMachine)
 {
     AssertReturn(aDevice, false);
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false);
@@ -160,7 +161,8 @@ bool USBProxyServiceFreeBSD::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVIC
  *
  * See USBProxyService::deviceAdded for details.
  */
-void USBProxyServiceFreeBSD::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice)
+void USBProxyServiceFreeBSD::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines,
+                                         PUSBDEVICE aUSBDevice)
 {
     USBProxyService::deviceAdded(aDevice, llOpenedMachines, aUSBDevice);
 }
diff --git a/src/VBox/Main/src-server/generic/NetIf-generic.cpp b/src/VBox/Main/src-server/generic/NetIf-generic.cpp
index 2f99585..8dd3e10 100644
--- a/src/VBox/Main/src-server/generic/NetIf-generic.cpp
+++ b/src/VBox/Main/src-server/generic/NetIf-generic.cpp
@@ -156,7 +156,8 @@ int NetIfEnableStaticIpConfig(VirtualBox * /* vBox */, HostNetworkInterface * pI
     return NetIfAdpCtl(pIf, szAddress, pszOption, pszMask);
 }
 
-int NetIfEnableStaticIpConfigV6(VirtualBox * /* vBox */, HostNetworkInterface * pIf, IN_BSTR aOldIPV6Address, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
+int NetIfEnableStaticIpConfigV6(VirtualBox * /* vBox */, HostNetworkInterface * pIf, IN_BSTR aOldIPV6Address,
+                                IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
 {
     char szAddress[5*8 + 1 + 5 + 1];
     if (Bstr(aIPV6Address).length())
@@ -179,7 +180,7 @@ int NetIfEnableDynamicIpConfig(VirtualBox * /* vBox */, HostNetworkInterface * /
 }
 
 
-int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
+int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVirtualBox,
                                         IHostNetworkInterface **aHostNetworkInterface,
                                         IProgress **aProgress,
                                         const char *pcszName)
@@ -190,10 +191,10 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
     progress.createObject();
 
     ComPtr<IHost> host;
-    HRESULT hrc = pVBox->COMGETTER(Host)(host.asOutParam());
+    HRESULT hrc = pVirtualBox->COMGETTER(Host)(host.asOutParam());
     if (SUCCEEDED(hrc))
     {
-        hrc = progress->init(pVBox, host,
+        hrc = progress->init(pVirtualBox, host,
                              Bstr("Creating host only network interface").raw(),
                              FALSE /* aCancelable */);
         if (SUCCEEDED(hrc))
@@ -204,10 +205,10 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
             int rc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME " add"));
             if (RT_FAILURE(rc))
             {
-                progress->notifyComplete(E_FAIL,
-                                         COM_IIDOF(IHostNetworkInterface),
-                                         HostNetworkInterface::getStaticComponentName(),
-                                         "Failed to get program path, rc=%Rrc\n", rc);
+                progress->i_notifyComplete(E_FAIL,
+                                           COM_IIDOF(IHostNetworkInterface),
+                                           HostNetworkInterface::getStaticComponentName(),
+                                           "Failed to get program path, rc=%Rrc\n", rc);
                 return rc;
             }
             strcat(szAdpCtl, "/" VBOXNETADPCTL_NAME " ");
@@ -234,10 +235,10 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
 
                     if (!strncmp(VBOXNETADPCTL_NAME ":", szBuf, sizeof(VBOXNETADPCTL_NAME)))
                     {
-                        progress->notifyComplete(E_FAIL,
-                                                 COM_IIDOF(IHostNetworkInterface),
-                                                 HostNetworkInterface::getStaticComponentName(),
-                                                 "%s", szBuf);
+                        progress->i_notifyComplete(E_FAIL,
+                                                   COM_IIDOF(IHostNetworkInterface),
+                                                   HostNetworkInterface::getStaticComponentName(),
+                                                   "%s", szBuf);
                         pclose(fp);
                         return E_FAIL;
                     }
@@ -253,10 +254,10 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
                         rc = NetIfGetConfigByName(pInfo);
                         if (RT_FAILURE(rc))
                         {
-                            progress->notifyComplete(E_FAIL,
-                                                     COM_IIDOF(IHostNetworkInterface),
-                                                     HostNetworkInterface::getStaticComponentName(),
-                                                     "Failed to get config info for %s (as reported by '" VBOXNETADPCTL_NAME " add')\n", szBuf);
+                            progress->i_notifyComplete(E_FAIL,
+                                                       COM_IIDOF(IHostNetworkInterface),
+                                                       HostNetworkInterface::getStaticComponentName(),
+                                                       "Failed to get config info for %s (as reported by '" VBOXNETADPCTL_NAME " add')\n", szBuf);
                         }
                         else
                         {
@@ -265,17 +266,17 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
                             ComObjPtr<HostNetworkInterface> iface;
                             iface.createObject();
                             iface->init(IfName, HostNetworkInterfaceType_HostOnly, pInfo);
-                            iface->setVirtualBox(pVBox);
+                            iface->i_setVirtualBox(pVirtualBox);
                             iface.queryInterfaceTo(aHostNetworkInterface);
                         }
                         RTMemFree(pInfo);
                     }
                     if ((rc = pclose(fp)) != 0)
                     {
-                        progress->notifyComplete(E_FAIL,
-                                                 COM_IIDOF(IHostNetworkInterface),
-                                                 HostNetworkInterface::getStaticComponentName(),
-                                                 "Failed to execute '"VBOXNETADPCTL_NAME " add' (exit status: %d)", rc);
+                        progress->i_notifyComplete(E_FAIL,
+                                                   COM_IIDOF(IHostNetworkInterface),
+                                                   HostNetworkInterface::getStaticComponentName(),
+                                                   "Failed to execute '" VBOXNETADPCTL_NAME " add' (exit status: %d)", rc);
                         rc = VERR_INTERNAL_ERROR;
                     }
                 }
@@ -283,15 +284,15 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
                 {
                     /* Failed to add an interface */
                     rc = VERR_PERMISSION_DENIED;
-                    progress->notifyComplete(E_FAIL,
-                                             COM_IIDOF(IHostNetworkInterface),
-                                             HostNetworkInterface::getStaticComponentName(),
-                                             "Failed to execute '"VBOXNETADPCTL_NAME " add' (exit status: %d). Check permissions!", rc);
+                    progress->i_notifyComplete(E_FAIL,
+                                               COM_IIDOF(IHostNetworkInterface),
+                                               HostNetworkInterface::getStaticComponentName(),
+                                               "Failed to execute '" VBOXNETADPCTL_NAME " add' (exit status: %d). Check permissions!", rc);
                     pclose(fp);
                 }
             }
             if (RT_SUCCESS(rc))
-                progress->notifyComplete(rc);
+                progress->i_notifyComplete(rc);
             else
                 hrc = E_FAIL;
         }
@@ -300,7 +301,7 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
     return hrc;
 
 #else
-    NOREF(pVBox);
+    NOREF(pVirtualBox);
     NOREF(aHostNetworkInterface);
     NOREF(aProgress);
     NOREF(pcszName);
@@ -308,7 +309,7 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
 #endif
 }
 
-int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVBox, IN_GUID aId,
+int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVirtualBox, IN_GUID aId,
                                         IProgress **aProgress)
 {
 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
@@ -317,7 +318,7 @@ int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVBox, IN_GUID aId,
     progress.createObject();
     ComPtr<IHost> host;
     int rc = VINF_SUCCESS;
-    HRESULT hr = pVBox->COMGETTER(Host)(host.asOutParam());
+    HRESULT hr = pVirtualBox->COMGETTER(Host)(host.asOutParam());
     if (SUCCEEDED(hr))
     {
         Bstr ifname;
@@ -328,7 +329,7 @@ int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVBox, IN_GUID aId,
         if (ifname.isEmpty())
             return VERR_INTERNAL_ERROR;
 
-        rc = progress->init(pVBox, host,
+        rc = progress->init(pVirtualBox, host,
                             Bstr("Removing host network interface").raw(),
                             FALSE /* aCancelable */);
         if (SUCCEEDED(rc))
@@ -336,22 +337,22 @@ int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVBox, IN_GUID aId,
             progress.queryInterfaceTo(aProgress);
             rc = NetIfAdpCtl(Utf8Str(ifname).c_str(), "remove", NULL, NULL);
             if (RT_FAILURE(rc))
-                progress->notifyComplete(E_FAIL,
-                                         COM_IIDOF(IHostNetworkInterface),
-                                         HostNetworkInterface::getStaticComponentName(),
-                                         "Failed to execute '"VBOXNETADPCTL_NAME "' (exit status: %d)", rc);
+                progress->i_notifyComplete(E_FAIL,
+                                           COM_IIDOF(IHostNetworkInterface),
+                                           HostNetworkInterface::getStaticComponentName(),
+                                           "Failed to execute '" VBOXNETADPCTL_NAME "' (exit status: %d)", rc);
             else
-                progress->notifyComplete(S_OK);
+                progress->i_notifyComplete(S_OK);
         }
     }
     else
     {
-        progress->notifyComplete(hr);
+        progress->i_notifyComplete(hr);
         rc = VERR_INTERNAL_ERROR;
     }
     return rc;
 #else
-    NOREF(pVBox);
+    NOREF(pVirtualBox);
     NOREF(aId);
     NOREF(aProgress);
     return VERR_NOT_IMPLEMENTED;
diff --git a/src/VBox/Main/src-server/linux/HostHardwareLinux.cpp b/src/VBox/Main/src-server/linux/HostHardwareLinux.cpp
index 1ff26d8..be52f53 100644
--- a/src/VBox/Main/src-server/linux/HostHardwareLinux.cpp
+++ b/src/VBox/Main/src-server/linux/HostHardwareLinux.cpp
@@ -85,8 +85,6 @@ static void setNoProbe(bool val) { (void)val; }
 
 static int getDriveInfoFromEnv(const char *pcszVar, DriveInfoList *pList,
                                bool isDVD, bool *pfSuccess);
-static int getDriveInfoFromDev(DriveInfoList *pList, bool isDVD,
-                               bool *pfSuccess);
 static int getDriveInfoFromSysfs(DriveInfoList *pList, bool isDVD,
                                  bool *pfSuccess);
 
@@ -468,9 +466,6 @@ int VBoxMainDriveInfo::updateDVDs ()
             setNoProbe(true);
             rc = getDriveInfoFromSysfs(&mDVDList, true /* isDVD */, &success);
         }
-        /* Walk through the /dev subtree if nothing else has helped. */
-        if (RT_SUCCESS(rc) && (!success | testing()))
-            rc = getDriveInfoFromDev(&mDVDList, true /* isDVD */, &success);
     }
     catch(std::bad_alloc &e)
     {
@@ -500,10 +495,6 @@ int VBoxMainDriveInfo::updateFloppies ()
             setNoProbe(true);
             rc = getDriveInfoFromSysfs(&mFloppyList, false /* isDVD */, &success);
         }
-        /* Walk through the /dev subtree if nothing else has helped. */
-        if (   RT_SUCCESS(rc) && (!success || testing()))
-            rc = getDriveInfoFromDev(&mFloppyList, false /* isDVD */,
-                                     &success);
     }
     catch(std::bad_alloc &e)
     {
@@ -621,8 +612,8 @@ private:
             misConsistent = false;
             return false;
         }
-        if (RTLinuxFindDevicePath(dev, RTFS_TYPE_DEV_BLOCK, mszNode,
-                                  sizeof(mszNode), "%s", mpcszName) < 0)
+        if (RTLinuxCheckDevicePath(dev, RTFS_TYPE_DEV_BLOCK, mszNode,
+                                   sizeof(mszNode), "%s", mpcszName) < 0)
             return false;
         return true;
     }
@@ -808,170 +799,6 @@ int getDriveInfoFromSysfs(DriveInfoList *pList, bool isDVD, bool *pfSuccess)
 }
 
 
-/** Structure for holding information about a drive we have found */
-struct deviceNodeInfo
-{
-    /** The device number */
-    dev_t Device;
-    /** The device node path */
-    char szPath[RTPATH_MAX];
-    /** The device description */
-    char szDesc[256];
-    /** The device UDI */
-    char szUdi[256];
-};
-
-/** The maximum number of devices we will search for. */
-enum { MAX_DEVICE_NODES = 8 };
-/** An array of MAX_DEVICE_NODES devices */
-typedef struct deviceNodeInfo deviceNodeArray[MAX_DEVICE_NODES];
-
-/**
- * Recursive worker function to walk the /dev tree looking for DVD or floppy
- * devices.
- * @returns true if we have already found MAX_DEVICE_NODES devices, false
- *          otherwise
- * @param   pszPath   the path to start recursing.  The function can modify
- *                    this string at and after the terminating zero
- * @param   cchPath   the size of the buffer (not the string!) in @a pszPath
- * @param   aDevices  where to fill in information about devices that we have
- *                    found
- * @param   wantDVD   are we looking for DVD devices (or floppies)?
- */
-static bool devFindDeviceRecursive(char *pszPath, size_t cchPath,
-                                   deviceNodeArray aDevices, bool wantDVD)
-{
-    /*
-     * Check assumptions made by the code below.
-     */
-    size_t const cchBasePath = strlen(pszPath);
-    AssertReturn(cchBasePath < RTPATH_MAX - 10U, false);
-    AssertReturn(pszPath[cchBasePath - 1] != '/', false);
-
-    PRTDIR  pDir;
-    if (RT_FAILURE(RTDirOpen(&pDir, pszPath)))
-        return false;
-    for (;;)
-    {
-        RTDIRENTRY Entry;
-        RTFSOBJINFO ObjInfo;
-        int rc = RTDirRead(pDir, &Entry, NULL);
-        if (RT_FAILURE(rc))
-            break;
-        if (Entry.enmType == RTDIRENTRYTYPE_UNKNOWN)
-        {
-            if (RT_FAILURE(RTPathQueryInfo(pszPath, &ObjInfo,
-                           RTFSOBJATTRADD_UNIX)))
-                continue;
-            if (RTFS_IS_SYMLINK(ObjInfo.Attr.fMode))
-                continue;
-        }
-
-        if (Entry.enmType == RTDIRENTRYTYPE_SYMLINK)
-            continue;
-        pszPath[cchBasePath] = '\0';
-        if (RT_FAILURE(RTPathAppend(pszPath, cchPath, Entry.szName)))
-            break;
-
-        /* Do the matching. */
-        dev_t DevNode;
-        char szDesc[256], szUdi[256];
-        if (!devValidateDevice(pszPath, wantDVD, &DevNode, szDesc,
-                               sizeof(szDesc), szUdi, sizeof(szUdi)))
-            continue;
-        unsigned i;
-        for (i = 0; i < MAX_DEVICE_NODES; ++i)
-            if (!aDevices[i].Device || (aDevices[i].Device == DevNode))
-                break;
-        AssertBreak(i < MAX_DEVICE_NODES);
-        if (aDevices[i].Device)
-            continue;
-        aDevices[i].Device = DevNode;
-        RTStrPrintf(aDevices[i].szPath, sizeof(aDevices[i].szPath),
-                    "%s", pszPath);
-        AssertCompile(sizeof(aDevices[i].szDesc) == sizeof(szDesc));
-        strcpy(aDevices[i].szDesc, szDesc);
-        AssertCompile(sizeof(aDevices[i].szUdi) == sizeof(szUdi));
-        strcpy(aDevices[i].szUdi, szUdi);
-        if (i == MAX_DEVICE_NODES - 1)
-            break;
-        continue;
-
-        /* Recurse into subdirectories. */
-        if (   (Entry.enmType == RTDIRENTRYTYPE_UNKNOWN)
-            && !RTFS_IS_DIRECTORY(ObjInfo.Attr.fMode))
-            continue;
-        if (Entry.enmType != RTDIRENTRYTYPE_DIRECTORY)
-            continue;
-        if (Entry.szName[0] == '.')
-            continue;
-
-        if (devFindDeviceRecursive(pszPath, cchPath, aDevices, wantDVD))
-            break;
-    }
-    RTDirClose(pDir);
-    return aDevices[MAX_DEVICE_NODES - 1].Device ? true : false;
-}
-
-
-/**
- * Recursively walk through the /dev tree and add any DVD or floppy drives we
- * find and can access to our list.  (If we can't access them we can't check
- * whether or not they are really DVD or floppy drives).
- * @note  this is rather slow (a couple of seconds) for DVD probing on
- *        systems with a static /dev tree, as the current code tries to open
- *        any device node with a major/minor combination that could belong to
- *        a CD-ROM device, and opening a non-existent device can take a non.
- *        negligible time on Linux.  If it is ever necessary to improve this
- *        (static /dev trees are no longer very fashionable these days, and
- *        sysfs looks like it will be with us for a while), we could further
- *        reduce the number of device nodes we open by checking whether the
- *        driver is actually loaded in /proc/devices, and by counting the
- *        of currently attached SCSI CD-ROM devices in /proc/scsi/scsi (yes,
- *        there is a race, but it is probably not important for us).
- * @returns iprt status code
- * @param   pList      the list to append the drives found to
- * @param   isDVD      are we looking for DVD drives or for floppies?
- * @param   pfSuccess  this will be set to true if we found at least one drive
- *                     and to false otherwise.  Optional.
- */
-/* static */
-int getDriveInfoFromDev(DriveInfoList *pList, bool isDVD, bool *pfSuccess)
-{
-    AssertPtrReturn(pList, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(pfSuccess, VERR_INVALID_POINTER);
-    LogFlowFunc(("pList=%p, isDVD=%d, pfSuccess=%p\n", pList, isDVD,
-                 pfSuccess));
-    int rc = VINF_SUCCESS;
-    bool success = false;
-
-    char szPath[RTPATH_MAX] = "/dev";
-    deviceNodeArray aDevices;
-    RT_ZERO(aDevices);
-    devFindDeviceRecursive(szPath, sizeof(szPath), aDevices, isDVD);
-    try
-    {
-        for (unsigned i = 0; i < MAX_DEVICE_NODES; ++i)
-        {
-            if (aDevices[i].Device)
-            {
-                pList->push_back(DriveInfo(aDevices[i].szPath,
-                                 aDevices[i].szUdi, aDevices[i].szDesc));
-                success = true;
-            }
-        }
-        if (pfSuccess != NULL)
-            *pfSuccess = success;
-    }
-    catch(std::bad_alloc &e)
-    {
-        rc = VERR_NO_MEMORY;
-    }
-    LogFlowFunc (("rc=%Rrc, success=%d\n", rc, success));
-    return rc;
-}
-
-
 /** Helper for readFilePathsFromDir().  Adds a path to the vector if it is not
  * NULL and not a dotfile (".", "..", ".*"). */
 static int maybeAddPathToVector(const char *pcszPath, const char *pcszEntry,
diff --git a/src/VBox/Main/src-server/linux/HostPowerLinux.cpp b/src/VBox/Main/src-server/linux/HostPowerLinux.cpp
new file mode 100644
index 0000000..aa83021
--- /dev/null
+++ b/src/VBox/Main/src-server/linux/HostPowerLinux.cpp
@@ -0,0 +1,144 @@
+/** @file
+ *
+ * VirtualBox interface to host's power notification service
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "HostPower.h"
+#include "Logging.h"
+
+#include <iprt/asm.h>
+#include <iprt/power.h>
+#include <iprt/time.h>
+
+static bool checkDBusError(DBusError *pError, DBusConnection *pConnection)
+{
+    if (dbus_error_is_set(pError))
+    {
+        LogRel(("HostPowerServiceLinux: DBus connection Error (%s)\n", pError->message));
+        dbus_error_free(pError);
+        /* Close the socket or whatever underlying the connection. */
+        dbus_connection_close(pConnection);
+        /* Free in-process resources used for the now-closed connection. */
+        dbus_connection_unref(pConnection);
+        return true;
+    }
+    return false;
+}
+
+HostPowerServiceLinux::HostPowerServiceLinux(VirtualBox *aVirtualBox)
+  : HostPowerService(aVirtualBox)
+  , mThread(NULL)
+  , mpConnection(NULL)
+{
+    DBusError error;
+    int rc;
+
+    rc = RTDBusLoadLib();
+    if (RT_FAILURE(rc))
+    {
+        LogRel(("HostPowerServiceLinux: DBus library not found.  Service not available.\n"));
+        return;
+    }
+    dbus_error_init(&error);
+    /* Connect to the DBus.  The connection will be not shared with any other
+     * in-process callers of dbus_bus_get().  This is considered wasteful (see
+     * API documentation) but simplifies our code, specifically shutting down.
+     * The session bus allows up to 100000 connections per user as it "is just
+     * running as the user anyway" (see session.conf.in in the DBus sources). */
+    mpConnection = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
+    if (checkDBusError(&error, mpConnection))
+        return;
+    /* We do not want to exit(1) if the connection is broken. */
+    dbus_connection_set_exit_on_disconnect(mpConnection, FALSE);
+    /* Tell the bus to wait for the sleep signal(s). */
+    /* The current systemd-logind interface. */
+    dbus_bus_add_match(mpConnection, "type='signal',interface='org.freedesktop.login1.Manager'", &error);
+    /* The previous UPower interfaces (2010 - ca 2013). */
+    dbus_bus_add_match(mpConnection, "type='signal',interface='org.freedesktop.UPower'", &error);
+    dbus_connection_flush(mpConnection);
+    if (checkDBusError(&error, mpConnection))
+        return;
+    /* Create the new worker thread. */
+    rc = RTThreadCreate(&mThread, HostPowerServiceLinux::powerChangeNotificationThread, this, 0 /* cbStack */,
+                        RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, "MainPower");
+    if (RT_FAILURE(rc))
+        LogRel(("HostPowerServiceLinux: RTThreadCreate failed with %Rrc\n", rc));
+}
+
+
+HostPowerServiceLinux::~HostPowerServiceLinux()
+{
+    /* Closing the connection should cause the event loop to exit. */
+    LogFunc((": Stopping thread\n"));
+    dbus_connection_close(mpConnection);
+
+    RTThreadWait(mThread, 5000, NULL);
+    mThread = NIL_RTTHREAD;
+}
+
+
+DECLCALLBACK(int) HostPowerServiceLinux::powerChangeNotificationThread(RTTHREAD hThreadSelf, void *pInstance)
+{
+    NOREF(hThreadSelf);
+    HostPowerServiceLinux *pPowerObj = static_cast<HostPowerServiceLinux *>(pInstance);
+
+    Log(("HostPowerServiceLinux: Thread started\n"));
+    while (dbus_connection_read_write(pPowerObj->mpConnection, -1))
+    {
+        DBusMessage *pMessage = NULL;
+
+        for (;;)
+        {
+            DBusMessageIter args;
+            dbus_bool_t fSuspend;
+
+            pMessage = dbus_connection_pop_message(pPowerObj->mpConnection);
+            if (pMessage == NULL)
+                break;
+            /* The systemd-logind interface notification. */
+            if (   dbus_message_is_signal(pMessage, "org.freedesktop.login1.Manager", "PrepareForSleep")
+                && dbus_message_iter_init(pMessage, &args)
+                && dbus_message_iter_get_arg_type(&args) == DBUS_TYPE_BOOLEAN)
+            {
+                dbus_message_iter_get_basic(&args, &fSuspend);
+                /* Trinary operator does not work here as Reason_... is an
+                 * anonymous enum. */
+                if (fSuspend)
+                    pPowerObj->notify(Reason_HostSuspend);
+                else
+                    pPowerObj->notify(Reason_HostResume);
+            }
+            /* The UPowerd interface notifications.  Sleeping is the older one,
+             * NotifySleep the newer.  This gives us one second grace before the
+             * suspend triggers. */
+            if (   dbus_message_is_signal(pMessage, "org.freedesktop.UPower", "Sleeping")
+                || dbus_message_is_signal(pMessage, "org.freedesktop.UPower", "NotifySleep"))
+                pPowerObj->notify(Reason_HostSuspend);
+            if (   dbus_message_is_signal(pMessage, "org.freedesktop.UPower", "Resuming")
+                || dbus_message_is_signal(pMessage, "org.freedesktop.UPower", "NotifyResume"))
+                pPowerObj->notify(Reason_HostResume);
+            /* Free local resources held for the message. */
+            dbus_message_unref(pMessage);
+        }
+    }
+    /* Close the socket or whatever underlying the connection. */
+    dbus_connection_close(pPowerObj->mpConnection);
+    /* Free in-process resources used for the now-closed connection. */
+    dbus_connection_unref(pPowerObj->mpConnection);
+    pPowerObj->mpConnection = NULL;
+    Log(("HostPowerServiceLinux: Exiting thread\n"));
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Main/src-server/linux/PerformanceLinux.cpp b/src/VBox/Main/src-server/linux/PerformanceLinux.cpp
index 77ccb9b..7ccf5d1 100644
--- a/src/VBox/Main/src-server/linux/PerformanceLinux.cpp
+++ b/src/VBox/Main/src-server/linux/PerformanceLinux.cpp
@@ -117,7 +117,7 @@ int CollectorLinux::preCollect(const CollectorHints& hints, uint64_t /* iTick */
     hints.getProcesses(processes);
 
     std::vector<RTPROCESS>::iterator it;
-    for (it = processes.begin(); it != processes.end(); it++)
+    for (it = processes.begin(); it != processes.end(); ++it)
     {
         VMProcessStats vmStats;
         int rc = getRawProcessStats(*it, &vmStats.cpuUser, &vmStats.cpuKernel, &vmStats.pagesUsed);
diff --git a/src/VBox/Main/src-server/linux/USBGetDevices.cpp b/src/VBox/Main/src-server/linux/USBGetDevices.cpp
index f0aeedd..a88fcbd 100644
--- a/src/VBox/Main/src-server/linux/USBGetDevices.cpp
+++ b/src/VBox/Main/src-server/linux/USBGetDevices.cpp
@@ -363,6 +363,8 @@ static int usbReadSpeed(const char *pszValue, USBDEVICESPEED *pSpd, char **ppszN
         *pSpd = USBDEVICESPEED_FULL;
     else if (!strncmp(pszValue, RT_STR_TUPLE("480")))
         *pSpd = USBDEVICESPEED_HIGH;
+    else if (!strncmp(pszValue, RT_STR_TUPLE("5000")))
+        *pSpd = USBDEVICESPEED_SUPER;
     else
         *pSpd = USBDEVICESPEED_UNKNOWN;
     while (pszValue[0] != '\0' && !RT_C_IS_SPACE(pszValue[0]))
@@ -465,7 +467,8 @@ static USBDEVICESTATE usbDeterminState(PCUSBDEVICE pDevice)
 
 
 /** Just a worker for USBProxyServiceLinux::getDevices that avoids some code duplication. */
-static int addDeviceToChain(PUSBDEVICE pDev, PUSBDEVICE *ppFirst, PUSBDEVICE **pppNext, const char *pcszUsbfsRoot, bool testfs, int rc)
+static int addDeviceToChain(PUSBDEVICE pDev, PUSBDEVICE *ppFirst, PUSBDEVICE **pppNext, const char *pcszUsbfsRoot,
+                            bool testfs, int rc)
 {
     /* usbDeterminState requires the address. */
     PUSBDEVICE pDevNew = (PUSBDEVICE)RTMemDup(pDev, sizeof(*pDev));
@@ -881,10 +884,10 @@ static int addIfDevice(const char *pcszDevicesRoot,
         return VINF_SUCCESS;
     char szDevPath[RTPATH_MAX];
     ssize_t cchDevPath;
-    cchDevPath = RTLinuxFindDevicePath(devnum, RTFS_TYPE_DEV_CHAR,
-                                       szDevPath, sizeof(szDevPath),
-                                       "%s/%.3d/%.3d",
-                                       pcszDevicesRoot, bus, device);
+    cchDevPath = RTLinuxCheckDevicePath(devnum, RTFS_TYPE_DEV_CHAR,
+                                        szDevPath, sizeof(szDevPath),
+                                        "%s/%.3d/%.3d",
+                                        pcszDevicesRoot, bus, device);
     if (cchDevPath < 0)
         return VINF_SUCCESS;
 
@@ -1176,6 +1179,7 @@ DECLINLINE(void) usbLogDevice(PUSBDEVICE pDev)
           : pDev->enmSpeed == USBDEVICESPEED_LOW      ? "1.5 MBit/s"
           : pDev->enmSpeed == USBDEVICESPEED_FULL     ? "12 MBit/s"
           : pDev->enmSpeed == USBDEVICESPEED_HIGH     ? "480 MBit/s"
+          : pDev->enmSpeed == USBDEVICESPEED_SUPER    ? "5.0 GBit/s"
           : pDev->enmSpeed == USBDEVICESPEED_VARIABLE ? "variable"
           :                                             "invalid"));
     Log3(("Number of configurations: %d\n", pDev->bNumConfigurations));
@@ -1262,9 +1266,10 @@ static void fillInDeviceFromSysfs(USBDEVICE *Dev, USBDeviceInfo *pInfo)
     if (cchRead <= 0 || (size_t) cchRead == sizeof(szBuf))
         Dev->enmState = USBDEVICESTATE_UNSUPPORTED;
     else
-        Dev->enmSpeed =   !strcmp(szBuf, "1.5") ? USBDEVICESPEED_LOW
-                        : !strcmp(szBuf, "12")  ? USBDEVICESPEED_FULL
-                        : !strcmp(szBuf, "480") ? USBDEVICESPEED_HIGH
+        Dev->enmSpeed =   !strcmp(szBuf, "1.5")  ? USBDEVICESPEED_LOW
+                        : !strcmp(szBuf, "12")   ? USBDEVICESPEED_FULL
+                        : !strcmp(szBuf, "480")  ? USBDEVICESPEED_HIGH
+                        : !strcmp(szBuf, "5000") ? USBDEVICESPEED_SUPER
                         : USBDEVICESPEED_UNKNOWN;
 
     cchRead = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), "%s/version",
@@ -1469,6 +1474,8 @@ static PUSBDEVICE testGetUsbfsDevices(const char *pcszUsbfsRoot, bool testfs)
             pNext->pszAddress = RTStrDup(*pcsz);
         if (!pNext || !pNext->pszAddress)
         {
+            if (pNext)
+                RTMemFree(pNext);
             deviceListFree(&pList);
             return NULL;
         }
diff --git a/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp b/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
index 82c97aa..a613c8a 100644
--- a/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
+++ b/src/VBox/Main/src-server/linux/USBProxyServiceLinux.cpp
@@ -225,12 +225,12 @@ int USBProxyServiceLinux::captureDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
     /*
      * Don't think we need to do anything when the device is held... fake it.
      */
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_Capturing);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_Capturing);
     devLock.release();
     interruptWait();
 
@@ -244,12 +244,12 @@ int USBProxyServiceLinux::releaseDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
     /*
      * We're not really holding it atm., just fake it.
      */
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_ReleasingToHost);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_ReleasingToHost);
     devLock.release();
     interruptWait();
 
@@ -257,7 +257,8 @@ int USBProxyServiceLinux::releaseDevice(HostUSBDevice *aDevice)
 }
 
 
-bool USBProxyServiceLinux::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool USBProxyServiceLinux::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters,
+                                             SessionMachine **aIgnoreMachine)
 {
     AssertReturn(aDevice, false);
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false);
@@ -276,7 +277,8 @@ bool USBProxyServiceLinux::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE
  *
  * See USBProxyService::deviceAdded for details.
  */
-void USBProxyServiceLinux::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice)
+void USBProxyServiceLinux::deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines,
+                                       PUSBDEVICE aUSBDevice)
 {
     AssertReturnVoid(aDevice);
     AssertReturnVoid(!aDevice->isWriteLockOnCurrentThread());
diff --git a/src/VBox/Main/src-server/linux/vbox-libhal.cpp b/src/VBox/Main/src-server/linux/vbox-libhal.cpp
index ade8f07..30da016 100644
--- a/src/VBox/Main/src-server/linux/vbox-libhal.cpp
+++ b/src/VBox/Main/src-server/linux/vbox-libhal.cpp
@@ -1,3 +1,4 @@
+/* $Id: vbox-libhal.cpp $ */
 /** @file
  *
  * Module to dynamically load libhal and libdbus and load all symbols
diff --git a/src/VBox/Main/src-server/os2/USBProxyServiceOs2.cpp b/src/VBox/Main/src-server/os2/USBProxyServiceOs2.cpp
index d74f116..c6284b0 100644
--- a/src/VBox/Main/src-server/os2/USBProxyServiceOs2.cpp
+++ b/src/VBox/Main/src-server/os2/USBProxyServiceOs2.cpp
@@ -165,7 +165,8 @@ int USBProxyServiceOs2::releaseDevice(HostUSBDevice *aDevice)
 }
 
 
-bool USBProxyServiceOs2::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool USBProxyServiceOs2::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters,
+                                           SessionMachine **aIgnoreMachine)
 {
     AssertReturn(aDevice, false);
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false);
diff --git a/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp b/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp
index 073828f..78056b1 100644
--- a/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp
+++ b/src/VBox/Main/src-server/solaris/NetIf-solaris.cpp
@@ -127,7 +127,8 @@ static void queryIfaceSpeed(PNETIFINFO pInfo)
 
 static void vboxSolarisAddHostIface(char *pszIface, int Instance, void *pvHostNetworkInterfaceList)
 {
-    std::list<ComObjPtr<HostNetworkInterface> > *pList = (std::list<ComObjPtr<HostNetworkInterface> > *)pvHostNetworkInterfaceList;
+    std::list<ComObjPtr<HostNetworkInterface> > *pList =
+        (std::list<ComObjPtr<HostNetworkInterface> > *)pvHostNetworkInterfaceList;
     Assert(pList);
 
     typedef std::map <std::string, std::string> NICMap;
diff --git a/src/VBox/Main/src-server/solaris/USBProxyServiceSolaris.cpp b/src/VBox/Main/src-server/solaris/USBProxyServiceSolaris.cpp
index 0d6d85e..f48ab36 100644
--- a/src/VBox/Main/src-server/solaris/USBProxyServiceSolaris.cpp
+++ b/src/VBox/Main/src-server/solaris/USBProxyServiceSolaris.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2005-2012 Oracle Corporation
+ * Copyright (C) 2005-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -283,7 +283,9 @@ static int solarisWalkDeviceNode(di_node_t Node, void *pvArg)
             if (di_prop_lookup_strings(DDI_DEV_T_ANY, Node, "usb-serialno", &pStr) > 0)
                 pCur->pszSerialNumber = RTStrDup(pStr);
 
-            if (di_prop_lookup_ints(DDI_DEV_T_ANY, Node, "low-speed", &pInt) >= 0)
+            if (pCur->bcdUSB == 0x300)
+                pCur->enmSpeed = USBDEVICESPEED_SUPER;
+            else if (di_prop_lookup_ints(DDI_DEV_T_ANY, Node, "low-speed", &pInt) >= 0)
                 pCur->enmSpeed = USBDEVICESPEED_LOW;
             else if (di_prop_lookup_ints(DDI_DEV_T_ANY, Node, "high-speed", &pInt) >= 0)
                 pCur->enmSpeed = USBDEVICESPEED_HIGH;
@@ -339,9 +341,9 @@ int USBProxyServiceSolaris::captureDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_Capturing);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_Capturing);
     AssertReturn(aDevice->mUsb, VERR_INVALID_POINTER);
 
     /*
@@ -378,7 +380,7 @@ void USBProxyServiceSolaris::captureDeviceCompleted(HostUSBDevice *aDevice, bool
     /*
      * Remove the one-shot filter if necessary.
      */
-    LogFlowThisFunc(("aDevice=%s aSuccess=%RTbool mOneShotId=%p\n", aDevice->getName().c_str(), aSuccess, aDevice->mOneShotId));
+    LogFlowThisFunc(("aDevice=%s aSuccess=%RTbool mOneShotId=%p\n", aDevice->i_getName().c_str(), aSuccess, aDevice->mOneShotId));
     if (!aSuccess && aDevice->mOneShotId)
         USBLibRemoveFilter(aDevice->mOneShotId);
     aDevice->mOneShotId = NULL;
@@ -394,9 +396,9 @@ int USBProxyServiceSolaris::releaseDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_ReleasingToHost);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_ReleasingToHost);
     AssertReturn(aDevice->mUsb, VERR_INVALID_POINTER);
 
     /*
@@ -433,14 +435,15 @@ void USBProxyServiceSolaris::releaseDeviceCompleted(HostUSBDevice *aDevice, bool
     /*
      * Remove the one-shot filter if necessary.
      */
-    LogFlowThisFunc(("aDevice=%s aSuccess=%RTbool mOneShotId=%p\n", aDevice->getName().c_str(), aSuccess, aDevice->mOneShotId));
+    LogFlowThisFunc(("aDevice=%s aSuccess=%RTbool mOneShotId=%p\n", aDevice->i_getName().c_str(), aSuccess, aDevice->mOneShotId));
     if (!aSuccess && aDevice->mOneShotId)
         USBLibRemoveFilter(aDevice->mOneShotId);
     aDevice->mOneShotId = NULL;
 }
 
 
-bool USBProxyServiceSolaris::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool USBProxyServiceSolaris::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters,
+                                               SessionMachine **aIgnoreMachine)
 {
     AssertReturn(aDevice, false);
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false);
diff --git a/src/VBox/Main/src-server/win/HostPowerWin.cpp b/src/VBox/Main/src-server/win/HostPowerWin.cpp
index ff0f5dd..1e3e40e 100644
--- a/src/VBox/Main/src-server/win/HostPowerWin.cpp
+++ b/src/VBox/Main/src-server/win/HostPowerWin.cpp
@@ -1,3 +1,4 @@
+/* $Id: HostPowerWin.cpp $ */
 /** @file
  *
  * VirtualBox interface to host's power notification service
@@ -171,7 +172,8 @@ LRESULT CALLBACK HostPowerServiceWin::WndProc(HWND hwnd, UINT msg, WPARAM wParam
                     Log(("PBT_APMPOWERSTATUSCHANGE\n"));
                     if (GetSystemPowerStatus(&SystemPowerStatus) == TRUE)
                     {
-                        Log(("PBT_APMPOWERSTATUSCHANGE ACLineStatus=%d BatteryFlag=%d\n", SystemPowerStatus.ACLineStatus, SystemPowerStatus.BatteryFlag));
+                        Log(("PBT_APMPOWERSTATUSCHANGE ACLineStatus=%d BatteryFlag=%d\n", SystemPowerStatus.ACLineStatus,
+                             SystemPowerStatus.BatteryFlag));
 
                         if (SystemPowerStatus.ACLineStatus == 0)      /* offline */
                         {
@@ -180,10 +182,12 @@ LRESULT CALLBACK HostPowerServiceWin::WndProc(HWND hwnd, UINT msg, WPARAM wParam
                                 LONG rc;
                                 SYSTEM_BATTERY_STATE BatteryState;
 
-                                rc = CallNtPowerInformation(SystemBatteryState, NULL, 0, (PVOID)&BatteryState, sizeof(BatteryState));
+                                rc = CallNtPowerInformation(SystemBatteryState, NULL, 0, (PVOID)&BatteryState,
+                                                            sizeof(BatteryState));
 #ifdef LOG_ENABLED
                                 if (rc == 0 /* STATUS_SUCCESS */)
-                                    Log(("CallNtPowerInformation claims %d seconds of power left\n", BatteryState.EstimatedTime));
+                                    Log(("CallNtPowerInformation claims %d seconds of power left\n",
+                                         BatteryState.EstimatedTime));
 #endif
                                 if (    rc == 0 /* STATUS_SUCCESS */
                                     &&  BatteryState.EstimatedTime < 60*5)
@@ -192,7 +196,8 @@ LRESULT CALLBACK HostPowerServiceWin::WndProc(HWND hwnd, UINT msg, WPARAM wParam
                                 }
                             }
                             else
-                            /* If the machine has less than 5% battery left (and is not connected to the AC), then we should save the state. */
+                            /* If the machine has less than 5% battery left (and is not connected
+                             * to the AC), then we should save the state. */
                             if (SystemPowerStatus.BatteryFlag == 4      /* critical battery status; less than 5% */)
                             {
                                 pPowerObj->notify(Reason_HostBatteryLow);
diff --git a/src/VBox/Main/src-server/win/NetIf-win.cpp b/src/VBox/Main/src-server/win/NetIf-win.cpp
index 3b86dab..bf0f964 100644
--- a/src/VBox/Main/src-server/win/NetIf-win.cpp
+++ b/src/VBox/Main/src-server/win/NetIf-win.cpp
@@ -319,7 +319,7 @@ static HRESULT netIfNetworkInterfaceHelperClient(SVCHlpClient *aClient,
                         rc = d->iface->init(Bstr(name), Bstr(name), guid, HostNetworkInterfaceType_HostOnly);
                         if (SUCCEEDED(rc))
                         {
-                            rc = d->iface->setVirtualBox(d->vBox);
+                            rc = d->iface->i_setVirtualBox(d->vBox);
                             if (SUCCEEDED(rc))
                             {
                                 rc = d->iface->updateConfig();
@@ -667,7 +667,8 @@ int netIfNetworkInterfaceHelperServer(SVCHlpClient *aClient,
             Bstr name;
             Bstr bstrErr;
 
-            hrc = VBoxNetCfgWinCreateHostOnlyNetworkInterface(NULL, false, guid.asOutParam(), name.asOutParam(), bstrErr.asOutParam());
+            hrc = VBoxNetCfgWinCreateHostOnlyNetworkInterface(NULL, false, guid.asOutParam(), name.asOutParam(),
+                                                              bstrErr.asOutParam());
 
             if (hrc == S_OK)
             {
@@ -1109,7 +1110,7 @@ int NetIfGetLinkSpeed(const char * /*pcszIfName*/, uint32_t * /*puMbits*/)
     return VERR_NOT_IMPLEMENTED;
 }
 
-int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
+int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVirtualBox,
                                         IHostNetworkInterface **aHostNetworkInterface,
                                         IProgress **aProgress,
                                         const char *pcszName)
@@ -1122,10 +1123,10 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
     progress.createObject();
 
     ComPtr<IHost> host;
-    HRESULT rc = pVBox->COMGETTER(Host)(host.asOutParam());
+    HRESULT rc = pVirtualBox->COMGETTER(Host)(host.asOutParam());
     if (SUCCEEDED(rc))
     {
-        rc = progress->init(pVBox, host,
+        rc = progress->init(pVirtualBox, host,
                             Bstr(_T("Creating host only network interface")).raw(),
                             FALSE /* aCancelable */);
         if (SUCCEEDED(rc))
@@ -1146,13 +1147,12 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
             d->msgCode = SVCHlpMsg::CreateHostOnlyNetworkInterface;
 //            d->name = aName;
             d->iface = iface;
-            d->vBox = pVBox;
-
-            rc = pVBox->startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
-                                             netIfNetworkInterfaceHelperClient,
-                                             static_cast<void *>(d.get()),
-                                             progress);
+            d->vBox = pVirtualBox;
 
+            rc = pVirtualBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
+                                                     netIfNetworkInterfaceHelperClient,
+                                                     static_cast<void *>(d.get()),
+                                                     progress);
             if (SUCCEEDED(rc))
             {
                 /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */
@@ -1165,7 +1165,7 @@ int NetIfCreateHostOnlyNetworkInterface(VirtualBox *pVBox,
 #endif
 }
 
-int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVBox, IN_GUID aId,
+int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVirtualBox, IN_GUID aId,
                                         IProgress **aProgress)
 {
 #ifndef VBOX_WITH_NETFLT
@@ -1175,10 +1175,10 @@ int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVBox, IN_GUID aId,
     ComObjPtr<Progress> progress;
     progress.createObject();
     ComPtr<IHost> host;
-    HRESULT rc = pVBox->COMGETTER(Host)(host.asOutParam());
+    HRESULT rc = pVirtualBox->COMGETTER(Host)(host.asOutParam());
     if (SUCCEEDED(rc))
     {
-        rc = progress->init(pVBox, host,
+        rc = progress->init(pVirtualBox, host,
                            Bstr(_T("Removing host network interface")).raw(),
                            FALSE /* aCancelable */);
         if (SUCCEEDED(rc))
@@ -1194,10 +1194,10 @@ int NetIfRemoveHostOnlyNetworkInterface(VirtualBox *pVBox, IN_GUID aId,
             d->msgCode = SVCHlpMsg::RemoveHostOnlyNetworkInterface;
             d->guid = aId;
 
-            rc = pVBox->startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
-                                             netIfNetworkInterfaceHelperClient,
-                                             static_cast<void *>(d.get()),
-                                             progress);
+            rc = pVirtualBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
+                                                     netIfNetworkInterfaceHelperClient,
+                                                     static_cast<void *>(d.get()),
+                                                     progress);
 
             if (SUCCEEDED(rc))
             {
@@ -1251,10 +1251,10 @@ int NetIfEnableStaticIpConfig(VirtualBox *vBox, HostNetworkInterface * pIf, ULON
                     d->u.StaticIP.IPAddress = ip;
                     d->u.StaticIP.IPNetMask = mask;
 
-                    rc = vBox->startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
-                                                    netIfNetworkInterfaceHelperClient,
-                                                    static_cast<void *>(d.get()),
-                                                    progress);
+                    rc = vBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
+                                                      netIfNetworkInterfaceHelperClient,
+                                                      static_cast<void *>(d.get()),
+                                                      progress);
 
                     if (SUCCEEDED(rc))
                     {
@@ -1272,7 +1272,8 @@ int NetIfEnableStaticIpConfig(VirtualBox *vBox, HostNetworkInterface * pIf, ULON
 #endif
 }
 
-int NetIfEnableStaticIpConfigV6(VirtualBox *vBox, HostNetworkInterface * pIf, IN_BSTR aOldIPV6Address, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
+int NetIfEnableStaticIpConfigV6(VirtualBox *vBox, HostNetworkInterface * pIf, IN_BSTR aOldIPV6Address,
+                                IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
 {
 #ifndef VBOX_WITH_NETFLT
     return VERR_NOT_IMPLEMENTED;
@@ -1312,10 +1313,10 @@ int NetIfEnableStaticIpConfigV6(VirtualBox *vBox, HostNetworkInterface * pIf, IN
                     d->u.StaticIPV6.IPV6Address = aIPV6Address;
                     d->u.StaticIPV6.IPV6NetMaskLength = aIPV6MaskPrefixLength;
 
-                    rc = vBox->startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
-                                                    netIfNetworkInterfaceHelperClient,
-                                                    static_cast<void *>(d.get()),
-                                                    progress);
+                    rc = vBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
+                                                      netIfNetworkInterfaceHelperClient,
+                                                      static_cast<void *>(d.get()),
+                                                      progress);
 
                     if (SUCCEEDED(rc))
                     {
@@ -1371,10 +1372,10 @@ int NetIfEnableDynamicIpConfig(VirtualBox *vBox, HostNetworkInterface * pIf)
                     d->guid = guid;
                     d->iface = pIf;
 
-                    rc = vBox->startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
-                                                    netIfNetworkInterfaceHelperClient,
-                                                    static_cast<void *>(d.get()),
-                                                    progress);
+                    rc = vBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
+                                                      netIfNetworkInterfaceHelperClient,
+                                                      static_cast<void *>(d.get()),
+                                                      progress);
 
                     if (SUCCEEDED(rc))
                     {
@@ -1430,10 +1431,10 @@ int NetIfDhcpRediscover(VirtualBox *vBox, HostNetworkInterface * pIf)
                     d->guid = guid;
                     d->iface = pIf;
 
-                    rc = vBox->startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
-                                                    netIfNetworkInterfaceHelperClient,
-                                                    static_cast<void *>(d.get()),
-                                                    progress);
+                    rc = vBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,
+                                                      netIfNetworkInterfaceHelperClient,
+                                                      static_cast<void *>(d.get()),
+                                                      progress);
 
                     if (SUCCEEDED(rc))
                     {
@@ -1479,8 +1480,13 @@ int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list)
         /* for the protocol-based approach for now we just get all miniports the MS_TCPIP protocol binds to */
         hr = pNc->FindComponent(L"MS_TCPIP", &pTcpIpNcc);
 # else
-        /* for the filter-based approach we get all miniports our filter (sun_VBoxNetFlt)is bound to */
-        hr = pNc->FindComponent(L"sun_VBoxNetFlt", &pTcpIpNcc);
+        /* for the filter-based approach we get all miniports our filter (oracle_VBoxNetLwf)is bound to */
+        hr = pNc->FindComponent(L"oracle_VBoxNetLwf", &pTcpIpNcc);
+        if (hr != S_OK)
+        {
+            /* fall back to NDIS5 miniport lookup (sun_VBoxNetFlt) */
+            hr = pNc->FindComponent(L"sun_VBoxNetFlt", &pTcpIpNcc);
+        }
 #  ifndef VBOX_WITH_HARDENING
         if (hr != S_OK)
         {
@@ -1530,7 +1536,22 @@ int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list)
                                                 {
                                                     if (uComponentStatus == 0)
                                                     {
-                                                        vboxNetWinAddComponent(&list, pMpNcc, HostNetworkInterfaceType_Bridged, iDefault);
+                                                        LPWSTR pId;
+                                                        hr = pMpNcc->GetId(&pId);
+                                                        Assert(hr == S_OK);
+                                                        if (hr == S_OK)
+                                                        {
+                                                            /*
+                                                             * Host-only interfaces are ignored here and included into the list
+                                                             * later in netIfListHostAdapters()
+                                                             */
+                                                            if (_wcsnicmp(pId, L"sun_VBoxNetAdp", sizeof(L"sun_VBoxNetAdp")/2))
+                                                            {
+                                                                vboxNetWinAddComponent(&list, pMpNcc, HostNetworkInterfaceType_Bridged,
+                                                                                       iDefault);
+                                                            }
+                                                            CoTaskMemFree(pId);
+                                                        }
                                                     }
                                                 }
                                                 pMpNcc->Release();
@@ -1554,12 +1575,13 @@ int NetIfList(std::list<ComObjPtr<HostNetworkInterface> > &list)
         }
         else
         {
-            LogRel(("failed to get the sun_VBoxNetFlt component, error (0x%x)\n", hr));
+            LogRel(("failed to get the oracle_VBoxNetLwf(sun_VBoxNetFlt) component, error (0x%x)\n", hr));
         }
 
         VBoxNetCfgWinReleaseINetCfg(pNc, FALSE);
     }
 
+    /* Add host-only adapters to the list */
     netIfListHostAdapters(list);
 
     return VINF_SUCCESS;
diff --git a/src/VBox/Main/src-server/win/PerformanceWin.cpp b/src/VBox/Main/src-server/win/PerformanceWin.cpp
index 74c2bf1..3776825 100644
--- a/src/VBox/Main/src-server/win/PerformanceWin.cpp
+++ b/src/VBox/Main/src-server/win/PerformanceWin.cpp
@@ -139,7 +139,7 @@ int CollectorWin::preCollect(const CollectorHints& hints, uint64_t /* iTick */)
 
     mProcessStats.clear();
 
-    for (it = processes.begin(); it != processes.end() && RT_SUCCESS(rc); it++)
+    for (it = processes.begin(); it != processes.end() && RT_SUCCESS(rc); ++it)
     {
         RTPROCESS process = it->first;
         HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
@@ -268,7 +268,8 @@ int CollectorWin::getHostCpuMHz(ULONG *mhz)
 {
     uint64_t uTotalMhz   = 0;
     RTCPUID  nProcessors = RTMpGetCount();
-    PPROCESSOR_POWER_INFORMATION ppi = (PPROCESSOR_POWER_INFORMATION)RTMemAllocZ(nProcessors * sizeof(PROCESSOR_POWER_INFORMATION));
+    PPROCESSOR_POWER_INFORMATION ppi = (PPROCESSOR_POWER_INFORMATION)
+                                       RTMemAllocZ(nProcessors * sizeof(PROCESSOR_POWER_INFORMATION));
 
     if (!ppi)
         return VERR_NO_MEMORY;
diff --git a/src/VBox/Main/src-server/win/USBProxyServiceWindows.cpp b/src/VBox/Main/src-server/win/USBProxyServiceWindows.cpp
index 8c8db31..c4788c5 100644
--- a/src/VBox/Main/src-server/win/USBProxyServiceWindows.cpp
+++ b/src/VBox/Main/src-server/win/USBProxyServiceWindows.cpp
@@ -143,9 +143,9 @@ int USBProxyServiceWindows::captureDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_Capturing);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_Capturing);
 
     /*
      * Create a one-shot ignore filter for the device
@@ -185,9 +185,9 @@ int USBProxyServiceWindows::releaseDevice(HostUSBDevice *aDevice)
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
 
     AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
-    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
+    LogFlowThisFunc(("aDevice=%s\n", aDevice->i_getName().c_str()));
 
-    Assert(aDevice->getUnistate() == kHostUSBDeviceState_ReleasingToHost);
+    Assert(aDevice->i_getUnistate() == kHostUSBDeviceState_ReleasingToHost);
 
     /*
      * Create a one-shot ignore filter for the device
@@ -219,35 +219,13 @@ int USBProxyServiceWindows::releaseDevice(HostUSBDevice *aDevice)
 }
 
 
-bool USBProxyServiceWindows::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
+bool USBProxyServiceWindows::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters,
+                                               SessionMachine **aIgnoreMachine)
 {
     AssertReturn(aDevice, false);
     AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false);
     /* Nothing special here so far, so fall back on parent */
     return USBProxyService::updateDeviceState(aDevice, aUSBDevice, aRunFilters, aIgnoreMachine);
-
-/// @todo remove?
-#if 0
-
-    /*
-     * We're only called in the 'existing device' state, so if there is a pending async
-     * operation we can check if it completed here and suppress state changes if it hasn't.
-     */
-    /* TESTME */
-    if (aDevice->isStatePending())
-    {
-        bool fRc = aDevice->updateState(aUSBDevice);
-        if (fRc)
-        {
-            if (aDevice->state() != aDevice->pendingState())
-                fRc = false;
-        }
-        return fRc;
-    }
-
-    /* fall back on parent. */
-    return USBProxyService::updateDeviceState(aDevice, aUSBDevice, aRunFilters, aIgnoreMachine);
-#endif
 }
 
 
diff --git a/src/VBox/Main/src-server/win/VBoxComEvents.cpp b/src/VBox/Main/src-server/win/VBoxComEvents.cpp
index cca2f39..67d992b 100644
--- a/src/VBox/Main/src-server/win/VBoxComEvents.cpp
+++ b/src/VBox/Main/src-server/win/VBoxComEvents.cpp
@@ -1,3 +1,4 @@
+/* $Id: VBoxComEvents.cpp $ */
 /** @file
  *
  *  COM Events Helper routines.
diff --git a/src/VBox/Main/src-server/win/VBoxComEvents.h b/src/VBox/Main/src-server/win/VBoxComEvents.h
index ec1a1ba..655816a 100644
--- a/src/VBox/Main/src-server/win/VBoxComEvents.h
+++ b/src/VBox/Main/src-server/win/VBoxComEvents.h
@@ -1,3 +1,4 @@
+/* $Id: VBoxComEvents.h $ */
 /** @file
  *
  *  Declaration of COM Events Helper routines.
diff --git a/src/VBox/Main/src-server/win/VBoxSVC.rc b/src/VBox/Main/src-server/win/VBoxSVC.rc
index cb70760..6e569b7 100644
--- a/src/VBox/Main/src-server/win/VBoxSVC.rc
+++ b/src/VBox/Main/src-server/win/VBoxSVC.rc
@@ -21,30 +21,27 @@
 #include "win/resource.h"
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-#ifdef _DEBUG
-  FILEFLAGS        VS_FF_DEBUG|VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE
-#else
-  FILEFLAGS        0 // final version
-#endif
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_APP
-  FILESUBTYPE      0   // not used
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_APP
+  FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904E4" // Lang=US English, CharSet=Windows Multilingual
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Interface\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxSVC\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxSVC.exe\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
 
       VALUE "OLESelfRegister",  "\0"
     END
diff --git a/src/VBox/Main/src-server/win/svchlp.cpp b/src/VBox/Main/src-server/win/svchlp.cpp
index a3c07ff..f550717 100644
--- a/src/VBox/Main/src-server/win/svchlp.cpp
+++ b/src/VBox/Main/src-server/win/svchlp.cpp
@@ -1,3 +1,4 @@
+/* $Id: svchlp.cpp $ */
 /** @file
  * Definition of SVC Helper Process control routines.
  */
diff --git a/src/VBox/Main/src-server/win/svchlp.h b/src/VBox/Main/src-server/win/svchlp.h
index a5df8db..5777bb1 100644
--- a/src/VBox/Main/src-server/win/svchlp.h
+++ b/src/VBox/Main/src-server/win/svchlp.h
@@ -1,3 +1,4 @@
+/* $Id: svchlp.h $ */
 /** @file
  *
  *  Declaration of SVC Helper Process control routines.
diff --git a/src/VBox/Main/src-server/win/svcmain.cpp b/src/VBox/Main/src-server/win/svcmain.cpp
index b04093f..ade917a 100644
--- a/src/VBox/Main/src-server/win/svcmain.cpp
+++ b/src/VBox/Main/src-server/win/svcmain.cpp
@@ -1,3 +1,4 @@
+/* $Id: svcmain.cpp $ */
 /** @file
  *
  * SVCMAIN - COM out-of-proc server main entry
@@ -92,6 +93,26 @@ void CExeModule::MonitorShutdown()
         /* timed out */
         if (!bActivity && m_nLockCnt == 0) /* if no activity let's really bail */
         {
+            /* Disable log rotation at this point, worst case a log file
+             * becomes slightly bigger than it should. Avoids quirks with
+             * log rotation: there might be another API service process
+             * running at this point which would rotate the logs concurrently,
+             * creating a mess. */
+            PRTLOGGER pReleaseLogger = RTLogRelDefaultInstance();
+            if (pReleaseLogger)
+            {
+                char szDest[1024];
+                int rc = RTLogGetDestinations(pReleaseLogger, szDest, sizeof(szDest));
+                if (RT_SUCCESS(rc))
+                {
+                    rc = RTStrCat(szDest, sizeof(szDest), " nohistory");
+                    if (RT_SUCCESS(rc))
+                    {
+                        rc = RTLogDestinations(pReleaseLogger, szDest);
+                        AssertRC(rc);
+                    }
+                }
+            }
 #if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED)
             CoSuspendClassObjects();
             if (!bActivity && m_nLockCnt == 0)
@@ -120,53 +141,20 @@ BEGIN_OBJECT_MAP(ObjectMap)
 END_OBJECT_MAP()
 
 
-LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2)
-{
-    while (p1 != NULL && *p1 != NULL)
-    {
-        LPCTSTR p = p2;
-        while (p != NULL && *p != NULL)
-        {
-            if (*p1 == *p)
-                return CharNext(p1);
-            p = CharNext(p);
-        }
-        p1 = CharNext(p1);
-    }
-    return NULL;
-}
-
-static int WordCmpI(LPCTSTR psz1, LPCTSTR psz2) throw()
-{
-    TCHAR c1 = (TCHAR)CharUpper((LPTSTR)*psz1);
-    TCHAR c2 = (TCHAR)CharUpper((LPTSTR)*psz2);
-    while (c1 != NULL && c1 == c2 && c1 != ' ' && c1 != '\t')
-    {
-        psz1 = CharNext(psz1);
-        psz2 = CharNext(psz2);
-        c1 = (TCHAR)CharUpper((LPTSTR)*psz1);
-        c2 = (TCHAR)CharUpper((LPTSTR)*psz2);
-    }
-    if ((c1 == NULL || c1 == ' ' || c1 == '\t') && (c2 == NULL || c2 == ' ' || c2 == '\t'))
-        return 0;
-
-    return (c1 < c2) ? -1 : 1;
-}
-
 /////////////////////////////////////////////////////////////////////////////
 //
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nShowCmd*/)
 {
-    LPCTSTR lpCmdLine = GetCommandLine(); /* this line necessary for _ATL_MIN_CRT */
+    int    argc = __argc;
+    char **argv = __argv;
 
     /*
-     * Need to parse the command line before initializing the VBox runtime.
+     * Need to parse the command line before initializing the VBox runtime so we can
+     * change to the user home directory before logs are being created.
      */
-    TCHAR szTokens[] = _T("-/");
-    LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
-    while (lpszToken != NULL)
-    {
-        if (WordCmpI(lpszToken, _T("Embedding")) == 0)
+    for (int i = 1; i < argc; i++)
+        if (   (argv[i][0] == '/' || argv[i][0] == '-')
+            && stricmp(&argv[i][1], "embedding") == 0) /* ANSI */
         {
             /* %HOMEDRIVE%%HOMEPATH% */
             wchar_t wszHome[RTPATH_MAX];
@@ -183,15 +171,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpC
             }
         }
 
-        lpszToken = FindOneOf(lpszToken, szTokens);
-    }
-
     /*
      * Initialize the VBox runtime without loading
      * the support driver.
      */
-    int    argc = __argc;
-    char **argv = __argv;
     RTR3InitExe(argc, &argv, 0);
 
     /* Note that all options are given lowercase/camel case/uppercase to
diff --git a/src/VBox/Main/src-server/xpcom/server.cpp b/src/VBox/Main/src-server/xpcom/server.cpp
index 24ff15a..96b4537 100644
--- a/src/VBox/Main/src-server/xpcom/server.cpp
+++ b/src/VBox/Main/src-server/xpcom/server.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2004-2013 Oracle Corporation
+ * Copyright (C) 2004-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -94,105 +94,29 @@
 #endif
 # include "NATNetworkImpl.h"
 
+// This needs to stay - it is needed by the service registration below, and
+// is defined in the automatically generated VirtualBoxWrap.cpp
+extern nsIClassInfo *NS_CLASSINFO_NAME(VirtualBoxWrap);
+NS_DECL_CI_INTERFACE_GETTER(VirtualBoxWrap)
 
-/* implement nsISupports parts of our objects with support for nsIClassInfo */
-
-NS_DECL_CLASSINFO(VirtualBox)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBox, IVirtualBox)
-
-NS_DECL_CLASSINFO(Machine)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Machine, IMachine)
-
-NS_DECL_CLASSINFO(VFSExplorer)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VFSExplorer, IVFSExplorer)
-
-NS_DECL_CLASSINFO(Appliance)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Appliance, IAppliance)
-
-NS_DECL_CLASSINFO(VirtualSystemDescription)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualSystemDescription, IVirtualSystemDescription)
+// The declarations/implementations of the various XPCOM helper data structures
+// and functions have to be removed bit by bit, as the conversion to the
+// automatically generated wrappers makes them obsolete.
 
+/* implement nsISupports parts of our objects with support for nsIClassInfo */
 NS_DECL_CLASSINFO(SessionMachine)
 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(SessionMachine, IMachine, IInternalMachineControl)
 
 NS_DECL_CLASSINFO(SnapshotMachine)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SnapshotMachine, IMachine)
 
-NS_DECL_CLASSINFO(Snapshot)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Snapshot, ISnapshot)
-
-NS_DECL_CLASSINFO(Medium)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Medium, IMedium)
-
-NS_DECL_CLASSINFO(MediumAttachment)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(MediumAttachment, IMediumAttachment)
-
-NS_DECL_CLASSINFO(Progress)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Progress, IProgress)
-
 NS_DECL_CLASSINFO(ProgressProxy)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ProgressProxy, IProgress)
 
-NS_DECL_CLASSINFO(SharedFolder)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder)
-
-NS_DECL_CLASSINFO(VRDEServer)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServer, IVRDEServer)
-
-NS_DECL_CLASSINFO(Host)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Host, IHost)
-
-NS_DECL_CLASSINFO(HostNetworkInterface)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(HostNetworkInterface, IHostNetworkInterface)
-
-NS_DECL_CLASSINFO(DHCPServer)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(DHCPServer, IDHCPServer)
-
-NS_DECL_CLASSINFO(NATNetwork)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NATNetwork, INATNetwork)
-
-NS_DECL_CLASSINFO(GuestOSType)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(GuestOSType, IGuestOSType)
-
-NS_DECL_CLASSINFO(NetworkAdapter)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NetworkAdapter, INetworkAdapter)
-
-NS_DECL_CLASSINFO(NATEngine)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NATEngine, INATEngine)
-
-
-NS_DECL_CLASSINFO(SerialPort)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SerialPort, ISerialPort)
-
-NS_DECL_CLASSINFO(ParallelPort)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ParallelPort, IParallelPort)
-
-NS_DECL_CLASSINFO(USBController)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBController, IUSBController)
-
-NS_DECL_CLASSINFO(USBDeviceFilters)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBDeviceFilters, IUSBDeviceFilters)
-
-NS_DECL_CLASSINFO(StorageController)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(StorageController, IStorageController)
-
 #ifdef VBOX_WITH_USB
-NS_DECL_CLASSINFO(USBDeviceFilter)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBDeviceFilter, IUSBDeviceFilter)
-
-NS_DECL_CLASSINFO(HostUSBDevice)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(HostUSBDevice, IUSBDevice, IHostUSBDevice)
 
-NS_DECL_CLASSINFO(HostUSBDeviceFilter)
-NS_IMPL_THREADSAFE_ISUPPORTS2_CI(HostUSBDeviceFilter, IUSBDeviceFilter, IHostUSBDeviceFilter)
 #endif
 
-NS_DECL_CLASSINFO(AudioAdapter)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(AudioAdapter, IAudioAdapter)
-
-NS_DECL_CLASSINFO(SystemProperties)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SystemProperties, ISystemProperties)
-
 #ifdef VBOX_WITH_RESOURCE_USAGE_API
 NS_DECL_CLASSINFO(PerformanceCollector)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(PerformanceCollector, IPerformanceCollector)
@@ -200,26 +124,6 @@ NS_DECL_CLASSINFO(PerformanceMetric)
 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(PerformanceMetric, IPerformanceMetric)
 #endif /* VBOX_WITH_RESOURCE_USAGE_API */
 
-NS_DECL_CLASSINFO(BIOSSettings)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(BIOSSettings, IBIOSSettings)
-
-#ifdef VBOX_WITH_EXTPACK
-NS_DECL_CLASSINFO(ExtPackFile)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackFile, IExtPackFile)
-
-NS_DECL_CLASSINFO(ExtPack)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPack, IExtPack)
-
-NS_DECL_CLASSINFO(ExtPackManager)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackManager, IExtPackManager)
-#endif
-
-NS_DECL_CLASSINFO(BandwidthGroup)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(BandwidthGroup, IBandwidthGroup)
-
-NS_DECL_CLASSINFO(BandwidthControl)
-NS_IMPL_THREADSAFE_ISUPPORTS1_CI(BandwidthControl, IBandwidthControl)
-
 ////////////////////////////////////////////////////////////////////////////////
 
 static bool gAutoShutdown = false;
@@ -227,7 +131,7 @@ static bool gAutoShutdown = false;
  * VirtualBox instance is released, in ms */
 static uint32_t gShutdownDelayMs = 5000;
 
-static nsIEventQueue  *gEventQ          = nsnull;
+static nsCOMPtr<nsIEventQueue> gEventQ  = nsnull;
 static PRBool volatile gKeepRunning     = PR_TRUE;
 static PRBool volatile gAllowSigUsrQuit = PR_TRUE;
 
@@ -327,8 +231,12 @@ public:
              * (see GetInstance()) */
 
             PRBool onMainThread = PR_TRUE;
-            if (gEventQ)
-                gEventQ->IsOnCurrentThread(&onMainThread);
+            nsCOMPtr<nsIEventQueue> q(gEventQ);
+            if (q)
+            {
+                q->IsOnCurrentThread(&onMainThread);
+                q = nsnull;
+            }
 
             PRBool timerStarted = PR_FALSE;
 
@@ -384,7 +292,7 @@ public:
                      * any more. Thus, we assert below.
                      */
 
-                    Assert(gEventQ == NULL);
+                    Assert(!gEventQ);
                 }
             }
         }
@@ -451,11 +359,12 @@ public:
          * manually ended the server after a destruction has been scheduled
          * and this method was so lucky that it got a chance to run before
          * the timer was killed. */
-        AssertReturnVoid(gEventQ);
+        nsCOMPtr<nsIEventQueue> q(gEventQ);
+        AssertReturnVoid(q);
 
         /* post a quit event to the main queue */
         MaybeQuitEvent *ev = new MaybeQuitEvent();
-        nsresult rv = ev->postTo(gEventQ);
+        nsresult rv = ev->postTo(q);
         NOREF(rv);
 
         /* A failure above means we've been already stopped (for example
@@ -488,8 +397,6 @@ public:
         RTTimerLRDestroy(sTimer);
         sTimer = NULL;
 
-        RTCritSectDelete(&sLock);
-
         if (sInstance != NULL)
         {
             /* Either posting a destruction event failed for some reason (most
@@ -500,6 +407,10 @@ public:
             sInstance->Release();
         }
 
+        /* Destroy lock after releasing the VirtualBox instance, otherwise
+         * there are races with cleanup. */
+        RTCritSectDelete(&sLock);
+
         return NS_OK;
     }
 
@@ -526,7 +437,7 @@ public:
 
         if (sInstance == NULL)
         {
-            LogFlowFunc (("Creating new VirtualBox object...\n"));
+            LogFlowFunc(("Creating new VirtualBox object...\n"));
             sInstance = new VirtualBoxClassFactory();
             if (sInstance != NULL)
             {
@@ -689,14 +600,15 @@ class ForceQuitEvent : public MyEvent
 
 static void signal_handler(int sig)
 {
-    if (gEventQ && gKeepRunning)
+    nsCOMPtr<nsIEventQueue> q(gEventQ);
+    if (q && gKeepRunning)
     {
         if (sig == SIGUSR1)
         {
             if (gAllowSigUsrQuit)
             {
                 VirtualBoxClassFactory::MaybeQuitEvent *ev = new VirtualBoxClassFactory::MaybeQuitEvent();
-                ev->postTo(gEventQ);
+                ev->postTo(q);
             }
             /* else do nothing */
         }
@@ -704,7 +616,7 @@ static void signal_handler(int sig)
         {
             /* post a force quit event to the queue */
             ForceQuitEvent *ev = new ForceQuitEvent();
-            ev->postTo(gEventQ);
+            ev->postTo(q);
         }
     }
 }
@@ -916,9 +828,9 @@ int main(int argc, char **argv)
         NULL, // registration function
         NULL, // deregistration function
         VirtualBoxClassFactory::FactoryDestructor, // factory destructor function
-        NS_CI_INTERFACE_GETTER_NAME(VirtualBox),
+        NS_CI_INTERFACE_GETTER_NAME(VirtualBoxWrap),
         NULL, // language helper
-        &NS_CLASSINFO_NAME(VirtualBox),
+        &NS_CLASSINFO_NAME(VirtualBoxWrap),
         0 // flags
     };
 
@@ -938,7 +850,7 @@ int main(int argc, char **argv)
             break;
         }
 
-        nsCOMPtr <nsIComponentRegistrar> registrar;
+        nsCOMPtr<nsIComponentRegistrar> registrar;
         rc = NS_GetComponentRegistrar(getter_AddRefs(registrar));
         if (NS_FAILED(rc))
         {
@@ -958,14 +870,14 @@ int main(int argc, char **argv)
         /* get the main thread's event queue (afaik, the dconnect service always
          * gets created upon XPCOM startup, so it will use the main (this)
          * thread's event queue to receive IPC events) */
-        rc = NS_GetMainEventQ(&gEventQ);
+        rc = NS_GetMainEventQ(getter_AddRefs(gEventQ));
         if (NS_FAILED(rc))
         {
             RTMsgError("Failed to get the main event queue! (rc=%Rhrc)", rc);
             break;
         }
 
-        nsCOMPtr<ipcIService> ipcServ (do_GetService(IPC_SERVICE_CONTRACTID, &rc));
+        nsCOMPtr<ipcIService> ipcServ(do_GetService(IPC_SERVICE_CONTRACTID, &rc));
         if (NS_FAILED(rc))
         {
             RTMsgError("Failed to get IPC service! (rc=%Rhrc)", rc);
@@ -1079,8 +991,7 @@ int main(int argc, char **argv)
 
         /* process any remaining events. These events may include
          * CreateInstance() requests received right before we called
-         * StopAcceptingEvents() above. We will detect this case below,
-         * restore gKeepRunning and continue to serve. */
+         * StopAcceptingEvents() above, and those will fail. */
         gEventQ->ProcessPendingEvents();
 
         RTPrintf("Terminated event loop.\n");
@@ -1088,7 +999,7 @@ int main(int argc, char **argv)
     while (0); // this scopes the nsCOMPtrs
 
     NS_IF_RELEASE(gIpcServ);
-    NS_IF_RELEASE(gEventQ);
+    gEventQ = nsnull;
 
     /* no nsCOMPtrs are allowed to be alive when you call com::Shutdown(). */
 
diff --git a/src/VBox/Main/src-server/xpcom/server.h b/src/VBox/Main/src-server/xpcom/server.h
index 4fbaa23..a6727c7 100644
--- a/src/VBox/Main/src-server/xpcom/server.h
+++ b/src/VBox/Main/src-server/xpcom/server.h
@@ -1,3 +1,4 @@
+/* $Id: server.h $ */
 /** @file
  *
  * Common header for XPCOM server and its module counterpart
diff --git a/src/VBox/Main/src-server/xpcom/server_module.cpp b/src/VBox/Main/src-server/xpcom/server_module.cpp
index 11cf239..f332c48 100644
--- a/src/VBox/Main/src-server/xpcom/server_module.cpp
+++ b/src/VBox/Main/src-server/xpcom/server_module.cpp
@@ -1,3 +1,4 @@
+/* $Id: server_module.cpp $ */
 /** @file
  *
  * XPCOM server process helper module implementation functions
@@ -91,8 +92,8 @@ static bool IsVBoxSVCPathSet = false;
  *  in sync with macros used for VirtualBox in server.cpp for the same purpose.
  */
 
-NS_DECL_CLASSINFO(VirtualBox)
-NS_IMPL_CI_INTERFACE_GETTER1(VirtualBox, IVirtualBox)
+NS_DECL_CLASSINFO(VirtualBoxWrap)
+NS_IMPL_CI_INTERFACE_GETTER1(VirtualBoxWrap, IVirtualBox)
 
 static nsresult vboxsvcSpawnDaemon(void)
 {
@@ -363,10 +364,10 @@ static const nsModuleComponentInfo components[] =
         NULL, // deregistration function
         NULL, // destructor function
         /// @todo
-        NS_CI_INTERFACE_GETTER_NAME(VirtualBox), // interfaces function
+        NS_CI_INTERFACE_GETTER_NAME(VirtualBoxWrap), // interfaces function
         NULL, // language helper
         /// @todo
-        &NS_CLASSINFO_NAME(VirtualBox) // global class info & flags
+        &NS_CLASSINFO_NAME(VirtualBoxWrap) // global class info & flags
     }
 };
 
diff --git a/src/VBox/Main/testcase/Makefile.kmk b/src/VBox/Main/testcase/Makefile.kmk
index e9b7cc8..6cbac0e 100644
--- a/src/VBox/Main/testcase/Makefile.kmk
+++ b/src/VBox/Main/testcase/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2004-2013 Oracle Corporation
+# Copyright (C) 2004-2014 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -25,15 +25,18 @@ include $(KBUILD_PATH)/subheader.kmk
 ifndef VBOX_ONLY_SDK
  if defined(VBOX_WITH_TESTCASES)
   PROGRAMS       += \
-	tstAPI \
-	$(if $(VBOX_OSE),,tstOVF) \
-	$(if $(VBOX_WITH_XPCOM),tstVBoxAPIXPCOM,tstVBoxAPIWin) \
-	$(if $(VBOX_WITH_RESOURCE_USAGE_API),tstCollector,) \
-	$(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlParseBuffer,) \
-	$(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlContextID,) \
-	tstMediumLock
+  	tstAPI \
+  	tstVBoxAPI \
+  	tstVBoxAPIPerf \
+  	$(if $(VBOX_OSE),,tstOVF) \
+  	$(if $(VBOX_WITH_XPCOM),tstVBoxAPIXPCOM,tstVBoxAPIWin) \
+  	$(if $(VBOX_WITH_RESOURCE_USAGE_API),tstCollector,) \
+  	$(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlParseBuffer,) \
+  	$(if $(VBOX_WITH_GUEST_CONTROL),tstGuestCtrlContextID,) \
+  	tstMediumLock \
+  	tstGuid
   PROGRAMS.linux += \
-	$(if $(VBOX_WITH_USB),tstUSBProxyLinux,)
+  	$(if $(VBOX_WITH_USB),tstUSBProxyLinux,)
  endif # !VBOX_WITH_TESTCASES
 endif # !VBOX_ONLY_SDK
 if defined(VBOX_ONLY_SDK) || !defined(VBOX_WITH_XPCOM)
@@ -63,6 +66,19 @@ tstAPI_TEMPLATE = VBOXMAINCLIENTTSTEXE
 #tstAPI_INST = $(INST_SDK)bindings/gluecom/samples/
 tstAPI_SOURCES  = tstAPI.cpp
 
+#
+# tstVBoxAPI
+#
+tstVBoxAPI_TEMPLATE = VBOXMAINCLIENTTSTEXE
+tstVBoxAPI_SOURCES  = \
+	tstVBoxAPI.cpp
+
+#
+# tstVBoxAPIPerf
+#
+tstVBoxAPIPerf_TEMPLATE = VBOXMAINCLIENTTSTEXE
+tstVBoxAPIPerf_SOURCES  = \
+	tstVBoxAPIPerf.cpp
 
 #
 # tstOVF
@@ -77,7 +93,7 @@ ifndef VBOX_OSE
 #
 INSTALLS += ovf-testcases
 ovf-testcases_MODE = a+r,u+w
-ovf-testcases_INST = $(INST_BIN)ovf-testcases/
+ovf-testcases_INST = $(INST_TESTCASE)ovf-testcases/
 ovf-testcases_SOURCES = \
 	ovf-dummy.vmdk \
 	ovf-joomla-0.9/joomla-1.1.4-ovf.ovf=>ovf-joomla-0.9/joomla-1.1.4-ovf.ovf \
@@ -92,59 +108,102 @@ endif
 # We only build the testcase here to make sure it builds.
 # It comes with a custom makefile which should be tested as well!
 #
-tstVBoxAPIXPCOM_TEMPLATE = VBOXMAINCLIENTTSTEXE
+# Use very generic template to make the build environment similar
+# to the standalone case, to detect if IPRT or glue use sneaks in.
+#
+tstVBoxAPIXPCOM_TEMPLATE = VBOXR3EXE
+tstVBoxAPIXPCOM_INST = $(INST_TESTCASE)
 tstVBoxAPIXPCOM_SOURCES  = tstVBoxAPIXPCOM.cpp
+tstVBoxAPIXPCOM_INCS = \
+	$(VBOX_PATH_SDK)/bindings/xpcom/include \
+	$(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
+	$(VBOX_PATH_SDK)/bindings/xpcom/include/string \
+	$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
+	$(VBOX_PATH_SDK)/bindings/xpcom/include/ipcd
+tstVBoxAPIXPCOM_LIBS = \
+	$(LIB_XPCOM)
+tstVBoxAPIXPCOM_CXXFLAGS = -fshort-wchar
+ifdef VBOX_WITH_RUNPATH
+ tstVBoxAPIXPCOM_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' $(TEMPLATE_VBoxBldProg_LDFLAGS)
+else ifdef VBOX_WITH_RELATIVE_RUNPATH
+ tstVBoxAPIXPCOM_LDFLAGS = '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)/..' $(TEMPLATE_VBoxBldProg_LDFLAGS)
+endif
+tstVBoxAPIXPCOM_INTERMEDIATES = \
+	$(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h
+ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
+ tstVBoxAPIXPCOM_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
+endif
 
 
 #
 # tstVBoxAPIWin
 #
-tstVBoxAPIWin_TEMPLATE = VBOXMAINCLIENTTSTEXE
+# Use very generic template to make the build environment similar
+# to the standalone case, to detect if IPRT or glue use sneaks in.
+#
+tstVBoxAPIWin_TEMPLATE = VBoxBldProg
+tstVBoxAPIWin_INST = $(INST_TESTCASE)
 tstVBoxAPIWin_SOURCES  = \
 	tstVBoxAPIWin.cpp \
 	$(VBOX_PATH_SDK)/bindings/mscom/lib/VirtualBox_i.c
+tstVBoxAPIWin_INCS = \
+	$(VBOX_PATH_SDK)/bindings/mscom/include
+tstVBoxAPIWin_INTERMEDIATES = \
+	$(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h
 
 
 #
 # tstCollector
 #
+# Note! VBOX_MAIN_APIWRAPPER_GEN_HDRS is only defined if kmk is executed a
+#       parent directory.  Since the rules for generating the files listed by
+#       the variable lives in the parent makefile, this is not a problem.
+#
 tstCollector_TEMPLATE = VBOXMAINCLIENTTSTEXE
 tstCollector_SOURCES  = \
 	tstCollector.cpp \
 	../src-server/Performance.cpp
-tstCollector_INCS     = ../include
-tstCollector_DEFS    += VBOX_COLLECTOR_TEST_CASE
-tstCollector_LDFLAGS.darwin  += -lproc
-tstCollector_LDFLAGS.solaris += -lkstat -lnvpair
-tstCollector_LDFLAGS.win     += psapi.lib powrprof.lib
+tstCollector_INCS            = \
+	../include \
+	$(VBOX_MAIN_APIWRAPPER_INCS)
+tstCollector_INTERMEDIATES   = $(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
+tstCollector_DEFS            = VBOX_COLLECTOR_TEST_CASE
+tstCollector_LDFLAGS.darwin  = -lproc
+tstCollector_LDFLAGS.solaris = -lkstat -lnvpair
+tstCollector_LDFLAGS.win     = psapi.lib powrprof.lib
 
 
 #
 # tstGuestCtrlParseBuffer
 #
 tstGuestCtrlParseBuffer_TEMPLATE = VBOXMAINCLIENTTSTEXE
+tstGuestCtrlParseBuffer_INTERMEDIATES   = $(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
 tstGuestCtrlParseBuffer_DEFS    += VBOX_WITH_HGCM VBOX_WITH_GUEST_CONTROL VBOX_GUESTCTRL_TEST_CASE
 tstGuestCtrlParseBuffer_SOURCES  = \
 	tstGuestCtrlParseBuffer.cpp \
 	../src-client/GuestCtrlPrivate.cpp
-tstGuestCtrlParseBuffer_INCS     = ../include
+tstGuestCtrlParseBuffer_INCS     = ../include \
+    $(VBOX_MAIN_APIWRAPPER_INCS)
 
 
 #
 # tstGuestCtrlContextID
 #
 tstGuestCtrlContextID_TEMPLATE = VBOXMAINCLIENTTSTEXE
+tstGuestCtrlContextID_INTERMEDIATES   = $(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
 tstGuestCtrlContextID_DEFS    += VBOX_WITH_HGCM VBOX_WITH_GUEST_CONTROL VBOX_GUESTCTRL_TEST_CASE
 tstGuestCtrlContextID_SOURCES  = \
 	tstGuestCtrlContextID.cpp \
 	../src-client/GuestCtrlPrivate.cpp
-tstGuestCtrlContextID_INCS     = ../include
+tstGuestCtrlContextID_INCS     = ../include \
+     $(VBOX_MAIN_APIWRAPPER_INCS)
 
 
 #
 # tstUSBProxyLinux
 #
-tstUSBProxyLinux_TEMPLATE  = VBOXR3TSTNPEXE
+tstUSBProxyLinux_TEMPLATE  = VBOXMAINCLIENTTSTEXE
+tstUSBProxyLinux_INTERMEDIATES = $(VBOX_MAIN_APIWRAPPER_GEN_HDRS)
 tstUSBProxyLinux_SOURCES   = \
 	tstUSBProxyLinux.cpp \
 	../src-server/linux/USBProxyServiceLinux.cpp \
@@ -154,7 +213,8 @@ tstUSBProxyLinux_INCS      = \
 	../include \
 	$(VBOX_PATH_SDK)/bindings/xpcom/include \
 	$(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \
-	$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom
+	$(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \
+	$(VBOX_MAIN_APIWRAPPER_INCS)
 tstUSBProxyLinux_DEFS      = \
 	UNIT_TEST \
 	VBOX_WITH_USB \
@@ -174,6 +234,13 @@ tstMediumLock_TEMPLATE = VBOXMAINCLIENTTSTEXE
 tstMediumLock_SOURCES  = tstMediumLock.cpp
 
 
+#
+# tstGuid
+#
+tstGuid_TEMPLATE = VBOXMAINCLIENTTSTEXE
+tstGuid_SOURCES  = tstGuid.cpp
+
+
 # generate rules.
 include $(FILE_KBUILD_SUB_FOOTER)
 
diff --git a/src/VBox/Main/testcase/makefile.tstVBoxAPIXPCOM b/src/VBox/Main/testcase/makefile.tstVBoxAPIXPCOM
index 09fc2b8..8e3c829 100644
--- a/src/VBox/Main/testcase/makefile.tstVBoxAPIXPCOM
+++ b/src/VBox/Main/testcase/makefile.tstVBoxAPIXPCOM
@@ -2,7 +2,7 @@
 # tstVBoxAPIXPCOM makefile
 #
 #
-# Copyright (C) 2006-2013 Oracle Corporation
+# Copyright (C) 2006-2014 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -31,6 +31,10 @@ ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
  DEFS_XPCOM   += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
 endif
 
+# Adjust this to match your platform, pick from RT_OS_LINUX, RT_OS_WINDOWS,
+# RT_OS_DARWIN, RT_OS_SOLARIS...
+DEFS_XPCOM += RT_OS_LINUX
+
 
 #
 # Link with the public XPCOM libraries
diff --git a/src/VBox/Main/testcase/ovf-winxp-vbox-sharedfolders/winxp.ovf b/src/VBox/Main/testcase/ovf-winxp-vbox-sharedfolders/winxp.ovf
index de54410..9d6ce61 100644
--- a/src/VBox/Main/testcase/ovf-winxp-vbox-sharedfolders/winxp.ovf
+++ b/src/VBox/Main/testcase/ovf-winxp-vbox-sharedfolders/winxp.ovf
@@ -299,7 +299,7 @@
       <StorageControllers>
         <StorageController name="IDE Controller" type="PIIX3" PortCount="2" useHostIOCache="true">
           <AttachedDevice type="HardDisk" port="0" device="0">
-            <Image uuid="{cf2b9350-4d5f-42a2-be70-b85a00c2ec9f}"/>
+            <Image uuid="{1fc3c37e-079b-477b-a6d7-84c0e8a717ac}"/>
           </AttachedDevice>
           <AttachedDevice type="HardDisk" port="0" device="1">
             <Image uuid="{cf2b9350-4d5f-42a2-be70-b85a00c2ec9f}"/>
diff --git a/src/VBox/Main/testcase/tstAPI.cpp b/src/VBox/Main/testcase/tstAPI.cpp
index a18499e..3e7991a 100644
--- a/src/VBox/Main/testcase/tstAPI.cpp
+++ b/src/VBox/Main/testcase/tstAPI.cpp
@@ -1,3 +1,4 @@
+/* $Id: tstAPI.cpp $ */
 /** @file
  *
  * tstAPI - test program for our COM/XPCOM interface
diff --git a/src/VBox/Main/testcase/tstCollector.cpp b/src/VBox/Main/testcase/tstCollector.cpp
index 44b6428..eb17a60 100644
--- a/src/VBox/Main/testcase/tstCollector.cpp
+++ b/src/VBox/Main/testcase/tstCollector.cpp
@@ -379,7 +379,7 @@ int main(int argc, char *argv[])
     pm::CollectorHAL *collector = pm::createHAL();
     if (!collector)
     {
-        RTPrintf("tstCollector: createMetricFactory() failed\n", rc);
+        RTPrintf("tstCollector: createMetricFactory() failed\n");
         return 1;
     }
 
diff --git a/src/VBox/Main/testcase/tstGuid.cpp b/src/VBox/Main/testcase/tstGuid.cpp
new file mode 100644
index 0000000..1199845
--- /dev/null
+++ b/src/VBox/Main/testcase/tstGuid.cpp
@@ -0,0 +1,99 @@
+/* $Id: tstGuid.cpp $ */
+/** @file
+ * API Glue Testcase - Guid.
+ */
+
+/*
+ * Copyright (C) 2013-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/com/Guid.h>
+
+#include <iprt/err.h>
+#include <iprt/mem.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+#include <iprt/uni.h>
+
+
+static void test1(RTTEST hTest)
+{
+    RTTestSub(hTest, "Basics");
+
+#define CHECK(expr) RTTESTI_CHECK(expr)
+#define CHECK_DUMP(expr, value) \
+    do { \
+        if (!(expr)) \
+            RTTestFailed(hTest, "%d: FAILED %s, got \"%s\"", __LINE__, #expr, value); \
+    } while (0)
+
+#define CHECK_DUMP_I(expr) \
+    do { \
+        if (!(expr)) \
+            RTTestFailed(hTest, "%d: FAILED %s, got \"%d\"", __LINE__, #expr, expr); \
+    } while (0)
+#define CHECK_EQUAL(Str, szExpect) \
+    do { \
+        if (!(Str).equals(szExpect)) \
+            RTTestIFailed("line %u: expected \"%s\" got \"%s\"", __LINE__, szExpect, (Str).c_str()); \
+    } while (0)
+#define CHECK_EQUAL_I(iRes, iExpect) \
+    do { \
+        if (iRes != iExpect) \
+            RTTestIFailed("line %u: expected \"%zd\" got \"%zd\"", __LINE__, iExpect, iRes); \
+    } while (0)
+
+    com::Guid zero;
+    CHECK(zero.isZero());
+
+    com::Guid copyZero(zero);
+    CHECK(copyZero.isZero());
+
+    com::Guid assignZero(zero);
+    CHECK(assignZero.isZero());
+
+    com::Guid random;
+    random.create();
+    CHECK(!random.isZero());
+
+    com::Guid copyRandom(random);
+    CHECK(!copyRandom.isZero());
+
+    com::Guid assignRandom(random);
+    CHECK(!assignRandom.isZero());
+
+    /** @todo extend this a lot, it needs to cover many more cases */
+
+#undef CHECK
+#undef CHECK_DUMP
+#undef CHECK_DUMP_I
+#undef CHECK_EQUAL
+}
+
+
+int main()
+{
+    RTTEST      hTest;
+    RTEXITCODE  rcExit = RTTestInitAndCreate("tstGuid", &hTest);
+    if (rcExit == RTEXITCODE_SUCCESS)
+    {
+        RTTestBanner(hTest);
+
+        test1(hTest);
+
+        rcExit = RTTestSummaryAndDestroy(hTest);
+    }
+    return rcExit;
+}
+
diff --git a/src/VBox/Main/testcase/tstMediumLock.cpp b/src/VBox/Main/testcase/tstMediumLock.cpp
index 2aebc84..8a09686 100644
--- a/src/VBox/Main/testcase/tstMediumLock.cpp
+++ b/src/VBox/Main/testcase/tstMediumLock.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
     if (!RTTestSubErrorCount(hTest))
     {
         RTTestSub(hTest, "Creating temp hard disk medium");
-        TEST_COM_SUCCESS(hTest, pVirtualBox->CreateHardDisk(Bstr("VDI").raw(), Bstr(szPathTemp).raw(), pMedium.asOutParam()), "create medium");
+        TEST_COM_SUCCESS(hTest, pVirtualBox->CreateMedium(Bstr("VDI").raw(), Bstr(szPathTemp).raw(), AccessMode_ReadWrite, DeviceType_HardDisk, pMedium.asOutParam()), "create medium");
         if (!pMedium.isNull())
         {
             ComPtr<IProgress> pProgress;
diff --git a/src/VBox/Main/testcase/tstOVF.cpp b/src/VBox/Main/testcase/tstOVF.cpp
index de8c808..54a6f5e 100644
--- a/src/VBox/Main/testcase/tstOVF.cpp
+++ b/src/VBox/Main/testcase/tstOVF.cpp
@@ -84,7 +84,8 @@ void importOVF(const char *pcszPrefix,
                std::list<Guid> &llMachinesCreated)
 {
     char szAbsOVF[RTPATH_MAX];
-    RTPathAbs(pcszOVF0, szAbsOVF, sizeof(szAbsOVF));
+    RTPathExecDir(szAbsOVF, sizeof(szAbsOVF));
+    RTPathAppend(szAbsOVF, sizeof(szAbsOVF), pcszOVF0);
 
     RTPrintf("%s: reading appliance \"%s\"...\n", pcszPrefix, szAbsOVF);
     ComPtr<IAppliance> pAppl;
@@ -265,11 +266,17 @@ void copyDummyDiskImage(const char *pcszPrefix,
                         std::list<Utf8Str> &llFiles2Delete,
                         const char *pcszDest)
 {
+    char szSrc[RTPATH_MAX];
+    char szDst[RTPATH_MAX];
+    RTPathExecDir(szSrc, sizeof(szSrc));
+    RTPathAppend(szSrc, sizeof(szSrc), "ovf-testcases/ovf-dummy.vmdk");
+    RTPathExecDir(szDst, sizeof(szDst));
+    RTPathAppend(szDst, sizeof(szDst), pcszDest);
     RTPrintf("%s: copying ovf-dummy.vmdk to \"%s\"...\n", pcszPrefix, pcszDest);
 
-    int vrc = RTFileCopy("ovf-testcases/ovf-dummy.vmdk", pcszDest);
+    int vrc = RTFileCopy(szSrc, szDst);
     if (RT_FAILURE(vrc)) throw MyError(0, Utf8StrFmt("Cannot copy ovf-dummy.vmdk to %s: %Rra\n", pcszDest, vrc).c_str());
-    llFiles2Delete.push_back(pcszDest);
+    llFiles2Delete.push_back(szDst);
 }
 
 /**
@@ -282,6 +289,7 @@ int main(int argc, char *argv[])
 {
     RTR3InitExe(argc, &argv, 0);
 
+    RTEXITCODE rcExit = RTEXITCODE_SUCCESS;
     HRESULT rc = S_OK;
 
     std::list<Utf8Str> llFiles2Delete;
@@ -328,6 +336,7 @@ int main(int argc, char *argv[])
     {
         rc = e.m_rc;
         RTPrintf("%s", e.m_str.c_str());
+        rcExit = RTEXITCODE_FAILURE;
     }
 
     try
@@ -360,6 +369,7 @@ int main(int argc, char *argv[])
     {
         rc = e.m_rc;
         RTPrintf("%s", e.m_str.c_str());
+        rcExit = RTEXITCODE_FAILURE;
     }
 
     // clean up the VMDK copies that we made in copyDummyDiskImage()
@@ -376,8 +386,8 @@ int main(int argc, char *argv[])
 
     RTPrintf("Shutting down COM...\n");
     com::Shutdown();
-    RTPrintf ("tstOVF all done!\n");
+    RTPrintf("tstOVF all done: %s\n", rcExit ? "ERROR" : "SUCCESS");
 
-    return rc;
+    return rcExit;
 }
 
diff --git a/src/VBox/Main/testcase/tstUSBProxyLinux.cpp b/src/VBox/Main/testcase/tstUSBProxyLinux.cpp
index 0535332..8897959 100644
--- a/src/VBox/Main/testcase/tstUSBProxyLinux.cpp
+++ b/src/VBox/Main/testcase/tstUSBProxyLinux.cpp
@@ -57,7 +57,7 @@ bool USBProxyService::isActive() { return true; }
 
 VBoxMainHotplugWaiter::VBoxMainHotplugWaiter(char const*) {}
 
-com::Utf8Str HostUSBDevice::getName()
+com::Utf8Str HostUSBDevice::i_getName()
 {
     return Utf8Str();
 }
diff --git a/src/VBox/Main/testcase/tstVBoxAPI.cpp b/src/VBox/Main/testcase/tstVBoxAPI.cpp
new file mode 100644
index 0000000..e85c029
--- /dev/null
+++ b/src/VBox/Main/testcase/tstVBoxAPI.cpp
@@ -0,0 +1,400 @@
+/* $Id: tstVBoxAPI.cpp $ */
+/** @file
+ * tstVBoxAPI - Checks VirtualBox API.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/com/com.h>
+#include <VBox/com/string.h>
+#include <VBox/com/array.h>
+#include <VBox/com/Guid.h>
+#include <VBox/com/ErrorInfo.h>
+#include <VBox/com/errorprint.h>
+#include <VBox/com/VirtualBox.h>
+#include <VBox/sup.h>
+
+#include <iprt/test.h>
+#include <iprt/time.h>
+
+using namespace com;
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+static RTTEST g_hTest;
+static Bstr   tstMachineName = "tstVBoxAPI test VM";
+
+
+/** Worker for TST_COM_EXPR(). */
+static HRESULT tstComExpr(HRESULT hrc, const char *pszOperation, int iLine)
+{
+    if (FAILED(hrc))
+        RTTestFailed(g_hTest, "%s failed on line %u with hrc=%Rhrc", pszOperation, iLine, hrc);
+    return hrc;
+}
+
+/** Macro that executes the given expression and report any failure.
+ *  The expression must return a HRESULT. */
+#define TST_COM_EXPR(expr) tstComExpr(expr, #expr, __LINE__)
+
+
+static BOOL tstApiIVirtualBox(IVirtualBox *pVBox)
+{
+    HRESULT rc;
+    Bstr bstrTmp;
+    ULONG ulTmp;
+
+    RTTestSub(g_hTest, "IVirtualBox::version");
+    CHECK_ERROR(pVBox, COMGETTER(Version)(bstrTmp.asOutParam()));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::version");
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::version failed", __LINE__);
+
+    RTTestSub(g_hTest, "IVirtualBox::versionNormalized");
+    CHECK_ERROR(pVBox, COMGETTER(VersionNormalized)(bstrTmp.asOutParam()));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::versionNormalized");
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::versionNormalized failed", __LINE__);
+
+    RTTestSub(g_hTest, "IVirtualBox::revision");
+    CHECK_ERROR(pVBox, COMGETTER(Revision)(&ulTmp));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::revision");
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::revision failed", __LINE__);
+
+    RTTestSub(g_hTest, "IVirtualBox::packageType");
+    CHECK_ERROR(pVBox, COMGETTER(PackageType)(bstrTmp.asOutParam()));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::packageType");
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::packageType failed", __LINE__);
+
+    RTTestSub(g_hTest, "IVirtualBox::APIVersion");
+    CHECK_ERROR(pVBox, COMGETTER(APIVersion)(bstrTmp.asOutParam()));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::APIVersion");
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::APIVersion failed", __LINE__);
+
+    RTTestSub(g_hTest, "IVirtualBox::homeFolder");
+    CHECK_ERROR(pVBox, COMGETTER(HomeFolder)(bstrTmp.asOutParam()));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::homeFolder");
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::homeFolder failed", __LINE__);
+
+    RTTestSub(g_hTest, "IVirtualBox::settingsFilePath");
+    CHECK_ERROR(pVBox, COMGETTER(SettingsFilePath)(bstrTmp.asOutParam()));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::settingsFilePath");
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::settingsFilePath failed", __LINE__);
+
+    com::SafeIfaceArray<IGuestOSType> guestOSTypes;
+    RTTestSub(g_hTest, "IVirtualBox::guestOSTypes");
+    CHECK_ERROR(pVBox, COMGETTER(GuestOSTypes)(ComSafeArrayAsOutParam(guestOSTypes)));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::guestOSTypes");
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::guestOSTypes failed", __LINE__);
+
+    /** Create VM */
+    RTTestSub(g_hTest, "IVirtualBox::CreateMachine");
+    ComPtr<IMachine> ptrMachine;
+    com::SafeArray<BSTR> groups;
+    /** Default VM settings */
+    CHECK_ERROR(pVBox, CreateMachine(NULL,                          /** Settings */
+                                     tstMachineName.raw(),          /** Name */
+                                     ComSafeArrayAsInParam(groups), /** Groups */
+                                     NULL,                          /** OS Type */
+                                     NULL,                          /** Create flags */
+                                     ptrMachine.asOutParam()));     /** Machine */
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::CreateMachine");
+    else
+    {
+        RTTestFailed(g_hTest, "%d: IVirtualBox::CreateMachine failed", __LINE__);
+        return FALSE;
+    }
+
+    RTTestSub(g_hTest, "IVirtualBox::RegisterMachine");
+    CHECK_ERROR(pVBox, RegisterMachine(ptrMachine));
+    if (SUCCEEDED(rc))
+        RTTestPassed(g_hTest, "IVirtualBox::RegisterMachine");
+    else
+    {
+        RTTestFailed(g_hTest, "%d: IVirtualBox::RegisterMachine failed", __LINE__);
+        return FALSE;
+    }
+
+    ComPtr<IHost> host;
+    RTTestSub(g_hTest, "IVirtualBox::host");
+    CHECK_ERROR(pVBox, COMGETTER(Host)(host.asOutParam()));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add IHost testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::host");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::host failed", __LINE__);
+
+    ComPtr<ISystemProperties> sysprop;
+    RTTestSub(g_hTest, "IVirtualBox::systemProperties");
+    CHECK_ERROR(pVBox, COMGETTER(SystemProperties)(sysprop.asOutParam()));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add ISystemProperties testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::systemProperties");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::systemProperties failed", __LINE__);
+
+    com::SafeIfaceArray<IMachine> machines;
+    RTTestSub(g_hTest, "IVirtualBox::machines");
+    CHECK_ERROR(pVBox, COMGETTER(Machines)(ComSafeArrayAsOutParam(machines)));
+    if (SUCCEEDED(rc))
+    {
+        bool bFound = FALSE;
+        for (size_t i = 0; i < machines.size(); ++i)
+        {
+            if (machines[i])
+            {
+                Bstr tmpName;
+                rc = machines[i]->COMGETTER(Name)(tmpName.asOutParam());
+                if (SUCCEEDED(rc))
+                {
+                    if (tmpName == tstMachineName)
+                    {
+                        bFound = TRUE;
+                        break;
+                    }
+                }
+            }
+        }
+
+        if (bFound)
+            RTTestPassed(g_hTest, "IVirtualBox::machines");
+        else
+            RTTestFailed(g_hTest, "%d: IVirtualBox::machines failed. No created machine found", __LINE__);
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::machines failed", __LINE__);
+
+#if 0 /** Not yet implemented */
+    com::SafeIfaceArray<ISharedFolder> sharedFolders;
+    RTTestSub(g_hTest, "IVirtualBox::sharedFolders");
+    CHECK_ERROR(pVBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(sharedFolders)));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add ISharedFolders testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::sharedFolders");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::sharedFolders failed", __LINE__);
+#endif
+
+    com::SafeIfaceArray<IMedium> hardDisks;
+    RTTestSub(g_hTest, "IVirtualBox::hardDisks");
+    CHECK_ERROR(pVBox, COMGETTER(HardDisks)(ComSafeArrayAsOutParam(hardDisks)));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add hardDisks testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::hardDisks");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::hardDisks failed", __LINE__);
+
+    com::SafeIfaceArray<IMedium> DVDImages;
+    RTTestSub(g_hTest, "IVirtualBox::DVDImages");
+    CHECK_ERROR(pVBox, COMGETTER(DVDImages)(ComSafeArrayAsOutParam(DVDImages)));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add DVDImages testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::DVDImages");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::DVDImages failed", __LINE__);
+
+    com::SafeIfaceArray<IMedium> floppyImages;
+    RTTestSub(g_hTest, "IVirtualBox::floppyImages");
+    CHECK_ERROR(pVBox, COMGETTER(FloppyImages)(ComSafeArrayAsOutParam(floppyImages)));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add floppyImages testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::floppyImages");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::floppyImages failed", __LINE__);
+
+    com::SafeIfaceArray<IProgress> progressOperations;
+    RTTestSub(g_hTest, "IVirtualBox::progressOperations");
+    CHECK_ERROR(pVBox, COMGETTER(ProgressOperations)(ComSafeArrayAsOutParam(progressOperations)));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add IProgress testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::progressOperations");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::progressOperations failed", __LINE__);
+
+    ComPtr<IPerformanceCollector> performanceCollector;
+    RTTestSub(g_hTest, "IVirtualBox::performanceCollector");
+    CHECK_ERROR(pVBox, COMGETTER(PerformanceCollector)(performanceCollector.asOutParam()));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add IPerformanceCollector testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::performanceCollector");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::performanceCollector failed", __LINE__);
+
+    com::SafeIfaceArray<IDHCPServer> DHCPServers;
+    RTTestSub(g_hTest, "IVirtualBox::DHCPServers");
+    CHECK_ERROR(pVBox, COMGETTER(DHCPServers)(ComSafeArrayAsOutParam(DHCPServers)));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add IDHCPServers testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::DHCPServers");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::DHCPServers failed", __LINE__);
+
+    com::SafeIfaceArray<INATNetwork> NATNetworks;
+    RTTestSub(g_hTest, "IVirtualBox::NATNetworks");
+    CHECK_ERROR(pVBox, COMGETTER(NATNetworks)(ComSafeArrayAsOutParam(NATNetworks)));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add INATNetworks testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::NATNetworks");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::NATNetworks failed", __LINE__);
+
+    ComPtr<IEventSource> eventSource;
+    RTTestSub(g_hTest, "IVirtualBox::eventSource");
+    CHECK_ERROR(pVBox, COMGETTER(EventSource)(eventSource.asOutParam()));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add IEventSource testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::eventSource");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::eventSource failed", __LINE__);
+
+    ComPtr<IExtPackManager> extensionPackManager;
+    RTTestSub(g_hTest, "IVirtualBox::extensionPackManager");
+    CHECK_ERROR(pVBox, COMGETTER(ExtensionPackManager)(extensionPackManager.asOutParam()));
+    if (SUCCEEDED(rc))
+    {
+        /** @todo Add IExtPackManager testing here. */
+        RTTestPassed(g_hTest, "IVirtualBox::extensionPackManager");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::extensionPackManager failed", __LINE__);
+
+    com::SafeArray<BSTR> internalNetworks;
+    RTTestSub(g_hTest, "IVirtualBox::internalNetworks");
+    CHECK_ERROR(pVBox, COMGETTER(InternalNetworks)(ComSafeArrayAsOutParam(internalNetworks)));
+    if (SUCCEEDED(rc))
+    {
+        RTTestPassed(g_hTest, "IVirtualBox::internalNetworks");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::internalNetworks failed", __LINE__);
+
+    com::SafeArray<BSTR> genericNetworkDrivers;
+    RTTestSub(g_hTest, "IVirtualBox::genericNetworkDrivers");
+    CHECK_ERROR(pVBox, COMGETTER(GenericNetworkDrivers)(ComSafeArrayAsOutParam(genericNetworkDrivers)));
+    if (SUCCEEDED(rc))
+    {
+        RTTestPassed(g_hTest, "IVirtualBox::genericNetworkDrivers");
+    }
+    else
+        RTTestFailed(g_hTest, "%d: IVirtualBox::genericNetworkDrivers failed", __LINE__);
+
+    return TRUE;
+}
+
+
+static BOOL tstApiClean(IVirtualBox *pVBox)
+{
+    HRESULT rc;
+
+    /** Delete created VM and its files */
+    ComPtr<IMachine> machine;
+    CHECK_ERROR_RET(pVBox, FindMachine(Bstr(tstMachineName).raw(), machine.asOutParam()), FALSE);
+    SafeIfaceArray<IMedium> media;
+    CHECK_ERROR_RET(machine, Unregister(CleanupMode_DetachAllReturnHardDisksOnly,
+                                    ComSafeArrayAsOutParam(media)), FALSE);
+    ComPtr<IProgress> progress;
+    CHECK_ERROR_RET(machine, DeleteConfig(ComSafeArrayAsInParam(media), progress.asOutParam()), FALSE);
+    CHECK_ERROR_RET(progress, WaitForCompletion(-1), FALSE);
+
+    return TRUE;
+}
+
+
+int main(int argc, char **argv)
+{
+    /*
+     * Initialization.
+     */
+    RTEXITCODE rcExit = RTTestInitAndCreate("tstVBoxAPI", &g_hTest);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+    SUPR3Init(NULL); /* Better time support. */
+    RTTestBanner(g_hTest);
+
+    RTTestSub(g_hTest, "Initializing COM and singletons");
+    HRESULT hrc = com::Initialize();
+    if (SUCCEEDED(hrc))
+    {
+        ComPtr<IVirtualBox> ptrVBox;
+        hrc = TST_COM_EXPR(ptrVBox.createLocalObject(CLSID_VirtualBox));
+        if (SUCCEEDED(hrc))
+        {
+            ComPtr<ISession> ptrSession;
+            hrc = TST_COM_EXPR(ptrSession.createInprocObject(CLSID_Session));
+            if (SUCCEEDED(hrc))
+            {
+                RTTestSubDone(g_hTest);
+
+                /*
+                 * Call test functions.
+                 */
+
+                /** Test IVirtualBox interface */
+                tstApiIVirtualBox(ptrVBox);
+
+
+                /** Clean files/configs */
+                tstApiClean(ptrVBox);
+            }
+        }
+
+        ptrVBox.setNull();
+        com::Shutdown();
+    }
+    else
+        RTTestIFailed("com::Initialize failed with hrc=%Rhrc", hrc);
+    return RTTestSummaryAndDestroy(g_hTest);
+}
diff --git a/src/VBox/Main/testcase/tstVBoxAPIPerf.cpp b/src/VBox/Main/testcase/tstVBoxAPIPerf.cpp
new file mode 100644
index 0000000..7fdc680
--- /dev/null
+++ b/src/VBox/Main/testcase/tstVBoxAPIPerf.cpp
@@ -0,0 +1,243 @@
+/* $Id: tstVBoxAPIPerf.cpp $ */
+/** @file
+ * tstVBoxAPIPerf - Checks the performance of the COM / XPOM API.
+ */
+
+/*
+ * Copyright (C) 2006-2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/com/com.h>
+#include <VBox/com/string.h>
+#include <VBox/com/array.h>
+#include <VBox/com/Guid.h>
+#include <VBox/com/ErrorInfo.h>
+#include <VBox/com/VirtualBox.h>
+#include <VBox/sup.h>
+
+#include <iprt/test.h>
+#include <iprt/time.h>
+
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+static RTTEST g_hTest;
+
+
+/** Worker fro TST_COM_EXPR(). */
+static HRESULT tstComExpr(HRESULT hrc, const char *pszOperation, int iLine)
+{
+    if (FAILED(hrc))
+        RTTestFailed(g_hTest, "%s failed on line %u with hrc=%Rhrc", pszOperation, iLine, hrc);
+    return hrc;
+}
+
+/** Macro that executes the given expression and report any failure.
+ *  The expression must return a HRESULT. */
+#define TST_COM_EXPR(expr) tstComExpr(expr, #expr, __LINE__)
+
+
+
+static void tstApiPrf1(IVirtualBox *pVBox)
+{
+    RTTestSub(g_hTest, "IVirtualBox::Revision performance");
+
+    uint32_t const cCalls   = 65536;
+    uint32_t       cLeft    = cCalls;
+    uint64_t       uStartTS = RTTimeNanoTS();
+    while (cLeft-- > 0)
+    {
+        ULONG uRev;
+        HRESULT hrc = pVBox->COMGETTER(Revision)(&uRev);
+        if (FAILED(hrc))
+        {
+            tstComExpr(hrc, "IVirtualBox::Revision", __LINE__);
+            return;
+        }
+    }
+    uint64_t uElapsed = RTTimeNanoTS() - uStartTS;
+    RTTestValue(g_hTest, "IVirtualBox::Revision average", uElapsed / cCalls, RTTESTUNIT_NS_PER_CALL);
+    RTTestSubDone(g_hTest);
+}
+
+
+static void tstApiPrf2(IVirtualBox *pVBox)
+{
+    RTTestSub(g_hTest, "IVirtualBox::Version performance");
+
+    uint32_t const cCalls   = 65536;
+    uint32_t       cLeft    = cCalls;
+    uint64_t       uStartTS = RTTimeNanoTS();
+    while (cLeft-- > 0)
+    {
+        com::Bstr bstrVersion;
+        HRESULT hrc = pVBox->COMGETTER(Version)(bstrVersion.asOutParam());
+        if (FAILED(hrc))
+        {
+            tstComExpr(hrc, "IVirtualBox::Version", __LINE__);
+            return;
+        }
+    }
+    uint64_t uElapsed = RTTimeNanoTS() - uStartTS;
+    RTTestValue(g_hTest, "IVirtualBox::Version average", uElapsed / cCalls, RTTESTUNIT_NS_PER_CALL);
+    RTTestSubDone(g_hTest);
+}
+
+
+static void tstApiPrf3(IVirtualBox *pVBox)
+{
+    RTTestSub(g_hTest, "IVirtualBox::Host performance");
+
+    /* The first call. */
+    uint64_t    uStartTS = RTTimeNanoTS();
+    IHost      *pHost = NULL;
+    HRESULT     hrc = pVBox->COMGETTER(Host)(&pHost);
+    if (FAILED(hrc))
+    {
+        tstComExpr(hrc, "IVirtualBox::Host", __LINE__);
+        return;
+    }
+    pHost->Release();
+    uint64_t uElapsed = RTTimeNanoTS() - uStartTS;
+    RTTestValue(g_hTest, "IVirtualBox::Host first", uElapsed, RTTESTUNIT_NS);
+
+    /* Subsequent calls. */
+    uint32_t const cCalls1  = 4096;
+    uint32_t       cLeft    = cCalls1;
+    uStartTS = RTTimeNanoTS();
+    while (cLeft-- > 0)
+    {
+        IHost *pHost2 = NULL;
+        hrc = pVBox->COMGETTER(Host)(&pHost2);
+        if (FAILED(hrc))
+        {
+            tstComExpr(hrc, "IVirtualBox::Host", __LINE__);
+            return;
+        }
+        pHost2->Release();
+    }
+    uElapsed = RTTimeNanoTS() - uStartTS;
+    RTTestValue(g_hTest, "IVirtualBox::Host average", uElapsed / cCalls1, RTTESTUNIT_NS_PER_CALL);
+
+    /* Keep a reference around and see how that changes things.
+       Note! VBoxSVC is not creating and destroying Host().  */
+    pHost = NULL;
+    hrc = pVBox->COMGETTER(Host)(&pHost);
+
+    uint32_t const cCalls2  = 16384;
+    cLeft    = cCalls2;
+    uStartTS = RTTimeNanoTS();
+    while (cLeft-- > 0)
+    {
+        IHost *pHost2 = NULL;
+        hrc = pVBox->COMGETTER(Host)(&pHost2);
+        if (FAILED(hrc))
+        {
+            tstComExpr(hrc, "IVirtualBox::Host", __LINE__);
+            pHost->Release();
+            return;
+        }
+        pHost2->Release();
+    }
+    uElapsed = RTTimeNanoTS() - uStartTS;
+    RTTestValue(g_hTest, "IVirtualBox::Host 2nd ref", uElapsed / cCalls2, RTTESTUNIT_NS_PER_CALL);
+    pHost->Release();
+
+    RTTestSubDone(g_hTest);
+}
+
+
+static void tstApiPrf4(IVirtualBox *pVBox)
+{
+    RTTestSub(g_hTest, "IHost::GetProcessorFeature performance");
+
+    IHost      *pHost = NULL;
+    HRESULT     hrc = pVBox->COMGETTER(Host)(&pHost);
+    if (FAILED(hrc))
+    {
+        tstComExpr(hrc, "IVirtualBox::Host", __LINE__);
+        return;
+    }
+
+    uint32_t const  cCalls   = 65536;
+    uint32_t        cLeft    = cCalls;
+    uint64_t        uStartTS = RTTimeNanoTS();
+    while (cLeft-- > 0)
+    {
+        BOOL fSupported;
+        hrc = pHost->GetProcessorFeature(ProcessorFeature_PAE, &fSupported);
+        if (FAILED(hrc))
+        {
+            tstComExpr(hrc, "IHost::GetProcessorFeature", __LINE__);
+            pHost->Release();
+            return;
+        }
+    }
+    uint64_t uElapsed = RTTimeNanoTS() - uStartTS;
+    RTTestValue(g_hTest, "IHost::GetProcessorFeature average", uElapsed / cCalls, RTTESTUNIT_NS_PER_CALL);
+    pHost->Release();
+    RTTestSubDone(g_hTest);
+}
+
+
+
+int main(int argc, char **argv)
+{
+    /*
+     * Initialization.
+     */
+    RTEXITCODE rcExit = RTTestInitAndCreate("tstVBoxAPIPerf", &g_hTest);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+    SUPR3Init(NULL); /* Better time support. */
+    RTTestBanner(g_hTest);
+
+    RTTestSub(g_hTest, "Initializing COM and singletons");
+    HRESULT hrc = com::Initialize();
+    if (SUCCEEDED(hrc))
+    {
+        ComPtr<IVirtualBox> ptrVBox;
+        hrc = TST_COM_EXPR(ptrVBox.createLocalObject(CLSID_VirtualBox));
+        if (SUCCEEDED(hrc))
+        {
+            ComPtr<ISession> ptrSession;
+            hrc = TST_COM_EXPR(ptrSession.createInprocObject(CLSID_Session));
+            if (SUCCEEDED(hrc))
+            {
+                RTTestSubDone(g_hTest);
+
+                /*
+                 * Call test functions.
+                 */
+                tstApiPrf1(ptrVBox);
+                tstApiPrf2(ptrVBox);
+                tstApiPrf3(ptrVBox);
+
+                /** @todo Find something that returns a 2nd instance of an interface and see
+                 *        how if wrapper stuff is reused in any way. */
+                tstApiPrf4(ptrVBox);
+            }
+        }
+
+        ptrVBox.setNull();
+        com::Shutdown();
+    }
+    else
+        RTTestIFailed("com::Initialize failed with hrc=%Rhrc", hrc);
+    return RTTestSummaryAndDestroy(g_hTest);
+}
+
diff --git a/src/VBox/Main/testcase/tstVBoxAPIWin.cpp b/src/VBox/Main/testcase/tstVBoxAPIWin.cpp
index 6211e42..aa60654 100644
--- a/src/VBox/Main/testcase/tstVBoxAPIWin.cpp
+++ b/src/VBox/Main/testcase/tstVBoxAPIWin.cpp
@@ -12,7 +12,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -73,7 +73,7 @@ int listVMs(IVirtualBox *virtualBox)
     if (SUCCEEDED(rc))
     {
         IMachine **machines;
-        rc = SafeArrayAccessData (machinesArray, (void **) &machines);
+        rc = SafeArrayAccessData(machinesArray, (void **) &machines);
         if (SUCCEEDED(rc))
         {
             for (ULONG i = 0; i < machinesArray->rgsabound[0].cElements; ++i)
@@ -88,10 +88,10 @@ int listVMs(IVirtualBox *virtualBox)
                 }
             }
 
-            SafeArrayUnaccessData (machinesArray);
+            SafeArrayUnaccessData(machinesArray);
         }
 
-        SafeArrayDestroy (machinesArray);
+        SafeArrayDestroy(machinesArray);
     }
 
     return 0;
@@ -217,8 +217,8 @@ int testStartVM(IVirtualBox *virtualBox)
             }
 
             /* Wait until VM is running. */
-            printf ("Starting VM, please wait ...\n");
-            rc = progress->WaitForCompletion (-1);
+            printf("Starting VM, please wait ...\n");
+            rc = progress->WaitForCompletion(-1);
 
             /* Get console object. */
             session->get_Console(&console);
@@ -226,15 +226,15 @@ int testStartVM(IVirtualBox *virtualBox)
             /* Bring console window to front. */
             machine->ShowConsoleWindow(0);
 
-            printf ("Press enter to power off VM and close the session...\n");
+            printf("Press enter to power off VM and close the session...\n");
             getchar();
 
             /* Power down the machine. */
             rc = console->PowerDown(&progress);
 
             /* Wait until VM is powered down. */
-            printf ("Powering off VM, please wait ...\n");
-            rc = progress->WaitForCompletion (-1);
+            printf("Powering off VM, please wait ...\n");
+            rc = progress->WaitForCompletion(-1);
 
             /* Close the session. */
             rc = session->UnlockMachine();
diff --git a/src/VBox/Main/testcase/tstVBoxAPIXPCOM.cpp b/src/VBox/Main/testcase/tstVBoxAPIXPCOM.cpp
index 1ea16f6..71caca4 100644
--- a/src/VBox/Main/testcase/tstVBoxAPIXPCOM.cpp
+++ b/src/VBox/Main/testcase/tstVBoxAPIXPCOM.cpp
@@ -1,13 +1,14 @@
+/* $Id: tstVBoxAPIXPCOM.cpp $ */
 /** @file
  *
- * tstVBoxAPILinux - sample program to illustrate the VirtualBox
- *                   XPCOM API for machine management on Linux.
+ * tstVBoxAPIXPCOM - sample program to illustrate the VirtualBox
+ *                   XPCOM API for machine management.
  *                   It only uses standard C/C++ and XPCOM semantics,
  *                   no additional VBox classes/macros/helpers.
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -52,7 +53,7 @@
  * and where to search for VirtualBox shared libraries. Therefore, you need to
  * use the following (or similar) command to execute it:
  *
- *   $ env VBOX_XPCOM_HOME=../../.. LD_LIBRARY_PATH=../../.. ./tstVBoxAPILinux
+ *   $ env VBOX_XPCOM_HOME=../../.. LD_LIBRARY_PATH=../../.. ./tstVBoxAPIXPCOM
  *
  * The above command assumes that VBoxRT.so, VBoxXPCOM.so and others reside in
  * the directory ../../..
@@ -73,18 +74,6 @@
 
 #include <nsIExceptionService.h>
 
-#include <VBox/com/com.h>
-#include <VBox/com/string.h>
-#include <VBox/com/array.h>
-#include <VBox/com/Guid.h>
-#include <VBox/com/ErrorInfo.h>
-#include <VBox/com/errorprint.h>
-
-#include <VBox/com/VirtualBox.h>
-
-#include <iprt/stream.h>
-
-
 /*
  * VirtualBox XPCOM interface. This header is generated
  * from IDL which in turn is generated from a custom XML format.
@@ -108,8 +97,8 @@ void listVMs(IVirtualBox *virtualBox)
 {
     nsresult rc;
 
-    RTPrintf("----------------------------------------------------\n");
-    RTPrintf("VM List:\n\n");
+    printf("----------------------------------------------------\n");
+    printf("VM List:\n\n");
 
     /*
      * Get the list of all registered VMs
@@ -136,18 +125,18 @@ void listVMs(IVirtualBox *virtualBox)
                     nsXPIDLString machineName;
                     machine->GetName(getter_Copies(machineName));
                     char *machineNameAscii = ToNewCString(machineName);
-                    RTPrintf("\tName:        %s\n", machineNameAscii);
+                    printf("\tName:        %s\n", machineNameAscii);
                     free(machineNameAscii);
                 }
                 else
                 {
-                    RTPrintf("\tName:        <inaccessible>\n");
+                    printf("\tName:        <inaccessible>\n");
                 }
 
                 nsXPIDLString iid;
                 machine->GetId(getter_Copies(iid));
                 const char *uuidString = ToNewCString(iid);
-                RTPrintf("\tUUID:        %s\n", uuidString);
+                printf("\tUUID:        %s\n", uuidString);
                 free((void*)uuidString);
 
                 if (isAccessible)
@@ -155,21 +144,21 @@ void listVMs(IVirtualBox *virtualBox)
                     nsXPIDLString configFile;
                     machine->GetSettingsFilePath(getter_Copies(configFile));
                     char *configFileAscii = ToNewCString(configFile);
-                    RTPrintf("\tConfig file: %s\n", configFileAscii);
+                    printf("\tConfig file: %s\n", configFileAscii);
                     free(configFileAscii);
 
                     PRUint32 memorySize;
                     machine->GetMemorySize(&memorySize);
-                    RTPrintf("\tMemory size: %uMB\n", memorySize);
+                    printf("\tMemory size: %uMB\n", memorySize);
 
                     nsXPIDLString typeId;
                     machine->GetOSTypeId(getter_Copies(typeId));
                     IGuestOSType *osType = nsnull;
-                    virtualBox->GetGuestOSType (typeId.get(), &osType);
+                    virtualBox->GetGuestOSType(typeId.get(), &osType);
                     nsXPIDLString osName;
                     osType->GetDescription(getter_Copies(osName));
                     char *osNameAscii = ToNewCString(osName);
-                    RTPrintf("\tGuest OS:    %s\n\n", osNameAscii);
+                    printf("\tGuest OS:    %s\n\n", osNameAscii);
                     free(osNameAscii);
                     osType->Release();
                 }
@@ -179,7 +168,7 @@ void listVMs(IVirtualBox *virtualBox)
             }
         }
     }
-    RTPrintf("----------------------------------------------------\n\n");
+    printf("----------------------------------------------------\n\n");
 }
 
 /**
@@ -203,7 +192,7 @@ void createVM(IVirtualBox *virtualBox)
                                    getter_AddRefs(machine));
     if (NS_FAILED(rc))
     {
-        RTPrintf("Error: could not create machine! rc=%Rhrc\n", rc);
+        printf("Error: could not create machine! rc=%#x\n", rc);
         return;
     }
 
@@ -229,11 +218,11 @@ void createVM(IVirtualBox *virtualBox)
                                     getter_AddRefs(osType));
     if (NS_FAILED(rc))
     {
-        RTPrintf("Error: could not find guest OS type! rc=%Rhrc\n", rc);
+        printf("Error: could not find guest OS type! rc=%#x\n", rc);
     }
     else
     {
-        machine->SetOSTypeId (NS_LITERAL_STRING("Windows2000").get());
+        machine->SetOSTypeId(NS_LITERAL_STRING("Windows2000").get());
     }
 
     /*
@@ -247,7 +236,7 @@ void createVM(IVirtualBox *virtualBox)
     rc = virtualBox->RegisterMachine(machine);
     if (NS_FAILED(rc))
     {
-        RTPrintf("Error: could not register machine! rc=%Rhrc\n", rc);
+        printf("Error: could not register machine! rc=%#x\n", rc);
         printErrorInfo();
         return;
     }
@@ -262,26 +251,26 @@ void createVM(IVirtualBox *virtualBox)
     nsCOMPtr<IMachine> sessionMachine;
     {
         nsCOMPtr<nsIComponentManager> manager;
-        rc = NS_GetComponentManager (getter_AddRefs (manager));
+        rc = NS_GetComponentManager(getter_AddRefs(manager));
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error: could not get component manager! rc=%Rhrc\n", rc);
+            printf("Error: could not get component manager! rc=%#x\n", rc);
             return;
         }
-        rc = manager->CreateInstanceByContractID (NS_SESSION_CONTRACTID,
-                                                  nsnull,
-                                                  NS_GET_IID(ISession),
-                                                  getter_AddRefs(session));
+        rc = manager->CreateInstanceByContractID(NS_SESSION_CONTRACTID,
+                                                 nsnull,
+                                                 NS_GET_IID(ISession),
+                                                 getter_AddRefs(session));
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error, could not instantiate session object! rc=%Rhrc\n", rc);
+            printf("Error, could not instantiate session object! rc=%#x\n", rc);
             return;
         }
 
         rc = machine->LockMachine(session, LockType_Write);
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error, could not lock the machine for the session! rc=%Rhrc\n", rc);
+            printf("Error, could not lock the machine for the session! rc=%#x\n", rc);
             return;
         }
 
@@ -293,7 +282,7 @@ void createVM(IVirtualBox *virtualBox)
         rc = session->GetMachine(getter_AddRefs(sessionMachine));
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error, could not get machine session! rc=%Rhrc\n", rc);
+            printf("Error, could not get machine session! rc=%#x\n", rc);
             return;
         }
     }
@@ -302,12 +291,13 @@ void createVM(IVirtualBox *virtualBox)
      * Create a virtual harddisk
      */
     nsCOMPtr<IMedium> hardDisk = 0;
-    rc = virtualBox->CreateHardDisk(NS_LITERAL_STRING("VDI").get(),
-                                    NS_LITERAL_STRING("TestHardDisk.vdi").get(),
-                                    getter_AddRefs(hardDisk));
+    rc = virtualBox->CreateMedium(NS_LITERAL_STRING("VDI").get(),
+                                  NS_LITERAL_STRING("/tmp/TestHardDisk.vdi").get(),
+                                  AccessMode_ReadWrite, DeviceType_HardDisk,
+                                  getter_AddRefs(hardDisk));
     if (NS_FAILED(rc))
     {
-        RTPrintf("Failed creating a hard disk object! rc=%Rhrc\n", rc);
+        printf("Failed creating a hard disk object! rc=%#x\n", rc);
     }
     else
     {
@@ -316,15 +306,15 @@ void createVM(IVirtualBox *virtualBox)
          * because none of its properties has been set so far. Let's continue creating
          * a dynamically expanding image.
          */
-        nsCOMPtr <IProgress> progress;
-        com::SafeArray<MediumVariant_T> mediumVariant;
-        mediumVariant.push_back(MediumVariant_Standard);
-        rc = hardDisk->CreateBaseStorage(100,                                // size in megabytes
-                                         ComSafeArrayAsInParam(mediumVariant),
+        nsCOMPtr<IProgress> progress;
+        MediumVariant_T mediumVariants[] =
+            { MediumVariant_Standard };
+        rc = hardDisk->CreateBaseStorage(100 * 1024 * 1024,                  // size in bytes
+                                         sizeof(mediumVariants) / sizeof(mediumVariants[0]), mediumVariants,
                                          getter_AddRefs(progress));          // optional progress object
         if (NS_FAILED(rc))
         {
-            RTPrintf("Failed creating hard disk image! rc=%Rhrc\n", rc);
+            printf("Failed creating hard disk image! rc=%#x\n", rc);
         }
         else
         {
@@ -338,7 +328,7 @@ void createVM(IVirtualBox *virtualBox)
             progress->GetResultCode(&resultCode);
             if (NS_FAILED(rc) || NS_FAILED(resultCode))
             {
-                RTPrintf("Error: could not create hard disk! rc=%Rhrc\n",
+                printf("Error: could not create hard disk! rc=%#x\n",
                        NS_FAILED(rc) ? rc : resultCode);
             }
             else
@@ -354,7 +344,7 @@ void createVM(IVirtualBox *virtualBox)
                                            hardDisk);
                 if (NS_FAILED(rc))
                 {
-                    RTPrintf("Error: could not attach hard disk! rc=%Rhrc\n", rc);
+                    printf("Error: could not attach hard disk! rc=%#x\n", rc);
                 }
             }
         }
@@ -373,7 +363,7 @@ void createVM(IVirtualBox *virtualBox)
                                 false /* fForceNewUuid */,
                                 getter_AddRefs(dvdImage));
     if (NS_FAILED(rc))
-        RTPrintf("Error: could not open CD image! rc=%Rhrc\n", rc);
+        printf("Error: could not open CD image! rc=%#x\n", rc);
     else
     {
         /*
@@ -387,17 +377,17 @@ void createVM(IVirtualBox *virtualBox)
                                   PR_FALSE);                      // aForce
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error: could not mount ISO image! rc=%Rhrc\n", rc);
+            printf("Error: could not mount ISO image! rc=%#x\n", rc);
         }
         else
         {
             /*
              * Last step: tell the VM to boot from the CD.
              */
-            rc = sessionMachine->SetBootOrder (1, DeviceType::DVD);
+            rc = sessionMachine->SetBootOrder(1, DeviceType::DVD);
             if (NS_FAILED(rc))
             {
-                RTPrintf("Could not set boot device! rc=%Rhrc\n", rc);
+                printf("Could not set boot device! rc=%#x\n", rc);
             }
         }
     }
@@ -407,7 +397,7 @@ void createVM(IVirtualBox *virtualBox)
      */
     rc = sessionMachine->SaveSettings();
     if (NS_FAILED(rc))
-        RTPrintf("Could not save machine settings! rc=%Rhrc\n", rc);
+        printf("Could not save machine settings! rc=%#x\n", rc);
 
     /*
      * It is always important to close the open session when it becomes not
@@ -415,25 +405,26 @@ void createVM(IVirtualBox *virtualBox)
      */
     session->UnlockMachine();
 
-    com::SafeIfaceArray<IMedium> aMedia;
+    IMedium **aMedia;
+    PRUint32 cMedia;
     rc = machine->Unregister((CleanupMode_T)CleanupMode_DetachAllReturnHardDisksOnly,
-                             ComSafeArrayAsOutParam(aMedia));
+                             &cMedia, &aMedia);
     if (NS_FAILED(rc))
-        RTPrintf("Unregistering the machine failed! rc=%Rhrc\n", rc);
+        printf("Unregistering the machine failed! rc=%#x\n", rc);
     else
     {
-        ComPtr<IProgress> pProgress;
-        rc = machine->DeleteConfig(ComSafeArrayAsInParam(aMedia), pProgress.asOutParam());
+        nsCOMPtr<IProgress> pProgress;
+        rc = machine->DeleteConfig(cMedia, aMedia, getter_AddRefs(pProgress));
         if (NS_FAILED(rc))
-            RTPrintf("Deleting of machine failed! rc=%Rhrc\n", rc);
+            printf("Deleting of machine failed! rc=%#x\n", rc);
         else
         {
             rc = pProgress->WaitForCompletion(-1);
             PRInt32 resultCode;
             pProgress->GetResultCode(&resultCode);
             if (NS_FAILED(rc) || NS_FAILED(resultCode))
-                RTPrintf("Failed to delete the machine! rc=%Rhrc\n",
-                         NS_FAILED(rc) ? rc : resultCode);
+                printf("Failed to delete the machine! rc=%#x\n",
+                       NS_FAILED(rc) ? rc : resultCode);
         }
     }
 }
@@ -452,7 +443,7 @@ int main(int argc, char *argv[])
      */
     if (sizeof(PRUnichar) != sizeof(wchar_t))
     {
-        RTPrintf("Error: sizeof(PRUnichar) {%lu} != sizeof(wchar_t) {%lu}!\n"
+        printf("Error: sizeof(PRUnichar) {%lu} != sizeof(wchar_t) {%lu}!\n"
                "Probably, you forgot the -fshort-wchar compiler option.\n",
                (unsigned long) sizeof(PRUnichar),
                (unsigned long) sizeof(wchar_t));
@@ -475,7 +466,7 @@ int main(int argc, char *argv[])
         rc = NS_InitXPCOM2(getter_AddRefs(serviceManager), nsnull, nsnull);
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error: XPCOM could not be initialized! rc=%Rhrc\n", rc);
+            printf("Error: XPCOM could not be initialized! rc=%#x\n", rc);
             return -1;
         }
 
@@ -488,7 +479,7 @@ int main(int argc, char *argv[])
         nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(serviceManager);
         if (!registrar)
         {
-            RTPrintf("Error: could not query nsIComponentRegistrar interface!\n");
+            printf("Error: could not query nsIComponentRegistrar interface!\n");
             return -1;
         }
         registrar->AutoRegister(nsnull);
@@ -503,10 +494,10 @@ int main(int argc, char *argv[])
          * operations so it doesn't run the event loop.
          */
         nsCOMPtr<nsIEventQueue> eventQ;
-        rc = NS_GetMainEventQ(getter_AddRefs (eventQ));
+        rc = NS_GetMainEventQ(getter_AddRefs(eventQ));
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error: could not get main event queue! rc=%Rhrc\n", rc);
+            printf("Error: could not get main event queue! rc=%#x\n", rc);
             return -1;
         }
 
@@ -519,24 +510,24 @@ int main(int argc, char *argv[])
          * counting and freeing.
          */
         nsCOMPtr<nsIComponentManager> manager;
-        rc = NS_GetComponentManager (getter_AddRefs (manager));
+        rc = NS_GetComponentManager(getter_AddRefs(manager));
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error: could not get component manager! rc=%Rhrc\n", rc);
+            printf("Error: could not get component manager! rc=%#x\n", rc);
             return -1;
         }
 
         nsCOMPtr<IVirtualBox> virtualBox;
-        rc = manager->CreateInstanceByContractID (NS_VIRTUALBOX_CONTRACTID,
-                                                  nsnull,
-                                                  NS_GET_IID(IVirtualBox),
-                                                  getter_AddRefs(virtualBox));
+        rc = manager->CreateInstanceByContractID(NS_VIRTUALBOX_CONTRACTID,
+                                                 nsnull,
+                                                 NS_GET_IID(IVirtualBox),
+                                                 getter_AddRefs(virtualBox));
         if (NS_FAILED(rc))
         {
-            RTPrintf("Error, could not instantiate VirtualBox object! rc=%Rhrc\n", rc);
+            printf("Error, could not instantiate VirtualBox object! rc=%#x\n", rc);
             return -1;
         }
-        RTPrintf("VirtualBox object created\n");
+        printf("VirtualBox object created\n");
 
         ////////////////////////////////////////////////////////////////////////////////
         ////////////////////////////////////////////////////////////////////////////////
@@ -566,7 +557,7 @@ int main(int argc, char *argv[])
      * Perform the standard XPCOM shutdown procedure.
      */
     NS_ShutdownXPCOM(nsnull);
-    RTPrintf("Done!\n");
+    printf("Done!\n");
     return 0;
 }
 
@@ -587,7 +578,7 @@ char *nsIDToString(nsID *guid)
 
     if (res != NULL)
     {
-        RTStrPrintf(res, 39, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+        snprintf(res, 39, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
                  guid->m0, (PRUint32)guid->m1, (PRUint32)guid->m2,
                  (PRUint32)guid->m3[0], (PRUint32)guid->m3[1], (PRUint32)guid->m3[2],
                  (PRUint32)guid->m3[3], (PRUint32)guid->m3[4], (PRUint32)guid->m3[5],
@@ -605,48 +596,48 @@ void printErrorInfo()
 {
     nsresult rc;
 
-    nsCOMPtr <nsIExceptionService> es;
-    es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
+    nsCOMPtr<nsIExceptionService> es;
+    es = do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID, &rc);
     if (NS_SUCCEEDED(rc))
     {
-        nsCOMPtr <nsIExceptionManager> em;
-        rc = es->GetCurrentExceptionManager (getter_AddRefs (em));
+        nsCOMPtr<nsIExceptionManager> em;
+        rc = es->GetCurrentExceptionManager(getter_AddRefs(em));
         if (NS_SUCCEEDED(rc))
         {
             nsCOMPtr<nsIException> ex;
-            rc = em->GetCurrentException (getter_AddRefs (ex));
+            rc = em->GetCurrentException(getter_AddRefs(ex));
             if (NS_SUCCEEDED(rc) && ex)
             {
-                nsCOMPtr <IVirtualBoxErrorInfo> info;
+                nsCOMPtr<IVirtualBoxErrorInfo> info;
                 info = do_QueryInterface(ex, &rc);
                 if (NS_SUCCEEDED(rc) && info)
                 {
                     /* got extended error info */
-                    RTPrintf ("Extended error info (IVirtualBoxErrorInfo):\n");
+                    printf("Extended error info (IVirtualBoxErrorInfo):\n");
                     PRInt32 resultCode = NS_OK;
-                    info->GetResultCode (&resultCode);
-                    RTPrintf ("  resultCode=%08X\n", resultCode);
+                    info->GetResultCode(&resultCode);
+                    printf("  resultCode=%08X\n", resultCode);
                     nsXPIDLString component;
-                    info->GetComponent (getter_Copies (component));
-                    RTPrintf ("  component=%s\n", NS_ConvertUTF16toUTF8(component).get());
+                    info->GetComponent(getter_Copies(component));
+                    printf("  component=%s\n", NS_ConvertUTF16toUTF8(component).get());
                     nsXPIDLString text;
-                    info->GetText (getter_Copies (text));
-                    RTPrintf ("  text=%s\n", NS_ConvertUTF16toUTF8(text).get());
+                    info->GetText(getter_Copies(text));
+                    printf("  text=%s\n", NS_ConvertUTF16toUTF8(text).get());
                 }
                 else
                 {
                     /* got basic error info */
-                    RTPrintf ("Basic error info (nsIException):\n");
+                    printf("Basic error info (nsIException):\n");
                     nsresult resultCode = NS_OK;
-                    ex->GetResult (&resultCode);
-                    RTPrintf ("  resultCode=%08X\n", resultCode);
+                    ex->GetResult(&resultCode);
+                    printf("  resultCode=%08X\n", resultCode);
                     nsXPIDLCString message;
-                    ex->GetMessage (getter_Copies (message));
-                    RTPrintf ("  message=%s\n", message.get());
+                    ex->GetMessage(getter_Copies(message));
+                    printf("  message=%s\n", message.get());
                 }
 
                 /* reset the exception to NULL to indicate we've processed it */
-                em->SetCurrentException (NULL);
+                em->SetCurrentException(NULL);
 
                 rc = NS_OK;
             }
diff --git a/src/VBox/Main/webservice/Makefile.kmk b/src/VBox/Main/webservice/Makefile.kmk
index 0e377bb..2e91a8e 100644
--- a/src/VBox/Main/webservice/Makefile.kmk
+++ b/src/VBox/Main/webservice/Makefile.kmk
@@ -6,7 +6,7 @@
 #
 
 #
-# Copyright (C) 2007-2013 Oracle Corporation
+# Copyright (C) 2007-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -446,7 +446,7 @@ $(VBOX_JWS_GEN)/MANIFEST.MF: $(VBOX_PATH_WEBSERVICE)/MANIFEST.MF.in
 		-e 's/@VBOX_API_SUFFIX@/$(VBOX_API_SUFFIX)/' \
 		<  $< >  $@
 
-$$(VBOX_JWSDOC_JAR): $(VBOX_JWS_GEN)/jwsglue.list $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) $$(VBOX_JWS_JAR) | $$(dir $$@)
+$$(VBOX_JWSDOC_JAR): $(VBOX_JWS_GEN)/jwsglue.list $$(VBoxJWs-inst-jar_GENERATEDSOURCES) $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL) $$(VBOX_JWS_JAR) | $$(dir $$@)
 	$(call MSG_TOOL,javadoc,$(notdir $@),jwsgen.list,)
 	$(QUIET)$(RM) -Rf $(VBOX_JWSDOC_JDEST)
 	$(QUIET)$(MKDIR) -p $(VBOX_JWSDOC_JDEST)
@@ -527,7 +527,7 @@ if defined(VBOX_ONLY_SDK) && "$(KBUILD_TARGET)" != "win"
  # Globals relevant to the SDK.
  #
  VBOXWEB_GLUE_PYTHON           = $(VBOX_PATH_SDK)/bindings/webservice/python/lib/VirtualBox_wrappers.py
- VBOXWEB_WS_PYTHON             = $(VBOX_PATH_SDK)/bindings/webservice/python/lib/VirtualBox_services.py
+ VBOXWEB_WS_PYTHON             = $(VBOX_PATH_SDK)/bindings/webservice/python/lib/VirtualBox_server.py
  VBOXWEB_WS_PERL               = $(VBOX_PATH_SDK)/bindings/webservice/perl/lib/vboxService.pm
  VBOXWEB_WS_PHP                = $(VBOX_PATH_SDK)/bindings/webservice/php/lib/vboxServiceWrappers.php
  VBOXWEB_SAMPLES_JAXWS_DIR     = $(VBOX_PATH_SDK)/bindings/webservice/java/jax-ws/samples
@@ -539,11 +539,10 @@ if defined(VBOX_ONLY_SDK) && "$(KBUILD_TARGET)" != "win"
  endef
 
  VBOXWEB_OTHERS               +=  \
-	$(VBOXWEB_GLUE_PYTHON) 	  \
-	$(VBOXWEB_WS_PYTHON)      \
-	$(VBOXWEB_WS_PERL)        \
-	$(VBOXWEB_WS_PHP)         \
-	$(VBOXWEB_PYTHONWSSAMPLE) \
+	$(if $(VBOX_WITH_PYTHON),$(VBOXWEB_GLUE_PYTHON),)       \
+	$(if $(VBOX_WITH_PYTHON),$(VBOXWEB_WS_PYTHON),)         \
+	$(if $(VBOX_WITH_PERL),$(VBOXWEB_WS_PERL),)             \
+	$(if $(VBOX_WITH_PHP),$(VBOXWEB_WS_PHP),)               \
 	$(PATH_ROOT)
 
 
@@ -554,17 +553,17 @@ if defined(VBOX_ONLY_SDK) && "$(KBUILD_TARGET)" != "win"
  vboxwebinst_INST = $(INST_SDK)bindings/webservice/
  vboxwebinst_MODE = a+rx,u+w
  vboxwebinst_SOURCES = \
-	samples/perl/clienttest.pl=>perl/samples/clienttest.pl \
-	samples/php/clienttest.php=>php/samples/clienttest.php \
-	samples/python/clienttest.py=>python/samples/clienttest.py
+	$(if $(VBOX_WITH_PERL),samples/perl/clienttest.pl=>perl/samples/clienttest.pl,) \
+	$(if $(VBOX_WITH_PHP),samples/php/clienttest.php=>php/samples/clienttest.php,) \
+	$(if $(VBOX_WITH_PYTHON),samples/python/clienttest.py=>python/samples/clienttest.py,)
 
  INSTALLS += vboxwebinst_nox
  vboxwebinst_nox_INST = $(INST_SDK)bindings/webservice/
  vboxwebinst_nox_MODE = a+r,u+w
  vboxwebinst_nox_SOURCES = \
-	samples/python/Makefile=>python/samples/Makefile \
-	samples/python/Makefile.glue=>python/lib/Makefile \
-	$(PATH_ROOT)/COPYING.LIB=>java/jax-ws/COPYING.LIB
+	$(if $(VBOX_WITH_PYTHON),samples/python/Makefile=>python/samples/Makefile,) \
+	$(if $(VBOX_WITH_PYTHON),samples/python/Makefile.glue=>python/lib/Makefile,) \
+	$(if ($VBOX_WITH_JWS),$(PATH_ROOT)/COPYING.LIB=>java/jax-ws/COPYING.LIB,)
 
  INSTALLS += vboxwebinst_wsdl
  vboxwebinst_wsdl_INST = $(INST_SDK)bindings/webservice/
@@ -627,7 +626,7 @@ $(VBOXWEB_WS_PERL): $(VBOXWEB_WSDL) $(VBOXWEBSERVICE_WSDL)
 	$(QUIET)$(MKDIR) -p $(@D)
 	$(QUIET)$(REDIRECT) -C $(@D) -- $(VBOX_STUBMAKER) file://$(VBOXWEBSERVICE_WSDL)
 # Ugly, ugly, ugly, make me right once
-	$(QUIET)$(SED) -e "s+http://www.virtualbox.org/Service+http://www.virtualbox.org/+" < $(VBOXWEB_WS_PERL) > $(VBOXWEB_WS_PERL).tmp
+	$(QUIET)$(SED) -e "s+http://www.virtualbox.org/Service+http://www.virtualbox.org/+" --output $(VBOXWEB_WS_PERL).tmp $(VBOXWEB_WS_PERL)
 	$(QUIET)$(MV) $(VBOXWEB_WS_PERL).tmp $(VBOXWEB_WS_PERL)
 	$(QUIET)$(APPEND) $@ ''
 
diff --git a/src/VBox/Main/webservice/VBoxWebSrv.rc b/src/VBox/Main/webservice/VBoxWebSrv.rc
index 5123f4a..989d2d5 100644
--- a/src/VBox/Main/webservice/VBoxWebSrv.rc
+++ b/src/VBox/Main/webservice/VBoxWebSrv.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_APP
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_APP
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Web Service\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxWebSrv\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxWebSrv.exe\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Main/webservice/samples/php/clienttest.php b/src/VBox/Main/webservice/samples/php/clienttest.php
index 3b6d805..b27896a 100644
--- a/src/VBox/Main/webservice/samples/php/clienttest.php
+++ b/src/VBox/Main/webservice/samples/php/clienttest.php
@@ -57,11 +57,11 @@ foreach ($machines as $machine)
         {
             $console = $session->console;
             $display = $console->display;
-            list($screenWidth, $screenHeight, $screenBpp, $screenX, $screenY) = $display->getScreenResolution(0 /* First screen */);             
+            list($screenWidth, $screenHeight, $screenBpp, $screenX, $screenY, $screenStatus) = $display->getScreenResolution(0 /* First screen */);
 
-            $imageraw = $display->takeScreenShotToArray(0 /* First screen */, $screenWidth, $screenHeight);
+            $imageraw = $display->takeScreenShotToArray(0 /* First screen */, $screenWidth, $screenHeight, "RGBA");
             echo "Screenshot size: " . sizeof($imageraw) . "\n";
-            
+
             $filename = 'screenshot.png';
             echo "Saving screenshot of " . $machine->name . " (${screenWidth}x${screenHeight}, ${screenBpp}BPP) to $filename\n";
             $image = imagecreatetruecolor($screenWidth, $screenHeight);
diff --git a/src/VBox/Main/webservice/samples/python/clienttest.py b/src/VBox/Main/webservice/samples/python/clienttest.py
index bcb2b81..0b03ebe 100755
--- a/src/VBox/Main/webservice/samples/python/clienttest.py
+++ b/src/VBox/Main/webservice/samples/python/clienttest.py
@@ -17,7 +17,7 @@
 # - If not already done, set the environment variable "VBOX_INSTALL_PATH"
 #   to point to your VirtualBox installation directory (which in turn must have
 #   the "sdk" subfolder")
-# - Install the VirtualBox Python bindings by doing a 
+# - Install the VirtualBox Python bindings by doing a
 #   "[python] vboxapisetup.py install"
 # - Run this sample with "[python] clienttest.py"
 
@@ -100,7 +100,7 @@ def main(argv):
 
                 # Get the VM's current display resolution + bit depth + position
                 screenNum = 0 # From first screen
-                (screenW, screenH, screenBPP, screenX, screenY) = display.getScreenResolution(screenNum)
+                (screenW, screenH, screenBPP, screenX, screenY, _) = display.getScreenResolution(screenNum)
                 print "    Display (%d):     %dx%d, %d BPP at %d,%d"  %(screenNum, screenW, screenH, screenBPP, screenX, screenY)
 
                 # We're done -- don't forget to unlock the machine!
diff --git a/src/VBox/Main/webservice/vboxweb.cpp b/src/VBox/Main/webservice/vboxweb.cpp
index 647af79..4b9572f 100644
--- a/src/VBox/Main/webservice/vboxweb.cpp
+++ b/src/VBox/Main/webservice/vboxweb.cpp
@@ -5,7 +5,7 @@
  *      (plus static gSOAP server code) to implement the actual webservice
  *      server, to which clients can connect.
  *
- * Copyright (C) 2007-2014 Oracle Corporation
+ * Copyright (C) 2007-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -85,19 +85,17 @@ static void WebLogSoapError(struct soap *soap);
  *
  ****************************************************************************/
 
-typedef std::map<uint64_t, ManagedObjectRef*>
-            ManagedObjectsMapById;
-typedef std::map<uint64_t, ManagedObjectRef*>::iterator
-            ManagedObjectsIteratorById;
-typedef std::map<uintptr_t, ManagedObjectRef*>
-            ManagedObjectsMapByPtr;
+typedef std::map<uint64_t, ManagedObjectRef*>   ManagedObjectsMapById;
+typedef ManagedObjectsMapById::iterator         ManagedObjectsIteratorById;
+typedef std::map<uintptr_t, ManagedObjectRef*>  ManagedObjectsMapByPtr;
+typedef ManagedObjectsMapByPtr::iterator        ManagedObjectsIteratorByPtr;
 
-typedef std::map<uint64_t, WebServiceSession*>
-            SessionsMap;
-typedef std::map<uint64_t, WebServiceSession*>::iterator
-            SessionsMapIterator;
+typedef std::map<uint64_t, WebServiceSession*>  WebsessionsMap;
+typedef WebsessionsMap::iterator                WebsessionsMapIterator;
 
-int fntWatchdog(RTTHREAD ThreadSelf, void *pvUser);
+typedef std::map<RTTHREAD, com::Utf8Str> ThreadsMap;
+
+static int fntWatchdog(RTTHREAD ThreadSelf, void *pvUser);
 
 /****************************************************************************
  *
@@ -109,40 +107,41 @@ static ComPtr<IVirtualBoxClient> g_pVirtualBoxClient = NULL;
 
 // generated strings in methodmaps.cpp
 extern const char       *g_pcszISession,
-                        *g_pcszIVirtualBox;
+                        *g_pcszIVirtualBox,
+                        *g_pcszIVirtualBoxErrorInfo;
 
 // globals for vboxweb command-line arguments
 #define DEFAULT_TIMEOUT_SECS 300
 #define DEFAULT_TIMEOUT_SECS_STRING "300"
-int                     g_iWatchdogTimeoutSecs = DEFAULT_TIMEOUT_SECS;
-int                     g_iWatchdogCheckInterval = 5;
+static int              g_iWatchdogTimeoutSecs = DEFAULT_TIMEOUT_SECS;
+static int              g_iWatchdogCheckInterval = 5;
 
-const char              *g_pcszBindToHost = NULL;       // host; NULL = localhost
-unsigned int            g_uBindToPort = 18083;          // port
-unsigned int            g_uBacklog = 100;               // backlog = max queue size for requests
+static const char       *g_pcszBindToHost = NULL;       // host; NULL = localhost
+static unsigned int     g_uBindToPort = 18083;          // port
+static unsigned int     g_uBacklog = 100;               // backlog = max queue size for requests
 
 #ifdef WITH_OPENSSL
-bool                    g_fSSL = false;                 // if SSL is enabled
-const char              *g_pcszKeyFile = NULL;          // server key file
-const char              *g_pcszPassword = NULL;         // password for server key
-const char              *g_pcszCACert = NULL;           // file with trusted CA certificates
-const char              *g_pcszCAPath = NULL;           // directory with trusted CA certificates
-const char              *g_pcszDHFile = NULL;           // DH file name or DH key length in bits, NULL=use RSA
-const char              *g_pcszRandFile = NULL;         // file with random data seed
-const char              *g_pcszSID = "vboxwebsrv";      // server ID for SSL session cache
+static bool             g_fSSL = false;                 // if SSL is enabled
+static const char       *g_pcszKeyFile = NULL;          // server key file
+static const char       *g_pcszPassword = NULL;         // password for server key
+static const char       *g_pcszCACert = NULL;           // file with trusted CA certificates
+static const char       *g_pcszCAPath = NULL;           // directory with trusted CA certificates
+static const char       *g_pcszDHFile = NULL;           // DH file name or DH key length in bits, NULL=use RSA
+static const char       *g_pcszRandFile = NULL;         // file with random data seed
+static const char       *g_pcszSID = "vboxwebsrv";      // server ID for SSL session cache
 #endif /* WITH_OPENSSL */
 
-unsigned int            g_cMaxWorkerThreads = 100;      // max. no. of worker threads
-unsigned int            g_cMaxKeepAlive = 100;          // maximum number of soap requests in one connection
+static unsigned int     g_cMaxWorkerThreads = 100;      // max. no. of worker threads
+static unsigned int     g_cMaxKeepAlive = 100;          // maximum number of soap requests in one connection
 
-const char              *g_pcszAuthentication = NULL;   // web service authentication
+static const char       *g_pcszAuthentication = NULL;   // web service authentication
 
-uint32_t                g_cHistory = 10;                // enable log rotation, 10 files
-uint32_t                g_uHistoryFileTime = RT_SEC_1DAY; // max 1 day per file
-uint64_t                g_uHistoryFileSize = 100 * _1M; // max 100MB per file
+static uint32_t         g_cHistory = 10;                // enable log rotation, 10 files
+static uint32_t         g_uHistoryFileTime = RT_SEC_1DAY; // max 1 day per file
+static uint64_t         g_uHistoryFileSize = 100 * _1M; // max 100MB per file
 bool                    g_fVerbose = false;             // be verbose
 
-bool                    g_fDaemonize = false;           // run in background.
+static bool             g_fDaemonize = false;           // run in background.
 
 const WSDLT_ID          g_EmptyWSDLID;                  // for NULL MORs
 
@@ -154,32 +153,27 @@ const WSDLT_ID          g_EmptyWSDLID;                  // for NULL MORs
 
 // The one global SOAP queue created by main().
 class SoapQ;
-SoapQ               *g_pSoapQ = NULL;
+static SoapQ                    *g_pSoapQ = NULL;
 
 // this mutex protects the auth lib and authentication
-util::WriteLockHandle  *g_pAuthLibLockHandle;
+static util::WriteLockHandle    *g_pAuthLibLockHandle;
 
 // this mutex protects the global VirtualBox reference below
-static util::RWLockHandle *g_pVirtualBoxLockHandle;
+static util::RWLockHandle       *g_pVirtualBoxLockHandle;
 
-static ComPtr<IVirtualBox> g_pVirtualBox = NULL;
+static ComPtr<IVirtualBox>      g_pVirtualBox = NULL;
 
 // this mutex protects all of the below
-util::WriteLockHandle  *g_pSessionsLockHandle;
+util::WriteLockHandle           *g_pWebsessionsLockHandle;
 
-SessionsMap         g_mapSessions;
-ULONG64             g_iMaxManagedObjectID = 0;
-ULONG64             g_cManagedObjects = 0;
+static WebsessionsMap           g_mapWebsessions;
+static ULONG64                  g_cManagedObjects = 0;
 
 // this mutex protects g_mapThreads
-util::RWLockHandle  *g_pThreadsLockHandle;
-
-// this mutex synchronizes logging
-util::WriteLockHandle *g_pWebLogLockHandle;
+static util::RWLockHandle       *g_pThreadsLockHandle;
 
 // Threads map, so we can quickly map an RTTHREAD struct to a logger prefix
-typedef std::map<RTTHREAD, com::Utf8Str> ThreadsMap;
-ThreadsMap          g_mapThreads;
+static ThreadsMap               g_mapThreads;
 
 /****************************************************************************
  *
@@ -217,7 +211,7 @@ static const RTGETOPTDEF g_aOptions[]
         { "--loginterval",      'I', RTGETOPT_REQ_UINT32 }
     };
 
-void DisplayHelp()
+static void DisplayHelp()
 {
     RTStrmPrintf(g_pStdErr, "\nUsage: vboxwebsrv [options]\n\nSupported options (default values in brackets):\n");
     for (unsigned i = 0;
@@ -639,18 +633,18 @@ public:
                         g_pVirtualBox = NULL;
                     }
                     {
-                        // we're messing with sessions, so lock them
-                        util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
-                        WEBDEBUG(("SVC unavailable: deleting %d sessions\n", g_mapSessions.size()));
+                        // we're messing with websessions, so lock them
+                        util::AutoWriteLock lock(g_pWebsessionsLockHandle COMMA_LOCKVAL_SRC_POS);
+                        WEBDEBUG(("SVC unavailable: deleting %d websessions\n", g_mapWebsessions.size()));
 
-                        SessionsMap::iterator it = g_mapSessions.begin(),
-                                              itEnd = g_mapSessions.end();
+                        WebsessionsMapIterator it = g_mapWebsessions.begin(),
+                                               itEnd = g_mapWebsessions.end();
                         while (it != itEnd)
                         {
-                            WebServiceSession *pSession = it->second;
-                            WEBDEBUG(("SVC unavailable: Session %llX stale, deleting\n", pSession->getID()));
-                            delete pSession;
-                            it = g_mapSessions.begin();
+                            WebServiceSession *pWebsession = it->second;
+                            WEBDEBUG(("SVC unavailable: websession %#llx stale, deleting\n", pWebsession->getID()));
+                            delete pWebsession;
+                            it = g_mapWebsessions.begin();
                         }
                     }
                 }
@@ -828,7 +822,7 @@ static void CRYPTO_thread_cleanup()
  *
  ****************************************************************************/
 
-void doQueuesLoop()
+static void doQueuesLoop()
 {
 #ifdef WITH_OPENSSL
     if (g_fSSL && CRYPTO_thread_setup())
@@ -908,7 +902,7 @@ void doQueuesLoop()
  * the loop that takes SOAP calls from HTTP and serves them by handing sockets to the
  * SOAP queue worker threads.
  */
-int fntQPumper(RTTHREAD ThreadSelf, void *pvUser)
+static int fntQPumper(RTTHREAD ThreadSelf, void *pvUser)
 {
     // store a log prefix for this thread
     util::AutoWriteLock thrLock(g_pThreadsLockHandle COMMA_LOCKVAL_SRC_POS);
@@ -1201,9 +1195,8 @@ int main(int argc, char *argv[])
     // create the global mutexes
     g_pAuthLibLockHandle = new util::WriteLockHandle(util::LOCKCLASS_WEBSERVICE);
     g_pVirtualBoxLockHandle = new util::RWLockHandle(util::LOCKCLASS_WEBSERVICE);
-    g_pSessionsLockHandle = new util::WriteLockHandle(util::LOCKCLASS_WEBSERVICE);
+    g_pWebsessionsLockHandle = new util::WriteLockHandle(util::LOCKCLASS_WEBSERVICE);
     g_pThreadsLockHandle = new util::RWLockHandle(util::LOCKCLASS_OBJECTSTATE);
-    g_pWebLogLockHandle = new util::WriteLockHandle(util::LOCKCLASS_WEBSERVICE);
 
     // SOAP queue pumper thread
     rc = RTThreadCreate(NULL,
@@ -1265,10 +1258,11 @@ int main(int argc, char *argv[])
 /**
  * Watchdog thread, runs in the background while the webservice is alive.
  *
- * This gets started by main() and runs in the background to check all sessions
+ * This gets started by main() and runs in the background to check all websessions
  * for whether they have been no requests in a configurable timeout period. In
- * that case, the session is automatically logged off.
+ * that case, the websession is automatically logged off.
  */
+/* static */
 int fntWatchdog(RTTHREAD ThreadSelf, void *pvUser)
 {
     // store a log prefix for this thread
@@ -1286,23 +1280,21 @@ int fntWatchdog(RTTHREAD ThreadSelf, void *pvUser)
         time_t                      tNow;
         time(&tNow);
 
-        // we're messing with sessions, so lock them
-        util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
-        WEBDEBUG(("Watchdog: checking %d sessions\n", g_mapSessions.size()));
+        // we're messing with websessions, so lock them
+        util::AutoWriteLock lock(g_pWebsessionsLockHandle COMMA_LOCKVAL_SRC_POS);
+        WEBDEBUG(("Watchdog: checking %d websessions\n", g_mapWebsessions.size()));
 
-        SessionsMap::iterator it = g_mapSessions.begin(),
-                              itEnd = g_mapSessions.end();
+        WebsessionsMapIterator it = g_mapWebsessions.begin(),
+                               itEnd = g_mapWebsessions.end();
         while (it != itEnd)
         {
-            WebServiceSession *pSession = it->second;
-            WEBDEBUG(("Watchdog: tNow: %d, session timestamp: %d\n", tNow, pSession->getLastObjectLookup()));
-            if (   tNow
-                 > pSession->getLastObjectLookup() + g_iWatchdogTimeoutSecs
-               )
+            WebServiceSession *pWebsession = it->second;
+            WEBDEBUG(("Watchdog: tNow: %d, websession timestamp: %d\n", tNow, pWebsession->getLastObjectLookup()));
+            if (tNow > pWebsession->getLastObjectLookup() + g_iWatchdogTimeoutSecs)
             {
-                WEBDEBUG(("Watchdog: Session %llX timed out, deleting\n", pSession->getID()));
-                delete pSession;
-                it = g_mapSessions.begin();
+                WEBDEBUG(("Watchdog: websession %#llx timed out, deleting\n", pWebsession->getID()));
+                delete pWebsession;
+                it = g_mapWebsessions.begin();
             }
             else
                 ++it;
@@ -1337,10 +1329,10 @@ int fntWatchdog(RTTHREAD ThreadSelf, void *pvUser)
  * @param extype
  * @param ex
  */
-void RaiseSoapFault(struct soap *soap,
-                    const char *pcsz,
-                    int extype,
-                    void *ex)
+static void RaiseSoapFault(struct soap *soap,
+                           const char *pcsz,
+                           int extype,
+                           void *ex)
 {
     // raise the fault
     soap_sender_fault(soap, pcsz, NULL);
@@ -1514,7 +1506,7 @@ void RaiseSoapRuntimeFault(struct soap *soap,
     ComPtr<IVirtualBoxErrorInfo> pVirtualBoxErrorInfo;
     info.getVirtualBoxErrorInfo(pVirtualBoxErrorInfo);
     ex->resultCode = apirc;
-    ex->returnval = createOrFindRefFromComPtr(idThis, "IVirtualBoxErrorInfo", pVirtualBoxErrorInfo);
+    ex->returnval = createOrFindRefFromComPtr(idThis, g_pcszIVirtualBoxErrorInfo, pVirtualBoxErrorInfo);
 
     RaiseSoapFault(soap,
                    str.c_str(),
@@ -1528,26 +1520,18 @@ void RaiseSoapRuntimeFault(struct soap *soap,
  *
  ****************************************************************************/
 
-uint64_t str2ulonglong(const char *pcsz)
-{
-    uint64_t u = 0;
-    RTStrToUInt64Full(pcsz, 16, &u);
-    return u;
-}
-
 /**
- * Splits a managed object reference (in string form, as
- * passed in from a SOAP method call) into two integers for
- * session and object IDs, respectively.
+ * Splits a managed object reference (in string form, as passed in from a SOAP
+ * method call) into two integers for websession and object IDs, respectively.
  *
  * @param id
- * @param sessid
- * @param objid
+ * @param pWebsessId
+ * @param pObjId
  * @return
  */
-bool SplitManagedObjectRef(const WSDLT_ID &id,
-                           uint64_t *pSessid,
-                           uint64_t *pObjid)
+static bool SplitManagedObjectRef(const WSDLT_ID &id,
+                                  uint64_t *pWebsessId,
+                                  uint64_t *pObjId)
 {
     // 64-bit numbers in hex have 16 digits; hence
     // the object-ref string must have 16 + "-" + 16 characters
@@ -1559,10 +1543,10 @@ bool SplitManagedObjectRef(const WSDLT_ID &id,
         char psz[34];
         memcpy(psz, id.c_str(), 34);
         psz[16] = '\0';
-        if (pSessid)
-            *pSessid = str2ulonglong(psz);
-        if (pObjid)
-            *pObjid = str2ulonglong(psz + 17);
+        if (pWebsessId)
+            RTStrToUInt64Full(psz, 16, pWebsessId);
+        if (pObjId)
+            RTStrToUInt64Full(psz + 17, 16, pObjId);
         return true;
     }
 
@@ -1571,20 +1555,20 @@ bool SplitManagedObjectRef(const WSDLT_ID &id,
 
 /**
  * Creates a managed object reference (in string form) from
- * two integers representing a session and object ID, respectively.
+ * two integers representing a websession and object ID, respectively.
  *
  * @param sz Buffer with at least 34 bytes space to receive MOR string.
- * @param sessid
- * @param objid
+ * @param websessId
+ * @param objId
  * @return
  */
-void MakeManagedObjectRef(char *sz,
-                          uint64_t &sessid,
-                          uint64_t &objid)
+static void MakeManagedObjectRef(char *sz,
+                                 uint64_t websessId,
+                                 uint64_t objId)
 {
-    RTStrFormatNumber(sz, sessid, 16, 16, 0, RTSTR_F_64BIT | RTSTR_F_ZEROPAD);
+    RTStrFormatNumber(sz, websessId, 16, 16, 0, RTSTR_F_64BIT | RTSTR_F_ZEROPAD);
     sz[16] = '-';
-    RTStrFormatNumber(sz + 17, objid, 16, 16, 0, RTSTR_F_64BIT | RTSTR_F_ZEROPAD);
+    RTStrFormatNumber(sz + 17, objId, 16, 16, 0, RTSTR_F_64BIT | RTSTR_F_ZEROPAD);
 }
 
 /****************************************************************************
@@ -1601,51 +1585,45 @@ class WebServiceSessionPrivate
 };
 
 /**
- * Constructor for the session object.
+ * Constructor for the websession object.
  *
- * Preconditions: Caller must have locked g_pSessionsLockHandle.
+ * Preconditions: Caller must have locked g_pWebsessionsLockHandle.
  *
  * @param username
  * @param password
  */
 WebServiceSession::WebServiceSession()
-    : _fDestructing(false),
-      _pISession(NULL),
+    : _uNextObjectID(1),        // avoid 0 for no real reason
+      _fDestructing(false),
       _tLastObjectLookup(0)
 {
     _pp = new WebServiceSessionPrivate;
-    _uSessionID = RTRandU64();
+    _uWebsessionID = RTRandU64();
 
-    // register this session globally
-    Assert(g_pSessionsLockHandle->isWriteLockOnCurrentThread());
-    g_mapSessions[_uSessionID] = this;
+    // register this websession globally
+    Assert(g_pWebsessionsLockHandle->isWriteLockOnCurrentThread());
+    g_mapWebsessions[_uWebsessionID] = this;
 }
 
 /**
  * Destructor. Cleans up and destroys all contained managed object references on the way.
  *
- * Preconditions: Caller must have locked g_pSessionsLockHandle.
+ * Preconditions: Caller must have locked g_pWebsessionsLockHandle.
  */
 WebServiceSession::~WebServiceSession()
 {
     // delete us from global map first so we can't be found
     // any more while we're cleaning up
-    Assert(g_pSessionsLockHandle->isWriteLockOnCurrentThread());
-    g_mapSessions.erase(_uSessionID);
+    Assert(g_pWebsessionsLockHandle->isWriteLockOnCurrentThread());
+    g_mapWebsessions.erase(_uWebsessionID);
 
     // notify ManagedObjectRef destructor so it won't
     // remove itself from the maps; this avoids rebalancing
     // the map's tree on every delete as well
     _fDestructing = true;
 
-    // if (_pISession)
-    // {
-    //     delete _pISession;
-    //     _pISession = NULL;
-    // }
-
-    ManagedObjectsMapById::iterator it,
-                                    end = _pp->_mapManagedObjectsById.end();
+    ManagedObjectsIteratorById it,
+                               end = _pp->_mapManagedObjectsById.end();
     for (it = _pp->_mapManagedObjectsById.begin();
          it != end;
          ++it)
@@ -1770,40 +1748,11 @@ int WebServiceSession::authenticate(const char *pcszUsername,
 
     lock.release();
 
-    if (!rc)
-    {
-        do
-        {
-            // now create the ISession object that this webservice session can use
-            // (and of which IWebsessionManager::getSessionObject returns a managed object reference)
-            ComPtr<ISession> session;
-            rc = g_pVirtualBoxClient->COMGETTER(Session)(session.asOutParam());
-            if (FAILED(rc))
-            {
-                WEBDEBUG(("ERROR: cannot create session object!"));
-                break;
-            }
-
-            ComPtr<IUnknown> p2 = session;
-            _pISession = new ManagedObjectRef(*this,
-                                              p2,                               // IUnknown *pobjUnknown
-                                              session,                          // void *pobjInterface
-                                              com::Guid(COM_IIDOF(ISession)),
-                                              g_pcszISession);
-
-            if (g_fVerbose)
-            {
-                ISession *p = session;
-                WEBDEBUG(("   * %s: created session object with comptr %#p, MOR = %s\n", __FUNCTION__, p, _pISession->getWSDLID().c_str()));
-            }
-        } while (0);
-    }
-
     return rc;
 }
 
 /**
- *  Look up, in this session, whether a ManagedObjectRef has already been
+ *  Look up, in this websession, whether a ManagedObjectRef has already been
  *  created for the given COM pointer.
  *
  *  Note how we require that a ComPtr<IUnknown> is passed, which causes a
@@ -1812,18 +1761,18 @@ int WebServiceSession::authenticate(const char *pcszUsername,
  *  ComPtr<IVirtualBox>, for example. As we store the ComPtr<IUnknown> in
  *  our private hash table, we must search for one too.
  *
- * Preconditions: Caller must have locked g_pSessionsLockHandle.
+ * Preconditions: Caller must have locked g_pWebsessionsLockHandle.
  *
  * @param pcu pointer to a COM object.
  * @return The existing ManagedObjectRef that represents the COM object, or NULL if there's none yet.
  */
 ManagedObjectRef* WebServiceSession::findRefFromPtr(const IUnknown *pObject)
 {
-    Assert(g_pSessionsLockHandle->isWriteLockOnCurrentThread());
+    Assert(g_pWebsessionsLockHandle->isWriteLockOnCurrentThread());
 
     uintptr_t ulp = (uintptr_t)pObject;
     // WEBDEBUG(("   %s: looking up %#lx\n", __FUNCTION__, ulp));
-    ManagedObjectsMapByPtr::iterator it = _pp->_mapManagedObjectsByPtr.find(ulp);
+    ManagedObjectsIteratorByPtr it = _pp->_mapManagedObjectsByPtr.find(ulp);
     if (it != _pp->_mapManagedObjectsByPtr.end())
     {
         ManagedObjectRef *pRef = it->second;
@@ -1835,47 +1784,38 @@ ManagedObjectRef* WebServiceSession::findRefFromPtr(const IUnknown *pObject)
 }
 
 /**
- * Static method which attempts to find the session for which the given managed
- * object reference was created, by splitting the reference into the session and
- * object IDs and then looking up the session object for that session ID.
+ * Static method which attempts to find the websession for which the given
+ * managed object reference was created, by splitting the reference into the
+ * websession and object IDs and then looking up the websession object.
  *
- * Preconditions: Caller must have locked g_pSessionsLockHandle in read mode.
+ * Preconditions: Caller must have locked g_pWebsessionsLockHandle in read mode.
  *
- * @param id Managed object reference (with combined session and object IDs).
+ * @param id Managed object reference (with combined websession and object IDs).
  * @return
  */
-WebServiceSession* WebServiceSession::findSessionFromRef(const WSDLT_ID &id)
+WebServiceSession *WebServiceSession::findWebsessionFromRef(const WSDLT_ID &id)
 {
-    Assert(g_pSessionsLockHandle->isWriteLockOnCurrentThread());
+    Assert(g_pWebsessionsLockHandle->isWriteLockOnCurrentThread());
 
-    WebServiceSession *pSession = NULL;
-    uint64_t sessid;
+    WebServiceSession *pWebsession = NULL;
+    uint64_t websessId;
     if (SplitManagedObjectRef(id,
-                              &sessid,
+                              &websessId,
                               NULL))
     {
-        SessionsMapIterator it = g_mapSessions.find(sessid);
-        if (it != g_mapSessions.end())
-            pSession = it->second;
+        WebsessionsMapIterator it = g_mapWebsessions.find(websessId);
+        if (it != g_mapWebsessions.end())
+            pWebsession = it->second;
     }
-    return pSession;
+    return pWebsession;
 }
 
 /**
+ * Touches the websession to prevent it from timing out.
  *
- */
-const WSDLT_ID& WebServiceSession::getSessionWSDLID() const
-{
-    return _pISession->getWSDLID();
-}
-
-/**
- * Touches the webservice session to prevent it from timing out.
- *
- * Each webservice session has an internal timestamp that records
- * the last request made to it from the client that started it.
- * If no request was made within a configurable timeframe, then
- * the client is logged off automatically,
+ * Each websession has an internal timestamp that records the last request made
+ * to it from the client that started it. If no request was made within a
+ * configurable timeframe, then the client is logged off automatically,
  * by calling IWebsessionManager::logoff()
  */
 void WebServiceSession::touch()
@@ -1892,9 +1832,10 @@ void WebServiceSession::touch()
 
 /**
  *  Constructor, which assigns a unique ID to this managed object
- *  reference and stores it two global hashes:
+ *  reference and stores it in two hashes (living in the associated
+ *  WebServiceSession object):
  *
- *   a) G_mapManagedObjectsById, which maps ManagedObjectID's to
+ *   a) _mapManagedObjectsById, which maps ManagedObjectID's to
  *      instances of this class; this hash is then used by the
  *      findObjectFromRef() template function in vboxweb.h
  *      to quickly retrieve the COM object from its managed
@@ -1902,7 +1843,7 @@ void WebServiceSession::touch()
  *      in methodmaps.cpp, when a web service client passes in
  *      a managed object ID);
  *
- *   b) G_mapManagedObjectsByComPtr, which maps COM pointers to
+ *   b) _mapManagedObjectsByPtr, which maps COM pointers to
  *      instances of this class; this hash is used by
  *      createRefFromObject() to quickly figure out whether an
  *      instance already exists for a given COM pointer.
@@ -1921,20 +1862,20 @@ void WebServiceSession::touch()
  *  createOrFindRefFromComPtr() template function in vboxweb.h, which
  *  does perform that check.
  *
- * Preconditions: Caller must have locked g_pSessionsLockHandle.
+ * Preconditions: Caller must have locked g_pWebsessionsLockHandle.
  *
- * @param session Session to which the MOR will be added.
+ * @param websession Websession to which the MOR will be added.
  * @param pobjUnknown Pointer to IUnknown* interface for the COM object; this will be used in the hashes.
  * @param pobjInterface Pointer to a specific interface for the COM object, described by guidInterface.
  * @param guidInterface Interface which pobjInterface points to.
  * @param pcszInterface String representation of that interface (e.g. "IMachine") for readability and logging.
  */
-ManagedObjectRef::ManagedObjectRef(WebServiceSession &session,
+ManagedObjectRef::ManagedObjectRef(WebServiceSession &websession,
                                    IUnknown *pobjUnknown,
                                    void *pobjInterface,
                                    const com::Guid &guidInterface,
                                    const char *pcszInterface)
-    : _session(session),
+    : _websession(websession),
       _pobjUnknown(pobjUnknown),
       _pobjInterface(pobjInterface),
       _guidInterface(guidInterface),
@@ -1948,21 +1889,21 @@ ManagedObjectRef::ManagedObjectRef(WebServiceSession &session,
     uint32_t cRefs2 = ((IUnknown*)pobjInterface)->AddRef();
     _ulp = (uintptr_t)pobjUnknown;
 
-    Assert(g_pSessionsLockHandle->isWriteLockOnCurrentThread());
-    _id = ++g_iMaxManagedObjectID;
+    Assert(g_pWebsessionsLockHandle->isWriteLockOnCurrentThread());
+    _id = websession.createObjectID();
     // and count globally
     ULONG64 cTotal = ++g_cManagedObjects;           // raise global count and make a copy for the debug message below
 
     char sz[34];
-    MakeManagedObjectRef(sz, session._uSessionID, _id);
+    MakeManagedObjectRef(sz, websession._uWebsessionID, _id);
     _strID = sz;
 
-    session._pp->_mapManagedObjectsById[_id] = this;
-    session._pp->_mapManagedObjectsByPtr[_ulp] = this;
+    websession._pp->_mapManagedObjectsById[_id] = this;
+    websession._pp->_mapManagedObjectsByPtr[_ulp] = this;
 
-    session.touch();
+    websession.touch();
 
-    WEBDEBUG(("   * %s: MOR created for %s*=%#p (IUnknown*=%#p; COM refcount now %RI32/%RI32), new ID is %llX; now %lld objects total\n",
+    WEBDEBUG(("   * %s: MOR created for %s*=%#p (IUnknown*=%#p; COM refcount now %RI32/%RI32), new ID is %#llx; now %lld objects total\n",
               __FUNCTION__,
               pcszInterface,
               pobjInterface,
@@ -1977,11 +1918,11 @@ ManagedObjectRef::ManagedObjectRef(WebServiceSession &session,
  * Destructor; removes the instance from the global hash of
  * managed objects. Calls Release() on the contained COM object.
  *
- * Preconditions: Caller must have locked g_pSessionsLockHandle.
+ * Preconditions: Caller must have locked g_pWebsessionsLockHandle.
  */
 ManagedObjectRef::~ManagedObjectRef()
 {
-    Assert(g_pSessionsLockHandle->isWriteLockOnCurrentThread());
+    Assert(g_pWebsessionsLockHandle->isWriteLockOnCurrentThread());
     ULONG64 cTotal = --g_cManagedObjects;
 
     Assert(_pobjUnknown);
@@ -1991,17 +1932,17 @@ ManagedObjectRef::~ManagedObjectRef()
     // both as well, but in reverse order
     uint32_t cRefs2 = ((IUnknown*)_pobjInterface)->Release();
     uint32_t cRefs1 = _pobjUnknown->Release();
-    WEBDEBUG(("   * %s: deleting MOR for ID %llX (%s; COM refcount now %RI32/%RI32); now %lld objects total\n", __FUNCTION__, _id, _pcszInterface, cRefs1, cRefs2, cTotal));
+    WEBDEBUG(("   * %s: deleting MOR for ID %#llx (%s; COM refcount now %RI32/%RI32); now %lld objects total\n", __FUNCTION__, _id, _pcszInterface, cRefs1, cRefs2, cTotal));
 
-    // if we're being destroyed from the session's destructor,
+    // if we're being destroyed from the websession's destructor,
     // then that destructor is iterating over the maps, so
     // don't remove us there! (data integrity + speed)
-    if (!_session._fDestructing)
+    if (!_websession._fDestructing)
     {
-        WEBDEBUG(("   * %s: removing from session maps\n", __FUNCTION__));
-        _session._pp->_mapManagedObjectsById.erase(_id);
-        if (_session._pp->_mapManagedObjectsByPtr.erase(_ulp) != 1)
-            WEBDEBUG(("   WARNING: could not find %llX in _mapManagedObjectsByPtr\n", _ulp));
+        WEBDEBUG(("   * %s: removing from websession maps\n", __FUNCTION__));
+        _websession._pp->_mapManagedObjectsById.erase(_id);
+        if (_websession._pp->_mapManagedObjectsByPtr.erase(_ulp) != 1)
+            WEBDEBUG(("   WARNING: could not find %#llx in _mapManagedObjectsByPtr\n", _ulp));
     }
 }
 
@@ -2012,11 +1953,11 @@ ManagedObjectRef::~ManagedObjectRef()
  * This has been extracted into this non-template function to reduce
  * code bloat as we have the actual STL map lookup only in this function.
  *
- * This also "touches" the timestamp in the session whose ID is encoded
- * in the given integer ID, in order to prevent the session from timing
+ * This also "touches" the timestamp in the websession whose ID is encoded
+ * in the given integer ID, in order to prevent the websession from timing
  * out.
  *
- * Preconditions: Caller must have locked g_mutexSessions.
+ * Preconditions: Caller must have locked g_pWebsessionsLockHandle.
  *
  * @param strId
  * @param iter
@@ -2037,31 +1978,31 @@ int ManagedObjectRef::findRefFromId(const WSDLT_ID &id,
             return 0;
         }
 
-        uint64_t sessid;
-        uint64_t objid;
+        uint64_t websessId;
+        uint64_t objId;
         WEBDEBUG(("   %s(): looking up objref %s\n", __FUNCTION__, id.c_str()));
         if (!SplitManagedObjectRef(id,
-                                   &sessid,
-                                   &objid))
+                                   &websessId,
+                                   &objId))
         {
             rc = VERR_WEB_INVALID_MANAGED_OBJECT_REFERENCE;
             break;
         }
 
-        SessionsMapIterator it = g_mapSessions.find(sessid);
-        if (it == g_mapSessions.end())
+        WebsessionsMapIterator it = g_mapWebsessions.find(websessId);
+        if (it == g_mapWebsessions.end())
         {
-            WEBDEBUG(("   %s: cannot find session for objref %s\n", __FUNCTION__, id.c_str()));
+            WEBDEBUG(("   %s: cannot find websession for objref %s\n", __FUNCTION__, id.c_str()));
             rc = VERR_WEB_INVALID_SESSION_ID;
             break;
         }
 
-        WebServiceSession *pSess = it->second;
-        // "touch" session to prevent it from timing out
-        pSess->touch();
+        WebServiceSession *pWebsession = it->second;
+        // "touch" websession to prevent it from timing out
+        pWebsession->touch();
 
-        ManagedObjectsIteratorById iter = pSess->_pp->_mapManagedObjectsById.find(objid);
-        if (iter == pSess->_pp->_mapManagedObjectsById.end())
+        ManagedObjectsIteratorById iter = pWebsession->_pp->_mapManagedObjectsById.find(objId);
+        if (iter == pWebsession->_pp->_mapManagedObjectsById.end())
         {
             WEBDEBUG(("   %s: cannot find comobj for objref %s\n", __FUNCTION__, id.c_str()));
             rc = VERR_WEB_INVALID_OBJECT_ID;
@@ -2103,7 +2044,7 @@ int __vbox__IManagedObjectRef_USCOREgetInterfaceName(
     do
     {
         // findRefFromId require the lock
-        util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
+        util::AutoWriteLock lock(g_pWebsessionsLockHandle COMMA_LOCKVAL_SRC_POS);
 
         ManagedObjectRef *pRef;
         if (!ManagedObjectRef::findRefFromId(req->_USCOREthis, &pRef, false))
@@ -2138,7 +2079,7 @@ int __vbox__IManagedObjectRef_USCORErelease(
     do
     {
         // findRefFromId and the delete call below require the lock
-        util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
+        util::AutoWriteLock lock(g_pWebsessionsLockHandle COMMA_LOCKVAL_SRC_POS);
 
         ManagedObjectRef *pRef;
         if ((rc = ManagedObjectRef::findRefFromId(req->_USCOREthis, &pRef, false)))
@@ -2173,15 +2114,9 @@ int __vbox__IManagedObjectRef_USCORErelease(
  * webservice will do anything useful.
  *
  * This returns a managed object reference to the global IVirtualBox object; into this
- * reference a session ID is encoded which remains constant with all managed object
+ * reference a websession ID is encoded which remains constant with all managed object
  * references returned by other methods.
  *
- * This also creates an instance of ISession, which is stored internally with the
- * webservice session and can be retrieved with IWebsessionManager::getSessionObject
- * (__vbox__IWebsessionManager_USCOREgetSessionObject). In order for the
- * VirtualBox web service to do anything useful, one usually needs both a
- * VirtualBox and an ISession object, for which these two methods are designed.
- *
  * When the webservice client is done, it should call IWebsessionManager::logoff. This
  * will clean up internally (destroy all remaining managed object references and
  * related COM objects used internally).
@@ -2209,34 +2144,28 @@ int __vbox__IWebsessionManager_USCORElogon(
     do
     {
         // WebServiceSession constructor tinkers with global MOR map and requires a write lock
-        util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
+        util::AutoWriteLock lock(g_pWebsessionsLockHandle COMMA_LOCKVAL_SRC_POS);
 
-        // create new session; the constructor stores the new session
+        // create new websession; the constructor stores the new websession
         // in the global map automatically
-        WebServiceSession *pSession = new WebServiceSession();
+        WebServiceSession *pWebsession = new WebServiceSession();
         ComPtr<IVirtualBox> pVirtualBox;
 
         // authenticate the user
-        if (!(pSession->authenticate(req->username.c_str(),
-                                     req->password.c_str(),
-                                     pVirtualBox.asOutParam())))
+        if (!(pWebsession->authenticate(req->username.c_str(),
+                                        req->password.c_str(),
+                                        pVirtualBox.asOutParam())))
         {
-            // in the new session, create a managed object reference (MOR) for the
-            // global VirtualBox object; this encodes the session ID in the MOR so
+            // fake up a "root" MOR for this websession
+            char sz[34];
+            MakeManagedObjectRef(sz, pWebsession->getID(), 0ULL);
+            WSDLT_ID id = sz;
+
+            // in the new websession, create a managed object reference (MOR) for the
+            // global VirtualBox object; this encodes the websession ID in the MOR so
             // that it will be implicitly be included in all future requests of this
             // webservice client
-            ComPtr<IUnknown> p2 = pVirtualBox;
-            if (pVirtualBox.isNull() || p2.isNull())
-            {
-                rc = E_FAIL;
-                break;
-            }
-            ManagedObjectRef *pRef = new ManagedObjectRef(*pSession,
-                                                          p2,                       // IUnknown *pobjUnknown
-                                                          pVirtualBox,              // void *pobjInterface
-                                                          COM_IIDOF(IVirtualBox),
-                                                          g_pcszIVirtualBox);
-            resp->returnval = pRef->getWSDLID();
+            resp->returnval = createOrFindRefFromComPtr(id, g_pcszIVirtualBox, pVirtualBox);
             WEBDEBUG(("VirtualBox object ref is %s\n", resp->returnval.c_str()));
         }
         else
@@ -2250,8 +2179,10 @@ int __vbox__IWebsessionManager_USCORElogon(
 }
 
 /**
- * Returns the ISession object that was created for the webservice client
- * on logon.
+ * Returns a new ISession object every time.
+ *
+ * No longer connected in any way to logons, one websession can easily
+ * handle multiple sessions.
  */
 int __vbox__IWebsessionManager_USCOREgetSessionObject(
         struct soap*,
@@ -2263,13 +2194,18 @@ int __vbox__IWebsessionManager_USCOREgetSessionObject(
 
     do
     {
-        // findSessionFromRef needs lock
-        util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
-
-        WebServiceSession* pSession;
-        if ((pSession = WebServiceSession::findSessionFromRef(req->refIVirtualBox)))
-            resp->returnval = pSession->getSessionWSDLID();
+        // create a new ISession object
+        ComPtr<ISession> pSession;
+        rc = g_pVirtualBoxClient->COMGETTER(Session)(pSession.asOutParam());
+        if (FAILED(rc))
+        {
+            WEBDEBUG(("ERROR: cannot create session object!"));
+            break;
+        }
 
+        // return its MOR
+        resp->returnval = createOrFindRefFromComPtr(req->refIVirtualBox, g_pcszISession, pSession);
+        WEBDEBUG(("Session object ref is %s\n", resp->returnval.c_str()));
     } while (0);
 
     WEBDEBUG(("-- leaving %s, rc: %#lx\n", __FUNCTION__, rc));
@@ -2296,16 +2232,17 @@ int __vbox__IWebsessionManager_USCORElogoff(
 
     do
     {
-        // findSessionFromRef and the session destructor require the lock
-        util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
+        // findWebsessionFromRef and the websession destructor require the lock
+        util::AutoWriteLock lock(g_pWebsessionsLockHandle COMMA_LOCKVAL_SRC_POS);
 
-        WebServiceSession* pSession;
-        if ((pSession = WebServiceSession::findSessionFromRef(req->refIVirtualBox)))
+        WebServiceSession* pWebsession;
+        if ((pWebsession = WebServiceSession::findWebsessionFromRef(req->refIVirtualBox)))
         {
-            delete pSession;
+            WEBDEBUG(("websession logoff, deleting websession %#llx\n", pWebsession->getID()));
+            delete pWebsession;
                 // destructor cleans up
 
-            WEBDEBUG(("session destroyed, %d sessions left open\n", g_mapSessions.size()));
+            WEBDEBUG(("websession destroyed, %d websessions left open\n", g_mapWebsessions.size()));
         }
     } while (0);
 
diff --git a/src/VBox/Main/webservice/vboxweb.h b/src/VBox/Main/webservice/vboxweb.h
index 7cc2f55..34d19d2 100644
--- a/src/VBox/Main/webservice/vboxweb.h
+++ b/src/VBox/Main/webservice/vboxweb.h
@@ -2,7 +2,7 @@
  * vboxweb.h:
  *      header file for "real" web server code.
  *
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -13,16 +13,6 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-/****************************************************************************
- *
- * debug macro
- *
- ****************************************************************************/
-
-void WebLog(const char *pszFormat, ...);
-
-#define WEBDEBUG(a) do { if (g_fVerbose) { WebLog a; } } while (0)
-
 #ifdef DEBUG
 #define LOG_GROUP LOG_GROUP_WEBSERVICE
 #include <VBox/log.h>
@@ -34,18 +24,30 @@ void WebLog(const char *pszFormat, ...);
 
 #include <VBox/err.h>
 
-#include <iprt/stream.h>
+#include <iprt/asm.h>
 
 #include <string>
 
 /****************************************************************************
  *
+ * debug macro
+ *
+ ****************************************************************************/
+
+RT_C_DECLS_BEGIN
+extern void WebLog(const char *pszFormat, ...);
+RT_C_DECLS_END
+
+#define WEBDEBUG(a) do { if (g_fVerbose) { WebLog a; } } while (0)
+
+/****************************************************************************
+ *
  * typedefs
  *
  ****************************************************************************/
 
 // type used by gSOAP-generated code
-typedef std::string WSDLT_ID;               // combined managed object ref (session ID plus object ID)
+typedef std::string WSDLT_ID;               // combined managed object ref (websession ID plus object ID)
 typedef std::string vbox__uuid;
 
 /****************************************************************************
@@ -56,10 +58,7 @@ typedef std::string vbox__uuid;
 
 extern bool g_fVerbose;
 
-extern PRTSTREAM g_pstrLog;
-
-extern util::WriteLockHandle  *g_pAuthLibLockHandle;
-extern util::WriteLockHandle  *g_pSessionsLockHandle;
+extern util::WriteLockHandle  *g_pWebsessionsLockHandle;
 
 extern const WSDLT_ID          g_EmptyWSDLID;
 
@@ -69,9 +68,9 @@ extern const WSDLT_ID          g_EmptyWSDLID;
  *
  ****************************************************************************/
 
-void RaiseSoapInvalidObjectFault(struct soap *soap, WSDLT_ID obj);
+extern void RaiseSoapInvalidObjectFault(struct soap *soap, WSDLT_ID obj);
 
-void RaiseSoapRuntimeFault(struct soap *soap, const WSDLT_ID &idThis, const char *pcszMethodName, HRESULT apirc, IUnknown *pObj, const com::Guid &iid);
+extern void RaiseSoapRuntimeFault(struct soap *soap, const WSDLT_ID &idThis, const char *pcszMethodName, HRESULT apirc, IUnknown *pObj, const com::Guid &iid);
 
 /****************************************************************************
  *
@@ -79,13 +78,14 @@ void RaiseSoapRuntimeFault(struct soap *soap, const WSDLT_ID &idThis, const char
  *
  ****************************************************************************/
 
-std::string ConvertComString(const com::Bstr &bstr);
+extern std::string ConvertComString(const com::Bstr &bstr);
 
-std::string ConvertComString(const com::Guid &bstr);
+extern std::string ConvertComString(const com::Guid &bstr);
 
-std::string Base64EncodeByteArray(ComSafeArrayIn(BYTE, aData));
+extern std::string Base64EncodeByteArray(ComSafeArrayIn(BYTE, aData));
+
+extern void Base64DecodeByteArray(struct soap *soap, const std::string& aStr, ComSafeArrayOut(BYTE, aData), const WSDLT_ID &idThis, const char *pszMethodName, IUnknown *pObj, const com::Guid &iid);
 
-void Base64DecodeByteArray(struct soap *soap, const std::string& aStr, ComSafeArrayOut(BYTE, aData), const WSDLT_ID &idThis, const char *pszMethodName, IUnknown *pObj, const com::Guid &iid);
 /****************************************************************************
  *
  * managed object reference classes
@@ -98,19 +98,18 @@ class ManagedObjectRef;
 /**
  *  An instance of this gets created for every client that logs onto the
  *  webservice (via the special IWebsessionManager::logon() SOAP API) and
- *  maintains the managed object references for that session.
+ *  maintains the managed object references for that websession.
  */
 class WebServiceSession
 {
     friend class ManagedObjectRef;
 
     private:
-        uint64_t                    _uSessionID;
+        uint64_t                    _uWebsessionID;
+        uint64_t                    _uNextObjectID;
         WebServiceSessionPrivate    *_pp;               // opaque data struct (defined in vboxweb.cpp)
         bool                        _fDestructing;
 
-        ManagedObjectRef            *_pISession;
-
         time_t                      _tLastObjectLookup;
 
         // hide the copy constructor because we're not copyable
@@ -129,10 +128,14 @@ class WebServiceSession
 
         uint64_t getID() const
         {
-            return _uSessionID;
+            return _uWebsessionID;
         }
 
-        const WSDLT_ID& getSessionWSDLID() const;
+        uint64_t createObjectID()
+        {
+            uint64_t id = ASMAtomicIncU64(&_uNextObjectID);
+            return id - 1;
+        }
 
         void touch();
 
@@ -141,25 +144,25 @@ class WebServiceSession
             return _tLastObjectLookup;
         }
 
-        static WebServiceSession* findSessionFromRef(const WSDLT_ID &id);
+        static WebServiceSession* findWebsessionFromRef(const WSDLT_ID &id);
 
         void DumpRefs();
 };
 
 /**
  *  ManagedObjectRef is used to map COM pointers to object IDs
- *  within a session. Such object IDs are 64-bit integers.
+ *  within a websession. Such object IDs are 64-bit integers.
  *
  *  When a webservice method call is invoked on an object, it
  *  has an opaque string called a "managed object reference". Such
- *  a string consists of a session ID combined with an object ID.
+ *  a string consists of a websession ID combined with an object ID.
  *
  */
 class ManagedObjectRef
 {
     protected:
-        // owning session:
-        WebServiceSession           &_session;
+        // owning websession:
+        WebServiceSession           &_websession;
 
 
         IUnknown                    *_pobjUnknown;          // pointer to IUnknown interface for this MOR
@@ -178,7 +181,7 @@ class ManagedObjectRef
         WSDLT_ID                    _strID;
 
     public:
-        ManagedObjectRef(WebServiceSession &session,
+        ManagedObjectRef(WebServiceSession &websession,
                          IUnknown *pobjUnknown,
                          void *pobjInterface,
                          const com::Guid &guidInterface,
@@ -223,11 +226,6 @@ class ManagedObjectRef
         static int findRefFromId(const WSDLT_ID &id,
                                  ManagedObjectRef **pRef,
                                  bool fNullAllowed);
-
-        static ManagedObjectRef* findFromPtr(ComPtr<IUnknown> pcu);
-        static ManagedObjectRef* create(const WSDLT_ID &idParent,
-                                        ComPtr<IUnknown> pcu);
-
 };
 
 /**
@@ -262,7 +260,7 @@ int findComPtrFromId(struct soap *soap,
                      bool fNullAllowed)
 {
     // findRefFromId requires thelock
-    util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
+    util::AutoWriteLock lock(g_pWebsessionsLockHandle COMMA_LOCKVAL_SRC_POS);
 
     int rc;
     ManagedObjectRef *pRef;
@@ -313,21 +311,22 @@ int findComPtrFromId(struct soap *soap,
 }
 
 /**
- * Creates a new managed object for the given COM pointer. If a reference already exists
- * for the given pointer, then that reference's ID is returned instead.
+ * Creates a new managed object reference for the given COM pointer. If one
+ * already exists for the given pointer, then that reference's ID is returned.
  *
- * This gets called from tons of generated code in methodmaps.cpp to
- * resolve objects *returned* from COM methods (i.e. create MOR strings from COM objects
- * which might have been newly created).
+ * This gets called from tons of generated code in methodmaps.cpp to resolve
+ * objects *returned* from COM methods (i.e. create MOR strings from COM
+ * objects which might have been newly created).
  *
- * @param idParent managed object reference of calling object; used to extract session ID
+ * @param idParent managed object reference of calling object; used to extract
+ *              websession ID
  * @param pc COM object for which to create a reference
  * @return existing or new managed object reference
  */
 template <class T>
 const WSDLT_ID& createOrFindRefFromComPtr(const WSDLT_ID &idParent,
                                           const char *pcszInterface,
-                                          ComPtr<T> &pc)
+                                          const ComPtr<T> &pc)
 {
     // NULL comptr should return NULL MOR
     if (pc.isNull())
@@ -336,17 +335,17 @@ const WSDLT_ID& createOrFindRefFromComPtr(const WSDLT_ID &idParent,
         return g_EmptyWSDLID;
     }
 
-    util::AutoWriteLock lock(g_pSessionsLockHandle COMMA_LOCKVAL_SRC_POS);
-    WebServiceSession *pSession;
-    if ((pSession = WebServiceSession::findSessionFromRef(idParent)))
+    util::AutoWriteLock lock(g_pWebsessionsLockHandle COMMA_LOCKVAL_SRC_POS);
+    WebServiceSession *pWebsession;
+    if ((pWebsession = WebServiceSession::findWebsessionFromRef(idParent)))
     {
         ManagedObjectRef *pRef;
 
         // we need an IUnknown pointer for the MOR
         ComPtr<IUnknown> pobjUnknown = pc;
 
-        if (    ((pRef = pSession->findRefFromPtr(pobjUnknown)))
-             || ((pRef = new ManagedObjectRef(*pSession,
+        if (    ((pRef = pWebsession->findRefFromPtr(pobjUnknown)))
+             || ((pRef = new ManagedObjectRef(*pWebsession,
                                               pobjUnknown,          // IUnknown *pobjUnknown
                                               pc,                   // void *pobjInterface
                                               COM_IIDOF(T),
@@ -355,7 +354,7 @@ const WSDLT_ID& createOrFindRefFromComPtr(const WSDLT_ID &idParent,
             return pRef->getWSDLID();
     }
 
-    // session has expired, return an empty MOR instead of allocating a
+    // websession has expired, return an empty MOR instead of allocating a
     // new reference which couldn't be used anyway.
     return g_EmptyWSDLID;
 }
diff --git a/src/VBox/Main/webservice/websrv-cpp.xsl b/src/VBox/Main/webservice/websrv-cpp.xsl
index 32372e7..1884691 100644
--- a/src/VBox/Main/webservice/websrv-cpp.xsl
+++ b/src/VBox/Main/webservice/websrv-cpp.xsl
@@ -47,6 +47,13 @@
               select="//interface[@wsmap='suppress']" />
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
+  Keys for more efficiently looking up of types.
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
   root match
  - - - - - - - - - - - - - - - - - - - - - - -->
 
@@ -271,7 +278,7 @@ const char *g_pcszIUnknown = "IUnknown";
     <xsl:text>        }
</xsl:text>
     <xsl:call-template name="emitNewline" />
 
-    <xsl:for-each select="//interface[@name=$structname]/attribute">
+    <xsl:for-each select="key('G_keyInterfacesByName', $structname)/attribute">
       <xsl:if test="not(@wsmap = 'suppress')">
         <xsl:value-of select="concat('        // -- ', $structname, '.', @name)" />
         <xsl:call-template name="emitNewline" />
@@ -389,7 +396,7 @@ const char *g_pcszIUnknown = "IUnknown";
         <xsl:with-param name="safearray" select="$safearray"/>
       </xsl:call-template>
     </xsl:when>
-    <xsl:when test="//enum[@name=$type]">
+    <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
       <xsl:call-template name="emitTypeOrArray">
         <xsl:with-param name="type" select="concat($type, '_T ')"/>
         <xsl:with-param name="safearray" select="$safearray"/>
@@ -405,8 +412,8 @@ const char *g_pcszIUnknown = "IUnknown";
         </xsl:otherwise>
       </xsl:choose>
     </xsl:when>
-    <xsl:when test="//interface[@name=$type]">
-      <xsl:variable name="thatif" select="//interface[@name=$type]" />
+    <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
+      <xsl:variable name="thatif" select="key('G_keyInterfacesByName', $type)" />
       <xsl:variable name="thatifname" select="$thatif/@name" />
       <xsl:choose>
         <xsl:when test="$safearray='yes'">
@@ -578,7 +585,7 @@ const char *g_pcszIUnknown = "IUnknown";
           <xsl:call-template name="emitNewlineIndent8" />
           <xsl:value-of select="concat('    IUnknown *tmpObject2(tmpObject); tmpObject2->AddRef(); comcall_', $name, '[i] = tmpObject;')" />
         </xsl:when>
-        <xsl:when test="//interface[@name=$type]">
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
           <xsl:value-of select="concat('    ComPtr<', $type, '> tmpObject;')" />
           <xsl:call-template name="emitNewlineIndent8" />
           <xsl:value-of select="concat('    if ((rc = findComPtrFromId(soap, ', $structprefix, $name, '[i], tmpObject, true)))')" />
@@ -608,7 +615,7 @@ const char *g_pcszIUnknown = "IUnknown";
           <xsl:call-template name="emitNewlineIndent8" />
           <xsl:value-of select="concat('    comcall_', $name, '[i] = ', $structprefix, $name, '[i];')" />
         </xsl:when>
-        <xsl:when test="//enum[@name=$type]">
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
           <xsl:call-template name="emitNewlineIndent8" />
           <xsl:value-of select="concat('    comcall_', $name, '[i] = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, '[i]);')" />
         </xsl:when>
@@ -633,7 +640,7 @@ const char *g_pcszIUnknown = "IUnknown";
         <xsl:when test="$type='wstring' or $type='uuid'">
           <xsl:value-of select="concat(' comcall_', $name, '(', $structprefix, $name, '.c_str())')" />
         </xsl:when>
-        <xsl:when test="//enum[@name=$type]">
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
           <xsl:value-of select="concat(' comcall_', $name, ' = ', $G_funcPrefixInputEnumConverter, $type, '(', $structprefix, $name, ')')" />
         </xsl:when>
         <xsl:when test="$type='$unknown'">
@@ -643,9 +650,9 @@ const char *g_pcszIUnknown = "IUnknown";
           <xsl:call-template name="emitNewlineIndent8" />
           <xsl:text>    break</xsl:text>
         </xsl:when>
-        <xsl:when test="//interface[@name=$type]">
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
           <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
-          <xsl:variable name="thatif" select="//interface[@name=$type]" />
+          <xsl:variable name="thatif" select="key('G_keyInterfacesByName', $type)" />
           <xsl:variable name="wsmap" select="$thatif/@wsmap" />
           <xsl:variable name="thatifname" select="$thatif/@name" />
           <xsl:choose>
@@ -770,7 +777,7 @@ const char *g_pcszIUnknown = "IUnknown";
                         or ($type='long long')
                         or ($type='unsigned long long')
                         or ($type='result')
-                        or (//enum[@name=$type])">
+                        or (count(key('G_keyEnumsByName', $type)) > 0)">
           <xsl:text>&</xsl:text><xsl:value-of select="$varname" />
         </xsl:when>
         <xsl:otherwise>
@@ -899,15 +906,15 @@ const char *g_pcszIUnknown = "IUnknown";
                     or ($type='result')">
       <xsl:value-of select="$varname" />
     </xsl:when>
-    <xsl:when test="//enum[@name=$type]">
+    <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
       <xsl:value-of select="concat($G_funcPrefixOutputEnumConverter, $type, '(', $varname, ')')" />
     </xsl:when>
     <xsl:when test="$type='$unknown'">
       <xsl:value-of select="concat('createOrFindRefFromComPtr(idThis, g_pcszIUnknown, ', $varname, ')')" />
     </xsl:when>
-    <xsl:when test="//interface[@name=$type]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
       <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
-      <xsl:variable name="thatif" select="//interface[@name=$type]" />
+      <xsl:variable name="thatif" select="key('G_keyInterfacesByName', $type)" />
       <xsl:variable name="wsmap" select="$thatif/@wsmap" />
       <xsl:variable name="thatifname" select="$thatif/@name" />
       <xsl:choose>
@@ -992,10 +999,10 @@ const char *g_pcszIUnknown = "IUnknown";
       <!-- look up C++ glue type from IDL type from table array in typemap-shared.inc.xsl -->
       <xsl:variable name="gluetypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@gluename" />
       <xsl:choose>
-        <xsl:when test="//interface[@name=$type]">
+        <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
           <xsl:value-of select="concat('    ComPtr<', $type, '> tmpObject(', $varname, '[i]);')" />
         </xsl:when>
-        <xsl:when test="//enum[@name=$type]">
+        <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
           <xsl:value-of select="concat('    ', $type, '_T tmpObject(', $varname, '[i]);')" />
         </xsl:when>
         <xsl:when test="$type='$unknown'">
@@ -1267,8 +1274,8 @@ const char *g_pcszIUnknown = "IUnknown";
 <xsl:copy-of select="$ifname" />
 <xsl:text>
  *
- ****************************************************************************/
-</xsl:text>
+ ****************************************************************************/</xsl:text>
+    <xsl:call-template name="xsltprocNewlineOutputHack"/>
 
     <!--
       here come the attributes
diff --git a/src/VBox/Main/webservice/websrv-php.xsl b/src/VBox/Main/webservice/websrv-php.xsl
index 42591dc..d20abbc 100644
--- a/src/VBox/Main/webservice/websrv-php.xsl
+++ b/src/VBox/Main/webservice/websrv-php.xsl
@@ -11,7 +11,7 @@
 
      Contributed by James Lucas (mjlucas at eng.uts.edu.au).
 
-    Copyright (C) 2008-2014 Oracle Corporation
+    Copyright (C) 2008-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -34,6 +34,8 @@
 <xsl:variable name="G_setSuppressedInterfaces"
               select="//interface[@wsmap='suppress']" />
 
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
+
 <xsl:template name="emitOutParam">
   <xsl:param name="type" />
   <xsl:param name="value" />
@@ -171,7 +173,7 @@
       <xsl:when test="($extends = '$unknown') or ($extends = '$errorinfo')">
          <xsl:value-of select="concat('class ', $ifname, ' extends VBox_ManagedObject
{
')" />
       </xsl:when>
-      <xsl:when test="//interface[@name=$extends]">
+      <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0">
          <xsl:value-of select="concat('class ', $ifname, ' extends ', $extends, '
{
')" />
       </xsl:when>
    </xsl:choose>
@@ -360,7 +362,7 @@ class <xsl:value-of select="$ifname"/>Collection extends VBox_EnumCollection
 <xsl:text><?php
 
 /*
- * Copyright (C) 2008-2014 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of a free software library; you can redistribute
  * it and/or modify it under the terms of the GNU Lesser General
diff --git a/src/VBox/Main/webservice/websrv-python.xsl b/src/VBox/Main/webservice/websrv-python.xsl
index 0198459..501bd93 100644
--- a/src/VBox/Main/webservice/websrv-python.xsl
+++ b/src/VBox/Main/webservice/websrv-python.xsl
@@ -9,7 +9,7 @@
         VirtualBox.xidl. This Python file represents our
         web service API. Depends on WSDL file for actual SOAP bindings.
 
-    Copyright (C) 2008-2014 Oracle Corporation
+    Copyright (C) 2008-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -344,7 +344,7 @@ class <xsl:value-of select="$ifname"/>:
       if self.isarray:
           return <xsl:value-of select="$ifname" />(self.mgr, self.handle[index])
       raise TypeError, "iteration over non-sequence"
-
+<xsl:call-template name="xsltprocNewlineOutputHack"/>
 </xsl:template>
 
 <xsl:template name="convertInParam">
@@ -467,7 +467,7 @@ class <xsl:value-of select="@name"/>:
 </xsl:template>
 
 <xsl:template match="/">
-<xsl:text># Copyright (C) 2008-2014 Oracle Corporation
+<xsl:text># Copyright (C) 2008-2015 Oracle Corporation
 #
 # This file is part of a free software library; you can redistribute
 # it and/or modify it under the terms of the GNU Lesser General
@@ -868,6 +868,7 @@ class IUnknown:
   <xsl:for-each select="//enum">
        <xsl:call-template name="enum"/>
   </xsl:for-each>
+  <xsl:text>
 
 import base64
 
@@ -891,7 +892,7 @@ class IWebsessionManager2(IWebsessionManager):
 
   def encodebase64(self, str):
       return base64.encodestring(str)
-
+</xsl:text>
 </xsl:template>
 
 </xsl:stylesheet>
diff --git a/src/VBox/Main/webservice/websrv-typemap.xsl b/src/VBox/Main/webservice/websrv-typemap.xsl
index 714c42b..b4d305e 100644
--- a/src/VBox/Main/webservice/websrv-typemap.xsl
+++ b/src/VBox/Main/webservice/websrv-typemap.xsl
@@ -60,10 +60,10 @@ xsd__unsignedInt = | unsigned long
 # Main namespace (which is mapped to vbox__ prefixes):
 ]]></xsl:text>
   <xsl:value-of select="concat('vbox = "', $G_targetNamespace, '"')" />
-  <xsl:call-template name="emitNewline" />
-  <xsl:call-template name="emitNewline" />
-  <xsl:text># Namespaces for the interfaces in xidl that need to be mapped according to their wsmap attribs:</xsl:text>
-  <xsl:call-template name="emitNewline" />
+  <xsl:text>
+
+# Namespaces for the interfaces in xidl that need to be mapped according to their wsmap attribs:
+</xsl:text>
   <xsl:apply-templates />
 </xsl:template>
 
@@ -146,8 +146,8 @@ xsd__unsignedInt = | unsigned long
     <xsl:when test="$wsmap='struct'" />
     <xsl:when test="$wsmap='suppress'" />
     <xsl:otherwise>
-      <xsl:value-of select="concat($ifname, ' = ', $G_targetNamespace, $G_targetNamespaceSeparator, $ifname, $G_bindingSuffix)" />
-      <xsl:call-template name="emitNewline" />
+      <xsl:value-of select="concat($ifname, ' = ', $G_targetNamespace, $G_targetNamespaceSeparator,
+                                   $ifname, $G_bindingSuffix, $G_sNewLine)" />
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
diff --git a/src/VBox/Main/webservice/websrv-wsdl.xsl b/src/VBox/Main/webservice/websrv-wsdl.xsl
index 5508cd1..ddabc7c 100644
--- a/src/VBox/Main/webservice/websrv-wsdl.xsl
+++ b/src/VBox/Main/webservice/websrv-wsdl.xsl
@@ -9,7 +9,7 @@
         See webservice/Makefile.kmk for an overview of all the things
         generated for the webservice.
 
-    Copyright (C) 2006-2013 Oracle Corporation
+    Copyright (C) 2006-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -133,6 +133,14 @@
 <xsl:variable name="G_typeIsGlobalResponseElementMarker"
               select="'<<<<Response'" />
 
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  Keys for more efficiently looking up of types.
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
+
+
 <!--**********************************************************************
  *
  *  shared helpers
@@ -159,17 +167,12 @@
     <xsl:when test="$type='managed'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
     <xsl:when test="$type='explicit'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
     <!-- enums are easy, these are defined in schema at the top of the wsdl -->
-    <xsl:when test="//enum[@name=$type]"><xsl:value-of select="concat('vbox:', $type)" /></xsl:when>
+    <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0"><xsl:value-of select="concat('vbox:', $type)" /></xsl:when>
     <!-- otherwise test for an interface with this name -->
-    <xsl:when test="//interface[@name=$type]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
       <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
-      <xsl:variable name="wsmap" select="//interface[@name=$type]/@wsmap" />
+      <xsl:variable name="wsmap" select="key('G_keyInterfacesByName', $type)/@wsmap" />
       <xsl:choose>
-        <xsl:when test="not($wsmap)">
-          <xsl:call-template name="fatalError">
-            <xsl:with-param name="msg" select="concat('emitConvertedType: Type "', $type, '" in method "', $ifname, '::', $methodname, '" lacks wsmap attribute value in XIDL.')" />
-          </xsl:call-template>
-        </xsl:when>
         <xsl:when test="$wsmap='struct'"><xsl:value-of select="concat('vbox:', $type)" /></xsl:when>
         <xsl:when test="$wsmap='global'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
         <xsl:when test="$wsmap='managed'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
diff --git a/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl b/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl
index bdbce0e..4db1fd7 100644
--- a/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl
+++ b/src/VBox/Main/webservice/websrv-wsdl2gsoapH.xsl
@@ -52,6 +52,15 @@
 
 
 <!-- - - - - - - - - - - - - - - - - - - - - - -
+  Keys for more efficiently looking up of stuff
+ - - - - - - - - - - - - - - - - - - - - - - -->
+
+<xsl:key name="G_keyMessagesByName" match="//wsdl:message[@name]" use="@name"/>
+<xsl:key name="G_keySimpleTypesByName" match="//xsd:simpleType[@name]" use="@name"/>
+<xsl:key name="G_keyComplexTypesByName" match="//xsd:complexType[@name]" use="@name"/>
+
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
   root match
  - - - - - - - - - - - - - - - - - - - - - - -->
 
@@ -91,8 +100,8 @@ struct SOAP_ENV__Detail
     int __type;
     void *fault;
     _XML __any;
-};</xsl:text>
-  <xsl:call-template name="emitNewline" />
+};
+</xsl:text>
 
   <xsl:apply-templates />
 </xsl:template>
@@ -101,12 +110,10 @@ struct SOAP_ENV__Detail
   <xsl:param name="xmltype" />
   <xsl:param name="ctype" />
 
-  <xsl:value-of select="concat('class ', $ctype)" />
-  <xsl:call-template name="emitNewline" />
-  <xsl:text>{</xsl:text>
-  <xsl:call-template name="emitNewline" />
-  <xsl:text>    public:</xsl:text>
-  <xsl:call-template name="emitNewline" />
+  <xsl:value-of select="concat('class ', $ctype, $G_sNewLine)" />
+  <xsl:text>{
+    public:
+</xsl:text>
   <xsl:for-each select="xsd:element">
     <xsl:variable name="typefield" select="@type" />
     <xsl:variable name="xmltypefield" select="substring($typefield, 5)" /><!-- remove "xsd:" prefix-->
@@ -126,7 +133,7 @@ struct SOAP_ENV__Detail
         </xsl:choose>
       </xsl:when>
       <!-- is there an enum of this type? (look up in simple types) -->
-      <xsl:when test="//xsd:simpleType[@name=$withoutvboxtypefield]">
+      <xsl:when test="count(key('G_keySimpleTypesByName', $withoutvboxtypefield)) > 0">
         <xsl:variable name="enumname">
           <xsl:value-of select="concat('enum vbox__', $withoutvboxtypefield)" />
         </xsl:variable>
@@ -140,7 +147,7 @@ struct SOAP_ENV__Detail
         </xsl:choose>
       </xsl:when>
       <!-- is this one of the vbox types? (look up in complex types) -->
-      <xsl:when test="//xsd:complexType[@name=$withoutvboxtypefield]">
+      <xsl:when test="count(key('G_keyComplexTypesByName', $withoutvboxtypefield)) > 0">
         <!-- array or simple type: depends on whether maxOccurs="unbounded" is in WSDL -->
         <xsl:choose>
           <xsl:when test="@maxOccurs='unbounded'">
@@ -160,14 +167,13 @@ struct SOAP_ENV__Detail
             <xsl:with-param name="string" select="@name" />
         </xsl:call-template>
     </xsl:variable>
-    <xsl:value-of select="concat(' ', $underscoredname, ' 1;')" />
-    <xsl:call-template name="emitNewline" />
+    <xsl:value-of select="concat(' ', $underscoredname, ' 1;', $G_sNewLine)" />
   </xsl:for-each>
-  <xsl:text>        struct soap *soap;</xsl:text>
-  <xsl:call-template name="emitNewline" />
-  <xsl:text>};</xsl:text>
-  <xsl:call-template name="emitNewline" />
-  <xsl:call-template name="emitNewline" />
+  <xsl:text>        struct soap *soap;
+};
+</xsl:text>
+<xsl:call-template name="xsltprocNewlineOutputHack"/>
+
 </xsl:template>
 
 <xsl:template match="wsdl:types/xsd:schema">
@@ -177,9 +183,9 @@ struct SOAP_ENV__Detail
     <xsl:variable name="ctype" select="concat('vbox__', @name)" />
     <xsl:for-each select="xsd:restriction">
       <xsl:value-of select="concat('enum ', $ctype)" />
-      <xsl:call-template name="emitNewline" />
-      <xsl:text>{</xsl:text>
-      <xsl:call-template name="emitNewline" />
+      <xsl:text>
+{
+</xsl:text>
       <xsl:for-each select="xsd:enumeration">
         <xsl:variable name="underscoredname">
           <xsl:call-template name="escapeUnderscores">
@@ -190,11 +196,12 @@ struct SOAP_ENV__Detail
         <xsl:if test = "not(position()=last())" >
           <xsl:text >,</xsl:text>
         </xsl:if>
-        <xsl:call-template name="emitNewline" />
+        <xsl:text>
+</xsl:text>
       </xsl:for-each>
-      <xsl:text>};</xsl:text>
-      <xsl:call-template name="emitNewline" />
-      <xsl:call-template name="emitNewline" />
+      <xsl:text>};
+
+</xsl:text>
     </xsl:for-each>
   </xsl:for-each>
 
@@ -232,14 +239,10 @@ struct SOAP_ENV__Detail
 
 <xsl:template match="wsdl:portType">
 
-  <xsl:value-of select="concat('//gsoap vbox service name: vbox', $G_bindingSuffix)" />
-  <xsl:call-template name="emitNewline" />
-  <xsl:value-of select="concat('//gsoap vbox service type: vbox', $G_portTypeSuffix)" />
-  <xsl:call-template name="emitNewline" />
-  <xsl:value-of select="concat('//gsoap vbox service namespace: ', $G_targetNamespace, $G_targetNamespaceSeparator)" />
-  <xsl:call-template name="emitNewline" />
-  <xsl:value-of select="concat('//gsoap vbox service transport: ', 'http://schemas.xmlsoap.org/soap/http')" />
-  <xsl:call-template name="emitNewline" />
+  <xsl:value-of select="concat('//gsoap vbox service name: vbox', $G_bindingSuffix, $G_sNewLine)" />
+  <xsl:value-of select="concat('//gsoap vbox service type: vbox', $G_portTypeSuffix, $G_sNewLine)" />
+  <xsl:value-of select="concat('//gsoap vbox service namespace: ', $G_targetNamespace, $G_targetNamespaceSeparator, $G_sNewLine)" />
+  <xsl:value-of select="concat('//gsoap vbox service transport: ', 'http://schemas.xmlsoap.org/soap/http', $G_sNewLine)" />
 
   <xsl:for-each select="wsdl:operation">
     <xsl:variable name="methodname" select="@name" />
@@ -251,22 +254,15 @@ struct SOAP_ENV__Detail
     <xsl:variable name="requestmsg" select="concat($methodname, $G_methodRequest)" />
     <xsl:variable name="responsemsg" select="concat($methodname, $G_methodResponse)" />
 
-    <xsl:call-template name="emitNewline" />
-    <xsl:value-of select="concat('//gsoap vbox service method-style:    ', $cmethodname, ' ', $G_basefmt)" />
-    <xsl:call-template name="emitNewline" />
-    <xsl:value-of select="concat('//gsoap vbox service method-encoding: ', $cmethodname, ' ', $G_parmfmt)" />
-    <xsl:call-template name="emitNewline" />
-    <xsl:value-of select="concat('//gsoap vbox service method-action:   ', $cmethodname, ' ""')" />
-    <xsl:call-template name="emitNewline" />
-    <xsl:value-of select="concat('//gsoap vbox service method-fault:    ', $cmethodname, ' vbox__InvalidObjectFault')" />
-    <xsl:call-template name="emitNewline" />
-    <xsl:value-of select="concat('//gsoap vbox service method-fault:    ', $cmethodname, ' vbox__RuntimeFault')" />
-    <xsl:call-template name="emitNewline" />
-    <xsl:value-of select="concat('int __vbox__', $cmethodname, '(')" />
-    <xsl:call-template name="emitNewline" />
+    <xsl:value-of select="concat($G_sNewLine, '//gsoap vbox service method-style:    ', $cmethodname, ' ', $G_basefmt)" />
+    <xsl:value-of select="concat($G_sNewLine, '//gsoap vbox service method-encoding: ', $cmethodname, ' ', $G_parmfmt)" />
+    <xsl:value-of select="concat($G_sNewLine, '//gsoap vbox service method-action:   ', $cmethodname, ' ""')" />
+    <xsl:value-of select="concat($G_sNewLine, '//gsoap vbox service method-fault:    ', $cmethodname, ' vbox__InvalidObjectFault')" />
+    <xsl:value-of select="concat($G_sNewLine, '//gsoap vbox service method-fault:    ', $cmethodname, ' vbox__RuntimeFault')" />
+    <xsl:value-of select="concat($G_sNewLine, 'int __vbox__', $cmethodname, '(', $G_sNewLine)" />
 
     <!-- request element -->
-    <xsl:variable name="reqtype" select="//wsdl:message[@name=$requestmsg]/wsdl:part/@element" />
+    <xsl:variable name="reqtype" select="key('G_keyMessagesByName', $requestmsg)/wsdl:part/@element" />
     <xsl:if test="not($reqtype)">
       <xsl:call-template name="fatalError">
         <xsl:with-param name="msg" select="concat('wsdl:portType match: Cannot find message with "name"="', $requestmsg, '".')" />
@@ -277,10 +273,9 @@ struct SOAP_ENV__Detail
         <xsl:with-param name="string" select="substring($reqtype, 6)" />
       </xsl:call-template>
     </xsl:variable>
-    <xsl:value-of select="concat('    _vbox__', $creqtype, '* vbox__', $creqtype, ',')"/>
-    <xsl:call-template name="emitNewline" />
+    <xsl:value-of select="concat('    _vbox__', $creqtype, '* vbox__', $creqtype, ',', $G_sNewLine)"/>
     <!-- response element -->
-    <xsl:variable name="resptype" select="//wsdl:message[@name=$responsemsg]/wsdl:part/@element" />
+    <xsl:variable name="resptype" select="key('G_keyMessagesByName', $responsemsg)/wsdl:part/@element" />
     <xsl:if test="not($resptype)">
       <xsl:call-template name="fatalError">
         <xsl:with-param name="msg" select="concat('wsdl:portType match: Cannot find message with "name"="', $responsemsg, '".')" />
@@ -291,11 +286,10 @@ struct SOAP_ENV__Detail
         <xsl:with-param name="string" select="substring($resptype, 6)" />
       </xsl:call-template>
     </xsl:variable>
-    <xsl:value-of select="concat('    _vbox__', $cresptype, '* vbox__', $cresptype)"/>
-    <xsl:call-template name="emitNewline" />
+    <xsl:value-of select="concat('    _vbox__', $cresptype, '* vbox__', $cresptype, $G_sNewLine)"/>
 
     <xsl:text>);</xsl:text>
-    <xsl:call-template name="emitNewline" />
+    <xsl:call-template name="xsltprocNewlineOutputHack"/>
 
   </xsl:for-each>
 </xsl:template>
diff --git a/src/VBox/Main/xml/Settings.cpp b/src/VBox/Main/xml/Settings.cpp
index 5bc08bd..1459200 100644
--- a/src/VBox/Main/xml/Settings.cpp
+++ b/src/VBox/Main/xml/Settings.cpp
@@ -54,7 +54,7 @@
  */
 
 /*
- * Copyright (C) 2007-2014 Oracle Corporation
+ * Copyright (C) 2007-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -120,6 +120,9 @@ using namespace settings;
 /** VirtualBox XML settings full version string ("x.y-platform") */
 #define VBOX_XML_VERSION_FULL   VBOX_XML_VERSION "-" VBOX_XML_PLATFORM
 
+const struct Snapshot settings::g_SnapshotEmpty; /* default ctor is OK */
+const struct Medium settings::g_MediumEmpty; /* default ctor is OK */
+
 ////////////////////////////////////////////////////////////////////////////////
 //
 // Internal data
@@ -329,7 +332,9 @@ ConfigFileBase::ConfigFileBase(const com::Utf8Str *pstrFilename)
                     m->sv = SettingsVersion_v1_13;
                 else if (ulMinor == 14)
                     m->sv = SettingsVersion_v1_14;
-                else if (ulMinor > 14)
+                else if (ulMinor == 15)
+                    m->sv = SettingsVersion_v1_15;
+                else if (ulMinor > 15)
                     m->sv = SettingsVersion_Future;
             }
             else if (ulMajor > 1)
@@ -374,6 +379,27 @@ ConfigFileBase::~ConfigFileBase()
 }
 
 /**
+ * Helper function to convert a MediaType enum value into string from.
+ * @param t
+ */
+/*static*/
+const char *ConfigFileBase::stringifyMediaType(MediaType t)
+{
+    switch (t)
+    {
+        case HardDisk:
+            return "hard disk";
+        case DVDImage:
+            return "DVD";
+        case FloppyImage:
+            return "floppy";
+        default:
+            AssertMsgFailed(("media type %d\n", t));
+            return "UNKNOWN";
+    }
+}
+
+/**
  * Helper function that parses a UUID in string form into
  * a com::Guid item. Accepts UUIDs both with and without
  * "{}" brackets. Throws on errors.
@@ -463,7 +489,7 @@ void ConfigFileBase::parseTimestamp(RTTIMESPEC &timestamp,
  * @param stamp
  * @return
  */
-com::Utf8Str ConfigFileBase::makeString(const RTTIMESPEC &stamp)
+com::Utf8Str ConfigFileBase::stringifyTimestamp(const RTTIMESPEC &stamp) const
 {
     RTTIME time;
     if (!RTTimeExplode(&time, &stamp))
@@ -563,15 +589,14 @@ void ConfigFileBase::readUSBDeviceFilters(const xml::ElementNode &elmDeviceFilte
  *
  * @param t
  * @param elmMedium
- * @param llMedia
+ * @param med
  */
-void ConfigFileBase::readMedium(MediaType t,
-                                const xml::ElementNode &elmMedium,  // HardDisk node if root; if recursing,
-                                                                    // child HardDisk node or DiffHardDisk node for pre-1.4
-                                MediaList &llMedia)     // list to append medium to (root disk or child list)
+void ConfigFileBase::readMediumOne(MediaType t,
+                                   const xml::ElementNode &elmMedium,
+                                   Medium &med)
 {
     // <HardDisk uuid="{5471ecdb-1ddb-4012-a801-6d98e226868b}" location="/mnt/innotek-unix/vdis/Windows XP.vdi" format="VDI" type="Normal">
-    settings::Medium med;
+
     Utf8Str strUUID;
     if (!elmMedium.getAttributeValue("uuid", strUUID))
         throw ConfigFileError(this, &elmMedium, N_("Required %s/@uuid attribute is missing"), elmMedium.getName());
@@ -723,34 +748,61 @@ void ConfigFileBase::readMedium(MediaType t,
 
     elmMedium.getAttributeValue("Description", med.strDescription);       // optional
 
-    // recurse to handle children
-    xml::NodesLoop nl2(elmMedium);
+    // handle medium properties
+    xml::NodesLoop nl2(elmMedium, "Property");
     const xml::ElementNode *pelmHDChild;
     while ((pelmHDChild = nl2.forAllNodes()))
     {
-        if (    t == HardDisk
-             && (    pelmHDChild->nameEquals("HardDisk")
-                  || (    (m->sv < SettingsVersion_v1_4)
-                       && (pelmHDChild->nameEquals("DiffHardDisk"))
-                     )
-                )
-           )
-            // recurse with this element and push the child onto our current children list
-            readMedium(t,
-                        *pelmHDChild,
-                        med.llChildren);
-        else if (pelmHDChild->nameEquals("Property"))
-        {
-            Utf8Str strPropName, strPropValue;
-            if (   pelmHDChild->getAttributeValue("name", strPropName)
-                && pelmHDChild->getAttributeValue("value", strPropValue) )
-                med.properties[strPropName] = strPropValue;
-            else
-                throw ConfigFileError(this, pelmHDChild, N_("Required HardDisk/Property/@name or @value attribute is missing"));
-        }
+        Utf8Str strPropName, strPropValue;
+        if (   pelmHDChild->getAttributeValue("name", strPropName)
+            && pelmHDChild->getAttributeValue("value", strPropValue) )
+            med.properties[strPropName] = strPropValue;
+        else
+            throw ConfigFileError(this, pelmHDChild, N_("Required HardDisk/Property/@name or @value attribute is missing"));
     }
+}
 
-    llMedia.push_back(med);
+/**
+ * Reads a media registry entry from the main VirtualBox.xml file and recurses
+ * into children where applicable.
+ *
+ * @param t
+ * @param depth
+ * @param elmMedium
+ * @param med
+ */
+void ConfigFileBase::readMedium(MediaType t,
+                                uint32_t depth,
+                                const xml::ElementNode &elmMedium,  // HardDisk node if root; if recursing,
+                                                                    // child HardDisk node or DiffHardDisk node for pre-1.4
+                                Medium &med)                        // medium settings to fill out
+{
+    if (depth > SETTINGS_MEDIUM_DEPTH_MAX)
+        throw ConfigFileError(this, &elmMedium, N_("Maximum medium tree depth of %u exceeded"), SETTINGS_MEDIUM_DEPTH_MAX);
+
+    // Do not inline this method call, as the purpose of having this separate
+    // is to save on stack size. Less local variables are the key for reaching
+    // deep recursion levels with small stack (XPCOM/g++ without optimization).
+    readMediumOne(t, elmMedium, med);
+
+    if (t != HardDisk)
+        return;
+
+    // recurse to handle children
+    MediaList &llSettingsChildren = med.llChildren;
+    xml::NodesLoop nl2(elmMedium, m->sv >= SettingsVersion_v1_4 ? "HardDisk" : "DiffHardDisk");
+    const xml::ElementNode *pelmHDChild;
+    while ((pelmHDChild = nl2.forAllNodes()))
+    {
+        // recurse with this element and put the child at the end of the list.
+        // XPCOM has very small stack, avoid big local variables and use the
+        // list element.
+        llSettingsChildren.push_back(g_MediumEmpty);
+        readMedium(t,
+                   depth + 1,
+                   *pelmHDChild,
+                   llSettingsChildren.back());
+    }
 }
 
 /**
@@ -785,24 +837,24 @@ void ConfigFileBase::readMediaRegistry(const xml::ElementNode &elmMediaRegistry,
         const xml::ElementNode *pelmMedium;
         while ((pelmMedium = nl2.forAllNodes()))
         {
-            if (    t == HardDisk
-                 && (pelmMedium->nameEquals("HardDisk"))
-               )
-                readMedium(t,
-                           *pelmMedium,
-                           mr.llHardDisks);      // list to append hard disk data to: the root list
-            else if (    t == DVDImage
-                      && (pelmMedium->nameEquals("Image"))
-                    )
-                readMedium(t,
-                           *pelmMedium,
-                           mr.llDvdImages);      // list to append dvd images to: the root list
-            else if (    t == FloppyImage
-                      && (pelmMedium->nameEquals("Image"))
-                    )
-                readMedium(t,
-                           *pelmMedium,
-                           mr.llFloppyImages);      // list to append floppy images to: the root list
+            if (   t == HardDisk
+                && (pelmMedium->nameEquals("HardDisk")))
+            {
+                mr.llHardDisks.push_back(g_MediumEmpty);
+                readMedium(t, 1, *pelmMedium, mr.llHardDisks.back());
+            }
+            else if (   t == DVDImage
+                     && (pelmMedium->nameEquals("Image")))
+            {
+                mr.llDvdImages.push_back(g_MediumEmpty);
+                readMedium(t, 1, *pelmMedium, mr.llDvdImages.back());
+            }
+            else if (   t == FloppyImage
+                     && (pelmMedium->nameEquals("Image")))
+            {
+                mr.llFloppyImages.push_back(g_MediumEmpty);
+                readMedium(t, 1, *pelmMedium, mr.llFloppyImages.back());
+            }
         }
     }
 }
@@ -888,17 +940,35 @@ void ConfigFileBase::setVersionAttribute(xml::ElementNode &elm)
             pcszVersion = "1.14";
             break;
 
-        case SettingsVersion_Future:
-            // can be set if this code runs on XML files that were created by a future version of VBox;
-            // in that case, downgrade to current version when writing since we can't write future versions...
-            pcszVersion = "1.14";
-            m->sv = SettingsVersion_v1_14;
+        case SettingsVersion_v1_15:
+            pcszVersion = "1.15";
             break;
 
         default:
+            // catch human error: the assertion below will trigger in debug
+            // or dbgopt builds, so hopefully this will get noticed sooner in
+            // the future, because it's easy to forget top update something.
+            AssertMsg(m->sv <= SettingsVersion_v1_7, ("Settings.cpp: unexpected settings version %d, unhandled future version?\n", m->sv));
             // silently upgrade if this is less than 1.7 because that's the oldest we can write
-            pcszVersion = "1.7";
-            m->sv = SettingsVersion_v1_7;
+            if (m->sv <= SettingsVersion_v1_7)
+            {
+                pcszVersion = "1.7";
+                m->sv = SettingsVersion_v1_7;
+            }
+            else
+            {
+                // This is reached for SettingsVersion_Future and forgotten
+                // settings version after SettingsVersion_v1_7, which should
+                // not happen (see assertion above). Set the version to the
+                // latest known version, to minimize loss of information, but
+                // as we can't predict the future we have to use some format
+                // we know, and latest should be the best choice. Note that
+                // for "forgotten settings" this may not be the best choice,
+                // but as it's an omission of someone who changed this file
+                // it's the only generic possibility.
+                pcszVersion = "1.15";
+                m->sv = SettingsVersion_v1_15;
+            }
             break;
     }
 
@@ -1065,18 +1135,22 @@ void ConfigFileBase::buildUSBDeviceFilters(xml::ElementNode &elmParent,
  * and recurses to write the child hard disks underneath. Called from
  * MainConfigFile::write().
  *
+ * @param t
+ * @param depth
  * @param elmMedium
- * @param m
- * @param level
+ * @param mdm
  */
-void ConfigFileBase::buildMedium(xml::ElementNode &elmMedium,
-                                 DeviceType_T devType,
-                                 const Medium &mdm,
-                                 uint32_t level)          // 0 for "root" call, incremented with each recursion
+void ConfigFileBase::buildMedium(MediaType t,
+                                 uint32_t depth,
+                                 xml::ElementNode &elmMedium,
+                                 const Medium &mdm)
 {
+    if (depth > SETTINGS_MEDIUM_DEPTH_MAX)
+        throw ConfigFileError(this, &elmMedium, N_("Maximum medium tree depth of %u exceeded"), SETTINGS_MEDIUM_DEPTH_MAX);
+
     xml::ElementNode *pelmMedium;
 
-    if (devType == DeviceType_HardDisk)
+    if (t == HardDisk)
         pelmMedium = elmMedium.createChild("HardDisk");
     else
         pelmMedium = elmMedium.createChild("Image");
@@ -1085,9 +1159,9 @@ void ConfigFileBase::buildMedium(xml::ElementNode &elmMedium,
 
     pelmMedium->setAttributePath("location", mdm.strLocation);
 
-    if (devType == DeviceType_HardDisk || RTStrICmp(mdm.strFormat.c_str(), "RAW"))
+    if (t == HardDisk || RTStrICmp(mdm.strFormat.c_str(), "RAW"))
         pelmMedium->setAttribute("format", mdm.strFormat);
-    if (   devType == DeviceType_HardDisk
+    if (   t == HardDisk
         && mdm.fAutoReset)
         pelmMedium->setAttribute("autoReset", mdm.fAutoReset);
     if (mdm.strDescription.length())
@@ -1103,13 +1177,13 @@ void ConfigFileBase::buildMedium(xml::ElementNode &elmMedium,
     }
 
     // only for base hard disks, save the type
-    if (level == 0)
+    if (depth == 1)
     {
         // no need to save the usual DVD/floppy medium types
-        if (   (   devType != DeviceType_DVD
+        if (   (   t != DVDImage
                 || (   mdm.hdType != MediumType_Writethrough // shouldn't happen
                     && mdm.hdType != MediumType_Readonly))
-            && (   devType != DeviceType_Floppy
+            && (   t != FloppyImage
                 || mdm.hdType != MediumType_Writethrough))
         {
             const char *pcszType =
@@ -1129,10 +1203,10 @@ void ConfigFileBase::buildMedium(xml::ElementNode &elmMedium,
          ++it)
     {
         // recurse for children
-        buildMedium(*pelmMedium, // parent
-                    devType,     // device type
-                    *it,         // settings::Medium
-                    ++level);    // recursion level
+        buildMedium(t,              // device type
+                    depth + 1,      // depth
+                    *pelmMedium,    // parent
+                    *it);           // settings::Medium
     }
 }
 
@@ -1157,7 +1231,7 @@ void ConfigFileBase::buildMediaRegistry(xml::ElementNode &elmParent,
          it != mr.llHardDisks.end();
          ++it)
     {
-        buildMedium(*pelmHardDisks, DeviceType_HardDisk, *it, 0);
+        buildMedium(HardDisk, 1, *pelmHardDisks, *it);
     }
 
     xml::ElementNode *pelmDVDImages = pelmMediaRegistry->createChild("DVDImages");
@@ -1165,7 +1239,7 @@ void ConfigFileBase::buildMediaRegistry(xml::ElementNode &elmParent,
          it != mr.llDvdImages.end();
          ++it)
     {
-        buildMedium(*pelmDVDImages, DeviceType_DVD, *it, 0);
+        buildMedium(DVDImage, 1, *pelmDVDImages, *it);
     }
 
     xml::ElementNode *pelmFloppyImages = pelmMediaRegistry->createChild("FloppyImages");
@@ -1173,7 +1247,7 @@ void ConfigFileBase::buildMediaRegistry(xml::ElementNode &elmParent,
          it != mr.llFloppyImages.end();
          ++it)
     {
-        buildMedium(*pelmFloppyImages, DeviceType_Floppy, *it, 0);
+        buildMedium(FloppyImage, 1, *pelmFloppyImages, *it);
     }
 }
 
@@ -1584,7 +1658,7 @@ void MainConfigFile::write(const com::Utf8Str strFilename)
         pelmThis->setAttribute("upperIP", d.strIPUpper);
         pelmThis->setAttribute("enabled", (d.fEnabled) ? 1 : 0);        // too bad we chose 1 vs. 0 here
         /* We assume that if there're only 1 element it means that */
-        int cOpt = d.GlobalDhcpOptions.size();
+        size_t cOpt = d.GlobalDhcpOptions.size();
         /* We don't want duplicate validation check of networkMask here*/
         if (   (   itOpt == d.GlobalDhcpOptions.end()
                 && cOpt > 0)
@@ -1888,7 +1962,6 @@ Hardware::Hardware()
           fVPID(true),
           fUnrestrictedExecution(true),
           fHardwareVirtForce(false),
-          fSyntheticCpu(false),
           fTripleFaultReset(false),
           fPAE(false),
           enmLongMode(HC_ARCH_BITS == 64 ? Hardware::LongMode_Enabled : Hardware::LongMode_Disabled),
@@ -1896,6 +1969,7 @@ Hardware::Hardware()
           fCpuHotPlug(false),
           fHPETEnabled(false),
           ulCpuExecutionCap(100),
+          uCpuIdPortabilityLevel(0),
           ulMemorySizeMB((uint32_t)-1),
           graphicsControllerType(GraphicsControllerType_VBoxVGA),
           ulVRAMSizeMB(8),
@@ -1906,6 +1980,8 @@ Hardware::Hardware()
           ulVideoCaptureVertRes(768),
           ulVideoCaptureRate(512),
           ulVideoCaptureFPS(25),
+          ulVideoCaptureMaxTime(0),
+          ulVideoCaptureMaxSize(0),
           fVideoCaptureEnabled(false),
           u64VideoCaptureScreens(UINT64_C(0xffffffffffffffff)),
           strVideoCaptureFile(""),
@@ -1913,9 +1989,10 @@ Hardware::Hardware()
           pointingHIDType(PointingHIDType_PS2Mouse),
           keyboardHIDType(KeyboardHIDType_PS2Keyboard),
           chipsetType(ChipsetType_PIIX3),
+          paravirtProvider(ParavirtProvider_Legacy),
           fEmulatedUSBCardReader(false),
           clipboardMode(ClipboardMode_Disabled),
-          dragAndDropMode(DragAndDropMode_Disabled),
+          dndMode(DnDMode_Disabled),
           ulMemoryBalloonSize(0),
           fPageFusionEnabled(false)
 {
@@ -1959,13 +2036,13 @@ bool Hardware::operator==(const Hardware& h) const
                   && (fVPID                     == h.fVPID)
                   && (fUnrestrictedExecution    == h.fUnrestrictedExecution)
                   && (fHardwareVirtForce        == h.fHardwareVirtForce)
-                  && (fSyntheticCpu             == h.fSyntheticCpu)
                   && (fPAE                      == h.fPAE)
                   && (enmLongMode               == h.enmLongMode)
                   && (fTripleFaultReset         == h.fTripleFaultReset)
                   && (cCPUs                     == h.cCPUs)
                   && (fCpuHotPlug               == h.fCpuHotPlug)
                   && (ulCpuExecutionCap         == h.ulCpuExecutionCap)
+                  && (uCpuIdPortabilityLevel    == h.uCpuIdPortabilityLevel)
                   && (fHPETEnabled              == h.fHPETEnabled)
                   && (llCpus                    == h.llCpus)
                   && (llCpuIdLeafs              == h.llCpuIdLeafs)
@@ -1983,10 +2060,13 @@ bool Hardware::operator==(const Hardware& h) const
                   && (ulVideoCaptureVertRes     == h.ulVideoCaptureVertRes)
                   && (ulVideoCaptureRate        == h.ulVideoCaptureRate)
                   && (ulVideoCaptureFPS         == h.ulVideoCaptureFPS)
+                  && (ulVideoCaptureMaxTime     == h.ulVideoCaptureMaxTime)
+                  && (ulVideoCaptureMaxSize     == h.ulVideoCaptureMaxTime)
                   && (firmwareType              == h.firmwareType)
                   && (pointingHIDType           == h.pointingHIDType)
                   && (keyboardHIDType           == h.keyboardHIDType)
                   && (chipsetType               == h.chipsetType)
+                  && (paravirtProvider          == h.paravirtProvider)
                   && (fEmulatedUSBCardReader    == h.fEmulatedUSBCardReader)
                   && (vrdeSettings              == h.vrdeSettings)
                   && (biosSettings              == h.biosSettings)
@@ -1997,7 +2077,7 @@ bool Hardware::operator==(const Hardware& h) const
                   && (audioAdapter              == h.audioAdapter)
                   && (llSharedFolders           == h.llSharedFolders)
                   && (clipboardMode             == h.clipboardMode)
-                  && (dragAndDropMode           == h.dragAndDropMode)
+                  && (dndMode           == h.dndMode)
                   && (ulMemoryBalloonSize       == h.ulMemoryBalloonSize)
                   && (fPageFusionEnabled        == h.fPageFusionEnabled)
                   && (llGuestProperties         == h.llGuestProperties)
@@ -2484,6 +2564,8 @@ void MachineConfigFile::readSerialPorts(const xml::ElementNode &elmUART,
             port.portMode = PortMode_HostDevice;
         else if (strPortMode == "Disconnected")
             port.portMode = PortMode_Disconnected;
+        else if (strPortMode == "TCP")
+            port.portMode = PortMode_TCP;
         else
             throw ConfigFileError(this, pelmPort, N_("Invalid value '%s' in UART/Port/@hostMode attribute"), strPortMode.c_str());
 
@@ -2719,7 +2801,12 @@ void MachineConfigFile::readHardware(const xml::ElementNode &elmHardware,
                 hw.enmLongMode = Hardware::LongMode_Legacy;
 
             if ((pelmCPUChild = pelmHwChild->findChildElement("SyntheticCpu")))
-                pelmCPUChild->getAttributeValue("enabled", hw.fSyntheticCpu);
+            {
+                bool fSyntheticCpu = false;
+                pelmCPUChild->getAttributeValue("enabled", fSyntheticCpu);
+                hw.uCpuIdPortabilityLevel = fSyntheticCpu ? 1 : 0;
+            }
+            pelmHwChild->getAttributeValue("CpuIdPortabilityLevel", hw.uCpuIdPortabilityLevel);
 
             if ((pelmCPUChild = pelmHwChild->findChildElement("TripleFaultReset")))
                 pelmCPUChild->getAttributeValue("enabled", hw.fTripleFaultReset);
@@ -2814,6 +2901,30 @@ void MachineConfigFile::readHardware(const xml::ElementNode &elmHardware,
                                           strChipsetType.c_str());
             }
         }
+        else if (pelmHwChild->nameEquals("Paravirt"))
+        {
+            Utf8Str strProvider;
+            if (pelmHwChild->getAttributeValue("provider", strProvider))
+            {
+                if (strProvider == "None")
+                    hw.paravirtProvider = ParavirtProvider_None;
+                else if (strProvider == "Default")
+                    hw.paravirtProvider = ParavirtProvider_Default;
+                else if (strProvider == "Legacy")
+                    hw.paravirtProvider = ParavirtProvider_Legacy;
+                else if (strProvider == "Minimal")
+                    hw.paravirtProvider = ParavirtProvider_Minimal;
+                else if (strProvider == "HyperV")
+                    hw.paravirtProvider = ParavirtProvider_HyperV;
+                else if (strProvider == "KVM")
+                    hw.paravirtProvider = ParavirtProvider_KVM;
+                else
+                    throw ConfigFileError(this,
+                                          pelmHwChild,
+                                          N_("Invalid value '%s' in Paravirt/@provider attribute"),
+                                          strProvider.c_str());
+            }
+        }
         else if (pelmHwChild->nameEquals("HPET"))
         {
             pelmHwChild->getAttributeValue("enabled", hw.fHPETEnabled);
@@ -2899,6 +3010,8 @@ void MachineConfigFile::readHardware(const xml::ElementNode &elmHardware,
             pelmHwChild->getAttributeValue("vertRes",   hw.ulVideoCaptureVertRes);
             pelmHwChild->getAttributeValue("rate",      hw.ulVideoCaptureRate);
             pelmHwChild->getAttributeValue("fps",       hw.ulVideoCaptureFPS);
+            pelmHwChild->getAttributeValue("maxTime",   hw.ulVideoCaptureMaxTime);
+            pelmHwChild->getAttributeValue("maxSize",   hw.ulVideoCaptureMaxSize);
         }
         else if (pelmHwChild->nameEquals("RemoteDisplay"))
         {
@@ -3085,6 +3198,8 @@ void MachineConfigFile::readHardware(const xml::ElementNode &elmHardware,
                             ctrl.enmType = USBControllerType_OHCI;
                         else if (strCtrlType == "EHCI")
                             ctrl.enmType = USBControllerType_EHCI;
+                        else if (strCtrlType == "XHCI")
+                            ctrl.enmType = USBControllerType_XHCI;
                         else
                             throw ConfigFileError(this, pelmCtrl, N_("Invalid value '%s' for Controller/@type attribute"), strCtrlType.c_str());
                     }
@@ -3168,13 +3283,13 @@ void MachineConfigFile::readHardware(const xml::ElementNode &elmHardware,
             if (pelmHwChild->getAttributeValue("mode", strTemp))
             {
                 if (strTemp == "Disabled")
-                    hw.dragAndDropMode = DragAndDropMode_Disabled;
+                    hw.dndMode = DnDMode_Disabled;
                 else if (strTemp == "HostToGuest")
-                    hw.dragAndDropMode = DragAndDropMode_HostToGuest;
+                    hw.dndMode = DnDMode_HostToGuest;
                 else if (strTemp == "GuestToHost")
-                    hw.dragAndDropMode = DragAndDropMode_GuestToHost;
+                    hw.dndMode = DnDMode_GuestToHost;
                 else if (strTemp == "Bidirectional")
-                    hw.dragAndDropMode = DragAndDropMode_Bidirectional;
+                    hw.dndMode = DnDMode_Bidirectional;
                 else
                     throw ConfigFileError(this, pelmHwChild, N_("Invalid value '%s' in DragAndDrop/@mode attribute"), strTemp.c_str());
             }
@@ -3430,6 +3545,11 @@ void MachineConfigFile::readStorageControllers(const xml::ElementNode &elmStorag
             sctl.storageBus = StorageBus_SAS;
             sctl.controllerType = StorageControllerType_LsiLogicSas;
         }
+        else if (strType == "USB")
+        {
+            sctl.storageBus = StorageBus_USB;
+            sctl.controllerType = StorageControllerType_USB;
+        }
         else
             throw ConfigFileError(this, pelmController, N_("Invalid value '%s' for StorageController/@type attribute"), strType.c_str());
 
@@ -3445,6 +3565,7 @@ void MachineConfigFile::readStorageControllers(const xml::ElementNode &elmStorag
 
             att.fDiscard = false;
             att.fNonRotational = false;
+            att.fHotPluggable = false;
 
             if (strTemp == "HardDisk")
             {
@@ -3494,7 +3615,12 @@ void MachineConfigFile::readStorageControllers(const xml::ElementNode &elmStorag
                 if (!pelmAttached->getAttributeValue("device", att.lDevice))
                     throw ConfigFileError(this, pelmImage, N_("Required AttachedDevice/@device attribute is missing"));
 
-                pelmAttached->getAttributeValue("hotpluggable", att.fHotPluggable);
+                /* AHCI controller ports are hotpluggable by default, keep compatibility with existing settings. */
+                if (m->sv >= SettingsVersion_v1_15)
+                    pelmAttached->getAttributeValue("hotpluggable", att.fHotPluggable);
+                else if (sctl.controllerType == StorageControllerType_IntelAhci)
+                    att.fHotPluggable = true;
+
                 pelmAttached->getAttributeValue("bandwidthGroup", att.strBwGroup);
                 sctl.llAttachedDevices.push_back(att);
             }
@@ -3701,7 +3827,7 @@ bool MachineConfigFile::readSnapshot(const Guid &curSnapshotUuid,
                                      Snapshot &snap)
 {
     if (depth > SETTINGS_SNAPSHOT_DEPTH_MAX)
-        throw ConfigFileError(this, &elmSnapshot, N_("Maximum snapshot tree depth of %u exceeded"), depth);
+        throw ConfigFileError(this, &elmSnapshot, N_("Maximum snapshot tree depth of %u exceeded"), SETTINGS_SNAPSHOT_DEPTH_MAX);
 
     Utf8Str strTemp;
 
@@ -3748,15 +3874,12 @@ bool MachineConfigFile::readSnapshot(const Guid &curSnapshotUuid,
             {
                 if (pelmChildSnapshot->nameEquals("Snapshot"))
                 {
-                    // Use the heap to reduce the stack footprint. Each
-                    // recursion needs over 1K, and there can be VMs with
-                    // deeply nested snapshots. The stack can be quite
-                    // small, especially with XPCOM.
-                    Snapshot *child = new Snapshot();
-                    bool found = readSnapshot(curSnapshotUuid, depth + 1, *pelmChildSnapshot, *child);
+                    // recurse with this element and put the child at the
+                    // end of the list. XPCOM has very small stack, avoid
+                    // big local variables and use the list element.
+                    snap.llChildSnapshots.push_back(g_SnapshotEmpty);
+                    bool found = readSnapshot(curSnapshotUuid, depth + 1, *pelmChildSnapshot, snap.llChildSnapshots.back());
                     foundCurrentSnapshot = foundCurrentSnapshot || found;
-                    snap.llChildSnapshots.push_back(*child);
-                    delete child;
                 }
             }
         }
@@ -3976,13 +4099,13 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
     if (m->sv >= SettingsVersion_v1_14 && hw.enmLongMode != Hardware::LongMode_Legacy)
         pelmCPU->createChild("LongMode")->setAttribute("enabled", hw.enmLongMode == Hardware::LongMode_Enabled);
 
-    if (hw.fSyntheticCpu)
-        pelmCPU->createChild("SyntheticCpu")->setAttribute("enabled", hw.fSyntheticCpu);
     if (hw.fTripleFaultReset)
         pelmCPU->createChild("TripleFaultReset")->setAttribute("enabled", hw.fTripleFaultReset);
     pelmCPU->setAttribute("count", hw.cCPUs);
     if (hw.ulCpuExecutionCap != 100)
         pelmCPU->setAttribute("executionCap", hw.ulCpuExecutionCap);
+    if (hw.uCpuIdPortabilityLevel != 0)
+        pelmCPU->setAttribute("CpuIdPortabilityLevel", hw.uCpuIdPortabilityLevel);
 
     /* Always save this setting as we have changed the default in 4.0 (on for large memory 64-bit systems). */
     pelmCPU->createChild("HardwareVirtExLargePages")->setAttribute("enabled", hw.fLargePages);
@@ -4103,6 +4226,26 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
          pelmChipset->setAttribute("type", pcszChipset);
     }
 
+    if (    (m->sv >= SettingsVersion_v1_15)
+        && !hw.areParavirtDefaultSettings()
+       )
+    {
+        const char *pcszParavirtProvider;
+        switch (hw.paravirtProvider)
+        {
+            case ParavirtProvider_None:         pcszParavirtProvider = "None";     break;
+            case ParavirtProvider_Default:      pcszParavirtProvider = "Default";  break;
+            case ParavirtProvider_Legacy:       pcszParavirtProvider = "Legacy";   break;
+            case ParavirtProvider_Minimal:      pcszParavirtProvider = "Minimal";  break;
+            case ParavirtProvider_HyperV:       pcszParavirtProvider = "HyperV";   break;
+            case ParavirtProvider_KVM:          pcszParavirtProvider = "KVM";      break;
+            default:            Assert(false);  pcszParavirtProvider = "None";     break;
+        }
+
+        xml::ElementNode *pelmParavirt = pelmHardware->createChild("Paravirt");
+        pelmParavirt->setAttribute("provider", pcszParavirtProvider);
+    }
+
     xml::ElementNode *pelmBoot = pelmHardware->createChild("Boot");
     for (BootOrderMap::const_iterator it = hw.mapBootOrder.begin();
          it != hw.mapBootOrder.end();
@@ -4157,6 +4300,8 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
         pelmVideoCapture->setAttribute("vertRes",   hw.ulVideoCaptureVertRes);
         pelmVideoCapture->setAttribute("rate",      hw.ulVideoCaptureRate);
         pelmVideoCapture->setAttribute("fps",       hw.ulVideoCaptureFPS);
+        pelmVideoCapture->setAttribute("maxTime",   hw.ulVideoCaptureMaxTime);
+        pelmVideoCapture->setAttribute("maxSize",   hw.ulVideoCaptureMaxSize);
     }
 
     xml::ElementNode *pelmVRDE = pelmHardware->createChild("RemoteDisplay");
@@ -4380,6 +4525,9 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
                 case USBControllerType_EHCI:
                     strType = "EHCI";
                     break;
+                case USBControllerType_XHCI:
+                    strType = "XHCI";
+                    break;
                 default:
                     AssertMsgFailed(("Unknown USB controller type %d\n", ctrl.enmType));
             }
@@ -4505,11 +4653,13 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
         {
             case PortMode_HostPipe: pcszHostMode = "HostPipe"; break;
             case PortMode_HostDevice: pcszHostMode = "HostDevice"; break;
+            case PortMode_TCP: pcszHostMode = "TCP"; break;
             case PortMode_RawFile: pcszHostMode = "RawFile"; break;
             default: /*case PortMode_Disconnected:*/ pcszHostMode = "Disconnected"; break;
         }
         switch (port.portMode)
         {
+            case PortMode_TCP:
             case PortMode_HostPipe:
                 pelmPort->setAttribute("server", port.fServer);
                 /* no break */
@@ -4609,12 +4759,12 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
 
     xml::ElementNode *pelmDragAndDrop = pelmHardware->createChild("DragAndDrop");
     const char *pcszDragAndDrop;
-    switch (hw.dragAndDropMode)
+    switch (hw.dndMode)
     {
-        default: /*case DragAndDropMode_Disabled:*/ pcszDragAndDrop = "Disabled"; break;
-        case DragAndDropMode_HostToGuest: pcszDragAndDrop = "HostToGuest"; break;
-        case DragAndDropMode_GuestToHost: pcszDragAndDrop = "GuestToHost"; break;
-        case DragAndDropMode_Bidirectional: pcszDragAndDrop = "Bidirectional"; break;
+        default: /*case DnDMode_Disabled:*/ pcszDragAndDrop = "Disabled"; break;
+        case DnDMode_HostToGuest: pcszDragAndDrop = "HostToGuest"; break;
+        case DnDMode_GuestToHost: pcszDragAndDrop = "GuestToHost"; break;
+        case DnDMode_Bidirectional: pcszDragAndDrop = "Bidirectional"; break;
     }
     pelmDragAndDrop->setAttribute("mode", pcszDragAndDrop);
 
@@ -4867,6 +5017,7 @@ void MachineConfigFile::buildStorageControllersXML(xml::ElementNode &elmParent,
             case StorageControllerType_ICH6: pcszType = "ICH6"; break;
             case StorageControllerType_I82078: pcszType = "I82078"; break;
             case StorageControllerType_LsiLogicSas: pcszType = "LsiLogicSas"; break;
+            case StorageControllerType_USB: pcszType = "USB"; break;
             default: /*case StorageControllerType_PIIX3:*/ pcszType = "PIIX3"; break;
         }
         pelmController->setAttribute("type", pcszType);
@@ -4933,7 +5084,7 @@ void MachineConfigFile::buildStorageControllersXML(xml::ElementNode &elmParent,
 
             pelmDevice->setAttribute("type", pcszType);
 
-            if (att.fHotPluggable)
+            if (m->sv >= SettingsVersion_v1_15)
                 pelmDevice->setAttribute("hotpluggable", att.fHotPluggable);
 
             pelmDevice->setAttribute("port", att.lPort);
@@ -5057,7 +5208,7 @@ void MachineConfigFile::buildSnapshotXML(uint32_t depth,
 
     pelmSnapshot->setAttribute("uuid", snap.uuid.toStringCurly());
     pelmSnapshot->setAttribute("name", snap.strName);
-    pelmSnapshot->setAttribute("timeStamp", makeString(snap.timestamp));
+    pelmSnapshot->setAttribute("timeStamp", stringifyTimestamp(snap.timestamp));
 
     if (snap.strStateFile.length())
         pelmSnapshot->setAttributePath("stateFile", snap.strStateFile);
@@ -5164,7 +5315,7 @@ void MachineConfigFile::buildMachineXML(xml::ElementNode &elmMachine,
         elmMachine.setAttributePath("snapshotFolder", machineUserData.strSnapshotFolder);
     if (!fCurrentStateModified)
         elmMachine.setAttribute("currentStateModified", fCurrentStateModified);
-    elmMachine.setAttribute("lastStateChange", makeString(timeLastStateChange));
+    elmMachine.setAttribute("lastStateChange", stringifyTimestamp(timeLastStateChange));
     if (fAborted)
         elmMachine.setAttribute("aborted", fAborted);
     // Please keep the icon last so that one doesn't have to check if there
@@ -5348,6 +5499,87 @@ AudioDriverType_T MachineConfigFile::getHostDefaultAudioDriver()
  */
 void MachineConfigFile::bumpSettingsVersionIfNeeded()
 {
+    if (m->sv < SettingsVersion_v1_15)
+    {
+        // VirtualBox 5.0 adds paravirt providers, explicit AHCI port hotplug
+        // setting, USB storage controller, xHCI and serial port TCP backend.
+
+        /*
+         * Check simple configuration bits first, loopy stuff afterwards.
+         */
+        if (   hardwareMachine.paravirtProvider != ParavirtProvider_Legacy
+            || hardwareMachine.uCpuIdPortabilityLevel != 0)
+        {
+            m->sv = SettingsVersion_v1_15;
+            return;
+        }
+
+        /*
+         * Check whether the hotpluggable flag of all storage devices differs
+         * from the default for old settings.
+         * AHCI ports are hotpluggable by default every other device is not.
+         * Also check if there are USB storage controllers.
+         */
+        for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin();
+             it != storageMachine.llStorageControllers.end();
+             ++it)
+        {
+            const StorageController &sctl = *it;
+
+            if (sctl.controllerType == StorageControllerType_USB)
+            {
+                m->sv = SettingsVersion_v1_15;
+                return;
+            }
+
+            for (AttachedDevicesList::const_iterator it2 = sctl.llAttachedDevices.begin();
+                 it2 != sctl.llAttachedDevices.end();
+                 ++it2)
+            {
+                const AttachedDevice &att = *it2;
+
+                if (   (   att.fHotPluggable
+                        && sctl.controllerType != StorageControllerType_IntelAhci)
+                    || (   !att.fHotPluggable
+                        && sctl.controllerType == StorageControllerType_IntelAhci))
+                {
+                    m->sv = SettingsVersion_v1_15;
+                    return;
+                }
+            }
+        }
+
+        /*
+         * Check if there is an xHCI (USB3) USB controller.
+         */
+        for (USBControllerList::const_iterator it = hardwareMachine.usbSettings.llUSBControllers.begin();
+             it != hardwareMachine.usbSettings.llUSBControllers.end();
+             ++it)
+        {
+            const USBController &ctrl = *it;
+            if (ctrl.enmType == USBControllerType_XHCI)
+            {
+                m->sv = SettingsVersion_v1_15;
+                return;
+            }
+        }
+
+        /*
+         * Check if any serial port uses the TCP backend.
+         */
+        for (SerialPortsList::const_iterator it = hardwareMachine.llSerialPorts.begin();
+             it != hardwareMachine.llSerialPorts.end();
+             ++it)
+        {
+            const SerialPort &port = *it;
+            if (port.portMode == PortMode_TCP)
+            {
+                m->sv = SettingsVersion_v1_15;
+                return;
+            }
+        }
+    }
+
     if (m->sv < SettingsVersion_v1_14)
     {
         // VirtualBox 4.3 adds default frontend setting, graphics controller
@@ -5399,7 +5631,8 @@ void MachineConfigFile::bumpSettingsVersionIfNeeded()
                         fNonStdName = true;
                     break;
                 default:
-                    AssertMsgFailed(("Unknown USB controller type %d\n", ctrl.enmType));
+                    /* Anything unknown forces a bump. */
+                    fNonStdName = true;
             }
 
             /* Skip checking other controllers if the settings bump is necessary. */
diff --git a/src/VBox/Main/xml/VirtualBox-settings.xsd b/src/VBox/Main/xml/VirtualBox-settings.xsd
index dc393df..77bab82 100644
--- a/src/VBox/Main/xml/VirtualBox-settings.xsd
+++ b/src/VBox/Main/xml/VirtualBox-settings.xsd
@@ -6,7 +6,7 @@
  *  Oracle VM VirtualBox Settings Schema
  *  Common definitions
 
-    Copyright (C) 2004-2013 Oracle Corporation
+    Copyright (C) 2004-2015 Oracle Corporation
 
     This file is part of VirtualBox Open Source Edition (OSE), as
     available from http://www.virtualbox.org. This file is free software;
@@ -241,6 +241,7 @@
     <xsd:enumeration value="RawFile"/>
     <xsd:enumeration value="HostPipe"/>
     <xsd:enumeration value="HostDevice"/>
+    <xsd:enumeration value="TCP"/>
   </xsd:restriction>
 </xsd:simpleType>
 
diff --git a/src/VBox/Makefile.kmk b/src/VBox/Makefile.kmk
index 7bb7035..6801ee4 100644
--- a/src/VBox/Makefile.kmk
+++ b/src/VBox/Makefile.kmk
@@ -35,9 +35,9 @@ else ifdef VBOX_ONLY_DOCS
 
 else ifdef VBOX_ONLY_EXTPACKS
  include $(PATH_SUB_CURRENT)/Runtime/Makefile.kmk
- include $(PATH_SUB_CURRENT)/Storage/Makefile.kmk
  include $(PATH_SUB_CURRENT)/Devices/Makefile.kmk
  include $(PATH_SUB_CURRENT)/HostDrivers/Makefile.kmk
+ include $(PATH_SUB_CURRENT)/Storage/Makefile.kmk
  include $(PATH_SUB_CURRENT)/ExtPacks/Makefile.kmk
  ifdef VBOX_WITH_VRDP
   include $(PATH_SUB_CURRENT)/RDP/Makefile.kmk
@@ -55,11 +55,12 @@ else ifdef VBOX_ONLY_SDK
  include $(PATH_SUB_CURRENT)/Installer/Makefile.kmk
  include $(PATH_SUB_CURRENT)/Frontends/VBoxShell/Makefile.kmk
 
-else ifdef VBOX_ONLY_TESTSUITE
+else ifdef VBOX_ONLY_VALIDATIONKIT
  include $(PATH_SUB_CURRENT)/Runtime/Makefile.kmk
  include $(PATH_SUB_CURRENT)/HostDrivers/Makefile.kmk
  include $(PATH_SUB_CURRENT)/Additions/Makefile.kmk
- include $(PATH_SUB_CURRENT)/Testsuite/Makefile.kmk
+ include $(PATH_SUB_CURRENT)/Disassembler/Makefile.kmk
+ include $(PATH_SUB_CURRENT)/ValidationKit/Makefile.kmk
 
 else
  ifdef VBOX_WITH_MAIN
@@ -87,11 +88,13 @@ else
  ifdef VBOX_WITH_ADDITIONS
   include $(PATH_SUB_CURRENT)/Additions/Makefile.kmk
  endif
- ifdef VBOX_WITH_TESTSUITE
-  include $(PATH_SUB_CURRENT)/Testsuite/Makefile.kmk
+ ifdef VBOX_WITH_VALIDATIONKIT
+  include $(PATH_SUB_CURRENT)/ValidationKit/Makefile.kmk
  endif
- if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
-  include $(PATH_SUB_CURRENT)/NetworkServices/Makefile.kmk
+ ifdef VBOX_WITH_MAIN
+  if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
+   include $(PATH_SUB_CURRENT)/NetworkServices/Makefile.kmk
+  endif
  endif
  include $(PATH_SUB_CURRENT)/ExtPacks/Makefile.kmk
  ifdef VBOX_WITH_INSTALLER
diff --git a/src/VBox/NetworkServices/DHCP/Config.cpp b/src/VBox/NetworkServices/DHCP/Config.cpp
index 8ffe2e8..2a4f7dc 100644
--- a/src/VBox/NetworkServices/DHCP/Config.cpp
+++ b/src/VBox/NetworkServices/DHCP/Config.cpp
@@ -1050,19 +1050,11 @@ static int parseDhcpOptionText(const char *pszText,
 }
 
 
-/*
- * XXX: Since encoding info is "smuggled" through the API and is not
- * exposed properly we don't have a common definition we can use here.
- *
- * TODO: We can define the encodings enum in the IDL without breaking
- * backward compatibility.  This will provide the authoritative
- * definition.
- */
 static int fillDhcpOption(RawOption &opt, const std::string &OptText, int OptEncoding)
 {
     int rc;
  
-    if (OptEncoding == /* HEX */ 1)
+    if (OptEncoding == DhcpOptEncoding_Hex)
     {
         if (OptText.empty())
             return VERR_INVALID_PARAMETER;
@@ -1071,7 +1063,7 @@ static int fillDhcpOption(RawOption &opt, const std::string &OptText, int OptEnc
         char *pszNext = const_cast<char *>(OptText.c_str());
         while (*pszNext != '\0')
         {
-            if (cbRawOpt == 256)
+            if (cbRawOpt >= RT_ELEMENTS(opt.au8RawOpt))
                 return VERR_INVALID_PARAMETER;
 
             uint8_t u8Byte;
@@ -1089,7 +1081,7 @@ static int fillDhcpOption(RawOption &opt, const std::string &OptText, int OptEnc
         }
         opt.cbRawOpt = (uint8_t)cbRawOpt;
     }
-    else if (OptEncoding == /* LEGACY */ 0)
+    else if (OptEncoding == DhcpOptEncoding_Legacy)
     {
         /*
          * XXX: TODO: encode "known" option opt.u8OptId
@@ -1101,7 +1093,7 @@ static int fillDhcpOption(RawOption &opt, const std::string &OptText, int OptEnc
 }
 
 
-int NetworkManager::processParameterReqList(const Client& client, const uint8_t *pu8ReqList, 
+int NetworkManager::processParameterReqList(const Client& client, const uint8_t *pu8ReqList,
                                             int cReqList, std::vector<RawOption>& extra)
 {
     int rc;
diff --git a/src/VBox/NetworkServices/DHCP/Config.h b/src/VBox/NetworkServices/DHCP/Config.h
index 1278df8..cbba334 100644
--- a/src/VBox/NetworkServices/DHCP/Config.h
+++ b/src/VBox/NetworkServices/DHCP/Config.h
@@ -1,6 +1,18 @@
 /* $Id: Config.h $ */
-/**
- * This file contains declarations of DHCP config.
+/** @file
+ * Config.h
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
 #ifndef _CONFIG_H_
diff --git a/src/VBox/NetworkServices/DHCP/README.customoptions b/src/VBox/NetworkServices/DHCP/README.customoptions
new file mode 100644
index 0000000..c121d31
--- /dev/null
+++ b/src/VBox/NetworkServices/DHCP/README.customoptions
@@ -0,0 +1,23 @@
+To configure custom DHCP options for a VM use the following command adapted
+to your needs:
+
+$ VBoxManage dhcpserver modify \
+    --netname test-0 --options --vm "Test Client" --slot 0 \
+    --id 0 --value "224=c0:a8:02:01:c0:a8:02:02" \
+    --id 0 --value "225=0:0"
+
+Note that custom DHCP options must be specified with ID 0 and the actual
+number in the value. This has technical reasons which may change in future
+VirtualBox releases.
+
+
+It corresponds to the following bit of ISC 'dhcpd.conf':
+
+option sample1 code 224 = array of ip-address;
+option sample2 code 225 = array of integer 8;
+
+...
+    option sample1 192.168.2.1,192.168.2.2;
+    option sample2 0,0;
+...
+
diff --git a/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp b/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
index 4df5069..820ac26 100644
--- a/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
+++ b/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp
@@ -92,6 +92,7 @@ public:
     virtual ~VBoxNetDhcp();
 
     int                 init();
+    void                done();
     void                usage(void) { /* XXX: document options */ };
     int                 parseOpt(int rc, const RTGETOPTUNION& getOptVal);
     int                 processFrame(void *, size_t) {return VERR_IGNORED; };
@@ -100,10 +101,6 @@ public:
 
 protected:
     bool                handleDhcpMsg(uint8_t uMsgType, PCRTNETBOOTP pDhcpMsg, size_t cb);
-    bool                handleDhcpReqDiscover(PCRTNETBOOTP pDhcpMsg, size_t cb);
-    bool                handleDhcpReqRequest(PCRTNETBOOTP pDhcpMsg, size_t cb);
-    bool                handleDhcpReqDecline(PCRTNETBOOTP pDhcpMsg, size_t cb);
-    bool                handleDhcpReqRelease(PCRTNETBOOTP pDhcpMsg, size_t cb);
 
     void                debugPrintV(int32_t iMinLevel, bool fMsg,  const char *pszFmt, va_list va) const;
     static const char  *debugDhcpName(uint8_t uMsgType);
@@ -132,7 +129,8 @@ protected:
     ComPtr<INATNetwork> m_NATNetwork;
 
     /** Listener for Host DNS changes */
-    ComPtr<NATNetworkListenerImpl> m_vboxListener;
+    ComNatListenerPtr m_VBoxListener;
+    ComNatListenerPtr m_VBoxClientListener;
 
     NetworkManager *m_NetworkManager;
 
@@ -306,6 +304,11 @@ int VBoxNetDhcp::init()
     return VINF_SUCCESS;
 }
 
+void VBoxNetDhcp::done()
+{
+    destroyNatListener(m_VBoxListener, virtualbox);
+    destroyClientListener(m_VBoxClientListener, virtualboxClient);
+}
 
 int  VBoxNetDhcp::processUDP(void *pv, size_t cbPv)
 {
@@ -520,11 +523,20 @@ int VBoxNetDhcp::initWithMain()
     rc = fetchAndUpdateDnsInfo();
     AssertMsgRCReturn(rc, ("Wasn't able to fetch Dns info"), rc);
 
-    ComEventTypeArray aVBoxEvents;
-    aVBoxEvents.push_back(VBoxEventType_OnHostNameResolutionConfigurationChange);
-    aVBoxEvents.push_back(VBoxEventType_OnNATNetworkStartStop);
-    rc = createNatListener(m_vboxListener, virtualbox, this, aVBoxEvents);
-    AssertRCReturn(rc, rc);
+    {
+        ComEventTypeArray eventTypes;
+        eventTypes.push_back(VBoxEventType_OnHostNameResolutionConfigurationChange);
+        eventTypes.push_back(VBoxEventType_OnNATNetworkStartStop);
+        rc = createNatListener(m_VBoxListener, virtualbox, this, eventTypes);
+        AssertRCReturn(rc, rc);
+    }
+
+    {
+        ComEventTypeArray eventTypes;
+        eventTypes.push_back(VBoxEventType_OnVBoxSVCAvailabilityChanged);
+        rc = createClientListener(m_VBoxClientListener, virtualboxClient, this, eventTypes);
+        AssertRCReturn(rc, rc);
+    }
 
     RTNETADDRIPV4 LowerAddress;
     rc = configGetBoundryAddress(m_DhcpServer, false, LowerAddress);
@@ -592,7 +604,6 @@ int VBoxNetDhcp::fetchAndUpdateDnsInfo()
     return VINF_SUCCESS;
 }
 
-
 HRESULT VBoxNetDhcp::HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent)
 {
     switch(aEventType)
@@ -618,6 +629,12 @@ HRESULT VBoxNetDhcp::HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent)
                 shutdown();
             break;
         }
+
+        case VBoxEventType_OnVBoxSVCAvailabilityChanged:
+        {
+            shutdown();
+            break;
+        }
     }
 
     return S_OK;
@@ -659,6 +676,8 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv)
      */
     g_pDhcp = pDhcp;
     rc = pDhcp->run();
+    pDhcp->done();
+
     g_pDhcp = NULL;
     delete pDhcp;
 
diff --git a/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.rc b/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.rc
index c7bf1b7..f282f79 100644
--- a/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.rc
+++ b/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.rc
@@ -21,12 +21,12 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
@@ -35,12 +35,13 @@ BEGIN
     BEGIN
       VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox DHCP Server\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
       VALUE "InternalName",     "VBoxNetDHCP\0"
       VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxNetDHCP.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp b/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
index f2f4686..16d3a2e 100644
--- a/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
+++ b/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
@@ -16,6 +16,8 @@
  */
 
 /* Must be included before winutils.h (lwip/def.h), otherwise Windows build breaks. */
+#define LOG_GROUP LOG_GROUP_NAT_SERVICE
+
 #include <iprt/cpp/mem.h>
 
 #include "winutils.h"
@@ -52,7 +54,6 @@
 #include <iprt/file.h>
 #include <iprt/semaphore.h>
 #include <iprt/cpp/utils.h>
-#define LOG_GROUP LOG_GROUP_NAT_SERVICE
 #include <VBox/log.h>
 
 #include <VBox/sup.h>
@@ -166,10 +167,11 @@ class VBoxNetLwipNAT: public VBoxNetBaseService, public NATNetworkEventAdapter
 
     /* Our NAT network descriptor in Main */
     ComPtr<INATNetwork> m_net;
-    ComNatListenerPtr m_listener;
-
     ComPtr<IHost> m_host;
-    ComNatListenerPtr m_vboxListener;
+
+    ComNatListenerPtr m_NatListener;
+    ComNatListenerPtr m_VBoxListener;
+    ComNatListenerPtr m_VBoxClientListener;
     static INTNETSEG aXmitSeg[64];
 
     HRESULT HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent);
@@ -412,6 +414,13 @@ HRESULT VBoxNetLwipNAT::HandleEvent(VBoxEventType_T aEventType, IEvent *pEvent)
                 shutdown();
             break;
         }
+
+        case VBoxEventType_OnVBoxSVCAvailabilityChanged:
+        {
+            LogRel(("VBoxSVC became unavailable, exiting.\n"));
+            shutdown();
+            break;
+        }
     }
     return hrc;
 }
@@ -793,11 +802,13 @@ int VBoxNetLwipNAT::init()
     rc = findNatNetwork(virtualbox, networkName, m_net);
     AssertRCReturn(rc, rc);
 
-    ComEventTypeArray aNetEvents;
-    aNetEvents.push_back(VBoxEventType_OnNATNetworkPortForward);
-    aNetEvents.push_back(VBoxEventType_OnNATNetworkSetting);
-    rc = createNatListener(m_listener, virtualbox, this, aNetEvents);
-    AssertRCReturn(rc, rc);
+    {
+        ComEventTypeArray eventTypes;
+        eventTypes.push_back(VBoxEventType_OnNATNetworkPortForward);
+        eventTypes.push_back(VBoxEventType_OnNATNetworkSetting);
+        rc = createNatListener(m_NatListener, virtualbox, this, eventTypes);
+        AssertRCReturn(rc, rc);
+    }
 
 
     // resolver changes are reported on vbox but are retrieved from
@@ -805,11 +816,20 @@ int VBoxNetLwipNAT::init()
     HRESULT hrc = virtualbox->COMGETTER(Host)(m_host.asOutParam());
     AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
 
-    ComEventTypeArray aVBoxEvents;
-    aVBoxEvents.push_back(VBoxEventType_OnHostNameResolutionConfigurationChange);
-    aVBoxEvents.push_back(VBoxEventType_OnNATNetworkStartStop);
-    rc = createNatListener(m_vboxListener, virtualbox, this, aVBoxEvents);
-    AssertRCReturn(rc, rc);
+    {
+        ComEventTypeArray eventTypes;
+        eventTypes.push_back(VBoxEventType_OnHostNameResolutionConfigurationChange);
+        eventTypes.push_back(VBoxEventType_OnNATNetworkStartStop);
+        rc = createNatListener(m_VBoxListener, virtualbox, this, eventTypes);
+        AssertRCReturn(rc, rc);
+    }
+
+    {
+        ComEventTypeArray eventTypes;
+        eventTypes.push_back(VBoxEventType_OnVBoxSVCAvailabilityChanged);
+        rc = createClientListener(m_VBoxClientListener, virtualboxClient, this, eventTypes);
+        AssertRCReturn(rc, rc);
+    }
 
     BOOL fIPv6Enabled = FALSE;
     hrc = m_net->COMGETTER(IPv6Enabled)(&fIPv6Enabled);
@@ -1043,6 +1063,10 @@ int VBoxNetLwipNAT::run()
     m_vecPortForwardRule4.clear();
     m_vecPortForwardRule6.clear();
 
+    destroyNatListener(m_NatListener, virtualbox);
+    destroyNatListener(m_VBoxListener, virtualbox);
+    destroyClientListener(m_VBoxClientListener, virtualboxClient);
+
     return VINF_SUCCESS;
 }
 
@@ -1355,10 +1379,9 @@ static DWORD WINAPI MsgThreadProc(__in  LPVOID lpParameter)
      if (atomWindowClass != 0)
      {
          /* Create the window. */
-         hwnd = CreateWindowEx (WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
-                 g_WndClassName, g_WndClassName,
-                                                   WS_POPUPWINDOW,
-                                                  -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
+         hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST,
+                               g_WndClassName, g_WndClassName, WS_POPUPWINDOW,
+                               -200, -200, 100, 100, NULL, NULL, hInstance, NULL);
 
          if (hwnd)
          {
diff --git a/src/VBox/NetworkServices/NAT/VBoxNetNAT.rc b/src/VBox/NetworkServices/NAT/VBoxNetNAT.rc
index 6f11618..db80698 100644
--- a/src/VBox/NetworkServices/NAT/VBoxNetNAT.rc
+++ b/src/VBox/NetworkServices/NAT/VBoxNetNAT.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox NAT Engine\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "VBoxNetNAT\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxNetNAT.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/NetworkServices/NAT/lwipopts.h b/src/VBox/NetworkServices/NAT/lwipopts.h
index 37375cc..45d170c 100644
--- a/src/VBox/NetworkServices/NAT/lwipopts.h
+++ b/src/VBox/NetworkServices/NAT/lwipopts.h
@@ -120,7 +120,7 @@
 
 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool.
    Use default that is based on TCP_MSS and PBUF_LINK_HLEN.  */
-#undef PBUF_POOL_BUFSIZE  
+#undef PBUF_POOL_BUFSIZE
 
 /** Turn on support for lightweight critical region protection. Leaving this
  * off uses synchronization code in pbuf.c which is totally polluted with
@@ -148,17 +148,17 @@
 
 #define LWIP_ND6_ALLOW_RA_UPDATES       (!LWIP_IPV6_FORWARD)
 #define LWIP_IPV6_SEND_ROUTER_SOLICIT   (!LWIP_IPV6_FORWARD)
-/* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases 
+/* IPv6 autoconfig we don't need in proxy, but it required for very seldom cases
  * iSCSI over intnet with IPv6
  */
-#define LWIP_IPV6_AUTOCONFIG            1 
+#define LWIP_IPV6_AUTOCONFIG            1
 #if LWIP_IPV6_FORWARD /* otherwise use the default from lwip/opt.h */
 #define LWIP_IPV6_DUP_DETECT_ATTEMPTS   0
 #endif
 
 #define LWIP_IPV6_FRAG                  1
 
-/** 
+/**
  * aka Slirp mode.
  */
 #define LWIP_CONNECTION_PROXY 1
diff --git a/src/VBox/NetworkServices/NAT/portfwd.c b/src/VBox/NetworkServices/NAT/portfwd.c
index e465fab..a81a715 100644
--- a/src/VBox/NetworkServices/NAT/portfwd.c
+++ b/src/VBox/NetworkServices/NAT/portfwd.c
@@ -188,11 +188,11 @@ fwspec_set(struct fwspec *fwspec, int sdom, int stype,
 
     if (sdom == PF_INET) {
         fwspec->src.sin.sin_port = htons(src_port);
-        fwspec->dst.sin.sin_port = htons(dst_port); 
+        fwspec->dst.sin.sin_port = htons(dst_port);
     }
     else { /* PF_INET6 */
         fwspec->src.sin6.sin6_port = htons(src_port);
-        fwspec->dst.sin6.sin6_port = htons(dst_port); 
+        fwspec->dst.sin6.sin6_port = htons(dst_port);
     }
 
     return 0;
diff --git a/src/VBox/NetworkServices/NAT/proxy.c b/src/VBox/NetworkServices/NAT/proxy.c
index da671f6..e15b632 100644
--- a/src/VBox/NetworkServices/NAT/proxy.c
+++ b/src/VBox/NetworkServices/NAT/proxy.c
@@ -317,7 +317,17 @@ proxy_create_socket(int sdom, int stype)
         return INVALID_SOCKET;
     }
 
-#if !defined(SOCK_NONBLOCK) && !defined(RT_OS_WINDOWS)
+#if defined(RT_OS_WINDOWS)
+    {
+        u_long mode = 1;
+        status = ioctlsocket(s, FIONBIO, &mode);
+        if (status == SOCKET_ERROR) {
+            DPRINTF(("FIONBIO: %R[sockerr]\n", SOCKERRNO()));
+            closesocket(s);
+            return INVALID_SOCKET;
+        }
+    }
+#elif !defined(SOCK_NONBLOCK)
     {
         int sflags;
 
@@ -352,13 +362,32 @@ proxy_create_socket(int sdom, int stype)
 #endif
 
 #if defined(RT_OS_WINDOWS)
-    {
-        u_long mode = 1;
-        status = ioctlsocket(s, FIONBIO, &mode);
-        if (status == SOCKET_ERROR) {
-            DPRINTF(("FIONBIO: %R[sockerr]\n", SOCKERRNO()));
-            closesocket(s);
-            return INVALID_SOCKET;
+    /*
+     * lwIP only holds one packet of "refused data" for us.  Proxy
+     * relies on OS socket send buffer and doesn't do its own
+     * buffering.  Unfortunately on Windows send buffer is very small
+     * (8K by default) and is not dynamically adpated by the OS it
+     * seems.  So a single large write will fill it up and that will
+     * make lwIP drop segments, causing guest TCP into pathologic
+     * resend patterns.  As a quick and dirty fix just bump it up.
+     */
+    if (stype == SOCK_STREAM) {
+        int sndbuf;
+        socklen_t optlen = sizeof(sndbuf);
+
+        status = getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&sndbuf, &optlen);
+        if (status == 0) {
+            if (sndbuf < 64 * 1024) {
+                sndbuf = 64 * 1024;
+                status = setsockopt(s, SOL_SOCKET, SO_SNDBUF,
+                                    (char *)&sndbuf, optlen);
+                if (status != 0) {
+                    DPRINTF(("SO_SNDBUF: setsockopt: %R[sockerr]\n", SOCKERRNO()));
+                }
+            }
+        }
+        else {
+            DPRINTF(("SO_SNDBUF: getsockopt: %R[sockerr]\n", SOCKERRNO()));
         }
     }
 #endif
@@ -545,7 +574,7 @@ proxy_reset_socket(SOCKET s)
      * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4468997
      */
     setsockopt(s, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof(linger));
-    
+
     closesocket(s);
 }
 
diff --git a/src/VBox/NetworkServices/NAT/pxdns.c b/src/VBox/NetworkServices/NAT/pxdns.c
index e6c7619..dd56bf2 100644
--- a/src/VBox/NetworkServices/NAT/pxdns.c
+++ b/src/VBox/NetworkServices/NAT/pxdns.c
@@ -696,7 +696,7 @@ pxdns_forward_outbound(struct pxdns *pxdns, struct request *req)
     if (resolver->sa.sa_family == AF_INET) {
         nsent = sendto(pxdns->sock4, req->data, req->size, 0,
                        &resolver->sa, sizeof(resolver->sin));
-        
+
     }
     else if (resolver->sa.sa_family == AF_INET6) {
         if (pxdns->sock6 != INVALID_SOCKET) {
diff --git a/src/VBox/NetworkServices/NAT/pxping.c b/src/VBox/NetworkServices/NAT/pxping.c
index 97f082a..563b2e5 100644
--- a/src/VBox/NetworkServices/NAT/pxping.c
+++ b/src/VBox/NetworkServices/NAT/pxping.c
@@ -811,7 +811,7 @@ pxping_pcb_rtstrfmt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
                               " (%RTnaipv4)", pcb->peer.sin.sin_addr.s_addr);
         }
     }
-                      
+
     cb += RTStrFormat(pfnOutput, pvArgOutput, NULL, NULL,
                       " id %04x->%04x", ntohs(pcb->guest_id), ntohs(pcb->host_id));
 
diff --git a/src/VBox/NetworkServices/NAT/pxping_win.c b/src/VBox/NetworkServices/NAT/pxping_win.c
index f5427ec..82402fb 100644
--- a/src/VBox/NetworkServices/NAT/pxping_win.c
+++ b/src/VBox/NetworkServices/NAT/pxping_win.c
@@ -207,8 +207,14 @@ pxping_recv4(void *arg, struct pbuf *p)
         goto out;
     }
 
-    bufsize = sizeof(ICMP_ECHO_REPLY) + p->tot_len;
-    pong = (struct pong4 *)malloc(sizeof(*pong) - sizeof(pong->buf) + bufsize);
+    bufsize = sizeof(ICMP_ECHO_REPLY);
+    if (p->tot_len < sizeof(IO_STATUS_BLOCK) + sizeof(struct icmp_echo_hdr))
+        bufsize += sizeof(IO_STATUS_BLOCK) + sizeof(struct icmp_echo_hdr);
+    else
+        bufsize += p->tot_len;
+    bufsize += 16; /* whatever that is; empirically at least XP needs it */
+
+    pong = (struct pong4 *)malloc(RT_OFFSETOF(struct pong4, buf) + bufsize);
     if (RT_UNLIKELY(pong == NULL)) {
         goto out;
     }
@@ -484,8 +490,15 @@ pxping_recv6(void *arg, struct pbuf *p)
         goto out;
     }
 
-    bufsize = sizeof(ICMPV6_ECHO_REPLY) + p->tot_len;
-    pong = (struct pong6 *)malloc(sizeof(*pong) - sizeof(pong->buf) + bufsize);
+    /* XXX: parrotted from IPv4 version, not tested all os version/bitness */
+    bufsize = sizeof(ICMPV6_ECHO_REPLY);
+    if (p->tot_len < sizeof(IO_STATUS_BLOCK) + sizeof(struct icmp6_echo_hdr))
+        bufsize += sizeof(IO_STATUS_BLOCK) + sizeof(struct icmp6_echo_hdr);
+    else
+        bufsize += p->tot_len;
+    bufsize += 16;
+
+    pong = (struct pong6 *)malloc(RT_OFFSETOF(struct pong6, buf) + bufsize);
     if (RT_UNLIKELY(pong == NULL)) {
         goto out;
     }
@@ -549,7 +562,7 @@ pxping_recv6(void *arg, struct pbuf *p)
         }
         goto out;
     }
-    
+
     pong = NULL;                /* callback owns it now */
   out:
     if (pong != NULL) {
diff --git a/src/VBox/NetworkServices/NAT/pxtcp.c b/src/VBox/NetworkServices/NAT/pxtcp.c
index 065b654..715726b 100644
--- a/src/VBox/NetworkServices/NAT/pxtcp.c
+++ b/src/VBox/NetworkServices/NAT/pxtcp.c
@@ -1104,32 +1104,64 @@ pxtcp_pmgr_connect(struct pollmgr_handler *handler, SOCKET fd, int revents)
     pxtcp = (struct pxtcp *)handler->data;
     LWIP_ASSERT1(handler == &pxtcp->pmhdl);
     LWIP_ASSERT1(fd == pxtcp->sock);
+    LWIP_ASSERT1(pxtcp->sockerr == 0);
 
-    if (revents & (POLLNVAL | POLLHUP | POLLERR)) {
-        if (revents & POLLNVAL) {
-            pxtcp->sock = INVALID_SOCKET;
+    if (revents & POLLNVAL) {
+        pxtcp->sock = INVALID_SOCKET;
+        pxtcp->sockerr = ETIMEDOUT;
+        return pxtcp_schedule_reject(pxtcp);
+    }
+
+    /*
+     * Solaris and NetBSD don't report either POLLERR or POLLHUP when
+     * connect(2) fails, just POLLOUT.  In that case we always need to
+     * check SO_ERROR.
+     */
+#if defined(RT_OS_SOLARIS) || defined(RT_OS_NETBSD)
+# define CONNECT_CHECK_ERROR POLLOUT
+#else
+# define CONNECT_CHECK_ERROR (POLLERR | POLLHUP)
+#endif
+
+    /*
+     * Check the cause of the failure so that pxtcp_pcb_reject() may
+     * behave accordingly.
+     */
+    if (revents & CONNECT_CHECK_ERROR) {
+        socklen_t optlen = (socklen_t)sizeof(pxtcp->sockerr);
+        int status;
+        SOCKET s;
+
+        status = getsockopt(pxtcp->sock, SOL_SOCKET, SO_ERROR,
+                            (char *)&pxtcp->sockerr, &optlen);
+        if (RT_UNLIKELY(status == SOCKET_ERROR)) { /* should not happen */
+            DPRINTF(("%s: sock %d: SO_ERROR failed: %R[sockerr]\n",
+                     __func__, fd, SOCKERRNO()));
             pxtcp->sockerr = ETIMEDOUT;
         }
         else {
-            socklen_t optlen = (socklen_t)sizeof(pxtcp->sockerr);
-            int status;
-            SOCKET s;
-
-            status = getsockopt(pxtcp->sock, SOL_SOCKET, SO_ERROR,
-                                (char *)&pxtcp->sockerr, &optlen);
-            if (status == SOCKET_ERROR) { /* should not happen */
-                DPRINTF(("%s: sock %d: SO_ERROR failed: %R[sockerr]\n",
-                         __func__, fd, SOCKERRNO()));
-            }
-            else {
+            /* don't spam this log on successful connect(2) */
+            if ((revents & (POLLERR | POLLHUP)) /* we were told it's failed */
+                || pxtcp->sockerr != 0)         /* we determined it's failed */
+            {
                 DPRINTF(("%s: sock %d: connect: %R[sockerr]\n",
                          __func__, fd, pxtcp->sockerr));
             }
+
+            if ((revents & (POLLERR | POLLHUP))
+                && RT_UNLIKELY(pxtcp->sockerr == 0))
+            {
+                /* if we're told it's failed, make sure it's marked as such */
+                pxtcp->sockerr = ETIMEDOUT;
+            }
+        }
+
+        if (pxtcp->sockerr != 0) {
             s = pxtcp->sock;
             pxtcp->sock = INVALID_SOCKET;
             closesocket(s);
+            return pxtcp_schedule_reject(pxtcp);
         }
-        return pxtcp_schedule_reject(pxtcp);
     }
 
     if (revents & POLLOUT) { /* connect is successful */
@@ -1704,7 +1736,7 @@ pxtcp_pmgr_pump(struct pollmgr_handler *handler, SOCKET fd, int revents)
          * Remote closed inbound.
          */
         if (!pxtcp->outbound_close_done) {
-            /* 
+            /*
              * We might still need to poll for POLLOUT, but we can not
              * poll for POLLIN anymore (even if not all data are read)
              * because we will be spammed by POLLHUP.
diff --git a/src/VBox/NetworkServices/NAT/winutils.h b/src/VBox/NetworkServices/NAT/winutils.h
index 2d14ed6..c738375 100644
--- a/src/VBox/NetworkServices/NAT/winutils.h
+++ b/src/VBox/NetworkServices/NAT/winutils.h
@@ -191,15 +191,15 @@ proxy_error_is_transient(int error)
 # if !defined(RT_OS_WINDOWS)
     return error == EWOULDBLOCK
 #  if EAGAIN != EWOULDBLOCK
-	|| error == EAGAIN
+        || error == EAGAIN
 #  endif
-	|| error == EINTR
-	|| error == ENOBUFS
-	|| error == ENOMEM;
+        || error == EINTR
+        || error == ENOBUFS
+        || error == ENOMEM;
 # else
     return error == WSAEWOULDBLOCK
-	|| error == WSAEINTR	/* NB: we don't redefine EINTR above */
-	|| error == WSAENOBUFS;
+        || error == WSAEINTR    /* NB: we don't redefine EINTR above */
+        || error == WSAENOBUFS;
 # endif
 }
 
diff --git a/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp b/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp
index 5b455fd..0c1f853 100644
--- a/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp
+++ b/src/VBox/NetworkServices/NetLib/ComHostUtils.cpp
@@ -213,3 +213,59 @@ int createNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxp
 
     return VINF_SUCCESS;
 }
+
+int destroyNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr)
+{
+    if (listener)
+    {
+        ComPtr<IEventSource> esVBox;
+        HRESULT hrc = vboxptr->COMGETTER(EventSource)(esVBox.asOutParam());
+        AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+        if (!esVBox.isNull())
+        {
+            hrc = esVBox->UnregisterListener(listener);
+            AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+        }
+        listener.setNull();
+    }
+    return VINF_SUCCESS;
+}
+
+int createClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr,
+                         NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events)
+{
+    ComObjPtr<NATNetworkListenerImpl> obj;
+    HRESULT hrc = obj.createObject();
+    AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+
+    hrc = obj->init(new NATNetworkListener(), adapter);
+    AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+
+    ComPtr<IEventSource> esVBox;
+    hrc = vboxclientptr->COMGETTER(EventSource)(esVBox.asOutParam());
+    AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+
+    listener = obj;
+
+    hrc = esVBox->RegisterListener(listener, ComSafeArrayAsInParam(events), true);
+    AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+
+    return VINF_SUCCESS;
+}
+
+int destroyClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr)
+{
+    if (listener)
+    {
+        ComPtr<IEventSource> esVBox;
+        HRESULT hrc = vboxclientptr->COMGETTER(EventSource)(esVBox.asOutParam());
+        AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+        if (!esVBox.isNull())
+        {
+            hrc = esVBox->UnregisterListener(listener);
+            AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+        }
+        listener.setNull();
+    }
+    return VINF_SUCCESS;
+}
diff --git a/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp b/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp
index aecc6eb..95022b2 100644
--- a/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp
+++ b/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp
@@ -1,11 +1,10 @@
 /* $Id: VBoxNetBaseService.cpp $ */
 /** @file
- * VBoxNetDHCP - DHCP Service for connecting to IntNet.
+ * VBoxNetBaseService - common services for VBoxNetDHCP and VBoxNetNAT.
  */
-/** @todo r=bird: Cut&Past rules... Please fix DHCP refs! */
 
 /*
- * Copyright (C) 2009-2011 Oracle Corporation
+ * Copyright (C) 2009-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -171,7 +170,7 @@ VBoxNetBaseService::~VBoxNetBaseService()
     /*
      * Close the interface connection.
      */
-    if (m != NULL)
+    if (m)
     {
         shutdown();
         if (m->m_hIf != INTNET_HANDLE_INVALID)
@@ -207,7 +206,10 @@ int VBoxNetBaseService::init()
         HRESULT hrc = com::Initialize();
         AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
 
-        hrc = virtualbox.createLocalObject(CLSID_VirtualBox);
+        hrc = virtualboxClient.createInprocObject(CLSID_VirtualBoxClient);
+        AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
+
+        hrc = virtualboxClient->COMGETTER(VirtualBox)(virtualbox.asOutParam());
         AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
     }
 
@@ -224,16 +226,15 @@ bool VBoxNetBaseService::isMainNeeded() const
 int VBoxNetBaseService::run()
 {
     /**
-     * If child class need Main we start receving thread which calls doReceiveLoop and enter to event polling loop
-     * and for the rest clients we do receiving on the current (main) thread.
+     * If the child class needs Main we start the receving thread which calls
+     * doReceiveLoop and enter to event polling loop. For other clients we do
+     * receiving on the current (main) thread.
      */
     if (isMainNeeded())
         return startReceiveThreadAndEnterEventLoop();
-    else
-    {
-        doReceiveLoop();
-        return VINF_SUCCESS;
-    }
+
+    doReceiveLoop();
+    return VINF_SUCCESS;
 }
 
 /**
@@ -337,6 +338,7 @@ int VBoxNetBaseService::parseArgs(int argc, char **argv)
                 return 1;
 
             default:
+            {
                 int rc1 = parseOpt(rc, Val);
                 if (RT_FAILURE(rc1))
                 {
@@ -344,6 +346,8 @@ int VBoxNetBaseService::parseArgs(int argc, char **argv)
                     RTPrintf("Use --help for more information.\n");
                     return rc;
                 }
+                break;
+            }
         }
     }
 
@@ -448,6 +452,7 @@ int VBoxNetBaseService::tryGoOnline(void)
     /* bail out */
     Log2(("VBoxNetBaseService: SUPR3CallVMMR0Ex(,VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE,) failed, rc=%Rrc\n", rc));
 
+    /* ignore this error */
     return VINF_SUCCESS;
 }
 
@@ -455,15 +460,14 @@ int VBoxNetBaseService::tryGoOnline(void)
 void VBoxNetBaseService::shutdown(void)
 {
     syncEnter();
-    if (! m->fShutdown)
+    if (!m->fShutdown)
     {
         m->fShutdown = true;
         if (m->m_hThrRecv != NIL_RTTHREAD)
         {
             int rc = abortWait();
-            Assert(rc == VINF_SUCCESS || rc == VERR_SEM_DESTROYED);
+            AssertRC(rc == VINF_SUCCESS || rc == VERR_SEM_DESTROYED);
             rc = m->m_EventQ->interruptEventQueueProcessing();
-#if 0 /* this will not work as long as we don't set RTTHREADFLAGS_WAITABLE */
             if (RT_SUCCESS(rc))
             {
                 rc = RTThreadWait(m->m_hThrRecv, 60000, NULL);
@@ -475,7 +479,6 @@ void VBoxNetBaseService::shutdown(void)
                 AssertMsgFailed(("interruptEventQueueProcessing() failed\n"));
                 RTThreadWait(m->m_hThrRecv , 0, NULL);
             }
-#endif
         }
     }
     syncLeave();
@@ -564,7 +567,6 @@ void VBoxNetBaseService::flushWire()
     int rc = SUPR3CallVMMR0Ex(NIL_RTR0PTR, NIL_VMCPUID, VMMR0_DO_INTNET_IF_SEND, 0, &SendReq.Hdr);
     AssertRCReturnVoid(rc);
     LogFlowFuncLeave();
-
 }
 
 
@@ -691,10 +693,10 @@ void VBoxNetBaseService::doReceiveLoop()
         /*
          * Wait for a packet to become available.
          */
-        /* 2. waiting for request for */
         rc = waitForIntNetEvent(2000);
         if (rc == VERR_SEM_DESTROYED)
             break;
+
         if (RT_FAILURE(rc))
         {
             if (rc == VERR_TIMEOUT || rc == VERR_INTERRUPTED)
@@ -702,7 +704,7 @@ void VBoxNetBaseService::doReceiveLoop()
                 /* do we want interrupt anyone ??? */
                 continue;
             }
-            LogRel(("VBoxNetNAT: waitForIntNetEvent returned %Rrc\n", rc));
+            LogRel(("VBoxNetBaseService: waitForIntNetEvent returned %Rrc\n", rc));
             AssertRCReturnVoid(rc);
         }
 
@@ -710,50 +712,50 @@ void VBoxNetBaseService::doReceiveLoop()
          * Process the receive buffer.
          */
         PCINTNETHDR pHdr;
-
         while ((pHdr = IntNetRingGetNextFrameToRead(pRingBuf)) != NULL)
         {
             uint8_t const u8Type = pHdr->u8Type;
-            size_t         cbFrame = pHdr->cbFrame;
+            size_t        cbFrame = pHdr->cbFrame;
             switch (u8Type)
             {
-
                 case INTNETHDR_TYPE_FRAME:
+                {
+                    void *pvFrame = IntNetHdrGetFramePtr(pHdr, m->m_pIfBuf);
+                    rc = processFrame(pvFrame, cbFrame);
+                    if (RT_FAILURE(rc) && rc == VERR_IGNORED)
                     {
-                        void *pvFrame = IntNetHdrGetFramePtr(pHdr, m->m_pIfBuf);
-                        rc = processFrame(pvFrame, cbFrame);
-                        if (RT_FAILURE(rc) && rc == VERR_IGNORED)
-                        {
-                            /* XXX: UDP + ARP for DHCP */
-                            VBOXNETUDPHDRS Hdrs;
-                            size_t  cb;
-                            void   *pv = VBoxNetUDPMatch(m->m_pIfBuf, RTNETIPV4_PORT_BOOTPS, &m->m_MacAddress,
-                                                         VBOXNETUDP_MATCH_UNICAST | VBOXNETUDP_MATCH_BROADCAST
-                                                         | VBOXNETUDP_MATCH_CHECKSUM
-                                                         | (m->m_cVerbosity > 2 ? VBOXNETUDP_MATCH_PRINT_STDERR : 0),
-                                                         &Hdrs, &cb);
-                            if (pv && cb)
-                                processUDP(pv, cb);
-                            else
-                                VBoxNetArpHandleIt(m->m_pSession, m->m_hIf, m->m_pIfBuf, &m->m_MacAddress, m->m_Ipv4Address);
-                        }
+                        /* XXX: UDP + ARP for DHCP */
+                        VBOXNETUDPHDRS Hdrs;
+                        size_t  cb;
+                        void   *pv = VBoxNetUDPMatch(m->m_pIfBuf, RTNETIPV4_PORT_BOOTPS, &m->m_MacAddress,
+                                                       VBOXNETUDP_MATCH_UNICAST
+                                                     | VBOXNETUDP_MATCH_BROADCAST
+                                                     | VBOXNETUDP_MATCH_CHECKSUM
+                                                     | (m->m_cVerbosity > 2 ? VBOXNETUDP_MATCH_PRINT_STDERR : 0),
+                                                     &Hdrs, &cb);
+                        if (pv && cb)
+                            processUDP(pv, cb);
+                        else
+                            VBoxNetArpHandleIt(m->m_pSession, m->m_hIf, m->m_pIfBuf, &m->m_MacAddress, m->m_Ipv4Address);
                     }
                     break;
+                }
                 case INTNETHDR_TYPE_GSO:
-                  {
-                      PCPDMNETWORKGSO pGso = IntNetHdrGetGsoContext(pHdr, m->m_pIfBuf);
-                      rc = processGSO(pGso, cbFrame);
-                      if (RT_FAILURE(rc) && rc == VERR_IGNORED)
-                          break;
-                  }
-                  break;
+                {
+                    PCPDMNETWORKGSO pGso = IntNetHdrGetGsoContext(pHdr, m->m_pIfBuf);
+                    rc = processGSO(pGso, cbFrame);
+                    if (RT_FAILURE(rc) && rc == VERR_IGNORED)
+                        break;
+                    break;
+                }
+
                 case INTNETHDR_TYPE_PADDING:
                     break;
+
                 default:
                     break;
             }
             IntNetRingSkipFrame(&m->m_pIfBuf->Recv);
-
         } /* loop */
     }
 }
@@ -769,7 +771,7 @@ int VBoxNetBaseService::startReceiveThreadAndEnterEventLoop()
                             this, /* user data */
                             128 * _1K, /* stack size */
                             RTTHREADTYPE_IO, /* type */
-                            0, /* flags, @todo: waitable ?*/
+                            RTTHREADFLAGS_WAITABLE, /* flags */
                             "RECV");
     AssertRCReturn(rc, rc);
 
@@ -823,7 +825,6 @@ void VBoxNetBaseService::debugPrintV(int iMinLevel, bool fMsg, const char *pszFm
                      &vaCopy);
         va_end(vaCopy);
     }
-
 }
 
 
diff --git a/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h b/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h
index f636921..aaca08d 100644
--- a/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h
+++ b/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h
@@ -132,6 +132,7 @@ protected:
     protected:
     /* VirtualBox instance */
     ComPtr<IVirtualBox> virtualbox;
+    ComPtr<IVirtualBoxClient> virtualboxClient;
 
     private:
     struct Data;
diff --git a/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp b/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp
index ad180df..12ff0e4 100644
--- a/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp
+++ b/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp
@@ -245,8 +245,7 @@ int netPfStrToPf(const char *pcszStrPortForward, int fIPv6, PPORTFORWARDRULE pPf
     AssertReturn(cbRaw > 14, VERR_INVALID_PARAMETER);
 
     pszRaw = RTStrDup(pcszStrPortForward);
-
-    AssertPtrReturn(pszRaw, VERR_NO_MEMORY);
+    AssertReturn(pszRaw, VERR_NO_MEMORY);
 
     pszRawBegin = pszRaw;
 
diff --git a/src/VBox/NetworkServices/NetLib/utils.h b/src/VBox/NetworkServices/NetLib/utils.h
index dbf5252..9b334b5 100644
--- a/src/VBox/NetworkServices/NetLib/utils.h
+++ b/src/VBox/NetworkServices/NetLib/utils.h
@@ -24,6 +24,7 @@
 #include "cpp/utils.h"
 
 typedef ComPtr<IVirtualBox> ComVirtualBoxPtr;
+typedef ComPtr<IVirtualBoxClient> ComVirtualBoxClientPtr;
 typedef ComPtr<IDHCPServer> ComDhcpServerPtr;
 typedef ComPtr<IHost> ComHostPtr;
 typedef ComPtr<INATNetwork> ComNatPtr;
@@ -130,4 +131,9 @@ typedef com::SafeArray<VBoxEventType_T> ComEventTypeArray;
  isn't modify event type array */
 int createNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr,
                       NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events);
+int destroyNatListener(ComNatListenerPtr& listener, const ComVirtualBoxPtr& vboxptr);
+int createClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr,
+                         NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events);
+int destroyClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr);
+
 #endif
diff --git a/src/VBox/RDP/client-1.8.3/vrdp/rdpusb.c b/src/VBox/RDP/client-1.8.3/vrdp/rdpusb.c
index a0886ee..894c8e9 100644
--- a/src/VBox/RDP/client-1.8.3/vrdp/rdpusb.c
+++ b/src/VBox/RDP/client-1.8.3/vrdp/rdpusb.c
@@ -502,6 +502,7 @@ rdpusb_process(STREAM s)
 			proxy->pvInstanceDataR3 = xmalloc(g_USBProxyDeviceHost.cbBackend);
 			if (!proxy->pvInstanceDataR3)
 			{
+				xfree (proxy);
 				error("RDPUSB: Out of memory allocating proxy backend data\n");
 				return;
 			}
diff --git a/src/VBox/Resources/OSE/virtualbox-128px.png b/src/VBox/Resources/OSE/virtualbox-128px.png
index 079e145..8526142 100644
Binary files a/src/VBox/Resources/OSE/virtualbox-128px.png and b/src/VBox/Resources/OSE/virtualbox-128px.png differ
diff --git a/src/VBox/Resources/OSE/virtualbox-16px.png b/src/VBox/Resources/OSE/virtualbox-16px.png
index 51c3aa5..4cd79fd 100644
Binary files a/src/VBox/Resources/OSE/virtualbox-16px.png and b/src/VBox/Resources/OSE/virtualbox-16px.png differ
diff --git a/src/VBox/Resources/OSE/virtualbox-20px.png b/src/VBox/Resources/OSE/virtualbox-20px.png
index 5136dc9..9a42cda 100644
Binary files a/src/VBox/Resources/OSE/virtualbox-20px.png and b/src/VBox/Resources/OSE/virtualbox-20px.png differ
diff --git a/src/VBox/Resources/OSE/virtualbox-32px.png b/src/VBox/Resources/OSE/virtualbox-32px.png
index 978eeb6..586e3ef 100644
Binary files a/src/VBox/Resources/OSE/virtualbox-32px.png and b/src/VBox/Resources/OSE/virtualbox-32px.png differ
diff --git a/src/VBox/Resources/OSE/virtualbox-40px.png b/src/VBox/Resources/OSE/virtualbox-40px.png
index e678c64..99f5399 100644
Binary files a/src/VBox/Resources/OSE/virtualbox-40px.png and b/src/VBox/Resources/OSE/virtualbox-40px.png differ
diff --git a/src/VBox/Resources/OSE/virtualbox-48px.png b/src/VBox/Resources/OSE/virtualbox-48px.png
index 26ac821..126b33f 100644
Binary files a/src/VBox/Resources/OSE/virtualbox-48px.png and b/src/VBox/Resources/OSE/virtualbox-48px.png differ
diff --git a/src/VBox/Resources/OSE/virtualbox-64px.png b/src/VBox/Resources/OSE/virtualbox-64px.png
index 59c45a6..26e919b 100644
Binary files a/src/VBox/Resources/OSE/virtualbox-64px.png and b/src/VBox/Resources/OSE/virtualbox-64px.png differ
diff --git a/src/VBox/Resources/win/TemplateDll.rc b/src/VBox/Resources/win/TemplateDll.rc
new file mode 100644
index 0000000..f7fb16e
--- /dev/null
+++ b/src/VBox/Resources/win/TemplateDll.rc
@@ -0,0 +1,114 @@
+/* $Id: TemplateDll.rc $ */
+/** @file
+ * Resource file template for a dynamic link library (DLL).
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/* Validate input and deal with optional input. */
+/** @def IN_FILE_DESCRIPTION
+ * The file description string.
+ */
+#ifndef IN_FILE_DESCRIPTION
+# error "Must define the IN_FILE_DESCRIPTION string!"
+#endif
+/** @def IN_INTERNAL_NAME
+ * The internal name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_INTERNAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_INTERNAL_NAME string!"
+# endif
+# define IN_INTERNAL_NAME IN_FILE_BASENAME
+#endif
+/** @def IN_ORIGINAL_NAME
+ * The original name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_ORIGINAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_ORIGINAL_NAME string!"
+# endif
+# define IN_ORIGINAL_NAME IN_FILE_BASENAME " .dll"
+#endif
+/** @def IN_PRODUCT_NAME
+ * The product name string, optional.
+ */
+#ifndef IN_PRODUCT_NAME
+# ifdef IN_GUEST
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_GA
+# elif defined(VBOX_IN_PUEL_EXTPACK)
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_PUEL_EXTPACK
+# elif defined(VBOX_IN_DTRACE_EXTPACK)
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_DTRACE_EXTPACK
+# else
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME
+# endif
+#endif
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <Windows.h>
+#include <VBox/version.h>
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#ifdef IN_ICON_FILE
+1 ICON IN_ICON_FILE
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION     VBOX_RC_FILE_VERSION
+PRODUCTVERSION  VBOX_RC_FILE_VERSION
+FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
+FILEFLAGS       VBOX_RC_FILE_FLAGS
+FILEOS          VBOX_RC_FILE_OS
+FILETYPE        VBOX_RC_TYPE_DLL
+FILESUBTYPE     VFT2_UNKNOWN
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0" /* Lang=US English, CodePage=utf-16 */
+        BEGIN
+            VALUE "FileDescription",  IN_FILE_DESCRIPTION "\0"
+            VALUE "InternalName",     IN_INTERNAL_NAME "\0"
+            VALUE "OriginalFilename", IN_ORIGINAL_NAME "\0"
+            VALUE "CompanyName",      VBOX_RC_COMPANY_NAME "\0"
+            VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+            VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+            VALUE "ProductName",      IN_PRODUCT_NAME
+            VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+            VBOX_RC_MORE_STRINGS
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200 /* Lang=US English, CodePage=utf-16 */
+    END
+END
+
diff --git a/src/VBox/Resources/win/TemplateDrv.rc b/src/VBox/Resources/win/TemplateDrv.rc
new file mode 100644
index 0000000..2274126
--- /dev/null
+++ b/src/VBox/Resources/win/TemplateDrv.rc
@@ -0,0 +1,117 @@
+/* $Id: TemplateDrv.rc $ */
+/** @file
+ * Resource file template for a driver.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/* Validate input and deal with optional input. */
+/** @def IN_FILE_DESCRIPTION
+ * The file description string.
+ */
+#ifndef IN_FILE_DESCRIPTION
+# error "Must define the IN_FILE_DESCRIPTION string!"
+#endif
+/** @def IN_INTERNAL_NAME
+ * The internal name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_INTERNAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_INTERNAL_NAME string!"
+# endif
+# define IN_INTERNAL_NAME IN_FILE_BASENAME
+#endif
+/** @def IN_ORIGINAL_NAME
+ * The original name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_ORIGINAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_ORIGINAL_NAME string!"
+# endif
+# define IN_ORIGINAL_NAME IN_FILE_BASENAME " .dll"
+#endif
+/** @def IN_PRODUCT_NAME
+ * The product name string, optional.
+ */
+#ifndef IN_PRODUCT_NAME
+# ifdef IN_GUEST
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_GA
+# elif defined(VBOX_IN_PUEL_EXTPACK)
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_PUEL_EXTPACK
+# elif defined(VBOX_IN_DTRACE_EXTPACK)
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_DTRACE_EXTPACK
+# else
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME
+# endif
+#endif
+#ifndef IN_FILE_SUBTYPE /* optional */
+# define IN_FILE_SUBTYPE VFT2_UNKNOWN
+#endif
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <Windows.h>
+#include <VBox/version.h>
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#ifdef IN_ICON_FILE
+1 ICON IN_ICON_FILE
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION     VBOX_RC_FILE_VERSION
+PRODUCTVERSION  VBOX_RC_FILE_VERSION
+FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
+FILEFLAGS       VBOX_RC_FILE_FLAGS
+FILEOS          VBOX_RC_FILE_OS
+FILETYPE        VBOX_RC_TYPE_DRV
+FILESUBTYPE     IN_FILE_SUBTYPE
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0" /* Lang=US English, CodePage=utf-16 */
+        BEGIN
+            VALUE "FileDescription",  IN_FILE_DESCRIPTION "\0"
+            VALUE "InternalName",     IN_INTERNAL_NAME "\0"
+            VALUE "OriginalFilename", IN_ORIGINAL_NAME "\0"
+            VALUE "CompanyName",      VBOX_RC_COMPANY_NAME "\0"
+            VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+            VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+            VALUE "ProductName",      IN_PRODUCT_NAME
+            VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+            VBOX_RC_MORE_STRINGS
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200 /* Lang=US English, CodePage=utf-16 */
+    END
+END
+
diff --git a/src/VBox/Resources/win/TemplateExe.rc b/src/VBox/Resources/win/TemplateExe.rc
new file mode 100644
index 0000000..ab52a0b
--- /dev/null
+++ b/src/VBox/Resources/win/TemplateExe.rc
@@ -0,0 +1,114 @@
+/* $Id: TemplateExe.rc $ */
+/** @file
+ * Resource file template for an executable.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/* Validate input and deal with optional input. */
+/** @def IN_FILE_DESCRIPTION
+ * The file description string.
+ */
+#ifndef IN_FILE_DESCRIPTION
+# error "Must define the IN_FILE_DESCRIPTION string!"
+#endif
+/** @def IN_INTERNAL_NAME
+ * The internal name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_INTERNAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_INTERNAL_NAME string!"
+# endif
+# define IN_INTERNAL_NAME IN_FILE_BASENAME
+#endif
+/** @def IN_ORIGINAL_NAME
+ * The original name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_ORIGINAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_ORIGINAL_NAME string!"
+# endif
+# define IN_ORIGINAL_NAME IN_FILE_BASENAME " .dll"
+#endif
+/** @def IN_PRODUCT_NAME
+ * The product name string, optional.
+ */
+#ifndef IN_PRODUCT_NAME
+# ifdef IN_GUEST
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_GA
+# elif defined(VBOX_IN_PUEL_EXTPACK)
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_PUEL_EXTPACK
+# elif defined(VBOX_IN_DTRACE_EXTPACK)
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_DTRACE_EXTPACK
+# else
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME
+# endif
+#endif
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <Windows.h>
+#include <VBox/version.h>
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#ifdef IN_ICON_FILE
+1 ICON IN_ICON_FILE
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION     VBOX_RC_FILE_VERSION
+PRODUCTVERSION  VBOX_RC_FILE_VERSION
+FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
+FILEFLAGS       VBOX_RC_FILE_FLAGS
+FILEOS          VBOX_RC_FILE_OS
+FILETYPE        VBOX_RC_TYPE_APP
+FILESUBTYPE     VFT2_UNKNOWN
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0" /* Lang=US English, CodePage=utf-16 */
+        BEGIN
+            VALUE "FileDescription",  IN_FILE_DESCRIPTION "\0"
+            VALUE "InternalName",     IN_INTERNAL_NAME "\0"
+            VALUE "OriginalFilename", IN_ORIGINAL_NAME "\0"
+            VALUE "CompanyName",      VBOX_RC_COMPANY_NAME "\0"
+            VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+            VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+            VALUE "ProductName",      IN_PRODUCT_NAME
+            VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+            VBOX_RC_MORE_STRINGS
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200 /* Lang=US English, CodePage=utf-16 */
+    END
+END
+
diff --git a/src/VBox/Resources/win/TemplateR0.rc b/src/VBox/Resources/win/TemplateR0.rc
new file mode 100644
index 0000000..eebf5c5
--- /dev/null
+++ b/src/VBox/Resources/win/TemplateR0.rc
@@ -0,0 +1,115 @@
+/* $Id: TemplateR0.rc $ */
+/** @file
+ * Resource file template for a ring-0 module.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/* Validate input and deal with optional input. */
+/** @def IN_FILE_DESCRIPTION
+ * The file description string.
+ */
+#ifndef IN_FILE_DESCRIPTION
+# error "Must define the IN_FILE_DESCRIPTION string!"
+#endif
+/** @def IN_INTERNAL_NAME
+ * The internal name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_INTERNAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_INTERNAL_NAME string!"
+# endif
+# define IN_INTERNAL_NAME IN_FILE_BASENAME
+#endif
+/** @def IN_ORIGINAL_NAME
+ * The original name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_ORIGINAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_ORIGINAL_NAME string!"
+# endif
+# define IN_ORIGINAL_NAME IN_FILE_BASENAME " .dll"
+#endif
+/** @def IN_PRODUCT_NAME
+ * The product name string, optional.
+ */
+#ifndef IN_PRODUCT_NAME
+# ifdef VBOX_IN_PUEL_EXTPACK
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_PUEL_EXTPACK
+# elif defined(VBOX_IN_DTRACE_EXTPACK)
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_DTRACE_EXTPACK
+# else
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME
+# endif
+#endif
+#ifdef IN_GUEST
+# error "No R0 modules with IN_GUEST defined!"
+#endif
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "TemplateRsrcDefs.h"
+#include <VBox/version.h>
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#ifdef IN_ICON_FILE
+1 ICON IN_ICON_FILE
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION     VBOX_RC_FILE_VERSION
+PRODUCTVERSION  VBOX_RC_FILE_VERSION
+FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
+FILEFLAGS       VBOX_RC_FILE_FLAGS
+FILEOS          VBOX_RC_FILE_OS
+FILETYPE        VBOX_RC_TYPE_DRV
+FILESUBTYPE     VFT2_UNKNOWN
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0" /* Lang=US English, CodePage=utf-16 */
+        BEGIN
+            VALUE "FileDescription",  IN_FILE_DESCRIPTION "\0"
+            VALUE "InternalName",     IN_INTERNAL_NAME "\0"
+            VALUE "OriginalFilename", IN_ORIGINAL_NAME "\0"
+            VALUE "CompanyName",      VBOX_RC_COMPANY_NAME "\0"
+            VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+            VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+            VALUE "ProductName",      IN_PRODUCT_NAME
+            VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+            VBOX_RC_MORE_STRINGS
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200 /* Lang=US English, CodePage=utf-16 */
+    END
+END
+
diff --git a/src/VBox/Resources/win/TemplateRC.rc b/src/VBox/Resources/win/TemplateRC.rc
new file mode 100644
index 0000000..fce9422
--- /dev/null
+++ b/src/VBox/Resources/win/TemplateRC.rc
@@ -0,0 +1,115 @@
+/* $Id: TemplateRC.rc $ */
+/** @file
+ * Resource file template for a raw-mode context module.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/* Validate input and deal with optional input. */
+/** @def IN_FILE_DESCRIPTION
+ * The file description string.
+ */
+#ifndef IN_FILE_DESCRIPTION
+# error "Must define the IN_FILE_DESCRIPTION string!"
+#endif
+/** @def IN_INTERNAL_NAME
+ * The internal name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_INTERNAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_INTERNAL_NAME string!"
+# endif
+# define IN_INTERNAL_NAME IN_FILE_BASENAME
+#endif
+/** @def IN_ORIGINAL_NAME
+ * The original name string, optional (requires IN_FILE_BASENAME then).
+ */
+#ifndef IN_ORIGINAL_NAME
+# ifndef IN_FILE_BASENAME
+#  error "Must define the IN_FILE_BASENAME or the IN_ORIGINAL_NAME string!"
+# endif
+# define IN_ORIGINAL_NAME IN_FILE_BASENAME " .dll"
+#endif
+/** @def IN_PRODUCT_NAME
+ * The product name string, optional.
+ */
+#ifndef IN_PRODUCT_NAME
+# ifdef VBOX_IN_PUEL_EXTPACK
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_PUEL_EXTPACK
+# elif defined(VBOX_IN_DTRACE_EXTPACK)
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME_DTRACE_EXTPACK
+# else
+#  define IN_PRODUCT_NAME VBOX_RC_PRODUCT_NAME
+# endif
+#endif
+#ifdef IN_GUEST
+# error "No RC modules with IN_GUEST defined!"
+#endif
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "TemplateRsrcDefs.h"
+#include <VBox/version.h>
+
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+#ifdef IN_ICON_FILE
+1 ICON IN_ICON_FILE
+#endif
+
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION     VBOX_RC_FILE_VERSION
+PRODUCTVERSION  VBOX_RC_FILE_VERSION
+FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
+FILEFLAGS       VBOX_RC_FILE_FLAGS
+FILEOS          VBOX_RC_FILE_OS
+FILETYPE        VBOX_RC_TYPE_DRV
+FILESUBTYPE     VFT2_UNKNOWN
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0" /* Lang=US English, CodePage=utf-16 */
+        BEGIN
+            VALUE "FileDescription",  IN_FILE_DESCRIPTION "\0"
+            VALUE "InternalName",     IN_INTERNAL_NAME "\0"
+            VALUE "OriginalFilename", IN_ORIGINAL_NAME "\0"
+            VALUE "CompanyName",      VBOX_RC_COMPANY_NAME "\0"
+            VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+            VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+            VALUE "ProductName",      IN_PRODUCT_NAME
+            VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+            VBOX_RC_MORE_STRINGS
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200 /* Lang=US English, CodePage=utf-16 */
+    END
+END
+
diff --git a/src/VBox/Resources/win/TemplateRsrcDefs.h b/src/VBox/Resources/win/TemplateRsrcDefs.h
new file mode 100644
index 0000000..0c7db00
--- /dev/null
+++ b/src/VBox/Resources/win/TemplateRsrcDefs.h
@@ -0,0 +1,45 @@
+/* $Id: TemplateRsrcDefs.h $ */
+/** @file
+ * Defines for templates that does not have Windows.h handy.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+#ifdef IN_ICON_FILE
+IDI_ICON1 ICON IN_ICON_FILE
+#endif
+
+#define VS_VERSION_INFO         1
+#define VS_FFI_FILEFLAGSMASK    0x3f
+#define VS_FF_DEBUG             0x01
+#define VS_FF_PRERELEASE        0x02
+#define VS_FF_PATCHED           0x03
+#define VS_FF_PRIVATEBUILD      0x08
+#define VS_FF_INFOINFERRED      0x10
+#define VS_FF_SPECIALBUILD      0x20
+#define VFT_DRV                 3
+#define VFT2_UNKNOWN            0
+#define VOS_NT_WINDOWS32        0x40004
+#define LANG_ENGLISH            0x409
+#define SUBLANG_ENGLISH_US      1
+
diff --git a/src/VBox/Runtime/Makefile.kmk b/src/VBox/Runtime/Makefile.kmk
index 607c00b..a8c2138 100644
--- a/src/VBox/Runtime/Makefile.kmk
+++ b/src/VBox/Runtime/Makefile.kmk
@@ -39,9 +39,9 @@ ifdef VBOX_ONLY_ADDITIONS
   LIBRARIES.win.x86 += RuntimeGuestR0NT4
  endif
 
-else ifdef VBOX_ONLY_TESTSUITE
+else ifdef VBOX_ONLY_VALIDATIONKIT
  #
- # Only build the testsuite.
+ # Only build the Validation Kit.
  #
  LIBRARIES += RuntimeGuestR3 RuntimeGuestR3Shared RuntimeR3 RuntimeR0 RuntimeBldProg
  LIBRARIES.solaris += RuntimeR0Stub
@@ -57,14 +57,15 @@ else ifdef VBOX_ONLY_DOCS
 
 else ifdef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
  #
- # Build docs only - need just regular R3 runtime.
+ # Build extension packs using import libraries as much as possible (VBoxDTrace
+ # needs Ring-0 IPRT, though).
  #
- LIBRARIES += RuntimeBldProg
+ LIBRARIES += RuntimeBldProg RuntimeR0
  LIBRARIES.solaris += RuntimeR0Stub
  LIBRARIES.win += RuntimeR0Stub RuntimeRCStub
  include $(PATH_SUB_CURRENT)/tools/Makefile.kmk
 
-else # !VBOX_ONLY_ADDITIONS && !VBOX_ONLY_TESTSUITE && !VBOX_ONLY_DOCS
+else # !VBOX_ONLY_ADDITIONS && !VBOX_ONLY_VALIDATIONKIT && !VBOX_ONLY_DOCS
 
  #
  # Normal build.
@@ -180,11 +181,15 @@ RuntimeWin64ASM_SOURCES = \
 	win/amd64/ASMGetDR6.asm \
 	win/amd64/ASMGetDR7.asm \
 	common/asm/ASMAtomicCmpXchgU8.asm \
+	common/asm/ASMMultU32ByU32DivByU32.asm \
 	common/asm/ASMMultU64ByU32DivByU32.asm \
 	common/asm/ASMCpuId_Idx_ECX.asm \
 	common/asm/ASMNopPause.asm \
 	common/asm/ASMGetIDTR.asm \
+	common/asm/ASMGetIdtrLimit.asm \
+	common/asm/ASMSetIDTR.asm \
 	common/asm/ASMGetGDTR.asm \
+	common/asm/ASMSetGDTR.asm \
 	common/asm/ASMGetLDTR.asm \
 	common/asm/ASMGetSegAttr.asm \
 	common/asm/ASMGetTR.asm
@@ -194,6 +199,7 @@ RuntimeWin64ASM_SOURCES = \
 #
 RuntimeWin32ASM_SOURCES = \
 	common/asm/ASMAtomicCmpXchgU8.asm \
+	common/asm/ASMMultU32ByU32DivByU32.asm \
 	common/asm/ASMMultU64ByU32DivByU32.asm \
 	common/asm/ASMCpuId_Idx_ECX.asm \
 	common/asm/ASMGetSegAttr.asm
@@ -297,6 +303,7 @@ RuntimeR3_SOURCES       = \
 	common/asn1/asn1-ut-time-decode.cpp \
 	common/checksum/adler32.cpp \
 	common/checksum/crc32.cpp \
+	common/checksum/crc32c.cpp \
 	common/checksum/crc64.cpp \
 	common/checksum/alt-md2.cpp \
 	common/checksum/alt-md5.cpp \
@@ -320,6 +327,7 @@ RuntimeR3_SOURCES       = \
 	common/checksum/sha512str.cpp \
 	common/checksum/sha512t224str.cpp \
 	common/checksum/sha512t256str.cpp \
+	common/checksum/x509.cpp \
 	common/crypto/digest-core.cpp \
 	common/crypto/digest-builtin.cpp \
 	common/crypto/iprt-openssl.cpp \
@@ -434,7 +442,6 @@ RuntimeR3_SOURCES       = \
 	common/misc/term.cpp \
 	common/misc/uri.cpp \
 	common/misc/zero.asm \
-	common/net/netaddrstr.cpp \
 	common/net/netaddrstr2.cpp \
 	common/net/macstr.cpp \
 	common/path/rtPathRootSpecLen.cpp \
@@ -641,19 +648,31 @@ RuntimeR3_SOURCES.x86 += \
 	common/asm/ASMCpuIdExSlow.asm \
 	common/asm/ASMAtomicUoAndU64.asm \
 	common/asm/ASMAtomicUoAndU32.asm \
+	common/asm/ASMAtomicUoDecU32.asm \
+	common/asm/ASMAtomicUoIncU32.asm \
 	common/asm/ASMAtomicUoOrU64.asm \
 	common/asm/ASMAtomicUoOrU32.asm \
 	common/asm/ASMRdMsrEx.asm \
 	common/asm/ASMWrMsrEx.asm \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
+	common/asm/ASMXSave.asm \
+	common/asm/ASMXRstor.asm \
 	common/math/bignum-amd64-x86.asm
 RuntimeR3_SOURCES.amd64 += \
 	common/asm/ASMCpuIdExSlow.asm \
 	common/asm/ASMAtomicUoAndU64.asm \
 	common/asm/ASMAtomicUoAndU32.asm \
+	common/asm/ASMAtomicUoDecU32.asm \
+	common/asm/ASMAtomicUoIncU32.asm \
 	common/asm/ASMAtomicUoOrU64.asm \
 	common/asm/ASMAtomicUoOrU32.asm \
 	common/asm/ASMRdMsrEx.asm \
 	common/asm/ASMWrMsrEx.asm \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
+	common/asm/ASMXSave.asm \
+	common/asm/ASMXRstor.asm \
 	common/math/bignum-amd64-x86.asm \
 	common/math/RTUInt128MulByU64.asm
 
@@ -684,6 +703,7 @@ RuntimeR3_SOURCES += \
 	$(if $(VBOX_WITH_DBUS),VBox/dbus.cpp,)
 endif
 
+VBOX_WITH_NT_DIRENUM = 1
 RuntimeR3_SOURCES.win = \
 	common/dbg/dbgmoddbghelp.cpp \
 	generic/cdrom-generic.cpp \
@@ -739,10 +759,10 @@ RuntimeR3_SOURCES.win = \
 	r3/win/semmutex-win.cpp \
 	r3/win/symlink-win.cpp \
 	r3/win/rtFileNativeSetAttributes-win.cpp \
-	r3/win/rtmemlocked-win.cpp \
 	r3/win/thread-win.cpp \
 	r3/win/thread2-win.cpp \
-	r3/win/time-win.cpp \
+	$(if-expr 1,r3/win/time-win.cpp,r3/nt/time-nt.cpp) \
+	r3/win/time2-win.cpp \
 	r3/win/timer-win.cpp \
 	r3/win/tls-win.cpp \
 	r3/win/utf16locale-win.cpp \
@@ -793,7 +813,6 @@ RuntimeR3_SOURCES.linux = \
 	r3/posix/RTTimeNow-posix.cpp \
 	r3/posix/RTTimeSet-posix.cpp \
 	r3/posix/rtmempage-exec-mmap-heap-posix.cpp \
-	r3/posix/rtmemlocked-posix.cpp \
 	r3/posix/dir-posix.cpp \
 	r3/posix/env-posix.cpp \
 	r3/posix/errvars-posix.cpp \
@@ -968,7 +987,6 @@ RuntimeR3_SOURCES.darwin = \
 	r3/posix/fs3-posix.cpp \
 	r3/posix/ldrNative-posix.cpp \
 	r3/posix/rtmempage-exec-mmap-heap-posix.cpp \
-	r3/posix/rtmemlocked-posix.cpp \
 	r3/posix/path-posix.cpp \
 	r3/posix/path2-posix.cpp \
 	r3/posix/pipe-posix.cpp \
@@ -1015,6 +1033,7 @@ RuntimeR3_SOURCES.freebsd = \
 	generic/RTProcIsRunningByName-generic.cpp \
 	generic/RTThreadGetNativeState-generic.cpp \
 	r3/freebsd/mp-freebsd.cpp \
+	r3/freebsd/systemmem-freebsd.cpp \
 	r3/freebsd/rtProcInitExePath-freebsd.cpp \
 	r3/generic/allocex-r3-generic.cpp \
 	r3/posix/RTFileQueryFsSizes-posix.cpp \
@@ -1022,7 +1041,6 @@ RuntimeR3_SOURCES.freebsd = \
 	r3/posix/RTMemProtect-posix.cpp \
 	r3/posix/RTPathUserHome-posix.cpp \
 	r3/posix/RTSystemQueryOSInfo-posix.cpp \
-	r3/posix/RTSystemQueryTotalRam-posix.cpp \
 	r3/posix/RTTimeNow-posix.cpp \
 	r3/posix/RTTimeSet-posix.cpp \
 	r3/posix/dir-posix.cpp \
@@ -1036,7 +1054,6 @@ RuntimeR3_SOURCES.freebsd = \
 	r3/posix/fs3-posix.cpp \
 	r3/posix/ldrNative-posix.cpp \
 	r3/posix/rtmempage-exec-mmap-heap-posix.cpp \
-	r3/posix/rtmemlocked-posix.cpp \
 	r3/posix/path-posix.cpp \
 	r3/posix/path2-posix.cpp \
 	r3/posix/pathhost-posix.cpp \
@@ -1097,7 +1114,6 @@ RuntimeR3_SOURCES.solaris = \
 	r3/posix/fs3-posix.cpp \
 	r3/posix/ldrNative-posix.cpp \
 	r3/posix/rtmempage-exec-mmap-heap-posix.cpp \
-	r3/posix/rtmemlocked-posix.cpp \
 	r3/posix/path-posix.cpp \
 	r3/posix/path2-posix.cpp \
 	r3/posix/pathhost-posix.cpp \
@@ -1178,7 +1194,6 @@ RuntimeR3_SOURCES.haiku = \
 	r3/posix/fs3-posix.cpp \
 	r3/posix/ldrNative-posix.cpp \
 	r3/posix/rtmempage-exec-mmap-heap-posix.cpp \
-	r3/posix/rtmemlocked-posix.cpp \
 	r3/posix/path-posix.cpp \
 	r3/posix/path2-posix.cpp \
 	r3/posix/pathhost-posix.cpp \
@@ -1215,6 +1230,10 @@ RuntimeBldProg_SOURCES          = $(filter-out \
 	r3/xml.cpp \
 	common/zip/xarvfs.cpp \
 	, $(RuntimeR3_SOURCES))
+if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_HOST)" != "win"
+RuntimeBldProg_SOURCES         += \
+	common/err/errmsgxpcom.cpp
+endif
 
 
 
@@ -1236,7 +1255,7 @@ RuntimeGuestR3_SOURCES                  := $(filter-out \
 	common/time/timesupref.cpp \
 	common/time/timesupA.asm \
 	common/time/timesup.cpp \
-	common/checksum/openssl-% \
+	common/checksum/x509.cpp \
 	generic/RTLogWriteUser-generic.cpp \
 	r3/xml.cpp \
 	common/zip/xarvfs.cpp \
@@ -1301,6 +1320,9 @@ endif
 ifdef VBOX_WITH_LIBCURL
  VBoxRT_DEFS                  += IPRT_WITH_HTTP
 endif
+ifdef RTALLOC_REPLACE_MALLOC
+ VBoxRT_DEFS                  += RTALLOC_REPLACE_MALLOC
+endif
 VBoxRT_DEFS.$(KBUILD_TYPE)    := $(RuntimeR3_DEFS.$(KBUILD_TYPE))
 VBoxRT_SOURCES                := \
 	VBox/VBoxRTDeps.cpp \
@@ -1323,7 +1345,6 @@ VBoxRT_SOURCES.amd64 := $(RuntimeR3_SOURCES.amd64)
 VBoxRT_SOURCES.win            += \
 	r3/win/dllmain-win.cpp \
 	r3/win/fileaio-win.cpp \
-	r3/win/VBoxRT.rc \
 	$(VBoxRT_0_OUTDIR)/VBoxRT.def
 VBoxRT_SOURCES.linux          += \
 	r3/linux/fileaio-linux.cpp
@@ -1360,6 +1381,10 @@ endif
 ifdef IPRT_WITH_LZO
  VBoxRT_LIBS                  += lzo2
 endif
+ifdef RTALLOC_REPLACE_MALLOC
+VBoxRT_LIBS                   += \
+	$(PATH_STAGE_LIB)/DisasmR3$(VBOX_SUFF_LIB)
+endif
 VBoxRT_LIBS.linux              = \
 	crypt
 VBoxRT_LIBS.darwin             = \
@@ -1397,6 +1422,10 @@ $$(VBoxRT_0_OUTDIR)/VBoxRT.def: \
 	$(REDIRECT) -wto $@ -- $(CAT_EXT) $^
 endif
 
+if1of (VBoxRT,$(DLLS))
+ $(call VBOX_SET_VER_INFO_DLL,VBoxRT,VirtualBox Runtime)
+endif
+
 
 #
 # HACK ALERT!  Make testcase run during build on SELinux boxes.
@@ -1483,7 +1512,7 @@ VBoxRT-x86_LIBS.win                = \
 	$(PATH_SDK_$(VBOX_WINDDK)_LIB.x86)/wbemuuid.lib \
 	$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_LIB)/delayimp.lib
 
-VBoxRT-x86_SOURCES.win = $(filter-out %.def,$(VBoxRT_SOURCES.win)) \
+VBoxRT-x86_SOURCES.win = $(filter-out %.def %.rc,$(VBoxRT_SOURCES.win)) \
 	$(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def
 if1of ($(DLLS), VBoxRT-x86)
 $$(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def: \
@@ -1493,15 +1522,19 @@ $$(VBoxRT-x86_0_OUTDIR)/VBoxRT-x86.def: \
 	$(REDIRECT) -wto $@ -- $(CAT_EXT) $^
 endif
 
+if1of (VBoxRT-x86,$(DLLS))
+ $(call VBOX_SET_VER_INFO_DLL,VBoxRT-x86,VirtualBox 32-bit Runtime)
+endif
+
 #
 # VBoxRTImp - Import library/hack.
 #
 ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.amd64)
-$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-openssl-ose.def r3/win/VBoxRT-win64.def)
+$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-win64.def)
 else ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
-$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-openssl-ose.def r3/win/VBoxRT-win32.def)
+$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-win32.def)
 else
-$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def r3/win/VBoxRT-openssl-ose.def)
+$(call VBOX_GENERATE_IMPORT_TARGET_FN,VBoxRTImp,VBoxRT,VBox/VBoxRTImp.def)
 endif
 
 
@@ -1671,16 +1704,28 @@ RuntimeR0_SOURCES.x86 += \
 	common/asm/ASMCpuIdExSlow.asm \
 	common/asm/ASMAtomicUoAndU64.asm \
 	common/asm/ASMAtomicUoAndU32.asm \
+	common/asm/ASMAtomicUoDecU32.asm \
+	common/asm/ASMAtomicUoIncU32.asm \
 	common/asm/ASMAtomicUoOrU64.asm \
 	common/asm/ASMAtomicUoOrU32.asm \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
+	common/asm/ASMXSave.asm \
+	common/asm/ASMXRstor.asm \
 	common/asm/ASMRdMsrEx.asm \
 	common/asm/ASMWrMsrEx.asm
 RuntimeR0_SOURCES.amd64 += \
 	common/asm/ASMCpuIdExSlow.asm \
 	common/asm/ASMAtomicUoAndU64.asm \
 	common/asm/ASMAtomicUoAndU32.asm \
+	common/asm/ASMAtomicUoDecU32.asm \
+	common/asm/ASMAtomicUoIncU32.asm \
 	common/asm/ASMAtomicUoOrU64.asm \
 	common/asm/ASMAtomicUoOrU32.asm \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
+	common/asm/ASMXSave.asm \
+	common/asm/ASMXRstor.asm \
 	common/asm/ASMRdMsrEx.asm \
 	common/asm/ASMWrMsrEx.asm
 
@@ -2017,6 +2062,7 @@ RuntimeR0Drv_SOURCES.darwin = \
 	generic/RTAssertShouldPanic-generic.cpp \
 	generic/RTTimerCreate-generic.cpp \
 	generic/RTMpGetCoreCount-generic.cpp \
+	generic/RTMpOnPair-generic.cpp \
 	generic/mppresent-generic.cpp \
 	generic/timer-generic.cpp \
 	r0drv/generic/mpnotification-r0drv-generic.cpp \
@@ -2114,6 +2160,7 @@ RuntimeR0Drv_SOURCES.freebsd = \
 	generic/RTAssertShouldPanic-generic.cpp \
 	generic/RTLogWriteDebugger-generic.cpp \
 	generic/RTLogWriteStdOut-stub-generic.cpp \
+	generic/RTMpOnPair-generic.cpp \
 	generic/RTTimerCreate-generic.cpp \
 	generic/mppresent-generic.cpp \
 	r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp \
@@ -2179,6 +2226,7 @@ RuntimeR0Drv_SOURCES.haiku = \
 	common/string/memcmp.asm \
 	common/string/strchr.asm \
 	generic/RTAssertShouldPanic-generic.cpp \
+	generic/RTMpOnPair-generic.cpp \
 	generic/RTTimerCreate-generic.cpp \
 	generic/mppresent-generic.cpp \
 	r0drv/generic/RTMpIsCpuWorkPending-r0drv-generic.cpp \
@@ -2239,9 +2287,13 @@ ifdef VBOX_WITH_RAW_MODE
  # RuntimeRC - Raw-mode context library.
  #
  RuntimeRC_TEMPLATE      = VBoxRc
- RuntimeRC_DEFS          = IN_RT_RC RT_WITH_VBOX
+ RuntimeRC_DEFS          = IN_RT_RC RT_WITH_VBOX IN_SUP_RC IN_VMM_RC
  RuntimeRC_INCS          = include
  RuntimeRC_SOURCES      := \
+	common/asm/ASMGetXcr0.asm \
+	common/asm/ASMSetXcr0.asm \
+	common/asm/ASMXSave.asm \
+	common/asm/ASMXRstor.asm \
 	common/checksum/alt-md5.cpp \
 	common/checksum/crc32.cpp \
 	common/checksum/crc64.cpp \
@@ -2697,7 +2749,7 @@ if1of ($(LIBRARIES),RuntimeR3 RuntimeR0 RuntimeR0Drv RuntimeRC)
 		| $(SED) -nf "$@"
   endif
 	$(call MSG_L1,IPRT: Testing mangling using nm...)
-	$(QUIET)nm $^  2> /dev/null \
+	$(QUIET)$(VBOX_NM) $^  2> /dev/null \
 		| $(SED) -n \
 			-e 's/^[0-9a-f][0-9a-f]* //' \
 			-e '/^[TUDB] /!d' \
@@ -2717,6 +2769,12 @@ if1of ($(LIBRARIES),RuntimeR3 RuntimeR0 RuntimeR0Drv RuntimeRC)
 			-e '/^g_hDbgModStrCache/d'\
 			-e '/^g_pfnR0Darwin/d'\
 			-e '/^g_pDarwinLockGroup/d'\
+			$(if-expr "$(KBUILD_TARGET)" == "solaris", \
+			-e '/^g_kLdrRdrFileOps/d' \
+			-e '/^g_pSUPGlobalInfoPage/d' \
+			-e '/^g_Logger/d' \
+			-e '/^g_RelLogger/d' \
+			-e '/^g_VM/d',) \
 			\
 			-e '/^RTDBusLoadLib/d' \
 			\
@@ -2727,7 +2785,7 @@ if1of ($(LIBRARIES),RuntimeR3 RuntimeR0 RuntimeR0Drv RuntimeRC)
 endif
 	$(QUIET)$(APPEND) -t $@
 
-if !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_TESTSUITE) && !defined(VBOX_ONLY_DOCS)
+if !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_VALIDATIONKIT) && !defined(VBOX_ONLY_DOCS)
 #
 # Windows build tool.
 #
diff --git a/src/VBox/Runtime/VBox/VBoxRTDeps.cpp b/src/VBox/Runtime/VBox/VBoxRTDeps.cpp
index 42ebc45..e0fc16c 100644
--- a/src/VBox/Runtime/VBox/VBoxRTDeps.cpp
+++ b/src/VBox/Runtime/VBox/VBoxRTDeps.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -54,8 +54,10 @@ PFNRT g_VBoxRTDeps[] =
 #ifndef RT_NO_GIP
     (PFNRT)SUPR3Init,
     (PFNRT)SUPR3PageAllocEx,
+    (PFNRT)SUPR3LoadVMM,
     (PFNRT)SUPSemEventCreate,
     (PFNRT)SUPTracerFireProbe,
+    (PFNRT)SUPGetTscDeltaSlow,
 #endif
     (PFNRT)xmlLoadCatalogs,
     (PFNRT)MD5_Init,
@@ -69,6 +71,9 @@ PFNRT g_VBoxRTDeps[] =
     (PFNRT)i2d_X509,
     (PFNRT)i2d_PublicKey,
     (PFNRT)RSA_generate_key,
+    (PFNRT)RSA_generate_key_ex,
+    (PFNRT)DH_generate_parameters,
+    (PFNRT)DH_generate_parameters_ex,
     (PFNRT)RAND_load_file,
     (PFNRT)CRYPTO_set_dynlock_create_callback,
     (PFNRT)CRYPTO_set_dynlock_lock_callback,
diff --git a/src/VBox/Runtime/VBox/VBoxRTImp.def b/src/VBox/Runtime/VBox/VBoxRTImp.def
index 0c1f3ba..dbe246d 100644
--- a/src/VBox/Runtime/VBox/VBoxRTImp.def
+++ b/src/VBox/Runtime/VBox/VBoxRTImp.def
@@ -3,7 +3,7 @@
 ; VirtualBox Runtime DLL - Stable Interface Definition file.
 
 ;
-; Copyright (C) 2010-2012 Oracle Corporation
+; Copyright (C) 2010-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -728,6 +728,13 @@ EXPORTS
     RTMemPoolRetain
     RTMemProtect
     RTMemReallocTag
+    RTMemSaferAllocZExTag
+    RTMemSaferAllocZTag
+    RTMemSaferFree
+    RTMemSaferReallocZExTag
+    RTMemSaferReallocZTag
+    RTMemSaferScramble
+    RTMemSaferUnscramble
     RTMemTmpAllocTag
     RTMemTmpAllocZTag
     RTMemTmpFree
@@ -797,12 +804,11 @@ EXPORTS
     RTPathExecDir
     RTPathExists
     RTPathExistsEx
-    RTPathExt
     RTPathFilename
     RTPathGetCurrent
     RTPathGetMode
-    RTPathHaveExt
     RTPathHavePath
+    RTPathHaveSuffix
     RTPathJoin
     RTPathJoinA
     RTPathJoinEx
@@ -821,9 +827,10 @@ EXPORTS
     RTPathSharedLibs
     RTPathStartsWith
     RTPathStartsWithRoot
-    RTPathStripExt
     RTPathStripFilename
+    RTPathStripSuffix
     RTPathStripTrailingSlash
+    RTPathSuffix
     RTPathTemp
     RTPathTraverseList
     RTPathUserHome
@@ -1329,10 +1336,20 @@ EXPORTS
     RTTimeLocalNow
     RTTimeMilliTS
     RTTimeNanoTS
-    RTTimeNanoTSLFenceAsync
-    RTTimeNanoTSLFenceSync
-    RTTimeNanoTSLegacyAsync
-    RTTimeNanoTSLegacySync
+    RTTimeNanoTSLegacySyncInvarNoDelta
+    RTTimeNanoTSLFenceSyncInvarNoDelta
+    RTTimeNanoTSLegacyAsyncUseApicId
+    RTTimeNanoTSLegacyAsyncUseRdtscp
+    RTTimeNanoTSLegacyAsyncUseIdtrLim
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim
+    RTTimeNanoTSLFenceAsyncUseApicId
+    RTTimeNanoTSLFenceAsyncUseRdtscp
+    RTTimeNanoTSLFenceAsyncUseIdtrLim
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim
     RTTimeNormalize
     RTTimeNow
     RTTimeProgramMicroTS
@@ -1487,3 +1504,12 @@ EXPORTS
     SUPR3HardenedLdrLoadPlugIn
     SUPR3QueryVTxSupported
     SUPR3QueryVTCaps
+    SUPSemEventSignal
+    SUPSemEventWaitNoResume
+    SUPSemEventClose
+    SUPSemEventCreate
+    SUPR3Init
+    SUPR3LoadModule
+    SUPR3TracerOpen
+    SUPR3TracerIoCtl
+
diff --git a/src/VBox/Runtime/VBox/dbus.cpp b/src/VBox/Runtime/VBox/dbus.cpp
index 70e6374..c9a6bec 100644
--- a/src/VBox/Runtime/VBox/dbus.cpp
+++ b/src/VBox/Runtime/VBox/dbus.cpp
@@ -1,3 +1,4 @@
+/* $Id: dbus.cpp $ */
 /** @file
  *
  * Module to dynamically load libdbus and load all symbols
diff --git a/src/VBox/Runtime/VBox/log-vbox.cpp b/src/VBox/Runtime/VBox/log-vbox.cpp
index ef53798..097ae94 100644
--- a/src/VBox/Runtime/VBox/log-vbox.cpp
+++ b/src/VBox/Runtime/VBox/log-vbox.cpp
@@ -469,7 +469,7 @@ RTDECL(PRTLOGGER) RTLogDefaultInit(void)
         pLogger->fDestFlags |= RTLOGDEST_DEBUGGER;
 # endif
 # if defined(DEBUG_aleksey)  /* Guest ring-0 as well */
-        RTLogGroupSettings(pLogger, "+net_adp_drv.e.l.f+net_flt_drv.e.l.l2.l3.l4.l5.f");
+        RTLogGroupSettings(pLogger, "net_flt_drv.e.l.f.l3.l4.l5 +net_adp_drv.e.l.f.l3.l4.l5");
         RTLogFlags(pLogger, "enabled unbuffered");
         pLogger->fDestFlags |= RTLOGDEST_DEBUGGER | RTLOGDEST_STDOUT;
 # endif
@@ -485,7 +485,7 @@ RTDECL(PRTLOGGER) RTLogDefaultInit(void)
 # if defined(DEBUG_michael) && defined(IN_GUEST)
         RTLogGroupSettings(pLogger, "+all.e.l.f");
         RTLogFlags(pLogger, "enabled unbuffered");
-        pLogger->fDestFlags |= RTLOGDEST_DEBUGGER;
+        pLogger->fDestFlags |= RTLOGDEST_DEBUGGER | RTLOGDEST_STDOUT;
 # endif
 # if 0 /* vboxdrv logging - ATTENTION: this is what we're referring to guys! Change to '# if 1'. */
         RTLogGroupSettings(pLogger, "all=~0 -default.l6.l5.l4.l3");
diff --git a/src/VBox/Runtime/common/alloc/memcache.cpp b/src/VBox/Runtime/common/alloc/memcache.cpp
index 43285e6..3b60576 100644
--- a/src/VBox/Runtime/common/alloc/memcache.cpp
+++ b/src/VBox/Runtime/common/alloc/memcache.cpp
@@ -86,7 +86,7 @@ typedef struct RTMEMCACHEPAGE
     void volatile              *pbmAlloc;
     /** Bitmap tracking which blocks that has been thru the constructor. */
     void volatile              *pbmCtor;
-    /** Pointer to the object array.. */
+    /** Pointer to the object array. */
     uint8_t                    *pbObjects;
     /** The number of objects on this page.  */
     uint32_t                    cObjects;
@@ -149,6 +149,11 @@ typedef struct RTMEMCACHEINT
 } RTMEMCACHEINT;
 
 
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static void rtMemCacheFreeList(RTMEMCACHEINT *pThis, PRTMEMCACHEFREEOBJ pHead);
+
 
 RTDECL(int) RTMemCacheCreate(PRTMEMCACHE phMemCache, size_t cbObject, size_t cbAlignment, uint32_t cMaxObjects,
                              PFNMEMCACHECTOR pfnCtor, PFNMEMCACHEDTOR pfnDtor, void *pvUser, uint32_t fFlags)
@@ -220,21 +225,6 @@ RTDECL(int) RTMemCacheCreate(PRTMEMCACHE phMemCache, size_t cbObject, size_t cbA
     pThis->pPageHint        = NULL;
     pThis->pFreeTop         = NULL;
 
-    /** @todo
-     * Here is a puzzler (or maybe I'm just blind), the free list code breaks
-     * badly on my macbook pro (i7) (32-bit).
-     *
-     * I tried changing the reads from unordered to ordered to no avail.  Then I
-     * tried optimizing the code with the ASMAtomicCmpXchgExPtr function to
-     * avoid some reads - no change. Inserting pause instructions did nothing
-     * (as expected).  The only thing which seems to make a difference is
-     * reading the pFreeTop pointer twice in the free code... This is weird or I'm
-     * overlooking something..
-     *
-     * No time to figure it out, so I'm disabling the broken code paths for
-     * now. */
-    pThis->fUseFreeList = false;
-
     *phMemCache = pThis;
     return VINF_SUCCESS;
 }
@@ -359,13 +349,14 @@ static int rtMemCacheGrow(RTMEMCACHEINT *pThis)
  */
 DECL_FORCE_INLINE(int32_t) rtMemCacheGrabObj(PRTMEMCACHEPAGE pPage)
 {
-    int32_t cFreeNew = ASMAtomicDecS32(&pPage->cFree);
-    if (cFreeNew < 0)
+    if (ASMAtomicUoReadS32(&pPage->cFree) > 0)
     {
+        int32_t cFreeNew = ASMAtomicDecS32(&pPage->cFree);
+        if (cFreeNew >= 0)
+            return cFreeNew;
         ASMAtomicIncS32(&pPage->cFree);
-        return -1;
     }
-    return cFreeNew;
+    return -1;
 }
 
 
@@ -381,21 +372,21 @@ RTDECL(int) RTMemCacheAllocEx(RTMEMCACHE hMemCache, void **ppvObj)
     PRTMEMCACHEFREEOBJ pObj = ASMAtomicUoReadPtrT(&pThis->pFreeTop, PRTMEMCACHEFREEOBJ);
     if (pObj)
     {
-        do
+        pObj = ASMAtomicXchgPtrT(&pThis->pFreeTop, NULL, PRTMEMCACHEFREEOBJ);
+        if (pObj)
         {
-            PRTMEMCACHEFREEOBJ pNext = ASMAtomicUoReadPtrT(&pObj->pNext, PRTMEMCACHEFREEOBJ);
-            PRTMEMCACHEFREEOBJ pObjOld;
-            if (ASMAtomicCmpXchgExPtr(&pThis->pFreeTop, pNext, pObj, &pObjOld))
+            if (pObj->pNext)
             {
-                Assert(pObjOld == pObj);
-                Assert(pNext != pObjOld);
-                pObj->pNext = NULL;
-                *ppvObj = pObj;
-                return VINF_SUCCESS;
+                Assert(pObj->pNext != pObj);
+                PRTMEMCACHEFREEOBJ pAllocRace = ASMAtomicXchgPtrT(&pThis->pFreeTop, pObj->pNext, PRTMEMCACHEFREEOBJ);
+                if (pAllocRace)
+                    rtMemCacheFreeList(pThis, pAllocRace);
             }
-            pObj = pObjOld;
-            ASMNopPause();
-        } while (pObj);
+
+            pObj->pNext = NULL;
+            *ppvObj = pObj;
+            return VINF_SUCCESS;
+        }
     }
 
     /*
@@ -423,7 +414,7 @@ RTDECL(int) RTMemCacheAllocEx(RTMEMCACHE hMemCache, void **ppvObj)
     /*
      * Grab a free object at the page level.
      */
-    PRTMEMCACHEPAGE pPage = ASMAtomicReadPtrT(&pThis->pPageHint, PRTMEMCACHEPAGE);
+    PRTMEMCACHEPAGE pPage = ASMAtomicUoReadPtrT(&pThis->pPageHint, PRTMEMCACHEPAGE);
     int32_t iObj = pPage ? rtMemCacheGrabObj(pPage) : -1;
     if (iObj < 0)
     {
@@ -501,6 +492,58 @@ RTDECL(void *) RTMemCacheAlloc(RTMEMCACHE hMemCache)
 }
 
 
+
+/**
+ * Really frees one object.
+ *
+ * @param   pThis               The memory cache.
+ * @param   pvObj               The memory object to free.
+ */
+static void rtMemCacheFreeOne(RTMEMCACHEINT *pThis, void *pvObj)
+{
+    /* Note: Do *NOT* attempt to poison the object! */
+
+    /*
+     * Find the cache page.  The page structure is at the start of the page.
+     */
+    PRTMEMCACHEPAGE pPage = (PRTMEMCACHEPAGE)(((uintptr_t)pvObj) & ~(uintptr_t)PAGE_OFFSET_MASK);
+    Assert(pPage->pCache == pThis);
+    Assert(ASMAtomicUoReadS32(&pPage->cFree) < (int32_t)pThis->cPerPage);
+
+    /*
+     * Clear the bitmap bit and update the two object counter. Order matters!
+     */
+    uintptr_t offObj = (uintptr_t)pvObj - (uintptr_t)pPage->pbObjects;
+    uintptr_t iObj   = offObj / pThis->cbObject;
+    Assert(iObj * pThis->cbObject == offObj);
+    Assert(iObj < pThis->cPerPage);
+    AssertReturnVoid(ASMAtomicBitTestAndClear(pPage->pbmAlloc, iObj));
+
+    ASMAtomicIncS32(&pPage->cFree);
+    ASMAtomicIncS32(&pThis->cFree);
+}
+
+
+/**
+ * Really frees a list of 'freed' object.
+ *
+ * @param   pThis               The memory cache.
+ * @param   pHead               The head of the list.
+ */
+static void rtMemCacheFreeList(RTMEMCACHEINT *pThis, PRTMEMCACHEFREEOBJ pHead)
+{
+    while (pHead)
+    {
+        PRTMEMCACHEFREEOBJ pFreeMe = pHead;
+        pHead = pHead->pNext;
+        pFreeMe->pNext = NULL;
+        ASMCompilerBarrier();
+        rtMemCacheFreeOne(pThis, pFreeMe);
+    }
+}
+
+
+
 RTDECL(void) RTMemCacheFree(RTMEMCACHE hMemCache, void *pvObj)
 {
     if (!pvObj)
@@ -513,7 +556,9 @@ RTDECL(void) RTMemCacheFree(RTMEMCACHE hMemCache, void *pvObj)
     AssertPtr(pvObj);
     Assert(RT_ALIGN_P(pvObj, pThis->cbAlignment) == pvObj);
 
-    if (pThis->fUseFreeList)
+    if (!pThis->fUseFreeList)
+        rtMemCacheFreeOne(pThis, pvObj);
+    else
     {
 # ifdef RT_STRICT
         /* This is the same as the other branch, except it's not actually freed. */
@@ -531,39 +576,10 @@ RTDECL(void) RTMemCacheFree(RTMEMCACHE hMemCache, void *pvObj)
          * Push it onto the free stack.
          */
         PRTMEMCACHEFREEOBJ pObj = (PRTMEMCACHEFREEOBJ)pvObj;
-        PRTMEMCACHEFREEOBJ pNext = ASMAtomicUoReadPtrT(&pThis->pFreeTop, PRTMEMCACHEFREEOBJ);
-        PRTMEMCACHEFREEOBJ pFreeTopOld;
-        pObj->pNext = pNext;
-        while (!ASMAtomicCmpXchgExPtr(&pThis->pFreeTop, pObj, pNext, &pFreeTopOld))
-        {
-            pNext = pFreeTopOld;
-            Assert(pNext != pObj);
-            pObj->pNext = pNext;
-            ASMNopPause();
-        }
-    }
-    else
-    {
-        /* Note: Do *NOT* attempt to poison the object! */
-
-        /*
-         * Find the cache page.  The page structure is at the start of the page.
-         */
-        PRTMEMCACHEPAGE pPage = (PRTMEMCACHEPAGE)(((uintptr_t)pvObj) & ~(uintptr_t)PAGE_OFFSET_MASK);
-        Assert(pPage->pCache == pThis);
-        Assert(ASMAtomicUoReadS32(&pPage->cFree) < (int32_t)pThis->cPerPage);
-
-        /*
-         * Clear the bitmap bit and update the two object counter. Order matters!
-         */
-        uintptr_t offObj = (uintptr_t)pvObj - (uintptr_t)pPage->pbObjects;
-        uintptr_t iObj   = offObj / pThis->cbObject;
-        Assert(iObj * pThis->cbObject == offObj);
-        Assert(iObj < pThis->cPerPage);
-        AssertReturnVoid(ASMAtomicBitTestAndClear(pPage->pbmAlloc, iObj));
-
-        ASMAtomicIncS32(&pPage->cFree);
-        ASMAtomicIncS32(&pThis->cFree);
+        pObj->pNext = ASMAtomicXchgPtrT(&pThis->pFreeTop, NULL, PRTMEMCACHEFREEOBJ);
+        PRTMEMCACHEFREEOBJ pFreeRace = ASMAtomicXchgPtrT(&pThis->pFreeTop, pObj, PRTMEMCACHEFREEOBJ);
+        if (pFreeRace)
+            rtMemCacheFreeList(pThis, pFreeRace);
     }
 }
 
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm
index 4274c30..77a0e73 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU32.asm
@@ -54,5 +54,3 @@ BEGINPROC_EXPORTED ASMAtomicUoAndU32
         ret
 ENDPROC ASMAtomicUoAndU32
 
-
-
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm
index 7f145c2..70a2cf8 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoAndU64.asm
@@ -74,4 +74,3 @@ BEGINPROC_EXPORTED ASMAtomicUoAndU64
         ret
 ENDPROC ASMAtomicUoAndU64
 
-
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoDecU32.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoDecU32.asm
new file mode 100644
index 0000000..5a95580
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoDecU32.asm
@@ -0,0 +1,56 @@
+; $Id: ASMAtomicUoDecU32.asm $
+;; @file
+; IPRT - ASMAtomicUoDecU32().
+;
+
+;
+; Copyright (C) 2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Atomically decrement an unsigned 32-bit value, unordered.
+;
+; @param    pu32     x86:esp+4   gcc:rdi  msc:rcx
+
+; @returns  the new decremented value.
+;
+BEGINPROC_EXPORTED ASMAtomicUoDecU32
+        mov     eax, -1
+%ifdef RT_ARCH_AMD64
+ %ifdef ASM_CALL64_MSC
+        xadd    [rcx], eax
+ %else
+        xadd    [rdi], eax
+ %endif
+%elifdef RT_ARCH_X86
+        mov     ecx, [esp + 04h]
+        xadd    [ecx], eax
+%endif
+        dec     eax
+        ret
+ENDPROC ASMAtomicUoDecU32
+
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoIncU32.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoIncU32.asm
new file mode 100644
index 0000000..7294a64
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoIncU32.asm
@@ -0,0 +1,56 @@
+; $Id: ASMAtomicUoIncU32.asm $
+;; @file
+; IPRT - ASMAtomicUoIncU32().
+;
+
+;
+; Copyright (C) 2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Atomically increment an unsigned 32-bit value, unordered.
+;
+; @param    pu32     x86:esp+4   gcc:rdi  msc:rcx
+;
+; @returns  the new incremented value.
+;
+BEGINPROC_EXPORTED ASMAtomicUoIncU32
+        mov     eax, 1
+%ifdef RT_ARCH_AMD64
+ %ifdef ASM_CALL64_MSC
+        xadd    [rcx], eax
+ %else
+        xadd    [rdi], eax
+ %endif
+%elifdef RT_ARCH_X86
+        mov     ecx, [esp + 04h]
+        xadd    [ecx], eax
+%endif
+        inc     eax
+        ret
+ENDPROC ASMAtomicUoIncU32
+
diff --git a/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm b/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm
index 6266a66..7c0e099 100644
--- a/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm
+++ b/src/VBox/Runtime/common/asm/ASMAtomicUoOrU32.asm
@@ -54,4 +54,3 @@ BEGINPROC_EXPORTED ASMAtomicUoOrU32
         ret
 ENDPROC ASMAtomicUoOrU32
 
-
diff --git a/src/VBox/Runtime/common/asm/ASMGetIdtrLimit.asm b/src/VBox/Runtime/common/asm/ASMGetIdtrLimit.asm
new file mode 100644
index 0000000..389bb20
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMGetIdtrLimit.asm
@@ -0,0 +1,48 @@
+; $Id: ASMGetIdtrLimit.asm $
+;; @file
+; IPRT - ASMGetIdtrLimit().
+;
+
+;
+; Copyright (C) 2006-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%define RT_ASM_WITH_SEH64
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Gets the content of the IDTR CPU register.
+; @returns  IDTR.LIMIT in ax
+;
+BEGINPROC_EXPORTED ASMGetIdtrLimit
+        sub     xSP, 18h
+        SEH64_ALLOCATE_STACK 18h
+SEH64_END_PROLOGUE
+        sidt    [xSP + 6]
+        mov     ax, [xSP + 6]
+        add     xSP, 18h
+        ret
+ENDPROC ASMGetIdtrLimit
+
diff --git a/src/VBox/Runtime/common/asm/ASMGetXcr0.asm b/src/VBox/Runtime/common/asm/ASMGetXcr0.asm
new file mode 100644
index 0000000..e14e393
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMGetXcr0.asm
@@ -0,0 +1,49 @@
+; $Id: ASMGetXcr0.asm $
+;; @file
+; IPRT - ASMGetXcr0().
+;
+
+;
+; Copyright (C) 2006-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%define RT_ASM_WITH_SEH64
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Gets the content of the XCR0 CPU register.
+; @returns XCR0 value in rax (amd64) / edx:eax (x86).
+;
+BEGINPROC_EXPORTED ASMGetXcr0
+SEH64_END_PROLOGUE
+        xor     ecx, ecx                ; XCR0
+        xgetbv
+%ifdef RT_ARCH_AMD64
+        shl     rdx, 32
+        or      rax, rdx
+%endif
+        ret
+ENDPROC ASMGetXcr0
+
diff --git a/src/VBox/Runtime/common/asm/ASMMultU32ByU32DivByU32.asm b/src/VBox/Runtime/common/asm/ASMMultU32ByU32DivByU32.asm
new file mode 100644
index 0000000..7aec907
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMMultU32ByU32DivByU32.asm
@@ -0,0 +1,64 @@
+; $Id: ASMMultU32ByU32DivByU32.asm $
+;; @file
+; IPRT - Assembly Functions, ASMMultU32ByU32DivByU32.
+;
+
+;
+; Copyright (C) 2006-2010 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "iprt/asmdefs.mac"
+
+
+;;
+; Multiple a 32-bit by a 32-bit integer and divide the result by a 32-bit integer
+; using a 64 bit intermediate result.
+;
+; @returns (u32A * u32B) / u32C.
+; @param   u32A/ecx/edi     The 32-bit value (A).
+; @param   u32B/edx/esi     The 32-bit value to multiple by A.
+; @param   u32C/r8d/edx     The 32-bit value to divide A*B by.
+;
+; @cproto  DECLASM(uint32_t) ASMMultU32ByU32DivByU32(uint32_t u32A, uint32_t u32B, uint32_t u32C);
+;
+BEGINPROC_EXPORTED ASMMultU32ByU32DivByU32
+%ifdef RT_ARCH_AMD64
+ %ifdef ASM_CALL64_MSC
+        mov     eax, ecx
+        mul     edx
+        div     r8d
+ %else
+        mov     eax, edi
+        mov     ecx, edx
+        mul     esi
+        div     ecx
+ %endif
+
+%elifdef RT_ARCH_X86
+        mov     eax, [esp + 04h]
+        mul     dword [esp + 08h]
+        div     dword [esp + 0ch]
+%else
+ %error "Unsupported arch."
+ unsupported arch
+%endif
+
+        ret
+ENDPROC ASMMultU32ByU32DivByU32
diff --git a/src/VBox/Runtime/common/asm/ASMSetGDTR.asm b/src/VBox/Runtime/common/asm/ASMSetGDTR.asm
new file mode 100644
index 0000000..bed159d
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMSetGDTR.asm
@@ -0,0 +1,52 @@
+; $Id: ASMSetGDTR.asm $
+;; @file
+; IPRT - ASMSetGDTR().
+;
+
+;
+; Copyright (C) 2006-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Sets the content of the GDTR CPU register.
+; @param   pGdtr    Where to load the GDTR contents from.
+;                   msc=rcx, gcc=rdi, x86=[esp+4]
+;
+BEGINPROC_EXPORTED ASMSetGDTR
+%ifdef ASM_CALL64_MSC
+        mov     rax, rcx
+%elifdef ASM_CALL64_GCC
+        mov     rax, rdi
+%elifdef RT_ARCH_X86
+        mov     eax, [esp + 4]
+%else
+ %error "Undefined arch?"
+%endif
+        lgdt    [xAX]
+        ret
+ENDPROC ASMSetGDTR
+
diff --git a/src/VBox/Runtime/common/asm/ASMSetIDTR.asm b/src/VBox/Runtime/common/asm/ASMSetIDTR.asm
new file mode 100644
index 0000000..da42014
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMSetIDTR.asm
@@ -0,0 +1,52 @@
+; $Id: ASMSetIDTR.asm $
+;; @file
+; IPRT - ASMSetIDTR().
+;
+
+;
+; Copyright (C) 2006-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Sets the content of the IDTR CPU register.
+; @param   pIdtr    Where to load the IDTR contents from.
+;                   msc=rcx, gcc=rdi, x86=[esp+4]
+;
+BEGINPROC_EXPORTED ASMSetIDTR
+%ifdef ASM_CALL64_MSC
+        mov     rax, rcx
+%elifdef ASM_CALL64_GCC
+        mov     rax, rdi
+%elifdef RT_ARCH_X86
+        mov     eax, [esp + 4]
+%else
+ %error "Undefined arch?"
+%endif
+        lidt    [xAX]
+        ret
+ENDPROC ASMSetIDTR
+
diff --git a/src/VBox/Runtime/common/asm/ASMSetXcr0.asm b/src/VBox/Runtime/common/asm/ASMSetXcr0.asm
new file mode 100644
index 0000000..fcc73c3
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMSetXcr0.asm
@@ -0,0 +1,60 @@
+; $Id: ASMSetXcr0.asm $
+;; @file
+; IPRT - ASMSetXcr0().
+;
+
+;
+; Copyright (C) 2006-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%define RT_ASM_WITH_SEH64
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Sets the content of the Xcr0 CPU register.
+; @param   uXcr0    The new XCR0 content.
+;                   msc=rcx, gcc=rdi, x86=[esp+4]
+;
+BEGINPROC_EXPORTED ASMSetXcr0
+SEH64_END_PROLOGUE
+%ifdef ASM_CALL64_MSC
+        mov     rdx, rcx
+        shr     rdx, 32
+        mov     eax, ecx
+%elifdef ASM_CALL64_GCC
+        mov     rdx, rdi
+        shr     rdx, 32
+        mov     eax, edi
+%elifdef RT_ARCH_X86
+        mov     eax, [esp + 4]
+        mov     edx, [esp + 8]
+%else
+ %error "Undefined arch?"
+%endif
+        xor     ecx, ecx
+        xsetbv
+        ret
+ENDPROC ASMSetXcr0
+
diff --git a/src/VBox/Runtime/common/asm/ASMXRstor.asm b/src/VBox/Runtime/common/asm/ASMXRstor.asm
new file mode 100644
index 0000000..dbb857f
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMXRstor.asm
@@ -0,0 +1,63 @@
+; $Id: ASMXRstor.asm $
+;; @file
+; IPRT - ASMXRstor().
+;
+
+;
+; Copyright (C) 2006-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%define RT_ASM_WITH_SEH64
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Loads extended CPU state.
+; @param    pXStateArea Pointer to the XRSTOR state area.
+;                       msc=rcx, gcc=rdi, x86=[esp+4]
+; @param    fMask       The 64-bit state component mask.
+;                       msc=rdx, gcc=rsi, x86=[esp+8]
+;
+BEGINPROC_EXPORTED ASMXRstor
+SEH64_END_PROLOGUE
+%ifdef ASM_CALL64_MSC
+        mov     eax, edx
+        shr     rdx, 32
+        xrstor  [rcx]
+%elifdef ASM_CALL64_GCC
+        mov     rdx, rsi
+        shr     rdx, 32
+        mov     eax, esi
+        xrstor  [rdi]
+%elifdef RT_ARCH_X86
+        mov     ecx, [esp + 4]
+        mov     eax, [esp + 8]
+        mov     edx, [esp + 12]
+        xrstor  [ecx]
+%else
+ %error "Undefined arch?"
+%endif
+        ret
+ENDPROC ASMXRstor
+
diff --git a/src/VBox/Runtime/common/asm/ASMXSave.asm b/src/VBox/Runtime/common/asm/ASMXSave.asm
new file mode 100644
index 0000000..f0d8842
--- /dev/null
+++ b/src/VBox/Runtime/common/asm/ASMXSave.asm
@@ -0,0 +1,63 @@
+; $Id: ASMXSave.asm $
+;; @file
+; IPRT - ASMXSave().
+;
+
+;
+; Copyright (C) 2006-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%define RT_ASM_WITH_SEH64
+%include "iprt/asmdefs.mac"
+
+BEGINCODE
+
+;;
+; Saves extended CPU state.
+; @param    pXStateArea Pointer to the XSAVE state area.
+;                       msc=rcx, gcc=rdi, x86=[esp+4]
+; @param    fComponents The 64-bit state component mask.
+;                       msc=rdx, gcc=rsi, x86=[esp+8]
+;
+BEGINPROC_EXPORTED ASMXSave
+SEH64_END_PROLOGUE
+%ifdef ASM_CALL64_MSC
+        mov     eax, edx
+        shr     rdx, 32
+        xsave   [rcx]
+%elifdef ASM_CALL64_GCC
+        mov     rdx, rsi
+        shr     rdx, 32
+        mov     eax, esi
+        xsave   [rdi]
+%elifdef RT_ARCH_X86
+        mov     ecx, [esp + 4]
+        mov     eax, [esp + 8]
+        mov     edx, [esp + 12]
+        xsave   [ecx]
+%else
+ %error "Undefined arch?"
+%endif
+        ret
+ENDPROC ASMXSave
+
diff --git a/src/VBox/Runtime/common/asn1/asn1-ut-time-template.h b/src/VBox/Runtime/common/asn1/asn1-ut-time-template.h
index 9b371c6..abe26d1 100644
--- a/src/VBox/Runtime/common/asn1/asn1-ut-time-template.h
+++ b/src/VBox/Runtime/common/asn1/asn1-ut-time-template.h
@@ -43,4 +43,3 @@ RTASN1TMPL_SET_OF(RTASN1TIME, RTAsn1Time);
 #undef RTASN1TMPL_EXT_NAME
 #undef RTASN1TMPL_INT_NAME
 
-
diff --git a/src/VBox/Runtime/common/checksum/RTSha256Digest.cpp b/src/VBox/Runtime/common/checksum/RTSha256Digest.cpp
index cfc25a0..a68a5b8 100644
--- a/src/VBox/Runtime/common/checksum/RTSha256Digest.cpp
+++ b/src/VBox/Runtime/common/checksum/RTSha256Digest.cpp
@@ -1,3 +1,4 @@
+/* $Id: RTSha256Digest.cpp $ */
 /** @file
  * IPRT - SHA256 digest creation
  *
diff --git a/src/VBox/Runtime/common/checksum/alt-sha1.cpp b/src/VBox/Runtime/common/checksum/alt-sha1.cpp
index 2c499fa..7ecab09 100644
--- a/src/VBox/Runtime/common/checksum/alt-sha1.cpp
+++ b/src/VBox/Runtime/common/checksum/alt-sha1.cpp
@@ -498,4 +498,3 @@ RTDECL(void) RTSha1(const void *pvBuf, size_t cbBuf, uint8_t pabDigest[RTSHA1_HA
 }
 RT_EXPORT_SYMBOL(RTSha1);
 
-
diff --git a/src/VBox/Runtime/common/checksum/crc32c.cpp b/src/VBox/Runtime/common/checksum/crc32c.cpp
new file mode 100644
index 0000000..ea4e7ea
--- /dev/null
+++ b/src/VBox/Runtime/common/checksum/crc32c.cpp
@@ -0,0 +1,122 @@
+/* $Id: crc32c.cpp $ */
+/** @file
+ * IPRT - CRC32C.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#include <iprt/crc.h>
+#include "internal/iprt.h"
+
+/**
+ * Generated using the pycrc tool using model crc-32c.
+ */
+static uint32_t const g_au32Crc32C[] =
+{
+    0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, 0xc79a971f, 0x35f1141c,
+    0x26a1e7e8, 0xd4ca64eb, 0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b,
+    0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24, 0x105ec76f, 0xe235446c,
+    0xf165b798, 0x030e349b, 0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384,
+    0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54, 0x5d1d08bf, 0xaf768bbc,
+    0xbc267848, 0x4e4dfb4b, 0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a,
+    0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35, 0xaa64d611, 0x580f5512,
+    0x4b5fa6e6, 0xb93425e5, 0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa,
+    0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45, 0xf779deae, 0x05125dad,
+    0x1642ae59, 0xe4292d5a, 0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a,
+    0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595, 0x417b1dbc, 0xb3109ebf,
+    0xa0406d4b, 0x522bee48, 0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957,
+    0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687, 0x0c38d26c, 0xfe53516f,
+    0xed03a29b, 0x1f682198, 0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927,
+    0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38, 0xdbfc821c, 0x2997011f,
+    0x3ac7f2eb, 0xc8ac71e8, 0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7,
+    0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096, 0xa65c047d, 0x5437877e,
+    0x4767748a, 0xb50cf789, 0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859,
+    0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46, 0x7198540d, 0x83f3d70e,
+    0x90a324fa, 0x62c8a7f9, 0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6,
+    0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36, 0x3cdb9bdd, 0xceb018de,
+    0xdde0eb2a, 0x2f8b6829, 0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c,
+    0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93, 0x082f63b7, 0xfa44e0b4,
+    0xe9141340, 0x1b7f9043, 0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c,
+    0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3, 0x55326b08, 0xa759e80b,
+    0xb4091bff, 0x466298fc, 0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c,
+    0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033, 0xa24bb5a6, 0x502036a5,
+    0x4370c551, 0xb11b4652, 0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d,
+    0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d, 0xef087a76, 0x1d63f975,
+    0x0e330a81, 0xfc588982, 0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d,
+    0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622, 0x38cc2a06, 0xcaa7a905,
+    0xd9f75af1, 0x2b9cd9f2, 0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed,
+    0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530, 0x0417b1db, 0xf67c32d8,
+    0xe52cc12c, 0x1747422f, 0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff,
+    0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0, 0xd3d3e1ab, 0x21b862a8,
+    0x32e8915c, 0xc083125f, 0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540,
+    0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90, 0x9e902e7b, 0x6cfbad78,
+    0x7fab5e8c, 0x8dc0dd8f, 0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee,
+    0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1, 0x69e9f0d5, 0x9b8273d6,
+    0x88d28022, 0x7ab90321, 0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e,
+    0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81, 0x34f4f86a, 0xc69f7b69,
+    0xd5cf889d, 0x27a40b9e, 0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e,
+    0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351
+};
+
+
+DECLINLINE(uint32_t) rtCrc32ProcessWithTable(const uint32_t *pau32Crc32,
+                                             uint32_t uCrc32, const void *pv, size_t cb)
+{
+    const uint8_t  *pu8 = (const uint8_t *)pv;
+
+    while (cb--)
+        uCrc32 = pau32Crc32[(uCrc32 ^ *pu8++) & 0xff] ^ (uCrc32 >> 8);
+
+    return uCrc32;
+}
+
+
+RTDECL(uint32_t) RTCrc32CStart(void)
+{
+    return ~0U;
+}
+RT_EXPORT_SYMBOL(RTCrc32Start);
+
+
+RTDECL(uint32_t) RTCrc32CFinish(uint32_t uCRC32)
+{
+    return uCRC32 ^ ~0U;
+}
+RT_EXPORT_SYMBOL(RTCrc32Finish);
+
+
+RTDECL(uint32_t) RTCrc32C(const void *pv, size_t cb)
+{
+    uint32_t uCrc32C = RTCrc32Start();
+
+    uCrc32C = rtCrc32ProcessWithTable(g_au32Crc32C, uCrc32C, pv, cb);
+    return RTCrc32Finish(uCrc32C);
+}
+RT_EXPORT_SYMBOL(RTCrc32C);
+
+
+RTDECL(uint32_t) RTCrc32CProcess(uint32_t uCrc32C, const void *pv, size_t cb)
+{
+    return rtCrc32ProcessWithTable(g_au32Crc32C, uCrc32C, pv, cb);;
+}
+RT_EXPORT_SYMBOL(RTCrc32CProcess);
+
diff --git a/src/VBox/Runtime/common/checksum/manifest3.cpp b/src/VBox/Runtime/common/checksum/manifest3.cpp
index 9ff67f2..fbdfc7e 100644
--- a/src/VBox/Runtime/common/checksum/manifest3.cpp
+++ b/src/VBox/Runtime/common/checksum/manifest3.cpp
@@ -427,7 +427,7 @@ RTDECL(int) RTManifestEntryAddPassthruIoStream(RTMANIFEST hManifest, RTVFSIOSTRE
     uint32_t cRefs = RTManifestRetain(hManifest);
     AssertReturn(cRefs != UINT32_MAX, VERR_INVALID_HANDLE);
     cRefs = RTVfsIoStrmRetain(hVfsIos);
-    AssertReturnStmt(cRefs != UINT32_MAX, VERR_INVALID_HANDLE, RTManifestRelease(hManifest));
+    AssertReturnStmt(cRefs != UINT32_MAX, RTManifestRelease(hManifest), VERR_INVALID_HANDLE);
 
     /*
      * Create an instace of the passthru I/O stream.
diff --git a/src/VBox/Runtime/common/checksum/openssl-sha512.cpp b/src/VBox/Runtime/common/checksum/openssl-sha512.cpp
index 9f3ad45..6f70a38 100644
--- a/src/VBox/Runtime/common/checksum/openssl-sha512.cpp
+++ b/src/VBox/Runtime/common/checksum/openssl-sha512.cpp
@@ -107,4 +107,3 @@ RTDECL(void) RTSha384Final(PRTSHA384CONTEXT pCtx, uint8_t pabDigest[32])
 }
 RT_EXPORT_SYMBOL(RTSha384Final);
 
-
diff --git a/src/VBox/Runtime/common/checksum/x509.cpp b/src/VBox/Runtime/common/checksum/x509.cpp
new file mode 100644
index 0000000..a4c9f95
--- /dev/null
+++ b/src/VBox/Runtime/common/checksum/x509.cpp
@@ -0,0 +1,400 @@
+/* $Id: x509.cpp $ */
+/** @file
+ * IPRT - X509 functions.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "internal/iprt.h"
+#include <iprt/x509-branch-collision.h>
+
+#include <iprt/assert.h>
+#include <iprt/mem.h>
+#include <iprt/err.h>
+#include <iprt/sha.h>
+#include <iprt/manifest.h>
+#include <iprt/string.h>
+
+#include <openssl/bio.h>
+#include <openssl/err.h>
+#include <openssl/pem.h>
+#include <openssl/x509.h>
+#include <openssl/x509v3.h>
+
+
+/**
+ * Preparation before start to work with openssl
+ *
+ * @returns IPRT status code.
+ */
+RTDECL(int) RTX509PrepareOpenSSL(void)
+{
+    OpenSSL_add_all_digests();
+    ERR_load_BIO_strings();
+    ERR_load_crypto_strings();
+    return VINF_SUCCESS;
+}
+RT_EXPORT_SYMBOL(RTX509PrepareOpenSSL);
+
+
+/**
+ * Read X509 certificate from the given memory buffer into the internal
+ * structure.
+ *
+ * @returns IPRT status code.
+ *
+ * @param   pvBuf           String representation containing X509
+ *                          certificate in PEM format.
+ * @param   cbBuf           The amount of data @a pvBuf points to.
+ * @param   ppOutCert       Where to store the pointer to the structure where
+ *                          the info about X509 certificate will be stored.
+ */
+static int rtX509ReadCertificateFromPEM(void const *pvPem, unsigned int cbPem, X509 **ppOutCert)
+{
+    BIO *pBio = BIO_new(BIO_s_mem());
+    if (!pBio)
+        return VERR_NO_MEMORY;
+
+    int cb = BIO_write(pBio, pvPem, cbPem);
+    *ppOutCert = PEM_read_bio_X509(pBio, NULL, 0, NULL);
+    BIO_free(pBio);
+
+    return *ppOutCert ? VINF_SUCCESS : VERR_X509_READING_CERT_FROM_BIO;
+}
+
+
+/**
+ * Convert X509 certificate from string to binary representation
+ *
+ * @returns iprt status code.
+ *
+ * @param   pvBuf                 string representation
+ *                                containing X509 certificate
+ *                                in PEM format
+ * @param   pOutSignature         memory buffer where the binary
+ *                                representation will be stored
+ * @param   lengthOfSignature     length of X509 certificate in
+ *                                binary representation
+ */
+static int RTX509ConvertCertificateToBinary(void *pvBuf, unsigned char** pOutSignature, unsigned int* lengthOfSignature)
+{
+    int rc = VINF_SUCCESS;
+
+    char* beginSignatureStr = RTStrStr((char*)pvBuf, "=");
+    beginSignatureStr+=2;
+    char* endSignatureStr = RTStrStr((char*)pvBuf, "-----BEGIN CERTIFICATE-----");
+    --endSignatureStr;
+    *lengthOfSignature = (endSignatureStr - beginSignatureStr)/2;//two hex digits in one byte
+    *pOutSignature = (unsigned char *)RTMemAlloc(*lengthOfSignature);
+
+    rc = RTStrConvertHexBytes(beginSignatureStr, *pOutSignature, *lengthOfSignature, 0);
+
+    if (RT_FAILURE(rc))
+    {
+        RTMemFree(*pOutSignature);
+        *pOutSignature = NULL;
+    }
+    return rc;
+}
+
+/**
+ * Convert digest from string to binary representation
+ *
+ * @returns iprt status code.
+ *
+ * @param   digest                string representation
+ * @param   pOutDigest            memory buffer where the binary
+ *                                representation will be stored
+ * @param   digestType            Type of digest
+ * @param   lengthOfDigest        length of digest in binary
+ *                                representation
+ */
+static int RTConvertDigestToBinary(const char* digest,
+                                    unsigned char** pOutDigest,
+                                    RTDIGESTTYPE digestType,
+                                    unsigned int* lengthOfDigest)
+{
+    int rc = VINF_SUCCESS;
+
+    if(digestType == RTDIGESTTYPE_SHA1)
+    {
+        *lengthOfDigest = RTSHA1_HASH_SIZE;
+        *pOutDigest = (unsigned char *)RTMemAlloc(RTSHA1_HASH_SIZE);
+        rc = RTStrConvertHexBytes(digest, *pOutDigest, RTSHA1_HASH_SIZE, 0);
+    }
+    else if(digestType == RTDIGESTTYPE_SHA256)
+    {
+        *lengthOfDigest = RTSHA256_HASH_SIZE;
+        *pOutDigest = (unsigned char *)RTMemAlloc(RTSHA256_HASH_SIZE);
+        rc = RTStrConvertHexBytes(digest, *pOutDigest, RTSHA256_HASH_SIZE, 0);
+    }
+    else
+    {
+        rc = VERR_MANIFEST_UNSUPPORTED_DIGEST_TYPE;
+    }
+
+    if (RT_FAILURE(rc))
+    {
+        if(*pOutDigest != NULL)
+            RTMemFree(*pOutDigest);
+        *pOutDigest = NULL;
+    }
+
+    return rc;
+}
+
+RTDECL(int) RTRSAVerify(void *pvBuf, unsigned int cbSize, const char* pManifestDigestIn, RTDIGESTTYPE digestType)
+{
+    int rc = VINF_SUCCESS;
+    unsigned char* pSignatureRSA = NULL;
+    unsigned char* pManifestDigestOut = NULL;
+    X509 *certificate = NULL;
+    EVP_PKEY * evp_key = NULL;
+    RSA * rsa_key = NULL;
+
+    while(1)
+    {
+        unsigned int siglen = 0;
+        rc = RTX509ConvertCertificateToBinary(pvBuf, &pSignatureRSA, &siglen);
+        if (RT_FAILURE(rc))
+        {
+            /*pSignatureRSA isn't allocated in this case, thus there is no need to free it*/
+            break;
+        }
+
+        unsigned int diglen = 0;
+        rc = RTConvertDigestToBinary(pManifestDigestIn,&pManifestDigestOut, digestType, &diglen);
+        if (RT_FAILURE(rc))
+        {
+            /*pManifestDigestOut isn't allocated in this case, thus there is no need to free it*/
+            break;
+        }
+
+        rc = rtX509ReadCertificateFromPEM(pvBuf, cbSize, &certificate);
+        if (RT_FAILURE(rc))
+        {
+            /*memory for certificate isn't allocated in this case, thus there is no need to free it*/
+            break;
+        }
+
+        evp_key = X509_get_pubkey(certificate);
+        if (evp_key == NULL)
+        {
+            rc = VERR_X509_EXTRACT_PUBKEY_FROM_CERT;
+            break;
+        }
+
+        rsa_key = EVP_PKEY_get1_RSA(evp_key);
+        if (rsa_key == NULL)
+        {
+            rc = VERR_X509_EXTRACT_RSA_FROM_PUBLIC_KEY;
+            break;
+        }
+
+        rc = RSA_verify(NID_sha1,
+                        pManifestDigestOut,
+                        diglen,
+                        pSignatureRSA,
+                        siglen,
+                        rsa_key);
+
+        if (rc != 1)
+        {
+            rc = VERR_X509_RSA_VERIFICATION_FUILURE;
+        }
+
+        break;
+    }//end while(1)
+
+    if(rsa_key)
+        RSA_free(rsa_key);
+    if(evp_key)
+        EVP_PKEY_free(evp_key);
+    if(certificate)
+        X509_free(certificate);
+    if (pManifestDigestOut)
+        RTMemFree(pManifestDigestOut);
+    if (pSignatureRSA)
+        RTMemFree(pSignatureRSA);
+
+    return rc;
+}
+RT_EXPORT_SYMBOL(RTRSAVerify);
+
+/**
+ * Get X509 certificate basic constraints
+ *
+ * @returns iprt status code.
+ *
+ * @param   pvBuf                 string representation
+ *                                containing X509 certificate
+ *                                in PEM format
+ * @param   cbSize                The amount of data (in bytes)
+ * @param   pBasicConstraintsOut  memory buffer where the
+ *                                extracted basic constraints
+ *                                will be stored in string
+ *                                representation
+ */
+static int RTX509GetBasicConstraints(void *pvBuf, unsigned int cbSize, unsigned char** pBasicConstraintsOut)
+{
+    int rc = VINF_SUCCESS;
+    BUF_MEM *bptr = NULL;
+    X509 *certificate = NULL;
+    char *errDesc = NULL;
+    BIO *bio_memory = NULL;
+
+    for (;;)
+    {
+        rc = rtX509ReadCertificateFromPEM(pvBuf, cbSize, &certificate);
+        int loc = X509_get_ext_by_NID(certificate, NID_basic_constraints,-1);
+
+        if(loc == -1)
+        {
+            rc = VERR_X509_NO_BASIC_CONSTARAINTS;
+            break;
+        }
+
+        X509_EXTENSION *ext = X509_get_ext(certificate, loc);
+        if(!ext)
+        {
+            rc = VERR_X509_GETTING_EXTENSION_FROM_CERT;
+            break;
+        }
+
+        ASN1_OCTET_STRING *extdata = X509_EXTENSION_get_data(ext);
+        if(!extdata)
+        {
+            rc = VERR_X509_GETTING_DATA_FROM_EXTENSION;
+            break;
+        }
+
+        bio_memory = BIO_new(BIO_s_mem());
+        if(!X509V3_EXT_print(bio_memory, ext, 0, 0))
+        {
+            rc = VERR_X509_PRINT_EXTENSION_TO_BIO;
+            break;
+        }
+        BIO_ctrl(bio_memory,BIO_CTRL_FLUSH,0,NULL);
+        BIO_ctrl(bio_memory,BIO_C_GET_BUF_MEM_PTR,0,(void *)&bptr);
+
+        // now bptr contains the strings of the key_usage
+        unsigned char *buf = (unsigned char *)RTMemAlloc((bptr->length + 1)*sizeof(char));
+        memcpy(buf, bptr->data, bptr->length);
+        // take care that bptr->data is NOT NULL terminated, so add '\0'
+        buf[bptr->length] = '\0';
+
+        *pBasicConstraintsOut = buf;
+
+        break;
+    }
+
+    if(certificate)
+        X509_free(certificate);
+
+    BIO_free(bio_memory);
+
+    return rc;
+}
+
+RTDECL(int) RTX509CertificateVerify(void *pvBuf, unsigned int cbSize)
+{
+    int rc = VINF_SUCCESS;
+
+    X509 *certificate = NULL;
+    X509_NAME * subject = NULL;
+    X509_NAME * issuer = NULL;
+    EVP_PKEY * evp_key = NULL;
+    unsigned char* strBasicConstraints =  NULL;
+
+    while(1)
+    {
+        rc = rtX509ReadCertificateFromPEM(pvBuf, cbSize, &certificate);
+        if (RT_FAILURE(rc))
+        {
+            break;
+        }
+
+        rc = RTX509GetBasicConstraints(pvBuf, cbSize, &strBasicConstraints);
+        if (RT_FAILURE(rc))
+        {
+            break;
+        }
+
+        issuer = X509_get_issuer_name(certificate);
+
+        if(strcmp("CA:TRUE", (const char*)strBasicConstraints) == 0)
+        {
+            subject = X509_get_subject_name(certificate);
+            int ki=0;
+
+            if(X509_name_cmp(issuer, subject) == 0)
+            {
+                evp_key = X509_get_pubkey(certificate);
+                ki=X509_verify(certificate,evp_key);
+                if(ki>0)
+                {
+                    /* if it's needed will do something with the verified certificate */
+                }
+                else
+                    rc = VERR_X509_CERTIFICATE_VERIFICATION_FAILURE;
+            }
+            else
+            {
+                rc = VINF_X509_NOT_SELFSIGNED_CERTIFICATE;
+            }
+        }
+        else
+        {
+            rc = VINF_X509_NOT_SELFSIGNED_CERTIFICATE;
+        }
+
+        break;
+    }
+
+    if(certificate)
+        X509_free(certificate);
+    if(evp_key)
+        EVP_PKEY_free(evp_key);
+
+    RTMemFree(strBasicConstraints);
+
+    return rc;
+}
+RT_EXPORT_SYMBOL(RTX509CertificateVerify);
+
+
+RTDECL(unsigned long) RTX509GetErrorDescription(char** pErrorDesc)
+{
+    char *errorDescription = (char *)RTMemAlloc(256);// buffer must be at least 120 bytes long.
+                                             // see http://www.openssl.org/docs/crypto/ERR_error_string.html
+    unsigned long err = ERR_get_error();
+    ERR_error_string(err, errorDescription);
+
+    *pErrorDesc = errorDescription;
+
+    return err;
+}
+RT_EXPORT_SYMBOL(RTX509GetError);
diff --git a/src/VBox/Runtime/common/crypto/pkcs7-init.cpp b/src/VBox/Runtime/common/crypto/pkcs7-init.cpp
index a602225..8bc966f 100644
--- a/src/VBox/Runtime/common/crypto/pkcs7-init.cpp
+++ b/src/VBox/Runtime/common/crypto/pkcs7-init.cpp
@@ -50,4 +50,3 @@ static int rtCrPkcs7ContentInfo_CloneExtra(PRTCRPKCS7CONTENTINFO pThis)
  */
 #include <iprt/asn1-generator-init.h>
 
-
diff --git a/src/VBox/Runtime/common/crypto/pkix-signature-builtin.cpp b/src/VBox/Runtime/common/crypto/pkix-signature-builtin.cpp
index 1897550..b51e93c 100644
--- a/src/VBox/Runtime/common/crypto/pkix-signature-builtin.cpp
+++ b/src/VBox/Runtime/common/crypto/pkix-signature-builtin.cpp
@@ -136,4 +136,3 @@ RTDECL(int) RTCrPkixSignatureCreateByObjId(PRTCRPKIXSIGNATURE phSignature, PCRTA
     return VERR_NOT_FOUND;
 }
 
-
diff --git a/src/VBox/Runtime/common/crypto/rsa-internal.h b/src/VBox/Runtime/common/crypto/rsa-internal.h
index 95c3bcd..696aba4 100644
--- a/src/VBox/Runtime/common/crypto/rsa-internal.h
+++ b/src/VBox/Runtime/common/crypto/rsa-internal.h
@@ -36,4 +36,3 @@
 
 #endif
 
-
diff --git a/src/VBox/Runtime/common/crypto/rsa-template.h b/src/VBox/Runtime/common/crypto/rsa-template.h
index e60a0de..5199654 100644
--- a/src/VBox/Runtime/common/crypto/rsa-template.h
+++ b/src/VBox/Runtime/common/crypto/rsa-template.h
@@ -106,4 +106,3 @@ RTASN1TMPL_END_SEQCORE();
 #undef RTASN1TMPL_EXT_NAME
 #undef RTASN1TMPL_INT_NAME
 
-
diff --git a/src/VBox/Runtime/common/crypto/spc-init.cpp b/src/VBox/Runtime/common/crypto/spc-init.cpp
index ea1e3db..1775258 100644
--- a/src/VBox/Runtime/common/crypto/spc-init.cpp
+++ b/src/VBox/Runtime/common/crypto/spc-init.cpp
@@ -43,4 +43,3 @@
  */
 #include <iprt/asn1-generator-init.h>
 
-
diff --git a/src/VBox/Runtime/common/crypto/spc-sanity.cpp b/src/VBox/Runtime/common/crypto/spc-sanity.cpp
index 3d838d7..cd40719 100644
--- a/src/VBox/Runtime/common/crypto/spc-sanity.cpp
+++ b/src/VBox/Runtime/common/crypto/spc-sanity.cpp
@@ -165,4 +165,3 @@ RTDECL(int) RTCrSpcIndirectDataContent_CheckSanityEx(PCRTCRSPCINDIRECTDATACONTEN
  */
 #include <iprt/asn1-generator-sanity.h>
 
-
diff --git a/src/VBox/Runtime/common/crypto/tsp-core.cpp b/src/VBox/Runtime/common/crypto/tsp-core.cpp
index bd1c250..30143d6 100644
--- a/src/VBox/Runtime/common/crypto/tsp-core.cpp
+++ b/src/VBox/Runtime/common/crypto/tsp-core.cpp
@@ -39,4 +39,3 @@
  */
 #include <iprt/asn1-generator-core.h>
 
-
diff --git a/src/VBox/Runtime/common/crypto/tsp-sanity.cpp b/src/VBox/Runtime/common/crypto/tsp-sanity.cpp
index f81210c..ac1bccf 100644
--- a/src/VBox/Runtime/common/crypto/tsp-sanity.cpp
+++ b/src/VBox/Runtime/common/crypto/tsp-sanity.cpp
@@ -39,4 +39,3 @@
  */
 #include <iprt/asn1-generator-sanity.h>
 
-
diff --git a/src/VBox/Runtime/common/crypto/x509-core.cpp b/src/VBox/Runtime/common/crypto/x509-core.cpp
index 3b5c511..212b77d 100644
--- a/src/VBox/Runtime/common/crypto/x509-core.cpp
+++ b/src/VBox/Runtime/common/crypto/x509-core.cpp
@@ -1531,4 +1531,3 @@ RTCrX509Certificates_FindByIssuerAndSerialNumber(PCRTCRX509CERTIFICATES pCertifi
     return NULL;
 }
 
-
diff --git a/src/VBox/Runtime/common/dbg/dbgcfg.cpp b/src/VBox/Runtime/common/dbg/dbgcfg.cpp
index 63a13c9..1d497c1 100644
--- a/src/VBox/Runtime/common/dbg/dbgcfg.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgcfg.cpp
@@ -183,6 +183,66 @@ static const RTDBGCFGU64MNEMONIC g_aDbgCfgFlags[] =
 };
 
 
+/** Interesting bundle suffixes. */
+static const char * const g_apszBundleSuffixes[] =
+{
+    ".kext",
+    ".app",
+    ".framework",
+    ".component",
+    ".action",
+    ".caction",
+    ".bundle",
+    ".sourcebundle",
+    ".menu",
+    ".plugin",
+    ".ppp",
+    ".monitorpanel",
+    ".scripting",
+    ".prefPane",
+    ".qlgenerator",
+    ".brailledriver",
+    ".saver",
+    ".SpeechVoice",
+    ".SpeechRecognizer",
+    ".SpeechSynthesizer",
+    ".mdimporter",
+    ".spreporter",
+    ".xpc",
+    NULL
+};
+
+/** Debug bundle suffixes. (Same as above + .dSYM) */
+static const char * const g_apszDSymBundleSuffixes[] =
+{
+    ".dSYM",
+    ".kext.dSYM",
+    ".app.dSYM",
+    ".framework.dSYM",
+    ".component.dSYM",
+    ".action.dSYM",
+    ".caction.dSYM",
+    ".bundle.dSYM",
+    ".sourcebundle.dSYM",
+    ".menu.dSYM",
+    ".plugin.dSYM",
+    ".ppp.dSYM",
+    ".monitorpanel.dSYM",
+    ".scripting.dSYM",
+    ".prefPane.dSYM",
+    ".qlgenerator.dSYM",
+    ".brailledriver.dSYM",
+    ".saver.dSYM",
+    ".SpeechVoice.dSYM",
+    ".SpeechRecognizer.dSYM",
+    ".SpeechSynthesizer.dSYM",
+    ".mdimporter.dSYM",
+    ".spreporter.dSYM",
+    ".xpc.dSYM",
+    NULL
+};
+
+
 
 /**
  * Runtime logging, level 1.
@@ -256,44 +316,53 @@ static int rtDbgCfgIsFsCaseInsensitive(const char *pszPath)
  * Worker that does case sensitive file/dir searching.
  *
  * @returns true / false.
- * @param   pszPath         The path buffer containing an existing directory.
- *                          RTPATH_MAX in size.  On success, this will contain
- *                          the combined path with @a pszName case correct.
+ * @param   pszPath         The path buffer containing an existing directory and
+ *                          at @a offLastComp the name we're looking for.
+ *                          RTPATH_MAX in size.  On success, this last component
+ *                          will have the correct case.  On failure, the last
+ *                          component is stripped off.
  * @param   offLastComp     The offset of the last component (for chopping it
  *                          off).
- * @param   pszName         What we're looking for.
  * @param   enmType         What kind of thing we're looking for.
  */
-static bool rtDbgCfgIsXxxxAndFixCaseWorker(char *pszPath, size_t offLastComp, const char *pszName,
-                                           RTDIRENTRYTYPE enmType)
+static bool rtDbgCfgIsXxxxAndFixCaseWorker(char *pszPath, size_t offLastComp, RTDIRENTRYTYPE enmType)
 {
     /** @todo IPRT should generalize this so we can use host specific tricks to
      *        speed it up. */
 
+    char *pszName = &pszPath[offLastComp];
+
     /* Return straight away if the name isn't case foldable. */
     if (!RTStrIsCaseFoldable(pszName))
+    {
+        *pszName = '\0';
         return false;
+    }
 
     /*
      * Try some simple case folding games.
      */
-    RTStrToLower(&pszPath[offLastComp]);
+    RTStrToLower(pszName);
     if (RTFileExists(pszPath))
         return true;
 
-    RTStrToUpper(&pszPath[offLastComp]);
+    RTStrToUpper(pszName);
     if (RTFileExists(pszPath))
         return true;
 
     /*
      * Open the directory and check each entry in it.
      */
-    pszPath[offLastComp] = '\0';
+    char chSaved = *pszName;
+    *pszName = '\0';
+
     PRTDIR pDir;
     int rc = RTDirOpen(&pDir, pszPath);
     if (RT_FAILURE(rc))
         return false;
 
+    *pszName = chSaved;
+
     for (;;)
     {
         /* Read the next entry. */
@@ -312,28 +381,19 @@ static bool rtDbgCfgIsXxxxAndFixCaseWorker(char *pszPath, size_t offLastComp, co
                 || u.Entry.enmType == RTDIRENTRYTYPE_UNKNOWN
                 || u.Entry.enmType == RTDIRENTRYTYPE_SYMLINK) )
         {
-            pszPath[offLastComp] = '\0';
-            rc = RTPathAppend(pszPath, RTPATH_MAX, u.Entry.szName);
-            if (   u.Entry.enmType != enmType
-                && RT_SUCCESS(rc))
+            strcpy(pszName, u.Entry.szName);
+            if (u.Entry.enmType != enmType)
                 RTDirQueryUnknownType(pszPath, true /*fFollowSymlinks*/, &u.Entry.enmType);
-
-            if (   u.Entry.enmType == enmType
-                || RT_FAILURE(rc))
+            if (u.Entry.enmType == enmType)
             {
                 RTDirClose(pDir);
-                if (RT_FAILURE(rc))
-                {
-                    pszPath[offLastComp] = '\0';
-                    return false;
-                }
                 return true;
             }
         }
     }
 
     RTDirClose(pDir);
-    pszPath[offLastComp] = '\0';
+    *pszName = '\0';
 
     return false;
 }
@@ -372,7 +432,53 @@ static bool rtDbgCfgIsDirAndFixCase(char *pszPath, const char *pszSubDir, bool f
      * Do case insensitive lookup if requested.
      */
     if (fCaseInsensitive)
-        return rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, pszSubDir, RTDIRENTRYTYPE_DIRECTORY);
+        return rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, RTDIRENTRYTYPE_DIRECTORY);
+
+    pszPath[cchPath] = '\0';
+    return false;
+}
+
+
+/**
+ * Appends @a pszSubDir1 and @a pszSuffix to @a pszPath and check whether it
+ * exists and is a directory.
+ *
+ * If @a fCaseInsensitive is set, we will do a case insensitive search for a
+ * matching sub directory.
+ *
+ * @returns true / false
+ * @param   pszPath             The path buffer containing an existing
+ *                              directory.  RTPATH_MAX in size.
+ * @param   pszSubDir           The sub directory to append.
+ * @param   fCaseInsensitive    Whether case insensitive searching is required.
+ */
+static bool rtDbgCfgIsDirAndFixCase2(char *pszPath, const char *pszSubDir, const char *pszSuffix, bool fCaseInsensitive)
+{
+    Assert(!strpbrk(pszSuffix, ":/\\"));
+
+    /* Save the length of the input path so we can restore it in the case
+       insensitive branch further down. */
+    size_t const cchPath = strlen(pszPath);
+
+    /*
+     * Append the subdirectory and suffix, then check if we got a hit.
+     */
+    int rc = RTPathAppend(pszPath, RTPATH_MAX, pszSubDir);
+    if (RT_SUCCESS(rc))
+    {
+        rc = RTStrCat(pszPath, RTPATH_MAX, pszSuffix);
+        if (RT_SUCCESS(rc))
+        {
+            if (RTDirExists(pszPath))
+                return true;
+
+            /*
+             * Do case insensitive lookup if requested.
+             */
+            if (fCaseInsensitive)
+                return rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, RTDIRENTRYTYPE_DIRECTORY);
+        }
+    }
 
     pszPath[cchPath] = '\0';
     return false;
@@ -389,14 +495,15 @@ static bool rtDbgCfgIsDirAndFixCase(char *pszPath, const char *pszSubDir, bool f
  * @returns true / false
  * @param   pszPath             The path buffer containing an existing
  *                              directory.  RTPATH_MAX in size.
- * @param   pszFilename         The file name to append.
+ * @param   pszFilename         The filename to append.
+ * @param   pszSuffix           Optional filename suffix to append.
  * @param   fCaseInsensitive    Whether case insensitive searching is required.
  * @param   fMsCompressed       Whether to look for the MS compressed file name
  *                              variant.
  * @param   pfProbablyCompressed    This is set to true if a MS compressed
  *                                  filename variant is returned.  Optional.
  */
-static bool rtDbgCfgIsFileAndFixCase(char *pszPath, const char *pszFilename, bool fCaseInsensitive,
+static bool rtDbgCfgIsFileAndFixCase(char *pszPath, const char *pszFilename, const char *pszSuffix, bool fCaseInsensitive,
                                      bool fMsCompressed, bool *pfProbablyCompressed)
 {
     /* Save the length of the input path so we can restore it in the case
@@ -406,11 +513,18 @@ static bool rtDbgCfgIsFileAndFixCase(char *pszPath, const char *pszFilename, boo
         *pfProbablyCompressed = false;
 
     /*
-     * Append the filename and check if we got a hit.
+     * Append the filename and optionally suffix, then check if we got a hit.
      */
     int rc = RTPathAppend(pszPath, RTPATH_MAX, pszFilename);
     if (RT_FAILURE(rc))
         return false;
+    if (pszSuffix)
+    {
+        Assert(!fMsCompressed);
+        rc = RTStrCat(pszPath, RTPATH_MAX, pszSuffix);
+        if (RT_FAILURE(rc))
+            return false;
+    }
 
     if (RTFileExists(pszPath))
         return true;
@@ -420,7 +534,7 @@ static bool rtDbgCfgIsFileAndFixCase(char *pszPath, const char *pszFilename, boo
      */
     if (fCaseInsensitive)
     {
-        if (rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, pszFilename, RTDIRENTRYTYPE_FILE))
+        if (rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, RTDIRENTRYTYPE_FILE))
             return true;
     }
 
@@ -438,16 +552,11 @@ static bool rtDbgCfgIsFileAndFixCase(char *pszPath, const char *pszFilename, boo
         if (pfProbablyCompressed)
             *pfProbablyCompressed = true;
 
-        if (RTFileExists(pszPath))
+        if (   RTFileExists(pszPath)
+            || (   fCaseInsensitive
+                && rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, RTDIRENTRYTYPE_FILE) ))
             return true;
 
-        if (fCaseInsensitive)
-        {
-            /* Note! Ugly hack here, the pszName parameter points into pszPath! */
-            if (rtDbgCfgIsXxxxAndFixCaseWorker(pszPath, cchPath, RTPathFilename(pszPath), RTDIRENTRYTYPE_FILE))
-                return true;
-        }
-
         if (pfProbablyCompressed)
             *pfProbablyCompressed = false;
     }
@@ -496,7 +605,8 @@ static int rtDbgCfgTryOpenDir(PRTDBGCFGINT pThis, char *pszPath, PRTPATHSPLIT pS
 
         if (RT_SUCCESS(rc2))
         {
-            if (rtDbgCfgIsFileAndFixCase(pszPath, pSplitFn->apszComps[pSplitFn->cComps - 1], fCaseInsensitive, false, NULL))
+            if (rtDbgCfgIsFileAndFixCase(pszPath, pSplitFn->apszComps[pSplitFn->cComps - 1], NULL /*pszSuffix*/,
+                                         fCaseInsensitive, false, NULL))
             {
                 rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath);
                 rc2 = pfnCallback(pThis, pszPath, pvUser1, pvUser2);
@@ -548,6 +658,8 @@ static int rtDbgCfgUnpackMsCacheFile(PRTDBGCFGINT pThis, char *pszPath, const ch
      * Figuring out the argument list for the platform specific unpack util.
      */
 #ifdef RT_OS_WINDOWS
+    RTPathChangeToDosSlashes(pszSrcArchive, false /*fForce*/);
+    RTPathChangeToDosSlashes(pszPath, false /*fForce*/);
     const char *papszArgs[] =
     {
         "expand.exe",
@@ -619,11 +731,16 @@ static int rtDbgCfgUnpackMsCacheFile(PRTDBGCFGINT pThis, char *pszPath, const ch
     return rc;
 }
 
-static int rtDbgCfgTryDownloadAndOpen(PRTDBGCFGINT pThis, const char *pszServer,
-                                      char *pszPath, const char *pszCacheSubDir, PRTPATHSPLIT pSplitFn,
-                                      uint32_t fFlags, PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+
+static int rtDbgCfgTryDownloadAndOpen(PRTDBGCFGINT pThis, const char *pszServer, char *pszPath,
+                                      const char *pszCacheSubDir, const char *pszUuidMappingSubDir,
+                                      PRTPATHSPLIT pSplitFn, const char *pszCacheSuffix, uint32_t fFlags,
+                                      PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
 {
 #ifdef IPRT_WITH_HTTP
+    NOREF(pszUuidMappingSubDir); /** @todo do we bother trying pszUuidMappingSubDir? */
+    NOREF(pszCacheSuffix); /** @todo do we bother trying pszUuidMappingSubDir? */
+
     if (pThis->fFlags & RTDBGCFG_FLAGS_NO_SYM_SRV)
         return VWRN_NOT_FOUND;
     if (!pszCacheSubDir || !*pszCacheSubDir)
@@ -703,7 +820,7 @@ static int rtDbgCfgTryDownloadAndOpen(PRTDBGCFGINT pThis, const char *pszServer,
         if (RT_FAILURE(rc))
         {
             RTFileDelete(pszPath);
-            rtDbgCfgLog1(pThis, "%Rrc on URL '%s'\n", rc, pszPath);
+            rtDbgCfgLog1(pThis, "%Rrc on URL '%s'\n", rc, szUrl);
         }
         if (rc == VERR_HTTP_NOT_FOUND)
         {
@@ -724,11 +841,19 @@ static int rtDbgCfgTryDownloadAndOpen(PRTDBGCFGINT pThis, const char *pszServer,
 
     RTHttpDestroy(hHttp);
 
-    /*
-     * If we succeeded, give it a try.
-     */
     if (RT_SUCCESS(rc))
     {
+        /*
+         * Succeeded in downloading it. Add UUID mapping?
+         */
+        if (pszUuidMappingSubDir)
+        {
+            /** @todo UUID mapping when downloading. */
+        }
+
+        /*
+         * Give the file a try.
+         */
         Assert(RTFileExists(pszPath));
         rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath);
         rc = pfnCallback(pThis, pszPath, pvUser1, pvUser2);
@@ -749,7 +874,7 @@ static int rtDbgCfgTryDownloadAndOpen(PRTDBGCFGINT pThis, const char *pszServer,
 
 
 static int rtDbgCfgCopyFileToCache(PRTDBGCFGINT pThis, char const *pszSrc, const char *pchCache, size_t cchCache,
-                                   const char *pszCacheSubDir, PRTPATHSPLIT pSplitFn)
+                                   const char *pszCacheSubDir, const char *pszUuidMappingSubDir, PRTPATHSPLIT pSplitFn)
 {
     if (!pszCacheSubDir || !*pszCacheSubDir)
         return VINF_SUCCESS;
@@ -759,9 +884,13 @@ static int rtDbgCfgCopyFileToCache(PRTDBGCFGINT pThis, char const *pszSrc, const
 }
 
 
-static int rtDbgCfgTryOpenCache(PRTDBGCFGINT pThis, char *pszPath, const char *pszCacheSubDir, PRTPATHSPLIT pSplitFn,
-                                uint32_t fFlags, PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+static int rtDbgCfgTryOpenCache(PRTDBGCFGINT pThis, char *pszPath, size_t cchCachePath,
+                                const char *pszCacheSubDir, const char *pszUuidMappingSubDir,
+                                PCRTPATHSPLIT pSplitFn, const char *pszCacheSuffix, uint32_t fFlags,
+                                PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
 {
+    Assert(pszPath[cchCachePath] == '\0');
+
     /*
      * If the cache doesn't exist, fail right away.
      */
@@ -773,7 +902,41 @@ static int rtDbgCfgTryOpenCache(PRTDBGCFGINT pThis, char *pszPath, const char *p
         return VWRN_NOT_FOUND;
     }
 
-    size_t cchPath = strlen(pszPath);
+    /*
+     * If we got a UUID mapping option, try it first as we can hopefully
+     * dispense with case folding.
+     */
+    if (pszUuidMappingSubDir)
+    {
+        int rc = RTPathAppend(pszPath, RTPATH_MAX, pszUuidMappingSubDir);
+        if (   RT_SUCCESS(rc)
+            && RTFileExists(pszPath))
+        {
+            /* Try resolve the path before presenting it to the client, a
+               12 digit filename is of little worth. */
+            char szBackup[RTPATH_MAX];
+            strcpy(szBackup, pszPath);
+            rc = RTPathAbs(szBackup, pszPath, RTPATH_MAX);
+            if (RT_FAILURE(rc))
+                strcpy(pszPath, szBackup);
+
+            /* Do the callback thing. */
+            rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath);
+            int rc2 = pfnCallback(pThis, pszPath, pvUser1, pvUser2);
+            if (rc2 == VINF_CALLBACK_RETURN)
+                rtDbgCfgLog1(pThis, "Found '%s' via uuid mapping.\n", pszPath);
+            else if (rc2 == VERR_CALLBACK_RETURN)
+                rtDbgCfgLog1(pThis, "Error opening '%s'.\n", pszPath);
+            else
+                rtDbgCfgLog1(pThis, "Error %Rrc opening '%s'.\n", rc2, pszPath);
+            if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
+                return rc2;
+
+            /* Failed, restore the cache path. */
+            memcpy(pszPath, szBackup, cchCachePath);
+        }
+        pszPath[cchCachePath] = '\0';
+    }
 
     /*
      * Carefully construct the cache path with case insensitivity in mind.
@@ -789,7 +952,7 @@ static int rtDbgCfgTryOpenCache(PRTDBGCFGINT pThis, char *pszPath, const char *p
         return VWRN_NOT_FOUND;
 
     bool fProbablyCompressed = false;
-    if (!rtDbgCfgIsFileAndFixCase(pszPath, pszFilename, fCaseInsensitive,
+    if (!rtDbgCfgIsFileAndFixCase(pszPath, pszFilename, pszCacheSuffix, fCaseInsensitive,
                                   RT_BOOL(fFlags & RTDBGCFG_O_MAYBE_COMPRESSED_MS), &fProbablyCompressed))
         return VWRN_NOT_FOUND;
     if (fProbablyCompressed)
@@ -812,10 +975,11 @@ static int rtDbgCfgTryOpenCache(PRTDBGCFGINT pThis, char *pszPath, const char *p
 
 
 static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHSPLIT pSplitFn, const char *pszCacheSubDir,
-                               uint32_t fFlags, char *pszPath, PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+                               const char *pszUuidMappingSubDir, uint32_t fFlags, char *pszPath,
+                               PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
 {
     int rcRet = VWRN_NOT_FOUND;
-    int rc2;
+    int rc2 = VINF_SUCCESS;
 
     const char *pchCache = NULL;
     size_t      cchCache = 0;
@@ -840,7 +1004,7 @@ static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHS
         /*
          * Process the path according to it's type.
          */
-        if (!strncmp(pszDir, RT_STR_TUPLE("srv*")))
+        if (!RTStrNICmp(pszDir, RT_STR_TUPLE("srv*")))
         {
             /*
              * Symbol server.
@@ -853,6 +1017,7 @@ static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHS
                 pszServer = pszDir;
             else if (pszServer == pszDir)
                 continue;
+            else
             {
                 fSearchCache = true;
                 pchCache = pszDir;
@@ -871,8 +1036,8 @@ static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHS
                 pszPath[cchCache] = '\0';
                 RTPathChangeToUnixSlashes(pszPath, false);
 
-                rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, pszCacheSubDir, pSplitFn, fFlags,
-                                                     pfnCallback, pvUser1, pvUser2);
+                rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, cchCache, pszCacheSubDir, pszUuidMappingSubDir,
+                                                     pSplitFn, NULL /*pszCacheSuffix*/, fFlags, pfnCallback, pvUser1, pvUser2);
                 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
                     return rc2;
             }
@@ -884,13 +1049,13 @@ static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHS
                 pszPath[cchCache] = '\0';
                 RTPathChangeToUnixSlashes(pszPath, false);
 
-                rc2 = rtDbgCfgTryDownloadAndOpen(pThis, pszServer, pszPath, pszCacheSubDir, pSplitFn, fFlags,
-                                                 pfnCallback, pvUser1, pvUser2);
+                rc2 = rtDbgCfgTryDownloadAndOpen(pThis, pszServer, pszPath, pszCacheSubDir, pszUuidMappingSubDir,
+                                                 pSplitFn, NULL /*pszCacheSuffix*/, fFlags, pfnCallback, pvUser1, pvUser2);
                 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
                     return rc2;
             }
         }
-        else if (!strncmp(pszDir, RT_STR_TUPLE("cache*")))
+        else if (!RTStrNICmp(pszDir, RT_STR_TUPLE("cache*")))
         {
             /*
              * Cache directory.
@@ -906,8 +1071,8 @@ static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHS
             pszPath[cchCache] = '\0';
             RTPathChangeToUnixSlashes(pszPath, false);
 
-            rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, pszCacheSubDir, pSplitFn, fFlags,
-                                                 pfnCallback, pvUser1, pvUser2);
+            rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, cchCache, pszCacheSubDir, pszUuidMappingSubDir,
+                                                 pSplitFn, NULL /*pszCacheSuffix*/, fFlags, pfnCallback, pvUser1, pvUser2);
             if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
                 return rc2;
         }
@@ -918,13 +1083,13 @@ static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHS
              * flags governing recursive searching.
              */
             uint32_t fFlagsDir = fFlags;
-            if (!strncmp(pszDir, RT_STR_TUPLE("rec*")))
+            if (!RTStrNICmp(pszDir, RT_STR_TUPLE("rec*")))
             {
                 pszDir += sizeof("rec*") - 1;
                 cchDir -= sizeof("rec*") - 1;
                 fFlagsDir |= RTDBGCFG_O_RECURSIVE;
             }
-            else if (!strncmp(pszDir, RT_STR_TUPLE("norec*")))
+            else if (!RTStrNICmp(pszDir, RT_STR_TUPLE("norec*")))
             {
                 pszDir += sizeof("norec*") - 1;
                 cchDir -= sizeof("norec*") - 1;
@@ -941,7 +1106,8 @@ static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHS
             {
                 if (   rc2 == VINF_CALLBACK_RETURN
                     && cchCache > 0)
-                    rtDbgCfgCopyFileToCache(pThis, pszPath, pchCache, cchCache, pszCacheSubDir, pSplitFn);
+                    rtDbgCfgCopyFileToCache(pThis, pszPath, pchCache, cchCache,
+                                            pszCacheSubDir, pszUuidMappingSubDir, pSplitFn);
                 return rc2;
             }
         }
@@ -961,19 +1127,23 @@ static int rtDbgCfgTryOpenList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHS
  * This will not search using for suffixes.
  *
  * @returns IPRT status code.
- * @param   hDbgCfg         The debugging configuration handle.  NIL_RTDBGCFG is
- *                          accepted, but the result is that no paths will be
- *                          searched beyond the given and the current directory.
- * @param   pszFilename     The filename to search for.  This may or may not
- *                          include a full or partial path.
- * @param   pszCacheSubDir  The cache subdirectory to look in.
- * @param   fFlags          Flags and hints.
- * @param   pfnCallback     The open callback routine.
- * @param   pvUser1         User parameter 1.
- * @param   pvUser2         User parameter 2.
+ * @param   hDbgCfg                 The debugging configuration handle.
+ *                                  NIL_RTDBGCFG is accepted, but the result is
+ *                                  that no paths will be searched beyond the
+ *                                  given and the current directory.
+ * @param   pszFilename             The filename to search for.  This may or may
+ *                                  not include a full or partial path.
+ * @param   pszCacheSubDir          The cache subdirectory to look in.
+ * @param   pszUuidMappingSubDir    UUID mapping subdirectory to check, NULL if
+ *                                  no mapping wanted.
+ * @param   fFlags                  Flags and hints.
+ * @param   pfnCallback             The open callback routine.
+ * @param   pvUser1                 User parameter 1.
+ * @param   pvUser2                 User parameter 2.
  */
 static int rtDbgCfgOpenWithSubDir(RTDBGCFG hDbgCfg, const char *pszFilename, const char *pszCacheSubDir,
-                                  uint32_t fFlags, PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+                                  const char *pszUuidMappingSubDir, uint32_t fFlags,
+                                  PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
 {
     int rcRet = VINF_SUCCESS;
     int rc2;
@@ -1055,8 +1225,8 @@ static int rtDbgCfgOpenWithSubDir(RTDBGCFG hDbgCfg, const char *pszFilename, con
                 /*
                  * Run the applicable lists.
                  */
-                rc2 = rtDbgCfgTryOpenList(pThis, &pThis->PathList, pSplitFn, pszCacheSubDir, fFlags, szPath,
-                                          pfnCallback, pvUser1, pvUser2);
+                rc2 = rtDbgCfgTryOpenList(pThis, &pThis->PathList, pSplitFn, pszCacheSubDir,
+                                          pszUuidMappingSubDir, fFlags, szPath, pfnCallback, pvUser1, pvUser2);
                 if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet))
                     rcRet = rc2;
 
@@ -1066,8 +1236,8 @@ static int rtDbgCfgOpenWithSubDir(RTDBGCFG hDbgCfg, const char *pszFilename, con
                     && (fFlags & RTDBGCFG_O_EXECUTABLE_IMAGE)
                     && !(pThis->fFlags & RTDBGCFG_FLAGS_NO_SYSTEM_PATHS) )
                 {
-                    rc2 = rtDbgCfgTryOpenList(pThis, &pThis->NtExecutablePathList, pSplitFn, pszCacheSubDir, fFlags, szPath,
-                                              pfnCallback, pvUser1, pvUser2);
+                    rc2 = rtDbgCfgTryOpenList(pThis, &pThis->NtExecutablePathList, pSplitFn, pszCacheSubDir,
+                                              pszUuidMappingSubDir, fFlags, szPath, pfnCallback, pvUser1, pvUser2);
                     if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet))
                         rcRet = rc2;
                 }
@@ -1076,8 +1246,8 @@ static int rtDbgCfgOpenWithSubDir(RTDBGCFG hDbgCfg, const char *pszFilename, con
                     && rc2 != VERR_CALLBACK_RETURN
                     && !(pThis->fFlags & RTDBGCFG_FLAGS_NO_SYSTEM_PATHS) )
                 {
-                    rc2 = rtDbgCfgTryOpenList(pThis, &pThis->NtSymbolPathList, pSplitFn, pszCacheSubDir, fFlags, szPath,
-                                              pfnCallback, pvUser1, pvUser2);
+                    rc2 = rtDbgCfgTryOpenList(pThis, &pThis->NtSymbolPathList, pSplitFn, pszCacheSubDir,
+                                              pszUuidMappingSubDir, fFlags, szPath, pfnCallback, pvUser1, pvUser2);
                     if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet))
                         rcRet = rc2;
                 }
@@ -1104,7 +1274,7 @@ RTDECL(int) RTDbgCfgOpenPeImage(RTDBGCFG hDbgCfg, const char *pszFilename, uint3
 {
     char szSubDir[32];
     RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X%x", uTimestamp, cbImage);
-    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir,
+    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, NULL,
                                   RT_OPSYS_WINDOWS /* approx */ | RTDBGCFG_O_SYMSRV | RTDBGCFG_O_CASE_INSENSITIVE
                                   | RTDBGCFG_O_MAYBE_COMPRESSED_MS | RTDBGCFG_O_EXECUTABLE_IMAGE,
                                   pfnCallback, pvUser1, pvUser2);
@@ -1133,7 +1303,7 @@ RTDECL(int) RTDbgCfgOpenPdb70(RTDBGCFG hDbgCfg, const char *pszFilename, PCRTUUI
         RTStrPrintf(pszDst, &szSubDir[sizeof(szSubDir)] - pszDst, "%X", uAge);
     }
 
-    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir,
+    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, NULL,
                                   RT_OPSYS_WINDOWS /* approx */ | RTDBGCFG_O_SYMSRV | RTDBGCFG_O_CASE_INSENSITIVE
                                   | RTDBGCFG_O_MAYBE_COMPRESSED_MS | RTDBGCFG_O_EXT_DEBUG_FILE,
                                   pfnCallback, pvUser1, pvUser2);
@@ -1146,7 +1316,7 @@ RTDECL(int) RTDbgCfgOpenPdb20(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_
     /** @todo test this! */
     char szSubDir[32];
     RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X%x", uTimestamp, uAge);
-    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir,
+    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, NULL,
                                   RT_OPSYS_WINDOWS /* approx */ | RTDBGCFG_O_SYMSRV | RTDBGCFG_O_CASE_INSENSITIVE
                                   | RTDBGCFG_O_MAYBE_COMPRESSED_MS | RTDBGCFG_O_EXT_DEBUG_FILE,
                                   pfnCallback, pvUser1, pvUser2);
@@ -1158,7 +1328,7 @@ RTDECL(int) RTDbgCfgOpenDbg(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t
 {
     char szSubDir[32];
     RTStrPrintf(szSubDir, sizeof(szSubDir), "%08X%x", uTimestamp, cbImage);
-    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir,
+    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, NULL,
                                   RT_OPSYS_WINDOWS /* approx */ | RTDBGCFG_O_SYMSRV | RTDBGCFG_O_CASE_INSENSITIVE
                                   | RTDBGCFG_O_MAYBE_COMPRESSED_MS | RTDBGCFG_O_EXT_DEBUG_FILE,
                                   pfnCallback, pvUser1, pvUser2);
@@ -1170,7 +1340,7 @@ RTDECL(int) RTDbgCfgOpenDwo(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t
 {
     char szSubDir[32];
     RTStrPrintf(szSubDir, sizeof(szSubDir), "%08x", uCrc32);
-    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir,
+    return rtDbgCfgOpenWithSubDir(hDbgCfg, pszFilename, szSubDir, NULL,
                                   RT_OPSYS_UNKNOWN | RTDBGCFG_O_EXT_DEBUG_FILE,
                                   pfnCallback, pvUser1, pvUser2);
 }
@@ -1188,8 +1358,9 @@ RTDECL(int) RTDbgCfgOpenDwo(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t
 /**
  * Very similar to rtDbgCfgTryOpenDir.
  */
-static int rtDbgCfgTryOpenDsymBundleInDir(PRTDBGCFGINT pThis, char *pszPath, PRTPATHSPLIT pSplitFn, const char *pszDsymName,
-                                          uint32_t fFlags, PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+static int rtDbgCfgTryOpenDsymBundleInDir(PRTDBGCFGINT pThis, char *pszPath, PRTPATHSPLIT pSplitFn,
+                                          const char * const *papszSuffixes, uint32_t fFlags,
+                                          PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
 {
     int rcRet = VWRN_NOT_FOUND;
     int rc2;
@@ -1215,7 +1386,9 @@ static int rtDbgCfgTryOpenDsymBundleInDir(PRTDBGCFGINT pThis, char *pszPath, PRT
 
     /*
      * Look for the file with less and less of the original path given.
+     * Also try out typical bundle extension variations.
      */
+    const char *pszName = pSplitFn->apszComps[pSplitFn->cComps - 1];
     for (unsigned i = RTPATH_PROP_HAS_ROOT_SPEC(pSplitFn->fProps); i < pSplitFn->cComps; i++)
     {
         pszPath[cchPath] = '\0';
@@ -1224,27 +1397,33 @@ static int rtDbgCfgTryOpenDsymBundleInDir(PRTDBGCFGINT pThis, char *pszPath, PRT
         for (unsigned j = i; j < pSplitFn->cComps - 1U && RT_SUCCESS(rc2); j++)
             if (!rtDbgCfgIsDirAndFixCase(pszPath, pSplitFn->apszComps[i], fCaseInsensitive))
                 rc2 = VERR_FILE_NOT_FOUND;
-        if (    RT_SUCCESS(rc2)
-            && !rtDbgCfgIsDirAndFixCase(pszPath, pszDsymName, fCaseInsensitive)
-            && !rtDbgCfgIsDirAndFixCase(pszPath, "Contents", fCaseInsensitive)
-            && !rtDbgCfgIsDirAndFixCase(pszPath, "Resources", fCaseInsensitive)
-            && !rtDbgCfgIsDirAndFixCase(pszPath, "DWARF", fCaseInsensitive))
+        if (RT_SUCCESS(rc2))
         {
-            if (rtDbgCfgIsFileAndFixCase(pszPath, pSplitFn->apszComps[pSplitFn->cComps - 1], fCaseInsensitive, false, NULL))
+            size_t cchCurPath = cchPath + strlen(&pszPath[cchPath]);
+            for (uint32_t iSuffix = 0; papszSuffixes[iSuffix]; iSuffix++)
             {
-                rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath);
-                rc2 = pfnCallback(pThis, pszPath, pvUser1, pvUser2);
-                if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
+                if (   !rtDbgCfgIsDirAndFixCase2(pszPath, pszName, papszSuffixes[iSuffix], fCaseInsensitive)
+                    && !rtDbgCfgIsDirAndFixCase(pszPath, "Contents", fCaseInsensitive)
+                    && !rtDbgCfgIsDirAndFixCase(pszPath, "Resources", fCaseInsensitive)
+                    && !rtDbgCfgIsDirAndFixCase(pszPath, "DWARF", fCaseInsensitive))
                 {
-                    if (rc2 == VINF_CALLBACK_RETURN)
-                        rtDbgCfgLog1(pThis, "Found '%s'.\n", pszPath);
-                    else
-                        rtDbgCfgLog1(pThis, "Error opening '%s'.\n", pszPath);
-                    return rc2;
+                    if (rtDbgCfgIsFileAndFixCase(pszPath, pszName, NULL /*pszSuffix*/, fCaseInsensitive, false, NULL))
+                    {
+                        rtDbgCfgLog1(pThis, "Trying '%s'...\n", pszPath);
+                        rc2 = pfnCallback(pThis, pszPath, pvUser1, pvUser2);
+                        if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
+                        {
+                            if (rc2 == VINF_CALLBACK_RETURN)
+                                rtDbgCfgLog1(pThis, "Found '%s'.\n", pszPath);
+                            else
+                                rtDbgCfgLog1(pThis, "Error opening '%s'.\n", pszPath);
+                            return rc2;
+                        }
+                        rtDbgCfgLog1(pThis, "Error %Rrc opening '%s'.\n", rc2, pszPath);
+                        if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet))
+                            rcRet = rc2;
+                    }
                 }
-                rtDbgCfgLog1(pThis, "Error %Rrc opening '%s'.\n", rc2, pszPath);
-                if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet))
-                    rcRet = rc2;
             }
         }
         rc2 = VERR_FILE_NOT_FOUND;
@@ -1266,9 +1445,11 @@ static int rtDbgCfgTryOpenDsymBundleInDir(PRTDBGCFGINT pThis, char *pszPath, PRT
 /**
  * Very similar to rtDbgCfgTryOpenList.
  */
-static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHSPLIT pSplitFn,
-                                           const char *pszDsymName, const char *pszCacheSubDir, uint32_t fFlags, char *pszPath,
-                                           PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+static int rtDbgCfgTryOpenBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pList, PRTPATHSPLIT pSplitFn,
+                                       const char * const *papszSuffixes, const char *pszCacheSubDir,
+                                       const char *pszCacheSuffix, const char *pszUuidMappingSubDir,
+                                       uint32_t fFlags, char *pszPath,
+                                       PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
 {
     int rcRet = VWRN_NOT_FOUND;
     int rc2;
@@ -1296,7 +1477,8 @@ static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pLi
         /*
          * Process the path according to it's type.
          */
-        if (!strncmp(pszDir, RT_STR_TUPLE("srv*")))
+        rc2 = VINF_SUCCESS;
+        if (!RTStrNICmp(pszDir, RT_STR_TUPLE("srv*")))
         {
             /*
              * Symbol server.
@@ -1309,6 +1491,7 @@ static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pLi
                 pszServer = pszDir;
             else if (pszServer == pszDir)
                 continue;
+            else
             {
                 fSearchCache = true;
                 pchCache = pszDir;
@@ -1327,8 +1510,8 @@ static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pLi
                 pszPath[cchCache] = '\0';
                 RTPathChangeToUnixSlashes(pszPath, false);
 
-                rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, pszCacheSubDir, pSplitFn, fFlags,
-                                                     pfnCallback, pvUser1, pvUser2);
+                rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, cchCache, pszCacheSubDir, pszUuidMappingSubDir,
+                                                     pSplitFn, pszCacheSuffix, fFlags, pfnCallback, pvUser1, pvUser2);
                 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
                     return rc2;
             }
@@ -1340,13 +1523,13 @@ static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pLi
                 pszPath[cchCache] = '\0';
                 RTPathChangeToUnixSlashes(pszPath, false);
 
-                rc2 = rtDbgCfgTryDownloadAndOpen(pThis, pszServer, pszPath, pszCacheSubDir, pSplitFn, fFlags,
-                                                 pfnCallback, pvUser1, pvUser2);
+                rc2 = rtDbgCfgTryDownloadAndOpen(pThis, pszServer, pszPath, pszCacheSubDir, pszUuidMappingSubDir,
+                                                 pSplitFn, pszCacheSuffix, fFlags, pfnCallback, pvUser1, pvUser2);
                 if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
                     return rc2;
             }
         }
-        else if (!strncmp(pszDir, RT_STR_TUPLE("cache*")))
+        else if (!RTStrNICmp(pszDir, RT_STR_TUPLE("cache*")))
         {
             /*
              * Cache directory.
@@ -1362,8 +1545,8 @@ static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pLi
             pszPath[cchCache] = '\0';
             RTPathChangeToUnixSlashes(pszPath, false);
 
-            rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, pszCacheSubDir, pSplitFn, fFlags,
-                                                 pfnCallback, pvUser1, pvUser2);
+            rcCache = rc2 = rtDbgCfgTryOpenCache(pThis, pszPath, cchCache, pszCacheSubDir, pszUuidMappingSubDir,
+                                                 pSplitFn, pszCacheSuffix, fFlags, pfnCallback, pvUser1, pvUser2);
             if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
                 return rc2;
         }
@@ -1374,13 +1557,13 @@ static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pLi
              * flags governing recursive searching.
              */
             uint32_t fFlagsDir = fFlags;
-            if (!strncmp(pszDir, RT_STR_TUPLE("rec*")))
+            if (!RTStrNICmp(pszDir, RT_STR_TUPLE("rec*")))
             {
                 pszDir += sizeof("rec*") - 1;
                 cchDir -= sizeof("rec*") - 1;
                 fFlagsDir |= RTDBGCFG_O_RECURSIVE;
             }
-            else if (!strncmp(pszDir, RT_STR_TUPLE("norec*")))
+            else if (!RTStrNICmp(pszDir, RT_STR_TUPLE("norec*")))
             {
                 pszDir += sizeof("norec*") - 1;
                 cchDir -= sizeof("norec*") - 1;
@@ -1392,13 +1575,14 @@ static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pLi
             pszPath[cchDir] = '\0';
             RTPathChangeToUnixSlashes(pszPath, false);
 
-            rc2 = rtDbgCfgTryOpenDsymBundleInDir(pThis, pszPath, pSplitFn, pszDsymName, fFlagsDir,
+            rc2 = rtDbgCfgTryOpenDsymBundleInDir(pThis, pszPath, pSplitFn, papszSuffixes, fFlagsDir,
                                                  pfnCallback, pvUser1, pvUser2);
             if (rc2 == VINF_CALLBACK_RETURN || rc2 == VERR_CALLBACK_RETURN)
             {
                 if (   rc2 == VINF_CALLBACK_RETURN
                     && cchCache > 0)
-                    rtDbgCfgCopyFileToCache(pThis, pszPath, pchCache, cchCache, pszCacheSubDir, pSplitFn);
+                    rtDbgCfgCopyFileToCache(pThis, pszPath, pchCache, cchCache,
+                                            pszCacheSubDir, pszUuidMappingSubDir, pSplitFn);
                 return rc2;
             }
         }
@@ -1412,14 +1596,60 @@ static int rtDbgCfgTryOpenDsumBundleInList(PRTDBGCFGINT pThis, PRTLISTANCHOR pLi
 }
 
 
-RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTUUID pUuid,
-                                   PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+/**
+ * Creating a UUID mapping subdirectory path for use in caches.
+ *
+ * @returns IPRT status code.
+ * @param   pszSubDir           The output buffer.
+ * @param   cbSubDir            The size of the output buffer. (Top dir length +
+ *                              slash + UUID string len + extra dash.)
+ * @param   pszTopDir           The top level cache directory name. No slashes
+ *                              or other directory separators, please.
+ * @param   pUuid               The UUID.
+ */
+static int rtDbgCfgConstructUuidMappingSubDir(char *pszSubDir, size_t cbSubDir, const char *pszTopDir, PCRTUUID pUuid)
+{
+    Assert(!strpbrk(pszTopDir, ":/\\"));
+
+    size_t cchTopDir = strlen(pszTopDir);
+    if (cchTopDir + 1 + 1 + RTUUID_STR_LENGTH + 1 > cbSubDir)
+        return VERR_BUFFER_OVERFLOW;
+    memcpy(pszSubDir, pszTopDir, cchTopDir);
+
+    pszSubDir += cchTopDir;
+    *pszSubDir++ = RTPATH_SLASH;
+    cbSubDir  -= cchTopDir + 1;
+
+    /* ed5a8336-35c2-4892-9122-21d5572924a3 -> ED5A/8336/35C2/4892/9122/21D5572924A3 */
+    int rc = RTUuidToStr(pUuid, pszSubDir + 1, cbSubDir - 1); AssertRCReturn(rc, rc);
+    RTStrToUpper(pszSubDir + 1);
+    memmove(pszSubDir, pszSubDir + 1, 4);
+    pszSubDir += 4;
+    *pszSubDir = RTPATH_SLASH;
+    pszSubDir += 5;
+    *pszSubDir = RTPATH_SLASH;
+    pszSubDir += 5;
+    *pszSubDir = RTPATH_SLASH;
+    pszSubDir += 5;
+    *pszSubDir = RTPATH_SLASH;
+    pszSubDir += 5;
+    *pszSubDir = RTPATH_SLASH;
+
+    return VINF_SUCCESS;
+}
+
+
+static int rtDbgCfgOpenBundleFile(RTDBGCFG hDbgCfg, const char *pszImage, const char * const *papszSuffixes,
+                                  const char *pszBundleSubDir, PCRTUUID pUuid, const char *pszUuidMapDirName,
+                                  const char *pszCacheSuffix, bool fOpenImage,
+                                  PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
 {
     /*
      * Bundles are directories, means we can forget about sharing code much
      * with the other RTDbgCfgOpenXXX methods.  Thus we're duplicating a lot of
-     * code from rtDbgCfgOpenWithSubDir with .dSYM related adjustments, so, a bug
-     * found here or there probably means the other version needs updating.
+     * code from rtDbgCfgOpenWithSubDir with .dSYM/.kext/.dylib/.app/.* related
+     * adjustments, so, a bug found here or there probably means the other
+     * version needs updating.
      */
     int rcRet = VINF_SUCCESS;
     int rc2;
@@ -1436,15 +1666,23 @@ RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTU
     AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
 
     /*
-     * Set up rtDbgCfgOpenWithSubDir parameters.
+     * Set up rtDbgCfgOpenWithSubDir and uuid map parameters.
      */
     uint32_t fFlags = RTDBGCFG_O_EXT_DEBUG_FILE | RT_OPSYS_DARWIN;
     const char *pszCacheSubDir = NULL;
     char szCacheSubDir[RTUUID_STR_LENGTH];
+    const char *pszUuidMappingSubDir = NULL;
+    char szUuidMappingSubDir[RTUUID_STR_LENGTH + 16];
     if (pUuid)
     {
+        /* Since Mac debuggers uses UUID mappings, we just the slashing default
+           UUID string representation instead of stripping dashes like for PDB. */
         RTUuidToStr(pUuid, szCacheSubDir, sizeof(szCacheSubDir));
         pszCacheSubDir = szCacheSubDir;
+
+        rc2 = rtDbgCfgConstructUuidMappingSubDir(szUuidMappingSubDir, sizeof(szUuidMappingSubDir), pszUuidMapDirName, pUuid);
+        AssertRCReturn(rc2, rc2);
+        pszUuidMappingSubDir = szUuidMappingSubDir;
     }
 
     /*
@@ -1473,12 +1711,15 @@ RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTU
     if (pSplitFn->cComps > 0)
     {
         rc2 = RTPathSplitReassemble(pSplitFn, RTPATH_STR_F_STYLE_HOST, szPath, sizeof(szPath));
-        if (RT_SUCCESS(rc2))
-            rc2 = RTStrCat(szPath, sizeof(szPath),
-                           ".dSYM" RTPATH_SLASH_STR "Contents" RTPATH_SLASH_STR "Resources" RTPATH_SLASH_STR "DWARF");
-        if (RT_SUCCESS(rc2))
-            rc2 = RTPathAppend(szPath, sizeof(szPath), pSplitFn->apszComps[pSplitFn->cComps - 1]);
-        if (RT_SUCCESS(rc2))
+        if (fOpenImage && RT_SUCCESS(rc2))
+        {
+            rc2 = RTStrCat(szPath, sizeof(szPath), papszSuffixes[0]);
+            if (RT_SUCCESS(rc2))
+                rc2 = RTStrCat(szPath, sizeof(szPath), pszBundleSubDir);
+            if (RT_SUCCESS(rc2))
+                rc2 = RTPathAppend(szPath, sizeof(szPath), pSplitFn->apszComps[pSplitFn->cComps - 1]);
+        }
+        if (RT_SUCCESS(rc2) && RTPathExists(szPath))
         {
             RTPathChangeToUnixSlashes(szPath, false);
             rtDbgCfgLog1(pThis, "Trying '%s'...\n", szPath);
@@ -1494,9 +1735,6 @@ RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTU
     if (   rc2 != VINF_CALLBACK_RETURN
         && rc2 != VERR_CALLBACK_RETURN)
     {
-        char *pszDsymName = (char *)alloca(strlen(pSplitFn->apszComps[pSplitFn->cComps - 1]) + sizeof(".dSYM"));
-        strcat(strcpy(pszDsymName, pSplitFn->apszComps[pSplitFn->cComps - 1]), ".dSYM");
-
         /*
          * Try the current directory (will take cover relative paths
          * skipped above).
@@ -1506,7 +1744,8 @@ RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTU
             strcpy(szPath, ".");
         RTPathChangeToUnixSlashes(szPath, false);
 
-        rc2 = rtDbgCfgTryOpenDsymBundleInDir(pThis, szPath, pSplitFn, pszDsymName, fFlags, pfnCallback, pvUser1, pvUser2);
+        rc2 = rtDbgCfgTryOpenDsymBundleInDir(pThis, szPath, pSplitFn, g_apszDSymBundleSuffixes,
+                                             fFlags, pfnCallback, pvUser1, pvUser2);
         if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet))
             rcRet = rc2;
 
@@ -1520,9 +1759,10 @@ RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTU
                 /*
                  * Run the applicable lists.
                  */
-                rc2 = rtDbgCfgTryOpenDsumBundleInList(pThis, &pThis->PathList, pSplitFn, pszDsymName,
-                                                      pszCacheSubDir, fFlags, szPath,
-                                                      pfnCallback, pvUser1, pvUser2);
+                rc2 = rtDbgCfgTryOpenBundleInList(pThis, &pThis->PathList, pSplitFn, g_apszDSymBundleSuffixes,
+                                                  pszCacheSubDir, pszCacheSuffix,
+                                                  pszUuidMappingSubDir, fFlags, szPath,
+                                                  pfnCallback, pvUser1, pvUser2);
                 if (RT_FAILURE(rc2) && RT_SUCCESS_NP(rcRet))
                     rcRet = rc2;
 
@@ -1543,6 +1783,26 @@ RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTU
 }
 
 
+RTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszImage, PCRTUUID pUuid,
+                                   PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+{
+    return rtDbgCfgOpenBundleFile(hDbgCfg, pszImage, g_apszDSymBundleSuffixes,
+                                  "Contents" RTPATH_SLASH_STR "Resources" RTPATH_SLASH_STR "DWARF",
+                                  pUuid, RTDBG_CACHE_UUID_MAP_DIR_DSYMS, RTDBG_CACHE_DSYM_FILE_SUFFIX, false /* fOpenImage */,
+                                  pfnCallback, pvUser1, pvUser2);
+}
+
+
+RTDECL(int) RTDbgCfgOpenMachOImage(RTDBGCFG hDbgCfg, const char *pszImage, PCRTUUID pUuid,
+                                   PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2)
+{
+    return rtDbgCfgOpenBundleFile(hDbgCfg, pszImage, g_apszBundleSuffixes,
+                                  "Contents" RTPATH_SLASH_STR "MacOS",
+                                  pUuid, RTDBG_CACHE_UUID_MAP_DIR_IMAGES, NULL /*pszCacheSuffix*/, true /* fOpenImage */,
+                                  pfnCallback, pvUser1, pvUser2);
+}
+
+
 
 RTDECL(int) RTDbgCfgSetLogCallback(RTDBGCFG hDbgCfg, PFNRTDBGCFGLOG pfnCallback, void *pvUser)
 {
diff --git a/src/VBox/Runtime/common/dbg/dbgmod.cpp b/src/VBox/Runtime/common/dbg/dbgmod.cpp
index 2755a72..f55bba5 100644
--- a/src/VBox/Runtime/common/dbg/dbgmod.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgmod.cpp
@@ -584,7 +584,7 @@ rtDbgModOpenDebugInfoExternalToImageCallback(RTLDRMOD hLdrMod, PCRTLDRDBGINFO pD
             if (psz)
             {
                 memcpy(psz, pArgs->pDbgMod->pszName, cchName + 1);
-                RTPathStripExt(psz);
+                RTPathStripSuffix(psz);
                 pszExtFile = strcat(psz, pszExt);
             }
         }
@@ -738,7 +738,13 @@ static int rtDbgModOpenDebugInfoExternalToImage2(PRTDBGMODINT pDbgMod, RTDBGCFG
     {
         case RTLDRFMT_MACHO:
         {
-            rc = RTDbgCfgOpenDsymBundle(hDbgCfg, pDbgMod->pszImgFile, NULL /**@todo pUuid*/,
+            RTUUID  Uuid;
+            PRTUUID pUuid = &Uuid;
+            rc = pDbgMod->pImgVt->pfnQueryProp(pDbgMod, RTLDRPROP_UUID, &Uuid, sizeof(Uuid));
+            if (RT_FAILURE(rc))
+                pUuid = NULL;
+
+            rc = RTDbgCfgOpenDsymBundle(hDbgCfg, pDbgMod->pszImgFile, pUuid,
                                         rtDbgModExtDbgInfoOpenCallback2, pDbgMod, NULL /*pvUser2*/);
             if (RT_SUCCESS(rc))
                 return VINF_SUCCESS;
@@ -1181,25 +1187,30 @@ RT_EXPORT_SYMBOL(RTDbgModCreateFromPeImage);
  *
  */
 
-/** @callback_method_impl{FNRTDBGCFGOPEN} */
-static DECLCALLBACK(int)
-rtDbgModFromMachOImageOpenMachOCallback(RTDBGCFG hDbgCfg, const char *pszFilename, void *pvUser1, void *pvUser2)
-{
-    PRTDBGMODINT        pDbgMod   = (PRTDBGMODINT)pvUser1;
-    PCRTDBGDWARFSEGPKG  pSegPkg   = (PCRTDBGDWARFSEGPKG)pvUser2;
 
-    /** @todo  */
+/**
+ * Argument package used when opening Mach-O images and .dSYMs files.
+ */
+typedef struct RTDBGMODMACHOARGS
+{
+    /** For use more internal use in file locator callbacks. */
+    RTLDRARCH           enmArch;
+    /** For use more internal use in file locator callbacks. */
+    PCRTUUID            pUuid;
+    /** For use more internal use in file locator callbacks. */
+    bool                fOpenImage;
+} RTDBGMODMACHOARGS;
+/** Pointer to a const segment package. */
+typedef RTDBGMODMACHOARGS const *PCRTDBGMODMACHOARGS;
 
-    return VERR_OPEN_FAILED;
-}
 
 
 /** @callback_method_impl{FNRTDBGCFGOPEN} */
 static DECLCALLBACK(int)
-rtDbgModFromMachOImageOpenDsymCallback(RTDBGCFG hDbgCfg, const char *pszFilename, void *pvUser1, void *pvUser2)
+rtDbgModFromMachOImageOpenDsymMachOCallback(RTDBGCFG hDbgCfg, const char *pszFilename, void *pvUser1, void *pvUser2)
 {
-    PRTDBGMODINT        pDbgMod   = (PRTDBGMODINT)pvUser1;
-    PCRTDBGDWARFSEGPKG  pSegPkg   = (PCRTDBGDWARFSEGPKG)pvUser2;
+    PRTDBGMODINT        pDbgMod = (PRTDBGMODINT)pvUser1;
+    PCRTDBGMODMACHOARGS pArgs   = (PCRTDBGMODMACHOARGS)pvUser2;
 
     Assert(!pDbgMod->pDbgVt);
     Assert(!pDbgMod->pvDbgPriv);
@@ -1229,7 +1240,7 @@ rtDbgModFromMachOImageOpenDsymCallback(RTDBGCFG hDbgCfg, const char *pszFilename
         {
             pDbgMod->pImgVt    = pImg->pVt;
             pDbgMod->pvImgPriv = NULL;
-            rc = pImg->pVt->pfnTryOpen(pDbgMod, pSegPkg->enmArch);
+            rc = pImg->pVt->pfnTryOpen(pDbgMod, pArgs->enmArch);
             if (RT_SUCCESS(rc))
                 break;
             pDbgMod->pImgVt    = NULL;
@@ -1241,13 +1252,13 @@ rtDbgModFromMachOImageOpenDsymCallback(RTDBGCFG hDbgCfg, const char *pszFilename
             /*
              * Check the UUID if one was given.
              */
-            if (pSegPkg->pUuid)
+            if (pArgs->pUuid)
             {
                 RTUUID UuidOpened;
                 rc = pDbgMod->pImgVt->pfnQueryProp(pDbgMod, RTLDRPROP_UUID, &UuidOpened, sizeof(UuidOpened));
                 if (RT_SUCCESS(rc))
                 {
-                    if (RTUuidCompare(&UuidOpened, pSegPkg->pUuid) != 0)
+                    if (RTUuidCompare(&UuidOpened, pArgs->pUuid) != 0)
                         rc = VERR_DBG_FILE_MISMATCH;
                 }
                 else if (rc == VERR_NOT_FOUND || rc == VERR_NOT_IMPLEMENTED)
@@ -1256,14 +1267,16 @@ rtDbgModFromMachOImageOpenDsymCallback(RTDBGCFG hDbgCfg, const char *pszFilename
             if (RT_SUCCESS(rc))
             {
                 /*
-                 * Pass it to the DWARF reader(s).
+                 * Pass it to the DWARF reader(s).  Careful to restrict this or
+                 * the dbghelp wrapper may end up being overly helpful.
                  */
                 for (PRTDBGMODREGDBG pDbg = g_pDbgHead; pDbg; pDbg = pDbg->pNext)
                 {
-                    if (pDbg->pVt->fSupports & RT_DBGTYPE_DWARF)
+                    if (pDbg->pVt->fSupports & (RT_DBGTYPE_DWARF | RT_DBGTYPE_STABS | RT_DBGTYPE_WATCOM))
+
                     {
                         pDbgMod->pDbgVt    = pDbg->pVt;
-                        pDbgMod->pvDbgPriv = pSegPkg->cSegs ? (void *)pSegPkg : NULL;
+                        pDbgMod->pvDbgPriv = NULL;
                         rc = pDbg->pVt->pfnTryOpen(pDbgMod, pDbgMod->pImgVt->pfnGetArch(pDbgMod));
                         if (RT_SUCCESS(rc))
                         {
@@ -1279,6 +1292,23 @@ rtDbgModFromMachOImageOpenDsymCallback(RTDBGCFG hDbgCfg, const char *pszFilename
                         Assert(pDbgMod->pvDbgPriv == NULL);
                     }
                 }
+
+                /*
+                 * Likely fallback for when opening image.
+                 */
+                if (pArgs->fOpenImage)
+                {
+                    rc = rtDbgModCreateForExports(pDbgMod);
+                    if (RT_SUCCESS(rc))
+                    {
+                        /*
+                         * Done.
+                         */
+                        RTSemRWReleaseRead(g_hDbgModRWSem);
+                        RTStrCacheRelease(g_hDbgModStrCache, pszImgFileOrg);
+                        return VINF_CALLBACK_RETURN;
+                    }
+                }
             }
 
             pDbgMod->pImgVt->pfnClose(pDbgMod);
@@ -1300,24 +1330,24 @@ rtDbgModFromMachOImageOpenDsymCallback(RTDBGCFG hDbgCfg, const char *pszFilename
 static int rtDbgModFromMachOImageWorker(PRTDBGMODINT pDbgMod, RTLDRARCH enmArch, uint32_t cbImage,
                                         uint32_t cSegs, PCRTDBGSEGMENT paSegs, PCRTUUID pUuid, RTDBGCFG hDbgCfg)
 {
-    RTDBGDWARFSEGPKG SegPkg;
-    SegPkg.cSegs    = cSegs;
-    SegPkg.paSegs   = paSegs;
-    SegPkg.enmArch  = enmArch;
-    SegPkg.pUuid    = pUuid && RTUuidIsNull(pUuid) ? pUuid : NULL;
+    RTDBGMODMACHOARGS Args;
+    Args.enmArch    = enmArch;
+    Args.pUuid      = pUuid && RTUuidIsNull(pUuid) ? pUuid : NULL;
+    Args.fOpenImage = false;
 
     /*
      * Search for the .dSYM bundle first, since that's generally all we need.
      */
     int rc = RTDbgCfgOpenDsymBundle(hDbgCfg, pDbgMod->pszImgFile, pUuid,
-                                    rtDbgModFromMachOImageOpenDsymCallback, pDbgMod, &SegPkg);
+                                    rtDbgModFromMachOImageOpenDsymMachOCallback, pDbgMod, &Args);
     if (RT_FAILURE(rc))
     {
         /*
          * If we cannot get at the .dSYM, try the executable image.
          */
-        //rc = RTDbgCfgOpenMachOImage(hDbgCfg, pDbgMod->pszImgFile, pUuid,
-        //                            rtDbgModFromMachOImageOpenMachOCallback, pDbgMod, &SegPkg);
+        Args.fOpenImage = true;
+        rc = RTDbgCfgOpenMachOImage(hDbgCfg, pDbgMod->pszImgFile, pUuid,
+                                    rtDbgModFromMachOImageOpenDsymMachOCallback, pDbgMod, &Args);
     }
     return rc;
 }
@@ -1391,6 +1421,7 @@ RTDECL(int) RTDbgModCreateFromMachOImage(PRTDBGMOD phDbgMod, const char *pszFile
                  * Load it immediately?
                  */
                 if (   !(fDbgCfg & RTDBGCFG_FLAGS_DEFERRED)
+                    || cSegs /* for the time being. */
                     || (!cbImage && !cSegs)
                     || (fFlags & RTDBGMOD_F_NOT_DEFERRED) )
                     rc = rtDbgModFromMachOImageWorker(pDbgMod, enmArch, cbImage, cSegs, paSegs, pUuid, hDbgCfg);
@@ -1399,18 +1430,8 @@ RTDECL(int) RTDbgModCreateFromMachOImage(PRTDBGMOD phDbgMod, const char *pszFile
                     /*
                      * Procrastinate.  Need image size atm.
                      */
-                    uint32_t uRvaMax = cbImage;
-                    if (!uRvaMax)
-                        for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++)
-                        {
-                            if (   paSegs[iSeg].uRva > uRvaMax
-                                && paSegs[iSeg].uRva - uRvaMax < _1M)
-                                uRvaMax = paSegs[iSeg].uRva;
-                            uRvaMax += paSegs[iSeg].cb;
-                        }
-
                     PRTDBGMODDEFERRED pDeferred;
-                    rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromMachOImageDeferredCallback, uRvaMax, hDbgCfg,
+                    rc = rtDbgModDeferredCreate(pDbgMod, rtDbgModFromMachOImageDeferredCallback, cbImage, hDbgCfg,
                                                 RT_OFFSETOF(RTDBGMODDEFERRED, u.MachO.aSegs[cSegs]),
                                                 &pDeferred);
                     if (RT_SUCCESS(rc))
@@ -1419,23 +1440,7 @@ RTDECL(int) RTDbgModCreateFromMachOImage(PRTDBGMOD phDbgMod, const char *pszFile
                         pDeferred->u.MachO.enmArch = enmArch;
                         pDeferred->u.MachO.cSegs   = cSegs;
                         if (cSegs)
-                        {
                             memcpy(&pDeferred->u.MachO.aSegs, paSegs, cSegs * sizeof(paSegs[0]));
-                            if (!cbImage)
-                            {
-                                /* If we calculated a cbImage above, do corresponding RVA adjustments. */
-                                uRvaMax = 0;
-                                for (uint32_t iSeg = 0; iSeg < cSegs; iSeg++)
-                                {
-                                    if (   paSegs[iSeg].uRva > uRvaMax
-                                        && paSegs[iSeg].uRva - uRvaMax < _1M)
-                                        uRvaMax = paSegs[iSeg].uRva;
-                                    else
-                                        pDeferred->u.MachO.aSegs[iSeg].uRva = uRvaMax;
-                                    uRvaMax += paSegs[iSeg].cb;
-                                }
-                            }
-                        }
                     }
                 }
                 if (RT_SUCCESS(rc))
diff --git a/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp b/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp
index 55d41fb..efa9375 100644
--- a/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgmodcodeview.cpp
@@ -2717,7 +2717,7 @@ static DECLCALLBACK(int) rtDbgModCv_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enmArch
         {
             /* Try the executable in case it has a NBxx tail header. */
             rc2 = rtDbgModCvProbeFile(pMod, pMod->pszImgFile, enmArch);
-            if (RT_FAILURE(rc2) && (RT_SUCCESS(rc) || VERR_DBG_NO_MATCHING_INTERPRETER))
+            if (RT_FAILURE(rc2) && (RT_SUCCESS(rc) || rc == VERR_DBG_NO_MATCHING_INTERPRETER))
                 rc = rc2;
         }
     }
diff --git a/src/VBox/Runtime/common/dbg/dbgmoddbghelp.cpp b/src/VBox/Runtime/common/dbg/dbgmoddbghelp.cpp
index 9641977..f8a1e79 100644
--- a/src/VBox/Runtime/common/dbg/dbgmoddbghelp.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgmoddbghelp.cpp
@@ -215,7 +215,7 @@ static BOOL CALLBACK rtDbgModDbgHelpCopyLineNumberCallback(PSRCCODEINFOW pLineIn
 
     if (pLineInfo->Address < pArgs->uModAddr)
     {
-        Log((" %#018x %05u  %s  [SKIPPED - INVALID ADDRESS!]\n", pLineInfo->Address, pLineInfo->LineNumber));
+        Log((" %#018RX64 %05u  %s  [SKIPPED - INVALID ADDRESS!]\n", pLineInfo->Address, pLineInfo->LineNumber));
         return TRUE;
     }
 
@@ -255,7 +255,7 @@ static BOOL CALLBACK rtDbgModDbgHelpCopyLineNumberCallback(PSRCCODEINFOW pLineIn
      */
     int rc = RTDbgModLineAdd(pArgs->hCnt, pArgs->pszPrev, pLineInfo->LineNumber,
                              RTDBGSEGIDX_RVA, pLineInfo->Address - pArgs->uModAddr, NULL);
-    Log((" %#018x %05u  %s  [%Rrc]\n", pLineInfo->Address, pLineInfo->LineNumber, rc));
+    Log((" %#018RX64 %05u  %s  [%Rrc]\n", pLineInfo->Address, pLineInfo->LineNumber, rc));
     NOREF(rc);
 
     return TRUE;
@@ -311,12 +311,12 @@ static BOOL CALLBACK rtDbgModDbgHelpCopySymbolsCallback(PSYMBOL_INFO pSymInfo, U
     RTDBGMODBGHELPARGS *pArgs = (RTDBGMODBGHELPARGS *)pvUser;
     if (pSymInfo->Address < pArgs->uModAddr) /* NT4 SP1 ntfs.dbg */
     {
-        Log(("  %#018x LB %#07x  %s  [SKIPPED - INVALID ADDRESS!]\n", pSymInfo->Address, cbSymbol, pSymInfo->Name));
+        Log(("  %#018RX64 LB %#07x  %s  [SKIPPED - INVALID ADDRESS!]\n", pSymInfo->Address, cbSymbol, pSymInfo->Name));
         return TRUE;
     }
     if (pSymInfo->NameLen >= RTDBG_SYMBOL_NAME_LENGTH)
     {
-        Log(("  %#018x LB %#07x  %s  [SKIPPED - TOO LONG (%u > %u)!]\n", pSymInfo->Address, cbSymbol, pSymInfo->Name,
+        Log(("  %#018RX64 LB %#07x  %s  [SKIPPED - TOO LONG (%u > %u)!]\n", pSymInfo->Address, cbSymbol, pSymInfo->Name,
              pSymInfo->NameLen, RTDBG_SYMBOL_NAME_LENGTH));
         return TRUE;
     }
@@ -324,7 +324,7 @@ static BOOL CALLBACK rtDbgModDbgHelpCopySymbolsCallback(PSYMBOL_INFO pSymInfo, U
     /* ASSUMES the symbol name is ASCII. */
     int rc = RTDbgModSymbolAdd(pArgs->hCnt, pSymInfo->Name, RTDBGSEGIDX_RVA,
                                pSymInfo->Address - pArgs->uModAddr, cbSymbol, 0, NULL);
-    Log(("  %#018x LB %#07x  %s  [%Rrc]\n", pSymInfo->Address, cbSymbol, pSymInfo->Name, rc));
+    Log(("  %#018RX64 LB %#07x  %s  [%Rrc]\n", pSymInfo->Address, cbSymbol, pSymInfo->Name, rc));
     NOREF(rc);
 
     return TRUE;
diff --git a/src/VBox/Runtime/common/dbg/dbgmoddwarf.cpp b/src/VBox/Runtime/common/dbg/dbgmoddwarf.cpp
index 1091465..840a4fd 100644
--- a/src/VBox/Runtime/common/dbg/dbgmoddwarf.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgmoddwarf.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2013 Oracle Corporation
+ * Copyright (C) 2011-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -285,7 +285,7 @@
 #define DW_ADDR_i386_huge16     UINT8_C(3)
 #define DW_ADDR_i386_near32     UINT8_C(4)
 #define DW_ADDR_i386_far32      UINT8_C(5)
-/** @}  */
+/** @} */
 
 
 /** @name Location Expression Opcodes
@@ -391,7 +391,7 @@ typedef struct RTDWARFABBREV
 {
     /** Whether there are children or not. */
     bool                fChildren;
-    /** The tag.  */
+    /** The tag. */
     uint16_t            uTag;
     /** Offset into the abbrev section of the specification pairs. */
     uint32_t            offSpec;
@@ -460,7 +460,7 @@ typedef struct RTDBGMODDWARF
     /** Used by rtDwarfAbbrev_Lookup when the result is uncachable. */
     RTDWARFABBREV           LookupAbbrev;
 
-    /** The list of compilation units (RTDWARFDIE).   */
+    /** The list of compilation units (RTDWARFDIE). */
     RTLISTANCHOR            CompileUnitList;
 
     /** Set if we have to use link addresses because the module does not have
@@ -483,7 +483,7 @@ typedef struct RTDBGMODDWARF
     /** Pointer to segments if iWatcomPass isn't -1. */
     PRTDBGDWARFSEG          paSegs;
 #ifdef RTDBGMODDWARF_WITH_MEM_CACHE
-    /** DIE allocators.  */
+    /** DIE allocators. */
     struct
     {
         RTMEMCACHE          hMemCache;
@@ -642,11 +642,11 @@ typedef struct RTDWARFDIEDESC
     size_t              cbDie;
     /** The number of attributes. */
     size_t              cAttributes;
-    /** The  */
+    /** Pointer to the array of attributes. */
     PCRTDWARFATTRDESC   paAttributes;
 } RTDWARFDIEDESC;
 typedef struct RTDWARFDIEDESC const *PCRTDWARFDIEDESC;
-/** DIE descriptor initializer.  */
+/** DIE descriptor initializer. */
 #define DIE_DESC_INIT(a_Type, a_aAttrs)  { sizeof(a_Type), RT_ELEMENTS(a_aAttrs), &a_aAttrs[0] }
 
 
@@ -740,7 +740,7 @@ typedef struct RTDWARFLOCST
     RTDWARFCURSOR   Cursor;
     /** Points to the current top of the stack. Initial value -1. */
     int32_t         iTop;
-    /** The value stack.  */
+    /** The value stack. */
     uint64_t        auStack[64];
 } RTDWARFLOCST;
 /** Pointer to location state. */
@@ -859,9 +859,9 @@ typedef struct RTDWARFDIESUBPROGRAM
     /** Reference to the specification. */
     RTDWARFREF          SpecRef;
 } RTDWARFDIESUBPROGRAM;
-/** Pointer to a DW_TAG_subprogram DIE.  */
+/** Pointer to a DW_TAG_subprogram DIE. */
 typedef RTDWARFDIESUBPROGRAM *PRTDWARFDIESUBPROGRAM;
-/** Pointer to a const DW_TAG_subprogram DIE.  */
+/** Pointer to a const DW_TAG_subprogram DIE. */
 typedef RTDWARFDIESUBPROGRAM const *PCRTDWARFDIESUBPROGRAM;
 
 
@@ -911,9 +911,9 @@ typedef struct RTDWARFDIELABEL
     /** Externally visible? */
     bool                fExternal;
 } RTDWARFDIELABEL;
-/** Pointer to a DW_TAG_label DIE.  */
+/** Pointer to a DW_TAG_label DIE. */
 typedef RTDWARFDIELABEL *PRTDWARFDIELABEL;
-/** Pointer to a const DW_TAG_label DIE.  */
+/** Pointer to a const DW_TAG_label DIE. */
 typedef RTDWARFDIELABEL const *PCRTDWARFDIELABEL;
 
 
@@ -935,7 +935,7 @@ static const RTDWARFDIEDESC g_LabelDesc = DIE_DESC_INIT(RTDWARFDIELABEL, g_aLabe
  */
 static const struct RTDWARFTAGDESC
 {
-    /** The tag value.  */
+    /** The tag value. */
     uint16_t            uTag;
     /** The tag name as string. */
     const char         *pszName;
@@ -4403,6 +4403,97 @@ static int rtDwarfInfo_LoadAll(PRTDBGMODDWARF pThis)
 
 
 
+/*
+ *
+ * Public and image level symbol handling.
+ * Public and image level symbol handling.
+ * Public and image level symbol handling.
+ * Public and image level symbol handling.
+ *
+ *
+ */
+
+#define RTDBGDWARF_SYM_ENUM_BASE_ADDRESS  UINT32_C(0x200000)
+
+/** @callback_method_impl{FNRTLDRENUMSYMS,
+ *  Adds missing symbols from the image symbol table.} */
+static DECLCALLBACK(int) rtDwarfSyms_EnumSymbolsCallback(RTLDRMOD hLdrMod, const char *pszSymbol, unsigned uSymbol,
+                                                         RTLDRADDR Value, void *pvUser)
+{
+    PRTDBGMODDWARF pThis = (PRTDBGMODDWARF)pvUser;
+    NOREF(hLdrMod);
+    Assert(pThis->iWatcomPass != 1);
+
+    RTLDRADDR uRva = Value - RTDBGDWARF_SYM_ENUM_BASE_ADDRESS;
+    if (   Value >= RTDBGDWARF_SYM_ENUM_BASE_ADDRESS
+        && uRva  <  _1G)
+    {
+        RTDBGSYMBOL SymInfo;
+        RTINTPTR    offDisp;
+        int rc = RTDbgModSymbolByAddr(pThis->hCnt, RTDBGSEGIDX_RVA, uRva, RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL, &offDisp, &SymInfo);
+        if (   RT_FAILURE(rc)
+            || offDisp != 0)
+        {
+            rc = RTDbgModSymbolAdd(pThis->hCnt, pszSymbol, RTDBGSEGIDX_RVA, uRva, 1, 0 /*fFlags*/, NULL /*piOrdinal*/);
+            Log(("Dwarf: Symbol #%05u %#018RTptr %s [%Rrc]\n", uSymbol, Value, pszSymbol, rc)); NOREF(rc);
+        }
+    }
+    else
+        Log(("Dwarf: Symbol #%05u %#018RTptr '%s' [SKIPPED - INVALID ADDRESS]\n", uSymbol, Value, pszSymbol));
+    return VINF_SUCCESS;
+}
+
+
+
+/**
+ * Loads additional symbols from the pubnames section and the executable image.
+ *
+ * The symbols are insered into the debug info container.
+ *
+ * @returns IPRT status code
+ * @param   pThis               The DWARF instance.
+ */
+static int rtDwarfSyms_LoadAll(PRTDBGMODDWARF pThis)
+{
+    /*
+     * pubnames.
+     */
+    int rc = VINF_SUCCESS;
+    if (pThis->aSections[krtDbgModDwarfSect_pubnames].fPresent)
+    {
+//        RTDWARFCURSOR Cursor;
+//        int rc = rtDwarfCursor_Init(&Cursor, pThis, krtDbgModDwarfSect_info);
+//        if (RT_SUCCESS(rc))
+//        {
+//            while (   !rtDwarfCursor_IsAtEnd(&Cursor)
+//                   && RT_SUCCESS(rc))
+//                rc = rtDwarfInfo_LoadUnit(pThis, &Cursor, false /* fKeepDies */);
+//
+//            rc = rtDwarfCursor_Delete(&Cursor, rc);
+//        }
+//        return rc;
+    }
+
+    /*
+     * The executable image.
+     */
+    if (   pThis->pImgMod
+        && pThis->pImgMod->pImgVt->pfnEnumSymbols
+        && pThis->iWatcomPass != 1
+        && RT_SUCCESS(rc))
+    {
+        rc = pThis->pImgMod->pImgVt->pfnEnumSymbols(pThis->pImgMod,
+                                                    RTLDR_ENUM_SYMBOL_FLAGS_ALL | RTLDR_ENUM_SYMBOL_FLAGS_NO_FWD,
+                                                    RTDBGDWARF_SYM_ENUM_BASE_ADDRESS,
+                                                    rtDwarfSyms_EnumSymbolsCallback,
+                                                    pThis);
+    }
+
+    return rc;
+}
+
+
+
 
 /*
  *
@@ -4711,8 +4802,9 @@ static DECLCALLBACK(int) rtDbgModDwarf_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enmA
     pThis->pImgMod     = pMod;
     RTListInit(&pThis->CompileUnitList);
     /** @todo better fUseLinkAddress heuristics! */
-    if (   (pMod->pszDbgFile && strstr(pMod->pszDbgFile, "mach_kernel"))
-        || (pMod->pszImgFile && strstr(pMod->pszImgFile, "mach_kernel")) )
+    if (   (pMod->pszDbgFile          && strstr(pMod->pszDbgFile,          "mach_kernel"))
+        || (pMod->pszImgFile          && strstr(pMod->pszImgFile,          "mach_kernel"))
+        || (pMod->pszImgFileSpecified && strstr(pMod->pszImgFileSpecified, "mach_kernel")) )
         pThis->fUseLinkAddress = true;
 
 #ifdef RTDBGMODDWARF_WITH_MEM_CACHE
@@ -4767,6 +4859,8 @@ static DECLCALLBACK(int) rtDbgModDwarf_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enmA
                 if (RT_SUCCESS(rc))
                     rc = rtDwarfInfo_LoadAll(pThis);
                 if (RT_SUCCESS(rc))
+                    rc = rtDwarfSyms_LoadAll(pThis);
+                if (RT_SUCCESS(rc))
                     rc = rtDwarfLine_ExplodeAll(pThis);
                 if (RT_SUCCESS(rc) && pThis->iWatcomPass == 1)
                 {
@@ -4775,6 +4869,8 @@ static DECLCALLBACK(int) rtDbgModDwarf_TryOpen(PRTDBGMODINT pMod, RTLDRARCH enmA
                     if (RT_SUCCESS(rc))
                         rc = rtDwarfInfo_LoadAll(pThis);
                     if (RT_SUCCESS(rc))
+                        rc = rtDwarfSyms_LoadAll(pThis);
+                    if (RT_SUCCESS(rc))
                         rc = rtDwarfLine_ExplodeAll(pThis);
                 }
                 if (RT_SUCCESS(rc))
diff --git a/src/VBox/Runtime/common/dbg/dbgmodexports.cpp b/src/VBox/Runtime/common/dbg/dbgmodexports.cpp
index d25bff5..b62e250 100644
--- a/src/VBox/Runtime/common/dbg/dbgmodexports.cpp
+++ b/src/VBox/Runtime/common/dbg/dbgmodexports.cpp
@@ -66,10 +66,10 @@ static DECLCALLBACK(int) rtDbgModExportsAddSymbolCallback(RTLDRMOD hLdrMod, cons
     {
         int rc = RTDbgModSymbolAdd(pArgs->pDbgMod, pszSymbol, RTDBGSEGIDX_RVA, Value - pArgs->uImageBase,
                                    0 /*cb*/, 0 /* fFlags */, NULL /*piOrdinal*/);
-        Log(("Symbol #%05u %#018x %s [%Rrc]\n", uSymbol, Value, pszSymbol, rc)); NOREF(rc);
+        Log(("Symbol #%05u %#018RTptr %s [%Rrc]\n", uSymbol, Value, pszSymbol, rc)); NOREF(rc);
     }
     else
-        Log(("Symbol #%05u %#018x %s [SKIPPED - INVALID ADDRESS]\n", uSymbol, Value, pszSymbol));
+        Log(("Symbol #%05u %#018RTptr %s [SKIPPED - INVALID ADDRESS]\n", uSymbol, Value, pszSymbol));
     return VINF_SUCCESS;
 }
 
@@ -86,7 +86,8 @@ static DECLCALLBACK(int) rtDbgModExportsAddSegmentsCallback(RTLDRMOD hLdrMod, PC
     pArgs->cSegs++;
 
     /* Add dummy segments for segments that doesn't get mapped. */
-    if (pSeg->LinkAddress == NIL_RTLDRADDR)
+    if (   pSeg->LinkAddress == NIL_RTLDRADDR
+        || pSeg->RVA         == NIL_RTLDRADDR)
         return RTDbgModSegmentAdd(pArgs->pDbgMod, 0, 0, pSeg->pszName, 0 /*fFlags*/, NULL);
 
     RTLDRADDR uRva = pSeg->RVA;
diff --git a/src/VBox/Runtime/common/ldr/Makefile.kup b/src/VBox/Runtime/common/ldr/Makefile.kup
index d3f5a12..e69de29 100644
--- a/src/VBox/Runtime/common/ldr/Makefile.kup
+++ b/src/VBox/Runtime/common/ldr/Makefile.kup
@@ -1 +0,0 @@
-
diff --git a/src/VBox/Runtime/common/ldr/ldrMemory.cpp b/src/VBox/Runtime/common/ldr/ldrMemory.cpp
index 944b3a2..2cfacb8 100644
--- a/src/VBox/Runtime/common/ldr/ldrMemory.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrMemory.cpp
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -71,7 +71,7 @@ typedef struct RTLDRRDRMEM
     /** The fake filename (variable size). */
     char                szName[1];
 } RTLDRRDRMEM;
-/** Memory based loader reader instance data.   */
+/** Memory based loader reader instance data. */
 typedef RTLDRRDRMEM *PRTLDRRDRMEM;
 
 
diff --git a/src/VBox/Runtime/common/ldr/ldrNative.cpp b/src/VBox/Runtime/common/ldr/ldrNative.cpp
index 1d20713..1d2f0ab 100644
--- a/src/VBox/Runtime/common/ldr/ldrNative.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrNative.cpp
@@ -186,7 +186,7 @@ RTDECL(int) RTLdrLoadSystem(const char *pszFilename, bool fNoUnload, PRTLDRMOD p
     AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER);
     *phLdrMod = NIL_RTLDRMOD;
     AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
-    AssertMsgReturn(!RTPathHavePath(pszFilename), ("%s\n", pszFilename), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!RTPathHasPath(pszFilename), ("%s\n", pszFilename), VERR_INVALID_PARAMETER);
 
     /*
      * Check the filename.
@@ -194,14 +194,14 @@ RTDECL(int) RTLdrLoadSystem(const char *pszFilename, bool fNoUnload, PRTLDRMOD p
     size_t cchFilename = strlen(pszFilename);
     AssertMsgReturn(cchFilename < (RTPATH_MAX / 4) * 3, ("%zu\n", cchFilename), VERR_INVALID_PARAMETER);
 
-    const char *pszExt = "";
-    if (!RTPathHaveExt(pszFilename))
-        pszExt = RTLdrGetSuff();
+    const char *pszSuffix = "";
+    if (!RTPathHasSuffix(pszFilename))
+        pszSuffix = RTLdrGetSuff();
 
     /*
      * Let the platform specific code do the rest.
      */
-    int rc = rtldrNativeLoadSystem(pszFilename, pszExt, fNoUnload ? RTLDRLOAD_FLAGS_NO_UNLOAD : 0, phLdrMod);
+    int rc = rtldrNativeLoadSystem(pszFilename, pszSuffix, fNoUnload ? RTLDRLOAD_FLAGS_NO_UNLOAD : 0, phLdrMod);
     LogFlow(("RTLdrLoadSystem: returns %Rrc\n", rc));
     return rc;
 }
@@ -243,7 +243,7 @@ RTDECL(int) RTLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod)
     AssertPtrReturn(phLdrMod, VERR_INVALID_PARAMETER);
     *phLdrMod = NIL_RTLDRMOD;
     AssertPtrReturn(pszFilename, VERR_INVALID_PARAMETER);
-    AssertMsgReturn(!RTPathHavePath(pszFilename), ("%s\n", pszFilename), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!RTPathHasPath(pszFilename), ("%s\n", pszFilename), VERR_INVALID_PARAMETER);
 
     /*
      * Check the filename.
@@ -251,26 +251,26 @@ RTDECL(int) RTLdrLoadAppPriv(const char *pszFilename, PRTLDRMOD phLdrMod)
     size_t cchFilename = strlen(pszFilename);
     AssertMsgReturn(cchFilename < (RTPATH_MAX / 4) * 3, ("%zu\n", cchFilename), VERR_INVALID_PARAMETER);
 
-    const char *pszExt = "";
-    size_t cchExt = 0;
-    if (!RTPathHaveExt(pszFilename))
+    const char *pszSuffix = "";
+    size_t cchSuffix = 0;
+    if (!RTPathHasSuffix(pszFilename))
     {
-        pszExt = RTLdrGetSuff();
-        cchExt = strlen(pszExt);
+        pszSuffix = RTLdrGetSuff();
+        cchSuffix = strlen(pszSuffix);
     }
 
     /*
      * Construct the private arch path and check if the file exists.
      */
     char szPath[RTPATH_MAX];
-    int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - 1 - cchExt - cchFilename);
+    int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - 1 - cchSuffix - cchFilename);
     AssertRCReturn(rc, rc);
 
     char *psz = strchr(szPath, '\0');
     *psz++ = RTPATH_SLASH;
     memcpy(psz, pszFilename, cchFilename);
     psz += cchFilename;
-    memcpy(psz, pszExt, cchExt + 1);
+    memcpy(psz, pszSuffix, cchSuffix + 1);
 
     if (!RTPathExists(szPath))
     {
diff --git a/src/VBox/Runtime/common/ldr/ldrPE.cpp b/src/VBox/Runtime/common/ldr/ldrPE.cpp
index 5583958..c9f69c0 100644
--- a/src/VBox/Runtime/common/ldr/ldrPE.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrPE.cpp
@@ -3600,11 +3600,10 @@ static int rtldrPEValidateDirectoriesAndRememberStuff(PRTLDRMODPE pModPe, const
             } while (off < Dir.Size);
         }
         RTMemTmpFree(pFirst);
-        if (RT_FAILURE(rc))
+        if (RT_FAILURE(rc) && !(fFlags & RTLDR_O_FOR_DEBUG))
             return rc;
     }
 
-
     return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/Runtime/common/ldr/ldrkStuff.cpp b/src/VBox/Runtime/common/ldr/ldrkStuff.cpp
index 0ba1f2d..7438466 100644
--- a/src/VBox/Runtime/common/ldr/ldrkStuff.cpp
+++ b/src/VBox/Runtime/common/ldr/ldrkStuff.cpp
@@ -110,7 +110,6 @@ static int rtkldrConvertError(int krc)
         case KERR_NO_MEMORY:                                return VERR_NO_MEMORY;
         case KLDR_ERR_CPU_ARCH_MISMATCH:                    return VERR_LDR_ARCH_MISMATCH;
 
-
         case KLDR_ERR_UNKNOWN_FORMAT:
         case KLDR_ERR_MZ_NOT_SUPPORTED:                     return VERR_MZ_EXE_NOT_SUPPORTED;
         case KLDR_ERR_NE_NOT_SUPPORTED:                     return VERR_NE_EXE_NOT_SUPPORTED;
@@ -844,19 +843,15 @@ static DECLCALLBACK(int) rtkldr_QueryProp(PRTLDRMODINTERNAL pMod, RTLDRPROP enmP
                                           void *pvBuf, size_t cbBuf, size_t *pcbRet)
 {
     PRTLDRMODKLDR pThis = (PRTLDRMODKLDR)pMod;
-#if 0
     int           rc;
-#endif
     switch (enmProp)
     {
         case RTLDRPROP_UUID:
-#if 0 /* Requires neewer kStuff version. */
             rc = kLdrModQueryImageUuid(pThis->pMod, /*pvBits*/ NULL, (uint8_t *)pvBuf, cbBuf);
             if (rc == KLDR_ERR_NO_IMAGE_UUID)
                 return VERR_NOT_FOUND;
             AssertReturn(rc == 0, VERR_INVALID_PARAMETER);
             break;
-#endif
 
         default:
             return VERR_NOT_FOUND;
diff --git a/src/VBox/Runtime/common/log/log.cpp b/src/VBox/Runtime/common/log/log.cpp
index 62463c4..65982ad 100644
--- a/src/VBox/Runtime/common/log/log.cpp
+++ b/src/VBox/Runtime/common/log/log.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -63,6 +63,33 @@
 
 
 /*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** @def RTLOG_RINGBUF_DEFAULT_SIZE
+ * The default ring buffer size. */
+/** @def RTLOG_RINGBUF_MAX_SIZE
+ * The max ring buffer size. */
+/** @def RTLOG_RINGBUF_MIN_SIZE
+ * The min ring buffer size. */
+#ifdef IN_RING0
+# define RTLOG_RINGBUF_DEFAULT_SIZE     _64K
+# define RTLOG_RINGBUF_MAX_SIZE         _4M
+# define RTLOG_RINGBUF_MIN_SIZE         _1K
+#elif defined(IN_RING3) || defined(DOXYGEN_RUNNING)
+# define RTLOG_RINGBUF_DEFAULT_SIZE     _512K
+# define RTLOG_RINGBUF_MAX_SIZE         _1G
+# define RTLOG_RINGBUF_MIN_SIZE         _4K
+#endif
+/** The start of ring buffer eye catcher (16 bytes). */
+#define RTLOG_RINGBUF_EYE_CATCHER           "START RING BUF\0"
+AssertCompile(sizeof(RTLOG_RINGBUF_EYE_CATCHER) == 16);
+/** The end of ring buffer eye catcher (16 bytes).  This also ensures that the ring buffer
+ * forms are properly terminated C string (leading zero chars).  */
+#define RTLOG_RINGBUF_EYE_CATCHER_END    "\0\0\0END RING BUF"
+AssertCompile(sizeof(RTLOG_RINGBUF_EYE_CATCHER_END) == 16);
+
+
+/*******************************************************************************
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
 /**
@@ -78,6 +105,8 @@ typedef struct RTLOGOUTPUTPREFIXEDARGS
     unsigned                iGroup;
 } RTLOGOUTPUTPREFIXEDARGS, *PRTLOGOUTPUTPREFIXEDARGS;
 
+#ifndef IN_RC
+
 /**
  * Internal logger data.
  *
@@ -102,7 +131,10 @@ typedef struct RTLOGGERINTERNAL
     /** This is set if a prefix is pending. */
     bool                    fPendingPrefix;
     /** Alignment padding. */
-    bool                    afPadding1[3];
+    bool                    afPadding1[2];
+    /** Set if fully created.  Used to avoid confusing in a few functions used to
+     * parse logger settings from environment variables. */
+    bool                    fCreated;
 
     /** The max number of groups that there is room for in afGroups and papszGroups.
      * Used by RTLogCopyGroupAndFlags(). */
@@ -116,10 +148,34 @@ typedef struct RTLOGGERINTERNAL
     uint32_t               *pacEntriesPerGroup;
     /** The max number of entries per group. */
     uint32_t                cMaxEntriesPerGroup;
-    /** Padding.  */
-    uint32_t                u32Padding2;
 
-#ifdef IN_RING3 /* Note! Must be at the end! */
+    /** @name Ring buffer logging
+     * The ring buffer records the last cbRingBuf - 1 of log output.  The
+     * other configured log destinations are not touched until someone calls
+     * RTLogFlush(), when the ring buffer content is written to them all.
+     *
+     * The aim here is a fast logging destination, that avoids wasting storage
+     * space saving disk space when dealing with huge log volumes where the
+     * interesting bits usually are found near the end of the log.  This is
+     * typically the case for scenarios that crashes or hits assertions.
+     *
+     * RTLogFlush() is called implicitly when hitting an assertion.  While on a
+     * crash the most debuggers are able to make calls these days, it's usually
+     * possible to view the ring buffer memory.
+     *
+     * @{ */
+    /** Ring buffer size (including both eye catchers). */
+    uint32_t                cbRingBuf;
+    /** Number of bytes passing thru the ring buffer since last RTLogFlush call.
+     * (This is used to avoid writing out the same bytes twice.) */
+    uint64_t volatile       cbRingBufUnflushed;
+    /** Ring buffer pointer (points at RTLOG_RINGBUF_EYE_CATCHER). */
+    char                   *pszRingBuf;
+    /** Current ring buffer position (where to write the next char). */
+    char * volatile         pchRingBufCur;
+    /** @} */
+
+# ifdef IN_RING3 /* Note! Must be at the end! */
     /** @name File logging bits for the logger.
      * @{ */
     /** Pointer to the function called when starting logging, and when
@@ -143,18 +199,22 @@ typedef struct RTLOGGERINTERNAL
     /** Pointer to filename. */
     char                    szFilename[RTPATH_MAX];
     /** @} */
-#endif /* IN_RING3 */
+# endif /* IN_RING3 */
 } RTLOGGERINTERNAL;
 
 /** The revision of the internal logger structure. */
-#define RTLOGGERINTERNAL_REV    UINT32_C(9)
+# define RTLOGGERINTERNAL_REV    UINT32_C(10)
 
-#ifdef IN_RING3
+# ifdef IN_RING3
 /** The size of the RTLOGGERINTERNAL structure in ring-0.  */
-# define RTLOGGERINTERNAL_R0_SIZE       RT_OFFSETOF(RTLOGGERINTERNAL, pfnPhase)
+#  define RTLOGGERINTERNAL_R0_SIZE       RT_OFFSETOF(RTLOGGERINTERNAL, pfnPhase)
 AssertCompileMemberAlignment(RTLOGGERINTERNAL, hFile, sizeof(void *));
 AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbHistoryFileMax, sizeof(uint64_t));
-#endif
+# endif
+AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbRingBufUnflushed, sizeof(uint64_t));
+
+#endif /* !IN_RC */
+
 
 /*******************************************************************************
 *   Internal Functions                                                         *
@@ -163,12 +223,16 @@ AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbHistoryFileMax, sizeof(uint64_t
 static unsigned rtlogGroupFlags(const char *psz);
 #endif
 #ifdef IN_RING0
-static void rtR0LogLoggerExFallback(uint32_t fDestFlags, uint32_t fFlags, const char *pszFormat, va_list va);
+static void rtR0LogLoggerExFallback(uint32_t fDestFlags, uint32_t fFlags, PRTLOGGERINTERNAL pInt,
+                                    const char *pszFormat, va_list va);
 #endif
 #ifdef IN_RING3
 static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMsg);
 static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst);
 #endif
+#ifndef IN_RC
+static void rtLogRingBufFlush(PRTLOGGER pLogger);
+#endif
 static void rtlogFlush(PRTLOGGER pLogger);
 static DECLCALLBACK(size_t) rtLogOutput(void *pv, const char *pachChars, size_t cbChars);
 static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars, size_t cbChars);
@@ -281,24 +345,25 @@ static struct
     uint32_t    fFlag;                  /**< The corresponding destination flag. */
 } const s_aLogDst[] =
 {
-    { "file",     sizeof("file"    ) - 1,  RTLOGDEST_FILE }, /* Must be 1st! */
-    { "dir",      sizeof("dir"     ) - 1,  RTLOGDEST_FILE }, /* Must be 2nd! */
-    { "history",  sizeof("history" ) - 1,  0 },              /* Must be 3rd! */
-    { "histsize", sizeof("histsize") - 1,  0 },              /* Must be 4th! */
-    { "histtime", sizeof("histtime") - 1,  0 },              /* Must be 5th! */
-    { "stdout",   sizeof("stdout"  ) - 1,  RTLOGDEST_STDOUT },
-    { "stderr",   sizeof("stderr"  ) - 1,  RTLOGDEST_STDERR },
-    { "debugger", sizeof("debugger") - 1,  RTLOGDEST_DEBUGGER },
-    { "com",      sizeof("com"     ) - 1,  RTLOGDEST_COM },
-    { "user",     sizeof("user"    ) - 1,  RTLOGDEST_USER },
+    { RT_STR_TUPLE("file"),         RTLOGDEST_FILE },       /* Must be 1st! */
+    { RT_STR_TUPLE("dir"),          RTLOGDEST_FILE },       /* Must be 2nd! */
+    { RT_STR_TUPLE("history"),      0 },                    /* Must be 3rd! */
+    { RT_STR_TUPLE("histsize"),     0 },                    /* Must be 4th! */
+    { RT_STR_TUPLE("histtime"),     0 },                    /* Must be 5th! */
+    { RT_STR_TUPLE("ringbuf"),      RTLOGDEST_RINGBUF },    /* Must be 6th! */
+    { RT_STR_TUPLE("stdout"),       RTLOGDEST_STDOUT },
+    { RT_STR_TUPLE("stderr"),       RTLOGDEST_STDERR },
+    { RT_STR_TUPLE("debugger"),     RTLOGDEST_DEBUGGER },
+    { RT_STR_TUPLE("com"),          RTLOGDEST_COM },
+    { RT_STR_TUPLE("user"),         RTLOGDEST_USER },
 };
 
-/**
- * Log rotation backoff table, important on Windows host, especially for
- * VBoxSVC release logging. Only a medium term solution, until a proper fix
- * for log file handling is available. 10 seconds total.
+/** Log rotation backoff table - millisecond sleep intervals.
+ * Important on Windows host, especially for VBoxSVC release logging.  Only a
+ * medium term solution, until a proper fix for log file handling is available.
+ * 10 seconds total.
  */
-static const uint32_t s_aLogBackoff[] =
+static const uint32_t g_acMsLogBackoff[] =
 { 10, 10, 10, 20, 50, 100, 200, 200, 200, 200, 500, 500, 500, 500, 1000, 1000, 1000, 1000, 1000, 1000, 1000 };
 
 
@@ -434,6 +499,283 @@ static DECLCALLBACK(void) rtlogPhaseMsgNormal(PRTLOGGER pLogger, const char *psz
 
 # endif /* IN_RING3 */
 
+/**
+ * Adjusts the ring buffer.
+ *
+ * @returns IPRT status code.
+ * @param   pLogger     The logger instance.
+ * @param   cbNewSize   The new ring buffer size (0 == default).
+ * @param   fForce      Whether to do this even if the logger instance hasn't
+ *                      really been fully created yet (i.e. during RTLogCreate).
+ */
+static int rtLogRingBufAdjust(PRTLOGGER pLogger, uint32_t cbNewSize, bool fForce)
+{
+    /*
+     * If this is early logger init, don't do anything.
+     */
+    if (!pLogger->pInt->fCreated && !fForce)
+        return VINF_SUCCESS;
+
+    /*
+     * Lock the logger and make the necessary changes.
+     */
+    int rc = rtlogLock(pLogger);
+    if (RT_SUCCESS(rc))
+    {
+        if (cbNewSize == 0)
+            cbNewSize = RTLOG_RINGBUF_DEFAULT_SIZE;
+        if (   pLogger->pInt->cbRingBuf != cbNewSize
+            || !pLogger->pInt->pchRingBufCur)
+        {
+            uintptr_t offOld = pLogger->pInt->pchRingBufCur - pLogger->pInt->pszRingBuf;
+            if (offOld < sizeof(RTLOG_RINGBUF_EYE_CATCHER))
+                offOld = sizeof(RTLOG_RINGBUF_EYE_CATCHER);
+            else if (offOld >= cbNewSize)
+            {
+                memmove(pLogger->pInt->pszRingBuf, &pLogger->pInt->pszRingBuf[offOld - cbNewSize], cbNewSize);
+                offOld = sizeof(RTLOG_RINGBUF_EYE_CATCHER);
+            }
+
+            void *pvNew = RTMemRealloc(pLogger->pInt->pchRingBufCur, cbNewSize);
+            if (pvNew)
+            {
+                pLogger->pInt->pszRingBuf    = (char *)pvNew;
+                pLogger->pInt->pchRingBufCur = (char *)pvNew + offOld;
+                pLogger->pInt->cbRingBuf     = cbNewSize;
+                memcpy(pvNew, RTLOG_RINGBUF_EYE_CATCHER, sizeof(RTLOG_RINGBUF_EYE_CATCHER));
+                memcpy((char *)pvNew + cbNewSize - sizeof(RTLOG_RINGBUF_EYE_CATCHER_END),
+                       RTLOG_RINGBUF_EYE_CATCHER_END, sizeof(RTLOG_RINGBUF_EYE_CATCHER_END));
+                rc = VINF_SUCCESS;
+            }
+            else
+                rc = VERR_NO_MEMORY;
+        }
+        rtlogUnlock(pLogger);
+    }
+
+    return rc;
+}
+
+
+/**
+ * Writes text to the ring buffer.
+ *
+ * @param   pInt                The internal logger data structure.
+ * @param   pachText            The text to write.
+ * @param   cchText             The number of chars (bytes) to write.
+ */
+static void rtLogRingBufWrite(PRTLOGGERINTERNAL pInt, const char *pachText, size_t cchText)
+{
+    /*
+     * Get the ring buffer data, adjusting it to only describe the writable
+     * part of the buffer.
+     */
+    char * const pchStart = &pInt->pszRingBuf[sizeof(RTLOG_RINGBUF_EYE_CATCHER)];
+    size_t const cchBuf   = pInt->cbRingBuf - sizeof(RTLOG_RINGBUF_EYE_CATCHER) - sizeof(RTLOG_RINGBUF_EYE_CATCHER_END);
+    char        *pchCur   = pInt->pchRingBufCur;
+    size_t       cchLeft  = pchCur - pchStart;
+    if (RT_LIKELY(cchLeft < cchBuf))
+        cchLeft = cchBuf - cchLeft;
+    else
+    {
+        /* May happen in ring-0 where a thread or two went ahead without getting the lock. */
+        pchCur = pchStart;
+        cchLeft = cchBuf;
+    }
+    Assert(cchBuf < pInt->cbRingBuf);
+
+    if (cchText < cchLeft)
+    {
+        /*
+         * The text fits in the remaining space.
+         */
+        memcpy(pchCur, pachText, cchText);
+        pchCur[cchText] = '\0';
+        pInt->pchRingBufCur = &pchCur[cchText];
+        pInt->cbRingBufUnflushed += cchText;
+    }
+    else
+    {
+        /*
+         * The text wraps around.  Taking the simple but inefficient approach
+         * to input texts that are longer than the ring buffer since that
+         * is unlikely to the be a frequent case.
+         */
+        /* Fill to the end of the buffer. */
+        memcpy(pchCur, pachText, cchLeft);
+        pachText += cchLeft;
+        cchText  -= cchLeft;
+        pInt->cbRingBufUnflushed += cchLeft;
+        pInt->pchRingBufCur       = pchStart;
+
+        /* Ring buffer overflows (the plainly inefficient bit). */
+        while (cchText >= cchBuf)
+        {
+            memcpy(pchStart, pachText, cchBuf);
+            pachText += cchBuf;
+            cchText  -= cchBuf;
+            pInt->cbRingBufUnflushed += cchBuf;
+        }
+
+        /* The final bit, if any. */
+        if (cchText > 0)
+        {
+            memcpy(pchStart, pachText, cchText);
+            pInt->cbRingBufUnflushed += cchText;
+        }
+        pchStart[cchText] = '\0';
+        pInt->pchRingBufCur = &pchStart[cchText];
+    }
+}
+
+
+/**
+ * Flushes the ring buffer to all the other log destinations.
+ *
+ * @param   pLogger     The logger instance which ring buffer should be flushed.
+ */
+static void rtLogRingBufFlush(PRTLOGGER pLogger)
+{
+    const char  *pszPreamble;
+    size_t       cchPreamble;
+    const char  *pszFirst;
+    size_t       cchFirst;
+    const char  *pszSecond;
+    size_t       cchSecond;
+
+    /*
+     * Get the ring buffer data, adjusting it to only describe the writable
+     * part of the buffer.
+     */
+    uint64_t     cchUnflushed = pLogger->pInt->cbRingBufUnflushed;
+    char * const pszBuf   = &pLogger->pInt->pszRingBuf[sizeof(RTLOG_RINGBUF_EYE_CATCHER)];
+    size_t const cchBuf   = pLogger->pInt->cbRingBuf - sizeof(RTLOG_RINGBUF_EYE_CATCHER) - sizeof(RTLOG_RINGBUF_EYE_CATCHER_END);
+    size_t       offCur   = pLogger->pInt->pchRingBufCur - pszBuf;
+    size_t       cchAfter;
+    if (RT_LIKELY(offCur < cchBuf))
+        cchAfter = cchBuf - offCur;
+    else /* May happen in ring-0 where a thread or two went ahead without getting the lock. */
+    {
+        offCur   = 0;
+        cchAfter = cchBuf;
+    }
+
+    pLogger->pInt->cbRingBufUnflushed = 0;
+
+    /*
+     * Figure out whether there are one or two segments that needs writing,
+     * making the last segment is terminated.  (The first is always
+     * terminated because of the eye-catcher at the end of the buffer.)
+     */
+    if (cchUnflushed == 0)
+        return;
+    pszBuf[offCur] = '\0';
+    if (cchUnflushed >= cchBuf)
+    {
+        pszFirst    = &pszBuf[offCur + 1];
+        cchFirst    = cchAfter ? cchAfter - 1 : 0;
+        pszSecond   = pszBuf;
+        cchSecond   = offCur;
+        pszPreamble =        "\n*FLUSH RING BUF*\n";
+        cchPreamble = sizeof("\n*FLUSH RING BUF*\n") - 1;
+    }
+    else if ((size_t)cchUnflushed <= offCur)
+    {
+        cchFirst    = (size_t)cchUnflushed;
+        pszFirst    = &pszBuf[offCur - cchFirst];
+        pszSecond   = "";
+        cchSecond   = 0;
+        pszPreamble = "";
+        cchPreamble = 0;
+    }
+    else
+    {
+        cchFirst    = (size_t)cchUnflushed - offCur;
+        pszFirst    = &pszBuf[cchBuf - cchFirst];
+        pszSecond   = pszBuf;
+        cchSecond   = offCur;
+        pszPreamble = "";
+        cchPreamble = 0;
+    }
+
+    /*
+     * Write the ring buffer to all other destiations.
+     */
+    if (pLogger->fDestFlags & RTLOGDEST_USER)
+    {
+        if (cchPreamble)
+            RTLogWriteUser(pszPreamble, cchPreamble);
+        if (cchFirst)
+            RTLogWriteUser(pszFirst, cchFirst);
+        if (cchSecond)
+            RTLogWriteUser(pszSecond, cchSecond);
+    }
+
+    if (pLogger->fDestFlags & RTLOGDEST_DEBUGGER)
+    {
+        if (cchPreamble)
+            RTLogWriteDebugger(pszPreamble, cchPreamble);
+        if (cchFirst)
+            RTLogWriteDebugger(pszFirst, cchFirst);
+        if (cchSecond)
+            RTLogWriteDebugger(pszSecond, cchSecond);
+    }
+
+# ifdef IN_RING3
+    if (pLogger->fDestFlags & RTLOGDEST_FILE)
+    {
+        if (pLogger->pInt->hFile != NIL_RTFILE)
+        {
+            if (cchPreamble)
+                RTFileWrite(pLogger->pInt->hFile, pszPreamble, cchPreamble, NULL);
+            if (cchFirst)
+                RTFileWrite(pLogger->pInt->hFile, pszFirst, cchFirst, NULL);
+            if (cchSecond)
+                RTFileWrite(pLogger->pInt->hFile, pszSecond, cchSecond, NULL);
+            if (pLogger->fFlags & RTLOGFLAGS_FLUSH)
+                RTFileFlush(pLogger->pInt->hFile);
+        }
+        if (pLogger->pInt->cHistory)
+            pLogger->pInt->cbHistoryFileWritten += cchFirst + cchSecond;
+    }
+# endif
+
+    if (pLogger->fDestFlags & RTLOGDEST_STDOUT)
+    {
+        if (cchPreamble)
+            RTLogWriteStdOut(pszPreamble, cchPreamble);
+        if (cchFirst)
+            RTLogWriteStdOut(pszFirst, cchFirst);
+        if (cchSecond)
+            RTLogWriteStdOut(pszSecond, cchSecond);
+    }
+
+    if (pLogger->fDestFlags & RTLOGDEST_STDERR)
+    {
+        if (cchPreamble)
+            RTLogWriteStdErr(pszPreamble, cchPreamble);
+        if (cchFirst)
+            RTLogWriteStdErr(pszFirst, cchFirst);
+        if (cchSecond)
+            RTLogWriteStdErr(pszSecond, cchSecond);
+    }
+
+# if defined(IN_RING0) && !defined(LOG_NO_COM)
+    if (pLogger->fDestFlags & RTLOGDEST_COM)
+    {
+        if (cchPreamble)
+            RTLogWriteCom(pszPreamble, cchPreamble);
+        if (cchFirst)
+            RTLogWriteCom(pszFirst, cchFirst);
+        if (cchSecond)
+            RTLogWriteCom(pszSecond, cchSecond);
+    }
+# endif
+}
+
+
+
+
 RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,
                            const char *pszEnvVarBase, unsigned cGroups, const char * const *papszGroups,
                            uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,
@@ -488,7 +830,7 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
         pLogger->pInt->pvPrefixUserArg          = NULL;
         pLogger->pInt->afPadding1[0]            = false;
         pLogger->pInt->afPadding1[1]            = false;
-        pLogger->pInt->afPadding1[2]            = false;
+        pLogger->pInt->fCreated                 = false;
         pLogger->pInt->cMaxGroups               = cGroups;
         pLogger->pInt->papszGroups              = papszGroups;
         if (fFlags & RTLOGFLAGS_RESTRICT_GROUPS)
@@ -624,6 +966,9 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
             }
 # endif  /* IN_RING3 */
 
+            if ((pLogger->fDestFlags & RTLOGDEST_RINGBUF) && RT_SUCCESS(rc))
+                rc = rtLogRingBufAdjust(pLogger, pLogger->pInt->cbRingBuf, true /*fForce*/);
+
             /*
              * Create mutex and check how much it counts when entering the lock
              * so that we can report the values for RTLOGFLAGS_PREFIX_LOCK_COUNTS.
@@ -649,6 +994,7 @@ RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *psz
                     if (pLogger->pInt->pfnPhase)
                         pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_BEGIN, rtlogPhaseMsgNormal);
 # endif
+                    pLogger->pInt->fCreated = true;
                     *ppLogger = pLogger;
                     return VINF_SUCCESS;
                 }
@@ -1000,6 +1346,7 @@ RTDECL(int) RTLogCreateForR0(PRTLOGGER pLogger, size_t cbLogger,
     else
         pInt->pacEntriesPerGroup= NULL;
 
+    pInt->fCreated              = true;
     pLogger->u32Magic           = RTLOGGER_MAGIC;
     return VINF_SUCCESS;
 }
@@ -1101,7 +1448,7 @@ RTDECL(void) RTLogFlushR0(PRTLOGGER pLogger, PRTLOGGER pLoggerR0)
     }
 
     /*
-     * Any thing to flush?
+     * Anything to flush?
      */
     if (    pLoggerR0->offScratch
         ||  pLogger->offScratch)
@@ -1918,20 +2265,27 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszValue)
                     pszEnd = strchr(pszValue, ';');
                     if (!pszEnd)
                         pszEnd = strchr(pszValue, '\0');
-# ifdef IN_RING3
                     size_t cch = pszEnd - pszValue;
+# ifdef IN_RING3
+                    char szTmp[sizeof(pLogger->pInt->szFilename)];
+# else
+                    char szTmp[32];
+# endif
+                    if (0)
+                    { /* nothing */ }
+#ifdef IN_RING3
 
                     /* log file name */
-                    if (i == 0 /* file */ && !fNo)
+                    else if (i == 0 /* file */ && !fNo)
                     {
                         AssertReturn(cch < sizeof(pLogger->pInt->szFilename), VERR_OUT_OF_RANGE);
                         memcpy(pLogger->pInt->szFilename, pszValue, cch);
                         pLogger->pInt->szFilename[cch] = '\0';
+                        /** @todo reopen log file if pLogger->pInt->fCreated is true ... */
                     }
                     /* log directory */
                     else if (i == 1 /* dir */ && !fNo)
                     {
-                        char        szTmp[sizeof(pLogger->pInt->szFilename)];
                         const char *pszFile = RTPathFilename(pLogger->pInt->szFilename);
                         size_t      cchFile = pszFile ? strlen(pszFile) : 0;
                         AssertReturn(cchFile + cch + 1 < sizeof(pLogger->pInt->szFilename), VERR_OUT_OF_RANGE);
@@ -1945,13 +2299,13 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszValue)
                         pLogger->pInt->szFilename[cch++] = '/';
                         memcpy(&pLogger->pInt->szFilename[cch], szTmp, cchFile);
                         pLogger->pInt->szFilename[cch + cchFile] = '\0';
+                        /** @todo reopen log file if pLogger->pInt->fCreated is true ... */
                     }
                     else if (i == 2 /* history */)
                     {
                         if (!fNo)
                         {
-                            uint32_t    cHistory = 0;
-                            char        szTmp[32];
+                            uint32_t cHistory = 0;
                             int rc = RTStrCopyEx(szTmp, sizeof(szTmp), pszValue, cch);
                             if (RT_SUCCESS(rc))
                                 rc = RTStrToUInt32Full(szTmp, 0, &cHistory);
@@ -1965,7 +2319,6 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszValue)
                     {
                         if (!fNo)
                         {
-                            char szTmp[32];
                             int rc = RTStrCopyEx(szTmp, sizeof(szTmp), pszValue, cch);
                             if (RT_SUCCESS(rc))
                                 rc = RTStrToUInt64Full(szTmp, 0, &pLogger->pInt->cbHistoryFileMax);
@@ -1980,7 +2333,6 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszValue)
                     {
                         if (!fNo)
                         {
-                            char szTmp[32];
                             int rc = RTStrCopyEx(szTmp, sizeof(szTmp), pszValue, cch);
                             if (RT_SUCCESS(rc))
                                 rc = RTStrToUInt32Full(szTmp, 0, &pLogger->pInt->cSecsHistoryTimeSlot);
@@ -1991,13 +2343,40 @@ RTDECL(int) RTLogDestinations(PRTLOGGER pLogger, char const *pszValue)
                         else
                             pLogger->pInt->cSecsHistoryTimeSlot = UINT32_MAX;
                     }
+# endif /* IN_RING3 */
+                    else if (i == 5 /* ringbuf */ && !fNo)
+                    {
+                        int rc = RTStrCopyEx(szTmp, sizeof(szTmp), pszValue, cch);
+                        uint32_t cbRingBuf;
+                        if (RT_SUCCESS(rc))
+                            rc = RTStrToUInt32Full(szTmp, 0, &cbRingBuf);
+                        AssertMsgRCReturn(rc, ("Invalid ring buffer size value '%s' (%Rrc)!\n", szTmp, rc), rc);
+
+                        if (cbRingBuf == 0)
+                            cbRingBuf = RTLOG_RINGBUF_DEFAULT_SIZE;
+                        else if (cbRingBuf < RTLOG_RINGBUF_MIN_SIZE)
+                            cbRingBuf = RTLOG_RINGBUF_MIN_SIZE;
+                        else if (cbRingBuf > RTLOG_RINGBUF_MAX_SIZE)
+                            cbRingBuf = RTLOG_RINGBUF_MAX_SIZE;
+                        else
+                            cbRingBuf = RT_ALIGN_32(cbRingBuf, 64);
+                        rc = rtLogRingBufAdjust(pLogger, cbRingBuf, false /*fForce*/);
+                        if (RT_FAILURE(rc))
+                            return rc;
+                    }
                     else
                         AssertMsgFailedReturn(("Invalid destination value! %s%s doesn't take a value!\n",
                                                fNo ? "no" : "", s_aLogDst[i].pszInstr),
                                               VERR_INVALID_PARAMETER);
-# endif /* IN_RING3 */
+
                     pszValue = pszEnd + (*pszEnd != '\0');
                 }
+                else if (i == 5 /* ringbuf */ && !fNo && !pLogger->pInt->pszRingBuf)
+                {
+                    int rc = rtLogRingBufAdjust(pLogger, pLogger->pInt->cbRingBuf, false /*fForce*/);
+                    if (RT_FAILURE(rc))
+                        return rc;
+                }
                 break;
             }
         }
@@ -2050,7 +2429,7 @@ RTDECL(int) RTLogGetDestinations(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf)
      * Add the flags in the list.
      */
     fDestFlags = pLogger->fDestFlags;
-    for (i = 2; i < RT_ELEMENTS(s_aLogDst); i++)
+    for (i = 6; i < RT_ELEMENTS(s_aLogDst); i++)
         if (s_aLogDst[i].fFlag & fDestFlags)
         {
             if (fNotFirst)
@@ -2065,6 +2444,8 @@ RTDECL(int) RTLogGetDestinations(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf)
             fNotFirst = true;
         }
 
+    char szNum[32];
+
 # ifdef IN_RING3
     /*
      * Add the filename.
@@ -2078,11 +2459,7 @@ RTDECL(int) RTLogGetDestinations(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf)
         if (RT_FAILURE(rc))
             return rc;
         fNotFirst = true;
-    }
 
-    if (fDestFlags & RTLOGDEST_FILE)
-    {
-        char szNum[32];
         if (pLogger->pInt->cHistory)
         {
             RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? " history=%u" : "history=%u", pLogger->pInt->cHistory);
@@ -2110,6 +2487,23 @@ RTDECL(int) RTLogGetDestinations(PRTLOGGER pLogger, char *pszBuf, size_t cchBuf)
     }
 # endif /* IN_RING3 */
 
+    /*
+     * Add the ring buffer.
+     */
+    if (fDestFlags & RTLOGDEST_RINGBUF)
+    {
+        if (pLogger->pInt->cbRingBuf == RTLOG_RINGBUF_DEFAULT_SIZE)
+            rc = RTStrCopyP(&pszBuf, &cchBuf, fNotFirst ? " ringbuf" : "ringbuf");
+        else
+        {
+            RTStrPrintf(szNum, sizeof(szNum), fNotFirst ? " ringbuf=%#x" : "ringbuf=%#x", pLogger->pInt->cbRingBuf);
+            rc = RTStrCopyP(&pszBuf, &cchBuf, szNum);
+        }
+        if (RT_FAILURE(rc))
+            return rc;
+        fNotFirst = true;
+    }
+
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTLogGetDestinations);
@@ -2142,7 +2536,11 @@ RTDECL(void) RTLogFlush(PRTLOGGER pLogger)
     /*
      * Any thing to flush?
      */
-    if (pLogger->offScratch)
+    if (   pLogger->offScratch
+#ifndef IN_RC
+        || (pLogger->fDestFlags & RTLOGDEST_RINGBUF)
+#endif
+       )
     {
 #ifndef IN_RC
         /*
@@ -2159,6 +2557,14 @@ RTDECL(void) RTLogFlush(PRTLOGGER pLogger)
 
 #ifndef IN_RC
         /*
+         * Since this is an explicit flush call, the ring buffer content should
+         * be flushed to the other destinations if active.
+         */
+        if (   (pLogger->fDestFlags & RTLOGDEST_RINGBUF)
+            && pLogger->pInt->pszRingBuf /* paranoia */)
+            rtLogRingBufFlush(pLogger);
+
+        /*
          * Release the semaphore.
          */
         rtlogUnlock(pLogger);
@@ -2407,7 +2813,7 @@ RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
     {
 #ifdef IN_RING0
         if (pLogger->fDestFlags & ~RTLOGDEST_FILE)
-            rtR0LogLoggerExFallback(pLogger->fDestFlags, pLogger->fFlags, pszFormat, args);
+            rtR0LogLoggerExFallback(pLogger->fDestFlags, pLogger->fFlags, pLogger->pInt, pszFormat, args);
 #endif
         return;
     }
@@ -2455,11 +2861,13 @@ RT_EXPORT_SYMBOL(RTLogLoggerExV);
 typedef struct RTR0LOGLOGGERFALLBACK
 {
     /** The current scratch buffer offset. */
-    uint32_t offScratch;
+    uint32_t            offScratch;
     /** The destination flags. */
-    uint32_t fDestFlags;
+    uint32_t            fDestFlags;
+    /** For ring buffer output. */
+    PRTLOGGERINTERNAL   pInt;
     /** The scratch buffer. */
-    char achScratch[80];
+    char                achScratch[80];
 } RTR0LOGLOGGERFALLBACK;
 /** Pointer to RTR0LOGLOGGERFALLBACK which is used by
  * rtR0LogLoggerExFallbackOutput. */
@@ -2476,22 +2884,29 @@ static void rtR0LogLoggerExFallbackFlush(PRTR0LOGLOGGERFALLBACK pThis)
     if (!pThis->offScratch)
         return;
 
-    if (pThis->fDestFlags & RTLOGDEST_USER)
-        RTLogWriteUser(pThis->achScratch, pThis->offScratch);
+    if (   (pThis->fDestFlags & RTLOGDEST_RINGBUF)
+        && pThis->pInt
+        && pThis->pInt->pszRingBuf /* paranoia */)
+        rtLogRingBufWrite(pThis->pInt, pThis->achScratch, pThis->offScratch);
+    else
+    {
+        if (pThis->fDestFlags & RTLOGDEST_USER)
+            RTLogWriteUser(pThis->achScratch, pThis->offScratch);
 
-    if (pThis->fDestFlags & RTLOGDEST_DEBUGGER)
-        RTLogWriteDebugger(pThis->achScratch, pThis->offScratch);
+        if (pThis->fDestFlags & RTLOGDEST_DEBUGGER)
+            RTLogWriteDebugger(pThis->achScratch, pThis->offScratch);
 
-    if (pThis->fDestFlags & RTLOGDEST_STDOUT)
-        RTLogWriteStdOut(pThis->achScratch, pThis->offScratch);
+        if (pThis->fDestFlags & RTLOGDEST_STDOUT)
+            RTLogWriteStdOut(pThis->achScratch, pThis->offScratch);
 
-    if (pThis->fDestFlags & RTLOGDEST_STDERR)
-        RTLogWriteStdErr(pThis->achScratch, pThis->offScratch);
+        if (pThis->fDestFlags & RTLOGDEST_STDERR)
+            RTLogWriteStdErr(pThis->achScratch, pThis->offScratch);
 
 # ifndef LOG_NO_COM
-    if (pThis->fDestFlags & RTLOGDEST_COM)
-        RTLogWriteCom(pThis->achScratch, pThis->offScratch);
+        if (pThis->fDestFlags & RTLOGDEST_COM)
+            RTLogWriteCom(pThis->achScratch, pThis->offScratch);
 # endif
+    }
 
     /* empty the buffer. */
     pThis->offScratch = 0;
@@ -2559,13 +2974,16 @@ static DECLCALLBACK(size_t) rtR0LogLoggerExFallbackOutput(void *pv, const char *
  *
  * @param   fDestFlags  The destination flags.
  * @param   fFlags      The logger flags.
+ * @param   pInt        The internal logger data, for ring buffer output.
  * @param   pszFormat   The format string.
  * @param   va          The format arguments.
  */
-static void rtR0LogLoggerExFallback(uint32_t fDestFlags, uint32_t fFlags, const char *pszFormat, va_list va)
+static void rtR0LogLoggerExFallback(uint32_t fDestFlags, uint32_t fFlags, PRTLOGGERINTERNAL pInt,
+                                    const char *pszFormat, va_list va)
 {
     RTR0LOGLOGGERFALLBACK This;
     This.fDestFlags = fDestFlags;
+    This.pInt = pInt;
 
     /* fallback indicator. */
     This.offScratch = 2;
@@ -2644,27 +3062,15 @@ static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMs
     if (pLogger->fFlags & RTLOGFLAGS_WRITE_THROUGH)
         fOpen |= RTFILE_O_WRITE_THROUGH;
 
-    int rc;
     unsigned cBackoff = 0;
-    do
+    int rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen);
+    while (   rc == VERR_SHARING_VIOLATION
+           && cBackoff < RT_ELEMENTS(g_acMsLogBackoff))
     {
+        RTThreadSleep(g_acMsLogBackoff[cBackoff++]);
         rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen);
-        if (rc == VERR_SHARING_VIOLATION)
-        {
-            if (cBackoff >= RT_ELEMENTS(s_aLogBackoff))
-                break;
-            RTThreadSleep(s_aLogBackoff[cBackoff]);
-            cBackoff++;
-        }
-    }
-    while (rc == VERR_SHARING_VIOLATION);
-    if (RT_FAILURE(rc))
-    {
-        pLogger->pInt->hFile = NIL_RTFILE;
-        if (pszErrorMsg)
-            RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("could not open file '%s' (fOpen=%#x)"), pLogger->pInt->szFilename, fOpen);
     }
-    else
+    if (RT_SUCCESS(rc))
     {
         rc = RTFileGetSize(pLogger->pInt->hFile, &pLogger->pInt->cbHistoryFileWritten);
         if (RT_FAILURE(rc))
@@ -2674,6 +3080,12 @@ static int rtlogFileOpen(PRTLOGGER pLogger, char *pszErrorMsg, size_t cchErrorMs
             rc = VINF_SUCCESS;
         }
     }
+    else
+    {
+        pLogger->pInt->hFile = NIL_RTFILE;
+        if (pszErrorMsg)
+            RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("could not open file '%s' (fOpen=%#x)"), pLogger->pInt->szFilename, fOpen);
+    }
     return rc;
 }
 
@@ -2750,22 +3162,15 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
             char szNewName[sizeof(pLogger->pInt->szFilename) + 32];
             RTStrPrintf(szNewName, sizeof(szNewName), "%s.%u", pLogger->pInt->szFilename, i + 1);
 
-
-
-            int rc;
             unsigned cBackoff = 0;
-            do
+            int rc = RTFileRename(szOldName, szNewName, RTFILEMOVE_FLAGS_REPLACE);
+            while (   rc == VERR_SHARING_VIOLATION
+                   && cBackoff < RT_ELEMENTS(g_acMsLogBackoff))
             {
+                RTThreadSleep(g_acMsLogBackoff[cBackoff++]);
                 rc = RTFileRename(szOldName, szNewName, RTFILEMOVE_FLAGS_REPLACE);
-                if (rc == VERR_SHARING_VIOLATION)
-                {
-                    if (cBackoff >= RT_ELEMENTS(s_aLogBackoff))
-                        break;
-                    RTThreadSleep(s_aLogBackoff[cBackoff]);
-                    cBackoff++;
-                }
             }
-            while (rc == VERR_SHARING_VIOLATION);
+
             if (rc == VERR_FILE_NOT_FOUND)
                 RTFileDelete(szNewName);
         }
@@ -2805,11 +3210,12 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
 
     /* Restore saved values. */
     pLogger->pInt->cHistory = cSavedHistory;
-    pLogger->fFlags          = fSavedFlags;
+    pLogger->fFlags         = fSavedFlags;
 }
 
 #endif /* IN_RING3 */
 
+
 /**
  * Writes the buffer to the given log device without checking for buffered
  * data or anything.
@@ -2823,67 +3229,83 @@ static void rtlogFlush(PRTLOGGER pLogger)
     if (cchScratch == 0)
         return; /* nothing to flush. */
 
-    /* Make sure the string is terminated.  On Windows, RTLogWriteDebugger
-       will get upset if it isn't. */
-    if (RT_LIKELY(cchScratch < sizeof(pLogger->achScratch)))
-        pLogger->achScratch[cchScratch] = '\0';
+#ifndef IN_RC
+    /*
+     * If the ring buffer is active, the other destinations are only written
+     * to when the ring buffer is flushed by RTLogFlush().
+     */
+    if (   (pLogger->fDestFlags & RTLOGDEST_RINGBUF)
+        && pLogger->pInt
+        && pLogger->pInt->pszRingBuf /* paraoia */)
+    {
+        rtLogRingBufWrite(pLogger->pInt, pLogger->achScratch, pLogger->offScratch);
+        pLogger->offScratch = 0; /* empty the buffer. */
+    }
     else
-        AssertFailed();
+#endif
+    {
+        /* Make sure the string is terminated.  On Windows, RTLogWriteDebugger
+           will get upset if it isn't. */
+        if (RT_LIKELY(cchScratch < sizeof(pLogger->achScratch)))
+            pLogger->achScratch[cchScratch] = '\0';
+        else
+            AssertFailed();
 
 #ifndef IN_RC
-    if (pLogger->fDestFlags & RTLOGDEST_USER)
-        RTLogWriteUser(pLogger->achScratch, cchScratch);
+        if (pLogger->fDestFlags & RTLOGDEST_USER)
+            RTLogWriteUser(pLogger->achScratch, cchScratch);
 
-    if (pLogger->fDestFlags & RTLOGDEST_DEBUGGER)
-        RTLogWriteDebugger(pLogger->achScratch, cchScratch);
+        if (pLogger->fDestFlags & RTLOGDEST_DEBUGGER)
+            RTLogWriteDebugger(pLogger->achScratch, cchScratch);
 
 # ifdef IN_RING3
-    if (pLogger->fDestFlags & RTLOGDEST_FILE)
-    {
-        if (pLogger->pInt->hFile != NIL_RTFILE)
+        if ((pLogger->fDestFlags & (RTLOGDEST_FILE | RTLOGDEST_RINGBUF)) == RTLOGDEST_FILE)
         {
-            RTFileWrite(pLogger->pInt->hFile, pLogger->achScratch, cchScratch, NULL);
-            if (pLogger->fFlags & RTLOGFLAGS_FLUSH)
-                RTFileFlush(pLogger->pInt->hFile);
+            if (pLogger->pInt->hFile != NIL_RTFILE)
+            {
+                RTFileWrite(pLogger->pInt->hFile, pLogger->achScratch, cchScratch, NULL);
+                if (pLogger->fFlags & RTLOGFLAGS_FLUSH)
+                    RTFileFlush(pLogger->pInt->hFile);
+            }
+            if (pLogger->pInt->cHistory)
+                pLogger->pInt->cbHistoryFileWritten += cchScratch;
         }
-        if (pLogger->pInt->cHistory)
-            pLogger->pInt->cbHistoryFileWritten += cchScratch;
-    }
 # endif
 
-    if (pLogger->fDestFlags & RTLOGDEST_STDOUT)
-        RTLogWriteStdOut(pLogger->achScratch, cchScratch);
+        if (pLogger->fDestFlags & RTLOGDEST_STDOUT)
+            RTLogWriteStdOut(pLogger->achScratch, cchScratch);
 
-    if (pLogger->fDestFlags & RTLOGDEST_STDERR)
-        RTLogWriteStdErr(pLogger->achScratch, cchScratch);
+        if (pLogger->fDestFlags & RTLOGDEST_STDERR)
+            RTLogWriteStdErr(pLogger->achScratch, cchScratch);
 
 # if (defined(IN_RING0) || defined(IN_RC)) && !defined(LOG_NO_COM)
-    if (pLogger->fDestFlags & RTLOGDEST_COM)
-        RTLogWriteCom(pLogger->achScratch, cchScratch);
+        if (pLogger->fDestFlags & RTLOGDEST_COM)
+            RTLogWriteCom(pLogger->achScratch, cchScratch);
 # endif
 #endif /* !IN_RC */
 
 #ifdef IN_RC
-    if (pLogger->pfnFlush)
-        pLogger->pfnFlush(pLogger);
+        if (pLogger->pfnFlush)
+            pLogger->pfnFlush(pLogger);
 #else
-    if (pLogger->pInt->pfnFlush)
-        pLogger->pInt->pfnFlush(pLogger);
+        if (pLogger->pInt->pfnFlush)
+            pLogger->pInt->pfnFlush(pLogger);
 #endif
 
-    /* empty the buffer. */
-    pLogger->offScratch = 0;
+        /* empty the buffer. */
+        pLogger->offScratch = 0;
 
 #ifdef IN_RING3
-    /*
-     * Rotate the log file if configured.  Must be done after everything is
-     * flushed, since this will also use logging/flushing to write the header
-     * and footer messages.
-     */
-    if (   (pLogger->fDestFlags & RTLOGDEST_FILE)
-        && pLogger->pInt->cHistory)
-        rtlogRotate(pLogger, RTTimeProgramSecTS() / pLogger->pInt->cSecsHistoryTimeSlot, false /* fFirst */);
+        /*
+         * Rotate the log file if configured.  Must be done after everything is
+         * flushed, since this will also use logging/flushing to write the header
+         * and footer messages.
+         */
+        if (   (pLogger->fDestFlags & RTLOGDEST_FILE)
+            && pLogger->pInt->cHistory)
+            rtlogRotate(pLogger, RTTimeProgramSecTS() / pLogger->pInt->cSecsHistoryTimeSlot, false /* fFirst */);
 #endif
+    }
 }
 
 
diff --git a/src/VBox/Runtime/common/log/tracebuf.cpp b/src/VBox/Runtime/common/log/tracebuf.cpp
index e76e40b..a664e4e 100644
--- a/src/VBox/Runtime/common/log/tracebuf.cpp
+++ b/src/VBox/Runtime/common/log/tracebuf.cpp
@@ -1,3 +1,29 @@
+/* $Id: tracebuf.cpp $ */
+/** @file
+ * IPRT - Tracebuffer common functions.
+ */
+
+/*
+ * Copyright (C) 2011-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
 
 /*******************************************************************************
 *   Header Files                                                               *
diff --git a/src/VBox/Runtime/common/log/tracedefault.cpp b/src/VBox/Runtime/common/log/tracedefault.cpp
index 72acc1c..801137d 100644
--- a/src/VBox/Runtime/common/log/tracedefault.cpp
+++ b/src/VBox/Runtime/common/log/tracedefault.cpp
@@ -1,3 +1,29 @@
+/* $Id: tracedefault.cpp $ */
+/** @file
+ * IPRT - Tracebuffer common functions.
+ */
+
+/*
+ * Copyright (C) 2011-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
 
 /*******************************************************************************
 *   Header Files                                                               *
diff --git a/src/VBox/Runtime/common/math/ldexpl.asm b/src/VBox/Runtime/common/math/ldexpl.asm
index f64ca4b..4b26fc7 100644
--- a/src/VBox/Runtime/common/math/ldexpl.asm
+++ b/src/VBox/Runtime/common/math/ldexpl.asm
@@ -32,7 +32,7 @@ BEGINCODE
 ; Computes lrd * 2^exp
 ; @returns st(0)
 ; @param    lrd     [rbp + xCB*2]
-; @param    exp     [ebp + 14h]  GCC:edi  MSC:ecx
+; @param    exp     [ebp + 14h]  gcc:edi  msc:ecx
 BEGINPROC RT_NOCRT(ldexpl)
     push    xBP
     mov     xBP, xSP
diff --git a/src/VBox/Runtime/common/misc/lockvalidator.cpp b/src/VBox/Runtime/common/misc/lockvalidator.cpp
index eac25db..81c8c53 100644
--- a/src/VBox/Runtime/common/misc/lockvalidator.cpp
+++ b/src/VBox/Runtime/common/misc/lockvalidator.cpp
@@ -2999,6 +2999,9 @@ RTDECL(void) RTLockValidatorRecExclDelete(PRTLOCKVALRECEXCL pRec)
 
     rtLockValidatorSerializeDestructEnter();
 
+    /** @todo Check that it's not on our stack first.  Need to make it
+     *        configurable whether deleting a owned lock is acceptable? */
+
     ASMAtomicWriteU32(&pRec->Core.u32Magic, RTLOCKVALRECEXCL_MAGIC_DEAD);
     ASMAtomicWriteHandle(&pRec->hThread, NIL_RTTHREAD);
     RTLOCKVALCLASS hClass;
@@ -3467,6 +3470,9 @@ RTDECL(void) RTLockValidatorRecSharedDelete(PRTLOCKVALRECSHRD pRec)
 {
     Assert(pRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC);
 
+    /** @todo Check that it's not on our stack first.  Need to make it
+     *        configurable whether deleting a owned lock is acceptable? */
+
     /*
      * Flip it into table realloc mode and take the destruction lock.
      */
diff --git a/src/VBox/Runtime/common/misc/thread.cpp b/src/VBox/Runtime/common/misc/thread.cpp
index 1be4a45..3299c9b 100644
--- a/src/VBox/Runtime/common/misc/thread.cpp
+++ b/src/VBox/Runtime/common/misc/thread.cpp
@@ -73,7 +73,9 @@
 *   Global Variables                                                           *
 *******************************************************************************/
 /** The AVL thread containing the threads. */
-static PAVLPVNODECORE   g_ThreadTree;
+static PAVLPVNODECORE       g_ThreadTree;
+/** The number of threads in the tree (for ring-0 termination kludge). */
+static uint32_t volatile    g_cThreadInTree;
 #ifdef IN_RING3
 /** The RW lock protecting the tree. */
 static RTSEMRW          g_ThreadRWSem = NIL_RTSEMRW;
@@ -454,6 +456,8 @@ DECLHIDDEN(void) rtThreadInsert(PRTTHREADINT pThread, RTNATIVETHREAD NativeThrea
                 ASMAtomicWritePtr(&pThread->Core.Key, (void *)NativeThread);
                 fRc = RTAvlPVInsert(&g_ThreadTree, &pThread->Core);
                 ASMAtomicOrU32(&pThread->fIntFlags, RTTHREADINT_FLAG_IN_TREE);
+                if (fRc)
+                    ASMAtomicIncU32(&g_cThreadInTree);
 
                 AssertReleaseMsg(fRc, ("Lock problem? %p (%RTnthrd) %s\n", pThread, NativeThread, pThread->szName));
                 NOREF(fRc);
@@ -478,7 +482,8 @@ static void rtThreadRemoveLocked(PRTTHREADINT pThread)
     AssertMsg(pThread2 == pThread, ("%p(%s) != %p (%p/%s)\n", pThread2, pThread2  ? pThread2->szName : "<null>",
                                     pThread, pThread->Core.Key, pThread->szName));
 #endif
-    NOREF(pThread2);
+    if (pThread2)
+        ASMAtomicDecU32(&g_cThreadInTree);
 }
 
 
@@ -1175,7 +1180,19 @@ static int rtThreadWait(RTTHREAD Thread, RTMSINTERVAL cMillies, int *prc, bool f
                      * init cRef in rtThreadAlloc()).
                      */
                     if (ASMAtomicBitTestAndClear(&pThread->fFlags, RTTHREADFLAGS_WAITABLE_BIT))
+                    {
                         rtThreadRelease(pThread);
+#ifdef IN_RING0
+                        /*
+                         * IPRT termination kludge. Call native code to make sure
+                         * the last thread is really out of IPRT to prevent it from
+                         * crashing after we destroyed the spinlock in rtThreadTerm.
+                         */
+                        if (   ASMAtomicReadU32(&g_cThreadInTree) == 1
+                            && ASMAtomicReadU32(&pThread->cRefs) > 1)
+                            rtThreadNativeWaitKludge(pThread);
+#endif
+                    }
                 }
             }
             else
@@ -1537,3 +1554,33 @@ DECLHIDDEN(void) rtThreadClearTlsEntry(RTTLS iTls)
 }
 
 #endif /* IPRT_WITH_GENERIC_TLS */
+
+
+#if defined(RT_OS_WINDOWS) && defined(IN_RING3)
+
+/**
+ * Thread enumeration callback for RTThreadNameThreads
+ */
+static DECLCALLBACK(int) rtThreadNameThreadCallback(PAVLPVNODECORE pNode, void *pvUser)
+{
+    PRTTHREADINT pThread = (PRTTHREADINT)pNode;
+    rtThreadNativeInformDebugger(pThread);
+    return 0;
+}
+
+/**
+ * A function that can be called from the windows debugger to get the names of
+ * all threads when attaching to a process.
+ *
+ * Usage: .call VBoxRT!RTThreadNameThreads()
+ *
+ * @returns 0
+ * @remarks Do not call from source code as it skips locks.
+ */
+extern "C" RTDECL(int) RTThreadNameThreads(void);
+RTDECL(int) RTThreadNameThreads(void)
+{
+    return RTAvlPVDoWithAll(&g_ThreadTree, true /* fFromLeft*/, rtThreadNameThreadCallback, NULL);
+}
+
+#endif
diff --git a/src/VBox/Runtime/common/misc/uri.cpp b/src/VBox/Runtime/common/misc/uri.cpp
index f2400dd..056f93c 100644
--- a/src/VBox/Runtime/common/misc/uri.cpp
+++ b/src/VBox/Runtime/common/misc/uri.cpp
@@ -132,7 +132,11 @@ static char *rtUriPercentDecodeN(const char *pszString, size_t cchMax)
             /* % encoding means the percent sign and exactly 2 hexadecimal
              * digits describing the ASCII number of the character. */
             ++iIn;
-            char szNum[] = { pszString[iIn++], pszString[iIn++], '\0' };
+            char szNum[3];
+            szNum[0] = pszString[iIn++];
+            szNum[1] = pszString[iIn++];
+            szNum[2] = '\0';
+
             uint8_t u8;
             rc = RTStrToUInt8Ex(szNum, NULL, 16, &u8);
             if (RT_FAILURE(rc))
@@ -649,7 +653,7 @@ RTR3DECL(char *) RTUriFileNPath(const char *pszUri, uint32_t uFormat, size_t cch
     if (rtUriCheckPathStart(pszUri, iPos3, cbLen - iPos3, &iPos4))
     {
         uint32_t uFIntern = uFormat;
-        /* Auto is based on the current host OS. */
+        /* Auto is based on the current OS. */
         if (uFormat == URI_FILE_FORMAT_AUTO)
 #ifdef RT_OS_WINDOWS
             uFIntern = URI_FILE_FORMAT_WIN;
diff --git a/src/VBox/Runtime/common/net/netaddrstr.cpp b/src/VBox/Runtime/common/net/netaddrstr.cpp
index ba4df40..4d754b0 100644
--- a/src/VBox/Runtime/common/net/netaddrstr.cpp
+++ b/src/VBox/Runtime/common/net/netaddrstr.cpp
@@ -1221,70 +1221,3 @@ static int rtNetIpv6CheckAddrStr(const char *psz, char *pszResultAddress, size_t
     return returnValue;
 
 }
-
-
-RTDECL(bool) RTNetIsIPv6AddrStr(const char *pszAddress)
-{
-    return rtNetIpv6CheckAddrStr(pszAddress, NULL, 0, true, true) >= 0;
-}
-RT_EXPORT_SYMBOL(RTNetIsIPv6AddrStr);
-
-
-RTDECL(bool) RTNetIsIPv4AddrStr(const char *pszAddress)
-{
-    static char const s_szIpV4Digits[] = "0123456789.";
-
-    size_t cchAddress = strlen(pszAddress);
-    if (cchAddress < 7 || cchAddress > 15)
-        return false;
-
-    const char *pStart, *pFrom, *pTo, *pNow;
-    pStart = pNow = pFrom = pTo = pszAddress;
-
-    unsigned cOctets = 0;
-    while (*pNow != '\0')
-    {
-        const char *pChar  = (const char *)memchr(s_szIpV4Digits, *pNow, sizeof(s_szIpV4Digits) - 1);
-        const char *pDigit = (const char *)memchr(s_szIpV4Digits, *pNow, sizeof(s_szIpV4Digits) - 2);
-        const char *pNext  = pNow + 1;
-
-        if (!pChar)
-            return false;
-
-        if (pDigit && *pNext != '\0')
-        {
-            pTo = pNow;
-            pNow++;
-            continue;
-        }
-
-        if (*pNow == '.' || *pNext == '\0')
-        {
-            if (*pNext == '\0')
-                pTo = pNow;
-
-            size_t cchSub = pTo - pFrom;
-            if (cchSub > 2)
-                return false;
-
-            char szDummy[4] = { 0, 0, 0, 0 };
-            memcpy(szDummy, pFrom, cchSub + 1);
-
-            int rc = RTStrToUInt8Ex(szDummy, NULL, 10, NULL);
-            if (rc != VINF_SUCCESS)
-                return false;
-
-            cOctets++;
-            if (cOctets > 4)
-                return false;
-            pFrom = pNext;
-        }
-        pNow++;
-    }
-
-    if (cOctets != 4)
-        return false;
-
-    return true;
-}
-RT_EXPORT_SYMBOL(RTNetIsIPv4AddrStr);
diff --git a/src/VBox/Runtime/common/net/netaddrstr2.cpp b/src/VBox/Runtime/common/net/netaddrstr2.cpp
index eb9c70a..30aa7cc 100644
--- a/src/VBox/Runtime/common/net/netaddrstr2.cpp
+++ b/src/VBox/Runtime/common/net/netaddrstr2.cpp
@@ -30,18 +30,23 @@
 #include "internal/iprt.h"
 #include <iprt/net.h>
 
+#include <iprt/asm.h>
 #include <iprt/mem.h>
 #include <iprt/string.h>
 #include <iprt/stream.h>
 #include "internal/string.h"
 
-RTDECL(int) RTNetStrToIPv4Addr(const char *pszAddr, PRTNETADDRIPV4 pAddr)
+
+DECLHIDDEN(int) rtNetStrToIPv4AddrEx(const char *pcszAddr, PRTNETADDRIPV4 pAddr,
+                                     char **ppszNext)
 {
     char *pszNext;
-    AssertPtrReturn(pszAddr, VERR_INVALID_PARAMETER);
+    int rc;
+
+    AssertPtrReturn(pcszAddr, VERR_INVALID_PARAMETER);
     AssertPtrReturn(pAddr, VERR_INVALID_PARAMETER);
 
-    int rc = RTStrToUInt8Ex(RTStrStripL(pszAddr), &pszNext, 10, &pAddr->au8[0]);
+    rc = RTStrToUInt8Ex(pcszAddr, &pszNext, 10, &pAddr->au8[0]);
     if (rc != VINF_SUCCESS && rc != VWRN_TRAILING_CHARS)
         return VERR_INVALID_PARAMETER;
     if (*pszNext++ != '.')
@@ -60,13 +65,344 @@ RTDECL(int) RTNetStrToIPv4Addr(const char *pszAddr, PRTNETADDRIPV4 pAddr)
         return VERR_INVALID_PARAMETER;
 
     rc = RTStrToUInt8Ex(pszNext, &pszNext, 10, &pAddr->au8[3]);
-    if (rc != VINF_SUCCESS && rc != VWRN_TRAILING_SPACES)
+    if (rc != VINF_SUCCESS && rc != VWRN_TRAILING_SPACES && rc != VWRN_TRAILING_CHARS)
+        return VERR_INVALID_PARAMETER;
+
+    if (ppszNext != NULL)
+        *ppszNext = pszNext;
+    return VINF_SUCCESS;
+}
+
+
+RTDECL(int) RTNetStrToIPv4AddrEx(const char *pcszAddr, PRTNETADDRIPV4 pAddr,
+                                 char **ppszNext)
+{
+    return rtNetStrToIPv4AddrEx(pcszAddr, pAddr, ppszNext);
+}
+RT_EXPORT_SYMBOL(RTNetStrToIPv4AddrEx);
+
+
+RTDECL(int) RTNetStrToIPv4Addr(const char *pcszAddr, PRTNETADDRIPV4 pAddr)
+{
+    char *pszNext;
+    int rc;
+
+    AssertPtrReturn(pcszAddr, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pAddr, VERR_INVALID_PARAMETER);
+
+    pcszAddr = RTStrStripL(pcszAddr);
+    rc = rtNetStrToIPv4AddrEx(pcszAddr, pAddr, &pszNext);
+    if (rc != VINF_SUCCESS)
         return VERR_INVALID_PARAMETER;
+
     pszNext = RTStrStripL(pszNext);
-    if (*pszNext)
+    if (*pszNext != '\0')
         return VERR_INVALID_PARAMETER;
 
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTNetStrToIPv4Addr);
 
+
+RTDECL(bool) RTNetIsIPv4AddrStr(const char *pcszAddr)
+{
+    RTNETADDRIPV4 addrIPv4;
+    char *pszNext;
+    int rc;
+
+    if (pcszAddr == NULL)
+        return false;
+
+    rc = rtNetStrToIPv4AddrEx(pcszAddr, &addrIPv4, &pszNext);
+    if (rc != VINF_SUCCESS)
+        return false;
+
+    if (*pszNext != '\0')
+        return false;
+
+    return true;
+}
+RT_EXPORT_SYMBOL(RTNetIsIPv4AddrStr);
+
+
+static int rtNetStrToHexGroup(const char *pcszValue, char **ppszNext,
+                              uint16_t *pu16)
+{
+    char *pszNext;
+    int rc;
+
+    rc = RTStrToUInt16Ex(pcszValue, &pszNext, 16, pu16);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    if (   rc != VINF_SUCCESS
+        && rc != VWRN_TRAILING_CHARS
+        && rc != VWRN_TRAILING_SPACES)
+    {
+        return -rc;             /* convert warning to error */
+    }
+
+    /* parser always accepts 0x prefix */
+    if (pcszValue[0] == '0' && (pcszValue[1] == 'x' || pcszValue[1] == 'X'))
+    {
+        if (pu16)
+            *pu16 = 0;
+        if (ppszNext)
+            *ppszNext = (/* UNCONST */ char *)pcszValue + 1; /* to 'x' */
+        return VWRN_TRAILING_CHARS;
+    }
+
+    /* parser accepts leading zeroes "000000f" */
+    if (pszNext - pcszValue > 4)
+        return VERR_PARSE_ERROR;
+
+    if (ppszNext)
+        *ppszNext = pszNext;
+    return rc;
+}
+
+
+/*
+ * This function deals only with the hex-group IPv6 address syntax
+ * proper (with possible embedded IPv4).
+ */
+DECLHIDDEN(int) rtNetStrToIPv6AddrBase(const char *pcszAddr, PRTNETADDRIPV6 pAddrResult,
+                                       char **ppszNext)
+{
+    RTNETADDRIPV6 ipv6;
+    RTNETADDRIPV4 ipv4;
+    const char *pcszPos;
+    char *pszNext;
+    int iGroup;
+    uint16_t u16;
+    int rc;
+
+    memset(&ipv6, 0, sizeof(ipv6));
+
+    pcszPos = pcszAddr;
+
+    if (pcszPos[0] == ':') /* compressed zero run at the beginning? */
+    {
+        if (pcszPos[1] != ':')
+            return VERR_PARSE_ERROR;
+
+        pcszPos += 2;           /* skip over "::" */
+        pszNext = (/* UNCONST */ char *)pcszPos;
+        iGroup = 1;
+    }
+    else
+    {
+        /*
+         * Scan forward until we either get complete address or find
+         * "::" compressed zero run.
+         */
+        for (iGroup = 0; iGroup < 8; ++iGroup)
+        {
+            /* check for embedded IPv4 at the end */
+            if (iGroup == 6)
+            {
+                rc = rtNetStrToIPv4AddrEx(pcszPos, &ipv4, &pszNext);
+                if (rc == VINF_SUCCESS)
+                {
+                    ipv6.au32[3] = ipv4.au32[0];
+                    iGroup = 8; /* filled 6 and 7 */
+                    break;      /* we are done */
+                }
+            }
+
+            rc = rtNetStrToHexGroup(pcszPos, &pszNext, &u16);
+            if (RT_FAILURE(rc))
+                return VERR_PARSE_ERROR;
+
+            ipv6.au16[iGroup] = RT_H2N_U16(u16);
+
+            if (iGroup == 7)
+                pcszPos = pszNext;
+            else
+            {
+                /* skip the colon that delimits this group */
+                if (*pszNext != ':')
+                    return VERR_PARSE_ERROR;
+                pcszPos = pszNext + 1;
+
+                /* compressed zero run? */
+                if (*pcszPos == ':')
+                {
+                    ++pcszPos;    /* skip over :: */
+                    pszNext += 2; /* skip over :: (in case we are done) */
+                    iGroup += 2;  /* current field and the zero in the next */
+                    break;
+                }
+            }
+        }
+    }
+
+    if (iGroup != 8)
+    {
+        /*
+         * iGroup is the first group that can be filled by the part of
+         * the address after "::".
+         */
+        RTNETADDRIPV6 ipv6Tail;
+        const int iMaybeStart = iGroup;
+        int j;
+
+        memset(&ipv6Tail, 0, sizeof(ipv6Tail));
+
+        /*
+         * We try to accept longest match; we'll shift if necessary.
+         * Unlike the first loop, a failure to parse a group doesn't
+         * mean invalid address.
+         */
+        for (; iGroup < 8; ++iGroup)
+        {
+            /* check for embedded IPv4 at the end */
+            if (iGroup <= 6)
+            {
+                rc = rtNetStrToIPv4AddrEx(pcszPos, &ipv4, &pszNext);
+                if (rc == VINF_SUCCESS)
+                {
+                    ipv6Tail.au16[iGroup]     = ipv4.au16[0];
+                    ipv6Tail.au16[iGroup + 1] = ipv4.au16[1];
+                    iGroup = iGroup + 2; /* these two are done */
+                    break;               /* the rest is trailer */
+                }
+            }
+
+            rc = rtNetStrToHexGroup(pcszPos, &pszNext, &u16);
+            if (RT_FAILURE(rc))
+                break;
+
+            ipv6Tail.au16[iGroup] = RT_H2N_U16(u16);
+
+            if (iGroup == 7)
+                pcszPos = pszNext;
+            else
+            {
+                if (*pszNext != ':')
+                {
+                    ++iGroup;   /* this one is done */
+                    break;      /* the rest is trailer */
+                }
+
+                pcszPos = pszNext + 1;
+            }
+        }
+
+        for (j = 7, --iGroup; iGroup >= iMaybeStart; --j, --iGroup)
+            ipv6.au16[j] = ipv6Tail.au16[iGroup];
+    }
+
+    if (pAddrResult != NULL)
+        memcpy(pAddrResult, &ipv6, sizeof(ipv6));
+    if (ppszNext != NULL)
+        *ppszNext = pszNext;
+    return VINF_SUCCESS;
+}
+
+
+DECLHIDDEN(int) rtNetStrToIPv6AddrEx(const char *pcszAddr, PRTNETADDRIPV6 pAddr,
+                                     char **ppszZone, char **ppszNext)
+{
+    char *pszNext, *pszZone;
+    int rc;
+
+    rc = rtNetStrToIPv6AddrBase(pcszAddr, pAddr, &pszNext);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    if (*pszNext != '%')      /* is there a zone id? */
+    {
+        pszZone = NULL;
+    }
+    else
+    {
+        pszZone = pszNext + 1; /* skip '%' zone id delimiter */
+        if (*pszZone == '\0')
+            return VERR_PARSE_ERROR; /* empty zone id */
+
+        /*
+         * XXX: this is speculative as zone id syntax is
+         * implementation dependent, so we kinda guess here (accepting
+         * unreserved characters from URI syntax).
+         */
+        for (pszNext = pszZone; *pszNext != '\0'; ++pszNext)
+        {
+            const char c = *pszNext;
+            if (   !('0' <= c && c <= '9')
+                   && !('a' <= c && c <= 'z')
+                   && !('A' <= c && c <= 'Z')
+                   && c != '_'
+                   && c != '.'
+                   && c != '-'
+                   && c != '~')
+            {
+                break;
+            }
+        }
+    }
+
+    if (ppszZone != NULL)
+        *ppszZone = pszZone;
+    if (ppszNext != NULL)
+        *ppszNext = pszNext;
+
+    if (*pszNext == '\0')       /* all input string consumed */
+        return VINF_SUCCESS;
+    else
+    {
+        while (*pszNext == ' ' || *pszNext == '\t')
+            ++pszNext;
+        if (*pszNext == '\0')
+            return VWRN_TRAILING_SPACES;
+        else
+            return VWRN_TRAILING_CHARS;
+    }
+}
+
+
+RTDECL(int) RTNetStrToIPv6AddrEx(const char *pcszAddr, PRTNETADDRIPV6 pAddr,
+                                 char **ppszNext)
+{
+    AssertPtrReturn(pcszAddr, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pAddr, VERR_INVALID_PARAMETER);
+
+    return rtNetStrToIPv6AddrBase(pcszAddr, pAddr, ppszNext);
+}
+RT_EXPORT_SYMBOL(RTNetStrToIPv6AddrEx);
+
+
+RTDECL(int) RTNetStrToIPv6Addr(const char *pcszAddr, PRTNETADDRIPV6 pAddr,
+                               char **ppszZone)
+{
+    int rc;
+
+    AssertPtrReturn(pcszAddr, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pAddr, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(ppszZone, VERR_INVALID_PARAMETER);
+
+    pcszAddr = RTStrStripL(pcszAddr);
+    rc = rtNetStrToIPv6AddrEx(pcszAddr, pAddr, ppszZone, NULL);
+    if (rc != VINF_SUCCESS && rc != VWRN_TRAILING_SPACES)
+        return VERR_INVALID_PARAMETER;
+
+    return VINF_SUCCESS;
+}
+RT_EXPORT_SYMBOL(RTNetStrToIPv6Addr);
+
+
+RTDECL(bool) RTNetIsIPv6AddrStr(const char *pcszAddr)
+{
+    RTNETADDRIPV6 addrIPv6;
+    int rc;
+
+    if (pcszAddr == NULL)
+        return false;
+
+    rc = rtNetStrToIPv6AddrEx(pcszAddr, &addrIPv6, NULL, NULL);
+    if (rc != VINF_SUCCESS)
+        return false;
+
+    return true;
+}
+RT_EXPORT_SYMBOL(RTNetIsIPv6AddrStr);
diff --git a/src/VBox/Runtime/common/path/RTPathExt.cpp b/src/VBox/Runtime/common/path/RTPathExt.cpp
index bb2ee52..d337be6 100644
--- a/src/VBox/Runtime/common/path/RTPathExt.cpp
+++ b/src/VBox/Runtime/common/path/RTPathExt.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -32,14 +32,7 @@
 #include <iprt/path.h>
 
 
-/**
- * Finds the extension part of in a path.
- *
- * @returns Pointer to extension within pszPath.
- * @returns NULL if no extension.
- * @param   pszPath     Path to find extension in.
- */
-RTDECL(char *) RTPathExt(const char *pszPath)
+RTDECL(char *) RTPathSuffix(const char *pszPath)
 {
     const char *psz = pszPath;
     const char *pszExt = NULL;
@@ -65,7 +58,7 @@ RTDECL(char *) RTPathExt(const char *pszPath)
 
             /* the end */
             case '\0':
-                if (pszExt)
+                if (pszExt && pszExt != pszPath && pszExt[1])
                     return (char *)(void *)pszExt;
                 return NULL;
         }
diff --git a/src/VBox/Runtime/common/path/RTPathHasExt.cpp b/src/VBox/Runtime/common/path/RTPathHasExt.cpp
index f0ed065..3624c97 100644
--- a/src/VBox/Runtime/common/path/RTPathHasExt.cpp
+++ b/src/VBox/Runtime/common/path/RTPathHasExt.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -33,15 +33,8 @@
 
 
 
-/**
- * Checks if a path has an extension.
- *
- * @returns true if extension present.
- * @returns false if no extension present.
- * @param   pszPath     Path to check.
- */
-RTDECL(bool) RTPathHasExt(const char *pszPath)
+RTDECL(bool) RTPathHasSuffix(const char *pszPath)
 {
-    return RTPathExt(pszPath) != NULL;
+    return RTPathSuffix(pszPath) != NULL;
 }
 
diff --git a/src/VBox/Runtime/common/path/RTPathStripExt.cpp b/src/VBox/Runtime/common/path/RTPathStripExt.cpp
index 8156f6a..5c0daeb 100644
--- a/src/VBox/Runtime/common/path/RTPathStripExt.cpp
+++ b/src/VBox/Runtime/common/path/RTPathStripExt.cpp
@@ -1,10 +1,10 @@
 /* $Id: RTPathStripExt.cpp $ */
 /** @file
- * IPRT - RTPathStripExt
+ * IPRT - RTPathStripSuffix
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -34,37 +34,10 @@
 
 
 
-/**
- * Strips the extension from a path.
- *
- * @param   pszPath     Path which extension should be stripped.
- */
-RTDECL(void) RTPathStripExt(char *pszPath)
+RTDECL(void) RTPathStripSuffix(char *pszPath)
 {
-    char *pszDot = NULL;
-    for (;; pszPath++)
-    {
-        switch (*pszPath)
-        {
-            /* handle separators. */
-#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
-            case ':':
-            case '\\':
-#endif
-            case '/':
-                pszDot = NULL;
-                break;
-            case '.':
-                pszDot = pszPath;
-                break;
-
-            /* the end */
-            case '\0':
-                if (pszDot)
-                    *pszDot = '\0';
-                return;
-        }
-    }
-    /* will never get here */
+    char *pszSuffix = RTPathSuffix(pszPath);
+    if (pszSuffix)
+        *pszSuffix = '\0';
 }
 
diff --git a/src/VBox/Runtime/common/string/ministring.cpp b/src/VBox/Runtime/common/string/ministring.cpp
index 56c60b1..f54c31f 100644
--- a/src/VBox/Runtime/common/string/ministring.cpp
+++ b/src/VBox/Runtime/common/string/ministring.cpp
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (C) 2007-2012 Oracle Corporation
+ * Copyright (C) 2007-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -394,14 +394,16 @@ RTCString::split(const RTCString &a_rstrSep, SplitMode mode /* = RemoveEmptyPart
 
 /* static */
 RTCString
-RTCString::join(const RTCList<RTCString, RTCString *> &a_rList,
-                const RTCString &a_rstrSep /* = "" */)
+RTCString::joinEx(const RTCList<RTCString, RTCString *> &a_rList,
+                  const RTCString &a_rstrPrefix /* = "" */,
+                  const RTCString &a_rstrSep /* = "" */)
 {
     RTCString strRet;
     if (a_rList.size() > 1)
     {
         /* calc the required size */
         size_t cbNeeded = a_rstrSep.length() * (a_rList.size() - 1) + 1;
+        cbNeeded += a_rstrPrefix.length() * (a_rList.size() - 1) + 1;
         for (size_t i = 0; i < a_rList.size(); ++i)
             cbNeeded += a_rList.at(i).length();
         strRet.reserve(cbNeeded);
@@ -409,6 +411,8 @@ RTCString::join(const RTCList<RTCString, RTCString *> &a_rList,
         /* do the appending. */
         for (size_t i = 0; i < a_rList.size() - 1; ++i)
         {
+            if (a_rstrPrefix.isNotEmpty())
+                strRet.append(a_rstrPrefix);
             strRet.append(a_rList.at(i));
             strRet.append(a_rstrSep);
         }
@@ -416,11 +420,24 @@ RTCString::join(const RTCList<RTCString, RTCString *> &a_rList,
     }
     /* special case: one list item. */
     else if (a_rList.size() > 0)
+    {
+        if (a_rstrPrefix.isNotEmpty())
+            strRet.append(a_rstrPrefix);
         strRet.append(a_rList.last());
+    }
 
     return strRet;
 }
 
+/* static */
+RTCString
+RTCString::join(const RTCList<RTCString, RTCString *> &a_rList,
+                const RTCString &a_rstrSep /* = "" */)
+{
+    return RTCString::joinEx(a_rList,
+                             "" /* a_rstrPrefix */, a_rstrSep);
+}
+
 const RTCString operator+(const RTCString &a_rStr1, const RTCString &a_rStr2)
 {
     RTCString strRet(a_rStr1);
diff --git a/src/VBox/Runtime/common/string/strformatrt.cpp b/src/VBox/Runtime/common/string/strformatrt.cpp
index d96ef98..05ce927 100644
--- a/src/VBox/Runtime/common/string/strformatrt.cpp
+++ b/src/VBox/Runtime/common/string/strformatrt.cpp
@@ -55,6 +55,42 @@
 #endif
 #include "internal/string.h"
 
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+static char g_szHexDigits[17] = "0123456789abcdef";
+
+
+/**
+ * Helper that formats a 16-bit hex word in a IPv6 address.
+ *
+ * @returns Length in chars.
+ * @param   pszDst      The output buffer.  Written from the start.
+ * @param   uWord       The word to format as hex.
+ */
+static size_t rtstrFormatIPv6HexWord(char *pszDst, uint16_t uWord)
+{
+    size_t   off;
+    uint16_t cDigits;
+
+    if (uWord & UINT16_C(0xff00))
+        cDigits = uWord & UINT16_C(0xf000) ? 4 : 3;
+    else
+        cDigits = uWord & UINT16_C(0x00f0) ? 2 : 1;
+
+    off = 0;
+    switch (cDigits)
+    {
+        case 4: pszDst[off++] = g_szHexDigits[(uWord >> 12) & 0xf];
+        case 3: pszDst[off++] = g_szHexDigits[(uWord >>  8) & 0xf];
+        case 2: pszDst[off++] = g_szHexDigits[(uWord >>  4) & 0xf];
+        case 1: pszDst[off++] = g_szHexDigits[(uWord >>  0) & 0xf];
+            break;
+    }
+    pszDst[off] = '\0';
+    return off;
+}
+
 
 /**
  * Helper function to format IPv6 address according to RFC 5952.
@@ -66,13 +102,13 @@
  */
 static size_t rtstrFormatIPv6(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PCRTNETADDRIPV6 pIpv6Addr)
 {
-    size_t cch = 0; /* result */
-
-    bool fEmbeddedIpv4;
+    size_t cch; /* result */
+    bool   fEmbeddedIpv4;
     size_t cwHexPart;
-    size_t cwZeroRun, cwLongestZeroRun;
-    size_t iZeroStart, iLongestZeroStart;
+    size_t cwLongestZeroRun;
+    size_t iLongestZeroStart;
     size_t idx;
+    char   szHexWord[8];
 
     Assert(pIpv6Addr != NULL);
 
@@ -85,78 +121,81 @@ static size_t rtstrFormatIPv6(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PCRTN
      */
     fEmbeddedIpv4 = false;
     cwHexPart = RT_ELEMENTS(pIpv6Addr->au16);
-    if (pIpv6Addr->au64[0] == 0
-        && (   (pIpv6Addr->au32[2] == 0
-                && (   pIpv6Addr->au32[3] != 0
-                    && pIpv6Addr->au32[3] != RT_H2BE_U32_C(1)))
+    if (   pIpv6Addr->au64[0] == 0
+        && (   (   pIpv6Addr->au32[2] == 0
+                && pIpv6Addr->au32[3] != 0
+                && pIpv6Addr->au32[3] != RT_H2BE_U32_C(1) )
             || pIpv6Addr->au32[2] == RT_H2BE_U32_C(0x0000ffff)
-            || pIpv6Addr->au32[2] == RT_H2BE_U32_C(0xffff0000)))
+            || pIpv6Addr->au32[2] == RT_H2BE_U32_C(0xffff0000) ) )
     {
         fEmbeddedIpv4 = true;
         cwHexPart -= 2;
     }
 
-    cwZeroRun = cwLongestZeroRun = 0;
-    iZeroStart = iLongestZeroStart = -1;
-    for (idx = 0; idx <= cwHexPart; ++idx)
-    {
-        if (idx < cwHexPart && pIpv6Addr->au16[idx] == 0)
-        {
-            if (cwZeroRun == 0)
-            {
-                cwZeroRun = 1;
-                iZeroStart = idx;
-            }
-            else
-                ++cwZeroRun;
-        }
-        else
+    /*
+     * Find the longest sequences of two or more zero words.
+     */
+    cwLongestZeroRun  = 0;
+    iLongestZeroStart = 0;
+    for (idx = 0; idx < cwHexPart; idx++)
+        if (pIpv6Addr->au16[idx] == 0)
         {
-            if (cwZeroRun != 0)
+            size_t iZeroStart = idx;
+            size_t cwZeroRun;
+            do
+                idx++;
+            while (idx < cwHexPart && pIpv6Addr->au16[idx] == 0);
+            cwZeroRun = idx - iZeroStart;
+            if (cwZeroRun > 1 && cwZeroRun > cwLongestZeroRun)
             {
-                if (cwZeroRun > 1 && cwZeroRun > cwLongestZeroRun)
-                {
-                    cwLongestZeroRun = cwZeroRun;
-                    iLongestZeroStart = iZeroStart;
-                }
-                cwZeroRun = 0;
-                iZeroStart = -1;
+                cwLongestZeroRun  = cwZeroRun;
+                iLongestZeroStart = iZeroStart;
+                if (cwZeroRun >= cwHexPart - idx)
+                    break;
             }
         }
-    }
 
+    /*
+     * Do the formatting.
+     */
+    cch = 0;
     if (cwLongestZeroRun == 0)
     {
         for (idx = 0; idx < cwHexPart; ++idx)
-            cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
-                               "%s%x",
-                               idx == 0 ? "" : ":",
-                               RT_BE2H_U16(pIpv6Addr->au16[idx]));
+        {
+            if (idx > 0)
+                cch += pfnOutput(pvArgOutput, ":", 1);
+            cch += pfnOutput(pvArgOutput, szHexWord, rtstrFormatIPv6HexWord(szHexWord, RT_BE2H_U16(pIpv6Addr->au16[idx])));
+        }
 
         if (fEmbeddedIpv4)
-            cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, ":");
+            cch += pfnOutput(pvArgOutput, ":", 1);
     }
     else
     {
         const size_t iLongestZeroEnd = iLongestZeroStart + cwLongestZeroRun;
 
         if (iLongestZeroStart == 0)
-            cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, ":");
+            cch += pfnOutput(pvArgOutput, ":", 1);
         else
             for (idx = 0; idx < iLongestZeroStart; ++idx)
-                cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
-                                   "%x:", RT_BE2H_U16(pIpv6Addr->au16[idx]));
+            {
+                cch += pfnOutput(pvArgOutput, szHexWord, rtstrFormatIPv6HexWord(szHexWord, RT_BE2H_U16(pIpv6Addr->au16[idx])));
+                cch += pfnOutput(pvArgOutput, ":", 1);
+            }
 
         if (iLongestZeroEnd == cwHexPart)
-            cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, ":");
+            cch += pfnOutput(pvArgOutput, ":", 1);
         else
         {
             for (idx = iLongestZeroEnd; idx < cwHexPart; ++idx)
-                cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
-                                   ":%x", RT_BE2H_U16(pIpv6Addr->au16[idx]));
+            {
+                cch += pfnOutput(pvArgOutput, ":", 1);
+                cch += pfnOutput(pvArgOutput, szHexWord, rtstrFormatIPv6HexWord(szHexWord, RT_BE2H_U16(pIpv6Addr->au16[idx])));
+            }
 
             if (fEmbeddedIpv4)
-                cch += RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, ":");
+                cch += pfnOutput(pvArgOutput, ":", 1);
         }
     }
 
@@ -1159,14 +1198,14 @@ DECLHIDDEN(size_t) rtstrFormatRt(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, co
                         REG_OUT_BIT(cr4, X86_CR4_MCE, "MCE");
                         REG_OUT_BIT(cr4, X86_CR4_PGE, "PGE");
                         REG_OUT_BIT(cr4, X86_CR4_PCE, "PCE");
-                        REG_OUT_BIT(cr4, X86_CR4_OSFSXR, "OSFSXR");
+                        REG_OUT_BIT(cr4, X86_CR4_OSFXSR, "OSFXSR");
                         REG_OUT_BIT(cr4, X86_CR4_OSXMMEEXCPT, "OSXMMEEXCPT");
                         REG_OUT_BIT(cr4, X86_CR4_VMXE, "VMXE");
                         REG_OUT_BIT(cr4, X86_CR4_SMXE, "SMXE");
                         REG_OUT_BIT(cr4, X86_CR4_PCIDE, "PCIDE");
                         REG_OUT_BIT(cr4, X86_CR4_OSXSAVE, "OSXSAVE");
                         REG_OUT_BIT(cr4, X86_CR4_SMEP, "SMEP");
-// XXX                  REG_OUT_BIT(cr4, X86_CR4_SMAP, "SMAP");
+                        REG_OUT_BIT(cr4, X86_CR4_SMAP, "SMAP");
                         REG_OUT_CLOSE(cr4);
                     }
                     else
diff --git a/src/VBox/Runtime/common/string/unidata-flags.cpp b/src/VBox/Runtime/common/string/unidata-flags.cpp
index 5f85b8f..6cab483 100644
--- a/src/VBox/Runtime/common/string/unidata-flags.cpp
+++ b/src/VBox/Runtime/common/string/unidata-flags.cpp
@@ -47005,4 +47005,3 @@ RT_DECL_DATA_CONST(const RTUNIFLAGSRANGE) g_aRTUniFlagsRanges[] =
     { ~(RTUNICP)0, ~(RTUNICP)0, NULL }
 };
 
-
diff --git a/src/VBox/Runtime/common/string/unidata-lower.cpp b/src/VBox/Runtime/common/string/unidata-lower.cpp
index 085295b..e912ef6 100644
--- a/src/VBox/Runtime/common/string/unidata-lower.cpp
+++ b/src/VBox/Runtime/common/string/unidata-lower.cpp
@@ -3899,4 +3899,3 @@ RT_DECL_DATA_CONST(const RTUNICASERANGE) g_aRTUniLowerRanges[] =
     { ~(RTUNICP)0, ~(RTUNICP)0, NULL }
 };
 
-
diff --git a/src/VBox/Runtime/common/string/unidata-upper.cpp b/src/VBox/Runtime/common/string/unidata-upper.cpp
index 916bd41..5222fe6 100644
--- a/src/VBox/Runtime/common/string/unidata-upper.cpp
+++ b/src/VBox/Runtime/common/string/unidata-upper.cpp
@@ -4066,4 +4066,3 @@ RT_DECL_DATA_CONST(const RTUNICASERANGE) g_aRTUniUpperRanges[] =
     { ~(RTUNICP)0, ~(RTUNICP)0, NULL }
 };
 
-
diff --git a/src/VBox/Runtime/common/time/timesup.cpp b/src/VBox/Runtime/common/time/timesup.cpp
index b95c4f3..c518b03 100644
--- a/src/VBox/Runtime/common/time/timesup.cpp
+++ b/src/VBox/Runtime/common/time/timesup.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -51,6 +51,7 @@
 static DECLCALLBACK(void)     rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS);
 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData);
 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData);
+static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalBadCpuIndex(PRTTIMENANOTSDATA pData, uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu);
 #endif
 
 
@@ -64,47 +65,56 @@ static uint64_t         g_TimeNanoTSPrev = 0;
 /** The RTTimeNanoTS data structure that's passed down to the worker functions.  */
 static RTTIMENANOTSDATA g_TimeNanoTSData =
 {
-    /* .pu64Prev      = */ &g_TimeNanoTSPrev,
-    /* .pfnBad        = */ rtTimeNanoTSInternalBitch,
-    /* .pfnRediscover = */ rtTimeNanoTSInternalRediscover,
-    /* .pvDummy       = */ NULL,
-    /* .c1nsSteps     = */ 0,
-    /* .cExpired      = */ 0,
-    /* .cBadPrev      = */ 0,
-    /* .cUpdateRaces  = */ 0
+    /* .pu64Prev       = */ &g_TimeNanoTSPrev,
+    /* .pfnBad         = */ rtTimeNanoTSInternalBitch,
+    /* .pfnRediscover  = */ rtTimeNanoTSInternalRediscover,
+    /* .pfnBadCpuIndex = */ rtTimeNanoTSInternalBadCpuIndex,
+    /* .c1nsSteps      = */ 0,
+    /* .cExpired       = */ 0,
+    /* .cBadPrev       = */ 0,
+    /* .cUpdateRaces   = */ 0
 };
 
-/** The index into g_apfnWorkers for the function to use.
- * This cannot be a pointer because that'll break down in GC due to code relocation. */
-static uint32_t             g_iWorker = 0;
+# ifdef IN_RC
 /** Array of rtTimeNanoTSInternal worker functions.
  * This array is indexed by g_iWorker. */
 static const PFNTIMENANOTSINTERNAL g_apfnWorkers[] =
 {
-# define RTTIMENANO_WORKER_DETECT        0
+#  define RTTIMENANO_WORKER_DETECT                                      0
     rtTimeNanoTSInternalRediscover,
-# define RTTIMENANO_WORKER_SYNC_CPUID    1
-    RTTimeNanoTSLegacySync,
-# define RTTIMENANO_WORKER_ASYNC_CPUID   2
+
+#  define RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_NO_DELTA                  1
+    RTTimeNanoTSLegacySyncInvarNoDelta,
+#  define RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_WITH_DELTA                2
+    RTTimeNanoTSLegacySyncInvarWithDelta,
+#  define RTTIMENANO_WORKER_LEGACY_ASYNC                                3
     RTTimeNanoTSLegacyAsync,
-# define RTTIMENANO_WORKER_SYNC_LFENCE   3
-    RTTimeNanoTSLFenceSync,
-# define RTTIMENANO_WORKER_ASYNC_LFENCE  4
+
+#  define RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_NO_DELTA                  4
+    RTTimeNanoTSLFenceSyncInvarNoDelta,
+#  define RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_WITH_DELTA                5
+    RTTimeNanoTSLFenceSyncInvarWithDelta,
+#  define RTTIMENANO_WORKER_LFENCE_ASYNC                                6
     RTTimeNanoTSLFenceAsync,
-# define RTTIMENANO_WORKER_FALLBACK      5
+
+#  define RTTIMENANO_WORKER_FALLBACK                                    7
     rtTimeNanoTSInternalFallback,
 };
+/** The index into g_apfnWorkers for the function to use.
+ * @remarks This cannot be a pointer because that'll break down in RC due to
+ *          code relocation. */
+static uint32_t                 g_iWorker   = RTTIMENANO_WORKER_DETECT;
+# else
+/** Pointer to the worker */
+static PFNTIMENANOTSINTERNAL    g_pfnWorker = rtTimeNanoTSInternalRediscover;
+# endif /* IN_RC */
 
 
 /**
- * Helper function that's used by the assembly routines when something goes bust.
- *
- * @param   pData           Pointer to the data structure.
- * @param   u64NanoTS       The calculated nano ts.
- * @param   u64DeltaPrev    The delta relative to the previously returned timestamp.
- * @param   u64PrevNanoTS   The previously returned timestamp (as it was read it).
+ * @interface_method_impl{RTTIMENANOTSDATA, pfnBad}
  */
-static DECLCALLBACK(void) rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS)
+static DECLCALLBACK(void) rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev,
+                                                    uint64_t u64PrevNanoTS)
 {
     pData->cBadPrev++;
     if ((int64_t)u64DeltaPrev < 0)
@@ -116,6 +126,22 @@ static DECLCALLBACK(void) rtTimeNanoTSInternalBitch(PRTTIMENANOTSDATA pData, uin
 }
 
 /**
+ * @interface_method_impl{RTTIMENANOTSDATA, pfnBadCpuIndex}
+ */
+static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalBadCpuIndex(PRTTIMENANOTSDATA pData, uint16_t idApic,
+                                                              uint16_t iCpuSet, uint16_t iGipCpu)
+{
+# ifndef IN_RC
+    AssertMsgFailed(("idApic=%#x iCpuSet=%#x iGipCpu=%#x\n", idApic, iCpuSet, iGipCpu));
+    return RTTimeSystemNanoTS();
+# else
+    RTAssertReleasePanic();
+    return 0;
+# endif
+}
+
+
+/**
  * Fallback function.
  */
 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pData)
@@ -123,13 +149,15 @@ static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pDa
     PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
     if (    pGip
         &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
-        &&  (   pGip->u32Mode == SUPGIPMODE_SYNC_TSC
+        &&  (   pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC
+             || pGip->u32Mode == SUPGIPMODE_SYNC_TSC
              || pGip->u32Mode == SUPGIPMODE_ASYNC_TSC))
         return rtTimeNanoTSInternalRediscover(pData);
     NOREF(pData);
 # ifndef IN_RC
     return RTTimeSystemNanoTS();
 # else
+    RTAssertReleasePanic();
     return 0;
 # endif
 }
@@ -141,27 +169,110 @@ static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalFallback(PRTTIMENANOTSDATA pDa
  */
 static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA pData)
 {
-    uint32_t iWorker;
-    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    PSUPGLOBALINFOPAGE      pGip = g_pSUPGlobalInfoPage;
+# ifdef IN_RC
+    uint32_t                iWorker;
+# else
+    PFNTIMENANOTSINTERNAL   pfnWorker;
+# endif
     if (    pGip
         &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
-        &&  (   pGip->u32Mode == SUPGIPMODE_SYNC_TSC
+        &&  (   pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC
+             || pGip->u32Mode == SUPGIPMODE_SYNC_TSC
              || pGip->u32Mode == SUPGIPMODE_ASYNC_TSC))
     {
         if (ASMCpuId_EDX(1) & X86_CPUID_FEATURE_EDX_SSE2)
-            iWorker = pGip->u32Mode == SUPGIPMODE_SYNC_TSC
-                    ? RTTIMENANO_WORKER_SYNC_LFENCE
-                    : RTTIMENANO_WORKER_ASYNC_LFENCE;
+        {
+# ifdef IN_RC
+            iWorker   = pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
+                      ? RTTIMENANO_WORKER_LFENCE_ASYNC
+                      : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
+                      ? RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_NO_DELTA
+                      : RTTIMENANO_WORKER_LFENCE_SYNC_INVAR_WITH_DELTA;
+# elif defined(IN_RING0)
+            pfnWorker = pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
+                      ? RTTimeNanoTSLFenceAsync
+                      : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
+                      ? RTTimeNanoTSLFenceSyncInvarNoDelta
+                      : RTTimeNanoTSLFenceSyncInvarWithDelta;
+# else
+            if (pGip->u32Mode == SUPGIPMODE_ASYNC_TSC)
+                pfnWorker = pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+                          ? RTTimeNanoTSLFenceAsyncUseIdtrLim
+                          : pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+                          ? RTTimeNanoTSLFenceAsyncUseRdtscp
+                          : pGip->fGetGipCpu & SUPGIPGETCPU_APIC_ID
+                          ? RTTimeNanoTSLFenceAsyncUseApicId
+                          : rtTimeNanoTSInternalFallback;
+           else
+               pfnWorker = pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+                         ? pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO
+                           ? RTTimeNanoTSLFenceSyncInvarNoDelta
+                           : RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim
+                         : pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+                         ?   pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO
+                           ? RTTimeNanoTSLFenceSyncInvarNoDelta
+                           : RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp
+                         : pGip->fGetGipCpu & SUPGIPGETCPU_APIC_ID
+                         ? pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
+                           ? RTTimeNanoTSLFenceSyncInvarNoDelta
+                           : RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId
+                         : rtTimeNanoTSInternalFallback;
+# endif
+        }
         else
-            iWorker = pGip->u32Mode == SUPGIPMODE_SYNC_TSC
-                    ? RTTIMENANO_WORKER_SYNC_CPUID
-                    : RTTIMENANO_WORKER_ASYNC_CPUID;
+        {
+# ifdef IN_RC
+            iWorker = pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
+                    ? RTTIMENANO_WORKER_LEGACY_ASYNC
+                    : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
+                    ? RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_NO_DELTA :  RTTIMENANO_WORKER_LEGACY_SYNC_INVAR_WITH_DELTA;
+# elif defined(IN_RING0)
+            pfnWorker = pGip->u32Mode == SUPGIPMODE_ASYNC_TSC
+                      ? RTTimeNanoTSLegacyAsync
+                      : pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
+                      ? RTTimeNanoTSLegacySyncInvarNoDelta
+                      : RTTimeNanoTSLegacySyncInvarWithDelta;
+# else
+            if (pGip->u32Mode == SUPGIPMODE_ASYNC_TSC)
+                pfnWorker = pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+                          ? RTTimeNanoTSLegacyAsyncUseRdtscp
+                          : pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+                          ? RTTimeNanoTSLegacyAsyncUseIdtrLim
+                          : pGip->fGetGipCpu & SUPGIPGETCPU_APIC_ID
+                          ? RTTimeNanoTSLegacyAsyncUseApicId
+                          : rtTimeNanoTSInternalFallback;
+           else
+               pfnWorker = pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+                         ?   pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO
+                           ? RTTimeNanoTSLegacySyncInvarNoDelta
+                           : RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp
+                         : pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+                         ? pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO
+                           ? RTTimeNanoTSLegacySyncInvarNoDelta
+                           : RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim
+                         : pGip->fGetGipCpu & SUPGIPGETCPU_APIC_ID
+                         ? pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
+                           ? RTTimeNanoTSLegacySyncInvarNoDelta
+                           : RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId
+                         : rtTimeNanoTSInternalFallback;
+# endif
+        }
     }
     else
+# ifdef IN_RC
         iWorker = RTTIMENANO_WORKER_FALLBACK;
+# else
+        pfnWorker = rtTimeNanoTSInternalFallback;
+# endif
 
-    ASMAtomicXchgU32((uint32_t volatile *)&g_iWorker, iWorker);
+# ifdef IN_RC
+    ASMAtomicWriteU32((uint32_t volatile *)&g_iWorker, iWorker);
     return g_apfnWorkers[iWorker](pData);
+# else
+    ASMAtomicWritePtr((void * volatile *)&g_pfnWorker, (void *)(uintptr_t)pfnWorker);
+    return pfnWorker(pData);
+# endif
 }
 
 #endif /* !IN_GUEST && !RT_NO_GIP */
@@ -173,7 +284,11 @@ static DECLCALLBACK(uint64_t) rtTimeNanoTSInternalRediscover(PRTTIMENANOTSDATA p
 DECLINLINE(uint64_t) rtTimeNanoTSInternal(void)
 {
 #if !defined(IN_GUEST) && !defined(RT_NO_GIP)
+# ifdef IN_RC
     return g_apfnWorkers[g_iWorker](&g_TimeNanoTSData);
+# else
+    return g_pfnWorker(&g_TimeNanoTSData);
+# endif
 #else
     return RTTimeSystemNanoTS();
 #endif
diff --git a/src/VBox/Runtime/common/time/timesupA.asm b/src/VBox/Runtime/common/time/timesupA.asm
index 2cee44c..c32c18f 100644
--- a/src/VBox/Runtime/common/time/timesupA.asm
+++ b/src/VBox/Runtime/common/time/timesupA.asm
@@ -29,6 +29,14 @@
 %include "iprt/asmdefs.mac"
 %include "VBox/sup.mac"
 
+;
+; Use the C reference implementation for now.
+;
+%error "This is out of date, use C code.  Not worth it for a couple of ticks in some functions and equal or worse performance in others."
+This is out of date
+This is out of date
+This is out of date
+
 
 ;; Keep this in sync with iprt/time.h.
 struc RTTIMENANOTSDATA
@@ -73,7 +81,6 @@ BEGINDATA
  %endif
 %endif
 
-
 BEGINCODE
 
 ;
@@ -82,29 +89,58 @@ BEGINCODE
 ;
 %undef  ASYNC_GIP
 %undef  USE_LFENCE
+%undef  WITH_TSC_DELTA
+%undef  NEED_APIC_ID
 %define NEED_TRANSACTION_ID
-%define NEED_TO_SAVE_REGS
-%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLegacySync
+%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLegacySyncNoDelta
+%include "timesupA.mac"
+
+%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLegacyInvariantNoDelta
+%include "timesupA.mac"
+
+%define WITH_TSC_DELTA
+%define NEED_APIC_ID
+%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLegacySyncWithDelta
+%include "timesupA.mac"
+
+%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLegacyInvariantWithDelta
 %include "timesupA.mac"
 
 %define ASYNC_GIP
+%undef  WITH_TSC_DELTA
+%define NEED_APIC_ID
 %ifdef IN_RC
  %undef NEED_TRANSACTION_ID
 %endif
 %define rtTimeNanoTSInternalAsm    RTTimeNanoTSLegacyAsync
 %include "timesupA.mac"
 
+
 ;
 ; Alternative implementation that employs lfence instead of cpuid.
 ;
 %undef  ASYNC_GIP
 %define USE_LFENCE
+%undef  WITH_TSC_DELTA
+%undef  NEED_APIC_ID
 %define NEED_TRANSACTION_ID
-%undef  NEED_TO_SAVE_REGS
-%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLFenceSync
+%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLFenceSyncNoDelta
+%include "timesupA.mac"
+
+%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLFenceInvariantNoDelta
+%include "timesupA.mac"
+
+%define WITH_TSC_DELTA
+%define NEED_APIC_ID
+%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLFenceSyncWithDelta
+%include "timesupA.mac"
+
+%define rtTimeNanoTSInternalAsm    RTTimeNanoTSLFenceInvariantWithDelta
 %include "timesupA.mac"
 
 %define ASYNC_GIP
+%undef  WITH_TSC_DELTA
+%define NEED_APIC_ID
 %ifdef IN_RC
  %undef NEED_TRANSACTION_ID
 %endif
diff --git a/src/VBox/Runtime/common/time/timesupA.mac b/src/VBox/Runtime/common/time/timesupA.mac
index 54c9200..cd88193 100644
--- a/src/VBox/Runtime/common/time/timesupA.mac
+++ b/src/VBox/Runtime/common/time/timesupA.mac
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2011 Oracle Corporation
+; Copyright (C) 2006-2014 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -71,7 +71,7 @@ BEGINPROC rtTimeNanoTSInternalAsm
 
 
     ;
-    ; Load pGip and calc pGipCPU, setting u32ApicIdPlus if necessary.
+    ; Load pGip.
     ;
 %ifdef IMPORTED_SUPLIB
  %ifdef IN_RING0
@@ -87,28 +87,34 @@ BEGINPROC rtTimeNanoTSInternalAsm
     jz      .Rediscover
     cmp     dword [esi + SUPGLOBALINFOPAGE.u32Magic], SUPGLOBALINFOPAGE_MAGIC
     jne     .Rediscover
-%ifdef ASYNC_GIP
+
+    ;
+    ; Calc pGipCPU, setting u32ApicIdPlus if necessary.
+    ;
+%ifdef NEED_APIC_ID
     ; u8ApicId = ASMGetApicId();
     mov     eax, 1
     cpuid                               ; expensive
  %ifdef NEED_TRANSACTION_ID
     mov     u32ApicIdPlus, ebx
  %endif
-    ; pGipCpu = &pGip->aCPU[pGip->aiCpuFromApicId[u8ApicId]];
+    ; pGipCpu/pGipCpuDelta = &pGip->aCPU[pGip->aiCpuFromApicId[u8ApicId]];
     shr     ebx, 24
     movzx   ebx, word [esi + ebx * 2 + SUPGLOBALINFOPAGE.aiCpuFromApicId]
     mov     eax, SUPGIPCPU_size
     mul     ebx
     lea     edi, [esi + eax + SUPGLOBALINFOPAGE.aCPUs]  ; edi == &pGip->aCPU[u8ApicId];
-%else
-    lea     edi, [esi + SUPGLOBALINFOPAGE.aCPUs]        ; edi == &pGip->aCPU[0];
 %endif
 
 %ifdef NEED_TRANSACTION_ID
     ;
     ; Serialized loading of u32TransactionId.
     ;
+ %ifdef ASYNC_GIP
     mov     ebx, [edi + SUPGIPCPU.u32TransactionId]
+ %else
+    mov     ebx, [esi + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u32TransactionId]
+ %endif
     mov     u32TransactionId, ebx
  %ifdef USE_LFENCE
     lfence
@@ -118,30 +124,63 @@ BEGINPROC rtTimeNanoTSInternalAsm
 %endif
 
     ;
-    ; Load the data and TSC.
+    ; Load the data and TSC with delta applied.
     ;
     mov     eax, [esi + SUPGLOBALINFOPAGE.u32UpdateIntervalNS]
-    mov     u32UpdateIntervalNS, eax    ; esi is now free
+    mov     u32UpdateIntervalNS, eax
+%ifdef ASYNC_GIP                        ; esi is now free.
     mov     edx, [edi + SUPGIPCPU.u32UpdateIntervalTSC]
+%else
+    mov     edx, [esi + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u32UpdateIntervalTSC]
+%endif
     mov     u32UpdateIntervalTSC, edx
+
     rdtsc
+%ifdef WITH_TSC_DELTA
+    cmp     dword [edi + SUPGIPCPU.i64TSCDelta], 0xffffffff
+    je      .TscDeltaPossiblyInvalid
+.TscDeltaValid:
+    sub     eax, dword [edi + SUPGIPCPU.i64TSCDelta]
+    sbb     edx, dword [edi + SUPGIPCPU.i64TSCDelta + 4]
+.TscDeltaNotValid:                      ; edi is now free.
+%endif
+
+%ifdef ASYNC_GIP
     mov     ecx, [edi + SUPGIPCPU.u64NanoTS]
-    mov     u64CurNanoTS, ecx
     mov     esi, [edi + SUPGIPCPU.u64NanoTS + 4]
-    mov     u64CurNanoTS_Hi, esi
-    mov     ebx, [edi + SUPGIPCPU.u64TSC]
-    mov     u64TSC, ebx
-    mov     ecx, [edi + SUPGIPCPU.u64TSC + 4]
-    mov     u64TSC_Hi, ecx
+%else
+    mov     ecx, [esi + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u64NanoTS]
+    mov     ebx, [esi + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u64NanoTS + 4]
+%endif
+    mov     u64CurNanoTS, ecx
+    mov     u64CurNanoTS_Hi, ebx
+%ifdef ASYNC_GIP
+    mov     ecx, [edi + SUPGIPCPU.u64TSC]
+    mov     ebx, [edi + SUPGIPCPU.u64TSC + 4]
+%else
+    mov     ecx, [esi + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u64TSC]
+    mov     ebx, [esi + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u64TSC + 4]
+%endif
+    mov     u64TSC, ecx
+    mov     u64TSC_Hi, ebx
 
     ; u64PrevNanoTS = ASMAtomicReadU64(pu64Prev);
     ;   This serializes load/save. And with the dependency on the
     ;   RDTSC result, we try to make sure it has completed as well.
+%ifdef ASYNC_GIP
     mov     esi, pData
     mov     esi, [esi + RTTIMENANOTSDATA.pu64Prev]
+%else
+    mov     edi, pData
+    mov     edi, [esi + RTTIMENANOTSDATA.pu64Prev]
+%endif
     mov     ebx, eax
     mov     ecx, edx
+%ifdef ASYNC_GIP
     lock cmpxchg8b [esi]
+%else
+    lock cmpxchg8b [edi]
+%endif
     mov     u64PrevNanoTS, eax
     mov     u64PrevNanoTS_Hi, edx
 
@@ -151,7 +190,7 @@ BEGINPROC rtTimeNanoTSInternalAsm
     ; Check that the GIP and CPU didn't change.
     ; We've already serialized all the loads and stores at this point.
     ;
- %ifdef ASYNC_GIP
+ %ifdef NEED_APIC_ID
     mov     u64RetNanoTS, ebx
     mov     u64RetNanoTS_Hi, ecx
   %define SAVED_u64RetNanoTS
@@ -160,7 +199,11 @@ BEGINPROC rtTimeNanoTSInternalAsm
     cmp     u32ApicIdPlus, ebx
     jne     .ReadGip
  %endif
+ %ifdef ASYNC_GIP
     mov     esi, [edi + SUPGIPCPU.u32TransactionId]
+ %else
+    mov     esi, [esi + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u32TransactionId]
+ %endif
     cmp     esi, u32TransactionId
     jne     .ReadGip
     test    esi, 1
@@ -381,6 +424,17 @@ BEGINPROC rtTimeNanoTSInternalAsm
     add     esp, 4h
     jmp     .Done
 
+
+%ifdef WITH_TSC_DELTA
+    ;;
+    ;; Unlikely branch for when we think the TSC delta might be invalid.
+    ;;
+.TscDeltaPossiblyInvalid:
+    cmp     dword [edi + SUPGIPCPU.i64TSCDelta + 4], 0x7fffffff
+    jne     .TscDeltaValid
+    jmp     .TscDeltaNotValid
+%endif
+
     ;
     ; Cleanup variables
     ;
@@ -418,7 +472,7 @@ BEGINPROC rtTimeNanoTSInternalAsm
 %define TmpVar                  [rbp - 30h]
 %define TmpVar2                 [rbp - 38h]
 %ifdef NEED_TRANSACTION_ID
- %ifdef ASYNC_GIP
+ %ifdef NEED_APIC_ID
   %define SavedR14              [rbp - 40h]
   %define SavedR15              [rbp - 48h]
  %endif
@@ -426,9 +480,19 @@ BEGINPROC rtTimeNanoTSInternalAsm
 
 %define pData                   rdi
 
-%define u64TSC                  rsi
-%define pGip                    rsi
-%define pGipCPU                 r8
+%ifdef ASYNC_GIP
+ %define u64TSC                 rsi
+ %define pGip                   rsi
+ %ifdef NEED_APIC_ID
+  %define pGipCPU               r8
+ %endif
+%else
+ %define u64TSC                 r8
+ %define pGip                   rsi
+ %ifdef NEED_APIC_ID
+  %define pGipCPU               r8
+ %endif
+%endif
 %define u32TransactionId        r9d
 %define u64CurNanoTS            r10
 %define u64PrevNanoTS           r11     ; not parameter register
@@ -439,7 +503,7 @@ BEGINPROC rtTimeNanoTSInternalAsm
 %undef u64SavedRetNanoTS
 %undef u32ApicIdPlus
 %ifdef NEED_TRANSACTION_ID
- %ifdef ASYNC_GIP
+ %ifdef NEED_APIC_ID
   %define u64SavedRetNanoTS     r14
   %define u32ApicIdPlus         r15d
  %endif
@@ -480,8 +544,7 @@ BEGINPROC rtTimeNanoTSInternalAsm
 .ReadGip:
 
     ;
-    ; Load pGip and calc pGipCPU, setting u32ApicIdPlus if necessary.
-    ; Finding the GIP is fun...
+    ; Load pGip - finding the GIP is fun...
     ;
 %ifdef RT_OS_WINDOWS
  %ifdef IMPORTED_SUPLIB
@@ -509,27 +572,32 @@ BEGINPROC rtTimeNanoTSInternalAsm
     cmp     dword [pGip + SUPGLOBALINFOPAGE.u32Magic], SUPGLOBALINFOPAGE_MAGIC
     jne     .Rediscover
 
-%ifdef ASYNC_GIP
+    ;
+    ; pGipCPU, setting u32ApicIdPlus if necessary.
+    ;
+%ifdef NEED_APIC_ID
     ; u8ApicId = ASMGetApicId();
     mov     eax, 1
     cpuid                               ; expensive
  %ifdef NEED_TRANSACTION_ID
     mov     u32ApicIdPlus, ebx
  %endif
-    ; pGipCpu = &pGip->aCPU[pGip->aiCpuFromApicId[u8ApicId]];
+    ; pGipCPU = &pGip->aCPU[pGip->aiCpuFromApicId[u8ApicId]];
     shr     ebx, 24
     movzx   eax, word [pGip + rbx * 2 + SUPGLOBALINFOPAGE.aiCpuFromApicId]
     imul    eax, SUPGIPCPU_size
     lea     pGipCPU, [pGip + rax + SUPGLOBALINFOPAGE.aCPUs]
-%else
-    lea     pGipCPU, [pGip + SUPGLOBALINFOPAGE.aCPUs]
 %endif
 
 %ifdef NEED_TRANSACTION_ID
     ;
     ; Serialized loading of u32TransactionId.
     ;
+ %ifdef ASYNC_GIP
     mov     u32TransactionId, [pGipCPU + SUPGIPCPU.u32TransactionId]
+ %else
+    mov     u32TransactionId, [pGip + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u32TransactionId]
+ %endif
  %ifdef USE_LFENCE
     lfence
  %else
@@ -540,20 +608,38 @@ BEGINPROC rtTimeNanoTSInternalAsm
     ;
     ; Load the data and TSC.
     ;
-    mov     u32UpdateIntervalNS,  [pGip + SUPGLOBALINFOPAGE.u32UpdateIntervalNS] ; before u64TSC
+    mov     u32UpdateIntervalNS,  [pGip + SUPGLOBALINFOPAGE.u32UpdateIntervalNS]
+%ifdef ASYNC_GIP
     mov     u32UpdateIntervalTSC, [pGipCPU + SUPGIPCPU.u32UpdateIntervalTSC]
+%else
+    mov     u32UpdateIntervalTSC, [pGip + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u32UpdateIntervalTSC]
+%endif
+
     rdtsc
     mov     u64PrevNanoTS,        [pData + RTTIMENANOTSDATA.pu64Prev]
     mov     u64PrevNanoTS,        [u64PrevNanoTS]
     shl     rdx, 32
- %ifdef u64SavedRetNanoTS               ; doing this here saves a tick or so.
-    mov     u64SavedRetNanoTS, rax
-    or      u64SavedRetNanoTS, rdx
- %else
     or      rax, rdx                    ; rax is u64RetNanoTS.
- %endif
+%ifdef WITH_TSC_DELTA
+    mov     rdx, [pGipCPU + SUPGIPCPU.i64TSCDelta]
+    mov     u64CurNanoTS, 0x7fffffffffffffff ; INT64_MAX - temporarily borrowing u64CurNanoTS
+    cmp     rdx, u64CurNanoTS
+    je      .TscDeltaNotValid
+    sub     rax, rdx
+.TscDeltaNotValid:
+%endif
+%ifdef u64SavedRetNanoTS                ; doing this here may save a tick or so?
+    mov     u64SavedRetNanoTS, rax
+%endif
+
+%ifdef ASYNC_GIP
     mov     u64CurNanoTS,         [pGipCPU + SUPGIPCPU.u64NanoTS]
-    mov     u64TSC,               [pGipCPU + SUPGIPCPU.u64TSC]
+    mov     u64TSC,               [pGipCPU + SUPGIPCPU.u64TSC]                              ; transhes pGIP!
+%else
+    mov     u64CurNanoTS,         [pGip + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u64NanoTS]
+    mov     u64TSC,               [pGip + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u64TSC]       ; trashes pGipCPU!
+%endif
+
 
 %ifdef NEED_TRANSACTION_ID
     ;
@@ -564,7 +650,7 @@ BEGINPROC rtTimeNanoTSInternalAsm
     ; dependency on the RDTSC result should do the trick, I think.
     ; CPUID is serializing, so the async path is safe by default.
     ;
- %ifdef ASYNC_GIP
+ %ifdef NEED_APIC_ID
     mov     eax, 1
     cpuid
     cmp     u32ApicIdPlus, ebx
@@ -572,7 +658,11 @@ BEGINPROC rtTimeNanoTSInternalAsm
  %else
     lock xor qword TmpVar, rax
  %endif
+ %ifdef ASYNC_GIP
     cmp     u32TransactionId, [pGipCPU + SUPGIPCPU.u32TransactionId]
+ %else
+    cmp     u32TransactionId, [pGip + SUPGLOBALINFOPAGE.aCPUs + SUPGIPCPU.u32TransactionId]
+ %endif
     jne     .ReadGip
     test    u32TransactionId, 1
     jnz     .ReadGip
diff --git a/src/VBox/Runtime/common/time/timesupref.cpp b/src/VBox/Runtime/common/time/timesupref.cpp
index 12c9bb3..b7717ba 100644
--- a/src/VBox/Runtime/common/time/timesupref.cpp
+++ b/src/VBox/Runtime/common/time/timesupref.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -36,50 +36,184 @@
 #include <iprt/asm-math.h>
 #include <iprt/asm-amd64-x86.h>
 #include <VBox/sup.h>
+#ifdef IN_RC
+# include <VBox/vmm/vmm.h>
+# include <VBox/vmm/vm.h>
+#endif
 #include "internal/time.h"
 
 
+#define TMPL_MODE_SYNC_INVAR_NO_DELTA       1
+#define TMPL_MODE_SYNC_INVAR_WITH_DELTA     2
+#define TMPL_MODE_ASYNC                     3
+
+
 /*
- * Use the CPUID instruction for some kind of serialization.
+ * Use the XCHG instruction for some kind of serialization.
  */
-#undef  ASYNC_GIP
-#undef  USE_LFENCE
-#define NEED_TRANSACTION_ID
-#define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySync
-#include "timesupref.h"
-RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySync);
+#define TMPL_READ_FENCE()        ASMReadFence()
 
-#define ASYNC_GIP
-#ifdef IN_RC
-# undef NEED_TRANSACTION_ID
-#endif
+#undef  TMPL_MODE
+#define TMPL_MODE                TMPL_MODE_SYNC_INVAR_NO_DELTA
+#undef  TMPL_GET_CPU_METHOD
+#define TMPL_GET_CPU_METHOD      0
 #undef  rtTimeNanoTSInternalRef
-#define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsync
+#define rtTimeNanoTSInternalRef  RTTimeNanoTSLegacySyncInvarNoDelta
 #include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarNoDelta);
+
+#ifdef IN_RING3
+
+# undef  TMPL_MODE
+# define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId);
+
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp);
+
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim);
+
+# undef  TMPL_MODE
+# define TMPL_MODE               TMPL_MODE_ASYNC
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseApicId
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseApicId);
+
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseRdtscp
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseRdtscp);
+
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsyncUseIdtrLim
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsyncUseIdtrLim);
+
+#else  /* IN_RC || IN_RING0: Disable interrupts and call getter function. */
+
+# undef  TMPL_MODE
+# define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     UINT32_MAX
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLegacySyncInvarWithDelta
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLegacySyncInvarWithDelta);
+
+# undef  TMPL_MODE
+# define TMPL_MODE TMPL_MODE_ASYNC
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLegacyAsync
+# include "timesupref.h"
 RT_EXPORT_SYMBOL(RTTimeNanoTSLegacyAsync);
 
+#endif
+
 
 /*
  * Use LFENCE for load serialization.
  */
-#undef  ASYNC_GIP
-#define USE_LFENCE
-#undef  NEED_TRANSACTION_ID
-#define NEED_TRANSACTION_ID
-#undef  rtTimeNanoTSInternalRef
-#define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSync
-#include "timesupref.h"
-RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSync);
+#undef  TMPL_READ_FENCE
+#define TMPL_READ_FENCE()        ASMReadFenceSSE2()
 
-#define ASYNC_GIP
-#ifdef IN_RC
-# undef NEED_TRANSACTION_ID
-#endif
+#undef  TMPL_MODE
+#define TMPL_MODE                TMPL_MODE_SYNC_INVAR_NO_DELTA
+#undef  TMPL_GET_CPU_METHOD
+#define TMPL_GET_CPU_METHOD      0
 #undef  rtTimeNanoTSInternalRef
-#define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsync
+#define rtTimeNanoTSInternalRef  RTTimeNanoTSLFenceSyncInvarNoDelta
 #include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarNoDelta);
+
+#ifdef IN_RING3
+
+# undef  TMPL_MODE
+# define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId);
+
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp);
+
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim);
+
+# undef  TMPL_MODE
+# define TMPL_MODE               TMPL_MODE_ASYNC
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_APIC_ID
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseApicId
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseApicId);
+
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseRdtscp
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseRdtscp);
+
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsyncUseIdtrLim
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsyncUseIdtrLim);
+
+#else  /* IN_RC || IN_RING0: Disable interrupts and call getter function. */
+
+# undef  TMPL_MODE
+# define TMPL_MODE               TMPL_MODE_SYNC_INVAR_WITH_DELTA
+# undef  TMPL_GET_CPU_METHOD
+# define TMPL_GET_CPU_METHOD     UINT32_MAX
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceSyncInvarWithDelta
+# include "timesupref.h"
+RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceSyncInvarWithDelta);
+
+# undef  TMPL_MODE
+# define TMPL_MODE TMPL_MODE_ASYNC
+# undef  rtTimeNanoTSInternalRef
+# define rtTimeNanoTSInternalRef RTTimeNanoTSLFenceAsync
+# include "timesupref.h"
 RT_EXPORT_SYMBOL(RTTimeNanoTSLFenceAsync);
 
+#endif
+
 
 #endif /* !IN_GUEST && !RT_NO_GIP */
 
diff --git a/src/VBox/Runtime/common/time/timesupref.h b/src/VBox/Runtime/common/time/timesupref.h
index 6043898..4cd54c8 100644
--- a/src/VBox/Runtime/common/time/timesupref.h
+++ b/src/VBox/Runtime/common/time/timesupref.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -43,131 +43,309 @@
  */
 RTDECL(uint64_t) rtTimeNanoTSInternalRef(PRTTIMENANOTSDATA pData)
 {
-    uint64_t    u64Delta;
-    uint32_t    u32NanoTSFactor0;
-    uint64_t    u64TSC;
-    uint64_t    u64NanoTS;
-    uint32_t    u32UpdateIntervalTSC;
-    uint64_t    u64PrevNanoTS;
-
-    /*
-     * Read the GIP data and the previous value.
-     */
+#if TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA && defined(IN_RING3)
+    PSUPGIPCPU pGipCpuAttemptedTscRecalibration = NULL;
+#endif
+    AssertCompile(RT_IS_POWER_OF_TWO(RTCPUSET_MAX_CPUS));
+
     for (;;)
     {
-        PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
-#ifdef IN_RING3
-        if (RT_UNLIKELY(!pGip || pGip->u32Magic != SUPGLOBALINFOPAGE_MAGIC))
-            return pData->pfnRediscover(pData);
+#ifndef IN_RING3 /* This simplifies and improves everything. */
+        RTCCUINTREG const  uFlags = ASMIntDisableFlags();
 #endif
 
-#ifdef ASYNC_GIP
-        uint8_t    u8ApicId = ASMGetApicId();
-        PSUPGIPCPU pGipCpu = &pGip->aCPUs[pGip->aiCpuFromApicId[u8ApicId]];
+        /*
+         * Check that the GIP is sane and that the premises for this worker function
+         * hasn't changed (CPU onlined with bad delta or missing features).
+         */
+        PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+        if (   RT_LIKELY(pGip)
+            && RT_LIKELY(pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC)
+#if TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA
+            && RT_LIKELY(pGip->enmUseTscDelta >= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO)
 #else
-        PSUPGIPCPU pGipCpu = &pGip->aCPUs[0];
+            && RT_LIKELY(pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
+#endif
+#if defined(IN_RING3) && TMPL_GET_CPU_METHOD != 0 && TMPL_GET_CPU_METHOD != SUPGIPGETCPU_APIC_ID
+            && RT_LIKELY(pGip->fGetGipCpu & TMPL_GET_CPU_METHOD)
+#endif
+           )
+        {
+            /*
+             * Resolve pGipCpu if needed.  If the instruction is serializing, we
+             * read the transaction id first if possible.
+             */
+#if TMPL_MODE == TMPL_MODE_ASYNC || TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA
+# if   defined(IN_RING0)
+            uint32_t const  iCpuSet  = RTMpCurSetIndex();
+            uint16_t const  iGipCpu  = iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)
+                                     ? pGip->aiCpuFromCpuSetIdx[iCpuSet] : UINT16_MAX;
+# elif defined(IN_RC)
+            uint32_t const  iCpuSet  = VMMGetCpu(&g_VM)->iHostCpuSet;
+            uint16_t const  iGipCpu  = iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx)
+                                     ? pGip->aiCpuFromCpuSetIdx[iCpuSet] : UINT16_MAX;
+# elif TMPL_GET_CPU_METHOD == SUPGIPGETCPU_APIC_ID
+#  if TMPL_MODE != TMPL_MODE_ASYNC
+            uint32_t const  u32TransactionId = pGip->aCPUs[0].u32TransactionId;
+#  endif
+            uint8_t  const  idApic   = ASMGetApicId();
+            uint16_t const  iGipCpu  = pGip->aiCpuFromApicId[idApic];
+# elif TMPL_GET_CPU_METHOD == SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+#  if TMPL_MODE != TMPL_MODE_ASYNC
+            uint32_t const  u32TransactionId = pGip->aCPUs[0].u32TransactionId;
+#  endif
+            uint32_t        uAux;
+            ASMReadTscWithAux(&uAux);
+            uint16_t const  iCpuSet  = uAux & (RTCPUSET_MAX_CPUS - 1);
+            uint16_t const  iGipCpu  = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+# elif TMPL_GET_CPU_METHOD == SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+            uint16_t const  cbLim    = ASMGetIdtrLimit();
+            uint16_t const  iCpuSet  = (cbLim - 256 * (ARCH_BITS == 64 ? 16 : 8)) & (RTCPUSET_MAX_CPUS - 1);
+            uint16_t const  iGipCpu  = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+# else
+#  error "What?"
+# endif
+            if (RT_LIKELY(iGipCpu < pGip->cCpus))
+            {
+                PSUPGIPCPU pGipCpu = &pGip->aCPUs[iGipCpu];
+#else
+            {
+#endif
+                /*
+                 * Get the transaction ID if necessary and we haven't already
+                 * read it before a serializing instruction above.  We can skip
+                 * this for ASYNC_TSC mode in ring-0 and raw-mode context since
+                 * we disable interrupts.
+                 */
+#if TMPL_MODE == TMPL_MODE_ASYNC && defined(IN_RING3)
+                uint32_t const u32TransactionId = pGipCpu->u32TransactionId;
+                ASMCompilerBarrier();
+                TMPL_READ_FENCE();
+#elif TMPL_MODE != TMPL_MODE_ASYNC \
+   && TMPL_GET_CPU_METHOD != SUPGIPGETCPU_APIC_ID \
+   && TMPL_GET_CPU_METHOD != SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+                uint32_t const u32TransactionId = pGip->aCPUs[0].u32TransactionId;
+                ASMCompilerBarrier();
+                TMPL_READ_FENCE();
 #endif
 
-#ifdef NEED_TRANSACTION_ID
-        uint32_t u32TransactionId = pGipCpu->u32TransactionId;
-        uint32_t volatile Tmp1;
-        ASMAtomicXchgU32(&Tmp1, u32TransactionId);
+                /*
+                 * Gather all the data we need.  The mess at the end is to make
+                 * sure all loads are done before we recheck the transaction ID
+                 * without triggering serializing twice.
+                 */
+                uint32_t u32NanoTSFactor0       = pGip->u32UpdateIntervalNS;
+#if TMPL_MODE == TMPL_MODE_ASYNC
+                uint32_t u32UpdateIntervalTSC   = pGipCpu->u32UpdateIntervalTSC;
+                uint64_t u64NanoTS              = pGipCpu->u64NanoTS;
+                uint64_t u64TSC                 = pGipCpu->u64TSC;
+#else
+                uint32_t u32UpdateIntervalTSC   = pGip->aCPUs[0].u32UpdateIntervalTSC;
+                uint64_t u64NanoTS              = pGip->aCPUs[0].u64NanoTS;
+                uint64_t u64TSC                 = pGip->aCPUs[0].u64TSC;
+# if TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA
+                int64_t i64TscDelta             = pGipCpu->i64TSCDelta;
+# endif
+#endif
+                uint64_t u64PrevNanoTS          = ASMAtomicUoReadU64(pData->pu64Prev);
+#if TMPL_GET_CPU_METHOD == SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+                ASMCompilerBarrier();
+                uint32_t uAux2;
+                uint64_t u64Delta               = ASMReadTscWithAux(&uAux2); /* serializing */
+#else
+                uint64_t u64Delta               = ASMReadTSC();
+                ASMCompilerBarrier();
+# if TMPL_GET_CPU_METHOD != SUPGIPGETCPU_APIC_ID /* getting APIC will serialize  */ \
+  && (defined(IN_RING3) || TMPL_MODE != TMPL_MODE_ASYNC)
+                TMPL_READ_FENCE(); /* Expensive (~30 ticks).  Would like convincing argumentation that let us remove it. */
+# endif
 #endif
 
-        u32UpdateIntervalTSC = pGipCpu->u32UpdateIntervalTSC;
-        u64NanoTS = pGipCpu->u64NanoTS;
-        u64TSC = pGipCpu->u64TSC;
-        u32NanoTSFactor0 = pGip->u32UpdateIntervalNS;
-        u64Delta = ASMReadTSC();
-        u64PrevNanoTS = ASMAtomicReadU64(pData->pu64Prev);
+                /*
+                 * Check that we didn't change CPU.
+                 */
+#if defined(IN_RING3) && ( TMPL_MODE == TMPL_MODE_ASYNC || TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA )
+# if   TMPL_GET_CPU_METHOD == SUPGIPGETCPU_APIC_ID
+                if (RT_LIKELY(ASMGetApicId() == idApic))
+# elif TMPL_GET_CPU_METHOD == SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS
+                if (RT_LIKELY(uAux2 == uAux))
+# elif TMPL_GET_CPU_METHOD == SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS
+                if (RT_LIKELY(ASMGetIdtrLimit() == cbLim))
+# endif
+#endif
+                {
+                    /*
+                     * Check the transaction ID (see above for R0/RC + ASYNC).
+                     */
+#if defined(IN_RING3) || TMPL_MODE != TMPL_MODE_ASYNC
+# if TMPL_MODE == TMPL_MODE_ASYNC
+                    if (RT_LIKELY(pGipCpu->u32TransactionId       == u32TransactionId && !(u32TransactionId & 1) ))
+# else
+                    if (RT_LIKELY(pGip->aCPUs[0].u32TransactionId == u32TransactionId && !(u32TransactionId & 1) ))
+# endif
+#endif
+                    {
 
-#ifdef NEED_TRANSACTION_ID
-# ifdef ASYNC_GIP
-        if (RT_UNLIKELY(u8ApicId != ASMGetApicId()))
-            continue;
-# elif !defined(RT_ARCH_X86)
-        uint32_t volatile Tmp2;
-        ASMAtomicXchgU32(&Tmp2, u64Delta);
+                        /*
+                         * Apply the TSC delta.  If the delta is invalid and the
+                         * execution allows it, try trigger delta recalibration.
+                         */
+#if TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA && defined(IN_RING3)
+                        if (RT_LIKELY(   i64TscDelta != INT64_MAX
+                                      || pGipCpu == pGipCpuAttemptedTscRecalibration))
+#endif
+                        {
+#if TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA
+# ifndef IN_RING3
+                            if (RT_LIKELY(i64TscDelta != INT64_MAX))
 # endif
-        if (RT_UNLIKELY(    pGipCpu->u32TransactionId != u32TransactionId
-                        ||  (u32TransactionId & 1)))
-            continue;
+                                u64Delta -= i64TscDelta;
 #endif
-        break;
-    }
 
-    /*
-     * Calc NanoTS delta.
-     */
-    u64Delta -= u64TSC;
-    if (RT_UNLIKELY(u64Delta > u32UpdateIntervalTSC))
-    {
-        /*
-         * We've expired the interval, cap it. If we're here for the 2nd
-         * time without any GIP update in-between, the checks against
-         * *pu64Prev below will force 1ns stepping.
-         */
-        pData->cExpired++;
-        u64Delta = u32UpdateIntervalTSC;
-    }
-#if !defined(_MSC_VER) || defined(RT_ARCH_AMD64) /* GCC makes very pretty code from these two inline calls, while MSC cannot. */
-    u64Delta = ASMMult2xU32RetU64((uint32_t)u64Delta, u32NanoTSFactor0);
-    u64Delta = ASMDivU64ByU32RetU32(u64Delta, u32UpdateIntervalTSC);
+                            /*
+                             * Bingo! We've got a consistent set of data.
+                             */
+#ifndef IN_RING3
+                            ASMSetFlags(uFlags);
+#endif
+
+                            /*
+                             * Calc NanoTS delta.
+                             */
+                            u64Delta -= u64TSC;
+                            if (RT_LIKELY(u64Delta <= u32UpdateIntervalTSC))
+                            { /* MSVC branch hint, probably pointless. */ }
+                            else
+                            {
+                                /*
+                                 * We've expired the interval, cap it. If we're here for the 2nd
+                                 * time without any GIP update in-between, the checks against
+                                 * *pu64Prev below will force 1ns stepping.
+                                 */
+                                ASMAtomicIncU32(&pData->cExpired);
+                                u64Delta = u32UpdateIntervalTSC;
+                            }
+#if !defined(_MSC_VER) || !defined(RT_ARCH_X86) /* GCC makes very pretty code from these two inline calls, while MSC cannot. */
+                            u64Delta = ASMMult2xU32RetU64((uint32_t)u64Delta, u32NanoTSFactor0);
+                            u64Delta = ASMDivU64ByU32RetU32(u64Delta, u32UpdateIntervalTSC);
 #else
-    __asm
-    {
-        mov     eax, dword ptr [u64Delta]
-        mul     dword ptr [u32NanoTSFactor0]
-        div     dword ptr [u32UpdateIntervalTSC]
-        mov     dword ptr [u64Delta], eax
-        xor     edx, edx
-        mov     dword ptr [u64Delta + 4], edx
-    }
+                            __asm
+                            {
+                                mov     eax, dword ptr [u64Delta]
+                                mul     dword ptr [u32NanoTSFactor0]
+                                div     dword ptr [u32UpdateIntervalTSC]
+                                mov     dword ptr [u64Delta], eax
+                                xor     edx, edx
+                                mov     dword ptr [u64Delta + 4], edx
+                            }
 #endif
 
-    /*
-     * Calculate the time and compare it with the previously returned value.
-     */
-    u64NanoTS += u64Delta;
-    uint64_t u64DeltaPrev = u64NanoTS - u64PrevNanoTS;
-    if (RT_LIKELY(   u64DeltaPrev > 0
-                  && u64DeltaPrev < UINT64_C(86000000000000) /* 24h */))
-        /* Frequent - less than 24h since last call. */;
-    else if (RT_LIKELY(   (int64_t)u64DeltaPrev <= 0
-                       && (int64_t)u64DeltaPrev + u32NanoTSFactor0 * 2 >= 0))
-    {
-        /* Occasional - u64NanoTS is in the recent 'past' relative the previous call. */
-        ASMAtomicIncU32(&pData->c1nsSteps);
-        u64NanoTS = u64PrevNanoTS + 1;
-    }
-    else if (!u64PrevNanoTS)
-        /* We're resuming (see TMVirtualResume). */;
-    else
-    {
-        /* Something has gone bust, if negative offset it's real bad. */
-        ASMAtomicIncU32(&pData->cBadPrev);
-        pData->pfnBad(pData, u64NanoTS, u64DeltaPrev, u64PrevNanoTS);
-    }
+                            /*
+                             * Calculate the time and compare it with the previously returned value.
+                             */
+                            u64NanoTS += u64Delta;
+                            uint64_t u64DeltaPrev = u64NanoTS - u64PrevNanoTS;
+                            if (RT_LIKELY(   u64DeltaPrev > 0
+                                          && u64DeltaPrev < UINT64_C(86000000000000) /* 24h */))
+                            { /* Frequent - less than 24h since last call. */ }
+                            else if (RT_LIKELY(   (int64_t)u64DeltaPrev <= 0
+                                               && (int64_t)u64DeltaPrev + u32NanoTSFactor0 * 2 >= 0))
+                            {
+                                /* Occasional - u64NanoTS is in the recent 'past' relative the previous call. */
+                                ASMAtomicIncU32(&pData->c1nsSteps);
+                                u64NanoTS = u64PrevNanoTS + 1;
+                            }
+                            else if (!u64PrevNanoTS)
+                                /* We're resuming (see TMVirtualResume). */;
+                            else
+                            {
+                                /* Something has gone bust, if negative offset it's real bad. */
+                                ASMAtomicIncU32(&pData->cBadPrev);
+                                pData->pfnBad(pData, u64NanoTS, u64DeltaPrev, u64PrevNanoTS);
+                            }
+
+                            /*
+                             * Attempt updating the previous value, provided we're still ahead of it.
+                             *
+                             * There is no point in recalculating u64NanoTS because we got preempted or if
+                             * we raced somebody while the GIP was updated, since these are events
+                             * that might occur at any point in the return path as well.
+                             */
+                            if (RT_LIKELY(ASMAtomicCmpXchgU64(pData->pu64Prev, u64NanoTS, u64PrevNanoTS)))
+                                return u64NanoTS;
+
+                            ASMAtomicIncU32(&pData->cUpdateRaces);
+                            for (int cTries = 25; cTries > 0; cTries--)
+                            {
+                                u64PrevNanoTS = ASMAtomicReadU64(pData->pu64Prev);
+                                if (u64PrevNanoTS >= u64NanoTS)
+                                    break;
+                                if (ASMAtomicCmpXchgU64(pData->pu64Prev, u64NanoTS, u64PrevNanoTS))
+                                    break;
+                                ASMNopPause();
+                            }
+                            return u64NanoTS;
+                        }
+
+#if TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA && defined(IN_RING3)
+                        /*
+                         * Call into the support driver to try make it recalculate the delta. We
+                         * remember which GIP CPU structure we're probably working on so we won't
+                         * end up in a loop if the driver for some reason cannot get the job done.
+                         */
+                        else /* else is unecessary, but helps checking the preprocessor spaghetti. */
+                        {
+                            pGipCpuAttemptedTscRecalibration = pGipCpu;
+                            uint64_t u64TscTmp;
+                            uint16_t idApicUpdate;
+                            int rc = SUPR3ReadTsc(&u64TscTmp, &idApicUpdate);
+                            if (RT_SUCCESS(rc) && idApicUpdate < RT_ELEMENTS(pGip->aiCpuFromApicId))
+                            {
+                                uint32_t iUpdateGipCpu = pGip->aiCpuFromApicId[idApicUpdate];
+                                if (iUpdateGipCpu < pGip->cCpus)
+                                    pGipCpuAttemptedTscRecalibration = &pGip->aCPUs[iUpdateGipCpu];
+                            }
+                        }
+#endif
+                    }
+                }
+
+                /*
+                 * No joy must try again.
+                 */
+#ifndef IN_RING3
+                ASMSetFlags(uFlags);
+#endif
+                ASMNopPause();
+                continue;
+            }
+
+#if TMPL_MODE == TMPL_MODE_ASYNC || TMPL_MODE == TMPL_MODE_SYNC_INVAR_WITH_DELTA
+            /*
+             * We've got a bad CPU or APIC index of some kind.
+             */
+            else /* else is unecessary, but helps checking the preprocessor spaghetti. */
+            {
+# ifndef IN_RING3
+                ASMSetFlags(uFlags);
+# endif
+# if defined(IN_RING0) || defined(IN_RC) || TMPL_GET_CPU_METHOD != SUPGIPGETCPU_APIC_ID
+                return pData->pfnBadCpuIndex(pData, UINT16_MAX-1, iCpuSet, iGipCpu);
+# else
+                return pData->pfnBadCpuIndex(pData, idApic, UINT16_MAX-1, iGipCpu);
+# endif
+            }
+#endif
+        }
 
-    if (RT_UNLIKELY(!ASMAtomicCmpXchgU64(pData->pu64Prev, u64NanoTS, u64PrevNanoTS)))
-    {
         /*
-         * Attempt updating the previous value, provided we're still ahead of it.
-         *
-         * There is no point in recalculating u64NanoTS because we got preempted or if
-         * we raced somebody while the GIP was updated, since these are events
-         * that might occur at any point in the return path as well.
+         * Something changed in the GIP config or it was unmapped, figure out
+         * the right worker function to use now.
          */
-        pData->cUpdateRaces++;
-        for (int cTries = 25; cTries > 0; cTries--)
-        {
-            u64PrevNanoTS = ASMAtomicReadU64(pData->pu64Prev);
-            if (u64PrevNanoTS >= u64NanoTS)
-                break;
-            if (ASMAtomicCmpXchgU64(pData->pu64Prev, u64NanoTS, u64PrevNanoTS))
-                break;
-        }
+#ifndef IN_RING3
+        ASMSetFlags(uFlags);
+#endif
+        return pData->pfnRediscover(pData);
     }
-    return u64NanoTS;
 }
 
diff --git a/src/VBox/Runtime/common/zip/gzipvfs.cpp b/src/VBox/Runtime/common/zip/gzipvfs.cpp
index 87efeb1..a9ef3e8 100644
--- a/src/VBox/Runtime/common/zip/gzipvfs.cpp
+++ b/src/VBox/Runtime/common/zip/gzipvfs.cpp
@@ -147,7 +147,7 @@ typedef struct RTZIPGZIPSTREAM
     bool                fFatalError;
     /** Set if we've reached the end of the zlib stream. */
     bool                fEndOfStream;
-    /** The stream offset for pfnTell. */
+    /** The stream offset for pfnTell, always the uncompressed data. */
     RTFOFF              offStream;
     /** The zlib stream.  */
     z_stream            Zlib;
@@ -376,9 +376,9 @@ static DECLCALLBACK(int) rtZipGzip_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgB
     PRTZIPGZIPSTREAM pThis = (PRTZIPGZIPSTREAM)pvThis;
 
     Assert(pSgBuf->cSegs == 1);
-    AssertReturn(off == -1, VERR_INVALID_PARAMETER);
     if (!pThis->fDecompress)
         return VERR_ACCESS_DENIED;
+    AssertReturn(off == -1 || off == pThis->offStream , VERR_INVALID_PARAMETER);
 
     return rtZipGzip_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead);
 }
@@ -509,14 +509,13 @@ static DECLCALLBACK(int) rtZipGzip_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSg
 {
     PRTZIPGZIPSTREAM pThis = (PRTZIPGZIPSTREAM)pvThis;
 
-    AssertReturn(off == -1, VERR_INVALID_PARAMETER);
     Assert(pSgBuf->cSegs == 1); NOREF(fBlocking);
-
     if (pThis->fDecompress)
         return VERR_ACCESS_DENIED;
+    AssertReturn(off == -1 || off == pThis->offStream , VERR_INVALID_PARAMETER);
 
     /*
-     * Write out the intput buffer. Using a loop here because of potential
+     * Write out the input buffer. Using a loop here because of potential
      * integer type overflow since avail_in is uInt and cbSeg is size_t.
      */
     int             rc        = VINF_SUCCESS;
@@ -540,6 +539,7 @@ static DECLCALLBACK(int) rtZipGzip_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSg
             cbLeft -= cbThis;
         }
 
+    pThis->offStream += cbWritten;
     if (pcbWritten)
         *pcbWritten = cbWritten;
     return rc;
diff --git a/src/VBox/Runtime/common/zip/pkzipvfs.cpp b/src/VBox/Runtime/common/zip/pkzipvfs.cpp
index cc0567e..d5ddf15 100644
--- a/src/VBox/Runtime/common/zip/pkzipvfs.cpp
+++ b/src/VBox/Runtime/common/zip/pkzipvfs.cpp
@@ -451,7 +451,7 @@ static uint64_t rtZipPkzipReaderUncompressed(PRTZIPPKZIPREADER pThis)
 {
     if (pThis->fZip64Ex && pThis->cdh.cbUncompressed == (uint32_t)-1)
         return pThis->cd64ex.cbUncompressed;
-    
+
     return pThis->cdh.cbUncompressed;
 }
 
@@ -463,7 +463,7 @@ static uint64_t rtZipPkzipReaderCompressed(PRTZIPPKZIPREADER pThis)
 {
     if (pThis->fZip64Ex && pThis->cdh.cbCompressed == (uint32_t)-1)
         return pThis->cd64ex.cbCompressed;
-    
+
     return pThis->cdh.cbCompressed;
 }
 
diff --git a/src/VBox/Runtime/common/zip/tar.cpp b/src/VBox/Runtime/common/zip/tar.cpp
index e2ced7e..e18ecce 100644
--- a/src/VBox/Runtime/common/zip/tar.cpp
+++ b/src/VBox/Runtime/common/zip/tar.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2013 Oracle Corporation
+ * Copyright (C) 2009-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -25,9 +25,9 @@
  */
 
 
-/******************************************************************************
- *   Header Files                                                             *
- ******************************************************************************/
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
 #include "internal/iprt.h"
 #include <iprt/tar.h>
 
@@ -38,15 +38,17 @@
 #include <iprt/mem.h>
 #include <iprt/path.h>
 #include <iprt/string.h>
+#include <iprt/vfs.h>
+#include <iprt/zip.h>
+
 
 #include "internal/magics.h"
 #include "tar.h"
 
 
-/******************************************************************************
- *   Structures and Typedefs                                                  *
- ******************************************************************************/
-
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
 /** @name RTTARRECORD::h::linkflag
  * @{  */
 #define LF_OLDNORMAL '\0' /**< Normal disk file, Unix compatible */
@@ -107,10 +109,12 @@ typedef struct RTTARINTERNAL
     /** Whether a file within the archive is currently open for writing.
      * Only one can be open.  */
     bool                fFileOpenForWrite;
-    /** Whether operating in stream mode. */
-    bool                fStreamMode;
-    /** The file cache of one file.  */
-    PRTTARFILEINTERNAL  pFileCache;
+    /** The tar file VFS handle (for reading). */
+    RTVFSFILE           hVfsFile;
+    /** The tar file system VFS handle. */
+    RTVFSFSSTREAM       hVfsFss;
+    /** Set if hVfsFss is at the start of the stream and doesn't need rewinding. */
+    bool                fFssAtStart;
 } RTTARINTERNAL;
 /** Pointer to a the internal data of a tar handle.  */
 typedef RTTARINTERNAL* PRTTARINTERNAL;
@@ -122,6 +126,8 @@ typedef struct RTTARFILEINTERNAL
 {
     /** The magic (RTTARFILE_MAGIC). */
     uint32_t        u32Magic;
+    /** The open mode. */
+    uint32_t        fOpenMode;
     /** Pointer to back to the tar file. */
     PRTTARINTERNAL  pTar;
     /** The name of the file. */
@@ -134,28 +140,17 @@ typedef struct RTTARFILEINTERNAL
     uint64_t        cbSetSize;
     /** The current offset within this file. */
     uint64_t        offCurrent;
-    /** The open mode. */
-    uint32_t        fOpenMode;
-    /** The link flag. */
-    char            linkflag;
+    /** The VFS I/O stream (only for reading atm). */
+    RTVFSIOSTREAM   hVfsIos;
 } RTTARFILEINTERNAL;
 /** Pointer to the internal data of a tar file.  */
 typedef RTTARFILEINTERNAL *PRTTARFILEINTERNAL;
 
-#if 0 /* not currently used */
-typedef struct RTTARFILELIST
-{
-    char *pszFilename;
-    RTTARFILELIST *pNext;
-} RTTARFILELIST;
-typedef RTTARFILELIST *PRTTARFILELIST;
-#endif
-
 
 
-/******************************************************************************
- *   Defined Constants And Macros                                             *
- ******************************************************************************/
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
 
 /** Validates a handle and returns VERR_INVALID_HANDLE if not valid. */
 /* RTTAR */
@@ -192,83 +187,263 @@ typedef RTTARFILELIST *PRTTARFILELIST;
     } while (0)
 
 
-/******************************************************************************
- *   Internal Functions                                                       *
- ******************************************************************************/
-
-DECLINLINE(void) rtTarSizeToRec(PRTTARRECORD pRecord, uint64_t cbSize)
+RTR3DECL(int) RTTarOpen(PRTTAR phTar, const char *pszTarname, uint32_t fMode)
 {
+    AssertReturn(fMode & RTFILE_O_WRITE, VERR_INVALID_PARAMETER);
+
     /*
-     * Small enough for the standard octal string encoding?
-     *
-     * Note! We could actually use the terminator character as well if we liked,
-     *       but let not do that as it's easier to test this way.
+     * Create a tar instance.
      */
-    if (cbSize < _4G * 2U)
-        RTStrPrintf(pRecord->h.size, sizeof(pRecord->h.size), "%0.11llo", cbSize);
-    else
+    PRTTARINTERNAL pThis = (PRTTARINTERNAL)RTMemAllocZ(sizeof(RTTARINTERNAL));
+    if (!pThis)
+        return VERR_NO_MEMORY;
+
+    pThis->u32Magic         = RTTAR_MAGIC;
+    pThis->fOpenMode        = fMode;
+    pThis->hVfsFile         = NIL_RTVFSFILE;
+    pThis->hVfsFss          = NIL_RTVFSFSSTREAM;
+    pThis->fFssAtStart      = false;
+
+    /*
+     * Open the tar file.
+     */
+    int rc = RTFileOpen(&pThis->hTarFile, pszTarname, fMode);
+    if (RT_SUCCESS(rc))
     {
-        /*
-         * Base 256 extension. Set the highest bit of the left most character.
-         * We don't deal with negatives here, cause the size have to be greater
-         * than zero.
-         *
-         * Note! The base-256 extension are never used by gtar or libarchive
-         *       with the "ustar  \0" format version, only the later
-         *       "ustar\000" version.  However, this shouldn't cause much
-         *       trouble as they are not picky about what they read.
-         */
-        size_t cchField = sizeof(pRecord->h.size) - 1;
-        unsigned char *puchField = (unsigned char*)pRecord->h.size;
-        puchField[0] = 0x80;
-        do
+        *phTar = pThis;
+        return VINF_SUCCESS;
+    }
+
+    RTMemFree(pThis);
+    return rc;
+}
+
+
+RTR3DECL(int) RTTarClose(RTTAR hTar)
+{
+    if (hTar == NIL_RTTAR)
+        return VINF_SUCCESS;
+
+    PRTTARINTERNAL pInt = hTar;
+    RTTAR_VALID_RETURN(pInt);
+
+    int rc = VINF_SUCCESS;
+
+    /* gtar gives a warning, but the documentation says EOF is indicated by a
+     * zero block. Disabled for now. */
+#if 0
+    {
+        /* Append the EOF record which is filled all by zeros */
+        RTTARRECORD record;
+        RT_ZERO(record);
+        rc = RTFileWrite(pInt->hTarFile, &record, sizeof(record), NULL);
+    }
+#endif
+
+    if (pInt->hVfsFss != NIL_RTVFSFSSTREAM)
+    {
+        uint32_t cRefs = RTVfsFsStrmRelease(pInt->hVfsFss); Assert(cRefs != UINT32_MAX);
+        pInt->hVfsFss  = NIL_RTVFSFSSTREAM;
+    }
+
+    if (pInt->hVfsFile != NIL_RTVFSFILE)
+    {
+        uint32_t cRefs = RTVfsFileRelease(pInt->hVfsFile); Assert(cRefs != UINT32_MAX);
+        pInt->hVfsFile = NIL_RTVFSFILE;
+    }
+
+    if (pInt->hTarFile != NIL_RTFILE)
+    {
+        rc = RTFileClose(pInt->hTarFile);
+        pInt->hTarFile = NIL_RTFILE;
+    }
+
+    pInt->u32Magic = RTTAR_MAGIC_DEAD;
+
+    RTMemFree(pInt);
+
+    return rc;
+}
+
+
+/**
+ * Creates a tar file handle for a read-only VFS stream object.
+ *
+ * @returns IPRT status code.
+ * @param   pszName             The file name. Automatically freed on failure.
+ * @param   hVfsIos             The VFS I/O stream we create the handle around.
+ *                              The reference is NOT consumed.
+ * @param   fOpen               The open flags.
+ * @param   ppFile              Where to return the handle.
+ */
+static int rtTarFileCreateHandleForReadOnly(char *pszName, RTVFSIOSTREAM hVfsIos, uint32_t fOpen, PRTTARFILEINTERNAL *ppFile)
+{
+    int rc;
+    PRTTARFILEINTERNAL pNewFile = (PRTTARFILEINTERNAL)RTMemAllocZ(sizeof(*pNewFile));
+    if (pNewFile)
+    {
+        RTFSOBJINFO ObjInfo;
+        rc = RTVfsIoStrmQueryInfo(hVfsIos, &ObjInfo, RTFSOBJATTRADD_UNIX);
+        if (RT_SUCCESS(rc))
         {
-            puchField[cchField--] = cbSize & 0xff;
-            cbSize >>= 8;
-        } while (cchField);
+            pNewFile->u32Magic      = RTTARFILE_MAGIC;
+            pNewFile->pTar          = NULL;
+            pNewFile->pszFilename   = pszName;
+            pNewFile->offStart      = UINT64_MAX;
+            pNewFile->cbSize        = ObjInfo.cbObject;
+            pNewFile->cbSetSize     = 0;
+            pNewFile->offCurrent    = 0;
+            pNewFile->fOpenMode     = fOpen;
+            pNewFile->hVfsIos       = hVfsIos;
+
+            uint32_t cRefs = RTVfsIoStrmRetain(hVfsIos); Assert(cRefs != UINT32_MAX); NOREF(cRefs);
+
+            *ppFile = pNewFile;
+            return VINF_SUCCESS;
+        }
+
+        RTMemFree(pNewFile);
     }
+    else
+        rc = VERR_NO_MEMORY;
+    RTStrFree(pszName);
+    return rc;
+}
+
+
+/* Only used for write handles. */
+static PRTTARFILEINTERNAL rtTarFileCreateForWrite(PRTTARINTERNAL pInt, const char *pszFilename, uint32_t fOpen)
+{
+    PRTTARFILEINTERNAL pFileInt = (PRTTARFILEINTERNAL)RTMemAllocZ(sizeof(RTTARFILEINTERNAL));
+    if (!pFileInt)
+        return NULL;
+
+    pFileInt->u32Magic    = RTTARFILE_MAGIC;
+    pFileInt->pTar        = pInt;
+    pFileInt->fOpenMode   = fOpen;
+    pFileInt->pszFilename = RTStrDup(pszFilename);
+    pFileInt->hVfsIos     = NIL_RTVFSIOSTREAM;
+    if (pFileInt->pszFilename)
+        return pFileInt;
+
+    RTMemFree(pFileInt);
+    return NULL;
+
 }
 
-DECLINLINE(uint64_t) rtTarRecToSize(PRTTARRECORD pRecord)
+
+RTR3DECL(int) RTTarFileOpen(RTTAR hTar, PRTTARFILE phFile, const char *pszFilename, uint32_t fOpen)
 {
-    int64_t cbSize = 0;
-    if (pRecord->h.size[0] & 0x80)
+    /* Write only interface now. */
+    AssertReturn(fOpen & RTFILE_O_WRITE, VERR_INVALID_PARAMETER);
+
+    PRTTARINTERNAL pInt = hTar;
+    RTTAR_VALID_RETURN(pInt);
+
+    if (!pInt->hTarFile)
+        return VERR_INVALID_HANDLE;
+
+    if (fOpen & RTFILE_O_WRITE)
     {
-        size_t cchField = sizeof(pRecord->h.size);
-        unsigned char const *puchField = (unsigned char const *)pRecord->h.size;
+        if (!(pInt->fOpenMode & RTFILE_O_WRITE))
+            return VERR_WRITE_PROTECT;
+        if (pInt->fFileOpenForWrite)
+            return VERR_TOO_MANY_OPEN_FILES;
+    }
 
+    int rc = VINF_SUCCESS;
+    if (!(fOpen & RTFILE_O_WRITE))
+    {
         /*
-         * The first byte has the bit 7 set to indicate base-256, while bit 6
-         * is the signed bit. Bits 5:0 are the most significant value bits.
+         * Rewind the stream if necessary.
          */
-        cbSize = !(0x40 & *puchField) ? 0 : -1;
-        cbSize = (cbSize << 6) | (*puchField & 0x3f);
-        cchField--;
-        puchField++;
+        if (!pInt->fFssAtStart)
+        {
+            if (pInt->hVfsFss != NIL_RTVFSFSSTREAM)
+            {
+                uint32_t cRefs = RTVfsFsStrmRelease(pInt->hVfsFss); Assert(cRefs != UINT32_MAX);
+                pInt->hVfsFss  = NIL_RTVFSFSSTREAM;
+            }
+
+            if (pInt->hVfsFile == NIL_RTVFSFILE)
+            {
+                rc = RTVfsFileFromRTFile(pInt->hTarFile, RTFILE_O_READ, true /*fLeaveOpen*/, &pInt->hVfsFile);
+                if (RT_FAILURE(rc))
+                    return rc;
+            }
+
+            RTVFSIOSTREAM hVfsIos = RTVfsFileToIoStream(pInt->hVfsFile);
+            rc = RTZipTarFsStreamFromIoStream(hVfsIos, 0 /*fFlags*/, &pInt->hVfsFss);
+            RTVfsIoStrmRelease(hVfsIos);
+            if (RT_FAILURE(rc))
+                return rc;
+        }
 
         /*
-         * The remaining bytes are used in full.
+         * Search the file system stream.
          */
-        while (cchField-- > 0)
+        pInt->fFssAtStart = false;
+        for (;;)
         {
-            if (RT_UNLIKELY(   cbSize > INT64_MAX / 256
-                            || cbSize < INT64_MIN / 256))
+            char           *pszName;
+            RTVFSOBJTYPE    enmType;
+            RTVFSOBJ        hVfsObj;
+            rc = RTVfsFsStrmNext(pInt->hVfsFss, &pszName, &enmType, &hVfsObj);
+            if (rc == VERR_EOF)
+                return VERR_FILE_NOT_FOUND;
+            if (RT_FAILURE(rc))
+                return rc;
+
+            if (!RTStrCmp(pszName, pszFilename))
             {
-                cbSize = cbSize < 0 ? INT64_MIN : INT64_MAX;
+                if (enmType == RTVFSOBJTYPE_FILE || enmType == RTVFSOBJTYPE_IO_STREAM)
+                    rc = rtTarFileCreateHandleForReadOnly(pszName, RTVfsObjToIoStream(hVfsObj), fOpen, phFile);
+                else
+                {
+                    rc = VERR_UNEXPECTED_FS_OBJ_TYPE;
+                    RTStrFree(pszName);
+                }
+                RTVfsObjRelease(hVfsObj);
                 break;
             }
-            cbSize = (cbSize << 8) | *puchField++;
-        }
+            RTStrFree(pszName);
+            RTVfsObjRelease(hVfsObj);
+        } /* Search loop. */
     }
     else
-        RTStrToInt64Full(pRecord->h.size, 8, &cbSize);
+    {
+        PRTTARFILEINTERNAL pFileInt = rtTarFileCreateForWrite(pInt, pszFilename, fOpen);
+        if (!pFileInt)
+            return VERR_NO_MEMORY;
+
+        pInt->fFileOpenForWrite = true;
 
-    if (cbSize < 0)
-        cbSize = 0;
+        /* If we are in write mode, we also in append mode. Add an dummy
+         * header at the end of the current file. It will be filled by the
+         * close operation. */
+        rc = RTFileSeek(pFileInt->pTar->hTarFile, 0, RTFILE_SEEK_END, &pFileInt->offStart);
+        if (RT_SUCCESS(rc))
+        {
+            RTTARRECORD record;
+            RT_ZERO(record);
+            rc = RTFileWrite(pFileInt->pTar->hTarFile, &record, sizeof(RTTARRECORD), NULL);
+        }
+
+        if (RT_SUCCESS(rc))
+            *phFile = (RTTARFILE)pFileInt;
+        else
+        {
+            /* Cleanup on failure */
+            if (pFileInt->pszFilename)
+                RTStrFree(pFileInt->pszFilename);
+            RTMemFree(pFileInt);
+        }
+    }
 
-    return (uint64_t)cbSize;
+    return rc;
 }
 
+
 /**
  * Calculates the TAR header checksums and detects if it's all zeros.
  *
@@ -324,44 +499,43 @@ static bool rtZipTarCalcChkSum(PCRTZIPTARHDR pHdr, int32_t *pi32Unsigned, int32_
     return fZeroHdr;
 }
 
-DECLINLINE(int) rtTarReadHeaderRecord(RTFILE hFile, PRTTARRECORD pRecord)
-{
-    int rc = RTFileRead(hFile, pRecord, sizeof(RTTARRECORD), NULL);
-    /* Check for EOF. EOF is valid in this case, cause it indicates no more
-     * data in the tar archive. */
-    if (rc == VERR_EOF)
-        return VERR_TAR_END_OF_FILE;
-    /* Report any other errors */
-    else if (RT_FAILURE(rc))
-        return rc;
-
-    /* Check for data integrity & an EOF record */
-    int32_t iUnsignedChksum, iSignedChksum;
-    if (rtZipTarCalcChkSum((PCRTZIPTARHDR)pRecord, &iUnsignedChksum, &iSignedChksum))
-        return VERR_TAR_END_OF_FILE;
 
-    /* Verify the checksum */
-    uint32_t sum;
-    rc = RTStrToUInt32Full(pRecord->h.chksum, 8, &sum);
-    if (   RT_SUCCESS(rc)
-        && (   sum == (uint32_t)iSignedChksum
-            || sum == (uint32_t)iUnsignedChksum) )
+static void rtTarSizeToRec(PRTTARRECORD pRecord, uint64_t cbSize)
+{
+    /*
+     * Small enough for the standard octal string encoding?
+     *
+     * Note! We could actually use the terminator character as well if we liked,
+     *       but let not do that as it's easier to test this way.
+     */
+    if (cbSize < _4G * 2U)
+        RTStrPrintf(pRecord->h.size, sizeof(pRecord->h.size), "%0.11llo", cbSize);
+    else
     {
-        /* Make sure the strings are zero terminated. */
-        pRecord->h.name[sizeof(pRecord->h.name) - 1]         = 0;
-        pRecord->h.linkname[sizeof(pRecord->h.linkname) - 1] = 0;
-        pRecord->h.magic[sizeof(pRecord->h.magic) - 1]       = 0;
-        pRecord->h.uname[sizeof(pRecord->h.uname) - 1]       = 0;
-        pRecord->h.gname[sizeof(pRecord->h.gname) - 1]       = 0;
+        /*
+         * Base 256 extension. Set the highest bit of the left most character.
+         * We don't deal with negatives here, cause the size have to be greater
+         * than zero.
+         *
+         * Note! The base-256 extension are never used by gtar or libarchive
+         *       with the "ustar  \0" format version, only the later
+         *       "ustar\000" version.  However, this shouldn't cause much
+         *       trouble as they are not picky about what they read.
+         */
+        size_t cchField = sizeof(pRecord->h.size) - 1;
+        unsigned char *puchField = (unsigned char*)pRecord->h.size;
+        puchField[0] = 0x80;
+        do
+        {
+            puchField[cchField--] = cbSize & 0xff;
+            cbSize >>= 8;
+        } while (cchField);
     }
-    else
-        rc = VERR_TAR_CHKSUM_MISMATCH;
-
-    return rc;
 }
 
-DECLINLINE(int) rtTarCreateHeaderRecord(PRTTARRECORD pRecord, const char *pszSrcName, uint64_t cbSize,
-                                        RTUID uid, RTGID gid, RTFMODE fmode, int64_t mtime)
+
+static int rtTarCreateHeaderRecord(PRTTARRECORD pRecord, const char *pszSrcName, uint64_t cbSize,
+                                   RTUID uid, RTGID gid, RTFMODE fmode, int64_t mtime)
 {
     /** @todo check for field overflows. */
     /* Fill the header record */
@@ -391,6 +565,7 @@ DECLINLINE(int) rtTarCreateHeaderRecord(PRTTARRECORD pRecord, const char *pszSrc
     return VINF_SUCCESS;
 }
 
+
 DECLINLINE(void *) rtTarMemTmpAlloc(size_t *pcbSize)
 {
     *pcbSize = 0;
@@ -407,7 +582,8 @@ DECLINLINE(void *) rtTarMemTmpAlloc(size_t *pcbSize)
     return pvTmp;
 }
 
-DECLINLINE(int) rtTarAppendZeros(RTTARFILE hFile, uint64_t cbSize)
+
+static int rtTarAppendZeros(PRTTARFILEINTERNAL pFileInt, uint64_t cbSize)
 {
     /* Allocate a temporary buffer for copying the tar content in blocks. */
     size_t cbTmp = 0;
@@ -424,7 +600,7 @@ DECLINLINE(int) rtTarAppendZeros(RTTARFILE hFile, uint64_t cbSize)
         if (cbAllWritten >= cbSize)
             break;
         size_t cbToWrite = RT_MIN(cbSize - cbAllWritten, cbTmp);
-        rc = RTTarFileWrite(hFile, pvTmp, cbToWrite, &cbWritten);
+        rc = RTTarFileWriteAt(pFileInt, pFileInt->offCurrent, pvTmp, cbToWrite, &cbWritten);
         if (RT_FAILURE(rc))
             break;
         cbAllWritten += cbWritten;
@@ -435,1335 +611,149 @@ DECLINLINE(int) rtTarAppendZeros(RTTARFILE hFile, uint64_t cbSize)
     return rc;
 }
 
-DECLINLINE(PRTTARFILEINTERNAL) rtCreateTarFileInternal(PRTTARINTERNAL pInt, const char *pszFilename, uint32_t fOpen)
-{
-    PRTTARFILEINTERNAL pFileInt = (PRTTARFILEINTERNAL)RTMemAllocZ(sizeof(RTTARFILEINTERNAL));
-    if (!pFileInt)
-        return NULL;
-
-    pFileInt->u32Magic = RTTARFILE_MAGIC;
-    pFileInt->pTar = pInt;
-    pFileInt->fOpenMode = fOpen;
-    pFileInt->pszFilename = RTStrDup(pszFilename);
-    if (!pFileInt->pszFilename)
-    {
-        RTMemFree(pFileInt);
-        return NULL;
-    }
-
-    return pFileInt;
-}
 
-DECLINLINE(PRTTARFILEINTERNAL) rtCopyTarFileInternal(PRTTARFILEINTERNAL pInt)
+RTR3DECL(int) RTTarFileClose(RTTARFILE hFile)
 {
-    PRTTARFILEINTERNAL pNewInt = (PRTTARFILEINTERNAL)RTMemAllocZ(sizeof(RTTARFILEINTERNAL));
-    if (!pNewInt)
-        return NULL;
-
-    memcpy(pNewInt, pInt, sizeof(RTTARFILEINTERNAL));
-    pNewInt->pszFilename = RTStrDup(pInt->pszFilename);
-    if (!pNewInt->pszFilename)
-    {
-        RTMemFree(pNewInt);
-        return NULL;
-    }
-
-    return pNewInt;
-}
+    /* Already closed? */
+    if (hFile == NIL_RTTARFILE)
+        return VINF_SUCCESS;
 
-DECLINLINE(void) rtDeleteTarFileInternal(PRTTARFILEINTERNAL pInt)
-{
-    if (pInt)
-    {
-        if (pInt->pszFilename)
-            RTStrFree(pInt->pszFilename);
-        pInt->u32Magic = RTTARFILE_MAGIC_DEAD;
-        RTMemFree(pInt);
-    }
-}
+    PRTTARFILEINTERNAL pFileInt = hFile;
+    RTTARFILE_VALID_RETURN(pFileInt);
 
-static int rtTarExtractFileToFile(RTTARFILE hFile, const char *pszTargetName, const uint64_t cbOverallSize, uint64_t &cbOverallWritten, PFNRTPROGRESS pfnProgressCallback, void *pvUser)
-{
-    /* Open the target file */
-    RTFILE hNewFile;
-    int rc = RTFileOpen(&hNewFile, pszTargetName, RTFILE_O_CREATE | RTFILE_O_WRITE | RTFILE_O_DENY_WRITE);
-    if (RT_FAILURE(rc))
-        return rc;
+    int rc = VINF_SUCCESS;
 
-    void *pvTmp = NULL;
-    do
+    /* In write mode: */
+    if ((pFileInt->fOpenMode & (RTFILE_O_WRITE | RTFILE_O_READ)) == RTFILE_O_WRITE)
     {
-        /* Allocate a temporary buffer for reading the tar content in blocks. */
-        size_t cbTmp = 0;
-        pvTmp = rtTarMemTmpAlloc(&cbTmp);
-        if (!pvTmp)
-        {
-            rc = VERR_NO_MEMORY;
-            break;
-        }
-
-        /* Get the size of the source file */
-        uint64_t cbToCopy = 0;
-        rc = RTTarFileGetSize(hFile, &cbToCopy);
-        if (RT_FAILURE(rc))
-            break;
-
-        /* Copy the content from hFile over to pszTargetName. */
-        uint64_t cbAllWritten = 0; /* Already copied */
-        uint64_t cbRead = 0; /* Actually read in the last step */
-        for (;;)
+        pFileInt->pTar->fFileOpenForWrite = false;
+        do
         {
-            if (pfnProgressCallback)
-                pfnProgressCallback((unsigned)(100.0 / cbOverallSize * cbOverallWritten), pvUser);
+            /* If the user has called RTTarFileSetSize in the meantime, we have
+               to make sure the file has the right size. */
+            if (pFileInt->cbSetSize > pFileInt->cbSize)
+            {
+                rc = rtTarAppendZeros(pFileInt, pFileInt->cbSetSize - pFileInt->cbSize);
+                if (RT_FAILURE(rc))
+                    break;
+            }
 
-            /* Finished already? */
-            if (cbAllWritten == cbToCopy)
-                break;
-
-            /* Read one block. */
-            cbRead = RT_MIN(cbToCopy - cbAllWritten, cbTmp);
-            rc = RTTarFileRead(hFile, pvTmp, cbRead, NULL);
-            if (RT_FAILURE(rc))
-                break;
-
-            /* Write the block */
-            rc = RTFileWrite(hNewFile, pvTmp, cbRead, NULL);
-            if (RT_FAILURE(rc))
-                break;
-
-            /* Count how many bytes are written already */
-            cbAllWritten += cbRead;
-            cbOverallWritten += cbRead;
-        }
-
-    } while(0);
-
-    /* Cleanup */
-    if (pvTmp)
-        RTMemTmpFree(pvTmp);
-
-    /* Now set all file attributes */
-    if (RT_SUCCESS(rc))
-    {
-        uint32_t mode;
-        rc = RTTarFileGetMode(hFile, &mode);
-        if (RT_SUCCESS(rc))
-        {
-            mode |= RTFS_TYPE_FILE; /* For now we support regular files only */
-            /* Set the mode */
-            rc = RTFileSetMode(hNewFile, mode);
-        }
-    }
-
-    RTFileClose(hNewFile);
-
-    /* Delete the freshly created file in the case of an error */
-    if (RT_FAILURE(rc))
-        RTFileDelete(pszTargetName);
-
-    return rc;
-}
-
-static int rtTarAppendFileFromFile(RTTAR hTar, const char *pszSrcName, const uint64_t cbOverallSize, uint64_t &cbOverallWritten, PFNRTPROGRESS pfnProgressCallback, void *pvUser)
-{
-    /* Open the source file */
-    RTFILE hOldFile;
-    int rc = RTFileOpen(&hOldFile, pszSrcName, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_WRITE);
-    if (RT_FAILURE(rc))
-        return rc;
-
-    RTTARFILE hFile = NIL_RTTARFILE;
-    void *pvTmp = NULL;
-    do
-    {
-        /* Get the size of the source file */
-        uint64_t cbToCopy;
-        rc = RTFileGetSize(hOldFile, &cbToCopy);
-        if (RT_FAILURE(rc))
-            break;
-
-        rc = RTTarFileOpen(hTar, &hFile, RTPathFilename(pszSrcName), RTFILE_O_OPEN | RTFILE_O_WRITE);
-        if (RT_FAILURE(rc))
-            break;
-
-        /* Get some info from the source file */
-        RTFSOBJINFO info;
-        RTUID uid = 0;
-        RTGID gid = 0;
-        RTFMODE fmode = 0600; /* Make some save default */
-        int64_t mtime = 0;
-
-        /* This isn't critical. Use the defaults if it fails. */
-        rc = RTFileQueryInfo(hOldFile, &info, RTFSOBJATTRADD_UNIX);
-        if (RT_SUCCESS(rc))
-        {
-            fmode = info.Attr.fMode & RTFS_UNIX_MASK;
-            uid = info.Attr.u.Unix.uid;
-            gid = info.Attr.u.Unix.gid;
-            mtime = RTTimeSpecGetSeconds(&info.ModificationTime);
-        }
-
-        /* Set the mode from the other file */
-        rc = RTTarFileSetMode(hFile, fmode);
-        if (RT_FAILURE(rc))
-            break;
-
-        /* Set the modification time from the other file */
-        RTTIMESPEC time;
-        RTTimeSpecSetSeconds(&time, mtime);
-        rc = RTTarFileSetTime(hFile, &time);
-        if (RT_FAILURE(rc))
-            break;
-
-        /* Set the owner from the other file */
-        rc = RTTarFileSetOwner(hFile, uid, gid);
-        if (RT_FAILURE(rc))
-            break;
-
-        /* Allocate a temporary buffer for copying the tar content in blocks. */
-        size_t cbTmp = 0;
-        pvTmp = rtTarMemTmpAlloc(&cbTmp);
-        if (!pvTmp)
-        {
-            rc = VERR_NO_MEMORY;
-            break;
-        }
-
-        /* Copy the content from pszSrcName over to hFile. This is done block
-         * wise in 512 byte steps. After this copying is finished hFile will be
-         * on a 512 byte boundary, regardless if the file copied is 512 byte
-         * size aligned. */
-        uint64_t cbAllWritten = 0; /* Already copied */
-        uint64_t cbRead       = 0; /* Actually read in the last step */
-        for (;;)
-        {
-            if (pfnProgressCallback)
-                pfnProgressCallback((unsigned)(100.0 / cbOverallSize * cbOverallWritten), pvUser);
-            if (cbAllWritten >= cbToCopy)
-                break;
-
-            /* Read one block. Either its the buffer size or the rest of the
-             * file. */
-            cbRead = RT_MIN(cbToCopy - cbAllWritten, cbTmp);
-            rc = RTFileRead(hOldFile, pvTmp, cbRead, NULL);
-            if (RT_FAILURE(rc))
-                break;
-
-            /* Write one block. */
-            rc = RTTarFileWriteAt(hFile, cbAllWritten, pvTmp, cbRead, NULL);
-            if (RT_FAILURE(rc))
-                break;
-
-            /* Count how many bytes (of the original file) are written already */
-            cbAllWritten += cbRead;
-            cbOverallWritten += cbRead;
-        }
-    } while (0);
-
-    /* Cleanup */
-    if (pvTmp)
-        RTMemTmpFree(pvTmp);
-
-    if (hFile)
-        RTTarFileClose(hFile);
-
-    RTFileClose(hOldFile);
-
-    return rc;
-}
-
-static int rtTarSkipData(RTFILE hFile, PRTTARRECORD pRecord)
-{
-    int rc = VINF_SUCCESS;
-    /* Seek over the data parts (512 bytes aligned) */
-    int64_t offSeek = RT_ALIGN(rtTarRecToSize(pRecord), sizeof(RTTARRECORD));
-    if (offSeek > 0)
-        rc = RTFileSeek(hFile, offSeek, RTFILE_SEEK_CURRENT, NULL);
-    return rc;
-}
-
-static int rtTarFindFile(RTFILE hFile, const char *pszFile, uint64_t *poff, uint64_t *pcbSize)
-{
-    /* Assume we are on the file head. */
-    int         rc      = VINF_SUCCESS;
-    bool        fFound  = false;
-    RTTARRECORD record;
-    for (;;)
-    {
-        /* Read & verify a header record */
-        rc = rtTarReadHeaderRecord(hFile, &record);
-        /* Check for error or EOF. */
-        if (RT_FAILURE(rc))
-            break;
-
-        /* We support normal files only */
-        if (   record.h.linkflag == LF_OLDNORMAL
-            || record.h.linkflag == LF_NORMAL)
-        {
-            if (!RTStrCmp(record.h.name, pszFile))
-            {
-                /* Get the file size */
-                *pcbSize = rtTarRecToSize(&record);
-                /* Seek back, to position the file pointer at the start of the header. */
-                rc = RTFileSeek(hFile, -(int64_t)sizeof(RTTARRECORD), RTFILE_SEEK_CURRENT, poff);
-                fFound = true;
-                break;
-            }
-        }
-        rc = rtTarSkipData(hFile, &record);
-        if (RT_FAILURE(rc))
-            break;
-    }
-
-    if (rc == VERR_TAR_END_OF_FILE)
-        rc = VINF_SUCCESS;
-
-    /* Something found? */
-    if (    RT_SUCCESS(rc)
-        &&  !fFound)
-        rc = VERR_FILE_NOT_FOUND;
-
-    return rc;
-}
-
-#ifdef SOME_UNUSED_FUNCTION
-static int rtTarGetFilesOverallSize(RTFILE hFile, const char * const *papszFiles, size_t cFiles, uint64_t *pcbOverallSize)
-{
-    int rc = VINF_SUCCESS;
-    size_t cFound = 0;
-    RTTARRECORD record;
-    for (;;)
-    {
-        /* Read & verify a header record */
-        rc = rtTarReadHeaderRecord(hFile, &record);
-        /* Check for error or EOF. */
-        if (RT_FAILURE(rc))
-            break;
-
-        /* We support normal files only */
-        if (   record.h.linkflag == LF_OLDNORMAL
-            || record.h.linkflag == LF_NORMAL)
-        {
-            for (size_t i = 0; i < cFiles; ++i)
-            {
-                if (!RTStrCmp(record.h.name, papszFiles[i]))
-                {
-                    /* Sum up the overall size */
-                    *pcbOverallSize += rtTarRecToSize(&record);
-                    ++cFound;
-                    break;
-                }
-            }
-            if (   cFound == cFiles
-                || RT_FAILURE(rc))
-                break;
-        }
-        rc = rtTarSkipData(hFile, &record);
-        if (RT_FAILURE(rc))
-            break;
-    }
-    if (rc == VERR_TAR_END_OF_FILE)
-        rc = VINF_SUCCESS;
-
-    /* Make sure the file pointer is at the begin of the file again. */
-    if (RT_SUCCESS(rc))
-        rc = RTFileSeek(hFile, 0, RTFILE_SEEK_BEGIN, 0);
-    return rc;
-}
-#endif /* SOME_UNUSED_FUNCTION */
-
-/******************************************************************************
- *   Public Functions                                                         *
- ******************************************************************************/
-
-RTR3DECL(int) RTTarOpen(PRTTAR phTar, const char *pszTarname, uint32_t fMode, bool fStream)
-{
-    /*
-     * Create a tar instance.
-     */
-    PRTTARINTERNAL pThis = (PRTTARINTERNAL)RTMemAllocZ(sizeof(RTTARINTERNAL));
-    if (!pThis)
-        return VERR_NO_MEMORY;
-
-    pThis->u32Magic    = RTTAR_MAGIC;
-    pThis->fOpenMode   = fMode;
-    pThis->fStreamMode = fStream && (fMode & RTFILE_O_READ);
-
-    /*
-     * Open the tar file.
-     */
-    int rc = RTFileOpen(&pThis->hTarFile, pszTarname, fMode);
-    if (RT_SUCCESS(rc))
-    {
-        *phTar = pThis;
-        return VINF_SUCCESS;
-    }
-
-    RTMemFree(pThis);
-    return rc;
-}
-
-RTR3DECL(int) RTTarClose(RTTAR hTar)
-{
-    if (hTar == NIL_RTTAR)
-        return VINF_SUCCESS;
-
-    PRTTARINTERNAL pInt = hTar;
-    RTTAR_VALID_RETURN(pInt);
-
-    int rc = VINF_SUCCESS;
-
-    /* gtar gives a warning, but the documentation says EOF is indicated by a
-     * zero block. Disabled for now. */
-#if 0
-    {
-        /* Append the EOF record which is filled all by zeros */
-        RTTARRECORD record;
-        RT_ZERO(record);
-        rc = RTFileWrite(pInt->hTarFile, &record, sizeof(record), NULL);
-    }
-#endif
-
-    if (pInt->hTarFile != NIL_RTFILE)
-        rc = RTFileClose(pInt->hTarFile);
-
-    /* Delete any remaining cached file headers. */
-    if (pInt->pFileCache)
-    {
-        rtDeleteTarFileInternal(pInt->pFileCache);
-        pInt->pFileCache = NULL;
-    }
-
-    pInt->u32Magic = RTTAR_MAGIC_DEAD;
-
-    RTMemFree(pInt);
-
-    return rc;
-}
-
-RTR3DECL(int) RTTarFileOpen(RTTAR hTar, PRTTARFILE phFile, const char *pszFilename, uint32_t fOpen)
-{
-    AssertReturn((fOpen & RTFILE_O_READ) || (fOpen & RTFILE_O_WRITE), VERR_INVALID_PARAMETER);
-
-    PRTTARINTERNAL pInt = hTar;
-    RTTAR_VALID_RETURN(pInt);
-
-    if (!pInt->hTarFile)
-        return VERR_INVALID_HANDLE;
-
-    if (pInt->fStreamMode)
-        return VERR_INVALID_STATE;
-
-    if (fOpen & RTFILE_O_WRITE)
-    {
-        if (!(pInt->fOpenMode & RTFILE_O_WRITE))
-            return VERR_WRITE_PROTECT;
-        if (pInt->fFileOpenForWrite)
-            return VERR_TOO_MANY_OPEN_FILES;
-    }
-
-    PRTTARFILEINTERNAL pFileInt = rtCreateTarFileInternal(pInt, pszFilename, fOpen);
-    if (!pFileInt)
-        return VERR_NO_MEMORY;
-
-    int rc = VINF_SUCCESS;
-    do /* break loop */
-    {
-        if (pFileInt->fOpenMode & RTFILE_O_WRITE)
-        {
-            pInt->fFileOpenForWrite = true;
-
-            /* If we are in write mode, we also in append mode. Add an dummy
-             * header at the end of the current file. It will be filled by the
-             * close operation. */
-            rc = RTFileSeek(pFileInt->pTar->hTarFile, 0, RTFILE_SEEK_END, &pFileInt->offStart);
-            if (RT_FAILURE(rc))
-                break;
-            RTTARRECORD record;
-            RT_ZERO(record);
-            rc = RTFileWrite(pFileInt->pTar->hTarFile, &record, sizeof(RTTARRECORD), NULL);
-            if (RT_FAILURE(rc))
-                break;
-        }
-        else if (pFileInt->fOpenMode & RTFILE_O_READ)
-        {
-            /* We need to be on the start of the file */
-            rc = RTFileSeek(pFileInt->pTar->hTarFile, 0, RTFILE_SEEK_BEGIN, NULL);
-            if (RT_FAILURE(rc))
-                break;
-
-            /* Search for the file. */
-            rc = rtTarFindFile(pFileInt->pTar->hTarFile, pszFilename, &pFileInt->offStart, &pFileInt->cbSize);
-            if (RT_FAILURE(rc))
-                break;
-        }
-        else
-        {
-            /** @todo is something missing here? */
-        }
-
-    } while (0);
-
-    /* Cleanup on failure */
-    if (RT_FAILURE(rc))
-    {
-        if (pFileInt->pszFilename)
-            RTStrFree(pFileInt->pszFilename);
-        RTMemFree(pFileInt);
-    }
-    else
-        *phFile = (RTTARFILE)pFileInt;
-
-    return rc;
-}
-
-RTR3DECL(int) RTTarFileClose(RTTARFILE hFile)
-{
-    /* Already closed? */
-    if (hFile == NIL_RTTARFILE)
-        return VINF_SUCCESS;
-
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    int rc = VINF_SUCCESS;
-
-    /* In write mode: */
-    if (pFileInt->fOpenMode & RTFILE_O_READ)
-    {
-        /* In read mode, we want to make sure to stay at the aligned end of this
-         * file, so the next file could be read immediately. */
-        uint64_t offCur = RTFileTell(pFileInt->pTar->hTarFile);
-
-        /* Check that the file pointer is somewhere within the last open file.
-         * If we are at the beginning (nothing read yet) nothing will be done.
-         * A user could open/close a file more than once, without reading
-         * something. */
-        if (   pFileInt->offStart + sizeof(RTTARRECORD) < offCur
-            && offCur < RT_ALIGN(pFileInt->offStart + sizeof(RTTARRECORD) + pFileInt->cbSize, sizeof(RTTARRECORD)))
-        {
-            /* Seek to the next file header. */
-            uint64_t offNext = RT_ALIGN(pFileInt->offStart + sizeof(RTTARRECORD) + pFileInt->cbSize, sizeof(RTTARRECORD));
-            rc = RTFileSeek(pFileInt->pTar->hTarFile, offNext - offCur, RTFILE_SEEK_CURRENT, NULL);
-        }
-    }
-    else if (pFileInt->fOpenMode & RTFILE_O_WRITE)
-    {
-        pFileInt->pTar->fFileOpenForWrite = false;
-        do
-        {
-            /* If the user has called RTTarFileSetSize in the meantime, we have
-               to make sure the file has the right size. */
-            if (pFileInt->cbSetSize > pFileInt->cbSize)
-            {
-                rc = rtTarAppendZeros(hFile, pFileInt->cbSetSize - pFileInt->cbSize);
-                if (RT_FAILURE(rc))
-                    break;
-            }
-
-            /* If the written size isn't 512 byte aligned, we need to fix this. */
-            RTTARRECORD record;
-            RT_ZERO(record);
-            uint64_t cbSizeAligned = RT_ALIGN(pFileInt->cbSize, sizeof(RTTARRECORD));
-            if (cbSizeAligned != pFileInt->cbSize)
-            {
-                /* Note the RTFile method. We didn't increase the cbSize or cbCurrentPos here. */
-                rc = RTFileWriteAt(pFileInt->pTar->hTarFile,
-                                   pFileInt->offStart + sizeof(RTTARRECORD) + pFileInt->cbSize,
-                                   &record,
-                                   cbSizeAligned - pFileInt->cbSize,
-                                   NULL);
-                if (RT_FAILURE(rc))
-                    break;
-            }
-
-            /* Create a header record for the file */
-            /* Todo: mode, gid, uid, mtime should be setable (or detected myself) */
-            RTTIMESPEC time;
-            RTTimeNow(&time);
-            rc = rtTarCreateHeaderRecord(&record, pFileInt->pszFilename, pFileInt->cbSize,
-                                         0, 0, 0600, RTTimeSpecGetSeconds(&time));
-            if (RT_FAILURE(rc))
-                break;
-
-            /* Write this at the start of the file data */
-            rc = RTFileWriteAt(pFileInt->pTar->hTarFile, pFileInt->offStart, &record, sizeof(RTTARRECORD), NULL);
-            if (RT_FAILURE(rc))
-                break;
-        }
-        while(0);
-    }
-
-    /* Now cleanup and delete the handle */
-    rtDeleteTarFileInternal(pFileInt);
-
-    return rc;
-}
-
-RTR3DECL(int) RTTarFileSeek(RTTARFILE hFile, uint64_t offSeek, unsigned uMethod, uint64_t *poffActual)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    if (pFileInt->pTar->fStreamMode)
-        return VERR_INVALID_STATE;
-
-    switch (uMethod)
-    {
-        case RTFILE_SEEK_BEGIN:
-        {
-            if (offSeek > pFileInt->cbSize)
-                return VERR_SEEK_ON_DEVICE;
-            pFileInt->offCurrent = offSeek;
-            break;
-        }
-        case RTFILE_SEEK_CURRENT:
-        {
-            if (pFileInt->offCurrent + offSeek > pFileInt->cbSize)
-                return VERR_SEEK_ON_DEVICE;
-            pFileInt->offCurrent += offSeek;
-            break;
-        }
-        case RTFILE_SEEK_END:
-        {
-            if ((int64_t)pFileInt->cbSize - (int64_t)offSeek < 0)
-                return VERR_NEGATIVE_SEEK;
-            pFileInt->offCurrent = pFileInt->cbSize - offSeek;
-            break;
-        }
-        default: AssertFailedReturn(VERR_INVALID_PARAMETER);
-    }
-
-    if (poffActual)
-        *poffActual = pFileInt->offCurrent;
-
-    return VINF_SUCCESS;
-}
-
-RTR3DECL(uint64_t) RTTarFileTell(RTTARFILE hFile)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN_RC(pFileInt, UINT64_MAX);
-
-    return pFileInt->offCurrent;
-}
-
-RTR3DECL(int) RTTarFileRead(RTTARFILE hFile, void *pvBuf, size_t cbToRead, size_t *pcbRead)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    /* Todo: optimize this, by checking the current pos */
-    return RTTarFileReadAt(hFile, pFileInt->offCurrent, pvBuf, cbToRead, pcbRead);
-}
-
-RTR3DECL(int) RTTarFileReadAt(RTTARFILE hFile, uint64_t off, void *pvBuf, size_t cbToRead, size_t *pcbRead)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    /* Check that we not read behind the end of file. If so return immediately. */
-    if (off > pFileInt->cbSize)
-    {
-        if (pcbRead)
-            *pcbRead = 0;
-        return VINF_SUCCESS; /* ??? VERR_EOF */
-    }
-
-    size_t cbToCopy = RT_MIN(pFileInt->cbSize - off, cbToRead);
-    size_t cbTmpRead = 0;
-    int rc = RTFileReadAt(pFileInt->pTar->hTarFile, pFileInt->offStart + 512 + off, pvBuf, cbToCopy, &cbTmpRead);
-    pFileInt->offCurrent = off + cbTmpRead;
-    if (pcbRead)
-        *pcbRead = cbTmpRead;
-
-    return rc;
-}
-
-RTR3DECL(int) RTTarFileWrite(RTTARFILE hFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    /** @todo Optimize this, by checking the current pos */
-    return RTTarFileWriteAt(hFile, pFileInt->offCurrent, pvBuf, cbToWrite, pcbWritten);
-}
-
-RTR3DECL(int) RTTarFileWriteAt(RTTARFILE hFile, uint64_t off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    if ((pFileInt->fOpenMode & RTFILE_O_WRITE) != RTFILE_O_WRITE)
-        return VERR_WRITE_ERROR;
-
-    size_t cbTmpWritten = 0;
-    int rc = RTFileWriteAt(pFileInt->pTar->hTarFile, pFileInt->offStart + 512 + off, pvBuf, cbToWrite, &cbTmpWritten);
-    pFileInt->cbSize += cbTmpWritten;
-    pFileInt->offCurrent = off + cbTmpWritten;
-    if (pcbWritten)
-        *pcbWritten = cbTmpWritten;
-
-    return rc;
-}
-
-RTR3DECL(int) RTTarFileGetSize(RTTARFILE hFile, uint64_t *pcbSize)
-{
-    /* Validate input */
-    AssertPtrReturn(pcbSize, VERR_INVALID_POINTER);
-
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    *pcbSize = RT_MAX(pFileInt->cbSetSize, pFileInt->cbSize);
-
-    return VINF_SUCCESS;
-}
-
-RTR3DECL(int) RTTarFileSetSize(RTTARFILE hFile, uint64_t cbSize)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    if ((pFileInt->fOpenMode & RTFILE_O_WRITE) != RTFILE_O_WRITE)
-        return VERR_WRITE_ERROR;
-
-    /** @todo If cbSize is smaller than pFileInt->cbSize we have to
-     * truncate the current file. */
-    pFileInt->cbSetSize = cbSize;
-
-    return VINF_SUCCESS;
-}
-
-RTR3DECL(int) RTTarFileGetMode(RTTARFILE hFile, uint32_t *pfMode)
-{
-    /* Validate input */
-    AssertPtrReturn(pfMode, VERR_INVALID_POINTER);
-
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    /* Read the mode out of the header entry */
-    char szMode[RT_SIZEOFMEMB(RTTARRECORD, h.mode)+1];
-    int rc = RTFileReadAt(pFileInt->pTar->hTarFile,
-                          pFileInt->offStart + RT_OFFSETOF(RTTARRECORD, h.mode),
-                          szMode,
-                          RT_SIZEOFMEMB(RTTARRECORD, h.mode),
-                          NULL);
-    if (RT_FAILURE(rc))
-        return rc;
-    szMode[sizeof(szMode) - 1] = '\0';
-
-    /* Convert it to an integer */
-    return RTStrToUInt32Full(szMode, 8, pfMode);
-}
-
-RTR3DECL(int) RTTarFileSetMode(RTTARFILE hFile, uint32_t fMode)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    if ((pFileInt->fOpenMode & RTFILE_O_WRITE) != RTFILE_O_WRITE)
-        return VERR_WRITE_ERROR;
-
-    /* Convert the mode to an string. */
-    char szMode[RT_SIZEOFMEMB(RTTARRECORD, h.mode)];
-    RTStrPrintf(szMode, sizeof(szMode), "%0.7o", fMode);
-
-    /* Write it directly into the header */
-    return RTFileWriteAt(pFileInt->pTar->hTarFile,
-                         pFileInt->offStart + RT_OFFSETOF(RTTARRECORD, h.mode),
-                         szMode,
-                         RT_SIZEOFMEMB(RTTARRECORD, h.mode),
-                         NULL);
-}
-
-RTR3DECL(int) RTTarFileGetTime(RTTARFILE hFile, PRTTIMESPEC pTime)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    /* Read the time out of the header entry */
-    char szModTime[RT_SIZEOFMEMB(RTTARRECORD, h.mtime) + 1];
-    int rc = RTFileReadAt(pFileInt->pTar->hTarFile,
-                          pFileInt->offStart + RT_OFFSETOF(RTTARRECORD, h.mtime),
-                          szModTime,
-                          RT_SIZEOFMEMB(RTTARRECORD, h.mtime),
-                          NULL);
-    if (RT_FAILURE(rc))
-        return rc;
-    szModTime[sizeof(szModTime) - 1] = '\0';
-
-    /* Convert it to an integer */
-    int64_t cSeconds;
-    rc = RTStrToInt64Full(szModTime, 12, &cSeconds);
-
-    /* And back to our time structure */
-    if (RT_SUCCESS(rc))
-        RTTimeSpecSetSeconds(pTime, cSeconds);
-
-    return rc;
-}
-
-RTR3DECL(int) RTTarFileSetTime(RTTARFILE hFile, PRTTIMESPEC pTime)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    if ((pFileInt->fOpenMode & RTFILE_O_WRITE) != RTFILE_O_WRITE)
-        return VERR_WRITE_ERROR;
-
-    /* Convert the time to an string. */
-    char szModTime[RT_SIZEOFMEMB(RTTARRECORD, h.mtime)];
-    RTStrPrintf(szModTime, sizeof(szModTime), "%0.11llo", RTTimeSpecGetSeconds(pTime));
-
-    /* Write it directly into the header */
-    return RTFileWriteAt(pFileInt->pTar->hTarFile,
-                         pFileInt->offStart + RT_OFFSETOF(RTTARRECORD, h.mtime),
-                         szModTime,
-                         RT_SIZEOFMEMB(RTTARRECORD, h.mtime),
-                         NULL);
-}
-
-RTR3DECL(int) RTTarFileGetOwner(RTTARFILE hFile, uint32_t *pUid, uint32_t *pGid)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    /* Read the uid and gid out of the header entry */
-    AssertCompileAdjacentMembers(RTTARRECORD, h.uid, h.gid);
-    char szUidGid[RT_SIZEOFMEMB(RTTARRECORD, h.uid) + RT_SIZEOFMEMB(RTTARRECORD, h.gid) + 1];
-    int rc = RTFileReadAt(pFileInt->pTar->hTarFile,
-                          pFileInt->offStart + RT_OFFSETOF(RTTARRECORD, h.uid),
-                          szUidGid,
-                          sizeof(szUidGid) - 1,
-                          NULL);
-    if (RT_FAILURE(rc))
-        return rc;
-    szUidGid[sizeof(szUidGid) - 1] = '\0';
-
-    /* Convert it to integer */
-    rc = RTStrToUInt32Full(&szUidGid[RT_SIZEOFMEMB(RTTARRECORD, h.uid)], 8, pGid);
-    if (RT_SUCCESS(rc))
-    {
-        szUidGid[RT_SIZEOFMEMB(RTTARRECORD, h.uid)] = '\0';
-        rc = RTStrToUInt32Full(szUidGid, 8, pUid);
-    }
-    return rc;
-}
-
-RTR3DECL(int) RTTarFileSetOwner(RTTARFILE hFile, uint32_t uid, uint32_t gid)
-{
-    PRTTARFILEINTERNAL pFileInt = hFile;
-    RTTARFILE_VALID_RETURN(pFileInt);
-
-    if ((pFileInt->fOpenMode & RTFILE_O_WRITE) != RTFILE_O_WRITE)
-        return VERR_WRITE_ERROR;
-    AssertReturn(uid == (uint32_t)-1 || uid <= 07777777, VERR_OUT_OF_RANGE);
-    AssertReturn(gid == (uint32_t)-1 || gid <= 07777777, VERR_OUT_OF_RANGE);
-
-    int rc = VINF_SUCCESS;
-
-    if (uid != (uint32_t)-1)
-    {
-        /* Convert the uid to an string. */
-        char szUid[RT_SIZEOFMEMB(RTTARRECORD, h.uid)];
-        RTStrPrintf(szUid, sizeof(szUid), "%0.7o", uid);
-
-        /* Write it directly into the header */
-        rc = RTFileWriteAt(pFileInt->pTar->hTarFile,
-                           pFileInt->offStart + RT_OFFSETOF(RTTARRECORD, h.uid),
-                           szUid,
-                           RT_SIZEOFMEMB(RTTARRECORD, h.uid),
-                           NULL);
-        if (RT_FAILURE(rc))
-            return rc;
-    }
-
-    if (gid != (uint32_t)-1)
-    {
-        /* Convert the gid to an string. */
-        char szGid[RT_SIZEOFMEMB(RTTARRECORD, h.gid)];
-        RTStrPrintf(szGid, sizeof(szGid), "%0.7o", gid);
-
-        /* Write it directly into the header */
-        rc = RTFileWriteAt(pFileInt->pTar->hTarFile,
-                           pFileInt->offStart + RT_OFFSETOF(RTTARRECORD, h.gid),
-                           szGid,
-                           RT_SIZEOFMEMB(RTTARRECORD, h.gid),
-                           NULL);
-        if (RT_FAILURE(rc))
-            return rc;
-    }
-
-    return rc;
-}
-
-/******************************************************************************
- *   Convenience Functions                                                    *
- ******************************************************************************/
-
-RTR3DECL(int) RTTarFileExists(const char *pszTarFile, const char *pszFile)
-{
-    /* Validate input */
-    AssertPtrReturn(pszTarFile, VERR_INVALID_POINTER);
-    AssertPtrReturn(pszFile, VERR_INVALID_POINTER);
-
-    /* Open the tar file */
-    RTTAR hTar;
-    int rc = RTTarOpen(&hTar, pszTarFile, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, false /*fStream*/);
-    if (RT_FAILURE(rc))
-        return rc;
-
-    /* Just try to open that file readonly. If this succeed the file exists. */
-    RTTARFILE hFile;
-    rc = RTTarFileOpen(hTar, &hFile, pszFile, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE);
-    if (RT_SUCCESS(rc))
-        RTTarFileClose(hFile);
-
-    RTTarClose(hTar);
-
-    return rc;
-}
-
-RTR3DECL(int) RTTarList(const char *pszTarFile, char ***ppapszFiles, size_t *pcFiles)
-{
-    /* Validate input */
-    AssertPtrReturn(pszTarFile, VERR_INVALID_POINTER);
-    AssertPtrReturn(ppapszFiles, VERR_INVALID_POINTER);
-    AssertPtrReturn(pcFiles, VERR_INVALID_POINTER);
-
-    /* Open the tar file */
-    RTTAR hTar;
-    int rc = RTTarOpen(&hTar, pszTarFile, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, false /*fStream*/);
-    if (RT_FAILURE(rc))
-        return rc;
-
-    /* This is done by internal methods, cause we didn't have a RTTARDIR
-     * interface, yet. This should be fixed someday. */
-
-    PRTTARINTERNAL pInt = hTar;
-    char **papszFiles = NULL;
-    size_t cFiles = 0;
-    do /* break loop */
-    {
-        /* Initialize the file name array with one slot */
-        size_t cFilesAlloc = 1;
-        papszFiles = (char **)RTMemAlloc(sizeof(char *));
-        if (!papszFiles)
-        {
-            rc = VERR_NO_MEMORY;
-            break;
-        }
+            /* If the written size isn't 512 byte aligned, we need to fix this. */
+            RTTARRECORD record;
+            RT_ZERO(record);
+            uint64_t cbSizeAligned = RT_ALIGN(pFileInt->cbSize, sizeof(RTTARRECORD));
+            if (cbSizeAligned != pFileInt->cbSize)
+            {
+                /* Note the RTFile method. We didn't increase the cbSize or cbCurrentPos here. */
+                rc = RTFileWriteAt(pFileInt->pTar->hTarFile,
+                                   pFileInt->offStart + sizeof(RTTARRECORD) + pFileInt->cbSize,
+                                   &record,
+                                   cbSizeAligned - pFileInt->cbSize,
+                                   NULL);
+                if (RT_FAILURE(rc))
+                    break;
+            }
 
-        /* Iterate through the tar file record by record. Skip data records as we
-         * didn't need them. */
-        RTTARRECORD record;
-        for (;;)
-        {
-            /* Read & verify a header record */
-            rc = rtTarReadHeaderRecord(pInt->hTarFile, &record);
-            /* Check for error or EOF. */
+            /* Create a header record for the file */
+            /* Todo: mode, gid, uid, mtime should be setable (or detected myself) */
+            RTTIMESPEC time;
+            RTTimeNow(&time);
+            rc = rtTarCreateHeaderRecord(&record, pFileInt->pszFilename, pFileInt->cbSize,
+                                         0, 0, 0600, RTTimeSpecGetSeconds(&time));
             if (RT_FAILURE(rc))
                 break;
-            /* We support normal files only */
-            if (   record.h.linkflag == LF_OLDNORMAL
-                || record.h.linkflag == LF_NORMAL)
-            {
-                if (cFiles >= cFilesAlloc)
-                {
-                    /* Double the array size, make sure the size doesn't wrap. */
-                    void  *pvNew = NULL;
-                    size_t cbNew = cFilesAlloc * sizeof(char *) * 2;
-                    if (cbNew / sizeof(char *) / 2 == cFilesAlloc)
-                        pvNew = RTMemRealloc(papszFiles, cbNew);
-                    if (!pvNew)
-                    {
-                        rc = VERR_NO_MEMORY;
-                        break;
-                    }
-                    papszFiles = (char **)pvNew;
-                    cFilesAlloc *= 2;
-                }
 
-                /* Duplicate the name */
-                papszFiles[cFiles] = RTStrDup(record.h.name);
-                if (!papszFiles[cFiles])
-                {
-                    rc = VERR_NO_MEMORY;
-                    break;
-                }
-                cFiles++;
-            }
-            rc = rtTarSkipData(pInt->hTarFile, &record);
+            /* Write this at the start of the file data */
+            rc = RTFileWriteAt(pFileInt->pTar->hTarFile, pFileInt->offStart, &record, sizeof(RTTARRECORD), NULL);
             if (RT_FAILURE(rc))
                 break;
         }
-    } while(0);
-
-    if (rc == VERR_TAR_END_OF_FILE)
-        rc = VINF_SUCCESS;
-
-    /* Return the file array on success, dispose of it on failure. */
-    if (RT_SUCCESS(rc))
-    {
-        *pcFiles = cFiles;
-        *ppapszFiles = papszFiles;
+        while (0);
     }
-    else
-    {
-        while (cFiles-- > 0)
-            RTStrFree(papszFiles[cFiles]);
-        RTMemFree(papszFiles);
-    }
-
-    RTTarClose(hTar);
 
-    return rc;
-}
-
-RTR3DECL(int) RTTarExtractFileToBuf(const char *pszTarFile, void **ppvBuf, size_t *pcbSize, const char *pszFile,
-                                    PFNRTPROGRESS pfnProgressCallback, void *pvUser)
-{
     /*
-     * Validate input
+     * Now cleanup and delete the handle.
      */
-    AssertPtrReturn(pszTarFile, VERR_INVALID_POINTER);
-    AssertPtrReturn(ppvBuf, VERR_INVALID_POINTER);
-    AssertPtrReturn(pcbSize, VERR_INVALID_POINTER);
-    AssertPtrReturn(pszFile, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(pfnProgressCallback, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(pvUser, VERR_INVALID_POINTER);
-
-    /** @todo progress bar - is this TODO still valid? */
-
-    int         rc      = VINF_SUCCESS;
-    RTTAR       hTar    = NIL_RTTAR;
-    RTTARFILE   hFile   = NIL_RTTARFILE;
-    char       *pvTmp   = NULL;
-    uint64_t    cbToCopy= 0;
-    do /* break loop */
-    {
-        rc = RTTarOpen(&hTar, pszTarFile, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, false /*fStream*/);
-        if (RT_FAILURE(rc))
-            break;
-        rc = RTTarFileOpen(hTar, &hFile, pszFile, RTFILE_O_OPEN | RTFILE_O_READ);
-        if (RT_FAILURE(rc))
-            break;
-        rc = RTTarFileGetSize(hFile, &cbToCopy);
-        if (RT_FAILURE(rc))
-            break;
-
-        /* Allocate the memory for the file content. */
-        pvTmp = (char *)RTMemAlloc(cbToCopy);
-        if (!pvTmp)
-        {
-            rc = VERR_NO_MEMORY;
-            break;
-        }
-        size_t cbRead = 0;
-        size_t cbAllRead = 0;
-        for (;;)
-        {
-            if (pfnProgressCallback)
-                pfnProgressCallback((unsigned)(100.0 / cbToCopy * cbAllRead), pvUser);
-            if (cbAllRead == cbToCopy)
-                break;
-            rc = RTTarFileReadAt(hFile, 0, &pvTmp[cbAllRead], cbToCopy - cbAllRead, &cbRead);
-            if (RT_FAILURE(rc))
-                break;
-            cbAllRead += cbRead;
-        }
-    } while (0);
-
-    /* Set output values on success */
-    if (RT_SUCCESS(rc))
+    if (pFileInt->pszFilename)
+        RTStrFree(pFileInt->pszFilename);
+    if (pFileInt->hVfsIos != NIL_RTVFSIOSTREAM)
     {
-        *pcbSize = cbToCopy;
-        *ppvBuf = pvTmp;
+        RTVfsIoStrmRelease(pFileInt->hVfsIos);
+        pFileInt->hVfsIos = NIL_RTVFSIOSTREAM;
     }
-
-    /* Cleanup */
-    if (   RT_FAILURE(rc)
-        && pvTmp)
-        RTMemFree(pvTmp);
-    if (hFile)
-        RTTarFileClose(hFile);
-    if (hTar)
-        RTTarClose(hTar);
+    pFileInt->u32Magic = RTTARFILE_MAGIC_DEAD;
+    RTMemFree(pFileInt);
 
     return rc;
 }
 
-RTR3DECL(int) RTTarExtractFiles(const char *pszTarFile, const char *pszOutputDir, const char * const *papszFiles,
-                                size_t cFiles, PFNRTPROGRESS pfnProgressCallback, void *pvUser)
-{
-    /* Validate input */
-    AssertPtrReturn(pszTarFile, VERR_INVALID_POINTER);
-    AssertPtrReturn(pszOutputDir, VERR_INVALID_POINTER);
-    AssertPtrReturn(papszFiles, VERR_INVALID_POINTER);
-    AssertReturn(cFiles, VERR_INVALID_PARAMETER);
-    AssertPtrNullReturn(pfnProgressCallback, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(pvUser, VERR_INVALID_POINTER);
-
-    /* Open the tar file */
-    RTTAR hTar;
-    int rc = RTTarOpen(&hTar, pszTarFile, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, false /*fStream*/);
-    if (RT_FAILURE(rc))
-        return rc;
-
-    do /* break loop */
-    {
-        /* Get the overall size of all files to extract out of the tar archive
-           headers. Only necessary if there is a progress callback. */
-        uint64_t cbOverallSize = 0;
-        if (pfnProgressCallback)
-        {
-//            rc = rtTarGetFilesOverallSize(hFile, papszFiles, cFiles, &cbOverallSize);
-//            if (RT_FAILURE(rc))
-//                break;
-        }
-
-        uint64_t cbOverallWritten = 0;
-        for (size_t i = 0; i < cFiles; ++i)
-        {
-            RTTARFILE hFile;
-            rc = RTTarFileOpen(hTar, &hFile, papszFiles[i], RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE);
-            if (RT_FAILURE(rc))
-                break;
-            char *pszTargetFile = RTPathJoinA(pszOutputDir, papszFiles[i]);
-            if (pszTargetFile)
-                rc = rtTarExtractFileToFile(hFile, pszTargetFile, cbOverallSize, cbOverallWritten, pfnProgressCallback, pvUser);
-            else
-                rc = VERR_NO_STR_MEMORY;
-            RTStrFree(pszTargetFile);
-            RTTarFileClose(hFile);
-            if (RT_FAILURE(rc))
-                break;
-        }
-    } while (0);
-
-    RTTarClose(hTar);
-
-    return rc;
-}
 
-RTR3DECL(int) RTTarExtractAll(const char *pszTarFile, const char *pszOutputDir, PFNRTPROGRESS pfnProgressCallback, void *pvUser)
+RTR3DECL(int) RTTarFileReadAt(RTTARFILE hFile, uint64_t off, void *pvBuf, size_t cbToRead, size_t *pcbRead)
 {
-    /* Validate input */
-    AssertPtrReturn(pszTarFile, VERR_INVALID_POINTER);
-    AssertPtrReturn(pszOutputDir, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(pfnProgressCallback, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(pvUser, VERR_INVALID_POINTER);
-
-    char **papszFiles;
-    size_t cFiles;
-
-    /* First fetch the files names contained in the tar file */
-    int rc = RTTarList(pszTarFile, &papszFiles, &cFiles);
-    if (RT_FAILURE(rc))
-        return rc;
-
-    /* Extract all files */
-    return RTTarExtractFiles(pszTarFile, pszOutputDir, papszFiles, cFiles, pfnProgressCallback, pvUser);
-}
+    PRTTARFILEINTERNAL pFileInt = hFile;
+    RTTARFILE_VALID_RETURN(pFileInt);
 
-RTR3DECL(int) RTTarCreate(const char *pszTarFile, const char * const *papszFiles, size_t cFiles, PFNRTPROGRESS pfnProgressCallback, void *pvUser)
-{
-    /* Validate input */
-    AssertPtrReturn(pszTarFile, VERR_INVALID_POINTER);
-    AssertPtrReturn(papszFiles, VERR_INVALID_POINTER);
-    AssertReturn(cFiles, VERR_INVALID_PARAMETER);
-    AssertPtrNullReturn(pfnProgressCallback, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(pvUser, VERR_INVALID_POINTER);
-
-    RTTAR hTar;
-    int rc = RTTarOpen(&hTar, pszTarFile, RTFILE_O_CREATE | RTFILE_O_READWRITE | RTFILE_O_DENY_NONE, false /*fStream*/);
-    if (RT_FAILURE(rc))
-        return rc;
-
-    /* Get the overall size of all files to pack into the tar archive. Only
-       necessary if there is a progress callback. */
-    uint64_t cbOverallSize = 0;
-    if (pfnProgressCallback)
-        for (size_t i = 0; i < cFiles; ++i)
-        {
-            uint64_t cbSize;
-            rc = RTFileQuerySize(papszFiles[i], &cbSize);
-            if (RT_FAILURE(rc))
-                break;
-            cbOverallSize += cbSize;
-        }
-    uint64_t cbOverallWritten = 0;
-    for (size_t i = 0; i < cFiles; ++i)
+    size_t cbTmpRead = 0;
+    int rc = RTVfsIoStrmReadAt(pFileInt->hVfsIos, off, pvBuf, cbToRead, true /*fBlocking*/, &cbTmpRead);
+    if (RT_SUCCESS(rc))
     {
-        rc = rtTarAppendFileFromFile(hTar, papszFiles[i], cbOverallSize, cbOverallWritten, pfnProgressCallback, pvUser);
-        if (RT_FAILURE(rc))
-            break;
+        pFileInt->offCurrent = off + cbTmpRead;
+        if (pcbRead)
+            *pcbRead = cbTmpRead;
+        if (rc == VINF_EOF)
+            rc = pcbRead ? VINF_SUCCESS : VERR_EOF;
     }
-
-    /* Cleanup */
-    RTTarClose(hTar);
-
+    else if (pcbRead)
+        *pcbRead = 0;
     return rc;
 }
 
-/******************************************************************************
- *   Streaming Functions                                                      *
- ******************************************************************************/
 
-RTR3DECL(int) RTTarCurrentFile(RTTAR hTar, char **ppszFilename)
+RTR3DECL(int) RTTarFileWriteAt(RTTARFILE hFile, uint64_t off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten)
 {
-    /* Validate input. */
-    AssertPtrNullReturn(ppszFilename, VERR_INVALID_POINTER);
+    PRTTARFILEINTERNAL pFileInt = hFile;
+    RTTARFILE_VALID_RETURN(pFileInt);
 
-    PRTTARINTERNAL pInt = hTar;
-    RTTAR_VALID_RETURN(pInt);
+    if ((pFileInt->fOpenMode & RTFILE_O_WRITE) != RTFILE_O_WRITE)
+        return VERR_ACCESS_DENIED;
 
-    /* Open and close the file on the current position. This makes sure the
-     * cache is filled in case we never read something before. On success it
-     * will return the current filename. */
-    RTTARFILE hFile;
-    int rc = RTTarFileOpenCurrentFile(hTar, &hFile, ppszFilename, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE);
-    if (RT_SUCCESS(rc))
-        RTTarFileClose(hFile);
+    size_t cbTmpWritten = 0;
+    int rc = RTFileWriteAt(pFileInt->pTar->hTarFile, pFileInt->offStart + 512 + off, pvBuf, cbToWrite, &cbTmpWritten);
+    pFileInt->cbSize += cbTmpWritten;
+    pFileInt->offCurrent = off + cbTmpWritten;
+    if (pcbWritten)
+        *pcbWritten = cbTmpWritten;
 
     return rc;
 }
 
-RTR3DECL(int) RTTarSeekNextFile(RTTAR hTar)
-{
-    PRTTARINTERNAL pInt = hTar;
-    RTTAR_VALID_RETURN(pInt);
-
-    int rc = VINF_SUCCESS;
-
-    if (!pInt->fStreamMode)
-        return VERR_INVALID_STATE;
-
-    /* If there is nothing in the cache, it means we never read something. Just
-     * ask for the current filename to fill the cache. */
-    if (!pInt->pFileCache)
-    {
-        rc = RTTarCurrentFile(hTar, NULL);
-        if (RT_FAILURE(rc))
-            return rc;
-    }
-
-    /* Check that the file pointer is somewhere within the last open file.
-     * If not we are somehow busted. */
-    uint64_t offCur = RTFileTell(pInt->hTarFile);
-    if (!(   pInt->pFileCache->offStart <= offCur
-          && offCur <= pInt->pFileCache->offStart + sizeof(RTTARRECORD) + pInt->pFileCache->cbSize))
-        return VERR_INVALID_STATE;
-
-    /* Seek to the next file header. */
-    uint64_t offNext = RT_ALIGN(pInt->pFileCache->offStart + sizeof(RTTARRECORD) + pInt->pFileCache->cbSize, sizeof(RTTARRECORD));
-    if (pInt->pFileCache->cbSize != 0)
-    {
-        rc = RTFileSeek(pInt->hTarFile, offNext - offCur, RTFILE_SEEK_CURRENT, NULL);
-        if (RT_FAILURE(rc))
-            return rc;
-    }
-    else
-    {
-        /* Else delete the last open file cache. Might be recreated below. */
-        rtDeleteTarFileInternal(pInt->pFileCache);
-        pInt->pFileCache = NULL;
-    }
-
-    /* Again check the current filename to fill the cache with the new value. */
-    return RTTarCurrentFile(hTar, NULL);
-}
 
-RTR3DECL(int) RTTarFileOpenCurrentFile(RTTAR hTar, PRTTARFILE phFile, char **ppszFilename, uint32_t fOpen)
+RTR3DECL(int) RTTarFileGetSize(RTTARFILE hFile, uint64_t *pcbSize)
 {
-    /* Validate input. */
-    AssertPtrReturn(phFile, VERR_INVALID_POINTER);
-    AssertPtrNullReturn(ppszFilename, VERR_INVALID_POINTER);
-    AssertReturn((fOpen & RTFILE_O_READ), VERR_INVALID_PARAMETER); /* Only valid in read mode. */
-
-    PRTTARINTERNAL pInt = hTar;
-    RTTAR_VALID_RETURN(pInt);
-
-    if (!pInt->fStreamMode)
-        return VERR_INVALID_STATE;
-
-    int rc = VINF_SUCCESS;
-
-    /* Is there some cached entry? */
-    if (pInt->pFileCache)
-    {
-        if (pInt->pFileCache->offStart + sizeof(RTTARRECORD) < RTFileTell(pInt->hTarFile))
-        {
-            /* Else delete the last open file cache. Might be recreated below. */
-            rtDeleteTarFileInternal(pInt->pFileCache);
-            pInt->pFileCache = NULL;
-        }
-        else/* Are we still directly behind that header? */
-        {
-            /* Yes, so the streaming can start. Just return the cached file
-             * structure to the caller. */
-            *phFile = rtCopyTarFileInternal(pInt->pFileCache);
-            if (ppszFilename)
-                *ppszFilename = RTStrDup(pInt->pFileCache->pszFilename);
-            if (pInt->pFileCache->linkflag == LF_DIR)
-                return VINF_TAR_DIR_PATH;
-            return VINF_SUCCESS;
-        }
+    /* Validate input */
+    AssertPtrReturn(pcbSize, VERR_INVALID_POINTER);
 
-    }
+    PRTTARFILEINTERNAL pFileInt = hFile;
+    RTTARFILE_VALID_RETURN(pFileInt);
 
-    PRTTARFILEINTERNAL pFileInt = NULL;
-    do /* break loop */
-    {
-        /* Try to read a header entry from the current position. If we aren't
-         * on a header record, the header checksum will show and an error will
-         * be returned. */
-        RTTARRECORD record;
-        /* Read & verify a header record */
-        rc = rtTarReadHeaderRecord(pInt->hTarFile, &record);
-        /* Check for error or EOF. */
-        if (RT_FAILURE(rc))
-            break;
+    *pcbSize = RT_MAX(pFileInt->cbSetSize, pFileInt->cbSize);
 
-        /* We support normal files only */
-        if (   record.h.linkflag == LF_OLDNORMAL
-            || record.h.linkflag == LF_NORMAL
-            || record.h.linkflag == LF_DIR)
-        {
-            pFileInt = rtCreateTarFileInternal(pInt, record.h.name, fOpen);
-            if (!pFileInt)
-            {
-                rc = VERR_NO_MEMORY;
-                break;
-            }
+    return VINF_SUCCESS;
+}
 
-            /* Get the file size */
-            pFileInt->cbSize = rtTarRecToSize(&record);
-            /* The start is -512 from here. */
-            pFileInt->offStart = RTFileTell(pInt->hTarFile) - sizeof(RTTARRECORD);
-            /* remember the type of a file */
-            pFileInt->linkflag = record.h.linkflag;
 
-            /* Copy the new file structure to our cache. */
-            pInt->pFileCache = rtCopyTarFileInternal(pFileInt);
-            if (ppszFilename)
-                *ppszFilename = RTStrDup(pFileInt->pszFilename);
+RTR3DECL(int) RTTarFileSetSize(RTTARFILE hFile, uint64_t cbSize)
+{
+    PRTTARFILEINTERNAL pFileInt = hFile;
+    RTTARFILE_VALID_RETURN(pFileInt);
 
-            if (pFileInt->linkflag == LF_DIR)
-                rc = VINF_TAR_DIR_PATH;
-        }
-    } while (0);
+    if ((pFileInt->fOpenMode & RTFILE_O_WRITE) != RTFILE_O_WRITE)
+        return VERR_WRITE_ERROR;
 
-    if (RT_FAILURE(rc))
-    {
-        if (pFileInt)
-            rtDeleteTarFileInternal(pFileInt);
-    }
-    else
-        *phFile = pFileInt;
+    /** @todo If cbSize is smaller than pFileInt->cbSize we have to
+     * truncate the current file. */
+    pFileInt->cbSetSize = cbSize;
 
-    return rc;
+    return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/Runtime/common/zip/tarvfs.cpp b/src/VBox/Runtime/common/zip/tarvfs.cpp
index 878b403..72c3d44 100644
--- a/src/VBox/Runtime/common/zip/tarvfs.cpp
+++ b/src/VBox/Runtime/common/zip/tarvfs.cpp
@@ -77,7 +77,8 @@ typedef struct RTZIPTARREADER
     uint32_t                cZeroHdrs;
     /** The state machine state. */
     RTZIPTARREADERSTATE     enmState;
-    /** The type of the previous TAR header. */
+    /** The type of the previous TAR header.
+     * @remarks Same a enmType for the first header in the TAR stream. */
     RTZIPTARTYPE            enmPrevType;
     /** The type of the current TAR header. */
     RTZIPTARTYPE            enmType;
@@ -125,6 +126,8 @@ typedef struct RTZIPTARIOSTREAM
     RTFOFF                  cbFile;
     /** The current file position. */
     RTFOFF                  offFile;
+    /** The start position in the hVfsIos (for seekable hVfsIos). */
+    RTFOFF                  offStart;
     /** The number of padding bytes following the file. */
     uint32_t                cbPadding;
     /** Set if we've reached the end of the file. */
@@ -349,9 +352,13 @@ static int rtZipTarHdrValidate(PCRTZIPTARHDR pTar, PRTZIPTARTYPE penmType)
             && pTar->Common.version[1] == '0')
             enmType = RTZIPTARTYPE_POSIX;
         else if (   pTar->Common.magic[5]   == ' '
-                && pTar->Common.version[0] == ' '
-                && pTar->Common.version[1] == '\0')
+                 && pTar->Common.version[0] == ' '
+                 && pTar->Common.version[1] == '\0')
             enmType = RTZIPTARTYPE_GNU;
+        else if (   pTar->Common.magic[5]   == '\0' /* VMWare ambiguity - they probably mean posix but */
+                 && pTar->Common.version[0] == ' '  /*                    got the version wrong. */
+                 && pTar->Common.version[1] == '\0')
+            enmType = RTZIPTARTYPE_POSIX;
         else
             return VERR_TAR_NOT_USTAR_V00;
     }
@@ -452,7 +459,11 @@ static int rtZipTarReaderParseNextHeader(PRTZIPTARREADER pThis, PCRTZIPTARHDR pH
         return rc;
     }
     if (fFirst)
+    {
         pThis->enmType = enmType;
+        if (pThis->enmPrevType == RTZIPTARTYPE_INVALID)
+            pThis->enmPrevType = enmType;
+    }
 
     /*
      * Handle the header by type.
@@ -844,8 +855,10 @@ static bool rtZipTarReaderExpectingMoreHeaders(PRTZIPTARREADER pThis)
  */
 static bool rtZipTarReaderIsAtEnd(PRTZIPTARREADER pThis)
 {
+    /* Turns out our own tar writer code doesn't get this crap right.
+       Kludge our way around it. */
     if (!pThis->cZeroHdrs)
-        return false;
+        return pThis->enmPrevType == RTZIPTARTYPE_GNU ? true /* IPRT tar.cpp */ : false;
 
     /* Here is a kludge to try deal with archivers not putting at least two
        zero headers at the end.  Afraid it may require further relaxing
@@ -1006,25 +1019,27 @@ static DECLCALLBACK(int) rtZipTarFssIos_QueryInfo(void *pvThis, PRTFSOBJINFO pOb
 
 
 /**
- * Reads one segment.
- *
- * @returns IPRT status code.
- * @param   pThis           The instance data.
- * @param   pvBuf           Where to put the read bytes.
- * @param   cbToRead        The number of bytes to read.
- * @param   fBlocking       Whether to block or not.
- * @param   pcbRead         Where to store the number of bytes actually read.
+ * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
  */
-static int rtZipTarFssIos_ReadOneSeg(PRTZIPTARIOSTREAM pThis, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead)
+static DECLCALLBACK(int) rtZipTarFssIos_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
 {
+    PRTZIPTARIOSTREAM pThis = (PRTZIPTARIOSTREAM)pvThis;
+    Assert(pSgBuf->cSegs == 1);
+
     /*
-     * Fend of reads beyond the end of the stream here.
+     * Make offset into a real offset so it's possible to do random access
+     * on TAR files that are seekable.  Fend of reads beyond the end of the
+     * stream.
      */
-    if (pThis->fEndOfStream)
+    if (off < 0)
+        off = pThis->offFile;
+    if (off >= pThis->cbFile)
         return pcbRead ? VINF_EOF : VERR_EOF;
 
+
     Assert(pThis->cbFile >= pThis->offFile);
-    uint64_t cbLeft = (uint64_t)(pThis->cbFile - pThis->offFile);
+    uint64_t cbLeft   = (uint64_t)(pThis->cbFile - pThis->offFile);
+    size_t   cbToRead = pSgBuf->paSegs[0].cbSeg;
     if (cbToRead > cbLeft)
     {
         if (!pcbRead)
@@ -1038,8 +1053,8 @@ static int rtZipTarFssIos_ReadOneSeg(PRTZIPTARIOSTREAM pThis, void *pvBuf, size_
     size_t cbReadStack = 0;
     if (!pcbRead)
         pcbRead = &cbReadStack;
-    int rc = RTVfsIoStrmRead(pThis->hVfsIos, pvBuf, cbToRead, fBlocking, pcbRead);
-    pThis->offFile += *pcbRead;
+    int rc = RTVfsIoStrmReadAt(pThis->hVfsIos, pThis->offStart + off, pSgBuf->paSegs[0].pvSeg, cbToRead, fBlocking, pcbRead);
+    pThis->offFile = off + *pcbRead;
     if (pThis->offFile >= pThis->cbFile)
     {
         Assert(pThis->offFile == pThis->cbFile);
@@ -1052,44 +1067,6 @@ static int rtZipTarFssIos_ReadOneSeg(PRTZIPTARIOSTREAM pThis, void *pvBuf, size_
 
 
 /**
- * @interface_method_impl{RTVFSIOSTREAMOPS,pfnRead}
- */
-static DECLCALLBACK(int) rtZipTarFssIos_Read(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead)
-{
-    PRTZIPTARIOSTREAM pThis = (PRTZIPTARIOSTREAM)pvThis;
-    int               rc;
-    AssertReturn(off == -1, VERR_INVALID_PARAMETER);
-
-    if (pSgBuf->cSegs == 1)
-        rc = rtZipTarFssIos_ReadOneSeg(pThis, pSgBuf->paSegs[0].pvSeg, pSgBuf->paSegs[0].cbSeg, fBlocking, pcbRead);
-    else
-    {
-        rc = VINF_SUCCESS;
-        size_t  cbRead = 0;
-        size_t  cbReadSeg;
-        size_t *pcbReadSeg = pcbRead ? &cbReadSeg : NULL;
-        for (uint32_t iSeg = 0; iSeg < pSgBuf->cSegs; iSeg++)
-        {
-            cbReadSeg = 0;
-            rc = rtZipTarFssIos_ReadOneSeg(pThis, pSgBuf->paSegs[iSeg].pvSeg, pSgBuf->paSegs[iSeg].cbSeg, fBlocking, pcbReadSeg);
-            if (RT_FAILURE(rc))
-                break;
-            if (pcbRead)
-            {
-                cbRead += cbReadSeg;
-                if (cbReadSeg != pSgBuf->paSegs[iSeg].cbSeg)
-                    break;
-            }
-        }
-        if (pcbRead)
-            *pcbRead = cbRead;
-    }
-
-    return rc;
-}
-
-
-/**
  * @interface_method_impl{RTVFSIOSTREAMOPS,pfnWrite}
  */
 static DECLCALLBACK(int) rtZipTarFssIos_Write(void *pvThis, RTFOFF off, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten)
@@ -1160,7 +1137,7 @@ static const RTVFSIOSTREAMOPS g_rtZipTarFssIosOps =
         RTVFSOBJOPS_VERSION
     },
     RTVFSIOSTREAMOPS_VERSION,
-    0,
+    RTVFSIOSTREAMOPS_FEAT_NO_SG,
     rtZipTarFssIos_Read,
     rtZipTarFssIos_Write,
     rtZipTarFssIos_Flush,
@@ -1418,6 +1395,7 @@ static DECLCALLBACK(int) rtZipTarFss_Next(void *pvThis, char **ppszName, RTVFSOB
             pIosData->BaseObj.ObjInfo   = Info;
             pIosData->cbFile            = Info.cbObject;
             pIosData->offFile           = 0;
+            pIosData->offStart          = RTVfsIoStrmTell(pThis->hVfsIos);
             pIosData->cbPadding         = (uint32_t)(Info.cbAllocated - Info.cbObject);
             pIosData->fEndOfStream      = false;
             pIosData->hVfsIos           = pThis->hVfsIos;
diff --git a/src/VBox/Runtime/common/zip/unzipcmd.cpp b/src/VBox/Runtime/common/zip/unzipcmd.cpp
index 499742e..7d314ea 100644
--- a/src/VBox/Runtime/common/zip/unzipcmd.cpp
+++ b/src/VBox/Runtime/common/zip/unzipcmd.cpp
@@ -182,7 +182,7 @@ static RTEXITCODE rtZipUnzipCmdExtractCallback(PRTZIPUNZIPCMDOPS pOpts, RTVFSOBJ
     int rc = RTVfsObjQueryInfo(hVfsObj, &UnixInfo, RTFSOBJATTRADD_UNIX);
     if (RT_FAILURE(rc))
         return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTVfsObjQueryInfo returned %Rrc on '%s'", rc, pszName);
-    
+
     *pcBytes = UnixInfo.cbObject;
 
     char szDst[RTPATH_MAX];
@@ -406,7 +406,7 @@ RTDECL(RTEXITCODE) RTZipUnzipCmd(unsigned cArgs, char **papszArgs)
 
     RTZIPUNZIPCMDOPS Opts;
     RT_ZERO(Opts);
-    
+
     RTGETOPTUNION  ValueUnion;
     while (   (rc = RTGetOpt(&GetState, &ValueUnion)) != 0
            && rc != VINF_GETOPT_NOT_OPTION)
diff --git a/src/VBox/Runtime/common/zip/zip.cpp b/src/VBox/Runtime/common/zip/zip.cpp
index 2592f7a..f6e00d2 100644
--- a/src/VBox/Runtime/common/zip/zip.cpp
+++ b/src/VBox/Runtime/common/zip/zip.cpp
@@ -1964,7 +1964,7 @@ RTDECL(int) RTZipBlockDecompress(RTZIPTYPE enmType, uint32_t fFlags,
                 return zipErrConvertFromZlib(rc, false /*fCompressing*/);
 
             if (pcbSrcActual)
-                *pcbSrcActual = ZStrm.avail_in - cbSrc;
+                *pcbSrcActual = cbSrc - ZStrm.avail_in;
             if (pcbDstActual)
                 *pcbDstActual = ZStrm.total_out;
             break;
diff --git a/src/VBox/Runtime/generic/RTFileCopy-generic.cpp b/src/VBox/Runtime/generic/RTFileCopy-generic.cpp
index a87ecb4..00222a5 100644
--- a/src/VBox/Runtime/generic/RTFileCopy-generic.cpp
+++ b/src/VBox/Runtime/generic/RTFileCopy-generic.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -32,16 +32,6 @@
 #include "internal/iprt.h"
 
 
-/**
- * Copies a file.
- *
- * @returns VERR_ALREADY_EXISTS if the destination file exists.
- * @returns VBox Status code.
- *
- * @param   pszSrc      The path to the source file.
- * @param   pszDst      The path to the destination file.
- *                      This file will be created.
- */
 RTDECL(int) RTFileCopy(const char *pszSrc, const char *pszDst)
 {
     return RTFileCopyEx(pszSrc, pszDst, 0, NULL, NULL);
diff --git a/src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp b/src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp
index e0c8cb7..10000c2 100644
--- a/src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetDescription-generic-stub.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2010 Oracle Corporation
+ * Copyright (C) 2009-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -37,7 +37,7 @@ RTDECL(int) RTMpGetDescription(RTCPUID idCpu, char *pszBuf, size_t cbBuf)
 {
     static const char s_szUnknown[] = "Unknown";
 
-    if (!RTMpIsCpuOnline(idCpu))
+    if (idCpu != NIL_RTCPUID && !RTMpIsCpuOnline(idCpu))
         return RTMpIsCpuPossible(idCpu)
              ? VERR_CPU_OFFLINE
              : VERR_CPU_NOT_FOUND;
diff --git a/src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp b/src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp
index fbf11f2..2a5f6eb 100644
--- a/src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp
+++ b/src/VBox/Runtime/generic/RTMpGetDescription-generic.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2010 Oracle Corporation
+ * Copyright (C) 2009-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -59,7 +59,7 @@ RTDECL(int) RTMpGetDescription(RTCPUID idCpu, char *pszBuf, size_t cbBuf)
     /*
      * Check that the specified cpu is valid & online.
      */
-    if (!RTMpIsCpuOnline(idCpu))
+    if (idCpu != NIL_RTCPUID && !RTMpIsCpuOnline(idCpu))
         return RTMpIsCpuPossible(idCpu)
              ? VERR_CPU_OFFLINE
              : VERR_CPU_NOT_FOUND;
diff --git a/src/VBox/Runtime/generic/RTMpOnPair-generic.cpp b/src/VBox/Runtime/generic/RTMpOnPair-generic.cpp
new file mode 100644
index 0000000..c948e34
--- /dev/null
+++ b/src/VBox/Runtime/generic/RTMpOnPair-generic.cpp
@@ -0,0 +1,137 @@
+/* $Id: RTMpOnPair-generic.cpp $ */
+/** @file
+ * IPRT - RTMpOnPair, generic implementation using RTMpOnAll.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "internal/iprt.h"
+#include <iprt/mp.h>
+
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/err.h>
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * Argument package for the generic RTMpOnPair implemenetation.
+ */
+typedef struct RTMPONPAIRGENERIC
+{
+    RTCPUID             idCpu1;
+    RTCPUID             idCpu2;
+    PFNRTMPWORKER       pfnWorker;
+    void               *pvUser1;
+    void               *pvUser2;
+    /** Count of how many CPUs actually showed up. */
+    uint32_t volatile   cPresent;
+} RTMPONPAIRGENERIC;
+/** Pointer to the an argument package for the generic RTMpOnPair
+ *  implemenation. */
+typedef RTMPONPAIRGENERIC *PRTMPONPAIRGENERIC;
+
+
+/**
+ * @callback_method_impl{FNRTMPWORKER,
+ *      Used by RTMpOnPair to call the worker on the two specified CPUs.}
+ */
+static DECLCALLBACK(void) rtMpOnPairGenericWorker(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    PRTMPONPAIRGENERIC pArgs = (PRTMPONPAIRGENERIC)pvUser1;
+
+    /*
+     * Only the two choosen CPUs should call the worker function, count how
+     * many of them that showed up.
+     */
+    if (   idCpu == pArgs->idCpu1
+        || idCpu == pArgs->idCpu2)
+    {
+        ASMAtomicIncU32(&pArgs->cPresent);
+        pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+    }
+}
+
+
+RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+{
+    int rc;
+    AssertReturn(idCpu1 != idCpu2, VERR_INVALID_PARAMETER);
+    AssertReturn(!(fFlags & RTMPON_F_VALID_MASK), VERR_INVALID_FLAGS);
+    if ((fFlags & RTMPON_F_CONCURRENT_EXEC) && !RTMpOnAllIsConcurrentSafe())
+        return VERR_NOT_SUPPORTED;
+
+    /*
+     * Check that both CPUs are online before doing the broadcast call.
+     */
+    if (   RTMpIsCpuOnline(idCpu1)
+        && RTMpIsCpuOnline(idCpu2))
+    {
+        RTMPONPAIRGENERIC Args;
+        Args.idCpu1    = idCpu1;
+        Args.idCpu2    = idCpu2;
+        Args.pfnWorker = pfnWorker;
+        Args.pvUser1   = pvUser1;
+        Args.pvUser2   = pvUser2;
+        Args.cPresent  = 0;
+        rc = RTMpOnAll(rtMpOnPairGenericWorker, &Args, pvUser2);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Let's see if both of the CPUs showed up.
+             */
+            if (RT_LIKELY(Args.cPresent == 2))
+            { /* likely */ }
+            else if (Args.cPresent == 0)
+                rc = VERR_CPU_OFFLINE;
+            else if (Args.cPresent == 1)
+                rc = VERR_NOT_ALL_CPUS_SHOWED;
+            else
+            {
+                rc = VERR_CPU_IPE_1;
+                AssertMsgFailed(("cPresent=%#x\n", Args.cPresent));
+            }
+        }
+    }
+    /*
+     * A CPU must be present to be considered just offline.
+     */
+    else if (   RTMpIsCpuPresent(idCpu1)
+             && RTMpIsCpuPresent(idCpu2))
+        rc = VERR_CPU_OFFLINE;
+    else
+        rc = VERR_CPU_NOT_FOUND;
+    return rc;
+}
+
+
+RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void)
+{
+    return RTMpOnAllIsConcurrentSafe();
+}
+
diff --git a/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp b/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp
index 81c28c5..a161d20 100644
--- a/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp
+++ b/src/VBox/Runtime/generic/RTTimerCreate-generic.cpp
@@ -37,10 +37,10 @@
 
 RTDECL(int) RTTimerCreate(PRTTIMER *ppTimer, unsigned uMilliesInterval, PFNRTTIMER pfnTimer, void *pvUser)
 {
-    int rc = RTTimerCreateEx(ppTimer, uMilliesInterval * UINT64_C(1000000), 0, pfnTimer, pvUser);
+    int rc = RTTimerCreateEx(ppTimer, uMilliesInterval * RT_NS_1MS_64, 0 /* fFlags */, pfnTimer, pvUser);
     if (RT_SUCCESS(rc))
     {
-        rc = RTTimerStart(*ppTimer, 0);
+        rc = RTTimerStart(*ppTimer, 0 /* u64First */);
         if (RT_FAILURE(rc))
         {
             int rc2 = RTTimerDestroy(*ppTimer); AssertRC(rc2);
diff --git a/src/VBox/Runtime/generic/env-generic.cpp b/src/VBox/Runtime/generic/env-generic.cpp
index 0d9a13b..a96f30e 100644
--- a/src/VBox/Runtime/generic/env-generic.cpp
+++ b/src/VBox/Runtime/generic/env-generic.cpp
@@ -88,6 +88,8 @@ typedef struct RTENVINTERNAL
 {
     /** Magic value . */
     uint32_t    u32Magic;
+    /** Set if this is a record of environment changes, putenv style. */
+    bool        fPutEnvBlock;
     /** Number of variables in the array.
      * This does not include the terminating NULL entry. */
     size_t      cVars;
@@ -95,7 +97,10 @@ typedef struct RTENVINTERNAL
      * This includes space for the terminating NULL element (for compatibility
      * with the C library), so that c <= cCapacity - 1. */
     size_t      cAllocated;
-    /** Array of environment variables. */
+    /** Array of environment variables.
+     * These are always in "NAME=VALUE" form, where the value can be empty. If
+     * fPutEnvBlock is set though, there will be "NAME" entries too for variables
+     * that need to be removed when merged with another environment block. */
     char      **papszEnv;
     /** Array of environment variables in the process CP.
      * This get (re-)constructed when RTEnvGetExecEnvP method is called. */
@@ -131,8 +136,12 @@ static const char * const *rtEnvDefault(void)
  * @param   cAllocated      The initial array size.
  * @param   fCaseSensitive  Whether the environment block is case sensitive or
  *                          not.
+ * @param   fPutEnvBlock    Indicates whether this is a special environment
+ *                          block that will be used to record change another
+ *                          block.  We will keep unsets in putenv format, i.e.
+ *                          just the variable name without any equal sign.
  */
-static int rtEnvCreate(PRTENVINTERNAL *ppIntEnv, size_t cAllocated, bool fCaseSensitive)
+static int rtEnvCreate(PRTENVINTERNAL *ppIntEnv, size_t cAllocated, bool fCaseSensitive, bool fPutEnvBlock)
 {
     /*
      * Allocate environment handle.
@@ -144,6 +153,7 @@ static int rtEnvCreate(PRTENVINTERNAL *ppIntEnv, size_t cAllocated, bool fCaseSe
          * Pre-allocate the variable array.
          */
         pIntEnv->u32Magic = RTENV_MAGIC;
+        pIntEnv->fPutEnvBlock = fPutEnvBlock;
         pIntEnv->pfnCompare = fCaseSensitive ? RTStrNCmp : RTStrNICmp;
         pIntEnv->papszEnvOtherCP = NULL;
         pIntEnv->cVars = 0;
@@ -165,7 +175,7 @@ static int rtEnvCreate(PRTENVINTERNAL *ppIntEnv, size_t cAllocated, bool fCaseSe
 RTDECL(int) RTEnvCreate(PRTENV pEnv)
 {
     AssertPtrReturn(pEnv, VERR_INVALID_POINTER);
-    return rtEnvCreate(pEnv, RTENV_GROW_SIZE, false /*fCaseSensitive*/);
+    return rtEnvCreate(pEnv, RTENV_GROW_SIZE, false /*fCaseSensitive*/, false /*fPutEnvBlock*/);
 }
 RT_EXPORT_SYMBOL(RTEnvCreate);
 
@@ -220,6 +230,7 @@ RTDECL(int) RTEnvClone(PRTENV pEnv, RTENV EnvToClone)
      * Validate input and figure out how many variable to clone and where to get them.
      */
     bool fCaseSensitive = true;
+    bool fPutEnvBlock   = false;
     size_t cVars;
     const char * const *papszEnv;
 #ifdef RTENV_HAVE_WENVIRON
@@ -233,7 +244,7 @@ RTDECL(int) RTEnvClone(PRTENV pEnv, RTENV EnvToClone)
         pIntEnvToClone = NULL;
 #ifdef RTENV_HAVE_WENVIRON
         papszEnv  = NULL;
-        papwszEnv = (PCRTUTF16 * const )_wenviron;
+        papwszEnv = (PCRTUTF16 * const)_wenviron;
         if (!papwszEnv)
         {
             _wgetenv(L"Path"); /* Force the CRT to initalize it. */
@@ -262,6 +273,7 @@ RTDECL(int) RTEnvClone(PRTENV pEnv, RTENV EnvToClone)
         AssertReturn(pIntEnvToClone->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
         RTENV_LOCK(pIntEnvToClone);
 
+        fPutEnvBlock = pIntEnvToClone->fPutEnvBlock;
         papszEnv = pIntEnvToClone->papszEnv;
         cVars = pIntEnvToClone->cVars;
     }
@@ -270,7 +282,7 @@ RTDECL(int) RTEnvClone(PRTENV pEnv, RTENV EnvToClone)
      * Create the duplicate.
      */
     PRTENVINTERNAL pIntEnv;
-    int rc = rtEnvCreate(&pIntEnv, cVars + 1 /* NULL */, fCaseSensitive);
+    int rc = rtEnvCreate(&pIntEnv, cVars + 1 /* NULL */, fCaseSensitive, fPutEnvBlock);
     if (RT_SUCCESS(rc))
     {
         pIntEnv->cVars = cVars;
@@ -287,15 +299,25 @@ RTDECL(int) RTEnvClone(PRTENV pEnv, RTENV EnvToClone)
                 int rc2 = RTStrCurrentCPToUtf8(&pIntEnv->papszEnv[iDst], papszEnv[iSrc]);
 #endif
                 if (RT_SUCCESS(rc2))
+                {
+                    /* Make sure it contains an '='. */
                     iDst++;
+                    if (strchr(pIntEnv->papszEnv[iDst - 1], '='))
+                        continue;
+                    rc2 = RTStrAAppend(&pIntEnv->papszEnv[iDst - 1], "=");
+                    if (RT_SUCCESS(rc2))
+                        continue;
+                }
                 else if (rc2 == VERR_NO_TRANSLATION)
-                    rc = VWRN_ENV_NOT_FULLY_TRANSLATED;
-                else
                 {
-                    pIntEnv->cVars = iDst;
-                    RTEnvDestroy(pIntEnv);
-                    return rc2;
+                    rc = VWRN_ENV_NOT_FULLY_TRANSLATED;
+                    continue;
                 }
+
+                /* failed fatally. */
+                pIntEnv->cVars = iDst;
+                RTEnvDestroy(pIntEnv);
+                return rc2;
             }
             pIntEnv->cVars = iDst;
         }
@@ -327,6 +349,28 @@ RTDECL(int) RTEnvClone(PRTENV pEnv, RTENV EnvToClone)
 RT_EXPORT_SYMBOL(RTEnvClone);
 
 
+RTDECL(int) RTEnvReset(RTENV hEnv)
+{
+    PRTENVINTERNAL pIntEnv = hEnv;
+    AssertPtrReturn(pIntEnv, VERR_INVALID_HANDLE);
+    AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
+
+    RTENV_LOCK(pIntEnv);
+
+    size_t iVar = pIntEnv->cVars;
+    pIntEnv->cVars = 0;
+    while (iVar-- > 0)
+    {
+        RTMemFree(pIntEnv->papszEnv[iVar]);
+        pIntEnv->papszEnv[iVar] = NULL;
+    }
+
+    RTENV_UNLOCK(pIntEnv);
+    return VINF_SUCCESS;
+}
+RT_EXPORT_SYMBOL(RTEnvReset);
+
+
 RTDECL(int) RTEnvPutEx(RTENV Env, const char *pszVarEqualValue)
 {
     int rc;
@@ -355,11 +399,53 @@ RTDECL(int) RTEnvPutEx(RTENV Env, const char *pszVarEqualValue)
 RT_EXPORT_SYMBOL(RTEnvPutEx);
 
 
+/**
+ * Appends an already allocated string to papszEnv.
+ *
+ * @returns IPRT status code
+ * @param   pIntEnv             The environment block to append it to.
+ * @param   pszEntry            The string to add.  Already duplicated, caller
+ *                              does error cleanup.
+ */
+static int rtEnvIntAppend(PRTENVINTERNAL pIntEnv, char *pszEntry)
+{
+    /*
+     * Do we need to resize the array?
+     */
+    int rc = VINF_SUCCESS;
+    size_t iVar = pIntEnv->cVars;
+    if (iVar + 2 > pIntEnv->cAllocated)
+    {
+        void *pvNew = RTMemRealloc(pIntEnv->papszEnv, sizeof(char *) * (pIntEnv->cAllocated + RTENV_GROW_SIZE));
+        if (!pvNew)
+            rc = VERR_NO_MEMORY;
+        else
+        {
+            pIntEnv->papszEnv = (char **)pvNew;
+            pIntEnv->cAllocated += RTENV_GROW_SIZE;
+            for (size_t iNewVar = pIntEnv->cVars; iNewVar < pIntEnv->cAllocated; iNewVar++)
+                pIntEnv->papszEnv[iNewVar] = NULL;
+        }
+    }
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Append it.
+         */
+        pIntEnv->papszEnv[iVar] = pszEntry;
+        pIntEnv->papszEnv[iVar + 1] = NULL; /* this isn't really necessary, but doesn't hurt. */
+        pIntEnv->cVars = iVar + 1;
+    }
+    return rc;
+}
+
+
 RTDECL(int) RTEnvSetEx(RTENV Env, const char *pszVar, const char *pszValue)
 {
     AssertPtrReturn(pszVar, VERR_INVALID_POINTER);
     AssertReturn(*pszVar, VERR_INVALID_PARAMETER);
     AssertPtrReturn(pszValue, VERR_INVALID_POINTER);
+    AssertReturn(strchr(pszVar, '=') == NULL, VERR_ENV_INVALID_VAR_NAME);
 
     int rc;
     if (Env == RTENV_DEFAULT)
@@ -414,7 +500,8 @@ RTDECL(int) RTEnvSetEx(RTENV Env, const char *pszVar, const char *pszValue)
             size_t iVar;
             for (iVar = 0; iVar < pIntEnv->cVars; iVar++)
                 if (    !pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar)
-                    &&  pIntEnv->papszEnv[iVar][cchVar] == '=')
+                    &&  (   pIntEnv->papszEnv[iVar][cchVar] == '='
+                         || pIntEnv->papszEnv[iVar][cchVar] == '\0') )
                     break;
             if (iVar < pIntEnv->cVars)
             {
@@ -427,29 +514,10 @@ RTDECL(int) RTEnvSetEx(RTENV Env, const char *pszVar, const char *pszValue)
             else
             {
                 /*
-                 * Adding a new variable. Resize the array if required
-                 * and then insert the new value at the end.
+                 * New variable, append it.
                  */
-                if (pIntEnv->cVars + 2 > pIntEnv->cAllocated)
-                {
-                    void *pvNew = RTMemRealloc(pIntEnv->papszEnv, sizeof(char *) * (pIntEnv->cAllocated + RTENV_GROW_SIZE));
-                    if (!pvNew)
-                        rc = VERR_NO_MEMORY;
-                    else
-                    {
-                        pIntEnv->papszEnv = (char **)pvNew;
-                        pIntEnv->cAllocated += RTENV_GROW_SIZE;
-                        for (size_t iNewVar = pIntEnv->cVars; iNewVar < pIntEnv->cAllocated; iNewVar++)
-                            pIntEnv->papszEnv[iNewVar] = NULL;
-                    }
-                }
-                if (RT_SUCCESS(rc))
-                {
-                    pIntEnv->papszEnv[iVar] = pszEntry;
-                    pIntEnv->papszEnv[iVar + 1] = NULL; /* this isn't really necessary, but doesn't hurt. */
-                    pIntEnv->cVars++;
-                    Assert(pIntEnv->cVars == iVar + 1);
-                }
+                Assert(pIntEnv->cVars == iVar);
+                rc = rtEnvIntAppend(pIntEnv, pszEntry);
             }
 
             RTENV_UNLOCK(pIntEnv);
@@ -469,6 +537,7 @@ RTDECL(int) RTEnvUnsetEx(RTENV Env, const char *pszVar)
 {
     AssertPtrReturn(pszVar, VERR_INVALID_POINTER);
     AssertReturn(*pszVar, VERR_INVALID_PARAMETER);
+    AssertReturn(strchr(pszVar, '=') == NULL, VERR_ENV_INVALID_VAR_NAME);
 
     int rc;
     if (Env == RTENV_DEFAULT)
@@ -506,17 +575,44 @@ RTDECL(int) RTEnvUnsetEx(RTENV Env, const char *pszVar)
         size_t iVar;
         for (iVar = 0; iVar < pIntEnv->cVars; iVar++)
             if (    !pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar)
-                &&  pIntEnv->papszEnv[iVar][cchVar] == '=')
+                &&  (   pIntEnv->papszEnv[iVar][cchVar] == '='
+                     || pIntEnv->papszEnv[iVar][cchVar] == '\0') )
             {
-                RTMemFree(pIntEnv->papszEnv[iVar]);
-                pIntEnv->cVars--;
-                if (pIntEnv->cVars > 0)
-                    pIntEnv->papszEnv[iVar] = pIntEnv->papszEnv[pIntEnv->cVars];
-                pIntEnv->papszEnv[pIntEnv->cVars] = NULL;
+                if (!pIntEnv->fPutEnvBlock)
+                {
+                    RTMemFree(pIntEnv->papszEnv[iVar]);
+                    pIntEnv->cVars--;
+                    if (pIntEnv->cVars > 0)
+                        pIntEnv->papszEnv[iVar] = pIntEnv->papszEnv[pIntEnv->cVars];
+                    pIntEnv->papszEnv[pIntEnv->cVars] = NULL;
+                }
+                else
+                {
+                    /* Record this unset by keeping the variable without any equal sign. */
+                    pIntEnv->papszEnv[iVar][cchVar] = '\0';
+                }
                 rc = VINF_SUCCESS;
                 /* no break, there could be more. */
             }
 
+        /*
+         * If this is a change record, we may need to add it.
+         */
+        if (rc == VINF_ENV_VAR_NOT_FOUND && pIntEnv->fPutEnvBlock)
+        {
+            char *pszEntry = (char *)RTMemDup(pszVar, cchVar + 1);
+            if (pszEntry)
+            {
+                rc = rtEnvIntAppend(pIntEnv, pszEntry);
+                if (RT_SUCCESS(rc))
+                    rc = VINF_ENV_VAR_NOT_FOUND;
+                else
+                    RTMemFree(pszEntry);
+            }
+            else
+                rc = VERR_NO_MEMORY;
+        }
+
         RTENV_UNLOCK(pIntEnv);
     }
     return rc;
@@ -531,6 +627,7 @@ RTDECL(int) RTEnvGetEx(RTENV Env, const char *pszVar, char *pszValue, size_t cbV
     AssertPtrNullReturn(pszValue, VERR_INVALID_POINTER);
     AssertPtrNullReturn(pcchActual, VERR_INVALID_POINTER);
     AssertReturn(pcchActual || (pszValue && cbValue), VERR_INVALID_PARAMETER);
+    AssertReturn(strchr(pszVar, '=') == NULL, VERR_ENV_INVALID_VAR_NAME);
 
     if (pcchActual)
         *pcchActual = 0;
@@ -591,22 +688,30 @@ RTDECL(int) RTEnvGetEx(RTENV Env, const char *pszVar, char *pszValue, size_t cbV
         const size_t cchVar = strlen(pszVar);
         size_t iVar;
         for (iVar = 0; iVar < pIntEnv->cVars; iVar++)
-            if (    !pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar)
-                &&  pIntEnv->papszEnv[iVar][cchVar] == '=')
+            if (!pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar))
             {
-                rc = VINF_SUCCESS;
-                const char *pszValueOrg = pIntEnv->papszEnv[iVar] + cchVar + 1;
-                size_t cch = strlen(pszValueOrg);
-                if (pcchActual)
-                    *pcchActual = cch;
-                if (pszValue && cbValue)
+                if (pIntEnv->papszEnv[iVar][cchVar] == '=')
                 {
-                    if (cch < cbValue)
-                        memcpy(pszValue, pszValueOrg, cch + 1);
-                    else
-                        rc = VERR_BUFFER_OVERFLOW;
+                    rc = VINF_SUCCESS;
+                    const char *pszValueOrg = pIntEnv->papszEnv[iVar] + cchVar + 1;
+                    size_t cch = strlen(pszValueOrg);
+                    if (pcchActual)
+                        *pcchActual = cch;
+                    if (pszValue && cbValue)
+                    {
+                        if (cch < cbValue)
+                            memcpy(pszValue, pszValueOrg, cch + 1);
+                        else
+                            rc = VERR_BUFFER_OVERFLOW;
+                    }
+                    break;
+                }
+                if (pIntEnv->papszEnv[iVar][cchVar] == '\0')
+                {
+                    Assert(pIntEnv->fPutEnvBlock);
+                    rc = VERR_ENV_VAR_UNSET;
+                    break;
                 }
-                break;
             }
 
         RTENV_UNLOCK(pIntEnv);
@@ -653,11 +758,15 @@ RTDECL(bool) RTEnvExistEx(RTENV Env, const char *pszVar)
          */
         const size_t cchVar = strlen(pszVar);
         for (size_t iVar = 0; iVar < pIntEnv->cVars; iVar++)
-            if (    !pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar)
-                &&  pIntEnv->papszEnv[iVar][cchVar] == '=')
+            if (!pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar))
             {
-                fExists = true;
-                break;
+                if (pIntEnv->papszEnv[iVar][cchVar] == '=')
+                {
+                    fExists = true;
+                    break;
+                }
+                if (pIntEnv->papszEnv[iVar][cchVar] == '\0')
+                    break;
             }
 
         RTENV_UNLOCK(pIntEnv);
@@ -739,7 +848,7 @@ RT_EXPORT_SYMBOL(RTEnvGetExecEnvP);
  * @param   pvElement2          Variable 2.
  * @param   pvUser              Ignored.
  */
-DECLCALLBACK(int) rtEnvSortCompare(const void *pvElement1, const void *pvElement2, void *pvUser)
+static DECLCALLBACK(int) rtEnvSortCompare(const void *pvElement1, const void *pvElement2, void *pvUser)
 {
     NOREF(pvUser);
     int iDiff = strcmp((const char *)pvElement1, (const char *)pvElement2);
@@ -837,7 +946,7 @@ RTDECL(int) RTEnvQueryUtf16Block(RTENV hEnv, PRTUTF16 *ppwszzBlock)
         *ppwszzBlock = pwszzBlock;
     return rc;
 }
-RT_EXPORT_SYMBOL(RTEnvGetExecEnvP);
+RT_EXPORT_SYMBOL(RTEnvQueryUtf16Block);
 
 
 RTDECL(void) RTEnvFreeUtf16Block(PRTUTF16 pwszzBlock)
@@ -846,3 +955,221 @@ RTDECL(void) RTEnvFreeUtf16Block(PRTUTF16 pwszzBlock)
 }
 RT_EXPORT_SYMBOL(RTEnvFreeUtf16Block);
 
+
+RTDECL(int) RTEnvQueryUtf8Block(RTENV hEnv, bool fSorted, char **ppszzBlock, size_t *pcbBlock)
+{
+    RTENV           hClone  = NIL_RTENV;
+    PRTENVINTERNAL  pIntEnv;
+    int             rc;
+
+    /*
+     * Validate / simplify input.
+     */
+    if (hEnv == RTENV_DEFAULT)
+    {
+        rc = RTEnvClone(&hClone, RTENV_DEFAULT);
+        if (RT_FAILURE(rc))
+            return rc;
+        pIntEnv = hClone;
+    }
+    else
+    {
+        pIntEnv = hEnv;
+        AssertPtrReturn(pIntEnv, VERR_INVALID_HANDLE);
+        AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
+        rc = VINF_SUCCESS;
+    }
+
+    RTENV_LOCK(pIntEnv);
+
+    /*
+     * Sort it, if requested.
+     */
+    if (fSorted)
+        RTSortApvShell((void **)pIntEnv->papszEnv, pIntEnv->cVars, rtEnvSortCompare, pIntEnv);
+
+    /*
+     * Calculate the size. We add one extra terminator just to be on the safe side.
+     */
+    size_t cbBlock = 2;
+    for (size_t iVar = 0; iVar < pIntEnv->cVars; iVar++)
+        cbBlock += strlen(pIntEnv->papszEnv[iVar]) + 1;
+
+    if (pcbBlock)
+        *pcbBlock = cbBlock - 1;
+
+    /*
+     * Allocate memory and copy out the variables.
+     */
+    char *pszzBlock;
+    char *pszz = pszzBlock = (char *)RTMemAlloc(cbBlock);
+    if (pszz)
+    {
+        size_t cbLeft = cbBlock;
+        for (size_t iVar = 0; iVar < pIntEnv->cVars; iVar++)
+        {
+            size_t cb = strlen(pIntEnv->papszEnv[iVar]) + 1;
+            AssertBreakStmt(cb + 2 <= cbLeft, rc = VERR_INTERNAL_ERROR_3);
+            memcpy(pszz, pIntEnv->papszEnv[iVar], cb);
+            pszz   += cb;
+            cbLeft -= cb;
+        }
+        if (RT_SUCCESS(rc))
+        {
+            pszz[0] = '\0';
+            pszz[1] = '\0'; /* The extra one. */
+        }
+        else
+        {
+            RTMemFree(pszzBlock);
+            pszzBlock = NULL;
+        }
+    }
+    else
+        rc = VERR_NO_MEMORY;
+
+    RTENV_UNLOCK(pIntEnv);
+
+    if (hClone != NIL_RTENV)
+        RTEnvDestroy(hClone);
+    if (RT_SUCCESS(rc))
+        *ppszzBlock = pszzBlock;
+    return rc;
+}
+RT_EXPORT_SYMBOL(RTEnvQueryUtf8Block);
+
+
+RTDECL(void) RTEnvFreeUtf8Block(char *pszzBlock)
+{
+    RTMemFree(pszzBlock);
+}
+RT_EXPORT_SYMBOL(RTEnvFreeUtf8Block);
+
+
+RTDECL(uint32_t) RTEnvCountEx(RTENV hEnv)
+{
+    PRTENVINTERNAL pIntEnv = hEnv;
+    AssertPtrReturn(pIntEnv, UINT32_MAX);
+    AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, UINT32_MAX);
+
+    RTENV_LOCK(pIntEnv);
+    uint32_t cVars = (uint32_t)pIntEnv->cVars;
+    RTENV_UNLOCK(pIntEnv);
+
+    return cVars;
+}
+RT_EXPORT_SYMBOL(RTEnvCountEx);
+
+
+RTDECL(int) RTEnvGetByIndexEx(RTENV hEnv, uint32_t iVar, char *pszVar, size_t cbVar, char *pszValue, size_t cbValue)
+{
+    PRTENVINTERNAL pIntEnv = hEnv;
+    AssertPtrReturn(pIntEnv, UINT32_MAX);
+    AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, UINT32_MAX);
+    if (cbVar)
+        AssertPtrReturn(pszVar, VERR_INVALID_POINTER);
+    if (cbValue)
+        AssertPtrReturn(pszValue, VERR_INVALID_POINTER);
+
+    RTENV_LOCK(pIntEnv);
+
+    int rc;
+    if (iVar < pIntEnv->cVars)
+    {
+        const char *pszSrcVar   = pIntEnv->papszEnv[iVar];
+        const char *pszSrcValue = strchr(pszSrcVar, '=');
+        bool        fHasEqual   = pszSrcValue != NULL;
+        if (pszSrcValue)
+        {
+            pszSrcValue++;
+            rc = VINF_SUCCESS;
+        }
+        else
+        {
+            pszSrcValue = strchr(pszSrcVar, '\0');
+            rc = VINF_ENV_VAR_UNSET;
+        }
+        if (cbVar)
+        {
+            int rc2 = RTStrCopyEx(pszVar, cbVar, pszSrcVar, pszSrcValue - pszSrcVar - fHasEqual);
+            if (RT_FAILURE(rc2))
+                rc = rc2;
+        }
+        if (cbValue)
+        {
+            int rc2 = RTStrCopy(pszValue, cbValue, pszSrcValue);
+            if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
+                rc = rc2;
+        }
+    }
+    else
+        rc = VERR_ENV_VAR_NOT_FOUND;
+
+    RTENV_UNLOCK(pIntEnv);
+
+    return rc;
+}
+RT_EXPORT_SYMBOL(RTEnvGetByIndexEx);
+
+
+RTDECL(const char *) RTEnvGetByIndexRawEx(RTENV hEnv, uint32_t iVar)
+{
+    PRTENVINTERNAL pIntEnv = hEnv;
+    AssertPtrReturn(pIntEnv, NULL);
+    AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, NULL);
+
+    RTENV_LOCK(pIntEnv);
+
+    const char *pszRet;
+    if (iVar < pIntEnv->cVars)
+        pszRet = pIntEnv->papszEnv[iVar];
+    else
+        pszRet = NULL;
+
+    RTENV_UNLOCK(pIntEnv);
+
+    return pszRet;
+}
+RT_EXPORT_SYMBOL(RTEnvGetByIndexRawEx);
+
+
+RTDECL(int) RTEnvCreateChangeRecord(PRTENV phEnv)
+{
+    AssertPtrReturn(phEnv, VERR_INVALID_POINTER);
+    return rtEnvCreate(phEnv, RTENV_GROW_SIZE, false /*fCaseSensitive*/, true /*fPutEnvBlock*/);
+}
+RT_EXPORT_SYMBOL(RTEnvCreateChangeRecord);
+
+
+RTDECL(bool) RTEnvIsChangeRecord(RTENV hEnv)
+{
+    if (hEnv == RTENV_DEFAULT)
+        return false;
+
+    PRTENVINTERNAL pIntEnv = hEnv;
+    AssertPtrReturn(pIntEnv, false);
+    AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, false);
+    return pIntEnv->fPutEnvBlock;
+}
+RT_EXPORT_SYMBOL(RTEnvIsChangeRecord);
+
+
+RTDECL(int) RTEnvApplyChanges(RTENV hEnvDst, RTENV hEnvChanges)
+{
+    PRTENVINTERNAL pIntEnvChanges = hEnvChanges;
+    AssertPtrReturn(pIntEnvChanges, VERR_INVALID_HANDLE);
+    AssertReturn(pIntEnvChanges->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
+
+    /** @todo lock validator trouble ahead here! */
+    RTENV_LOCK(pIntEnvChanges);
+
+    int rc = VINF_SUCCESS;
+    for (uint32_t iChange = 0; iChange < pIntEnvChanges->cVars && RT_SUCCESS(rc); iChange++)
+        rc = RTEnvPutEx(hEnvDst, pIntEnvChanges->papszEnv[iChange]);
+
+    RTENV_UNLOCK(pIntEnvChanges);
+
+    return rc;
+}
+RT_EXPORT_SYMBOL(RTEnvApplyChanges);
+
diff --git a/src/VBox/Runtime/generic/spinlock-generic.cpp b/src/VBox/Runtime/generic/spinlock-generic.cpp
index 45039d0..9891b71 100644
--- a/src/VBox/Runtime/generic/spinlock-generic.cpp
+++ b/src/VBox/Runtime/generic/spinlock-generic.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -62,7 +62,7 @@
  */
 typedef struct RTSPINLOCKINTERNAL
 {
-    /** Spinlock magic value (RTSPINLOCK_MAGIC). */
+    /** Spinlock magic value (RTSPINLOCK_GEN_MAGIC). */
     uint32_t            u32Magic;
     /** The spinlock creation flags. */
     uint32_t            fFlags;
@@ -88,7 +88,7 @@ RTDECL(int)  RTSpinlockCreate(PRTSPINLOCK pSpinlock, uint32_t fFlags, const char
     /*
      * Initialize and return.
      */
-    pThis->u32Magic  = RTSPINLOCK_MAGIC;
+    pThis->u32Magic  = RTSPINLOCK_GEN_MAGIC;
     pThis->fFlags    = fFlags;
     pThis->fIntSaved = 0;
     ASMAtomicWriteU32(&pThis->fLocked, 0);
@@ -107,7 +107,7 @@ RTDECL(int)  RTSpinlockDestroy(RTSPINLOCK Spinlock)
     PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)Spinlock;
     if (!pThis)
         return VERR_INVALID_PARAMETER;
-    if (pThis->u32Magic != RTSPINLOCK_MAGIC)
+    if (pThis->u32Magic != RTSPINLOCK_GEN_MAGIC)
     {
         AssertMsgFailed(("Invalid spinlock %p magic=%#x\n", pThis, pThis->u32Magic));
         return VERR_INVALID_PARAMETER;
@@ -123,7 +123,7 @@ RT_EXPORT_SYMBOL(RTSpinlockDestroy);
 RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)
 {
     PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)Spinlock;
-    AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_MAGIC,
+    AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_GEN_MAGIC,
               ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
 
     if (pThis->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)
@@ -199,7 +199,7 @@ RT_EXPORT_SYMBOL(RTSpinlockAcquire);
 RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
 {
     PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)Spinlock;
-    AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_MAGIC,
+    AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_GEN_MAGIC,
               ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
 
     if (pThis->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)
@@ -224,16 +224,3 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
 }
 RT_EXPORT_SYMBOL(RTSpinlockRelease);
 
-
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
-{
-#if 1
-    if (RT_UNLIKELY(!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)))
-        RTAssertMsg2("RTSpinlockReleaseNoInts: %p (magic=%#x)\n", Spinlock, Spinlock->u32Magic);
-#else
-    AssertRelease(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE);
-#endif
-    RTSpinlockRelease(Spinlock);
-}
-RT_EXPORT_SYMBOL(RTSpinlockReleaseNoInts);
-
diff --git a/src/VBox/Runtime/include/internal/dbgmod.h b/src/VBox/Runtime/include/internal/dbgmod.h
index cf35ef1..c71e36b 100644
--- a/src/VBox/Runtime/include/internal/dbgmod.h
+++ b/src/VBox/Runtime/include/internal/dbgmod.h
@@ -640,27 +640,6 @@ typedef struct RTDBGMODINT
 typedef RTDBGMODINT *PRTDBGMODINT;
 
 
-/**
- * Special segment package used passing segment order information for mach-o
- * images (mainly mach_kernel, really).
- *
- * Passes to rtDbgModDwarf_TryOpen via RTDBGMODINF::pvDbgPriv.
- */
-typedef struct RTDBGDWARFSEGPKG
-{
-    /** Pointer to the segment array. */
-    PCRTDBGSEGMENT      paSegs;
-    /** Number of segments. */
-    uint32_t            cSegs;
-    /** For use more internal use in file locator callbacks. */
-    RTLDRARCH           enmArch;
-    /** For use more internal use in file locator callbacks. */
-    PCRTUUID            pUuid;
-} RTDBGDWARFSEGPKG;
-/** Pointer to a const segment package. */
-typedef RTDBGDWARFSEGPKG const *PCRTDBGDWARFSEGPKG;
-
-
 extern DECLHIDDEN(RTSTRCACHE)           g_hDbgModStrCache;
 extern DECLHIDDEN(RTDBGMODVTDBG const)  g_rtDbgModVtDbgCodeView;
 extern DECLHIDDEN(RTDBGMODVTDBG const)  g_rtDbgModVtDbgDwarf;
diff --git a/src/VBox/Runtime/include/internal/dir.h b/src/VBox/Runtime/include/internal/dir.h
index 8a85a1e..e8e95e8 100644
--- a/src/VBox/Runtime/include/internal/dir.h
+++ b/src/VBox/Runtime/include/internal/dir.h
@@ -90,7 +90,7 @@ typedef struct RTDIR
 # ifdef RT_OS_WINDOWS
     /** Handle to the opened directory search. */
     HANDLE              hDir;
-#  ifndef RT_USE_NATIVE_NT
+#  ifndef RTNT_USE_NATIVE_NT
     /** Find data buffer.
      * fDataUnread indicates valid data. */
     WIN32_FIND_DATAW    Data;
diff --git a/src/VBox/Runtime/include/internal/iprt.h b/src/VBox/Runtime/include/internal/iprt.h
index 3cadf9d..15fa196 100644
--- a/src/VBox/Runtime/include/internal/iprt.h
+++ b/src/VBox/Runtime/include/internal/iprt.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2012 Oracle Corporation
+ * Copyright (C) 2009-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -62,7 +62,7 @@
 
 
 /** @def RT_MORE_STRICT
- * Enables more assertions in IPRT.  */
+ * Enables more assertions in IPRT. */
 #if !defined(RT_MORE_STRICT) && (defined(DEBUG) || defined(RT_STRICT) || defined(DOXYGEN_RUNNING)) && !defined(RT_OS_WINDOWS) /** @todo enable on windows after testing */
 # define RT_MORE_STRICT
 #endif
@@ -97,7 +97,7 @@
 /** @def RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED
  * Extended version of RT_ASSERT_PREEMPT_CPUID for use before
  * RTSpinlockAcquired* returns.  This macro works the idCpuOwner and idAssertCpu
- * members of the spinlock instance data.  */
+ * members of the spinlock instance data. */
 #ifdef RT_MORE_STRICT
 # define RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED(pThis) \
     do \
@@ -171,7 +171,7 @@
 
 
 /** @def RT_ASSERT_INTS_ON
- * Asserts that interrupts are disabled when RT_MORE_STRICT is defined.   */
+ * Asserts that interrupts are disabled when RT_MORE_STRICT is defined. */
 #ifdef RT_MORE_STRICT
 # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
 #  define RT_ASSERT_INTS_ON()           Assert(ASMIntAreEnabled())
diff --git a/src/VBox/Runtime/include/internal/magics.h b/src/VBox/Runtime/include/internal/magics.h
index 16be900..008504e 100644
--- a/src/VBox/Runtime/include/internal/magics.h
+++ b/src/VBox/Runtime/include/internal/magics.h
@@ -170,6 +170,8 @@
 #define RTSOCKET_MAGIC_DEAD             UINT32_C(0x20060326)
 /** Magic value for RTSPINLOCKINTERNAL::u32Magic. (Terry Pratchett) */
 #define RTSPINLOCK_MAGIC                UINT32_C(0x19480428)
+/** Magic value for generic RTSPINLOCKINTERNAL::u32Magic (Georges Prosper Remi). */
+#define RTSPINLOCK_GEN_MAGIC            UINT32_C(0x10970522)
 /** Magic value for RTSTRCACHE::u32Magic. (Sir Arthur Charles Clarke) */
 #define RTSTRCACHE_MAGIC                UINT32_C(0x19171216)
 /** Magic value for RTSTRCACHE::u32Magic after RTStrCacheDestroy. */
@@ -190,8 +192,8 @@
 #define RTTARFILE_MAGIC_DEAD            UINT32_C(0x19120420)
 /** RTTESTINT::u32Magic value. (Daniel Kehlmann) */
 #define RTTESTINT_MAGIC                 UINT32_C(0x19750113)
-/** RTTHREADCTXINT::u32Magic value. (Dennis MacAlistair Ritchie) */
-#define RTTHREADCTXINT_MAGIC            UINT32_C(0x19410909)
+/** RTTHREADCTXHOOKINT::u32Magic value. (Dennis MacAlistair Ritchie) */
+#define RTTHREADCTXHOOKINT_MAGIC        UINT32_C(0x19410909)
 /** RTTHREADINT::u32Magic value. (Gilbert Keith Chesterton) */
 #define RTTHREADINT_MAGIC               UINT32_C(0x18740529)
 /** RTTHREADINT::u32Magic value for a dead thread. */
diff --git a/src/VBox/Runtime/include/internal/socket.h b/src/VBox/Runtime/include/internal/socket.h
index a8ab307..e6a518b 100644
--- a/src/VBox/Runtime/include/internal/socket.h
+++ b/src/VBox/Runtime/include/internal/socket.h
@@ -55,6 +55,7 @@ int rtSocketResolverError(void);
 int rtSocketCreateForNative(RTSOCKETINT **ppSocket, RTSOCKETNATIVE hNative);
 int rtSocketCreate(PRTSOCKET phSocket, int iDomain, int iType, int iProtocol);
 int rtSocketBind(RTSOCKET hSocket, PCRTNETADDR pAddr);
+int rtSocketBindRawAddr(RTSOCKET hSocket, void const *pvAddr, size_t cbAddr);
 int rtSocketListen(RTSOCKET hSocket, int cMaxPending);
 int rtSocketAccept(RTSOCKET hSocket, PRTSOCKET phClient, struct sockaddr *pAddr, size_t *pcbAddr);
 int rtSocketConnect(RTSOCKET hSocket, PCRTNETADDR pAddr, RTMSINTERVAL cMillies);
diff --git a/src/VBox/Runtime/include/internal/thread.h b/src/VBox/Runtime/include/internal/thread.h
index 337b0bf..11e5b88 100644
--- a/src/VBox/Runtime/include/internal/thread.h
+++ b/src/VBox/Runtime/include/internal/thread.h
@@ -75,6 +75,10 @@ typedef struct RTTHREADINT
      * This is not valid before rtThreadMain has been called by the new thread.  */
     pid_t                   tid;
 #endif
+#if defined(RT_OS_SOLARIS) && defined(IN_RING0)
+    /** Debug thread ID needed for thread_join. */
+    uint64_t                tid;
+#endif
     /** The user event semaphore. */
     RTSEMEVENTMULTI         EventUser;
     /** The terminated event semaphore. */
@@ -175,6 +179,17 @@ DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread);
  */
 DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread);
 
+#ifdef IN_RING0
+/**
+ * Called from rtThreadWait when the last thread has completed in order to make
+ * sure it's all the way out of IPRT before RTR0Term is called.
+ *
+ * @param   pThread     The thread structure.
+ */
+DECLHIDDEN(void) rtThreadNativeWaitKludge(PRTTHREADINT pThread);
+#endif
+
+
 /**
  * Sets the priority of the thread according to the thread type
  * and current process priority.
@@ -198,8 +213,14 @@ DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enm
  * threads properly.
  */
 DECLHIDDEN(void) rtThreadNativeDetach(void);
+
+/**
+ * Internal function for informing the debugger about a thread.
+ * @param   pThread     The thread. May differ from the calling thread.
+ */
+DECLHIDDEN(void) rtThreadNativeInformDebugger(PRTTHREADINT pThread);
 # endif
-#endif /* !IN_RING0 */
+#endif /* IN_RING3 */
 
 
 /* thread.cpp */
diff --git a/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp b/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp
index 6a3f8d7..88cb45d 100644
--- a/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp
+++ b/src/VBox/Runtime/nt/RTErrConvertFromNtStatus.cpp
@@ -52,6 +52,8 @@ RTDECL(int)  RTErrConvertFromNtStatus(long lNativeCode)
 
         case STATUS_INVALID_HANDLE:         return VERR_INVALID_HANDLE;
         case STATUS_INVALID_PARAMETER:      return VERR_INVALID_PARAMETER;
+        case STATUS_NO_SUCH_DEVICE:         return VERR_FILE_NOT_FOUND;
+        case STATUS_NO_SUCH_FILE:           return VERR_FILE_NOT_FOUND;
         case STATUS_INVALID_DEVICE_REQUEST: return VERR_IO_BAD_COMMAND;
         case STATUS_ACCESS_DENIED:          return VERR_ACCESS_DENIED;
         case STATUS_OBJECT_TYPE_MISMATCH:   return VERR_UNEXPECTED_FS_OBJ_TYPE;
diff --git a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp
index 48d0e09..40449cb 100644
--- a/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/mp-r0drv-darwin.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2011 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -77,6 +77,18 @@ RTDECL(RTCPUID) RTMpCpuId(void)
 }
 
 
+RTDECL(int) RTMpCurSetIndex(void)
+{
+    return cpu_number();
+}
+
+
+RTDECL(int) RTMpCurSetIndexAndId(PRTCPUID pidCpu)
+{
+    return *pidCpu = cpu_number();
+}
+
+
 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
 {
     return idCpu < RTCPUSET_MAX_CPUS ? (int)idCpu : -1;
@@ -270,3 +282,9 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
     return VINF_SUCCESS;
 }
 
+
+RTDECL(bool) RTMpOnAllIsConcurrentSafe(void)
+{
+    return true;
+}
+
diff --git a/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp
index ef0f9d8..fb20b58 100644
--- a/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/semmutex-r0drv-darwin.cpp
@@ -121,7 +121,7 @@ RTDECL(int)  RTSemMutexDestroy(RTSEMMUTEX hMutexSem)
      * Validate input.
      */
     PRTSEMMUTEXINTERNAL pThis = (PRTSEMMUTEXINTERNAL)hMutexSem;
-    if (!pThis)
+    if (pThis == NIL_RTSEMMUTEX)
         return VERR_INVALID_PARAMETER;
     AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     AssertMsgReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, ("u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis), VERR_INVALID_HANDLE);
diff --git a/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
index bc744da..f3202b9 100644
--- a/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/spinlock-r0drv-darwin.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -160,15 +160,3 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
         lck_spin_unlock(pThis->pSpinLock);
 }
 
-
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
-{
-#if 1
-    if (RT_UNLIKELY(!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)))
-        RTAssertMsg2("RTSpinlockReleaseNoInts: %p (%s)\n", Spinlock, Spinlock->pszName);
-#else
-    AssertRelease(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE);
-#endif
-    RTSpinlockRelease(Spinlock);
-}
-
diff --git a/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp
index 139c015..431bea8 100644
--- a/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/thread2-r0drv-darwin.cpp
@@ -136,6 +136,13 @@ DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
 }
 
 
+DECLHIDDEN(void) rtThreadNativeWaitKludge(PRTTHREADINT pThread)
+{
+    /** @todo fix RTThreadWait/RTR0Term race on darwin. */
+    RTThreadSleep(1);
+}
+
+
 DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
 {
     NOREF(pThread);
diff --git a/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp b/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp
index 4d9ef80..aa0b4d7 100644
--- a/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp
+++ b/src/VBox/Runtime/r0drv/darwin/time-r0drv-darwin.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -67,7 +67,7 @@ RTDECL(uint64_t) RTTimeNanoTS(void)
 
 RTDECL(uint64_t) RTTimeMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
 
@@ -79,7 +79,7 @@ RTDECL(uint64_t) RTTimeSystemNanoTS(void)
 
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
 
@@ -93,6 +93,6 @@ RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
     clock_nsec_t    uNanosecs;
 #endif
     clock_get_calendar_nanotime(&uSecs, &uNanosecs);
-    return RTTimeSpecSetNano(pTime, (uint64_t)uSecs * 1000000000 + uNanosecs);
+    return RTTimeSpecSetNano(pTime, (uint64_t)uSecs * RT_NS_1SEC + uNanosecs);
 }
 
diff --git a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
index 2486fd1..3fc3b9e 100644
--- a/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
@@ -168,14 +168,18 @@ DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)
             VM_OBJECT_LOCK(pMemFreeBSD->pObject);
 #endif
             vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
+#if __FreeBSD_version < 1000000
             vm_page_lock_queues();
+#endif
             for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0);
                  pPage != NULL;
                  pPage = vm_page_next(pPage))
             {
                 vm_page_unwire(pPage, 0);
             }
+#if __FreeBSD_version < 1000000
             vm_page_unlock_queues();
+#endif
 #if __FreeBSD_version >= 1000030
             VM_OBJECT_WUNLOCK(pMemFreeBSD->pObject);
 #else
@@ -291,11 +295,15 @@ static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
             while (iPage-- > 0)
             {
                 pPage = vm_page_lookup(pObject, iPage);
+#if __FreeBSD_version < 1000000
                 vm_page_lock_queues();
+#endif
                 if (fWire)
                     vm_page_unwire(pPage, 0);
                 vm_page_free(pPage);
+#if __FreeBSD_version < 1000000
                 vm_page_unlock_queues();
+#endif
             }
 #if __FreeBSD_version >= 1000030
             VM_OBJECT_WUNLOCK(pObject);
diff --git a/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
index a38e78a..8c05a38 100644
--- a/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2011 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -43,6 +43,18 @@ RTDECL(RTCPUID) RTMpCpuId(void)
 }
 
 
+RTDECL(int) RTMpCurSetIndex(void)
+{
+    return curcpu;
+}
+
+
+RTDECL(int) RTMpCurSetIndexAndId(PRTCPUID pidCpu)
+{
+    return *pidCpu = curcpu;
+}
+
+
 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
 {
     return idCpu < RTCPUSET_MAX_CPUS && idCpu <= mp_maxid ? (int)idCpu : -1;
@@ -288,3 +300,9 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
 }
 #endif /* < 7.0 */
 
+
+RTDECL(bool) RTMpOnAllIsConcurrentSafe(void)
+{
+    return true;
+}
+
diff --git a/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
index ae07431..d4d46d6 100644
--- a/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
@@ -207,15 +207,3 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
     critical_exit();
 }
 
-
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
-{
-#if 1
-    if (RT_UNLIKELY(!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)))
-        RTAssertMsg2("RTSpinlockReleaseNoInts: %p (magic=%#x)\n", Spinlock, Spinlock->u32Magic);
-#else
-    AssertRelease(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE);
-#endif
-    RTSpinlockRelease(Spinlock);
-}
-
diff --git a/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c
index 4f356c2..0515f02 100644
--- a/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/thread2-r0drv-freebsd.c
@@ -98,6 +98,13 @@ DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
 }
 
 
+DECLHIDDEN(void) rtThreadNativeWaitKludge(PRTTHREADINT pThread)
+{
+    /** @todo fix RTThreadWait/RTR0Term race on freebsd. */
+    RTThreadSleep(1);
+}
+
+
 DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
 {
     NOREF(pThread);
diff --git a/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c
index 7f356a1..5e6c8ae 100644
--- a/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/time-r0drv-freebsd.c
@@ -42,14 +42,14 @@ RTDECL(uint64_t) RTTimeNanoTS(void)
 {
     struct timespec tsp;
     nanouptime(&tsp);
-    return tsp.tv_sec * UINT64_C(1000000000)
+    return tsp.tv_sec * RT_NS_1SEC_64
          + tsp.tv_nsec;
 }
 
 
 RTDECL(uint64_t) RTTimeMilliTS(void)
 {
-    return RTTimeNanoTS() / 1000;
+    return RTTimeNanoTS() / RT_NS_1MS;
 }
 
 
@@ -71,3 +71,4 @@ RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
     nanotime(&tsp);
     return RTTimeSpecSetTimespec(pTime, &tsp);
 }
+
diff --git a/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c b/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c
index 43f693f..220a2d2 100644
--- a/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c
+++ b/src/VBox/Runtime/r0drv/freebsd/timer-r0drv-freebsd.c
@@ -62,7 +62,7 @@ typedef struct RTTIMER
     /** Whether the timer must run on a specific CPU or not. */
     uint8_t                 fSpecificCpu;
     /** The CPU it must run on if fSpecificCpu is set. */
-    uint8_t                 iCpu;
+    uint32_t                iCpu;
     /** The FreeBSD callout structure. */
     struct callout          Callout;
     /** Callback. */
diff --git a/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp
index ba352a6..3df4d92 100644
--- a/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/RTMpOn-r0drv-generic.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2010 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -44,6 +44,13 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 RT_EXPORT_SYMBOL(RTMpOnAll);
 
 
+RTDECL(bool) RTMpOnAllIsConcurrentSafe(void)
+{
+    return false;
+}
+RT_EXPORT_SYMBOL(RTMpOnAllIsConcurrentSafe);
+
+
 RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
     NOREF(pfnWorker);
@@ -64,3 +71,23 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
 }
 RT_EXPORT_SYMBOL(RTMpOnSpecific);
 
+
+RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+{
+    NOREF(idCpu1);
+    NOREF(idCpu2);
+    NOREF(pfnWorker);
+    NOREF(pvUser1);
+    NOREF(pvUser2);
+    return VERR_NOT_SUPPORTED;
+}
+RT_EXPORT_SYMBOL(RTMpOnPair);
+
+
+
+RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void)
+{
+    return false;
+}
+RT_EXPORT_SYMBOL(RTMpOnPairIsConcurrentExecSupported);
+
diff --git a/src/VBox/Runtime/r0drv/generic/threadctxhooks-r0drv-generic.cpp b/src/VBox/Runtime/r0drv/generic/threadctxhooks-r0drv-generic.cpp
index cce89ba..4e625b5 100644
--- a/src/VBox/Runtime/r0drv/generic/threadctxhooks-r0drv-generic.cpp
+++ b/src/VBox/Runtime/r0drv/generic/threadctxhooks-r0drv-generic.cpp
@@ -1,10 +1,10 @@
 /* $Id: threadctxhooks-r0drv-generic.cpp $ */
 /** @file
- * IPRT - Thread-Context Hooks, Ring-0 Driver, Generic.
+ * IPRT - Thread Context Switching Hook, Ring-0 Driver, Generic.
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -33,52 +33,43 @@
 
 #include "internal/iprt.h"
 
-RTDECL(int) RTThreadCtxHooksCreate(PRTTHREADCTX phThreadCtx)
+RTDECL(int) RTThreadCtxHookCreate(PRTTHREADCTXHOOK phCtxHook, uint32_t fFlags, PFNRTTHREADCTXHOOK pfnCallback, void *pvUser)
 {
-    NOREF(phThreadCtx);
+    NOREF(phCtxHook);
+    NOREF(pfnCallback);
+    NOREF(pvUser);
     return VERR_NOT_SUPPORTED;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksCreate);
-
-
-RTDECL(uint32_t) RTThreadCtxHooksRelease(RTTHREADCTX hThreadCtx)
-{
-    NOREF(hThreadCtx);
-    return UINT32_MAX;
-}
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRelease);
+RT_EXPORT_SYMBOL(RTThreadCtxHookCreate);
 
 
-RTDECL(uint32_t) RTThreadCtxHooksRetain(RTTHREADCTX hThreadCtx)
+RTDECL(int) RTThreadCtxHookDestroy(RTTHREADCTXHOOK hCtxHook)
 {
-    NOREF(hThreadCtx);
-    return UINT32_MAX;
+    return hCtxHook == NIL_RTTHREADCTXHOOK ? VINF_SUCCESS : VERR_INVALID_HANDLE;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRetain);
+RT_EXPORT_SYMBOL(RTThreadCtxHookDestroy);
 
 
-RTDECL(int) RTThreadCtxHooksRegister(RTTHREADCTX hThreadCtx, PFNRTTHREADCTXHOOK pfnCallback, void *pvUser)
+RTDECL(int) RTThreadCtxHookEnable(RTTHREADCTXHOOK hCtxHook)
 {
-    NOREF(hThreadCtx);
-    NOREF(pfnCallback);
-    NOREF(pvUser);
+    NOREF(hCtxHook);
     return VERR_NOT_SUPPORTED;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRegister);
+RT_EXPORT_SYMBOL(RTThreadCtxHookEnable);
 
 
-RTDECL(int) RTThreadCtxHooksDeregister(RTTHREADCTX hThreadCtx)
+RTDECL(int) RTThreadCtxHookDisable(RTTHREADCTXHOOK hCtxHook)
 {
-    NOREF(hThreadCtx);
+    NOREF(hCtxHook);
     return VERR_NOT_SUPPORTED;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksDeregister);
+RT_EXPORT_SYMBOL(RTThreadCtxHookDisable);
 
 
-RTDECL(bool) RTThreadCtxHooksAreRegistered(RTTHREADCTX hThreadCtx)
+RTDECL(bool) RTThreadCtxHookIsEnabled(RTTHREADCTXHOOK hCtxHook)
 {
-    NOREF(hThreadCtx);
+    NOREF(hCtxHook);
     return false;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksAreRegistered);
+RT_EXPORT_SYMBOL(RTThreadCtxHookIsEnabled);
 
diff --git a/src/VBox/Runtime/r0drv/haiku/mp-r0drv-haiku.c b/src/VBox/Runtime/r0drv/haiku/mp-r0drv-haiku.c
index 0d0af54..81930b0 100644
--- a/src/VBox/Runtime/r0drv/haiku/mp-r0drv-haiku.c
+++ b/src/VBox/Runtime/r0drv/haiku/mp-r0drv-haiku.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -43,6 +43,18 @@ RTDECL(RTCPUID) RTMpCpuId(void)
 }
 
 
+RTDECL(int) RTMpCurSetIndex(void)
+{
+    return smp_get_current_cpu();
+}
+
+
+RTDECL(int) RTMpCurSetIndexAndId(PRTCPUID pidCpu)
+{
+    return *pidCpu = smp_get_current_cpu();
+}
+
+
 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
 {
     return idCpu < smp_get_num_cpus() ? (int)idCpu : -1;
@@ -216,3 +228,9 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
            : VERR_CPU_NOT_FOUND;
 }
 
+
+RTDECL(bool) RTMpOnAllIsConcurrentSafe(void)
+{
+    return true;
+}
+
diff --git a/src/VBox/Runtime/r0drv/haiku/spinlock-r0drv-haiku.c b/src/VBox/Runtime/r0drv/haiku/spinlock-r0drv-haiku.c
index 6ffed17..a77d0de 100644
--- a/src/VBox/Runtime/r0drv/haiku/spinlock-r0drv-haiku.c
+++ b/src/VBox/Runtime/r0drv/haiku/spinlock-r0drv-haiku.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -136,11 +136,3 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
     restore_interrupts(pSpinlockInt->fIntSaved);
 }
 
-
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
-{
-    if (!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE))
-        RTAssertMsg2("RTSpinlockReleaseNoInts: p=%p (magic=%#x)\n", Spinlock, Spinlock->u32Magic);
-    RTSpinlockRelease(Spinlock);
-}
-
diff --git a/src/VBox/Runtime/r0drv/haiku/thread2-r0drv-haiku.c b/src/VBox/Runtime/r0drv/haiku/thread2-r0drv-haiku.c
index f4c4a47..ad76b99 100644
--- a/src/VBox/Runtime/r0drv/haiku/thread2-r0drv-haiku.c
+++ b/src/VBox/Runtime/r0drv/haiku/thread2-r0drv-haiku.c
@@ -40,7 +40,7 @@
 #include "internal/thread.h"
 
 
-int rtThreadNativeInit(void)
+DECLHIDDEN(int) rtThreadNativeInit(void)
 {
     /* No TLS in Ring-0. :-/ */
     return VINF_SUCCESS;
@@ -53,7 +53,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
 }
 
 
-int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
+DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
 {
     int32 iPriority;
     status_t status;
@@ -81,13 +81,20 @@ int rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
 }
 
 
-int rtThreadNativeAdopt(PRTTHREADINT pThread)
+DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
 {
     return VERR_NOT_IMPLEMENTED;
 }
 
 
-void rtThreadNativeDestroy(PRTTHREADINT pThread)
+DECLHIDDEN(void) rtThreadNativeWaitKludge(PRTTHREADINT pThread)
+{
+    /** @todo fix RTThreadWait/RTR0Term race on freebsd. */
+    RTThreadSleep(1);
+}
+
+
+DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
 {
     NOREF(pThread);
 }
@@ -114,7 +121,7 @@ static status_t rtThreadNativeMain(void *pvArg)
 }
 
 
-int rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
+DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
 {
     thread_id NativeThread;
     RT_ASSERT_PREEMPTIBLE();
diff --git a/src/VBox/Runtime/r0drv/haiku/time-r0drv-haiku.c b/src/VBox/Runtime/r0drv/haiku/time-r0drv-haiku.c
index 889ac19..36b8788 100644
--- a/src/VBox/Runtime/r0drv/haiku/time-r0drv-haiku.c
+++ b/src/VBox/Runtime/r0drv/haiku/time-r0drv-haiku.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -38,13 +38,13 @@
 
 DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
 {
-    return system_time() * 1000;
+    return system_time() * RT_NS_1US;
 }
 
 
 DECLINLINE(uint64_t) rtTimeGetSystemMilliTS(void)
 {
-    return system_time() / 1000;
+    return system_time() / RT_NS_1US;
 }
 
 
@@ -74,6 +74,6 @@ RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 
 RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
 {
-    return RTTimeSpecSetNano(pTime, real_time_clock_usecs() * 1000);
+    return RTTimeSpecSetNano(pTime, real_time_clock_usecs() * RT_NS_1US);
 }
 
diff --git a/src/VBox/Runtime/r0drv/initterm-r0drv.cpp b/src/VBox/Runtime/r0drv/initterm-r0drv.cpp
index db963fe..97a700f 100644
--- a/src/VBox/Runtime/r0drv/initterm-r0drv.cpp
+++ b/src/VBox/Runtime/r0drv/initterm-r0drv.cpp
@@ -66,7 +66,9 @@ RTR0DECL(int) RTR0Init(unsigned fReserved)
     int rc;
     uint32_t cNewUsers;
     Assert(fReserved == 0);
+#ifndef RT_OS_SOLARIS       /* On Solaris our thread preemption information is only obtained in rtR0InitNative().*/
     RT_ASSERT_PREEMPTIBLE();
+#endif
 
     /*
      * The first user initializes it.
diff --git a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
index 7c6064a..9b03f7f 100644
--- a/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
@@ -37,7 +37,7 @@
 #include "r0drv/alloc-r0drv.h"
 
 
-#if defined(RT_ARCH_AMD64) || defined(DOXYGEN_RUNNING)
+#if (defined(RT_ARCH_AMD64) || defined(DOXYGEN_RUNNING)) && !defined(RTMEMALLOC_EXEC_HEAP)
 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
 /**
  * Starting with 2.6.23 we can use __get_vm_area and map_vm_area to allocate
@@ -95,6 +95,7 @@ typedef RTMEMLNXHDREX *PRTMEMLNXHDREX;
 static RTHEAPSIMPLE g_HeapExec = NIL_RTHEAPSIMPLE;
 /** Spinlock protecting the heap. */
 static RTSPINLOCK   g_HeapExecSpinlock = NIL_RTSPINLOCK;
+#endif
 
 
 /**
@@ -103,8 +104,10 @@ static RTSPINLOCK   g_HeapExecSpinlock = NIL_RTSPINLOCK;
  */
 DECLHIDDEN(void) rtR0MemExecCleanup(void)
 {
+#ifdef RTMEMALLOC_EXEC_HEAP
     RTSpinlockDestroy(g_HeapExecSpinlock);
     g_HeapExecSpinlock = NIL_RTSPINLOCK;
+#endif
 }
 
 
@@ -120,11 +123,13 @@ DECLHIDDEN(void) rtR0MemExecCleanup(void)
  * The API only accept one single donation.
  *
  * @returns IPRT status code.
+ * @retval  VERR_NOT_SUPPORTED if the code isn't enabled.
  * @param   pvMemory    Pointer to the memory block.
  * @param   cb          The size of the memory block.
  */
 RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb)
 {
+#ifdef RTMEMALLOC_EXEC_HEAP
     int rc;
     AssertReturn(g_HeapExec == NIL_RTHEAPSIMPLE, VERR_WRONG_ORDER);
 
@@ -136,10 +141,12 @@ RTR0DECL(int) RTR0MemExecDonate(void *pvMemory, size_t cb)
             rtR0MemExecCleanup();
     }
     return rc;
+#else
+    return VERR_NOT_SUPPORTED;
+#endif
 }
 RT_EXPORT_SYMBOL(RTR0MemExecDonate);
 
-#endif /* RTMEMALLOC_EXEC_HEAP */
 
 
 #ifdef RTMEMALLOC_EXEC_VM_AREA
diff --git a/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
index fda6e35..896b8b0 100644
--- a/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/initterm-r0drv-linux.c
@@ -49,10 +49,8 @@ static DECLARE_TASK_QUEUE(g_rtR0LnxWorkQueue);
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-#if defined(RT_ARCH_AMD64) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
 /* in alloc-r0drv0-linux.c */
 DECLHIDDEN(void) rtR0MemExecCleanup(void);
-#endif
 
 
 /**
@@ -97,7 +95,11 @@ DECLHIDDEN(void) rtR0LnxWorkqueueFlush(void)
 DECLHIDDEN(int) rtR0InitNative(void)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)
-    g_prtR0LnxWorkQueue = create_workqueue("iprt");
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
+    g_prtR0LnxWorkQueue = create_workqueue("iprt-VBoxWQueue");
+ #else
+    g_prtR0LnxWorkQueue = create_workqueue("iprt-VBoxQ");
+ #endif
     if (!g_prtR0LnxWorkQueue)
         return VERR_NO_MEMORY;
 #endif
@@ -114,8 +116,6 @@ DECLHIDDEN(void) rtR0TermNative(void)
     g_prtR0LnxWorkQueue = NULL;
 #endif
 
-#if defined(RT_ARCH_AMD64) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
     rtR0MemExecCleanup();
-#endif
 }
 
diff --git a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
index fd35307..62b38b1 100644
--- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
@@ -1,4 +1,4 @@
-/* $Revision: 94832 $ */
+/* $Id: memobj-r0drv-linux.c $ */
 /** @file
  * IPRT - Ring-0 Memory Objects, Linux.
  */
diff --git a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
index 88971ac..1a07375 100644
--- a/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/mp-r0drv-linux.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2011 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -46,6 +46,20 @@ RTDECL(RTCPUID) RTMpCpuId(void)
 RT_EXPORT_SYMBOL(RTMpCpuId);
 
 
+RTDECL(int) RTMpCurSetIndex(void)
+{
+    return smp_processor_id();
+}
+RT_EXPORT_SYMBOL(RTMpCurSetIndex);
+
+
+RTDECL(int) RTMpCurSetIndexAndId(PRTCPUID pidCpu)
+{
+    return *pidCpu = smp_processor_id();
+}
+RT_EXPORT_SYMBOL(RTMpCurSetIndexAndId);
+
+
 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
 {
     return idCpu < RTCPUSET_MAX_CPUS && idCpu < NR_CPUS ? (int)idCpu : -1;
@@ -186,7 +200,7 @@ RT_EXPORT_SYMBOL(RTMpIsCpuWorkPending);
 
 
 /**
- * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER
+ * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER.
  *
  * @param   pvInfo      Pointer to the RTMPARGS package.
  */
@@ -198,33 +212,94 @@ static void rtmpLinuxWrapper(void *pvInfo)
 }
 
 
+/**
+ * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER, does hit
+ * increment after calling the worker.
+ *
+ * @param   pvInfo      Pointer to the RTMPARGS package.
+ */
+static void rtmpLinuxWrapperPostInc(void *pvInfo)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)pvInfo;
+    pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2);
+    ASMAtomicIncU32(&pArgs->cHits);
+}
+
+
+/**
+ * Wrapper between the native linux all-cpu callbacks and PFNRTWORKER.
+ *
+ * @param   pvInfo      Pointer to the RTMPARGS package.
+ */
+static void rtmpLinuxAllWrapper(void *pvInfo)
+{
+    PRTMPARGS  pArgs      = (PRTMPARGS)pvInfo;
+    PRTCPUSET  pWorkerSet = pArgs->pWorkerSet;
+    RTCPUID    idCpu      = RTMpCpuId();
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+
+    if (RTCpuSetIsMember(pWorkerSet, idCpu))
+    {
+        pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+        RTCpuSetDel(pWorkerSet, idCpu);
+    }
+}
+
+
 RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
     int rc;
     RTMPARGS Args;
+    RTCPUSET OnlineSet;
+    RTCPUID  idCpu;
+    uint32_t cLoops;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
     RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
-#endif
-    Args.pfnWorker = pfnWorker;
-    Args.pvUser1 = pvUser1;
-    Args.pvUser2 = pvUser2;
-    Args.idCpu = NIL_RTCPUID;
-    Args.cHits = 0;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
-    rc = on_each_cpu(rtmpLinuxWrapper, &Args, 1 /* wait */);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
-    rc = on_each_cpu(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
-#else /* older kernels */
+    Args.pfnWorker  = pfnWorker;
+    Args.pvUser1    = pvUser1;
+    Args.pvUser2    = pvUser2;
+    Args.idCpu      = NIL_RTCPUID;
+    Args.cHits      = 0;
+
     RTThreadPreemptDisable(&PreemptState);
-    rc = smp_call_function(rtmpLinuxWrapper, &Args, 0 /* retry */, 1 /* wait */);
-    local_irq_disable();
-    rtmpLinuxWrapper(&Args);
-    local_irq_enable();
+    RTMpGetOnlineSet(&OnlineSet);
+    Args.pWorkerSet = &OnlineSet;
+    idCpu = RTMpCpuId();
+
+    if (RTCpuSetCount(&OnlineSet) > 1)
+    {
+        /* Fire the function on all other CPUs without waiting for completion. */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+        rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* wait */);
+#else
+        rc = smp_call_function(rtmpLinuxAllWrapper, &Args, 0 /* retry */, 0 /* wait */);
+#endif
+        Assert(!rc); NOREF(rc);
+    }
+
+    /* Fire the function on this CPU. */
+    Args.pfnWorker(idCpu, Args.pvUser1, Args.pvUser2);
+    RTCpuSetDel(Args.pWorkerSet, idCpu);
+
+    /* Wait for all of them finish. */
+    cLoops = 64000;
+    while (!RTCpuSetIsEmpty(Args.pWorkerSet))
+    {
+        /* Periodically check if any CPU in the wait set has gone offline, if so update the wait set. */
+        if (!cLoops--)
+        {
+            RTCPUSET OnlineSetNow;
+            RTMpGetOnlineSet(&OnlineSetNow);
+            RTCpuSetAnd(Args.pWorkerSet, &OnlineSetNow);
+
+            cLoops = 64000;
+        }
+
+        ASMNopPause();
+    }
+
     RTThreadPreemptRestore(&PreemptState);
-#endif /* older kernels */
-    Assert(rc == 0); NOREF(rc);
     return VINF_SUCCESS;
 }
 RT_EXPORT_SYMBOL(RTMpOnAll);
@@ -256,6 +331,129 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 RT_EXPORT_SYMBOL(RTMpOnOthers);
 
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
+/**
+ * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER
+ * employed by RTMpOnPair on older kernels that lacks smp_call_function_many.
+ *
+ * @param   pvInfo      Pointer to the RTMPARGS package.
+ */
+static void rtMpLinuxOnPairWrapper(void *pvInfo)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)pvInfo;
+    RTCPUID   idCpu = RTMpCpuId();
+
+    if (   idCpu == pArgs->idCpu
+        || idCpu == pArgs->idCpu2)
+    {
+        pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+        ASMAtomicIncU32(&pArgs->cHits);
+    }
+}
+#endif
+
+
+RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+{
+    int rc;
+    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+
+    AssertReturn(idCpu1 != idCpu2, VERR_INVALID_PARAMETER);
+    AssertReturn(!(fFlags & RTMPON_F_VALID_MASK), VERR_INVALID_FLAGS);
+
+    /*
+     * Check that both CPUs are online before doing the broadcast call.
+     */
+    RTThreadPreemptDisable(&PreemptState);
+    if (   RTMpIsCpuOnline(idCpu1)
+        && RTMpIsCpuOnline(idCpu2))
+    {
+        /*
+         * Use the smp_call_function variant taking a cpu mask where available,
+         * falling back on broadcast with filter.  Slight snag if one of the
+         * CPUs is the one we're running on, we must do the call and the post
+         * call wait ourselves.
+         */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+        cpumask_t   DstCpuMask;
+#endif
+        RTCPUID     idCpuSelf = RTMpCpuId();
+        bool const  fCallSelf = idCpuSelf == idCpu1 || idCpuSelf == idCpu2;
+        RTMPARGS    Args;
+        Args.pfnWorker = pfnWorker;
+        Args.pvUser1 = pvUser1;
+        Args.pvUser2 = pvUser2;
+        Args.idCpu   = idCpu1;
+        Args.idCpu2  = idCpu2;
+        Args.cHits   = 0;
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
+        cpumask_clear(&DstCpuMask);
+        cpumask_set_cpu(idCpu1, &DstCpuMask);
+        cpumask_set_cpu(idCpu2, &DstCpuMask);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+        cpus_clear(DstCpuMask);
+        cpu_set(idCpu1, DstCpuMask);
+        cpu_set(idCpu2, DstCpuMask);
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
+        smp_call_function_many(&DstCpuMask, rtmpLinuxWrapperPostInc, &Args, !fCallSelf /* wait */);
+        rc = 0;
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
+        rc = smp_call_function_many(&DstCpuMask, rtmpLinuxWrapperPostInc, &Args, !fCallSelf /* wait */);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
+        rc = smp_call_function_mask(DstCpuMask, rtmpLinuxWrapperPostInc, &Args, !fCallSelf /* wait */);
+#else /* older kernels */
+        rc = smp_call_function(rtMpLinuxOnPairWrapper, &Args, 0 /* retry */, !fCallSelf /* wait */);
+#endif /* older kernels */
+        Assert(rc == 0);
+
+        /* Call ourselves if necessary and wait for the other party to be done. */
+        if (fCallSelf)
+        {
+            uint32_t cLoops = 0;
+            rtmpLinuxWrapper(&Args);
+            while (ASMAtomicReadU32(&Args.cHits) < 2)
+            {
+                if ((cLoops & 0x1ff) == 0 && !RTMpIsCpuOnline(idCpuSelf == idCpu1 ? idCpu2 : idCpu1))
+                    break;
+                cLoops++;
+                ASMNopPause();
+            }
+        }
+
+        Assert(Args.cHits <= 2);
+        if (Args.cHits == 2)
+            rc = VINF_SUCCESS;
+        else if (Args.cHits == 1)
+            rc = VERR_NOT_ALL_CPUS_SHOWED;
+        else if (Args.cHits == 0)
+            rc = VERR_CPU_OFFLINE;
+        else
+            rc = VERR_CPU_IPE_1;
+    }
+    /*
+     * A CPU must be present to be considered just offline.
+     */
+    else if (   RTMpIsCpuPresent(idCpu1)
+             && RTMpIsCpuPresent(idCpu2))
+        rc = VERR_CPU_OFFLINE;
+    else
+        rc = VERR_CPU_NOT_FOUND;
+    RTThreadPreemptRestore(&PreemptState);;
+    return rc;
+}
+RT_EXPORT_SYMBOL(RTMpOnPair);
+
+
+RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void)
+{
+    return true;
+}
+RT_EXPORT_SYMBOL(RTMpOnPairIsConcurrentExecSupported);
+
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
 /**
  * Wrapper between the native linux per-cpu callbacks and PFNRTWORKER
@@ -364,3 +562,10 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
 }
 RT_EXPORT_SYMBOL(RTMpPokeCpu);
 
+
+RTDECL(bool) RTMpOnAllIsConcurrentSafe(void)
+{
+    return true;
+}
+RT_EXPORT_SYMBOL(RTMpOnAllIsConcurrentSafe);
+
diff --git a/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
index 687f3bb..1c7cad4 100644
--- a/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/mpnotification-r0drv-linux.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2011 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -31,7 +31,6 @@
 #include "the-linux-kernel.h"
 #include "internal/iprt.h"
 
-#include <iprt/mp.h>
 #include <iprt/asm-amd64-x86.h>
 #include <iprt/err.h>
 #include <iprt/cpuset.h>
@@ -69,62 +68,17 @@ static RTCPUSET g_MpPendingOfflineSet;
 
 
 /**
- * Notification wrapper that updates CPU states and invokes our notification
- * callbacks.
- *
- * @param idCpu             The CPU Id.
- * @param pvUser1           Pointer to the notifier_block (unused).
- * @param pvUser2           The notification event.
- * @remarks This can be invoked in interrupt context.
- */
-static DECLCALLBACK(void) rtMpNotificationLinuxOnCurrentCpu(RTCPUID idCpu, void *pvUser1, void *pvUser2)
-{
-    unsigned long ulNativeEvent = *(unsigned long *)pvUser2;
-    NOREF(pvUser1);
-
-    AssertRelease(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-    AssertReleaseMsg(idCpu == RTMpCpuId(),  /* ASSUMES iCpu == RTCPUID */
-                     ("idCpu=%u RTMpCpuId=%d ApicId=%d\n", idCpu, RTMpCpuId(), ASMGetApicId() ));
-
-    switch (ulNativeEvent)
-    {
-# ifdef CPU_DOWN_FAILED
-        case CPU_DOWN_FAILED:
-#  if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_FAILED_FROZEN)
-        case CPU_DOWN_FAILED_FROZEN:
-#  endif
-# endif
-        case CPU_ONLINE:
-# if defined(CPU_TASKS_FROZEN) && defined(CPU_ONLINE_FROZEN)
-        case CPU_ONLINE_FROZEN:
-# endif
-            rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, idCpu);
-            break;
-
-# ifdef CPU_DOWN_PREPARE
-        case CPU_DOWN_PREPARE:
-#  if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_PREPARE_FROZEN)
-        case CPU_DOWN_PREPARE_FROZEN:
-#  endif
-            rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, idCpu);
-            break;
-# endif
-    }
-}
-
-
-/**
  * The native callback.
  *
  * @returns NOTIFY_DONE.
  * @param   pNotifierBlock  Pointer to g_NotifierBlock.
  * @param   ulNativeEvent   The native event.
  * @param   pvCpu           The cpu id cast into a pointer value.
+ *
  * @remarks This can fire with preemption enabled and on any CPU.
  */
 static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock, unsigned long ulNativeEvent, void *pvCpu)
 {
-    int rc;
     bool fProcessEvent = false;
     RTCPUID idCpu      = (uintptr_t)pvCpu;
     NOREF(pNotifierBlock);
@@ -187,11 +141,31 @@ static int rtMpNotificationLinuxCallback(struct notifier_block *pNotifierBlock,
     if (!fProcessEvent)
         return NOTIFY_DONE;
 
-    /*
-     * Reschedule the callbacks to fire on the specific CPU with preemption disabled.
-     */
-    rc = RTMpOnSpecific(idCpu, rtMpNotificationLinuxOnCurrentCpu, pNotifierBlock, &ulNativeEvent);
-    Assert(RT_SUCCESS(rc)); NOREF(rc);
+    switch (ulNativeEvent)
+    {
+# ifdef CPU_DOWN_FAILED
+        case CPU_DOWN_FAILED:
+#  if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_FAILED_FROZEN)
+        case CPU_DOWN_FAILED_FROZEN:
+#  endif
+# endif
+        case CPU_ONLINE:
+# if defined(CPU_TASKS_FROZEN) && defined(CPU_ONLINE_FROZEN)
+        case CPU_ONLINE_FROZEN:
+# endif
+            rtMpNotificationDoCallbacks(RTMPEVENT_ONLINE, idCpu);
+            break;
+
+# ifdef CPU_DOWN_PREPARE
+        case CPU_DOWN_PREPARE:
+#  if defined(CPU_TASKS_FROZEN) && defined(CPU_DOWN_PREPARE_FROZEN)
+        case CPU_DOWN_PREPARE_FROZEN:
+#  endif
+            rtMpNotificationDoCallbacks(RTMPEVENT_OFFLINE, idCpu);
+            break;
+# endif
+    }
+
     return NOTIFY_DONE;
 }
 
diff --git a/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c
index eb141e8..0a1a086 100644
--- a/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/spinlock-r0drv-linux.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -130,7 +130,7 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)
     AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_MAGIC,
               ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
 
-#if defined(CONFIG_PROVE_LOCKING) && !defined(RT_STRICT)
+#ifdef CONFIG_PROVE_LOCKING
     lockdep_off();
 #endif
     if (pThis->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)
@@ -141,7 +141,7 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)
     }
     else
         spin_lock(&pThis->Spinlock);
-#if defined(CONFIG_PROVE_LOCKING) && !defined(RT_STRICT)
+#ifdef CONFIG_PROVE_LOCKING
     lockdep_on();
 #endif
 
@@ -158,7 +158,7 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
               ("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));
     RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE(pThis);
 
-#if defined(CONFIG_PROVE_LOCKING) && !defined(RT_STRICT)
+#ifdef CONFIG_PROVE_LOCKING
     lockdep_off();
 #endif
     if (pThis->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)
@@ -169,7 +169,7 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
     }
     else
         spin_unlock(&pThis->Spinlock);
-#if defined(CONFIG_PROVE_LOCKING) && !defined(RT_STRICT)
+#ifdef CONFIG_PROVE_LOCKING
     lockdep_on();
 #endif
 
@@ -177,16 +177,3 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
 }
 RT_EXPORT_SYMBOL(RTSpinlockRelease);
 
-
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
-{
-#if 1
-    if (RT_UNLIKELY(!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)))
-        RTAssertMsg2("RTSpinlockReleaseNoInts: %p (magic=%#x)\n", Spinlock, Spinlock->u32Magic);
-#else
-    AssertRelease(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE);
-#endif
-    RTSpinlockRelease(Spinlock);
-}
-RT_EXPORT_SYMBOL(RTSpinlockReleaseNoInts);
-
diff --git a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
index ad743a3..5a8d162 100644
--- a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
+++ b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
@@ -378,6 +378,23 @@ DECLINLINE(unsigned long) msecs_to_jiffies(unsigned int cMillies)
 # define IPRT_DEBUG_SEMS_STATE_RC(pThis, chState, rc)  do {  } while (0)
 #endif
 
+/** @name Macros for preserving EFLAGS.AC on 3.19+/amd64  paranoid.
+ * The AMD 64 switch_to in macro in arch/x86/include/asm/switch_to.h stopped
+ * restoring flags.
+ * @{ */
+#ifdef CONFIG_X86_SMAP
+# include <iprt/asm-amd64-x86.h>
+# define IPRT_X86_EFL_AC                    RT_BIT(18)
+# define IPRT_LINUX_SAVE_EFL_AC()           RTCCUINTREG fSavedEfl = ASMGetFlags();
+# define IPRT_LINUX_RESTORE_EFL_AC()        ASMSetFlags(fSavedEfl)
+# define IPRT_LINUX_RESTORE_EFL_ONLY_AC()   ASMSetFlags((ASMGetFlags() & ~IPRT_X86_EFL_AC) | (fSavedEfl & IPRT_X86_EFL_AC))
+#else
+# define IPRT_LINUX_SAVE_EFL_AC()           do { } while (0)
+# define IPRT_LINUX_RESTORE_EFL_AC()        do { } while (0)
+# define IPRT_LINUX_RESTORE_EFL_ONLY_AC()   do { } while (0)
+#endif
+/** @} */
+
 /*
  * There are some conflicting defines in iprt/param.h, sort them out here.
  */
diff --git a/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
index d5b69d6..679164c 100644
--- a/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -33,7 +33,7 @@
 #include <iprt/thread.h>
 
 #include <iprt/asm.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 28)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 28) || defined(CONFIG_X86_SMAP)
 # include <iprt/asm-amd64-x86.h>
 #endif
 #include <iprt/assert.h>
@@ -199,10 +199,12 @@ RT_EXPORT_SYMBOL(RTThreadPreemptDisable);
 RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState)
 {
 #ifdef CONFIG_PREEMPT
+    IPRT_LINUX_SAVE_EFL_AC(); /* paranoia */
     AssertPtr(pState);
     Assert(pState->u32Reserved == 42);
     RT_ASSERT_PREEMPT_CPUID_RESTORE(pState);
     preempt_enable();
+    IPRT_LINUX_RESTORE_EFL_ONLY_AC();  /* paranoia */
 
 #else
     int32_t volatile *pc;
diff --git a/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
index 0195656..ec2b491 100644
--- a/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/thread2-r0drv-linux.c
@@ -102,6 +102,13 @@ DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
 }
 
 
+DECLHIDDEN(void) rtThreadNativeWaitKludge(PRTTHREADINT pThread)
+{
+    /** @todo fix RTThreadWait/RTR0Term race on linux. */
+    RTThreadSleep(1); NOREF(pThread);
+}
+
+
 DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
 {
     NOREF(pThread);
diff --git a/src/VBox/Runtime/r0drv/linux/threadctxhooks-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/threadctxhooks-r0drv-linux.c
index d02823c..6b64205 100644
--- a/src/VBox/Runtime/r0drv/linux/threadctxhooks-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/threadctxhooks-r0drv-linux.c
@@ -1,6 +1,6 @@
 /* $Id: threadctxhooks-r0drv-linux.c $ */
 /** @file
- * IPRT - Thread-Context Hook, Ring-0 Driver, Linux.
+ * IPRT - Thread Context Switching Hook, Ring-0 Driver, Linux.
  */
 
 /*
@@ -41,8 +41,9 @@
 #endif
 #include "internal/thread.h"
 
+
 /*
- * Linux kernel 2.6.23 introduced thread-context hooks but RedHat 2.6.18 kernels
+ * Linux kernel 2.6.23 introduced preemption notifiers but RedHat 2.6.18 kernels
  * got it backported.
  */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18) && defined(CONFIG_PREEMPT_NOTIFIERS)
@@ -51,58 +52,58 @@
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
 /**
- * The internal thread-context object.
+ * The internal hook object for linux.
  */
-typedef struct RTTHREADCTXINT
+typedef struct RTTHREADCTXHOOKINT
 {
-    /** Magic value (RTTHREADCTXINT_MAGIC). */
+    /** Magic value (RTTHREADCTXHOOKINT_MAGIC). */
     uint32_t volatile           u32Magic;
-    /** The thread handle (owner) for which the context-hooks are registered. */
+    /** The thread handle (owner) for which the hook is registered. */
     RTNATIVETHREAD              hOwner;
     /** The preemption notifier object. */
-    struct preempt_notifier     hPreemptNotifier;
-    /** Whether this handle has any hooks registered or not. */
-    bool                        fRegistered;
-    /** Pointer to the registered thread-context hook. */
-    PFNRTTHREADCTXHOOK          pfnThreadCtxHook;
-    /** User argument passed to the thread-context hook. */
+    struct preempt_notifier     LnxPreemptNotifier;
+    /** Whether the hook is enabled or not.  If enabled, the LnxPreemptNotifier
+     * is linked into the owning thread's list of preemption callouts. */
+    bool                        fEnabled;
+    /** Pointer to the user callback. */
+    PFNRTTHREADCTXHOOK          pfnCallback;
+    /** User argument passed to the callback. */
     void                       *pvUser;
-    /** The thread-context operations. */
-    struct preempt_ops          hPreemptOps;
-    /** The reference count for this object. */
-    uint32_t volatile           cRefs;
+    /** The linux callbacks. */
+    struct preempt_ops          PreemptOps;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 19) && defined(RT_ARCH_AMD64)
     /** Starting with 3.1.19, the linux kernel doesn't restore kernel RFLAGS during
      * task switch, so we have to do that ourselves. (x86 code is not affected.) */
     RTCCUINTREG                 fSavedRFlags;
 #endif
-} RTTHREADCTXINT, *PRTTHREADCTXINT;
+} RTTHREADCTXHOOKINT;
+typedef RTTHREADCTXHOOKINT *PRTTHREADCTXHOOKINT;
 
 
 /**
- * Hook function for the thread-preempting event.
+ * Hook function for the thread schedule out event.
  *
  * @param   pPreemptNotifier    Pointer to the preempt_notifier struct.
- * @param   pNext               Pointer to the task that is preempting the
- *                              current thread.
+ * @param   pNext               Pointer to the task that is being scheduled
+ *                              instead of the current thread.
  *
  * @remarks Called with the rq (runqueue) lock held and with preemption and
  *          interrupts disabled!
  */
 static void rtThreadCtxHooksLnxSchedOut(struct preempt_notifier *pPreemptNotifier, struct task_struct *pNext)
 {
-    PRTTHREADCTXINT pThis = RT_FROM_MEMBER(pPreemptNotifier, RTTHREADCTXINT, hPreemptNotifier);
+    PRTTHREADCTXHOOKINT pThis = RT_FROM_MEMBER(pPreemptNotifier, RTTHREADCTXHOOKINT, LnxPreemptNotifier);
 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     RTCCUINTREG fSavedEFlags = ASMGetFlags();
     stac();
 #endif
 
     AssertPtr(pThis);
-    AssertPtr(pThis->pfnThreadCtxHook);
-    Assert(pThis->fRegistered);
+    AssertPtr(pThis->pfnCallback);
+    Assert(pThis->fEnabled);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
-    pThis->pfnThreadCtxHook(RTTHREADCTXEVENT_PREEMPTING, pThis->pvUser);
+    pThis->pfnCallback(RTTHREADCTXEVENT_OUT, pThis->pvUser);
 
 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     ASMSetFlags(fSavedEFlags);
@@ -114,27 +115,28 @@ static void rtThreadCtxHooksLnxSchedOut(struct preempt_notifier *pPreemptNotifie
 
 
 /**
- * Hook function for the thread-resumed event.
+ * Hook function for the thread schedule in event.
  *
  * @param   pPreemptNotifier    Pointer to the preempt_notifier struct.
- * @param   iCpu                The CPU this thread is scheduled on.
+ * @param   iCpu                The CPU this thread is being scheduled on.
  *
  * @remarks Called without holding the rq (runqueue) lock and with preemption
  *          enabled!
+ * @todo    r=bird: Preemption is of course disabled when it is called.
  */
 static void rtThreadCtxHooksLnxSchedIn(struct preempt_notifier *pPreemptNotifier, int iCpu)
 {
-    PRTTHREADCTXINT pThis = RT_FROM_MEMBER(pPreemptNotifier, RTTHREADCTXINT, hPreemptNotifier);
+    PRTTHREADCTXHOOKINT pThis = RT_FROM_MEMBER(pPreemptNotifier, RTTHREADCTXHOOKINT, LnxPreemptNotifier);
 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     RTCCUINTREG fSavedEFlags = ASMGetFlags();
     stac();
 #endif
 
     AssertPtr(pThis);
-    AssertPtr(pThis->pfnThreadCtxHook);
-    Assert(pThis->fRegistered);
+    AssertPtr(pThis->pfnCallback);
+    Assert(pThis->fEnabled);
 
-    pThis->pfnThreadCtxHook(RTTHREADCTXEVENT_RESUMED, pThis->pvUser);
+    pThis->pfnCallback(RTTHREADCTXEVENT_IN, pThis->pvUser);
 
 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
 # if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 19) && defined(RT_ARCH_AMD64)
@@ -151,213 +153,151 @@ static void rtThreadCtxHooksLnxSchedIn(struct preempt_notifier *pPreemptNotifier
  *
  * @param   pThis   Pointer to the internal thread-context object.
  */
-DECLINLINE(void) rtThreadCtxHooksDeregister(PRTTHREADCTXINT pThis)
+DECLINLINE(void) rtThreadCtxHookDisable(PRTTHREADCTXHOOKINT pThis)
 {
-    preempt_notifier_unregister(&pThis->hPreemptNotifier);
-    pThis->hPreemptOps.sched_out = NULL;
-    pThis->hPreemptOps.sched_in  = NULL;
-    pThis->fRegistered           = false;
+    Assert(pThis->PreemptOps.sched_out == rtThreadCtxHooksLnxSchedOut);
+    Assert(pThis->PreemptOps.sched_in  == rtThreadCtxHooksLnxSchedIn);
+    preempt_disable();
+    preempt_notifier_unregister(&pThis->LnxPreemptNotifier);
+    pThis->fEnabled = false;
+    preempt_enable();
 }
 
 
-RTDECL(int) RTThreadCtxHooksCreate(PRTTHREADCTX phThreadCtx)
+RTDECL(int) RTThreadCtxHookCreate(PRTTHREADCTXHOOK phCtxHook, uint32_t fFlags, PFNRTTHREADCTXHOOK pfnCallback, void *pvUser)
 {
-    PRTTHREADCTXINT pThis;
+    /*
+     * Validate input.
+     */
+    PRTTHREADCTXHOOKINT pThis;
     Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
+    AssertReturn(fFlags == 0, VERR_INVALID_FLAGS);
 
-    pThis = (PRTTHREADCTXINT)RTMemAllocZ(sizeof(*pThis));
+    /*
+     * Allocate and initialize a new hook.  We don't register it yet, just
+     * create it.
+     */
+    pThis = (PRTTHREADCTXHOOKINT)RTMemAllocZ(sizeof(*pThis));
     if (RT_UNLIKELY(!pThis))
         return VERR_NO_MEMORY;
-    pThis->u32Magic    = RTTHREADCTXINT_MAGIC;
-    pThis->hOwner      = RTThreadNativeSelf();
-    pThis->fRegistered = false;
-    preempt_notifier_init(&pThis->hPreemptNotifier, &pThis->hPreemptOps);
-    pThis->cRefs       = 1;
-
-    *phThreadCtx = pThis;
+    pThis->u32Magic     = RTTHREADCTXHOOKINT_MAGIC;
+    pThis->hOwner       = RTThreadNativeSelf();
+    pThis->fEnabled     = false;
+    pThis->pfnCallback  = pfnCallback;
+    pThis->pvUser       = pvUser;
+    preempt_notifier_init(&pThis->LnxPreemptNotifier, &pThis->PreemptOps);
+    pThis->PreemptOps.sched_out = rtThreadCtxHooksLnxSchedOut;
+    pThis->PreemptOps.sched_in  = rtThreadCtxHooksLnxSchedIn;
+
+    *phCtxHook = pThis;
     return VINF_SUCCESS;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksCreate);
+RT_EXPORT_SYMBOL(RTThreadCtxHookCreate);
 
 
-RTDECL(uint32_t) RTThreadCtxHooksRetain(RTTHREADCTX hThreadCtx)
+RTDECL(int ) RTThreadCtxHookDestroy(RTTHREADCTXHOOK hCtxHook)
 {
     /*
      * Validate input.
      */
-    uint32_t        cRefs;
-    PRTTHREADCTXINT pThis = hThreadCtx;
+    PRTTHREADCTXHOOKINT pThis = hCtxHook;
+    if (pThis == NIL_RTTHREADCTXHOOK)
+        return VINF_SUCCESS;
     AssertPtr(pThis);
-    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
-                    UINT32_MAX);
-
-    cRefs = ASMAtomicIncU32(&pThis->cRefs);
-    Assert(cRefs < UINT32_MAX / 2);
-    return cRefs;
-}
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRetain);
-
-
+    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXHOOKINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
+                    VERR_INVALID_HANDLE);
+    Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    Assert(pThis->fEnabled || pThis->hOwner == RTThreadNativeSelf());
 
-RTDECL(uint32_t) RTThreadCtxHooksRelease(RTTHREADCTX hThreadCtx)
-{
     /*
-     * Validate input.
+     * If there's still a registered thread-context hook, deregister it now before destroying the object.
      */
-    uint32_t        cRefs;
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    if (pThis == NIL_RTTHREADCTX)
-        return 0;
-
-    AssertPtr(pThis);
-    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
-                    UINT32_MAX);
-    Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-
-    cRefs = ASMAtomicDecU32(&pThis->cRefs);
-    if (!cRefs)
+    if (pThis->fEnabled)
     {
-        /*
-         * If there's still a registered thread-context hook, deregister it now before destroying the object.
-         */
-        if (pThis->fRegistered)
-            rtThreadCtxHooksDeregister(pThis);
-
-        /*
-         * Paranoia... but since these are ring-0 threads we can't be too careful.
-         */
-        Assert(!pThis->fRegistered);
-        Assert(!pThis->hPreemptOps.sched_out);
-        Assert(!pThis->hPreemptOps.sched_in);
-
-        ASMAtomicWriteU32(&pThis->u32Magic, ~RTTHREADCTXINT_MAGIC);
-        RTMemFree(pThis);
+        Assert(pThis->hOwner == RTThreadNativeSelf());
+        rtThreadCtxHookDisable(pThis);
+        Assert(!pThis->fEnabled); /* paranoia */
     }
-    else
-        Assert(cRefs < UINT32_MAX / 2);
 
-    return cRefs;
+    ASMAtomicWriteU32(&pThis->u32Magic, ~RTTHREADCTXHOOKINT_MAGIC);
+    RTMemFree(pThis);
+
+    return VINF_SUCCESS;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRelease);
+RT_EXPORT_SYMBOL(RTThreadCtxHookDestroy);
 
 
-RTDECL(int) RTThreadCtxHooksRegister(RTTHREADCTX hThreadCtx, PFNRTTHREADCTXHOOK pfnThreadCtxHook, void *pvUser)
+RTDECL(int) RTThreadCtxHookEnable(RTTHREADCTXHOOK hCtxHook)
 {
     /*
      * Validate input.
      */
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    if (pThis == NIL_RTTHREADCTX)
-        return VERR_INVALID_HANDLE;
+    PRTTHREADCTXHOOKINT pThis = hCtxHook;
     AssertPtr(pThis);
-    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
+    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXHOOKINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
                     VERR_INVALID_HANDLE);
     Assert(pThis->hOwner == RTThreadNativeSelf());
-    Assert(!pThis->hPreemptOps.sched_out);
-    Assert(!pThis->hPreemptOps.sched_in);
+    Assert(!pThis->fEnabled);
+    if (!pThis->fEnabled)
+    {
+        Assert(pThis->PreemptOps.sched_out == rtThreadCtxHooksLnxSchedOut);
+        Assert(pThis->PreemptOps.sched_in == rtThreadCtxHooksLnxSchedIn);
 
-    /*
-     * Register the callback.
-     */
-    pThis->hPreemptOps.sched_out = rtThreadCtxHooksLnxSchedOut;
-    pThis->hPreemptOps.sched_in  = rtThreadCtxHooksLnxSchedIn;
-    pThis->pvUser                = pvUser;
-    pThis->pfnThreadCtxHook      = pfnThreadCtxHook;
-    pThis->fRegistered           = true;
-    preempt_notifier_register(&pThis->hPreemptNotifier);
+        /*
+         * Register the callback.
+         */
+        preempt_disable();
+        pThis->fEnabled = true;
+        preempt_notifier_register(&pThis->LnxPreemptNotifier);
+        preempt_enable();
+    }
 
     return VINF_SUCCESS;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRegister);
+RT_EXPORT_SYMBOL(RTThreadCtxHookEnable);
 
 
-RTDECL(int) RTThreadCtxHooksDeregister(RTTHREADCTX hThreadCtx)
+RTDECL(int) RTThreadCtxHookDisable(RTTHREADCTXHOOK hCtxHook)
 {
     /*
      * Validate input.
      */
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    if (pThis == NIL_RTTHREADCTX)
-        return VERR_INVALID_HANDLE;
-    AssertPtr(pThis);
-    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
-                    VERR_INVALID_HANDLE);
-    Assert(pThis->hOwner == RTThreadNativeSelf());
-    Assert(pThis->fRegistered);
+    PRTTHREADCTXHOOKINT pThis = hCtxHook;
+    if (pThis != NIL_RTTHREADCTXHOOK)
+    {
+        AssertPtr(pThis);
+        AssertMsgReturn(pThis->u32Magic == RTTHREADCTXHOOKINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
+                        VERR_INVALID_HANDLE);
+        Assert(pThis->hOwner == RTThreadNativeSelf());
 
-    /*
-     * Deregister the callback.
-     */
-    rtThreadCtxHooksDeregister(pThis);
+        /*
+         * Deregister the callback.
+         */
+        if (pThis->fEnabled)
+            rtThreadCtxHookDisable(pThis);
+    }
     return VINF_SUCCESS;
 }
-RT_EXPORT_SYMBOL(RTThreadCtxHooksDeregister);
+RT_EXPORT_SYMBOL(RTThreadCtxHookDisable);
 
 
-RTDECL(bool) RTThreadCtxHooksAreRegistered(RTTHREADCTX hThreadCtx)
+RTDECL(bool) RTThreadCtxHookIsEnabled(RTTHREADCTXHOOK hCtxHook)
 {
     /*
      * Validate input.
      */
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    if (pThis == NIL_RTTHREADCTX)
+    PRTTHREADCTXHOOKINT pThis = hCtxHook;
+    if (pThis == NIL_RTTHREADCTXHOOK)
         return false;
     AssertPtr(pThis);
-    AssertMsg(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis));
+    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXHOOKINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
+                    false);
 
-    return pThis->fRegistered;
+    return pThis->fEnabled;
 }
 
 #else    /* Not supported / Not needed */
-
-RTDECL(int) RTThreadCtxHooksCreate(PRTTHREADCTX phThreadCtx)
-{
-    NOREF(phThreadCtx);
-    return VERR_NOT_SUPPORTED;
-}
-RT_EXPORT_SYMBOL(RTThreadCtxHooksCreate);
-
-
-RTDECL(uint32_t) RTThreadCtxHooksRetain(RTTHREADCTX hThreadCtx)
-{
-    NOREF(hThreadCtx);
-    return UINT32_MAX;
-}
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRetain);
-
-
-RTDECL(uint32_t) RTThreadCtxHooksRelease(RTTHREADCTX hThreadCtx)
-{
-    NOREF(hThreadCtx);
-    return UINT32_MAX;
-}
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRelease);
-
-
-RTDECL(int) RTThreadCtxHooksRegister(RTTHREADCTX hThreadCtx, PFNRTTHREADCTXHOOK pfnThreadCtxHook, void *pvUser)
-{
-    NOREF(hThreadCtx);
-    NOREF(pfnThreadCtxHook);
-    NOREF(pvUser);
-    return VERR_NOT_SUPPORTED;
-}
-RT_EXPORT_SYMBOL(RTThreadCtxHooksRegister);
-
-
-RTDECL(int) RTThreadCtxHooksDeregister(RTTHREADCTX hThreadCtx)
-{
-    NOREF(hThreadCtx);
-    return VERR_NOT_SUPPORTED;
-}
-RT_EXPORT_SYMBOL(RTThreadCtxHooksDeregister);
-
-
-RTDECL(bool) RTThreadCtxHooksAreRegistered(RTTHREADCTX hThreadCtx)
-{
-    NOREF(hThreadCtx);
-    return false;
-}
-RT_EXPORT_SYMBOL(RTThreadCtxHooksAreRegistered);
-
+# include "../generic/threadctxhooks-r0drv-generic.cpp"
 #endif   /* Not supported / Not needed */
 
diff --git a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
index cd2e70f..e67df2a 100644
--- a/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/time-r0drv-linux.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -45,7 +45,7 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     uint64_t u64;
     struct timespec Ts;
     ktime_get_ts(&Ts);
-    u64 = Ts.tv_sec * UINT64_C(1000000000) + Ts.tv_nsec;
+    u64 = Ts.tv_sec * RT_NS_1SEC_64 + Ts.tv_nsec;
     return u64;
 
 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 60)
@@ -148,7 +148,7 @@ RT_EXPORT_SYMBOL(RTTimeNanoTS);
 
 RTDECL(uint64_t) RTTimeMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 RT_EXPORT_SYMBOL(RTTimeMilliTS);
 
@@ -162,7 +162,7 @@ RT_EXPORT_SYMBOL(RTTimeSystemNanoTS);
 
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 RT_EXPORT_SYMBOL(RTTimeSystemMilliTS);
 
diff --git a/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c
index b5c875d..f1b8b9f 100644
--- a/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c
+++ b/src/VBox/Runtime/r0drv/linux/timer-r0drv-linux.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -1352,6 +1352,8 @@ RTDECL(int) RTTimerChangeInterval(PRTTIMER pTimer, uint64_t u64NanoInterval)
     AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);
     AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);
     AssertReturn(u64NanoInterval, VERR_INVALID_PARAMETER);
+    AssertReturn(u64NanoInterval < UINT64_MAX / 8, VERR_INVALID_PARAMETER);
+    AssertReturn(pTimer->u64NanoInterval, VERR_INVALID_STATE);
     RTTIMERLNX_LOG(("change %p %llu\n", pTimer, u64NanoInterval));
 
 #ifdef RTTIMER_LINUX_WITH_HRTIMER
@@ -1440,7 +1442,7 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
         }
 
         if (pTimer->cCpus > 1)
-            RTSpinlockReleaseNoInts(pTimer->hSpinlock);
+            RTSpinlockRelease(pTimer->hSpinlock);
     }
 
     if (fCanDestroy)
@@ -1589,7 +1591,7 @@ RTDECL(uint32_t) RTTimerGetSystemGranularity(void)
         return Ts.tv_nsec;
     }
 #endif
-    return 1000000000 / HZ; /* ns */
+    return RT_NS_1SEC / HZ; /* ns */
 }
 RT_EXPORT_SYMBOL(RTTimerGetSystemGranularity);
 
diff --git a/src/VBox/Runtime/r0drv/memobj-r0drv.cpp b/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
index 2d5c85c..d8982ff 100644
--- a/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
+++ b/src/VBox/Runtime/r0drv/memobj-r0drv.cpp
@@ -1,4 +1,4 @@
-/* $Revision: 89632 $ */
+/* $Id: memobj-r0drv.cpp $ */
 /** @file
  * IPRT - Ring-0 Memory Objects, Common Code.
  */
diff --git a/src/VBox/Runtime/r0drv/mp-r0drv.h b/src/VBox/Runtime/r0drv/mp-r0drv.h
index 0166cef..0915918 100644
--- a/src/VBox/Runtime/r0drv/mp-r0drv.h
+++ b/src/VBox/Runtime/r0drv/mp-r0drv.h
@@ -52,7 +52,17 @@ typedef struct RTMPARGS
     void       *pvUser1;
     void       *pvUser2;
     RTCPUID     idCpu;
+    RTCPUID     idCpu2;
     uint32_t volatile cHits;
+#ifdef RT_OS_WINDOWS
+    /** Turns out that KeFlushQueuedDpcs doesn't necessarily wait till all
+     * callbacks are done.  So, do reference counting to make sure we don't free
+     * this structure befor all CPUs have completely handled their requests.  */
+    int32_t volatile  cRefs;
+#endif
+#ifdef RT_OS_LINUX
+    PRTCPUSET   pWorkerSet;
+#endif
 } RTMPARGS;
 /** Pointer to a RTMpOn* argument packet. */
 typedef RTMPARGS *PRTMPARGS;
diff --git a/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
index 7838bc0..d17f914 100644
--- a/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
@@ -55,14 +55,22 @@ RTCPUSET                            g_rtMpNtCpuSet;
 PFNMYEXSETTIMERRESOLUTION           g_pfnrtNtExSetTimerResolution;
 /** KeFlushQueuedDpcs, introduced in XP. */
 PFNMYKEFLUSHQUEUEDDPCS              g_pfnrtNtKeFlushQueuedDpcs;
-/** HalRequestIpi, introduced in ??. */
-PFNHALREQUESTIPI                    g_pfnrtNtHalRequestIpi;
-/** HalSendSoftwareInterrupt */
+/** HalRequestIpi, version introduced with windows 7. */
+PFNHALREQUESTIPI_W7PLUS             g_pfnrtHalRequestIpiW7Plus;
+/** HalRequestIpi, version valid up to windows vista?? */
+PFNHALREQUESTIPI_PRE_W7             g_pfnrtHalRequestIpiPreW7;
+/** HalSendSoftwareInterrupt, introduced in AMD64 version of W2K3. */
 PFNHALSENDSOFTWAREINTERRUPT         g_pfnrtNtHalSendSoftwareInterrupt;
-/** SendIpi handler based on Windows version */
-PFNRTSENDIPI                        g_pfnrtSendIpi;
-/** KeIpiGenericCall - Windows Server 2003+ only */
+/** Worker for RTMpPokeCpu. */
+PFNRTSENDIPI                        g_pfnrtMpPokeCpuWorker;
+/** KeIpiGenericCall - Introduced in Windows Server 2003. */
 PFNRTKEIPIGENERICCALL               g_pfnrtKeIpiGenericCall;
+/** KeInitializeAffinityEx - Introducted in Windows 7. */
+PFNKEINITIALIZEAFFINITYEX           g_pfnrtKeInitializeAffinityEx;
+/** KeAddProcessorAffinityEx - Introducted in Windows 7. */
+PFNKEADDPROCESSORAFFINITYEX         g_pfnrtKeAddProcessorAffinityEx;
+/** KeGetProcessorIndexFromNumber - Introducted in Windows  7. */
+PFNKEGETPROCESSORINDEXFROMNUMBER    g_pfnrtKeGetProcessorIndexFromNumber;
 /** RtlGetVersion, introduced in ??. */
 PFNRTRTLGETVERSION                  g_pfnrtRtlGetVersion;
 #ifndef RT_ARCH_AMD64
@@ -215,9 +223,13 @@ DECLHIDDEN(int) rtR0InitNative(void)
 #ifdef IPRT_TARGET_NT4
     g_pfnrtNtExSetTimerResolution = NULL;
     g_pfnrtNtKeFlushQueuedDpcs = NULL;
-    g_pfnrtNtHalRequestIpi = NULL;
+    g_pfnrtHalRequestIpiW7Plus = NULL;
+    g_pfnrtHalRequestIpiPreW7 = NULL;
     g_pfnrtNtHalSendSoftwareInterrupt = NULL;
     g_pfnrtKeIpiGenericCall = NULL;
+    g_pfnrtKeInitializeAffinityEx = NULL;
+    g_pfnrtKeAddProcessorAffinityEx = NULL;
+    g_pfnrtKeGetProcessorIndexFromNumber = NULL;
     g_pfnrtRtlGetVersion = NULL;
     g_pfnrtKeQueryInterruptTime = NULL;
     g_pfnrtKeQueryInterruptTimePrecise = NULL;
@@ -232,7 +244,8 @@ DECLHIDDEN(int) rtR0InitNative(void)
     g_pfnrtNtKeFlushQueuedDpcs = (PFNMYKEFLUSHQUEUEDDPCS)MmGetSystemRoutineAddress(&RoutineName);
 
     RtlInitUnicodeString(&RoutineName, L"HalRequestIpi");
-    g_pfnrtNtHalRequestIpi = (PFNHALREQUESTIPI)MmGetSystemRoutineAddress(&RoutineName);
+    g_pfnrtHalRequestIpiW7Plus = (PFNHALREQUESTIPI_W7PLUS)MmGetSystemRoutineAddress(&RoutineName);
+    g_pfnrtHalRequestIpiPreW7 = (PFNHALREQUESTIPI_PRE_W7)g_pfnrtHalRequestIpiW7Plus;
 
     RtlInitUnicodeString(&RoutineName, L"HalSendSoftwareInterrupt");
     g_pfnrtNtHalSendSoftwareInterrupt = (PFNHALSENDSOFTWAREINTERRUPT)MmGetSystemRoutineAddress(&RoutineName);
@@ -240,6 +253,15 @@ DECLHIDDEN(int) rtR0InitNative(void)
     RtlInitUnicodeString(&RoutineName, L"KeIpiGenericCall");
     g_pfnrtKeIpiGenericCall = (PFNRTKEIPIGENERICCALL)MmGetSystemRoutineAddress(&RoutineName);
 
+    RtlInitUnicodeString(&RoutineName, L"KeInitializeAffinityEx");
+    g_pfnrtKeInitializeAffinityEx = (PFNKEINITIALIZEAFFINITYEX)MmGetSystemRoutineAddress(&RoutineName);
+
+    RtlInitUnicodeString(&RoutineName, L"KeAddProcessorAffinityEx");
+    g_pfnrtKeAddProcessorAffinityEx = (PFNKEADDPROCESSORAFFINITYEX)MmGetSystemRoutineAddress(&RoutineName);
+
+    RtlInitUnicodeString(&RoutineName, L"KeGetProcessorIndexFromNumber");
+    g_pfnrtKeGetProcessorIndexFromNumber = (PFNKEGETPROCESSORINDEXFROMNUMBER)MmGetSystemRoutineAddress(&RoutineName);
+
     RtlInitUnicodeString(&RoutineName, L"RtlGetVersion");
     g_pfnrtRtlGetVersion = (PFNRTRTLGETVERSION)MmGetSystemRoutineAddress(&RoutineName);
 # ifndef RT_ARCH_AMD64
@@ -385,25 +407,33 @@ DECLHIDDEN(int) rtR0InitNative(void)
 #endif
 
     /*
-     * Special IPI fun.
+     * Special IPI fun for RTMpPokeCpu.
+     *
+     * On Vista and later the DPC method doesn't seem to reliably send IPIs,
+     * so we have to use alternative methods.  The NtHalSendSoftwareInterrupt
+     * is preferrable, but it's AMD64 only.  The NalRequestIpip method changed
+     * in Windows 7 with the lots-of-processors-support, but it's the only
+     * targeted IPI game in town if we cannot use KeInsertQueueDpc.  Worst case
+     * we use broadcast IPIs.
      */
-    g_pfnrtSendIpi = rtMpSendIpiDummy;
+    if (   OsVerInfo.uMajorVer > 6
+        || (OsVerInfo.uMajorVer == 6 && OsVerInfo.uMinorVer > 0))
+        g_pfnrtHalRequestIpiPreW7 = NULL;
+    else
+        g_pfnrtHalRequestIpiW7Plus = NULL;
+
+    g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingDpc;
 #ifndef IPRT_TARGET_NT4
-    if (    g_pfnrtNtHalRequestIpi
-        &&  OsVerInfo.uMajorVer == 6
-        &&  OsVerInfo.uMinorVer == 0)
-    {
-        /* Vista or Windows Server 2008 */
-        g_pfnrtSendIpi = rtMpSendIpiVista;
-    }
-    else if (   g_pfnrtNtHalSendSoftwareInterrupt
-             && OsVerInfo.uMajorVer == 6
-             && OsVerInfo.uMinorVer == 1)
-    {
-        /* Windows 7 or Windows Server 2008 R2 */
-        g_pfnrtSendIpi = rtMpSendIpiWin7;
-    }
-    /* Windows XP should send always send an IPI -> VERIFY */
+    if (g_pfnrtNtHalSendSoftwareInterrupt)
+        g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalSendSoftwareInterrupt;
+    else if (   g_pfnrtHalRequestIpiW7Plus
+             && g_pfnrtKeInitializeAffinityEx
+             && g_pfnrtKeAddProcessorAffinityEx
+             && g_pfnrtKeGetProcessorIndexFromNumber)
+        g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingHalReqestIpiW7Plus;
+    else if (OsVerInfo.uMajorVer >= 6 && g_pfnrtKeIpiGenericCall)
+        g_pfnrtMpPokeCpuWorker = rtMpPokeCpuUsingBroadcastIpi;
+    /* else: Windows XP should send always send an IPI -> VERIFY */
 #endif
 
     return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h b/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
index fe8aa8c..1f7bfbf 100644
--- a/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
+++ b/src/VBox/Runtime/r0drv/nt/internal-r0drv-nt.h
@@ -28,6 +28,7 @@
 #define ___internal_r0drv_h
 
 #include <iprt/cpuset.h>
+#include <iprt/nt/nt.h>
 
 RT_C_DECLS_BEGIN
 
@@ -36,7 +37,6 @@ RT_C_DECLS_BEGIN
 *******************************************************************************/
 typedef ULONG (__stdcall *PFNMYEXSETTIMERRESOLUTION)(ULONG, BOOLEAN);
 typedef VOID (__stdcall *PFNMYKEFLUSHQUEUEDDPCS)(VOID);
-typedef VOID (__stdcall *PFNHALREQUESTIPI)(KAFFINITY TargetSet);
 typedef VOID (__stdcall *PFNHALSENDSOFTWAREINTERRUPT)(ULONG ProcessorNumber, KIRQL Irql);
 typedef int (__stdcall *PFNRTSENDIPI)(RTCPUID idCpu);
 typedef ULONG_PTR (__stdcall *PFNRTKEIPIGENERICCALL)(PKIPI_BROADCAST_WORKER BroadcastFunction, ULONG_PTR  Context);
@@ -55,10 +55,15 @@ typedef VOID (__stdcall *PFNRTKEQUERYSYSTEMTIMEPRECISE)(PLARGE_INTEGER pTime);
 extern RTCPUSET                         g_rtMpNtCpuSet;
 extern PFNMYEXSETTIMERRESOLUTION        g_pfnrtNtExSetTimerResolution;
 extern PFNMYKEFLUSHQUEUEDDPCS           g_pfnrtNtKeFlushQueuedDpcs;
-extern PFNHALREQUESTIPI                 g_pfnrtNtHalRequestIpi;
+extern PFNHALREQUESTIPI_W7PLUS          g_pfnrtHalRequestIpiW7Plus;
+extern PFNHALREQUESTIPI_PRE_W7          g_pfnrtHalRequestIpiPreW7;
 extern PFNHALSENDSOFTWAREINTERRUPT      g_pfnrtNtHalSendSoftwareInterrupt;
-extern PFNRTSENDIPI                     g_pfnrtSendIpi;
+extern PFNRTSENDIPI                     g_pfnrtMpPokeCpuWorker;
 extern PFNRTKEIPIGENERICCALL            g_pfnrtKeIpiGenericCall;
+extern PFNKEINITIALIZEAFFINITYEX        g_pfnrtKeInitializeAffinityEx;
+extern PFNKEADDPROCESSORAFFINITYEX      g_pfnrtKeAddProcessorAffinityEx;
+extern PFNKEGETPROCESSORINDEXFROMNUMBER g_pfnrtKeGetProcessorIndexFromNumber;
+
 extern PFNRTRTLGETVERSION               g_pfnrtRtlGetVersion;
 #ifndef RT_ARCH_AMD64
 extern PFNRTKEQUERYINTERRUPTTIME        g_pfnrtKeQueryInterruptTime;
@@ -71,9 +76,11 @@ extern uint32_t                         g_cbrtNtPbQuantumEnd;
 extern uint32_t                         g_offrtNtPbDpcQueueDepth;
 
 
-int rtMpSendIpiVista(RTCPUID idCpu);
-int rtMpSendIpiWin7(RTCPUID idCpu);
-int rtMpSendIpiDummy(RTCPUID idCpu);
+int rtMpPokeCpuUsingDpc(RTCPUID idCpu);
+int rtMpPokeCpuUsingBroadcastIpi(RTCPUID idCpu);
+int rtMpPokeCpuUsingHalSendSoftwareInterrupt(RTCPUID idCpu);
+int rtMpPokeCpuUsingHalReqestIpiW7Plus(RTCPUID idCpu);
+int rtMpPokeCpuUsingHalReqestIpiPreW7(RTCPUID idCpu);
 
 RT_C_DECLS_END
 
diff --git a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
index 643c34a..438795e 100644
--- a/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/mp-r0drv-nt.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2011 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -34,6 +34,8 @@
 #include <iprt/cpuset.h>
 #include <iprt/err.h>
 #include <iprt/asm.h>
+#include <iprt/log.h>
+#include <iprt/time.h>
 #include "r0drv/mp-r0drv.h"
 #include "internal-r0drv-nt.h"
 
@@ -44,11 +46,35 @@
 typedef enum
 {
     RT_NT_CPUID_SPECIFIC,
+    RT_NT_CPUID_PAIR,
     RT_NT_CPUID_OTHERS,
     RT_NT_CPUID_ALL
 } RT_NT_CPUID;
 
 
+/**
+ * Used by the RTMpOnSpecific.
+ */
+typedef struct RTMPNTONSPECIFICARGS
+{
+    /** Set if we're executing. */
+    bool volatile       fExecuting;
+    /** Set when done executing. */
+    bool volatile       fDone;
+    /** Number of references to this heap block. */
+    uint32_t volatile   cRefs;
+    /** Event that the calling thread is waiting on. */
+    KEVENT              DoneEvt;
+    /** The deferred procedure call object. */
+    KDPC                Dpc;
+    /** The callback argument package. */
+    RTMPARGS            CallbackArgs;
+} RTMPNTONSPECIFICARGS;
+/** Pointer to an argument/state structure for RTMpOnSpecific on NT. */
+typedef RTMPNTONSPECIFICARGS *PRTMPNTONSPECIFICARGS;
+
+
+
 /* test a couple of assumption. */
 AssertCompile(MAXIMUM_PROCESSORS <= RTCPUSET_MAX_CPUS);
 AssertCompile(NIL_RTCPUID >= MAXIMUM_PROCESSORS);
@@ -68,6 +94,19 @@ RTDECL(RTCPUID) RTMpCpuId(void)
 }
 
 
+RTDECL(int) RTMpCurSetIndex(void)
+{
+    /* WDK upgrade warning: PCR->Number changed from BYTE to WORD. */
+    return KeGetCurrentProcessorNumber();
+}
+
+
+RTDECL(int) RTMpCurSetIndexAndId(PRTCPUID pidCpu)
+{
+    return *pidCpu = KeGetCurrentProcessorNumber();
+}
+
+
 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
 {
     return idCpu < MAXIMUM_PROCESSORS ? (int)idCpu : -1;
@@ -187,6 +226,113 @@ RTDECL(bool) RTMpIsCpuWorkPending(void)
 
 
 /**
+ * Wrapper between the native KIPI_BROADCAST_WORKER and IPRT's PFNRTMPWORKER for
+ * the RTMpOnAll case.
+ *
+ * @param   uUserCtx            The user context argument (PRTMPARGS).
+ */
+static ULONG_PTR __stdcall rtmpNtOnAllBroadcastIpiWrapper(ULONG_PTR uUserCtx)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)uUserCtx;
+    /*ASMAtomicIncU32(&pArgs->cHits); - not needed */
+    pArgs->pfnWorker(KeGetCurrentProcessorNumber(), pArgs->pvUser1, pArgs->pvUser2);
+    return 0;
+}
+
+
+/**
+ * Wrapper between the native KIPI_BROADCAST_WORKER and IPRT's PFNRTMPWORKER for
+ * the RTMpOnOthers case.
+ *
+ * @param   uUserCtx            The user context argument (PRTMPARGS).
+ */
+static ULONG_PTR __stdcall rtmpNtOnOthersBroadcastIpiWrapper(ULONG_PTR uUserCtx)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)uUserCtx;
+    RTCPUID idCpu = KeGetCurrentProcessorNumber();
+    if (pArgs->idCpu != idCpu)
+    {
+        /*ASMAtomicIncU32(&pArgs->cHits); - not needed */
+        pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+    }
+    return 0;
+}
+
+
+/**
+ * Wrapper between the native KIPI_BROADCAST_WORKER and IPRT's PFNRTMPWORKER for
+ * the RTMpOnPair case.
+ *
+ * @param   uUserCtx            The user context argument (PRTMPARGS).
+ */
+static ULONG_PTR __stdcall rtmpNtOnPairBroadcastIpiWrapper(ULONG_PTR uUserCtx)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)uUserCtx;
+    RTCPUID idCpu = KeGetCurrentProcessorNumber();
+    if (   pArgs->idCpu  == idCpu
+        || pArgs->idCpu2 == idCpu)
+    {
+        ASMAtomicIncU32(&pArgs->cHits);
+        pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+    }
+    return 0;
+}
+
+
+/**
+ * Wrapper between the native KIPI_BROADCAST_WORKER and IPRT's PFNRTMPWORKER for
+ * the RTMpOnSpecific case.
+ *
+ * @param   uUserCtx            The user context argument (PRTMPARGS).
+ */
+static ULONG_PTR __stdcall rtmpNtOnSpecificBroadcastIpiWrapper(ULONG_PTR uUserCtx)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)uUserCtx;
+    RTCPUID idCpu = KeGetCurrentProcessorNumber();
+    if (pArgs->idCpu == idCpu)
+    {
+        ASMAtomicIncU32(&pArgs->cHits);
+        pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+    }
+    return 0;
+}
+
+
+/**
+ * Internal worker for the RTMpOn* APIs using KeIpiGenericCall.
+ *
+ * @returns VINF_SUCCESS.
+ * @param   pfnWorker   The callback.
+ * @param   pvUser1     User argument 1.
+ * @param   pvUser2     User argument 2.
+ * @param   idCpu       First CPU to match, ultimately specific to the
+ *                      pfnNativeWrapper used.
+ * @param   idCpu2      Second CPU to match, ultimately specific to the
+ *                      pfnNativeWrapper used.
+ * @param   pcHits      Where to return the number of this. Optional.
+ */
+static int rtMpCallUsingBroadcastIpi(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2,
+                                     PKIPI_BROADCAST_WORKER pfnNativeWrapper, RTCPUID idCpu, RTCPUID idCpu2,
+                                     uint32_t *pcHits)
+{
+    RTMPARGS Args;
+    Args.pfnWorker = pfnWorker;
+    Args.pvUser1   = pvUser1;
+    Args.pvUser2   = pvUser2;
+    Args.idCpu     = idCpu;
+    Args.idCpu2    = idCpu2;
+    Args.cRefs     = 0;
+    Args.cHits     = 0;
+
+    AssertPtr(g_pfnrtKeIpiGenericCall);
+    g_pfnrtKeIpiGenericCall(pfnNativeWrapper, (uintptr_t)&Args);
+    if (pcHits)
+        *pcHits = Args.cHits;
+    return VINF_SUCCESS;
+}
+
+
+/**
  * Wrapper between the native nt per-cpu callbacks and PFNRTWORKER
  *
  * @param   Dpc                 DPC object
@@ -194,11 +340,18 @@ RTDECL(bool) RTMpIsCpuWorkPending(void)
  * @param   SystemArgument1     Argument specified by KeInsertQueueDpc
  * @param   SystemArgument2     Argument specified by KeInsertQueueDpc
  */
-static VOID rtmpNtDPCWrapper(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
+static VOID __stdcall rtmpNtDPCWrapper(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 {
     PRTMPARGS pArgs = (PRTMPARGS)DeferredContext;
+
     ASMAtomicIncU32(&pArgs->cHits);
     pArgs->pfnWorker(KeGetCurrentProcessorNumber(), pArgs->pvUser1, pArgs->pvUser2);
+
+    /* Dereference the argument structure. */
+    int32_t cRefs = ASMAtomicDecS32(&pArgs->cRefs);
+    Assert(cRefs >= 0);
+    if (cRefs == 0)
+        ExFreePool(pArgs);
 }
 
 
@@ -206,13 +359,17 @@ static VOID rtmpNtDPCWrapper(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID Sy
  * Internal worker for the RTMpOn* APIs.
  *
  * @returns IPRT status code.
- * @param   pfnWorker       The callback.
- * @param   pvUser1         User argument 1.
- * @param   pvUser2         User argument 2.
- * @param   enmCpuid        What to do / is idCpu valid.
- * @param   idCpu           Used if enmCpuid RT_NT_CPUID_SPECIFIC, otherwise ignored.
+ * @param   pfnWorker   The callback.
+ * @param   pvUser1     User argument 1.
+ * @param   pvUser2     User argument 2.
+ * @param   enmCpuid    What to do / is idCpu valid.
+ * @param   idCpu       Used if enmCpuid is RT_NT_CPUID_SPECIFIC or
+ *                      RT_NT_CPUID_PAIR, otherwise ignored.
+ * @param   idCpu2      Used if enmCpuid is RT_NT_CPUID_PAIR, otherwise ignored.
+ * @param   pcHits      Where to return the number of this. Optional.
  */
-static int rtMpCall(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2, RT_NT_CPUID enmCpuid, RTCPUID idCpu)
+static int rtMpCallUsingDpcs(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2,
+                             RT_NT_CPUID enmCpuid, RTCPUID idCpu, RTCPUID idCpu2, uint32_t *pcHits)
 {
     PRTMPARGS pArgs;
     KDPC     *paExecCpuDpcs;
@@ -244,7 +401,9 @@ static int rtMpCall(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2, RT_NT
     pArgs->pvUser1   = pvUser1;
     pArgs->pvUser2   = pvUser2;
     pArgs->idCpu     = NIL_RTCPUID;
+    pArgs->idCpu2    = NIL_RTCPUID;
     pArgs->cHits     = 0;
+    pArgs->cRefs     = 1;
 
     paExecCpuDpcs = (KDPC *)(pArgs + 1);
 
@@ -253,6 +412,19 @@ static int rtMpCall(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2, RT_NT
         KeInitializeDpc(&paExecCpuDpcs[0], rtmpNtDPCWrapper, pArgs);
         KeSetImportanceDpc(&paExecCpuDpcs[0], HighImportance);
         KeSetTargetProcessorDpc(&paExecCpuDpcs[0], (int)idCpu);
+        pArgs->idCpu = idCpu;
+    }
+    else if (enmCpuid == RT_NT_CPUID_SPECIFIC)
+    {
+        KeInitializeDpc(&paExecCpuDpcs[0], rtmpNtDPCWrapper, pArgs);
+        KeSetImportanceDpc(&paExecCpuDpcs[0], HighImportance);
+        KeSetTargetProcessorDpc(&paExecCpuDpcs[0], (int)idCpu);
+        pArgs->idCpu = idCpu;
+
+        KeInitializeDpc(&paExecCpuDpcs[1], rtmpNtDPCWrapper, pArgs);
+        KeSetImportanceDpc(&paExecCpuDpcs[1], HighImportance);
+        KeSetTargetProcessorDpc(&paExecCpuDpcs[1], (int)idCpu2);
+        pArgs->idCpu2 = idCpu2;
     }
     else
     {
@@ -275,11 +447,23 @@ static int rtMpCall(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2, RT_NT
      * affinity mask and the process despite the warnings in the docs.
      * If someone knows a better way to get this done, please let bird know.
      */
+    ASMCompilerBarrier(); /* paranoia */
     if (enmCpuid == RT_NT_CPUID_SPECIFIC)
     {
+        ASMAtomicIncS32(&pArgs->cRefs);
         BOOLEAN ret = KeInsertQueueDpc(&paExecCpuDpcs[0], 0, 0);
         Assert(ret);
     }
+    else if (enmCpuid == RT_NT_CPUID_PAIR)
+    {
+        ASMAtomicIncS32(&pArgs->cRefs);
+        BOOLEAN ret = KeInsertQueueDpc(&paExecCpuDpcs[0], 0, 0);
+        Assert(ret);
+
+        ASMAtomicIncS32(&pArgs->cRefs);
+        ret = KeInsertQueueDpc(&paExecCpuDpcs[1], 0, 0);
+        Assert(ret);
+    }
     else
     {
         unsigned iSelf = KeGetCurrentProcessorNumber();
@@ -289,6 +473,7 @@ static int rtMpCall(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2, RT_NT
             if (    (i != iSelf)
                 &&  (Mask & RT_BIT_64(i)))
             {
+                ASMAtomicIncS32(&pArgs->cRefs);
                 BOOLEAN ret = KeInsertQueueDpc(&paExecCpuDpcs[i], 0, 0);
                 Assert(ret);
             }
@@ -302,37 +487,304 @@ static int rtMpCall(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2, RT_NT
     /* Flush all DPCs and wait for completion. (can take long!) */
     /** @todo Consider changing this to an active wait using some atomic inc/dec
      *  stuff (and check for the current cpu above in the specific case). */
+    /** @todo Seems KeFlushQueuedDpcs doesn't wait for the DPCs to be completely
+     *        executed. Seen pArgs being freed while some CPU was using it before
+     *        cRefs was added. */
     g_pfnrtNtKeFlushQueuedDpcs();
 
-    ExFreePool(pArgs);
+    if (pcHits)
+        *pcHits = pArgs->cHits;
+
+    /* Dereference the argument structure. */
+    int32_t cRefs = ASMAtomicDecS32(&pArgs->cRefs);
+    Assert(cRefs >= 0);
+    if (cRefs == 0)
+        ExFreePool(pArgs);
+
     return VINF_SUCCESS;
 }
 
 
 RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
-    return rtMpCall(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_ALL, 0);
+    if (g_pfnrtKeIpiGenericCall)
+        return rtMpCallUsingBroadcastIpi(pfnWorker, pvUser1, pvUser2, rtmpNtOnAllBroadcastIpiWrapper,
+                                         NIL_RTCPUID, NIL_RTCPUID, NULL);
+    return rtMpCallUsingDpcs(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_ALL, NIL_RTCPUID, NIL_RTCPUID, NULL);
 }
 
 
 RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
-    return rtMpCall(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_OTHERS, 0);
+    if (g_pfnrtKeIpiGenericCall)
+        return rtMpCallUsingBroadcastIpi(pfnWorker, pvUser1, pvUser2, rtmpNtOnOthersBroadcastIpiWrapper,
+                                         NIL_RTCPUID, NIL_RTCPUID, NULL);
+    return rtMpCallUsingDpcs(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_OTHERS, NIL_RTCPUID, NIL_RTCPUID, NULL);
+}
+
+
+RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+{
+    int rc;
+    AssertReturn(idCpu1 != idCpu2, VERR_INVALID_PARAMETER);
+    AssertReturn(!(fFlags & RTMPON_F_VALID_MASK), VERR_INVALID_FLAGS);
+    if ((fFlags & RTMPON_F_CONCURRENT_EXEC) && !g_pfnrtKeIpiGenericCall)
+        return VERR_NOT_SUPPORTED;
+
+    /*
+     * Check that both CPUs are online before doing the broadcast call.
+     */
+    if (   RTMpIsCpuOnline(idCpu1)
+        && RTMpIsCpuOnline(idCpu2))
+    {
+        /*
+         * The broadcast IPI isn't quite as bad as it could have been, because
+         * it looks like windows doesn't synchronize CPUs on the way out, they
+         * seems to get back to normal work while the pair is still busy.
+         */
+        uint32_t cHits = 0;
+        if (g_pfnrtKeIpiGenericCall)
+            rc = rtMpCallUsingBroadcastIpi(pfnWorker, pvUser1, pvUser2, rtmpNtOnPairBroadcastIpiWrapper, idCpu1, idCpu2, &cHits);
+        else
+            rc = rtMpCallUsingDpcs(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_PAIR, idCpu1, idCpu2, &cHits);
+        if (RT_SUCCESS(rc))
+        {
+            Assert(cHits <= 2);
+            if (cHits == 2)
+                rc = VINF_SUCCESS;
+            else if (cHits == 1)
+                rc = VERR_NOT_ALL_CPUS_SHOWED;
+            else if (cHits == 0)
+                rc = VERR_CPU_OFFLINE;
+            else
+                rc = VERR_CPU_IPE_1;
+        }
+    }
+    /*
+     * A CPU must be present to be considered just offline.
+     */
+    else if (   RTMpIsCpuPresent(idCpu1)
+             && RTMpIsCpuPresent(idCpu2))
+        rc = VERR_CPU_OFFLINE;
+    else
+        rc = VERR_CPU_NOT_FOUND;
+    return rc;
+}
+
+
+RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void)
+{
+    return g_pfnrtKeIpiGenericCall != NULL;
+}
+
+
+/**
+ * Releases a reference to a RTMPNTONSPECIFICARGS heap allocation, freeing it
+ * when the last reference is released.
+ */
+DECLINLINE(void) rtMpNtOnSpecificRelease(PRTMPNTONSPECIFICARGS pArgs)
+{
+    uint32_t cRefs = ASMAtomicDecU32(&pArgs->cRefs);
+    AssertMsg(cRefs <= 1, ("cRefs=%#x\n", cRefs));
+    if (cRefs == 0)
+        ExFreePool(pArgs);
+}
+
+
+/**
+ * Wrapper between the native nt per-cpu callbacks and PFNRTWORKER
+ *
+ * @param   Dpc                 DPC object
+ * @param   DeferredContext     Context argument specified by KeInitializeDpc
+ * @param   SystemArgument1     Argument specified by KeInsertQueueDpc
+ * @param   SystemArgument2     Argument specified by KeInsertQueueDpc
+ */
+static VOID __stdcall rtMpNtOnSpecificDpcWrapper(IN PKDPC Dpc, IN PVOID DeferredContext,
+                                                 IN PVOID SystemArgument1, IN PVOID SystemArgument2)
+{
+    PRTMPNTONSPECIFICARGS pArgs = (PRTMPNTONSPECIFICARGS)DeferredContext;
+    ASMAtomicWriteBool(&pArgs->fExecuting, true);
+
+    pArgs->CallbackArgs.pfnWorker(KeGetCurrentProcessorNumber(), pArgs->CallbackArgs.pvUser1, pArgs->CallbackArgs.pvUser2);
+
+    ASMAtomicWriteBool(&pArgs->fDone, true);
+    KeSetEvent(&pArgs->DoneEvt, 1 /*PriorityIncrement*/, FALSE /*Wait*/);
+
+    rtMpNtOnSpecificRelease(pArgs);
 }
 
 
 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
+    /*
+     * Don't try mess with an offline CPU.
+     */
     if (!RTMpIsCpuOnline(idCpu))
         return !RTMpIsCpuPossible(idCpu)
               ? VERR_CPU_NOT_FOUND
               : VERR_CPU_OFFLINE;
 
-    return rtMpCall(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_SPECIFIC, idCpu);
+    /*
+     * Use the broadcast IPI routine if there are no more than two CPUs online,
+     * or if the current IRQL is unsuitable for KeWaitForSingleObject.
+     */
+    int rc;
+    uint32_t cHits = 0;
+    if (   g_pfnrtKeIpiGenericCall
+        && (   RTMpGetOnlineCount() <= 2
+            || KeGetCurrentIrql()   > APC_LEVEL)
+       )
+    {
+        rc = rtMpCallUsingBroadcastIpi(pfnWorker, pvUser1, pvUser2, rtmpNtOnSpecificBroadcastIpiWrapper,
+                                       idCpu, NIL_RTCPUID, &cHits);
+        if (RT_SUCCESS(rc))
+        {
+            if (cHits == 1)
+                return VINF_SUCCESS;
+            rc = cHits == 0 ? VERR_CPU_OFFLINE : VERR_CPU_IPE_1;
+        }
+        return rc;
+    }
+
+#if 0
+    rc = rtMpCallUsingDpcs(pfnWorker, pvUser1, pvUser2, RT_NT_CPUID_SPECIFIC, idCpu, NIL_RTCPUID, &cHits);
+    if (RT_SUCCESS(rc))
+    {
+        if (cHits == 1)
+            return VINF_SUCCESS;
+        rc = cHits == 0 ? VERR_CPU_OFFLINE : VERR_CPU_IPE_1;
+    }
+    return rc;
+
+#else
+    /*
+     * Initialize the argument package and the objects within it.
+     * The package is referenced counted to avoid unnecessary spinning to
+     * synchronize cleanup and prevent stack corruption.
+     */
+    PRTMPNTONSPECIFICARGS pArgs = (PRTMPNTONSPECIFICARGS)ExAllocatePoolWithTag(NonPagedPool, sizeof(*pArgs), (ULONG)'RTMp');
+    if (!pArgs)
+        return VERR_NO_MEMORY;
+    pArgs->cRefs                  = 2;
+    pArgs->fExecuting             = false;
+    pArgs->fDone                  = false;
+    pArgs->CallbackArgs.pfnWorker = pfnWorker;
+    pArgs->CallbackArgs.pvUser1   = pvUser1;
+    pArgs->CallbackArgs.pvUser2   = pvUser2;
+    pArgs->CallbackArgs.idCpu     = idCpu;
+    pArgs->CallbackArgs.cHits     = 0;
+    pArgs->CallbackArgs.cRefs     = 2;
+    KeInitializeEvent(&pArgs->DoneEvt, SynchronizationEvent, FALSE /* not signalled */);
+    KeInitializeDpc(&pArgs->Dpc, rtMpNtOnSpecificDpcWrapper, pArgs);
+    KeSetImportanceDpc(&pArgs->Dpc, HighImportance);
+    KeSetTargetProcessorDpc(&pArgs->Dpc, (int)idCpu);
+
+    /*
+     * Disable preemption while we check the current processor and inserts the DPC.
+     */
+    KIRQL bOldIrql;
+    KeRaiseIrql(DISPATCH_LEVEL, &bOldIrql);
+    ASMCompilerBarrier(); /* paranoia */
+
+    if (RTMpCpuId() == idCpu)
+    {
+        /* Just execute the callback on the current CPU. */
+        pfnWorker(idCpu, pvUser1, pvUser2);
+        KeLowerIrql(bOldIrql);
+
+        ExFreePool(pArgs);
+        return VINF_SUCCESS;
+    }
+
+    /* Different CPU, so queue it if the CPU is still online. */
+    if (RTMpIsCpuOnline(idCpu))
+    {
+        BOOLEAN fRc = KeInsertQueueDpc(&pArgs->Dpc, 0, 0);
+        Assert(fRc);
+        KeLowerIrql(bOldIrql);
+
+        uint64_t const nsRealWaitTS = RTTimeNanoTS();
+
+        /*
+         * Wait actively for a while in case the CPU/thread responds quickly.
+         */
+        uint32_t cLoopsLeft = 0x20000;
+        while (cLoopsLeft-- > 0)
+        {
+            if (pArgs->fDone)
+            {
+                rtMpNtOnSpecificRelease(pArgs);
+                return VINF_SUCCESS;
+            }
+            ASMNopPause();
+        }
+
+        /*
+         * It didn't respond, so wait on the event object, poking the CPU if it's slow.
+         */
+        LARGE_INTEGER Timeout;
+        Timeout.QuadPart = -10000; /* 1ms */
+        NTSTATUS rcNt = KeWaitForSingleObject(&pArgs->DoneEvt, Executive, KernelMode, FALSE /* Alertable */, &Timeout);
+        if (rcNt == STATUS_SUCCESS)
+        {
+            rtMpNtOnSpecificRelease(pArgs);
+            return VINF_SUCCESS;
+        }
+
+        /* If it hasn't respondend yet, maybe poke it and wait some more. */
+        if (rcNt == STATUS_TIMEOUT)
+        {
+#ifndef IPRT_TARGET_NT4
+            if (   !pArgs->fExecuting
+                && (   g_pfnrtMpPokeCpuWorker == rtMpPokeCpuUsingHalSendSoftwareInterrupt
+                    || g_pfnrtMpPokeCpuWorker == rtMpPokeCpuUsingHalReqestIpiW7Plus
+                    || g_pfnrtMpPokeCpuWorker == rtMpPokeCpuUsingHalReqestIpiPreW7))
+                RTMpPokeCpu(idCpu);
+#endif
+
+            Timeout.QuadPart = -1280000; /* 128ms */
+            rcNt = KeWaitForSingleObject(&pArgs->DoneEvt, Executive, KernelMode, FALSE /* Alertable */, &Timeout);
+            if (rcNt == STATUS_SUCCESS)
+            {
+                rtMpNtOnSpecificRelease(pArgs);
+                return VINF_SUCCESS;
+            }
+        }
+
+        /*
+         * Something weird is happening, try bail out.
+         */
+        if (KeRemoveQueueDpc(&pArgs->Dpc))
+        {
+            ExFreePool(pArgs); /* DPC was still queued, so we can return without further ado. */
+            LogRel(("RTMpOnSpecific(%#x): Not processed after %llu ns: rcNt=%#x\n", idCpu, RTTimeNanoTS() - nsRealWaitTS, rcNt));
+        }
+        else
+        {
+            /* DPC is running, wait a good while for it to complete. */
+            LogRel(("RTMpOnSpecific(%#x): Still running after %llu ns: rcNt=%#x\n", idCpu, RTTimeNanoTS() - nsRealWaitTS, rcNt));
+
+            Timeout.QuadPart = -30*1000*1000*10; /* 30 seconds */
+            rcNt = KeWaitForSingleObject(&pArgs->DoneEvt, Executive, KernelMode, FALSE /* Alertable */, &Timeout);
+            if (rcNt != STATUS_SUCCESS)
+                LogRel(("RTMpOnSpecific(%#x): Giving up on running worker after %llu ns: rcNt=%#x\n", idCpu, RTTimeNanoTS() - nsRealWaitTS, rcNt));
+        }
+        rc = RTErrConvertFromNtStatus(rcNt);
+    }
+    else
+    {
+        /* CPU is offline.*/
+        KeLowerIrql(bOldIrql);
+        rc = !RTMpIsCpuPossible(idCpu) ? VERR_CPU_NOT_FOUND : VERR_CPU_OFFLINE;
+    }
+
+    rtMpNtOnSpecificRelease(pArgs);
+    return rc;
+#endif
 }
 
-static KDPC aPokeDpcs[MAXIMUM_PROCESSORS] = {0};
-static bool fPokeDPCsInitialized = false;
+
+
 
 static VOID rtMpNtPokeCpuDummy(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 {
@@ -344,58 +796,102 @@ static VOID rtMpNtPokeCpuDummy(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID
 
 #ifndef IPRT_TARGET_NT4
 
-ULONG_PTR rtMpIpiGenericCall(ULONG_PTR Argument)
+/** Callback used by rtMpPokeCpuUsingBroadcastIpi. */
+static ULONG_PTR __stdcall rtMpIpiGenericCall(ULONG_PTR Argument)
 {
     NOREF(Argument);
     return 0;
 }
 
 
-int rtMpSendIpiVista(RTCPUID idCpu)
+/**
+ * RTMpPokeCpu worker that uses broadcast IPIs for doing the work.
+ *
+ * @returns VINF_SUCCESS
+ * @param   idCpu           The CPU identifier.
+ */
+int rtMpPokeCpuUsingBroadcastIpi(RTCPUID idCpu)
 {
     g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0);
-////    g_pfnrtNtHalRequestIpi(1 << idCpu);
     return VINF_SUCCESS;
 }
 
 
-int rtMpSendIpiWin7(RTCPUID idCpu)
+/**
+ * RTMpPokeCpu worker that uses HalSendSoftwareInterrupt to get the job done.
+ *
+ * This is only really available on AMD64, at least at the time of writing.
+ *
+ * @returns VINF_SUCCESS
+ * @param   idCpu           The CPU identifier.
+ */
+int rtMpPokeCpuUsingHalSendSoftwareInterrupt(RTCPUID idCpu)
 {
-    g_pfnrtKeIpiGenericCall(rtMpIpiGenericCall, 0);
-////    g_pfnrtNtHalSendSoftwareInterrupt(idCpu, DISPATCH_LEVEL);
+    g_pfnrtNtHalSendSoftwareInterrupt(idCpu, DISPATCH_LEVEL);
     return VINF_SUCCESS;
 }
 
-#endif /* IPRT_TARGET_NT4 */
-
 
-int rtMpSendIpiDummy(RTCPUID idCpu)
+/**
+ * RTMpPokeCpu worker that uses the Windows 7 and later version of
+ * HalRequestIpip to get the job done.
+ *
+ * @returns VINF_SUCCESS
+ * @param   idCpu           The CPU identifier.
+ */
+int rtMpPokeCpuUsingHalReqestIpiW7Plus(RTCPUID idCpu)
 {
-    return VERR_NOT_IMPLEMENTED;
+    /*
+     * I think we'll let idCpu be an NT processor number and not a HAL processor
+     * index.  KeAddProcessorAffinityEx is for HAL and uses HAL processor
+     * indexes as input from what I can tell.
+     */
+    PROCESSOR_NUMBER ProcNumber = { /*Group=*/ idCpu / 64, /*Number=*/ idCpu % 64, /* Reserved=*/ 0};
+    KAFFINITY_EX     Target;
+    g_pfnrtKeInitializeAffinityEx(&Target);
+    g_pfnrtKeAddProcessorAffinityEx(&Target, g_pfnrtKeGetProcessorIndexFromNumber(&ProcNumber));
+
+    g_pfnrtHalRequestIpiW7Plus(0, &Target);
+    return VINF_SUCCESS;
 }
 
 
-RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
+/**
+ * RTMpPokeCpu worker that uses the Vista and earlier version of HalRequestIpip
+ * to get the job done.
+ *
+ * @returns VINF_SUCCESS
+ * @param   idCpu           The CPU identifier.
+ */
+int rtMpPokeCpuUsingHalReqestIpiPreW7(RTCPUID idCpu)
 {
-    if (!RTMpIsCpuOnline(idCpu))
-        return !RTMpIsCpuPossible(idCpu)
-              ? VERR_CPU_NOT_FOUND
-              : VERR_CPU_OFFLINE;
+    __debugbreak(); /** @todo this code needs testing!!  */
+    KAFFINITY Target = 1;
+    Target <<= idCpu;
+    g_pfnrtHalRequestIpiPreW7(Target);
+    return VINF_SUCCESS;
+}
+
+#endif /* !IPRT_TARGET_NT4 */
 
-    int rc = g_pfnrtSendIpi(idCpu);
-    if (rc == VINF_SUCCESS)
-        return rc;
 
-    /* Fallback. */
-    if (!fPokeDPCsInitialized)
+int rtMpPokeCpuUsingDpc(RTCPUID idCpu)
+{
+    /*
+     * APC fallback.
+     */
+    static KDPC s_aPokeDpcs[MAXIMUM_PROCESSORS] = {0};
+    static bool s_fPokeDPCsInitialized = false;
+
+    if (!s_fPokeDPCsInitialized)
     {
-        for (unsigned i = 0; i < RT_ELEMENTS(aPokeDpcs); i++)
+        for (unsigned i = 0; i < RT_ELEMENTS(s_aPokeDpcs); i++)
         {
-            KeInitializeDpc(&aPokeDpcs[i], rtMpNtPokeCpuDummy, NULL);
-            KeSetImportanceDpc(&aPokeDpcs[i], HighImportance);
-            KeSetTargetProcessorDpc(&aPokeDpcs[i], (int)i);
+            KeInitializeDpc(&s_aPokeDpcs[i], rtMpNtPokeCpuDummy, NULL);
+            KeSetImportanceDpc(&s_aPokeDpcs[i], HighImportance);
+            KeSetTargetProcessorDpc(&s_aPokeDpcs[i], (int)i);
         }
-        fPokeDPCsInitialized = true;
+        s_fPokeDPCsInitialized = true;
     }
 
     /* Raise the IRQL to DISPATCH_LEVEL so we can't be rescheduled to another cpu.
@@ -404,14 +900,32 @@ RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
     KIRQL oldIrql;
     KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);
 
-    KeSetImportanceDpc(&aPokeDpcs[idCpu], HighImportance);
-    KeSetTargetProcessorDpc(&aPokeDpcs[idCpu], (int)idCpu);
+    KeSetImportanceDpc(&s_aPokeDpcs[idCpu], HighImportance);
+    KeSetTargetProcessorDpc(&s_aPokeDpcs[idCpu], (int)idCpu);
 
     /* Assuming here that high importance DPCs will be delivered immediately; or at least an IPI will be sent immediately.
      * @note: not true on at least Vista & Windows 7
      */
-    BOOLEAN bRet = KeInsertQueueDpc(&aPokeDpcs[idCpu], 0, 0);
+    BOOLEAN bRet = KeInsertQueueDpc(&s_aPokeDpcs[idCpu], 0, 0);
 
     KeLowerIrql(oldIrql);
     return (bRet == TRUE) ? VINF_SUCCESS : VERR_ACCESS_DENIED /* already queued */;
 }
+
+
+RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
+{
+    if (!RTMpIsCpuOnline(idCpu))
+        return !RTMpIsCpuPossible(idCpu)
+              ? VERR_CPU_NOT_FOUND
+              : VERR_CPU_OFFLINE;
+    /* Calls rtMpSendIpiFallback, rtMpSendIpiWin7AndLater or rtMpSendIpiVista. */
+    return g_pfnrtMpPokeCpuWorker(idCpu);
+}
+
+
+RTDECL(bool) RTMpOnAllIsConcurrentSafe(void)
+{
+    return false;
+}
+
diff --git a/src/VBox/Runtime/r0drv/nt/ntBldSymDb.cpp b/src/VBox/Runtime/r0drv/nt/ntBldSymDb.cpp
index 0ffd6ca..3e0fcd0 100644
--- a/src/VBox/Runtime/r0drv/nt/ntBldSymDb.cpp
+++ b/src/VBox/Runtime/r0drv/nt/ntBldSymDb.cpp
@@ -1146,7 +1146,7 @@ int main(int argc, char **argv)
                 break;
 
             case 'V':
-                RTPrintf("$Revision: 92629 $");
+                RTPrintf("$Revision: 92621 $");
                 break;
 
             case 'h':
diff --git a/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp
index 00dbd3e..d8ea10d 100644
--- a/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/spinlock-r0drv-nt.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -195,15 +195,3 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
         KeReleaseSpinLock(&pThis->Spinlock, SavedIrql);
 }
 
-
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
-{
-#if 1
-    if (RT_UNLIKELY(!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)))
-        RTAssertMsg2("RTSpinlockReleaseNoInts: %p (magic=%#x)\n", Spinlock, Spinlock->u32Magic);
-#else
-    AssertRelease(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE);
-#endif
-    RTSpinlockRelease(Spinlock);
-}
-
diff --git a/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h b/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h
index 44a805b..8a2276b 100644
--- a/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h
+++ b/src/VBox/Runtime/r0drv/nt/the-nt-kernel.h
@@ -40,7 +40,7 @@
 # define _InterlockedAddLargeStatistic  _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
 # pragma warning(disable : 4163)
 RT_C_DECLS_BEGIN
-# include <ntddk.h>
+# include <iprt/nt/nt.h>
 RT_C_DECLS_END
 # pragma warning(default : 4163)
 # undef  _InterlockedExchange
@@ -49,7 +49,7 @@ RT_C_DECLS_END
 # undef  _InterlockedAddLargeStatistic
 #else
 RT_C_DECLS_BEGIN
-# include <ntddk.h>
+# include <iprt/nt/nt.h>
 RT_C_DECLS_END
 #endif
 
diff --git a/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp
index 4863194..f112519 100644
--- a/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/thread2-r0drv-nt.cpp
@@ -87,6 +87,14 @@ DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
 }
 
 
+DECLHIDDEN(void) rtThreadNativeWaitKludge(PRTTHREADINT pThread)
+{
+    PVOID pvThreadObj = pThread->Core.Key;
+    NTSTATUS rcNt = KeWaitForSingleObject(pvThreadObj, Executive, KernelMode, FALSE, NULL);
+    AssertMsg(rcNt == STATUS_SUCCESS, ("rcNt=%#x\n", rcNt));
+}
+
+
 DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
 {
     NOREF(pThread);
diff --git a/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp
index ce4e1b2..2fed94a 100644
--- a/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/time-r0drv-nt.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2007-2010 Oracle Corporation
+ * Copyright (C) 2007-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -90,7 +90,7 @@ RTDECL(uint64_t) RTTimeNanoTS(void)
 
 RTDECL(uint64_t) RTTimeMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
 
@@ -102,7 +102,7 @@ RTDECL(uint64_t) RTTimeSystemNanoTS(void)
 
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
 
diff --git a/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp b/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp
index 5903cfe..5bd19bc 100644
--- a/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp
+++ b/src/VBox/Runtime/r0drv/nt/timer-r0drv-nt.cpp
@@ -35,7 +35,8 @@
 #include <iprt/err.h>
 #include <iprt/asm.h>
 #include <iprt/assert.h>
-#include <iprt/alloc.h>
+#include <iprt/mem.h>
+#include <iprt/thread.h>
 
 #include "internal-r0drv-nt.h"
 #include "internal/magics.h"
@@ -58,6 +59,8 @@ typedef struct RTTIMERNTSUBTIMER
     uint64_t                iTick;
     /** Pointer to the parent timer. */
     PRTTIMER                pParent;
+    /** Thread active executing the worker function, NIL if inactive. */
+    RTNATIVETHREAD volatile hActiveThread;
     /** The NT DPC object. */
     KDPC                    NtDpc;
 } RTTIMERNTSUBTIMER;
@@ -186,12 +189,16 @@ static void _stdcall rtTimerNtSimpleCallback(IN PKDPC pDpc, IN PVOID pvUser, IN
     if (    !ASMAtomicUoReadBool(&pTimer->fSuspended)
         &&  pTimer->u32Magic == RTTIMER_MAGIC)
     {
+        ASMAtomicWriteHandle(&pTimer->aSubTimers[0].hActiveThread, RTThreadNativeSelf());
+
         if (!pTimer->u64NanoInterval)
             ASMAtomicWriteBool(&pTimer->fSuspended, true);
         uint64_t iTick = ++pTimer->aSubTimers[0].iTick;
         if (pTimer->u64NanoInterval)
             rtTimerNtRearmInternval(pTimer, iTick, &pTimer->aSubTimers[0].NtDpc);
         pTimer->pfnTimer(pTimer, pTimer->pvUser, iTick);
+
+        ASMAtomicWriteHandle(&pTimer->aSubTimers[0].hActiveThread, NIL_RTNATIVETHREAD);
     }
 
     NOREF(pDpc); NOREF(SystemArgument1); NOREF(SystemArgument2);
@@ -226,11 +233,15 @@ static void _stdcall rtTimerNtOmniSlaveCallback(IN PKDPC pDpc, IN PVOID pvUser,
     if (    !ASMAtomicUoReadBool(&pTimer->fSuspended)
         &&  pTimer->u32Magic == RTTIMER_MAGIC)
     {
+        ASMAtomicWriteHandle(&pSubTimer->hActiveThread, RTThreadNativeSelf());
+
         if (!pTimer->u64NanoInterval)
             if (ASMAtomicDecS32(&pTimer->cOmniSuspendCountDown) <= 0)
                 ASMAtomicWriteBool(&pTimer->fSuspended, true);
 
         pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pSubTimer->iTick);
+
+        ASMAtomicWriteHandle(&pSubTimer->hActiveThread, NIL_RTNATIVETHREAD);
     }
 
     NOREF(pDpc); NOREF(SystemArgument1); NOREF(SystemArgument2);
@@ -272,6 +283,8 @@ static void _stdcall rtTimerNtOmniMasterCallback(IN PKDPC pDpc, IN PVOID pvUser,
         RTCPUSET    OnlineSet;
         RTMpGetOnlineSet(&OnlineSet);
 
+        ASMAtomicWriteHandle(&pSubTimer->hActiveThread, RTThreadNativeSelf());
+
         if (pTimer->u64NanoInterval)
         {
             /*
@@ -308,6 +321,8 @@ static void _stdcall rtTimerNtOmniMasterCallback(IN PKDPC pDpc, IN PVOID pvUser,
 
             pTimer->pfnTimer(pTimer, pTimer->pvUser, ++pSubTimer->iTick);
         }
+
+        ASMAtomicWriteHandle(&pSubTimer->hActiveThread, NIL_RTNATIVETHREAD);
     }
 
     NOREF(pDpc); NOREF(SystemArgument1); NOREF(SystemArgument2);
@@ -378,18 +393,11 @@ static void rtTimerNtStopWorker(PRTTIMER pTimer)
      * Just cancel the timer, dequeue the DPCs and flush them (if this is supported).
      */
     ASMAtomicWriteBool(&pTimer->fSuspended, true);
+
     KeCancelTimer(&pTimer->NtTimer);
 
     for (RTCPUID iCpu = 0; iCpu < pTimer->cSubTimers; iCpu++)
         KeRemoveQueueDpc(&pTimer->aSubTimers[iCpu].NtDpc);
-
-    /*
-     * I'm a bit uncertain whether this should be done during RTTimerStop
-     * or only in RTTimerDestroy()... Linux and Solaris will wait AFAIK,
-     * which is why I'm keeping this here for now.
-     */
-    if (g_pfnrtNtKeFlushQueuedDpcs)
-        g_pfnrtNtKeFlushQueuedDpcs();
 }
 
 
@@ -430,12 +438,25 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
     AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);
 
     /*
+     * We do not support destroying a timer from the callback because it is
+     * not 101% safe since we cannot flush DPCs.  Solaris has the same restriction.
+     */
+    AssertReturn(KeGetCurrentIrql() == PASSIVE_LEVEL, VERR_INVALID_CONTEXT);
+
+    /*
      * Invalidate the timer, stop it if it's running and finally
      * free up the memory.
      */
     ASMAtomicWriteU32(&pTimer->u32Magic, ~RTTIMER_MAGIC);
     if (!ASMAtomicUoReadBool(&pTimer->fSuspended))
         rtTimerNtStopWorker(pTimer);
+
+    /*
+     * Flush DPCs to be on the safe side.
+     */
+    if (g_pfnrtNtKeFlushQueuedDpcs)
+        g_pfnrtNtKeFlushQueuedDpcs();
+
     RTMemFree(pTimer);
 
     return VINF_SUCCESS;
diff --git a/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp
index 39be522..3d716c6 100644
--- a/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/spinlock-r0drv-os2.cpp
@@ -127,15 +127,3 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
     KernReleaseSpinLock(&pThis->Spinlock);
 }
 
-
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
-{
-#if 1
-    if (RT_UNLIKELY(!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)))
-        RTAssertMsg2("RTSpinlockReleaseNoInts: %p (magic=%#x)\n", Spinlock, Spinlock->u32Magic);
-#else
-    AssertRelease(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE);
-#endif
-    RTSpinlockRelease(Spinlock);
-}
-
diff --git a/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp
index f0aef3c..0c590f7 100644
--- a/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/thread2-r0drv-os2.cpp
@@ -64,6 +64,11 @@ DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
     return VERR_NOT_IMPLEMENTED;
 }
 
+DECLHIDDEN(void) rtThreadNativeWaitKludge(PRTTHREADINT pThread)
+{
+    NOREF(pThread);
+}
+
 
 DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
 {
diff --git a/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp b/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp
index bc9a025..7a86f54 100644
--- a/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp
+++ b/src/VBox/Runtime/r0drv/os2/timer-r0drv-os2.cpp
@@ -156,7 +156,7 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
     pTimer->pNext = g_pTimerHead;
     g_pTimerHead = pTimer;
     g_cTimers++;
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
 
     *ppTimer = pTimer;
     return VINF_SUCCESS;
@@ -200,7 +200,7 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
             pPrev = pPrev->pNext;
             if (RT_UNLIKELY(!pPrev))
             {
-                RTSpinlockReleaseNoInts(g_Spinlock);
+                RTSpinlockRelease(g_Spinlock);
                 return VERR_INVALID_HANDLE;
             }
         }
@@ -215,7 +215,7 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
         if (!g_cActiveTimers)
             rtTimerOs2Dearm();
     }
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
 
     /*
      * Free the associated resources.
@@ -245,7 +245,7 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
         int rc = rtTimerOs2Arm();
         if (RT_FAILURE(rc))
         {
-            RTSpinlockReleaseNoInts(g_Spinlock);
+            RTSpinlockRelease(g_Spinlock);
             return rc;
         }
     }
@@ -255,7 +255,7 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
     pTimer->iTick = 0;
     pTimer->u64StartTS = u64First;
     pTimer->u64NextTS = u64First;
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
 
     return VINF_SUCCESS;
 }
@@ -278,7 +278,7 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer)
     g_cActiveTimers--;
     if (!g_cActiveTimers)
         rtTimerOs2Dearm();
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
 
     return VINF_SUCCESS;
 }
@@ -337,7 +337,7 @@ DECLASM(void) rtTimerOs2Tick(void)
             /* do the callout */
             PFNRTTIMER  pfnTimer = pTimer->pfnTimer;
             void       *pvUser   = pTimer->pvUser;
-            RTSpinlockReleaseNoInts(g_Spinlock);
+            RTSpinlockRelease(g_Spinlock);
             pfnTimer(pTimer, pvUser, pTimer->iTick);
 
             RTSpinlockAcquire(g_Spinlock);
@@ -354,7 +354,7 @@ DECLASM(void) rtTimerOs2Tick(void)
         pTimer = pNext;
     }
 
-    RTSpinlockReleaseNoInts(g_Spinlock);
+    RTSpinlockRelease(g_Spinlock);
 }
 
 
diff --git a/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c
index fc31009..ba41d4d 100644
--- a/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/alloc-r0drv-solaris.c
@@ -185,7 +185,7 @@ RTR0DECL(void *) RTMemContAlloc(PRTCCPHYS pPhys, size_t cb)
 
     /* Allocate physically contiguous (< 4GB) page-aligned memory. */
     uint64_t uPhys;
-    void *pvMem = rtR0SolMemAlloc((uint64_t)_4G - 1, &uPhys, cb, PAGESIZE, true);
+    void *pvMem = rtR0SolMemAlloc((uint64_t)_4G - 1, &uPhys, cb, PAGESIZE, true /* fContig */);
     if (RT_UNLIKELY(!pvMem))
     {
         LogRel(("RTMemContAlloc failed to allocate %u bytes\n", cb));
diff --git a/src/VBox/Runtime/r0drv/solaris/dbgkrnlinfo-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/dbgkrnlinfo-r0drv-solaris.c
index 0bbb29f..d987633 100644
--- a/src/VBox/Runtime/r0drv/solaris/dbgkrnlinfo-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/dbgkrnlinfo-r0drv-solaris.c
@@ -138,7 +138,9 @@ RTR0DECL(int) RTR0DbgKrnlInfoOpen(PRTDBGKRNLINFO phKrnlInfo, uint32_t fFlags)
 {
     AssertReturn(fFlags == 0, VERR_INVALID_PARAMETER);
     AssertPtrReturn(phKrnlInfo, VERR_INVALID_POINTER);
-    RT_ASSERT_PREEMPTIBLE();
+    /* This can be called as part of IPRT init, in which case we have no thread preempt information yet. */
+    if (g_frtSolInitDone)
+        RT_ASSERT_PREEMPTIBLE();
 
     *phKrnlInfo = NIL_RTDBGKRNLINFO;
     PRTDBGKRNLINFOINT pThis = (PRTDBGKRNLINFOINT)RTMemAllocZ(sizeof(*pThis));
@@ -181,7 +183,8 @@ RTR0DECL(uint32_t) RTR0DbgKrnlInfoRelease(RTDBGKRNLINFO hKrnlInfo)
         return 0;
     AssertPtrReturn(pThis, UINT32_MAX);
     AssertMsgReturn(pThis->u32Magic == RTDBGKRNLINFO_MAGIC, ("%p: u32Magic=%RX32\n", pThis, pThis->u32Magic), UINT32_MAX);
-    RT_ASSERT_PREEMPTIBLE();
+    if (g_frtSolInitDone)
+        RT_ASSERT_PREEMPTIBLE();
 
     uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs);
     if (cRefs == 0)
@@ -203,7 +206,8 @@ RTR0DECL(int) RTR0DbgKrnlInfoQueryMember(RTDBGKRNLINFO hKrnlInfo, const char *ps
     AssertPtrReturn(pszMember, VERR_INVALID_PARAMETER);
     AssertPtrReturn(pszStructure, VERR_INVALID_PARAMETER);
     AssertPtrReturn(poffMember, VERR_INVALID_PARAMETER);
-    RT_ASSERT_PREEMPTIBLE();
+    if (g_frtSolInitDone)
+        RT_ASSERT_PREEMPTIBLE();
 
     int rc = VERR_NOT_FOUND;
     ctf_id_t TypeIdent = ctf_lookup_by_name(pThis->pGenUnixCTF, pszStructure);
@@ -231,7 +235,8 @@ RTR0DECL(int) RTR0DbgKrnlInfoQuerySymbol(RTDBGKRNLINFO hKrnlInfo, const char *ps
     AssertPtrReturn(pszSymbol, VERR_INVALID_PARAMETER);
     AssertPtrNullReturn(ppvSymbol, VERR_INVALID_PARAMETER);
     AssertReturn(!pszModule, VERR_MODULE_NOT_FOUND);
-    RT_ASSERT_PREEMPTIBLE();
+    if (g_frtSolInitDone)
+        RT_ASSERT_PREEMPTIBLE();
 
     uintptr_t uValue = kobj_getsymvalue((char *)pszSymbol, 1 /* only kernel */);
     if (ppvSymbol)
diff --git a/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c
index 0d43536..7a7eb2c 100644
--- a/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -70,8 +70,16 @@ RTR0FNSOLXCCALL                 g_rtSolXcCall;
 bool                            g_frtSolOldThreadCtx = false;
 /** The thread-context hooks callout table structure. */
 RTR0FNSOLTHREADCTX              g_rtSolThreadCtx;
-/** Thread preemption offset. */
+/** Thread preemption offset in the thread structure. */
 size_t                          g_offrtSolThreadPreempt;
+/** Thread ID offset in the thread structure. */
+size_t                          g_offrtSolThreadId;
+/** The interrupt (pinned) thread pointer offset in the thread structure.  */
+size_t                          g_offrtSolThreadIntrThread;
+/** The dispatcher lock pointer offset in the thread structure. */
+size_t                          g_offrtSolThreadLock;
+/** The process pointer offset in the thread structure. */
+size_t                          g_offrtSolThreadProc;
 /** Host scheduler preemption offset. */
 size_t                          g_offrtSolCpuPreempt;
 /** Host scheduler force preemption offset. */
@@ -80,7 +88,7 @@ size_t                          g_offrtSolCpuForceKernelPreempt;
 extern void contig_free(void *addr, size_t size);
 #pragma weak contig_free
 /** contig_free address. */
-PFNSOL_contig_free          g_pfnrtR0Sol_contig_free       = contig_free;
+PFNSOL_contig_free              g_pfnrtR0Sol_contig_free = contig_free;
 
 DECLHIDDEN(int) rtR0InitNative(void)
 {
@@ -106,7 +114,6 @@ DECLHIDDEN(int) rtR0InitNative(void)
 #else
         /* PORTME: See if the amd64/x86 problem applies to this architecture. */
 #endif
-
         /*
          * Mandatory: Preemption offsets.
          */
@@ -130,9 +137,41 @@ DECLHIDDEN(int) rtR0InitNative(void)
             cmn_err(CE_NOTE, "Failed to find kthread_t::t_preempt!\n");
             goto errorbail;
         }
+
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_did", &g_offrtSolThreadId);
+        if (RT_FAILURE(rc))
+        {
+            cmn_err(CE_NOTE, "Failed to find kthread_t::t_did!\n");
+            goto errorbail;
+        }
+
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_intr", &g_offrtSolThreadIntrThread);
+        if (RT_FAILURE(rc))
+        {
+            cmn_err(CE_NOTE, "Failed to find kthread_t::t_intr!\n");
+            goto errorbail;
+        }
+
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_lockp", &g_offrtSolThreadLock);
+        if (RT_FAILURE(rc))
+        {
+            cmn_err(CE_NOTE, "Failed to find kthread_t::t_lockp!\n");
+            goto errorbail;
+        }
+
+        rc = RTR0DbgKrnlInfoQueryMember(g_hKrnlDbgInfo, "kthread_t", "t_procp", &g_offrtSolThreadProc);
+        if (RT_FAILURE(rc))
+        {
+            cmn_err(CE_NOTE, "Failed to find kthread_t::t_procp!\n");
+            goto errorbail;
+        }
         cmn_err(CE_CONT, "!cpu_t::cpu_runrun @ 0x%lx (%ld)\n",    g_offrtSolCpuPreempt, g_offrtSolCpuPreempt);
         cmn_err(CE_CONT, "!cpu_t::cpu_kprunrun @ 0x%lx (%ld)\n",  g_offrtSolCpuForceKernelPreempt, g_offrtSolCpuForceKernelPreempt);
         cmn_err(CE_CONT, "!kthread_t::t_preempt @ 0x%lx (%ld)\n", g_offrtSolThreadPreempt, g_offrtSolThreadPreempt);
+        cmn_err(CE_CONT, "!kthread_t::t_did @ 0x%lx (%ld)\n",     g_offrtSolThreadId, g_offrtSolThreadId);
+        cmn_err(CE_CONT, "!kthread_t::t_intr @ 0x%lx (%ld)\n",    g_offrtSolThreadIntrThread, g_offrtSolThreadIntrThread);
+        cmn_err(CE_CONT, "!kthread_t::t_lockp @ 0x%lx (%ld)\n",   g_offrtSolThreadLock, g_offrtSolThreadLock);
+        cmn_err(CE_CONT, "!kthread_t::t_procp @ 0x%lx (%ld)\n",   g_offrtSolThreadProc, g_offrtSolThreadProc);
 
         /*
          * Mandatory: CPU cross call infrastructure. Refer the-solaris-kernel.h for details.
@@ -211,7 +250,8 @@ DECLHIDDEN(int) rtR0InitNative(void)
          */
         if (g_pfnrtR0Sol_contig_free == NULL)
         {
-            rc = RTR0DbgKrnlInfoQuerySymbol(g_hKrnlDbgInfo, NULL /* pszModule */, "contig_free", (void **)&g_pfnrtR0Sol_contig_free);
+            rc = RTR0DbgKrnlInfoQuerySymbol(g_hKrnlDbgInfo, NULL /* pszModule */, "contig_free",
+                                            (void **)&g_pfnrtR0Sol_contig_free);
             if (RT_FAILURE(rc))
             {
                 cmn_err(CE_NOTE, "rtR0InitNative: failed to find contig_free!\n");
diff --git a/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
index b5e0ee6..02a0b99 100644
--- a/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/memobj-r0drv-solaris.c
@@ -207,6 +207,8 @@ static void rtR0MemObjSolPageDestroy(page_t *pPage)
 }
 
 
+/* Currently not used on 32-bits, define it to shut up gcc. */
+#if HC_ARCH_BITS == 64
 /**
  * Allocates physical, non-contiguous memory of pages.
  *
@@ -277,6 +279,7 @@ static page_t **rtR0MemObjSolPagesAlloc(uint64_t *puPhys, size_t cb)
 
     return NULL;
 }
+#endif  /* HC_ARCH_BITS == 64 */
 
 
 /**
diff --git a/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c
index b3a171a..1625bee 100644
--- a/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/modulestub-r0drv-solaris.c
@@ -1,4 +1,28 @@
-
+/* $Id: modulestub-r0drv-solaris.c $ */
+/** @file
+ * IPRT - Ring-0 Solaris stubs
+ */
+
+/*
+ * Copyright (C) 2011-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
 
 
 /*******************************************************************************
diff --git a/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c
index 3a9dce9..dfd82e9 100644
--- a/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -57,6 +57,18 @@ RTDECL(RTCPUID) RTMpCpuId(void)
 }
 
 
+RTDECL(int) RTMpCurSetIndex(void)
+{
+    return CPU->cpu_id;
+}
+
+
+RTDECL(int) RTMpCurSetIndexAndId(PRTCPUID pidCpu)
+{
+    return *pidCpu = CPU->cpu_id;
+}
+
+
 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu)
 {
     return idCpu < RTCPUSET_MAX_CPUS && idCpu <= max_cpuid ? idCpu : -1;
@@ -136,11 +148,10 @@ RTDECL(RTCPUID) RTMpGetOnlineCount(void)
 /**
  * Wrapper to Solaris IPI infrastructure.
  *
+ * @returns Solaris error code.
  * @param   pCpuSet        Pointer to Solaris CPU set.
  * @param   pfnSolWorker   Function to execute on target CPU(s).
  * @param   pArgs          Pointer to RTMPARGS to pass to @a pfnSolWorker.
- *
- * @returns Solaris error code.
  */
 static void rtMpSolCrossCall(PRTSOLCPUSET pCpuSet, PFNRTMPSOLWORKER pfnSolWorker, PRTMPARGS pArgs)
 {
@@ -184,11 +195,12 @@ static void rtMpSolCrossCall(PRTSOLCPUSET pCpuSet, PFNRTMPSOLWORKER pfnSolWorker
  * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
  * for the RTMpOnAll API.
  *
+ * @returns Solaris error code.
  * @param   uArgs       Pointer to the RTMPARGS package.
- * @param   uIgnored1   Ignored.
- * @param   uIgnored2   Ignored.
+ * @param   pvIgnored1  Ignored.
+ * @param   pvIgnored2  Ignored.
  */
-static int rtMpSolOnAllCpuWrapper(void *uArg, void *uIgnored1, void *uIgnored2)
+static int rtMpSolOnAllCpuWrapper(void *uArg, void *pvIgnored1, void *pvIgnored2)
 {
     PRTMPARGS pArgs = (PRTMPARGS)(uArg);
 
@@ -201,8 +213,8 @@ static int rtMpSolOnAllCpuWrapper(void *uArg, void *uIgnored1, void *uIgnored2)
 
     pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2);
 
-    NOREF(uIgnored1);
-    NOREF(uIgnored2);
+    NOREF(pvIgnored1);
+    NOREF(pvIgnored2);
     return 0;
 }
 
@@ -210,6 +222,8 @@ static int rtMpSolOnAllCpuWrapper(void *uArg, void *uIgnored1, void *uIgnored2)
 RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
     RTMPARGS Args;
+    RTSOLCPUSET CpuSet;
+    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     RT_ASSERT_INTS_ON();
 
     Args.pfnWorker = pfnWorker;
@@ -218,13 +232,11 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
     Args.idCpu = NIL_RTCPUID;
     Args.cHits = 0;
 
-    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
-    RTThreadPreemptDisable(&PreemptState);
-
-    RTSOLCPUSET CpuSet;
     for (int i = 0; i < IPRT_SOL_SET_WORDS; i++)
         CpuSet.auCpus[i] = (ulong_t)-1L;
 
+    RTThreadPreemptDisable(&PreemptState);
+
     rtMpSolCrossCall(&CpuSet, rtMpSolOnAllCpuWrapper, &Args);
 
     RTThreadPreemptRestore(&PreemptState);
@@ -237,11 +249,12 @@ RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
  * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
  * for the RTMpOnOthers API.
  *
+ * @returns Solaris error code.
  * @param   uArgs       Pointer to the RTMPARGS package.
- * @param   uIgnored1   Ignored.
- * @param   uIgnored2   Ignored.
+ * @param   pvIgnored1  Ignored.
+ * @param   pvIgnored2  Ignored.
  */
-static int rtMpSolOnOtherCpusWrapper(void *uArg, void *uIgnored1, void *uIgnored2)
+static int rtMpSolOnOtherCpusWrapper(void *uArg, void *pvIgnored1, void *pvIgnored2)
 {
     PRTMPARGS pArgs = (PRTMPARGS)(uArg);
     RTCPUID idCpu = RTMpCpuId();
@@ -249,8 +262,8 @@ static int rtMpSolOnOtherCpusWrapper(void *uArg, void *uIgnored1, void *uIgnored
     Assert(idCpu != pArgs->idCpu);
     pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
 
-    NOREF(uIgnored1);
-    NOREF(uIgnored2);
+    NOREF(pvIgnored1);
+    NOREF(pvIgnored2);
     return 0;
 }
 
@@ -258,6 +271,8 @@ static int rtMpSolOnOtherCpusWrapper(void *uArg, void *uIgnored1, void *uIgnored
 RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
     RTMPARGS Args;
+    RTSOLCPUSET CpuSet;
+    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     RT_ASSERT_INTS_ON();
 
     Args.pfnWorker = pfnWorker;
@@ -267,10 +282,8 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
     Args.cHits = 0;
 
     /* The caller is supposed to have disabled preemption, but take no chances. */
-    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     RTThreadPreemptDisable(&PreemptState);
 
-    RTSOLCPUSET CpuSet;
     for (int i = 0; i < IPRT_SOL_SET_WORDS; i++)
         CpuSet.auCpus[0] = (ulong_t)-1L;
     BT_CLEAR(CpuSet.auCpus, RTMpCpuId());
@@ -283,17 +296,102 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 }
 
 
+
 /**
  * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
- * for the RTMpOnSpecific API.
+ * for the RTMpOnPair API.
  *
+ * @returns Solaris error code.
  * @param   uArgs       Pointer to the RTMPARGS package.
- * @param   uIgnored1   Ignored.
- * @param   uIgnored2   Ignored.
+ * @param   pvIgnored1  Ignored.
+ * @param   pvIgnored2  Ignored.
+ */
+static int rtMpSolOnPairCpuWrapper(void *uArg, void *pvIgnored1, void *pvIgnored2)
+{
+    PRTMPARGS pArgs = (PRTMPARGS)(uArg);
+    RTCPUID idCpu = RTMpCpuId();
+
+    Assert(idCpu == pArgs->idCpu || idCpu == pArgs->idCpu2);
+    pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
+    ASMAtomicIncU32(&pArgs->cHits);
+
+    NOREF(pvIgnored1);
+    NOREF(pvIgnored2);
+    return 0;
+}
+
+
+RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
+{
+    int rc;
+    RTMPARGS Args;
+    RTSOLCPUSET CpuSet;
+    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+
+    AssertReturn(idCpu1 != idCpu2, VERR_INVALID_PARAMETER);
+    AssertReturn(!(fFlags & RTMPON_F_VALID_MASK), VERR_INVALID_FLAGS);
+
+    Args.pfnWorker = pfnWorker;
+    Args.pvUser1   = pvUser1;
+    Args.pvUser2   = pvUser2;
+    Args.idCpu     = idCpu1;
+    Args.idCpu2    = idCpu2;
+    Args.cHits     = 0;
+
+    for (int i = 0; i < IPRT_SOL_SET_WORDS; i++)
+        CpuSet.auCpus[i] = 0;
+    BT_SET(CpuSet.auCpus, idCpu1);
+    BT_SET(CpuSet.auCpus, idCpu2);
+
+    /*
+     * Check that both CPUs are online before doing the broadcast call.
+     */
+    RTThreadPreemptDisable(&PreemptState);
+    if (   RTMpIsCpuOnline(idCpu1)
+        && RTMpIsCpuOnline(idCpu2))
+    {
+        rtMpSolCrossCall(&CpuSet, rtMpSolOnPairCpuWrapper, &Args);
+
+        Assert(Args.cHits <= 2);
+        if (Args.cHits == 2)
+            rc = VINF_SUCCESS;
+        else if (Args.cHits == 1)
+            rc = VERR_NOT_ALL_CPUS_SHOWED;
+        else if (Args.cHits == 0)
+            rc = VERR_CPU_OFFLINE;
+        else
+            rc = VERR_CPU_IPE_1;
+    }
+    /*
+     * A CPU must be present to be considered just offline.
+     */
+    else if (   RTMpIsCpuPresent(idCpu1)
+             && RTMpIsCpuPresent(idCpu2))
+        rc = VERR_CPU_OFFLINE;
+    else
+        rc = VERR_CPU_NOT_FOUND;
+
+    RTThreadPreemptRestore(&PreemptState);
+    return rc;
+}
+
+
+RTDECL(bool) RTMpOnPairIsConcurrentExecSupported(void)
+{
+    return true;
+}
+
+
+/**
+ * Wrapper between the native solaris per-cpu callback and PFNRTWORKER
+ * for the RTMpOnSpecific API.
  *
  * @returns Solaris error code.
+ * @param   uArgs       Pointer to the RTMPARGS package.
+ * @param   pvIgnored1  Ignored.
+ * @param   pvIgnored2  Ignored.
  */
-static int rtMpSolOnSpecificCpuWrapper(void *uArg, void *uIgnored1, void *uIgnored2)
+static int rtMpSolOnSpecificCpuWrapper(void *uArg, void *pvIgnored1, void *pvIgnored2)
 {
     PRTMPARGS pArgs = (PRTMPARGS)(uArg);
     RTCPUID idCpu = RTMpCpuId();
@@ -302,8 +400,8 @@ static int rtMpSolOnSpecificCpuWrapper(void *uArg, void *uIgnored1, void *uIgnor
     pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2);
     ASMAtomicIncU32(&pArgs->cHits);
 
-    NOREF(uIgnored1);
-    NOREF(uIgnored2);
+    NOREF(pvIgnored1);
+    NOREF(pvIgnored2);
     return 0;
 }
 
@@ -311,6 +409,8 @@ static int rtMpSolOnSpecificCpuWrapper(void *uArg, void *uIgnored1, void *uIgnor
 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
     RTMPARGS Args;
+    RTSOLCPUSET CpuSet;
+    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     RT_ASSERT_INTS_ON();
 
     if (idCpu >= ncpus)
@@ -325,14 +425,12 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
     Args.idCpu = idCpu;
     Args.cHits = 0;
 
-    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
-    RTThreadPreemptDisable(&PreemptState);
-
-    RTSOLCPUSET CpuSet;
     for (int i = 0; i < IPRT_SOL_SET_WORDS; i++)
         CpuSet.auCpus[i] = 0;
     BT_SET(CpuSet.auCpus, idCpu);
 
+    RTThreadPreemptDisable(&PreemptState);
+
     rtMpSolCrossCall(&CpuSet, rtMpSolOnSpecificCpuWrapper, &Args);
 
     RTThreadPreemptRestore(&PreemptState);
@@ -344,3 +442,9 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1
          : VERR_CPU_NOT_FOUND;
 }
 
+
+RTDECL(bool) RTMpOnAllIsConcurrentSafe(void)
+{
+    return true;
+}
+
diff --git a/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c
index a7c1f9b..89ea669 100644
--- a/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/mpnotification-r0drv-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -63,44 +63,21 @@ typedef RTMPSOLWATCHCPUS *PRTMPSOLWATCHCPUS;
 
 
 /**
- * PFNRTMPWORKER worker for executing Mp events on the target CPU.
- *
- * @param    idCpu          The current CPU Id.
- * @param    pvArg          Opaque pointer to event type (online/offline).
- * @param    pvIgnored1     Ignored.
- */
-static void rtMpNotificationSolOnCurrentCpu(RTCPUID idCpu, void *pvArg, void *pvIgnored1)
-{
-    NOREF(pvIgnored1);
-    NOREF(idCpu);
-
-    PRTMPARGS pArgs = (PRTMPARGS)pvArg;
-    AssertRelease(pArgs && pArgs->idCpu == RTMpCpuId());
-    Assert(pArgs->pvUser1);
-    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-
-    RTMPEVENT enmMpEvent = *(RTMPEVENT *)pArgs->pvUser1;
-    rtMpNotificationDoCallbacks(enmMpEvent, pArgs->idCpu);
-}
-
-
-/**
  * Solaris callback function for Mp event notification.
  *
+ * @returns Solaris error code.
  * @param    CpuState   The current event/state of the CPU.
- * @param    iCpu       Which CPU is this event fore.
+ * @param    iCpu       Which CPU is this event for.
  * @param    pvArg      Ignored.
  *
  * @remarks This function assumes index == RTCPUID.
- * @returns Solaris error code.
+ *          We may -not- be firing on the CPU going online/offline and called
+ *          with preemption enabled.
  */
 static int rtMpNotificationCpuEvent(cpu_setup_t CpuState, int iCpu, void *pvArg)
 {
     RTMPEVENT enmMpEvent;
 
-    RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
-    RTThreadPreemptDisable(&PreemptState);
-
     /*
      * Update our CPU set structures first regardless of whether we've been
      * scheduled on the right CPU or not, this is just atomic accounting.
@@ -118,33 +95,7 @@ static int rtMpNotificationCpuEvent(cpu_setup_t CpuState, int iCpu, void *pvArg)
     else
         return 0;
 
-    /*
-     * Since we don't absolutely need to do CPU bound code in any of the CPU offline
-     * notification hooks, run it on the current CPU. Scheduling a callback to execute
-     * on the CPU going offline at this point is too late and will not work reliably.
-     */
-    bool fRunningOnTargetCpu = iCpu == RTMpCpuId();
-    if (   fRunningOnTargetCpu == true
-        || enmMpEvent == RTMPEVENT_OFFLINE)
-    {
-        rtMpNotificationDoCallbacks(enmMpEvent, iCpu);
-    }
-    else
-    {
-        /*
-         * We're not on the target CPU, schedule (synchronous) the event notification callback
-         * to run on the target CPU i.e. the CPU that was online'd.
-         */
-        RTMPARGS Args;
-        RT_ZERO(Args);
-        Args.pvUser1 = &enmMpEvent;
-        Args.pvUser2 = NULL;
-        Args.idCpu   = iCpu;
-        RTMpOnSpecific(iCpu, rtMpNotificationSolOnCurrentCpu, &Args, NULL /* pvIgnored1 */);
-    }
-
-    RTThreadPreemptRestore(&PreemptState);
-
+    rtMpNotificationDoCallbacks(enmMpEvent, iCpu);
     NOREF(pvArg);
     return 0;
 }
diff --git a/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h b/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h
index 033ea6d..ee40f2b 100644
--- a/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h
+++ b/src/VBox/Runtime/r0drv/solaris/semeventwait-r0drv-solaris.h
@@ -43,6 +43,9 @@
  *       CY_HIGH_LEVEL. */
 #define RTR0SEMSOLWAIT_NO_OLD_S10_FALLBACK
 
+#define SOL_THREAD_TINTR_PTR        ((kthread_t **)((char *)curthread + g_offrtSolThreadIntrThread))
+
+
 /**
  * Solaris semaphore wait structure.
  */
@@ -454,15 +457,17 @@ DECLINLINE(void) rtR0SemSolWaitEnterMutexWithUnpinningHack(kmutex_t *pMtx)
     if (!fAcquired)
     {
         /*
-         * Note! This assumes nobody is using the RTThreadPreemptDisable in an
+         * Note! This assumes nobody is using the RTThreadPreemptDisable() in an
          *       interrupt context and expects it to work right.  The swtch will
          *       result in a voluntary preemption.  To fix this, we would have to
-         *       do our own counting in RTThreadPreemptDisable/Restore like we do
+         *       do our own counting in RTThreadPreemptDisable/Restore() like we do
          *       on systems which doesn't do preemption (OS/2, linux, ...) and
-         *       check whether preemption was disabled via RTThreadPreemptDisable
-         *       or not and only call swtch if RTThreadPreemptDisable wasn't called.
+         *       check whether preemption was disabled via RTThreadPreemptDisable()
+         *       or not and only call swtch if RTThreadPreemptDisable() wasn't called.
          */
-        if (curthread->t_intr && getpil() < DISP_LEVEL)
+        kthread_t **ppIntrThread = SOL_THREAD_TINTR_PTR;
+        if (   *ppIntrThread
+            && getpil() < DISP_LEVEL)
         {
             RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
             RTThreadPreemptDisable(&PreemptState);
diff --git a/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c
index bae81d1..9540241 100644
--- a/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/spinlock-r0drv-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -202,15 +202,3 @@ RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)
     RT_ASSERT_PREEMPT_CPUID();
 }
 
-
-RTDECL(void) RTSpinlockReleaseNoInts(RTSPINLOCK Spinlock)
-{
-#if 1
-    if (RT_UNLIKELY(!(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE)))
-        RTAssertMsg2("RTSpinlockReleaseNoInts: %p (magic=%#x)\n", Spinlock, Spinlock->u32Magic);
-#else
-    AssertRelease(Spinlock->fFlags & RTSPINLOCK_FLAGS_INTERRUPT_SAFE);
-#endif
-    RTSpinlockRelease(Spinlock);
-}
-
diff --git a/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h b/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
index 0a5a1ad..3874aee 100644
--- a/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
+++ b/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -58,6 +58,7 @@
 #include <sys/ctf_api.h>
 #include <sys/modctl.h>
 #include <sys/proc.h>
+#include <sys/t_lock.h>
 
 #undef u /* /usr/include/sys/user.h:249:1 is where this is defined to (curproc->p_user). very cool. */
 
@@ -90,6 +91,10 @@ extern PFNSOL_cyclic_reprogram         g_pfnrtR0Sol_cyclic_reprogram;
 extern PFNSOL_contig_free              g_pfnrtR0Sol_contig_free;
 extern PFNSOL_page_noreloc_supported   g_pfnrtR0Sol_page_noreloc_supported;
 extern size_t                          g_offrtSolThreadPreempt;
+extern size_t                          g_offrtSolThreadIntrThread;
+extern size_t                          g_offrtSolThreadLock;
+extern size_t                          g_offrtSolThreadProc;
+extern size_t                          g_offrtSolThreadId;
 extern size_t                          g_offrtSolCpuPreempt;
 extern size_t                          g_offrtSolCpuForceKernelPreempt;
 extern bool                            g_frtSolInitDone;
diff --git a/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c
index 9983ba2..b8450f2 100644
--- a/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/thread-r0drv-solaris.c
@@ -89,16 +89,16 @@ RTDECL(bool) RTThreadYield(void)
     RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     RTThreadPreemptDisable(&PreemptState);
 
-    char cThreadPreempt = SOL_THREAD_PREEMPT;
-    char cForcePreempt  = SOL_CPU_KPRUNRUN;
+    char const bThreadPreempt = SOL_THREAD_PREEMPT;
+    char const bForcePreempt  = SOL_CPU_KPRUNRUN;
     bool fWillYield = false;
-    Assert(cThreadPreempt >= 1);
+    Assert(bThreadPreempt >= 1);
 
     /*
      * If we are the last preemption enabler for this thread and if force
      * preemption is set on the CPU, only then we are guaranteed to be preempted.
      */
-    if (cThreadPreempt == 1 && cForcePreempt != 0)
+    if (bThreadPreempt == 1 && bForcePreempt != 0)
         fWillYield = true;
 
     RTThreadPreemptRestore(&PreemptState);
@@ -135,9 +135,9 @@ RTDECL(bool) RTThreadPreemptIsPending(RTTHREAD hThread)
 {
     Assert(hThread == NIL_RTTHREAD);
 
-    char cPreempt      = SOL_CPU_RUNRUN;
-    char cForcePreempt = SOL_CPU_KPRUNRUN;
-    return (cPreempt != 0 || cForcePreempt != 0);
+    char const bPreempt      = SOL_CPU_RUNRUN;
+    char const bForcePreempt = SOL_CPU_KPRUNRUN;
+    return (bPreempt != 0 || bForcePreempt != 0);
 }
 
 
diff --git a/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c
index 0d77396..e8141b3 100644
--- a/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/thread2-r0drv-solaris.c
@@ -37,7 +37,8 @@
 #include <iprt/err.h>
 #include "internal/thread.h"
 
-
+#define SOL_THREAD_ID_PTR           ((uint64_t *)((char *)curthread + g_offrtSolThreadId))
+#define SOL_THREAD_LOCKP_PTR        ((disp_lock_t **)((char *)curthread + g_offrtSolThreadLock))
 
 DECLHIDDEN(int) rtThreadNativeInit(void)
 {
@@ -54,6 +55,7 @@ RTDECL(RTTHREAD) RTThreadSelf(void)
 DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enmType)
 {
     int iPriority;
+    disp_lock_t **ppDispLock;
     switch (enmType)
     {
         case RTTHREADTYPE_INFREQUENT_POLLER:    iPriority = 60;             break;
@@ -67,11 +69,18 @@ DECLHIDDEN(int) rtThreadNativeSetPriority(PRTTHREADINT pThread, RTTHREADTYPE enm
             return VERR_INVALID_PARAMETER;
     }
 
-    kthread_t *pCurThread = curthread;
-    Assert(pCurThread);
-    thread_lock(pCurThread);
-    thread_change_pri(pCurThread, iPriority, 0);
-    thread_unlock(pCurThread);
+    Assert(curthread);
+    thread_lock(curthread);
+    thread_change_pri(curthread, iPriority, 0);
+
+    /*
+     * thread_unlock() is a macro calling disp_lock_exit() with the thread's dispatcher lock.
+     * We need to dereference the offset manually here (for S10, S11 compatibility) rather than
+     * using the macro.
+     */
+    ppDispLock = SOL_THREAD_LOCKP_PTR;
+    disp_lock_exit(*ppDispLock);
+
     return VINF_SUCCESS;
 }
 
@@ -85,6 +94,12 @@ DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
 }
 
 
+DECLHIDDEN(void) rtThreadNativeWaitKludge(PRTTHREADINT pThread)
+{
+    thread_join(pThread->tid);
+}
+
+
 DECLHIDDEN(void) rtThreadNativeDestroy(PRTTHREADINT pThread)
 {
     NOREF(pThread);
@@ -100,6 +115,9 @@ static void rtThreadNativeMain(void *pvThreadInt)
 {
     PRTTHREADINT pThreadInt = (PRTTHREADINT)pvThreadInt;
 
+    AssertCompile(sizeof(kt_did_t) == sizeof(pThreadInt->tid));
+    uint64_t *pu64ThrId = SOL_THREAD_ID_PTR;
+    pThreadInt->tid = *pu64ThrId;
     rtThreadMain(pThreadInt, RTThreadNativeSelf(), &pThreadInt->szName[0]);
     thread_exit();
 }
@@ -107,16 +125,20 @@ static void rtThreadNativeMain(void *pvThreadInt)
 
 DECLHIDDEN(int) rtThreadNativeCreate(PRTTHREADINT pThreadInt, PRTNATIVETHREAD pNativeThread)
 {
+    kthread_t *pThread;
     RT_ASSERT_PREEMPTIBLE();
-    kthread_t *pThread = thread_create(NULL,                            /* Stack, use base */
-                                       0,                               /* Stack size */
-                                       rtThreadNativeMain,              /* Thread function */
-                                       pThreadInt,                      /* Function data */
-                                       0,                               /* Data size */
-                                       (proc_t *)RTR0ProcHandleSelf(),  /* Process handle */
-                                       TS_RUN,                          /* Ready to run */
-                                       minclsyspri                      /* Priority */
-                                       );
+
+    pThreadInt->tid = UINT64_MAX;
+
+    pThread = thread_create(NULL,                            /* Stack, use base */
+                            0,                               /* Stack size */
+                            rtThreadNativeMain,              /* Thread function */
+                            pThreadInt,                      /* Function data */
+                            0,                               /* Data size */
+                            &p0,                             /* Process 0 handle */
+                            TS_RUN,                          /* Ready to run */
+                            minclsyspri                      /* Priority */
+                            );
     if (RT_LIKELY(pThread))
     {
         *pNativeThread = (RTNATIVETHREAD)pThread;
diff --git a/src/VBox/Runtime/r0drv/solaris/threadctxhooks-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/threadctxhooks-r0drv-solaris.c
index 3f5b507..73c2353 100644
--- a/src/VBox/Runtime/r0drv/solaris/threadctxhooks-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/threadctxhooks-r0drv-solaris.c
@@ -1,10 +1,10 @@
 /* $Id: threadctxhooks-r0drv-solaris.c $ */
 /** @file
- * IPRT - Thread-Context Hook, Ring-0 Driver, Solaris.
+ * IPRT - Thread Context Switching Hook, Ring-0 Driver, Solaris.
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -44,75 +44,76 @@
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
 /**
- * The internal thread-context object.
+ * The internal hook object for solaris.
  */
-typedef struct RTTHREADCTXINT
+typedef struct RTTHREADCTXHOOKINT
 {
-    /** Magic value (RTTHREADCTXINT_MAGIC). */
+    /** Magic value (RTTHREADCTXHOOKINT_MAGIC). */
     uint32_t volatile           u32Magic;
     /** The thread handle (owner) for which the context-hooks are registered. */
     RTNATIVETHREAD              hOwner;
-    /** Pointer to the registered thread-context hook. */
-    PFNRTTHREADCTXHOOK          pfnThreadCtxHook;
-    /** User argument passed to the thread-context hook. */
+    /** Pointer to the registered callback function. */
+    PFNRTTHREADCTXHOOK          pfnCallback;
+    /** User argument passed to the callback function. */
     void                       *pvUser;
-    /** Whether this handle has any hooks registered or not. */
-    bool volatile               fRegistered;
+    /** Whether the hook is enabled or not. */
+    bool volatile               fEnabled;
     /** Number of references to this object. */
     uint32_t volatile           cRefs;
-} RTTHREADCTXINT, *PRTTHREADCTXINT;
+} RTTHREADCTXHOOKINT;
+typedef RTTHREADCTXHOOKINT *PRTTHREADCTXHOOKINT;
 
 
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-/** Validates a thread-context hook handle and returns rc if not valid. */
+/** Validates a hook handle and returns rc if not valid. */
 #define RTTHREADCTX_VALID_RETURN_RC(pThis, rc) \
     do { \
         AssertPtrReturn((pThis), (rc)); \
-        AssertReturn((pThis)->u32Magic == RTTHREADCTXINT_MAGIC, (rc)); \
+        AssertReturn((pThis)->u32Magic == RTTHREADCTXHOOKINT_MAGIC, (rc)); \
         AssertReturn((pThis)->cRefs > 0, (rc)); \
     } while (0)
 
 
 /**
- * Hook function for the thread-preempting event.
+ * Hook function for the thread-save event.
  *
- * @param   pvThreadCtxInt  Opaque pointer to the internal thread-context
- *                          object.
+ * @param   pvThreadCtxInt  Opaque pointer to the internal hook object.
  *
  * @remarks Called with the with preemption disabled!
  */
-static void rtThreadCtxHooksSolPreempting(void *pvThreadCtxInt)
+static void rtThreadCtxHookSolOut(void *pvThreadCtxInt)
 {
-    PRTTHREADCTXINT pThis = (PRTTHREADCTXINT)pvThreadCtxInt;
+    PRTTHREADCTXHOOKINT pThis = (PRTTHREADCTXHOOKINT)pvThreadCtxInt;
     AssertPtr(pThis);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    Assert(pThis->cRefs > 0);
 
-    if (pThis->fRegistered)
+    if (pThis->fEnabled)
     {
-        Assert(pThis->pfnThreadCtxHook);
-        pThis->pfnThreadCtxHook(RTTHREADCTXEVENT_PREEMPTING, pThis->pvUser);
+        Assert(pThis->pfnCallback);
+        pThis->pfnCallback(RTTHREADCTXEVENT_OUT, pThis->pvUser);
     }
 }
 
 
 /**
- * Hook function for the thread-resumed event.
+ * Hook function for the thread-restore event.
  *
- * @param   pvThreadCtxInt  Opaque pointer to the internal thread-context
- *                          object.
+ * @param   pvThreadCtxInt  Opaque pointer to the internal hook object.
  */
-static void rtThreadCtxHooksSolResumed(void *pvThreadCtxInt)
+static void rtThreadCtxHookSolIn(void *pvThreadCtxInt)
 {
-    PRTTHREADCTXINT pThis = (PRTTHREADCTXINT)pvThreadCtxInt;
+    PRTTHREADCTXHOOKINT pThis = (PRTTHREADCTXHOOKINT)pvThreadCtxInt;
     AssertPtr(pThis);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    Assert(pThis->cRefs > 0);
 
-    if (pThis->fRegistered)
+    if (pThis->fEnabled)
     {
-        Assert(pThis->pfnThreadCtxHook);
-        pThis->pfnThreadCtxHook(RTTHREADCTXEVENT_RESUMED, pThis->pvUser);
+        Assert(pThis->pfnCallback);
+        pThis->pfnCallback(RTTHREADCTXEVENT_IN, pThis->pvUser);
     }
 }
 
@@ -120,141 +121,152 @@ static void rtThreadCtxHooksSolResumed(void *pvThreadCtxInt)
 /**
  * Hook function for the thread-free event.
  *
- * @param   pvThreadCtxInt      Opaque pointer to the internal thread-context
- *                              object.
+ * This is used for making sure the hook object is safely released - see
+ * RTThreadCtxHookRelease for details.
+ *
+ * @param   pvThreadCtxInt      Opaque pointer to the internal hook object.
  * @param   fIsExec             Whether this event is triggered due to exec().
  */
-static void rtThreadCtxHooksSolFree(void *pvThreadCtxInt, int fIsExec)
+static void rtThreadCtxHookSolFree(void *pvThreadCtxInt, int fIsExec)
 {
-    PRTTHREADCTXINT pThis = (PRTTHREADCTXINT)pvThreadCtxInt;
+    PRTTHREADCTXHOOKINT pThis = (PRTTHREADCTXHOOKINT)pvThreadCtxInt;
     AssertPtrReturnVoid(pThis);
-    AssertMsgReturnVoid(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis));
+    AssertMsgReturnVoid(pThis->u32Magic == RTTHREADCTXHOOKINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis));
 
     uint32_t cRefs = ASMAtomicReadU32(&pThis->cRefs);
-    if (RT_UNLIKELY(!cRefs))
+    if (cRefs > 0)
     {
-        /* Should never happen. */
-        AssertMsgFailed(("rtThreadCtxHooksSolFree with cRefs=0 pThis=%p\n", pThis));
-        return;
+        cRefs = ASMAtomicDecU32(&pThis->cRefs);
+        if (!cRefs)
+        {
+            Assert(!pThis->fEnabled);
+            ASMAtomicWriteU32(&pThis->u32Magic, ~RTTHREADCTXHOOKINT_MAGIC);
+            RTMemFree(pThis);
+        }
     }
-
-    cRefs = ASMAtomicDecU32(&pThis->cRefs);
-    if (!cRefs)
+    else
     {
-        Assert(!pThis->fRegistered);
-        ASMAtomicWriteU32(&pThis->u32Magic, ~RTTHREADCTXINT_MAGIC);
-        RTMemFree(pThis);
+        /* Should never happen. */
+        AssertMsgFailed(("rtThreadCtxHookSolFree with cRefs=0 pThis=%p\n", pThis));
     }
 }
 
 
-RTDECL(int) RTThreadCtxHooksCreate(PRTTHREADCTX phThreadCtx)
+RTDECL(int) RTThreadCtxHookCreate(PRTTHREADCTXHOOK phCtxHook, uint32_t fFlags, PFNRTTHREADCTXHOOK pfnCallback, void *pvUser)
 {
-    PRTTHREADCTXINT pThis;
+    /*
+     * Validate input.
+     */
+    PRTTHREADCTXHOOKINT pThis;
     Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
+    AssertReturn(fFlags == 0, VERR_INVALID_FLAGS);
 
-    pThis = (PRTTHREADCTXINT)RTMemAllocZ(sizeof(*pThis));
+    /*
+     * Allocate and initialize a new hook.
+     */
+    pThis = (PRTTHREADCTXHOOKINT)RTMemAllocZ(sizeof(*pThis));
     if (RT_UNLIKELY(!pThis))
         return VERR_NO_MEMORY;
-    pThis->u32Magic    = RTTHREADCTXINT_MAGIC;
-    pThis->hOwner      = RTThreadNativeSelf();
-    pThis->fRegistered = false;
-    pThis->cRefs       = 2;               /* One reference for the thread, one for the hook object. */
+    pThis->u32Magic     = RTTHREADCTXHOOKINT_MAGIC;
+    pThis->hOwner       = RTThreadNativeSelf();
+    pThis->pfnCallback  = pfnCallback;
+    pThis->pvUser       = pvUser;
+    pThis->fEnabled     = false;
+    pThis->cRefs        = 2;        /* One reference for the thread, one for the caller. */
 
     /*
-     * installctx() allocates memory and thus cannot be used in RTThreadCtxHooksRegister() which can be used
-     * with preemption disabled. We allocate the context-hooks here and use 'fRegistered' to determine if we can
+     * installctx() allocates memory and thus cannot be used in RTThreadCtxHookRegister() which can be used
+     * with preemption disabled. We allocate the context-hooks here and use 'fEnabled' to determine if we can
      * invoke the consumer's hook or not.
      */
     if (g_frtSolOldThreadCtx)
     {
         g_rtSolThreadCtx.Install.pfnSol_installctx_old(curthread,
                                                        pThis,
-                                                       rtThreadCtxHooksSolPreempting,
-                                                       rtThreadCtxHooksSolResumed,
-                                                       NULL,                          /* fork */
-                                                       NULL,                          /* lwp_create */
-                                                       rtThreadCtxHooksSolFree);
+                                                       rtThreadCtxHookSolOut,   /* save */
+                                                       rtThreadCtxHookSolIn,    /* restore */
+                                                       NULL,                    /* fork */
+                                                       NULL,                    /* lwp_create */
+                                                       rtThreadCtxHookSolFree);
     }
     else
     {
         g_rtSolThreadCtx.Install.pfnSol_installctx(curthread,
                                                    pThis,
-                                                   rtThreadCtxHooksSolPreempting,
-                                                   rtThreadCtxHooksSolResumed,
-                                                   NULL,                              /* fork */
-                                                   NULL,                              /* lwp_create */
-                                                   NULL,                              /* exit */
-                                                   rtThreadCtxHooksSolFree);
+                                                   rtThreadCtxHookSolOut,       /* save */
+                                                   rtThreadCtxHookSolIn,        /* restore */
+                                                   NULL,                        /* fork */
+                                                   NULL,                        /* lwp_create */
+                                                   NULL,                        /* exit */
+                                                   rtThreadCtxHookSolFree);
     }
 
-    *phThreadCtx = pThis;
+    *phCtxHook = pThis;
     return VINF_SUCCESS;
 }
 
 
-RTDECL(uint32_t) RTThreadCtxHooksRetain(RTTHREADCTX hThreadCtx)
-{
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    RTTHREADCTX_VALID_RETURN_RC(hThreadCtx, UINT32_MAX);
-
-    uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs);
-    Assert(cRefs < UINT32_MAX / 2);
-    return cRefs;
-}
-
-
-RTDECL(uint32_t) RTThreadCtxHooksRelease(RTTHREADCTX hThreadCtx)
+RTDECL(int) RTThreadCtxHookDestroy(RTTHREADCTXHOOK hCtxHook)
 {
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    if (pThis == NIL_RTTHREADCTX)
-        return 0;
-
-    RTTHREADCTX_VALID_RETURN_RC(hThreadCtx, UINT32_MAX);
+    /*
+     * Validate input, ignoring NIL.
+     */
+    PRTTHREADCTXHOOKINT pThis = hCtxHook;
+    if (pThis == NIL_RTTHREADCTXHOOK)
+        return VINF_SUCCESS;
+    RTTHREADCTX_VALID_RETURN_RC(hCtxHook, VERR_INVALID_HANDLE);
     Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    Assert(pThis->fEnabled || pThis->hOwner == RTThreadNativeSelf());
 
-    ASMAtomicWriteBool(&pThis->fRegistered, false);
-    uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs);
+    /*
+     * Make sure it's disabled.
+     */
+    ASMAtomicWriteBool(&pThis->fEnabled, false);
 
+    /*
+     * Decrement.
+     */
+    uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs);
     if (   cRefs == 1
         && pThis->hOwner == RTThreadNativeSelf())
     {
         /*
-         * removectx() will invoke rtThreadCtxHooksSolFree() and there is no way to bypass it and still use
-         * rtThreadCtxHooksSolFree() at the same time.  Hence the convulated reference counting.
+         * removectx() will invoke rtThreadCtxHookSolFree() and there is no way to bypass it and still use
+         * rtThreadCtxHookSolFree() at the same time.  Hence the convulated reference counting.
          *
          * When this function is called from the owner thread and is the last reference, we call removectx() which
-         * will invoke rtThreadCtxHooksSolFree() with cRefs = 1 and that will then free the hook object.
+         * will invoke rtThreadCtxHookSolFree() with cRefs = 1 and that will then free the hook object.
          *
          * When the function is called from a different thread, we simply decrement the reference. Whenever the
-         * ring-0 thread dies, Solaris will call rtThreadCtxHooksSolFree() which will free the hook object.
+         * ring-0 thread dies, Solaris will call rtThreadCtxHookSolFree() which will free the hook object.
          */
         int rc;
         if (g_frtSolOldThreadCtx)
         {
             rc = g_rtSolThreadCtx.Remove.pfnSol_removectx_old(curthread,
                                                               pThis,
-                                                              rtThreadCtxHooksSolPreempting,
-                                                              rtThreadCtxHooksSolResumed,
-                                                              NULL,                          /* fork */
-                                                              NULL,                          /* lwp_create */
-                                                              rtThreadCtxHooksSolFree);
+                                                              rtThreadCtxHookSolOut,    /* save */
+                                                              rtThreadCtxHookSolIn,     /* restore */
+                                                              NULL,                     /* fork */
+                                                              NULL,                     /* lwp_create */
+                                                              rtThreadCtxHookSolFree);
         }
         else
         {
             rc = g_rtSolThreadCtx.Remove.pfnSol_removectx(curthread,
                                                           pThis,
-                                                          rtThreadCtxHooksSolPreempting,
-                                                          rtThreadCtxHooksSolResumed,
-                                                          NULL,                              /* fork */
-                                                          NULL,                              /* lwp_create */
-                                                          NULL,                              /* exit */
-                                                          rtThreadCtxHooksSolFree);
+                                                          rtThreadCtxHookSolOut,        /* save */
+                                                          rtThreadCtxHookSolIn,         /* restore */
+                                                          NULL,                         /* fork */
+                                                          NULL,                         /* lwp_create */
+                                                          NULL,                         /* exit */
+                                                          rtThreadCtxHookSolFree);
         }
         AssertMsg(rc, ("removectx() failed. rc=%d\n", rc));
         NOREF(rc);
 
-#ifdef VBOX_STRICT
+#if 0 /*def RT_STRICT - access after free */
         cRefs = ASMAtomicReadU32(&pThis->cRefs);
         Assert(!cRefs);
 #endif
@@ -266,7 +278,7 @@ RTDECL(uint32_t) RTThreadCtxHooksRelease(RTTHREADCTX hThreadCtx)
          * The ring-0 thread for this hook object has already died. Free up the object as we have no more references.
          */
         Assert(pThis->hOwner != RTThreadNativeSelf());
-        ASMAtomicWriteU32(&pThis->u32Magic, ~RTTHREADCTXINT_MAGIC);
+        ASMAtomicWriteU32(&pThis->u32Magic, ~RTTHREADCTXHOOKINT_MAGIC);
         RTMemFree(pThis);
     }
 
@@ -274,64 +286,62 @@ RTDECL(uint32_t) RTThreadCtxHooksRelease(RTTHREADCTX hThreadCtx)
 }
 
 
-RTDECL(int) RTThreadCtxHooksRegister(RTTHREADCTX hThreadCtx, PFNRTTHREADCTXHOOK pfnThreadCtxHook, void *pvUser)
+RTDECL(int) RTThreadCtxHookEnable(RTTHREADCTXHOOK hCtxHook)
 {
     /*
      * Validate input.
      */
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    if (pThis == NIL_RTTHREADCTX)
-        return VERR_INVALID_HANDLE;
+    PRTTHREADCTXHOOKINT pThis = hCtxHook;
     AssertPtr(pThis);
-    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
+    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXHOOKINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
                     VERR_INVALID_HANDLE);
     Assert(pThis->hOwner == RTThreadNativeSelf());
+    Assert(!pThis->fEnabled);
 
     /*
-     * Register the callback.
+     * Mark it as enabled.
      */
-    pThis->pvUser           = pvUser;
-    pThis->pfnThreadCtxHook = pfnThreadCtxHook;
-    pThis->fRegistered      = true;
+    pThis->fEnabled = true;
 
     return VINF_SUCCESS;
 }
 
 
-RTDECL(int) RTThreadCtxHooksDeregister(RTTHREADCTX hThreadCtx)
+RTDECL(int) RTThreadCtxHookDisable(RTTHREADCTXHOOK hCtxHook)
 {
     /*
      * Validate input.
      */
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    if (pThis == NIL_RTTHREADCTX)
-        return VERR_INVALID_HANDLE;
-    AssertPtr(pThis);
-    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
-                    VERR_INVALID_HANDLE);
-    Assert(pThis->hOwner == RTThreadNativeSelf());
-    Assert(pThis->fRegistered);
+    PRTTHREADCTXHOOKINT pThis = hCtxHook;
+    if (pThis != NIL_RTTHREADCTXHOOK)
+    {
+        AssertPtr(pThis);
+        AssertMsgReturn(pThis->u32Magic == RTTHREADCTXHOOKINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
+                        VERR_INVALID_HANDLE);
+        Assert(pThis->hOwner == RTThreadNativeSelf());
 
-    /*
-     * Deregister the callback.
-     */
-    pThis->fRegistered = false;
+        /*
+         * Mark it as disabled.
+         */
+        pThis->fEnabled = false;
+    }
 
     return VINF_SUCCESS;
 }
 
 
-RTDECL(bool) RTThreadCtxHooksAreRegistered(RTTHREADCTX hThreadCtx)
+RTDECL(bool) RTThreadCtxHookIsEnabled(RTTHREADCTXHOOK hCtxHook)
 {
     /*
      * Validate input.
      */
-    PRTTHREADCTXINT pThis = hThreadCtx;
-    if (pThis == NIL_RTTHREADCTX)
+    PRTTHREADCTXHOOKINT pThis = hCtxHook;
+    if (pThis == NIL_RTTHREADCTXHOOK)
         return false;
     AssertPtr(pThis);
-    AssertMsg(pThis->u32Magic == RTTHREADCTXINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis));
+    AssertMsgReturn(pThis->u32Magic == RTTHREADCTXHOOKINT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis),
+                    false);
 
-    return pThis->fRegistered;
+    return pThis->fEnabled;
 }
 
diff --git a/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c
index d4113ac..e79f238 100644
--- a/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/time-r0drv-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -42,7 +42,7 @@ RTDECL(uint64_t) RTTimeNanoTS(void)
 
 RTDECL(uint64_t) RTTimeMilliTS(void)
 {
-    return RTTimeNanoTS() / 1000000;
+    return RTTimeNanoTS() / RT_NS_1MS;
 }
 
 
@@ -54,7 +54,7 @@ RTDECL(uint64_t) RTTimeSystemNanoTS(void)
 
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return RTTimeNanoTS() / 1000000;
+    return RTTimeNanoTS() / RT_NS_1MS;
 }
 
 
@@ -65,6 +65,6 @@ RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
     mutex_enter(&tod_lock);
     TimeSpec = tod_get();
     mutex_exit(&tod_lock);
-    return RTTimeSpecSetNano(pTime, (uint64_t)TimeSpec.tv_sec * 1000000000 + TimeSpec.tv_nsec);
+    return RTTimeSpecSetNano(pTime, (uint64_t)TimeSpec.tv_sec * RT_NS_1SEC + TimeSpec.tv_nsec);
 }
 
diff --git a/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c b/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c
index dd61201..c313233 100644
--- a/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c
+++ b/src/VBox/Runtime/r0drv/solaris/timer-r0drv-solaris.c
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -45,38 +45,11 @@
 #include <iprt/thread.h>
 #include "internal/magics.h"
 
-#define SOL_TIMER_ANY_CPU       (-1)
 
 /*******************************************************************************
 *   Structures and Typedefs                                                    *
 *******************************************************************************/
 /**
- * Single-CPU timer handle.
- */
-typedef struct RTR0SINGLETIMERSOL
-{
-    /** Cyclic handler. */
-    cyc_handler_t           hHandler;
-    /** Cyclic time and interval representation. */
-    cyc_time_t              hFireTime;
-    /** Timer ticks. */
-    uint64_t                u64Tick;
-} RTR0SINGLETIMERSOL;
-typedef RTR0SINGLETIMERSOL *PRTR0SINGLETIMERSOL;
-
-/**
- * Omni-CPU timer handle.
- */
-typedef struct RTR0OMNITIMERSOL
-{
-    /** Absolute timestamp of when the timer should fire next. */
-    uint64_t                u64When;
-    /** Array of timer ticks per CPU. Reinitialized when a CPU is online'd. */
-    uint64_t               *au64Ticks;
-} RTR0OMNITIMERSOL;
-typedef RTR0OMNITIMERSOL *PRTR0OMNITIMERSOL;
-
-/**
  * The internal representation of a Solaris timer handle.
  */
 typedef struct RTTIMER
@@ -85,28 +58,65 @@ typedef struct RTTIMER
      * This is RTTIMER_MAGIC, but changes to something else before the timer
      * is destroyed to indicate clearly that thread should exit. */
     uint32_t volatile       u32Magic;
-    /** Flag indicating that the timer is suspended. */
-    uint8_t volatile        fSuspended;
+    /** Reference counter. */
+    uint32_t volatile       cRefs;
+    /** Flag indicating that the timer is suspended (hCyclicId should be
+     *  CYCLIC_NONE). */
+    bool volatile           fSuspended;
+    /** Flag indicating that the timer was suspended from the timer callback and
+     * therefore the hCyclicId may still be valid. */
+    bool volatile           fSuspendedFromTimer;
+    /** Flag indicating that the timer interval was changed and that it requires
+     * manual expiration time programming for each callout. */
+    bool volatile           fIntervalChanged;
     /** Whether the timer must run on all CPUs or not. */
-    uint8_t                 fAllCpu;
+    uint8_t                 fAllCpus;
     /** Whether the timer must run on a specific CPU or not. */
     uint8_t                 fSpecificCpu;
     /** The CPU it must run on if fSpecificCpu is set. */
-    uint8_t                 iCpu;
+    uint32_t                iCpu;
     /** The nano second interval for repeating timers. */
-    uint64_t                interval;
-    /** Cyclic timer Id. */
+    uint64_t volatile       cNsInterval;
+    /** Cyclic timer Id.  This is CYCLIC_NONE if no active timer.
+     * @remarks Please keep in mind that cyclic may call us back before the
+     *          cyclic_add/cyclic_add_omni functions returns, so don't use this
+     *          unguarded with cyclic_reprogram. */
     cyclic_id_t             hCyclicId;
-    /** @todo Make this a union unless we intend to support omni<=>single timers
-     *        conversions. */
-    /** Single-CPU timer handle. */
-    PRTR0SINGLETIMERSOL     pSingleTimer;
-    /** Omni-CPU timer handle. */
-    PRTR0OMNITIMERSOL       pOmniTimer;
     /** The user callback. */
     PFNRTTIMER              pfnTimer;
     /** The argument for the user callback. */
     void                   *pvUser;
+    /** Union with timer type specific data. */
+    union
+    {
+        /** Single timer (fAllCpus == false). */
+        struct
+        {
+            /** Timer ticks. */
+            uint64_t        u64Tick;
+            /** The next tick when fIntervalChanged is true, otherwise 0. */
+            uint64_t        nsNextTick;
+            /** The (interrupt) thread currently active in the callback. */
+            kthread_t * volatile pActiveThread;
+        } Single;
+
+        /** Omni timer (fAllCpus == true). */
+        struct
+        {
+            /** Absolute timestamp of when the timer should fire first when starting up. */
+            uint64_t        u64When;
+            /** Array of per CPU data (variable size). */
+            struct
+            {
+                /** Timer ticks (reinitialized when online'd). */
+                uint64_t    u64Tick;
+                /** The (interrupt) thread currently active in the callback. */
+                kthread_t * volatile pActiveThread;
+                /** The next tick when fIntervalChanged is true, otherwise 0. */
+                uint64_t    nsNextTick;
+            } aPerCpu[1];
+        } Omni;
+    } u;
 } RTTIMER;
 
 
@@ -123,38 +133,125 @@ typedef struct RTTIMER
     } while (0)
 
 
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static void rtTimerSolSingleCallbackWrapper(void *pvArg);
+static void rtTimerSolStopIt(PRTTIMER pTimer);
+
+
+/**
+ * Retains a reference to the timer.
+ *
+ * @returns New reference counter value.
+ * @param   pTimer              The timer.
+ */
+DECLINLINE(uint32_t) rtTimerSolRetain(PRTTIMER pTimer)
+{
+    return ASMAtomicIncU32(&pTimer->cRefs);
+}
+
+
+/**
+ * Destroys the timer when the reference counter has reached zero.
+ *
+ * @returns 0 (new references counter value).
+ * @param   pTimer              The timer.
+ */
+static uint32_t rtTimeSolReleaseCleanup(PRTTIMER pTimer)
+{
+    Assert(pTimer->hCyclicId == CYCLIC_NONE);
+    ASMAtomicWriteU32(&pTimer->u32Magic, ~RTTIMER_MAGIC);
+    RTMemFree(pTimer);
+    return 0;
+}
+
+
 /**
- * Callback wrapper for specific timers if they happened to have been fired on
- * the wrong CPU. See rtTimerSolCallbackWrapper().
+ * Releases a reference to the timer.
  *
- * @param   idCpu       The CPU this is fired on.
- * @param   pvUser1     Opaque pointer to the timer.
- * @param   pvUser2     Not used, NULL.
+ * @returns New reference counter value.
+ * @param   pTimer              The timer.
  */
-static void rtTimerSolMpCallbackWrapper(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+DECLINLINE(uint32_t) rtTimerSolRelease(PRTTIMER pTimer)
 {
-    PRTTIMER pTimer = (PRTTIMER)pvUser1;
+    uint32_t cRefs = ASMAtomicDecU32(&pTimer->cRefs);
+    if (!cRefs)
+        return rtTimeSolReleaseCleanup(pTimer);
+    return cRefs;
+}
+
+
+/**
+ * Callback wrapper for single-CPU timers.
+ *
+ * @param    pvArg              Opaque pointer to the timer.
+ *
+ * @remarks This will be executed in interrupt context but only at the specified
+ *          level i.e. CY_LOCK_LEVEL in our case. We -CANNOT- call into the
+ *          cyclic subsystem here, neither should pfnTimer().
+ */
+static void rtTimerSolSingleCallbackWrapper(void *pvArg)
+{
+    PRTTIMER pTimer = (PRTTIMER)pvArg;
     AssertPtrReturnVoid(pTimer);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-    Assert(pTimer->iCpu == RTMpCpuId());    /* ASSUMES: index == cpuid */
-    Assert(pTimer->pSingleTimer);
-    NOREF(pvUser2);
+    Assert(!pTimer->fAllCpus);
 
     /* Make sure one-shots do not fire another time. */
     Assert(   !pTimer->fSuspended
-           || pTimer->interval != 0);
+           || pTimer->cNsInterval != 0);
+
+    if (!pTimer->fSuspendedFromTimer)
+    {
+        /* Make sure we are firing on the right CPU. */
+        Assert(   !pTimer->fSpecificCpu
+               || pTimer->iCpu == RTMpCpuId());
+
+        /* For one-shot, we may allow the callback to restart them. */
+        if (pTimer->cNsInterval == 0)
+            pTimer->fSuspendedFromTimer = true;
+
+        /*
+         * Perform the callout.
+         */
+        pTimer->u.Single.pActiveThread = curthread;
 
-    /* For one-shot specific timers, allow RTTimer to restart them. */
-    if (pTimer->interval == 0)
-        pTimer->fSuspended = true;
+        uint64_t u64Tick = ++pTimer->u.Single.u64Tick;
+        pTimer->pfnTimer(pTimer, pTimer->pvUser, u64Tick);
+
+        pTimer->u.Single.pActiveThread = NULL;
+
+        if (RT_LIKELY(!pTimer->fSuspendedFromTimer))
+        {
+            if (   !pTimer->fIntervalChanged
+                || RT_UNLIKELY(pTimer->hCyclicId == CYCLIC_NONE))
+                return;
+
+            /*
+             * The interval was changed, we need to set the expiration time
+             * ourselves before returning.  This comes at a slight cost,
+             * which is why we don't do it all the time.
+             */
+            if (pTimer->u.Single.nsNextTick)
+                pTimer->u.Single.nsNextTick += ASMAtomicUoReadU64(&pTimer->cNsInterval);
+            else
+                pTimer->u.Single.nsNextTick = RTTimeSystemNanoTS() + ASMAtomicUoReadU64(&pTimer->cNsInterval);
+            cyclic_reprogram(pTimer->hCyclicId, pTimer->u.Single.nsNextTick);
+            return;
+        }
 
-    uint64_t u64Tick = ++pTimer->pSingleTimer->u64Tick;
-    pTimer->pfnTimer(pTimer, pTimer->pvUser, u64Tick);
+        /*
+         * The timer has been suspended, set expiration time to infinitiy.
+         */
+    }
+    if (RT_LIKELY(pTimer->hCyclicId != CYCLIC_NONE))
+        cyclic_reprogram(pTimer->hCyclicId, CY_INFINITY);
 }
 
 
 /**
- * Callback wrapper for Omni-CPU and single-CPU timers.
+ * Callback wrapper for Omni-CPU timers.
  *
  * @param    pvArg              Opaque pointer to the timer.
  *
@@ -162,39 +259,55 @@ static void rtTimerSolMpCallbackWrapper(RTCPUID idCpu, void *pvUser1, void *pvUs
  *          level i.e. CY_LOCK_LEVEL in our case. We -CANNOT- call into the
  *          cyclic subsystem here, neither should pfnTimer().
  */
-static void rtTimerSolCallbackWrapper(void *pvArg)
+static void rtTimerSolOmniCallbackWrapper(void *pvArg)
 {
     PRTTIMER pTimer = (PRTTIMER)pvArg;
     AssertPtrReturnVoid(pTimer);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    Assert(pTimer->fAllCpus);
 
-    if (pTimer->pSingleTimer)
+    if (!pTimer->fSuspendedFromTimer)
     {
-        /* Make sure one-shots do not fire another time. */
-        Assert(   !pTimer->fSuspended
-               || pTimer->interval != 0);
+        /*
+         * Perform the callout.
+         */
+        uint32_t const iCpu = CPU->cpu_id;
 
-        /* For specific timers, we might fire on the wrong CPU between cyclic_add() and cyclic_bind().
-           Redirect these shots to the right CPU as we are temporarily rebinding to the right CPU. */
-        if (   pTimer->fSpecificCpu
-            && pTimer->iCpu != RTMpCpuId())          /* ASSUMES: index == cpuid */
+        pTimer->u.Omni.aPerCpu[iCpu].pActiveThread = curthread;
+        uint64_t u64Tick = ++pTimer->u.Omni.aPerCpu[iCpu].u64Tick;
+
+        pTimer->pfnTimer(pTimer, pTimer->pvUser, u64Tick);
+
+        pTimer->u.Omni.aPerCpu[iCpu].pActiveThread = NULL;
+
+        if (RT_LIKELY(!pTimer->fSuspendedFromTimer))
         {
-            RTMpOnSpecific(pTimer->iCpu, rtTimerSolMpCallbackWrapper, pTimer, NULL);
+            if (   !pTimer->fIntervalChanged
+                || RT_UNLIKELY(pTimer->hCyclicId == CYCLIC_NONE))
+                return;
+
+            /*
+             * The interval was changed, we need to set the expiration time
+             * ourselves before returning.  This comes at a slight cost,
+             * which is why we don't do it all the time.
+             *
+             * Note! The cyclic_reprogram call only affects the omni cyclic
+             *       component for this CPU.
+             */
+            if (pTimer->u.Omni.aPerCpu[iCpu].nsNextTick)
+                pTimer->u.Omni.aPerCpu[iCpu].nsNextTick += ASMAtomicUoReadU64(&pTimer->cNsInterval);
+            else
+                pTimer->u.Omni.aPerCpu[iCpu].nsNextTick = RTTimeSystemNanoTS() + ASMAtomicUoReadU64(&pTimer->cNsInterval);
+            cyclic_reprogram(pTimer->hCyclicId, pTimer->u.Omni.aPerCpu[iCpu].nsNextTick);
             return;
         }
 
-        /* For one-shot any-cpu timers, allow RTTimer to restart them. */
-        if (pTimer->interval == 0)
-            pTimer->fSuspended = true;
-
-        uint64_t u64Tick = ++pTimer->pSingleTimer->u64Tick;
-        pTimer->pfnTimer(pTimer, pTimer->pvUser, u64Tick);
-    }
-    else if (pTimer->pOmniTimer)
-    {
-        uint64_t u64Tick = ++pTimer->pOmniTimer->au64Ticks[CPU->cpu_id];
-        pTimer->pfnTimer(pTimer, pTimer->pvUser, u64Tick);
+        /*
+         * The timer has been suspended, set expiration time to infinitiy.
+         */
     }
+    if (RT_LIKELY(pTimer->hCyclicId != CYCLIC_NONE))
+        cyclic_reprogram(pTimer->hCyclicId, CY_INFINITY);
 }
 
 
@@ -218,19 +331,22 @@ static void rtTimerSolOmniCpuOnline(void *pvArg, cpu_t *pCpu, cyc_handler_t *pCy
     AssertPtrReturnVoid(pCpu);
     AssertPtrReturnVoid(pCyclicHandler);
     AssertPtrReturnVoid(pCyclicTime);
+    uint32_t const iCpu = pCpu->cpu_id; /* Note! CPU is not necessarily the same as pCpu. */
+
+    pTimer->u.Omni.aPerCpu[iCpu].u64Tick = 0;
+    pTimer->u.Omni.aPerCpu[iCpu].nsNextTick = 0;
 
-    pTimer->pOmniTimer->au64Ticks[pCpu->cpu_id] = 0;
-    pCyclicHandler->cyh_func  = rtTimerSolCallbackWrapper;
+    pCyclicHandler->cyh_func  = (cyc_func_t)rtTimerSolOmniCallbackWrapper;
     pCyclicHandler->cyh_arg   = pTimer;
     pCyclicHandler->cyh_level = CY_LOCK_LEVEL;
 
-    uint64_t u64Now = RTTimeNanoTS();
-    if (pTimer->pOmniTimer->u64When < u64Now)
-        pCyclicTime->cyt_when = u64Now + pTimer->interval / 2;
+    uint64_t u64Now = RTTimeSystemNanoTS();
+    if (pTimer->u.Omni.u64When < u64Now)
+        pCyclicTime->cyt_when = u64Now + pTimer->cNsInterval / 2;
     else
-        pCyclicTime->cyt_when = pTimer->pOmniTimer->u64When;
+        pCyclicTime->cyt_when = pTimer->u.Omni.u64When;
 
-    pCyclicTime->cyt_interval = pTimer->interval;
+    pCyclicTime->cyt_interval = pTimer->cNsInterval;
 }
 
 
@@ -253,42 +369,44 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
     /* One-shot omni timers are not supported by the cyclic system. */
     if (   (fFlags & RTTIMER_FLAGS_CPU_ALL) == RTTIMER_FLAGS_CPU_ALL
         && u64NanoInterval == 0)
-    {
         return VERR_NOT_SUPPORTED;
-    }
 
     /*
-     * Allocate and initialize the timer handle.
+     * Allocate and initialize the timer handle.  The omni variant has a
+     * variable sized array of ticks counts, thus the size calculation.
      */
-    PRTTIMER pTimer = (PRTTIMER)RTMemAlloc(sizeof(*pTimer));
+    PRTTIMER pTimer = (PRTTIMER)RTMemAllocZ(  (fFlags & RTTIMER_FLAGS_CPU_ALL) == RTTIMER_FLAGS_CPU_ALL
+                                            ? RT_OFFSETOF(RTTIMER, u.Omni.aPerCpu[RTMpGetCount()])
+                                            : sizeof(RTTIMER));
     if (!pTimer)
         return VERR_NO_MEMORY;
 
     pTimer->u32Magic = RTTIMER_MAGIC;
+    pTimer->cRefs = 1;
     pTimer->fSuspended = true;
+    pTimer->fSuspendedFromTimer = false;
+    pTimer->fIntervalChanged = false;
     if ((fFlags & RTTIMER_FLAGS_CPU_ALL) == RTTIMER_FLAGS_CPU_ALL)
     {
-        pTimer->fAllCpu = true;
+        pTimer->fAllCpus = true;
         pTimer->fSpecificCpu = false;
-        pTimer->iCpu = 255;
+        pTimer->iCpu = UINT32_MAX;
     }
     else if (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC)
     {
-        pTimer->fAllCpu = false;
+        pTimer->fAllCpus = false;
         pTimer->fSpecificCpu = true;
         pTimer->iCpu = fFlags & RTTIMER_FLAGS_CPU_MASK; /* ASSUMES: index == cpuid */
     }
     else
     {
-        pTimer->fAllCpu = false;
+        pTimer->fAllCpus = false;
         pTimer->fSpecificCpu = false;
-        pTimer->iCpu = 255;
+        pTimer->iCpu = UINT32_MAX;
     }
-    pTimer->interval = u64NanoInterval;
+    pTimer->cNsInterval = u64NanoInterval;
     pTimer->pfnTimer = pfnTimer;
     pTimer->pvUser = pvUser;
-    pTimer->pSingleTimer = NULL;
-    pTimer->pOmniTimer = NULL;
     pTimer->hCyclicId = CYCLIC_NONE;
 
     *ppTimer = pTimer;
@@ -296,6 +414,24 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *ppTimer, uint64_t u64NanoInterval, uint32_
 }
 
 
+/**
+ * Checks if the calling thread is currently executing the timer proceduce for
+ * the given timer.
+ *
+ * @returns true if it is, false if it isn't.
+ * @param   pTimer              The timer in question.
+ */
+DECLINLINE(bool) rtTimerSolIsCallingFromTimerProc(PRTTIMER pTimer)
+{
+    kthread_t *pCurThread = curthread;
+    AssertReturn(pCurThread, false); /* serious paranoia */
+
+    if (!pTimer->fAllCpus)
+        return pTimer->u.Single.pActiveThread == pCurThread;
+    return pTimer->u.Omni.aPerCpu[CPU->cpu_id].pActiveThread == pCurThread;
+}
+
+
 RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
 {
     if (pTimer == NULL)
@@ -304,11 +440,21 @@ RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)
     RT_ASSERT_INTS_ON();
 
     /*
-     * Free the associated resources.
+     * It is not possible to destroy a timer from it's callback function.
+     * Cyclic makes that impossible (or at least extremely risky).
+     */
+    AssertReturn(!rtTimerSolIsCallingFromTimerProc(pTimer), VERR_INVALID_CONTEXT);
+
+    /*
+     * Invalidate the handle, make sure it's stopped and free the associated resources.
      */
-    RTTimerStop(pTimer);
     ASMAtomicWriteU32(&pTimer->u32Magic, ~RTTIMER_MAGIC);
-    RTMemFree(pTimer);
+
+    if (   !pTimer->fSuspended
+        || pTimer->hCyclicId != CYCLIC_NONE) /* 2nd check shouldn't happen */
+        rtTimerSolStopIt(pTimer);
+
+    rtTimerSolRelease(pTimer);
     return VINF_SUCCESS;
 }
 
@@ -318,90 +464,116 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
     RTTIMER_ASSERT_VALID_RET(pTimer);
     RT_ASSERT_INTS_ON();
 
-    if (!pTimer->fSuspended)
-        return VERR_TIMER_ACTIVE;
+    /*
+     * It's not possible to restart a one-shot time from it's callback function,
+     * at least not at the moment.
+     */
+    AssertReturn(!rtTimerSolIsCallingFromTimerProc(pTimer), VERR_INVALID_CONTEXT);
 
-    pTimer->fSuspended = false;
-    if (pTimer->fAllCpu)
-    {
-        Assert(pTimer->interval);
-        PRTR0OMNITIMERSOL pOmniTimer = RTMemAllocZ(sizeof(RTR0OMNITIMERSOL));
-        if (RT_UNLIKELY(!pOmniTimer))
-            return VERR_NO_MEMORY;
+    mutex_enter(&cpu_lock);
 
-        pOmniTimer->au64Ticks = RTMemAllocZ(RTMpGetCount() * sizeof(uint64_t));
-        if (RT_UNLIKELY(!pOmniTimer->au64Ticks))
+    /*
+     * Make sure it's not active already.  If it was suspended from a timer
+     * callback function, we need to do some cleanup work here before we can
+     * restart the timer.
+     */
+    if (!pTimer->fSuspended)
+    {
+        if (!pTimer->fSuspendedFromTimer)
         {
-            RTMemFree(pOmniTimer);
-            return VERR_NO_MEMORY;
+            mutex_exit(&cpu_lock);
+            return VERR_TIMER_ACTIVE;
         }
+        cyclic_remove(pTimer->hCyclicId);
+        pTimer->hCyclicId = CYCLIC_NONE;
+    }
 
+    pTimer->fSuspended = false;
+    pTimer->fSuspendedFromTimer = false;
+    pTimer->fIntervalChanged = false;
+    if (pTimer->fAllCpus)
+    {
         /*
          * Setup omni (all CPU) timer. The Omni-CPU online event will fire
          * and from there we setup periodic timers per CPU.
          */
-        pTimer->pOmniTimer = pOmniTimer;
-        pOmniTimer->u64When     = pTimer->interval + RTTimeNanoTS();
+        pTimer->u.Omni.u64When  = RTTimeSystemNanoTS() + (u64First ? u64First : pTimer->cNsInterval);
 
-        cyc_omni_handler_t hOmni;
-        hOmni.cyo_online        = rtTimerSolOmniCpuOnline;
-        hOmni.cyo_offline       = NULL;
-        hOmni.cyo_arg           = pTimer;
+        cyc_omni_handler_t HandlerOmni;
+        HandlerOmni.cyo_online  = rtTimerSolOmniCpuOnline;
+        HandlerOmni.cyo_offline = NULL;
+        HandlerOmni.cyo_arg     = pTimer;
 
-        mutex_enter(&cpu_lock);
-        pTimer->hCyclicId = cyclic_add_omni(&hOmni);
-        mutex_exit(&cpu_lock);
+        pTimer->hCyclicId = cyclic_add_omni(&HandlerOmni);
     }
     else
     {
-        int iCpu = SOL_TIMER_ANY_CPU;
-        if (pTimer->fSpecificCpu)
-        {
-            iCpu = pTimer->iCpu;
-            if (!RTMpIsCpuOnline(iCpu))    /* ASSUMES: index == cpuid */
-                return VERR_CPU_OFFLINE;
-        }
+        cyc_handler_t Handler;
+        cyc_time_t    FireTime;
 
-        PRTR0SINGLETIMERSOL pSingleTimer = RTMemAllocZ(sizeof(RTR0SINGLETIMERSOL));
-        if (RT_UNLIKELY(!pSingleTimer))
-            return VERR_NO_MEMORY;
-
-        pTimer->pSingleTimer = pSingleTimer;
-        pSingleTimer->hHandler.cyh_func  = rtTimerSolCallbackWrapper;
-        pSingleTimer->hHandler.cyh_arg   = pTimer;
-        pSingleTimer->hHandler.cyh_level = CY_LOCK_LEVEL;
-
-        mutex_enter(&cpu_lock);
-        if (   iCpu != SOL_TIMER_ANY_CPU
-            && !cpu_is_online(cpu[iCpu]))
+        /*
+         * Setup a single CPU timer.   If a specific CPU was requested, it
+         * must be online or the timer cannot start.
+         */
+        if (   pTimer->fSpecificCpu
+            && !RTMpIsCpuOnline(pTimer->iCpu)) /* ASSUMES: index == cpuid */
         {
+            pTimer->fSuspended = true;
+
             mutex_exit(&cpu_lock);
-            RTMemFree(pSingleTimer);
-            pTimer->pSingleTimer = NULL;
             return VERR_CPU_OFFLINE;
         }
 
-        pSingleTimer->hFireTime.cyt_when = u64First + RTTimeNanoTS();
-        if (pTimer->interval == 0)
+        Handler.cyh_func  = (cyc_func_t)rtTimerSolSingleCallbackWrapper;
+        Handler.cyh_arg   = pTimer;
+        Handler.cyh_level = CY_LOCK_LEVEL;
+
+        /*
+         * Use a large interval (1 hour) so that we don't get a timer-callback between
+         * cyclic_add() and cyclic_bind(). Program the correct interval once cyclic_bind() is done.
+         * See @bugref{7691} comment #20.
+         */
+        if (!pTimer->fSpecificCpu)
+            FireTime.cyt_when = RTTimeSystemNanoTS() + u64First;
+        else
+            FireTime.cyt_when = RTTimeSystemNanoTS() + u64First + RT_NS_1HOUR;
+        FireTime.cyt_interval = pTimer->cNsInterval != 0
+                              ? pTimer->cNsInterval
+                              : CY_INFINITY /* Special value, see cyclic_fire(). */;
+        pTimer->u.Single.u64Tick = 0;
+        pTimer->u.Single.nsNextTick = 0;
+
+        pTimer->hCyclicId = cyclic_add(&Handler, &FireTime);
+        if (pTimer->fSpecificCpu)
         {
-            /*
-             * cylic_add() comment: "The caller is responsible for assuring that cyt_when + cyt_interval <= INT64_MAX"
-             * but it contradicts itself because cyclic_reprogram() updates only the interval and accepts CY_INFINITY as
-             * a valid, special value. See cyclic_fire().
-             */
-            pSingleTimer->hFireTime.cyt_interval = CY_INFINITY;
+            cyclic_bind(pTimer->hCyclicId, cpu[pTimer->iCpu], NULL /* cpupart */);
+            cyclic_reprogram(pTimer->hCyclicId, RTTimeSystemNanoTS() + u64First);
         }
-        else
-            pSingleTimer->hFireTime.cyt_interval = pTimer->interval;
+    }
+
+    mutex_exit(&cpu_lock);
+    return VINF_SUCCESS;
+}
 
-        pTimer->hCyclicId = cyclic_add(&pSingleTimer->hHandler, &pSingleTimer->hFireTime);
-        if (iCpu != SOL_TIMER_ANY_CPU)
-            cyclic_bind(pTimer->hCyclicId, cpu[iCpu], NULL /* cpupart */);
 
-        mutex_exit(&cpu_lock);
+/**
+ * Worker common for RTTimerStop and RTTimerDestroy.
+ *
+ * @param   pTimer      The timer to stop.
+ */
+static void rtTimerSolStopIt(PRTTIMER pTimer)
+{
+    mutex_enter(&cpu_lock);
+
+    pTimer->fSuspended = true;
+    if (pTimer->hCyclicId != CYCLIC_NONE)
+    {
+        cyclic_remove(pTimer->hCyclicId);
+        pTimer->hCyclicId = CYCLIC_NONE;
     }
+    pTimer->fSuspendedFromTimer = false;
 
-    return VINF_SUCCESS;
+    mutex_exit(&cpu_lock);
 }
 
 
@@ -413,22 +585,13 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer)
     if (pTimer->fSuspended)
         return VERR_TIMER_SUSPENDED;
 
-    pTimer->fSuspended = true;
-    if (pTimer->pSingleTimer)
-    {
-        mutex_enter(&cpu_lock);
-        cyclic_remove(pTimer->hCyclicId);
-        mutex_exit(&cpu_lock);
-        RTMemFree(pTimer->pSingleTimer);
-    }
-    else if (pTimer->pOmniTimer)
-    {
-        mutex_enter(&cpu_lock);
-        cyclic_remove(pTimer->hCyclicId);
-        mutex_exit(&cpu_lock);
-        RTMemFree(pTimer->pOmniTimer->au64Ticks);
-        RTMemFree(pTimer->pOmniTimer);
-    }
+    /* Trying the cpu_lock stuff and calling cyclic_remove may deadlock
+       the system, so just mark the timer as suspened and deal with it in
+       the callback wrapper function above. */
+    if (rtTimerSolIsCallingFromTimerProc(pTimer))
+        pTimer->fSuspendedFromTimer = true;
+    else
+        rtTimerSolStopIt(pTimer);
 
     return VINF_SUCCESS;
 }
@@ -436,11 +599,29 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer)
 
 RTDECL(int) RTTimerChangeInterval(PRTTIMER pTimer, uint64_t u64NanoInterval)
 {
+    /*
+     * Validate.
+     */
     RTTIMER_ASSERT_VALID_RET(pTimer);
+    AssertReturn(u64NanoInterval > 0, VERR_INVALID_PARAMETER);
+    AssertReturn(u64NanoInterval < UINT64_MAX / 8, VERR_INVALID_PARAMETER);
+    AssertReturn(pTimer->cNsInterval, VERR_INVALID_STATE);
 
-    /** @todo implement me! */
+    if (pTimer->fSuspended || pTimer->fSuspendedFromTimer)
+        pTimer->cNsInterval = u64NanoInterval;
+    else
+    {
+        ASMAtomicWriteU64(&pTimer->cNsInterval, u64NanoInterval);
+        ASMAtomicWriteBool(&pTimer->fIntervalChanged, true);
+
+        if (   !pTimer->fAllCpus
+            && !pTimer->u.Single.nsNextTick
+            && pTimer->hCyclicId != CYCLIC_NONE
+            && rtTimerSolIsCallingFromTimerProc(pTimer))
+            pTimer->u.Single.nsNextTick = RTTimeSystemNanoTS();
+    }
 
-    return VERR_NOT_SUPPORTED;
+    return VINF_SUCCESS;
 }
 
 
@@ -464,7 +645,6 @@ RTDECL(int) RTTimerReleaseSystemGranularity(uint32_t u32Granted)
 
 RTDECL(bool) RTTimerCanDoHighResolution(void)
 {
-    /** @todo return true; - when missing bits have been implemented and tested*/
-    return false;
+    return true;
 }
 
diff --git a/src/VBox/Runtime/r3/alloc-ef-cpp.cpp b/src/VBox/Runtime/r3/alloc-ef-cpp.cpp
index eb8614e..7ca82b5 100644
--- a/src/VBox/Runtime/r3/alloc-ef-cpp.cpp
+++ b/src/VBox/Runtime/r3/alloc-ef-cpp.cpp
@@ -57,7 +57,11 @@
 # ifdef _MSC_VER
 #  define RT_EF_THROWS_BAD_ALLOC
 # else
-#  define RT_EF_THROWS_BAD_ALLOC     throw(std::bad_alloc)
+#  ifdef _GLIBCXX_THROW
+#   define RT_EF_THROWS_BAD_ALLOC     _GLIBCXX_THROW(std::bad_alloc)
+#  else
+#   define RT_EF_THROWS_BAD_ALLOC     throw(std::bad_alloc)
+#  endif
 # endif
 #else  /* !RT_EXCEPTIONS_ENABLED */
 # define RT_EF_THROWS_BAD_ALLOC
diff --git a/src/VBox/Runtime/r3/alloc-ef.cpp b/src/VBox/Runtime/r3/alloc-ef.cpp
index f113f6b..c44974f 100644
--- a/src/VBox/Runtime/r3/alloc-ef.cpp
+++ b/src/VBox/Runtime/r3/alloc-ef.cpp
@@ -44,6 +44,24 @@
 #include <iprt/param.h>
 #include <iprt/string.h>
 
+#ifdef RTALLOC_REPLACE_MALLOC
+# include <VBox/dis.h>
+# include <VBox/disopcode.h>
+# include <dlfcn.h>
+# ifdef RT_OS_DARWIN
+#  include <malloc/malloc.h>
+# endif
+#endif
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#ifdef RTALLOC_REPLACE_MALLOC
+# define RTMEM_REPLACMENT_ALIGN(a_cb) ((a_cb) >= 16 ? RT_ALIGN_Z(a_cb, 16) \
+                                       : (a_cb) >= sizeof(uintptr_t) ? RT_ALIGN_Z(a_cb,  sizeof(uintptr_t)) : (a_cb))
+#endif
+
 
 /*******************************************************************************
 *   Global Variables                                                           *
@@ -61,6 +79,16 @@ static volatile PRTMEMBLOCK g_pBlocksDelayTail;
 /** Number of bytes in the delay list (includes fences). */
 static volatile size_t      g_cbBlocksDelay;
 # endif /* RTALLOC_EFENCE_FREE_DELAYED */
+# ifdef RTALLOC_REPLACE_MALLOC
+/** @name For calling the real allocation API we've replaced.
+ * @{ */
+void * (*g_pfnOrgMalloc)(size_t);
+void * (*g_pfnOrgCalloc)(size_t, size_t);
+void * (*g_pfnOrgRealloc)(void *, size_t);
+void   (*g_pfnOrgFree)(void *);
+size_t (*g_pfnOrgMallocSize)(void *);
+/** @} */
+# endif
 #endif /* RTALLOC_EFENCE_TRACE */
 /** Array of pointers free watches for. */
 void   *gapvRTMemFreeWatch[4] = {NULL, NULL, NULL, NULL};
@@ -71,6 +99,11 @@ bool    gfRTMemFreeLog = false;
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
+#ifdef RTALLOC_REPLACE_MALLOC
+static void rtMemReplaceMallocAndFriends(void);
+#endif
+
+
 /**
  * Complains about something.
  */
@@ -130,7 +163,13 @@ DECLINLINE(void) rtmemBlockUnlock(void)
 DECLINLINE(PRTMEMBLOCK) rtmemBlockCreate(RTMEMTYPE enmType, size_t cbUnaligned, size_t cbAligned,
                                          const char *pszTag, void *pvCaller, RT_SRC_POS_DECL)
 {
+# ifdef RTALLOC_REPLACE_MALLOC
+    if (!g_pfnOrgMalloc)
+        rtMemReplaceMallocAndFriends();
+    PRTMEMBLOCK pBlock = (PRTMEMBLOCK)g_pfnOrgMalloc(sizeof(*pBlock));
+# else
     PRTMEMBLOCK pBlock = (PRTMEMBLOCK)malloc(sizeof(*pBlock));
+# endif
     if (pBlock)
     {
         pBlock->enmType     = enmType;
@@ -151,7 +190,11 @@ DECLINLINE(PRTMEMBLOCK) rtmemBlockCreate(RTMEMTYPE enmType, size_t cbUnaligned,
  */
 DECLINLINE(void) rtmemBlockFree(PRTMEMBLOCK pBlock)
 {
+# ifdef RTALLOC_REPLACE_MALLOC
+    g_pfnOrgFree(pBlock);
+# else
     free(pBlock);
+# endif
 }
 
 
@@ -271,6 +314,235 @@ DECLINLINE(PRTMEMBLOCK) rtmemBlockDelayRemove(void)
 #endif /* RTALLOC_EFENCE_TRACE */
 
 
+#if defined(RTALLOC_REPLACE_MALLOC) && defined(RTALLOC_EFENCE_TRACE)
+/*
+ *
+ * Replacing malloc, calloc, realloc, & free.
+ *
+ */
+
+/** Replacement for malloc. */
+static void *rtMemReplacementMalloc(size_t cb)
+{
+    size_t cbAligned = RTMEM_REPLACMENT_ALIGN(cb);
+    void *pv = rtR3MemAlloc("r-malloc", RTMEMTYPE_RTMEMALLOC, cb, cbAligned, "heap", ASMReturnAddress(), RT_SRC_POS);
+    if (!pv)
+        pv = g_pfnOrgMalloc(cb);
+    return pv;
+}
+
+/** Replacement for calloc. */
+static void *rtMemReplacementCalloc(size_t cbItem, size_t cItems)
+{
+    size_t cb = cbItem * cItems;
+    size_t cbAligned = RTMEM_REPLACMENT_ALIGN(cb);
+    void *pv = rtR3MemAlloc("r-calloc", RTMEMTYPE_RTMEMALLOCZ, cb, cbAligned, "heap", ASMReturnAddress(), RT_SRC_POS);
+    if (!pv)
+        pv = g_pfnOrgCalloc(cbItem, cItems);
+    return pv;
+}
+
+/** Replacement for realloc. */
+static void *rtMemReplacementRealloc(void *pvOld, size_t cbNew)
+{
+    if (pvOld)
+    {
+        /* We're not strict about where the memory was allocated. */
+        PRTMEMBLOCK pBlock = rtmemBlockGet(pvOld);
+        if (pBlock)
+        {
+            size_t cbAligned = RTMEM_REPLACMENT_ALIGN(cbNew);
+            return rtR3MemRealloc("r-realloc", RTMEMTYPE_RTMEMREALLOC, pvOld, cbAligned, "heap", ASMReturnAddress(), RT_SRC_POS);
+        }
+        return g_pfnOrgRealloc(pvOld, cbNew);
+    }
+    return rtMemReplacementMalloc(cbNew);
+}
+
+/** Replacement for free(). */
+static void rtMemReplacementFree(void *pv)
+{
+    if (pv)
+    {
+        /* We're not strict about where the memory was allocated. */
+        PRTMEMBLOCK pBlock = rtmemBlockGet(pv);
+        if (pBlock)
+            rtR3MemFree("r-free", RTMEMTYPE_RTMEMFREE, pv, ASMReturnAddress(), RT_SRC_POS);
+        else
+            g_pfnOrgFree(pv);
+    }
+}
+
+# ifdef RT_OS_DARWIN
+/** Replacement for malloc. */
+static size_t rtMemReplacementMallocSize(void *pv)
+{
+    size_t cb;
+    if (pv)
+    {
+        /* We're not strict about where the memory was allocated. */
+        PRTMEMBLOCK pBlock = rtmemBlockGet(pv);
+        if (pBlock)
+            cb = pBlock->cbUnaligned;
+        else
+            cb = g_pfnOrgMallocSize(pv);
+    }
+    else
+        cb = 0;
+    return cb;
+}
+# endif
+
+
+static void rtMemReplaceMallocAndFriends(void)
+{
+    struct
+    {
+        const char *pszName;
+        PFNRT       pfnReplacement;
+        PFNRT       pfnOrg;
+        PFNRT      *ppfnJumpBack;
+    } aApis[] =
+    {
+        { "free",    (PFNRT)rtMemReplacementFree,    (PFNRT)free,    (PFNRT *)&g_pfnOrgFree },
+        { "realloc", (PFNRT)rtMemReplacementRealloc, (PFNRT)realloc, (PFNRT *)&g_pfnOrgRealloc },
+        { "calloc",  (PFNRT)rtMemReplacementCalloc,  (PFNRT)calloc,  (PFNRT *)&g_pfnOrgCalloc },
+        { "malloc",  (PFNRT)rtMemReplacementMalloc,  (PFNRT)malloc,  (PFNRT *)&g_pfnOrgMalloc },
+#ifdef RT_OS_DARWIN
+        { "malloc_size", (PFNRT)rtMemReplacementMallocSize,  (PFNRT)malloc_size,  (PFNRT *)&g_pfnOrgMallocSize },
+#endif
+    };
+
+    /*
+     * Initialize the jump backs to avoid recursivly entering this function.
+     */
+    for (unsigned i = 0; i < RT_ELEMENTS(aApis); i++)
+        *aApis[i].ppfnJumpBack = aApis[i].pfnOrg;
+
+    /*
+     * Give the user an option to skip replacing malloc.
+     */
+    if (getenv("IPRT_DONT_REPLACE_MALLOC"))
+        return;
+
+    /*
+     * Allocate a page for jump back code (we leak it).
+     */
+    uint8_t *pbExecPage = (uint8_t *)RTMemPageAlloc(PAGE_SIZE); AssertFatal(pbExecPage);
+    int rc = RTMemProtect(pbExecPage, PAGE_SIZE, RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC); AssertFatalRC(rc);
+
+    /*
+     * Do the ground work.
+     */
+    uint8_t *pb = pbExecPage;
+    for (unsigned i = 0; i < RT_ELEMENTS(aApis); i++)
+    {
+        /* Resolve it. */
+        PFNRT pfnOrg = (PFNRT)(uintptr_t)dlsym(RTLD_DEFAULT, aApis[i].pszName);
+        if (pfnOrg)
+            aApis[i].pfnOrg = pfnOrg;
+        else
+            pfnOrg = aApis[i].pfnOrg;
+
+        /* Figure what we can replace and how much to duplicate in the jump back code. */
+# ifdef RT_ARCH_AMD64
+        uint32_t         cbNeeded   = 12;
+        DISCPUMODE const enmCpuMode = DISCPUMODE_64BIT;
+# elif defined(RT_ARCH_X86)
+        uint32_t   const cbNeeded   = 5;
+        DISCPUMODE const enmCpuMode = DISCPUMODE_32BIT;
+# else
+#  error "Port me"
+# endif
+        uint32_t offJmpBack = 0;
+        uint32_t cbCopy = 0;
+        while (offJmpBack < cbNeeded)
+        {
+            DISCPUSTATE Dis;
+            uint32_t cbInstr = 1;
+            rc = DISInstr((void *)((uintptr_t)pfnOrg + offJmpBack), enmCpuMode, &Dis, &cbInstr); AssertFatalRC(rc);
+            AssertFatal(!(Dis.pCurInstr->fOpType & (DISOPTYPE_CONTROLFLOW)));
+# ifdef RT_ARCH_AMD64
+#  ifdef RT_OS_DARWIN
+            /* Kludge for: cmp [malloc_def_zone_state], 1; jg 2; call _malloc_initialize; 2: */
+            DISQPVPARAMVAL Parm;
+            if (   Dis.ModRM.Bits.Mod == 0
+                && Dis.ModRM.Bits.Rm == 5 /* wrt RIP */
+                && (Dis.Param2.fUse & (DISUSE_IMMEDIATE16_SX8 | DISUSE_IMMEDIATE32_SX8 | DISUSE_IMMEDIATE64_SX8))
+                && Dis.Param2.uValue == 1
+                && Dis.pCurInstr->uOpcode == OP_CMP)
+            {
+                cbCopy = offJmpBack;
+
+                offJmpBack += cbInstr;
+                rc = DISInstr((void *)((uintptr_t)pfnOrg + offJmpBack), enmCpuMode, &Dis, &cbInstr); AssertFatalRC(rc);
+                if (   Dis.pCurInstr->uOpcode == OP_JNBE
+                    && Dis.Param1.uDisp.i8 == 5)
+                {
+                    offJmpBack += cbInstr + 5;
+                    AssertFatal(offJmpBack >= cbNeeded);
+                    break;
+                }
+            }
+#  endif
+            AssertFatal(!(Dis.ModRM.Bits.Mod == 0 && Dis.ModRM.Bits.Rm == 5 /* wrt RIP */));
+# endif
+            offJmpBack += cbInstr;
+        }
+        if (!cbCopy)
+            cbCopy = offJmpBack;
+
+        /* Assemble the jump back. */
+        memcpy(pb, (void *)(uintptr_t)pfnOrg, cbCopy);
+        uint32_t off = cbCopy;
+# ifdef RT_ARCH_AMD64
+        pb[off++] = 0xff; /* jmp qword [$+8 wrt RIP] */
+        pb[off++] = 0x25;
+        *(uint32_t *)&pb[off] = 0;
+        off += 4;
+        *(uint64_t *)&pb[off] = (uintptr_t)pfnOrg + offJmpBack;
+        off += 8;
+        off = RT_ALIGN_32(off, 16);
+# elif defined(RT_ARCH_X86)
+        pb[off++] = 0xe9; /* jmp rel32 */
+        *(uint32_t *)&pb[off] = (uintptr_t)pfnOrg + offJmpBack - (uintptr_t)&pb[4];
+        off += 4;
+        off = RT_ALIGN_32(off, 8);
+# else
+#  error "Port me"
+# endif
+        *aApis[i].ppfnJumpBack = (PFNRT)(uintptr_t)pb;
+        pb += off;
+    }
+
+    /*
+     * Modify the APIs.
+     */
+    for (unsigned i = 0; i < RT_ELEMENTS(aApis); i++)
+    {
+        pb = (uint8_t *)(uintptr_t)aApis[i].pfnOrg;
+        rc = RTMemProtect(pb, 16, RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC); AssertFatalRC(rc);
+
+# ifdef RT_ARCH_AMD64
+        /* Assemble the LdrLoadDll patch. */
+        *pb++ = 0x48; /* mov rax, qword */
+        *pb++ = 0xb8;
+        *(uint64_t *)pb = (uintptr_t)aApis[i].pfnReplacement;
+        pb += 8;
+        *pb++ = 0xff; /* jmp rax */
+        *pb++ = 0xe0;
+# elif defined(RT_ARCH_X86)
+        *pb++ = 0xe9; /* jmp rel32 */
+        *(uint32_t *)pb = (uintptr_t)aApis[i].pfnReplacement - (uintptr_t)&pb[4];
+# else
+#  error "Port me"
+# endif
+    }
+}
+
+#endif /* RTALLOC_REPLACE_MALLOC && RTALLOC_EFENCE_TRACE */
+
+
 /**
  * Internal allocator.
  */
diff --git a/src/VBox/Runtime/r3/alloc-ef.h b/src/VBox/Runtime/r3/alloc-ef.h
index d7f630a..f4e81dd 100644
--- a/src/VBox/Runtime/r3/alloc-ef.h
+++ b/src/VBox/Runtime/r3/alloc-ef.h
@@ -118,6 +118,15 @@
 # define RTALLOC_EFENCE_CPP
 #endif
 
+#if defined(RUNNING_DOXYGEN)
+/** @def RTALLOC_REPLACE_MALLOC
+ * Replaces the malloc, calloc, realloc, free and friends in libc (experimental).
+ * Set in LocalConfig.kmk. Requires RTALLOC_EFENCE_TRACE to work. */
+# define RTALLOC_REPLACE_MALLOC
+#endif
+#if defined(RTALLOC_REPLACE_MALLOC) && !defined(RTALLOC_EFENCE_TRACE)
+# error "RTALLOC_REPLACE_MALLOC requires RTALLOC_EFENCE_TRACE."
+#endif
 
 
 /*******************************************************************************
@@ -191,5 +200,18 @@ RTDECL(void *)  rtR3MemRealloc(const char *pszOp, RTMEMTYPE enmType, void *pvOld
 RTDECL(void)    rtR3MemFree(const char *pszOp, RTMEMTYPE enmType, void *pv, void *pvCaller, RT_SRC_POS_DECL);
 RT_C_DECLS_END
 
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+#ifdef RTALLOC_REPLACE_MALLOC
+RT_C_DECLS_BEGIN
+extern void * (*g_pfnOrgMalloc)(size_t);
+extern void * (*g_pfnOrgCalloc)(size_t, size_t);
+extern void * (*g_pfnOrgRealloc)(void *, size_t);
+extern void   (*g_pfnOrgFree)(void *);
+RT_C_DECLS_END
+#endif
+
 #endif
 
diff --git a/src/VBox/Runtime/r3/darwin/time-darwin.cpp b/src/VBox/Runtime/r3/darwin/time-darwin.cpp
index a737d01..9dc05ae 100644
--- a/src/VBox/Runtime/r3/darwin/time-darwin.cpp
+++ b/src/VBox/Runtime/r3/darwin/time-darwin.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -88,8 +88,8 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     /* worst case: fallback to gettimeofday(). */
     struct timeval tv;
     gettimeofday(&tv, NULL);
-    return (uint64_t)tv.tv_sec  * (uint64_t)(1000 * 1000 * 1000)
-         + (uint64_t)(tv.tv_usec * 1000);
+    return (uint64_t)tv.tv_sec  * RT_NS_1SEC_64
+         + (uint64_t)(tv.tv_usec * RT_NS_1US);
 }
 
 
@@ -101,7 +101,7 @@ RTDECL(uint64_t) RTTimeSystemNanoTS(void)
 
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
 
diff --git a/src/VBox/Runtime/r3/fileio.cpp b/src/VBox/Runtime/r3/fileio.cpp
index fd1a289..6482fe0 100644
--- a/src/VBox/Runtime/r3/fileio.cpp
+++ b/src/VBox/Runtime/r3/fileio.cpp
@@ -27,10 +27,13 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
+#include "internal/iprt.h"
 #include <iprt/file.h>
-#include <iprt/alloc.h>
+
+#include <iprt/mem.h>
 #include <iprt/assert.h>
 #include <iprt/alloca.h>
+#include <iprt/string.h>
 #include <iprt/err.h>
 #include "internal/file.h"
 
@@ -351,35 +354,12 @@ RTR3DECL(RTFOFF) RTFileGetMaxSize(RTFILE File)
 }
 
 
-/**
- * Copies a file given the handles to both files.
- *
- * @returns VBox Status code.
- *
- * @param   FileSrc     The source file. The file position is unaltered.
- * @param   FileDst     The destination file.
- *                      On successful returns the file position is at the end of the file.
- *                      On failures the file position and size is undefined.
- */
 RTDECL(int) RTFileCopyByHandles(RTFILE FileSrc, RTFILE FileDst)
 {
     return RTFileCopyByHandlesEx(FileSrc, FileDst, NULL, NULL);
 }
 
 
-/**
- * Copies a file.
- *
- * @returns VERR_ALREADY_EXISTS if the destination file exists.
- * @returns VBox Status code.
- *
- * @param   pszSrc      The path to the source file.
- * @param   pszDst      The path to the destination file.
- *                      This file will be created.
- * @param   fFlags      Flags, any of the RTFILECOPY_FLAGS_ \#defines.
- * @param   pfnProgress Pointer to callback function for reporting progress.
- * @param   pvUser      User argument to pass to pfnProgress along with the completion percentage.
- */
 RTDECL(int) RTFileCopyEx(const char *pszSrc, const char *pszDst, uint32_t fFlags, PFNRTPROGRESS pfnProgress, void *pvUser)
 {
     /*
@@ -431,19 +411,6 @@ RTDECL(int) RTFileCopyEx(const char *pszSrc, const char *pszDst, uint32_t fFlags
 }
 
 
-/**
- * Copies a file given the handles to both files and
- * provide progress callbacks.
- *
- * @returns VBox Status code.
- *
- * @param   FileSrc     The source file. The file position is unaltered.
- * @param   FileDst     The destination file.
- *                      On successful returns the file position is at the end of the file.
- *                      On failures the file position and size is undefined.
- * @param   pfnProgress Pointer to callback function for reporting progress.
- * @param   pvUser      User argument to pass to pfnProgress along with the completion percentage.
- */
 RTDECL(int) RTFileCopyByHandlesEx(RTFILE FileSrc, RTFILE FileDst, PFNRTPROGRESS pfnProgress, void *pvUser)
 {
     /*
@@ -560,3 +527,188 @@ RTDECL(int) RTFileCopyByHandlesEx(RTFILE FileSrc, RTFILE FileDst, PFNRTPROGRESS
     return rc;
 }
 
+
+RTDECL(int) RTFileCompare(const char *pszFile1, const char *pszFile2)
+{
+    return RTFileCompareEx(pszFile1, pszFile2, 0 /*fFlags*/, NULL, NULL);
+}
+
+
+RTDECL(int) RTFileCompareByHandles(RTFILE hFile1, RTFILE hFile2)
+{
+    return RTFileCompareByHandlesEx(hFile1, hFile2, 0 /*fFlags*/, NULL, NULL);
+}
+
+
+RTDECL(int) RTFileCompareEx(const char *pszFile1, const char *pszFile2, uint32_t fFlags, PFNRTPROGRESS pfnProgress, void *pvUser)
+{
+    /*
+     * Validate input.
+     */
+    AssertPtrReturn(pszFile1, VERR_INVALID_POINTER);
+    AssertReturn(*pszFile1, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(pszFile2, VERR_INVALID_POINTER);
+    AssertReturn(*pszFile2, VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!pfnProgress || VALID_PTR(pfnProgress), ("pfnProgress=%p\n", pfnProgress), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!(fFlags & ~RTFILECOMP_FLAGS_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
+
+    /*
+     * Open the files.
+     */
+    RTFILE hFile1;
+    int rc = RTFileOpen(&hFile1, pszFile1,
+                        RTFILE_O_READ | RTFILE_O_OPEN
+                        | (fFlags & RTFILECOMP_FLAGS_NO_DENY_WRITE_FILE1 ? RTFILE_O_DENY_NONE : RTFILE_O_DENY_WRITE));
+    if (RT_SUCCESS(rc))
+    {
+        RTFILE hFile2;
+        rc = RTFileOpen(&hFile2, pszFile2,
+                        RTFILE_O_READ | RTFILE_O_OPEN
+                        | (fFlags & RTFILECOMP_FLAGS_NO_DENY_WRITE_FILE2 ? RTFILE_O_DENY_NONE : RTFILE_O_DENY_WRITE));
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Call the ByHandles version and let it do the job.
+             */
+            rc = RTFileCompareByHandlesEx(hFile1, hFile2, fFlags,  pfnProgress, pvUser);
+
+            /* Clean up */
+            int rc2 = RTFileClose(hFile2);
+            AssertRC(rc2);
+            if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
+                rc = rc2;
+        }
+
+        int rc2 = RTFileClose(hFile1);
+        AssertRC(rc2);
+        if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
+            rc = rc2;
+    }
+    return rc;
+}
+
+
+RTDECL(int) RTFileCompareByHandlesEx(RTFILE hFile1, RTFILE hFile2, uint32_t fFlags, PFNRTPROGRESS pfnProgress, void *pvUser)
+{
+    /*
+     * Validate input.
+     */
+    AssertReturn(RTFileIsValid(hFile1), VERR_INVALID_HANDLE);
+    AssertReturn(RTFileIsValid(hFile1), VERR_INVALID_HANDLE);
+    AssertMsgReturn(!pfnProgress || VALID_PTR(pfnProgress), ("pfnProgress=%p\n", pfnProgress), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!(fFlags & ~RTFILECOMP_FLAGS_MASK), ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
+
+    /*
+     * Compare the file sizes first.
+     */
+    uint64_t cbFile1;
+    int rc = RTFileGetSize(hFile1, &cbFile1);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    uint64_t cbFile2;
+    rc = RTFileGetSize(hFile1, &cbFile2);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    if (cbFile1 != cbFile2)
+        return VERR_NOT_EQUAL;
+
+
+    /*
+     * Allocate buffer.
+     */
+    size_t      cbBuf;
+    uint8_t    *pbBuf1Free = NULL;
+    uint8_t    *pbBuf1;
+    uint8_t    *pbBuf2Free = NULL;
+    uint8_t    *pbBuf2;
+    if (cbFile1 < _512K)
+    {
+        cbBuf  = 8*_1K;
+        pbBuf1 = (uint8_t *)alloca(cbBuf);
+        pbBuf2 = (uint8_t *)alloca(cbBuf);
+    }
+    else
+    {
+        cbBuf = _128K;
+        pbBuf1 = pbBuf1Free = (uint8_t *)RTMemTmpAlloc(cbBuf);
+        pbBuf2 = pbBuf2Free = (uint8_t *)RTMemTmpAlloc(cbBuf);
+    }
+    if (pbBuf1 && pbBuf2)
+    {
+        /*
+         * Seek to the start of each file
+         * and set the size of the destination file.
+         */
+        rc = RTFileSeek(hFile1, 0, RTFILE_SEEK_BEGIN, NULL);
+        if (RT_SUCCESS(rc))
+        {
+            rc = RTFileSeek(hFile2, 0, RTFILE_SEEK_BEGIN, NULL);
+            if (RT_SUCCESS(rc) && pfnProgress)
+                rc = pfnProgress(0, pvUser);
+            if (RT_SUCCESS(rc))
+            {
+                /*
+                 * Compare loop.
+                 */
+                unsigned    uPercentage    = 0;
+                RTFOFF      off            = 0;
+                RTFOFF      cbPercent      = cbFile1 / 100;
+                RTFOFF      offNextPercent = cbPercent;
+                while (off < (RTFOFF)cbFile1)
+                {
+                    /* read the blocks */
+                    RTFOFF cbLeft = cbFile1 - off;
+                    size_t cbBlock = cbLeft >= (RTFOFF)cbBuf ? cbBuf : (size_t)cbLeft;
+                    rc = RTFileRead(hFile1, pbBuf1, cbBlock, NULL);
+                    if (RT_FAILURE(rc))
+                        break;
+                    rc = RTFileRead(hFile2, pbBuf2, cbBlock, NULL);
+                    if (RT_FAILURE(rc))
+                        break;
+
+                    /* compare */
+                    if (memcmp(pbBuf1, pbBuf2, cbBlock))
+                    {
+                        rc = VERR_NOT_EQUAL;
+                        break;
+                    }
+
+                    /* advance */
+                    off += cbBlock;
+                    if (pfnProgress && offNextPercent < off)
+                    {
+                        while (offNextPercent < off)
+                        {
+                            uPercentage++;
+                            offNextPercent += cbPercent;
+                        }
+                        rc = pfnProgress(uPercentage, pvUser);
+                        if (RT_FAILURE(rc))
+                            break;
+                    }
+                }
+
+#if 0
+                /*
+                 * Compare OS specific data (EAs and stuff).
+                 */
+                if (RT_SUCCESS(rc))
+                    rc = rtFileCompareOSStuff(hFile1, hFile2);
+#endif
+
+                /* 100% */
+                if (pfnProgress && uPercentage < 100 && RT_SUCCESS(rc))
+                    rc = pfnProgress(100, pvUser);
+            }
+        }
+    }
+    else
+        rc = VERR_NO_MEMORY;
+    RTMemTmpFree(pbBuf2Free);
+    RTMemTmpFree(pbBuf1Free);
+
+    return rc;
+}
+
diff --git a/src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp b/src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp
new file mode 100644
index 0000000..a7533a6
--- /dev/null
+++ b/src/VBox/Runtime/r3/freebsd/systemmem-freebsd.cpp
@@ -0,0 +1,98 @@
+/* $Id: systemmem-freebsd.cpp $ */
+/** @file
+ * IPRT - RTSystemQueryTotalRam, Linux ring-3.
+ */
+
+/*
+ * Copyright (C) 2012-2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/system.h>
+#include "internal/iprt.h"
+
+#include <iprt/err.h>
+#include <iprt/assert.h>
+#include <iprt/string.h>
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <errno.h>
+
+
+RTDECL(int) RTSystemQueryTotalRam(uint64_t *pcb)
+{
+    int rc = VINF_SUCCESS;
+    u_long cbMemPhys = 0;
+    size_t cbParameter = sizeof(cbMemPhys);
+
+    AssertPtrReturn(pcb, VERR_INVALID_POINTER);
+
+    if (!sysctlbyname("hw.physmem", &cbMemPhys, &cbParameter, NULL, 0))
+    {
+        *pcb = cbMemPhys;
+        return VINF_SUCCESS;
+    }
+    return RTErrConvertFromErrno(errno);
+}
+
+
+RTDECL(int) RTSystemQueryAvailableRam(uint64_t *pcb)
+{
+    AssertPtrReturn(pcb, VERR_INVALID_POINTER);
+
+    int rc = VINF_SUCCESS;
+    u_int cPagesMemFree = 0;
+    u_int cPagesMemInactive = 0;
+    u_int cPagesMemCached = 0;
+    u_int cPagesMemUsed = 0;
+    int cbPage = 0;
+    size_t cbParameter;
+    int cProcessed = 0;
+
+    cbParameter = sizeof(cPagesMemFree);
+    if (sysctlbyname("vm.stats.vm.v_free_count", &cPagesMemFree, &cbParameter, NULL, 0))
+        rc = RTErrConvertFromErrno(errno);
+    cbParameter = sizeof(cPagesMemUsed);
+    if (   RT_SUCCESS(rc)
+        && sysctlbyname("vm.stats.vm.v_active_count", &cPagesMemUsed, &cbParameter, NULL, 0))
+        rc = RTErrConvertFromErrno(errno);
+    cbParameter = sizeof(cPagesMemInactive);
+    if (   RT_SUCCESS(rc)
+        && sysctlbyname("vm.stats.vm.v_inactive_count", &cPagesMemInactive, &cbParameter, NULL, 0))
+        rc = RTErrConvertFromErrno(errno);
+    cbParameter = sizeof(cPagesMemCached);
+    if (   RT_SUCCESS(rc)
+        && sysctlbyname("vm.stats.vm.v_cache_count", &cPagesMemCached, &cbParameter, NULL, 0))
+        rc = RTErrConvertFromErrno(errno);
+    cbParameter = sizeof(cbPage);
+    if (   RT_SUCCESS(rc)
+        && sysctlbyname("hw.pagesize", &cbPage, &cbParameter, NULL, 0))
+        rc = RTErrConvertFromErrno(errno);
+
+    if (RT_SUCCESS(rc))
+        *pcb = (cPagesMemFree + cPagesMemInactive + cPagesMemCached ) * cbPage;
+
+    return rc;
+}
+
diff --git a/src/VBox/Runtime/r3/haiku/time-haiku.cpp b/src/VBox/Runtime/r3/haiku/time-haiku.cpp
index 269b4b2..03e709b 100644
--- a/src/VBox/Runtime/r3/haiku/time-haiku.cpp
+++ b/src/VBox/Runtime/r3/haiku/time-haiku.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -43,7 +43,7 @@
 
 DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
 {
-    return (uint64_t)system_time() * 1000;
+    return (uint64_t)system_time() * RT_NS_1US;
 }
 
 
@@ -71,7 +71,7 @@ RTDECL(uint64_t) RTTimeSystemNanoTS(void)
  */
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
 
@@ -82,3 +82,4 @@ RTDECL(int) RTTimeSet(PCRTTIMESPEC pTime)
     set_real_time_clock(tv.tv_sec);
     return VINF_SUCCESS;
 }
+
diff --git a/src/VBox/Runtime/r3/linux/sysfs.cpp b/src/VBox/Runtime/r3/linux/sysfs.cpp
index 1530933..bea3641 100644
--- a/src/VBox/Runtime/r3/linux/sysfs.cpp
+++ b/src/VBox/Runtime/r3/linux/sysfs.cpp
@@ -412,64 +412,9 @@ RTDECL(ssize_t) RTLinuxSysFsGetLinkDest(char *pszBuf, size_t cchBuf, const char
 }
 
 
-/** Search for a device node with the number @a DevNum and the type (character
- * or block) @a fMode below the path @a pszPath.  @a pszPath MUST point to a
- * buffer of size at least RTPATH_MAX which will be modified during the function
- * execution.  On successful return it will contain the path to the device node
- * found. */
-/** @note This function previously used a local stack buffer of size RTPATH_MAX
- *    to construct the path passed to the next recursive call, which used up 4K
- *    of stack space per iteration and caused a stack overflow on a path with
- *    too many components. */
-static int rtLinuxFindDevicePathRecursive(dev_t DevNum, RTFMODE fMode,
-                                          char *pszPath)
-{
-    int rc;
-    PRTDIR  pDir;
-    size_t const cchPath = strlen(pszPath);
-
-    /*
-     * Check assumptions made by the code below.
-     */
-    AssertReturn(cchPath < RTPATH_MAX - 10U, VERR_BUFFER_OVERFLOW);
-    rc = RTDirOpen(&pDir, pszPath);
-    if (RT_SUCCESS(rc))
-    {
-        for (;;)
-        {
-            RTDIRENTRYEX Entry;
-            rc = RTDirReadEx(pDir, &Entry, NULL, RTFSOBJATTRADD_UNIX,
-                             RTPATH_F_ON_LINK);
-            if (RT_FAILURE(rc))
-                break;
-            if (RTFS_IS_SYMLINK(Entry.Info.Attr.fMode))
-                continue;
-            pszPath[cchPath] = '\0';
-            rc = RTPathAppend(pszPath, RTPATH_MAX, Entry.szName);
-            if (RT_FAILURE(rc))
-                break;
-            /* Do the matching. */
-            if (   Entry.Info.Attr.u.Unix.Device == DevNum
-                && (Entry.Info.Attr.fMode & RTFS_TYPE_MASK) == fMode)
-                break;
-            /* Recurse into subdirectories. */
-            if (!RTFS_IS_DIRECTORY(Entry.Info.Attr.fMode))
-                continue;
-            if (Entry.szName[0] == '.')
-                continue;
-            rc = rtLinuxFindDevicePathRecursive(DevNum, fMode, pszPath);
-            if (RT_SUCCESS(rc) || rc != VERR_NO_MORE_FILES)
-                break;
-        }
-        RTDirClose(pDir);
-    }
-    return rc;
-}
-
-
-RTDECL(ssize_t) RTLinuxFindDevicePathV(dev_t DevNum, RTFMODE fMode, char *pszBuf,
-                                       size_t cchBuf, const char *pszSuggestion,
-                                       va_list va)
+RTDECL(ssize_t) RTLinuxCheckDevicePathV(dev_t DevNum, RTFMODE fMode, char *pszBuf,
+                                        size_t cchBuf, const char *pszPattern,
+                                        va_list va)
 {
     char szFilename[RTPATH_MAX];
     int rc = VINF_TRY_AGAIN;
@@ -478,35 +423,25 @@ RTDECL(ssize_t) RTLinuxFindDevicePathV(dev_t DevNum, RTFMODE fMode, char *pszBuf
     AssertReturn(   fMode == RTFS_TYPE_DEV_CHAR
                  || fMode == RTFS_TYPE_DEV_BLOCK,
                  VERR_INVALID_PARAMETER);
-    if (pszSuggestion)
+    if (pszPattern)
     {
         /*
          * Construct the filename and read the link.
          */
         rc = rtLinuxConstructPathV(szFilename, sizeof(szFilename), "/dev/",
-                                   pszSuggestion, va);
+                                   pszPattern, va);
         if (rc > 0)
         {
-            /*
-             * Check whether the caller's suggestion was right.
-             */
             RTFSOBJINFO Info;
             rc = RTPathQueryInfo(szFilename, &Info, RTFSOBJATTRADD_UNIX);
-            if (   rc == VERR_PATH_NOT_FOUND 
-                || rc == VERR_FILE_NOT_FOUND
+            if (   rc == VERR_PATH_NOT_FOUND
                 || (   RT_SUCCESS(rc)
                     && (   Info.Attr.u.Unix.Device != DevNum
                         || (Info.Attr.fMode & RTFS_TYPE_MASK) != fMode)))
-            /* The suggestion was wrong, fall back on the brute force attack. */
-                rc = VINF_TRY_AGAIN;
+                rc = VERR_FILE_NOT_FOUND;
         }
     }
 
-    if (rc == VINF_TRY_AGAIN)
-    {
-        RTStrCopy(szFilename, sizeof(szFilename), "/dev/");
-        rc = rtLinuxFindDevicePathRecursive(DevNum, fMode, szFilename);
-    }
     if (RT_SUCCESS(rc))
     {
         size_t cchPath = strlen(szFilename);
@@ -521,13 +456,14 @@ RTDECL(ssize_t) RTLinuxFindDevicePathV(dev_t DevNum, RTFMODE fMode, char *pszBuf
 
 /** @todo Do we really need to return the string length?  If the caller is
  * interested (the current ones aren't) they can check themselves. */
-RTDECL(ssize_t) RTLinuxFindDevicePath(dev_t DevNum, RTFMODE fMode, char *pszBuf,
-                                      size_t cchBuf, const char *pszSuggestion,
-                                      ...)
+RTDECL(ssize_t) RTLinuxCheckDevicePath(dev_t DevNum, RTFMODE fMode, char *pszBuf,
+                                       size_t cchBuf, const char *pszPattern,
+                                       ...)
 {
     va_list va;
-    va_start(va, pszSuggestion);
-    int rc = RTLinuxFindDevicePathV(DevNum, fMode, pszBuf, cchBuf, pszSuggestion, va);
+    va_start(va, pszPattern);
+    int rc = RTLinuxCheckDevicePathV(DevNum, fMode, pszBuf, cchBuf,
+                                     pszPattern, va);
     va_end(va);
     return rc;
 }
diff --git a/src/VBox/Runtime/r3/linux/time-linux.cpp b/src/VBox/Runtime/r3/linux/time-linux.cpp
index ab9c0e5..dfd40d8 100644
--- a/src/VBox/Runtime/r3/linux/time-linux.cpp
+++ b/src/VBox/Runtime/r3/linux/time-linux.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -118,7 +118,7 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     {
         struct timespec ts;
         if (!mono_clock(&ts))
-            return (uint64_t)ts.tv_sec * (uint64_t)(1000 * 1000 * 1000)
+            return (uint64_t)ts.tv_sec * RT_NS_1SEC_64
                  + ts.tv_nsec;
         fMonoClock = false;
     }
@@ -126,8 +126,8 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     /* fallback to gettimeofday(). */
     struct timeval tv;
     gettimeofday(&tv, NULL);
-    return (uint64_t)tv.tv_sec  * (uint64_t)(1000 * 1000 * 1000)
-         + (uint64_t)(tv.tv_usec * 1000);
+    return (uint64_t)tv.tv_sec  * RT_NS_1SEC_64
+         + (uint64_t)(tv.tv_usec * RT_NS_1US);
 }
 
 
@@ -155,6 +155,6 @@ RTDECL(uint64_t) RTTimeSystemNanoTS(void)
  */
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
diff --git a/src/VBox/Runtime/r3/nt/time-nt.cpp b/src/VBox/Runtime/r3/nt/time-nt.cpp
new file mode 100644
index 0000000..a4594f6
--- /dev/null
+++ b/src/VBox/Runtime/r3/nt/time-nt.cpp
@@ -0,0 +1,218 @@
+/* $Id: time-nt.cpp $ */
+/** @file
+ * IPRT - Time, Windows.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP RTLOGGROUP_TIME
+#include "internal-r3-nt.h"
+
+#include <iprt/time.h>
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/err.h>
+#include <iprt/ldr.h>
+#include <iprt/uint128.h>
+#include "internal/time.h"
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** Whether we've tried to resolve g_pfnRtlGetSystemTimePrecise or not. */
+static bool                         g_fInitialized = false;
+/** Pointer to RtlGetSystemTimePrecise, added in 6.2 (windows 8).   */
+static PFNRTLGETSYSTEMTIMEPRECISE   g_pfnRtlGetSystemTimePrecise = NULL;
+
+
+/**
+ * Initializes globals.
+ */
+static void rtTimeNtInitialize(void)
+{
+    /*
+     * Make sure we don't recurse here when calling into RTLdr.
+     */
+    if (ASMAtomicCmpXchgBool(&g_fInitialized, true, false))
+    {
+        void *pvFunc = RTLdrGetSystemSymbol("ntdll.dll", "RtlGetSystemTimePrecise");
+        if (pvFunc)
+            ASMAtomicWritePtr((void * volatile *)&g_pfnRtlGetSystemTimePrecise, pvFunc);
+        ASMCompilerBarrier();
+    }
+}
+
+
+static uint64_t rtTimeGetSystemNanoTS(void)
+{
+    if (RT_UNLIKELY(!g_fInitialized))
+        rtTimeNtInitialize();
+
+    KUSER_SHARED_DATA volatile *pUserSharedData = (KUSER_SHARED_DATA volatile *)MM_SHARED_USER_DATA_VA;
+
+#if 1
+    /*
+     * If there is precise time, get the precise system time and calculate the
+     * interrupt time from it.  (Microsoft doesn't expose interrupt time to user
+     * application, which is very unfortunate as there are a lot place where
+     * monotonic time is applicable but developer is "forced" to use wall clock.)
+     */
+    if (g_pfnRtlGetSystemTimePrecise)
+    {
+        for (;;)
+        {
+            uint64_t uUpdateLockBefore;
+            while ((uUpdateLockBefore = pUserSharedData->TimeUpdateLock) & 1)
+                ASMNopPause();
+
+            uint64_t        uInterruptTime                  = *(uint64_t volatile *)&pUserSharedData->InterruptTime;
+            uint64_t        uBaselineInterruptTimeQpc       = pUserSharedData->BaselineInterruptTimeQpc;
+            uint64_t        uQpcInterruptTimeIncrement      = pUserSharedData->QpcInterruptTimeIncrement;
+            uint8_t         uQpcInterruptTimeIncrementShift = pUserSharedData->QpcInterruptTimeIncrementShift;
+            LARGE_INTEGER   QpcValue;
+            RtlQueryPerformanceCounter(&QpcValue);
+
+            if (pUserSharedData->TimeUpdateLock == uUpdateLockBefore)
+            {
+                uint64_t uQpcValue = QpcValue.QuadPart;
+                if (uQpcValue <= uBaselineInterruptTimeQpc)
+                    return uInterruptTime * 100;
+
+                /* Calc QPC delta since base line. */
+                uQpcValue -= uBaselineInterruptTimeQpc;
+                uQpcValue--;
+
+                /* Multiply by 10 million. */
+                uQpcValue *= UINT32_C(10000000);
+
+                /* Multiply by QPC interrupt time increment value. */
+                RTUINT128U Tmp128;
+                RTUInt128MulU64ByU64(&Tmp128, uQpcValue, uQpcInterruptTimeIncrement);
+
+                /* Shift the upper 64 bits by the increment shift factor. */
+                uint64_t uResult = Tmp128.s.Hi >> uQpcInterruptTimeIncrementShift;
+
+                /* Add to base interrupt time value. */
+                uResult += uInterruptTime;
+
+                /* Convert from NT unit to nano seconds. */
+                return uResult * 100;
+            }
+
+            ASMNopPause();
+        }
+    }
+#endif
+
+    /*
+     * Just read interrupt time.
+     */
+#if ARCH_BITS >= 64
+    uint64_t uRet = *(uint64_t volatile *)&pUserSharedData->InterruptTime; /* This is what KeQueryInterruptTime does. */
+    uRet *= 100;
+    return uRet;
+#else
+
+    LARGE_INTEGER NtTime;
+    do
+    {
+        NtTime.HighPart = pUserSharedData->InterruptTime.High1Time;
+        NtTime.LowPart  = pUserSharedData->InterruptTime.LowPart;
+    } while (pUserSharedData->InterruptTime.High2Time != NtTime.HighPart);
+
+    return (uint64_t)NtTime.QuadPart * 100;
+#endif
+}
+
+
+RTDECL(uint64_t) RTTimeSystemNanoTS(void)
+{
+    return rtTimeGetSystemNanoTS();
+}
+
+
+RTDECL(uint64_t) RTTimeSystemMilliTS(void)
+{
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
+}
+
+
+RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
+{
+    /*
+     * Get the precise time if possible.
+     */
+    if (RT_UNLIKELY(!g_fInitialized))
+        rtTimeNtInitialize();
+    if (g_pfnRtlGetSystemTimePrecise != NULL)
+        return RTTimeSpecSetNtTime(pTime, g_pfnRtlGetSystemTimePrecise());
+
+    /*
+     * Just read system time.
+     */
+    KUSER_SHARED_DATA volatile *pUserSharedData = (KUSER_SHARED_DATA volatile *)MM_SHARED_USER_DATA_VA;
+#ifdef RT_ARCH_AMD64
+    uint64_t uRet = *(uint64_t volatile *)&pUserSharedData->SystemTime; /* This is what KeQuerySystemTime does. */
+    return RTTimeSpecSetNtTime(pTime, uRet);
+#else
+
+    LARGE_INTEGER NtTime;
+    do
+    {
+        NtTime.HighPart = pUserSharedData->SystemTime.High1Time;
+        NtTime.LowPart  = pUserSharedData->SystemTime.LowPart;
+    } while (pUserSharedData->SystemTime.High2Time != NtTime.HighPart);
+    return RTTimeSpecSetNtTime(pTime, NtTime.QuadPart);
+#endif
+}
+
+
+RTDECL(PRTTIMESPEC) RTTimeLocalNow(PRTTIMESPEC pTime)
+{
+    return RTTimeSpecAddNano(RTTimeNow(pTime), RTTimeLocalDeltaNano());
+}
+
+
+RTDECL(int64_t) RTTimeLocalDeltaNano(void)
+{
+    /*
+     * UTC = local + TimeZoneBias; The bias is given in NT units.
+     */
+    KUSER_SHARED_DATA volatile *pUserSharedData = (KUSER_SHARED_DATA volatile *)MM_SHARED_USER_DATA_VA;
+    LARGE_INTEGER               Delta;
+#if ARCH_BITS == 64
+    Delta.QuadPart = *(int64_t volatile *)&pUserSharedData->TimeZoneBias;
+#else
+    do
+    {
+        Delta.HighPart = pUserSharedData->TimeZoneBias.High1Time;
+        Delta.LowPart  = pUserSharedData->TimeZoneBias.LowPart;
+    } while (pUserSharedData->TimeZoneBias.High2Time != Delta.HighPart);
+#endif
+    return Delta.QuadPart * -100;
+}
+
diff --git a/src/VBox/Runtime/r3/posix/env-posix.cpp b/src/VBox/Runtime/r3/posix/env-posix.cpp
index cd4fdb1..677b391 100644
--- a/src/VBox/Runtime/r3/posix/env-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/env-posix.cpp
@@ -48,6 +48,7 @@
 
 RTDECL(bool) RTEnvExistsBad(const char *pszVar)
 {
+    AssertReturn(strchr(pszVar, '=') == NULL, false);
     return RTEnvGetBad(pszVar) != NULL;
 }
 
@@ -60,6 +61,8 @@ RTDECL(bool) RTEnvExist(const char *pszVar)
 
 RTDECL(const char *) RTEnvGetBad(const char *pszVar)
 {
+    AssertReturn(strchr(pszVar, '=') == NULL, NULL);
+
     IPRT_ALIGNMENT_CHECKS_DISABLE(); /* glibc causes trouble */
     const char *pszValue = getenv(pszVar);
     IPRT_ALIGNMENT_CHECKS_ENABLE();
@@ -90,6 +93,8 @@ RTDECL(int) RTEnvPut(const char *pszVarEqualValue)
 
 RTDECL(int) RTEnvSetBad(const char *pszVar, const char *pszValue)
 {
+    AssertMsgReturn(strchr(pszVar, '=') == NULL, ("'%s'\n", pszVar), VERR_ENV_INVALID_VAR_NAME);
+
 #if defined(_MSC_VER)
     /* make a local copy and feed it to putenv. */
     const size_t cchVar = strlen(pszVar);
@@ -124,7 +129,7 @@ RTDECL(int) RTEnvSet(const char *pszVar, const char *pszValue)
 
 RTDECL(int) RTEnvUnsetBad(const char *pszVar)
 {
-    AssertReturn(!strchr(pszVar, '='), VERR_INVALID_PARAMETER);
+    AssertReturn(strchr(pszVar, '=') == NULL, VERR_ENV_INVALID_VAR_NAME);
 
     /*
      * Check that it exists first.
diff --git a/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp b/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
index 4028eb5..15a85f6 100644
--- a/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
@@ -45,7 +45,7 @@ int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlag
     /*
      * Do we need to add an extension?
      */
-    if (!RTPathHaveExt(pszFilename))
+    if (!RTPathHasSuffix(pszFilename))
     {
 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
         static const char s_szSuff[] = ".DLL";
diff --git a/src/VBox/Runtime/r3/posix/process-creation-posix.cpp b/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
index f37acc9..7d701ef 100644
--- a/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/process-creation-posix.cpp
@@ -247,7 +247,7 @@ static void rtSolarisContractPostForkParent(int templateFd, pid_t pid)
     /* Abandon this contract we just created. */
     char ctlPath[PATH_MAX];
     size_t len = snprintf(ctlPath, sizeof(ctlPath),
-                          CTFS_ROOT "/process/%d/ctl", ctId);
+                          CTFS_ROOT "/process/%ld/ctl", (long)ctId);
     if (len >= sizeof(ctlPath))
         return;
     int ctlFd = open64(ctlPath, O_WRONLY);
diff --git a/src/VBox/Runtime/r3/posix/process-posix.cpp b/src/VBox/Runtime/r3/posix/process-posix.cpp
index 553808f..4c2b51e 100644
--- a/src/VBox/Runtime/r3/posix/process-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/process-posix.cpp
@@ -188,6 +188,7 @@ RTR3DECL(int) RTProcQueryUsername(RTPROCESS hProcess, char *pszUser, size_t cbUs
             rc = VERR_BUFFER_OVERFLOW;
         else
         {
+/** @todo this needs to be UTF-8 checked or converted...   */
             memcpy(pszUser, pPwd->pw_name, cbPwdUser);
             rc = VINF_SUCCESS;
         }
diff --git a/src/VBox/Runtime/r3/posix/rtmemlocked-posix.cpp b/src/VBox/Runtime/r3/posix/rtmemlocked-posix.cpp
deleted file mode 100644
index 92aff0b..0000000
--- a/src/VBox/Runtime/r3/posix/rtmemlocked-posix.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $Id: rtmemlocked-posix.cpp $ */
-/** @file
- * IPRT - RTMemLocked*, POSIX.
- */
-
-/*
- * Copyright (C) 2014 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#include "internal/iprt.h"
-#include <iprt/mem.h>
-
-#include <iprt/assert.h>
-#include <iprt/err.h>
-#include <iprt/param.h>
-#include <iprt/string.h>
-#include "internal/mem.h"
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <errno.h>
-
-
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
-
-#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) 
-# define MAP_ANONYMOUS MAP_ANON 
-#endif
-
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
-/**
- * Header for a locked memory region.
- */
-typedef struct RTMEMLOCKEDHDR
-{
-    /** Magic value. */
-    uint32_t            u32Magic;
-    /** Size of the region in bytes including the header, rounded to a page aligned value. */
-    size_t              cbRegion;
-#if HC_ARCH_BITS == 64
-    /** 8 byte alignment of the structure on 64bit platforms. */
-    uint32_t            u32Alignment;
-#endif
-} RTMEMLOCKEDHDR;
-/** Pointer to a locked memory region header. */
-typedef RTMEMLOCKEDHDR *PRTMEMLOCKEDHDR;
-/** Magic for the header. (Vienna Teng) */
-#define RTMEMLOCKEDHDR_MAGIC UINT32_C(0x19781003)
-
-RTDECL(int) RTMemLockedAllocExTag(size_t cb, const char *pszTag, void **ppv) RT_NO_THROW
-{
-    int rc = VINF_SUCCESS;
-    size_t cbAlloc = RT_ALIGN_Z(cb + sizeof(RTMEMLOCKEDHDR), PAGE_SIZE);
-    void *pv;
-
-    NOREF(pszTag);
-
-    pv = mmap(NULL, cbAlloc, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,
-              -1, 0);
-    if (pv != MAP_FAILED)
-    {
-        int rcPosix = mlock(pv, cbAlloc);
-        if (!rcPosix)
-        {
-            PRTMEMLOCKEDHDR pHdr = (PRTMEMLOCKEDHDR)pv;
-            AssertPtr(pHdr);
-
-            pHdr->u32Magic = RTMEMLOCKEDHDR_MAGIC;
-            pHdr->cbRegion = cbAlloc;
-            *ppv = pHdr + 1;
-        }
-        else
-            rc = RTErrConvertFromErrno(errno);
-    }
-
-    return rc;
-}
-
-RTDECL(int) RTMemLockedAllocZExTag(size_t cb, const char *pszTag, void **ppv) RT_NO_THROW
-{
-    void *pv = NULL;
-    int rc = RTMemLockedAllocExTag(cb, pszTag, &pv);
-
-    if (RT_SUCCESS(rc))
-    {
-        RT_BZERO(pv, cb);
-        *ppv = pv;
-    }
-
-    return rc;
-}
-
-RTDECL(void *) RTMemLockedAllocTag(size_t cb, const char *pszTag) RT_NO_THROW
-{
-    void *pv = NULL;
-    int rc = RTMemLockedAllocExTag(cb, pszTag, &pv);
-
-    if (RT_FAILURE(rc))
-        return NULL;
-
-    return pv;
-}
-
-RTDECL(void *) RTMemLockedAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW
-{
-    void *pv = NULL;
-    int rc = RTMemLockedAllocZExTag(cb, pszTag, &pv);
-
-    if (RT_FAILURE(rc))
-        return NULL;
-
-    return pv;
-}
-
-RTDECL(void) RTMemLockedFree(void *pv) RT_NO_THROW
-{
-    /*
-     * Validate & adjust the input.
-     */
-    if (!pv)
-        return;
-    AssertPtr(pv);
-
-    int rcPosix;
-    PRTMEMLOCKEDHDR pHdr = ((PRTMEMLOCKEDHDR)pv) - 1;
-    AssertReturnVoid(pHdr->u32Magic == RTMEMLOCKEDHDR_MAGIC);
-
-    pHdr->u32Magic = ~RTMEMLOCKEDHDR_MAGIC;
-    rcPosix = munlock(pHdr, pHdr->cbRegion);
-    AssertMsg(rcPosix == 0, ("rc=%d errno=%d pv=%p\n", rcPosix, errno, pHdr)); NOREF(rcPosix);
-
-    rcPosix = munmap(pHdr, pHdr->cbRegion);
-    AssertMsg(rcPosix == 0, ("rc=%d errno=%d pv=%p\n", rcPosix, errno, pHdr)); NOREF(rcPosix);
-}
-
diff --git a/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp b/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
index c72cd22..84dc20c 100644
--- a/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/rtmempage-exec-mmap-heap-posix.cpp
@@ -40,6 +40,7 @@
 #include <iprt/param.h>
 #include <iprt/string.h>
 #include "internal/mem.h"
+#include "../alloc-ef.h"
 
 #include <stdlib.h>
 #include <errno.h>
@@ -411,7 +412,13 @@ static int rtHeapPageAllocLocked(PRTHEAPPAGE pHeap, size_t cPages, const char *p
 
     }
     /** @todo Eliminate this rtMemBaseAlloc dependency! */
-    PRTHEAPPAGEBLOCK pBlock = (PRTHEAPPAGEBLOCK)rtMemBaseAlloc(sizeof(*pBlock));
+    PRTHEAPPAGEBLOCK pBlock;
+#ifdef RTALLOC_REPLACE_MALLOC
+    if (g_pfnOrgMalloc)
+        pBlock = (PRTHEAPPAGEBLOCK)g_pfnOrgMalloc(sizeof(*pBlock));
+    else
+#endif
+        pBlock = (PRTHEAPPAGEBLOCK)rtMemBaseAlloc(sizeof(*pBlock));
     if (!pBlock)
     {
         munmap(pvPages, RTMEMPAGEPOSIX_BLOCK_SIZE);
@@ -582,7 +589,12 @@ int RTHeapPageFree(PRTHEAPPAGE pHeap, void *pv, size_t cPages)
                         munmap(pBlock->Core.Key, RTMEMPAGEPOSIX_BLOCK_SIZE);
                         pBlock->Core.Key = pBlock->Core.KeyLast = NULL;
                         pBlock->cFreePages = 0;
-                        rtMemBaseFree(pBlock);
+#ifdef RTALLOC_REPLACE_MALLOC
+                        if (g_pfnOrgFree)
+                            g_pfnOrgFree(pBlock);
+                        else
+#endif
+                            rtMemBaseFree(pBlock);
 
                         RTCritSectEnter(&pHeap->CritSect);
                     }
diff --git a/src/VBox/Runtime/r3/posix/time-posix.cpp b/src/VBox/Runtime/r3/posix/time-posix.cpp
index 6f313af..dad9943 100644
--- a/src/VBox/Runtime/r3/posix/time-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/time-posix.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -46,7 +46,7 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     {
         struct timespec ts;
         if (!clock_gettime(CLOCK_MONOTONIC, &ts))
-            return (uint64_t)ts.tv_sec * (uint64_t)(1000 * 1000 * 1000)
+            return (uint64_t)ts.tv_sec * RT_NS_1SEC_64
                  + ts.tv_nsec;
         s_fMonoClock = false;
     }
@@ -55,8 +55,8 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     /* fallback to gettimeofday(). */
     struct timeval tv;
     gettimeofday(&tv, NULL);
-    return (uint64_t)tv.tv_sec  * (uint64_t)(1000 * 1000 * 1000)
-         + (uint64_t)(tv.tv_usec * 1000);
+    return (uint64_t)tv.tv_sec  * RT_NS_1SEC_64
+         + (uint64_t)(tv.tv_usec * RT_NS_1US);
 }
 
 
@@ -84,6 +84,6 @@ RTDECL(uint64_t) RTTimeSystemNanoTS(void)
  */
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
diff --git a/src/VBox/Runtime/r3/posix/timer-posix.cpp b/src/VBox/Runtime/r3/posix/timer-posix.cpp
index 043709a..7cf2e39 100644
--- a/src/VBox/Runtime/r3/posix/timer-posix.cpp
+++ b/src/VBox/Runtime/r3/posix/timer-posix.cpp
@@ -668,7 +668,7 @@ RTR3DECL(int) RTTimerDestroy(PRTTIMER pTimer)
         TimerSpec.it_value.tv_sec     = 0;
         TimerSpec.it_value.tv_nsec    = 0;
         int err = timer_settime(pTimer->NativeTimer, 0, &TimerSpec, NULL); NOREF(err);
-        AssertMsg(!err, ("%d\n", err));
+        AssertMsg(!err, ("%d / %d\n", err, errno));
     }
 #endif
 
@@ -765,7 +765,7 @@ RTDECL(int) RTTimerStart(PRTTIMER pTimer, uint64_t u64First)
     TimerSpec.it_interval.tv_sec  = pTimer->u64NanoInterval / 1000000000;
     TimerSpec.it_interval.tv_nsec = pTimer->u64NanoInterval % 1000000000;
     int err = timer_settime(pTimer->NativeTimer, 0, &TimerSpec, NULL);
-    int rc = RTErrConvertFromErrno(err);
+    int rc = err == 0 ? VINF_SUCCESS : RTErrConvertFromErrno(errno);
 #endif /* IPRT_WITH_POSIX_TIMERS */
 
     if (RT_FAILURE(rc))
@@ -812,7 +812,7 @@ RTDECL(int) RTTimerStop(PRTTIMER pTimer)
     TimerSpec.it_value.tv_sec     = 0;
     TimerSpec.it_value.tv_nsec    = 0;
     int err = timer_settime(pTimer->NativeTimer, 0, &TimerSpec, NULL);
-    int rc = RTErrConvertFromErrno(err);
+    int rc = err == 0 ? VINF_SUCCESS : RTErrConvertFromErrno(errno);
 #endif /* IPRT_WITH_POSIX_TIMERS */
 
     return rc;
diff --git a/src/VBox/Runtime/r3/socket.cpp b/src/VBox/Runtime/r3/socket.cpp
index 250d2bb..930076a 100644
--- a/src/VBox/Runtime/r3/socket.cpp
+++ b/src/VBox/Runtime/r3/socket.cpp
@@ -678,7 +678,7 @@ RTDECL(int) RTSocketParseInetAddress(const char *pszAddress, unsigned uPort, PRT
     if (!pHostEnt)
     {
         rc = rtSocketResolverError();
-        //AssertMsgFailed(("Could not resolve '%s', rc=%Rrc\n", pszAddress, rc));
+        AssertMsgFailed(("Could not resolve '%s', rc=%Rrc\n", pszAddress, rc));
         return rc;
     }
 
@@ -782,9 +782,8 @@ RTDECL(int) RTSocketQueryAddressStr(const char *pszHost, char *pszResult, size_t
     if (pgrResult->ai_family == AF_INET)
     {
         struct sockaddr_in const *pgrSa = (struct sockaddr_in const *)pgrResult->ai_addr;
-        pbDummy = (uint8_t const *)&pgrSa->sin_addr;
-        cchIpAddress = RTStrPrintf(szIpAddress, sizeof(szIpAddress), "%u.%u.%u.%u",
-                                   pbDummy[0], pbDummy[1], pbDummy[2], pbDummy[3]);
+        cchIpAddress = RTStrPrintf(szIpAddress, sizeof(szIpAddress),
+                                   "%RTnaipv4", pgrSa->sin_addr.s_addr);
         Assert(cchIpAddress >= 7 && cchIpAddress < sizeof(szIpAddress) - 1);
         enmAddrType = RTNETADDRTYPE_IPV4;
         rc = VINF_SUCCESS;
@@ -792,27 +791,10 @@ RTDECL(int) RTSocketQueryAddressStr(const char *pszHost, char *pszResult, size_t
     else if (pgrResult->ai_family == AF_INET6)
     {
         struct sockaddr_in6 const *pgrSa6 = (struct sockaddr_in6 const *)pgrResult->ai_addr;
-        pbDummy = (uint8_t const *) &pgrSa6->sin6_addr;
-        char szTmp[32+1];
-        size_t cchTmp = RTStrPrintf(szTmp, sizeof(szTmp),
-                                    "%02x%02x%02x%02x"
-                                    "%02x%02x%02x%02x"
-                                    "%02x%02x%02x%02x"
-                                    "%02x%02x%02x%02x",
-                                    pbDummy[0],  pbDummy[1],  pbDummy[2],  pbDummy[3],
-                                    pbDummy[4],  pbDummy[5],  pbDummy[6],  pbDummy[7],
-                                    pbDummy[8],  pbDummy[9],  pbDummy[10], pbDummy[11],
-                                    pbDummy[12], pbDummy[13], pbDummy[14], pbDummy[15]);
-        Assert(cchTmp == 32);
-        rc = rtStrToIpAddr6Str(szTmp, szIpAddress, sizeof(szIpAddress), NULL, 0, true);
-        if (RT_SUCCESS(rc))
-            cchIpAddress = strlen(szIpAddress);
-        else
-        {
-            szIpAddress[0] = '\0';
-            cchIpAddress = 0;
-        }
+        cchIpAddress = RTStrPrintf(szIpAddress, sizeof(szIpAddress),
+                                   "%RTnaipv6", (PRTNETADDRIPV6)&pgrSa6->sin6_addr);
         enmAddrType = RTNETADDRTYPE_IPV6;
+        rc = VINF_SUCCESS;
     }
     else
     {
@@ -1606,28 +1588,47 @@ RTDECL(int) RTSocketGetPeerAddress(RTSOCKET hSocket, PRTNETADDR pAddr)
  */
 int rtSocketBind(RTSOCKET hSocket, PCRTNETADDR pAddr)
 {
+    RTSOCKADDRUNION u;
+    int             cbAddr;
+    int rc = rtSocketAddrFromNetAddr(pAddr, &u, sizeof(u), &cbAddr);
+    if (RT_SUCCESS(rc))
+        rc = rtSocketBindRawAddr(hSocket, &u.Addr, cbAddr);
+    return rc;
+}
+
+
+/**
+ * Very thin wrapper around bind.
+ *
+ * @returns IPRT status code.
+ * @param   hSocket             The socket handle.
+ * @param   pvAddr              The address to bind to (struct sockaddr and
+ *                              friends).
+ * @param   cbAddr              The size of the address.
+ */
+int rtSocketBindRawAddr(RTSOCKET hSocket, void const *pvAddr, size_t cbAddr)
+{
     /*
      * Validate input.
      */
     RTSOCKETINT *pThis = hSocket;
     AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     AssertReturn(pThis->u32Magic == RTSOCKET_MAGIC, VERR_INVALID_HANDLE);
+    AssertPtrReturn(pvAddr, VERR_INVALID_POINTER);
     AssertReturn(rtSocketTryLock(pThis), VERR_CONCURRENT_ACCESS);
 
-    RTSOCKADDRUNION u;
-    int             cbAddr;
-    int rc = rtSocketAddrFromNetAddr(pAddr, &u, sizeof(u), &cbAddr);
-    if (RT_SUCCESS(rc))
-    {
-        if (bind(pThis->hNative, &u.Addr, cbAddr) != 0)
-            rc = rtSocketError();
-    }
+    int rc;
+    if (bind(pThis->hNative, (struct sockaddr const *)pvAddr, (int)cbAddr) == 0)
+        rc = VINF_SUCCESS;
+    else
+        rc = rtSocketError();
 
     rtSocketUnlock(pThis);
     return rc;
 }
 
 
+
 /**
  * Wrapper around listen.
  *
diff --git a/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp b/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp
index 66ef528..fe251ec 100644
--- a/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp
+++ b/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp
@@ -1348,7 +1348,7 @@ static int ElfWriteNoteHeader(PRTSOLCORE pSolCore, uint_t Type, const void *pcv,
 
     /*
      * This is a known violation of the 64-bit ELF spec., see xTracker @bugref{5211}
-     * for the historic reasons as to the padding and namesz anomalies.
+     * for the historic reasons as to the padding and 'namesz' anomalies.
      */
     static const char s_achPad[3] = { 0, 0, 0 };
     size_t cbAlign = RT_ALIGN_Z(cb, 4);
@@ -1687,7 +1687,7 @@ static int ElfWriteMappingHeaders(PRTSOLCORE pSolCore)
     while (pMapInfo)
     {
         ProgHdr.p_vaddr  = pMapInfo->pMap.pr_vaddr;     /* Virtual address of this mapping in the process address space */
-        ProgHdr.p_offset = pSolCore->offWrite;         /* Where this mapping is located in the core file */
+        ProgHdr.p_offset = pSolCore->offWrite;          /* Where this mapping is located in the core file */
         ProgHdr.p_memsz  = pMapInfo->pMap.pr_size;      /* Size of the memory image of the mapping */
         ProgHdr.p_filesz = pMapInfo->pMap.pr_size;      /* Size of the file image of the mapping */
 
diff --git a/src/VBox/Runtime/r3/stream.cpp b/src/VBox/Runtime/r3/stream.cpp
index 4866439..19baedc 100644
--- a/src/VBox/Runtime/r3/stream.cpp
+++ b/src/VBox/Runtime/r3/stream.cpp
@@ -59,6 +59,10 @@
 #ifdef RT_OS_WINDOWS
 # include <Windows.h>
 #endif
+#ifndef RT_OS_WINDOWS
+# include <termios.h>
+# include <unistd.h>
+#endif
 
 #ifdef RT_OS_OS2
 # define _O_TEXT   O_TEXT
@@ -464,6 +468,91 @@ RTR3DECL(int) RTStrmSetMode(PRTSTREAM pStream, int fBinary, int fCurrentCodeSet)
 }
 
 
+RTR3DECL(int) RTStrmInputGetEchoChars(PRTSTREAM pStream, bool *pfEchoChars)
+{
+    int rc = VINF_SUCCESS;
+
+    AssertPtrReturn(pStream, VERR_INVALID_HANDLE);
+    AssertReturn(pStream->u32Magic == RTSTREAM_MAGIC, VERR_INVALID_HANDLE);
+    AssertPtrReturn(pfEchoChars, VERR_INVALID_POINTER);
+
+    int fh = fileno(pStream->pFile);
+    if (isatty(fh))
+    {
+#ifdef RT_OS_WINDOWS
+        DWORD dwMode;
+        HANDLE hCon = (HANDLE)_get_osfhandle(fh);
+        if (GetConsoleMode(hCon, &dwMode))
+            *pfEchoChars = RT_BOOL(dwMode & ENABLE_ECHO_INPUT);
+        else
+            rc = RTErrConvertFromWin32(GetLastError());
+#else
+        struct termios Termios;
+
+        int rcPosix = tcgetattr(fh, &Termios);
+        if (!rcPosix)
+            *pfEchoChars = RT_BOOL(Termios.c_lflag & ECHO);
+        else
+            rc = RTErrConvertFromErrno(errno);
+#endif
+    }
+    else
+        rc = VERR_INVALID_HANDLE;
+
+    return rc;
+}
+
+
+RTR3DECL(int) RTStrmInputSetEchoChars(PRTSTREAM pStream, bool fEchoChars)
+{
+    int rc = VINF_SUCCESS;
+
+    AssertPtrReturn(pStream, VERR_INVALID_HANDLE);
+    AssertReturn(pStream->u32Magic == RTSTREAM_MAGIC, VERR_INVALID_HANDLE);
+
+    int fh = fileno(pStream->pFile);
+    if (isatty(fh))
+    {
+#ifdef RT_OS_WINDOWS
+        DWORD dwMode;
+        HANDLE hCon = (HANDLE)_get_osfhandle(fh);
+        if (GetConsoleMode(hCon, &dwMode))
+        {
+            if (fEchoChars)
+                dwMode |= ENABLE_ECHO_INPUT;
+            else
+                dwMode &= ~ENABLE_ECHO_INPUT;
+            if (!SetConsoleMode(hCon, dwMode))
+                rc = RTErrConvertFromWin32(GetLastError());
+        }
+        else
+            rc = RTErrConvertFromWin32(GetLastError());
+#else
+        struct termios Termios;
+
+        int rcPosix = tcgetattr(fh, &Termios);
+        if (!rcPosix)
+        {
+            if (fEchoChars)
+                Termios.c_lflag |= ECHO;
+            else
+                Termios.c_lflag &= ~ECHO;
+
+            rcPosix = tcsetattr(fh, TCSAFLUSH, &Termios);
+            if (rcPosix != 0)
+                rc = RTErrConvertFromErrno(errno);
+        }
+        else
+            rc = RTErrConvertFromErrno(errno);
+#endif
+    }
+    else
+        rc = VERR_INVALID_HANDLE;
+
+    return rc;
+}
+
+
 /**
  * Rewinds the stream.
  *
diff --git a/src/VBox/Runtime/r3/test.cpp b/src/VBox/Runtime/r3/test.cpp
index 5688dc6..bdc4bb2 100644
--- a/src/VBox/Runtime/r3/test.cpp
+++ b/src/VBox/Runtime/r3/test.cpp
@@ -635,7 +635,7 @@ RTR3DECL(int) RTTestGuardedAlloc(RTTEST hTest, size_t cb, uint32_t cbAlign, bool
 RTR3DECL(void *) RTTestGuardedAllocTail(RTTEST hTest, size_t cb)
 {
     void *pvUser;
-    int rc = RTTestGuardedAlloc(hTest, cb, 1, false /*fHead*/, &pvUser);
+    int rc = RTTestGuardedAlloc(hTest, cb, 1 /* cbAlign */, false /* fHead */, &pvUser);
     if (RT_SUCCESS(rc))
         return pvUser;
     return NULL;
@@ -654,7 +654,7 @@ RTR3DECL(void *) RTTestGuardedAllocTail(RTTEST hTest, size_t cb)
 RTR3DECL(void *) RTTestGuardedAllocHead(RTTEST hTest, size_t cb)
 {
     void *pvUser;
-    int rc = RTTestGuardedAlloc(hTest, cb, 1, true /*fHead*/, &pvUser);
+    int rc = RTTestGuardedAlloc(hTest, cb, 1 /* cbAlign */, true /* fHead */, &pvUser);
     if (RT_SUCCESS(rc))
         return pvUser;
     return NULL;
diff --git a/src/VBox/Runtime/r3/win/VBoxRT-win32.def b/src/VBox/Runtime/r3/win/VBoxRT-win32.def
index e36769f..1cecf92 100644
--- a/src/VBox/Runtime/r3/win/VBoxRT-win32.def
+++ b/src/VBox/Runtime/r3/win/VBoxRT-win32.def
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2012 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -27,8 +27,18 @@
 EXPORTS
     ASMMultU64ByU32DivByU32
 
-    RTTimeNanoTSLegacySync
-    RTTimeNanoTSLegacyAsync
-    RTTimeNanoTSLFenceSync
-    RTTimeNanoTSLFenceAsync
+    RTTimeNanoTSLegacySyncInvarNoDelta
+    RTTimeNanoTSLFenceSyncInvarNoDelta
+    RTTimeNanoTSLegacyAsyncUseApicId
+    RTTimeNanoTSLegacyAsyncUseRdtscp
+    RTTimeNanoTSLegacyAsyncUseIdtrLim
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim
+    RTTimeNanoTSLFenceAsyncUseApicId
+    RTTimeNanoTSLFenceAsyncUseRdtscp
+    RTTimeNanoTSLFenceAsyncUseIdtrLim
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim
 
diff --git a/src/VBox/Runtime/r3/win/VBoxRT-win64.def b/src/VBox/Runtime/r3/win/VBoxRT-win64.def
index 434c7be..f24ecca 100644
--- a/src/VBox/Runtime/r3/win/VBoxRT-win64.def
+++ b/src/VBox/Runtime/r3/win/VBoxRT-win64.def
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2012 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -39,8 +39,18 @@ EXPORTS
     ASMMultU64ByU32DivByU32
     ASMNopPause
 
-    RTTimeNanoTSLegacySync
-    RTTimeNanoTSLegacyAsync
-    RTTimeNanoTSLFenceSync
-    RTTimeNanoTSLFenceAsync
+    RTTimeNanoTSLegacySyncInvarNoDelta
+    RTTimeNanoTSLFenceSyncInvarNoDelta
+    RTTimeNanoTSLegacyAsyncUseApicId
+    RTTimeNanoTSLegacyAsyncUseRdtscp
+    RTTimeNanoTSLegacyAsyncUseIdtrLim
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp
+    RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim
+    RTTimeNanoTSLFenceAsyncUseApicId
+    RTTimeNanoTSLFenceAsyncUseRdtscp
+    RTTimeNanoTSLFenceAsyncUseIdtrLim
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp
+    RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim
 
diff --git a/src/VBox/Runtime/r3/win/VBoxRT.rc b/src/VBox/Runtime/r3/win/VBoxRT.rc
deleted file mode 100644
index 1b34d15..0000000
--- a/src/VBox/Runtime/r3/win/VBoxRT.rc
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id: VBoxRT.rc $ */
-/** @file
- * VBoxRT - Resource file containing version info.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      VFT2_UNKNOWN
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904b0" // Lang=US English, CharSet=Unicode
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox Runtime\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     "VBoxRT\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", "VBoxRT.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1200
-  END
-END
diff --git a/src/VBox/Runtime/r3/win/dir-win.cpp b/src/VBox/Runtime/r3/win/dir-win.cpp
index 5c57315..4f11e82 100644
--- a/src/VBox/Runtime/r3/win/dir-win.cpp
+++ b/src/VBox/Runtime/r3/win/dir-win.cpp
@@ -72,9 +72,17 @@ RTDECL(int) RTDirCreate(const char *pszPath, RTFMODE fMode, uint32_t fCreate)
             /*
              * Turn off indexing of directory through Windows Indexing Service
              */
-            if (RT_SUCCESS(rc))
+            /** @todo This FILE_ATTRIBUTE_NOT_CONTENT_INDEXED hack (for .VDI files,
+             *        really) may cause failures on samba shares.  That really sweet and
+             *        need to be addressed differently.  We shouldn't be doing this
+             *        unless the caller actually asks for it, must less returning failure,
+             *        for crying out loud!  This is only important a couple of places in
+             *        main, if important is the right way to put it... */
+            if (   RT_SUCCESS(rc)
+                && !(fCreate & RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_DONT_SET))
             {
-                if (SetFileAttributesW((LPCWSTR)pwszString, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED))
+                if (   SetFileAttributesW((LPCWSTR)pwszString, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)
+                    || (fCreate & RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_NOT_CRITICAL) )
                     rc = VINF_SUCCESS;
                 else
                     rc = RTErrConvertFromWin32(GetLastError());
diff --git a/src/VBox/Runtime/r3/win/env-win.cpp b/src/VBox/Runtime/r3/win/env-win.cpp
index 030c6cd..d9f1198 100644
--- a/src/VBox/Runtime/r3/win/env-win.cpp
+++ b/src/VBox/Runtime/r3/win/env-win.cpp
@@ -53,6 +53,8 @@ RTDECL(bool) RTEnvExist(const char *pszVar)
 
 RTDECL(bool) RTEnvExistsUtf8(const char *pszVar)
 {
+    AssertReturn(strchr(pszVar, '=') == NULL, false);
+
     PRTUTF16 pwszVar;
     int rc = RTStrToUtf16(pszVar, &pwszVar);
     AssertRCReturn(rc, false);
@@ -64,6 +66,7 @@ RTDECL(bool) RTEnvExistsUtf8(const char *pszVar)
 
 RTDECL(const char *) RTEnvGetBad(const char *pszVar)
 {
+    AssertReturn(strchr(pszVar, '=') == NULL, NULL);
     return getenv(pszVar);
 }
 
@@ -80,13 +83,14 @@ RTDECL(int) RTEnvGetUtf8(const char *pszVar, char *pszValue, size_t cbValue, siz
     AssertReturn(pszValue || !cbValue, VERR_INVALID_PARAMETER);
     AssertPtrNullReturn(pcchActual, VERR_INVALID_POINTER);
     AssertReturn(pcchActual || (pszValue && cbValue), VERR_INVALID_PARAMETER);
+    AssertReturn(strchr(pszVar, '=') == NULL, VERR_ENV_INVALID_VAR_NAME);
 
     if (pcchActual)
         *pcchActual = 0;
 
     PRTUTF16 pwszVar;
     int rc = RTStrToUtf16(pszVar, &pwszVar);
-    AssertRCReturn(rc, false);
+    AssertRCReturn(rc, rc);
 
     /** @todo Consider _wgetenv_s or GetEnvironmentVariableW here to avoid the
      *        potential race with a concurrent _wputenv/_putenv. */
@@ -139,6 +143,8 @@ RTDECL(int) RTEnvPutUtf8(const char *pszVarEqualValue)
 
 RTDECL(int) RTEnvSetBad(const char *pszVar, const char *pszValue)
 {
+    AssertMsgReturn(strchr(pszVar, '=') == NULL, ("'%s'\n", pszVar), VERR_ENV_INVALID_VAR_NAME);
+
     /* make a local copy and feed it to putenv. */
     const size_t cchVar = strlen(pszVar);
     const size_t cchValue = strlen(pszValue);
@@ -166,6 +172,8 @@ RTDECL(int) RTEnvSet(const char *pszVar, const char *pszValue)
 
 RTDECL(int) RTEnvSetUtf8(const char *pszVar, const char *pszValue)
 {
+    AssertReturn(strchr(pszVar, '=') == NULL, VERR_ENV_INVALID_VAR_NAME);
+
     size_t cwcVar;
     int rc = RTStrCalcUtf16LenEx(pszVar, RTSTR_MAX, &cwcVar);
     if (RT_SUCCESS(rc))
@@ -203,7 +211,7 @@ RTDECL(int) RTEnvSetUtf8(const char *pszVar, const char *pszValue)
 
 RTDECL(int) RTEnvUnsetBad(const char *pszVar)
 {
-    AssertReturn(!strchr(pszVar, '='), VERR_INVALID_PARAMETER);
+    AssertReturn(strchr(pszVar, '=') == NULL, VERR_ENV_INVALID_VAR_NAME);
 
     /*
      * Check that it exists first.
@@ -243,6 +251,8 @@ RTDECL(int) RTEnvUnset(const char *pszVar)
 
 RTDECL(int) RTEnvUnsetUtf8(const char *pszVar)
 {
+    AssertReturn(strchr(pszVar, '=') == NULL, VERR_ENV_INVALID_VAR_NAME);
+
     size_t cwcVar;
     int rc = RTStrCalcUtf16LenEx(pszVar, RTSTR_MAX, &cwcVar);
     if (RT_SUCCESS(rc))
diff --git a/src/VBox/Runtime/r3/win/fileio-win.cpp b/src/VBox/Runtime/r3/win/fileio-win.cpp
index f335cd8..397d26a 100644
--- a/src/VBox/Runtime/r3/win/fileio-win.cpp
+++ b/src/VBox/Runtime/r3/win/fileio-win.cpp
@@ -709,6 +709,9 @@ RTR3DECL(bool) RTFileIsValid(RTFILE hFile)
                 if (GetLastError() == NO_ERROR)
                     return true;
                 break;
+
+            default:
+                break;
         }
     }
     return false;
@@ -826,8 +829,10 @@ RTR3DECL(int) RTFileQueryInfo(RTFILE hFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRAD
         DWORD dwErr = GetLastError();
         /* Only return if we *really* don't have a valid handle value,
          * everything else is fine here ... */
-        if (dwErr != ERROR_INVALID_HANDLE)
+        if (dwErr == ERROR_INVALID_HANDLE)
             return RTErrConvertFromWin32(dwErr);
+        RT_ZERO(Data);
+        Data.dwFileAttributes = RTFS_DOS_NT_DEVICE;
     }
 
     /*
diff --git a/src/VBox/Runtime/r3/win/internal-r3-win.h b/src/VBox/Runtime/r3/win/internal-r3-win.h
index cc73b58..cefaf3a 100644
--- a/src/VBox/Runtime/r3/win/internal-r3-win.h
+++ b/src/VBox/Runtime/r3/win/internal-r3-win.h
@@ -1,3 +1,29 @@
+/* $Id: internal-r3-win.h $ */
+/** @file
+ * IPRT - some Windows OS type constants.
+ */
+
+/*
+ * Copyright (C) 2013-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
 
 #ifndef ___internal_r3_win_h
 #define ___internal_r3_win_h
diff --git a/src/VBox/Runtime/r3/win/ldrNative-win.cpp b/src/VBox/Runtime/r3/win/ldrNative-win.cpp
index 8b26ab2..82e7343 100644
--- a/src/VBox/Runtime/r3/win/ldrNative-win.cpp
+++ b/src/VBox/Runtime/r3/win/ldrNative-win.cpp
@@ -57,7 +57,7 @@ int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlag
     /*
      * Do we need to add an extension?
      */
-    if (!RTPathHaveExt(pszFilename))
+    if (!RTPathHasSuffix(pszFilename))
     {
         size_t cch = strlen(pszFilename);
         char *psz = (char *)alloca(cch + sizeof(".DLL"));
diff --git a/src/VBox/Runtime/r3/win/localipc-win.cpp b/src/VBox/Runtime/r3/win/localipc-win.cpp
index a25b9ca..0a12dbb 100644
--- a/src/VBox/Runtime/r3/win/localipc-win.cpp
+++ b/src/VBox/Runtime/r3/win/localipc-win.cpp
@@ -346,10 +346,13 @@ RTDECL(int) RTLocalIpcServerCreate(PRTLOCALIPCSERVER phServer, const char *pszNa
 
     /*
      * Allocate and initialize the instance data.
+     *
+     * We align the size on pointer size here to make sure we get naturally
+     * aligned members in the critsect when the electric fence heap is active.
      */
     size_t cchName = strlen(pszName);
-    size_t cch = RT_OFFSETOF(RTLOCALIPCSERVERINT, szName[cchName + sizeof(RTLOCALIPC_WIN_PREFIX)]);
-    PRTLOCALIPCSERVERINT pThis = (PRTLOCALIPCSERVERINT)RTMemAlloc(cch);
+    size_t cbThis = RT_OFFSETOF(RTLOCALIPCSERVERINT, szName[cchName + sizeof(RTLOCALIPC_WIN_PREFIX)]);
+    PRTLOCALIPCSERVERINT pThis = (PRTLOCALIPCSERVERINT)RTMemAllocVar(cbThis);
     if (!pThis)
         return VERR_NO_MEMORY;
     pThis->u32Magic = RTLOCALIPCSERVER_MAGIC;
diff --git a/src/VBox/Runtime/r3/win/mp-win.cpp b/src/VBox/Runtime/r3/win/mp-win.cpp
index dce41d1..b540620 100644
--- a/src/VBox/Runtime/r3/win/mp-win.cpp
+++ b/src/VBox/Runtime/r3/win/mp-win.cpp
@@ -100,13 +100,26 @@ RTDECL(RTCPUID) RTMpGetCoreCount(void)
 {
     /*
      * Resolve the API dynamically (one try) as it requires XP w/ sp3 or later.
-     */
+     */    
     typedef BOOL (WINAPI *PFNGETLOGICALPROCINFO)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD);
     static PFNGETLOGICALPROCINFO s_pfnGetLogicalProcInfo = (PFNGETLOGICALPROCINFO)~(uintptr_t)0;
     if (s_pfnGetLogicalProcInfo == (PFNGETLOGICALPROCINFO)~(uintptr_t)0)
         s_pfnGetLogicalProcInfo = (PFNGETLOGICALPROCINFO)RTLdrGetSystemSymbol("kernel32.dll", "GetLogicalProcessorInformation");
 
-    if (s_pfnGetLogicalProcInfo)
+    /*
+     * Sadly, on XP and Server 2003, even if the API is present, it does not tell us
+     * how many physical cores there are (any package will look like a single core).
+     * That is worse than not using the API at all, so just skip it unless it's Vista+.
+     */
+    bool fIsVistaOrLater = false;
+    OSVERSIONINFOEX OSInfoEx = { 0 };
+    OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+    if (   GetVersionEx((LPOSVERSIONINFO) &OSInfoEx)
+        && (OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT)
+        && (OSInfoEx.dwMajorVersion >= 6))
+        fIsVistaOrLater = true;
+
+    if (s_pfnGetLogicalProcInfo && fIsVistaOrLater)
     {
         /*
          * Query the information. This unfortunately requires a buffer, so we
diff --git a/src/VBox/Runtime/r3/win/ntdll-mini-implib.def b/src/VBox/Runtime/r3/win/ntdll-mini-implib.def
index 8f8a855..c4d3d0c 100644
--- a/src/VBox/Runtime/r3/win/ntdll-mini-implib.def
+++ b/src/VBox/Runtime/r3/win/ntdll-mini-implib.def
@@ -137,4 +137,6 @@ EXPORTS
     RtlSetLastWin32ErrorAndNtStatusFromNtStatus ;;= _RtlSetLastWin32ErrorAndNtStatusFromNtStatus at 4
     RtlSizeHeap                           ;;= _RtlSizeHeap at 12
     RtlSubAuthoritySid                    ;;= _RtlSubAuthoritySid at 8
+    RtlQueryPerformanceCounter            ;;= _RtlQueryPerformanceCounter at 4
+    RtlGetSystemTimePrecise               ;;= _RtlGetSystemTimePrecise at 0
 
diff --git a/src/VBox/Runtime/r3/win/process-win.cpp b/src/VBox/Runtime/r3/win/process-win.cpp
index e706ecb..ff31df8 100644
--- a/src/VBox/Runtime/r3/win/process-win.cpp
+++ b/src/VBox/Runtime/r3/win/process-win.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -612,22 +612,28 @@ static void rtProcWinUserLogoff(HANDLE hToken)
 
 
 /**
- * Creates an environment block out of a handed in Unicode and RTENV block.
- * The RTENV block can overwrite entries already present in the Unicode block.
+ * Creates an environment block out of a handed-in Unicode and
+ * RTENV block. The RTENV block can overwrite entries already
+ * present in the Unicode block.
  *
  * @return  IPRT status code.
  *
- * @param   pvBlock         Unicode block (array) of environment entries; name=value
- * @param   hEnv            Handle of an existing RTENV block to use.
- * @param   ppwszBlock      Pointer to the final output.
+ * @param   pvEnvBlock          Unicode block (array) of environment entries;
+ *                              in form of "FOO=BAR\0BAR=BAZ".
+ * @param   hEnv                Handle of an existing RTENV block to use.
+ * @param   fOverwriteExisting  Whether to overwrite existing values of hEnv
+ *                              with the ones defined in pvEnvBlock.
+ * @param   ppwszBlock          Pointer to the final output.
  */
-static int rtProcWinEnvironmentCreateInternal(VOID *pvBlock, RTENV hEnv, PRTUTF16 *ppwszBlock)
+static int rtProcWinEnvironmentCreateInternal(VOID *pvEnvBlock, RTENV hEnv,
+                                              bool fOverwriteExisting,
+                                              PRTUTF16 *ppwszBlock)
 {
     RTENV hEnvTemp;
     int rc = RTEnvClone(&hEnvTemp, hEnv);
     if (RT_SUCCESS(rc))
     {
-        PCRTUTF16 pwch = (PCRTUTF16)pvBlock;
+        PCRTUTF16 pwch = (PCRTUTF16)pvEnvBlock;
         while (   pwch
                && RT_SUCCESS(rc))
         {
@@ -637,10 +643,31 @@ static int rtProcWinEnvironmentCreateInternal(VOID *pvBlock, RTENV hEnv, PRTUTF1
                 rc = RTUtf16ToUtf8(pwch, &pszEntry);
                 if (RT_SUCCESS(rc))
                 {
-                    /* Don't overwrite values which we already have set to a custom value
-                     * specified in hEnv ... */
-                    if (!RTEnvExistEx(hEnv, pszEntry))
-                        rc = RTEnvPutEx(hEnvTemp, pszEntry);
+                    const char *pszEq = strchr(pszEntry, '=');
+                    if (   !pszEq
+                        && fOverwriteExisting)
+                    {
+                        rc = RTEnvUnset(pszEntry);
+                    }
+                    else if (pszEq)
+                    {
+                        const char *pszValue = pszEq + 1;
+                        size_t cchVar = pszEq - pszEntry;
+                        char *pszVar = (char *)RTMemAlloc(cchVar + 1);
+                        if (pszVar)
+                        {
+                            memcpy(pszVar, pszEntry, cchVar);
+                            pszVar[cchVar] = '\0';
+                            if (   !RTEnvExistEx(hEnv, pszVar)
+                                || fOverwriteExisting)
+                            {
+                                rc = RTEnvSetEx(hEnvTemp, pszVar, pszValue);
+                            }
+                            RTMemFree(pszVar);
+                        }
+                        else
+                            rc = VERR_NO_MEMORY;
+                    }
                     RTStrFree(pszEntry);
                 }
             }
@@ -693,7 +720,9 @@ static int rtProcWinCreateEnvFromToken(HANDLE hToken, RTENV hEnv, PRTUTF16 *ppws
                 LPVOID pvEnvBlockProfile = NULL;
                 if (pfnCreateEnvironmentBlock(&pvEnvBlockProfile, hToken, FALSE /* Don't inherit from parent. */))
                 {
-                    rc = rtProcWinEnvironmentCreateInternal(pvEnvBlockProfile, hEnv, ppwszBlock);
+                    rc = rtProcWinEnvironmentCreateInternal(pvEnvBlockProfile, hEnv,
+                                                            false /* fOverwriteExisting */,
+                                                            ppwszBlock);
                     pfnDestroyEnvironmentBlock(pvEnvBlockProfile);
                 }
                 else
@@ -816,13 +845,13 @@ static int rtProcWinCreateAsUser2(PRTUTF16 pwszUser, PRTUTF16 pwszPassword, PRTU
                 dwErr = NO_ERROR;
 
                 PSID pSid = (PSID)RTMemAlloc(cbSid * sizeof(wchar_t)); /** @todo r=bird: What's the relationship between wchar_t and PSID? */
-                AssertPtrReturn(pSid, VERR_NO_MEMORY); /** @todo r=bird: Leaking token handles when we're out of memory...  */
+                AssertReturn(pSid, VERR_NO_MEMORY); /** @todo r=bird: Leaking token handles when we're out of memory...  */
 
                 PRTUTF16 pwszDomain = NULL;
                 if (cchDomain > 0)
                 {
                     pwszDomain = (PRTUTF16)RTMemAlloc(cchDomain * sizeof(RTUTF16));
-                    AssertPtrReturn(pwszDomain, VERR_NO_MEMORY); /** @todo r=bird: Leaking token handles when we're out of memory...  */
+                    AssertReturn(pwszDomain, VERR_NO_MEMORY); /** @todo r=bird: Leaking token handles when we're out of memory...  */
                 }
 
                 /* Note: Also supports FQDNs! */
diff --git a/src/VBox/Runtime/r3/win/rtmemlocked-win.cpp b/src/VBox/Runtime/r3/win/rtmemlocked-win.cpp
deleted file mode 100644
index 196171f..0000000
--- a/src/VBox/Runtime/r3/win/rtmemlocked-win.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $Id: rtmemlocked-win.cpp $ */
-/** @file
- * IPRT - RTMemLocked*, POSIX.
- */
-
-/*
- * Copyright (C) 2014 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#define LOG_GROUP RTLOGGROUP_MEM
-#include "internal/iprt.h"
-#include <iprt/mem.h>
-
-#include <iprt/assert.h>
-#include <iprt/err.h>
-#include <iprt/param.h>
-#include <iprt/string.h>
-#include "internal/mem.h"
-
-#include <Windows.h>
-
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
-
-
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
-
-RTDECL(int) RTMemLockedAllocExTag(size_t cb, const char *pszTag, void **ppv) RT_NO_THROW
-{
-    int rc = VINF_SUCCESS;
-
-    *ppv = RTMemAlloc(cb);
-    if (!*ppv)
-        rc = VERR_NO_MEMORY;
-
-    return rc;
-}
-
-RTDECL(int) RTMemLockedAllocZExTag(size_t cb, const char *pszTag, void **ppv) RT_NO_THROW
-{
-    void *pv = NULL;
-    int rc = RTMemLockedAllocExTag(cb, pszTag, &pv);
-
-    if (RT_SUCCESS(rc))
-    {
-        RT_BZERO(pv, cb);
-        *ppv = pv;
-    }
-
-    return rc;
-}
-
-RTDECL(void *) RTMemLockedAllocTag(size_t cb, const char *pszTag) RT_NO_THROW
-{
-    void *pv = NULL;
-    int rc = RTMemLockedAllocExTag(cb, pszTag, &pv);
-
-    if (RT_FAILURE(rc))
-        return NULL;
-
-    return pv;
-}
-
-RTDECL(void *) RTMemLockedAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW
-{
-    void *pv = NULL;
-    int rc = RTMemLockedAllocZExTag(cb, pszTag, &pv);
-
-    if (RT_FAILURE(rc))
-        return NULL;
-
-    return pv;
-}
-
-RTDECL(void) RTMemLockedFree(void *pv) RT_NO_THROW
-{
-    /*
-     * Validate & adjust the input.
-     */
-    if (!pv)
-        return;
-    AssertPtr(pv);
-
-    RTMemFree(pv);
-}
-
diff --git a/src/VBox/Runtime/r3/win/symlink-win.cpp b/src/VBox/Runtime/r3/win/symlink-win.cpp
index 52f5c41..05e92b7 100644
--- a/src/VBox/Runtime/r3/win/symlink-win.cpp
+++ b/src/VBox/Runtime/r3/win/symlink-win.cpp
@@ -157,6 +157,16 @@ RTDECL(int) RTSymlinkCreate(const char *pszSymlink, const char *pszTarget, RTSYM
         rc = RTStrToUtf16(pszTarget, &pwszNativeTarget);
         if (RT_SUCCESS(rc))
         {
+            /* The link target path must use backslashes to work reliably. */
+            RTUTF16  wc;
+            PRTUTF16 pwsz = pwszNativeTarget;
+            while ((wc = *pwsz) != '\0')
+            {
+                if (wc == '/')
+                    *pwsz = '\\';
+                pwsz++;
+            }
+
             /*
              * Massage the target path, determin the link type.
              */
diff --git a/src/VBox/Runtime/r3/win/thread-win.cpp b/src/VBox/Runtime/r3/win/thread-win.cpp
index dab8cb7..581062e 100644
--- a/src/VBox/Runtime/r3/win/thread-win.cpp
+++ b/src/VBox/Runtime/r3/win/thread-win.cpp
@@ -57,6 +57,7 @@ static DWORD g_dwSelfTLS = TLS_OUT_OF_INDEXES;
 *   Internal Functions                                                         *
 *******************************************************************************/
 static unsigned __stdcall rtThreadNativeMain(void *pvArgs);
+static void rtThreadWinTellDebuggerThreadName(uint32_t idThread, const char *pszName);
 
 
 DECLHIDDEN(int) rtThreadNativeInit(void)
@@ -106,10 +107,48 @@ DECLHIDDEN(int) rtThreadNativeAdopt(PRTTHREADINT pThread)
 {
     if (!TlsSetValue(g_dwSelfTLS, pThread))
         return VERR_FAILED_TO_SET_SELF_TLS;
+    if (IsDebuggerPresent())
+        rtThreadWinTellDebuggerThreadName(GetCurrentThreadId(), pThread->szName);
     return VINF_SUCCESS;
 }
 
 
+DECLHIDDEN(void) rtThreadNativeInformDebugger(PRTTHREADINT pThread)
+{
+    rtThreadWinTellDebuggerThreadName((uint32_t)(uintptr_t)pThread->Core.Key, pThread->szName);
+}
+
+
+/**
+ * Communicates the thread name to the debugger, if we're begin debugged that
+ * is.
+ *
+ * See http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx for debugger
+ * interface details.
+ *
+ * @param   idThread        The thread ID. UINT32_MAX for current thread.
+ * @param   pszName         The name.
+ */
+static void rtThreadWinTellDebuggerThreadName(uint32_t idThread, const char *pszName)
+{
+    struct
+    {
+        uint32_t    uType;
+        const char *pszName;
+        uint32_t    idThread;
+        uint32_t    fFlags;
+    } Pkg = { 0x1000, pszName, idThread, 0 };
+    __try
+    {
+        RaiseException(0x406d1388, 0, sizeof(Pkg)/sizeof(ULONG_PTR), (ULONG_PTR *)&Pkg);
+    }
+    __except(EXCEPTION_CONTINUE_EXECUTION)
+    {
+
+    }
+}
+
+
 /**
  * Bitch about dangling COM and OLE references, dispose of them
  * afterwards so we don't end up deadlocked somewhere below
@@ -207,6 +246,8 @@ static unsigned __stdcall rtThreadNativeMain(void *pvArgs)
 
     if (!TlsSetValue(g_dwSelfTLS, pThread))
         AssertReleaseMsgFailed(("failed to set self TLS. lasterr=%d thread '%s'\n", GetLastError(), pThread->szName));
+    if (IsDebuggerPresent())
+        rtThreadWinTellDebuggerThreadName(dwThreadId, &pThread->szName[0]);
 
     int rc = rtThreadMain(pThread, dwThreadId, &pThread->szName[0]);
 
diff --git a/src/VBox/Runtime/r3/win/time-win.cpp b/src/VBox/Runtime/r3/win/time-win.cpp
index 44dea14..d5517bd 100644
--- a/src/VBox/Runtime/r3/win/time-win.cpp
+++ b/src/VBox/Runtime/r3/win/time-win.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -78,7 +78,7 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     /*
      * This would work if it didn't flip over every 49 (or so) days.
      */
-    return (uint64_t)GetTickCount() * (uint64_t)1000000;
+    return (uint64_t)GetTickCount() * RT_NS_1MS_64;
 
 #elif defined USE_PERFORMANCE_COUNTER
     /*
@@ -89,7 +89,7 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     if (!llFreq.QuadPart)
     {
         if (!QueryPerformanceFrequency(&llFreq))
-            return (uint64_t)GetTickCount() * (uint64_t)1000000;
+            return (uint64_t)GetTickCount() * RT_NS_1MS_64;
         llFreq.QuadPart /=    1000;
         uMult            = 1000000;     /* no math genius, but this seemed to help avoiding floating point. */
     }
@@ -97,7 +97,7 @@ DECLINLINE(uint64_t) rtTimeGetSystemNanoTS(void)
     LARGE_INTEGER   ll;
     if (QueryPerformanceCounter(&ll))
         return (ll.QuadPart * uMult) / llFreq.QuadPart;
-    return (uint64_t)GetTickCount() * (uint64_t)1000000;
+    return (uint64_t)GetTickCount() * RT_NS_1MS_64;
 
 #elif defined USE_FILE_TIME
     /*
@@ -148,7 +148,7 @@ RTDECL(uint64_t) RTTimeSystemNanoTS(void)
 
 RTDECL(uint64_t) RTTimeSystemMilliTS(void)
 {
-    return rtTimeGetSystemNanoTS() / 1000000;
+    return rtTimeGetSystemNanoTS() / RT_NS_1MS;
 }
 
 
@@ -161,19 +161,6 @@ RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)
 }
 
 
-RTDECL(int) RTTimeSet(PCRTTIMESPEC pTime)
-{
-    FILETIME    FileTime;
-    SYSTEMTIME  SysTime;
-    if (FileTimeToSystemTime(RTTimeSpecGetNtFileTime(pTime, &FileTime), &SysTime))
-    {
-        if (SetSystemTime(&SysTime))
-            return VINF_SUCCESS;
-    }
-    return RTErrConvertFromWin32(GetLastError());
-}
-
-
 RTDECL(PRTTIMESPEC) RTTimeLocalNow(PRTTIMESPEC pTime)
 {
     uint64_t u64;
@@ -195,47 +182,7 @@ RTDECL(int64_t) RTTimeLocalDeltaNano(void)
     TIME_ZONE_INFORMATION Tzi;
     Tzi.Bias = 0;
     if (GetTimeZoneInformation(&Tzi) != TIME_ZONE_ID_INVALID)
-        return -(int64_t)Tzi.Bias * 60*1000*1000*1000;
+        return -(int64_t)Tzi.Bias * 60 * RT_NS_1SEC_64;
     return 0;
 }
 
-
-RTDECL(PRTTIME) RTTimeLocalExplode(PRTTIME pTime, PCRTTIMESPEC pTimeSpec)
-{
-    /*
-     * FileTimeToLocalFileTime does not do the right thing, so we'll have
-     * to convert to system time and SystemTimeToTzSpecificLocalTime instead.
-     */
-    RTTIMESPEC LocalTime;
-    SYSTEMTIME SystemTimeIn;
-    FILETIME FileTime;
-    if (FileTimeToSystemTime(RTTimeSpecGetNtFileTime(pTimeSpec, &FileTime), &SystemTimeIn))
-    {
-        SYSTEMTIME SystemTimeOut;
-        if (SystemTimeToTzSpecificLocalTime(NULL /* use current TZI */,
-                                            &SystemTimeIn,
-                                            &SystemTimeOut))
-        {
-            if (SystemTimeToFileTime(&SystemTimeOut, &FileTime))
-            {
-                RTTimeSpecSetNtFileTime(&LocalTime, &FileTime);
-                pTime = RTTimeExplode(pTime, &LocalTime);
-                if (pTime)
-                    pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL;
-                return pTime;
-            }
-        }
-    }
-
-    /*
-     * The fallback is to use the current offset.
-     * (A better fallback would be to use the offset of the same time of the year.)
-     */
-    LocalTime = *pTimeSpec;
-    RTTimeSpecAddNano(&LocalTime, RTTimeLocalDeltaNano());
-    pTime = RTTimeExplode(pTime, &LocalTime);
-    if (pTime)
-        pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL;
-    return pTime;
-}
-
diff --git a/src/VBox/Runtime/r3/win/time2-win.cpp b/src/VBox/Runtime/r3/win/time2-win.cpp
new file mode 100644
index 0000000..e2372d9
--- /dev/null
+++ b/src/VBox/Runtime/r3/win/time2-win.cpp
@@ -0,0 +1,94 @@
+/* $Id: time2-win.cpp $ */
+/** @file
+ * IPRT - Time, Windows.
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP RTLOGGROUP_TIME
+#include <Windows.h>
+
+#include <iprt/time.h>
+#include "internal/iprt.h"
+
+#include <iprt/assert.h>
+#include <iprt/err.h>
+#include "internal/time.h"
+
+
+
+RTDECL(int) RTTimeSet(PCRTTIMESPEC pTime)
+{
+    FILETIME    FileTime;
+    SYSTEMTIME  SysTime;
+    if (FileTimeToSystemTime(RTTimeSpecGetNtFileTime(pTime, &FileTime), &SysTime))
+    {
+        if (SetSystemTime(&SysTime))
+            return VINF_SUCCESS;
+    }
+    return RTErrConvertFromWin32(GetLastError());
+}
+
+
+RTDECL(PRTTIME) RTTimeLocalExplode(PRTTIME pTime, PCRTTIMESPEC pTimeSpec)
+{
+    /*
+     * FileTimeToLocalFileTime does not do the right thing, so we'll have
+     * to convert to system time and SystemTimeToTzSpecificLocalTime instead.
+     */
+    RTTIMESPEC LocalTime;
+    SYSTEMTIME SystemTimeIn;
+    FILETIME FileTime;
+    if (FileTimeToSystemTime(RTTimeSpecGetNtFileTime(pTimeSpec, &FileTime), &SystemTimeIn))
+    {
+        SYSTEMTIME SystemTimeOut;
+        if (SystemTimeToTzSpecificLocalTime(NULL /* use current TZI */,
+                                            &SystemTimeIn,
+                                            &SystemTimeOut))
+        {
+            if (SystemTimeToFileTime(&SystemTimeOut, &FileTime))
+            {
+                RTTimeSpecSetNtFileTime(&LocalTime, &FileTime);
+                pTime = RTTimeExplode(pTime, &LocalTime);
+                if (pTime)
+                    pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL;
+                return pTime;
+            }
+        }
+    }
+
+    /*
+     * The fallback is to use the current offset.
+     * (A better fallback would be to use the offset of the same time of the year.)
+     */
+    LocalTime = *pTimeSpec;
+    RTTimeSpecAddNano(&LocalTime, RTTimeLocalDeltaNano());
+    pTime = RTTimeExplode(pTime, &LocalTime);
+    if (pTime)
+        pTime->fFlags = (pTime->fFlags & ~RTTIME_FLAGS_TYPE_MASK) | RTTIME_FLAGS_TYPE_LOCAL;
+    return pTime;
+}
+
diff --git a/src/VBox/Runtime/r3/xml.cpp b/src/VBox/Runtime/r3/xml.cpp
index 708e41f..1aa05fa 100644
--- a/src/VBox/Runtime/r3/xml.cpp
+++ b/src/VBox/Runtime/r3/xml.cpp
@@ -185,25 +185,31 @@ File::File(Mode aMode, const char *aFileName, bool aFlushIt /* = false */)
     m->flushOnClose = aFlushIt;
 
     uint32_t flags = 0;
+    const char *pcszMode = "???";
     switch (aMode)
     {
         /** @todo change to RTFILE_O_DENY_WRITE where appropriate. */
         case Mode_Read:
             flags = RTFILE_O_READ      | RTFILE_O_OPEN           | RTFILE_O_DENY_NONE;
+            pcszMode = "reading";
             break;
         case Mode_WriteCreate:      // fail if file exists
             flags = RTFILE_O_WRITE     | RTFILE_O_CREATE         | RTFILE_O_DENY_NONE;
+            pcszMode = "writing";
             break;
         case Mode_Overwrite:        // overwrite if file exists
             flags = RTFILE_O_WRITE     | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_NONE;
+            pcszMode = "overwriting";
             break;
         case Mode_ReadWrite:
-            flags = RTFILE_O_READWRITE | RTFILE_O_OPEN           | RTFILE_O_DENY_NONE;;
+            flags = RTFILE_O_READWRITE | RTFILE_O_OPEN           | RTFILE_O_DENY_NONE;
+            pcszMode = "reading/writing";
+            break;
     }
 
     int vrc = RTFileOpen(&m->handle, aFileName, flags);
     if (RT_FAILURE(vrc))
-        throw EIPRTFailure(vrc, "Runtime error opening '%s' for reading", aFileName);
+        throw EIPRTFailure(vrc, "Runtime error opening '%s' for %s", aFileName, pcszMode);
 
     m->opened = true;
     m->flushOnClose = aFlushIt && (flags & RTFILE_O_ACCESS_MASK) != RTFILE_O_READ;
diff --git a/src/VBox/Runtime/testcase/Makefile.kmk b/src/VBox/Runtime/testcase/Makefile.kmk
index ede8a9f..60b5049 100644
--- a/src/VBox/Runtime/testcase/Makefile.kmk
+++ b/src/VBox/Runtime/testcase/Makefile.kmk
@@ -92,6 +92,8 @@ PROGRAMS += \
 	tstRTMemSafer \
 	tstMove \
 	tstRTMp-1 \
+	tstRTNetIPv4 \
+	tstRTNetIPv6 \
 	tstOnce \
 	tstRTPath \
 	tstRTPipe \
@@ -138,7 +140,8 @@ PROGRAMS += \
 	tstRTCircBuf \
 	tstRTManifest \
 	tstRTUri \
-	tstVector
+	tstVector \
+       tstRTZip
 
 PROGRAMS.win += \
 	tstRTCritSectW32 \
@@ -174,25 +177,29 @@ if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
   	tstRTR0MemUserKernelDriverHardened \
   	tstRTR0SemMutexDriverHardened \
   	tstRTR0TimerDriverHardened \
-  	tstR0ThreadPreemptionDriverHardened
+  	tstRTR0ThreadPreemptionDriverHardened \
+  	tstRTR0ThreadDriverHardened
   DLLS     += \
     	tstRTR0MemUserKernelDriver \
   	tstRTR0SemMutexDriver \
   	tstRTR0TimerDriver \
-  	tstR0ThreadPreemptionDriver
+  	tstRTR0ThreadPreemptionDriver \
+  	tstRTR0ThreadDriver
  else
   PROGRAMS += \
     	tstRTR0MemUserKernelDriver \
   	tstRTR0SemMutexDriver \
   	tstRTR0TimerDriver \
-  	tstR0ThreadPreemptionDriver
+  	tstRTR0ThreadPreemptionDriver \
+  	tstRTR0ThreadDriver
  endif
  SYSMODS += \
  	tstLdrObjR0 \
  	tstRTR0MemUserKernel \
  	tstRTR0SemMutex \
  	tstRTR0Timer \
- 	tstR0ThreadPreemption
+ 	tstRTR0ThreadPreemption \
+ 	tstRTR0Thread
  ifdef VBOX_WITH_RAW_MODE
   SYSMODS += tstLdrObj
  endif
@@ -200,6 +207,7 @@ if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
   PROGRAMS += tstRTR0DbgKrnlInfoDriver
   SYSMODS += tstRTR0DbgKrnlInfo
  endif
+
 endif
 if1of ($(VBOX_LDR_FMT)), lx pe)
  LIBRARIES += \
@@ -367,16 +375,10 @@ ifdef VBOX_WITH_RAW_MODE
  tstLdrObj_LIBS = \
  	$(PATH_STAGE_LIB)/DisasmRC$(VBOX_SUFF_LIB) \
  	$(PATH_STAGE_LIB)/RuntimeRC$(VBOX_SUFF_LIB)
- ifeq ($(VBOX_LDR_FMT32),pe)
- tstLdrObj_LIBS += \
- 	$(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB)
- endif # PE
- ifeq ($(VBOX_LDR_FMT32),elf)
- tstLdrObj_LDFLAGS = -e Entrypoint
- endif
- ifeq ($(VBOX_LDR_FMT32),lx)
+ if1of ($(VBOX_LDR_FMT32),lx pe)
  tstLdrObj_LIBS += \
- 	$(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB)
+ 	$(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB) \
+ 	$(PATH_STAGE_LIB)/VMMRCImp$(VBOX_SUFF_LIB)
  endif
 endif # VBOX_WITH_RAW_MODE
 
@@ -412,9 +414,6 @@ ifeq ($(VBOX_LDR_FMT),pe)
 	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB) \
 	$(TARGET_tstLdr-4Imp)
 endif
-ifeq ($(VBOX_LDR_FMT),elf)
- tstLdrObjR0_LDFLAGS = -e Entrypoint
-endif
 ifeq ($(VBOX_LDR_FMT),lx)
  tstLdrObjR0_LIBS += \
 	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB) \
@@ -469,6 +468,12 @@ tstMove_SOURCES = tstMove.cpp
 tstRTMp-1_TEMPLATE = VBOXR3TSTEXE
 tstRTMp-1_SOURCES = tstRTMp-1.cpp
 
+tstRTNetIPv4_TEMPLATE = VBOXR3TSTEXE
+tstRTNetIPv4_SOURCES = tstRTNetIPv4.cpp
+
+tstRTNetIPv6_TEMPLATE = VBOXR3TSTEXE
+tstRTNetIPv6_SOURCES = tstRTNetIPv6.cpp
+
 tstNoCrt-1_TEMPLATE = VBOXR3TSTEXE
 tstNoCrt-1_DEFS = RT_WITHOUT_NOCRT_WRAPPER_ALIASES
 tstNoCrt-1_SOURCES = \
@@ -641,6 +646,10 @@ tstVector_TEMPLATE = VBOXR3TSTEXE
 tstVector_SOURCES = tstVector.cpp
 
 
+tstRTZip_TEMPLATE = VBOXR3TSTEXE
+tstRTZip_SOURCES = tstRTZip.cpp
+
+
 #
 # Ring-0 testcases.
 #
@@ -710,6 +719,27 @@ endif
 tstRTR0SemMutexDriver_SOURCES = tstRTR0SemMutexDriver.cpp
 
 
+tstRTR0Thread_TEMPLATE = VBoxR0
+tstRTR0Thread_INST = $(INST_TESTCASE)
+tstRTR0Thread_DEFS = IN_RT_R0
+tstRTR0Thread_SYSSUFF = .r0
+tstRTR0Thread_SOURCES = tstRTR0Thread.cpp
+tstRTR0Thread_LIBS = $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
+if1of ($(VBOX_LDR_FMT), pe lx)
+ tstRTR0Thread_LIBS += $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
+endif
+if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "win"
+ tstRTR0ThreadDriverHardened_TEMPLATE = VBoxR3HardenedTstExe
+ tstRTR0ThreadDriverHardened_NAME = tstRTR0ThreadDriver
+ tstRTR0ThreadDriverHardened_DEFS = PROGRAM_NAME_STR=\"tstRTR0ThreadDriver\"
+ tstRTR0ThreadDriverHardened_SOURCES = ../../HostDrivers/Support/SUPR3HardenedMainTemplate.cpp
+ tstRTR0ThreadDriver_TEMPLATE = VBoxR3TstDll
+else
+ tstRTR0ThreadDriver_TEMPLATE = VBOXR3TSTEXE
+endif
+tstRTR0ThreadDriver_SOURCES = tstRTR0ThreadDriver.cpp
+
+
 tstRTR0Timer_TEMPLATE = VBoxR0
 tstRTR0Timer_INST = $(INST_TESTCASE)
 tstRTR0Timer_DEFS = IN_RT_R0
@@ -731,25 +761,25 @@ endif
 tstRTR0TimerDriver_SOURCES = tstRTR0TimerDriver.cpp
 
 
-tstR0ThreadPreemption_TEMPLATE = VBoxR0
-tstR0ThreadPreemption_INST = $(INST_TESTCASE)
-tstR0ThreadPreemption_DEFS = IN_RT_R0
-tstR0ThreadPreemption_SYSSUFF = .r0
-tstR0ThreadPreemption_SOURCES = tstR0ThreadPreemption.cpp
-tstR0ThreadPreemption_LIBS = $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
+tstRTR0ThreadPreemption_TEMPLATE = VBoxR0
+tstRTR0ThreadPreemption_INST = $(INST_TESTCASE)
+tstRTR0ThreadPreemption_DEFS = IN_RT_R0
+tstRTR0ThreadPreemption_SYSSUFF = .r0
+tstRTR0ThreadPreemption_SOURCES = tstRTR0ThreadPreemption.cpp
+tstRTR0ThreadPreemption_LIBS = $(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
 if1of ($(VBOX_LDR_FMT), pe lx)
- tstR0ThreadPreemption_LIBS += $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
+ tstRTR0ThreadPreemption_LIBS += $(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
 endif
 if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "win"
- tstR0ThreadPreemptionDriverHardened_TEMPLATE = VBoxR3HardenedTstExe
- tstR0ThreadPreemptionDriverHardened_NAME = tstR0ThreadPreemptionDriver
- tstR0ThreadPreemptionDriverHardened_DEFS = PROGRAM_NAME_STR=\"tstR0ThreadPreemptionDriver\"
- tstR0ThreadPreemptionDriverHardened_SOURCES = ../../HostDrivers/Support/SUPR3HardenedMainTemplate.cpp
- tstR0ThreadPreemptionDriver_TEMPLATE = VBoxR3TstDll
+ tstRTR0ThreadPreemptionDriverHardened_TEMPLATE = VBoxR3HardenedTstExe
+ tstRTR0ThreadPreemptionDriverHardened_NAME = tstRTR0ThreadPreemptionDriver
+ tstRTR0ThreadPreemptionDriverHardened_DEFS = PROGRAM_NAME_STR=\"tstRTR0ThreadPreemptionDriver\"
+ tstRTR0ThreadPreemptionDriverHardened_SOURCES = ../../HostDrivers/Support/SUPR3HardenedMainTemplate.cpp
+ tstRTR0ThreadPreemptionDriver_TEMPLATE = VBoxR3TstDll
 else
- tstR0ThreadPreemptionDriver_TEMPLATE = VBOXR3TSTEXE
+ tstRTR0ThreadPreemptionDriver_TEMPLATE = VBOXR3TSTEXE
 endif
-tstR0ThreadPreemptionDriver_SOURCES = tstR0ThreadPreemptionDriver.cpp
+tstRTR0ThreadPreemptionDriver_SOURCES = tstRTR0ThreadPreemptionDriver.cpp
 
 
 #
diff --git a/src/VBox/Runtime/testcase/tstDarwinSched.cpp b/src/VBox/Runtime/testcase/tstDarwinSched.cpp
index e6accf6..523a6f6 100644
--- a/src/VBox/Runtime/testcase/tstDarwinSched.cpp
+++ b/src/VBox/Runtime/testcase/tstDarwinSched.cpp
@@ -1,3 +1,29 @@
+/* $Id: tstDarwinSched.cpp $ */
+/** @file
+ * IPRT testcase - darwin scheduling.
+ */
+
+/*
+ * Copyright (C) 2009-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
 
 /*******************************************************************************
 *   Header Files                                                               *
diff --git a/src/VBox/Runtime/testcase/tstHandleTable.cpp b/src/VBox/Runtime/testcase/tstHandleTable.cpp
index 1759ca0..27833f2 100644
--- a/src/VBox/Runtime/testcase/tstHandleTable.cpp
+++ b/src/VBox/Runtime/testcase/tstHandleTable.cpp
@@ -487,7 +487,7 @@ int main(int argc, char **argv)
                 return 1;
 
             case 'V':
-                RTPrintf("$Revision: 92648 $\n");
+                RTPrintf("$Revision: 92645 $\n");
                 return 0;
 
             default:
diff --git a/src/VBox/Runtime/testcase/tstLdr-3.cpp b/src/VBox/Runtime/testcase/tstLdr-3.cpp
index 90856bf..02a9c84 100644
--- a/src/VBox/Runtime/testcase/tstLdr-3.cpp
+++ b/src/VBox/Runtime/testcase/tstLdr-3.cpp
@@ -174,6 +174,11 @@ static bool MyDisBlock(DISCPUMODE enmCpuMode, RTHCUINTPTR pvCodeBlock, int32_t c
         if (RT_FAILURE(rc))
             return false;
 
+        TESTNEARSYM NearSym;
+        rc = FindNearSymbol(uNearAddr + i, &NearSym);
+        if (RT_SUCCESS(rc) && NearSym.aSyms[0].Value == NearSym.Addr)
+            RTPrintf("%s:\n", NearSym.aSyms[0].szName);
+
         DISFormatYasmEx(&Cpu, szOutput, sizeof(szOutput),
                         DIS_FMT_FLAGS_RELATIVE_BRANCH | DIS_FMT_FLAGS_BYTES_RIGHT | DIS_FMT_FLAGS_ADDR_LEFT  | DIS_FMT_FLAGS_BYTES_SPACED,
                         MyGetSymbol, NULL);
diff --git a/src/VBox/Runtime/testcase/tstPrfRT.cpp b/src/VBox/Runtime/testcase/tstPrfRT.cpp
index 05a0883..5cff5f3 100644
--- a/src/VBox/Runtime/testcase/tstPrfRT.cpp
+++ b/src/VBox/Runtime/testcase/tstPrfRT.cpp
@@ -43,7 +43,9 @@ void PrintResult(uint64_t u64Ticks, uint64_t u64MaxTicks, uint64_t u64MinTicks,
 }
 
 # define ITERATE(preexpr, expr, postexpr, cIterations) \
-    for (i = 0, u64TotalTS = 0, u64MinTS = ~0, u64MaxTS = 0; i < (cIterations); i++) \
+    AssertCompile(((cIterations) % 8) == 0); \
+    /* Min and max value. */ \
+    for (i = 0, u64MinTS = ~0, u64MaxTS = 0; i < (cIterations); i++) \
     { \
         { preexpr } \
         uint64_t u64StartTS = ASMReadTSC(); \
@@ -59,7 +61,28 @@ void PrintResult(uint64_t u64Ticks, uint64_t u64MaxTicks, uint64_t u64MinTicks,
             u64MinTS = u64ElapsedTS; \
         if (u64ElapsedTS > u64MaxTS) \
             u64MaxTS = u64ElapsedTS; \
-        u64TotalTS += u64ElapsedTS; \
+    } \
+    { \
+        /* Calculate a good average value (may be smaller than min). */ \
+        i = (cIterations); \
+        AssertRelease((i % 8) == 0); \
+        { preexpr } \
+        uint64_t u64StartTS = ASMReadTSC(); \
+        while (i != 0) \
+        { \
+            { expr } \
+            { expr } \
+            { expr } \
+            { expr } \
+            { expr } \
+            { expr } \
+            { expr } \
+            { expr } \
+            i -= 8; \
+        } \
+        u64TotalTS = ASMReadTSC() - u64StartTS; \
+        { postexpr } \
+        i = (cIterations); \
     }
 
 #else  /* !AMD64 && !X86 */
@@ -93,20 +116,20 @@ void PrintResult(uint64_t cNs, uint64_t cNsMax, uint64_t cNsMin, unsigned cTimes
 #endif /* !AMD64 && !X86 */
 
 
-int main()
+int main(int argc, char **argv)
 {
     uint64_t    u64TotalTS;
     uint64_t    u64MinTS;
     uint64_t    u64MaxTS;
     unsigned    i;
 
-    RTR3InitExeNoArguments(0);
+    RTR3InitExeNoArguments(argc == 2 ? RTR3INIT_FLAGS_SUPLIB : 0);
     RTPrintf("tstPrfRT: TESTING...\n");
 
     /*
      * RTTimeNanoTS, RTTimeProgramNanoTS, RTTimeMilliTS, and RTTimeProgramMilliTS.
      */
-    ITERATE(RT_NOTHING, RTTimeNanoTS();, RT_NOTHING, 1000000);
+    ITERATE(RT_NOTHING, RTTimeNanoTS();, RT_NOTHING, _1M * 32);
     PrintResult(u64TotalTS, u64MaxTS, u64MinTS, i, "RTTimeNanoTS");
 
     ITERATE(RT_NOTHING, RTTimeProgramNanoTS();, RT_NOTHING, 1000000);
diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp
deleted file mode 100644
index 85b6666..0000000
--- a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp
+++ /dev/null
@@ -1,457 +0,0 @@
-/* $Id: tstR0ThreadPreemption.cpp $ */
-/** @file
- * IPRT R0 Testcase - Thread Preemption.
- */
-
-/*
- * Copyright (C) 2009-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#include <iprt/thread.h>
-
-#include <iprt/asm-amd64-x86.h>
-#include <iprt/err.h>
-#include <iprt/mem.h>
-#include <iprt/time.h>
-#include <iprt/string.h>
-#include <VBox/sup.h>
-#include "tstR0ThreadPreemption.h"
-
-
-#define TSTRTR0THREADCTXDATA_MAGIC      0xc01a50da
-
-/**
- * Thread-context hook data.
- */
-typedef struct TSTRTR0THREADCTXDATA
-{
-    uint32_t volatile   u32Magic;
-    RTCPUID             uSourceCpuId;
-    RTNATIVETHREAD      hSourceThread;
-    RTTHREADCTX         hThreadCtx;
-
-    /* For RTTHREADCTXEVENT_PREEMPTING. */
-    bool                fPreemptingSuccess;
-    volatile bool       fPreemptingInvoked;
-
-    /* For RTTHREADCTXEVENT_RESUMED. */
-    bool                fResumedSuccess;
-    volatile bool       fResumedInvoked;
-
-    char                achResult[512];
-} TSTRTR0THREADCTXDATA, *PTSTRTR0THREADCTXDATA;
-
-
-/**
- * Thread-context hook function.
- *
- * @param   enmEvent    The thread-context event.
- * @param   pvUser      Pointer to the user argument.
- */
-static DECLCALLBACK(void) tstR0ThreadCtxHook(RTTHREADCTXEVENT enmEvent, void *pvUser)
-{
-    PTSTRTR0THREADCTXDATA pData = (PTSTRTR0THREADCTXDATA)pvUser;
-    AssertPtrReturnVoid(pData);
-
-    if (pData->u32Magic != TSTRTR0THREADCTXDATA_MAGIC)
-    {
-        RTStrPrintf(pData->achResult, sizeof(pData->achResult), "!tstR0ThreadCtxHook: Invalid magic.");
-        return;
-    }
-
-    switch (enmEvent)
-    {
-        case RTTHREADCTXEVENT_PREEMPTING:
-        {
-            ASMAtomicWriteBool(&pData->fPreemptingInvoked, true);
-
-            /* We've already been called once, we now might very well be on another CPU. Nothing to do here. */
-            if (pData->fPreemptingSuccess)
-                return;
-
-            if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
-            {
-                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
-                            "!tstR0ThreadCtxHook[RTTHREADCTXEVENT_PREEMPTING]: Called with preemption enabled");
-                break;
-            }
-
-            RTNATIVETHREAD hCurrentThread = RTThreadNativeSelf();
-            if (pData->hSourceThread != hCurrentThread)
-            {
-                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
-                            "!tstR0ThreadCtxHook[RTTHREADCTXEVENT_PREEMPTING]: Thread switched! Source=%RTnthrd Current=%RTnthrd.",
-                            pData->hSourceThread, hCurrentThread);
-                break;
-            }
-
-            RTCPUID uCurrentCpuId = RTMpCpuId();
-            if (pData->uSourceCpuId != uCurrentCpuId)
-            {
-                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
-                            "!tstR0ThreadCtxHook[RTTHREADCTXEVENT_PREEMPTING]: migrated uSourceCpuId=%RU32 uCurrentCpuId=%RU32",
-                            pData->uSourceCpuId, uCurrentCpuId);
-                break;
-            }
-
-            pData->fPreemptingSuccess = true;
-            break;
-        }
-
-        case RTTHREADCTXEVENT_RESUMED:
-        {
-            ASMAtomicWriteBool(&pData->fResumedInvoked, true);
-
-            /* We've already been called once successfully, nothing more to do. */
-            if (ASMAtomicReadBool(&pData->fResumedSuccess))
-                return;
-
-            if (!pData->fPreemptingSuccess)
-            {
-                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
-                            "!tstR0ThreadCtxHook[RTTHREADCTXEVENT_RESUMED]: Called before preempting callback was invoked.");
-                break;
-            }
-
-            RTNATIVETHREAD hCurrentThread = RTThreadNativeSelf();
-            if (pData->hSourceThread != hCurrentThread)
-            {
-                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
-                            "!tstR0ThreadCtxHook[RTTHREADCTXEVENT_RESUMED]: Thread switched! Source=%RTnthrd Current=%RTnthrd.",
-                            pData->hSourceThread, hCurrentThread);
-                break;
-            }
-
-            ASMAtomicWriteBool(&pData->fResumedSuccess, true);
-            break;
-        }
-
-        default:
-            AssertMsgFailed(("Invalid event %#x\n", enmEvent));
-            break;
-    }
-}
-
-
-/**
- * Service request callback function.
- *
- * @returns VBox status code.
- * @param   pSession    The caller's session.
- * @param   u64Arg      64-bit integer argument.
- * @param   pReqHdr     The request header. Input / Output. Optional.
- */
-DECLEXPORT(int) TSTR0ThreadPreemptionSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation,
-                                                   uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr)
-{
-    NOREF(pSession);
-    if (u64Arg)
-        return VERR_INVALID_PARAMETER;
-    if (!VALID_PTR(pReqHdr))
-        return VERR_INVALID_PARAMETER;
-    char   *pszErr = (char *)(pReqHdr + 1);
-    size_t  cchErr = pReqHdr->cbReq - sizeof(*pReqHdr);
-    if (cchErr < 32 || cchErr >= 0x10000)
-        return VERR_INVALID_PARAMETER;
-    *pszErr = '\0';
-
-    /*
-     * The big switch.
-     */
-    switch (uOperation)
-    {
-        case TSTR0THREADPREMEPTION_SANITY_OK:
-            break;
-
-        case TSTR0THREADPREMEPTION_SANITY_FAILURE:
-            RTStrPrintf(pszErr, cchErr, "!42failure42%1024s", "");
-            break;
-
-        case TSTR0THREADPREMEPTION_BASIC:
-        {
-            if (!ASMIntAreEnabled())
-                RTStrPrintf(pszErr, cchErr, "!Interrupts disabled");
-            else if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
-                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns false by default");
-            else
-            {
-                RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER;
-                RTThreadPreemptDisable(&State);
-                if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
-                    RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after RTThreadPreemptDisable");
-                else if (!ASMIntAreEnabled())
-                    RTStrPrintf(pszErr, cchErr, "!Interrupts disabled");
-                RTThreadPreemptRestore(&State);
-            }
-            break;
-        }
-
-        case TSTR0THREADPREMEPTION_IS_TRUSTY:
-            if (!RTThreadPreemptIsPendingTrusty())
-                RTStrPrintf(pszErr, cchErr, "!Untrusty");
-            break;
-
-        case TSTR0THREADPREMEPTION_IS_PENDING:
-        {
-            RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER;
-            RTThreadPreemptDisable(&State);
-            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
-            {
-#ifdef RT_OS_DARWIN
-                uint64_t const cNsMax = UINT64_C(8)*1000U*1000U*1000U;
-#else
-                uint64_t const cNsMax = UINT64_C(2)*1000U*1000U*1000U;
-#endif
-                if (ASMIntAreEnabled())
-                {
-                    uint64_t    u64StartTS    = RTTimeNanoTS();
-                    uint64_t    u64StartSysTS = RTTimeSystemNanoTS();
-                    uint64_t    cLoops        = 0;
-                    uint64_t    cNanosSysElapsed;
-                    uint64_t    cNanosElapsed;
-                    bool        fPending;
-                    do
-                    {
-                        fPending         = RTThreadPreemptIsPending(NIL_RTTHREAD);
-                        cNanosElapsed    = RTTimeNanoTS()       - u64StartTS;
-                        cNanosSysElapsed = RTTimeSystemNanoTS() - u64StartSysTS;
-                        cLoops++;
-                    } while (   !fPending
-                             && cNanosElapsed    < cNsMax
-                             && cNanosSysElapsed < cNsMax
-                             && cLoops           < 100U*_1M);
-                    if (!fPending)
-                        RTStrPrintf(pszErr, cchErr, "!Preempt not pending after %'llu loops / %'llu ns / %'llu ns (sys)",
-                                    cLoops, cNanosElapsed, cNanosSysElapsed);
-                    else if (cLoops == 1)
-                        RTStrPrintf(pszErr, cchErr, "!cLoops=1\n");
-                    else
-                        RTStrPrintf(pszErr, cchErr, "RTThreadPreemptIsPending returned true after %'llu loops / %'llu ns / %'llu ns (sys)",
-                                    cLoops, cNanosElapsed, cNanosSysElapsed);
-                }
-                else
-                    RTStrPrintf(pszErr, cchErr, "!Interrupts disabled");
-            }
-            else
-                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after RTThreadPreemptDisable");
-            RTThreadPreemptRestore(&State);
-            break;
-        }
-
-        case TSTR0THREADPREMEPTION_NESTED:
-        {
-            bool const fDefault = RTThreadPreemptIsEnabled(NIL_RTTHREAD);
-            RTTHREADPREEMPTSTATE State1 = RTTHREADPREEMPTSTATE_INITIALIZER;
-            RTThreadPreemptDisable(&State1);
-            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
-            {
-                RTTHREADPREEMPTSTATE State2 = RTTHREADPREEMPTSTATE_INITIALIZER;
-                RTThreadPreemptDisable(&State2);
-                if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
-                {
-                    RTTHREADPREEMPTSTATE State3 = RTTHREADPREEMPTSTATE_INITIALIZER;
-                    RTThreadPreemptDisable(&State3);
-                    if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
-                        RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 3rd RTThreadPreemptDisable");
-
-                    RTThreadPreemptRestore(&State3);
-                    if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)
-                        RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptRestore");
-                }
-                else
-                    RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 2nd RTThreadPreemptDisable");
-
-                RTThreadPreemptRestore(&State2);
-                if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)
-                    RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 2nd RTThreadPreemptRestore");
-            }
-            else
-                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptDisable");
-            RTThreadPreemptRestore(&State1);
-            if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) != fDefault && !*pszErr)
-                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns false after 3rd RTThreadPreemptRestore");
-            break;
-        }
-
-        case TSTR0THREADPREEMPTION_CTXHOOKS:
-        {
-            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
-            {
-                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksCreate must be called with preemption enabled");
-                break;
-            }
-
-            bool fRegistered = RTThreadCtxHooksAreRegistered(NIL_RTTHREADCTX);
-            if (fRegistered)
-            {
-                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksAreRegistered returns true before creating any hooks");
-                break;
-            }
-
-            RTTHREADCTX hThreadCtx;
-            int rc = RTThreadCtxHooksCreate(&hThreadCtx);
-            if (RT_FAILURE(rc))
-            {
-                if (rc == VERR_NOT_SUPPORTED)
-                    RTStrPrintf(pszErr, cchErr, "RTThreadCtxHooksCreate returns VERR_NOT_SUPPORTED");
-                else
-                    RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksCreate returns %Rrc", rc);
-                break;
-            }
-
-            fRegistered = RTThreadCtxHooksAreRegistered(hThreadCtx);
-            if (fRegistered)
-            {
-                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksAreRegistered returns true before registering any hooks");
-                RTThreadCtxHooksRelease(hThreadCtx);
-                break;
-            }
-
-            PTSTRTR0THREADCTXDATA pCtxData = (PTSTRTR0THREADCTXDATA)RTMemAllocZ(sizeof(*pCtxData));
-            AssertReturn(pCtxData, VERR_NO_MEMORY);
-            pCtxData->u32Magic           = TSTRTR0THREADCTXDATA_MAGIC;
-            pCtxData->hThreadCtx         = hThreadCtx;
-            pCtxData->fPreemptingSuccess = false;
-            pCtxData->fPreemptingInvoked = false;
-            pCtxData->fResumedInvoked    = false;
-            pCtxData->fResumedSuccess    = false;
-            pCtxData->hSourceThread      = RTThreadNativeSelf();
-            RT_ZERO(pCtxData->achResult);
-
-            RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
-            RTThreadPreemptDisable(&PreemptState);
-            Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-
-            pCtxData->uSourceCpuId       = RTMpCpuId();
-
-            rc = RTThreadCtxHooksRegister(hThreadCtx, &tstR0ThreadCtxHook, pCtxData);
-            if (RT_FAILURE(rc))
-            {
-                RTThreadPreemptRestore(&PreemptState);
-                RTMemFree(pCtxData);
-                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksRegister returns %Rrc", rc);
-                break;
-            }
-
-            fRegistered = RTThreadCtxHooksAreRegistered(hThreadCtx);
-            if (!fRegistered)
-            {
-                RTThreadPreemptRestore(&PreemptState);
-                RTMemFree(pCtxData);
-                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksAreRegistered return false when hooks are supposedly registered");
-                break;
-            }
-
-            RTThreadPreemptRestore(&PreemptState);
-
-            /* Check if the preempting callback has/will been invoked. */
-            const uint32_t  cMsTimeout           = 10000;
-            const uint32_t  cMsSleepGranularity  = 50;
-            uint32_t        cMsSlept             = 0;
-            RTCPUID         uCurrentCpuId        = NIL_RTCPUID;
-            for (;;)
-            {
-                RTThreadYield();
-                RTThreadPreemptDisable(&PreemptState);
-                uCurrentCpuId = RTMpCpuId();
-                RTThreadPreemptRestore(&PreemptState);
-
-                if (   pCtxData->uSourceCpuId != uCurrentCpuId
-                    || cMsSlept >= cMsTimeout)
-                {
-                    break;
-                }
-
-                RTThreadSleep(cMsSleepGranularity);
-                cMsSlept += cMsSleepGranularity;
-            }
-
-            if (!ASMAtomicReadBool(&pCtxData->fPreemptingInvoked))
-            {
-                if (pCtxData->uSourceCpuId != uCurrentCpuId)
-                {
-                    RTStrPrintf(pszErr, cchErr,
-                                "!tstR0ThreadCtxHooks[RTTHREADCTXEVENT_PREEMPTING] not invoked before migrating from CPU %RU32 to %RU32",
-                                pCtxData->uSourceCpuId, uCurrentCpuId);
-                }
-                else
-                {
-                    RTStrPrintf(pszErr, cchErr, "!tstR0ThreadCtxHooks[RTTHREADCTXEVENT_PREEMPTING] not invoked after ca. %u ms",
-                                cMsSlept);
-                }
-            }
-            else if (!pCtxData->fPreemptingSuccess)
-                RTStrCopy(pszErr, cchErr, pCtxData->achResult);
-            else
-            {
-                /* Preempting callback succeeded, now check if the resumed callback has/will been invoked. */
-                cMsSlept = 0;
-                for (;;)
-                {
-                    if (   ASMAtomicReadBool(&pCtxData->fResumedInvoked)
-                        || cMsSlept >= cMsTimeout)
-                    {
-                        break;
-                    }
-
-                    RTThreadSleep(cMsSleepGranularity);
-                    cMsSlept += cMsSleepGranularity;
-                }
-
-                if (!ASMAtomicReadBool(&pCtxData->fResumedInvoked))
-                {
-                    RTStrPrintf(pszErr, cchErr, "!tstR0ThreadCtxHooks[RTTHREADCTXEVENT_RESUMED] not invoked after ca. %u ms",
-                                cMsSlept);
-                }
-                else if (!pCtxData->fResumedSuccess)
-                    RTStrCopy(pszErr, cchErr, pCtxData->achResult);
-            }
-
-            RTThreadCtxHooksDeregister(hThreadCtx);
-
-            fRegistered = RTThreadCtxHooksAreRegistered(hThreadCtx);
-            if (fRegistered)
-            {
-                RTMemFree(pCtxData);
-                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksAreRegistered return true when hooks are deregistered");
-                break;
-            }
-
-            Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-            uint32_t cRefs = RTThreadCtxHooksRelease(hThreadCtx);
-            if (cRefs == UINT32_MAX)
-                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksRelease returns invalid cRefs!");
-
-            RTMemFree(pCtxData);
-            break;
-        }
-
-        default:
-            RTStrPrintf(pszErr, cchErr, "!Unknown test #%d", uOperation);
-            break;
-    }
-
-    /* The error indicator is the '!' in the message buffer. */
-    return VINF_SUCCESS;
-}
-
diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h b/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h
deleted file mode 100644
index a6e716b..0000000
--- a/src/VBox/Runtime/testcase/tstR0ThreadPreemption.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $Id: tstR0ThreadPreemption.h $ */
-/** @file
- * IPRT R0 Testcase - Thread Preemption, common header.
- */
-
-/*
- * Copyright (C) 2009-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-#ifdef IN_RING0
-RT_C_DECLS_BEGIN
-DECLEXPORT(int) TSTR0ThreadPreemptionSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation,
-                                                   uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr);
-RT_C_DECLS_END
-#endif
-
-typedef enum TSTR0THREADPREMEPTION
-{
-    TSTR0THREADPREMEPTION_SANITY_OK = 1,
-    TSTR0THREADPREMEPTION_SANITY_FAILURE,
-    TSTR0THREADPREMEPTION_BASIC,
-    TSTR0THREADPREMEPTION_IS_TRUSTY,
-    TSTR0THREADPREMEPTION_IS_PENDING,
-    TSTR0THREADPREMEPTION_NESTED,
-    TSTR0THREADPREEMPTION_CTXHOOKS
-} TSTR0THREADPREMEPTION;
-
diff --git a/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp b/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp
deleted file mode 100644
index e88913d..0000000
--- a/src/VBox/Runtime/testcase/tstR0ThreadPreemptionDriver.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/* $Id: tstR0ThreadPreemptionDriver.cpp $ */
-/** @file
- * IPRT R0 Testcase - Thread Preemption, driver program.
- */
-
-/*
- * Copyright (C) 2009-2013 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- *
- * The contents of this file may alternatively be used under the terms
- * of the Common Development and Distribution License Version 1.0
- * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
- * VirtualBox OSE distribution, in which case the provisions of the
- * CDDL are applicable instead of those of the GPL.
- *
- * You may elect to license modified versions of this file under the
- * terms and conditions of either the GPL or the CDDL or both.
- */
-
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
-#include <iprt/initterm.h>
-
-#include <iprt/asm.h>
-#include <iprt/cpuset.h>
-#include <iprt/err.h>
-#include <iprt/path.h>
-#include <iprt/param.h>
-#include <iprt/stream.h>
-#include <iprt/string.h>
-#include <iprt/test.h>
-#include <iprt/time.h>
-#include <iprt/thread.h>
-#ifdef VBOX
-# include <VBox/sup.h>
-# include "tstR0ThreadPreemption.h"
-#endif
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
-static bool volatile g_fTerminate = false;
-
-
-/**
- * Try make sure all online CPUs will be engaged.
- */
-static DECLCALLBACK(int) MyThreadProc(RTTHREAD hSelf, void *pvCpuIdx)
-{
-    RTCPUSET Affinity;
-    RTCpuSetEmpty(&Affinity);
-    RTCpuSetAddByIndex(&Affinity, (intptr_t)pvCpuIdx);
-    RTThreadSetAffinity(&Affinity); /* ignore return code as it's not supported on all hosts. */
-
-    while (!g_fTerminate)
-    {
-        uint64_t tsStart = RTTimeMilliTS();
-        do
-        {
-            ASMNopPause();
-        } while (RTTimeMilliTS() - tsStart < 8);
-        RTThreadSleep(4);
-    }
-
-    return VINF_SUCCESS;
-}
-
-
-/**
- *  Entry point.
- */
-extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
-{
-#ifndef VBOX
-    RTPrintf("tstSup: SKIPPED\n");
-    return 0;
-#else
-    /*
-     * Init.
-     */
-    RTTEST hTest;
-    int rc = RTTestInitAndCreate("tstR0ThreadPreemption", &hTest);
-    if (rc)
-        return rc;
-    RTTestBanner(hTest);
-
-    PSUPDRVSESSION pSession;
-    rc = SUPR3Init(&pSession);
-    if (RT_FAILURE(rc))
-    {
-        RTTestFailed(hTest, "SUPR3Init failed with rc=%Rrc\n", rc);
-        return RTTestSummaryAndDestroy(hTest);
-    }
-
-    char szPath[RTPATH_MAX];
-    rc = RTPathExecDir(szPath, sizeof(szPath));
-    if (RT_SUCCESS(rc))
-        rc = RTPathAppend(szPath, sizeof(szPath), "tstR0ThreadPreemption.r0");
-    if (RT_FAILURE(rc))
-    {
-        RTTestFailed(hTest, "Failed constructing .r0 filename (rc=%Rrc)", rc);
-        return RTTestSummaryAndDestroy(hTest);
-    }
-
-    void *pvImageBase;
-    rc = SUPR3LoadServiceModule(szPath, "tstR0ThreadPreemption",
-                                "TSTR0ThreadPreemptionSrvReqHandler",
-                                &pvImageBase);
-    if (RT_FAILURE(rc))
-    {
-        RTTestFailed(hTest, "SUPR3LoadServiceModule(%s,,,) failed with rc=%Rrc\n", szPath, rc);
-        return RTTestSummaryAndDestroy(hTest);
-    }
-
-    /* test request */
-    struct
-    {
-        SUPR0SERVICEREQHDR  Hdr;
-        char                szMsg[256];
-    } Req;
-
-    /*
-     * Sanity checks.
-     */
-    RTTestSub(hTest, "Sanity");
-    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
-    Req.Hdr.cbReq = sizeof(Req);
-    Req.szMsg[0] = '\0';
-    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
-                                             TSTR0THREADPREMEPTION_SANITY_OK, 0, &Req.Hdr), VINF_SUCCESS);
-    if (RT_FAILURE(rc))
-        return RTTestSummaryAndDestroy(hTest);
-    RTTESTI_CHECK_MSG(Req.szMsg[0] == '\0', ("%s", Req.szMsg));
-    if (Req.szMsg[0] != '\0')
-        return RTTestSummaryAndDestroy(hTest);
-
-    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
-    Req.Hdr.cbReq = sizeof(Req);
-    Req.szMsg[0] = '\0';
-    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
-                                             TSTR0THREADPREMEPTION_SANITY_FAILURE, 0, &Req.Hdr), VINF_SUCCESS);
-    if (RT_FAILURE(rc))
-        return RTTestSummaryAndDestroy(hTest);
-    RTTESTI_CHECK_MSG(!strncmp(Req.szMsg, RT_STR_TUPLE("!42failure42")), ("%s", Req.szMsg));
-    if (strncmp(Req.szMsg, RT_STR_TUPLE("!42failure42")))
-        return RTTestSummaryAndDestroy(hTest);
-
-    /*
-     * Basic tests, bail out on failure.
-     */
-    RTTestSub(hTest, "Basics");
-    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
-    Req.Hdr.cbReq = sizeof(Req);
-    Req.szMsg[0] = '\0';
-    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
-                                             TSTR0THREADPREMEPTION_BASIC, 0, &Req.Hdr), VINF_SUCCESS);
-    if (RT_FAILURE(rc))
-        return RTTestSummaryAndDestroy(hTest);
-    if (Req.szMsg[0] == '!')
-    {
-        RTTestIFailed("%s", &Req.szMsg[1]);
-        return RTTestSummaryAndDestroy(hTest);
-    }
-    if (Req.szMsg[0])
-        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
-
-    /*
-     * Is it trusty.
-     */
-    RTTestSub(hTest, "RTThreadPreemptIsPendingTrusty");
-    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
-    Req.Hdr.cbReq = sizeof(Req);
-    Req.szMsg[0] = '\0';
-    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
-                                             TSTR0THREADPREMEPTION_IS_TRUSTY, 0, &Req.Hdr), VINF_SUCCESS);
-    if (RT_FAILURE(rc))
-        return RTTestSummaryAndDestroy(hTest);
-    if (Req.szMsg[0] == '!')
-        RTTestIFailed("%s", &Req.szMsg[1]);
-    else if (Req.szMsg[0])
-        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
-
-    /*
-     * Stay in ring-0 until preemption is pending.
-     */
-    RTTHREAD ahThreads[RTCPUSET_MAX_CPUS];
-    uint32_t cThreads = RTMpGetCount();
-    RTCPUSET OnlineSet;
-    RTMpGetOnlineSet(&OnlineSet);
-    for (uint32_t i = 0; i < RT_ELEMENTS(ahThreads); i++)
-    {
-        ahThreads[i] = NIL_RTTHREAD;
-        if (RTCpuSetIsMemberByIndex(&OnlineSet, i))
-            RTThreadCreateF(&ahThreads[i], MyThreadProc, (void *)(uintptr_t)i, 0, RTTHREADTYPE_DEFAULT,
-                            RTTHREADFLAGS_WAITABLE, "cpu=%u", i);
-    }
-
-
-    RTTestSub(hTest, "Pending Preemption");
-    RTThreadSleep(250); /** @todo fix GIP initialization? */
-    for (int i = 0; ; i++)
-    {
-        Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
-        Req.Hdr.cbReq = sizeof(Req);
-        Req.szMsg[0] = '\0';
-        RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
-                                                 TSTR0THREADPREMEPTION_IS_PENDING, 0, &Req.Hdr), VINF_SUCCESS);
-        if (    strcmp(Req.szMsg, "!cLoops=1\n")
-            ||  i >= 64)
-        {
-            if (Req.szMsg[0] == '!')
-                RTTestIFailed("%s", &Req.szMsg[1]);
-            else if (Req.szMsg[0])
-                RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
-            break;
-        }
-        if ((i % 3) == 0)
-            RTThreadYield();
-        else if ((i % 16) == 0)
-            RTThreadSleep(8);
-    }
-
-    ASMAtomicWriteBool(&g_fTerminate, true);
-    for (uint32_t i = 0; i < RT_ELEMENTS(ahThreads); i++)
-        if (ahThreads[i] != NIL_RTTHREAD)
-            RTThreadWait(ahThreads[i], 5000, NULL);
-
-    /*
-     * Test nested RTThreadPreemptDisable calls.
-     */
-    RTTestSub(hTest, "Nested");
-    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
-    Req.Hdr.cbReq = sizeof(Req);
-    Req.szMsg[0] = '\0';
-    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
-                                             TSTR0THREADPREMEPTION_NESTED, 0, &Req.Hdr), VINF_SUCCESS);
-    if (Req.szMsg[0] == '!')
-        RTTestIFailed("%s", &Req.szMsg[1]);
-    else if (Req.szMsg[0])
-        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
-
-
-    /*
-     * Test thread-context hooks.
-     */
-    RTTestSub(hTest, "RTThreadCtxHooks");
-    uint64_t u64StartTS = RTTimeMilliTS();
-    uint64_t cMsMax     = 60000;        /* ca. 1 minute timeout. */
-    uint64_t cMsElapsed;
-    for (unsigned i = 0; i < 50; i++)
-    {
-        Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
-        Req.Hdr.cbReq = sizeof(Req);
-        Req.szMsg[0] = '\0';
-        RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstR0ThreadPreemption", sizeof("tstR0ThreadPreemption") - 1,
-                                                 TSTR0THREADPREEMPTION_CTXHOOKS, 0, &Req.Hdr), VINF_SUCCESS);
-        if (RT_FAILURE(rc))
-            return RTTestSummaryAndDestroy(hTest);
-        if (Req.szMsg[0] == '!')
-            RTTestIFailed("%s", &Req.szMsg[1]);
-        else if (Req.szMsg[0])
-            RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
-        if (!(i % 10))
-            RTTestIPrintf(RTTESTLVL_ALWAYS, "RTThreadCtxHooks passed %u iteration(s)\n", i);
-
-        /* Check timeout and bail. */
-        cMsElapsed = RTTimeMilliTS() - u64StartTS;
-        if (cMsElapsed > cMsMax)
-        {
-            RTTestIPrintf(RTTESTLVL_INFO, "RTThreadCtxHooks Stopping iterations. %RU64 ms. for %u iterations.\n",
-                          cMsElapsed, i);
-            break;
-        }
-    }
-
-    /*
-     * Done.
-     */
-    return RTTestSummaryAndDestroy(hTest);
-#endif
-}
-
-
-#if !defined(VBOX_WITH_HARDENING) || !defined(RT_OS_WINDOWS)
-/**
- * Main entry point.
- */
-int main(int argc, char **argv, char **envp)
-{
-    return TrustedMain(argc, argv, envp);
-}
-#endif
-
diff --git a/src/VBox/Runtime/testcase/tstRTGetOpt.cpp b/src/VBox/Runtime/testcase/tstRTGetOpt.cpp
index 9505f80..f76f8db 100644
--- a/src/VBox/Runtime/testcase/tstRTGetOpt.cpp
+++ b/src/VBox/Runtime/testcase/tstRTGetOpt.cpp
@@ -458,6 +458,8 @@ int main()
         "foo10",
         "--",
         "--optwithstring",
+        "-s",
+        "-i",
         "foo11",
         "foo12",
 
@@ -510,6 +512,8 @@ int main()
     CHECK_GETOPT_STR(RTGetOpt(&GetState, &Val), VINF_GETOPT_NOT_OPTION, 1, "foo9");
     CHECK_GETOPT_STR(RTGetOpt(&GetState, &Val), VINF_GETOPT_NOT_OPTION, 1, "foo10");
     CHECK_GETOPT_STR(RTGetOpt(&GetState, &Val), VINF_GETOPT_NOT_OPTION, 1, "--optwithstring");
+    CHECK_GETOPT_STR(RTGetOpt(&GetState, &Val), VINF_GETOPT_NOT_OPTION, 1, "-s");
+    CHECK_GETOPT_STR(RTGetOpt(&GetState, &Val), VINF_GETOPT_NOT_OPTION, 1, "-i");
     CHECK_GETOPT_STR(RTGetOpt(&GetState, &Val), VINF_GETOPT_NOT_OPTION, 1, "foo11");
     CHECK_GETOPT_STR(RTGetOpt(&GetState, &Val), VINF_GETOPT_NOT_OPTION, 1, "foo12");
 
diff --git a/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp b/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp
index c78a511..1e3a33b 100644
--- a/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp
+++ b/src/VBox/Runtime/testcase/tstRTInlineAsm.cpp
@@ -41,6 +41,7 @@
 
 #if !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
 # include <iprt/asm-amd64-x86.h>
+# include <iprt/x86.h>
 #else
 # include <iprt/time.h>
 #endif
@@ -580,6 +581,41 @@ void tstASMCpuId(void)
      }
 }
 
+# if 0
+static void bruteForceCpuId(void)
+{
+    RTTestISub("brute force CPUID leafs");
+    uint32_t auPrevValues[4] = { 0, 0, 0, 0};
+    uint32_t uLeaf = 0;
+    do
+    {
+        uint32_t auValues[4];
+        ASMCpuIdExSlow(uLeaf, 0, 0, 0, &auValues[0], &auValues[1], &auValues[2], &auValues[3]);
+        if (   (auValues[0] != auPrevValues[0] && auValues[0] != uLeaf)
+            || (auValues[1] != auPrevValues[1] && auValues[1] != 0)
+            || (auValues[2] != auPrevValues[2] && auValues[2] != 0)
+            || (auValues[3] != auPrevValues[3] && auValues[3] != 0)
+            || (uLeaf & (UINT32_C(0x08000000) - UINT32_C(1))) == 0)
+        {
+            RTTestIPrintf(RTTESTLVL_ALWAYS,
+                          "%08x: %08x %08x %08x %08x\n", uLeaf,
+                          auValues[0], auValues[1], auValues[2], auValues[3]);
+        }
+        auPrevValues[0] = auValues[0];
+        auPrevValues[1] = auValues[1];
+        auPrevValues[2] = auValues[2];
+        auPrevValues[3] = auValues[3];
+
+        //uint32_t uSubLeaf = 0;
+        //do
+        //{
+        //
+        //
+        //} while (false);
+    } while (uLeaf++ < UINT32_MAX);
+}
+# endif
+
 #endif /* AMD64 || X86 */
 
 DECLINLINE(void) tstASMAtomicXchgU8Worker(uint8_t volatile *pu8)
@@ -912,12 +948,59 @@ DECLINLINE(void) tstASMAtomicAddS32Worker(int32_t *pi32)
 #undef MYCHECK
 }
 
+
 static void tstASMAtomicAddS32(void)
 {
     DO_SIMPLE_TEST(ASMAtomicAddS32, int32_t);
 }
 
 
+DECLINLINE(void) tstASMAtomicUoIncU32Worker(uint32_t volatile *pu32)
+{
+    *pu32 = 0;
+
+    CHECKOP(ASMAtomicUoIncU32(pu32), UINT32_C(1), "%#x", uint32_t);
+    CHECKVAL(*pu32, UINT32_C(1), "%#x");
+
+    *pu32 = ~UINT32_C(0);
+    CHECKOP(ASMAtomicUoIncU32(pu32), 0, "%#x", uint32_t);
+    CHECKVAL(*pu32, 0, "%#x");
+
+    *pu32 = UINT32_C(0x7fffffff);
+    CHECKOP(ASMAtomicUoIncU32(pu32), UINT32_C(0x80000000), "%#x", uint32_t);
+    CHECKVAL(*pu32, UINT32_C(0x80000000), "%#x");
+}
+
+
+static void tstASMAtomicUoIncU32(void)
+{
+    DO_SIMPLE_TEST(ASMAtomicUoIncU32, uint32_t);
+}
+
+
+DECLINLINE(void) tstASMAtomicUoDecU32Worker(uint32_t volatile *pu32)
+{
+    *pu32 = 0;
+
+    CHECKOP(ASMAtomicUoDecU32(pu32), ~UINT32_C(0), "%#x", uint32_t);
+    CHECKVAL(*pu32, ~UINT32_C(0), "%#x");
+
+    *pu32 = ~UINT32_C(0);
+    CHECKOP(ASMAtomicUoDecU32(pu32), UINT32_C(0xfffffffe), "%#x", uint32_t);
+    CHECKVAL(*pu32, UINT32_C(0xfffffffe), "%#x");
+
+    *pu32 = UINT32_C(0x80000000);
+    CHECKOP(ASMAtomicUoDecU32(pu32), UINT32_C(0x7fffffff), "%#x", uint32_t);
+    CHECKVAL(*pu32, UINT32_C(0x7fffffff), "%#x");
+}
+
+
+static void tstASMAtomicUoDecU32(void)
+{
+    DO_SIMPLE_TEST(ASMAtomicUoDecU32, uint32_t);
+}
+
+
 DECLINLINE(void) tstASMAtomicAddS64Worker(int64_t volatile *pi64)
 {
     int64_t i64Rc;
@@ -1144,6 +1227,45 @@ static void tstASMAtomicAndOrU64(void)
 }
 
 
+DECLINLINE(void) tstASMAtomicUoAndOrU32Worker(uint32_t volatile *pu32)
+{
+    *pu32 = UINT32_C(0xffffffff);
+
+    ASMAtomicUoOrU32(pu32, UINT32_C(0xffffffff));
+    CHECKVAL(*pu32, UINT32_C(0xffffffff), "%#x");
+
+    ASMAtomicUoAndU32(pu32, UINT32_C(0xffffffff));
+    CHECKVAL(*pu32, UINT32_C(0xffffffff), "%#x");
+
+    ASMAtomicUoAndU32(pu32, UINT32_C(0x8f8f8f8f));
+    CHECKVAL(*pu32, UINT32_C(0x8f8f8f8f), "%#x");
+
+    ASMAtomicUoOrU32(pu32, UINT32_C(0x70707070));
+    CHECKVAL(*pu32, UINT32_C(0xffffffff), "%#x");
+
+    ASMAtomicUoAndU32(pu32, UINT32_C(1));
+    CHECKVAL(*pu32, UINT32_C(1), "%#x");
+
+    ASMAtomicUoOrU32(pu32, UINT32_C(0x80000000));
+    CHECKVAL(*pu32, UINT32_C(0x80000001), "%#x");
+
+    ASMAtomicUoAndU32(pu32, UINT32_C(0x80000000));
+    CHECKVAL(*pu32, UINT32_C(0x80000000), "%#x");
+
+    ASMAtomicUoAndU32(pu32, UINT32_C(0));
+    CHECKVAL(*pu32, UINT32_C(0), "%#x");
+
+    ASMAtomicUoOrU32(pu32, UINT32_C(0x42424242));
+    CHECKVAL(*pu32, UINT32_C(0x42424242), "%#x");
+}
+
+
+static void tstASMAtomicUoAndOrU32(void)
+{
+    DO_SIMPLE_TEST(ASMAtomicUoAndOrU32, uint32_t);
+}
+
+
 typedef struct
 {
     uint8_t ab[PAGE_SIZE];
@@ -1313,6 +1435,21 @@ void tstASMMath(void)
     uint32_t u32 = ASMDivU64ByU32RetU32(UINT64_C(0x0800000000000000), UINT32_C(0x10000000));
     CHECKVAL(u32, UINT32_C(0x80000000), "%#010RX32");
 
+    u32 = ASMMultU32ByU32DivByU32(UINT32_C(0x00000001), UINT32_C(0x00000001), UINT32_C(0x00000001));
+    CHECKVAL(u32, UINT32_C(0x00000001), "%#018RX32");
+    u32 = ASMMultU32ByU32DivByU32(UINT32_C(0x10000000), UINT32_C(0x80000000), UINT32_C(0x20000000));
+    CHECKVAL(u32, UINT32_C(0x40000000), "%#018RX32");
+    u32 = ASMMultU32ByU32DivByU32(UINT32_C(0x76543210), UINT32_C(0xffffffff), UINT32_C(0xffffffff));
+    CHECKVAL(u32, UINT32_C(0x76543210), "%#018RX32");
+    u32 = ASMMultU32ByU32DivByU32(UINT32_C(0xffffffff), UINT32_C(0xffffffff), UINT32_C(0xffffffff));
+    CHECKVAL(u32, UINT32_C(0xffffffff), "%#018RX32");
+    u32 = ASMMultU32ByU32DivByU32(UINT32_C(0xffffffff), UINT32_C(0xfffffff0), UINT32_C(0xffffffff));
+    CHECKVAL(u32, UINT32_C(0xfffffff0), "%#018RX32");
+    u32 = ASMMultU32ByU32DivByU32(UINT32_C(0x10359583), UINT32_C(0x58734981), UINT32_C(0xf8694045));
+    CHECKVAL(u32, UINT32_C(0x05c584ce), "%#018RX32");
+    u32 = ASMMultU32ByU32DivByU32(UINT32_C(0x10359583), UINT32_C(0xf8694045), UINT32_C(0x58734981));
+    CHECKVAL(u32, UINT32_C(0x2d860795), "%#018RX32");
+
 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
     u64 = ASMMultU64ByU32DivByU32(UINT64_C(0x0000000000000001), UINT32_C(0x00000001), UINT32_C(0x00000001));
     CHECKVAL(u64, UINT64_C(0x0000000000000001), "%#018RX64");
@@ -1484,65 +1621,92 @@ void tstASMBench(void)
     } while (0)
 #endif
 
-    BENCH(s_u32 = 0,                            "s_u32 = 0");
-    BENCH(ASMAtomicUoReadU8(&s_u8),             "ASMAtomicUoReadU8");
-    BENCH(ASMAtomicUoReadS8(&s_i8),             "ASMAtomicUoReadS8");
-    BENCH(ASMAtomicUoReadU16(&s_u16),           "ASMAtomicUoReadU16");
-    BENCH(ASMAtomicUoReadS16(&s_i16),           "ASMAtomicUoReadS16");
-    BENCH(ASMAtomicUoReadU32(&s_u32),           "ASMAtomicUoReadU32");
-    BENCH(ASMAtomicUoReadS32(&s_i32),           "ASMAtomicUoReadS32");
-    BENCH(ASMAtomicUoReadU64(&s_u64),           "ASMAtomicUoReadU64");
-    BENCH(ASMAtomicUoReadS64(&s_i64),           "ASMAtomicUoReadS64");
-    BENCH(ASMAtomicReadU8(&s_u8),               "ASMAtomicReadU8");
-    BENCH(ASMAtomicReadS8(&s_i8),               "ASMAtomicReadS8");
-    BENCH(ASMAtomicReadU16(&s_u16),             "ASMAtomicReadU16");
-    BENCH(ASMAtomicReadS16(&s_i16),             "ASMAtomicReadS16");
-    BENCH(ASMAtomicReadU32(&s_u32),             "ASMAtomicReadU32");
-    BENCH(ASMAtomicReadS32(&s_i32),             "ASMAtomicReadS32");
-    BENCH(ASMAtomicReadU64(&s_u64),             "ASMAtomicReadU64");
-    BENCH(ASMAtomicReadS64(&s_i64),             "ASMAtomicReadS64");
-    BENCH(ASMAtomicUoWriteU8(&s_u8, 0),         "ASMAtomicUoWriteU8");
-    BENCH(ASMAtomicUoWriteS8(&s_i8, 0),         "ASMAtomicUoWriteS8");
-    BENCH(ASMAtomicUoWriteU16(&s_u16, 0),       "ASMAtomicUoWriteU16");
-    BENCH(ASMAtomicUoWriteS16(&s_i16, 0),       "ASMAtomicUoWriteS16");
-    BENCH(ASMAtomicUoWriteU32(&s_u32, 0),       "ASMAtomicUoWriteU32");
-    BENCH(ASMAtomicUoWriteS32(&s_i32, 0),       "ASMAtomicUoWriteS32");
-    BENCH(ASMAtomicUoWriteU64(&s_u64, 0),       "ASMAtomicUoWriteU64");
-    BENCH(ASMAtomicUoWriteS64(&s_i64, 0),       "ASMAtomicUoWriteS64");
-    BENCH(ASMAtomicWriteU8(&s_u8, 0),           "ASMAtomicWriteU8");
-    BENCH(ASMAtomicWriteS8(&s_i8, 0),           "ASMAtomicWriteS8");
-    BENCH(ASMAtomicWriteU16(&s_u16, 0),         "ASMAtomicWriteU16");
-    BENCH(ASMAtomicWriteS16(&s_i16, 0),         "ASMAtomicWriteS16");
-    BENCH(ASMAtomicWriteU32(&s_u32, 0),         "ASMAtomicWriteU32");
-    BENCH(ASMAtomicWriteS32(&s_i32, 0),         "ASMAtomicWriteS32");
-    BENCH(ASMAtomicWriteU64(&s_u64, 0),         "ASMAtomicWriteU64");
-    BENCH(ASMAtomicWriteS64(&s_i64, 0),         "ASMAtomicWriteS64");
-    BENCH(ASMAtomicXchgU8(&s_u8, 0),            "ASMAtomicXchgU8");
-    BENCH(ASMAtomicXchgS8(&s_i8, 0),            "ASMAtomicXchgS8");
-    BENCH(ASMAtomicXchgU16(&s_u16, 0),          "ASMAtomicXchgU16");
-    BENCH(ASMAtomicXchgS16(&s_i16, 0),          "ASMAtomicXchgS16");
-    BENCH(ASMAtomicXchgU32(&s_u32, 0),          "ASMAtomicXchgU32");
-    BENCH(ASMAtomicXchgS32(&s_i32, 0),          "ASMAtomicXchgS32");
-    BENCH(ASMAtomicXchgU64(&s_u64, 0),          "ASMAtomicXchgU64");
-    BENCH(ASMAtomicXchgS64(&s_i64, 0),          "ASMAtomicXchgS64");
-    BENCH(ASMAtomicCmpXchgU32(&s_u32, 0, 0),    "ASMAtomicCmpXchgU32");
-    BENCH(ASMAtomicCmpXchgS32(&s_i32, 0, 0),    "ASMAtomicCmpXchgS32");
-    BENCH(ASMAtomicCmpXchgU64(&s_u64, 0, 0),    "ASMAtomicCmpXchgU64");
-    BENCH(ASMAtomicCmpXchgS64(&s_i64, 0, 0),    "ASMAtomicCmpXchgS64");
-    BENCH(ASMAtomicCmpXchgU32(&s_u32, 0, 1),    "ASMAtomicCmpXchgU32/neg");
-    BENCH(ASMAtomicCmpXchgS32(&s_i32, 0, 1),    "ASMAtomicCmpXchgS32/neg");
-    BENCH(ASMAtomicCmpXchgU64(&s_u64, 0, 1),    "ASMAtomicCmpXchgU64/neg");
-    BENCH(ASMAtomicCmpXchgS64(&s_i64, 0, 1),    "ASMAtomicCmpXchgS64/neg");
-    BENCH(ASMAtomicIncU32(&s_u32),              "ASMAtomicIncU32");
-    BENCH(ASMAtomicIncS32(&s_i32),              "ASMAtomicIncS32");
-    BENCH(ASMAtomicDecU32(&s_u32),              "ASMAtomicDecU32");
-    BENCH(ASMAtomicDecS32(&s_i32),              "ASMAtomicDecS32");
-    BENCH(ASMAtomicAddU32(&s_u32, 5),           "ASMAtomicAddU32");
-    BENCH(ASMAtomicAddS32(&s_i32, 5),           "ASMAtomicAddS32");
+    BENCH(s_u32 = 0,                             "s_u32 = 0");
+    BENCH(ASMAtomicUoReadU8(&s_u8),              "ASMAtomicUoReadU8");
+    BENCH(ASMAtomicUoReadS8(&s_i8),              "ASMAtomicUoReadS8");
+    BENCH(ASMAtomicUoReadU16(&s_u16),            "ASMAtomicUoReadU16");
+    BENCH(ASMAtomicUoReadS16(&s_i16),            "ASMAtomicUoReadS16");
+    BENCH(ASMAtomicUoReadU32(&s_u32),            "ASMAtomicUoReadU32");
+    BENCH(ASMAtomicUoReadS32(&s_i32),            "ASMAtomicUoReadS32");
+    BENCH(ASMAtomicUoReadU64(&s_u64),            "ASMAtomicUoReadU64");
+    BENCH(ASMAtomicUoReadS64(&s_i64),            "ASMAtomicUoReadS64");
+    BENCH(ASMAtomicReadU8(&s_u8),                "ASMAtomicReadU8");
+    BENCH(ASMAtomicReadS8(&s_i8),                "ASMAtomicReadS8");
+    BENCH(ASMAtomicReadU16(&s_u16),              "ASMAtomicReadU16");
+    BENCH(ASMAtomicReadS16(&s_i16),              "ASMAtomicReadS16");
+    BENCH(ASMAtomicReadU32(&s_u32),              "ASMAtomicReadU32");
+    BENCH(ASMAtomicReadS32(&s_i32),              "ASMAtomicReadS32");
+    BENCH(ASMAtomicReadU64(&s_u64),              "ASMAtomicReadU64");
+    BENCH(ASMAtomicReadS64(&s_i64),              "ASMAtomicReadS64");
+    BENCH(ASMAtomicUoWriteU8(&s_u8, 0),          "ASMAtomicUoWriteU8");
+    BENCH(ASMAtomicUoWriteS8(&s_i8, 0),          "ASMAtomicUoWriteS8");
+    BENCH(ASMAtomicUoWriteU16(&s_u16, 0),        "ASMAtomicUoWriteU16");
+    BENCH(ASMAtomicUoWriteS16(&s_i16, 0),        "ASMAtomicUoWriteS16");
+    BENCH(ASMAtomicUoWriteU32(&s_u32, 0),        "ASMAtomicUoWriteU32");
+    BENCH(ASMAtomicUoWriteS32(&s_i32, 0),        "ASMAtomicUoWriteS32");
+    BENCH(ASMAtomicUoWriteU64(&s_u64, 0),        "ASMAtomicUoWriteU64");
+    BENCH(ASMAtomicUoWriteS64(&s_i64, 0),        "ASMAtomicUoWriteS64");
+    BENCH(ASMAtomicWriteU8(&s_u8, 0),            "ASMAtomicWriteU8");
+    BENCH(ASMAtomicWriteS8(&s_i8, 0),            "ASMAtomicWriteS8");
+    BENCH(ASMAtomicWriteU16(&s_u16, 0),          "ASMAtomicWriteU16");
+    BENCH(ASMAtomicWriteS16(&s_i16, 0),          "ASMAtomicWriteS16");
+    BENCH(ASMAtomicWriteU32(&s_u32, 0),          "ASMAtomicWriteU32");
+    BENCH(ASMAtomicWriteS32(&s_i32, 0),          "ASMAtomicWriteS32");
+    BENCH(ASMAtomicWriteU64(&s_u64, 0),          "ASMAtomicWriteU64");
+    BENCH(ASMAtomicWriteS64(&s_i64, 0),          "ASMAtomicWriteS64");
+    BENCH(ASMAtomicXchgU8(&s_u8, 0),             "ASMAtomicXchgU8");
+    BENCH(ASMAtomicXchgS8(&s_i8, 0),             "ASMAtomicXchgS8");
+    BENCH(ASMAtomicXchgU16(&s_u16, 0),           "ASMAtomicXchgU16");
+    BENCH(ASMAtomicXchgS16(&s_i16, 0),           "ASMAtomicXchgS16");
+    BENCH(ASMAtomicXchgU32(&s_u32, 0),           "ASMAtomicXchgU32");
+    BENCH(ASMAtomicXchgS32(&s_i32, 0),           "ASMAtomicXchgS32");
+    BENCH(ASMAtomicXchgU64(&s_u64, 0),           "ASMAtomicXchgU64");
+    BENCH(ASMAtomicXchgS64(&s_i64, 0),           "ASMAtomicXchgS64");
+    BENCH(ASMAtomicCmpXchgU32(&s_u32, 0, 0),     "ASMAtomicCmpXchgU32");
+    BENCH(ASMAtomicCmpXchgS32(&s_i32, 0, 0),     "ASMAtomicCmpXchgS32");
+    BENCH(ASMAtomicCmpXchgU64(&s_u64, 0, 0),     "ASMAtomicCmpXchgU64");
+    BENCH(ASMAtomicCmpXchgS64(&s_i64, 0, 0),     "ASMAtomicCmpXchgS64");
+    BENCH(ASMAtomicCmpXchgU32(&s_u32, 0, 1),     "ASMAtomicCmpXchgU32/neg");
+    BENCH(ASMAtomicCmpXchgS32(&s_i32, 0, 1),     "ASMAtomicCmpXchgS32/neg");
+    BENCH(ASMAtomicCmpXchgU64(&s_u64, 0, 1),     "ASMAtomicCmpXchgU64/neg");
+    BENCH(ASMAtomicCmpXchgS64(&s_i64, 0, 1),     "ASMAtomicCmpXchgS64/neg");
+    BENCH(ASMAtomicIncU32(&s_u32),               "ASMAtomicIncU32");
+    BENCH(ASMAtomicIncS32(&s_i32),               "ASMAtomicIncS32");
+    BENCH(ASMAtomicDecU32(&s_u32),               "ASMAtomicDecU32");
+    BENCH(ASMAtomicDecS32(&s_i32),               "ASMAtomicDecS32");
+    BENCH(ASMAtomicAddU32(&s_u32, 5),            "ASMAtomicAddU32");
+    BENCH(ASMAtomicAddS32(&s_i32, 5),            "ASMAtomicAddS32");
+    BENCH(ASMAtomicUoIncU32(&s_u32),             "ASMAtomicUoIncU32");
+    BENCH(ASMAtomicUoDecU32(&s_u32),             "ASMAtomicUoDecU32");
+    BENCH(ASMAtomicUoAndU32(&s_u32, 0xffffffff), "ASMAtomicUoAndU32");
+    BENCH(ASMAtomicUoOrU32(&s_u32, 0xffffffff),  "ASMAtomicUoOrU32");
+
     /* The Darwin gcc does not like this ... */
 #if !defined(RT_OS_DARWIN) && !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
     BENCH(s_u8 = ASMGetApicId(),                "ASMGetApicId");
 #endif
+#if !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
+    BENCH(s_u64 = ASMReadTSC(),                 "ASMReadTSC");
+    uint32_t uAux;
+    if (   ASMHasCpuId()
+        && ASMIsValidExtRange(ASMCpuId_EAX(0x80000000))
+        && (ASMCpuId_EDX(0x80000001) & X86_CPUID_EXT_FEATURE_EDX_RDTSCP) )
+        BENCH(s_u64 = ASMReadTscWithAux(&uAux),  "ASMReadTscWithAux");
+    union
+    {
+        uint64_t    u64[2];
+        RTIDTR      Unaligned;
+        struct
+        {
+            uint16_t abPadding[3];
+            RTIDTR   Aligned;
+        } s;
+    } uBuf;
+    Assert(((uintptr_t)&uBuf.Unaligned.pIdt & (sizeof(uintptr_t) - 1)) != 0);
+    BENCH(ASMGetIDTR(&uBuf.Unaligned),            "ASMGetIDTR/unaligned");
+    Assert(((uintptr_t)&uBuf.s.Aligned.pIdt & (sizeof(uintptr_t) - 1)) == 0);
+    BENCH(ASMGetIDTR(&uBuf.s.Aligned),            "ASMGetIDTR/aligned");
+#endif
 
 #undef BENCH
 }
@@ -1560,6 +1724,7 @@ int main(int argc, char *argv[])
      */
 #if !defined(GCC44_32BIT_PIC) && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
     tstASMCpuId();
+    //bruteForceCpuId();
 #endif
 #if 1
     tstASMAtomicXchgU8();
@@ -1582,6 +1747,10 @@ int main(int argc, char *argv[])
     tstASMAtomicAndOrU32();
     tstASMAtomicAndOrU64();
 
+    tstASMAtomicUoIncU32();
+    tstASMAtomicUoDecU32();
+    tstASMAtomicUoAndOrU32();
+
     tstASMMemZeroPage();
     tstASMMemIsZeroPage(g_hTest);
     tstASMMemZero32();
diff --git a/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.S b/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.S
new file mode 100644
index 0000000..348cd5e
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.S
@@ -0,0 +1,126 @@
+/*
+ * as -o tstRTLdrMachORelocs-1-as.o tstRTLdrMachORelocs-1.S
+ * ld -r -o tstRTLdrMachORelocs-1.o tstRTLdrMachORelocs-1-as.o
+ * tstLdr-3 0x2000 tstRTLdrMachORelocs-1.o 0x2000 > tmp.disas
+ * diff tmp.disas tstRTLdrMachORelocs-1.disas
+ */
+	.section	__TEXT,__text,regular,pure_instructions
+	.globl	_myfunc6
+	.align	4, 0x90
+_myfunc6:
+Leh_func_begin6:
+       .byte 0x90
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad   Lg_LocalData
+       movb    Lg_LocalData(%rip), %al
+	cmpb	$0x7f, Lg_LocalData(%rip)
+	cmpw	$0x117f, Lg_LocalData(%rip)
+	cmpl	$0x9988117f, Lg_LocalData(%rip)
+       jmp     Lg_LocalData
+
+       .byte 0x90
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad   Leh_func_end6
+       movb    Leh_func_end6(%rip), %al
+	cmpb	$0x7e, Leh_func_end6(%rip)
+	cmpw	$0x117e, Leh_func_end6(%rip)
+	cmpl	$0x9988117e, Leh_func_end6(%rip)
+       jmp     Leh_func_end6
+
+       .byte 0x90
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad   _g_Data.3-3
+       movb    _g_Data.3-3(%rip), %al
+	cmpb	$4, _g_Data.3-3(%rip)
+       jmp     _g_Data.3-3
+
+       .byte 0x90
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad _g_Data.3
+       movb    _g_Data.3(%rip), %al
+	cmpb	$5, _g_Data.3(%rip)
+	cmpw	$1105, _g_Data.3(%rip)
+	cmpl	$99881105, _g_Data.3(%rip)
+       jmp     _g_Data.3
+
+       .byte 0x90
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad abssym
+       movb    abssym(%rip), %al
+	cmpb	$6, abssym(%rip)
+	cmpw	$1106, abssym(%rip)
+	cmpl	$99881106, abssym(%rip)
+       jmp     abssym
+1193046 = 0x123456 (1193046)+00000000000000dd
+
+       .byte 0x90
+	cmpb	$1, _g_Data.4.1(%rip)
+	cmpb	$2, _g_Data.4.2(%rip)
+	cmpb	$3, _g_Data.4.3(%rip)
+
+       /* X86_64_RELOC_SUBTRACTOR */
+       .byte 0x90
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad   Leh_func_end6 - _g_Data.0
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad   Leh_func_end6 - _g_Data.0 + 0x80
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad   _myfunc6_end - _g_Data.0
+       .byte 0x48, 0xb8                 /* movabsq  */
+       .quad   _myfunc6_end - _g_Data.0 + 0x80
+	.align	4, 0xcc
+_myfunc6_end:
+
+	.section	__TEXT,__othertext,regular,pure_instructions
+       .align 3, 0xcc
+Leh_func_end6:
+        .byte 0x90
+        .byte 0x90
+        .byte 0xcc
+        .byte 0xcc
+        .byte 0x90
+        .byte 0x90
+        .byte 0xcc
+        .byte 0xcc
+
+	.section	__DATA,__data,regular,pure_instructions
+       .align 3, 0xcc
+_g_Data.0:
+       .byte 0x90
+_g_Data.1:
+       .byte 0xcc
+_g_Data.2:
+       .byte 0x90
+_g_Data.3:
+       .byte 0xcc
+_g_Data.4.0:
+       .byte 0x90
+_g_Data.4.1:
+       .byte 0xcc
+_g_Data.4.2:
+       .byte 0x90
+_g_Data.4.3:
+       .byte 0xcc
+_g_EndOfData:
+
+	.section	__GROG,__foobar,regular,pure_instructions
+       .align 3, 0xcc
+        .byte 0x90
+Lg_LocalDataMinus3:
+        .byte 0x90
+Lg_LocalDataMinus2:
+        .byte 0x90
+Lg_LocalDataMinus1:
+        .byte 0x90
+Lg_LocalData:
+        .byte 0xcc
+        .byte 0xcc
+        .byte 0xcc
+        .byte 0xcc
+        .byte 0xcc
+        .byte 0xcc
+
+.set abssym, 0x123456
+.globl abssym
+
+.subsections_via_symbols
diff --git a/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.disas b/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.disas
new file mode 100644
index 0000000..452c4bf
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.disas
@@ -0,0 +1,206 @@
+tstLdr-3: Addr=0000000000002000
+0000000000002000 myfunc6 (10) - 0000000000002120 myfunc6_end (0)
+myfunc6:
+00002000 nop                                       ; 90
+^^^^^^^^
+00002001 mov rax, 00000000000002134h               ; 48 b8 34 21 00 00 00 00 00 00
+0000200b mov al, byte [+000000123h wrt rip (00000000000002134h = g_EndOfData+004h)] ; 8a 05 23 01 00 00
+00002011 cmp byte [+00000011ch wrt rip (00000000000002134h = g_EndOfData+004h)], 07fh ; 80 3d 1c 01 00 00 7f
+00002018 cmp word [+000000113h wrt rip (00000000000002134h = g_EndOfData+004h)], word 0117fh ; 66 81 3d 13 01 00 00 7f 11
+00002021 cmp dword [+000000109h wrt rip (00000000000002134h = g_EndOfData+004h)], 09988117fh ; 81 3d 09 01 00 00 7f 11 88 99
+0000202b jmp +000000104h (00000000000002134h = g_EndOfData+004h ) ; e9 04 01 00 00
+00002030 nop                                       ; 90
+00002031 mov rax, 00000000000002120h               ; 48 b8 20 21 00 00 00 00 00 00
+0000203b mov al, byte [+0000000dfh wrt rip (00000000000002120h = myfunc6_end)] ; 8a 05 df 00 00 00
+00002041 cmp byte [+0000000d8h wrt rip (00000000000002120h = myfunc6_end)], 07eh ; 80 3d d8 00 00 00 7e
+00002048 cmp word [+0000000cfh wrt rip (00000000000002120h = myfunc6_end)], word 0117eh ; 66 81 3d cf 00 00 00 7e 11
+00002051 cmp dword [+0000000c5h wrt rip (00000000000002120h = myfunc6_end)], 09988117eh ; 81 3d c5 00 00 00 7e 11 88 99
+0000205b jmp +0000000c0h (00000000000002120h = myfunc6_end ) ; e9 c0 00 00 00
+00002060 nop                                       ; 90
+00002061 mov rax, 00000000000002128h               ; 48 b8 28 21 00 00 00 00 00 00
+0000206b mov al, byte [+0000000b7h wrt rip (00000000000002128h = g_Data.0)] ; 8a 05 b7 00 00 00
+00002071 cmp byte [+0000000b0h wrt rip (00000000000002128h = g_Data.0)], 004h ; 80 3d b0 00 00 00 04
+00002078 jmp +0000000abh (00000000000002128h = g_Data.0 ) ; e9 ab 00 00 00
+0000207d nop                                       ; 90
+0000207e mov rax, 0000000000000212bh               ; 48 b8 2b 21 00 00 00 00 00 00
+00002088 mov al, byte [+00000009dh wrt rip (0000000000000212bh = g_Data.3)] ; 8a 05 9d 00 00 00
+0000208e cmp byte [+000000096h wrt rip (0000000000000212bh = g_Data.3)], 005h ; 80 3d 96 00 00 00 05
+00002095 cmp word [+00000008dh wrt rip (0000000000000212bh = g_Data.3)], word 00451h ; 66 81 3d 8d 00 00 00 51 04
+0000209e cmp dword [+000000083h wrt rip (0000000000000212bh = g_Data.3)], 005f41091h ; 81 3d 83 00 00 00 91 10 f4 05
+000020a8 jmp +00000007eh (0000000000000212bh = g_Data.3 ) ; e9 7e 00 00 00
+000020ad nop                                       ; 90
+000020ae mov rax, 00000000000123456h               ; 48 b8 56 34 12 00 00 00 00 00
+000020b8 mov al, byte [+0001234c3h wrt rip (00000000000125581h] ; 8a 05 c3 34 12 00
+000020be cmp byte [+0001234bch wrt rip (00000000000125581h], 005h ; 80 3d bc 34 12 00 05
+000020c5 cmp word [+0001234b3h wrt rip (00000000000125581h], word 00451h ; 66 81 3d b3 34 12 00 51 04
+000020ce cmp dword [+0001234a9h wrt rip (00000000000125581h], 005f41091h ; 81 3d a9 34 12 00 91 10 f4 05
+000020d8 jmp +0001234a4h (00000000000125581h)      ; e9 a4 34 12 00
+000020dd nop                                       ; 90
+000020de cmp byte [+000000048h wrt rip (0000000000000212dh = g_Data.4.1)], 001h ; 80 3d 48 00 00 00 01
+000020e5 cmp byte [+000000042h wrt rip (0000000000000212eh = g_Data.4.2)], 002h ; 80 3d 42 00 00 00 02
+000020ec cmp byte [+00000003ch wrt rip (0000000000000212fh = g_Data.4.3)], 003h ; 80 3d 3c 00 00 00 03
+000020f3 nop                                       ; 90
+000020f4 mov rax, 0fffffffffffffff8h               ; 48 b8 f8 ff ff ff ff ff ff ff
+000020fe mov rax, 00000000000000078h               ; 48 b8 78 00 00 00 00 00 00 00
+00002108 mov rax, 0fffffffffffffff8h               ; 48 b8 f8 ff ff ff ff ff ff ff
+00002112 mov rax, 00000000000000078h               ; 48 b8 78 00 00 00 00 00 00 00
+0000211c int3                                      ; cc
+0000211d int3                                      ; cc
+0000211e int3                                      ; cc
+0000211f int3                                      ; cc
+myfunc6_end:
+00002120 nop                                       ; 90
+00002121 nop                                       ; 90
+00002122 int3                                      ; cc
+00002123 int3                                      ; cc
+00002124 nop                                       ; 90
+00002125 nop                                       ; 90
+00002126 int3                                      ; cc
+00002127 int3                                      ; cc
+g_Data.0:
+00002128 nop                                       ; 90
+g_Data.1:
+00002129 int3                                      ; cc
+g_Data.2:
+0000212a nop                                       ; 90
+g_Data.3:
+0000212b int3                                      ; cc
+g_Data.4.0:
+0000212c nop                                       ; 90
+g_Data.4.1:
+0000212d int3                                      ; cc
+g_Data.4.2:
+0000212e nop                                       ; 90
+g_Data.4.3:
+0000212f int3                                      ; cc
+g_EndOfData:
+00002130 nop                                       ; 90
+00002131 nop                                       ; 90
+00002132 nop                                       ; 90
+00002133 nop                                       ; 90
+00002134 int3                                      ; cc
+00002135 int3                                      ; cc
+00002136 int3                                      ; cc
+00002137 int3                                      ; cc
+00002138 int3                                      ; cc
+00002139 int3                                      ; cc
+0000213a add byte [rax], al                        ; 00 00
+0000213c add byte [rax], al                        ; 00 00
+0000213e add byte [rax], al                        ; 00 00
+00002140 and byte [rcx], ah                        ; 20 21
+00002142 add byte [rax], al                        ; 00 00
+00002144 add byte [rax], al                        ; 00 00
+00002146 add byte [rax], al                        ; 00 00
+00002148 sub byte [rcx], ah                        ; 28 21
+0000214a add byte [rax], al                        ; 00 00
+0000214c add byte [rax], al                        ; 00 00
+0000214e add byte [rax], al                        ; 00 00
+00002150 sub dword [rcx], esp                      ; 29 21
+00002152 add byte [rax], al                        ; 00 00
+00002154 add byte [rax], al                        ; 00 00
+00002156 add byte [rax], al                        ; 00 00
+00002158 sub ah, byte [rcx]                        ; 2a 21
+0000215a add byte [rax], al                        ; 00 00
+0000215c add byte [rax], al                        ; 00 00
+0000215e add byte [rax], al                        ; 00 00
+00002160 sub esp, dword [rcx]                      ; 2b 21
+00002162 add byte [rax], al                        ; 00 00
+00002164 add byte [rax], al                        ; 00 00
+00002166 add byte [rax], al                        ; 00 00
+00002168 sub AL, 021h                              ; 2c 21
+0000216a add byte [rax], al                        ; 00 00
+0000216c add byte [rax], al                        ; 00 00
+0000216e add byte [rax], al                        ; 00 00
+00002170 sub eax, 000000021h                       ; 2d 21 00 00 00
+00002175 add byte [rax], al                        ; 00 00
+00002177 add byte [rsi], ch                        ; 00 2e
+00002179 and dword [rax], eax                      ; 21 00
+0000217b add byte [rax], al                        ; 00 00
+0000217d add byte [rax], al                        ; 00 00
+0000217f add byte [rdi], ch                        ; 00 2f
+00002181 and dword [rax], eax                      ; 21 00
+00002183 add byte [rax], al                        ; 00 00
+00002185 add byte [rax], al                        ; 00 00
+00002187 add byte [rax], dh                        ; 00 30
+00002189 and dword [rax], eax                      ; 21 00
+0000218b add byte [rax], al                        ; 00 00
+0000218d add byte [rax], al                        ; 00 00
+0000218f add byte [rax], al                        ; 00 00
+00002191 and byte [rax], al                        ; 20 00
+00002193 add byte [rax], al                        ; 00 00
+00002195 add byte [rax], al                        ; 00 00
+00002197 add byte [rsi+034h], dl                   ; 00 56 34
+0000219a adc al, byte [rax]                        ; 12 00
+0000219c add byte [rax], al                        ; 00 00
+0000219e add byte [rax], al                        ; 00 00
+000021a0 add byte [rax], al                        ; 00 00
+000021a2 add byte [rax], al                        ; 00 00
+000021a4 add byte [rax], al                        ; 00 00
+000021a6 add byte [rax], al                        ; 00 00
+000021a8 add byte [rax], al                        ; 00 00
+000021aa add byte [rax], al                        ; 00 00
+000021ac add byte [rax], al                        ; 00 00
+000021ae add byte [rax], al                        ; 00 00
+000021b0 add byte [rax], al                        ; 00 00
+000021b2 add byte [rax], al                        ; 00 00
+000021b4 add byte [rax], al                        ; 00 00
+000021b6 add byte [rax], al                        ; 00 00
+000021b8 add byte [rax], al                        ; 00 00
+000021ba add byte [rax], al                        ; 00 00
+000021bc add byte [rax], al                        ; 00 00
+000021be add byte [rax], al                        ; 00 00
+000021c0 jmp qword [-000000086h wrt rip (00000000000002140h = g_EndOfData+010h)] ; ff 25 7a ff ff ff
+000021c6 int3                                      ; cc
+000021c7 int3                                      ; cc
+000021c8 jmp qword [-000000086h wrt rip (00000000000002148h = g_EndOfData+018h)] ; ff 25 7a ff ff ff
+000021ce int3                                      ; cc
+000021cf int3                                      ; cc
+000021d0 jmp qword [-000000086h wrt rip (00000000000002150h = g_EndOfData+020h)] ; ff 25 7a ff ff ff
+000021d6 int3                                      ; cc
+000021d7 int3                                      ; cc
+000021d8 jmp qword [-000000086h wrt rip (00000000000002158h = g_EndOfData+028h)] ; ff 25 7a ff ff ff
+000021de int3                                      ; cc
+000021df int3                                      ; cc
+000021e0 jmp qword [-000000086h wrt rip (00000000000002160h = g_EndOfData+030h)] ; ff 25 7a ff ff ff
+000021e6 int3                                      ; cc
+000021e7 int3                                      ; cc
+000021e8 jmp qword [-000000086h wrt rip (00000000000002168h = g_EndOfData+038h)] ; ff 25 7a ff ff ff
+000021ee int3                                      ; cc
+000021ef int3                                      ; cc
+000021f0 jmp qword [-000000086h wrt rip (00000000000002170h = g_EndOfData+040h)] ; ff 25 7a ff ff ff
+000021f6 int3                                      ; cc
+000021f7 int3                                      ; cc
+000021f8 jmp qword [-000000086h wrt rip (00000000000002178h = g_EndOfData+048h)] ; ff 25 7a ff ff ff
+000021fe int3                                      ; cc
+000021ff int3                                      ; cc
+00002200 jmp qword [-000000086h wrt rip (00000000000002180h = g_EndOfData+050h)] ; ff 25 7a ff ff ff
+00002206 int3                                      ; cc
+00002207 int3                                      ; cc
+00002208 jmp qword [-000000086h wrt rip (00000000000002188h = g_EndOfData+058h)] ; ff 25 7a ff ff ff
+0000220e int3                                      ; cc
+0000220f int3                                      ; cc
+00002210 jmp qword [-000000086h wrt rip (00000000000002190h = g_EndOfData+060h)] ; ff 25 7a ff ff ff
+00002216 int3                                      ; cc
+00002217 int3                                      ; cc
+00002218 jmp qword [-000000086h wrt rip (00000000000002198h = g_EndOfData+068h)] ; ff 25 7a ff ff ff
+0000221e int3                                      ; cc
+0000221f int3                                      ; cc
+00002220 add byte [rax], al                        ; 00 00
+00002222 add byte [rax], al                        ; 00 00
+00002224 add byte [rax], al                        ; 00 00
+00002226 add byte [rax], al                        ; 00 00
+00002228 add byte [rax], al                        ; 00 00
+0000222a add byte [rax], al                        ; 00 00
+0000222c add byte [rax], al                        ; 00 00
+0000222e add byte [rax], al                        ; 00 00
+00002230 add byte [rax], al                        ; 00 00
+00002232 add byte [rax], al                        ; 00 00
+00002234 add byte [rax], al                        ; 00 00
+00002236 add byte [rax], al                        ; 00 00
+00002238 add byte [rax], al                        ; 00 00
+0000223a add byte [rax], al                        ; 00 00
+0000223c add byte [rax], al                        ; 00 00
+0000223e add byte [rax], al                        ; 00 00
+00002240 add al, byte [rax]                        ; 02 00
+00002242 add byte [rax], al                        ; 00 00
+tstLdr-3: SUCCESS
diff --git a/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.o b/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.o
new file mode 100644
index 0000000..f0685b2
Binary files /dev/null and b/src/VBox/Runtime/testcase/tstRTLdrMachORelocs-1.o differ
diff --git a/src/VBox/Runtime/testcase/tstRTNetIPv4.cpp b/src/VBox/Runtime/testcase/tstRTNetIPv4.cpp
new file mode 100644
index 0000000..991544c
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTNetIPv4.cpp
@@ -0,0 +1,134 @@
+/* $Id: tstRTNetIPv4.cpp $ */
+/** @file
+ * IPRT Testcase - IPv4.
+ */
+
+/*
+ * Copyright (C) 2008-2010 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/net.h>
+
+#include <iprt/err.h>
+#include <iprt/initterm.h>
+#include <iprt/test.h>
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define CHECKADDR(String, rcExpected, ExpectedAddr)                     \
+    do {                                                                \
+        RTNETADDRIPV4 Addr;                                             \
+        int rc2 = RTNetStrToIPv4Addr(String, &Addr);                    \
+        if ((rcExpected) && !rc2)                                       \
+        {                                                               \
+            RTTestIFailed("at line %d: '%s': expected %Rrc got %Rrc\n", \
+                          __LINE__, String, (rcExpected), rc2);         \
+        }                                                               \
+        else if (   (rcExpected) != rc2                                 \
+                 || (   rc2 == VINF_SUCCESS                             \
+                     && RT_H2N_U32_C(ExpectedAddr) != Addr.u))          \
+        {                                                               \
+            RTTestIFailed("at line %d: '%s': expected %Rrc got %Rrc,"   \
+                          " expected address %RTnaipv4 got %RTnaipv4\n", \
+                          __LINE__, String, rcExpected, rc2,            \
+                          RT_H2N_U32_C(ExpectedAddr), Addr.u);          \
+        }                                                               \
+    } while (0)
+
+#define GOODADDR(String, ExpectedAddr) \
+    CHECKADDR(String, VINF_SUCCESS, ExpectedAddr)
+
+#define BADADDR(String) \
+    CHECKADDR(String, VERR_INVALID_PARAMETER, 0)
+
+
+#define CHECKADDREX(String, Trailer, rcExpected, ExpectedAddr)          \
+    do {                                                                \
+        RTNETADDRIPV4 Addr;                                             \
+        const char *strAll = String /* concat */ Trailer;               \
+        const char *pTrailer = strAll + sizeof(String) - 1;             \
+        char *pNext = NULL;                                             \
+        int rc2 = RTNetStrToIPv4AddrEx(strAll, &Addr, &pNext);          \
+        if ((rcExpected) && !rc2)                                       \
+        {                                                               \
+            RTTestIFailed("at line %d: '%s': expected %Rrc got %Rrc\n", \
+                          __LINE__, String, (rcExpected), rc2);         \
+        }                                                               \
+        else if ((rcExpected) != rc2                                    \
+                 || (rc2 == VINF_SUCCESS                                \
+                     && (RT_H2N_U32_C(ExpectedAddr) != Addr.u           \
+                         || pTrailer != pNext)))                        \
+        {                                                               \
+            RTTestIFailed("at line %d: '%s': expected %Rrc got %Rrc,"   \
+                          " expected address %RTnaipv4 got %RTnaipv4"   \
+                          " expected trailer \"%s\" got %s%s%s"         \
+                          "\n",                                         \
+                          __LINE__, String, rcExpected, rc2,            \
+                          RT_H2N_U32_C(ExpectedAddr), Addr.u,           \
+                          pTrailer,                                     \
+                          pNext ? "\"" : "",                            \
+                          pNext ? pNext : "(null)",                     \
+                          pNext ? "\"" : "");                           \
+        }                                                               \
+    } while (0)
+
+
+int main()
+{
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("tstRTNetIPv4", &hTest);
+    if (rc)
+        return rc;
+    RTTestBanner(hTest);
+
+    GOODADDR("1.2.3.4",         0x01020304);
+    GOODADDR("0.0.0.0",         0x00000000);
+    GOODADDR("255.255.255.255", 0xFFFFFFFF);
+
+    /* leading and trailing whitespace is allowed */
+    GOODADDR(" 1.2.3.4 ",       0x01020304);
+    GOODADDR("\t1.2.3.4\t",     0x01020304);
+
+    BADADDR("1.2.3.4x");
+    BADADDR("1.2.3.4.");
+    BADADDR("1.2.3");
+    BADADDR("0x1.2.3.4");
+    BADADDR("666.2.3.4");
+    BADADDR("1.666.3.4");
+    BADADDR("1.2.666.4");
+    BADADDR("1.2.3.666");
+
+    /*
+     * Parsing itself is covered by the tests above, here we only
+     * check trailers
+     */
+    CHECKADDREX("1.2.3.4",  "",   VINF_SUCCESS,           0x01020304);
+    CHECKADDREX("1.2.3.4",  " ",  VINF_SUCCESS,           0x01020304);
+    CHECKADDREX("1.2.3.4",  "x",  VINF_SUCCESS,           0x01020304);
+    CHECKADDREX("1.2.3.444", "",  VERR_INVALID_PARAMETER,          0);
+
+    return RTTestSummaryAndDestroy(hTest);
+}
diff --git a/src/VBox/Runtime/testcase/tstRTNetIPv6.cpp b/src/VBox/Runtime/testcase/tstRTNetIPv6.cpp
new file mode 100644
index 0000000..2878818
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTNetIPv6.cpp
@@ -0,0 +1,191 @@
+/* $Id: tstRTNetIPv6.cpp $ */
+/** @file
+ * IPRT Testcase - IPv6.
+ */
+
+/*
+ * Copyright (C) 2008-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/net.h>
+
+#include <iprt/err.h>
+#include <iprt/initterm.h>
+#include <iprt/test.h>
+
+#include <iprt/string.h>
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define CHECKADDR(String, rcExpected, u32_0, u32_1, u32_2, u32_3)       \
+    do {                                                                \
+        RTNETADDRIPV6 Addr;                                             \
+        char *pszZone;                                                  \
+        uint32_t ExpectedAddr[4] = {                                    \
+            RT_H2N_U32_C(u32_0), RT_H2N_U32_C(u32_1),                   \
+            RT_H2N_U32_C(u32_2), RT_H2N_U32_C(u32_3)                    \
+        };                                                              \
+        int rc2 = RTNetStrToIPv6Addr(String, &Addr, &pszZone);          \
+        if ((rcExpected) && !rc2)                                       \
+        {                                                               \
+            RTTestIFailed("at line %d: '%s': expected %Rrc got %Rrc\n", \
+                          __LINE__, String, (rcExpected), rc2);         \
+        }                                                               \
+        else if (   (rcExpected) != rc2                                 \
+                 || (   rc2 == VINF_SUCCESS                             \
+                     && memcmp(ExpectedAddr, &Addr, sizeof(Addr)) != 0)) \
+        {                                                               \
+            RTTestIFailed("at line %d: '%s': expected %Rrc got %Rrc,"   \
+                          " expected address %RTnaipv6 got %RTnaipv6\n", \
+                          __LINE__, String, rcExpected, rc2,            \
+                          ExpectedAddr, &Addr);                         \
+        }                                                               \
+    } while (0)
+
+#define GOODADDR(String, u32_0, u32_1, u32_2, u32_3) \
+    CHECKADDR(String, VINF_SUCCESS, u32_0, u32_1, u32_2, u32_3)
+
+#define BADADDR(String) \
+    CHECKADDR(String, VERR_INVALID_PARAMETER, 0, 0, 0, 0)
+
+
+int main()
+{
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("tstRTNetIPv6", &hTest);
+    if (rc)
+        return rc;
+    RTTestBanner(hTest);
+
+
+    /* base case: eight groups fully spelled */
+    GOODADDR("1:2:3:4:5:6:7:8", 0x00010002, 0x00030004, 0x00050006, 0x00070008);
+    GOODADDR("0001:0002:0003:0004:0005:0006:0007:0008", 0x00010002, 0x00030004, 0x00050006, 0x00070008);
+    GOODADDR("D:E:A:D:b:e:e:f", 0x000d000e, 0x000a000d, 0x000b000e, 0x000e000f);
+
+    /* ... too short or too long */
+    BADADDR("1:2:3:4:5:6:7");
+    BADADDR("1:2:3:4:5:6:7:8:9");
+
+    /* ... hex group constraints */
+    BADADDR("1:2:3:4:5:6:7:-8");
+    BADADDR("1:2:3:4:5:6:7:0x8");
+    BADADDR("1:2:3:4:5:6:7:88888");
+    BADADDR("1:2:3:4:5:6:7:00008");
+
+
+    /* embedded IPv4 at the end */
+    GOODADDR("0:0:0:0:0:0:1.2.3.4", 0, 0, 0, 0x01020304);
+
+    /* ... not at the end */
+    BADADDR("0:0:0:0:0:1.2.3.4:0");
+
+    /* ... too short or too long */
+    BADADDR("0:0:0:0:0:0:0:1.2.3.4");
+    BADADDR("0:0:0:0:0:1.2.3.4");
+
+    /* ... invalid IPv4 address */
+    BADADDR("0:0:0:0:0:0:111.222.333.444");
+
+
+    /* "any" in compressed form */
+    GOODADDR("::",  0, 0, 0, 0);
+
+    /* compressed run at the beginning */
+    GOODADDR("::8",                      0,          0,          0, 0x00000008);
+    GOODADDR("::7:8",                    0,          0,          0, 0x00070008);
+    GOODADDR("::6:7:8",                  0,          0, 0x00000006, 0x00070008);
+    GOODADDR("::5:6:7:8",                0,          0, 0x00050006, 0x00070008);
+    GOODADDR("::4:5:6:7:8",              0, 0x00000004, 0x00050006, 0x00070008);
+    GOODADDR("::3:4:5:6:7:8",            0, 0x00030004, 0x00050006, 0x00070008);
+    GOODADDR("::2:3:4:5:6:7:8", 0x00000002, 0x00030004, 0x00050006, 0x00070008);
+
+    /* ... too long */
+    BADADDR("::1:2:3:4:5:6:7:8");
+
+    /* compressed run at the end */
+    GOODADDR("1::",             0x00010000,          0,          0,          0);
+    GOODADDR("1:2::",           0x00010002,          0,          0,          0);
+    GOODADDR("1:2:3::",         0x00010002, 0x00030000,          0,          0);
+    GOODADDR("1:2:3:4::",       0x00010002, 0x00030004,          0,          0);
+    GOODADDR("1:2:3:4:5::",     0x00010002, 0x00030004, 0x00050000,          0);
+    GOODADDR("1:2:3:4:5:6::",   0x00010002, 0x00030004, 0x00050006,          0);
+    GOODADDR("1:2:3:4:5:6:7::", 0x00010002, 0x00030004, 0x00050006, 0x00070000);
+
+    /* ... too long */
+    BADADDR("1:2:3:4:5:6:7:8::");
+
+    /* compressed run in the middle  */
+    GOODADDR("1::8",            0x00010000,          0,          0, 0x00000008);
+    GOODADDR("1:2::8",          0x00010002,          0,          0, 0x00000008);
+    GOODADDR("1:2:3::8",        0x00010002, 0x00030000,          0, 0x00000008);
+    GOODADDR("1:2:3:4::8",      0x00010002, 0x00030004,          0, 0x00000008);
+    GOODADDR("1:2:3:4:5::8",    0x00010002, 0x00030004, 0x00050000, 0x00000008);
+    GOODADDR("1:2:3:4:5:6::8",  0x00010002, 0x00030004, 0x00050006, 0x00000008);
+
+    GOODADDR("1::7:8",          0x00010000,          0,          0, 0x00070008);
+    GOODADDR("1::6:7:8",        0x00010000,          0, 0x00000006, 0x00070008);
+    GOODADDR("1::5:6:7:8",      0x00010000,          0, 0x00050006, 0x00070008);
+    GOODADDR("1::4:5:6:7:8",    0x00010000, 0x00000004, 0x00050006, 0x00070008);
+    GOODADDR("1::3:4:5:6:7:8",  0x00010000, 0x00030004, 0x00050006, 0x00070008);
+
+    /* ... too long */
+    BADADDR("1::2:3:4:5:6:7:8");
+    BADADDR("1:2::3:4:5:6:7:8");
+    BADADDR("1:2:3::4:5:6:7:8");
+    BADADDR("1:2:3:4::5:6:7:8");
+    BADADDR("1:2:3:4:5::6:7:8");
+    BADADDR("1:2:3:4:5:6::7:8");
+    BADADDR("1:2:3:4:5:6:7::8");
+
+    /* compressed with embedded IPv4 */
+    GOODADDR("::0.0.0.0",        0, 0,          0,          0);
+    GOODADDR("::1.2.3.4",        0, 0,          0, 0x01020304);
+    GOODADDR("::ffff:1.2.3.4",   0, 0, 0x0000ffff, 0x01020304);
+    GOODADDR("::ffff:0:1.2.3.4", 0, 0, 0xffff0000, 0x01020304);
+
+    GOODADDR("1::1.2.3.4",         0x00010000,          0,          0, 0x01020304);
+    GOODADDR("1:2::1.2.3.4",       0x00010002,          0,          0, 0x01020304);
+    GOODADDR("1:2:3::1.2.3.4",     0x00010002, 0x00030000,          0, 0x01020304);
+    GOODADDR("1:2:3:4::1.2.3.4",   0x00010002, 0x00030004,          0, 0x01020304);
+    GOODADDR("1:2:3:4:5::1.2.3.4", 0x00010002, 0x00030004, 0x00050000, 0x01020304);
+
+    /* ... too long */
+    BADADDR("1:2:3:4:5:6::1.2.3.4");
+    BADADDR("1:2:3:4:5::6:1.2.3.4");
+    BADADDR("1:2:3:4::5:6:1.2.3.4");
+    BADADDR("1:2:3::4:5:6:1.2.3.4");
+    BADADDR("1:2::3:4:5:6:1.2.3.4");
+    BADADDR("1::2:3:4:5:6:1.2.3.4");
+
+    /* zone ids (beware, shaky ground) */
+    GOODADDR("ff01::1%0",      0xff010000, 0, 0, 1);
+    GOODADDR("ff01::1%eth0",   0xff010000, 0, 0, 1);
+    GOODADDR("ff01::1%net1.0", 0xff010000, 0, 0, 1);
+
+    GOODADDR(" ff01::1%net1.1\t", 0xff010000, 0, 0, 1);
+
+    return RTTestSummaryAndDestroy(hTest);
+}
diff --git a/src/VBox/Runtime/testcase/tstRTPath.cpp b/src/VBox/Runtime/testcase/tstRTPath.cpp
index 5986708..25538d0 100644
--- a/src/VBox/Runtime/testcase/tstRTPath.cpp
+++ b/src/VBox/Runtime/testcase/tstRTPath.cpp
@@ -597,9 +597,9 @@ int main()
         "D:\\",                 "D:\\",
         "D:\\/\\",              "D:\\",
         "D:/\\/\\",             "D:/",
-        "C:/Temp",              "D:/Temp",
-        "C:/Temp/",             "D:/Temp/",
-        "C:/Temp\\/",           "D:/Temp",
+        "C:/Temp",              "C:/Temp",
+        "C:/Temp/",             "C:/Temp",
+        "C:/Temp\\/",           "C:/Temp",
 #endif
     };
     for (unsigned i = 0; i < RT_ELEMENTS(s_apszStripTrailingSlash); i += 2)
@@ -704,9 +704,9 @@ int main()
 
 
     /*
-     * RTPathStripExt
+     * RTPathStripSuffix
      */
-    RTTestSub(hTest, "RTPathStripExt");
+    RTTestSub(hTest, "RTPathStripSuffix");
     struct
     {
         const char *pszSrc;
@@ -716,7 +716,7 @@ int main()
         { "filename.ext",               "filename" },
         { "filename.ext1.ext2.ext3",    "filename.ext1.ext2" },
         { "filename..ext",              "filename." },
-        { "filename.ext.",              "filename.ext" }, /** @todo This is a bit weird/wrong, but not half as weird as the way Windows+OS/2 deals with a trailing dots. */
+        { "filename.ext.",              "filename.ext." },
     };
     for (unsigned i = 0; i < RT_ELEMENTS(s_aStripExt); i++)
     {
@@ -724,7 +724,7 @@ int main()
         const char *pszResult   = s_aStripExt[i].pszResult;
 
         strcpy(szPath, pszInput);
-        RTPathStripExt(szPath);
+        RTPathStripSuffix(szPath);
         if (strcmp(szPath, pszResult))
             RTTestIFailed("Unexpected result\n"
                           "   input: '%s'\n"
@@ -747,8 +747,8 @@ int main()
     {
         { "/home/test.ext", "/home/test2.ext", VINF_SUCCESS, "test2.ext"},
         { "/dir/test.ext", "/dir/dir2/test2.ext", VINF_SUCCESS, "dir2/test2.ext"},
-        { "/dir/dir2/test.ext", "/dir/test2.ext", VINF_SUCCESS, "../test2.ext"},
-        { "/dir/dir2/test.ext", "/dir/dir3/test2.ext", VINF_SUCCESS, "../dir3/test2.ext"},
+        { "/dir/dir2/test.ext", "/dir/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "test2.ext"},
+        { "/dir/dir2/test.ext", "/dir/dir3/test2.ext", VINF_SUCCESS, ".." RTPATH_SLASH_STR "dir3/test2.ext"},
 #if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS)
         { "\\\\server\\share\\test.ext", "\\\\server\\share2\\test2.ext", VERR_NOT_SUPPORTED, ""},
         { "c:\\dir\\test.ext", "f:\\dir\\test.ext", VERR_NOT_SUPPORTED, ""}
diff --git a/src/VBox/Runtime/testcase/tstRTR0Thread.cpp b/src/VBox/Runtime/testcase/tstRTR0Thread.cpp
new file mode 100644
index 0000000..beebef0
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTR0Thread.cpp
@@ -0,0 +1,120 @@
+/* $Id: tstRTR0Thread.cpp $ */
+/** @file
+ * IPRT R0 Testcase - Kernel thread.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/thread.h>
+
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/err.h>
+#include <VBox/sup.h>
+#include "tstRTR0Thread.h"
+#include "tstRTR0Common.h"
+
+#define TSTRTR0THREADDATA_MAGIC             0xcececece
+
+/**
+ * State structure for tstRTR0ThreadCallback().
+ */
+typedef struct TSTRTR0THREADDATA
+{
+    /** The magic value. */
+    uint32_t                uMagic;
+    /** Sample counter.  */
+    uint32_t volatile       cCounter;
+    /** The thread handle. */
+    RTTHREAD                hThread;
+} TSTRTR0THREADDATA;
+/** Pointer to state structure for tstRTR0ThreadCallback(). */
+typedef TSTRTR0THREADDATA *PTSTRTR0THREADDATA;
+
+
+static DECLCALLBACK(int) tstRTR0ThreadCallback(RTTHREAD hThread, void *pvUser)
+{
+    PTSTRTR0THREADDATA pData = (PTSTRTR0THREADDATA)pvUser;
+    if (RT_LIKELY(pData))
+    {
+        if (pData->uMagic == TSTRTR0THREADDATA_MAGIC)
+            pData->uMagic = ~pData->uMagic;
+        if (pData->cCounter == 127)
+            pData->cCounter = 196;
+    }
+    RTThreadUserSignal(RTThreadSelf());
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Service request callback function.
+ *
+ * @returns VBox status code.
+ * @param   pSession    The caller's session.
+ * @param   u64Arg      64-bit integer argument.
+ * @param   pReqHdr     The request header. Input / Output. Optional.
+ */
+DECLEXPORT(int) TSTRTR0ThreadSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation,
+                                                   uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr)
+{
+    RTR0TESTR0_SRV_REQ_PROLOG_RET(pReqHdr);
+
+    /*
+     * The big switch.
+     */
+    switch (uOperation)
+    {
+        RTR0TESTR0_IMPLEMENT_SANITY_CASES();
+        RTR0TESTR0_IMPLEMENT_DEFAULT_CASE(uOperation);
+
+        case TSTRTR0THREAD_BASIC:
+        {
+            TSTRTR0THREADDATA Data;
+            RT_ZERO(Data);
+            Data.uMagic   = TSTRTR0THREADDATA_MAGIC;
+            Data.cCounter = 127;
+
+            /* Create the kernel thread. */
+            RTR0TESTR0_CHECK_RC_BREAK(RTThreadCreate(&Data.hThread, tstRTR0ThreadCallback, &Data, 0 /* cbStack */,
+                                                     RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "tstRTR0Thr"), VINF_SUCCESS);
+
+            /* Wait for thread to signal. */
+            RTR0TESTR0_CHECK_RC(RTThreadUserWait(Data.hThread, 500 /* ms */), VINF_SUCCESS);
+
+            /* Reset the semaphore. */
+            RTR0TESTR0_CHECK_RC(RTThreadUserReset(Data.hThread), VINF_SUCCESS);
+
+            /* Check if the thread has modified data as expected. */
+            RTR0TESTR0_CHECK_MSG_BREAK(Data.cCounter = 196 && Data.uMagic == ~TSTRTR0THREADDATA_MAGIC,
+                                       ("Thread didn't modify data as expected.\n"));
+            break;
+        }
+    }
+
+    RTR0TESTR0_SRV_REQ_EPILOG(pReqHdr);
+    /* The error indicator is the '!' in the message buffer. */
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Runtime/testcase/tstRTR0Thread.h b/src/VBox/Runtime/testcase/tstRTR0Thread.h
new file mode 100644
index 0000000..04c9211
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTR0Thread.h
@@ -0,0 +1,42 @@
+/* $Id: tstRTR0Thread.h $ */
+/** @file
+ * IPRT R0 Testcase - Kernel thread, common header.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#include "tstRTR0CommonReq.h"
+
+#ifdef IN_RING0
+RT_C_DECLS_BEGIN
+DECLEXPORT(int) TSTRTR0ThreadSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation, uint64_t u64Arg,
+                                           PSUPR0SERVICEREQHDR pReqHdr);
+RT_C_DECLS_END
+#endif
+
+typedef enum TSTR0THREAD
+{
+    TSTRTR0THREAD_SANITY_OK = RTTSTR0REQ_FIRST_USER,
+    TSTRTR0THREAD_SANITY_FAILURE,
+    TSTRTR0THREAD_BASIC
+} TSTR0THREAD;
+
diff --git a/src/VBox/Runtime/testcase/tstRTR0ThreadDriver.cpp b/src/VBox/Runtime/testcase/tstRTR0ThreadDriver.cpp
new file mode 100644
index 0000000..b190c1d
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTR0ThreadDriver.cpp
@@ -0,0 +1,80 @@
+/* $Id: tstRTR0ThreadDriver.cpp $ */
+/** @file
+ * IPRT R0 Testcase - Kernel thread, driver program.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/initterm.h>
+
+#include <iprt/err.h>
+#include <iprt/path.h>
+#include <iprt/param.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+#ifdef VBOX
+# include <VBox/sup.h>
+# include "tstRTR0Thread.h"
+#endif
+#include "tstRTR0CommonDriver.h"
+
+
+/**
+ *  Entry point.
+ */
+extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
+{
+#ifndef VBOX
+    RTPrintf("tstRTR0Thread: SKIPPED\n");
+    return RTEXITCODE_SKIPPED;
+#else
+    /*
+     * Init.
+     */
+    RTEXITCODE rcExit = RTR3TestR0CommonDriverInit("tstRTR0Thread");
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
+    RTR3TestR0SimpleTest(TSTRTR0THREAD_BASIC, "Basic");
+
+    /*
+     * Done.
+     */
+    return RTTestSummaryAndDestroy(g_hTest);
+#endif
+}
+
+
+#if !defined(VBOX_WITH_HARDENING) || !defined(RT_OS_WINDOWS)
+/**
+ * Main entry point.
+ */
+int main(int argc, char **argv, char **envp)
+{
+    return TrustedMain(argc, argv, envp);
+}
+#endif
+
diff --git a/src/VBox/Runtime/testcase/tstRTR0ThreadPreemption.cpp b/src/VBox/Runtime/testcase/tstRTR0ThreadPreemption.cpp
new file mode 100644
index 0000000..f8327c8
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTR0ThreadPreemption.cpp
@@ -0,0 +1,456 @@
+/* $Id: tstRTR0ThreadPreemption.cpp $ */
+/** @file
+ * IPRT R0 Testcase - Thread Preemption.
+ */
+
+/*
+ * Copyright (C) 2009-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/thread.h>
+
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/err.h>
+#include <iprt/mem.h>
+#include <iprt/time.h>
+#include <iprt/string.h>
+#include <VBox/sup.h>
+#include "tstRTR0ThreadPreemption.h"
+
+
+#define TSTRTR0THREADCTXDATA_MAGIC      0xc01a50da
+
+/**
+ * Thread-context hook data.
+ */
+typedef struct TSTRTR0THREADCTXDATA
+{
+    uint32_t volatile   u32Magic;
+    RTCPUID             uSourceCpuId;
+    RTNATIVETHREAD      hSourceThread;
+
+    /* For RTTHREADCTXEVENT_PREEMPTING. */
+    bool                fPreemptingSuccess;
+    volatile bool       fPreemptingInvoked;
+
+    /* For RTTHREADCTXEVENT_RESUMED. */
+    bool                fResumedSuccess;
+    volatile bool       fResumedInvoked;
+
+    char                achResult[512];
+} TSTRTR0THREADCTXDATA, *PTSTRTR0THREADCTXDATA;
+
+
+/**
+ * Thread-context hook function.
+ *
+ * @param   enmEvent    The thread-context event.
+ * @param   pvUser      Pointer to the user argument.
+ */
+static DECLCALLBACK(void) tstRTR0ThreadCtxHook(RTTHREADCTXEVENT enmEvent, void *pvUser)
+{
+    PTSTRTR0THREADCTXDATA pData = (PTSTRTR0THREADCTXDATA)pvUser;
+    AssertPtrReturnVoid(pData);
+
+    if (pData->u32Magic != TSTRTR0THREADCTXDATA_MAGIC)
+    {
+        RTStrPrintf(pData->achResult, sizeof(pData->achResult), "!tstRTR0ThreadCtxHook: Invalid magic.");
+        return;
+    }
+
+    switch (enmEvent)
+    {
+        case RTTHREADCTXEVENT_OUT:
+        {
+            ASMAtomicWriteBool(&pData->fPreemptingInvoked, true);
+
+            /* We've already been called once, we now might very well be on another CPU. Nothing to do here. */
+            if (pData->fPreemptingSuccess)
+                return;
+
+            if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
+            {
+                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
+                            "!tstRTR0ThreadCtxHook[RTTHREADCTXEVENT_PREEMPTING]: Called with preemption enabled");
+                break;
+            }
+
+            RTNATIVETHREAD hCurrentThread = RTThreadNativeSelf();
+            if (pData->hSourceThread != hCurrentThread)
+            {
+                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
+                            "!tstRTR0ThreadCtxHook[RTTHREADCTXEVENT_PREEMPTING]: Thread switched! Source=%RTnthrd Current=%RTnthrd.",
+                            pData->hSourceThread, hCurrentThread);
+                break;
+            }
+
+            RTCPUID uCurrentCpuId = RTMpCpuId();
+            if (pData->uSourceCpuId != uCurrentCpuId)
+            {
+                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
+                            "!tstRTR0ThreadCtxHook[RTTHREADCTXEVENT_PREEMPTING]: migrated uSourceCpuId=%RU32 uCurrentCpuId=%RU32",
+                            pData->uSourceCpuId, uCurrentCpuId);
+                break;
+            }
+
+            pData->fPreemptingSuccess = true;
+            break;
+        }
+
+        case RTTHREADCTXEVENT_IN:
+        {
+            ASMAtomicWriteBool(&pData->fResumedInvoked, true);
+
+            /* We've already been called once successfully, nothing more to do. */
+            if (ASMAtomicReadBool(&pData->fResumedSuccess))
+                return;
+
+            if (!pData->fPreemptingSuccess)
+            {
+                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
+                            "!tstRTR0ThreadCtxHook[RTTHREADCTXEVENT_RESUMED]: Called before preempting callback was invoked.");
+                break;
+            }
+
+            RTNATIVETHREAD hCurrentThread = RTThreadNativeSelf();
+            if (pData->hSourceThread != hCurrentThread)
+            {
+                RTStrPrintf(pData->achResult, sizeof(pData->achResult),
+                            "!tstRTR0ThreadCtxHook[RTTHREADCTXEVENT_RESUMED]: Thread switched! Source=%RTnthrd Current=%RTnthrd.",
+                            pData->hSourceThread, hCurrentThread);
+                break;
+            }
+
+            ASMAtomicWriteBool(&pData->fResumedSuccess, true);
+            break;
+        }
+
+        default:
+            AssertMsgFailed(("Invalid event %#x\n", enmEvent));
+            break;
+    }
+}
+
+
+/**
+ * Service request callback function.
+ *
+ * @returns VBox status code.
+ * @param   pSession    The caller's session.
+ * @param   u64Arg      64-bit integer argument.
+ * @param   pReqHdr     The request header. Input / Output. Optional.
+ */
+DECLEXPORT(int) TSTRTR0ThreadPreemptionSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation,
+                                                     uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr)
+{
+    NOREF(pSession);
+    if (u64Arg)
+        return VERR_INVALID_PARAMETER;
+    if (!VALID_PTR(pReqHdr))
+        return VERR_INVALID_PARAMETER;
+    char   *pszErr = (char *)(pReqHdr + 1);
+    size_t  cchErr = pReqHdr->cbReq - sizeof(*pReqHdr);
+    if (cchErr < 32 || cchErr >= 0x10000)
+        return VERR_INVALID_PARAMETER;
+    *pszErr = '\0';
+
+    /*
+     * The big switch.
+     */
+    switch (uOperation)
+    {
+        case TSTRTR0THREADPREEMPTION_SANITY_OK:
+            break;
+
+        case TSTRTR0THREADPREEMPTION_SANITY_FAILURE:
+            RTStrPrintf(pszErr, cchErr, "!42failure42%1024s", "");
+            break;
+
+        case TSTRTR0THREADPREEMPTION_BASIC:
+        {
+            if (!ASMIntAreEnabled())
+                RTStrPrintf(pszErr, cchErr, "!Interrupts disabled");
+            else if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
+                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns false by default");
+            else
+            {
+                RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER;
+                RTThreadPreemptDisable(&State);
+                if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
+                    RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after RTThreadPreemptDisable");
+                else if (!ASMIntAreEnabled())
+                    RTStrPrintf(pszErr, cchErr, "!Interrupts disabled");
+                RTThreadPreemptRestore(&State);
+            }
+            break;
+        }
+
+        case TSTRTR0THREADPREEMPTION_IS_TRUSTY:
+            if (!RTThreadPreemptIsPendingTrusty())
+                RTStrPrintf(pszErr, cchErr, "!Untrusty");
+            break;
+
+        case TSTRTR0THREADPREEMPTION_IS_PENDING:
+        {
+            RTTHREADPREEMPTSTATE State = RTTHREADPREEMPTSTATE_INITIALIZER;
+            RTThreadPreemptDisable(&State);
+            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
+            {
+#ifdef RT_OS_DARWIN
+                uint64_t const cNsMax = UINT64_C(8)*1000U*1000U*1000U;
+#else
+                uint64_t const cNsMax = UINT64_C(2)*1000U*1000U*1000U;
+#endif
+                if (ASMIntAreEnabled())
+                {
+                    uint64_t    u64StartTS    = RTTimeNanoTS();
+                    uint64_t    u64StartSysTS = RTTimeSystemNanoTS();
+                    uint64_t    cLoops        = 0;
+                    uint64_t    cNanosSysElapsed;
+                    uint64_t    cNanosElapsed;
+                    bool        fPending;
+                    do
+                    {
+                        fPending         = RTThreadPreemptIsPending(NIL_RTTHREAD);
+                        cNanosElapsed    = RTTimeNanoTS()       - u64StartTS;
+                        cNanosSysElapsed = RTTimeSystemNanoTS() - u64StartSysTS;
+                        cLoops++;
+                    } while (   !fPending
+                             && cNanosElapsed    < cNsMax
+                             && cNanosSysElapsed < cNsMax
+                             && cLoops           < 100U*_1M);
+                    if (!fPending)
+                        RTStrPrintf(pszErr, cchErr, "!Preempt not pending after %'llu loops / %'llu ns / %'llu ns (sys)",
+                                    cLoops, cNanosElapsed, cNanosSysElapsed);
+                    else if (cLoops == 1)
+                        RTStrPrintf(pszErr, cchErr, "!cLoops=1\n");
+                    else
+                        RTStrPrintf(pszErr, cchErr, "RTThreadPreemptIsPending returned true after %'llu loops / %'llu ns / %'llu ns (sys)",
+                                    cLoops, cNanosElapsed, cNanosSysElapsed);
+                }
+                else
+                    RTStrPrintf(pszErr, cchErr, "!Interrupts disabled");
+            }
+            else
+                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after RTThreadPreemptDisable");
+            RTThreadPreemptRestore(&State);
+            break;
+        }
+
+        case TSTRTR0THREADPREEMPTION_NESTED:
+        {
+            bool const fDefault = RTThreadPreemptIsEnabled(NIL_RTTHREAD);
+            RTTHREADPREEMPTSTATE State1 = RTTHREADPREEMPTSTATE_INITIALIZER;
+            RTThreadPreemptDisable(&State1);
+            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
+            {
+                RTTHREADPREEMPTSTATE State2 = RTTHREADPREEMPTSTATE_INITIALIZER;
+                RTThreadPreemptDisable(&State2);
+                if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
+                {
+                    RTTHREADPREEMPTSTATE State3 = RTTHREADPREEMPTSTATE_INITIALIZER;
+                    RTThreadPreemptDisable(&State3);
+                    if (RTThreadPreemptIsEnabled(NIL_RTTHREAD))
+                        RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 3rd RTThreadPreemptDisable");
+
+                    RTThreadPreemptRestore(&State3);
+                    if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)
+                        RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptRestore");
+                }
+                else
+                    RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 2nd RTThreadPreemptDisable");
+
+                RTThreadPreemptRestore(&State2);
+                if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) && !*pszErr)
+                    RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 2nd RTThreadPreemptRestore");
+            }
+            else
+                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns true after 1st RTThreadPreemptDisable");
+            RTThreadPreemptRestore(&State1);
+            if (RTThreadPreemptIsEnabled(NIL_RTTHREAD) != fDefault && !*pszErr)
+                RTStrPrintf(pszErr, cchErr, "!RTThreadPreemptIsEnabled returns false after 3rd RTThreadPreemptRestore");
+            break;
+        }
+
+        case TSTRTR0THREADPREEMPTION_CTXHOOKS:
+        {
+            if (!RTThreadPreemptIsEnabled(NIL_RTTHREAD))
+            {
+                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksCreate must be called with preemption enabled");
+                break;
+            }
+
+            bool fRegistered = RTThreadCtxHookIsEnabled(NIL_RTTHREADCTXHOOK);
+            if (fRegistered)
+            {
+                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHookIsEnabled returns true before creating any hooks");
+                break;
+            }
+
+            PTSTRTR0THREADCTXDATA pCtxData = (PTSTRTR0THREADCTXDATA)RTMemAllocZ(sizeof(*pCtxData));
+            AssertReturn(pCtxData, VERR_NO_MEMORY);
+            pCtxData->u32Magic           = TSTRTR0THREADCTXDATA_MAGIC;
+            pCtxData->fPreemptingSuccess = false;
+            pCtxData->fPreemptingInvoked = false;
+            pCtxData->fResumedInvoked    = false;
+            pCtxData->fResumedSuccess    = false;
+            pCtxData->hSourceThread      = RTThreadNativeSelf();
+            RT_ZERO(pCtxData->achResult);
+
+            RTTHREADCTXHOOK hThreadCtx;
+            int rc = RTThreadCtxHookCreate(&hThreadCtx, 0, tstRTR0ThreadCtxHook, pCtxData);
+            if (RT_FAILURE(rc))
+            {
+                if (rc == VERR_NOT_SUPPORTED)
+                    RTStrPrintf(pszErr, cchErr, "RTThreadCtxHooksCreate returns VERR_NOT_SUPPORTED");
+                else
+                    RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksCreate returns %Rrc", rc);
+                RTMemFree(pCtxData);
+                break;
+            }
+
+            fRegistered = RTThreadCtxHookIsEnabled(hThreadCtx);
+            if (fRegistered)
+            {
+                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHookIsEnabled returns true before registering any hooks");
+                RTThreadCtxHookDestroy(hThreadCtx);
+                break;
+            }
+
+            RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+            RTThreadPreemptDisable(&PreemptState);
+            Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+
+            pCtxData->uSourceCpuId       = RTMpCpuId();
+
+            rc = RTThreadCtxHookEnable(hThreadCtx);
+            if (RT_FAILURE(rc))
+            {
+                RTThreadPreemptRestore(&PreemptState);
+                RTMemFree(pCtxData);
+                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHookEnable returns %Rrc", rc);
+                break;
+            }
+
+            fRegistered = RTThreadCtxHookIsEnabled(hThreadCtx);
+            if (!fRegistered)
+            {
+                RTThreadPreemptRestore(&PreemptState);
+                RTMemFree(pCtxData);
+                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHookIsEnabled return false when hooks are supposedly registered");
+                break;
+            }
+
+            RTThreadPreemptRestore(&PreemptState);
+
+            /* Check if the preempting callback has/will been invoked. */
+            const uint32_t  cMsTimeout           = 10000;
+            const uint32_t  cMsSleepGranularity  = 50;
+            uint32_t        cMsSlept             = 0;
+            RTCPUID         uCurrentCpuId        = NIL_RTCPUID;
+            for (;;)
+            {
+                RTThreadYield();
+                RTThreadPreemptDisable(&PreemptState);
+                uCurrentCpuId = RTMpCpuId();
+                RTThreadPreemptRestore(&PreemptState);
+
+                if (   pCtxData->uSourceCpuId != uCurrentCpuId
+                    || cMsSlept >= cMsTimeout)
+                {
+                    break;
+                }
+
+                RTThreadSleep(cMsSleepGranularity);
+                cMsSlept += cMsSleepGranularity;
+            }
+
+            if (!ASMAtomicReadBool(&pCtxData->fPreemptingInvoked))
+            {
+                if (pCtxData->uSourceCpuId != uCurrentCpuId)
+                {
+                    RTStrPrintf(pszErr, cchErr,
+                                "!tstRTR0ThreadCtxHooks[RTTHREADCTXEVENT_PREEMPTING] not invoked before migrating from CPU %RU32 to %RU32",
+                                pCtxData->uSourceCpuId, uCurrentCpuId);
+                }
+                else
+                {
+                    RTStrPrintf(pszErr, cchErr, "!tstRTR0ThreadCtxHooks[RTTHREADCTXEVENT_PREEMPTING] not invoked after ca. %u ms",
+                                cMsSlept);
+                }
+            }
+            else if (!pCtxData->fPreemptingSuccess)
+                RTStrCopy(pszErr, cchErr, pCtxData->achResult);
+            else
+            {
+                /* Preempting callback succeeded, now check if the resumed callback has/will been invoked. */
+                cMsSlept = 0;
+                for (;;)
+                {
+                    if (   ASMAtomicReadBool(&pCtxData->fResumedInvoked)
+                        || cMsSlept >= cMsTimeout)
+                    {
+                        break;
+                    }
+
+                    RTThreadSleep(cMsSleepGranularity);
+                    cMsSlept += cMsSleepGranularity;
+                }
+
+                if (!ASMAtomicReadBool(&pCtxData->fResumedInvoked))
+                {
+                    RTStrPrintf(pszErr, cchErr, "!tstRTR0ThreadCtxHooks[RTTHREADCTXEVENT_RESUMED] not invoked after ca. %u ms",
+                                cMsSlept);
+                }
+                else if (!pCtxData->fResumedSuccess)
+                    RTStrCopy(pszErr, cchErr, pCtxData->achResult);
+            }
+
+            RTThreadCtxHookDisable(hThreadCtx);
+
+            fRegistered = RTThreadCtxHookIsEnabled(hThreadCtx);
+            if (fRegistered)
+            {
+                RTMemFree(pCtxData);
+                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHookIsEnabled return true when hooks are deregistered");
+                break;
+            }
+
+            Assert(RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+            rc = RTThreadCtxHookDestroy(hThreadCtx);
+            if (RT_FAILURE(rc))
+                RTStrPrintf(pszErr, cchErr, "!RTThreadCtxHooksRelease returns %Rrc!", rc);
+
+            RTMemFree(pCtxData);
+            break;
+        }
+
+        default:
+            RTStrPrintf(pszErr, cchErr, "!Unknown test #%d", uOperation);
+            break;
+    }
+
+    /* The error indicator is the '!' in the message buffer. */
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/Runtime/testcase/tstRTR0ThreadPreemption.h b/src/VBox/Runtime/testcase/tstRTR0ThreadPreemption.h
new file mode 100644
index 0000000..b59aa68
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTR0ThreadPreemption.h
@@ -0,0 +1,44 @@
+/* $Id: tstRTR0ThreadPreemption.h $ */
+/** @file
+ * IPRT R0 Testcase - Thread Preemption, common header.
+ */
+
+/*
+ * Copyright (C) 2009-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifdef IN_RING0
+RT_C_DECLS_BEGIN
+DECLEXPORT(int) TSTRTR0ThreadPreemptionSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation,
+                                                     uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr);
+RT_C_DECLS_END
+#endif
+
+typedef enum TSTRTR0THREADPREEMPTION
+{
+    TSTRTR0THREADPREEMPTION_SANITY_OK = 1,
+    TSTRTR0THREADPREEMPTION_SANITY_FAILURE,
+    TSTRTR0THREADPREEMPTION_BASIC,
+    TSTRTR0THREADPREEMPTION_IS_TRUSTY,
+    TSTRTR0THREADPREEMPTION_IS_PENDING,
+    TSTRTR0THREADPREEMPTION_NESTED,
+    TSTRTR0THREADPREEMPTION_CTXHOOKS
+} TSTRTR0THREADPREEMPTION;
+
diff --git a/src/VBox/Runtime/testcase/tstRTR0ThreadPreemptionDriver.cpp b/src/VBox/Runtime/testcase/tstRTR0ThreadPreemptionDriver.cpp
new file mode 100644
index 0000000..cfb9377
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTR0ThreadPreemptionDriver.cpp
@@ -0,0 +1,301 @@
+/* $Id: tstRTR0ThreadPreemptionDriver.cpp $ */
+/** @file
+ * IPRT R0 Testcase - Thread Preemption, driver program.
+ */
+
+/*
+ * Copyright (C) 2009-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/initterm.h>
+
+#include <iprt/asm.h>
+#include <iprt/cpuset.h>
+#include <iprt/err.h>
+#include <iprt/path.h>
+#include <iprt/param.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+#include <iprt/time.h>
+#include <iprt/thread.h>
+#ifdef VBOX
+# include <VBox/sup.h>
+# include "tstRTR0ThreadPreemption.h"
+#endif
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+static bool volatile g_fTerminate = false;
+
+
+/**
+ * Try make sure all online CPUs will be engaged.
+ */
+static DECLCALLBACK(int) MyThreadProc(RTTHREAD hSelf, void *pvCpuIdx)
+{
+    RTCPUSET Affinity;
+    RTCpuSetEmpty(&Affinity);
+    RTCpuSetAddByIndex(&Affinity, (intptr_t)pvCpuIdx);
+    RTThreadSetAffinity(&Affinity); /* ignore return code as it's not supported on all hosts. */
+
+    while (!g_fTerminate)
+    {
+        uint64_t tsStart = RTTimeMilliTS();
+        do
+        {
+            ASMNopPause();
+        } while (RTTimeMilliTS() - tsStart < 8);
+        RTThreadSleep(4);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ *  Entry point.
+ */
+extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
+{
+#ifndef VBOX
+    RTPrintf("tstSup: SKIPPED\n");
+    return 0;
+#else
+    /*
+     * Init.
+     */
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("tstRTR0ThreadPreemption", &hTest);
+    if (rc)
+        return rc;
+    RTTestBanner(hTest);
+
+    PSUPDRVSESSION pSession;
+    rc = SUPR3Init(&pSession);
+    if (RT_FAILURE(rc))
+    {
+        RTTestFailed(hTest, "SUPR3Init failed with rc=%Rrc\n", rc);
+        return RTTestSummaryAndDestroy(hTest);
+    }
+
+    char szPath[RTPATH_MAX];
+    rc = RTPathExecDir(szPath, sizeof(szPath));
+    if (RT_SUCCESS(rc))
+        rc = RTPathAppend(szPath, sizeof(szPath), "tstRTR0ThreadPreemption.r0");
+    if (RT_FAILURE(rc))
+    {
+        RTTestFailed(hTest, "Failed constructing .r0 filename (rc=%Rrc)", rc);
+        return RTTestSummaryAndDestroy(hTest);
+    }
+
+    void *pvImageBase;
+    rc = SUPR3LoadServiceModule(szPath, "tstRTR0ThreadPreemption",
+                                "TSTRTR0ThreadPreemptionSrvReqHandler",
+                                &pvImageBase);
+    if (RT_FAILURE(rc))
+    {
+        RTTestFailed(hTest, "SUPR3LoadServiceModule(%s,,,) failed with rc=%Rrc\n", szPath, rc);
+        return RTTestSummaryAndDestroy(hTest);
+    }
+
+    /* test request */
+    struct
+    {
+        SUPR0SERVICEREQHDR  Hdr;
+        char                szMsg[256];
+    } Req;
+
+    /*
+     * Sanity checks.
+     */
+    RTTestSub(hTest, "Sanity");
+    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
+    Req.Hdr.cbReq = sizeof(Req);
+    Req.szMsg[0] = '\0';
+    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstRTR0ThreadPreemption", sizeof("tstRTR0ThreadPreemption") - 1,
+                                             TSTRTR0THREADPREEMPTION_SANITY_OK, 0, &Req.Hdr), VINF_SUCCESS);
+    if (RT_FAILURE(rc))
+        return RTTestSummaryAndDestroy(hTest);
+    RTTESTI_CHECK_MSG(Req.szMsg[0] == '\0', ("%s", Req.szMsg));
+    if (Req.szMsg[0] != '\0')
+        return RTTestSummaryAndDestroy(hTest);
+
+    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
+    Req.Hdr.cbReq = sizeof(Req);
+    Req.szMsg[0] = '\0';
+    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstRTR0ThreadPreemption", sizeof("tstRTR0ThreadPreemption") - 1,
+                                             TSTRTR0THREADPREEMPTION_SANITY_FAILURE, 0, &Req.Hdr), VINF_SUCCESS);
+    if (RT_FAILURE(rc))
+        return RTTestSummaryAndDestroy(hTest);
+    RTTESTI_CHECK_MSG(!strncmp(Req.szMsg, RT_STR_TUPLE("!42failure42")), ("%s", Req.szMsg));
+    if (strncmp(Req.szMsg, RT_STR_TUPLE("!42failure42")))
+        return RTTestSummaryAndDestroy(hTest);
+
+    /*
+     * Basic tests, bail out on failure.
+     */
+    RTTestSub(hTest, "Basics");
+    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
+    Req.Hdr.cbReq = sizeof(Req);
+    Req.szMsg[0] = '\0';
+    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstRTR0ThreadPreemption", sizeof("tstRTR0ThreadPreemption") - 1,
+                                             TSTRTR0THREADPREEMPTION_BASIC, 0, &Req.Hdr), VINF_SUCCESS);
+    if (RT_FAILURE(rc))
+        return RTTestSummaryAndDestroy(hTest);
+    if (Req.szMsg[0] == '!')
+    {
+        RTTestIFailed("%s", &Req.szMsg[1]);
+        return RTTestSummaryAndDestroy(hTest);
+    }
+    if (Req.szMsg[0])
+        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
+
+    /*
+     * Is it trusty.
+     */
+    RTTestSub(hTest, "RTThreadPreemptIsPendingTrusty");
+    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
+    Req.Hdr.cbReq = sizeof(Req);
+    Req.szMsg[0] = '\0';
+    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstRTR0ThreadPreemption", sizeof("tstRTR0ThreadPreemption") - 1,
+                                             TSTRTR0THREADPREEMPTION_IS_TRUSTY, 0, &Req.Hdr), VINF_SUCCESS);
+    if (RT_FAILURE(rc))
+        return RTTestSummaryAndDestroy(hTest);
+    if (Req.szMsg[0] == '!')
+        RTTestIFailed("%s", &Req.szMsg[1]);
+    else if (Req.szMsg[0])
+        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
+
+    /*
+     * Stay in ring-0 until preemption is pending.
+     */
+    RTTHREAD ahThreads[RTCPUSET_MAX_CPUS];
+    uint32_t cThreads = RTMpGetCount();
+    RTCPUSET OnlineSet;
+    RTMpGetOnlineSet(&OnlineSet);
+    for (uint32_t i = 0; i < RT_ELEMENTS(ahThreads); i++)
+    {
+        ahThreads[i] = NIL_RTTHREAD;
+        if (RTCpuSetIsMemberByIndex(&OnlineSet, i))
+            RTThreadCreateF(&ahThreads[i], MyThreadProc, (void *)(uintptr_t)i, 0, RTTHREADTYPE_DEFAULT,
+                            RTTHREADFLAGS_WAITABLE, "cpu=%u", i);
+    }
+
+
+    RTTestSub(hTest, "Pending Preemption");
+    RTThreadSleep(250); /** @todo fix GIP initialization? */
+    for (int i = 0; ; i++)
+    {
+        Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
+        Req.Hdr.cbReq = sizeof(Req);
+        Req.szMsg[0] = '\0';
+        RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstRTR0ThreadPreemption", sizeof("tstRTR0ThreadPreemption") - 1,
+                                                 TSTRTR0THREADPREEMPTION_IS_PENDING, 0, &Req.Hdr), VINF_SUCCESS);
+        if (    strcmp(Req.szMsg, "!cLoops=1\n")
+            ||  i >= 64)
+        {
+            if (Req.szMsg[0] == '!')
+                RTTestIFailed("%s", &Req.szMsg[1]);
+            else if (Req.szMsg[0])
+                RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
+            break;
+        }
+        if ((i % 3) == 0)
+            RTThreadYield();
+        else if ((i % 16) == 0)
+            RTThreadSleep(8);
+    }
+
+    ASMAtomicWriteBool(&g_fTerminate, true);
+    for (uint32_t i = 0; i < RT_ELEMENTS(ahThreads); i++)
+        if (ahThreads[i] != NIL_RTTHREAD)
+            RTThreadWait(ahThreads[i], 5000, NULL);
+
+    /*
+     * Test nested RTThreadPreemptDisable calls.
+     */
+    RTTestSub(hTest, "Nested");
+    Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
+    Req.Hdr.cbReq = sizeof(Req);
+    Req.szMsg[0] = '\0';
+    RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstRTR0ThreadPreemption", sizeof("tstRTR0ThreadPreemption") - 1,
+                                             TSTRTR0THREADPREEMPTION_NESTED, 0, &Req.Hdr), VINF_SUCCESS);
+    if (Req.szMsg[0] == '!')
+        RTTestIFailed("%s", &Req.szMsg[1]);
+    else if (Req.szMsg[0])
+        RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
+
+
+    /*
+     * Test thread-context hooks.
+     */
+    RTTestSub(hTest, "RTThreadCtxHooks");
+    uint64_t u64StartTS = RTTimeMilliTS();
+    uint64_t cMsMax     = 60000;        /* ca. 1 minute timeout. */
+    uint64_t cMsElapsed;
+    for (unsigned i = 0; i < 50; i++)
+    {
+        Req.Hdr.u32Magic = SUPR0SERVICEREQHDR_MAGIC;
+        Req.Hdr.cbReq = sizeof(Req);
+        Req.szMsg[0] = '\0';
+        RTTESTI_CHECK_RC(rc = SUPR3CallR0Service("tstRTR0ThreadPreemption", sizeof("tstRTR0ThreadPreemption") - 1,
+                                                 TSTRTR0THREADPREEMPTION_CTXHOOKS, 0, &Req.Hdr), VINF_SUCCESS);
+        if (RT_FAILURE(rc))
+            return RTTestSummaryAndDestroy(hTest);
+        if (Req.szMsg[0] == '!')
+            RTTestIFailed("%s", &Req.szMsg[1]);
+        else if (Req.szMsg[0])
+            RTTestIPrintf(RTTESTLVL_ALWAYS, "%s", Req.szMsg);
+        if (!(i % 10))
+            RTTestIPrintf(RTTESTLVL_ALWAYS, "RTThreadCtxHooks passed %u iteration(s)\n", i);
+
+        /* Check timeout and bail. */
+        cMsElapsed = RTTimeMilliTS() - u64StartTS;
+        if (cMsElapsed > cMsMax)
+        {
+            RTTestIPrintf(RTTESTLVL_INFO, "RTThreadCtxHooks Stopping iterations. %RU64 ms. for %u iterations.\n",
+                          cMsElapsed, i);
+            break;
+        }
+    }
+
+    /*
+     * Done.
+     */
+    return RTTestSummaryAndDestroy(hTest);
+#endif
+}
+
+
+#if !defined(VBOX_WITH_HARDENING) || !defined(RT_OS_WINDOWS)
+/**
+ * Main entry point.
+ */
+int main(int argc, char **argv, char **envp)
+{
+    return TrustedMain(argc, argv, envp);
+}
+#endif
+
diff --git a/src/VBox/Runtime/testcase/tstRTR0Timer.cpp b/src/VBox/Runtime/testcase/tstRTR0Timer.cpp
index ad41354..db48468 100644
--- a/src/VBox/Runtime/testcase/tstRTR0Timer.cpp
+++ b/src/VBox/Runtime/testcase/tstRTR0Timer.cpp
@@ -486,7 +486,7 @@ DECLEXPORT(int) TSTRTR0TimerSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOpe
             break;
         }
 
-#if 1 /* might have to disable this for some host... */
+#if !defined(RT_OS_SOLARIS) /* Not expected to work on all hosts. */
         case TSTRTR0TIMER_ONE_SHOT_RESTART:
         case TSTRTR0TIMER_ONE_SHOT_RESTART_HIRES:
         {
@@ -519,7 +519,7 @@ DECLEXPORT(int) TSTRTR0TimerSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOpe
         }
 #endif
 
-#if 1 /* might have to disable this for some host... */
+#if !defined(RT_OS_SOLARIS) && !defined(RT_OS_WINDOWS) /* Not expected to work on all hosts. */
         case TSTRTR0TIMER_ONE_SHOT_DESTROY:
         case TSTRTR0TIMER_ONE_SHOT_DESTROY_HIRES:
         {
@@ -888,7 +888,6 @@ DECLEXPORT(int) TSTRTR0TimerSrvReqHandler(PSUPDRVSESSION pSession, uint32_t uOpe
                 RTThreadSleep(2);
 
             RTR0TESTR0_CHECK_RC_BREAK(RTTimerStop(pTimer), VINF_SUCCESS);
-            uint64_t    cNsElapsedX = RTTimeNanoTS() - uStartNsTS;
 
             /*
              * Process the result.
diff --git a/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp b/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp
index dbee05d..aa55fab 100644
--- a/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp
+++ b/src/VBox/Runtime/testcase/tstRTR0TimerDriver.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2010 Oracle Corporation
+ * Copyright (C) 2009-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/testcase/tstRTSymlink.cpp b/src/VBox/Runtime/testcase/tstRTSymlink.cpp
index 46188ec..dd852ec 100644
--- a/src/VBox/Runtime/testcase/tstRTSymlink.cpp
+++ b/src/VBox/Runtime/testcase/tstRTSymlink.cpp
@@ -47,6 +47,21 @@ static void test1Worker(RTTEST hTest, const char *pszBaseDir,
     char    szPath1[RTPATH_MAX];
     char    szPath2[RTPATH_MAX];
     size_t  cchTarget = strlen(pszTarget);
+    char    szPath3[RTPATH_MAX];
+
+    RTStrCopy(szPath3, sizeof(szPath3), pszTarget);
+
+#ifdef RT_OS_WINDOWS
+    /* see RTSymlinkCreate in symlink-win.cpp */
+    char c;
+    char *psz = szPath3;
+    while ((c = *psz) != '\0')
+    {
+        if (c == '/')
+            *psz = '\\';
+        psz++;
+    }
+#endif
 
     /* Create it.*/
     RTTESTI_CHECK_RC_OK_RETV(RTPathJoin(szPath1, sizeof(szPath1), pszBaseDir, "tstRTSymlink-link-1"));
@@ -61,19 +76,19 @@ static void test1Worker(RTTEST hTest, const char *pszBaseDir,
     memset(szPath2, 0xff, sizeof(szPath2));
     szPath2[sizeof(szPath2) - 1] = '\0';
     RTTESTI_CHECK_RC(RTSymlinkRead(szPath1, szPath2, sizeof(szPath2), 0), VINF_SUCCESS);
-    RTTESTI_CHECK_MSG(strcmp(szPath2, pszTarget) == 0, ("got=\"%s\" expected=\"%s\"", szPath2, pszTarget));
+    RTTESTI_CHECK_MSG(strcmp(szPath2, szPath3) == 0, ("got=\"%s\" expected=\"%s\"", szPath2, szPath3));
 
     memset(szPath2, 0xff, sizeof(szPath2));
     szPath2[sizeof(szPath2) - 1] = '\0';
     RTTESTI_CHECK_RC(RTSymlinkRead(szPath1, szPath2, cchTarget + 1, 0), VINF_SUCCESS);
-    RTTESTI_CHECK_MSG(strcmp(szPath2, pszTarget) == 0, ("got=\"%s\" expected=\"%s\"", szPath2, pszTarget));
+    RTTESTI_CHECK_MSG(strcmp(szPath2, szPath3) == 0, ("got=\"%s\" expected=\"%s\"", szPath2, szPath3));
 
     memset(szPath2, 0xff, sizeof(szPath2));
     szPath2[sizeof(szPath2) - 1] = '\0';
     RTTESTI_CHECK_RC(RTSymlinkRead(szPath1, szPath2, cchTarget, 0), VERR_BUFFER_OVERFLOW);
-    RTTESTI_CHECK_MSG(   strncmp(szPath2, pszTarget, cchTarget - 1) == 0
+    RTTESTI_CHECK_MSG(   strncmp(szPath2, szPath3, cchTarget - 1) == 0
                       && szPath2[cchTarget - 1] == '\0',
-                      ("got=\"%s\" expected=\"%.*s\"", szPath2, cchTarget - 1, pszTarget));
+                      ("got=\"%s\" expected=\"%.*s\"", szPath2, cchTarget - 1, szPath3));
 
     /* Other APIs that have to handle symlinks carefully. */
     int rc;
diff --git a/src/VBox/Runtime/testcase/tstRTTcp-1.cpp b/src/VBox/Runtime/testcase/tstRTTcp-1.cpp
index 1ee7c15..fba5a89 100644
--- a/src/VBox/Runtime/testcase/tstRTTcp-1.cpp
+++ b/src/VBox/Runtime/testcase/tstRTTcp-1.cpp
@@ -1,3 +1,30 @@
+/* $Id: tstRTTcp-1.cpp $ */
+/** @file
+ * IPRT testcase - TCP.
+ */
+
+/*
+ * Copyright (C) 2010-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
 #include <iprt/tcp.h>
 
 #include <iprt/string.h>
diff --git a/src/VBox/Runtime/testcase/tstRTTime.cpp b/src/VBox/Runtime/testcase/tstRTTime.cpp
index 302acc7..b76f3b6 100644
--- a/src/VBox/Runtime/testcase/tstRTTime.cpp
+++ b/src/VBox/Runtime/testcase/tstRTTime.cpp
@@ -97,7 +97,10 @@ int main()
                      u64OSElapsedTS, u64RTElapsedTS, u64OSElapsedTS - u64RTElapsedTS);
     else
     {
-        RTTestValue(hTest, "Total time delta", u64OSElapsedTS - u64RTElapsedTS, RTTESTUNIT_NS);
+        if (u64OSElapsedTS >= u64RTElapsedTS)
+            RTTestValue(hTest, "Total time delta", u64OSElapsedTS - u64RTElapsedTS, RTTESTUNIT_NS);
+        else
+            RTTestValue(hTest, "Total time delta", u64RTElapsedTS - u64OSElapsedTS, RTTESTUNIT_NS);
         RTTestPrintf(hTest, RTTESTLVL_INFO, "total time difference: u64OSElapsedTS=%#llx u64RTElapsedTS=%#llx delta=%lld\n",
                      u64OSElapsedTS, u64RTElapsedTS, u64OSElapsedTS - u64RTElapsedTS);
     }
diff --git a/src/VBox/Runtime/testcase/tstRTZip.cpp b/src/VBox/Runtime/testcase/tstRTZip.cpp
new file mode 100644
index 0000000..a2a9e00
--- /dev/null
+++ b/src/VBox/Runtime/testcase/tstRTZip.cpp
@@ -0,0 +1,87 @@
+/* $Id: tstRTZip.cpp $ */
+/** @file
+ * IPRT Testcase - RTZip, kind of.
+ */
+
+/*
+ * Copyright (C) 2010-2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/zip.h>
+
+#include <iprt/env.h>
+#include <iprt/err.h>
+#include <iprt/initterm.h>
+#include <iprt/file.h>
+#include <iprt/mem.h>
+#include <iprt/message.h>
+#include <iprt/param.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+
+
+static void testFile(const char *pszFilename)
+{
+    size_t  cbSrcActually = 0;
+    void   *pvSrc;
+    size_t  cbSrc;
+    int rc = RTFileReadAll(pszFilename, &pvSrc, &cbSrc);
+    RTTESTI_CHECK_RC_OK_RETV(rc);
+
+    size_t  cbDstActually = 0;
+    size_t  cbDst = RT_MAX(cbSrc * 8, _1M);
+    void   *pvDst = RTMemAllocZ(cbDst);
+
+    rc = RTZipBlockDecompress(RTZIPTYPE_ZLIB, 0, pvSrc, cbSrc, &cbSrcActually, pvDst, cbDst, &cbDstActually);
+    RTTestIPrintf(RTTESTLVL_ALWAYS, "cbSrc=%zu cbSrcActually=%zu cbDst=%zu cbDstActually=%zu rc=%Rrc\n",
+                  cbSrc, cbSrcActually, cbDst, cbDstActually, rc);
+    RTTESTI_CHECK_RC_OK(rc);
+
+}
+
+
+int main(int argc, char **argv)
+{
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("tstRTZip", &hTest);
+    if (rc)
+        return rc;
+    RTTestBanner(hTest);
+
+    if (argc > 1)
+    {
+        for (int i = 1; i < argc; i++)
+            testFile(argv[i]);
+    }
+    else
+    {
+        /** @todo testcase */
+    }
+
+    /*
+     * Summary.
+     */
+    return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/Runtime/testcase/tstUtf8.cpp b/src/VBox/Runtime/testcase/tstUtf8.cpp
index 7f81f10..8bbe882 100644
--- a/src/VBox/Runtime/testcase/tstUtf8.cpp
+++ b/src/VBox/Runtime/testcase/tstUtf8.cpp
@@ -308,17 +308,12 @@ int mymemcmp(const void *pv1, const void *pv2, size_t cb, int cBits)
         {
             RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, "mismatch at %#x: ", off);
             whereami(cBits, off);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off-1, pb1[off-1], pb2[off-1]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, "*%#x: %02x != %02x!\n", off, pb1[off], pb2[off]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+1, pb1[off+1], pb2[off+1]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+2, pb1[off+2], pb2[off+2]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+3, pb1[off+3], pb2[off+3]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+4, pb1[off+4], pb2[off+4]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+5, pb1[off+5], pb2[off+5]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+6, pb1[off+6], pb2[off+6]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+7, pb1[off+7], pb2[off+7]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+8, pb1[off+8], pb2[off+8]);
-            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+9, pb1[off+9], pb2[off+9]);
+            if (off > 0)
+                RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off-1, pb1[off-1], pb2[off-1]);
+            RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, "*%#x: %02x != %02x!\n", off,   pb1[off], pb2[off]);
+            for (size_t i = 1; i < 10; i++)
+                if (off + i < cb)
+                    RTTestPrintf(NIL_RTTEST, RTTESTLVL_FAILURE, " %#x: %02x != %02x!\n", off+i, pb1[off+i], pb2[off+i]);
             return 1;
         }
     }
@@ -429,6 +424,7 @@ void test2(RTTEST hTest)
     int rc = RTUtf16ToUtf8(&g_wszAll[0], &pszUtf8);
     if (rc == VINF_SUCCESS)
     {
+        pszUtf8[0] = 1;
         if (mymemcmp(pszUtf8, g_szAll, sizeof(g_szAll), 8))
             RTTestFailed(hTest, "UTF-16 -> UTF-8 mismatch!");
 
diff --git a/src/VBox/Runtime/tools/Makefile.kmk b/src/VBox/Runtime/tools/Makefile.kmk
index 40f0592..bc05a7f 100644
--- a/src/VBox/Runtime/tools/Makefile.kmk
+++ b/src/VBox/Runtime/tools/Makefile.kmk
@@ -74,7 +74,7 @@ if !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS) && !defined(VBOX_ONLY_VALIDATIONKIT)
 
  # RTUnzip - our unzip clone (for testing the unzip streaming code)
  PROGRAMS += RTUnzip
- RTUnzip_TEMPLATE = VBOXR3TSTEXE
+ RTUnzip_TEMPLATE = VBoxR3Tool
  RTUnzip_SOURCES = RTUnzip.cpp
 
  # RTNtDbgHelp - our tar clone (for testing the tar/gzip/gunzip streaming code)
@@ -82,19 +82,17 @@ if !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS) && !defined(VBOX_ONLY_VALIDATIONKIT)
  RTNtDbgHelp_TEMPLATE = VBoxR3Tool
  RTNtDbgHelp_SOURCES = RTNtDbgHelp.cpp
 
+ # RTDbgSymCache - Symbol cache manager.
+ PROGRAMS += RTDbgSymCache
+ RTDbgSymCache_TEMPLATE = VBoxR3Tool
+ RTDbgSymCache_SOURCES = RTDbgSymCache.cpp
+
  # RTSignTool - Signing utility.
  PROGRAMS += RTSignTool
  RTSignTool_TEMPLATE = VBoxR3Tool
  RTSignTool_SOURCES = RTSignTool.cpp
  RTSignTool_LIBS = $(PATH_STAGE_LIB)/SUPR3$(VBOX_SUFF_LIB)
 
- if 0 # disabled due to missing backports.
- # RTDbgSymCache - Symbol cache manager.
- PROGRAMS += RTDbgSymCache
- RTDbgSymCache_TEMPLATE = VBoxR3Tool
- RTDbgSymCache_SOURCES = RTDbgSymCache.cpp
- endif
-
 endif # !VBOX_ONLY_EXTPACKS_USE_IMPLIBS
 
 include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/Runtime/tools/RTDbgSymCache.cpp b/src/VBox/Runtime/tools/RTDbgSymCache.cpp
index f08616c..030f253 100644
--- a/src/VBox/Runtime/tools/RTDbgSymCache.cpp
+++ b/src/VBox/Runtime/tools/RTDbgSymCache.cpp
@@ -31,7 +31,9 @@
 #include <iprt/zip.h>
 
 #include <iprt/buildconfig.h>
+#include <iprt/dbg.h>
 #include <iprt/file.h>
+#include <iprt/formats/mach-o.h>
 #include <iprt/getopt.h>
 #include <iprt/initterm.h>
 #include <iprt/ldr.h>
@@ -40,10 +42,9 @@
 #include <iprt/path.h>
 #include <iprt/stream.h>
 #include <iprt/string.h>
+#include <iprt/uuid.h>
 #include <iprt/vfs.h>
 #include <iprt/zip.h>
-#include <iprt/uuid.h>
-#include <iprt/formats/mach-o.h>
 
 
 /*******************************************************************************
@@ -71,6 +72,7 @@ typedef enum RTDBGSYMCACHEFILETYPE
 typedef struct RTDBGSYMCACHEADDCFG
 {
     bool        fRecursive;
+    bool        fOverwriteOnConflict;
     const char *pszFilter;
     const char *pszCache;
 } RTDBGSYMCACHEADDCFG;
@@ -141,6 +143,12 @@ static const char * const g_apszDSymBundleSuffixes[] =
 };
 
 
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static int rtDbgSymCacheAddDirWorker(char *pszPath, size_t cchPath, PRTDIRENTRYEX pDirEntry, PCRTDBGSYMCACHEADDCFG pCfg);
+
+
 
 /**
  * Display the version of the cache program.
@@ -164,7 +172,7 @@ static RTEXITCODE rtDbgSymCacheVersion(void)
 static RTEXITCODE rtDbgSymCacheUsage(const char *pszArg0, const char *pszCommand)
 {
     if (!pszCommand || !strcmp(pszCommand, "add"))
-        RTPrintf("Usage: %s add [-rn] <cache-root-dir> <file1> [fileN..]\n", pszArg0);
+        RTPrintf("Usage: %s add [-Rno] <cache-root-dir> <file1> [fileN..]\n", pszArg0);
     return RTEXITCODE_SUCCESS;
 }
 
@@ -218,7 +226,7 @@ static int rtDbgSymCacheAddCreateUuidMapping(const char *pszCacheFile, PRTUUID p
         szMapPath[cch] = '\0';
         if (!RTDirExists(szMapPath))
         {
-            rc = RTDirCreate(szMapPath, 0755, 0/*fFlags*/);
+            rc = RTDirCreate(szMapPath, 0755, RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_NOT_CRITICAL);
             if (RT_FAILURE(rc))
                 return RTMsgErrorRc(rc, "RTDirCreate failed on '%s' (UUID map path): %Rrc", szMapPath, rc);
         }
@@ -321,7 +329,7 @@ static int rtDbgSymCacheAddOneFile(const char *pszSrcPath, const char *pszDstNam
 
     if (!RTDirExists(szDstPath))
     {
-        rc = RTDirCreate(szDstPath, 0755, 0 /*fFlags*/);
+        rc = RTDirCreate(szDstPath, 0755, RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_NOT_CRITICAL);
         if (RT_FAILURE(rc))
             return RTMsgErrorRc(rc, "Error creating '%s': %Rrc", szDstPath, rc);
     }
@@ -332,7 +340,7 @@ static int rtDbgSymCacheAddOneFile(const char *pszSrcPath, const char *pszDstNam
 
     if (!RTDirExists(szDstPath))
     {
-        rc = RTDirCreate(szDstPath, 0755, 0 /*fFlags*/);
+        rc = RTDirCreate(szDstPath, 0755, RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_NOT_CRITICAL);
         if (RT_FAILURE(rc))
             return RTMsgErrorRc(rc, "Error creating '%s': %Rrc", szDstPath, rc);
     }
@@ -364,7 +372,8 @@ static int rtDbgSymCacheAddOneFile(const char *pszSrcPath, const char *pszDstNam
             RTMsgInfo("Cache conflict with existing entry '%s' when inserting '%s'.", szDstPath, pszSrcPath);
         else
             RTMsgInfo("Error comparing '%s' with '%s': %Rrc", pszSrcPath, szDstPath, rc);
-        return rc;
+        if (!pCfg->fOverwriteOnConflict)
+            return rc;
     }
 
     /*
@@ -663,31 +672,44 @@ static int rtDbgSymCacheAddDebugFile(const char *pszPath, PCRTDBGSYMCACHEADDCFG
 static int rtDbgSymCacheConstructBundlePath(char *pszPath, size_t cchPath, size_t cchName, const char *pszSubDir,
                                             const char * const *papszSuffixes)
 {
-    int rc = RTPathAppend(pszPath, RTPATH_MAX, pszSubDir);
-    if (RT_SUCCESS(rc))
+    /*
+     * Calc the name without the bundle extension.
+     */
+    size_t const cchOrgName = cchName;
+    const char  *pszEnd     = &pszPath[cchPath + cchName];
+    for (unsigned i = 0; papszSuffixes[i]; i++)
     {
-        /* Strip off the bundle suffix. */
-        const char *pszEnd = &pszPath[cchPath + cchName];
-        for (unsigned i = 0; papszSuffixes[i]; i++)
+        Assert(papszSuffixes[i][0] == '.');
+        size_t cchSuff = strlen(papszSuffixes[i]);
+        if (   cchSuff < cchName
+            && !memcmp(&pszEnd[-(ssize_t)cchSuff], papszSuffixes[i], cchSuff))
         {
-            Assert(papszSuffixes[i][0] == '.');
-            size_t cchSuff = strlen(papszSuffixes[i]);
-            if (   cchSuff < cchName
-                && !memcmp(&pszEnd[-(ssize_t)cchSuff], papszSuffixes[i], cchSuff))
-            {
-                cchName -= cchSuff;
-                break;
-            }
+            cchName -= cchSuff;
+            break;
         }
-
-        /* Add the name. */
-        rc = RTPathAppendEx(pszPath, RTPATH_MAX, &pszPath[cchPath], cchName);
     }
-    if (RT_FAILURE(rc))
+
+    /*
+     * Check the immediate directory first, in case it's layed out like
+     * IOPCIFamily.kext.
+     */
+    int rc = RTPathAppendEx(pszPath, RTPATH_MAX, &pszPath[cchPath], cchName);
+    if (RT_FAILURE(rc) || !RTFileExists(pszPath))
     {
-        pszPath[cchPath + cchName] = '\0';
-        return RTMsgErrorRc(rc, "Error constructing image bundle path for '%s': %Rrc", pszPath, rc);
+        /*
+         * Not there, ok then try the given subdirectory + name.
+         */
+        pszPath[cchPath + cchOrgName] = '\0';
+        rc = RTPathAppend(pszPath, RTPATH_MAX, pszSubDir);
+        if (RT_SUCCESS(rc))
+            rc = RTPathAppendEx(pszPath, RTPATH_MAX, &pszPath[cchPath], cchName);
+        if (RT_FAILURE(rc))
+        {
+            pszPath[cchPath + cchOrgName] = '\0';
+            return RTMsgErrorRc(rc, "Error constructing image bundle path for '%s': %Rrc", pszPath, rc);
+        }
     }
+
     return VINF_SUCCESS;
 }
 
@@ -702,16 +724,59 @@ static int rtDbgSymCacheConstructBundlePath(char *pszPath, size_t cchPath, size_
  *                              interested in.
  * @param   cchPath             The length of the path up to the bundle name.
  * @param   cchName             The length of the bundle name.
+ * @param   pDirEntry           The directory entry buffer, for handling bundle
+ *                              within bundle recursion.
  * @param   pCfg                The configuration.
  */
-static int rtDbgSymCacheAddImageBundle(char *pszPath, size_t cchPath, size_t cchName, PCRTDBGSYMCACHEADDCFG pCfg)
+static int rtDbgSymCacheAddImageBundle(char *pszPath, size_t cchPath, size_t cchName,
+                                       PRTDIRENTRYEX pDirEntry, PCRTDBGSYMCACHEADDCFG pCfg)
 {
-    /* Assuming these are kexts or simple applications, we only add the image
-       file itself to the cache. No Info.plist or other files. */
+    /*
+     * Assuming these are kexts or simple applications, we only add the image
+     * file itself to the cache.  No Info.plist or other files.
+     */
     /** @todo consider looking for Frameworks and handling framework bundles. */
     int rc = rtDbgSymCacheConstructBundlePath(pszPath, cchPath, cchName, "Contents/MacOS/", g_apszBundleSuffixes);
     if (RT_SUCCESS(rc))
-        rc = rtDbgSymCacheAddImageFile(pszPath, NULL, "image-uuids", pCfg);
+        rc = rtDbgSymCacheAddImageFile(pszPath, NULL, RTDBG_CACHE_UUID_MAP_DIR_IMAGES, pCfg);
+
+    /*
+     * Look for plugins and other sub-bundles.
+     */
+    if (pCfg->fRecursive)
+    {
+        static char const * const s_apszSubBundleDirs[] =
+        {
+            "Contents/Plugins/",
+            /** @todo Frameworks ++ */
+        };
+        for (uint32_t i = 0; i < RT_ELEMENTS(s_apszSubBundleDirs); i++)
+        {
+            pszPath[cchPath + cchName] = '\0';
+            int rc2 = RTPathAppend(pszPath, RTPATH_MAX - 1, s_apszSubBundleDirs[i]);
+            if (RT_SUCCESS(rc2))
+            {
+                if (RTDirExists(pszPath))
+                {
+                    size_t cchPath2 = strlen(pszPath);
+                    if (!RTPATH_IS_SLASH(pszPath[cchPath2 - 1]))
+                    {
+                        pszPath[cchPath2++] = RTPATH_SLASH;
+                        pszPath[cchPath2]   = '\0';
+                    }
+                    rc2 = rtDbgSymCacheAddDirWorker(pszPath, cchPath2, pDirEntry, pCfg);
+                }
+            }
+            else
+            {
+                pszPath[cchPath + cchName] = '\0';
+                RTMsgError("Error constructing bundle subdir path for '%s' + '%s': %Rrc", pszPath, s_apszSubBundleDirs[i], rc);
+            }
+            if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
+                rc = rc2;
+        }
+    }
+
     return rc;
 }
 
@@ -747,7 +812,7 @@ static int rtDbgSymCacheAddDebugBundle(char *pszPath, size_t cchPath, size_t cch
      */
     int rc = rtDbgSymCacheConstructBundlePath(pszPath, cchPath, cchName, "Contents/Resources/DWARF/", g_apszDSymBundleSuffixes);
     if (RT_SUCCESS(rc))
-        rc = rtDbgSymCacheAddImageFile(pszPath, ".dwarf", "dsym-uuids", pCfg);
+        rc = rtDbgSymCacheAddImageFile(pszPath, RTDBG_CACHE_DSYM_FILE_SUFFIX, RTDBG_CACHE_UUID_MAP_DIR_DSYMS, pCfg);
     return rc;
 }
 
@@ -954,7 +1019,7 @@ static int rtDbgSymCacheAddDirWorker(char *pszPath, size_t cchPath, PRTDIRENTRYE
                 break;
 
             case RTDBGSYMCACHEFILETYPE_IMAGE_FILE:
-                rc2 = rtDbgSymCacheAddImageFile(pszPath, NULL /*pszExtraSuff*/, "image-uuids", pCfg);
+                rc2 = rtDbgSymCacheAddImageFile(pszPath, NULL /*pszExtraSuff*/, RTDBG_CACHE_UUID_MAP_DIR_IMAGES, pCfg);
                 break;
 
             case RTDBGSYMCACHEFILETYPE_DEBUG_BUNDLE:
@@ -962,7 +1027,7 @@ static int rtDbgSymCacheAddDirWorker(char *pszPath, size_t cchPath, PRTDIRENTRYE
                 break;
 
             case RTDBGSYMCACHEFILETYPE_IMAGE_BUNDLE:
-                rc2 = rtDbgSymCacheAddImageBundle(pszPath, cchPath, pDirEntry->cbName, pCfg);
+                rc2 = rtDbgSymCacheAddImageBundle(pszPath, cchPath, pDirEntry->cbName, pDirEntry, pCfg);
                 break;
 
             case RTDBGSYMCACHEFILETYPE_DIR_FILTER:
@@ -1034,11 +1099,14 @@ static int rtDbgSymCacheAddDir(const char *pszPath, PCRTDBGSYMCACHEADDCFG pCfg)
  * Adds a file or directory.
  *
  * @returns Program exit code.
- * @param   pszPath         The user supplied path to the file or directory.
- * @param   pszCache        The path to the cache.
- * @param   fRecursive      Whether to process directories recursively.
+ * @param   pszPath                 The user supplied path to the file or directory.
+ * @param   pszCache                The path to the cache.
+ * @param   fRecursive              Whether to process directories recursively.
+ * @param   fOverwriteOnConflict    Whether to overwrite existing cache entry on
+ *                                  conflict, or just leave it.
  */
-static RTEXITCODE rtDbgSymCacheAddFileOrDir(const char *pszPath, const char *pszCache, bool fRecursive)
+static RTEXITCODE rtDbgSymCacheAddFileOrDir(const char *pszPath, const char *pszCache, bool fRecursive,
+                                            bool fOverwriteOnConflict)
 {
     RTDBGSYMCACHEADDCFG Cfg;
     Cfg.fRecursive      = fRecursive;
@@ -1065,7 +1133,7 @@ static RTEXITCODE rtDbgSymCacheAddFileOrDir(const char *pszPath, const char *psz
             break;
 
         case RTDBGSYMCACHEFILETYPE_IMAGE_FILE:
-            rc = rtDbgSymCacheAddImageFile(pszPath, NULL /*pszExtraSuff*/, "image-uuids", &Cfg);
+            rc = rtDbgSymCacheAddImageFile(pszPath, NULL /*pszExtraSuff*/, RTDBG_CACHE_UUID_MAP_DIR_IMAGES, &Cfg);
             break;
 
         case RTDBGSYMCACHEFILETYPE_DEBUG_BUNDLE:
@@ -1080,7 +1148,10 @@ static RTEXITCODE rtDbgSymCacheAddFileOrDir(const char *pszPath, const char *psz
                 if (enmType == RTDBGSYMCACHEFILETYPE_DEBUG_BUNDLE)
                     rc = rtDbgSymCacheAddDebugBundle(szPathBuf, cchPath - cchFilename, cchFilename, &Cfg);
                 else
-                    rc = rtDbgSymCacheAddImageBundle(szPathBuf, cchPath - cchFilename, cchFilename, &Cfg);
+                {
+                    RTDIRENTRYEX DirEntry;
+                    rc = rtDbgSymCacheAddImageBundle(szPathBuf, cchPath - cchFilename, cchFilename, &DirEntry, &Cfg);
+                }
             }
             else
                 rc = RTMsgErrorRc(VERR_FILENAME_TOO_LONG, "Filename too long: '%s'", pszPath);
@@ -1110,12 +1181,14 @@ static RTEXITCODE rtDbgSymCacheCmdAdd(const char *pszArg0, int cArgs, char **pap
      */
     static RTGETOPTDEF const s_aOptions[] =
     {
-        { "--recursive",        'R', RTGETOPT_REQ_NOTHING },
-        { "--no-recursive",     'n', RTGETOPT_REQ_NOTHING },
+        { "--recursive",                'R', RTGETOPT_REQ_NOTHING },
+        { "--no-recursive",             'n', RTGETOPT_REQ_NOTHING },
+        { "--overwrite-on-conflict",    'o', RTGETOPT_REQ_NOTHING },
     };
 
-    const char *pszCache        = NULL;
-    bool        fRecursive      = false;
+    const char *pszCache                = NULL;
+    bool        fRecursive              = false;
+    bool        fOverwriteOnConflict    = false;
 
     RTGETOPTSTATE State;
     int rc = RTGetOptInit(&State, cArgs, papszArgs, &s_aOptions[0], RT_ELEMENTS(s_aOptions), 0,  RTGETOPTINIT_FLAGS_OPTS_FIRST);
@@ -1137,6 +1210,10 @@ static RTEXITCODE rtDbgSymCacheCmdAdd(const char *pszArg0, int cArgs, char **pap
                 fRecursive = false;
                 break;
 
+            case 'o':
+                fOverwriteOnConflict = true;
+                break;
+
             case VINF_GETOPT_NOT_OPTION:
                 /* The first non-option is a cache directory. */
                 if (!pszCache)
@@ -1144,7 +1221,7 @@ static RTEXITCODE rtDbgSymCacheCmdAdd(const char *pszArg0, int cArgs, char **pap
                     pszCache = ValueUnion.psz;
                     if (!RTPathExists(pszCache))
                     {
-                        rc = RTDirCreate(pszCache, 0755, 0 /*fFlags*/);
+                        rc = RTDirCreate(pszCache, 0755, RTDIRCREATE_FLAGS_NOT_CONTENT_INDEXED_NOT_CRITICAL);
                         if (RT_FAILURE(rc))
                             return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Error creating cache directory '%s': %Rrc", pszCache, rc);
                     }
@@ -1154,7 +1231,7 @@ static RTEXITCODE rtDbgSymCacheCmdAdd(const char *pszArg0, int cArgs, char **pap
                 /* Subsequent non-options are files to be added to the cache. */
                 else
                 {
-                    RTEXITCODE rcExit = rtDbgSymCacheAddFileOrDir(ValueUnion.psz, pszCache, fRecursive);
+                    RTEXITCODE rcExit = rtDbgSymCacheAddFileOrDir(ValueUnion.psz, pszCache, fRecursive, fOverwriteOnConflict);
                     if (rcExit != RTEXITCODE_FAILURE)
                         return rcExit;
                 }
diff --git a/src/VBox/Runtime/tools/RTGzip.cpp b/src/VBox/Runtime/tools/RTGzip.cpp
index aedb7d9..693ad6a 100644
--- a/src/VBox/Runtime/tools/RTGzip.cpp
+++ b/src/VBox/Runtime/tools/RTGzip.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2011 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -68,9 +68,9 @@ typedef struct RTGZIPCMDOPTS
     /** The current input filename (for deletion and messages). */
     const char     *pszInput;
 } RTGZIPCMDOPTS;
-/** Pointer to GZIP options.   */
+/** Pointer to GZIP options. */
 typedef RTGZIPCMDOPTS *PRTGZIPCMDOPTS;
-/** Pointer to const GZIP options.   */
+/** Pointer to const GZIP options. */
 typedef RTGZIPCMDOPTS const *PCRTGZIPCMDOPTS;
 
 
@@ -137,7 +137,7 @@ static RTEXITCODE gzipPushFlushAndClose(PRTVFSIOSTREAM phVfsSrc, PCRTGZIPCMDOPTS
     *phVfsSrc = NIL_RTVFSIOSTREAM;
 
     int rc = RTVfsIoStrmFlush(*phVfsDst);
-    if (RT_FAILURE(rc))
+    if (RT_FAILURE(rc) && rc != VERR_INVALID_PARAMETER)
         rcExit = RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to flush the output file: %Rrc", rc);
     RTVfsIoStrmRelease(*phVfsDst);
     *phVfsDst = NIL_RTVFSIOSTREAM;
@@ -207,8 +207,10 @@ static RTEXITCODE gzipSetupDecompressor(PRTVFSIOSTREAM phVfsSrc)
     /*
      * Attach the decompressor to the input stream.
      */
+    uint32_t fFlags = 0;
+    fFlags |= RTZIPGZIPDECOMP_F_ALLOW_ZLIB_HDR;
     RTVFSIOSTREAM hVfsGunzip;
-    int rc = RTZipGzipDecompressIoStream(*phVfsSrc, 0 /*fFlags*/, &hVfsGunzip);
+    int rc = RTZipGzipDecompressIoStream(*phVfsSrc, fFlags, &hVfsGunzip);
     if (RT_FAILURE(rc))
         return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTZipGzipDecompressIoStream failed: %Rrc", rc);
 
diff --git a/src/VBox/Runtime/tools/RTNtDbgHelp.cpp b/src/VBox/Runtime/tools/RTNtDbgHelp.cpp
index c20864b..a7030df 100644
--- a/src/VBox/Runtime/tools/RTNtDbgHelp.cpp
+++ b/src/VBox/Runtime/tools/RTNtDbgHelp.cpp
@@ -186,7 +186,7 @@ static RTEXITCODE loadModule(const char *pszFile)
     pMod->pszName  = RTPathFilename(pMod->szFullName);
     pMod->uModAddr = uModAddrGot;
     RTListAppend(&g_ModuleList, &pMod->ListEntry);
-    infoPrintf(1, "%#018x %s\n", pMod->uModAddr, pMod->pszName);
+    infoPrintf(1, "%#018RX64 %s\n", pMod->uModAddr, pMod->pszName);
 
     return RTEXITCODE_SUCCESS;
 }
@@ -228,7 +228,7 @@ static const char *symTypeName(SYM_TYPE enmType)
 static BOOL CALLBACK dumpSymbolCallback(PSYMBOL_INFO pSymInfo, ULONG cbSymbol, PVOID pvUser)
 {
     NOREF(pvUser);
-    RTPrintf("  %#018x LB %#07x  %s\n", pSymInfo->Address, cbSymbol, pSymInfo->Name);
+    RTPrintf("  %#018RX64 LB %#07x  %s\n", pSymInfo->Address, cbSymbol, pSymInfo->Name);
     return TRUE;
 }
 
@@ -242,7 +242,7 @@ static RTEXITCODE dumpAll(void)
     PRTNTDBGHELPMOD pMod;
     RTListForEach(&g_ModuleList, pMod, RTNTDBGHELPMOD, ListEntry)
     {
-        RTPrintf("*** %#018x - %s ***\n", pMod->uModAddr, pMod->szFullName);
+        RTPrintf("*** %#018RX64 - %s ***\n", pMod->uModAddr, pMod->szFullName);
 
         static const int8_t s_acbVariations[]  = { 0, -4, -8, -12, -16, -20, -24, -28, -32, 4, 8, 12, 16, 20, 24, 28, 32 };
         unsigned            iVariation = 0;
@@ -358,7 +358,7 @@ int main(int argc, char **argv)
 
 
             case 'V':
-                RTPrintf("$Revision: 85818 $");
+                RTPrintf("$Revision: 94014 $");
                 break;
 
             case 'h':
diff --git a/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp b/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp
index 85abca5..8b095ca 100644
--- a/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp
+++ b/src/VBox/Runtime/win/RTErrConvertFromWin32.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -186,6 +186,7 @@ RTR3DECL(int)  RTErrConvertFromWin32(unsigned uNativeCode)
         case ERROR_INVALID_ADDRESS:         return VERR_INVALID_POINTER; ///@todo fix ERROR_INVALID_ADDRESS translation - dbghelp returns it on some line number queries.
 
         case ERROR_CANCELLED:               return VERR_CANCELLED;
+        case ERROR_USER_MAPPED_FILE:        return VERR_SHARING_VIOLATION;
         case ERROR_DIRECTORY:               return VERR_NOT_A_DIRECTORY;
 
         case ERROR_LOGON_FAILURE:           return VERR_AUTHENTICATION_FAILURE;
diff --git a/src/VBox/Storage/DMG.cpp b/src/VBox/Storage/DMG.cpp
index cb3fdd5..918512a 100644
--- a/src/VBox/Storage/DMG.cpp
+++ b/src/VBox/Storage/DMG.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2013 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -1801,7 +1801,9 @@ static DECLCALLBACK(int) dmgOpen(const char *pszFilename, unsigned uOpenFlags,
                                  PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                                  VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
+
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
 
     /* Check open flags. All valid flags are (in principle) supported. */
     AssertReturn(!(uOpenFlags & ~VD_OPEN_FLAGS_MASK), VERR_INVALID_PARAMETER);
@@ -1855,9 +1857,11 @@ static DECLCALLBACK(int) dmgCreate(const char *pszFilename, uint64_t cbSize,
                                    PCRTUUID pUuid, unsigned uOpenFlags,
                                    unsigned uPercentStart, unsigned uPercentSpan,
                                    PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
-                                   PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                                   PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                                   void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc = VERR_NOT_SUPPORTED;
 
     LogFlowFunc(("returns %Rrc\n", rc));
diff --git a/src/VBox/Storage/Debug/Makefile.kmk b/src/VBox/Storage/Debug/Makefile.kmk
index 5bf51ae..8747eb0 100644
--- a/src/VBox/Storage/Debug/Makefile.kmk
+++ b/src/VBox/Storage/Debug/Makefile.kmk
@@ -15,7 +15,7 @@
 # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 #
 
-SUB_DEPTH = ../../..
+SUB_DEPTH = ../../../..
 include $(KBUILD_PATH)/subheader.kmk
 
 #
diff --git a/src/VBox/Storage/Debug/VDDbgIoLog.cpp b/src/VBox/Storage/Debug/VDDbgIoLog.cpp
index 1aec115..63d0619 100644
--- a/src/VBox/Storage/Debug/VDDbgIoLog.cpp
+++ b/src/VBox/Storage/Debug/VDDbgIoLog.cpp
@@ -486,7 +486,7 @@ VBOXDDU_DECL(int) VDDbgIoLogStartDiscard(VDIOLOGGER hIoLogger, bool fAsync, PCRT
             for (unsigned i = 0; i < cRanges; i++)
             {
                 DiscardRange.u64Off = RT_H2LE_U64(paRanges[i].offStart);
-                DiscardRange.u32Discard = RT_H2LE_U32(paRanges[i].cbRange);
+                DiscardRange.u32Discard = RT_H2LE_U32((uint32_t)paRanges[i].cbRange);
                 rc = RTFileWriteAt(pIoLogger->hFile, pIoLogger->offWriteNext + i*sizeof(DiscardRange),
                                    &DiscardRange, sizeof(DiscardRange), NULL);
                 if (RT_FAILURE(rc))
@@ -665,7 +665,7 @@ VBOXDDU_DECL(int) VDDbgIoLogEventGetStart(VDIOLOGGER hIoLogger, uint64_t *pidEve
         rc = RTFileReadAt(pIoLogger->hFile, pIoLogger->offReadNext, &Entry, sizeof(Entry), NULL);
         if (RT_SUCCESS(rc))
         {
-            *pfAsync   = (bool)Entry.u8AsyncIo;
+            *pfAsync   = RT_BOOL(Entry.u8AsyncIo);
             *pidEvent  = RT_LE2H_U64(Entry.u64Id);
             *poff      = RT_LE2H_U64(Entry.Io.u64Off);
             *pcbIo     = RT_LE2H_U64(Entry.Io.u64IoSize);
@@ -720,7 +720,7 @@ VBOXDDU_DECL(int) VDDbgIoLogEventGetStartDiscard(VDIOLOGGER hIoLogger, uint64_t
             IoLogEntryDiscard DiscardRange;
 
             pIoLogger->offReadNext += sizeof(Entry);
-            *pfAsync   = (bool)Entry.u8AsyncIo;
+            *pfAsync   = RT_BOOL(Entry.u8AsyncIo);
             *pidEvent  = RT_LE2H_U64(Entry.u64Id);
             *pcRanges  = RT_LE2H_U32(Entry.Discard.cRanges);
 
diff --git a/src/VBox/Storage/ISCSI.cpp b/src/VBox/Storage/ISCSI.cpp
index 96468ed..d31608c 100644
--- a/src/VBox/Storage/ISCSI.cpp
+++ b/src/VBox/Storage/ISCSI.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -569,6 +569,8 @@ typedef struct ISCSIIMAGE
     bool                fAutomaticInitiatorName;
     /** Flag whether to use the host IP stack or DevINIP. */
     bool                fHostIP;
+    /** Flag whether to dump malformed packets in the release log. */
+    bool                fDumpMalformedPackets;
 
     /** Head of request queue */
     PISCSICMD           pScsiReqQueue;
@@ -629,22 +631,26 @@ static const char *s_iscsiConfigDefaultWriteSplit = "262144";
 /** Default host IP stack. */
 static const char *s_iscsiConfigDefaultHostIPStack = "1";
 
+/** Default dump malformed packet configuration value. */
+static const char *s_iscsiConfigDefaultDumpMalformedPackets = "0";
+
 /** Description of all accepted config parameters. */
 static const VDCONFIGINFO s_iscsiConfigInfo[] =
 {
-    { "TargetName",         NULL,                               VDCFGVALUETYPE_STRING,  VD_CFGKEY_MANDATORY },
+    { "TargetName",           NULL,                                      VDCFGVALUETYPE_STRING,  VD_CFGKEY_MANDATORY },
     /* LUN is defined of string type to handle the "enc" prefix. */
-    { "LUN",                s_iscsiConfigDefaultLUN,            VDCFGVALUETYPE_STRING,  VD_CFGKEY_MANDATORY },
-    { "TargetAddress",      NULL,                               VDCFGVALUETYPE_STRING,  VD_CFGKEY_MANDATORY },
-    { "InitiatorName",      NULL,                               VDCFGVALUETYPE_STRING,  0 },
-    { "InitiatorUsername",  NULL,                               VDCFGVALUETYPE_STRING,  0 },
-    { "InitiatorSecret",    NULL,                               VDCFGVALUETYPE_BYTES,   0 },
-    { "TargetUsername",     NULL,                               VDCFGVALUETYPE_STRING,  VD_CFGKEY_EXPERT },
-    { "TargetSecret",       NULL,                               VDCFGVALUETYPE_BYTES,   VD_CFGKEY_EXPERT },
-    { "WriteSplit",         s_iscsiConfigDefaultWriteSplit,     VDCFGVALUETYPE_INTEGER, VD_CFGKEY_EXPERT },
-    { "Timeout",            s_iscsiConfigDefaultTimeout,        VDCFGVALUETYPE_INTEGER, VD_CFGKEY_EXPERT },
-    { "HostIPStack",        s_iscsiConfigDefaultHostIPStack,    VDCFGVALUETYPE_INTEGER, VD_CFGKEY_EXPERT },
-    { NULL,                 NULL,                               VDCFGVALUETYPE_INTEGER, 0 }
+    { "LUN",                  s_iscsiConfigDefaultLUN,                   VDCFGVALUETYPE_STRING,  VD_CFGKEY_MANDATORY },
+    { "TargetAddress",        NULL,                                      VDCFGVALUETYPE_STRING,  VD_CFGKEY_MANDATORY },
+    { "InitiatorName",        NULL,                                      VDCFGVALUETYPE_STRING,  0 },
+    { "InitiatorUsername",    NULL,                                      VDCFGVALUETYPE_STRING,  0 },
+    { "InitiatorSecret",      NULL,                                      VDCFGVALUETYPE_BYTES,   0 },
+    { "TargetUsername",       NULL,                                      VDCFGVALUETYPE_STRING,  VD_CFGKEY_EXPERT },
+    { "TargetSecret",         NULL,                                      VDCFGVALUETYPE_BYTES,   VD_CFGKEY_EXPERT },
+    { "WriteSplit",           s_iscsiConfigDefaultWriteSplit,            VDCFGVALUETYPE_INTEGER, VD_CFGKEY_EXPERT },
+    { "Timeout",              s_iscsiConfigDefaultTimeout,               VDCFGVALUETYPE_INTEGER, VD_CFGKEY_EXPERT },
+    { "HostIPStack",          s_iscsiConfigDefaultHostIPStack,           VDCFGVALUETYPE_INTEGER, VD_CFGKEY_EXPERT },
+    { "DumpMalformedPackets", s_iscsiConfigDefaultDumpMalformedPackets,  VDCFGVALUETYPE_INTEGER, VD_CFGKEY_EXPERT },
+    { NULL,                   NULL,                                      VDCFGVALUETYPE_INTEGER, 0 }
 };
 
 /*******************************************************************************
@@ -803,6 +809,34 @@ static PISCSICMD iscsiCmdRemoveAll(PISCSIIMAGE pImage)
     return pIScsiCmdHead;
 }
 
+/**
+ * Dumps an iSCSI packet if enabled.
+ *
+ * @returns nothing.
+ * @param   pImage         The iSCSI image instance data.
+ * @param   paISCSISegs    Pointer to the segments array.
+ * @param   cnISCSISegs    Number of segments in the array.
+ * @param   rc             Status code for this packet.
+ * @param   fRequest       Flag whether this is request or response packet.
+ */
+static void iscsiDumpPacket(PISCSIIMAGE pImage, PISCSIREQ paISCSISegs, unsigned cnISCSISegs, int rc, bool fRequest)
+{
+    if (pImage->fDumpMalformedPackets)
+    {
+        LogRel(("iSCSI{%s}: Dumping %s packet completed with status code %Rrc\n", pImage->pszTargetName, fRequest ? "request" : "response", rc));
+        for (unsigned i = 0; i < cnISCSISegs; i++)
+        {
+            if (paISCSISegs[i].cbSeg)
+            {
+                LogRel(("iSCSI{%s}: Segment %u, size %zu\n"
+                        "%.*Rhxd\n",
+                        pImage->pszTargetName, i, paISCSISegs[i].cbSeg,
+                        paISCSISegs[i].cbSeg, paISCSISegs[i].pcvSeg));
+            }
+        }
+    }
+}
+
 static int iscsiTransportConnect(PISCSIIMAGE pImage)
 {
     int rc;
@@ -1654,6 +1688,16 @@ out:
     if (RT_FAILURE(rc))
     {
         /*
+         * Dump the last request and response of we are supposed to do so and there is a request
+         * or response.
+         */
+        if (cnISCSIReq)
+            iscsiDumpPacket(pImage, aISCSIReq, cnISCSIReq, VINF_SUCCESS, true /* fRequest */);
+
+        if (cnISCSIRes)
+            iscsiDumpPacket(pImage, (PISCSIREQ)aISCSIRes, cnISCSIRes, rc, false /* fRequest */);
+
+        /*
          * Close connection to target.
          */
         iscsiTransportClose(pImage);
@@ -1665,7 +1709,7 @@ out:
     RTSemMutexRelease(pImage->Mutex);
 
     LogFlowFunc(("returning %Rrc\n", rc));
-    LogRel(("iSCSI: login to target %s %s\n", pImage->pszTargetName, RT_SUCCESS(rc) ? "successful" : "failed"));
+    LogRel(("iSCSI: login to target %s %s (%Rrc)\n", pImage->pszTargetName, RT_SUCCESS(rc) ? "successful" : "failed", rc));
     return rc;
 }
 
@@ -2122,7 +2166,10 @@ static int iscsiRecvPDU(PISCSIIMAGE pImage, uint32_t itt, PISCSIRES paRes, uint3
              * the iSCSI connection/session. */
             rc = iscsiValidatePDU(&aResBuf, 1);
             if (RT_FAILURE(rc))
+            {
+                iscsiDumpPacket(pImage, (PISCSIREQ)&aResBuf, 1, rc, false /* fRequest */);
                 continue;
+            }
             cmd = (ISCSIOPCODE)(RT_N2H_U32(pcvResSeg[0]) & ISCSIOP_MASK);
             switch (cmd)
             {
@@ -2143,6 +2190,7 @@ static int iscsiRecvPDU(PISCSIIMAGE pImage, uint32_t itt, PISCSIRES paRes, uint3
                     break;
                 default:
                     rc = VERR_PARSE_ERROR;
+                    iscsiDumpPacket(pImage, (PISCSIREQ)&aResBuf, 1, rc, false /* fRequest */);
             }
             if (RT_FAILURE(rc))
                 continue;
@@ -2161,6 +2209,7 @@ static int iscsiRecvPDU(PISCSIIMAGE pImage, uint32_t itt, PISCSIRES paRes, uint3
                 else
                 {
                     rc = VERR_PARSE_ERROR;
+                    iscsiDumpPacket(pImage, (PISCSIREQ)&aResBuf, 1, rc, false /* fRequest */);
                     continue;
                 }
             }
@@ -2233,7 +2282,7 @@ static int iscsiRecvPDU(PISCSIIMAGE pImage, uint32_t itt, PISCSIRES paRes, uint3
         }
     }
 
-    LogFlowFunc(("returns rc=%Rrc\n"));
+    LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
 
@@ -2445,6 +2494,7 @@ static int iscsiRecvPDUProcess(PISCSIIMAGE pImage, PISCSIRES paRes, uint32_t cnR
                     break;
                 default:
                     rc = VERR_PARSE_ERROR;
+                    iscsiDumpPacket(pImage, (PISCSIREQ)paRes, cnRes, rc, false /* fRequest */);
             }
 
             if (RT_FAILURE(rc))
@@ -2462,8 +2512,9 @@ static int iscsiRecvPDUProcess(PISCSIIMAGE pImage, PISCSIRES paRes, uint32_t cnR
                 }
                 else
                 {
-                   rc = VERR_PARSE_ERROR;
-                   break;
+                    rc = VERR_PARSE_ERROR;
+                    iscsiDumpPacket(pImage, (PISCSIREQ)paRes, cnRes, rc, false /* fRequest */);
+                    break;
                 }
             }
 
@@ -2534,6 +2585,8 @@ static int iscsiRecvPDUProcess(PISCSIIMAGE pImage, PISCSIRES paRes, uint32_t cnR
             }
         } while (0);
     }
+    else
+        iscsiDumpPacket(pImage, (PISCSIREQ)paRes, cnRes, rc, false /* fRequest */);
 
     return rc;
 }
@@ -2847,6 +2900,7 @@ static int iscsiRecvPDUUpdateRequest(PISCSIIMAGE pImage, PISCSIRES paRes, uint32
     if (RT_FAILURE(rc))
     {
         LogRel(("iSCSI: Received malformed PDU from target %s (rc=%Rrc), ignoring\n", pImage->pszTargetName, rc));
+        iscsiDumpPacket(pImage, (PISCSIREQ)paRes, cnRes, rc, false /* fRequest */);
         rc = VINF_SUCCESS;
     }
 
@@ -3541,7 +3595,7 @@ static int iscsiCommandSync(PISCSIIMAGE pImage, PSCSIREQ pScsiReq, bool fRetry,
                 rc = IScsiCmdSync.rcCmd;
 
                 if (RT_FAILURE(rc) || pScsiReq->cbSense > 0)
-                        rc = rcSense;
+                    rc = rcSense;
             }
         }
 
@@ -3563,7 +3617,7 @@ static int iscsiCommandSync(PISCSIIMAGE pImage, PSCSIREQ pScsiReq, bool fRetry,
         else
         {
             rc = iscsiCommand(pImage, pScsiReq);
-            if (RT_SUCCESS(rc) && pScsiReq->cbSense > 0)
+            if (RT_FAILURE(rc) || pScsiReq->cbSense > 0)
                 rc = rcSense;
         }
     }
@@ -3765,15 +3819,20 @@ static int iscsiOpenImage(PISCSIIMAGE pImage, unsigned uOpenFlags)
     bool fLunEncoded = false;
     uint32_t uWriteSplitDef = 0;
     uint32_t uTimeoutDef = 0;
-    uint64_t uHostIPTmp = 0;
-    bool fHostIPDef = 0;
+    uint64_t uCfgTmp = 0;
+    bool fHostIPDef = false;
+    bool fDumpMalformedPacketsDef = false;
     rc = RTStrToUInt32Full(s_iscsiConfigDefaultWriteSplit, 0, &uWriteSplitDef);
     AssertRC(rc);
     rc = RTStrToUInt32Full(s_iscsiConfigDefaultTimeout, 0, &uTimeoutDef);
     AssertRC(rc);
-    rc = RTStrToUInt64Full(s_iscsiConfigDefaultHostIPStack, 0, &uHostIPTmp);
+    rc = RTStrToUInt64Full(s_iscsiConfigDefaultHostIPStack, 0, &uCfgTmp);
+    AssertRC(rc);
+    fHostIPDef = RT_BOOL(uCfgTmp);
+
+    rc = RTStrToUInt64Full(s_iscsiConfigDefaultDumpMalformedPackets, 0, &uCfgTmp);
     AssertRC(rc);
-    fHostIPDef = !!uHostIPTmp;
+    fDumpMalformedPacketsDef = RT_BOOL(uCfgTmp);
 
     pImage->uOpenFlags      = uOpenFlags;
 
@@ -3841,7 +3900,8 @@ static int iscsiOpenImage(PISCSIIMAGE pImage, unsigned uOpenFlags)
                            "TargetSecret\0"
                            "WriteSplit\0"
                            "Timeout\0"
-                           "HostIPStack\0"))
+                           "HostIPStack\0"
+                           "DumpMalformedPackets\0"))
     {
         rc = vdIfError(pImage->pIfError, VERR_VD_UNKNOWN_CFG_VALUES, RT_SRC_POS, N_("iSCSI: configuration error: unknown configuration keys present"));
         goto out;
@@ -4003,6 +4063,15 @@ static int iscsiOpenImage(PISCSIIMAGE pImage, unsigned uOpenFlags)
         goto out;
     }
 
+    rc = VDCFGQueryBoolDef(pImage->pIfConfig,
+                           "DumpMalformedPackets", &pImage->fDumpMalformedPackets,
+                           fDumpMalformedPacketsDef);
+    if (RT_FAILURE(rc))
+    {
+        rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("iSCSI: configuration error: failed to read DumpMalformedPackets as boolean"));
+        goto out;
+    }
+
     /* Don't actually establish iSCSI transport connection if this is just an
      * open to query the image information and the host IP stack isn't used.
      * Even trying is rather useless, as in this context the InTnet IP stack
@@ -4497,10 +4566,12 @@ static int iscsiOpen(const char *pszFilename, unsigned uOpenFlags,
                      PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                      VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc;
     PISCSIIMAGE pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -4561,9 +4632,11 @@ static int iscsiCreate(const char *pszFilename, uint64_t cbSize,
                        PCRTUUID pUuid, unsigned uOpenFlags,
                        unsigned uPercentStart, unsigned uPercentSpan,
                        PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
-                       PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                       PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                       void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc = VERR_NOT_SUPPORTED;
 
     LogFlowFunc(("returns %Rrc (pBackendData=%#p)\n", rc, *ppBackendData));
diff --git a/src/VBox/Storage/Makefile.kmk b/src/VBox/Storage/Makefile.kmk
index 2054243..4527ce1 100644
--- a/src/VBox/Storage/Makefile.kmk
+++ b/src/VBox/Storage/Makefile.kmk
@@ -59,7 +59,9 @@ if defined(VBOX_WITH_EXTPACK_PUEL) && defined(VBOX_WITH_EXTPACK_PUEL_BUILD)
   VDPluginCrypt_SDKS          = VBoxOpenSslExtPack
   VDPluginCrypt_LDFLAGS.linux = -Wl,--no-undefined
 
-  VDPluginCrypt_SOURCES  = VDFilterCrypt.cpp
+  VDPluginCrypt_SOURCES  = \
+	VDFilterCrypt.cpp \
+	VDKeyStore.cpp
   VDPluginCrypt_SOURCES.win = VDPluginCrypt.rc
  endif
 endif # VBOX_WITH_EXTPACK_PUEL
diff --git a/src/VBox/Storage/Parallels.cpp b/src/VBox/Storage/Parallels.cpp
index 5fac5d5..487974e 100644
--- a/src/VBox/Storage/Parallels.cpp
+++ b/src/VBox/Storage/Parallels.cpp
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -206,8 +206,8 @@ static int parallelsOpenImage(PPARALLELSIMAGE pImage, unsigned uOpenFlags)
     if (memcmp(parallelsHeader.HeaderIdentifier, PARALLELS_HEADER_MAGIC, 16))
     {
         /* Check if the file has hdd as extension. It is a fixed size raw image then. */
-        char *pszExtension = RTPathExt(pImage->pszFilename);
-        if (strcmp(pszExtension, ".hdd"))
+        char *pszSuffix = RTPathSuffix(pImage->pszFilename);
+        if (strcmp(pszSuffix, ".hdd"))
         {
             rc = VERR_VD_PARALLELS_INVALID_HEADER;
             goto out;
@@ -392,7 +392,7 @@ static int parallelsCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDis
              * of 512 and if the file extensions is *.hdd
              */
             uint64_t cbFile;
-            char *pszExtension;
+            char *pszSuffix;
 
             rc = vdIfIoIntFileGetSize(pIfIo, pStorage, &cbFile);
             if (RT_FAILURE(rc) || ((cbFile % 512) != 0))
@@ -401,8 +401,8 @@ static int parallelsCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDis
                 return VERR_VD_PARALLELS_INVALID_HEADER;
             }
 
-            pszExtension = RTPathExt(pszFilename);
-            if (!pszExtension || strcmp(pszExtension, ".hdd"))
+            pszSuffix = RTPathSuffix(pszFilename);
+            if (!pszSuffix || strcmp(pszSuffix, ".hdd"))
                 rc = VERR_VD_PARALLELS_INVALID_HEADER;
             else
                 rc = VINF_SUCCESS;
@@ -421,10 +421,12 @@ static int parallelsOpen(const char *pszFilename, unsigned uOpenFlags,
                          PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                          VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc;
     PPARALLELSIMAGE pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -472,10 +474,11 @@ static int parallelsCreate(const char *pszFilename, uint64_t cbSize,
                            unsigned uOpenFlags, unsigned uPercentStart,
                            unsigned uPercentSpan, PVDINTERFACE pVDIfsDisk,
                            PVDINTERFACE pVDIfsImage,
-                           PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                           PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                           void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p",
-                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc = VINF_SUCCESS;
     PPARALLELSIMAGE pImage;
 
@@ -488,6 +491,13 @@ static int parallelsCreate(const char *pszFilename, uint64_t cbSize,
         pvUser = pIfProgress->Core.pvUser;
     }
 
+    /* Check the VD container type. */
+    if (enmType != VDTYPE_HDD)
+    {
+        rc = VERR_VD_INVALID_TYPE;
+        goto out;
+    }
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
diff --git a/src/VBox/Storage/QCOW.cpp b/src/VBox/Storage/QCOW.cpp
index f2f9b09..e21aa19 100644
--- a/src/VBox/Storage/QCOW.cpp
+++ b/src/VBox/Storage/QCOW.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2013 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -1494,10 +1494,12 @@ static int qcowOpen(const char *pszFilename, unsigned uOpenFlags,
                    PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                    VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc;
     PQCOWIMAGE pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -1543,10 +1545,11 @@ static int qcowCreate(const char *pszFilename, uint64_t cbSize,
                      PCRTUUID pUuid, unsigned uOpenFlags,
                      unsigned uPercentStart, unsigned uPercentSpan,
                      PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
-                     PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                     PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                     void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p",
-                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc;
     PQCOWIMAGE pImage;
 
@@ -1559,6 +1562,13 @@ static int qcowCreate(const char *pszFilename, uint64_t cbSize,
         pvUser = pIfProgress->Core.pvUser;
     }
 
+    /* Check the VD container type. */
+    if (enmType != VDTYPE_HDD)
+    {
+        rc = VERR_VD_INVALID_TYPE;
+        goto out;
+    }
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
diff --git a/src/VBox/Storage/QED.cpp b/src/VBox/Storage/QED.cpp
index 32dbfbb..1b8b38b 100644
--- a/src/VBox/Storage/QED.cpp
+++ b/src/VBox/Storage/QED.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2011-2014 Oracle Corporation
+ * Copyright (C) 2011-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -831,7 +831,7 @@ static int qedFlushImage(PQEDIMAGE pImage)
                                              pImage->cTableEntries);
             rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage,
                                         pImage->offL1Table, paL1TblImg,
-                                        pImage->cbTable, NULL);
+                                        pImage->cbTable);
             RTMemFree(paL1TblImg);
         }
         else
@@ -1588,10 +1588,12 @@ static int qedOpen(const char *pszFilename, unsigned uOpenFlags,
                    PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                    VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc;
     PQEDIMAGE pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -1637,10 +1639,11 @@ static int qedCreate(const char *pszFilename, uint64_t cbSize,
                      PCRTUUID pUuid, unsigned uOpenFlags,
                      unsigned uPercentStart, unsigned uPercentSpan,
                      PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
-                     PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                     PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                     void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p",
-                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType, ppBackendData=%#p",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc;
     PQEDIMAGE pImage;
 
@@ -1653,6 +1656,13 @@ static int qedCreate(const char *pszFilename, uint64_t cbSize,
         pvUser = pIfProgress->Core.pvUser;
     }
 
+    /* Check the VD container type. */
+    if (enmType != VDTYPE_HDD)
+    {
+        rc = VERR_VD_INVALID_TYPE;
+        goto out;
+    }
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
diff --git a/src/VBox/Storage/RAW.cpp b/src/VBox/Storage/RAW.cpp
index 8fcefe0..486b828 100644
--- a/src/VBox/Storage/RAW.cpp
+++ b/src/VBox/Storage/RAW.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -300,7 +300,7 @@ static int rawCreateImage(PRAWIMAGE pImage, uint64_t cbSize,
         /* Write data to all image blocks. */
         while (uOff < cbSize)
         {
-            unsigned cbChunk = (unsigned)RT_MIN(cbSize, RAW_FILL_SIZE);
+            unsigned cbChunk = (unsigned)RT_MIN(cbSize - uOff, RAW_FILL_SIZE);
 
             rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, uOff,
                                         pvBuf, cbChunk);
@@ -350,7 +350,7 @@ static int rawCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk,
     PVDIOSTORAGE pStorage = NULL;
     uint64_t cbFile;
     int rc = VINF_SUCCESS;
-    char *pszExtension = NULL;
+    char *pszSuffix = NULL;
 
     PVDINTERFACEIOINT pIfIo = VDIfIoIntGet(pVDIfsImage);
     AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
@@ -362,7 +362,7 @@ static int rawCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk,
         goto out;
     }
 
-    pszExtension = RTPathExt(pszFilename);
+    pszSuffix = RTPathSuffix(pszFilename);
 
     /*
      * Open the file and read the footer.
@@ -376,10 +376,10 @@ static int rawCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk,
 
     /* Try to guess the image type based on the extension. */
     if (   RT_SUCCESS(rc)
-        && pszExtension)
+        && pszSuffix)
     {
-        if (   !RTStrICmp(pszExtension, ".iso")
-            || !RTStrICmp(pszExtension, ".cdr")) /* DVD images. */
+        if (   !RTStrICmp(pszSuffix, ".iso")
+            || !RTStrICmp(pszSuffix, ".cdr")) /* DVD images. */
         {
             /* Note that there are ISO images smaller than 1 MB; it is impossible to distinguish
              * between raw floppy and CD images based on their size (and cannot be reliably done
@@ -393,11 +393,11 @@ static int rawCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk,
             else
                 rc = VERR_VD_RAW_INVALID_HEADER;
         }
-        else if (   !RTStrICmp(pszExtension, ".img")
-                 || !RTStrICmp(pszExtension, ".ima")
-                 || !RTStrICmp(pszExtension, ".dsk")
-                 || !RTStrICmp(pszExtension, ".flp")
-                 || !RTStrICmp(pszExtension, ".vfd")) /* Floppy images */
+        else if (   !RTStrICmp(pszSuffix, ".img")
+                 || !RTStrICmp(pszSuffix, ".ima")
+                 || !RTStrICmp(pszSuffix, ".dsk")
+                 || !RTStrICmp(pszSuffix, ".flp")
+                 || !RTStrICmp(pszSuffix, ".vfd")) /* Floppy images */
         {
             if (!(cbFile % 512) && cbFile <= RAW_MAX_FLOPPY_IMG_SIZE)
             {
@@ -426,10 +426,12 @@ static int rawOpen(const char *pszFilename, unsigned uOpenFlags,
                    PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                    VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc;
     PRAWIMAGE pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -481,9 +483,11 @@ static int rawCreate(const char *pszFilename, uint64_t cbSize,
                      PCRTUUID pUuid, unsigned uOpenFlags,
                      unsigned uPercentStart, unsigned uPercentSpan,
                      PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
-                     PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                     PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                     void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc;
     PRAWIMAGE pImage;
 
@@ -496,6 +500,14 @@ static int rawCreate(const char *pszFilename, uint64_t cbSize,
         pvUser = pIfProgress->Core.pvUser;
     }
 
+    /* Check the VD container type. Yes, hard disk must be allowed, otherwise
+     * various tools using this backend for hard disk images will fail. */
+    if (enmType != VDTYPE_HDD && enmType != VDTYPE_DVD && enmType != VDTYPE_FLOPPY)
+    {
+        rc = VERR_VD_INVALID_TYPE;
+        goto out;
+    }
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
diff --git a/src/VBox/Storage/VD.cpp b/src/VBox/Storage/VD.cpp
index 7d2832f..8b4d69f 100644
--- a/src/VBox/Storage/VD.cpp
+++ b/src/VBox/Storage/VD.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -197,10 +197,12 @@ typedef struct VDDISCARDSTATE
  */
 typedef struct VDFILTER
 {
-    /** Pointer to the previous filter. */
-    struct VDFILTER   *pPrev;
-    /** Pointer to the next filter. */
-    struct VDFILTER   *pNext;
+    /** List node for the read filter chain. */
+    RTLISTNODE         ListNodeChainRead;
+    /** List node for the write filter chain. */
+    RTLISTNODE         ListNodeChainWrite;
+    /** Number of references to this filter. */
+    uint32_t           cRefs;
     /** Opaque VD filter backend instance data. */
     void              *pvBackendData;
     /** Pointer to the filter backend interface. */
@@ -289,15 +291,10 @@ struct VBOXHDD
     /** Pointer to the discard state if any. */
     PVDDISCARDSTATE        pDiscard;
 
-     /** Pointer to the first filter in the chain. */
-     PVDFILTER              pFilterHead;
-     /** Pointer to the last filter in the chain. */
-     PVDFILTER              pFilterTail;
-
-    /** Event semaphore for synchronous I/O. */
-    RTSEMEVENT             hEventSemSyncIo;
-    /** Status code of the last synchronous I/O request. */
-    int                    rcSync;
+    /** Read filter chain - PVDFILTER. */
+    RTLISTANCHOR           ListFilterChainRead;
+    /** Write filter chain - PVDFILTER. */
+    RTLISTANCHOR           ListFilterChainWrite;
 };
 
 # define VD_IS_LOCKED(a_pDisk) \
@@ -942,45 +939,33 @@ static void vdRemoveImageFromList(PVBOXHDD pDisk, PVDIMAGE pImage)
 }
 
 /**
- * internal: add filter structure to the end of filter list.
+ * Release a referene to the filter decrementing the counter and destroying the filter
+ * when the counter reaches zero.
+ *
+ * @returns The new reference count.
+ * @param   pFilter    The filter to release.
  */
-static void vdAddFilterToList(PVBOXHDD pDisk, PVDFILTER pFilter)
+static uint32_t vdFilterRelease(PVDFILTER pFilter)
 {
-    pFilter->pPrev = NULL;
-    pFilter->pNext = NULL;
-
-    if (pDisk->pFilterHead)
+    uint32_t cRefs = ASMAtomicDecU32(&pFilter->cRefs);
+    if (!cRefs)
     {
-        pFilter->pPrev = pDisk->pFilterTail;
-        pDisk->pFilterTail->pNext = pFilter;
-        pDisk->pFilterTail = pFilter;
-    }
-    else
-    {
-        pDisk->pFilterHead = pFilter;
-        pDisk->pFilterTail = pFilter;
+        pFilter->pBackend->pfnDestroy(pFilter->pvBackendData);
+        RTMemFree(pFilter);
     }
+
+    return cRefs;
 }
 
 /**
- * internal: Remove last filter structure from the filter list.
+ * Increments the reference counter of the given filter.
+ *
+ * @return The new reference count.
+ * @param  pFilter    The filter.
  */
-static void vdRemoveFilterFromList(PVBOXHDD pDisk, PVDFILTER pFilter)
+static uint32_t vdFilterRetain(PVDFILTER pFilter)
 {
-    Assert(pDisk->pFilterHead != NULL && pDisk->pFilterTail != NULL);
-
-    if (pFilter->pPrev)
-        pFilter->pPrev->pNext = pFilter->pNext;
-    else
-        pDisk->pFilterHead = pFilter->pNext;
-
-    if (pFilter->pNext)
-        pFilter->pNext->pPrev = pFilter->pPrev;
-    else
-        pDisk->pFilterTail = pFilter->pPrev;
-
-    pFilter->pPrev = NULL;
-    pFilter->pNext = NULL;
+    return ASMAtomicIncU32(&pFilter->cRefs);
 }
 
 /**
@@ -1015,19 +1000,14 @@ static int vdFilterChainApplyWrite(PVBOXHDD pDisk, uint64_t uOffset, size_t cbWr
 
     VD_IS_LOCKED(pDisk);
 
-    if (pDisk->pFilterHead)
+    PVDFILTER pFilter;
+    RTListForEach(&pDisk->ListFilterChainWrite, pFilter, VDFILTER, ListNodeChainWrite)
     {
-        PVDFILTER pFilterCurr = pDisk->pFilterHead;
-
-        do
-        {
-            rc = pFilterCurr->pBackend->pfnFilterWrite(pFilterCurr->pvBackendData, uOffset, cbWrite, pIoCtx);
-            /* Reset S/G buffer for the next filter. */
-            RTSgBufReset(&pIoCtx->Req.Io.SgBuf);
-
-            pFilterCurr = pFilterCurr->pNext;
-        } while (   RT_SUCCESS(rc)
-                 && pFilterCurr);
+        rc = pFilter->pBackend->pfnFilterWrite(pFilter->pvBackendData, uOffset, cbWrite, pIoCtx);
+        if (RT_FAILURE(rc))
+            break;
+        /* Reset S/G buffer for the next filter. */
+        RTSgBufReset(&pIoCtx->Req.Io.SgBuf);
     }
 
     return rc;
@@ -1049,22 +1029,17 @@ static int vdFilterChainApplyRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRea
 
     VD_IS_LOCKED(pDisk);
 
-    if (pDisk->pFilterHead)
-    {
-        PVDFILTER pFilterCurr = pDisk->pFilterHead;
+    /* Reset buffer before starting. */
+    RTSgBufReset(&pIoCtx->Req.Io.SgBuf);
 
-        /* Reset buffer before starting. */
+    PVDFILTER pFilter;
+    RTListForEach(&pDisk->ListFilterChainRead, pFilter, VDFILTER, ListNodeChainRead)
+    {
+        rc = pFilter->pBackend->pfnFilterRead(pFilter->pvBackendData, uOffset, cbRead, pIoCtx);
+        if (RT_FAILURE(rc))
+            break;
+        /* Reset S/G buffer for the next filter. */
         RTSgBufReset(&pIoCtx->Req.Io.SgBuf);
-
-        do
-        {
-            rc = pFilterCurr->pBackend->pfnFilterRead(pFilterCurr->pvBackendData, uOffset, cbRead, pIoCtx);
-            /* Reset S/G buffer for the next filter. */
-            RTSgBufReset(&pIoCtx->Req.Io.SgBuf);
-
-            pFilterCurr = pFilterCurr->pNext;
-        } while (   RT_SUCCESS(rc)
-                 && pFilterCurr);
     }
 
     return rc;
@@ -1428,6 +1403,35 @@ DECLINLINE(PVDIOCTX) vdIoCtxRootAlloc(PVBOXHDD pDisk, VDIOCTXTXDIR enmTxDir,
     return pIoCtx;
 }
 
+DECLINLINE(void) vdIoCtxDiscardInit(PVDIOCTX pIoCtx, PVBOXHDD pDisk, PCRTRANGE paRanges,
+                                    unsigned cRanges, PFNVDASYNCTRANSFERCOMPLETE pfnComplete,
+                                    void *pvUser1, void *pvUser2, void *pvAllocation,
+                                    PFNVDIOCTXTRANSFER pfnIoCtxTransfer, uint32_t fFlags)
+{
+    pIoCtx->pIoCtxNext                = NULL;
+    pIoCtx->pDisk                     = pDisk;
+    pIoCtx->enmTxDir                  = VDIOCTXTXDIR_DISCARD;
+    pIoCtx->cDataTransfersPending     = 0;
+    pIoCtx->cMetaTransfersPending     = 0;
+    pIoCtx->fComplete                 = false;
+    pIoCtx->fFlags                    = fFlags;
+    pIoCtx->pvAllocation              = pvAllocation;
+    pIoCtx->pfnIoCtxTransfer          = pfnIoCtxTransfer;
+    pIoCtx->pfnIoCtxTransferNext      = NULL;
+    pIoCtx->rcReq                     = VINF_SUCCESS;
+    pIoCtx->Req.Discard.paRanges      = paRanges;
+    pIoCtx->Req.Discard.cRanges       = cRanges;
+    pIoCtx->Req.Discard.idxRange      = 0;
+    pIoCtx->Req.Discard.cbDiscardLeft = 0;
+    pIoCtx->Req.Discard.offCur        = 0;
+    pIoCtx->Req.Discard.cbThisDiscard = 0;
+
+    pIoCtx->pIoCtxParent          = NULL;
+    pIoCtx->Type.Root.pfnComplete = pfnComplete;
+    pIoCtx->Type.Root.pvUser1     = pvUser1;
+    pIoCtx->Type.Root.pvUser2     = pvUser2;
+}
+
 DECLINLINE(PVDIOCTX) vdIoCtxDiscardAlloc(PVBOXHDD pDisk, PCRTRANGE paRanges,
                                          unsigned cRanges,
                                          PFNVDASYNCTRANSFERCOMPLETE pfnComplete,
@@ -1441,28 +1445,8 @@ DECLINLINE(PVDIOCTX) vdIoCtxDiscardAlloc(PVBOXHDD pDisk, PCRTRANGE paRanges,
     pIoCtx = (PVDIOCTX)RTMemCacheAlloc(pDisk->hMemCacheIoCtx);
     if (RT_LIKELY(pIoCtx))
     {
-        pIoCtx->pIoCtxNext                = NULL;
-        pIoCtx->pDisk                     = pDisk;
-        pIoCtx->enmTxDir                  = VDIOCTXTXDIR_DISCARD;
-        pIoCtx->cDataTransfersPending     = 0;
-        pIoCtx->cMetaTransfersPending     = 0;
-        pIoCtx->fComplete                 = false;
-        pIoCtx->fFlags                    = fFlags;
-        pIoCtx->pvAllocation              = pvAllocation;
-        pIoCtx->pfnIoCtxTransfer          = pfnIoCtxTransfer;
-        pIoCtx->pfnIoCtxTransferNext      = NULL;
-        pIoCtx->rcReq                     = VINF_SUCCESS;
-        pIoCtx->Req.Discard.paRanges      = paRanges;
-        pIoCtx->Req.Discard.cRanges       = cRanges;
-        pIoCtx->Req.Discard.idxRange      = 0;
-        pIoCtx->Req.Discard.cbDiscardLeft = 0;
-        pIoCtx->Req.Discard.offCur        = 0;
-        pIoCtx->Req.Discard.cbThisDiscard = 0;
-
-        pIoCtx->pIoCtxParent          = NULL;
-        pIoCtx->Type.Root.pfnComplete = pfnComplete;
-        pIoCtx->Type.Root.pvUser1     = pvUser1;
-        pIoCtx->Type.Root.pvUser2     = pvUser2;
+        vdIoCtxDiscardInit(pIoCtx, pDisk, paRanges, cRanges, pfnComplete, pvUser1,
+                           pvUser2, pvAllocation, pfnIoCtxTransfer, fFlags);
     }
 
     LogFlow(("Allocated discard I/O context %#p\n", pIoCtx));
@@ -1707,18 +1691,15 @@ static int vdIoCtxProcessLocked(PVDIOCTX pIoCtx)
     {
         ASMAtomicCmpXchgS32(&pIoCtx->rcReq, rc, VINF_SUCCESS);
 
-        if (rc != VERR_DISK_FULL)
-        {
-            /*
-             * The I/O context completed if we have an error and there is no data
-             * or meta data transfer pending.
-             */
-            if (   !pIoCtx->cMetaTransfersPending
-                && !pIoCtx->cDataTransfersPending)
-                rc = VINF_VD_ASYNC_IO_FINISHED;
-            else
-                rc = VERR_VD_ASYNC_IO_IN_PROGRESS;
-        }
+        /*
+         * The I/O context completed if we have an error and there is no data
+         * or meta data transfer pending.
+         */
+        if (   !pIoCtx->cMetaTransfersPending
+            && !pIoCtx->cDataTransfersPending)
+            rc = VINF_VD_ASYNC_IO_FINISHED;
+        else
+            rc = VERR_VD_ASYNC_IO_IN_PROGRESS;
     }
 
 out:
@@ -1732,7 +1713,8 @@ out:
 /**
  * Processes the list of waiting I/O contexts.
  *
- * @returns VBox status code.
+ * @returns VBox status code, only valid if pIoCtxRc is not NULL, treat as void
+ *          function otherwise.
  * @param   pDisk    The disk structure.
  * @param   pIoCtxRc An I/O context handle which waits on the list. When processed
  *                   The status code is returned. NULL if there is no I/O context
@@ -1740,7 +1722,7 @@ out:
  */
 static int vdDiskProcessWaitingIoCtx(PVBOXHDD pDisk, PVDIOCTX pIoCtxRc)
 {
-    int rc = VINF_SUCCESS;
+    int rc = VERR_VD_ASYNC_IO_IN_PROGRESS;
 
     LogFlowFunc(("pDisk=%#p pIoCtxRc=%#p\n", pDisk, pIoCtxRc));
 
@@ -1797,7 +1779,11 @@ static int vdDiskProcessWaitingIoCtx(PVBOXHDD pDisk, PVDIOCTX pIoCtxRc)
             }
 
             /* The given I/O context was processed, pass the return code to the caller. */
-            rc = rcTmp;
+            if (   rcTmp == VINF_VD_ASYNC_IO_FINISHED
+                && (pTmp->fFlags & VDIOCTX_FLAGS_SYNC))
+                rc = pTmp->rcReq;
+            else
+                rc = rcTmp;
         }
         else if (   rcTmp == VINF_VD_ASYNC_IO_FINISHED
                  && ASMAtomicCmpXchgBool(&pTmp->fComplete, true, false))
@@ -1809,15 +1795,6 @@ static int vdDiskProcessWaitingIoCtx(PVBOXHDD pDisk, PVDIOCTX pIoCtxRc)
         }
     }
 
-    /*
-     * vdIoCtxProcessLocked() never returns VINF_SUCCESS.
-     * If the status code is still set and a valid I/O context was given
-     * it was not found on the list (another thread cleared it already).
-     * Return I/O in progress status code in that case.
-     */
-    if (rc == VINF_SUCCESS && pIoCtxRc)
-        rc = VERR_VD_ASYNC_IO_IN_PROGRESS;
-
     LogFlowFunc(("returns rc=%Rrc\n", rc));
     return rc;
 }
@@ -1913,16 +1890,17 @@ static int vdIoCtxProcessTryLockDefer(PVDIOCTX pIoCtx)
  * for it to complete.
  *
  * @returns VBox status code of the completed request.
- * @param   pIoCtx    The sync I/O context.
+ * @param   pIoCtx            The sync I/O context.
+ * @param   hEventComplete    Event sempahore to wait on for completion.
  */
-static int vdIoCtxProcessSync(PVDIOCTX pIoCtx)
+static int vdIoCtxProcessSync(PVDIOCTX pIoCtx, RTSEMEVENT hEventComplete)
 {
     int rc = VINF_SUCCESS;
     PVBOXHDD pDisk = pIoCtx->pDisk;
 
     LogFlowFunc(("pIoCtx=%p\n", pIoCtx));
 
-    AssertMsg(pIoCtx->fFlags & VDIOCTX_FLAGS_SYNC,
+    AssertMsg(pIoCtx->fFlags & (VDIOCTX_FLAGS_SYNC | VDIOCTX_FLAGS_DONT_FREE),
               ("I/O context is not marked as synchronous\n"));
 
     rc = vdIoCtxProcessTryLockDefer(pIoCtx);
@@ -1931,17 +1909,13 @@ static int vdIoCtxProcessSync(PVDIOCTX pIoCtx)
 
     if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
     {
-        rc = RTSemEventWait(pDisk->hEventSemSyncIo, RT_INDEFINITE_WAIT);
+        rc = RTSemEventWait(hEventComplete, RT_INDEFINITE_WAIT);
         AssertRC(rc);
-
-        rc = pDisk->rcSync;
-    }
-    else /* Success or error. */
-    {
-        rc = pIoCtx->rcReq;
-        vdIoCtxFree(pDisk, pIoCtx);
     }
 
+    rc = pIoCtx->rcReq;
+    vdIoCtxFree(pDisk, pIoCtx);
+
     return rc;
 }
 
@@ -2244,10 +2218,16 @@ static int vdReadHelperEx(PVBOXHDD pDisk, PVDIMAGE pImage, PVDIMAGE pImageParent
                           uint64_t uOffset, void *pvBuf, size_t cbRead,
                           bool fZeroFreeBlocks, bool fUpdateCache, unsigned cImagesRead)
 {
+    int rc = VINF_SUCCESS;
     uint32_t fFlags = VDIOCTX_FLAGS_SYNC | VDIOCTX_FLAGS_DONT_FREE;
     RTSGSEG Segment;
     RTSGBUF SgBuf;
     VDIOCTX IoCtx;
+    RTSEMEVENT hEventComplete = NIL_RTSEMEVENT;
+
+    rc = RTSemEventCreate(&hEventComplete);
+    if (RT_FAILURE(rc))
+        return rc;
 
     if (fZeroFreeBlocks)
         fFlags |= VDIOCTX_FLAGS_ZERO_FREE_BLOCKS;
@@ -2264,8 +2244,10 @@ static int vdReadHelperEx(PVBOXHDD pDisk, PVDIMAGE pImage, PVDIMAGE pImageParent
     IoCtx.Req.Io.cImagesRead = cImagesRead;
     IoCtx.Type.Root.pfnComplete = vdIoCtxSyncComplete;
     IoCtx.Type.Root.pvUser1     = pDisk;
-    IoCtx.Type.Root.pvUser2     = NULL;
-    return vdIoCtxProcessSync(&IoCtx);
+    IoCtx.Type.Root.pvUser2     = hEventComplete;
+    rc = vdIoCtxProcessSync(&IoCtx, hEventComplete);
+    RTSemEventDestroy(hEventComplete);
+    return rc;
 }
 
 /**
@@ -2336,9 +2318,15 @@ static int vdWriteHelperEx(PVBOXHDD pDisk, PVDIMAGE pImage,
                            const void *pvBuf, size_t cbWrite,
                            uint32_t fFlags, unsigned cImagesRead)
 {
+    int rc = VINF_SUCCESS;
     RTSGSEG Segment;
     RTSGBUF SgBuf;
     VDIOCTX IoCtx;
+    RTSEMEVENT hEventComplete = NIL_RTSEMEVENT;
+
+    rc = RTSemEventCreate(&hEventComplete);
+    if (RT_FAILURE(rc))
+        return rc;
 
     fFlags |= VDIOCTX_FLAGS_SYNC | VDIOCTX_FLAGS_DONT_FREE;
 
@@ -2353,8 +2341,12 @@ static int vdWriteHelperEx(PVBOXHDD pDisk, PVDIMAGE pImage,
     IoCtx.pIoCtxParent          = NULL;
     IoCtx.Type.Root.pfnComplete = vdIoCtxSyncComplete;
     IoCtx.Type.Root.pvUser1     = pDisk;
-    IoCtx.Type.Root.pvUser2     = NULL;
-    return vdIoCtxProcessSync(&IoCtx);
+    IoCtx.Type.Root.pvUser2     = hEventComplete;
+    if (RT_SUCCESS(rc))
+        rc = vdIoCtxProcessSync(&IoCtx, hEventComplete);
+
+    RTSemEventDestroy(hEventComplete);
+    return rc;
 }
 
 /**
@@ -2384,12 +2376,16 @@ static int vdCopyHelper(PVBOXHDD pDiskFrom, PVDIMAGE pImageFrom, PVBOXHDD pDiskT
     void *pvBuf = NULL;
     bool fLockReadFrom = false;
     bool fLockWriteTo = false;
-    bool fBlockwiseCopy = fSuppressRedundantIo || (cImagesFromRead > 0);
+    bool fBlockwiseCopy = false;
     unsigned uProgressOld = 0;
 
     LogFlowFunc(("pDiskFrom=%#p pImageFrom=%#p pDiskTo=%#p cbSize=%llu cImagesFromRead=%u cImagesToRead=%u fSuppressRedundantIo=%RTbool pIfProgress=%#p pDstIfProgress=%#p\n",
                  pDiskFrom, pImageFrom, pDiskTo, cbSize, cImagesFromRead, cImagesToRead, fSuppressRedundantIo, pDstIfProgress, pDstIfProgress));
 
+    if (   (fSuppressRedundantIo || (cImagesFromRead > 0))
+        && RTListIsEmpty(&pDiskFrom->ListFilterChainRead))
+        fBlockwiseCopy = true;
+
     /* Allocate tmp buffer. */
     pvBuf = RTMemTmpAlloc(VD_MERGE_BUFFER_SIZE);
     if (!pvBuf)
@@ -2771,6 +2767,41 @@ static int vdWriteHelperOptimizedAsync(PVDIOCTX pIoCtx)
     return VINF_SUCCESS;
 }
 
+static int vdWriteHelperStandardReadImageAsync(PVDIOCTX pIoCtx)
+{
+    int rc = VINF_SUCCESS;
+
+    LogFlowFunc(("pIoCtx=%#p\n", pIoCtx));
+
+    pIoCtx->fFlags |= VDIOCTX_FLAGS_ZERO_FREE_BLOCKS;
+
+    if (   pIoCtx->Req.Io.cbTransferLeft
+        && !pIoCtx->cDataTransfersPending)
+        rc = vdReadHelperAsync(pIoCtx);
+
+    if (   RT_SUCCESS(rc)
+        && (   pIoCtx->Req.Io.cbTransferLeft
+            || pIoCtx->cMetaTransfersPending))
+        rc = VERR_VD_ASYNC_IO_IN_PROGRESS;
+    else
+    {
+        size_t cbFill = pIoCtx->Type.Child.Write.Optimized.cbFill;
+
+        /* Zero out the remainder of this block. Will never be visible, as this
+         * is beyond the limit of the image. */
+        if (cbFill)
+            vdIoCtxSet(pIoCtx, '\0', cbFill);
+
+        /* Write the full block to the virtual disk. */
+        RTSgBufReset(&pIoCtx->Req.Io.SgBuf);
+
+        vdIoCtxChildReset(pIoCtx);
+        pIoCtx->pfnIoCtxTransferNext = vdWriteHelperCommitAsync;
+    }
+
+    return rc;
+}
+
 static int vdWriteHelperStandardAssemble(PVDIOCTX pIoCtx)
 {
     int rc = VINF_SUCCESS;
@@ -2800,22 +2831,26 @@ static int vdWriteHelperStandardAssemble(PVDIOCTX pIoCtx)
             RTSgBufCopy(&pIoCtx->Req.Io.SgBuf, &SgBufParentTmp, cbWriteCopy);
         }
 
-        /* Zero out the remainder of this block. Will never be visible, as this
-         * is beyond the limit of the image. */
-        if (cbFill)
-        {
-            RTSgBufAdvance(&pIoCtx->Req.Io.SgBuf, cbReadImage);
-            vdIoCtxSet(pIoCtx, '\0', cbFill);
-        }
-
         if (cbReadImage)
         {
             /* Read remaining data. */
+            pIoCtx->pfnIoCtxTransferNext = vdWriteHelperStandardReadImageAsync;
+
+            /* Read the data that goes before the write to fill the block. */
+            pIoCtx->Req.Io.cbTransferLeft = (uint32_t)cbReadImage; Assert(cbReadImage == (uint32_t)cbReadImage);
+            pIoCtx->Req.Io.cbTransfer     = pIoCtx->Req.Io.cbTransferLeft;
+            pIoCtx->Req.Io.uOffset       += cbWriteCopy;
         }
         else
         {
+            /* Zero out the remainder of this block. Will never be visible, as this
+             * is beyond the limit of the image. */
+            if (cbFill)
+                vdIoCtxSet(pIoCtx, '\0', cbFill);
+
             /* Write the full block to the virtual disk. */
             RTSgBufReset(&pIoCtx->Req.Io.SgBuf);
+            vdIoCtxChildReset(pIoCtx);
             pIoCtx->pfnIoCtxTransferNext = vdWriteHelperCommitAsync;
         }
     }
@@ -2823,6 +2858,7 @@ static int vdWriteHelperStandardAssemble(PVDIOCTX pIoCtx)
     {
         /* Write the full block to the virtual disk. */
         RTSgBufReset(&pIoCtx->Req.Io.SgBuf);
+        vdIoCtxChildReset(pIoCtx);
         pIoCtx->pfnIoCtxTransferNext = vdWriteHelperCommitAsync;
     }
 
@@ -2837,7 +2873,8 @@ static int vdWriteHelperStandardPreReadAsync(PVDIOCTX pIoCtx)
 
     pIoCtx->fFlags |= VDIOCTX_FLAGS_ZERO_FREE_BLOCKS;
 
-    if (pIoCtx->Req.Io.cbTransferLeft)
+    if (   pIoCtx->Req.Io.cbTransferLeft
+        && !pIoCtx->cDataTransfersPending)
         rc = vdReadHelperAsync(pIoCtx);
 
     if (   RT_SUCCESS(rc)
@@ -2872,9 +2909,10 @@ static int vdWriteHelperStandardAsync(PVDIOCTX pIoCtx)
     {
         /* If we have data to be written, use that instead of reading
          * data from the image. */
-        cbWriteCopy;
         if (cbWrite > cbThisWrite)
             cbWriteCopy = RT_MIN(cbWrite - cbThisWrite, cbPostRead);
+        else
+            cbWriteCopy = 0;
 
         /* Figure out how much we cannot read from the image, because
          * the last block to write might exceed the nominal size of the
@@ -2982,7 +3020,7 @@ static int vdWriteHelperAsync(PVDIOCTX pIoCtx)
                  * A bit hackish but avoids the need to allocate memory twice.
                  */
                 PRTSGBUF pTmp = (PRTSGBUF)RTMemAlloc(cbPreRead + cbThisWrite + cbPostRead + sizeof(RTSGSEG) + sizeof(RTSGBUF));
-                AssertBreakStmt(VALID_PTR(pTmp), rc = VERR_NO_MEMORY);
+                AssertBreakStmt(pTmp, rc = VERR_NO_MEMORY);
                 PRTSGSEG pSeg = (PRTSGSEG)(pTmp + 1);
 
                 pSeg->pvSeg = pSeg + 1;
@@ -3031,11 +3069,10 @@ static int vdWriteHelperAsync(PVDIOCTX pIoCtx)
                     LogFlow(("Child write request completed\n"));
                     Assert(pIoCtx->Req.Io.cbTransferLeft >= cbThisWrite);
                     Assert(cbThisWrite == (uint32_t)cbThisWrite);
+                    rc = pIoCtxWrite->rcReq;
                     ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbThisWrite);
                     vdIoCtxUnlockDisk(pDisk, pIoCtx, false /* fProcessDeferredReqs*/ );
                     vdIoCtxFree(pDisk, pIoCtxWrite);
-
-                    rc = VINF_SUCCESS;
                 }
                 else
                 {
@@ -5312,7 +5349,7 @@ static DECLCALLBACK(size_t) vdIOIntIoCtxGetDataUnitSize(void *pvUser, PVDIOCTX p
 
     PVDIMAGE pImage = vdGetImageByNumber(pDisk, VD_LAST_IMAGE);
     AssertPtrReturn(pImage, 0);
-    return pImage->Backend->pfnGetSectorSize(pImage->pBackendData);  
+    return pImage->Backend->pfnGetSectorSize(pImage->pBackendData);
 }
 
 /**
@@ -5607,9 +5644,9 @@ static void vdIfIoIntCallbacksSetup(PVDINTERFACEIOINT pIfIoInt)
 static DECLCALLBACK(void) vdIoCtxSyncComplete(void *pvUser1, void *pvUser2, int rcReq)
 {
     PVBOXHDD pDisk = (PVBOXHDD)pvUser1;
+    RTSEMEVENT hEvent = (RTSEMEVENT)pvUser2;
 
-    pDisk->rcSync = rcReq;
-    RTSemEventSignal(pDisk->hEventSemSyncIo);
+    RTSemEventSignal(hEvent);
 }
 
 /**
@@ -5629,7 +5666,7 @@ VBOXDDU_DECL(int) VDInit(void)
             rc = vdLoadDynamicBackends();
         }
     }
-    LogRel(("VDInit finished\n"));
+    LogRel(("VD: VDInit finished\n"));
     return rc;
 }
 
@@ -5955,15 +5992,10 @@ VBOXDDU_DECL(int) VDCreate(PVDINTERFACE pVDIfsDisk, VDTYPE enmType, PVBOXHDD *pp
             pDisk->pIoCtxLockOwner         = NULL;
             pDisk->pIoCtxHead              = NULL;
             pDisk->fLocked                 = false;
-            pDisk->hEventSemSyncIo         = NIL_RTSEMEVENT;
             pDisk->hMemCacheIoCtx          = NIL_RTMEMCACHE;
             pDisk->hMemCacheIoTask         = NIL_RTMEMCACHE;
-            pDisk->pFilterHead             = NULL;
-            pDisk->pFilterTail             = NULL;
-
-            rc = RTSemEventCreate(&pDisk->hEventSemSyncIo);
-            if (RT_FAILURE(rc))
-                break;
+            RTListInit(&pDisk->ListFilterChainWrite);
+            RTListInit(&pDisk->ListFilterChainRead);
 
             /* Create the I/O ctx cache */
             rc = RTMemCacheCreate(&pDisk->hMemCacheIoCtx, sizeof(VDIOCTX), 0, UINT32_MAX,
@@ -5992,8 +6024,6 @@ VBOXDDU_DECL(int) VDCreate(PVDINTERFACE pVDIfsDisk, VDTYPE enmType, PVBOXHDD *pp
     if (   RT_FAILURE(rc)
         && pDisk)
     {
-        if (pDisk->hEventSemSyncIo != NIL_RTSEMEVENT)
-            RTSemEventDestroy(pDisk->hEventSemSyncIo);
         if (pDisk->hMemCacheIoCtx != NIL_RTMEMCACHE)
             RTMemCacheDestroy(pDisk->hMemCacheIoCtx);
         if (pDisk->hMemCacheIoTask != NIL_RTMEMCACHE)
@@ -6029,7 +6059,6 @@ VBOXDDU_DECL(int) VDDestroy(PVBOXHDD pDisk)
 
         RTMemCacheDestroy(pDisk->hMemCacheIoCtx);
         RTMemCacheDestroy(pDisk->hMemCacheIoTask);
-        RTSemEventDestroy(pDisk->hEventSemSyncIo);
         RTMemFree(pDisk);
     } while (0);
     LogFlowFunc(("returns %Rrc\n", rc));
@@ -6694,15 +6723,7 @@ VBOXDDU_DECL(int) VDCacheOpen(PVBOXHDD pDisk, const char *pszBackend,
     return rc;
 }
 
-/**
- * Adds a filter to the disk.
- *
- * @returns VBox status code.
- * @param   pDisk           Pointer to the HDD container which should use the filter.
- * @param   pszFilter       Name of the filter backend to use (case insensitive).
- * @param   pVDIfsFilter    Pointer to the per-filter VD interface list.
- */
-VBOXDDU_DECL(int) VDFilterAdd(PVBOXHDD pDisk, const char *pszFilter,
+VBOXDDU_DECL(int) VDFilterAdd(PVBOXHDD pDisk, const char *pszFilter, uint32_t fFlags,
                               PVDINTERFACE pVDIfsFilter)
 {
     int rc = VINF_SUCCESS;
@@ -6724,6 +6745,10 @@ VBOXDDU_DECL(int) VDFilterAdd(PVBOXHDD pDisk, const char *pszFilter,
                            ("pszFilter=%#p \"%s\"\n", pszFilter, pszFilter),
                            rc = VERR_INVALID_PARAMETER);
 
+        AssertMsgBreakStmt(!(fFlags & ~VD_FILTER_FLAGS_MASK),
+                           ("Invalid flags set (fFlags=%#x)\n", fFlags),
+                           rc = VERR_INVALID_PARAMETER);
+
         /* Set up image descriptor. */
         pFilter = (PVDFILTER)RTMemAllocZ(sizeof(VDFILTER));
         if (!pFilter)
@@ -6752,24 +6777,28 @@ VBOXDDU_DECL(int) VDFilterAdd(PVBOXHDD pDisk, const char *pszFilter,
                             &pFilter->VDIo, sizeof(VDINTERFACEIOINT), &pFilter->pVDIfsFilter);
         AssertRC(rc);
 
-        rc = pFilter->pBackend->pfnCreate(pDisk->pVDIfsDisk, pFilter->pVDIfsFilter,
-                                          &pFilter->pvBackendData);
-
-        /* If the open in read-write mode failed, retry in read-only mode. */
+        rc = pFilter->pBackend->pfnCreate(pDisk->pVDIfsDisk, fFlags & VD_FILTER_FLAGS_INFO,
+                                          pFilter->pVDIfsFilter, &pFilter->pvBackendData);
         if (RT_FAILURE(rc))
-        {
-            rc = vdError(pDisk, rc, RT_SRC_POS,
-                         N_("VD: error %Rrc creating filter '%s'"), rc, pszFilter);
             break;
-        }
 
         /* Lock disk for writing, as we modify pDisk information below. */
         rc2 = vdThreadStartWrite(pDisk);
         AssertRC(rc2);
         fLockWrite = true;
 
-        /* Add filter to chain. */
-        vdAddFilterToList(pDisk, pFilter);
+        /* Add filter to chains. */
+        if (fFlags & VD_FILTER_FLAGS_WRITE)
+        {
+            RTListAppend(&pDisk->ListFilterChainWrite, &pFilter->ListNodeChainWrite);
+            vdFilterRetain(pFilter);
+        }
+
+        if (fFlags & VD_FILTER_FLAGS_READ)
+        {
+            RTListAppend(&pDisk->ListFilterChainRead, &pFilter->ListNodeChainRead);
+            vdFilterRetain(pFilter);
+        }
     } while (0);
 
     if (RT_UNLIKELY(fLockWrite))
@@ -6960,6 +6989,7 @@ VBOXDDU_DECL(int) VDCreateBase(PVBOXHDD pDisk, const char *pszBackend,
                                         pDisk->pVDIfsDisk,
                                         pImage->pVDIfsImage,
                                         pVDIfsOperation,
+                                        pDisk->enmType,
                                         &pImage->pBackendData);
 
         if (RT_SUCCESS(rc))
@@ -7237,6 +7267,7 @@ VBOXDDU_DECL(int) VDCreateDiff(PVBOXHDD pDisk, const char *pszBackend,
                                         pDisk->pVDIfsDisk,
                                         pImage->pVDIfsImage,
                                         pVDIfsOperation,
+                                        pDisk->enmType,
                                         &pImage->pBackendData);
 
         if (RT_SUCCESS(rc))
@@ -8613,6 +8644,197 @@ VBOXDDU_DECL(int) VDResize(PVBOXHDD pDisk, uint64_t cbSize,
     return rc;
 }
 
+VBOXDDU_DECL(int) VDPrepareWithFilters(PVBOXHDD pDisk, PVDINTERFACE pVDIfsOperation)
+{
+    int rc = VINF_SUCCESS;
+    int rc2;
+    bool fLockRead = false, fLockWrite = false;
+
+    LogFlowFunc(("pDisk=%#p pVDIfsOperation=%#p\n", pDisk, pVDIfsOperation));
+
+    PVDINTERFACEPROGRESS pIfProgress = VDIfProgressGet(pVDIfsOperation);
+
+    do {
+        /* Check arguments. */
+        AssertMsgBreakStmt(VALID_PTR(pDisk), ("pDisk=%#p\n", pDisk),
+                           rc = VERR_INVALID_PARAMETER);
+        AssertMsg(pDisk->u32Signature == VBOXHDDDISK_SIGNATURE,
+                  ("u32Signature=%08x\n", pDisk->u32Signature));
+
+        rc2 = vdThreadStartRead(pDisk);
+        AssertRC(rc2);
+        fLockRead = true;
+
+        /* Must have at least one image in the chain. */
+        AssertMsgBreakStmt(pDisk->cImages >= 1, ("cImages=%u\n", pDisk->cImages),
+                           rc = VERR_VD_NOT_OPENED);
+
+        unsigned uOpenFlags = pDisk->pLast->Backend->pfnGetOpenFlags(pDisk->pLast->pBackendData);
+        AssertMsgBreakStmt(!(uOpenFlags & VD_OPEN_FLAGS_READONLY),
+                           ("Last image should be read write"),
+                           rc = VERR_VD_IMAGE_READ_ONLY);
+
+        rc2 = vdThreadFinishRead(pDisk);
+        AssertRC(rc2);
+        fLockRead = false;
+
+        rc2 = vdThreadStartWrite(pDisk);
+        AssertRC(rc2);
+        fLockWrite = true;
+
+        /*
+         * Open all images in the chain in read write mode first to avoid running
+         * into an error in the middle of the process.
+         */
+        PVDIMAGE pImage = pDisk->pBase;
+
+        while (pImage)
+        {
+            uOpenFlags = pImage->Backend->pfnGetOpenFlags(pImage->pBackendData);
+            if (uOpenFlags & VD_OPEN_FLAGS_READONLY)
+            {
+                /*
+                 * Clear skip consistency checks because the image is made writable now and
+                 * skipping consistency checks is only possible for readonly images.
+                 */
+                uOpenFlags &= ~(VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_SKIP_CONSISTENCY_CHECKS);
+                rc = pImage->Backend->pfnSetOpenFlags(pImage->pBackendData, uOpenFlags);
+                if (RT_FAILURE(rc))
+                    break;
+            }
+            pImage = pImage->pNext;
+        }
+
+        if (RT_SUCCESS(rc))
+        {
+            unsigned cImgCur = 0;
+            unsigned uPercentStart = 0;
+            unsigned uPercentSpan = 100 / pDisk->cImages - 1;
+
+            /* Allocate tmp buffer. */
+            void *pvBuf = RTMemTmpAlloc(VD_MERGE_BUFFER_SIZE);
+            if (!pvBuf)
+            {
+                rc = VERR_NO_MEMORY;
+                break;
+            }
+
+            pImage = pDisk->pBase;
+            pDisk->fLocked = true;
+
+            while (   pImage
+                   && RT_SUCCESS(rc))
+            {
+                /* Get size of image. */
+                uint64_t cbSize = pImage->Backend->pfnGetSize(pImage->pBackendData);
+                uint64_t cbSizeFile = pImage->Backend->pfnGetFileSize(pImage->pBackendData);
+                uint64_t cbFileWritten = 0;
+                uint64_t uOffset = 0;
+                uint64_t cbRemaining = cbSize;
+
+                do
+                {
+                    size_t cbThisRead = RT_MIN(VD_MERGE_BUFFER_SIZE, cbRemaining);
+                    RTSGSEG SegmentBuf;
+                    RTSGBUF SgBuf;
+                    VDIOCTX IoCtx;
+
+                    SegmentBuf.pvSeg = pvBuf;
+                    SegmentBuf.cbSeg = VD_MERGE_BUFFER_SIZE;
+                    RTSgBufInit(&SgBuf, &SegmentBuf, 1);
+                    vdIoCtxInit(&IoCtx, pDisk, VDIOCTXTXDIR_READ, 0, 0, NULL,
+                                &SgBuf, NULL, NULL, VDIOCTX_FLAGS_SYNC);
+
+                    rc = pImage->Backend->pfnRead(pImage->pBackendData, uOffset,
+                                                  cbThisRead, &IoCtx, &cbThisRead);
+                    if (rc != VERR_VD_BLOCK_FREE)
+                    {
+                        if (RT_FAILURE(rc))
+                            break;
+
+                        /* Apply filter chains. */
+                        rc = vdFilterChainApplyRead(pDisk, uOffset, cbThisRead, &IoCtx);
+                        if (RT_FAILURE(rc))
+                            break;
+
+                        rc = vdFilterChainApplyWrite(pDisk, uOffset, cbThisRead, &IoCtx);
+                        if (RT_FAILURE(rc))
+                            break;
+
+                        RTSgBufReset(&SgBuf);
+                        size_t cbThisWrite = 0;
+                        size_t cbPreRead = 0;
+                        size_t cbPostRead = 0;
+                        rc = pImage->Backend->pfnWrite(pImage->pBackendData, uOffset,
+                                                       cbThisRead, &IoCtx, &cbThisWrite,
+                                                       &cbPreRead, &cbPostRead, VD_WRITE_NO_ALLOC);
+                        if (RT_FAILURE(rc))
+                            break;
+                        Assert(cbThisWrite == cbThisRead);
+                        cbFileWritten += cbThisWrite;
+                    }
+                    else
+                        rc = VINF_SUCCESS;
+
+                    uOffset += cbThisRead;
+                    cbRemaining -= cbThisRead;
+
+                    if (pIfProgress && pIfProgress->pfnProgress)
+                    {
+                        rc2 = pIfProgress->pfnProgress(pIfProgress->Core.pvUser,
+                                                       uPercentStart + cbFileWritten * uPercentSpan / cbSizeFile);
+                        AssertRC(rc2); /* Cancelling this operation without leaving an inconsistent state is not possible. */
+                    }
+                } while (uOffset < cbSize);
+
+                pImage = pImage->pNext;
+                cImgCur++;
+                uPercentStart += uPercentSpan;
+            }
+
+            pDisk->fLocked = false;
+            if (pvBuf)
+                RTMemTmpFree(pvBuf);
+        }
+
+        /* Change images except last one back to readonly. */
+        pImage = pDisk->pBase;
+        while (   pImage != pDisk->pLast
+               && pImage)
+        {
+            uOpenFlags = pImage->Backend->pfnGetOpenFlags(pImage->pBackendData);
+            uOpenFlags |= VD_OPEN_FLAGS_READONLY;
+            rc2 = pImage->Backend->pfnSetOpenFlags(pImage->pBackendData, uOpenFlags);
+            if (RT_FAILURE(rc2))
+            {
+                if (RT_SUCCESS(rc))
+                    rc = rc2;
+                break;
+            }
+            pImage = pImage->pNext;
+        }
+    } while (0);
+
+    if (RT_UNLIKELY(fLockWrite))
+    {
+        rc2 = vdThreadFinishWrite(pDisk);
+        AssertRC(rc2);
+    }
+    else if (RT_UNLIKELY(fLockRead))
+    {
+        rc2 = vdThreadFinishRead(pDisk);
+        AssertRC(rc2);
+    }
+
+    if (   RT_SUCCESS(rc)
+        && pIfProgress
+        && pIfProgress->pfnProgress)
+        pIfProgress->pfnProgress(pIfProgress->Core.pvUser, 100);
+
+    LogFlowFunc(("returns %Rrc\n", rc));
+    return rc;
+}
+
 /**
  * Closes the last opened image file in HDD container.
  * If previous image file was opened in read-only mode (the normal case) and
@@ -8774,14 +8996,7 @@ VBOXDDU_DECL(int) VDCacheClose(PVBOXHDD pDisk, bool fDelete)
     return rc;
 }
 
-/**
- * Removes the last added filter in the HDD container.
- *
- * @return  VBox status code.
- * @retval  VERR_VD_NOT_OPENED if no filter is present for the disk.
- * @param   pDisk           Pointer to HDD container.
- */
-VBOXDDU_DECL(int) VDFilterRemove(PVBOXHDD pDisk)
+VBOXDDU_DECL(int) VDFilterRemove(PVBOXHDD pDisk, uint32_t fFlags)
 {
     int rc = VINF_SUCCESS;
     int rc2;
@@ -8796,17 +9011,31 @@ VBOXDDU_DECL(int) VDFilterRemove(PVBOXHDD pDisk)
         AssertPtrBreakStmt(pDisk, rc = VERR_INVALID_PARAMETER);
         AssertMsg(pDisk->u32Signature == VBOXHDDDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature));
 
+        AssertMsgBreakStmt(!(fFlags & ~VD_FILTER_FLAGS_MASK),
+                           ("Invalid flags set (fFlags=%#x)\n", fFlags),
+                           rc = VERR_INVALID_PARAMETER);
+
         rc2 = vdThreadStartWrite(pDisk);
         AssertRC(rc2);
         fLockWrite = true;
 
-        AssertPtrBreakStmt(pDisk->pFilterHead, rc = VERR_VD_NOT_OPENED);
-
-        pFilter = pDisk->pFilterTail;
-        vdRemoveFilterFromList(pDisk, pFilter);
+        if (fFlags & VD_FILTER_FLAGS_WRITE)
+        {
+            AssertBreakStmt(!RTListIsEmpty(&pDisk->ListFilterChainWrite), rc = VERR_VD_NOT_OPENED);
+            pFilter = RTListGetLast(&pDisk->ListFilterChainWrite, VDFILTER, ListNodeChainWrite);
+            AssertPtr(pFilter);
+            RTListNodeRemove(&pFilter->ListNodeChainWrite);
+            vdFilterRelease(pFilter);
+        }
 
-        pFilter->pBackend->pfnDestroy(pFilter->pvBackendData);
-        RTMemFree(pFilter);
+        if (fFlags & VD_FILTER_FLAGS_READ)
+        {
+            AssertBreakStmt(!RTListIsEmpty(&pDisk->ListFilterChainRead), rc = VERR_VD_NOT_OPENED);
+            pFilter = RTListGetLast(&pDisk->ListFilterChainRead, VDFILTER, ListNodeChainRead);
+            AssertPtr(pFilter);
+            RTListNodeRemove(&pFilter->ListNodeChainRead);
+            vdFilterRelease(pFilter);
+        }
     } while (0);
 
     if (RT_LIKELY(fLockWrite))
@@ -8907,20 +9136,20 @@ VBOXDDU_DECL(int) VDFilterRemoveAll(PVBOXHDD pDisk)
         AssertRC(rc2);
         fLockWrite = true;
 
-        PVDFILTER pFilter = pDisk->pFilterTail;
-        while (VALID_PTR(pFilter))
+        PVDFILTER pFilter, pFilterNext;
+        RTListForEachSafe(&pDisk->ListFilterChainWrite, pFilter, pFilterNext, VDFILTER, ListNodeChainWrite)
         {
-            PVDFILTER pPrev = pFilter->pPrev;
-            vdRemoveFilterFromList(pDisk, pFilter);
+            RTListNodeRemove(&pFilter->ListNodeChainWrite);
+            vdFilterRelease(pFilter);
+        }
 
-            rc2 = pFilter->pBackend->pfnDestroy(pFilter->pvBackendData);
-            if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
-                rc = rc2;
-            /* Free remaining resources related to the image. */
-            RTMemFree(pFilter);
-            pFilter = pPrev;
+        RTListForEachSafe(&pDisk->ListFilterChainRead, pFilter, pFilterNext, VDFILTER, ListNodeChainRead)
+        {
+            RTListNodeRemove(&pFilter->ListNodeChainRead);
+            vdFilterRelease(pFilter);
         }
-        Assert(!VALID_PTR(pDisk->pFilterTail));
+        Assert(RTListIsEmpty(&pDisk->ListFilterChainRead));
+        Assert(RTListIsEmpty(&pDisk->ListFilterChainWrite));
     } while (0);
 
     if (RT_UNLIKELY(fLockWrite))
@@ -9103,19 +9332,22 @@ VBOXDDU_DECL(int) VDFlush(PVBOXHDD pDisk)
         PVDIMAGE pImage = pDisk->pLast;
         AssertPtrBreakStmt(pImage, rc = VERR_VD_NOT_OPENED);
 
-        PVDIOCTX pIoCtx = vdIoCtxRootAlloc(pDisk, VDIOCTXTXDIR_FLUSH, 0,
-                                           0, pDisk->pLast, NULL,
-                                           vdIoCtxSyncComplete, pDisk, NULL,
-                                           NULL, vdFlushHelperAsync,
-                                           VDIOCTX_FLAGS_SYNC);
+        VDIOCTX IoCtx;
+        RTSEMEVENT hEventComplete = NIL_RTSEMEVENT;
 
-        if (!pIoCtx)
-        {
-            rc = VERR_NO_MEMORY;
+        rc = RTSemEventCreate(&hEventComplete);
+        if (RT_FAILURE(rc))
             break;
-        }
 
-        rc = vdIoCtxProcessSync(pIoCtx);
+        vdIoCtxInit(&IoCtx, pDisk, VDIOCTXTXDIR_FLUSH, 0, 0, pImage, NULL,
+                    NULL, vdFlushHelperAsync, VDIOCTX_FLAGS_SYNC | VDIOCTX_FLAGS_DONT_FREE);
+
+        IoCtx.Type.Root.pfnComplete = vdIoCtxSyncComplete;
+        IoCtx.Type.Root.pvUser1     = pDisk;
+        IoCtx.Type.Root.pvUser2     = hEventComplete;
+        rc = vdIoCtxProcessSync(&IoCtx, hEventComplete);
+
+        RTSemEventDestroy(hEventComplete);
     } while (0);
 
     if (RT_UNLIKELY(fLockWrite))
@@ -10469,17 +10701,19 @@ VBOXDDU_DECL(int) VDDiscardRanges(PVBOXHDD pDisk, PCRTRANGE paRanges, unsigned c
                            ("Discarding not supported\n"),
                            rc = VERR_NOT_SUPPORTED);
 
-        PVDIOCTX pIoCtx = vdIoCtxDiscardAlloc(pDisk, paRanges, cRanges,
-                                              vdIoCtxSyncComplete, pDisk, NULL, NULL,
-                                              vdDiscardHelperAsync,
-                                              VDIOCTX_FLAGS_SYNC);
-        if (!pIoCtx)
-        {
-            rc = VERR_NO_MEMORY;
+        VDIOCTX IoCtx;
+        RTSEMEVENT hEventComplete = NIL_RTSEMEVENT;
+
+        rc = RTSemEventCreate(&hEventComplete);
+        if (RT_FAILURE(rc))
             break;
-        }
 
-        rc = vdIoCtxProcessSync(pIoCtx);
+        vdIoCtxDiscardInit(&IoCtx, pDisk, paRanges, cRanges,
+                           vdIoCtxSyncComplete, pDisk, hEventComplete, NULL,
+                           vdDiscardHelperAsync, VDIOCTX_FLAGS_SYNC | VDIOCTX_FLAGS_DONT_FREE);
+        rc = vdIoCtxProcessSync(&IoCtx, hEventComplete);
+
+        RTSemEventDestroy(hEventComplete);
     } while (0);
 
     if (RT_UNLIKELY(fLockWrite))
diff --git a/src/VBox/Storage/VDI.cpp b/src/VBox/Storage/VDI.cpp
index 6aeb135..ddd3a4a 100644
--- a/src/VBox/Storage/VDI.cpp
+++ b/src/VBox/Storage/VDI.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -1350,10 +1350,12 @@ static int vdiOpen(const char *pszFilename, unsigned uOpenFlags,
                    PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                    VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc;
     PVDIIMAGEDESC pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -1399,9 +1401,11 @@ static int vdiCreate(const char *pszFilename, uint64_t cbSize,
                      PCRTUUID pUuid, unsigned uOpenFlags,
                      unsigned uPercentStart, unsigned uPercentSpan,
                      PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
-                     PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                     PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                     void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p\n", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p\n",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc;
     PVDIIMAGEDESC pImage;
 
@@ -1423,6 +1427,13 @@ static int vdiCreate(const char *pszFilename, uint64_t cbSize,
         goto out;
     }
 
+    /* Check the VD container type. */
+    if (enmType != VDTYPE_HDD)
+    {
+        rc = VERR_VD_INVALID_TYPE;
+        goto out;
+    }
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -2426,10 +2437,10 @@ static int vdiCompact(void *pBackendData, unsigned uPercentStart,
         if (pfnParentRead)
         {
             pvBuf = RTMemTmpAlloc(cbBlock);
-            AssertBreakStmt(VALID_PTR(pvBuf), rc = VERR_NO_MEMORY);
+            AssertBreakStmt(pvBuf, rc = VERR_NO_MEMORY);
         }
         pvTmp = RTMemTmpAlloc(cbBlock);
-        AssertBreakStmt(VALID_PTR(pvTmp), rc = VERR_NO_MEMORY);
+        AssertBreakStmt(pvTmp, rc = VERR_NO_MEMORY);
 
         uint64_t cbFile;
         rc = vdIfIoIntFileGetSize(pImage->pIfIo, pImage->pStorage, &cbFile);
@@ -2444,7 +2455,7 @@ static int vdiCompact(void *pBackendData, unsigned uPercentStart,
 
         /* Allocate block array for back resolving. */
         paBlocks2 = (unsigned *)RTMemAlloc(sizeof(unsigned *) * cBlocksAllocated);
-        AssertBreakStmt(VALID_PTR(paBlocks2), rc = VERR_NO_MEMORY);
+        AssertBreakStmt(paBlocks2, rc = VERR_NO_MEMORY);
         /* Fill out back resolving, check/fix allocation errors before
          * compacting the image, just to be on the safe side. Update the
          * image contents straight away, as this enables cancelling. */
diff --git a/src/VBox/Storage/VHD.cpp b/src/VBox/Storage/VHD.cpp
index 1f9db9f..4725e4f 100644
--- a/src/VBox/Storage/VHD.cpp
+++ b/src/VBox/Storage/VHD.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -341,7 +341,8 @@ static int vhdLocatorUpdate(PVHDIMAGE pImage, PVHDPLE pLocator, const char *pszF
                 }
                 memcpy(pvBuf, pszFilename, cb);
             }
-            pLocator->u32DataLength = RT_H2BE_U32(cb);
+            if (RT_SUCCESS(rc))
+                pLocator->u32DataLength = RT_H2BE_U32(cb);
             break;
         }
         case VHD_PLATFORM_CODE_WI2K:
@@ -1295,10 +1296,12 @@ static int vhdOpen(const char *pszFilename, unsigned uOpenFlags,
                    PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                    VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc = VINF_SUCCESS;
     PVHDIMAGE pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -1344,9 +1347,11 @@ static int vhdCreate(const char *pszFilename, uint64_t cbSize,
                      PCRTUUID pUuid, unsigned uOpenFlags,
                      unsigned uPercentStart, unsigned uPercentSpan,
                      PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
-                     PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                     PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                     void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc = VINF_SUCCESS;
     PVHDIMAGE pImage;
 
@@ -1359,6 +1364,13 @@ static int vhdCreate(const char *pszFilename, uint64_t cbSize,
         pvUser = pIfProgress->Core.pvUser;
     }
 
+    /* Check the VD container type. */
+    if (enmType != VDTYPE_HDD)
+    {
+        rc = VERR_VD_INVALID_TYPE;
+        goto out;
+    }
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -1633,7 +1645,8 @@ static int vhdWrite(void *pBackendData, uint64_t uOffset, size_t cbWrite,
         if (pImage->pBlockAllocationTable[cBlockAllocationTableEntry] == ~0U)
         {
             /* Check if the block allocation should be suppressed. */
-            if (fWrite & VD_WRITE_NO_ALLOC)
+            if (   (fWrite & VD_WRITE_NO_ALLOC)
+                || (cbWrite != pImage->cbDataBlock))
             {
                 *pcbPreRead = cBATEntryIndex * VHD_SECTOR_SIZE;
                 *pcbPostRead = pImage->cSectorsPerDataBlock * VHD_SECTOR_SIZE - cbWrite - *pcbPreRead;
@@ -2459,10 +2472,10 @@ static int vhdCompact(void *pBackendData, unsigned uPercentStart,
         if (pfnParentRead)
         {
             pvParent = RTMemTmpAlloc(pImage->cbDataBlock);
-            AssertBreakStmt(VALID_PTR(pvParent), rc = VERR_NO_MEMORY);
+            AssertBreakStmt(pvParent, rc = VERR_NO_MEMORY);
         }
         pvBuf = RTMemTmpAlloc(pImage->cbDataBlock);
-        AssertBreakStmt(VALID_PTR(pvBuf), rc = VERR_NO_MEMORY);
+        AssertBreakStmt(pvBuf, rc = VERR_NO_MEMORY);
 
         unsigned cBlocksAllocated = 0;
         unsigned cBlocksToMove    = 0;
@@ -2487,7 +2500,7 @@ static int vhdCompact(void *pBackendData, unsigned uPercentStart,
         }
 
         paBlocks = (uint32_t *)RTMemTmpAllocZ(cBlocksAllocated * sizeof(uint32_t));
-        AssertBreakStmt(VALID_PTR(paBlocks), rc = VERR_NO_MEMORY);
+        AssertBreakStmt(paBlocks, rc = VERR_NO_MEMORY);
 
         /* Invalidate the back resolving array. */
         for (unsigned i = 0; i < cBlocksAllocated; i++)
@@ -2569,7 +2582,7 @@ static int vhdCompact(void *pBackendData, unsigned uPercentStart,
             /* Allocate data buffer to hold the data block and allocation bitmap in front of the actual data. */
             RTMemTmpFree(pvBuf);
             pvBuf = RTMemTmpAllocZ(cbBlock);
-            AssertBreakStmt(VALID_PTR(pvBuf), rc = VERR_NO_MEMORY);
+            AssertBreakStmt(pvBuf, rc = VERR_NO_MEMORY);
 
             for (unsigned i = 0; i < cBlocksAllocated; i++)
             {
diff --git a/src/VBox/Storage/VHDX.cpp b/src/VBox/Storage/VHDX.cpp
index 4eaef10..acdc033 100644
--- a/src/VBox/Storage/VHDX.cpp
+++ b/src/VBox/Storage/VHDX.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,7 +18,7 @@
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
-#define LOG_GROUP LOG_GROUP_DEFAULT /** @todo: Log group */
+#define LOG_GROUP LOG_GROUP_VD_VHDX
 #include <VBox/vd-plugin.h>
 #include <VBox/err.h>
 
@@ -1065,10 +1065,10 @@ static int vhdxFindAndLoadCurrentHeader(PVHDXIMAGE pImage)
             /* Validate checksum. */
             u32ChkSumSaved = pHdr1->u32Checksum;
             pHdr1->u32Checksum = 0;
-            //u32ChkSum = RTCrc32C(pHdr1, RT_OFFSETOF(VhdxHeader, u8Reserved[502]));
+            u32ChkSum = RTCrc32C(pHdr1, sizeof(VhdxHeader));
 
             if (   pHdr1->u32Signature == VHDX_HEADER_SIGNATURE
-                /*&& u32ChkSum == u32ChkSumSaved*/)
+                && u32ChkSum == u32ChkSumSaved)
                 fHdr1Valid = true;
         }
 
@@ -1082,10 +1082,10 @@ static int vhdxFindAndLoadCurrentHeader(PVHDXIMAGE pImage)
             /* Validate checksum. */
             u32ChkSumSaved = pHdr2->u32Checksum;
             pHdr2->u32Checksum = 0;
-            //u32ChkSum = RTCrc32C(pHdr2, RT_OFFSETOF(VhdxHeader, u8Reserved[502]));
+            u32ChkSum = RTCrc32C(pHdr2, sizeof(VhdxHeader));
 
             if (   pHdr2->u32Signature == VHDX_HEADER_SIGNATURE
-                /*&& u32ChkSum == u32ChkSumSaved*/)
+                && u32ChkSum == u32ChkSumSaved)
                 fHdr2Valid = true;
         }
 
@@ -1572,18 +1572,16 @@ static int vhdxLoadRegionTable(PVHDXIMAGE pImage)
             pRegionTblHdr->u32Checksum = 0;
 
             /* Verify the region table integrity. */
-            //u32ChkSum = RTCrc32C(pbRegionTbl, VHDX_REGION_TBL_SIZE_MAX);
+            u32ChkSum = RTCrc32C(pbRegionTbl, VHDX_REGION_TBL_SIZE_MAX);
 
             if (RegionTblHdr.u32Signature != VHDX_REGION_TBL_HDR_SIGNATURE)
                 rc = vdIfError(pImage->pIfError, VERR_VD_GEN_INVALID_HEADER, RT_SRC_POS,
                                "VHDX: Invalid signature for region table header of image \'%s\'",
                                pImage->pszFilename);
-#if 0
             else if (u32ChkSum != RegionTblHdr.u32Checksum)
                 rc = vdIfError(pImage->pIfError, VERR_VD_GEN_INVALID_HEADER, RT_SRC_POS,
                                "VHDX: CRC32 checksum mismatch for the region table of image \'%s\' (expected %#x got %#x)",
                                pImage->pszFilename, RegionTblHdr.u32Checksum, u32ChkSum);
-#endif
             else if (RegionTblHdr.u32EntryCount > VHDX_REGION_TBL_HDR_ENTRY_COUNT_MAX)
                 rc = vdIfError(pImage->pIfError, VERR_VD_GEN_INVALID_HEADER, RT_SRC_POS,
                                "VHDX: Invalid entry count field in the region table header of image \'%s\'",
@@ -1793,10 +1791,12 @@ static int vhdxOpen(const char *pszFilename, unsigned uOpenFlags,
                    PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                    VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc;
     PVHDXIMAGE pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (   uOpenFlags & ~VD_OPEN_FLAGS_MASK
         || !VALID_PTR(pszFilename)
@@ -1826,6 +1826,24 @@ static int vhdxOpen(const char *pszFilename, unsigned uOpenFlags,
     return rc;
 }
 
+/** @interface_method_impl{VBOXHDDBACKEND,pfnCreate} */
+static DECLCALLBACK(int) vhdxCreate(const char *pszFilename, uint64_t cbSize,
+                                    unsigned uImageFlags, const char *pszComment,
+                                    PCVDGEOMETRY pPCHSGeometry, PCVDGEOMETRY pLCHSGeometry,
+                                    PCRTUUID pUuid, unsigned uOpenFlags,
+                                    unsigned uPercentStart, unsigned uPercentSpan,
+                                    PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
+                                    PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                                    void **ppBackendData)
+{
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
+    int rc = VERR_NOT_SUPPORTED;
+
+    LogFlowFunc(("returns %Rrc\n", rc));
+    return rc;
+}
+
 /** @copydoc VBOXHDDBACKEND::pfnRename */
 static int vhdxRename(void *pBackendData, const char *pszFilename)
 {
@@ -2449,7 +2467,7 @@ const VBOXHDDBACKEND g_VhdxBackend =
     /* pfnOpen */
     vhdxOpen,
     /* pfnCreate */
-    NULL,
+    vhdxCreate,
     /* pfnRename */
     vhdxRename,
     /* pfnClose */
diff --git a/src/VBox/Storage/VMDK.cpp b/src/VBox/Storage/VMDK.cpp
index f749ee4..c60dfff 100644
--- a/src/VBox/Storage/VMDK.cpp
+++ b/src/VBox/Storage/VMDK.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -563,14 +563,14 @@ static int vmdkFileOpen(PVMDKIMAGE pImage, PVMDKFILE *ppVmdkFile,
 
     /* If we get here, there's no matching entry in the cache. */
     pVmdkFile = (PVMDKFILE)RTMemAllocZ(sizeof(VMDKFILE));
-    if (!VALID_PTR(pVmdkFile))
+    if (!pVmdkFile)
     {
         *ppVmdkFile = NULL;
         return VERR_NO_MEMORY;
     }
 
     pVmdkFile->pszFilename = RTStrDup(pszFilename);
-    if (!VALID_PTR(pVmdkFile->pszFilename))
+    if (!pVmdkFile->pszFilename)
     {
         RTMemFree(pVmdkFile);
         *ppVmdkFile = NULL;
@@ -640,6 +640,8 @@ static int vmdkFileClose(PVMDKIMAGE pImage, PVMDKFILE *ppVmdkFile, bool fDelete)
     return rc;
 }
 
+/*#define VMDK_USE_BLOCK_DECOMP_API - test and enable */
+#ifndef VMDK_USE_BLOCK_DECOMP_API
 static DECLCALLBACK(int) vmdkFileInflateHelper(void *pvUser, void *pvBuf, size_t cbBuf, size_t *pcbBuf)
 {
     VMDKCOMPRESSIO *pInflateState = (VMDKCOMPRESSIO *)pvUser;
@@ -669,6 +671,7 @@ static DECLCALLBACK(int) vmdkFileInflateHelper(void *pvUser, void *pvBuf, size_t
     *pcbBuf = cbBuf + cbInjected;
     return VINF_SUCCESS;
 }
+#endif
 
 /**
  * Internal: read from a file and inflate the compressed data,
@@ -680,7 +683,9 @@ DECLINLINE(int) vmdkFileInflateSync(PVMDKIMAGE pImage, PVMDKEXTENT pExtent,
                                     uint64_t *puLBA, uint32_t *pcbMarkerData)
 {
     int rc;
+#ifndef VMDK_USE_BLOCK_DECOMP_API
     PRTZIPDECOMP pZip = NULL;
+#endif
     VMDKMARKER *pMarker = (VMDKMARKER *)pExtent->pvCompGrain;
     size_t cbCompSize, cbActuallyRead;
 
@@ -728,6 +733,11 @@ DECLINLINE(int) vmdkFileInflateSync(PVMDKIMAGE pImage, PVMDKEXTENT pExtent,
                                   + RT_OFFSETOF(VMDKMARKER, uType),
                                   512);
 
+#ifdef VMDK_USE_BLOCK_DECOMP_API
+    rc = RTZipBlockDecompress(RTZIPTYPE_ZLIB, 0 /*fFlags*/,
+                              pExtent->pvCompGrain, cbCompSize + RT_OFFSETOF(VMDKMARKER, uType), NULL,
+                              pvBuf, cbToRead, &cbActuallyRead);
+#else
     VMDKCOMPRESSIO InflateState;
     InflateState.pImage = pImage;
     InflateState.iOffset = -1;
@@ -739,6 +749,7 @@ DECLINLINE(int) vmdkFileInflateSync(PVMDKIMAGE pImage, PVMDKEXTENT pExtent,
         return rc;
     rc = RTZipDecompress(pZip, pvBuf, cbToRead, &cbActuallyRead);
     RTZipDecompDestroy(pZip);
+#endif /* !VMDK_USE_BLOCK_DECOMP_API */
     if (RT_FAILURE(rc))
     {
         if (rc == VERR_ZIP_CORRUPTED)
@@ -3430,15 +3441,15 @@ static int vmdkCreateRawImage(PVMDKIMAGE pImage, const PVBOXHDDRAW pRaw,
         /** @todo remove fixed buffer without creating memory leaks. */
         char pszPartition[1024];
         const char *pszBase = RTPathFilename(pImage->pszFilename);
-        const char *pszExt = RTPathExt(pszBase);
-        if (pszExt == NULL)
+        const char *pszSuff = RTPathSuffix(pszBase);
+        if (pszSuff == NULL)
             return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: invalid filename '%s'"), pImage->pszFilename);
         char *pszBaseBase = RTStrDup(pszBase);
         if (!pszBaseBase)
             return VERR_NO_MEMORY;
-        RTPathStripExt(pszBaseBase);
+        RTPathStripSuffix(pszBaseBase);
         RTStrPrintf(pszPartition, sizeof(pszPartition), "%s-pt%s",
-                    pszBaseBase, pszExt);
+                    pszBaseBase, pszSuff);
         RTStrFree(pszBaseBase);
 
         /* Second pass over the partitions, now define all extents. */
@@ -3628,23 +3639,23 @@ static int vmdkCreateRegularImage(PVMDKIMAGE pImage, uint64_t cbSize,
         }
         else
         {
-            char *pszBasenameExt = RTPathExt(pszBasenameSubstr);
+            char *pszBasenameSuff = RTPathSuffix(pszBasenameSubstr);
             char *pszBasenameBase = RTStrDup(pszBasenameSubstr);
-            RTPathStripExt(pszBasenameBase);
+            RTPathStripSuffix(pszBasenameBase);
             char *pszTmp;
             size_t cbTmp;
             if (uImageFlags & VD_IMAGE_FLAGS_FIXED)
             {
                 if (cExtents == 1)
                     RTStrAPrintf(&pszTmp, "%s-flat%s", pszBasenameBase,
-                                 pszBasenameExt);
+                                 pszBasenameSuff);
                 else
                     RTStrAPrintf(&pszTmp, "%s-f%03d%s", pszBasenameBase,
-                                 i+1, pszBasenameExt);
+                                 i+1, pszBasenameSuff);
             }
             else
                 RTStrAPrintf(&pszTmp, "%s-s%03d%s", pszBasenameBase, i+1,
-                             pszBasenameExt);
+                             pszBasenameSuff);
             RTStrFree(pszBasenameBase);
             if (!pszTmp)
                 return VERR_NO_STR_MEMORY;
@@ -5252,10 +5263,12 @@ static int vmdkOpen(const char *pszFilename, unsigned uOpenFlags,
                     PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
                     VDTYPE enmType, void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p enmType=%u ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, enmType, ppBackendData));
     int rc;
     PVMDKIMAGE pImage;
 
+    NOREF(enmType); /**< @todo r=klaus make use of the type info. */
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -5305,9 +5318,11 @@ static int vmdkCreate(const char *pszFilename, uint64_t cbSize,
                       PCRTUUID pUuid, unsigned uOpenFlags,
                       unsigned uPercentStart, unsigned uPercentSpan,
                       PVDINTERFACE pVDIfsDisk, PVDINTERFACE pVDIfsImage,
-                      PVDINTERFACE pVDIfsOperation, void **ppBackendData)
+                      PVDINTERFACE pVDIfsOperation, VDTYPE enmType,
+                      void **ppBackendData)
 {
-    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p\n", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
+    LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p enmType=%u ppBackendData=%#p\n",
+                 pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, enmType, ppBackendData));
     int rc;
     PVMDKIMAGE pImage;
 
@@ -5327,6 +5342,13 @@ static int vmdkCreate(const char *pszFilename, uint64_t cbSize,
         goto out;
     }
 
+    /* Check the VD container type. */
+    if (enmType != VDTYPE_HDD)
+    {
+        rc = VERR_VD_INVALID_TYPE;
+        goto out;
+    }
+
     /* Check open flags. All valid flags are supported. */
     if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
     {
@@ -5492,14 +5514,14 @@ static int vmdkRename(void *pBackendData, const char *pszFilename)
 
     /* Prepare both old and new base names used for string replacement. */
     pszNewBaseName = RTStrDup(RTPathFilename(pszFilename));
-    RTPathStripExt(pszNewBaseName);
+    RTPathStripSuffix(pszNewBaseName);
     pszOldBaseName = RTStrDup(RTPathFilename(pImage->pszFilename));
-    RTPathStripExt(pszOldBaseName);
+    RTPathStripSuffix(pszOldBaseName);
     /* Prepare both old and new full names used for string replacement. */
     pszNewFullName = RTStrDup(pszFilename);
-    RTPathStripExt(pszNewFullName);
+    RTPathStripSuffix(pszNewFullName);
     pszOldFullName = RTStrDup(pImage->pszFilename);
-    RTPathStripExt(pszOldFullName);
+    RTPathStripSuffix(pszOldFullName);
 
     /* --- Up to this point we have not done any damage yet. --- */
 
diff --git a/src/VBox/Storage/testcase/BuiltinTests.h b/src/VBox/Storage/testcase/BuiltinTests.h
index 072ff41..83a65af 100644
--- a/src/VBox/Storage/testcase/BuiltinTests.h
+++ b/src/VBox/Storage/testcase/BuiltinTests.h
@@ -22,6 +22,8 @@
  */
 typedef struct TSTVDIOTESTENTRY
 {
+    /** Test name. */
+    const char             *pszName;
     /** Pointer to the raw bytes. */
     const unsigned char    *pch;
     /** Number of bytes. */
@@ -31,7 +33,7 @@ typedef struct TSTVDIOTESTENTRY
 typedef TSTVDIOTESTENTRY const *PCTSTVDIOTESTENTRY;
 
 /** Macro for simplifying generating the trust anchor tables. */
-#define TSTVDIOTESTENTRY_GEN(a_abTest)      { &a_abTest[0], sizeof(a_abTest) }
+#define TSTVDIOTESTENTRY_GEN(a_szName, a_abTest)      { #a_szName, &a_abTest[0], sizeof(a_abTest) }
 
 /** All tests we know. */
 extern TSTVDIOTESTENTRY const       g_aVDIoTests[];
diff --git a/src/VBox/Storage/testcase/Makefile.kmk b/src/VBox/Storage/testcase/Makefile.kmk
index 01c21b7..6aeeca8 100644
--- a/src/VBox/Storage/testcase/Makefile.kmk
+++ b/src/VBox/Storage/testcase/Makefile.kmk
@@ -65,7 +65,7 @@ ifdef VBOX_WITH_TESTCASES
 
  # 1=name, 2=filter
  TSTVDIO_GEN_TEST_MACRO = 'TSTVDIOTESTENTRY const g_a$(1)[] =' '{' \
-	$(foreach testnm,$(filter $(2),$(TSTVDIO_BUILTIN_TEST_NAMES)), '    TSTVDIOTESTENTRY_GEN(g_ab$(testnm)),') \
+	$(foreach testnm,$(filter $(2),$(TSTVDIO_BUILTIN_TEST_NAMES)), '    TSTVDIOTESTENTRY_GEN($(testnm), g_ab$(testnm)),') \
 	'};' 'unsigned const g_c$(1) = RT_ELEMENTS(g_a$(1));' '' ''
 
  $$(TSTVDIO_BUILTIN_TESTS_FILE): $(MAKEFILE_CURRENT) \
diff --git a/src/VBox/Storage/testcase/VDIoBackend.cpp b/src/VBox/Storage/testcase/VDIoBackend.cpp
index 6458d7d..b63fa3e 100644
--- a/src/VBox/Storage/testcase/VDIoBackend.cpp
+++ b/src/VBox/Storage/testcase/VDIoBackend.cpp
@@ -281,3 +281,15 @@ int VDIoBackendStorageGetSize(PVDIOSTORAGE pIoStorage, uint64_t *pcbSize)
     return rc;
 }
 
+DECLHIDDEN(int) VDIoBackendDumpToFile(PVDIOSTORAGE pIoStorage, const char *pszPath)
+{
+    int rc = VINF_SUCCESS;
+
+    if (pIoStorage->fMemory)
+        rc = VDMemDiskWriteToFile(pIoStorage->u.pMemDisk, pszPath);
+    else
+        rc = VERR_NOT_IMPLEMENTED;
+
+    return rc;
+}
+
diff --git a/src/VBox/Storage/testcase/VDIoBackend.h b/src/VBox/Storage/testcase/VDIoBackend.h
index bec1bb7..520d19d 100644
--- a/src/VBox/Storage/testcase/VDIoBackend.h
+++ b/src/VBox/Storage/testcase/VDIoBackend.h
@@ -71,6 +71,8 @@ int VDIoBackendStorageSetSize(PVDIOSTORAGE pIoStorage, uint64_t cbSize);
 
 int VDIoBackendStorageGetSize(PVDIOSTORAGE pIoStorage, uint64_t *pcbSize);
 
+DECLHIDDEN(int) VDIoBackendDumpToFile(PVDIOSTORAGE pIoStorage, const char *pszPath);
+
 /**
  * Enqueues a new I/O request.
  *
diff --git a/src/VBox/Storage/testcase/VDScript.cpp b/src/VBox/Storage/testcase/VDScript.cpp
index 9b6ef83..a2afeb8 100644
--- a/src/VBox/Storage/testcase/VDScript.cpp
+++ b/src/VBox/Storage/testcase/VDScript.cpp
@@ -278,28 +278,28 @@ typedef VDSCRIPTKEYWORD *PVDSCRIPTKEYWORD;
  */
 static VDSCRIPTKEYWORD g_aKeywords[] =
 {
-    {"continue", 8, VDSCRIPTTOKENKEYWORD_CONTINUE},
-    {"register", 8, VDSCRIPTTOKENKEYWORD_REGISTER},
-    {"restrict", 8, VDSCRIPTTOKENKEYWORD_RESTRICT},
-    {"voaltile", 8, VDSCRIPTTOKENKEYWORD_VOLATILE},
-    {"typedef",  7, VDSCRIPTTOKENKEYWORD_TYPEDEF},
-    {"default",  7, VDSCRIPTTOKENKEYWORD_DEFAULT},
-    {"extern",   6, VDSCRIPTTOKENKEYWORD_EXTERN},
-    {"static",   6, VDSCRIPTTOKENKEYWORD_STATIC},
-    {"return",   6, VDSCRIPTTOKENKEYWORD_RETURN},
-    {"switch",   6, VDSCRIPTTOKENKEYWORD_SWITCH},
-    {"struct",   6, VDSCRIPTTOKENKEYWORD_STRUCT},
-    {"while",    5, VDSCRIPTTOKENKEYWORD_WHILE},
-    {"break",    5, VDSCRIPTTOKENKEYWORD_BREAK},
-    {"const",    5, VDSCRIPTTOKENKEYWORD_CONST},
-    {"false",    5, VDSCRIPTTOKENKEYWORD_FALSE},
-    {"true",     4, VDSCRIPTTOKENKEYWORD_TRUE},
-    {"else",     4, VDSCRIPTTOKENKEYWORD_ELSE},
-    {"case",     4, VDSCRIPTTOKENKEYWORD_CASE},
-    {"auto",     4, VDSCRIPTTOKENKEYWORD_AUTO},
-    {"for",      3, VDSCRIPTTOKENKEYWORD_FOR},
-    {"if",       2, VDSCRIPTTOKENKEYWORD_IF},
-    {"do",       2, VDSCRIPTTOKENKEYWORD_DO}
+    {RT_STR_TUPLE("continue"), VDSCRIPTTOKENKEYWORD_CONTINUE},
+    {RT_STR_TUPLE("register"), VDSCRIPTTOKENKEYWORD_REGISTER},
+    {RT_STR_TUPLE("restrict"), VDSCRIPTTOKENKEYWORD_RESTRICT},
+    {RT_STR_TUPLE("volatile"), VDSCRIPTTOKENKEYWORD_VOLATILE},
+    {RT_STR_TUPLE("typedef"),  VDSCRIPTTOKENKEYWORD_TYPEDEF},
+    {RT_STR_TUPLE("default"),  VDSCRIPTTOKENKEYWORD_DEFAULT},
+    {RT_STR_TUPLE("extern"),   VDSCRIPTTOKENKEYWORD_EXTERN},
+    {RT_STR_TUPLE("static"),   VDSCRIPTTOKENKEYWORD_STATIC},
+    {RT_STR_TUPLE("return"),   VDSCRIPTTOKENKEYWORD_RETURN},
+    {RT_STR_TUPLE("switch"),   VDSCRIPTTOKENKEYWORD_SWITCH},
+    {RT_STR_TUPLE("struct"),   VDSCRIPTTOKENKEYWORD_STRUCT},
+    {RT_STR_TUPLE("while"),    VDSCRIPTTOKENKEYWORD_WHILE},
+    {RT_STR_TUPLE("break"),    VDSCRIPTTOKENKEYWORD_BREAK},
+    {RT_STR_TUPLE("const"),    VDSCRIPTTOKENKEYWORD_CONST},
+    {RT_STR_TUPLE("false"),    VDSCRIPTTOKENKEYWORD_FALSE},
+    {RT_STR_TUPLE("true"),     VDSCRIPTTOKENKEYWORD_TRUE},
+    {RT_STR_TUPLE("else"),     VDSCRIPTTOKENKEYWORD_ELSE},
+    {RT_STR_TUPLE("case"),     VDSCRIPTTOKENKEYWORD_CASE},
+    {RT_STR_TUPLE("auto"),     VDSCRIPTTOKENKEYWORD_AUTO},
+    {RT_STR_TUPLE("for"),      VDSCRIPTTOKENKEYWORD_FOR},
+    {RT_STR_TUPLE("if"),       VDSCRIPTTOKENKEYWORD_IF},
+    {RT_STR_TUPLE("do"),       VDSCRIPTTOKENKEYWORD_DO}
 };
 
 static int vdScriptParseCompoundStatement(PVDSCRIPTCTXINT pThis, PVDSCRIPTASTSTMT *ppAstNodeCompound);
diff --git a/src/VBox/Storage/testcase/tstVDIo.cpp b/src/VBox/Storage/testcase/tstVDIo.cpp
index a8fdad1..a992798 100644
--- a/src/VBox/Storage/testcase/tstVDIo.cpp
+++ b/src/VBox/Storage/testcase/tstVDIo.cpp
@@ -971,6 +971,7 @@ static DECLCALLBACK(int) vdScriptHandlerIo(PVDSCRIPTARG paScriptArgs, void *pvUs
 
             tstVDIoTestDestroy(&IoTest);
         }
+        RTTestSubDone(pGlob->hTest);
     }
 
     return rc;
@@ -1757,7 +1758,7 @@ static DECLCALLBACK(int) vdScriptHandlerDumpFile(PVDSCRIPTARG paScriptArgs, void
     if (fFound)
     {
         RTPrintf("Dumping memory file %s to %s, this might take some time\n", pcszFile, pcszPathToDump);
-        //rc = VDMemDiskWriteToFile(pIt->pIo, pcszPathToDump);
+        rc = VDIoBackendDumpToFile(pIt->pIoStorage, pcszPathToDump);
         rc = VERR_NOT_IMPLEMENTED;
     }
     else
@@ -2693,9 +2694,10 @@ static int tstVDIoPatternGetBuffer(PVDPATTERN pPattern, void **ppv, size_t cb)
  * Executes the given script.
  *
  * @returns nothing.
+ * @param   pszName      The script name.
  * @param   pszScript    The script to execute.
  */
-static void tstVDIoScriptExec(const char *pszScript)
+static void tstVDIoScriptExec(const char *pszName, const char *pszScript)
 {
     int rc = VINF_SUCCESS;
     VDTESTGLOB GlobTest;   /**< Global test data. */
@@ -2738,7 +2740,7 @@ static void tstVDIoScriptExec(const char *pszScript)
                         &GlobTest, sizeof(VDINTERFACEIO), &GlobTest.pInterfacesImages);
     AssertRC(rc);
 
-    rc = RTTestCreate("tstVDIo", &GlobTest.hTest);
+    rc = RTTestCreate(pszName, &GlobTest.hTest);
     if (RT_SUCCESS(rc))
     {
         /* Init I/O backend. */
@@ -2795,7 +2797,7 @@ static void tstVDIoScriptRun(const char *pcszFilename)
         RTFileReadAllFree(pvFile, cbFile);
 
         AssertPtr(pszScript);
-        tstVDIoScriptExec(pszScript);
+        tstVDIoScriptExec(pcszFilename, pszScript);
         RTStrFree(pszScript);
     }
     else
@@ -2834,7 +2836,7 @@ static void tstVDIoRunBuiltinTests(void)
         char *pszScript = RTStrDupN((const char *)g_aVDIoTests[i].pch, g_aVDIoTests[i].cb);
 
         AssertPtr(pszScript);
-        tstVDIoScriptExec(pszScript);
+        tstVDIoScriptExec(g_aVDIoTests[i].pszName, pszScript);
     }
 #endif
 }
diff --git a/src/VBox/Storage/testcase/vbox-img.cpp b/src/VBox/Storage/testcase/vbox-img.cpp
index 7d3f9a4..99892fa 100644
--- a/src/VBox/Storage/testcase/vbox-img.cpp
+++ b/src/VBox/Storage/testcase/vbox-img.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -34,7 +34,7 @@
 #include <iprt/filesystem.h>
 #include <iprt/vfs.h>
 
-const char *g_pszProgName = "";
+static const char *g_pszProgName = "";
 static void printUsage(PRTSTREAM pStrm)
 {
     RTStrmPrintf(pStrm,
@@ -45,6 +45,13 @@ static void printUsage(PRTSTREAM pStrm)
                  "                [--parentuuid <uuid>]\n"
                  "                [--zeroparentuuid]\n"
                  "\n"
+                 "   geometry     --filename <filename>\n"
+                 "                [--format VDI|VMDK|VHD|...]\n"
+                 "                [--clearchs]\n"
+                 "                [--cylinders <number>]\n"
+                 "                [--heads <number>]\n"
+                 "                [--sectors <number>]\n"
+                 "\n"
                  "   convert      --srcfilename <filename>\n"
                  "                --dstfilename <filename>\n"
                  "                [--stdin]|[--stdout]\n"
@@ -74,7 +81,7 @@ static void printUsage(PRTSTREAM pStrm)
                  g_pszProgName);
 }
 
-void showLogo(PRTSTREAM pStrm)
+static void showLogo(PRTSTREAM pStrm)
 {
     static bool s_fShown; /* show only once */
 
@@ -95,7 +102,7 @@ struct HandlerArg
     char **argv;
 };
 
-PVDINTERFACE pVDIfs;
+static PVDINTERFACE pVDIfs;
 
 static DECLCALLBACK(void) handleVDError(void *pvUser, int rc, RT_SRC_POS_DECL,
                                         const char *pszFormat, va_list va)
@@ -115,7 +122,7 @@ static int handleVDMessage(void *pvUser, const char *pszFormat, va_list va)
 /**
  * Print a usage synopsis and the syntax error message.
  */
-int errorSyntax(const char *pszFormat, ...)
+static int errorSyntax(const char *pszFormat, ...)
 {
     va_list args;
     showLogo(g_pStdErr); // show logo even if suppressed
@@ -126,7 +133,7 @@ int errorSyntax(const char *pszFormat, ...)
     return 1;
 }
 
-int errorRuntime(const char *pszFormat, ...)
+static int errorRuntime(const char *pszFormat, ...)
 {
     va_list args;
 
@@ -184,7 +191,7 @@ static int parseDiskVariant(const char *psz, unsigned *puImageFlags)
 }
 
 
-int handleSetUUID(HandlerArg *a)
+static int handleSetUUID(HandlerArg *a)
 {
     const char *pszFilename = NULL;
     char *pszFormat = NULL;
@@ -315,6 +322,141 @@ int handleSetUUID(HandlerArg *a)
 }
 
 
+static int handleGeometry(HandlerArg *a)
+{
+    const char *pszFilename = NULL;
+    char *pszFormat = NULL;
+    VDTYPE enmType = VDTYPE_INVALID;
+    uint16_t cCylinders = 0;
+    uint8_t cHeads = 0;
+    uint8_t cSectors = 0;
+    bool fCylinders = false;
+    bool fHeads = false;
+    bool fSectors = false;
+    int rc;
+
+    /* Parse the command line. */
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--filename", 'f', RTGETOPT_REQ_STRING },
+        { "--format", 'o', RTGETOPT_REQ_STRING },
+        { "--clearchs", 'C', RTGETOPT_REQ_NOTHING },
+        { "--cylinders", 'c', RTGETOPT_REQ_UINT16 },
+        { "--heads", 'e', RTGETOPT_REQ_UINT8 },
+        { "--sectors", 's', RTGETOPT_REQ_UINT8 }
+    };
+    int ch;
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, 0 /* fFlags */);
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (ch)
+        {
+            case 'f':   // --filename
+                pszFilename = ValueUnion.psz;
+                break;
+            case 'o':   // --format
+                pszFormat = RTStrDup(ValueUnion.psz);
+                break;
+            case 'C':   // --clearchs
+                cCylinders = 0;
+                cHeads = 0;
+                cSectors = 0;
+                fCylinders = true;
+                fHeads = true;
+                fSectors = true;
+                break;
+            case 'c':   // --cylinders
+                cCylinders = ValueUnion.u16;
+                fCylinders = true;
+                break;
+            case 'e':   // --heads
+                cHeads = ValueUnion.u8;
+                fHeads = true;
+                break;
+            case 's':   // --sectors
+                cSectors = ValueUnion.u8;
+                fSectors = true;
+                break;
+
+            default:
+                ch = RTGetOptPrintError(ch, &ValueUnion);
+                printUsage(g_pStdErr);
+                return ch;
+        }
+    }
+
+    /* Check for mandatory parameters. */
+    if (!pszFilename)
+        return errorSyntax("Mandatory --filename option missing\n");
+
+    /* Autodetect image format. */
+    if (!pszFormat)
+    {
+        /* Don't pass error interface, as that would triggers error messages
+         * because some backends fail to open the image. */
+        rc = VDGetFormat(NULL, NULL, pszFilename, &pszFormat, &enmType);
+        if (RT_FAILURE(rc))
+            return errorRuntime("Format autodetect failed: %Rrc\n", rc);
+    }
+
+    PVBOXHDD pVD = NULL;
+    rc = VDCreate(pVDIfs, enmType, &pVD);
+    if (RT_FAILURE(rc))
+        return errorRuntime("Cannot create the virtual disk container: %Rrc\n", rc);
+
+    /* Open in info mode to be able to open diff images without their parent. */
+    rc = VDOpen(pVD, pszFormat, pszFilename, VD_OPEN_FLAGS_INFO, NULL);
+    if (RT_FAILURE(rc))
+        return errorRuntime("Cannot open the virtual disk image \"%s\": %Rrc\n",
+                            pszFilename, rc);
+
+    VDGEOMETRY oldLCHSGeometry;
+    rc = VDGetLCHSGeometry(pVD, VD_LAST_IMAGE, &oldLCHSGeometry);
+    if (rc == VERR_VD_GEOMETRY_NOT_SET)
+    {
+        memset(&oldLCHSGeometry, 0, sizeof(oldLCHSGeometry));
+        rc = VINF_SUCCESS;
+    }
+    if (RT_FAILURE(rc))
+        return errorRuntime("Cannot get LCHS geometry of virtual disk image \"%s\": %Rrc\n",
+                            pszFilename, rc);
+
+    VDGEOMETRY newLCHSGeometry = oldLCHSGeometry;
+    if (fCylinders)
+        newLCHSGeometry.cCylinders = cCylinders;
+    if (fHeads)
+        newLCHSGeometry.cHeads = cHeads;
+    if (fSectors)
+        newLCHSGeometry.cSectors = cSectors;
+
+    if (fCylinders || fHeads || fSectors)
+    {
+        RTPrintf("Old image LCHS: %u/%u/%u\n", oldLCHSGeometry.cCylinders, oldLCHSGeometry.cHeads, oldLCHSGeometry.cSectors);
+        RTPrintf("New image LCHS: %u/%u/%u\n", newLCHSGeometry.cCylinders, newLCHSGeometry.cHeads, newLCHSGeometry.cSectors);
+
+        rc = VDSetLCHSGeometry(pVD, VD_LAST_IMAGE, &newLCHSGeometry);
+        if (RT_FAILURE(rc))
+            return errorRuntime("Cannot set LCHS geometry of virtual disk image \"%s\": %Rrc\n",
+                                pszFilename, rc);
+    }
+    else
+        RTPrintf("Current image LCHS: %u/%u/%u\n", oldLCHSGeometry.cCylinders, oldLCHSGeometry.cHeads, oldLCHSGeometry.cSectors);
+
+
+    VDDestroy(pVD);
+
+    if (pszFormat)
+    {
+        RTStrFree(pszFormat);
+        pszFormat = NULL;
+    }
+
+    return 0;
+}
+
+
 typedef struct FILEIOSTATE
 {
     RTFILE file;
@@ -687,7 +829,7 @@ static int convOutFlush(void *pvUser, void *pStorage)
     return VINF_SUCCESS;
 }
 
-int handleConvert(HandlerArg *a)
+static int handleConvert(HandlerArg *a)
 {
     const char *pszSrcFilename = NULL;
     const char *pszDstFilename = NULL;
@@ -913,7 +1055,7 @@ int handleConvert(HandlerArg *a)
 }
 
 
-int handleInfo(HandlerArg *a)
+static int handleInfo(HandlerArg *a)
 {
     int rc = VINF_SUCCESS;
     PVBOXHDD pDisk = NULL;
@@ -1062,7 +1204,7 @@ typedef struct VBOXIMGVFS
     RTVFS              hVfs;
 } VBOXIMGVFS, *PVBOXIMGVFS;
 
-int handleCompact(HandlerArg *a)
+static int handleCompact(HandlerArg *a)
 {
     int rc = VINF_SUCCESS;
     PVBOXHDD pDisk = NULL;
@@ -1161,7 +1303,7 @@ int handleCompact(HandlerArg *a)
                             /* Release the file handle and continue.*/
                             RTVfsFileRelease(hVfsFile);
                         }
-                        else if RT_FAILURE(rc)
+                        else if (RT_FAILURE(rc))
                             break;
                         else
                         {
@@ -1243,7 +1385,7 @@ int handleCompact(HandlerArg *a)
 }
 
 
-int handleCreateCache(HandlerArg *a)
+static int handleCreateCache(HandlerArg *a)
 {
     int rc = VINF_SUCCESS;
     PVBOXHDD pDisk = NULL;
@@ -1338,7 +1480,7 @@ static DECLCALLBACK(int) vdIfCfgCreateBaseQuery(void *pvUser, const char *pszNam
 
 }
 
-int handleCreateBase(HandlerArg *a)
+static int handleCreateBase(HandlerArg *a)
 {
     int rc = VINF_SUCCESS;
     PVBOXHDD pDisk = NULL;
@@ -1352,8 +1494,8 @@ int handleCreateBase(HandlerArg *a)
     PVDINTERFACE pVDIfsOperation = NULL;
     VDINTERFACECONFIG vdIfCfg;
 
-    memset(&LCHSGeometry, 0, sizeof(VDGEOMETRY));
-    memset(&PCHSGeometry, 0, sizeof(VDGEOMETRY));
+    memset(&LCHSGeometry, 0, sizeof(LCHSGeometry));
+    memset(&PCHSGeometry, 0, sizeof(PCHSGeometry));
 
     /* Parse the command line. */
     static const RTGETOPTDEF s_aOptions[] =
@@ -1440,7 +1582,7 @@ int handleCreateBase(HandlerArg *a)
 }
 
 
-int handleRepair(HandlerArg *a)
+static int handleRepair(HandlerArg *a)
 {
     int rc = VINF_SUCCESS;
     PVBOXHDD pDisk = NULL;
@@ -1507,7 +1649,7 @@ int handleRepair(HandlerArg *a)
 }
 
 
-int handleClearComment(HandlerArg *a)
+static int handleClearComment(HandlerArg *a)
 {
     int rc = VINF_SUCCESS;
     PVBOXHDD pDisk = NULL;
@@ -1648,6 +1790,7 @@ int main(int argc, char *argv[])
     } s_commandHandlers[] =
     {
         { "setuuid",      handleSetUUID      },
+        { "geometry",     handleGeometry     },
         { "convert",      handleConvert      },
         { "info",         handleInfo         },
         { "compact",      handleCompact      },
diff --git a/src/VBox/Storage/testcase/vbox-img.rc b/src/VBox/Storage/testcase/vbox-img.rc
index 5d55366..54d5bee 100644
--- a/src/VBox/Storage/testcase/vbox-img.rc
+++ b/src/VBox/Storage/testcase/vbox-img.rc
@@ -21,26 +21,27 @@
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_FILE_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_APP
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_APP
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Virtual Disk Utility\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
       VALUE "InternalName",     "vbox-img\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "vbox-img.exe\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/VBox/Storage/testcase/vditool.cpp b/src/VBox/Storage/testcase/vditool.cpp
index 33212ce..edfbe9e 100644
--- a/src/VBox/Storage/testcase/vditool.cpp
+++ b/src/VBox/Storage/testcase/vditool.cpp
@@ -26,6 +26,7 @@
 #include <iprt/initterm.h>
 #include <VBox/err.h>
 #include <VBox/log.h>
+#include <VBox/version.h>
 
 #include <stdlib.h>
 
@@ -380,7 +381,7 @@ int main(int argc, char **argv)
 
     RTR3InitExe(argc, &argv, 0);
     RTPrintf("vditool -- for internal use only!\n"
-             "Copyright (c) 2009 Oracle Corporation\n\n");
+             "Copyright (C) 2009-" VBOX_C_YEAR " " VBOX_VENDOR "\n\n");
 
     /*
      * Do cmd line parsing.
diff --git a/src/VBox/VMM/Makefile.kmk b/src/VBox/VMM/Makefile.kmk
index 056b9d6..8c5bd34 100644
--- a/src/VBox/VMM/Makefile.kmk
+++ b/src/VBox/VMM/Makefile.kmk
@@ -4,7 +4,7 @@
 #
 
 #
-# Copyright (C) 2006-2013 Oracle Corporation
+# Copyright (C) 2006-2015 Oracle Corporation
 #
 # This file is part of VirtualBox Open Source Edition (OSE), as
 # available from http://www.virtualbox.org. This file is free software;
@@ -68,6 +68,9 @@ endif
 ifdef VBOX_WITH_64ON32_CMOS_DEBUG
  VMM_COMMON_DEFS += VBOX_WITH_64ON32_CMOS_DEBUG
 endif
+ifeq ($(KBUILD_TARGET),amd64)
+ VMM_COMMON_DEFS += VBOX_WITH_MORE_RING0_MEM_MAPPINGS
+endif
 
 # VMM_COMMON_DEFS += VBOX_WITH_NS_ACCOUNTING_STATS
 
@@ -76,10 +79,6 @@ ifdef IEM_VERIFICATION_MODE
  VMM_COMMON_DEFS += IEM_VERIFICATION_MODE IEM_VERIFICATION_MODE_FULL IEM_VERIFICATION_MODE_FULL_HM
 endif
 
-ifdef VBOX_WITH_NEW_MSR_CODE
- VMM_COMMON_DEFS += VBOX_WITH_NEW_MSR_CODE
-endif
-
 
 #
 # The VMM DLL.
@@ -107,6 +106,15 @@ endif
 ifdef VBOX_WITH_RAW_MODE
  VBoxVMM_DEFS   += VBOX_WITH_RAW_MODE VBOX_WITH_RAW_MODE_NOT_R0
 endif
+ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+ VBoxVMM_DEFS   += VBOX_WITH_PDM_AUDIO_DRIVER
+endif
+ifdef VBOX_WITH_VMM_R0_SWITCH_STACK
+ VBoxVMM_DEFS   += VMM_R0_SWITCH_STACK
+endif
+if "$(KBUILD_TYPE)" == "debug" && "$(USERNAME)" == "bird"
+ VBoxVMM_DEFS   += RTMEM_WRAP_TO_EF_APIS
+endif
 VBoxVMM_DEFS.darwin = VMM_R0_SWITCH_STACK
 VBoxVMM_DEFS.darwin.x86 = \
 	VBOX_WITH_2X_4GB_ADDR_SPACE   VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R3 \
@@ -135,6 +143,7 @@ VBoxVMM_SOURCES  = \
 	VMMR3/DBGFLog.cpp \
 	VMMR3/DBGFMem.cpp \
 	VMMR3/DBGFOS.cpp \
+	VMMR3/DBGFR3PlugIn.cpp \
 	VMMR3/DBGFReg.cpp \
 	VMMR3/DBGFStack.cpp \
 	VMMR3/DBGFR3Trace.cpp \
@@ -143,6 +152,10 @@ VBoxVMM_SOURCES  = \
 	$(if $(VBOX_WITH_RAW_MODE),VMMR3/EMRaw.cpp) \
 	VMMR3/EMHM.cpp \
 	VMMR3/FTM.cpp \
+	VMMR3/GIM.cpp \
+	VMMR3/GIMHv.cpp \
+	VMMR3/GIMKvm.cpp \
+	VMMR3/GIMMinimal.cpp \
 	VMMR3/IEMR3.cpp \
 	VMMR3/IOM.cpp \
 	VMMR3/GMM.cpp \
@@ -219,6 +232,9 @@ VBoxVMM_SOURCES  = \
 	VMMAll/EMAll.cpp \
 	VMMAll/EMAllA.asm \
 	VMMAll/FTMAll.cpp \
+	VMMAll/GIMAll.cpp \
+	VMMAll/GIMAllHv.cpp \
+	VMMAll/GIMAllKvm.cpp \
 	VMMAll/TMAll.cpp \
 	VMMAll/TMAllCpu.cpp \
 	VMMAll/TMAllReal.cpp \
@@ -265,8 +281,6 @@ VBoxVMM_SOURCES.x86 += \
 	VMMSwitcher/X86Stub.asm
 VBoxVMM_SOURCES.amd64 += \
 	VMMSwitcher/AMD64Stub.asm
-VBoxVMM_SOURCES.win += \
-	VMMR3/VMMR3.rc
 
 VBoxVMM_LIBS = \
 	$(PATH_STAGE_LIB)/DisasmR3$(VBOX_SUFF_LIB)
@@ -296,6 +310,8 @@ VMMR3/SSM.cpp_DEFS +=	\
 # endif
 #endif
 
+$(call VBOX_SET_VER_INFO_DLL,VBoxVMM,VirtualBox VMM) # Version info / description.
+
 
 if defined(VBOX_WITH_RAW_MODE) && $(intersects $(VBOX_LDR_FMT32), pe lx)
 
@@ -399,7 +415,11 @@ if defined(VBOX_WITH_RAW_MODE) && !defined(VBOX_ONLY_EXTPACKS)
  VMMRC_NAME      = VMMGC
  VMMRC_SYSSUFF   = .gc
 
- VMMRC_DEFS      = IN_VMM_RC IN_RT_RC IN_DIS DIS_CORE_ONLY VBOX_WITH_RAW_MODE VBOX_WITH_RAW_MODE_NOT_R0 $(VMM_COMMON_DEFS)
+ VMMRC_DEFS      = IN_VMM_RC IN_RT_RC IN_DIS DIS_CORE_ONLY VBOX_WITH_RAW_MODE VBOX_WITH_RAW_MODE_NOT_R0 IN_SUP_RC \
+ 	$(VMM_COMMON_DEFS)
+ ifdef VBOX_WITH_VMM_R0_SWITCH_STACK
+  VMMRC_DEFS    += VMM_R0_SWITCH_STACK
+ endif
  ifeq ($(KBUILD_TARGET_ARCH),x86)
   VMMRC_DEFS.darwin = VMM_R0_SWITCH_STACK
   VMMRC_DEFS.darwin = \
@@ -414,7 +434,8 @@ if defined(VBOX_WITH_RAW_MODE) && !defined(VBOX_ONLY_EXTPACKS)
 
  VMMRC_LIBS      = \
  	$(PATH_STAGE_LIB)/DisasmRC$(VBOX_SUFF_LIB) \
- 	$(PATH_STAGE_LIB)/RuntimeRC$(VBOX_SUFF_LIB)
+ 	$(PATH_STAGE_LIB)/RuntimeRC$(VBOX_SUFF_LIB) \
+ 	$(PATH_STAGE_LIB)/SUPRC$(VBOX_SUFF_LIB)
  ifneq ($(filter pe lx,$(VBOX_LDR_FMT32)),)
   VMMRC_LIBS    += \
  	$(PATH_STAGE_LIB)/VMMRCBuiltin$(VBOX_SUFF_LIB)
@@ -426,6 +447,7 @@ if defined(VBOX_WITH_RAW_MODE) && !defined(VBOX_ONLY_EXTPACKS)
  	VMMRC/VMMRCDeps.cpp \
  	VMMRC/CPUMRC.cpp \
  	VMMRC/CPUMRCA.asm \
+ 	VMMRC/CPUMRCPatchHlp.asm \
  	VMMRC/EMRCA.asm \
  	VMMRC/IOMRC.cpp \
  	VMMRC/MMRamRC.cpp \
@@ -439,23 +461,26 @@ if defined(VBOX_WITH_RAW_MODE) && !defined(VBOX_ONLY_EXTPACKS)
  	VMMRC/VMMRC.cpp \
  	VMMRC/VMMRCA.asm \
  	$(if-expr defined(VBOX_WITH_RAW_MODE), \
-	VMMRC/CSAMRC.cpp \
+ 	VMMRC/CSAMRC.cpp \
  	VMMRC/PATMRC.cpp \
-	,) \
+ 	,) \
  	VMMRZ/DBGFRZ.cpp \
  	VMMRZ/PGMRZDynMap.cpp \
  	VMMRZ/VMMRZ.cpp \
  	VMMAll/CPUMAllRegs.cpp \
-	VMMAll/CPUMAllMsrs.cpp \
+ 	VMMAll/CPUMAllMsrs.cpp \
  	VMMAll/DBGFAll.cpp \
-	VMMAll/IEMAll.cpp \
-	VMMAll/IEMAllAImpl.asm \
-	VMMAll/IEMAllAImplC.cpp \
-  	VMMAll/IOMAll.cpp \
+ 	VMMAll/IEMAll.cpp \
+ 	VMMAll/IEMAllAImpl.asm \
+ 	VMMAll/IEMAllAImplC.cpp \
+ 	VMMAll/IOMAll.cpp \
  	VMMAll/IOMAllMMIO.cpp \
  	VMMAll/EMAll.cpp \
  	VMMAll/EMAllA.asm \
-	VMMAll/FTMAll.cpp \
+ 	VMMAll/FTMAll.cpp \
+ 	VMMAll/GIMAll.cpp \
+ 	VMMAll/GIMAllHv.cpp \
+ 	VMMAll/GIMAllKvm.cpp \
  	VMMAll/MMAll.cpp \
  	VMMAll/MMAllHyper.cpp \
  	VMMAll/PDMAll.cpp \
@@ -479,7 +504,7 @@ if defined(VBOX_WITH_RAW_MODE) && !defined(VBOX_ONLY_EXTPACKS)
  	VMMAll/VMMAll.cpp \
  	VMMAll/VMMAllA.asm \
  	$(if-expr defined(VBOX_WITH_RAW_MODE), \
-	VMMAll/CSAMAll.cpp \
+ 	VMMAll/CSAMAll.cpp \
  	VMMAll/PATMAll.cpp \
        ,)
  ifeq ($(VBOX_LDR_FMT32),pe)
@@ -493,6 +518,8 @@ if defined(VBOX_WITH_RAW_MODE) && !defined(VBOX_ONLY_EXTPACKS)
  VMMRC_SOURCES += VMMRC/VMMRC99.asm
 
  VMMRC/VMMRCDeps.cpp_CXXFLAGS.win = -Oi- -TC ## @todo rename VMMRCDeps.cpp to .c
+
+ $(call VBOX_SET_VER_INFO_RC,VMMRC,VirtualBox VMM - raw-mode context parts) # Version info / description.
 endif # VBOX_WITH_RAW_MODE && !VBOX_ONLY_EXTPACKS
 
 
@@ -516,15 +543,15 @@ ifndef VBOX_ONLY_EXTPACKS
  ifdef VBOX_WITH_RAW_MODE
   VMMR0_DEFS    += VBOX_WITH_RAW_MODE
  endif
+ ifdef VBOX_WITH_VMM_R0_SWITCH_STACK
+  VMMR0_DEFS    += VMM_R0_SWITCH_STACK
+ endif
  VMMR0_DEFS.darwin = VMM_R0_SWITCH_STACK
  VMMR0_DEFS.darwin.x86 = \
  	VBOX_WITH_2X_4GB_ADDR_SPACE   VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 \
  	VBOX_WITH_HYBRID_32BIT_KERNEL VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0
  VMMR0_DEFS.win.amd64  = VBOX_WITH_KERNEL_USING_XMM
 
- ifeq ($(VBOX_LDR_FMT),elf)
-  VMMR0_LDFLAGS  = -e VMMR0EntryEx
- endif
  VMMR0_INCS      = \
  	include \
  	$(if-expr defined(VBOX_WITH_RAW_MODE),PATM,)
@@ -533,12 +560,14 @@ ifndef VBOX_ONLY_EXTPACKS
  	VBoxVMM.d \
  	VMMR0/CPUMR0.cpp \
  	VMMR0/CPUMR0A.asm \
+ 	VMMR0/GIMR0.cpp \
+ 	VMMR0/GIMR0Hv.cpp \
  	VMMR0/GMMR0.cpp \
  	VMMR0/GVMMR0.cpp \
  	VMMR0/HMR0.cpp \
  	VMMR0/HMR0A.asm \
-	VMMR0/HMVMXR0.cpp \
-	VMMR0/HMSVMR0.cpp \
+ 	VMMR0/HMVMXR0.cpp \
+ 	VMMR0/HMSVMR0.cpp \
  	VMMR0/PDMR0Device.cpp \
  	VMMR0/PDMR0Driver.cpp \
  	VMMR0/PGMR0.cpp \
@@ -549,16 +578,19 @@ ifndef VBOX_ONLY_EXTPACKS
  	VMMRZ/DBGFRZ.cpp \
  	VMMRZ/VMMRZ.cpp \
  	VMMAll/CPUMAllRegs.cpp \
-	VMMAll/CPUMAllMsrs.cpp \
+ 	VMMAll/CPUMAllMsrs.cpp \
  	VMMAll/CPUMStack.cpp \
  	VMMAll/DBGFAll.cpp \
  	VMMAll/EMAll.cpp \
  	VMMAll/EMAllA.asm \
  	VMMAll/FTMAll.cpp \
+ 	VMMAll/GIMAll.cpp \
+ 	VMMAll/GIMAllHv.cpp \
+ 	VMMAll/GIMAllKvm.cpp \
  	VMMAll/HMAll.cpp \
-	VMMAll/IEMAll.cpp \
-	VMMAll/IEMAllAImpl.asm \
-	VMMAll/IEMAllAImplC.cpp \
+ 	VMMAll/IEMAll.cpp \
+ 	VMMAll/IEMAllAImpl.asm \
+ 	VMMAll/IEMAllAImplC.cpp \
  	VMMAll/IOMAll.cpp \
  	VMMAll/IOMAllMMIO.cpp \
  	VMMAll/MMAll.cpp \
@@ -590,7 +622,7 @@ ifndef VBOX_ONLY_EXTPACKS
  ifdef VBOX_WITH_TRIPLE_FAULT_HACK
   VMMR0_SOURCES += \
  	VMMR0/VMMR0TripleFaultHack.cpp \
-	VMMR0/VMMR0TripleFaultHackA.asm
+ 	VMMR0/VMMR0TripleFaultHackA.asm
  endif
  ifdef VBOX_WITH_NETSHAPER
   VMMR0_SOURCES += \
@@ -611,6 +643,8 @@ ifndef VBOX_ONLY_EXTPACKS
   VMMR0_LIBS += \
   	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
  endif
+
+ $(call VBOX_SET_VER_INFO_R0,VMMR0,VirtualBox VMM - ring-0 context parts) # Version info / description.
 endif # !VBOX_ONLY_EXTPACKS
 
 
@@ -638,12 +672,12 @@ if !defined(VBOX_ONLY_EXTPACKS) \
  INSTALLS += VMMLibDTrace
  VMMLibDTrace_INST    = $(VBOX_INST_DTRACE_LIB)$(KBUILD_TARGET_ARCH)/
  VMMLibDTrace_SOURCES = \
-	dtrace/lib/vbox-types.d \
-	dtrace/lib/$(KBUILD_TARGET_ARCH)/vbox-arch-types.d \
-	$(VMMLibDTrace_0_OUTDIR)/vm.d \
-	$(VMMLibDTrace_0_OUTDIR)/cpumctx.d \
-	$(VMMLibDTrace_0_OUTDIR)/CPUMInternal.d \
-	$(VMMLibDTrace_0_OUTDIR)/x86.d \
+ 	dtrace/lib/vbox-types.d \
+ 	dtrace/lib/$(KBUILD_TARGET_ARCH)/vbox-arch-types.d \
+ 	$(VMMLibDTrace_0_OUTDIR)/vm.d \
+ 	$(VMMLibDTrace_0_OUTDIR)/cpumctx.d \
+ 	$(VMMLibDTrace_0_OUTDIR)/CPUMInternal.d \
+ 	$(VMMLibDTrace_0_OUTDIR)/x86.d \
 
 
  ##
@@ -721,6 +755,40 @@ endif # bird wants good stacks
 $(foreach base,$(notdir $(basename $(wildcard $(PATH_SUB_CURRENT)/VMMR3/cpus/*.h))), $(eval $(base).o $(base).obj: CPUMR3Db.o))
 
 
+#
+# Test for undefined symbols.
+#
+if1of ($(SYSMODS),VMMRC)
+ test-undef-rc:: $(PATH_TARGET)/undef-rc.run
+ OTHERS      += $(PATH_TARGET)/undef-rc.run
+ CLEANS      += $(PATH_TARGET)/undef-rc.run
+ $(PATH_TARGET)/undef-rc.run: \
+		$$(VMMRC_1_TARGET)
+ ifn1of ($(KBUILD_TARGET), linux solaris)
+ else
+	$(call MSG_L1,VMM: Testing for undefined symbols in VMMRC using nm...)
+	$(QUIET)$(VBOX_NM) $^  2> /dev/null \
+		| $(SED) -n \
+			-e '/^ *U .*/!d' \
+			-e 's/ *U //' \
+			\
+			-e '/^g_VM\>/d'\
+			-e '/^g_CPUM\>/d'\
+			-e '/^g_Logger\>/d'\
+			-e '/^g_RelLogger\>/d'\
+			-e '/^g_TRPM\>/d'\
+			-e '/^g_TRPMCPU\>/d'\
+			-e '/^g_pSUPGlobalInfoPage\>/d'\
+			-e '/^g_trpmHyperCtxCore\>/d' \
+			-e '/^g_trpmGuestCtxCore\>/d' \
+			\
+			-e 's/\(.*\)$(DOLLAR)/  Undefined symbol: \1/' \
+			-e 'p' \
+			-e 'q 1'
+ endif
+	$(QUIET)$(APPEND) -t $@
+endif
+
 include $(FILE_KBUILD_SUB_FOOTER)
 
 
diff --git a/src/VBox/VMM/VBoxVMM.d b/src/VBox/VMM/VBoxVMM.d
index 579aa03..4a6fe19 100644
--- a/src/VBox/VMM/VBoxVMM.d
+++ b/src/VBox/VMM/VBoxVMM.d
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2009-2012 Oracle Corporation
+ * Copyright (C) 2009-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -35,7 +35,7 @@ provider vboxvmm
     probe em__ff__all(struct VMCPU *a_pVCpu, uint32_t a_fGlobal, uint32_t a_fLocal, int a_rc);
     /*^^VMM-ALT-TP: "vm=%#x cpu=%#x rc=%d", (a_fGlobal), (a_fLocal), (a_rc) */
 
-    probe em__ff__all_ret(struct VMCPU *a_pVCpu, int a_rc);
+    probe em__ff__all__ret(struct VMCPU *a_pVCpu, int a_rc);
     /*^^VMM-ALT-TP: "%d", (a_rc) */
 
     probe em__ff__raw(struct VMCPU *a_pVCpu, uint32_t a_fGlobal, uint32_t a_fLocal);
@@ -51,11 +51,12 @@ provider vboxvmm
 
 
     probe r0__gvmm__vm__created(void *a_pGVM, void *a_pVM, uint32_t a_Pid, void *a_hEMT0, uint32_t a_cCpus);
-    probe r0__hmsvm__vmexit(struct VMCPU *a_pVCpu, struct CPUMCTX *a_pCtx, uint64_t a_ExitCode,
-                            uint64_t a_ExitInfo1, uint64_t a_ExitInfo2, uint64_t a_ExitIntInfo,
-                            uint64_t a_TestArgument);
-    probe r0__hmvmx__vmexit(struct VMCPU *a_pVCpu, struct CPUMCTX *a_pCtx, uint64_t a_ExitReason);
+    probe r0__hmsvm__vmexit(struct VMCPU *a_pVCpu, struct CPUMCTX *a_pCtx, uint64_t a_ExitCode, struct SVMVMCB *a_pVmcb);
+    probe r0__hmvmx__vmexit(struct VMCPU *a_pVCpu, struct CPUMCTX *a_pCtx, uint64_t a_ExitReason, uint64_t a_ExitQualification);
+    probe r0__hmvmx__vmexit__noctx(struct VMCPU *a_pVCpu, struct CPUMCTX *a_pIncompleteCtx, uint64_t a_ExitReason);
 
+    probe r0__vmm__return__to__ring3__rc(struct VMCPU *a_pVCpu, struct CPUMCTX *p_Ctx, int a_rc);
+    probe r0__vmm__return__to__ring3__hm(struct VMCPU *a_pVCpu, struct CPUMCTX *p_Ctx, int a_rc);
 };
 
 #pragma D attributes Evolving/Evolving/Common provider vboxvmm provider
diff --git a/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp b/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
index 0f54fed..c507169 100644
--- a/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
+++ b/src/VBox/VMM/VMMAll/CPUMAllMsrs.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-201 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -23,6 +23,7 @@
 #include <VBox/vmm/pdmapi.h>
 #include <VBox/vmm/hm.h>
 #include <VBox/vmm/tm.h>
+#include <VBox/vmm/gim.h>
 #include "CPUMInternal.h"
 #include <VBox/vmm/vm.h>
 #include <VBox/err.h>
@@ -56,6 +57,8 @@
  *
  * @returns VBox status code.
  * @retval  VINF_SUCCESS on success.
+ * @retval  VINF_CPUM_R3_MSR_READ if the MSR read could not be serviced in the
+ *          current context (raw-mode or ring-0).
  * @retval  VERR_CPUM_RAISE_GP_0 on failure (invalid MSR).
  *
  * @param   pVCpu       Pointer to the VMCPU.
@@ -63,7 +66,7 @@
  * @param   pRange      The MSR range descriptor.
  * @param   puValue     Where to return the value.
  */
-typedef DECLCALLBACK(int) FNCPUMRDMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
+typedef DECLCALLBACK(VBOXSTRICTRC) FNCPUMRDMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
 /** Pointer to a RDMSR worker for a specific MSR or range of MSRs.  */
 typedef FNCPUMRDMSR *PFNCPUMRDMSR;
 
@@ -72,6 +75,8 @@ typedef FNCPUMRDMSR *PFNCPUMRDMSR;
  * Implements writing one or more MSRs.
  *
  * @retval  VINF_SUCCESS on success.
+ * @retval  VINF_CPUM_R3_MSR_WRITE if the MSR write could not be serviced in the
+ *          current context (raw-mode or ring-0).
  * @retval  VERR_CPUM_RAISE_GP_0 on failure.
  *
  * @param   pVCpu       Pointer to the VMCPU.
@@ -80,7 +85,7 @@ typedef FNCPUMRDMSR *PFNCPUMRDMSR;
  * @param   uValue      The value to set, ignored bits masked.
  * @param   uRawValue   The raw value with the ignored bits not masked.
  */
-typedef DECLCALLBACK(int) FNCPUMWRMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue);
+typedef DECLCALLBACK(VBOXSTRICTRC) FNCPUMWRMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue);
 /** Pointer to a WRMSR worker for a specific MSR or range of MSRs.  */
 typedef FNCPUMWRMSR *PFNCPUMWRMSR;
 
@@ -94,7 +99,7 @@ typedef FNCPUMWRMSR *PFNCPUMWRMSR;
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_FixedValue(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_FixedValue(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pRange->uValue;
     return VINF_SUCCESS;
@@ -102,7 +107,7 @@ static DECLCALLBACK(int) cpumMsrRd_FixedValue(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IgnoreWrite(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IgnoreWrite(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     Log(("CPUM: Ignoring WRMSR %#x (%s), %#llx\n", idMsr, pRange->szName, uValue));
     return VINF_SUCCESS;
@@ -110,14 +115,14 @@ static DECLCALLBACK(int) cpumMsrWr_IgnoreWrite(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_WriteOnly(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_WriteOnly(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     return VERR_CPUM_RAISE_GP_0;
 }
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_ReadOnly(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_ReadOnly(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     Assert(pRange->fWrGpMask == UINT64_MAX);
     return VERR_CPUM_RAISE_GP_0;
@@ -133,7 +138,7 @@ static DECLCALLBACK(int) cpumMsrWr_ReadOnly(PVMCPU pVCpu, uint32_t idMsr, PCCPUM
  */
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32P5McAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32P5McAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0; /** @todo implement machine check injection. */
     return VINF_SUCCESS;
@@ -141,7 +146,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32P5McAddr(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32P5McAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32P5McAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement machine check injection. */
     return VINF_SUCCESS;
@@ -149,7 +154,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32P5McAddr(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32P5McType(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32P5McType(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0; /** @todo implement machine check injection. */
     return VINF_SUCCESS;
@@ -157,7 +162,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32P5McType(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32P5McType(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32P5McType(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement machine check injection. */
     return VINF_SUCCESS;
@@ -165,7 +170,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32P5McType(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32TimestampCounter(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32TimestampCounter(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = TMCpuTickGet(pVCpu);
     return VINF_SUCCESS;
@@ -173,7 +178,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32TimestampCounter(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32TimestampCounter(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32TimestampCounter(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     TMCpuTickSet(pVCpu->CTX_SUFF(pVM), pVCpu, uValue);
     return VINF_SUCCESS;
@@ -181,7 +186,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32TimestampCounter(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PlatformId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PlatformId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     uint64_t uValue = pRange->uValue;
     if (uValue & 0x1f00)
@@ -196,7 +201,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PlatformId(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32ApicBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32ApicBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     PVM pVM = pVCpu->CTX_SUFF(pVM);
 #if 0 /** @todo Sort this one out properly.  Evidence from ticks 12240 and 12875 suggest the apic base is still readable even
@@ -216,7 +221,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32ApicBase(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32ApicBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32ApicBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     int rc = PDMApicSetBase(pVCpu, uValue);
     if (rc != VINF_SUCCESS)
@@ -226,7 +231,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32ApicBase(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32FeatureControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32FeatureControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 1; /* Locked, no VT-X, no SYSENTER micromanagement. */
     return VINF_SUCCESS;
@@ -234,14 +239,14 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32FeatureControl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32FeatureControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32FeatureControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     return VERR_CPUM_RAISE_GP_0;
 }
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32BiosSignId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32BiosSignId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo fake microcode update. */
     *puValue = pRange->uValue;
@@ -250,7 +255,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32BiosSignId(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32BiosSignId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32BiosSignId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /* Normally, zero is written to Ia32BiosSignId before reading it in order
        to select the signature instead of the BBL_CR_D3 behaviour.  The GP mask
@@ -261,7 +266,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32BiosSignId(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32BiosUpdateTrigger(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32BiosUpdateTrigger(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Fake bios update trigger better.  The value is the address to an
      *        update package, I think.  We should probably GP if it's invalid. */
@@ -270,7 +275,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32BiosUpdateTrigger(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32SmmMonitorCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32SmmMonitorCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo SMM. */
     *puValue = 0;
@@ -279,7 +284,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32SmmMonitorCtl(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32SmmMonitorCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32SmmMonitorCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo SMM. */
     return VINF_SUCCESS;
@@ -287,7 +292,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32SmmMonitorCtl(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PmcN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PmcN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo check CPUID leaf 0ah. */
     *puValue = 0;
@@ -296,7 +301,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PmcN(PVMCPU pVCpu, uint32_t idMsr, PCCPUM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PmcN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PmcN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo check CPUID leaf 0ah. */
     return VINF_SUCCESS;
@@ -304,7 +309,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PmcN(PVMCPU pVCpu, uint32_t idMsr, PCCPUM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32MonitorFilterLineSize(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32MonitorFilterLineSize(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo return 0x1000 if we try emulate mwait 100% correctly. */
     *puValue = 0x40; /** @todo Change to CPU cache line size. */
@@ -313,7 +318,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32MonitorFilterLineSize(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32MonitorFilterLineSize(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32MonitorFilterLineSize(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo should remember writes, though it's supposedly something only a BIOS
      * would write so, it's not extremely important. */
@@ -321,7 +326,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32MonitorFilterLineSize(PVMCPU pVCpu, uint3
 }
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32MPerf(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32MPerf(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Read MPERF: Adjust against previously written MPERF value.  Is TSC
      *        what we want? */
@@ -331,7 +336,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32MPerf(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32MPerf(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32MPerf(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Write MPERF: Calc adjustment. */
     return VINF_SUCCESS;
@@ -339,7 +344,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32MPerf(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32APerf(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32APerf(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Read APERF: Adjust against previously written MPERF value.  Is TSC
      *        what we want? */
@@ -349,7 +354,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32APerf(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32APerf(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32APerf(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Write APERF: Calc adjustment. */
     return VINF_SUCCESS;
@@ -357,7 +362,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32APerf(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32MtrrCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /* This is currently a bit weird. :-) */
     uint8_t const   cVariableRangeRegs              = 0;
@@ -373,7 +378,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrCap(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrPhysBaseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32MtrrPhysBaseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Implement variable MTRR storage. */
     Assert(pRange->uValue == (idMsr - 0x200) / 2);
@@ -383,7 +388,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrPhysBaseN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32MtrrPhysBaseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32MtrrPhysBaseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /*
      * Validate the value.
@@ -413,7 +418,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32MtrrPhysBaseN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrPhysMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32MtrrPhysMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Implement variable MTRR storage. */
     Assert(pRange->uValue == (idMsr - 0x200) / 2);
@@ -423,7 +428,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrPhysMaskN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32MtrrPhysMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32MtrrPhysMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /*
      * Validate the value.
@@ -447,7 +452,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32MtrrPhysMaskN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrFixed(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32MtrrFixed(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     CPUM_MSR_ASSERT_CPUMCPU_OFFSET_RETURN(pVCpu, pRange, uint64_t, puFixedMtrr);
     *puValue = *puFixedMtrr;
@@ -456,7 +461,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrFixed(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32MtrrFixed(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32MtrrFixed(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     CPUM_MSR_ASSERT_CPUMCPU_OFFSET_RETURN(pVCpu, pRange, uint64_t, puFixedMtrr);
     for (uint32_t cShift = 0; cShift < 63; cShift += 8)
@@ -475,7 +480,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32MtrrFixed(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrDefType(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32MtrrDefType(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrDefType;
     return VINF_SUCCESS;
@@ -483,7 +488,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32MtrrDefType(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32MtrrDefType(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32MtrrDefType(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     if ((uValue & 0xff) >= 7)
     {
@@ -497,7 +502,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32MtrrDefType(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32Pat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32Pat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.msrPAT;
     return VINF_SUCCESS;
@@ -505,7 +510,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32Pat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32Pat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32Pat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     pVCpu->cpum.s.Guest.msrPAT = uValue;
     return VINF_SUCCESS;
@@ -513,7 +518,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32Pat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32SysEnterCs(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32SysEnterCs(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.SysEnter.cs;
     return VINF_SUCCESS;
@@ -521,7 +526,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32SysEnterCs(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32SysEnterCs(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32SysEnterCs(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /* Note! We used to mask this by 0xffff, but turns out real HW doesn't and
              there are generally 32-bit working bits backing this register. */
@@ -531,7 +536,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32SysEnterCs(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32SysEnterEsp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32SysEnterEsp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.SysEnter.esp;
     return VINF_SUCCESS;
@@ -539,7 +544,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32SysEnterEsp(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32SysEnterEsp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32SysEnterEsp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     if (X86_IS_CANONICAL(uValue))
     {
@@ -552,7 +557,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32SysEnterEsp(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32SysEnterEip(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32SysEnterEip(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.SysEnter.eip;
     return VINF_SUCCESS;
@@ -560,7 +565,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32SysEnterEip(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32SysEnterEip(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32SysEnterEip(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     if (X86_IS_CANONICAL(uValue))
     {
@@ -577,7 +582,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32SysEnterEip(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32McgCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32McgCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
 #if 0 /** @todo implement machine checks. */
     *puValue = pRange->uValue & (RT_BIT_64(8) | 0);
@@ -589,7 +594,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32McgCap(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32McgStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32McgStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement machine checks. */
     *puValue = 0;
@@ -598,7 +603,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32McgStatus(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32McgStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32McgStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement machine checks. */
     return VINF_SUCCESS;
@@ -606,7 +611,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32McgStatus(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32McgCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32McgCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement machine checks. */
     *puValue = 0;
@@ -615,7 +620,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32McgCtl(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32McgCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32McgCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement machine checks. */
     return VINF_SUCCESS;
@@ -623,7 +628,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32McgCtl(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32DebugCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32DebugCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_DEBUGCTL. */
     *puValue = 0;
@@ -632,7 +637,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32DebugCtl(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32DebugCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32DebugCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement IA32_DEBUGCTL. */
     return VINF_SUCCESS;
@@ -640,7 +645,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32DebugCtl(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32SmrrPhysBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32SmrrPhysBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement intel SMM. */
     *puValue = 0;
@@ -649,7 +654,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32SmrrPhysBase(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32SmrrPhysBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32SmrrPhysBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement intel SMM. */
     return VERR_CPUM_RAISE_GP_0;
@@ -657,7 +662,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32SmrrPhysBase(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32SmrrPhysMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32SmrrPhysMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement intel SMM. */
     *puValue = 0;
@@ -666,7 +671,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32SmrrPhysMask(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32SmrrPhysMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32SmrrPhysMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement intel SMM. */
     return VERR_CPUM_RAISE_GP_0;
@@ -674,7 +679,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32SmrrPhysMask(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PlatformDcaCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PlatformDcaCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement intel direct cache access (DCA)?? */
     *puValue = 0;
@@ -683,7 +688,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PlatformDcaCap(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PlatformDcaCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PlatformDcaCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement intel direct cache access (DCA)?? */
     return VINF_SUCCESS;
@@ -691,7 +696,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PlatformDcaCap(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32CpuDcaCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32CpuDcaCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement intel direct cache access (DCA)?? */
     *puValue = 0;
@@ -700,7 +705,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32CpuDcaCap(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32Dca0Cap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32Dca0Cap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement intel direct cache access (DCA)?? */
     *puValue = 0;
@@ -709,7 +714,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32Dca0Cap(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32Dca0Cap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32Dca0Cap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement intel direct cache access (DCA)?? */
     return VINF_SUCCESS;
@@ -717,7 +722,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32Dca0Cap(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_PERFEVTSEL0+. */
     *puValue = 0;
@@ -726,7 +731,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement IA32_PERFEVTSEL0+. */
     return VINF_SUCCESS;
@@ -734,7 +739,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     uint64_t uValue = pRange->uValue;
 
@@ -755,7 +760,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PerfStatus(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /* Pentium4 allows writing, but all bits are ignored. */
     return VINF_SUCCESS;
@@ -763,7 +768,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PerfStatus(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PerfCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PerfCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_PERFCTL. */
     *puValue = 0;
@@ -772,7 +777,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PerfCtl(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PerfCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PerfCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement IA32_PERFCTL. */
     return VINF_SUCCESS;
@@ -780,7 +785,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PerfCtl(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32FixedCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32FixedCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_FIXED_CTRn (fixed performance counters). */
     *puValue = 0;
@@ -789,7 +794,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32FixedCtrN(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32FixedCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32FixedCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement IA32_FIXED_CTRn (fixed performance counters). */
     return VINF_SUCCESS;
@@ -797,7 +802,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32FixedCtrN(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PerfCapabilities(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PerfCapabilities(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement performance counters. */
     *puValue = 0;
@@ -806,7 +811,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PerfCapabilities(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PerfCapabilities(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PerfCapabilities(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement performance counters. */
     return VINF_SUCCESS;
@@ -814,7 +819,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PerfCapabilities(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32FixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32FixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement performance counters. */
     *puValue = 0;
@@ -823,7 +828,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32FixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32FixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32FixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement performance counters. */
     return VINF_SUCCESS;
@@ -831,7 +836,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32FixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PerfGlobalStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PerfGlobalStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement performance counters. */
     *puValue = 0;
@@ -840,7 +845,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PerfGlobalStatus(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PerfGlobalStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PerfGlobalStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement performance counters. */
     return VINF_SUCCESS;
@@ -848,7 +853,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PerfGlobalStatus(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PerfGlobalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PerfGlobalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement performance counters. */
     *puValue = 0;
@@ -857,7 +862,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PerfGlobalCtrl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PerfGlobalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PerfGlobalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement performance counters. */
     return VINF_SUCCESS;
@@ -865,7 +870,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PerfGlobalCtrl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement performance counters. */
     *puValue = 0;
@@ -874,7 +879,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement performance counters. */
     return VINF_SUCCESS;
@@ -882,7 +887,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32PebsEnable(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32PebsEnable(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement performance counters. */
     *puValue = 0;
@@ -891,7 +896,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32PebsEnable(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32PebsEnable(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32PebsEnable(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement performance counters. */
     return VINF_SUCCESS;
@@ -899,7 +904,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32PebsEnable(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32ClockModulation(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32ClockModulation(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_CLOCK_MODULATION. */
     *puValue = 0;
@@ -908,7 +913,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32ClockModulation(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32ClockModulation(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32ClockModulation(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement IA32_CLOCK_MODULATION. */
     return VINF_SUCCESS;
@@ -916,7 +921,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32ClockModulation(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32ThermInterrupt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32ThermInterrupt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_THERM_INTERRUPT. */
     *puValue = 0;
@@ -925,7 +930,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32ThermInterrupt(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32ThermInterrupt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32ThermInterrupt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement IA32_THERM_STATUS. */
     return VINF_SUCCESS;
@@ -933,7 +938,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32ThermInterrupt(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32ThermStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32ThermStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_THERM_STATUS. */
     *puValue = 0;
@@ -942,7 +947,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32ThermStatus(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32ThermStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32ThermStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement IA32_THERM_INTERRUPT. */
     return VINF_SUCCESS;
@@ -950,7 +955,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32ThermStatus(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32Therm2Ctl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32Therm2Ctl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_THERM2_CTL. */
     *puValue = 0;
@@ -959,7 +964,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32Therm2Ctl(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32Therm2Ctl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32Therm2Ctl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement IA32_THERM2_CTL. */
     return VINF_SUCCESS;
@@ -967,7 +972,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32Therm2Ctl(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32MiscEnable(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32MiscEnable(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.GuestMsrs.msr.MiscEnable;
     return VINF_SUCCESS;
@@ -975,7 +980,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32MiscEnable(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32MiscEnable(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32MiscEnable(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
 #ifdef LOG_ENABLED
     uint64_t const uOld = pVCpu->cpum.s.GuestMsrs.msr.MiscEnable;
@@ -997,7 +1002,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32MiscEnable(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32McCtlStatusAddrMiscN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32McCtlStatusAddrMiscN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Implement machine check exception injection. */
     switch (idMsr & 3)
@@ -1021,7 +1026,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32McCtlStatusAddrMiscN(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32McCtlStatusAddrMiscN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32McCtlStatusAddrMiscN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     switch (idMsr & 3)
     {
@@ -1066,7 +1071,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32McCtlStatusAddrMiscN(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32McNCtl2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32McNCtl2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Implement machine check exception injection. */
     *puValue = 0;
@@ -1075,7 +1080,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32McNCtl2(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32McNCtl2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32McNCtl2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Implement machine check exception injection. */
     return VINF_SUCCESS;
@@ -1083,7 +1088,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32McNCtl2(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32DsArea(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32DsArea(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement IA32_DS_AREA. */
     *puValue = 0;
@@ -1092,14 +1097,14 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32DsArea(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32DsArea(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32DsArea(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     return VINF_SUCCESS;
 }
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32TscDeadline(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32TscDeadline(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement TSC deadline timer. */
     *puValue = 0;
@@ -1108,7 +1113,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32TscDeadline(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32TscDeadline(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32TscDeadline(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement TSC deadline timer. */
     return VINF_SUCCESS;
@@ -1116,7 +1121,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32TscDeadline(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32X2ApicN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32X2ApicN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     int rc = PDMApicReadMSR(pVCpu->CTX_SUFF(pVM), pVCpu->idCpu, idMsr, puValue);
     if (rc != VINF_SUCCESS)
@@ -1129,7 +1134,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32X2ApicN(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32X2ApicN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32X2ApicN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     int rc = PDMApicWriteMSR(pVCpu->CTX_SUFF(pVM), pVCpu->idCpu, idMsr, uValue);
     if (rc != VINF_SUCCESS)
@@ -1142,7 +1147,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32X2ApicN(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32DebugInterface(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32DebugInterface(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo IA32_DEBUG_INTERFACE (no docs)  */
     *puValue = 0;
@@ -1151,7 +1156,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32DebugInterface(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Ia32DebugInterface(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Ia32DebugInterface(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo IA32_DEBUG_INTERFACE (no docs)  */
     return VINF_SUCCESS;
@@ -1159,7 +1164,7 @@ static DECLCALLBACK(int) cpumMsrWr_Ia32DebugInterface(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1167,7 +1172,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxBase(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxPinbasedCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxPinbasedCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1175,7 +1180,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxPinbasedCtls(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxProcbasedCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxProcbasedCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1183,7 +1188,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxProcbasedCtls(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxExitCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxExitCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1191,7 +1196,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxExitCtls(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxEntryCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxEntryCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1199,7 +1204,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxEntryCtls(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxMisc(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxMisc(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1207,7 +1212,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxMisc(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxCr0Fixed0(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxCr0Fixed0(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1215,7 +1220,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxCr0Fixed0(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxCr0Fixed1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxCr0Fixed1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1223,7 +1228,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxCr0Fixed1(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxCr4Fixed0(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxCr4Fixed0(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1231,7 +1236,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxCr4Fixed0(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxCr4Fixed1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxCr4Fixed1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1239,7 +1244,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxCr4Fixed1(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxVmcsEnum(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxVmcsEnum(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1247,7 +1252,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxVmcsEnum(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxProcBasedCtls2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxProcBasedCtls2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1255,7 +1260,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxProcBasedCtls2(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxEptVpidCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxEptVpidCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1263,7 +1268,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxEptVpidCap(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxTruePinbasedCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxTruePinbasedCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1271,7 +1276,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxTruePinbasedCtls(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxTrueProcbasedCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxTrueProcbasedCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1279,7 +1284,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxTrueProcbasedCtls(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxTrueExitCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxTrueExitCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1287,7 +1292,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxTrueExitCtls(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Ia32VmxTrueEntryCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Ia32VmxTrueEntryCtls(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1310,7 +1315,7 @@ static DECLCALLBACK(int) cpumMsrRd_Ia32VmxTrueEntryCtls(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64Efer(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64Efer(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.msrEFER;
     return VINF_SUCCESS;
@@ -1318,14 +1323,15 @@ static DECLCALLBACK(int) cpumMsrRd_Amd64Efer(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64Efer(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64Efer(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     PVM             pVM          = pVCpu->CTX_SUFF(pVM);
     uint64_t const  uOldEfer     = pVCpu->cpum.s.Guest.msrEFER;
-    uint32_t const  fExtFeatures = pVM->cpum.s.aGuestCpuIdExt[0].eax >= 0x80000001
-                                 ? pVM->cpum.s.aGuestCpuIdExt[1].edx
+    uint32_t const  fExtFeatures = pVM->cpum.s.aGuestCpuIdPatmExt[0].uEax >= 0x80000001
+                                 ? pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx
                                  : 0;
     uint64_t        fMask        = 0;
+    uint64_t        fIgnoreMask  = MSR_K6_EFER_LMA;
 
     /* Filter out those bits the guest is allowed to change. (e.g. LMA is read-only) */
     if (fExtFeatures & X86_CPUID_EXT_FEATURE_EDX_NX)
@@ -1337,6 +1343,13 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64Efer(PVMCPU pVCpu, uint32_t idMsr, PCCPU
     if (fExtFeatures & X86_CPUID_AMD_FEATURE_EDX_FFXSR)
         fMask |= MSR_K6_EFER_FFXSR;
 
+    /* #GP(0) If anything outside the allowed bits is set. */
+    if (uValue & ~(fIgnoreMask | fMask))
+    {
+        Log(("CPUM: Settings disallowed EFER bit. uValue=%#RX64 fAllowed=%#RX64 -> #GP(0)\n", uValue, fMask));
+        return VERR_CPUM_RAISE_GP_0;
+    }
+
     /* Check for illegal MSR_K6_EFER_LME transitions: not allowed to change LME if
        paging is enabled. (AMD Arch. Programmer's Manual Volume 2: Table 14-5) */
     if (   (uOldEfer & MSR_K6_EFER_LME) != (uValue & fMask & MSR_K6_EFER_LME)
@@ -1369,7 +1382,7 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64Efer(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64SyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64SyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.msrSTAR;
     return VINF_SUCCESS;
@@ -1377,7 +1390,7 @@ static DECLCALLBACK(int) cpumMsrRd_Amd64SyscallTarget(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64SyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64SyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     pVCpu->cpum.s.Guest.msrSTAR = uValue;
     return VINF_SUCCESS;
@@ -1385,7 +1398,7 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64SyscallTarget(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64LongSyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64LongSyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.msrLSTAR;
     return VINF_SUCCESS;
@@ -1393,7 +1406,7 @@ static DECLCALLBACK(int) cpumMsrRd_Amd64LongSyscallTarget(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64LongSyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64LongSyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     if (!X86_IS_CANONICAL(uValue))
     {
@@ -1406,7 +1419,7 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64LongSyscallTarget(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64CompSyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64CompSyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.msrCSTAR;
     return VINF_SUCCESS;
@@ -1414,7 +1427,7 @@ static DECLCALLBACK(int) cpumMsrRd_Amd64CompSyscallTarget(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64CompSyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64CompSyscallTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     if (!X86_IS_CANONICAL(uValue))
     {
@@ -1427,7 +1440,7 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64CompSyscallTarget(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64SyscallFlagMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64SyscallFlagMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.msrSFMASK;
     return VINF_SUCCESS;
@@ -1435,7 +1448,7 @@ static DECLCALLBACK(int) cpumMsrRd_Amd64SyscallFlagMask(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64SyscallFlagMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64SyscallFlagMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     pVCpu->cpum.s.Guest.msrSFMASK = uValue;
     return VINF_SUCCESS;
@@ -1443,7 +1456,7 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64SyscallFlagMask(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64FsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64FsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.fs.u64Base;
     return VINF_SUCCESS;
@@ -1451,7 +1464,7 @@ static DECLCALLBACK(int) cpumMsrRd_Amd64FsBase(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64FsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64FsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     pVCpu->cpum.s.Guest.fs.u64Base = uValue;
     return VINF_SUCCESS;
@@ -1459,14 +1472,14 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64FsBase(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64GsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64GsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.gs.u64Base;
     return VINF_SUCCESS;
 }
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64GsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64GsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     pVCpu->cpum.s.Guest.gs.u64Base = uValue;
     return VINF_SUCCESS;
@@ -1475,14 +1488,14 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64GsBase(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64KernelGsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64KernelGsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.Guest.msrKERNELGSBASE;
     return VINF_SUCCESS;
 }
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64KernelGsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64KernelGsBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     pVCpu->cpum.s.Guest.msrKERNELGSBASE = uValue;
     return VINF_SUCCESS;
@@ -1490,14 +1503,14 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64KernelGsBase(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_Amd64TscAux(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Amd64TscAux(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.GuestMsrs.msr.TscAux;
     return VINF_SUCCESS;
 }
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_Amd64TscAux(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Amd64TscAux(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     pVCpu->cpum.s.GuestMsrs.msr.TscAux = uValue;
     return VINF_SUCCESS;
@@ -1511,7 +1524,7 @@ static DECLCALLBACK(int) cpumMsrWr_Amd64TscAux(PVMCPU pVCpu, uint32_t idMsr, PCC
  */
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelEblCrPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelEblCrPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo recalc clock frequency ratio? */
     *puValue = pRange->uValue;
@@ -1520,7 +1533,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelEblCrPowerOn(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelEblCrPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelEblCrPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Write EBL_CR_POWERON: Remember written bits. */
     return VINF_SUCCESS;
@@ -1528,7 +1541,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelEblCrPowerOn(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7CoreThreadCount(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7CoreThreadCount(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /* Note! According to cpuid_set_info in XNU (10.7.0), Westmere CPU only
              have a 4-bit core count. */
@@ -1540,7 +1553,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7CoreThreadCount(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelP4EbcHardPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelP4EbcHardPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo P4 hard power on config */
     *puValue = pRange->uValue;
@@ -1549,7 +1562,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelP4EbcHardPowerOn(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelP4EbcHardPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelP4EbcHardPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo P4 hard power on config */
     return VINF_SUCCESS;
@@ -1557,7 +1570,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelP4EbcHardPowerOn(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelP4EbcSoftPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelP4EbcSoftPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo P4 soft power on config  */
     *puValue = pRange->uValue;
@@ -1566,7 +1579,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelP4EbcSoftPowerOn(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelP4EbcSoftPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelP4EbcSoftPowerOn(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo P4 soft power on config */
     return VINF_SUCCESS;
@@ -1574,7 +1587,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelP4EbcSoftPowerOn(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelP4EbcFrequencyId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelP4EbcFrequencyId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     uint64_t uValue;
     PVM      pVM            = pVCpu->CTX_SUFF(pVM);
@@ -1632,7 +1645,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelP4EbcFrequencyId(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelP4EbcFrequencyId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelP4EbcFrequencyId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo P4 bus frequency config  */
     return VINF_SUCCESS;
@@ -1640,7 +1653,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelP4EbcFrequencyId(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelP6FsbFrequency(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelP6FsbFrequency(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /* Convert the scalable bus frequency to the encoding in the intel manual (for core+). */
     uint64_t uScalableBusHz = CPUMGetGuestScalableBusFrequency(pVCpu->CTX_SUFF(pVM));
@@ -1666,7 +1679,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelP6FsbFrequency(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelPlatformInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelPlatformInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /* Just indicate a fixed TSC, no turbo boost, no programmable anything. */
     PVM      pVM            = pVCpu->CTX_SUFF(pVM);
@@ -1686,7 +1699,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelPlatformInfo(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelFlexRatio(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelFlexRatio(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     uint64_t uValue = pRange->uValue & ~UINT64_C(0x1ff00);
 
@@ -1702,7 +1715,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelFlexRatio(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelFlexRatio(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelFlexRatio(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement writing MSR_FLEX_RATIO. */
     return VINF_SUCCESS;
@@ -1710,7 +1723,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelFlexRatio(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelPkgCStConfigControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelPkgCStConfigControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pVCpu->cpum.s.GuestMsrs.msr.PkgCStateCfgCtrl;
     return VINF_SUCCESS;
@@ -1718,7 +1731,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelPkgCStConfigControl(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelPkgCStConfigControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelPkgCStConfigControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     if (pVCpu->cpum.s.GuestMsrs.msr.PkgCStateCfgCtrl & RT_BIT_64(15))
     {
@@ -1738,7 +1751,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelPkgCStConfigControl(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelPmgIoCaptureBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelPmgIoCaptureBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement I/O mwait wakeup. */
     *puValue = 0;
@@ -1747,7 +1760,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelPmgIoCaptureBase(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelPmgIoCaptureBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelPmgIoCaptureBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement I/O mwait wakeup. */
     return VINF_SUCCESS;
@@ -1755,7 +1768,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelPmgIoCaptureBase(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelLastBranchFromToN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelLastBranchFromToN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement last branch records. */
     *puValue = 0;
@@ -1764,7 +1777,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelLastBranchFromToN(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelLastBranchFromToN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelLastBranchFromToN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement last branch records. */
     return VINF_SUCCESS;
@@ -1772,7 +1785,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelLastBranchFromToN(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelLastBranchFromN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelLastBranchFromN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement last branch records. */
     *puValue = 0;
@@ -1781,7 +1794,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelLastBranchFromN(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelLastBranchFromN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelLastBranchFromN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement last branch records. */
     /** @todo Probing indicates that bit 63 is settable on SandyBridge, at least
@@ -1797,7 +1810,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelLastBranchFromN(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelLastBranchToN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelLastBranchToN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement last branch records. */
     *puValue = 0;
@@ -1806,7 +1819,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelLastBranchToN(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelLastBranchToN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelLastBranchToN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement last branch records. */
     /** @todo Probing indicates that bit 63 is settable on SandyBridge, at least
@@ -1822,7 +1835,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelLastBranchToN(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelLastBranchTos(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelLastBranchTos(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement last branch records. */
     *puValue = 0;
@@ -1831,7 +1844,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelLastBranchTos(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelLastBranchTos(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelLastBranchTos(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement last branch records. */
     return VINF_SUCCESS;
@@ -1839,7 +1852,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelLastBranchTos(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelBblCrCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelBblCrCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pRange->uValue;
     return VINF_SUCCESS;
@@ -1847,14 +1860,14 @@ static DECLCALLBACK(int) cpumMsrRd_IntelBblCrCtl(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelBblCrCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelBblCrCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     return VINF_SUCCESS;
 }
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelBblCrCtl3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelBblCrCtl3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pRange->uValue;
     return VINF_SUCCESS;
@@ -1862,14 +1875,14 @@ static DECLCALLBACK(int) cpumMsrRd_IntelBblCrCtl3(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelBblCrCtl3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelBblCrCtl3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     return VINF_SUCCESS;
 }
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7TemperatureTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7TemperatureTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = pRange->uValue;
     return VINF_SUCCESS;
@@ -1877,14 +1890,14 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7TemperatureTarget(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7TemperatureTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7TemperatureTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     return VINF_SUCCESS;
 }
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7MsrOffCoreResponseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7MsrOffCoreResponseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo machine check. */
     *puValue = pRange->uValue;
@@ -1893,7 +1906,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7MsrOffCoreResponseN(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7MsrOffCoreResponseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7MsrOffCoreResponseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo machine check. */
     return VINF_SUCCESS;
@@ -1901,7 +1914,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7MsrOffCoreResponseN(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7MiscPwrMgmt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7MiscPwrMgmt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     return VINF_SUCCESS;
@@ -1909,14 +1922,14 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7MiscPwrMgmt(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7MiscPwrMgmt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7MiscPwrMgmt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     return VINF_SUCCESS;
 }
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelP6CrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelP6CrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     int rc = CPUMGetGuestCRx(pVCpu, pRange->uValue, puValue);
     AssertRC(rc);
@@ -1925,7 +1938,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelP6CrN(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelP6CrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelP6CrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /* This CRx interface differs from the MOV CRx, GReg interface in that
        #GP(0) isn't raised if unsupported bits are written to.  Instead they
@@ -1937,7 +1950,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelP6CrN(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelCpuId1FeatureMaskEcdx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelCpuId1FeatureMaskEcdx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement CPUID masking.  */
     *puValue = UINT64_MAX;
@@ -1946,7 +1959,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelCpuId1FeatureMaskEcdx(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelCpuId1FeatureMaskEcdx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelCpuId1FeatureMaskEcdx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement CPUID masking.  */
     return VINF_SUCCESS;
@@ -1954,7 +1967,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelCpuId1FeatureMaskEcdx(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelCpuId1FeatureMaskEax(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelCpuId1FeatureMaskEax(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement CPUID masking.  */
     return VINF_SUCCESS;
@@ -1962,7 +1975,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelCpuId1FeatureMaskEax(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelCpuId1FeatureMaskEax(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelCpuId1FeatureMaskEax(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement CPUID masking.  */
     return VINF_SUCCESS;
@@ -1971,7 +1984,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelCpuId1FeatureMaskEax(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelCpuId80000001FeatureMaskEcdx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelCpuId80000001FeatureMaskEcdx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement CPUID masking.  */
     *puValue = UINT64_MAX;
@@ -1980,7 +1993,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelCpuId80000001FeatureMaskEcdx(PVMCPU pVCp
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelCpuId80000001FeatureMaskEcdx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelCpuId80000001FeatureMaskEcdx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement CPUID masking.  */
     return VINF_SUCCESS;
@@ -1989,7 +2002,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelCpuId80000001FeatureMaskEcdx(PVMCPU pVCp
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyAesNiCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7SandyAesNiCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement AES-NI.  */
     *puValue = 3;  /* Bit 0 is lock bit, bit 1 disables AES-NI. That's what they say. */
@@ -1998,7 +2011,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyAesNiCtl(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyAesNiCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7SandyAesNiCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement AES-NI.  */
     return VERR_CPUM_RAISE_GP_0;
@@ -2006,7 +2019,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyAesNiCtl(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7TurboRatioLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7TurboRatioLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement intel C states.  */
     *puValue = pRange->uValue;
@@ -2015,7 +2028,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7TurboRatioLimit(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7TurboRatioLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7TurboRatioLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement intel C states.  */
     return VINF_SUCCESS;
@@ -2023,7 +2036,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7TurboRatioLimit(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7LbrSelect(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7LbrSelect(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement last-branch-records.  */
     *puValue = 0;
@@ -2032,7 +2045,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7LbrSelect(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7LbrSelect(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7LbrSelect(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement last-branch-records.  */
     return VINF_SUCCESS;
@@ -2040,7 +2053,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7LbrSelect(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyErrorControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7SandyErrorControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement memory error injection (MSR_ERROR_CONTROL).  */
     *puValue = 0;
@@ -2049,7 +2062,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyErrorControl(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyErrorControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7SandyErrorControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement memory error injection (MSR_ERROR_CONTROL).  */
     return VINF_SUCCESS;
@@ -2057,7 +2070,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyErrorControl(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7VirtualLegacyWireCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7VirtualLegacyWireCap(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement memory VLW?  */
     *puValue = pRange->uValue;
@@ -2074,7 +2087,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7VirtualLegacyWireCap(PVMCPU pVCpu, uin
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7PowerCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7PowerCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management  */
     *puValue = 0;
@@ -2083,7 +2096,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7PowerCtl(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7PowerCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7PowerCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel power management  */
     return VINF_SUCCESS;
@@ -2091,7 +2104,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7PowerCtl(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyPebsNumAlt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7SandyPebsNumAlt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel performance counters.  */
     *puValue = 0;
@@ -2100,7 +2113,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyPebsNumAlt(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyPebsNumAlt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7SandyPebsNumAlt(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel performance counters.  */
     return VINF_SUCCESS;
@@ -2108,7 +2121,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyPebsNumAlt(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7PebsLdLat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7PebsLdLat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel performance counters.  */
     *puValue = 0;
@@ -2117,7 +2130,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7PebsLdLat(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7PebsLdLat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7PebsLdLat(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel performance counters.  */
     return VINF_SUCCESS;
@@ -2125,7 +2138,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7PebsLdLat(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7PkgCnResidencyN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7PkgCnResidencyN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2134,7 +2147,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7PkgCnResidencyN(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7CoreCnResidencyN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7CoreCnResidencyN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2143,7 +2156,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7CoreCnResidencyN(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyVrCurrentConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7SandyVrCurrentConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Figure out what MSR_VR_CURRENT_CONFIG & MSR_VR_MISC_CONFIG are.  */
     *puValue = 0;
@@ -2152,7 +2165,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyVrCurrentConfig(PVMCPU pVCpu, uin
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyVrCurrentConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7SandyVrCurrentConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Figure out what MSR_VR_CURRENT_CONFIG & MSR_VR_MISC_CONFIG are.  */
     return VINF_SUCCESS;
@@ -2160,7 +2173,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyVrCurrentConfig(PVMCPU pVCpu, uin
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyVrMiscConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7SandyVrMiscConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Figure out what MSR_VR_CURRENT_CONFIG & MSR_VR_MISC_CONFIG are.  */
     *puValue = 0;
@@ -2169,7 +2182,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyVrMiscConfig(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyVrMiscConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7SandyVrMiscConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Figure out what MSR_VR_CURRENT_CONFIG & MSR_VR_MISC_CONFIG are.  */
     return VINF_SUCCESS;
@@ -2177,7 +2190,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyVrMiscConfig(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyRaplPowerUnit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7SandyRaplPowerUnit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel RAPL.  */
     *puValue = pRange->uValue;
@@ -2186,7 +2199,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyRaplPowerUnit(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyPkgCnIrtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7SandyPkgCnIrtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2195,7 +2208,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyPkgCnIrtlN(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyPkgCnIrtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7SandyPkgCnIrtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel power management.  */
     return VINF_SUCCESS;
@@ -2203,7 +2216,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7SandyPkgCnIrtlN(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyPkgC2Residency(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7SandyPkgC2Residency(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2212,7 +2225,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7SandyPkgC2Residency(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPkgPowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPkgPowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel RAPL.  */
     *puValue = 0;
@@ -2221,7 +2234,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPkgPowerLimit(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPkgPowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7RaplPkgPowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel RAPL.  */
     return VINF_SUCCESS;
@@ -2229,7 +2242,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPkgPowerLimit(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPkgEnergyStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPkgEnergyStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2238,7 +2251,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPkgEnergyStatus(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPkgPerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPkgPerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2247,7 +2260,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPkgPerfStatus(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPkgPowerInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPkgPowerInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2256,7 +2269,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPkgPowerInfo(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplDramPowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplDramPowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel RAPL.  */
     *puValue = 0;
@@ -2265,7 +2278,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplDramPowerLimit(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplDramPowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7RaplDramPowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel RAPL.  */
     return VINF_SUCCESS;
@@ -2273,7 +2286,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplDramPowerLimit(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplDramEnergyStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplDramEnergyStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2282,7 +2295,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplDramEnergyStatus(PVMCPU pVCpu, uin
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplDramPerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplDramPerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2291,7 +2304,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplDramPerfStatus(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplDramPowerInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplDramPowerInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2300,7 +2313,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplDramPowerInfo(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp0PowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPp0PowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel RAPL.  */
     *puValue = 0;
@@ -2309,7 +2322,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp0PowerLimit(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPp0PowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7RaplPp0PowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel RAPL.  */
     return VINF_SUCCESS;
@@ -2317,7 +2330,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPp0PowerLimit(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp0EnergyStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPp0EnergyStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2326,7 +2339,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp0EnergyStatus(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp0Policy(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPp0Policy(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel RAPL.  */
     *puValue = 0;
@@ -2335,7 +2348,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp0Policy(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPp0Policy(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7RaplPp0Policy(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel RAPL.  */
     return VINF_SUCCESS;
@@ -2343,7 +2356,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPp0Policy(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp0PerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPp0PerfStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2352,7 +2365,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp0PerfStatus(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp1PowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPp1PowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel RAPL.  */
     *puValue = 0;
@@ -2361,7 +2374,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp1PowerLimit(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPp1PowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7RaplPp1PowerLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel RAPL.  */
     return VINF_SUCCESS;
@@ -2369,7 +2382,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPp1PowerLimit(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp1EnergyStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPp1EnergyStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2378,7 +2391,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp1EnergyStatus(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp1Policy(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7RaplPp1Policy(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel RAPL.  */
     *puValue = 0;
@@ -2387,7 +2400,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7RaplPp1Policy(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPp1Policy(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7RaplPp1Policy(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel RAPL.  */
     return VINF_SUCCESS;
@@ -2395,7 +2408,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7RaplPp1Policy(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyConfigTdpNominal(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7IvyConfigTdpNominal(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = pRange->uValue;
@@ -2404,7 +2417,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyConfigTdpNominal(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyConfigTdpLevel1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7IvyConfigTdpLevel1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = pRange->uValue;
@@ -2413,7 +2426,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyConfigTdpLevel1(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyConfigTdpLevel2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7IvyConfigTdpLevel2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = pRange->uValue;
@@ -2422,7 +2435,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyConfigTdpLevel2(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyConfigTdpControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7IvyConfigTdpControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2431,7 +2444,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyConfigTdpControl(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7IvyConfigTdpControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7IvyConfigTdpControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel power management.  */
     return VINF_SUCCESS;
@@ -2439,7 +2452,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7IvyConfigTdpControl(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyTurboActivationRatio(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7IvyTurboActivationRatio(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo intel power management.  */
     *puValue = 0;
@@ -2448,7 +2461,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7IvyTurboActivationRatio(PVMCPU pVCpu,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7IvyTurboActivationRatio(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7IvyTurboActivationRatio(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo intel power management.  */
     return VINF_SUCCESS;
@@ -2456,7 +2469,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7IvyTurboActivationRatio(PVMCPU pVCpu,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfGlobalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7UncPerfGlobalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo uncore msrs.  */
     *puValue = 0;
@@ -2465,7 +2478,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfGlobalCtrl(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfGlobalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7UncPerfGlobalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo uncore msrs.  */
     return VINF_SUCCESS;
@@ -2473,7 +2486,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfGlobalCtrl(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfGlobalStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7UncPerfGlobalStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo uncore msrs.  */
     *puValue = 0;
@@ -2482,7 +2495,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfGlobalStatus(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfGlobalStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7UncPerfGlobalStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo uncore msrs.  */
     return VINF_SUCCESS;
@@ -2490,7 +2503,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfGlobalStatus(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7UncPerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo uncore msrs.  */
     *puValue = 0;
@@ -2499,7 +2512,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfGlobalOvfCtrl(PVMCPU pVCpu, uin
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7UncPerfGlobalOvfCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo uncore msrs.  */
     return VINF_SUCCESS;
@@ -2507,7 +2520,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfGlobalOvfCtrl(PVMCPU pVCpu, uin
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfFixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7UncPerfFixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo uncore msrs.  */
     *puValue = 0;
@@ -2516,7 +2529,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfFixedCtrCtrl(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfFixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7UncPerfFixedCtrCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo uncore msrs.  */
     return VINF_SUCCESS;
@@ -2524,7 +2537,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfFixedCtrCtrl(PVMCPU pVCpu, uint
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfFixedCtr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7UncPerfFixedCtr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo uncore msrs.  */
     *puValue = 0;
@@ -2533,7 +2546,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7UncPerfFixedCtr(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfFixedCtr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7UncPerfFixedCtr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo uncore msrs.  */
     return VINF_SUCCESS;
@@ -2541,7 +2554,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7UncPerfFixedCtr(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7UncCBoxConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7UncCBoxConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo uncore msrs.  */
     *puValue = 0;
@@ -2550,7 +2563,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7UncCBoxConfig(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7UncArbPerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7UncArbPerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo uncore msrs.  */
     *puValue = 0;
@@ -2559,7 +2572,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7UncArbPerfCtrN(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7UncArbPerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7UncArbPerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo uncore msrs.  */
     return VINF_SUCCESS;
@@ -2567,7 +2580,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7UncArbPerfCtrN(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelI7UncArbPerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelI7UncArbPerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo uncore msrs.  */
     *puValue = 0;
@@ -2576,7 +2589,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelI7UncArbPerfEvtSelN(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelI7UncArbPerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelI7UncArbPerfEvtSelN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo uncore msrs.  */
     return VINF_SUCCESS;
@@ -2584,7 +2597,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelI7UncArbPerfEvtSelN(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelCore2EmttmCrTablesN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelCore2EmttmCrTablesN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement enhanced multi thread termal monitoring? */
     *puValue = pRange->uValue;
@@ -2593,7 +2606,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelCore2EmttmCrTablesN(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelCore2EmttmCrTablesN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelCore2EmttmCrTablesN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement enhanced multi thread termal monitoring? */
     return VINF_SUCCESS;
@@ -2601,7 +2614,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelCore2EmttmCrTablesN(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelCore2SmmCStMiscInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelCore2SmmCStMiscInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo SMM & C-states? */
     *puValue = 0;
@@ -2610,7 +2623,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelCore2SmmCStMiscInfo(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelCore2SmmCStMiscInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelCore2SmmCStMiscInfo(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo SMM & C-states? */
     return VINF_SUCCESS;
@@ -2618,7 +2631,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelCore2SmmCStMiscInfo(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelCore1ExtConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelCore1ExtConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Core1&2 EXT_CONFIG (whatever that is)? */
     *puValue = 0;
@@ -2627,7 +2640,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelCore1ExtConfig(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelCore1ExtConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelCore1ExtConfig(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Core1&2 EXT_CONFIG (whatever that is)? */
     return VINF_SUCCESS;
@@ -2635,7 +2648,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelCore1ExtConfig(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelCore1DtsCalControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelCore1DtsCalControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Core1&2(?) DTS_CAL_CTRL (whatever that is)? */
     *puValue = 0;
@@ -2644,7 +2657,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelCore1DtsCalControl(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelCore1DtsCalControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelCore1DtsCalControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Core1&2(?) DTS_CAL_CTRL (whatever that is)? */
     return VINF_SUCCESS;
@@ -2652,7 +2665,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelCore1DtsCalControl(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_IntelCore2PeciControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_IntelCore2PeciControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Core2+ platform environment control interface control register? */
     *puValue = 0;
@@ -2661,7 +2674,7 @@ static DECLCALLBACK(int) cpumMsrRd_IntelCore2PeciControl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_IntelCore2PeciControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_IntelCore2PeciControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Core2+ platform environment control interface control register? */
     return VINF_SUCCESS;
@@ -2680,7 +2693,7 @@ static DECLCALLBACK(int) cpumMsrWr_IntelCore2PeciControl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_P6LastBranchFromIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_P6LastBranchFromIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /* AMD seems to just record RIP, while intel claims to record RIP+CS.BASE
        if I read the docs correctly, thus the need for separate functions. */
@@ -2691,7 +2704,7 @@ static DECLCALLBACK(int) cpumMsrRd_P6LastBranchFromIp(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_P6LastBranchToIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_P6LastBranchToIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement last branch records. */
     *puValue = 0;
@@ -2700,7 +2713,7 @@ static DECLCALLBACK(int) cpumMsrRd_P6LastBranchToIp(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_P6LastIntFromIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_P6LastIntFromIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement last exception records. */
     *puValue = 0;
@@ -2709,7 +2722,7 @@ static DECLCALLBACK(int) cpumMsrRd_P6LastIntFromIp(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_P6LastIntFromIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_P6LastIntFromIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement last exception records. */
     /* Note! On many CPUs, the high bit of the 0x000001dd register is always writable, even when the result is
@@ -2719,7 +2732,7 @@ static DECLCALLBACK(int) cpumMsrWr_P6LastIntFromIp(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_P6LastIntToIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_P6LastIntToIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo implement last exception records. */
     *puValue = 0;
@@ -2728,7 +2741,7 @@ static DECLCALLBACK(int) cpumMsrRd_P6LastIntToIp(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_P6LastIntToIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_P6LastIntToIp(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo implement last exception records. */
     return VINF_SUCCESS;
@@ -2744,7 +2757,7 @@ static DECLCALLBACK(int) cpumMsrWr_P6LastIntToIp(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hTscRate(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hTscRate(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Implement TscRateMsr */
     *puValue = RT_MAKE_U64(0, 1); /* 1.0 = reset value. */
@@ -2753,7 +2766,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hTscRate(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hTscRate(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hTscRate(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Implement TscRateMsr */
     return VINF_SUCCESS;
@@ -2761,7 +2774,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hTscRate(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hLwpCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hLwpCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Implement AMD LWP? (Instructions: LWPINS, LWPVAL, LLWPCB, SLWPCB) */
     /* Note: Only listes in BKDG for Family 15H. */
@@ -2771,7 +2784,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hLwpCfg(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hLwpCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hLwpCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Implement AMD LWP? (Instructions: LWPINS, LWPVAL, LLWPCB, SLWPCB) */
     return VINF_SUCCESS;
@@ -2779,7 +2792,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hLwpCfg(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hLwpCbAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hLwpCbAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Implement AMD LWP? (Instructions: LWPINS, LWPVAL, LLWPCB, SLWPCB) */
     /* Note: Only listes in BKDG for Family 15H. */
@@ -2789,7 +2802,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hLwpCbAddr(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hLwpCbAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hLwpCbAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Implement AMD LWP? (Instructions: LWPINS, LWPVAL, LLWPCB, SLWPCB) */
     return VINF_SUCCESS;
@@ -2797,7 +2810,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hLwpCbAddr(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hMc4MiscN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hMc4MiscN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo machine check. */
     *puValue = 0;
@@ -2806,7 +2819,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hMc4MiscN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hMc4MiscN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hMc4MiscN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo machine check. */
     return VINF_SUCCESS;
@@ -2814,7 +2827,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hMc4MiscN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8PerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8PerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD performance events. */
     *puValue = 0;
@@ -2823,7 +2836,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8PerfCtlN(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8PerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8PerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD performance events. */
     return VINF_SUCCESS;
@@ -2831,7 +2844,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8PerfCtlN(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8PerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8PerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD performance events. */
     *puValue = 0;
@@ -2840,7 +2853,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8PerfCtrN(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8PerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8PerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD performance events. */
     return VINF_SUCCESS;
@@ -2848,7 +2861,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8PerfCtrN(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SysCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SysCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SYS_CFG */
     *puValue = pRange->uValue;
@@ -2857,7 +2870,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SysCfg(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SysCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SysCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SYS_CFG */
     return VINF_SUCCESS;
@@ -2865,7 +2878,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SysCfg(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8HwCr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8HwCr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD HW_CFG */
     *puValue = 0;
@@ -2874,7 +2887,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8HwCr(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8HwCr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8HwCr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD HW_CFG */
     return VINF_SUCCESS;
@@ -2882,7 +2895,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8HwCr(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8IorrBaseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8IorrBaseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IorrMask/IorrBase */
     *puValue = 0;
@@ -2891,7 +2904,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8IorrBaseN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8IorrBaseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8IorrBaseN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IorrMask/IorrBase */
     return VINF_SUCCESS;
@@ -2899,7 +2912,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8IorrBaseN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8IorrMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8IorrMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IorrMask/IorrBase */
     *puValue = 0;
@@ -2908,7 +2921,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8IorrMaskN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8IorrMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8IorrMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IorrMask/IorrBase */
     return VINF_SUCCESS;
@@ -2916,7 +2929,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8IorrMaskN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8TopOfMemN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8TopOfMemN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     *puValue = 0;
     /** @todo return 4GB - RamHoleSize here for TOPMEM. Figure out what to return
@@ -2928,7 +2941,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8TopOfMemN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8TopOfMemN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8TopOfMemN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD TOPMEM and TOPMEM2/TOM2. */
     return VINF_SUCCESS;
@@ -2936,7 +2949,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8TopOfMemN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8NbCfg1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8NbCfg1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD NB_CFG1 */
     *puValue = 0;
@@ -2945,7 +2958,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8NbCfg1(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8NbCfg1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8NbCfg1(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD NB_CFG1 */
     return VINF_SUCCESS;
@@ -2953,7 +2966,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8NbCfg1(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8McXcptRedir(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8McXcptRedir(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo machine check. */
     *puValue = 0;
@@ -2962,7 +2975,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8McXcptRedir(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8McXcptRedir(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8McXcptRedir(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo machine check. */
     return VINF_SUCCESS;
@@ -2970,9 +2983,9 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8McXcptRedir(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuNameN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8CpuNameN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
-    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), pRange->uValue / 2 + 0x80000001, 0);
+    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), pRange->uValue / 2 + 0x80000001);
     if (pLeaf)
     {
         if (!(pRange->uValue & 1))
@@ -2987,7 +3000,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuNameN(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuNameN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8CpuNameN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Remember guest programmed CPU name. */
     return VINF_SUCCESS;
@@ -2995,7 +3008,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuNameN(PVMCPU pVCpu, uint32_t idMsr, P
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8HwThermalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8HwThermalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD HTC. */
     *puValue = pRange->uValue;
@@ -3004,7 +3017,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8HwThermalCtrl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8HwThermalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8HwThermalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD HTC. */
     return VINF_SUCCESS;
@@ -3012,7 +3025,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8HwThermalCtrl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SwThermalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SwThermalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD STC. */
     *puValue = 0;
@@ -3021,7 +3034,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SwThermalCtrl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SwThermalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SwThermalCtrl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD STC. */
     return VINF_SUCCESS;
@@ -3029,7 +3042,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SwThermalCtrl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8FidVidControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8FidVidControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD FIDVID_CTL. */
     *puValue = pRange->uValue;
@@ -3038,7 +3051,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8FidVidControl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8FidVidControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8FidVidControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD FIDVID_CTL. */
     return VINF_SUCCESS;
@@ -3046,7 +3059,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8FidVidControl(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8FidVidStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8FidVidStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD FIDVID_STATUS. */
     *puValue = pRange->uValue;
@@ -3055,7 +3068,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8FidVidStatus(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8McCtlMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8McCtlMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD MC. */
     *puValue = 0;
@@ -3064,7 +3077,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8McCtlMaskN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8McCtlMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8McCtlMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD MC. */
     return VINF_SUCCESS;
@@ -3072,7 +3085,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8McCtlMaskN(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SmiOnIoTrapN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SmiOnIoTrapN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM/SMI and I/O trap. */
     *puValue = 0;
@@ -3081,7 +3094,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SmiOnIoTrapN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SmiOnIoTrapN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SmiOnIoTrapN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM/SMI and I/O trap. */
     return VINF_SUCCESS;
@@ -3089,7 +3102,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SmiOnIoTrapN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SmiOnIoTrapCtlSts(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SmiOnIoTrapCtlSts(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM/SMI and I/O trap. */
     *puValue = 0;
@@ -3098,7 +3111,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SmiOnIoTrapCtlSts(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SmiOnIoTrapCtlSts(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SmiOnIoTrapCtlSts(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM/SMI and I/O trap. */
     return VINF_SUCCESS;
@@ -3106,7 +3119,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SmiOnIoTrapCtlSts(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8IntPendingMessage(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8IntPendingMessage(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Interrupt pending message. */
     *puValue = 0;
@@ -3115,7 +3128,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8IntPendingMessage(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8IntPendingMessage(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8IntPendingMessage(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Interrupt pending message. */
     return VINF_SUCCESS;
@@ -3123,7 +3136,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8IntPendingMessage(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SmiTriggerIoCycle(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SmiTriggerIoCycle(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM/SMI and trigger I/O cycle. */
     *puValue = 0;
@@ -3132,7 +3145,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SmiTriggerIoCycle(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SmiTriggerIoCycle(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SmiTriggerIoCycle(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM/SMI and trigger I/O cycle. */
     return VINF_SUCCESS;
@@ -3140,7 +3153,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SmiTriggerIoCycle(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hMmioCfgBaseAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hMmioCfgBaseAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD MMIO Configuration base address. */
     *puValue = 0;
@@ -3149,7 +3162,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hMmioCfgBaseAddr(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hMmioCfgBaseAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hMmioCfgBaseAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD MMIO Configuration base address. */
     return VINF_SUCCESS;
@@ -3157,7 +3170,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hMmioCfgBaseAddr(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hTrapCtlMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hTrapCtlMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD 0xc0010059. */
     *puValue = 0;
@@ -3166,7 +3179,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hTrapCtlMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hTrapCtlMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hTrapCtlMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD 0xc0010059. */
     return VINF_SUCCESS;
@@ -3174,7 +3187,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hTrapCtlMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hPStateCurLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hPStateCurLimit(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD P-states. */
     *puValue = pRange->uValue;
@@ -3183,7 +3196,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hPStateCurLimit(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hPStateControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hPStateControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD P-states. */
     *puValue = pRange->uValue;
@@ -3192,7 +3205,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hPStateControl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hPStateControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hPStateControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD P-states. */
     return VINF_SUCCESS;
@@ -3200,7 +3213,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hPStateControl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hPStateStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hPStateStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD P-states. */
     *puValue = pRange->uValue;
@@ -3209,7 +3222,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hPStateStatus(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hPStateStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hPStateStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD P-states. */
     return VINF_SUCCESS;
@@ -3217,7 +3230,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hPStateStatus(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hPStateN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hPStateN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD P-states. */
     *puValue = pRange->uValue;
@@ -3226,7 +3239,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hPStateN(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hPStateN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hPStateN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD P-states. */
     return VINF_SUCCESS;
@@ -3234,7 +3247,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hPStateN(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hCofVidControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hCofVidControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD P-states. */
     *puValue = pRange->uValue;
@@ -3243,7 +3256,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hCofVidControl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hCofVidControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hCofVidControl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD P-states. */
     return VINF_SUCCESS;
@@ -3251,7 +3264,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hCofVidControl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hCofVidStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hCofVidStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD P-states. */
     *puValue = pRange->uValue;
@@ -3260,7 +3273,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hCofVidStatus(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hCofVidStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hCofVidStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /* Note! Writing 0 seems to not GP, not sure if it does anything to the value... */
     /** @todo AMD P-states. */
@@ -3269,7 +3282,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hCofVidStatus(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hCStateIoBaseAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hCStateIoBaseAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD C-states. */
     *puValue = 0;
@@ -3278,7 +3291,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hCStateIoBaseAddr(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hCStateIoBaseAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hCStateIoBaseAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD C-states. */
     return VINF_SUCCESS;
@@ -3286,7 +3299,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hCStateIoBaseAddr(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hCpuWatchdogTimer(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hCpuWatchdogTimer(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD machine checks. */
     *puValue = 0;
@@ -3295,7 +3308,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hCpuWatchdogTimer(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hCpuWatchdogTimer(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hCpuWatchdogTimer(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD machine checks. */
     return VINF_SUCCESS;
@@ -3303,7 +3316,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hCpuWatchdogTimer(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SmmBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SmmBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM. */
     *puValue = 0;
@@ -3312,7 +3325,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SmmBase(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SmmBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SmmBase(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM. */
     return VINF_SUCCESS;
@@ -3320,7 +3333,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SmmBase(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SmmAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SmmAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM. */
     *puValue = 0;
@@ -3329,7 +3342,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SmmAddr(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SmmAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SmmAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM. */
     return VINF_SUCCESS;
@@ -3338,7 +3351,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SmmAddr(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SmmMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SmmMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM. */
     *puValue = 0;
@@ -3347,7 +3360,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SmmMask(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SmmMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SmmMask(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM. */
     return VINF_SUCCESS;
@@ -3355,7 +3368,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SmmMask(PVMCPU pVCpu, uint32_t idMsr, PC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8VmCr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8VmCr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SVM. */
     *puValue = 0;
@@ -3364,7 +3377,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8VmCr(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8VmCr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8VmCr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SVM. */
     return VINF_SUCCESS;
@@ -3372,7 +3385,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8VmCr(PVMCPU pVCpu, uint32_t idMsr, PCCPU
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8IgnNe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8IgnNe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IGNNE\# control. */
     *puValue = 0;
@@ -3381,7 +3394,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8IgnNe(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8IgnNe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8IgnNe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IGNNE\# control. */
     return VINF_SUCCESS;
@@ -3389,7 +3402,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8IgnNe(PVMCPU pVCpu, uint32_t idMsr, PCCP
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8SmmCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8SmmCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM. */
     *puValue = 0;
@@ -3398,7 +3411,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8SmmCtl(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8SmmCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8SmmCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM. */
     return VINF_SUCCESS;
@@ -3406,7 +3419,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8SmmCtl(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8VmHSavePa(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8VmHSavePa(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SVM. */
     *puValue = 0;
@@ -3415,7 +3428,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8VmHSavePa(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8VmHSavePa(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8VmHSavePa(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SVM. */
     return VINF_SUCCESS;
@@ -3423,7 +3436,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8VmHSavePa(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hVmLockKey(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hVmLockKey(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SVM. */
     *puValue = 0; /* RAZ */
@@ -3432,7 +3445,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hVmLockKey(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hVmLockKey(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hVmLockKey(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SVM. */
     return VINF_SUCCESS;
@@ -3440,7 +3453,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hVmLockKey(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hSmmLockKey(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hSmmLockKey(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM. */
     *puValue = 0; /* RAZ */
@@ -3449,7 +3462,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hSmmLockKey(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hSmmLockKey(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hSmmLockKey(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM. */
     return VINF_SUCCESS;
@@ -3457,7 +3470,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hSmmLockKey(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hLocalSmiStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hLocalSmiStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD SMM/SMI. */
     *puValue = 0;
@@ -3466,7 +3479,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hLocalSmiStatus(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hLocalSmiStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hLocalSmiStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD SMM/SMI. */
     return VINF_SUCCESS;
@@ -3474,7 +3487,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hLocalSmiStatus(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hOsVisWrkIdLength(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hOsVisWrkIdLength(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD OS visible workaround. */
     *puValue = pRange->uValue;
@@ -3483,7 +3496,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hOsVisWrkIdLength(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hOsVisWrkIdLength(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hOsVisWrkIdLength(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD OS visible workaround. */
     return VINF_SUCCESS;
@@ -3491,7 +3504,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hOsVisWrkIdLength(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hOsVisWrkStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hOsVisWrkStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD OS visible workaround. */
     *puValue = 0;
@@ -3500,7 +3513,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hOsVisWrkStatus(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hOsVisWrkStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hOsVisWrkStatus(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD OS visible workaround. */
     return VINF_SUCCESS;
@@ -3508,7 +3521,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hOsVisWrkStatus(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam16hL2IPerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam16hL2IPerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD L2I performance counters. */
     *puValue = 0;
@@ -3517,7 +3530,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam16hL2IPerfCtlN(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam16hL2IPerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam16hL2IPerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD L2I performance counters. */
     return VINF_SUCCESS;
@@ -3525,7 +3538,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam16hL2IPerfCtlN(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam16hL2IPerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam16hL2IPerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD L2I performance counters. */
     *puValue = 0;
@@ -3534,7 +3547,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam16hL2IPerfCtrN(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam16hL2IPerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam16hL2IPerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD L2I performance counters. */
     return VINF_SUCCESS;
@@ -3542,7 +3555,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam16hL2IPerfCtrN(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hNorthbridgePerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hNorthbridgePerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD Northbridge performance counters. */
     *puValue = 0;
@@ -3551,7 +3564,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hNorthbridgePerfCtlN(PVMCPU pVCpu, ui
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hNorthbridgePerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hNorthbridgePerfCtlN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD Northbridge performance counters. */
     return VINF_SUCCESS;
@@ -3559,7 +3572,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hNorthbridgePerfCtlN(PVMCPU pVCpu, ui
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hNorthbridgePerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hNorthbridgePerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD Northbridge performance counters. */
     *puValue = 0;
@@ -3568,7 +3581,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hNorthbridgePerfCtrN(PVMCPU pVCpu, ui
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hNorthbridgePerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hNorthbridgePerfCtrN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD Northbridge performance counters. */
     return VINF_SUCCESS;
@@ -3576,7 +3589,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hNorthbridgePerfCtrN(PVMCPU pVCpu, ui
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7MicrocodeCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7MicrocodeCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus. Need to be explored and verify K7 presence. */
@@ -3587,7 +3600,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7MicrocodeCtl(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7MicrocodeCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7MicrocodeCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3597,7 +3610,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7MicrocodeCtl(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7ClusterIdMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7ClusterIdMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus. Need to be explored and verify K7 presence. */
@@ -3609,7 +3622,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7ClusterIdMaybe(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7ClusterIdMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7ClusterIdMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3620,9 +3633,10 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7ClusterIdMaybe(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuIdCtlStd07hEbax(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8CpuIdCtlStd07hEbax(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
-    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), 0x00000007, 0);
+    bool           fIgnored;
+    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeafEx(pVCpu->CTX_SUFF(pVM), 0x00000007, 0, &fIgnored);
     if (pLeaf)
         *puValue = RT_MAKE_U64(pLeaf->uEbx, pLeaf->uEax);
     else
@@ -3632,7 +3646,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuIdCtlStd07hEbax(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuIdCtlStd07hEbax(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8CpuIdCtlStd07hEbax(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Changing CPUID leaf 7/0. */
     return VINF_SUCCESS;
@@ -3640,9 +3654,9 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuIdCtlStd07hEbax(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuIdCtlStd06hEcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8CpuIdCtlStd06hEcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
-    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), 0x00000006, 0);
+    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), 0x00000006);
     if (pLeaf)
         *puValue = pLeaf->uEcx;
     else
@@ -3652,7 +3666,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuIdCtlStd06hEcx(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuIdCtlStd06hEcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8CpuIdCtlStd06hEcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Changing CPUID leaf 6. */
     return VINF_SUCCESS;
@@ -3660,9 +3674,9 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuIdCtlStd06hEcx(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuIdCtlStd01hEdcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8CpuIdCtlStd01hEdcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
-    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), 0x00000001, 0);
+    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), 0x00000001);
     if (pLeaf)
         *puValue = RT_MAKE_U64(pLeaf->uEdx, pLeaf->uEcx);
     else
@@ -3672,7 +3686,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuIdCtlStd01hEdcx(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuIdCtlStd01hEdcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8CpuIdCtlStd01hEdcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Changing CPUID leaf 0x80000001. */
     return VINF_SUCCESS;
@@ -3680,9 +3694,9 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuIdCtlStd01hEdcx(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuIdCtlExt01hEdcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8CpuIdCtlExt01hEdcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
-    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), 0x80000001, 0);
+    PCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeaf(pVCpu->CTX_SUFF(pVM), 0x80000001);
     if (pLeaf)
         *puValue = RT_MAKE_U64(pLeaf->uEdx, pLeaf->uEcx);
     else
@@ -3692,7 +3706,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8CpuIdCtlExt01hEdcx(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuIdCtlExt01hEdcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8CpuIdCtlExt01hEdcx(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Changing CPUID leaf 0x80000001. */
     return VINF_SUCCESS;
@@ -3700,7 +3714,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8CpuIdCtlExt01hEdcx(PVMCPU pVCpu, uint32_
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK8PatchLevel(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK8PatchLevel(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Fake AMD microcode patching.  */
     *puValue = pRange->uValue;
@@ -3709,7 +3723,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK8PatchLevel(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK8PatchLoader(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK8PatchLoader(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Fake AMD microcode patching.  */
     return VINF_SUCCESS;
@@ -3717,7 +3731,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK8PatchLoader(PVMCPU pVCpu, uint32_t idMsr
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7DebugStatusMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7DebugStatusMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3728,7 +3742,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7DebugStatusMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7DebugStatusMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7DebugStatusMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3738,7 +3752,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7DebugStatusMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7BHTraceBaseMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7BHTraceBaseMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3749,7 +3763,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7BHTraceBaseMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7BHTraceBaseMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7BHTraceBaseMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3759,7 +3773,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7BHTraceBaseMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7BHTracePtrMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7BHTracePtrMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3770,7 +3784,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7BHTracePtrMaybe(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7BHTracePtrMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7BHTracePtrMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3780,7 +3794,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7BHTracePtrMaybe(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7BHTraceLimitMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7BHTraceLimitMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3791,7 +3805,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7BHTraceLimitMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7BHTraceLimitMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7BHTraceLimitMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3801,7 +3815,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7BHTraceLimitMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7HardwareDebugToolCfgMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7HardwareDebugToolCfgMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3812,7 +3826,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7HardwareDebugToolCfgMaybe(PVMCPU pVCpu,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7HardwareDebugToolCfgMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7HardwareDebugToolCfgMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3822,7 +3836,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7HardwareDebugToolCfgMaybe(PVMCPU pVCpu,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7FastFlushCountMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7FastFlushCountMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3833,7 +3847,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7FastFlushCountMaybe(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7FastFlushCountMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7FastFlushCountMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3843,7 +3857,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7FastFlushCountMaybe(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7NodeId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7NodeId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3854,7 +3868,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7NodeId(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7NodeId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7NodeId(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3864,7 +3878,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7NodeId(PVMCPU pVCpu, uint32_t idMsr, PCC
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7DrXAddrMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7DrXAddrMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3875,7 +3889,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7DrXAddrMaskN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7DrXAddrMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7DrXAddrMaskN(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3885,7 +3899,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7DrXAddrMaskN(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7Dr0DataMatchMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7Dr0DataMatchMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3896,7 +3910,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7Dr0DataMatchMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7Dr0DataMatchMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7Dr0DataMatchMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3906,7 +3920,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7Dr0DataMatchMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7Dr0DataMaskMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7Dr0DataMaskMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3917,7 +3931,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7Dr0DataMaskMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7Dr0DataMaskMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7Dr0DataMaskMaybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3927,7 +3941,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7Dr0DataMaskMaybe(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7LoadStoreCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7LoadStoreCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3938,7 +3952,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7LoadStoreCfg(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7LoadStoreCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7LoadStoreCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3948,7 +3962,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7LoadStoreCfg(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7InstrCacheCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7InstrCacheCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3959,7 +3973,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7InstrCacheCfg(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7InstrCacheCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7InstrCacheCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3969,7 +3983,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7InstrCacheCfg(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7DataCacheCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7DataCacheCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3980,7 +3994,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7DataCacheCfg(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7DataCacheCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7DataCacheCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -3990,7 +4004,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7DataCacheCfg(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7BusUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7BusUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -4001,7 +4015,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7BusUnitCfg(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7BusUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7BusUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -4011,7 +4025,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7BusUnitCfg(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdK7DebugCtl2Maybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdK7DebugCtl2Maybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -4022,7 +4036,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdK7DebugCtl2Maybe(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdK7DebugCtl2Maybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdK7DebugCtl2Maybe(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo Allegedly requiring edi=0x9c5a203a when execuing rdmsr/wrmsr on older
      *  cpus.  Need to be explored and verify K7 presence.  */
@@ -4032,7 +4046,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdK7DebugCtl2Maybe(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hFpuCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hFpuCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD FPU config. */
     *puValue = 0;
@@ -4041,7 +4055,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hFpuCfg(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hFpuCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hFpuCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD FPU config. */
     return VINF_SUCCESS;
@@ -4049,7 +4063,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hFpuCfg(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hDecoderCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hDecoderCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD decoder config. */
     *puValue = 0;
@@ -4058,7 +4072,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hDecoderCfg(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hDecoderCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hDecoderCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD decoder config. */
     return VINF_SUCCESS;
@@ -4066,7 +4080,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hDecoderCfg(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hBusUnitCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hBusUnitCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /* Note! 10h and 16h */
     /** @todo AMD bus unit  config. */
@@ -4076,7 +4090,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hBusUnitCfg2(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hBusUnitCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hBusUnitCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /* Note! 10h and 16h */
     /** @todo AMD bus unit config. */
@@ -4085,7 +4099,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hBusUnitCfg2(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hCombUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hCombUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD unit config. */
     *puValue = 0;
@@ -4094,7 +4108,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hCombUnitCfg(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hCombUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hCombUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD unit config. */
     return VINF_SUCCESS;
@@ -4102,7 +4116,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hCombUnitCfg(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hCombUnitCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hCombUnitCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD unit config 2. */
     *puValue = 0;
@@ -4111,7 +4125,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hCombUnitCfg2(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hCombUnitCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hCombUnitCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD unit config 2. */
     return VINF_SUCCESS;
@@ -4119,7 +4133,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hCombUnitCfg2(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hCombUnitCfg3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hCombUnitCfg3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD combined unit config 3. */
     *puValue = 0;
@@ -4128,7 +4142,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hCombUnitCfg3(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hCombUnitCfg3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hCombUnitCfg3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD combined unit config 3. */
     return VINF_SUCCESS;
@@ -4136,7 +4150,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hCombUnitCfg3(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hExecUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hExecUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD execution unit config. */
     *puValue = 0;
@@ -4145,7 +4159,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hExecUnitCfg(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hExecUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hExecUnitCfg(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD execution unit config. */
     return VINF_SUCCESS;
@@ -4153,7 +4167,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hExecUnitCfg(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam15hLoadStoreCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam15hLoadStoreCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD load-store config 2. */
     *puValue = 0;
@@ -4162,7 +4176,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam15hLoadStoreCfg2(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam15hLoadStoreCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam15hLoadStoreCfg2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD load-store config 2. */
     return VINF_SUCCESS;
@@ -4170,7 +4184,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam15hLoadStoreCfg2(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsFetchCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsFetchCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4179,7 +4193,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsFetchCtl(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsFetchCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsFetchCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4187,7 +4201,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsFetchCtl(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsFetchLinAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsFetchLinAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4196,7 +4210,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsFetchLinAddr(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsFetchLinAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsFetchLinAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4204,7 +4218,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsFetchLinAddr(PVMCPU pVCpu, uint32
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsFetchPhysAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsFetchPhysAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4213,7 +4227,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsFetchPhysAddr(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsFetchPhysAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsFetchPhysAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4221,7 +4235,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsFetchPhysAddr(PVMCPU pVCpu, uint3
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpExecCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsOpExecCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4230,7 +4244,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpExecCtl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpExecCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsOpExecCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4238,7 +4252,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpExecCtl(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpRip(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsOpRip(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4247,7 +4261,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpRip(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpRip(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsOpRip(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     if (!X86_IS_CANONICAL(uValue))
@@ -4260,7 +4274,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpRip(PVMCPU pVCpu, uint32_t idMs
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpData(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsOpData(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4269,7 +4283,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpData(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpData(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsOpData(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4277,7 +4291,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpData(PVMCPU pVCpu, uint32_t idM
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpData2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsOpData2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4286,7 +4300,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpData2(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpData2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsOpData2(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4294,7 +4308,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpData2(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpData3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsOpData3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4303,7 +4317,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsOpData3(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpData3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsOpData3(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4311,7 +4325,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsOpData3(PVMCPU pVCpu, uint32_t id
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsDcLinAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsDcLinAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4320,7 +4334,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsDcLinAddr(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsDcLinAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsDcLinAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     if (!X86_IS_CANONICAL(uValue))
@@ -4333,7 +4347,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsDcLinAddr(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsDcPhysAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsDcPhysAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4342,7 +4356,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsDcPhysAddr(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsDcPhysAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsDcPhysAddr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4350,7 +4364,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsDcPhysAddr(PVMCPU pVCpu, uint32_t
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam10hIbsCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4359,7 +4373,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam10hIbsCtl(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam10hIbsCtl(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     return VINF_SUCCESS;
@@ -4367,7 +4381,7 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam10hIbsCtl(PVMCPU pVCpu, uint32_t idMsr,
 
 
 /** @callback_method_impl{FNCPUMRDMSR} */
-static DECLCALLBACK(int) cpumMsrRd_AmdFam14hIbsBrTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_AmdFam14hIbsBrTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
 {
     /** @todo AMD IBS. */
     *puValue = 0;
@@ -4376,7 +4390,7 @@ static DECLCALLBACK(int) cpumMsrRd_AmdFam14hIbsBrTarget(PVMCPU pVCpu, uint32_t i
 
 
 /** @callback_method_impl{FNCPUMWRMSR} */
-static DECLCALLBACK(int) cpumMsrWr_AmdFam14hIbsBrTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_AmdFam14hIbsBrTarget(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
 {
     /** @todo AMD IBS. */
     if (!X86_IS_CANONICAL(uValue))
@@ -4389,6 +4403,27 @@ static DECLCALLBACK(int) cpumMsrWr_AmdFam14hIbsBrTarget(PVMCPU pVCpu, uint32_t i
 
 
 
+/*
+ * GIM MSRs.
+ * GIM MSRs.
+ * GIM MSRs.
+ */
+
+
+/** @callback_method_impl{FNCPUMRDMSR} */
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrRd_Gim(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+{
+    return GIMReadMsr(pVCpu, idMsr, pRange, puValue);
+}
+
+
+/** @callback_method_impl{FNCPUMWRMSR} */
+static DECLCALLBACK(VBOXSTRICTRC) cpumMsrWr_Gim(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+{
+    return GIMWriteMsr(pVCpu, idMsr, pRange, uValue, uRawValue);
+}
+
+
 /**
  * MSR read function table.
  */
@@ -4645,6 +4680,8 @@ static const PFNCPUMRDMSR g_aCpumRdMsrFns[kCpumMsrRdFn_End] =
     cpumMsrRd_AmdFam10hIbsDcPhysAddr,
     cpumMsrRd_AmdFam10hIbsCtl,
     cpumMsrRd_AmdFam14hIbsBrTarget,
+
+    cpumMsrRd_Gim
 };
 
 
@@ -4859,6 +4896,8 @@ static const PFNCPUMWRMSR g_aCpumWrMsrFns[kCpumMsrWrFn_End] =
     cpumMsrWr_AmdFam10hIbsDcPhysAddr,
     cpumMsrWr_AmdFam10hIbsCtl,
     cpumMsrWr_AmdFam14hIbsBrTarget,
+
+    cpumMsrWr_Gim
 };
 
 
@@ -4927,7 +4966,6 @@ PCPUMMSRRANGE cpumLookupMsrRange(PVM pVM, uint32_t idMsr)
     return NULL;
 }
 
-#ifdef VBOX_WITH_NEW_MSR_CODE
 
 /**
  * Query a guest MSR.
@@ -4936,6 +4974,8 @@ PCPUMMSRRANGE cpumLookupMsrRange(PVM pVM, uint32_t idMsr)
  * a RDMSR instruction.  We'll do the rest.
  *
  * @retval  VINF_SUCCESS on success.
+ * @retval  VINF_CPUM_R3_MSR_READ if the MSR read could not be serviced in the
+ *          current context (raw-mode or ring-0).
  * @retval  VERR_CPUM_RAISE_GP_0 on failure (invalid MSR), the caller is
  *          expected to take the appropriate actions. @a *puValue is set to 0.
  * @param   pVCpu               Pointer to the VMCPU.
@@ -4945,11 +4985,11 @@ PCPUMMSRRANGE cpumLookupMsrRange(PVM pVM, uint32_t idMsr)
  * @remarks This will always return the right values, even when we're in the
  *          recompiler.
  */
-VMMDECL(int) CPUMQueryGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue)
+VMMDECL(VBOXSTRICTRC) CPUMQueryGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue)
 {
     *puValue = 0;
 
-    int             rc;
+    VBOXSTRICTRC    rcStrict;
     PVM             pVM    = pVCpu->CTX_SUFF(pVM);
     PCPUMMSRRANGE   pRange = cpumLookupMsrRange(pVM, idMsr);
     if (pRange)
@@ -4963,29 +5003,35 @@ VMMDECL(int) CPUMQueryGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue)
         STAM_COUNTER_INC(&pRange->cReads);
         STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrReads);
 
-        rc = pfnRdMsr(pVCpu, idMsr, pRange, puValue);
-        if (RT_SUCCESS(rc))
-        {
+        rcStrict = pfnRdMsr(pVCpu, idMsr, pRange, puValue);
+        if (rcStrict == VINF_SUCCESS)
             Log2(("CPUM: RDMSR %#x (%s) -> %#llx\n", idMsr, pRange->szName, *puValue));
-            AssertMsg(rc == VINF_SUCCESS, ("%Rrc idMsr=%#x\n", rc, idMsr));
-        }
-        else if (rc == VERR_CPUM_RAISE_GP_0)
+        else if (rcStrict == VERR_CPUM_RAISE_GP_0)
         {
             Log(("CPUM: RDMSR %#x (%s) -> #GP(0)\n", idMsr, pRange->szName));
             STAM_COUNTER_INC(&pRange->cGps);
             STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrReadsRaiseGp);
         }
+#ifndef IN_RING3
+        else if (rcStrict == VINF_CPUM_R3_MSR_READ)
+            Log(("CPUM: RDMSR %#x (%s) -> ring-3\n", idMsr, pRange->szName));
+#endif
         else
-            Log(("CPUM: RDMSR %#x (%s) -> rc=%Rrc\n", idMsr, pRange->szName, rc));
+        {
+            Log(("CPUM: RDMSR %#x (%s) -> rcStrict=%Rrc\n", idMsr, pRange->szName, VBOXSTRICTRC_VAL(rcStrict)));
+            AssertMsgStmt(RT_FAILURE_NP(rcStrict), ("%Rrc idMsr=%#x\n", VBOXSTRICTRC_VAL(rcStrict), idMsr),
+                          rcStrict = VERR_IPE_UNEXPECTED_INFO_STATUS);
+            Assert(rcStrict != VERR_EM_INTERPRETER);
+        }
     }
     else
     {
         Log(("CPUM: Unknown RDMSR %#x -> #GP(0)\n", idMsr));
         STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrReads);
         STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrReadsUnknown);
-        rc = VERR_CPUM_RAISE_GP_0;
+        rcStrict = VERR_CPUM_RAISE_GP_0;
     }
-    return rc;
+    return rcStrict;
 }
 
 
@@ -4996,6 +5042,8 @@ VMMDECL(int) CPUMQueryGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue)
  * a WRMSR instruction.  We'll do the rest.
  *
  * @retval  VINF_SUCCESS on success.
+ * @retval  VINF_CPUM_R3_MSR_WRITE if the MSR write could not be serviced in the
+ *          current context (raw-mode or ring-0).
  * @retval  VERR_CPUM_RAISE_GP_0 on failure, the caller is expected to take the
  *          appropriate actions.
  *
@@ -5011,9 +5059,9 @@ VMMDECL(int) CPUMQueryGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue)
  *          MSRs when in HM mode.  The code here and in HM must be aware of
  *          this.
  */
-VMMDECL(int) CPUMSetGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t uValue)
+VMMDECL(VBOXSTRICTRC) CPUMSetGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t uValue)
 {
-    int             rc;
+    VBOXSTRICTRC    rcStrict;
     PVM             pVM    = pVCpu->CTX_SUFF(pVM);
     PCPUMMSRRANGE   pRange = cpumLookupMsrRange(pVM, idMsr);
     if (pRange)
@@ -5036,20 +5084,27 @@ VMMDECL(int) CPUMSetGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t uValue)
                 STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrWritesToIgnoredBits);
             }
 
-            rc = pfnWrMsr(pVCpu, idMsr, pRange, uValueAdjusted, uValue);
-            if (RT_SUCCESS(rc))
-            {
+            rcStrict = pfnWrMsr(pVCpu, idMsr, pRange, uValueAdjusted, uValue);
+            if (rcStrict == VINF_SUCCESS)
                 Log2(("CPUM: WRMSR %#x (%s), %#llx [%#llx]\n", idMsr, pRange->szName, uValueAdjusted, uValue));
-                AssertMsg(rc == VINF_SUCCESS, ("%Rrc idMsr=%#x\n", rc, idMsr));
-            }
-            else if (rc == VERR_CPUM_RAISE_GP_0)
+            else if (rcStrict == VERR_CPUM_RAISE_GP_0)
             {
                 Log(("CPUM: WRMSR %#x (%s), %#llx [%#llx] -> #GP(0)\n", idMsr, pRange->szName, uValueAdjusted, uValue));
                 STAM_COUNTER_INC(&pRange->cGps);
                 STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrWritesRaiseGp);
             }
+#ifndef IN_RING3
+            else if (rcStrict == VINF_CPUM_R3_MSR_WRITE)
+                Log(("CPUM: WRMSR %#x (%s), %#llx [%#llx] -> ring-3\n", idMsr, pRange->szName, uValueAdjusted, uValue));
+#endif
             else
-                Log(("CPUM: WRMSR %#x (%s), %#llx [%#llx] -> rc=%Rrc\n", idMsr, pRange->szName, uValueAdjusted, uValue, rc));
+            {
+                Log(("CPUM: WRMSR %#x (%s), %#llx [%#llx] -> rcStrict=%Rrc\n",
+                     idMsr, pRange->szName, uValueAdjusted, uValue, VBOXSTRICTRC_VAL(rcStrict)));
+                AssertMsgStmt(RT_FAILURE_NP(rcStrict), ("%Rrc idMsr=%#x\n", VBOXSTRICTRC_VAL(rcStrict), idMsr),
+                              rcStrict = VERR_IPE_UNEXPECTED_INFO_STATUS);
+                Assert(rcStrict != VERR_EM_INTERPRETER);
+            }
         }
         else
         {
@@ -5057,7 +5112,7 @@ VMMDECL(int) CPUMSetGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t uValue)
                  idMsr, pRange->szName, uValue, uValue & pRange->fWrGpMask));
             STAM_COUNTER_INC(&pRange->cGps);
             STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrWritesRaiseGp);
-            rc = VERR_CPUM_RAISE_GP_0;
+            rcStrict = VERR_CPUM_RAISE_GP_0;
         }
     }
     else
@@ -5065,13 +5120,11 @@ VMMDECL(int) CPUMSetGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t uValue)
         Log(("CPUM: Unknown WRMSR %#x, %#llx -> #GP(0)\n", idMsr, uValue));
         STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrWrites);
         STAM_REL_COUNTER_INC(&pVM->cpum.s.cMsrWritesUnknown);
-        rc = VERR_CPUM_RAISE_GP_0;
+        rcStrict = VERR_CPUM_RAISE_GP_0;
     }
-    return rc;
+    return rcStrict;
 }
 
-#endif /* VBOX_WITH_NEW_MSR_CODE */
-
 
 #if defined(VBOX_STRICT) && defined(IN_RING3)
 /**
@@ -5336,6 +5389,8 @@ int cpumR3MsrStrictInitChecks(void)
     CPUM_ASSERT_RD_MSR_FN(AmdFam10hIbsCtl);
     CPUM_ASSERT_RD_MSR_FN(AmdFam14hIbsBrTarget);
 
+    CPUM_ASSERT_RD_MSR_FN(Gim)
+
     AssertReturn(g_aCpumWrMsrFns[kCpumMsrWrFn_Invalid] == NULL, VERR_CPUM_IPE_2);
     CPUM_ASSERT_WR_MSR_FN(Ia32P5McAddr);
     CPUM_ASSERT_WR_MSR_FN(Ia32P5McType);
@@ -5539,6 +5594,8 @@ int cpumR3MsrStrictInitChecks(void)
     CPUM_ASSERT_WR_MSR_FN(AmdFam10hIbsCtl);
     CPUM_ASSERT_WR_MSR_FN(AmdFam14hIbsBrTarget);
 
+    CPUM_ASSERT_WR_MSR_FN(Gim);
+
     return VINF_SUCCESS;
 }
 #endif /* VBOX_STRICT && IN_RING3 */
@@ -5592,3 +5649,4 @@ VMMR0_INT_DECL(void) CPUMR0SetGuestTscAux(PVMCPU pVCpu, uint64_t uValue)
 }
 
 #endif /* IN_RING0 */
+
diff --git a/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp b/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
index 8b59596..eb27500 100644
--- a/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
+++ b/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2014 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -49,6 +49,9 @@
 # pragma optimize("y", off)
 #endif
 
+AssertCompile2MemberOffsets(VM, cpum.s.HostFeatures,  cpum.ro.HostFeatures);
+AssertCompile2MemberOffsets(VM, cpum.s.GuestFeatures, cpum.ro.GuestFeatures);
+
 
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
@@ -741,12 +744,24 @@ VMMDECL(int) CPUMSetGuestCR3(PVMCPU pVCpu, uint64_t cr3)
 
 VMMDECL(int) CPUMSetGuestCR4(PVMCPU pVCpu, uint64_t cr4)
 {
-    if (    (cr4                     & (X86_CR4_PGE | X86_CR4_PAE | X86_CR4_PSE))
-        !=  (pVCpu->cpum.s.Guest.cr4 & (X86_CR4_PGE | X86_CR4_PAE | X86_CR4_PSE)))
+    /*
+     * The CR4.OSXSAVE bit is reflected in CPUID(1).ECX[27].
+     */
+    if (   (cr4                     & X86_CR4_OSXSAVE)
+        != (pVCpu->cpum.s.Guest.cr4 & X86_CR4_OSXSAVE) )
+    {
+        PVM pVM = pVCpu->CTX_SUFF(pVM);
+        if (cr4 & X86_CR4_OSXSAVE)
+            CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_OSXSAVE);
+        else
+            CPUMClearGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_OSXSAVE);
+    }
+
+    if (   (cr4                     & (X86_CR4_PGE | X86_CR4_PAE | X86_CR4_PSE))
+        != (pVCpu->cpum.s.Guest.cr4 & (X86_CR4_PGE | X86_CR4_PAE | X86_CR4_PSE)))
         pVCpu->cpum.s.fChanged |= CPUM_CHANGED_GLOBAL_TLB_FLUSH;
+
     pVCpu->cpum.s.fChanged |= CPUM_CHANGED_CR4;
-    if (!CPUMSupportsFXSR(pVCpu->CTX_SUFF(pVM)))
-        cr4 &= ~X86_CR4_OSFSXR;
     pVCpu->cpum.s.Guest.cr4 = cr4;
     return VINF_SUCCESS;
 }
@@ -869,728 +884,6 @@ VMMDECL(void) CPUMSetGuestEFER(PVMCPU pVCpu, uint64_t val)
     pVCpu->cpum.s.Guest.msrEFER = val;
 }
 
-#ifndef VBOX_WITH_NEW_MSR_CODE
-
-/**
- * Worker for CPUMQueryGuestMsr().
- *
- * @retval  VINF_SUCCESS
- * @retval  VERR_CPUM_RAISE_GP_0
- * @param   pVCpu               The cross context CPU structure.
- * @param   idMsr               The MSR to read.
- * @param   puValue             Where to store the return value.
- */
-static int cpumQueryGuestMsrInt(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue)
-{
-    /*
-     * If we don't indicate MSR support in the CPUID feature bits, indicate
-     * that a #GP(0) should be raised.
-     */
-    if (!(pVCpu->CTX_SUFF(pVM)->cpum.s.aGuestCpuIdStd[1].edx & X86_CPUID_FEATURE_EDX_MSR))
-    {
-        *puValue = 0;
-        return VERR_CPUM_RAISE_GP_0; /** @todo isn't \#UD more correct if not supported? */
-    }
-
-    int rc = VINF_SUCCESS;
-    uint8_t const u8Multiplier = 4;
-    switch (idMsr)
-    {
-        case MSR_IA32_TSC:
-            *puValue = TMCpuTickGet(pVCpu);
-            break;
-
-        case MSR_IA32_APICBASE:
-        {
-            /* See @bugref{7097} comment 6. */
-            PVM pVM = pVCpu->CTX_SUFF(pVM);
-            if (PDMHasApic(pVM))
-                *puValue = pVCpu->cpum.s.Guest.msrApicBase;
-            else
-            {
-                rc = VERR_CPUM_RAISE_GP_0;
-                *puValue = 0;
-            }
-            break;
-        }
-
-        case MSR_IA32_CR_PAT:
-            *puValue = pVCpu->cpum.s.Guest.msrPAT;
-            break;
-
-        case MSR_IA32_SYSENTER_CS:
-            *puValue = pVCpu->cpum.s.Guest.SysEnter.cs;
-            break;
-
-        case MSR_IA32_SYSENTER_EIP:
-            *puValue = pVCpu->cpum.s.Guest.SysEnter.eip;
-            break;
-
-        case MSR_IA32_SYSENTER_ESP:
-            *puValue = pVCpu->cpum.s.Guest.SysEnter.esp;
-            break;
-
-        case MSR_IA32_MTRR_CAP:
-        {
-            /* This is currently a bit weird. :-) */
-            uint8_t const   cVariableRangeRegs              = 0;
-            bool const      fSystemManagementRangeRegisters = false;
-            bool const      fFixedRangeRegisters            = false;
-            bool const      fWriteCombiningType             = false;
-            *puValue = cVariableRangeRegs
-                     | (fFixedRangeRegisters            ? RT_BIT_64(8)  : 0)
-                     | (fWriteCombiningType             ? RT_BIT_64(10) : 0)
-                     | (fSystemManagementRangeRegisters ? RT_BIT_64(11) : 0);
-            break;
-        }
-
-        case IA32_MTRR_PHYSBASE0: case IA32_MTRR_PHYSMASK0:
-        case IA32_MTRR_PHYSBASE1: case IA32_MTRR_PHYSMASK1:
-        case IA32_MTRR_PHYSBASE2: case IA32_MTRR_PHYSMASK2:
-        case IA32_MTRR_PHYSBASE3: case IA32_MTRR_PHYSMASK3:
-        case IA32_MTRR_PHYSBASE4: case IA32_MTRR_PHYSMASK4:
-        case IA32_MTRR_PHYSBASE5: case IA32_MTRR_PHYSMASK5:
-        case IA32_MTRR_PHYSBASE6: case IA32_MTRR_PHYSMASK6:
-        case IA32_MTRR_PHYSBASE7: case IA32_MTRR_PHYSMASK7:
-            /** @todo implement variable MTRRs. */
-            *puValue = 0;
-            break;
-#if 0 /** @todo newer CPUs have more, figure since when and do selective GP(). */
-        case IA32_MTRR_PHYSBASE8: case IA32_MTRR_PHYSMASK8:
-        case IA32_MTRR_PHYSBASE9: case IA32_MTRR_PHYSMASK9:
-            *puValue = 0;
-            break;
-#endif
-
-        case MSR_IA32_MTRR_DEF_TYPE:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrDefType;
-            break;
-
-        case IA32_MTRR_FIX64K_00000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix64K_00000;
-            break;
-        case IA32_MTRR_FIX16K_80000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix16K_80000;
-            break;
-        case IA32_MTRR_FIX16K_A0000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix16K_A0000;
-            break;
-        case IA32_MTRR_FIX4K_C0000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_C0000;
-            break;
-        case IA32_MTRR_FIX4K_C8000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_C8000;
-            break;
-        case IA32_MTRR_FIX4K_D0000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_D0000;
-            break;
-        case IA32_MTRR_FIX4K_D8000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_D8000;
-            break;
-        case IA32_MTRR_FIX4K_E0000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_E0000;
-            break;
-        case IA32_MTRR_FIX4K_E8000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_E8000;
-            break;
-        case IA32_MTRR_FIX4K_F0000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_F0000;
-            break;
-        case IA32_MTRR_FIX4K_F8000:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_F8000;
-            break;
-
-        case MSR_K6_EFER:
-            *puValue = pVCpu->cpum.s.Guest.msrEFER;
-            break;
-
-        case MSR_K8_SF_MASK:
-            *puValue = pVCpu->cpum.s.Guest.msrSFMASK;
-            break;
-
-        case MSR_K6_STAR:
-            *puValue = pVCpu->cpum.s.Guest.msrSTAR;
-            break;
-
-        case MSR_K8_LSTAR:
-            *puValue = pVCpu->cpum.s.Guest.msrLSTAR;
-            break;
-
-        case MSR_K8_CSTAR:
-            *puValue = pVCpu->cpum.s.Guest.msrCSTAR;
-            break;
-
-        case MSR_K8_FS_BASE:
-            *puValue = pVCpu->cpum.s.Guest.fs.u64Base;
-            break;
-
-        case MSR_K8_GS_BASE:
-            *puValue = pVCpu->cpum.s.Guest.gs.u64Base;
-            break;
-
-        case MSR_K8_KERNEL_GS_BASE:
-            *puValue = pVCpu->cpum.s.Guest.msrKERNELGSBASE;
-            break;
-
-        case MSR_K8_TSC_AUX:
-            *puValue = pVCpu->cpum.s.GuestMsrs.msr.TscAux;
-            break;
-
-        case MSR_IA32_PERF_STATUS:
-            /** @todo could really be not exactly correct, maybe use host's values
-             * Apple code indicates that we should use CPU Hz / 1.333MHz here. */
-            /** @todo Where are the specs implemented here found? */
-            *puValue = UINT64_C(1000)                 /* TSC increment by tick */
-                     | ((uint64_t)u8Multiplier << 24) /* CPU multiplier (aka bus ratio) min */
-                     | ((uint64_t)u8Multiplier << 40) /* CPU multiplier (aka bus ratio) max */;
-            break;
-
-        case MSR_IA32_FSB_CLOCK_STS:
-            /*
-             * Encoded as:
-             * 0 - 266
-             * 1 - 133
-             * 2 - 200
-             * 3 - return 166
-             * 5 - return 100
-             */
-            *puValue = (2 << 4);
-            break;
-
-        case MSR_IA32_PLATFORM_INFO:
-            *puValue = ((uint32_t)u8Multiplier << 8)  /* Flex ratio max */
-                     | ((uint64_t)u8Multiplier << 40) /* Flex ratio min */;
-            break;
-
-        case MSR_IA32_THERM_STATUS:
-            /* CPU temperature relative to TCC, to actually activate, CPUID leaf 6 EAX[0] must be set */
-            *puValue = RT_BIT(31)           /* validity bit */
-                     | (UINT64_C(20) << 16) /* degrees till TCC */;
-            break;
-
-        case MSR_IA32_MISC_ENABLE:
-#if 0
-            /* Needs to be tested more before enabling. */
-            *puValue = pVCpu->cpum.s.GuestMsr.msr.miscEnable;
-#else
-            /* Currenty we don't allow guests to modify enable MSRs. */
-            *puValue = MSR_IA32_MISC_ENABLE_FAST_STRINGS  /* by default */;
-
-            if ((pVCpu->CTX_SUFF(pVM)->cpum.s.aGuestCpuIdStd[1].ecx & X86_CPUID_FEATURE_ECX_MONITOR) != 0)
-
-                *puValue |= MSR_IA32_MISC_ENABLE_MONITOR /* if mwait/monitor available */;
-            /** @todo: add more cpuid-controlled features this way. */
-#endif
-            break;
-
-        /** @todo virtualize DEBUGCTL and relatives */
-        case MSR_IA32_DEBUGCTL:
-            *puValue = 0;
-            break;
-
-#if 0 /*def IN_RING0 */
-        case MSR_IA32_PLATFORM_ID:
-        case MSR_IA32_BIOS_SIGN_ID:
-            if (CPUMGetCPUVendor(pVM) == CPUMCPUVENDOR_INTEL)
-            {
-                /* Available since the P6 family. VT-x implies that this feature is present. */
-                if (idMsr == MSR_IA32_PLATFORM_ID)
-                    *puValue = ASMRdMsr(MSR_IA32_PLATFORM_ID);
-                else if (idMsr == MSR_IA32_BIOS_SIGN_ID)
-                    *puValue = ASMRdMsr(MSR_IA32_BIOS_SIGN_ID);
-                break;
-            }
-            /* no break */
-#endif
-        /*
-         * The BIOS_SIGN_ID MSR and MSR_IA32_MCP_CAP et al exist on AMD64 as
-         * well, at least bulldozer have them.  Windows 7 is querying them.
-         * XP has been observed querying MSR_IA32_MC0_CTL.
-         * XP64 has been observed querying MSR_P4_LASTBRANCH_0 (also on AMD).
-         */
-        case MSR_IA32_BIOS_SIGN_ID:         /* fam/mod >= 6_01 */
-        case MSR_IA32_MCG_CAP:              /* fam/mod >= 6_01 */
-        case MSR_IA32_MCG_STATUS:           /* indicated as not present in CAP */
-        /*case MSR_IA32_MCG_CTRL:       - indicated as not present in CAP */
-        case MSR_IA32_MC0_CTL:
-        case MSR_IA32_MC0_STATUS:
-        case MSR_P4_LASTBRANCH_0:
-        case MSR_P4_LASTBRANCH_1:
-        case MSR_P4_LASTBRANCH_2:
-        case MSR_P4_LASTBRANCH_3:
-        case 0x2c:                          /* accessed by some Intel driver but also read on
-                                               AMD systems */
-            *puValue = 0;
-            break;
-
-
-        /*
-         * Intel specifics MSRs:
-         */
-        case MSR_P5_MC_ADDR:
-        case MSR_P5_MC_TYPE:
-        case MSR_P4_LASTBRANCH_TOS: /** @todo Are these branch regs still here on more recent CPUs? The documentation doesn't mention them for several archs. */
-        case MSR_IA32_PERFEVTSEL0:          /* NetWare 6.5 wants the these four. (Bet on AMD as well.) */
-        case MSR_IA32_PERFEVTSEL1:
-        case MSR_IA32_PMC0:
-        case MSR_IA32_PMC1:
-        case MSR_IA32_PLATFORM_ID:          /* fam/mod >= 6_01 */
-        case MSR_IA32_MPERF:                /* intel_pstate depends on this but does a validation test */
-        case MSR_IA32_APERF:                /* intel_pstate depends on this but does a validation test */
-        /*case MSR_IA32_BIOS_UPDT_TRIG: - write-only? */
-        case MSR_RAPL_POWER_UNIT:
-        case MSR_BBL_CR_CTL3:               /* ca. core arch? */
-        case MSR_PKG_CST_CONFIG_CONTROL:    /* Nahalem, Sandy Bridge */
-        case MSR_CORE_THREAD_COUNT:         /* Apple queries this. */
-        case MSR_FLEX_RATIO:                /* Apple queries this. */
-        case 0x1ad:                         /* MSR_TURBO_POWER_CURRENT_LIMIT */
-            *puValue = 0;
-            if (CPUMGetGuestCpuVendor(pVCpu->CTX_SUFF(pVM)) != CPUMCPUVENDOR_INTEL)
-            {
-                Log(("CPUM: MSR %#x is Intel, the virtual CPU isn't an Intel one -> #GP\n", idMsr));
-                rc = VERR_CPUM_RAISE_GP_0;
-                break;
-            }
-
-            /* Provide more plausive values for some of them. */
-            switch (idMsr)
-            {
-                case MSR_RAPL_POWER_UNIT:
-                    *puValue = RT_MAKE_U32_FROM_U8(3 /* power units (1/8 W)*/,
-                                                   16 /* 15.3 micro-Joules */,
-                                                   10 /* 976 microseconds increments */,
-                                                   0);
-                    break;
-                case MSR_BBL_CR_CTL3:
-                    *puValue = RT_MAKE_U32_FROM_U8(1, /* bit 0  - L2 Hardware Enabled. (RO) */
-                                                   1, /* bit 8  - L2 Enabled (R/W). */
-                                                   0, /* bit 23 - L2 Not Present (RO). */
-                                                   0);
-                    break;
-                case MSR_PKG_CST_CONFIG_CONTROL:
-                    *puValue = pVCpu->cpum.s.GuestMsrs.msr.PkgCStateCfgCtrl;
-                    break;
-                case MSR_CORE_THREAD_COUNT:
-                {
-                    /** @todo restrict this to nehalem.  */
-                    PVM pVM = pVCpu->CTX_SUFF(pVM); /* Note! Not sweating the 4-bit core count limit on westmere. */
-                    *puValue = (pVM->cCpus & 0xffff) | ((pVM->cCpus & 0xffff) << 16);
-                    break;
-                }
-
-                case MSR_FLEX_RATIO:
-                {
-                    /** @todo Check for P4, it's different there. Try find accurate specs. */
-                    *puValue = (uint32_t)u8Multiplier << 8;
-                    break;
-                }
-            }
-            break;
-
-#if 0 /* Only on pentium CPUs! */
-        /* Event counters, not supported. */
-        case MSR_IA32_CESR:
-        case MSR_IA32_CTR0:
-        case MSR_IA32_CTR1:
-            *puValue = 0;
-            break;
-#endif
-
-
-        /*
-         * AMD specific MSRs:
-         */
-        case MSR_K8_SYSCFG:
-        case MSR_K8_INT_PENDING:
-        case MSR_K8_NB_CFG:             /* (All known values are 0 on reset.) */
-        case MSR_K8_HWCR:               /* Very interesting bits here. :) */
-        case MSR_K8_VM_CR:              /* Windows 8 */
-        case 0xc0011029:                /* quick fix for FreeBSd 9.1. */
-        case 0xc0010042:                /* quick fix for something. */
-        case 0xc001102a:                /* quick fix for w2k8 + opposition. */
-        case 0xc0011004:                /* quick fix for the opposition. */
-        case 0xc0011005:                /* quick fix for the opposition. */
-        case 0xc0011023:                /* quick fix for the opposition. */
-        case MSR_K7_EVNTSEL0:           /* quick fix for the opposition. */
-        case MSR_K7_EVNTSEL1:           /* quick fix for the opposition. */
-        case MSR_K7_EVNTSEL2:           /* quick fix for the opposition. */
-        case MSR_K7_EVNTSEL3:           /* quick fix for the opposition. */
-        case MSR_K7_PERFCTR0:           /* quick fix for the opposition. */
-        case MSR_K7_PERFCTR1:           /* quick fix for the opposition. */
-        case MSR_K7_PERFCTR2:           /* quick fix for the opposition. */
-        case MSR_K7_PERFCTR3:           /* quick fix for the opposition. */
-            *puValue = 0;
-            if (CPUMGetGuestCpuVendor(pVCpu->CTX_SUFF(pVM)) != CPUMCPUVENDOR_AMD)
-            {
-                Log(("CPUM: MSR %#x is AMD, the virtual CPU isn't an Intel one -> #GP\n", idMsr));
-                return VERR_CPUM_RAISE_GP_0;
-            }
-            /* ignored */
-            break;
-
-        default:
-            /*
-             * Hand the X2APIC range to PDM and the APIC.
-             */
-            if (    idMsr >= MSR_IA32_X2APIC_START
-                &&  idMsr <= MSR_IA32_X2APIC_END)
-            {
-                rc = PDMApicReadMSR(pVCpu->CTX_SUFF(pVM), pVCpu->idCpu, idMsr, puValue);
-                if (RT_SUCCESS(rc))
-                    rc = VINF_SUCCESS;
-                else
-                {
-                    *puValue = 0;
-                    rc = VERR_CPUM_RAISE_GP_0;
-                }
-            }
-            else
-            {
-                *puValue = 0;
-                rc = VERR_CPUM_RAISE_GP_0;
-            }
-            break;
-    }
-
-    return rc;
-}
-
-
-/**
- * Query an MSR.
- *
- * The caller is responsible for checking privilege if the call is the result
- * of a RDMSR instruction. We'll do the rest.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_CPUM_RAISE_GP_0 on failure (invalid MSR), the caller is
- *          expected to take the appropriate actions. @a *puValue is set to 0.
- * @param   pVCpu               Pointer to the VMCPU.
- * @param   idMsr               The MSR.
- * @param   puValue             Where to return the value.
- *
- * @remarks This will always return the right values, even when we're in the
- *          recompiler.
- */
-VMMDECL(int) CPUMQueryGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t *puValue)
-{
-    int rc = cpumQueryGuestMsrInt(pVCpu, idMsr, puValue);
-    LogFlow(("CPUMQueryGuestMsr: %#x -> %llx rc=%d\n", idMsr, *puValue, rc));
-    return rc;
-}
-
-
-/**
- * Sets the MSR.
- *
- * The caller is responsible for checking privilege if the call is the result
- * of a WRMSR instruction. We'll do the rest.
- *
- * @retval  VINF_SUCCESS on success.
- * @retval  VERR_CPUM_RAISE_GP_0 on failure, the caller is expected to take the
- *          appropriate actions.
- *
- * @param   pVCpu       Pointer to the VMCPU.
- * @param   idMsr       The MSR id.
- * @param   uValue      The value to set.
- *
- * @remarks Everyone changing MSR values, including the recompiler, shall do it
- *          by calling this method. This makes sure we have current values and
- *          that we trigger all the right actions when something changes.
- */
-VMMDECL(int) CPUMSetGuestMsr(PVMCPU pVCpu, uint32_t idMsr, uint64_t uValue)
-{
-    LogFlow(("CPUMSetGuestMsr: %#x <- %#llx\n", idMsr, uValue));
-
-    /*
-     * If we don't indicate MSR support in the CPUID feature bits, indicate
-     * that a #GP(0) should be raised.
-     */
-    if (!(pVCpu->CTX_SUFF(pVM)->cpum.s.aGuestCpuIdStd[1].edx & X86_CPUID_FEATURE_EDX_MSR))
-        return VERR_CPUM_RAISE_GP_0; /** @todo isn't \#UD more correct if not supported? */
-
-    int rc = VINF_SUCCESS;
-    switch (idMsr)
-    {
-        case MSR_IA32_MISC_ENABLE:
-            pVCpu->cpum.s.GuestMsrs.msr.MiscEnable = uValue;
-            break;
-
-        case MSR_IA32_TSC:
-            TMCpuTickSet(pVCpu->CTX_SUFF(pVM), pVCpu, uValue);
-            break;
-
-        case MSR_IA32_APICBASE:
-            rc = PDMApicSetBase(pVCpu, uValue);
-            if (rc != VINF_SUCCESS)
-                rc = VERR_CPUM_RAISE_GP_0;
-            break;
-
-        case MSR_IA32_CR_PAT:
-            pVCpu->cpum.s.Guest.msrPAT      = uValue;
-            break;
-
-        case MSR_IA32_SYSENTER_CS:
-            pVCpu->cpum.s.Guest.SysEnter.cs = uValue & 0xffff; /* 16 bits selector */
-            break;
-
-        case MSR_IA32_SYSENTER_EIP:
-            pVCpu->cpum.s.Guest.SysEnter.eip = uValue;
-            break;
-
-        case MSR_IA32_SYSENTER_ESP:
-            pVCpu->cpum.s.Guest.SysEnter.esp = uValue;
-            break;
-
-        case MSR_IA32_MTRR_CAP:
-            return VERR_CPUM_RAISE_GP_0;
-
-        case MSR_IA32_MTRR_DEF_TYPE:
-            if (   (uValue & UINT64_C(0xfffffffffffff300))
-                || (    (uValue & 0xff) != 0
-                    &&  (uValue & 0xff) != 1
-                    &&  (uValue & 0xff) != 4
-                    &&  (uValue & 0xff) != 5
-                    &&  (uValue & 0xff) != 6) )
-            {
-                Log(("CPUM: MSR_IA32_MTRR_DEF_TYPE: #GP(0) - writing reserved value (%#llx)\n", uValue));
-                return VERR_CPUM_RAISE_GP_0;
-            }
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrDefType = uValue;
-            break;
-
-        case IA32_MTRR_PHYSBASE0: case IA32_MTRR_PHYSMASK0:
-        case IA32_MTRR_PHYSBASE1: case IA32_MTRR_PHYSMASK1:
-        case IA32_MTRR_PHYSBASE2: case IA32_MTRR_PHYSMASK2:
-        case IA32_MTRR_PHYSBASE3: case IA32_MTRR_PHYSMASK3:
-        case IA32_MTRR_PHYSBASE4: case IA32_MTRR_PHYSMASK4:
-        case IA32_MTRR_PHYSBASE5: case IA32_MTRR_PHYSMASK5:
-        case IA32_MTRR_PHYSBASE6: case IA32_MTRR_PHYSMASK6:
-        case IA32_MTRR_PHYSBASE7: case IA32_MTRR_PHYSMASK7:
-            /** @todo implement variable MTRRs. */
-            break;
-#if 0 /** @todo newer CPUs have more, figure since when and do selective GP(). */
-        case IA32_MTRR_PHYSBASE8: case IA32_MTRR_PHYSMASK8:
-        case IA32_MTRR_PHYSBASE9: case IA32_MTRR_PHYSMASK9:
-            break;
-#endif
-
-        case IA32_MTRR_FIX64K_00000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix64K_00000 = uValue;
-            break;
-        case IA32_MTRR_FIX16K_80000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix16K_80000 = uValue;
-            break;
-        case IA32_MTRR_FIX16K_A0000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix16K_A0000 = uValue;
-            break;
-        case IA32_MTRR_FIX4K_C0000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_C0000 = uValue;
-            break;
-        case IA32_MTRR_FIX4K_C8000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_C8000 = uValue;
-            break;
-        case IA32_MTRR_FIX4K_D0000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_D0000 = uValue;
-            break;
-        case IA32_MTRR_FIX4K_D8000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_D8000 = uValue;
-            break;
-        case IA32_MTRR_FIX4K_E0000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_E0000 = uValue;
-            break;
-        case IA32_MTRR_FIX4K_E8000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_E8000 = uValue;
-            break;
-        case IA32_MTRR_FIX4K_F0000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_F0000 = uValue;
-            break;
-        case IA32_MTRR_FIX4K_F8000:
-            pVCpu->cpum.s.GuestMsrs.msr.MtrrFix4K_F8000 = uValue;
-            break;
-
-        /*
-         * AMD64 MSRs.
-         */
-        case MSR_K6_EFER:
-        {
-            PVM             pVM          = pVCpu->CTX_SUFF(pVM);
-            uint64_t const  uOldEFER     = pVCpu->cpum.s.Guest.msrEFER;
-            uint32_t const  fExtFeatures = pVM->cpum.s.aGuestCpuIdExt[0].eax >= 0x80000001
-                                         ? pVM->cpum.s.aGuestCpuIdExt[1].edx
-                                         : 0;
-            uint64_t        fMask        = 0;
-
-            /* Filter out those bits the guest is allowed to change. (e.g. LMA is read-only) */
-            if (fExtFeatures & X86_CPUID_EXT_FEATURE_EDX_NX)
-                fMask |= MSR_K6_EFER_NXE;
-            if (fExtFeatures & X86_CPUID_EXT_FEATURE_EDX_LONG_MODE)
-                fMask |= MSR_K6_EFER_LME;
-            if (fExtFeatures & X86_CPUID_EXT_FEATURE_EDX_SYSCALL)
-                fMask |= MSR_K6_EFER_SCE;
-            if (fExtFeatures & X86_CPUID_AMD_FEATURE_EDX_FFXSR)
-                fMask |= MSR_K6_EFER_FFXSR;
-
-            /* Check for illegal MSR_K6_EFER_LME transitions: not allowed to change LME if
-               paging is enabled. (AMD Arch. Programmer's Manual Volume 2: Table 14-5) */
-            if (    (uOldEFER & MSR_K6_EFER_LME) != (uValue & fMask & MSR_K6_EFER_LME)
-                &&  (pVCpu->cpum.s.Guest.cr0 & X86_CR0_PG))
-            {
-                Log(("CPUM: Illegal MSR_K6_EFER_LME change: paging is enabled!!\n"));
-                return VERR_CPUM_RAISE_GP_0;
-            }
-
-            /* There are a few more: e.g. MSR_K6_EFER_LMSLE */
-            AssertMsg(!(uValue & ~(MSR_K6_EFER_NXE | MSR_K6_EFER_LME | MSR_K6_EFER_LMA /* ignored anyway */ | MSR_K6_EFER_SCE | MSR_K6_EFER_FFXSR)),
-                      ("Unexpected value %RX64\n", uValue));
-            pVCpu->cpum.s.Guest.msrEFER = (uOldEFER & ~fMask) | (uValue & fMask);
-
-            /* AMD64 Architecture Programmer's Manual: 15.15 TLB Control; flush the TLB
-               if MSR_K6_EFER_NXE, MSR_K6_EFER_LME or MSR_K6_EFER_LMA are changed. */
-            if (   (uOldEFER                    & (MSR_K6_EFER_NXE | MSR_K6_EFER_LME | MSR_K6_EFER_LMA))
-                != (pVCpu->cpum.s.Guest.msrEFER & (MSR_K6_EFER_NXE | MSR_K6_EFER_LME | MSR_K6_EFER_LMA)))
-            {
-                /// @todo PGMFlushTLB(pVCpu, cr3, true /*fGlobal*/);
-                HMFlushTLB(pVCpu);
-
-                /* Notify PGM about NXE changes. */
-                if (   (uOldEFER                    & MSR_K6_EFER_NXE)
-                    != (pVCpu->cpum.s.Guest.msrEFER & MSR_K6_EFER_NXE))
-                    PGMNotifyNxeChanged(pVCpu, !(uOldEFER & MSR_K6_EFER_NXE));
-            }
-            break;
-        }
-
-        case MSR_K8_SF_MASK:
-            pVCpu->cpum.s.Guest.msrSFMASK       = uValue;
-            break;
-
-        case MSR_K6_STAR:
-            pVCpu->cpum.s.Guest.msrSTAR         = uValue;
-            break;
-
-        case MSR_K8_LSTAR:
-            pVCpu->cpum.s.Guest.msrLSTAR        = uValue;
-            break;
-
-        case MSR_K8_CSTAR:
-            pVCpu->cpum.s.Guest.msrCSTAR        = uValue;
-            break;
-
-        case MSR_K8_FS_BASE:
-            pVCpu->cpum.s.Guest.fs.u64Base      = uValue;
-            break;
-
-        case MSR_K8_GS_BASE:
-            pVCpu->cpum.s.Guest.gs.u64Base      = uValue;
-            break;
-
-        case MSR_K8_KERNEL_GS_BASE:
-            pVCpu->cpum.s.Guest.msrKERNELGSBASE = uValue;
-            break;
-
-        case MSR_K8_TSC_AUX:
-            pVCpu->cpum.s.GuestMsrs.msr.TscAux  = uValue;
-            break;
-
-        case MSR_IA32_DEBUGCTL:
-            /** @todo virtualize DEBUGCTL and relatives */
-            break;
-
-        /*
-         * Intel specifics MSRs:
-         */
-        /*case MSR_IA32_PLATFORM_ID: - read-only */
-        case MSR_IA32_BIOS_SIGN_ID:         /* fam/mod >= 6_01 */
-        case MSR_IA32_BIOS_UPDT_TRIG:       /* fam/mod >= 6_01 */
-        /*case MSR_IA32_MCP_CAP:     - read-only */
-        /*case MSR_IA32_MCG_STATUS:  - read-only */
-        /*case MSR_IA32_MCG_CTRL:    - indicated as not present in CAP */
-        /*case MSR_IA32_MC0_CTL:     - read-only? */
-        /*case MSR_IA32_MC0_STATUS:  - read-only? */
-        case MSR_PKG_CST_CONFIG_CONTROL:
-            if (CPUMGetGuestCpuVendor(pVCpu->CTX_SUFF(pVM)) != CPUMCPUVENDOR_INTEL)
-            {
-                Log(("CPUM: MSR %#x is Intel, the virtual CPU isn't an Intel one -> #GP\n", idMsr));
-                return VERR_CPUM_RAISE_GP_0;
-            }
-
-            switch (idMsr)
-            {
-                case MSR_PKG_CST_CONFIG_CONTROL:
-                {
-                    if (pVCpu->cpum.s.GuestMsrs.msr.PkgCStateCfgCtrl & RT_BIT_64(15))
-                    {
-                        Log(("MSR_PKG_CST_CONFIG_CONTROL: Write protected -> #GP\n"));
-                        return VERR_CPUM_RAISE_GP_0;
-                    }
-                    static uint64_t s_fMask = UINT64_C(0x01f08407); /** @todo Only Nehalem has 24; Only Sandy has 27 and 28. */
-                    static uint64_t s_fGpInvalid = UINT64_C(0xffffffff00ff0000); /** @todo figure out exactly what's off limits. */
-                    if ((uValue & s_fGpInvalid) || (uValue & 7) >= 5)
-                    {
-                        Log(("MSR_PKG_CST_CONFIG_CONTROL: Invalid value %#llx -> #GP\n", uValue));
-                        return VERR_CPUM_RAISE_GP_0;
-                    }
-                    pVCpu->cpum.s.GuestMsrs.msr.PkgCStateCfgCtrl = uValue & s_fMask;
-                    break;
-                }
-
-            }
-            /* ignored */
-            break;
-
-        /*
-         * AMD specific MSRs:
-         */
-        case MSR_K8_SYSCFG:      /** @todo can be written, but we ignore that for now. */
-        case MSR_K8_INT_PENDING: /** @todo can be written, but we ignore that for now. */
-        case MSR_K8_NB_CFG:      /** @todo can be written; the apicid swapping might be used and would need saving, but probably unnecessary. */
-        case 0xc0011029:        /* quick fix for FreeBSd 9.1. */
-        case 0xc0010042:        /* quick fix for something. */
-        case 0xc001102a:        /* quick fix for w2k8 + opposition. */
-        case 0xc0011004:        /* quick fix for the opposition. */
-        case 0xc0011005:        /* quick fix for the opposition. */
-        case MSR_K7_EVNTSEL0:   /* quick fix for the opposition. */
-        case MSR_K7_EVNTSEL1:   /* quick fix for the opposition. */
-        case MSR_K7_EVNTSEL2:   /* quick fix for the opposition. */
-        case MSR_K7_EVNTSEL3:   /* quick fix for the opposition. */
-        case MSR_K7_PERFCTR0:   /* quick fix for the opposition. */
-        case MSR_K7_PERFCTR1:   /* quick fix for the opposition. */
-        case MSR_K7_PERFCTR2:   /* quick fix for the opposition. */
-        case MSR_K7_PERFCTR3:   /* quick fix for the opposition. */
-            if (CPUMGetGuestCpuVendor(pVCpu->CTX_SUFF(pVM)) != CPUMCPUVENDOR_AMD)
-            {
-                Log(("CPUM: MSR %#x is AMD, the virtual CPU isn't an Intel one -> #GP\n", idMsr));
-                return VERR_CPUM_RAISE_GP_0;
-            }
-            /* ignored */
-            break;
-
-
-        default:
-            /*
-             * Hand the X2APIC range to PDM and the APIC.
-             */
-            if (    idMsr >= MSR_IA32_X2APIC_START
-                &&  idMsr <= MSR_IA32_X2APIC_END)
-            {
-                rc = PDMApicWriteMSR(pVCpu->CTX_SUFF(pVM), pVCpu->idCpu, idMsr, uValue);
-                if (rc != VINF_SUCCESS)
-                    rc = VERR_CPUM_RAISE_GP_0;
-            }
-            else
-            {
-                /* We should actually trigger a #GP here, but don't as that might cause more trouble. */
-                /** @todo rc = VERR_CPUM_RAISE_GP_0 */
-                Log(("CPUMSetGuestMsr: Unknown MSR %#x attempted set to %#llx\n", idMsr, uValue));
-            }
-            break;
-    }
-    return rc;
-}
-
-#endif /* !VBOX_WITH_NEW_MSR_CODE */
-
 
 VMMDECL(RTGCPTR) CPUMGetGuestIDTR(PVMCPU pVCpu, uint16_t *pcbLimit)
 {
@@ -1859,6 +1152,60 @@ VMMDECL(uint64_t) CPUMGetGuestEFER(PVMCPU pVCpu)
 
 
 /**
+ * Looks up a CPUID leaf in the CPUID leaf array, no subleaf.
+ *
+ * @returns Pointer to the leaf if found, NULL if not.
+ *
+ * @param   pVM                 Pointer to the cross context VM structure.
+ * @param   uLeaf               The leaf to get.
+ */
+PCPUMCPUIDLEAF cpumCpuIdGetLeaf(PVM pVM, uint32_t uLeaf)
+{
+    unsigned            iEnd     = pVM->cpum.s.GuestInfo.cCpuIdLeaves;
+    if (iEnd)
+    {
+        unsigned        iStart   = 0;
+        PCPUMCPUIDLEAF  paLeaves = pVM->cpum.s.GuestInfo.CTX_SUFF(paCpuIdLeaves);
+        for (;;)
+        {
+            unsigned i = iStart + (iEnd - iStart) / 2U;
+            if (uLeaf < paLeaves[i].uLeaf)
+            {
+                if (i <= iStart)
+                    return NULL;
+                iEnd = i;
+            }
+            else if (uLeaf > paLeaves[i].uLeaf)
+            {
+                i += 1;
+                if (i >= iEnd)
+                    return NULL;
+                iStart = i;
+            }
+            else
+            {
+                if (RT_LIKELY(paLeaves[i].fSubLeafMask == 0 && paLeaves[i].uSubLeaf == 0))
+                    return &paLeaves[i];
+
+                /* This shouldn't normally happen. But in case the it does due
+                   to user configuration overrids or something, just return the
+                   first sub-leaf. */
+                AssertMsgFailed(("uLeaf=%#x fSubLeafMask=%#x uSubLeaf=%#x\n",
+                                 uLeaf, paLeaves[i].fSubLeafMask, paLeaves[i].uSubLeaf));
+                while (   paLeaves[i].uSubLeaf != 0
+                       && i > 0
+                       && uLeaf == paLeaves[i - 1].uLeaf)
+                    i--;
+                return &paLeaves[i];
+            }
+        }
+    }
+
+    return NULL;
+}
+
+
+/**
  * Looks up a CPUID leaf in the CPUID leaf array.
  *
  * @returns Pointer to the leaf if found, NULL if not.
@@ -1867,8 +1214,9 @@ VMMDECL(uint64_t) CPUMGetGuestEFER(PVMCPU pVCpu)
  * @param   uLeaf               The leaf to get.
  * @param   uSubLeaf            The subleaf, if applicable.  Just pass 0 if it
  *                              isn't.
+ * @param   pfExactSubLeafHit   Whether we've got an exact subleaf hit or not.
  */
-PCPUMCPUIDLEAF cpumCpuIdGetLeaf(PVM pVM, uint32_t uLeaf, uint32_t uSubLeaf)
+PCPUMCPUIDLEAF cpumCpuIdGetLeafEx(PVM pVM, uint32_t uLeaf, uint32_t uSubLeaf, bool *pfExactSubLeafHit)
 {
     unsigned            iEnd     = pVM->cpum.s.GuestInfo.cCpuIdLeaves;
     if (iEnd)
@@ -1894,26 +1242,30 @@ PCPUMCPUIDLEAF cpumCpuIdGetLeaf(PVM pVM, uint32_t uLeaf, uint32_t uSubLeaf)
             else
             {
                 uSubLeaf &= paLeaves[i].fSubLeafMask;
-                if (uSubLeaf != paLeaves[i].uSubLeaf)
+                if (uSubLeaf == paLeaves[i].uSubLeaf)
+                    *pfExactSubLeafHit = true;
+                else
                 {
                     /* Find the right subleaf.  We return the last one before
                        uSubLeaf if we don't find an exact match. */
                     if (uSubLeaf < paLeaves[i].uSubLeaf)
                         while (   i > 0
-                               && uLeaf    == paLeaves[i].uLeaf
-                               && uSubLeaf  < paLeaves[i].uSubLeaf)
+                               && uLeaf    == paLeaves[i - 1].uLeaf
+                               && uSubLeaf <= paLeaves[i - 1].uSubLeaf)
                             i--;
                     else
                         while (   i + 1 < pVM->cpum.s.GuestInfo.cCpuIdLeaves
                                && uLeaf    == paLeaves[i + 1].uLeaf
                                && uSubLeaf >= paLeaves[i + 1].uSubLeaf)
                             i++;
+                    *pfExactSubLeafHit = uSubLeaf == paLeaves[i].uSubLeaf;
                 }
                 return &paLeaves[i];
             }
         }
     }
 
+    *pfExactSubLeafHit = false;
     return NULL;
 }
 
@@ -1921,136 +1273,102 @@ PCPUMCPUIDLEAF cpumCpuIdGetLeaf(PVM pVM, uint32_t uLeaf, uint32_t uSubLeaf)
 /**
  * Gets a CPUID leaf.
  *
- * @param   pVCpu   Pointer to the VMCPU.
- * @param   iLeaf   The CPUID leaf to get.
- * @param   pEax    Where to store the EAX value.
- * @param   pEbx    Where to store the EBX value.
- * @param   pEcx    Where to store the ECX value.
- * @param   pEdx    Where to store the EDX value.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   uLeaf       The CPUID leaf to get.
+ * @param   uSubLeaf    The CPUID sub-leaf to get, if applicable.
+ * @param   pEax        Where to store the EAX value.
+ * @param   pEbx        Where to store the EBX value.
+ * @param   pEcx        Where to store the ECX value.
+ * @param   pEdx        Where to store the EDX value.
  */
-VMMDECL(void) CPUMGetGuestCpuId(PVMCPU pVCpu, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
+VMMDECL(void) CPUMGetGuestCpuId(PVMCPU pVCpu, uint32_t uLeaf, uint32_t uSubLeaf,
+                                uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx)
 {
-    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    bool            fExactSubLeafHit;
+    PVM             pVM   = pVCpu->CTX_SUFF(pVM);
+    PCCPUMCPUIDLEAF pLeaf = cpumCpuIdGetLeafEx(pVM, uLeaf, uSubLeaf, &fExactSubLeafHit);
+    if (pLeaf)
+    {
+        AssertMsg(pLeaf->uLeaf == uLeaf, ("%#x\n", pLeaf->uLeaf, uLeaf));
+        if (fExactSubLeafHit)
+        {
+            *pEax = pLeaf->uEax;
+            *pEbx = pLeaf->uEbx;
+            *pEcx = pLeaf->uEcx;
+            *pEdx = pLeaf->uEdx;
 
-    PCCPUMCPUID pCpuId;
-    if (iLeaf < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
-        pCpuId = &pVM->cpum.s.aGuestCpuIdStd[iLeaf];
-    else if (iLeaf - UINT32_C(0x80000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdExt))
-        pCpuId = &pVM->cpum.s.aGuestCpuIdExt[iLeaf - UINT32_C(0x80000000)];
-    else if (   iLeaf - UINT32_C(0x40000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdHyper)
-             && (pVCpu->CTX_SUFF(pVM)->cpum.s.aGuestCpuIdStd[1].ecx & X86_CPUID_FEATURE_ECX_HVP))
-        pCpuId = &pVM->cpum.s.aGuestCpuIdHyper[iLeaf - UINT32_C(0x40000000)];   /* Only report if HVP bit set. */
-    else if (iLeaf - UINT32_C(0xc0000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur))
-        pCpuId = &pVM->cpum.s.aGuestCpuIdCentaur[iLeaf - UINT32_C(0xc0000000)];
+            /*
+             * Deal with CPU specific information (currently only APIC ID).
+             */
+            if (pLeaf->fFlags & (CPUMCPUIDLEAF_F_CONTAINS_APIC_ID | CPUMCPUIDLEAF_F_CONTAINS_OSXSAVE))
+            {
+                if (uLeaf == 1)
+                {
+                    /* EBX: Bits 31-24: Initial APIC ID. */
+                    Assert(pVCpu->idCpu <= 255);
+                    AssertMsg((pLeaf->uEbx >> 24) == 0, ("%#x\n", pLeaf->uEbx)); /* raw-mode assumption */
+                    *pEbx = (pLeaf->uEbx & UINT32_C(0x00ffffff)) | (pVCpu->idCpu << 24);
+
+                    /* ECX: Bit 27: CR4.OSXSAVE mirror. */
+                    *pEcx = (pLeaf->uEcx & ~X86_CPUID_FEATURE_ECX_OSXSAVE)
+                          | (pVCpu->cpum.s.Guest.cr4 & X86_CR4_OSXSAVE ? X86_CPUID_FEATURE_ECX_OSXSAVE : 0);
+                }
+                else if (uLeaf == 0xb)
+                {
+                    /* EDX: Initial extended APIC ID. */
+                    AssertMsg(pLeaf->uEdx == 0, ("%#x\n", pLeaf->uEdx)); /* raw-mode assumption */
+                    *pEdx = pVCpu->idCpu;
+                }
+                else if (uLeaf == UINT32_C(0x8000001e))
+                {
+                    /* EAX: Initial extended APIC ID. */
+                    AssertMsg(pLeaf->uEax == 0, ("%#x\n", pLeaf->uEax)); /* raw-mode assumption */
+                    *pEax = pVCpu->idCpu;
+                }
+                else
+                    AssertMsgFailed(("uLeaf=%#x\n", uLeaf));
+            }
+        }
+        /*
+         * Out of range sub-leaves aren't quite as easy and pretty as we emulate
+         * them here, but we do the best we can here...
+         */
+        else
+        {
+            *pEax = *pEbx = *pEcx = *pEdx = 0;
+            if (pLeaf->fFlags & CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES)
+            {
+                *pEcx = uSubLeaf & 0xff;
+                *pEdx = pVCpu->idCpu;
+            }
+        }
+    }
     else
-        pCpuId = &pVM->cpum.s.GuestCpuIdDef;
-
-    uint32_t cCurrentCacheIndex = *pEcx;
-
-    *pEax = pCpuId->eax;
-    *pEbx = pCpuId->ebx;
-    *pEcx = pCpuId->ecx;
-    *pEdx = pCpuId->edx;
-
-    if (    iLeaf == 1)
-    {
-        /* Bits 31-24: Initial APIC ID */
-        Assert(pVCpu->idCpu <= 255);
-        *pEbx |= (pVCpu->idCpu << 24);
-   }
-
-    if (    iLeaf == 4
-        &&  cCurrentCacheIndex < 3
-        &&  pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_INTEL)
     {
-        uint32_t type, level, sharing, linesize,
-                 partitions, associativity, sets, cores;
-
-        /* For type: 1 - data cache, 2 - i-cache, 3 - unified */
-        partitions = 1;
-        /* Those are only to shut up compiler, as they will always
-           get overwritten, and compiler should be able to figure that out */
-        sets = associativity = sharing = level = 1;
-        cores = pVM->cCpus > 32 ? 32 : pVM->cCpus;
-        switch (cCurrentCacheIndex)
+        /*
+         * Different CPUs have different ways of dealing with unknown CPUID leaves.
+         */
+        switch (pVM->cpum.s.GuestInfo.enmUnknownCpuIdMethod)
         {
-            case 0:
-                type = 1;
-                level = 1;
-                sharing = 1;
-                linesize = 64;
-                associativity = 8;
-                sets = 64;
-                break;
-            case 1:
-                level = 1;
-                type = 2;
-                sharing = 1;
-                linesize = 64;
-                associativity = 8;
-                sets = 64;
-                break;
-            default:            /* shut up gcc.*/
+            default:
                 AssertFailed();
-            case 2:
-                level = 2;
-                type = 3;
-                sharing = cores; /* our L2 cache is modelled as shared between all cores */
-                linesize = 64;
-                associativity = 24;
-                sets = 4096;
+            case CPUMUNKNOWNCPUID_DEFAULTS:
+            case CPUMUNKNOWNCPUID_LAST_STD_LEAF: /* ASSUME this is executed */
+            case CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX: /** @todo Implement CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX */
+                *pEax = pVM->cpum.s.GuestInfo.DefCpuId.uEax;
+                *pEbx = pVM->cpum.s.GuestInfo.DefCpuId.uEbx;
+                *pEcx = pVM->cpum.s.GuestInfo.DefCpuId.uEcx;
+                *pEdx = pVM->cpum.s.GuestInfo.DefCpuId.uEdx;
+                break;
+            case CPUMUNKNOWNCPUID_PASSTHRU:
+                *pEax = uLeaf;
+                *pEbx = 0;
+                *pEcx = uSubLeaf;
+                *pEdx = 0;
                 break;
         }
-
-        *pEax |= ((cores - 1) << 26)        |
-                 ((sharing - 1) << 14)      |
-                 (level << 5)               |
-                 1;
-        *pEbx = (linesize - 1)               |
-                ((partitions - 1) << 12)     |
-                ((associativity - 1) << 22); /* -1 encoding */
-        *pEcx = sets - 1;
     }
-
-    Log2(("CPUMGetGuestCpuId: iLeaf=%#010x %RX32 %RX32 %RX32 %RX32\n", iLeaf, *pEax, *pEbx, *pEcx, *pEdx));
-}
-
-/**
- * Gets a number of standard CPUID leafs.
- *
- * @returns Number of leafs.
- * @param   pVM         Pointer to the VM.
- * @remark  Intended for PATM.
- */
-VMMDECL(uint32_t) CPUMGetGuestCpuIdStdMax(PVM pVM)
-{
-    return RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd);
-}
-
-
-/**
- * Gets a number of extended CPUID leafs.
- *
- * @returns Number of leafs.
- * @param   pVM         Pointer to the VM.
- * @remark  Intended for PATM.
- */
-VMMDECL(uint32_t) CPUMGetGuestCpuIdExtMax(PVM pVM)
-{
-    return RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdExt);
-}
-
-
-/**
- * Gets a number of centaur CPUID leafs.
- *
- * @returns Number of leafs.
- * @param   pVM         Pointer to the VM.
- * @remark  Intended for PATM.
- */
-VMMDECL(uint32_t) CPUMGetGuestCpuIdCentaurMax(PVM pVM)
-{
-    return RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur);
+    Log2(("CPUMGetGuestCpuId: uLeaf=%#010x/%#010x %RX32 %RX32 %RX32 %RX32\n", uLeaf, uSubLeaf, *pEax, *pEbx, *pEcx, *pEdx));
 }
 
 
@@ -2070,14 +1388,14 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
          * Set the APIC bit in both feature masks.
          */
         case CPUMCPUIDFEATURE_APIC:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].edx = pLeaf->uEdx |= X86_CPUID_FEATURE_EDX_APIC;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEdx = pLeaf->uEdx |= X86_CPUID_FEATURE_EDX_APIC;
 
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   pLeaf
                 && pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
-                pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx |= X86_CPUID_AMD_FEATURE_EDX_APIC;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx |= X86_CPUID_AMD_FEATURE_EDX_APIC;
 
             pVM->cpum.s.GuestFeatures.fApic = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled APIC\n"));
@@ -2087,9 +1405,9 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
         * Set the x2APIC bit in the standard feature mask.
         */
         case CPUMCPUIDFEATURE_X2APIC:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].ecx = pLeaf->uEcx |= X86_CPUID_FEATURE_ECX_X2APIC;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEcx = pLeaf->uEcx |= X86_CPUID_FEATURE_ECX_X2APIC;
             pVM->cpum.s.GuestFeatures.fX2Apic = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled x2APIC\n"));
             break;
@@ -2105,9 +1423,9 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
                 return;
             }
 
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].edx = pLeaf->uEdx |= X86_CPUID_FEATURE_EDX_SEP;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEdx = pLeaf->uEdx |= X86_CPUID_FEATURE_EDX_SEP;
             pVM->cpum.s.GuestFeatures.fSysEnter = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled SYSENTER/EXIT\n"));
             break;
@@ -2117,7 +1435,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
          * Assumes the caller knows what it's doing! (host must support these)
          */
         case CPUMCPUIDFEATURE_SYSCALL:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   !pLeaf
                 || !pVM->cpum.s.HostFeatures.fSysCall)
             {
@@ -2134,7 +1452,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
             }
 
             /* Valid for both Intel and AMD CPUs, although only in 64 bits mode for Intel. */
-            pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx |= X86_CPUID_EXT_FEATURE_EDX_SYSCALL;
+            pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx |= X86_CPUID_EXT_FEATURE_EDX_SYSCALL;
             pVM->cpum.s.GuestFeatures.fSysCall = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled SYSCALL/RET\n"));
             break;
@@ -2150,14 +1468,14 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
                 return;
             }
 
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].edx = pLeaf->uEdx |= X86_CPUID_FEATURE_EDX_PAE;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEdx = pLeaf->uEdx |= X86_CPUID_FEATURE_EDX_PAE;
 
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (    pLeaf
                 &&  pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
-                pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx |= X86_CPUID_AMD_FEATURE_EDX_PAE;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx |= X86_CPUID_AMD_FEATURE_EDX_PAE;
 
             pVM->cpum.s.GuestFeatures.fPae = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled PAE\n"));
@@ -2168,7 +1486,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
          * Assumes the caller knows what it's doing! (host must support these)
          */
         case CPUMCPUIDFEATURE_LONG_MODE:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   !pLeaf
                 || !pVM->cpum.s.HostFeatures.fLongMode)
             {
@@ -2177,7 +1495,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
             }
 
             /* Valid for both Intel and AMD. */
-            pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx |= X86_CPUID_EXT_FEATURE_EDX_LONG_MODE;
+            pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx |= X86_CPUID_EXT_FEATURE_EDX_LONG_MODE;
             pVM->cpum.s.GuestFeatures.fLongMode = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled LONG MODE\n"));
             break;
@@ -2187,7 +1505,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
          * Assumes the caller knows what it's doing! (host must support these)
          */
         case CPUMCPUIDFEATURE_NX:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   !pLeaf
                 || !pVM->cpum.s.HostFeatures.fNoExecute)
             {
@@ -2196,7 +1514,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
             }
 
             /* Valid for both Intel and AMD. */
-            pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx |= X86_CPUID_EXT_FEATURE_EDX_NX;
+            pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx |= X86_CPUID_EXT_FEATURE_EDX_NX;
             pVM->cpum.s.GuestFeatures.fNoExecute = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled NX\n"));
             break;
@@ -2207,7 +1525,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
          * Assumes the caller knows what it's doing! (host must support this)
          */
         case CPUMCPUIDFEATURE_LAHF:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   !pLeaf
                 || !pVM->cpum.s.HostFeatures.fLahfSahf)
             {
@@ -2216,7 +1534,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
             }
 
             /* Valid for both Intel and AMD. */
-            pVM->cpum.s.aGuestCpuIdExt[1].ecx = pLeaf->uEcx |= X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF;
+            pVM->cpum.s.aGuestCpuIdPatmExt[1].uEcx = pLeaf->uEcx |= X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF;
             pVM->cpum.s.GuestFeatures.fLahfSahf = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled LAHF/SAHF\n"));
             break;
@@ -2227,14 +1545,14 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
          * virtualized, though it may when passing thru device memory.
          */
         case CPUMCPUIDFEATURE_PAT:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].edx = pLeaf->uEdx |= X86_CPUID_FEATURE_EDX_PAT;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEdx = pLeaf->uEdx |= X86_CPUID_FEATURE_EDX_PAT;
 
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   pLeaf
                 && pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
-                pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx |= X86_CPUID_AMD_FEATURE_EDX_PAT;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx |= X86_CPUID_AMD_FEATURE_EDX_PAT;
 
             pVM->cpum.s.GuestFeatures.fPat = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled PAT\n"));
@@ -2245,7 +1563,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
          * Assumes the caller knows what it's doing! (host must support this)
          */
         case CPUMCPUIDFEATURE_RDTSCP:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   !pLeaf
                 || !pVM->cpum.s.HostFeatures.fRdTscP
                 || pVM->cpum.s.u8PortableCpuIdLevel > 0)
@@ -2256,7 +1574,7 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
             }
 
             /* Valid for both Intel and AMD. */
-            pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx |= X86_CPUID_EXT_FEATURE_EDX_RDTSCP;
+            pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx |= X86_CPUID_EXT_FEATURE_EDX_RDTSCP;
             pVM->cpum.s.HostFeatures.fRdTscP = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled RDTSCP.\n"));
             break;
@@ -2265,13 +1583,49 @@ VMMDECL(void) CPUMSetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
         * Set the Hypervisor Present bit in the standard feature mask.
         */
         case CPUMCPUIDFEATURE_HVP:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].ecx = pLeaf->uEcx |= X86_CPUID_FEATURE_ECX_HVP;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEcx = pLeaf->uEcx |= X86_CPUID_FEATURE_ECX_HVP;
             pVM->cpum.s.GuestFeatures.fHypervisorPresent = 1;
             LogRel(("CPUM: SetGuestCpuIdFeature: Enabled Hypervisor Present bit\n"));
             break;
 
+        /*
+         * Set the MWAIT Extensions Present bit in the MWAIT/MONITOR leaf.
+         * This currently includes the Present bit and MWAITBREAK bit as well.
+         */
+        case CPUMCPUIDFEATURE_MWAIT_EXTS:
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000005));
+            if (   !pLeaf
+                || !pVM->cpum.s.HostFeatures.fMWaitExtensions)
+            {
+                LogRel(("CPUM: WARNING! Can't turn on MWAIT Extensions when the host doesn't support it!\n"));
+                return;
+            }
+
+            /* Valid for both Intel and AMD. */
+            pVM->cpum.s.aGuestCpuIdPatmStd[5].uEcx = pLeaf->uEcx |= X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0;
+            pVM->cpum.s.GuestFeatures.fMWaitExtensions = 1;
+            LogRel(("CPUM: SetGuestCpuIdFeature: Enabled MWAIT Extensions.\n"));
+            break;
+
+        /*
+         * OSXSAVE - only used from CPUMSetGuestCR4.
+         */
+        case CPUMCPUIDFEATURE_OSXSAVE:
+            AssertLogRelReturnVoid(pVM->cpum.s.HostFeatures.fXSaveRstor && pVM->cpum.s.HostFeatures.fOpSysXSaveRstor);
+
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
+            AssertLogRelReturnVoid(pLeaf);
+
+            /* UNI: Special case for single CPU to make life simple for CPUMPatchHlpCpuId. */
+            if (pVM->cCpus == 1)
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEcx = pLeaf->uEcx |= X86_CPUID_FEATURE_ECX_OSXSAVE;
+            /* SMP: Set flag indicating OSXSAVE updating (superfluous because of the APIC ID, but that's fine). */
+            else
+                ASMAtomicOrU32(&pLeaf->fFlags, CPUMCPUIDLEAF_F_CONTAINS_OSXSAVE);
+            break;
+
         default:
             AssertMsgFailed(("enmFeature=%d\n", enmFeature));
             break;
@@ -2307,7 +1661,9 @@ VMMDECL(bool) CPUMGetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
         case CPUMCPUIDFEATURE_PAT:          return pVM->cpum.s.GuestFeatures.fPat;
         case CPUMCPUIDFEATURE_RDTSCP:       return pVM->cpum.s.GuestFeatures.fRdTscP;
         case CPUMCPUIDFEATURE_HVP:          return pVM->cpum.s.GuestFeatures.fHypervisorPresent;
+        case CPUMCPUIDFEATURE_MWAIT_EXTS:   return pVM->cpum.s.GuestFeatures.fMWaitExtensions;
 
+        case CPUMCPUIDFEATURE_OSXSAVE:
         case CPUMCPUIDFEATURE_INVALID:
         case CPUMCPUIDFEATURE_32BIT_HACK:
             break;
@@ -2329,84 +1685,108 @@ VMMDECL(void) CPUMClearGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature)
     switch (enmFeature)
     {
         case CPUMCPUIDFEATURE_APIC:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].edx = pLeaf->uEdx &= ~X86_CPUID_FEATURE_EDX_APIC;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEdx = pLeaf->uEdx &= ~X86_CPUID_FEATURE_EDX_APIC;
 
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   pLeaf
                 && pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
-                pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx &= ~X86_CPUID_AMD_FEATURE_EDX_APIC;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx &= ~X86_CPUID_AMD_FEATURE_EDX_APIC;
 
             pVM->cpum.s.GuestFeatures.fApic = 0;
             Log(("CPUM: ClearGuestCpuIdFeature: Disabled APIC\n"));
             break;
 
         case CPUMCPUIDFEATURE_X2APIC:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].ecx = pLeaf->uEcx &= ~X86_CPUID_FEATURE_ECX_X2APIC;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEcx = pLeaf->uEcx &= ~X86_CPUID_FEATURE_ECX_X2APIC;
             pVM->cpum.s.GuestFeatures.fX2Apic = 0;
             Log(("CPUM: ClearGuestCpuIdFeature: Disabled x2APIC\n"));
             break;
 
         case CPUMCPUIDFEATURE_PAE:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].edx = pLeaf->uEdx &= ~X86_CPUID_FEATURE_EDX_PAE;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEdx = pLeaf->uEdx &= ~X86_CPUID_FEATURE_EDX_PAE;
 
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   pLeaf
                 && pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
-                pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx &= ~X86_CPUID_AMD_FEATURE_EDX_PAE;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx &= ~X86_CPUID_AMD_FEATURE_EDX_PAE;
 
             pVM->cpum.s.GuestFeatures.fPae = 0;
             Log(("CPUM: ClearGuestCpuIdFeature: Disabled PAE!\n"));
             break;
 
         case CPUMCPUIDFEATURE_PAT:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].edx = pLeaf->uEdx &= ~X86_CPUID_FEATURE_EDX_PAT;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEdx = pLeaf->uEdx &= ~X86_CPUID_FEATURE_EDX_PAT;
 
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (   pLeaf
                 && pVM->cpum.s.GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
-                pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx &= ~X86_CPUID_AMD_FEATURE_EDX_PAT;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx &= ~X86_CPUID_AMD_FEATURE_EDX_PAT;
 
             pVM->cpum.s.GuestFeatures.fPat = 0;
             Log(("CPUM: ClearGuestCpuIdFeature: Disabled PAT!\n"));
             break;
 
         case CPUMCPUIDFEATURE_LONG_MODE:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx &= ~X86_CPUID_EXT_FEATURE_EDX_LONG_MODE;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx &= ~X86_CPUID_EXT_FEATURE_EDX_LONG_MODE;
             pVM->cpum.s.GuestFeatures.fLongMode = 0;
             break;
 
         case CPUMCPUIDFEATURE_LAHF:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdExt[1].ecx = pLeaf->uEcx &= ~X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEcx = pLeaf->uEcx &= ~X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF;
             pVM->cpum.s.GuestFeatures.fLahfSahf = 0;
             break;
 
         case CPUMCPUIDFEATURE_RDTSCP:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x80000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdExt[1].edx = pLeaf->uEdx &= ~X86_CPUID_EXT_FEATURE_EDX_RDTSCP;
+                pVM->cpum.s.aGuestCpuIdPatmExt[1].uEdx = pLeaf->uEdx &= ~X86_CPUID_EXT_FEATURE_EDX_RDTSCP;
             pVM->cpum.s.GuestFeatures.fRdTscP = 0;
             Log(("CPUM: ClearGuestCpuIdFeature: Disabled RDTSCP!\n"));
             break;
 
         case CPUMCPUIDFEATURE_HVP:
-            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001), 0);
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
             if (pLeaf)
-                pVM->cpum.s.aGuestCpuIdStd[1].ecx = pLeaf->uEcx &= ~X86_CPUID_FEATURE_ECX_HVP;
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEcx = pLeaf->uEcx &= ~X86_CPUID_FEATURE_ECX_HVP;
             pVM->cpum.s.GuestFeatures.fHypervisorPresent = 0;
             break;
 
+        case CPUMCPUIDFEATURE_MWAIT_EXTS:
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000005));
+            if (pLeaf)
+                pVM->cpum.s.aGuestCpuIdPatmStd[5].uEcx = pLeaf->uEcx &= ~(X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0);
+            pVM->cpum.s.GuestFeatures.fMWaitExtensions = 0;
+            Log(("CPUM: ClearGuestCpuIdFeature: Disabled MWAIT Extensions!\n"));
+            break;
+
+        /*
+         * OSXSAVE - only used from CPUMSetGuestCR4.
+         */
+        case CPUMCPUIDFEATURE_OSXSAVE:
+            AssertLogRelReturnVoid(pVM->cpum.s.HostFeatures.fXSaveRstor && pVM->cpum.s.HostFeatures.fOpSysXSaveRstor);
+
+            pLeaf = cpumCpuIdGetLeaf(pVM, UINT32_C(0x00000001));
+            AssertLogRelReturnVoid(pLeaf);
+
+            /* UNI: Special case for single CPU to make life easy for CPUMPatchHlpCpuId. */
+            if (pVM->cCpus == 1)
+                pVM->cpum.s.aGuestCpuIdPatmStd[1].uEcx = pLeaf->uEcx &= ~X86_CPUID_FEATURE_ECX_OSXSAVE;
+            /* else: SMP: We never set the OSXSAVE bit and leaving the CONTAINS_OSXSAVE flag is fine. */
+            break;
+
+
         default:
             AssertMsgFailed(("enmFeature=%d\n", enmFeature));
             break;
@@ -2760,6 +2140,63 @@ VMMDECL(int) CPUMRecalcHyperDRx(PVMCPU pVCpu, uint8_t iGstReg, bool fForceHyper)
 
 
 /**
+ * Set the guest XCR0 register.
+ *
+ * Will load additional state if the FPU state is already loaded (in ring-0 &
+ * raw-mode context).
+ *
+ * @returns VINF_SUCCESS on success, VERR_CPUM_RAISE_GP_0 on invalid input
+ *          value.
+ * @param   pVCpu       Pointer to the cross context VMCPU structure for the
+ *                      calling EMT.
+ * @param   uNewValue   The new value.
+ * @thread  EMT(pVCpu)
+ */
+VMM_INT_DECL(int)   CPUMSetGuestXcr0(PVMCPU pVCpu, uint64_t uNewValue)
+{
+    if (   (uNewValue & ~pVCpu->CTX_SUFF(pVM)->cpum.s.fXStateGuestMask) == 0
+        /* The X87 bit cannot be cleared. */
+        && (uNewValue & XSAVE_C_X87)
+        /* AVX requires SSE. */
+        && (uNewValue & (XSAVE_C_SSE | XSAVE_C_YMM)) != XSAVE_C_YMM
+        /* AVX-512 requires YMM, SSE and all of its three components to be enabled. */
+        && (   (uNewValue & (XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI)) == 0
+            ||    (uNewValue & (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI))
+               ==              (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI) )
+       )
+    {
+        pVCpu->cpum.s.Guest.aXcr[0] = uNewValue;
+
+        /* If more state components are enabled, we need to take care to load
+           them if the FPU/SSE state is already loaded.  May otherwise leak
+           host state to the guest. */
+        uint64_t fNewComponents = ~pVCpu->cpum.s.Guest.fXStateMask & uNewValue;
+        if (fNewComponents)
+        {
+#if defined(IN_RING0) || defined(IN_RC)
+            if (pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU)
+            {
+                if (pVCpu->cpum.s.Guest.fXStateMask != 0)
+                    /* Adding more components. */
+                    ASMXRstor(pVCpu->cpum.s.Guest.CTX_SUFF(pXState), fNewComponents);
+                else
+                {
+                    /* We're switching from FXSAVE/FXRSTOR to XSAVE/XRSTOR. */
+                    pVCpu->cpum.s.Guest.fXStateMask |= XSAVE_C_X87 | XSAVE_C_SSE;
+                    if (uNewValue & ~(XSAVE_C_X87 | XSAVE_C_SSE))
+                        ASMXRstor(pVCpu->cpum.s.Guest.CTX_SUFF(pXState), uNewValue & ~(XSAVE_C_X87 | XSAVE_C_SSE));
+                }
+            }
+#endif
+            pVCpu->cpum.s.Guest.fXStateMask |= uNewValue;
+        }
+        return VINF_SUCCESS;
+    }
+    return VERR_CPUM_RAISE_GP_0;
+}
+
+
+/**
  * Tests if the guest has No-Execute Page Protection Enabled (NXE).
  *
  * @returns true if in real mode, otherwise false.
@@ -2932,69 +2369,67 @@ VMM_INT_DECL(bool) CPUMIsGuestInRawMode(PVMCPU pVCpu)
  *
  * @returns VBox status. (recompiler failure)
  * @param   pVCpu       Pointer to the VMCPU.
- * @param   pCtxCore    The context core (for trap usage).
  * @see     @ref pg_raw
  */
-VMM_INT_DECL(int) CPUMRawEnter(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore)
+VMM_INT_DECL(int) CPUMRawEnter(PVMCPU pVCpu)
 {
     PVM pVM = pVCpu->CTX_SUFF(pVM);
 
     Assert(!pVCpu->cpum.s.fRawEntered);
     Assert(!pVCpu->cpum.s.fRemEntered);
-    if (!pCtxCore)
-        pCtxCore = CPUMCTX2CORE(&pVCpu->cpum.s.Guest);
+    PCPUMCTX pCtx = &pVCpu->cpum.s.Guest;
 
     /*
      * Are we in Ring-0?
      */
-    if (    pCtxCore->ss.Sel
-        &&  (pCtxCore->ss.Sel & X86_SEL_RPL) == 0
-        &&  !pCtxCore->eflags.Bits.u1VM)
+    if (    pCtx->ss.Sel
+        &&  (pCtx->ss.Sel & X86_SEL_RPL) == 0
+        &&  !pCtx->eflags.Bits.u1VM)
     {
         /*
          * Enter execution mode.
          */
-        PATMRawEnter(pVM, pCtxCore);
+        PATMRawEnter(pVM, pCtx);
 
         /*
          * Set CPL to Ring-1.
          */
-        pCtxCore->ss.Sel |= 1;
-        if (    pCtxCore->cs.Sel
-            &&  (pCtxCore->cs.Sel & X86_SEL_RPL) == 0)
-            pCtxCore->cs.Sel |= 1;
+        pCtx->ss.Sel |= 1;
+        if (    pCtx->cs.Sel
+            &&  (pCtx->cs.Sel & X86_SEL_RPL) == 0)
+            pCtx->cs.Sel |= 1;
     }
     else
     {
 # ifdef VBOX_WITH_RAW_RING1
         if (    EMIsRawRing1Enabled(pVM)
-            &&  !pCtxCore->eflags.Bits.u1VM
-            &&  (pCtxCore->ss.Sel & X86_SEL_RPL) == 1)
+            &&  !pCtx->eflags.Bits.u1VM
+            &&  (pCtx->ss.Sel & X86_SEL_RPL) == 1)
         {
             /* Set CPL to Ring-2. */
-            pCtxCore->ss.Sel = (pCtxCore->ss.Sel & ~X86_SEL_RPL) | 2;
-            if (pCtxCore->cs.Sel && (pCtxCore->cs.Sel & X86_SEL_RPL) == 1)
-                pCtxCore->cs.Sel = (pCtxCore->cs.Sel & ~X86_SEL_RPL) | 2;
+            pCtx->ss.Sel = (pCtx->ss.Sel & ~X86_SEL_RPL) | 2;
+            if (pCtx->cs.Sel && (pCtx->cs.Sel & X86_SEL_RPL) == 1)
+                pCtx->cs.Sel = (pCtx->cs.Sel & ~X86_SEL_RPL) | 2;
         }
 # else
-        AssertMsg((pCtxCore->ss.Sel & X86_SEL_RPL) >= 2 || pCtxCore->eflags.Bits.u1VM,
+        AssertMsg((pCtx->ss.Sel & X86_SEL_RPL) >= 2 || pCtx->eflags.Bits.u1VM,
                   ("ring-1 code not supported\n"));
 # endif
         /*
          * PATM takes care of IOPL and IF flags for Ring-3 and Ring-2 code as well.
          */
-        PATMRawEnter(pVM, pCtxCore);
+        PATMRawEnter(pVM, pCtx);
     }
 
     /*
      * Assert sanity.
      */
-    AssertMsg((pCtxCore->eflags.u32 & X86_EFL_IF), ("X86_EFL_IF is clear\n"));
-    AssertReleaseMsg(pCtxCore->eflags.Bits.u2IOPL == 0,
-                     ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss.Sel & X86_SEL_RPL));
+    AssertMsg((pCtx->eflags.u32 & X86_EFL_IF), ("X86_EFL_IF is clear\n"));
+    AssertReleaseMsg(pCtx->eflags.Bits.u2IOPL == 0,
+                     ("X86_EFL_IOPL=%d CPL=%d\n", pCtx->eflags.Bits.u2IOPL, pCtx->ss.Sel & X86_SEL_RPL));
     Assert((pVCpu->cpum.s.Guest.cr0 & (X86_CR0_PG | X86_CR0_WP | X86_CR0_PE)) == (X86_CR0_PG | X86_CR0_PE | X86_CR0_WP));
 
-    pCtxCore->eflags.u32        |= X86_EFL_IF; /* paranoia */
+    pCtx->eflags.u32        |= X86_EFL_IF; /* paranoia */
 
     pVCpu->cpum.s.fRawEntered = true;
     return VINF_SUCCESS;
@@ -3009,10 +2444,9 @@ VMM_INT_DECL(int) CPUMRawEnter(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore)
  * @returns Adjusted rc.
  * @param   pVCpu       Pointer to the VMCPU.
  * @param   rc          Raw mode return code
- * @param   pCtxCore    The context core (for trap usage).
  * @see     @ref pg_raw
  */
-VMM_INT_DECL(int) CPUMRawLeave(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, int rc)
+VMM_INT_DECL(int) CPUMRawLeave(PVMCPU pVCpu, int rc)
 {
     PVM pVM = pVCpu->CTX_SUFF(pVM);
 
@@ -3025,82 +2459,80 @@ VMM_INT_DECL(int) CPUMRawLeave(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, int rc)
     pVCpu->cpum.s.fRawEntered = false;
 
     PCPUMCTX pCtx = &pVCpu->cpum.s.Guest;
-    if (!pCtxCore)
-        pCtxCore = CPUMCTX2CORE(pCtx);
-    Assert(pCtxCore->eflags.Bits.u1VM || (pCtxCore->ss.Sel & X86_SEL_RPL));
-    AssertMsg(pCtxCore->eflags.Bits.u1VM || pCtxCore->eflags.Bits.u2IOPL < (unsigned)(pCtxCore->ss.Sel & X86_SEL_RPL),
-              ("X86_EFL_IOPL=%d CPL=%d\n", pCtxCore->eflags.Bits.u2IOPL, pCtxCore->ss.Sel & X86_SEL_RPL));
+    Assert(pCtx->eflags.Bits.u1VM || (pCtx->ss.Sel & X86_SEL_RPL));
+    AssertMsg(pCtx->eflags.Bits.u1VM || pCtx->eflags.Bits.u2IOPL < (unsigned)(pCtx->ss.Sel & X86_SEL_RPL),
+              ("X86_EFL_IOPL=%d CPL=%d\n", pCtx->eflags.Bits.u2IOPL, pCtx->ss.Sel & X86_SEL_RPL));
 
     /*
      * Are we executing in raw ring-1?
      */
-    if (    (pCtxCore->ss.Sel & X86_SEL_RPL) == 1
-        &&  !pCtxCore->eflags.Bits.u1VM)
+    if (    (pCtx->ss.Sel & X86_SEL_RPL) == 1
+        &&  !pCtx->eflags.Bits.u1VM)
     {
         /*
          * Leave execution mode.
          */
-        PATMRawLeave(pVM, pCtxCore, rc);
+        PATMRawLeave(pVM, pCtx, rc);
         /* Not quite sure if this is really required, but shouldn't harm (too much anyways). */
         /** @todo See what happens if we remove this. */
-        if ((pCtxCore->ds.Sel & X86_SEL_RPL) == 1)
-            pCtxCore->ds.Sel &= ~X86_SEL_RPL;
-        if ((pCtxCore->es.Sel & X86_SEL_RPL) == 1)
-            pCtxCore->es.Sel &= ~X86_SEL_RPL;
-        if ((pCtxCore->fs.Sel & X86_SEL_RPL) == 1)
-            pCtxCore->fs.Sel &= ~X86_SEL_RPL;
-        if ((pCtxCore->gs.Sel & X86_SEL_RPL) == 1)
-            pCtxCore->gs.Sel &= ~X86_SEL_RPL;
+        if ((pCtx->ds.Sel & X86_SEL_RPL) == 1)
+            pCtx->ds.Sel &= ~X86_SEL_RPL;
+        if ((pCtx->es.Sel & X86_SEL_RPL) == 1)
+            pCtx->es.Sel &= ~X86_SEL_RPL;
+        if ((pCtx->fs.Sel & X86_SEL_RPL) == 1)
+            pCtx->fs.Sel &= ~X86_SEL_RPL;
+        if ((pCtx->gs.Sel & X86_SEL_RPL) == 1)
+            pCtx->gs.Sel &= ~X86_SEL_RPL;
 
         /*
          * Ring-1 selector => Ring-0.
          */
-        pCtxCore->ss.Sel &= ~X86_SEL_RPL;
-        if ((pCtxCore->cs.Sel & X86_SEL_RPL) == 1)
-            pCtxCore->cs.Sel &= ~X86_SEL_RPL;
+        pCtx->ss.Sel &= ~X86_SEL_RPL;
+        if ((pCtx->cs.Sel & X86_SEL_RPL) == 1)
+            pCtx->cs.Sel &= ~X86_SEL_RPL;
     }
     else
     {
         /*
          * PATM is taking care of the IOPL and IF flags for us.
          */
-        PATMRawLeave(pVM, pCtxCore, rc);
-        if (!pCtxCore->eflags.Bits.u1VM)
+        PATMRawLeave(pVM, pCtx, rc);
+        if (!pCtx->eflags.Bits.u1VM)
         {
 # ifdef VBOX_WITH_RAW_RING1
             if (    EMIsRawRing1Enabled(pVM)
-                &&  (pCtxCore->ss.Sel & X86_SEL_RPL) == 2)
+                &&  (pCtx->ss.Sel & X86_SEL_RPL) == 2)
             {
                 /* Not quite sure if this is really required, but shouldn't harm (too much anyways). */
                 /** @todo See what happens if we remove this. */
-                if ((pCtxCore->ds.Sel & X86_SEL_RPL) == 2)
-                    pCtxCore->ds.Sel = (pCtxCore->ds.Sel & ~X86_SEL_RPL) | 1;
-                if ((pCtxCore->es.Sel & X86_SEL_RPL) == 2)
-                    pCtxCore->es.Sel = (pCtxCore->es.Sel & ~X86_SEL_RPL) | 1;
-                if ((pCtxCore->fs.Sel & X86_SEL_RPL) == 2)
-                    pCtxCore->fs.Sel = (pCtxCore->fs.Sel & ~X86_SEL_RPL) | 1;
-                if ((pCtxCore->gs.Sel & X86_SEL_RPL) == 2)
-                    pCtxCore->gs.Sel = (pCtxCore->gs.Sel & ~X86_SEL_RPL) | 1;
+                if ((pCtx->ds.Sel & X86_SEL_RPL) == 2)
+                    pCtx->ds.Sel = (pCtx->ds.Sel & ~X86_SEL_RPL) | 1;
+                if ((pCtx->es.Sel & X86_SEL_RPL) == 2)
+                    pCtx->es.Sel = (pCtx->es.Sel & ~X86_SEL_RPL) | 1;
+                if ((pCtx->fs.Sel & X86_SEL_RPL) == 2)
+                    pCtx->fs.Sel = (pCtx->fs.Sel & ~X86_SEL_RPL) | 1;
+                if ((pCtx->gs.Sel & X86_SEL_RPL) == 2)
+                    pCtx->gs.Sel = (pCtx->gs.Sel & ~X86_SEL_RPL) | 1;
 
                 /*
                  * Ring-2 selector => Ring-1.
                  */
-                pCtxCore->ss.Sel = (pCtxCore->ss.Sel & ~X86_SEL_RPL) | 1;
-                if ((pCtxCore->cs.Sel & X86_SEL_RPL) == 2)
-                    pCtxCore->cs.Sel = (pCtxCore->cs.Sel & ~X86_SEL_RPL) | 1;
+                pCtx->ss.Sel = (pCtx->ss.Sel & ~X86_SEL_RPL) | 1;
+                if ((pCtx->cs.Sel & X86_SEL_RPL) == 2)
+                    pCtx->cs.Sel = (pCtx->cs.Sel & ~X86_SEL_RPL) | 1;
             }
             else
             {
 # endif
                 /** @todo See what happens if we remove this. */
-                if ((pCtxCore->ds.Sel & X86_SEL_RPL) == 1)
-                    pCtxCore->ds.Sel &= ~X86_SEL_RPL;
-                if ((pCtxCore->es.Sel & X86_SEL_RPL) == 1)
-                    pCtxCore->es.Sel &= ~X86_SEL_RPL;
-                if ((pCtxCore->fs.Sel & X86_SEL_RPL) == 1)
-                    pCtxCore->fs.Sel &= ~X86_SEL_RPL;
-                if ((pCtxCore->gs.Sel & X86_SEL_RPL) == 1)
-                    pCtxCore->gs.Sel &= ~X86_SEL_RPL;
+                if ((pCtx->ds.Sel & X86_SEL_RPL) == 1)
+                    pCtx->ds.Sel &= ~X86_SEL_RPL;
+                if ((pCtx->es.Sel & X86_SEL_RPL) == 1)
+                    pCtx->es.Sel &= ~X86_SEL_RPL;
+                if ((pCtx->fs.Sel & X86_SEL_RPL) == 1)
+                    pCtx->fs.Sel &= ~X86_SEL_RPL;
+                if ((pCtx->gs.Sel & X86_SEL_RPL) == 1)
+                    pCtx->gs.Sel &= ~X86_SEL_RPL;
 # ifdef VBOX_WITH_RAW_RING1
             }
 # endif
@@ -3122,7 +2554,7 @@ VMMDECL(void) CPUMRawSetEFlags(PVMCPU pVCpu, uint32_t fEfl)
 {
 #ifdef VBOX_WITH_RAW_MODE_NOT_R0
     if (pVCpu->cpum.s.fRawEntered)
-        PATMRawSetEFlags(pVCpu->CTX_SUFF(pVM), CPUMCTX2CORE(&pVCpu->cpum.s.Guest), fEfl);
+        PATMRawSetEFlags(pVCpu->CTX_SUFF(pVM), &pVCpu->cpum.s.Guest, fEfl);
     else
 #endif
         pVCpu->cpum.s.Guest.eflags.u32 = fEfl;
@@ -3139,7 +2571,7 @@ VMMDECL(uint32_t) CPUMRawGetEFlags(PVMCPU pVCpu)
 {
 #ifdef VBOX_WITH_RAW_MODE_NOT_R0
     if (pVCpu->cpum.s.fRawEntered)
-        return PATMRawGetEFlags(pVCpu->CTX_SUFF(pVM), CPUMCTX2CORE(&pVCpu->cpum.s.Guest));
+        return PATMRawGetEFlags(pVCpu->CTX_SUFF(pVM), &pVCpu->cpum.s.Guest);
 #endif
     return pVCpu->cpum.s.Guest.eflags.u32;
 }
@@ -3157,14 +2589,15 @@ VMMDECL(void) CPUMSetChangedFlags(PVMCPU pVCpu, uint32_t fChangedFlags)
 
 
 /**
- * Checks if the CPU supports the FXSAVE and FXRSTOR instruction.
+ * Checks if the CPU supports the XSAVE and XRSTOR instruction.
+ *
  * @returns true if supported.
  * @returns false if not supported.
  * @param   pVM     Pointer to the VM.
  */
-VMMDECL(bool) CPUMSupportsFXSR(PVM pVM)
+VMMDECL(bool) CPUMSupportsXSave(PVM pVM)
 {
-    return pVM->cpum.s.CPUFeatures.edx.u1FXSR != 0;
+    return pVM->cpum.s.HostFeatures.fXSaveRstor != 0;
 }
 
 
@@ -3219,20 +2652,6 @@ VMMDECL(bool) CPUMIsGuestFPUStateActive(PVMCPU pVCpu)
 
 
 /**
- * Deactivate the FPU/XMM state of the guest OS.
- * @param   pVCpu       Pointer to the VMCPU.
- *
- * @todo    r=bird: Why is this needed? Looks like a workaround for mishandled
- *          FPU state management.
- */
-VMMDECL(void) CPUMDeactivateGuestFPUState(PVMCPU pVCpu)
-{
-    Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU));
-    pVCpu->cpum.s.fUseFlags &= ~CPUM_USED_FPU;
-}
-
-
-/**
  * Checks if the guest debug state is active.
  *
  * @returns boolean
diff --git a/src/VBox/VMM/VMMAll/CPUMStack.cpp b/src/VBox/VMM/VMMAll/CPUMStack.cpp
index 2d9ba00..9c1cc17 100644
--- a/src/VBox/VMM/VMMAll/CPUMStack.cpp
+++ b/src/VBox/VMM/VMMAll/CPUMStack.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/VMM/VMMAll/EMAll.cpp b/src/VBox/VMM/VMMAll/EMAll.cpp
index 4c4a595..860b260 100644
--- a/src/VBox/VMM/VMMAll/EMAll.cpp
+++ b/src/VBox/VMM/VMMAll/EMAll.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -189,6 +189,7 @@ VMM_INT_DECL(int) EMMonitorWaitPrepare(PVMCPU pVCpu, uint64_t rax, uint64_t rcx,
     pVCpu->em.s.MWait.uMonitorRDX = rdx;
     pVCpu->em.s.MWait.fWait |= EMMWAIT_FLAG_MONITOR_ACTIVE;
     /** @todo Make use of GCPhys. */
+    NOREF(GCPhys);
     /** @todo Complete MONITOR implementation.  */
     return VINF_SUCCESS;
 }
@@ -418,6 +419,7 @@ static DECLCALLBACK(int) emReadBytes(PDISCPUSTATE pDis, uint8_t offInstr, uint8_
 
 DECLINLINE(int) emDisCoreOne(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, RTGCUINTPTR InstrGC, uint32_t *pOpsize)
 {
+    NOREF(pVM);
     return DISInstrWithReader(InstrGC, (DISCPUMODE)pDis->uCpuMode, emReadBytes, pVCpu, pDis, pOpsize);
 }
 
@@ -471,6 +473,7 @@ VMM_INT_DECL(int) EMInterpretDisasCurrent(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pD
 VMM_INT_DECL(int) EMInterpretDisasOneEx(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore,
                                         PDISCPUSTATE pDis, unsigned *pcbInstr)
 {
+    NOREF(pVM);
     Assert(pCtxCore == CPUMGetGuestCtxCore(pVCpu));
     DISCPUMODE enmCpuMode = CPUMGetGuestDisMode(pVCpu);
     /** @todo Deal with too long instruction (=> \#GP), opcode read errors (=>
@@ -1210,17 +1213,18 @@ static int emInterpretIret(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCOR
 VMM_INT_DECL(int) EMInterpretCpuId(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)
 {
     Assert(pRegFrame == CPUMGetGuestCtxCore(pVCpu));
-    uint32_t iLeaf = pRegFrame->eax;
+    uint32_t iLeaf    = pRegFrame->eax;
+    uint32_t iSubLeaf = pRegFrame->ecx;
     NOREF(pVM);
 
     /* cpuid clears the high dwords of the affected 64 bits registers. */
     pRegFrame->rax = 0;
     pRegFrame->rbx = 0;
-    pRegFrame->rcx &= UINT64_C(0x00000000ffffffff);
+    pRegFrame->rcx = 0;
     pRegFrame->rdx = 0;
 
     /* Note: operates the same in 64 and non-64 bits mode. */
-    CPUMGetGuestCpuId(pVCpu, iLeaf, &pRegFrame->eax, &pRegFrame->ebx, &pRegFrame->ecx, &pRegFrame->edx);
+    CPUMGetGuestCpuId(pVCpu, iLeaf, iSubLeaf, &pRegFrame->eax, &pRegFrame->ebx, &pRegFrame->ecx, &pRegFrame->edx);
     Log(("Emulate: CPUID %x -> %08x %08x %08x %08x\n", iLeaf, pRegFrame->eax, pRegFrame->ebx, pRegFrame->ecx, pRegFrame->edx));
     return VINF_SUCCESS;
 }
@@ -1288,7 +1292,7 @@ VMM_INT_DECL(int) EMInterpretRdtscp(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
     g_fIgnoreRaxRdx = true;
 #endif
     /* Low dword of the TSC_AUX msr only. */
-    CPUMQueryGuestMsr(pVCpu, MSR_K8_TSC_AUX, &pCtx->rcx);
+    VBOXSTRICTRC rc2 = CPUMQueryGuestMsr(pVCpu, MSR_K8_TSC_AUX, &pCtx->rcx); Assert(rc2 == VINF_SUCCESS);
     pCtx->rcx &= UINT32_C(0xffffffff);
 
     return VINF_SUCCESS;
@@ -1341,7 +1345,7 @@ VMM_INT_DECL(VBOXSTRICTRC) EMInterpretMWait(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE
     if (cpl != 0)
         return VERR_EM_INTERPRETER; /* supervisor only */
 
-    CPUMGetGuestCpuId(pVCpu, 1, &u32Dummy, &u32Dummy, &u32ExtFeatures, &u32Dummy);
+    CPUMGetGuestCpuId(pVCpu, 1, 0, &u32Dummy, &u32Dummy, &u32ExtFeatures, &u32Dummy);
     if (!(u32ExtFeatures & X86_CPUID_FEATURE_ECX_MONITOR))
         return VERR_EM_INTERPRETER; /* not supported */
 
@@ -1349,7 +1353,7 @@ VMM_INT_DECL(VBOXSTRICTRC) EMInterpretMWait(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE
      * CPUID.05H.ECX[0] defines support for power management extensions (eax)
      * CPUID.05H.ECX[1] defines support for interrupts as break events for mwait even when IF=0
      */
-    CPUMGetGuestCpuId(pVCpu, 5, &u32Dummy, &u32Dummy, &u32MWaitFeatures, &u32Dummy);
+    CPUMGetGuestCpuId(pVCpu, 5, 0, &u32Dummy, &u32Dummy, &u32MWaitFeatures, &u32Dummy);
     if (pRegFrame->ecx > 1)
     {
         Log(("EMInterpretMWait: unexpected ecx value %x -> recompiler\n", pRegFrame->ecx));
@@ -1386,7 +1390,7 @@ VMM_INT_DECL(int) EMInterpretMonitor(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFra
     if (cpl != 0)
         return VERR_EM_INTERPRETER; /* supervisor only */
 
-    CPUMGetGuestCpuId(pVCpu, 1, &u32Dummy, &u32Dummy, &u32ExtFeatures, &u32Dummy);
+    CPUMGetGuestCpuId(pVCpu, 1, 0, &u32Dummy, &u32Dummy, &u32ExtFeatures, &u32Dummy);
     if (!(u32ExtFeatures & X86_CPUID_FEATURE_ECX_MONITOR))
         return VERR_EM_INTERPRETER; /* not supported */
 
@@ -1443,11 +1447,12 @@ static int emUpdateCRx(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t D
 {
     uint64_t oldval;
     uint64_t msrEFER;
+    uint32_t fValid;
     int      rc, rc2;
     NOREF(pVM);
 
     /** @todo Clean up this mess. */
-    LogFlow(("EMInterpretCRxWrite at %RGv CR%d <- %RX64\n", (RTGCPTR)pRegFrame->rip, DestRegCrx, val));
+    LogFlow(("emInterpretCRxWrite at %RGv CR%d <- %RX64\n", (RTGCPTR)pRegFrame->rip, DestRegCrx, val));
     Assert(pRegFrame == CPUMGetGuestCtxCore(pVCpu));
     switch (DestRegCrx)
     {
@@ -1537,6 +1542,24 @@ static int emUpdateCRx(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t D
             return VERR_EM_INTERPRETER; /** @todo generate #GP(0) */
         }
 
+        /* From IEM iemCImpl_load_CrX. */
+        /** @todo Check guest CPUID bits for determining corresponding valid bits. */
+        fValid = X86_CR4_VME | X86_CR4_PVI
+               | X86_CR4_TSD | X86_CR4_DE
+               | X86_CR4_PSE | X86_CR4_PAE
+               | X86_CR4_MCE | X86_CR4_PGE
+               | X86_CR4_PCE | X86_CR4_OSFXSR
+               | X86_CR4_OSXMMEEXCPT;
+        //if (xxx)
+        //    fValid |= X86_CR4_VMXE;
+        //if (xxx)
+        //    fValid |= X86_CR4_OSXSAVE;
+        if (val & ~(uint64_t)fValid)
+        {
+            Log(("Trying to set reserved CR4 bits: NewCR4=%#llx InvalidBits=%#llx\n", val, val & ~(uint64_t)fValid));
+            return VERR_EM_INTERPRETER; /** @todo generate #GP(0) */
+        }
+
         rc = VINF_SUCCESS;
         if (    (oldval & (X86_CR4_PGE|X86_CR4_PAE|X86_CR4_PSE))
             !=  (val    & (X86_CR4_PGE|X86_CR4_PAE|X86_CR4_PSE)))
@@ -1548,8 +1571,8 @@ static int emUpdateCRx(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t D
 
         /* Feeling extremely lazy. */
 # ifdef IN_RC
-        if (    (oldval & (X86_CR4_OSFSXR|X86_CR4_OSXMMEEXCPT|X86_CR4_PCE|X86_CR4_MCE|X86_CR4_PAE|X86_CR4_DE|X86_CR4_TSD|X86_CR4_PVI|X86_CR4_VME))
-            !=  (val    & (X86_CR4_OSFSXR|X86_CR4_OSXMMEEXCPT|X86_CR4_PCE|X86_CR4_MCE|X86_CR4_PAE|X86_CR4_DE|X86_CR4_TSD|X86_CR4_PVI|X86_CR4_VME)))
+        if (    (oldval & (X86_CR4_OSFXSR|X86_CR4_OSXMMEEXCPT|X86_CR4_PCE|X86_CR4_MCE|X86_CR4_PAE|X86_CR4_DE|X86_CR4_TSD|X86_CR4_PVI|X86_CR4_VME))
+            !=  (val    & (X86_CR4_OSFXSR|X86_CR4_OSXMMEEXCPT|X86_CR4_PCE|X86_CR4_MCE|X86_CR4_PAE|X86_CR4_DE|X86_CR4_TSD|X86_CR4_PVI|X86_CR4_VME)))
         {
             Log(("emInterpretMovCRx: CR4: %#RX64->%#RX64 => R3\n", oldval, val));
             VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3);
@@ -1586,7 +1609,7 @@ static int emUpdateCRx(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t D
  * @param   SrcRegGen   General purpose register index (USE_REG_E**))
  *
  */
-VMM_INT_DECL(int) EMInterpretCRxWrite(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegCrx, uint32_t SrcRegGen)
+static int emInterpretCRxWrite(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegCrx, uint32_t SrcRegGen)
 {
     uint64_t val;
     int      rc;
@@ -1607,47 +1630,6 @@ VMM_INT_DECL(int) EMInterpretCRxWrite(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFr
     return VERR_EM_INTERPRETER;
 }
 
-/**
- * Interpret LMSW.
- *
- * @returns VBox status code.
- * @param   pVM         Pointer to the VM.
- * @param   pVCpu       Pointer to the VMCPU.
- * @param   pRegFrame   The register frame.
- * @param   u16Data     LMSW source data.
- *
- */
-VMM_INT_DECL(int) EMInterpretLMSW(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint16_t u16Data)
-{
-    Assert(pRegFrame == CPUMGetGuestCtxCore(pVCpu));
-    uint64_t OldCr0 = CPUMGetGuestCR0(pVCpu);
-
-    /* Only PE, MP, EM and TS can be changed; note that PE can't be cleared by this instruction. */
-    uint64_t NewCr0 = ( OldCr0 & ~(             X86_CR0_MP | X86_CR0_EM | X86_CR0_TS))
-                    | (u16Data &  (X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS));
-
-    return emUpdateCRx(pVM, pVCpu, pRegFrame, DISCREG_CR0, NewCr0);
-}
-
-
-/**
- * Interpret CLTS.
- *
- * @returns VBox status code.
- * @param   pVM         Pointer to the VM.
- * @param   pVCpu       Pointer to the VMCPU.
- *
- */
-VMM_INT_DECL(int) EMInterpretCLTS(PVM pVM, PVMCPU pVCpu)
-{
-    NOREF(pVM);
-
-    uint64_t cr0 = CPUMGetGuestCR0(pVCpu);
-    if (!(cr0 & X86_CR0_TS))
-        return VINF_SUCCESS;
-    return CPUMSetGuestCR0(pVCpu, cr0 & ~X86_CR0_TS);
-}
-
 
 #ifdef LOG_ENABLED
 static const char *emMSRtoString(uint32_t uMsr)
@@ -1723,17 +1705,17 @@ VMM_INT_DECL(int) EMInterpretRdmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame
     }
 
     uint64_t uValue;
-    int rc = CPUMQueryGuestMsr(pVCpu, pRegFrame->ecx, &uValue);
-    if (RT_UNLIKELY(rc != VINF_SUCCESS))
+    VBOXSTRICTRC rcStrict = CPUMQueryGuestMsr(pVCpu, pRegFrame->ecx, &uValue);
+    if (RT_UNLIKELY(rcStrict != VINF_SUCCESS))
     {
-        Assert(rc == VERR_CPUM_RAISE_GP_0);
-        Log4(("EM: Refuse RDMSR: rc=%Rrc\n", rc));
+        Log4(("EM: Refuse RDMSR: rc=%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
+        Assert(rcStrict == VERR_CPUM_RAISE_GP_0 || rcStrict == VERR_EM_INTERPRETER || rcStrict == VINF_CPUM_R3_MSR_READ);
         return VERR_EM_INTERPRETER;
     }
     pRegFrame->rax = (uint32_t) uValue;
     pRegFrame->rdx = (uint32_t)(uValue >> 32);
     LogFlow(("EMInterpretRdmsr %s (%x) -> %RX64\n", emMSRtoString(pRegFrame->ecx), pRegFrame->ecx, uValue));
-    return rc;
+    return VINF_SUCCESS;
 }
 
 
@@ -1756,17 +1738,17 @@ VMM_INT_DECL(int) EMInterpretWrmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame
         return VERR_EM_INTERPRETER; /** @todo raise \#GP(0) */
     }
 
-    int rc = CPUMSetGuestMsr(pVCpu, pRegFrame->ecx, RT_MAKE_U64(pRegFrame->eax, pRegFrame->edx));
-    if (rc != VINF_SUCCESS)
+    VBOXSTRICTRC rcStrict = CPUMSetGuestMsr(pVCpu, pRegFrame->ecx, RT_MAKE_U64(pRegFrame->eax, pRegFrame->edx));
+    if (rcStrict != VINF_SUCCESS)
     {
-        Assert(rc == VERR_CPUM_RAISE_GP_0);
-        Log4(("EM: Refuse WRMSR: rc=%d\n", rc));
+        Log4(("EM: Refuse WRMSR: CPUMSetGuestMsr returned %Rrc\n",  VBOXSTRICTRC_VAL(rcStrict)));
+        Assert(rcStrict == VERR_CPUM_RAISE_GP_0 || rcStrict == VERR_EM_INTERPRETER || rcStrict == VINF_CPUM_R3_MSR_WRITE);
         return VERR_EM_INTERPRETER;
     }
     LogFlow(("EMInterpretWrmsr %s (%x) val=%RX64\n", emMSRtoString(pRegFrame->ecx), pRegFrame->ecx,
              RT_MAKE_U64(pRegFrame->eax, pRegFrame->edx)));
     NOREF(pVM);
-    return rc;
+    return VINF_SUCCESS;
 }
 
 
@@ -1781,7 +1763,7 @@ VMM_INT_DECL(int) EMInterpretWrmsr(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame
  * @param   SrcRegCRx   CRx register index (DISUSE_REG_CR*)
  *
  */
-VMM_INT_DECL(int) EMInterpretCRxRead(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegGen, uint32_t SrcRegCrx)
+static int emInterpretCRxRead(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t DestRegGen, uint32_t SrcRegCrx)
 {
     Assert(pRegFrame == CPUMGetGuestCtxCore(pVCpu));
     uint64_t val64;
@@ -2730,6 +2712,12 @@ static int emInterpretMov(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE
     if(RT_FAILURE(rc))
         return VERR_EM_INTERPRETER;
 
+    /* If destination is a segment register, punt. We can't handle it here.
+     * NB: Source can be a register and still trigger a #PF!
+     */
+    if (RT_UNLIKELY(pDis->Param1.fUse == DISUSE_REG_SEG))
+        return VERR_EM_INTERPRETER;
+
     if (param1.type == DISQPV_TYPE_ADDRESS)
     {
         RTGCPTR pDest;
@@ -3321,8 +3309,12 @@ static int emInterpretCpuId(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCO
  */
 static int emInterpretClts(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
 {
-    NOREF(pDis); NOREF(pRegFrame); NOREF(pvFault); NOREF(pcbSize);
-    return EMInterpretCLTS(pVM, pVCpu);
+    NOREF(pVM); NOREF(pDis); NOREF(pRegFrame); NOREF(pvFault); NOREF(pcbSize);
+
+    uint64_t cr0 = CPUMGetGuestCR0(pVCpu);
+    if (!(cr0 & X86_CR0_TS))
+        return VINF_SUCCESS;
+    return CPUMSetGuestCR0(pVCpu, cr0 & ~X86_CR0_TS);
 }
 
 
@@ -3334,6 +3326,7 @@ static int emInterpretLmsw(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCOR
     DISQPVPARAMVAL param1;
     uint32_t    val;
     NOREF(pvFault); NOREF(pcbSize);
+    Assert(pRegFrame == CPUMGetGuestCtxCore(pVCpu));
 
     int rc = DISQueryParamVal(pRegFrame, pDis, &pDis->Param1, &param1, DISQPVWHICH_SRC);
     if(RT_FAILURE(rc))
@@ -3353,7 +3346,14 @@ static int emInterpretLmsw(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCOR
     }
 
     LogFlow(("emInterpretLmsw %x\n", val));
-    return EMInterpretLMSW(pVM, pVCpu, pRegFrame, val);
+    uint64_t OldCr0 = CPUMGetGuestCR0(pVCpu);
+
+    /* Only PE, MP, EM and TS can be changed; note that PE can't be cleared by this instruction. */
+    uint64_t NewCr0 = ( OldCr0 & ~(             X86_CR0_MP | X86_CR0_EM | X86_CR0_TS))
+                    | (val     &  (X86_CR0_PE | X86_CR0_MP | X86_CR0_EM | X86_CR0_TS));
+
+    return emUpdateCRx(pVM, pVCpu, pRegFrame, DISCREG_CR0, NewCr0);
+
 }
 
 #ifdef EM_EMULATE_SMSW
@@ -3362,6 +3362,7 @@ static int emInterpretLmsw(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCOR
  */
 static int emInterpretSmsw(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)
 {
+    NOREF(pvFault); NOREF(pcbSize);
     DISQPVPARAMVAL param1;
     uint64_t    cr0 = CPUMGetGuestCR0(pVCpu);
 
@@ -3415,10 +3416,10 @@ static int emInterpretMovCRx(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXC
 {
     NOREF(pvFault); NOREF(pcbSize);
     if ((pDis->Param1.fUse == DISUSE_REG_GEN32 || pDis->Param1.fUse == DISUSE_REG_GEN64) && pDis->Param2.fUse == DISUSE_REG_CR)
-        return EMInterpretCRxRead(pVM, pVCpu, pRegFrame, pDis->Param1.Base.idxGenReg, pDis->Param2.Base.idxCtrlReg);
+        return emInterpretCRxRead(pVM, pVCpu, pRegFrame, pDis->Param1.Base.idxGenReg, pDis->Param2.Base.idxCtrlReg);
 
     if (pDis->Param1.fUse == DISUSE_REG_CR && (pDis->Param2.fUse == DISUSE_REG_GEN32 || pDis->Param2.fUse == DISUSE_REG_GEN64))
-        return EMInterpretCRxWrite(pVM, pVCpu, pRegFrame, pDis->Param1.Base.idxCtrlReg, pDis->Param2.Base.idxGenReg);
+        return emInterpretCRxWrite(pVM, pVCpu, pRegFrame, pDis->Param1.Base.idxCtrlReg, pDis->Param2.Base.idxGenReg);
 
     AssertMsgFailedReturn(("Unexpected control register move\n"), VERR_EM_INTERPRETER);
 }
diff --git a/src/VBox/VMM/VMMAll/GIMAll.cpp b/src/VBox/VMM/VMMAll/GIMAll.cpp
new file mode 100644
index 0000000..b96fd97
--- /dev/null
+++ b/src/VBox/VMM/VMMAll/GIMAll.cpp
@@ -0,0 +1,263 @@
+/* $Id: GIMAll.cpp $ */
+/** @file
+ * GIM - Guest Interface Manager - All Contexts.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include "GIMInternal.h"
+#include <VBox/err.h>
+#include <VBox/vmm/vm.h>
+
+/* Include all the providers. */
+#include "GIMHvInternal.h"
+#include "GIMMinimalInternal.h"
+
+
+/**
+ * Checks whether GIM is being used by this VM.
+ *
+ * @retval  @c true if used.
+ * @retval  @c false if no GIM provider ("none") is used.
+ *
+ * @param   pVM       Pointer to the VM.
+ */
+VMMDECL(bool) GIMIsEnabled(PVM pVM)
+{
+    return pVM->gim.s.enmProviderId != GIMPROVIDERID_NONE;
+}
+
+
+/**
+ * Gets the GIM provider configured for this VM.
+ *
+ * @returns The GIM provider Id.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMDECL(GIMPROVIDERID) GIMGetProvider(PVM pVM)
+{
+    return pVM->gim.s.enmProviderId;
+}
+
+
+/**
+ * Returns whether the guest has configured and enabled calls to the hypervisor.
+ *
+ * @returns true if hypercalls are enabled and usable, false otherwise.
+ * @param   pVCpu           Pointer to the VMCPU.
+ */
+VMM_INT_DECL(bool) GIMAreHypercallsEnabled(PVMCPU pVCpu)
+{
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    if (!GIMIsEnabled(pVM))
+        return false;
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimHvAreHypercallsEnabled(pVCpu);
+
+        case GIMPROVIDERID_KVM:
+            return gimKvmAreHypercallsEnabled(pVCpu);
+
+        default:
+            return false;
+    }
+}
+
+
+/**
+ * Implements a GIM hypercall with the provider configured for the VM.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pCtx        Pointer to the guest-CPU context.
+ */
+VMM_INT_DECL(int) GIMHypercall(PVMCPU pVCpu, PCPUMCTX pCtx)
+{
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    VMCPU_ASSERT_EMT(pVCpu);
+
+    if (RT_UNLIKELY(!GIMIsEnabled(pVM)))
+        return VERR_GIM_NOT_ENABLED;
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimHvHypercall(pVCpu, pCtx);
+
+        case GIMPROVIDERID_KVM:
+            return gimKvmHypercall(pVCpu, pCtx);
+
+        default:
+            AssertMsgFailed(("GIMHypercall: for provider %u not available/implemented\n", pVM->gim.s.enmProviderId));
+            return VERR_GIM_HYPERCALLS_NOT_AVAILABLE;
+    }
+}
+
+
+/**
+ * Returns whether the guest has configured and setup the use of paravirtualized
+ * TSC.
+ *
+ * Paravirtualized TSCs are per-VM and the rest of the execution engine logic
+ * relies on that.
+ *
+ * @returns true if enabled and usable, false otherwise.
+ * @param   pVM         Pointer to the VM.
+ */
+VMM_INT_DECL(bool) GIMIsParavirtTscEnabled(PVM pVM)
+{
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimHvIsParavirtTscEnabled(pVM);
+
+        case GIMPROVIDERID_KVM:
+            return gimKvmIsParavirtTscEnabled(pVM);
+
+        default:
+            break;
+    }
+    return false;
+}
+
+
+/**
+ * Whether #UD exceptions in the guest needs to be intercepted by the GIM
+ * provider.
+ *
+ * At the moment, the reason why this isn't a more generic interface wrt to
+ * exceptions is because of performance (each VM-exit would have to manually
+ * check whether or not GIM needs to be notified). Left as a todo for later if
+ * really required.
+ *
+ * @returns true if needed, false otherwise.
+ * @param   pVCpu       Pointer to the VMCPU.
+ */
+VMM_INT_DECL(bool) GIMShouldTrapXcptUD(PVMCPU pVCpu)
+{
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    if (!GIMIsEnabled(pVM))
+        return false;
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_KVM:
+            return gimKvmShouldTrapXcptUD(pVCpu);
+
+        default:
+            return false;
+    }
+}
+
+
+/**
+ * Exception handler for #UD when requested by the GIM provider.
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pCtx        Pointer to the guest-CPU context.
+ * @param   pDis        Pointer to the disassembled instruction state at RIP.
+ *                      Optional, can be NULL.
+ */
+VMM_INT_DECL(int) GIMXcptUD(PVMCPU pVCpu, PCPUMCTX pCtx, PDISCPUSTATE pDis)
+{
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    Assert(GIMIsEnabled(pVM));
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_KVM:
+            return gimKvmXcptUD(pVCpu, pCtx, pDis);
+
+        default:
+            return VERR_GIM_OPERATION_FAILED;
+    }
+}
+
+
+/**
+ * Invokes the read-MSR handler for the GIM provider configured for the VM.
+ *
+ * @returns Strict VBox status code like CPUMQueryGuestMsr.
+ * @retval  VINF_CPUM_R3_MSR_READ
+ * @retval  VERR_CPUM_RAISE_GP_0
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   idMsr       The MSR to read.
+ * @param   pRange      The range this MSR belongs to.
+ * @param   puValue     Where to store the MSR value read.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) GIMReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+{
+    Assert(pVCpu);
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    Assert(GIMIsEnabled(pVM));
+    VMCPU_ASSERT_EMT(pVCpu);
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimHvReadMsr(pVCpu, idMsr, pRange, puValue);
+
+        case GIMPROVIDERID_KVM:
+            return gimKvmReadMsr(pVCpu, idMsr, pRange, puValue);
+
+        default:
+            AssertMsgFailed(("GIMReadMsr: for unknown provider %u idMsr=%#RX32 -> #GP(0)", pVM->gim.s.enmProviderId, idMsr));
+            return VERR_CPUM_RAISE_GP_0;
+    }
+}
+
+
+/**
+ * Invokes the write-MSR handler for the GIM provider configured for the VM.
+ *
+ * @returns Strict VBox status code like CPUMSetGuestMsr.
+ * @retval  VINF_CPUM_R3_MSR_WRITE
+ * @retval  VERR_CPUM_RAISE_GP_0
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   idMsr       The MSR to write.
+ * @param   pRange      The range this MSR belongs to.
+ * @param   uValue      The value to set, ignored bits masked.
+ * @param   uRawValue   The raw value with the ignored bits not masked.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) GIMWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue)
+{
+    AssertPtr(pVCpu);
+    NOREF(uValue);
+
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    Assert(GIMIsEnabled(pVM));
+    VMCPU_ASSERT_EMT(pVCpu);
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimHvWriteMsr(pVCpu, idMsr, pRange, uRawValue);
+
+        case GIMPROVIDERID_KVM:
+            return gimKvmWriteMsr(pVCpu, idMsr, pRange, uRawValue);
+
+        default:
+            AssertMsgFailed(("GIMWriteMsr: for unknown provider %u idMsr=%#RX32 -> #GP(0)", pVM->gim.s.enmProviderId, idMsr));
+            return VERR_CPUM_RAISE_GP_0;
+    }
+}
+
diff --git a/src/VBox/VMM/VMMAll/GIMAllHv.cpp b/src/VBox/VMM/VMMAll/GIMAllHv.cpp
new file mode 100644
index 0000000..c5d41c2
--- /dev/null
+++ b/src/VBox/VMM/VMMAll/GIMAllHv.cpp
@@ -0,0 +1,332 @@
+/* $Id: GIMAllHv.cpp $ */
+/** @file
+ * GIM - Guest Interface Manager, Microsoft Hyper-V, All Contexts.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include "GIMHvInternal.h"
+#include "GIMInternal.h"
+
+#include <VBox/err.h>
+#include <VBox/vmm/hm.h>
+#include <VBox/vmm/tm.h>
+#include <VBox/vmm/vm.h>
+#include <VBox/vmm/pgm.h>
+#include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pdmapi.h>
+
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/spinlock.h>
+
+
+/**
+ * Handles the Hyper-V hypercall.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu           Pointer to the VMCPU.
+ * @param   pCtx            Pointer to the guest-CPU context.
+ */
+VMM_INT_DECL(int) gimHvHypercall(PVMCPU pVCpu, PCPUMCTX pCtx)
+{
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    if (!MSR_GIM_HV_HYPERCALL_IS_ENABLED(pVM->gim.s.u.Hv.u64HypercallMsr))
+        return VERR_GIM_HYPERCALLS_NOT_ENABLED;
+
+    /** @todo Handle hypercalls. Fail for now */
+    return VERR_GIM_IPE_3;
+}
+
+
+/**
+ * Returns whether the guest has configured and enabled the use of Hyper-V's
+ * hypercall interface.
+ *
+ * @returns true if hypercalls are enabled, false otherwise.
+ * @param   pVCpu       Pointer to the VMCPU.
+ */
+VMM_INT_DECL(bool) gimHvAreHypercallsEnabled(PVMCPU pVCpu)
+{
+    return MSR_GIM_HV_HYPERCALL_IS_ENABLED(pVCpu->CTX_SUFF(pVM)->gim.s.u.Hv.u64HypercallMsr);
+}
+
+
+/**
+ * Returns whether the guest has configured and enabled the use of Hyper-V's
+ * paravirtualized TSC.
+ *
+ * @returns true if paravirt. TSC is enabled, false otherwise.
+ * @param   pVM     Pointer to the VM.
+ */
+VMM_INT_DECL(bool) gimHvIsParavirtTscEnabled(PVM pVM)
+{
+    return MSR_GIM_HV_REF_TSC_IS_ENABLED(pVM->gim.s.u.Hv.u64TscPageMsr);
+}
+
+
+/**
+ * MSR read handler for Hyper-V.
+ *
+ * @returns Strict VBox status code like CPUMQueryGuestMsr().
+ * @retval  VINF_CPUM_R3_MSR_READ
+ * @retval  VERR_CPUM_RAISE_GP_0
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   idMsr       The MSR being read.
+ * @param   pRange      The range this MSR belongs to.
+ * @param   puValue     Where to store the MSR value read.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) gimHvReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+{
+    NOREF(pRange);
+    PVM    pVM = pVCpu->CTX_SUFF(pVM);
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+
+    switch (idMsr)
+    {
+        case MSR_GIM_HV_TIME_REF_COUNT:
+        {
+            /* Hyper-V reports the time in 100 ns units (10 MHz). */
+            uint64_t u64Tsc      = TMCpuTickGet(pVCpu);
+            uint64_t u64TscHz    = TMCpuTicksPerSecond(pVM);
+            uint64_t u64Tsc100Ns = u64TscHz / UINT64_C(10000000); /* 100 ns */
+            *puValue = (u64Tsc / u64Tsc100Ns);
+            return VINF_SUCCESS;
+        }
+
+        case MSR_GIM_HV_VP_INDEX:
+            *puValue = pVCpu->idCpu;
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_TPR:
+            PDMApicReadMSR(pVM, pVCpu->idCpu, 0x80, puValue);
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_EOI:
+            PDMApicReadMSR(pVM, pVCpu->idCpu, 0x0B, puValue);
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_ICR:
+            PDMApicReadMSR(pVM, pVCpu->idCpu, 0x30, puValue);
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_GUEST_OS_ID:
+            *puValue = pHv->u64GuestOsIdMsr;
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_HYPERCALL:
+            *puValue = pHv->u64HypercallMsr;
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_REF_TSC:
+            *puValue = pHv->u64TscPageMsr;
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_TSC_FREQ:
+            *puValue = TMCpuTicksPerSecond(pVM);
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_APIC_FREQ:
+        {
+            int rc = PDMApicGetTimerFreq(pVM, puValue);
+            if (RT_FAILURE(rc))
+                return VERR_CPUM_RAISE_GP_0;
+            return VINF_SUCCESS;
+        }
+
+        case MSR_GIM_HV_RESET:
+            *puValue = 0;
+            return VINF_SUCCESS;
+
+        default:
+        {
+#ifdef IN_RING3
+            static uint32_t s_cTimes = 0;
+            if (s_cTimes++ < 20)
+                LogRel(("GIM: HyperV: Unknown/invalid RdMsr (%#x) -> #GP(0)\n", idMsr));
+#endif
+            LogFunc(("Unknown/invalid RdMsr (%#RX32) -> #GP(0)\n", idMsr));
+            break;
+        }
+    }
+
+    return VERR_CPUM_RAISE_GP_0;
+}
+
+
+/**
+ * MSR write handler for Hyper-V.
+ *
+ * @returns Strict VBox status code like CPUMSetGuestMsr().
+ * @retval  VINF_CPUM_R3_MSR_WRITE
+ * @retval  VERR_CPUM_RAISE_GP_0
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   idMsr       The MSR being written.
+ * @param   pRange      The range this MSR belongs to.
+ * @param   uRawValue   The raw value with the ignored bits not masked.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) gimHvWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uRawValue)
+{
+    NOREF(pRange);
+    PVM    pVM = pVCpu->CTX_SUFF(pVM);
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+
+    switch (idMsr)
+    {
+        case MSR_GIM_HV_TPR:
+            PDMApicWriteMSR(pVM, pVCpu->idCpu, 0x80, uRawValue);
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_EOI:
+            PDMApicWriteMSR(pVM, pVCpu->idCpu, 0x0B, uRawValue);
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_ICR:
+            PDMApicWriteMSR(pVM, pVCpu->idCpu, 0x30, uRawValue);
+            return VINF_SUCCESS;
+
+        case MSR_GIM_HV_GUEST_OS_ID:
+        {
+#ifndef IN_RING3
+            return VINF_CPUM_R3_MSR_WRITE;
+#else
+            /* Disable the hypercall-page if 0 is written to this MSR. */
+            if (!uRawValue)
+            {
+                gimR3HvDisableHypercallPage(pVM);
+                pHv->u64HypercallMsr &= ~MSR_GIM_HV_HYPERCALL_ENABLE_BIT;
+            }
+            pHv->u64GuestOsIdMsr = uRawValue;
+            return VINF_SUCCESS;
+#endif /* IN_RING3 */
+        }
+
+        case MSR_GIM_HV_HYPERCALL:
+        {
+#ifndef IN_RING3
+            return VINF_CPUM_R3_MSR_WRITE;
+#else  /* IN_RING3 */
+            /*
+             * For now ignore writes to the hypercall MSR (i.e. keeps it disabled).
+             * This is required to boot FreeBSD 10.1 (with Hyper-V enabled ofc),
+             * see @bugref{7270} comment #116.
+             */
+            return VINF_SUCCESS;
+# if 0
+            /* First, update all but the hypercall enable bit. */
+            pHv->u64HypercallMsr = (uRawValue & ~MSR_GIM_HV_HYPERCALL_ENABLE_BIT);
+
+            /* Hypercalls can only be enabled when the guest has set the Guest-OS Id Msr. */
+            bool fEnable = RT_BOOL(uRawValue & MSR_GIM_HV_HYPERCALL_ENABLE_BIT);
+            if (   fEnable
+                && !pHv->u64GuestOsIdMsr)
+            {
+                return VINF_SUCCESS;
+            }
+
+            /* Is the guest disabling the hypercall-page? Allow it regardless of the Guest-OS Id Msr. */
+            if (!fEnable)
+            {
+                gimR3HvDisableHypercallPage(pVM);
+                pHv->u64HypercallMsr = uRawValue;
+                return VINF_SUCCESS;
+            }
+
+            /* Enable the hypercall-page. */
+            RTGCPHYS GCPhysHypercallPage = MSR_GIM_HV_HYPERCALL_GUEST_PFN(uRawValue) << PAGE_SHIFT;
+            int rc = gimR3HvEnableHypercallPage(pVM, GCPhysHypercallPage);
+            if (RT_SUCCESS(rc))
+            {
+                pHv->u64HypercallMsr = uRawValue;
+                return VINF_SUCCESS;
+            }
+
+            return VERR_CPUM_RAISE_GP_0;
+# endif
+#endif /* IN_RING3 */
+        }
+
+        case MSR_GIM_HV_REF_TSC:
+        {
+#ifndef IN_RING3
+            return VINF_CPUM_R3_MSR_WRITE;
+#else  /* IN_RING3 */
+            /* First, update all but the TSC-page enable bit. */
+            pHv->u64TscPageMsr = (uRawValue & ~MSR_GIM_HV_REF_TSC_ENABLE_BIT);
+
+            /* Is the guest disabling the TSC-page? */
+            bool fEnable = RT_BOOL(uRawValue & MSR_GIM_HV_REF_TSC_ENABLE_BIT);
+            if (!fEnable)
+            {
+                gimR3HvDisableTscPage(pVM);
+                pHv->u64TscPageMsr = uRawValue;
+                return VINF_SUCCESS;
+            }
+
+            /* Enable the TSC-page. */
+            RTGCPHYS GCPhysTscPage = MSR_GIM_HV_REF_TSC_GUEST_PFN(uRawValue) << PAGE_SHIFT;
+            int rc = gimR3HvEnableTscPage(pVM, GCPhysTscPage, false /* fUseThisTscSequence */, 0 /* uTscSequence */);
+            if (RT_SUCCESS(rc))
+            {
+                pHv->u64TscPageMsr = uRawValue;
+                return VINF_SUCCESS;
+            }
+
+            return VERR_CPUM_RAISE_GP_0;
+#endif /* IN_RING3 */
+        }
+
+        case MSR_GIM_HV_RESET:
+        {
+#ifndef IN_RING3
+            return VINF_CPUM_R3_MSR_WRITE;
+#else
+            if (MSR_GIM_HV_RESET_IS_SET(uRawValue))
+            {
+                LogRel(("GIM: HyperV: Reset initiated through MSR.\n"));
+                int rc = PDMDevHlpVMReset(pVM->gim.s.pDevInsR3);
+                AssertRC(rc);
+            }
+            /* else: Ignore writes to other bits. */
+            return VINF_SUCCESS;
+#endif /* IN_RING3 */
+        }
+
+        case MSR_GIM_HV_TIME_REF_COUNT:     /* Read-only MSRs. */
+        case MSR_GIM_HV_VP_INDEX:
+        case MSR_GIM_HV_TSC_FREQ:
+        case MSR_GIM_HV_APIC_FREQ:
+            LogFunc(("WrMsr on read-only MSR %#RX32 -> #GP(0)\n", idMsr));
+            return VERR_CPUM_RAISE_GP_0;
+
+        default:
+        {
+#ifdef IN_RING3
+            static uint32_t s_cTimes = 0;
+            if (s_cTimes++ < 20)
+                LogRel(("GIM: HyperV: Unknown/invalid WrMsr (%#x,%#x`%08x) -> #GP(0)\n", idMsr,
+                        uRawValue & UINT64_C(0xffffffff00000000), uRawValue & UINT64_C(0xffffffff)));
+#endif
+            LogFunc(("Unknown/invalid WrMsr (%#RX32,%#RX64) -> #GP(0)\n", idMsr, uRawValue));
+            break;
+        }
+    }
+
+    return VERR_CPUM_RAISE_GP_0;
+}
+
diff --git a/src/VBox/VMM/VMMAll/GIMAllKvm.cpp b/src/VBox/VMM/VMMAll/GIMAllKvm.cpp
new file mode 100644
index 0000000..105894d
--- /dev/null
+++ b/src/VBox/VMM/VMMAll/GIMAllKvm.cpp
@@ -0,0 +1,413 @@
+/* $Id: GIMAllKvm.cpp $ */
+/** @file
+ * GIM - Guest Interface Manager, KVM, All Contexts.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include "GIMKvmInternal.h"
+#include "GIMInternal.h"
+
+#include <VBox/err.h>
+#include <VBox/dis.h>
+#include <VBox/vmm/hm.h>
+#include <VBox/vmm/em.h>
+#include <VBox/vmm/tm.h>
+#include <VBox/vmm/vm.h>
+#include <VBox/vmm/pgm.h>
+#include <VBox/vmm/pdmdev.h>
+#include <VBox/vmm/pdmapi.h>
+#include <VBox/sup.h>
+
+#include <iprt/asm-amd64-x86.h>
+
+
+/**
+ * Handles the KVM hypercall.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu           Pointer to the VMCPU.
+ * @param   pCtx            Pointer to the guest-CPU context.
+ */
+VMM_INT_DECL(int) gimKvmHypercall(PVMCPU pVCpu, PCPUMCTX pCtx)
+{
+    /*
+     * Get the hypercall operation and arguments.
+     */
+    bool const fIs64BitMode = CPUMIsGuestIn64BitCodeEx(pCtx);
+    uint64_t uHyperOp       = pCtx->rax;
+    uint64_t uHyperArg0     = pCtx->rbx;
+    uint64_t uHyperArg1     = pCtx->rcx;
+    uint64_t uHyperArg2     = pCtx->rdi;
+    uint64_t uHyperArg3     = pCtx->rsi;
+    uint64_t uHyperRet      = KVM_HYPERCALL_RET_ENOSYS;
+    uint64_t uAndMask       = UINT64_C(0xffffffffffffffff);
+    if (!fIs64BitMode)
+    {
+        uAndMask    = UINT64_C(0xffffffff);
+        uHyperOp   &= UINT64_C(0xffffffff);
+        uHyperArg0 &= UINT64_C(0xffffffff);
+        uHyperArg1 &= UINT64_C(0xffffffff);
+        uHyperArg2 &= UINT64_C(0xffffffff);
+        uHyperArg3 &= UINT64_C(0xffffffff);
+        uHyperRet  &= UINT64_C(0xffffffff);
+    }
+
+    /*
+     * Verify that guest ring-0 is the one making the hypercall.
+     */
+    uint32_t uCpl = CPUMGetGuestCPL(pVCpu);
+    if (uCpl)
+    {
+        pCtx->rax = KVM_HYPERCALL_RET_EPERM & uAndMask;
+        return VINF_SUCCESS;
+    }
+
+    /*
+     * Do the work.
+     */
+    switch (uHyperOp)
+    {
+        case KVM_HYPERCALL_OP_KICK_CPU:
+        {
+            PVM pVM = pVCpu->CTX_SUFF(pVM);
+            if (uHyperArg1 < pVM->cCpus)
+            {
+                PVMCPU pVCpuTarget = &pVM->aCpus[uHyperArg1];   /** ASSUMES pVCpu index == ApicId of the VCPU. */
+                VMCPU_FF_SET(pVCpuTarget, VMCPU_FF_UNHALT);
+#ifdef IN_RING0
+                GVMMR0SchedWakeUp(pVM, pVCpuTarget->idCpu);
+#elif defined(IN_RING3)
+                int rc2 = SUPR3CallVMMR0(pVM->pVMR0, pVCpuTarget->idCpu, VMMR0_DO_GVMM_SCHED_WAKE_UP, NULL);
+                AssertRC(rc2);
+#endif
+                uHyperRet = KVM_HYPERCALL_RET_SUCCESS;
+            }
+            break;
+        }
+
+        case KVM_HYPERCALL_OP_VAPIC_POLL_IRQ:
+            uHyperRet = KVM_HYPERCALL_RET_SUCCESS;
+            break;
+
+        default:
+            break;
+    }
+
+    /*
+     * Place the result in rax/eax.
+     */
+    pCtx->rax = uHyperRet & uAndMask;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Returns whether the guest has configured and enabled the use of KVM's
+ * hypercall interface.
+ *
+ * @returns true if hypercalls are enabled, false otherwise.
+ * @param   pVCpu       Pointer to the VMCPU.
+ */
+VMM_INT_DECL(bool) gimKvmAreHypercallsEnabled(PVMCPU pVCpu)
+{
+    /* KVM paravirt interface doesn't have hypercall control bits like Hyper-V does
+       that guests can control. It's always enabled. */
+    return true;
+}
+
+
+/**
+ * Returns whether the guest has configured and enabled the use of KVM's
+ * paravirtualized TSC.
+ *
+ * @returns true if paravirt. TSC is enabled, false otherwise.
+ * @param   pVM     Pointer to the VM.
+ */
+VMM_INT_DECL(bool) gimKvmIsParavirtTscEnabled(PVM pVM)
+{
+    uint32_t cCpus = pVM->cCpus;
+    for (uint32_t i = 0; i < cCpus; i++)
+    {
+        PVMCPU     pVCpu      = &pVM->aCpus[i];
+        PGIMKVMCPU pGimKvmCpu = &pVCpu->gim.s.u.KvmCpu;
+        if (MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(pGimKvmCpu->u64SystemTimeMsr))
+            return true;
+    }
+    return false;
+}
+
+
+/**
+ * MSR read handler for KVM.
+ *
+ * @returns Strict VBox status code like CPUMQueryGuestMsr().
+ * @retval  VINF_CPUM_R3_MSR_READ
+ * @retval  VERR_CPUM_RAISE_GP_0
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   idMsr       The MSR being read.
+ * @param   pRange      The range this MSR belongs to.
+ * @param   puValue     Where to store the MSR value read.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) gimKvmReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue)
+{
+    NOREF(pRange);
+    PVM     pVM        = pVCpu->CTX_SUFF(pVM);
+    PGIMKVM pKvm       = &pVM->gim.s.u.Kvm;
+    PGIMKVMCPU pKvmCpu = &pVCpu->gim.s.u.KvmCpu;
+
+    switch (idMsr)
+    {
+        case MSR_GIM_KVM_SYSTEM_TIME:
+        case MSR_GIM_KVM_SYSTEM_TIME_OLD:
+            *puValue = pKvmCpu->u64SystemTimeMsr;
+            return VINF_SUCCESS;
+
+        case MSR_GIM_KVM_WALL_CLOCK:
+        case MSR_GIM_KVM_WALL_CLOCK_OLD:
+            *puValue = pKvm->u64WallClockMsr;
+            return VINF_SUCCESS;
+
+        default:
+        {
+#ifdef IN_RING3
+            static uint32_t s_cTimes = 0;
+            if (s_cTimes++ < 20)
+                LogRel(("GIM: KVM: Unknown/invalid RdMsr (%#x) -> #GP(0)\n", idMsr));
+#endif
+            LogFunc(("Unknown/invalid RdMsr (%#RX32) -> #GP(0)\n", idMsr));
+            break;
+        }
+    }
+
+    return VERR_CPUM_RAISE_GP_0;
+}
+
+
+/**
+ * MSR write handler for KVM.
+ *
+ * @returns Strict VBox status code like CPUMSetGuestMsr().
+ * @retval  VINF_CPUM_R3_MSR_WRITE
+ * @retval  VERR_CPUM_RAISE_GP_0
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   idMsr       The MSR being written.
+ * @param   pRange      The range this MSR belongs to.
+ * @param   uRawValue   The raw value with the ignored bits not masked.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) gimKvmWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uRawValue)
+{
+    NOREF(pRange);
+    PVM     pVM  = pVCpu->CTX_SUFF(pVM);
+    PGIMKVM pKvm = &pVM->gim.s.u.Kvm;
+    PGIMKVMCPU pKvmCpu = &pVCpu->gim.s.u.KvmCpu;
+
+    switch (idMsr)
+    {
+        case MSR_GIM_KVM_SYSTEM_TIME:
+        case MSR_GIM_KVM_SYSTEM_TIME_OLD:
+        {
+            bool fEnable = RT_BOOL(uRawValue & MSR_GIM_KVM_SYSTEM_TIME_ENABLE_BIT);
+#ifndef IN_RING3
+            if (fEnable)
+            {
+                RTCCUINTREG fEFlags  = ASMIntDisableFlags();
+                pKvmCpu->uTsc        = TMCpuTickGetNoCheck(pVCpu);
+                pKvmCpu->uVirtNanoTS = TMVirtualGetNoCheck(pVM);
+                ASMSetFlags(fEFlags);
+            }
+            return VINF_CPUM_R3_MSR_WRITE;
+#else
+            if (!fEnable)
+            {
+                gimR3KvmDisableSystemTime(pVM);
+                pKvmCpu->u64SystemTimeMsr = uRawValue;
+                return VINF_SUCCESS;
+            }
+
+            /* Is the system-time struct. already enabled? If so, get flags that need preserving. */
+            uint8_t fFlags = 0;
+            GIMKVMSYSTEMTIME SystemTime;
+            RT_ZERO(SystemTime);
+            if (   MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(pKvmCpu->u64SystemTimeMsr)
+                && MSR_GIM_KVM_SYSTEM_TIME_GUEST_GPA(uRawValue) == pKvmCpu->GCPhysSystemTime)
+            {
+                int rc2 = PGMPhysSimpleReadGCPhys(pVM, &SystemTime, pKvmCpu->GCPhysSystemTime, sizeof(GIMKVMSYSTEMTIME));
+                if (RT_SUCCESS(rc2))
+                    fFlags = (SystemTime.fFlags & GIM_KVM_SYSTEM_TIME_FLAGS_GUEST_PAUSED);
+            }
+
+            /* Enable and populate the system-time struct. */
+            pKvmCpu->u64SystemTimeMsr      = uRawValue;
+            pKvmCpu->GCPhysSystemTime      = MSR_GIM_KVM_SYSTEM_TIME_GUEST_GPA(uRawValue);
+            pKvmCpu->u32SystemTimeVersion += 2;
+            int rc = gimR3KvmEnableSystemTime(pVM, pVCpu, pKvmCpu, fFlags);
+            if (RT_FAILURE(rc))
+            {
+                pKvmCpu->u64SystemTimeMsr = 0;
+                return VERR_CPUM_RAISE_GP_0;
+            }
+            return VINF_SUCCESS;
+#endif /* IN_RING3 */
+        }
+
+        case MSR_GIM_KVM_WALL_CLOCK:
+        case MSR_GIM_KVM_WALL_CLOCK_OLD:
+        {
+#ifndef IN_RING3
+
+            return VINF_CPUM_R3_MSR_WRITE;
+#else
+            /* Enable the wall-clock struct. */
+            RTGCPHYS GCPhysWallClock = MSR_GIM_KVM_WALL_CLOCK_GUEST_GPA(uRawValue);
+            if (RT_LIKELY(RT_ALIGN_64(GCPhysWallClock, 4) == GCPhysWallClock))
+            {
+                int rc = gimR3KvmEnableWallClock(pVM, GCPhysWallClock);
+                if (RT_SUCCESS(rc))
+                {
+                    pKvm->u64WallClockMsr     = uRawValue;
+                    return VINF_SUCCESS;
+                }
+            }
+            return VERR_CPUM_RAISE_GP_0;
+#endif /* IN_RING3 */
+        }
+
+        default:
+        {
+#ifdef IN_RING3
+            static uint32_t s_cTimes = 0;
+            if (s_cTimes++ < 20)
+                LogRel(("GIM: KVM: Unknown/invalid WrMsr (%#x,%#x`%08x) -> #GP(0)\n", idMsr,
+                        uRawValue & UINT64_C(0xffffffff00000000), uRawValue & UINT64_C(0xffffffff)));
+#endif
+            LogFunc(("Unknown/invalid WrMsr (%#RX32,%#RX64) -> #GP(0)\n", idMsr, uRawValue));
+            break;
+        }
+    }
+
+    return VERR_CPUM_RAISE_GP_0;
+}
+
+
+/**
+ * Whether we need to trap #UD exceptions in the guest.
+ *
+ * On AMD-V we need to trap them because paravirtualized Linux/KVM guests use
+ * the Intel VMCALL instruction to make hypercalls and we need to trap and
+ * optionally patch them to the AMD-V VMMCALL instruction and handle the
+ * hypercall.
+ *
+ * I guess this was done so that guest teleporation between an AMD and an Intel
+ * machine would working without any changes at the time of teleporation.
+ * However, this also means we -always- need to intercept #UD exceptions on one
+ * of the two CPU models (Intel or AMD). Hyper-V solves this problem more
+ * elegantly by letting the hypervisor supply an opaque hypercall page.
+ *
+ * For raw-mode VMs, this function will always return true. See gimR3KvmInit().
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ */
+VMM_INT_DECL(bool) gimKvmShouldTrapXcptUD(PVMCPU pVCpu)
+{
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    return pVM->gim.s.u.Kvm.fTrapXcptUD;
+}
+
+
+/**
+ * Exception handler for #UD.
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pCtx        Pointer to the guest-CPU context.
+ * @param   pDis        Pointer to the disassembled instruction state at RIP.
+ *                      Optional, can be NULL.
+ */
+VMM_INT_DECL(int) gimKvmXcptUD(PVMCPU pVCpu, PCPUMCTX pCtx, PDISCPUSTATE pDis)
+{
+    /*
+     * If we didn't ask for #UD to be trapped, bail.
+     */
+    PVM     pVM  = pVCpu->CTX_SUFF(pVM);
+    PGIMKVM pKvm = &pVM->gim.s.u.Kvm;
+    if (RT_UNLIKELY(!pVM->gim.s.u.Kvm.fTrapXcptUD))
+        return VERR_GIM_OPERATION_FAILED;
+
+    /*
+     * Make sure guest ring-0 is the one making the hypercall.
+     */
+    if (CPUMGetGuestCPL(pVCpu))
+        return VERR_GIM_HYPERCALL_ACCESS_DENIED;
+
+    int rc = VINF_SUCCESS;
+    if (!pDis)
+    {
+        /*
+         * Disassemble the instruction at RIP to figure out if it's the Intel
+         * VMCALL instruction and if so, handle it as a hypercall.
+         */
+        DISCPUSTATE Dis;
+        rc = EMInterpretDisasCurrent(pVM, pVCpu, &Dis, NULL /* pcbInstr */);
+        pDis = &Dis;
+    }
+
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Patch the instruction to so we don't have to spend time disassembling it each time.
+         * Makes sense only for HM as with raw-mode we will be getting a #UD regardless.
+         */
+        if (   pDis->pCurInstr->uOpcode == OP_VMCALL
+            || pDis->pCurInstr->uOpcode == OP_VMMCALL)
+        {
+            if (   pDis->pCurInstr->uOpcode != pKvm->uOpCodeNative
+                && HMIsEnabled(pVM))
+            {
+                uint8_t abHypercall[3];
+                size_t  cbWritten = 0;
+                rc = VMMPatchHypercall(pVM, &abHypercall, sizeof(abHypercall), &cbWritten);
+                AssertRC(rc);
+                Assert(sizeof(abHypercall) == pDis->cbInstr);
+                Assert(sizeof(abHypercall) == cbWritten);
+
+                rc = PGMPhysSimpleWriteGCPtr(pVCpu, pCtx->rip, &abHypercall, sizeof(abHypercall));
+            }
+
+            /*
+             * Perform the hypercall and update RIP.
+             *
+             * For HM, we can simply resume guest execution without perform the hypercall now and
+             * do it on the next VMCALL/VMMCALL exit handler on the patched instruction.
+             *
+             * For raw-mode we need to do this now anyway. So we do it here regardless with an added
+             * advantage is that it saves one world-switch for the HM case.
+             */
+            if (RT_SUCCESS(rc))
+            {
+                int rc2 = gimKvmHypercall(pVCpu, pCtx);
+                AssertRC(rc2);
+                pCtx->rip += pDis->cbInstr;
+            }
+            return rc;
+        }
+    }
+
+    return VERR_GIM_OPERATION_FAILED;
+}
+
diff --git a/src/VBox/VMM/VMMAll/HMAll.cpp b/src/VBox/VMM/VMMAll/HMAll.cpp
index 89b0d98..8410d06 100644
--- a/src/VBox/VMM/VMMAll/HMAll.cpp
+++ b/src/VBox/VMM/VMMAll/HMAll.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -37,7 +37,6 @@
 #include <iprt/asm-amd64-x86.h>
 
 
-
 /**
  * Checks whether HM (VT-x/AMD-V) is being used by this VM.
  *
@@ -78,6 +77,7 @@ static void hmQueueInvlPage(PVMCPU pVCpu, RTGCPTR GCVirt)
 #endif
 }
 
+
 /**
  * Invalidates a guest page
  *
@@ -102,6 +102,7 @@ VMM_INT_DECL(int) HMInvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt)
 #endif
 }
 
+
 /**
  * Flushes the guest TLB.
  *
@@ -117,8 +118,8 @@ VMM_INT_DECL(int) HMFlushTLB(PVMCPU pVCpu)
     return VINF_SUCCESS;
 }
 
-#ifdef IN_RING0
 
+#ifdef IN_RING0
 /**
  * Dummy RTMpOnSpecific handler since RTMpPokeCpu couldn't be used.
  *
@@ -172,10 +173,10 @@ static void hmR0PokeCpu(PVMCPU pVCpu, RTCPUID idHostCpu)
             STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatSpinPokeFailed, z);
     }
 }
-
 #endif /* IN_RING0 */
-#ifndef IN_RC
 
+
+#ifndef IN_RC
 /**
  * Poke an EMT so it can perform the appropriate TLB shootdowns.
  *
@@ -269,14 +270,15 @@ VMM_INT_DECL(int) HMFlushTLBOnAllVCpus(PVM pVM)
 
     return VINF_SUCCESS;
 }
-
 #endif /* !IN_RC */
 
 /**
- * Checks if nested paging is enabled
+ * Checks if nested paging is enabled.
  *
- * @returns boolean
+ * @returns true if nested paging is active, false otherwise.
  * @param   pVM         Pointer to the VM.
+ *
+ * @remarks Works before hmR3InitFinalizeR0.
  */
 VMM_INT_DECL(bool) HMIsNestedPagingActive(PVM pVM)
 {
@@ -285,6 +287,25 @@ VMM_INT_DECL(bool) HMIsNestedPagingActive(PVM pVM)
 
 
 /**
+ * Checks if both nested paging and unhampered guest execution are enabled.
+ *
+ * The almost complete guest execution in harware is only applicable to VT-x.
+ *
+ * @returns true if we have both enabled, otherwise false.
+ * @param   pVM         Pointer to the VM.
+ *
+ * @remarks Works before hmR3InitFinalizeR0.
+ */
+VMM_INT_DECL(bool) HMAreNestedPagingAndFullGuestExecEnabled(PVM pVM)
+{
+    return HMIsEnabled(pVM)
+        && pVM->hm.s.fNestedPaging
+        && (   pVM->hm.s.vmx.fUnrestrictedGuest
+            || pVM->hm.s.svm.fSupported);
+}
+
+
+/**
  * Checks if this VM is long-mode capable.
  *
  * @returns true if long mode is allowed, false otherwise.
@@ -297,6 +318,30 @@ VMM_INT_DECL(bool) HMIsLongModeAllowed(PVM pVM)
 
 
 /**
+ * Checks if MSR bitmaps are available. It is assumed that when it's available
+ * it will be used as well.
+ *
+ * @returns true if MSR bitmaps are available, false otherwise.
+ * @param   pVM         Pointer to the VM.
+ */
+VMM_INT_DECL(bool) HMAreMsrBitmapsAvailable(PVM pVM)
+{
+    if (HMIsEnabled(pVM))
+    {
+        if (pVM->hm.s.svm.fSupported)
+            return true;
+
+        if (   pVM->hm.s.vmx.fSupported
+            && (pVM->hm.s.vmx.Msrs.VmxProcCtls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+
+/**
  * Return the shadow paging mode for nested paging/ept
  *
  * @returns shadow paging mode
@@ -460,3 +505,49 @@ VMM_INT_DECL(bool) HMSetSingleInstruction(PVMCPU pVCpu, bool fEnable)
     return fOld;
 }
 
+
+/**
+ * Notifies HM that paravirtualized hypercalls are now enabled.
+ *
+ * @param   pVCpu   Pointer to the VMCPU.
+ */
+VMM_INT_DECL(void) HMHypercallsEnable(PVMCPU pVCpu)
+{
+    pVCpu->hm.s.fHypercallsEnabled = true;
+}
+
+
+/**
+ * Notifies HM that paravirtualized hypercalls are now disabled.
+ *
+ * @param   pVCpu   Pointer to the VMCPU.
+ */
+VMM_INT_DECL(void) HMHypercallsDisable(PVMCPU pVCpu)
+{
+    pVCpu->hm.s.fHypercallsEnabled = false;
+}
+
+
+/**
+ * Notifies HM that GIM provider wants to trap #UD.
+ *
+ * @param   pVCpu   Pointer to the VMCPU.
+ */
+VMM_INT_DECL(void) HMTrapXcptUDForGIMEnable(PVMCPU pVCpu)
+{
+    pVCpu->hm.s.fGIMTrapXcptUD = true;
+    HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
+}
+
+
+/**
+ * Notifies HM that GIM provider no longer wants to trap #UD.
+ *
+ * @param   pVCpu   Pointer to the VMCPU.
+ */
+VMM_INT_DECL(void) HMTrapXcptUDForGIMDisable(PVMCPU pVCpu)
+{
+    pVCpu->hm.s.fGIMTrapXcptUD = false;
+    HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
+}
+
diff --git a/src/VBox/VMM/VMMAll/IEMAll.cpp b/src/VBox/VMM/VMMAll/IEMAll.cpp
index 715f73e..b404b3e 100644
--- a/src/VBox/VMM/VMMAll/IEMAll.cpp
+++ b/src/VBox/VMM/VMMAll/IEMAll.cpp
@@ -75,6 +75,7 @@
  * context. */
 //#define IEM_VERIFICATION_MODE_MINIMAL
 //#define IEM_LOG_MEMORY_WRITES
+#define IEM_IMPLEMENTS_TASKSWITCH
 
 /*******************************************************************************
 *   Header Files                                                               *
@@ -187,15 +188,6 @@ typedef IEMSELDESC *PIEMSELDESC;
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-/** @name IEM status codes.
- *
- * Not quite sure how this will play out in the end, just aliasing safe status
- * codes for now.
- *
- * @{ */
-#define VINF_IEM_RAISED_XCPT    VINF_EM_RESCHEDULE
-/** @} */
-
 /** Temporary hack to disable the double execution.  Will be removed in favor
  * of a dedicated execution mode in EM. */
 //#define IEM_VERIFICATION_MODE_NO_REM
@@ -270,6 +262,14 @@ typedef IEMSELDESC *PIEMSELDESC;
 #define IEM_IS_REAL_OR_V86_MODE(a_pIemCpu)  (CPUMIsGuestInRealOrV86ModeEx((a_pIemCpu)->CTX_SUFF(pCtx)))
 
 /**
+ * Check if we're currently executing in virtual 8086 mode.
+ *
+ * @returns @c true if it is, @c false if not.
+ * @param   a_pIemCpu       The IEM state of the current CPU.
+ */
+#define IEM_IS_V86_MODE(a_pIemCpu)          (CPUMIsGuestInV86ModeEx((a_pIemCpu)->CTX_SUFF(pCtx)))
+
+/**
  * Check if we're currently executing in long mode.
  *
  * @returns @c true if it is, @c false if not.
@@ -286,39 +286,18 @@ typedef IEMSELDESC *PIEMSELDESC;
 #define IEM_IS_REAL_MODE(a_pIemCpu)         (CPUMIsGuestInRealModeEx((a_pIemCpu)->CTX_SUFF(pCtx)))
 
 /**
- * Tests if an AMD CPUID feature (extended) is marked present - ECX.
- */
-#define IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX(a_fEcx)    iemRegIsAmdCpuIdFeaturePresent(pIemCpu, 0, (a_fEcx))
-
-/**
- * Tests if an AMD CPUID feature (extended) is marked present - EDX.
- */
-#define IEM_IS_AMD_CPUID_FEATURE_PRESENT_EDX(a_fEdx)    iemRegIsAmdCpuIdFeaturePresent(pIemCpu, (a_fEdx), 0)
-
-/**
- * Tests if at least on of the specified AMD CPUID features (extended) are
- * marked present.
- */
-#define IEM_IS_AMD_CPUID_FEATURES_ANY_PRESENT(a_fEdx, a_fEcx)   iemRegIsAmdCpuIdFeaturePresent(pIemCpu, (a_fEdx), (a_fEcx))
-
-/**
- * Checks if an Intel CPUID feature is present.
- */
-#define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(a_fEdx)  \
-    (   ((a_fEdx) & (X86_CPUID_FEATURE_EDX_TSC | 0)) \
-     || iemRegIsIntelCpuIdFeaturePresent(pIemCpu, (a_fEdx), 0) )
-
-/**
- * Checks if an Intel CPUID feature is present.
+ * Returns a (const) pointer to the CPUMFEATURES for the guest CPU.
+ * @returns PCCPUMFEATURES
+ * @param   a_pIemCpu       The IEM state of the current CPU.
  */
-#define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_ECX(a_fEcx)  \
-    ( iemRegIsIntelCpuIdFeaturePresent(pIemCpu, 0, (a_fEcx)) )
+#define IEM_GET_GUEST_CPU_FEATURES(a_pIemCpu) (&(IEMCPU_TO_VM(a_pIemCpu)->cpum.ro.GuestFeatures))
 
 /**
- * Checks if an Intel CPUID feature is present in the host CPU.
+ * Returns a (const) pointer to the CPUMFEATURES for the host CPU.
+ * @returns PCCPUMFEATURES
+ * @param   a_pIemCpu       The IEM state of the current CPU.
  */
-#define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(a_fEdx)  \
-    ( (a_fEdx) & pIemCpu->fHostCpuIdStdFeaturesEdx )
+#define IEM_GET_HOST_CPU_FEATURES(a_pIemCpu)  (&(IEMCPU_TO_VM(a_pIemCpu)->cpum.ro.HostFeatures))
 
 /**
  * Evaluates to true if we're presenting an Intel CPU to the guest.
@@ -696,6 +675,7 @@ size_t g_cbIemWrote;
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
+static VBOXSTRICTRC     iemRaiseTaskSwitchFaultWithErr(PIEMCPU pIemCpu, uint16_t uErr);
 static VBOXSTRICTRC     iemRaiseTaskSwitchFaultCurrentTSS(PIEMCPU pIemCpu);
 static VBOXSTRICTRC     iemRaiseTaskSwitchFault0(PIEMCPU pIemCpu);
 static VBOXSTRICTRC     iemRaiseTaskSwitchFaultBySelector(PIEMCPU pIemCpu, uint16_t uSel);
@@ -703,6 +683,7 @@ static VBOXSTRICTRC     iemRaiseTaskSwitchFaultBySelector(PIEMCPU pIemCpu, uint1
 static VBOXSTRICTRC     iemRaiseSelectorNotPresentBySelector(PIEMCPU pIemCpu, uint16_t uSel);
 static VBOXSTRICTRC     iemRaiseSelectorNotPresentWithErr(PIEMCPU pIemCpu, uint16_t uErr);
 static VBOXSTRICTRC     iemRaiseStackSelectorNotPresentBySelector(PIEMCPU pIemCpu, uint16_t uSel);
+static VBOXSTRICTRC     iemRaiseStackSelectorNotPresentWithErr(PIEMCPU pIemCpu, uint16_t uErr);
 static VBOXSTRICTRC     iemRaiseGeneralProtectionFault(PIEMCPU pIemCpu, uint16_t uErr);
 static VBOXSTRICTRC     iemRaiseGeneralProtectionFault0(PIEMCPU pIemCpu);
 static VBOXSTRICTRC     iemRaiseGeneralProtectionFaultBySelector(PIEMCPU pIemCpu, RTSEL uSel);
@@ -719,9 +700,12 @@ static VBOXSTRICTRC     iemMemFetchSysU8(PIEMCPU pIemCpu, uint32_t *pu32Dst, uin
 static VBOXSTRICTRC     iemMemFetchSysU16(PIEMCPU pIemCpu, uint32_t *pu32Dst, uint8_t iSegReg, RTGCPTR GCPtrMem);
 static VBOXSTRICTRC     iemMemFetchSysU32(PIEMCPU pIemCpu, uint32_t *pu32Dst, uint8_t iSegReg, RTGCPTR GCPtrMem);
 static VBOXSTRICTRC     iemMemFetchSysU64(PIEMCPU pIemCpu, uint64_t *pu64Dst, uint8_t iSegReg, RTGCPTR GCPtrMem);
+static VBOXSTRICTRC     iemMemFetchSelDescWithErr(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint16_t uSel, uint8_t uXcpt, uint16_t uErrorCode);
 static VBOXSTRICTRC     iemMemFetchSelDesc(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint16_t uSel, uint8_t uXcpt);
 static VBOXSTRICTRC     iemMemStackPushCommitSpecial(PIEMCPU pIemCpu, void *pvMem, uint64_t uNewRsp);
 static VBOXSTRICTRC     iemMemStackPushBeginSpecial(PIEMCPU pIemCpu, size_t cbMem, void **ppvMem, uint64_t *puNewRsp);
+static VBOXSTRICTRC     iemMemStackPushU32(PIEMCPU pIemCpu, uint32_t u32Value);
+static VBOXSTRICTRC     iemMemStackPushU16(PIEMCPU pIemCpu, uint16_t u16Value);
 static VBOXSTRICTRC     iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel);
 static uint16_t         iemSRegFetchU16(PIEMCPU pIemCpu, uint8_t iSegReg);
 
@@ -829,7 +813,7 @@ DECLINLINE(void) iemInitExec(PIEMCPU pIemCpu, bool fBypassHandlers)
                                && pCtx->cs.u32Limit == UINT32_MAX
                                && PATMIsPatchGCAddr(IEMCPU_TO_VM(pIemCpu), pCtx->eip);
     if (!pIemCpu->fInPatchCode)
-        CPUMRawLeave(pVCpu, CPUMCTX2CORE(pCtx), VINF_SUCCESS);
+        CPUMRawLeave(pVCpu, VINF_SUCCESS);
 #endif
 }
 
@@ -899,7 +883,7 @@ DECLINLINE(void) iemInitDecoder(PIEMCPU pIemCpu, bool fBypassHandlers)
                                && pCtx->cs.u32Limit == UINT32_MAX
                                && PATMIsPatchGCAddr(IEMCPU_TO_VM(pIemCpu), pCtx->eip);
     if (!pIemCpu->fInPatchCode)
-        CPUMRawLeave(pVCpu, CPUMCTX2CORE(pCtx), VINF_SUCCESS);
+        CPUMRawLeave(pVCpu, VINF_SUCCESS);
 #endif
 
 #ifdef DBGFTRACE_ENABLED
@@ -961,7 +945,8 @@ static VBOXSTRICTRC iemInitDecoderAndPrefetchOpcodes(PIEMCPU pIemCpu, bool fBypa
             Assert(GCPtrPC32 == 0); Assert(pCtx->cs.u32Limit == UINT32_MAX);
             cbToTryRead = UINT32_MAX;
         }
-        GCPtrPC = pCtx->cs.u64Base + GCPtrPC32;
+        GCPtrPC = (uint32_t)pCtx->cs.u64Base + GCPtrPC32;
+        Assert(GCPtrPC <= UINT32_MAX);
     }
 
 #ifdef VBOX_WITH_RAW_MODE_NOT_R0
@@ -1041,7 +1026,7 @@ static VBOXSTRICTRC iemInitDecoderAndPrefetchOpcodes(PIEMCPU pIemCpu, bool fBypa
             cbToTryRead = sizeof(pIemCpu->abOpcode);
 
         if (!pIemCpu->fBypassHandlers)
-            rc = PGMPhysRead(pVM, GCPhys, pIemCpu->abOpcode, cbToTryRead);
+            rc = PGMPhysRead(pVM, GCPhys, pIemCpu->abOpcode, cbToTryRead, PGMACCESSORIGIN_IEM);
         else
             rc = PGMPhysSimpleReadGCPhys(pVM, pIemCpu->abOpcode, GCPhys, cbToTryRead);
         if (rc != VINF_SUCCESS)
@@ -1101,7 +1086,7 @@ static VBOXSTRICTRC iemOpcodeFetchMoreBytes(PIEMCPU pIemCpu, size_t cbMin)
         }
         if (cbToTryRead < cbMin - cbLeft)
             return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION);
-        GCPtrNext = pCtx->cs.u64Base + GCPtrNext32;
+        GCPtrNext = (uint32_t)pCtx->cs.u64Base + GCPtrNext32;
     }
 
     /* Only read up to the end of the page, and make sure we don't read more
@@ -1111,6 +1096,7 @@ static VBOXSTRICTRC iemOpcodeFetchMoreBytes(PIEMCPU pIemCpu, size_t cbMin)
         cbToTryRead = cbLeftOnPage;
     if (cbToTryRead > sizeof(pIemCpu->abOpcode) - pIemCpu->cbOpcode)
         cbToTryRead = sizeof(pIemCpu->abOpcode) - pIemCpu->cbOpcode;
+/** @todo r=bird: Convert assertion into undefined opcode exception? */
     Assert(cbToTryRead >= cbMin - cbLeft); /* ASSUMPTION based on iemInitDecoderAndPrefetchOpcodes. */
 
 #ifdef VBOX_WITH_RAW_MODE_NOT_R0
@@ -1158,7 +1144,7 @@ static VBOXSTRICTRC iemOpcodeFetchMoreBytes(PIEMCPU pIemCpu, size_t cbMin)
      * should be no need to check again here.
      */
     if (!pIemCpu->fBypassHandlers)
-        rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhys, &pIemCpu->abOpcode[pIemCpu->cbOpcode], cbToTryRead);
+        rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhys, &pIemCpu->abOpcode[pIemCpu->cbOpcode], cbToTryRead, PGMACCESSORIGIN_IEM);
     else
         rc = PGMPhysSimpleReadGCPhys(IEMCPU_TO_VM(pIemCpu), &pIemCpu->abOpcode[pIemCpu->cbOpcode], GCPhys, cbToTryRead);
     if (rc != VINF_SUCCESS)
@@ -1206,12 +1192,13 @@ DECL_NO_INLINE(static, VBOXSTRICTRC) iemOpcodeGetNextU8Slow(PIEMCPU pIemCpu, uin
 DECLINLINE(VBOXSTRICTRC) iemOpcodeGetNextU8(PIEMCPU pIemCpu, uint8_t *pu8)
 {
     uint8_t const offOpcode = pIemCpu->offOpcode;
-    if (RT_UNLIKELY(offOpcode >= pIemCpu->cbOpcode))
-        return iemOpcodeGetNextU8Slow(pIemCpu, pu8);
-
-    *pu8 = pIemCpu->abOpcode[offOpcode];
-    pIemCpu->offOpcode = offOpcode + 1;
-    return VINF_SUCCESS;
+    if (RT_LIKELY(offOpcode < pIemCpu->cbOpcode))
+    {
+        *pu8 = pIemCpu->abOpcode[offOpcode];
+        pIemCpu->offOpcode = offOpcode + 1;
+        return VINF_SUCCESS;
+    }
+    return iemOpcodeGetNextU8Slow(pIemCpu, pu8);
 }
 
 
@@ -2252,7 +2239,7 @@ iemRaiseXcptOrIntInRealMode(PIEMCPU     pIemCpu,
  * Loads a NULL data selector into when coming from V8086 mode.
  *
  * @param   pIemCpu         The IEM per CPU instance data.
- * @param   pSReg               Pointer to the segment register.
+ * @param   pSReg           Pointer to the segment register.
  */
 static void iemHlpLoadNullDataSelectorOnV86Xcpt(PIEMCPU pIemCpu, PCPUMSELREG pSReg)
 {
@@ -2264,13 +2251,901 @@ static void iemHlpLoadNullDataSelectorOnV86Xcpt(PIEMCPU pIemCpu, PCPUMSELREG pSR
         pSReg->Attr.u &= X86DESCATTR_DT | X86DESCATTR_TYPE | X86DESCATTR_DPL | X86DESCATTR_G | X86DESCATTR_D;
         pSReg->Attr.u |= X86DESCATTR_UNUSABLE;
     }
-    else
+    else
+    {
+        pSReg->fFlags   = CPUMSELREG_FLAGS_VALID;
+        /** @todo check this on AMD-V */
+        pSReg->u64Base  = 0;
+        pSReg->u32Limit = 0;
+    }
+}
+
+
+/**
+ * Loads a segment selector during a task switch in V8086 mode.
+ *
+ * @param   pIemCpu         The IEM per CPU instance data.
+ * @param   pSReg           Pointer to the segment register.
+ * @param   uSel            The selector value to load.
+ */
+static void iemHlpLoadSelectorInV86Mode(PIEMCPU pIemCpu, PCPUMSELREG pSReg, uint16_t uSel)
+{
+    /* See Intel spec. 26.3.1.2 "Checks on Guest Segment Registers". */
+    pSReg->Sel      = uSel;
+    pSReg->ValidSel = uSel;
+    pSReg->fFlags   = CPUMSELREG_FLAGS_VALID;
+    pSReg->u64Base  = uSel << 4;
+    pSReg->u32Limit = 0xffff;
+    pSReg->Attr.u   = 0xf3;
+}
+
+
+/**
+ * Loads a NULL data selector into a selector register, both the hidden and
+ * visible parts, in protected mode.
+ *
+ * @param   pIemCpu             The IEM state of the calling EMT.
+ * @param   pSReg               Pointer to the segment register.
+ * @param   uRpl                The RPL.
+ */
+static void iemHlpLoadNullDataSelectorProt(PIEMCPU pIemCpu, PCPUMSELREG pSReg, RTSEL uRpl)
+{
+    /** @todo Testcase: write a testcase checking what happends when loading a NULL
+     *        data selector in protected mode. */
+    pSReg->Sel      = uRpl;
+    pSReg->ValidSel = uRpl;
+    pSReg->fFlags   = CPUMSELREG_FLAGS_VALID;
+    if (IEM_IS_GUEST_CPU_INTEL(pIemCpu) && !IEM_FULL_VERIFICATION_REM_ENABLED(pIemCpu))
+    {
+        /* VT-x (Intel 3960x) observed doing something like this. */
+        pSReg->Attr.u   = X86DESCATTR_UNUSABLE | X86DESCATTR_G | X86DESCATTR_D | (pIemCpu->uCpl << X86DESCATTR_DPL_SHIFT);
+        pSReg->u32Limit = UINT32_MAX;
+        pSReg->u64Base  = 0;
+    }
+    else
+    {
+        pSReg->Attr.u   = X86DESCATTR_UNUSABLE;
+        pSReg->u32Limit = 0;
+        pSReg->u64Base  = 0;
+    }
+}
+
+
+/**
+ * Loads a segment selector during a task switch in protected mode. In this task
+ * switch scenario, we would throw #TS exceptions rather than #GPs.
+ *
+ * @returns VBox strict status code.
+ * @param   pIemCpu         The IEM per CPU instance data.
+ * @param   pSReg           Pointer to the segment register.
+ * @param   uSel            The new selector value.
+ *
+ * @remarks This does -NOT- handle CS or SS.
+ * @remarks This expects pIemCpu->uCpl to be up to date.
+ */
+static VBOXSTRICTRC iemHlpTaskSwitchLoadDataSelectorInProtMode(PIEMCPU pIemCpu, PCPUMSELREG pSReg, uint16_t uSel)
+{
+    Assert(pIemCpu->enmCpuMode != IEMMODE_64BIT);
+
+    /* Null data selector. */
+    if (!(uSel & X86_SEL_MASK_OFF_RPL))
+    {
+        iemHlpLoadNullDataSelectorProt(pIemCpu, pSReg, uSel);
+        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(IEMCPU_TO_VMCPU(pIemCpu), pSReg));
+        CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_HIDDEN_SEL_REGS);
+        return VINF_SUCCESS;
+    }
+
+    /* Fetch the descriptor. */
+    IEMSELDESC Desc;
+    VBOXSTRICTRC rcStrict = iemMemFetchSelDesc(pIemCpu, &Desc, uSel, X86_XCPT_TS);
+    if (rcStrict != VINF_SUCCESS)
+    {
+        Log(("iemHlpTaskSwitchLoadDataSelectorInProtMode: failed to fetch selector. uSel=%u rc=%Rrc\n", uSel,
+             VBOXSTRICTRC_VAL(rcStrict)));
+        return rcStrict;
+    }
+
+    /* Must be a data segment or readable code segment. */
+    if (   !Desc.Legacy.Gen.u1DescType
+        || (Desc.Legacy.Gen.u4Type & (X86_SEL_TYPE_CODE | X86_SEL_TYPE_READ)) == X86_SEL_TYPE_CODE)
+    {
+        Log(("iemHlpTaskSwitchLoadDataSelectorInProtMode: invalid segment type. uSel=%u Desc.u4Type=%#x\n", uSel,
+             Desc.Legacy.Gen.u4Type));
+        return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+    }
+
+    /* Check privileges for data segments and non-conforming code segments. */
+    if (   (Desc.Legacy.Gen.u4Type & (X86_SEL_TYPE_CODE | X86_SEL_TYPE_CONF))
+        != (X86_SEL_TYPE_CODE | X86_SEL_TYPE_CONF))
+    {
+        /* The RPL and the new CPL must be less than or equal to the DPL. */
+        if (   (unsigned)(uSel & X86_SEL_RPL) > Desc.Legacy.Gen.u2Dpl
+            || (pIemCpu->uCpl > Desc.Legacy.Gen.u2Dpl))
+        {
+            Log(("iemHlpTaskSwitchLoadDataSelectorInProtMode: Invalid priv. uSel=%u uSel.RPL=%u DPL=%u CPL=%u\n",
+                 uSel, (uSel & X86_SEL_RPL), Desc.Legacy.Gen.u2Dpl, pIemCpu->uCpl));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+        }
+    }
+
+    /* Is it there? */
+    if (!Desc.Legacy.Gen.u1Present)
+    {
+        Log(("iemHlpTaskSwitchLoadDataSelectorInProtMode: Segment not present. uSel=%u\n", uSel));
+        return iemRaiseSelectorNotPresentWithErr(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+    }
+
+    /* The base and limit. */
+    uint32_t cbLimit = X86DESC_LIMIT_G(&Desc.Legacy);
+    uint64_t u64Base = X86DESC_BASE(&Desc.Legacy);
+
+    /*
+     * Ok, everything checked out fine. Now set the accessed bit before
+     * committing the result into the registers.
+     */
+    if (!(Desc.Legacy.Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+    {
+        rcStrict = iemMemMarkSelDescAccessed(pIemCpu, uSel);
+        if (rcStrict != VINF_SUCCESS)
+            return rcStrict;
+        Desc.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED;
+    }
+
+    /* Commit */
+    pSReg->Sel      = uSel;
+    pSReg->Attr.u   = X86DESC_GET_HID_ATTR(&Desc.Legacy);
+    pSReg->u32Limit = cbLimit;
+    pSReg->u64Base  = u64Base;  /** @todo testcase/investigate: seen claims that the upper half of the base remains unchanged... */
+    pSReg->ValidSel = uSel;
+    pSReg->fFlags   = CPUMSELREG_FLAGS_VALID;
+    if (IEM_IS_GUEST_CPU_INTEL(pIemCpu) && !IEM_FULL_VERIFICATION_REM_ENABLED(pIemCpu))
+        pSReg->Attr.u &= ~X86DESCATTR_UNUSABLE;
+
+    Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(IEMCPU_TO_VMCPU(pIemCpu), pSReg));
+    CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_HIDDEN_SEL_REGS);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Performs a task switch.
+ *
+ * If the task switch is the result of a JMP, CALL or IRET instruction, the
+ * caller is responsible for performing the necessary checks (like DPL, TSS
+ * present etc.) which are specific to JMP/CALL/IRET. See Intel Instruction
+ * reference for JMP, CALL, IRET.
+ *
+ * If the task switch is the due to a software interrupt or hardware exception,
+ * the caller is responsible for validating the TSS selector and descriptor. See
+ * Intel Instruction reference for INT n.
+ *
+ * @returns VBox strict status code.
+ * @param   pIemCpu         The IEM per CPU instance data.
+ * @param   pCtx            The CPU context.
+ * @param   enmTaskSwitch   What caused this task switch.
+ * @param   uNextEip        The EIP effective after the task switch.
+ * @param   fFlags          The flags.
+ * @param   uErr            The error value if IEM_XCPT_FLAGS_ERR is set.
+ * @param   uCr2            The CR2 value if IEM_XCPT_FLAGS_CR2 is set.
+ * @param   SelTSS          The TSS selector of the new task.
+ * @param   pNewDescTSS     Pointer to the new TSS descriptor.
+ */
+static VBOXSTRICTRC iemTaskSwitch(PIEMCPU         pIemCpu,
+                                  PCPUMCTX        pCtx,
+                                  IEMTASKSWITCH   enmTaskSwitch,
+                                  uint32_t        uNextEip,
+                                  uint32_t        fFlags,
+                                  uint16_t        uErr,
+                                  uint64_t        uCr2,
+                                  RTSEL           SelTSS,
+                                  PIEMSELDESC     pNewDescTSS)
+{
+    Assert(!IEM_IS_REAL_MODE(pIemCpu));
+    Assert(pIemCpu->enmCpuMode != IEMMODE_64BIT);
+
+    uint32_t const uNewTSSType = pNewDescTSS->Legacy.Gate.u4Type;
+    Assert(   uNewTSSType == X86_SEL_TYPE_SYS_286_TSS_AVAIL
+           || uNewTSSType == X86_SEL_TYPE_SYS_286_TSS_BUSY
+           || uNewTSSType == X86_SEL_TYPE_SYS_386_TSS_AVAIL
+           || uNewTSSType == X86_SEL_TYPE_SYS_386_TSS_BUSY);
+
+    bool const fIsNewTSS386 = (   uNewTSSType == X86_SEL_TYPE_SYS_386_TSS_AVAIL
+                               || uNewTSSType == X86_SEL_TYPE_SYS_386_TSS_BUSY);
+
+    Log(("iemTaskSwitch: enmTaskSwitch=%u NewTSS=%#x fIsNewTSS386=%RTbool EIP=%#RGv uNextEip=%#RGv\n", enmTaskSwitch, SelTSS,
+         fIsNewTSS386, pCtx->eip, uNextEip));
+
+    /* Update CR2 in case it's a page-fault. */
+    /** @todo This should probably be done much earlier in IEM/PGM. See
+     *        @bugref{5653} comment #49. */
+    if (fFlags & IEM_XCPT_FLAGS_CR2)
+        pCtx->cr2 = uCr2;
+
+    /*
+     * Check the new TSS limit. See Intel spec. 6.15 "Exception and Interrupt Reference"
+     * subsection "Interrupt 10 - Invalid TSS Exception (#TS)".
+     */
+    uint32_t const uNewTSSLimit    = pNewDescTSS->Legacy.Gen.u16LimitLow | (pNewDescTSS->Legacy.Gen.u4LimitHigh << 16);
+    uint32_t const uNewTSSLimitMin = fIsNewTSS386 ? X86_SEL_TYPE_SYS_386_TSS_LIMIT_MIN : X86_SEL_TYPE_SYS_286_TSS_LIMIT_MIN;
+    if (uNewTSSLimit < uNewTSSLimitMin)
+    {
+        Log(("iemTaskSwitch: Invalid new TSS limit. enmTaskSwitch=%u uNewTSSLimit=%#x uNewTSSLimitMin=%#x -> #TS\n",
+             enmTaskSwitch, uNewTSSLimit, uNewTSSLimitMin));
+        return iemRaiseTaskSwitchFaultWithErr(pIemCpu, SelTSS & X86_SEL_MASK_OFF_RPL);
+    }
+
+    /*
+     * Check the current TSS limit. The last written byte to the current TSS during the
+     * task switch will be 2 bytes at offset 0x5C (32-bit) and 1 byte at offset 0x28 (16-bit).
+     * See Intel spec. 7.2.1 "Task-State Segment (TSS)" for static and dynamic fields.
+     *
+     * The AMD docs doesn't mention anything about limit checks with LTR which suggests you can
+     * end up with smaller than "legal" TSS limits.
+     */
+    uint32_t const uCurTSSLimit    = pCtx->tr.u32Limit;
+    uint32_t const uCurTSSLimitMin = fIsNewTSS386 ? 0x5F : 0x29;
+    if (uCurTSSLimit < uCurTSSLimitMin)
+    {
+        Log(("iemTaskSwitch: Invalid current TSS limit. enmTaskSwitch=%u uCurTSSLimit=%#x uCurTSSLimitMin=%#x -> #TS\n",
+             enmTaskSwitch, uCurTSSLimit, uCurTSSLimitMin));
+        return iemRaiseTaskSwitchFaultWithErr(pIemCpu, SelTSS & X86_SEL_MASK_OFF_RPL);
+    }
+
+    /*
+     * Verify that the new TSS can be accessed and map it. Map only the required contents
+     * and not the entire TSS.
+     */
+    void     *pvNewTSS;
+    uint32_t  cbNewTSS    = uNewTSSLimitMin + 1;
+    RTGCPTR   GCPtrNewTSS = X86DESC_BASE(&pNewDescTSS->Legacy);
+    AssertCompile(RTASSERT_OFFSET_OF(X86TSS32, IntRedirBitmap) == X86_SEL_TYPE_SYS_386_TSS_LIMIT_MIN + 1);
+    /** @todo Handle if the TSS crosses a page boundary. Intel specifies that it may
+     *        not perform correct translation if this happens. See Intel spec. 7.2.1
+     *        "Task-State Segment" */
+    VBOXSTRICTRC rcStrict = iemMemMap(pIemCpu, &pvNewTSS, cbNewTSS, UINT8_MAX, GCPtrNewTSS, IEM_ACCESS_SYS_RW);
+    if (rcStrict != VINF_SUCCESS)
+    {
+        Log(("iemTaskSwitch: Failed to read new TSS. enmTaskSwitch=%u cbNewTSS=%u uNewTSSLimit=%u rc=%Rrc\n", enmTaskSwitch,
+             cbNewTSS, uNewTSSLimit, VBOXSTRICTRC_VAL(rcStrict)));
+        return rcStrict;
+    }
+
+    /*
+     * Clear the busy bit in current task's TSS descriptor if it's a task switch due to JMP/IRET.
+     */
+    uint32_t u32EFlags = pCtx->eflags.u32;
+    if (   enmTaskSwitch == IEMTASKSWITCH_JUMP
+        || enmTaskSwitch == IEMTASKSWITCH_IRET)
+    {
+        PX86DESC pDescCurTSS;
+        rcStrict = iemMemMap(pIemCpu, (void **)&pDescCurTSS, sizeof(*pDescCurTSS), UINT8_MAX,
+                             pCtx->gdtr.pGdt + (pCtx->tr.Sel & X86_SEL_MASK), IEM_ACCESS_SYS_RW);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Failed to read new TSS descriptor in GDT. enmTaskSwitch=%u pGdt=%#RX64 rc=%Rrc\n",
+                 enmTaskSwitch, pCtx->gdtr.pGdt, VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+
+        pDescCurTSS->Gate.u4Type &= ~X86_SEL_TYPE_SYS_TSS_BUSY_MASK;
+        rcStrict = iemMemCommitAndUnmap(pIemCpu, pDescCurTSS, IEM_ACCESS_SYS_RW);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Failed to commit new TSS descriptor in GDT. enmTaskSwitch=%u pGdt=%#RX64 rc=%Rrc\n",
+                 enmTaskSwitch, pCtx->gdtr.pGdt, VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+
+        /* Clear EFLAGS.NT (Nested Task) in the eflags memory image, if it's a task switch due to an IRET. */
+        if (enmTaskSwitch == IEMTASKSWITCH_IRET)
+        {
+            Assert(   uNewTSSType == X86_SEL_TYPE_SYS_286_TSS_BUSY
+                   || uNewTSSType == X86_SEL_TYPE_SYS_386_TSS_BUSY);
+            u32EFlags &= ~X86_EFL_NT;
+        }
+    }
+
+    /*
+     * Save the CPU state into the current TSS.
+     */
+    RTGCPTR GCPtrCurTSS = pCtx->tr.u64Base;
+    if (GCPtrNewTSS == GCPtrCurTSS)
+    {
+        Log(("iemTaskSwitch: Switching to the same TSS! enmTaskSwitch=%u GCPtr[Cur|New]TSS=%#RGv\n", enmTaskSwitch, GCPtrCurTSS));
+        Log(("uCurCr3=%#x uCurEip=%#x uCurEflags=%#x uCurEax=%#x uCurEsp=%#x uCurEbp=%#x uCurCS=%#04x uCurSS=%#04x uCurLdt=%#x\n",
+             pCtx->cr3, pCtx->eip, pCtx->eflags.u32, pCtx->eax, pCtx->esp, pCtx->ebp, pCtx->cs.Sel, pCtx->ss.Sel, pCtx->ldtr.Sel));
+    }
+    if (fIsNewTSS386)
+    {
+        /*
+         * Verify that the current TSS (32-bit) can be accessed, only the minimum required size.
+         * See Intel spec. 7.2.1 "Task-State Segment (TSS)" for static and dynamic fields.
+         */
+        void    *pvCurTSS32;
+        uint32_t offCurTSS = RT_OFFSETOF(X86TSS32, eip);
+        uint32_t cbCurTSS  = RT_OFFSETOF(X86TSS32, selLdt) - RT_OFFSETOF(X86TSS32, eip);
+        AssertCompile(RTASSERT_OFFSET_OF(X86TSS32, selLdt) - RTASSERT_OFFSET_OF(X86TSS32, eip) == 64);
+        rcStrict = iemMemMap(pIemCpu, &pvCurTSS32, cbCurTSS, UINT8_MAX, GCPtrCurTSS + offCurTSS, IEM_ACCESS_SYS_RW);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Failed to read current 32-bit TSS. enmTaskSwitch=%u GCPtrCurTSS=%#RGv cb=%u rc=%Rrc\n",
+                 enmTaskSwitch, GCPtrCurTSS, cbCurTSS, VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+
+        /* !! WARNING !! Access -only- the members (dynamic fields) that are mapped, i.e interval [offCurTSS..cbCurTSS). */
+        PX86TSS32 pCurTSS32 = (PX86TSS32)((uintptr_t)pvCurTSS32 - offCurTSS);
+        pCurTSS32->eip    = uNextEip;
+        pCurTSS32->eflags = u32EFlags;
+        pCurTSS32->eax    = pCtx->eax;
+        pCurTSS32->ecx    = pCtx->ecx;
+        pCurTSS32->edx    = pCtx->edx;
+        pCurTSS32->ebx    = pCtx->ebx;
+        pCurTSS32->esp    = pCtx->esp;
+        pCurTSS32->ebp    = pCtx->ebp;
+        pCurTSS32->esi    = pCtx->esi;
+        pCurTSS32->edi    = pCtx->edi;
+        pCurTSS32->es     = pCtx->es.Sel;
+        pCurTSS32->cs     = pCtx->cs.Sel;
+        pCurTSS32->ss     = pCtx->ss.Sel;
+        pCurTSS32->ds     = pCtx->ds.Sel;
+        pCurTSS32->fs     = pCtx->fs.Sel;
+        pCurTSS32->gs     = pCtx->gs.Sel;
+
+        rcStrict = iemMemCommitAndUnmap(pIemCpu, pvCurTSS32, IEM_ACCESS_SYS_RW);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Failed to commit current 32-bit TSS. enmTaskSwitch=%u rc=%Rrc\n", enmTaskSwitch,
+                 VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+    }
+    else
+    {
+        /*
+         * Verify that the current TSS (16-bit) can be accessed. Again, only the minimum required size.
+         */
+        void    *pvCurTSS16;
+        uint32_t offCurTSS = RT_OFFSETOF(X86TSS16, ip);
+        uint32_t cbCurTSS  = RT_OFFSETOF(X86TSS16, selLdt) - RT_OFFSETOF(X86TSS16, ip);
+        AssertCompile(RTASSERT_OFFSET_OF(X86TSS16, selLdt) - RTASSERT_OFFSET_OF(X86TSS16, ip) == 28);
+        rcStrict = iemMemMap(pIemCpu, &pvCurTSS16, cbCurTSS, UINT8_MAX, GCPtrCurTSS + offCurTSS, IEM_ACCESS_SYS_RW);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Failed to read current 16-bit TSS. enmTaskSwitch=%u GCPtrCurTSS=%#RGv cb=%u rc=%Rrc\n",
+                 enmTaskSwitch, GCPtrCurTSS, cbCurTSS, VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+
+        /* !! WARNING !! Access -only- the members (dynamic fields) that are mapped, i.e interval [offCurTSS..cbCurTSS). */
+        PX86TSS16 pCurTSS16 = (PX86TSS16)((uintptr_t)pvCurTSS16 - offCurTSS);
+        pCurTSS16->ip    = uNextEip;
+        pCurTSS16->flags = u32EFlags;
+        pCurTSS16->ax    = pCtx->ax;
+        pCurTSS16->cx    = pCtx->cx;
+        pCurTSS16->dx    = pCtx->dx;
+        pCurTSS16->bx    = pCtx->bx;
+        pCurTSS16->sp    = pCtx->sp;
+        pCurTSS16->bp    = pCtx->bp;
+        pCurTSS16->si    = pCtx->si;
+        pCurTSS16->di    = pCtx->di;
+        pCurTSS16->es    = pCtx->es.Sel;
+        pCurTSS16->cs    = pCtx->cs.Sel;
+        pCurTSS16->ss    = pCtx->ss.Sel;
+        pCurTSS16->ds    = pCtx->ds.Sel;
+
+        rcStrict = iemMemCommitAndUnmap(pIemCpu, pvCurTSS16, IEM_ACCESS_SYS_RW);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Failed to commit current 16-bit TSS. enmTaskSwitch=%u rc=%Rrc\n", enmTaskSwitch,
+                 VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+    }
+
+    /*
+     * Update the previous task link field for the new TSS, if the task switch is due to a CALL/INT_XCPT.
+     */
+    if (   enmTaskSwitch == IEMTASKSWITCH_CALL
+        || enmTaskSwitch == IEMTASKSWITCH_INT_XCPT)
+    {
+        /* 16 or 32-bit TSS doesn't matter, we only access the first, common 16-bit field (selPrev) here. */
+        PX86TSS32 pNewTSS = (PX86TSS32)pvNewTSS;
+        pNewTSS->selPrev  = pCtx->tr.Sel;
+    }
+
+    /*
+     * Read the state from the new TSS into temporaries. Setting it immediately as the new CPU state is tricky,
+     * it's done further below with error handling (e.g. CR3 changes will go through PGM).
+     */
+    uint32_t uNewCr3, uNewEip, uNewEflags, uNewEax, uNewEcx, uNewEdx, uNewEbx, uNewEsp, uNewEbp, uNewEsi, uNewEdi;
+    uint16_t uNewES,  uNewCS, uNewSS, uNewDS, uNewFS, uNewGS, uNewLdt;
+    bool     fNewDebugTrap;
+    if (fIsNewTSS386)
+    {
+        PX86TSS32 pNewTSS32 = (PX86TSS32)pvNewTSS;
+        uNewCr3       = (pCtx->cr0 & X86_CR0_PG) ? pNewTSS32->cr3 : 0;
+        uNewEip       = pNewTSS32->eip;
+        uNewEflags    = pNewTSS32->eflags;
+        uNewEax       = pNewTSS32->eax;
+        uNewEcx       = pNewTSS32->ecx;
+        uNewEdx       = pNewTSS32->edx;
+        uNewEbx       = pNewTSS32->ebx;
+        uNewEsp       = pNewTSS32->esp;
+        uNewEbp       = pNewTSS32->ebp;
+        uNewEsi       = pNewTSS32->esi;
+        uNewEdi       = pNewTSS32->edi;
+        uNewES        = pNewTSS32->es;
+        uNewCS        = pNewTSS32->cs;
+        uNewSS        = pNewTSS32->ss;
+        uNewDS        = pNewTSS32->ds;
+        uNewFS        = pNewTSS32->fs;
+        uNewGS        = pNewTSS32->gs;
+        uNewLdt       = pNewTSS32->selLdt;
+        fNewDebugTrap = RT_BOOL(pNewTSS32->fDebugTrap);
+    }
+    else
+    {
+        PX86TSS16 pNewTSS16 = (PX86TSS16)pvNewTSS;
+        uNewCr3       = 0;
+        uNewEip       = pNewTSS16->ip;
+        uNewEflags    = pNewTSS16->flags;
+        uNewEax       = UINT32_C(0xffff0000) | pNewTSS16->ax;
+        uNewEcx       = UINT32_C(0xffff0000) | pNewTSS16->cx;
+        uNewEdx       = UINT32_C(0xffff0000) | pNewTSS16->dx;
+        uNewEbx       = UINT32_C(0xffff0000) | pNewTSS16->bx;
+        uNewEsp       = UINT32_C(0xffff0000) | pNewTSS16->sp;
+        uNewEbp       = UINT32_C(0xffff0000) | pNewTSS16->bp;
+        uNewEsi       = UINT32_C(0xffff0000) | pNewTSS16->si;
+        uNewEdi       = UINT32_C(0xffff0000) | pNewTSS16->di;
+        uNewES        = pNewTSS16->es;
+        uNewCS        = pNewTSS16->cs;
+        uNewSS        = pNewTSS16->ss;
+        uNewDS        = pNewTSS16->ds;
+        uNewFS        = 0;
+        uNewGS        = 0;
+        uNewLdt       = pNewTSS16->selLdt;
+        fNewDebugTrap = false;
+    }
+
+    if (GCPtrNewTSS == GCPtrCurTSS)
+        Log(("uNewCr3=%#x uNewEip=%#x uNewEflags=%#x uNewEax=%#x uNewEsp=%#x uNewEbp=%#x uNewCS=%#04x uNewSS=%#04x uNewLdt=%#x\n",
+             uNewCr3, uNewEip, uNewEflags, uNewEax, uNewEsp, uNewEbp, uNewCS, uNewSS, uNewLdt));
+
+    /*
+     * We're done accessing the new TSS.
+     */
+    rcStrict = iemMemCommitAndUnmap(pIemCpu, pvNewTSS, IEM_ACCESS_SYS_RW);
+    if (rcStrict != VINF_SUCCESS)
+    {
+        Log(("iemTaskSwitch: Failed to commit new TSS. enmTaskSwitch=%u rc=%Rrc\n", enmTaskSwitch, VBOXSTRICTRC_VAL(rcStrict)));
+        return rcStrict;
+    }
+
+    /*
+     * Set the busy bit in the new TSS descriptor, if the task switch is a JMP/CALL/INT_XCPT.
+     */
+    if (enmTaskSwitch != IEMTASKSWITCH_IRET)
+    {
+        rcStrict = iemMemMap(pIemCpu, (void **)&pNewDescTSS, sizeof(*pNewDescTSS), UINT8_MAX,
+                             pCtx->gdtr.pGdt + (SelTSS & X86_SEL_MASK), IEM_ACCESS_SYS_RW);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Failed to read new TSS descriptor in GDT (2). enmTaskSwitch=%u pGdt=%#RX64 rc=%Rrc\n",
+                 enmTaskSwitch, pCtx->gdtr.pGdt, VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+
+        /* Check that the descriptor indicates the new TSS is available (not busy). */
+        AssertMsg(   pNewDescTSS->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_286_TSS_AVAIL
+                  || pNewDescTSS->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_386_TSS_AVAIL,
+                     ("Invalid TSS descriptor type=%#x", pNewDescTSS->Legacy.Gate.u4Type));
+
+        pNewDescTSS->Legacy.Gate.u4Type |= X86_SEL_TYPE_SYS_TSS_BUSY_MASK;
+        rcStrict = iemMemCommitAndUnmap(pIemCpu, pNewDescTSS, IEM_ACCESS_SYS_RW);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Failed to commit new TSS descriptor in GDT (2). enmTaskSwitch=%u pGdt=%#RX64 rc=%Rrc\n",
+                 enmTaskSwitch, pCtx->gdtr.pGdt, VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+    }
+
+    /*
+     * From this point on, we're technically in the new task. We will defer exceptions
+     * until the completion of the task switch but before executing any instructions in the new task.
+     */
+    pCtx->tr.Sel      = SelTSS;
+    pCtx->tr.ValidSel = SelTSS;
+    pCtx->tr.fFlags   = CPUMSELREG_FLAGS_VALID;
+    pCtx->tr.Attr.u   = X86DESC_GET_HID_ATTR(&pNewDescTSS->Legacy);
+    pCtx->tr.u32Limit = X86DESC_LIMIT_G(&pNewDescTSS->Legacy);
+    pCtx->tr.u64Base  = X86DESC_BASE(&pNewDescTSS->Legacy);
+    CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_TR);
+
+    /* Set the busy bit in TR. */
+    pCtx->tr.Attr.n.u4Type |= X86_SEL_TYPE_SYS_TSS_BUSY_MASK;
+    /* Set EFLAGS.NT (Nested Task) in the eflags loaded from the new TSS, if it's a task switch due to a CALL/INT_XCPT. */
+    if (   enmTaskSwitch == IEMTASKSWITCH_CALL
+        || enmTaskSwitch == IEMTASKSWITCH_INT_XCPT)
+    {
+        uNewEflags |= X86_EFL_NT;
+    }
+
+    pCtx->dr[7] &= ~X86_DR7_LE_ALL;     /** @todo Should we clear DR7.LE bit too? */
+    pCtx->cr0   |= X86_CR0_TS;
+    CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_CR0);
+
+    pCtx->eip    = uNewEip;
+    pCtx->eax    = uNewEax;
+    pCtx->ecx    = uNewEcx;
+    pCtx->edx    = uNewEdx;
+    pCtx->ebx    = uNewEbx;
+    pCtx->esp    = uNewEsp;
+    pCtx->ebp    = uNewEbp;
+    pCtx->esi    = uNewEsi;
+    pCtx->edi    = uNewEdi;
+
+    uNewEflags &= X86_EFL_LIVE_MASK;
+    uNewEflags |= X86_EFL_RA1_MASK;
+    IEMMISC_SET_EFL(pIemCpu, pCtx, uNewEflags);
+
+    /*
+     * Switch the selectors here and do the segment checks later. If we throw exceptions, the selectors
+     * will be valid in the exception handler. We cannot update the hidden parts until we've switched CR3
+     * due to the hidden part data originating from the guest LDT/GDT which is accessed through paging.
+     */
+    pCtx->es.Sel       = uNewES;
+    pCtx->es.fFlags    = CPUMSELREG_FLAGS_STALE;
+    pCtx->es.Attr.u   &= ~X86DESCATTR_P;
+
+    pCtx->cs.Sel       = uNewCS;
+    pCtx->cs.fFlags    = CPUMSELREG_FLAGS_STALE;
+    pCtx->cs.Attr.u   &= ~X86DESCATTR_P;
+
+    pCtx->ss.Sel       = uNewSS;
+    pCtx->ss.fFlags    = CPUMSELREG_FLAGS_STALE;
+    pCtx->ss.Attr.u   &= ~X86DESCATTR_P;
+
+    pCtx->ds.Sel       = uNewDS;
+    pCtx->ds.fFlags    = CPUMSELREG_FLAGS_STALE;
+    pCtx->ds.Attr.u   &= ~X86DESCATTR_P;
+
+    pCtx->fs.Sel       = uNewFS;
+    pCtx->fs.fFlags    = CPUMSELREG_FLAGS_STALE;
+    pCtx->fs.Attr.u   &= ~X86DESCATTR_P;
+
+    pCtx->gs.Sel       = uNewGS;
+    pCtx->gs.fFlags    = CPUMSELREG_FLAGS_STALE;
+    pCtx->gs.Attr.u   &= ~X86DESCATTR_P;
+    CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_HIDDEN_SEL_REGS);
+
+    pCtx->ldtr.Sel     = uNewLdt;
+    pCtx->ldtr.fFlags  = CPUMSELREG_FLAGS_STALE;
+    pCtx->ldtr.Attr.u &= ~X86DESCATTR_P;
+    CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_LDTR);
+
+    if (IEM_IS_GUEST_CPU_INTEL(pIemCpu) && !IEM_FULL_VERIFICATION_REM_ENABLED(pIemCpu))
+    {
+        pCtx->es.Attr.u   |= X86DESCATTR_UNUSABLE;
+        pCtx->cs.Attr.u   |= X86DESCATTR_UNUSABLE;
+        pCtx->ss.Attr.u   |= X86DESCATTR_UNUSABLE;
+        pCtx->ds.Attr.u   |= X86DESCATTR_UNUSABLE;
+        pCtx->fs.Attr.u   |= X86DESCATTR_UNUSABLE;
+        pCtx->gs.Attr.u   |= X86DESCATTR_UNUSABLE;
+        pCtx->ldtr.Attr.u |= X86DESCATTR_UNUSABLE;
+    }
+
+    /*
+     * Switch CR3 for the new task.
+     */
+    if (   fIsNewTSS386
+        && (pCtx->cr0 & X86_CR0_PG))
+    {
+        /** @todo Should we update and flush TLBs only if CR3 value actually changes? */
+        if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
+        {
+            int rc = CPUMSetGuestCR3(IEMCPU_TO_VMCPU(pIemCpu), uNewCr3);
+            AssertRCSuccessReturn(rc, rc);
+        }
+        else
+            pCtx->cr3 = uNewCr3;
+
+        /* Inform PGM. */
+        if (!IEM_FULL_VERIFICATION_ENABLED(pIemCpu))
+        {
+            int rc = PGMFlushTLB(IEMCPU_TO_VMCPU(pIemCpu), pCtx->cr3, !(pCtx->cr4 & X86_CR4_PGE));
+            AssertRCReturn(rc, rc);
+            /* ignore informational status codes */
+        }
+        CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_CR3);
+    }
+
+    /*
+     * Switch LDTR for the new task.
+     */
+    if (!(uNewLdt & X86_SEL_MASK_OFF_RPL))
+        iemHlpLoadNullDataSelectorProt(pIemCpu, &pCtx->ldtr, uNewLdt);
+    else
+    {
+        Assert(!pCtx->ldtr.Attr.n.u1Present);       /* Ensures that LDT.TI check passes in iemMemFetchSelDesc() below. */
+
+        IEMSELDESC DescNewLdt;
+        rcStrict = iemMemFetchSelDesc(pIemCpu, &DescNewLdt, uNewLdt, X86_XCPT_TS);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: fetching LDT failed. enmTaskSwitch=%u uNewLdt=%u cbGdt=%u rc=%Rrc\n", enmTaskSwitch,
+                 uNewLdt, pCtx->gdtr.cbGdt, VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+        if (   !DescNewLdt.Legacy.Gen.u1Present
+            ||  DescNewLdt.Legacy.Gen.u1DescType
+            ||  DescNewLdt.Legacy.Gen.u4Type != X86_SEL_TYPE_SYS_LDT)
+        {
+            Log(("iemTaskSwitch: Invalid LDT. enmTaskSwitch=%u uNewLdt=%u DescNewLdt.Legacy.u=%#RX64 -> #TS\n", enmTaskSwitch,
+                 uNewLdt, DescNewLdt.Legacy.u));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uNewLdt & X86_SEL_MASK_OFF_RPL);
+        }
+
+        pCtx->ldtr.ValidSel = uNewLdt;
+        pCtx->ldtr.fFlags   = CPUMSELREG_FLAGS_VALID;
+        pCtx->ldtr.u64Base  = X86DESC_BASE(&DescNewLdt.Legacy);
+        pCtx->ldtr.u32Limit = X86DESC_LIMIT_G(&DescNewLdt.Legacy);
+        pCtx->ldtr.Attr.u   = X86DESC_GET_HID_ATTR(&DescNewLdt.Legacy);
+        if (IEM_IS_GUEST_CPU_INTEL(pIemCpu) && !IEM_FULL_VERIFICATION_REM_ENABLED(pIemCpu))
+            pCtx->ldtr.Attr.u &= ~X86DESCATTR_UNUSABLE;
+        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(IEMCPU_TO_VMCPU(pIemCpu), &pCtx->ldtr));
+    }
+
+    IEMSELDESC DescSS;
+    if (IEM_IS_V86_MODE(pIemCpu))
+    {
+        pIemCpu->uCpl = 3;
+        iemHlpLoadSelectorInV86Mode(pIemCpu, &pCtx->es, uNewES);
+        iemHlpLoadSelectorInV86Mode(pIemCpu, &pCtx->cs, uNewCS);
+        iemHlpLoadSelectorInV86Mode(pIemCpu, &pCtx->ss, uNewSS);
+        iemHlpLoadSelectorInV86Mode(pIemCpu, &pCtx->ds, uNewDS);
+        iemHlpLoadSelectorInV86Mode(pIemCpu, &pCtx->fs, uNewFS);
+        iemHlpLoadSelectorInV86Mode(pIemCpu, &pCtx->gs, uNewGS);
+    }
+    else
+    {
+        uint8_t uNewCpl = (uNewCS & X86_SEL_RPL);
+
+        /*
+         * Load the stack segment for the new task.
+         */
+        if (!(uNewSS & X86_SEL_MASK_OFF_RPL))
+        {
+            Log(("iemTaskSwitch: Null stack segment. enmTaskSwitch=%u uNewSS=%#x -> #TS\n", enmTaskSwitch, uNewSS));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uNewSS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        /* Fetch the descriptor. */
+        rcStrict = iemMemFetchSelDesc(pIemCpu, &DescSS, uNewSS, X86_XCPT_TS);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: failed to fetch SS. uNewSS=%#x rc=%Rrc\n", uNewSS,
+                 VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+
+        /* SS must be a data segment and writable. */
+        if (    !DescSS.Legacy.Gen.u1DescType
+            ||  (DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_CODE)
+            || !(DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_WRITE))
+        {
+            Log(("iemTaskSwitch: SS invalid descriptor type. uNewSS=%#x u1DescType=%u u4Type=%#x\n",
+                 uNewSS, DescSS.Legacy.Gen.u1DescType, DescSS.Legacy.Gen.u4Type));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uNewSS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        /* The SS.RPL, SS.DPL, CS.RPL (CPL) must be equal. */
+        if (   (uNewSS & X86_SEL_RPL) != uNewCpl
+            || DescSS.Legacy.Gen.u2Dpl != uNewCpl)
+        {
+            Log(("iemTaskSwitch: Invalid priv. for SS. uNewSS=%#x SS.DPL=%u uNewCpl=%u -> #TS\n", uNewSS, DescSS.Legacy.Gen.u2Dpl,
+                 uNewCpl));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uNewSS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        /* Is it there? */
+        if (!DescSS.Legacy.Gen.u1Present)
+        {
+            Log(("iemTaskSwitch: SS not present. uNewSS=%#x -> #NP\n", uNewSS));
+            return iemRaiseSelectorNotPresentWithErr(pIemCpu, uNewSS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        uint32_t cbLimit = X86DESC_LIMIT_G(&DescSS.Legacy);
+        uint64_t u64Base = X86DESC_BASE(&DescSS.Legacy);
+
+        /* Set the accessed bit before committing the result into SS. */
+        if (!(DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+        {
+            rcStrict = iemMemMarkSelDescAccessed(pIemCpu, uNewSS);
+            if (rcStrict != VINF_SUCCESS)
+                return rcStrict;
+            DescSS.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED;
+        }
+
+        /* Commit SS. */
+        pCtx->ss.Sel      = uNewSS;
+        pCtx->ss.ValidSel = uNewSS;
+        pCtx->ss.Attr.u   = X86DESC_GET_HID_ATTR(&DescSS.Legacy);
+        pCtx->ss.u32Limit = cbLimit;
+        pCtx->ss.u64Base  = u64Base;
+        pCtx->ss.fFlags   = CPUMSELREG_FLAGS_VALID;
+        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(IEMCPU_TO_VMCPU(pIemCpu), &pCtx->ss));
+
+        /* CPL has changed, update IEM before loading rest of segments. */
+        pIemCpu->uCpl = uNewCpl;
+
+        /*
+         * Load the data segments for the new task.
+         */
+        rcStrict = iemHlpTaskSwitchLoadDataSelectorInProtMode(pIemCpu, &pCtx->es, uNewES);
+        if (rcStrict != VINF_SUCCESS)
+            return rcStrict;
+        rcStrict = iemHlpTaskSwitchLoadDataSelectorInProtMode(pIemCpu, &pCtx->ds, uNewDS);
+        if (rcStrict != VINF_SUCCESS)
+            return rcStrict;
+        rcStrict = iemHlpTaskSwitchLoadDataSelectorInProtMode(pIemCpu, &pCtx->fs, uNewFS);
+        if (rcStrict != VINF_SUCCESS)
+            return rcStrict;
+        rcStrict = iemHlpTaskSwitchLoadDataSelectorInProtMode(pIemCpu, &pCtx->gs, uNewGS);
+        if (rcStrict != VINF_SUCCESS)
+            return rcStrict;
+
+        /*
+         * Load the code segment for the new task.
+         */
+        if (!(uNewCS & X86_SEL_MASK_OFF_RPL))
+        {
+            Log(("iemTaskSwitch #TS: Null code segment. enmTaskSwitch=%u uNewCS=%#x\n", enmTaskSwitch, uNewCS));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uNewCS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        /* Fetch the descriptor. */
+        IEMSELDESC DescCS;
+        rcStrict = iemMemFetchSelDesc(pIemCpu, &DescCS, uNewCS, X86_XCPT_TS);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: failed to fetch CS. uNewCS=%u rc=%Rrc\n", uNewCS, VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+
+        /* CS must be a code segment. */
+        if (   !DescCS.Legacy.Gen.u1DescType
+            || !(DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_CODE))
+        {
+            Log(("iemTaskSwitch: CS invalid descriptor type. uNewCS=%#x u1DescType=%u u4Type=%#x -> #TS\n", uNewCS,
+                 DescCS.Legacy.Gen.u1DescType, DescCS.Legacy.Gen.u4Type));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uNewCS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        /* For conforming CS, DPL must be less than or equal to the RPL. */
+        if (   (DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_CONF)
+            && DescCS.Legacy.Gen.u2Dpl > (uNewCS & X86_SEL_RPL))
+        {
+            Log(("iemTaskSwitch: confirming CS DPL > RPL. uNewCS=%#x u4Type=%#x DPL=%u -> #TS\n", uNewCS, DescCS.Legacy.Gen.u4Type,
+                 DescCS.Legacy.Gen.u2Dpl));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uNewCS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        /* For non-conforming CS, DPL must match RPL. */
+        if (   !(DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_CONF)
+            && DescCS.Legacy.Gen.u2Dpl != (uNewCS & X86_SEL_RPL))
+        {
+            Log(("iemTaskSwitch: non-confirming CS DPL RPL mismatch. uNewCS=%#x u4Type=%#x DPL=%u -> #TS\n", uNewCS,
+                 DescCS.Legacy.Gen.u4Type, DescCS.Legacy.Gen.u2Dpl));
+            return iemRaiseTaskSwitchFaultWithErr(pIemCpu, uNewCS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        /* Is it there? */
+        if (!DescCS.Legacy.Gen.u1Present)
+        {
+            Log(("iemTaskSwitch: CS not present. uNewCS=%#x -> #NP\n", uNewCS));
+            return iemRaiseSelectorNotPresentWithErr(pIemCpu, uNewCS & X86_SEL_MASK_OFF_RPL);
+        }
+
+        cbLimit = X86DESC_LIMIT_G(&DescCS.Legacy);
+        u64Base = X86DESC_BASE(&DescCS.Legacy);
+
+        /* Set the accessed bit before committing the result into CS. */
+        if (!(DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+        {
+            rcStrict = iemMemMarkSelDescAccessed(pIemCpu, uNewCS);
+            if (rcStrict != VINF_SUCCESS)
+                return rcStrict;
+            DescCS.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED;
+        }
+
+        /* Commit CS. */
+        pCtx->cs.Sel      = uNewCS;
+        pCtx->cs.ValidSel = uNewCS;
+        pCtx->cs.Attr.u   = X86DESC_GET_HID_ATTR(&DescCS.Legacy);
+        pCtx->cs.u32Limit = cbLimit;
+        pCtx->cs.u64Base  = u64Base;
+        pCtx->cs.fFlags   = CPUMSELREG_FLAGS_VALID;
+        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(IEMCPU_TO_VMCPU(pIemCpu), &pCtx->cs));
+    }
+
+    /** @todo Debug trap. */
+    if (fIsNewTSS386 && fNewDebugTrap)
+        Log(("iemTaskSwitch: Debug Trap set in new TSS. Not implemented!\n"));
+
+    /*
+     * Construct the error code masks based on what caused this task switch.
+     * See Intel Instruction reference for INT.
+     */
+    uint16_t uExt;
+    if (   enmTaskSwitch == IEMTASKSWITCH_INT_XCPT
+        && !(fFlags & IEM_XCPT_FLAGS_T_SOFT_INT))
+    {
+        uExt = 1;
+    }
+    else
+        uExt = 0;
+
+    /*
+     * Push any error code on to the new stack.
+     */
+    if (fFlags & IEM_XCPT_FLAGS_ERR)
+    {
+        Assert(enmTaskSwitch == IEMTASKSWITCH_INT_XCPT);
+        uint32_t cbLimitSS = X86DESC_LIMIT_G(&DescSS.Legacy);
+        uint8_t const cbStackFrame = fIsNewTSS386 ? 4 : 2;
+
+        /* Check that there is sufficient space on the stack. */
+        /** @todo Factor out segment limit checking for normal/expand down segments
+         *        into a separate function. */
+        if (!(DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_DOWN))
+        {
+            if (   pCtx->esp - 1 > cbLimitSS
+                || pCtx->esp < cbStackFrame)
+            {
+                /** @todo Intel says #SS(EXT) for INT/XCPT, I couldn't figure out AMD yet. */
+                Log(("iemTaskSwitch: SS=%#x ESP=%#x cbStackFrame=%#x is out of bounds -> #SS\n", pCtx->ss.Sel, pCtx->esp,
+                     cbStackFrame));
+                return iemRaiseStackSelectorNotPresentWithErr(pIemCpu, uExt);
+            }
+        }
+        else
+        {
+            if (   pCtx->esp - 1 > (DescSS.Legacy.Gen.u4Type & X86_DESC_DB ? UINT32_MAX : UINT32_C(0xffff))
+                || pCtx->esp - cbStackFrame < cbLimitSS + UINT32_C(1))
+            {
+                Log(("iemTaskSwitch: SS=%#x ESP=%#x cbStackFrame=%#x (expand down) is out of bounds -> #SS\n", pCtx->ss.Sel, pCtx->esp,
+                     cbStackFrame));
+                return iemRaiseStackSelectorNotPresentWithErr(pIemCpu, uExt);
+            }
+        }
+
+
+        if (fIsNewTSS386)
+            rcStrict = iemMemStackPushU32(pIemCpu, uErr);
+        else
+            rcStrict = iemMemStackPushU16(pIemCpu, uErr);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("iemTaskSwitch: Can't push error code to new task's stack. %s-bit TSS. rc=%Rrc\n", fIsNewTSS386 ? "32" : "16",
+                 VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+    }
+
+    /* Check the new EIP against the new CS limit. */
+    if (pCtx->eip > pCtx->cs.u32Limit)
     {
-        pSReg->fFlags   = CPUMSELREG_FLAGS_VALID;
-        /** @todo check this on AMD-V */
-        pSReg->u64Base  = 0;
-        pSReg->u32Limit = 0;
+        Log(("iemHlpTaskSwitchLoadDataSelectorInProtMode: New EIP exceeds CS limit. uNewEIP=%#RGv CS limit=%u -> #GP(0)\n",
+             pCtx->eip, pCtx->cs.u32Limit));
+        /** @todo Intel says #GP(EXT) for INT/XCPT, I couldn't figure out AMD yet. */
+        return iemRaiseGeneralProtectionFault(pIemCpu, uExt);
     }
+
+    Log(("iemTaskSwitch: Success! New CS:EIP=%#04x:%#x SS=%#04x\n", pCtx->cs.Sel, pCtx->eip, pCtx->ss.Sel));
+    return fFlags & IEM_XCPT_FLAGS_T_CPU_XCPT ? VINF_IEM_RAISED_XCPT : VINF_SUCCESS;
 }
 
 
@@ -2296,8 +3171,6 @@ iemRaiseXcptOrIntInProtMode(PIEMCPU     pIemCpu,
                             uint16_t    uErr,
                             uint64_t    uCr2)
 {
-    NOREF(cbInstr);
-
     /*
      * Read the IDT entry.
      */
@@ -2324,6 +3197,7 @@ iemRaiseXcptOrIntInProtMode(PIEMCPU     pIemCpu,
         Log(("RaiseXcptOrIntInProtMode %#x - not system selector (%#x) -> #GP\n", u8Vector, Idte.Gate.u4Type));
         return iemRaiseGeneralProtectionFault(pIemCpu, X86_TRAP_ERR_IDT | ((uint16_t)u8Vector << X86_TRAP_ERR_SEL_SHIFT));
     }
+    bool     fTaskGate   = false;
     uint8_t  f32BitGate  = true;
     uint32_t fEflToClear = X86_EFL_TF | X86_EFL_NT | X86_EFL_RF | X86_EFL_VM;
     switch (Idte.Gate.u4Type)
@@ -2353,8 +3227,11 @@ iemRaiseXcptOrIntInProtMode(PIEMCPU     pIemCpu,
             break;
 
         case X86_SEL_TYPE_SYS_TASK_GATE:
-            /** @todo task gates. */
-            IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Task gates\n")); /** @todo Implement task gate support. */
+            fTaskGate = true;
+#ifndef IEM_IMPLEMENTS_TASKSWITCH
+            IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Task gates\n"));
+#endif
+            break;
 
         case X86_SEL_TYPE_SYS_286_TRAP_GATE:
             f32BitGate = false;
@@ -2381,6 +3258,50 @@ iemRaiseXcptOrIntInProtMode(PIEMCPU     pIemCpu,
         return iemRaiseSelectorNotPresentWithErr(pIemCpu, X86_TRAP_ERR_IDT | ((uint16_t)u8Vector << X86_TRAP_ERR_SEL_SHIFT));
     }
 
+    /* Is it a task-gate? */
+    if (fTaskGate)
+    {
+        /*
+         * Construct the error code masks based on what caused this task switch.
+         * See Intel Instruction reference for INT.
+         */
+        uint16_t const uExt     = (fFlags & IEM_XCPT_FLAGS_T_SOFT_INT) ? 0 : 1;
+        uint16_t const uSelMask = X86_SEL_MASK_OFF_RPL;
+        RTSEL          SelTSS   = Idte.Gate.u16Sel;
+
+        /*
+         * Fetch the TSS descriptor in the GDT.
+         */
+        IEMSELDESC DescTSS;
+        rcStrict = iemMemFetchSelDescWithErr(pIemCpu, &DescTSS, SelTSS, X86_XCPT_GP, (SelTSS & uSelMask) | uExt);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            Log(("RaiseXcptOrIntInProtMode %#x - failed to fetch TSS selector %#x, rc=%Rrc\n", u8Vector, SelTSS,
+                 VBOXSTRICTRC_VAL(rcStrict)));
+            return rcStrict;
+        }
+
+        /* The TSS descriptor must be a system segment and be available (not busy). */
+        if (   DescTSS.Legacy.Gen.u1DescType
+            || (   DescTSS.Legacy.Gen.u4Type != X86_SEL_TYPE_SYS_286_TSS_AVAIL
+                && DescTSS.Legacy.Gen.u4Type != X86_SEL_TYPE_SYS_386_TSS_AVAIL))
+        {
+            Log(("RaiseXcptOrIntInProtMode %#x - TSS selector %#x of task gate not a system descriptor or not available %#RX64\n",
+                 u8Vector, SelTSS, DescTSS.Legacy.au64));
+            return iemRaiseGeneralProtectionFault(pIemCpu, (SelTSS & uSelMask) | uExt);
+        }
+
+        /* The TSS must be present. */
+        if (!DescTSS.Legacy.Gen.u1Present)
+        {
+            Log(("RaiseXcptOrIntInProtMode %#x - TSS selector %#x not present %#RX64\n", u8Vector, SelTSS, DescTSS.Legacy.au64));
+            return iemRaiseSelectorNotPresentWithErr(pIemCpu, (SelTSS & uSelMask) | uExt);
+        }
+
+        /* Do the actual task switch. */
+        return iemTaskSwitch(pIemCpu, pCtx, IEMTASKSWITCH_INT_XCPT, pCtx->eip, fFlags, uErr, uCr2, SelTSS, &DescTSS);
+    }
+
     /* A null CS is bad. */
     RTSEL NewCS = Idte.Gate.u16Sel;
     if (!(NewCS & X86_SEL_MASK_OFF_RPL))
@@ -2477,20 +3398,29 @@ iemRaiseXcptOrIntInProtMode(PIEMCPU     pIemCpu,
 
         /* Check that there is sufficient space for the stack frame. */
         uint32_t cbLimitSS = X86DESC_LIMIT_G(&DescSS.Legacy);
-        if (DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_DOWN)
-        {
-            IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Expand down segments\n")); /** @todo Implement expand down segment support. */
-        }
-
         uint8_t const cbStackFrame = !(fEfl & X86_EFL_VM)
                                    ? (fFlags & IEM_XCPT_FLAGS_ERR ? 12 : 10) << f32BitGate
                                    : (fFlags & IEM_XCPT_FLAGS_ERR ? 20 : 18) << f32BitGate;
-        if (   uNewEsp - 1 > cbLimitSS
-            || uNewEsp < cbStackFrame)
+
+        if (!(DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_DOWN))
+        {
+            if (   uNewEsp - 1 > cbLimitSS
+                || uNewEsp < cbStackFrame)
+            {
+                Log(("RaiseXcptOrIntInProtMode: %#x - SS=%#x ESP=%#x cbStackFrame=%#x is out of bounds -> #GP\n",
+                     u8Vector, NewSS, uNewEsp, cbStackFrame));
+                return iemRaiseSelectorBoundsBySelector(pIemCpu, NewSS);
+            }
+        }
+        else
         {
-            Log(("RaiseXcptOrIntInProtMode: %#x - SS=%#x ESP=%#x cbStackFrame=%#x is out of bounds -> #GP\n",
-                 u8Vector, NewSS, uNewEsp, cbStackFrame));
-            return iemRaiseSelectorBoundsBySelector(pIemCpu, NewSS);
+            if (   uNewEsp - 1 > (DescSS.Legacy.Gen.u4Type & X86_DESC_DB ? UINT32_MAX : UINT32_C(0xffff))
+                || uNewEsp - cbStackFrame < cbLimitSS + UINT32_C(1))
+            {
+                Log(("RaiseXcptOrIntInProtMode: %#x - SS=%#x ESP=%#x cbStackFrame=%#x (expand down) is out of bounds -> #GP\n",
+                     u8Vector, NewSS, uNewEsp, cbStackFrame));
+                return iemRaiseSelectorBoundsBySelector(pIemCpu, NewSS);
+            }
         }
 
         /*
@@ -2676,8 +3606,6 @@ iemRaiseXcptOrIntInLongMode(PIEMCPU     pIemCpu,
                             uint16_t    uErr,
                             uint64_t    uCr2)
 {
-    NOREF(cbInstr);
-
     /*
      * Read the IDT entry.
      */
@@ -2923,6 +3851,10 @@ iemRaiseXcptOrInt(PIEMCPU     pIemCpu,
                   uint64_t    uCr2)
 {
     PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
+#ifdef IN_RING0
+    int rc = HMR0EnsureCompleteBasicContext(IEMCPU_TO_VMCPU(pIemCpu), pCtx);
+    AssertRCReturn(rc, rc);
+#endif
 
     /*
      * Perform the V8086 IOPL check and upgrade the fault without nesting.
@@ -3073,13 +4005,11 @@ DECL_NO_INLINE(static, VBOXSTRICTRC) iemRaiseDeviceNotAvailable(PIEMCPU pIemCpu)
 }
 
 
-#ifdef SOME_UNUSED_FUNCTION
 /** \#TS(err) - 0a.  */
 DECL_NO_INLINE(static, VBOXSTRICTRC) iemRaiseTaskSwitchFaultWithErr(PIEMCPU pIemCpu, uint16_t uErr)
 {
     return iemRaiseXcptOrInt(pIemCpu, 0, X86_XCPT_TS, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR, uErr, 0);
 }
-#endif
 
 
 /** \#TS(tr) - 0a.  */
@@ -3137,6 +4067,13 @@ DECL_NO_INLINE(static, VBOXSTRICTRC) iemRaiseStackSelectorNotPresentBySelector(P
 }
 
 
+/** \#SS(err) - 0c.  */
+DECL_NO_INLINE(static, VBOXSTRICTRC) iemRaiseStackSelectorNotPresentWithErr(PIEMCPU pIemCpu, uint16_t uErr)
+{
+    return iemRaiseXcptOrInt(pIemCpu, 0, X86_XCPT_SS, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR, uErr, 0);
+}
+
+
 /** \#GP(n) - 0d.  */
 DECL_NO_INLINE(static, VBOXSTRICTRC) iemRaiseGeneralProtectionFault(PIEMCPU pIemCpu, uint16_t uErr)
 {
@@ -3671,24 +4608,6 @@ static uint64_t iemGRegFetchU64(PIEMCPU pIemCpu, uint8_t iReg)
 
 
 /**
- * Is the FPU state in FXSAVE format or not.
- *
- * @returns true if it is, false if it's in FNSAVE.
- * @param   pVCpu               Pointer to the VMCPU.
- */
-DECLINLINE(bool) iemFRegIsFxSaveFormat(PIEMCPU pIemCpu)
-{
-#ifdef RT_ARCH_AMD64
-    NOREF(pIemCpu);
-    return true;
-#else
-    NOREF(pIemCpu); /// @todo return pVCpu->pVMR3->cpum.s.CPUFeatures.edx.u1FXSR;
-    return true;
-#endif
-}
-
-
-/**
  * Adds a 8-bit signed jump offset to RIP/EIP/IP.
  *
  * May raise a \#GP(0) if the new RIP is non-canonical or outside the code
@@ -4166,46 +5085,6 @@ DECLINLINE(RTGCPTR) iemRegGetRspForPopEx(PCIEMCPU pIemCpu, PCCPUMCTX pCtx, PRTUI
     return GCPtrTop;
 }
 
-
-/**
- * Checks if an Intel CPUID feature bit is set.
- *
- * @returns true / false.
- *
- * @param   pIemCpu             The IEM per CPU data.
- * @param   fEdx                The EDX bit to test, or 0 if ECX.
- * @param   fEcx                The ECX bit to test, or 0 if EDX.
- * @remarks Used via IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX,
- *          IEM_IS_INTEL_CPUID_FEATURE_PRESENT_ECX and others.
- */
-static bool iemRegIsIntelCpuIdFeaturePresent(PIEMCPU pIemCpu, uint32_t fEdx, uint32_t fEcx)
-{
-    uint32_t uEax, uEbx, uEcx, uEdx;
-    CPUMGetGuestCpuId(IEMCPU_TO_VMCPU(pIemCpu), 0x00000001, &uEax, &uEbx, &uEcx, &uEdx);
-    return (fEcx && (uEcx & fEcx))
-        || (fEdx && (uEdx & fEdx));
-}
-
-
-/**
- * Checks if an AMD CPUID feature bit is set.
- *
- * @returns true / false.
- *
- * @param   pIemCpu             The IEM per CPU data.
- * @param   fEdx                The EDX bit to test, or 0 if ECX.
- * @param   fEcx                The ECX bit to test, or 0 if EDX.
- * @remarks Used via IEM_IS_AMD_CPUID_FEATURE_PRESENT_EDX,
- *          IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX and others.
- */
-static bool iemRegIsAmdCpuIdFeaturePresent(PIEMCPU pIemCpu, uint32_t fEdx, uint32_t fEcx)
-{
-    uint32_t uEax, uEbx, uEcx, uEdx;
-    CPUMGetGuestCpuId(IEMCPU_TO_VMCPU(pIemCpu), 0x80000001, &uEax, &uEbx, &uEcx, &uEdx);
-    return (fEcx && (uEcx & fEcx))
-        || (fEdx && (uEdx & fEdx));
-}
-
 /** @}  */
 
 
@@ -4264,36 +5143,38 @@ DECLINLINE(void) iemFpuStoreQNan(PRTFLOAT80U pReg)
  *
  * @param   pIemCpu             The IEM per CPU data.
  * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  */
-DECLINLINE(void) iemFpuUpdateOpcodeAndIpWorker(PIEMCPU pIemCpu, PCPUMCTX pCtx)
+DECLINLINE(void) iemFpuUpdateOpcodeAndIpWorker(PIEMCPU pIemCpu, PCPUMCTX pCtx, PX86FXSTATE pFpuCtx)
 {
-    pCtx->fpu.FOP   = pIemCpu->abOpcode[pIemCpu->offFpuOpcode]
-                    | ((uint16_t)(pIemCpu->abOpcode[pIemCpu->offFpuOpcode - 1] & 0x7) << 8);
-    /** @todo FPU.CS and FPUIP needs to be kept seperately. */
+    pFpuCtx->FOP       = pIemCpu->abOpcode[pIemCpu->offFpuOpcode]
+                       | ((uint16_t)(pIemCpu->abOpcode[pIemCpu->offFpuOpcode - 1] & 0x7) << 8);
+    /** @todo x87.CS and FPUIP needs to be kept seperately. */
     if (IEM_IS_REAL_OR_V86_MODE(pIemCpu))
     {
         /** @todo Testcase: making assumptions about how FPUIP and FPUDP are handled
          *        happens in real mode here based on the fnsave and fnstenv images. */
-        pCtx->fpu.CS    = 0;
-        pCtx->fpu.FPUIP = pCtx->eip | ((uint32_t)pCtx->cs.Sel << 4);
+        pFpuCtx->CS    = 0;
+        pFpuCtx->FPUIP = pCtx->eip | ((uint32_t)pCtx->cs.Sel << 4);
     }
     else
     {
-        pCtx->fpu.CS    = pCtx->cs.Sel;
-        pCtx->fpu.FPUIP = pCtx->rip;
+        pFpuCtx->CS    = pCtx->cs.Sel;
+        pFpuCtx->FPUIP = pCtx->rip;
     }
 }
 
 
 /**
- * Updates the FPU.DS and FPUDP registers.
+ * Updates the x87.DS and FPUDP registers.
  *
  * @param   pIemCpu             The IEM per CPU data.
  * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  * @param   iEffSeg             The effective segment register.
  * @param   GCPtrEff            The effective address relative to @a iEffSeg.
  */
-DECLINLINE(void) iemFpuUpdateDP(PIEMCPU pIemCpu, PCPUMCTX pCtx, uint8_t iEffSeg, RTGCPTR GCPtrEff)
+DECLINLINE(void) iemFpuUpdateDP(PIEMCPU pIemCpu, PCPUMCTX pCtx, PX86FXSTATE pFpuCtx, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
     RTSEL sel;
     switch (iEffSeg)
@@ -4308,16 +5189,16 @@ DECLINLINE(void) iemFpuUpdateDP(PIEMCPU pIemCpu, PCPUMCTX pCtx, uint8_t iEffSeg,
             AssertMsgFailed(("%d\n", iEffSeg));
             sel = pCtx->ds.Sel;
     }
-    /** @todo FPU.DS and FPUDP needs to be kept seperately. */
+    /** @todo pFpuCtx->DS and FPUDP needs to be kept seperately. */
     if (IEM_IS_REAL_OR_V86_MODE(pIemCpu))
     {
-        pCtx->fpu.DS    = 0;
-        pCtx->fpu.FPUDP = (uint32_t)GCPtrEff | ((uint32_t)sel << 4);
+        pFpuCtx->DS    = 0;
+        pFpuCtx->FPUDP = (uint32_t)GCPtrEff | ((uint32_t)sel << 4);
     }
     else
     {
-        pCtx->fpu.DS    = sel;
-        pCtx->fpu.FPUDP = GCPtrEff;
+        pFpuCtx->DS    = sel;
+        pFpuCtx->FPUDP = GCPtrEff;
     }
 }
 
@@ -4325,42 +5206,42 @@ DECLINLINE(void) iemFpuUpdateDP(PIEMCPU pIemCpu, PCPUMCTX pCtx, uint8_t iEffSeg,
 /**
  * Rotates the stack registers in the push direction.
  *
- * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  * @remarks This is a complete waste of time, but fxsave stores the registers in
  *          stack order.
  */
-DECLINLINE(void) iemFpuRotateStackPush(PCPUMCTX pCtx)
+DECLINLINE(void) iemFpuRotateStackPush(PX86FXSTATE pFpuCtx)
 {
-    RTFLOAT80U r80Tmp = pCtx->fpu.aRegs[7].r80;
-    pCtx->fpu.aRegs[7].r80 = pCtx->fpu.aRegs[6].r80;
-    pCtx->fpu.aRegs[6].r80 = pCtx->fpu.aRegs[5].r80;
-    pCtx->fpu.aRegs[5].r80 = pCtx->fpu.aRegs[4].r80;
-    pCtx->fpu.aRegs[4].r80 = pCtx->fpu.aRegs[3].r80;
-    pCtx->fpu.aRegs[3].r80 = pCtx->fpu.aRegs[2].r80;
-    pCtx->fpu.aRegs[2].r80 = pCtx->fpu.aRegs[1].r80;
-    pCtx->fpu.aRegs[1].r80 = pCtx->fpu.aRegs[0].r80;
-    pCtx->fpu.aRegs[0].r80 = r80Tmp;
+    RTFLOAT80U r80Tmp = pFpuCtx->aRegs[7].r80;
+    pFpuCtx->aRegs[7].r80 = pFpuCtx->aRegs[6].r80;
+    pFpuCtx->aRegs[6].r80 = pFpuCtx->aRegs[5].r80;
+    pFpuCtx->aRegs[5].r80 = pFpuCtx->aRegs[4].r80;
+    pFpuCtx->aRegs[4].r80 = pFpuCtx->aRegs[3].r80;
+    pFpuCtx->aRegs[3].r80 = pFpuCtx->aRegs[2].r80;
+    pFpuCtx->aRegs[2].r80 = pFpuCtx->aRegs[1].r80;
+    pFpuCtx->aRegs[1].r80 = pFpuCtx->aRegs[0].r80;
+    pFpuCtx->aRegs[0].r80 = r80Tmp;
 }
 
 
 /**
  * Rotates the stack registers in the pop direction.
  *
- * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  * @remarks This is a complete waste of time, but fxsave stores the registers in
  *          stack order.
  */
-DECLINLINE(void) iemFpuRotateStackPop(PCPUMCTX pCtx)
+DECLINLINE(void) iemFpuRotateStackPop(PX86FXSTATE pFpuCtx)
 {
-    RTFLOAT80U r80Tmp = pCtx->fpu.aRegs[0].r80;
-    pCtx->fpu.aRegs[0].r80 = pCtx->fpu.aRegs[1].r80;
-    pCtx->fpu.aRegs[1].r80 = pCtx->fpu.aRegs[2].r80;
-    pCtx->fpu.aRegs[2].r80 = pCtx->fpu.aRegs[3].r80;
-    pCtx->fpu.aRegs[3].r80 = pCtx->fpu.aRegs[4].r80;
-    pCtx->fpu.aRegs[4].r80 = pCtx->fpu.aRegs[5].r80;
-    pCtx->fpu.aRegs[5].r80 = pCtx->fpu.aRegs[6].r80;
-    pCtx->fpu.aRegs[6].r80 = pCtx->fpu.aRegs[7].r80;
-    pCtx->fpu.aRegs[7].r80 = r80Tmp;
+    RTFLOAT80U r80Tmp = pFpuCtx->aRegs[0].r80;
+    pFpuCtx->aRegs[0].r80 = pFpuCtx->aRegs[1].r80;
+    pFpuCtx->aRegs[1].r80 = pFpuCtx->aRegs[2].r80;
+    pFpuCtx->aRegs[2].r80 = pFpuCtx->aRegs[3].r80;
+    pFpuCtx->aRegs[3].r80 = pFpuCtx->aRegs[4].r80;
+    pFpuCtx->aRegs[4].r80 = pFpuCtx->aRegs[5].r80;
+    pFpuCtx->aRegs[5].r80 = pFpuCtx->aRegs[6].r80;
+    pFpuCtx->aRegs[6].r80 = pFpuCtx->aRegs[7].r80;
+    pFpuCtx->aRegs[7].r80 = r80Tmp;
 }
 
 
@@ -4370,65 +5251,64 @@ DECLINLINE(void) iemFpuRotateStackPop(PCPUMCTX pCtx)
  *
  * @param   pIemCpu             The IEM per CPU data.
  * @param   pResult             The FPU operation result to push.
- * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  */
-static void iemFpuMaybePushResult(PIEMCPU pIemCpu, PIEMFPURESULT pResult, PCPUMCTX pCtx)
+static void iemFpuMaybePushResult(PIEMCPU pIemCpu, PIEMFPURESULT pResult, PX86FXSTATE pFpuCtx)
 {
     /* Update FSW and bail if there are pending exceptions afterwards. */
-    uint16_t fFsw = pCtx->fpu.FSW & ~X86_FSW_C_MASK;
+    uint16_t fFsw = pFpuCtx->FSW & ~X86_FSW_C_MASK;
     fFsw |= pResult->FSW & ~X86_FSW_TOP_MASK;
-    if (   (fFsw          & (X86_FSW_IE | X86_FSW_ZE | X86_FSW_DE))
-        & ~(pCtx->fpu.FCW & (X86_FCW_IM | X86_FCW_ZM | X86_FCW_DM)))
+    if (   (fFsw             & (X86_FSW_IE | X86_FSW_ZE | X86_FSW_DE))
+        & ~(pFpuCtx->FCW & (X86_FCW_IM | X86_FCW_ZM | X86_FCW_DM)))
     {
-        pCtx->fpu.FSW = fFsw;
+        pFpuCtx->FSW = fFsw;
         return;
     }
 
     uint16_t iNewTop = (X86_FSW_TOP_GET(fFsw) + 7) & X86_FSW_TOP_SMASK;
-    if (!(pCtx->fpu.FTW & RT_BIT(iNewTop)))
+    if (!(pFpuCtx->FTW & RT_BIT(iNewTop)))
     {
         /* All is fine, push the actual value. */
-        pCtx->fpu.FTW |= RT_BIT(iNewTop);
-        pCtx->fpu.aRegs[7].r80 = pResult->r80Result;
+        pFpuCtx->FTW |= RT_BIT(iNewTop);
+        pFpuCtx->aRegs[7].r80 = pResult->r80Result;
     }
-    else if (pCtx->fpu.FCW & X86_FCW_IM)
+    else if (pFpuCtx->FCW & X86_FCW_IM)
     {
         /* Masked stack overflow, push QNaN. */
         fFsw |= X86_FSW_IE | X86_FSW_SF | X86_FSW_C1;
-        iemFpuStoreQNan(&pCtx->fpu.aRegs[7].r80);
+        iemFpuStoreQNan(&pFpuCtx->aRegs[7].r80);
     }
     else
     {
         /* Raise stack overflow, don't push anything. */
-        pCtx->fpu.FSW |= pResult->FSW & ~X86_FSW_C_MASK;
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_C1 | X86_FSW_B | X86_FSW_ES;
+        pFpuCtx->FSW |= pResult->FSW & ~X86_FSW_C_MASK;
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_C1 | X86_FSW_B | X86_FSW_ES;
         return;
     }
 
     fFsw &= ~X86_FSW_TOP_MASK;
     fFsw |= iNewTop << X86_FSW_TOP_SHIFT;
-    pCtx->fpu.FSW = fFsw;
+    pFpuCtx->FSW = fFsw;
 
-    iemFpuRotateStackPush(pCtx);
+    iemFpuRotateStackPush(pFpuCtx);
 }
 
 
 /**
  * Stores a result in a FPU register and updates the FSW and FTW.
  *
- * @param   pIemCpu             The IEM per CPU data.
+ * @param   pFpuCtx             The FPU context.
  * @param   pResult             The result to store.
  * @param   iStReg              Which FPU register to store it in.
- * @param   pCtx                The CPU context.
  */
-static void iemFpuStoreResultOnly(PIEMCPU pIemCpu, PIEMFPURESULT pResult, uint8_t iStReg, PCPUMCTX pCtx)
+static void iemFpuStoreResultOnly(PX86FXSTATE pFpuCtx, PIEMFPURESULT pResult, uint8_t iStReg)
 {
     Assert(iStReg < 8);
-    uint16_t  iReg = (X86_FSW_TOP_GET(pCtx->fpu.FSW) + iStReg) & X86_FSW_TOP_SMASK;
-    pCtx->fpu.FSW &= ~X86_FSW_C_MASK;
-    pCtx->fpu.FSW |= pResult->FSW & ~X86_FSW_TOP_MASK;
-    pCtx->fpu.FTW |= RT_BIT(iReg);
-    pCtx->fpu.aRegs[iStReg].r80 = pResult->r80Result;
+    uint16_t iReg = (X86_FSW_TOP_GET(pFpuCtx->FSW) + iStReg) & X86_FSW_TOP_SMASK;
+    pFpuCtx->FSW &= ~X86_FSW_C_MASK;
+    pFpuCtx->FSW |= pResult->FSW & ~X86_FSW_TOP_MASK;
+    pFpuCtx->FTW |= RT_BIT(iReg);
+    pFpuCtx->aRegs[iStReg].r80 = pResult->r80Result;
 }
 
 
@@ -4436,41 +5316,41 @@ static void iemFpuStoreResultOnly(PIEMCPU pIemCpu, PIEMFPURESULT pResult, uint8_
  * Only updates the FPU status word (FSW) with the result of the current
  * instruction.
  *
- * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  * @param   u16FSW              The FSW output of the current instruction.
  */
-static void iemFpuUpdateFSWOnly(PCPUMCTX pCtx, uint16_t u16FSW)
+static void iemFpuUpdateFSWOnly(PX86FXSTATE pFpuCtx, uint16_t u16FSW)
 {
-    pCtx->fpu.FSW &= ~X86_FSW_C_MASK;
-    pCtx->fpu.FSW |= u16FSW & ~X86_FSW_TOP_MASK;
+    pFpuCtx->FSW &= ~X86_FSW_C_MASK;
+    pFpuCtx->FSW |= u16FSW & ~X86_FSW_TOP_MASK;
 }
 
 
 /**
  * Pops one item off the FPU stack if no pending exception prevents it.
  *
- * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  */
-static void iemFpuMaybePopOne(PCPUMCTX pCtx)
+static void iemFpuMaybePopOne(PX86FXSTATE pFpuCtx)
 {
     /* Check pending exceptions. */
-    uint16_t uFSW = pCtx->fpu.FSW;
-    if (   (pCtx->fpu.FSW & (X86_FSW_IE | X86_FSW_ZE | X86_FSW_DE))
-        & ~(pCtx->fpu.FCW & (X86_FCW_IM | X86_FCW_ZM | X86_FCW_DM)))
+    uint16_t uFSW = pFpuCtx->FSW;
+    if (   (pFpuCtx->FSW & (X86_FSW_IE | X86_FSW_ZE | X86_FSW_DE))
+        & ~(pFpuCtx->FCW & (X86_FCW_IM | X86_FCW_ZM | X86_FCW_DM)))
         return;
 
     /* TOP--. */
     uint16_t iOldTop = uFSW & X86_FSW_TOP_MASK;
     uFSW &= ~X86_FSW_TOP_MASK;
     uFSW |= (iOldTop + (UINT16_C(9) << X86_FSW_TOP_SHIFT)) & X86_FSW_TOP_MASK;
-    pCtx->fpu.FSW = uFSW;
+    pFpuCtx->FSW = uFSW;
 
     /* Mark the previous ST0 as empty. */
     iOldTop >>= X86_FSW_TOP_SHIFT;
-    pCtx->fpu.FTW &= ~RT_BIT(iOldTop);
+    pFpuCtx->FTW &= ~RT_BIT(iOldTop);
 
     /* Rotate the registers. */
-    iemFpuRotateStackPop(pCtx);
+    iemFpuRotateStackPop(pFpuCtx);
 }
 
 
@@ -4482,9 +5362,10 @@ static void iemFpuMaybePopOne(PCPUMCTX pCtx)
  */
 static void iemFpuPushResult(PIEMCPU pIemCpu, PIEMFPURESULT pResult)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuMaybePushResult(pIemCpu, pResult, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuMaybePushResult(pIemCpu, pResult, pFpuCtx);
 }
 
 
@@ -4499,10 +5380,11 @@ static void iemFpuPushResult(PIEMCPU pIemCpu, PIEMFPURESULT pResult)
  */
 static void iemFpuPushResultWithMemOp(PIEMCPU pIemCpu, PIEMFPURESULT pResult, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateDP(pIemCpu, pCtx, iEffSeg, GCPtrEff);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuMaybePushResult(pIemCpu, pResult, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateDP(pIemCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuMaybePushResult(pIemCpu, pResult, pFpuCtx);
 }
 
 
@@ -4515,47 +5397,48 @@ static void iemFpuPushResultWithMemOp(PIEMCPU pIemCpu, PIEMFPURESULT pResult, ui
  */
 static void iemFpuPushResultTwo(PIEMCPU pIemCpu, PIEMFPURESULTTWO pResult)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
 
     /* Update FSW and bail if there are pending exceptions afterwards. */
-    uint16_t fFsw = pCtx->fpu.FSW & ~X86_FSW_C_MASK;
+    uint16_t fFsw = pFpuCtx->FSW & ~X86_FSW_C_MASK;
     fFsw |= pResult->FSW & ~X86_FSW_TOP_MASK;
-    if (   (fFsw          & (X86_FSW_IE | X86_FSW_ZE | X86_FSW_DE))
-        & ~(pCtx->fpu.FCW & (X86_FCW_IM | X86_FCW_ZM | X86_FCW_DM)))
+    if (   (fFsw             & (X86_FSW_IE | X86_FSW_ZE | X86_FSW_DE))
+        & ~(pFpuCtx->FCW & (X86_FCW_IM | X86_FCW_ZM | X86_FCW_DM)))
     {
-        pCtx->fpu.FSW = fFsw;
+        pFpuCtx->FSW = fFsw;
         return;
     }
 
     uint16_t iNewTop = (X86_FSW_TOP_GET(fFsw) + 7) & X86_FSW_TOP_SMASK;
-    if (!(pCtx->fpu.FTW & RT_BIT(iNewTop)))
+    if (!(pFpuCtx->FTW & RT_BIT(iNewTop)))
     {
         /* All is fine, push the actual value. */
-        pCtx->fpu.FTW |= RT_BIT(iNewTop);
-        pCtx->fpu.aRegs[0].r80 = pResult->r80Result1;
-        pCtx->fpu.aRegs[7].r80 = pResult->r80Result2;
+        pFpuCtx->FTW |= RT_BIT(iNewTop);
+        pFpuCtx->aRegs[0].r80 = pResult->r80Result1;
+        pFpuCtx->aRegs[7].r80 = pResult->r80Result2;
     }
-    else if (pCtx->fpu.FCW & X86_FCW_IM)
+    else if (pFpuCtx->FCW & X86_FCW_IM)
     {
         /* Masked stack overflow, push QNaN. */
         fFsw |= X86_FSW_IE | X86_FSW_SF | X86_FSW_C1;
-        iemFpuStoreQNan(&pCtx->fpu.aRegs[0].r80);
-        iemFpuStoreQNan(&pCtx->fpu.aRegs[7].r80);
+        iemFpuStoreQNan(&pFpuCtx->aRegs[0].r80);
+        iemFpuStoreQNan(&pFpuCtx->aRegs[7].r80);
     }
     else
     {
         /* Raise stack overflow, don't push anything. */
-        pCtx->fpu.FSW |= pResult->FSW & ~X86_FSW_C_MASK;
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_C1 | X86_FSW_B | X86_FSW_ES;
+        pFpuCtx->FSW |= pResult->FSW & ~X86_FSW_C_MASK;
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_C1 | X86_FSW_B | X86_FSW_ES;
         return;
     }
 
     fFsw &= ~X86_FSW_TOP_MASK;
     fFsw |= iNewTop << X86_FSW_TOP_SHIFT;
-    pCtx->fpu.FSW = fFsw;
+    pFpuCtx->FSW = fFsw;
 
-    iemFpuRotateStackPush(pCtx);
+    iemFpuRotateStackPush(pFpuCtx);
 }
 
 
@@ -4570,9 +5453,10 @@ static void iemFpuPushResultTwo(PIEMCPU pIemCpu, PIEMFPURESULTTWO pResult)
  */
 static void iemFpuStoreResult(PIEMCPU pIemCpu, PIEMFPURESULT pResult, uint8_t iStReg)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStoreResultOnly(pIemCpu, pResult, iStReg, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStoreResultOnly(pFpuCtx, pResult, iStReg);
 }
 
 
@@ -4587,10 +5471,11 @@ static void iemFpuStoreResult(PIEMCPU pIemCpu, PIEMFPURESULT pResult, uint8_t iS
  */
 static void iemFpuStoreResultThenPop(PIEMCPU pIemCpu, PIEMFPURESULT pResult, uint8_t iStReg)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStoreResultOnly(pIemCpu, pResult, iStReg, pCtx);
-    iemFpuMaybePopOne(pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStoreResultOnly(pFpuCtx, pResult, iStReg);
+    iemFpuMaybePopOne(pFpuCtx);
 }
 
 
@@ -4607,10 +5492,11 @@ static void iemFpuStoreResultThenPop(PIEMCPU pIemCpu, PIEMFPURESULT pResult, uin
  */
 static void iemFpuStoreResultWithMemOp(PIEMCPU pIemCpu, PIEMFPURESULT pResult, uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateDP(pIemCpu, pIemCpu->CTX_SUFF(pCtx), iEffSeg, GCPtrEff);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStoreResultOnly(pIemCpu, pResult, iStReg, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateDP(pIemCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStoreResultOnly(pFpuCtx, pResult, iStReg);
 }
 
 
@@ -4628,11 +5514,12 @@ static void iemFpuStoreResultWithMemOp(PIEMCPU pIemCpu, PIEMFPURESULT pResult, u
 static void iemFpuStoreResultWithMemOpThenPop(PIEMCPU pIemCpu, PIEMFPURESULT pResult,
                                               uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateDP(pIemCpu, pCtx, iEffSeg, GCPtrEff);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStoreResultOnly(pIemCpu, pResult, iStReg, pCtx);
-    iemFpuMaybePopOne(pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateDP(pIemCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStoreResultOnly(pFpuCtx, pResult, iStReg);
+    iemFpuMaybePopOne(pFpuCtx);
 }
 
 
@@ -4643,7 +5530,9 @@ static void iemFpuStoreResultWithMemOpThenPop(PIEMCPU pIemCpu, PIEMFPURESULT pRe
  */
 static void iemFpuUpdateOpcodeAndIp(PIEMCPU pIemCpu)
 {
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pIemCpu->CTX_SUFF(pCtx));
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
 }
 
 
@@ -4656,9 +5545,9 @@ static void iemFpuUpdateOpcodeAndIp(PIEMCPU pIemCpu)
 static void iemFpuStackFree(PIEMCPU pIemCpu, uint8_t iStReg)
 {
     Assert(iStReg < 8);
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    uint8_t iReg = (X86_FSW_TOP_GET(pCtx->fpu.FSW) + iStReg) & X86_FSW_TOP_SMASK;
-    pCtx->fpu.FTW &= ~RT_BIT(iReg);
+    PX86FXSTATE pFpuCtx = &pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
+    uint8_t     iReg    = (X86_FSW_TOP_GET(pFpuCtx->FSW) + iStReg) & X86_FSW_TOP_SMASK;
+    pFpuCtx->FTW &= ~RT_BIT(iReg);
 }
 
 
@@ -4669,13 +5558,13 @@ static void iemFpuStackFree(PIEMCPU pIemCpu, uint8_t iStReg)
  */
 static void iemFpuStackIncTop(PIEMCPU pIemCpu)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    uint16_t uFsw = pCtx->fpu.FSW;
-    uint16_t uTop = uFsw & X86_FSW_TOP_MASK;
+    PX86FXSTATE pFpuCtx = &pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
+    uint16_t    uFsw    = pFpuCtx->FSW;
+    uint16_t    uTop    = uFsw & X86_FSW_TOP_MASK;
     uTop  = (uTop + (1 << X86_FSW_TOP_SHIFT)) & X86_FSW_TOP_MASK;
     uFsw &= ~X86_FSW_TOP_MASK;
     uFsw |= uTop;
-    pCtx->fpu.FSW = uFsw;
+    pFpuCtx->FSW = uFsw;
 }
 
 
@@ -4686,13 +5575,13 @@ static void iemFpuStackIncTop(PIEMCPU pIemCpu)
  */
 static void iemFpuStackDecTop(PIEMCPU pIemCpu)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    uint16_t uFsw = pCtx->fpu.FSW;
-    uint16_t uTop = uFsw & X86_FSW_TOP_MASK;
+    PX86FXSTATE pFpuCtx = &pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
+    uint16_t    uFsw    = pFpuCtx->FSW;
+    uint16_t    uTop    = uFsw & X86_FSW_TOP_MASK;
     uTop  = (uTop + (7 << X86_FSW_TOP_SHIFT)) & X86_FSW_TOP_MASK;
     uFsw &= ~X86_FSW_TOP_MASK;
     uFsw |= uTop;
-    pCtx->fpu.FSW = uFsw;
+    pFpuCtx->FSW = uFsw;
 }
 
 
@@ -4704,9 +5593,10 @@ static void iemFpuStackDecTop(PIEMCPU pIemCpu)
  */
 static void iemFpuUpdateFSW(PIEMCPU pIemCpu, uint16_t u16FSW)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuUpdateFSWOnly(pCtx, u16FSW);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuUpdateFSWOnly(pFpuCtx, u16FSW);
 }
 
 
@@ -4718,10 +5608,11 @@ static void iemFpuUpdateFSW(PIEMCPU pIemCpu, uint16_t u16FSW)
  */
 static void iemFpuUpdateFSWThenPop(PIEMCPU pIemCpu, uint16_t u16FSW)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuUpdateFSWOnly(pCtx, u16FSW);
-    iemFpuMaybePopOne(pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuUpdateFSWOnly(pFpuCtx, u16FSW);
+    iemFpuMaybePopOne(pFpuCtx);
 }
 
 
@@ -4735,10 +5626,11 @@ static void iemFpuUpdateFSWThenPop(PIEMCPU pIemCpu, uint16_t u16FSW)
  */
 static void iemFpuUpdateFSWWithMemOp(PIEMCPU pIemCpu, uint16_t u16FSW, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateDP(pIemCpu, pCtx, iEffSeg, GCPtrEff);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuUpdateFSWOnly(pCtx, u16FSW);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateDP(pIemCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuUpdateFSWOnly(pFpuCtx, u16FSW);
 }
 
 
@@ -4750,11 +5642,12 @@ static void iemFpuUpdateFSWWithMemOp(PIEMCPU pIemCpu, uint16_t u16FSW, uint8_t i
  */
 static void iemFpuUpdateFSWThenPopPop(PIEMCPU pIemCpu, uint16_t u16FSW)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuUpdateFSWOnly(pCtx, u16FSW);
-    iemFpuMaybePopOne(pCtx);
-    iemFpuMaybePopOne(pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuUpdateFSWOnly(pFpuCtx, u16FSW);
+    iemFpuMaybePopOne(pFpuCtx);
+    iemFpuMaybePopOne(pFpuCtx);
 }
 
 
@@ -4768,11 +5661,12 @@ static void iemFpuUpdateFSWThenPopPop(PIEMCPU pIemCpu, uint16_t u16FSW)
  */
 static void iemFpuUpdateFSWWithMemOpThenPop(PIEMCPU pIemCpu, uint16_t u16FSW, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateDP(pIemCpu, pCtx, iEffSeg, GCPtrEff);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuUpdateFSWOnly(pCtx, u16FSW);
-    iemFpuMaybePopOne(pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateDP(pIemCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuUpdateFSWOnly(pFpuCtx, u16FSW);
+    iemFpuMaybePopOne(pFpuCtx);
 }
 
 
@@ -4780,28 +5674,28 @@ static void iemFpuUpdateFSWWithMemOpThenPop(PIEMCPU pIemCpu, uint16_t u16FSW, ui
  * Worker routine for raising an FPU stack underflow exception.
  *
  * @param   pIemCpu             The IEM per CPU data.
+ * @param   pFpuCtx             The FPU context.
  * @param   iStReg              The stack register being accessed.
- * @param   pCtx                The CPU context.
  */
-static void iemFpuStackUnderflowOnly(PIEMCPU pIemCpu, uint8_t iStReg, PCPUMCTX pCtx)
+static void iemFpuStackUnderflowOnly(PIEMCPU pIemCpu, PX86FXSTATE pFpuCtx, uint8_t iStReg)
 {
     Assert(iStReg < 8 || iStReg == UINT8_MAX);
-    if (pCtx->fpu.FCW & X86_FCW_IM)
+    if (pFpuCtx->FCW & X86_FCW_IM)
     {
         /* Masked underflow. */
-        pCtx->fpu.FSW &= ~X86_FSW_C_MASK;
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF;
-        uint16_t iReg = (X86_FSW_TOP_GET(pCtx->fpu.FSW) + iStReg) & X86_FSW_TOP_SMASK;
+        pFpuCtx->FSW &= ~X86_FSW_C_MASK;
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF;
+        uint16_t iReg = (X86_FSW_TOP_GET(pFpuCtx->FSW) + iStReg) & X86_FSW_TOP_SMASK;
         if (iStReg != UINT8_MAX)
         {
-            pCtx->fpu.FTW |= RT_BIT(iReg);
-            iemFpuStoreQNan(&pCtx->fpu.aRegs[iStReg].r80);
+            pFpuCtx->FTW |= RT_BIT(iReg);
+            iemFpuStoreQNan(&pFpuCtx->aRegs[iStReg].r80);
         }
     }
     else
     {
-        pCtx->fpu.FSW &= ~X86_FSW_C_MASK;
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
+        pFpuCtx->FSW &= ~X86_FSW_C_MASK;
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
     }
 }
 
@@ -4816,74 +5710,80 @@ static void iemFpuStackUnderflowOnly(PIEMCPU pIemCpu, uint8_t iStReg, PCPUMCTX p
  */
 DECL_NO_INLINE(static, void) iemFpuStackUnderflow(PIEMCPU pIemCpu, uint8_t iStReg)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStackUnderflowOnly(pIemCpu, iStReg, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStackUnderflowOnly(pIemCpu, pFpuCtx, iStReg);
 }
 
 
 DECL_NO_INLINE(static, void)
 iemFpuStackUnderflowWithMemOp(PIEMCPU pIemCpu, uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateDP(pIemCpu, pCtx, iEffSeg, GCPtrEff);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStackUnderflowOnly(pIemCpu, iStReg, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateDP(pIemCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStackUnderflowOnly(pIemCpu, pFpuCtx, iStReg);
 }
 
 
 DECL_NO_INLINE(static, void) iemFpuStackUnderflowThenPop(PIEMCPU pIemCpu, uint8_t iStReg)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStackUnderflowOnly(pIemCpu, iStReg, pCtx);
-    iemFpuMaybePopOne(pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStackUnderflowOnly(pIemCpu, pFpuCtx, iStReg);
+    iemFpuMaybePopOne(pFpuCtx);
 }
 
 
 DECL_NO_INLINE(static, void)
 iemFpuStackUnderflowWithMemOpThenPop(PIEMCPU pIemCpu, uint8_t iStReg, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateDP(pIemCpu, pCtx, iEffSeg, GCPtrEff);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStackUnderflowOnly(pIemCpu, iStReg, pCtx);
-    iemFpuMaybePopOne(pCtx);
+    PCPUMCTX    pCtx      = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateDP(pIemCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStackUnderflowOnly(pIemCpu, pFpuCtx, iStReg);
+    iemFpuMaybePopOne(pFpuCtx);
 }
 
 
 DECL_NO_INLINE(static, void) iemFpuStackUnderflowThenPopPop(PIEMCPU pIemCpu)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStackUnderflowOnly(pIemCpu, UINT8_MAX, pCtx);
-    iemFpuMaybePopOne(pCtx);
-    iemFpuMaybePopOne(pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStackUnderflowOnly(pIemCpu, pFpuCtx, UINT8_MAX);
+    iemFpuMaybePopOne(pFpuCtx);
+    iemFpuMaybePopOne(pFpuCtx);
 }
 
 
 DECL_NO_INLINE(static, void)
 iemFpuStackPushUnderflow(PIEMCPU pIemCpu)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
 
-    if (pCtx->fpu.FCW & X86_FCW_IM)
+    if (pFpuCtx->FCW & X86_FCW_IM)
     {
         /* Masked overflow - Push QNaN. */
-        uint16_t iNewTop = (X86_FSW_TOP_GET(pCtx->fpu.FSW) + 7) & X86_FSW_TOP_SMASK;
-        pCtx->fpu.FSW &= ~(X86_FSW_TOP_MASK | X86_FSW_C_MASK);
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF;
-        pCtx->fpu.FSW |= iNewTop << X86_FSW_TOP_SHIFT;
-        pCtx->fpu.FTW |= RT_BIT(iNewTop);
-        iemFpuStoreQNan(&pCtx->fpu.aRegs[7].r80);
-        iemFpuRotateStackPush(pCtx);
+        uint16_t iNewTop = (X86_FSW_TOP_GET(pFpuCtx->FSW) + 7) & X86_FSW_TOP_SMASK;
+        pFpuCtx->FSW &= ~(X86_FSW_TOP_MASK | X86_FSW_C_MASK);
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF;
+        pFpuCtx->FSW |= iNewTop << X86_FSW_TOP_SHIFT;
+        pFpuCtx->FTW |= RT_BIT(iNewTop);
+        iemFpuStoreQNan(&pFpuCtx->aRegs[7].r80);
+        iemFpuRotateStackPush(pFpuCtx);
     }
     else
     {
         /* Exception pending - don't change TOP or the register stack. */
-        pCtx->fpu.FSW &= ~X86_FSW_C_MASK;
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
+        pFpuCtx->FSW &= ~X86_FSW_C_MASK;
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
     }
 }
 
@@ -4891,26 +5791,27 @@ iemFpuStackPushUnderflow(PIEMCPU pIemCpu)
 DECL_NO_INLINE(static, void)
 iemFpuStackPushUnderflowTwo(PIEMCPU pIemCpu)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
 
-    if (pCtx->fpu.FCW & X86_FCW_IM)
+    if (pFpuCtx->FCW & X86_FCW_IM)
     {
         /* Masked overflow - Push QNaN. */
-        uint16_t iNewTop = (X86_FSW_TOP_GET(pCtx->fpu.FSW) + 7) & X86_FSW_TOP_SMASK;
-        pCtx->fpu.FSW &= ~(X86_FSW_TOP_MASK | X86_FSW_C_MASK);
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF;
-        pCtx->fpu.FSW |= iNewTop << X86_FSW_TOP_SHIFT;
-        pCtx->fpu.FTW |= RT_BIT(iNewTop);
-        iemFpuStoreQNan(&pCtx->fpu.aRegs[0].r80);
-        iemFpuStoreQNan(&pCtx->fpu.aRegs[7].r80);
-        iemFpuRotateStackPush(pCtx);
+        uint16_t iNewTop = (X86_FSW_TOP_GET(pFpuCtx->FSW) + 7) & X86_FSW_TOP_SMASK;
+        pFpuCtx->FSW &= ~(X86_FSW_TOP_MASK | X86_FSW_C_MASK);
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF;
+        pFpuCtx->FSW |= iNewTop << X86_FSW_TOP_SHIFT;
+        pFpuCtx->FTW |= RT_BIT(iNewTop);
+        iemFpuStoreQNan(&pFpuCtx->aRegs[0].r80);
+        iemFpuStoreQNan(&pFpuCtx->aRegs[7].r80);
+        iemFpuRotateStackPush(pFpuCtx);
     }
     else
     {
         /* Exception pending - don't change TOP or the register stack. */
-        pCtx->fpu.FSW &= ~X86_FSW_C_MASK;
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
+        pFpuCtx->FSW &= ~X86_FSW_C_MASK;
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
     }
 }
 
@@ -4918,27 +5819,26 @@ iemFpuStackPushUnderflowTwo(PIEMCPU pIemCpu)
 /**
  * Worker routine for raising an FPU stack overflow exception on a push.
  *
- * @param   pIemCpu             The IEM per CPU data.
- * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  */
-static void iemFpuStackPushOverflowOnly(PIEMCPU pIemCpu, PCPUMCTX pCtx)
+static void iemFpuStackPushOverflowOnly(PX86FXSTATE pFpuCtx)
 {
-    if (pCtx->fpu.FCW & X86_FCW_IM)
+    if (pFpuCtx->FCW & X86_FCW_IM)
     {
         /* Masked overflow. */
-        uint16_t iNewTop = (X86_FSW_TOP_GET(pCtx->fpu.FSW) + 7) & X86_FSW_TOP_SMASK;
-        pCtx->fpu.FSW &= ~(X86_FSW_TOP_MASK | X86_FSW_C_MASK);
-        pCtx->fpu.FSW |= X86_FSW_C1 | X86_FSW_IE | X86_FSW_SF;
-        pCtx->fpu.FSW |= iNewTop << X86_FSW_TOP_SHIFT;
-        pCtx->fpu.FTW |= RT_BIT(iNewTop);
-        iemFpuStoreQNan(&pCtx->fpu.aRegs[7].r80);
-        iemFpuRotateStackPush(pCtx);
+        uint16_t iNewTop = (X86_FSW_TOP_GET(pFpuCtx->FSW) + 7) & X86_FSW_TOP_SMASK;
+        pFpuCtx->FSW &= ~(X86_FSW_TOP_MASK | X86_FSW_C_MASK);
+        pFpuCtx->FSW |= X86_FSW_C1 | X86_FSW_IE | X86_FSW_SF;
+        pFpuCtx->FSW |= iNewTop << X86_FSW_TOP_SHIFT;
+        pFpuCtx->FTW |= RT_BIT(iNewTop);
+        iemFpuStoreQNan(&pFpuCtx->aRegs[7].r80);
+        iemFpuRotateStackPush(pFpuCtx);
     }
     else
     {
         /* Exception pending - don't change TOP or the register stack. */
-        pCtx->fpu.FSW &= ~X86_FSW_C_MASK;
-        pCtx->fpu.FSW |= X86_FSW_C1 | X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
+        pFpuCtx->FSW &= ~X86_FSW_C_MASK;
+        pFpuCtx->FSW |= X86_FSW_C1 | X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
     }
 }
 
@@ -4950,9 +5850,10 @@ static void iemFpuStackPushOverflowOnly(PIEMCPU pIemCpu, PCPUMCTX pCtx)
  */
 DECL_NO_INLINE(static, void) iemFpuStackPushOverflow(PIEMCPU pIemCpu)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStackPushOverflowOnly(pIemCpu, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStackPushOverflowOnly(pFpuCtx);
 }
 
 
@@ -4966,18 +5867,19 @@ DECL_NO_INLINE(static, void) iemFpuStackPushOverflow(PIEMCPU pIemCpu)
 DECL_NO_INLINE(static, void)
 iemFpuStackPushOverflowWithMemOp(PIEMCPU pIemCpu, uint8_t iEffSeg, RTGCPTR GCPtrEff)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    iemFpuUpdateDP(pIemCpu, pCtx, iEffSeg, GCPtrEff);
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
-    iemFpuStackPushOverflowOnly(pIemCpu, pCtx);
+    PCPUMCTX    pCtx    = pIemCpu->CTX_SUFF(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    iemFpuUpdateDP(pIemCpu, pCtx, pFpuCtx, iEffSeg, GCPtrEff);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
+    iemFpuStackPushOverflowOnly(pFpuCtx);
 }
 
 
 static int iemFpuStRegNotEmpty(PIEMCPU pIemCpu, uint8_t iStReg)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    uint16_t iReg = (X86_FSW_TOP_GET(pCtx->fpu.FSW) + iStReg) & X86_FSW_TOP_SMASK;
-    if (pCtx->fpu.FTW & RT_BIT(iReg))
+    PX86FXSTATE pFpuCtx = &pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
+    uint16_t    iReg    = (X86_FSW_TOP_GET(pFpuCtx->FSW) + iStReg) & X86_FSW_TOP_SMASK;
+    if (pFpuCtx->FTW & RT_BIT(iReg))
         return VINF_SUCCESS;
     return VERR_NOT_FOUND;
 }
@@ -4985,11 +5887,11 @@ static int iemFpuStRegNotEmpty(PIEMCPU pIemCpu, uint8_t iStReg)
 
 static int iemFpuStRegNotEmptyRef(PIEMCPU pIemCpu, uint8_t iStReg, PCRTFLOAT80U *ppRef)
 {
-    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
-    uint16_t iReg = (X86_FSW_TOP_GET(pCtx->fpu.FSW) + iStReg) & X86_FSW_TOP_SMASK;
-    if (pCtx->fpu.FTW & RT_BIT(iReg))
+    PX86FXSTATE pFpuCtx = &pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
+    uint16_t    iReg    = (X86_FSW_TOP_GET(pFpuCtx->FSW) + iStReg) & X86_FSW_TOP_SMASK;
+    if (pFpuCtx->FTW & RT_BIT(iReg))
     {
-        *ppRef = &pCtx->fpu.aRegs[iStReg].r80;
+        *ppRef = &pFpuCtx->aRegs[iStReg].r80;
         return VINF_SUCCESS;
     }
     return VERR_NOT_FOUND;
@@ -4999,14 +5901,14 @@ static int iemFpuStRegNotEmptyRef(PIEMCPU pIemCpu, uint8_t iStReg, PCRTFLOAT80U
 static int iemFpu2StRegsNotEmptyRef(PIEMCPU pIemCpu, uint8_t iStReg0, PCRTFLOAT80U *ppRef0,
                                     uint8_t iStReg1, PCRTFLOAT80U *ppRef1)
 {
-    PCPUMCTX pCtx  = pIemCpu->CTX_SUFF(pCtx);
-    uint16_t iTop  = X86_FSW_TOP_GET(pCtx->fpu.FSW);
-    uint16_t iReg0 = (iTop + iStReg0) & X86_FSW_TOP_SMASK;
-    uint16_t iReg1 = (iTop + iStReg1) & X86_FSW_TOP_SMASK;
-    if ((pCtx->fpu.FTW & (RT_BIT(iReg0) | RT_BIT(iReg1))) == (RT_BIT(iReg0) | RT_BIT(iReg1)))
+    PX86FXSTATE pFpuCtx = &pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
+    uint16_t    iTop    = X86_FSW_TOP_GET(pFpuCtx->FSW);
+    uint16_t    iReg0   = (iTop + iStReg0) & X86_FSW_TOP_SMASK;
+    uint16_t    iReg1   = (iTop + iStReg1) & X86_FSW_TOP_SMASK;
+    if ((pFpuCtx->FTW & (RT_BIT(iReg0) | RT_BIT(iReg1))) == (RT_BIT(iReg0) | RT_BIT(iReg1)))
     {
-        *ppRef0 = &pCtx->fpu.aRegs[iStReg0].r80;
-        *ppRef1 = &pCtx->fpu.aRegs[iStReg1].r80;
+        *ppRef0 = &pFpuCtx->aRegs[iStReg0].r80;
+        *ppRef1 = &pFpuCtx->aRegs[iStReg1].r80;
         return VINF_SUCCESS;
     }
     return VERR_NOT_FOUND;
@@ -5015,13 +5917,13 @@ static int iemFpu2StRegsNotEmptyRef(PIEMCPU pIemCpu, uint8_t iStReg0, PCRTFLOAT8
 
 static int iemFpu2StRegsNotEmptyRefFirst(PIEMCPU pIemCpu, uint8_t iStReg0, PCRTFLOAT80U *ppRef0, uint8_t iStReg1)
 {
-    PCPUMCTX pCtx  = pIemCpu->CTX_SUFF(pCtx);
-    uint16_t iTop  = X86_FSW_TOP_GET(pCtx->fpu.FSW);
-    uint16_t iReg0 = (iTop + iStReg0) & X86_FSW_TOP_SMASK;
-    uint16_t iReg1 = (iTop + iStReg1) & X86_FSW_TOP_SMASK;
-    if ((pCtx->fpu.FTW & (RT_BIT(iReg0) | RT_BIT(iReg1))) == (RT_BIT(iReg0) | RT_BIT(iReg1)))
+    PX86FXSTATE pFpuCtx = &pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87;
+    uint16_t    iTop    = X86_FSW_TOP_GET(pFpuCtx->FSW);
+    uint16_t    iReg0   = (iTop + iStReg0) & X86_FSW_TOP_SMASK;
+    uint16_t    iReg1   = (iTop + iStReg1) & X86_FSW_TOP_SMASK;
+    if ((pFpuCtx->FTW & (RT_BIT(iReg0) | RT_BIT(iReg1))) == (RT_BIT(iReg0) | RT_BIT(iReg1)))
     {
-        *ppRef0 = &pCtx->fpu.aRegs[iStReg0].r80;
+        *ppRef0 = &pFpuCtx->aRegs[iStReg0].r80;
         return VINF_SUCCESS;
     }
     return VERR_NOT_FOUND;
@@ -5031,16 +5933,16 @@ static int iemFpu2StRegsNotEmptyRefFirst(PIEMCPU pIemCpu, uint8_t iStReg0, PCRTF
 /**
  * Updates the FPU exception status after FCW is changed.
  *
- * @param   pCtx                The CPU context.
+ * @param   pFpuCtx             The FPU context.
  */
-static void iemFpuRecalcExceptionStatus(PCPUMCTX pCtx)
+static void iemFpuRecalcExceptionStatus(PX86FXSTATE pFpuCtx)
 {
-    uint16_t u16Fsw = pCtx->fpu.FSW;
-    if ((u16Fsw & X86_FSW_XCPT_MASK) & ~(pCtx->fpu.FCW & X86_FCW_XCPT_MASK))
+    uint16_t u16Fsw = pFpuCtx->FSW;
+    if ((u16Fsw & X86_FSW_XCPT_MASK) & ~(pFpuCtx->FCW & X86_FCW_XCPT_MASK))
         u16Fsw |= X86_FSW_ES | X86_FSW_B;
     else
         u16Fsw &= ~(X86_FSW_ES | X86_FSW_B);
-    pCtx->fpu.FSW = u16Fsw;
+    pFpuCtx->FSW = u16Fsw;
 }
 
 
@@ -5048,13 +5950,13 @@ static void iemFpuRecalcExceptionStatus(PCPUMCTX pCtx)
  * Calculates the full FTW (FPU tag word) for use in FNSTENV and FNSAVE.
  *
  * @returns The full FTW.
- * @param   pCtx                The CPU state.
+ * @param   pFpuCtx             The FPU context.
  */
-static uint16_t iemFpuCalcFullFtw(PCCPUMCTX pCtx)
+static uint16_t iemFpuCalcFullFtw(PCX86FXSTATE pFpuCtx)
 {
-    uint8_t const   u8Ftw  = (uint8_t)pCtx->fpu.FTW;
+    uint8_t const   u8Ftw  = (uint8_t)pFpuCtx->FTW;
     uint16_t        u16Ftw = 0;
-    unsigned const  iTop   = X86_FSW_TOP_GET(pCtx->fpu.FSW);
+    unsigned const  iTop   = X86_FSW_TOP_GET(pFpuCtx->FSW);
     for (unsigned iSt = 0; iSt < 8; iSt++)
     {
         unsigned const iReg = (iSt + iTop) & 7;
@@ -5063,7 +5965,7 @@ static uint16_t iemFpuCalcFullFtw(PCCPUMCTX pCtx)
         else
         {
             uint16_t uTag;
-            PCRTFLOAT80U const pr80Reg = &pCtx->fpu.aRegs[iSt].r80;
+            PCRTFLOAT80U const pr80Reg = &pFpuCtx->aRegs[iSt].r80;
             if (pr80Reg->s.uExponent == 0x7fff)
                 uTag = 2; /* Exponent is all 1's => Special. */
             else if (pr80Reg->s.uExponent == 0x0000)
@@ -5527,12 +6429,14 @@ static VBOXSTRICTRC iemMemBounceBufferCommitAndUnmap(PIEMCPU pIemCpu, unsigned i
             rc = PGMPhysWrite(IEMCPU_TO_VM(pIemCpu),
                               pIemCpu->aMemBbMappings[iMemMap].GCPhysFirst,
                               pbBuf,
-                              cbFirst);
+                              cbFirst,
+                              PGMACCESSORIGIN_IEM);
             if (cbSecond && rc == VINF_SUCCESS)
                 rc = PGMPhysWrite(IEMCPU_TO_VM(pIemCpu),
                                   pIemCpu->aMemBbMappings[iMemMap].GCPhysSecond,
                                   pbBuf + cbFirst,
-                                  cbSecond);
+                                  cbSecond,
+                                  PGMACCESSORIGIN_IEM);
         }
         else
         {
@@ -5672,14 +6576,14 @@ static VBOXSTRICTRC iemMemBounceBufferMapCrossPage(PIEMCPU pIemCpu, int iMemMap,
         int rc;
         if (!pIemCpu->fBypassHandlers)
         {
-            rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysFirst, pbBuf, cbFirstPage);
+            rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysFirst, pbBuf, cbFirstPage, PGMACCESSORIGIN_IEM);
             if (rc != VINF_SUCCESS)
             {
                 /** @todo status code handling */
                 Log(("iemMemBounceBufferMapPhys: PGMPhysRead GCPhysFirst=%RGp rc=%Rrc (!!)\n", GCPhysFirst, rc));
                 return rc;
             }
-            rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysSecond, pbBuf + cbFirstPage, cbSecondPage);
+            rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysSecond, pbBuf + cbFirstPage, cbSecondPage, PGMACCESSORIGIN_IEM);
             if (rc != VINF_SUCCESS)
             {
                 /** @todo status code handling */
@@ -5792,7 +6696,7 @@ static VBOXSTRICTRC iemMemBounceBufferMapPhys(PIEMCPU pIemCpu, unsigned iMemMap,
         {
             int rc;
             if (!pIemCpu->fBypassHandlers)
-                rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysFirst, pbBuf, cbMem);
+                rc = PGMPhysRead(IEMCPU_TO_VM(pIemCpu), GCPhysFirst, pbBuf, cbMem, PGMACCESSORIGIN_IEM);
             else
                 rc = PGMPhysSimpleReadGCPhys(IEMCPU_TO_VM(pIemCpu), pbBuf, GCPhysFirst, cbMem);
             if (rc != VINF_SUCCESS)
@@ -5886,7 +6790,7 @@ static VBOXSTRICTRC iemMemMap(PIEMCPU pIemCpu, void **ppvMem, size_t cbMem, uint
     /*
      * Check the input and figure out which mapping entry to use.
      */
-    Assert(cbMem <= 64 || cbMem == 512 || cbMem == 108 || cbMem == 94); /* 512 is the max! */
+    Assert(cbMem <= 64 || cbMem == 512 || cbMem == 108 || cbMem == 104 || cbMem == 94); /* 512 is the max! */
     Assert(~(fAccess & ~(IEM_ACCESS_TYPE_MASK | IEM_ACCESS_WHAT_MASK)));
 
     unsigned iMemMap = pIemCpu->iNextMapping;
@@ -6197,7 +7101,7 @@ static VBOXSTRICTRC iemMemFetchDataU128(PIEMCPU pIemCpu, uint128_t *pu128Dst, ui
  * Fetches a data dqword (double qword) at an aligned address, generally SSE
  * related.
  *
- * Raises GP(0) if not aligned.
+ * Raises \#GP(0) if not aligned.
  *
  * @returns Strict VBox status code.
  * @param   pIemCpu             The IEM per CPU data.
@@ -6210,7 +7114,8 @@ static VBOXSTRICTRC iemMemFetchDataU128AlignedSse(PIEMCPU pIemCpu, uint128_t *pu
 {
     /* The lazy approach for now... */
     /** @todo testcase: Ordering of \#SS(0) vs \#GP() vs \#PF on SSE stuff. */
-    if ((GCPtrMem & 15) && !(pIemCpu->CTX_SUFF(pCtx)->fpu.MXCSR & X86_MSXCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
+    if (   (GCPtrMem & 15)
+        && !(pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
         return iemRaiseGeneralProtectionFault0(pIemCpu);
 
     uint128_t const *pu128Src;
@@ -6410,7 +7315,8 @@ static VBOXSTRICTRC iemMemStoreDataU128(PIEMCPU pIemCpu, uint8_t iSegReg, RTGCPT
 static VBOXSTRICTRC iemMemStoreDataU128AlignedSse(PIEMCPU pIemCpu, uint8_t iSegReg, RTGCPTR GCPtrMem, uint128_t u128Value)
 {
     /* The lazy approach for now... */
-    if ((GCPtrMem & 15) && !(pIemCpu->CTX_SUFF(pCtx)->fpu.MXCSR & X86_MSXCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
+    if (   (GCPtrMem & 15)
+        && !(pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.MXCSR & X86_MXSCR_MM)) /** @todo should probably check this *after* applying seg.u64Base... Check real HW. */
         return iemRaiseGeneralProtectionFault0(pIemCpu);
 
     uint128_t *pu128Dst;
@@ -7138,16 +8044,19 @@ static VBOXSTRICTRC iemMemFetchSysU64(PIEMCPU pIemCpu, uint64_t *pu64Dst, uint8_
 
 
 /**
- * Fetches a descriptor table entry.
+ * Fetches a descriptor table entry with caller specified error code.
  *
  * @returns Strict VBox status code.
  * @param   pIemCpu             The IEM per CPU.
  * @param   pDesc               Where to return the descriptor table entry.
  * @param   uSel                The selector which table entry to fetch.
  * @param   uXcpt               The exception to raise on table lookup error.
+ * @param   uErrorCode          The error code associated with the exception.
  */
-static VBOXSTRICTRC iemMemFetchSelDesc(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint16_t uSel, uint8_t uXcpt)
+static VBOXSTRICTRC iemMemFetchSelDescWithErr(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint16_t uSel, uint8_t uXcpt,
+                                              uint16_t uErrorCode)
 {
+    AssertPtr(pDesc);
     PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
 
     /** @todo did the 286 require all 8 bytes to be accessible? */
@@ -7163,7 +8072,7 @@ static VBOXSTRICTRC iemMemFetchSelDesc(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint1
             Log(("iemMemFetchSelDesc: LDT selector %#x is out of bounds (%3x) or ldtr is NP (%#x)\n",
                  uSel, pCtx->ldtr.u32Limit, pCtx->ldtr.Sel));
             return iemRaiseXcptOrInt(pIemCpu, 0, uXcpt, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR,
-                                     uSel & ~X86_SEL_RPL, 0);
+                                     uErrorCode, 0);
         }
 
         Assert(pCtx->ldtr.Attr.n.u1Present);
@@ -7175,7 +8084,7 @@ static VBOXSTRICTRC iemMemFetchSelDesc(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint1
         {
             Log(("iemMemFetchSelDesc: GDT selector %#x is out of bounds (%3x)\n", uSel, pCtx->gdtr.cbGdt));
             return iemRaiseXcptOrInt(pIemCpu, 0, uXcpt, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR,
-                                     uSel & ~X86_SEL_RPL, 0);
+                                     uErrorCode, 0);
         }
         GCPtrBase = pCtx->gdtr.pGdt;
     }
@@ -7196,8 +8105,7 @@ static VBOXSTRICTRC iemMemFetchSelDesc(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint1
         {
             Log(("iemMemFetchSelDesc: system selector %#x is out of bounds\n", uSel));
             /** @todo is this the right exception? */
-            return iemRaiseXcptOrInt(pIemCpu, 0, uXcpt, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR,
-                                     uSel & ~X86_SEL_RPL, 0);
+            return iemRaiseXcptOrInt(pIemCpu, 0, uXcpt, IEM_XCPT_FLAGS_T_CPU_XCPT | IEM_XCPT_FLAGS_ERR, uErrorCode, 0);
         }
     }
     return rcStrict;
@@ -7205,6 +8113,21 @@ static VBOXSTRICTRC iemMemFetchSelDesc(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint1
 
 
 /**
+ * Fetches a descriptor table entry.
+ *
+ * @returns Strict VBox status code.
+ * @param   pIemCpu             The IEM per CPU.
+ * @param   pDesc               Where to return the descriptor table entry.
+ * @param   uSel                The selector which table entry to fetch.
+ * @param   uXcpt               The exception to raise on table lookup error.
+ */
+static VBOXSTRICTRC iemMemFetchSelDesc(PIEMCPU pIemCpu, PIEMSELDESC pDesc, uint16_t uSel, uint8_t uXcpt)
+{
+    return iemMemFetchSelDescWithErr(pIemCpu, pDesc, uSel, uXcpt, uSel & X86_SEL_MASK_OFF_RPL);
+}
+
+
+/**
  * Fakes a long mode stack selector for SS = 0.
  *
  * @param   pDescSs             Where to return the fake stack descriptor.
@@ -7325,14 +8248,14 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
     } while (0)
 #define IEM_MC_MAYBE_RAISE_FPU_XCPT() \
     do { \
-        if ((pIemCpu)->CTX_SUFF(pCtx)->fpu.FSW & X86_FSW_ES) \
+        if ((pIemCpu)->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FSW & X86_FSW_ES) \
             return iemRaiseMathFault(pIemCpu); \
     } while (0)
 #define IEM_MC_MAYBE_RAISE_SSE2_RELATED_XCPT() \
     do { \
         if (   (pIemCpu->CTX_SUFF(pCtx)->cr0 & X86_CR0_EM) \
-            || !(pIemCpu->CTX_SUFF(pCtx)->cr4 & X86_CR4_OSFSXR) \
-            || !IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE2) ) \
+            || !(pIemCpu->CTX_SUFF(pCtx)->cr4 & X86_CR4_OSFXSR) \
+            || !IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fSse2) \
             return iemRaiseUndefinedOpcode(pIemCpu); \
         if (pIemCpu->CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \
             return iemRaiseDeviceNotAvailable(pIemCpu); \
@@ -7340,7 +8263,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT() \
     do { \
         if (   ((pIemCpu)->CTX_SUFF(pCtx)->cr0 & X86_CR0_EM) \
-            || !IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_MMX) ) \
+            || !IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fMmx) \
             return iemRaiseUndefinedOpcode(pIemCpu); \
         if (pIemCpu->CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \
             return iemRaiseDeviceNotAvailable(pIemCpu); \
@@ -7348,8 +8271,8 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT_CHECK_SSE_OR_MMXEXT() \
     do { \
         if (   ((pIemCpu)->CTX_SUFF(pCtx)->cr0 & X86_CR0_EM) \
-            || (   !IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE) \
-                && !IEM_IS_AMD_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_AMD_FEATURE_EDX_AXMMX) ) ) \
+            || (   !IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fSse \
+                && !IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fAmdMmxExts) ) \
             return iemRaiseUndefinedOpcode(pIemCpu); \
         if (pIemCpu->CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \
             return iemRaiseDeviceNotAvailable(pIemCpu); \
@@ -7408,8 +8331,8 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 /** @note Not for IOPL or IF testing or modification. */
 #define IEM_MC_FETCH_EFLAGS(a_EFlags)                   (a_EFlags) = (pIemCpu)->CTX_SUFF(pCtx)->eflags.u
 #define IEM_MC_FETCH_EFLAGS_U8(a_EFlags)                (a_EFlags) = (uint8_t)(pIemCpu)->CTX_SUFF(pCtx)->eflags.u
-#define IEM_MC_FETCH_FSW(a_u16Fsw)                      (a_u16Fsw) = pIemCpu->CTX_SUFF(pCtx)->fpu.FSW
-#define IEM_MC_FETCH_FCW(a_u16Fcw)                      (a_u16Fcw) = pIemCpu->CTX_SUFF(pCtx)->fpu.FCW
+#define IEM_MC_FETCH_FSW(a_u16Fsw)                      (a_u16Fsw) = pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FSW
+#define IEM_MC_FETCH_FCW(a_u16Fcw)                      (a_u16Fcw) = pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FCW
 
 #define IEM_MC_STORE_GREG_U8(a_iGReg, a_u8Value)        *iemGRegRefU8(pIemCpu, (a_iGReg)) = (a_u8Value)
 #define IEM_MC_STORE_GREG_U16(a_iGReg, a_u16Value)      *(uint16_t *)iemGRegRef(pIemCpu, (a_iGReg)) = (a_u16Value)
@@ -7422,7 +8345,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_CLEAR_HIGH_GREG_U64(a_iGReg)             *(uint64_t *)iemGRegRef(pIemCpu, (a_iGReg)) &= UINT32_MAX
 #define IEM_MC_CLEAR_HIGH_GREG_U64_BY_REF(a_pu32Dst)    do { (a_pu32Dst)[1] = 0; } while (0)
 #define IEM_MC_STORE_FPUREG_R80_SRC_REF(a_iSt, a_pr80Src) \
-    do { pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[a_iSt].r80 = *(a_pr80Src); } while (0)
+    do { pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[a_iSt].r80 = *(a_pr80Src); } while (0)
 
 #define IEM_MC_REF_GREG_U8(a_pu8Dst, a_iGReg)           (a_pu8Dst) = iemGRegRefU8(pIemCpu, (a_iGReg))
 #define IEM_MC_REF_GREG_U16(a_pu16Dst, a_iGReg)         (a_pu16Dst) = (uint16_t *)iemGRegRef(pIemCpu, (a_iGReg))
@@ -7513,46 +8436,46 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 /** @note Not for IOPL or IF modification. */
 #define IEM_MC_FLIP_EFL_BIT(a_fBit)                     do { (pIemCpu)->CTX_SUFF(pCtx)->eflags.u ^= (a_fBit); } while (0)
 
-#define IEM_MC_CLEAR_FSW_EX()   do { (pIemCpu)->CTX_SUFF(pCtx)->fpu.FSW &= X86_FSW_C_MASK | X86_FSW_TOP_MASK; } while (0)
+#define IEM_MC_CLEAR_FSW_EX()   do { (pIemCpu)->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FSW &= X86_FSW_C_MASK | X86_FSW_TOP_MASK; } while (0)
 
 
 #define IEM_MC_FETCH_MREG_U64(a_u64Value, a_iMReg) \
-    do { (a_u64Value) = pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].mmx; } while (0)
+    do { (a_u64Value) = pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx; } while (0)
 #define IEM_MC_FETCH_MREG_U32(a_u32Value, a_iMReg) \
-    do { (a_u32Value) = pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].au32[0]; } while (0)
+    do { (a_u32Value) = pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].au32[0]; } while (0)
 #define IEM_MC_STORE_MREG_U64(a_iMReg, a_u64Value) \
-    do { pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].mmx = (a_u64Value); } while (0)
+    do { pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx = (a_u64Value); } while (0)
 #define IEM_MC_STORE_MREG_U32_ZX_U64(a_iMReg, a_u32Value) \
-    do { pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].mmx = (uint32_t)(a_u32Value); } while (0)
+    do { pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx = (uint32_t)(a_u32Value); } while (0)
 #define IEM_MC_REF_MREG_U64(a_pu64Dst, a_iMReg)         \
-        (a_pu64Dst) = (&pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].mmx)
+        (a_pu64Dst) = (&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
 #define IEM_MC_REF_MREG_U64_CONST(a_pu64Dst, a_iMReg) \
-        (a_pu64Dst) = ((uint64_t const *)&pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].mmx)
+        (a_pu64Dst) = ((uint64_t const *)&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
 #define IEM_MC_REF_MREG_U32_CONST(a_pu32Dst, a_iMReg) \
-        (a_pu32Dst) = ((uint32_t const *)&pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].mmx)
+        (a_pu32Dst) = ((uint32_t const *)&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aRegs[(a_iMReg)].mmx)
 
 #define IEM_MC_FETCH_XREG_U128(a_u128Value, a_iXReg) \
-    do { (a_u128Value) = pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].xmm; } while (0)
+    do { (a_u128Value) = pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm; } while (0)
 #define IEM_MC_FETCH_XREG_U64(a_u64Value, a_iXReg) \
-    do { (a_u64Value) = pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[0]; } while (0)
+    do { (a_u64Value) = pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0]; } while (0)
 #define IEM_MC_FETCH_XREG_U32(a_u32Value, a_iXReg) \
-    do { (a_u32Value) = pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au32[0]; } while (0)
+    do { (a_u32Value) = pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au32[0]; } while (0)
 #define IEM_MC_STORE_XREG_U128(a_iXReg, a_u128Value) \
-    do { pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].xmm = (a_u128Value); } while (0)
+    do { pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm = (a_u128Value); } while (0)
 #define IEM_MC_STORE_XREG_U64_ZX_U128(a_iXReg, a_u64Value) \
-    do { pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[0] = (a_u64Value); \
-         pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[1] = 0; \
+    do { pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0] = (a_u64Value); \
+         pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[1] = 0; \
     } while (0)
 #define IEM_MC_STORE_XREG_U32_ZX_U128(a_iXReg, a_u32Value) \
-    do { pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[0] = (uint32_t)(a_u32Value); \
-         pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[1] = 0; \
+    do { pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0] = (uint32_t)(a_u32Value); \
+         pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[1] = 0; \
     } while (0)
 #define IEM_MC_REF_XREG_U128(a_pu128Dst, a_iXReg)       \
-    (a_pu128Dst) = (&pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].xmm)
+    (a_pu128Dst) = (&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm)
 #define IEM_MC_REF_XREG_U128_CONST(a_pu128Dst, a_iXReg) \
-    (a_pu128Dst) = ((uint128_t const *)&pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].xmm)
+    (a_pu128Dst) = ((uint128_t const *)&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].xmm)
 #define IEM_MC_REF_XREG_U64_CONST(a_pu64Dst, a_iXReg) \
-    (a_pu64Dst) = ((uint64_t const *)&pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[0])
+    (a_pu64Dst) = ((uint64_t const *)&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.aXMM[(a_iXReg)].au64[0])
 
 #define IEM_MC_FETCH_MEM_U8(a_u8Dst, a_iSeg, a_GCPtrMem) \
     IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pIemCpu, &(a_u8Dst), (a_iSeg), (a_GCPtrMem)))
@@ -7584,6 +8507,8 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
     IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64(pIemCpu, &(a_u64Dst), (a_iSeg), (a_GCPtrMem) + (a_offDisp)))
 #define IEM_MC_FETCH_MEM_U64_ALIGN_U128(a_u128Dst, a_iSeg, a_GCPtrMem) \
     IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64AlignedU128(pIemCpu, &(a_u128Dst), (a_iSeg), (a_GCPtrMem)))
+#define IEM_MC_FETCH_MEM_I64(a_i64Dst, a_iSeg, a_GCPtrMem) \
+    IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64(pIemCpu, (uint64_t *)&(a_i64Dst), (a_iSeg), (a_GCPtrMem)))
 
 #define IEM_MC_FETCH_MEM_R32(a_r32Dst, a_iSeg, a_GCPtrMem) \
     IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pIemCpu, &(a_r32Dst).u32, (a_iSeg), (a_GCPtrMem)))
@@ -7758,7 +8683,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
     do { \
         if (   !(a_u16FSW & X86_FSW_ES) \
             || !(  (a_u16FSW & (X86_FSW_UE | X86_FSW_OE | X86_FSW_IE)) \
-                 & ~(pIemCpu->CTX_SUFF(pCtx)->fpu.FCW & X86_FCW_MASK_ALL) ) ) \
+                 & ~(pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FCW & X86_FCW_MASK_ALL) ) ) \
             IEM_MC_RETURN_ON_FAILURE(iemMemCommitAndUnmap(pIemCpu, (a_pvMem), (a_fAccess))); \
     } while (0)
 
@@ -7894,7 +8819,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_CALL_FPU_AIMPL_1(a_pfnAImpl, a0) \
     do { \
         iemFpuPrepareUsage(pIemCpu); \
-        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->fpu, (a0)); \
+        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0)); \
     } while (0)
 
 /**
@@ -7907,7 +8832,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_CALL_FPU_AIMPL_2(a_pfnAImpl, a0, a1) \
     do { \
         iemFpuPrepareUsage(pIemCpu); \
-        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->fpu, (a0), (a1)); \
+        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
     } while (0)
 
 /**
@@ -7921,7 +8846,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_CALL_FPU_AIMPL_3(a_pfnAImpl, a0, a1, a2) \
     do { \
         iemFpuPrepareUsage(pIemCpu); \
-        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->fpu, (a0), (a1), (a2)); \
+        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
     } while (0)
 
 #define IEM_MC_SET_FPU_RESULT(a_FpuData, a_FSW, a_pr80Value) \
@@ -8038,7 +8963,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_CALL_MMX_AIMPL_2(a_pfnAImpl, a0, a1) \
     do { \
         iemFpuPrepareUsage(pIemCpu); \
-        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->fpu, (a0), (a1)); \
+        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
     } while (0)
 
 /**
@@ -8052,7 +8977,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_CALL_MMX_AIMPL_3(a_pfnAImpl, a0, a1, a2) \
     do { \
         iemFpuPrepareUsage(pIemCpu); \
-        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->fpu, (a0), (a1), (a2)); \
+        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
     } while (0)
 
 
@@ -8066,7 +8991,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_CALL_SSE_AIMPL_2(a_pfnAImpl, a0, a1) \
     do { \
         iemFpuPrepareUsageSse(pIemCpu); \
-        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->fpu, (a0), (a1)); \
+        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1)); \
     } while (0)
 
 /**
@@ -8080,7 +9005,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_CALL_SSE_AIMPL_3(a_pfnAImpl, a0, a1, a2) \
     do { \
         iemFpuPrepareUsageSse(pIemCpu); \
-        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->fpu, (a0), (a1), (a2)); \
+        a_pfnAImpl(&pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87, (a0), (a1), (a2)); \
     } while (0)
 
 
@@ -8150,7 +9075,7 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEM_MC_IF_TWO_FPUREGS_NOT_EMPTY_REF_R80_FIRST(a_pr80Dst0, a_iSt0, a_iSt1) \
     if (iemFpu2StRegsNotEmptyRefFirst(pIemCpu, (a_iSt0), &(a_pr80Dst0), (a_iSt1)) == VINF_SUCCESS) {
 #define IEM_MC_IF_FCW_IM() \
-    if (pIemCpu->CTX_SUFF(pCtx)->fpu.FCW & X86_FCW_IM) {
+    if (pIemCpu->CTX_SUFF(pCtx)->CTX_SUFF(pXState)->x87.FCW & X86_FCW_IM) {
 
 #define IEM_MC_ELSE()                                   } else {
 #define IEM_MC_ENDIF()                                  } do {} while (0)
@@ -8264,13 +9189,17 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX() \
     do \
     { \
-        if (pIemCpu->fPrefixes & IEM_OP_PRF_LOCK) \
+        if (RT_LIKELY(!(pIemCpu->fPrefixes & IEM_OP_PRF_LOCK))) \
+        { /* likely */ } \
+        else \
             return IEMOP_RAISE_INVALID_LOCK_PREFIX(); \
     } while (0)
 #define IEMOP_HLP_DECODED_NL_1(a_uDisOpNo, a_fIemOpFlags, a_uDisParam0, a_fDisOpType) \
     do \
     { \
-        if (pIemCpu->fPrefixes & IEM_OP_PRF_LOCK) \
+        if (RT_LIKELY(!(pIemCpu->fPrefixes & IEM_OP_PRF_LOCK))) \
+        { /* likely */ } \
+        else \
         { \
             NOREF(a_uDisOpNo); NOREF(a_fIemOpFlags); NOREF(a_uDisParam0); NOREF(a_fDisOpType); \
             return IEMOP_RAISE_INVALID_LOCK_PREFIX(); \
@@ -8279,12 +9208,26 @@ static VBOXSTRICTRC iemMemMarkSelDescAccessed(PIEMCPU pIemCpu, uint16_t uSel)
 #define IEMOP_HLP_DECODED_NL_2(a_uDisOpNo, a_fIemOpFlags, a_uDisParam0, a_uDisParam1, a_fDisOpType) \
     do \
     { \
-        if (pIemCpu->fPrefixes & IEM_OP_PRF_LOCK) \
+        if (RT_LIKELY(!(pIemCpu->fPrefixes & IEM_OP_PRF_LOCK))) \
+        { /* likely */ } \
+        else \
         { \
             NOREF(a_uDisOpNo); NOREF(a_fIemOpFlags); NOREF(a_uDisParam0); NOREF(a_uDisParam1); NOREF(a_fDisOpType); \
             return IEMOP_RAISE_INVALID_LOCK_PREFIX(); \
         } \
     } while (0)
+/**
+ * Done decoding, raise \#UD exception if any lock, repz or repnz prefixes
+ * are present.
+ */
+#define IEMOP_HLP_DONE_DECODING_NO_LOCK_REPZ_OR_REPNZ_PREFIXES() \
+    do \
+    { \
+        if (RT_LIKELY(!(pIemCpu->fPrefixes & (IEM_OP_PRF_LOCK | IEM_OP_PRF_REPNZ | IEM_OP_PRF_REPZ)))) \
+        { /* likely */ } \
+        else \
+            return IEMOP_RAISE_INVALID_OPCODE(); \
+    } while (0)
 
 
 /**
@@ -8736,7 +9679,7 @@ static void iemExecVerificationModeSetup(PIEMCPU pIemCpu)
         RTGCUINT    uErrCode;
         RTGCPTR     uCr2;
         int rc2 = TRPMQueryTrapAll(pVCpu, &u8TrapNo, &enmType, &uErrCode, &uCr2, NULL /* pu8InstLen */); AssertRC(rc2);
-        IEMInjectTrap(pVCpu, u8TrapNo, enmType, (uint16_t)uErrCode, uCr2);
+        IEMInjectTrap(pVCpu, u8TrapNo, enmType, (uint16_t)uErrCode, uCr2, 0 /* cbInstr */);
         if (!IEM_VERIFICATION_ENABLED(pIemCpu))
             TRPMResetTrap(pVCpu);
         pIemCpu->uInjectCpl = pIemCpu->uCpl;
@@ -9154,6 +10097,7 @@ static void iemExecVerificationModeCheck(PIEMCPU pIemCpu)
         && pIemCpu->cIOWrites == 0
         && !pIemCpu->fProblematicMemory)
     {
+        uint64_t uStartRip = pOrgCtx->rip;
         unsigned iLoops = 0;
         do
         {
@@ -9166,6 +10110,8 @@ static void iemExecVerificationModeCheck(PIEMCPU pIemCpu)
                  || (   pOrgCtx->rip != pDebugCtx->rip
                      && pIemCpu->uInjectCpl != UINT8_MAX
                      && iLoops < 8) );
+        if (rc == VINF_EM_RESCHEDULE && pOrgCtx->rip != uStartRip)
+            rc = VINF_SUCCESS;
     }
 #endif
     if (   rc == VERR_EM_CANNOT_EXEC_GUEST
@@ -9174,6 +10120,9 @@ static void iemExecVerificationModeCheck(PIEMCPU pIemCpu)
         || rc == VINF_IOM_R3_MMIO_READ
         || rc == VINF_IOM_R3_MMIO_READ_WRITE
         || rc == VINF_IOM_R3_MMIO_WRITE
+        || rc == VINF_CPUM_R3_MSR_READ
+        || rc == VINF_CPUM_R3_MSR_WRITE
+        || rc == VINF_EM_RESCHEDULE
         )
     {
         EMRemLock(pVM);
@@ -9208,6 +10157,22 @@ static void iemExecVerificationModeCheck(PIEMCPU pIemCpu)
             cDiffs++; \
         } \
     } while (0)
+#  define CHECK_XSTATE_FIELD(a_Field) \
+    do \
+    { \
+        if (pOrgXState->a_Field != pDebugXState->a_Field) \
+        { \
+            switch (sizeof(pOrgCtx->a_Field)) \
+            { \
+                case 1: RTAssertMsg2Weak("  %8s differs - iem=%02x - %s=%02x\n", #a_Field, pDebugXState->a_Field, pszWho, pOrgXState->a_Field); break; \
+                case 2: RTAssertMsg2Weak("  %8s differs - iem=%04x - %s=%04x\n", #a_Field, pDebugXState->a_Field, pszWho, pOrgXState->a_Field); break; \
+                case 4: RTAssertMsg2Weak("  %8s differs - iem=%08x - %s=%08x\n", #a_Field, pDebugXState->a_Field, pszWho, pOrgXState->a_Field); break; \
+                case 8: RTAssertMsg2Weak("  %8s differs - iem=%016llx - %s=%016llx\n", #a_Field, pDebugXState->a_Field, pszWho, pOrgXState->a_Field); break; \
+                default: RTAssertMsg2Weak("  %8s differs\n", #a_Field); break; \
+            } \
+            cDiffs++; \
+        } \
+    } while (0)
 
 #  define CHECK_BIT_FIELD(a_Field) \
     do \
@@ -9229,63 +10194,66 @@ static void iemExecVerificationModeCheck(PIEMCPU pIemCpu)
         CHECK_FIELD(a_Sel.fFlags); \
     } while (0)
 
+        PX86XSAVEAREA pOrgXState   = pOrgCtx->CTX_SUFF(pXState);
+        PX86XSAVEAREA pDebugXState = pDebugCtx->CTX_SUFF(pXState);
+
 #if 1 /* The recompiler doesn't update these the intel way. */
         if (fRem)
         {
-            pOrgCtx->fpu.FOP        = pDebugCtx->fpu.FOP;
-            pOrgCtx->fpu.FPUIP      = pDebugCtx->fpu.FPUIP;
-            pOrgCtx->fpu.CS         = pDebugCtx->fpu.CS;
-            pOrgCtx->fpu.Rsrvd1     = pDebugCtx->fpu.Rsrvd1;
-            pOrgCtx->fpu.FPUDP      = pDebugCtx->fpu.FPUDP;
-            pOrgCtx->fpu.DS         = pDebugCtx->fpu.DS;
-            pOrgCtx->fpu.Rsrvd2     = pDebugCtx->fpu.Rsrvd2;
-            //pOrgCtx->fpu.MXCSR_MASK = pDebugCtx->fpu.MXCSR_MASK;
-            if ((pOrgCtx->fpu.FSW & X86_FSW_TOP_MASK) == (pDebugCtx->fpu.FSW & X86_FSW_TOP_MASK))
-                pOrgCtx->fpu.FSW = pDebugCtx->fpu.FSW;
+            pOrgXState->x87.FOP        = pDebugXState->x87.FOP;
+            pOrgXState->x87.FPUIP      = pDebugXState->x87.FPUIP;
+            pOrgXState->x87.CS         = pDebugXState->x87.CS;
+            pOrgXState->x87.Rsrvd1     = pDebugXState->x87.Rsrvd1;
+            pOrgXState->x87.FPUDP      = pDebugXState->x87.FPUDP;
+            pOrgXState->x87.DS         = pDebugXState->x87.DS;
+            pOrgXState->x87.Rsrvd2     = pDebugXState->x87.Rsrvd2;
+            //pOrgXState->x87.MXCSR_MASK = pDebugXState->x87.MXCSR_MASK;
+            if ((pOrgXState->x87.FSW & X86_FSW_TOP_MASK) == (pDebugXState->x87.FSW & X86_FSW_TOP_MASK))
+                pOrgXState->x87.FSW = pDebugXState->x87.FSW;
         }
 #endif
-        if (memcmp(&pOrgCtx->fpu, &pDebugCtx->fpu, sizeof(pDebugCtx->fpu)))
+        if (memcmp(&pOrgXState->x87, &pDebugXState->x87, sizeof(pDebugXState->x87)))
         {
             RTAssertMsg2Weak("  the FPU state differs\n");
             cDiffs++;
-            CHECK_FIELD(fpu.FCW);
-            CHECK_FIELD(fpu.FSW);
-            CHECK_FIELD(fpu.FTW);
-            CHECK_FIELD(fpu.FOP);
-            CHECK_FIELD(fpu.FPUIP);
-            CHECK_FIELD(fpu.CS);
-            CHECK_FIELD(fpu.Rsrvd1);
-            CHECK_FIELD(fpu.FPUDP);
-            CHECK_FIELD(fpu.DS);
-            CHECK_FIELD(fpu.Rsrvd2);
-            CHECK_FIELD(fpu.MXCSR);
-            CHECK_FIELD(fpu.MXCSR_MASK);
-            CHECK_FIELD(fpu.aRegs[0].au64[0]); CHECK_FIELD(fpu.aRegs[0].au64[1]);
-            CHECK_FIELD(fpu.aRegs[1].au64[0]); CHECK_FIELD(fpu.aRegs[1].au64[1]);
-            CHECK_FIELD(fpu.aRegs[2].au64[0]); CHECK_FIELD(fpu.aRegs[2].au64[1]);
-            CHECK_FIELD(fpu.aRegs[3].au64[0]); CHECK_FIELD(fpu.aRegs[3].au64[1]);
-            CHECK_FIELD(fpu.aRegs[4].au64[0]); CHECK_FIELD(fpu.aRegs[4].au64[1]);
-            CHECK_FIELD(fpu.aRegs[5].au64[0]); CHECK_FIELD(fpu.aRegs[5].au64[1]);
-            CHECK_FIELD(fpu.aRegs[6].au64[0]); CHECK_FIELD(fpu.aRegs[6].au64[1]);
-            CHECK_FIELD(fpu.aRegs[7].au64[0]); CHECK_FIELD(fpu.aRegs[7].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 0].au64[0]);  CHECK_FIELD(fpu.aXMM[ 0].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 1].au64[0]);  CHECK_FIELD(fpu.aXMM[ 1].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 2].au64[0]);  CHECK_FIELD(fpu.aXMM[ 2].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 3].au64[0]);  CHECK_FIELD(fpu.aXMM[ 3].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 4].au64[0]);  CHECK_FIELD(fpu.aXMM[ 4].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 5].au64[0]);  CHECK_FIELD(fpu.aXMM[ 5].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 6].au64[0]);  CHECK_FIELD(fpu.aXMM[ 6].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 7].au64[0]);  CHECK_FIELD(fpu.aXMM[ 7].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 8].au64[0]);  CHECK_FIELD(fpu.aXMM[ 8].au64[1]);
-            CHECK_FIELD(fpu.aXMM[ 9].au64[0]);  CHECK_FIELD(fpu.aXMM[ 9].au64[1]);
-            CHECK_FIELD(fpu.aXMM[10].au64[0]);  CHECK_FIELD(fpu.aXMM[10].au64[1]);
-            CHECK_FIELD(fpu.aXMM[11].au64[0]);  CHECK_FIELD(fpu.aXMM[11].au64[1]);
-            CHECK_FIELD(fpu.aXMM[12].au64[0]);  CHECK_FIELD(fpu.aXMM[12].au64[1]);
-            CHECK_FIELD(fpu.aXMM[13].au64[0]);  CHECK_FIELD(fpu.aXMM[13].au64[1]);
-            CHECK_FIELD(fpu.aXMM[14].au64[0]);  CHECK_FIELD(fpu.aXMM[14].au64[1]);
-            CHECK_FIELD(fpu.aXMM[15].au64[0]);  CHECK_FIELD(fpu.aXMM[15].au64[1]);
-            for (unsigned i = 0; i < RT_ELEMENTS(pOrgCtx->fpu.au32RsrvdRest); i++)
-                CHECK_FIELD(fpu.au32RsrvdRest[i]);
+            CHECK_XSTATE_FIELD(x87.FCW);
+            CHECK_XSTATE_FIELD(x87.FSW);
+            CHECK_XSTATE_FIELD(x87.FTW);
+            CHECK_XSTATE_FIELD(x87.FOP);
+            CHECK_XSTATE_FIELD(x87.FPUIP);
+            CHECK_XSTATE_FIELD(x87.CS);
+            CHECK_XSTATE_FIELD(x87.Rsrvd1);
+            CHECK_XSTATE_FIELD(x87.FPUDP);
+            CHECK_XSTATE_FIELD(x87.DS);
+            CHECK_XSTATE_FIELD(x87.Rsrvd2);
+            CHECK_XSTATE_FIELD(x87.MXCSR);
+            CHECK_XSTATE_FIELD(x87.MXCSR_MASK);
+            CHECK_XSTATE_FIELD(x87.aRegs[0].au64[0]); CHECK_XSTATE_FIELD(x87.aRegs[0].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aRegs[1].au64[0]); CHECK_XSTATE_FIELD(x87.aRegs[1].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aRegs[2].au64[0]); CHECK_XSTATE_FIELD(x87.aRegs[2].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aRegs[3].au64[0]); CHECK_XSTATE_FIELD(x87.aRegs[3].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aRegs[4].au64[0]); CHECK_XSTATE_FIELD(x87.aRegs[4].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aRegs[5].au64[0]); CHECK_XSTATE_FIELD(x87.aRegs[5].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aRegs[6].au64[0]); CHECK_XSTATE_FIELD(x87.aRegs[6].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aRegs[7].au64[0]); CHECK_XSTATE_FIELD(x87.aRegs[7].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 0].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 0].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 1].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 1].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 2].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 2].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 3].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 3].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 4].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 4].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 5].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 5].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 6].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 6].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 7].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 7].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 8].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 8].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[ 9].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[ 9].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[10].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[10].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[11].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[11].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[12].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[12].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[13].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[13].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[14].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[14].au64[1]);
+            CHECK_XSTATE_FIELD(x87.aXMM[15].au64[0]);  CHECK_XSTATE_FIELD(x87.aXMM[15].au64[1]);
+            for (unsigned i = 0; i < RT_ELEMENTS(pOrgXState->x87.au32RsrvdRest); i++)
+                CHECK_XSTATE_FIELD(x87.au32RsrvdRest[i]);
         }
         CHECK_FIELD(rip);
         uint32_t fFlagsMask = UINT32_MAX & ~pIemCpu->fUndefinedEFlags;
@@ -9531,18 +10499,19 @@ static void iemLogCurInstr(PVMCPU pVCpu, PCPUMCTX pCtx, bool fSameCtx)
                                szInstr, sizeof(szInstr), &cbInstr);
         }
 
+        PCX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
         Log2(("****\n"
               " eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n"
-              " eip=%08x esp=%08x ebp=%08x iopl=%d\n"
+              " eip=%08x esp=%08x ebp=%08x iopl=%d tr=%04x\n"
               " cs=%04x ss=%04x ds=%04x es=%04x fs=%04x gs=%04x efl=%08x\n"
               " fsw=%04x fcw=%04x ftw=%02x mxcsr=%04x/%04x\n"
               " %s\n"
               ,
               pCtx->eax, pCtx->ebx, pCtx->ecx, pCtx->edx, pCtx->esi, pCtx->edi,
-              pCtx->eip, pCtx->esp, pCtx->ebp, pCtx->eflags.Bits.u2IOPL,
+              pCtx->eip, pCtx->esp, pCtx->ebp, pCtx->eflags.Bits.u2IOPL, pCtx->tr.Sel,
               pCtx->cs.Sel, pCtx->ss.Sel, pCtx->ds.Sel, pCtx->es.Sel,
               pCtx->fs.Sel, pCtx->gs.Sel, pCtx->eflags.u,
-              pCtx->fpu.FSW, pCtx->fpu.FCW, pCtx->fpu.FTW, pCtx->fpu.MXCSR, pCtx->fpu.MXCSR_MASK,
+              pFpuCtx->FSW, pFpuCtx->FCW, pFpuCtx->FTW, pFpuCtx->MXCSR, pFpuCtx->MXCSR_MASK,
               szInstr));
 
         if (LogIs3Enabled())
@@ -9576,6 +10545,8 @@ DECL_FORCE_INLINE(VBOXSTRICTRC) iemExecStatusCodeFiddling(PIEMCPU pIemCpu, VBOXS
                       || rcStrict == VINF_IOM_R3_MMIO_READ
                       || rcStrict == VINF_IOM_R3_MMIO_READ_WRITE
                       || rcStrict == VINF_IOM_R3_MMIO_WRITE
+                      || rcStrict == VINF_CPUM_R3_MSR_READ
+                      || rcStrict == VINF_CPUM_R3_MSR_WRITE
                       , ("rcStrict=%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
             int32_t const rcPassUp = pIemCpu->rcPassUp;
             if (rcPassUp == VINF_SUCCESS)
@@ -9650,7 +10621,7 @@ DECL_FORCE_INLINE(VBOXSTRICTRC) iemExecOneInner(PVMCPU pVCpu, PIEMCPU pIemCpu, b
 # ifdef LOG_ENABLED
             iemLogCurInstr(IEMCPU_TO_VMCPU(pIemCpu), pIemCpu->CTX_SUFF(pCtx), false);
 # endif
-            b; IEM_OPCODE_GET_NEXT_U8(&b);
+            IEM_OPCODE_GET_NEXT_U8(&b);
             rcStrict = FNIEMOP_CALL(g_apfnOneByteMap[b]);
             if (rcStrict == VINF_SUCCESS)
                 pIemCpu->cInstructions++;
@@ -9690,7 +10661,7 @@ DECL_FORCE_INLINE(VBOXSTRICTRC) iemExecOneInner(PVMCPU pVCpu, PIEMCPU pIemCpu, b
 DECLINLINE(VBOXSTRICTRC) iemRCRawMaybeReenter(PIEMCPU pIemCpu, PVMCPU pVCpu, PCPUMCTX pCtx, VBOXSTRICTRC rcStrict)
 {
     if (!pIemCpu->fInPatchCode)
-        CPUMRawEnter(pVCpu, CPUMCTX2CORE(pCtx));
+        CPUMRawEnter(pVCpu);
     return rcStrict;
 }
 #endif
@@ -9860,7 +10831,7 @@ VMMDECL(VBOXSTRICTRC) IEMExecLots(PVMCPU pVCpu)
         RTGCUINT    uErrCode;
         RTGCPTR     uCr2;
         int rc2 = TRPMQueryTrapAll(pVCpu, &u8TrapNo, &enmType, &uErrCode, &uCr2, NULL /* pu8InstLen */); AssertRC(rc2);
-        IEMInjectTrap(pVCpu, u8TrapNo, enmType, (uint16_t)uErrCode, uCr2);
+        IEMInjectTrap(pVCpu, u8TrapNo, enmType, (uint16_t)uErrCode, uCr2, 0 /* cbInstr */);
         if (!IEM_VERIFICATION_ENABLED(pIemCpu))
             TRPMResetTrap(pVCpu);
     }
@@ -9897,7 +10868,7 @@ VMMDECL(VBOXSTRICTRC) IEMExecLots(PVMCPU pVCpu)
     rcStrict = iemRCRawMaybeReenter(pIemCpu, pVCpu, pIemCpu->CTX_SUFF(pCtx), rcStrict);
 #endif
     if (rcStrict != VINF_SUCCESS)
-        LogFlow(("IEMExecOne: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x - rcStrict=%Rrc\n",
+        LogFlow(("IEMExecLots: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x - rcStrict=%Rrc\n",
                  pCtx->cs.Sel, pCtx->rip, pCtx->ss.Sel, pCtx->rsp, pCtx->eflags.u, VBOXSTRICTRC_VAL(rcStrict)));
     return rcStrict;
 }
@@ -9916,8 +10887,11 @@ VMMDECL(VBOXSTRICTRC) IEMExecLots(PVMCPU pVCpu)
  *                              interrupt or hardware interrupt.
  * @param   uErrCode            The error code if applicable.
  * @param   uCr2                The CR2 value if applicable.
+ * @param   cbInstr             The instruction length (only relevant for
+ *                              software interrupts).
  */
-VMM_INT_DECL(VBOXSTRICTRC) IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType, uint16_t uErrCode, RTGCPTR uCr2)
+VMM_INT_DECL(VBOXSTRICTRC) IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVENT enmType, uint16_t uErrCode, RTGCPTR uCr2,
+                                         uint8_t cbInstr)
 {
     iemInitDecoder(&pVCpu->iem.s, false);
 #ifdef DBGFTRACE_ENABLED
@@ -9955,13 +10929,51 @@ VMM_INT_DECL(VBOXSTRICTRC) IEMInjectTrap(PVMCPU pVCpu, uint8_t u8TrapNo, TRPMEVE
                 case X86_XCPT_AC:
                     fFlags |= IEM_XCPT_FLAGS_ERR;
                     break;
+
+                case X86_XCPT_NMI:
+                    VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
+                    break;
             }
             break;
 
         IEM_NOT_REACHED_DEFAULT_CASE_RET();
     }
 
-    return iemRaiseXcptOrInt(&pVCpu->iem.s, 0, u8TrapNo, fFlags, uErrCode, uCr2);
+    return iemRaiseXcptOrInt(&pVCpu->iem.s, cbInstr, u8TrapNo, fFlags, uErrCode, uCr2);
+}
+
+
+/**
+ * Injects the active TRPM event.
+ *
+ * @returns Strict VBox status code.
+ * @param   pVCpu               Pointer to the VMCPU.
+ */
+VMMDECL(VBOXSTRICTRC) IEMInjectTrpmEvent(PVMCPU pVCpu)
+{
+#ifndef IEM_IMPLEMENTS_TASKSWITCH
+    IEM_RETURN_ASPECT_NOT_IMPLEMENTED_LOG(("Event injection\n"));
+#else
+    uint8_t     u8TrapNo;
+    TRPMEVENT   enmType;
+    RTGCUINT    uErrCode;
+    RTGCUINTPTR uCr2;
+    uint8_t     cbInstr;
+    int rc = TRPMQueryTrapAll(pVCpu, &u8TrapNo, &enmType, &uErrCode, &uCr2, &cbInstr);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    VBOXSTRICTRC rcStrict = IEMInjectTrap(pVCpu, u8TrapNo, enmType, uErrCode, uCr2, cbInstr);
+
+    /** @todo Are there any other codes that imply the event was successfully
+     *        delivered to the guest? See @bugref{6607}.  */
+    if (   rcStrict == VINF_SUCCESS
+        || rcStrict == VINF_IEM_RAISED_XCPT)
+    {
+        TRPMResetTrap(pVCpu);
+    }
+    return rcStrict;
+#endif
 }
 
 
@@ -10005,6 +11017,18 @@ VMM_INT_DECL(int) IEMExecInstr_iret(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore)
 #endif
 
 
+/**
+ * Macro used by the IEMExec* method to check the given instruction length.
+ *
+ * Will return on failure!
+ *
+ * @param   a_cbInstr   The given instruction length.
+ * @param   a_cbMin     The minimum length.
+ */
+#define IEMEXEC_ASSERT_INSTR_LEN_RETURN(a_cbInstr, a_cbMin) \
+    AssertMsgReturn((unsigned)(a_cbInstr) - (unsigned)(a_cbMin) <= (unsigned)15 - (unsigned)(a_cbMin), \
+                    ("cbInstr=%u cbMin=%u\n", (a_cbInstr), (a_cbMin)), VERR_IEM_INVALID_INSTR_LENGTH)
+
 
 /**
  * Interface for HM and EM for executing string I/O OUT (write) instructions.
@@ -10026,7 +11050,7 @@ VMM_INT_DECL(VBOXSTRICTRC) IEMExecStringIoWrite(PVMCPU pVCpu, uint8_t cbValue, I
                                                 bool fRepPrefix, uint8_t cbInstr, uint8_t iEffSeg)
 {
     AssertMsgReturn(iEffSeg < X86_SREG_COUNT, ("%#x\n", iEffSeg), VERR_IEM_INVALID_EFF_SEG);
-    AssertReturn(cbInstr - 1U <= 14U, VERR_IEM_INVALID_INSTR_LENGTH);
+    IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 1);
 
     /*
      * State init.
@@ -10143,7 +11167,7 @@ VMM_INT_DECL(VBOXSTRICTRC) IEMExecStringIoWrite(PVMCPU pVCpu, uint8_t cbValue, I
 VMM_INT_DECL(VBOXSTRICTRC) IEMExecStringIoRead(PVMCPU pVCpu, uint8_t cbValue, IEMMODE enmAddrMode,
                                                bool fRepPrefix, uint8_t cbInstr)
 {
-    AssertReturn(cbInstr - 1U <= 14U, VERR_IEM_INVALID_INSTR_LENGTH);
+    IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 1);
 
     /*
      * State init.
@@ -10241,3 +11265,116 @@ VMM_INT_DECL(VBOXSTRICTRC) IEMExecStringIoRead(PVMCPU pVCpu, uint8_t cbValue, IE
     return iemExecStatusCodeFiddling(pIemCpu, rcStrict);
 }
 
+
+
+/**
+ * Interface for HM and EM to write to a CRx register.
+ *
+ * @returns Strict VBox status code.
+ * @param   pVCpu       The cross context per virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ * @param   iCrReg      The control register number (destination).
+ * @param   iGReg       The general purpose register number (source).
+ *
+ * @remarks In ring-0 not all of the state needs to be synced in.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedMovCRxWrite(PVMCPU pVCpu, uint8_t cbInstr, uint8_t iCrReg, uint8_t iGReg)
+{
+    IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 2);
+    Assert(iCrReg < 16);
+    Assert(iGReg < 16);
+
+    PIEMCPU pIemCpu = &pVCpu->iem.s;
+    iemInitExec(pIemCpu, false /*fBypassHandlers*/);
+    VBOXSTRICTRC rcStrict = IEM_CIMPL_CALL_2(iemCImpl_mov_Cd_Rd, iCrReg, iGReg);
+    return iemExecStatusCodeFiddling(pIemCpu, rcStrict);
+}
+
+
+/**
+ * Interface for HM and EM to read from a CRx register.
+ *
+ * @returns Strict VBox status code.
+ * @param   pVCpu       The cross context per virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ * @param   iGReg       The general purpose register number (destination).
+ * @param   iCrReg      The control register number (source).
+ *
+ * @remarks In ring-0 not all of the state needs to be synced in.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedMovCRxRead(PVMCPU pVCpu, uint8_t cbInstr, uint8_t iGReg, uint8_t iCrReg)
+{
+    IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 2);
+    Assert(iCrReg < 16);
+    Assert(iGReg < 16);
+
+    PIEMCPU pIemCpu = &pVCpu->iem.s;
+    iemInitExec(pIemCpu, false /*fBypassHandlers*/);
+    VBOXSTRICTRC rcStrict = IEM_CIMPL_CALL_2(iemCImpl_mov_Rd_Cd, iGReg, iCrReg);
+    return iemExecStatusCodeFiddling(pIemCpu, rcStrict);
+}
+
+
+/**
+ * Interface for HM and EM to clear the CR0[TS] bit.
+ *
+ * @returns Strict VBox status code.
+ * @param   pVCpu       The cross context per virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ *
+ * @remarks In ring-0 not all of the state needs to be synced in.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedClts(PVMCPU pVCpu, uint8_t cbInstr)
+{
+    IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 2);
+
+    PIEMCPU pIemCpu = &pVCpu->iem.s;
+    iemInitExec(pIemCpu, false /*fBypassHandlers*/);
+    VBOXSTRICTRC rcStrict = IEM_CIMPL_CALL_0(iemCImpl_clts);
+    return iemExecStatusCodeFiddling(pIemCpu, rcStrict);
+}
+
+
+/**
+ * Interface for HM and EM to emulate the LMSW instruction (loads CR0).
+ *
+ * @returns Strict VBox status code.
+ * @param   pVCpu       The cross context per virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ * @param   uValue      The value to load into CR0.
+ *
+ * @remarks In ring-0 not all of the state needs to be synced in.
+ */
+VMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedLmsw(PVMCPU pVCpu, uint8_t cbInstr, uint16_t uValue)
+{
+    IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 3);
+
+    PIEMCPU pIemCpu = &pVCpu->iem.s;
+    iemInitExec(pIemCpu, false /*fBypassHandlers*/);
+    VBOXSTRICTRC rcStrict = IEM_CIMPL_CALL_1(iemCImpl_lmsw, uValue);
+    return iemExecStatusCodeFiddling(pIemCpu, rcStrict);
+}
+
+
+/**
+ * Interface for HM and EM to emulate the XSETBV instruction (loads XCRx).
+ *
+ * Takes input values in ecx and edx:eax of the CPU context of the calling EMT.
+ *
+ * @returns Strict VBox status code.
+ * @param   pVCpu       The cross context per virtual CPU structure of the
+ *                      calling EMT.
+ * @param   cbInstr     The instruction length in bytes.
+ * @remarks In ring-0 not all of the state needs to be synced in.
+ * @threads EMT(pVCpu)
+ */
+VMM_INT_DECL(VBOXSTRICTRC) IEMExecDecodedXsetbv(PVMCPU pVCpu, uint8_t cbInstr)
+{
+    IEMEXEC_ASSERT_INSTR_LEN_RETURN(cbInstr, 3);
+
+    PIEMCPU pIemCpu = &pVCpu->iem.s;
+    iemInitExec(pIemCpu, false /*fBypassHandlers*/);
+    VBOXSTRICTRC rcStrict = IEM_CIMPL_CALL_0(iemCImpl_xsetbv);
+    return iemExecStatusCodeFiddling(pIemCpu, rcStrict);
+}
+
diff --git a/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h b/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
index b5e865e..c22ee08 100644
--- a/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
+++ b/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h
@@ -189,37 +189,6 @@ static void iemHlpUpdateArithEFlagsU8(PIEMCPU pIemCpu, uint8_t u8Result, uint32_
 
 
 /**
- * Loads a NULL data selector into a selector register, both the hidden and
- * visible parts, in protected mode.
- *
- * @param   pIemCpu             The IEM state of the calling EMT.
- * @param   pSReg               Pointer to the segment register.
- * @param   uRpl                The RPL.
- */
-static void iemHlpLoadNullDataSelectorProt(PIEMCPU pIemCpu, PCPUMSELREG pSReg, RTSEL uRpl)
-{
-    /** @todo Testcase: write a testcase checking what happends when loading a NULL
-     *        data selector in protected mode. */
-    pSReg->Sel      = uRpl;
-    pSReg->ValidSel = uRpl;
-    pSReg->fFlags   = CPUMSELREG_FLAGS_VALID;
-    if (IEM_IS_GUEST_CPU_INTEL(pIemCpu) && !IEM_FULL_VERIFICATION_REM_ENABLED(pIemCpu))
-    {
-        /* VT-x (Intel 3960x) observed doing something like this. */
-        pSReg->Attr.u   = X86DESCATTR_UNUSABLE | X86DESCATTR_G | X86DESCATTR_D | (pIemCpu->uCpl << X86DESCATTR_DPL_SHIFT);
-        pSReg->u32Limit = UINT32_MAX;
-        pSReg->u64Base  = 0;
-    }
-    else
-    {
-        pSReg->Attr.u   = X86DESCATTR_UNUSABLE;
-        pSReg->u32Limit = 0;
-        pSReg->u64Base  = 0;
-    }
-}
-
-
-/**
  * Helper used by iret.
  *
  * @param   uCpl                The new CPL.
@@ -617,7 +586,6 @@ IEM_CIMPL_DEF_1(iemCImpl_pushf, IEMMODE, enmEffOpSize)
 IEM_CIMPL_DEF_1(iemCImpl_popf, IEMMODE, enmEffOpSize)
 {
     PCPUMCTX        pCtx    = pIemCpu->CTX_SUFF(pCtx);
-    PVMCPU          pVCpu   = IEMCPU_TO_VMCPU(pIemCpu);
     uint32_t const  fEflOld = IEMMISC_GET_EFL(pIemCpu, pCtx);
     VBOXSTRICTRC    rcStrict;
     uint32_t        fEflNew;
@@ -913,13 +881,40 @@ IEM_CIMPL_DEF_1(iemCImpl_call_rel_64, int64_t, offDisp)
  * @param   uSel            The selector.
  * @param   enmBranch       The kind of branching we're performing.
  * @param   enmEffOpSize    The effective operand size.
- * @param   pDesc           The descriptor corrsponding to @a uSel. The type is
- *                          call gate.
+ * @param   pDesc           The descriptor corresponding to @a uSel. The type is
+ *                          task gate.
  */
 IEM_CIMPL_DEF_4(iemCImpl_BranchTaskSegment, uint16_t, uSel, IEMBRANCH, enmBranch, IEMMODE, enmEffOpSize, PIEMSELDESC, pDesc)
 {
-    /* Call various functions to do the work.  Clear RF? */
+#ifndef IEM_IMPLEMENTS_TASKSWITCH
     IEM_RETURN_ASPECT_NOT_IMPLEMENTED();
+#else
+    Assert(enmBranch == IEMBRANCH_JUMP || enmBranch == IEMBRANCH_CALL);
+    Assert(   pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_286_TSS_AVAIL
+           || pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_386_TSS_AVAIL);
+
+    if (   pDesc->Legacy.Gate.u2Dpl < pIemCpu->uCpl
+        || pDesc->Legacy.Gate.u2Dpl < (uSel & X86_SEL_RPL))
+    {
+        Log(("BranchTaskSegment invalid priv. uSel=%04x TSS DPL=%d CPL=%u Sel RPL=%u -> #GP\n", uSel, pDesc->Legacy.Gate.u2Dpl,
+             pIemCpu->uCpl, (uSel & X86_SEL_RPL)));
+        return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+    }
+
+    /** @todo This is checked earlier for far jumps (see iemCImpl_FarJmp) but not
+     *        far calls (see iemCImpl_callf). Most likely in both cases it should be
+     *        checked here, need testcases. */
+    if (!pDesc->Legacy.Gen.u1Present)
+    {
+        Log(("BranchTaskSegment TSS not present uSel=%04x -> #NP\n", uSel));
+        return iemRaiseSelectorNotPresentBySelector(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+    }
+
+    PCPUMCTX pCtx     = pIemCpu->CTX_SUFF(pCtx);
+    uint32_t uNextEip = pCtx->eip + cbInstr;
+    return iemTaskSwitch(pIemCpu, pIemCpu->CTX_SUFF(pCtx), enmBranch == IEMBRANCH_JUMP ? IEMTASKSWITCH_JUMP : IEMTASKSWITCH_CALL,
+                         uNextEip, 0 /* fFlags */, 0 /* uErr */, 0 /* uCr2 */, uSel, pDesc);
+#endif
 }
 
 
@@ -929,13 +924,66 @@ IEM_CIMPL_DEF_4(iemCImpl_BranchTaskSegment, uint16_t, uSel, IEMBRANCH, enmBranch
  * @param   uSel            The selector.
  * @param   enmBranch       The kind of branching we're performing.
  * @param   enmEffOpSize    The effective operand size.
- * @param   pDesc           The descriptor corrsponding to @a uSel. The type is
- *                          call gate.
+ * @param   pDesc           The descriptor corresponding to @a uSel. The type is
+ *                          task gate.
  */
 IEM_CIMPL_DEF_4(iemCImpl_BranchTaskGate, uint16_t, uSel, IEMBRANCH, enmBranch, IEMMODE, enmEffOpSize, PIEMSELDESC, pDesc)
 {
-    /* Call various functions to do the work. Don't clear RF */
+#ifndef IEM_IMPLEMENTS_TASKSWITCH
     IEM_RETURN_ASPECT_NOT_IMPLEMENTED();
+#else
+    Assert(enmBranch == IEMBRANCH_JUMP || enmBranch == IEMBRANCH_CALL);
+
+    if (   pDesc->Legacy.Gate.u2Dpl < pIemCpu->uCpl
+        || pDesc->Legacy.Gate.u2Dpl < (uSel & X86_SEL_RPL))
+    {
+        Log(("BranchTaskGate invalid priv. uSel=%04x TSS DPL=%d CPL=%u Sel RPL=%u -> #GP\n", uSel, pDesc->Legacy.Gate.u2Dpl,
+             pIemCpu->uCpl, (uSel & X86_SEL_RPL)));
+        return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+    }
+
+    /** @todo This is checked earlier for far jumps (see iemCImpl_FarJmp) but not
+     *        far calls (see iemCImpl_callf). Most likely in both cases it should be
+     *        checked here, need testcases. */
+    if (!pDesc->Legacy.Gen.u1Present)
+    {
+        Log(("BranchTaskSegment segment not present uSel=%04x -> #NP\n", uSel));
+        return iemRaiseSelectorNotPresentBySelector(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+    }
+
+    /*
+     * Fetch the new TSS descriptor from the GDT.
+     */
+    RTSEL uSelTss = pDesc->Legacy.Gate.u16Sel;
+    if (uSelTss  & X86_SEL_LDT)
+    {
+        Log(("BranchTaskGate TSS is in LDT. uSel=%04x uSelTss=%04x -> #GP\n", uSel, uSelTss));
+        return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+    }
+
+    IEMSELDESC TssDesc;
+    VBOXSTRICTRC rcStrict = iemMemFetchSelDesc(pIemCpu, &TssDesc, uSelTss, X86_XCPT_GP);
+    if (rcStrict != VINF_SUCCESS)
+        return rcStrict;
+
+    if (TssDesc.Legacy.Gate.u4Type & X86_SEL_TYPE_SYS_TSS_BUSY_MASK)
+    {
+        Log(("BranchTaskGate TSS is busy. uSel=%04x uSelTss=%04x DescType=%#x -> #GP\n", uSel, uSelTss,
+             TssDesc.Legacy.Gate.u4Type));
+        return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel & X86_SEL_MASK_OFF_RPL);
+    }
+
+    if (!TssDesc.Legacy.Gate.u1Present)
+    {
+        Log(("BranchTaskGate TSS is not present. uSel=%04x uSelTss=%04x -> #NP\n", uSel, uSelTss));
+        return iemRaiseSelectorNotPresentBySelector(pIemCpu, uSelTss & X86_SEL_MASK_OFF_RPL);
+    }
+
+    PCPUMCTX pCtx     = pIemCpu->CTX_SUFF(pCtx);
+    uint32_t uNextEip = pCtx->eip + cbInstr;
+    return iemTaskSwitch(pIemCpu, pIemCpu->CTX_SUFF(pCtx), enmBranch == IEMBRANCH_JUMP ? IEMTASKSWITCH_JUMP : IEMTASKSWITCH_CALL,
+                         uNextEip, 0 /* fFlags */, 0 /* uErr */, 0 /* uCr2 */, uSelTss, &TssDesc);
+#endif
 }
 
 
@@ -945,13 +993,614 @@ IEM_CIMPL_DEF_4(iemCImpl_BranchTaskGate, uint16_t, uSel, IEMBRANCH, enmBranch, I
  * @param   uSel            The selector.
  * @param   enmBranch       The kind of branching we're performing.
  * @param   enmEffOpSize    The effective operand size.
- * @param   pDesc           The descriptor corrsponding to @a uSel. The type is
+ * @param   pDesc           The descriptor corresponding to @a uSel. The type is
  *                          call gate.
  */
 IEM_CIMPL_DEF_4(iemCImpl_BranchCallGate, uint16_t, uSel, IEMBRANCH, enmBranch, IEMMODE, enmEffOpSize, PIEMSELDESC, pDesc)
 {
-    /* Call various functions to do the work.  Clear RF. */
+#ifndef IEM_IMPLEMENTS_CALLGATE
     IEM_RETURN_ASPECT_NOT_IMPLEMENTED();
+#else
+    /* NB: Far jumps can only do intra-privilege transfers. Far calls support
+     * inter-privilege calls and are much more complex.
+     *
+     * NB: 64-bit call gate has the same type as a 32-bit call gate! If
+     * EFER.LMA=1, the gate must be 64-bit. Conversely if EFER.LMA=0, the gate
+     * must be 16-bit or 32-bit.
+     */
+    /** @todo: effective operand size is probably irrelevant here, only the
+     *         call gate bitness matters??
+     */
+    VBOXSTRICTRC    rcStrict;
+    RTPTRUNION      uPtrRet;
+    uint64_t        uNewRsp;
+    uint64_t        uNewRip;
+    uint64_t        u64Base;
+    uint32_t        cbLimit;
+    RTSEL           uNewCS;
+    IEMSELDESC      DescCS;
+    PCPUMCTX        pCtx;
+
+    AssertCompile(X86_SEL_TYPE_SYS_386_CALL_GATE == AMD64_SEL_TYPE_SYS_CALL_GATE);
+    Assert(enmBranch == IEMBRANCH_JUMP || enmBranch == IEMBRANCH_CALL);
+    Assert(   pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_286_CALL_GATE
+           || pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_386_CALL_GATE);
+
+    /* Determine the new instruction pointer from the gate descriptor. */
+    uNewRip = pDesc->Legacy.Gate.u16OffsetLow
+            | ((uint32_t)pDesc->Legacy.Gate.u16OffsetHigh << 16)
+            | ((uint64_t)pDesc->Long.Gate.u32OffsetTop    << 32);
+
+    /* Perform DPL checks on the gate descriptor. */
+    if (   pDesc->Legacy.Gate.u2Dpl < pIemCpu->uCpl
+        || pDesc->Legacy.Gate.u2Dpl < (uSel & X86_SEL_RPL))
+    {
+        Log(("BranchCallGate invalid priv. uSel=%04x Gate DPL=%d CPL=%u Sel RPL=%u -> #GP\n", uSel, pDesc->Legacy.Gate.u2Dpl,
+             pIemCpu->uCpl, (uSel & X86_SEL_RPL)));
+        return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel);
+    }
+
+    /** @todo does this catch NULL selectors, too? */
+    if (!pDesc->Legacy.Gen.u1Present)
+    {
+        Log(("BranchCallGate Gate not present uSel=%04x -> #NP\n", uSel));
+        return iemRaiseSelectorNotPresentBySelector(pIemCpu, uSel);
+    }
+
+    /*
+     * Fetch the target CS descriptor from the GDT or LDT.
+     */
+    uNewCS = pDesc->Legacy.Gate.u16Sel;
+    rcStrict = iemMemFetchSelDesc(pIemCpu, &DescCS, uNewCS, X86_XCPT_GP);
+    if (rcStrict != VINF_SUCCESS)
+        return rcStrict;
+
+    /* Target CS must be a code selector. */
+    if (   !DescCS.Legacy.Gen.u1DescType
+        || !(DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_CODE) )
+    {
+        Log(("BranchCallGate %04x:%08RX64 -> not a code selector (u1DescType=%u u4Type=%#x).\n",
+             uNewCS, uNewRip, DescCS.Legacy.Gen.u1DescType, DescCS.Legacy.Gen.u4Type));
+        return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uNewCS);
+    }
+
+    /* Privilege checks on target CS. */
+    if (enmBranch == IEMBRANCH_JUMP)
+    {
+        if (DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_CONF)
+        {
+            if (DescCS.Legacy.Gen.u2Dpl > pIemCpu->uCpl)
+            {
+                Log(("BranchCallGate jump (conforming) bad DPL uNewCS=%04x Gate DPL=%d CPL=%u -> #GP\n",
+                     uNewCS, DescCS.Legacy.Gen.u2Dpl, pIemCpu->uCpl));
+                return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uNewCS);
+            }
+        }
+        else
+        {
+            if (DescCS.Legacy.Gen.u2Dpl != pIemCpu->uCpl)
+            {
+                Log(("BranchCallGate jump (non-conforming) bad DPL uNewCS=%04x Gate DPL=%d CPL=%u -> #GP\n",
+                     uNewCS, DescCS.Legacy.Gen.u2Dpl, pIemCpu->uCpl));
+                return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uNewCS);
+            }
+        }
+    }
+    else
+    {
+        Assert(enmBranch == IEMBRANCH_CALL);
+        if (DescCS.Legacy.Gen.u2Dpl > pIemCpu->uCpl)
+        {
+            Log(("BranchCallGate call invalid priv. uNewCS=%04x Gate DPL=%d CPL=%u -> #GP\n",
+                 uNewCS, DescCS.Legacy.Gen.u2Dpl, pIemCpu->uCpl));
+            return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uNewCS & X86_SEL_MASK_OFF_RPL);
+        }
+    }
+
+    /* Additional long mode checks. */
+    if (IEM_IS_LONG_MODE(pIemCpu))
+    {
+        if (!DescCS.Legacy.Gen.u1Long)
+        {
+            Log(("BranchCallGate uNewCS %04x -> not a 64-bit code segment.\n", uNewCS));
+            return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uNewCS);
+        }
+
+        /* L vs D. */
+        if (   DescCS.Legacy.Gen.u1Long
+            && DescCS.Legacy.Gen.u1DefBig)
+        {
+            Log(("BranchCallGate uNewCS %04x -> both L and D are set.\n", uNewCS));
+            return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uNewCS);
+        }
+    }
+
+    if (!DescCS.Legacy.Gate.u1Present)
+    {
+        Log(("BranchCallGate target CS is not present. uSel=%04x uNewCS=%04x -> #NP(CS)\n", uSel, uNewCS));
+        return iemRaiseSelectorNotPresentBySelector(pIemCpu, uNewCS);
+    }
+
+    pCtx = pIemCpu->CTX_SUFF(pCtx);
+
+    if (enmBranch == IEMBRANCH_JUMP)
+    {
+        /** @todo: This is very similar to regular far jumps; merge! */
+        /* Jumps are fairly simple... */
+
+        /* Chop the high bits off if 16-bit gate (Intel says so). */
+        if (pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_286_CALL_GATE)
+            uNewRip = (uint16_t)uNewRip;
+
+        /* Limit check for non-long segments. */
+        cbLimit = X86DESC_LIMIT_G(&DescCS.Legacy);
+        if (DescCS.Legacy.Gen.u1Long)
+            u64Base = 0;
+        else
+        {
+            if (uNewRip > cbLimit)
+            {
+                Log(("BranchCallGate jump %04x:%08RX64 -> out of bounds (%#x) -> #GP(0)\n", uNewCS, uNewRip, cbLimit));
+                return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, 0);
+            }
+            u64Base = X86DESC_BASE(&DescCS.Legacy);
+        }
+
+        /* Canonical address check. */
+        if (!IEM_IS_CANONICAL(uNewRip))
+        {
+            Log(("BranchCallGate jump %04x:%016RX64 - not canonical -> #GP\n", uNewCS, uNewRip));
+            return iemRaiseNotCanonical(pIemCpu);
+        }
+
+        /*
+         * Ok, everything checked out fine.  Now set the accessed bit before
+         * committing the result into CS, CSHID and RIP.
+         */
+        if (!(DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+        {
+            rcStrict = iemMemMarkSelDescAccessed(pIemCpu, uNewCS);
+            if (rcStrict != VINF_SUCCESS)
+                return rcStrict;
+            /** @todo check what VT-x and AMD-V does. */
+            DescCS.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED;
+        }
+
+        /* commit */
+        pCtx->rip         = uNewRip;
+        pCtx->cs.Sel      = uNewCS & X86_SEL_MASK_OFF_RPL;
+        pCtx->cs.Sel     |= pIemCpu->uCpl; /** @todo is this right for conforming segs? or in general? */
+        pCtx->cs.ValidSel = pCtx->cs.Sel;
+        pCtx->cs.fFlags   = CPUMSELREG_FLAGS_VALID;
+        pCtx->cs.Attr.u   = X86DESC_GET_HID_ATTR(&DescCS.Legacy);
+        pCtx->cs.u32Limit = cbLimit;
+        pCtx->cs.u64Base  = u64Base;
+    }
+    else
+    {
+        Assert(enmBranch == IEMBRANCH_CALL);
+        /* Calls are much more complicated. */
+
+        if (DescCS.Legacy.Gen.u2Dpl < pIemCpu->uCpl)
+        {
+            uint16_t    offNewStack;    /* Offset of new stack in TSS. */
+            uint16_t    cbNewStack;     /* Number of bytes the stack information takes up in TSS. */
+            uint8_t     uNewCSDpl;
+            uint8_t     cbWords;
+            RTSEL       uNewSS;
+            RTSEL       uOldSS;
+            uint64_t    uOldRsp;
+            IEMSELDESC  DescSS;
+            RTPTRUNION  uPtrTSS;
+            RTGCPTR     GCPtrTSS;
+            RTPTRUNION  uPtrParmWds;
+            RTGCPTR     GCPtrParmWds;
+
+            /* More privilege. This is the fun part. */
+            Assert(!(DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_CONF));    /* Filtered out above. */
+
+            /*
+             * Determine new SS:rSP from the TSS.
+             */
+            Assert(!pCtx->tr.Attr.n.u1DescType);
+
+            /* Figure out where the new stack pointer is stored in the TSS. */
+            uNewCSDpl = uNewCS & X86_SEL_RPL;
+            if (!IEM_IS_LONG_MODE(pIemCpu))
+            {
+                if (pCtx->tr.Attr.n.u4Type == X86_SEL_TYPE_SYS_386_TSS_BUSY)
+                {
+                    offNewStack = RT_OFFSETOF(X86TSS32, esp0) + uNewCSDpl * 8;
+                    cbNewStack  = RT_SIZEOFMEMB(X86TSS32, esp0) + RT_SIZEOFMEMB(X86TSS32, ss0);
+                }
+                else
+                {
+                    Assert(pCtx->tr.Attr.n.u4Type == X86_SEL_TYPE_SYS_286_TSS_BUSY);
+                    offNewStack = RT_OFFSETOF(X86TSS16, sp0) + uNewCSDpl * 4;
+                    cbNewStack  = RT_SIZEOFMEMB(X86TSS16, sp0) + RT_SIZEOFMEMB(X86TSS16, ss0);
+                }
+            }
+            else
+            {
+                Assert(pCtx->tr.Attr.n.u4Type == AMD64_SEL_TYPE_SYS_TSS_BUSY);
+                offNewStack = RT_OFFSETOF(X86TSS64, rsp0) + uNewCSDpl * RT_SIZEOFMEMB(X86TSS64, rsp0);
+                cbNewStack  = RT_SIZEOFMEMB(X86TSS64, rsp0);
+            }
+
+            /* Check against TSS limit. */
+            if ((uint16_t)(offNewStack + cbNewStack - 1) > pCtx->tr.u32Limit)
+            {
+                Log(("BranchCallGate inner stack past TSS limit - %u > %u -> #TS(TSS)\n", offNewStack + cbNewStack - 1, pCtx->tr.u32Limit));
+                return iemRaiseTaskSwitchFaultBySelector(pIemCpu, pCtx->tr.Sel);
+            }
+
+            GCPtrTSS = pCtx->tr.u64Base + offNewStack;
+            rcStrict = iemMemMap(pIemCpu, &uPtrTSS.pv, cbNewStack, UINT8_MAX, GCPtrTSS, IEM_ACCESS_SYS_R);
+            if (rcStrict != VINF_SUCCESS)
+            {
+                Log(("BranchCallGate: TSS mapping failed (%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
+                return rcStrict;
+            }
+
+            if (!IEM_IS_LONG_MODE(pIemCpu))
+            {
+                if (pCtx->tr.Attr.n.u4Type == X86_SEL_TYPE_SYS_386_TSS_BUSY)
+                {
+                    uNewRsp = uPtrTSS.pu32[0];
+                    uNewSS  = uPtrTSS.pu16[2];
+                }
+                else
+                {
+                    Assert(pCtx->tr.Attr.n.u4Type == X86_SEL_TYPE_SYS_286_TSS_BUSY);
+                    uNewRsp = uPtrTSS.pu16[0];
+                    uNewSS  = uPtrTSS.pu16[1];
+                }
+            }
+            else
+            {
+                Assert(pCtx->tr.Attr.n.u4Type == AMD64_SEL_TYPE_SYS_TSS_BUSY);
+                /* SS will be a NULL selector, but that's valid. */
+                uNewRsp = uPtrTSS.pu64[0];
+                uNewSS  = uNewCSDpl;
+            }
+
+            /* Done with the TSS now. */
+            rcStrict = iemMemCommitAndUnmap(pIemCpu, uPtrTSS.pv, IEM_ACCESS_SYS_R);
+            if (rcStrict != VINF_SUCCESS)
+            {
+                Log(("BranchCallGate: TSS unmapping failed (%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
+                return rcStrict;
+            }
+
+            /* Only used outside of long mode. */
+            cbWords = pDesc->Legacy.Gate.u4ParmCount;
+
+            /* If EFER.LMA is 0, there's extra work to do. */
+            if (!IEM_IS_LONG_MODE(pIemCpu))
+            {
+                if ((uNewSS & X86_SEL_MASK_OFF_RPL) == 0)
+                {
+                    Log(("BranchCallGate new SS NULL -> #TS(NewSS)\n"));
+                    return iemRaiseTaskSwitchFaultBySelector(pIemCpu, uNewSS);
+                }
+
+                /* Grab the new SS descriptor. */
+                rcStrict = iemMemFetchSelDesc(pIemCpu, &DescSS, uNewSS, X86_XCPT_SS);
+                if (rcStrict != VINF_SUCCESS)
+                    return rcStrict;
+
+                /* Ensure that CS.DPL == SS.RPL == SS.DPL. */
+                if (   (DescCS.Legacy.Gen.u2Dpl != (uNewSS & X86_SEL_RPL))
+                    || (DescCS.Legacy.Gen.u2Dpl != DescSS.Legacy.Gen.u2Dpl))
+                {
+                    Log(("BranchCallGate call bad RPL/DPL uNewSS=%04x SS DPL=%d CS DPL=%u -> #TS(NewSS)\n",
+                         uNewSS, DescCS.Legacy.Gen.u2Dpl, DescCS.Legacy.Gen.u2Dpl));
+                    return iemRaiseTaskSwitchFaultBySelector(pIemCpu, uNewSS);
+                }
+
+                /* Ensure new SS is a writable data segment. */
+                if ((DescSS.Legacy.Gen.u4Type & (X86_SEL_TYPE_CODE | X86_SEL_TYPE_WRITE)) != X86_SEL_TYPE_WRITE)
+                {
+                    Log(("BranchCallGate call new SS -> not a writable data selector (u4Type=%#x)\n", DescSS.Legacy.Gen.u4Type));
+                    return iemRaiseTaskSwitchFaultBySelector(pIemCpu, uNewSS);
+                }
+
+                if (!DescSS.Legacy.Gen.u1Present)
+                {
+                    Log(("BranchCallGate New stack not present uSel=%04x -> #SS(NewSS)\n", uNewSS));
+                    return iemRaiseStackSelectorNotPresentBySelector(pIemCpu, uNewSS);
+                }
+                if (pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_386_CALL_GATE)
+                    cbNewStack = (uint16_t)sizeof(uint32_t) * (4 + cbWords);
+                else
+                    cbNewStack = (uint16_t)sizeof(uint16_t) * (4 + cbWords);
+            }
+            else
+            {
+                /* Just grab the new (NULL) SS descriptor. */
+                rcStrict = iemMemFetchSelDesc(pIemCpu, &DescSS, uNewSS, X86_XCPT_SS);
+                if (rcStrict != VINF_SUCCESS)
+                    return rcStrict;
+
+                cbNewStack = sizeof(uint64_t) * 4;
+            }
+
+            /** @todo: According to Intel, new stack is checked for enough space first,
+             *         then switched. According to AMD, the stack is switched first and
+             *         then pushes might fault!
+             */
+
+            /** @todo: According to AMD, CS is loaded first, then SS.
+             *         According to Intel, it's the other way around!?
+             */
+
+            /** @todo: Intel and AMD disagree on when exactly the CPL changes! */
+
+            /* Set the accessed bit before committing new SS. */
+            if (!(DescSS.Legacy.Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+            {
+                rcStrict = iemMemMarkSelDescAccessed(pIemCpu, uNewSS);
+                if (rcStrict != VINF_SUCCESS)
+                    return rcStrict;
+                DescSS.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED;
+            }
+
+            /* Remember the old SS:rSP and their linear address. */
+            uOldSS  = pCtx->ss.Sel;
+            uOldRsp = pCtx->rsp;
+
+            GCPtrParmWds = pCtx->ss.u64Base + pCtx->rsp;
+
+            /* Commit new SS:rSP. */
+            pCtx->ss.Sel      = uNewSS;
+            pCtx->ss.ValidSel = uNewSS;
+            pCtx->ss.Attr.u   = X86DESC_GET_HID_ATTR(&DescSS.Legacy);
+            pCtx->ss.u32Limit = X86DESC_LIMIT_G(&DescSS.Legacy);
+            pCtx->ss.u64Base  = X86DESC_BASE(&DescSS.Legacy);
+            pCtx->ss.fFlags   = CPUMSELREG_FLAGS_VALID;
+            pCtx->rsp         = uNewRsp;
+            pIemCpu->uCpl     = uNewCSDpl;
+            Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(IEMCPU_TO_VMCPU(pIemCpu), &pCtx->ss));
+            CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_HIDDEN_SEL_REGS);
+
+            /* Check new stack - may #SS(NewSS). */
+            rcStrict = iemMemStackPushBeginSpecial(pIemCpu, cbNewStack,
+                                                   &uPtrRet.pv, &uNewRsp);
+            if (rcStrict != VINF_SUCCESS)
+            {
+                Log(("BranchCallGate: New stack mapping failed (%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
+                return rcStrict;
+            }
+
+            if (!IEM_IS_LONG_MODE(pIemCpu))
+            {
+                if (pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_386_CALL_GATE)
+                {
+                    /* Push the old CS:rIP. */
+                    uPtrRet.pu32[0] = pCtx->eip + cbInstr;
+                    uPtrRet.pu32[1] = pCtx->cs.Sel; /** @todo Testcase: What is written to the high word when pushing CS? */
+
+                    /* Map the relevant chunk of the old stack. */
+                    rcStrict = iemMemMap(pIemCpu, &uPtrParmWds.pv, cbWords * 4, UINT8_MAX, GCPtrParmWds, IEM_ACCESS_DATA_R);
+                    if (rcStrict != VINF_SUCCESS)
+                    {
+                        Log(("BranchCallGate: Old stack mapping (32-bit) failed (%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
+                        return rcStrict;
+                    }
+
+                    /* Copy the parameter (d)words. */
+                    for (int i = 0; i < cbWords; ++i)
+                        uPtrRet.pu32[2 + i] = uPtrParmWds.pu32[i];
+
+                    /* Unmap the old stack. */
+                    rcStrict = iemMemCommitAndUnmap(pIemCpu, uPtrParmWds.pv, IEM_ACCESS_DATA_R);
+                    if (rcStrict != VINF_SUCCESS)
+                    {
+                        Log(("BranchCallGate: Old stack unmapping (32-bit) failed (%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
+                        return rcStrict;
+                    }
+
+                    /* Push the old SS:rSP. */
+                    uPtrRet.pu32[2 + cbWords + 0] = uOldRsp;
+                    uPtrRet.pu32[2 + cbWords + 1] = uOldSS;
+                }
+                else
+                {
+                    Assert(pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_286_CALL_GATE);
+
+                    /* Push the old CS:rIP. */
+                    uPtrRet.pu16[0] = pCtx->ip + cbInstr;
+                    uPtrRet.pu16[1] = pCtx->cs.Sel;
+
+                    /* Map the relevant chunk of the old stack. */
+                    rcStrict = iemMemMap(pIemCpu, &uPtrParmWds.pv, cbWords * 2, UINT8_MAX, GCPtrParmWds, IEM_ACCESS_DATA_R);
+                    if (rcStrict != VINF_SUCCESS)
+                    {
+                        Log(("BranchCallGate: Old stack mapping (16-bit) failed (%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
+                        return rcStrict;
+                    }
+
+                    /* Copy the parameter words. */
+                    for (int i = 0; i < cbWords; ++i)
+                        uPtrRet.pu16[2 + i] = uPtrParmWds.pu16[i];
+
+                    /* Unmap the old stack. */
+                    rcStrict = iemMemCommitAndUnmap(pIemCpu, uPtrParmWds.pv, IEM_ACCESS_DATA_R);
+                    if (rcStrict != VINF_SUCCESS)
+                    {
+                        Log(("BranchCallGate: Old stack unmapping (32-bit) failed (%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
+                        return rcStrict;
+                    }
+
+                    /* Push the old SS:rSP. */
+                    uPtrRet.pu16[2 + cbWords + 0] = uOldRsp;
+                    uPtrRet.pu16[2 + cbWords + 1] = uOldSS;
+                }
+            }
+            else
+            {
+                Assert(pDesc->Legacy.Gate.u4Type == AMD64_SEL_TYPE_SYS_CALL_GATE);
+
+                /* For 64-bit gates, no parameters are copied. Just push old SS:rSP and CS:rIP. */
+                uPtrRet.pu64[0] = pCtx->rip + cbInstr;
+                uPtrRet.pu64[1] = pCtx->cs.Sel; /** @todo Testcase: What is written to the high words when pushing CS? */
+                uPtrRet.pu64[2] = uOldRsp;
+                uPtrRet.pu64[3] = uOldSS;       /** @todo Testcase: What is written to the high words when pushing SS? */
+            }
+
+            rcStrict = iemMemStackPushCommitSpecial(pIemCpu, uPtrRet.pv, uNewRsp);
+            if (rcStrict != VINF_SUCCESS)
+            {
+                Log(("BranchCallGate: New stack unmapping failed (%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
+                return rcStrict;
+            }
+
+            /* Chop the high bits off if 16-bit gate (Intel says so). */
+            if (pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_286_CALL_GATE)
+                uNewRip = (uint16_t)uNewRip;
+
+            /* Limit / canonical check. */
+            cbLimit = X86DESC_LIMIT_G(&DescCS.Legacy);
+            if (!IEM_IS_LONG_MODE(pIemCpu))
+            {
+                if (uNewRip > cbLimit)
+                {
+                    Log(("BranchCallGate %04x:%08RX64 -> out of bounds (%#x)\n", uNewCS, uNewRip, cbLimit));
+                    return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, 0);
+                }
+                u64Base = X86DESC_BASE(&DescCS.Legacy);
+            }
+            else
+            {
+                Assert(pDesc->Legacy.Gate.u4Type == AMD64_SEL_TYPE_SYS_CALL_GATE);
+                if (!IEM_IS_CANONICAL(uNewRip))
+                {
+                    Log(("BranchCallGate call %04x:%016RX64 - not canonical -> #GP\n", uNewCS, uNewRip));
+                    return iemRaiseNotCanonical(pIemCpu);
+                }
+                u64Base = 0;
+            }
+
+            /*
+             * Now set the accessed bit before
+             * writing the return address to the stack and committing the result into
+             * CS, CSHID and RIP.
+             */
+            /** @todo Testcase: Need to check WHEN exactly the accessed bit is set. */
+            if (!(DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+            {
+                rcStrict = iemMemMarkSelDescAccessed(pIemCpu, uNewCS);
+                if (rcStrict != VINF_SUCCESS)
+                    return rcStrict;
+                /** @todo check what VT-x and AMD-V does. */
+                DescCS.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED;
+            }
+
+            /* Commit new CS:rIP. */
+            pCtx->rip         = uNewRip;
+            pCtx->cs.Sel      = uNewCS & X86_SEL_MASK_OFF_RPL;
+            pCtx->cs.Sel     |= pIemCpu->uCpl;
+            pCtx->cs.ValidSel = pCtx->cs.Sel;
+            pCtx->cs.fFlags   = CPUMSELREG_FLAGS_VALID;
+            pCtx->cs.Attr.u   = X86DESC_GET_HID_ATTR(&DescCS.Legacy);
+            pCtx->cs.u32Limit = cbLimit;
+            pCtx->cs.u64Base  = u64Base;
+        }
+        else
+        {
+            /* Same privilege. */
+            /** @todo: This is very similar to regular far calls; merge! */
+
+            /* Check stack first - may #SS(0). */
+            /** @todo check how gate size affects pushing of CS! Does callf 16:32 in
+             *        16-bit code cause a two or four byte CS to be pushed? */
+            rcStrict = iemMemStackPushBeginSpecial(pIemCpu,
+                                                   IEM_IS_LONG_MODE(pIemCpu) ? 8+8
+                                                   : pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_386_CALL_GATE ? 4+4 : 2+2,
+                                                   &uPtrRet.pv, &uNewRsp);
+            if (rcStrict != VINF_SUCCESS)
+                return rcStrict;
+
+            /* Chop the high bits off if 16-bit gate (Intel says so). */
+            if (pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_286_CALL_GATE)
+                uNewRip = (uint16_t)uNewRip;
+
+            /* Limit / canonical check. */
+            cbLimit = X86DESC_LIMIT_G(&DescCS.Legacy);
+            if (!IEM_IS_LONG_MODE(pIemCpu))
+            {
+                if (uNewRip > cbLimit)
+                {
+                    Log(("BranchCallGate %04x:%08RX64 -> out of bounds (%#x)\n", uNewCS, uNewRip, cbLimit));
+                    return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, 0);
+                }
+                u64Base = X86DESC_BASE(&DescCS.Legacy);
+            }
+            else
+            {
+                if (!IEM_IS_CANONICAL(uNewRip))
+                {
+                    Log(("BranchCallGate call %04x:%016RX64 - not canonical -> #GP\n", uNewCS, uNewRip));
+                    return iemRaiseNotCanonical(pIemCpu);
+                }
+                u64Base = 0;
+            }
+
+            /*
+             * Now set the accessed bit before
+             * writing the return address to the stack and committing the result into
+             * CS, CSHID and RIP.
+             */
+            /** @todo Testcase: Need to check WHEN exactly the accessed bit is set. */
+            if (!(DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_ACCESSED))
+            {
+                rcStrict = iemMemMarkSelDescAccessed(pIemCpu, uNewCS);
+                if (rcStrict != VINF_SUCCESS)
+                    return rcStrict;
+                /** @todo check what VT-x and AMD-V does. */
+                DescCS.Legacy.Gen.u4Type |= X86_SEL_TYPE_ACCESSED;
+            }
+
+            /* stack */
+            if (!IEM_IS_LONG_MODE(pIemCpu))
+            {
+                if (pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_386_CALL_GATE)
+                {
+                    uPtrRet.pu32[0] = pCtx->eip + cbInstr;
+                    uPtrRet.pu32[1] = pCtx->cs.Sel; /** @todo Testcase: What is written to the high word when pushing CS? */
+                }
+                else
+                {
+                    Assert(pDesc->Legacy.Gate.u4Type == X86_SEL_TYPE_SYS_286_CALL_GATE);
+                    uPtrRet.pu16[0] = pCtx->ip + cbInstr;
+                    uPtrRet.pu16[1] = pCtx->cs.Sel;
+                }
+            }
+            else
+            {
+                Assert(pDesc->Legacy.Gate.u4Type == AMD64_SEL_TYPE_SYS_CALL_GATE);
+                uPtrRet.pu64[0] = pCtx->rip + cbInstr;
+                uPtrRet.pu64[1] = pCtx->cs.Sel; /** @todo Testcase: What is written to the high words when pushing CS? */
+            }
+
+            rcStrict = iemMemStackPushCommitSpecial(pIemCpu, uPtrRet.pv, uNewRsp);
+            if (rcStrict != VINF_SUCCESS)
+                return rcStrict;
+
+            /* commit */
+            pCtx->rip         = uNewRip;
+            pCtx->cs.Sel      = uNewCS & X86_SEL_MASK_OFF_RPL;
+            pCtx->cs.Sel     |= pIemCpu->uCpl;
+            pCtx->cs.ValidSel = pCtx->cs.Sel;
+            pCtx->cs.fFlags   = CPUMSELREG_FLAGS_VALID;
+            pCtx->cs.Attr.u   = X86DESC_GET_HID_ATTR(&DescCS.Legacy);
+            pCtx->cs.u32Limit = cbLimit;
+            pCtx->cs.u64Base  = u64Base;
+        }
+    }
+    pCtx->eflags.Bits.u1RF = 0;
+    return VINF_SUCCESS;
+#endif
 }
 
 
@@ -961,7 +1610,7 @@ IEM_CIMPL_DEF_4(iemCImpl_BranchCallGate, uint16_t, uSel, IEMBRANCH, enmBranch, I
  * @param   uSel            The selector.
  * @param   enmBranch       The kind of branching we're performing.
  * @param   enmEffOpSize    The effective operand size.
- * @param   pDesc           The descriptor corrsponding to @a uSel.
+ * @param   pDesc           The descriptor corresponding to @a uSel.
  */
 IEM_CIMPL_DEF_4(iemCImpl_BranchSysSel, uint16_t, uSel, IEMBRANCH, enmBranch, IEMMODE, enmEffOpSize, PIEMSELDESC, pDesc)
 {
@@ -982,7 +1631,6 @@ IEM_CIMPL_DEF_4(iemCImpl_BranchSysSel, uint16_t, uSel, IEMBRANCH, enmBranch, IEM
             case AMD64_SEL_TYPE_SYS_INT_GATE:
                 Log(("branch %04x -> wrong sys selector (64-bit): %d\n", uSel, pDesc->Legacy.Gen.u4Type));
                 return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel);
-
         }
 
     switch (pDesc->Legacy.Gen.u4Type)
@@ -1138,6 +1786,7 @@ IEM_CIMPL_DEF_3(iemCImpl_FarJmp, uint16_t, uSel, uint64_t, offSeg, IEMMODE, enmE
         if (offSeg > cbLimit)
         {
             Log(("jmpf %04x:%08RX64 -> out of bounds (%#x)\n", uSel, offSeg, cbLimit));
+            /** @todo: Intel says this is #GP(0)! */
             return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel);
         }
         u64Base = X86DESC_BASE(&Desc.Legacy);
@@ -1333,6 +1982,7 @@ IEM_CIMPL_DEF_3(iemCImpl_callf, uint16_t, uSel, uint64_t, offSeg, IEMMODE, enmEf
         if (offSeg > cbLimit)
         {
             Log(("callf %04x:%08RX64 -> out of bounds (%#x)\n", uSel, offSeg, cbLimit));
+            /** @todo: Intel says this is #GP(0)! */
             return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uSel);
         }
         u64Base = X86DESC_BASE(&Desc.Legacy);
@@ -1532,27 +2182,30 @@ IEM_CIMPL_DEF_2(iemCImpl_retf, IEMMODE, enmEffOpSize, uint16_t, cbPop)
      */
     if ((uNewCs & X86_SEL_RPL) != pIemCpu->uCpl)
     {
-        /* Read the return pointer, it comes before the parameters. */
+        /* Read the outer stack pointer stored *after* the parameters. */
         RTCPTRUNION uPtrStack;
         rcStrict = iemMemStackPopContinueSpecial(pIemCpu, cbPop + cbRetPtr, &uPtrStack.pv, &uNewRsp);
         if (rcStrict != VINF_SUCCESS)
             return rcStrict;
+
+        uPtrStack.pu8 += cbPop; /* Skip the parameters. */
+
         uint16_t uNewOuterSs;
         uint64_t uNewOuterRsp;
         if (enmEffOpSize == IEMMODE_16BIT)
         {
-            uNewOuterRsp = uPtrFrame.pu16[0];
-            uNewOuterSs  = uPtrFrame.pu16[1];
+            uNewOuterRsp = uPtrStack.pu16[0];
+            uNewOuterSs  = uPtrStack.pu16[1];
         }
         else if (enmEffOpSize == IEMMODE_32BIT)
         {
-            uNewOuterRsp = uPtrFrame.pu32[0];
-            uNewOuterSs  = uPtrFrame.pu16[2];
+            uNewOuterRsp = uPtrStack.pu32[0];
+            uNewOuterSs  = uPtrStack.pu16[2];
         }
         else
         {
-            uNewOuterRsp = uPtrFrame.pu64[0];
-            uNewOuterSs  = uPtrFrame.pu16[4];
+            uNewOuterRsp = uPtrStack.pu64[0];
+            uNewOuterSs  = uPtrStack.pu16[4];
         }
 
         /* Check for NULL stack selector (invalid in ring-3 and non-long mode)
@@ -1642,6 +2295,7 @@ IEM_CIMPL_DEF_2(iemCImpl_retf, IEMMODE, enmEffOpSize, uint16_t, cbPop)
             {
                 Log(("retf %04x:%08RX64 %04x:%08RX64 - out of bounds (%#x)-> #GP(CS).\n",
                      uNewCs, uNewRip, uNewOuterSs, uNewOuterRsp, cbLimitCs));
+                /** @todo: Intel says this is #GP(0)! */
                 return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uNewCs);
             }
             u64Base = X86DESC_BASE(&DescCs.Legacy);
@@ -1685,7 +2339,7 @@ IEM_CIMPL_DEF_2(iemCImpl_retf, IEMMODE, enmEffOpSize, uint16_t, cbPop)
         pCtx->cs.Attr.u         = X86DESC_GET_HID_ATTR(&DescCs.Legacy);
         pCtx->cs.u32Limit       = cbLimitCs;
         pCtx->cs.u64Base        = u64Base;
-        pCtx->rsp               = uNewRsp;
+        pCtx->rsp               = uNewOuterRsp;
         pCtx->ss.Sel            = uNewOuterSs;
         pCtx->ss.ValidSel       = uNewOuterSs;
         pCtx->ss.fFlags         = CPUMSELREG_FLAGS_VALID;
@@ -1734,6 +2388,7 @@ IEM_CIMPL_DEF_2(iemCImpl_retf, IEMMODE, enmEffOpSize, uint16_t, cbPop)
             if (uNewRip > cbLimitCs)
             {
                 Log(("retf %04x:%08RX64 -> out of bounds (%#x)\n", uNewCs, uNewRip, cbLimitCs));
+                /** @todo: Intel says this is #GP(0)! */
                 return iemRaiseGeneralProtectionFaultBySelector(pIemCpu, uNewCs);
             }
             u64Base = X86DESC_BASE(&DescCs.Legacy);
@@ -2045,7 +2700,6 @@ IEM_CIMPL_DEF_2(iemCImpl_int, uint8_t, u8Int, bool, fIsBpInstr)
 IEM_CIMPL_DEF_1(iemCImpl_iret_real_v8086, IEMMODE, enmEffOpSize)
 {
     PCPUMCTX  pCtx  = pIemCpu->CTX_SUFF(pCtx);
-    PVMCPU    pVCpu = IEMCPU_TO_VMCPU(pIemCpu);
     X86EFLAGS Efl;
     Efl.u = IEMMISC_GET_EFL(pIemCpu, pCtx);
     NOREF(cbInstr);
@@ -2096,7 +2750,7 @@ IEM_CIMPL_DEF_1(iemCImpl_iret_real_v8086, IEMMODE, enmEffOpSize)
         uNewFlags  = uFrame.pu16[2];
         uNewFlags &= X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF
                    | X86_EFL_TF | X86_EFL_IF | X86_EFL_DF | X86_EFL_OF | X86_EFL_IOPL | X86_EFL_NT;
-        uNewFlags |= Efl.u & (UINT32_C(0xffff0000) | X86_EFL_1);
+        uNewFlags |= Efl.u & ((UINT32_C(0xffff0000) | X86_EFL_1) & ~X86_EFL_RF);
         /** @todo The intel pseudo code does not indicate what happens to
          *        reserved flags. We just ignore them. */
     }
@@ -2243,7 +2897,55 @@ IEM_CIMPL_DEF_5(iemCImpl_iret_prot_v8086, PCPUMCTX, pCtx, uint32_t, uNewEip, uin
  */
 IEM_CIMPL_DEF_1(iemCImpl_iret_prot_NestedTask, IEMMODE, enmEffOpSize)
 {
+#ifndef IEM_IMPLEMENTS_TASKSWITCH
     IEM_RETURN_ASPECT_NOT_IMPLEMENTED();
+#else
+    /*
+     * Read the segment selector in the link-field of the current TSS.
+     */
+    RTSEL        uSelRet;
+    PCPUMCTX     pCtx = pIemCpu->CTX_SUFF(pCtx);
+    VBOXSTRICTRC rcStrict = iemMemFetchSysU16(pIemCpu, &uSelRet, UINT8_MAX, pCtx->tr.u64Base);
+    if (rcStrict != VINF_SUCCESS)
+        return rcStrict;
+
+    /*
+     * Fetch the returning task's TSS descriptor from the GDT.
+     */
+    if (uSelRet & X86_SEL_LDT)
+    {
+        Log(("iret_prot_NestedTask TSS not in LDT. uSelRet=%04x -> #TS\n", uSelRet));
+        return iemRaiseTaskSwitchFaultBySelector(pIemCpu, uSelRet);
+    }
+
+    IEMSELDESC TssDesc;
+    rcStrict = iemMemFetchSelDesc(pIemCpu, &TssDesc, uSelRet, X86_XCPT_GP);
+    if (rcStrict != VINF_SUCCESS)
+        return rcStrict;
+
+    if (TssDesc.Legacy.Gate.u1DescType)
+    {
+        Log(("iret_prot_NestedTask Invalid TSS type. uSelRet=%04x -> #TS\n", uSelRet));
+        return iemRaiseTaskSwitchFaultBySelector(pIemCpu, uSelRet & X86_SEL_MASK_OFF_RPL);
+    }
+
+    if (   TssDesc.Legacy.Gate.u4Type != X86_SEL_TYPE_SYS_286_TSS_BUSY
+        && TssDesc.Legacy.Gate.u4Type != X86_SEL_TYPE_SYS_386_TSS_BUSY)
+    {
+        Log(("iret_prot_NestedTask TSS is not busy. uSelRet=%04x DescType=%#x -> #TS\n", uSelRet, TssDesc.Legacy.Gate.u4Type));
+        return iemRaiseTaskSwitchFaultBySelector(pIemCpu, uSelRet & X86_SEL_MASK_OFF_RPL);
+    }
+
+    if (!TssDesc.Legacy.Gate.u1Present)
+    {
+        Log(("iret_prot_NestedTask TSS is not present. uSelRet=%04x -> #NP\n", uSelRet));
+        return iemRaiseSelectorNotPresentBySelector(pIemCpu, uSelRet & X86_SEL_MASK_OFF_RPL);
+    }
+
+    uint32_t uNextEip = pCtx->eip + cbInstr;
+    return iemTaskSwitch(pIemCpu, pIemCpu->CTX_SUFF(pCtx), IEMTASKSWITCH_IRET, uNextEip, 0 /* fFlags */, 0 /* uErr */,
+                         0 /* uCr2 */, uSelRet, &TssDesc);
+#endif
 }
 
 
@@ -2407,7 +3109,7 @@ IEM_CIMPL_DEF_1(iemCImpl_iret_prot, IEMMODE, enmEffOpSize)
         }
         else
         {
-            rcStrict = iemMemStackPopContinueSpecial(pIemCpu, 8, &uFrame.pv, &uNewRsp);
+            rcStrict = iemMemStackPopContinueSpecial(pIemCpu, 4, &uFrame.pv, &uNewRsp);
             if (rcStrict != VINF_SUCCESS)
                 return rcStrict;
             uNewESP = uFrame.pu16[0];
@@ -2474,6 +3176,7 @@ IEM_CIMPL_DEF_1(iemCImpl_iret_prot, IEMMODE, enmEffOpSize)
         {
             Log(("iret %04x:%08x/%04x:%08x -> EIP is out of bounds (%#x) -> #GP(0)\n",
                  uNewCs, uNewEip, uNewSS, uNewESP, cbLimitCS));
+            /** @todo: Which is it, #GP(0) or #GP(sel)? */
             return iemRaiseSelectorBoundsBySelector(pIemCpu, uNewCs);
         }
 
@@ -2521,7 +3224,7 @@ IEM_CIMPL_DEF_1(iemCImpl_iret_prot, IEMMODE, enmEffOpSize)
         pCtx->cs.Attr.u     = X86DESC_GET_HID_ATTR(&DescCS.Legacy);
         pCtx->cs.u32Limit   = cbLimitCS;
         pCtx->cs.u64Base    = X86DESC_BASE(&DescCS.Legacy);
-        if (!pCtx->cs.Attr.n.u1DefBig)
+        if (!pCtx->ss.Attr.n.u1DefBig)
             pCtx->sp        = (uint16_t)uNewESP;
         else
             pCtx->rsp       = uNewESP;
@@ -2550,6 +3253,7 @@ IEM_CIMPL_DEF_1(iemCImpl_iret_prot, IEMMODE, enmEffOpSize)
         if (uNewEip > cbLimitCS)
         {
             Log(("iret %04x:%08x - EIP is out of bounds (%#x) -> #GP(0)\n", uNewCs, uNewEip, cbLimitCS));
+            /** @todo: Which is it, #GP(0) or #GP(sel)? */
             return iemRaiseSelectorBoundsBySelector(pIemCpu, uNewCs);
         }
 
@@ -2803,6 +3507,7 @@ IEM_CIMPL_DEF_1(iemCImpl_iret_long, IEMMODE, enmEffOpSize)
         {
             Log(("iret %04x:%016RX64/%04x:%016RX64 -> EIP is out of bounds (%#x) -> #GP(0)\n",
                  uNewCs, uNewRip, uNewSs, uNewRsp, cbLimitCS));
+            /** @todo: Which is it, #GP(0) or #GP(sel)? */
             return iemRaiseSelectorBoundsBySelector(pIemCpu, uNewCs);
         }
     }
@@ -2895,6 +3600,12 @@ IEM_CIMPL_DEF_1(iemCImpl_iret_long, IEMMODE, enmEffOpSize)
 IEM_CIMPL_DEF_1(iemCImpl_iret, IEMMODE, enmEffOpSize)
 {
     /*
+     * First, clear NMI blocking, if any, before causing any exceptions.
+     */
+    PVMCPU pVCpu = IEMCPU_TO_VMCPU(pIemCpu);
+    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
+
+    /*
      * Call a mode specific worker.
      */
     if (IEM_IS_REAL_OR_V86_MODE(pIemCpu))
@@ -4257,17 +4968,20 @@ IEM_CIMPL_DEF_2(iemCImpl_load_CrX, uint8_t, iCrReg, uint64_t, uNewCrX)
         {
             uint64_t const uOldCrX = pCtx->cr4;
 
+            /** @todo Shouldn't this look at the guest CPUID bits to determine
+             *        valid bits? e.g. if guest CPUID doesn't allow X86_CR4_OSXMMEEXCPT, we
+             *        should #GP(0). */
             /* reserved bits */
             uint32_t fValid = X86_CR4_VME | X86_CR4_PVI
                             | X86_CR4_TSD | X86_CR4_DE
                             | X86_CR4_PSE | X86_CR4_PAE
                             | X86_CR4_MCE | X86_CR4_PGE
-                            | X86_CR4_PCE | X86_CR4_OSFSXR
+                            | X86_CR4_PCE | X86_CR4_OSFXSR
                             | X86_CR4_OSXMMEEXCPT;
             //if (xxx)
             //    fValid |= X86_CR4_VMXE;
-            //if (xxx)
-            //    fValid |= X86_CR4_OSXSAVE;
+            if (IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fXSaveRstor)
+                fValid |= X86_CR4_OSXSAVE;
             if (uNewCrX & ~(uint64_t)fValid)
             {
                 Log(("Trying to set reserved CR4 bits: NewCR4=%#llx InvalidBits=%#llx\n", uNewCrX, uNewCrX & ~(uint64_t)fValid));
@@ -4620,7 +5334,7 @@ IEM_CIMPL_DEF_0(iemCImpl_rdtsc)
     /*
      * Check preconditions.
      */
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_TSC))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fTsc)
         return iemRaiseUndefinedOpcode(pIemCpu);
 
     if (   (pCtx->cr4 & X86_CR4_TSD)
@@ -4655,7 +5369,7 @@ IEM_CIMPL_DEF_0(iemCImpl_rdmsr)
     /*
      * Check preconditions.
      */
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_MSR))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fMsr)
         return iemRaiseUndefinedOpcode(pIemCpu);
     if (pIemCpu->uCpl != 0)
         return iemRaiseGeneralProtectionFault0(pIemCpu);
@@ -4664,24 +5378,33 @@ IEM_CIMPL_DEF_0(iemCImpl_rdmsr)
      * Do the job.
      */
     RTUINT64U uValue;
-    int rc = CPUMQueryGuestMsr(IEMCPU_TO_VMCPU(pIemCpu), pCtx->ecx, &uValue.u);
-    if (rc != VINF_SUCCESS)
+    VBOXSTRICTRC rcStrict = CPUMQueryGuestMsr(IEMCPU_TO_VMCPU(pIemCpu), pCtx->ecx, &uValue.u);
+    if (rcStrict == VINF_SUCCESS)
     {
-#ifdef IN_RING3
-        static uint32_t s_cTimes = 0;
-        if (s_cTimes++ < 10)
-            LogRel(("IEM: rdmsr(%#x) -> GP(0)\n", pCtx->ecx));
-#endif
-        Log(("IEM: rdmsr(%#x) -> GP(0)\n", pCtx->ecx));
-        AssertMsgReturn(rc == VERR_CPUM_RAISE_GP_0, ("%Rrc\n", rc), VERR_IPE_UNEXPECTED_STATUS);
-        return iemRaiseGeneralProtectionFault0(pIemCpu);
-    }
+        pCtx->rax = uValue.s.Lo;
+        pCtx->rdx = uValue.s.Hi;
 
-    pCtx->rax = uValue.s.Lo;
-    pCtx->rdx = uValue.s.Hi;
+        iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
+        return VINF_SUCCESS;
+    }
 
-    iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
-    return VINF_SUCCESS;
+#ifndef IN_RING3
+    /* Deferred to ring-3. */
+    if (rcStrict == VINF_CPUM_R3_MSR_READ)
+    {
+        Log(("IEM: rdmsr(%#x) -> ring-3\n", pCtx->ecx));
+        return rcStrict;
+    }
+#else /* IN_RING3 */
+    /* Often a unimplemented MSR or MSR bit, so worth logging. */
+    static uint32_t s_cTimes = 0;
+    if (s_cTimes++ < 10)
+        LogRel(("IEM: rdmsr(%#x) -> #GP(0)\n", pCtx->ecx));
+    else
+#endif
+        Log(("IEM: rdmsr(%#x) -> #GP(0)\n", pCtx->ecx));
+    AssertMsgReturn(rcStrict == VERR_CPUM_RAISE_GP_0, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), VERR_IPE_UNEXPECTED_STATUS);
+    return iemRaiseGeneralProtectionFault0(pIemCpu);
 }
 
 
@@ -4695,7 +5418,7 @@ IEM_CIMPL_DEF_0(iemCImpl_wrmsr)
     /*
      * Check preconditions.
      */
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_MSR))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fMsr)
         return iemRaiseUndefinedOpcode(pIemCpu);
     if (pIemCpu->uCpl != 0)
         return iemRaiseGeneralProtectionFault0(pIemCpu);
@@ -4707,31 +5430,44 @@ IEM_CIMPL_DEF_0(iemCImpl_wrmsr)
     uValue.s.Lo = pCtx->eax;
     uValue.s.Hi = pCtx->edx;
 
-    int rc;
+    VBOXSTRICTRC rcStrict;
     if (!IEM_VERIFICATION_ENABLED(pIemCpu))
-        rc = CPUMSetGuestMsr(IEMCPU_TO_VMCPU(pIemCpu), pCtx->ecx, uValue.u);
+        rcStrict = CPUMSetGuestMsr(IEMCPU_TO_VMCPU(pIemCpu), pCtx->ecx, uValue.u);
     else
     {
+#ifdef IN_RING3
         CPUMCTX CtxTmp = *pCtx;
-        rc = CPUMSetGuestMsr(IEMCPU_TO_VMCPU(pIemCpu), pCtx->ecx, uValue.u);
+        rcStrict = CPUMSetGuestMsr(IEMCPU_TO_VMCPU(pIemCpu), pCtx->ecx, uValue.u);
         PCPUMCTX pCtx2 = CPUMQueryGuestCtxPtr(IEMCPU_TO_VMCPU(pIemCpu));
         *pCtx = *pCtx2;
         *pCtx2 = CtxTmp;
+#else
+        AssertReleaseFailedReturn(VERR_INTERNAL_ERROR_4);
+#endif
     }
-    if (rc != VINF_SUCCESS)
+    if (rcStrict == VINF_SUCCESS)
     {
-#ifdef IN_RING3
-        static uint32_t s_cTimes = 0;
-        if (s_cTimes++ < 10)
-            LogRel(("IEM: wrmsr(%#x,%#x`%08x) -> GP(0)\n", pCtx->ecx, uValue.s.Hi, uValue.s.Lo));
-#endif
-        Log(("IEM: wrmsr(%#x,%#x`%08x) -> GP(0)\n", pCtx->ecx, uValue.s.Hi, uValue.s.Lo));
-        AssertMsgReturn(rc == VERR_CPUM_RAISE_GP_0, ("%Rrc\n", rc), VERR_IPE_UNEXPECTED_STATUS);
-        return iemRaiseGeneralProtectionFault0(pIemCpu);
+        iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
+        return VINF_SUCCESS;
     }
 
-    iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
-    return VINF_SUCCESS;
+#ifndef IN_RING3
+    /* Deferred to ring-3. */
+    if (rcStrict == VINF_CPUM_R3_MSR_WRITE)
+    {
+        Log(("IEM: rdmsr(%#x) -> ring-3\n", pCtx->ecx));
+        return rcStrict;
+    }
+#else /* IN_RING3 */
+    /* Often a unimplemented MSR or MSR bit, so worth logging. */
+    static uint32_t s_cTimes = 0;
+    if (s_cTimes++ < 10)
+        LogRel(("IEM: wrmsr(%#x,%#x`%08x) -> #GP(0)\n", pCtx->ecx, uValue.s.Hi, uValue.s.Lo));
+    else
+#endif
+        Log(("IEM: wrmsr(%#x,%#x`%08x) -> #GP(0)\n", pCtx->ecx, uValue.s.Hi, uValue.s.Lo));
+    AssertMsgReturn(rcStrict == VERR_CPUM_RAISE_GP_0, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), VERR_IPE_UNEXPECTED_STATUS);
+    return iemRaiseGeneralProtectionFault0(pIemCpu);
 }
 
 
@@ -4880,7 +5616,6 @@ IEM_CIMPL_DEF_1(iemCImpl_out_DX_eAX, uint8_t, cbReg)
 IEM_CIMPL_DEF_0(iemCImpl_cli)
 {
     PCPUMCTX        pCtx    = pIemCpu->CTX_SUFF(pCtx);
-    PVMCPU          pVCpu   = IEMCPU_TO_VMCPU(pIemCpu);
     uint32_t        fEfl    = IEMMISC_GET_EFL(pIemCpu, pCtx);
     uint32_t const  fEflOld = fEfl;
     if (pCtx->cr0 & X86_CR0_PE)
@@ -4923,7 +5658,6 @@ IEM_CIMPL_DEF_0(iemCImpl_cli)
 IEM_CIMPL_DEF_0(iemCImpl_sti)
 {
     PCPUMCTX        pCtx    = pIemCpu->CTX_SUFF(pCtx);
-    PVMCPU          pVCpu   = IEMCPU_TO_VMCPU(pIemCpu);
     uint32_t        fEfl    = IEMMISC_GET_EFL(pIemCpu, pCtx);
     uint32_t const  fEflOld = fEfl;
 
@@ -4990,7 +5724,7 @@ IEM_CIMPL_DEF_1(iemCImpl_monitor, uint8_t, iEffSeg)
         Log2(("monitor: CPL != 0\n"));
         return iemRaiseUndefinedOpcode(pIemCpu); /** @todo MSR[0xC0010015].MonMwaitUserEn if we care. */
     }
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_ECX(X86_CPUID_FEATURE_ECX_MONITOR))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fMonitorMWait)
     {
         Log2(("monitor: Not in CPUID\n"));
         return iemRaiseUndefinedOpcode(pIemCpu);
@@ -5046,7 +5780,7 @@ IEM_CIMPL_DEF_0(iemCImpl_mwait)
          *        EFLAGS.VM then.) */
         return iemRaiseUndefinedOpcode(pIemCpu);
     }
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_ECX(X86_CPUID_FEATURE_ECX_MONITOR))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fMonitorMWait)
     {
         Log2(("mwait: Not in CPUID\n"));
         return iemRaiseUndefinedOpcode(pIemCpu);
@@ -5068,7 +5802,7 @@ IEM_CIMPL_DEF_0(iemCImpl_mwait)
         }
         uint32_t fMWaitFeatures = 0;
         uint32_t uIgnore = 0;
-        CPUMGetGuestCpuId(IEMCPU_TO_VMCPU(pIemCpu), 5, &uIgnore, &uIgnore, &fMWaitFeatures, &uIgnore);
+        CPUMGetGuestCpuId(IEMCPU_TO_VMCPU(pIemCpu), 5, 0, &uIgnore, &uIgnore, &fMWaitFeatures, &uIgnore);
         if (    (fMWaitFeatures & (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0))
             !=                    (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0))
         {
@@ -5123,7 +5857,7 @@ IEM_CIMPL_DEF_0(iemCImpl_cpuid)
 {
     PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
 
-    CPUMGetGuestCpuId(IEMCPU_TO_VMCPU(pIemCpu), pCtx->eax, &pCtx->eax, &pCtx->ebx, &pCtx->ecx, &pCtx->edx);
+    CPUMGetGuestCpuId(IEMCPU_TO_VMCPU(pIemCpu), pCtx->eax, pCtx->ecx, &pCtx->eax, &pCtx->ebx, &pCtx->ecx, &pCtx->edx);
     pCtx->rax &= UINT32_C(0xffffffff);
     pCtx->rbx &= UINT32_C(0xffffffff);
     pCtx->rcx &= UINT32_C(0xffffffff);
@@ -5291,6 +6025,81 @@ IEM_CIMPL_DEF_0(iemCImpl_das)
 
 
 /**
+ * Implements 'XGETBV'.
+ */
+IEM_CIMPL_DEF_0(iemCImpl_xgetbv)
+{
+    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
+    if (pCtx->cr4 & X86_CR4_OSXSAVE)
+    {
+        uint32_t uEcx = pCtx->ecx;
+        switch (uEcx)
+        {
+            case 0:
+                break;
+
+            case 1: /** @todo Implement XCR1 support. */
+            default:
+                Log(("xgetbv ecx=%RX32 -> #GP(0)\n", uEcx));
+                return iemRaiseGeneralProtectionFault0(pIemCpu);
+
+        }
+        pCtx->rax = RT_LO_U32(pCtx->aXcr[uEcx]);
+        pCtx->rdx = RT_HI_U32(pCtx->aXcr[uEcx]);
+
+        iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
+        return VINF_SUCCESS;
+    }
+    Log(("xgetbv CR4.OSXSAVE=0 -> UD\n"));
+    return iemRaiseUndefinedOpcode(pIemCpu);
+}
+
+
+/**
+ * Implements 'XSETBV'.
+ */
+IEM_CIMPL_DEF_0(iemCImpl_xsetbv)
+{
+    PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
+    if (pCtx->cr4 & X86_CR4_OSXSAVE)
+    {
+        if (pIemCpu->uCpl == 0)
+        {
+            uint32_t uEcx = pCtx->ecx;
+            uint64_t uNewValue = RT_MAKE_U64(pCtx->eax, pCtx->edx);
+            switch (uEcx)
+            {
+                case 0:
+                {
+                    int rc = CPUMSetGuestXcr0(IEMCPU_TO_VMCPU(pIemCpu), uNewValue);
+                    if (rc == VINF_SUCCESS)
+                        break;
+                    Assert(rc == VERR_CPUM_RAISE_GP_0);
+                    Log(("xsetbv ecx=%RX32 (newvalue=%RX64) -> #GP(0)\n", uEcx, uNewValue));
+                    return iemRaiseGeneralProtectionFault0(pIemCpu);
+                }
+
+                case 1: /** @todo Implement XCR1 support. */
+                default:
+                    Log(("xsetbv ecx=%RX32 (newvalue=%RX64) -> #GP(0)\n", uEcx, uNewValue));
+                    return iemRaiseGeneralProtectionFault0(pIemCpu);
+
+            }
+
+            iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
+            return VINF_SUCCESS;
+        }
+
+        Log(("xsetbv cpl=%u -> GP(0)\n", pIemCpu->uCpl));
+        return iemRaiseGeneralProtectionFault0(pIemCpu);
+    }
+    Log(("xsetbv CR4.OSXSAVE=0 -> UD\n"));
+    return iemRaiseUndefinedOpcode(pIemCpu);
+}
+
+
+
+/**
  * Implements 'FINIT' and 'FNINIT'.
  *
  * @param   fCheckXcpts     Whether to check for umasked pending exceptions or
@@ -5308,31 +6117,17 @@ IEM_CIMPL_DEF_1(iemCImpl_finit, bool, fCheckXcpts)
         return iemRaiseMathFault(pIemCpu);
      */
 
-    if (iemFRegIsFxSaveFormat(pIemCpu))
-    {
-        pCtx->fpu.FCW   = 0x37f;
-        pCtx->fpu.FSW   = 0;
-        pCtx->fpu.FTW   = 0x00;         /* 0 - empty. */
-        pCtx->fpu.FPUDP = 0;
-        pCtx->fpu.DS    = 0; //??
-        pCtx->fpu.Rsrvd2= 0;
-        pCtx->fpu.FPUIP = 0;
-        pCtx->fpu.CS    = 0; //??
-        pCtx->fpu.Rsrvd1= 0;
-        pCtx->fpu.FOP   = 0;
-    }
-    else
-    {
-        PX86FPUSTATE pFpu = (PX86FPUSTATE)&pCtx->fpu;
-        pFpu->FCW       = 0x37f;
-        pFpu->FSW       = 0;
-        pFpu->FTW       = 0xffff;       /* 11 - empty */
-        pFpu->FPUOO     = 0; //??
-        pFpu->FPUOS     = 0; //??
-        pFpu->FPUIP     = 0;
-        pFpu->CS        = 0; //??
-        pFpu->FOP       = 0;
-    }
+    PX86XSAVEAREA pXState = pCtx->CTX_SUFF(pXState);
+    pXState->x87.FCW   = 0x37f;
+    pXState->x87.FSW   = 0;
+    pXState->x87.FTW   = 0x00;         /* 0 - empty. */
+    pXState->x87.FPUDP = 0;
+    pXState->x87.DS    = 0; //??
+    pXState->x87.Rsrvd2= 0;
+    pXState->x87.FPUIP = 0;
+    pXState->x87.CS    = 0; //??
+    pXState->x87.Rsrvd1= 0;
+    pXState->x87.FOP   = 0;
 
     iemHlpUsedFpu(pIemCpu);
     iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
@@ -5368,7 +6163,6 @@ IEM_CIMPL_DEF_3(iemCImpl_fxsave, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, e
             return iemRaiseAlignmentCheckException(pIemCpu);
         return iemRaiseGeneralProtectionFault0(pIemCpu);
     }
-    AssertReturn(iemFRegIsFxSaveFormat(pIemCpu), VERR_IEM_IPE_2);
 
     /*
      * Access the memory.
@@ -5377,7 +6171,8 @@ IEM_CIMPL_DEF_3(iemCImpl_fxsave, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, e
     VBOXSTRICTRC rcStrict = iemMemMap(pIemCpu, &pvMem512, 512, iEffSeg, GCPtrEff, IEM_ACCESS_DATA_W | IEM_ACCESS_PARTIAL_WRITE);
     if (rcStrict != VINF_SUCCESS)
         return rcStrict;
-    PX86FXSTATE pDst = (PX86FXSTATE)pvMem512;
+    PX86FXSTATE  pDst = (PX86FXSTATE)pvMem512;
+    PCX86FXSTATE pSrc = &pCtx->CTX_SUFF(pXState)->x87;
 
     /*
      * Store the registers.
@@ -5386,32 +6181,32 @@ IEM_CIMPL_DEF_3(iemCImpl_fxsave, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, e
      * implementation specific whether MXCSR and XMM0-XMM7 are saved. */
 
     /* common for all formats */
-    pDst->FCW           = pCtx->fpu.FCW;
-    pDst->FSW           = pCtx->fpu.FSW;
-    pDst->FTW           = pCtx->fpu.FTW & UINT16_C(0xff);
-    pDst->FOP           = pCtx->fpu.FOP;
-    pDst->MXCSR         = pCtx->fpu.MXCSR;
-    pDst->MXCSR_MASK    = pCtx->fpu.MXCSR_MASK;
+    pDst->FCW           = pSrc->FCW;
+    pDst->FSW           = pSrc->FSW;
+    pDst->FTW           = pSrc->FTW & UINT16_C(0xff);
+    pDst->FOP           = pSrc->FOP;
+    pDst->MXCSR         = pSrc->MXCSR;
+    pDst->MXCSR_MASK    = pSrc->MXCSR_MASK;
     for (uint32_t i = 0; i < RT_ELEMENTS(pDst->aRegs); i++)
     {
         /** @todo Testcase: What actually happens to the 6 reserved bytes? I'm clearing
          *        them for now... */
-        pDst->aRegs[i].au32[0] = pCtx->fpu.aRegs[i].au32[0];
-        pDst->aRegs[i].au32[1] = pCtx->fpu.aRegs[i].au32[1];
-        pDst->aRegs[i].au32[2] = pCtx->fpu.aRegs[i].au32[2] & UINT32_C(0xffff);
+        pDst->aRegs[i].au32[0] = pSrc->aRegs[i].au32[0];
+        pDst->aRegs[i].au32[1] = pSrc->aRegs[i].au32[1];
+        pDst->aRegs[i].au32[2] = pSrc->aRegs[i].au32[2] & UINT32_C(0xffff);
         pDst->aRegs[i].au32[3] = 0;
     }
 
     /* FPU IP, CS, DP and DS. */
-    pDst->FPUIP  = pCtx->fpu.FPUIP;
-    pDst->CS     = pCtx->fpu.CS;
-    pDst->FPUDP  = pCtx->fpu.FPUDP;
-    pDst->DS     = pCtx->fpu.DS;
+    pDst->FPUIP  = pSrc->FPUIP;
+    pDst->CS     = pSrc->CS;
+    pDst->FPUDP  = pSrc->FPUDP;
+    pDst->DS     = pSrc->DS;
     if (enmEffOpSize == IEMMODE_64BIT)
     {
         /* Save upper 16-bits of FPUIP (IP:CS:Rsvd1) and FPUDP (DP:DS:Rsvd2). */
-        pDst->Rsrvd1 = pCtx->fpu.Rsrvd1;
-        pDst->Rsrvd2 = pCtx->fpu.Rsrvd2;
+        pDst->Rsrvd1 = pSrc->Rsrvd1;
+        pDst->Rsrvd2 = pSrc->Rsrvd2;
         pDst->au32RsrvdForSoftware[0] = 0;
     }
     else
@@ -5428,7 +6223,7 @@ IEM_CIMPL_DEF_3(iemCImpl_fxsave, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE, e
     {
         uint32_t cXmmRegs = enmEffOpSize == IEMMODE_64BIT ? 16 : 8;
         for (uint32_t i = 0; i < cXmmRegs; i++)
-            pDst->aXMM[i] = pCtx->fpu.aXMM[i];
+            pDst->aXMM[i] = pSrc->aXMM[i];
         /** @todo Testcase: What happens to the reserved XMM registers? Untouched,
          *        right? */
     }
@@ -5472,7 +6267,6 @@ IEM_CIMPL_DEF_3(iemCImpl_fxrstor, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE,
             return iemRaiseAlignmentCheckException(pIemCpu);
         return iemRaiseGeneralProtectionFault0(pIemCpu);
     }
-    AssertReturn(iemFRegIsFxSaveFormat(pIemCpu), VERR_IEM_IPE_2);
 
     /*
      * Access the memory.
@@ -5482,12 +6276,13 @@ IEM_CIMPL_DEF_3(iemCImpl_fxrstor, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE,
     if (rcStrict != VINF_SUCCESS)
         return rcStrict;
     PCX86FXSTATE pSrc = (PCX86FXSTATE)pvMem512;
+    PX86FXSTATE  pDst = &pCtx->CTX_SUFF(pXState)->x87;
 
     /*
-     * Check the state for stuff which will GP(0).
+     * Check the state for stuff which will #GP(0).
      */
     uint32_t const fMXCSR      = pSrc->MXCSR;
-    uint32_t const fMXCSR_MASK = pCtx->fpu.MXCSR_MASK ? pCtx->fpu.MXCSR_MASK : UINT32_C(0xffbf);
+    uint32_t const fMXCSR_MASK = pDst->MXCSR_MASK ? pDst->MXCSR_MASK : UINT32_C(0xffbf);
     if (fMXCSR & ~fMXCSR_MASK)
     {
         Log(("fxrstor: MXCSR=%#x (MXCSR_MASK=%#x) -> #GP(0)\n", fMXCSR, fMXCSR_MASK));
@@ -5501,38 +6296,38 @@ IEM_CIMPL_DEF_3(iemCImpl_fxrstor, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE,
      * implementation specific whether MXCSR and XMM0-XMM7 are restored. */
 
     /* common for all formats */
-    pCtx->fpu.FCW       = pSrc->FCW;
-    pCtx->fpu.FSW       = pSrc->FSW;
-    pCtx->fpu.FTW       = pSrc->FTW & UINT16_C(0xff);
-    pCtx->fpu.FOP       = pSrc->FOP;
-    pCtx->fpu.MXCSR     = fMXCSR;
+    pDst->FCW       = pSrc->FCW;
+    pDst->FSW       = pSrc->FSW;
+    pDst->FTW       = pSrc->FTW & UINT16_C(0xff);
+    pDst->FOP       = pSrc->FOP;
+    pDst->MXCSR     = fMXCSR;
     /* (MXCSR_MASK is read-only) */
     for (uint32_t i = 0; i < RT_ELEMENTS(pSrc->aRegs); i++)
     {
-        pCtx->fpu.aRegs[i].au32[0] = pSrc->aRegs[i].au32[0];
-        pCtx->fpu.aRegs[i].au32[1] = pSrc->aRegs[i].au32[1];
-        pCtx->fpu.aRegs[i].au32[2] = pSrc->aRegs[i].au32[2] & UINT32_C(0xffff);
-        pCtx->fpu.aRegs[i].au32[3] = 0;
+        pDst->aRegs[i].au32[0] = pSrc->aRegs[i].au32[0];
+        pDst->aRegs[i].au32[1] = pSrc->aRegs[i].au32[1];
+        pDst->aRegs[i].au32[2] = pSrc->aRegs[i].au32[2] & UINT32_C(0xffff);
+        pDst->aRegs[i].au32[3] = 0;
     }
 
     /* FPU IP, CS, DP and DS. */
     if (pIemCpu->enmCpuMode == IEMMODE_64BIT)
     {
-        pCtx->fpu.FPUIP  = pSrc->FPUIP;
-        pCtx->fpu.CS     = pSrc->CS;
-        pCtx->fpu.Rsrvd1 = pSrc->Rsrvd1;
-        pCtx->fpu.FPUDP  = pSrc->FPUDP;
-        pCtx->fpu.DS     = pSrc->DS;
-        pCtx->fpu.Rsrvd2 = pSrc->Rsrvd2;
+        pDst->FPUIP  = pSrc->FPUIP;
+        pDst->CS     = pSrc->CS;
+        pDst->Rsrvd1 = pSrc->Rsrvd1;
+        pDst->FPUDP  = pSrc->FPUDP;
+        pDst->DS     = pSrc->DS;
+        pDst->Rsrvd2 = pSrc->Rsrvd2;
     }
     else
     {
-        pCtx->fpu.FPUIP  = pSrc->FPUIP;
-        pCtx->fpu.CS     = pSrc->CS;
-        pCtx->fpu.Rsrvd1 = 0;
-        pCtx->fpu.FPUDP  = pSrc->FPUDP;
-        pCtx->fpu.DS     = pSrc->DS;
-        pCtx->fpu.Rsrvd2 = 0;
+        pDst->FPUIP  = pSrc->FPUIP;
+        pDst->CS     = pSrc->CS;
+        pDst->Rsrvd1 = 0;
+        pDst->FPUDP  = pSrc->FPUDP;
+        pDst->DS     = pSrc->DS;
+        pDst->Rsrvd2 = 0;
     }
 
     /* XMM registers. */
@@ -5542,7 +6337,7 @@ IEM_CIMPL_DEF_3(iemCImpl_fxrstor, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE,
     {
         uint32_t cXmmRegs = enmEffOpSize == IEMMODE_64BIT ? 16 : 8;
         for (uint32_t i = 0; i < cXmmRegs; i++)
-            pCtx->fpu.aXMM[i] = pSrc->aXMM[i];
+            pDst->aXMM[i] = pSrc->aXMM[i];
     }
 
     /*
@@ -5566,11 +6361,12 @@ IEM_CIMPL_DEF_3(iemCImpl_fxrstor, uint8_t, iEffSeg, RTGCPTR, GCPtrEff, IEMMODE,
  */
 static void iemCImplCommonFpuStoreEnv(PIEMCPU pIemCpu, IEMMODE enmEffOpSize, RTPTRUNION uPtr, PCCPUMCTX pCtx)
 {
+    PCX86FXSTATE pSrcX87 = &pCtx->CTX_SUFF(pXState)->x87;
     if (enmEffOpSize == IEMMODE_16BIT)
     {
-        uPtr.pu16[0] = pCtx->fpu.FCW;
-        uPtr.pu16[1] = pCtx->fpu.FSW;
-        uPtr.pu16[2] = iemFpuCalcFullFtw(pCtx);
+        uPtr.pu16[0] = pSrcX87->FCW;
+        uPtr.pu16[1] = pSrcX87->FSW;
+        uPtr.pu16[2] = iemFpuCalcFullFtw(pSrcX87);
         if (IEM_IS_REAL_OR_V86_MODE(pIemCpu))
         {
             /** @todo Testcase: How does this work when the FPUIP/CS was saved in
@@ -5578,39 +6374,39 @@ static void iemCImplCommonFpuStoreEnv(PIEMCPU pIemCpu, IEMMODE enmEffOpSize, RTP
              *        versa?  And with 32-bit operand size?  I think CPU is storing the
              *        effective address ((CS << 4) + IP) in the offset register and not
              *        doing any address calculations here. */
-            uPtr.pu16[3] = (uint16_t)pCtx->fpu.FPUIP;
-            uPtr.pu16[4] = ((pCtx->fpu.FPUIP >> 4) & UINT16_C(0xf000)) | pCtx->fpu.FOP;
-            uPtr.pu16[5] = (uint16_t)pCtx->fpu.FPUDP;
-            uPtr.pu16[6] = (pCtx->fpu.FPUDP  >> 4) & UINT16_C(0xf000);
+            uPtr.pu16[3] = (uint16_t)pSrcX87->FPUIP;
+            uPtr.pu16[4] = ((pSrcX87->FPUIP >> 4) & UINT16_C(0xf000)) | pSrcX87->FOP;
+            uPtr.pu16[5] = (uint16_t)pSrcX87->FPUDP;
+            uPtr.pu16[6] = (pSrcX87->FPUDP  >> 4) & UINT16_C(0xf000);
         }
         else
         {
-            uPtr.pu16[3] = pCtx->fpu.FPUIP;
-            uPtr.pu16[4] = pCtx->fpu.CS;
-            uPtr.pu16[5] = pCtx->fpu.FPUDP;
-            uPtr.pu16[6] = pCtx->fpu.DS;
+            uPtr.pu16[3] = pSrcX87->FPUIP;
+            uPtr.pu16[4] = pSrcX87->CS;
+            uPtr.pu16[5] = pSrcX87->FPUDP;
+            uPtr.pu16[6] = pSrcX87->DS;
         }
     }
     else
     {
         /** @todo Testcase: what is stored in the "gray" areas? (figure 8-9 and 8-10) */
-        uPtr.pu16[0*2] = pCtx->fpu.FCW;
-        uPtr.pu16[1*2] = pCtx->fpu.FSW;
-        uPtr.pu16[2*2] = iemFpuCalcFullFtw(pCtx);
+        uPtr.pu16[0*2] = pSrcX87->FCW;
+        uPtr.pu16[1*2] = pSrcX87->FSW;
+        uPtr.pu16[2*2] = iemFpuCalcFullFtw(pSrcX87);
         if (IEM_IS_REAL_OR_V86_MODE(pIemCpu))
         {
-            uPtr.pu16[3*2]  = (uint16_t)pCtx->fpu.FPUIP;
-            uPtr.pu32[4]    = ((pCtx->fpu.FPUIP & UINT32_C(0xffff0000)) >> 4) | pCtx->fpu.FOP;
-            uPtr.pu16[5*2]  = (uint16_t)pCtx->fpu.FPUDP;
-            uPtr.pu32[6]    = (pCtx->fpu.FPUDP  & UINT32_C(0xffff0000)) >> 4;
+            uPtr.pu16[3*2]  = (uint16_t)pSrcX87->FPUIP;
+            uPtr.pu32[4]    = ((pSrcX87->FPUIP & UINT32_C(0xffff0000)) >> 4) | pSrcX87->FOP;
+            uPtr.pu16[5*2]  = (uint16_t)pSrcX87->FPUDP;
+            uPtr.pu32[6]    = (pSrcX87->FPUDP  & UINT32_C(0xffff0000)) >> 4;
         }
         else
         {
-            uPtr.pu32[3]    = pCtx->fpu.FPUIP;
-            uPtr.pu16[4*2]  = pCtx->fpu.CS;
-            uPtr.pu16[4*2+1]= pCtx->fpu.FOP;
-            uPtr.pu32[5]    = pCtx->fpu.FPUDP;
-            uPtr.pu16[6*2]  = pCtx->fpu.DS;
+            uPtr.pu32[3]    = pSrcX87->FPUIP;
+            uPtr.pu16[4*2]  = pSrcX87->CS;
+            uPtr.pu16[4*2+1]= pSrcX87->FOP;
+            uPtr.pu32[5]    = pSrcX87->FPUDP;
+            uPtr.pu16[6*2]  = pSrcX87->DS;
         }
     }
 }
@@ -5624,63 +6420,64 @@ static void iemCImplCommonFpuStoreEnv(PIEMCPU pIemCpu, IEMMODE enmEffOpSize, RTP
  */
 static void iemCImplCommonFpuRestoreEnv(PIEMCPU pIemCpu, IEMMODE enmEffOpSize, RTCPTRUNION uPtr, PCPUMCTX pCtx)
 {
+    PX86FXSTATE pDstX87 = &pCtx->CTX_SUFF(pXState)->x87;
     if (enmEffOpSize == IEMMODE_16BIT)
     {
-        pCtx->fpu.FCW = uPtr.pu16[0];
-        pCtx->fpu.FSW = uPtr.pu16[1];
-        pCtx->fpu.FTW = uPtr.pu16[2];
+        pDstX87->FCW = uPtr.pu16[0];
+        pDstX87->FSW = uPtr.pu16[1];
+        pDstX87->FTW = uPtr.pu16[2];
         if (IEM_IS_REAL_OR_V86_MODE(pIemCpu))
         {
-            pCtx->fpu.FPUIP = uPtr.pu16[3] | ((uint32_t)(uPtr.pu16[4] & UINT16_C(0xf000)) << 4);
-            pCtx->fpu.FPUDP = uPtr.pu16[5] | ((uint32_t)(uPtr.pu16[6] & UINT16_C(0xf000)) << 4);
-            pCtx->fpu.FOP   = uPtr.pu16[4] & UINT16_C(0x07ff);
-            pCtx->fpu.CS    = 0;
-            pCtx->fpu.Rsrvd1= 0;
-            pCtx->fpu.DS    = 0;
-            pCtx->fpu.Rsrvd2= 0;
+            pDstX87->FPUIP = uPtr.pu16[3] | ((uint32_t)(uPtr.pu16[4] & UINT16_C(0xf000)) << 4);
+            pDstX87->FPUDP = uPtr.pu16[5] | ((uint32_t)(uPtr.pu16[6] & UINT16_C(0xf000)) << 4);
+            pDstX87->FOP   = uPtr.pu16[4] & UINT16_C(0x07ff);
+            pDstX87->CS    = 0;
+            pDstX87->Rsrvd1= 0;
+            pDstX87->DS    = 0;
+            pDstX87->Rsrvd2= 0;
         }
         else
         {
-            pCtx->fpu.FPUIP = uPtr.pu16[3];
-            pCtx->fpu.CS    = uPtr.pu16[4];
-            pCtx->fpu.Rsrvd1= 0;
-            pCtx->fpu.FPUDP = uPtr.pu16[5];
-            pCtx->fpu.DS    = uPtr.pu16[6];
-            pCtx->fpu.Rsrvd2= 0;
+            pDstX87->FPUIP = uPtr.pu16[3];
+            pDstX87->CS    = uPtr.pu16[4];
+            pDstX87->Rsrvd1= 0;
+            pDstX87->FPUDP = uPtr.pu16[5];
+            pDstX87->DS    = uPtr.pu16[6];
+            pDstX87->Rsrvd2= 0;
             /** @todo Testcase: Is FOP cleared when doing 16-bit protected mode fldenv? */
         }
     }
     else
     {
-        pCtx->fpu.FCW = uPtr.pu16[0*2];
-        pCtx->fpu.FSW = uPtr.pu16[1*2];
-        pCtx->fpu.FTW = uPtr.pu16[2*2];
+        pDstX87->FCW = uPtr.pu16[0*2];
+        pDstX87->FSW = uPtr.pu16[1*2];
+        pDstX87->FTW = uPtr.pu16[2*2];
         if (IEM_IS_REAL_OR_V86_MODE(pIemCpu))
         {
-            pCtx->fpu.FPUIP = uPtr.pu16[3*2] | ((uPtr.pu32[4] & UINT32_C(0x0ffff000)) << 4);
-            pCtx->fpu.FOP   = uPtr.pu32[4] & UINT16_C(0x07ff);
-            pCtx->fpu.FPUDP = uPtr.pu16[5*2] | ((uPtr.pu32[6] & UINT32_C(0x0ffff000)) << 4);
-            pCtx->fpu.CS    = 0;
-            pCtx->fpu.Rsrvd1= 0;
-            pCtx->fpu.DS    = 0;
-            pCtx->fpu.Rsrvd2= 0;
+            pDstX87->FPUIP = uPtr.pu16[3*2] | ((uPtr.pu32[4] & UINT32_C(0x0ffff000)) << 4);
+            pDstX87->FOP   = uPtr.pu32[4] & UINT16_C(0x07ff);
+            pDstX87->FPUDP = uPtr.pu16[5*2] | ((uPtr.pu32[6] & UINT32_C(0x0ffff000)) << 4);
+            pDstX87->CS    = 0;
+            pDstX87->Rsrvd1= 0;
+            pDstX87->DS    = 0;
+            pDstX87->Rsrvd2= 0;
         }
         else
         {
-            pCtx->fpu.FPUIP = uPtr.pu32[3];
-            pCtx->fpu.CS    = uPtr.pu16[4*2];
-            pCtx->fpu.Rsrvd1= 0;
-            pCtx->fpu.FOP   = uPtr.pu16[4*2+1];
-            pCtx->fpu.FPUDP = uPtr.pu32[5];
-            pCtx->fpu.DS    = uPtr.pu16[6*2];
-            pCtx->fpu.Rsrvd2= 0;
+            pDstX87->FPUIP = uPtr.pu32[3];
+            pDstX87->CS    = uPtr.pu16[4*2];
+            pDstX87->Rsrvd1= 0;
+            pDstX87->FOP   = uPtr.pu16[4*2+1];
+            pDstX87->FPUDP = uPtr.pu32[5];
+            pDstX87->DS    = uPtr.pu16[6*2];
+            pDstX87->Rsrvd2= 0;
         }
     }
 
     /* Make adjustments. */
-    pCtx->fpu.FTW = iemFpuCompressFtw(pCtx->fpu.FTW);
-    pCtx->fpu.FCW &= ~X86_FCW_ZERO_MASK;
-    iemFpuRecalcExceptionStatus(pCtx);
+    pDstX87->FTW = iemFpuCompressFtw(pDstX87->FTW);
+    pDstX87->FCW &= ~X86_FCW_ZERO_MASK;
+    iemFpuRecalcExceptionStatus(pDstX87);
     /** @todo Testcase: Check if ES and/or B are automatically cleared if no
      *        exceptions are pending after loading the saved state? */
 }
@@ -5729,13 +6526,14 @@ IEM_CIMPL_DEF_3(iemCImpl_fnsave, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPT
     if (rcStrict != VINF_SUCCESS)
         return rcStrict;
 
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
     iemCImplCommonFpuStoreEnv(pIemCpu, enmEffOpSize, uPtr, pCtx);
     PRTFLOAT80U paRegs = (PRTFLOAT80U)(uPtr.pu8 + (enmEffOpSize == IEMMODE_16BIT ? 14 : 28));
-    for (uint32_t i = 0; i < RT_ELEMENTS(pCtx->fpu.aRegs); i++)
+    for (uint32_t i = 0; i < RT_ELEMENTS(pFpuCtx->aRegs); i++)
     {
-        paRegs[i].au32[0] = pCtx->fpu.aRegs[i].au32[0];
-        paRegs[i].au32[1] = pCtx->fpu.aRegs[i].au32[1];
-        paRegs[i].au16[4] = pCtx->fpu.aRegs[i].au16[4];
+        paRegs[i].au32[0] = pFpuCtx->aRegs[i].au32[0];
+        paRegs[i].au32[1] = pFpuCtx->aRegs[i].au32[1];
+        paRegs[i].au16[4] = pFpuCtx->aRegs[i].au16[4];
     }
 
     rcStrict = iemMemCommitAndUnmap(pIemCpu, uPtr.pv, IEM_ACCESS_DATA_W | IEM_ACCESS_PARTIAL_WRITE);
@@ -5743,18 +6541,18 @@ IEM_CIMPL_DEF_3(iemCImpl_fnsave, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPT
         return rcStrict;
 
     /*
-     * Re-initialize the FPU.
+     * Re-initialize the FPU context.
      */
-    pCtx->fpu.FCW   = 0x37f;
-    pCtx->fpu.FSW   = 0;
-    pCtx->fpu.FTW   = 0x00;       /* 0 - empty */
-    pCtx->fpu.FPUDP = 0;
-    pCtx->fpu.DS    = 0;
-    pCtx->fpu.Rsrvd2= 0;
-    pCtx->fpu.FPUIP = 0;
-    pCtx->fpu.CS    = 0;
-    pCtx->fpu.Rsrvd1= 0;
-    pCtx->fpu.FOP   = 0;
+    pFpuCtx->FCW   = 0x37f;
+    pFpuCtx->FSW   = 0;
+    pFpuCtx->FTW   = 0x00;       /* 0 - empty */
+    pFpuCtx->FPUDP = 0;
+    pFpuCtx->DS    = 0;
+    pFpuCtx->Rsrvd2= 0;
+    pFpuCtx->FPUIP = 0;
+    pFpuCtx->CS    = 0;
+    pFpuCtx->Rsrvd1= 0;
+    pFpuCtx->FOP   = 0;
 
     iemHlpUsedFpu(pIemCpu);
     iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
@@ -5806,14 +6604,15 @@ IEM_CIMPL_DEF_3(iemCImpl_frstor, IEMMODE, enmEffOpSize, uint8_t, iEffSeg, RTGCPT
     if (rcStrict != VINF_SUCCESS)
         return rcStrict;
 
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
     iemCImplCommonFpuRestoreEnv(pIemCpu, enmEffOpSize, uPtr, pCtx);
     PCRTFLOAT80U paRegs = (PCRTFLOAT80U)(uPtr.pu8 + (enmEffOpSize == IEMMODE_16BIT ? 14 : 28));
-    for (uint32_t i = 0; i < RT_ELEMENTS(pCtx->fpu.aRegs); i++)
+    for (uint32_t i = 0; i < RT_ELEMENTS(pFpuCtx->aRegs); i++)
     {
-        pCtx->fpu.aRegs[i].au32[0] = paRegs[i].au32[0];
-        pCtx->fpu.aRegs[i].au32[1] = paRegs[i].au32[1];
-        pCtx->fpu.aRegs[i].au32[2] = paRegs[i].au16[4];
-        pCtx->fpu.aRegs[i].au32[3] = 0;
+        pFpuCtx->aRegs[i].au32[0] = paRegs[i].au32[0];
+        pFpuCtx->aRegs[i].au32[1] = paRegs[i].au32[1];
+        pFpuCtx->aRegs[i].au32[2] = paRegs[i].au16[4];
+        pFpuCtx->aRegs[i].au32[3] = 0;
     }
 
     rcStrict = iemMemCommitAndUnmap(pIemCpu, (void *)uPtr.pv, IEM_ACCESS_DATA_R);
@@ -5840,8 +6639,9 @@ IEM_CIMPL_DEF_1(iemCImpl_fldcw, uint16_t, u16Fcw)
      *        (other than 6 and 7).  Currently ignoring them. */
     /** @todo Testcase: Test that it raises and loweres the FPU exception bits
      *        according to FSW. (This is was is currently implemented.) */
-    pCtx->fpu.FCW = u16Fcw & ~X86_FCW_ZERO_MASK;
-    iemFpuRecalcExceptionStatus(pCtx);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    pFpuCtx->FCW = u16Fcw & ~X86_FCW_ZERO_MASK;
+    iemFpuRecalcExceptionStatus(pFpuCtx);
 
     /* Note: C0, C1, C2 and C3 are documented as undefined, we leave them untouched! */
     iemHlpUsedFpu(pIemCpu);
@@ -5860,39 +6660,40 @@ IEM_CIMPL_DEF_1(iemCImpl_fxch_underflow, uint8_t, iStReg)
 {
     PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);
 
-    unsigned const iReg1 = X86_FSW_TOP_GET(pCtx->fpu.FSW);
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    unsigned const iReg1 = X86_FSW_TOP_GET(pFpuCtx->FSW);
     unsigned const iReg2 = (iReg1 + iStReg) & X86_FSW_TOP_SMASK;
-    Assert(!(RT_BIT(iReg1) & pCtx->fpu.FTW) || !(RT_BIT(iReg2) & pCtx->fpu.FTW));
+    Assert(!(RT_BIT(iReg1) & pFpuCtx->FTW) || !(RT_BIT(iReg2) & pFpuCtx->FTW));
 
     /** @todo Testcase: fxch underflow. Making assumptions that underflowed
      *        registers are read as QNaN and then exchanged. This could be
      *        wrong... */
-    if (pCtx->fpu.FCW & X86_FCW_IM)
+    if (pFpuCtx->FCW & X86_FCW_IM)
     {
-        if (RT_BIT(iReg1) & pCtx->fpu.FTW)
+        if (RT_BIT(iReg1) & pFpuCtx->FTW)
         {
-            if (RT_BIT(iReg2) & pCtx->fpu.FTW)
-                iemFpuStoreQNan(&pCtx->fpu.aRegs[0].r80);
+            if (RT_BIT(iReg2) & pFpuCtx->FTW)
+                iemFpuStoreQNan(&pFpuCtx->aRegs[0].r80);
             else
-                pCtx->fpu.aRegs[0].r80 = pCtx->fpu.aRegs[iStReg].r80;
-            iemFpuStoreQNan(&pCtx->fpu.aRegs[iStReg].r80);
+                pFpuCtx->aRegs[0].r80 = pFpuCtx->aRegs[iStReg].r80;
+            iemFpuStoreQNan(&pFpuCtx->aRegs[iStReg].r80);
         }
         else
         {
-            pCtx->fpu.aRegs[iStReg].r80 = pCtx->fpu.aRegs[0].r80;
-            iemFpuStoreQNan(&pCtx->fpu.aRegs[0].r80);
+            pFpuCtx->aRegs[iStReg].r80 = pFpuCtx->aRegs[0].r80;
+            iemFpuStoreQNan(&pFpuCtx->aRegs[0].r80);
         }
-        pCtx->fpu.FSW &= ~X86_FSW_C_MASK;
-        pCtx->fpu.FSW |= X86_FSW_C1 | X86_FSW_IE | X86_FSW_SF;
+        pFpuCtx->FSW &= ~X86_FSW_C_MASK;
+        pFpuCtx->FSW |= X86_FSW_C1 | X86_FSW_IE | X86_FSW_SF;
     }
     else
     {
         /* raise underflow exception, don't change anything. */
-        pCtx->fpu.FSW &= ~(X86_FSW_TOP_MASK | X86_FSW_XCPT_MASK);
-        pCtx->fpu.FSW |= X86_FSW_C1 | X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
+        pFpuCtx->FSW &= ~(X86_FSW_TOP_MASK | X86_FSW_XCPT_MASK);
+        pFpuCtx->FSW |= X86_FSW_C1 | X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
     }
 
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
     iemHlpUsedFpu(pIemCpu);
     iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
     return VINF_SUCCESS;
@@ -5914,7 +6715,9 @@ IEM_CIMPL_DEF_3(iemCImpl_fcomi_fucomi, uint8_t, iStReg, PFNIEMAIMPLFPUR80EFL, pf
      */
     if (pCtx->cr0 & (X86_CR0_EM | X86_CR0_TS))
         return iemRaiseDeviceNotAvailable(pIemCpu);
-    uint16_t u16Fsw = pCtx->fpu.FSW;
+
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
+    uint16_t u16Fsw = pFpuCtx->FSW;
     if (u16Fsw & X86_FSW_ES)
         return iemRaiseMathFault(pIemCpu);
 
@@ -5923,31 +6726,33 @@ IEM_CIMPL_DEF_3(iemCImpl_fcomi_fucomi, uint8_t, iStReg, PFNIEMAIMPLFPUR80EFL, pf
      */
     unsigned const iReg1 = X86_FSW_TOP_GET(u16Fsw);
     unsigned const iReg2 = (iReg1 + iStReg) & X86_FSW_TOP_SMASK;
-    if ((pCtx->fpu.FTW & (RT_BIT(iReg1) | RT_BIT(iReg2))) == (RT_BIT(iReg1) | RT_BIT(iReg2)))
+    if ((pFpuCtx->FTW & (RT_BIT(iReg1) | RT_BIT(iReg2))) == (RT_BIT(iReg1) | RT_BIT(iReg2)))
     {
-        uint32_t u32Eflags = pfnAImpl(&pCtx->fpu, &u16Fsw, &pCtx->fpu.aRegs[0].r80, &pCtx->fpu.aRegs[iStReg].r80);
-        pCtx->fpu.FSW &= ~X86_FSW_C1;
-        pCtx->fpu.FSW |= u16Fsw & ~X86_FSW_TOP_MASK;
+        uint32_t u32Eflags = pfnAImpl(pFpuCtx, &u16Fsw, &pFpuCtx->aRegs[0].r80, &pFpuCtx->aRegs[iStReg].r80);
+        NOREF(u32Eflags);
+
+        pFpuCtx->FSW &= ~X86_FSW_C1;
+        pFpuCtx->FSW |= u16Fsw & ~X86_FSW_TOP_MASK;
         if (   !(u16Fsw & X86_FSW_IE)
-            || (pCtx->fpu.FCW & X86_FCW_IM) )
+            || (pFpuCtx->FCW & X86_FCW_IM) )
         {
             pCtx->eflags.u &= ~(X86_EFL_OF | X86_EFL_SF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_PF | X86_EFL_CF);
             pCtx->eflags.u |= pCtx->eflags.u & (X86_EFL_ZF | X86_EFL_PF | X86_EFL_CF);
         }
     }
-    else if (pCtx->fpu.FCW & X86_FCW_IM)
+    else if (pFpuCtx->FCW & X86_FCW_IM)
     {
         /* Masked underflow. */
-        pCtx->fpu.FSW &= ~X86_FSW_C1;
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF;
+        pFpuCtx->FSW &= ~X86_FSW_C1;
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF;
         pCtx->eflags.u &= ~(X86_EFL_OF | X86_EFL_SF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_PF | X86_EFL_CF);
         pCtx->eflags.u |= X86_EFL_ZF | X86_EFL_PF | X86_EFL_CF;
     }
     else
     {
         /* Raise underflow - don't touch EFLAGS or TOP. */
-        pCtx->fpu.FSW &= ~X86_FSW_C1;
-        pCtx->fpu.FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
+        pFpuCtx->FSW &= ~X86_FSW_C1;
+        pFpuCtx->FSW |= X86_FSW_IE | X86_FSW_SF | X86_FSW_ES | X86_FSW_B;
         fPop = false;
     }
 
@@ -5956,12 +6761,12 @@ IEM_CIMPL_DEF_3(iemCImpl_fcomi_fucomi, uint8_t, iStReg, PFNIEMAIMPLFPUR80EFL, pf
      */
     if (fPop)
     {
-        pCtx->fpu.FTW &= ~RT_BIT(iReg1);
-        pCtx->fpu.FSW &= X86_FSW_TOP_MASK;
-        pCtx->fpu.FSW |= ((iReg1 + 7) & X86_FSW_TOP_SMASK) << X86_FSW_TOP_SHIFT;
+        pFpuCtx->FTW &= ~RT_BIT(iReg1);
+        pFpuCtx->FSW &= X86_FSW_TOP_MASK;
+        pFpuCtx->FSW |= ((iReg1 + 7) & X86_FSW_TOP_SMASK) << X86_FSW_TOP_SHIFT;
     }
 
-    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx);
+    iemFpuUpdateOpcodeAndIpWorker(pIemCpu, pCtx, pFpuCtx);
     iemHlpUsedFpu(pIemCpu);
     iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
     return VINF_SUCCESS;
diff --git a/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h b/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h
index a432233..cf7e441 100644
--- a/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h
+++ b/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h
@@ -1066,12 +1066,12 @@ IEM_CIMPL_DEF_1(RT_CONCAT4(iemCImpl_ins_op,OP_SIZE,_addr,ADDR_SIZE), bool, fIoCh
                 pCtx->ADDR_rDI -= OP_SIZE / 8;
             iemRegAddToRipAndClearRF(pIemCpu, cbInstr);
         }
-        /* iemMemMap already check permissions, so this may only be real errors
-           or access handlers medling. The access handler case is going to
+        /* iemMemMap already checked permissions, so this may only be real errors
+           or access handlers meddling. The access handler case is going to
            cause misbehavior if the instruction is re-interpreted or smth. So,
            we fail with an internal error here instead. */
         else
-            AssertLogRelFailedReturn(VERR_IEM_IPE_1);
+            AssertLogRelMsgFailedReturn(("rcStrict2=%Rrc\n", VBOXSTRICTRC_VAL(rcStrict2)), VERR_IEM_IPE_1);
     }
     return rcStrict;
 }
@@ -1227,7 +1227,8 @@ IEM_CIMPL_DEF_1(RT_CONCAT4(iemCImpl_rep_ins_op,OP_SIZE,_addr,ADDR_SIZE), bool, f
 
             *puMem = (OP_TYPE)u32Value;
             VBOXSTRICTRC rcStrict2 = iemMemCommitAndUnmap(pIemCpu, puMem, IEM_ACCESS_DATA_W);
-            AssertLogRelReturn(rcStrict2 == VINF_SUCCESS, VERR_IEM_IPE_1); /* See non-rep version. */
+            AssertLogRelMsgReturn(rcStrict2 == VINF_SUCCESS, ("rcStrict2=%Rrc\n", VBOXSTRICTRC_VAL(rcStrict2)),
+                                  VERR_IEM_IPE_1); /* See non-rep version. */
 
             pCtx->ADDR_rDI = uAddrReg += cbIncr;
             pCtx->ADDR_rCX = --uCounterReg;
diff --git a/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h b/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
index eb9872c..cfbfce4 100644
--- a/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
+++ b/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
@@ -883,18 +883,28 @@ FNIEMOP_DEF_1(iemOp_Grp7_lgdt, uint8_t, bRm)
 }
 
 
-/** Opcode 0x0f 0x01 /2. */
+/** Opcode 0x0f 0x01 0xd0. */
 FNIEMOP_DEF(iemOp_Grp7_xgetbv)
 {
-    AssertFailed();
+    IEMOP_MNEMONIC("xgetbv");
+    if (IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fXSaveRstor)
+    {
+        IEMOP_HLP_DONE_DECODING_NO_LOCK_REPZ_OR_REPNZ_PREFIXES();
+        return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_xgetbv);
+    }
     return IEMOP_RAISE_INVALID_OPCODE();
 }
 
 
-/** Opcode 0x0f 0x01 /2. */
+/** Opcode 0x0f 0x01 0xd1. */
 FNIEMOP_DEF(iemOp_Grp7_xsetbv)
 {
-    AssertFailed();
+    IEMOP_MNEMONIC("xsetbv");
+    if (IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fXSaveRstor)
+    {
+        IEMOP_HLP_DONE_DECODING_NO_LOCK_REPZ_OR_REPNZ_PREFIXES();
+        return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_xsetbv);
+    }
     return IEMOP_RAISE_INVALID_OPCODE();
 }
 
@@ -1222,6 +1232,7 @@ FNIEMOP_DEF_1(iemOpCommonLarLsl_Gv_Ew, bool, fIsLar)
 
                 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0);
                 IEMOP_HLP_DECODED_NL_2(fIsLar ? OP_LAR : OP_LSL, IEMOPFORM_RM_MEM, OP_PARM_Gv, OP_PARM_Ew, DISOPTYPE_DANGEROUS | DISOPTYPE_PRIVILEGED_NOTRAP);
+/** @todo testcase: make sure it's a 16-bit read. */
 
                 IEM_MC_FETCH_MEM_U16(u16Sel, pIemCpu->iEffSeg, GCPtrEffSrc);
                 IEM_MC_REF_GREG_U64(pu64Dst, ((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg);
@@ -1306,8 +1317,7 @@ FNIEMOP_STUB(iemOp_ud2);
 FNIEMOP_DEF(iemOp_nop_Ev_GrpP)
 {
     /* AMD prefetch group, Intel implements this as NOP Ev (and so do we). */
-    if (!IEM_IS_AMD_CPUID_FEATURES_ANY_PRESENT(X86_CPUID_EXT_FEATURE_EDX_LONG_MODE | X86_CPUID_AMD_FEATURE_EDX_3DNOW,
-                                               X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->f3DNowPrefetch)
     {
         IEMOP_MNEMONIC("GrpP");
         return IEMOP_RAISE_INVALID_OPCODE();
@@ -1329,7 +1339,7 @@ FNIEMOP_DEF(iemOp_nop_Ev_GrpP)
         case 6: /* Aliased to /0 for the time being. */
         case 7: /* Aliased to /0 for the time being. */
         case 0: IEMOP_MNEMONIC("prefetch"); break;
-        case 1: IEMOP_MNEMONIC("prefetchw "); break;
+        case 1: IEMOP_MNEMONIC("prefetchw"); break;
         case 3: IEMOP_MNEMONIC("prefetchw"); break;
         IEM_NOT_REACHED_DEFAULT_CASE_RET();
     }
@@ -1424,7 +1434,7 @@ FNIEMOP_STUB(iemOp_3Dnow_pavgusb_PQ_Qq);
 /** Opcode 0x0f 0x0f. */
 FNIEMOP_DEF(iemOp_3Dnow)
 {
-    if (!IEM_IS_AMD_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_AMD_FEATURE_EDX_3DNOW))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->f3DNow)
     {
         IEMOP_MNEMONIC("3Dnow");
         return IEMOP_RAISE_INVALID_OPCODE();
@@ -1554,7 +1564,7 @@ FNIEMOP_DEF(iemOp_mov_Rd_Cd)
     if (pIemCpu->fPrefixes & IEM_OP_PRF_LOCK)
     {
         /* The lock prefix can be used to encode CR8 accesses on some CPUs. */
-        if (!IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX(X86_CPUID_AMD_FEATURE_ECX_CR8L))
+        if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fMovCr8In32Bit)
             return IEMOP_RAISE_INVALID_OPCODE(); /* #UD takes precedence over #GP(), see test. */
         iCrReg |= 8;
     }
@@ -1600,7 +1610,7 @@ FNIEMOP_DEF(iemOp_mov_Cd_Rd)
     if (pIemCpu->fPrefixes & IEM_OP_PRF_LOCK)
     {
         /* The lock prefix can be used to encode CR8 accesses on some CPUs. */
-        if (!IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX(X86_CPUID_AMD_FEATURE_ECX_CR8L))
+        if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fMovCr8In32Bit)
             return IEMOP_RAISE_INVALID_OPCODE(); /* #UD takes precedence over #GP(), see test. */
         iCrReg |= 8;
     }
@@ -4458,6 +4468,8 @@ FNIEMOP_DEF_1(iemOpCommonBit_Ev_Gv, PCIEMOPBINSIZES, pImpl)
             fAccess = IEM_ACCESS_DATA_R;
         }
 
+        NOREF(fAccess);
+
         /** @todo test negative bit offsets! */
         switch (pIemCpu->enmEffOpSize)
         {
@@ -4920,7 +4932,7 @@ FNIEMOP_DEF(iemOp_shrd_Ev_Gv_CL)
 FNIEMOP_DEF_1(iemOp_Grp15_fxsave,   uint8_t, bRm)
 {
     IEMOP_MNEMONIC("fxsave m512");
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_FXSR))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fFxSaveRstor)
         return IEMOP_RAISE_INVALID_OPCODE();
 
     IEM_MC_BEGIN(3, 1);
@@ -4940,7 +4952,7 @@ FNIEMOP_DEF_1(iemOp_Grp15_fxsave,   uint8_t, bRm)
 FNIEMOP_DEF_1(iemOp_Grp15_fxrstor,  uint8_t, bRm)
 {
     IEMOP_MNEMONIC("fxrstor m512");
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_FXSR))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fFxSaveRstor)
         return IEMOP_RAISE_INVALID_OPCODE();
 
     IEM_MC_BEGIN(3, 1);
@@ -4980,11 +4992,11 @@ FNIEMOP_DEF_1(iemOp_Grp15_lfence,   uint8_t, bRm)
 {
     IEMOP_MNEMONIC("lfence");
     IEMOP_HLP_NO_LOCK_PREFIX();
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE2))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fSse2)
         return IEMOP_RAISE_INVALID_OPCODE();
 
     IEM_MC_BEGIN(0, 0);
-    if (IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(X86_CPUID_FEATURE_EDX_SSE2))
+    if (IEM_GET_HOST_CPU_FEATURES(pIemCpu)->fSse2)
         IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_lfence);
     else
         IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_alt_mem_fence);
@@ -4999,11 +5011,11 @@ FNIEMOP_DEF_1(iemOp_Grp15_mfence,   uint8_t, bRm)
 {
     IEMOP_MNEMONIC("mfence");
     IEMOP_HLP_NO_LOCK_PREFIX();
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE2))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fSse2)
         return IEMOP_RAISE_INVALID_OPCODE();
 
     IEM_MC_BEGIN(0, 0);
-    if (IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(X86_CPUID_FEATURE_EDX_SSE2))
+    if (IEM_GET_HOST_CPU_FEATURES(pIemCpu)->fSse2)
         IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_mfence);
     else
         IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_alt_mem_fence);
@@ -5018,11 +5030,11 @@ FNIEMOP_DEF_1(iemOp_Grp15_sfence,   uint8_t, bRm)
 {
     IEMOP_MNEMONIC("sfence");
     IEMOP_HLP_NO_LOCK_PREFIX();
-    if (!IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE2))
+    if (!IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fSse2)
         return IEMOP_RAISE_INVALID_OPCODE();
 
     IEM_MC_BEGIN(0, 0);
-    if (IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(X86_CPUID_FEATURE_EDX_SSE2))
+    if (IEM_GET_HOST_CPU_FEATURES(pIemCpu)->fSse2)
         IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_sfence);
     else
         IEM_MC_CALL_VOID_AIMPL_0(iemAImpl_alt_mem_fence);
@@ -8092,7 +8104,7 @@ FNIEMOP_DEF(iemOp_popa)
 
 
 /** Opcode 0x62. */
-FNIEMOP_STUB(iemOp_bound_Gv_Ma);
+FNIEMOP_STUB(iemOp_bound_Gv_Ma_evex);
 
 
 /** Opcode 0x63 - non-64-bit modes. */
@@ -10258,9 +10270,13 @@ FNIEMOP_DEF_1(iemOp_pop_Ev, uint8_t, bRm)
 FNIEMOP_DEF(iemOp_Grp1A)
 {
     uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm);
-    if ((bRm & X86_MODRM_REG_MASK) != (0 << X86_MODRM_REG_SHIFT)) /* only pop Ev in this group. */
-        return IEMOP_RAISE_INVALID_OPCODE();
-    return FNIEMOP_CALL_1(iemOp_pop_Ev, bRm);
+    if ((bRm & X86_MODRM_REG_MASK) == (0 << X86_MODRM_REG_SHIFT)) /* /0 */
+        return FNIEMOP_CALL_1(iemOp_pop_Ev, bRm);
+
+    /* AMD has defined /1 thru /7 as XOP prefix (similar to three byte VEX). */
+    /** @todo XOP decoding. */
+    IEMOP_MNEMONIC("3-byte-xop");
+    return IEMOP_RAISE_INVALID_OPCODE();
 }
 
 
@@ -10543,7 +10559,7 @@ FNIEMOP_DEF(iemOp_sahf)
     IEMOP_MNEMONIC("sahf");
     IEMOP_HLP_NO_LOCK_PREFIX();
     if (   pIemCpu->enmCpuMode == IEMMODE_64BIT
-        && !IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX(X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF))
+        && !IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fLahfSahf)
         return IEMOP_RAISE_INVALID_OPCODE();
     IEM_MC_BEGIN(0, 2);
     IEM_MC_LOCAL(uint32_t, u32Flags);
@@ -10567,7 +10583,7 @@ FNIEMOP_DEF(iemOp_lahf)
     IEMOP_MNEMONIC("lahf");
     IEMOP_HLP_NO_LOCK_PREFIX();
     if (   pIemCpu->enmCpuMode == IEMMODE_64BIT
-        && !IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX(X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF))
+        && !IEM_GET_GUEST_CPU_FEATURES(pIemCpu)->fLahfSahf)
         return IEMOP_RAISE_INVALID_OPCODE();
     IEM_MC_BEGIN(0, 1);
     IEM_MC_LOCAL(uint8_t, u8Flags);
@@ -11966,7 +11982,7 @@ FNIEMOP_DEF(iemOp_retn)
 
 
 /** Opcode 0xc4. */
-FNIEMOP_DEF(iemOp_les_Gv_Mp)
+FNIEMOP_DEF(iemOp_les_Gv_Mp_vex2)
 {
     uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm);
     if (   pIemCpu->enmCpuMode == IEMMODE_64BIT
@@ -11988,23 +12004,41 @@ FNIEMOP_DEF(iemOp_les_Gv_Mp)
 
 
 /** Opcode 0xc5. */
-FNIEMOP_DEF(iemOp_lds_Gv_Mp)
+FNIEMOP_DEF(iemOp_lds_Gv_Mp_vex3)
 {
+    /* The LDS instruction is invalid 64-bit mode. In legacy and
+       compatability mode it is invalid with MOD=3.
+       The use as a VEX prefix is made possible by assigning the inverted
+       REX.R and REX.X to the two MOD bits, since the REX bits are ignored
+       outside of 64-bit mode.  VEX is not available in real or v86 mode. */
     uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm);
-    if (   pIemCpu->enmCpuMode == IEMMODE_64BIT
-        || (bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT))
+    if (pIemCpu->enmCpuMode != IEMMODE_64BIT)
     {
-        IEMOP_MNEMONIC("3-byte-vex");
-        /* The LDS instruction is invalid 64-bit mode. In legacy and
-           compatability mode it is invalid with MOD=3.
-           The use as a VEX prefix is made possible by assigning the inverted
-           REX.R and REX.X to the two MOD bits, since the REX bits are ignored
-           outside of 64-bit mode. */
-        /** @todo VEX: Just use new tables for it. */
-        return IEMOP_RAISE_INVALID_OPCODE();
+        if ((bRm & X86_MODRM_MOD_MASK) != (3 << X86_MODRM_MOD_SHIFT))
+        {
+            IEMOP_MNEMONIC("lds Gv,Mp");
+            return FNIEMOP_CALL_2(iemOpCommonLoadSRegAndGreg, X86_SREG_DS, bRm);
+        }
+        IEMOP_HLP_NO_REAL_OR_V86_MODE();
     }
-    IEMOP_MNEMONIC("lds Gv,Mp");
-    return FNIEMOP_CALL_2(iemOpCommonLoadSRegAndGreg, X86_SREG_DS, bRm);
+
+    IEMOP_MNEMONIC("3-byte-vex");
+    /** @todo Test when exctly the VEX conformance checks kick in during
+     * instruction decoding and fetching (using \#PF). */
+    uint8_t bVex1;   IEM_OPCODE_GET_NEXT_U8(&bVex1);
+    uint8_t bVex2;   IEM_OPCODE_GET_NEXT_U8(&bVex2);
+    uint8_t bOpcode; IEM_OPCODE_GET_NEXT_U8(&bOpcode);
+#if 0 /* will make sense of this next week... */
+    if (   !(pIemCpu->fPrefixes & (IEM_OP_PRF_REPNZ | IEM_OP_PRF_REPZ | IEM_OP_PRF_REPZ | IEM_OP_PRF_SIZE_OP | IEM_OP_PRF_REX))
+        &&
+        )
+    {
+
+    }
+#endif
+
+    /** @todo VEX: Just use new tables for it. */
+    return IEMOP_RAISE_INVALID_OPCODE();
 }
 
 
@@ -12186,6 +12220,9 @@ FNIEMOP_DEF(iemOp_int_Ib)
 /** Opcode 0xce. */
 FNIEMOP_DEF(iemOp_into)
 {
+    IEMOP_MNEMONIC("into");
+    IEMOP_HLP_NO_64BIT();
+
     IEM_MC_BEGIN(2, 0);
     IEM_MC_ARG_CONST(uint8_t,   u8Int,      /*=*/ X86_XCPT_OF, 0);
     IEM_MC_ARG_CONST(bool,      fIsBpInstr, /*=*/ false, 1);
@@ -12612,6 +12649,26 @@ FNIEMOP_DEF(iemOp_aad_Ib)
 }
 
 
+/** Opcode 0xd6. */
+FNIEMOP_DEF(iemOp_salc)
+{
+    IEMOP_MNEMONIC("salc");
+    uint8_t bImm; IEM_OPCODE_GET_NEXT_U8(&bImm);
+    IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
+    IEMOP_HLP_NO_64BIT();
+
+    IEM_MC_BEGIN(0, 0);
+    IEM_MC_IF_EFL_BIT_SET(X86_EFL_CF) {
+        IEM_MC_STORE_GREG_U8_CONST(X86_GREG_xAX, 0xff);
+    } IEM_MC_ELSE() {
+        IEM_MC_STORE_GREG_U8_CONST(X86_GREG_xAX, 0x00);
+    } IEM_MC_ENDIF();
+    IEM_MC_ADVANCE_RIP();
+    IEM_MC_END();
+    return VINF_SUCCESS;
+}
+
+
 /** Opcode 0xd7. */
 FNIEMOP_DEF(iemOp_xlat)
 {
@@ -13189,7 +13246,7 @@ FNIEMOP_DEF_1(iemOp_fnstcw, uint8_t, bRm)
 }
 
 
-/** Opcode 0xd9 0xc9, 0xd9 0xd8-0xdf, ++?.  */
+/** Opcode 0xd9 0xd0, 0xd9 0xd8-0xdf, ++?.  */
 FNIEMOP_DEF(iemOp_fnop)
 {
     IEMOP_MNEMONIC("fnop");
@@ -13759,7 +13816,7 @@ FNIEMOP_DEF(iemOp_EscF1)
             case 0: return FNIEMOP_CALL_1(iemOp_fld_stN, bRm);
             case 1: return FNIEMOP_CALL_1(iemOp_fxch_stN, bRm);
             case 2:
-                if (bRm == 0xc9)
+                if (bRm == 0xd0)
                     return FNIEMOP_CALL(iemOp_fnop);
                 return IEMOP_RAISE_INVALID_OPCODE();
             case 3: return FNIEMOP_CALL_1(iemOp_fstp_stN, bRm); /* Reserved. Intel behavior seems to be FSTP ST(i) though. */
@@ -15487,7 +15544,36 @@ FNIEMOP_DEF_1(iemOp_fcomip_st0_stN,  uint8_t, bRm)
 
 
 /** Opcode 0xdf !11/0. */
-FNIEMOP_STUB_1(iemOp_fild_m16i,   uint8_t, bRm);
+FNIEMOP_DEF_1(iemOp_fild_m16i, uint8_t, bRm)
+{
+    IEMOP_MNEMONIC("fild m16i");
+
+    IEM_MC_BEGIN(2, 3);
+    IEM_MC_LOCAL(RTGCPTR,                   GCPtrEffSrc);
+    IEM_MC_LOCAL(IEMFPURESULT,              FpuRes);
+    IEM_MC_LOCAL(int16_t,                   i16Val);
+    IEM_MC_ARG_LOCAL_REF(PIEMFPURESULT,     pFpuRes,    FpuRes, 0);
+    IEM_MC_ARG_LOCAL_REF(int16_t const *,   pi16Val,    i16Val, 1);
+
+    IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0);
+    IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
+
+    IEM_MC_MAYBE_RAISE_DEVICE_NOT_AVAILABLE();
+    IEM_MC_MAYBE_RAISE_FPU_XCPT();
+    IEM_MC_FETCH_MEM_I16(i16Val, pIemCpu->iEffSeg, GCPtrEffSrc);
+
+    IEM_MC_IF_FPUREG_IS_EMPTY(7)
+        IEM_MC_CALL_FPU_AIMPL_2(iemAImpl_fild_i16_to_r80, pFpuRes, pi16Val);
+        IEM_MC_PUSH_FPU_RESULT_MEM_OP(FpuRes, pIemCpu->iEffSeg, GCPtrEffSrc);
+    IEM_MC_ELSE()
+        IEM_MC_FPU_STACK_PUSH_OVERFLOW_MEM_OP(pIemCpu->iEffSeg, GCPtrEffSrc);
+    IEM_MC_ENDIF();
+    IEM_MC_USED_FPU();
+    IEM_MC_ADVANCE_RIP();
+
+    IEM_MC_END();
+    return VINF_SUCCESS;
+}
 
 
 /** Opcode 0xdf !11/1. */
@@ -15601,8 +15687,39 @@ FNIEMOP_DEF_1(iemOp_fistp_m16i,  uint8_t, bRm)
 /** Opcode 0xdf !11/4. */
 FNIEMOP_STUB_1(iemOp_fbld_m80d,   uint8_t, bRm);
 
+
 /** Opcode 0xdf !11/5. */
-FNIEMOP_STUB_1(iemOp_fild_m64i,   uint8_t, bRm);
+FNIEMOP_DEF_1(iemOp_fild_m64i,   uint8_t, bRm)
+{
+    IEMOP_MNEMONIC("fild m64i");
+
+    IEM_MC_BEGIN(2, 3);
+    IEM_MC_LOCAL(RTGCPTR,                   GCPtrEffSrc);
+    IEM_MC_LOCAL(IEMFPURESULT,              FpuRes);
+    IEM_MC_LOCAL(int64_t,                   i64Val);
+    IEM_MC_ARG_LOCAL_REF(PIEMFPURESULT,     pFpuRes,    FpuRes, 0);
+    IEM_MC_ARG_LOCAL_REF(int64_t const *,   pi64Val,    i64Val, 1);
+
+    IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 0);
+    IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX();
+
+    IEM_MC_MAYBE_RAISE_DEVICE_NOT_AVAILABLE();
+    IEM_MC_MAYBE_RAISE_FPU_XCPT();
+    IEM_MC_FETCH_MEM_I64(i64Val, pIemCpu->iEffSeg, GCPtrEffSrc);
+
+    IEM_MC_IF_FPUREG_IS_EMPTY(7)
+        IEM_MC_CALL_FPU_AIMPL_2(iemAImpl_fild_i64_to_r80, pFpuRes, pi64Val);
+        IEM_MC_PUSH_FPU_RESULT_MEM_OP(FpuRes, pIemCpu->iEffSeg, GCPtrEffSrc);
+    IEM_MC_ELSE()
+        IEM_MC_FPU_STACK_PUSH_OVERFLOW_MEM_OP(pIemCpu->iEffSeg, GCPtrEffSrc);
+    IEM_MC_ENDIF();
+    IEM_MC_USED_FPU();
+    IEM_MC_ADVANCE_RIP();
+
+    IEM_MC_END();
+    return VINF_SUCCESS;
+}
+
 
 /** Opcode 0xdf !11/6. */
 FNIEMOP_STUB_1(iemOp_fbstp_m80d,  uint8_t, bRm);
@@ -16080,6 +16197,15 @@ FNIEMOP_DEF(iemOp_lock)
 }
 
 
+/** Opcode 0xf1. */
+FNIEMOP_DEF(iemOp_int_1)
+{
+    IEMOP_MNEMONIC("int1"); /* icebp */
+    /** @todo testcase! */
+    return IEM_MC_DEFER_TO_CIMPL_2(iemCImpl_int, X86_XCPT_DB, false /*fIsBpInstr*/);
+}
+
+
 /** Opcode 0xf2. */
 FNIEMOP_DEF(iemOp_repne)
 {
@@ -17205,7 +17331,7 @@ const PFNIEMOP g_apfnOneByteMap[256] =
     /* 0x54 */  iemOp_push_eSP,         iemOp_push_eBP,         iemOp_push_eSI,         iemOp_push_eDI,
     /* 0x58 */  iemOp_pop_eAX,          iemOp_pop_eCX,          iemOp_pop_eDX,          iemOp_pop_eBX,
     /* 0x5c */  iemOp_pop_eSP,          iemOp_pop_eBP,          iemOp_pop_eSI,          iemOp_pop_eDI,
-    /* 0x60 */  iemOp_pusha,            iemOp_popa,             iemOp_bound_Gv_Ma,      iemOp_arpl_Ew_Gw_movsx_Gv_Ev,
+    /* 0x60 */  iemOp_pusha,            iemOp_popa,             iemOp_bound_Gv_Ma_evex, iemOp_arpl_Ew_Gw_movsx_Gv_Ev,
     /* 0x64 */  iemOp_seg_FS,           iemOp_seg_GS,           iemOp_op_size,          iemOp_addr_size,
     /* 0x68 */  iemOp_push_Iz,          iemOp_imul_Gv_Ev_Iz,    iemOp_push_Ib,          iemOp_imul_Gv_Ev_Ib,
     /* 0x6c */  iemOp_insb_Yb_DX,       iemOp_inswd_Yv_DX,      iemOp_outsb_Yb_DX,      iemOp_outswd_Yv_DX,
@@ -17230,18 +17356,18 @@ const PFNIEMOP g_apfnOneByteMap[256] =
     /* 0xb8 */  iemOp_eAX_Iv,           iemOp_eCX_Iv,           iemOp_eDX_Iv,           iemOp_eBX_Iv,
     /* 0xbc */  iemOp_eSP_Iv,           iemOp_eBP_Iv,           iemOp_eSI_Iv,           iemOp_eDI_Iv,
     /* 0xc0 */  iemOp_Grp2_Eb_Ib,       iemOp_Grp2_Ev_Ib,       iemOp_retn_Iw,          iemOp_retn,
-    /* 0xc4 */  iemOp_les_Gv_Mp,        iemOp_lds_Gv_Mp,        iemOp_Grp11_Eb_Ib,      iemOp_Grp11_Ev_Iz,
+    /* 0xc4 */  iemOp_les_Gv_Mp_vex2,   iemOp_lds_Gv_Mp_vex3,   iemOp_Grp11_Eb_Ib,      iemOp_Grp11_Ev_Iz,
     /* 0xc8 */  iemOp_enter_Iw_Ib,      iemOp_leave,            iemOp_retf_Iw,          iemOp_retf,
     /* 0xcc */  iemOp_int_3,            iemOp_int_Ib,           iemOp_into,             iemOp_iret,
     /* 0xd0 */  iemOp_Grp2_Eb_1,        iemOp_Grp2_Ev_1,        iemOp_Grp2_Eb_CL,       iemOp_Grp2_Ev_CL,
-    /* 0xd4 */  iemOp_aam_Ib,           iemOp_aad_Ib,           iemOp_Invalid,          iemOp_xlat,
+    /* 0xd4 */  iemOp_aam_Ib,           iemOp_aad_Ib,           iemOp_salc,             iemOp_xlat,
     /* 0xd8 */  iemOp_EscF0,            iemOp_EscF1,            iemOp_EscF2,            iemOp_EscF3,
     /* 0xdc */  iemOp_EscF4,            iemOp_EscF5,            iemOp_EscF6,            iemOp_EscF7,
     /* 0xe0 */  iemOp_loopne_Jb,        iemOp_loope_Jb,         iemOp_loop_Jb,          iemOp_jecxz_Jb,
     /* 0xe4 */  iemOp_in_AL_Ib,         iemOp_in_eAX_Ib,        iemOp_out_Ib_AL,        iemOp_out_Ib_eAX,
     /* 0xe8 */  iemOp_call_Jv,          iemOp_jmp_Jv,           iemOp_jmp_Ap,           iemOp_jmp_Jb,
     /* 0xec */  iemOp_in_AL_DX,         iemOp_eAX_DX,           iemOp_out_DX_AL,        iemOp_out_DX_eAX,
-    /* 0xf0 */  iemOp_lock,             iemOp_Invalid,          iemOp_repne,            iemOp_repe, /** @todo 0xf1 is INT1 / ICEBP. */
+    /* 0xf0 */  iemOp_lock,             iemOp_int_1,            iemOp_repne,            iemOp_repe,
     /* 0xf4 */  iemOp_hlt,              iemOp_cmc,              iemOp_Grp3_Eb,          iemOp_Grp3_Ev,
     /* 0xf8 */  iemOp_clc,              iemOp_stc,              iemOp_cli,              iemOp_sti,
     /* 0xfc */  iemOp_cld,              iemOp_std,              iemOp_Grp4,             iemOp_Grp5,
diff --git a/src/VBox/VMM/VMMAll/IOMAll.cpp b/src/VBox/VMM/VMMAll/IOMAll.cpp
index 06f7b0c..5b20cdb 100644
--- a/src/VBox/VMM/VMMAll/IOMAll.cpp
+++ b/src/VBox/VMM/VMMAll/IOMAll.cpp
@@ -946,7 +946,7 @@ VMMDECL(VBOXSTRICTRC) IOMInterpretIN(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFra
             AssertMsg(rcStrict == VINF_IOM_R3_IOPORT_READ || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     }
     else
-        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
+        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
 
     return rcStrict;
 }
@@ -999,7 +999,7 @@ VMMDECL(VBOXSTRICTRC) IOMInterpretOUT(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFr
         AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IOM_R3_IOPORT_WRITE || (rcStrict >= VINF_EM_FIRST && rcStrict <= VINF_EM_LAST) || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     }
     else
-        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
+        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     return rcStrict;
 }
 
diff --git a/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp b/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
index 88d2358..a0ff863 100644
--- a/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
+++ b/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
@@ -108,6 +108,8 @@ static VBOXSTRICTRC iomMMIODoComplicatedWrite(PVM pVM, PIOMMMIORANGE pRange, RTG
     if (pRange->fFlags & IOMMMIO_FLAGS_DBGSTOP_ON_COMPLICATED_WRITE)
     {
 # ifdef IN_RING3
+        LogRel(("IOM: Complicated write %#x byte at %RGp to %s, initiating debugger intervention\n", cbValue, GCPhys,
+                R3STRING(pRange->pszDesc)));
         rc = DBGFR3EventSrc(pVM, DBGFEVENT_DEV_STOP, RT_SRC_POS,
                             "Complicated write %#x byte at %RGp to %s\n", cbValue, GCPhys, R3STRING(pRange->pszDesc));
         if (rc == VERR_DBGF_NOT_ATTACHED)
@@ -312,7 +314,7 @@ static int iomMMIODoWrite(PVM pVM, PVMCPU pVCpu, PIOMMMIORANGE pRange, RTGCPHYS
 /**
  * Deals with complicated MMIO reads.
  *
- * Complicatd means unaligned or non-dword/qword align accesses depending on
+ * Complicated means unaligned or non-dword/qword sized accesses depending on
  * the MMIO region's access mode flags.
  *
  * @returns Strict VBox status code. Any EM scheduling status code,
@@ -675,7 +677,7 @@ DECLINLINE(int) iomRamRead(PVMCPU pVCpu, void *pDest, RTGCPTR GCSrc, uint32_t cb
         rc = VINF_IOM_R3_IOPORT_WRITE;
     return rc;
 #else
-    return PGMPhysReadGCPtr(pVCpu, pDest, GCSrc, cb);
+    return PGMPhysReadGCPtr(pVCpu, pDest, GCSrc, cb, PGMACCESSORIGIN_IOM);
 #endif
 }
 
@@ -693,7 +695,7 @@ DECLINLINE(int) iomRamWrite(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, RTGCPTR GCPtrDs
     return PGMPhysInterpretedWriteNoHandlers(pVCpu, pCtxCore, GCPtrDst, pvSrc, cb, false /*fRaiseTrap*/);
 #else
     NOREF(pCtxCore);
-    return PGMPhysWriteGCPtr(pVCpu, GCPtrDst, pvSrc, cb);
+    return PGMPhysWriteGCPtr(pVCpu, GCPtrDst, pvSrc, cb, PGMACCESSORIGIN_IOM);
 #endif
 }
 
@@ -1732,17 +1734,20 @@ static int iomMMIOHandler(PVM pVM, PVMCPU pVCpu, uint32_t uErrorCode, PCPUMCTXCO
  *
  * @returns VBox status code (appropriate for GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode  CPU Error code.
  * @param   pCtxCore    Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   GCPhysFault The GC physical address corresponding to pvFault.
  * @param   pvUser      Pointer to the MMIO ring-3 range entry.
  */
-VMMDECL(int) IOMMMIOHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
+DECLEXPORT(int) iomMmioPfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pCtxCore, RTGCPTR pvFault,
+                                 RTGCPHYS GCPhysFault, void *pvUser)
 {
-    LogFlow(("IOMMMIOHandler: GCPhys=%RGp uErr=%#x pvFault=%RGv rip=%RGv\n",
+    LogFlow(("iomMmioPfHandler: GCPhys=%RGp uErr=%#x pvFault=%RGv rip=%RGv\n",
              GCPhysFault, (uint32_t)uErrorCode, pvFault, (RTGCPTR)pCtxCore->rip));
-    VBOXSTRICTRC rcStrict = iomMMIOHandler(pVM, VMMGetCpu(pVM), (uint32_t)uErrorCode, pCtxCore, GCPhysFault, pvUser);
+    VBOXSTRICTRC rcStrict = iomMMIOHandler(pVM, pVCpu, (uint32_t)uErrorCode, pCtxCore, GCPhysFault, pvUser);
     return VBOXSTRICTRC_VAL(rcStrict);
 }
 
@@ -1782,30 +1787,30 @@ VMMDECL(VBOXSTRICTRC) IOMMMIOPhysHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorC
 }
 
 
-#ifdef IN_RING3
 /**
  * \#PF Handler callback for MMIO ranges.
  *
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           The cross context CPU structure for the calling EMT.
  * @param   GCPhys          The physical address the guest is writing to.
  * @param   pvPhys          The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
+ * @param   enmOrigin       Who is making the access.
  * @param   pvUser          Pointer to the MMIO range entry.
  */
-DECLCALLBACK(int) IOMR3MMIOHandler(PVM pVM, RTGCPHYS GCPhysFault, void *pvPhys, void *pvBuf, size_t cbBuf,
-                                   PGMACCESSTYPE enmAccessType, void *pvUser)
+PGM_ALL_CB2_DECL(int) iomMmioHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhysFault, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                     PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
-    PVMCPU        pVCpu = VMMGetCpu(pVM);
     PIOMMMIORANGE pRange = (PIOMMMIORANGE)pvUser;
     STAM_COUNTER_INC(&pVM->iom.s.StatR3MMIOHandler);
 
     AssertMsg(cbBuf >= 1 && cbBuf <= 16, ("%zu\n", cbBuf));
     AssertPtr(pRange);
-    NOREF(pvPhys);
+    NOREF(pvPhys); NOREF(enmOrigin);
 
     /*
      * Validate the range.
@@ -1840,7 +1845,6 @@ DECLCALLBACK(int) IOMR3MMIOHandler(PVM pVM, RTGCPHYS GCPhysFault, void *pvPhys,
     PDMCritSectLeave(pDevIns->CTX_SUFF(pCritSectRo));
     return rc;
 }
-#endif /* IN_RING3 */
 
 
 /**
@@ -2238,7 +2242,7 @@ VMMDECL(VBOXSTRICTRC) IOMInterpretINS(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFr
     VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);
     if (RT_UNLIKELY(rcStrict != VINF_SUCCESS))
     {
-        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
+        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
         return rcStrict;
     }
 
@@ -2409,7 +2413,7 @@ VMMDECL(VBOXSTRICTRC) IOMInterpretOUTS(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegF
     VBOXSTRICTRC rcStrict = IOMInterpretCheckPortIOAccess(pVM, pRegFrame, Port, cb);
     if (RT_UNLIKELY(rcStrict != VINF_SUCCESS))
     {
-        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
+        AssertMsg(rcStrict == VINF_EM_RAW_GUEST_TRAP || rcStrict == VINF_TRPM_XCPT_DISPATCHED || RT_FAILURE(rcStrict), ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
         return rcStrict;
     }
 
diff --git a/src/VBox/VMM/VMMAll/MMAll.cpp b/src/VBox/VMM/VMMAll/MMAll.cpp
index 88b9c4a..5d5944c 100644
--- a/src/VBox/VMM/VMMAll/MMAll.cpp
+++ b/src/VBox/VMM/VMMAll/MMAll.cpp
@@ -623,6 +623,7 @@ const char *mmGetTagName(MMTAG enmTag)
         TAG2STR(PGM);
         TAG2STR(PGM_CHUNK_MAPPING);
         TAG2STR(PGM_HANDLERS);
+        TAG2STR(PGM_HANDLER_TYPES);
         TAG2STR(PGM_MAPPINGS);
         TAG2STR(PGM_PHYS);
         TAG2STR(PGM_POOL);
diff --git a/src/VBox/VMM/VMMAll/MMAllHyper.cpp b/src/VBox/VMM/VMMAll/MMAllHyper.cpp
index b62dd6d..084875b 100644
--- a/src/VBox/VMM/VMMAll/MMAllHyper.cpp
+++ b/src/VBox/VMM/VMMAll/MMAllHyper.cpp
@@ -341,6 +341,17 @@ VMMDECL(int) MMHyperAlloc(PVM pVM, size_t cb, unsigned uAlignment, MMTAG enmTag,
 
 /**
  * Duplicates a block of memory.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pvSrc       The source memory block to copy from.
+ * @param   cb          Size of the source memory block.
+ * @param   uAlignment  Required memory alignment in bytes.
+ *                      Values are 0,8,16,32,64 and PAGE_SIZE.
+ *                      0 -> default alignment, i.e. 8 bytes.
+ * @param   enmTag      The statistics tag.
+ * @param   ppv         Where to store the address to the allocated
+ *                      memory.
  */
 VMMDECL(int) MMHyperDupMem(PVM pVM, const void *pvSrc, size_t cb, unsigned uAlignment, MMTAG enmTag, void **ppv)
 {
@@ -1247,6 +1258,7 @@ VMMDECL(size_t) MMHyperHeapGetFreeSize(PVM pVM)
     return pVM->mm.s.CTX_SUFF(pHyperHeap)->cbFree;
 }
 
+
 /**
  * Query the size the hypervisor heap.
  *
@@ -1259,6 +1271,35 @@ VMMDECL(size_t) MMHyperHeapGetSize(PVM pVM)
 
 
 /**
+ * Converts a context neutral heap offset into a pointer.
+ *
+ * @returns Pointer to hyper heap data.
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   offHeap     The hyper heap offset.
+ */
+VMMDECL(void *) MMHyperHeapOffsetToPtr(PVM pVM, uint32_t offHeap)
+{
+    Assert(offHeap - MMYPERHEAP_HDR_SIZE <= pVM->mm.s.CTX_SUFF(pHyperHeap)->cbHeap);
+    return (uint8_t *)pVM->mm.s.CTX_SUFF(pHyperHeap) + offHeap;
+}
+
+
+/**
+ * Converts a context specific heap pointer into a neutral heap offset.
+ *
+ * @returns Heap offset.
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   pv          Pointer to the heap data.
+ */
+VMMDECL(uint32_t) MMHyperHeapPtrToOffset(PVM pVM, void *pv)
+{
+    size_t offHeap = (uint8_t *)pv - (uint8_t *)pVM->mm.s.CTX_SUFF(pHyperHeap);
+    Assert(offHeap - MMYPERHEAP_HDR_SIZE <= pVM->mm.s.CTX_SUFF(pHyperHeap)->cbHeap);
+    return (uint32_t)offHeap;
+}
+
+
+/**
  * Query the address and size the hypervisor memory area.
  *
  * @returns Base address of the hypervisor area.
diff --git a/src/VBox/VMM/VMMAll/PATMAll.cpp b/src/VBox/VMM/VMMAll/PATMAll.cpp
index ebd40c4..942e4e5 100644
--- a/src/VBox/VMM/VMMAll/PATMAll.cpp
+++ b/src/VBox/VMM/VMMAll/PATMAll.cpp
@@ -45,10 +45,10 @@
  * IF and IOPL eflags bits, the caller will enforce those to set and 0 respectively.
  *
  * @param   pVM         Pointer to the VM.
- * @param   pCtxCore    The cpu context core.
+ * @param   pCtx        The cpu context.
  * @see     pg_raw
  */
-VMM_INT_DECL(void) PATMRawEnter(PVM pVM, PCPUMCTXCORE pCtxCore)
+VMM_INT_DECL(void) PATMRawEnter(PVM pVM, PCPUMCTX pCtx)
 {
     Assert(!HMIsEnabled(pVM));
 
@@ -56,20 +56,20 @@ VMM_INT_DECL(void) PATMRawEnter(PVM pVM, PCPUMCTXCORE pCtxCore)
      * Currently we don't bother to check whether PATM is enabled or not.
      * For all cases where it isn't, IOPL will be safe and IF will be set.
      */
-    uint32_t efl = pCtxCore->eflags.u32;
+    uint32_t efl = pCtx->eflags.u32;
     CTXSUFF(pVM->patm.s.pGCState)->uVMFlags = efl & PATM_VIRTUAL_FLAGS_MASK;
 
-    AssertMsg((efl & X86_EFL_IF) || PATMShouldUseRawMode(pVM, (RTRCPTR)pCtxCore->eip),
+    AssertMsg((efl & X86_EFL_IF) || PATMShouldUseRawMode(pVM, (RTRCPTR)pCtx->eip),
               ("X86_EFL_IF is clear and PATM is disabled! (eip=%RRv eflags=%08x fPATM=%d pPATMGC=%RRv-%RRv\n",
-               pCtxCore->eip, pCtxCore->eflags.u32, PATMIsEnabled(pVM), pVM->patm.s.pPatchMemGC,
+               pCtx->eip, pCtx->eflags.u32, PATMIsEnabled(pVM), pVM->patm.s.pPatchMemGC,
                pVM->patm.s.pPatchMemGC + pVM->patm.s.cbPatchMem));
 
-    AssertReleaseMsg(CTXSUFF(pVM->patm.s.pGCState)->fPIF || PATMIsPatchGCAddr(pVM, pCtxCore->eip),
-                     ("fPIF=%d eip=%RRv\n", pVM->patm.s.CTXSUFF(pGCState)->fPIF, pCtxCore->eip));
+    AssertReleaseMsg(CTXSUFF(pVM->patm.s.pGCState)->fPIF || PATMIsPatchGCAddr(pVM, pCtx->eip),
+                     ("fPIF=%d eip=%RRv\n", pVM->patm.s.CTXSUFF(pGCState)->fPIF, pCtx->eip));
 
     efl &= ~PATM_VIRTUAL_FLAGS_MASK;
     efl |= X86_EFL_IF;
-    pCtxCore->eflags.u32 = efl;
+    pCtx->eflags.u32 = efl;
 
 #ifdef IN_RING3
 # ifdef PATM_EMULATE_SYSENTER
@@ -120,25 +120,25 @@ VMM_INT_DECL(void) PATMRawEnter(PVM pVM, PCPUMCTXCORE pCtxCore)
  ** @note Only here we are allowed to switch back to guest code (without a special reason such as a trap in patch code)!!
  *
  * @param   pVM         Pointer to the VM.
- * @param   pCtxCore    The cpu context core.
+ * @param   pCtx        The cpu context.
  * @param   rawRC       Raw mode return code
  * @see     @ref pg_raw
  */
-VMM_INT_DECL(void) PATMRawLeave(PVM pVM, PCPUMCTXCORE pCtxCore, int rawRC)
+VMM_INT_DECL(void) PATMRawLeave(PVM pVM, PCPUMCTX pCtx, int rawRC)
 {
     Assert(!HMIsEnabled(pVM));
-    bool fPatchCode = PATMIsPatchGCAddr(pVM, pCtxCore->eip);
+    bool fPatchCode = PATMIsPatchGCAddr(pVM, pCtx->eip);
 
     /*
      * We will only be called if PATMRawEnter was previously called.
      */
-    uint32_t efl = pCtxCore->eflags.u32;
+    uint32_t efl = pCtx->eflags.u32;
     efl = (efl & ~PATM_VIRTUAL_FLAGS_MASK) | (CTXSUFF(pVM->patm.s.pGCState)->uVMFlags & PATM_VIRTUAL_FLAGS_MASK);
-    pCtxCore->eflags.u32 = efl;
+    pCtx->eflags.u32 = efl;
     CTXSUFF(pVM->patm.s.pGCState)->uVMFlags = X86_EFL_IF;
 
-    AssertReleaseMsg((efl & X86_EFL_IF) || fPatchCode || rawRC == VINF_PATM_PENDING_IRQ_AFTER_IRET || RT_FAILURE(rawRC), ("Inconsistent state at %RRv rc=%Rrc\n", pCtxCore->eip, rawRC));
-    AssertReleaseMsg(CTXSUFF(pVM->patm.s.pGCState)->fPIF || fPatchCode || RT_FAILURE(rawRC), ("fPIF=%d eip=%RRv rc=%Rrc\n", CTXSUFF(pVM->patm.s.pGCState)->fPIF, pCtxCore->eip, rawRC));
+    AssertReleaseMsg((efl & X86_EFL_IF) || fPatchCode || rawRC == VINF_PATM_PENDING_IRQ_AFTER_IRET || RT_FAILURE(rawRC), ("Inconsistent state at %RRv rc=%Rrc\n", pCtx->eip, rawRC));
+    AssertReleaseMsg(CTXSUFF(pVM->patm.s.pGCState)->fPIF || fPatchCode || RT_FAILURE(rawRC), ("fPIF=%d eip=%RRv rc=%Rrc\n", CTXSUFF(pVM->patm.s.pGCState)->fPIF, pCtx->eip, rawRC));
 
 #ifdef IN_RING3
     if (   (efl & X86_EFL_IF)
@@ -158,7 +158,7 @@ VMM_INT_DECL(void) PATMRawLeave(PVM pVM, PCPUMCTXCORE pCtxCore, int rawRC)
             if (CTXSUFF(pVM->patm.s.pGCState)->fPIF == 1)            /* consistent patch instruction state */
             {
                 PATMTRANSSTATE  enmState;
-                RTRCPTR         pOrgInstrGC = PATMR3PatchToGCPtr(pVM, pCtxCore->eip, &enmState);
+                RTRCPTR         pOrgInstrGC = PATMR3PatchToGCPtr(pVM, pCtx->eip, &enmState);
 
                 AssertRelease(pOrgInstrGC);
 
@@ -166,22 +166,22 @@ VMM_INT_DECL(void) PATMRawLeave(PVM pVM, PCPUMCTXCORE pCtxCore, int rawRC)
                 if (enmState == PATMTRANS_SAFE)
                 {
                     Assert(!patmFindActivePatchByEntrypoint(pVM, pOrgInstrGC));
-                    Log(("Switchback from %RRv to %RRv (Psp=%x)\n", pCtxCore->eip, pOrgInstrGC, CTXSUFF(pVM->patm.s.pGCState)->Psp));
+                    Log(("Switchback from %RRv to %RRv (Psp=%x)\n", pCtx->eip, pOrgInstrGC, CTXSUFF(pVM->patm.s.pGCState)->Psp));
                     STAM_COUNTER_INC(&pVM->patm.s.StatSwitchBack);
-                    pCtxCore->eip = pOrgInstrGC;
+                    pCtx->eip = pOrgInstrGC;
                     fPatchCode = false; /* to reset the stack ptr */
 
                     CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts = 0;   /* reset this pointer; safe otherwise the state would be PATMTRANS_INHIBITIRQ */
                 }
                 else
                 {
-                    LogFlow(("Patch address %RRv can't be interrupted (state=%d)!\n",  pCtxCore->eip, enmState));
+                    LogFlow(("Patch address %RRv can't be interrupted (state=%d)!\n",  pCtx->eip, enmState));
                     STAM_COUNTER_INC(&pVM->patm.s.StatSwitchBackFail);
                 }
             }
             else
             {
-                LogFlow(("Patch address %RRv can't be interrupted (fPIF=%d)!\n",  pCtxCore->eip, CTXSUFF(pVM->patm.s.pGCState)->fPIF));
+                LogFlow(("Patch address %RRv can't be interrupted (fPIF=%d)!\n",  pCtx->eip, CTXSUFF(pVM->patm.s.pGCState)->fPIF));
                 STAM_COUNTER_INC(&pVM->patm.s.StatSwitchBackFail);
             }
         }
@@ -191,14 +191,14 @@ VMM_INT_DECL(void) PATMRawLeave(PVM pVM, PCPUMCTXCORE pCtxCore, int rawRC)
      * When leaving raw-mode state while IN_RC, it's generally for interpreting
      * a single original guest instruction.
      */
-    AssertMsg(!fPatchCode, ("eip=%RRv\n", pCtxCore->eip));
+    AssertMsg(!fPatchCode, ("eip=%RRv\n", pCtx->eip));
 #endif /* !IN_RING3 */
 
     if (!fPatchCode)
     {
-        if (CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts == (RTRCPTR)pCtxCore->eip)
+        if (CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts == (RTRCPTR)pCtx->eip)
         {
-            EMSetInhibitInterruptsPC(VMMGetCpu0(pVM), pCtxCore->eip);
+            EMSetInhibitInterruptsPC(VMMGetCpu0(pVM), pCtx->eip);
         }
         CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts = 0;
 
@@ -219,12 +219,12 @@ VMM_INT_DECL(void) PATMRawLeave(PVM pVM, PCPUMCTXCORE pCtxCore, int rawRC)
  *
  * @returns The eflags.
  * @param   pVM         Pointer to the VM.
- * @param   pCtxCore    The context core.
+ * @param   pCtx        The guest cpu context.
  */
-VMM_INT_DECL(uint32_t) PATMRawGetEFlags(PVM pVM, PCCPUMCTXCORE pCtxCore)
+VMM_INT_DECL(uint32_t) PATMRawGetEFlags(PVM pVM, PCCPUMCTX pCtx)
 {
     Assert(!HMIsEnabled(pVM));
-    uint32_t efl = pCtxCore->eflags.u32;
+    uint32_t efl = pCtx->eflags.u32;
     efl &= ~PATM_VIRTUAL_FLAGS_MASK;
     efl |= pVM->patm.s.CTXSUFF(pGCState)->uVMFlags & PATM_VIRTUAL_FLAGS_MASK;
     return efl;
@@ -235,16 +235,16 @@ VMM_INT_DECL(uint32_t) PATMRawGetEFlags(PVM pVM, PCCPUMCTXCORE pCtxCore)
  * This is a worker for CPUMRawSetEFlags().
  *
  * @param   pVM         Pointer to the VM.
- * @param   pCtxCore    The context core.
+ * @param   pCtx        The guest cpu context.
  * @param   efl         The new EFLAGS value.
  */
-VMM_INT_DECL(void) PATMRawSetEFlags(PVM pVM, PCPUMCTXCORE pCtxCore, uint32_t efl)
+VMM_INT_DECL(void) PATMRawSetEFlags(PVM pVM, PCPUMCTX pCtx, uint32_t efl)
 {
     Assert(!HMIsEnabled(pVM));
     pVM->patm.s.CTXSUFF(pGCState)->uVMFlags = efl & PATM_VIRTUAL_FLAGS_MASK;
     efl &= ~PATM_VIRTUAL_FLAGS_MASK;
     efl |= X86_EFL_IF;
-    pCtxCore->eflags.u32 = efl;
+    pCtx->eflags.u32 = efl;
 }
 
 /**
@@ -255,8 +255,9 @@ VMM_INT_DECL(void) PATMRawSetEFlags(PVM pVM, PCPUMCTXCORE pCtxCore, uint32_t efl
  */
 VMM_INT_DECL(bool) PATMShouldUseRawMode(PVM pVM, RTRCPTR pAddrGC)
 {
-    return (    PATMIsEnabled(pVM)
-            && ((pAddrGC >= (RTRCPTR)pVM->patm.s.pPatchMemGC && pAddrGC < (RTRCPTR)((RTRCUINTPTR)pVM->patm.s.pPatchMemGC + pVM->patm.s.cbPatchMem)))) ? true : false;
+    return   PATMIsEnabled(pVM)
+          && (   (RTRCUINTPTR)pAddrGC - (RTRCUINTPTR)pVM->patm.s.pPatchMemGC      < pVM->patm.s.cbPatchMem
+              || (RTRCUINTPTR)pAddrGC - (RTRCUINTPTR)pVM->patm.s.pbPatchHelpersRC < pVM->patm.s.cbPatchHelpers);
 }
 
 /**
@@ -272,22 +273,37 @@ VMM_INT_DECL(RCPTRTYPE(PPATMGCSTATE)) PATMGetGCState(PVM pVM)
 }
 
 /**
- * Checks whether the GC address is part of our patch region
+ * Checks whether the GC address is part of our patch or helper regions.
  *
  * @returns VBox status code.
  * @param   pVM         Pointer to the VM.
- * @param   pAddrGC     Guest context address
+ * @param   uGCAddr     Guest context address.
+ * @internal
+ */
+VMMDECL(bool) PATMIsPatchGCAddr(PVM pVM, RTRCUINTPTR uGCAddr)
+{
+    return PATMIsEnabled(pVM)
+        && (   uGCAddr - (RTRCUINTPTR)pVM->patm.s.pPatchMemGC      < pVM->patm.s.cbPatchMem
+            || uGCAddr - (RTRCUINTPTR)pVM->patm.s.pbPatchHelpersRC < pVM->patm.s.cbPatchHelpers);
+}
+
+/**
+ * Checks whether the GC address is part of our patch region.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   uGCAddr     Guest context address.
  * @internal
  */
-VMMDECL(bool) PATMIsPatchGCAddr(PVM pVM, RTRCUINTPTR pAddrGC)
+VMMDECL(bool) PATMIsPatchGCAddrExclHelpers(PVM pVM, RTRCUINTPTR uGCAddr)
 {
-    return (PATMIsEnabled(pVM) && pAddrGC - (RTRCUINTPTR)pVM->patm.s.pPatchMemGC < pVM->patm.s.cbPatchMem) ? true : false;
+    return PATMIsEnabled(pVM)
+        && uGCAddr - (RTRCUINTPTR)pVM->patm.s.pPatchMemGC < pVM->patm.s.cbPatchMem;
 }
 
 /**
  * Reads patch code.
  *
- * @returns
  * @retval  VINF_SUCCESS on success.
  * @retval  VERR_PATCH_NOT_FOUND if the request is entirely outside the patch
  *          code.
@@ -306,19 +322,44 @@ VMM_INT_DECL(int) PATMReadPatchCode(PVM pVM, RTGCPTR GCPtrPatchCode, void *pvDst
         return VERR_PATCH_NOT_FOUND;
     Assert(!HMIsEnabled(pVM));
 
-    RTGCPTR offPatchedInstr = GCPtrPatchCode - (RTGCPTR32)pVM->patm.s.pPatchMemGC;
-    if (offPatchedInstr >= pVM->patm.s.cbPatchMem)
-        return VERR_PATCH_NOT_FOUND;
-
-    uint32_t cbMaxRead = pVM->patm.s.cbPatchMem - (uint32_t)offPatchedInstr;
-    if (cbToRead > cbMaxRead)
-        cbToRead = cbMaxRead;
-
+    /*
+     * Check patch code and patch helper code.  We assume the requested bytes
+     * are not in either.
+     */
+    RTGCPTR offPatchCode = GCPtrPatchCode - (RTGCPTR32)pVM->patm.s.pPatchMemGC;
+    if (offPatchCode >= pVM->patm.s.cbPatchMem)
+    {
+        offPatchCode = GCPtrPatchCode - (RTGCPTR32)pVM->patm.s.pbPatchHelpersRC;
+        if (offPatchCode >= pVM->patm.s.cbPatchHelpers)
+            return VERR_PATCH_NOT_FOUND;
+
+        /*
+         * Patch helper memory.
+         */
+        uint32_t cbMaxRead = pVM->patm.s.cbPatchHelpers - (uint32_t)offPatchCode;
+        if (cbToRead > cbMaxRead)
+            cbToRead = cbMaxRead;
+#ifdef IN_RC
+        memcpy(pvDst, pVM->patm.s.pbPatchHelpersRC + (uint32_t)offPatchCode, cbToRead);
+#else
+        memcpy(pvDst, pVM->patm.s.pbPatchHelpersR3 + (uint32_t)offPatchCode, cbToRead);
+#endif
+    }
+    else
+    {
+        /*
+         * Patch memory.
+         */
+        uint32_t cbMaxRead = pVM->patm.s.cbPatchMem - (uint32_t)offPatchCode;
+        if (cbToRead > cbMaxRead)
+            cbToRead = cbMaxRead;
 #ifdef IN_RC
-    memcpy(pvDst, pVM->patm.s.pPatchMemGC + (uint32_t)offPatchedInstr, cbToRead);
+        memcpy(pvDst, pVM->patm.s.pPatchMemGC + (uint32_t)offPatchCode, cbToRead);
 #else
-    memcpy(pvDst, pVM->patm.s.pPatchMemHC + (uint32_t)offPatchedInstr, cbToRead);
+        memcpy(pvDst, pVM->patm.s.pPatchMemHC + (uint32_t)offPatchCode, cbToRead);
 #endif
+    }
+
     if (pcbRead)
         *pcbRead = cbToRead;
     return VINF_SUCCESS;
@@ -356,7 +397,7 @@ VMM_INT_DECL(bool) PATMAreInterruptsEnabled(PVM pVM)
 {
     PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(VMMGetCpu(pVM));
 
-    return PATMAreInterruptsEnabledByCtxCore(pVM, CPUMCTX2CORE(pCtx));
+    return PATMAreInterruptsEnabledByCtx(pVM, pCtx);
 }
 
 /**
@@ -366,18 +407,18 @@ VMM_INT_DECL(bool) PATMAreInterruptsEnabled(PVM pVM)
  * @returns false if it's disabled.
  *
  * @param   pVM         Pointer to the VM.
- * @param   pCtxCore    CPU context
+ * @param   pCtx        The guest CPU context.
  * @todo CPUM should wrap this, EM.cpp shouldn't call us.
  */
-VMM_INT_DECL(bool) PATMAreInterruptsEnabledByCtxCore(PVM pVM, PCPUMCTXCORE pCtxCore)
+VMM_INT_DECL(bool) PATMAreInterruptsEnabledByCtx(PVM pVM, PCPUMCTX pCtx)
 {
     if (PATMIsEnabled(pVM))
     {
         Assert(!HMIsEnabled(pVM));
-        if (PATMIsPatchGCAddr(pVM, pCtxCore->eip))
+        if (PATMIsPatchGCAddr(pVM, pCtx->eip))
             return false;
     }
-    return !!(pCtxCore->eflags.u32 & X86_EFL_IF);
+    return !!(pCtx->eflags.u32 & X86_EFL_IF);
 }
 
 /**
@@ -436,33 +477,33 @@ VMM_INT_DECL(bool) PATMIsInt3Patch(PVM pVM, RTRCPTR pInstrGC, uint32_t *pOpcode,
  * @returns VBox status
  *
  * @param   pVM         Pointer to the VM.
- * @param   pCtxCore    The relevant core context.
- * @param   pCpu        Disassembly context
+ * @param   pCtx        The relevant guest cpu context.
+ * @param   pCpu        Disassembly state.
  */
-VMMDECL(int) PATMSysCall(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
+VMMDECL(int) PATMSysCall(PVM pVM, PCPUMCTX pCtx, PDISCPUSTATE pCpu)
 {
-    PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(VMMGetCpu0(pVM));
+    Assert(CPUMQueryGuestCtxPtr(VMMGetCpu0(pVM)) == pCtx);
     AssertReturn(!HMIsEnabled(pVM), VERR_PATM_HM_IPE);
 
     if (pCpu->pCurInstr->uOpcode == OP_SYSENTER)
     {
         if (    pCtx->SysEnter.cs == 0
-            ||  pRegFrame->eflags.Bits.u1VM
-            ||  (pRegFrame->cs.Sel & X86_SEL_RPL) != 3
+            ||  pCtx->eflags.Bits.u1VM
+            ||  (pCtx->cs.Sel & X86_SEL_RPL) != 3
             ||  pVM->patm.s.pfnSysEnterPatchGC == 0
             ||  pVM->patm.s.pfnSysEnterGC != (RTRCPTR)(RTRCUINTPTR)pCtx->SysEnter.eip
-            ||  !(PATMRawGetEFlags(pVM, pRegFrame) & X86_EFL_IF))
+            ||  !(PATMRawGetEFlags(pVM, pCtx) & X86_EFL_IF))
             goto end;
 
-        Log2(("PATMSysCall: sysenter from %RRv to %RRv\n", pRegFrame->eip, pVM->patm.s.pfnSysEnterPatchGC));
+        Log2(("PATMSysCall: sysenter from %RRv to %RRv\n", pCtx->eip, pVM->patm.s.pfnSysEnterPatchGC));
         /** @todo the base and limit are forced to 0 & 4G-1 resp. We assume the selector is wide open here. */
         /** @note The Intel manual suggests that the OS is responsible for this. */
-        pRegFrame->cs.Sel      = (pCtx->SysEnter.cs & ~X86_SEL_RPL) | 1;
-        pRegFrame->eip         = /** @todo ugly conversion! */(uint32_t)pVM->patm.s.pfnSysEnterPatchGC;
-        pRegFrame->ss.Sel      = pRegFrame->cs.Sel + 8;     /* SysEnter.cs + 8 */
-        pRegFrame->esp         = pCtx->SysEnter.esp;
-        pRegFrame->eflags.u32 &= ~(X86_EFL_VM | X86_EFL_RF);
-        pRegFrame->eflags.u32 |= X86_EFL_IF;
+        pCtx->cs.Sel      = (pCtx->SysEnter.cs & ~X86_SEL_RPL) | 1;
+        pCtx->eip         = /** @todo ugly conversion! */(uint32_t)pVM->patm.s.pfnSysEnterPatchGC;
+        pCtx->ss.Sel      = pCtx->cs.Sel + 8;     /* SysEnter.cs + 8 */
+        pCtx->esp         = pCtx->SysEnter.esp;
+        pCtx->eflags.u32 &= ~(X86_EFL_VM | X86_EFL_RF);
+        pCtx->eflags.u32 |= X86_EFL_IF;
 
         /* Turn off interrupts. */
         pVM->patm.s.CTXSUFF(pGCState)->uVMFlags &= ~X86_EFL_IF;
@@ -474,17 +515,17 @@ VMMDECL(int) PATMSysCall(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
     if (pCpu->pCurInstr->uOpcode == OP_SYSEXIT)
     {
         if (    pCtx->SysEnter.cs == 0
-            ||  (pRegFrame->cs.Sel & X86_SEL_RPL) != 1
-            ||  pRegFrame->eflags.Bits.u1VM
-            ||  !(PATMRawGetEFlags(pVM, pRegFrame) & X86_EFL_IF))
+            ||  (pCtx->cs.Sel & X86_SEL_RPL) != 1
+            ||  pCtx->eflags.Bits.u1VM
+            ||  !(PATMRawGetEFlags(pVM, pCtx) & X86_EFL_IF))
             goto end;
 
-        Log2(("PATMSysCall: sysexit from %RRv to %RRv\n", pRegFrame->eip, pRegFrame->edx));
+        Log2(("PATMSysCall: sysexit from %RRv to %RRv\n", pCtx->eip, pCtx->edx));
 
-        pRegFrame->cs.Sel      = ((pCtx->SysEnter.cs + 16) & ~X86_SEL_RPL) | 3;
-        pRegFrame->eip         = pRegFrame->edx;
-        pRegFrame->ss.Sel      = pRegFrame->cs.Sel + 8;  /* SysEnter.cs + 24 */
-        pRegFrame->esp         = pRegFrame->ecx;
+        pCtx->cs.Sel      = ((pCtx->SysEnter.cs + 16) & ~X86_SEL_RPL) | 3;
+        pCtx->eip         = pCtx->edx;
+        pCtx->ss.Sel      = pCtx->cs.Sel + 8;  /* SysEnter.cs + 24 */
+        pCtx->esp         = pCtx->ecx;
 
         STAM_COUNTER_INC(&pVM->patm.s.StatSysExit);
 
diff --git a/src/VBox/VMM/VMMAll/PDMAll.cpp b/src/VBox/VMM/VMMAll/PDMAll.cpp
index 29eefb9..725412f 100644
--- a/src/VBox/VMM/VMMAll/PDMAll.cpp
+++ b/src/VBox/VMM/VMMAll/PDMAll.cpp
@@ -397,6 +397,25 @@ VMM_INT_DECL(int) PDMApicReadMSR(PVM pVM, VMCPUID iCpu, uint32_t u32Reg, uint64_
 
 
 /**
+ * Gets the frequency of the APIC timer.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pu64Value       Where to store the frequency.
+ */
+VMM_INT_DECL(int) PDMApicGetTimerFreq(PVM pVM, uint64_t *pu64Value)
+{
+    if (pVM->pdm.s.Apic.CTX_SUFF(pDevIns))
+    {
+        AssertPtr(pVM->pdm.s.Apic.CTX_SUFF(pfnGetTimerFreq));
+        *pu64Value = pVM->pdm.s.Apic.CTX_SUFF(pfnGetTimerFreq)(pVM->pdm.s.Apic.CTX_SUFF(pDevIns));
+        return VINF_SUCCESS;
+    }
+    return VERR_PDM_NO_APIC_INSTANCE;
+}
+
+
+/**
  * Locks PDM.
  * This might call back to Ring-3 in order to deal with lock contention in GC and R3.
  *
diff --git a/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp b/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
index db90379..0223820 100644
--- a/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
+++ b/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
@@ -298,11 +298,11 @@ DECL_FORCE_INLINE(int) pdmCritSectEnter(PPDMCRITSECT pCritSect, int rcBusy, PCRT
             PVM     pVM   = pCritSect->s.CTX_SUFF(pVM);
             PVMCPU  pVCpu = VMMGetCpu(pVM);
             HMR0Leave(pVM, pVCpu);
-            RTThreadPreemptRestore(NIL_RTTHREAD, ????);
+            RTThreadPreemptRestore(NIL_RTTHREAD, XXX);
 
             rc = pdmR3R0CritSectEnterContended(pCritSect, hNativeSelf, pSrcPos);
 
-            RTThreadPreemptDisable(NIL_RTTHREAD, ????);
+            RTThreadPreemptDisable(NIL_RTTHREAD, XXX);
             HMR0Enter(pVM, pVCpu);
         }
         return rc;
diff --git a/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp b/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp
index 3f751a1..f8feee9 100644
--- a/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp
+++ b/src/VBox/VMM/VMMAll/PDMAllCritSectRw.cpp
@@ -454,6 +454,7 @@ VMMDECL(int) PDMCritSectRwEnterShared(PPDMCRITSECTRW pThis, int rcBusy)
  */
 VMMDECL(int) PDMCritSectRwEnterSharedDebug(PPDMCRITSECTRW pThis, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)
 {
+    NOREF(uId); NOREF(pszFile); NOREF(iLine); NOREF(pszFunction);
 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3)
     return pdmCritSectRwEnterShared(pThis, rcBusy, false /*fTryOnly*/, NULL,    false /*fNoVal*/);
 #else
@@ -514,6 +515,7 @@ VMMDECL(int) PDMCritSectRwTryEnterShared(PPDMCRITSECTRW pThis)
  */
 VMMDECL(int) PDMCritSectRwTryEnterSharedDebug(PPDMCRITSECTRW pThis, RTHCUINTPTR uId, RT_SRC_POS_DECL)
 {
+    NOREF(uId); NOREF(pszFile); NOREF(iLine); NOREF(pszFunction);
 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3)
     return pdmCritSectRwEnterShared(pThis, VERR_SEM_BUSY, true /*fTryOnly*/, NULL,    false /*fNoVal*/);
 #else
@@ -994,6 +996,7 @@ VMMDECL(int) PDMCritSectRwEnterExcl(PPDMCRITSECTRW pThis, int rcBusy)
  */
 VMMDECL(int) PDMCritSectRwEnterExclDebug(PPDMCRITSECTRW pThis, int rcBusy, RTHCUINTPTR uId, RT_SRC_POS_DECL)
 {
+    NOREF(uId); NOREF(pszFile); NOREF(iLine); NOREF(pszFunction);
 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3)
     return pdmCritSectRwEnterExcl(pThis, rcBusy, false /*fTryAgain*/, NULL,    false /*fNoVal*/);
 #else
@@ -1050,6 +1053,7 @@ VMMDECL(int) PDMCritSectRwTryEnterExcl(PPDMCRITSECTRW pThis)
  */
 VMMDECL(int) PDMCritSectRwTryEnterExclDebug(PPDMCRITSECTRW pThis, RTHCUINTPTR uId, RT_SRC_POS_DECL)
 {
+    NOREF(uId); NOREF(pszFile); NOREF(iLine); NOREF(pszFunction);
 #if !defined(PDMCRITSECTRW_STRICT) || !defined(IN_RING3)
     return pdmCritSectRwEnterExcl(pThis, VERR_SEM_BUSY, true /*fTryAgain*/, NULL,    false /*fNoVal*/);
 #else
diff --git a/src/VBox/VMM/VMMAll/PDMAllQueue.cpp b/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
index 6906d84..6ef6ae2 100644
--- a/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
+++ b/src/VBox/VMM/VMMAll/PDMAllQueue.cpp
@@ -67,6 +67,26 @@ VMMDECL(PPDMQUEUEITEMCORE) PDMQueueAlloc(PPDMQUEUE pQueue)
 
 
 /**
+ * Sets the FFs and fQueueFlushed.
+ *
+ * @param   pQueue              The PDM queue.
+ */
+static void pdmQueueSetFF(PPDMQUEUE pQueue)
+{
+    PVM pVM = pQueue->CTX_SUFF(pVM);
+    Log2(("PDMQueueInsert: VM_FF_PDM_QUEUES %d -> 1\n", VM_FF_IS_SET(pVM, VM_FF_PDM_QUEUES)));
+    VM_FF_SET(pVM, VM_FF_PDM_QUEUES);
+    ASMAtomicBitSet(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_PENDING_BIT);
+#ifdef IN_RING3
+# ifdef VBOX_WITH_REM
+    REMR3NotifyQueuePending(pVM); /** @todo r=bird: we can remove REMR3NotifyQueuePending and let VMR3NotifyFF do the work. */
+# endif
+    VMR3NotifyGlobalFFU(pVM->pUVM, VMNOTIFYFF_FLAGS_DONE_REM);
+#endif
+}
+
+
+/**
  * Queue an item.
  * The item must have been obtained using PDMQueueAlloc(). Once the item
  * have been passed to this function it must not be touched!
@@ -97,18 +117,7 @@ VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem)
 #endif
 
     if (!pQueue->pTimer)
-    {
-        PVM pVM = pQueue->CTX_SUFF(pVM);
-        Log2(("PDMQueueInsert: VM_FF_PDM_QUEUES %d -> 1\n", VM_FF_IS_SET(pVM, VM_FF_PDM_QUEUES)));
-        VM_FF_SET(pVM, VM_FF_PDM_QUEUES);
-        ASMAtomicBitSet(&pVM->pdm.s.fQueueFlushing, PDM_QUEUE_FLUSH_FLAG_PENDING_BIT);
-#ifdef IN_RING3
-# ifdef VBOX_WITH_REM
-        REMR3NotifyQueuePending(pVM); /** @todo r=bird: we can remove REMR3NotifyQueuePending and let VMR3NotifyFF do the work. */
-# endif
-        VMR3NotifyGlobalFFU(pVM->pUVM, VMNOTIFYFF_FLAGS_DONE_REM);
-#endif
-    }
+        pdmQueueSetFF(pQueue);
     STAM_REL_COUNTER_INC(&pQueue->StatInsert);
     STAM_STATS({ ASMAtomicIncU32(&pQueue->cStatPending); });
 }
@@ -183,3 +192,23 @@ VMMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue)
 #endif
 }
 
+
+/**
+ * Schedule the queue for flushing (processing) if necessary.
+ *
+ * @returns @c true if necessary, @c false if not.
+ * @param   pQueue              The queue.
+ */
+VMMDECL(bool) PDMQueueFlushIfNecessary(PPDMQUEUE pQueue)
+{
+    AssertPtr(pQueue);
+    if (   pQueue->pPendingR3 != NIL_RTR3PTR
+        || pQueue->pPendingR0 != NIL_RTR0PTR
+        || pQueue->pPendingRC != NIL_RTRCPTR)
+    {
+        pdmQueueSetFF(pQueue);
+        return false;
+    }
+    return false;
+}
+
diff --git a/src/VBox/VMM/VMMAll/PGMAll.cpp b/src/VBox/VMM/VMMAll/PGMAll.cpp
index 9a046d1..49741fa 100644
--- a/src/VBox/VMM/VMMAll/PGMAll.cpp
+++ b/src/VBox/VMM/VMMAll/PGMAll.cpp
@@ -808,6 +808,7 @@ VMMDECL(int) PGMInvalidatePage(PVMCPU pVCpu, RTGCPTR GCPtrPage)
  */
 VMMDECL(VBOXSTRICTRC) PGMInterpretInstruction(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault)
 {
+    NOREF(pVM);
     VBOXSTRICTRC rc = EMInterpretInstruction(pVCpu, pRegFrame, pvFault);
     if (rc == VERR_EM_INTERPRETER)
         rc = VINF_EM_RAW_EMULATE_INSTR;
diff --git a/src/VBox/VMM/VMMAll/PGMAllBth.h b/src/VBox/VMM/VMMAll/PGMAllBth.h
index dfe3e24..1fa23c7 100644
--- a/src/VBox/VMM/VMMAll/PGMAllBth.h
+++ b/src/VBox/VMM/VMMAll/PGMAllBth.h
@@ -15,7 +15,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -178,6 +178,8 @@ static VBOXSTRICTRC PGM_BTH_NAME(Trap0eHandlerDoAccessHandlers)(PVMCPU pVCpu, RT
         PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhysFault);
         if (pCur)
         {
+            PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+
 #  ifdef PGM_SYNC_N_PAGES
             /*
              * If the region is write protected and we got a page not present fault, then sync
@@ -187,7 +189,7 @@ static VBOXSTRICTRC PGM_BTH_NAME(Trap0eHandlerDoAccessHandlers)(PVMCPU pVCpu, RT
              * ASSUMES that there is only one handler per page or that they have similar write properties.
              */
             if (   !(uErr & X86_TRAP_PF_P)
-                &&  pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE)
+                &&  pCurType->enmKind == PGMPHYSHANDLERKIND_WRITE)
             {
 #   if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
                 rc = PGM_BTH_NAME(SyncPage)(pVCpu, pGstWalk->Pde, pvFault, PGM_SYNC_NR_PAGES, uErr);
@@ -210,7 +212,7 @@ static VBOXSTRICTRC PGM_BTH_NAME(Trap0eHandlerDoAccessHandlers)(PVMCPU pVCpu, RT
              * If the access was not thru a #PF(RSVD|...) resync the page.
              */
             if (   !(uErr & X86_TRAP_PF_RSVD)
-                && pCur->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE
+                && pCurType->enmKind != PGMPHYSHANDLERKIND_WRITE
 #   if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)
                 && pGstWalk->Core.fEffectiveRW
                 && !pGstWalk->Core.fEffectiveUS /** @todo Remove pGstWalk->Core.fEffectiveUS and X86_PTE_US further down in the sync code. */
@@ -233,11 +235,11 @@ static VBOXSTRICTRC PGM_BTH_NAME(Trap0eHandlerDoAccessHandlers)(PVMCPU pVCpu, RT
             }
 #  endif
 
-            AssertMsg(   pCur->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE
-                      || (pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE && (uErr & X86_TRAP_PF_RW)),
-                      ("Unexpected trap for physical handler: %08X (phys=%08x) pPage=%R[pgmpage] uErr=%X, enum=%d\n",
-                       pvFault, GCPhysFault, pPage, uErr, pCur->enmType));
-            if (pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE)
+            AssertMsg(   pCurType->enmKind != PGMPHYSHANDLERKIND_WRITE
+                      || (pCurType->enmKind == PGMPHYSHANDLERKIND_WRITE && (uErr & X86_TRAP_PF_RW)),
+                      ("Unexpected trap for physical handler: %08X (phys=%08x) pPage=%R[pgmpage] uErr=%X, enmKind=%d\n",
+                       pvFault, GCPhysFault, pPage, uErr, pCurType->enmKind));
+            if (pCurType->enmKind == PGMPHYSHANDLERKIND_WRITE)
                 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eHandlersPhysWrite);
             else
             {
@@ -245,24 +247,19 @@ static VBOXSTRICTRC PGM_BTH_NAME(Trap0eHandlerDoAccessHandlers)(PVMCPU pVCpu, RT
                 if (uErr & X86_TRAP_PF_RSVD) STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eHandlersPhysAllOpt);
             }
 
-            if (pCur->CTX_SUFF(pfnHandler))
+            if (pCurType->CTX_SUFF(pfnPfHandler))
             {
-                PPGMPOOL            pPool      = pVM->pgm.s.CTX_SUFF(pPool);
-                void               *pvUser     = pCur->CTX_SUFF(pvUser);
-#  ifdef IN_RING0
-                PFNPGMR0PHYSHANDLER pfnHandler = pCur->CTX_SUFF(pfnHandler);
-#  else
-                PFNPGMRCPHYSHANDLER pfnHandler = pCur->CTX_SUFF(pfnHandler);
-#  endif
+                PPGMPOOL    pPool  = pVM->pgm.s.CTX_SUFF(pPool);
+                void       *pvUser = pCur->CTX_SUFF(pvUser);
 
                 STAM_PROFILE_START(&pCur->Stat, h);
-                if (pfnHandler != pPool->CTX_SUFF(pfnAccessHandler))
+                if (pCur->hType != pPool->hAccessHandlerType)
                 {
                     pgmUnlock(pVM);
                     *pfLockTaken = false;
                 }
 
-                rc = pfnHandler(pVM, uErr, pRegFrame, pvFault, GCPhysFault, pvUser);
+                rc = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, GCPhysFault, pvUser);
 
 #  ifdef VBOX_WITH_STATISTICS
                 pgmLock(pVM);
@@ -317,25 +314,27 @@ static VBOXSTRICTRC PGM_BTH_NAME(Trap0eHandlerDoAccessHandlers)(PVMCPU pVCpu, RT
         PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, pvFault);
         if (pCur)
         {
+            PPGMVIRTHANDLERTYPEINT pCurType = PGMVIRTANDLER_GET_TYPE(pVM, pCur);
             AssertMsg(!(pvFault - pCur->Core.Key < pCur->cb)
-                      || (     pCur->enmType != PGMVIRTHANDLERTYPE_WRITE
+                      || (     pCurType->enmKind != PGMVIRTHANDLERKIND_WRITE
                            || !(uErr & X86_TRAP_PF_P)
-                           || (pCur->enmType == PGMVIRTHANDLERTYPE_WRITE && (uErr & X86_TRAP_PF_RW))),
-                      ("Unexpected trap for virtual handler: %RGv (phys=%RGp) pPage=%R[pgmpage] uErr=%X, enum=%d\n",
-                       pvFault, pGstWalk->Core.GCPhys, pPage, uErr, pCur->enmType));
+                           || (pCurType->enmKind == PGMVIRTHANDLERKIND_WRITE && (uErr & X86_TRAP_PF_RW))),
+                      ("Unexpected trap for virtual handler: %RGv (phys=%RGp) pPage=%R[pgmpage] uErr=%X, enumKind=%d\n",
+                       pvFault, pGstWalk->Core.GCPhys, pPage, uErr, pCurType->enmKind));
 
             if (    pvFault - pCur->Core.Key < pCur->cb
                 &&  (    uErr & X86_TRAP_PF_RW
-                     ||  pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) )
+                     ||  pCurType->enmKind != PGMVIRTHANDLERKIND_WRITE ) )
             {
 #   ifdef IN_RC
                 STAM_PROFILE_START(&pCur->Stat, h);
-                RTGCPTR                     GCPtrStart = pCur->Core.Key;
-                CTX_MID(PFNPGM,VIRTHANDLER) pfnHandler = pCur->CTX_SUFF(pfnHandler);
+                RTGCPTR GCPtrStart = pCur->Core.Key;
+                void *pvUser = pCur->CTX_SUFF(pvUser);
                 pgmUnlock(pVM);
                 *pfLockTaken = false;
 
-                rc = pfnHandler(pVM, uErr, pRegFrame, pvFault, GCPtrStart, pvFault - GCPtrStart);
+                rc = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, GCPtrStart,
+                                                      pvFault - GCPtrStart, pvUser);
 
 #    ifdef VBOX_WITH_STATISTICS
                 pgmLock(pVM);
@@ -360,37 +359,41 @@ static VBOXSTRICTRC PGM_BTH_NAME(Trap0eHandlerDoAccessHandlers)(PVMCPU pVCpu, RT
             unsigned iPage;
             rc = pgmHandlerVirtualFindByPhysAddr(pVM, pGstWalk->Core.GCPhys, &pCur, &iPage);
             Assert(RT_SUCCESS(rc) || !pCur);
-            if (    pCur
-                &&  (   uErr & X86_TRAP_PF_RW
-                     || pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) )
+            if (pCur)
             {
-                Assert((pCur->aPhysToVirt[iPage].Core.Key & X86_PTE_PAE_PG_MASK) == (pGstWalk->Core.GCPhys & X86_PTE_PAE_PG_MASK));
+                PPGMVIRTHANDLERTYPEINT pCurType = PGMVIRTANDLER_GET_TYPE(pVM, pCur);
+                if  (   uErr & X86_TRAP_PF_RW
+                     || pCurType->enmKind != PGMVIRTHANDLERKIND_WRITE )
+                {
+                    Assert(   (pCur->aPhysToVirt[iPage].Core.Key & X86_PTE_PAE_PG_MASK)
+                           == (pGstWalk->Core.GCPhys & X86_PTE_PAE_PG_MASK));
 #   ifdef IN_RC
-                STAM_PROFILE_START(&pCur->Stat, h);
-                RTGCPTR                     GCPtrStart = pCur->Core.Key;
-                CTX_MID(PFNPGM,VIRTHANDLER) pfnHandler = pCur->CTX_SUFF(pfnHandler);
-                pgmUnlock(pVM);
-                *pfLockTaken = false;
+                    STAM_PROFILE_START(&pCur->Stat, h);
+                    RTGCPTR GCPtrStart = pCur->Core.Key;
+                    void *pvUser = pCur->CTX_SUFF(pvUser);
+                    pgmUnlock(pVM);
+                    *pfLockTaken = false;
 
-                RTGCPTR off = (iPage << PAGE_SHIFT)
-                            + (pvFault    & PAGE_OFFSET_MASK)
-                            - (GCPtrStart & PAGE_OFFSET_MASK);
-                Assert(off < pCur->cb);
-                rc = pfnHandler(pVM, uErr, pRegFrame, pvFault, GCPtrStart, off);
+                    RTGCPTR off = (iPage << PAGE_SHIFT)
+                                + (pvFault    & PAGE_OFFSET_MASK)
+                                - (GCPtrStart & PAGE_OFFSET_MASK);
+                    Assert(off < pCur->cb);
+                    rc = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, GCPtrStart, off, pvUser);
 
 #    ifdef VBOX_WITH_STATISTICS
-                pgmLock(pVM);
-                pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, GCPtrStart);
-                if (pCur)
-                    STAM_PROFILE_STOP(&pCur->Stat, h);
-                pgmUnlock(pVM);
+                    pgmLock(pVM);
+                    pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, GCPtrStart);
+                    if (pCur)
+                        STAM_PROFILE_STOP(&pCur->Stat, h);
+                    pgmUnlock(pVM);
 #    endif
 #   else
-                rc = VINF_EM_RAW_EMULATE_INSTR; /** @todo for VMX */
+                    rc = VINF_EM_RAW_EMULATE_INSTR; /** @todo for VMX */
 #   endif
-                STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eHandlersVirtualByPhys);
-                STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2HndVirt; });
-                return rc;
+                    STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eHandlersVirtualByPhys);
+                    STAM_STATS({ pVCpu->pgm.s.CTX_SUFF(pStatTrap0eAttribution) = &pVCpu->pgm.s.CTX_SUFF(pStats)->StatRZTrap0eTime2HndVirt; });
+                    return rc;
+                }
             }
         }
     }
@@ -710,15 +713,19 @@ PGM_BTH_DECL(int, Trap0eHandler)(PVMCPU pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegF
                 /*
                  * Check if the fault address is in a virtual page access handler range.
                  */
-                PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->HyperVirtHandlers, pvFault);
+                PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->HyperVirtHandlers,
+                                                                             pvFault);
                 if (    pCur
                     &&  pvFault - pCur->Core.Key < pCur->cb
                     &&  uErr & X86_TRAP_PF_RW)
                 {
 #   ifdef IN_RC
                     STAM_PROFILE_START(&pCur->Stat, h);
+                    PPGMVIRTHANDLERTYPEINT pCurType = PGMVIRTANDLER_GET_TYPE(pVM, pCur);
+                    void *pvUser = pCur->CTX_SUFF(pvUser);
                     pgmUnlock(pVM);
-                    rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, pvFault - pCur->Core.Key);
+                    rc = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, pCur->Core.Key,
+                                                          pvFault - pCur->Core.Key, pvUser);
                     pgmLock(pVM);
                     STAM_PROFILE_STOP(&pCur->Stat, h);
 #   else
@@ -797,20 +804,24 @@ PGM_BTH_DECL(int, Trap0eHandler)(PVMCPU pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegF
         PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRangeGet(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, pvFault);
         if (pCur)
         {
+            PPGMVIRTHANDLERTYPEINT pCurType = PGMVIRTANDLER_GET_TYPE(pVM, pCur);
             AssertMsg(   !(pvFault - pCur->Core.Key < pCur->cb)
-                      || (    pCur->enmType != PGMVIRTHANDLERTYPE_WRITE
+                      || (    pCurType->enmKind != PGMVIRTHANDLERKIND_WRITE
                            || !(uErr & X86_TRAP_PF_P)
-                           || (pCur->enmType == PGMVIRTHANDLERTYPE_WRITE && (uErr & X86_TRAP_PF_RW))),
-                      ("Unexpected trap for virtual handler: %08X (phys=%08x) %R[pgmpage] uErr=%X, enum=%d\n", pvFault, GCPhys, pPage, uErr, pCur->enmType));
+                           || (pCurType->enmKind == PGMVIRTHANDLERKIND_WRITE && (uErr & X86_TRAP_PF_RW))),
+                      ("Unexpected trap for virtual handler: %08X (phys=%08x) %R[pgmpage] uErr=%X, enumKind=%d\n",
+                       pvFault, GCPhys, pPage, uErr, pCurType->enmKind));
 
             if (    pvFault - pCur->Core.Key < pCur->cb
                 &&  (    uErr & X86_TRAP_PF_RW
-                     ||  pCur->enmType != PGMVIRTHANDLERTYPE_WRITE ) )
+                     ||  pCurType->enmKind != PGMVIRTHANDLERKIND_WRITE ) )
             {
 #   ifdef IN_RC
                 STAM_PROFILE_START(&pCur->Stat, h);
+                void *pvUser = pCur->CTX_SUFF(pvUser);
                 pgmUnlock(pVM);
-                rc = pCur->CTX_SUFF(pfnHandler)(pVM, uErr, pRegFrame, pvFault, pCur->Core.Key, pvFault - pCur->Core.Key);
+                rc = pCurType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr, pRegFrame, pvFault, pCur->Core.Key,
+                                                      pvFault - pCur->Core.Key, pvUser);
                 pgmLock(pVM);
                 STAM_PROFILE_STOP(&pCur->Stat, h);
 #   else
diff --git a/src/VBox/VMM/VMMAll/PGMAllGst.h b/src/VBox/VMM/VMMAll/PGMAllGst.h
index 0b94e51..231ca08 100644
--- a/src/VBox/VMM/VMMAll/PGMAllGst.h
+++ b/src/VBox/VMM/VMMAll/PGMAllGst.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -461,11 +461,13 @@ PGM_GST_DECL(int, GetPDE)(PVMCPU pVCpu, RTGCPTR GCPtr, PX86PDEPAE pPDE)
  */
 static DECLCALLBACK(int) PGM_GST_NAME(VirtHandlerUpdateOne)(PAVLROGCPTRNODECORE pNode, void *pvUser)
 {
-    PPGMVIRTHANDLER pCur   = (PPGMVIRTHANDLER)pNode;
-    PPGMHVUSTATE    pState = (PPGMHVUSTATE)pvUser;
-    PVM             pVM    = pState->pVM;
-    PVMCPU          pVCpu  = pState->pVCpu;
-    Assert(pCur->enmType != PGMVIRTHANDLERTYPE_HYPERVISOR);
+    PPGMHVUSTATE            pState   = (PPGMHVUSTATE)pvUser;
+    PVM                     pVM      = pState->pVM;
+    PVMCPU                  pVCpu    = pState->pVCpu;
+    PPGMVIRTHANDLER         pCur     = (PPGMVIRTHANDLER)pNode;
+    PPGMVIRTHANDLERTYPEINT  pCurType = PGMVIRTANDLER_GET_TYPE(pVM, pCur);
+
+    Assert(pCurType->enmKind != PGMVIRTHANDLERKIND_HYPERVISOR);
 
 # if PGM_GST_TYPE == PGM_TYPE_32BIT
     PX86PD          pPDSrc = pgmGstGet32bitPDPtr(pVCpu);
diff --git a/src/VBox/VMM/VMMAll/PGMAllHandler.cpp b/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
index 688a594..8b82158 100644
--- a/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
+++ b/src/VBox/VMM/VMMAll/PGMAllHandler.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -54,6 +54,73 @@ static void pgmHandlerPhysicalDeregisterNotifyREM(PVM pVM, PPGMPHYSHANDLER pCur)
 static void pgmHandlerPhysicalResetRamFlags(PVM pVM, PPGMPHYSHANDLER pCur);
 
 
+/**
+ * Internal worker for releasing a physical handler type registration reference.
+ *
+ * @returns New reference count. UINT32_MAX if invalid input (asserted).
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   pType       Pointer to the type registration.
+ */
+DECLINLINE(uint32_t) pgmHandlerPhysicalTypeRelease(PVM pVM, PPGMPHYSHANDLERTYPEINT pType)
+{
+    AssertMsgReturn(pType->u32Magic == PGMPHYSHANDLERTYPEINT_MAGIC, ("%#x\n", pType->u32Magic), UINT32_MAX);
+    uint32_t cRefs = ASMAtomicDecU32(&pType->cRefs);
+    if (cRefs == 0)
+    {
+        pgmLock(pVM);
+        pType->u32Magic = PGMPHYSHANDLERTYPEINT_MAGIC_DEAD;
+        RTListOff32NodeRemove(&pType->ListNode);
+        pgmUnlock(pVM);
+        MMHyperFree(pVM, pType);
+    }
+    return cRefs;
+}
+
+
+/**
+ * Internal worker for retaining a physical handler type registration reference.
+ *
+ * @returns New reference count. UINT32_MAX if invalid input (asserted).
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   pType       Pointer to the type registration.
+ */
+DECLINLINE(uint32_t) pgmHandlerPhysicalTypeRetain(PVM pVM, PPGMPHYSHANDLERTYPEINT pType)
+{
+    AssertMsgReturn(pType->u32Magic == PGMPHYSHANDLERTYPEINT_MAGIC, ("%#x\n", pType->u32Magic), UINT32_MAX);
+    uint32_t cRefs = ASMAtomicIncU32(&pType->cRefs);
+    Assert(cRefs < _1M && cRefs > 0);
+    return cRefs;
+}
+
+
+/**
+ * Releases a reference to a physical handler type registration.
+ *
+ * @returns New reference count. UINT32_MAX if invalid input (asserted).
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   hType       The type regiration handle.
+ */
+VMMDECL(uint32_t) PGMHandlerPhysicalTypeRelease(PVM pVM, PGMPHYSHANDLERTYPE hType)
+{
+    if (hType != NIL_PGMPHYSHANDLERTYPE)
+        return pgmHandlerPhysicalTypeRelease(pVM, PGMPHYSHANDLERTYPEINT_FROM_HANDLE(pVM, hType));
+    return 0;
+}
+
+
+/**
+ * Retains a reference to a physical handler type registration.
+ *
+ * @returns New reference count. UINT32_MAX if invalid input (asserted).
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   hType       The type regiration handle.
+ */
+VMMDECL(uint32_t) PGMHandlerPhysicalTypeRetain(PVM pVM, PGMPHYSHANDLERTYPE hType)
+{
+    return pgmHandlerPhysicalTypeRetain(pVM, PGMPHYSHANDLERTYPEINT_FROM_HANDLE(pVM, hType));
+}
+
+
 
 /**
  * Register a access handler for a physical range.
@@ -67,44 +134,41 @@ static void pgmHandlerPhysicalResetRamFlags(PVM pVM, PPGMPHYSHANDLER pCur);
  *          one. A debug assertion is raised.
  *
  * @param   pVM             Pointer to the VM.
- * @param   enmType         Handler type. Any of the PGMPHYSHANDLERTYPE_PHYSICAL* enums.
  * @param   GCPhys          Start physical address.
  * @param   GCPhysLast      Last physical address. (inclusive)
- * @param   pfnHandlerR3    The R3 handler.
+ * @param   hType           The handler type registration handle.
  * @param   pvUserR3        User argument to the R3 handler.
- * @param   pfnHandlerR0    The R0 handler.
  * @param   pvUserR0        User argument to the R0 handler.
- * @param   pfnHandlerRC    The RC handler.
  * @param   pvUserRC        User argument to the RC handler. This can be a value
  *                          less that 0x10000 or a (non-null) pointer that is
  *                          automatically relocated.
- * @param   pszDesc         Pointer to description string. This must not be freed.
+ * @param   pszDesc         Description of this handler.  If NULL, the type
+ *                          description will be used instead.
  */
-VMMDECL(int) PGMHandlerPhysicalRegisterEx(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
-                                          R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
-                                          R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
-                                          RCPTRTYPE(PFNPGMRCPHYSHANDLER) pfnHandlerRC, RTRCPTR pvUserRC,
-                                          R3PTRTYPE(const char *) pszDesc)
+VMMDECL(int) PGMHandlerPhysicalRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast, PGMPHYSHANDLERTYPE hType,
+                                        RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, R3PTRTYPE(const char *) pszDesc)
 {
-    Log(("PGMHandlerPhysicalRegisterEx: enmType=%d GCPhys=%RGp GCPhysLast=%RGp pfnHandlerR3=%RHv pvUserR3=%RHv pfnHandlerR0=%RHv pvUserR0=%RHv pfnHandlerGC=%RRv pvUserGC=%RRv pszDesc=%s\n",
-          enmType, GCPhys, GCPhysLast, pfnHandlerR3, pvUserR3, pfnHandlerR0, pvUserR0, pfnHandlerRC, pvUserRC, R3STRING(pszDesc)));
+    PPGMPHYSHANDLERTYPEINT pType = PGMPHYSHANDLERTYPEINT_FROM_HANDLE(pVM, hType);
+    Log(("PGMHandlerPhysicalRegister: GCPhys=%RGp GCPhysLast=%RGp pvUserR3=%RHv pvUserR0=%RHv pvUserGC=%RRv hType=%#x (%d, %s) pszDesc=%RHv:%s\n",
+         GCPhys, GCPhysLast, pvUserR3, pvUserR0, pvUserRC, hType, pType->enmKind, R3STRING(pType->pszDesc), pszDesc, R3STRING(pszDesc)));
 
     /*
      * Validate input.
      */
+    AssertReturn(pType->u32Magic == PGMPHYSHANDLERTYPEINT_MAGIC, VERR_INVALID_HANDLE);
     AssertMsgReturn(GCPhys < GCPhysLast, ("GCPhys >= GCPhysLast (%#x >= %#x)\n", GCPhys, GCPhysLast), VERR_INVALID_PARAMETER);
-    switch (enmType)
+    switch (pType->enmKind)
     {
-        case PGMPHYSHANDLERTYPE_PHYSICAL_WRITE:
+        case PGMPHYSHANDLERKIND_WRITE:
             break;
-        case PGMPHYSHANDLERTYPE_MMIO:
-        case PGMPHYSHANDLERTYPE_PHYSICAL_ALL:
+        case PGMPHYSHANDLERKIND_MMIO:
+        case PGMPHYSHANDLERKIND_ALL:
             /* Simplification for PGMPhysRead, PGMR0Trap0eHandlerNPMisconfig and others. */
             AssertMsgReturn(!(GCPhys & PAGE_OFFSET_MASK), ("%RGp\n", GCPhys), VERR_INVALID_PARAMETER);
             AssertMsgReturn((GCPhysLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, ("%RGp\n", GCPhysLast), VERR_INVALID_PARAMETER);
             break;
         default:
-            AssertMsgFailed(("Invalid input enmType=%d!\n", enmType));
+            AssertMsgFailed(("Invalid input enmKind=%d!\n", pType->enmKind));
             return VERR_INVALID_PARAMETER;
     }
     AssertMsgReturn(    (RTRCUINTPTR)pvUserRC < 0x10000
@@ -115,9 +179,6 @@ VMMDECL(int) PGMHandlerPhysicalRegisterEx(PVM pVM, PGMPHYSHANDLERTYPE enmType, R
                     ||  MMHyperR3ToR0(pVM, MMHyperR0ToR3(pVM, pvUserR0)) == pvUserR0,
                     ("Not R0 pointer! pvUserR0=%RHv\n", pvUserR0),
                     VERR_INVALID_PARAMETER);
-    AssertPtrReturn(pfnHandlerR3, VERR_INVALID_POINTER);
-    AssertReturn(pfnHandlerR0, VERR_INVALID_PARAMETER);
-    AssertReturn(pfnHandlerRC || HMIsEnabled(pVM), VERR_INVALID_PARAMETER);
 
     /*
      * We require the range to be within registered ram.
@@ -145,17 +206,15 @@ VMMDECL(int) PGMHandlerPhysicalRegisterEx(PVM pVM, PGMPHYSHANDLERTYPE enmType, R
 
     pNew->Core.Key      = GCPhys;
     pNew->Core.KeyLast  = GCPhysLast;
-    pNew->enmType       = enmType;
     pNew->cPages        = (GCPhysLast - (GCPhys & X86_PTE_PAE_PG_MASK) + PAGE_SIZE) >> PAGE_SHIFT;
     pNew->cAliasedPages = 0;
     pNew->cTmpOffPages  = 0;
-    pNew->pfnHandlerR3  = pfnHandlerR3;
     pNew->pvUserR3      = pvUserR3;
-    pNew->pfnHandlerR0  = pfnHandlerR0;
     pNew->pvUserR0      = pvUserR0;
-    pNew->pfnHandlerRC  = pfnHandlerRC;
     pNew->pvUserRC      = pvUserRC;
-    pNew->pszDesc       = pszDesc;
+    pNew->hType         = hType;
+    pNew->pszDesc       = pszDesc != NIL_RTR3PTR ? pszDesc : pType->pszDesc;
+    pgmHandlerPhysicalTypeRetain(pVM, pType);
 
     pgmLock(pVM);
 
@@ -170,9 +229,9 @@ VMMDECL(int) PGMHandlerPhysicalRegisterEx(PVM pVM, PGMPHYSHANDLERTYPE enmType, R
         pgmUnlock(pVM);
 #ifdef VBOX_WITH_REM
 # ifndef IN_RING3
-        REMNotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, GCPhysLast - GCPhys + 1, !!pfnHandlerR3);
+        REMNotifyHandlerPhysicalRegister(pVM, pType->enmKind, GCPhys, GCPhysLast - GCPhys + 1, !!pType->pfnHandlerR3);
 # else
-        REMR3NotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, GCPhysLast - GCPhys + 1, !!pfnHandlerR3);
+        REMR3NotifyHandlerPhysicalRegister(pVM, pType->enmKind, GCPhys, GCPhysLast - GCPhys + 1, !!pType->pfnHandlerR3);
 # endif
 #endif
         if (rc != VINF_SUCCESS)
@@ -185,7 +244,9 @@ VMMDECL(int) PGMHandlerPhysicalRegisterEx(PVM pVM, PGMPHYSHANDLERTYPE enmType, R
 #if defined(IN_RING3) && defined(VBOX_STRICT)
     DBGFR3Info(pVM->pUVM, "handlers", "phys nostats", NULL);
 #endif
-    AssertMsgFailed(("Conflict! GCPhys=%RGp GCPhysLast=%RGp pszDesc=%s\n", GCPhys, GCPhysLast, pszDesc));
+    AssertMsgFailed(("Conflict! GCPhys=%RGp GCPhysLast=%RGp pszDesc=%s/%s\n",
+                     GCPhys, GCPhysLast, R3STRING(pszDesc), R3STRING(pType->pszDesc)));
+    pgmHandlerPhysicalTypeRelease(pVM, pType);
     MMHyperFree(pVM, pNew);
     return VERR_PGM_HANDLER_PHYSICAL_CONFLICT;
 }
@@ -208,15 +269,16 @@ static int pgmHandlerPhysicalSetRamFlagsAndFlushShadowPTs(PVM pVM, PPGMPHYSHANDL
      * Iterate the guest ram pages updating the flags and flushing PT entries
      * mapping the page.
      */
-    bool            fFlushTLBs = false;
-    int             rc         = VINF_SUCCESS;
-    const unsigned  uState     = pgmHandlerPhysicalCalcState(pCur);
-    uint32_t        cPages     = pCur->cPages;
-    uint32_t        i          = (pCur->Core.Key - pRam->GCPhys) >> PAGE_SHIFT;
+    bool                    fFlushTLBs = false;
+    int                     rc         = VINF_SUCCESS;
+    PPGMPHYSHANDLERTYPEINT  pCurType   = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+    const unsigned          uState     = pCurType->uState;
+    uint32_t                cPages     = pCur->cPages;
+    uint32_t                i          = (pCur->Core.Key - pRam->GCPhys) >> PAGE_SHIFT;
     for (;;)
     {
         PPGMPAGE pPage = &pRam->aPages[i];
-        AssertMsg(pCur->enmType != PGMPHYSHANDLERTYPE_MMIO || PGM_PAGE_IS_MMIO(pPage),
+        AssertMsg(pCurType->enmKind != PGMPHYSHANDLERKIND_MMIO || PGM_PAGE_IS_MMIO(pPage),
                   ("%RGp %R[pgmpage]\n", pRam->GCPhys + (i << PAGE_SHIFT), pPage));
 
         /* Only do upgrades. */
@@ -264,8 +326,7 @@ VMMDECL(int)  PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys)
     PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     if (pCur)
     {
-        LogFlow(("PGMHandlerPhysicalDeregister: Removing Range %RGp-%RGp %s\n",
-                 pCur->Core.Key, pCur->Core.KeyLast, R3STRING(pCur->pszDesc)));
+        LogFlow(("PGMHandlerPhysicalDeregister: Removing Range %RGp-%RGp %s\n", pCur->Core.Key, pCur->Core.KeyLast, R3STRING(pCur->pszDesc)));
 
         /*
          * Clear the page bits, notify the REM about this change and clear
@@ -276,6 +337,7 @@ VMMDECL(int)  PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys)
         pVM->pgm.s.pLastPhysHandlerR0 = 0;
         pVM->pgm.s.pLastPhysHandlerR3 = 0;
         pVM->pgm.s.pLastPhysHandlerRC = 0;
+        PGMHandlerPhysicalTypeRelease(pVM, pCur->hType);
         MMHyperFree(pVM, pCur);
         pgmUnlock(pVM);
         return VINF_SUCCESS;
@@ -292,8 +354,9 @@ VMMDECL(int)  PGMHandlerPhysicalDeregister(PVM pVM, RTGCPHYS GCPhys)
  */
 static void pgmHandlerPhysicalDeregisterNotifyREM(PVM pVM, PPGMPHYSHANDLER pCur)
 {
-    RTGCPHYS    GCPhysStart = pCur->Core.Key;
-    RTGCPHYS    GCPhysLast = pCur->Core.KeyLast;
+    PPGMPHYSHANDLERTYPEINT  pCurType    = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+    RTGCPHYS                GCPhysStart = pCur->Core.Key;
+    RTGCPHYS                GCPhysLast  = pCur->Core.KeyLast;
 
     /*
      * Page align the range.
@@ -305,7 +368,7 @@ static void pgmHandlerPhysicalDeregisterNotifyREM(PVM pVM, PPGMPHYSHANDLER pCur)
     if (    (pCur->Core.Key & PAGE_OFFSET_MASK)
         ||  ((pCur->Core.KeyLast + 1) & PAGE_OFFSET_MASK))
     {
-        Assert(pCur->enmType != PGMPHYSHANDLERTYPE_MMIO);
+        Assert(pCurType->enmKind != PGMPHYSHANDLERKIND_MMIO);
 
         if (GCPhysStart & PAGE_OFFSET_MASK)
         {
@@ -345,13 +408,15 @@ static void pgmHandlerPhysicalDeregisterNotifyREM(PVM pVM, PPGMPHYSHANDLER pCur)
     /*
      * Tell REM.
      */
-    const bool fRestoreAsRAM = pCur->pfnHandlerR3
-                            && pCur->enmType != PGMPHYSHANDLERTYPE_MMIO; /** @todo this isn't entirely correct. */
+    const bool fRestoreAsRAM = pCurType->pfnHandlerR3
+                            && pCurType->enmKind != PGMPHYSHANDLERKIND_MMIO; /** @todo this isn't entirely correct. */
 #ifdef VBOX_WITH_REM
 # ifndef IN_RING3
-    REMNotifyHandlerPhysicalDeregister(pVM, pCur->enmType, GCPhysStart, GCPhysLast - GCPhysStart + 1, !!pCur->pfnHandlerR3, fRestoreAsRAM);
+    REMNotifyHandlerPhysicalDeregister(pVM, pCurType->enmKind, GCPhysStart, GCPhysLast - GCPhysStart + 1,
+                                       !!pCurType->pfnHandlerR3, fRestoreAsRAM);
 # else
-    REMR3NotifyHandlerPhysicalDeregister(pVM, pCur->enmType, GCPhysStart, GCPhysLast - GCPhysStart + 1, !!pCur->pfnHandlerR3, fRestoreAsRAM);
+    REMR3NotifyHandlerPhysicalDeregister(pVM, pCurType->enmKind, GCPhysStart, GCPhysLast - GCPhysStart + 1,
+                                         !!pCurType->pfnHandlerR3, fRestoreAsRAM);
 # endif
 #endif
 }
@@ -370,11 +435,11 @@ DECLINLINE(void) pgmHandlerPhysicalRecalcPageState(PVM pVM, RTGCPHYS GCPhys, boo
     for (;;)
     {
         PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysGetBestFit(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys, fAbove);
-        if (    !pCur
-            ||  ((fAbove ? pCur->Core.Key : pCur->Core.KeyLast) >> PAGE_SHIFT) != (GCPhys >> PAGE_SHIFT))
+        if (   !pCur
+            || ((fAbove ? pCur->Core.Key : pCur->Core.KeyLast) >> PAGE_SHIFT) != (GCPhys >> PAGE_SHIFT))
             break;
-        unsigned uThisState = pgmHandlerPhysicalCalcState(pCur);
-        uState = RT_MAX(uState, uThisState);
+        PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+        uState = RT_MAX(uState, pCurType->uState);
 
         /* next? */
         RTGCPHYS GCPhysNext = fAbove
@@ -504,7 +569,10 @@ static void pgmHandlerPhysicalResetRamFlags(PVM pVM, PPGMPHYSHANDLER pCur)
                 pgmHandlerPhysicalResetAliasedPage(pVM, pPage, GCPhys, false /*fDoAccounting*/);
                 pCur->cAliasedPages--;
             }
-            AssertMsg(pCur->enmType != PGMPHYSHANDLERTYPE_MMIO || PGM_PAGE_IS_MMIO(pPage), ("%RGp %R[pgmpage]\n", GCPhys, pPage));
+#ifdef VBOX_STRICT
+            PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+            AssertMsg(pCurType->enmKind != PGMPHYSHANDLERKIND_MMIO || PGM_PAGE_IS_MMIO(pPage), ("%RGp %R[pgmpage]\n", GCPhys, pPage));
+#endif
             PGM_PAGE_SET_HNDL_PHYS_STATE(pPage, PGM_PAGE_HNDL_PHYS_STATE_NONE);
         }
         else
@@ -556,8 +624,9 @@ VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS
          * Clear the ram flags. (We're gonna move or free it!)
          */
         pgmHandlerPhysicalResetRamFlags(pVM, pCur);
-        const bool fRestoreAsRAM = pCur->pfnHandlerR3
-                                && pCur->enmType != PGMPHYSHANDLERTYPE_MMIO; /** @todo this isn't entirely correct. */
+        PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+        const bool fRestoreAsRAM = pCurType->pfnHandlerR3
+                                && pCurType->enmKind != PGMPHYSHANDLERKIND_MMIO; /** @todo this isn't entirely correct. */
 
         /*
          * Validate the new range, modify and reinsert.
@@ -579,9 +648,9 @@ VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS
 
                 if (RTAvlroGCPhysInsert(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, &pCur->Core))
                 {
-                    PGMPHYSHANDLERTYPE  enmType       = pCur->enmType;
                     RTGCPHYS            cb            = GCPhysLast - GCPhys + 1;
-                    bool                fHasHCHandler = !!pCur->pfnHandlerR3;
+                    PGMPHYSHANDLERKIND  enmKind       = pCurType->enmKind;
+                    bool                fHasHCHandler = !!pCurType->pfnHandlerR3;
 
                     /*
                      * Set ram flags, flush shadow PT entries and finally tell REM about this.
@@ -591,10 +660,10 @@ VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS
 
 #ifdef VBOX_WITH_REM
 # ifndef IN_RING3
-                    REMNotifyHandlerPhysicalModify(pVM, enmType, GCPhysCurrent, GCPhys, cb,
+                    REMNotifyHandlerPhysicalModify(pVM, enmKind, GCPhysCurrent, GCPhys, cb,
                                                    fHasHCHandler, fRestoreAsRAM);
 # else
-                    REMR3NotifyHandlerPhysicalModify(pVM, enmType, GCPhysCurrent, GCPhys, cb,
+                    REMR3NotifyHandlerPhysicalModify(pVM, enmKind, GCPhysCurrent, GCPhys, cb,
                                                      fHasHCHandler, fRestoreAsRAM);
 # endif
 #endif
@@ -627,6 +696,7 @@ VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS
         pVM->pgm.s.pLastPhysHandlerR0 = 0;
         pVM->pgm.s.pLastPhysHandlerR3 = 0;
         pVM->pgm.s.pLastPhysHandlerRC = 0;
+        PGMHandlerPhysicalTypeRelease(pVM, pCur->hType);
         MMHyperFree(pVM, pCur);
     }
     else
@@ -641,28 +711,21 @@ VMMDECL(int) PGMHandlerPhysicalModify(PVM pVM, RTGCPHYS GCPhysCurrent, RTGCPHYS
 
 
 /**
- * Changes the callbacks associated with a physical access handler.
+ * Changes the user callback arguments associated with a physical access
+ * handler.
  *
  * @returns VBox status code.
  * @param   pVM             Pointer to the VM.
- * @param   GCPhys          Start physical address.
- * @param   pfnHandlerR3    The R3 handler.
+ * @param   GCPhys          Start physical address of the handler.
  * @param   pvUserR3        User argument to the R3 handler.
- * @param   pfnHandlerR0    The R0 handler.
  * @param   pvUserR0        User argument to the R0 handler.
- * @param   pfnHandlerRC    The RC handler.
  * @param   pvUserRC        User argument to the RC handler. Values larger or
  *                          equal to 0x10000 will be relocated automatically.
- * @param   pszDesc         Pointer to description string. This must not be freed.
  */
-VMMDECL(int) PGMHandlerPhysicalChangeCallbacks(PVM pVM, RTGCPHYS GCPhys,
-                                               R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
-                                               R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
-                                               RCPTRTYPE(PFNPGMRCPHYSHANDLER) pfnHandlerRC, RTRCPTR pvUserRC,
-                                               R3PTRTYPE(const char *) pszDesc)
+VMMDECL(int) PGMHandlerPhysicalChangeUserArgs(PVM pVM, RTGCPHYS GCPhys, RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC)
 {
     /*
-     * Get the handler.
+     * Find the handler.
      */
     int rc = VINF_SUCCESS;
     pgmLock(pVM);
@@ -670,15 +733,11 @@ VMMDECL(int) PGMHandlerPhysicalChangeCallbacks(PVM pVM, RTGCPHYS GCPhys,
     if (pCur)
     {
         /*
-         * Change callbacks.
+         * Change arguments.
          */
-        pCur->pfnHandlerR3  = pfnHandlerR3;
-        pCur->pvUserR3      = pvUserR3;
-        pCur->pfnHandlerR0  = pfnHandlerR0;
-        pCur->pvUserR0      = pvUserR0;
-        pCur->pfnHandlerRC  = pfnHandlerRC;
-        pCur->pvUserRC      = pvUserRC;
-        pCur->pszDesc       = pszDesc;
+        pCur->pvUserR3 = pvUserR3;
+        pCur->pvUserR0 = pvUserR0;
+        pCur->pvUserRC = pvUserRC;
     }
     else
     {
@@ -783,9 +842,7 @@ VMMDECL(int) PGMHandlerPhysicalJoin(PVM pVM, RTGCPHYS GCPhys1, RTGCPHYS GCPhys2)
              */
             if (RT_LIKELY(pCur1->Core.KeyLast + 1 == pCur2->Core.Key))
             {
-                if (RT_LIKELY(    pCur1->pfnHandlerRC == pCur2->pfnHandlerRC
-                              &&  pCur1->pfnHandlerR0 == pCur2->pfnHandlerR0
-                              &&  pCur1->pfnHandlerR3 == pCur2->pfnHandlerR3))
+                if (RT_LIKELY(pCur1->hType == pCur2->hType))
                 {
                     PPGMPHYSHANDLER pCur3 = (PPGMPHYSHANDLER)RTAvlroGCPhysRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys2);
                     if (RT_LIKELY(pCur3 == pCur2))
@@ -797,6 +854,7 @@ VMMDECL(int) PGMHandlerPhysicalJoin(PVM pVM, RTGCPHYS GCPhys1, RTGCPHYS GCPhys2)
                         pVM->pgm.s.pLastPhysHandlerR0 = 0;
                         pVM->pgm.s.pLastPhysHandlerR3 = 0;
                         pVM->pgm.s.pLastPhysHandlerRC = 0;
+                        PGMHandlerPhysicalTypeRelease(pVM, pCur2->hType);
                         MMHyperFree(pVM, pCur2);
                         pgmUnlock(pVM);
                         return VINF_SUCCESS;
@@ -862,13 +920,14 @@ VMMDECL(int) PGMHandlerPhysicalReset(PVM pVM, RTGCPHYS GCPhys)
     if (RT_LIKELY(pCur))
     {
         /*
-         * Validate type.
+         * Validate kind.
          */
-        switch (pCur->enmType)
+        PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+        switch (pCurType->enmKind)
         {
-            case PGMPHYSHANDLERTYPE_PHYSICAL_WRITE:
-            case PGMPHYSHANDLERTYPE_PHYSICAL_ALL:
-            case PGMPHYSHANDLERTYPE_MMIO: /* NOTE: Only use when clearing MMIO ranges with aliased MMIO2 pages! */
+            case PGMPHYSHANDLERKIND_WRITE:
+            case PGMPHYSHANDLERKIND_ALL:
+            case PGMPHYSHANDLERKIND_MMIO: /* NOTE: Only use when clearing MMIO ranges with aliased MMIO2 pages! */
             {
                 STAM_COUNTER_INC(&pVM->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,PhysHandlerReset)); /**@Todo move out of switch */
                 PPGMRAMRANGE pRam = pgmPhysGetRange(pVM, GCPhys);
@@ -876,7 +935,7 @@ VMMDECL(int) PGMHandlerPhysicalReset(PVM pVM, RTGCPHYS GCPhys)
                 Assert(pRam->GCPhys     <= pCur->Core.Key);
                 Assert(pRam->GCPhysLast >= pCur->Core.KeyLast);
 
-                if (pCur->enmType == PGMPHYSHANDLERTYPE_MMIO)
+                if (pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO)
                 {
                     /*
                      * Reset all the PGMPAGETYPE_MMIO2_ALIAS_MMIO pages first and that's it.
@@ -926,7 +985,7 @@ VMMDECL(int) PGMHandlerPhysicalReset(PVM pVM, RTGCPHYS GCPhys)
              * Invalid.
              */
             default:
-                AssertMsgFailed(("Invalid type %d! Corruption!\n",  pCur->enmType));
+                AssertMsgFailed(("Invalid type %d! Corruption!\n",  pCurType->enmKind));
                 rc = VERR_PGM_PHYS_HANDLER_IPE;
                 break;
         }
@@ -978,8 +1037,9 @@ VMMDECL(int)  PGMHandlerPhysicalPageTempOff(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS G
             Assert(!(pCur->Core.Key & PAGE_OFFSET_MASK));
             Assert((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK);
 
-            AssertReturnStmt(   pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE
-                             || pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL,
+            PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+            AssertReturnStmt(   pCurType->enmKind == PGMPHYSHANDLERKIND_WRITE
+                             || pCurType->enmKind == PGMPHYSHANDLERKIND_ALL,
                              pgmUnlock(pVM), VERR_ACCESS_DENIED);
 
             /*
@@ -1051,8 +1111,8 @@ VMMDECL(int)  PGMHandlerPhysicalPageTempOff(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS G
 VMMDECL(int)  PGMHandlerPhysicalPageAlias(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTGCPHYS GCPhysPageRemap)
 {
 ///    Assert(!IOMIsLockOwner(pVM)); /* We mustn't own any other locks when calling this */
-
     pgmLock(pVM);
+
     /*
      * Lookup and validate the range.
      */
@@ -1062,7 +1122,8 @@ VMMDECL(int)  PGMHandlerPhysicalPageAlias(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCP
         if (RT_LIKELY(    GCPhysPage >= pCur->Core.Key
                       &&  GCPhysPage <= pCur->Core.KeyLast))
         {
-            AssertReturnStmt(pCur->enmType == PGMPHYSHANDLERTYPE_MMIO, pgmUnlock(pVM), VERR_ACCESS_DENIED);
+            PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+            AssertReturnStmt(pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO, pgmUnlock(pVM), VERR_ACCESS_DENIED);
             AssertReturnStmt(!(pCur->Core.Key & PAGE_OFFSET_MASK), pgmUnlock(pVM), VERR_INVALID_PARAMETER);
             AssertReturnStmt((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, pgmUnlock(pVM), VERR_INVALID_PARAMETER);
 
@@ -1169,18 +1230,19 @@ VMMDECL(int)  PGMHandlerPhysicalPageAlias(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCP
 VMMDECL(int)  PGMHandlerPhysicalPageAliasHC(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS GCPhysPage, RTHCPHYS HCPhysPageRemap)
 {
 ///    Assert(!IOMIsLockOwner(pVM)); /* We mustn't own any other locks when calling this */
+    pgmLock(pVM);
 
     /*
      * Lookup and validate the range.
      */
-    pgmLock(pVM);
     PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)RTAvlroGCPhysGet(&pVM->pgm.s.CTX_SUFF(pTrees)->PhysHandlers, GCPhys);
     if (RT_LIKELY(pCur))
     {
         if (RT_LIKELY(    GCPhysPage >= pCur->Core.Key
                       &&  GCPhysPage <= pCur->Core.KeyLast))
         {
-            AssertReturnStmt(pCur->enmType == PGMPHYSHANDLERTYPE_MMIO, pgmUnlock(pVM), VERR_ACCESS_DENIED);
+            PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+            AssertReturnStmt(pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO, pgmUnlock(pVM), VERR_ACCESS_DENIED);
             AssertReturnStmt(!(pCur->Core.Key & PAGE_OFFSET_MASK), pgmUnlock(pVM), VERR_INVALID_PARAMETER);
             AssertReturnStmt((pCur->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK, pgmUnlock(pVM), VERR_INVALID_PARAMETER);
 
@@ -1253,10 +1315,13 @@ VMMDECL(bool) PGMHandlerPhysicalIsRegistered(PVM pVM, RTGCPHYS GCPhys)
     PPGMPHYSHANDLER pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
     if (pCur)
     {
+#ifdef VBOX_STRICT
         Assert(GCPhys >= pCur->Core.Key && GCPhys <= pCur->Core.KeyLast);
-        Assert(     pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE
-               ||   pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL
-               ||   pCur->enmType == PGMPHYSHANDLERTYPE_MMIO);
+        PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+        Assert(   pCurType->enmKind == PGMPHYSHANDLERKIND_WRITE
+               || pCurType->enmKind == PGMPHYSHANDLERKIND_ALL
+               || pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO);
+#endif
         pgmUnlock(pVM);
         return true;
     }
@@ -1286,20 +1351,88 @@ bool pgmHandlerPhysicalIsAll(PVM pVM, RTGCPHYS GCPhys)
         AssertFailed();
         return true;
     }
-    Assert(     pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_WRITE
-           ||   pCur->enmType == PGMPHYSHANDLERTYPE_PHYSICAL_ALL
-           ||   pCur->enmType == PGMPHYSHANDLERTYPE_MMIO); /* sanity */
+    PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+    Assert(   pCurType->enmKind == PGMPHYSHANDLERKIND_WRITE
+           || pCurType->enmKind == PGMPHYSHANDLERKIND_ALL
+           || pCurType->enmKind == PGMPHYSHANDLERKIND_MMIO); /* sanity */
     /* Only whole pages can be disabled. */
     Assert(   pCur->Core.Key     <= (GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK)
            && pCur->Core.KeyLast >= (GCPhys | PAGE_OFFSET_MASK));
 
-    bool bRet = pCur->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE;
+    bool bRet = pCurType->enmKind != PGMPHYSHANDLERKIND_WRITE;
     pgmUnlock(pVM);
     return bRet;
 }
 
 
 /**
+ * Internal worker for releasing a virtual handler type registration reference.
+ *
+ * @returns New reference count. UINT32_MAX if invalid input (asserted).
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   pType       Pointer to the type registration.
+ */
+DECLINLINE(uint32_t) pgmHandlerVirtualTypeRelease(PVM pVM, PPGMVIRTHANDLERTYPEINT pType)
+{
+    AssertMsgReturn(pType->u32Magic == PGMVIRTHANDLERTYPEINT_MAGIC, ("%#x\n", pType->u32Magic), UINT32_MAX);
+    uint32_t cRefs = ASMAtomicDecU32(&pType->cRefs);
+    if (cRefs == 0)
+    {
+        pgmLock(pVM);
+        pType->u32Magic = PGMVIRTHANDLERTYPEINT_MAGIC_DEAD;
+        RTListOff32NodeRemove(&pType->ListNode);
+        pgmUnlock(pVM);
+        MMHyperFree(pVM, pType);
+    }
+    return cRefs;
+}
+
+
+/**
+ * Internal worker for retaining a virtual handler type registration reference.
+ *
+ * @returns New reference count. UINT32_MAX if invalid input (asserted).
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   pType       Pointer to the type registration.
+ */
+DECLINLINE(uint32_t) pgmHandlerVirtualTypeRetain(PVM pVM, PPGMVIRTHANDLERTYPEINT pType)
+{
+    AssertMsgReturn(pType->u32Magic == PGMVIRTHANDLERTYPEINT_MAGIC, ("%#x\n", pType->u32Magic), UINT32_MAX);
+    uint32_t cRefs = ASMAtomicIncU32(&pType->cRefs);
+    Assert(cRefs < _1M && cRefs > 0);
+    return cRefs;
+}
+
+
+/**
+ * Releases a reference to a virtual handler type registration.
+ *
+ * @returns New reference count. UINT32_MAX if invalid input (asserted).
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   hType       The type regiration handle.
+ */
+VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRelease(PVM pVM, PGMVIRTHANDLERTYPE hType)
+{
+    if (hType != NIL_PGMVIRTHANDLERTYPE)
+        return pgmHandlerVirtualTypeRelease(pVM, PGMVIRTHANDLERTYPEINT_FROM_HANDLE(pVM, hType));
+    return 0;
+}
+
+
+/**
+ * Retains a reference to a virtual handler type registration.
+ *
+ * @returns New reference count. UINT32_MAX if invalid input (asserted).
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   hType       The type regiration handle.
+ */
+VMM_INT_DECL(uint32_t) PGMHandlerVirtualTypeRetain(PVM pVM, PGMVIRTHANDLERTYPE hType)
+{
+    return pgmHandlerVirtualTypeRetain(pVM, PGMVIRTHANDLERTYPEINT_FROM_HANDLE(pVM, hType));
+}
+
+
+/**
  * Check if particular guest's VA is being monitored.
  *
  * @returns true or false
@@ -1308,7 +1441,7 @@ bool pgmHandlerPhysicalIsAll(PVM pVM, RTGCPHYS GCPhys)
  * @remarks Will acquire the PGM lock.
  * @thread  Any.
  */
-VMMDECL(bool) PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr)
+VMM_INT_DECL(bool) PGMHandlerVirtualIsRegistered(PVM pVM, RTGCPTR GCPtr)
 {
     pgmLock(pVM);
     PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrGet(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, GCPtr);
@@ -1426,7 +1559,7 @@ DECLCALLBACK(int) pgmHandlerVirtualResetOne(PAVLROGCPTRNODECORE pNode, void *pvU
     /*
      * Iterate the pages and apply the new state.
      */
-    unsigned        uState   = pgmHandlerVirtualCalcState(pCur);
+    uint32_t        uState   = PGMVIRTANDLER_GET_TYPE(pVM, pCur)->uState;
     PPGMRAMRANGE    pRamHint = NULL;
     RTGCUINTPTR     offPage  = ((RTGCUINTPTR)pCur->Core.Key & PAGE_OFFSET_MASK);
     RTGCUINTPTR     cbLeft   = pCur->cb;
@@ -1578,24 +1711,25 @@ static DECLCALLBACK(int) pgmHandlerVirtualVerifyOneByPhysAddr(PAVLROGCPTRNODECOR
  */
 static DECLCALLBACK(int) pgmHandlerVirtualVerifyOne(PAVLROGCPTRNODECORE pNode, void *pvUser)
 {
-    PPGMVIRTHANDLER pVirt   = (PPGMVIRTHANDLER)pNode;
-    PPGMAHAFIS      pState  = (PPGMAHAFIS)pvUser;
-    PVM             pVM     = pState->pVM;
+    PPGMAHAFIS              pState  = (PPGMAHAFIS)pvUser;
+    PVM                     pVM     = pState->pVM;
+    PPGMVIRTHANDLER         pVirt   = (PPGMVIRTHANDLER)pNode;
+    PPGMVIRTHANDLERTYPEINT  pType   = PGMVIRTANDLER_GET_TYPE(pVM, pVirt);
 
     /*
      * Validate the type and calc state.
      */
-    switch (pVirt->enmType)
+    switch (pType->enmKind)
     {
-        case PGMVIRTHANDLERTYPE_WRITE:
-        case PGMVIRTHANDLERTYPE_ALL:
+        case PGMVIRTHANDLERKIND_WRITE:
+        case PGMVIRTHANDLERKIND_ALL:
             break;
         default:
-            AssertMsgFailed(("unknown/wrong enmType=%d\n", pVirt->enmType));
+            AssertMsgFailed(("unknown/wrong enmKind=%d\n", pType->enmKind));
             pState->cErrors++;
             return 0;
     }
-    const unsigned uState = pgmHandlerVirtualCalcState(pVirt);
+    const uint32_t uState = pType->uState;
 
     /*
      * Check key alignment.
@@ -1723,7 +1857,8 @@ VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM)
                     }
                     if (pPhys)
                     {
-                        unsigned uState = pgmHandlerPhysicalCalcState(pPhys);
+                        PPGMPHYSHANDLERTYPEINT pPhysType = (PPGMPHYSHANDLERTYPEINT)MMHyperHeapOffsetToPtr(pVM, pPhys->hType);
+                        unsigned uState = pPhysType->uState;
 
                         /* more? */
                         while (pPhys->Core.KeyLast < (State.GCPhys | PAGE_OFFSET_MASK))
@@ -1733,8 +1868,8 @@ VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM)
                             if (    !pPhys2
                                 ||  pPhys2->Core.Key > (State.GCPhys | PAGE_OFFSET_MASK))
                                 break;
-                            unsigned uState2 = pgmHandlerPhysicalCalcState(pPhys2);
-                            uState = RT_MAX(uState, uState2);
+                            PPGMPHYSHANDLERTYPEINT pPhysType2 = (PPGMPHYSHANDLERTYPEINT)MMHyperHeapOffsetToPtr(pVM, pPhys2->hType);
+                            uState = RT_MAX(uState, pPhysType2->uState);
                             pPhys = pPhys2;
                         }
 
@@ -1743,7 +1878,7 @@ VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM)
                             &&  PGM_PAGE_GET_HNDL_PHYS_STATE(pPage) != PGM_PAGE_HNDL_PHYS_STATE_DISABLED)
                         {
                             AssertMsgFailed(("ram range vs phys handler flags mismatch. GCPhys=%RGp state=%d expected=%d %s\n",
-                                             State.GCPhys, PGM_PAGE_GET_HNDL_PHYS_STATE(pPage), uState, pPhys->pszDesc));
+                                             State.GCPhys, PGM_PAGE_GET_HNDL_PHYS_STATE(pPage), uState, pPhysType->pszDesc));
                             State.cErrors++;
                         }
 
@@ -1755,7 +1890,7 @@ VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM)
                             &&  PGM_PAGE_GET_TYPE(pPage) != PGMPAGETYPE_ROM_SHADOW)
                         {
                             AssertMsgFailed(("ram range vs phys handler REM mismatch. GCPhys=%RGp state=%d %s\n",
-                                             State.GCPhys, PGM_PAGE_GET_HNDL_PHYS_STATE(pPage), pPhys->pszDesc));
+                                             State.GCPhys, PGM_PAGE_GET_HNDL_PHYS_STATE(pPage), pPhysType->pszDesc));
                             State.cErrors++;
                         }
 # endif
@@ -1789,7 +1924,7 @@ VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM)
                         /* the head */
                         GCPhysKey = pPhys2Virt->Core.KeyLast;
                         PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)((uintptr_t)pPhys2Virt + pPhys2Virt->offVirtHandler);
-                        unsigned uState = pgmHandlerVirtualCalcState(pCur);
+                        unsigned uState = PGMVIRTANDLER_GET_TYPE(pVM, pCur)->uState;
                         State.uVirtStateFound = RT_MAX(State.uVirtStateFound, uState);
 
                         /* any aliases */
@@ -1797,7 +1932,7 @@ VMMDECL(unsigned) PGMAssertHandlerAndFlagsInSync(PVM pVM)
                         {
                             pPhys2Virt = (PPGMPHYS2VIRTHANDLER)((uintptr_t)pPhys2Virt + (pPhys2Virt->offNextAlias & PGMPHYS2VIRTHANDLER_OFF_MASK));
                             pCur = (PPGMVIRTHANDLER)((uintptr_t)pPhys2Virt + pPhys2Virt->offVirtHandler);
-                            uState = pgmHandlerVirtualCalcState(pCur);
+                            uState = PGMVIRTANDLER_GET_TYPE(pVM, pCur)->uState;
                             State.uVirtStateFound = RT_MAX(State.uVirtStateFound, uState);
                         }
 
diff --git a/src/VBox/VMM/VMMAll/PGMAllPhys.cpp b/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
index d98ec57..cb816f6 100644
--- a/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
+++ b/src/VBox/VMM/VMMAll/PGMAllPhys.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -57,15 +57,18 @@
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   GCPhysFault The GC physical address corresponding to pvFault.
  * @param   pvUser      User argument.
  */
-VMMDECL(int) pgmPhysHandlerRedirectToHC(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
+VMMDECL(int) pgmPhysPfHandlerRedirectToHC(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                          RTGCPHYS GCPhysFault, void *pvUser)
 {
-    NOREF(pVM); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(GCPhysFault); NOREF(pvUser);
+    NOREF(pVM); NOREF(pVCpu); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(GCPhysFault); NOREF(pvUser);
     return (uErrorCode & X86_TRAP_PF_RW) ? VINF_IOM_R3_MMIO_WRITE : VINF_IOM_R3_MMIO_READ;
 }
 
@@ -76,18 +79,20 @@ VMMDECL(int) pgmPhysHandlerRedirectToHC(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCO
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   GCPhysFault The GC physical address corresponding to pvFault.
  * @param   pvUser      User argument. Pointer to the ROM range structure.
  */
-VMMDECL(int) pgmPhysRomWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser)
+DECLEXPORT(int) pgmPhysRomWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                         RTGCPHYS GCPhysFault, void *pvUser)
 {
     int             rc;
     PPGMROMRANGE    pRom = (PPGMROMRANGE)pvUser;
     uint32_t        iPage = (GCPhysFault - pRom->GCPhys) >> PAGE_SHIFT;
-    PVMCPU          pVCpu = VMMGetCpu(pVM);
     NOREF(uErrorCode); NOREF(pvFault);
 
     Assert(uErrorCode & X86_TRAP_PF_RW); /* This shall not be used for read access! */
@@ -143,7 +148,111 @@ VMMDECL(int) pgmPhysRomWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE p
     return VINF_EM_RAW_EMULATE_INSTR;
 }
 
-#endif /* IN_RING3 */
+#endif /* !IN_RING3 */
+
+
+/**
+ * Access handler callback for ROM write accesses.
+ *
+ * @returns VINF_SUCCESS if the handler have carried out the operation.
+ * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
+ * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           The cross context CPU structure for the calling EMT.
+ * @param   GCPhys          The physical address the guest is writing to.
+ * @param   pvPhys          The HC mapping of that address.
+ * @param   pvBuf           What the guest is reading/writing.
+ * @param   cbBuf           How much it's reading/writing.
+ * @param   enmAccessType   The access type.
+ * @param   enmOrigin       Who is making the access.
+ * @param   pvUser          User argument.
+ */
+PGM_ALL_CB2_DECL(int) pgmPhysRomWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                             PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
+{
+    PPGMROMRANGE    pRom     = (PPGMROMRANGE)pvUser;
+    const uint32_t  iPage    = (GCPhys - pRom->GCPhys) >> PAGE_SHIFT;
+    Assert(iPage < (pRom->cb >> PAGE_SHIFT));
+    PPGMROMPAGE     pRomPage = &pRom->aPages[iPage];
+    Log5(("pgmPhysRomWriteHandler: %d %c %#08RGp %#04zx\n", pRomPage->enmProt, enmAccessType == PGMACCESSTYPE_READ ? 'R' : 'W', GCPhys, cbBuf));
+    NOREF(pVCpu); NOREF(pvPhys); NOREF(enmOrigin);
+
+    if (enmAccessType == PGMACCESSTYPE_READ)
+    {
+        switch (pRomPage->enmProt)
+        {
+            /*
+             * Take the default action.
+             */
+            case PGMROMPROT_READ_ROM_WRITE_IGNORE:
+            case PGMROMPROT_READ_RAM_WRITE_IGNORE:
+            case PGMROMPROT_READ_ROM_WRITE_RAM:
+            case PGMROMPROT_READ_RAM_WRITE_RAM:
+                return VINF_PGM_HANDLER_DO_DEFAULT;
+
+            default:
+                AssertMsgFailedReturn(("enmProt=%d iPage=%d GCPhys=%RGp\n",
+                                       pRom->aPages[iPage].enmProt, iPage, GCPhys),
+                                      VERR_IPE_NOT_REACHED_DEFAULT_CASE);
+        }
+    }
+    else
+    {
+        Assert(enmAccessType == PGMACCESSTYPE_WRITE);
+        switch (pRomPage->enmProt)
+        {
+            /*
+             * Ignore writes.
+             */
+            case PGMROMPROT_READ_ROM_WRITE_IGNORE:
+            case PGMROMPROT_READ_RAM_WRITE_IGNORE:
+                return VINF_SUCCESS;
+
+            /*
+             * Write to the RAM page.
+             */
+            case PGMROMPROT_READ_ROM_WRITE_RAM:
+            case PGMROMPROT_READ_RAM_WRITE_RAM: /* yes this will get here too, it's *way* simpler that way. */
+            {
+                /* This should be impossible now, pvPhys doesn't work cross page anylonger. */
+                Assert(((GCPhys - pRom->GCPhys + cbBuf - 1) >> PAGE_SHIFT) == iPage);
+
+                /*
+                 * Take the lock, do lazy allocation, map the page and copy the data.
+                 *
+                 * Note that we have to bypass the mapping TLB since it works on
+                 * guest physical addresses and entering the shadow page would
+                 * kind of screw things up...
+                 */
+                int rc = pgmLock(pVM);
+                AssertRC(rc);
+
+                PPGMPAGE pShadowPage = &pRomPage->Shadow;
+                if (!PGMROMPROT_IS_ROM(pRomPage->enmProt))
+                {
+                    pShadowPage = pgmPhysGetPage(pVM, GCPhys);
+                    AssertLogRelReturn(pShadowPage, VERR_PGM_PHYS_PAGE_GET_IPE);
+                }
+
+                void *pvDstPage;
+                rc = pgmPhysPageMakeWritableAndMap(pVM, pShadowPage, GCPhys & X86_PTE_PG_MASK, &pvDstPage);
+                if (RT_SUCCESS(rc))
+                {
+                    memcpy((uint8_t *)pvDstPage + (GCPhys & PAGE_OFFSET_MASK), pvBuf, cbBuf);
+                    pRomPage->LiveSave.fWrittenTo = true;
+                }
+
+                pgmUnlock(pVM);
+                return rc;
+            }
+
+            default:
+                AssertMsgFailedReturn(("enmProt=%d iPage=%d GCPhys=%RGp\n",
+                                       pRom->aPages[iPage].enmProt, iPage, GCPhys),
+                                      VERR_IPE_NOT_REACHED_DEFAULT_CASE);
+        }
+    }
+}
+
 
 /**
  * Invalidates the RAM range TLBs.
@@ -1011,6 +1120,7 @@ int pgmPhysPageMapByPageID(PVM pVM, uint32_t idPage, RTHCPHYS HCPhys, void **ppv
 static int pgmPhysPageMapCommon(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPPGMPAGEMAP ppMap, void **ppv)
 {
     PGM_LOCK_ASSERT_OWNER(pVM);
+    NOREF(GCPhys);
 
 #if defined(IN_RC) || defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0)
     /*
@@ -1020,7 +1130,6 @@ static int pgmPhysPageMapCommon(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPPGMP
     RTHCPHYS HCPhys = PGM_PAGE_GET_HCPHYS(pPage);
     Assert(HCPhys != pVM->pgm.s.HCPhysZeroPg);
     pgmRZDynMapHCPageInlined(VMMGetCpu(pVM), HCPhys, ppv RTLOG_COMMA_SRC_POS);
-    NOREF(GCPhys);
     return VINF_SUCCESS;
 
 #else /* IN_RING3 || IN_RING0 */
@@ -1035,8 +1144,11 @@ static int pgmPhysPageMapCommon(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, PPPGMP
         /* Decode the page id to a page in a MMIO2 ram range. */
         uint8_t  idMmio2 = PGM_MMIO2_PAGEID_GET_MMIO2_ID(PGM_PAGE_GET_PAGEID(pPage));
         uint32_t iPage   = PGM_MMIO2_PAGEID_GET_IDX(PGM_PAGE_GET_PAGEID(pPage));
-        AssertLogRelReturn((uint8_t)(idMmio2 - 1U)< RT_ELEMENTS(pVM->pgm.s.CTX_SUFF(apMmio2Ranges)),
-                            VERR_PGM_PHYS_PAGE_MAP_MMIO2_IPE);
+        AssertLogRelMsgReturn((uint8_t)(idMmio2 - 1U) < RT_ELEMENTS(pVM->pgm.s.CTX_SUFF(apMmio2Ranges)),
+                              ("idMmio2=%u size=%u type=%u GCPHys=%#RGp Id=%u State=%u", idMmio2,
+                               RT_ELEMENTS(pVM->pgm.s.CTX_SUFF(apMmio2Ranges)), PGM_PAGE_GET_TYPE(pPage), GCPhys,
+                               pPage->s.idPage, pPage->s.uStateY),
+                              VERR_PGM_PHYS_PAGE_MAP_MMIO2_IPE);
         PPGMMMIO2RANGE pMmio2Range = pVM->pgm.s.CTX_SUFF(apMmio2Ranges)[idMmio2 - 1];
         AssertLogRelReturn(pMmio2Range, VERR_PGM_PHYS_PAGE_MAP_MMIO2_IPE);
         AssertLogRelReturn(pMmio2Range->idMmio2 == idMmio2, VERR_PGM_PHYS_PAGE_MAP_MMIO2_IPE);
@@ -2076,8 +2188,9 @@ static void pgmPhysCacheAdd(PVM pVM, PGMPHYSCACHE *pCache, RTGCPHYS GCPhys, uint
  * @param   GCPhys      The physical address to start reading at.
  * @param   pvBuf       Where to put the bits we read.
  * @param   cb          How much to read - less or equal to a page.
+ * @param   enmOrigin       The origin of this call.
  */
-static int pgmPhysReadHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void *pvBuf, size_t cb)
+static int pgmPhysReadHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void *pvBuf, size_t cb, PGMACCESSORIGIN enmOrigin)
 {
     /*
      * The most frequent access here is MMIO and shadowed ROM.
@@ -2102,6 +2215,7 @@ static int pgmPhysReadHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void *pv
     /*
      * Deal with any physical handlers.
      */
+    PVMCPU pVCpu = VMMGetCpu(pVM);
 #ifdef IN_RING3
     PPGMPHYSHANDLER pPhys = NULL;
 #endif
@@ -2114,9 +2228,8 @@ static int pgmPhysReadHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void *pv
         Assert(GCPhys >= pPhys->Core.Key && GCPhys <= pPhys->Core.KeyLast);
         Assert((pPhys->Core.Key     & PAGE_OFFSET_MASK) == 0);
         Assert((pPhys->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK);
-        Assert(pPhys->CTX_SUFF(pfnHandler));
 
-        PFNPGMR3PHYSHANDLER pfnHandler = pPhys->CTX_SUFF(pfnHandler);
+        PFNPGMPHYSHANDLER pfnHandler = PGMPHYSHANDLER_GET_TYPE(pVM, pPhys)->CTX_SUFF(pfnHandler); Assert(pfnHandler);
         void *pvUser = pPhys->CTX_SUFF(pvUser);
 
         Log5(("pgmPhysReadHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] phys %s\n", GCPhys, cb, pPage, R3STRING(pPhys->pszDesc) ));
@@ -2124,7 +2237,7 @@ static int pgmPhysReadHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void *pv
         PGM_LOCK_ASSERT_OWNER(pVM);
         /* Release the PGM lock as MMIO handlers take the IOM lock. (deadlock prevention) */
         pgmUnlock(pVM);
-        rc = pfnHandler(pVM, GCPhys, (void *)pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, pvUser);
+        rc = pfnHandler(pVM, pVCpu, GCPhys, (void *)pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, enmOrigin, pvUser);
         pgmLock(pVM);
 # ifdef VBOX_WITH_STATISTICS
         pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
@@ -2156,8 +2269,9 @@ static int pgmPhysReadHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void *pv
         Assert((pVirt->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK);
         Assert(GCPhys >= pVirt->aPhysToVirt[iPage].Core.Key && GCPhys <= pVirt->aPhysToVirt[iPage].Core.KeyLast);
 
+        PPGMVIRTHANDLERTYPEINT pVirtType = PGMVIRTANDLER_GET_TYPE(pVM, pVirt);
 #ifdef IN_RING3
-        if (pVirt->pfnHandlerR3)
+        if (pVirtType->pfnHandlerR3)
         {
             if (!pPhys)
                 Log5(("pgmPhysReadHandler: GCPhys=%RGp cb=%#x pPage=%R[pgmpage] virt %s\n", GCPhys, cb, pPage, R3STRING(pVirt->pszDesc) ));
@@ -2168,7 +2282,8 @@ static int pgmPhysReadHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void *pv
                               + (GCPhys & PAGE_OFFSET_MASK);
 
             STAM_PROFILE_START(&pVirt->Stat, h);
-            rc2 = pVirt->CTX_SUFF(pfnHandler)(pVM, GCPtr, (void *)pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, /*pVirt->CTX_SUFF(pvUser)*/ NULL);
+            rc2 = pVirtType->CTX_SUFF(pfnHandler)(pVM, pVCpu, GCPtr, (void *)pvSrc, pvBuf, cb, PGMACCESSTYPE_READ, enmOrigin,
+                                                  pVirt->CTX_SUFF(pvUser));
             STAM_PROFILE_STOP(&pVirt->Stat, h);
             if (rc2 == VINF_SUCCESS)
                 rc = VINF_SUCCESS;
@@ -2208,8 +2323,9 @@ static int pgmPhysReadHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void *pv
  * @param   GCPhys          Physical address start reading from.
  * @param   pvBuf           Where to put the read bits.
  * @param   cbRead          How many bytes to read.
+ * @param   enmOrigin       The origin of this call.
  */
-VMMDECL(int) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
+VMMDECL(int) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin)
 {
     AssertMsgReturn(cbRead > 0, ("don't even think about reading zero bytes!\n"), VINF_SUCCESS);
     LogFlow(("PGMPhysRead: %RGp %d\n", GCPhys, cbRead));
@@ -2246,7 +2362,7 @@ VMMDECL(int) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
                 if (RT_UNLIKELY(   PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage)
                                 || PGM_PAGE_IS_SPECIAL_ALIAS_MMIO(pPage)))
                 {
-                    int rc = pgmPhysReadHandler(pVM, pPage, pRam->GCPhys + off, pvBuf, cb);
+                    int rc = pgmPhysReadHandler(pVM, pPage, pRam->GCPhys + off, pvBuf, cb, enmOrigin);
                     if (RT_FAILURE(rc))
                     {
                         pgmUnlock(pVM);
@@ -2329,8 +2445,10 @@ VMMDECL(int) PGMPhysRead(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
  * @param   GCPhys      The physical address to start writing at.
  * @param   pvBuf       What to write.
  * @param   cbWrite     How much to write - less or equal to a page.
+ * @param   enmOrigin       The origin of this call.
  */
-static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void const *pvBuf, size_t cbWrite)
+static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void const *pvBuf, size_t cbWrite,
+                               PGMACCESSORIGIN enmOrigin)
 {
     PGMPAGEMAPLOCK  PgMpLck;
     void           *pvDst = NULL;
@@ -2343,6 +2461,7 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
      * write area. This should be a pretty frequent case with MMIO and
      * the heavy usage of full page handlers in the page pool.
      */
+    PVMCPU pVCpu = VMMGetCpu(pVM);
     if (   !PGM_PAGE_HAS_ACTIVE_VIRTUAL_HANDLERS(pPage)
         || PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage) /* screw virtual handlers on MMIO pages */)
     {
@@ -2350,7 +2469,6 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
         if (pCur)
         {
             Assert(GCPhys >= pCur->Core.Key && GCPhys <= pCur->Core.KeyLast);
-            Assert(pCur->CTX_SUFF(pfnHandler));
 
             size_t cbRange = pCur->Core.KeyLast - GCPhys + 1;
             if (cbRange > cbWrite)
@@ -2363,21 +2481,23 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
             return VERR_PGM_PHYS_WR_HIT_HANDLER;
 
 #else  /* IN_RING3 */
-            Log5(("pgmPhysWriteHandler: GCPhys=%RGp cbRange=%#x pPage=%R[pgmpage] phys %s\n", GCPhys, cbRange, pPage, R3STRING(pCur->pszDesc) ));
+            Assert(PGMPHYSHANDLER_GET_TYPE(pVM, pCur)->CTX_SUFF(pfnHandler));
+            Log5(("pgmPhysWriteHandler: GCPhys=%RGp cbRange=%#x pPage=%R[pgmpage] phys %s\n",
+                  GCPhys, cbRange, pPage, R3STRING(pCur->pszDesc) ));
             if (!PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage))
                 rc = pgmPhysGCPhys2CCPtrInternal(pVM, pPage, GCPhys, &pvDst, &PgMpLck);
             else
                 rc = VINF_SUCCESS;
             if (RT_SUCCESS(rc))
             {
-                PFNPGMR3PHYSHANDLER pfnHandler = pCur->CTX_SUFF(pfnHandler);
+                PFNPGMPHYSHANDLER pfnHandler = PGMPHYSHANDLER_GET_TYPE(pVM, pCur)->CTX_SUFF(pfnHandler);
                 void *pvUser = pCur->CTX_SUFF(pvUser);
 
                 STAM_PROFILE_START(&pCur->Stat, h);
                 PGM_LOCK_ASSERT_OWNER(pVM);
                 /* Release the PGM lock as MMIO handlers take the IOM lock. (deadlock prevention) */
                 pgmUnlock(pVM);
-                rc = pfnHandler(pVM, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, pvUser);
+                rc = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
                 pgmLock(pVM);
 # ifdef VBOX_WITH_STATISTICS
                 pCur = pgmHandlerPhysicalLookup(pVM, GCPhys);
@@ -2392,7 +2512,8 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
                         memcpy(pvDst, pvBuf, cbRange);
                 }
                 else
-                    AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, (pCur) ? pCur->pszDesc : ""));
+                    AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT,
+                                    ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, pCur ? pCur->pszDesc : ""));
             }
             else
                 AssertLogRelMsgFailedReturn(("pgmPhysGCPhys2CCPtrInternal failed on %RGp / %R[pgmpage] -> %Rrc\n",
@@ -2425,6 +2546,8 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
         rc = pgmHandlerVirtualFindByPhysAddr(pVM, GCPhys, &pCur, &iPage);
         if (RT_SUCCESS(rc))
         {
+            PPGMVIRTHANDLERTYPEINT pCurType = PGMVIRTANDLER_GET_TYPE(pVM, pCur);
+
             size_t cbRange = (PAGE_OFFSET_MASK & pCur->Core.KeyLast) - (PAGE_OFFSET_MASK & GCPhys) + 1;
             if (cbRange > cbWrite)
                 cbRange = cbWrite;
@@ -2442,14 +2565,15 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
             if (RT_SUCCESS(rc))
             {
                 rc = VINF_PGM_HANDLER_DO_DEFAULT;
-                if (pCur->pfnHandlerR3)
+                if (pCurType->pfnHandlerR3)
                 {
                     RTGCUINTPTR GCPtr = ((RTGCUINTPTR)pCur->Core.Key & PAGE_BASE_GC_MASK)
                                       + (iPage << PAGE_SHIFT)
                                       + (GCPhys & PAGE_OFFSET_MASK);
 
                     STAM_PROFILE_START(&pCur->Stat, h);
-                    rc = pCur->CTX_SUFF(pfnHandler)(pVM, GCPtr, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, /*pCur->CTX_SUFF(pvUser)*/ NULL);
+                    rc = pCurType->CTX_SUFF(pfnHandler)(pVM, pVCpu, GCPtr, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE,
+                                                        enmOrigin, pCur->CTX_SUFF(pvUser));
                     STAM_PROFILE_STOP(&pCur->Stat, h);
                 }
                 if (rc == VINF_PGM_HANDLER_DO_DEFAULT)
@@ -2591,7 +2715,7 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
             if (cbRange > offVirt)
                 cbRange = offVirt;
 #ifdef IN_RING3
-            PFNPGMR3PHYSHANDLER pfnHandler = pPhys->CTX_SUFF(pfnHandler);
+            PFNPGMPHYSHANDLER pfnHandler = PGMPHYSHANDLER_GET_TYPE(pVM, pPhys)->CTX_SUFF(pfnHandler);
             void *pvUser = pPhys->CTX_SUFF(pvUser);
 
             Log5(("pgmPhysWriteHandler: GCPhys=%RGp cbRange=%#x pPage=%R[pgmpage] phys %s\n", GCPhys, cbRange, pPage, R3STRING(pPhys->pszDesc) ));
@@ -2599,7 +2723,7 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
             PGM_LOCK_ASSERT_OWNER(pVM);
             /* Release the PGM lock as MMIO handlers take the IOM lock. (deadlock prevention) */
             pgmUnlock(pVM);
-            rc = pfnHandler(pVM, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, pvUser);
+            rc = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
             pgmLock(pVM);
 # ifdef VBOX_WITH_STATISTICS
             pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
@@ -2626,15 +2750,18 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
                 cbRange = offVirtLast + 1;
             if (cbRange > offPhys)
                 cbRange = offPhys;
+
+            PPGMVIRTHANDLERTYPEINT pVirtType = PGMVIRTANDLER_GET_TYPE(pVM, pVirt);
 #ifdef IN_RING3
             Log5(("pgmPhysWriteHandler: GCPhys=%RGp cbRange=%#x pPage=%R[pgmpage] phys %s\n", GCPhys, cbRange, pPage, R3STRING(pVirt->pszDesc) ));
-            if (pVirt->pfnHandlerR3)
+            if (pVirtType->pfnHandlerR3)
             {
                 RTGCUINTPTR GCPtr = ((RTGCUINTPTR)pVirt->Core.Key & PAGE_BASE_GC_MASK)
                                   + (iVirtPage << PAGE_SHIFT)
                                   + (GCPhys & PAGE_OFFSET_MASK);
                 STAM_PROFILE_START(&pVirt->Stat, h);
-                rc = pVirt->CTX_SUFF(pfnHandler)(pVM, GCPtr, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, /*pCur->CTX_SUFF(pvUser)*/ NULL);
+                rc = pVirtType->CTX_SUFF(pfnHandler)(pVM, pVCpu, GCPtr, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE,
+                                                     enmOrigin, pVirt->CTX_SUFF(pvUser));
                 STAM_PROFILE_STOP(&pVirt->Stat, h);
                 AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, pVirt->pszDesc));
             }
@@ -2658,19 +2785,20 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
             if (cbRange > offPhysLast + 1)
                 cbRange = offPhysLast + 1;
 
+            PPGMVIRTHANDLERTYPEINT pVirtType = PGMVIRTANDLER_GET_TYPE(pVM, pVirt);
 #ifdef IN_RING3
-            if (pVirt->pfnHandlerR3)
+            if (pVirtType->pfnHandlerR3)
                 Log(("pgmPhysWriteHandler: overlapping phys and virt handlers at %RGp %R[pgmpage]; cbRange=%#x\n", GCPhys, pPage, cbRange));
             Log5(("pgmPhysWriteHandler: GCPhys=%RGp cbRange=%#x pPage=%R[pgmpage] phys/virt %s/%s\n", GCPhys, cbRange, pPage, R3STRING(pPhys->pszDesc), R3STRING(pVirt->pszDesc) ));
 
-            PFNPGMR3PHYSHANDLER pfnHandler = pPhys->CTX_SUFF(pfnHandler);
+            PFNPGMPHYSHANDLER pfnHandler = PGMPHYSHANDLER_GET_TYPE(pVM, pPhys)->CTX_SUFF(pfnHandler);
             void *pvUser = pPhys->CTX_SUFF(pvUser);
 
             STAM_PROFILE_START(&pPhys->Stat, h);
             PGM_LOCK_ASSERT_OWNER(pVM);
             /* Release the PGM lock as MMIO handlers take the IOM lock. (deadlock prevention) */
             pgmUnlock(pVM);
-            rc = pfnHandler(pVM, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, pvUser);
+            rc = pfnHandler(pVM, pVCpu, GCPhys, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, enmOrigin, pvUser);
             pgmLock(pVM);
 # ifdef VBOX_WITH_STATISTICS
             pPhys = pgmHandlerPhysicalLookup(pVM, GCPhys);
@@ -2680,14 +2808,15 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
             pPhys = NULL; /* might not be valid anymore. */
 # endif
             AssertLogRelMsg(rc == VINF_SUCCESS || rc == VINF_PGM_HANDLER_DO_DEFAULT, ("rc=%Rrc GCPhys=%RGp pPage=%R[pgmpage] %s\n", rc, GCPhys, pPage, (pPhys) ? pPhys->pszDesc : ""));
-            if (pVirt->pfnHandlerR3)
+            if (pVirtType->pfnHandlerR3)
             {
 
                 RTGCUINTPTR GCPtr = ((RTGCUINTPTR)pVirt->Core.Key & PAGE_BASE_GC_MASK)
                                   + (iVirtPage << PAGE_SHIFT)
                                   + (GCPhys & PAGE_OFFSET_MASK);
                 STAM_PROFILE_START(&pVirt->Stat, h2);
-                int rc2 = pVirt->CTX_SUFF(pfnHandler)(pVM, GCPtr, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE, /*pCur->CTX_SUFF(pvUser)*/ NULL);
+                int rc2 = pVirtType->CTX_SUFF(pfnHandler)(pVM, pVCpu, GCPtr, pvDst, (void *)pvBuf, cbRange, PGMACCESSTYPE_WRITE,
+                                                          enmOrigin, pVirt->CTX_SUFF(pvUser));
                 STAM_PROFILE_STOP(&pVirt->Stat, h2);
                 if (rc2 == VINF_SUCCESS && rc == VINF_PGM_HANDLER_DO_DEFAULT)
                     rc = VINF_SUCCESS;
@@ -2743,10 +2872,11 @@ static int pgmPhysWriteHandler(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void co
  * @param   GCPhys          Physical address to write to.
  * @param   pvBuf           What to write.
  * @param   cbWrite         How many bytes to write.
+ * @param   enmOrigin       Who is calling.
  */
-VMMDECL(int) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
+VMMDECL(int) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin)
 {
-    AssertMsg(!pVM->pgm.s.fNoMorePhysWrites, ("Calling PGMPhysWrite after pgmR3Save()!\n"));
+    AssertMsg(!pVM->pgm.s.fNoMorePhysWrites, ("Calling PGMPhysWrite after pgmR3Save()! enmOrigin=%d\n", enmOrigin));
     AssertMsgReturn(cbWrite > 0, ("don't even think about writing zero bytes!\n"), VINF_SUCCESS);
     LogFlow(("PGMPhysWrite: %RGp %d\n", GCPhys, cbWrite));
 
@@ -2782,7 +2912,7 @@ VMMDECL(int) PGMPhysWrite(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cb
                 if (   PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage)
                     || PGM_PAGE_IS_SPECIAL_ALIAS_MMIO(pPage))
                 {
-                    int rc = pgmPhysWriteHandler(pVM, pPage, pRam->GCPhys + off, pvBuf, cb);
+                    int rc = pgmPhysWriteHandler(pVM, pPage, pRam->GCPhys + off, pvBuf, cb, enmOrigin);
                     if (RT_FAILURE(rc))
                     {
                         pgmUnlock(pVM);
@@ -3254,9 +3384,10 @@ VMMDECL(int) PGMPhysSimpleDirtyWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const
  * @param   pvDst       The destination address.
  * @param   GCPtrSrc    The source address (GC pointer).
  * @param   cb          The number of bytes to read.
- * @thread  The vCPU EMT.
+ * @param   enmOrigin   Who is calling.
+ * @thread  EMT(pVCpu)
  */
-VMMDECL(int) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb)
+VMMDECL(int) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_t cb, PGMACCESSORIGIN enmOrigin)
 {
     RTGCPHYS    GCPhys;
     uint64_t    fFlags;
@@ -3289,7 +3420,7 @@ VMMDECL(int) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_
             AssertRC(rc);
         }
 
-        return PGMPhysRead(pVM, GCPhys, pvDst, cb);
+        return PGMPhysRead(pVM, GCPhys, pvDst, cb, enmOrigin);
     }
 
     /*
@@ -3313,12 +3444,12 @@ VMMDECL(int) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_
         size_t cbRead = PAGE_SIZE - ((RTGCUINTPTR)GCPtrSrc & PAGE_OFFSET_MASK);
         if (cbRead < cb)
         {
-            rc = PGMPhysRead(pVM, GCPhys, pvDst, cbRead);
+            rc = PGMPhysRead(pVM, GCPhys, pvDst, cbRead, enmOrigin);
             if (RT_FAILURE(rc))
                 return rc;
         }
         else    /* Last page (cbRead is PAGE_SIZE, we only need cb!) */
-            return PGMPhysRead(pVM, GCPhys, pvDst, cb);
+            return PGMPhysRead(pVM, GCPhys, pvDst, cb, enmOrigin);
 
         /* next */
         Assert(cb > cbRead);
@@ -3343,8 +3474,9 @@ VMMDECL(int) PGMPhysReadGCPtr(PVMCPU pVCpu, void *pvDst, RTGCPTR GCPtrSrc, size_
  * @param   GCPtrDst    The destination address (GC pointer).
  * @param   pvSrc       The source address.
  * @param   cb          The number of bytes to write.
+ * @param   enmOrigin       Who is calling.
  */
-VMMDECL(int) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb)
+VMMDECL(int) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc, size_t cb, PGMACCESSORIGIN enmOrigin)
 {
     RTGCPHYS    GCPhys;
     uint64_t    fFlags;
@@ -3381,7 +3513,7 @@ VMMDECL(int) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc
             AssertRC(rc);
         }
 
-        return PGMPhysWrite(pVM, GCPhys, pvSrc, cb);
+        return PGMPhysWrite(pVM, GCPhys, pvSrc, cb, enmOrigin);
     }
 
     /*
@@ -3409,12 +3541,12 @@ VMMDECL(int) PGMPhysWriteGCPtr(PVMCPU pVCpu, RTGCPTR GCPtrDst, const void *pvSrc
         size_t cbWrite = PAGE_SIZE - ((RTGCUINTPTR)GCPtrDst & PAGE_OFFSET_MASK);
         if (cbWrite < cb)
         {
-            rc = PGMPhysWrite(pVM, GCPhys, pvSrc, cbWrite);
+            rc = PGMPhysWrite(pVM, GCPhys, pvSrc, cbWrite, enmOrigin);
             if (RT_FAILURE(rc))
                 return rc;
         }
         else    /* Last page (cbWrite is PAGE_SIZE, we only need cb!) */
-            rc = PGMPhysWrite(pVM, GCPhys, pvSrc, cb);
+            rc = PGMPhysWrite(pVM, GCPhys, pvSrc, cb, enmOrigin);
 
         /* next */
         Assert(cb > cbWrite);
diff --git a/src/VBox/VMM/VMMAll/PGMAllPool.cpp b/src/VBox/VMM/VMMAll/PGMAllPool.cpp
index 30fbd01..c50259d 100644
--- a/src/VBox/VMM/VMMAll/PGMAllPool.cpp
+++ b/src/VBox/VMM/VMMAll/PGMAllPool.cpp
@@ -50,9 +50,6 @@ static void pgmPoolTrackClearPageUsers(PPGMPOOL pPool, PPGMPOOLPAGE pPage);
 static void pgmPoolTrackDeref(PPGMPOOL pPool, PPGMPOOLPAGE pPage);
 static int pgmPoolTrackAddUser(PPGMPOOL pPool, PPGMPOOLPAGE pPage, uint16_t iUser, uint32_t iUserTable);
 static void pgmPoolMonitorModifiedRemove(PPGMPOOL pPool, PPGMPOOLPAGE pPage);
-#ifndef IN_RING3
-DECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
-#endif
 #if defined(LOG_ENABLED) || defined(VBOX_STRICT)
 static const char *pgmPoolPoolKindToStr(uint8_t enmKind);
 #endif
@@ -142,12 +139,12 @@ int pgmPoolMonitorChainFlush(PPGMPOOL pPool, PPGMPOOLPAGE pPage)
  * @returns VBox status code suitable for scheduling.
  * @param   pVM         Pointer to the VM.
  * @param   pvDst       Destination address
- * @param   pvSrc       Source guest virtual address.
+ * @param   pvSrc       Pointer to the mapping of @a GCPhysSrc or NULL depending
+ *                      on the context (e.g. \#PF in R0 & RC).
  * @param   GCPhysSrc   The source guest physical address.
  * @param   cb          Size of data to read
  */
-DECLINLINE(int) pgmPoolPhysSimpleReadGCPhys(PVM pVM, void *pvDst, CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvSrc,
-                                            RTGCPHYS GCPhysSrc, size_t cb)
+DECLINLINE(int) pgmPoolPhysSimpleReadGCPhys(PVM pVM, void *pvDst, void const *pvSrc, RTGCPHYS GCPhysSrc, size_t cb)
 {
 #if defined(IN_RING3)
     NOREF(pVM); NOREF(GCPhysSrc);
@@ -171,12 +168,12 @@ DECLINLINE(int) pgmPoolPhysSimpleReadGCPhys(PVM pVM, void *pvDst, CTXTYPE(RTGCPT
  * @param   pPool       The pool.
  * @param   pPage       The head page.
  * @param   GCPhysFault The guest physical fault address.
- * @param   uAddress    In R0 and GC this is the guest context fault address (flat).
- *                      In R3 this is the host context 'fault' address.
+ * @param   pvAddress   Pointer to the mapping of @a GCPhysFault or NULL
+ *                      depending on the context (e.g. \#PF in R0 & RC).
  * @param   cbWrite     Write size; might be zero if the caller knows we're not crossing entry boundaries
  */
-void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault,
-                                 CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvAddress, unsigned cbWrite)
+static void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault,
+                                        void const *pvAddress, unsigned cbWrite)
 {
     AssertMsg(pPage->iMonitoredPrev == NIL_PGMPOOL_IDX, ("%u (idx=%u)\n", pPage->iMonitoredPrev, pPage->idx));
     const unsigned  off = GCPhysFault & PAGE_OFFSET_MASK;
@@ -347,11 +344,9 @@ void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPag
                     if (PGMSHWPTEPAE_IS_P(uShw.pPTPae->a[iShw2]))
                     {
                         X86PTEPAE GstPte;
-#   ifdef IN_RING3
-                        int rc = pgmPoolPhysSimpleReadGCPhys(pVM, &GstPte, (RTHCPTR)((RTHCUINTPTR)pvAddress + sizeof(GstPte)), GCPhysFault + sizeof(GstPte), sizeof(GstPte));
-#   else
-                        int rc = pgmPoolPhysSimpleReadGCPhys(pVM, &GstPte, pvAddress + sizeof(GstPte), GCPhysFault + sizeof(GstPte), sizeof(GstPte));
-#   endif
+                        int rc = pgmPoolPhysSimpleReadGCPhys(pVM, &GstPte,
+                                                             pvAddress ? (uint8_t const *)pvAddress + sizeof(GstPte) : NULL,
+                                                             GCPhysFault + sizeof(GstPte), sizeof(GstPte));
                         AssertRC(rc);
                         Log4(("pgmPoolMonitorChainChanging pae: deref %016RX64 GCPhys %016RX64\n", PGMSHWPTEPAE_GET_HCPHYS(uShw.pPTPae->a[iShw2]), GstPte.u & X86_PTE_PAE_PG_MASK));
                         pgmPoolTracDerefGCPhysHint(pPool, pPage,
@@ -422,7 +417,7 @@ void pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPag
                         }
                     }
                 }
-#if 0 /* useful when running PGMAssertCR3(), a bit too troublesome for general use (TLBs). */
+#if 0 /* useful when running PGMAssertCR3(), a bit too troublesome for general use (TLBs). - not working any longer... */
                 if (    uShw.pPD->a[iShw].n.u1Present
                     &&  !VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3))
                 {
@@ -822,10 +817,10 @@ DECLINLINE(bool) pgmPoolMonitorIsReused(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pReg
  * @param   pvFault     The fault address.
  * @todo VBOXSTRICTRC
  */
-static int pgmPoolAccessHandlerFlush(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
-                                     PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, RTGCPTR pvFault)
+static int pgmPoolAccessPfHandlerFlush(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
+                                       PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, RTGCPTR pvFault)
 {
-    NOREF(GCPhysFault);
+    NOREF(pVM); NOREF(GCPhysFault);
 
     /*
      * First, do the flushing.
@@ -854,7 +849,7 @@ static int pgmPoolAccessHandlerFlush(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGM
 #ifdef IN_RC
         if (PATMIsPatchGCAddr(pVM, pRegFrame->eip))
         {
-            LogFlow(("pgmPoolAccessHandlerPTWorker: Interpretation failed for patch code %04x:%RGv, ignoring.\n",
+            LogFlow(("pgmPoolAccessPfHandlerPTWorker: Interpretation failed for patch code %04x:%RGv, ignoring.\n",
                      pRegFrame->cs.Sel, (RTGCPTR)pRegFrame->eip));
             rc = VINF_SUCCESS;
             STAM_COUNTER_INC(&pPool->StatMonitorRZIntrFailPatch2);
@@ -871,7 +866,7 @@ static int pgmPoolAccessHandlerFlush(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGM
     else
         AssertMsgFailed(("%Rrc\n", VBOXSTRICTRC_VAL(rc2))); /* ASSUMES no complicated stuff here. */
 
-    LogFlow(("pgmPoolAccessHandlerPT: returns %Rrc (flushed)\n", rc));
+    LogFlow(("pgmPoolAccessPfHandlerPT: returns %Rrc (flushed)\n", rc));
     return rc;
 }
 
@@ -888,8 +883,8 @@ static int pgmPoolAccessHandlerFlush(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGM
  * @param   GCPhysFault The fault address as guest physical address.
  * @param   pvFault     The fault address.
  */
-DECLINLINE(int) pgmPoolAccessHandlerSTOSD(PVM pVM, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
-                                          PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, RTGCPTR pvFault)
+DECLINLINE(int) pgmPoolAccessPfHandlerSTOSD(PVM pVM, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
+                                            PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, RTGCPTR pvFault)
 {
     unsigned uIncrement = pDis->Param1.cb;
     NOREF(pVM);
@@ -904,7 +899,7 @@ DECLINLINE(int) pgmPoolAccessHandlerSTOSD(PVM pVM, PPGMPOOL pPool, PPGMPOOLPAGE
         Assert(uIncrement == 8);
 #endif
 
-    Log3(("pgmPoolAccessHandlerSTOSD\n"));
+    Log3(("pgmPoolAccessPfHandlerSTOSD\n"));
 
     /*
      * Increment the modification counter and insert it into the list
@@ -925,10 +920,10 @@ DECLINLINE(int) pgmPoolAccessHandlerSTOSD(PVM pVM, PPGMPOOL pPool, PPGMPOOLPAGE
     {
 #if defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) || defined(IN_RC)
         uint32_t iPrevSubset = PGMRZDynMapPushAutoSubset(pVCpu);
-        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, (RTGCPTR)pu32, uIncrement);
+        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, NULL, uIncrement);
         PGMRZDynMapPopAutoSubset(pVCpu, iPrevSubset);
 #else
-        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, (RTGCPTR)pu32, uIncrement);
+        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, NULL, uIncrement);
 #endif
 #ifdef IN_RC
         *(uint32_t *)(uintptr_t)pu32 = pRegFrame->eax;
@@ -942,7 +937,7 @@ DECLINLINE(int) pgmPoolAccessHandlerSTOSD(PVM pVM, PPGMPOOL pPool, PPGMPOOLPAGE
     }
     pRegFrame->rip += pDis->cbInstr;
 
-    LogFlow(("pgmPoolAccessHandlerSTOSD: returns\n"));
+    LogFlow(("pgmPoolAccessPfHandlerSTOSD: returns\n"));
     return VINF_SUCCESS;
 }
 
@@ -961,10 +956,11 @@ DECLINLINE(int) pgmPoolAccessHandlerSTOSD(PVM pVM, PPGMPOOL pPool, PPGMPOOLPAGE
  * @param   pvFault     The fault address.
  * @param   pfReused    Reused state (in/out)
  */
-DECLINLINE(int) pgmPoolAccessHandlerSimple(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
-                                           PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, RTGCPTR pvFault, bool *pfReused)
+DECLINLINE(int) pgmPoolAccessPfHandlerSimple(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, PDISCPUSTATE pDis,
+                                             PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, RTGCPTR pvFault, bool *pfReused)
 {
-    Log3(("pgmPoolAccessHandlerSimple\n"));
+    Log3(("pgmPoolAccessPfHandlerSimple\n"));
+    NOREF(pVM);
     NOREF(pfReused); /* initialized by caller */
 
     /*
@@ -983,12 +979,12 @@ DECLINLINE(int) pgmPoolAccessHandlerSimple(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool
 
     uint32_t cbWrite = DISGetParamSize(pDis, &pDis->Param1);
     if (cbWrite <= 8)
-        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, pvFault, cbWrite);
+        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, NULL, cbWrite);
     else
     {
         Assert(cbWrite <= 16);
-        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, pvFault, 8);
-        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault + 8, pvFault + 8, cbWrite - 8);
+        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault, NULL, 8);
+        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhysFault + 8, NULL, cbWrite - 8);
     }
 
 #if defined(VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0) || defined(IN_RC)
@@ -1003,7 +999,7 @@ DECLINLINE(int) pgmPoolAccessHandlerSimple(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool
         AssertMsg(rc == VINF_SUCCESS, ("%Rrc\n", VBOXSTRICTRC_VAL(rc))); /* ASSUMES no complicated stuff here. */
     else if (rc == VERR_EM_INTERPRETER)
     {
-        LogFlow(("pgmPoolAccessHandlerPTWorker: Interpretation failed for %04x:%RGv - opcode=%d\n",
+        LogFlow(("pgmPoolAccessPfHandlerPTWorker: Interpretation failed for %04x:%RGv - opcode=%d\n",
                   pRegFrame->cs.Sel, (RTGCPTR)pRegFrame->rip, pDis->pCurInstr->uOpcode));
         rc = VINF_EM_RAW_EMULATE_INSTR;
         STAM_COUNTER_INC(&pPool->CTX_MID_Z(StatMonitor,EmulateInstr));
@@ -1039,7 +1035,7 @@ DECLINLINE(int) pgmPoolAccessHandlerSimple(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool
     }
 #endif
 
-    LogFlow(("pgmPoolAccessHandlerSimple: returns %Rrc\n", VBOXSTRICTRC_VAL(rc)));
+    LogFlow(("pgmPoolAccessPfHandlerSimple: returns %Rrc\n", VBOXSTRICTRC_VAL(rc)));
     return VBOXSTRICTRC_VAL(rc);
 }
 
@@ -1049,6 +1045,8 @@ DECLINLINE(int) pgmPoolAccessHandlerSimple(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool
  *
  * @returns VBox status code (appropriate for GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  *                      NULL on DMA and other non CPU access.
@@ -1056,24 +1054,23 @@ DECLINLINE(int) pgmPoolAccessHandlerSimple(PVM pVM, PVMCPU pVCpu, PPGMPOOL pPool
  * @param   GCPhysFault The GC physical address corresponding to pvFault.
  * @param   pvUser      User argument.
  */
-DECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
-                                     RTGCPHYS GCPhysFault, void *pvUser)
+DECLEXPORT(int) pgmPoolAccessPfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                       RTGCPHYS GCPhysFault, void *pvUser)
 {
     STAM_PROFILE_START(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), a);
     PPGMPOOL        pPool = pVM->pgm.s.CTX_SUFF(pPool);
     PPGMPOOLPAGE    pPage = (PPGMPOOLPAGE)pvUser;
-    PVMCPU          pVCpu = VMMGetCpu(pVM);
     unsigned        cMaxModifications;
     bool            fForcedFlush = false;
     NOREF(uErrorCode);
 
-    LogFlow(("pgmPoolAccessHandler: pvFault=%RGv pPage=%p:{.idx=%d} GCPhysFault=%RGp\n", pvFault, pPage, pPage->idx, GCPhysFault));
+    LogFlow(("pgmPoolAccessPfHandler: pvFault=%RGv pPage=%p:{.idx=%d} GCPhysFault=%RGp\n", pvFault, pPage, pPage->idx, GCPhysFault));
 
     pgmLock(pVM);
     if (PHYS_PAGE_ADDRESS(GCPhysFault) != PHYS_PAGE_ADDRESS(pPage->GCPhys))
     {
         /* Pool page changed while we were waiting for the lock; ignore. */
-        Log(("CPU%d: pgmPoolAccessHandler pgm pool page for %RGp changed (to %RGp) while waiting!\n", pVCpu->idCpu, PHYS_PAGE_ADDRESS(GCPhysFault), PHYS_PAGE_ADDRESS(pPage->GCPhys)));
+        Log(("CPU%d: pgmPoolAccessPfHandler pgm pool page for %RGp changed (to %RGp) while waiting!\n", pVCpu->idCpu, PHYS_PAGE_ADDRESS(GCPhysFault), PHYS_PAGE_ADDRESS(pPage->GCPhys)));
         STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), &pPool->CTX_MID_Z(StatMonitor,Handled), a);
         pgmUnlock(pVM);
         return VINF_SUCCESS;
@@ -1171,7 +1168,7 @@ DECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE
          */
         if (!(pDis->fPrefix & (DISPREFIX_REP | DISPREFIX_REPNE)))
         {
-            rc = pgmPoolAccessHandlerSimple(pVM, pVCpu, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault, &fReused);
+            rc = pgmPoolAccessPfHandlerSimple(pVM, pVCpu, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault, &fReused);
             if (fReused)
                 goto flushPage;
 
@@ -1242,7 +1239,7 @@ DECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE
 
             if (fValidStosd)
             {
-                rc = pgmPoolAccessHandlerSTOSD(pVM, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault);
+                rc = pgmPoolAccessPfHandlerSTOSD(pVM, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault);
                 STAM_PROFILE_STOP_EX(&pVM->pgm.s.CTX_SUFF(pPool)->CTX_SUFF_Z(StatMonitor), &pPool->CTX_MID_Z(StatMonitor,RepStosd), a);
                 pgmUnlock(pVM);
                 return rc;
@@ -1251,7 +1248,7 @@ DECLEXPORT(int) pgmPoolAccessHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE
 
         /* REP prefix, don't bother. */
         STAM_COUNTER_INC(&pPool->CTX_MID_Z(StatMonitor,RepPrefix));
-        Log4(("pgmPoolAccessHandler: eax=%#x ecx=%#x edi=%#x esi=%#x rip=%RGv opcode=%d prefix=%#x\n",
+        Log4(("pgmPoolAccessPfHandler: eax=%#x ecx=%#x edi=%#x esi=%#x rip=%RGv opcode=%d prefix=%#x\n",
               pRegFrame->eax, pRegFrame->ecx, pRegFrame->edi, pRegFrame->esi, (RTGCPTR)pRegFrame->rip, pDis->pCurInstr->uOpcode, pDis->fPrefix));
         fNotReusedNotForking = true;
     }
@@ -1339,7 +1336,7 @@ flushPage:
      * interpret then. This may be a bit risky, in which case
      * the reuse detection must be fixed.
      */
-    rc = pgmPoolAccessHandlerFlush(pVM, pVCpu, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault);
+    rc = pgmPoolAccessPfHandlerFlush(pVM, pVCpu, pPool, pPage, pDis, pRegFrame, GCPhysFault, pvFault);
     if (    rc == VINF_EM_RAW_EMULATE_INSTR
         &&  fReused)
     {
@@ -1354,6 +1351,94 @@ flushPage:
 
 # endif /* !IN_RING3 */
 
+/**
+ * Access handler callback for PT write accesses.
+ *
+ * The handler can not raise any faults, it's mainly for monitoring write access
+ * to certain pages.
+ *
+ * @returns VINF_SUCCESS if the handler has carried out the operation.
+ * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
+ * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           The cross context CPU structure for the calling EMT.
+ * @param   GCPhys          The physical address the guest is writing to.
+ * @param   pvPhys          The HC mapping of that address.
+ * @param   pvBuf           What the guest is reading/writing.
+ * @param   cbBuf           How much it's reading/writing.
+ * @param   enmAccessType   The access type.
+ * @param   enmOrigin       Who is making the access.
+ * @param   pvUser          User argument.
+ */
+PGM_ALL_CB2_DECL(int) pgmPoolAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                           PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
+{
+    PPGMPOOL        pPool = pVM->pgm.s.CTX_SUFF(pPool);
+    STAM_PROFILE_START(&pPool->StatMonitorR3, a);
+    PPGMPOOLPAGE    pPage = (PPGMPOOLPAGE)pvUser;
+    LogFlow(("PGM_ALL_CB_DECL: GCPhys=%RGp %p:{.Core=%RHp, .idx=%d, .GCPhys=%RGp, .enmType=%d}\n",
+             GCPhys, pPage, pPage->Core.Key, pPage->idx, pPage->GCPhys, pPage->enmKind));
+
+    NOREF(pvBuf); NOREF(enmAccessType);
+
+    /*
+     * Make sure the pool page wasn't modified by a different CPU.
+     */
+    pgmLock(pVM);
+    if (PHYS_PAGE_ADDRESS(GCPhys) == PHYS_PAGE_ADDRESS(pPage->GCPhys))
+    {
+        Assert(pPage->enmKind != PGMPOOLKIND_FREE);
+
+        /* The max modification count before flushing depends on the context and page type. */
+#ifdef IN_RING3
+        uint16_t const cMaxModifications = 96; /* it's cheaper here, right? */
+#else
+        uint16_t cMaxModifications;
+        if (    pPage->enmKind == PGMPOOLKIND_PAE_PT_FOR_PAE_PT
+            ||  pPage->enmKind == PGMPOOLKIND_PAE_PT_FOR_32BIT_PT)
+            cMaxModifications = 4;
+        else
+            cMaxModifications = 24;
+# ifdef IN_RC
+        cMaxModifications *= 2; /* traps are cheaper than exists. */
+# endif
+#endif
+
+        /*
+         * We don't have to be very sophisticated about this since there are relativly few calls here.
+         * However, we must try our best to detect any non-cpu accesses (disk / networking).
+         */
+        if (   (   pPage->cModifications < cMaxModifications
+                || pgmPoolIsPageLocked(pPage) )
+            && enmOrigin != PGMACCESSORIGIN_DEVICE
+            && cbBuf <= 16)
+        {
+            /* Clear the shadow entry. */
+            if (!pPage->cModifications++)
+                pgmPoolMonitorModifiedInsert(pPool, pPage);
+
+            if (cbBuf <= 8)
+                pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhys, pvBuf, (uint32_t)cbBuf);
+            else
+            {
+                pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhys, pvBuf, 8);
+                pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhys + 8, (uint8_t *)pvBuf + 8, (uint32_t)cbBuf - 8);
+            }
+        }
+        else
+        {
+            /* ASSUME that VERR_PGM_POOL_CLEARED can be ignored here and that FFs will deal with it in due time. */
+            pgmPoolMonitorChainFlush(pPool, pPage);
+        }
+
+        STAM_PROFILE_STOP_EX(&pPool->StatMonitorR3, &pPool->StatMonitorR3FlushPage, a);
+    }
+    else
+        Log(("CPU%d: PGM_ALL_CB_DECL pgm pool page for %RGp changed (to %RGp) while waiting!\n", pVCpu->idCpu, PHYS_PAGE_ADDRESS(GCPhys), PHYS_PAGE_ADDRESS(pPage->GCPhys)));
+    pgmUnlock(pVM);
+    return VINF_PGM_HANDLER_DO_DEFAULT;
+}
+
+
 # ifdef PGMPOOL_WITH_OPTIMIZED_DIRTY_PT
 
 #  if defined(VBOX_STRICT) && !defined(IN_RING3)
@@ -2499,12 +2584,9 @@ static int pgmPoolMonitorInsert(PPGMPOOL pPool, PPGMPOOLPAGE pPage)
         Assert(pPage->iMonitoredNext == NIL_PGMPOOL_IDX); Assert(pPage->iMonitoredPrev == NIL_PGMPOOL_IDX);
         PVM pVM = pPool->CTX_SUFF(pVM);
         const RTGCPHYS GCPhysPage = pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK;
-        rc = PGMHandlerPhysicalRegisterEx(pVM, PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
-                                          GCPhysPage, GCPhysPage + PAGE_OFFSET_MASK,
-                                          pPool->pfnAccessHandlerR3, MMHyperCCToR3(pVM, pPage),
-                                          pPool->pfnAccessHandlerR0, MMHyperCCToR0(pVM, pPage),
-                                          pPool->pfnAccessHandlerRC, MMHyperCCToRC(pVM, pPage),
-                                          pPool->pszAccessHandler);
+        rc = PGMHandlerPhysicalRegister(pVM, GCPhysPage, GCPhysPage + PAGE_OFFSET_MASK, pPool->hAccessHandlerType,
+                                        MMHyperCCToR3(pVM, pPage), MMHyperCCToR0(pVM, pPage), MMHyperCCToRC(pVM, pPage),
+                                        NIL_RTR3PTR /*pszDesc*/);
         /** @todo we should probably deal with out-of-memory conditions here, but for now increasing
          * the heap size should suffice. */
         AssertFatalMsgRC(rc, ("PGMHandlerPhysicalRegisterEx %RGp failed with %Rrc\n", GCPhysPage, rc));
@@ -2581,11 +2663,9 @@ static int pgmPoolMonitorFlush(PPGMPOOL pPool, PPGMPOOLPAGE pPage)
         {
             PPGMPOOLPAGE pNewHead = &pPool->aPages[pPage->iMonitoredNext];
             pNewHead->iMonitoredPrev = NIL_PGMPOOL_IDX;
-            rc = PGMHandlerPhysicalChangeCallbacks(pVM, pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK,
-                                                   pPool->pfnAccessHandlerR3, MMHyperCCToR3(pVM, pNewHead),
-                                                   pPool->pfnAccessHandlerR0, MMHyperCCToR0(pVM, pNewHead),
-                                                   pPool->pfnAccessHandlerRC, MMHyperCCToRC(pVM, pNewHead),
-                                                   pPool->pszAccessHandler);
+            rc = PGMHandlerPhysicalChangeUserArgs(pVM, pPage->GCPhys & ~(RTGCPHYS)PAGE_OFFSET_MASK, MMHyperCCToR3(pVM, pNewHead),
+                                                  MMHyperCCToR0(pVM, pNewHead), MMHyperCCToRC(pVM, pNewHead));
+
             AssertFatalRCSuccess(rc);
             pPage->iMonitoredNext = NIL_PGMPOOL_IDX;
         }
diff --git a/src/VBox/VMM/VMMAll/REMAll.cpp b/src/VBox/VMM/VMMAll/REMAll.cpp
index 97498b4..2117464 100644
--- a/src/VBox/VMM/VMMAll/REMAll.cpp
+++ b/src/VBox/VMM/VMMAll/REMAll.cpp
@@ -132,16 +132,16 @@ static void remNotifyHandlerInsert(PVM pVM, PREMHANDLERNOTIFICATION pRec)
  * Notification about a successful PGMR3HandlerPhysicalRegister() call.
  *
  * @param   pVM             Pointer to the VM.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhys          Handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler have a HC callback function.
  */
-VMMDECL(void) REMNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler)
+VMMDECL(void) REMNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler)
 {
     REMHANDLERNOTIFICATION Rec;
     Rec.enmKind = REMHANDLERNOTIFICATIONKIND_PHYSICAL_REGISTER;
-    Rec.u.PhysicalRegister.enmType = enmType;
+    Rec.u.PhysicalRegister.enmKind = enmKind;
     Rec.u.PhysicalRegister.GCPhys = GCPhys;
     Rec.u.PhysicalRegister.cb = cb;
     Rec.u.PhysicalRegister.fHasHCHandler = fHasHCHandler;
@@ -153,17 +153,17 @@ VMMDECL(void) REMNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmTy
  * Notification about a successful PGMR3HandlerPhysicalDeregister() operation.
  *
  * @param   pVM             Pointer to the VM.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhys          Handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler have a HC callback function.
  * @param   fRestoreAsRAM   Whether the to restore it as normal RAM or as unassigned memory.
  */
-VMMDECL(void) REMNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
+VMMDECL(void) REMNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
 {
     REMHANDLERNOTIFICATION Rec;
     Rec.enmKind = REMHANDLERNOTIFICATIONKIND_PHYSICAL_DEREGISTER;
-    Rec.u.PhysicalDeregister.enmType = enmType;
+    Rec.u.PhysicalDeregister.enmKind = enmKind;
     Rec.u.PhysicalDeregister.GCPhys = GCPhys;
     Rec.u.PhysicalDeregister.cb = cb;
     Rec.u.PhysicalDeregister.fHasHCHandler = fHasHCHandler;
@@ -176,18 +176,18 @@ VMMDECL(void) REMNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enm
  * Notification about a successful PGMR3HandlerPhysicalModify() call.
  *
  * @param   pVM             Pointer to the VM.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhysOld       Old handler range address.
  * @param   GCPhysNew       New handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler have a HC callback function.
  * @param   fRestoreAsRAM   Whether the to restore it as normal RAM or as unassigned memory.
  */
-VMMDECL(void) REMNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
+VMMDECL(void) REMNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
 {
     REMHANDLERNOTIFICATION Rec;
     Rec.enmKind = REMHANDLERNOTIFICATIONKIND_PHYSICAL_MODIFY;
-    Rec.u.PhysicalModify.enmType = enmType;
+    Rec.u.PhysicalModify.enmKind = enmKind;
     Rec.u.PhysicalModify.GCPhysOld = GCPhysOld;
     Rec.u.PhysicalModify.GCPhysNew = GCPhysNew;
     Rec.u.PhysicalModify.cb = cb;
diff --git a/src/VBox/VMM/VMMAll/SELMAll.cpp b/src/VBox/VMM/VMMAll/SELMAll.cpp
index 317727d..f75af7a 100644
--- a/src/VBox/VMM/VMMAll/SELMAll.cpp
+++ b/src/VBox/VMM/VMMAll/SELMAll.cpp
@@ -107,11 +107,11 @@ VMMDECL(RTGCPTR) SELMToFlat(PVM pVM, DISSELREG SelReg, PCPUMCTXCORE pCtxCore, RT
     if (    pCtxCore->eflags.Bits.u1VM
         ||  CPUMIsGuestInRealMode(pVCpu))
     {
-        RTGCUINTPTR uFlat = (RTGCUINTPTR)Addr & 0xffff;
+        uint32_t uFlat = (uint32_t)Addr & 0xffff;
         if (CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, pSReg))
-            uFlat += pSReg->u64Base;
+            uFlat += (uint32_t)pSReg->u64Base;
         else
-            uFlat += (RTGCUINTPTR)pSReg->Sel << 4;
+            uFlat += (uint32_t)pSReg->Sel << 4;
         return (RTGCPTR)uFlat;
     }
 
@@ -144,7 +144,7 @@ VMMDECL(RTGCPTR) SELMToFlat(PVM pVM, DISSELREG SelReg, PCPUMCTXCORE pCtxCore, RT
 
     /* AMD64 manual: compatibility mode ignores the high 32 bits when calculating an effective address. */
     Assert(pSReg->u64Base <= 0xffffffff);
-    return ((pSReg->u64Base + (RTGCUINTPTR)Addr) & 0xffffffff);
+    return (uint32_t)pSReg->u64Base + (uint32_t)Addr;
 }
 
 
@@ -177,13 +177,13 @@ VMMDECL(int) SELMToFlatEx(PVMCPU pVCpu, DISSELREG SelReg, PCPUMCTXCORE pCtxCore,
     if (    pCtxCore->eflags.Bits.u1VM
         ||  CPUMIsGuestInRealMode(pVCpu))
     {
-        RTGCUINTPTR uFlat = (RTGCUINTPTR)Addr & 0xffff;
         if (ppvGC)
         {
+            uint32_t uFlat = (uint32_t)Addr & 0xffff;
             if (CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, pSReg))
-                *ppvGC = pSReg->u64Base + uFlat;
+                *ppvGC = (uint32_t)pSReg->u64Base + uFlat;
             else
-                *ppvGC = ((RTGCUINTPTR)pSReg->Sel << 4) + uFlat;
+                *ppvGC = ((uint32_t)pSReg->Sel << 4) + uFlat;
         }
         return VINF_SUCCESS;
     }
@@ -222,8 +222,8 @@ VMMDECL(int) SELMToFlatEx(PVMCPU pVCpu, DISSELREG SelReg, PCPUMCTXCORE pCtxCore,
     {
         /* AMD64 manual: compatibility mode ignores the high 32 bits when calculating an effective address. */
         Assert(pSReg->u64Base <= UINT32_C(0xffffffff));
-        pvFlat  = pSReg->u64Base + Addr;
-        pvFlat &= UINT32_C(0xffffffff);
+        pvFlat  = (uint32_t)pSReg->u64Base + (uint32_t)Addr;
+        Assert(pvFlat <= UINT32_MAX);
     }
 
     /*
@@ -495,7 +495,7 @@ static void selLoadHiddenSelectorRegFromGuestTable(PVMCPU pVCpu, PCCPUMCTX pCtx,
      * Try read the entry.
      */
     X86DESC GstDesc;
-    int rc = PGMPhysReadGCPtr(pVCpu, &GstDesc, GCPtrDesc, sizeof(GstDesc));
+    int rc = PGMPhysReadGCPtr(pVCpu, &GstDesc, GCPtrDesc, sizeof(GstDesc), PGMACCESSORIGIN_IOM);
     if (RT_FAILURE(rc))
     {
         Log(("SELMLoadHiddenSelectorReg: Error reading descriptor %s=%#x: %Rrc\n", g_aszSRegNms[iSReg], Sel, rc));
@@ -608,11 +608,12 @@ VMM_INT_DECL(void) SELMLoadHiddenSelectorReg(PVMCPU pVCpu, PCCPUMCTX pCtx, PCPUM
 DECLINLINE(int) selmValidateAndConvertCSAddrRealMode(PVMCPU pVCpu, RTSEL SelCS, PCCPUMSELREGHID pSReg, RTGCPTR Addr,
                                                      PRTGCPTR ppvFlat)
 {
-    RTGCUINTPTR uFlat = Addr & 0xffff;
+    NOREF(pVCpu);
+    uint32_t uFlat = Addr & 0xffff;
     if (!pSReg || !CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, pSReg))
-        uFlat += (RTGCUINTPTR)SelCS << 4;
+        uFlat += (uint32_t)SelCS << 4;
     else
-        uFlat += pSReg->u64Base;
+        uFlat += (uint32_t)pSReg->u64Base;
     *ppvFlat = uFlat;
     return VINF_SUCCESS;
 }
@@ -738,9 +739,9 @@ DECLINLINE(int) selmValidateAndConvertCSAddrHidden(PVMCPU pVCpu, RTSEL SelCPL, R
              * final value. The granularity bit was included in its calculation.
              */
             uint32_t u32Limit = pSRegCS->u32Limit;
-            if ((RTGCUINTPTR)Addr <= u32Limit)
+            if ((uint32_t)Addr <= u32Limit)
             {
-                *ppvFlat = Addr + pSRegCS->u64Base;
+                *ppvFlat = (uint32_t)Addr + (uint32_t)pSRegCS->u64Base;
                 return VINF_SUCCESS;
             }
 
diff --git a/src/VBox/VMM/VMMAll/TMAll.cpp b/src/VBox/VMM/VMMAll/TMAll.cpp
index a1167a1..4c556cb 100644
--- a/src/VBox/VMM/VMMAll/TMAll.cpp
+++ b/src/VBox/VMM/VMMAll/TMAll.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -72,6 +72,40 @@
 # define TMTIMER_ASSERT_CRITSECT(pTimer) do { } while (0)
 #endif
 
+/** @def TMTIMER_ASSERT_SYNC_CRITSECT_ORDER
+ * Checks for lock order trouble between the timer critsect and the critical
+ * section critsect.  The virtual sync critsect must always be entered before
+ * the one associated with the timer (see TMR3TimerQueuesDo).  It is OK if there
+ * isn't any critical section associated with the timer or if the calling thread
+ * doesn't own it, ASSUMING of course that the thread using this macro is going
+ * to enter the virtual sync critical section anyway.
+ *
+ * @remarks This is a sligtly relaxed timer locking attitude compared to
+ *          TMTIMER_ASSERT_CRITSECT, however, the calling device/whatever code
+ *          should know what it's doing if it's stopping or starting a timer
+ *          without taking the device lock.
+ */
+#ifdef VBOX_STRICT
+# define TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer) \
+    do { \
+        if ((pTimer)->pCritSect) \
+        { \
+            VMSTATE      enmState; \
+            PPDMCRITSECT pCritSect = (PPDMCRITSECT)MMHyperR3ToCC(pVM, (pTimer)->pCritSect); \
+            AssertMsg(   pCritSect \
+                      && (   !PDMCritSectIsOwner(pCritSect) \
+                          || PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock) \
+                          || (enmState = (pVM)->enmVMState) == VMSTATE_CREATING \
+                          || enmState == VMSTATE_RESETTING \
+                          || enmState == VMSTATE_RESETTING_LS ),\
+                      ("pTimer=%p (%s) pCritSect=%p (%s)\n", pTimer, R3STRING(pTimer->pszDesc), \
+                       (pTimer)->pCritSect, R3STRING(PDMR3CritSectName((pTimer)->pCritSect)) )); \
+        } \
+    } while (0)
+#else
+# define TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer) do { } while (0)
+#endif
+
 
 /**
  * Notification that execution is about to start.
@@ -482,6 +516,7 @@ DECLINLINE(void) tmTimerQueueScheduleOne(PTMTIMERQUEUE pQueue, PTMTIMER pTimer)
 void tmTimerQueueSchedule(PVM pVM, PTMTIMERQUEUE pQueue)
 {
     TM_ASSERT_TIMER_LOCK_OWNERSHIP(pVM);
+    NOREF(pVM);
 
     /*
      * Dequeue the scheduling list and iterate it.
@@ -710,7 +745,7 @@ DECL_FORCE_INLINE(uint64_t) tmTimerPollReturnOtherCpu(PVM pVM, uint64_t u64Now,
 DECL_FORCE_INLINE(uint64_t) tmTimerPollReturnHit(PVM pVM, PVMCPU pVCpu, PVMCPU pVCpuDst, uint64_t u64Now,
                                                  uint64_t *pu64Delta, PSTAMCOUNTER pCounter)
 {
-    STAM_COUNTER_INC(pCounter);
+    STAM_COUNTER_INC(pCounter); NOREF(pCounter);
     if (pVCpuDst != pVCpu)
         return tmTimerPollReturnOtherCpu(pVM, u64Now, pu64Delta);
     *pu64Delta = 0;
@@ -1128,7 +1163,7 @@ static int tmTimerVirtualSyncSet(PVM pVM, PTMTIMER pTimer, uint64_t u64Expire)
 {
     STAM_PROFILE_START(&pVM->tm.s.CTX_SUFF_Z(StatTimerSetVs), a);
     VM_ASSERT_EMT(pVM);
-    Assert(PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock));
+    TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer);
     int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
     AssertRCReturn(rc, rc);
 
@@ -1427,7 +1462,7 @@ static int tmTimerVirtualSyncSetRelative(PVM pVM, PTMTIMER pTimer, uint64_t cTic
 {
     STAM_PROFILE_START(pVM->tm.s.CTX_SUFF_Z(StatTimerSetRelativeVs), a);
     VM_ASSERT_EMT(pVM);
-    Assert(PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock));
+    TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer);
     int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
     AssertRCReturn(rc, rc);
 
@@ -1754,7 +1789,7 @@ static int tmTimerVirtualSyncStop(PVM pVM, PTMTIMER pTimer)
 {
     STAM_PROFILE_START(&pVM->tm.s.CTX_SUFF_Z(StatTimerStopVs), a);
     VM_ASSERT_EMT(pVM);
-    Assert(PDMCritSectIsOwner(&pVM->tm.s.VirtualSyncLock));
+    TMTIMER_ASSERT_SYNC_CRITSECT_ORDER(pVM, pTimer);
     int rc = PDMCritSectEnter(&pVM->tm.s.VirtualSyncLock, VINF_SUCCESS);
     AssertRCReturn(rc, rc);
 
@@ -2539,3 +2574,16 @@ VMM_INT_DECL(uint32_t) TMCalcHostTimerFrequency(PVM pVM, PVMCPU pVCpu)
 
     return uHz;
 }
+
+
+/**
+ * Whether the guest virtual clock is ticking.
+ *
+ * @returns true if ticking, false otherwise.
+ * @param   pVM     Pointer to the VM.
+ */
+VMM_INT_DECL(bool) TMVirtualIsTicking(PVM pVM)
+{
+    return RT_BOOL(pVM->tm.s.cVirtualTicking);
+}
+
diff --git a/src/VBox/VMM/VMMAll/TMAllCpu.cpp b/src/VBox/VMM/VMMAll/TMAllCpu.cpp
index 36da1ae..d9bed90 100644
--- a/src/VBox/VMM/VMMAll/TMAllCpu.cpp
+++ b/src/VBox/VMM/VMMAll/TMAllCpu.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,6 +24,7 @@
 #include <iprt/asm-amd64-x86.h> /* for SUPGetCpuHzFromGIP */
 #include "TMInternal.h"
 #include <VBox/vmm/vm.h>
+#include <VBox/vmm/gim.h>
 #include <VBox/sup.h>
 
 #include <VBox/param.h>
@@ -49,6 +50,17 @@ DECLINLINE(uint64_t) tmCpuTickGetRawVirtual(PVM pVM, bool fCheckTimers)
 }
 
 
+#ifdef IN_RING3
+/**
+ * Used by tmR3CpuTickParavirtEnable and tmR3CpuTickParavirtDisable.
+ */
+uint64_t tmR3CpuTickGetRawVirtualNoCheck(PVM pVM)
+{
+    return tmCpuTickGetRawVirtual(pVM, false /*fCheckTimers*/);
+}
+#endif
+
+
 /**
  * Resumes the CPU timestamp counter ticking.
  *
@@ -62,16 +74,14 @@ int tmCpuTickResume(PVM pVM, PVMCPU pVCpu)
     if (!pVCpu->tm.s.fTSCTicking)
     {
         pVCpu->tm.s.fTSCTicking = true;
-        if (pVM->tm.s.fTSCVirtualized)
-        {
-            /** @todo Test that pausing and resuming doesn't cause lag! (I.e. that we're
-             *        unpaused before the virtual time and stopped after it. */
-            if (pVM->tm.s.fTSCUseRealTSC)
-                pVCpu->tm.s.offTSCRawSrc = ASMReadTSC() - pVCpu->tm.s.u64TSC;
-            else
-                pVCpu->tm.s.offTSCRawSrc = tmCpuTickGetRawVirtual(pVM, false /* don't check for pending timers */)
-                                         - pVCpu->tm.s.u64TSC;
-        }
+
+        /** @todo Test that pausing and resuming doesn't cause lag! (I.e. that we're
+         *        unpaused before the virtual time and stopped after it. */
+        if (pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET)
+            pVCpu->tm.s.offTSCRawSrc = SUPReadTsc() - pVCpu->tm.s.u64TSC;
+        else
+            pVCpu->tm.s.offTSCRawSrc = tmCpuTickGetRawVirtual(pVM, false /* don't check for pending timers */)
+                                     - pVCpu->tm.s.u64TSC;
         return VINF_SUCCESS;
     }
     AssertFailed();
@@ -83,8 +93,8 @@ int tmCpuTickResume(PVM pVM, PVMCPU pVCpu)
  * Resumes the CPU timestamp counter ticking.
  *
  * @returns VINF_SUCCESS or VERR_TM_VIRTUAL_TICKING_IPE (asserted).
- * @param   pVM     Pointer to the VM. 
- * @param   pVCpu   Pointer to the VCPU. 
+ * @param   pVM     Pointer to the VM.
+ * @param   pVCpu   Pointer to the VCPU.
  */
 int tmCpuTickResumeLocked(PVM pVM, PVMCPU pVCpu)
 {
@@ -92,32 +102,29 @@ int tmCpuTickResumeLocked(PVM pVM, PVMCPU pVCpu)
     {
         /* TSC must be ticking before calling tmCpuTickGetRawVirtual()! */
         pVCpu->tm.s.fTSCTicking = true;
-        if (pVM->tm.s.fTSCVirtualized)
+        uint32_t c = ASMAtomicIncU32(&pVM->tm.s.cTSCsTicking);
+        AssertMsgReturn(c <= pVM->cCpus, ("%u vs %u\n", c, pVM->cCpus), VERR_TM_VIRTUAL_TICKING_IPE);
+        if (c == 1)
         {
-            uint32_t c = ASMAtomicIncU32(&pVM->tm.s.cTSCsTicking);
-            AssertMsgReturn(c <= pVM->cCpus, ("%u vs %u\n", c, pVM->cCpus), VERR_TM_VIRTUAL_TICKING_IPE);
-            if (c == 1)
-            {
-                /* The first VCPU to resume. */
-                uint64_t    offTSCRawSrcOld = pVCpu->tm.s.offTSCRawSrc;
-
-                STAM_COUNTER_INC(&pVM->tm.s.StatTSCResume);
-
-                /* When resuming, use the TSC value of the last stopped VCPU to avoid the TSC going back. */
-                if (pVM->tm.s.fTSCUseRealTSC)
-                    pVCpu->tm.s.offTSCRawSrc = ASMReadTSC() - pVM->tm.s.u64LastPausedTSC;
-                else
-                    pVCpu->tm.s.offTSCRawSrc = tmCpuTickGetRawVirtual(pVM, false /* don't check for pending timers */)
-                                             - pVM->tm.s.u64LastPausedTSC;
-
-                /* Calculate the offset for other VCPUs to use. */
-                pVM->tm.s.offTSCPause = pVCpu->tm.s.offTSCRawSrc - offTSCRawSrcOld;
-            }
+            /* The first VCPU to resume. */
+            uint64_t    offTSCRawSrcOld = pVCpu->tm.s.offTSCRawSrc;
+
+            STAM_COUNTER_INC(&pVM->tm.s.StatTSCResume);
+
+            /* When resuming, use the TSC value of the last stopped VCPU to avoid the TSC going back. */
+            if (pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET)
+                pVCpu->tm.s.offTSCRawSrc = SUPReadTsc() - pVM->tm.s.u64LastPausedTSC;
             else
-            {
-                /* All other VCPUs (if any). */
-                pVCpu->tm.s.offTSCRawSrc += pVM->tm.s.offTSCPause;
-            }
+                pVCpu->tm.s.offTSCRawSrc = tmCpuTickGetRawVirtual(pVM, false /* don't check for pending timers */)
+                                         - pVM->tm.s.u64LastPausedTSC;
+
+            /* Calculate the offset for other VCPUs to use. */
+            pVM->tm.s.offTSCPause = pVCpu->tm.s.offTSCRawSrc - offTSCRawSrcOld;
+        }
+        else
+        {
+            /* All other VCPUs (if any). */
+            pVCpu->tm.s.offTSCRawSrc += pVM->tm.s.offTSCPause;
         }
     }
     return VINF_SUCCESS;
@@ -148,7 +155,7 @@ int tmCpuTickPause(PVMCPU pVCpu)
  * Pauses the CPU timestamp counter ticking.
  *
  * @returns VBox status code.
- * @param   pVM         Pointer to the VM. 
+ * @param   pVM         Pointer to the VM.
  * @param   pVCpu       Pointer to the VMCPU.
  * @internal
  */
@@ -177,20 +184,19 @@ int tmCpuTickPauseLocked(PVM pVM, PVMCPU pVCpu)
 /**
  * Record why we refused to use offsetted TSC.
  *
- * Used by TMCpuTickCanUseRealTSC and TMCpuTickGetDeadlineAndTscOffset.
+ * Used by TMCpuTickCanUseRealTSC() and TMCpuTickGetDeadlineAndTscOffset().
  *
  * @param   pVM         Pointer to the VM.
  * @param   pVCpu       The current CPU.
  */
 DECLINLINE(void) tmCpuTickRecordOffsettedTscRefusal(PVM pVM, PVMCPU pVCpu)
 {
-
     /* Sample the reason for refusing. */
-    if (!pVM->tm.s.fMaybeUseOffsettedHostTSC)
+    if (pVM->tm.s.enmTSCMode != TMTSCMODE_DYNAMIC)
        STAM_COUNTER_INC(&pVM->tm.s.StatTSCNotFixed);
     else if (!pVCpu->tm.s.fTSCTicking)
        STAM_COUNTER_INC(&pVM->tm.s.StatTSCNotTicking);
-    else if (!pVM->tm.s.fTSCUseRealTSC)
+    else if (pVM->tm.s.enmTSCMode != TMTSCMODE_REAL_TSC_OFFSET)
     {
         if (pVM->tm.s.fVirtualSyncCatchUp)
         {
@@ -215,14 +221,45 @@ DECLINLINE(void) tmCpuTickRecordOffsettedTscRefusal(PVM pVM, PVMCPU pVCpu)
  * Checks if AMD-V / VT-x can use an offsetted hardware TSC or not.
  *
  * @returns true/false accordingly.
- * @param   pVCpu       Pointer to the VMCPU.
- * @param   poffRealTSC     The offset against the TSC of the current CPU.
- *                          Can be NULL.
- * @thread EMT.
+ * @param   pVM             Pointer to the cross context VM structure.
+ * @param   pVCpu           Pointer to the VMCPU.
+ * @param   poffRealTsc     The offset against the TSC of the current host CPU,
+ *                          if pfOffsettedTsc is set to true.
+ * @param   pfParavirtTsc   Where to return whether paravirt TSC is enabled.
+ *
+ * @thread  EMT(pVCpu).
+ * @see     TMCpuTickGetDeadlineAndTscOffset().
  */
-VMM_INT_DECL(bool) TMCpuTickCanUseRealTSC(PVMCPU pVCpu, uint64_t *poffRealTSC)
+VMM_INT_DECL(bool) TMCpuTickCanUseRealTSC(PVM pVM, PVMCPU pVCpu, uint64_t *poffRealTsc, bool *pfParavirtTsc)
 {
-    PVM pVM = pVCpu->CTX_SUFF(pVM);
+    Assert(pVCpu->tm.s.fTSCTicking);
+
+    *pfParavirtTsc = pVM->tm.s.fParavirtTscEnabled;
+
+    /*
+     * In real TSC mode it's easy, we just need the delta & offTscRawSrc and
+     * the CPU will add them to RDTSC and RDTSCP at runtime.
+     *
+     * In tmCpuTickGetInternal we do:
+     *          SUPReadTsc() - pVCpu->tm.s.offTSCRawSrc;
+     * Where SUPReadTsc() does:
+     *          ASMReadTSC() - pGipCpu->i64TscDelta;
+     * Which means tmCpuTickGetInternal actually does:
+     *          ASMReadTSC() - pGipCpu->i64TscDelta - pVCpu->tm.s.offTSCRawSrc;
+     * So, the offset to be ADDED to RDTSC[P] is:
+     *          offRealTsc = -(pGipCpu->i64TscDelta + pVCpu->tm.s.offTSCRawSrc)
+     */
+    if (pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET)
+    {
+        /** @todo We should negate both deltas!  It's soo weird that we do the
+         *        exact opposite of what the hardware implements. */
+#ifdef IN_RING3
+        *poffRealTsc = 0 - pVCpu->tm.s.offTSCRawSrc - SUPGetTscDelta();
+#else
+        *poffRealTsc = 0 - pVCpu->tm.s.offTSCRawSrc - SUPGetTscDeltaByCpuSetIndex(pVCpu->iHostCpuSet);
+#endif
+        return true;
+    }
 
     /*
      * We require:
@@ -233,40 +270,23 @@ VMM_INT_DECL(bool) TMCpuTickCanUseRealTSC(PVMCPU pVCpu, uint64_t *poffRealTSC)
      *          b) the virtual sync clock hasn't been halted by an expired timer, and
      *          c) we're not using warp drive (accelerated virtual guest time).
      */
-    if (    pVM->tm.s.fMaybeUseOffsettedHostTSC
-        &&  RT_LIKELY(pVCpu->tm.s.fTSCTicking)
-        &&  (   pVM->tm.s.fTSCUseRealTSC
-             || (   !pVM->tm.s.fVirtualSyncCatchUp
-                 && RT_LIKELY(pVM->tm.s.fVirtualSyncTicking)
-                 && !pVM->tm.s.fVirtualWarpDrive))
-       )
+    if (   pVM->tm.s.enmTSCMode == TMTSCMODE_DYNAMIC
+        && !pVM->tm.s.fVirtualSyncCatchUp
+        && RT_LIKELY(pVM->tm.s.fVirtualSyncTicking)
+        && !pVM->tm.s.fVirtualWarpDrive)
     {
-        if (!pVM->tm.s.fTSCUseRealTSC)
+        /* The source is the timer synchronous virtual clock. */
+        uint64_t u64Now = tmCpuTickGetRawVirtual(pVM, false /* don't check for pending timers */)
+                        - pVCpu->tm.s.offTSCRawSrc;
+        /** @todo When we start collecting statistics on how much time we spend executing
+         * guest code before exiting, we should check this against the next virtual sync
+         * timer timeout. If it's lower than the avg. length, we should trap rdtsc to increase
+         * the chance that we'll get interrupted right after the timer expired. */
+        if (u64Now >= pVCpu->tm.s.u64TSCLastSeen)
         {
-            /* The source is the timer synchronous virtual clock. */
-            Assert(pVM->tm.s.fTSCVirtualized);
-
-            if (poffRealTSC)
-            {
-                uint64_t u64Now = tmCpuTickGetRawVirtual(pVM, false /* don't check for pending timers */)
-                                - pVCpu->tm.s.offTSCRawSrc;
-                /** @todo When we start collecting statistics on how much time we spend executing
-                 * guest code before exiting, we should check this against the next virtual sync
-                 * timer timeout. If it's lower than the avg. length, we should trap rdtsc to increase
-                 * the chance that we'll get interrupted right after the timer expired. */
-                *poffRealTSC = u64Now - ASMReadTSC();
-            }
+            *poffRealTsc = u64Now - ASMReadTSC();
+            return true;    /** @todo count this? */
         }
-        else if (poffRealTSC)
-        {
-            /* The source is the real TSC. */
-            if (pVM->tm.s.fTSCVirtualized)
-                *poffRealTSC = pVCpu->tm.s.offTSCRawSrc;
-            else
-                *poffRealTSC = 0;
-        }
-        /** @todo count this? */
-        return true;
     }
 
 #ifdef VBOX_WITH_STATISTICS
@@ -283,17 +303,21 @@ VMM_INT_DECL(bool) TMCpuTickCanUseRealTSC(PVMCPU pVCpu, uint64_t *poffRealTSC)
  *          tick count for deadlines that are more than a second ahead.
  *
  * @returns The number of host cpu ticks to the next deadline.  Max one second.
- * @param   cNsToDeadline       The number of nano seconds to the next virtual
- *                              sync deadline.
+ * @param   pVCpu           The current CPU.
+ * @param   cNsToDeadline   The number of nano seconds to the next virtual
+ *                          sync deadline.
  */
-DECLINLINE(uint64_t) tmCpuCalcTicksToDeadline(uint64_t cNsToDeadline)
+DECLINLINE(uint64_t) tmCpuCalcTicksToDeadline(PVMCPU pVCpu, uint64_t cNsToDeadline)
 {
     AssertCompile(TMCLOCK_FREQ_VIRTUAL <= _4G);
+#ifdef IN_RING3
+    uint64_t uCpuHz = SUPGetCpuHzFromGip(g_pSUPGlobalInfoPage);
+#else
+    uint64_t uCpuHz = SUPGetCpuHzFromGipBySetIndex(g_pSUPGlobalInfoPage, pVCpu->iHostCpuSet);
+#endif
     if (RT_UNLIKELY(cNsToDeadline >= TMCLOCK_FREQ_VIRTUAL))
-        return SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage);
-    uint64_t cTicks = ASMMultU64ByU32DivByU32(SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage),
-                                              cNsToDeadline,
-                                              TMCLOCK_FREQ_VIRTUAL);
+        return uCpuHz;
+    uint64_t cTicks = ASMMultU64ByU32DivByU32(uCpuHz, cNsToDeadline, TMCLOCK_FREQ_VIRTUAL);
     if (cTicks > 4000)
         cTicks -= 4000; /* fudge to account for overhead */
     else
@@ -307,68 +331,65 @@ DECLINLINE(uint64_t) tmCpuCalcTicksToDeadline(uint64_t cNsToDeadline)
  * use the raw TSC.
  *
  * @returns The number of host CPU clock ticks to the next timer deadline.
+ * @param   pVM             Pointer to the cross context VM structure.
  * @param   pVCpu           The current CPU.
- * @param   poffRealTSC     The offset against the TSC of the current CPU.
+ * @param   poffRealTsc     The offset against the TSC of the current host CPU,
+ *                          if pfOffsettedTsc is set to true.
+ * @param   pfOffsettedTsc  Where to return whether TSC offsetting can be used.
+ * @param   pfParavirtTsc   Where to return whether paravirt TSC is enabled.
+ *
  * @thread  EMT(pVCpu).
- * @remarks Superset of TMCpuTickCanUseRealTSC.
+ * @see     TMCpuTickCanUseRealTSC().
  */
-VMM_INT_DECL(uint64_t) TMCpuTickGetDeadlineAndTscOffset(PVMCPU pVCpu, bool *pfOffsettedTsc, uint64_t *poffRealTSC)
+VMM_INT_DECL(uint64_t) TMCpuTickGetDeadlineAndTscOffset(PVM pVM, PVMCPU pVCpu, uint64_t *poffRealTsc,
+                                                        bool *pfOffsettedTsc, bool *pfParavirtTsc)
 {
-    PVM         pVM = pVCpu->CTX_SUFF(pVM);
-    uint64_t    cTicksToDeadline;
+    Assert(pVCpu->tm.s.fTSCTicking);
+
+    *pfParavirtTsc = pVM->tm.s.fParavirtTscEnabled;
 
     /*
-     * We require:
-     *     1. A fixed TSC, this is checked at init time.
-     *     2. That the TSC is ticking (we shouldn't be here if it isn't)
-     *     3. Either that we're using the real TSC as time source or
-     *          a) we don't have any lag to catch up, and
-     *          b) the virtual sync clock hasn't been halted by an expired timer, and
-     *          c) we're not using warp drive (accelerated virtual guest time).
+     * Same logic as in TMCpuTickCanUseRealTSC.
      */
-    if (    pVM->tm.s.fMaybeUseOffsettedHostTSC
-        &&  RT_LIKELY(pVCpu->tm.s.fTSCTicking)
-        &&  (   pVM->tm.s.fTSCUseRealTSC
-             || (   !pVM->tm.s.fVirtualSyncCatchUp
-                 && RT_LIKELY(pVM->tm.s.fVirtualSyncTicking)
-                 && !pVM->tm.s.fVirtualWarpDrive))
-       )
+    if (pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET)
     {
-        *pfOffsettedTsc = true;
-        if (!pVM->tm.s.fTSCUseRealTSC)
-        {
-            /* The source is the timer synchronous virtual clock. */
-            Assert(pVM->tm.s.fTSCVirtualized);
-
-            uint64_t cNsToDeadline;
-            uint64_t u64NowVirtSync = TMVirtualSyncGetWithDeadlineNoCheck(pVM, &cNsToDeadline);
-            uint64_t u64Now = u64NowVirtSync != TMCLOCK_FREQ_VIRTUAL /* what's the use of this? */
-                            ? ASMMultU64ByU32DivByU32(u64NowVirtSync, pVM->tm.s.cTSCTicksPerSecond, TMCLOCK_FREQ_VIRTUAL)
-                            : u64NowVirtSync;
-            u64Now -= pVCpu->tm.s.offTSCRawSrc;
-            *poffRealTSC = u64Now - ASMReadTSC();
-            cTicksToDeadline = tmCpuCalcTicksToDeadline(cNsToDeadline);
-        }
-        else
-        {
-            /* The source is the real TSC. */
-            if (pVM->tm.s.fTSCVirtualized)
-                *poffRealTSC = pVCpu->tm.s.offTSCRawSrc;
-            else
-                *poffRealTSC = 0;
-            cTicksToDeadline = tmCpuCalcTicksToDeadline(TMVirtualSyncGetNsToDeadline(pVM));
-        }
+        /** @todo We should negate both deltas!  It's soo weird that we do the
+         *        exact opposite of what the hardware implements. */
+#ifdef IN_RING3
+        *poffRealTsc     = 0 - pVCpu->tm.s.offTSCRawSrc - SUPGetTscDelta();
+#else
+        *poffRealTsc     = 0 - pVCpu->tm.s.offTSCRawSrc - SUPGetTscDeltaByCpuSetIndex(pVCpu->iHostCpuSet);
+#endif
+        *pfOffsettedTsc  = true;
+        return tmCpuCalcTicksToDeadline(pVCpu, TMVirtualSyncGetNsToDeadline(pVM));
     }
-    else
+
+    /*
+     * Same logic as in TMCpuTickCanUseRealTSC.
+     */
+    if (   pVM->tm.s.enmTSCMode == TMTSCMODE_DYNAMIC
+        && !pVM->tm.s.fVirtualSyncCatchUp
+        && RT_LIKELY(pVM->tm.s.fVirtualSyncTicking)
+        && !pVM->tm.s.fVirtualWarpDrive)
     {
+        /* The source is the timer synchronous virtual clock. */
+        uint64_t cNsToDeadline;
+        uint64_t u64NowVirtSync = TMVirtualSyncGetWithDeadlineNoCheck(pVM, &cNsToDeadline);
+        uint64_t u64Now = u64NowVirtSync != TMCLOCK_FREQ_VIRTUAL /* what's the use of this? */
+                        ? ASMMultU64ByU32DivByU32(u64NowVirtSync, pVM->tm.s.cTSCTicksPerSecond, TMCLOCK_FREQ_VIRTUAL)
+                        : u64NowVirtSync;
+        u64Now -= pVCpu->tm.s.offTSCRawSrc;
+        *poffRealTsc     = u64Now - ASMReadTSC();
+        *pfOffsettedTsc  = u64Now >= pVCpu->tm.s.u64TSCLastSeen;
+        return tmCpuCalcTicksToDeadline(pVCpu, cNsToDeadline);
+    }
+
 #ifdef VBOX_WITH_STATISTICS
-        tmCpuTickRecordOffsettedTscRefusal(pVM, pVCpu);
+    tmCpuTickRecordOffsettedTscRefusal(pVM, pVCpu);
 #endif
-        *pfOffsettedTsc  = false;
-        *poffRealTSC     = 0;
-        cTicksToDeadline = tmCpuCalcTicksToDeadline(TMVirtualSyncGetNsToDeadline(pVM));
-    }
-    return cTicksToDeadline;
+    *pfOffsettedTsc  = false;
+    *poffRealTsc     = 0;
+    return tmCpuCalcTicksToDeadline(pVCpu, TMVirtualSyncGetNsToDeadline(pVM));
 }
 
 
@@ -385,16 +406,11 @@ DECLINLINE(uint64_t) tmCpuTickGetInternal(PVMCPU pVCpu, bool fCheckTimers)
     if (RT_LIKELY(pVCpu->tm.s.fTSCTicking))
     {
         PVM pVM = pVCpu->CTX_SUFF(pVM);
-        if (pVM->tm.s.fTSCVirtualized)
-        {
-            if (pVM->tm.s.fTSCUseRealTSC)
-                u64 = ASMReadTSC();
-            else
-                u64 = tmCpuTickGetRawVirtual(pVM, fCheckTimers);
-            u64 -= pVCpu->tm.s.offTSCRawSrc;
-        }
+        if (pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET)
+            u64 = SUPReadTsc();
         else
-            u64 = ASMReadTSC();
+            u64 = tmCpuTickGetRawVirtual(pVM, fCheckTimers);
+        u64 -= pVCpu->tm.s.offTSCRawSrc;
 
         /* Always return a value higher than what the guest has already seen. */
         if (RT_LIKELY(u64 > pVCpu->tm.s.u64TSCLastSeen))
@@ -402,7 +418,7 @@ DECLINLINE(uint64_t) tmCpuTickGetInternal(PVMCPU pVCpu, bool fCheckTimers)
         else
         {
             STAM_COUNTER_INC(&pVM->tm.s.StatTSCUnderflow);
-            pVCpu->tm.s.u64TSCLastSeen += 64;   /* @todo choose a good increment here */
+            pVCpu->tm.s.u64TSCLastSeen += 64;   /** @todo choose a good increment here */
             u64 = pVCpu->tm.s.u64TSCLastSeen;
         }
     }
@@ -487,12 +503,12 @@ VMM_INT_DECL(int) TMCpuTickSetLastSeen(PVMCPU pVCpu, uint64_t u64LastSeenTick)
 }
 
 /**
- * Gets the last seen CPU timestamp counter.
+ * Gets the last seen CPU timestamp counter of the guest.
  *
- * @returns last seen TSC
+ * @returns the last seen TSC.
  * @param   pVCpu               Pointer to the VMCPU.
  *
- * @thread  EMT which TSC is to be set.
+ * @thread  EMT(pVCpu).
  */
 VMM_INT_DECL(uint64_t) TMCpuTickGetLastSeen(PVMCPU pVCpu)
 {
@@ -510,12 +526,31 @@ VMM_INT_DECL(uint64_t) TMCpuTickGetLastSeen(PVMCPU pVCpu)
  */
 VMMDECL(uint64_t) TMCpuTicksPerSecond(PVM pVM)
 {
-    if (pVM->tm.s.fTSCUseRealTSC)
+    if (   pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET
+        && g_pSUPGlobalInfoPage->u32Mode != SUPGIPMODE_INVARIANT_TSC)
     {
-        uint64_t cTSCTicksPerSecond = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage);
+#ifdef IN_RING3
+        uint64_t cTSCTicksPerSecond = SUPGetCpuHzFromGip(g_pSUPGlobalInfoPage);
+#elif defined(IN_RING0)
+        uint64_t cTSCTicksPerSecond = SUPGetCpuHzFromGipBySetIndex(g_pSUPGlobalInfoPage, RTMpCpuIdToSetIndex(RTMpCpuId()));
+#else
+        uint64_t cTSCTicksPerSecond = SUPGetCpuHzFromGipBySetIndex(g_pSUPGlobalInfoPage, VMMGetCpu(pVM)->iHostCpuSet);
+#endif
         if (RT_LIKELY(cTSCTicksPerSecond != ~(uint64_t)0))
             return cTSCTicksPerSecond;
     }
     return pVM->tm.s.cTSCTicksPerSecond;
 }
 
+
+/**
+ * Whether the TSC is ticking for the VCPU.
+ *
+ * @returns true if ticking, false otherwise.
+ * @param   pVCpu           Pointer to the VMCPU.
+ */
+VMM_INT_DECL(bool) TMCpuTickIsTicking(PVMCPU pVCpu)
+{
+    return pVCpu->tm.s.fTSCTicking;
+}
+
diff --git a/src/VBox/VMM/VMMAll/TMAllVirtual.cpp b/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
index 89d94c2..4b74903 100644
--- a/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
+++ b/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
@@ -43,45 +43,110 @@
 
 
 /**
- * Helper function that's used by the assembly routines when something goes bust.
- *
- * @param   pData           Pointer to the data structure.
- * @param   u64NanoTS       The calculated nano ts.
- * @param   u64DeltaPrev    The delta relative to the previously returned timestamp.
- * @param   u64PrevNanoTS   The previously returned timestamp (as it was read it).
+ * @interface_method_impl{RTTIMENANOTSDATA, pfnBadPrev}
  */
-DECLEXPORT(void) tmVirtualNanoTSBad(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS)
+DECLEXPORT(void) tmVirtualNanoTSBadPrev(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev,
+                                        uint64_t u64PrevNanoTS)
 {
-    //PVM pVM = (PVM)((uint8_t *)pData - RT_OFFSETOF(VM, CTXALLSUFF(s.tm.VirtualGetRawData)));
+    PVM pVM = RT_FROM_MEMBER(pData, VM, CTX_SUFF(tm.s.VirtualGetRawData));
     pData->cBadPrev++;
     if ((int64_t)u64DeltaPrev < 0)
-        LogRel(("TM: u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64\n",
-                u64DeltaPrev, u64PrevNanoTS, u64NanoTS));
+        LogRel(("TM: u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64 pVM=%p\n",
+                u64DeltaPrev, u64PrevNanoTS, u64NanoTS, pVM));
     else
-        Log(("TM: u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64 (debugging?)\n",
-             u64DeltaPrev, u64PrevNanoTS, u64NanoTS));
+        Log(("TM: u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64 pVM=%p (debugging?)\n",
+             u64DeltaPrev, u64PrevNanoTS, u64NanoTS, pVM));
 }
 
 
 /**
- * Called the first time somebody asks for the time or when the GIP
- * is mapped/unmapped.
+ * @interface_method_impl{RTTIMENANOTSDATA, pfnRediscover}
  *
- * This should never ever happen.
+ * This is the initial worker, so the first call in each context ends up here.
+ * It is also used should the delta rating of the host CPUs change or if the
+ * fGetGipCpu feature the current worker relies upon becomes unavailable.  The
+ * last two events may occur as CPUs are taken online.
  */
 DECLEXPORT(uint64_t) tmVirtualNanoTSRediscover(PRTTIMENANOTSDATA pData)
 {
-    NOREF(pData);
-    //PVM pVM = (PVM)((uint8_t *)pData - RT_OFFSETOF(VM, CTXALLSUFF(s.tm.VirtualGetRawData)));
+    PVM pVM = RT_FROM_MEMBER(pData, VM, CTX_SUFF(tm.s.VirtualGetRawData));
+
+    /*
+     * We require a valid GIP for the selection below.  Invalid GIP is fatal.
+     */
     PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
-    AssertFatalMsgFailed(("pGip=%p u32Magic=%#x\n", pGip, VALID_PTR(pGip) ? pGip->u32Magic : 0));
-#ifndef _MSC_VER
-    return 0; /* gcc false positive warning */
+    AssertFatalMsg(RT_VALID_PTR(pGip), ("pVM=%p pGip=%p\n", pVM, pGip));
+    AssertFatalMsg(pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC, ("pVM=%p pGip=%p u32Magic=%#x\n", pVM, pGip, pGip->u32Magic));
+    AssertFatalMsg(pGip->u32Mode > SUPGIPMODE_INVALID && pGip->u32Mode < SUPGIPMODE_END,
+                   ("pVM=%p pGip=%p u32Mode=%#x\n", pVM, pGip, pGip->u32Mode));
+
+    /*
+     * Determine the new worker.
+     */
+    PFNTIMENANOTSINTERNAL   pfnWorker;
+    bool const              fLFence = RT_BOOL(ASMCpuId_EDX(1) & X86_CPUID_FEATURE_EDX_SSE2);
+    switch (pGip->u32Mode)
+    {
+        case SUPGIPMODE_SYNC_TSC:
+        case SUPGIPMODE_INVARIANT_TSC:
+#if defined(IN_RC) || defined(IN_RING0)
+            if (pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO)
+                pfnWorker = fLFence ? RTTimeNanoTSLFenceSyncInvarNoDelta    : RTTimeNanoTSLegacySyncInvarNoDelta;
+            else
+                pfnWorker = fLFence ? RTTimeNanoTSLFenceSyncInvarWithDelta  : RTTimeNanoTSLegacySyncInvarWithDelta;
+#else
+            if (pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS)
+                pfnWorker = pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO
+                          ? fLFence ? RTTimeNanoTSLFenceSyncInvarNoDelta    : RTTimeNanoTSLegacySyncInvarNoDelta
+                          : fLFence ? RTTimeNanoTSLFenceSyncInvarWithDeltaUseIdtrLim : RTTimeNanoTSLegacySyncInvarWithDeltaUseIdtrLim;
+            else if (pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS)
+                pfnWorker = pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_PRACTICALLY_ZERO
+                          ? fLFence ? RTTimeNanoTSLFenceSyncInvarNoDelta    : RTTimeNanoTSLegacySyncInvarNoDelta
+                          : fLFence ? RTTimeNanoTSLFenceSyncInvarWithDeltaUseRdtscp : RTTimeNanoTSLegacySyncInvarWithDeltaUseRdtscp;
+            else
+                pfnWorker = pGip->enmUseTscDelta <= SUPGIPUSETSCDELTA_ROUGHLY_ZERO
+                          ? fLFence ? RTTimeNanoTSLFenceSyncInvarNoDelta    : RTTimeNanoTSLegacySyncInvarNoDelta
+                          : fLFence ? RTTimeNanoTSLFenceSyncInvarWithDeltaUseApicId : RTTimeNanoTSLegacySyncInvarWithDeltaUseApicId;
 #endif
+            break;
+
+        case SUPGIPMODE_ASYNC_TSC:
+#if defined(IN_RC) || defined(IN_RING0)
+            pfnWorker = fLFence ? RTTimeNanoTSLFenceAsync : RTTimeNanoTSLegacyAsync;
+#else
+            if (pGip->fGetGipCpu & SUPGIPGETCPU_IDTR_LIMIT_MASK_MAX_SET_CPUS)
+                pfnWorker = fLFence ? RTTimeNanoTSLFenceAsyncUseIdtrLim     : RTTimeNanoTSLegacyAsyncUseIdtrLim;
+            else if (pGip->fGetGipCpu & SUPGIPGETCPU_RDTSCP_MASK_MAX_SET_CPUS)
+                pfnWorker = fLFence ? RTTimeNanoTSLFenceAsyncUseRdtscp      : RTTimeNanoTSLegacyAsyncUseRdtscp;
+            else
+                pfnWorker = fLFence ? RTTimeNanoTSLFenceAsyncUseApicId      : RTTimeNanoTSLegacyAsyncUseApicId;
+#endif
+            break;
+
+        default:
+            AssertFatalMsgFailed(("pVM=%p pGip=%p u32Mode=%#x\n", pVM, pGip, pGip->u32Mode));
+    }
+
+    /*
+     * Update the pfnVirtualGetRaw pointer and call the worker we selected.
+     */
+    ASMAtomicWritePtr((void * volatile *)&CTX_SUFF(pVM->tm.s.pfnVirtualGetRaw), (void *)(uintptr_t)pfnWorker);
+    return pfnWorker(pData);
 }
 
 
-#if 1
+/**
+ * @interface_method_impl{RTTIMENANOTSDATA, pfnBadGipIndex}
+ */
+DECLEXPORT(uint64_t) tmVirtualNanoTSBadCpuIndex(PRTTIMENANOTSDATA pData, uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu)
+{
+    PVM pVM = RT_FROM_MEMBER(pData, VM, CTX_SUFF(tm.s.VirtualGetRawData));
+    AssertFatalMsgFailed(("pVM=%p idApic=%#x iCpuSet=%#x iGipCpu=%#x\n", pVM, idApic, iCpuSet, iGipCpu));
+#ifndef _MSC_VER
+    return UINT64_MAX;
+#endif
+}
+
 
 /**
  * Wrapper around the IPRT GIP time methods.
@@ -100,183 +165,6 @@ DECLINLINE(uint64_t) tmVirtualGetRawNanoTS(PVM pVM)
     return u64;
 }
 
-#else
-
-/**
- * This is (mostly) the same as rtTimeNanoTSInternal() except
- * for the two globals which live in TM.
- *
- * @returns Nanosecond timestamp.
- * @param   pVM     Pointer to the VM.
- */
-static uint64_t tmVirtualGetRawNanoTS(PVM pVM)
-{
-    uint64_t    u64Delta;
-    uint32_t    u32NanoTSFactor0;
-    uint64_t    u64TSC;
-    uint64_t    u64NanoTS;
-    uint32_t    u32UpdateIntervalTSC;
-    uint64_t    u64PrevNanoTS;
-
-    /*
-     * Read the GIP data and the previous value.
-     */
-    for (;;)
-    {
-        uint32_t u32TransactionId;
-        PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
-#ifdef IN_RING3
-        if (RT_UNLIKELY(!pGip || pGip->u32Magic != SUPGLOBALINFOPAGE_MAGIC))
-            return RTTimeSystemNanoTS();
-#endif
-
-        if (pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)
-        {
-            u32TransactionId = pGip->aCPUs[0].u32TransactionId;
-#ifdef RT_OS_L4
-            Assert((u32TransactionId & 1) == 0);
-#endif
-            u32UpdateIntervalTSC = pGip->aCPUs[0].u32UpdateIntervalTSC;
-            u64NanoTS = pGip->aCPUs[0].u64NanoTS;
-            u64TSC = pGip->aCPUs[0].u64TSC;
-            u32NanoTSFactor0 = pGip->u32UpdateIntervalNS;
-            u64Delta = ASMReadTSC();
-            u64PrevNanoTS = ASMAtomicReadU64(&pVM->tm.s.u64VirtualRawPrev);
-            if (RT_UNLIKELY(    pGip->aCPUs[0].u32TransactionId != u32TransactionId
-                            ||  (u32TransactionId & 1)))
-                continue;
-        }
-        else
-        {
-            /* SUPGIPMODE_ASYNC_TSC */
-            PSUPGIPCPU pGipCpu;
-
-            uint8_t u8ApicId = ASMGetApicId();
-            if (RT_LIKELY(u8ApicId < RT_ELEMENTS(pGip->aCPUs)))
-                pGipCpu = &pGip->aCPUs[u8ApicId];
-            else
-            {
-                AssertMsgFailed(("%x\n", u8ApicId));
-                pGipCpu = &pGip->aCPUs[0];
-            }
-
-            u32TransactionId = pGipCpu->u32TransactionId;
-#ifdef RT_OS_L4
-            Assert((u32TransactionId & 1) == 0);
-#endif
-            u32UpdateIntervalTSC = pGipCpu->u32UpdateIntervalTSC;
-            u64NanoTS = pGipCpu->u64NanoTS;
-            u64TSC = pGipCpu->u64TSC;
-            u32NanoTSFactor0 = pGip->u32UpdateIntervalNS;
-            u64Delta = ASMReadTSC();
-            u64PrevNanoTS = ASMAtomicReadU64(&pVM->tm.s.u64VirtualRawPrev);
-#ifdef IN_RC
-            Assert(!(ASMGetFlags() & X86_EFL_IF));
-#else
-            if (RT_UNLIKELY(u8ApicId != ASMGetApicId()))
-                continue;
-            if (RT_UNLIKELY(    pGipCpu->u32TransactionId != u32TransactionId
-                            ||  (u32TransactionId & 1)))
-                continue;
-#endif
-        }
-        break;
-    }
-
-    /*
-     * Calc NanoTS delta.
-     */
-    u64Delta -= u64TSC;
-    if (u64Delta > u32UpdateIntervalTSC)
-    {
-        /*
-         * We've expired the interval, cap it. If we're here for the 2nd
-         * time without any GIP update in-between, the checks against
-         * pVM->tm.s.u64VirtualRawPrev below will force 1ns stepping.
-         */
-        u64Delta = u32UpdateIntervalTSC;
-    }
-#if !defined(_MSC_VER) || defined(RT_ARCH_AMD64) /* GCC makes very pretty code from these two inline calls, while MSC cannot. */
-    u64Delta = ASMMult2xU32RetU64((uint32_t)u64Delta, u32NanoTSFactor0);
-    u64Delta = ASMDivU64ByU32RetU32(u64Delta, u32UpdateIntervalTSC);
-#else
-    __asm
-    {
-        mov     eax, dword ptr [u64Delta]
-        mul     dword ptr [u32NanoTSFactor0]
-        div     dword ptr [u32UpdateIntervalTSC]
-        mov     dword ptr [u64Delta], eax
-        xor     edx, edx
-        mov     dword ptr [u64Delta + 4], edx
-    }
-#endif
-
-    /*
-     * Calculate the time and compare it with the previously returned value.
-     *
-     * Since this function is called *very* frequently when the VM is running
-     * and then mostly on EMT, we can restrict the valid range of the delta
-     * (-1s to 2*GipUpdates) and simplify/optimize the default path.
-     */
-    u64NanoTS += u64Delta;
-    uint64_t u64DeltaPrev = u64NanoTS - u64PrevNanoTS;
-    if (RT_LIKELY(u64DeltaPrev < 1000000000 /* 1s */))
-        /* frequent - less than 1s since last call. */;
-    else if (   (int64_t)u64DeltaPrev < 0
-             && (int64_t)u64DeltaPrev + u32NanoTSFactor0 * 2 > 0)
-    {
-        /* occasional - u64NanoTS is in the 'past' relative to previous returns. */
-        ASMAtomicIncU32(&pVM->tm.s.CTX_SUFF(VirtualGetRawData).c1nsSteps);
-        u64NanoTS = u64PrevNanoTS + 1;
-#ifndef IN_RING3
-        VM_FF_SET(pVM, VM_FF_TO_R3); /* S10 hack */
-#endif
-    }
-    else if (u64PrevNanoTS)
-    {
-        /* Something has gone bust, if negative offset it's real bad. */
-        ASMAtomicIncU32(&pVM->tm.s.CTX_SUFF(VirtualGetRawData).cBadPrev);
-        if ((int64_t)u64DeltaPrev < 0)
-            LogRel(("TM: u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64 u64Delta=%#RX64\n",
-                    u64DeltaPrev, u64PrevNanoTS, u64NanoTS, u64Delta));
-        else
-            Log(("TM: u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64 u64Delta=%#RX64 (debugging?)\n",
-                 u64DeltaPrev, u64PrevNanoTS, u64NanoTS, u64Delta));
-#ifdef DEBUG_bird
-        /** @todo there are some hickups during boot and reset that can cause 2-5 seconds delays. Investigate... */
-        AssertMsg(u64PrevNanoTS > UINT64_C(100000000000) /* 100s */,
-                  ("u64DeltaPrev=%RI64 u64PrevNanoTS=0x%016RX64 u64NanoTS=0x%016RX64 u64Delta=%#RX64\n",
-                  u64DeltaPrev, u64PrevNanoTS, u64NanoTS, u64Delta));
-#endif
-    }
-    /* else: We're resuming (see TMVirtualResume). */
-    if (RT_LIKELY(ASMAtomicCmpXchgU64(&pVM->tm.s.u64VirtualRawPrev, u64NanoTS, u64PrevNanoTS)))
-        return u64NanoTS;
-
-    /*
-     * Attempt updating the previous value, provided we're still ahead of it.
-     *
-     * There is no point in recalculating u64NanoTS because we got preempted or if
-     * we raced somebody while the GIP was updated, since these are events
-     * that might occur at any point in the return path as well.
-     */
-    for (int cTries = 50;;)
-    {
-        u64PrevNanoTS = ASMAtomicReadU64(&pVM->tm.s.u64VirtualRawPrev);
-        if (u64PrevNanoTS >= u64NanoTS)
-            break;
-        if (ASMAtomicCmpXchgU64(&pVM->tm.s.u64VirtualRawPrev, u64NanoTS, u64PrevNanoTS))
-            break;
-        AssertBreak(--cTries <= 0);
-        if (cTries < 25 && !VM_IS_EMT(pVM)) /* give up early */
-            break;
-    }
-
-    return u64NanoTS;
-}
-
-#endif
-
 
 /**
  * Get the time when we're not running at 100%
diff --git a/src/VBox/VMM/VMMAll/TRPMAll.cpp b/src/VBox/VMM/VMMAll/TRPMAll.cpp
index f2b74cb..ee5dbe9 100644
--- a/src/VBox/VMM/VMMAll/TRPMAll.cpp
+++ b/src/VBox/VMM/VMMAll/TRPMAll.cpp
@@ -515,7 +515,7 @@ VMMDECL(int) TRPMForwardTrap(PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, uint32_t iGat
         RTGCPTR     pIDTEntry;
         int         rc;
 
-        Assert(PATMAreInterruptsEnabledByCtxCore(pVM, pRegFrame));
+        Assert(PATMAreInterruptsEnabledByCtx(pVM, CPUMCTX_FROM_CORE(pRegFrame)));
         Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_SELM_SYNC_GDT | VMCPU_FF_SELM_SYNC_LDT | VMCPU_FF_TRPM_SYNC_IDT | VMCPU_FF_SELM_SYNC_TSS));
 
         if (GCPtrIDT && iGate * sizeof(VBOXIDTE) >= cbIDT)
@@ -840,7 +840,7 @@ failure:
     STAM_COUNTER_INC(&pVM->trpm.s.CTX_SUFF_Z(StatForwardFail));
     STAM_PROFILE_ADV_STOP(&pVM->trpm.s.CTX_SUFF_Z(StatForwardProf), a);
 
-    Log(("TRAP%02X: forwarding to REM (ss rpl=%d eflags=%08X VMIF=%d handler=%08X\n", iGate, pRegFrame->ss.Sel & X86_SEL_RPL, pRegFrame->eflags.u32, PATMAreInterruptsEnabledByCtxCore(pVM, pRegFrame), pVM->trpm.s.aGuestTrapHandler[iGate]));
+    Log(("TRAP%02X: forwarding to REM (ss rpl=%d eflags=%08X VMIF=%d handler=%08X\n", iGate, pRegFrame->ss.Sel & X86_SEL_RPL, pRegFrame->eflags.u32, PATMAreInterruptsEnabledByCtx(pVM, CPUMCTX_FROM_CORE(pRegFrame)), pVM->trpm.s.aGuestTrapHandler[iGate]));
 #endif
     return VINF_EM_RAW_GUEST_TRAP;
 }
@@ -864,6 +864,7 @@ failure:
 VMMDECL(int) TRPMRaiseXcpt(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt)
 {
     LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x\n", pCtxCore->cs.Sel, pCtxCore->eip, enmXcpt));
+    NOREF(pCtxCore);
 /** @todo dispatch the trap. */
     pVCpu->trpm.s.uActiveVector            = enmXcpt;
     pVCpu->trpm.s.enmActiveType            = TRPM_TRAP;
@@ -892,6 +893,7 @@ VMMDECL(int) TRPMRaiseXcpt(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt)
 VMMDECL(int) TRPMRaiseXcptErr(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr)
 {
     LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x uErr=%RX32\n", pCtxCore->cs.Sel, pCtxCore->eip, enmXcpt, uErr));
+    NOREF(pCtxCore);
 /** @todo dispatch the trap. */
     pVCpu->trpm.s.uActiveVector            = enmXcpt;
     pVCpu->trpm.s.enmActiveType            = TRPM_TRAP;
@@ -921,6 +923,7 @@ VMMDECL(int) TRPMRaiseXcptErr(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXc
 VMMDECL(int) TRPMRaiseXcptErrCR2(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore, X86XCPT enmXcpt, uint32_t uErr, RTGCUINTPTR uCR2)
 {
     LogFlow(("TRPMRaiseXcptErr: cs:eip=%RTsel:%RX32 enmXcpt=%#x uErr=%RX32 uCR2=%RGv\n", pCtxCore->cs.Sel, pCtxCore->eip, enmXcpt, uErr, uCR2));
+    NOREF(pCtxCore);
 /** @todo dispatch the trap. */
     pVCpu->trpm.s.uActiveVector            = enmXcpt;
     pVCpu->trpm.s.enmActiveType            = TRPM_TRAP;
diff --git a/src/VBox/VMM/VMMAll/VMMAll.cpp b/src/VBox/VMM/VMMAll/VMMAll.cpp
index 0919315..ae7fc1b 100644
--- a/src/VBox/VMM/VMMAll/VMMAll.cpp
+++ b/src/VBox/VMM/VMMAll/VMMAll.cpp
@@ -23,6 +23,7 @@
 #include <VBox/vmm/vmm.h>
 #include "VMMInternal.h"
 #include <VBox/vmm/vm.h>
+#include <VBox/vmm/hm.h>
 #include <VBox/vmm/vmcpuset.h>
 #include <VBox/param.h>
 #include <iprt/thread.h>
@@ -70,6 +71,8 @@ static DECLCALLBACK(size_t) vmmFormatTypeVmCpuSet(PFNRTSTROUTPUT pfnOutput, void
                                                   int cchWidth, int cchPrecision, unsigned fFlags,
                                                   void *pvUser)
 {
+    NOREF(pszType); NOREF(cchWidth); NOREF(cchPrecision); NOREF(fFlags);
+
     PCVMCPUSET  pSet   = (PCVMCPUSET)pvValue;
     uint32_t    cCpus  = 0;
     uint32_t    iCpu   = RT_ELEMENTS(pSet->au32Bitmap) * 32;
@@ -281,7 +284,8 @@ VMMDECL(PVMCPU) VMMGetCpu(PVM pVM)
     /* RTThreadGetNativeSelf had better be cheap. */
     RTNATIVETHREAD hThread = RTThreadNativeSelf();
 
-    /** @todo optimize for large number of VCPUs when that becomes more common. */
+    /** @todo optimize for large number of VCPUs when that becomes more common.
+     * Use a map like GIP does that's indexed by the host CPU index.  */
     for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
     {
         PVMCPU pVCpu = &pVM->aCpus[idCpu];
@@ -387,3 +391,76 @@ uint32_t vmmGetBuildType(void)
     return uRet;
 }
 
+
+/**
+ * Patches the instructions necessary for making a hypercall to the hypervisor.
+ * Used by GIM.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pvBuf       The buffer in the hypercall page(s) to be patched.
+ * @param   cbBuf       The size of the buffer.
+ * @param   pcbWritten  Where to store the number of bytes patched. This
+ *                      is reliably updated only when this function returns
+ *                      VINF_SUCCESS.
+ */
+VMM_INT_DECL(int) VMMPatchHypercall(PVM pVM, void *pvBuf, size_t cbBuf, size_t *pcbWritten)
+{
+    AssertReturn(pvBuf, VERR_INVALID_POINTER);
+    AssertReturn(pcbWritten, VERR_INVALID_POINTER);
+
+    if (ASMIsAmdCpu())
+    {
+        uint8_t abHypercall[] = { 0x0F, 0x01, 0xD9 };   /* VMMCALL */
+        if (RT_LIKELY(cbBuf >= sizeof(abHypercall)))
+        {
+            memcpy(pvBuf, abHypercall, sizeof(abHypercall));
+            *pcbWritten = sizeof(abHypercall);
+            return VINF_SUCCESS;
+        }
+        return VERR_BUFFER_OVERFLOW;
+    }
+    else
+    {
+        AssertReturn(ASMIsIntelCpu() || ASMIsViaCentaurCpu(), VERR_UNSUPPORTED_CPU);
+        uint8_t abHypercall[] = { 0x0F, 0x01, 0xC1 };   /* VMCALL */
+        if (RT_LIKELY(cbBuf >= sizeof(abHypercall)))
+        {
+            memcpy(pvBuf, abHypercall, sizeof(abHypercall));
+            *pcbWritten = sizeof(abHypercall);
+            return VINF_SUCCESS;
+        }
+        return VERR_BUFFER_OVERFLOW;
+    }
+}
+
+
+/**
+ * Notifies VMM that paravirtualized hypercalls are now enabled.
+ *
+ * @param   pVCpu   Pointer to the VMCPU.
+ */
+VMM_INT_DECL(void) VMMHypercallsEnable(PVMCPU pVCpu)
+{
+    /* If there is anything to do for raw-mode, do it here. */
+#ifndef IN_RC
+    if (HMIsEnabled(pVCpu->CTX_SUFF(pVM)))
+        HMHypercallsEnable(pVCpu);
+#endif
+}
+
+
+/**
+ * Notifies VMM that paravirtualized hypercalls are now disabled.
+ *
+ * @param   pVCpu   Pointer to the VMCPU.
+ */
+VMM_INT_DECL(void) VMMHypercallsDisable(PVMCPU pVCpu)
+{
+    /* If there is anything to do for raw-mode, do it here. */
+#ifndef IN_RC
+    if (HMIsEnabled(pVCpu->CTX_SUFF(pVM)))
+        HMHypercallsDisable(pVCpu);
+#endif
+}
+
diff --git a/src/VBox/VMM/VMMR0/CPUMR0.cpp b/src/VBox/VMM/VMMR0/CPUMR0.cpp
index c3e75de..26a9c94 100644
--- a/src/VBox/VMM/VMMR0/CPUMR0.cpp
+++ b/src/VBox/VMM/VMMR0/CPUMR0.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -79,8 +79,8 @@ static CPUMHOSTLAPIC g_aLApics[RTCPUSET_MAX_CPUS];
 static struct
 {
     uint32_t uLeaf;  /**< Leaf to check. */
-    uint32_t ecx;    /**< which bits in ecx to unify between CPUs. */
-    uint32_t edx;    /**< which bits in edx to unify between CPUs. */
+    uint32_t uEcx;   /**< which bits in ecx to unify between CPUs. */
+    uint32_t uEdx;   /**< which bits in edx to unify between CPUs. */
 }
 const g_aCpuidUnifyBits[] =
 {
@@ -157,20 +157,20 @@ static DECLCALLBACK(void) cpumR0CheckCpuid(RTCPUID idCpu, void *pvUser1, void *p
 
         uint32_t   uLeaf = g_aCpuidUnifyBits[i].uLeaf;
         PCPUMCPUID pLegacyLeaf;
-        if (uLeaf < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
-            pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdStd[uLeaf];
-        else if (uLeaf - UINT32_C(0x80000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdExt))
-            pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdExt[uLeaf - UINT32_C(0x80000000)];
-        else if (uLeaf - UINT32_C(0xc0000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur))
-            pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdCentaur[uLeaf - UINT32_C(0xc0000000)];
+        if (uLeaf < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmStd))
+            pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdPatmStd[uLeaf];
+        else if (uLeaf - UINT32_C(0x80000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmExt))
+            pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdPatmExt[uLeaf - UINT32_C(0x80000000)];
+        else if (uLeaf - UINT32_C(0xc0000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmCentaur))
+            pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdPatmCentaur[uLeaf - UINT32_C(0xc0000000)];
         else
             continue;
 
         uint32_t eax, ebx, ecx, edx;
         ASMCpuIdExSlow(uLeaf, 0, 0, 0, &eax, &ebx, &ecx, &edx);
 
-        ASMAtomicAndU32(&pLegacyLeaf->ecx, ecx | ~g_aCpuidUnifyBits[i].ecx);
-        ASMAtomicAndU32(&pLegacyLeaf->edx, edx | ~g_aCpuidUnifyBits[i].edx);
+        ASMAtomicAndU32(&pLegacyLeaf->uEcx, ecx | ~g_aCpuidUnifyBits[i].uEcx);
+        ASMAtomicAndU32(&pLegacyLeaf->uEdx, edx | ~g_aCpuidUnifyBits[i].uEdx);
     }
 }
 
@@ -285,22 +285,23 @@ VMMR0_INT_DECL(int) CPUMR0InitVM(PVM pVM)
 
         for (uint32_t i = 0; i < RT_ELEMENTS(g_aCpuidUnifyBits); i++)
         {
+            bool            fIgnored;
             uint32_t        uLeaf = g_aCpuidUnifyBits[i].uLeaf;
-            PCPUMCPUIDLEAF  pLeaf = cpumCpuIdGetLeaf(pVM, uLeaf, 0);
+            PCPUMCPUIDLEAF  pLeaf = cpumCpuIdGetLeafEx(pVM, uLeaf, 0, &fIgnored);
             if (pLeaf)
             {
                 PCPUMCPUID pLegacyLeaf;
-                if (uLeaf < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
-                    pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdStd[uLeaf];
-                else if (uLeaf - UINT32_C(0x80000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdExt))
-                    pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdExt[uLeaf - UINT32_C(0x80000000)];
-                else if (uLeaf - UINT32_C(0xc0000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur))
-                    pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdCentaur[uLeaf - UINT32_C(0xc0000000)];
+                if (uLeaf < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmStd))
+                    pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdPatmStd[uLeaf];
+                else if (uLeaf - UINT32_C(0x80000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmExt))
+                    pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdPatmExt[uLeaf - UINT32_C(0x80000000)];
+                else if (uLeaf - UINT32_C(0xc0000000) < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmCentaur))
+                    pLegacyLeaf = &pVM->cpum.s.aGuestCpuIdPatmCentaur[uLeaf - UINT32_C(0xc0000000)];
                 else
                     continue;
 
-                pLeaf->uEcx = pLegacyLeaf->ecx;
-                pLeaf->uEdx = pLegacyLeaf->edx;
+                pLeaf->uEcx = pLegacyLeaf->uEcx;
+                pLeaf->uEdx = pLegacyLeaf->uEdx;
             }
         }
 
@@ -337,8 +338,8 @@ VMMR0_INT_DECL(int) CPUMR0InitVM(PVM pVM)
  */
 VMMR0_INT_DECL(int) CPUMR0Trap07Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
-    Assert(pVM->cpum.s.CPUFeatures.edx.u1FXSR);
-    Assert(ASMGetCR4() & X86_CR4_OSFSXR);
+    Assert(pVM->cpum.s.HostFeatures.fFxSaveRstor);
+    Assert(ASMGetCR4() & X86_CR4_OSFXSR);
 
     /* If the FPU state has already been loaded, then it's a guest trap. */
     if (CPUMIsGuestFPUStateActive(pVCpu))
@@ -412,6 +413,7 @@ VMMR0_INT_DECL(int) CPUMR0LoadGuestFPU(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
     else
 #endif
     {
+        NOREF(pCtx);
         Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_MANUAL_XMM_RESTORE));
         /** @todo Move the FFXR handling down into
          *        cpumR0SaveHostRestoreGuestFPUState to optimize the
@@ -419,8 +421,11 @@ VMMR0_INT_DECL(int) CPUMR0LoadGuestFPU(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         /* Clear MSR_K6_EFER_FFXSR or else we'll be unable to save/restore the XMM state with fxsave/fxrstor. */
         uint64_t uHostEfer    = 0;
         bool     fRestoreEfer = false;
-        if (pVM->cpum.s.CPUFeaturesExt.edx & X86_CPUID_AMD_FEATURE_EDX_FFXSR)
+        if (pVM->cpum.s.HostFeatures.fLeakyFxSR)
         {
+            /** @todo r=ramshankar: Can't we used a cached value here
+             *        instead of reading the MSR? host EFER doesn't usually
+             *        change. */
             uHostEfer = ASMRdMsr(MSR_K6_EFER);
             if (uHostEfer & MSR_K6_EFER_FFXSR)
             {
@@ -453,10 +458,10 @@ VMMR0_INT_DECL(int) CPUMR0LoadGuestFPU(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
  */
 VMMR0_INT_DECL(int) CPUMR0SaveGuestFPU(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
-    Assert(pVM->cpum.s.CPUFeatures.edx.u1FXSR);
-    Assert(ASMGetCR4() & X86_CR4_OSFSXR);
+    Assert(pVM->cpum.s.HostFeatures.fFxSaveRstor);
+    Assert(ASMGetCR4() & X86_CR4_OSFXSR);
     AssertReturn((pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU), VINF_SUCCESS);
-    NOREF(pCtx);
+    NOREF(pVM); NOREF(pCtx);
 
 #if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
     if (CPUMIsGuestInLongModeEx(pCtx))
@@ -481,7 +486,7 @@ VMMR0_INT_DECL(int) CPUMR0SaveGuestFPU(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
          *        I'm not able to test such an optimization tonight.
          *        We could just all this in assembly. */
         uint128_t aGuestXmmRegs[16];
-        memcpy(&aGuestXmmRegs[0], &pVCpu->cpum.s.Guest.fpu.aXMM[0], sizeof(aGuestXmmRegs));
+        memcpy(&aGuestXmmRegs[0], &pVCpu->cpum.s.Guest.CTX_SUFF(pXState)->x87.aXMM[0], sizeof(aGuestXmmRegs));
 #endif
 
         /* Clear MSR_K6_EFER_FFXSR or else we'll be unable to save/restore the XMM state with fxsave/fxrstor. */
@@ -504,7 +509,7 @@ VMMR0_INT_DECL(int) CPUMR0SaveGuestFPU(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
             ASMWrMsr(MSR_K6_EFER, uHostEfer | MSR_K6_EFER_FFXSR);
 
 #ifdef VBOX_WITH_KERNEL_USING_XMM
-        memcpy(&pVCpu->cpum.s.Guest.fpu.aXMM[0], &aGuestXmmRegs[0], sizeof(aGuestXmmRegs));
+        memcpy(&pVCpu->cpum.s.Guest.CTX_SUFF(pXState)->x87.aXMM[0], &aGuestXmmRegs[0], sizeof(aGuestXmmRegs));
 #endif
     }
 
@@ -837,6 +842,8 @@ static DECLCALLBACK(void) cpumR0MapLocalApicCpuProber(RTCPUID idCpu, void *pvUse
  */
 static DECLCALLBACK(void) cpumR0MapLocalApicCpuChecker(RTCPUID idCpu, void *pvUser1, void *pvUser2)
 {
+    NOREF(pvUser1); NOREF(pvUser2);
+
     int iCpu = RTMpCpuIdToSetIndex(idCpu);
     AssertReturnVoid(iCpu >= 0 && (unsigned)iCpu < RT_ELEMENTS(g_aLApics));
     if (!g_aLApics[iCpu].fEnabled)
@@ -858,15 +865,31 @@ static DECLCALLBACK(void) cpumR0MapLocalApicCpuChecker(RTCPUID idCpu, void *pvUs
 
 #if 0 /* enable if you need it. */
         if (g_aLApics[iCpu].fX2Apic)
-            SUPR0Printf("CPUM: X2APIC %02u - ver %#010x, lint0=%#07x lint1=%#07x pc=%#07x thmr=%#07x\n",
+            SUPR0Printf("CPUM: X2APIC %02u - ver %#010x, lint0=%#07x lint1=%#07x pc=%#07x thmr=%#07x cmci=%#07x\n",
                         iCpu, uApicVersion,
                         ApicX2RegRead32(APIC_REG_LVT_LINT0), ApicX2RegRead32(APIC_REG_LVT_LINT1),
-                        ApicX2RegRead32(APIC_REG_LVT_PC), ApicX2RegRead32(APIC_REG_LVT_THMR) );
+                        ApicX2RegRead32(APIC_REG_LVT_PC), ApicX2RegRead32(APIC_REG_LVT_THMR),
+                        ApicX2RegRead32(APIC_REG_LVT_CMCI));
         else
-            SUPR0Printf("CPUM: APIC %02u at %RGp (mapped at %p) - ver %#010x, lint0=%#07x lint1=%#07x pc=%#07x thmr=%#07x\n",
+        {
+            SUPR0Printf("CPUM: APIC %02u at %RGp (mapped at %p) - ver %#010x, lint0=%#07x lint1=%#07x pc=%#07x thmr=%#07x cmci=%#07x\n",
                         iCpu, g_aLApics[iCpu].PhysBase, g_aLApics[iCpu].pv, uApicVersion,
                         ApicRegRead(g_aLApics[iCpu].pv, APIC_REG_LVT_LINT0), ApicRegRead(g_aLApics[iCpu].pv, APIC_REG_LVT_LINT1),
-                        ApicRegRead(g_aLApics[iCpu].pv, APIC_REG_LVT_PC), ApicRegRead(g_aLApics[iCpu].pv, APIC_REG_LVT_THMR) );
+                        ApicRegRead(g_aLApics[iCpu].pv, APIC_REG_LVT_PC), ApicRegRead(g_aLApics[iCpu].pv, APIC_REG_LVT_THMR),
+                        ApicRegRead(g_aLApics[iCpu].pv, APIC_REG_LVT_CMCI));
+            if (uApicVersion & 0x80000000)
+            {
+                uint32_t uExtFeatures = ApicRegRead(g_aLApics[iCpu].pv, 0x400);
+                uint32_t cEiLvt = (uExtFeatures >> 16) & 0xff;
+                SUPR0Printf("CPUM: APIC %02u: ExtSpace available. extfeat=%08x eilvt[0..3]=%08x %08x %08x %08x\n",
+                            iCpu,
+                            ApicRegRead(g_aLApics[iCpu].pv, 0x400),
+                            cEiLvt >= 1 ? ApicRegRead(g_aLApics[iCpu].pv, 0x500) : 0,
+                            cEiLvt >= 2 ? ApicRegRead(g_aLApics[iCpu].pv, 0x510) : 0,
+                            cEiLvt >= 3 ? ApicRegRead(g_aLApics[iCpu].pv, 0x520) : 0,
+                            cEiLvt >= 4 ? ApicRegRead(g_aLApics[iCpu].pv, 0x530) : 0);
+            }
+        }
 #endif
     }
     else
@@ -985,13 +1008,13 @@ static void cpumR0UnmapLocalApics(void)
  *
  * @param   pVCpu       Pointer to the cross context CPU structure of the
  *                      calling EMT.
- * @param   idHostCpu   The ID of the current host CPU.
+ * @param   iHostCpuSet The CPU set index of the current host CPU.
  */
-VMMR0_INT_DECL(void) CPUMR0SetLApic(PVMCPU pVCpu, RTCPUID idHostCpu)
+VMMR0_INT_DECL(void) CPUMR0SetLApic(PVMCPU pVCpu, uint32_t iHostCpuSet)
 {
-    int idxCpu = RTMpCpuIdToSetIndex(idHostCpu);
-    pVCpu->cpum.s.pvApicBase = g_aLApics[idxCpu].pv;
-    pVCpu->cpum.s.fX2Apic    = g_aLApics[idxCpu].fX2Apic;
+    Assert(iHostCpuSet <= RT_ELEMENTS(g_aLApics));
+    pVCpu->cpum.s.pvApicBase = g_aLApics[iHostCpuSet].pv;
+    pVCpu->cpum.s.fX2Apic    = g_aLApics[iHostCpuSet].fX2Apic;
 //    Log6(("CPUMR0SetLApic: pvApicBase=%p fX2Apic=%d\n", g_aLApics[idxCpu].pv, g_aLApics[idxCpu].fX2Apic));
 }
 
diff --git a/src/VBox/VMM/VMMR0/CPUMR0A.asm b/src/VBox/VMM/VMMR0/CPUMR0A.asm
index c8e644d..e169def 100644
--- a/src/VBox/VMM/VMMR0/CPUMR0A.asm
+++ b/src/VBox/VMM/VMMR0/CPUMR0A.asm
@@ -1,10 +1,10 @@
-; $Id: CPUMR0A.asm $
+ ; $Id: CPUMR0A.asm $
 ;; @file
-; CPUM - Guest Context Assembly Routines.
+; CPUM - Ring-0 Assembly Routines (supporting HM and IEM).
 ;
 
 ;
-; Copyright (C) 2006-2013 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -40,6 +40,13 @@
 %define CS_OFF_IN_X86FXSTATE    0ch
 %define DS_OFF_IN_X86FXSTATE    14h
 
+;; For numeric expressions
+%ifdef RT_ARCH_AMD64
+ %define CPUMR0_IS_AMD64        1
+%else
+ %define CPUMR0_IS_AMD64        0
+%endif
+
 
 ;*******************************************************************************
 ;* External Symbols                                                            *
@@ -58,6 +65,10 @@ extern NAME(SUPR0AbsKernelCS)
 ;*******************************************************************************
 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
 BEGINDATA
+%if 0 ; Currently not used.
+g_r32_Zero:    dd 0.0
+%endif
+
 ;;
 ; Store the SUPR0AbsIs64bit absolute value here so we can cmp/test without
 ; needing to clobber a register. (This trick doesn't quite work for PE btw.
@@ -69,386 +80,668 @@ GLOBALNAME g_fCPUMIs64bitHost
 
 BEGINCODE
 
-;; Macro for FXSAVE/FXRSTOR leaky behaviour on AMD CPUs, see cpumR3CheckLeakyFpu().
+%if 0 ; Currently not used anywhere.
+;;
+; Macro for FXSAVE/FXRSTOR leaky behaviour on AMD CPUs, see cpumR3CheckLeakyFpu().
+;
 ; Cleans the FPU state, if necessary, before restoring the FPU.
 ;
 ; This macro ASSUMES CR0.TS is not set!
-; @remarks Trashes xAX!!
+;
+; @param    xDX     Pointer to CPUMCPU.
+; @uses     xAX, EFLAGS
+;
 ; Changes here should also be reflected in CPUMRCA.asm's copy!
+;
 %macro CLEANFPU 0
-    test    dword [xDX + CPUMCPU.fUseFlags], CPUM_USE_FFXSR_LEAKY
-    jz      .nothing_to_clean
+        test    dword [xDX + CPUMCPU.fUseFlags], CPUM_USE_FFXSR_LEAKY
+        jz      .nothing_to_clean
 
-    xor     eax, eax
-    fnstsw  ax               ; Get FSW
-    test    eax, RT_BIT(7)   ; If FSW.ES (bit 7) is set, clear it to not cause FPU exceptions
-                             ; while clearing & loading the FPU bits in 'clean_fpu'
-    jz      .clean_fpu
-    fnclex
+        xor     eax, eax
+        fnstsw  ax                      ; FSW -> AX.
+        test    eax, RT_BIT(7)          ; If FSW.ES (bit 7) is set, clear it to not cause FPU exceptions
+                                        ; while clearing & loading the FPU bits in 'clean_fpu' below.
+        jz      .clean_fpu
+        fnclex
 
 .clean_fpu:
-    ffree   st7              ; Clear FPU stack register(7)'s tag entry to prevent overflow if a wraparound occurs
-                             ; for the upcoming push (load)
-    fild    dword [xDX + CPUMCPU.Guest.fpu] ; Explicit FPU load to overwrite FIP, FOP, FDP registers in the FPU.
-
+        ffree   st7                     ; Clear FPU stack register(7)'s tag entry to prevent overflow if a wraparound occurs.
+                                        ; for the upcoming push (load)
+        fild    dword [g_r32_Zero xWrtRIP] ; Explicit FPU load to overwrite FIP, FOP, FDP registers in the FPU.
 .nothing_to_clean:
 %endmacro
+%endif ; Unused.
 
 
-;; Macro for FXSAVE for the guest FPU but tries to figure out whether to
-;  save the 32-bit FPU state or 64-bit FPU state.
+;;
+; Clears CR0.TS and CR0.EM if necessary, saving the previous result.
 ;
-; @remarks Requires CPUMCPU pointer in RDX
-%macro SAVE_32_OR_64_FPU 0
-    o64 fxsave  [rdx + CPUMCPU.Guest.fpu]
-
-    ; Shouldn't be necessary to check if the entire 64-bit FIP is 0 (i.e. guest hasn't used its FPU yet) because it should
-    ; be taken care of by the calling code, i.e. hmR0[Vmx|Svm]LoadSharedCR0() and hmR0[Vmx|Svm]ExitXcptNm() which ensure
-    ; we swap the guest FPU state when it starts using it (#NM). In any case it's only a performance optimization.
-    ; cmp         qword [rdx + CPUMCPU.Guest.fpu + IP_OFF_IN_X86FXSTATE], 0
-    ; je          short %%save_done
-
-    cmp         dword [rdx + CPUMCPU.Guest.fpu + CS_OFF_IN_X86FXSTATE], 0
-    jne         short %%save_done
-    sub         rsp, 20h                         ; Only need 1ch bytes but keep stack aligned otherwise we #GP(0)
-    fnstenv     [rsp]
-    movzx       eax, word [rsp + 10h]
-    mov         [rdx + CPUMCPU.Guest.fpu + CS_OFF_IN_X86FXSTATE], eax
-    movzx       eax, word [rsp + 18h]
-    mov         [rdx + CPUMCPU.Guest.fpu + DS_OFF_IN_X86FXSTATE], eax
-    add         rsp, 20h
-    mov         dword [rdx + CPUMCPU.Guest.fpu + X86_OFF_FXSTATE_RSVD], X86_FXSTATE_RSVD_32BIT_MAGIC
-%%save_done:
-%endmacro
-
-;; Macro for FXRSTOR for the guest FPU but loads the one based on what
-;  was saved before using SAVE_32_OR_64_FPU().
+; This is used to avoid FPU exceptions when touching the FPU state.
 ;
-; @remarks Requires CPUMCPU pointer in RDX
-%macro RESTORE_32_OR_64_FPU 0
-    cmp         dword [rdx + CPUMCPU.Guest.fpu + X86_OFF_FXSTATE_RSVD], X86_FXSTATE_RSVD_32BIT_MAGIC
-    jne         short %%restore_64bit_fpu
-    fxrstor     [rdx + CPUMCPU.Guest.fpu]
-    jmp         short %%restore_fpu_done
-%%restore_64bit_fpu:
-    o64 fxrstor [rdx + CPUMCPU.Guest.fpu]
-%%restore_fpu_done:
-%endmacro
-
-
-;; Macro to save and modify CR0 (if necessary) before touching the FPU state
-;  so as to not cause any FPU exceptions.
+; @param    %1      Register to save the old CR0 in (pass to RESTORE_CR0).
+; @param    %2      Temporary scratch register.
+; @uses     EFLAGS, CR0
 ;
-; @remarks Uses xCX for backing-up CR0 (if CR0 needs to be modified) otherwise clears xCX.
-; @remarks Trashes xAX.
-%macro SAVE_CR0_CLEAR_FPU_TRAPS 0
-    xor     ecx, ecx
-    mov     xAX, cr0
-    test    eax, X86_CR0_TS | X86_CR0_EM    ; Make sure its safe to access the FPU state.
-    jz      %%skip_cr0_write
-    mov     xCX, xAX                        ; Save old CR0
-    and     xAX, ~(X86_CR0_TS | X86_CR0_EM)
-    mov     cr0, xAX
+%macro SAVE_CR0_CLEAR_FPU_TRAPS 2
+        xor     %1, %1
+        mov     %2, cr0
+        test    %2, X86_CR0_TS | X86_CR0_EM ; Make sure its safe to access the FPU state.
+        jz      %%skip_cr0_write
+        mov     %1, %2                  ; Save old CR0
+        and     %2, ~(X86_CR0_TS | X86_CR0_EM)
+        mov     cr0, %2
 %%skip_cr0_write:
 %endmacro
 
-;; Macro to restore CR0 from xCX if necessary.
+;;
+; Restore CR0.TS and CR0.EM state if SAVE_CR0_CLEAR_FPU_TRAPS change it.
+;
+; @param    %1      The register that SAVE_CR0_CLEAR_FPU_TRAPS saved the old CR0 in.
 ;
-; @remarks xCX should contain the CR0 value to restore or 0 if no restoration is needed.
-%macro RESTORE_CR0 0
-    cmp     ecx, 0
-    je      %%skip_cr0_restore
-    mov     cr0, xCX
+%macro RESTORE_CR0 1
+        cmp     %1, 0
+        je      %%skip_cr0_restore
+        mov     cr0, %1
 %%skip_cr0_restore:
 %endmacro
 
 
 ;;
-; Saves the host FPU/XMM state and restores the guest state.
+; Saves the host state.
 ;
-; @returns  0
-; @param    pCPUMCPU  x86:[esp+4] gcc:rdi msc:rcx     CPUMCPU pointer
+; @uses     rax, rdx
+; @param    pCpumCpu    Define for the register containing the CPUMCPU pointer.
+; @param    pXState     Define for the regsiter containing the extended state pointer.
 ;
-align 16
-BEGINPROC cpumR0SaveHostRestoreGuestFPUState
+%macro CPUMR0_SAVE_HOST 0
+        ;
+        ; Load a couple of registers we'll use later in all branches.
+        ;
+        mov     pXState, [pCpumCpu + CPUMCPU.Host.pXStateR0]
+        mov     eax, [pCpumCpu + CPUMCPU.Host.fXStateMask]
+
+%ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
+        ; The joy of 32-bit darwin kernels that runs the CPU in 64-bit mode.
+        cmp     byte [NAME(g_fCPUMIs64bitHost)], 0
+        jz      %%host_legacy_mode
+        db      0xea                    ; jmp far .sixtyfourbit_mode
+        dd      %%host_sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)
+BITS 64
+%%host_sixtyfourbit_mode:
+        or      eax, eax
+        jz      %%host_sixtyfourbit_fxsave
+
+        ; XSAVE
+        mov     edx, [pCpumCpu + CPUMCPU.Host.fXStateMask + 4]
+        o64 xsave [pXState]
+        jmp     %%host_sixtyfourbit_done
+
+        ; FXSAVE
+%%host_sixtyfourbit_fxsave:
+        o64 fxsave [pXState]
+
+%%host_sixtyfourbit_done:
+        jmp far [%%host_fpret wrt rip]
+%%host_fpret:                           ; 16:32 Pointer to %%host_done.
+        dd      %%host_done, NAME(SUPR0AbsKernelCS)
+BITS 32
+
+%%host_legacy_mode:
+%endif
+
+        ;
+        ; XSAVE or FXSAVE?
+        ;
+        or      eax, eax
+        jz      %%host_fxsave
+
+        ; XSAVE
+        mov     edx, [pCpumCpu + CPUMCPU.Host.fXStateMask + 4]
 %ifdef RT_ARCH_AMD64
- %ifdef RT_OS_WINDOWS
-    mov     xDX, rcx
- %else
-    mov     xDX, rdi
- %endif
+        o64 xsave [pXState]
 %else
-    mov     xDX, dword [esp + 4]
+        xsave   [pXState]
 %endif
-    pushf                               ; The darwin kernel can get upset or upset things if an
-    cli                                 ; interrupt occurs while we're doing fxsave/fxrstor/cr0.
+        jmp     %%host_done
 
-    ; Switch the state.
-    or      dword [xDX + CPUMCPU.fUseFlags], (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM)
+        ; FXSAVE
+%%host_fxsave:
+%ifdef RT_ARCH_AMD64
+        o64 fxsave [pXState]            ; Use explicit REX prefix. See @bugref{6398}.
+%else
+        fxsave  [pXState]
+%endif
+
+%%host_done:
+%endmacro ; CPUMR0_SAVE_HOST
 
-    ; Clear CR0 FPU bits to not cause exceptions, uses xCX
-    SAVE_CR0_CLEAR_FPU_TRAPS
-    ; Do NOT use xCX from this point!
+
+;;
+; Loads the host state.
+;
+; @uses     rax, rdx
+; @param    pCpumCpu    Define for the register containing the CPUMCPU pointer.
+; @param    pXState     Define for the regsiter containing the extended state pointer.
+;
+%macro CPUMR0_LOAD_HOST 0
+        ;
+        ; Load a couple of registers we'll use later in all branches.
+        ;
+        mov     pXState, [pCpumCpu + CPUMCPU.Host.pXStateR0]
+        mov     eax, [pCpumCpu + CPUMCPU.Host.fXStateMask]
 
 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
-    cmp     byte [NAME(g_fCPUMIs64bitHost)], 0
-    jz      .legacy_mode
-    db      0xea                        ; jmp far .sixtyfourbit_mode
-    dd      .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)
-.legacy_mode:
-%endif ; VBOX_WITH_HYBRID_32BIT_KERNEL
+        ; The joy of 32-bit darwin kernels that runs the CPU in 64-bit mode.
+        cmp     byte [NAME(g_fCPUMIs64bitHost)], 0
+        jz      %%host_legacy_mode
+        db      0xea                    ; jmp far .sixtyfourbit_mode
+        dd      %%host_sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)
+BITS 64
+%%host_sixtyfourbit_mode:
+        or      eax, eax
+        jz      %%host_sixtyfourbit_fxrstor
+
+        ; XRSTOR
+        mov     edx, [pCpumCpu + CPUMCPU.Host.fXStateMask + 4]
+        o64 xrstor [pXState]
+        jmp     %%host_sixtyfourbit_done
+
+        ; FXRSTOR
+%%host_sixtyfourbit_fxrstor:
+        o64 fxrstor [pXState]
+
+%%host_sixtyfourbit_done:
+        jmp far [%%host_fpret wrt rip]
+%%host_fpret:                           ; 16:32 Pointer to %%host_done.
+        dd      %%host_done, NAME(SUPR0AbsKernelCS)
+BITS 32
 
+%%host_legacy_mode:
+%endif
+
+        ;
+        ; XRSTOR or FXRSTOR?
+        ;
+        or      eax, eax
+        jz      %%host_fxrstor
+
+        ; XRSTOR
+        mov     edx, [pCpumCpu + CPUMCPU.Host.fXStateMask + 4]
 %ifdef RT_ARCH_AMD64
-    ; Use explicit REX prefix. See @bugref{6398}.
-    o64 fxsave  [rdx + CPUMCPU.Host.fpu]    ; ASSUMES that all VT-x/AMD-V boxes sports fxsave/fxrstor (safe assumption)
-
-    ; Restore the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
-    test    dword [rdx + CPUMCPU.fUseFlags], CPUM_USE_SUPPORTS_LONGMODE
-    jnz     short .fpu_load_32_or_64
-    fxrstor [rdx + CPUMCPU.Guest.fpu]
-    jmp     short .fpu_load_done
-.fpu_load_32_or_64:
-    RESTORE_32_OR_64_FPU
-.fpu_load_done:
+        o64 xrstor [pXState]
 %else
-    fxsave  [edx + CPUMCPU.Host.fpu]        ; ASSUMES that all VT-x/AMD-V boxes sports fxsave/fxrstor (safe assumption)
-    fxrstor [edx + CPUMCPU.Guest.fpu]
+        xrstor  [pXState]
 %endif
+        jmp     %%host_done
 
-%ifdef VBOX_WITH_KERNEL_USING_XMM
-    ; Restore the non-volatile xmm registers. ASSUMING 64-bit windows
-    lea     r11, [xDX + CPUMCPU.Host.fpu + XMM_OFF_IN_X86FXSTATE]
-    movdqa  xmm6,  [r11 + 060h]
-    movdqa  xmm7,  [r11 + 070h]
-    movdqa  xmm8,  [r11 + 080h]
-    movdqa  xmm9,  [r11 + 090h]
-    movdqa  xmm10, [r11 + 0a0h]
-    movdqa  xmm11, [r11 + 0b0h]
-    movdqa  xmm12, [r11 + 0c0h]
-    movdqa  xmm13, [r11 + 0d0h]
-    movdqa  xmm14, [r11 + 0e0h]
-    movdqa  xmm15, [r11 + 0f0h]
+        ; FXRSTOR
+%%host_fxrstor:
+%ifdef RT_ARCH_AMD64
+        o64 fxrstor [pXState]           ; Use explicit REX prefix. See @bugref{6398}.
+%else
+        fxrstor [pXState]
 %endif
 
-.done:
-    ; Restore CR0 from xCX if it was previously saved.
-    RESTORE_CR0
-    popf
-    xor     eax, eax
-    ret
+%%host_done:
+%endmacro ; CPUMR0_LOAD_HOST
 
-%ifdef VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0
-ALIGNCODE(16)
-BITS 64
-.sixtyfourbit_mode:
-    and     edx, 0ffffffffh
-    o64 fxsave  [rdx + CPUMCPU.Host.fpu]
-
-    ; Restore the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
-    test    dword [rdx + CPUMCPU.fUseFlags], CPUM_USE_SUPPORTS_LONGMODE
-    jnz     short .fpu_load_32_or_64_darwin
-    fxrstor [rdx + CPUMCPU.Guest.fpu]
-    jmp     short .fpu_load_done_darwin
-.fpu_load_32_or_64_darwin:
-    RESTORE_32_OR_64_FPU
-.fpu_load_done_darwin:
 
-    jmp far [.fpret wrt rip]
-.fpret:                                 ; 16:32 Pointer to .the_end.
-    dd      .done, NAME(SUPR0AbsKernelCS)
-BITS 32
+
+;; Macro for FXSAVE for the guest FPU but tries to figure out whether to
+;  save the 32-bit FPU state or 64-bit FPU state.
+;
+; @param    %1      Pointer to CPUMCPU.
+; @param    %2      Pointer to XState.
+; @param    %3      Force AMD64
+; @uses     xAX, xDX, EFLAGS, 20h of stack.
+;
+%macro SAVE_32_OR_64_FPU 3
+%if CPUMR0_IS_AMD64 || %3
+        ; Save the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
+        test    dword [pCpumCpu + CPUMCPU.fUseFlags], CPUM_USE_SUPPORTS_LONGMODE
+        jnz     short %%save_long_mode_guest
 %endif
-ENDPROC   cpumR0SaveHostRestoreGuestFPUState
+        fxsave  [pXState]
+%if CPUMR0_IS_AMD64 || %3
+        jmp     %%save_done_32bit_cs_ds
+
+%%save_long_mode_guest:
+        o64 fxsave [pXState]
+
+        xor     edx, edx
+        cmp     dword [pXState + CS_OFF_IN_X86FXSTATE], 0
+        jne     short %%save_done
+
+        sub     rsp, 20h                ; Only need 1ch bytes but keep stack aligned otherwise we #GP(0).
+        fnstenv [rsp]
+        movzx   eax, word [rsp + 10h]
+        mov     [pXState + CS_OFF_IN_X86FXSTATE], eax
+        movzx   eax, word [rsp + 18h]
+        add     rsp, 20h
+        mov     [pXState + DS_OFF_IN_X86FXSTATE], eax
+%endif
+%%save_done_32bit_cs_ds:
+        mov     edx, X86_FXSTATE_RSVD_32BIT_MAGIC
+%%save_done:
+        mov     dword [pXState + X86_OFF_FXSTATE_RSVD], edx
+%endmacro ; SAVE_32_OR_64_FPU
 
 
-%ifndef RT_ARCH_AMD64
-%ifdef  VBOX_WITH_64_BITS_GUESTS
-%ifndef VBOX_WITH_HYBRID_32BIT_KERNEL
 ;;
-; Saves the host FPU/XMM state
+; Save the guest state.
 ;
-; @returns  0
-; @param    pCPUMCPU  x86:[esp+4] gcc:rdi msc:rcx     CPUMCPU pointer
+; @uses     rax, rdx
+; @param    pCpumCpu    Define for the register containing the CPUMCPU pointer.
+; @param    pXState     Define for the regsiter containing the extended state pointer.
 ;
-align 16
-BEGINPROC cpumR0SaveHostFPUState
-    mov     xDX, dword [esp + 4]
-    pushf                               ; The darwin kernel can get upset or upset things if an
-    cli                                 ; interrupt occurs while we're doing fxsave/fxrstor/cr0.
+%macro CPUMR0_SAVE_GUEST 0
+        ;
+        ; Load a couple of registers we'll use later in all branches.
+        ;
+        mov     pXState, [pCpumCpu + CPUMCPU.Guest.pXStateR0]
+        mov     eax, [pCpumCpu + CPUMCPU.Guest.fXStateMask]
+
+%ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
+        ; The joy of 32-bit darwin kernels that runs the CPU in 64-bit mode.
+        cmp     byte [NAME(g_fCPUMIs64bitHost)], 0
+        jz      %%guest_legacy_mode
+        db      0xea                    ; jmp far .sixtyfourbit_mode
+        dd      %%guest_sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)
+BITS 64
+%%guest_sixtyfourbit_mode:
+        or      eax, eax
+        jz      %%guest_sixtyfourbit_fxsave
+
+        ; XSAVE
+        mov     edx, [pCpumCpu + CPUMCPU.Guest.fXStateMask + 4]
+        o64 xsave [pXState]
+        jmp     %%guest_sixtyfourbit_done
+
+        ; FXSAVE
+%%guest_sixtyfourbit_fxsave:
+        SAVE_32_OR_64_FPU pCpumCpu, pXState, 1
+
+%%guest_sixtyfourbit_done:
+        jmp far [%%guest_fpret wrt rip]
+%%guest_fpret:                          ; 16:32 Pointer to %%guest_done.
+        dd      %%guest_done, NAME(SUPR0AbsKernelCS)
+BITS 32
+
+%%guest_legacy_mode:
+%endif
 
-    ; Switch the state.
-    or      dword [xDX + CPUMCPU.fUseFlags], (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM)
+        ;
+        ; XSAVE or FXSAVE?
+        ;
+        or      eax, eax
+        jz      %%guest_fxsave
 
-    ; Clear CR0 FPU bits to not cause exceptions, uses xCX
-    SAVE_CR0_CLEAR_FPU_TRAPS
-    ; Do NOT use xCX from this point!
+        ; XSAVE
+        mov     edx, [pCpumCpu + CPUMCPU.Guest.fXStateMask + 4]
+%ifdef VBOX_WITH_KERNEL_USING_XMM
+        and     eax, ~CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS ; Already saved in HMR0A.asm.
+%endif
+%ifdef RT_ARCH_AMD64
+        o64 xsave [pXState]
+%else
+        xsave   [pXState]
+%endif
+        jmp     %%guest_done
 
-    fxsave  [xDX + CPUMCPU.Host.fpu]    ; ASSUMES that all VT-x/AMD-V boxes support fxsave/fxrstor (safe assumption)
+        ; FXSAVE
+%%guest_fxsave:
+        SAVE_32_OR_64_FPU pCpumCpu, pXState, 0
 
-    ; Restore CR0 from xCX if it was saved previously.
-    RESTORE_CR0
+%%guest_done:
+%endmacro ; CPUMR0_SAVE_GUEST
 
-    popf
-    xor     eax, eax
-    ret
-ENDPROC   cpumR0SaveHostFPUState
+
+;;
+; Wrapper for selecting 32-bit or 64-bit FXRSTOR according to what SAVE_32_OR_64_FPU did.
+;
+; @param    %1      Pointer to CPUMCPU.
+; @param    %2      Pointer to XState.
+; @param    %3      Force AMD64.
+; @uses     xAX, xDX, EFLAGS
+;
+%macro RESTORE_32_OR_64_FPU 3
+%if CPUMR0_IS_AMD64 || %3
+        ; Restore the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
+        test    dword [pCpumCpu + CPUMCPU.fUseFlags], CPUM_USE_SUPPORTS_LONGMODE
+        jz      %%restore_32bit_fpu
+        cmp     dword [pXState + X86_OFF_FXSTATE_RSVD], X86_FXSTATE_RSVD_32BIT_MAGIC
+        jne     short %%restore_64bit_fpu
+%%restore_32bit_fpu:
 %endif
+        fxrstor [pXState]
+%if CPUMR0_IS_AMD64 || %3
+        ; TODO: Restore XMM8-XMM15!
+        jmp     short %%restore_fpu_done
+%%restore_64bit_fpu:
+        o64 fxrstor [pXState]
+%%restore_fpu_done:
+%endif
+%endmacro ; RESTORE_32_OR_64_FPU
+
+
+;;
+; Loads the guest state.
+;
+; @uses     rax, rdx
+; @param    pCpumCpu    Define for the register containing the CPUMCPU pointer.
+; @param    pXState     Define for the regsiter containing the extended state pointer.
+;
+%macro CPUMR0_LOAD_GUEST 0
+        ;
+        ; Load a couple of registers we'll use later in all branches.
+        ;
+        mov     pXState, [pCpumCpu + CPUMCPU.Guest.pXStateR0]
+        mov     eax, [pCpumCpu + CPUMCPU.Guest.fXStateMask]
+
+%ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
+        ; The joy of 32-bit darwin kernels that runs the CPU in 64-bit mode.
+        cmp     byte [NAME(g_fCPUMIs64bitHost)], 0
+        jz      %%guest_legacy_mode
+        db      0xea                    ; jmp far .sixtyfourbit_mode
+        dd      %%guest_sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)
+BITS 64
+%%guest_sixtyfourbit_mode:
+        or      eax, eax
+        jz      %%guest_sixtyfourbit_fxrstor
+
+        ; XRSTOR
+        mov     edx, [pCpumCpu + CPUMCPU.Guest.fXStateMask + 4]
+        o64 xrstor [pXState]
+        jmp     %%guest_sixtyfourbit_done
+
+        ; FXRSTOR
+%%guest_sixtyfourbit_fxrstor:
+        RESTORE_32_OR_64_FPU pCpumCpu, pXState, 1
+
+%%guest_sixtyfourbit_done:
+        jmp far [%%guest_fpret wrt rip]
+%%guest_fpret:                          ; 16:32 Pointer to %%guest_done.
+        dd      %%guest_done, NAME(SUPR0AbsKernelCS)
+BITS 32
+
+%%guest_legacy_mode:
 %endif
+
+        ;
+        ; XRSTOR or FXRSTOR?
+        ;
+        or      eax, eax
+        jz      %%guest_fxrstor
+
+        ; XRSTOR
+        mov     edx, [pCpumCpu + CPUMCPU.Guest.fXStateMask + 4]
+%ifdef VBOX_WITH_KERNEL_USING_XMM
+        and     eax, ~CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS ; Will be loaded by HMR0A.asm.
 %endif
+%ifdef RT_ARCH_AMD64
+        o64 xrstor [pXState]
+%else
+        xrstor  [pXState]
+%endif
+        jmp     %%guest_done
+
+        ; FXRSTOR
+%%guest_fxrstor:
+        RESTORE_32_OR_64_FPU pCpumCpu, pXState, 0
+
+%%guest_done:
+%endmacro ; CPUMR0_LOAD_GUEST
 
 
 ;;
-; Saves the guest FPU/XMM state and restores the host state.
+; Saves the host FPU/SSE/AVX state and restores the guest FPU/SSE/AVX state.
 ;
 ; @returns  0
-; @param    pCPUMCPU  x86:[esp+4] gcc:rdi msc:rcx     CPUMCPU pointer
+; @param    pCpumCpu  x86:[ebp+8] gcc:rdi msc:rcx     CPUMCPU pointer
 ;
 align 16
-BEGINPROC cpumR0SaveGuestRestoreHostFPUState
+BEGINPROC cpumR0SaveHostRestoreGuestFPUState
+        ;
+        ; Prologue - xAX+xDX must be free for XSAVE/XRSTOR input.
+        ;
 %ifdef RT_ARCH_AMD64
  %ifdef RT_OS_WINDOWS
-    mov     xDX, rcx
+        mov     r11, rcx
  %else
-    mov     xDX, rdi
+        mov     r11, rdi
  %endif
+ %define pCpumCpu   r11
+ %define pXState    r10
 %else
-    mov     xDX, dword [esp + 4]
+        push    ebp
+        mov     ebp, esp
+        push    ebx
+        push    esi
+        mov     ebx, dword [ebp + 8]
+ %define pCpumCpu ebx
+ %define pXState  esi
 %endif
 
-    ; Only restore FPU if guest has used it.
-    ; Using fxrstor should ensure that we're not causing unwanted exception on the host.
-    test    dword [xDX + CPUMCPU.fUseFlags], CPUM_USED_FPU
-    jz      .fpu_not_used
+        pushf                           ; The darwin kernel can get upset or upset things if an
+        cli                             ; interrupt occurs while we're doing fxsave/fxrstor/cr0.
 
-    pushf                               ; The darwin kernel can get upset or upset things if an
-    cli                                 ; interrupt occurs while we're doing fxsave/fxrstor/cr0.
+        SAVE_CR0_CLEAR_FPU_TRAPS xCX, xAX ; xCX is now old CR0 value, don't use!
 
-    ; Clear CR0 FPU bits to not cause exceptions, uses xCX
-    SAVE_CR0_CLEAR_FPU_TRAPS
-    ; Do NOT use xCX from this point!
+        CPUMR0_SAVE_HOST
+        CPUMR0_LOAD_GUEST
 
-%ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
-    cmp     byte [NAME(g_fCPUMIs64bitHost)], 0
-    jz      .legacy_mode
-    db      0xea                        ; jmp far .sixtyfourbit_mode
-    dd      .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)
-.legacy_mode:
-%endif ; VBOX_WITH_HYBRID_32BIT_KERNEL
+%ifdef VBOX_WITH_KERNEL_USING_XMM
+        ; Restore the non-volatile xmm registers. ASSUMING 64-bit host.
+        mov     pXState, [pCpumCpu + CPUMCPU.Host.pXStateR0]
+        movdqa  xmm6,  [pXState + XMM_OFF_IN_X86FXSTATE + 060h]
+        movdqa  xmm7,  [pXState + XMM_OFF_IN_X86FXSTATE + 070h]
+        movdqa  xmm8,  [pXState + XMM_OFF_IN_X86FXSTATE + 080h]
+        movdqa  xmm9,  [pXState + XMM_OFF_IN_X86FXSTATE + 090h]
+        movdqa  xmm10, [pXState + XMM_OFF_IN_X86FXSTATE + 0a0h]
+        movdqa  xmm11, [pXState + XMM_OFF_IN_X86FXSTATE + 0b0h]
+        movdqa  xmm12, [pXState + XMM_OFF_IN_X86FXSTATE + 0c0h]
+        movdqa  xmm13, [pXState + XMM_OFF_IN_X86FXSTATE + 0d0h]
+        movdqa  xmm14, [pXState + XMM_OFF_IN_X86FXSTATE + 0e0h]
+        movdqa  xmm15, [pXState + XMM_OFF_IN_X86FXSTATE + 0f0h]
+%endif
+
+        RESTORE_CR0 xCX
+        or      dword [pCpumCpu + CPUMCPU.fUseFlags], (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM)
+        popf
 
+%ifdef RT_ARCH_X86
+        pop     esi
+        pop     ebx
+        leave
+%endif
+        xor     eax, eax
+        ret
+ENDPROC   cpumR0SaveHostRestoreGuestFPUState
+
+
+%ifndef RT_ARCH_AMD64
+%ifdef  VBOX_WITH_64_BITS_GUESTS
+%ifndef VBOX_WITH_HYBRID_32BIT_KERNEL
+;;
+; Saves the host FPU/SSE/AVX state.
+;
+; @returns  VINF_SUCCESS (0) in EAX
+; @param    pCpumCpu  x86:[ebp+8] gcc:rdi msc:rcx     CPUMCPU pointer
+;
+align 16
+BEGINPROC cpumR0SaveHostFPUState
+        ;
+        ; Prologue - xAX+xDX must be free for XSAVE/XRSTOR input.
+        ;
 %ifdef RT_ARCH_AMD64
-    ; Save the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
-    test    dword [rdx + CPUMCPU.fUseFlags], CPUM_USE_SUPPORTS_LONGMODE
-    jnz     short .fpu_save_32_or_64
-    fxsave  [rdx + CPUMCPU.Guest.fpu]
-    jmp     short .fpu_save_done
-.fpu_save_32_or_64:
-    SAVE_32_OR_64_FPU
-.fpu_save_done:
-
-    ; Use explicit REX prefix. See @bugref{6398}.
-    o64 fxrstor [rdx + CPUMCPU.Host.fpu]
+ %ifdef RT_OS_WINDOWS
+        mov     r11, rcx
+ %else
+        mov     r11, rdi
+ %endif
+ %define pCpumCpu   r11
+ %define pXState    r10
 %else
-    fxsave  [edx + CPUMCPU.Guest.fpu]       ; ASSUMES that all VT-x/AMD-V boxes support fxsave/fxrstor (safe assumption)
-    fxrstor [edx + CPUMCPU.Host.fpu]
+        push    ebp
+        mov     ebp, esp
+        push    ebx
+        push    esi
+        mov     ebx, dword [ebp + 8]
+ %define pCpumCpu ebx
+ %define pXState  esi
 %endif
 
-.done:
-    ; Restore CR0 from xCX if it was previously saved.
-    RESTORE_CR0
-    and     dword [xDX + CPUMCPU.fUseFlags], ~CPUM_USED_FPU
-    popf
-.fpu_not_used:
-    xor     eax, eax
-    ret
+        pushf                           ; The darwin kernel can get upset or upset things if an
+        cli                             ; interrupt occurs while we're doing fxsave/fxrstor/cr0.
+        SAVE_CR0_CLEAR_FPU_TRAPS xCX, xAX ; xCX is now old CR0 value, don't use!
+
+        CPUMR0_SAVE_HOST
+
+        RESTORE_CR0 xCX
+        or      dword [pCpumCpu + CPUMCPU.fUseFlags], (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM)
+        popf
+
+%ifdef RT_ARCH_X86
+        pop     esi
+        pop     ebx
+        leave
+%endif
+        xor     eax, eax
+        ret
 
 %ifdef VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0
 ALIGNCODE(16)
 BITS 64
 .sixtyfourbit_mode:
-    and     edx, 0ffffffffh
-
-    ; Save the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
-    test    dword [rdx + CPUMCPU.fUseFlags], CPUM_USE_SUPPORTS_LONGMODE
-    jnz     short .fpu_save_32_or_64_darwin
-    fxsave  [rdx + CPUMCPU.Guest.fpu]
-    jmp     short .fpu_save_done_darwin
-.fpu_save_32_or_64_darwin:
-    SAVE_32_OR_64_FPU
-.fpu_save_done_darwin:
-
-    o64 fxrstor [rdx + CPUMCPU.Host.fpu]
-    jmp far [.fpret wrt rip]
+        ; Save the guest FPU (32-bit or 64-bit), preserves existing broken state. See @bugref{7138}.
+        o64 fxsave [pXstate]
+        jmp far [.fpret wrt rip]
 .fpret:                                 ; 16:32 Pointer to .the_end.
-    dd      .done, NAME(SUPR0AbsKernelCS)
+        dd      .done, NAME(SUPR0AbsKernelCS)
 BITS 32
 %endif
-ENDPROC   cpumR0SaveGuestRestoreHostFPUState
+%undef pCpumCpu
+%undef pXState
+ENDPROC   cpumR0SaveHostFPUState
+%endif
+%endif
+%endif
 
 
 ;;
-; Sets the host's FPU/XMM state
+; Saves the guest FPU/SSE/AVX state and restores the host FPU/SSE/AVX state.
 ;
-; @returns  0
-; @param    pCPUMCPU  x86:[esp+4] gcc:rdi msc:rcx     CPUMCPU pointer
+; @returns  VINF_SUCCESS (0) in eax.
+; @param    pCpumCpu  x86:[ebp+8] gcc:rdi msc:rcx     CPUMCPU pointer
 ;
 align 16
-BEGINPROC cpumR0RestoreHostFPUState
+BEGINPROC cpumR0SaveGuestRestoreHostFPUState
+        ;
+        ; Prologue - xAX+xDX must be free for XSAVE/XRSTOR input.
+        ;
 %ifdef RT_ARCH_AMD64
  %ifdef RT_OS_WINDOWS
-    mov     xDX, rcx
+        mov     r11, rcx
  %else
-    mov     xDX, rdi
+        mov     r11, rdi
  %endif
+ %define pCpumCpu   r11
+ %define pXState    r10
 %else
-    mov     xDX, dword [esp + 4]
+        push    ebp
+        mov     ebp, esp
+        push    ebx
+        push    esi
+        mov     ebx, dword [ebp + 8]
+ %define pCpumCpu ebx
+ %define pXState  esi
 %endif
 
-    ; Restore FPU if guest has used it.
-    ; Using fxrstor should ensure that we're not causing unwanted exception on the host.
-    test    dword [xDX + CPUMCPU.fUseFlags], CPUM_USED_FPU
-    jz short .fpu_not_used
+        ;
+        ; Only restore FPU if guest has used it.
+        ;
+        test    dword [pCpumCpu + CPUMCPU.fUseFlags], CPUM_USED_FPU
+        jz      .fpu_not_used
 
-    pushf                               ; The darwin kernel can get upset or upset things if an
-    cli                                 ; interrupt occurs while we're doing fxsave/fxrstor/cr0.
+        pushf                           ; The darwin kernel can get upset or upset things if an
+        cli                             ; interrupt occurs while we're doing fxsave/fxrstor/cr0.
+        SAVE_CR0_CLEAR_FPU_TRAPS xCX, xAX ; xCX is now old CR0 value, don't use!
 
-    ; Clear CR0 FPU bits to not cause exceptions, uses xCX
-    SAVE_CR0_CLEAR_FPU_TRAPS
-    ; Do NOT use xCX from this point!
+        CPUMR0_SAVE_GUEST
+        CPUMR0_LOAD_HOST
+
+        RESTORE_CR0 xCX
+        and     dword [pCpumCpu + CPUMCPU.fUseFlags], ~CPUM_USED_FPU
+        popf
+
+.fpu_not_used:
+%ifdef RT_ARCH_X86
+        pop     esi
+        pop     ebx
+        leave
+%endif
+        xor     eax, eax
+        ret
+%undef pCpumCpu
+%undef pXState
+ENDPROC   cpumR0SaveGuestRestoreHostFPUState
 
-%ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
-    cmp     byte [NAME(g_fCPUMIs64bitHost)], 0
-    jz      .legacy_mode
-    db      0xea                        ; jmp far .sixtyfourbit_mode
-    dd      .sixtyfourbit_mode, NAME(SUPR0Abs64bitKernelCS)
-.legacy_mode:
-%endif ; VBOX_WITH_HYBRID_32BIT_KERNEL
 
+;;
+; Restores the host's FPU/SSE/AVX state from pCpumCpu->Host.
+;
+; @returns  0
+; @param    pCpumCpu  x86:[ebp+8] gcc:rdi msc:rcx     CPUMCPU pointer
+;
+align 16
+BEGINPROC cpumR0RestoreHostFPUState
+        ;
+        ; Prologue - xAX+xDX must be free for XSAVE/XRSTOR input.
+        ;
 %ifdef RT_ARCH_AMD64
-    o64 fxrstor [xDX + CPUMCPU.Host.fpu]
+ %ifdef RT_OS_WINDOWS
+        mov     r11, rcx
+ %else
+        mov     r11, rdi
+ %endif
+ %define pCpumCpu   r11
+ %define pXState    r10
 %else
-    fxrstor [xDX + CPUMCPU.Host.fpu]
+        push    ebp
+        mov     ebp, esp
+        push    ebx
+        push    esi
+        mov     ebx, dword [ebp + 8]
+ %define pCpumCpu ebx
+ %define pXState  esi
 %endif
 
-.done:
-    ; Restore CR0 from xCX if it was previously saved.
-    RESTORE_CR0
-    and     dword [xDX + CPUMCPU.fUseFlags], ~CPUM_USED_FPU
-    popf
-.fpu_not_used:
-    xor     eax, eax
-    ret
+        ;
+        ; Restore FPU if guest has used it.
+        ;
+        test    dword [pCpumCpu + CPUMCPU.fUseFlags], CPUM_USED_FPU
+        jz short .fpu_not_used
 
-%ifdef VBOX_WITH_HYBRID_32BIT_KERNEL_IN_R0
-ALIGNCODE(16)
-BITS 64
-.sixtyfourbit_mode:
-    and     edx, 0ffffffffh
-    o64 fxrstor [rdx + CPUMCPU.Host.fpu]
-    jmp far [.fpret wrt rip]
-.fpret:                                 ; 16:32 Pointer to .the_end.
-    dd      .done, NAME(SUPR0AbsKernelCS)
-BITS 32
+        pushf                           ; The darwin kernel can get upset or upset things if an
+        cli                             ; interrupt occurs while we're doing fxsave/fxrstor/cr0.
+        SAVE_CR0_CLEAR_FPU_TRAPS xCX, xAX ; xCX is now old CR0 value, don't use!
+
+        CPUMR0_LOAD_HOST
+
+        RESTORE_CR0 xCX
+        and     dword [pCpumCpu + CPUMCPU.fUseFlags], ~CPUM_USED_FPU
+        popf
+
+.fpu_not_used:
+%ifdef RT_ARCH_X86
+        pop     esi
+        pop     ebx
+        leave
 %endif
+        xor     eax, eax
+        ret
+%undef pCpumCPu
+%undef pXState
 ENDPROC   cpumR0RestoreHostFPUState
 
 
diff --git a/src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm b/src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm
index d61db91..542f971 100644
--- a/src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm
+++ b/src/VBox/VMM/VMMR0/CPUMR0UnusedA.asm
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2011 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -47,7 +47,7 @@ extern NAME(g_fCPUMIs64bitHost)
 ;;
 ; Restores the guest's FPU/XMM state
 ;
-; @param    pCtx  x86:[esp+4] GCC:rdi MSC:rcx     CPUMCTX pointer
+; @param    pCtx  x86:[esp+4] gcc:rdi msc:rcx     CPUMCTX pointer
 ;
 ; @remarks Used by the disabled CPUM_CAN_HANDLE_NM_TRAPS_IN_KERNEL_MODE code.
 ;
@@ -91,7 +91,7 @@ ENDPROC     cpumR0LoadFPU
 ;;
 ; Restores the guest's FPU/XMM state
 ;
-; @param    pCtx  x86:[esp+4] GCC:rdi MSC:rcx     CPUMCTX pointer
+; @param    pCtx  x86:[esp+4] gcc:rdi msc:rcx     CPUMCTX pointer
 ;
 ; @remarks Used by the disabled CPUM_CAN_HANDLE_NM_TRAPS_IN_KERNEL_MODE code.
 ;
@@ -134,7 +134,7 @@ ENDPROC cpumR0SaveFPU
 ;;
 ; Restores the guest's XMM state
 ;
-; @param    pCtx  x86:[esp+4] GCC:rdi MSC:rcx     CPUMCTX pointer
+; @param    pCtx  x86:[esp+4] gcc:rdi msc:rcx     CPUMCTX pointer
 ;
 ; @remarks  Used by the disabled CPUM_CAN_HANDLE_NM_TRAPS_IN_KERNEL_MODE code.
 ;
@@ -220,7 +220,7 @@ ENDPROC     cpumR0LoadXMM
 ;;
 ; Restores the guest's XMM state
 ;
-; @param    pCtx  x86:[esp+4] GCC:rdi MSC:rcx     CPUMCTX pointer
+; @param    pCtx  x86:[esp+4] gcc:rdi msc:rcx     CPUMCTX pointer
 ;
 ; @remarks  Used by the disabled CPUM_CAN_HANDLE_NM_TRAPS_IN_KERNEL_MODE code.
 ;
@@ -308,7 +308,7 @@ ENDPROC     cpumR0SaveXMM
 ;;
 ; Set the FPU control word; clearing exceptions first
 ;
-; @param  u16FCW    x86:[esp+4] GCC:rdi MSC:rcx     New FPU control word
+; @param  u16FCW    x86:[esp+4] gcc:rdi msc:rcx     New FPU control word
 align 16
 BEGINPROC cpumR0SetFCW
 %ifdef RT_ARCH_AMD64
@@ -342,7 +342,7 @@ ENDPROC   cpumR0GetFCW
 ;;
 ; Set the MXCSR;
 ;
-; @param  u32MXCSR    x86:[esp+4] GCC:rdi MSC:rcx     New MXCSR
+; @param  u32MXCSR    x86:[esp+4] gcc:rdi msc:rcx     New MXCSR
 align 16
 BEGINPROC cpumR0SetMXCSR
 %ifdef RT_ARCH_AMD64
diff --git a/src/VBox/VMM/VMMR0/GIMR0.cpp b/src/VBox/VMM/VMMR0/GIMR0.cpp
new file mode 100644
index 0000000..979626b
--- /dev/null
+++ b/src/VBox/VMM/VMMR0/GIMR0.cpp
@@ -0,0 +1,109 @@
+/* $Id: GIMR0.cpp $ */
+/** @file
+ * Guest Interface Manager (GIM) - Host Context Ring-0.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include "GIMInternal.h"
+#include "GIMHvInternal.h"
+
+#include <VBox/err.h>
+#include <VBox/vmm/vm.h>
+
+
+/**
+ * Does ring-0 per-VM GIM initialization.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR0_INT_DECL(int) GIMR0InitVM(PVM pVM)
+{
+    if (!GIMIsEnabled(pVM))
+        return VINF_SUCCESS;
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimR0HvInitVM(pVM);
+
+        default:
+            break;
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Does ring-0 per-VM GIM termination.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR0_INT_DECL(int) GIMR0TermVM(PVM pVM)
+{
+    if (!GIMIsEnabled(pVM))
+        return VINF_SUCCESS;
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimR0HvTermVM(pVM);
+
+        default:
+            break;
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Updates the paravirtualized TSC supported by the GIM provider.
+ *
+ * @returns VBox status code.
+ * @retval VINF_SUCCESS if the paravirt. TSC is setup and in use.
+ * @retval VERR_GIM_NOT_ENABLED if no GIM provider is configured for this VM.
+ * @retval VERR_GIM_PVTSC_NOT_AVAILABLE if the GIM provider does not support any
+ *         paravirt. TSC.
+ * @retval VERR_GIM_PVTSC_NOT_IN_USE if the GIM provider supports paravirt. TSC
+ *         but the guest isn't currently using it.
+ *
+ * @param   pVM         Pointer to the VM.
+ * @param   u64Offset   The computed TSC offset.
+ *
+ * @thread EMT(pVCpu)
+ */
+VMMR0_INT_DECL(int) GIMR0UpdateParavirtTsc(PVM pVM, uint64_t u64Offset)
+{
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimR0HvUpdateParavirtTsc(pVM, u64Offset);
+
+        case GIMPROVIDERID_KVM:
+            return VINF_SUCCESS;
+
+        case GIMPROVIDERID_NONE:
+            return VERR_GIM_NOT_ENABLED;
+
+        default:
+            break;
+    }
+    return VERR_GIM_PVTSC_NOT_AVAILABLE;
+}
+
diff --git a/src/VBox/VMM/VMMR0/GIMR0Hv.cpp b/src/VBox/VMM/VMMR0/GIMR0Hv.cpp
new file mode 100644
index 0000000..8764bbe
--- /dev/null
+++ b/src/VBox/VMM/VMMR0/GIMR0Hv.cpp
@@ -0,0 +1,170 @@
+/* $Id: GIMR0Hv.cpp $ */
+/** @file
+ * Guest Interface Manager (GIM), Hyper-V - Host Context Ring-0.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include "GIMInternal.h"
+#include "GIMHvInternal.h"
+
+#include <VBox/err.h>
+#include <VBox/vmm/gim.h>
+#include <VBox/vmm/tm.h>
+#include <VBox/vmm/vm.h>
+
+#include <iprt/spinlock.h>
+
+
+#if 0
+/**
+ * Allocates and maps one physically contiguous page. The allocated page is
+ * zero'd out.
+ *
+ * @returns IPRT status code.
+ * @param   pMemObj         Pointer to the ring-0 memory object.
+ * @param   ppVirt          Where to store the virtual address of the
+ *                          allocation.
+ * @param   pPhys           Where to store the physical address of the
+ *                          allocation.
+ */
+static int gimR0HvPageAllocZ(PRTR0MEMOBJ pMemObj, PRTR0PTR ppVirt, PRTHCPHYS pHCPhys)
+{
+    AssertPtr(pMemObj);
+    AssertPtr(ppVirt);
+    AssertPtr(pHCPhys);
+
+    int rc = RTR0MemObjAllocCont(pMemObj, PAGE_SIZE, false /* fExecutable */);
+    if (RT_FAILURE(rc))
+        return rc;
+    *ppVirt  = RTR0MemObjAddress(*pMemObj);
+    *pHCPhys = RTR0MemObjGetPagePhysAddr(*pMemObj, 0 /* iPage */);
+    ASMMemZero32(*ppVirt, PAGE_SIZE);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Frees and unmaps an allocated physical page.
+ *
+ * @param   pMemObj         Pointer to the ring-0 memory object.
+ * @param   ppVirt          Where to re-initialize the virtual address of
+ *                          allocation as 0.
+ * @param   pHCPhys         Where to re-initialize the physical address of the
+ *                          allocation as 0.
+ */
+static void gimR0HvPageFree(PRTR0MEMOBJ pMemObj, PRTR0PTR ppVirt, PRTHCPHYS pHCPhys)
+{
+    AssertPtr(pMemObj);
+    AssertPtr(ppVirt);
+    AssertPtr(pHCPhys);
+    if (*pMemObj != NIL_RTR0MEMOBJ)
+    {
+        int rc = RTR0MemObjFree(*pMemObj, true /* fFreeMappings */);
+        AssertRC(rc);
+        *pMemObj = NIL_RTR0MEMOBJ;
+        *ppVirt  = 0;
+        *pHCPhys = 0;
+    }
+}
+#endif
+
+/**
+ * Updates Hyper-V's reference TSC page.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   u64Offset   The computed TSC offset.
+ * @thread  EMT.
+ */
+VMM_INT_DECL(int) gimR0HvUpdateParavirtTsc(PVM pVM, uint64_t u64Offset)
+{
+    Assert(GIMIsEnabled(pVM));
+    bool fHvTscEnabled = MSR_GIM_HV_REF_TSC_IS_ENABLED(pVM->gim.s.u.Hv.u64TscPageMsr);
+    if (RT_UNLIKELY(!fHvTscEnabled))
+        return VERR_GIM_PVTSC_NOT_ENABLED;
+
+    PCGIMHV          pcHv     = &pVM->gim.s.u.Hv;
+    PCGIMMMIO2REGION pcRegion = &pcHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];
+    PGIMHVREFTSC     pRefTsc  = (PGIMHVREFTSC)pcRegion->CTX_SUFF(pvPage);
+    Assert(pRefTsc);
+
+    /*
+     * Hyper-V reports the reference time in 100 nanosecond units.
+     */
+    uint64_t u64Tsc100Ns = TMCpuTicksPerSecond(pVM) / RT_NS_10MS;
+    int64_t i64TscOffset = (int64_t)u64Offset / u64Tsc100Ns;
+
+    /*
+     * The TSC page can be simulatenously read by other VCPUs in the guest. The
+     * spinlock is only for protecting simultaneous hypervisor writes from other
+     * EMTs.
+     */
+    RTSpinlockAcquire(pcHv->hSpinlockR0);
+    if (pRefTsc->i64TscOffset != i64TscOffset)
+    {
+        if (pRefTsc->u32TscSequence < UINT32_C(0xfffffffe))
+            ASMAtomicIncU32(&pRefTsc->u32TscSequence);
+        else
+            ASMAtomicWriteU32(&pRefTsc->u32TscSequence, 1);
+        ASMAtomicWriteS64(&pRefTsc->i64TscOffset, i64TscOffset);
+    }
+    RTSpinlockRelease(pcHv->hSpinlockR0);
+
+    Assert(pRefTsc->u32TscSequence != 0);
+    Assert(pRefTsc->u32TscSequence != UINT32_C(0xffffffff));
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Does ring-0 per-VM GIM Hyper-V initialization.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR0_INT_DECL(int) gimR0HvInitVM(PVM pVM)
+{
+    AssertPtr(pVM);
+    Assert(GIMIsEnabled(pVM));
+
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+    Assert(pHv->hSpinlockR0 == NIL_RTSPINLOCK);
+
+    int rc = RTSpinlockCreate(&pHv->hSpinlockR0, RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, "Hyper-V");
+    return rc;
+}
+
+
+/**
+ * Does ring-0 per-VM GIM Hyper-V termination.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR0_INT_DECL(int) gimR0HvTermVM(PVM pVM)
+{
+    AssertPtr(pVM);
+    Assert(GIMIsEnabled(pVM));
+
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+    RTSpinlockDestroy(pHv->hSpinlockR0);
+    pHv->hSpinlockR0 = NIL_RTSPINLOCK;
+
+    return VINF_SUCCESS;
+}
+
diff --git a/src/VBox/VMM/VMMR0/GMMR0.cpp b/src/VBox/VMM/VMMR0/GMMR0.cpp
index 1139004..5accfe2 100644
--- a/src/VBox/VMM/VMMR0/GMMR0.cpp
+++ b/src/VBox/VMM/VMMR0/GMMR0.cpp
@@ -4827,6 +4827,8 @@ static int gmmR0SharedModuleCheckPageFirstTime(PGMM pGMM, PGVM pGVM, PGMMSHAREDM
                                                unsigned idxRegion, unsigned idxPage,
                                                PGMMSHAREDPAGEDESC pPageDesc, PGMMSHAREDREGIONDESC pGlobalRegion)
 {
+    NOREF(pModule);
+
     /* Easy case: just change the internal page type. */
     PGMMPAGE pPage = gmmR0GetPage(pGMM, pPageDesc->idPage);
     AssertMsgReturn(pPage, ("idPage=%#x (GCPhys=%RGp HCPhys=%RHp idxRegion=%#x idxPage=%#x) #1\n",
@@ -5435,6 +5437,7 @@ GMMR0DECL(int) GMMR0QueryStatisticsReq(PVM pVM, PGMMQUERYSTATISTICSSREQ pReq)
  */
 GMMR0DECL(int) GMMR0ResetStatistics(PCGMMSTATS pStats, PSUPDRVSESSION pSession, PVM pVM)
 {
+    NOREF(pStats); NOREF(pSession); NOREF(pVM);
     /* Currently nothing we can reset at the moment. */
     return VINF_SUCCESS;
 }
diff --git a/src/VBox/VMM/VMMR0/GVMMR0.cpp b/src/VBox/VMM/VMMR0/GVMMR0.cpp
index 4160425..25ae0a8 100644
--- a/src/VBox/VMM/VMMR0/GVMMR0.cpp
+++ b/src/VBox/VMM/VMMR0/GVMMR0.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2007-2012 Oracle Corporation
+ * Copyright (C) 2007-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -84,7 +84,7 @@
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-#if defined(RT_OS_LINUX) || defined(DOXYGEN_RUNNING)
+#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS) || defined(DOXYGEN_RUNNING)
 /** Define this to enable the periodic preemption timer. */
 # define GVMM_SCHED_WITH_PPT
 #endif
@@ -888,7 +888,7 @@ GVMMR0DECL(int) GVMMR0CreateVM(PSUPDRVSESSION pSession, uint32_t cCpus, PVM *ppV
                                         pVM->aCpus[0].hNativeThreadR0 = hEMT0;
                                         pGVMM->cEMTs += cCpus;
 
-                                        rc = VMMR0ThreadCtxHooksCreate(&pVM->aCpus[0]);
+                                        rc = VMMR0ThreadCtxHookCreateForEmt(&pVM->aCpus[0]);
                                         if (RT_SUCCESS(rc))
                                         {
                                             VBOXVMM_R0_GVMM_VM_CREATED(pGVM, pVM, ProcId, (void *)hEMT0, cCpus);
@@ -1122,7 +1122,7 @@ GVMMR0DECL(int) GVMMR0DestroyVM(PVM pVM)
              *        deregistered before releasing (destroying) it? Only until we find a
              *        solution for not deregistering hooks everytime we're leaving HMR0
              *        context. */
-            VMMR0ThreadCtxHooksRelease(&pVM->aCpus[idCpu]);
+            VMMR0ThreadCtxHookDestroyForEmt(&pVM->aCpus[idCpu]);
         }
 
         SUPR0ObjRelease(pvObj, pHandle->pSession);
@@ -1350,8 +1350,7 @@ GVMMR0DECL(int) GVMMR0RegisterVCpu(PVM pVM, VMCPUID idCpu)
 
     pVM->aCpus[idCpu].hNativeThreadR0 = pGVM->aCpus[idCpu].hEMT = RTThreadNativeSelf();
 
-    rc = VMMR0ThreadCtxHooksCreate(&pVM->aCpus[idCpu]);
-    return rc;
+    return VMMR0ThreadCtxHookCreateForEmt(&pVM->aCpus[idCpu]);
 }
 
 
@@ -2206,7 +2205,7 @@ static DECLCALLBACK(void) gvmmR0SchedPeriodicPreemptionTimerCallback(PRTTIMER pT
             if (pCpu->Ppt.aHzHistory[i] > uHistMaxHz)
                 uHistMaxHz = pCpu->Ppt.aHzHistory[i];
         if (uHistMaxHz == pCpu->Ppt.uTimerHz)
-            RTSpinlockReleaseNoInts(pCpu->Ppt.hSpinlock);
+            RTSpinlockRelease(pCpu->Ppt.hSpinlock);
         else if (uHistMaxHz)
         {
             /*
@@ -2223,7 +2222,7 @@ static DECLCALLBACK(void) gvmmR0SchedPeriodicPreemptionTimerCallback(PRTTIMER pT
                                                        / cNsInterval;
             else
                 pCpu->Ppt.cTicksHistoriziationInterval = 1;
-            RTSpinlockReleaseNoInts(pCpu->Ppt.hSpinlock);
+            RTSpinlockRelease(pCpu->Ppt.hSpinlock);
 
             /*SUPR0Printf("Cpu%u: change to %u Hz / %u ns\n", pCpu->idxCpuSet, uHistMaxHz, cNsInterval);*/
             RTTimerChangeInterval(pTimer, cNsInterval);
@@ -2236,14 +2235,14 @@ static DECLCALLBACK(void) gvmmR0SchedPeriodicPreemptionTimerCallback(PRTTIMER pT
             pCpu->Ppt.fStarted    = false;
             pCpu->Ppt.uTimerHz    = 0;
             pCpu->Ppt.cNsInterval = 0;
-            RTSpinlockReleaseNoInts(pCpu->Ppt.hSpinlock);
+            RTSpinlockRelease(pCpu->Ppt.hSpinlock);
 
             /*SUPR0Printf("Cpu%u: stopping (%u Hz)\n", pCpu->idxCpuSet, uHistMaxHz);*/
             RTTimerStop(pTimer);
         }
     }
     else
-        RTSpinlockReleaseNoInts(pCpu->Ppt.hSpinlock);
+        RTSpinlockRelease(pCpu->Ppt.hSpinlock);
 }
 #endif /* GVMM_SCHED_WITH_PPT */
 
@@ -2310,7 +2309,7 @@ GVMMR0DECL(void) GVMMR0SchedUpdatePeriodicPreemptionTimer(PVM pVM, RTCPUID idHos
                 pCpu->Ppt.cTicksHistoriziationInterval = 1;
         }
 
-        RTSpinlockReleaseNoInts(pCpu->Ppt.hSpinlock);
+        RTSpinlockRelease(pCpu->Ppt.hSpinlock);
 
         if (cNsInterval)
         {
@@ -2322,7 +2321,7 @@ GVMMR0DECL(void) GVMMR0SchedUpdatePeriodicPreemptionTimer(PVM pVM, RTCPUID idHos
             if (RT_FAILURE(rc))
                 pCpu->Ppt.fStarted = false;
             pCpu->Ppt.fStarting = false;
-            RTSpinlockReleaseNoInts(pCpu->Ppt.hSpinlock);
+            RTSpinlockRelease(pCpu->Ppt.hSpinlock);
         }
     }
 #else  /* !GVMM_SCHED_WITH_PPT */
diff --git a/src/VBox/VMM/VMMR0/HMR0.cpp b/src/VBox/VMM/VMMR0/HMR0.cpp
index 23ae8cf..fb670f7 100644
--- a/src/VBox/VMM/VMMR0/HMR0.cpp
+++ b/src/VBox/VMM/VMMR0/HMR0.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -15,7 +15,6 @@
  * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
  */
 
-
 /*******************************************************************************
 *   Header Files                                                               *
 *******************************************************************************/
@@ -26,6 +25,7 @@
 #include <VBox/vmm/vm.h>
 #include <VBox/vmm/hm_vmx.h>
 #include <VBox/vmm/hm_svm.h>
+#include <VBox/vmm/gim.h>
 #include <VBox/err.h>
 #include <VBox/log.h>
 #include <iprt/assert.h>
@@ -85,16 +85,16 @@ static struct
 
     /** @name Ring-0 method table for AMD-V and VT-x specific operations.
      * @{ */
-    DECLR0CALLBACKMEMBER(int,  pfnEnterSession,(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu));
-    DECLR0CALLBACKMEMBER(void, pfnThreadCtxCallback,(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit));
-    DECLR0CALLBACKMEMBER(int,  pfnSaveHostState,(PVM pVM, PVMCPU pVCpu));
-    DECLR0CALLBACKMEMBER(int,  pfnRunGuestCode,(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx));
-    DECLR0CALLBACKMEMBER(int,  pfnEnableCpu,(PHMGLOBALCPUINFO pCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage,
-                                             bool fEnabledByHost, void *pvArg));
-    DECLR0CALLBACKMEMBER(int,  pfnDisableCpu,(PHMGLOBALCPUINFO pCpu, void *pvCpuPage, RTHCPHYS HCPhysCpuPage));
-    DECLR0CALLBACKMEMBER(int,  pfnInitVM,(PVM pVM));
-    DECLR0CALLBACKMEMBER(int,  pfnTermVM,(PVM pVM));
-    DECLR0CALLBACKMEMBER(int,  pfnSetupVM,(PVM pVM));
+    DECLR0CALLBACKMEMBER(int,  pfnEnterSession, (PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu));
+    DECLR0CALLBACKMEMBER(void, pfnThreadCtxCallback, (RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit));
+    DECLR0CALLBACKMEMBER(int,  pfnSaveHostState, (PVM pVM, PVMCPU pVCpu));
+    DECLR0CALLBACKMEMBER(int,  pfnRunGuestCode, (PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx));
+    DECLR0CALLBACKMEMBER(int,  pfnEnableCpu, (PHMGLOBALCPUINFO pCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage,
+                                              bool fEnabledByHost, void *pvArg));
+    DECLR0CALLBACKMEMBER(int,  pfnDisableCpu, (PHMGLOBALCPUINFO pCpu, void *pvCpuPage, RTHCPHYS HCPhysCpuPage));
+    DECLR0CALLBACKMEMBER(int,  pfnInitVM, (PVM pVM));
+    DECLR0CALLBACKMEMBER(int,  pfnTermVM, (PVM pVM));
+    DECLR0CALLBACKMEMBER(int,  pfnSetupVM ,(PVM pVM));
     /** @} */
 
     /** Maximum ASID allowed. */
@@ -230,12 +230,6 @@ static DECLCALLBACK(int) hmR0DummyEnter(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(int) hmR0DummyLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
-{
-    NOREF(pVM); NOREF(pVCpu); NOREF(pCtx);
-    return VINF_SUCCESS;
-}
-
 static DECLCALLBACK(void) hmR0DummyThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit)
 {
     NOREF(enmEvent); NOREF(pVCpu); NOREF(fGlobalInit);
@@ -284,12 +278,6 @@ static DECLCALLBACK(int) hmR0DummySaveHostState(PVM pVM, PVMCPU pVCpu)
     return VINF_SUCCESS;
 }
 
-static DECLCALLBACK(int) hmR0DummyLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
-{
-    NOREF(pVM); NOREF(pVCpu); NOREF(pCtx);
-    return VINF_SUCCESS;
-}
-
 /** @} */
 
 
@@ -625,7 +613,10 @@ VMMR0_INT_DECL(int) HMR0Init(void)
     static RTONCE s_OnceInit = RTONCE_INITIALIZER;
     g_HvmR0.EnableAllCpusOnce = s_OnceInit;
     for (unsigned i = 0; i < RT_ELEMENTS(g_HvmR0.aCpuInfo); i++)
+    {
         g_HvmR0.aCpuInfo[i].hMemObj = NIL_RTR0MEMOBJ;
+        g_HvmR0.aCpuInfo[i].idCpu   = NIL_RTCPUID;
+    }
 
     /* Fill in all callbacks with placeholders. */
     g_HvmR0.pfnEnterSession      = hmR0DummyEnter;
@@ -803,51 +794,9 @@ static DECLCALLBACK(void) hmR0InitIntelCpu(RTCPUID idCpu, void *pvUser1, void *p
     PHMR0FIRSTRC pFirstRc = (PHMR0FIRSTRC)pvUser1;
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     Assert(idCpu == (RTCPUID)RTMpCpuIdToSetIndex(idCpu)); /** @todo fix idCpu == index assumption (rainy day) */
-    NOREF(pvUser2);
-
-    uint64_t   fFC            = ASMRdMsr(MSR_IA32_FEATURE_CONTROL);
-    bool const fInSmxMode     = RT_BOOL(ASMGetCR4() & X86_CR4_SMXE);
-    bool       fMsrLocked     = RT_BOOL(fFC & MSR_IA32_FEATURE_CONTROL_LOCK);
-    bool       fSmxVmxAllowed = RT_BOOL(fFC & MSR_IA32_FEATURE_CONTROL_SMX_VMXON);
-    bool       fVmxAllowed    = RT_BOOL(fFC & MSR_IA32_FEATURE_CONTROL_VMXON);
-
-    /* Check if the LOCK bit is set but excludes the required VMXON bit. */
-    int rc = VERR_HM_IPE_1;
-    if (fMsrLocked)
-    {
-        if (fInSmxMode && !fSmxVmxAllowed)
-            rc = VERR_VMX_MSR_SMX_VMXON_DISABLED;
-        else if (!fInSmxMode && !fVmxAllowed)
-            rc = VERR_VMX_MSR_VMXON_DISABLED;
-        else
-            rc = VINF_SUCCESS;
-    }
-    else
-    {
-        /*
-         * MSR is not yet locked; we can change it ourselves here.
-         * Once the lock bit is set, this MSR can no longer be modified.
-         */
-        fFC |= MSR_IA32_FEATURE_CONTROL_LOCK;
-        if (fInSmxMode)
-            fFC |= MSR_IA32_FEATURE_CONTROL_SMX_VMXON;
-        else
-            fFC |= MSR_IA32_FEATURE_CONTROL_VMXON;
-
-        ASMWrMsr(MSR_IA32_FEATURE_CONTROL, fFC);
-
-        /* Verify. */
-        fFC                 = ASMRdMsr(MSR_IA32_FEATURE_CONTROL);
-        fMsrLocked          = RT_BOOL(fFC & MSR_IA32_FEATURE_CONTROL_LOCK);
-        fSmxVmxAllowed      = fMsrLocked && RT_BOOL(fFC & MSR_IA32_FEATURE_CONTROL_SMX_VMXON);
-        fVmxAllowed         = fMsrLocked && RT_BOOL(fFC & MSR_IA32_FEATURE_CONTROL_VMXON);
-        bool const fAllowed = fInSmxMode ? fSmxVmxAllowed : fVmxAllowed;
-        if (fAllowed)
-            rc = VINF_SUCCESS;
-        else
-            rc = VERR_VMX_MSR_LOCKING_FAILED;
-    }
+    NOREF(idCpu); NOREF(pvUser2);
 
+    int rc = SUPR0GetVmxUsability(NULL /* pfIsSmxModeAmbiguous */);
     hmR0FirstRcSetStatus(pFirstRc, rc);
 }
 
@@ -865,36 +814,9 @@ static DECLCALLBACK(void) hmR0InitAmdCpu(RTCPUID idCpu, void *pvUser1, void *pvU
     PHMR0FIRSTRC pFirstRc = (PHMR0FIRSTRC)pvUser1;
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     Assert(idCpu == (RTCPUID)RTMpCpuIdToSetIndex(idCpu)); /** @todo fix idCpu == index assumption (rainy day) */
-    NOREF(pvUser2);
-
-    /* Check if SVM is disabled. */
-    int rc;
-    uint64_t fVmCr = ASMRdMsr(MSR_K8_VM_CR);
-    if (!(fVmCr & MSR_K8_VM_CR_SVM_DISABLE))
-    {
-        /* Turn on SVM in the EFER MSR. */
-        uint64_t fEfer = ASMRdMsr(MSR_K6_EFER);
-        if (fEfer & MSR_K6_EFER_SVME)
-            rc = VERR_SVM_IN_USE;
-        else
-        {
-            ASMWrMsr(MSR_K6_EFER, fEfer | MSR_K6_EFER_SVME);
-
-            /* Paranoia. */
-            fEfer = ASMRdMsr(MSR_K6_EFER);
-            if (fEfer & MSR_K6_EFER_SVME)
-            {
-                /* Restore previous value. */
-                ASMWrMsr(MSR_K6_EFER, fEfer & ~MSR_K6_EFER_SVME);
-                rc = VINF_SUCCESS;
-            }
-            else
-                rc = VERR_SVM_ILLEGAL_EFER_MSR;
-        }
-    }
-    else
-        rc = VERR_SVM_DISABLED;
+    NOREF(idCpu); NOREF(pvUser2);
 
+    int rc = SUPR0GetSvmUsability(true /* fInitSvm */);
     hmR0FirstRcSetStatus(pFirstRc, rc);
 }
 
@@ -915,6 +837,7 @@ static int hmR0EnableCpu(PVM pVM, RTCPUID idCpu)
     Assert(idCpu == (RTCPUID)RTMpCpuIdToSetIndex(idCpu)); /** @todo fix idCpu == index assumption (rainy day) */
     Assert(idCpu < RT_ELEMENTS(g_HvmR0.aCpuInfo));
     Assert(!pCpu->fConfigured);
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
     pCpu->idCpu = idCpu;
     /* Do NOT reset cTlbFlushes here, see @bugref{6255}. */
@@ -926,7 +849,7 @@ static int hmR0EnableCpu(PVM pVM, RTCPUID idCpu)
     {
         AssertLogRelMsgReturn(pCpu->hMemObj != NIL_RTR0MEMOBJ, ("hmR0EnableCpu failed idCpu=%u.\n", idCpu), VERR_HM_IPE_1);
         void    *pvCpuPage     = RTR0MemObjAddress(pCpu->hMemObj);
-        RTHCPHYS HCPhysCpuPage = RTR0MemObjGetPagePhysAddr(pCpu->hMemObj, 0);
+        RTHCPHYS HCPhysCpuPage = RTR0MemObjGetPagePhysAddr(pCpu->hMemObj, 0 /* iPage */);
 
         if (g_HvmR0.vmx.fSupported)
             rc = g_HvmR0.pfnEnableCpu(pCpu, pVM, pvCpuPage, HCPhysCpuPage, false, &g_HvmR0.vmx.Msrs);
@@ -1001,8 +924,10 @@ static DECLCALLBACK(int32_t) hmR0EnableAllCpuOnce(void *pvUser)
          */
         rc = SUPR0EnableVTx(true /* fEnable */);
         if (RT_SUCCESS(rc))
+        {
             /* If the host provides a VT-x init API, then we'll rely on that for global init. */
             g_HvmR0.fGlobalInit = pVM->hm.s.fGlobalInit = true;
+        }
         else
             AssertMsgFailed(("hmR0EnableAllCpuOnce/SUPR0EnableVTx: rc=%Rrc\n", rc));
     }
@@ -1052,8 +977,7 @@ static DECLCALLBACK(int32_t) hmR0EnableAllCpuOnce(void *pvUser)
  */
 VMMR0_INT_DECL(int) HMR0EnableAllCpus(PVM pVM)
 {
-    /* Make sure we don't touch HM after we've disabled HM in
-       preparation of a suspend. */
+    /* Make sure we don't touch HM after we've disabled HM in preparation of a suspend. */
     if (ASMAtomicReadBool(&g_HvmR0.fSuspended))
         return VERR_HM_SUSPEND_PENDING;
 
@@ -1065,7 +989,7 @@ VMMR0_INT_DECL(int) HMR0EnableAllCpus(PVM pVM)
  * Disable VT-x or AMD-V on the current CPU.
  *
  * @returns VBox status code.
- * @param   idCpu       The identifier for the CPU the function is called on.
+ * @param   idCpu       The identifier for the CPU this function is called on.
  *
  * @remarks Must be called with preemption disabled.
  */
@@ -1078,13 +1002,13 @@ static int hmR0DisableCpu(RTCPUID idCpu)
     Assert(idCpu == (RTCPUID)RTMpCpuIdToSetIndex(idCpu)); /** @todo fix idCpu == index assumption (rainy day) */
     Assert(idCpu < RT_ELEMENTS(g_HvmR0.aCpuInfo));
     Assert(!pCpu->fConfigured || pCpu->hMemObj != NIL_RTR0MEMOBJ);
+    AssertRelease(idCpu == RTMpCpuId());
 
     if (pCpu->hMemObj == NIL_RTR0MEMOBJ)
         return pCpu->fConfigured ? VERR_NO_MEMORY : VINF_SUCCESS /* not initialized. */;
 
     int rc;
-    if (   pCpu->fConfigured
-        && idCpu == RTMpCpuId())    /* We may not be firing on the CPU being disabled/going offline. */
+    if (pCpu->fConfigured)
     {
         void    *pvCpuPage     = RTR0MemObjAddress(pCpu->hMemObj);
         RTHCPHYS HCPhysCpuPage = RTR0MemObjGetPagePhysAddr(pCpu->hMemObj, 0);
@@ -1093,6 +1017,7 @@ static int hmR0DisableCpu(RTCPUID idCpu)
         AssertRCReturn(rc, rc);
 
         pCpu->fConfigured = false;
+        pCpu->idCpu = NIL_RTCPUID;
     }
     else
         rc = VINF_SUCCESS; /* nothing to do */
@@ -1117,6 +1042,22 @@ static DECLCALLBACK(void) hmR0DisableCpuCallback(RTCPUID idCpu, void *pvUser1, v
 
 
 /**
+ * Worker function passed to RTMpOnSpecific() that is to be called on the target
+ * CPU.
+ *
+ * @param   idCpu       The identifier for the CPU the function is called on.
+ * @param   pvUser1     Null, not used.
+ * @param   pvUser2     Null, not used.
+ */
+static DECLCALLBACK(void) hmR0DisableCpuOnSpecificCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    NOREF(pvUser1);
+    NOREF(pvUser2);
+    hmR0DisableCpu(idCpu);
+}
+
+
+/**
  * Callback function invoked when a cpu goes online or offline.
  *
  * @param   enmEvent            The Mp event.
@@ -1131,13 +1072,23 @@ static DECLCALLBACK(void) hmR0MpEventCallback(RTMPEVENT enmEvent, RTCPUID idCpu,
      * We only care about uninitializing a CPU that is going offline. When a
      * CPU comes online, the initialization is done lazily in HMR0Enter().
      */
-    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     switch (enmEvent)
     {
         case RTMPEVENT_OFFLINE:
         {
-            int rc = hmR0DisableCpu(idCpu);
-            AssertRC(rc);
+            RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+            RTThreadPreemptDisable(&PreemptState);
+            if (idCpu == RTMpCpuId())
+            {
+                int rc = hmR0DisableCpu(idCpu);
+                AssertRC(rc);
+                RTThreadPreemptRestore(&PreemptState);
+            }
+            else
+            {
+                RTThreadPreemptRestore(&PreemptState);
+                RTMpOnSpecific(idCpu, hmR0DisableCpuOnSpecificCallback, NULL /* pvUser1 */, NULL /* pvUser2 */);
+            }
             break;
         }
 
@@ -1215,13 +1166,16 @@ static DECLCALLBACK(void) hmR0PowerCallback(RTPOWEREVENT enmEvent, void *pvUser)
 
 
 /**
- * Does Ring-0 per VM HM initialization.
+ * Does ring-0 per-VM HM initialization.
  *
  * This will copy HM global into the VM structure and call the CPU specific
  * init routine which will allocate resources for each virtual CPU and such.
  *
  * @returns VBox status code.
  * @param   pVM         Pointer to the VM.
+ *
+ * @remarks This is called after HMR3Init(), see vmR3CreateU() and
+ *          vmR3InitRing3().
  */
 VMMR0_INT_DECL(int) HMR0InitVM(PVM pVM)
 {
@@ -1238,12 +1192,10 @@ VMMR0_INT_DECL(int) HMR0InitVM(PVM pVM)
     /*
      * Copy globals to the VM structure.
      */
-    /** @todo r=ramshankar: Why do we do this for MSRs? We never change them in the
-     *        per-VM structures anyway... */
     pVM->hm.s.vmx.fSupported            = g_HvmR0.vmx.fSupported;
     pVM->hm.s.svm.fSupported            = g_HvmR0.svm.fSupported;
 
-    pVM->hm.s.vmx.fUsePreemptTimer      = g_HvmR0.vmx.fUsePreemptTimer;
+    pVM->hm.s.vmx.fUsePreemptTimer     &= g_HvmR0.vmx.fUsePreemptTimer;     /* Can be overridden by CFGM. See HMR3Init(). */
     pVM->hm.s.vmx.cPreemptTimerShift    = g_HvmR0.vmx.cPreemptTimerShift;
     pVM->hm.s.vmx.u64HostCr4            = g_HvmR0.vmx.u64HostCr4;
     pVM->hm.s.vmx.u64HostEfer           = g_HvmR0.vmx.u64HostEfer;
@@ -1254,10 +1206,8 @@ VMMR0_INT_DECL(int) HMR0InitVM(PVM pVM)
     pVM->hm.s.cpuid.u32AMDFeatureECX    = g_HvmR0.cpuid.u32AMDFeatureECX;
     pVM->hm.s.cpuid.u32AMDFeatureEDX    = g_HvmR0.cpuid.u32AMDFeatureEDX;
     pVM->hm.s.lLastError                = g_HvmR0.lLastError;
-
     pVM->hm.s.uMaxAsid                  = g_HvmR0.uMaxAsid;
 
-
     if (!pVM->hm.s.cMaxResumeLoops) /* allow ring-3 overrides */
     {
         pVM->hm.s.cMaxResumeLoops       = 1024;
@@ -1271,14 +1221,12 @@ VMMR0_INT_DECL(int) HMR0InitVM(PVM pVM)
     for (VMCPUID i = 0; i < pVM->cCpus; i++)
     {
         PVMCPU pVCpu = &pVM->aCpus[i];
+        pVCpu->hm.s.idEnteredCpu   = NIL_RTCPUID;
+        pVCpu->hm.s.idLastCpu      = NIL_RTCPUID;
+        pVCpu->hm.s.fGIMTrapXcptUD = GIMShouldTrapXcptUD(pVCpu);
 
-        pVCpu->hm.s.idEnteredCpu        = NIL_RTCPUID;
-
-        /* Invalidate the last cpu we were running on. */
-        pVCpu->hm.s.idLastCpu           = NIL_RTCPUID;
-
-        /* We'll aways increment this the first time (host uses ASID 0) */
-        pVCpu->hm.s.uCurrentAsid        = 0;
+        /* We'll aways increment this the first time (host uses ASID 0). */
+        AssertReturn(!pVCpu->hm.s.uCurrentAsid, VERR_HM_IPE_3);
     }
 
     pVM->hm.s.uHostKernelFeatures = SUPR0GetKernelFeatures();
@@ -1291,7 +1239,7 @@ VMMR0_INT_DECL(int) HMR0InitVM(PVM pVM)
 
 
 /**
- * Does Ring-0 per VM HM termination.
+ * Does ring-0 per VM HM termination.
  *
  * @returns VBox status code.
  * @param   pVM         Pointer to the VM.
@@ -1324,8 +1272,7 @@ VMMR0_INT_DECL(int) HMR0SetupVM(PVM pVM)
     Log(("HMR0SetupVM: %p\n", pVM));
     AssertReturn(pVM, VERR_INVALID_PARAMETER);
 
-    /* Make sure we don't touch HM after we've disabled HM in
-       preparation of a suspend. */
+    /* Make sure we don't touch HM after we've disabled HM in preparation of a suspend. */
     AssertReturn(!ASMAtomicReadBool(&g_HvmR0.fSuspended), VERR_HM_SUSPEND_PENDING);
 
     /* On first entry we'll sync everything. */
@@ -1339,7 +1286,6 @@ VMMR0_INT_DECL(int) HMR0SetupVM(PVM pVM)
     RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
     RTThreadPreemptDisable(&PreemptState);
     RTCPUID          idCpu  = RTMpCpuId();
-    PHMGLOBALCPUINFO pCpu   = &g_HvmR0.aCpuInfo[idCpu];
 
     /* Enable VT-x or AMD-V if local init is required. */
     int rc;
@@ -1390,8 +1336,10 @@ VMMR0_INT_DECL(int) HMR0EnterCpu(PVMCPU pVCpu)
     if (!pCpu->fConfigured)
         rc = hmR0EnableCpu(pVCpu->CTX_SUFF(pVM), idCpu);
 
-    /* Reload host-context (back from ring-3/migrated CPUs), reload host context & shared bits. */
+    /* Reload host-state (back from ring-3/migrated CPUs) and shared guest/host bits. */
     HMCPU_CF_SET(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_HOST_GUEST_SHARED_STATE);
+
+    Assert(pCpu->idCpu == idCpu && pCpu->idCpu != NIL_RTCPUID);
     pVCpu->hm.s.idEnteredCpu = idCpu;
     return rc;
 }
@@ -1417,21 +1365,19 @@ VMMR0_INT_DECL(int) HMR0Enter(PVM pVM, PVMCPU pVCpu)
     AssertRCReturn(rc, rc);
 
 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
-    AssertReturn(!VMMR0ThreadCtxHooksAreRegistered(pVCpu), VERR_HM_IPE_5);
+    AssertReturn(!VMMR0ThreadCtxHookIsEnabled(pVCpu), VERR_HM_IPE_5);
     bool fStartedSet = PGMR0DynMapStartOrMigrateAutoSet(pVCpu);
 #endif
 
     RTCPUID          idCpu = RTMpCpuId();
     PHMGLOBALCPUINFO pCpu  = &g_HvmR0.aCpuInfo[idCpu];
-    PCPUMCTX         pCtx  = CPUMQueryGuestCtxPtr(pVCpu);
     Assert(pCpu);
-    Assert(pCtx);
     Assert(HMCPU_CF_IS_SET(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_HOST_GUEST_SHARED_STATE));
 
     rc = g_HvmR0.pfnEnterSession(pVM, pVCpu, pCpu);
     AssertMsgRCReturn(rc, ("pfnEnterSession failed. rc=%Rrc pVCpu=%p HostCpuId=%u\n", rc, pVCpu, idCpu), rc);
 
-    /* Load the host as we may be resuming code after a longjmp and quite
+    /* Load the host-state as we may be resuming code after a longjmp and quite
        possibly now be scheduled on a different CPU. */
     rc = g_HvmR0.pfnSaveHostState(pVM, pVCpu);
     AssertMsgRCReturn(rc, ("pfnSaveHostState failed. rc=%Rrc pVCpu=%p HostCpuId=%u\n", rc, pVCpu, idCpu), rc);
@@ -1441,8 +1387,7 @@ VMMR0_INT_DECL(int) HMR0Enter(PVM pVM, PVMCPU pVCpu)
         PGMRZDynMapReleaseAutoSet(pVCpu);
 #endif
 
-    /* Keep track of the CPU owning the VMCS for debugging scheduling weirdness
-       and ring-3 calls. */
+    /* Keep track of the CPU owning the VMCS for debugging scheduling weirdness and ring-3 calls. */
     if (RT_FAILURE(rc))
         pVCpu->hm.s.idEnteredCpu = NIL_RTCPUID;
     return rc;
@@ -1461,6 +1406,7 @@ VMMR0_INT_DECL(int) HMR0Enter(PVM pVM, PVMCPU pVCpu)
 VMMR0_INT_DECL(int) HMR0LeaveCpu(PVMCPU pVCpu)
 {
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    VMCPU_ASSERT_EMT_RETURN(pVCpu, VERR_HM_WRONG_CPU);
 
     RTCPUID          idCpu = RTMpCpuId();
     PHMGLOBALCPUINFO pCpu  = &g_HvmR0.aCpuInfo[idCpu];
@@ -1471,15 +1417,14 @@ VMMR0_INT_DECL(int) HMR0LeaveCpu(PVMCPU pVCpu)
         int rc = hmR0DisableCpu(idCpu);
         AssertRCReturn(rc, rc);
         Assert(!pCpu->fConfigured);
+        Assert(pCpu->idCpu == NIL_RTCPUID);
+
+        /* For obtaining a non-zero ASID/VPID on next re-entry. */
+        pVCpu->hm.s.idLastCpu = NIL_RTCPUID;
     }
 
-    /* Reset these to force a TLB flush for the next entry. */
-    pVCpu->hm.s.idLastCpu    = NIL_RTCPUID;
+    /* Clear it while leaving HM context, hmPokeCpuForTlbFlush() relies on this. */
     pVCpu->hm.s.idEnteredCpu = NIL_RTCPUID;
-    VMCPU_FF_SET(pVCpu, VMCPU_FF_TLB_FLUSH);
-
-    /* Clear the VCPU <-> host CPU mapping as we've left HM context. */
-    ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
 
     return VINF_SUCCESS;
 }
@@ -1525,7 +1470,7 @@ VMMR0_INT_DECL(int) HMR0RunGuestCode(PVM pVM, PVMCPU pVCpu)
 #endif
 
 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
-    AssertReturn(!VMMR0ThreadCtxHooksAreRegistered(pVCpu), VERR_HM_IPE_4);
+    AssertReturn(!VMMR0ThreadCtxHookIsEnabled(pVCpu), VERR_HM_IPE_4);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     PGMRZDynMapStartAutoSet(pVCpu);
 #endif
@@ -1695,7 +1640,9 @@ VMMR0_INT_DECL(void) HMR0SavePendingIOPortWrite(PVMCPU pVCpu, RTGCPTR GCPtrRip,
  */
 VMMR0_INT_DECL(int) HMR0EnterSwitcher(PVM pVM, VMMSWITCHER enmSwitcher, bool *pfVTxDisabled)
 {
-    Assert(!(ASMGetFlags() & X86_EFL_IF) || !RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    NOREF(pVM);
+
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
     *pfVTxDisabled = false;
 
@@ -1759,7 +1706,7 @@ VMMR0_INT_DECL(int) HMR0EnterSwitcher(PVM pVM, VMMSWITCHER enmSwitcher, bool *pf
  */
 VMMR0_INT_DECL(void) HMR0LeaveSwitcher(PVM pVM, bool fVTxDisabled)
 {
-    Assert(!(ASMGetFlags() & X86_EFL_IF));
+    Assert(!ASMIntAreEnabled());
 
     if (!fVTxDisabled)
         return;         /* nothing to do */
@@ -1892,12 +1839,10 @@ VMMR0DECL(void) HMR0DumpDescriptor(PCX86DESCHC pDesc, RTSEL Sel, const char *psz
 
 # if HC_ARCH_BITS == 64
     uint64_t    u32Base  = X86DESC64_BASE(pDesc);
-
     Log(("%s %04x - %RX64 %RX64 - base=%RX64 limit=%08x dpl=%d %s\n", pszMsg,
          Sel, pDesc->au64[0], pDesc->au64[1], u32Base, u32Limit, pDesc->Gen.u2Dpl, szMsg));
 # else
     uint32_t    u32Base  = X86DESC_BASE(pDesc);
-
     Log(("%s %04x - %08x %08x - base=%08x limit=%08x dpl=%d %s\n", pszMsg,
          Sel, pDesc->au32[0], pDesc->au32[1], u32Base, u32Limit, pDesc->Gen.u2Dpl, szMsg));
 # endif
@@ -1923,28 +1868,28 @@ VMMR0DECL(void) HMDumpRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         const char *pszSet; const char *pszClear; uint32_t fFlag;
     } const s_aFlags[] =
     {
-        { "vip",NULL, X86_EFL_VIP },
-        { "vif",NULL, X86_EFL_VIF },
-        { "ac", NULL, X86_EFL_AC },
-        { "vm", NULL, X86_EFL_VM },
-        { "rf", NULL, X86_EFL_RF },
-        { "nt", NULL, X86_EFL_NT },
-        { "ov", "nv", X86_EFL_OF },
-        { "dn", "up", X86_EFL_DF },
-        { "ei", "di", X86_EFL_IF },
-        { "tf", NULL, X86_EFL_TF },
-        { "nt", "pl", X86_EFL_SF },
-        { "nz", "zr", X86_EFL_ZF },
-        { "ac", "na", X86_EFL_AF },
-        { "po", "pe", X86_EFL_PF },
-        { "cy", "nc", X86_EFL_CF },
+        { "vip", NULL, X86_EFL_VIP },
+        { "vif", NULL, X86_EFL_VIF },
+        { "ac",  NULL, X86_EFL_AC },
+        { "vm",  NULL, X86_EFL_VM },
+        { "rf",  NULL, X86_EFL_RF },
+        { "nt",  NULL, X86_EFL_NT },
+        { "ov",  "nv", X86_EFL_OF },
+        { "dn",  "up", X86_EFL_DF },
+        { "ei",  "di", X86_EFL_IF },
+        { "tf",  NULL, X86_EFL_TF },
+        { "nt",  "pl", X86_EFL_SF },
+        { "nz",  "zr", X86_EFL_ZF },
+        { "ac",  "na", X86_EFL_AF },
+        { "po",  "pe", X86_EFL_PF },
+        { "cy",  "nc", X86_EFL_CF },
     };
     char szEFlags[80];
     char *psz = szEFlags;
-    uint32_t efl = pCtx->eflags.u32;
+    uint32_t uEFlags = pCtx->eflags.u32;
     for (unsigned i = 0; i < RT_ELEMENTS(s_aFlags); i++)
     {
-        const char *pszAdd = s_aFlags[i].fFlag & efl ? s_aFlags[i].pszSet : s_aFlags[i].pszClear;
+        const char *pszAdd = s_aFlags[i].fFlag & uEFlags ? s_aFlags[i].pszSet : s_aFlags[i].pszClear;
         if (pszAdd)
         {
             strcpy(psz, pszAdd);
@@ -1982,7 +1927,7 @@ VMMR0DECL(void) HMDumpRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
              pCtx->rax, pCtx->rbx, pCtx->rcx, pCtx->rdx, pCtx->rsi, pCtx->rdi,
              pCtx->r8, pCtx->r9, pCtx->r10, pCtx->r11, pCtx->r12, pCtx->r13,
              pCtx->r14, pCtx->r15,
-             pCtx->rip, pCtx->rsp, pCtx->rbp, X86_EFL_GET_IOPL(efl), 31, szEFlags,
+             pCtx->rip, pCtx->rsp, pCtx->rbp, X86_EFL_GET_IOPL(uEFlags), 31, szEFlags,
              pCtx->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, pCtx->cs.Attr.u,
              pCtx->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, pCtx->ds.Attr.u,
              pCtx->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, pCtx->es.Attr.u,
@@ -1992,7 +1937,7 @@ VMMR0DECL(void) HMDumpRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
              pCtx->cr0,  pCtx->cr2, pCtx->cr3,  pCtx->cr4,
              pCtx->dr[0],  pCtx->dr[1], pCtx->dr[2],  pCtx->dr[3],
              pCtx->dr[4],  pCtx->dr[5], pCtx->dr[6],  pCtx->dr[7],
-             pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, efl,
+             pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, uEFlags,
              pCtx->ldtr.Sel, pCtx->ldtr.u64Base, pCtx->ldtr.u32Limit, pCtx->ldtr.Attr.u,
              pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u,
              pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp));
@@ -2012,28 +1957,28 @@ VMMR0DECL(void) HMDumpRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
              "SysEnter={cs=%04llx eip=%08llx esp=%08llx}\n"
              ,
              pCtx->eax, pCtx->ebx, pCtx->ecx, pCtx->edx, pCtx->esi, pCtx->edi,
-             pCtx->eip, pCtx->esp, pCtx->ebp, X86_EFL_GET_IOPL(efl), 31, szEFlags,
+             pCtx->eip, pCtx->esp, pCtx->ebp, X86_EFL_GET_IOPL(uEFlags), 31, szEFlags,
              pCtx->cs.Sel, pCtx->cs.u64Base, pCtx->cs.u32Limit, pCtx->cs.Attr.u, pCtx->dr[0],  pCtx->dr[1],
              pCtx->ds.Sel, pCtx->ds.u64Base, pCtx->ds.u32Limit, pCtx->ds.Attr.u, pCtx->dr[2],  pCtx->dr[3],
              pCtx->es.Sel, pCtx->es.u64Base, pCtx->es.u32Limit, pCtx->es.Attr.u, pCtx->dr[4],  pCtx->dr[5],
              pCtx->fs.Sel, pCtx->fs.u64Base, pCtx->fs.u32Limit, pCtx->fs.Attr.u, pCtx->dr[6],  pCtx->dr[7],
              pCtx->gs.Sel, pCtx->gs.u64Base, pCtx->gs.u32Limit, pCtx->gs.Attr.u, pCtx->cr0,  pCtx->cr2,
              pCtx->ss.Sel, pCtx->ss.u64Base, pCtx->ss.u32Limit, pCtx->ss.Attr.u, pCtx->cr3,  pCtx->cr4,
-             pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, efl,
+             pCtx->gdtr.pGdt, pCtx->gdtr.cbGdt, pCtx->idtr.pIdt, pCtx->idtr.cbIdt, uEFlags,
              pCtx->ldtr.Sel, pCtx->ldtr.u64Base, pCtx->ldtr.u32Limit, pCtx->ldtr.Attr.u,
              pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u,
              pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp));
 
+    PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
     Log(("FPU:\n"
         "FCW=%04x FSW=%04x FTW=%02x\n"
         "FOP=%04x FPUIP=%08x CS=%04x Rsrvd1=%04x\n"
         "FPUDP=%04x DS=%04x Rsvrd2=%04x MXCSR=%08x MXCSR_MASK=%08x\n"
         ,
-        pCtx->fpu.FCW, pCtx->fpu.FSW, pCtx->fpu.FTW,
-        pCtx->fpu.FOP, pCtx->fpu.FPUIP, pCtx->fpu.CS, pCtx->fpu.Rsrvd1,
-        pCtx->fpu.FPUDP, pCtx->fpu.DS, pCtx->fpu.Rsrvd2,
-        pCtx->fpu.MXCSR, pCtx->fpu.MXCSR_MASK));
-
+        pFpuCtx->FCW,   pFpuCtx->FSW,   pFpuCtx->FTW,
+        pFpuCtx->FOP,   pFpuCtx->FPUIP, pFpuCtx->CS, pFpuCtx->Rsrvd1,
+        pFpuCtx->FPUDP, pFpuCtx->DS,    pFpuCtx->Rsrvd2,
+        pFpuCtx->MXCSR, pFpuCtx->MXCSR_MASK));
 
     Log(("MSR:\n"
         "EFER         =%016RX64\n"
@@ -2050,7 +1995,6 @@ VMMR0DECL(void) HMDumpRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         pCtx->msrLSTAR,
         pCtx->msrSFMASK,
         pCtx->msrKERNELGSBASE));
-
 }
 
 #endif /* VBOX_STRICT */
diff --git a/src/VBox/VMM/VMMR0/HMR0A.asm b/src/VBox/VMM/VMMR0/HMR0A.asm
index 49f987d..1049b4c 100644
--- a/src/VBox/VMM/VMMR0/HMR0A.asm
+++ b/src/VBox/VMM/VMMR0/HMR0A.asm
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2013 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -22,6 +22,7 @@
 %include "VBox/err.mac"
 %include "VBox/vmm/hm_vmx.mac"
 %include "VBox/vmm/cpum.mac"
+%include "VBox/vmm/vm.mac"
 %include "iprt/x86.mac"
 %include "HMInternal.mac"
 
@@ -68,6 +69,7 @@
 ; Use define because I'm too lazy to convert the struct.
 %define XMM_OFF_IN_X86FXSTATE   160
 
+
 ;; @def MYPUSHAD
 ; Macro generating an equivalent to pushad
 
@@ -84,39 +86,6 @@
 ; @param 1  full width register name
 ; @param 2  16-bit register name for \a 1.
 
-%ifdef MAYBE_64_BIT
-  ; Save a host and load the corresponding guest MSR (trashes rdx & rcx)
-  %macro LOADGUESTMSR 2
-    mov     rcx, %1
-    rdmsr
-    push    rdx
-    push    rax
-    mov     edx, dword [xSI + %2 + 4]
-    mov     eax, dword [xSI + %2]
-    wrmsr
-  %endmacro
-
-  ; Save a guest and load the corresponding host MSR (trashes rdx & rcx)
-  ; Only really useful for gs kernel base as that one can be changed behind our back (swapgs)
-  %macro LOADHOSTMSREX 2
-    mov     rcx, %1
-    rdmsr
-    mov     dword [xSI + %2], eax
-    mov     dword [xSI + %2 + 4], edx
-    pop     rax
-    pop     rdx
-    wrmsr
-  %endmacro
-
-  ; Load the corresponding host MSR (trashes rdx & rcx)
-  %macro LOADHOSTMSR 1
-    mov     rcx, %1
-    pop     rax
-    pop     rdx
-    wrmsr
-  %endmacro
-%endif
-
 %ifdef ASM_CALL64_GCC
  %macro MYPUSHAD64 0
    push    r15
@@ -155,75 +124,75 @@
 %endif
 
 %ifdef VBOX_SKIP_RESTORE_SEG
-%macro MYPUSHSEGS64 2
-%endmacro
+ %macro MYPUSHSEGS64 2
+ %endmacro
 
-%macro MYPOPSEGS64 2
-%endmacro
-%else ; !VBOX_SKIP_RESTORE_SEG
-; trashes, rax, rdx & rcx
-%macro MYPUSHSEGS64 2
- %ifndef HM_64_BIT_USE_NULL_SEL
+ %macro MYPOPSEGS64 2
+ %endmacro
+%else       ; !VBOX_SKIP_RESTORE_SEG
+ ; trashes, rax, rdx & rcx
+ %macro MYPUSHSEGS64 2
+  %ifndef HM_64_BIT_USE_NULL_SEL
    mov     %2, es
    push    %1
    mov     %2, ds
    push    %1
- %endif
+  %endif
 
    ; Special case for FS; Windows and Linux either don't use it or restore it when leaving kernel mode, Solaris OTOH doesn't and we must save it.
    mov     ecx, MSR_K8_FS_BASE
    rdmsr
    push    rdx
    push    rax
- %ifndef HM_64_BIT_USE_NULL_SEL
+  %ifndef HM_64_BIT_USE_NULL_SEL
    push    fs
- %endif
+  %endif
 
    ; Special case for GS; OSes typically use swapgs to reset the hidden base register for GS on entry into the kernel. The same happens on exit
    mov     ecx, MSR_K8_GS_BASE
    rdmsr
    push    rdx
    push    rax
- %ifndef HM_64_BIT_USE_NULL_SEL
+  %ifndef HM_64_BIT_USE_NULL_SEL
    push    gs
- %endif
-%endmacro
+  %endif
+ %endmacro
 
-; trashes, rax, rdx & rcx
-%macro MYPOPSEGS64 2
+ ; trashes, rax, rdx & rcx
+ %macro MYPOPSEGS64 2
    ; Note: do not step through this code with a debugger!
- %ifndef HM_64_BIT_USE_NULL_SEL
+  %ifndef HM_64_BIT_USE_NULL_SEL
    xor     eax, eax
    mov     ds, ax
    mov     es, ax
    mov     fs, ax
    mov     gs, ax
- %endif
+  %endif
 
- %ifndef HM_64_BIT_USE_NULL_SEL
+  %ifndef HM_64_BIT_USE_NULL_SEL
    pop     gs
- %endif
+  %endif
    pop     rax
    pop     rdx
    mov     ecx, MSR_K8_GS_BASE
    wrmsr
 
- %ifndef HM_64_BIT_USE_NULL_SEL
+  %ifndef HM_64_BIT_USE_NULL_SEL
    pop     fs
- %endif
+  %endif
    pop     rax
    pop     rdx
    mov     ecx, MSR_K8_FS_BASE
    wrmsr
    ; Now it's safe to step again
 
- %ifndef HM_64_BIT_USE_NULL_SEL
+  %ifndef HM_64_BIT_USE_NULL_SEL
    pop     %1
    mov     ds, %2
    pop     %1
    mov     es, %2
- %endif
-%endmacro
+  %endif
+ %endmacro
 %endif ; VBOX_SKIP_RESTORE_SEG
 
 %macro MYPUSHAD32 0
@@ -1204,7 +1173,7 @@ BEGINPROC HMR0VMXStartVMWrapXMM
 
 ALIGNCODE(8)
 .guest_fpu_state_active:
-        ; Save the host XMM registers.
+        ; Save the non-volatile host XMM registers.
         movdqa  [rsp + 040h + 000h], xmm6
         movdqa  [rsp + 040h + 010h], xmm7
         movdqa  [rsp + 040h + 020h], xmm8
@@ -1216,25 +1185,18 @@ ALIGNCODE(8)
         movdqa  [rsp + 040h + 080h], xmm14
         movdqa  [rsp + 040h + 090h], xmm15
 
-        ; Load the full guest XMM register state.
         mov     r10, [xBP + 018h]       ; pCtx
-        lea     r10, [r10 + XMM_OFF_IN_X86FXSTATE]
-        movdqa  xmm0,  [r10 + 000h]
-        movdqa  xmm1,  [r10 + 010h]
-        movdqa  xmm2,  [r10 + 020h]
-        movdqa  xmm3,  [r10 + 030h]
-        movdqa  xmm4,  [r10 + 040h]
-        movdqa  xmm5,  [r10 + 050h]
-        movdqa  xmm6,  [r10 + 060h]
-        movdqa  xmm7,  [r10 + 070h]
-        movdqa  xmm8,  [r10 + 080h]
-        movdqa  xmm9,  [r10 + 090h]
-        movdqa  xmm10, [r10 + 0a0h]
-        movdqa  xmm11, [r10 + 0b0h]
-        movdqa  xmm12, [r10 + 0c0h]
-        movdqa  xmm13, [r10 + 0d0h]
-        movdqa  xmm14, [r10 + 0e0h]
-        movdqa  xmm15, [r10 + 0f0h]
+        mov     eax, [r10 + CPUMCTX.fXStateMask]
+        test    eax, eax
+        jz      .guest_fpu_state_manually
+
+        ;
+        ; Using XSAVE to load the guest XMM, YMM and ZMM registers.
+        ;
+        and     eax, CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS
+        xor     edx, edx
+        mov     r10, [r10 + CPUMCTX.pXStateR0]
+        xrstor  [r10]
 
         ; Make the call (same as in the other case ).
         mov     r11, [xBP + 38h]        ; pfnStartVM
@@ -1246,27 +1208,20 @@ ALIGNCODE(8)
         mov     r9,  [xBP + 028h]       ; pVM
         call    r11
 
+        mov     r11d, eax               ; save return value (xsave below uses eax)
+
         ; Save the guest XMM registers.
         mov     r10, [xBP + 018h]       ; pCtx
-        lea     r10, [r10 + XMM_OFF_IN_X86FXSTATE]
-        movdqa  [r10 + 000h], xmm0
-        movdqa  [r10 + 010h], xmm1
-        movdqa  [r10 + 020h], xmm2
-        movdqa  [r10 + 030h], xmm3
-        movdqa  [r10 + 040h], xmm4
-        movdqa  [r10 + 050h], xmm5
-        movdqa  [r10 + 060h], xmm6
-        movdqa  [r10 + 070h], xmm7
-        movdqa  [r10 + 080h], xmm8
-        movdqa  [r10 + 090h], xmm9
-        movdqa  [r10 + 0a0h], xmm10
-        movdqa  [r10 + 0b0h], xmm11
-        movdqa  [r10 + 0c0h], xmm12
-        movdqa  [r10 + 0d0h], xmm13
-        movdqa  [r10 + 0e0h], xmm14
-        movdqa  [r10 + 0f0h], xmm15
-
-        ; Load the host XMM registers.
+        mov     eax, [r10 + CPUMCTX.fXStateMask]
+        and     eax, CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS
+        xor     edx, edx
+        mov     r10, [r10 + CPUMCTX.pXStateR0]
+        xsave  [r10]
+
+        mov     eax, r11d               ; restore return value.
+
+.restore_non_volatile_host_xmm_regs:
+        ; Load the non-volatile host XMM registers.
         movdqa  xmm6,  [rsp + 040h + 000h]
         movdqa  xmm7,  [rsp + 040h + 010h]
         movdqa  xmm8,  [rsp + 040h + 020h]
@@ -1279,6 +1234,60 @@ ALIGNCODE(8)
         movdqa  xmm15, [rsp + 040h + 090h]
         leave
         ret
+
+        ;
+        ; No XSAVE, load and save the guest XMM registers manually.
+        ;
+.guest_fpu_state_manually:
+        ; Load the full guest XMM register state.
+        mov     r10, [r10 + CPUMCTX.pXStateR0]
+        movdqa  xmm0,  [r10 + XMM_OFF_IN_X86FXSTATE + 000h]
+        movdqa  xmm1,  [r10 + XMM_OFF_IN_X86FXSTATE + 010h]
+        movdqa  xmm2,  [r10 + XMM_OFF_IN_X86FXSTATE + 020h]
+        movdqa  xmm3,  [r10 + XMM_OFF_IN_X86FXSTATE + 030h]
+        movdqa  xmm4,  [r10 + XMM_OFF_IN_X86FXSTATE + 040h]
+        movdqa  xmm5,  [r10 + XMM_OFF_IN_X86FXSTATE + 050h]
+        movdqa  xmm6,  [r10 + XMM_OFF_IN_X86FXSTATE + 060h]
+        movdqa  xmm7,  [r10 + XMM_OFF_IN_X86FXSTATE + 070h]
+        movdqa  xmm8,  [r10 + XMM_OFF_IN_X86FXSTATE + 080h]
+        movdqa  xmm9,  [r10 + XMM_OFF_IN_X86FXSTATE + 090h]
+        movdqa  xmm10, [r10 + XMM_OFF_IN_X86FXSTATE + 0a0h]
+        movdqa  xmm11, [r10 + XMM_OFF_IN_X86FXSTATE + 0b0h]
+        movdqa  xmm12, [r10 + XMM_OFF_IN_X86FXSTATE + 0c0h]
+        movdqa  xmm13, [r10 + XMM_OFF_IN_X86FXSTATE + 0d0h]
+        movdqa  xmm14, [r10 + XMM_OFF_IN_X86FXSTATE + 0e0h]
+        movdqa  xmm15, [r10 + XMM_OFF_IN_X86FXSTATE + 0f0h]
+
+        ; Make the call (same as in the other case ).
+        mov     r11, [xBP + 38h]        ; pfnStartVM
+        mov     r10, [xBP + 30h]        ; pVCpu
+        mov     [xSP + 020h], r10
+        mov     rcx, [xBP + 010h]       ; fResumeVM
+        mov     rdx, [xBP + 018h]       ; pCtx
+        mov     r8,  [xBP + 020h]       ; pVMCSCache
+        mov     r9,  [xBP + 028h]       ; pVM
+        call    r11
+
+        ; Save the guest XMM registers.
+        mov     r10, [xBP + 018h]       ; pCtx
+        mov     r10, [r10 + CPUMCTX.pXStateR0]
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 000h], xmm0
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 010h], xmm1
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 020h], xmm2
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 030h], xmm3
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 040h], xmm4
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 050h], xmm5
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 060h], xmm6
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 070h], xmm7
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 080h], xmm8
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 090h], xmm9
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0a0h], xmm10
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0b0h], xmm11
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0c0h], xmm12
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0d0h], xmm13
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0e0h], xmm14
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0f0h], xmm15
+        jmp     .restore_non_volatile_host_xmm_regs
 ENDPROC   HMR0VMXStartVMWrapXMM
 
 ;;
@@ -1332,7 +1341,7 @@ BEGINPROC HMR0SVMRunWrapXMM
 
 ALIGNCODE(8)
 .guest_fpu_state_active:
-        ; Save the host XMM registers.
+        ; Save the non-volatile host XMM registers.
         movdqa  [rsp + 040h + 000h], xmm6
         movdqa  [rsp + 040h + 010h], xmm7
         movdqa  [rsp + 040h + 020h], xmm8
@@ -1344,25 +1353,18 @@ ALIGNCODE(8)
         movdqa  [rsp + 040h + 080h], xmm14
         movdqa  [rsp + 040h + 090h], xmm15
 
-        ; Load the full guest XMM register state.
         mov     r10, [xBP + 020h]       ; pCtx
-        lea     r10, [r10 + XMM_OFF_IN_X86FXSTATE]
-        movdqa  xmm0,  [r10 + 000h]
-        movdqa  xmm1,  [r10 + 010h]
-        movdqa  xmm2,  [r10 + 020h]
-        movdqa  xmm3,  [r10 + 030h]
-        movdqa  xmm4,  [r10 + 040h]
-        movdqa  xmm5,  [r10 + 050h]
-        movdqa  xmm6,  [r10 + 060h]
-        movdqa  xmm7,  [r10 + 070h]
-        movdqa  xmm8,  [r10 + 080h]
-        movdqa  xmm9,  [r10 + 090h]
-        movdqa  xmm10, [r10 + 0a0h]
-        movdqa  xmm11, [r10 + 0b0h]
-        movdqa  xmm12, [r10 + 0c0h]
-        movdqa  xmm13, [r10 + 0d0h]
-        movdqa  xmm14, [r10 + 0e0h]
-        movdqa  xmm15, [r10 + 0f0h]
+        mov     eax, [r10 + CPUMCTX.fXStateMask]
+        test    eax, eax
+        jz      .guest_fpu_state_manually
+
+        ;
+        ; Using XSAVE.
+        ;
+        and     eax, CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS
+        xor     edx, edx
+        mov     r10, [r10 + CPUMCTX.pXStateR0]
+        xrstor  [r10]
 
         ; Make the call (same as in the other case ).
         mov     r11, [xBP + 38h]        ; pfnVMRun
@@ -1374,27 +1376,20 @@ ALIGNCODE(8)
         mov     r9,  [xBP + 028h]       ; pVM
         call    r11
 
+        mov     r11d, eax               ; save return value (xsave below uses eax)
+
         ; Save the guest XMM registers.
         mov     r10, [xBP + 020h]       ; pCtx
-        lea     r10, [r10 + XMM_OFF_IN_X86FXSTATE]
-        movdqa  [r10 + 000h], xmm0
-        movdqa  [r10 + 010h], xmm1
-        movdqa  [r10 + 020h], xmm2
-        movdqa  [r10 + 030h], xmm3
-        movdqa  [r10 + 040h], xmm4
-        movdqa  [r10 + 050h], xmm5
-        movdqa  [r10 + 060h], xmm6
-        movdqa  [r10 + 070h], xmm7
-        movdqa  [r10 + 080h], xmm8
-        movdqa  [r10 + 090h], xmm9
-        movdqa  [r10 + 0a0h], xmm10
-        movdqa  [r10 + 0b0h], xmm11
-        movdqa  [r10 + 0c0h], xmm12
-        movdqa  [r10 + 0d0h], xmm13
-        movdqa  [r10 + 0e0h], xmm14
-        movdqa  [r10 + 0f0h], xmm15
-
-        ; Load the host XMM registers.
+        mov     eax, [r10 + CPUMCTX.fXStateMask]
+        and     eax, CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS
+        xor     edx, edx
+        mov     r10, [r10 + CPUMCTX.pXStateR0]
+        xsave  [r10]
+
+        mov     eax, r11d               ; restore return value.
+
+.restore_non_volatile_host_xmm_regs:
+        ; Load the non-volatile host XMM registers.
         movdqa  xmm6,  [rsp + 040h + 000h]
         movdqa  xmm7,  [rsp + 040h + 010h]
         movdqa  xmm8,  [rsp + 040h + 020h]
@@ -1407,6 +1402,60 @@ ALIGNCODE(8)
         movdqa  xmm15, [rsp + 040h + 090h]
         leave
         ret
+
+        ;
+        ; No XSAVE, load and save the guest XMM registers manually.
+        ;
+.guest_fpu_state_manually:
+        ; Load the full guest XMM register state.
+        mov     r10, [r10 + CPUMCTX.pXStateR0]
+        movdqa  xmm0,  [r10 + XMM_OFF_IN_X86FXSTATE + 000h]
+        movdqa  xmm1,  [r10 + XMM_OFF_IN_X86FXSTATE + 010h]
+        movdqa  xmm2,  [r10 + XMM_OFF_IN_X86FXSTATE + 020h]
+        movdqa  xmm3,  [r10 + XMM_OFF_IN_X86FXSTATE + 030h]
+        movdqa  xmm4,  [r10 + XMM_OFF_IN_X86FXSTATE + 040h]
+        movdqa  xmm5,  [r10 + XMM_OFF_IN_X86FXSTATE + 050h]
+        movdqa  xmm6,  [r10 + XMM_OFF_IN_X86FXSTATE + 060h]
+        movdqa  xmm7,  [r10 + XMM_OFF_IN_X86FXSTATE + 070h]
+        movdqa  xmm8,  [r10 + XMM_OFF_IN_X86FXSTATE + 080h]
+        movdqa  xmm9,  [r10 + XMM_OFF_IN_X86FXSTATE + 090h]
+        movdqa  xmm10, [r10 + XMM_OFF_IN_X86FXSTATE + 0a0h]
+        movdqa  xmm11, [r10 + XMM_OFF_IN_X86FXSTATE + 0b0h]
+        movdqa  xmm12, [r10 + XMM_OFF_IN_X86FXSTATE + 0c0h]
+        movdqa  xmm13, [r10 + XMM_OFF_IN_X86FXSTATE + 0d0h]
+        movdqa  xmm14, [r10 + XMM_OFF_IN_X86FXSTATE + 0e0h]
+        movdqa  xmm15, [r10 + XMM_OFF_IN_X86FXSTATE + 0f0h]
+
+        ; Make the call (same as in the other case ).
+        mov     r11, [xBP + 38h]        ; pfnVMRun
+        mov     r10, [xBP + 30h]        ; pVCpu
+        mov     [xSP + 020h], r10
+        mov     rcx, [xBP + 010h]       ; pVMCBHostPhys
+        mov     rdx, [xBP + 018h]       ; pVMCBPhys
+        mov     r8,  [xBP + 020h]       ; pCtx
+        mov     r9,  [xBP + 028h]       ; pVM
+        call    r11
+
+        ; Save the guest XMM registers.
+        mov     r10, [xBP + 020h]       ; pCtx
+        mov     r10, [r10 + CPUMCTX.pXStateR0]
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 000h], xmm0
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 010h], xmm1
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 020h], xmm2
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 030h], xmm3
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 040h], xmm4
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 050h], xmm5
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 060h], xmm6
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 070h], xmm7
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 080h], xmm8
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 090h], xmm9
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0a0h], xmm10
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0b0h], xmm11
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0c0h], xmm12
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0d0h], xmm13
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0e0h], xmm14
+        movdqa  [r10 + XMM_OFF_IN_X86FXSTATE + 0f0h], xmm15
+        jmp     .restore_non_volatile_host_xmm_regs
 ENDPROC   HMR0SVMRunWrapXMM
 
 %endif ; VBOX_WITH_KERNEL_USING_XMM
@@ -1442,7 +1491,7 @@ ENDPROC   HMR0SVMRunWrapXMM
  ; restoring, but better safe than sorry...
  ;
 
-; DECLASM(int) VMXR0StartVM32(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache /*, PVM pVM, PVMCPU pVCpu*/);
+; DECLASM(int) VMXR0StartVM32(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
 ALIGNCODE(16)
 BEGINPROC VMXR0StartVM32
     cmp     byte [NAME(g_fVMXIs64bitHost)], 0
@@ -1465,6 +1514,8 @@ BITS 64
     mov     edi, [rsp + 20h + 14h]      ; fResume
     mov     esi, [rsp + 20h + 18h]      ; pCtx
     mov     edx, [rsp + 20h + 1Ch]      ; pCache
+    mov     ecx, [rsp + 20h + 20h]      ; pVM
+    mov     r8,  [rsp + 20h + 24h]      ; pVCpu
     call    NAME(VMXR0StartVM32_64)
     add     esp, 20h
     jmp far [.fpthunk32 wrt rip]
@@ -1482,7 +1533,7 @@ ALIGNCODE(16)
 ENDPROC   VMXR0StartVM32
 
 
-; DECLASM(int) VMXR0StartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache /*, PVM pVM, PVMCPU pVCpu*/);
+; DECLASM(int) VMXR0StartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
 ALIGNCODE(16)
 BEGINPROC VMXR0StartVM64
     cmp     byte [NAME(g_fVMXIs64bitHost)], 0
@@ -1505,6 +1556,8 @@ BITS 64
     mov     edi, [rsp + 20h + 14h]      ; fResume
     mov     esi, [rsp + 20h + 18h]      ; pCtx
     mov     edx, [rsp + 20h + 1Ch]      ; pCache
+    mov     ecx, [rsp + 20h + 20h]      ; pVM
+    mov     r8,  [rsp + 20h + 24h]      ; pVCpu
     call    NAME(VMXR0StartVM64_64)
     add     esp, 20h
     jmp far [.fpthunk32 wrt rip]
@@ -1521,11 +1574,11 @@ ALIGNCODE(16)
     ret
 
 .not_in_long_mode:
-    mov     eax, VERR_PGM_UNSUPPORTED_SHADOW_PAGING_MODE
+    mov     eax, VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE
     ret
 ENDPROC   VMXR0StartVM64
 
-;DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx /*, PVM pVM, PVMCPU pVCpu*/);
+;DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
 ALIGNCODE(16)
 BEGINPROC SVMR0VMRun
     cmp     byte [NAME(g_fVMXIs64bitHost)], 0
@@ -1548,6 +1601,8 @@ BITS 64
     mov     rdi, [rsp + 20h + 14h]      ; pVMCBHostPhys
     mov     rsi, [rsp + 20h + 1Ch]      ; pVMCBPhys
     mov     edx, [rsp + 20h + 24h]      ; pCtx
+    mov     ecx, [rsp + 20h + 28h]      ; pVM
+    mov     r8d, [rsp + 20h + 2Ch]      ; pVCpu
     call    NAME(SVMR0VMRun_64)
     add     esp, 20h
     jmp far [.fpthunk32 wrt rip]
@@ -1565,7 +1620,7 @@ ALIGNCODE(16)
 ENDPROC   SVMR0VMRun
 
 
-; DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx /*, PVM pVM, PVMCPU pVCpu*/);
+; DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
 ALIGNCODE(16)
 BEGINPROC SVMR0VMRun64
     cmp     byte [NAME(g_fVMXIs64bitHost)], 0
@@ -1585,9 +1640,11 @@ ALIGNCODE(16)
 BITS 64
 .thunk64:
     sub     esp, 20h
-    mov     rdi, [rbp + 20h + 14h]      ; pVMCBHostPhys
-    mov     rsi, [rbp + 20h + 1Ch]      ; pVMCBPhys
-    mov     edx, [rbp + 20h + 24h]      ; pCtx
+    mov     rdi, [rsp + 20h + 14h]      ; pVMCBHostPhys
+    mov     rsi, [rsp + 20h + 1Ch]      ; pVMCBPhys
+    mov     edx, [rsp + 20h + 24h]      ; pCtx
+    mov     ecx, [rsp + 20h + 28h]      ; pVM
+    mov     r8d, [rsp + 20h + 2Ch]      ; pVCpu
     call    NAME(SVMR0VMRun64_64)
     add     esp, 20h
     jmp far [.fpthunk32 wrt rip]
diff --git a/src/VBox/VMM/VMMR0/HMR0Mixed.mac b/src/VBox/VMM/VMMR0/HMR0Mixed.mac
index c46e7b5..fe79bb8 100644
--- a/src/VBox/VMM/VMMR0/HMR0Mixed.mac
+++ b/src/VBox/VMM/VMMR0/HMR0Mixed.mac
@@ -18,17 +18,19 @@
 ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 ;
 
+
+;;
+; Keep these macro definitions in this file as it gets included and compiled
+; with RT_ARCH_AMD64 once and RT_ARCH_X86 once.
+%undef VMX_SKIP_GDTR
+%undef VMX_SKIP_IDTR
+%undef VMX_SKIP_TR
+
 %ifdef RT_ARCH_AMD64
- ;;
- ; Keep these macro definitions in this file as it gets included and compiled
- ; with RT_ARCH_AMD64 once and RT_ARCH_X86 once.
  %define VMX_SKIP_GDTR
  %ifdef RT_OS_DARWIN
- ; Darwin (Mavericks) uses IDTR limit to store the CPUID so we need to restore it always.
+ ; Darwin (Mavericks) uses IDTR limit to store the CPU Id so we need to restore it always.
  ; See @bugref{6875}.
- %elifdef RT_OS_WINDOWS
- ; Windows 8.1 RTM also seems to be using the IDTR limit for something. See @bugref{6956}.
- ;; @todo figure out what exactly it does and try and restrict it more.
  %else
   %define VMX_SKIP_IDTR
  %endif
@@ -121,19 +123,30 @@ ALIGN(16)
     ; Restore segment registers.
     MYPOPSEGS xAX, ax
 
+    ; Restore the host XCR0 if necessary.
+    pop     xCX
+    test    ecx, ecx
+    jnz     %%xcr0_after_skip
+    pop     xAX
+    pop     xDX
+    xsetbv                              ; ecx is already zero.
+%%xcr0_after_skip:
+
     ; Restore general purpose registers.
     MYPOPAD
 %endmacro
 
 
-;/**
-; * Prepares for and executes VMLAUNCH/VMRESUME (32 bits guest mode)
-; *
-; * @returns VBox status code
-; * @param   fResume    x86:[ebp+8], msc:rcx,gcc:rdi     Whether to use vmlauch/vmresume.
-; * @param   pCtx       x86:[ebp+c], msc:rdx,gcc:rsi     Pointer to the guest-CPU context.
-; * @param   pCache     x86:[esp+10],msc:r8, gcc:rdx     Pointer to the VMCS cache.
-; */
+;;
+; Prepares for and executes VMLAUNCH/VMRESUME (32 bits guest mode)
+;
+; @returns VBox status code
+; @param    fResume    x86:[ebp+8], msc:rcx,gcc:rdi     Whether to use vmlauch/vmresume.
+; @param    pCtx       x86:[ebp+c], msc:rdx,gcc:rsi     Pointer to the guest-CPU context.
+; @param    pCache     x86:[ebp+10],msc:r8, gcc:rdx     Pointer to the VMCS cache.
+; @param    pVM        x86:[ebp+14],msc:r9, gcc:rcx     Pointer to the cross context VM structure.
+; @param    pVCpu      x86:[ebp+18],msc:[ebp+30],gcc:r8 Pointer to the cross context VMCPU structure.
+;
 ALIGNCODE(16)
 BEGINPROC MY_NAME(VMXR0StartVM32)
     push    xBP
@@ -142,10 +155,14 @@ BEGINPROC MY_NAME(VMXR0StartVM32)
     pushf
     cli
 
+    ;
     ; Save all general purpose host registers.
+    ;
     MYPUSHAD
 
-    ; First we have to save some final CPU context registers.
+    ;
+    ; First we have to write some final guest CPU context registers.
+    ;
     mov     eax, VMX_VMCS_HOST_RIP
 %ifdef RT_ARCH_AMD64
     lea     r10, [.vmlaunch_done wrt rip]
@@ -156,7 +173,9 @@ BEGINPROC MY_NAME(VMXR0StartVM32)
 %endif
     ; Note: assumes success!
 
-    ; Save guest-CPU context pointer.
+    ;
+    ; Unify input parameter registers.
+    ;
 %ifdef RT_ARCH_AMD64
  %ifdef ASM_CALL64_GCC
     ; fResume already in rdi
@@ -173,8 +192,41 @@ BEGINPROC MY_NAME(VMXR0StartVM32)
     mov     ebx, [ebp + 16] ; pCache
 %endif
 
+    ;
+    ; Save the host XCR0 and load the guest one if necessary.
+    ; Note! Trashes rdx and rcx.
+    ;
+%ifdef ASM_CALL64_MSC
+    mov     rax, [xBP + 30h]            ; pVCpu
+%elifdef ASM_CALL64_GCC
+    mov     rax, r8                     ; pVCpu
+%else
+    mov     eax, [xBP + 18h]            ; pVCpu
+%endif
+    test    byte [xAX + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
+    jz      .xcr0_before_skip
+
+    xor     ecx, ecx
+    xgetbv                              ; Save the host one on the stack.
+    push    xDX
+    push    xAX
+
+    mov     eax, [xSI + CPUMCTX.aXcr]   ; Load the guest one.
+    mov     edx, [xSI + CPUMCTX.aXcr + 4]
+    xor     ecx, ecx                    ; paranoia
+    xsetbv
+
+    push    0                           ; Indicate that we must restore XCR0 (popped into ecx, thus 0).
+    jmp     .xcr0_before_done
+
+.xcr0_before_skip:
+    push    3fh                         ; indicate that we need not.
+.xcr0_before_done:
+
+    ;
     ; Save segment registers.
-    ; Note: MYPUSHSEGS trashes rdx & rcx, so we moved it here (msvc amd64 case).
+    ; Note! Trashes rdx & rcx, so we moved it here (amd64 case).
+    ;
     MYPUSHSEGS xAX, ax
 
 %ifdef VMX_USE_CACHED_VMCS_ACCESSES
@@ -355,14 +407,6 @@ ENDPROC MY_NAME(VMXR0StartVM32)
 %%skip_ldt_write64:
     pop     xSI         ; pCtx (needed in rsi by the macros below)
 
- %ifndef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-    ; Save the guest MSRs and load the host MSRs.
-    LOADHOSTMSREX MSR_K8_KERNEL_GS_BASE, CPUMCTX.msrKERNELGSBASE
-    LOADHOSTMSREX MSR_K8_SF_MASK,        CPUMCTX.msrSFMASK
-    LOADHOSTMSREX MSR_K6_STAR,           CPUMCTX.msrSTAR
-    LOADHOSTMSREX MSR_K8_LSTAR,          CPUMCTX.msrLSTAR
- %endif
-
  %ifdef VMX_USE_CACHED_VMCS_ACCESSES
     pop     xDX         ; Saved pCache
 
@@ -387,19 +431,30 @@ ALIGN(16)
     ; Restore segment registers.
     MYPOPSEGS xAX, ax
 
+    ; Restore the host XCR0 if necessary.
+    pop     xCX
+    test    ecx, ecx
+    jnz     %%xcr0_after_skip
+    pop     xAX
+    pop     xDX
+    xsetbv                              ; ecx is already zero.
+%%xcr0_after_skip:
+
     ; Restore general purpose registers.
     MYPOPAD
 %endmacro
 
 
-;/**
-; * Prepares for and executes VMLAUNCH/VMRESUME (64 bits guest mode)
-; *
-; * @returns VBox status code
-; * @param   fResume    msc:rcx, gcc:rdi     Whether to use vmlauch/vmresume.
-; * @param   pCtx       msc:rdx, gcc:rsi     Pointer to the guest-CPU context.
-; * @param   pCache     msc:r8,  gcc:rdx     Pointer to the VMCS cache.
-; */
+;;
+; Prepares for and executes VMLAUNCH/VMRESUME (64 bits guest mode)
+;
+; @returns VBox status code
+; @param    fResume    msc:rcx, gcc:rdi     Whether to use vmlauch/vmresume.
+; @param    pCtx       msc:rdx, gcc:rsi     Pointer to the guest-CPU context.
+; @param    pCache     msc:r8,  gcc:rdx     Pointer to the VMCS cache.
+; @param    pVM        msc:r9,  gcc:rcx     Pointer to the cross context VM structure.
+; @param    pVCpu      msc:[ebp+30], gcc:r8 Pointer to the cross context VMCPU structure.
+;
 ALIGNCODE(16)
 BEGINPROC MY_NAME(VMXR0StartVM64)
     push    xBP
@@ -417,7 +472,9 @@ BEGINPROC MY_NAME(VMXR0StartVM64)
     vmwrite rax, r10
     ; Note: assumes success!
 
-    ; Save guest-CPU context pointer.
+    ;
+    ; Unify the input parameter registers.
+    ;
 %ifdef ASM_CALL64_GCC
     ; fResume already in rdi
     ; pCtx    already in rsi
@@ -428,8 +485,39 @@ BEGINPROC MY_NAME(VMXR0StartVM64)
     mov     rbx, r8         ; pCache
 %endif
 
+    ;
+    ; Save the host XCR0 and load the guest one if necessary.
+    ; Note! Trashes rdx and rcx.
+    ;
+%ifdef ASM_CALL64_MSC
+    mov     rax, [xBP + 30h]            ; pVCpu
+%else
+    mov     rax, r8                     ; pVCpu
+%endif
+    test    byte [xAX + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
+    jz      .xcr0_before_skip
+
+    xor     ecx, ecx
+    xgetbv                              ; Save the host one on the stack.
+    push    xDX
+    push    xAX
+
+    mov     eax, [xSI + CPUMCTX.aXcr]   ; Load the guest one.
+    mov     edx, [xSI + CPUMCTX.aXcr + 4]
+    xor     ecx, ecx                    ; paranoia
+    xsetbv
+
+    push    0                           ; Indicate that we must restore XCR0 (popped into ecx, thus 0).
+    jmp     .xcr0_before_done
+
+.xcr0_before_skip:
+    push    3fh                         ; indicate that we need not.
+.xcr0_before_done:
+
+    ;
     ; Save segment registers.
-    ; Note: MYPUSHSEGS trashes rdx & rcx, so we moved it here (msvc amd64 case).
+    ; Note! Trashes rdx & rcx, so we moved it here (amd64 case).
+    ;
     MYPUSHSEGS xAX, ax
 
 %ifdef VMX_USE_CACHED_VMCS_ACCESSES
@@ -455,14 +543,6 @@ ALIGN(16)
     push    xBX
 %endif
 
-%ifndef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-    ; Save the host MSRs and load the guest MSRs.
-    LOADGUESTMSR MSR_K8_LSTAR,          CPUMCTX.msrLSTAR
-    LOADGUESTMSR MSR_K6_STAR,           CPUMCTX.msrSTAR
-    LOADGUESTMSR MSR_K8_SF_MASK,        CPUMCTX.msrSFMASK
-    LOADGUESTMSR MSR_K8_KERNEL_GS_BASE, CPUMCTX.msrKERNELGSBASE
-%endif
-
     ; Save the pCtx pointer.
     push    xSI
 
@@ -560,25 +640,32 @@ ENDPROC MY_NAME(VMXR0StartVM64)
 %endif ; RT_ARCH_AMD64
 
 
-;/**
-; * Prepares for and executes VMRUN (32 bits guests)
-; *
-; * @returns VBox status code
-; * @param   HCPhysVMCB     Physical address of host VMCB.
-; * @param   HCPhysVMCB     Physical address of guest VMCB.
-; * @param   pCtx           Pointer to the guest CPU-context.
-; */
+;;
+; Prepares for and executes VMRUN (32 bits guests)
+;
+; @returns  VBox status code
+; @param    HCPhysVMCB      Physical address of host VMCB.
+; @param    HCPhysVMCB      Physical address of guest VMCB.
+; @param    pCtx            Pointer to the guest CPU-context.
+; @param    pVM             msc:r9, gcc:rcx     Pointer to the cross context VM structure.
+; @param    pVCpu           msc:[rsp+28],gcc:r8 Pointer to the cross context VMCPU structure.
+;
 ALIGNCODE(16)
 BEGINPROC MY_NAME(SVMR0VMRun)
 %ifdef RT_ARCH_AMD64 ; fake a cdecl stack frame
  %ifdef ASM_CALL64_GCC
+    push    r8
+    push    rcx
     push    rdx
     push    rsi
     push    rdi
  %else
-    push    r8
-    push    rdx
-    push    rcx
+    mov     rax, [rsp + 28h]
+    push    rax                         ; pVCpu
+    push    r9                          ; pVM
+    push    r8                          ; pCtx
+    push    rdx                         ; HCPHYSGuestVMCB
+    push    rcx                         ; HCPhysHostVMCB
  %endif
     push    0
 %endif
@@ -586,12 +673,45 @@ BEGINPROC MY_NAME(SVMR0VMRun)
     mov     xBP, xSP
     pushf
 
+    ;
     ; Save all general purpose host registers.
+    ;
     MYPUSHAD
 
-    ; Save guest CPU-context pointer.
+    ;
+    ; Load pCtx into xSI.
+    ;
+    mov     xSI, [xBP + xCB * 2 + RTHCPHYS_CB * 2]  ; pCtx
+
+    ;
+    ; Save the host XCR0 and load the guest one if necessary.
+    ;
+    mov     xAX, [xBP + xCB * 2 + RTHCPHYS_CB * 2 + xCB * 2] ; pVCpu
+    test    byte [xAX + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
+    jz      .xcr0_before_skip
+
+    xor     ecx, ecx
+    xgetbv                              ; Save the host one on the stack.
+    push    xDX
+    push    xAX
+
     mov     xSI, [xBP + xCB * 2 + RTHCPHYS_CB * 2]  ; pCtx
-    push    xSI                                     ; push for saving the state at the end
+    mov     eax, [xSI + CPUMCTX.aXcr]   ; Load the guest one.
+    mov     edx, [xSI + CPUMCTX.aXcr + 4]
+    xor     ecx, ecx                    ; paranoia
+    xsetbv
+
+    push    0                           ; Indicate that we must restore XCR0 (popped into ecx, thus 0).
+    jmp     .xcr0_before_done
+
+.xcr0_before_skip:
+    push    3fh                         ; indicate that we need not.
+.xcr0_before_done:
+
+    ;
+    ; Save guest CPU-context pointer for simplifying saving of the GPRs afterwards.
+    ;
+    push    xSI
 
     ; Save host fs, gs, sysenter msr etc.
     mov     xAX, [xBP + xCB * 2]                    ; pVMCBHostPhys (64 bits physical address; x86: take low dword only)
@@ -632,7 +752,10 @@ BEGINPROC MY_NAME(SVMR0VMRun)
     cli
     stgi
 
-    pop     xAX                     ; pCtx
+    ;
+    ; Pop the context pointer (pushed above) and save the guest GPRs (sans RSP and RAX).
+    ;
+    pop     xAX
 
     mov     [ss:xAX + CPUMCTX.ebx], ebx
     mov     [ss:xAX + CPUMCTX.ecx], ecx
@@ -641,7 +764,20 @@ BEGINPROC MY_NAME(SVMR0VMRun)
     mov     [ss:xAX + CPUMCTX.edi], edi
     mov     [ss:xAX + CPUMCTX.ebp], ebp
 
+    ;
+    ; Restore the host xcr0 if necessary.
+    ;
+    pop     xCX
+    test    ecx, ecx
+    jnz     .xcr0_after_skip
+    pop     xAX
+    pop     xDX
+    xsetbv                              ; ecx is already zero.
+.xcr0_after_skip:
+
+    ;
     ; Restore host general purpose registers.
+    ;
     MYPOPAD
 
     mov     eax, VINF_SUCCESS
@@ -649,34 +785,41 @@ BEGINPROC MY_NAME(SVMR0VMRun)
     popf
     pop     xBP
 %ifdef RT_ARCH_AMD64
-    add     xSP, 4*xCB
+    add     xSP, 6*xCB
 %endif
     ret
 ENDPROC MY_NAME(SVMR0VMRun)
 
 %ifdef RT_ARCH_AMD64
-;/**
-; * Prepares for and executes VMRUN (64 bits guests)
-; *
-; * @returns VBox status code
-; * @param   HCPhysVMCB     Physical address of host VMCB.
-; * @param   HCPhysVMCB     Physical address of guest VMCB.
-; * @param   pCtx           Pointer to the guest-CPU context.
-; */
+;;
+; Prepares for and executes VMRUN (64 bits guests)
+;
+; @returns  VBox status code
+; @param    HCPhysVMCB      Physical address of host VMCB.
+; @param    HCPhysVMCB      Physical address of guest VMCB.
+; @param    pCtx            Pointer to the guest-CPU context.
+; @param    pVM             msc:r9, gcc:rcx     Pointer to the cross context VM structure.
+; @param    pVCpu           msc:[rsp+28],gcc:r8 Pointer to the cross context VMCPU structure.
+;
 ALIGNCODE(16)
 BEGINPROC MY_NAME(SVMR0VMRun64)
     ; Fake a cdecl stack frame
  %ifdef ASM_CALL64_GCC
+    push    r8
+    push    rcx
     push    rdx
     push    rsi
     push    rdi
  %else
-    push    r8
-    push    rdx
-    push    rcx
+    mov     rax, [rsp + 28h]
+    push    rax                         ; rbp + 30h pVCpu
+    push    r9                          ; rbp + 28h pVM
+    push    r8                          ; rbp + 20h pCtx
+    push    rdx                         ; rbp + 18h HCPHYSGuestVMCB
+    push    rcx                         ; rbp + 10h HCPhysHostVMCB
  %endif
-    push    0
-    push    rbp
+    push    0                           ; rbp + 08h "fake ret addr"
+    push    rbp                         ; rbp + 00h
     mov     rbp, rsp
     pushf
 
@@ -690,14 +833,49 @@ BEGINPROC MY_NAME(SVMR0VMRun64)
     ;  - DR7 (reset to 0x400)
     ;
 
+    ;
     ; Save all general purpose host registers.
+    ;
     MYPUSHAD
 
-    ; Save guest CPU-context pointer.
-    mov     rsi, [rbp + xCB * 2 + RTHCPHYS_CB * 2]  ; pCtx
-    push    rsi                                     ; push for saving the state at the end
+    ;
+    ; Load pCtx into xSI.
+    ;
+    mov     xSI, [rbp + xCB * 2 + RTHCPHYS_CB * 2]
+
+    ;
+    ; Save the host XCR0 and load the guest one if necessary.
+    ;
+    mov     rax, [xBP + 30h]            ; pVCpu
+    test    byte [xAX + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
+    jz      .xcr0_before_skip
+
+    xor     ecx, ecx
+    xgetbv                              ; Save the host one on the stack.
+    push    xDX
+    push    xAX
+
+    mov     xSI, [xBP + xCB * 2 + RTHCPHYS_CB * 2]  ; pCtx
+    mov     eax, [xSI + CPUMCTX.aXcr]   ; Load the guest one.
+    mov     edx, [xSI + CPUMCTX.aXcr + 4]
+    xor     ecx, ecx                    ; paranoia
+    xsetbv
+
+    push    0                           ; Indicate that we must restore XCR0 (popped into ecx, thus 0).
+    jmp     .xcr0_before_done
+
+.xcr0_before_skip:
+    push    3fh                         ; indicate that we need not.
+.xcr0_before_done:
+
+    ;
+    ; Save guest CPU-context pointer for simplifying saving of the GPRs afterwards.
+    ;
+    push    rsi
 
+    ;
     ; Save host fs, gs, sysenter msr etc.
+    ;
     mov     rax, [rbp + xCB * 2]                    ; pVMCBHostPhys (64 bits physical address; x86: take low dword only)
     push    rax                                     ; Save for the vmload after vmrun
     vmsave
@@ -736,15 +914,22 @@ BEGINPROC MY_NAME(SVMR0VMRun64)
     ; Save guest fs, gs, sysenter msr etc.
     vmsave
 
+    ;
     ; Load host fs, gs, sysenter msr etc.
+    ;
     pop     rax                     ; pushed above
     vmload
 
+    ;
     ; Set the global interrupt flag again, but execute cli to make sure IF=0.
+    ;
     cli
     stgi
 
-    pop     rax                     ; pCtx
+    ;
+    ; Pop the context pointer (pushed above) and save the guest GPRs (sans RSP and RAX).
+    ;
+    pop     rax
 
     mov     qword [rax + CPUMCTX.ebx], rbx
     mov     qword [rax + CPUMCTX.ecx], rcx
@@ -761,14 +946,27 @@ BEGINPROC MY_NAME(SVMR0VMRun64)
     mov     qword [rax + CPUMCTX.r14], r14
     mov     qword [rax + CPUMCTX.r15], r15
 
+    ;
+    ; Restore the host xcr0 if necessary.
+    ;
+    pop     xCX
+    test    ecx, ecx
+    jnz     .xcr0_after_skip
+    pop     xAX
+    pop     xDX
+    xsetbv                              ; ecx is already zero.
+.xcr0_after_skip:
+
+    ;
     ; Restore host general purpose registers.
+    ;
     MYPOPAD
 
     mov     eax, VINF_SUCCESS
 
     popf
     pop     rbp
-    add     rsp, 4 * xCB
+    add     rsp, 6 * xCB
     ret
 ENDPROC MY_NAME(SVMR0VMRun64)
 %endif ; RT_ARCH_AMD64
diff --git a/src/VBox/VMM/VMMR0/HMSVMR0.cpp b/src/VBox/VMM/VMMR0/HMSVMR0.cpp
index bde9f92..8b65f69 100644
--- a/src/VBox/VMM/VMMR0/HMSVMR0.cpp
+++ b/src/VBox/VMM/VMMR0/HMSVMR0.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -22,13 +22,16 @@
 #include <iprt/asm-amd64-x86.h>
 #include <iprt/thread.h>
 
-#include "HMInternal.h"
-#include <VBox/vmm/vm.h>
-#include "HMSVMR0.h"
 #include <VBox/vmm/pdmapi.h>
 #include <VBox/vmm/dbgf.h>
+#include <VBox/vmm/iem.h>
 #include <VBox/vmm/iom.h>
 #include <VBox/vmm/tm.h>
+#include <VBox/vmm/gim.h>
+#include "HMInternal.h"
+#include <VBox/vmm/vm.h>
+#include "HMSVMR0.h"
+#include "dtrace/VBoxVMM.h"
 
 #ifdef DEBUG_ramshankar
 # define HMSVM_SYNC_FULL_GUEST_STATE
@@ -117,12 +120,12 @@
     } while (0)
 
 /** Assert that preemption is disabled or covered by thread-context hooks. */
-#define HMSVM_ASSERT_PREEMPT_SAFE()           Assert(   VMMR0ThreadCtxHooksAreRegistered(pVCpu) \
+#define HMSVM_ASSERT_PREEMPT_SAFE()           Assert(   VMMR0ThreadCtxHookIsEnabled(pVCpu) \
                                                      || !RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
 /** Assert that we haven't migrated CPUs when thread-context hooks are not
  *  used. */
-#define HMSVM_ASSERT_CPU_SAFE()               AssertMsg(   VMMR0ThreadCtxHooksAreRegistered(pVCpu) \
+#define HMSVM_ASSERT_CPU_SAFE()               AssertMsg(   VMMR0ThreadCtxHookIsEnabled(pVCpu) \
                                                         || pVCpu->hm.s.idEnteredCpu == RTMpCpuId(), \
                                                         ("Illegal migration! Entered on CPU %u Current %u\n", \
                                                         pVCpu->hm.s.idEnteredCpu, RTMpCpuId()));
@@ -192,7 +195,7 @@ PHYSICAL_TABLE and AVIC LOGICAL_TABLE Pointers). */
 typedef struct SVMTRANSIENT
 {
     /** The host's rflags/eflags. */
-    RTCCUINTREG     uEflags;
+    RTCCUINTREG     fEFlags;
 #if HC_ARCH_BITS == 32
     uint32_t        u32Alignment0;
 #endif
@@ -216,6 +219,9 @@ typedef struct SVMTRANSIENT
     bool            fRestoreTscAuxMsr;
     /** Whether the #VMEXIT was caused by a page-fault during delivery of a
      *  contributary exception or a page-fault. */
+    bool            fVectoringDoublePF;
+    /** Whether the #VMEXIT was caused by a page-fault during delivery of an
+     *  external interrupt or NMI. */
     bool            fVectoringPF;
 } SVMTRANSIENT, *PSVMTRANSIENT;
 AssertCompileMemberAlignment(SVMTRANSIENT, u64ExitCode,             sizeof(uint64_t));
@@ -227,9 +233,9 @@ AssertCompileMemberAlignment(SVMTRANSIENT, fWasGuestFPUStateActive, sizeof(uint6
  */
 typedef enum SVMMSREXITREAD
 {
-    /** Reading this MSR causes a VM-exit. */
+    /** Reading this MSR causes a #VMEXIT. */
     SVMMSREXIT_INTERCEPT_READ = 0xb,
-    /** Reading this MSR does not cause a VM-exit. */
+    /** Reading this MSR does not cause a #VMEXIT. */
     SVMMSREXIT_PASSTHRU_READ
 } SVMMSREXITREAD;
 
@@ -238,14 +244,14 @@ typedef enum SVMMSREXITREAD
  */
 typedef enum SVMMSREXITWRITE
 {
-    /** Writing to this MSR causes a VM-exit. */
+    /** Writing to this MSR causes a #VMEXIT. */
     SVMMSREXIT_INTERCEPT_WRITE = 0xd,
-    /** Writing to this MSR does not cause a VM-exit. */
+    /** Writing to this MSR does not cause a #VMEXIT. */
     SVMMSREXIT_PASSTHRU_WRITE
 } SVMMSREXITWRITE;
 
 /**
- * SVM VM-exit handler.
+ * SVM #VMEXIT handler.
  *
  * @returns VBox status code.
  * @param   pVCpu           Pointer to the VMCPU.
@@ -261,7 +267,7 @@ static void hmR0SvmSetMsrPermission(PVMCPU pVCpu, unsigned uMsr, SVMMSREXITREAD
 static void hmR0SvmPendingEventToTrpmTrap(PVMCPU pVCpu);
 static void hmR0SvmLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
 
-/** @name VM-exit handlers.
+/** @name #VMEXIT handlers.
  * @{
  */
 static FNSVMEXITHANDLER hmR0SvmExitIntr;
@@ -282,13 +288,16 @@ static FNSVMEXITHANDLER hmR0SvmExitSetPendingXcptUD;
 static FNSVMEXITHANDLER hmR0SvmExitMsr;
 static FNSVMEXITHANDLER hmR0SvmExitReadDRx;
 static FNSVMEXITHANDLER hmR0SvmExitWriteDRx;
+static FNSVMEXITHANDLER hmR0SvmExitXsetbv;
 static FNSVMEXITHANDLER hmR0SvmExitIOInstr;
 static FNSVMEXITHANDLER hmR0SvmExitNestedPF;
 static FNSVMEXITHANDLER hmR0SvmExitVIntr;
 static FNSVMEXITHANDLER hmR0SvmExitTaskSwitch;
 static FNSVMEXITHANDLER hmR0SvmExitVmmCall;
+static FNSVMEXITHANDLER hmR0SvmExitIret;
 static FNSVMEXITHANDLER hmR0SvmExitXcptPF;
 static FNSVMEXITHANDLER hmR0SvmExitXcptNM;
+static FNSVMEXITHANDLER hmR0SvmExitXcptUD;
 static FNSVMEXITHANDLER hmR0SvmExitXcptMF;
 static FNSVMEXITHANDLER hmR0SvmExitXcptDB;
 /** @} */
@@ -320,16 +329,17 @@ R0PTRTYPE(void *)           g_pvIOBitmap      = NULL;
 VMMR0DECL(int) SVMR0EnableCpu(PHMGLOBALCPUINFO pCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage, bool fEnabledByHost,
                               void *pvArg)
 {
+    Assert(!fEnabledByHost);
+    Assert(HCPhysCpuPage && HCPhysCpuPage != NIL_RTHCPHYS);
+    Assert(RT_ALIGN_T(HCPhysCpuPage, _4K, RTHCPHYS) == HCPhysCpuPage);
+    Assert(pvCpuPage);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-    AssertReturn(!fEnabledByHost, VERR_INVALID_PARAMETER);
-    AssertReturn(   HCPhysCpuPage
-                 && HCPhysCpuPage != NIL_RTHCPHYS, VERR_INVALID_PARAMETER);
-    AssertReturn(pvCpuPage, VERR_INVALID_PARAMETER);
+
     NOREF(pvArg);
     NOREF(fEnabledByHost);
 
     /* Paranoid: Disable interrupt as, in theory, interrupt handlers might mess with EFER. */
-    RTCCUINTREG uEflags = ASMIntDisableFlags();
+    RTCCUINTREG fEFlags = ASMIntDisableFlags();
 
     /*
      * We must turn on AMD-V and setup the host state physical address, as those MSRs are per CPU.
@@ -346,7 +356,7 @@ VMMR0DECL(int) SVMR0EnableCpu(PHMGLOBALCPUINFO pCpu, PVM pVM, void *pvCpuPage, R
 
         if (!pCpu->fIgnoreAMDVInUseError)
         {
-            ASMSetFlags(uEflags);
+            ASMSetFlags(fEFlags);
             return VERR_SVM_IN_USE;
         }
     }
@@ -358,7 +368,7 @@ VMMR0DECL(int) SVMR0EnableCpu(PHMGLOBALCPUINFO pCpu, PVM pVM, void *pvCpuPage, R
     ASMWrMsr(MSR_K8_VM_HSAVE_PA, HCPhysCpuPage);
 
     /* Restore interrupts. */
-    ASMSetFlags(uEflags);
+    ASMSetFlags(fEFlags);
 
     /*
      * Theoretically, other hypervisors may have used ASIDs, ideally we should flush all non-zero ASIDs
@@ -394,7 +404,7 @@ VMMR0DECL(int) SVMR0DisableCpu(PHMGLOBALCPUINFO pCpu, void *pvCpuPage, RTHCPHYS
     NOREF(pCpu);
 
     /* Paranoid: Disable interrupts as, in theory, interrupt handlers might mess with EFER. */
-    RTCCUINTREG uEflags = ASMIntDisableFlags();
+    RTCCUINTREG fEFlags = ASMIntDisableFlags();
 
     /* Turn off AMD-V in the EFER MSR. */
     uint64_t u64HostEfer = ASMRdMsr(MSR_K6_EFER);
@@ -404,7 +414,7 @@ VMMR0DECL(int) SVMR0DisableCpu(PHMGLOBALCPUINFO pCpu, void *pvCpuPage, RTHCPHYS
     ASMWrMsr(MSR_K8_VM_HSAVE_PA, 0);
 
     /* Restore interrupts. */
-    ASMSetFlags(uEflags);
+    ASMSetFlags(fEFlags);
 
     return VINF_SUCCESS;
 }
@@ -562,7 +572,7 @@ VMMR0DECL(int) SVMR0InitVM(PVM pVM)
         pVCpu->hm.s.svm.pvMsrBitmap     = RTR0MemObjAddress(pVCpu->hm.s.svm.hMemObjMsrBitmap);
         pVCpu->hm.s.svm.HCPhysMsrBitmap = RTR0MemObjGetPagePhysAddr(pVCpu->hm.s.svm.hMemObjMsrBitmap, 0 /* iPage */);
         /* Set all bits to intercept all MSR accesses (changed later on). */
-        ASMMemFill32(pVCpu->hm.s.svm.pvMsrBitmap, 2 << PAGE_SHIFT, 0xffffffff);
+        ASMMemFill32(pVCpu->hm.s.svm.pvMsrBitmap, 2 << PAGE_SHIFT, UINT32_C(0xffffffff));
     }
 
     return VINF_SUCCESS;
@@ -668,6 +678,10 @@ VMMR0DECL(int) SVMR0SetupVM(PVM pVM)
 
         AssertMsgReturn(pVmcb, ("Invalid pVmcb for vcpu[%u]\n", i), VERR_SVM_INVALID_PVMCB);
 
+       /* Initialize the #VMEXIT history array with end-of-array markers (UINT16_MAX). */
+        Assert(!pVCpu->hm.s.idxExitHistoryFree);
+        HMCPU_EXIT_HISTORY_RESET(pVCpu);
+
         /* Trap exceptions unconditionally (debug purposes). */
 #ifdef HMSVM_ALWAYS_TRAP_PF
         pVmcb->ctrl.u32InterceptException |=   RT_BIT(X86_XCPT_PF);
@@ -689,29 +703,30 @@ VMMR0DECL(int) SVMR0SetupVM(PVM pVM)
 #endif
 
         /* Set up unconditional intercepts and conditions. */
-        pVmcb->ctrl.u32InterceptCtrl1 =   SVM_CTRL1_INTERCEPT_INTR          /* External interrupt causes a VM-exit. */
-                                        | SVM_CTRL1_INTERCEPT_NMI           /* Non-Maskable Interrupts causes a VM-exit. */
-                                        | SVM_CTRL1_INTERCEPT_INIT          /* INIT signal causes a VM-exit. */
-                                        | SVM_CTRL1_INTERCEPT_RDPMC         /* RDPMC causes a VM-exit. */
-                                        | SVM_CTRL1_INTERCEPT_CPUID         /* CPUID causes a VM-exit. */
-                                        | SVM_CTRL1_INTERCEPT_RSM           /* RSM causes a VM-exit. */
-                                        | SVM_CTRL1_INTERCEPT_HLT           /* HLT causes a VM-exit. */
-                                        | SVM_CTRL1_INTERCEPT_INOUT_BITMAP  /* Use the IOPM to cause IOIO VM-exits. */
-                                        | SVM_CTRL1_INTERCEPT_MSR_SHADOW    /* MSR access not covered by MSRPM causes a VM-exit.*/
-                                        | SVM_CTRL1_INTERCEPT_INVLPGA       /* INVLPGA causes a VM-exit. */
-                                        | SVM_CTRL1_INTERCEPT_SHUTDOWN      /* Shutdown events causes a VM-exit. */
+        pVmcb->ctrl.u32InterceptCtrl1 =   SVM_CTRL1_INTERCEPT_INTR          /* External interrupt causes a #VMEXIT. */
+                                        | SVM_CTRL1_INTERCEPT_NMI           /* Non-maskable interrupts causes a #VMEXIT. */
+                                        | SVM_CTRL1_INTERCEPT_INIT          /* INIT signal causes a #VMEXIT. */
+                                        | SVM_CTRL1_INTERCEPT_RDPMC         /* RDPMC causes a #VMEXIT. */
+                                        | SVM_CTRL1_INTERCEPT_CPUID         /* CPUID causes a #VMEXIT. */
+                                        | SVM_CTRL1_INTERCEPT_RSM           /* RSM causes a #VMEXIT. */
+                                        | SVM_CTRL1_INTERCEPT_HLT           /* HLT causes a #VMEXIT. */
+                                        | SVM_CTRL1_INTERCEPT_INOUT_BITMAP  /* Use the IOPM to cause IOIO #VMEXITs. */
+                                        | SVM_CTRL1_INTERCEPT_MSR_SHADOW    /* MSR access not covered by MSRPM causes a #VMEXIT.*/
+                                        | SVM_CTRL1_INTERCEPT_INVLPGA       /* INVLPGA causes a #VMEXIT. */
+                                        | SVM_CTRL1_INTERCEPT_SHUTDOWN      /* Shutdown events causes a #VMEXIT. */
                                         | SVM_CTRL1_INTERCEPT_FERR_FREEZE;  /* Intercept "freezing" during legacy FPU handling. */
 
-        pVmcb->ctrl.u32InterceptCtrl2 =   SVM_CTRL2_INTERCEPT_VMRUN         /* VMRUN causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_VMMCALL       /* VMMCALL causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_VMLOAD        /* VMLOAD causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_VMSAVE        /* VMSAVE causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_STGI          /* STGI causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_CLGI          /* CLGI causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_SKINIT        /* SKINIT causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_WBINVD        /* WBINVD causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_MONITOR       /* MONITOR causes a VM-exit. */
-                                        | SVM_CTRL2_INTERCEPT_MWAIT;        /* MWAIT causes a VM-exit. */
+        pVmcb->ctrl.u32InterceptCtrl2 =   SVM_CTRL2_INTERCEPT_VMRUN         /* VMRUN causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_VMMCALL       /* VMMCALL causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_VMLOAD        /* VMLOAD causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_VMSAVE        /* VMSAVE causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_STGI          /* STGI causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_CLGI          /* CLGI causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_SKINIT        /* SKINIT causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_WBINVD        /* WBINVD causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_MONITOR       /* MONITOR causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_MWAIT         /* MWAIT causes a #VMEXIT. */
+                                        | SVM_CTRL2_INTERCEPT_XSETBV;       /* XSETBV causes a #VMEXIT. */
 
         /* CR0, CR4 reads must be intercepted, our shadow values are not necessarily the same as the guest's. */
         pVmcb->ctrl.u16InterceptRdCRx = RT_BIT(0) | RT_BIT(4);
@@ -772,6 +787,10 @@ VMMR0DECL(int) SVMR0SetupVM(PVM pVM)
         pVmcb->ctrl.u32InterceptCtrl1 |= SVM_CTRL1_INTERCEPT_TASK_SWITCH;
 #endif
 
+        /* Apply the exceptions intercepts needed by the GIM provider. */
+        if (pVCpu->hm.s.fGIMTrapXcptUD)
+            pVmcb->ctrl.u32InterceptException |= RT_BIT(X86_XCPT_UD);
+
         /*
          * The following MSRs are saved/restored automatically during the world-switch.
          * Don't intercept guest read/write accesses to these MSRs.
@@ -1009,13 +1028,17 @@ static void hmR0SvmFlushTaggedTlb(PVMCPU pVCpu)
  */
 DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS HCPhysVmcbHost, RTHCPHYS HCPhysVmcb, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu)
 {
-    uint32_t aParam[4];
+    uint32_t aParam[8];
     aParam[0] = (uint32_t)(HCPhysVmcbHost);             /* Param 1: HCPhysVmcbHost - Lo. */
     aParam[1] = (uint32_t)(HCPhysVmcbHost >> 32);       /* Param 1: HCPhysVmcbHost - Hi. */
     aParam[2] = (uint32_t)(HCPhysVmcb);                 /* Param 2: HCPhysVmcb - Lo. */
     aParam[3] = (uint32_t)(HCPhysVmcb >> 32);           /* Param 2: HCPhysVmcb - Hi. */
+    aParam[4] = VM_RC_ADDR(pVM, pVM);
+    aParam[5] = 0;
+    aParam[6] = VM_RC_ADDR(pVM, pVCpu);
+    aParam[7] = 0;
 
-    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, HM64ON32OP_SVMRCVMRun64, 4, &aParam[0]);
+    return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, HM64ON32OP_SVMRCVMRun64, RT_ELEMENTS(aParam), &aParam[0]);
 }
 
 
@@ -1027,11 +1050,11 @@ DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS HCPhysVmcbHost, RTHCPHYS HCPhysVmcb,
  * @param   pVCpu       Pointer to the VMCPU.
  * @param   pCtx        Pointer to the guest-CPU context.
  * @param   enmOp       The operation to perform.
- * @param   cbParam     Number of parameters.
+ * @param   cParams     Number of parameters.
  * @param   paParam     Array of 32-bit parameters.
  */
-VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, HM64ON32OP enmOp, uint32_t cbParam,
-                                         uint32_t *paParam)
+VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, HM64ON32OP enmOp,
+                                         uint32_t cParams, uint32_t *paParam)
 {
     AssertReturn(pVM->hm.s.pfnHost32ToGuest64R0, VERR_HM_NO_32_TO_64_SWITCHER);
     Assert(enmOp > HM64ON32OP_INVALID && enmOp < HM64ON32OP_END);
@@ -1046,7 +1069,7 @@ VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, H
 
     CPUMSetHyperESP(pVCpu, VMMGetStackRC(pVCpu));
     CPUMSetHyperEIP(pVCpu, enmOp);
-    for (int i = (int)cbParam - 1; i >= 0; i--)
+    for (int i = (int)cParams - 1; i >= 0; i--)
         CPUMPushHyper(pVCpu, paParam[i]);
 
     STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatWorldSwitch3264, z);
@@ -1067,7 +1090,7 @@ VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, H
  * Adds an exception to the intercept exception bitmap in the VMCB and updates
  * the corresponding VMCB Clean bit.
  *
- * @param   pVmcb       Pointer to the VMCB.
+ * @param   pVmcb       Pointer to the VM control block.
  * @param   u32Xcpt     The value of the exception (X86_XCPT_*).
  */
 DECLINLINE(void) hmR0SvmAddXcptIntercept(PSVMVMCB pVmcb, uint32_t u32Xcpt)
@@ -1084,7 +1107,7 @@ DECLINLINE(void) hmR0SvmAddXcptIntercept(PSVMVMCB pVmcb, uint32_t u32Xcpt)
  * Removes an exception from the intercept-exception bitmap in the VMCB and
  * updates the corresponding VMCB Clean bit.
  *
- * @param   pVmcb       Pointer to the VMCB.
+ * @param   pVmcb       Pointer to the VM control block.
  * @param   u32Xcpt     The value of the exception (X86_XCPT_*).
  */
 DECLINLINE(void) hmR0SvmRemoveXcptIntercept(PSVMVMCB pVmcb, uint32_t u32Xcpt)
@@ -1106,7 +1129,7 @@ DECLINLINE(void) hmR0SvmRemoveXcptIntercept(PSVMVMCB pVmcb, uint32_t u32Xcpt)
  *
  * @returns VBox status code.
  * @param   pVM         Pointer to the VMCPU.
- * @param   pVmcb       Pointer to the VMCB.
+ * @param   pVmcb       Pointer to the VM control block.
  * @param   pCtx        Pointer to the guest-CPU context.
  *
  * @remarks No-long-jump zone!!!
@@ -1130,7 +1153,7 @@ static void hmR0SvmLoadSharedCR0(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
         if (!pVM->hm.s.fNestedPaging)
         {
             u64GuestCR0 |= X86_CR0_PG;     /* When Nested Paging is not available, use shadow page tables. */
-            u64GuestCR0 |= X86_CR0_WP;     /* Guest CPL 0 writes to its read-only pages should cause a #PF VM-exit. */
+            u64GuestCR0 |= X86_CR0_WP;     /* Guest CPL 0 writes to its read-only pages should cause a #PF #VMEXIT. */
         }
 
         /*
@@ -1150,7 +1173,7 @@ static void hmR0SvmLoadSharedCR0(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
         }
         else
         {
-            fInterceptNM = true;           /* Guest FPU inactive, VM-exit on #NM for lazy FPU loading. */
+            fInterceptNM = true;           /* Guest FPU inactive, #VMEXIT on #NM for lazy FPU loading. */
             u64GuestCR0 |=  X86_CR0_TS     /* Guest can task switch quickly and do lazy FPU syncing. */
                           | X86_CR0_MP;    /* FWAIT/WAIT should not ignore CR0.TS and should generate #NM. */
         }
@@ -1180,7 +1203,7 @@ static void hmR0SvmLoadSharedCR0(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
  *
  * @returns VBox status code.
  * @param   pVCpu       Pointer to the VMCPU.
- * @param   pVmcb       Pointer to the VMCB.
+ * @param   pVmcb       Pointer to the VM control block.
  * @param   pCtx        Pointer to the guest-CPU context.
  *
  * @remarks No-long-jump zone!!!
@@ -1228,6 +1251,7 @@ static int hmR0SvmLoadGuestControlRegs(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pC
 
     /*
      * Guest CR4.
+     * ASSUMES this is done everytime we get in from ring-3! (XCR0)
      */
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_CR4))
     {
@@ -1268,6 +1292,10 @@ static int hmR0SvmLoadGuestControlRegs(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pC
 
         pVmcb->guest.u64CR4 = u64GuestCR4;
         pVmcb->ctrl.u64VmcbCleanBits &= ~HMSVM_VMCB_CLEAN_CRX_EFER;
+
+        /* Whether to save/load/restore XCR0 during world switch depends on CR4.OSXSAVE and host+guest XCR0. */
+        pVCpu->hm.s.fLoadSaveGuestXcr0 = (u64GuestCR4 & X86_CR4_OSXSAVE) && pCtx->aXcr[0] != ASMGetXcr0();
+
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_CR4);
     }
 
@@ -1280,7 +1308,7 @@ static int hmR0SvmLoadGuestControlRegs(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pC
  *
  * @returns VBox status code.
  * @param   pVCpu       Pointer to the VMCPU.
- * @param   pVmcb       Pointer to the VMCB.
+ * @param   pVmcb       Pointer to the VM control block.
  * @param   pCtx        Pointer to the guest-CPU context.
  *
  * @remarks No-long-jump zone!!!
@@ -1340,7 +1368,7 @@ static void hmR0SvmLoadGuestSegmentRegs(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX p
  * Loads the guest MSRs into the VMCB.
  *
  * @param   pVCpu       Pointer to the VMCPU.
- * @param   pVmcb       Pointer to the VMCB.
+ * @param   pVmcb       Pointer to the VM control block.
  * @param   pCtx        Pointer to the guest-CPU context.
  *
  * @remarks No-long-jump zone!!!
@@ -1354,7 +1382,7 @@ static void hmR0SvmLoadGuestMsrs(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
 
     /*
      * Guest EFER MSR.
-     * AMD-V requires guest EFER.SVME to be set. Weird.                                                                                 .
+     * AMD-V requires guest EFER.SVME to be set. Weird.
      * See AMD spec. 15.5.1 "Basic Operation" | "Canonicalization and Consistency Checks".
      */
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_EFER_MSR))
@@ -1396,7 +1424,7 @@ static void hmR0SvmLoadGuestMsrs(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
  * accordingly.
  *
  * @param   pVCpu       Pointer to the VMCPU.
- * @param   pVmcb       Pointer to the VMCB.
+ * @param   pVmcb       Pointer to the VM control block.
  * @param   pCtx        Pointer to the guest-CPU context.
  *
  * @remarks No-long-jump zone!!!
@@ -1415,7 +1443,7 @@ static void hmR0SvmLoadSharedDebugState(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX p
     /*
      * Anyone single stepping on the host side? If so, we'll have to use the
      * trap flag in the guest EFLAGS since AMD-V doesn't have a trap flag on
-     * the VMM level like VT-x implementations does.
+     * the VMM level like the VT-x implementations does.
      */
     bool const fStepping = pVCpu->hm.s.fSingleInstruction || DBGFIsStepping(pVCpu);
     if (fStepping)
@@ -1426,8 +1454,8 @@ static void hmR0SvmLoadSharedDebugState(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX p
         fInterceptMovDRx = true; /* Need clean DR6, no guest mess. */
     }
 
-    PVM pVM = pVCpu->CTX_SUFF(pVM);
-    if (fStepping || (CPUMGetHyperDR7(pVCpu) & X86_DR7_ENABLED_MASK))
+    if (   fStepping
+        || (CPUMGetHyperDR7(pVCpu) & X86_DR7_ENABLED_MASK))
     {
         /*
          * Use the combined guest and host DRx values found in the hypervisor
@@ -1561,9 +1589,9 @@ static void hmR0SvmLoadSharedDebugState(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX p
  * Loads the guest APIC state (currently just the TPR).
  *
  * @returns VBox status code.
- * @param   pVCpu   Pointer to the VMCPU.
- * @param   pVmcb   Pointer to the VMCB.
- * @param   pCtx    Pointer to the guest-CPU context.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pVmcb       Pointer to the VM control block.
+ * @param   pCtx        Pointer to the guest-CPU context.
  */
 static int hmR0SvmLoadGuestApicState(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
 {
@@ -1617,6 +1645,30 @@ static int hmR0SvmLoadGuestApicState(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx
 
 
 /**
+ * Loads the exception interrupts required for guest execution in the VMCB.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pVmcb       Pointer to the VM control block.
+ * @param   pCtx        Pointer to the guest-CPU context.
+ */
+static int hmR0SvmLoadGuestXcptIntercepts(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
+{
+    int rc = VINF_SUCCESS;
+    if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS))
+    {
+        /* The remaining intercepts are handled elsewhere, e.g. in hmR0SvmLoadSharedCR0(). */
+        if (pVCpu->hm.s.fGIMTrapXcptUD)
+            hmR0SvmAddXcptIntercept(pVmcb, X86_XCPT_UD);
+        else
+            hmR0SvmRemoveXcptIntercept(pVmcb, X86_XCPT_UD);
+        HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
+    }
+    return rc;
+}
+
+
+/**
  * Sets up the appropriate function to run guest code.
  *
  * @returns VBox status code.
@@ -1664,7 +1716,7 @@ VMMR0DECL(int) SVMR0Enter(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
     AssertPtr(pVCpu);
     Assert(pVM->hm.s.svm.fSupported);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-    NOREF(pCpu);
+    NOREF(pVM); NOREF(pCpu);
 
     LogFlowFunc(("pVM=%p pVCpu=%p\n", pVM, pVCpu));
     Assert(HMCPU_CF_IS_SET(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_HOST_GUEST_SHARED_STATE));
@@ -1684,12 +1736,14 @@ VMMR0DECL(int) SVMR0Enter(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
  */
 VMMR0DECL(void) SVMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit)
 {
+    NOREF(fGlobalInit);
+
     switch (enmEvent)
     {
-        case RTTHREADCTXEVENT_PREEMPTING:
+        case RTTHREADCTXEVENT_OUT:
         {
             Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-            Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu));
+            Assert(VMMR0ThreadCtxHookIsEnabled(pVCpu));
             VMCPU_ASSERT_EMT(pVCpu);
 
             PVM         pVM  = pVCpu->CTX_SUFF(pVM);
@@ -1714,10 +1768,10 @@ VMMR0DECL(void) SVMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu,
             break;
         }
 
-        case RTTHREADCTXEVENT_RESUMED:
+        case RTTHREADCTXEVENT_IN:
         {
             Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-            Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu));
+            Assert(VMMR0ThreadCtxHookIsEnabled(pVCpu));
             VMCPU_ASSERT_EMT(pVCpu);
 
             /* No longjmps (log-flush, locks) in this fragile context. */
@@ -1764,9 +1818,9 @@ VMMR0DECL(int) SVMR0SaveHostState(PVM pVM, PVMCPU pVCpu)
 
 
 /**
- * Loads the guest state into the VMCB. The CPU state will be loaded from these
- * fields on every successful VM-entry.
+ * Loads the guest state into the VMCB.
  *
+ * The CPU state will be loaded from these fields on every successful VM-entry.
  * Also sets up the appropriate VMRUN function to execute guest code based on
  * the guest CPU mode.
  *
@@ -1798,17 +1852,21 @@ static int hmR0SvmLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
     rc = hmR0SvmLoadGuestApicState(pVCpu, pVmcb, pCtx);
     AssertLogRelMsgRCReturn(rc, ("hmR0SvmLoadGuestApicState! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
 
+    rc = hmR0SvmLoadGuestXcptIntercepts(pVCpu, pVmcb, pCtx);
+    AssertLogRelMsgRCReturn(rc, ("hmR0SvmLoadGuestXcptIntercepts! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
+
     rc = hmR0SvmSetupVMRunHandler(pVCpu, pCtx);
     AssertLogRelMsgRCReturn(rc, ("hmR0SvmSetupVMRunHandler! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
 
     /* Clear any unused and reserved bits. */
-    HMCPU_CF_CLEAR(pVCpu,   HM_CHANGED_GUEST_RIP                /* Unused (loaded unconditionally). */
+    HMCPU_CF_CLEAR(pVCpu,   HM_CHANGED_GUEST_RIP                  /* Unused (loaded unconditionally). */
                           | HM_CHANGED_GUEST_RSP
                           | HM_CHANGED_GUEST_RFLAGS
                           | HM_CHANGED_GUEST_SYSENTER_CS_MSR
                           | HM_CHANGED_GUEST_SYSENTER_EIP_MSR
                           | HM_CHANGED_GUEST_SYSENTER_ESP_MSR
-                          | HM_CHANGED_SVM_RESERVED1            /* Reserved. */
+                          | HM_CHANGED_GUEST_LAZY_MSRS            /* Unused. */
+                          | HM_CHANGED_SVM_RESERVED1              /* Reserved. */
                           | HM_CHANGED_SVM_RESERVED2
                           | HM_CHANGED_SVM_RESERVED3
                           | HM_CHANGED_SVM_RESERVED4);
@@ -1818,7 +1876,7 @@ static int hmR0SvmLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
               ||  HMCPU_CF_IS_PENDING_ONLY(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_HOST_GUEST_SHARED_STATE),
                ("fContextUseFlags=%#RX32\n", HMCPU_CF_VALUE(pVCpu)));
 
-    Log4(("Load: CS:RIP=%04x:%RX64 EFL=%#x SS:RSP=%04x:%RX64\n", pCtx->cs.Sel, pCtx->rip, pCtx->eflags.u, pCtx->ss, pCtx->rsp));
+    Log4(("Load: CS:RIP=%04x:%RX64 EFL=%#x SS:RSP=%04x:%RX64\n", pCtx->cs.Sel, pCtx->rip, pCtx->eflags.u, pCtx->ss.Sel, pCtx->rsp));
     STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatLoadGuestState, x);
     return rc;
 }
@@ -1829,7 +1887,7 @@ static int hmR0SvmLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
  * VMCB.
  *
  * @param   pVCpu       Pointer to the VMCPU.
- * @param   pVmcb       Pointer to the VMCB.
+ * @param   pVmcb       Pointer to the VM control block.
  * @param   pCtx        Pointer to the guest-CPU context.
  *
  * @remarks No-long-jump zone!!!
@@ -1845,6 +1903,9 @@ static void hmR0SvmLoadSharedState(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_DEBUG))
         hmR0SvmLoadSharedDebugState(pVCpu, pVmcb, pCtx);
 
+    /* Unused on AMD-V. */
+    HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_LAZY_MSRS);
+
     AssertMsg(!HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_HOST_GUEST_SHARED_STATE),
               ("fContextUseFlags=%#RX32\n", HMCPU_CF_VALUE(pVCpu)));
 }
@@ -1877,7 +1938,7 @@ static void hmR0SvmSaveGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
      */
     if (pVmcb->ctrl.u64IntShadow & SVM_INTERRUPT_SHADOW_ACTIVE)
         EMSetInhibitInterruptsPC(pVCpu, pMixedCtx->rip);
-    else
+    else if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
         VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
 
     /*
@@ -1950,9 +2011,17 @@ static void hmR0SvmSaveGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     pMixedCtx->ss.Attr.n.u2Dpl = pVmcb->guest.u8CPL & 0x3;
 
     /*
-     * Guest Descriptor-Table registers.
+     * Guest TR.
+     * Fixup TR attributes so it's compatible with Intel. Important when saved-states are used
+     * between Intel and AMD. See @bugref{6208} comment #39.
      */
     HMSVM_SAVE_SEG_REG(TR, tr);
+    if (CPUMIsGuestInLongModeEx(pMixedCtx))
+        pMixedCtx->tr.Attr.n.u4Type = X86_SEL_TYPE_SYS_386_TSS_BUSY;
+
+    /*
+     * Guest Descriptor-Table registers.
+     */
     HMSVM_SAVE_SEG_REG(LDTR, ldtr);
     pMixedCtx->gdtr.cbGdt = pVmcb->guest.GDTR.u32Limit;
     pMixedCtx->gdtr.pGdt  = pVmcb->guest.GDTR.u64Base;
@@ -2053,7 +2122,7 @@ static void hmR0SvmLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
  */
 static int hmR0SvmLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
-    HM_DISABLE_PREEMPT_IF_NEEDED();
+    HM_DISABLE_PREEMPT();
     Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
@@ -2069,14 +2138,15 @@ static int hmR0SvmLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
      * !!! IMPORTANT !!!
      * If you modify code here, make sure to check whether hmR0SvmCallRing3Callback() needs to be updated too.
      */
+
+    /** @todo eliminate the need for calling VMMR0ThreadCtxHookDisable here!  */
     /* Deregister hook now that we've left HM context before re-enabling preemption. */
-    if (VMMR0ThreadCtxHooksAreRegistered(pVCpu))
-        VMMR0ThreadCtxHooksDeregister(pVCpu);
+    VMMR0ThreadCtxHookDisable(pVCpu);
 
     /* Leave HM context. This takes care of local init (term). */
     int rc = HMR0LeaveCpu(pVCpu);
 
-    HM_RESTORE_PREEMPT_IF_NEEDED();
+    HM_RESTORE_PREEMPT();
     return rc;
 }
 
@@ -2118,7 +2188,7 @@ DECLCALLBACK(int) hmR0SvmCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperati
          */
         VMMRZCallRing3RemoveNotification(pVCpu);
         VMMRZCallRing3Disable(pVCpu);
-        HM_DISABLE_PREEMPT_IF_NEEDED();
+        HM_DISABLE_PREEMPT();
 
         /* Restore host FPU state if necessary and resync on next R0 reentry .*/
         if (CPUMIsGuestFPUStateActive(pVCpu))
@@ -2127,14 +2197,14 @@ DECLCALLBACK(int) hmR0SvmCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperati
         /* Restore host debug registers if necessary and resync on next R0 reentry. */
         CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(pVCpu, false /* save DR6 */);
 
-        /* Deregister hook now that we've left HM context before re-enabling preemption. */
-        if (VMMR0ThreadCtxHooksAreRegistered(pVCpu))
-            VMMR0ThreadCtxHooksDeregister(pVCpu);
+        /* Deregister the hook now that we've left HM context before re-enabling preemption. */
+        /** @todo eliminate the need for calling VMMR0ThreadCtxHookDisable here!  */
+        VMMR0ThreadCtxHookDisable(pVCpu);
 
         /* Leave HM context. This takes care of local init (term). */
         HMR0LeaveCpu(pVCpu);
 
-        HM_RESTORE_PREEMPT_IF_NEEDED();
+        HM_RESTORE_PREEMPT();
         return VINF_SUCCESS;
     }
 
@@ -2186,6 +2256,11 @@ static void hmR0SvmExitToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, int rcExit)
         Assert(!pVCpu->hm.s.Event.fPending);
     }
 
+    /* If we're emulating an instruction, we shouldn't have any TRPM traps pending
+       and if we're injecting an event we should have a TRPM trap pending. */
+    Assert(rcExit != VINF_EM_RAW_INJECT_TRPM_EVENT || TRPMHasTrap(pVCpu));
+    Assert(rcExit != VINF_EM_RAW_EMULATE_INSTR || !TRPMHasTrap(pVCpu));
+
     /* Sync. the necessary state for going back to ring-3. */
     hmR0SvmLeaveSession(pVM, pVCpu, pCtx);
     STAM_COUNTER_DEC(&pVCpu->hm.s.StatSwitchLongJmpToR3);
@@ -2203,13 +2278,6 @@ static void hmR0SvmExitToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, int rcExit)
         CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_GLOBAL_TLB_FLUSH);
     }
 
-    /* Make sure we've undo the trap flag if we tried to single step something. */
-    if (pVCpu->hm.s.fClearTrapFlag)
-    {
-        pCtx->eflags.Bits.u1TF = 0;
-        pVCpu->hm.s.fClearTrapFlag = false;
-    }
-
     /* On our way back from ring-3 reload the guest state if there is a possibility of it being changed. */
     if (rcExit != VINF_EM_RAW_INTERRUPT)
         HMCPU_CF_SET(pVCpu, HM_CHANGED_ALL_GUEST);
@@ -2226,28 +2294,21 @@ static void hmR0SvmExitToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, int rcExit)
  * Updates the use of TSC offsetting mode for the CPU and adjusts the necessary
  * intercepts.
  *
+ * @param   pVM         The shared VM handle.
  * @param   pVCpu       Pointer to the VMCPU.
  *
  * @remarks No-long-jump zone!!!
  */
-static void hmR0SvmUpdateTscOffsetting(PVMCPU pVCpu)
+static void hmR0SvmUpdateTscOffsetting(PVM pVM, PVMCPU pVCpu)
 {
+    bool     fParavirtTsc;
     PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
-    if (TMCpuTickCanUseRealTSC(pVCpu, &pVmcb->ctrl.u64TSCOffset))
+    bool fCanUseRealTsc = TMCpuTickCanUseRealTSC(pVM, pVCpu, &pVmcb->ctrl.u64TSCOffset, &fParavirtTsc);
+    if (fCanUseRealTsc)
     {
-        uint64_t u64CurTSC = ASMReadTSC();
-        if (u64CurTSC + pVmcb->ctrl.u64TSCOffset > TMCpuTickGetLastSeen(pVCpu))
-        {
-            pVmcb->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_RDTSC;
-            pVmcb->ctrl.u32InterceptCtrl2 &= ~SVM_CTRL2_INTERCEPT_RDTSCP;
-            STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffset);
-        }
-        else
-        {
-            pVmcb->ctrl.u32InterceptCtrl1 |= SVM_CTRL1_INTERCEPT_RDTSC;
-            pVmcb->ctrl.u32InterceptCtrl2 |= SVM_CTRL2_INTERCEPT_RDTSCP;
-            STAM_COUNTER_INC(&pVCpu->hm.s.StatTscInterceptOverFlow);
-        }
+        pVmcb->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_RDTSC;
+        pVmcb->ctrl.u32InterceptCtrl2 &= ~SVM_CTRL2_INTERCEPT_RDTSCP;
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffset);
     }
     else
     {
@@ -2255,8 +2316,16 @@ static void hmR0SvmUpdateTscOffsetting(PVMCPU pVCpu)
         pVmcb->ctrl.u32InterceptCtrl2 |= SVM_CTRL2_INTERCEPT_RDTSCP;
         STAM_COUNTER_INC(&pVCpu->hm.s.StatTscIntercept);
     }
-
     pVmcb->ctrl.u64VmcbCleanBits &= ~HMSVM_VMCB_CLEAN_INTERCEPTS;
+
+    /** @todo later optimize this to be done elsewhere and not before every
+     *        VM-entry. */
+    if (fParavirtTsc)
+    {
+        int rc = GIMR0UpdateParavirtTsc(pVM, 0 /* u64Offset */);
+        AssertRC(rc);
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscParavirt);
+    }
 }
 
 
@@ -2292,7 +2361,7 @@ DECLINLINE(void) hmR0SvmSetPendingEvent(PVMCPU pVCpu, PSVMEVENT pEvent, RTGCUINT
  * in the VMCB.
  *
  * @param   pVCpu       Pointer to the VMCPU.
- * @param   pVmcb       Pointer to the guest VMCB.
+ * @param   pVmcb       Pointer to the guest VM control block.
  * @param   pCtx        Pointer to the guest-CPU context.
  * @param   pEvent      Pointer to the event.
  *
@@ -2301,6 +2370,8 @@ DECLINLINE(void) hmR0SvmSetPendingEvent(PVMCPU pVCpu, PSVMEVENT pEvent, RTGCUINT
  */
 DECLINLINE(void) hmR0SvmInjectEventVmcb(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx, PSVMEVENT pEvent)
 {
+    NOREF(pVCpu); NOREF(pCtx);
+
     pVmcb->ctrl.EventInject.u = pEvent->u;
     STAM_COUNTER_INC(&pVCpu->hm.s.paStatInjectedIrqsR0[pEvent->n.u8Vector & MASK_INJECT_IRQ_STAT]);
 
@@ -2341,6 +2412,12 @@ static void hmR0SvmTrpmTrapToPendingEvent(PVMCPU pVCpu)
         Event.n.u3Type = SVM_EVENT_EXCEPTION;
         switch (uVector)
         {
+            case X86_XCPT_NMI:
+            {
+                Event.n.u3Type = SVM_EVENT_NMI;
+                break;
+            }
+
             case X86_XCPT_PF:
             case X86_XCPT_DF:
             case X86_XCPT_TS:
@@ -2356,12 +2433,7 @@ static void hmR0SvmTrpmTrapToPendingEvent(PVMCPU pVCpu)
         }
     }
     else if (enmTrpmEvent == TRPM_HARDWARE_INT)
-    {
-        if (uVector == X86_XCPT_NMI)
-            Event.n.u3Type = SVM_EVENT_NMI;
-        else
-            Event.n.u3Type = SVM_EVENT_EXTERNAL_IRQ;
-    }
+        Event.n.u3Type = SVM_EVENT_EXTERNAL_IRQ;
     else if (enmTrpmEvent == TRPM_SOFTWARE_INT)
         Event.n.u3Type = SVM_EVENT_SOFTWARE_INT;
     else
@@ -2399,13 +2471,13 @@ static void hmR0SvmPendingEventToTrpmTrap(PVMCPU pVCpu)
     switch (uVectorType)
     {
         case SVM_EVENT_EXTERNAL_IRQ:
-        case SVM_EVENT_NMI:
            enmTrapType = TRPM_HARDWARE_INT;
            break;
         case SVM_EVENT_SOFTWARE_INT:
             enmTrapType = TRPM_SOFTWARE_INT;
             break;
         case SVM_EVENT_EXCEPTION:
+        case SVM_EVENT_NMI:
             enmTrapType = TRPM_TRAP;
             break;
         default:
@@ -2478,7 +2550,7 @@ DECLINLINE(uint32_t) hmR0SvmGetGuestIntrShadow(PVMCPU pVCpu, PCPUMCTX pCtx)
  * instructs AMD-V to cause a #VMEXIT as soon as the guest is in a state to
  * receive interrupts.
  *
- * @param pVmcb         Pointer to the VMCB.
+ * @param pVmcb         Pointer to the VM control block.
  */
 DECLINLINE(void) hmR0SvmSetVirtIntrIntercept(PSVMVMCB pVmcb)
 {
@@ -2495,6 +2567,42 @@ DECLINLINE(void) hmR0SvmSetVirtIntrIntercept(PSVMVMCB pVmcb)
 
 
 /**
+ * Sets the IRET intercept control in the VMCB which instructs AMD-V to cause a
+ * #VMEXIT as soon as a guest starts executing an IRET. This is used to unblock
+ * virtual NMIs.
+ *
+ * @param pVmcb         Pointer to the VM control block.
+ */
+DECLINLINE(void) hmR0SvmSetIretIntercept(PSVMVMCB pVmcb)
+{
+    if (!(pVmcb->ctrl.u32InterceptCtrl1 & SVM_CTRL1_INTERCEPT_IRET))
+    {
+        pVmcb->ctrl.u32InterceptCtrl1 |= SVM_CTRL1_INTERCEPT_IRET;
+        pVmcb->ctrl.u64VmcbCleanBits &= ~(HMSVM_VMCB_CLEAN_INTERCEPTS);
+
+        Log4(("Setting IRET intercept\n"));
+    }
+}
+
+
+/**
+ * Clears the IRET intercept control in the VMCB.
+ *
+ * @param pVmcb         Pointer to the VM control block.
+ */
+DECLINLINE(void) hmR0SvmClearIretIntercept(PSVMVMCB pVmcb)
+{
+    if (pVmcb->ctrl.u32InterceptCtrl1 & SVM_CTRL1_INTERCEPT_IRET)
+    {
+        pVmcb->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_IRET;
+        pVmcb->ctrl.u64VmcbCleanBits &= ~(HMSVM_VMCB_CLEAN_INTERCEPTS);
+
+        Log4(("Clearing IRET intercept\n"));
+    }
+}
+
+
+/**
  * Evaluates the event to be delivered to the guest and sets it as the pending
  * event.
  *
@@ -2506,8 +2614,9 @@ static void hmR0SvmEvaluatePendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx)
     Assert(!pVCpu->hm.s.Event.fPending);
     Log4Func(("\n"));
 
-    const bool fIntShadow = !!hmR0SvmGetGuestIntrShadow(pVCpu, pCtx);
-    const bool fBlockInt  = !(pCtx->eflags.u32 & X86_EFL_IF);
+    bool const fIntShadow = RT_BOOL(hmR0SvmGetGuestIntrShadow(pVCpu, pCtx));
+    bool const fBlockInt  = !(pCtx->eflags.u32 & X86_EFL_IF);
+    bool const fBlockNmi  = RT_BOOL(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS));
     PSVMVMCB pVmcb        = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
 
     SVMEVENT Event;
@@ -2515,7 +2624,11 @@ static void hmR0SvmEvaluatePendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx)
                                                               /** @todo SMI. SMIs take priority over NMIs. */
     if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NMI))   /* NMI. NMIs take priority over regular interrupts . */
     {
-        if (!fIntShadow)
+        if (fBlockNmi)
+            hmR0SvmSetIretIntercept(pVmcb);
+        else if (fIntShadow)
+            hmR0SvmSetVirtIntrIntercept(pVmcb);
+        else
         {
             Log4(("Pending NMI\n"));
 
@@ -2524,10 +2637,9 @@ static void hmR0SvmEvaluatePendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx)
             Event.n.u3Type   = SVM_EVENT_NMI;
 
             hmR0SvmSetPendingEvent(pVCpu, &Event, 0 /* GCPtrFaultAddress */);
+            hmR0SvmSetIretIntercept(pVmcb);
             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI);
         }
-        else
-            hmR0SvmSetVirtIntrIntercept(pVmcb);
     }
     else if (VMCPU_FF_IS_PENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)))
     {
@@ -2575,10 +2687,9 @@ static void hmR0SvmInjectPendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx)
 {
     Assert(!TRPMHasTrap(pVCpu));
     Assert(!VMMRZCallRing3IsEnabled(pVCpu));
-    Log4Func(("\n"));
 
-    const bool fIntShadow = !!hmR0SvmGetGuestIntrShadow(pVCpu, pCtx);
-    const bool fBlockInt  = !(pCtx->eflags.u32 & X86_EFL_IF);
+    bool const fIntShadow = RT_BOOL(hmR0SvmGetGuestIntrShadow(pVCpu, pCtx));
+    bool const fBlockInt  = !(pCtx->eflags.u32 & X86_EFL_IF);
     PSVMVMCB pVmcb        = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
 
     if (pVCpu->hm.s.Event.fPending)                                /* First, inject any pending HM events. */
@@ -2610,6 +2721,7 @@ static void hmR0SvmInjectPendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx)
 
     /* Update the guest interrupt shadow in the VMCB. */
     pVmcb->ctrl.u64IntShadow = !!fIntShadow;
+    NOREF(fBlockInt);
 }
 
 
@@ -2625,12 +2737,13 @@ static void hmR0SvmInjectPendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx)
  */
 static void hmR0SvmReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, int rcVMRun, PCPUMCTX pCtx)
 {
+    NOREF(pCtx);
     HMSVM_ASSERT_PREEMPT_SAFE();
     PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
 
     if (rcVMRun == VERR_SVM_INVALID_GUEST_STATE)
     {
-        HMDumpRegs(pVM, pVCpu, pCtx);
+        HMDumpRegs(pVM, pVCpu, pCtx); NOREF(pVM);
 #ifdef VBOX_STRICT
         Log4(("ctrl.u64VmcbCleanBits             %#RX64\n",   pVmcb->ctrl.u64VmcbCleanBits));
         Log4(("ctrl.u16InterceptRdCRx            %#x\n",      pVmcb->ctrl.u16InterceptRdCRx));
@@ -2746,7 +2859,9 @@ static void hmR0SvmReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, int rcVMRun, PC
         Log4(("guest.u64BR_TO                    %#RX64\n",   pVmcb->guest.u64BR_TO));
         Log4(("guest.u64LASTEXCPFROM             %#RX64\n",   pVmcb->guest.u64LASTEXCPFROM));
         Log4(("guest.u64LASTEXCPTO               %#RX64\n",   pVmcb->guest.u64LASTEXCPTO));
-#endif
+#else
+        NOREF(pVmcb);
+#endif  /* VBOX_STRICT */
     }
     else
         Log4(("hmR0SvmReportWorldSwitchError: rcVMRun=%d\n", rcVMRun));
@@ -2911,23 +3026,44 @@ static int hmR0SvmPreRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIEN
      * We also check a couple of other force-flags as a last opportunity to get the EMT back to ring-3 before
      * executing guest code.
      */
-    pSvmTransient->uEflags = ASMIntDisableFlags();
+    pSvmTransient->fEFlags = ASMIntDisableFlags();
     if (   VM_FF_IS_PENDING(pVM, VM_FF_EMT_RENDEZVOUS | VM_FF_TM_VIRTUAL_SYNC)
         || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK))
     {
-        ASMSetFlags(pSvmTransient->uEflags);
+        ASMSetFlags(pSvmTransient->fEFlags);
         VMMRZCallRing3Enable(pVCpu);
         STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchHmToR3FF);
         return VINF_EM_RAW_TO_R3;
     }
     if (RTThreadPreemptIsPending(NIL_RTTHREAD))
     {
-        ASMSetFlags(pSvmTransient->uEflags);
+        ASMSetFlags(pSvmTransient->fEFlags);
         VMMRZCallRing3Enable(pVCpu);
         STAM_COUNTER_INC(&pVCpu->hm.s.StatPendingHostIrq);
         return VINF_EM_RAW_INTERRUPT;
     }
 
+    /*
+     * If we are injecting an NMI, we must set VMCPU_FF_BLOCK_NMIS only when we are going to execute
+     * guest code for certain (no exits to ring-3). Otherwise, we could re-read the flag on re-entry into
+     * AMD-V and conclude that NMI inhibition is active when we have not even delivered the NMI.
+     *
+     * With VT-x, this is handled by the Guest interruptibility information VMCS field which will set the
+     * VMCS field after actually delivering the NMI which we read on VM-exit to determine the state.
+     */
+    if (pVCpu->hm.s.Event.fPending)
+    {
+        SVMEVENT Event;
+        Event.u = pVCpu->hm.s.Event.u64IntInfo;
+        if (    Event.n.u1Valid
+            &&  Event.n.u3Type == SVM_EVENT_NMI
+            &&  Event.n.u8Vector == X86_XCPT_NMI
+            && !VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
+        {
+            VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
+        }
+    }
+
     return VINF_SUCCESS;
 }
 
@@ -2956,6 +3092,13 @@ static void hmR0SvmPreRunGuestCommitted(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, PS
 
     hmR0SvmInjectPendingEvent(pVCpu, pCtx);
 
+    if (   pVCpu->hm.s.fPreloadGuestFpu
+        && !CPUMIsGuestFPUStateActive(pVCpu))
+    {
+        CPUMR0LoadGuestFPU(pVM, pVCpu, pCtx);
+        HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR0);
+    }
+
     /* Load the state shared between host and guest (FPU, debug). */
     PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_HOST_GUEST_SHARED_STATE))
@@ -2964,15 +3107,16 @@ static void hmR0SvmPreRunGuestCommitted(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, PS
     AssertMsg(!HMCPU_CF_VALUE(pVCpu), ("fContextUseFlags=%#RX32\n", HMCPU_CF_VALUE(pVCpu)));
 
     /* Setup TSC offsetting. */
+    RTCPUID idCurrentCpu = HMR0GetCurrentCpu()->idCpu;
     if (   pSvmTransient->fUpdateTscOffsetting
-        || HMR0GetCurrentCpu()->idCpu != pVCpu->hm.s.idLastCpu)
+        || idCurrentCpu != pVCpu->hm.s.idLastCpu)
     {
-        hmR0SvmUpdateTscOffsetting(pVCpu);
+        hmR0SvmUpdateTscOffsetting(pVM, pVCpu);
         pSvmTransient->fUpdateTscOffsetting = false;
     }
 
     /* If we've migrating CPUs, mark the VMCB Clean bits as dirty. */
-    if (HMR0GetCurrentCpu()->idCpu != pVCpu->hm.s.idLastCpu)
+    if (idCurrentCpu != pVCpu->hm.s.idLastCpu)
         pVmcb->ctrl.u64VmcbCleanBits = 0;
 
     /* Store status of the shared guest-host state at the time of VMRUN. */
@@ -3009,8 +3153,6 @@ static void hmR0SvmPreRunGuestCommitted(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, PS
     if (    (pVM->hm.s.cpuid.u32AMDFeatureEDX & X86_CPUID_EXT_FEATURE_EDX_RDTSCP)
         && !(pVmcb->ctrl.u32InterceptCtrl2 & SVM_CTRL2_INTERCEPT_RDTSCP))
     {
-        /** @todo r=bird: I cannot find any place where the guest TSC_AUX value is
-         *        saved. */
         hmR0SvmSetMsrPermission(pVCpu, MSR_K8_TSC_AUX, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
         pVCpu->hm.s.u64HostTscAux = ASMRdMsr(MSR_K8_TSC_AUX);
         uint64_t u64GuestTscAux = CPUMR0GetGuestTscAux(pVCpu);
@@ -3084,9 +3226,9 @@ static void hmR0SvmPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PSVMT
 
     if (pSvmTransient->fRestoreTscAuxMsr)
     {
-        uint64_t u64GuestTscAux = ASMRdMsr(MSR_K8_TSC_AUX);
-        CPUMR0SetGuestTscAux(pVCpu, u64GuestTscAux);
-        if (u64GuestTscAux != pVCpu->hm.s.u64HostTscAux)
+        uint64_t u64GuestTscAuxMsr = ASMRdMsr(MSR_K8_TSC_AUX);
+        CPUMR0SetGuestTscAux(pVCpu, u64GuestTscAuxMsr);
+        if (u64GuestTscAuxMsr != pVCpu->hm.s.u64HostTscAux)
             ASMWrMsr(MSR_K8_TSC_AUX, pVCpu->hm.s.u64HostTscAux);
     }
 
@@ -3098,7 +3240,7 @@ static void hmR0SvmPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PSVMT
     VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_HM);
 
     Assert(!(ASMGetFlags() & X86_EFL_IF));
-    ASMSetFlags(pSvmTransient->uEflags);                        /* Enable interrupts. */
+    ASMSetFlags(pSvmTransient->fEFlags);                        /* Enable interrupts. */
     VMMRZCallRing3Enable(pVCpu);                                /* It is now safe to do longjmps to ring-3!!! */
 
     /* If VMRUN failed, we can bail out early. This does -not- cover SVM_EXIT_INVALID. */
@@ -3109,7 +3251,10 @@ static void hmR0SvmPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PSVMT
     }
 
     pSvmTransient->u64ExitCode  = pVmcb->ctrl.u64ExitCode;      /* Save the #VMEXIT reason. */
+    HMCPU_EXIT_HISTORY_ADD(pVCpu, pVmcb->ctrl.u64ExitCode);     /* Update the #VMEXIT history array. */
+    pSvmTransient->fVectoringDoublePF = false;                  /* Vectoring double page-fault needs to be determined later. */
     pSvmTransient->fVectoringPF = false;                        /* Vectoring page-fault needs to be determined later. */
+
     hmR0SvmSaveGuestState(pVCpu, pMixedCtx);                    /* Save the guest state from the VMCB to the guest-CPU context. */
 
     if (RT_LIKELY(pSvmTransient->u64ExitCode != (uint64_t)SVM_EXIT_INVALID))
@@ -3141,18 +3286,12 @@ static void hmR0SvmPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PSVMT
  * @returns VBox status code.
  * @param   pVM         Pointer to the VM.
  * @param   pVCpu       Pointer to the VMCPU.
- * @param   pCtx        Pointer to the guest-CPU context.
  */
-VMMR0DECL(int) SVMR0RunGuestCode(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
+static int hmR0SvmRunGuestCodeNormal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
-    Assert(VMMRZCallRing3IsEnabled(pVCpu));
-    HMSVM_ASSERT_PREEMPT_SAFE();
-    VMMRZCallRing3SetNotification(pVCpu, hmR0SvmCallRing3Callback, pCtx);
-
     SVMTRANSIENT SvmTransient;
     SvmTransient.fUpdateTscOffsetting = true;
     uint32_t cLoops = 0;
-    PSVMVMCB pVmcb  = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
     int      rc     = VERR_INTERNAL_ERROR_5;
 
     for (;; cLoops++)
@@ -3167,6 +3306,11 @@ VMMR0DECL(int) SVMR0RunGuestCode(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         if (rc != VINF_SUCCESS)
             break;
 
+        /*
+         * No longjmps to ring-3 from this point on!!!
+         * Asserts() will still longjmp to ring-3 (but won't return), which is intentional, better than a kernel panic.
+         * This also disables flushing of the R0-logger instance (if any).
+         */
         hmR0SvmPreRunGuestCommitted(pVM, pVCpu, pCtx, &SvmTransient);
         rc = hmR0SvmRunGuest(pVM, pVCpu, pCtx);
 
@@ -3187,19 +3331,143 @@ VMMR0DECL(int) SVMR0RunGuestCode(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         /* Handle the #VMEXIT. */
         HMSVM_EXITCODE_STAM_COUNTER_INC(SvmTransient.u64ExitCode);
         STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatExit1, &pVCpu->hm.s.StatExit2, x);
+        VBOXVMM_R0_HMSVM_VMEXIT(pVCpu, pCtx, SvmTransient.u64ExitCode, (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb);
+        rc = hmR0SvmHandleExit(pVCpu, pCtx, &SvmTransient);
+        STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit2, x);
+        if (rc != VINF_SUCCESS)
+            break;
+        if (cLoops > pVM->hm.s.cMaxResumeLoops)
+        {
+            STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchMaxResumeLoops);
+            rc = VINF_EM_RAW_INTERRUPT;
+            break;
+        }
+    }
+
+    STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatEntry, x);
+    return rc;
+}
+
+
+/**
+ * Runs the guest code using AMD-V in single step mode.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pCtx        Pointer to the guest-CPU context.
+ */
+static int hmR0SvmRunGuestCodeStep(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
+{
+    SVMTRANSIENT SvmTransient;
+    SvmTransient.fUpdateTscOffsetting = true;
+    uint32_t cLoops  = 0;
+    int      rc      = VERR_INTERNAL_ERROR_5;
+    uint16_t uCsStart  = pCtx->cs.Sel;
+    uint64_t uRipStart = pCtx->rip;
+
+    for (;; cLoops++)
+    {
+        Assert(!HMR0SuspendPending());
+        AssertMsg(pVCpu->hm.s.idEnteredCpu == RTMpCpuId(),
+                  ("Illegal migration! Entered on CPU %u Current %u cLoops=%u\n", (unsigned)pVCpu->hm.s.idEnteredCpu,
+                  (unsigned)RTMpCpuId(), cLoops));
+
+        /* Preparatory work for running guest code, this may force us to return
+           to ring-3.  This bugger disables interrupts on VINF_SUCCESS! */
+        STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatEntry, x);
+        rc = hmR0SvmPreRunGuest(pVM, pVCpu, pCtx, &SvmTransient);
+        if (rc != VINF_SUCCESS)
+            break;
+
+        /*
+         * No longjmps to ring-3 from this point on!!!
+         * Asserts() will still longjmp to ring-3 (but won't return), which is intentional, better than a kernel panic.
+         * This also disables flushing of the R0-logger instance (if any).
+         */
+        VMMRZCallRing3Disable(pVCpu);
+        VMMRZCallRing3RemoveNotification(pVCpu);
+        hmR0SvmPreRunGuestCommitted(pVM, pVCpu, pCtx, &SvmTransient);
+
+        rc = hmR0SvmRunGuest(pVM, pVCpu, pCtx);
+
+        /*
+         * Restore any residual host-state and save any bits shared between host and guest into the guest-CPU state.
+         * This will also re-enable longjmps to ring-3 when it has reached a safe point!!!
+         */
+        hmR0SvmPostRunGuest(pVM, pVCpu, pCtx, &SvmTransient, rc);
+        if (RT_UNLIKELY(   rc != VINF_SUCCESS                                         /* Check for VMRUN errors. */
+                        || SvmTransient.u64ExitCode == (uint64_t)SVM_EXIT_INVALID))   /* Check for invalid guest-state errors. */
+        {
+            if (rc == VINF_SUCCESS)
+                rc = VERR_SVM_INVALID_GUEST_STATE;
+            STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit1, x);
+            hmR0SvmReportWorldSwitchError(pVM, pVCpu, rc, pCtx);
+            return rc;
+        }
+
+        /* Handle the #VMEXIT. */
+        HMSVM_EXITCODE_STAM_COUNTER_INC(SvmTransient.u64ExitCode);
+        STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatExit1, &pVCpu->hm.s.StatExit2, x);
+        VBOXVMM_R0_HMSVM_VMEXIT(pVCpu, pCtx, SvmTransient.u64ExitCode, (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb);
         rc = hmR0SvmHandleExit(pVCpu, pCtx, &SvmTransient);
         STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit2, x);
         if (rc != VINF_SUCCESS)
             break;
-        else if (cLoops > pVM->hm.s.cMaxResumeLoops)
+        if (cLoops > pVM->hm.s.cMaxResumeLoops)
         {
-            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitMaxResume);
+            STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchMaxResumeLoops);
             rc = VINF_EM_RAW_INTERRUPT;
             break;
         }
+
+        /*
+         * Did the RIP change, if so, consider it a single step.
+         * Otherwise, make sure one of the TFs gets set.
+         */
+        if (   pCtx->rip    != uRipStart
+            || pCtx->cs.Sel != uCsStart)
+        {
+            rc = VINF_EM_DBG_STEPPED;
+            break;
+        }
+        pVCpu->hm.s.fContextUseFlags |= HM_CHANGED_GUEST_DEBUG;
+    }
+
+    /*
+     * Clear the X86_EFL_TF if necessary.
+     */
+    if (pVCpu->hm.s.fClearTrapFlag)
+    {
+        pVCpu->hm.s.fClearTrapFlag = false;
+        pCtx->eflags.Bits.u1TF = 0;
     }
 
     STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatEntry, x);
+    return rc;
+}
+
+
+/**
+ * Runs the guest code using AMD-V.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pCtx        Pointer to the guest-CPU context.
+ */
+VMMR0DECL(int) SVMR0RunGuestCode(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
+{
+    Assert(VMMRZCallRing3IsEnabled(pVCpu));
+    HMSVM_ASSERT_PREEMPT_SAFE();
+    VMMRZCallRing3SetNotification(pVCpu, hmR0SvmCallRing3Callback, pCtx);
+
+    int rc;
+    if (!pVCpu->hm.s.fSingleInstruction && !DBGFIsStepping(pVCpu))
+        rc = hmR0SvmRunGuestCodeNormal(pVM, pVCpu, pCtx);
+    else
+        rc = hmR0SvmRunGuestCodeStep(pVM, pVCpu, pCtx);
+
     if (rc == VERR_EM_INTERPRETER)
         rc = VINF_EM_RAW_EMULATE_INSTR;
     else if (rc == VINF_EM_RESET)
@@ -3226,7 +3494,7 @@ DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
     Assert(pSvmTransient->u64ExitCode <= SVM_EXIT_MAX);
 
     /*
-     * The ordering of the case labels is based on most-frequently-occurring VM-exits for most guests under
+     * The ordering of the case labels is based on most-frequently-occurring #VMEXITs for most guests under
      * normal workloads (for some definition of "normal").
      */
     uint32_t u32ExitCode = pSvmTransient->u64ExitCode;
@@ -3253,6 +3521,9 @@ DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
         case SVM_EXIT_EXCEPTION_7:   /* X86_XCPT_NM */
             return hmR0SvmExitXcptNM(pVCpu, pCtx, pSvmTransient);
 
+        case SVM_EXIT_EXCEPTION_6:  /* X86_XCPT_UD */
+            return hmR0SvmExitXcptUD(pVCpu, pCtx, pSvmTransient);
+
         case SVM_EXIT_EXCEPTION_10:  /* X86_XCPT_MF */
             return hmR0SvmExitXcptMF(pVCpu, pCtx, pSvmTransient);
 
@@ -3279,6 +3550,9 @@ DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
         case SVM_EXIT_WRITE_CR8:
             return hmR0SvmExitWriteCRx(pVCpu, pCtx, pSvmTransient);
 
+        case SVM_EXIT_VMMCALL:
+            return hmR0SvmExitVmmCall(pVCpu, pCtx, pSvmTransient);
+
         case SVM_EXIT_VINTR:
             return hmR0SvmExitVIntr(pVCpu, pCtx, pSvmTransient);
 
@@ -3318,11 +3592,14 @@ DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
                 case SVM_EXIT_WRITE_DR14:   case SVM_EXIT_WRITE_DR15:
                     return hmR0SvmExitWriteDRx(pVCpu, pCtx, pSvmTransient);
 
+                case SVM_EXIT_XSETBV:
+                    return hmR0SvmExitXsetbv(pVCpu, pCtx, pSvmTransient);
+
                 case SVM_EXIT_TASK_SWITCH:
                     return hmR0SvmExitTaskSwitch(pVCpu, pCtx, pSvmTransient);
 
-                case SVM_EXIT_VMMCALL:
-                    return hmR0SvmExitVmmCall(pVCpu, pCtx, pSvmTransient);
+                case SVM_EXIT_IRET:
+                    return hmR0SvmExitIret(pVCpu, pCtx, pSvmTransient);
 
                 case SVM_EXIT_SHUTDOWN:
                     return hmR0SvmExitShutdown(pVCpu, pCtx, pSvmTransient);
@@ -3356,7 +3633,7 @@ DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
                 case SVM_EXIT_EXCEPTION_3:             /* X86_XCPT_BP */
                 case SVM_EXIT_EXCEPTION_4:             /* X86_XCPT_OF */
                 case SVM_EXIT_EXCEPTION_5:             /* X86_XCPT_BR */
-                case SVM_EXIT_EXCEPTION_6:             /* X86_XCPT_UD */
+                /* case SVM_EXIT_EXCEPTION_6: */       /* X86_XCPT_UD - Handled above. */
                 /*   SVM_EXIT_EXCEPTION_7: */          /* X86_XCPT_NM - Handled above. */
                 case SVM_EXIT_EXCEPTION_8:             /* X86_XCPT_DF */
                 case SVM_EXIT_EXCEPTION_9:             /* X86_XCPT_CO_SEG_OVERRUN */
@@ -3395,10 +3672,6 @@ DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
                             STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestBP);
                             break;
 
-                        case X86_XCPT_UD:
-                            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestUD);
-                            break;
-
                         case X86_XCPT_NP:
                             Event.n.u1ErrorCodeValid    = 1;
                             Event.n.u32ErrorCode        = pVmcb->ctrl.u64ExitInfo1;
@@ -3468,7 +3741,7 @@ DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
             HMSVM_ASSERT_PREEMPT_CPUID(); \
     } while (0)
 #else   /* Release builds */
-# define HMSVM_VALIDATE_EXIT_HANDLER_PARAMS() do { } while (0)
+# define HMSVM_VALIDATE_EXIT_HANDLER_PARAMS() do { NOREF(pVCpu); NOREF(pCtx); NOREF(pSvmTransient); } while (0)
 #endif
 
 
@@ -3478,14 +3751,14 @@ DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
  * @return VBox status code.
  * @param   pVCpu           Pointer to the VMCPU.
  * @param   pCpu            Pointer to the disassembler state.
- * @param   pRegFrame       Pointer to the register frame.
+ * @param   pCtx            The guest CPU context.
  */
-static int hmR0SvmInterpretInvlPgEx(PVMCPU pVCpu, PDISCPUSTATE pCpu, PCPUMCTXCORE pRegFrame)
+static int hmR0SvmInterpretInvlPgEx(PVMCPU pVCpu, PDISCPUSTATE pCpu, PCPUMCTX pCtx)
 {
     DISQPVPARAMVAL Param1;
     RTGCPTR        GCPtrPage;
 
-    int rc = DISQueryParamVal(pRegFrame, pCpu, &pCpu->Param1, &Param1, DISQPVWHICH_SRC);
+    int rc = DISQueryParamVal(CPUMCTX2CORE(pCtx), pCpu, &pCpu->Param1, &Param1, DISQPVWHICH_SRC);
     if (RT_FAILURE(rc))
         return VERR_EM_INTERPRETER;
 
@@ -3496,7 +3769,7 @@ static int hmR0SvmInterpretInvlPgEx(PVMCPU pVCpu, PDISCPUSTATE pCpu, PCPUMCTXCOR
             return VERR_EM_INTERPRETER;
 
         GCPtrPage = Param1.val.val64;
-        VBOXSTRICTRC rc2 = EMInterpretInvlpg(pVCpu->CTX_SUFF(pVM), pVCpu, pRegFrame, GCPtrPage);
+        VBOXSTRICTRC rc2 = EMInterpretInvlpg(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pCtx), GCPtrPage);
         rc = VBOXSTRICTRC_VAL(rc2);
     }
     else
@@ -3518,11 +3791,11 @@ static int hmR0SvmInterpretInvlPgEx(PVMCPU pVCpu, PDISCPUSTATE pCpu, PCPUMCTXCOR
  * @retval  VERR_*                  Fatal errors.
  *
  * @param   pVM         Pointer to the VM.
- * @param   pRegFrame   Pointer to the register frame.
+ * @param   pCtx        The guest CPU context.
  *
  * @remarks Updates the RIP if the instruction was executed successfully.
  */
-static int hmR0SvmInterpretInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)
+static int hmR0SvmInterpretInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
     /* Only allow 32 & 64 bit code. */
     if (CPUMGetGuestCodeBits(pVCpu) != 16)
@@ -3532,9 +3805,9 @@ static int hmR0SvmInterpretInvlpg(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame)
         if (   RT_SUCCESS(rc)
             && pDis->pCurInstr->uOpcode == OP_INVLPG)
         {
-            rc = hmR0SvmInterpretInvlPgEx(pVCpu, pDis, pRegFrame);
+            rc = hmR0SvmInterpretInvlPgEx(pVCpu, pDis, pCtx);
             if (RT_SUCCESS(rc))
-                pRegFrame->rip += pDis->cbInstr;
+                pCtx->rip += pDis->cbInstr;
             return rc;
         }
         else
@@ -3667,6 +3940,10 @@ DECLINLINE(void) hmR0SvmSetPendingXcptDF(PVMCPU pVCpu)
  * TPR). See hmR3ReplaceTprInstr() for the details.
  *
  * @returns VBox status code.
+ * @retval VINF_SUCCESS if the access was handled successfully.
+ * @retval VERR_NOT_FOUND if no patch record for this RIP could be found.
+ * @retval VERR_SVM_UNEXPECTED_PATCH_TYPE if the found patch type is invalid.
+ *
  * @param   pVM         Pointer to the VM.
  * @param   pVCpu       Pointer to the VMCPU.
  * @param   pCtx        Pointer to the guest-CPU context.
@@ -3674,6 +3951,12 @@ DECLINLINE(void) hmR0SvmSetPendingXcptDF(PVMCPU pVCpu)
 static int hmR0SvmEmulateMovTpr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
     Log4(("Emulated VMMCall TPR access replacement at RIP=%RGv\n", pCtx->rip));
+
+    /*
+     * We do this in a loop as we increment the RIP after a successful emulation
+     * and the new RIP may be a patched instruction which needs emulation as well.
+     */
+    bool fPatchFound = false;
     for (;;)
     {
         bool    fPending;
@@ -3683,6 +3966,7 @@ static int hmR0SvmEmulateMovTpr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         if (!pPatch)
             break;
 
+        fPatchFound = true;
         switch (pPatch->enmType)
         {
             case HMTPRINSTR_READ:
@@ -3724,14 +4008,18 @@ static int hmR0SvmEmulateMovTpr(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         }
     }
 
-    return VINF_SUCCESS;
+    if (fPatchFound)
+        return VINF_SUCCESS;
+    return VERR_NOT_FOUND;
 }
 
 
 /**
- * Determines if an exception is a contributory exception. Contributory
- * exceptions are ones which can cause double-faults. Page-fault is
- * intentionally not included here as it's a conditional contributory exception.
+ * Determines if an exception is a contributory exception.
+ *
+ * Contributory exceptions are ones which can cause double-faults unless the
+ * original exception was a benign exception. Page-fault is intentionally not
+ * included here as it's a conditional contributory exception.
  *
  * @returns true if the exception is contributory, false otherwise.
  * @param   uVector     The exception vector.
@@ -3758,7 +4046,7 @@ DECLINLINE(bool) hmR0SvmIsContributoryXcpt(const uint32_t uVector)
  * IDT.
  *
  * @returns VBox status code (informational error codes included).
- * @retval VINF_SUCCESS if we should continue handling the VM-exit.
+ * @retval VINF_SUCCESS if we should continue handling the #VMEXIT.
  * @retval VINF_HM_DOUBLE_FAULT if a #DF condition was detected and we ought to
  *         continue execution of the guest which will delivery the #DF.
  * @retval VINF_EM_RESET if we detected a triple-fault condition.
@@ -3789,6 +4077,7 @@ static int hmR0SvmCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMT
         } SVMREFLECTXCPT;
 
         SVMREFLECTXCPT enmReflect = SVMREFLECTXCPT_NONE;
+        bool fReflectingNmi = false;
         if (pVmcb->ctrl.ExitIntInfo.n.u3Type == SVM_EVENT_EXCEPTION)
         {
             if (pSvmTransient->u64ExitCode - SVM_EXIT_EXCEPTION_0 <= SVM_EXIT_EXCEPTION_1F)
@@ -3805,8 +4094,8 @@ static int hmR0SvmCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMT
                 if (   uExitVector == X86_XCPT_PF
                     && uIdtVector  == X86_XCPT_PF)
                 {
-                    pSvmTransient->fVectoringPF = true;
-                    Log4(("IDT: Vectoring #PF uCR2=%#RX64\n", pCtx->cr2));
+                    pSvmTransient->fVectoringDoublePF = true;
+                    Log4(("IDT: Vectoring double #PF uCR2=%#RX64\n", pCtx->cr2));
                 }
                 else if (   (pVmcb->ctrl.u32InterceptException & HMSVM_CONTRIBUTORY_XCPT_MASK)
                          && hmR0SvmIsContributoryXcpt(uExitVector)
@@ -3830,21 +4119,37 @@ static int hmR0SvmCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMT
             {
                 /*
                  * If event delivery caused an #VMEXIT that is not an exception (e.g. #NPF) then reflect the original
-                 * exception to the guest after handling the VM-exit.
+                 * exception to the guest after handling the #VMEXIT.
                  */
                 enmReflect = SVMREFLECTXCPT_XCPT;
             }
         }
-        else if (pVmcb->ctrl.ExitIntInfo.n.u3Type != SVM_EVENT_SOFTWARE_INT)
+        else if (   pVmcb->ctrl.ExitIntInfo.n.u3Type == SVM_EVENT_EXTERNAL_IRQ
+                 || pVmcb->ctrl.ExitIntInfo.n.u3Type == SVM_EVENT_NMI)
         {
-            /* Ignore software interrupts (INT n) as they reoccur when restarting the instruction. */
             enmReflect = SVMREFLECTXCPT_XCPT;
+            fReflectingNmi = RT_BOOL(pVmcb->ctrl.ExitIntInfo.n.u3Type == SVM_EVENT_NMI);
+
+            if (pSvmTransient->u64ExitCode - SVM_EXIT_EXCEPTION_0 <= SVM_EXIT_EXCEPTION_1F)
+            {
+                uint8_t uExitVector = (uint8_t)(pSvmTransient->u64ExitCode - SVM_EXIT_EXCEPTION_0);
+                if (uExitVector == X86_XCPT_PF)
+                {
+                    pSvmTransient->fVectoringPF = true;
+                    Log4(("IDT: Vectoring #PF due to Ext-Int/NMI. uCR2=%#RX64\n", pCtx->cr2));
+                }
+            }
         }
+        /* else: Ignore software interrupts (INT n) as they reoccur when restarting the instruction. */
 
         switch (enmReflect)
         {
             case SVMREFLECTXCPT_XCPT:
             {
+                /* If we are re-injecting the NMI, clear NMI blocking. */
+                if (fReflectingNmi)
+                    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
+
                 Assert(pVmcb->ctrl.ExitIntInfo.n.u3Type != SVM_EVENT_SOFTWARE_INT);
                 hmR0SvmSetPendingEvent(pVCpu, &pVmcb->ctrl.ExitIntInfo, 0 /* GCPtrFaultAddress */);
 
@@ -3873,6 +4178,7 @@ static int hmR0SvmCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMT
         }
     }
     Assert(rc == VINF_SUCCESS || rc == VINF_HM_DOUBLE_FAULT || rc == VINF_EM_RESET);
+    NOREF(pCtx);
     return rc;
 }
 
@@ -3893,6 +4199,7 @@ DECLINLINE(void) hmR0SvmUpdateRip(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t cb)
     if (pVCpu->CTX_SUFF(pVM)->hm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE)
     {
         PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
+        Assert(pVmcb->ctrl.u64NextRIP - pCtx->rip == cb);
         pCtx->rip = pVmcb->ctrl.u64NextRIP;
     }
     else
@@ -3904,7 +4211,7 @@ DECLINLINE(void) hmR0SvmUpdateRip(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t cb)
 /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #VMEXIT handlers -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
 /* -=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
 
-/** @name VM-exit handlers.
+/** @name #VMEXIT handlers.
  * @{
  */
 
@@ -4067,7 +4374,7 @@ HMSVM_EXIT_DECL hmR0SvmExitInvlpg(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
     Assert(!pVM->hm.s.fNestedPaging);
 
     /** @todo Decode Assist. */
-    int rc = hmR0SvmInterpretInvlpg(pVM, pVCpu, CPUMCTX2CORE(pCtx));    /* Updates RIP if successful. */
+    int rc = hmR0SvmInterpretInvlpg(pVM, pVCpu, pCtx);    /* Updates RIP if successful. */
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitInvlpg);
     Assert(rc == VINF_SUCCESS || rc == VERR_EM_INTERPRETER);
     HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
@@ -4081,10 +4388,13 @@ HMSVM_EXIT_DECL hmR0SvmExitInvlpg(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
 HMSVM_EXIT_DECL hmR0SvmExitHlt(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
 {
     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
+
     hmR0SvmUpdateRip(pVCpu, pCtx, 1);
     int rc = EMShouldContinueAfterHalt(pVCpu, pCtx) ? VINF_SUCCESS : VINF_EM_HALT;
     HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitHlt);
+    if (rc != VINF_SUCCESS)
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchHltToR3);
     return rc;
 }
 
@@ -4181,10 +4491,13 @@ HMSVM_EXIT_DECL hmR0SvmExitReadCRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pS
 HMSVM_EXIT_DECL hmR0SvmExitWriteCRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
 {
     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
+
     /** @todo Decode Assist. */
-    VBOXSTRICTRC rc2 = EMInterpretInstruction(pVCpu, CPUMCTX2CORE(pCtx), 0 /* pvFault */);
-    int rc = VBOXSTRICTRC_VAL(rc2);
-    if (rc == VINF_SUCCESS)
+    VBOXSTRICTRC rcStrict = IEMExecOneBypassEx(pVCpu, CPUMCTX2CORE(pCtx), NULL);
+    if (RT_UNLIKELY(   rcStrict == VERR_IEM_ASPECT_NOT_IMPLEMENTED
+                    || rcStrict == VERR_IEM_INSTR_NOT_IMPLEMENTED))
+        rcStrict = VERR_EM_INTERPRETER;
+    if (rcStrict == VINF_SUCCESS)
     {
         /* RIP has been updated by EMInterpretInstruction(). */
         Assert((pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_CR0) <= 15);
@@ -4212,11 +4525,11 @@ HMSVM_EXIT_DECL hmR0SvmExitWriteCRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT p
                                 pSvmTransient->u64ExitCode, pSvmTransient->u64ExitCode - SVM_EXIT_WRITE_CR0));
                 break;
         }
-        HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
+        HMSVM_CHECK_SINGLE_STEP(pVCpu, rcStrict);
     }
     else
-        Assert(rc == VERR_EM_INTERPRETER || rc == VINF_PGM_CHANGE_MODE || rc == VINF_PGM_SYNC_CR3);
-    return rc;
+        Assert(rcStrict == VERR_EM_INTERPRETER || rcStrict == VINF_PGM_CHANGE_MODE || rcStrict == VINF_PGM_SYNC_CR3);
+    return VBOXSTRICTRC_TODO(rcStrict);
 }
 
 
@@ -4277,27 +4590,30 @@ HMSVM_EXIT_DECL hmR0SvmExitMsr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTr
         else
         {
             rc = VBOXSTRICTRC_TODO(EMInterpretInstruction(pVCpu, CPUMCTX2CORE(pCtx), 0 /* pvFault */));
-            if (RT_UNLIKELY(rc != VINF_SUCCESS))
+            if (RT_LIKELY(rc == VINF_SUCCESS))
+                HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);     /* RIP updated by EMInterpretInstruction(). */
+            else
                 AssertMsg(rc == VERR_EM_INTERPRETER, ("hmR0SvmExitMsr: WrMsr. EMInterpretInstruction failed rc=%Rrc\n", rc));
-            /* RIP updated by EMInterpretInstruction(). */
-            HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
         }
 
-        /* If this is an X2APIC WRMSR access, update the APIC state as well. */
-        if (   pCtx->ecx >= MSR_IA32_X2APIC_START
-            && pCtx->ecx <= MSR_IA32_X2APIC_END)
+        if (rc == VINF_SUCCESS)
         {
-            /*
-             * We've already saved the APIC related guest-state (TPR) in hmR0SvmPostRunGuest(). When full APIC register
-             * virtualization is implemented we'll have to make sure APIC state is saved from the VMCB before
-             * EMInterpretWrmsr() changes it.
-             */
-            HMCPU_CF_SET(pVCpu, HM_CHANGED_SVM_GUEST_APIC_STATE);
+            /* If this is an X2APIC WRMSR access, update the APIC state as well. */
+            if (   pCtx->ecx >= MSR_IA32_X2APIC_START
+                && pCtx->ecx <= MSR_IA32_X2APIC_END)
+            {
+                /*
+                 * We've already saved the APIC related guest-state (TPR) in hmR0SvmPostRunGuest(). When full APIC register
+                 * virtualization is implemented we'll have to make sure APIC state is saved from the VMCB before
+                 * EMInterpretWrmsr() changes it.
+                 */
+                HMCPU_CF_SET(pVCpu, HM_CHANGED_SVM_GUEST_APIC_STATE);
+            }
+            else if (pCtx->ecx == MSR_K6_EFER)
+                HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_EFER_MSR);
+            else if (pCtx->ecx == MSR_IA32_TSC)
+                pSvmTransient->fUpdateTscOffsetting = true;
         }
-        else if (pCtx->ecx == MSR_K6_EFER)
-            HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_EFER_MSR);
-        else if (pCtx->ecx == MSR_IA32_TSC)
-            pSvmTransient->fUpdateTscOffsetting = true;
     }
     else
     {
@@ -4339,7 +4655,7 @@ HMSVM_EXIT_DECL hmR0SvmExitReadDRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pS
     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitDRxRead);
 
-    /* We should -not- get this VM-exit if the guest's debug registers were active. */
+    /* We should -not- get this #VMEXIT if the guest's debug registers were active. */
     if (pSvmTransient->fWasGuestDebugStateActive)
     {
         AssertMsgFailed(("hmR0SvmHandleExit: Unexpected exit %#RX32\n", (uint32_t)pSvmTransient->u64ExitCode));
@@ -4363,13 +4679,13 @@ HMSVM_EXIT_DECL hmR0SvmExitReadDRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pS
 
         /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */
         VMMRZCallRing3Disable(pVCpu);
-        HM_DISABLE_PREEMPT_IF_NEEDED();
+        HM_DISABLE_PREEMPT();
 
         /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */
         CPUMR0LoadGuestDebugState(pVCpu, false /* include DR6 */);
         Assert(CPUMIsGuestDebugStateActive(pVCpu) || HC_ARCH_BITS == 32);
 
-        HM_RESTORE_PREEMPT_IF_NEEDED();
+        HM_RESTORE_PREEMPT();
         VMMRZCallRing3Enable(pVCpu);
 
         STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxContextSwitch);
@@ -4410,6 +4726,27 @@ HMSVM_EXIT_DECL hmR0SvmExitWriteDRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT p
 
 
 /**
+ * #VMEXIT handler for XCRx write (SVM_EXIT_XSETBV). Conditional #VMEXIT.
+ */
+HMSVM_EXIT_DECL hmR0SvmExitXsetbv(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
+{
+    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
+
+    /** @todo decode assists... */
+    VBOXSTRICTRC rcStrict = IEMExecOne(pVCpu);
+    if (rcStrict == VINF_IEM_RAISED_XCPT)
+        HMCPU_CF_SET(pVCpu, HM_CHANGED_ALL_GUEST);
+
+    pVCpu->hm.s.fLoadSaveGuestXcr0 = (pCtx->cr4 & X86_CR4_OSXSAVE) && pCtx->aXcr[0] != ASMGetXcr0();
+    Log4(("hmR0SvmExitXsetbv: New XCR0=%#RX64 fLoadSaveGuestXcr0=%d (cr4=%RX64) rcStrict=%Rrc\n",
+          pCtx->aXcr[0], pVCpu->hm.s.fLoadSaveGuestXcr0, pCtx->cr4, VBOXSTRICTRC_VAL(rcStrict)));
+
+    HMSVM_CHECK_SINGLE_STEP(pVCpu, rcStrict);
+    return VBOXSTRICTRC_TODO(rcStrict);
+}
+
+
+/**
  * #VMEXIT handler for I/O instructions (SVM_EXIT_IOIO). Conditional #VMEXIT.
  */
 HMSVM_EXIT_DECL hmR0SvmExitIOInstr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
@@ -4516,7 +4853,7 @@ HMSVM_EXIT_DECL hmR0SvmExitIOInstr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pS
         {
             /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */
             VMMRZCallRing3Disable(pVCpu);
-            HM_DISABLE_PREEMPT_IF_NEEDED();
+            HM_DISABLE_PREEMPT();
 
             STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxIoCheck);
             CPUMR0DebugStateMaybeSaveGuest(pVCpu, false /*fDr6*/);
@@ -4535,7 +4872,7 @@ HMSVM_EXIT_DECL hmR0SvmExitIOInstr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pS
                      && (rcStrict == VINF_SUCCESS || rcStrict2 < rcStrict))
                 rcStrict = rcStrict2;
 
-            HM_RESTORE_PREEMPT_IF_NEEDED();
+            HM_RESTORE_PREEMPT();
             VMMRZCallRing3Enable(pVCpu);
         }
 
@@ -4585,7 +4922,7 @@ HMSVM_EXIT_DECL hmR0SvmExitNestedPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT p
 
 #ifdef VBOX_HM_WITH_GUEST_PATCHING
     /* TPR patching for 32-bit guests, using the reserved bit in the page tables for MMIO regions.  */
-    if (   pVM->hm.s.fTRPPatchingAllowed
+    if (   pVM->hm.s.fTprPatchingAllowed
         && (GCPhysFaultAddr & PAGE_OFFSET_MASK) == 0x80                                                  /* TPR offset. */
         && (   !(u32ErrCode & X86_TRAP_PF_P)                                                             /* Not present */
             || (u32ErrCode & (X86_TRAP_PF_P | X86_TRAP_PF_RSVD)) == (X86_TRAP_PF_P | X86_TRAP_PF_RSVD))  /* MMIO page. */
@@ -4676,14 +5013,14 @@ HMSVM_EXIT_DECL hmR0SvmExitVIntr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvm
     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
 
     PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
-    pVmcb->ctrl.IntCtrl.n.u1VIrqValid  = 0;  /* No virtual interrupts pending, we'll inject the current one before reentry. */
+    pVmcb->ctrl.IntCtrl.n.u1VIrqValid  = 0;  /* No virtual interrupts pending, we'll inject the current one/NMI before reentry. */
     pVmcb->ctrl.IntCtrl.n.u8VIrqVector = 0;
 
-    /* Indicate that we no longer need to VM-exit when the guest is ready to receive interrupts, it is now ready. */
+    /* Indicate that we no longer need to #VMEXIT when the guest is ready to receive interrupts/NMIs, it is now ready. */
     pVmcb->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_VINTR;
     pVmcb->ctrl.u64VmcbCleanBits &= ~(HMSVM_VMCB_CLEAN_INTERCEPTS | HMSVM_VMCB_CLEAN_TPR);
 
-    /* Deliver the pending interrupt via hmR0SvmPreRunGuest()->hmR0SvmInjectEventVmcb() and resume guest execution. */
+    /* Deliver the pending interrupt/NMI via hmR0SvmEvaluatePendingEvent() and resume guest execution. */
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitIntWindow);
     return VINF_SUCCESS;
 }
@@ -4703,22 +5040,15 @@ HMSVM_EXIT_DECL hmR0SvmExitTaskSwitch(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT
     /* Check if this task-switch occurred while delivery an event through the guest IDT. */
     PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
     if (   !(pVmcb->ctrl.u64ExitInfo2 & (SVM_EXIT2_TASK_SWITCH_IRET | SVM_EXIT2_TASK_SWITCH_JMP))
-        && pVCpu->hm.s.Event.fPending)
+        && pVCpu->hm.s.Event.fPending)  /** @todo fPending cannot be 'true', see hmR0SvmInjectPendingEvent(). See @bugref{7362}.*/
     {
         /*
          * AMD-V does not provide us with the original exception but we have it in u64IntInfo since we
-         * injected the event during VM-entry. Software interrupts and exceptions will be regenerated
-         * when the recompiler restarts the instruction.
+         * injected the event during VM-entry.
          */
-        SVMEVENT Event;
-        Event.u = pVCpu->hm.s.Event.u64IntInfo;
-        if (   Event.n.u3Type == SVM_EVENT_EXCEPTION
-            || Event.n.u3Type == SVM_EVENT_SOFTWARE_INT)
-        {
-            pVCpu->hm.s.Event.fPending = false;
-        }
-        else
-            Log4(("hmR0SvmExitTaskSwitch: TS occurred during event delivery. Kept pending u8Vector=%#x\n", Event.n.u8Vector));
+        Log4(("hmR0SvmExitTaskSwitch: TS occurred during event delivery.\n"));
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitTaskSwitch);
+        return VINF_EM_RAW_INJECT_TRPM_EVENT;
     }
 
     /** @todo Emulate task switch someday, currently just going back to ring-3 for
@@ -4734,12 +5064,50 @@ HMSVM_EXIT_DECL hmR0SvmExitTaskSwitch(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT
 HMSVM_EXIT_DECL hmR0SvmExitVmmCall(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
 {
     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
+    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitVmcall);
 
+    /* First check if this is a patched VMMCALL for mov TPR */
     int rc = hmR0SvmEmulateMovTpr(pVCpu->CTX_SUFF(pVM), pVCpu, pCtx);
-    if (RT_LIKELY(rc == VINF_SUCCESS))
+    if (rc == VINF_SUCCESS)
+    {
         HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
-    else
-        hmR0SvmSetPendingXcptUD(pVCpu);
+        return VINF_SUCCESS;
+    }
+    else if (rc == VERR_NOT_FOUND)
+    {
+        if (pVCpu->hm.s.fHypercallsEnabled)
+        {
+            rc = GIMHypercall(pVCpu, pCtx);
+            if (RT_SUCCESS(rc))
+            {
+                /* If the hypercall changes anything other than guest general-purpose registers,
+                   we would need to reload the guest changed bits here before VM-reentry. */
+                hmR0SvmUpdateRip(pVCpu, pCtx, 3);
+                return VINF_SUCCESS;
+            }
+        }
+    }
+
+    hmR0SvmSetPendingXcptUD(pVCpu);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * #VMEXIT handler for IRET (SVM_EXIT_IRET). Conditional #VMEXIT.
+ */
+HMSVM_EXIT_DECL hmR0SvmExitIret(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
+{
+    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
+
+    /* Clear NMI blocking. */
+    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
+
+    /* Indicate that we no longer need to #VMEXIT when the guest is ready to receive NMIs, it is now ready. */
+    PSVMVMCB pVmcb = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
+    hmR0SvmClearIretIntercept(pVmcb);
+
+    /* Deliver the pending NMI via hmR0SvmEvaluatePendingEvent() and resume guest execution. */
     return VINF_SUCCESS;
 }
 
@@ -4764,7 +5132,7 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
     if (pVM->hm.s.fNestedPaging)
     {
         pVCpu->hm.s.Event.fPending = false;     /* In case it's a contributory or vectoring #PF. */
-        if (!pSvmTransient->fVectoringPF)
+        if (!pSvmTransient->fVectoringDoublePF)
         {
             /* A genuine guest #PF, reflect it to the guest. */
             hmR0SvmSetPendingXcptPF(pVCpu, pCtx, u32ErrCode, uFaultAddress);
@@ -4786,7 +5154,7 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
 
 #ifdef VBOX_HM_WITH_GUEST_PATCHING
     /* Shortcut for APIC TPR reads and writes; only applicable to 32-bit guests. */
-    if (   pVM->hm.s.fTRPPatchingAllowed
+    if (   pVM->hm.s.fTprPatchingAllowed
         && (uFaultAddress & 0xfff) == 0x80  /* TPR offset. */
         && !(u32ErrCode & X86_TRAP_PF_P)    /* Not present. */
         && !CPUMIsGuestInLongModeEx(pCtx)
@@ -4814,6 +5182,14 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
     Log4(("#PF: uFaultAddress=%#RX64 CS:RIP=%#04x:%#RX64 u32ErrCode %#RX32 cr3=%#RX64\n", uFaultAddress, pCtx->cs.Sel,
           pCtx->rip, u32ErrCode, pCtx->cr3));
 
+    /* If it's a vectoring #PF, emulate injecting the original event injection as PGMTrap0eHandler() is incapable
+       of differentiating between instruction emulation and event injection that caused a #PF. See @bugref{6607}. */
+    if (pSvmTransient->fVectoringPF)
+    {
+        Assert(pVCpu->hm.s.Event.fPending);
+        return VINF_EM_RAW_INJECT_TRPM_EVENT;
+    }
+
     TRPMAssertXcptPF(pVCpu, uFaultAddress, u32ErrCode);
     int rc = PGMTrap0eHandler(pVCpu, u32ErrCode, CPUMCTX2CORE(pCtx), (RTGCPTR)uFaultAddress);
 
@@ -4831,7 +5207,7 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
     {
         pVCpu->hm.s.Event.fPending = false;     /* In case it's a contributory or vectoring #PF. */
 
-        if (!pSvmTransient->fVectoringPF)
+        if (!pSvmTransient->fVectoringDoublePF)
         {
             /* It's a guest page fault and needs to be reflected to the guest. */
             u32ErrCode = TRPMGetErrorCode(pVCpu);        /* The error code might have been changed. */
@@ -4868,7 +5244,7 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptNM(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
 
     /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */
     VMMRZCallRing3Disable(pVCpu);
-    HM_DISABLE_PREEMPT_IF_NEEDED();
+    HM_DISABLE_PREEMPT();
 
     int rc;
     /* If the guest FPU was active at the time of the #NM exit, then it's a guest fault. */
@@ -4886,7 +5262,7 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptNM(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
         Assert(rc == VINF_EM_RAW_GUEST_TRAP || (rc == VINF_SUCCESS && CPUMIsGuestFPUStateActive(pVCpu)));
     }
 
-    HM_RESTORE_PREEMPT_IF_NEEDED();
+    HM_RESTORE_PREEMPT();
     VMMRZCallRing3Enable(pVCpu);
 
     if (rc == VINF_SUCCESS)
@@ -4894,6 +5270,7 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptNM(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
         /* Guest FPU state was activated, we'll want to change CR0 FPU intercepts before the next VM-reentry. */
         HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR0);
         STAM_COUNTER_INC(&pVCpu->hm.s.StatExitShadowNM);
+        pVCpu->hm.s.fPreloadGuestFpu = true;
     }
     else
     {
@@ -4907,6 +5284,26 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptNM(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
 
 
 /**
+ * #VMEXIT handler for undefined opcode (SVM_EXIT_EXCEPTION_6).
+ * Conditional #VMEXIT.
+ */
+HMSVM_EXIT_DECL hmR0SvmExitXcptUD(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
+{
+    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
+
+    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
+
+    if (pVCpu->hm.s.fGIMTrapXcptUD)
+        GIMXcptUD(pVCpu, pCtx, NULL /* pDis */);
+    else
+        hmR0SvmSetPendingXcptUD(pVCpu);
+
+    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestUD);
+    return VINF_SUCCESS;
+}
+
+
+/**
  * #VMEXIT handler for math-fault exceptions (SVM_EXIT_EXCEPTION_10).
  * Conditional #VMEXIT.
  */
@@ -4920,14 +5317,14 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptMF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
 
     if (!(pCtx->cr0 & X86_CR0_NE))
     {
-        PVM         pVM  = pVCpu->CTX_SUFF(pVM);
-        PDISSTATE   pDis = &pVCpu->hm.s.DisState;
-        unsigned    cbOp;
+        PVM       pVM  = pVCpu->CTX_SUFF(pVM);
+        PDISSTATE pDis = &pVCpu->hm.s.DisState;
+        unsigned  cbOp;
         int rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbOp);
         if (RT_SUCCESS(rc))
         {
-            /* Convert a #MF into a FERR -> IRQ 13. */
-            rc = PDMIsaSetIrq(pVCpu->CTX_SUFF(pVM), 13, 1, 0 /*uTagSrc*/);
+            /* Convert a #MF into a FERR -> IRQ 13. See @bugref{6117}. */
+            rc = PDMIsaSetIrq(pVCpu->CTX_SUFF(pVM), 13, 1, 0 /* uTagSrc */);
             if (RT_SUCCESS(rc))
                 pCtx->rip += cbOp;
         }
@@ -4953,13 +5350,6 @@ HMSVM_EXIT_DECL hmR0SvmExitXcptDB(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSv
 
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestDB);
 
-    /* If we set the trap flag above, we have to clear it. */
-    if (pVCpu->hm.s.fClearTrapFlag)
-    {
-        pVCpu->hm.s.fClearTrapFlag = false;
-        pCtx->eflags.Bits.u1TF = 0;
-    }
-
     /* This can be a fault-type #DB (instruction breakpoint) or a trap-type #DB (data breakpoint). However, for both cases
        DR6 and DR7 are updated to what the exception handler expects. See AMD spec. 15.12.2 "#DB (Debug)". */
     PSVMVMCB    pVmcb   = (PSVMVMCB)pVCpu->hm.s.svm.pvVmcb;
diff --git a/src/VBox/VMM/VMMR0/HMVMXR0.cpp b/src/VBox/VMM/VMMR0/HMVMXR0.cpp
index ca5487b..80a2bd3 100644
--- a/src/VBox/VMM/VMMR0/HMVMXR0.cpp
+++ b/src/VBox/VMM/VMMR0/HMVMXR0.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2012-2013 Oracle Corporation
+ * Copyright (C) 2012-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -19,30 +19,35 @@
 *   Header Files                                                               *
 *******************************************************************************/
 #define LOG_GROUP LOG_GROUP_HM
+#include <iprt/x86.h>
 #include <iprt/asm-amd64-x86.h>
 #include <iprt/thread.h>
-#include <iprt/string.h>
 
-#include "HMInternal.h"
-#include <VBox/vmm/vm.h>
-#include "HMVMXR0.h"
 #include <VBox/vmm/pdmapi.h>
 #include <VBox/vmm/dbgf.h>
 #include <VBox/vmm/iem.h>
 #include <VBox/vmm/iom.h>
 #include <VBox/vmm/selm.h>
 #include <VBox/vmm/tm.h>
+#include <VBox/vmm/gim.h>
 #ifdef VBOX_WITH_REM
 # include <VBox/vmm/rem.h>
 #endif
+#include "HMInternal.h"
+#include <VBox/vmm/vm.h>
+#include "HMVMXR0.h"
+#include "dtrace/VBoxVMM.h"
+
 #ifdef DEBUG_ramshankar
-#define HMVMX_SAVE_FULL_GUEST_STATE
-#define HMVMX_SYNC_FULL_GUEST_STATE
-#define HMVMX_ALWAYS_CHECK_GUEST_STATE
-#define HMVMX_ALWAYS_TRAP_ALL_XCPTS
-#define HMVMX_ALWAYS_TRAP_PF
-#define HMVMX_ALWAYS_SWAP_FPU_STATE
-#define HMVMX_ALWAYS_SWAP_EFER
+# define HMVMX_ALWAYS_SAVE_GUEST_RFLAGS
+# define HMVMX_ALWAYS_SAVE_FULL_GUEST_STATE
+# define HMVMX_ALWAYS_SYNC_FULL_GUEST_STATE
+# define HMVMX_ALWAYS_CHECK_GUEST_STATE
+# define HMVMX_ALWAYS_TRAP_ALL_XCPTS
+# define HMVMX_ALWAYS_TRAP_PF
+# define HMVMX_ALWAYS_SWAP_FPU_STATE
+# define HMVMX_ALWAYS_FLUSH_TLB
+# define HMVMX_ALWAYS_SWAP_EFER
 #endif
 
 
@@ -84,15 +89,14 @@ typedef RTHCUINTREG                   HMVMXHCUINTREG;
 #define HMVMX_UPDATED_GUEST_TR                    RT_BIT(9)
 #define HMVMX_UPDATED_GUEST_SEGMENT_REGS          RT_BIT(10)
 #define HMVMX_UPDATED_GUEST_DEBUG                 RT_BIT(11)
-#define HMVMX_UPDATED_GUEST_FS_BASE_MSR           RT_BIT(12)
-#define HMVMX_UPDATED_GUEST_GS_BASE_MSR           RT_BIT(13)
-#define HMVMX_UPDATED_GUEST_SYSENTER_CS_MSR       RT_BIT(14)
-#define HMVMX_UPDATED_GUEST_SYSENTER_EIP_MSR      RT_BIT(15)
-#define HMVMX_UPDATED_GUEST_SYSENTER_ESP_MSR      RT_BIT(16)
-#define HMVMX_UPDATED_GUEST_AUTO_LOAD_STORE_MSRS  RT_BIT(17)
-#define HMVMX_UPDATED_GUEST_ACTIVITY_STATE        RT_BIT(18)
-#define HMVMX_UPDATED_GUEST_INTR_STATE            RT_BIT(19)
-#define HMVMX_UPDATED_GUEST_APIC_STATE            RT_BIT(20)
+#define HMVMX_UPDATED_GUEST_SYSENTER_CS_MSR       RT_BIT(12)
+#define HMVMX_UPDATED_GUEST_SYSENTER_EIP_MSR      RT_BIT(13)
+#define HMVMX_UPDATED_GUEST_SYSENTER_ESP_MSR      RT_BIT(14)
+#define HMVMX_UPDATED_GUEST_AUTO_LOAD_STORE_MSRS  RT_BIT(15)
+#define HMVMX_UPDATED_GUEST_LAZY_MSRS             RT_BIT(16)
+#define HMVMX_UPDATED_GUEST_ACTIVITY_STATE        RT_BIT(17)
+#define HMVMX_UPDATED_GUEST_INTR_STATE            RT_BIT(18)
+#define HMVMX_UPDATED_GUEST_APIC_STATE            RT_BIT(19)
 #define HMVMX_UPDATED_GUEST_ALL                   (  HMVMX_UPDATED_GUEST_RIP                   \
                                                    | HMVMX_UPDATED_GUEST_RSP                   \
                                                    | HMVMX_UPDATED_GUEST_RFLAGS                \
@@ -105,12 +109,11 @@ typedef RTHCUINTREG                   HMVMXHCUINTREG;
                                                    | HMVMX_UPDATED_GUEST_TR                    \
                                                    | HMVMX_UPDATED_GUEST_SEGMENT_REGS          \
                                                    | HMVMX_UPDATED_GUEST_DEBUG                 \
-                                                   | HMVMX_UPDATED_GUEST_FS_BASE_MSR           \
-                                                   | HMVMX_UPDATED_GUEST_GS_BASE_MSR           \
                                                    | HMVMX_UPDATED_GUEST_SYSENTER_CS_MSR       \
                                                    | HMVMX_UPDATED_GUEST_SYSENTER_EIP_MSR      \
                                                    | HMVMX_UPDATED_GUEST_SYSENTER_ESP_MSR      \
                                                    | HMVMX_UPDATED_GUEST_AUTO_LOAD_STORE_MSRS  \
+                                                   | HMVMX_UPDATED_GUEST_LAZY_MSRS             \
                                                    | HMVMX_UPDATED_GUEST_ACTIVITY_STATE        \
                                                    | HMVMX_UPDATED_GUEST_INTR_STATE            \
                                                    | HMVMX_UPDATED_GUEST_APIC_STATE)
@@ -180,12 +183,12 @@ typedef RTHCUINTREG                   HMVMXHCUINTREG;
 #endif
 
 /** Assert that preemption is disabled or covered by thread-context hooks. */
-#define HMVMX_ASSERT_PREEMPT_SAFE()       Assert(   VMMR0ThreadCtxHooksAreRegistered(pVCpu)   \
+#define HMVMX_ASSERT_PREEMPT_SAFE()       Assert(   VMMR0ThreadCtxHookIsEnabled(pVCpu)   \
                                                  || !RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
 /** Assert that we haven't migrated CPUs when thread-context hooks are not
  *  used. */
-#define HMVMX_ASSERT_CPU_SAFE()           AssertMsg(   VMMR0ThreadCtxHooksAreRegistered(pVCpu) \
+#define HMVMX_ASSERT_CPU_SAFE()           AssertMsg(   VMMR0ThreadCtxHookIsEnabled(pVCpu) \
                                                     || pVCpu->hm.s.idEnteredCpu == RTMpCpuId(), \
                                                     ("Illegal migration! Entered on CPU %u Current %u\n", \
                                                     pVCpu->hm.s.idEnteredCpu, RTMpCpuId())); \
@@ -210,12 +213,10 @@ typedef RTHCUINTREG                   HMVMXHCUINTREG;
 typedef struct VMXTRANSIENT
 {
     /** The host's rflags/eflags. */
-    RTCCUINTREG     uEflags;
+    RTCCUINTREG     fEFlags;
 #if HC_ARCH_BITS == 32
     uint32_t        u32Alignment0;
 #endif
-    /** The guest's LSTAR MSR value used for TPR patching for 32-bit guests. */
-    uint64_t        u64LStarMsr;
     /** The guest's TPR value used for TPR shadowing. */
     uint8_t         u8GuestTpr;
     /** Alignment. */
@@ -227,7 +228,7 @@ typedef struct VMXTRANSIENT
     uint16_t        u16Alignment0;
     /** The VM-exit interruption error code. */
     uint32_t        uExitIntErrorCode;
-    /** The VM-exit exit qualification. */
+    /** The VM-exit exit code qualification. */
     uint64_t        uExitQualification;
 
     /** The VM-exit interruption-information field. */
@@ -281,6 +282,9 @@ typedef struct VMXTRANSIENT
     bool            fUpdateTscOffsettingAndPreemptTimer;
     /** Whether the VM-exit was caused by a page-fault during delivery of a
      *  contributory exception or a page-fault. */
+    bool            fVectoringDoublePF;
+    /** Whether the VM-exit was caused by a page-fault during delivery of an
+     *  external interrupt or NMI. */
     bool            fVectoringPF;
 } VMXTRANSIENT;
 AssertCompileMemberAlignment(VMXTRANSIENT, uExitReason,             sizeof(uint64_t));
@@ -302,6 +306,8 @@ typedef enum VMXMSREXITREAD
     /** Reading this MSR does not cause a VM-exit. */
     VMXMSREXIT_PASSTHRU_READ
 } VMXMSREXITREAD;
+/** Pointer to MSR-bitmap read permissions. */
+typedef VMXMSREXITREAD* PVMXMSREXITREAD;
 
 /**
  * MSR-bitmap write permissions.
@@ -313,6 +319,9 @@ typedef enum VMXMSREXITWRITE
     /** Writing to this MSR does not cause a VM-exit. */
     VMXMSREXIT_PASSTHRU_WRITE
 } VMXMSREXITWRITE;
+/** Pointer to MSR-bitmap write permissions. */
+typedef VMXMSREXITWRITE* PVMXMSREXITWRITE;
+
 
 /**
  * VMX VM-exit handler.
@@ -336,11 +345,11 @@ typedef FNVMXEXITHANDLER *PFNVMXEXITHANDLER;
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-static void               hmR0VmxFlushEpt(PVMCPU pVCpu, VMX_FLUSH_EPT enmFlush);
-static void               hmR0VmxFlushVpid(PVM pVM, PVMCPU pVCpu, VMX_FLUSH_VPID enmFlush, RTGCPTR GCPtr);
-static void               hmR0VmxClearEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx);
+static void               hmR0VmxFlushEpt(PVMCPU pVCpu, VMXFLUSHEPT enmFlush);
+static void               hmR0VmxFlushVpid(PVM pVM, PVMCPU pVCpu, VMXFLUSHVPID enmFlush, RTGCPTR GCPtr);
 static int                hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64IntInfo, uint32_t cbInstr,
-                                                 uint32_t u32ErrCode, RTGCUINTREG GCPtrFaultAddress, uint32_t *puIntState);
+                                                 uint32_t u32ErrCode, RTGCUINTREG GCPtrFaultAddress,
+                                                 bool fStepping, uint32_t *puIntState);
 #if HC_ARCH_BITS == 32 && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
 static int                hmR0VmxInitVmcsReadCache(PVM pVM, PVMCPU pVCpu);
 #endif
@@ -350,6 +359,8 @@ DECLINLINE(int)           hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PV
 #else
 # define HMVMX_EXIT_DECL  static DECLCALLBACK(int)
 #endif
+DECLINLINE(VBOXSTRICTRC)  hmR0VmxHandleExitStep(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient,
+                                                uint32_t uExitReason, uint16_t uCsStart, uint64_t uRipStart);
 
 /** @name VM-exit handlers.
  * @{
@@ -370,6 +381,7 @@ static FNVMXEXITHANDLER hmR0VmxExitHlt;
 static FNVMXEXITHANDLER hmR0VmxExitInvd;
 static FNVMXEXITHANDLER hmR0VmxExitInvlpg;
 static FNVMXEXITHANDLER hmR0VmxExitRdpmc;
+static FNVMXEXITHANDLER hmR0VmxExitVmcall;
 static FNVMXEXITHANDLER hmR0VmxExitRdtsc;
 static FNVMXEXITHANDLER hmR0VmxExitRsm;
 static FNVMXEXITHANDLER hmR0VmxExitSetPendingXcptUD;
@@ -406,7 +418,9 @@ static int          hmR0VmxExitXcptMF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRAN
 static int          hmR0VmxExitXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
 static int          hmR0VmxExitXcptBP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
 static int          hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
+#ifdef HMVMX_ALWAYS_TRAP_ALL_XCPTS
 static int          hmR0VmxExitXcptGeneric(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
+#endif
 static uint32_t     hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
 
 /*******************************************************************************
@@ -437,7 +451,7 @@ static const PFNVMXEXITHANDLER g_apfnVMExitHandlers[VMX_EXIT_MAX + 1] =
  /* 15  VMX_EXIT_RDPMC                   */  hmR0VmxExitRdpmc,
  /* 16  VMX_EXIT_RDTSC                   */  hmR0VmxExitRdtsc,
  /* 17  VMX_EXIT_RSM                     */  hmR0VmxExitRsm,
- /* 18  VMX_EXIT_VMCALL                  */  hmR0VmxExitSetPendingXcptUD,
+ /* 18  VMX_EXIT_VMCALL                  */  hmR0VmxExitVmcall,
  /* 19  VMX_EXIT_VMCLEAR                 */  hmR0VmxExitSetPendingXcptUD,
  /* 20  VMX_EXIT_VMLAUNCH                */  hmR0VmxExitSetPendingXcptUD,
  /* 21  VMX_EXIT_VMPTRLD                 */  hmR0VmxExitSetPendingXcptUD,
@@ -478,7 +492,12 @@ static const PFNVMXEXITHANDLER g_apfnVMExitHandlers[VMX_EXIT_MAX + 1] =
  /* 56  UNDEFINED                        */  hmR0VmxExitErrUndefined,
  /* 57  VMX_EXIT_RDRAND                  */  hmR0VmxExitRdrand,
  /* 58  VMX_EXIT_INVPCID                 */  hmR0VmxExitInvpcid,
- /* 59  VMX_EXIT_VMFUNC                  */  hmR0VmxExitSetPendingXcptUD
+ /* 59  VMX_EXIT_VMFUNC                  */  hmR0VmxExitSetPendingXcptUD,
+ /* 60  VMX_EXIT_RESERVED_60             */  hmR0VmxExitErrUndefined,
+ /* 61  VMX_EXIT_RDSEED                  */  hmR0VmxExitErrUndefined, /* only spurious exits, so undefined */
+ /* 62  VMX_EXIT_RESERVED_62             */  hmR0VmxExitErrUndefined,
+ /* 63  VMX_EXIT_XSAVES                  */  hmR0VmxExitSetPendingXcptUD,
+ /* 64  VMX_EXIT_XRSTORS                 */  hmR0VmxExitSetPendingXcptUD,
 };
 #endif /* HMVMX_USE_FUNCTION_TABLE */
 
@@ -492,8 +511,8 @@ static const char * const g_apszVmxInstrErrors[HMVMX_INSTR_ERROR_MAX + 1] =
     /*  4 */ "VMLAUNCH with non-clear VMCS.",
     /*  5 */ "VMRESUME with non-launched VMCS.",
     /*  6 */ "VMRESUME after VMXOFF",
-    /*  7 */ "VM entry with invalid control fields.",
-    /*  8 */ "VM entry with invalid host state fields.",
+    /*  7 */ "VM-entry with invalid control fields.",
+    /*  8 */ "VM-entry with invalid host state fields.",
     /*  9 */ "VMPTRLD with invalid physical address.",
     /* 10 */ "VMPTRLD with VMXON pointer.",
     /* 11 */ "VMPTRLD with incorrect revision identifier.",
@@ -501,17 +520,17 @@ static const char * const g_apszVmxInstrErrors[HMVMX_INSTR_ERROR_MAX + 1] =
     /* 13 */ "VMWRITE to read-only VMCS component.",
     /* 14 */ "(Not Used)",
     /* 15 */ "VMXON executed in VMX root operation.",
-    /* 16 */ "VM entry with invalid executive-VMCS pointer.",
-    /* 17 */ "VM entry with non-launched executing VMCS.",
-    /* 18 */ "VM entry with executive-VMCS pointer not VMXON pointer.",
+    /* 16 */ "VM-entry with invalid executive-VMCS pointer.",
+    /* 17 */ "VM-entry with non-launched executing VMCS.",
+    /* 18 */ "VM-entry with executive-VMCS pointer not VMXON pointer.",
     /* 19 */ "VMCALL with non-clear VMCS.",
     /* 20 */ "VMCALL with invalid VM-exit control fields.",
     /* 21 */ "(Not Used)",
     /* 22 */ "VMCALL with incorrect MSEG revision identifier.",
     /* 23 */ "VMXOFF under dual monitor treatment of SMIs and SMM.",
     /* 24 */ "VMCALL with invalid SMM-monitor features.",
-    /* 25 */ "VM entry with invalid VM-execution control fields in executive VMCS.",
-    /* 26 */ "VM entry with events blocked by MOV SS.",
+    /* 25 */ "VM-entry with invalid VM-execution control fields in executive VMCS.",
+    /* 26 */ "VM-entry with events blocked by MOV SS.",
     /* 27 */ "(Not Used)",
     /* 28 */ "Invalid operand to INVEPT/INVVPID."
 };
@@ -582,12 +601,11 @@ DECLINLINE(int) hmR0VmxReadEntryXcptErrorCodeVmcs(PVMXTRANSIENT pVmxTransient)
  * the VMX transient structure.
  *
  * @returns VBox status code.
- * @param   pVCpu           Pointer to the VMCPU.
  * @param   pVmxTransient   Pointer to the VMX transient structure.
  *
  * @remarks No-long-jump zone!!!
  */
-DECLINLINE(int) hmR0VmxReadEntryInstrLenVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
+DECLINLINE(int) hmR0VmxReadEntryInstrLenVmcs(PVMXTRANSIENT pVmxTransient)
 {
     int rc = VMXReadVmcs32(VMX_VMCS32_CTRL_ENTRY_INSTR_LENGTH, &pVmxTransient->cbEntryInstr);
     AssertRCReturn(rc, rc);
@@ -600,10 +618,9 @@ DECLINLINE(int) hmR0VmxReadEntryInstrLenVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTra
  * transient structure.
  *
  * @returns VBox status code.
- * @param   pVCpu           Pointer to the VMCPU.
  * @param   pVmxTransient   Pointer to the VMX transient structure.
  */
-DECLINLINE(int) hmR0VmxReadExitIntInfoVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
+DECLINLINE(int) hmR0VmxReadExitIntInfoVmcs(PVMXTRANSIENT pVmxTransient)
 {
     if (!(pVmxTransient->fVmcsFieldsRead & HMVMX_UPDATED_TRANSIENT_EXIT_INTERRUPTION_INFO))
     {
@@ -620,10 +637,9 @@ DECLINLINE(int) hmR0VmxReadExitIntInfoVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTrans
  * transient structure.
  *
  * @returns VBox status code.
- * @param   pVCpu           Pointer to the VMCPU.
  * @param   pVmxTransient   Pointer to the VMX transient structure.
  */
-DECLINLINE(int) hmR0VmxReadExitIntErrorCodeVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
+DECLINLINE(int) hmR0VmxReadExitIntErrorCodeVmcs(PVMXTRANSIENT pVmxTransient)
 {
     if (!(pVmxTransient->fVmcsFieldsRead & HMVMX_UPDATED_TRANSIENT_EXIT_INTERRUPTION_ERROR_CODE))
     {
@@ -643,7 +659,7 @@ DECLINLINE(int) hmR0VmxReadExitIntErrorCodeVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmx
  * @param   pVCpu           Pointer to the VMCPU.
  * @param   pVmxTransient   Pointer to the VMX transient structure.
  */
-DECLINLINE(int) hmR0VmxReadExitInstrLenVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
+DECLINLINE(int) hmR0VmxReadExitInstrLenVmcs(PVMXTRANSIENT pVmxTransient)
 {
     if (!(pVmxTransient->fVmcsFieldsRead & HMVMX_UPDATED_TRANSIENT_EXIT_INSTR_LEN))
     {
@@ -660,10 +676,9 @@ DECLINLINE(int) hmR0VmxReadExitInstrLenVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTran
  * the VMX transient structure.
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context per CPU structure.
  * @param   pVmxTransient   Pointer to the VMX transient structure.
  */
-DECLINLINE(int) hmR0VmxReadExitInstrInfoVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
+DECLINLINE(int) hmR0VmxReadExitInstrInfoVmcs(PVMXTRANSIENT pVmxTransient)
 {
     if (!(pVmxTransient->fVmcsFieldsRead & HMVMX_UPDATED_TRANSIENT_EXIT_INSTR_INFO))
     {
@@ -676,17 +691,19 @@ DECLINLINE(int) hmR0VmxReadExitInstrInfoVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTra
 
 
 /**
- * Reads the exit qualification from the VMCS into the VMX transient structure.
+ * Reads the exit code qualification from the VMCS into the VMX transient
+ * structure.
  *
  * @returns VBox status code.
- * @param   pVCpu           Pointer to the VMCPU.
+ * @param   pVCpu           Pointer to the VMCPU (required for the VMCS cache
+ *                          case).
  * @param   pVmxTransient   Pointer to the VMX transient structure.
  */
 DECLINLINE(int) hmR0VmxReadExitQualificationVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
 {
     if (!(pVmxTransient->fVmcsFieldsRead & HMVMX_UPDATED_TRANSIENT_EXIT_QUALIFICATION))
     {
-        int rc = VMXReadVmcsGstN(VMX_VMCS_RO_EXIT_QUALIFICATION, &pVmxTransient->uExitQualification);
+        int rc = VMXReadVmcsGstN(VMX_VMCS_RO_EXIT_QUALIFICATION, &pVmxTransient->uExitQualification); NOREF(pVCpu);
         AssertRCReturn(rc, rc);
         pVmxTransient->fVmcsFieldsRead |= HMVMX_UPDATED_TRANSIENT_EXIT_QUALIFICATION;
     }
@@ -745,8 +762,9 @@ DECLINLINE(int) hmR0VmxReadIdtVectoringErrorCodeVmcs(PVMXTRANSIENT pVmxTransient
  */
 static int hmR0VmxEnterRootMode(PVM pVM, RTHCPHYS HCPhysCpuPage, void *pvCpuPage)
 {
-    AssertReturn(HCPhysCpuPage != 0 && HCPhysCpuPage != NIL_RTHCPHYS, VERR_INVALID_PARAMETER);
-    AssertReturn(pvCpuPage, VERR_INVALID_PARAMETER);
+    Assert(HCPhysCpuPage && HCPhysCpuPage != NIL_RTHCPHYS);
+    Assert(RT_ALIGN_T(HCPhysCpuPage, _4K, RTHCPHYS) == HCPhysCpuPage);
+    Assert(pvCpuPage);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
     if (pVM)
@@ -756,7 +774,7 @@ static int hmR0VmxEnterRootMode(PVM pVM, RTHCPHYS HCPhysCpuPage, void *pvCpuPage
     }
 
     /* Paranoid: Disable interrupts as, in theory, interrupt handlers might mess with CR4. */
-    RTCCUINTREG uEflags = ASMIntDisableFlags();
+    RTCCUINTREG fEFlags = ASMIntDisableFlags();
 
     /* Enable the VMX bit in CR4 if necessary. */
     RTCCUINTREG uOldCr4 = SUPR0ChangeCR4(X86_CR4_VMXE, ~0);
@@ -773,7 +791,7 @@ static int hmR0VmxEnterRootMode(PVM pVM, RTHCPHYS HCPhysCpuPage, void *pvCpuPage
     }
 
     /* Restore interrupts. */
-    ASMSetFlags(uEflags);
+    ASMSetFlags(fEFlags);
     return rc;
 }
 
@@ -788,7 +806,7 @@ static int hmR0VmxLeaveRootMode(void)
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
     /* Paranoid: Disable interrupts as, in theory, interrupts handlers might mess with CR4. */
-    RTCCUINTREG uEflags = ASMIntDisableFlags();
+    RTCCUINTREG fEFlags = ASMIntDisableFlags();
 
     /* If we're for some reason not in VMX root mode, then don't leave it. */
     RTCCUINTREG uHostCR4 = ASMGetCR4();
@@ -805,7 +823,7 @@ static int hmR0VmxLeaveRootMode(void)
         rc = VERR_VMX_NOT_IN_VMX_ROOT_MODE;
 
     /* Restore interrupts. */
-    ASMSetFlags(uEflags);
+    ASMSetFlags(fEFlags);
     return rc;
 }
 
@@ -824,7 +842,7 @@ static int hmR0VmxLeaveRootMode(void)
 DECLINLINE(int) hmR0VmxPageAllocZ(PRTR0MEMOBJ pMemObj, PRTR0PTR ppVirt, PRTHCPHYS pHCPhys)
 {
     AssertPtrReturn(pMemObj, VERR_INVALID_PARAMETER);
-    AssertPtrReturn(ppVirt, VERR_INVALID_PARAMETER);
+    AssertPtrReturn(ppVirt,  VERR_INVALID_PARAMETER);
     AssertPtrReturn(pHCPhys, VERR_INVALID_PARAMETER);
 
     int rc = RTR0MemObjAllocCont(pMemObj, PAGE_SIZE, false /* fExecutable */);
@@ -875,10 +893,8 @@ static void hmR0VmxStructsFree(PVM pVM)
         PVMCPU pVCpu = &pVM->aCpus[i];
         AssertPtr(pVCpu);
 
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
         hmR0VmxPageFree(&pVCpu->hm.s.vmx.hMemObjHostMsr, &pVCpu->hm.s.vmx.pvHostMsr, &pVCpu->hm.s.vmx.HCPhysHostMsr);
         hmR0VmxPageFree(&pVCpu->hm.s.vmx.hMemObjGuestMsr, &pVCpu->hm.s.vmx.pvGuestMsr, &pVCpu->hm.s.vmx.HCPhysGuestMsr);
-#endif
 
         if (pVM->hm.s.vmx.Msrs.VmxProcCtls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS)
             hmR0VmxPageFree(&pVCpu->hm.s.vmx.hMemObjMsrBitmap, &pVCpu->hm.s.vmx.pvMsrBitmap, &pVCpu->hm.s.vmx.HCPhysMsrBitmap);
@@ -927,10 +943,8 @@ static int hmR0VmxStructsAlloc(PVM pVM)
         VMXLOCAL_INIT_VMCPU_MEMOBJ(Vmcs, pv);
         VMXLOCAL_INIT_VMCPU_MEMOBJ(VirtApic, pb);
         VMXLOCAL_INIT_VMCPU_MEMOBJ(MsrBitmap, pv);
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
         VMXLOCAL_INIT_VMCPU_MEMOBJ(GuestMsr, pv);
         VMXLOCAL_INIT_VMCPU_MEMOBJ(HostMsr, pv);
-#endif
     }
 #undef VMXLOCAL_INIT_VMCPU_MEMOBJ
 #undef VMXLOCAL_INIT_VM_MEMOBJ
@@ -983,17 +997,22 @@ static int hmR0VmxStructsAlloc(PVM pVM)
                 goto cleanup;
         }
 
-        /* Allocate the MSR-bitmap if supported by the CPU. The MSR-bitmap is for transparent accesses of specific MSRs. */
+        /*
+         * Allocate the MSR-bitmap if supported by the CPU. The MSR-bitmap is for
+         * transparent accesses of specific MSRs.
+         *
+         * If the condition for enabling MSR bitmaps changes here, don't forget to
+         * update HMIsMsrBitmapsAvailable().
+         */
         if (pVM->hm.s.vmx.Msrs.VmxProcCtls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS)
         {
             rc = hmR0VmxPageAllocZ(&pVCpu->hm.s.vmx.hMemObjMsrBitmap, &pVCpu->hm.s.vmx.pvMsrBitmap,
                                    &pVCpu->hm.s.vmx.HCPhysMsrBitmap);
             if (RT_FAILURE(rc))
                 goto cleanup;
-            memset(pVCpu->hm.s.vmx.pvMsrBitmap, 0xff, PAGE_SIZE);
+            ASMMemFill32(pVCpu->hm.s.vmx.pvMsrBitmap, PAGE_SIZE, UINT32_C(0xffffffff));
         }
 
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
         /* Allocate the VM-entry MSR-load and VM-exit MSR-store page for the guest MSRs. */
         rc = hmR0VmxPageAllocZ(&pVCpu->hm.s.vmx.hMemObjGuestMsr, &pVCpu->hm.s.vmx.pvGuestMsr, &pVCpu->hm.s.vmx.HCPhysGuestMsr);
         if (RT_FAILURE(rc))
@@ -1003,7 +1022,6 @@ static int hmR0VmxStructsAlloc(PVM pVM)
         rc = hmR0VmxPageAllocZ(&pVCpu->hm.s.vmx.hMemObjHostMsr, &pVCpu->hm.s.vmx.pvHostMsr, &pVCpu->hm.s.vmx.HCPhysHostMsr);
         if (RT_FAILURE(rc))
             goto cleanup;
-#endif
     }
 
     return VINF_SUCCESS;
@@ -1059,8 +1077,8 @@ VMMR0DECL(void) VMXR0GlobalTerm()
 VMMR0DECL(int) VMXR0EnableCpu(PHMGLOBALCPUINFO pCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage, bool fEnabledByHost,
                               void *pvMsrs)
 {
-    AssertReturn(pCpu, VERR_INVALID_PARAMETER);
-    AssertReturn(pvMsrs, VERR_INVALID_PARAMETER);
+    Assert(pCpu);
+    Assert(pvMsrs);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
     /* Enable VT-x if it's not already enabled by the host. */
@@ -1078,7 +1096,7 @@ VMMR0DECL(int) VMXR0EnableCpu(PHMGLOBALCPUINFO pCpu, PVM pVM, void *pvCpuPage, R
     PVMXMSRS pMsrs = (PVMXMSRS)pvMsrs;
     if (pMsrs->u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVEPT_ALL_CONTEXTS)
     {
-        hmR0VmxFlushEpt(NULL /* pVCpu */, VMX_FLUSH_EPT_ALL_CONTEXTS);
+        hmR0VmxFlushEpt(NULL /* pVCpu */, VMXFLUSHEPT_ALL_CONTEXTS);
         pCpu->fFlushAsidBeforeUse = false;
     }
     else
@@ -1142,10 +1160,7 @@ static void hmR0VmxSetMsrPermission(PVMCPU pVCpu, uint32_t uMsr, VMXMSREXITREAD
         pbMsrBitmap += 0x400;
     }
     else
-    {
-        AssertMsgFailed(("hmR0VmxSetMsrPermission: Invalid MSR %#RX32\n", uMsr));
-        return;
-    }
+        AssertMsgFailedReturnVoid(("hmR0VmxSetMsrPermission: Invalid MSR %#RX32\n", uMsr));
 
     Assert(iBit <= 0x1fff);
     if (enmRead == VMXMSREXIT_INTERCEPT_READ)
@@ -1162,54 +1177,472 @@ static void hmR0VmxSetMsrPermission(PVMCPU pVCpu, uint32_t uMsr, VMXMSREXITREAD
 
 #ifdef VBOX_STRICT
 /**
- * Verifies whether the guest/host MSR pairs in the auto-load/store area in the
- * VMCS are correct.
+ * Gets the permission bits for the specified MSR in the MSR bitmap.
+ *
+ * @returns VBox status code.
+ * @retval VINF_SUCCESS        if the specified MSR is found.
+ * @retval VERR_NOT_FOUND      if the specified MSR is not found.
+ * @retval VERR_NOT_SUPPORTED  if VT-x doesn't allow the MSR.
+ *
+ * @param   pVCpu           Pointer to the VMCPU.
+ * @param   uMsr            The MSR.
+ * @param   penmRead        Where to store the read permissions.
+ * @param   penmWrite       Where to store the write permissions.
+ */
+static int hmR0VmxGetMsrPermission(PVMCPU pVCpu, uint32_t uMsr, PVMXMSREXITREAD penmRead, PVMXMSREXITWRITE penmWrite)
+{
+    AssertPtrReturn(penmRead,  VERR_INVALID_PARAMETER);
+    AssertPtrReturn(penmWrite, VERR_INVALID_PARAMETER);
+    int32_t iBit;
+    uint8_t *pbMsrBitmap = (uint8_t *)pVCpu->hm.s.vmx.pvMsrBitmap;
+
+    /* See hmR0VmxSetMsrPermission() for the layout. */
+    if (uMsr <= 0x00001FFF)
+        iBit = uMsr;
+    else if (   uMsr >= 0xC0000000
+             && uMsr <= 0xC0001FFF)
+    {
+        iBit = (uMsr - 0xC0000000);
+        pbMsrBitmap += 0x400;
+    }
+    else
+        AssertMsgFailedReturn(("hmR0VmxGetMsrPermission: Invalid MSR %#RX32\n", uMsr), VERR_NOT_SUPPORTED);
+
+    Assert(iBit <= 0x1fff);
+    if (ASMBitTest(pbMsrBitmap, iBit))
+        *penmRead = VMXMSREXIT_INTERCEPT_READ;
+    else
+        *penmRead = VMXMSREXIT_PASSTHRU_READ;
+
+    if (ASMBitTest(pbMsrBitmap + 0x800, iBit))
+        *penmWrite = VMXMSREXIT_INTERCEPT_WRITE;
+    else
+        *penmWrite = VMXMSREXIT_PASSTHRU_WRITE;
+    return VINF_SUCCESS;
+}
+#endif /* VBOX_STRICT */
+
+
+/**
+ * Updates the VMCS with the number of effective MSRs in the auto-load/store MSR
+ * area.
  *
+ * @returns VBox status code.
  * @param   pVCpu       Pointer to the VMCPU.
+ * @param   cMsrs       The number of MSRs.
  */
-static void hmR0VmxCheckAutoLoadStoreMsrs(PVMCPU pVCpu)
+DECLINLINE(int) hmR0VmxSetAutoLoadStoreMsrCount(PVMCPU pVCpu, uint32_t cMsrs)
 {
-    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    /* Shouldn't ever happen but there -is- a number. We're well within the recommended 512. */
+    uint32_t const cMaxSupportedMsrs = MSR_IA32_VMX_MISC_MAX_MSR(pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.u64Misc);
+    if (RT_UNLIKELY(cMsrs > cMaxSupportedMsrs))
+    {
+        LogRel(("CPU auto-load/store MSR count in VMCS exceeded cMsrs=%u Supported=%u.\n", cMsrs, cMaxSupportedMsrs));
+        pVCpu->hm.s.u32HMError = VMX_UFC_INSUFFICIENT_GUEST_MSR_STORAGE;
+        return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
+    }
 
-    uint32_t cHostMsrs  = pVCpu->hm.s.vmx.cHostMsrs;
-    uint32_t cGuestMsrs = pVCpu->hm.s.vmx.cGuestMsrs;
-    AssertMsgReturnVoid(cHostMsrs == cGuestMsrs, ("cGuestMsrs=%u cHostMsrs=%u\n", cGuestMsrs, cHostMsrs));
+    /* Update number of guest MSRs to load/store across the world-switch. */
+    int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_MSR_LOAD_COUNT, cMsrs);  AssertRCReturn(rc, rc);
+    rc     = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_STORE_COUNT, cMsrs);  AssertRCReturn(rc, rc);
 
-    /* Verify MSR counts in the VMCS are what we think it should be.  */
-    uint32_t cMsrs;
-    int rc = VMXReadVmcs32(VMX_VMCS32_CTRL_ENTRY_MSR_LOAD_COUNT, &cMsrs);  AssertRC(rc);
-    AssertMsgReturnVoid(cMsrs == cHostMsrs, ("EntryMsrLd: cMsrs=%u cHostMsrs=%u cGuestMsrs=%u\n", cMsrs, cHostMsrs, cGuestMsrs));
+    /* Update number of host MSRs to load after the world-switch. Identical to guest-MSR count as it's always paired. */
+    rc     = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT,  cMsrs);  AssertRCReturn(rc, rc);
 
-    rc = VMXReadVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_STORE_COUNT, &cMsrs);      AssertRC(rc);
-    AssertMsgReturnVoid(cMsrs == cHostMsrs, ("ExitMsrSt: cMsrs=%u cHostMsrs=%u cGuestMsrs=%u\n", cMsrs, cHostMsrs, cGuestMsrs));
+    /* Update the VCPU's copy of the MSR count. */
+    pVCpu->hm.s.vmx.cMsrs = cMsrs;
+
+    return VINF_SUCCESS;
+}
 
-    rc = VMXReadVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT, &cMsrs);       AssertRC(rc);
-    AssertMsgReturnVoid(cMsrs == cHostMsrs, ("ExitMsrLd: cMsrs=%u cHostMsrs=%u cGuestMsrs=%u\n", cMsrs, cHostMsrs, cGuestMsrs));
 
+/**
+ * Adds a new (or updates the value of an existing) guest/host MSR
+ * pair to be swapped during the world-switch as part of the
+ * auto-load/store MSR area in the VMCS.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu               Pointer to the VMCPU.
+ * @param   uMsr                The MSR.
+ * @param   uGuestMsr           Value of the guest MSR.
+ * @param   fUpdateHostMsr      Whether to update the value of the host MSR if
+ *                              necessary.
+ * @param   pfAddedAndUpdated   Where to store whether the MSR was added -and-
+ *                              its value was updated. Optional, can be NULL.
+ */
+static int hmR0VmxAddAutoLoadStoreMsr(PVMCPU pVCpu, uint32_t uMsr, uint64_t uGuestMsrValue, bool fUpdateHostMsr,
+                                       bool *pfAddedAndUpdated)
+{
+    PVMXAUTOMSR pGuestMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
+    uint32_t    cMsrs     = pVCpu->hm.s.vmx.cMsrs;
+    uint32_t    i;
+    for (i = 0; i < cMsrs; i++)
+    {
+        if (pGuestMsr->u32Msr == uMsr)
+            break;
+        pGuestMsr++;
+    }
+
+    bool fAdded = false;
+    if (i == cMsrs)
+    {
+        ++cMsrs;
+        int rc = hmR0VmxSetAutoLoadStoreMsrCount(pVCpu, cMsrs);
+        AssertMsgRCReturn(rc, ("hmR0VmxAddAutoLoadStoreMsr: Insufficient space to add MSR %u\n", uMsr), rc);
+
+        /* Now that we're swapping MSRs during the world-switch, allow the guest to read/write them without causing VM-exits. */
+        if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS)
+            hmR0VmxSetMsrPermission(pVCpu, uMsr, VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
+
+        fAdded = true;
+    }
+
+    /* Update the MSR values in the auto-load/store MSR area. */
+    pGuestMsr->u32Msr    = uMsr;
+    pGuestMsr->u64Value  = uGuestMsrValue;
+
+    /* Create/update the MSR slot in the host MSR area. */
+    PVMXAUTOMSR pHostMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvHostMsr;
+    pHostMsr += i;
+    pHostMsr->u32Msr     = uMsr;
+
+    /*
+     * Update the host MSR only when requested by the caller AND when we're
+     * adding it to the auto-load/store area. Otherwise, it would have been
+     * updated by hmR0VmxSaveHostMsrs(). We do this for performance reasons.
+     */
+    bool fUpdatedMsrValue = false;
+    if (   fAdded
+        && fUpdateHostMsr)
+    {
+        Assert(!VMMRZCallRing3IsEnabled(pVCpu));
+        Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+        pHostMsr->u64Value = ASMRdMsr(pHostMsr->u32Msr);
+        fUpdatedMsrValue = true;
+    }
+
+    if (pfAddedAndUpdated)
+        *pfAddedAndUpdated = fUpdatedMsrValue;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Removes a guest/host MSR pair to be swapped during the world-switch from the
+ * auto-load/store MSR area in the VMCS.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   uMsr        The MSR.
+ */
+static int hmR0VmxRemoveAutoLoadStoreMsr(PVMCPU pVCpu, uint32_t uMsr)
+{
+    PVMXAUTOMSR pGuestMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
+    uint32_t    cMsrs     = pVCpu->hm.s.vmx.cMsrs;
+    for (uint32_t i = 0; i < cMsrs; i++)
+    {
+        /* Find the MSR. */
+        if (pGuestMsr->u32Msr == uMsr)
+        {
+            /* If it's the last MSR, simply reduce the count. */
+            if (i == cMsrs - 1)
+            {
+                --cMsrs;
+                break;
+            }
+
+            /* Remove it by swapping the last MSR in place of it, and reducing the count. */
+            PVMXAUTOMSR pLastGuestMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
+            pLastGuestMsr            += cMsrs - 1;
+            pGuestMsr->u32Msr         = pLastGuestMsr->u32Msr;
+            pGuestMsr->u64Value       = pLastGuestMsr->u64Value;
+
+            PVMXAUTOMSR pHostMsr     = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvHostMsr;
+            PVMXAUTOMSR pLastHostMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvHostMsr;
+            pLastHostMsr            += cMsrs - 1;
+            pHostMsr->u32Msr         = pLastHostMsr->u32Msr;
+            pHostMsr->u64Value       = pLastHostMsr->u64Value;
+            --cMsrs;
+            break;
+        }
+        pGuestMsr++;
+    }
+
+    /* Update the VMCS if the count changed (meaning the MSR was found). */
+    if (cMsrs != pVCpu->hm.s.vmx.cMsrs)
+    {
+        int rc = hmR0VmxSetAutoLoadStoreMsrCount(pVCpu, cMsrs);
+        AssertRCReturn(rc, rc);
+
+        /* We're no longer swapping MSRs during the world-switch, intercept guest read/writes to them. */
+        if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS)
+            hmR0VmxSetMsrPermission(pVCpu, uMsr, VMXMSREXIT_INTERCEPT_READ, VMXMSREXIT_INTERCEPT_WRITE);
+
+        Log4(("Removed MSR %#RX32 new cMsrs=%u\n", uMsr, pVCpu->hm.s.vmx.cMsrs));
+        return VINF_SUCCESS;
+    }
+
+    return VERR_NOT_FOUND;
+}
+
+
+/**
+ * Checks if the specified guest MSR is part of the auto-load/store area in
+ * the VMCS.
+ *
+ * @returns true if found, false otherwise.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   uMsr        The MSR to find.
+ */
+static bool hmR0VmxIsAutoLoadStoreGuestMsr(PVMCPU pVCpu, uint32_t uMsr)
+{
+    PVMXAUTOMSR pGuestMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
+    uint32_t    cMsrs     = pVCpu->hm.s.vmx.cMsrs;
+
+    for (uint32_t i = 0; i < cMsrs; i++, pGuestMsr++)
+    {
+        if (pGuestMsr->u32Msr == uMsr)
+            return true;
+    }
+    return false;
+}
+
+
+/**
+ * Updates the value of all host MSRs in the auto-load/store area in the VMCS.
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ *
+ * @remarks No-long-jump zone!!!
+ */
+static void hmR0VmxUpdateAutoLoadStoreHostMsrs(PVMCPU pVCpu)
+{
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     PVMXAUTOMSR pHostMsr  = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvHostMsr;
     PVMXAUTOMSR pGuestMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
+    uint32_t    cMsrs    = pVCpu->hm.s.vmx.cMsrs;
+
     for (uint32_t i = 0; i < cMsrs; i++, pHostMsr++, pGuestMsr++)
     {
-        /* Verify that the MSRs are paired properly and that the host MSR has the correct value. */
-        AssertMsgReturnVoid(pHostMsr->u32Msr == pGuestMsr->u32Msr, ("HostMsr=%#RX32 GuestMsr=%#RX32 cMsrs=%u\n", pHostMsr->u32Msr,
-                                                                    pGuestMsr->u32Msr, cMsrs));
+        AssertReturnVoid(pHostMsr->u32Msr == pGuestMsr->u32Msr);
 
-        uint64_t u64Msr = ASMRdMsr(pHostMsr->u32Msr);
-        AssertMsgReturnVoid(pHostMsr->u64Value == u64Msr, ("u32Msr=%#RX32 VMCS Value=%#RX64 ASMRdMsr=%#RX64 cMsrs=%u\n",
-                                                           pHostMsr->u32Msr, pHostMsr->u64Value, u64Msr, cMsrs));
+        /*
+         * Performance hack for the host EFER MSR. We use the cached value rather than re-read it.
+         * Strict builds will catch mismatches in hmR0VmxCheckAutoLoadStoreMsrs(). See @bugref{7368}.
+         */
+        if (pHostMsr->u32Msr == MSR_K6_EFER)
+            pHostMsr->u64Value = pVCpu->CTX_SUFF(pVM)->hm.s.vmx.u64HostEfer;
+        else
+            pHostMsr->u64Value = ASMRdMsr(pHostMsr->u32Msr);
+    }
+
+    pVCpu->hm.s.vmx.fUpdatedHostMsrs = true;
+}
+
+
+#if HC_ARCH_BITS == 64
+/**
+ * Saves a set of host MSRs to allow read/write passthru access to the guest and
+ * perform lazy restoration of the host MSRs while leaving VT-x.
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ *
+ * @remarks No-long-jump zone!!!
+ */
+static void hmR0VmxLazySaveHostMsrs(PVMCPU pVCpu)
+{
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+
+    /*
+     * Note: If you're adding MSRs here, make sure to update the MSR-bitmap permissions in hmR0VmxSetupProcCtls().
+     */
+    if (!(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST))
+    {
+        pVCpu->hm.s.vmx.u64HostLStarMsr        = ASMRdMsr(MSR_K8_LSTAR);
+        pVCpu->hm.s.vmx.u64HostStarMsr         = ASMRdMsr(MSR_K6_STAR);
+        pVCpu->hm.s.vmx.u64HostSFMaskMsr       = ASMRdMsr(MSR_K8_SF_MASK);
+        pVCpu->hm.s.vmx.u64HostKernelGSBaseMsr = ASMRdMsr(MSR_K8_KERNEL_GS_BASE);
+        pVCpu->hm.s.vmx.fLazyMsrs |= VMX_LAZY_MSRS_SAVED_HOST;
+    }
+}
+
+
+/**
+ * Checks whether the MSR belongs to the set of guest MSRs that we restore
+ * lazily while leaving VT-x.
+ *
+ * @returns true if it does, false otherwise.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   uMsr        The MSR to check.
+ */
+static bool hmR0VmxIsLazyGuestMsr(PVMCPU pVCpu, uint32_t uMsr)
+{
+    NOREF(pVCpu);
+    switch (uMsr)
+    {
+        case MSR_K8_LSTAR:
+        case MSR_K6_STAR:
+        case MSR_K8_SF_MASK:
+        case MSR_K8_KERNEL_GS_BASE:
+            return true;
+    }
+    return false;
+}
+
+
+/**
+ * Saves a set of guest MSRs back into the guest-CPU context.
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pMixedCtx   Pointer to the guest-CPU context. The data may be
+ *                      out-of-sync. Make sure to update the required fields
+ *                      before using them.
+ *
+ * @remarks No-long-jump zone!!!
+ */
+static void hmR0VmxLazySaveGuestMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
+{
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
+
+    if (pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST)
+    {
+        Assert(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_SAVED_HOST);
+        pMixedCtx->msrLSTAR        = ASMRdMsr(MSR_K8_LSTAR);
+        pMixedCtx->msrSTAR         = ASMRdMsr(MSR_K6_STAR);
+        pMixedCtx->msrSFMASK       = ASMRdMsr(MSR_K8_SF_MASK);
+        pMixedCtx->msrKERNELGSBASE = ASMRdMsr(MSR_K8_KERNEL_GS_BASE);
+    }
+}
+
+
+/**
+ * Loads a set of guests MSRs to allow read/passthru to the guest.
+ *
+ * The name of this function is slightly confusing. This function does NOT
+ * postpone loading, but loads the MSR right now. "hmR0VmxLazy" is simply a
+ * common prefix for functions dealing with "lazy restoration" of the shared
+ * MSRs.
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pMixedCtx   Pointer to the guest-CPU context. The data may be
+ *                      out-of-sync. Make sure to update the required fields
+ *                      before using them.
+ *
+ * @remarks No-long-jump zone!!!
+ */
+static void hmR0VmxLazyLoadGuestMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
+{
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
 
-        /** @todo Verify that the permissions are as expected in the MSR bitmap. */
+#define VMXLOCAL_LAZY_LOAD_GUEST_MSR(uMsr, a_GuestMsr, a_HostMsr) \
+    do { \
+        if (pMixedCtx->msr##a_GuestMsr != pVCpu->hm.s.vmx.u64Host##a_HostMsr##Msr) \
+            ASMWrMsr(uMsr, pMixedCtx->msr##a_GuestMsr); \
+        else \
+            Assert(ASMRdMsr(uMsr) == pVCpu->hm.s.vmx.u64Host##a_HostMsr##Msr); \
+    } while (0)
+
+    Assert(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_SAVED_HOST);
+    if (!(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST))
+    {
+        VMXLOCAL_LAZY_LOAD_GUEST_MSR(MSR_K8_LSTAR, LSTAR, LStar);
+        VMXLOCAL_LAZY_LOAD_GUEST_MSR(MSR_K6_STAR, STAR, Star);
+        VMXLOCAL_LAZY_LOAD_GUEST_MSR(MSR_K8_SF_MASK, SFMASK, SFMask);
+        VMXLOCAL_LAZY_LOAD_GUEST_MSR(MSR_K8_KERNEL_GS_BASE, KERNELGSBASE, KernelGSBase);
+        pVCpu->hm.s.vmx.fLazyMsrs |= VMX_LAZY_MSRS_LOADED_GUEST;
     }
+    else
+    {
+        ASMWrMsr(MSR_K8_LSTAR,          pMixedCtx->msrLSTAR);
+        ASMWrMsr(MSR_K6_STAR,           pMixedCtx->msrSTAR);
+        ASMWrMsr(MSR_K8_SF_MASK,        pMixedCtx->msrSFMASK);
+        ASMWrMsr(MSR_K8_KERNEL_GS_BASE, pMixedCtx->msrKERNELGSBASE);
+    }
+
+#undef VMXLOCAL_LAZY_LOAD_GUEST_MSR
 }
 
 
 /**
+ * Performs lazy restoration of the set of host MSRs if they were previously
+ * loaded with guest MSR values.
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ *
+ * @remarks No-long-jump zone!!!
+ * @remarks The guest MSRs should have been saved back into the guest-CPU
+ *          context by hmR0VmxSaveGuestLazyMsrs()!!!
+ */
+static void hmR0VmxLazyRestoreHostMsrs(PVMCPU pVCpu)
+{
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
+
+    if (pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_LOADED_GUEST)
+    {
+        Assert(pVCpu->hm.s.vmx.fLazyMsrs & VMX_LAZY_MSRS_SAVED_HOST);
+        ASMWrMsr(MSR_K8_LSTAR,          pVCpu->hm.s.vmx.u64HostLStarMsr);
+        ASMWrMsr(MSR_K6_STAR,           pVCpu->hm.s.vmx.u64HostStarMsr);
+        ASMWrMsr(MSR_K8_SF_MASK,        pVCpu->hm.s.vmx.u64HostSFMaskMsr);
+        ASMWrMsr(MSR_K8_KERNEL_GS_BASE, pVCpu->hm.s.vmx.u64HostKernelGSBaseMsr);
+    }
+    pVCpu->hm.s.vmx.fLazyMsrs &= ~(VMX_LAZY_MSRS_LOADED_GUEST | VMX_LAZY_MSRS_SAVED_HOST);
+}
+#endif  /* HC_ARCH_BITS == 64 */
+
+
+/**
+ * Verifies that our cached values of the VMCS controls are all
+ * consistent with what's actually present in the VMCS.
+ *
+ * @returns VBox status code.
+ * @param pVCpu     Pointer to the VMCPU.
+ */
+static int hmR0VmxCheckVmcsCtls(PVMCPU pVCpu)
+{
+    uint32_t u32Val;
+    int rc = VMXReadVmcs32(VMX_VMCS32_CTRL_ENTRY, &u32Val);
+    AssertRCReturn(rc, rc);
+    AssertMsgReturn(pVCpu->hm.s.vmx.u32EntryCtls == u32Val, ("Cache=%#RX32 VMCS=%#RX32", pVCpu->hm.s.vmx.u32EntryCtls, u32Val),
+                    VERR_VMX_ENTRY_CTLS_CACHE_INVALID);
+
+    rc = VMXReadVmcs32(VMX_VMCS32_CTRL_EXIT, &u32Val);
+    AssertRCReturn(rc, rc);
+    AssertMsgReturn(pVCpu->hm.s.vmx.u32ExitCtls == u32Val, ("Cache=%#RX32 VMCS=%#RX32", pVCpu->hm.s.vmx.u32ExitCtls, u32Val),
+                    VERR_VMX_EXIT_CTLS_CACHE_INVALID);
+
+    rc = VMXReadVmcs32(VMX_VMCS32_CTRL_PIN_EXEC, &u32Val);
+    AssertRCReturn(rc, rc);
+    AssertMsgReturn(pVCpu->hm.s.vmx.u32PinCtls == u32Val, ("Cache=%#RX32 VMCS=%#RX32", pVCpu->hm.s.vmx.u32PinCtls, u32Val),
+                    VERR_VMX_PIN_EXEC_CTLS_CACHE_INVALID);
+
+    rc = VMXReadVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, &u32Val);
+    AssertRCReturn(rc, rc);
+    AssertMsgReturn(pVCpu->hm.s.vmx.u32ProcCtls == u32Val, ("Cache=%#RX32 VMCS=%#RX32", pVCpu->hm.s.vmx.u32ProcCtls, u32Val),
+                    VERR_VMX_PROC_EXEC_CTLS_CACHE_INVALID);
+
+    if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_SECONDARY_EXEC_CTRL)
+    {
+        rc = VMXReadVmcs32(VMX_VMCS32_CTRL_PROC_EXEC2, &u32Val);
+        AssertRCReturn(rc, rc);
+        AssertMsgReturn(pVCpu->hm.s.vmx.u32ProcCtls2 == u32Val, ("Cache=%#RX32 VMCS=%#RX32", pVCpu->hm.s.vmx.u32ProcCtls2, u32Val),
+                        VERR_VMX_PROC_EXEC2_CTLS_CACHE_INVALID);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+#ifdef VBOX_STRICT
+/**
  * Verifies that our cached host EFER value has not changed
  * since we cached it.
  *
  * @param pVCpu         Pointer to the VMCPU.
  */
-static void hmR0VmxCheckVmcsHostEferMsr(PVMCPU pVCpu)
+static void hmR0VmxCheckHostEferMsr(PVMCPU pVCpu)
 {
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
 
@@ -1219,8 +1652,65 @@ static void hmR0VmxCheckVmcsHostEferMsr(PVMCPU pVCpu)
         int rc = VMXReadVmcs64(VMX_VMCS64_HOST_FIELD_EFER_FULL, &u64Val);
         AssertRC(rc);
 
-        uint64_t u64HostEferMsr = ASMRdMsr(MSR_K6_EFER);
-        AssertMsgReturnVoid(u64HostEferMsr == u64Val, ("u64HostEferMsr=%#RX64 u64Val=%#RX64\n", u64HostEferMsr, u64Val));
+        uint64_t u64HostEferMsr = ASMRdMsr(MSR_K6_EFER);
+        AssertMsgReturnVoid(u64HostEferMsr == u64Val, ("u64HostEferMsr=%#RX64 u64Val=%#RX64\n", u64HostEferMsr, u64Val));
+    }
+}
+
+
+/**
+ * Verifies whether the guest/host MSR pairs in the auto-load/store area in the
+ * VMCS are correct.
+ *
+ * @param   pVCpu       Pointer to the VMCPU.
+ */
+static void hmR0VmxCheckAutoLoadStoreMsrs(PVMCPU pVCpu)
+{
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+
+    /* Verify MSR counts in the VMCS are what we think it should be.  */
+    uint32_t cMsrs;
+    int rc = VMXReadVmcs32(VMX_VMCS32_CTRL_ENTRY_MSR_LOAD_COUNT, &cMsrs);  AssertRC(rc);
+    Assert(cMsrs == pVCpu->hm.s.vmx.cMsrs);
+
+    rc = VMXReadVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_STORE_COUNT, &cMsrs);      AssertRC(rc);
+    Assert(cMsrs == pVCpu->hm.s.vmx.cMsrs);
+
+    rc = VMXReadVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT, &cMsrs);       AssertRC(rc);
+    Assert(cMsrs == pVCpu->hm.s.vmx.cMsrs);
+
+    PVMXAUTOMSR pHostMsr  = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvHostMsr;
+    PVMXAUTOMSR pGuestMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
+    for (uint32_t i = 0; i < cMsrs; i++, pHostMsr++, pGuestMsr++)
+    {
+        /* Verify that the MSRs are paired properly and that the host MSR has the correct value. */
+        AssertMsgReturnVoid(pHostMsr->u32Msr == pGuestMsr->u32Msr, ("HostMsr=%#RX32 GuestMsr=%#RX32 cMsrs=%u\n", pHostMsr->u32Msr,
+                                                                    pGuestMsr->u32Msr, cMsrs));
+
+        uint64_t u64Msr = ASMRdMsr(pHostMsr->u32Msr);
+        AssertMsgReturnVoid(pHostMsr->u64Value == u64Msr, ("u32Msr=%#RX32 VMCS Value=%#RX64 ASMRdMsr=%#RX64 cMsrs=%u\n",
+                                                           pHostMsr->u32Msr, pHostMsr->u64Value, u64Msr, cMsrs));
+
+        /* Verify that the permissions are as expected in the MSR bitmap. */
+        if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS)
+        {
+            VMXMSREXITREAD  enmRead;
+            VMXMSREXITWRITE enmWrite;
+            rc = hmR0VmxGetMsrPermission(pVCpu, pGuestMsr->u32Msr, &enmRead, &enmWrite);
+            AssertMsgReturnVoid(rc == VINF_SUCCESS, ("hmR0VmxGetMsrPermission! failed. rc=%Rrc\n", rc));
+            if (pGuestMsr->u32Msr == MSR_K6_EFER)
+            {
+                AssertMsgReturnVoid(enmRead  == VMXMSREXIT_INTERCEPT_READ,  ("Passthru read for EFER!?\n"));
+                AssertMsgReturnVoid(enmWrite == VMXMSREXIT_INTERCEPT_WRITE, ("Passthru write for EFER!?\n"));
+            }
+            else
+            {
+                AssertMsgReturnVoid(enmRead  == VMXMSREXIT_PASSTHRU_READ,  ("u32Msr=%#RX32 cMsrs=%u No passthru read!\n",
+                                                                            pGuestMsr->u32Msr, cMsrs));
+                AssertMsgReturnVoid(enmWrite == VMXMSREXIT_PASSTHRU_WRITE, ("u32Msr=%#RX32 cMsrs=%u No passthru write!\n",
+                                                                            pGuestMsr->u32Msr, cMsrs));
+            }
+        }
     }
 }
 #endif /* VBOX_STRICT */
@@ -1239,10 +1729,10 @@ static void hmR0VmxCheckVmcsHostEferMsr(PVMCPU pVCpu)
  *          supported by the CPU.
  * @remarks Can be called with interrupts disabled.
  */
-static void hmR0VmxFlushEpt(PVMCPU pVCpu, VMX_FLUSH_EPT enmFlush)
+static void hmR0VmxFlushEpt(PVMCPU pVCpu, VMXFLUSHEPT enmFlush)
 {
     uint64_t au64Descriptor[2];
-    if (enmFlush == VMX_FLUSH_EPT_ALL_CONTEXTS)
+    if (enmFlush == VMXFLUSHEPT_ALL_CONTEXTS)
         au64Descriptor[0] = 0;
     else
     {
@@ -1275,13 +1765,14 @@ static void hmR0VmxFlushEpt(PVMCPU pVCpu, VMX_FLUSH_EPT enmFlush)
  *
  * @remarks Can be called with interrupts disabled.
  */
-static void hmR0VmxFlushVpid(PVM pVM, PVMCPU pVCpu, VMX_FLUSH_VPID enmFlush, RTGCPTR GCPtr)
+static void hmR0VmxFlushVpid(PVM pVM, PVMCPU pVCpu, VMXFLUSHVPID enmFlush, RTGCPTR GCPtr)
 {
+    NOREF(pVM);
     AssertPtr(pVM);
     Assert(pVM->hm.s.vmx.fVpid);
 
     uint64_t au64Descriptor[2];
-    if (enmFlush == VMX_FLUSH_VPID_ALL_CONTEXTS)
+    if (enmFlush == VMXFLUSHVPID_ALL_CONTEXTS)
     {
         au64Descriptor[0] = 0;
         au64Descriptor[1] = 0;
@@ -1335,7 +1826,7 @@ VMMR0DECL(int) VMXR0InvalidatePage(PVM pVM, PVMCPU pVCpu, RTGCPTR GCVirt)
         {
             if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_INDIV_ADDR)
             {
-                hmR0VmxFlushVpid(pVM, pVCpu, VMX_FLUSH_VPID_INDIV_ADDR, GCVirt);
+                hmR0VmxFlushVpid(pVM, pVCpu, VMXFLUSHVPID_INDIV_ADDR, GCVirt);
                 STAM_COUNTER_INC(&pVCpu->hm.s.StatFlushTlbInvlpgVirt);
             }
             else
@@ -1360,6 +1851,7 @@ VMMR0DECL(int) VMXR0InvalidatePage(PVM pVM, PVMCPU pVCpu, RTGCPTR GCVirt)
  */
 VMMR0DECL(int) VMXR0InvalidatePhysPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys)
 {
+    NOREF(pVM); NOREF(GCPhys);
     LogFlowFunc(("%RGp\n", GCPhys));
 
     /*
@@ -1397,6 +1889,7 @@ static void hmR0VmxFlushTaggedTlbNone(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
     pVCpu->hm.s.TlbShootdown.cPages = 0;
 #endif
 
+    Assert(pCpu->idCpu != NIL_RTCPUID);
     pVCpu->hm.s.idLastCpu           = pCpu->idCpu;
     pVCpu->hm.s.cTlbFlushes         = pCpu->cTlbFlushes;
     pVCpu->hm.s.fForceTLBFlush      = false;
@@ -1433,11 +1926,12 @@ static void hmR0VmxFlushTaggedTlbBoth(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
     AssertPtr(pVM);
     AssertPtr(pCpu);
     AssertPtr(pVCpu);
+    Assert(pCpu->idCpu != NIL_RTCPUID);
+
     AssertMsg(pVM->hm.s.fNestedPaging && pVM->hm.s.vmx.fVpid,
               ("hmR0VmxFlushTaggedTlbBoth cannot be invoked unless NestedPaging & VPID are enabled."
                "fNestedPaging=%RTbool fVpid=%RTbool", pVM->hm.s.fNestedPaging, pVM->hm.s.vmx.fVpid));
 
-
     /*
      * Force a TLB flush for the first world-switch if the current CPU differs from the one we ran on last.
      * If the TLB flush count changed, another VM (VCPU rather) has hit the ASID limit while flushing the TLB
@@ -1498,7 +1992,7 @@ static void hmR0VmxFlushTaggedTlbBoth(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
         if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_INDIV_ADDR)
         {
             for (uint32_t i = 0; i < pVCpu->hm.s.TlbShootdown.cPages; i++)
-                hmR0VmxFlushVpid(pVM, pVCpu, VMX_FLUSH_VPID_INDIV_ADDR, pVCpu->hm.s.TlbShootdown.aPages[i]);
+                hmR0VmxFlushVpid(pVM, pVCpu, VMXFLUSHVPID_INDIV_ADDR, pVCpu->hm.s.TlbShootdown.aPages[i]);
         }
         else
             hmR0VmxFlushEpt(pVCpu, pVM->hm.s.vmx.enmFlushEpt);
@@ -1518,9 +2012,10 @@ static void hmR0VmxFlushTaggedTlbBoth(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
     AssertMsg(pVCpu->hm.s.cTlbFlushes == pCpu->cTlbFlushes,
               ("Flush count mismatch for cpu %d (%u vs %u)\n", pCpu->idCpu, pVCpu->hm.s.cTlbFlushes, pCpu->cTlbFlushes));
     AssertMsg(pCpu->uCurrentAsid >= 1 && pCpu->uCurrentAsid < pVM->hm.s.uMaxAsid,
-              ("cpu%d uCurrentAsid = %u\n", pCpu->idCpu, pCpu->uCurrentAsid));
+              ("Cpu[%u] uCurrentAsid=%u cTlbFlushes=%u pVCpu->idLastCpu=%u pVCpu->cTlbFlushes=%u\n", pCpu->idCpu,
+               pCpu->uCurrentAsid, pCpu->cTlbFlushes, pVCpu->hm.s.idLastCpu, pVCpu->hm.s.cTlbFlushes));
     AssertMsg(pVCpu->hm.s.uCurrentAsid >= 1 && pVCpu->hm.s.uCurrentAsid < pVM->hm.s.uMaxAsid,
-              ("cpu%d VM uCurrentAsid = %u\n", pCpu->idCpu, pVCpu->hm.s.uCurrentAsid));
+              ("Cpu[%u] pVCpu->uCurrentAsid=%u\n", pCpu->idCpu, pVCpu->hm.s.uCurrentAsid));
 
     /* Update VMCS with the VPID. */
     int rc  = VMXWriteVmcs32(VMX_VMCS16_GUEST_FIELD_VPID, pVCpu->hm.s.uCurrentAsid);
@@ -1545,6 +2040,7 @@ static void hmR0VmxFlushTaggedTlbEpt(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCp
     AssertPtr(pVM);
     AssertPtr(pVCpu);
     AssertPtr(pCpu);
+    Assert(pCpu->idCpu != NIL_RTCPUID);
     AssertMsg(pVM->hm.s.fNestedPaging, ("hmR0VmxFlushTaggedTlbEpt cannot be invoked with NestedPaging disabled."));
     AssertMsg(!pVM->hm.s.vmx.fVpid, ("hmR0VmxFlushTaggedTlbEpt cannot be invoked with VPID enabled."));
 
@@ -1611,6 +2107,7 @@ static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
     AssertPtr(pVM);
     AssertPtr(pVCpu);
     AssertPtr(pCpu);
+    Assert(pCpu->idCpu != NIL_RTCPUID);
     AssertMsg(pVM->hm.s.vmx.fVpid, ("hmR0VmxFlushTlbVpid cannot be invoked with VPID disabled."));
     AssertMsg(!pVM->hm.s.fNestedPaging, ("hmR0VmxFlushTlbVpid cannot be invoked with NestedPaging enabled"));
 
@@ -1653,7 +2150,20 @@ static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
         pVCpu->hm.s.cTlbFlushes    = pCpu->cTlbFlushes;
         pVCpu->hm.s.uCurrentAsid   = pCpu->uCurrentAsid;
         if (pCpu->fFlushAsidBeforeUse)
-            hmR0VmxFlushVpid(pVM, pVCpu, pVM->hm.s.vmx.enmFlushVpid, 0 /* GCPtr */);
+        {
+            if (pVM->hm.s.vmx.enmFlushVpid == VMXFLUSHVPID_SINGLE_CONTEXT)
+                hmR0VmxFlushVpid(pVM, pVCpu, VMXFLUSHVPID_SINGLE_CONTEXT, 0 /* GCPtr */);
+            else if (pVM->hm.s.vmx.enmFlushVpid == VMXFLUSHVPID_ALL_CONTEXTS)
+            {
+                hmR0VmxFlushVpid(pVM, pVCpu, VMXFLUSHVPID_ALL_CONTEXTS, 0 /* GCPtr */);
+                pCpu->fFlushAsidBeforeUse = false;
+            }
+            else
+            {
+                /* hmR0VmxSetupTaggedTlb() ensures we never get here. Paranoia. */
+                AssertMsgFailed(("Unsupported VPID-flush context type.\n"));
+            }
+        }
     }
     /** @todo We never set VMCPU_FF_TLB_SHOOTDOWN anywhere. See hmQueueInvlPage()
      *        where it is commented out. Support individual entry flushing
@@ -1672,7 +2182,7 @@ static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
             if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_INDIV_ADDR)
             {
                 for (uint32_t i = 0; i < pVCpu->hm.s.TlbShootdown.cPages; i++)
-                    hmR0VmxFlushVpid(pVM, pVCpu, VMX_FLUSH_VPID_INDIV_ADDR, pVCpu->hm.s.TlbShootdown.aPages[i]);
+                    hmR0VmxFlushVpid(pVM, pVCpu, VMXFLUSHVPID_INDIV_ADDR, pVCpu->hm.s.TlbShootdown.aPages[i]);
             }
             else
                 hmR0VmxFlushVpid(pVM, pVCpu, pVM->hm.s.vmx.enmFlushVpid, 0 /* GCPtr */);
@@ -1688,9 +2198,10 @@ static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
     AssertMsg(pVCpu->hm.s.cTlbFlushes == pCpu->cTlbFlushes,
               ("Flush count mismatch for cpu %d (%u vs %u)\n", pCpu->idCpu, pVCpu->hm.s.cTlbFlushes, pCpu->cTlbFlushes));
     AssertMsg(pCpu->uCurrentAsid >= 1 && pCpu->uCurrentAsid < pVM->hm.s.uMaxAsid,
-              ("cpu%d uCurrentAsid = %u\n", pCpu->idCpu, pCpu->uCurrentAsid));
+              ("Cpu[%u] uCurrentAsid=%u cTlbFlushes=%u pVCpu->idLastCpu=%u pVCpu->cTlbFlushes=%u\n", pCpu->idCpu,
+               pCpu->uCurrentAsid, pCpu->cTlbFlushes, pVCpu->hm.s.idLastCpu, pVCpu->hm.s.cTlbFlushes));
     AssertMsg(pVCpu->hm.s.uCurrentAsid >= 1 && pVCpu->hm.s.uCurrentAsid < pVM->hm.s.uMaxAsid,
-              ("cpu%d VM uCurrentAsid = %u\n", pCpu->idCpu, pVCpu->hm.s.uCurrentAsid));
+              ("Cpu[%u] pVCpu->uCurrentAsid=%u\n", pCpu->idCpu, pVCpu->hm.s.uCurrentAsid));
 
     int rc  = VMXWriteVmcs32(VMX_VMCS16_GUEST_FIELD_VPID, pVCpu->hm.s.uCurrentAsid);
     AssertRC(rc);
@@ -1705,6 +2216,9 @@ static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pC
  */
 DECLINLINE(void) hmR0VmxFlushTaggedTlb(PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
 {
+#ifdef HMVMX_ALWAYS_FLUSH_TLB
+    VMCPU_FF_SET(pVCpu, VMCPU_FF_TLB_FLUSH);
+#endif
     PVM pVM = pVCpu->CTX_SUFF(pVM);
     switch (pVM->hm.s.vmx.uFlushTaggedTlb)
     {
@@ -1716,6 +2230,11 @@ DECLINLINE(void) hmR0VmxFlushTaggedTlb(PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
             AssertMsgFailed(("Invalid flush-tag function identifier\n"));
             break;
     }
+
+    /* VMCPU_FF_TLB_SHOOTDOWN is unused. */
+    Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_TLB_SHOOTDOWN));
+
+    /* Don't assert that VMCPU_FF_TLB_FLUSH should no longer be pending. It can be set by other EMTs. */
 }
 
 
@@ -1738,13 +2257,13 @@ static int hmR0VmxSetupTaggedTlb(PVM pVM)
         if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVEPT)
         {
             if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVEPT_SINGLE_CONTEXT)
-                pVM->hm.s.vmx.enmFlushEpt = VMX_FLUSH_EPT_SINGLE_CONTEXT;
+                pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_SINGLE_CONTEXT;
             else if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVEPT_ALL_CONTEXTS)
-                pVM->hm.s.vmx.enmFlushEpt = VMX_FLUSH_EPT_ALL_CONTEXTS;
+                pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_ALL_CONTEXTS;
             else
             {
                 /* Shouldn't happen. EPT is supported but no suitable flush-types supported. */
-                pVM->hm.s.vmx.enmFlushEpt = VMX_FLUSH_EPT_NOT_SUPPORTED;
+                pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_NOT_SUPPORTED;
                 return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
             }
 
@@ -1752,14 +2271,14 @@ static int hmR0VmxSetupTaggedTlb(PVM pVM)
             if (!(pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_EMT_WB))
             {
                 LogRel(("hmR0VmxSetupTaggedTlb: Unsupported EPTP memory type %#x.\n", pVM->hm.s.vmx.Msrs.u64EptVpidCaps));
-                pVM->hm.s.vmx.enmFlushEpt = VMX_FLUSH_EPT_NOT_SUPPORTED;
+                pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_NOT_SUPPORTED;
                 return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
             }
         }
         else
         {
             /* Shouldn't happen. EPT is supported but INVEPT instruction is not supported. */
-            pVM->hm.s.vmx.enmFlushEpt = VMX_FLUSH_EPT_NOT_SUPPORTED;
+            pVM->hm.s.vmx.enmFlushEpt = VMXFLUSHEPT_NOT_SUPPORTED;
             return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
         }
     }
@@ -1772,9 +2291,9 @@ static int hmR0VmxSetupTaggedTlb(PVM pVM)
         if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVVPID)
         {
             if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_SINGLE_CONTEXT)
-                pVM->hm.s.vmx.enmFlushVpid = VMX_FLUSH_VPID_SINGLE_CONTEXT;
+                pVM->hm.s.vmx.enmFlushVpid = VMXFLUSHVPID_SINGLE_CONTEXT;
             else if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_ALL_CONTEXTS)
-                pVM->hm.s.vmx.enmFlushVpid = VMX_FLUSH_VPID_ALL_CONTEXTS;
+                pVM->hm.s.vmx.enmFlushVpid = VMXFLUSHVPID_ALL_CONTEXTS;
             else
             {
                 /* Neither SINGLE nor ALL-context flush types for VPID is supported by the CPU. Ignore VPID capability. */
@@ -1782,7 +2301,7 @@ static int hmR0VmxSetupTaggedTlb(PVM pVM)
                     LogRel(("hmR0VmxSetupTaggedTlb: Only INDIV_ADDR supported. Ignoring VPID.\n"));
                 if (pVM->hm.s.vmx.Msrs.u64EptVpidCaps & MSR_IA32_VMX_EPT_VPID_CAP_INVVPID_SINGLE_CONTEXT_RETAIN_GLOBALS)
                     LogRel(("hmR0VmxSetupTaggedTlb: Only SINGLE_CONTEXT_RETAIN_GLOBALS supported. Ignoring VPID.\n"));
-                pVM->hm.s.vmx.enmFlushVpid = VMX_FLUSH_VPID_NOT_SUPPORTED;
+                pVM->hm.s.vmx.enmFlushVpid = VMXFLUSHVPID_NOT_SUPPORTED;
                 pVM->hm.s.vmx.fVpid = false;
             }
         }
@@ -1790,7 +2309,7 @@ static int hmR0VmxSetupTaggedTlb(PVM pVM)
         {
             /*  Shouldn't happen. VPID is supported but INVVPID is not supported by the CPU. Ignore VPID capability. */
             Log4(("hmR0VmxSetupTaggedTlb: VPID supported without INVEPT support. Ignoring VPID.\n"));
-            pVM->hm.s.vmx.enmFlushVpid = VMX_FLUSH_VPID_NOT_SUPPORTED;
+            pVM->hm.s.vmx.enmFlushVpid = VMXFLUSHVPID_NOT_SUPPORTED;
             pVM->hm.s.vmx.fVpid = false;
         }
     }
@@ -1825,9 +2344,11 @@ static int hmR0VmxSetupPinCtls(PVM pVM, PVMCPU pVCpu)
     uint32_t val = pVM->hm.s.vmx.Msrs.VmxPinCtls.n.disallowed0;         /* Bits set here must always be set. */
     uint32_t zap = pVM->hm.s.vmx.Msrs.VmxPinCtls.n.allowed1;            /* Bits cleared here must always be cleared. */
 
-    val |=   VMX_VMCS_CTRL_PIN_EXEC_EXT_INT_EXIT           /* External interrupts causes a VM-exits. */
-           | VMX_VMCS_CTRL_PIN_EXEC_NMI_EXIT;              /* Non-maskable interrupts causes a VM-exit. */
-    Assert(!(val & VMX_VMCS_CTRL_PIN_EXEC_VIRTUAL_NMI));
+    val |=   VMX_VMCS_CTRL_PIN_EXEC_EXT_INT_EXIT           /* External interrupts cause a VM-exit. */
+           | VMX_VMCS_CTRL_PIN_EXEC_NMI_EXIT;              /* Non-maskable interrupts (NMIs) cause a VM-exit. */
+
+    if (pVM->hm.s.vmx.Msrs.VmxPinCtls.n.allowed1 & VMX_VMCS_CTRL_PIN_EXEC_VIRTUAL_NMI)
+        val |= VMX_VMCS_CTRL_PIN_EXEC_VIRTUAL_NMI;         /* Use virtual NMIs and virtual-NMI blocking features. */
 
     /* Enable the VMX preemption timer. */
     if (pVM->hm.s.vmx.fUsePreemptTimer)
@@ -1847,7 +2368,6 @@ static int hmR0VmxSetupPinCtls(PVM pVM, PVMCPU pVCpu)
     int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PIN_EXEC, val);
     AssertRCReturn(rc, rc);
 
-    /* Update VCPU with the currently set pin-based VM-execution controls. */
     pVCpu->hm.s.vmx.u32PinCtls = val;
     return rc;
 }
@@ -1905,7 +2425,7 @@ static int hmR0VmxSetupProcCtls(PVM pVM, PVMCPU pVCpu)
         AssertRCReturn(rc, rc);
 
         val |= VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW;         /* CR8 reads from the Virtual-APIC page. */
-                                                               /* CR8 writes causes a VM-exit based on TPR threshold. */
+                                                               /* CR8 writes cause a VM-exit based on TPR threshold. */
         Assert(!(val & VMX_VMCS_CTRL_PROC_EXEC_CR8_STORE_EXIT));
         Assert(!(val & VMX_VMCS_CTRL_PROC_EXEC_CR8_LOAD_EXIT));
     }
@@ -1917,8 +2437,8 @@ static int hmR0VmxSetupProcCtls(PVM pVM, PVMCPU pVCpu)
          */
         if (pVM->hm.s.fAllow64BitGuests)
         {
-            val |=   VMX_VMCS_CTRL_PROC_EXEC_CR8_STORE_EXIT    /* CR8 reads causes a VM-exit. */
-                   | VMX_VMCS_CTRL_PROC_EXEC_CR8_LOAD_EXIT;    /* CR8 writes causes a VM-exit. */
+            val |=   VMX_VMCS_CTRL_PROC_EXEC_CR8_STORE_EXIT    /* CR8 reads cause a VM-exit. */
+                   | VMX_VMCS_CTRL_PROC_EXEC_CR8_LOAD_EXIT;    /* CR8 writes cause a VM-exit. */
         }
     }
 
@@ -1934,17 +2454,26 @@ static int hmR0VmxSetupProcCtls(PVM pVM, PVMCPU pVCpu)
 
         /*
          * The guest can access the following MSRs (read, write) without causing VM-exits; they are loaded/stored
-         * automatically (either as part of the MSR-load/store areas or dedicated fields in the VMCS).
+         * automatically using dedicated fields in the VMCS.
          */
         hmR0VmxSetMsrPermission(pVCpu, MSR_IA32_SYSENTER_CS,  VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
         hmR0VmxSetMsrPermission(pVCpu, MSR_IA32_SYSENTER_ESP, VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
         hmR0VmxSetMsrPermission(pVCpu, MSR_IA32_SYSENTER_EIP, VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
-        hmR0VmxSetMsrPermission(pVCpu, MSR_K8_LSTAR,          VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
-        hmR0VmxSetMsrPermission(pVCpu, MSR_K6_STAR,           VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
-        hmR0VmxSetMsrPermission(pVCpu, MSR_K8_SF_MASK,        VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
-        hmR0VmxSetMsrPermission(pVCpu, MSR_K8_KERNEL_GS_BASE, VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
         hmR0VmxSetMsrPermission(pVCpu, MSR_K8_GS_BASE,        VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
         hmR0VmxSetMsrPermission(pVCpu, MSR_K8_FS_BASE,        VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
+
+#if HC_ARCH_BITS == 64
+        /*
+         * Set passthru permissions for the following MSRs (mandatory for VT-x) required for 64-bit guests.
+         */
+        if (pVM->hm.s.fAllow64BitGuests)
+        {
+            hmR0VmxSetMsrPermission(pVCpu, MSR_K8_LSTAR,          VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
+            hmR0VmxSetMsrPermission(pVCpu, MSR_K6_STAR,           VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
+            hmR0VmxSetMsrPermission(pVCpu, MSR_K8_SF_MASK,        VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
+            hmR0VmxSetMsrPermission(pVCpu, MSR_K8_KERNEL_GS_BASE, VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
+        }
+#endif
     }
 
     /* Use the secondary processor-based VM-execution controls if supported by the CPU. */
@@ -1962,7 +2491,6 @@ static int hmR0VmxSetupProcCtls(PVM pVM, PVMCPU pVCpu)
     rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, val);
     AssertRCReturn(rc, rc);
 
-    /* Update VCPU with the currently set processor-based VM-execution controls. */
     pVCpu->hm.s.vmx.u32ProcCtls = val;
 
     /*
@@ -2008,29 +2536,26 @@ static int hmR0VmxSetupProcCtls(PVM pVM, PVMCPU pVCpu)
         }
 
         if (pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP)
-        {
             val |= VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP;                     /* Enable RDTSCP support. */
-            if (pVM->hm.s.vmx.Msrs.VmxProcCtls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS)
-                hmR0VmxSetMsrPermission(pVCpu, MSR_K8_TSC_AUX, VMXMSREXIT_PASSTHRU_READ, VMXMSREXIT_PASSTHRU_WRITE);
-        }
 
         if ((val & zap) != val)
         {
             LogRel(("hmR0VmxSetupProcCtls: invalid secondary processor-based VM-execution controls combo! "
                     "cpu=%#RX64 val=%#RX64 zap=%#RX64\n", pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.disallowed0, val, zap));
+            pVCpu->hm.s.u32HMError = VMX_UFC_CTRL_PROC_EXEC2;
             return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
         }
 
         rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC2, val);
         AssertRCReturn(rc, rc);
 
-        /* Update VCPU with the currently set secondary processor-based VM-execution controls. */
         pVCpu->hm.s.vmx.u32ProcCtls2 = val;
     }
     else if (RT_UNLIKELY(pVM->hm.s.vmx.fUnrestrictedGuest))
     {
         LogRel(("hmR0VmxSetupProcCtls: Unrestricted Guest set as true when secondary processor-based VM-execution controls not "
                 "available\n"));
+        pVCpu->hm.s.u32HMError = VMX_UFC_INVALID_UX_COMBO;
         return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
     }
 
@@ -2048,6 +2573,7 @@ static int hmR0VmxSetupProcCtls(PVM pVM, PVMCPU pVCpu)
  */
 static int hmR0VmxSetupMiscCtls(PVM pVM, PVMCPU pVCpu)
 {
+    NOREF(pVM);
     AssertPtr(pVM);
     AssertPtr(pVCpu);
 
@@ -2078,8 +2604,7 @@ static int hmR0VmxSetupMiscCtls(PVM pVM, PVMCPU pVCpu)
     rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT,  0);       AssertRCReturn(rc, rc);
 #endif
 
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-    /* Setup MSR autoloading/storing. */
+    /* Setup MSR auto-load/store area. */
     Assert(pVCpu->hm.s.vmx.HCPhysGuestMsr);
     Assert(!(pVCpu->hm.s.vmx.HCPhysGuestMsr & 0xf));    /* Lower 4 bits MBZ. */
     rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_ENTRY_MSR_LOAD_FULL, pVCpu->hm.s.vmx.HCPhysGuestMsr);
@@ -2091,7 +2616,6 @@ static int hmR0VmxSetupMiscCtls(PVM pVM, PVMCPU pVCpu)
     Assert(!(pVCpu->hm.s.vmx.HCPhysHostMsr & 0xf));     /* Lower 4 bits MBZ. */
     rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_EXIT_MSR_LOAD_FULL,  pVCpu->hm.s.vmx.HCPhysHostMsr);
     AssertRCReturn(rc, rc);
-#endif
 
     /* Set VMCS link pointer. Reserved for future use, must be -1. Intel spec. 24.4 "Guest-State Area". */
     rc = VMXWriteVmcs64(VMX_VMCS64_GUEST_VMCS_LINK_PTR_FULL, UINT64_C(0xffffffffffffffff));
@@ -2111,8 +2635,7 @@ static int hmR0VmxSetupMiscCtls(PVM pVM, PVMCPU pVCpu)
 
 
 /**
- * Sets up the initial exception bitmap in the VMCS based on static conditions
- * (i.e. conditions that cannot ever change after starting the VM).
+ * Sets up the initial exception bitmap in the VMCS based on static conditions.
  *
  * @returns VBox status code.
  * @param   pVM         Pointer to the VM.
@@ -2125,7 +2648,7 @@ static int hmR0VmxInitXcptBitmap(PVM pVM, PVMCPU pVCpu)
 
     LogFlowFunc(("pVM=%p pVCpu=%p\n", pVM, pVCpu));
 
-    uint32_t u32XcptBitmap = 0;
+    uint32_t u32XcptBitmap = pVCpu->hm.s.fGIMTrapXcptUD ? RT_BIT(X86_XCPT_UD) : 0;
 
     /* Without Nested Paging, #PF must cause a VM-exit so we can sync our shadow page tables. */
     if (!pVM->hm.s.fNestedPaging)
@@ -2209,9 +2732,8 @@ VMMR0DECL(int) VMXR0SetupVM(PVM pVM)
 
     /*
      * Without UnrestrictedGuest, pRealModeTSS and pNonPagingModeEPTPageTable *must* always be allocated.
-     * We no longer support the highly unlikely case of UnrestrictedGuest without pRealModeTSS. See hmR3InitFinalizeR0().
+     * We no longer support the highly unlikely case of UnrestrictedGuest without pRealModeTSS. See hmR3InitFinalizeR0Intel().
      */
-    /* -XXX- change hmR3InitFinalizeR0Intel() to fail if pRealModeTSS alloc fails. */
     if (   !pVM->hm.s.vmx.fUnrestrictedGuest
         &&  (   !pVM->hm.s.vmx.pNonPagingModeEPTPageTable
              || !pVM->hm.s.vmx.pRealModeTSS))
@@ -2234,8 +2756,8 @@ VMMR0DECL(int) VMXR0SetupVM(PVM pVM)
 #endif
 
     /* Initialize these always, see hmR3InitFinalizeR0().*/
-    pVM->hm.s.vmx.enmFlushEpt  = VMX_FLUSH_EPT_NONE;
-    pVM->hm.s.vmx.enmFlushVpid = VMX_FLUSH_VPID_NONE;
+    pVM->hm.s.vmx.enmFlushEpt  = VMXFLUSHEPT_NONE;
+    pVM->hm.s.vmx.enmFlushVpid = VMXFLUSHVPID_NONE;
 
     /* Setup the tagged-TLB flush handlers. */
     int rc = hmR0VmxSetupTaggedTlb(pVM);
@@ -2266,6 +2788,10 @@ VMMR0DECL(int) VMXR0SetupVM(PVM pVM)
         /* Log the VCPU pointers, useful for debugging SMP VMs. */
         Log4(("VMXR0SetupVM: pVCpu=%p idCpu=%RU32\n", pVCpu, pVCpu->idCpu));
 
+       /* Initialize the VM-exit history array with end-of-array markers (UINT16_MAX). */
+        Assert(!pVCpu->hm.s.idxExitHistoryFree);
+        HMCPU_EXIT_HISTORY_RESET(pVCpu);
+
         /* Set revision dword at the beginning of the VMCS structure. */
         *(uint32_t *)pVCpu->hm.s.vmx.pvVmcs = MSR_IA32_VMX_BASIC_INFO_VMCS_ID(pVM->hm.s.vmx.Msrs.u64BasicInfo);
 
@@ -2329,6 +2855,8 @@ VMMR0DECL(int) VMXR0SetupVM(PVM pVM)
  */
 DECLINLINE(int) hmR0VmxSaveHostControlRegs(PVM pVM, PVMCPU pVCpu)
 {
+    NOREF(pVM); NOREF(pVCpu);
+
     RTCCUINTREG uReg = ASMGetCR0();
     int rc = VMXWriteVmcsHstN(VMX_VMCS_HOST_CR0, uReg);
     AssertRCReturn(rc, rc);
@@ -2367,7 +2895,7 @@ DECLINLINE(int) hmR0VmxSaveHostControlRegs(PVM pVM, PVMCPU pVCpu)
         if ((selValue) & X86_SEL_LDT) \
         { \
             uint32_t uAttr = ASMGetSegAttr((selValue)); \
-            fValidSelector = RT_BOOL(uAttr != ~0U && (uAttr & X86_DESC_P)); \
+            fValidSelector = RT_BOOL(uAttr != UINT32_MAX && (uAttr & X86_DESC_P)); \
         } \
         if (fValidSelector) \
         { \
@@ -2391,6 +2919,15 @@ DECLINLINE(int) hmR0VmxSaveHostSegmentRegs(PVM pVM, PVMCPU pVCpu)
 {
     int rc = VERR_INTERNAL_ERROR_5;
 
+#if HC_ARCH_BITS == 64
+    /*
+     * If we've executed guest code using VT-x, the host-state bits will be messed up. We
+     * should -not- save the messed up state without restoring the original host-state. See @bugref{7240}.
+     */
+    AssertMsgReturn(!(pVCpu->hm.s.vmx.fRestoreHostFlags & VMX_RESTORE_HOST_REQUIRED),
+                    ("Re-saving host-state after executing guest code without leaving VT-x!\n"), VERR_WRONG_ORDER);
+#endif
+
     /*
      * Host DS, ES, FS and GS segment registers.
      */
@@ -2515,11 +3052,18 @@ DECLINLINE(int) hmR0VmxSaveHostSegmentRegs(PVM pVM, PVMCPU pVCpu)
         }
 
         /*
-         * IDT limit is practically 0xfff. Therefore if the host has the limit as 0xfff, VT-x bloating the limit to 0xffff
-         * is not a problem as it's not possible to get at them anyway. See Intel spec. 6.14.1 "64-Bit Mode IDT" and
-         * Intel spec. 6.2 "Exception and Interrupt Vectors".
+         * IDT limit is effectively capped at 0xfff. (See Intel spec. 6.14.1 "64-Bit Mode IDT"
+         * and Intel spec. 6.2 "Exception and Interrupt Vectors".)  Therefore if the host has the limit as 0xfff, VT-x
+         * bloating the limit to 0xffff shouldn't cause any different CPU behavior.  However, several hosts either insists
+         * on 0xfff being the limit (Windows Patch Guard) or uses the limit for other purposes (darwin puts the CPU ID in there
+         * but botches sidt alignment in at least one consumer).  So, we're only allowing IDTR.LIMIT to be left at 0xffff on
+         * hosts where we are pretty sure it won't cause trouble.
          */
-        if (Idtr.cbIdt < 0x0fff)
+# if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
+        if (Idtr.cbIdt <  0x0fff)
+# else
+        if (Idtr.cbIdt != 0xffff)
+# endif
         {
             pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_IDTR;
             AssertCompile(sizeof(Idtr) == sizeof(X86XDTR64));
@@ -2532,11 +3076,9 @@ DECLINLINE(int) hmR0VmxSaveHostSegmentRegs(PVM pVM, PVMCPU pVCpu)
      * Host TR base. Verify that TR selector doesn't point past the GDT. Masking off the TI and RPL bits
      * is effectively what the CPU does for "scaling by 8". TI is always 0 and RPL should be too in most cases.
      */
-    if ((uSelTR & X86_SEL_MASK) > Gdtr.cbGdt)
-    {
-        AssertMsgFailed(("hmR0VmxSaveHostSegmentRegs: TR selector exceeds limit. TR=%RTsel cbGdt=%#x\n", uSelTR, Gdtr.cbGdt));
-        return VERR_VMX_INVALID_HOST_STATE;
-    }
+    AssertMsgReturn((uSelTR | X86_SEL_RPL_LDT) <= Gdtr.cbGdt,
+                    ("hmR0VmxSaveHostSegmentRegs: TR selector exceeds limit. TR=%RTsel cbGdt=%#x\n", uSelTR, Gdtr.cbGdt),
+                    VERR_VMX_INVALID_HOST_STATE);
 
     PCX86DESCHC pDesc = (PCX86DESCHC)(Gdtr.pGdt + (uSelTR & X86_SEL_MASK));
 #ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
@@ -2606,7 +3148,77 @@ DECLINLINE(int) hmR0VmxSaveHostSegmentRegs(PVM pVM, PVMCPU pVCpu)
 }
 
 
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
+/**
+ * Saves certain host MSRs in the VM-Exit MSR-load area and some in the
+ * host-state area of the VMCS. Theses MSRs will be automatically restored on
+ * the host after every successful VM-exit.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the VMCPU.
+ *
+ * @remarks No-long-jump zone!!!
+ */
+DECLINLINE(int) hmR0VmxSaveHostMsrs(PVM pVM, PVMCPU pVCpu)
+{
+    NOREF(pVM);
+
+    AssertPtr(pVCpu);
+    AssertPtr(pVCpu->hm.s.vmx.pvHostMsr);
+
+    int rc = VINF_SUCCESS;
+#if HC_ARCH_BITS == 64
+    if (pVM->hm.s.fAllow64BitGuests)
+        hmR0VmxLazySaveHostMsrs(pVCpu);
+#endif
+
+    /*
+     * Host Sysenter MSRs.
+     */
+    rc = VMXWriteVmcs32(VMX_VMCS32_HOST_SYSENTER_CS,        ASMRdMsr_Low(MSR_IA32_SYSENTER_CS));
+    AssertRCReturn(rc, rc);
+#ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
+    if (HMVMX_IS_64BIT_HOST_MODE())
+    {
+        rc = VMXWriteVmcs64(VMX_VMCS_HOST_SYSENTER_ESP,     ASMRdMsr(MSR_IA32_SYSENTER_ESP));
+        AssertRCReturn(rc, rc);
+        rc = VMXWriteVmcs64(VMX_VMCS_HOST_SYSENTER_EIP,     ASMRdMsr(MSR_IA32_SYSENTER_EIP));
+    }
+    else
+    {
+        rc = VMXWriteVmcs32(VMX_VMCS_HOST_SYSENTER_ESP,     ASMRdMsr_Low(MSR_IA32_SYSENTER_ESP));
+        AssertRCReturn(rc, rc);
+        rc = VMXWriteVmcs32(VMX_VMCS_HOST_SYSENTER_EIP,     ASMRdMsr_Low(MSR_IA32_SYSENTER_EIP));
+    }
+#elif HC_ARCH_BITS == 32
+    rc = VMXWriteVmcs32(VMX_VMCS_HOST_SYSENTER_ESP,         ASMRdMsr_Low(MSR_IA32_SYSENTER_ESP));
+    AssertRCReturn(rc, rc);
+    rc = VMXWriteVmcs32(VMX_VMCS_HOST_SYSENTER_EIP,         ASMRdMsr_Low(MSR_IA32_SYSENTER_EIP));
+#else
+    rc = VMXWriteVmcs64(VMX_VMCS_HOST_SYSENTER_ESP,         ASMRdMsr(MSR_IA32_SYSENTER_ESP));
+    AssertRCReturn(rc, rc);
+    rc = VMXWriteVmcs64(VMX_VMCS_HOST_SYSENTER_EIP,         ASMRdMsr(MSR_IA32_SYSENTER_EIP));
+#endif
+    AssertRCReturn(rc, rc);
+
+    /*
+     * Host EFER MSR.
+     * If the CPU supports the newer VMCS controls for managing EFER, use it.
+     * Otherwise it's done as part of auto-load/store MSR area in the VMCS, see hmR0VmxLoadGuestMsrs().
+     */
+    if (pVM->hm.s.vmx.fSupportsVmcsEfer)
+    {
+        rc = VMXWriteVmcs64(VMX_VMCS64_HOST_FIELD_EFER_FULL, pVM->hm.s.vmx.u64HostEfer);
+        AssertRCReturn(rc, rc);
+    }
+
+    /** @todo IA32_PERF_GLOBALCTRL, IA32_PAT also see
+     *        hmR0VmxLoadGuestExitCtls() !! */
+
+    return rc;
+}
+
+
 /**
  * Figures out if we need to swap the EFER MSR which is
  * particularly expensive.
@@ -2652,220 +3264,22 @@ static bool hmR0VmxShouldSwapEferMsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     }
 
     /*
-     * If the guest uses PAE and EFER.NXE bit differs, we need to swap EFER as it                    .
+     * If the guest uses PAE and EFER.NXE bit differs, we need to swap EFER as it
      * affects guest paging. 64-bit paging implies CR4.PAE as well.
      * See Intel spec. 4.5 "IA-32e Paging" and Intel spec. 4.1.1 "Three Paging Modes".
      */
     if (   (pMixedCtx->cr4 & X86_CR4_PAE)
         && (pMixedCtx->cr0 & X86_CR0_PG)
-        && (u64GuestEfer & MSR_K6_EFER_NXE) != (u64HostEfer & MSR_K6_EFER_NXE))
-    {
-        /* Assert that host is PAE capable. */
-        Assert(pVM->hm.s.cpuid.u32AMDFeatureEDX & X86_CPUID_EXT_FEATURE_EDX_NX);
-        return true;
-    }
-
-    /** @todo Check the latest Intel spec. for any other bits,
-     *        like SMEP/SMAP? */
-    return false;
-}
-
-
-/**
- * Adds a new (or updates the value of an existing) host MSR to
- * be swapped during the world-switch as part of the
- * auto-load/store MSR area in the VMCS.
- *
- * @param   pVCpu           Pointer to the VMCPU.
- * @param   uMsr            The MSR.
- * @param   uHostMsr        Value of the host MSR.
- */
-static int hmR0VmxAddAutoLoadStoreHostMsr(PVMCPU pVCpu, uint32_t uMsr, uint64_t uHostMsrValue)
-{
-    PVMXAUTOMSR pHostMsr  = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvHostMsr;
-    uint32_t    cMsrs     = pVCpu->hm.s.vmx.cHostMsrs;
-    uint32_t    i;
-    for (i = 0; i < cMsrs; i++)
-    {
-        if (pHostMsr->u32Msr == uMsr)
-            break;
-        pHostMsr++;
-    }
-
-    if (i == cMsrs)
-    {
-        ++cMsrs;
-
-        /* Shouldn't ever happen but there -is- a number. We're well within the recommended 512. */
-        PVM pVM = pVCpu->CTX_SUFF(pVM);
-        if (RT_UNLIKELY(cMsrs > MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.Msrs.u64Misc)))
-        {
-            LogRel(("cHostMsrs=%u Cpu=%u\n", cMsrs, (unsigned)MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.Msrs.u64Misc)));
-            pVCpu->hm.s.u32HMError = VMX_UFC_INSUFFICIENT_HOST_MSR_STORAGE;
-            return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
-        }
-
-        /* Update VCPU's copy of the host MSR count. */
-        pVCpu->hm.s.vmx.cHostMsrs = cMsrs;
-        int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT, cMsrs);
-        AssertRCReturn(rc, rc);
-    }
-
-    /* Update the MSR values in the auto-load/store MSR area. */
-    pHostMsr->u32Msr      = uMsr;
-    pHostMsr->u32Reserved = 0;
-    pHostMsr->u64Value    = uHostMsrValue;
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Removes a host MSR to be swapped during the world-switch from the
- * auto-load/store MSR area in the VMCS.
- *
- * @returns VBox status code.
- * @param   pVCpu       Pointer to the VMCPU.
- * @param   uMsr        The MSR.
- */
-static int hmR0VmxRemoveAutoLoadStoreHostMsr(PVMCPU pVCpu, uint32_t uMsr)
-{
-    PVMXAUTOMSR pHostMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvHostMsr;
-    uint32_t    cMsrs     = pVCpu->hm.s.vmx.cHostMsrs;
-    for (uint32_t i = 0; i < cMsrs; i++)
-    {
-        /* Find the MSR. */
-        if (pHostMsr->u32Msr == uMsr)
-        {
-            /* If it's the last MSR, simply reduce the count. */
-            if (i == cMsrs - 1)
-            {
-                --cMsrs;
-                break;
-            }
-
-            /* Remove it by swapping the last MSR in place of it, and reducing the count. */
-            PVMXAUTOMSR pLastHostMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvHostMsr;
-            pLastHostMsr            += cMsrs - 1;
-            pHostMsr->u32Msr         = pLastHostMsr->u32Msr;
-            pHostMsr->u64Value       = pLastHostMsr->u64Value;
-            --cMsrs;
-            break;
-        }
-        pHostMsr++;
-    }
-
-    /* Update the VMCS if the count changed (meaning the MSR was found). */
-    if (cMsrs != pVCpu->hm.s.vmx.cHostMsrs)
-    {
-        /* Shouldn't ever happen but there -is- a number. We're well within the recommended 512. */
-        PVM pVM = pVCpu->CTX_SUFF(pVM);
-        if (RT_UNLIKELY(cMsrs > MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.Msrs.u64Misc)))
-        {
-            LogRel(("cHostMsrs=%u Cpu=%u\n", cMsrs, (unsigned)MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.Msrs.u64Misc)));
-            pVCpu->hm.s.u32HMError = VMX_UFC_INSUFFICIENT_HOST_MSR_STORAGE;
-            return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
-        }
-
-        /* Update VCPU's copy of the host MSR count. */
-        pVCpu->hm.s.vmx.cHostMsrs = cMsrs;
-        int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_LOAD_COUNT, cMsrs);
-        AssertRCReturn(rc, rc);
-        return VINF_SUCCESS;
-    }
-
-    return VERR_NOT_FOUND;
-}
-#endif /* VBOX_WITH_AUTO_MSR_LOAD_RESTORE */
-
-
-/**
- * Saves certain host MSRs in the VM-Exit MSR-load area and some in the
- * host-state area of the VMCS. Theses MSRs will be automatically restored on
- * the host after every successful VM exit.
- *
- * @returns VBox status code.
- * @param   pVM         Pointer to the VM.
- * @param   pVCpu       Pointer to the VMCPU.
- */
-DECLINLINE(int) hmR0VmxSaveHostMsrs(PVM pVM, PVMCPU pVCpu)
-{
-    AssertPtr(pVCpu);
-    AssertPtr(pVCpu->hm.s.vmx.pvHostMsr);
-
-    int rc = VINF_SUCCESS;
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-    uint32_t u32HostExtFeatures = pVM->hm.s.cpuid.u32AMDFeatureEDX;
-    if (u32HostExtFeatures & (X86_CPUID_EXT_FEATURE_EDX_NX | X86_CPUID_EXT_FEATURE_EDX_LONG_MODE))
-    {
-        uint64_t u64HostEfer = pVM->hm.s.vmx.u64HostEfer;
-# if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
-        if (   HMVMX_IS_64BIT_HOST_MODE()
-            && pVM->hm.s.vmx.fSupportsVmcsEfer)
-        {
-            rc = VMXWriteVmcs64(VMX_VMCS64_HOST_FIELD_EFER_FULL, pVM->hm.s.vmx.u64HostEfer);
-            AssertRCReturn(rc, rc);
-        }
-        /* else if: !HMVMX_IS_64BIT_HOST_MODE()
-           VMXR0SetupVM() ensures darwin 32-bit/PAE kernels can't execute 64-bit guests. */
-# elif HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
-        if (CPUMIsGuestInLongMode(pVCpu))
-        {
-            /* Must match the EFER value in our 64 bits switcher. */
-            u64HostEfer |= MSR_K6_EFER_LME | MSR_K6_EFER_SCE | MSR_K6_EFER_NXE;
-        }
-        hmR0VmxAddAutoLoadStoreHostMsr(pVCpu, MSR_K6_EFER, u64HostEfer);
-# endif  /* HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL) */
-    }
-
-# if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
-    if (   HMVMX_IS_64BIT_HOST_MODE()
-        && pVM->hm.s.fAllow64BitGuests)
-    {
-        hmR0VmxAddAutoLoadStoreHostMsr(pVCpu, MSR_K6_STAR,           ASMRdMsr(MSR_K6_STAR));
-        hmR0VmxAddAutoLoadStoreHostMsr(pVCpu, MSR_K8_LSTAR,          ASMRdMsr(MSR_K8_LSTAR));
-        hmR0VmxAddAutoLoadStoreHostMsr(pVCpu, MSR_K8_SF_MASK,        ASMRdMsr(MSR_K8_SF_MASK));
-        hmR0VmxAddAutoLoadStoreHostMsr(pVCpu, MSR_K8_KERNEL_GS_BASE, ASMRdMsr(MSR_K8_KERNEL_GS_BASE));
-    }
-# endif
-
-    /* Host TSC AUX MSR must be restored since we always load/store guest TSC AUX MSR. */
-    if (pVCpu->hm.s.vmx.u32ProcCtls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP)
-        hmR0VmxAddAutoLoadStoreHostMsr(pVCpu, MSR_K8_TSC_AUX, ASMRdMsr(MSR_K8_TSC_AUX));
-    Log4(("hmR0VmxSaveHostMsrs: cHostMSrs=%u\n", pVCpu->hm.s.vmx.cHostMsrs));
-#endif  /* VBOX_WITH_AUTO_MSR_LOAD_RESTORE */
-
-    /*
-     * Host Sysenter MSRs.
-     */
-    rc = VMXWriteVmcs32(VMX_VMCS32_HOST_SYSENTER_CS,        ASMRdMsr_Low(MSR_IA32_SYSENTER_CS));
-    AssertRCReturn(rc, rc);
-#ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
-    if (HMVMX_IS_64BIT_HOST_MODE())
-    {
-        rc = VMXWriteVmcs64(VMX_VMCS_HOST_SYSENTER_ESP,     ASMRdMsr(MSR_IA32_SYSENTER_ESP));
-        AssertRCReturn(rc, rc);
-        rc = VMXWriteVmcs64(VMX_VMCS_HOST_SYSENTER_EIP,     ASMRdMsr(MSR_IA32_SYSENTER_EIP));
-    }
-    else
-    {
-        rc = VMXWriteVmcs32(VMX_VMCS_HOST_SYSENTER_ESP,     ASMRdMsr_Low(MSR_IA32_SYSENTER_ESP));
-        AssertRCReturn(rc, rc);
-        rc = VMXWriteVmcs32(VMX_VMCS_HOST_SYSENTER_EIP,     ASMRdMsr_Low(MSR_IA32_SYSENTER_EIP));
-    }
-#elif HC_ARCH_BITS == 32
-    rc = VMXWriteVmcs32(VMX_VMCS_HOST_SYSENTER_ESP,         ASMRdMsr_Low(MSR_IA32_SYSENTER_ESP));
-    AssertRCReturn(rc, rc);
-    rc = VMXWriteVmcs32(VMX_VMCS_HOST_SYSENTER_EIP,         ASMRdMsr_Low(MSR_IA32_SYSENTER_EIP));
-#else
-    rc = VMXWriteVmcs64(VMX_VMCS_HOST_SYSENTER_ESP,         ASMRdMsr(MSR_IA32_SYSENTER_ESP));
-    AssertRCReturn(rc, rc);
-    rc = VMXWriteVmcs64(VMX_VMCS_HOST_SYSENTER_EIP,         ASMRdMsr(MSR_IA32_SYSENTER_EIP));
-#endif
-    AssertRCReturn(rc, rc);
+        && (u64GuestEfer & MSR_K6_EFER_NXE) != (u64HostEfer & MSR_K6_EFER_NXE))
+    {
+        /* Assert that host is PAE capable. */
+        Assert(pVM->hm.s.cpuid.u32AMDFeatureEDX & X86_CPUID_EXT_FEATURE_EDX_NX);
+        return true;
+    }
 
-    /** @todo IA32_PERF_GLOBALCTRL, IA32_PAT also
-     *        see hmR0VmxSetupExitCtls() !! */
-    return rc;
+    /** @todo Check the latest Intel spec. for any other bits,
+     *        like SMEP/SMAP? */
+    return false;
 }
 
 
@@ -2880,6 +3294,7 @@ DECLINLINE(int) hmR0VmxSaveHostMsrs(PVM pVM, PVMCPU pVCpu)
  *                      out-of-sync. Make sure to update the required fields
  *                      before using them.
  *
+ * @remarks Requires EFER.
  * @remarks No-long-jump zone!!!
  */
 DECLINLINE(int) hmR0VmxLoadGuestEntryCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
@@ -2898,7 +3313,7 @@ DECLINLINE(int) hmR0VmxLoadGuestEntryCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         if (CPUMIsGuestInLongModeEx(pMixedCtx))
         {
             val |= VMX_VMCS_CTRL_ENTRY_IA32E_MODE_GUEST;
-            Log4(("Load: VMX_VMCS_CTRL_ENTRY_IA32E_MODE_GUEST\n"));
+            Log4(("Load[%RU32]: VMX_VMCS_CTRL_ENTRY_IA32E_MODE_GUEST\n", pVCpu->idCpu));
         }
         else
             Assert(!(val & VMX_VMCS_CTRL_ENTRY_IA32E_MODE_GUEST));
@@ -2908,7 +3323,7 @@ DECLINLINE(int) hmR0VmxLoadGuestEntryCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
             && hmR0VmxShouldSwapEferMsr(pVCpu, pMixedCtx))
         {
             val |= VMX_VMCS_CTRL_ENTRY_LOAD_GUEST_EFER_MSR;
-            Log4(("Load: VMX_VMCS_CTRL_ENTRY_LOAD_GUEST_EFER_MSR\n"));
+            Log4(("Load[%RU32]: VMX_VMCS_CTRL_ENTRY_LOAD_GUEST_EFER_MSR\n", pVCpu->idCpu));
         }
 
         /*
@@ -2931,7 +3346,6 @@ DECLINLINE(int) hmR0VmxLoadGuestEntryCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY, val);
         AssertRCReturn(rc, rc);
 
-        /* Update VCPU with the currently set VM-exit controls. */
         pVCpu->hm.s.vmx.u32EntryCtls = val;
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_VMX_ENTRY_CTLS);
     }
@@ -2949,10 +3363,12 @@ DECLINLINE(int) hmR0VmxLoadGuestEntryCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  *                      out-of-sync. Make sure to update the required fields
  *                      before using them.
  *
- * @remarks requires EFER.
+ * @remarks Requires EFER.
  */
 DECLINLINE(int) hmR0VmxLoadGuestExitCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
+    NOREF(pMixedCtx);
+
     int rc = VINF_SUCCESS;
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_VMX_EXIT_CTLS))
     {
@@ -2971,7 +3387,7 @@ DECLINLINE(int) hmR0VmxLoadGuestExitCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         if (HMVMX_IS_64BIT_HOST_MODE())
         {
             val |= VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE;
-            Log4(("Load: VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE\n"));
+            Log4(("Load[%RU32]: VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE\n", pVCpu->idCpu));
         }
         else
             Assert(!(val & VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE));
@@ -2980,7 +3396,7 @@ DECLINLINE(int) hmR0VmxLoadGuestExitCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         {
             /* The switcher returns to long mode, EFER is managed by the switcher. */
             val |= VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE;
-            Log4(("Load: VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE\n"));
+            Log4(("Load[%RU32]: VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE\n", pVCpu->idCpu));
         }
         else
             Assert(!(val & VMX_VMCS_CTRL_EXIT_HOST_ADDR_SPACE_SIZE));
@@ -2992,7 +3408,7 @@ DECLINLINE(int) hmR0VmxLoadGuestExitCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         {
             val |=   VMX_VMCS_CTRL_EXIT_SAVE_GUEST_EFER_MSR
                    | VMX_VMCS_CTRL_EXIT_LOAD_HOST_EFER_MSR;
-            Log4(("Load: VMX_VMCS_CTRL_EXIT_SAVE_GUEST_EFER_MSR, VMX_VMCS_CTRL_EXIT_LOAD_HOST_EFER_MSR\n"));
+            Log4(("Load[%RU32]: VMX_VMCS_CTRL_EXIT_SAVE_GUEST_EFER_MSR, VMX_VMCS_CTRL_EXIT_LOAD_HOST_EFER_MSR\n", pVCpu->idCpu));
         }
 
         /* Don't acknowledge external interrupts on VM-exit. We want to let the host do that. */
@@ -3017,7 +3433,6 @@ DECLINLINE(int) hmR0VmxLoadGuestExitCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT, val);
         AssertRCReturn(rc, rc);
 
-        /* Update VCPU with the currently set VM-exit controls. */
         pVCpu->hm.s.vmx.u32ExitCtls = val;
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_VMX_EXIT_CTLS);
     }
@@ -3037,6 +3452,8 @@ DECLINLINE(int) hmR0VmxLoadGuestExitCtls(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 DECLINLINE(int) hmR0VmxLoadGuestApicState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
+    NOREF(pMixedCtx);
+
     int rc = VINF_SUCCESS;
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_VMX_GUEST_APIC_STATE))
     {
@@ -3091,13 +3508,11 @@ DECLINLINE(int) hmR0VmxLoadGuestApicState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  *                      before using them.
  *
  * @remarks No-long-jump zone!!!
- * @remarks Has side-effects with VMCPU_FF_INHIBIT_INTERRUPTS force-flag.
  */
 DECLINLINE(uint32_t) hmR0VmxGetGuestIntrState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
     /*
-     * Instructions like STI and MOV SS inhibit interrupts till the next instruction completes. Check if we should
-     * inhibit interrupts or clear any existing interrupt-inhibition.
+     * Check if we should inhibit interrupt delivery due to instructions like STI and MOV SS.
      */
     uint32_t uIntrState = 0;
     if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
@@ -3105,19 +3520,29 @@ DECLINLINE(uint32_t) hmR0VmxGetGuestIntrState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         /* If inhibition is active, RIP & RFLAGS should've been accessed (i.e. read previously from the VMCS or from ring-3). */
         AssertMsg(HMVMXCPU_GST_IS_SET(pVCpu, HMVMX_UPDATED_GUEST_RIP | HMVMX_UPDATED_GUEST_RFLAGS),
                   ("%#x\n", HMVMXCPU_GST_VALUE(pVCpu)));
-        if (pMixedCtx->rip != EMGetInhibitInterruptsPC(pVCpu))
+        if (pMixedCtx->rip == EMGetInhibitInterruptsPC(pVCpu))
         {
-            /*
-             * We can clear the inhibit force flag as even if we go back to the recompiler without executing guest code in
-             * VT-x, the flag's condition to be cleared is met and thus the cleared state is correct.
-             */
-            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
+            if (pMixedCtx->eflags.Bits.u1IF)
+                uIntrState = VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI;
+            else
+                uIntrState = VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS;
         }
-        else if (pMixedCtx->eflags.Bits.u1IF)
-            uIntrState = VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI;
-        else
-            uIntrState = VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS;
+        /* else: Although we can clear the force-flag here, let's keep this side-effects free. */
+    }
+
+    /*
+     * NMIs to the guest are blocked after an NMI is injected until the guest executes an IRET. We only
+     * bother with virtual-NMI blocking when we have support for virtual NMIs in the CPU, otherwise
+     * setting this would block host-NMIs and IRET will not clear the blocking.
+     *
+     * See Intel spec. 26.6.1 "Interruptibility state". See @bugref{7445}.
+     */
+    if (   VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS)
+        && (pVCpu->hm.s.vmx.u32PinCtls & VMX_VMCS_CTRL_PIN_EXEC_VIRTUAL_NMI))
+    {
+        uIntrState |= VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_NMI;
     }
+
     return uIntrState;
 }
 
@@ -3132,6 +3557,7 @@ DECLINLINE(uint32_t) hmR0VmxGetGuestIntrState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 static int hmR0VmxLoadGuestIntrState(PVMCPU pVCpu, uint32_t uIntrState)
 {
+    NOREF(pVCpu);
     AssertMsg(!(uIntrState & 0xfffffff0), ("%#x\n", uIntrState));   /* Bits 31:4 MBZ. */
     Assert((uIntrState & 0x3) != 0x3);                              /* Block-by-STI and MOV SS cannot be simultaneously set. */
     int rc = VMXWriteVmcs32(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE, uIntrState);
@@ -3141,6 +3567,42 @@ static int hmR0VmxLoadGuestIntrState(PVMCPU pVCpu, uint32_t uIntrState)
 
 
 /**
+ * Loads the exception intercepts required for guest execution in the VMCS.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pMixedCtx   Pointer to the guest-CPU context. The data may be
+ *                      out-of-sync. Make sure to update the required fields
+ *                      before using them.
+ */
+static int hmR0VmxLoadGuestXcptIntercepts(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
+{
+    NOREF(pMixedCtx);
+    int rc = VINF_SUCCESS;
+    if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS))
+    {
+        /* The remaining exception intercepts are handled elsewhere, e.g. in hmR0VmxLoadSharedCR0(). */
+        if (pVCpu->hm.s.fGIMTrapXcptUD)
+            pVCpu->hm.s.vmx.u32XcptBitmap |= RT_BIT(X86_XCPT_UD);
+        else
+        {
+#ifndef HMVMX_ALWAYS_TRAP_ALL_XCPTS
+            pVCpu->hm.s.vmx.u32XcptBitmap &= ~RT_BIT(X86_XCPT_UD);
+#endif
+        }
+
+        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXCEPTION_BITMAP, pVCpu->hm.s.vmx.u32XcptBitmap);
+        AssertRCReturn(rc, rc);
+
+        HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
+        Log4(("Load[%RU32]: VMX_VMCS32_CTRL_EXCEPTION_BITMAP=%#RX64 fContextUseFlags=%#RX32\n", pVCpu->idCpu,
+              pVCpu->hm.s.vmx.u32XcptBitmap, HMCPU_CF_VALUE(pVCpu)));
+    }
+    return rc;
+}
+
+
+/**
  * Loads the guest's RIP into the guest-state area in the VMCS.
  *
  * @returns VBox status code.
@@ -3160,7 +3622,8 @@ static int hmR0VmxLoadGuestRip(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         AssertRCReturn(rc, rc);
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_RIP);
-        Log4(("Load: VMX_VMCS_GUEST_RIP=%#RX64 fContextUseFlags=%#RX32\n", pMixedCtx->rip, HMCPU_CF_VALUE(pVCpu)));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_RIP=%#RX64 fContextUseFlags=%#RX32\n", pVCpu->idCpu, pMixedCtx->rip,
+              HMCPU_CF_VALUE(pVCpu)));
     }
     return rc;
 }
@@ -3186,7 +3649,7 @@ static int hmR0VmxLoadGuestRsp(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         AssertRCReturn(rc, rc);
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_RSP);
-        Log4(("Load: VMX_VMCS_GUEST_RSP=%#RX64\n", pMixedCtx->rsp));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_RSP=%#RX64\n", pVCpu->idCpu, pMixedCtx->rsp));
     }
     return rc;
 }
@@ -3212,11 +3675,18 @@ static int hmR0VmxLoadGuestRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
            Let us assert it as such and use 32-bit VMWRITE. */
         Assert(!(pMixedCtx->rflags.u64 >> 32));
         X86EFLAGS Eflags = pMixedCtx->eflags;
+        /** @todo r=bird: There shall be no need to OR in X86_EFL_1 here, nor
+         * shall there be any reason for clearing bits 63:22, 15, 5 and 3.
+         * These will never be cleared/set, unless some other part of the VMM
+         * code is buggy - in which case we're better of finding and fixing
+         * those bugs than hiding them. */
+        Assert(Eflags.u32 & X86_EFL_RA1_MASK);
+        Assert(!(Eflags.u32 & ~(X86_EFL_1 | X86_EFL_LIVE_MASK)));
         Eflags.u32 &= VMX_EFLAGS_RESERVED_0;                   /* Bits 22-31, 15, 5 & 3 MBZ. */
         Eflags.u32 |= VMX_EFLAGS_RESERVED_1;                   /* Bit 1 MB1. */
 
         /*
-         * If we're emulating real-mode using Virtual 8086 mode, save the real-mode eflags so we can restore them on VM exit.
+         * If we're emulating real-mode using Virtual 8086 mode, save the real-mode eflags so we can restore them on VM-exit.
          * Modify the real-mode guest's eflags so that VT-x can run the real-mode guest code under Virtual 8086 mode.
          */
         if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
@@ -3232,7 +3702,7 @@ static int hmR0VmxLoadGuestRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         AssertRCReturn(rc, rc);
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_RFLAGS);
-        Log4(("Load: VMX_VMCS_GUEST_RFLAGS=%#RX32\n", Eflags.u32));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_RFLAGS=%#RX32\n", pVCpu->idCpu, Eflags.u32));
     }
     return rc;
 }
@@ -3290,7 +3760,7 @@ static int hmR0VmxLoadSharedCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         /* The guest's view (read access) of its CR0 is unblemished. */
         rc  = VMXWriteVmcs32(VMX_VMCS_CTRL_CR0_READ_SHADOW, u32GuestCR0);
         AssertRCReturn(rc, rc);
-        Log4(("Load: VMX_VMCS_CTRL_CR0_READ_SHADOW=%#RX32\n", u32GuestCR0));
+        Log4(("Load[%RU32]: VMX_VMCS_CTRL_CR0_READ_SHADOW=%#RX32\n", pVCpu->idCpu, u32GuestCR0));
 
         /* Setup VT-x's view of the guest CR0. */
         /* Minimize VM-exits due to CR3 changes when we have NestedPaging. */
@@ -3298,13 +3768,13 @@ static int hmR0VmxLoadSharedCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         {
             if (CPUMIsGuestPagingEnabledEx(pMixedCtx))
             {
-                /* The guest has paging enabled, let it access CR3 without causing a VM exit if supported. */
+                /* The guest has paging enabled, let it access CR3 without causing a VM-exit if supported. */
                 pVCpu->hm.s.vmx.u32ProcCtls &= ~(  VMX_VMCS_CTRL_PROC_EXEC_CR3_LOAD_EXIT
                                                  | VMX_VMCS_CTRL_PROC_EXEC_CR3_STORE_EXIT);
             }
             else
             {
-                /* The guest doesn't have paging enabled, make CR3 access to cause VM exits to update our shadow. */
+                /* The guest doesn't have paging enabled, make CR3 access cause a VM-exit to update our shadow. */
                 pVCpu->hm.s.vmx.u32ProcCtls |=   VMX_VMCS_CTRL_PROC_EXEC_CR3_LOAD_EXIT
                                                | VMX_VMCS_CTRL_PROC_EXEC_CR3_STORE_EXIT;
             }
@@ -3354,7 +3824,11 @@ static int hmR0VmxLoadSharedCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
             fInterceptMF = true;
         }
         else
+        {
+            /* For now, cleared here as mode-switches can happen outside HM/VT-x. See @bugref{7626} comment #11. */
             pVCpu->hm.s.vmx.u32XcptBitmap &= ~HMVMX_REAL_MODE_XCPT_MASK;
+        }
+        HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
 
         if (fInterceptNM)
             pVCpu->hm.s.vmx.u32XcptBitmap |= RT_BIT(X86_XCPT_NM);
@@ -3373,6 +3847,7 @@ static int hmR0VmxLoadSharedCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
                                          | RT_BIT(X86_XCPT_DB)
                                          | RT_BIT(X86_XCPT_DE)
                                          | RT_BIT(X86_XCPT_NM)
+                                         | RT_BIT(X86_XCPT_TS)
                                          | RT_BIT(X86_XCPT_UD)
                                          | RT_BIT(X86_XCPT_NP)
                                          | RT_BIT(X86_XCPT_SS)
@@ -3398,12 +3873,11 @@ static int hmR0VmxLoadSharedCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         u32GuestCR0 &= uZapCR0;
         u32GuestCR0 &= ~(X86_CR0_CD | X86_CR0_NW);          /* Always enable caching. */
 
-        /* Write VT-x's view of the guest CR0 into the VMCS and update the exception bitmap. */
+        /* Write VT-x's view of the guest CR0 into the VMCS. */
         rc = VMXWriteVmcs32(VMX_VMCS_GUEST_CR0, u32GuestCR0);
         AssertRCReturn(rc, rc);
-        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXCEPTION_BITMAP, pVCpu->hm.s.vmx.u32XcptBitmap);
-        AssertRCReturn(rc, rc);
-        Log4(("Load: VMX_VMCS_GUEST_CR0=%#RX32 (uSetCR0=%#RX32 uZapCR0=%#RX32)\n", u32GuestCR0, uSetCR0, uZapCR0));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_CR0=%#RX32 (uSetCR0=%#RX32 uZapCR0=%#RX32)\n", pVCpu->idCpu, u32GuestCR0, uSetCR0,
+              uZapCR0));
 
         /*
          * CR0 is shared between host and guest along with a CR0 read shadow. Therefore, certain bits must not be changed
@@ -3440,7 +3914,7 @@ static int hmR0VmxLoadSharedCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         pVCpu->hm.s.vmx.u32CR0Mask = u32CR0Mask;
         rc = VMXWriteVmcs32(VMX_VMCS_CTRL_CR0_MASK, u32CR0Mask);
         AssertRCReturn(rc, rc);
-        Log4(("Load: VMX_VMCS_CTRL_CR0_MASK=%#RX32\n", u32CR0Mask));
+        Log4(("Load[%RU32]: VMX_VMCS_CTRL_CR0_MASK=%#RX32\n", pVCpu->idCpu, u32CR0Mask));
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_CR0);
     }
@@ -3497,7 +3971,7 @@ static int hmR0VmxLoadGuestCR3AndCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 
             rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_EPTP_FULL, pVCpu->hm.s.vmx.HCPhysEPTP);
             AssertRCReturn(rc, rc);
-            Log4(("Load: VMX_VMCS64_CTRL_EPTP_FULL=%#RX64\n", pVCpu->hm.s.vmx.HCPhysEPTP));
+            Log4(("Load[%RU32]: VMX_VMCS64_CTRL_EPTP_FULL=%#RX64\n", pVCpu->idCpu, pVCpu->hm.s.vmx.HCPhysEPTP));
 
             if (   pVM->hm.s.vmx.fUnrestrictedGuest
                 || CPUMIsGuestPagingEnabledEx(pMixedCtx))
@@ -3534,7 +4008,7 @@ static int hmR0VmxLoadGuestCR3AndCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
                 GCPhysGuestCR3 = GCPhys;
             }
 
-            Log4(("Load: VMX_VMCS_GUEST_CR3=%#RGv (GstN)\n", GCPhysGuestCR3));
+            Log4(("Load[%RU32]: VMX_VMCS_GUEST_CR3=%#RGv (GstN)\n", pVCpu->idCpu, GCPhysGuestCR3));
             rc = VMXWriteVmcsGstN(VMX_VMCS_GUEST_CR3, GCPhysGuestCR3);
         }
         else
@@ -3542,7 +4016,7 @@ static int hmR0VmxLoadGuestCR3AndCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
             /* Non-nested paging case, just use the hypervisor's CR3. */
             RTHCPHYS HCPhysGuestCR3 = PGMGetHyperCR3(pVCpu);
 
-            Log4(("Load: VMX_VMCS_GUEST_CR3=%#RHv (HstN)\n", HCPhysGuestCR3));
+            Log4(("Load[%RU32]: VMX_VMCS_GUEST_CR3=%#RHv (HstN)\n", pVCpu->idCpu, HCPhysGuestCR3));
             rc = VMXWriteVmcsHstN(VMX_VMCS_GUEST_CR3, HCPhysGuestCR3);
         }
         AssertRCReturn(rc, rc);
@@ -3552,6 +4026,7 @@ static int hmR0VmxLoadGuestCR3AndCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 
     /*
      * Guest CR4.
+     * ASSUMES this is done everytime we get in from ring-3! (XCR0)
      */
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_CR4))
     {
@@ -3561,7 +4036,7 @@ static int hmR0VmxLoadGuestCR3AndCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         /* The guest's view of its CR4 is unblemished. */
         rc = VMXWriteVmcs32(VMX_VMCS_CTRL_CR4_READ_SHADOW, u32GuestCR4);
         AssertRCReturn(rc, rc);
-        Log4(("Load: VMX_VMCS_CTRL_CR4_READ_SHADOW=%#RX32\n", u32GuestCR4));
+        Log4(("Load[%RU32]: VMX_VMCS_CTRL_CR4_READ_SHADOW=%#RX32\n", pVCpu->idCpu, u32GuestCR4));
 
         /* Setup VT-x's view of the guest CR4. */
         /*
@@ -3583,7 +4058,7 @@ static int hmR0VmxLoadGuestCR3AndCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
             {
                 /* We use 4 MB pages in our identity mapping page table when the guest doesn't have paging. */
                 u32GuestCR4 |= X86_CR4_PSE;
-                /* Our identity mapping is a 32 bits page directory. */
+                /* Our identity mapping is a 32-bit page directory. */
                 u32GuestCR4 &= ~X86_CR4_PAE;
             }
             /* else use guest CR4.*/
@@ -3629,21 +4104,25 @@ static int hmR0VmxLoadGuestCR3AndCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         u32GuestCR4 &= uZapCR4;
 
         /* Write VT-x's view of the guest CR4 into the VMCS. */
-        Log4(("Load: VMX_VMCS_GUEST_CR4=%#RX32 (Set=%#RX32 Zap=%#RX32)\n", u32GuestCR4, uSetCR4, uZapCR4));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_CR4=%#RX32 (Set=%#RX32 Zap=%#RX32)\n", pVCpu->idCpu, u32GuestCR4, uSetCR4, uZapCR4));
         rc = VMXWriteVmcs32(VMX_VMCS_GUEST_CR4, u32GuestCR4);
         AssertRCReturn(rc, rc);
 
-        /* Setup CR4 mask. CR4 flags owned by the host, if the guest attempts to change them, that would cause a VM exit. */
-        uint32_t u32CR4Mask = 0;
-        u32CR4Mask =  X86_CR4_VME
-                    | X86_CR4_PAE
-                    | X86_CR4_PGE
-                    | X86_CR4_PSE
-                    | X86_CR4_VMXE;
+        /* Setup CR4 mask. CR4 flags owned by the host, if the guest attempts to change them, that would cause a VM-exit. */
+        uint32_t u32CR4Mask = X86_CR4_VME
+                            | X86_CR4_PAE
+                            | X86_CR4_PGE
+                            | X86_CR4_PSE
+                            | X86_CR4_VMXE;
+        if (pVM->cpum.ro.HostFeatures.fXSaveRstor)
+            u32CR4Mask |= X86_CR4_OSXSAVE;
         pVCpu->hm.s.vmx.u32CR4Mask = u32CR4Mask;
         rc = VMXWriteVmcs32(VMX_VMCS_CTRL_CR4_MASK, u32CR4Mask);
         AssertRCReturn(rc, rc);
 
+        /* Whether to save/load/restore XCR0 during world switch depends on CR4.OSXSAVE and host+guest XCR0. */
+        pVCpu->hm.s.fLoadSaveGuestXcr0 = (pMixedCtx->cr4 & X86_CR4_OSXSAVE) && pMixedCtx->aXcr[0] != ASMGetXcr0();
+
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_CR4);
     }
     return rc;
@@ -3652,7 +4131,7 @@ static int hmR0VmxLoadGuestCR3AndCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 
 /**
  * Loads the guest debug registers into the guest-state area in the VMCS.
- * This also sets up whether #DB and MOV DRx accesses cause VM exits.
+ * This also sets up whether #DB and MOV DRx accesses cause VM-exits.
  *
  * The guest debug bits are partially shared with the host (e.g. DR6, DR0-3).
  *
@@ -3794,15 +4273,17 @@ static int hmR0VmxLoadSharedDebugState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
      */
     if (   fInterceptDB
         || pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
+    {
         pVCpu->hm.s.vmx.u32XcptBitmap |= RT_BIT(X86_XCPT_DB);
+        HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
+    }
     else
     {
 #ifndef HMVMX_ALWAYS_TRAP_ALL_XCPTS
         pVCpu->hm.s.vmx.u32XcptBitmap &= ~RT_BIT(X86_XCPT_DB);
+        HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
 #endif
     }
-    rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXCEPTION_BITMAP, pVCpu->hm.s.vmx.u32XcptBitmap);
-    AssertRCReturn(rc, rc);
 
     /*
      * Update the processor-based VM-execution controls regarding intercepting MOV DRx instructions.
@@ -4005,12 +4486,11 @@ static void hmR0VmxValidateSegmentRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
  * @param   idxBase     Index of the segment base in the VMCS.
  * @param   idxAccess   Index of the access rights of the segment in the VMCS.
  * @param   pSelReg     Pointer to the segment selector.
- * @param   pCtx        Pointer to the guest-CPU context.
  *
  * @remarks No-long-jump zone!!!
  */
 static int hmR0VmxWriteSegmentReg(PVMCPU pVCpu, uint32_t idxSel, uint32_t idxLimit, uint32_t idxBase,
-                                       uint32_t idxAccess, PCPUMSELREG pSelReg, PCPUMCTX pCtx)
+                                       uint32_t idxAccess, PCPUMSELREG pSelReg)
 {
     int rc = VMXWriteVmcs32(idxSel,    pSelReg->Sel);       /* 16-bit guest selector field. */
     AssertRCReturn(rc, rc);
@@ -4095,28 +4575,28 @@ static int hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
                 /* Signal that the recompiler must flush its code-cache as the guest -may- rewrite code it will later execute
                    in real-mode (e.g. OpenBSD 4.0) */
                 REMFlushTBs(pVM);
-                Log4(("Load: Switch to protected mode detected!\n"));
+                Log4(("Load[%RU32]: Switch to protected mode detected!\n", pVCpu->idCpu));
                 pVCpu->hm.s.vmx.fWasInRealMode = false;
             }
         }
 #endif
         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_CS, VMX_VMCS32_GUEST_CS_LIMIT, VMX_VMCS_GUEST_CS_BASE,
-                                     VMX_VMCS32_GUEST_CS_ACCESS_RIGHTS, &pMixedCtx->cs, pMixedCtx);
+                                     VMX_VMCS32_GUEST_CS_ACCESS_RIGHTS, &pMixedCtx->cs);
         AssertRCReturn(rc, rc);
         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_SS, VMX_VMCS32_GUEST_SS_LIMIT, VMX_VMCS_GUEST_SS_BASE,
-                                     VMX_VMCS32_GUEST_SS_ACCESS_RIGHTS, &pMixedCtx->ss, pMixedCtx);
+                                     VMX_VMCS32_GUEST_SS_ACCESS_RIGHTS, &pMixedCtx->ss);
         AssertRCReturn(rc, rc);
         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_DS, VMX_VMCS32_GUEST_DS_LIMIT, VMX_VMCS_GUEST_DS_BASE,
-                                     VMX_VMCS32_GUEST_DS_ACCESS_RIGHTS, &pMixedCtx->ds, pMixedCtx);
+                                     VMX_VMCS32_GUEST_DS_ACCESS_RIGHTS, &pMixedCtx->ds);
         AssertRCReturn(rc, rc);
         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_ES, VMX_VMCS32_GUEST_ES_LIMIT, VMX_VMCS_GUEST_ES_BASE,
-                                     VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS, &pMixedCtx->es, pMixedCtx);
+                                     VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS, &pMixedCtx->es);
         AssertRCReturn(rc, rc);
         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_FS, VMX_VMCS32_GUEST_FS_LIMIT, VMX_VMCS_GUEST_FS_BASE,
-                                     VMX_VMCS32_GUEST_FS_ACCESS_RIGHTS, &pMixedCtx->fs, pMixedCtx);
+                                     VMX_VMCS32_GUEST_FS_ACCESS_RIGHTS, &pMixedCtx->fs);
         AssertRCReturn(rc, rc);
         rc = hmR0VmxWriteSegmentReg(pVCpu, VMX_VMCS16_GUEST_FIELD_GS, VMX_VMCS32_GUEST_GS_LIMIT, VMX_VMCS_GUEST_GS_BASE,
-                                     VMX_VMCS32_GUEST_GS_ACCESS_RIGHTS, &pMixedCtx->gs, pMixedCtx);
+                                     VMX_VMCS32_GUEST_GS_ACCESS_RIGHTS, &pMixedCtx->gs);
         AssertRCReturn(rc, rc);
 
 #ifdef VBOX_STRICT
@@ -4125,8 +4605,8 @@ static int hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 #endif
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_SEGMENT_REGS);
-        Log4(("Load: CS=%#RX16 Base=%#RX64 Limit=%#RX32 Attr=%#RX32\n", pMixedCtx->cs.Sel, pMixedCtx->cs.u64Base,
-             pMixedCtx->cs.u32Limit, pMixedCtx->cs.Attr.u));
+        Log4(("Load[%RU32]: CS=%#RX16 Base=%#RX64 Limit=%#RX32 Attr=%#RX32\n", pVCpu->idCpu, pMixedCtx->cs.Sel,
+              pMixedCtx->cs.u64Base, pMixedCtx->cs.u32Limit, pMixedCtx->cs.Attr.u));
     }
 
     /*
@@ -4192,7 +4672,7 @@ static int hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         rc = VMXWriteVmcs32(VMX_VMCS32_GUEST_TR_ACCESS_RIGHTS, u32AccessRights);       AssertRCReturn(rc, rc);
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_TR);
-        Log4(("Load: VMX_VMCS_GUEST_TR_BASE=%#RX64\n", u64Base));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_TR_BASE=%#RX64\n", pVCpu->idCpu, u64Base));
     }
 
     /*
@@ -4207,7 +4687,7 @@ static int hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         Assert(!(pMixedCtx->gdtr.cbGdt & 0xffff0000));          /* Bits 31:16 MBZ. */
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_GDTR);
-        Log4(("Load: VMX_VMCS_GUEST_GDTR_BASE=%#RX64\n", pMixedCtx->gdtr.pGdt));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_GDTR_BASE=%#RX64\n", pVCpu->idCpu, pMixedCtx->gdtr.pGdt));
     }
 
     /*
@@ -4243,7 +4723,7 @@ static int hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         }
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_LDTR);
-        Log4(("Load: VMX_VMCS_GUEST_LDTR_BASE=%#RX64\n",  pMixedCtx->ldtr.u64Base));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_LDTR_BASE=%#RX64\n", pVCpu->idCpu, pMixedCtx->ldtr.u64Base));
     }
 
     /*
@@ -4258,7 +4738,7 @@ static int hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         Assert(!(pMixedCtx->idtr.cbIdt & 0xffff0000));          /* Bits 31:16 MBZ. */
 
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_IDTR);
-        Log4(("Load: VMX_VMCS_GUEST_IDTR_BASE=%#RX64\n", pMixedCtx->idtr.pIdt));
+        Log4(("Load[%RU32]: VMX_VMCS_GUEST_IDTR_BASE=%#RX64\n", pVCpu->idCpu, pMixedCtx->idtr.pIdt));
     }
 
     return VINF_SUCCESS;
@@ -4267,8 +4747,13 @@ static int hmR0VmxLoadGuestSegmentRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 
 /**
  * Loads certain guest MSRs into the VM-entry MSR-load and VM-exit MSR-store
- * areas. These MSRs will automatically be loaded to the host CPU on every
- * successful VM entry and stored from the host CPU on every successful VM exit.
+ * areas.
+ *
+ * These MSRs will automatically be loaded to the host CPU on every successful
+ * VM-entry and stored from the host CPU on every successful VM-exit. This also
+ * creates/updates MSR slots for the host MSRs. The actual host MSR values are
+ * -not- updated here for performance reasons. See hmR0VmxSaveHostMsrs().
+ *
  * Also loads the sysenter MSRs into the guest-state area in the VMCS.
  *
  * @returns VBox status code.
@@ -4284,82 +4769,32 @@ static int hmR0VmxLoadGuestMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     AssertPtr(pVCpu);
     AssertPtr(pVCpu->hm.s.vmx.pvGuestMsr);
 
-    PVM pVM = pVCpu->CTX_SUFF(pVM);
-
     /*
-     * When we don't have VMCS controls for managing EFER, we need to ensure we reconstruct the
-     * entire list of MSRs, otherwise we risk not removing EFER when it's no longer needed or we
-     * need to hardcode & make sure that EFER is always the last auto-load/store MSR which is ugly.
+     * MSRs that we use the auto-load/store MSR area in the VMCS.
      */
-    if (   !pVM->hm.s.vmx.fSupportsVmcsEfer
-        && HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_EFER_MSR | HM_CHANGED_VMX_GUEST_AUTO_MSRS))
-    {
-        HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_EFER_MSR | HM_CHANGED_VMX_GUEST_AUTO_MSRS);
-    }
-
-    /*
-     * MSRs covered by Auto-load/store: EFER, LSTAR, STAR, SF_MASK, TSC_AUX (RDTSCP).
-     */
-    int rc = VINF_SUCCESS;
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_VMX_GUEST_AUTO_MSRS))
     {
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-        PVMXAUTOMSR pGuestMsr  = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
-        uint32_t    cGuestMsrs = 0;
-
-        /* See Intel spec. 4.1.4 "Enumeration of Paging Features by CPUID". */
-        /** @todo r=ramshankar: Optimize this further to do lazy restoration and only
-         *        when the guest really is in 64-bit mode. */
+        /* For 64-bit hosts, we load/restore them lazily, see hmR0VmxLazyLoadGuestMsrs(). */
+#if HC_ARCH_BITS == 32 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
         if (pVM->hm.s.fAllow64BitGuests)
         {
-            pGuestMsr->u32Msr      = MSR_K6_STAR;
-            pGuestMsr->u32Reserved = 0;
-            pGuestMsr->u64Value    = pMixedCtx->msrSTAR;            /* legacy syscall eip, cs & ss */
-            pGuestMsr++; cGuestMsrs++;
-
-            pGuestMsr->u32Msr      = MSR_K8_LSTAR;
-            pGuestMsr->u32Reserved = 0;
-            pGuestMsr->u64Value    = pMixedCtx->msrLSTAR;           /* 64 bits mode syscall rip */
-            pGuestMsr++; cGuestMsrs++;
-
-            pGuestMsr->u32Msr      = MSR_K8_SF_MASK;
-            pGuestMsr->u32Reserved = 0;
-            pGuestMsr->u64Value    = pMixedCtx->msrSFMASK;          /* syscall flag mask */
-            pGuestMsr++; cGuestMsrs++;
-
-            pGuestMsr->u32Msr      = MSR_K8_KERNEL_GS_BASE;
-            pGuestMsr->u32Reserved = 0;
-            pGuestMsr->u64Value    = pMixedCtx->msrKERNELGSBASE;    /* swapgs exchange value */
-            pGuestMsr++; cGuestMsrs++;
-        }
-
-        /*
-         * RDTSCP requires the TSC_AUX MSR. Host and guest share the physical MSR. So we have to
-         * load the guest's copy always (since the MSR bitmap allows passthru unconditionally).
-         */
-        if (pVCpu->hm.s.vmx.u32ProcCtls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP)
-        {
-            pGuestMsr->u32Msr      = MSR_K8_TSC_AUX;
-            pGuestMsr->u32Reserved = 0;
-            pGuestMsr->u64Value    = CPUMR0GetGuestTscAux(pVCpu);
-            pGuestMsr++; cGuestMsrs++;
-        }
-
-        /* Shouldn't ever happen but there -is- a number. We're well within the recommended 512. */
-        if (cGuestMsrs > MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.Msrs.u64Misc))
-        {
-            LogRel(("CPU autoload/store MSR count in VMCS exceeded cGuestMsrs=%u.\n", cGuestMsrs));
-            pVCpu->hm.s.u32HMError = VMX_UFC_INSUFFICIENT_GUEST_MSR_STORAGE;
-            return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
+            int rc = VINF_SUCCESS;
+            rc |= hmR0VmxAddAutoLoadStoreMsr(pVCpu, MSR_K8_LSTAR,          pMixedCtx->msrLSTAR,        false, NULL);
+            rc |= hmR0VmxAddAutoLoadStoreMsr(pVCpu, MSR_K6_STAR,           pMixedCtx->msrSTAR,         false, NULL);
+            rc |= hmR0VmxAddAutoLoadStoreMsr(pVCpu, MSR_K8_SF_MASK,        pMixedCtx->msrSFMASK,       false, NULL);
+            rc |= hmR0VmxAddAutoLoadStoreMsr(pVCpu, MSR_K8_KERNEL_GS_BASE, pMixedCtx->msrKERNELGSBASE, false, NULL);
+            AssertRCReturn(rc, rc);
+#ifdef DEBUG
+            PVMXAUTOMSR pMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
+            for (uint32_t i = 0; i < pVCpu->hm.s.vmx.cMsrs; i++, pMsr++)
+            {
+                Log4(("Load[%RU32]: MSR[%RU32]: u32Msr=%#RX32 u64Value=%#RX64\n", pVCpu->idCpu, i, pMsr->u32Msr,
+                      pMsr->u64Value));
+            }
+# endif
         }
-
-        /* Update the VCPU's copy of the guest MSR count. */
-        pVCpu->hm.s.vmx.cGuestMsrs = cGuestMsrs;
-        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_MSR_LOAD_COUNT, cGuestMsrs);          AssertRCReturn(rc, rc);
-        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_STORE_COUNT, cGuestMsrs);          AssertRCReturn(rc, rc);
-        Log4(("Load: Auto Guest MSRs. cGUestMsrs=%u\n", pVCpu->hm.s.vmx.cGuestMsrs));
-#endif  /* VBOX_WITH_AUTO_MSR_LOAD_RESTORE */
-
+#endif
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_VMX_GUEST_AUTO_MSRS);
     }
 
@@ -4370,19 +4805,19 @@ static int hmR0VmxLoadGuestMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
      */
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_SYSENTER_CS_MSR))
     {
-        rc = VMXWriteVmcs32(VMX_VMCS32_GUEST_SYSENTER_CS, pMixedCtx->SysEnter.cs);      AssertRCReturn(rc, rc);
+        int rc = VMXWriteVmcs32(VMX_VMCS32_GUEST_SYSENTER_CS, pMixedCtx->SysEnter.cs);      AssertRCReturn(rc, rc);
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_SYSENTER_CS_MSR);
     }
 
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_SYSENTER_EIP_MSR))
     {
-        rc = VMXWriteVmcsGstN(VMX_VMCS_GUEST_SYSENTER_EIP, pMixedCtx->SysEnter.eip);    AssertRCReturn(rc, rc);
+        int rc = VMXWriteVmcsGstN(VMX_VMCS_GUEST_SYSENTER_EIP, pMixedCtx->SysEnter.eip);    AssertRCReturn(rc, rc);
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_SYSENTER_EIP_MSR);
     }
 
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_SYSENTER_ESP_MSR))
     {
-        rc = VMXWriteVmcsGstN(VMX_VMCS_GUEST_SYSENTER_ESP, pMixedCtx->SysEnter.esp);    AssertRCReturn(rc, rc);
+        int rc = VMXWriteVmcsGstN(VMX_VMCS_GUEST_SYSENTER_ESP, pMixedCtx->SysEnter.esp);    AssertRCReturn(rc, rc);
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_SYSENTER_ESP_MSR);
     }
 
@@ -4396,55 +4831,28 @@ static int hmR0VmxLoadGuestMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
              */
             if (pVM->hm.s.vmx.fSupportsVmcsEfer)
             {
-                rc = VMXWriteVmcs64(VMX_VMCS64_GUEST_EFER_FULL, pMixedCtx->msrEFER);
+                int rc = VMXWriteVmcs64(VMX_VMCS64_GUEST_EFER_FULL, pMixedCtx->msrEFER);
                 AssertRCReturn(rc,rc);
-                Log4(("Load: VMX_VMCS64_GUEST_EFER_FULL=%#RX64\n", pMixedCtx->msrEFER));
+                Log4(("Load[%RU32]: VMX_VMCS64_GUEST_EFER_FULL=%#RX64\n", pVCpu->idCpu, pMixedCtx->msrEFER));
             }
             else
             {
-                /*
-                 * Add guest EFER to the auto-load/store MSR area in the VMCS.
-                 */
-                PVMXAUTOMSR pGuestMsr  = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
-                uint32_t cGuestMsrs    = pVCpu->hm.s.vmx.cGuestMsrs;
-                pGuestMsr += cGuestMsrs;
-
-                pGuestMsr->u32Msr      = MSR_K6_EFER;
-                pGuestMsr->u32Reserved = 0;
-                pGuestMsr->u64Value    = pMixedCtx->msrEFER;
-                pGuestMsr++; cGuestMsrs++;
-
-                if (cGuestMsrs > MSR_IA32_VMX_MISC_MAX_MSR(pVM->hm.s.vmx.Msrs.u64Misc))
-                {
-                    LogRel(("CPU autoload/store MSR count in VMCS exceeded (2) cGuestMsrs=%u.\n", cGuestMsrs));
-                    pVCpu->hm.s.u32HMError = VMX_UFC_INSUFFICIENT_GUEST_MSR_STORAGE;
-                    return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
-                }
-
-                /* Update the VCPU's copy of the guest MSR count. */
-                pVCpu->hm.s.vmx.cGuestMsrs = cGuestMsrs;
-                rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_MSR_LOAD_COUNT, cGuestMsrs);          AssertRCReturn(rc, rc);
-                rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXIT_MSR_STORE_COUNT, cGuestMsrs);          AssertRCReturn(rc, rc);
-
-                Log4(("Load: MSR[--]: u32Msr=%#RX32 u64Value=%#RX64 cMsrs=%u\n", MSR_K6_EFER, pMixedCtx->msrEFER,
-                      pVCpu->hm.s.vmx.cGuestMsrs));
+                int rc = hmR0VmxAddAutoLoadStoreMsr(pVCpu, MSR_K6_EFER, pMixedCtx->msrEFER, false /* fUpdateHostMsr */,
+                                                    NULL /* pfAddedAndUpdated */);
+                AssertRCReturn(rc, rc);
 
-                /*
-                 * Add/update host EFER in the auto-load/store MSR area in the VMCS.
-                 */
-                hmR0VmxAddAutoLoadStoreHostMsr(pVCpu, MSR_K6_EFER, pVM->hm.s.vmx.u64HostEfer);
+                /* We need to intercept reads too, see @bugref{7386} comment #16. */
+                hmR0VmxSetMsrPermission(pVCpu, MSR_K6_EFER, VMXMSREXIT_INTERCEPT_READ, VMXMSREXIT_INTERCEPT_WRITE);
+                Log4(("Load[%RU32]: MSR[--]: u32Msr=%#RX32 u64Value=%#RX64 cMsrs=%u\n", pVCpu->idCpu, MSR_K6_EFER,
+                      pMixedCtx->msrEFER, pVCpu->hm.s.vmx.cMsrs));
             }
         }
         else if (!pVM->hm.s.vmx.fSupportsVmcsEfer)
-            hmR0VmxRemoveAutoLoadStoreHostMsr(pVCpu, MSR_K6_EFER);
-
-        AssertMsg(pVCpu->hm.s.vmx.cHostMsrs == pVCpu->hm.s.vmx.cGuestMsrs,
-                  ("cHostMsrs=%u cGuestMsrs=%u\n", pVCpu->hm.s.vmx.cHostMsrs, pVCpu->hm.s.vmx.cGuestMsrs));
-
+            hmR0VmxRemoveAutoLoadStoreMsr(pVCpu, MSR_K6_EFER);
         HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_EFER_MSR);
     }
 
-    return rc;
+    return VINF_SUCCESS;
 }
 
 
@@ -4461,6 +4869,7 @@ static int hmR0VmxLoadGuestMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 static int hmR0VmxLoadGuestActivityState(PVMCPU pVCpu, PCPUMCTX pCtx)
 {
+    NOREF(pCtx);
     /** @todo See if we can make use of other states, e.g.
      *        VMX_VMCS_GUEST_ACTIVITY_SHUTDOWN or HLT.  */
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_VMX_GUEST_ACTIVITY_STATE))
@@ -4497,8 +4906,14 @@ static int hmR0VmxSetupVMRunHandler(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         /* 32-bit host. We need to switch to 64-bit before running the 64-bit guest. */
         if (pVCpu->hm.s.vmx.pfnStartVM != VMXR0SwitcherStartVM64)
         {
+            if (pVCpu->hm.s.vmx.pfnStartVM != NULL) /* Very first entry would have saved host-state already, ignore it. */
+            {
+                /* Currently, all mode changes sends us back to ring-3, so these should be set. See @bugref{6944}. */
+                AssertMsg(HMCPU_CF_IS_SET(pVCpu,   HM_CHANGED_VMX_EXIT_CTLS
+                                                 | HM_CHANGED_VMX_ENTRY_CTLS
+                                                 | HM_CHANGED_GUEST_EFER_MSR), ("flags=%#x\n", HMCPU_CF_VALUE(pVCpu)));
+            }
             pVCpu->hm.s.vmx.pfnStartVM = VMXR0SwitcherStartVM64;
-            HMCPU_CF_SET(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_VMX_EXIT_CTLS | HM_CHANGED_VMX_ENTRY_CTLS);
         }
 #else
         /* 64-bit host or hybrid host. */
@@ -4511,8 +4926,14 @@ static int hmR0VmxSetupVMRunHandler(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 #if HC_ARCH_BITS == 32 && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
         if (pVCpu->hm.s.vmx.pfnStartVM != VMXR0StartVM32)
         {
+            if (pVCpu->hm.s.vmx.pfnStartVM != NULL) /* Very first entry would have saved host-state already, ignore it. */
+            {
+                /* Currently, all mode changes sends us back to ring-3, so these should be set. See @bugref{6944}. */
+                AssertMsg(HMCPU_CF_IS_SET(pVCpu,   HM_CHANGED_VMX_EXIT_CTLS
+                                                 | HM_CHANGED_VMX_ENTRY_CTLS
+                                                 | HM_CHANGED_GUEST_EFER_MSR), ("flags=%#x\n", HMCPU_CF_VALUE(pVCpu)));
+            }
             pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
-            HMCPU_CF_SET(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_VMX_EXIT_CTLS | HM_CHANGED_VMX_ENTRY_CTLS);
         }
 #else
         pVCpu->hm.s.vmx.pfnStartVM = VMXR0StartVM32;
@@ -4540,7 +4961,7 @@ DECLINLINE(int) hmR0VmxRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
      * using SSE instructions. Some XMM registers (XMM6-XMM15) are callee-saved and thus the need for this XMM wrapper.
      * Refer MSDN docs. "Configuring Programs for 64-bit / x64 Software Conventions / Register Usage" for details.
      */
-    const bool fResumeVM = RT_BOOL(pVCpu->hm.s.vmx.uVmcsState & HMVMX_VMCS_STATE_LAUNCHED);
+    bool const fResumeVM = RT_BOOL(pVCpu->hm.s.vmx.uVmcsState & HMVMX_VMCS_STATE_LAUNCHED);
     /** @todo Add stats for resume vs launch. */
 #ifdef VBOX_WITH_KERNEL_USING_XMM
     return HMR0VMXStartVMWrapXMM(fResumeVM, pCtx, &pVCpu->hm.s.vmx.VMCSCache, pVM, pVCpu, pVCpu->hm.s.vmx.pfnStartVM);
@@ -4742,9 +5163,9 @@ static void hmR0VmxReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, int rcVMRun, PC
                 if (HMVMX_IS_64BIT_HOST_MODE())
                 {
                     Log4(("MSR_K6_EFER            = %#RX64\n", ASMRdMsr(MSR_K6_EFER)));
-                    Log4(("MSR_K6_STAR            = %#RX64\n", ASMRdMsr(MSR_K6_STAR)));
-                    Log4(("MSR_K8_LSTAR           = %#RX64\n", ASMRdMsr(MSR_K8_LSTAR)));
                     Log4(("MSR_K8_CSTAR           = %#RX64\n", ASMRdMsr(MSR_K8_CSTAR)));
+                    Log4(("MSR_K8_LSTAR           = %#RX64\n", ASMRdMsr(MSR_K8_LSTAR)));
+                    Log4(("MSR_K6_STAR            = %#RX64\n", ASMRdMsr(MSR_K6_STAR)));
                     Log4(("MSR_K8_SF_MASK         = %#RX64\n", ASMRdMsr(MSR_K8_SF_MASK)));
                     Log4(("MSR_K8_KERNEL_GS_BASE  = %#RX64\n", ASMRdMsr(MSR_K8_KERNEL_GS_BASE)));
                 }
@@ -4758,7 +5179,7 @@ static void hmR0VmxReportWorldSwitchError(PVM pVM, PVMCPU pVCpu, int rcVMRun, PC
             AssertMsgFailed(("hmR0VmxReportWorldSwitchError %Rrc (%#x)\n", rcVMRun, rcVMRun));
             break;
     }
-    NOREF(pVM);
+    NOREF(pVM); NOREF(pCtx);
 }
 
 
@@ -4813,16 +5234,16 @@ static bool hmR0VmxIsValidReadField(uint32_t idxField)
  * @param   pVCpu       Pointer to the VMCPU.
  * @param   pCtx        Pointer to the guest CPU context.
  * @param   enmOp       The operation to perform.
- * @param   cbParam     Number of parameters.
+ * @param   cParams     Number of parameters.
  * @param   paParam     Array of 32-bit parameters.
  */
-VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, HM64ON32OP enmOp, uint32_t cbParam,
-                                         uint32_t *paParam)
+VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, HM64ON32OP enmOp,
+                                         uint32_t cParams, uint32_t *paParam)
 {
     int             rc, rc2;
     PHMGLOBALCPUINFO pCpu;
     RTHCPHYS        HCPhysCpuPage;
-    RTCCUINTREG     uOldEflags;
+    RTCCUINTREG     fOldEFlags;
 
     AssertReturn(pVM->hm.s.pfnHost32ToGuest64R0, VERR_HM_NO_32_TO_64_SWITCHER);
     Assert(enmOp > HM64ON32OP_INVALID && enmOp < HM64ON32OP_END);
@@ -4838,7 +5259,7 @@ VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, H
 #endif
 
     /* Disable interrupts. */
-    uOldEflags = ASMIntDisableFlags();
+    fOldEFlags = ASMIntDisableFlags();
 
 #ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
     RTCPUID idHostCpu = RTMpCpuId();
@@ -4858,7 +5279,7 @@ VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, H
 
     CPUMSetHyperESP(pVCpu, VMMGetStackRC(pVCpu));
     CPUMSetHyperEIP(pVCpu, enmOp);
-    for (int i = (int)cbParam - 1; i >= 0; i--)
+    for (int i = (int)cParams - 1; i >= 0; i--)
         CPUMPushHyper(pVCpu, paParam[i]);
 
     STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatWorldSwitch3264, z);
@@ -4876,7 +5297,7 @@ VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, H
     if (RT_FAILURE(rc2))
     {
         SUPR0ChangeCR4(0, ~X86_CR4_VMXE);
-        ASMSetFlags(uOldEflags);
+        ASMSetFlags(fOldEFlags);
         pVM->hm.s.vmx.HCPhysVmxEnableError = HCPhysCpuPage;
         return rc2;
     }
@@ -4884,13 +5305,13 @@ VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, H
     rc2 = VMXActivateVmcs(pVCpu->hm.s.vmx.HCPhysVmcs);
     AssertRC(rc2);
     Assert(!(ASMGetFlags() & X86_EFL_IF));
-    ASMSetFlags(uOldEflags);
+    ASMSetFlags(fOldEFlags);
     return rc;
 }
 
 
 /**
- * Prepares for and executes VMLAUNCH (64 bits guests) for 32-bit hosts
+ * Prepares for and executes VMLAUNCH (64-bit guests) for 32-bit hosts
  * supporting 64-bit guests.
  *
  * @returns VBox status code.
@@ -4902,7 +5323,6 @@ VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, H
  */
 DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu)
 {
-    uint32_t         aParam[6];
     PHMGLOBALCPUINFO pCpu          = NULL;
     RTHCPHYS         HCPhysCpuPage = 0;
     int              rc            = VERR_INTERNAL_ERROR_5;
@@ -4926,18 +5346,23 @@ DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE
     pCache->TestOut.eflags       = 0;
 #endif
 
+    uint32_t aParam[10];
     aParam[0] = (uint32_t)(HCPhysCpuPage);                              /* Param 1: VMXON physical address - Lo. */
     aParam[1] = (uint32_t)(HCPhysCpuPage >> 32);                        /* Param 1: VMXON physical address - Hi. */
     aParam[2] = (uint32_t)(pVCpu->hm.s.vmx.HCPhysVmcs);                 /* Param 2: VMCS physical address - Lo. */
     aParam[3] = (uint32_t)(pVCpu->hm.s.vmx.HCPhysVmcs >> 32);           /* Param 2: VMCS physical address - Hi. */
     aParam[4] = VM_RC_ADDR(pVM, &pVM->aCpus[pVCpu->idCpu].hm.s.vmx.VMCSCache);
     aParam[5] = 0;
+    aParam[6] = VM_RC_ADDR(pVM, pVM);
+    aParam[7] = 0;
+    aParam[8] = VM_RC_ADDR(pVM, pVCpu);
+    aParam[9] = 0;
 
 #ifdef VBOX_WITH_CRASHDUMP_MAGIC
     pCtx->dr[4] = pVM->hm.s.vmx.pScratchPhys + 16 + 8;
     *(uint32_t *)(pVM->hm.s.vmx.pScratch + 16 + 8) = 1;
 #endif
-    rc = VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, HM64ON32OP_VMXRCStartVM64, 6, &aParam[0]);
+    rc = VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, HM64ON32OP_VMXRCStartVM64, RT_ELEMENTS(aParam), &aParam[0]);
 
 #ifdef VBOX_WITH_CRASHDUMP_MAGIC
     Assert(*(uint32_t *)(pVM->hm.s.vmx.pScratch + 16 + 8) == 5);
@@ -4964,10 +5389,12 @@ DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE
 
 
 /**
- * Initialize the VMCS-Read cache. The VMCS cache is used for 32-bit hosts
- * running 64-bit guests (except 32-bit Darwin which runs with 64-bit paging in
- * 32-bit mode) for 64-bit fields that cannot be accessed in 32-bit mode. Some
- * 64-bit fields -can- be accessed (those that have a 32-bit FULL & HIGH part).
+ * Initialize the VMCS-Read cache.
+ *
+ * The VMCS cache is used for 32-bit hosts running 64-bit guests (except 32-bit
+ * Darwin which runs with 64-bit paging in 32-bit mode) for 64-bit fields that
+ * cannot be accessed in 32-bit mode. Some 64-bit fields -can- be accessed
+ * (those that have a 32-bit FULL & HIGH part).
  *
  * @returns VBox status code.
  * @param   pVM         Pointer to the VM.
@@ -5065,7 +5492,7 @@ static int hmR0VmxInitVmcsReadCache(PVM pVM, PVMCPU pVCpu)
  * @returns VBox status code.
  * @param   pVCpu           Pointer to the VMCPU.
  * @param   idxField        The VMCS field encoding.
- * @param   u64Val          16, 32 or 64 bits value.
+ * @param   u64Val          16, 32 or 64-bit value.
  */
 VMMR0DECL(int) VMXWriteVmcs64Ex(PVMCPU pVCpu, uint32_t idxField, uint64_t u64Val)
 {
@@ -5157,12 +5584,12 @@ VMMR0DECL(int) VMXWriteVmcs64Ex(PVMCPU pVCpu, uint32_t idxField, uint64_t u64Val
 
 
 /**
- * Queue up a VMWRITE by using the VMCS write cache. This is only used on 32-bit
- * hosts (except darwin) for 64-bit guests.
+ * Queue up a VMWRITE by using the VMCS write cache.
+ * This is only used on 32-bit hosts (except darwin) for 64-bit guests.
  *
  * @param   pVCpu       Pointer to the VMCPU.
  * @param   idxField    The VMCS field encoding.
- * @param   u64Val      16, 32 or 64 bits value.
+ * @param   u64Val      16, 32 or 64-bit value.
  */
 VMMR0DECL(int) VMXWriteCachedVmcsEx(PVMCPU pVCpu, uint32_t idxField, uint64_t u64Val)
 {
@@ -5232,72 +5659,73 @@ VMMR0DECL(void) VMXReadCachedVmcsStore(PVMCPU pVCpu, PVMCSCACHE pCache)
 
 
 /**
- * Sets up the usage of TSC-offsetting and updates the VMCS. If offsetting is
- * not possible, cause VM-exits on RDTSC(P)s. Also sets up the VMX preemption
- * timer.
+ * Sets up the usage of TSC-offsetting and updates the VMCS.
+ *
+ * If offsetting is not possible, cause VM-exits on RDTSC(P)s. Also sets up the
+ * VMX preemption timer.
  *
  * @returns VBox status code.
+ * @param   pVM             Pointer to the cross context VM structure.
  * @param   pVCpu           Pointer to the VMCPU.
- * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
- *                          out-of-sync. Make sure to update the required fields
- *                          before using them.
+ *
  * @remarks No-long-jump zone!!!
  */
-static void hmR0VmxUpdateTscOffsettingAndPreemptTimer(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
+static void hmR0VmxUpdateTscOffsettingAndPreemptTimer(PVM pVM, PVMCPU pVCpu)
 {
-    int  rc            = VERR_INTERNAL_ERROR_5;
-    bool fOffsettedTsc = false;
-    PVM pVM            = pVCpu->CTX_SUFF(pVM);
+    int  rc;
+    bool fOffsettedTsc;
+    bool fParavirtTsc;
     if (pVM->hm.s.vmx.fUsePreemptTimer)
     {
-        uint64_t cTicksToDeadline = TMCpuTickGetDeadlineAndTscOffset(pVCpu, &fOffsettedTsc, &pVCpu->hm.s.vmx.u64TSCOffset);
+        uint64_t cTicksToDeadline = TMCpuTickGetDeadlineAndTscOffset(pVM, pVCpu, &pVCpu->hm.s.vmx.u64TSCOffset,
+                                                                     &fOffsettedTsc, &fParavirtTsc);
 
         /* Make sure the returned values have sane upper and lower boundaries. */
-        uint64_t u64CpuHz  = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage);
+        uint64_t u64CpuHz  = SUPGetCpuHzFromGipBySetIndex(g_pSUPGlobalInfoPage, pVCpu->iHostCpuSet);
         cTicksToDeadline   = RT_MIN(cTicksToDeadline, u64CpuHz / 64);      /* 1/64th of a second */
         cTicksToDeadline   = RT_MAX(cTicksToDeadline, u64CpuHz / 2048);    /* 1/2048th of a second */
         cTicksToDeadline >>= pVM->hm.s.vmx.cPreemptTimerShift;
 
         uint32_t cPreemptionTickCount = (uint32_t)RT_MIN(cTicksToDeadline, UINT32_MAX - 16);
-        rc = VMXWriteVmcs32(VMX_VMCS32_GUEST_PREEMPT_TIMER_VALUE, cPreemptionTickCount);          AssertRC(rc);
+        rc = VMXWriteVmcs32(VMX_VMCS32_GUEST_PREEMPT_TIMER_VALUE, cPreemptionTickCount);        AssertRC(rc);
     }
     else
-        fOffsettedTsc = TMCpuTickCanUseRealTSC(pVCpu, &pVCpu->hm.s.vmx.u64TSCOffset);
+        fOffsettedTsc = TMCpuTickCanUseRealTSC(pVM, pVCpu, &pVCpu->hm.s.vmx.u64TSCOffset, &fParavirtTsc);
+
+    /** @todo later optimize this to be done elsewhere and not before every
+     *        VM-entry. */
+    if (fParavirtTsc)
+    {
+        rc = GIMR0UpdateParavirtTsc(pVM, 0 /* u64Offset */);
+        AssertRC(rc);
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscParavirt);
+    }
 
     if (fOffsettedTsc)
     {
-        uint64_t u64CurTSC = ASMReadTSC();
-        if (u64CurTSC + pVCpu->hm.s.vmx.u64TSCOffset >= TMCpuTickGetLastSeen(pVCpu))
-        {
-            /* Note: VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT takes precedence over TSC_OFFSET, applies to RDTSCP too. */
-            rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_TSC_OFFSET_FULL, pVCpu->hm.s.vmx.u64TSCOffset);   AssertRC(rc);
+        /* Note: VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT takes precedence over TSC_OFFSET, applies to RDTSCP too. */
+        rc = VMXWriteVmcs64(VMX_VMCS64_CTRL_TSC_OFFSET_FULL, pVCpu->hm.s.vmx.u64TSCOffset);     AssertRC(rc);
 
-            pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT;
-            rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);          AssertRC(rc);
-            STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffset);
-        }
-        else
-        {
-            /* VM-exit on RDTSC(P) as we would otherwise pass decreasing TSC values to the guest. */
-            pVCpu->hm.s.vmx.u32ProcCtls |= VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT;
-            rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);          AssertRC(rc);
-            STAM_COUNTER_INC(&pVCpu->hm.s.StatTscInterceptOverFlow);
-        }
+        pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT;
+        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);            AssertRC(rc);
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffset);
     }
     else
     {
         /* We can't use TSC-offsetting (non-fixed TSC, warp drive active etc.), VM-exit on RDTSC(P). */
         pVCpu->hm.s.vmx.u32ProcCtls |= VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT;
-        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);              AssertRC(rc);
+        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);            AssertRC(rc);
         STAM_COUNTER_INC(&pVCpu->hm.s.StatTscIntercept);
     }
 }
 
 
 /**
- * Determines if an exception is a contributory exception. Contributory
- * exceptions are ones which can cause double-faults. Page-fault is
- * intentionally not included here as it's a conditional contributory exception.
+ * Determines if an exception is a contributory exception.
+ *
+ * Contributory exceptions are ones which can cause double-faults unless the
+ * original exception was a benign exception. Page-fault is intentionally not
+ * included here as it's a conditional contributory exception.
  *
  * @returns true if the exception is contributory, false otherwise.
  * @param   uVector     The exception vector.
@@ -5359,6 +5787,7 @@ DECLINLINE(void) hmR0VmxSetPendingEvent(PVMCPU pVCpu, uint32_t u32IntInfo, uint3
  */
 DECLINLINE(void) hmR0VmxSetPendingXcptDF(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
+    NOREF(pMixedCtx);
     uint32_t u32IntInfo  = X86_XCPT_DF | VMX_EXIT_INTERRUPTION_INFO_VALID;
     u32IntInfo          |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     u32IntInfo          |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
@@ -5386,16 +5815,17 @@ DECLINLINE(void) hmR0VmxSetPendingXcptDF(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 static int hmR0VmxCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
 {
+    uint32_t uExitVector = VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVmxTransient->uExitIntInfo);
+
     int rc = hmR0VmxReadIdtVectoringInfoVmcs(pVmxTransient);
     AssertRCReturn(rc, rc);
+    rc = hmR0VmxReadExitIntInfoVmcs(pVmxTransient);
+    AssertRCReturn(rc, rc);
+
     if (VMX_IDT_VECTORING_INFO_VALID(pVmxTransient->uIdtVectoringInfo))
     {
-        rc = hmR0VmxReadExitIntInfoVmcs(pVCpu, pVmxTransient);
-        AssertRCReturn(rc, rc);
-
-        uint32_t uIntType    = VMX_IDT_VECTORING_INFO_TYPE(pVmxTransient->uIdtVectoringInfo);
-        uint32_t uExitVector = VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVmxTransient->uExitIntInfo);
-        uint32_t uIdtVector  = VMX_IDT_VECTORING_INFO_VECTOR(pVmxTransient->uIdtVectoringInfo);
+        uint32_t uIdtVectorType = VMX_IDT_VECTORING_INFO_TYPE(pVmxTransient->uIdtVectoringInfo);
+        uint32_t uIdtVector     = VMX_IDT_VECTORING_INFO_VECTOR(pVmxTransient->uIdtVectoringInfo);
 
         typedef enum
         {
@@ -5409,7 +5839,7 @@ static int hmR0VmxCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pMixedCtx,
         VMXREFLECTXCPT enmReflect = VMXREFLECTXCPT_NONE;
         if (VMX_EXIT_INTERRUPTION_INFO_IS_VALID(pVmxTransient->uExitIntInfo))
         {
-            if (uIntType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT)
+            if (uIdtVectorType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT)
             {
                 enmReflect = VMXREFLECTXCPT_XCPT;
 #ifdef VBOX_STRICT
@@ -5422,8 +5852,8 @@ static int hmR0VmxCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pMixedCtx,
                 if (   uExitVector == X86_XCPT_PF
                     && uIdtVector == X86_XCPT_PF)
                 {
-                    pVmxTransient->fVectoringPF = true;
-                    Log4(("IDT: vcpu[%RU32] Vectoring #PF uCR2=%#RX64\n", pVCpu->idCpu, pMixedCtx->cr2));
+                    pVmxTransient->fVectoringDoublePF = true;
+                    Log4(("IDT: vcpu[%RU32] Vectoring Double #PF uCR2=%#RX64\n", pVCpu->idCpu, pMixedCtx->cr2));
                 }
                 else if (   (pVCpu->hm.s.vmx.u32XcptBitmap & HMVMX_CONTRIBUTORY_XCPT_MASK)
                          && hmR0VmxIsContributoryXcpt(uExitVector)
@@ -5435,39 +5865,56 @@ static int hmR0VmxCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pMixedCtx,
                 else if (uIdtVector == X86_XCPT_DF)
                     enmReflect = VMXREFLECTXCPT_TF;
             }
-            else if (   uIntType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT
-                     || uIntType == VMX_IDT_VECTORING_INFO_TYPE_EXT_INT
-                     || uIntType == VMX_IDT_VECTORING_INFO_TYPE_NMI)
+            else if (   uIdtVectorType == VMX_IDT_VECTORING_INFO_TYPE_EXT_INT
+                     || uIdtVectorType == VMX_IDT_VECTORING_INFO_TYPE_NMI)
             {
                 /*
-                 * Ignore software interrupts (INT n), software exceptions (#BP, #OF) and privileged software exception
-                 * (whatever they are) as they reoccur when restarting the instruction.
+                 * Ignore software interrupts (INT n), software exceptions (#BP, #OF) and
+                 * privileged software exception (#DB from ICEBP) as they reoccur when restarting the instruction.
                  */
                 enmReflect = VMXREFLECTXCPT_XCPT;
+
+                if (uExitVector == X86_XCPT_PF)
+                {
+                    pVmxTransient->fVectoringPF = true;
+                    Log4(("IDT: vcpu[%RU32] Vectoring #PF due to Ext-Int/NMI. uCR2=%#RX64\n", pVCpu->idCpu, pMixedCtx->cr2));
+                }
             }
         }
-        else
+        else if (   uIdtVectorType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT
+                 || uIdtVectorType == VMX_IDT_VECTORING_INFO_TYPE_EXT_INT
+                 || uIdtVectorType == VMX_IDT_VECTORING_INFO_TYPE_NMI)
         {
             /*
              * If event delivery caused an EPT violation/misconfig or APIC access VM-exit, then the VM-exit
-             * interruption-information will not be valid and we end up here. In such cases, it is sufficient to reflect the
-             * original exception to the guest after handling the VM-exit.
+             * interruption-information will not be valid as it's not an exception and we end up here. In such cases,
+             * it is sufficient to reflect the original exception to the guest after handling the VM-exit.
              */
-            if (   uIntType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT
-                || uIntType == VMX_IDT_VECTORING_INFO_TYPE_EXT_INT
-                || uIntType == VMX_IDT_VECTORING_INFO_TYPE_NMI)
-            {
-                enmReflect = VMXREFLECTXCPT_XCPT;
-            }
+            enmReflect = VMXREFLECTXCPT_XCPT;
+        }
+
+        /*
+         * On CPUs that support Virtual NMIs, if this VM-exit (be it an exception or EPT violation/misconfig etc.) occurred
+         * while delivering the NMI, we need to clear the block-by-NMI field in the guest interruptibility-state before
+         * re-delivering the NMI after handling the VM-exit. Otherwise the subsequent VM-entry would fail.
+         *
+         * See Intel spec. 30.7.1.2 "Resuming Guest Software after Handling an Exception". See @bugref{7445}.
+         */
+        if (   uIdtVectorType == VMX_IDT_VECTORING_INFO_TYPE_NMI
+            && enmReflect == VMXREFLECTXCPT_XCPT
+            && (pVCpu->hm.s.vmx.u32PinCtls & VMX_VMCS_CTRL_PIN_EXEC_VIRTUAL_NMI)
+            && VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
+        {
+            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
         }
 
         switch (enmReflect)
         {
             case VMXREFLECTXCPT_XCPT:
             {
-                Assert(   uIntType != VMX_IDT_VECTORING_INFO_TYPE_SW_INT
-                       && uIntType != VMX_IDT_VECTORING_INFO_TYPE_SW_XCPT
-                       && uIntType != VMX_IDT_VECTORING_INFO_TYPE_PRIV_SW_XCPT);
+                Assert(   uIdtVectorType != VMX_IDT_VECTORING_INFO_TYPE_SW_INT
+                       && uIdtVectorType != VMX_IDT_VECTORING_INFO_TYPE_SW_XCPT
+                       && uIdtVectorType != VMX_IDT_VECTORING_INFO_TYPE_PRIV_SW_XCPT);
 
                 uint32_t u32ErrCode = 0;
                 if (VMX_IDT_VECTORING_INFO_ERROR_CODE_IS_VALID(pVmxTransient->uIdtVectoringInfo))
@@ -5510,6 +5957,24 @@ static int hmR0VmxCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pMixedCtx,
                 break;
         }
     }
+    else if (   VMX_EXIT_INTERRUPTION_INFO_IS_VALID(pVmxTransient->uExitIntInfo)
+             && VMX_EXIT_INTERRUPTION_INFO_NMI_UNBLOCK_IRET(pVmxTransient->uExitIntInfo)
+             && uExitVector != X86_XCPT_DF
+             && (pVCpu->hm.s.vmx.u32PinCtls & VMX_VMCS_CTRL_PIN_EXEC_VIRTUAL_NMI))
+    {
+        /*
+         * Execution of IRET caused this fault when NMI blocking was in effect (i.e we're in the guest NMI handler).
+         * We need to set the block-by-NMI field so that NMIs remain blocked until the IRET execution is restarted.
+         * See Intel spec. 30.7.1.2 "Resuming guest software after handling an exception".
+         */
+        if (!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
+        {
+            Log4(("hmR0VmxCheckExitDueToEventDelivery: vcpu[%RU32] Setting VMCPU_FF_BLOCK_NMIS. Valid=%RTbool uExitReason=%u\n",
+                  pVCpu->idCpu, VMX_EXIT_INTERRUPTION_INFO_IS_VALID(pVmxTransient->uExitIntInfo), pVmxTransient->uExitReason));
+            VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
+        }
+    }
+
     Assert(rc == VINF_SUCCESS || rc == VINF_HM_DOUBLE_FAULT || rc == VINF_EM_RESET);
     return rc;
 }
@@ -5535,7 +6000,7 @@ static int hmR0VmxSaveGuestCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
      * see hmR0VmxLeave(). Safer to just make this code non-preemptible.
      */
     VMMRZCallRing3Disable(pVCpu);
-    HM_DISABLE_PREEMPT_IF_NEEDED();
+    HM_DISABLE_PREEMPT();
 
     if (!HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_CR0))
     {
@@ -5552,7 +6017,7 @@ static int hmR0VmxSaveGuestCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_CR0);
     }
 
-    HM_RESTORE_PREEMPT_IF_NEEDED();
+    HM_RESTORE_PREEMPT();
     VMMRZCallRing3Enable(pVCpu);
     return VINF_SUCCESS;
 }
@@ -5571,6 +6036,8 @@ static int hmR0VmxSaveGuestCR0(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 static int hmR0VmxSaveGuestCR4(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
+    NOREF(pMixedCtx);
+
     int rc = VINF_SUCCESS;
     if (!HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_CR4))
     {
@@ -5672,7 +6139,7 @@ static int hmR0VmxSaveGuestRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
             pMixedCtx->eflags.Bits.u2IOPL = pVCpu->hm.s.vmx.RealMode.Eflags.Bits.u2IOPL;
         }
 
-        HMVMXCPU_GST_SET_UPDATED(pVCpu,  HMVMX_UPDATED_GUEST_RFLAGS);
+        HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_RFLAGS);
     }
     return VINF_SUCCESS;
 }
@@ -5704,7 +6171,7 @@ DECLINLINE(int) hmR0VmxSaveGuestRipRspRflags(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 static void hmR0VmxSaveGuestIntrState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
-    if (!HMVMXCPU_GST_IS_SET(pVCpu, HMVMX_UPDATED_GUEST_INTR_STATE))
+    if (!HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_INTR_STATE))
     {
         uint32_t uIntrState = 0;
         int rc = VMXReadVmcs32(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE, &uIntrState);
@@ -5714,18 +6181,33 @@ static void hmR0VmxSaveGuestIntrState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
         {
             if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
                 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
+
+            if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
+                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
         }
         else
         {
-            Assert(   uIntrState == VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI
-                   || uIntrState == VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS);
-            rc  = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
-            AssertRC(rc);
-            rc = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);    /* for hmR0VmxGetGuestIntrState(). */
-            AssertRC(rc);
+            if (uIntrState & (  VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS
+                              | VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI))
+            {
+                rc  = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
+                AssertRC(rc);
+                rc = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);    /* for hmR0VmxGetGuestIntrState(). */
+                AssertRC(rc);
 
-            EMSetInhibitInterruptsPC(pVCpu, pMixedCtx->rip);
-            Assert(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS));
+                EMSetInhibitInterruptsPC(pVCpu, pMixedCtx->rip);
+                Assert(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS));
+            }
+            else if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
+                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
+
+            if (uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_NMI)
+            {
+                if (!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
+                    VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
+            }
+            else if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
+                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
         }
 
         HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_INTR_STATE);
@@ -5746,6 +6228,7 @@ static void hmR0VmxSaveGuestIntrState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 static int hmR0VmxSaveGuestActivityState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
+    NOREF(pMixedCtx);
     /* Nothing to do for now until we make use of different guest-CPU activity state. Just update the flag. */
     HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_ACTIVITY_STATE);
     return VINF_SUCCESS;
@@ -5793,8 +6276,8 @@ static int hmR0VmxSaveGuestSysenterMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 
 
 /**
- * Saves the guest FS_BASE MSRs from the current VMCS into the guest-CPU
- * context.
+ * Saves the set of guest MSRs (that we restore lazily while leaving VT-x) from
+ * the CPU back into the guest-CPU context.
  *
  * @returns VBox status code.
  * @param   pVCpu       Pointer to the VMCPU.
@@ -5804,50 +6287,39 @@ static int hmR0VmxSaveGuestSysenterMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  *
  * @remarks No-long-jump zone!!!
  */
-static int hmR0VmxSaveGuestFSBaseMsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
+static int hmR0VmxSaveGuestLazyMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
-    int rc = VINF_SUCCESS;
-    if (!HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_FS_BASE_MSR))
+#if HC_ARCH_BITS == 64
+    if (pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests)
     {
-        uint64_t u64Val = 0;
-        rc = VMXReadVmcsGstN(VMX_VMCS_GUEST_FS_BASE, &u64Val);   AssertRCReturn(rc, rc);
-        pMixedCtx->fs.u64Base = u64Val;
-        HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_FS_BASE_MSR);
-    }
-    return rc;
-}
+        /* Since this can be called from our preemption hook it's safer to make the guest-MSRs update non-preemptible. */
+        VMMRZCallRing3Disable(pVCpu);
+        HM_DISABLE_PREEMPT();
 
+        /* Doing the check here ensures we don't overwrite already-saved guest MSRs from a preemption hook. */
+        if (!HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_LAZY_MSRS))
+        {
+            hmR0VmxLazySaveGuestMsrs(pVCpu, pMixedCtx);
+            HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_LAZY_MSRS);
+        }
 
-/**
- * Saves the guest GS_BASE MSRs from the current VMCS into the guest-CPU
- * context.
- *
- * @returns VBox status code.
- * @param   pVCpu       Pointer to the VMCPU.
- * @param   pMixedCtx   Pointer to the guest-CPU context. The data maybe
- *                      out-of-sync. Make sure to update the required fields
- *                      before using them.
- *
- * @remarks No-long-jump zone!!!
- */
-static int hmR0VmxSaveGuestGSBaseMsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
-{
-    int rc = VINF_SUCCESS;
-    if (!HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_GS_BASE_MSR))
-    {
-        uint64_t u64Val = 0;
-        rc = VMXReadVmcsGstN(VMX_VMCS_GUEST_GS_BASE, &u64Val);   AssertRCReturn(rc, rc);
-        pMixedCtx->gs.u64Base = u64Val;
-        HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_GS_BASE_MSR);
+        HM_RESTORE_PREEMPT();
+        VMMRZCallRing3Enable(pVCpu);
     }
-    return rc;
+    else
+        HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_LAZY_MSRS);
+#else
+    NOREF(pMixedCtx);
+    HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_LAZY_MSRS);
+#endif
+
+    return VINF_SUCCESS;
 }
 
 
 /**
- * Saves the auto load/store'd guest MSRs from the current VMCS into the
- * guest-CPU context. Currently these are LSTAR, STAR, SFMASK, KERNEL-GS BASE
- * and TSC_AUX.
+ * Saves the auto load/store'd guest MSRs from the current VMCS into
+ * the guest-CPU context.
  *
  * @returns VBox status code.
  * @param   pVCpu       Pointer to the VMCPU.
@@ -5862,27 +6334,29 @@ static int hmR0VmxSaveGuestAutoLoadStoreMsrs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     if (HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_AUTO_LOAD_STORE_MSRS))
         return VINF_SUCCESS;
 
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-    for (uint32_t i = 0; i < pVCpu->hm.s.vmx.cGuestMsrs; i++)
+    PVMXAUTOMSR pMsr  = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
+    uint32_t    cMsrs = pVCpu->hm.s.vmx.cMsrs;
+    Log4(("hmR0VmxSaveGuestAutoLoadStoreMsrs: cMsrs=%u\n", cMsrs));
+    for (uint32_t i = 0; i < cMsrs; i++, pMsr++)
     {
-        PVMXAUTOMSR pMsr = (PVMXAUTOMSR)pVCpu->hm.s.vmx.pvGuestMsr;
-        pMsr += i;
         switch (pMsr->u32Msr)
         {
-            case MSR_K8_LSTAR:          pMixedCtx->msrLSTAR  = pMsr->u64Value;                   break;
-            case MSR_K6_STAR:           pMixedCtx->msrSTAR   = pMsr->u64Value;                   break;
-            case MSR_K8_SF_MASK:        pMixedCtx->msrSFMASK = pMsr->u64Value;                   break;
             case MSR_K8_TSC_AUX:        CPUMR0SetGuestTscAux(pVCpu, pMsr->u64Value);             break;
+            case MSR_K8_LSTAR:          pMixedCtx->msrLSTAR        = pMsr->u64Value;             break;
+            case MSR_K6_STAR:           pMixedCtx->msrSTAR         = pMsr->u64Value;             break;
+            case MSR_K8_SF_MASK:        pMixedCtx->msrSFMASK       = pMsr->u64Value;             break;
             case MSR_K8_KERNEL_GS_BASE: pMixedCtx->msrKERNELGSBASE = pMsr->u64Value;             break;
-            case MSR_K6_EFER:           /* EFER can't be changed without causing a VM-exit. */   break;
+            case MSR_K6_EFER: /* Nothing to do here since we intercept writes, see hmR0VmxLoadGuestMsrs(). */
+                break;
+
             default:
             {
-                AssertFailed();
+                AssertMsgFailed(("Unexpected MSR in auto-load/store area. uMsr=%#RX32 cMsrs=%u\n", pMsr->u32Msr, cMsrs));
+                pVCpu->hm.s.u32HMError = pMsr->u32Msr;
                 return VERR_HM_UNEXPECTED_LD_ST_MSR;
             }
         }
     }
-#endif
 
     HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_AUTO_LOAD_STORE_MSRS);
     return VINF_SUCCESS;
@@ -6012,6 +6486,8 @@ static int hmR0VmxSaveGuestControlRegs(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 DECLINLINE(int) hmR0VmxReadSegmentReg(PVMCPU pVCpu, uint32_t idxSel, uint32_t idxLimit, uint32_t idxBase, uint32_t idxAccess,
                                       PCPUMSELREG pSelReg)
 {
+    NOREF(pVCpu);
+
     uint32_t u32Val = 0;
     int rc = VMXReadVmcs32(idxSel, &u32Val);
     AssertRCReturn(rc, rc);
@@ -6039,10 +6515,10 @@ DECLINLINE(int) hmR0VmxReadSegmentReg(PVMCPU pVCpu, uint32_t idxSel, uint32_t id
      *    - For the remaining data segments no bits are defined.
      *
      * The present bit and the unusable bit has been observed to be set at the
-     * same time (the selector was supposed to invalid as we started executing
+     * same time (the selector was supposed to be invalid as we started executing
      * a V8086 interrupt in ring-0).
      *
-     * What should be important for the rest of the VBox code that the P bit is
+     * What should be important for the rest of the VBox code, is that the P bit is
      * cleared.  Some of the other VBox code recognizes the unusable bit, but
      * AMD-V certainly don't, and REM doesn't really either.  So, to be on the
      * safe side here, we'll strip off P and other bits we don't care about.  If
@@ -6231,6 +6707,8 @@ static int hmR0VmxSaveGuestDR7(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 static int hmR0VmxSaveGuestApicState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
+    NOREF(pMixedCtx);
+
     /* Updating TPR is already done in hmR0VmxPostRunGuest(). Just update the flag. */
     HMVMXCPU_GST_SET_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_APIC_STATE);
     return VINF_SUCCESS;
@@ -6239,7 +6717,9 @@ static int hmR0VmxSaveGuestApicState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 
 /**
  * Saves the entire guest state from the currently active VMCS into the
- * guest-CPU context. This essentially VMREADs all guest-data.
+ * guest-CPU context.
+ *
+ * This essentially VMREADs all guest-data.
  *
  * @returns VBox status code.
  * @param   pVCpu       Pointer to the VMCPU.
@@ -6281,11 +6761,8 @@ static int hmR0VmxSaveGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     rc = hmR0VmxSaveGuestSysenterMsrs(pVCpu, pMixedCtx);
     AssertLogRelMsgRCReturn(rc, ("hmR0VmxSaveGuestSysenterMsrs failed! rc=%Rrc (pVCpu=%p)\n", rc, pVCpu), rc);
 
-    rc = hmR0VmxSaveGuestFSBaseMsr(pVCpu, pMixedCtx);
-    AssertLogRelMsgRCReturn(rc, ("hmR0VmxSaveGuestFSBaseMsr failed! rc=%Rrc (pVCpu=%p)\n", rc, pVCpu), rc);
-
-    rc = hmR0VmxSaveGuestGSBaseMsr(pVCpu, pMixedCtx);
-    AssertLogRelMsgRCReturn(rc, ("hmR0VmxSaveGuestGSBaseMsr failed! rc=%Rrc (pVCpu=%p)\n", rc, pVCpu), rc);
+    rc = hmR0VmxSaveGuestLazyMsrs(pVCpu, pMixedCtx);
+    AssertLogRelMsgRCReturn(rc, ("hmR0VmxSaveGuestLazyMsrs failed! rc=%Rrc (pVCpu=%p)\n", rc, pVCpu), rc);
 
     rc = hmR0VmxSaveGuestAutoLoadStoreMsrs(pVCpu, pMixedCtx);
     AssertLogRelMsgRCReturn(rc, ("hmR0VmxSaveGuestAutoLoadStoreMsrs failed! rc=%Rrc (pVCpu=%p)\n", rc, pVCpu), rc);
@@ -6302,11 +6779,76 @@ static int hmR0VmxSaveGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     if (VMMRZCallRing3IsEnabled(pVCpu))
         VMMR0LogFlushEnable(pVCpu);
 
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Saves basic guest registers needed for IEM instruction execution.
+ *
+ * @returns VBox status code (OR-able).
+ * @param   pVCpu       Pointer to the cross context CPU data for the calling
+ *                      EMT.
+ * @param   pMixedCtx   Pointer to the CPU context of the guest.
+ * @param   fMemory     Whether the instruction being executed operates on
+ *                      memory or not.  Only CR0 is synced up if clear.
+ * @param   fNeedRsp    Need RSP (any instruction working on GPRs or stack).
+ */
+static int hmR0VmxSaveGuestRegsForIemExec(PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fMemory, bool fNeedRsp)
+{
+    /*
+     * We assume all general purpose registers other than RSP are available.
+     *
+     * RIP is a must, as it will be incremented or otherwise changed.
+     *
+     * RFLAGS are always required to figure the CPL.
+     *
+     * RSP isn't always required, however it's a GPR, so frequently required.
+     *
+     * SS and CS are the only segment register needed if IEM doesn't do memory
+     * access (CPL + 16/32/64-bit mode), but we can only get all segment registers.
+     *
+     * CR0 is always required by IEM for the CPL, while CR3 and CR4 will only
+     * be required for memory accesses.
+     *
+     * Note! Before IEM dispatches an exception, it will call us to sync in everything.
+     */
+    int rc  = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
+    rc     |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);
+    if (fNeedRsp)
+        rc |= hmR0VmxSaveGuestRsp(pVCpu, pMixedCtx);
+    rc     |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
+    if (!fMemory)
+        rc |= hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx);
+    else
+        rc |= hmR0VmxSaveGuestControlRegs(pVCpu, pMixedCtx);
     return rc;
 }
 
 
 /**
+ * Ensures that we've got a complete basic guest-context.
+ *
+ * This excludes the FPU, SSE, AVX, and similar extended state.  The interface
+ * is for the interpreter.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu           Pointer to the VMCPU of the calling EMT.
+ * @param   pMixedCtx       Pointer to the guest-CPU context which may have data
+ *                          needing to be synced in.
+ * @thread  EMT(pVCpu)
+ */
+VMMR0_INT_DECL(int) HMR0EnsureCompleteBasicContext(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
+{
+    /* Note! Since this is only applicable to VT-x, the implementation is placed
+             in the VT-x part of the sources instead of the generic stuff. */
+    if (pVCpu->CTX_SUFF(pVM)->hm.s.vmx.fSupported)
+        return hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
+    return VINF_SUCCESS;
+}
+
+
+/**
  * Check per-VM and per-VCPU force flag actions that require us to go back to
  * ring-3 for one reason or another.
  *
@@ -6433,6 +6975,10 @@ static void hmR0VmxTrpmTrapToPendingEvent(PVMCPU pVCpu)
     {
         switch (uVector)
         {
+            case X86_XCPT_NMI:
+                u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
+                break;
+
             case X86_XCPT_BP:
             case X86_XCPT_OF:
                 u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
@@ -6453,12 +6999,7 @@ static void hmR0VmxTrpmTrapToPendingEvent(PVMCPU pVCpu)
         }
     }
     else if (enmTrpmEvent == TRPM_HARDWARE_INT)
-    {
-        if (uVector == X86_XCPT_NMI)
-            u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
-        else
-            u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
-    }
+        u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     else if (enmTrpmEvent == TRPM_SOFTWARE_INT)
         u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     else
@@ -6486,7 +7027,7 @@ static void hmR0VmxPendingEventToTrpmTrap(PVMCPU pVCpu)
 
     uint32_t uVectorType     = VMX_IDT_VECTORING_INFO_TYPE(pVCpu->hm.s.Event.u64IntInfo);
     uint32_t uVector         = VMX_IDT_VECTORING_INFO_VECTOR(pVCpu->hm.s.Event.u64IntInfo);
-    bool     fErrorCodeValid = !!VMX_IDT_VECTORING_INFO_ERROR_CODE_IS_VALID(pVCpu->hm.s.Event.u64IntInfo);
+    bool     fErrorCodeValid = VMX_IDT_VECTORING_INFO_ERROR_CODE_IS_VALID(pVCpu->hm.s.Event.u64IntInfo);
     uint32_t uErrorCode      = pVCpu->hm.s.Event.u32ErrCode;
 
     /* If a trap was already pending, we did something wrong! */
@@ -6496,7 +7037,6 @@ static void hmR0VmxPendingEventToTrpmTrap(PVMCPU pVCpu)
     switch (uVectorType)
     {
         case VMX_IDT_VECTORING_INFO_TYPE_EXT_INT:
-        case VMX_IDT_VECTORING_INFO_TYPE_NMI:
            enmTrapType = TRPM_HARDWARE_INT;
            break;
 
@@ -6504,6 +7044,7 @@ static void hmR0VmxPendingEventToTrpmTrap(PVMCPU pVCpu)
             enmTrapType = TRPM_SOFTWARE_INT;
             break;
 
+        case VMX_IDT_VECTORING_INFO_TYPE_NMI:
         case VMX_IDT_VECTORING_INFO_TYPE_PRIV_SW_XCPT:
         case VMX_IDT_VECTORING_INFO_TYPE_SW_XCPT:      /* #BP and #OF */
         case VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT:
@@ -6554,8 +7095,6 @@ static void hmR0VmxPendingEventToTrpmTrap(PVMCPU pVCpu)
  *                              fields before using them.
  * @param   fSaveGuestState     Whether to save the guest state or not.
  *
- * @remarks If you modify code here, make sure to check whether
- *          hmR0VmxCallRing3Callback() needs to be updated too.
  * @remarks No-long-jmp zone!!!
  */
 static int hmR0VmxLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fSaveGuestState)
@@ -6566,6 +7105,11 @@ static int hmR0VmxLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fSaveGue
     RTCPUID idCpu = RTMpCpuId();
     Log4Func(("HostCpuId=%u\n", idCpu));
 
+    /*
+     * !!! IMPORTANT !!!
+     * If you modify code here, check whether hmR0VmxCallRing3Callback() needs to be updated too.
+     */
+
     /* Save the guest state if necessary. */
     if (   fSaveGuestState
         && HMVMXCPU_GST_VALUE(pVCpu) != HMVMX_UPDATED_GUEST_ALL)
@@ -6606,10 +7150,30 @@ static int hmR0VmxLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fSaveGue
     {
         Log4Func(("Restoring Host State: fRestoreHostFlags=%#RX32 HostCpuId=%u\n", pVCpu->hm.s.vmx.fRestoreHostFlags, idCpu));
         VMXRestoreHostState(pVCpu->hm.s.vmx.fRestoreHostFlags, &pVCpu->hm.s.vmx.RestoreHost);
-        pVCpu->hm.s.vmx.fRestoreHostFlags = 0;
+    }
+    pVCpu->hm.s.vmx.fRestoreHostFlags = 0;
+#endif
+
+#if HC_ARCH_BITS == 64
+    /* Restore the lazy host MSRs as we're leaving VT-x context. */
+    if (   pVM->hm.s.fAllow64BitGuests
+        && pVCpu->hm.s.vmx.fLazyMsrs)
+    {
+        /* We shouldn't reload the guest MSRs without saving it first. */
+        if (!fSaveGuestState)
+        {
+            int rc = hmR0VmxSaveGuestLazyMsrs(pVCpu, pMixedCtx);
+            AssertRCReturn(rc, rc);
+        }
+        Assert(HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_LAZY_MSRS));
+        hmR0VmxLazyRestoreHostMsrs(pVCpu);
+        Assert(!pVCpu->hm.s.vmx.fLazyMsrs);
     }
 #endif
 
+    /* Update auto-load/store host MSRs values when we re-enter VT-x (as we could be on a different CPU). */
+    pVCpu->hm.s.vmx.fUpdatedHostMsrs = false;
+
     STAM_PROFILE_ADV_SET_STOPPED(&pVCpu->hm.s.StatEntry);
     STAM_PROFILE_ADV_SET_STOPPED(&pVCpu->hm.s.StatLoadGuestState);
     STAM_PROFILE_ADV_SET_STOPPED(&pVCpu->hm.s.StatExit1);
@@ -6621,7 +7185,7 @@ static int hmR0VmxLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fSaveGue
 
     VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_HM, VMCPUSTATE_STARTED_EXEC);
 
-    /** @todo This kinda defeats the purpose of having preemption hooks.
+    /** @todo This partially defeats the purpose of having preemption hooks.
      *  The problem is, deregistering the hooks should be moved to a place that
      *  lasts until the EMT is about to be destroyed not everytime while leaving HM
      *  context.
@@ -6655,7 +7219,7 @@ static int hmR0VmxLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fSaveGue
  */
 DECLINLINE(int) hmR0VmxLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
-    HM_DISABLE_PREEMPT_IF_NEEDED();
+    HM_DISABLE_PREEMPT();
     HMVMX_ASSERT_CPU_SAFE();
     Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
@@ -6665,21 +7229,26 @@ DECLINLINE(int) hmR0VmxLeaveSession(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     if (!pVCpu->hm.s.fLeaveDone)
     {
         int rc2 = hmR0VmxLeave(pVM, pVCpu, pMixedCtx, true /* fSaveGuestState */);
-        AssertRCReturnStmt(rc2, HM_RESTORE_PREEMPT_IF_NEEDED(), rc2);
+        AssertRCReturnStmt(rc2, HM_RESTORE_PREEMPT(), rc2);
         pVCpu->hm.s.fLeaveDone = true;
     }
+    Assert(HMVMXCPU_GST_VALUE(pVCpu) == HMVMX_UPDATED_GUEST_ALL);
+
+    /*
+     * !!! IMPORTANT !!!
+     * If you modify code here, make sure to check whether hmR0VmxCallRing3Callback() needs to be updated too.
+     */
 
     /* Deregister hook now that we've left HM context before re-enabling preemption. */
-    /** @todo This is bad. Deregistering here means we need to VMCLEAR always
+    /** @todo Deregistering here means we need to VMCLEAR always
      *        (longjmp/exit-to-r3) in VT-x which is not efficient. */
-    if (VMMR0ThreadCtxHooksAreRegistered(pVCpu))
-        VMMR0ThreadCtxHooksDeregister(pVCpu);
+    /** @todo eliminate the need for calling VMMR0ThreadCtxHookDisable here!  */
+    VMMR0ThreadCtxHookDisable(pVCpu);
 
     /* Leave HM context. This takes care of local init (term). */
     int rc = HMR0LeaveCpu(pVCpu);
 
-    HM_RESTORE_PREEMPT_IF_NEEDED();
-
+    HM_RESTORE_PREEMPT();
     return rc;
 }
 
@@ -6745,10 +7314,16 @@ static int hmR0VmxExitToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, int rcE
         Assert(!pVCpu->hm.s.Event.fPending);
     }
 
+    /* If we're emulating an instruction, we shouldn't have any TRPM traps pending
+       and if we're injecting an event we should have a TRPM trap pending. */
+    Assert(rcExit != VINF_EM_RAW_INJECT_TRPM_EVENT || TRPMHasTrap(pVCpu));
+    Assert(rcExit != VINF_EM_RAW_EMULATE_INSTR || !TRPMHasTrap(pVCpu));
+
     /* Save guest state and restore host state bits. */
     int rc = hmR0VmxLeaveSession(pVM, pVCpu, pMixedCtx);
     AssertRCReturn(rc, rc);
     STAM_COUNTER_DEC(&pVCpu->hm.s.StatSwitchLongJmpToR3);
+    /* Thread-context hooks are unregistered at this point!!! */
 
     /* Sync recompiler state. */
     VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TO_R3);
@@ -6765,18 +7340,7 @@ static int hmR0VmxExitToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, int rcE
         CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_GLOBAL_TLB_FLUSH);
     }
 
-    /*
-     * Clear the X86_EFL_TF if necessary.
-     */
-    if (pVCpu->hm.s.fClearTrapFlag)
-    {
-        Assert(HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_RFLAGS));
-        pMixedCtx->eflags.Bits.u1TF = 0;
-        pVCpu->hm.s.fClearTrapFlag = false;
-    }
-    /** @todo there seems to be issues with the resume flag when the monitor trap
-     *        flag is pending without being used. Seen early in bios init when
-     *        accessing APIC page in prot mode. */
+    Assert(!pVCpu->hm.s.fClearTrapFlag);
 
     /* On our way back from ring-3 reload the guest state if there is a possibility of it being changed. */
     if (rcExit != VINF_EM_RAW_INTERRUPT)
@@ -6802,19 +7366,24 @@ static int hmR0VmxExitToRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, int rcE
  * @param   pvUser          Opaque pointer to the guest-CPU context. The data
  *                          may be out-of-sync. Make sure to update the required
  *                          fields before using them.
- * @remarks If you modify code here, make sure to check whether
- *          hmR0VmxLeave() needs to be updated too.
  */
 DECLCALLBACK(int) hmR0VmxCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser)
 {
     if (enmOperation == VMMCALLRING3_VM_R0_ASSERTION)
     {
+        /*
+         * !!! IMPORTANT !!!
+         * If you modify code here, check whether hmR0VmxLeave() and hmR0VmxLeaveSession() needs to be updated too.
+         * This is a stripped down version which gets out ASAP, trying to not trigger any further assertions.
+         */
         VMMRZCallRing3RemoveNotification(pVCpu);
-        HM_DISABLE_PREEMPT_IF_NEEDED();
+        VMMRZCallRing3Disable(pVCpu);
+        RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+        RTThreadPreemptDisable(&PreemptState);
 
-        /* If anything here asserts or fails, good luck. */
+        PVM pVM = pVCpu->CTX_SUFF(pVM);
         if (CPUMIsGuestFPUStateActive(pVCpu))
-            CPUMR0SaveGuestFPU(pVCpu->CTX_SUFF(pVM), pVCpu, (PCPUMCTX)pvUser);
+            CPUMR0SaveGuestFPU(pVM, pVCpu, (PCPUMCTX)pvUser);
 
         CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(pVCpu, true /* save DR6 */);
 
@@ -6822,11 +7391,16 @@ DECLCALLBACK(int) hmR0VmxCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperati
         /* Restore host-state bits that VT-x only restores partially. */
         if (   (pVCpu->hm.s.vmx.fRestoreHostFlags & VMX_RESTORE_HOST_REQUIRED)
             && (pVCpu->hm.s.vmx.fRestoreHostFlags & ~VMX_RESTORE_HOST_REQUIRED))
-        {
             VMXRestoreHostState(pVCpu->hm.s.vmx.fRestoreHostFlags, &pVCpu->hm.s.vmx.RestoreHost);
-            pVCpu->hm.s.vmx.fRestoreHostFlags = 0;
-        }
+        pVCpu->hm.s.vmx.fRestoreHostFlags = 0;
+
+        /* Restore the lazy host MSRs as we're leaving VT-x context. */
+        if (   pVM->hm.s.fAllow64BitGuests
+            && pVCpu->hm.s.vmx.fLazyMsrs)
+            hmR0VmxLazyRestoreHostMsrs(pVCpu);
 #endif
+        /* Update auto-load/store host MSRs values when we re-enter VT-x (as we could be on a different CPU). */
+        pVCpu->hm.s.vmx.fUpdatedHostMsrs = false;
         VMCPU_CMPXCHG_STATE(pVCpu, VMCPUSTATE_STARTED_HM, VMCPUSTATE_STARTED_EXEC);
         if (pVCpu->hm.s.vmx.uVmcsState & HMVMX_VMCS_STATE_ACTIVE)
         {
@@ -6834,11 +7408,10 @@ DECLCALLBACK(int) hmR0VmxCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperati
             pVCpu->hm.s.vmx.uVmcsState = HMVMX_VMCS_STATE_CLEAR;
         }
 
-        if (VMMR0ThreadCtxHooksAreRegistered(pVCpu))
-            VMMR0ThreadCtxHooksDeregister(pVCpu);
-
+        /** @todo eliminate the need for calling VMMR0ThreadCtxHookDisable here!  */
+        VMMR0ThreadCtxHookDisable(pVCpu);
         HMR0LeaveCpu(pVCpu);
-        HM_RESTORE_PREEMPT_IF_NEEDED();
+        RTThreadPreemptRestore(&PreemptState);
         return VINF_SUCCESS;
     }
 
@@ -6850,7 +7423,7 @@ DECLCALLBACK(int) hmR0VmxCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperati
     VMMRZCallRing3Disable(pVCpu);
     Assert(VMMR0IsLogFlushDisabled(pVCpu));
 
-    Log4(("hmR0VmxCallRing3Callback->hmR0VmxLongJmpToRing3 pVCpu=%p idCpu=%RU32\n enmOperation=%d", pVCpu, pVCpu->idCpu,
+    Log4(("hmR0VmxCallRing3Callback->hmR0VmxLongJmpToRing3 pVCpu=%p idCpu=%RU32 enmOperation=%d\n", pVCpu, pVCpu->idCpu,
           enmOperation));
 
     int rc = hmR0VmxLongJmpToRing3(pVCpu->CTX_SUFF(pVM), pVCpu, (PCPUMCTX)pvUser);
@@ -6876,12 +7449,64 @@ DECLINLINE(void) hmR0VmxSetIntWindowExitVmcs(PVMCPU pVCpu)
             pVCpu->hm.s.vmx.u32ProcCtls |= VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT;
             int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);
             AssertRC(rc);
+            Log4(("Setup interrupt-window exiting\n"));
         }
     } /* else we will deliver interrupts whenever the guest exits next and is in a state to receive events. */
 }
 
 
 /**
+ * Clears the interrupt-window exiting control in the VMCS.
+ *
+ * @param pVCpu             Pointer to the VMCPU.
+ */
+DECLINLINE(void) hmR0VmxClearIntWindowExitVmcs(PVMCPU pVCpu)
+{
+    Assert(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT);
+    pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT;
+    int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);
+    AssertRC(rc);
+    Log4(("Cleared interrupt-window exiting\n"));
+}
+
+
+/**
+ * Sets the NMI-window exiting control in the VMCS which instructs VT-x to
+ * cause a VM-exit as soon as the guest is in a state to receive NMIs.
+ *
+ * @param pVCpu         Pointer to the VMCPU.
+ */
+DECLINLINE(void) hmR0VmxSetNmiWindowExitVmcs(PVMCPU pVCpu)
+{
+    if (RT_LIKELY(pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.VmxProcCtls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_NMI_WINDOW_EXIT))
+    {
+        if (!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_NMI_WINDOW_EXIT))
+        {
+            pVCpu->hm.s.vmx.u32ProcCtls |= VMX_VMCS_CTRL_PROC_EXEC_NMI_WINDOW_EXIT;
+            int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);
+            AssertRC(rc);
+            Log4(("Setup NMI-window exiting\n"));
+        }
+    } /* else we will deliver NMIs whenever we VM-exit next, even possibly nesting NMIs. Can't be helped on ancient CPUs. */
+}
+
+
+/**
+ * Clears the NMI-window exiting control in the VMCS.
+ *
+ * @param pVCpu             Pointer to the VMCPU.
+ */
+DECLINLINE(void) hmR0VmxClearNmiWindowExitVmcs(PVMCPU pVCpu)
+{
+    Assert(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_NMI_WINDOW_EXIT);
+    pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_NMI_WINDOW_EXIT;
+    int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);
+    AssertRC(rc);
+    Log4(("Cleared NMI-window exiting\n"));
+}
+
+
+/**
  * Evaluates the event to be delivered to the guest and sets it as the pending
  * event.
  *
@@ -6895,45 +7520,48 @@ static void hmR0VmxEvaluatePendingEvent(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     Assert(!pVCpu->hm.s.Event.fPending);
 
     /* Get the current interruptibility-state of the guest and then figure out what can be injected. */
-    uint32_t uIntrState = hmR0VmxGetGuestIntrState(pVCpu, pMixedCtx);
-    bool fBlockMovSS    = RT_BOOL(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS);
-    bool fBlockSti      = RT_BOOL(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI);
+    uint32_t const uIntrState = hmR0VmxGetGuestIntrState(pVCpu, pMixedCtx);
+    bool const fBlockMovSS    = RT_BOOL(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS);
+    bool const fBlockSti      = RT_BOOL(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI);
+    bool const fBlockNmi      = RT_BOOL(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_NMI);
 
     Assert(!fBlockSti || HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_RFLAGS));
-    Assert(   !(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_NMI)      /* We don't support block-by-NMI and SMI yet.*/
-           && !(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_SMI));
+    Assert(!(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_SMI));    /* We don't support block-by-SMI yet.*/
     Assert(!fBlockSti || pMixedCtx->eflags.Bits.u1IF);     /* Cannot set block-by-STI when interrupts are disabled. */
     Assert(!TRPMHasTrap(pVCpu));
 
+    /*
+     * Toggling of interrupt force-flags here is safe since we update TRPM on premature exits
+     * to ring-3 before executing guest code, see hmR0VmxExitToRing3(). We must NOT restore these force-flags.
+     */
                                                                /** @todo SMI. SMIs take priority over NMIs. */
-    if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NMI))    /* NMI. NMIs take priority over regular interrupts . */
+    if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NMI))    /* NMI. NMIs take priority over regular interrupts. */
     {
         /* On some CPUs block-by-STI also blocks NMIs. See Intel spec. 26.3.1.5 "Checks On Guest Non-Register State". */
-        if (   !fBlockMovSS
-            && !fBlockSti)
+        if (   !fBlockNmi
+            && !fBlockSti
+            && !fBlockMovSS)
         {
-            /* On some CPUs block-by-STI also blocks NMIs. See Intel spec. 26.3.1.5 "Checks On Guest Non-Register State". */
             Log4(("Pending NMI vcpu[%RU32]\n", pVCpu->idCpu));
             uint32_t u32IntInfo = X86_XCPT_NMI | VMX_EXIT_INTERRUPTION_INFO_VALID;
             u32IntInfo         |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
 
-            hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddres */);
+            hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INTERRUPT_NMI);
         }
         else
-            hmR0VmxSetIntWindowExitVmcs(pVCpu);
+            hmR0VmxSetNmiWindowExitVmcs(pVCpu);
     }
+    /*
+     * Check if the guest can receive external interrupts (PIC/APIC). Once we do PDMGetInterrupt() we -must- deliver
+     * the interrupt ASAP. We must not execute any guest code until we inject the interrupt.
+     */
     else if (   VMCPU_FF_IS_PENDING(pVCpu, (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC))
              && !pVCpu->hm.s.fSingleInstruction)
     {
-        /*
-         * Check if the guest can receive external interrupts (PIC/APIC). Once we do PDMGetInterrupt() we -must- deliver
-         * the interrupt ASAP. We must not execute any guest code until we inject the interrupt which is why it is
-         * evaluated here and not set as pending, solely based on the force-flags.
-         */
         int rc = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);
         AssertRC(rc);
-        const bool fBlockInt = !(pMixedCtx->eflags.u32 & X86_EFL_IF);
+        bool const fBlockInt = !(pMixedCtx->eflags.u32 & X86_EFL_IF);
         if (   !fBlockInt
             && !fBlockSti
             && !fBlockMovSS)
@@ -6990,8 +7618,11 @@ DECLINLINE(void) hmR0VmxSetPendingDebugXcpt(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
  *                          out-of-sync. Make sure to update the required fields
  *                          before using them.
+ * @param   fStepping       Running in hmR0VmxRunGuestCodeStep() and we should
+ *                          return VINF_EM_DBG_STEPPED if the event was
+ *                          dispatched directly.
  */
-static int hmR0VmxInjectPendingEvent(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
+static int hmR0VmxInjectPendingEvent(PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fStepping)
 {
     HMVMX_ASSERT_PREEMPT_SAFE();
     Assert(VMMRZCallRing3IsEnabled(pVCpu));
@@ -7002,34 +7633,46 @@ static int hmR0VmxInjectPendingEvent(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     bool fBlockSti      = RT_BOOL(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI);
 
     Assert(!fBlockSti || HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_RFLAGS));
-    Assert(   !(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_NMI)      /* We don't support block-by-NMI and SMI yet.*/
-           && !(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_SMI));
+    Assert(!(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_SMI));     /* We don't support block-by-SMI yet.*/
     Assert(!fBlockSti || pMixedCtx->eflags.Bits.u1IF);       /* Cannot set block-by-STI when interrupts are disabled. */
     Assert(!TRPMHasTrap(pVCpu));
 
     int rc = VINF_SUCCESS;
     if (pVCpu->hm.s.Event.fPending)
     {
-#if defined(VBOX_STRICT) || defined(VBOX_WITH_STATISTICS)
+        /*
+         * Clear any interrupt-window exiting control if we're going to inject an interrupt. Saves one extra
+         * VM-exit in situations where we previously setup interrupt-window exiting but got other VM-exits and
+         * ended up enabling interrupts outside VT-x.
+         */
         uint32_t uIntType = VMX_EXIT_INTERRUPTION_INFO_TYPE(pVCpu->hm.s.Event.u64IntInfo);
+        if (   (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT)
+            && uIntType == VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT)
+        {
+            Assert(pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.VmxProcCtls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT);
+            hmR0VmxClearIntWindowExitVmcs(pVCpu);
+        }
+
+#ifdef VBOX_STRICT
         if (uIntType == VMX_EXIT_INTERRUPTION_INFO_TYPE_EXT_INT)
         {
-            rc = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);
-            AssertRCReturn(rc, rc);
-            const bool fBlockInt = !(pMixedCtx->eflags.u32 & X86_EFL_IF);
+            bool const fBlockInt = !(pMixedCtx->eflags.u32 & X86_EFL_IF);
             Assert(!fBlockInt);
             Assert(!fBlockSti);
             Assert(!fBlockMovSS);
         }
         else if (uIntType == VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI)
         {
+            bool const fBlockNmi = RT_BOOL(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_NMI);
             Assert(!fBlockSti);
             Assert(!fBlockMovSS);
+            Assert(!fBlockNmi);
         }
 #endif
-        Log4(("Injecting pending event vcpu[%RU32] u64IntInfo=%#RX64\n", pVCpu->idCpu, pVCpu->hm.s.Event.u64IntInfo));
+        Log4(("Injecting pending event vcpu[%RU32] u64IntInfo=%#RX64 Type=%#x\n", pVCpu->idCpu, pVCpu->hm.s.Event.u64IntInfo,
+              (uint8_t)uIntType));
         rc = hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, pVCpu->hm.s.Event.u64IntInfo, pVCpu->hm.s.Event.cbInstr,
-                                    pVCpu->hm.s.Event.u32ErrCode, pVCpu->hm.s.Event.GCPtrFaultAddress, &uIntrState);
+                                    pVCpu->hm.s.Event.u32ErrCode, pVCpu->hm.s.Event.GCPtrFaultAddress, fStepping, &uIntrState);
         AssertRCReturn(rc, rc);
 
         /* Update the interruptibility-state as it could have been changed by
@@ -7073,13 +7716,14 @@ static int hmR0VmxInjectPendingEvent(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     }
 
     /*
-     * There's no need to clear the VM entry-interruption information field here if we're not injecting anything.
+     * There's no need to clear the VM-entry interruption-information field here if we're not injecting anything.
      * VT-x clears the valid bit on every VM-exit. See Intel spec. 24.8.3 "VM-Entry Controls for Event Injection".
      */
     int rc2 = hmR0VmxLoadGuestIntrState(pVCpu, uIntrState);
     AssertRC(rc2);
 
-    Assert(rc == VINF_SUCCESS || rc == VINF_EM_RESET);
+    Assert(rc == VINF_SUCCESS || rc == VINF_EM_RESET || (rc == VINF_EM_DBG_STEPPED && fStepping));
+    NOREF(fBlockMovSS); NOREF(fBlockSti);
     return rc;
 }
 
@@ -7094,6 +7738,7 @@ static int hmR0VmxInjectPendingEvent(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 DECLINLINE(void) hmR0VmxSetPendingXcptUD(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
+    NOREF(pMixedCtx);
     uint32_t u32IntInfo = X86_XCPT_UD | VMX_EXIT_INTERRUPTION_INFO_VALID;
     hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
 }
@@ -7107,14 +7752,21 @@ DECLINLINE(void) hmR0VmxSetPendingXcptUD(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
  *                          out-of-sync. Make sure to update the required fields
  *                          before using them.
+ * @param   fStepping       Whether we're running in hmR0VmxRunGuestCodeStep()
+ *                          and should return VINF_EM_DBG_STEPPED if the event
+ *                          is injected directly (register modified by us, not
+ *                          by hardware on VM-entry).
+ * @param   puIntrState     Pointer to the current guest interruptibility-state.
+ *                          This interruptibility-state will be updated if
+ *                          necessary. This cannot not be NULL.
  */
-DECLINLINE(int) hmR0VmxInjectXcptDF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint32_t *puIntrState)
+DECLINLINE(int) hmR0VmxInjectXcptDF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fStepping, uint32_t *puIntrState)
 {
     uint32_t u32IntInfo  = X86_XCPT_DF | VMX_EXIT_INTERRUPTION_INFO_VALID;
     u32IntInfo          |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     u32IntInfo          |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
     return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */,
-                                  puIntrState);
+                                  fStepping, puIntrState);
 }
 
 
@@ -7128,6 +7780,7 @@ DECLINLINE(int) hmR0VmxInjectXcptDF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint32_t *
  */
 DECLINLINE(void) hmR0VmxSetPendingXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
 {
+    NOREF(pMixedCtx);
     uint32_t u32IntInfo  = X86_XCPT_DB | VMX_EXIT_INTERRUPTION_INFO_VALID;
     u32IntInfo          |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
@@ -7146,6 +7799,7 @@ DECLINLINE(void) hmR0VmxSetPendingXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 DECLINLINE(void) hmR0VmxSetPendingXcptOF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint32_t cbInstr)
 {
+    NOREF(pMixedCtx);
     uint32_t u32IntInfo  = X86_XCPT_OF | VMX_EXIT_INTERRUPTION_INFO_VALID;
     u32IntInfo          |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, cbInstr, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
@@ -7156,21 +7810,51 @@ DECLINLINE(void) hmR0VmxSetPendingXcptOF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint3
  * Injects a general-protection (#GP) fault into the VM.
  *
  * @returns VBox status code (informational status code included).
+ * @param   pVCpu               Pointer to the VMCPU.
+ * @param   pMixedCtx           Pointer to the guest-CPU context. The data may be
+ *                              out-of-sync. Make sure to update the required fields
+ *                              before using them.
+ * @param   fErrorCodeValid     Whether the error code is valid (depends on the CPU
+ *                              mode, i.e. in real-mode it's not valid).
+ * @param   u32ErrorCode        The error code associated with the #GP.
+ * @param   fStepping           Whether we're running in
+ *                              hmR0VmxRunGuestCodeStep() and should return
+ *                              VINF_EM_DBG_STEPPED if the event is injected
+ *                              directly (register modified by us, not by
+ *                              hardware on VM-entry).
+ * @param   puIntrState         Pointer to the current guest interruptibility-state.
+ *                              This interruptibility-state will be updated if
+ *                              necessary. This cannot not be NULL.
+ */
+DECLINLINE(int) hmR0VmxInjectXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fErrorCodeValid, uint32_t u32ErrorCode,
+                                    bool fStepping, uint32_t *puIntrState)
+{
+    uint32_t u32IntInfo  = X86_XCPT_GP | VMX_EXIT_INTERRUPTION_INFO_VALID;
+    u32IntInfo          |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
+    if (fErrorCodeValid)
+        u32IntInfo |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
+    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntInfo, 0 /* cbInstr */, u32ErrorCode, 0 /* GCPtrFaultAddress */,
+                                  fStepping, puIntrState);
+}
+
+
+/**
+ * Sets a general-protection (#GP) exception as pending-for-injection into the
+ * VM.
+ *
  * @param   pVCpu           Pointer to the VMCPU.
  * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
  *                          out-of-sync. Make sure to update the required fields
  *                          before using them.
  * @param   u32ErrorCode    The error code associated with the #GP.
  */
-DECLINLINE(int) hmR0VmxInjectXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fErrorCodeValid, uint32_t u32ErrorCode,
-                                    uint32_t *puIntrState)
+DECLINLINE(void) hmR0VmxSetPendingXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint32_t u32ErrorCode)
 {
+    NOREF(pMixedCtx);
     uint32_t u32IntInfo  = X86_XCPT_GP | VMX_EXIT_INTERRUPTION_INFO_VALID;
     u32IntInfo          |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
-    if (fErrorCodeValid)
-        u32IntInfo |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
-    return hmR0VmxInjectEventVmcs(pVCpu, pMixedCtx, u32IntInfo, 0 /* cbInstr */, u32ErrorCode, 0 /* GCPtrFaultAddress */,
-                                  puIntrState);
+    u32IntInfo          |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
+    hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, 0 /* cbInstr */, u32ErrorCode, 0 /* GCPtrFaultAddress */);
 }
 
 
@@ -7187,12 +7871,11 @@ DECLINLINE(int) hmR0VmxInjectXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, bool fErro
  */
 DECLINLINE(void) hmR0VmxSetPendingIntN(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint16_t uVector, uint32_t cbInstr)
 {
+    NOREF(pMixedCtx);
     uint32_t u32IntInfo = uVector | VMX_EXIT_INTERRUPTION_INFO_VALID;
     if (   uVector == X86_XCPT_BP
         || uVector == X86_XCPT_OF)
-    {
         u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_XCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
-    }
     else
         u32IntInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW_INT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);
     hmR0VmxSetPendingEvent(pVCpu, u32IntInfo, cbInstr, 0 /* u32ErrCode */, 0 /* GCPtrFaultAddress */);
@@ -7246,20 +7929,25 @@ DECLINLINE(int) hmR0VmxRealModeGuestStackPush(PVM pVM, PCPUMCTX pMixedCtx, uint1
  * @param   puIntrState         Pointer to the current guest interruptibility-state.
  *                              This interruptibility-state will be updated if
  *                              necessary. This cannot not be NULL.
+ * @param   fStepping           Whether we're running in
+ *                              hmR0VmxRunGuestCodeStep() and should return
+ *                              VINF_EM_DBG_STEPPED if the event is injected
+ *                              directly (register modified by us, not by
+ *                              hardware on VM-entry).
  *
  * @remarks Requires CR0!
  * @remarks No-long-jump zone!!!
  */
 static int hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64IntInfo, uint32_t cbInstr,
-                                  uint32_t u32ErrCode, RTGCUINTREG GCPtrFaultAddress, uint32_t *puIntrState)
+                                  uint32_t u32ErrCode, RTGCUINTREG GCPtrFaultAddress, bool fStepping, uint32_t *puIntrState)
 {
     /* Intel spec. 24.8.3 "VM-Entry Controls for Event Injection" specifies the interruption-information field to be 32-bits. */
     AssertMsg(u64IntInfo >> 32 == 0, ("%#RX64\n", u64IntInfo));
     Assert(puIntrState);
     uint32_t u32IntInfo = (uint32_t)u64IntInfo;
 
-    const uint32_t uVector  = VMX_EXIT_INTERRUPTION_INFO_VECTOR(u32IntInfo);
-    const uint32_t uIntType = VMX_EXIT_INTERRUPTION_INFO_TYPE(u32IntInfo);
+    uint32_t const uVector  = VMX_EXIT_INTERRUPTION_INFO_VECTOR(u32IntInfo);
+    uint32_t const uIntType = VMX_EXIT_INTERRUPTION_INFO_TYPE(u32IntInfo);
 
 #ifdef VBOX_STRICT
     /* Validate the error-code-valid bit for hardware exceptions. */
@@ -7315,21 +8003,21 @@ static int hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64
             Assert(HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_RIP));
 
             /* Check if the interrupt handler is present in the IVT (real-mode IDT). IDT limit is (4N - 1). */
-            const size_t cbIdtEntry = sizeof(X86IDTR16);
+            size_t const cbIdtEntry = sizeof(X86IDTR16);
             if (uVector * cbIdtEntry + (cbIdtEntry - 1) > pMixedCtx->idtr.cbIdt)
             {
                 /* If we are trying to inject a #DF with no valid IDT entry, return a triple-fault. */
                 if (uVector == X86_XCPT_DF)
                     return VINF_EM_RESET;
-                else if (uVector == X86_XCPT_GP)
-                {
-                    /* If we're injecting a #GP with no valid IDT entry, inject a double-fault. */
-                    return hmR0VmxInjectXcptDF(pVCpu, pMixedCtx, puIntrState);
-                }
+
+                /* If we're injecting a #GP with no valid IDT entry, inject a double-fault. */
+                if (uVector == X86_XCPT_GP)
+                    return hmR0VmxInjectXcptDF(pVCpu, pMixedCtx, fStepping, puIntrState);
 
                 /* If we're injecting an interrupt/exception with no valid IDT entry, inject a general-protection fault. */
                 /* No error codes for exceptions in real-mode. See Intel spec. 20.1.4 "Interrupt and Exception Handling" */
-                return hmR0VmxInjectXcptGP(pVCpu, pMixedCtx, false /* fErrCodeValid */, 0 /* u32ErrCode */, puIntrState);
+                return hmR0VmxInjectXcptGP(pVCpu, pMixedCtx, false /* fErrCodeValid */, 0 /* u32ErrCode */,
+                                           fStepping, puIntrState);
             }
 
             /* Software exceptions (#BP and #OF exceptions thrown as a result of INT3 or INTO) */
@@ -7361,19 +8049,18 @@ static int hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64
                 pMixedCtx->eflags.u32 &= ~(X86_EFL_IF | X86_EFL_TF | X86_EFL_RF | X86_EFL_AC);
                 pMixedCtx->rip         = IdtEntry.offSel;
                 pMixedCtx->cs.Sel      = IdtEntry.uSel;
+                pMixedCtx->cs.ValidSel = IdtEntry.uSel;
                 pMixedCtx->cs.u64Base  = IdtEntry.uSel << cbIdtEntry;
                 if (   uIntType == VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT
                     && uVector  == X86_XCPT_PF)
-                {
                     pMixedCtx->cr2 = GCPtrFaultAddress;
-                }
 
                 /* If any other guest-state bits are changed here, make sure to update
                    hmR0VmxPreRunGuestCommitted() when thread-context hooks are used. */
-                HMCPU_CF_SET(pVCpu,     HM_CHANGED_GUEST_SEGMENT_REGS
-                                      | HM_CHANGED_GUEST_RIP
-                                      | HM_CHANGED_GUEST_RFLAGS
-                                      | HM_CHANGED_GUEST_RSP);
+                HMCPU_CF_SET(pVCpu,   HM_CHANGED_GUEST_SEGMENT_REGS
+                                    | HM_CHANGED_GUEST_RIP
+                                    | HM_CHANGED_GUEST_RFLAGS
+                                    | HM_CHANGED_GUEST_RSP);
 
                 /* We're clearing interrupts, which means no block-by-STI interrupt-inhibition. */
                 if (*puIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI)
@@ -7383,29 +8070,32 @@ static int hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64
                     Log4(("Clearing inhibition due to STI.\n"));
                     *puIntrState &= ~VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI;
                 }
-                Log4(("Injecting real-mode: u32IntInfo=%#x u32ErrCode=%#x instrlen=%#x\n", u32IntInfo, u32ErrCode, cbInstr));
+                Log4(("Injecting real-mode: u32IntInfo=%#x u32ErrCode=%#x cbInstr=%#x Eflags=%#x CS:EIP=%04x:%04x\n",
+                      u32IntInfo, u32ErrCode, cbInstr, pMixedCtx->eflags.u, pMixedCtx->cs.Sel, pMixedCtx->eip));
 
                 /* The event has been truly dispatched. Mark it as no longer pending so we don't attempt to 'undo'
                    it, if we are returning to ring-3 before executing guest code. */
                 pVCpu->hm.s.Event.fPending = false;
+
+                /* Make hmR0VmxPreRunGuest return if we're stepping since we've changed cs:rip. */
+                if (fStepping)
+                    rc = VINF_EM_DBG_STEPPED;
             }
-            Assert(rc == VINF_SUCCESS || rc == VINF_EM_RESET);
+            Assert(rc == VINF_SUCCESS || rc == VINF_EM_RESET || (rc == VINF_EM_DBG_STEPPED && fStepping));
             return rc;
         }
-        else
-        {
-            /*
-             * For unrestricted execution enabled CPUs running real-mode guests, we must not set the deliver-error-code bit.
-             * See Intel spec. 26.2.1.3 "VM-Entry Control Fields".
-             */
-            u32IntInfo &= ~VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
-        }
+
+        /*
+         * For unrestricted execution enabled CPUs running real-mode guests, we must not set the deliver-error-code bit.
+         * See Intel spec. 26.2.1.3 "VM-Entry Control Fields".
+         */
+        u32IntInfo &= ~VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;
     }
 
     /* Validate. */
-    Assert(VMX_EXIT_INTERRUPTION_INFO_IS_VALID(u32IntInfo));        /* Bit 31 (Valid bit) must be set by caller. */
-    Assert(!VMX_EXIT_INTERRUPTION_INFO_NMI_UNBLOCK(u32IntInfo));    /* Bit 12 MBZ. */
-    Assert(!(u32IntInfo & 0x7ffff000));                             /* Bits 30:12 MBZ. */
+    Assert(VMX_EXIT_INTERRUPTION_INFO_IS_VALID(u32IntInfo));             /* Bit 31 (Valid bit) must be set by caller. */
+    Assert(!VMX_EXIT_INTERRUPTION_INFO_NMI_UNBLOCK_IRET(u32IntInfo));    /* Bit 12 MBZ. */
+    Assert(!(u32IntInfo & 0x7ffff000));                                  /* Bits 30:12 MBZ. */
 
     /* Inject. */
     rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INTERRUPTION_INFO, u32IntInfo);
@@ -7415,9 +8105,7 @@ static int hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PCPUMCTX pMixedCtx, uint64_t u64
 
     if (   VMX_EXIT_INTERRUPTION_INFO_TYPE(u32IntInfo) == VMX_EXIT_INTERRUPTION_INFO_TYPE_HW_XCPT
         && uVector == X86_XCPT_PF)
-    {
         pMixedCtx->cr2 = GCPtrFaultAddress;
-    }
 
     Log4(("Injecting vcpu[%RU32] u32IntInfo=%#x u32ErrCode=%#x cbInstr=%#x pMixedCtx->uCR2=%#RX64\n", pVCpu->idCpu,
           u32IntInfo, u32ErrCode, cbInstr, pMixedCtx->cr2));
@@ -7443,12 +8131,16 @@ static void hmR0VmxClearEventVmcs(PVMCPU pVCpu)
     int rc;
     Log4Func(("vcpu[%d]\n", pVCpu->idCpu));
 
-    /* Clear interrupt-window exiting control. */
     if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT)
     {
-        pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT;
-        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);
-        AssertRC(rc);
+        hmR0VmxClearIntWindowExitVmcs(pVCpu);
+        Assert(!pVCpu->hm.s.Event.fPending);
+    }
+
+    if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_NMI_WINDOW_EXIT)
+    {
+        hmR0VmxClearNmiWindowExitVmcs(pVCpu);
+        Assert(!pVCpu->hm.s.Event.fPending);
     }
 
     if (!pVCpu->hm.s.Event.fPending)
@@ -7461,13 +8153,14 @@ static void hmR0VmxClearEventVmcs(PVMCPU pVCpu)
     Assert(VMX_ENTRY_INTERRUPTION_INFO_IS_VALID(u32EntryInfo));
 #endif
 
-    /* Clear the entry-interruption field (including the valid bit). */
     rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_ENTRY_INTERRUPTION_INFO, 0);
     AssertRC(rc);
 
-    /* Clear the pending debug exception field. */
     rc = VMXWriteVmcs32(VMX_VMCS_GUEST_PENDING_DEBUG_EXCEPTIONS, 0);
     AssertRC(rc);
+
+    /* We deliberately don't clear "hm.s.Event.fPending" here, it's taken
+       care of in hmR0VmxExitToRing3() converting the pending event to TRPM. */
 }
 
 
@@ -7485,7 +8178,7 @@ VMMR0DECL(int) VMXR0Enter(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
     AssertPtr(pVCpu);
     Assert(pVM->hm.s.vmx.fSupported);
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-    NOREF(pCpu);
+    NOREF(pCpu); NOREF(pVM);
 
     LogFlowFunc(("pVM=%p pVCpu=%p\n", pVM, pVCpu));
     Assert(HMCPU_CF_IS_SET(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_HOST_GUEST_SHARED_STATE));
@@ -7526,12 +8219,14 @@ VMMR0DECL(int) VMXR0Enter(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
  */
 VMMR0DECL(void) VMXR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit)
 {
+    NOREF(fGlobalInit);
+
     switch (enmEvent)
     {
-        case RTTHREADCTXEVENT_PREEMPTING:
+        case RTTHREADCTXEVENT_OUT:
         {
             Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-            Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu));
+            Assert(VMMR0ThreadCtxHookIsEnabled(pVCpu));
             VMCPU_ASSERT_EMT(pVCpu);
 
             PVM      pVM       = pVCpu->CTX_SUFF(pVM);
@@ -7562,10 +8257,10 @@ VMMR0DECL(void) VMXR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu,
             break;
         }
 
-        case RTTHREADCTXEVENT_RESUMED:
+        case RTTHREADCTXEVENT_IN:
         {
             Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-            Assert(VMMR0ThreadCtxHooksAreRegistered(pVCpu));
+            Assert(VMMR0ThreadCtxHookIsEnabled(pVCpu));
             VMCPU_ASSERT_EMT(pVCpu);
 
             /* No longjmps here, as we don't want to trigger preemption (& its hook) while resuming. */
@@ -7656,11 +8351,13 @@ VMMR0DECL(int) VMXR0SaveHostState(PVM pVM, PVMCPU pVCpu)
 
 
 /**
- * Loads the guest state into the VMCS guest-state area. The CPU state will be
- * loaded from these fields on every successful VM-entry.
+ * Loads the guest state into the VMCS guest-state area.
+ *
+ * The will typically be done before VM-entry when the guest-CPU state and the
+ * VMCS state may potentially be out of sync.
  *
- * Sets up the VM-entry MSR-load and VM-exit MSR-store areas.
- * Sets up the VM-entry controls.
+ * Sets up the VM-entry MSR-load and VM-exit MSR-store areas. Sets up the
+ * VM-entry controls.
  * Sets up the appropriate VMX non-root function to execute guest code based on
  * the guest CPU mode.
  *
@@ -7680,16 +8377,8 @@ static int hmR0VmxLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     AssertPtr(pMixedCtx);
     HMVMX_ASSERT_PREEMPT_SAFE();
 
-#ifdef LOG_ENABLED
-    /** @todo r=ramshankar: I'm not able to use VMMRZCallRing3Disable() here,
-     *        probably not initialized yet? Anyway this will do for now.
-     *
-     *  Update: Should be possible once VMXR0LoadGuestState() is removed as an
-     *  interface and disable ring-3 calls when thread-context hooks are not
-     *  available. */
-    bool fCallerDisabledLogFlush = VMMR0IsLogFlushDisabled(pVCpu);
-    VMMR0LogFlushDisable(pVCpu);
-#endif
+    VMMRZCallRing3Disable(pVCpu);
+    Assert(VMMR0IsLogFlushDisabled(pVCpu));
 
     LogFlowFunc(("pVM=%p pVCpu=%p\n", pVM, pVCpu));
 
@@ -7729,12 +8418,17 @@ static int hmR0VmxLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     rc = hmR0VmxLoadGuestSegmentRegs(pVCpu, pMixedCtx);
     AssertLogRelMsgRCReturn(rc, ("hmR0VmxLoadGuestSegmentRegs: rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
 
+    /* This needs to be done after hmR0VmxLoadGuestEntryCtls() and hmR0VmxLoadGuestExitCtls() as it may alter controls if we
+       determine we don't have to swap EFER after all. */
     rc = hmR0VmxLoadGuestMsrs(pVCpu, pMixedCtx);
-    AssertLogRelMsgRCReturn(rc, ("hmR0VmxLoadGuestMsrs! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
+    AssertLogRelMsgRCReturn(rc, ("hmR0VmxLoadSharedMsrs! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
 
     rc = hmR0VmxLoadGuestApicState(pVCpu, pMixedCtx);
     AssertLogRelMsgRCReturn(rc, ("hmR0VmxLoadGuestApicState! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
 
+    rc = hmR0VmxLoadGuestXcptIntercepts(pVCpu, pMixedCtx);
+    AssertLogRelMsgRCReturn(rc, ("hmR0VmxLoadGuestXcptIntercepts! rc=%Rrc (pVM=%p pVCpu=%p)\n", rc, pVM, pVCpu), rc);
+
     /*
      * Loading Rflags here is fine, even though Rflags.TF might depend on guest debug state (which is not loaded here).
      * It is re-evaluated and updated if necessary in hmR0VmxLoadSharedState().
@@ -7745,11 +8439,7 @@ static int hmR0VmxLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
     /* Clear any unused and reserved bits. */
     HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_CR2);
 
-#ifdef LOG_ENABLED
-    /* Only reenable log-flushing if the caller has it enabled. */
-    if (!fCallerDisabledLogFlush)
-        VMMR0LogFlushEnable(pVCpu);
-#endif
+    VMMRZCallRing3Enable(pVCpu);
 
     STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatLoadGuestState, x);
     return rc;
@@ -7767,6 +8457,8 @@ static int hmR0VmxLoadGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx)
  */
 static void hmR0VmxLoadSharedState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
+    NOREF(pVM);
+
     Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     Assert(!VMMRZCallRing3IsEnabled(pVCpu));
 
@@ -7789,6 +8481,23 @@ static void hmR0VmxLoadSharedState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         }
     }
 
+    if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_LAZY_MSRS))
+    {
+#if HC_ARCH_BITS == 64
+        if (pVM->hm.s.fAllow64BitGuests)
+            hmR0VmxLazyLoadGuestMsrs(pVCpu, pCtx);
+#endif
+        HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_LAZY_MSRS);
+    }
+
+    /* Loading CR0, debug state might have changed intercepts, update VMCS. */
+    if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS))
+    {
+        int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXCEPTION_BITMAP, pVCpu->hm.s.vmx.u32XcptBitmap);
+        AssertRC(rc);
+        HMCPU_CF_CLEAR(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
+    }
+
     AssertMsg(!HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_HOST_GUEST_SHARED_STATE),
               ("fContextUseFlags=%#RX32\n", HMCPU_CF_VALUE(pVCpu)));
 }
@@ -7808,7 +8517,7 @@ DECLINLINE(void) hmR0VmxLoadGuestStateOptimal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pM
     HMVMX_ASSERT_PREEMPT_SAFE();
 
     Log5(("LoadFlags=%#RX32\n", HMCPU_CF_VALUE(pVCpu)));
-#ifdef HMVMX_SYNC_FULL_GUEST_STATE
+#ifdef HMVMX_ALWAYS_SYNC_FULL_GUEST_STATE
     HMCPU_CF_SET(pVCpu, HM_CHANGED_ALL_GUEST);
 #endif
 
@@ -7829,12 +8538,6 @@ DECLINLINE(void) hmR0VmxLoadGuestStateOptimal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pM
     AssertMsg(   !HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_ALL_GUEST)
               ||  HMCPU_CF_IS_PENDING_ONLY(pVCpu, HM_CHANGED_HOST_CONTEXT | HM_CHANGED_HOST_GUEST_SHARED_STATE),
               ("fContextUseFlags=%#RX32\n", HMCPU_CF_VALUE(pVCpu)));
-
-#ifdef HMVMX_ALWAYS_CHECK_GUEST_STATE
-    uint32_t uInvalidReason = hmR0VmxCheckGuestState(pVM, pVCpu, pMixedCtx);
-    if (uInvalidReason != VMX_IGS_REASON_NOT_FOUND)
-        Log4(("hmR0VmxCheckGuestState returned %#x\n", uInvalidReason));
-#endif
 }
 
 
@@ -7842,19 +8545,22 @@ DECLINLINE(void) hmR0VmxLoadGuestStateOptimal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pM
  * Does the preparations before executing guest code in VT-x.
  *
  * This may cause longjmps to ring-3 and may even result in rescheduling to the
- * recompiler. We must be cautious what we do here regarding committing
+ * recompiler/IEM. We must be cautious what we do here regarding committing
  * guest-state information into the VMCS assuming we assuredly execute the
- * guest in VT-x mode. If we fall back to the recompiler after updating the VMCS
- * and clearing the common-state (TRPM/forceflags), we must undo those changes
- * so that the recompiler can (and should) use them when it resumes guest
- * execution. Otherwise such operations must be done when we can no longer
- * exit to ring-3.
+ * guest in VT-x mode.
+ *
+ * If we fall back to the recompiler/IEM after updating the VMCS and clearing
+ * the common-state (TRPM/forceflags), we must undo those changes so that the
+ * recompiler/IEM can (and should) use them when it resumes guest execution.
+ * Otherwise such operations must be done when we can no longer exit to ring-3.
  *
  * @returns Strict VBox status code.
  * @retval  VINF_SUCCESS if we can proceed with running the guest, interrupts
  *          have been disabled.
  * @retval  VINF_EM_RESET if a triple-fault occurs while injecting a
  *          double-fault into the guest.
+ * @retval  VINF_EM_DBG_STEPPED if @a fStepping is true and an event was
+ *          dispatched directly.
  * @retval  VINF_* scheduling changes, we have to go back to ring-3.
  *
  * @param   pVM             Pointer to the VM.
@@ -7863,11 +8569,12 @@ DECLINLINE(void) hmR0VmxLoadGuestStateOptimal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pM
  *                          out-of-sync. Make sure to update the required fields
  *                          before using them.
  * @param   pVmxTransient   Pointer to the VMX transient structure.
- *
- * @remarks Called with preemption disabled. In the VINF_SUCCESS return case
- *          interrupts will be disabled.
+ * @param   fStepping       Set if called from hmR0VmxRunGuestCodeStep().  Makes
+ *                          us ignore some of the reasons for returning to
+ *                          ring-3, and return VINF_EM_DBG_STEPPED if event
+ *                          dispatching took place.
  */
-static int hmR0VmxPreRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
+static int hmR0VmxPreRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, bool fStepping)
 {
     Assert(VMMRZCallRing3IsEnabled(pVCpu));
 
@@ -7903,13 +8610,6 @@ static int hmR0VmxPreRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRA
     }
 #endif /* !IEM_VERIFICATION_MODE_FULL */
 
-    /* Load the guest state bits, we can handle longjmps/getting preempted here. */
-    hmR0VmxLoadGuestStateOptimal(pVM, pVCpu, pMixedCtx);
-
-    /*
-     * Evaluate events as pending-for-injection into the guest. Toggling of force-flags here is safe as long as
-     * we update TRPM on premature exits to ring-3 before executing guest code. We must NOT restore the force-flags.
-     */
     if (TRPMHasTrap(pVCpu))
         hmR0VmxTrpmTrapToPendingEvent(pVCpu);
     else if (!pVCpu->hm.s.Event.fPending)
@@ -7919,14 +8619,23 @@ static int hmR0VmxPreRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRA
      * Event injection may take locks (currently the PGM lock for real-on-v86 case) and thus needs to be done with
      * longjmps or interrupts + preemption enabled. Event injection might also result in triple-faulting the VM.
      */
-    rc = hmR0VmxInjectPendingEvent(pVCpu, pMixedCtx);
+    rc = hmR0VmxInjectPendingEvent(pVCpu, pMixedCtx, fStepping);
     if (RT_UNLIKELY(rc != VINF_SUCCESS))
     {
-        Assert(rc == VINF_EM_RESET);
+        Assert(rc == VINF_EM_RESET || (rc == VINF_EM_DBG_STEPPED && fStepping));
         return rc;
     }
 
     /*
+     * Load the guest state bits, we can handle longjmps/getting preempted here.
+     *
+     * If we are injecting events to a real-on-v86 mode guest, we will have to update
+     * RIP and some segment registers, i.e. hmR0VmxInjectPendingEvent()->hmR0VmxInjectEventVmcs().
+     * Hence, this needs to be done -after- injection of events.
+     */
+    hmR0VmxLoadGuestStateOptimal(pVM, pVCpu, pMixedCtx);
+
+    /*
      * No longjmps to ring-3 from this point on!!!
      * Asserts() will still longjmp to ring-3 (but won't return), which is intentional, better than a kernel panic.
      * This also disables flushing of the R0-logger instance (if any).
@@ -7943,20 +8652,23 @@ static int hmR0VmxPreRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRA
      * We also check a couple of other force-flags as a last opportunity to get the EMT back to ring-3 before
      * executing guest code.
      */
-    pVmxTransient->uEflags = ASMIntDisableFlags();
-    if (   VM_FF_IS_PENDING(pVM, VM_FF_EMT_RENDEZVOUS | VM_FF_TM_VIRTUAL_SYNC)
-        || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK))
+    pVmxTransient->fEFlags = ASMIntDisableFlags();
+    if (  (   VM_FF_IS_PENDING(pVM, VM_FF_EMT_RENDEZVOUS | VM_FF_TM_VIRTUAL_SYNC)
+           || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK))
+        && (   !fStepping /* Optimized for the non-stepping case, of course. */
+            || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK & ~(VMCPU_FF_TIMER | VMCPU_FF_PDM_CRITSECT))) )
     {
         hmR0VmxClearEventVmcs(pVCpu);
-        ASMSetFlags(pVmxTransient->uEflags);
+        ASMSetFlags(pVmxTransient->fEFlags);
         VMMRZCallRing3Enable(pVCpu);
         STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchHmToR3FF);
         return VINF_EM_RAW_TO_R3;
     }
+
     if (RTThreadPreemptIsPending(NIL_RTTHREAD))
     {
         hmR0VmxClearEventVmcs(pVCpu);
-        ASMSetFlags(pVmxTransient->uEflags);
+        ASMSetFlags(pVmxTransient->fEFlags);
         VMMRZCallRing3Enable(pVCpu);
         STAM_COUNTER_INC(&pVCpu->hm.s.StatPendingHostIrq);
         return VINF_EM_RAW_INTERRUPT;
@@ -7993,28 +8705,35 @@ static void hmR0VmxPreRunGuestCommitted(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCt
     VMCPU_ASSERT_STATE(pVCpu, VMCPUSTATE_STARTED_HM);
     VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);            /* Indicate the start of guest execution. */
 
-    /*
-     * If we are injecting events to a real-on-v86 mode guest, we may have to update
-     * RIP and some other registers, i.e. hmR0VmxInjectPendingEvent()->hmR0VmxInjectEventVmcs().
-     * Reload only the necessary state, the assertion will catch if other parts of the code
-     * change.
-     */
-    if (pVCpu->hm.s.vmx.RealMode.fRealOnV86Active)
-    {
-        hmR0VmxLoadGuestRipRspRflags(pVCpu, pMixedCtx);
-        hmR0VmxLoadGuestSegmentRegs(pVCpu, pMixedCtx);
-    }
-
 #ifdef HMVMX_ALWAYS_SWAP_FPU_STATE
     if (!CPUMIsGuestFPUStateActive(pVCpu))
         CPUMR0LoadGuestFPU(pVM, pVCpu, pMixedCtx);
     HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR0);
 #endif
 
+    if (   pVCpu->hm.s.fPreloadGuestFpu
+        && !CPUMIsGuestFPUStateActive(pVCpu))
+    {
+        CPUMR0LoadGuestFPU(pVM, pVCpu, pMixedCtx);
+        Assert(HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_CR0));
+        HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR0);
+    }
+
+    /*
+     * Lazy-update of the host MSRs values in the auto-load/store MSR area.
+     */
+    if (   !pVCpu->hm.s.vmx.fUpdatedHostMsrs
+        && pVCpu->hm.s.vmx.cMsrs > 0)
+    {
+        hmR0VmxUpdateAutoLoadStoreHostMsrs(pVCpu);
+    }
+
     /*
      * Load the host state bits as we may've been preempted (only happens when
      * thread-context hooks are used or when hmR0VmxSetupVMRunHandler() changes pfnStartVM).
      */
+    /** @todo Why should hmR0VmxSetupVMRunHandler() changing pfnStartVM have
+     *        any effect to the host state needing to be saved? */
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_HOST_CONTEXT))
     {
         /* This ASSUMES that pfnStartVM has been set up already. */
@@ -8025,7 +8744,7 @@ static void hmR0VmxPreRunGuestCommitted(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCt
     Assert(!HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_HOST_CONTEXT));
 
     /*
-     * Load the state shared between host and guest (FPU, debug).
+     * Load the state shared between host and guest (FPU, debug, lazy MSRs).
      */
     if (HMCPU_CF_IS_PENDING(pVCpu, HM_CHANGED_HOST_GUEST_SHARED_STATE))
         hmR0VmxLoadSharedState(pVM, pVCpu, pMixedCtx);
@@ -8057,7 +8776,7 @@ static void hmR0VmxPreRunGuestCommitted(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCt
     if (   pVmxTransient->fUpdateTscOffsettingAndPreemptTimer
         || idCurrentCpu != pVCpu->hm.s.idLastCpu)
     {
-        hmR0VmxUpdateTscOffsettingAndPreemptTimer(pVCpu, pMixedCtx);
+        hmR0VmxUpdateTscOffsettingAndPreemptTimer(pVM, pVCpu);
         pVmxTransient->fUpdateTscOffsettingAndPreemptTimer = false;
     }
 
@@ -8071,21 +8790,42 @@ static void hmR0VmxPreRunGuestCommitted(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCt
     TMNotifyStartOfExecution(pVCpu);                            /* Finally, notify TM to resume its clocks as we're about
                                                                    to start executing. */
 
-#ifndef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
     /*
-     * Save the current Host TSC_AUX and write the guest TSC_AUX to the host, so that
-     * RDTSCPs (that don't cause exits) reads the guest MSR. See @bugref{3324}.
+     * Load the TSC_AUX MSR when we are not intercepting RDTSCP.
      */
     if (pVCpu->hm.s.vmx.u32ProcCtls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP)
     {
-        pVCpu->hm.s.u64HostTscAux = ASMRdMsr(MSR_K8_TSC_AUX);
-        uint64_t u64HostTscAux = CPUMR0GetGuestTscAux(pVCpu);
-        ASMWrMsr(MSR_K8_TSC_AUX, u64HostTscAux);
+        if (!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT))
+        {
+            bool fMsrUpdated;
+            int rc2 = hmR0VmxSaveGuestAutoLoadStoreMsrs(pVCpu, pMixedCtx);
+            AssertRC(rc2);
+            Assert(HMVMXCPU_GST_IS_UPDATED(pVCpu, HMVMX_UPDATED_GUEST_AUTO_LOAD_STORE_MSRS));
+
+            rc2 = hmR0VmxAddAutoLoadStoreMsr(pVCpu, MSR_K8_TSC_AUX, CPUMR0GetGuestTscAux(pVCpu), true /* fUpdateHostMsr */,
+                                             &fMsrUpdated);
+            AssertRC(rc2);
+            Assert(fMsrUpdated || pVCpu->hm.s.vmx.fUpdatedHostMsrs);
+
+            /* Finally, mark that all host MSR values are updated so we don't redo it without leaving VT-x. See @bugref{6956}. */
+            pVCpu->hm.s.vmx.fUpdatedHostMsrs = true;
+        }
+        else
+        {
+            hmR0VmxRemoveAutoLoadStoreMsr(pVCpu, MSR_K8_TSC_AUX);
+            Assert(!pVCpu->hm.s.vmx.cMsrs || pVCpu->hm.s.vmx.fUpdatedHostMsrs);
+        }
     }
-#endif
+
 #ifdef VBOX_STRICT
-    hmR0VmxCheckVmcsHostEferMsr(pVCpu);
     hmR0VmxCheckAutoLoadStoreMsrs(pVCpu);
+    hmR0VmxCheckHostEferMsr(pVCpu);
+    AssertRC(hmR0VmxCheckVmcsCtls(pVCpu));
+#endif
+#ifdef HMVMX_ALWAYS_CHECK_GUEST_STATE
+    uint32_t uInvalidReason = hmR0VmxCheckGuestState(pVM, pVCpu, pMixedCtx);
+    if (uInvalidReason != VMX_IGS_REASON_NOT_FOUND)
+        Log4(("hmR0VmxCheckGuestState returned %#x\n", uInvalidReason));
 #endif
 }
 
@@ -8109,6 +8849,8 @@ static void hmR0VmxPreRunGuestCommitted(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCt
  */
 static void hmR0VmxPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient, int rcVMRun)
 {
+    NOREF(pVM);
+
     Assert(!VMMRZCallRing3IsEnabled(pVCpu));
 
     ASMAtomicWriteBool(&pVCpu->hm.s.fCheckedTLBFlush, false);   /* See HMInvalidatePageOnAllVCpus(): used for TLB-shootdowns. */
@@ -8116,16 +8858,10 @@ static void hmR0VmxPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXT
     HMVMXCPU_GST_RESET_TO(pVCpu, 0);                            /* Exits/longjmps to ring-3 requires saving the guest state. */
     pVmxTransient->fVmcsFieldsRead     = 0;                     /* Transient fields need to be read from the VMCS. */
     pVmxTransient->fVectoringPF        = false;                 /* Vectoring page-fault needs to be determined later. */
+    pVmxTransient->fVectoringDoublePF  = false;                 /* Vectoring double page-fault needs to be determined later. */
 
     if (!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT))
-    {
-#ifndef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-        /* Restore host's TSC_AUX. */
-        if (pVCpu->hm.s.vmx.u32ProcCtls2 & VMX_VMCS_CTRL_PROC_EXEC2_RDTSCP)
-            ASMWrMsr(MSR_K8_TSC_AUX, pVCpu->hm.s.u64HostTscAux);
-#endif
         TMCpuTickSetLastSeen(pVCpu, ASMReadTSC() + pVCpu->hm.s.vmx.u64TSCOffset);
-    }
 
     STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatInGC, &pVCpu->hm.s.StatExit1, x);
     TMNotifyEndOfExecution(pVCpu);                                    /* Notify TM that the guest is no longer running. */
@@ -8141,9 +8877,14 @@ static void hmR0VmxPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXT
     }
 #endif
 
+#if HC_ARCH_BITS == 64
     pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_REQUIRED;   /* Host state messed up by VT-x, we must restore. */
+#endif
     pVCpu->hm.s.vmx.uVmcsState |= HMVMX_VMCS_STATE_LAUNCHED;          /* Use VMRESUME instead of VMLAUNCH in the next run. */
-    ASMSetFlags(pVmxTransient->uEflags);                              /* Enable interrupts. */
+#ifdef VBOX_STRICT
+    hmR0VmxCheckHostEferMsr(pVCpu);                                   /* Verify that VMRUN/VMLAUNCH didn't modify host EFER. */
+#endif
+    ASMSetFlags(pVmxTransient->fEFlags);                              /* Enable interrupts. */
     VMMRZCallRing3Enable(pVCpu);                                      /* It is now safe to do longjmps to ring-3!!! */
 
     /* Save the basic VM-exit reason. Refer Intel spec. 24.9.1 "Basic VM-exit Information". */
@@ -8154,6 +8895,9 @@ static void hmR0VmxPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXT
     pVmxTransient->uExitReason    = (uint16_t)VMX_EXIT_REASON_BASIC(uExitReason);
     pVmxTransient->fVMEntryFailed = VMX_ENTRY_INTERRUPTION_INFO_IS_VALID(pVmxTransient->uEntryIntInfo);
 
+    /* Update the VM-exit history array. */
+    HMCPU_EXIT_HISTORY_ADD(pVCpu, pVmxTransient->uExitReason);
+
     /* If the VMLAUNCH/VMRESUME failed, we can bail out early. This does -not- cover VMX_EXIT_ERR_*. */
     if (RT_UNLIKELY(rcVMRun != VINF_SUCCESS))
     {
@@ -8164,12 +8908,20 @@ static void hmR0VmxPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXT
 
     if (RT_LIKELY(!pVmxTransient->fVMEntryFailed))
     {
+        /** @todo We can optimize this by only syncing with our force-flags when
+         *        really needed and keeping the VMCS state as it is for most
+         *        VM-exits. */
         /* Update the guest interruptibility-state from the VMCS. */
         hmR0VmxSaveGuestIntrState(pVCpu, pMixedCtx);
-#if defined(HMVMX_SYNC_FULL_GUEST_STATE) || defined(HMVMX_SAVE_FULL_GUEST_STATE)
+
+#if defined(HMVMX_ALWAYS_SYNC_FULL_GUEST_STATE) || defined(HMVMX_ALWAYS_SAVE_FULL_GUEST_STATE)
         rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
         AssertRC(rc);
+#elif defined(HMVMX_ALWAYS_SAVE_GUEST_RFLAGS)
+        rc = hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);
+        AssertRC(rc);
 #endif
+
         /*
          * If the TPR was raised by the guest, it wouldn't cause a VM-exit immediately. Instead we sync the TPR lazily whenever
          * we eventually get a VM-exit for any reason. This maybe expensive as PDMApicSetTPR() can longjmp to ring-3 and which is
@@ -8187,7 +8939,6 @@ static void hmR0VmxPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXT
 }
 
 
-
 /**
  * Runs the guest code using VT-x the normal way.
  *
@@ -8196,8 +8947,7 @@ static void hmR0VmxPostRunGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXT
  * @param   pVCpu       Pointer to the VMCPU.
  * @param   pCtx        Pointer to the guest-CPU context.
  *
- * @note    Mostly the same as hmR0VmxRunGuestCodeStep.
- * @remarks Called with preemption disabled.
+ * @note    Mostly the same as hmR0VmxRunGuestCodeStep().
  */
 static int hmR0VmxRunGuestCodeNormal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
@@ -8214,7 +8964,7 @@ static int hmR0VmxRunGuestCodeNormal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         /* Preparatory work for running guest code, this may force us to return
            to ring-3.  This bugger disables interrupts on VINF_SUCCESS! */
         STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatEntry, x);
-        rc = hmR0VmxPreRunGuest(pVM, pVCpu, pCtx, &VmxTransient);
+        rc = hmR0VmxPreRunGuest(pVM, pVCpu, pCtx, &VmxTransient, false /* fStepping */);
         if (rc != VINF_SUCCESS)
             break;
 
@@ -8234,12 +8984,22 @@ static int hmR0VmxRunGuestCodeNormal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
             return rc;
         }
 
-        /* Handle the VM-exit. */
+        /* Profile the VM-exit. */
         AssertMsg(VmxTransient.uExitReason <= VMX_EXIT_MAX, ("%#x\n", VmxTransient.uExitReason));
         STAM_COUNTER_INC(&pVCpu->hm.s.StatExitAll);
         STAM_COUNTER_INC(&pVCpu->hm.s.paStatExitReasonR0[VmxTransient.uExitReason & MASK_EXITREASON_STAT]);
         STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatExit1, &pVCpu->hm.s.StatExit2, x);
         HMVMX_START_EXIT_DISPATCH_PROF();
+
+        VBOXVMM_R0_HMVMX_VMEXIT_NOCTX(pVCpu, pCtx, VmxTransient.uExitReason);
+        if (RT_UNLIKELY(VBOXVMM_R0_HMVMX_VMEXIT_ENABLED()))
+        {
+            hmR0VmxReadExitQualificationVmcs(pVCpu, &VmxTransient);
+            hmR0VmxSaveGuestState(pVCpu, pCtx);
+            VBOXVMM_R0_HMVMX_VMEXIT(pVCpu, pCtx, VmxTransient.uExitReason, VmxTransient.uExitQualification);
+        }
+
+        /* Handle the VM-exit. */
 #ifdef HMVMX_USE_FUNCTION_TABLE
         rc = g_apfnVMExitHandlers[VmxTransient.uExitReason](pVCpu, pCtx, &VmxTransient);
 #else
@@ -8248,9 +9008,9 @@ static int hmR0VmxRunGuestCodeNormal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit2, x);
         if (rc != VINF_SUCCESS)
             break;
-        else if (cLoops > pVM->hm.s.cMaxResumeLoops)
+        if (cLoops > pVM->hm.s.cMaxResumeLoops)
         {
-            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitMaxResume);
+            STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchMaxResumeLoops);
             rc = VINF_EM_RAW_INTERRUPT;
             break;
         }
@@ -8269,14 +9029,13 @@ static int hmR0VmxRunGuestCodeNormal(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
  * @param   pVCpu       Pointer to the VMCPU.
  * @param   pCtx        Pointer to the guest-CPU context.
  *
- * @note    Mostly the same as hmR0VmxRunGuestCodeNormal.
- * @remarks Called with preemption disabled.
+ * @note    Mostly the same as hmR0VmxRunGuestCodeNormal().
  */
 static int hmR0VmxRunGuestCodeStep(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
     VMXTRANSIENT VmxTransient;
     VmxTransient.fUpdateTscOffsettingAndPreemptTimer = true;
-    int          rc        = VERR_INTERNAL_ERROR_5;
+    VBOXSTRICTRC rcStrict  = VERR_INTERNAL_ERROR_5;
     uint32_t     cLoops    = 0;
     uint16_t     uCsStart  = pCtx->cs.Sel;
     uint64_t     uRipStart = pCtx->rip;
@@ -8289,44 +9048,50 @@ static int hmR0VmxRunGuestCodeStep(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         /* Preparatory work for running guest code, this may force us to return
            to ring-3.  This bugger disables interrupts on VINF_SUCCESS! */
         STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatEntry, x);
-        rc = hmR0VmxPreRunGuest(pVM, pVCpu, pCtx, &VmxTransient);
-        if (rc != VINF_SUCCESS)
+        rcStrict = hmR0VmxPreRunGuest(pVM, pVCpu, pCtx, &VmxTransient, true /* fStepping */);
+        if (rcStrict != VINF_SUCCESS)
             break;
 
         hmR0VmxPreRunGuestCommitted(pVM, pVCpu, pCtx, &VmxTransient);
-        rc = hmR0VmxRunGuest(pVM, pVCpu, pCtx);
+        rcStrict = hmR0VmxRunGuest(pVM, pVCpu, pCtx);
         /* The guest-CPU context is now outdated, 'pCtx' is to be treated as 'pMixedCtx' from this point on!!! */
 
         /* Restore any residual host-state and save any bits shared between host
            and guest into the guest-CPU state.  Re-enables interrupts! */
-        hmR0VmxPostRunGuest(pVM, pVCpu, pCtx, &VmxTransient, rc);
+        hmR0VmxPostRunGuest(pVM, pVCpu, pCtx, &VmxTransient, VBOXSTRICTRC_TODO(rcStrict));
 
         /* Check for errors with running the VM (VMLAUNCH/VMRESUME). */
-        if (RT_UNLIKELY(rc != VINF_SUCCESS))
+        if (RT_UNLIKELY(rcStrict != VINF_SUCCESS))
         {
             STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit1, x);
-            hmR0VmxReportWorldSwitchError(pVM, pVCpu, rc, pCtx, &VmxTransient);
-            return rc;
+            hmR0VmxReportWorldSwitchError(pVM, pVCpu, VBOXSTRICTRC_TODO(rcStrict), pCtx, &VmxTransient);
+            return VBOXSTRICTRC_TODO(rcStrict);
         }
 
-        /* Handle the VM-exit. */
+        /* Profile the VM-exit. */
         AssertMsg(VmxTransient.uExitReason <= VMX_EXIT_MAX, ("%#x\n", VmxTransient.uExitReason));
         STAM_COUNTER_INC(&pVCpu->hm.s.StatExitAll);
         STAM_COUNTER_INC(&pVCpu->hm.s.paStatExitReasonR0[VmxTransient.uExitReason & MASK_EXITREASON_STAT]);
         STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatExit1, &pVCpu->hm.s.StatExit2, x);
         HMVMX_START_EXIT_DISPATCH_PROF();
-#ifdef HMVMX_USE_FUNCTION_TABLE
-        rc = g_apfnVMExitHandlers[VmxTransient.uExitReason](pVCpu, pCtx, &VmxTransient);
-#else
-        rc = hmR0VmxHandleExit(pVCpu, pCtx, &VmxTransient, VmxTransient.uExitReason);
-#endif
+
+        VBOXVMM_R0_HMVMX_VMEXIT_NOCTX(pVCpu, pCtx, VmxTransient.uExitReason);
+        if (RT_UNLIKELY(VBOXVMM_R0_HMVMX_VMEXIT_ENABLED()))
+        {
+            hmR0VmxReadExitQualificationVmcs(pVCpu, &VmxTransient);
+            hmR0VmxSaveGuestState(pVCpu, pCtx);
+            VBOXVMM_R0_HMVMX_VMEXIT(pVCpu, pCtx, VmxTransient.uExitReason, VmxTransient.uExitQualification);
+        }
+
+        /* Handle the VM-exit - we quit earlier on certain VM-exits, see hmR0VmxHandleExitStep(). */
+        rcStrict = hmR0VmxHandleExitStep(pVCpu, pCtx, &VmxTransient, VmxTransient.uExitReason, uCsStart, uRipStart);
         STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExit2, x);
-        if (rc != VINF_SUCCESS)
+        if (rcStrict != VINF_SUCCESS)
             break;
-        else if (cLoops > pVM->hm.s.cMaxResumeLoops)
+        if (cLoops > pVM->hm.s.cMaxResumeLoops)
         {
-            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitMaxResume);
-            rc = VINF_EM_RAW_INTERRUPT;
+            STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchMaxResumeLoops);
+            rcStrict = VINF_EM_RAW_INTERRUPT;
             break;
         }
 
@@ -8340,14 +9105,28 @@ static int hmR0VmxRunGuestCodeStep(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         if (   pCtx->rip    != uRipStart
             || pCtx->cs.Sel != uCsStart)
         {
-            rc = VINF_EM_DBG_STEPPED;
+            rcStrict = VINF_EM_DBG_STEPPED;
             break;
         }
         HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_DEBUG);
     }
 
+    /*
+     * Clear the X86_EFL_TF if necessary.
+     */
+    if (pVCpu->hm.s.fClearTrapFlag)
+    {
+        int rc2 = hmR0VmxSaveGuestRflags(pVCpu, pCtx);
+        AssertRCReturn(rc2, rc2);
+        pVCpu->hm.s.fClearTrapFlag = false;
+        pCtx->eflags.Bits.u1TF = 0;
+    }
+    /** @todo there seems to be issues with the resume flag when the monitor trap
+     *        flag is pending without being used. Seen early in bios init when
+     *        accessing APIC page in protected mode. */
+
     STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatEntry, x);
-    return rc;
+    return VBOXSTRICTRC_TODO(rcStrict);
 }
 
 
@@ -8358,8 +9137,6 @@ static int hmR0VmxRunGuestCodeStep(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
  * @param   pVM         Pointer to the VM.
  * @param   pVCpu       Pointer to the VMCPU.
  * @param   pCtx        Pointer to the guest-CPU context.
- *
- * @remarks Called with preemption disabled.
  */
 VMMR0DECL(int) VMXR0RunGuestCode(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
@@ -8433,7 +9210,8 @@ DECLINLINE(int) hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
         case VMX_EXIT_RDRAND:                  /* SVVMCS(); */ rc = hmR0VmxExitRdrand(pVCpu, pMixedCtx, pVmxTransient);            /* LDVMCS(); */ break;
         case VMX_EXIT_INVPCID:                 /* SVVMCS(); */ rc = hmR0VmxExitInvpcid(pVCpu, pMixedCtx, pVmxTransient);           /* LDVMCS(); */ break;
         case VMX_EXIT_GETSEC:                  /* SVVMCS(); */ rc = hmR0VmxExitGetsec(pVCpu, pMixedCtx, pVmxTransient);            /* LDVMCS(); */ break;
-        case VMX_EXIT_RDPMC:                   /* SVVMCS(); */ rc = hmR0VmxExitRdpmc(pVCpu, pMixedCtx, pVmxTransient);             /* LDVMCS(); */  break;
+        case VMX_EXIT_RDPMC:                   /* SVVMCS(); */ rc = hmR0VmxExitRdpmc(pVCpu, pMixedCtx, pVmxTransient);             /* LDVMCS(); */ break;
+        case VMX_EXIT_VMCALL:                  /* SVVMCS(); */ rc = hmR0VmxExitVmcall(pVCpu, pMixedCtx, pVmxTransient);            /* LDVMCS(); */ break;
 
         case VMX_EXIT_TRIPLE_FAULT:            rc = hmR0VmxExitTripleFault(pVCpu, pMixedCtx, pVmxTransient); break;
         case VMX_EXIT_NMI_WINDOW:              rc = hmR0VmxExitNmiWindow(pVCpu, pMixedCtx, pVmxTransient); break;
@@ -8445,7 +9223,6 @@ DECLINLINE(int) hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
         case VMX_EXIT_ERR_INVALID_GUEST_STATE: rc = hmR0VmxExitErrInvalidGuestState(pVCpu, pMixedCtx, pVmxTransient); break;
         case VMX_EXIT_ERR_MACHINE_CHECK:       rc = hmR0VmxExitErrMachineCheck(pVCpu, pMixedCtx, pVmxTransient); break;
 
-        case VMX_EXIT_VMCALL:
         case VMX_EXIT_VMCLEAR:
         case VMX_EXIT_VMLAUNCH:
         case VMX_EXIT_VMPTRLD:
@@ -8458,15 +9235,117 @@ DECLINLINE(int) hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
         case VMX_EXIT_INVEPT:
         case VMX_EXIT_INVVPID:
         case VMX_EXIT_VMFUNC:
+        case VMX_EXIT_XSAVES:
+        case VMX_EXIT_XRSTORS:
             rc = hmR0VmxExitSetPendingXcptUD(pVCpu, pMixedCtx, pVmxTransient);
             break;
+        case VMX_EXIT_RESERVED_60:
+        case VMX_EXIT_RDSEED: /* only spurious exits, so undefined */
+        case VMX_EXIT_RESERVED_62:
         default:
             rc = hmR0VmxExitErrUndefined(pVCpu, pMixedCtx, pVmxTransient);
             break;
     }
     return rc;
 }
+#endif /* !HMVMX_USE_FUNCTION_TABLE */
+
+
+/**
+ * Single-stepping VM-exit filtering.
+ *
+ * This is preprocessing the exits and deciding whether we've gotten far enough
+ * to return VINF_EM_DBG_STEPPED already.  If not, normal VM-exit handling is
+ * performed.
+ *
+ * @returns Strict VBox status code.
+ * @param   pVCpu           The virtual CPU of the calling EMT.
+ * @param   pMixedCtx       Pointer to the guest-CPU context. The data may be
+ *                          out-of-sync. Make sure to update the required
+ *                          fields before using them.
+ * @param   pVmxTransient   Pointer to the VMX-transient structure.
+ * @param   uExitReason     The VM-exit reason.
+ */
+DECLINLINE(VBOXSTRICTRC) hmR0VmxHandleExitStep(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient,
+                                               uint32_t uExitReason, uint16_t uCsStart, uint64_t uRipStart)
+{
+    switch (uExitReason)
+    {
+        case VMX_EXIT_XCPT_OR_NMI:
+        {
+            /* Check for host NMI. */
+            int rc2 = hmR0VmxReadExitIntInfoVmcs(pVmxTransient);
+            AssertRCReturn(rc2, rc2);
+            uint32_t uIntType = VMX_EXIT_INTERRUPTION_INFO_TYPE(pVmxTransient->uExitIntInfo);
+            if (uIntType == VMX_EXIT_INTERRUPTION_INFO_TYPE_NMI)
+                return hmR0VmxExitXcptOrNmi(pVCpu, pMixedCtx, pVmxTransient);
+            /* fall thru */
+        }
+
+        case VMX_EXIT_EPT_MISCONFIG:
+        case VMX_EXIT_TRIPLE_FAULT:
+        case VMX_EXIT_APIC_ACCESS:
+        case VMX_EXIT_TPR_BELOW_THRESHOLD:
+        case VMX_EXIT_TASK_SWITCH:
+
+        /* Instruction specific VM-exits: */
+        case VMX_EXIT_IO_INSTR:
+        case VMX_EXIT_CPUID:
+        case VMX_EXIT_RDTSC:
+        case VMX_EXIT_RDTSCP:
+        case VMX_EXIT_MOV_CRX:
+        case VMX_EXIT_MWAIT:
+        case VMX_EXIT_MONITOR:
+        case VMX_EXIT_RDMSR:
+        case VMX_EXIT_WRMSR:
+        case VMX_EXIT_MOV_DRX:
+        case VMX_EXIT_HLT:
+        case VMX_EXIT_INVD:
+        case VMX_EXIT_INVLPG:
+        case VMX_EXIT_RSM:
+        case VMX_EXIT_PAUSE:
+        case VMX_EXIT_XDTR_ACCESS:
+        case VMX_EXIT_TR_ACCESS:
+        case VMX_EXIT_WBINVD:
+        case VMX_EXIT_XSETBV:
+        case VMX_EXIT_RDRAND:
+        case VMX_EXIT_INVPCID:
+        case VMX_EXIT_GETSEC:
+        case VMX_EXIT_RDPMC:
+        case VMX_EXIT_VMCALL:
+        case VMX_EXIT_VMCLEAR:
+        case VMX_EXIT_VMLAUNCH:
+        case VMX_EXIT_VMPTRLD:
+        case VMX_EXIT_VMPTRST:
+        case VMX_EXIT_VMREAD:
+        case VMX_EXIT_VMRESUME:
+        case VMX_EXIT_VMWRITE:
+        case VMX_EXIT_VMXOFF:
+        case VMX_EXIT_VMXON:
+        case VMX_EXIT_INVEPT:
+        case VMX_EXIT_INVVPID:
+        case VMX_EXIT_VMFUNC:
+        {
+            int rc2 = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
+            rc2    |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
+            AssertRCReturn(rc2, rc2);
+            if (   pMixedCtx->rip    != uRipStart
+                || pMixedCtx->cs.Sel != uCsStart)
+                return VINF_EM_DBG_STEPPED;
+            break;
+        }
+    }
+
+    /*
+     * Normal processing.
+     */
+#ifdef HMVMX_USE_FUNCTION_TABLE
+    return g_apfnVMExitHandlers[uExitReason](pVCpu, pMixedCtx, pVmxTransient);
+#else
+    return hmR0VmxHandleExit(pVCpu, pMixedCtx, pVmxTransient, uExitReason);
 #endif
+}
+
 
 #ifdef DEBUG
 /* Is there some generic IPRT define for this that are not in Runtime/internal/\* ?? */
@@ -8499,10 +9378,14 @@ DECLINLINE(int) hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
 # define HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS() \
             do { \
                 Log4Func(("\n")); \
-            } while(0)
+            } while (0)
 #else   /* Release builds */
-# define HMVMX_VALIDATE_EXIT_HANDLER_PARAMS() do { HMVMX_STOP_EXIT_DISPATCH_PROF(); } while(0)
-# define HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS() do { } while(0)
+# define HMVMX_VALIDATE_EXIT_HANDLER_PARAMS() \
+            do { \
+                HMVMX_STOP_EXIT_DISPATCH_PROF(); \
+                NOREF(pVCpu); NOREF(pMixedCtx); NOREF(pVmxTransient); \
+            } while (0)
+# define HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS() do { } while (0)
 #endif
 
 
@@ -8520,7 +9403,7 @@ DECLINLINE(int) hmR0VmxHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
  */
 DECLINLINE(int) hmR0VmxAdvanceGuestRip(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
 {
-    int rc = hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
+    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     rc    |= hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
     rc    |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);
     AssertRCReturn(rc, rc);
@@ -8551,6 +9434,9 @@ DECLINLINE(int) hmR0VmxAdvanceGuestRip(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRA
  * @param   pVM     Pointer to the VM.
  * @param   pVCpu   Pointer to the VMCPU.
  * @param   pCtx    Pointer to the guest-CPU state.
+ *
+ * @remarks This function assumes our cache of the VMCS controls
+ *          are valid, i.e. hmR0VmxCheckVmcsCtls() succeeded.
  */
 static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 {
@@ -8558,9 +9444,7 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 #define HMVMX_CHECK_BREAK(expr, err)        if (!(expr)) { \
                                                 uError = (err); \
                                                 break; \
-                                            } else do {} while (0)
-/* Duplicate of IEM_IS_CANONICAL(). */
-#define HMVMX_IS_CANONICAL(a_u64Addr)       ((uint64_t)(a_u64Addr) + UINT64_C(0x800000000000) < UINT64_C(0x1000000000000))
+                                            } else do { } while (0)
 
     int      rc;
     uint32_t uError             = VMX_IGS_ERROR;
@@ -8575,7 +9459,7 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         uint32_t uSetCR0 = (uint32_t)(pVM->hm.s.vmx.Msrs.u64Cr0Fixed0 & pVM->hm.s.vmx.Msrs.u64Cr0Fixed1);
         uint32_t uZapCR0 = (uint32_t)(pVM->hm.s.vmx.Msrs.u64Cr0Fixed0 | pVM->hm.s.vmx.Msrs.u64Cr0Fixed1);
         /* Exceptions for unrestricted-guests for fixed CR0 bits (PE, PG).
-           See Intel spec. 26.3.1 "Checks on guest Guest Control Registers, Debug Registers and MSRs." */
+           See Intel spec. 26.3.1 "Checks on Guest Control Registers, Debug Registers and MSRs." */
         if (fUnrestrictedGuest)
             uSetCR0 &= ~(X86_CR0_PE | X86_CR0_PG);
 
@@ -8639,9 +9523,9 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
                 HMVMX_CHECK_BREAK(!(u64Val & UINT64_C(0xffffffff00000000)), VMX_IGS_LONGMODE_RIP_INVALID);
             }
             /** @todo If the processor supports N < 64 linear-address bits, bits 63:N
-             *        must be identical if the "IA32e mode guest" VM-entry control is 1
-             *        and CS.L is 1. No check applies if the CPU supports 64
-             *        linear-address bits. */
+             *        must be identical if the "IA-32e mode guest" VM-entry
+             *        control is 1 and CS.L is 1. No check applies if the
+             *        CPU supports 64 linear-address bits. */
 
             /* Flags in pCtx can be different (real-on-v86 for instance). We are only concerned about the VMCS contents here. */
             rc = VMXReadVmcs64(VMX_VMCS_GUEST_RFLAGS, &u64Val);
@@ -8705,11 +9589,11 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 
             rc = VMXReadVmcs64(VMX_VMCS_HOST_SYSENTER_ESP, &u64Val);
             AssertRCBreak(rc);
-            HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(u64Val), VMX_IGS_SYSENTER_ESP_NOT_CANONICAL);
+            HMVMX_CHECK_BREAK(X86_IS_CANONICAL(u64Val), VMX_IGS_SYSENTER_ESP_NOT_CANONICAL);
 
             rc = VMXReadVmcs64(VMX_VMCS_HOST_SYSENTER_EIP, &u64Val);
             AssertRCBreak(rc);
-            HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(u64Val), VMX_IGS_SYSENTER_EIP_NOT_CANONICAL);
+            HMVMX_CHECK_BREAK(X86_IS_CANONICAL(u64Val), VMX_IGS_SYSENTER_EIP_NOT_CANONICAL);
         }
 #endif
 
@@ -8753,14 +9637,17 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
          */
         if (pVCpu->hm.s.vmx.u32EntryCtls & VMX_VMCS_CTRL_ENTRY_LOAD_GUEST_EFER_MSR)
         {
+            Assert(pVM->hm.s.vmx.fSupportsVmcsEfer);
             rc = VMXReadVmcs64(VMX_VMCS64_GUEST_EFER_FULL, &u64Val);
             AssertRCBreak(rc);
             HMVMX_CHECK_BREAK(!(u64Val & UINT64_C(0xfffffffffffff2fe)),
                               VMX_IGS_EFER_MSR_RESERVED);               /* Bits 63:12, bit 9, bits 7:1 MBZ. */
-            HMVMX_CHECK_BREAK((u64Val & MSR_K6_EFER_LMA) == (pVCpu->hm.s.vmx.u32EntryCtls & VMX_VMCS_CTRL_ENTRY_IA32E_MODE_GUEST),
+            HMVMX_CHECK_BREAK(RT_BOOL(u64Val & MSR_K6_EFER_LMA) == RT_BOOL(pVCpu->hm.s.vmx.u32EntryCtls & VMX_VMCS_CTRL_ENTRY_IA32E_MODE_GUEST),
                               VMX_IGS_EFER_LMA_GUEST_MODE_MISMATCH);
             HMVMX_CHECK_BREAK(   fUnrestrictedGuest
-                              || (u64Val & MSR_K6_EFER_LMA) == (u32GuestCR0 & X86_CR0_PG), VMX_IGS_EFER_LMA_PG_MISMATCH);
+                              || !(u32GuestCR0 & X86_CR0_PG)
+                              || RT_BOOL(u64Val & MSR_K6_EFER_LMA) == RT_BOOL(u64Val & MSR_K6_EFER_LME),
+                              VMX_IGS_EFER_LMA_LME_MISMATCH);
         }
 
         /*
@@ -8880,10 +9767,10 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
             if (HMVMX_IS_64BIT_HOST_MODE())
             {
-                HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(pCtx->fs.u64Base), VMX_IGS_FS_BASE_NOT_CANONICAL);
-                HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(pCtx->gs.u64Base), VMX_IGS_GS_BASE_NOT_CANONICAL);
+                HMVMX_CHECK_BREAK(X86_IS_CANONICAL(pCtx->fs.u64Base), VMX_IGS_FS_BASE_NOT_CANONICAL);
+                HMVMX_CHECK_BREAK(X86_IS_CANONICAL(pCtx->gs.u64Base), VMX_IGS_GS_BASE_NOT_CANONICAL);
                 HMVMX_CHECK_BREAK(   (pCtx->ldtr.Attr.u & X86DESCATTR_UNUSABLE)
-                                  || HMVMX_IS_CANONICAL(pCtx->ldtr.u64Base), VMX_IGS_LDTR_BASE_NOT_CANONICAL);
+                                  || X86_IS_CANONICAL(pCtx->ldtr.u64Base), VMX_IGS_LDTR_BASE_NOT_CANONICAL);
                 HMVMX_CHECK_BREAK(!(pCtx->cs.u64Base >> 32), VMX_IGS_LONGMODE_CS_BASE_INVALID);
                 HMVMX_CHECK_BREAK((pCtx->ss.Attr.u & X86DESCATTR_UNUSABLE) || !(pCtx->ss.u64Base >> 32),
                                   VMX_IGS_LONGMODE_SS_BASE_INVALID);
@@ -8939,10 +9826,10 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
             if (HMVMX_IS_64BIT_HOST_MODE())
             {
-                HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(pCtx->fs.u64Base), VMX_IGS_FS_BASE_NOT_CANONICAL);
-                HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(pCtx->gs.u64Base), VMX_IGS_GS_BASE_NOT_CANONICAL);
+                HMVMX_CHECK_BREAK(X86_IS_CANONICAL(pCtx->fs.u64Base), VMX_IGS_FS_BASE_NOT_CANONICAL);
+                HMVMX_CHECK_BREAK(X86_IS_CANONICAL(pCtx->gs.u64Base), VMX_IGS_GS_BASE_NOT_CANONICAL);
                 HMVMX_CHECK_BREAK(   (pCtx->ldtr.Attr.u & X86DESCATTR_UNUSABLE)
-                                  || HMVMX_IS_CANONICAL(pCtx->ldtr.u64Base), VMX_IGS_LDTR_BASE_NOT_CANONICAL);
+                                  || X86_IS_CANONICAL(pCtx->ldtr.u64Base), VMX_IGS_LDTR_BASE_NOT_CANONICAL);
                 HMVMX_CHECK_BREAK(!(pCtx->cs.u64Base >> 32), VMX_IGS_LONGMODE_CS_BASE_INVALID);
                 HMVMX_CHECK_BREAK((pCtx->ss.Attr.u & X86DESCATTR_UNUSABLE) || !(pCtx->ss.u64Base >> 32),
                                   VMX_IGS_LONGMODE_SS_BASE_INVALID);
@@ -8962,7 +9849,7 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
         if (HMVMX_IS_64BIT_HOST_MODE())
         {
-            HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(pCtx->tr.u64Base), VMX_IGS_TR_BASE_NOT_CANONICAL);
+            HMVMX_CHECK_BREAK(X86_IS_CANONICAL(pCtx->tr.u64Base), VMX_IGS_TR_BASE_NOT_CANONICAL);
         }
 #endif
         if (fLongModeGuest)
@@ -8993,11 +9880,11 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
         {
             rc = VMXReadVmcs64(VMX_VMCS_GUEST_GDTR_BASE, &u64Val);
             AssertRCBreak(rc);
-            HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(u64Val), VMX_IGS_GDTR_BASE_NOT_CANONICAL);
+            HMVMX_CHECK_BREAK(X86_IS_CANONICAL(u64Val), VMX_IGS_GDTR_BASE_NOT_CANONICAL);
 
             rc = VMXReadVmcs64(VMX_VMCS_GUEST_IDTR_BASE, &u64Val);
             AssertRCBreak(rc);
-            HMVMX_CHECK_BREAK(HMVMX_IS_CANONICAL(u64Val), VMX_IGS_IDTR_BASE_NOT_CANONICAL);
+            HMVMX_CHECK_BREAK(X86_IS_CANONICAL(u64Val), VMX_IGS_IDTR_BASE_NOT_CANONICAL);
         }
 #endif
 
@@ -9156,7 +10043,6 @@ static uint32_t hmR0VmxCheckGuestState(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
 
 #undef HMVMX_ERROR_BREAK
 #undef HMVMX_CHECK_BREAK
-#undef HMVMX_IS_CANONICAL
 }
 
 /* -=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
@@ -9175,7 +10061,7 @@ HMVMX_EXIT_DECL hmR0VmxExitExtInt(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
     HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitExtInt);
     /* Windows hosts (32-bit and 64-bit) have DPC latency issues. See @bugref{6853}. */
-    if (VMMR0ThreadCtxHooksAreRegistered(pVCpu))
+    if (VMMR0ThreadCtxHookIsEnabled(pVCpu))
         return VINF_SUCCESS;
     return VINF_EM_RAW_INTERRUPT;
 }
@@ -9189,7 +10075,7 @@ HMVMX_EXIT_DECL hmR0VmxExitXcptOrNmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANS
     HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
     STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatExitXcptNmi, y3);
 
-    int rc = hmR0VmxReadExitIntInfoVmcs(pVCpu, pVmxTransient);
+    int rc = hmR0VmxReadExitIntInfoVmcs(pVmxTransient);
     AssertRCReturn(rc, rc);
 
     uint32_t uIntType = VMX_EXIT_INTERRUPTION_INFO_TYPE(pVmxTransient->uExitIntInfo);
@@ -9214,19 +10100,16 @@ HMVMX_EXIT_DECL hmR0VmxExitXcptOrNmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANS
 
     /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
     rc = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient);
-    if (RT_UNLIKELY(rc == VINF_HM_DOUBLE_FAULT))
-    {
-        STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitXcptNmi, y3);
-        return VINF_SUCCESS;
-    }
-    else if (RT_UNLIKELY(rc == VINF_EM_RESET))
+    if (RT_UNLIKELY(rc != VINF_SUCCESS))
     {
+        if (rc == VINF_HM_DOUBLE_FAULT)
+            rc = VINF_SUCCESS;
         STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitXcptNmi, y3);
         return rc;
     }
 
     uint32_t uExitIntInfo = pVmxTransient->uExitIntInfo;
-    uint32_t uVector       = VMX_EXIT_INTERRUPTION_INFO_VECTOR(uExitIntInfo);
+    uint32_t uVector      = VMX_EXIT_INTERRUPTION_INFO_VECTOR(uExitIntInfo);
     switch (uIntType)
     {
         case VMX_EXIT_INTERRUPTION_INFO_TYPE_PRIV_SW_XCPT:  /* Privileged software exception. (#DB from ICEBP) */
@@ -9256,6 +10139,8 @@ HMVMX_EXIT_DECL hmR0VmxExitXcptOrNmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANS
                                   rc = hmR0VmxExitXcptGeneric(pVCpu, pMixedCtx, pVmxTransient); break;
                 case X86_XCPT_NP: STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestNP);
                                   rc = hmR0VmxExitXcptGeneric(pVCpu, pMixedCtx, pVmxTransient); break;
+                case X86_XCPT_TS: STAM_COUNTER_INC(&pVCpu->hm.s.StatExitGuestTS);
+                                  rc = hmR0VmxExitXcptGeneric(pVCpu, pMixedCtx, pVmxTransient); break;
 #endif
                 default:
                 {
@@ -9269,8 +10154,8 @@ HMVMX_EXIT_DECL hmR0VmxExitXcptOrNmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANS
                         Assert(PDMVmmDevHeapIsEnabled(pVCpu->CTX_SUFF(pVM)));
                         Assert(CPUMIsGuestInRealModeEx(pMixedCtx));
 
-                        rc  = hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
-                        rc |= hmR0VmxReadExitIntErrorCodeVmcs(pVCpu, pVmxTransient);
+                        rc  = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
+                        rc |= hmR0VmxReadExitIntErrorCodeVmcs(pVmxTransient);
                         AssertRCReturn(rc, rc);
                         hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(uExitIntInfo),
                                                pVmxTransient->cbInstr, pVmxTransient->uExitIntErrorCode,
@@ -9310,12 +10195,9 @@ HMVMX_EXIT_DECL hmR0VmxExitIntWindow(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANS
     HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
 
     /* Indicate that we no longer need to VM-exit when the guest is ready to receive interrupts, it is now ready. */
-    Assert(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT);
-    pVCpu->hm.s.vmx.u32ProcCtls &= ~VMX_VMCS_CTRL_PROC_EXEC_INT_WINDOW_EXIT;
-    int rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);
-    AssertRCReturn(rc, rc);
+    hmR0VmxClearIntWindowExitVmcs(pVCpu);
 
-    /* Deliver the pending interrupt via hmR0VmxPreRunGuest()->hmR0VmxInjectEvent() and resume guest execution. */
+    /* Deliver the pending interrupts via hmR0VmxEvaluatePendingEvent() and resume guest execution. */
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitIntWindow);
     return VINF_SUCCESS;
 }
@@ -9327,8 +10209,34 @@ HMVMX_EXIT_DECL hmR0VmxExitIntWindow(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANS
 HMVMX_EXIT_DECL hmR0VmxExitNmiWindow(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
 {
     HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
-    AssertMsgFailed(("Unexpected NMI-window exit.\n"));
-    HMVMX_RETURN_UNEXPECTED_EXIT();
+    if (RT_UNLIKELY(!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_NMI_WINDOW_EXIT)))
+    {
+        AssertMsgFailed(("Unexpected NMI-window exit.\n"));
+        HMVMX_RETURN_UNEXPECTED_EXIT();
+    }
+
+    Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS));
+
+    /*
+     * If block-by-STI is set when we get this VM-exit, it means the CPU doesn't block NMIs following STI.
+     * It is therefore safe to unblock STI and deliver the NMI ourselves. See @bugref{7445}.
+     */
+    uint32_t uIntrState = 0;
+    int rc = VMXReadVmcs32(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE, &uIntrState);
+    AssertRCReturn(rc, rc);
+
+    bool const fBlockSti = RT_BOOL(uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI);
+    if (   fBlockSti
+        && VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
+    {
+        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
+    }
+
+    /* Indicate that we no longer need to VM-exit when the guest is ready to receive NMIs, it is now ready */
+    hmR0VmxClearNmiWindowExitVmcs(pVCpu);
+
+    /* Deliver the pending NMI via hmR0VmxEvaluatePendingEvent() and resume guest execution. */
+    return VINF_SUCCESS;
 }
 
 
@@ -9414,10 +10322,7 @@ HMVMX_EXIT_DECL hmR0VmxExitRdtsc(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT
             pVmxTransient->fUpdateTscOffsettingAndPreemptTimer = true;
     }
     else
-    {
-        AssertMsgFailed(("hmR0VmxExitRdtsc: EMInterpretRdtsc failed with %Rrc\n", rc));
         rc = VERR_EM_INTERPRETER;
-    }
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitRdtsc);
     return rc;
 }
@@ -9481,6 +10386,41 @@ HMVMX_EXIT_DECL hmR0VmxExitRdpmc(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT
 
 
 /**
+ * VM-exit handler for VMCALL (VMX_EXIT_VMCALL). Unconditional VM-exit.
+ */
+HMVMX_EXIT_DECL hmR0VmxExitVmcall(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
+{
+    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
+    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitVmcall);
+
+    if (pVCpu->hm.s.fHypercallsEnabled)
+    {
+#if 0
+        int rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
+        AssertRCReturn(rc, rc);
+#else
+        /* Aggressive state sync. for now. */
+        int rc  = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
+        rc     |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);    /* For long-mode checks in gimKvmHypercall(). */
+#endif
+        AssertRCReturn(rc, rc);
+
+        rc = GIMHypercall(pVCpu, pMixedCtx);
+        if (RT_SUCCESS(rc))
+        {
+            /* If the hypercall changes anything other than guest general-purpose registers,
+               we would need to reload the guest changed bits here before VM-reentry. */
+            hmR0VmxAdvanceGuestRip(pVCpu, pMixedCtx, pVmxTransient);
+            return VINF_SUCCESS;
+        }
+    }
+
+    hmR0VmxSetPendingXcptUD(pVCpu, pMixedCtx);
+    return VINF_SUCCESS;
+}
+
+
+/**
  * VM-exit handler for INVLPG (VMX_EXIT_INVLPG). Conditional VM-exit.
  */
 HMVMX_EXIT_DECL hmR0VmxExitInvlpg(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
@@ -9581,6 +10521,7 @@ HMVMX_EXIT_DECL hmR0VmxExitRsm(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT p
      * executing VMCALL in VMX root operation. If we get here, something funny is going on.
      * See Intel spec. "33.15.5 Enabling the Dual-Monitor Treatment".
      */
+    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
     AssertMsgFailed(("Unexpected RSM VM-exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
     HMVMX_RETURN_UNEXPECTED_EXIT();
 }
@@ -9593,10 +10534,11 @@ HMVMX_EXIT_DECL hmR0VmxExitSmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT p
 {
     /*
      * This can only happen if we support dual-monitor treatment of SMI, which can be activated by executing VMCALL in VMX
-     * root operation. Only an STM (SMM transfer monitor) would get this exit when we (the executive monitor) execute a VMCALL
+     * root operation. Only an STM (SMM transfer monitor) would get this VM-exit when we (the executive monitor) execute a VMCALL
      * in VMX root mode or receive an SMI. If we get here, something funny is going on.
      * See Intel spec. "33.15.6 Activating the Dual-Monitor Treatment" and Intel spec. 25.3 "Other Causes of VM-Exits"
      */
+    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
     AssertMsgFailed(("Unexpected SMI VM-exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
     HMVMX_RETURN_UNEXPECTED_EXIT();
 }
@@ -9608,6 +10550,7 @@ HMVMX_EXIT_DECL hmR0VmxExitSmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT p
 HMVMX_EXIT_DECL hmR0VmxExitIoSmi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
 {
     /* Same treatment as VMX_EXIT_SMI. See comment in hmR0VmxExitSmi(). */
+    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
     AssertMsgFailed(("Unexpected IO SMI VM-exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
     HMVMX_RETURN_UNEXPECTED_EXIT();
 }
@@ -9623,6 +10566,7 @@ HMVMX_EXIT_DECL hmR0VmxExitSipi(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT
      * don't make use of it (see hmR0VmxLoadGuestActivityState()) as our guests don't have direct access to the host LAPIC.
      * See Intel spec. 25.3 "Other Causes of VM-exits".
      */
+    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
     AssertMsgFailed(("Unexpected SIPI VM-exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
     HMVMX_RETURN_UNEXPECTED_EXIT();
 }
@@ -9676,6 +10620,8 @@ HMVMX_EXIT_DECL hmR0VmxExitHlt(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT p
         rc = VINF_EM_HALT;
 
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitHlt);
+    if (rc != VINF_SUCCESS)
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchHltToR3);
     return rc;
 }
 
@@ -9717,9 +10663,17 @@ HMVMX_EXIT_DECL hmR0VmxExitXsetbv(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
 {
     HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
 
-    /* We expose XSETBV to the guest, fallback to the recompiler for emulation. */
-    /** @todo check if XSETBV is supported by the recompiler. */
-    return VERR_EM_INTERPRETER;
+    int rc = hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
+    rc |= hmR0VmxSaveGuestRegsForIemExec(pVCpu, pMixedCtx, false /*fMemory*/, false /*fNeedRsp*/);
+    rc |= hmR0VmxSaveGuestCR4(pVCpu, pMixedCtx);
+    AssertRCReturn(rc, rc);
+
+    VBOXSTRICTRC rcStrict = IEMExecDecodedXsetbv(pVCpu, pVmxTransient->cbInstr);
+    HMCPU_CF_SET(pVCpu, rcStrict != VINF_IEM_RAISED_XCPT ? HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS : HM_CHANGED_ALL_GUEST);
+
+    pVCpu->hm.s.fLoadSaveGuestXcr0 = (pMixedCtx->cr4 & X86_CR4_OSXSAVE) && pMixedCtx->aXcr[0] != ASMGetXcr0();
+
+    return VBOXSTRICTRC_TODO(rcStrict);
 }
 
 
@@ -9730,7 +10684,7 @@ HMVMX_EXIT_DECL hmR0VmxExitInvpcid(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIE
 {
     HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
 
-    /* The guest should not invalidate the host CPU's TLBs, fallback to recompiler. */
+    /* The guest should not invalidate the host CPU's TLBs, fallback to interpreter. */
     /** @todo implement EMInterpretInvpcid() */
     return VERR_EM_INTERPRETER;
 }
@@ -9745,6 +10699,9 @@ HMVMX_EXIT_DECL hmR0VmxExitErrInvalidGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx
     int rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
     AssertRCReturn(rc, rc);
 
+    rc = hmR0VmxCheckVmcsCtls(pVCpu);
+    AssertRCReturn(rc, rc);
+
     uint32_t uInvalidReason = hmR0VmxCheckGuestState(pVCpu->CTX_SUFF(pVM), pVCpu, pMixedCtx);
     NOREF(uInvalidReason);
 
@@ -9756,7 +10713,7 @@ HMVMX_EXIT_DECL hmR0VmxExitErrInvalidGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx
 
     rc  = hmR0VmxReadEntryIntInfoVmcs(pVmxTransient);
     rc |= hmR0VmxReadEntryXcptErrorCodeVmcs(pVmxTransient);
-    rc |= hmR0VmxReadEntryInstrLenVmcs(pVCpu, pVmxTransient);
+    rc |= hmR0VmxReadEntryInstrLenVmcs(pVmxTransient);
     rc |= VMXReadVmcs32(VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE, &uIntrState);
     AssertRCReturn(rc, rc);
 
@@ -9778,11 +10735,11 @@ HMVMX_EXIT_DECL hmR0VmxExitErrInvalidGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx
     Log4(("VMX_VMCS_CTRL_CR4_READ_SHADOW              %#RHr\n", uHCReg));
     rc = VMXReadVmcs64(VMX_VMCS64_CTRL_EPTP_FULL, &u64Val);                 AssertRC(rc);
     Log4(("VMX_VMCS64_CTRL_EPTP_FULL                  %#RX64\n", u64Val));
+#else
+    NOREF(pVmxTransient);
 #endif
 
-    PVM pVM = pVCpu->CTX_SUFF(pVM);
-    HMDumpRegs(pVM, pVCpu, pMixedCtx);
-
+    HMDumpRegs(pVCpu->CTX_SUFF(pVM), pVCpu, pMixedCtx);
     return VERR_VMX_INVALID_GUEST_STATE;
 }
 
@@ -9793,7 +10750,8 @@ HMVMX_EXIT_DECL hmR0VmxExitErrInvalidGuestState(PVMCPU pVCpu, PCPUMCTX pMixedCtx
  */
 HMVMX_EXIT_DECL hmR0VmxExitErrMsrLoad(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
 {
-    AssertMsgFailed(("Unexpected MSR-load exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
+    NOREF(pVmxTransient);
+    AssertMsgFailed(("Unexpected MSR-load exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx)); NOREF(pMixedCtx);
     HMVMX_RETURN_UNEXPECTED_EXIT();
 }
 
@@ -9804,7 +10762,8 @@ HMVMX_EXIT_DECL hmR0VmxExitErrMsrLoad(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRAN
  */
 HMVMX_EXIT_DECL hmR0VmxExitErrMachineCheck(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
 {
-    AssertMsgFailed(("Unexpected machine-check event exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx));
+    NOREF(pVmxTransient);
+    AssertMsgFailed(("Unexpected machine-check event exit. pVCpu=%p pMixedCtx=%p\n", pVCpu, pMixedCtx)); NOREF(pMixedCtx);
     HMVMX_RETURN_UNEXPECTED_EXIT();
 }
 
@@ -9816,6 +10775,7 @@ HMVMX_EXIT_DECL hmR0VmxExitErrMachineCheck(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVM
 HMVMX_EXIT_DECL hmR0VmxExitErrUndefined(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
 {
     AssertMsgFailed(("Huh!? Undefined VM-exit reason %d. pVCpu=%p pMixedCtx=%p\n", pVmxTransient->uExitReason, pVCpu, pMixedCtx));
+    NOREF(pVCpu); NOREF(pMixedCtx); NOREF(pVmxTransient);
     return VERR_VMX_UNDEFINED_EXIT_CODE;
 }
 
@@ -9865,15 +10825,39 @@ HMVMX_EXIT_DECL hmR0VmxExitRdmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT
     int rc  = hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx);
     rc     |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);
     rc     |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
+    if (!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS))
+    {
+        rc |= hmR0VmxSaveGuestLazyMsrs(pVCpu, pMixedCtx);
+        rc |= hmR0VmxSaveGuestAutoLoadStoreMsrs(pVCpu, pMixedCtx);
+    }
     AssertRCReturn(rc, rc);
-    Log4(("CS:RIP=%04x:%#RX64 ECX=%X\n", pMixedCtx->cs.Sel, pMixedCtx->rip, pMixedCtx->ecx));
+    Log4(("ecx=%#RX32\n", pMixedCtx->ecx));
+
+#ifdef VBOX_STRICT
+    if (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS)
+    {
+        if (   hmR0VmxIsAutoLoadStoreGuestMsr(pVCpu, pMixedCtx->ecx)
+            && pMixedCtx->ecx != MSR_K6_EFER)
+        {
+            AssertMsgFailed(("Unexpected RDMSR for an MSR in the auto-load/store area in the VMCS. ecx=%#RX32\n", pMixedCtx->ecx));
+            HMVMX_RETURN_UNEXPECTED_EXIT();
+        }
+# if HC_ARCH_BITS == 64
+        if (   pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests
+            && hmR0VmxIsLazyGuestMsr(pVCpu, pMixedCtx->ecx))
+        {
+            AssertMsgFailed(("Unexpected RDMSR for a passthru lazy-restore MSR. ecx=%#RX32\n", pMixedCtx->ecx));
+            HMVMX_RETURN_UNEXPECTED_EXIT();
+        }
+# endif
+    }
+#endif
 
     PVM pVM = pVCpu->CTX_SUFF(pVM);
     rc = EMInterpretRdmsr(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
     AssertMsg(rc == VINF_SUCCESS || rc == VERR_EM_INTERPRETER,
               ("hmR0VmxExitRdmsr: failed, invalid error code %Rrc\n", rc));
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitRdmsr);
-
     if (RT_LIKELY(rc == VINF_SUCCESS))
     {
         rc = hmR0VmxAdvanceGuestRip(pVCpu, pMixedCtx, pVmxTransient);
@@ -9896,27 +10880,13 @@ HMVMX_EXIT_DECL hmR0VmxExitWrmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT
     rc  = hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx);
     rc |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);
     rc |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
-    rc |= hmR0VmxSaveGuestAutoLoadStoreMsrs(pVCpu, pMixedCtx);
-
-    /*
-     * If MSR bitmaps are not supported, save those MSRs we are forced to intercept.
-     * When MSR bitmaps are available, we don't intercept these MSRs, see hmR0VmxSetupProcCtls().
-     */
     if (!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS))
     {
-        switch (pMixedCtx->ecx)
-        {
-            case MSR_IA32_SYSENTER_CS:
-            case MSR_IA32_SYSENTER_EIP:
-            case MSR_IA32_SYSENTER_ESP: rc |= hmR0VmxSaveGuestSysenterMsrs(pVCpu, pMixedCtx); break;
-            case MSR_K8_FS_BASE:        rc |= hmR0VmxSaveGuestFSBaseMsr(pVCpu, pMixedCtx);    break;
-            case MSR_K8_GS_BASE:        rc |= hmR0VmxSaveGuestGSBaseMsr(pVCpu, pMixedCtx);    break;
-            /* case MSR_K8_LSTAR:   case MSR_K6_STAR: case MSR_K8_SF_MASK:
-               case MSR_K8_TSC_AUX: case MSR_K8_KERNEL_GS_BASE: done in hmR0VmxSaveGuestAutoLoadStoreMsrs() */
-        }
+        rc |= hmR0VmxSaveGuestLazyMsrs(pVCpu, pMixedCtx);
+        rc |= hmR0VmxSaveGuestAutoLoadStoreMsrs(pVCpu, pMixedCtx);
     }
     AssertRCReturn(rc, rc);
-    Log4(("ecx=%#RX32\n", pMixedCtx->ecx));
+    Log4(("ecx=%#RX32 edx:eax=%#RX32:%#RX32\n", pMixedCtx->ecx, pMixedCtx->edx, pMixedCtx->eax));
 
     rc = EMInterpretWrmsr(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
     AssertMsg(rc == VINF_SUCCESS || rc == VERR_EM_INTERPRETER, ("hmR0VmxExitWrmsr: failed, invalid error code %Rrc\n", rc));
@@ -9935,16 +10905,19 @@ HMVMX_EXIT_DECL hmR0VmxExitWrmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT
                EMInterpretWrmsr() changes it. */
             HMCPU_CF_SET(pVCpu, HM_CHANGED_VMX_GUEST_APIC_STATE);
         }
-        else if (pMixedCtx->ecx == MSR_K6_EFER)         /* EFER is the only MSR we auto-load but don't allow write-passthrough. */
-        {
-            HMCPU_CF_SET(pVCpu,   HM_CHANGED_GUEST_EFER_MSR
-                                | HM_CHANGED_VMX_ENTRY_CTLS
-                                | HM_CHANGED_VMX_EXIT_CTLS);
-        }
         else if (pMixedCtx->ecx == MSR_IA32_TSC)        /* Windows 7 does this during bootup. See @bugref{6398}. */
             pVmxTransient->fUpdateTscOffsettingAndPreemptTimer = true;
+        else if (pMixedCtx->ecx == MSR_K6_EFER)
+        {
+            /*
+             * If the guest touches EFER we need to update the VM-Entry and VM-Exit controls as well,
+             * even if it is -not- touching bits that cause paging mode changes (LMA/LME). We care about
+             * the other bits as well, SCE and NXE. See @bugref{7368}.
+             */
+            HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_EFER_MSR | HM_CHANGED_VMX_ENTRY_CTLS | HM_CHANGED_VMX_EXIT_CTLS);
+        }
 
-        /* Update MSRs that are part of the VMCS when MSR-bitmaps are not supported. */
+        /* Update MSRs that are part of the VMCS and auto-load/store area when MSR-bitmaps are not supported. */
         if (!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_MSR_BITMAPS))
         {
             switch (pMixedCtx->ecx)
@@ -9954,10 +10927,17 @@ HMVMX_EXIT_DECL hmR0VmxExitWrmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT
                 case MSR_IA32_SYSENTER_ESP: HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_SYSENTER_ESP_MSR); break;
                 case MSR_K8_FS_BASE:        /* no break */
                 case MSR_K8_GS_BASE:        HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_SEGMENT_REGS);     break;
-                case MSR_K8_LSTAR:
-                case MSR_K6_STAR:
-                case MSR_K8_SF_MASK:
-                case MSR_K8_KERNEL_GS_BASE: HMCPU_CF_SET(pVCpu, HM_CHANGED_VMX_GUEST_AUTO_MSRS);    break;
+                case MSR_K6_EFER:           /* already handled above */                             break;
+                default:
+                {
+                    if (hmR0VmxIsAutoLoadStoreGuestMsr(pVCpu, pMixedCtx->ecx))
+                        HMCPU_CF_SET(pVCpu, HM_CHANGED_VMX_GUEST_AUTO_MSRS);
+#if HC_ARCH_BITS == 64
+                    else if (hmR0VmxIsLazyGuestMsr(pVCpu, pMixedCtx->ecx))
+                        HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_LAZY_MSRS);
+#endif
+                    break;
+                }
             }
         }
 #ifdef VBOX_STRICT
@@ -9976,15 +10956,28 @@ HMVMX_EXIT_DECL hmR0VmxExitWrmsr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT
                     HMVMX_RETURN_UNEXPECTED_EXIT();
                 }
 
-                case MSR_K8_LSTAR:
-                case MSR_K6_STAR:
-                case MSR_K8_SF_MASK:
-                case MSR_K8_TSC_AUX:
-                case MSR_K8_KERNEL_GS_BASE:
+                /* Writes to MSRs in auto-load/store area/swapped MSRs, shouldn't cause VM-exits with MSR-bitmaps. */
+                default:
                 {
-                    AssertMsgFailed(("Unexpected WRMSR for an MSR in the auto-load/store area in the VMCS. ecx=%#RX32\n",
-                                     pMixedCtx->ecx));
-                    HMVMX_RETURN_UNEXPECTED_EXIT();
+                    if (hmR0VmxIsAutoLoadStoreGuestMsr(pVCpu, pMixedCtx->ecx))
+                    {
+                        /* EFER writes are always intercepted, see hmR0VmxLoadGuestMsrs(). */
+                        if (pMixedCtx->ecx != MSR_K6_EFER)
+                        {
+                            AssertMsgFailed(("Unexpected WRMSR for an MSR in the auto-load/store area in the VMCS. ecx=%#RX32\n",
+                                             pMixedCtx->ecx));
+                            HMVMX_RETURN_UNEXPECTED_EXIT();
+                        }
+                    }
+
+#if HC_ARCH_BITS == 64
+                    if (hmR0VmxIsLazyGuestMsr(pVCpu, pMixedCtx->ecx))
+                    {
+                        AssertMsgFailed(("Unexpected WRMSR for passthru, lazy-restore MSR. ecx=%#RX32\n", pMixedCtx->ecx));
+                        HMVMX_RETURN_UNEXPECTED_EXIT();
+                    }
+#endif
+                    break;
                 }
             }
         }
@@ -10021,7 +11014,7 @@ HMVMX_EXIT_DECL hmR0VmxExitTprBelowThreshold(PVMCPU pVCpu, PCPUMCTX pMixedCtx, P
 
     /*
      * The TPR has already been updated, see hmR0VMXPostRunGuest(). RIP is also updated as part of the VM-exit by VT-x. Update
-     * the threshold in the VMCS, deliver the pending interrupt via hmR0VmxPreRunGuest()->hmR0VmxInjectEvent() and
+     * the threshold in the VMCS, deliver the pending interrupt via hmR0VmxPreRunGuest()->hmR0VmxInjectPendingEvent() and
      * resume guest execution.
      */
     HMCPU_CF_SET(pVCpu, HM_CHANGED_VMX_GUEST_APIC_STATE);
@@ -10038,42 +11031,38 @@ HMVMX_EXIT_DECL hmR0VmxExitTprBelowThreshold(PVMCPU pVCpu, PCPUMCTX pMixedCtx, P
  * @retval VINF_PGM_CHANGE_MODE when shadow paging mode changed, back to ring-3.
  * @retval VINF_PGM_SYNC_CR3 CR3 sync is required, back to ring-3.
  * @retval VERR_EM_INTERPRETER when something unexpected happened, fallback to
- *         recompiler.
+ *         interpreter.
  */
 HMVMX_EXIT_DECL hmR0VmxExitMovCRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient)
 {
     HMVMX_VALIDATE_EXIT_HANDLER_PARAMS();
     STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatExitMovCRx, y2);
     int rc = hmR0VmxReadExitQualificationVmcs(pVCpu, pVmxTransient);
+    rc |= hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     AssertRCReturn(rc, rc);
 
-    const RTGCUINTPTR uExitQualification = pVmxTransient->uExitQualification;
-    const uint32_t uAccessType           = VMX_EXIT_QUALIFICATION_CRX_ACCESS(uExitQualification);
+    RTGCUINTPTR const uExitQualification = pVmxTransient->uExitQualification;
+    uint32_t const uAccessType           = VMX_EXIT_QUALIFICATION_CRX_ACCESS(uExitQualification);
     PVM pVM                              = pVCpu->CTX_SUFF(pVM);
+    VBOXSTRICTRC rcStrict;
+    rc  = hmR0VmxSaveGuestRegsForIemExec(pVCpu, pMixedCtx, false /*fMemory*/, true /*fNeedRsp*/);
     switch (uAccessType)
     {
         case VMX_EXIT_QUALIFICATION_CRX_ACCESS_WRITE:       /* MOV to CRx */
         {
-#if 0
-            /* EMInterpretCRxWrite() references a lot of guest state (EFER, RFLAGS, Segment Registers, etc.) Sync entire state */
-            rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
-#else
-            rc  = hmR0VmxSaveGuestRipRspRflags(pVCpu, pMixedCtx);
             rc |= hmR0VmxSaveGuestControlRegs(pVCpu, pMixedCtx);
-            rc |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
-#endif
             AssertRCReturn(rc, rc);
 
-            rc = EMInterpretCRxWrite(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx),
-                                     VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification),
-                                     VMX_EXIT_QUALIFICATION_CRX_GENREG(uExitQualification));
-            Assert(rc == VINF_SUCCESS || rc == VERR_EM_INTERPRETER || rc == VINF_PGM_CHANGE_MODE || rc == VINF_PGM_SYNC_CR3);
-
+            rcStrict = IEMExecDecodedMovCRxWrite(pVCpu, pVmxTransient->cbInstr,
+                                                 VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification),
+                                                 VMX_EXIT_QUALIFICATION_CRX_GENREG(uExitQualification));
+            AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IEM_RAISED_XCPT || rcStrict == VINF_PGM_CHANGE_MODE
+                      || rcStrict == VINF_PGM_SYNC_CR3, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
             switch (VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification))
             {
                 case 0: /* CR0 */
                     HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR0);
-                    Log4(("CRX CR0 write rc=%d CR0=%#RX64\n", rc, pMixedCtx->cr0));
+                    Log4(("CRX CR0 write rcStrict=%Rrc CR0=%#RX64\n", VBOXSTRICTRC_VAL(rcStrict), pMixedCtx->cr0));
                     break;
                 case 2: /* CR2 */
                     /* Nothing to do here, CR2 it's not part of the VMCS. */
@@ -10081,15 +11070,16 @@ HMVMX_EXIT_DECL hmR0VmxExitMovCRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
                 case 3: /* CR3 */
                     Assert(!pVM->hm.s.fNestedPaging || !CPUMIsGuestPagingEnabledEx(pMixedCtx));
                     HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR3);
-                    Log4(("CRX CR3 write rc=%d CR3=%#RX64\n", rc, pMixedCtx->cr3));
+                    Log4(("CRX CR3 write rcStrict=%Rrc CR3=%#RX64\n", VBOXSTRICTRC_VAL(rcStrict), pMixedCtx->cr3));
                     break;
                 case 4: /* CR4 */
                     HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR4);
-                    Log4(("CRX CR4 write rc=%d CR4=%#RX64\n", rc, pMixedCtx->cr4));
+                    Log4(("CRX CR4 write rc=%Rrc CR4=%#RX64 fLoadSaveGuestXcr0=%u\n",
+                          VBOXSTRICTRC_VAL(rcStrict), pMixedCtx->cr4, pVCpu->hm.s.fLoadSaveGuestXcr0));
                     break;
                 case 8: /* CR8 */
                     Assert(!(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW));
-                    /* CR8 contains the APIC TPR. Was updated by EMInterpretCRxWrite(). */
+                    /* CR8 contains the APIC TPR. Was updated by IEMExecDecodedMovCRxWrite(). */
                     HMCPU_CF_SET(pVCpu, HM_CHANGED_VMX_GUEST_APIC_STATE);
                     break;
                 default:
@@ -10103,10 +11093,9 @@ HMVMX_EXIT_DECL hmR0VmxExitMovCRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
 
         case VMX_EXIT_QUALIFICATION_CRX_ACCESS_READ:        /* MOV from CRx */
         {
-            /* EMInterpretCRxRead() requires EFER MSR, CS. */
-            rc  = hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
             rc |= hmR0VmxSaveGuestControlRegs(pVCpu, pMixedCtx);
             AssertRCReturn(rc, rc);
+
             Assert(   !pVM->hm.s.fNestedPaging
                    || !CPUMIsGuestPagingEnabledEx(pMixedCtx)
                    || VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification) != 3);
@@ -10115,57 +11104,46 @@ HMVMX_EXIT_DECL hmR0VmxExitMovCRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
             Assert(   VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification) != 8
                    || !(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW));
 
-            rc = EMInterpretCRxRead(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx),
-                                    VMX_EXIT_QUALIFICATION_CRX_GENREG(uExitQualification),
-                                    VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification));
-            Assert(rc == VINF_SUCCESS || rc == VERR_EM_INTERPRETER);
+            rcStrict = IEMExecDecodedMovCRxRead(pVCpu, pVmxTransient->cbInstr,
+                                                VMX_EXIT_QUALIFICATION_CRX_GENREG(uExitQualification),
+                                                VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification));
+            AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IEM_RAISED_XCPT, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
             STAM_COUNTER_INC(&pVCpu->hm.s.StatExitCRxRead[VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification)]);
-            Log4(("CRX CR%d Read access rc=%d\n", VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification), rc));
+            Log4(("CRX CR%d Read access rcStrict=%Rrc\n", VMX_EXIT_QUALIFICATION_CRX_REGISTER(uExitQualification),
+                  VBOXSTRICTRC_VAL(rcStrict)));
             break;
         }
 
         case VMX_EXIT_QUALIFICATION_CRX_ACCESS_CLTS:        /* CLTS (Clear Task-Switch Flag in CR0) */
         {
-            rc = hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx);
-            AssertRCReturn(rc, rc);
-            rc = EMInterpretCLTS(pVM, pVCpu);
             AssertRCReturn(rc, rc);
+            rcStrict = IEMExecDecodedClts(pVCpu, pVmxTransient->cbInstr);
+            AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IEM_RAISED_XCPT, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
             HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR0);
             STAM_COUNTER_INC(&pVCpu->hm.s.StatExitClts);
-            Log4(("CRX CLTS write rc=%d\n", rc));
+            Log4(("CRX CLTS rcStrict=%d\n", VBOXSTRICTRC_VAL(rcStrict)));
             break;
         }
 
         case VMX_EXIT_QUALIFICATION_CRX_ACCESS_LMSW:        /* LMSW (Load Machine-Status Word into CR0) */
         {
-            rc = hmR0VmxSaveGuestCR0(pVCpu, pMixedCtx);
             AssertRCReturn(rc, rc);
-            rc = EMInterpretLMSW(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx), VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(uExitQualification));
-            if (RT_LIKELY(rc == VINF_SUCCESS))
-                HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR0);
+            rcStrict = IEMExecDecodedLmsw(pVCpu, pVmxTransient->cbInstr,
+                                          VMX_EXIT_QUALIFICATION_CRX_LMSW_DATA(uExitQualification));
+            AssertMsg(rcStrict == VINF_SUCCESS || rcStrict == VINF_IEM_RAISED_XCPT || rcStrict == VINF_PGM_CHANGE_MODE, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
             STAM_COUNTER_INC(&pVCpu->hm.s.StatExitLmsw);
-            Log4(("CRX LMSW write rc=%d\n", rc));
+            Log4(("CRX LMSW rcStrict=%d\n", VBOXSTRICTRC_VAL(rcStrict)));
             break;
         }
 
         default:
-        {
-            AssertMsgFailed(("Invalid access-type in Mov CRx exit qualification %#x\n", uAccessType));
-            rc = VERR_VMX_UNEXPECTED_EXCEPTION;
-        }
-    }
-
-    /* Validate possible error codes. */
-    Assert(rc == VINF_SUCCESS || rc == VINF_PGM_CHANGE_MODE || rc == VERR_EM_INTERPRETER || rc == VINF_PGM_SYNC_CR3
-           || rc == VERR_VMX_UNEXPECTED_EXCEPTION);
-    if (RT_SUCCESS(rc))
-    {
-        int rc2 = hmR0VmxAdvanceGuestRip(pVCpu, pMixedCtx, pVmxTransient);
-        AssertRCReturn(rc2, rc2);
+            AssertMsgFailedReturn(("Invalid access-type in Mov CRx VM-exit qualification %#x\n", uAccessType),
+                                  VERR_VMX_UNEXPECTED_EXCEPTION);
     }
 
+    HMCPU_CF_SET(pVCpu, rcStrict != VINF_IEM_RAISED_XCPT ? HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS : HM_CHANGED_ALL_GUEST);
     STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitMovCRx, y2);
-    return rc;
+    return VBOXSTRICTRC_TODO(rcStrict);
 }
 
 
@@ -10179,7 +11157,7 @@ HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIE
     STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatExitIO, y1);
 
     int rc2 = hmR0VmxReadExitQualificationVmcs(pVCpu, pVmxTransient);
-    rc2    |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
+    rc2    |= hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     rc2    |= hmR0VmxSaveGuestRip(pVCpu, pMixedCtx);
     rc2    |= hmR0VmxSaveGuestRflags(pVCpu, pMixedCtx);         /* Eflag checks in EMInterpretDisasCurrent(). */
     rc2    |= hmR0VmxSaveGuestControlRegs(pVCpu, pMixedCtx);    /* CR0 checks & PGM* in EMInterpretDisasCurrent(). */
@@ -10194,35 +11172,35 @@ HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIE
                           == VMX_EXIT_QUALIFICATION_IO_DIRECTION_OUT);
     bool     fIOString = VMX_EXIT_QUALIFICATION_IO_IS_STRING(pVmxTransient->uExitQualification);
     bool     fStepping = RT_BOOL(pMixedCtx->eflags.Bits.u1TF);
-    AssertReturn(uIOWidth <= 3 && uIOWidth != 2, VERR_HMVMX_IPE_1);
+    AssertReturn(uIOWidth <= 3 && uIOWidth != 2, VERR_VMX_IPE_1);
 
     /* I/O operation lookup arrays. */
-    static const uint32_t s_aIOSizes[4] = { 1, 2, 0, 4 };                   /* Size of the I/O accesses. */
-    static const uint32_t s_aIOOpAnd[4] = { 0xff, 0xffff, 0, 0xffffffff };  /* AND masks for saving the result (in AL/AX/EAX). */
+    static uint32_t const s_aIOSizes[4] = { 1, 2, 0, 4 };                   /* Size of the I/O accesses. */
+    static uint32_t const s_aIOOpAnd[4] = { 0xff, 0xffff, 0, 0xffffffff };  /* AND masks for saving the result (in AL/AX/EAX). */
 
     VBOXSTRICTRC   rcStrict;
-    const uint32_t cbValue  = s_aIOSizes[uIOWidth];
-    const uint32_t cbInstr  = pVmxTransient->cbInstr;
+    uint32_t const cbValue  = s_aIOSizes[uIOWidth];
+    uint32_t const cbInstr  = pVmxTransient->cbInstr;
     bool fUpdateRipAlready  = false; /* ugly hack, should be temporary. */
     PVM pVM                 = pVCpu->CTX_SUFF(pVM);
     if (fIOString)
     {
-#if 0       /* Not yet ready. IEM gurus with debian 32-bit guest without NP (on ATA reads). See @bugref{5752#c158}*/
+#if 0       /* Not yet ready. IEM gurus with debian 32-bit guest without NP (on ATA reads). See @bugref{5752#c158} */
         /*
          * INS/OUTS - I/O String instruction.
          *
          * Use instruction-information if available, otherwise fall back on
          * interpreting the instruction.
          */
-        Log4(("CS:RIP=%04x:%#RX64 %#06x/%u %c str\n", pMixedCtx->cs.Sel, pMixedCtx->rip, uIOPort, cbValue, fIOWrite ? 'w' : 'r'));
-        AssertReturn(pMixedCtx->dx == uIOPort, VERR_HMVMX_IPE_2);
+        Log4(("CS:RIP=%04x:%08RX64 %#06x/%u %c str\n", pMixedCtx->cs.Sel, pMixedCtx->rip, uIOPort, cbValue, fIOWrite ? 'w' : 'r'));
+        AssertReturn(pMixedCtx->dx == uIOPort, VERR_VMX_IPE_2);
         if (MSR_IA32_VMX_BASIC_INFO_VMCS_INS_OUTS(pVM->hm.s.vmx.Msrs.u64BasicInfo))
         {
-            rc2  = hmR0VmxReadExitInstrInfoVmcs(pVCpu, pVmxTransient);
+            rc2  = hmR0VmxReadExitInstrInfoVmcs(pVmxTransient);
             /** @todo optimize this, IEM should request the additional state if it needs it (GP, PF, ++). */
             rc2 |= hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
             AssertRCReturn(rc2, rc2);
-            AssertReturn(pVmxTransient->ExitInstrInfo.StrIo.u3AddrSize <= 2, VERR_HMVMX_IPE_3);
+            AssertReturn(pVmxTransient->ExitInstrInfo.StrIo.u3AddrSize <= 2, VERR_VMX_IPE_3);
             AssertCompile(IEMMODE_16BIT == 0 && IEMMODE_32BIT == 1 && IEMMODE_64BIT == 2);
             IEMMODE enmAddrMode = (IEMMODE)pVmxTransient->ExitInstrInfo.StrIo.u3AddrSize;
             bool    fRep        = VMX_EXIT_QUALIFICATION_IO_IS_REP(pVmxTransient->uExitQualification);
@@ -10254,7 +11232,7 @@ HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIE
         fUpdateRipAlready = true;
 #else
         PDISCPUSTATE pDis = &pVCpu->hm.s.DisState;
-        rcStrict = EMInterpretDisasCurrent(pVM, pVCpu, pDis, NULL);
+        rcStrict = EMInterpretDisasCurrent(pVM, pVCpu, pDis, NULL /* pcbInstr */);
         if (RT_SUCCESS(rcStrict))
         {
             if (fIOWrite)
@@ -10282,8 +11260,8 @@ HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIE
         /*
          * IN/OUT - I/O instruction.
          */
-        Log4(("CS:RIP=%04x:%#RX64 %#06x/%u %c\n", pMixedCtx->cs.Sel, pMixedCtx->rip, uIOPort, cbValue, fIOWrite ? 'w' : 'r'));
-        const uint32_t uAndVal = s_aIOOpAnd[uIOWidth];
+        Log4(("CS:RIP=%04x:%08RX64 %#06x/%u %c\n", pMixedCtx->cs.Sel, pMixedCtx->rip, uIOPort, cbValue, fIOWrite ? 'w' : 'r'));
+        uint32_t const uAndVal = s_aIOOpAnd[uIOWidth];
         Assert(!VMX_EXIT_QUALIFICATION_IO_IS_REP(pVmxTransient->uExitQualification));
         if (fIOWrite)
         {
@@ -10315,7 +11293,10 @@ HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIE
             HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_RIP);
         }
 
-        /* INS & OUTS with REP prefix modify RFLAGS. */
+        /*
+         * INS/OUTS with REP prefix updates RFLAGS, can be observed with triple-fault guru while booting Fedora 17 64-bit guest.
+         * See Intel Instruction reference for REP/REPE/REPZ/REPNE/REPNZ.
+         */
         if (fIOString)
         {
             /** @todo Single-step for INS/OUTS with REP prefix? */
@@ -10344,9 +11325,9 @@ HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIE
 
             /* We're playing with the host CPU state here, make sure we don't preempt or longjmp. */
             VMMRZCallRing3Disable(pVCpu);
-            HM_DISABLE_PREEMPT_IF_NEEDED();
+            HM_DISABLE_PREEMPT();
 
-            bool fIsGuestDbgActive = CPUMR0DebugStateMaybeSaveGuest(pVCpu, true /*fDr6*/);
+            bool fIsGuestDbgActive = CPUMR0DebugStateMaybeSaveGuest(pVCpu, true /* fDr6 */);
 
             VBOXSTRICTRC rcStrict2 = DBGFBpCheckIo(pVM, pVCpu, pMixedCtx, uIOPort, cbValue);
             if (rcStrict2 == VINF_EM_RAW_GUEST_TRAP)
@@ -10364,7 +11345,7 @@ HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIE
                      && (rcStrict == VINF_SUCCESS || rcStrict2 < rcStrict))
                 rcStrict = rcStrict2;
 
-            HM_RESTORE_PREEMPT_IF_NEEDED();
+            HM_RESTORE_PREEMPT();
             VMMRZCallRing3Enable(pVCpu);
         }
     }
@@ -10412,42 +11393,28 @@ HMVMX_EXIT_DECL hmR0VmxExitTaskSwitch(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRAN
         {
             uint32_t uIntType = VMX_IDT_VECTORING_INFO_TYPE(pVmxTransient->uIdtVectoringInfo);
 
-            /* Software interrupts and exceptions will be regenerated when the recompiler restarts the instruction. */
-            if (   uIntType != VMX_IDT_VECTORING_INFO_TYPE_SW_INT
-                && uIntType != VMX_IDT_VECTORING_INFO_TYPE_SW_XCPT
-                && uIntType != VMX_IDT_VECTORING_INFO_TYPE_PRIV_SW_XCPT)
-            {
-                uint32_t uVector     = VMX_IDT_VECTORING_INFO_VECTOR(pVmxTransient->uIdtVectoringInfo);
-                bool fErrorCodeValid = !!VMX_IDT_VECTORING_INFO_ERROR_CODE_IS_VALID(pVmxTransient->uIdtVectoringInfo);
-
-                /* Save it as a pending event and it'll be converted to a TRPM event on the way out to ring-3. */
-                Assert(!pVCpu->hm.s.Event.fPending);
-                pVCpu->hm.s.Event.fPending = true;
-                pVCpu->hm.s.Event.u64IntInfo = pVmxTransient->uIdtVectoringInfo;
-                rc = hmR0VmxReadIdtVectoringErrorCodeVmcs(pVmxTransient);
-                AssertRCReturn(rc, rc);
-                if (fErrorCodeValid)
-                    pVCpu->hm.s.Event.u32ErrCode = pVmxTransient->uIdtVectoringErrorCode;
-                else
-                    pVCpu->hm.s.Event.u32ErrCode = 0;
-                if (   uIntType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT
-                    && uVector == X86_XCPT_PF)
-                {
-                    pVCpu->hm.s.Event.GCPtrFaultAddress = pMixedCtx->cr2;
-                }
-
-                Log4(("Pending event on TaskSwitch uIntType=%#x uVector=%#x\n", uIntType, uVector));
-                STAM_COUNTER_INC(&pVCpu->hm.s.StatExitTaskSwitch);
+            uint32_t uVector     = VMX_IDT_VECTORING_INFO_VECTOR(pVmxTransient->uIdtVectoringInfo);
+            bool fErrorCodeValid = VMX_IDT_VECTORING_INFO_ERROR_CODE_IS_VALID(pVmxTransient->uIdtVectoringInfo);
 
-                /*
-                 * emR3ExecuteInstruction() will call IEMExecOne() which doesn't honor TRPM events. We could implement
-                 * IEMInjectTrpmEvent() but since IEM task-switching isn't backported to 4.3 it would return
-                 * VERR_IEM_ASPECT_NOT_IMPLEMENTED. What we really want is to just inject the event and not even try
-                 * emulate the instruction at RIP. At the moment for 4.3, only REM does this, so fallback directly to
-                 * REM here. See @bugref{7445} comment #25.
-                 */
-                return VINF_EM_RESCHEDULE_REM;
+            /* Save it as a pending event and it'll be converted to a TRPM event on the way out to ring-3. */
+            Assert(!pVCpu->hm.s.Event.fPending);
+            pVCpu->hm.s.Event.fPending = true;
+            pVCpu->hm.s.Event.u64IntInfo = pVmxTransient->uIdtVectoringInfo;
+            rc = hmR0VmxReadIdtVectoringErrorCodeVmcs(pVmxTransient);
+            AssertRCReturn(rc, rc);
+            if (fErrorCodeValid)
+                pVCpu->hm.s.Event.u32ErrCode = pVmxTransient->uIdtVectoringErrorCode;
+            else
+                pVCpu->hm.s.Event.u32ErrCode = 0;
+            if (   uIntType == VMX_IDT_VECTORING_INFO_TYPE_HW_XCPT
+                && uVector == X86_XCPT_PF)
+            {
+                pVCpu->hm.s.Event.GCPtrFaultAddress = pMixedCtx->cr2;
             }
+
+            Log4(("Pending event on TaskSwitch uIntType=%#x uVector=%#x\n", uIntType, uVector));
+            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitTaskSwitch);
+            return VINF_EM_RAW_INJECT_TRPM_EVENT;
         }
     }
 
@@ -10482,10 +11449,12 @@ HMVMX_EXIT_DECL hmR0VmxExitApicAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRAN
 
     /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
     int rc = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient);
-    if (RT_UNLIKELY(rc == VINF_HM_DOUBLE_FAULT))
-        return VINF_SUCCESS;
-    else if (RT_UNLIKELY(rc == VINF_EM_RESET))
+    if (RT_UNLIKELY(rc != VINF_SUCCESS))
+    {
+        if (rc == VINF_HM_DOUBLE_FAULT)
+            rc = VINF_SUCCESS;
         return rc;
+    }
 
 #if 0
     /** @todo Investigate if IOMMMIOPhysHandler() requires a lot of state, for now
@@ -10507,11 +11476,9 @@ HMVMX_EXIT_DECL hmR0VmxExitApicAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRAN
         case VMX_APIC_ACCESS_TYPE_LINEAR_WRITE:
         case VMX_APIC_ACCESS_TYPE_LINEAR_READ:
         {
-            if (  (pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW)
-                && VMX_EXIT_QUALIFICATION_APIC_ACCESS_OFFSET(pVmxTransient->uExitQualification) == 0x80)
-            {
-                AssertMsgFailed(("hmR0VmxExitApicAccess: can't access TPR offset while using TPR shadowing.\n"));
-            }
+            AssertMsg(   !(pVCpu->hm.s.vmx.u32ProcCtls & VMX_VMCS_CTRL_PROC_EXEC_USE_TPR_SHADOW)
+                      || VMX_EXIT_QUALIFICATION_APIC_ACCESS_OFFSET(pVmxTransient->uExitQualification) != 0x80,
+                      ("hmR0VmxExitApicAccess: can't access TPR offset while using TPR shadowing.\n"));
 
             RTGCPHYS GCPhys = pMixedCtx->msrApicBase;   /* Always up-to-date, msrApicBase is not part of the VMCS. */
             GCPhys &= PAGE_BASE_GC_MASK;
@@ -10521,7 +11488,7 @@ HMVMX_EXIT_DECL hmR0VmxExitApicAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRAN
                  VMX_EXIT_QUALIFICATION_APIC_ACCESS_OFFSET(pVmxTransient->uExitQualification)));
 
             VBOXSTRICTRC rc2 = IOMMMIOPhysHandler(pVM, pVCpu,
-                                                  (uAccessType == VMX_APIC_ACCESS_TYPE_LINEAR_READ) ? 0 : X86_TRAP_PF_RW,
+                                                  uAccessType == VMX_APIC_ACCESS_TYPE_LINEAR_READ ? 0 : X86_TRAP_PF_RW,
                                                   CPUMCTX2CORE(pMixedCtx), GCPhys);
             rc = VBOXSTRICTRC_VAL(rc2);
             Log4(("ApicAccess rc=%d\n", rc));
@@ -10529,10 +11496,10 @@ HMVMX_EXIT_DECL hmR0VmxExitApicAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRAN
                 || rc == VERR_PAGE_TABLE_NOT_PRESENT
                 || rc == VERR_PAGE_NOT_PRESENT)
             {
-                HMCPU_CF_SET(pVCpu,     HM_CHANGED_GUEST_RIP
-                                      | HM_CHANGED_GUEST_RSP
-                                      | HM_CHANGED_GUEST_RFLAGS
-                                      | HM_CHANGED_VMX_GUEST_APIC_STATE);
+                HMCPU_CF_SET(pVCpu,   HM_CHANGED_GUEST_RIP
+                                    | HM_CHANGED_GUEST_RSP
+                                    | HM_CHANGED_GUEST_RFLAGS
+                                    | HM_CHANGED_VMX_GUEST_APIC_STATE);
                 rc = VINF_SUCCESS;
             }
             break;
@@ -10545,6 +11512,8 @@ HMVMX_EXIT_DECL hmR0VmxExitApicAccess(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRAN
     }
 
     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitApicAccess);
+    if (rc != VINF_SUCCESS)
+        STAM_COUNTER_INC(&pVCpu->hm.s.StatSwitchApicAccessToR3);
     return rc;
 }
 
@@ -10578,21 +11547,19 @@ HMVMX_EXIT_DECL hmR0VmxExitMovDRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
         {
 #ifndef HMVMX_ALWAYS_TRAP_ALL_XCPTS
             pVCpu->hm.s.vmx.u32XcptBitmap &= ~RT_BIT(X86_XCPT_DB);
-            rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_EXCEPTION_BITMAP, pVCpu->hm.s.vmx.u32XcptBitmap);
-            AssertRCReturn(rc, rc);
+            HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_XCPT_INTERCEPTS);
 #endif
         }
 
         /* We're playing with the host CPU state here, make sure we can't preempt or longjmp. */
         VMMRZCallRing3Disable(pVCpu);
-        HM_DISABLE_PREEMPT_IF_NEEDED();
+        HM_DISABLE_PREEMPT();
 
         /* Save the host & load the guest debug state, restart execution of the MOV DRx instruction. */
-        PVM pVM = pVCpu->CTX_SUFF(pVM);
         CPUMR0LoadGuestDebugState(pVCpu, true /* include DR6 */);
         Assert(CPUMIsGuestDebugStateActive(pVCpu) || HC_ARCH_BITS == 32);
 
-        HM_RESTORE_PREEMPT_IF_NEEDED();
+        HM_RESTORE_PREEMPT();
         VMMRZCallRing3Enable(pVCpu);
 
 #ifdef VBOX_WITH_STATISTICS
@@ -10608,14 +11575,14 @@ HMVMX_EXIT_DECL hmR0VmxExitMovDRx(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
     }
 
     /*
-     * EMInterpretDRx[Write|Read]() calls CPUMIsGuestIn64BitCode() which requires EFER, CS. EFER is always up-to-date, see
-     * hmR0VmxSaveGuestAutoLoadStoreMsrs(). Update only the segment registers from the CPU.
+     * EMInterpretDRx[Write|Read]() calls CPUMIsGuestIn64BitCode() which requires EFER, CS. EFER is always up-to-date.
+     * Update the segment registers and DR7 from the CPU.
      */
     rc  = hmR0VmxReadExitQualificationVmcs(pVCpu, pVmxTransient);
     rc |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
     rc |= hmR0VmxSaveGuestDR7(pVCpu, pMixedCtx);
     AssertRCReturn(rc, rc);
-    Log4(("CS:RIP=%04x:%#RX64\n", pMixedCtx->cs.Sel, pMixedCtx->rip));
+    Log4(("CS:RIP=%04x:%08RX64\n", pMixedCtx->cs.Sel, pMixedCtx->rip));
 
     PVM pVM = pVCpu->CTX_SUFF(pVM);
     if (VMX_EXIT_QUALIFICATION_DRX_DIRECTION(pVmxTransient->uExitQualification) == VMX_EXIT_QUALIFICATION_DRX_DIRECTION_WRITE)
@@ -10656,10 +11623,12 @@ HMVMX_EXIT_DECL hmR0VmxExitEptMisconfig(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTR
 
     /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
     int rc = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient);
-    if (RT_UNLIKELY(rc == VINF_HM_DOUBLE_FAULT))
-        return VINF_SUCCESS;
-    else if (RT_UNLIKELY(rc == VINF_EM_RESET))
+    if (RT_UNLIKELY(rc != VINF_SUCCESS))
+    {
+        if (rc == VINF_HM_DOUBLE_FAULT)
+            rc = VINF_SUCCESS;
         return rc;
+    }
 
     RTGCPHYS GCPhys = 0;
     rc = VMXReadVmcs64(VMX_VMCS64_EXIT_GUEST_PHYS_ADDR_FULL, &GCPhys);
@@ -10690,7 +11659,7 @@ HMVMX_EXIT_DECL hmR0VmxExitEptMisconfig(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTR
         || rc == VERR_PAGE_NOT_PRESENT)
     {
         /* Successfully handled MMIO operation. */
-        HMCPU_CF_SET(pVCpu,    HM_CHANGED_GUEST_RIP
+        HMCPU_CF_SET(pVCpu,  HM_CHANGED_GUEST_RIP
                              | HM_CHANGED_GUEST_RSP
                              | HM_CHANGED_GUEST_RFLAGS
                              | HM_CHANGED_VMX_GUEST_APIC_STATE);
@@ -10711,10 +11680,12 @@ HMVMX_EXIT_DECL hmR0VmxExitEptViolation(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTR
 
     /* If this VM-exit occurred while delivering an event through the guest IDT, handle it accordingly. */
     int rc = hmR0VmxCheckExitDueToEventDelivery(pVCpu, pMixedCtx, pVmxTransient);
-    if (RT_UNLIKELY(rc == VINF_HM_DOUBLE_FAULT))
-        return VINF_SUCCESS;
-    else if (RT_UNLIKELY(rc == VINF_EM_RESET))
+    if (RT_UNLIKELY(rc != VINF_SUCCESS))
+    {
+        if (rc == VINF_HM_DOUBLE_FAULT)
+            rc = VINF_SUCCESS;
         return rc;
+    }
 
     RTGCPHYS GCPhys = 0;
     rc  = VMXReadVmcs64(VMX_VMCS64_EXIT_GUEST_PHYS_ADDR_FULL, &GCPhys);
@@ -10742,8 +11713,8 @@ HMVMX_EXIT_DECL hmR0VmxExitEptViolation(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTR
 
     TRPMAssertXcptPF(pVCpu, GCPhys, uErrorCode);
 
-    Log4(("EPT violation %#x at %#RX64 ErrorCode %#x CS:EIP=%04x:%#RX64\n", pVmxTransient->uExitQualification, GCPhys,
-         uErrorCode, pMixedCtx->cs.Sel, pMixedCtx->rip));
+    Log4(("EPT violation %#x at %#RX64 ErrorCode %#x CS:RIP=%04x:%08RX64\n", pVmxTransient->uExitQualification, GCPhys,
+          uErrorCode, pMixedCtx->cs.Sel, pMixedCtx->rip));
 
     /* Handle the pagefault trap for the nested shadow table. */
     PVM pVM = pVCpu->CTX_SUFF(pVM);
@@ -10763,7 +11734,7 @@ HMVMX_EXIT_DECL hmR0VmxExitEptViolation(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTR
         return VINF_SUCCESS;
     }
 
-    Log4(("EPT return to ring-3 rc=%d\n"));
+    Log4(("EPT return to ring-3 rc=%Rrc\n", rc));
     return rc;
 }
 
@@ -10790,8 +11761,12 @@ static int hmR0VmxExitXcptMF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
 
     if (!(pMixedCtx->cr0 & X86_CR0_NE))
     {
-        /* Convert a #MF into a FERR -> IRQ 13. */
-        rc = PDMIsaSetIrq(pVCpu->CTX_SUFF(pVM), 13, 1, 0 /*uTagSrc*/);
+        /* Convert a #MF into a FERR -> IRQ 13. See @bugref{6117}. */
+        rc = PDMIsaSetIrq(pVCpu->CTX_SUFF(pVM), 13, 1, 0 /* uTagSrc */);
+
+        /** @todo r=ramshankar: The Intel spec. does -not- specify that this VM-exit
+         *        provides VM-exit instruction length. If this causes problem later,
+         *        disassemble the instruction like it's done on AMD-V. */
         int rc2 = hmR0VmxAdvanceGuestRip(pVCpu, pMixedCtx, pVmxTransient);
         AssertRCReturn(rc2, rc2);
         return rc;
@@ -10820,9 +11795,9 @@ static int hmR0VmxExitXcptBP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
     rc = DBGFRZTrap03Handler(pVM, pVCpu, CPUMCTX2CORE(pMixedCtx));
     if (rc == VINF_EM_RAW_GUEST_TRAP)
     {
-        rc  = hmR0VmxReadExitIntInfoVmcs(pVCpu, pVmxTransient);
-        rc |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
-        rc |= hmR0VmxReadExitIntErrorCodeVmcs(pVCpu, pVmxTransient);
+        rc  = hmR0VmxReadExitIntInfoVmcs(pVmxTransient);
+        rc |= hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
+        rc |= hmR0VmxReadExitIntErrorCodeVmcs(pVmxTransient);
         AssertRCReturn(rc, rc);
 
         hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntInfo),
@@ -10844,7 +11819,7 @@ static int hmR0VmxExitXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
     Log6(("XcptDB\n"));
 
     /*
-     * Get the DR6-like values from the exit qualification and pass it to DBGF
+     * Get the DR6-like values from the VM-exit qualification and pass it to DBGF
      * for processing.
      */
     int rc = hmR0VmxReadExitQualificationVmcs(pVCpu, pVmxTransient);
@@ -10864,14 +11839,14 @@ static int hmR0VmxExitXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
          * (See Intel spec. 27.1 "Architectural State before a VM-Exit".)
          */
         VMMRZCallRing3Disable(pVCpu);
-        HM_DISABLE_PREEMPT_IF_NEEDED();
+        HM_DISABLE_PREEMPT();
 
         pMixedCtx->dr[6] &= ~X86_DR6_B_MASK;
         pMixedCtx->dr[6] |= uDR6;
         if (CPUMIsGuestDebugStateActive(pVCpu))
             ASMSetDR6(pMixedCtx->dr[6]);
 
-        HM_RESTORE_PREEMPT_IF_NEEDED();
+        HM_RESTORE_PREEMPT();
         VMMRZCallRing3Enable(pVCpu);
 
         rc = hmR0VmxSaveGuestDR7(pVCpu, pMixedCtx);
@@ -10896,9 +11871,9 @@ static int hmR0VmxExitXcptDB(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
          *
          * Since ICEBP isn't documented on Intel, see AMD spec. 15.20 "Event Injection".
          */
-        rc  = hmR0VmxReadExitIntInfoVmcs(pVCpu, pVmxTransient);
-        rc |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
-        rc |= hmR0VmxReadExitIntErrorCodeVmcs(pVCpu, pVmxTransient);
+        rc  = hmR0VmxReadExitIntInfoVmcs(pVmxTransient);
+        rc |= hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
+        rc |= hmR0VmxReadExitIntErrorCodeVmcs(pVmxTransient);
         AssertRCReturn(rc, rc);
         hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntInfo),
                                pVmxTransient->cbInstr, pVmxTransient->uExitIntErrorCode, 0 /* GCPtrFaultAddress */);
@@ -10931,7 +11906,7 @@ static int hmR0VmxExitXcptNM(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
 
     /* We're playing with the host CPU state here, have to disable preemption or longjmp. */
     VMMRZCallRing3Disable(pVCpu);
-    HM_DISABLE_PREEMPT_IF_NEEDED();
+    HM_DISABLE_PREEMPT();
 
     /* If the guest FPU was active at the time of the #NM exit, then it's a guest fault. */
     if (pVmxTransient->fWasGuestFPUStateActive)
@@ -10948,7 +11923,7 @@ static int hmR0VmxExitXcptNM(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
         Assert(rc == VINF_EM_RAW_GUEST_TRAP || (rc == VINF_SUCCESS && CPUMIsGuestFPUStateActive(pVCpu)));
     }
 
-    HM_RESTORE_PREEMPT_IF_NEEDED();
+    HM_RESTORE_PREEMPT();
     VMMRZCallRing3Enable(pVCpu);
 
     if (rc == VINF_SUCCESS)
@@ -10956,12 +11931,13 @@ static int hmR0VmxExitXcptNM(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
         /* Guest FPU state was activated, we'll want to change CR0 FPU intercepts before the next VM-reentry. */
         HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR0);
         STAM_COUNTER_INC(&pVCpu->hm.s.StatExitShadowNM);
+        pVCpu->hm.s.fPreloadGuestFpu = true;
     }
     else
     {
         /* Forward #NM to the guest. */
         Assert(rc == VINF_EM_RAW_GUEST_TRAP);
-        rc = hmR0VmxReadExitIntInfoVmcs(pVCpu, pVmxTransient);
+        rc = hmR0VmxReadExitIntInfoVmcs(pVmxTransient);
         AssertRCReturn(rc, rc);
         hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntInfo),
                                pVmxTransient->cbInstr, 0 /* error code */, 0 /* GCPtrFaultAddress */);
@@ -10987,19 +11963,20 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
     {
 #ifdef HMVMX_ALWAYS_TRAP_ALL_XCPTS
         /* If the guest is not in real-mode or we have unrestricted execution support, reflect #GP to the guest. */
-        rc  = hmR0VmxReadExitIntInfoVmcs(pVCpu, pVmxTransient);
-        rc |= hmR0VmxReadExitIntErrorCodeVmcs(pVCpu, pVmxTransient);
-        rc |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
+        rc  = hmR0VmxReadExitIntInfoVmcs(pVmxTransient);
+        rc |= hmR0VmxReadExitIntErrorCodeVmcs(pVmxTransient);
+        rc |= hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
         rc |= hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
         AssertRCReturn(rc, rc);
-        Log4(("#GP Gst: RIP %#RX64 ErrorCode=%#x CR0=%#RX64 CPL=%u\n", pMixedCtx->rip, pVmxTransient->uExitIntErrorCode,
-             pMixedCtx->cr0, CPUMGetGuestCPL(pVCpu)));
+        Log4(("#GP Gst: CS:RIP %04x:%08RX64 ErrorCode=%#x CR0=%#RX64 CPL=%u TR=%#04x\n", pMixedCtx->cs.Sel, pMixedCtx->rip,
+              pVmxTransient->uExitIntErrorCode, pMixedCtx->cr0, CPUMGetGuestCPL(pVCpu), pMixedCtx->tr.Sel));
         hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntInfo),
                                pVmxTransient->cbInstr, pVmxTransient->uExitIntErrorCode, 0 /* GCPtrFaultAddress */);
         return rc;
 #else
         /* We don't intercept #GP. */
         AssertMsgFailed(("Unexpected VM-exit caused by #GP exception\n"));
+        NOREF(pVmxTransient);
         return VERR_VMX_UNEXPECTED_EXCEPTION;
 #endif
     }
@@ -11019,12 +11996,13 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
     {
         rc = VINF_SUCCESS;
         Assert(cbOp == pDis->cbInstr);
-        Log4(("#GP Disas OpCode=%u CS:EIP %04x:%#RX64\n", pDis->pCurInstr->uOpcode, pMixedCtx->cs.Sel, pMixedCtx->rip));
+        Log4(("#GP Disas OpCode=%u CS:EIP %04x:%04RX64\n", pDis->pCurInstr->uOpcode, pMixedCtx->cs.Sel, pMixedCtx->rip));
         switch (pDis->pCurInstr->uOpcode)
         {
             case OP_CLI:
             {
                 pMixedCtx->eflags.Bits.u1IF = 0;
+                pMixedCtx->eflags.Bits.u1RF = 0;
                 pMixedCtx->rip += pDis->cbInstr;
                 HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS);
                 hmR0VmxSetPendingDebugXcpt(pVCpu, pMixedCtx);
@@ -11034,10 +12012,15 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
 
             case OP_STI:
             {
+                bool fOldIF = pMixedCtx->eflags.Bits.u1IF;
                 pMixedCtx->eflags.Bits.u1IF = 1;
+                pMixedCtx->eflags.Bits.u1RF = 0;
                 pMixedCtx->rip += pDis->cbInstr;
-                EMSetInhibitInterruptsPC(pVCpu, pMixedCtx->rip);
-                Assert(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS));
+                if (!fOldIF)
+                {
+                    EMSetInhibitInterruptsPC(pVCpu, pMixedCtx->rip);
+                    Assert(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS));
+                }
                 HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS);
                 hmR0VmxSetPendingDebugXcpt(pVCpu, pMixedCtx);
                 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitSti);
@@ -11048,14 +12031,15 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
             {
                 rc = VINF_EM_HALT;
                 pMixedCtx->rip += pDis->cbInstr;
-                HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_RIP);
+                pMixedCtx->eflags.Bits.u1RF = 0;
+                HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RFLAGS);
                 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitHlt);
                 break;
             }
 
             case OP_POPF:
             {
-                Log4(("POPF CS:RIP %04x:%#RX64\n", pMixedCtx->cs.Sel, pMixedCtx->rip));
+                Log4(("POPF CS:EIP %04x:%04RX64\n", pMixedCtx->cs.Sel, pMixedCtx->rip));
                 uint32_t cbParm;
                 uint32_t uMask;
                 bool     fStepping = RT_BOOL(pMixedCtx->eflags.Bits.u1TF);
@@ -11079,7 +12063,7 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
                 {
                     Assert(sizeof(Eflags.u32) >= cbParm);
                     Eflags.u32 = 0;
-                    rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u32, cbParm);
+                    rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u32, cbParm, PGMACCESSORIGIN_HM);
                 }
                 if (RT_FAILURE(rc))
                 {
@@ -11087,13 +12071,12 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
                     break;
                 }
                 Log4(("POPF %#x -> %#RX64 mask=%#x RIP=%#RX64\n", Eflags.u, pMixedCtx->rsp, uMask, pMixedCtx->rip));
-                pMixedCtx->eflags.u32 =   (pMixedCtx->eflags.u32 & ~(X86_EFL_POPF_BITS & uMask))
-                                        | (Eflags.u32 & X86_EFL_POPF_BITS & uMask);
-                pMixedCtx->eflags.Bits.u1RF  = 0;    /* The RF bit is always cleared by POPF; see Intel Instruction reference. */
+                pMixedCtx->eflags.u32 = (pMixedCtx->eflags.u32 & ~((X86_EFL_POPF_BITS & uMask) | X86_EFL_RF))
+                                      | (Eflags.u32 & X86_EFL_POPF_BITS & uMask);
                 pMixedCtx->esp              += cbParm;
                 pMixedCtx->esp              &= uMask;
                 pMixedCtx->rip              += pDis->cbInstr;
-                HMCPU_CF_SET(pVCpu,  HM_CHANGED_GUEST_RIP
+                HMCPU_CF_SET(pVCpu,   HM_CHANGED_GUEST_RIP
                                     | HM_CHANGED_GUEST_RSP
                                     | HM_CHANGED_GUEST_RFLAGS);
                 /* Generate a pending-debug exception when stepping over POPF regardless of how POPF modifies EFLAGS.TF. */
@@ -11133,7 +12116,7 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
                 Eflags.Bits.u1RF = 0;
                 Eflags.Bits.u1VM = 0;
 
-                rc = PGMPhysWrite(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u, cbParm);
+                rc = PGMPhysWrite(pVM, (RTGCPHYS)GCPtrStack, &Eflags.u, cbParm, PGMACCESSORIGIN_HM);
                 if (RT_FAILURE(rc))
                 {
                     rc = VERR_EM_INTERPRETER;
@@ -11143,7 +12126,10 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
                 pMixedCtx->esp               -= cbParm;
                 pMixedCtx->esp               &= uMask;
                 pMixedCtx->rip               += pDis->cbInstr;
-                HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_RIP | HM_CHANGED_GUEST_RSP);
+                pMixedCtx->eflags.Bits.u1RF   = 0;
+                HMCPU_CF_SET(pVCpu,   HM_CHANGED_GUEST_RIP
+                                    | HM_CHANGED_GUEST_RSP
+                                    | HM_CHANGED_GUEST_RFLAGS);
                 hmR0VmxSetPendingDebugXcpt(pVCpu, pMixedCtx);
                 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitPushf);
                 break;
@@ -11165,7 +12151,7 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
                 rc = SELMToFlatEx(pVCpu, DISSELREG_SS, CPUMCTX2CORE(pMixedCtx), pMixedCtx->esp & uMask, SELMTOFLAT_FLAGS_CPL0,
                                   &GCPtrStack);
                 if (RT_SUCCESS(rc))
-                    rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &aIretFrame[0], sizeof(aIretFrame));
+                    rc = PGMPhysRead(pVM, (RTGCPHYS)GCPtrStack, &aIretFrame[0], sizeof(aIretFrame), PGMACCESSORIGIN_HM);
                 if (RT_FAILURE(rc))
                 {
                     rc = VERR_EM_INTERPRETER;
@@ -11176,8 +12162,8 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
                 pMixedCtx->cs.Sel             = aIretFrame[1];
                 pMixedCtx->cs.ValidSel        = aIretFrame[1];
                 pMixedCtx->cs.u64Base         = (uint64_t)pMixedCtx->cs.Sel << 4;
-                pMixedCtx->eflags.u32         = (pMixedCtx->eflags.u32 & ~(X86_EFL_POPF_BITS & uMask))
-                                                | (aIretFrame[2] & X86_EFL_POPF_BITS & uMask);
+                pMixedCtx->eflags.u32         = (pMixedCtx->eflags.u32 & ((UINT32_C(0xffff0000) | X86_EFL_1) & ~X86_EFL_RF))
+                                              | (aIretFrame[2] & X86_EFL_POPF_BITS & uMask);
                 pMixedCtx->sp                += sizeof(aIretFrame);
                 HMCPU_CF_SET(pVCpu,   HM_CHANGED_GUEST_RIP
                                     | HM_CHANGED_GUEST_SEGMENT_REGS
@@ -11186,7 +12172,7 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
                 /* Generate a pending-debug exception when stepping over IRET regardless of how IRET modifies EFLAGS.TF. */
                 if (fStepping)
                     hmR0VmxSetPendingDebugXcpt(pVCpu, pMixedCtx);
-                Log4(("IRET %#RX32 to %04x:%x\n", GCPtrStack, pMixedCtx->cs.Sel, pMixedCtx->ip));
+                Log4(("IRET %#RX32 to %04x:%04x\n", GCPtrStack, pMixedCtx->cs.Sel, pMixedCtx->ip));
                 STAM_COUNTER_INC(&pVCpu->hm.s.StatExitIret);
                 break;
             }
@@ -11208,11 +12194,17 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
                     /* INTO clears EFLAGS.TF, we mustn't set any pending debug exceptions here. */
                     STAM_COUNTER_INC(&pVCpu->hm.s.StatExitInt);
                 }
+                else
+                {
+                    pMixedCtx->eflags.Bits.u1RF = 0;
+                    HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_RFLAGS);
+                }
                 break;
             }
 
             default:
             {
+                pMixedCtx->eflags.Bits.u1RF = 0; /* This is correct most of the time... */
                 VBOXSTRICTRC rc2 = EMInterpretInstructionDisasState(pVCpu, pDis, CPUMCTX2CORE(pMixedCtx), 0 /* pvFault */,
                                                                     EMCODETYPE_SUPERVISOR);
                 rc = VBOXSTRICTRC_VAL(rc2);
@@ -11233,6 +12225,7 @@ static int hmR0VmxExitXcptGP(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
 }
 
 
+#ifdef HMVMX_ALWAYS_TRAP_ALL_XCPTS
 /**
  * VM-exit exception handler wrapper for generic exceptions. Simply re-injects
  * the exception reported in the VMX transient structure back into the VM.
@@ -11246,15 +12239,22 @@ static int hmR0VmxExitXcptGeneric(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIEN
 
     /* Re-inject the exception into the guest. This cannot be a double-fault condition which would have been handled in
        hmR0VmxCheckExitDueToEventDelivery(). */
-    int rc = hmR0VmxReadExitIntErrorCodeVmcs(pVCpu, pVmxTransient);
-    rc    |= hmR0VmxReadExitInstrLenVmcs(pVCpu, pVmxTransient);
+    int rc = hmR0VmxReadExitIntErrorCodeVmcs(pVmxTransient);
+    rc    |= hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     AssertRCReturn(rc, rc);
     Assert(pVmxTransient->fVmcsFieldsRead & HMVMX_UPDATED_TRANSIENT_EXIT_INTERRUPTION_INFO);
 
+#ifdef DEBUG_ramshankar
+    rc |= hmR0VmxSaveGuestSegmentRegs(pVCpu, pMixedCtx);
+    uint8_t uVector = VMX_EXIT_INTERRUPTION_INFO_VECTOR(pVmxTransient->uExitIntInfo);
+    Log(("hmR0VmxExitXcptGeneric: Reinjecting Xcpt. uVector=%#x cs:rip=%#04x:%#RX64\n", uVector, pCtx->cs.Sel, pCtx->rip));
+#endif
+
     hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntInfo),
                            pVmxTransient->cbInstr, pVmxTransient->uExitIntErrorCode, 0 /* GCPtrFaultAddress */);
     return VINF_SUCCESS;
 }
+#endif
 
 
 /**
@@ -11265,15 +12265,15 @@ static int hmR0VmxExitXcptPF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
     HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS();
     PVM pVM = pVCpu->CTX_SUFF(pVM);
     int rc = hmR0VmxReadExitQualificationVmcs(pVCpu, pVmxTransient);
-    rc    |= hmR0VmxReadExitIntInfoVmcs(pVCpu, pVmxTransient);
-    rc    |= hmR0VmxReadExitIntErrorCodeVmcs(pVCpu, pVmxTransient);
+    rc    |= hmR0VmxReadExitIntInfoVmcs(pVmxTransient);
+    rc    |= hmR0VmxReadExitIntErrorCodeVmcs(pVmxTransient);
     AssertRCReturn(rc, rc);
 
 #if defined(HMVMX_ALWAYS_TRAP_ALL_XCPTS) || defined(HMVMX_ALWAYS_TRAP_PF)
     if (pVM->hm.s.fNestedPaging)
     {
         pVCpu->hm.s.Event.fPending = false;                  /* In case it's a contributory or vectoring #PF. */
-        if (RT_LIKELY(!pVmxTransient->fVectoringPF))
+        if (RT_LIKELY(!pVmxTransient->fVectoringDoublePF))
         {
             pMixedCtx->cr2 = pVmxTransient->uExitQualification;  /* Update here in case we go back to ring-3 before injection. */
             hmR0VmxSetPendingEvent(pVCpu, VMX_VMCS_CTRL_ENTRY_IRQ_INFO_FROM_EXIT_INT_INFO(pVmxTransient->uExitIntInfo),
@@ -11290,8 +12290,17 @@ static int hmR0VmxExitXcptPF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
     }
 #else
     Assert(!pVM->hm.s.fNestedPaging);
+    NOREF(pVM);
 #endif
 
+    /* If it's a vectoring #PF, emulate injecting the original event injection as PGMTrap0eHandler() is incapable
+       of differentiating between instruction emulation and event injection that caused a #PF. See @bugref{6607}. */
+    if (pVmxTransient->fVectoringPF)
+    {
+        Assert(pVCpu->hm.s.Event.fPending);
+        return VINF_EM_RAW_INJECT_TRPM_EVENT;
+    }
+
     rc = hmR0VmxSaveGuestState(pVCpu, pMixedCtx);
     AssertRCReturn(rc, rc);
 
@@ -11316,9 +12325,10 @@ static int hmR0VmxExitXcptPF(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVm
         STAM_COUNTER_INC(&pVCpu->hm.s.StatExitShadowPF);
         return rc;
     }
-    else if (rc == VINF_EM_RAW_GUEST_TRAP)
+
+    if (rc == VINF_EM_RAW_GUEST_TRAP)
     {
-        if (!pVmxTransient->fVectoringPF)
+        if (!pVmxTransient->fVectoringDoublePF)
         {
             /* It's a guest page fault and needs to be reflected to the guest. */
             uint32_t uGstErrorCode = TRPMGetErrorCode(pVCpu);
diff --git a/src/VBox/VMM/VMMR0/PDMR0Device.cpp b/src/VBox/VMM/VMMR0/PDMR0Device.cpp
index 94abdda..1e8669a 100644
--- a/src/VBox/VMM/VMMR0/PDMR0Device.cpp
+++ b/src/VBox/VMM/VMMR0/PDMR0Device.cpp
@@ -204,7 +204,7 @@ static DECLCALLBACK(int) pdmR0DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhy
     LogFlow(("pdmR0DevHlp_PhysRead: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n",
              pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbRead));
 
-    int rc = PGMPhysRead(pDevIns->Internal.s.pVMR0, GCPhys, pvBuf, cbRead);
+    int rc = PGMPhysRead(pDevIns->Internal.s.pVMR0, GCPhys, pvBuf, cbRead, PGMACCESSORIGIN_DEVICE);
     AssertRC(rc); /** @todo track down the users for this bugger. */
 
     Log(("pdmR0DevHlp_PhysRead: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, rc));
@@ -219,7 +219,7 @@ static DECLCALLBACK(int) pdmR0DevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPh
     LogFlow(("pdmR0DevHlp_PhysWrite: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n",
              pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbWrite));
 
-    int rc = PGMPhysWrite(pDevIns->Internal.s.pVMR0, GCPhys, pvBuf, cbWrite);
+    int rc = PGMPhysWrite(pDevIns->Internal.s.pVMR0, GCPhys, pvBuf, cbWrite, PGMACCESSORIGIN_DEVICE);
     AssertRC(rc); /** @todo track down the users for this bugger. */
 
     Log(("pdmR0DevHlp_PhysWrite: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, rc));
@@ -326,6 +326,16 @@ static DECLCALLBACK(PVMCPU) pdmR0DevHlp_GetVMCPU(PPDMDEVINS pDevIns)
 }
 
 
+/** @interface_method_impl{PDMDEVHLPRC,pfnGetCurrentCpuId} */
+static DECLCALLBACK(VMCPUID) pdmR0DevHlp_GetCurrentCpuId(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    VMCPUID idCpu = VMMGetCpuId(pDevIns->Internal.s.pVMR0);
+    LogFlow(("pdmR0DevHlp_GetCurrentCpuId: caller='%p'/%d for CPU %u\n", pDevIns, pDevIns->iInstance, idCpu));
+    return idCpu;
+}
+
+
 /** @interface_method_impl{PDMDEVHLPR0,pfnTMTimeVirtGet} */
 static DECLCALLBACK(uint64_t) pdmR0DevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns)
 {
@@ -394,6 +404,7 @@ extern DECLEXPORT(const PDMDEVHLPR0) g_pdmR0DevHlp =
     pdmR0DevHlp_GetVM,
     pdmR0DevHlp_CanEmulateIoBlock,
     pdmR0DevHlp_GetVMCPU,
+    pdmR0DevHlp_GetCurrentCpuId,
     pdmR0DevHlp_TMTimeVirtGet,
     pdmR0DevHlp_TMTimeVirtGetFreq,
     pdmR0DevHlp_TMTimeVirtGetNano,
diff --git a/src/VBox/VMM/VMMR0/PGMR0.cpp b/src/VBox/VMM/VMMR0/PGMR0.cpp
index 69ef6c7..3e45adc 100644
--- a/src/VBox/VMM/VMMR0/PGMR0.cpp
+++ b/src/VBox/VMM/VMMR0/PGMR0.cpp
@@ -556,8 +556,9 @@ VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PVM pVM, PVMCPU pVCpu, PGM
      * Try lookup the all access physical handler for the address.
      */
     pgmLock(pVM);
-    PPGMPHYSHANDLER pHandler = pgmHandlerPhysicalLookup(pVM, GCPhysFault);
-    if (RT_LIKELY(pHandler && pHandler->enmType != PGMPHYSHANDLERTYPE_PHYSICAL_WRITE))
+    PPGMPHYSHANDLER         pHandler     = pgmHandlerPhysicalLookup(pVM, GCPhysFault);
+    PPGMPHYSHANDLERTYPEINT  pHandlerType = RT_LIKELY(pHandler) ? PGMPHYSHANDLER_GET_TYPE(pVM, pHandler) : NULL;
+    if (RT_LIKELY(pHandler && pHandlerType->enmKind != PGMPHYSHANDLERKIND_WRITE))
     {
         /*
          * If the handle has aliases page or pages that have been temporarily
@@ -578,15 +579,15 @@ VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PVM pVM, PVMCPU pVCpu, PGM
         }
         else
         {
-            if (pHandler->CTX_SUFF(pfnHandler))
+            if (pHandlerType->CTX_SUFF(pfnPfHandler))
             {
-                CTX_MID(PFNPGM,PHYSHANDLER) pfnHandler = pHandler->CTX_SUFF(pfnHandler);
-                void                       *pvUser     = pHandler->CTX_SUFF(pvUser);
+                void *pvUser = pHandler->CTX_SUFF(pvUser);
                 STAM_PROFILE_START(&pHandler->Stat, h);
                 pgmUnlock(pVM);
 
-                Log6(("PGMR0Trap0eHandlerNPMisconfig: calling %p(,%#x,,%RGp,%p)\n", pfnHandler, uErr, GCPhysFault, pvUser));
-                rc = pfnHandler(pVM, uErr == UINT32_MAX ? RTGCPTR_MAX : uErr, pRegFrame, GCPhysFault, GCPhysFault, pvUser);
+                Log6(("PGMR0Trap0eHandlerNPMisconfig: calling %p(,%#x,,%RGp,%p)\n", pHandlerType->CTX_SUFF(pfnPfHandler), uErr, GCPhysFault, pvUser));
+                rc = pHandlerType->CTX_SUFF(pfnPfHandler)(pVM, pVCpu, uErr == UINT32_MAX ? RTGCPTR_MAX : uErr, pRegFrame,
+                                                          GCPhysFault, GCPhysFault, pvUser);
 
 #ifdef VBOX_WITH_STATISTICS
                 pgmLock(pVM);
diff --git a/src/VBox/VMM/VMMR0/VMMR0.cpp b/src/VBox/VMM/VMMR0/VMMR0.cpp
index 95641b3..380b231 100644
--- a/src/VBox/VMM/VMMR0/VMMR0.cpp
+++ b/src/VBox/VMM/VMMR0/VMMR0.cpp
@@ -35,6 +35,7 @@
 
 #include <VBox/vmm/gvmm.h>
 #include <VBox/vmm/gmm.h>
+#include <VBox/vmm/gim.h>
 #include <VBox/intnet.h>
 #include <VBox/vmm/hm.h>
 #include <VBox/param.h>
@@ -227,6 +228,7 @@ DECLEXPORT(int) ModuleInit(void *hMod)
  */
 DECLEXPORT(void) ModuleTerm(void *hMod)
 {
+    NOREF(hMod);
     LogFlow(("ModuleTerm:\n"));
 
     /*
@@ -377,16 +379,20 @@ static int vmmR0InitVM(PVM pVM, uint32_t uSvnRev, uint32_t uBuildType)
 #endif
                     if (RT_SUCCESS(rc))
                     {
-                        GVMMR0DoneInitVM(pVM);
-                        return rc;
-                    }
-                }
+                        rc = GIMR0InitVM(pVM);
+                        if (RT_SUCCESS(rc))
+                        {
+                            GVMMR0DoneInitVM(pVM);
+                            return rc;
+                        }
 
-                /* bail out */
-            }
+                        /* bail out*/
 #ifdef VBOX_WITH_PCI_PASSTHROUGH
-            PciRawR0TermVM(pVM);
+                        PciRawR0TermVM(pVM);
 #endif
+                    }
+                }
+            }
             HMR0TermVM(pVM);
         }
     }
@@ -410,7 +416,7 @@ static int vmmR0InitVM(PVM pVM, uint32_t uSvnRev, uint32_t uBuildType)
  * @param   pGVM        Pointer to the global VM structure. Optional.
  * @thread  EMT or session clean up thread.
  */
-VMMR0DECL(int) VMMR0TermVM(PVM pVM, PGVM pGVM)
+VMMR0_INT_DECL(int) VMMR0TermVM(PVM pVM, PGVM pGVM)
 {
 #ifdef VBOX_WITH_PCI_PASSTHROUGH
     PciRawR0TermVM(pVM);
@@ -421,6 +427,8 @@ VMMR0DECL(int) VMMR0TermVM(PVM pVM, PGVM pGVM)
      */
     if (GVMMR0DoingTermVM(pVM, pGVM))
     {
+        GIMR0TermVM(pVM);
+
         /** @todo I wish to call PGMR0PhysFlushHandyPages(pVM, &pVM->aCpus[idCpu])
          *        here to make sure we don't leak any shared pages if we crash... */
 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
@@ -438,154 +446,181 @@ VMMR0DECL(int) VMMR0TermVM(PVM pVM, PGVM pGVM)
 
 
 /**
- * Creates R0 thread-context hooks for the current EMT thread.
+ * VMM ring-0 thread-context callback.
  *
- * @returns VBox status code.
- * @param   pVCpu       Pointer to the VMCPU.
+ * This does common HM state updating and calls the HM-specific thread-context
+ * callback.
  *
- * @thread  EMT(pVCpu)
+ * @param   enmEvent    The thread-context event.
+ * @param   pvUser      Opaque pointer to the VMCPU.
+ *
+ * @thread  EMT(pvUser)
  */
-VMMR0DECL(int) VMMR0ThreadCtxHooksCreate(PVMCPU pVCpu)
+static DECLCALLBACK(void) vmmR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, void *pvUser)
 {
-    VMCPU_ASSERT_EMT(pVCpu);
-    Assert(pVCpu->vmm.s.hR0ThreadCtx == NIL_RTTHREADCTX);
-#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)
-    int rc = RTThreadCtxHooksCreate(&pVCpu->vmm.s.hR0ThreadCtx);
-    if (   RT_FAILURE(rc)
-        && rc != VERR_NOT_SUPPORTED)
+    PVMCPU pVCpu = (PVMCPU)pvUser;
+
+    switch (enmEvent)
     {
-        Log(("RTThreadCtxHooksCreate failed! rc=%Rrc pVCpu=%p idCpu=%RU32\n", rc, pVCpu, pVCpu->idCpu));
-        return rc;
-    }
-#endif
+        case RTTHREADCTXEVENT_IN:
+        {
+            /*
+             * Linux may call us with preemption enabled (really!) but technically we
+             * cannot get preempted here, otherwise we end up in an infinite recursion
+             * scenario (i.e. preempted in resume hook -> preempt hook -> resume hook...
+             * ad infinitum). Let's just disable preemption for now...
+             */
+            /** @todo r=bird: I don't believe the above. The linux code is clearly enabling
+             *        preemption after doing the callout (one or two functions up the
+             *        call chain). */
+            RTTHREADPREEMPTSTATE ParanoidPreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
+            RTThreadPreemptDisable(&ParanoidPreemptState);
 
-    return VINF_SUCCESS;
-}
+            /* We need to update the VCPU <-> host CPU mapping. */
+            RTCPUID idHostCpu;
+            uint32_t iHostCpuSet = RTMpCurSetIndexAndId(&idHostCpu);
+            pVCpu->iHostCpuSet   = iHostCpuSet;
+            ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
 
+            /* In the very unlikely event that the GIP delta for the CPU we're
+               rescheduled needs calculating, try force a return to ring-3.
+               We unfortunately cannot do the measurements right here. */
+            if (RT_UNLIKELY(SUPIsTscDeltaAvailableForCpuSetIndex(iHostCpuSet)))
+                VMCPU_FF_SET(pVCpu, VMCPU_FF_TO_R3);
 
-/**
- * Releases the object reference for the thread-context hook.
- *
- * @param   pVCpu       Pointer to the VMCPU.
- * @remarks Can be called from any thread.
- */
-VMMR0DECL(void) VMMR0ThreadCtxHooksRelease(PVMCPU pVCpu)
-{
-    RTThreadCtxHooksRelease(pVCpu->vmm.s.hR0ThreadCtx);
+            /* Invoke the HM-specific thread-context callback. */
+            HMR0ThreadCtxCallback(enmEvent, pvUser);
+
+            /* Restore preemption. */
+            RTThreadPreemptRestore(&ParanoidPreemptState);
+            break;
+        }
+
+        case RTTHREADCTXEVENT_OUT:
+        {
+            /* Invoke the HM-specific thread-context callback. */
+            HMR0ThreadCtxCallback(enmEvent, pvUser);
+
+            /*
+             * Sigh. See VMMGetCpu() used by VMCPU_ASSERT_EMT(). We cannot let several VCPUs
+             * have the same host CPU associated with it.
+             */
+            pVCpu->iHostCpuSet = UINT32_MAX;
+            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+            break;
+        }
+
+        default:
+            /* Invoke the HM-specific thread-context callback. */
+            HMR0ThreadCtxCallback(enmEvent, pvUser);
+            break;
+    }
 }
 
 
 /**
- * Registers the thread-context hook for this VCPU.
+ * Creates thread switching hook for the current EMT thread.
  *
- * @returns VBox status code.
- * @param   pVCpu           Pointer to the VMCPU.
- * @param   pfnThreadHook   Pointer to the thread-context callback.
+ * This is called by GVMMR0CreateVM and GVMMR0RegisterVCpu.  If the host
+ * platform does not implement switcher hooks, no hooks will be create and the
+ * member set to NIL_RTTHREADCTXHOOK.
  *
+ * @returns VBox status code.
+ * @param   pVCpu       Pointer to the cross context CPU structure.
  * @thread  EMT(pVCpu)
  */
-VMMR0DECL(int) VMMR0ThreadCtxHooksRegister(PVMCPU pVCpu, PFNRTTHREADCTXHOOK pfnThreadHook)
+VMMR0_INT_DECL(int) VMMR0ThreadCtxHookCreateForEmt(PVMCPU pVCpu)
 {
     VMCPU_ASSERT_EMT(pVCpu);
-    return RTThreadCtxHooksRegister(pVCpu->vmm.s.hR0ThreadCtx, pfnThreadHook, pVCpu);
+    Assert(pVCpu->vmm.s.hCtxHook == NIL_RTTHREADCTXHOOK);
+
+    int rc = RTThreadCtxHookCreate(&pVCpu->vmm.s.hCtxHook, 0, vmmR0ThreadCtxCallback, pVCpu);
+    if (RT_SUCCESS(rc))
+        return rc;
+
+    pVCpu->vmm.s.hCtxHook = NIL_RTTHREADCTXHOOK;
+    if (rc == VERR_NOT_SUPPORTED)
+        return VINF_SUCCESS;
+
+    LogRelMax(32, ("RTThreadCtxHookCreate failed! rc=%Rrc pVCpu=%p idCpu=%RU32\n", rc, pVCpu, pVCpu->idCpu));
+    return VINF_SUCCESS; /* Just ignore it, we can live without context hooks. */
 }
 
 
 /**
- * Deregisters the thread-context hook for this VCPU.
+ * Destroys the thread switching hook for the specified VCPU.
  *
- * @returns VBox status code.
- * @param   pVCpu       Pointer to the VMCPU.
- *
- * @thread  EMT(pVCpu)
+ * @param   pVCpu       Pointer to the cross context CPU structure.
+ * @remarks Can be called from any thread.
  */
-VMMR0DECL(int) VMMR0ThreadCtxHooksDeregister(PVMCPU pVCpu)
+VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDestroyForEmt(PVMCPU pVCpu)
 {
-    return RTThreadCtxHooksDeregister(pVCpu->vmm.s.hR0ThreadCtx);
+    int rc = RTThreadCtxHookDestroy(pVCpu->vmm.s.hCtxHook);
+    AssertRC(rc);
 }
 
 
 /**
- * Whether thread-context hooks are created (implying they're supported) on this
- * platform.
+ * Disables the thread switching hook for this VCPU (if we got one).
  *
- * @returns true if the hooks are created, false otherwise.
- * @param   pVCpu       Pointer to the VMCPU.
+ * @param   pVCpu       Pointer to the cross context CPU structure.
+ * @thread  EMT(pVCpu)
+ *
+ * @remarks This also clears VMCPU::idHostCpu, so the mapping is invalid after
+ *          this call.  This means you have to be careful with what you do!
  */
-VMMR0DECL(bool) VMMR0ThreadCtxHooksAreCreated(PVMCPU pVCpu)
+VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDisable(PVMCPU pVCpu)
 {
-    return pVCpu->vmm.s.hR0ThreadCtx != NIL_RTTHREADCTX;
+    /*
+     * Clear the VCPU <-> host CPU mapping as we've left HM context.
+     * @bugref{7726} comment #19 explains the need for this trick:
+     *
+     *      hmR0VmxCallRing3Callback/hmR0SvmCallRing3Callback &
+     *      hmR0VmxLeaveSession/hmR0SvmLeaveSession disables context hooks during
+     *      longjmp & normal return to ring-3, which opens a window where we may be
+     *      rescheduled without changing VMCPUID::idHostCpu and cause confusion if
+     *      the CPU starts executing a different EMT.  Both functions first disables
+     *      preemption and then calls HMR0LeaveCpu which invalids idHostCpu, leaving
+     *      an opening for getting preempted.
+     */
+    /** @todo Make HM not need this API!  Then we could leave the hooks enabled
+     *        all the time. */
+    /** @todo move this into the context hook disabling if(). */
+    ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+
+    /*
+     * Disable the context hook, if we got one.
+     */
+    if (pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK)
+    {
+        Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+        int rc = RTThreadCtxHookDisable(pVCpu->vmm.s.hCtxHook);
+        AssertRC(rc);
+    }
 }
 
 
 /**
- * Whether thread-context hooks are registered for this VCPU.
+ * Internal version of VMMR0ThreadCtxHooksAreRegistered.
  *
  * @returns true if registered, false otherwise.
  * @param   pVCpu       Pointer to the VMCPU.
  */
-VMMR0DECL(bool) VMMR0ThreadCtxHooksAreRegistered(PVMCPU pVCpu)
+DECLINLINE(bool) vmmR0ThreadCtxHookIsEnabled(PVMCPU pVCpu)
 {
-    return RTThreadCtxHooksAreRegistered(pVCpu->vmm.s.hR0ThreadCtx);
+    return RTThreadCtxHookIsEnabled(pVCpu->vmm.s.hCtxHook);
 }
 
 
 /**
- * VMM ring-0 thread-context callback.
- *
- * This does common HM state updating and calls the HM-specific thread-context
- * callback.
- *
- * @param   enmEvent    The thread-context event.
- * @param   pvUser      Opaque pointer to the VMCPU.
+ * Whether thread-context hooks are registered for this VCPU.
  *
- * @thread  EMT(pvUser)
+ * @returns true if registered, false otherwise.
+ * @param   pVCpu       Pointer to the VMCPU.
  */
-static DECLCALLBACK(void) vmmR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, void *pvUser)
+VMMR0_INT_DECL(bool) VMMR0ThreadCtxHookIsEnabled(PVMCPU pVCpu)
 {
-    PVMCPU pVCpu = (PVMCPU)pvUser;
-
-    switch (enmEvent)
-    {
-        case RTTHREADCTXEVENT_RESUMED:
-        {
-            /** @todo Linux may call us with preemption enabled (really!) but technically we
-             * cannot get preempted here, otherwise we end up in an infinite recursion
-             * scenario (i.e. preempted in resume hook -> preempt hook -> resume hook... ad
-             * infinitum). Let's just disable preemption for now...
-             */
-            HM_DISABLE_PREEMPT_IF_NEEDED();
-
-            /* We need to update the VCPU <-> host CPU mapping. */
-            RTCPUID idHostCpu = RTMpCpuId();
-            ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
-
-            /* Invoke the HM-specific thread-context callback. */
-            HMR0ThreadCtxCallback(enmEvent, pvUser);
-
-            /* Restore preemption. */
-            HM_RESTORE_PREEMPT_IF_NEEDED();
-            break;
-        }
-
-        case RTTHREADCTXEVENT_PREEMPTING:
-        {
-            /* Invoke the HM-specific thread-context callback. */
-            HMR0ThreadCtxCallback(enmEvent, pvUser);
-
-            /*
-             * Sigh. See VMMGetCpu() used by VMCPU_ASSERT_EMT(). We cannot let several VCPUs
-             * have the same host CPU associated with it.
-             */
-            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
-            break;
-        }
-
-        default:
-            /* Invoke the HM-specific thread-context callback. */
-            HMR0ThreadCtxCallback(enmEvent, pvUser);
-            break;
-    }
+    return vmmR0ThreadCtxHookIsEnabled(pVCpu);
 }
 
 
@@ -648,6 +683,12 @@ static void vmmR0RecordRC(PVM pVM, PVMCPU pVCpu, int rc)
         case VINF_PATM_HC_MMIO_PATCH_WRITE:
             STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMMIOPatchWrite);
             break;
+        case VINF_CPUM_R3_MSR_READ:
+            STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMSRRead);
+            break;
+        case VINF_CPUM_R3_MSR_WRITE:
+            STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetMSRWrite);
+            break;
         case VINF_EM_RAW_EMULATE_INSTR:
             STAM_COUNTER_INC(&pVM->vmm.s.StatRZRetEmulate);
             break;
@@ -816,10 +857,18 @@ VMMR0DECL(int) VMMR0EntryInt(PVM pVM, VMMR0OPERATION enmOperation, void *pvArg)
  */
 VMMR0DECL(void) VMMR0EntryFast(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation)
 {
+    /*
+     * Validation.
+     */
     if (RT_UNLIKELY(idCpu >= pVM->cCpus))
         return;
     PVMCPU pVCpu = &pVM->aCpus[idCpu];
+    if (RT_UNLIKELY(pVCpu->hNativeThreadR0 != RTThreadNativeSelf()))
+        return;
 
+    /*
+     * Perform requested operation.
+     */
     switch (enmOperation)
     {
         /*
@@ -837,58 +886,111 @@ VMMR0DECL(void) VMMR0EntryFast(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperati
             }
 #endif
 
-            /* Disable preemption and update the periodic preemption timer. */
+            /*
+             * Disable preemption.
+             */
             RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
             RTThreadPreemptDisable(&PreemptState);
-            RTCPUID idHostCpu = RTMpCpuId();
+
+            /*
+             * Get the host CPU identifiers, make sure they are valid and that
+             * we've got a TSC delta for the CPU.
+             */
+            RTCPUID  idHostCpu;
+            uint32_t iHostCpuSet = RTMpCurSetIndexAndId(&idHostCpu);
+            if (RT_LIKELY(   iHostCpuSet < RTCPUSET_MAX_CPUS
+                          && SUPIsTscDeltaAvailableForCpuSetIndex(iHostCpuSet)))
+            {
+                /*
+                 * Commit the CPU identifiers and update the periodict preemption timer if it's active.
+                 */
 #ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
-            CPUMR0SetLApic(pVCpu, idHostCpu);
+                CPUMR0SetLApic(pVCpu, iHostCpuSet);
 #endif
-            ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
-            if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
-                GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
+                pVCpu->iHostCpuSet = iHostCpuSet;
+                ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
 
-            /* We might need to disable VT-x if the active switcher turns off paging. */
-            bool fVTxDisabled;
-            int rc = HMR0EnterSwitcher(pVM, pVM->vmm.s.enmSwitcher, &fVTxDisabled);
-            if (RT_SUCCESS(rc))
-            {
-                RTCCUINTREG uFlags = ASMIntDisableFlags();
+                if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
+                    GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
 
-                for (;;)
+                /*
+                 * We might need to disable VT-x if the active switcher turns off paging.
+                  */
+                bool fVTxDisabled;
+                int rc = HMR0EnterSwitcher(pVM, pVM->vmm.s.enmSwitcher, &fVTxDisabled);
+                if (RT_SUCCESS(rc))
                 {
-                    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);
-                    TMNotifyStartOfExecution(pVCpu);
+                    /*
+                     * Disable interrupts and run raw-mode code.  The loop is for efficiently
+                     * dispatching tracepoints that fired in raw-mode context.
+                     */
+                    RTCCUINTREG uFlags = ASMIntDisableFlags();
 
-                    rc = pVM->vmm.s.pfnR0ToRawMode(pVM);
-                    pVCpu->vmm.s.iLastGZRc = rc;
+                    for (;;)
+                    {
+                        VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);
+                        TMNotifyStartOfExecution(pVCpu);
 
-                    TMNotifyEndOfExecution(pVCpu);
-                    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
+                        rc = pVM->vmm.s.pfnR0ToRawMode(pVM);
+                        pVCpu->vmm.s.iLastGZRc = rc;
 
-                    if (rc != VINF_VMM_CALL_TRACER)
-                        break;
-                    SUPR0TracerUmodProbeFire(pVM->pSession, &pVCpu->vmm.s.TracerCtx);
-                }
+                        TMNotifyEndOfExecution(pVCpu);
+                        VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
 
-                /* Re-enable VT-x if previously turned off. */
-                HMR0LeaveSwitcher(pVM, fVTxDisabled);
+                        if (rc != VINF_VMM_CALL_TRACER)
+                            break;
+                        SUPR0TracerUmodProbeFire(pVM->pSession, &pVCpu->vmm.s.TracerCtx);
+                    }
 
-                if (    rc == VINF_EM_RAW_INTERRUPT
-                    ||  rc == VINF_EM_RAW_INTERRUPT_HYPER)
-                    TRPMR0DispatchHostInterrupt(pVM);
+                    /*
+                     * Re-enable VT-x before we dispatch any pending host interrupts and
+                     * re-enables interrupts.
+                     */
+                    HMR0LeaveSwitcher(pVM, fVTxDisabled);
+
+                    if (    rc == VINF_EM_RAW_INTERRUPT
+                        ||  rc == VINF_EM_RAW_INTERRUPT_HYPER)
+                        TRPMR0DispatchHostInterrupt(pVM);
 
-                ASMSetFlags(uFlags);
+                    ASMSetFlags(uFlags);
 
+                    /* Fire dtrace probe and collect statistics. */
+                    VBOXVMM_R0_VMM_RETURN_TO_RING3_RC(pVCpu, CPUMQueryGuestCtxPtr(pVCpu), rc);
 #ifdef VBOX_WITH_STATISTICS
-                STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
-                vmmR0RecordRC(pVM, pVCpu, rc);
+                    STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
+                    vmmR0RecordRC(pVM, pVCpu, rc);
 #endif
+                }
+                else
+                    pVCpu->vmm.s.iLastGZRc = rc;
+
+                /*
+                 * Invalidate the host CPU identifiers as we restore preemption.
+                 */
+                pVCpu->iHostCpuSet = UINT32_MAX;
+                ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+
+                RTThreadPreemptRestore(&PreemptState);
             }
+            /*
+             * Invalid CPU set index or TSC delta in need of measuring.
+             */
             else
-                pVCpu->vmm.s.iLastGZRc = rc;
-            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
-            RTThreadPreemptRestore(&PreemptState);
+            {
+                RTThreadPreemptRestore(&PreemptState);
+                if (iHostCpuSet < RTCPUSET_MAX_CPUS)
+                {
+                    int rc = SUPR0TscDeltaMeasureBySetIndex(pVM->pSession, iHostCpuSet, 0 /*fFlags*/,
+                                                            2 /*cMsWaitRetry*/, 5*RT_MS_1SEC /*cMsWaitThread*/,
+                                                            0 /*default cTries*/);
+                    if (RT_SUCCESS(rc) || rc == VERR_CPU_OFFLINE)
+                        pVCpu->vmm.s.iLastGZRc = VINF_EM_RAW_TO_R3;
+                    else
+                        pVCpu->vmm.s.iLastGZRc = rc;
+                }
+                else
+                    pVCpu->vmm.s.iLastGZRc = VERR_INVALID_CPU_INDEX;
+            }
             break;
         }
 
@@ -897,94 +999,172 @@ VMMR0DECL(void) VMMR0EntryFast(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperati
          */
         case VMMR0_DO_HM_RUN:
         {
-            Assert(!VMMR0ThreadCtxHooksAreRegistered(pVCpu));
+            /*
+             * Disable preemption.
+             */
+            Assert(!vmmR0ThreadCtxHookIsEnabled(pVCpu));
             RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;
             RTThreadPreemptDisable(&PreemptState);
 
-            /* Update the VCPU <-> host CPU mapping before doing anything else. */
-            ASMAtomicWriteU32(&pVCpu->idHostCpu, RTMpCpuId());
-            if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
-                GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
-#ifdef LOG_ENABLED
-            if (pVCpu->idCpu > 0)
+            /*
+             * Get the host CPU identifiers, make sure they are valid and that
+             * we've got a TSC delta for the CPU.
+             */
+            RTCPUID  idHostCpu;
+            uint32_t iHostCpuSet = RTMpCurSetIndexAndId(&idHostCpu);
+            if (RT_LIKELY(   iHostCpuSet < RTCPUSET_MAX_CPUS
+                          && SUPIsTscDeltaAvailableForCpuSetIndex(iHostCpuSet)))
             {
-                /* Lazy registration of ring 0 loggers. */
-                PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0;
-                if (    pR0Logger
-                    &&  !pR0Logger->fRegistered)
-                {
-                    RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
-                    pR0Logger->fRegistered = true;
-                }
-            }
-#endif
+                pVCpu->iHostCpuSet = iHostCpuSet;
+                ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
 
-            int  rc;
-            bool fPreemptRestored = false;
-            if (!HMR0SuspendPending())
-            {
-                /* Register thread-context hooks if required. */
-                if (    VMMR0ThreadCtxHooksAreCreated(pVCpu)
-                    && !VMMR0ThreadCtxHooksAreRegistered(pVCpu))
+                /*
+                 * Update the periodic preemption timer if it's active.
+                 */
+                if (pVM->vmm.s.fUsePeriodicPreemptionTimers)
+                    GVMMR0SchedUpdatePeriodicPreemptionTimer(pVM, pVCpu->idHostCpu, TMCalcHostTimerFrequency(pVM, pVCpu));
+
+#ifdef LOG_ENABLED
+                /*
+                 * Ugly: Lazy registration of ring 0 loggers.
+                 */
+                if (pVCpu->idCpu > 0)
                 {
-                    rc = VMMR0ThreadCtxHooksRegister(pVCpu, vmmR0ThreadCtxCallback);
-                    AssertRC(rc);
+                    PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0;
+                    if (   pR0Logger
+                        && RT_UNLIKELY(!pR0Logger->fRegistered))
+                    {
+                        RTLogSetDefaultInstanceThread(&pR0Logger->Logger, (uintptr_t)pVM->pSession);
+                        pR0Logger->fRegistered = true;
+                    }
                 }
+#endif
 
-                /* Enter HM context. */
-                rc = HMR0Enter(pVM, pVCpu);
-                if (RT_SUCCESS(rc))
+                int  rc;
+                bool fPreemptRestored = false;
+                if (!HMR0SuspendPending())
                 {
-                    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_HM);
-
-                    /* When preemption hooks are in place, enable preemption now that we're in HM context. */
-                    if (VMMR0ThreadCtxHooksAreRegistered(pVCpu))
+                    /*
+                     * Enable the context switching hook.
+                     */
+                    if (pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK)
                     {
-                        fPreemptRestored = true;
-                        RTThreadPreemptRestore(&PreemptState);
+                        Assert(!RTThreadCtxHookIsEnabled(pVCpu->vmm.s.hCtxHook));
+                        int rc2 = RTThreadCtxHookEnable(pVCpu->vmm.s.hCtxHook); AssertRC(rc2);
                     }
 
-                    /* Setup the longjmp machinery and execute guest code. */
-                    rc = vmmR0CallRing3SetJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, HMR0RunGuestCode, pVM, pVCpu);
-
-                    /* Manual assert as normal assertions are going to crash in this case. */
-                    if (RT_UNLIKELY(   VMCPU_GET_STATE(pVCpu) != VMCPUSTATE_STARTED_HM
-                                    && RT_SUCCESS_NP(rc)  && rc !=  VINF_VMM_CALL_HOST ))
+                    /*
+                     * Enter HM context.
+                     */
+                    rc = HMR0Enter(pVM, pVCpu);
+                    if (RT_SUCCESS(rc))
                     {
-                        pVM->vmm.s.szRing0AssertMsg1[0] = '\0';
-                        RTStrPrintf(pVM->vmm.s.szRing0AssertMsg2, sizeof(pVM->vmm.s.szRing0AssertMsg2),
-                                    "Got VMCPU state %d expected %d.\n", VMCPU_GET_STATE(pVCpu), VMCPUSTATE_STARTED_HM);
-                        rc = VERR_VMM_WRONG_HM_VMCPU_STATE;
+                        VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_HM);
+
+                        /*
+                         * When preemption hooks are in place, enable preemption now that
+                         * we're in HM context.
+                         */
+                        if (vmmR0ThreadCtxHookIsEnabled(pVCpu))
+                        {
+                            fPreemptRestored = true;
+                            RTThreadPreemptRestore(&PreemptState);
+                        }
+
+                        /*
+                         * Setup the longjmp machinery and execute guest code (calls HMR0RunGuestCode).
+                         */
+                        rc = vmmR0CallRing3SetJmp(&pVCpu->vmm.s.CallRing3JmpBufR0, HMR0RunGuestCode, pVM, pVCpu);
+
+                        /*
+                         * Assert sanity on the way out.  Using manual assertions code here as normal
+                         * assertions are going to panic the host since we're outside the setjmp/longjmp zone.
+                         */
+                        if (RT_UNLIKELY(   VMCPU_GET_STATE(pVCpu) != VMCPUSTATE_STARTED_HM
+                                        && RT_SUCCESS_NP(rc)  && rc !=  VINF_VMM_CALL_HOST ))
+                        {
+                            pVM->vmm.s.szRing0AssertMsg1[0] = '\0';
+                            RTStrPrintf(pVM->vmm.s.szRing0AssertMsg2, sizeof(pVM->vmm.s.szRing0AssertMsg2),
+                                        "Got VMCPU state %d expected %d.\n", VMCPU_GET_STATE(pVCpu), VMCPUSTATE_STARTED_HM);
+                            rc = VERR_VMM_WRONG_HM_VMCPU_STATE;
+                        }
+                        /** @todo Get rid of this. HM shouldn't disable the context hook. */
+                        else if (RT_UNLIKELY(vmmR0ThreadCtxHookIsEnabled(pVCpu)))
+                        {
+                            pVM->vmm.s.szRing0AssertMsg1[0] = '\0';
+                            RTStrPrintf(pVM->vmm.s.szRing0AssertMsg2, sizeof(pVM->vmm.s.szRing0AssertMsg2),
+                                        "Thread-context hooks still enabled! VCPU=%p Id=%u rc=%d.\n", pVCpu, pVCpu->idCpu, rc);
+                            rc = VERR_INVALID_STATE;
+                        }
+
+                        VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
                     }
-                    else if (RT_UNLIKELY(VMMR0ThreadCtxHooksAreRegistered(pVCpu)))
+                    STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
+
+                    /*
+                     * Invalidate the host CPU identifiers before we disable the context
+                     * hook / restore preemption.
+                     */
+                    pVCpu->iHostCpuSet = UINT32_MAX;
+                    ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+
+                    /*
+                     * Disable context hooks.  Due to unresolved cleanup issues, we
+                     * cannot leave the hooks enabled when we return to ring-3.
+                     *
+                     * Note! At the moment HM may also have disabled the hook
+                     *       when we get here, but the IPRT API handles that.
+                     */
+                    if (pVCpu->vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK)
                     {
-                        pVM->vmm.s.szRing0AssertMsg1[0] = '\0';
-                        RTStrPrintf(pVM->vmm.s.szRing0AssertMsg2, sizeof(pVM->vmm.s.szRing0AssertMsg2),
-                                    "Thread-context hooks still registered! VCPU=%p Id=%u rc=%d.\n", pVCpu, pVCpu->idCpu, rc);
-                        rc = VERR_INVALID_STATE;
+                        ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+                        RTThreadCtxHookDisable(pVCpu->vmm.s.hCtxHook);
                     }
-
-                    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
                 }
-                STAM_COUNTER_INC(&pVM->vmm.s.StatRunRC);
-            }
-            else
-            {
-                /* System is about to go into suspend mode; go back to ring 3. */
-                rc = VINF_EM_RAW_INTERRUPT;
-            }
-            pVCpu->vmm.s.iLastGZRc = rc;
+                /*
+                 * The system is about to go into suspend mode; go back to ring 3.
+                 */
+                else
+                {
+                    rc = VINF_EM_RAW_INTERRUPT;
+                    pVCpu->iHostCpuSet = UINT32_MAX;
+                    ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+                }
 
-            /* Clear the VCPU <-> host CPU mapping as we've left HM context. */
-            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+                /** @todo When HM stops messing with the context hook state, we'll disable
+                 *        preemption again before the RTThreadCtxHookDisable call. */
+                if (!fPreemptRestored)
+                    RTThreadPreemptRestore(&PreemptState);
 
-            if (!fPreemptRestored)
-                RTThreadPreemptRestore(&PreemptState);
+                pVCpu->vmm.s.iLastGZRc = rc;
 
+                /* Fire dtrace probe and collect statistics. */
+                VBOXVMM_R0_VMM_RETURN_TO_RING3_HM(pVCpu, CPUMQueryGuestCtxPtr(pVCpu), rc);
 #ifdef VBOX_WITH_STATISTICS
-            vmmR0RecordRC(pVM, pVCpu, rc);
+                vmmR0RecordRC(pVM, pVCpu, rc);
 #endif
-            /* No special action required for external interrupts, just return. */
+            }
+            /*
+             * Invalid CPU set index or TSC delta in need of measuring.
+             */
+            else
+            {
+                pVCpu->iHostCpuSet = UINT32_MAX;
+                ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
+                RTThreadPreemptRestore(&PreemptState);
+                if (iHostCpuSet < RTCPUSET_MAX_CPUS)
+                {
+                    int rc = SUPR0TscDeltaMeasureBySetIndex(pVM->pSession, iHostCpuSet, 0 /*fFlags*/,
+                                                            2 /*cMsWaitRetry*/, 5*RT_MS_1SEC /*cMsWaitThread*/,
+                                                            0 /*default cTries*/);
+                    if (RT_SUCCESS(rc) || rc == VERR_CPU_OFFLINE)
+                        pVCpu->vmm.s.iLastGZRc = VINF_EM_RAW_TO_R3;
+                    else
+                        pVCpu->vmm.s.iLastGZRc = rc;
+                }
+                else
+                    pVCpu->vmm.s.iLastGZRc = VERR_INVALID_CPU_INDEX;
+            }
             break;
         }
 
@@ -1164,32 +1344,81 @@ static int vmmR0EntryExWorker(PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperatio
          */
         case VMMR0_DO_CALL_HYPERVISOR:
         {
-            int rc;
-            bool fVTxDisabled;
-
+            /*
+             * Validate input / context.
+             */
+            if (RT_UNLIKELY(idCpu != 0))
+                return VERR_INVALID_CPU_ID;
+            if (RT_UNLIKELY(pVM->cCpus != 1))
+                return VERR_INVALID_PARAMETER;
+            PVMCPU pVCpu = &pVM->aCpus[idCpu];
 #ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0
-            if (RT_UNLIKELY(!PGMGetHyperCR3(VMMGetCpu0(pVM))))
+            if (RT_UNLIKELY(!PGMGetHyperCR3(pVCpu)))
                 return VERR_PGM_NO_CR3_SHADOW_ROOT;
 #endif
 
+            /*
+             * Disable interrupts.
+             */
             RTCCUINTREG fFlags = ASMIntDisableFlags();
 
+            /*
+             * Get the host CPU identifiers, make sure they are valid and that
+             * we've got a TSC delta for the CPU.
+             */
+            RTCPUID  idHostCpu;
+            uint32_t iHostCpuSet = RTMpCurSetIndexAndId(&idHostCpu);
+            if (RT_UNLIKELY(iHostCpuSet >= RTCPUSET_MAX_CPUS))
+            {
+                ASMSetFlags(fFlags);
+                return VERR_INVALID_CPU_INDEX;
+            }
+            if (RT_UNLIKELY(!SUPIsTscDeltaAvailableForCpuSetIndex(iHostCpuSet)))
+            {
+                ASMSetFlags(fFlags);
+                int rc = SUPR0TscDeltaMeasureBySetIndex(pVM->pSession, iHostCpuSet, 0 /*fFlags*/,
+                                                        2 /*cMsWaitRetry*/, 5*RT_MS_1SEC /*cMsWaitThread*/,
+                                                        0 /*default cTries*/);
+                if (RT_FAILURE(rc) && rc != VERR_CPU_OFFLINE)
+                    return rc;
+            }
+
+            /*
+             * Commit the CPU identifiers.
+             */
 #ifdef VBOX_WITH_VMMR0_DISABLE_LAPIC_NMI
-            RTCPUID idHostCpu = RTMpCpuId();
-            CPUMR0SetLApic(&pVM->aCpus[0], idHostCpu);
+            CPUMR0SetLApic(pVCpu, iHostCpuSet);
 #endif
+            pVCpu->iHostCpuSet = iHostCpuSet;
+            ASMAtomicWriteU32(&pVCpu->idHostCpu, idHostCpu);
 
-            /* We might need to disable VT-x if the active switcher turns off paging. */
-            rc = HMR0EnterSwitcher(pVM, pVM->vmm.s.enmSwitcher, &fVTxDisabled);
-            if (RT_FAILURE(rc))
-                return rc;
-
-            rc = pVM->vmm.s.pfnR0ToRawMode(pVM);
+            /*
+             * We might need to disable VT-x if the active switcher turns off paging.
+             */
+            bool fVTxDisabled;
+            int rc = HMR0EnterSwitcher(pVM, pVM->vmm.s.enmSwitcher, &fVTxDisabled);
+            if (RT_SUCCESS(rc))
+            {
+                /*
+                 * Go through the wormhole...
+                 */
+                rc = pVM->vmm.s.pfnR0ToRawMode(pVM);
+
+                /*
+                 * Re-enable VT-x before we dispatch any pending host interrupts.
+                 */
+                HMR0LeaveSwitcher(pVM, fVTxDisabled);
 
-            /* Re-enable VT-x if previously turned off. */
-            HMR0LeaveSwitcher(pVM, fVTxDisabled);
+                if (   rc == VINF_EM_RAW_INTERRUPT
+                    || rc == VINF_EM_RAW_INTERRUPT_HYPER)
+                    TRPMR0DispatchHostInterrupt(pVM);
+            }
 
-            /** @todo dispatch interrupts? */
+            /*
+             * Invalidate the host CPU identifiers as we restore interrupts.
+             */
+            pVCpu->iHostCpuSet = UINT32_MAX;
+            ASMAtomicWriteU32(&pVCpu->idHostCpu, NIL_RTCPUID);
             ASMSetFlags(fFlags);
             return rc;
         }
@@ -1705,7 +1934,7 @@ VMMR0DECL(size_t) vmmR0LoggerPrefix(PRTLOGGER pLogger, char *pchBuf, size_t cchB
  *
  * @param   pVCpu       Pointer to the VMCPU.
  */
-VMMR0DECL(void) VMMR0LogFlushDisable(PVMCPU pVCpu)
+VMMR0_INT_DECL(void) VMMR0LogFlushDisable(PVMCPU pVCpu)
 {
     if (pVCpu->vmm.s.pR0LoggerR0)
         pVCpu->vmm.s.pR0LoggerR0->fFlushingDisabled = true;
@@ -1717,7 +1946,7 @@ VMMR0DECL(void) VMMR0LogFlushDisable(PVMCPU pVCpu)
  *
  * @param   pVCpu       Pointer to the VMCPU.
  */
-VMMR0DECL(void) VMMR0LogFlushEnable(PVMCPU pVCpu)
+VMMR0_INT_DECL(void) VMMR0LogFlushEnable(PVMCPU pVCpu)
 {
     if (pVCpu->vmm.s.pR0LoggerR0)
         pVCpu->vmm.s.pR0LoggerR0->fFlushingDisabled = false;
@@ -1729,7 +1958,7 @@ VMMR0DECL(void) VMMR0LogFlushEnable(PVMCPU pVCpu)
  *
  * @param   pVCpu       Pointer to the VMCPU.
  */
-VMMR0DECL(bool) VMMR0IsLogFlushDisabled(PVMCPU pVCpu)
+VMMR0_INT_DECL(bool) VMMR0IsLogFlushDisabled(PVMCPU pVCpu)
 {
     if (pVCpu->vmm.s.pR0LoggerR0)
         return pVCpu->vmm.s.pR0LoggerR0->fFlushingDisabled;
diff --git a/src/VBox/VMM/VMMR0/VMMR0.def b/src/VBox/VMM/VMMR0/VMMR0.def
index 6c8453e..7aa267b 100644
--- a/src/VBox/VMM/VMMR0/VMMR0.def
+++ b/src/VBox/VMM/VMMR0/VMMR0.def
@@ -3,7 +3,7 @@
 ; VMM Ring 0 DLL - Definition file.
 
 ;
-; Copyright (C) 2006-2013 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -87,9 +87,11 @@ EXPORTS
     RTAssertShouldPanic
     RTCrc32
     RTOnceSlow
-    RTTimeNanoTSLegacySync
+    RTTimeNanoTSLegacySyncInvarNoDelta
+    RTTimeNanoTSLegacySyncInvarWithDelta
     RTTimeNanoTSLegacyAsync
-    RTTimeNanoTSLFenceSync
+    RTTimeNanoTSLFenceSyncInvarNoDelta
+    RTTimeNanoTSLFenceSyncInvarWithDelta
     RTTimeNanoTSLFenceAsync
     RTTimeSystemNanoTS
     RTTimeNanoTS
diff --git a/src/VBox/VMM/VMMR3/CFGM.cpp b/src/VBox/VMM/VMMR3/CFGM.cpp
index 4420e89..cb7b9a5 100644
--- a/src/VBox/VMM/VMMR3/CFGM.cpp
+++ b/src/VBox/VMM/VMMR3/CFGM.cpp
@@ -610,6 +610,20 @@ VMMR3DECL(bool) CFGMR3AreValuesValid(PCFGMNODE pNode, const char *pszzValid)
 }
 
 
+/**
+ * Checks if the given value exists.
+ *
+ * @returns true if it exists, false if not.
+ * @param   pNode           Which node to search for pszName in.
+ * @param   pszName         The name of the value we seek.
+ */
+VMMR3DECL(bool) CFGMR3Exists(PCFGMNODE pNode, const char *pszName)
+{
+    PCFGMLEAF pLeaf;
+    int rc = cfgmR3ResolveLeaf(pNode, pszName, &pLeaf);
+    return RT_SUCCESS_NP(rc);
+}
+
 
 /**
  * Query value type.
@@ -878,7 +892,7 @@ VMMR3DECL(int) CFGMR3ValidateConfig(PCFGMNODE pNode, const char *pszNode,
     if (pNode)
     {
         /*
-         * Enumerate the leafs and check them against pszValidValues.
+         * Enumerate the leaves and check them against pszValidValues.
          */
         for (PCFGMLEAF pLeaf = pNode->pFirstLeaf; pLeaf; pLeaf = pLeaf->pNext)
         {
@@ -886,10 +900,10 @@ VMMR3DECL(int) CFGMR3ValidateConfig(PCFGMNODE pNode, const char *pszNode,
                                               pLeaf->szName, pLeaf->cchName,
                                               NULL))
             {
-                AssertLogRelMsgFailed(("%s/%u: Value '%s/%s' didn't match '%s'\n",
+                AssertLogRelMsgFailed(("%s/%u: Value '%s%s' didn't match '%s'\n",
                                        pszWho, uInstance, pszNode, pLeaf->szName, pszValidValues));
                 return VMSetError(pNode->pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS,
-                                  N_("Unknown configuration value '%s/%s' found in the configuration of %s instance #%u"),
+                                  N_("Unknown configuration value '%s%s' found in the configuration of %s instance #%u"),
                                   pszNode, pLeaf->szName, pszWho, uInstance);
             }
 
@@ -904,10 +918,10 @@ VMMR3DECL(int) CFGMR3ValidateConfig(PCFGMNODE pNode, const char *pszNode,
                                               pChild->szName, pChild->cchName,
                                               NULL))
             {
-                AssertLogRelMsgFailed(("%s/%u: Node '%s/%s' didn't match '%s'\n",
+                AssertLogRelMsgFailed(("%s/%u: Node '%s%s' didn't match '%s'\n",
                                        pszWho, uInstance, pszNode, pChild->szName, pszValidNodes));
                 return VMSetError(pNode->pVM, VERR_CFGM_CONFIG_UNKNOWN_NODE, RT_SRC_POS,
-                                  N_("Unknown configuration node '%s/%s' found in the configuration of %s instance #%u"),
+                                  N_("Unknown configuration node '%s%s' found in the configuration of %s instance #%u"),
                                   pszNode, pChild->szName, pszWho, uInstance);
             }
         }
@@ -1455,7 +1469,7 @@ VMMR3DECL(int) CFGMR3InsertSubTree(PCFGMNODE pNode, const char *pszName, PCFGMNO
 
     /*
      * Use CFGMR3InsertNode to create a new node and then
-     * re-attach the children and leafs of the subtree to it.
+     * re-attach the children and leaves of the subtree to it.
      */
     PCFGMNODE pNewChild;
     int rc = CFGMR3InsertNode(pNode, pszName, &pNewChild);
@@ -1925,7 +1939,7 @@ VMMR3DECL(void) CFGMR3RemoveNode(PCFGMNODE pNode)
             CFGMR3RemoveNode(pNode->pFirstChild);
 
         /*
-         * Free leafs.
+         * Free leaves.
          */
         while (pNode->pFirstLeaf)
             cfgmR3RemoveLeaf(pNode, pNode->pFirstLeaf);
diff --git a/src/VBox/VMM/VMMR3/CPUM.cpp b/src/VBox/VMM/VMMR3/CPUM.cpp
index f697c8e..60e4b43 100644
--- a/src/VBox/VMM/VMMR3/CPUM.cpp
+++ b/src/VBox/VMM/VMMR3/CPUM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -66,26 +66,6 @@
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-/** The current saved state version. */
-#define CPUM_SAVED_STATE_VERSION                14
-/** The current saved state version before using SSMR3PutStruct. */
-#define CPUM_SAVED_STATE_VERSION_MEM            13
-/** The saved state version before introducing the MSR size field. */
-#define CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE    12
-/** The saved state version of 3.2, 3.1 and 3.3 trunk before the hidden
- * selector register change (CPUM_CHANGED_HIDDEN_SEL_REGS_INVALID). */
-#define CPUM_SAVED_STATE_VERSION_VER3_2         11
-/** The saved state version of 3.0 and 3.1 trunk before the teleportation
- * changes. */
-#define CPUM_SAVED_STATE_VERSION_VER3_0         10
-/** The saved state version for the 2.1 trunk before the MSR changes. */
-#define CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR   9
-/** The saved state version of 2.0, used for backwards compatibility. */
-#define CPUM_SAVED_STATE_VERSION_VER2_0         8
-/** The saved state version of 1.6, used for backwards compatibility. */
-#define CPUM_SAVED_STATE_VERSION_VER1_6         6
-
-
 /**
  * This was used in the saved state up to the early life of version 14.
  *
@@ -115,7 +95,6 @@ typedef CPUMDUMPTYPE *PCPUMDUMPTYPE;
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-static int cpumR3CpuIdInit(PVM pVM);
 static DECLCALLBACK(int)  cpumR3LiveExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uPass);
 static DECLCALLBACK(int)  cpumR3SaveExec(PVM pVM, PSSMHANDLE pSSM);
 static DECLCALLBACK(int)  cpumR3LoadPrep(PVM pVM, PSSMHANDLE pSSM);
@@ -126,7 +105,6 @@ static DECLCALLBACK(void) cpumR3InfoGuest(PVM pVM, PCDBGFINFOHLP pHlp, const cha
 static DECLCALLBACK(void) cpumR3InfoGuestInstr(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
 static DECLCALLBACK(void) cpumR3InfoHyper(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
 static DECLCALLBACK(void) cpumR3InfoHost(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
-static DECLCALLBACK(void) cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
 
 
 /*******************************************************************************
@@ -135,42 +113,6 @@ static DECLCALLBACK(void) cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const cha
 /** Saved state field descriptors for CPUMCTX. */
 static const SSMFIELD g_aCpumCtxFields[] =
 {
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FCW),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FSW),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FTW),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FOP),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FPUIP),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.CS),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.Rsrvd1),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FPUDP),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.DS),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.Rsrvd2),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.MXCSR),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.MXCSR_MASK),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[0]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[1]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[2]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[3]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[4]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[5]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[6]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[7]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[0]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[1]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[2]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[3]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[4]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[5]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[6]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[7]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[8]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[9]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[10]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[11]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[12]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[13]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[14]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[15]),
     SSMFIELD_ENTRY(         CPUMCTX, rdi),
     SSMFIELD_ENTRY(         CPUMCTX, rsi),
     SSMFIELD_ENTRY(         CPUMCTX, rbp),
@@ -262,51 +204,210 @@ static const SSMFIELD g_aCpumCtxFields[] =
     SSMFIELD_ENTRY(         CPUMCTX, tr.u64Base),
     SSMFIELD_ENTRY(         CPUMCTX, tr.u32Limit),
     SSMFIELD_ENTRY(         CPUMCTX, tr.Attr),
+    SSMFIELD_ENTRY_VER(     CPUMCTX, aXcr[0],                           CPUM_SAVED_STATE_VERSION_XSAVE),
+    SSMFIELD_ENTRY_VER(     CPUMCTX, aXcr[1],                           CPUM_SAVED_STATE_VERSION_XSAVE),
+    SSMFIELD_ENTRY_VER(     CPUMCTX, fXStateMask,                       CPUM_SAVED_STATE_VERSION_XSAVE),
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for CPUMCTX. */
+static const SSMFIELD g_aCpumX87Fields[] =
+{
+    SSMFIELD_ENTRY(         X86FXSTATE, FCW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FSW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FTW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FOP),
+    SSMFIELD_ENTRY(         X86FXSTATE, FPUIP),
+    SSMFIELD_ENTRY(         X86FXSTATE, CS),
+    SSMFIELD_ENTRY(         X86FXSTATE, Rsrvd1),
+    SSMFIELD_ENTRY(         X86FXSTATE, FPUDP),
+    SSMFIELD_ENTRY(         X86FXSTATE, DS),
+    SSMFIELD_ENTRY(         X86FXSTATE, Rsrvd2),
+    SSMFIELD_ENTRY(         X86FXSTATE, MXCSR),
+    SSMFIELD_ENTRY(         X86FXSTATE, MXCSR_MASK),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[0]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[1]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[2]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[3]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[4]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[5]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[6]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[7]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[0]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[1]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[2]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[3]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[4]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[5]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[6]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[7]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[8]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[9]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[10]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[11]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[12]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[13]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[14]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[15]),
+    SSMFIELD_ENTRY_VER(     X86FXSTATE, au32RsrvdForSoftware[0],        CPUM_SAVED_STATE_VERSION_XSAVE), /* 32-bit/64-bit hack */
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for X86XSAVEHDR. */
+static const SSMFIELD g_aCpumXSaveHdrFields[] =
+{
+    SSMFIELD_ENTRY(         X86XSAVEHDR,  bmXState),
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for X86XSAVEYMMHI. */
+static const SSMFIELD g_aCpumYmmHiFields[] =
+{
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[0]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[1]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[2]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[3]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[4]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[5]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[6]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[7]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[8]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[9]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[10]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[11]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[12]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[13]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[14]),
+    SSMFIELD_ENTRY(         X86XSAVEYMMHI, aYmmHi[15]),
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for X86XSAVEBNDREGS. */
+static const SSMFIELD g_aCpumBndRegsFields[] =
+{
+    SSMFIELD_ENTRY(         X86XSAVEBNDREGS, aRegs[0]),
+    SSMFIELD_ENTRY(         X86XSAVEBNDREGS, aRegs[1]),
+    SSMFIELD_ENTRY(         X86XSAVEBNDREGS, aRegs[2]),
+    SSMFIELD_ENTRY(         X86XSAVEBNDREGS, aRegs[3]),
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for X86XSAVEBNDCFG. */
+static const SSMFIELD g_aCpumBndCfgFields[] =
+{
+    SSMFIELD_ENTRY(         X86XSAVEBNDCFG, fConfig),
+    SSMFIELD_ENTRY(         X86XSAVEBNDCFG, fStatus),
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for X86XSAVEOPMASK. */
+static const SSMFIELD g_aCpumOpmaskFields[] =
+{
+    SSMFIELD_ENTRY(         X86XSAVEOPMASK, aKRegs[0]),
+    SSMFIELD_ENTRY(         X86XSAVEOPMASK, aKRegs[1]),
+    SSMFIELD_ENTRY(         X86XSAVEOPMASK, aKRegs[2]),
+    SSMFIELD_ENTRY(         X86XSAVEOPMASK, aKRegs[3]),
+    SSMFIELD_ENTRY(         X86XSAVEOPMASK, aKRegs[4]),
+    SSMFIELD_ENTRY(         X86XSAVEOPMASK, aKRegs[5]),
+    SSMFIELD_ENTRY(         X86XSAVEOPMASK, aKRegs[6]),
+    SSMFIELD_ENTRY(         X86XSAVEOPMASK, aKRegs[7]),
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for X86XSAVEZMMHI256. */
+static const SSMFIELD g_aCpumZmmHi256Fields[] =
+{
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[0]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[1]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[2]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[3]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[4]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[5]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[6]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[7]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[8]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[9]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[10]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[11]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[12]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[13]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[14]),
+    SSMFIELD_ENTRY(         X86XSAVEZMMHI256, aHi256Regs[15]),
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for X86XSAVEZMM16HI. */
+static const SSMFIELD g_aCpumZmm16HiFields[] =
+{
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[0]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[1]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[2]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[3]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[4]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[5]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[6]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[7]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[8]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[9]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[10]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[11]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[12]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[13]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[14]),
+    SSMFIELD_ENTRY(         X86XSAVEZMM16HI, aRegs[15]),
     SSMFIELD_ENTRY_TERM()
 };
 
+
+
+/** Saved state field descriptors for CPUMCTX in V4.1 before the hidden selector
+ * registeres changed. */
+static const SSMFIELD g_aCpumX87FieldsMem[] =
+{
+    SSMFIELD_ENTRY(         X86FXSTATE, FCW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FSW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FTW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FOP),
+    SSMFIELD_ENTRY(         X86FXSTATE, FPUIP),
+    SSMFIELD_ENTRY(         X86FXSTATE, CS),
+    SSMFIELD_ENTRY(         X86FXSTATE, Rsrvd1),
+    SSMFIELD_ENTRY(         X86FXSTATE, FPUDP),
+    SSMFIELD_ENTRY(         X86FXSTATE, DS),
+    SSMFIELD_ENTRY(         X86FXSTATE, Rsrvd2),
+    SSMFIELD_ENTRY(         X86FXSTATE, MXCSR),
+    SSMFIELD_ENTRY(         X86FXSTATE, MXCSR_MASK),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[0]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[1]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[2]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[3]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[4]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[5]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[6]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[7]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[0]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[1]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[2]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[3]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[4]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[5]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[6]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[7]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[8]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[9]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[10]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[11]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[12]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[13]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[14]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[15]),
+    SSMFIELD_ENTRY_IGNORE(  X86FXSTATE, au32RsrvdRest),
+    SSMFIELD_ENTRY_IGNORE(  X86FXSTATE, au32RsrvdForSoftware),
+};
+
 /** Saved state field descriptors for CPUMCTX in V4.1 before the hidden selector
  * registeres changed. */
 static const SSMFIELD g_aCpumCtxFieldsMem[] =
 {
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FCW),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FSW),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FTW),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FOP),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FPUIP),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.CS),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.Rsrvd1),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.FPUDP),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.DS),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.Rsrvd2),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.MXCSR),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.MXCSR_MASK),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[0]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[1]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[2]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[3]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[4]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[5]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[6]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aRegs[7]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[0]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[1]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[2]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[3]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[4]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[5]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[6]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[7]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[8]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[9]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[10]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[11]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[12]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[13]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[14]),
-    SSMFIELD_ENTRY(         CPUMCTX, fpu.aXMM[15]),
-    SSMFIELD_ENTRY_IGNORE(  CPUMCTX, fpu.au32RsrvdRest),
-    SSMFIELD_ENTRY_IGNORE(  CPUMCTX, fpu.au32RsrvdForSoftware),
     SSMFIELD_ENTRY(         CPUMCTX, rdi),
     SSMFIELD_ENTRY(         CPUMCTX, rsi),
     SSMFIELD_ENTRY(         CPUMCTX, rbp),
@@ -398,46 +499,52 @@ static const SSMFIELD g_aCpumCtxFieldsMem[] =
 };
 
 /** Saved state field descriptors for CPUMCTX_VER1_6. */
+static const SSMFIELD g_aCpumX87FieldsV16[] =
+{
+    SSMFIELD_ENTRY(         X86FXSTATE, FCW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FSW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FTW),
+    SSMFIELD_ENTRY(         X86FXSTATE, FOP),
+    SSMFIELD_ENTRY(         X86FXSTATE, FPUIP),
+    SSMFIELD_ENTRY(         X86FXSTATE, CS),
+    SSMFIELD_ENTRY(         X86FXSTATE, Rsrvd1),
+    SSMFIELD_ENTRY(         X86FXSTATE, FPUDP),
+    SSMFIELD_ENTRY(         X86FXSTATE, DS),
+    SSMFIELD_ENTRY(         X86FXSTATE, Rsrvd2),
+    SSMFIELD_ENTRY(         X86FXSTATE, MXCSR),
+    SSMFIELD_ENTRY(         X86FXSTATE, MXCSR_MASK),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[0]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[1]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[2]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[3]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[4]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[5]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[6]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aRegs[7]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[0]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[1]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[2]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[3]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[4]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[5]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[6]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[7]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[8]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[9]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[10]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[11]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[12]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[13]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[14]),
+    SSMFIELD_ENTRY(         X86FXSTATE, aXMM[15]),
+    SSMFIELD_ENTRY_IGNORE(  X86FXSTATE, au32RsrvdRest),
+    SSMFIELD_ENTRY_IGNORE(  X86FXSTATE, au32RsrvdForSoftware),
+    SSMFIELD_ENTRY_TERM()
+};
+
+/** Saved state field descriptors for CPUMCTX_VER1_6. */
 static const SSMFIELD g_aCpumCtxFieldsV16[] =
 {
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.FCW),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.FSW),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.FTW),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.FOP),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.FPUIP),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.CS),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.Rsrvd1),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.FPUDP),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.DS),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.Rsrvd2),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.MXCSR),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.MXCSR_MASK),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aRegs[0]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aRegs[1]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aRegs[2]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aRegs[3]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aRegs[4]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aRegs[5]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aRegs[6]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aRegs[7]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[0]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[1]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[2]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[3]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[4]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[5]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[6]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[7]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[8]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[9]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[10]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[11]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[12]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[13]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[14]),
-    SSMFIELD_ENTRY(             CPUMCTX, fpu.aXMM[15]),
-    SSMFIELD_ENTRY_IGNORE(      CPUMCTX, fpu.au32RsrvdRest),
-    SSMFIELD_ENTRY_IGNORE(      CPUMCTX, fpu.au32RsrvdForSoftware),
     SSMFIELD_ENTRY(             CPUMCTX, rdi),
     SSMFIELD_ENTRY(             CPUMCTX, rsi),
     SSMFIELD_ENTRY(             CPUMCTX, rbp),
@@ -538,12 +645,11 @@ static const SSMFIELD g_aCpumCtxFieldsV16[] =
 /**
  * Checks for partial/leaky FXSAVE/FXRSTOR handling on AMD CPUs.
  *
- * AMD K7, K8 and newer AMD CPUs do not save/restore the x87 error
- * pointers (last instruction pointer, last data pointer, last opcode)
- * except when the ES bit (Exception Summary) in x87 FSW (FPU Status
- * Word) is set. Thus if we don't clear these registers there is
- * potential, local FPU leakage from a process using the FPU to
- * another.
+ * AMD K7, K8 and newer AMD CPUs do not save/restore the x87 error pointers
+ * (last instruction pointer, last data pointer, last opcode) except when the ES
+ * bit (Exception Summary) in x87 FSW (FPU Status Word) is set. Thus if we don't
+ * clear these registers there is potential, local FPU leakage from a process
+ * using the FPU to another.
  *
  * See AMD Instruction Reference for FXSAVE, FXRSTOR.
  *
@@ -598,6 +704,10 @@ VMMR3DECL(int) CPUMR3Init(PVM pVM)
     AssertRCReturn(rc2, rc2);
 #endif
 
+    /*
+     * Initialize offsets.
+     */
+
     /* Calculate the offset from CPUM to CPUMCPU for the first CPU. */
     pVM->cpum.s.offCPUMCPU0 = RT_OFFSETOF(VM, aCpus[0].cpum) - RT_OFFSETOF(VM, cpum);
     Assert((uintptr_t)&pVM->cpum + pVM->cpum.s.offCPUMCPU0 == (uintptr_t)&pVM->aCpus[0].cpum);
@@ -613,48 +723,14 @@ VMMR3DECL(int) CPUMR3Init(PVM pVM)
     }
 
     /*
-     * Check that the CPU supports the minimum features we require.
+     * Gather info about the host CPU.
      */
     if (!ASMHasCpuId())
     {
         Log(("The CPU doesn't support CPUID!\n"));
         return VERR_UNSUPPORTED_CPU;
     }
-    ASMCpuId_ECX_EDX(1, &pVM->cpum.s.CPUFeatures.ecx, &pVM->cpum.s.CPUFeatures.edx);
-    ASMCpuId_ECX_EDX(0x80000001, &pVM->cpum.s.CPUFeaturesExt.ecx, &pVM->cpum.s.CPUFeaturesExt.edx);
-
-    /* Setup the CR4 AND and OR masks used in the switcher */
-    /* Depends on the presence of FXSAVE(SSE) support on the host CPU */
-    if (!pVM->cpum.s.CPUFeatures.edx.u1FXSR)
-    {
-        Log(("The CPU doesn't support FXSAVE/FXRSTOR!\n"));
-        /* No FXSAVE implies no SSE */
-        pVM->cpum.s.CR4.AndMask = X86_CR4_PVI | X86_CR4_VME;
-        pVM->cpum.s.CR4.OrMask  = 0;
-    }
-    else
-    {
-        pVM->cpum.s.CR4.AndMask = X86_CR4_OSXMMEEXCPT | X86_CR4_PVI | X86_CR4_VME;
-        pVM->cpum.s.CR4.OrMask  = X86_CR4_OSFSXR;
-    }
-
-    if (!pVM->cpum.s.CPUFeatures.edx.u1MMX)
-    {
-        Log(("The CPU doesn't support MMX!\n"));
-        return VERR_UNSUPPORTED_CPU;
-    }
-    if (!pVM->cpum.s.CPUFeatures.edx.u1TSC)
-    {
-        Log(("The CPU doesn't support TSC!\n"));
-        return VERR_UNSUPPORTED_CPU;
-    }
-    /* Bogus on AMD? */
-    if (!pVM->cpum.s.CPUFeatures.edx.u1SEP)
-        Log(("The CPU doesn't support SYSENTER/SYSEXIT!\n"));
 
-    /*
-     * Gather info about the host CPU.
-     */
     PCPUMCPUIDLEAF  paLeaves;
     uint32_t        cLeaves;
     int rc = CPUMR3CpuIdCollectLeaves(&paLeaves, &cLeaves);
@@ -666,6 +742,73 @@ VMMR3DECL(int) CPUMR3Init(PVM pVM)
     pVM->cpum.s.GuestFeatures.enmCpuVendor = pVM->cpum.s.HostFeatures.enmCpuVendor;
 
     /*
+     * Check that the CPU supports the minimum features we require.
+     */
+    if (!pVM->cpum.s.HostFeatures.fFxSaveRstor)
+        return VMSetError(pVM, VERR_UNSUPPORTED_CPU, RT_SRC_POS, "Host CPU does not support the FXSAVE/FXRSTOR instruction.");
+    if (!pVM->cpum.s.HostFeatures.fMmx)
+        return VMSetError(pVM, VERR_UNSUPPORTED_CPU, RT_SRC_POS, "Host CPU does not support MMX.");
+    if (!pVM->cpum.s.HostFeatures.fTsc)
+        return VMSetError(pVM, VERR_UNSUPPORTED_CPU, RT_SRC_POS, "Host CPU does not support RDTSC.");
+
+    /*
+     * Setup the CR4 AND and OR masks used in the raw-mode switcher.
+     */
+    pVM->cpum.s.CR4.AndMask = X86_CR4_OSXMMEEXCPT | X86_CR4_PVI | X86_CR4_VME;
+    pVM->cpum.s.CR4.OrMask  = X86_CR4_OSFXSR;
+
+    /*
+     * Figure out which XSAVE/XRSTOR features are available on the host.
+     */
+    uint64_t fXStateHostMask = 0;
+    if (   pVM->cpum.s.HostFeatures.fXSaveRstor
+        && pVM->cpum.s.HostFeatures.fOpSysXSaveRstor)
+    {
+        fXStateHostMask = ASMGetXcr0() & (  XSAVE_C_X87 | XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_OPMASK
+                                          | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI);
+        AssertLogRelMsgStmt((fXStateHostMask & (XSAVE_C_X87 | XSAVE_C_SSE)) == (XSAVE_C_X87 | XSAVE_C_SSE),
+                            ("%#llx\n", fXStateHostMask), fXStateHostMask = 0);
+    }
+    pVM->cpum.s.fXStateHostMask = fXStateHostMask;
+    if (!HMIsEnabled(pVM)) /* For raw-mode, we only use XSAVE/XRSTOR when the guest starts using it (CPUID/CR4 visibility). */
+        fXStateHostMask = 0;
+    LogRel(("CPUM: fXStateHostMask=%#llx; initial: %#llx\n", pVM->cpum.s.fXStateHostMask, fXStateHostMask));
+
+    /*
+     * Allocate memory for the extended CPU state and initialize the host XSAVE/XRSTOR mask.
+     */
+    uint32_t cbMaxXState = pVM->cpum.s.HostFeatures.cbMaxExtendedState;
+    cbMaxXState = RT_ALIGN(cbMaxXState, 128);
+    AssertLogRelReturn(cbMaxXState >= sizeof(X86FXSTATE) && cbMaxXState <= _8K, VERR_CPUM_IPE_2);
+
+    uint8_t *pbXStates;
+    rc = MMR3HyperAllocOnceNoRelEx(pVM, cbMaxXState * 3 * pVM->cCpus, PAGE_SIZE, MM_TAG_CPUM_CTX,
+                                   MMHYPER_AONR_FLAGS_KERNEL_MAPPING, (void **)&pbXStates);
+    AssertLogRelRCReturn(rc, rc);
+
+    for (VMCPUID i = 0; i < pVM->cCpus; i++)
+    {
+        PVMCPU pVCpu = &pVM->aCpus[i];
+
+        pVCpu->cpum.s.Guest.pXStateR3 = (PX86XSAVEAREA)pbXStates;
+        pVCpu->cpum.s.Guest.pXStateR0 = MMHyperR3ToR0(pVM, pbXStates);
+        pVCpu->cpum.s.Guest.pXStateRC = MMHyperR3ToR0(pVM, pbXStates);
+        pbXStates += cbMaxXState;
+
+        pVCpu->cpum.s.Host.pXStateR3  = (PX86XSAVEAREA)pbXStates;
+        pVCpu->cpum.s.Host.pXStateR0  = MMHyperR3ToR0(pVM, pbXStates);
+        pVCpu->cpum.s.Host.pXStateRC  = MMHyperR3ToR0(pVM, pbXStates);
+        pbXStates += cbMaxXState;
+
+        pVCpu->cpum.s.Hyper.pXStateR3 = (PX86XSAVEAREA)pbXStates;
+        pVCpu->cpum.s.Hyper.pXStateR0 = MMHyperR3ToR0(pVM, pbXStates);
+        pVCpu->cpum.s.Hyper.pXStateRC = MMHyperR3ToR0(pVM, pbXStates);
+        pbXStates += cbMaxXState;
+
+        pVCpu->cpum.s.Host.fXStateMask = fXStateHostMask;
+    }
+
+    /*
      * Setup hypervisor startup values.
      */
 
@@ -699,9 +842,9 @@ VMMR3DECL(int) CPUMR3Init(PVM pVM)
     cpumR3CheckLeakyFpu(pVM);
 
     /*
-     * Initialize the Guest CPUID state.
+     * Initialize the Guest CPUID and MSR states.
      */
-    rc = cpumR3CpuIdInit(pVM);
+    rc = cpumR3InitCpuIdAndMsrs(pVM);
     if (RT_FAILURE(rc))
         return rc;
     CPUMR3Reset(pVM);
@@ -710,1203 +853,155 @@ VMMR3DECL(int) CPUMR3Init(PVM pVM)
 
 
 /**
- * Loads MSR range overrides.
+ * Applies relocations to data and code managed by this
+ * component. This function will be called at init and
+ * whenever the VMM need to relocate it self inside the GC.
  *
- * This must be called before the MSR ranges are moved from the normal heap to
- * the hyper heap!
+ * The CPUM will update the addresses used by the switcher.
  *
- * @returns VBox status code (VMSetError called).
- * @param   pVM                 Pointer to the cross context VM structure
- * @param   pMsrNode            The CFGM node with the MSR overrides.
+ * @param   pVM     The VM.
  */
-static int cpumR3LoadMsrOverrides(PVM pVM, PCFGMNODE pMsrNode)
+VMMR3DECL(void) CPUMR3Relocate(PVM pVM)
 {
-    for (PCFGMNODE pNode = CFGMR3GetFirstChild(pMsrNode); pNode; pNode = CFGMR3GetNextChild(pNode))
-    {
-        /*
-         * Assemble a valid MSR range.
-         */
-        CPUMMSRRANGE MsrRange;
-        MsrRange.offCpumCpu = 0;
-        MsrRange.fReserved  = 0;
-
-        int rc = CFGMR3GetName(pNode, MsrRange.szName, sizeof(MsrRange.szName));
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry (name is probably too long): %Rrc\n", rc);
-
-        rc = CFGMR3QueryU32(pNode, "First", &MsrRange.uFirst);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying mandatory 'First' value: %Rrc\n",
-                              MsrRange.szName, rc);
-
-        rc = CFGMR3QueryU32Def(pNode, "Last", &MsrRange.uLast, MsrRange.uFirst);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'Last' value: %Rrc\n",
-                              MsrRange.szName, rc);
-
-        char szType[32];
-        rc = CFGMR3QueryStringDef(pNode, "Type", szType, sizeof(szType), "FixedValue");
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'Type' value: %Rrc\n",
-                              MsrRange.szName, rc);
-        if (!RTStrICmp(szType, "FixedValue"))
-        {
-            MsrRange.enmRdFn = kCpumMsrRdFn_FixedValue;
-            MsrRange.enmWrFn = kCpumMsrWrFn_IgnoreWrite;
-
-            rc = CFGMR3QueryU64Def(pNode, "Value", &MsrRange.uValue, 0);
-            if (RT_FAILURE(rc))
-                return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'Value' value: %Rrc\n",
-                                  MsrRange.szName, rc);
+    LogFlow(("CPUMR3Relocate\n"));
 
-            rc = CFGMR3QueryU64Def(pNode, "WrGpMask", &MsrRange.fWrGpMask, 0);
-            if (RT_FAILURE(rc))
-                return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'WrGpMask' value: %Rrc\n",
-                                  MsrRange.szName, rc);
+    pVM->cpum.s.GuestInfo.paMsrRangesRC   = MMHyperR3ToRC(pVM, pVM->cpum.s.GuestInfo.paMsrRangesR3);
+    pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = MMHyperR3ToRC(pVM, pVM->cpum.s.GuestInfo.paCpuIdLeavesR3);
 
-            rc = CFGMR3QueryU64Def(pNode, "WrIgnMask", &MsrRange.fWrIgnMask, 0);
-            if (RT_FAILURE(rc))
-                return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'WrIgnMask' value: %Rrc\n",
-                                  MsrRange.szName, rc);
-        }
-        else
-            return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
-                              "Invalid MSR entry '%s': Unknown type '%s'\n", MsrRange.szName, szType);
+    for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
+    {
+        PVMCPU pVCpu = &pVM->aCpus[iCpu];
+        pVCpu->cpum.s.Guest.pXStateRC = MMHyperR3ToRC(pVM, pVCpu->cpum.s.Guest.pXStateR3);
+        pVCpu->cpum.s.Host.pXStateRC  = MMHyperR3ToRC(pVM, pVCpu->cpum.s.Host.pXStateR3);
+        pVCpu->cpum.s.Hyper.pXStateRC = MMHyperR3ToRC(pVM, pVCpu->cpum.s.Hyper.pXStateR3); /** @todo remove me */
 
-        /*
-         * Insert the range into the table (replaces/splits/shrinks existing
-         * MSR ranges).
-         */
-        rc = cpumR3MsrRangesInsert(&pVM->cpum.s.GuestInfo.paMsrRangesR3, &pVM->cpum.s.GuestInfo.cMsrRanges, &MsrRange);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Error adding MSR entry '%s': %Rrc\n", MsrRange.szName, rc);
+        /* Recheck the guest DRx values in raw-mode. */
+        CPUMRecalcHyperDRx(pVCpu, UINT8_MAX, false);
     }
-
-    return VINF_SUCCESS;
 }
 
 
 /**
- * Loads CPUID leaf overrides.
- *
- * This must be called before the CPUID leaves are moved from the normal
- * heap to the hyper heap!
+ * Apply late CPUM property changes based on the fHWVirtEx setting
  *
- * @returns VBox status code (VMSetError called).
- * @param   pVM             Pointer to the cross context VM structure
- * @param   pParentNode     The CFGM node with the CPUID leaves.
- * @param   pszLabel        How to label the overrides we're loading.
+ * @param   pVM                 Pointer to the VM.
+ * @param   fHWVirtExEnabled    HWVirtEx enabled/disabled
  */
-static int cpumR3LoadCpuIdOverrides(PVM pVM, PCFGMNODE pParentNode, const char *pszLabel)
+VMMR3DECL(void) CPUMR3SetHWVirtEx(PVM pVM, bool fHWVirtExEnabled)
 {
-    for (PCFGMNODE pNode = CFGMR3GetFirstChild(pParentNode); pNode; pNode = CFGMR3GetNextChild(pNode))
+    /*
+     * Workaround for missing cpuid(0) patches when leaf 4 returns GuestInfo.DefCpuId:
+     * If we miss to patch a cpuid(0).eax then Linux tries to determine the number
+     * of processors from (cpuid(4).eax >> 26) + 1.
+     *
+     * Note: this code is obsolete, but let's keep it here for reference.
+     *       Purpose is valid when we artificially cap the max std id to less than 4.
+     */
+    if (!fHWVirtExEnabled)
     {
-        /*
-         * Get the leaf and subleaf numbers.
-         */
-        char szName[128];
-        int rc = CFGMR3GetName(pNode, szName, sizeof(szName));
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry (name is probably too long): %Rrc\n", pszLabel, rc);
-
-        /* The leaf number is either specified directly or thru the node name. */
-        uint32_t uLeaf;
-        rc = CFGMR3QueryU32(pNode, "Leaf", &uLeaf);
-        if (rc == VERR_CFGM_VALUE_NOT_FOUND)
-        {
-            rc = RTStrToUInt32Full(szName, 16, &uLeaf);
-            if (rc != VINF_SUCCESS)
-                return VMSetError(pVM, VERR_INVALID_NAME, RT_SRC_POS,
-                                  "Invalid %s entry: Invalid leaf number: '%s' \n", pszLabel, szName);
-        }
-        else if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'Leaf' value: %Rrc\n",
-                              pszLabel, szName, rc);
-
-        uint32_t uSubLeaf;
-        rc = CFGMR3QueryU32Def(pNode, "SubLeaf", &uSubLeaf, 0);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'SubLeaf' value: %Rrc\n",
-                              pszLabel, szName, rc);
-
-        uint32_t fSubLeafMask;
-        rc = CFGMR3QueryU32Def(pNode, "SubLeafMask", &fSubLeafMask, 0);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'SubLeafMask' value: %Rrc\n",
-                              pszLabel, szName, rc);
-
-        /*
-         * Look up the specified leaf, since the output register values
-         * defaults to any existing values.  This allows overriding a single
-         * register, without needing to know the other values.
-         */
-        PCCPUMCPUIDLEAF pLeaf = cpumR3CpuIdGetLeaf(pVM->cpum.s.GuestInfo.paCpuIdLeavesR3, pVM->cpum.s.GuestInfo.cCpuIdLeaves,
-                                                   uLeaf, uSubLeaf);
-        CPUMCPUIDLEAF   Leaf;
-        if (pLeaf)
-            Leaf = *pLeaf;
-        else
-            RT_ZERO(Leaf);
-        Leaf.uLeaf          = uLeaf;
-        Leaf.uSubLeaf       = uSubLeaf;
-        Leaf.fSubLeafMask   = fSubLeafMask;
-
-        rc = CFGMR3QueryU32Def(pNode, "eax", &Leaf.uEax, Leaf.uEax);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'eax' value: %Rrc\n",
-                              pszLabel, szName, rc);
-        rc = CFGMR3QueryU32Def(pNode, "ebx", &Leaf.uEbx, Leaf.uEbx);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'ebx' value: %Rrc\n",
-                              pszLabel, szName, rc);
-        rc = CFGMR3QueryU32Def(pNode, "ecx", &Leaf.uEcx, Leaf.uEcx);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'ecx' value: %Rrc\n",
-                              pszLabel, szName, rc);
-        rc = CFGMR3QueryU32Def(pNode, "edx", &Leaf.uEdx, Leaf.uEdx);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'edx' value: %Rrc\n",
-                              pszLabel, szName, rc);
-
-        /*
-         * Insert the leaf into the table (replaces existing ones).
-         */
-        rc = cpumR3CpuIdInsert(&pVM->cpum.s.GuestInfo.paCpuIdLeavesR3, &pVM->cpum.s.GuestInfo.cCpuIdLeaves, &Leaf);
-        if (RT_FAILURE(rc))
-            return VMSetError(pVM, rc, RT_SRC_POS, "Error adding CPUID leaf entry '%s': %Rrc\n", szName, rc);
+        Assert(   (pVM->cpum.s.aGuestCpuIdPatmStd[4].uEax & UINT32_C(0xffffc000)) == 0
+               || pVM->cpum.s.aGuestCpuIdPatmStd[0].uEax < 0x4);
+        pVM->cpum.s.aGuestCpuIdPatmStd[4].uEax &= UINT32_C(0x00003fff);
     }
-
-    return VINF_SUCCESS;
 }
 
-
-
 /**
- * Fetches overrides for a CPUID leaf.
+ * Terminates the CPUM.
+ *
+ * Termination means cleaning up and freeing all resources,
+ * the VM it self is at this point powered off or suspended.
  *
  * @returns VBox status code.
- * @param   pLeaf               The leaf to load the overrides into.
- * @param   pCfgNode            The CFGM node containing the overrides
- *                              (/CPUM/HostCPUID/ or /CPUM/CPUID/).
- * @param   iLeaf               The CPUID leaf number.
+ * @param   pVM         Pointer to the VM.
  */
-static int cpumR3CpuIdFetchLeafOverride(PCPUMCPUID pLeaf, PCFGMNODE pCfgNode, uint32_t iLeaf)
+VMMR3DECL(int) CPUMR3Term(PVM pVM)
 {
-    PCFGMNODE pLeafNode = CFGMR3GetChildF(pCfgNode, "%RX32", iLeaf);
-    if (pLeafNode)
+#ifdef VBOX_WITH_CRASHDUMP_MAGIC
+    for (VMCPUID i = 0; i < pVM->cCpus; i++)
     {
-        uint32_t u32;
-        int rc = CFGMR3QueryU32(pLeafNode, "eax", &u32);
-        if (RT_SUCCESS(rc))
-            pLeaf->eax = u32;
-        else
-            AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
-
-        rc = CFGMR3QueryU32(pLeafNode, "ebx", &u32);
-        if (RT_SUCCESS(rc))
-            pLeaf->ebx = u32;
-        else
-            AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
-
-        rc = CFGMR3QueryU32(pLeafNode, "ecx", &u32);
-        if (RT_SUCCESS(rc))
-            pLeaf->ecx = u32;
-        else
-            AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
-
-        rc = CFGMR3QueryU32(pLeafNode, "edx", &u32);
-        if (RT_SUCCESS(rc))
-            pLeaf->edx = u32;
-        else
-            AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
+        PVMCPU   pVCpu = &pVM->aCpus[i];
+        PCPUMCTX pCtx  = CPUMQueryGuestCtxPtr(pVCpu);
 
+        memset(pVCpu->cpum.s.aMagic, 0, sizeof(pVCpu->cpum.s.aMagic));
+        pVCpu->cpum.s.uMagic     = 0;
+        pCtx->dr[5]              = 0;
     }
+#else
+    NOREF(pVM);
+#endif
     return VINF_SUCCESS;
 }
 
 
 /**
- * Load the overrides for a set of CPUID leaves.
+ * Resets a virtual CPU.
  *
- * @returns VBox status code.
- * @param   paLeaves            The leaf array.
- * @param   cLeaves             The number of leaves.
- * @param   uStart              The start leaf number.
- * @param   pCfgNode            The CFGM node containing the overrides
- *                              (/CPUM/HostCPUID/ or /CPUM/CPUID/).
- */
-static int cpumR3CpuIdInitLoadOverrideSet(uint32_t uStart, PCPUMCPUID paLeaves, uint32_t cLeaves, PCFGMNODE pCfgNode)
-{
-    for (uint32_t i = 0; i < cLeaves; i++)
-    {
-        int rc = cpumR3CpuIdFetchLeafOverride(&paLeaves[i], pCfgNode, uStart + i);
-        if (RT_FAILURE(rc))
-            return rc;
-    }
-
-    return VINF_SUCCESS;
-}
-
-/**
- * Init a set of host CPUID leaves.
+ * Used by CPUMR3Reset and CPU hot plugging.
  *
- * @returns VBox status code.
- * @param   paLeaves            The leaf array.
- * @param   cLeaves             The number of leaves.
- * @param   uStart              The start leaf number.
- * @param   pCfgNode            The /CPUM/HostCPUID/ node.
+ * @param   pVM         Pointer to the cross context VM structure.
+ * @param   pVCpu       Pointer to the cross context virtual CPU structure of
+ *                      the CPU that is being reset.  This may differ from the
+ *                      current EMT.
  */
-static int cpumR3CpuIdInitHostSet(uint32_t uStart, PCPUMCPUID paLeaves, uint32_t cLeaves, PCFGMNODE pCfgNode)
+VMMR3DECL(void) CPUMR3ResetCpu(PVM pVM, PVMCPU pVCpu)
 {
-    /* Using the ECX variant for all of them can't hurt... */
-    for (uint32_t i = 0; i < cLeaves; i++)
-        ASMCpuIdExSlow(uStart + i, 0, 0, 0, &paLeaves[i].eax, &paLeaves[i].ebx, &paLeaves[i].ecx, &paLeaves[i].edx);
-
-    /* Load CPUID leaf override; we currently don't care if the user
-       specifies features the host CPU doesn't support. */
-    return cpumR3CpuIdInitLoadOverrideSet(uStart, paLeaves, cLeaves, pCfgNode);
-}
-
+    /** @todo anything different for VCPU > 0? */
+    PCPUMCTX pCtx = &pVCpu->cpum.s.Guest;
 
-static int cpumR3CpuIdInstallAndExplodeLeaves(PVM pVM, PCPUM pCPUM, PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves)
-{
     /*
-     * Install the CPUID information.
+     * Initialize everything to ZERO first.
      */
-    int rc = MMHyperDupMem(pVM, paLeaves, sizeof(paLeaves[0]) * cLeaves, 32,
-                           MM_TAG_CPUM_CPUID, (void **)&pCPUM->GuestInfo.paCpuIdLeavesR3);
+    uint32_t fUseFlags              =  pVCpu->cpum.s.fUseFlags & ~CPUM_USED_FPU_SINCE_REM;
 
-    AssertLogRelRCReturn(rc, rc);
+    AssertCompile(RTASSERT_OFFSET_OF(CPUMCTX, pXStateR0) < RTASSERT_OFFSET_OF(CPUMCTX, pXStateR3));
+    AssertCompile(RTASSERT_OFFSET_OF(CPUMCTX, pXStateR0) < RTASSERT_OFFSET_OF(CPUMCTX, pXStateRC));
+    memset(pCtx, 0, RT_OFFSETOF(CPUMCTX, pXStateR0));
 
-    pCPUM->GuestInfo.paCpuIdLeavesR0 = MMHyperR3ToR0(pVM, pCPUM->GuestInfo.paCpuIdLeavesR3);
-    pCPUM->GuestInfo.paCpuIdLeavesRC = MMHyperR3ToRC(pVM, pCPUM->GuestInfo.paCpuIdLeavesR3);
-    Assert(MMHyperR0ToR3(pVM, pCPUM->GuestInfo.paCpuIdLeavesR0) == (void *)pCPUM->GuestInfo.paCpuIdLeavesR3);
-    Assert(MMHyperRCToR3(pVM, pCPUM->GuestInfo.paCpuIdLeavesRC) == (void *)pCPUM->GuestInfo.paCpuIdLeavesR3);
+    pVCpu->cpum.s.fUseFlags         = fUseFlags;
 
-    /*
-     * Explode the guest CPU features.
-     */
-    rc = cpumR3CpuIdExplodeFeatures(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, &pCPUM->GuestFeatures);
-    AssertLogRelRCReturn(rc, rc);
+    pCtx->cr0                       = X86_CR0_CD | X86_CR0_NW | X86_CR0_ET;  //0x60000010
+    pCtx->eip                       = 0x0000fff0;
+    pCtx->edx                       = 0x00000600;   /* P6 processor */
+    pCtx->eflags.Bits.u1Reserved0   = 1;
 
-    /*
-     * Adjust the scalable bus frequency according to the CPUID information
-     * we're now using.
-     */
-    if (CPUMMICROARCH_IS_INTEL_CORE7(pVM->cpum.s.GuestFeatures.enmMicroarch))
-        pCPUM->GuestInfo.uScalableBusFreq = pCPUM->GuestFeatures.enmMicroarch >= kCpumMicroarch_Intel_Core7_SandyBridge
-                                          ? UINT64_C(100000000)  /* 100MHz */
-                                          : UINT64_C(133333333); /* 133MHz */
+    pCtx->cs.Sel                    = 0xf000;
+    pCtx->cs.ValidSel               = 0xf000;
+    pCtx->cs.fFlags                 = CPUMSELREG_FLAGS_VALID;
+    pCtx->cs.u64Base                = UINT64_C(0xffff0000);
+    pCtx->cs.u32Limit               = 0x0000ffff;
+    pCtx->cs.Attr.n.u1DescType      = 1; /* code/data segment */
+    pCtx->cs.Attr.n.u1Present       = 1;
+    pCtx->cs.Attr.n.u4Type          = X86_SEL_TYPE_ER_ACC;
 
-    /*
-     * Populate the legacy arrays.  Currently used for everything, later only
-     * for patch manager.
-     */
-    struct { PCPUMCPUID paCpuIds; uint32_t cCpuIds, uBase; } aOldRanges[] =
-    {
-        { pCPUM->aGuestCpuIdStd,        RT_ELEMENTS(pCPUM->aGuestCpuIdStd),     0x00000000 },
-        { pCPUM->aGuestCpuIdExt,        RT_ELEMENTS(pCPUM->aGuestCpuIdExt),     0x80000000 },
-        { pCPUM->aGuestCpuIdCentaur,    RT_ELEMENTS(pCPUM->aGuestCpuIdCentaur), 0xc0000000 },
-        { pCPUM->aGuestCpuIdHyper,      RT_ELEMENTS(pCPUM->aGuestCpuIdHyper),   0x40000000 },
-    };
-    for (uint32_t i = 0; i < RT_ELEMENTS(aOldRanges); i++)
-    {
-        uint32_t    cLeft       = aOldRanges[i].cCpuIds;
-        uint32_t    uLeaf       = aOldRanges[i].uBase + cLeft;
-        PCPUMCPUID  pLegacyLeaf = &aOldRanges[i].paCpuIds[cLeft];
-        while (cLeft-- > 0)
-        {
-            uLeaf--;
-            pLegacyLeaf--;
+    pCtx->ds.fFlags                 = CPUMSELREG_FLAGS_VALID;
+    pCtx->ds.u32Limit               = 0x0000ffff;
+    pCtx->ds.Attr.n.u1DescType      = 1; /* code/data segment */
+    pCtx->ds.Attr.n.u1Present       = 1;
+    pCtx->ds.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
 
-            PCCPUMCPUIDLEAF pLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, uLeaf, 0);
-            if (pLeaf)
-            {
-                pLegacyLeaf->eax = pLeaf->uEax;
-                pLegacyLeaf->ebx = pLeaf->uEbx;
-                pLegacyLeaf->ecx = pLeaf->uEcx;
-                pLegacyLeaf->edx = pLeaf->uEdx;
-            }
-            else
-                *pLegacyLeaf = pCPUM->GuestInfo.DefCpuId;
-        }
-    }
+    pCtx->es.fFlags                 = CPUMSELREG_FLAGS_VALID;
+    pCtx->es.u32Limit               = 0x0000ffff;
+    pCtx->es.Attr.n.u1DescType      = 1; /* code/data segment */
+    pCtx->es.Attr.n.u1Present       = 1;
+    pCtx->es.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
 
-    pCPUM->GuestCpuIdDef = pCPUM->GuestInfo.DefCpuId;
+    pCtx->fs.fFlags                 = CPUMSELREG_FLAGS_VALID;
+    pCtx->fs.u32Limit               = 0x0000ffff;
+    pCtx->fs.Attr.n.u1DescType      = 1; /* code/data segment */
+    pCtx->fs.Attr.n.u1Present       = 1;
+    pCtx->fs.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
 
-    return VINF_SUCCESS;
-}
+    pCtx->gs.fFlags                 = CPUMSELREG_FLAGS_VALID;
+    pCtx->gs.u32Limit               = 0x0000ffff;
+    pCtx->gs.Attr.n.u1DescType      = 1; /* code/data segment */
+    pCtx->gs.Attr.n.u1Present       = 1;
+    pCtx->gs.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
 
-
-/**
- * Initializes the emulated CPU's cpuid information.
- *
- * @returns VBox status code.
- * @param   pVM          Pointer to the VM.
- */
-static int cpumR3CpuIdInit(PVM pVM)
-{
-    PCPUM       pCPUM    = &pVM->cpum.s;
-    PCFGMNODE   pCpumCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM");
-    int         rc;
-
-#define PORTABLE_CLEAR_BITS_WHEN(Lvl, a_pLeafReg, FeatNm, fMask, uValue) \
-    if ( pCPUM->u8PortableCpuIdLevel >= (Lvl) && ((a_pLeafReg) & (fMask)) == (uValue) ) \
-    { \
-        LogRel(("PortableCpuId: " #a_pLeafReg "[" #FeatNm "]: %#x -> 0\n", (a_pLeafReg) & (fMask))); \
-        (a_pLeafReg) &= ~(uint32_t)(fMask); \
-    }
-#define PORTABLE_DISABLE_FEATURE_BIT(Lvl, a_pLeafReg, FeatNm, fBitMask) \
-    if ( pCPUM->u8PortableCpuIdLevel >= (Lvl) && ((a_pLeafReg) & (fBitMask)) ) \
-    { \
-        LogRel(("PortableCpuId: " #a_pLeafReg "[" #FeatNm "]: 1 -> 0\n")); \
-        (a_pLeafReg) &= ~(uint32_t)(fBitMask); \
-    }
-
-    /*
-     * Read the configuration.
-     */
-    /** @cfgm{CPUM/SyntheticCpu, boolean, false}
-     * Enables the Synthetic CPU.  The Vendor ID and Processor Name are
-     * completely overridden by VirtualBox custom strings.  Some
-     * CPUID information is withheld, like the cache info.
-     *
-     * This is obsoleted by PortableCpuIdLevel. */
-    bool fSyntheticCpu;
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "SyntheticCpu",  &fSyntheticCpu, false);
-    AssertRCReturn(rc, rc);
-
-    /** @cfgm{CPUM/PortableCpuIdLevel, 8-bit, 0, 3, 0}
-     * When non-zero CPUID features that could cause portability issues will be
-     * stripped.  The higher the value the more features gets stripped.  Higher
-     * values should only be used when older CPUs are involved since it may
-     * harm performance and maybe also cause problems with specific guests. */
-    rc = CFGMR3QueryU8Def(pCpumCfg, "PortableCpuIdLevel", &pCPUM->u8PortableCpuIdLevel, fSyntheticCpu ? 1 : 0);
-    AssertLogRelRCReturn(rc, rc);
-
-    /** @cfgm{CPUM/GuestCpuName, string}
-     * The name of of the CPU we're to emulate.  The default is the host CPU.
-     * Note! CPUs other than "host" one is currently unsupported. */
-    char szCpuName[128];
-    rc = CFGMR3QueryStringDef(pCpumCfg, "GuestCpuName", szCpuName, sizeof(szCpuName), "host");
-    AssertLogRelRCReturn(rc, rc);
-
-    /** @cfgm{/CPUM/CMPXCHG16B, boolean, false}
-     * Expose CMPXCHG16B to the guest if supported by the host.
-     */
-    bool fCmpXchg16b;
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "CMPXCHG16B", &fCmpXchg16b, false);
-    AssertLogRelRCReturn(rc, rc);
-
-    /** @cfgm{/CPUM/MONITOR, boolean, true}
-     * Expose MONITOR/MWAIT instructions to the guest.
-     */
-    bool fMonitor;
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "MONITOR", &fMonitor, true);
-    AssertLogRelRCReturn(rc, rc);
-
-    /** @cfgm{/CPUM/MWaitExtensions, boolean, false}
-     * Expose MWAIT extended features to the guest.  For now we expose just MWAIT
-     * break on interrupt feature (bit 1).
-     */
-    bool fMWaitExtensions;
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "MWaitExtensions", &fMWaitExtensions, false);
-    AssertLogRelRCReturn(rc, rc);
-
-    /** @cfgm{/CPUM/SSE4.1, boolean, false}
-     * Expose SSE4.1 to the guest if available.
-     */
-    bool fSse41;
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "SSE4.1", &fSse41, false);
-    AssertLogRelRCReturn(rc, rc);
-
-    /** @cfgm{/CPUM/SSE4.2, boolean, false}
-     * Expose SSE4.2 to the guest if available.
-     */
-    bool fSse42;
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "SSE4.2", &fSse42, false);
-    AssertLogRelRCReturn(rc, rc);
-
-    /** @cfgm{/CPUM/NT4LeafLimit, boolean, false}
-     * Limit the number of standard CPUID leaves to 0..3 to prevent NT4 from
-     * bugchecking with MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED (0x3e).
-     * This option corresponds somewhat to IA32_MISC_ENABLES.BOOT_NT4[bit 22].
-     */
-    bool fNt4LeafLimit;
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "NT4LeafLimit", &fNt4LeafLimit, false);
-    AssertLogRelRCReturn(rc, rc);
-
-    /** @cfgm{/CPUM/MaxIntelFamilyModelStep, uint32_t, UINT32_MAX}
-     * Restrict the reported CPU family+model+stepping of intel CPUs.  This is
-     * probably going to be a temporary hack, so don't depend on this.
-     * The 1st byte of the value is the stepping, the 2nd byte value is the model
-     * number and the 3rd byte value is the family, and the 4th value must be zero.
-     */
-    uint32_t uMaxIntelFamilyModelStep;
-    rc = CFGMR3QueryU32Def(pCpumCfg, "MaxIntelFamilyModelStep", &uMaxIntelFamilyModelStep, UINT32_MAX);
-    AssertLogRelRCReturn(rc, rc);
-
-    /*
-     * Get the guest CPU data from the database and/or the host.
-     */
-    rc = cpumR3DbGetCpuInfo(szCpuName, &pCPUM->GuestInfo);
-    if (RT_FAILURE(rc))
-        return rc == VERR_CPUM_DB_CPU_NOT_FOUND
-             ? VMSetError(pVM, rc, RT_SRC_POS,
-                          "Info on guest CPU '%s' could not be found. Please, select a different CPU.", szCpuName)
-             : rc;
-
-    /** @cfgm{CPUM/MSRs/[Name]/[First|Last|Type|Value|...],}
-     * Overrides the guest MSRs.
-     */
-    rc = cpumR3LoadMsrOverrides(pVM, CFGMR3GetChild(pCpumCfg, "MSRs"));
-
-    /** @cfgm{CPUM/HostCPUID/[000000xx|800000xx|c000000x]/[eax|ebx|ecx|edx],32-bit}
-     * Overrides the CPUID leaf values (from the host CPU usually) used for
-     * calculating the guest CPUID leaves.  This can be used to preserve the CPUID
-     * values when moving a VM to a different machine.  Another use is restricting
-     * (or extending) the feature set exposed to the guest. */
-    if (RT_SUCCESS(rc))
-        rc = cpumR3LoadCpuIdOverrides(pVM, CFGMR3GetChild(pCpumCfg, "HostCPUID"), "HostCPUID");
-
-    if (RT_SUCCESS(rc) && CFGMR3GetChild(pCpumCfg, "CPUID")) /* 2nd override, now discontinued. */
-        rc = VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_NODE, RT_SRC_POS,
-                        "Found unsupported configuration node '/CPUM/CPUID/'. "
-                        "Please use IMachine::setCPUIDLeaf() instead.");
-
-    /*
-     * Pre-exploded the CPUID info.
-     */
-    if (RT_SUCCESS(rc))
-        rc = cpumR3CpuIdExplodeFeatures(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, &pCPUM->GuestFeatures);
-    if (RT_FAILURE(rc))
-    {
-        RTMemFree(pCPUM->GuestInfo.paCpuIdLeavesR3);
-        pCPUM->GuestInfo.paCpuIdLeavesR3 = NULL;
-        RTMemFree(pCPUM->GuestInfo.paMsrRangesR3);
-        pCPUM->GuestInfo.paMsrRangesR3 = NULL;
-        return rc;
-    }
-
-
-    /* ... split this function about here ... */
-
-
-    /* Cpuid 1:
-     * Only report features we can support.
-     *
-     * Note! When enabling new features the Synthetic CPU and Portable CPUID
-     *       options may require adjusting (i.e. stripping what was enabled).
-     */
-    PCPUMCPUIDLEAF pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves,
-                                                        1, 0); /* Note! Must refetch when used later. */
-    AssertLogRelReturn(pStdFeatureLeaf, VERR_CPUM_IPE_2);
-    pStdFeatureLeaf->uEdx        &= X86_CPUID_FEATURE_EDX_FPU
-                                  | X86_CPUID_FEATURE_EDX_VME
-                                  | X86_CPUID_FEATURE_EDX_DE
-                                  | X86_CPUID_FEATURE_EDX_PSE
-                                  | X86_CPUID_FEATURE_EDX_TSC
-                                  | X86_CPUID_FEATURE_EDX_MSR
-                                  //| X86_CPUID_FEATURE_EDX_PAE   - set later if configured.
-                                  | X86_CPUID_FEATURE_EDX_MCE
-                                  | X86_CPUID_FEATURE_EDX_CX8
-                                  //| X86_CPUID_FEATURE_EDX_APIC  - set by the APIC device if present.
-                                  /* Note! we don't report sysenter/sysexit support due to our inability to keep the IOPL part of eflags in sync while in ring 1 (see @bugref{1757}) */
-                                  //| X86_CPUID_FEATURE_EDX_SEP
-                                  | X86_CPUID_FEATURE_EDX_MTRR
-                                  | X86_CPUID_FEATURE_EDX_PGE
-                                  | X86_CPUID_FEATURE_EDX_MCA
-                                  | X86_CPUID_FEATURE_EDX_CMOV
-                                  | X86_CPUID_FEATURE_EDX_PAT
-                                  | X86_CPUID_FEATURE_EDX_PSE36
-                                  //| X86_CPUID_FEATURE_EDX_PSN   - no serial number.
-                                  | X86_CPUID_FEATURE_EDX_CLFSH
-                                  //| X86_CPUID_FEATURE_EDX_DS    - no debug store.
-                                  //| X86_CPUID_FEATURE_EDX_ACPI  - not virtualized yet.
-                                  | X86_CPUID_FEATURE_EDX_MMX
-                                  | X86_CPUID_FEATURE_EDX_FXSR
-                                  | X86_CPUID_FEATURE_EDX_SSE
-                                  | X86_CPUID_FEATURE_EDX_SSE2
-                                  //| X86_CPUID_FEATURE_EDX_SS    - no self snoop.
-                                  //| X86_CPUID_FEATURE_EDX_HTT   - no hyperthreading.
-                                  //| X86_CPUID_FEATURE_EDX_TM    - no thermal monitor.
-                                  //| X86_CPUID_FEATURE_EDX_PBE   - no pending break enabled.
-                                  | 0;
-    pStdFeatureLeaf->uEcx        &= 0
-                                  | X86_CPUID_FEATURE_ECX_SSE3
-                                  /* Can't properly emulate monitor & mwait with guest SMP; force the guest to use hlt for idling VCPUs. */
-                                  | ((fMonitor && pVM->cCpus == 1) ? X86_CPUID_FEATURE_ECX_MONITOR : 0)
-                                  //| X86_CPUID_FEATURE_ECX_CPLDS - no CPL qualified debug store.
-                                  //| X86_CPUID_FEATURE_ECX_VMX   - not virtualized.
-                                  //| X86_CPUID_FEATURE_ECX_EST   - no extended speed step.
-                                  //| X86_CPUID_FEATURE_ECX_TM2   - no thermal monitor 2.
-                                    | X86_CPUID_FEATURE_ECX_SSSE3
-                                  //| X86_CPUID_FEATURE_ECX_CNTXID - no L1 context id (MSR++).
-                                    | (fCmpXchg16b ? X86_CPUID_FEATURE_ECX_CX16 : 0)
-                                  /* ECX Bit 14 - xTPR Update Control. Processor supports changing IA32_MISC_ENABLES[bit 23]. */
-                                  //| X86_CPUID_FEATURE_ECX_TPRUPDATE
-                                  | (fSse41 ? X86_CPUID_FEATURE_ECX_SSE4_1 : 0)
-                                  | (fSse42 ? X86_CPUID_FEATURE_ECX_SSE4_2 : 0)
-                                  /* ECX Bit 21 - x2APIC support - not yet. */
-                                  // | X86_CPUID_FEATURE_ECX_X2APIC
-                                  /* ECX Bit 23 - POPCNT instruction. */
-                                  //| X86_CPUID_FEATURE_ECX_POPCNT
-                                  | 0;
-    if (pCPUM->u8PortableCpuIdLevel > 0)
-    {
-        PORTABLE_CLEAR_BITS_WHEN(1, pStdFeatureLeaf->uEax, ProcessorType, (UINT32_C(3) << 12), (UINT32_C(2) << 12));
-        PORTABLE_DISABLE_FEATURE_BIT(1, pStdFeatureLeaf->uEcx, SSSE3, X86_CPUID_FEATURE_ECX_SSSE3);
-        PORTABLE_DISABLE_FEATURE_BIT(1, pStdFeatureLeaf->uEcx, SSE3,  X86_CPUID_FEATURE_ECX_SSE3);
-        PORTABLE_DISABLE_FEATURE_BIT(1, pStdFeatureLeaf->uEcx, SSE4_1, X86_CPUID_FEATURE_ECX_SSE4_1);
-        PORTABLE_DISABLE_FEATURE_BIT(1, pStdFeatureLeaf->uEcx, SSE4_2, X86_CPUID_FEATURE_ECX_SSE4_2);
-        PORTABLE_DISABLE_FEATURE_BIT(1, pStdFeatureLeaf->uEcx, CX16,  X86_CPUID_FEATURE_ECX_CX16);
-        PORTABLE_DISABLE_FEATURE_BIT(2, pStdFeatureLeaf->uEdx, SSE2,  X86_CPUID_FEATURE_EDX_SSE2);
-        PORTABLE_DISABLE_FEATURE_BIT(3, pStdFeatureLeaf->uEdx, SSE,   X86_CPUID_FEATURE_EDX_SSE);
-        PORTABLE_DISABLE_FEATURE_BIT(3, pStdFeatureLeaf->uEdx, CLFSH, X86_CPUID_FEATURE_EDX_CLFSH);
-        PORTABLE_DISABLE_FEATURE_BIT(3, pStdFeatureLeaf->uEdx, CMOV,  X86_CPUID_FEATURE_EDX_CMOV);
-
-        Assert(!(pStdFeatureLeaf->uEdx        & (  X86_CPUID_FEATURE_EDX_SEP
-                                                 | X86_CPUID_FEATURE_EDX_PSN
-                                                 | X86_CPUID_FEATURE_EDX_DS
-                                                 | X86_CPUID_FEATURE_EDX_ACPI
-                                                 | X86_CPUID_FEATURE_EDX_SS
-                                                 | X86_CPUID_FEATURE_EDX_TM
-                                                 | X86_CPUID_FEATURE_EDX_PBE
-                                                 )));
-        Assert(!(pStdFeatureLeaf->uEcx        & (  X86_CPUID_FEATURE_ECX_PCLMUL
-                                                 | X86_CPUID_FEATURE_ECX_DTES64
-                                                 | X86_CPUID_FEATURE_ECX_CPLDS
-                                                 | X86_CPUID_FEATURE_ECX_VMX
-                                                 | X86_CPUID_FEATURE_ECX_SMX
-                                                 | X86_CPUID_FEATURE_ECX_EST
-                                                 | X86_CPUID_FEATURE_ECX_TM2
-                                                 | X86_CPUID_FEATURE_ECX_CNTXID
-                                                 | X86_CPUID_FEATURE_ECX_FMA
-                                                 | X86_CPUID_FEATURE_ECX_CX16
-                                                 | X86_CPUID_FEATURE_ECX_TPRUPDATE
-                                                 | X86_CPUID_FEATURE_ECX_PDCM
-                                                 | X86_CPUID_FEATURE_ECX_DCA
-                                                 | X86_CPUID_FEATURE_ECX_MOVBE
-                                                 | X86_CPUID_FEATURE_ECX_AES
-                                                 | X86_CPUID_FEATURE_ECX_POPCNT
-                                                 | X86_CPUID_FEATURE_ECX_XSAVE
-                                                 | X86_CPUID_FEATURE_ECX_OSXSAVE
-                                                 | X86_CPUID_FEATURE_ECX_AVX
-                                                 )));
-    }
-
-    /* Cpuid 0x80000001:
-     * Only report features we can support.
-     *
-     * Note! When enabling new features the Synthetic CPU and Portable CPUID
-     *       options may require adjusting (i.e. stripping what was enabled).
-     *
-     * ASSUMES that this is ALWAYS the AMD defined feature set if present.
-     */
-    PCPUMCPUIDLEAF pExtFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves,
-                                                        UINT32_C(0x80000001), 0); /* Note! Must refetch when used later. */
-    if (pExtFeatureLeaf)
-    {
-        pExtFeatureLeaf->uEdx    &= X86_CPUID_AMD_FEATURE_EDX_FPU
-                                  | X86_CPUID_AMD_FEATURE_EDX_VME
-                                  | X86_CPUID_AMD_FEATURE_EDX_DE
-                                  | X86_CPUID_AMD_FEATURE_EDX_PSE
-                                  | X86_CPUID_AMD_FEATURE_EDX_TSC
-                                  | X86_CPUID_AMD_FEATURE_EDX_MSR //?? this means AMD MSRs..
-                                  //| X86_CPUID_AMD_FEATURE_EDX_PAE    - not implemented yet.
-                                  //| X86_CPUID_AMD_FEATURE_EDX_MCE    - not virtualized yet.
-                                  | X86_CPUID_AMD_FEATURE_EDX_CX8
-                                  //| X86_CPUID_AMD_FEATURE_EDX_APIC   - set by the APIC device if present.
-                                  /* Note! we don't report sysenter/sysexit support due to our inability to keep the IOPL part of eflags in sync while in ring 1 (see @bugref{1757}) */
-                                  //| X86_CPUID_EXT_FEATURE_EDX_SEP
-                                  | X86_CPUID_AMD_FEATURE_EDX_MTRR
-                                  | X86_CPUID_AMD_FEATURE_EDX_PGE
-                                  | X86_CPUID_AMD_FEATURE_EDX_MCA
-                                  | X86_CPUID_AMD_FEATURE_EDX_CMOV
-                                  | X86_CPUID_AMD_FEATURE_EDX_PAT
-                                  | X86_CPUID_AMD_FEATURE_EDX_PSE36
-                                  //| X86_CPUID_EXT_FEATURE_EDX_NX     - not virtualized, requires PAE.
-                                  //| X86_CPUID_AMD_FEATURE_EDX_AXMMX
-                                  | X86_CPUID_AMD_FEATURE_EDX_MMX
-                                  | X86_CPUID_AMD_FEATURE_EDX_FXSR
-                                  | X86_CPUID_AMD_FEATURE_EDX_FFXSR
-                                  //| X86_CPUID_EXT_FEATURE_EDX_PAGE1GB
-                                  | X86_CPUID_EXT_FEATURE_EDX_RDTSCP
-                                  //| X86_CPUID_EXT_FEATURE_EDX_LONG_MODE - turned on when necessary
-                                  | X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX
-                                  | X86_CPUID_AMD_FEATURE_EDX_3DNOW
-                                  | 0;
-        pExtFeatureLeaf->uEcx    &= 0
-                                  //| X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF
-                                  //| X86_CPUID_AMD_FEATURE_ECX_CMPL
-                                  //| X86_CPUID_AMD_FEATURE_ECX_SVM    - not virtualized.
-                                  //| X86_CPUID_AMD_FEATURE_ECX_EXT_APIC
-                                  /* Note: This could prevent teleporting from AMD to Intel CPUs! */
-                                  | X86_CPUID_AMD_FEATURE_ECX_CR8L         /* expose lock mov cr0 = mov cr8 hack for guests that can use this feature to access the TPR. */
-                                  //| X86_CPUID_AMD_FEATURE_ECX_ABM
-                                  //| X86_CPUID_AMD_FEATURE_ECX_SSE4A
-                                  //| X86_CPUID_AMD_FEATURE_ECX_MISALNSSE
-                                  //| X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF
-                                  //| X86_CPUID_AMD_FEATURE_ECX_OSVW
-                                  //| X86_CPUID_AMD_FEATURE_ECX_IBS
-                                  //| X86_CPUID_AMD_FEATURE_ECX_SSE5
-                                  //| X86_CPUID_AMD_FEATURE_ECX_SKINIT
-                                  //| X86_CPUID_AMD_FEATURE_ECX_WDT
-                                  | 0;
-        if (pCPUM->u8PortableCpuIdLevel > 0)
-        {
-            PORTABLE_DISABLE_FEATURE_BIT(1, pExtFeatureLeaf->uEcx, CR8L,       X86_CPUID_AMD_FEATURE_ECX_CR8L);
-            PORTABLE_DISABLE_FEATURE_BIT(1, pExtFeatureLeaf->uEdx, 3DNOW,      X86_CPUID_AMD_FEATURE_EDX_3DNOW);
-            PORTABLE_DISABLE_FEATURE_BIT(1, pExtFeatureLeaf->uEdx, 3DNOW_EX,   X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX);
-            PORTABLE_DISABLE_FEATURE_BIT(1, pExtFeatureLeaf->uEdx, FFXSR,      X86_CPUID_AMD_FEATURE_EDX_FFXSR);
-            PORTABLE_DISABLE_FEATURE_BIT(1, pExtFeatureLeaf->uEdx, RDTSCP,     X86_CPUID_EXT_FEATURE_EDX_RDTSCP);
-            PORTABLE_DISABLE_FEATURE_BIT(2, pExtFeatureLeaf->uEcx, LAHF_SAHF,  X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF);
-            PORTABLE_DISABLE_FEATURE_BIT(3, pExtFeatureLeaf->uEcx, CMOV,       X86_CPUID_AMD_FEATURE_EDX_CMOV);
-
-            Assert(!(pExtFeatureLeaf->uEcx & (  X86_CPUID_AMD_FEATURE_ECX_CMPL
-                                              | X86_CPUID_AMD_FEATURE_ECX_SVM
-                                              | X86_CPUID_AMD_FEATURE_ECX_EXT_APIC
-                                              | X86_CPUID_AMD_FEATURE_ECX_CR8L
-                                              | X86_CPUID_AMD_FEATURE_ECX_ABM
-                                              | X86_CPUID_AMD_FEATURE_ECX_SSE4A
-                                              | X86_CPUID_AMD_FEATURE_ECX_MISALNSSE
-                                              | X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF
-                                              | X86_CPUID_AMD_FEATURE_ECX_OSVW
-                                              | X86_CPUID_AMD_FEATURE_ECX_IBS
-                                              | X86_CPUID_AMD_FEATURE_ECX_SSE5
-                                              | X86_CPUID_AMD_FEATURE_ECX_SKINIT
-                                              | X86_CPUID_AMD_FEATURE_ECX_WDT
-                                              | UINT32_C(0xffffc000)
-                                              )));
-            Assert(!(pExtFeatureLeaf->uEdx & (  RT_BIT(10)
-                                              | X86_CPUID_EXT_FEATURE_EDX_SYSCALL
-                                              | RT_BIT(18)
-                                              | RT_BIT(19)
-                                              | RT_BIT(21)
-                                              | X86_CPUID_AMD_FEATURE_EDX_AXMMX
-                                              | X86_CPUID_EXT_FEATURE_EDX_PAGE1GB
-                                              | RT_BIT(28)
-                                              )));
-        }
-    }
-
-    /*
-     * Hide HTT, multicode, SMP, whatever.
-     * (APIC-ID := 0 and #LogCpus := 0)
-     */
-    pStdFeatureLeaf->uEbx &= 0x0000ffff;
-#ifdef VBOX_WITH_MULTI_CORE
-    if (pVM->cCpus > 1)
-    {
-        /* If CPUID Fn0000_0001_EDX[HTT] = 1 then LogicalProcessorCount is the number of threads per CPU core times the number of CPU cores per processor */
-        pStdFeatureLeaf->uEbx |= (pVM->cCpus << 16);
-        pStdFeatureLeaf->uEdx |= X86_CPUID_FEATURE_EDX_HTT;  /* necessary for hyper-threading *or* multi-core CPUs */
-    }
-#endif
-
-    /* Cpuid 2:
-     * Intel: Cache and TLB information
-     * AMD:   Reserved
-     * VIA:   Reserved
-     * Safe to expose; restrict the number of calls to 1 for the portable case.
-     */
-    PCPUMCPUIDLEAF pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 2, 0);
-    if (   pCPUM->u8PortableCpuIdLevel > 0
-        && pCurLeaf
-        && (pCurLeaf->uEax & 0xff) > 1)
-    {
-        LogRel(("PortableCpuId: Std[2].al: %d -> 1\n", pCurLeaf->uEax & 0xff));
-        pCurLeaf->uEax &= UINT32_C(0xfffffffe);
-    }
-
-    /* Cpuid 3:
-     * Intel: EAX, EBX - reserved (transmeta uses these)
-     *        ECX, EDX - Processor Serial Number if available, otherwise reserved
-     * AMD:   Reserved
-     * VIA:   Reserved
-     * Safe to expose
-     */
-    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 3, 0);
-    pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 1, 0);
-    if (   !(pStdFeatureLeaf->uEdx & X86_CPUID_FEATURE_EDX_PSN)
-        && pCurLeaf)
-    {
-        pCurLeaf->uEcx = pCurLeaf->uEdx = 0;
-        if (pCPUM->u8PortableCpuIdLevel > 0)
-            pCurLeaf->uEax = pCurLeaf->uEbx = 0;
-    }
-
-    /* Cpuid 4:
-     * Intel: Deterministic Cache Parameters Leaf
-     *        Note: Depends on the ECX input! -> Feeling rather lazy now, so we just return 0
-     * AMD:   Reserved
-     * VIA:   Reserved
-     * Safe to expose, except for EAX:
-     *      Bits 25-14: Maximum number of addressable IDs for logical processors sharing this cache (see note)**
-     *      Bits 31-26: Maximum number of processor cores in this physical package**
-     * Note: These SMP values are constant regardless of ECX
-     */
-    CPUMCPUIDLEAF NewLeaf;
-    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 4, 0);
-    if (pCurLeaf)
-    {
-        NewLeaf.uLeaf        = 4;
-        NewLeaf.uSubLeaf     = 0;
-        NewLeaf.fSubLeafMask = 0;
-        NewLeaf.uEax         = 0;
-        NewLeaf.uEbx         = 0;
-        NewLeaf.uEcx         = 0;
-        NewLeaf.uEdx         = 0;
-        NewLeaf.fFlags       = 0;
-#ifdef VBOX_WITH_MULTI_CORE
-        if (   pVM->cCpus > 1
-            && pCPUM->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_INTEL)
-        {
-            AssertReturn(pVM->cCpus <= 64, VERR_TOO_MANY_CPUS);
-            /* One logical processor with possibly multiple cores. */
-            /* See  http://www.intel.com/Assets/PDF/appnote/241618.pdf p. 29 */
-            NewLeaf.uEax |= ((pVM->cCpus - 1) << 26);   /* 6 bits only -> 64 cores! */
-        }
-#endif
-        rc = cpumR3CpuIdInsert(&pCPUM->GuestInfo.paCpuIdLeavesR3, &pCPUM->GuestInfo.cCpuIdLeaves, &NewLeaf);
-        AssertLogRelRCReturn(rc, rc);
-    }
-
-    /* Cpuid 5:     Monitor/mwait Leaf
-     * Intel: ECX, EDX - reserved
-     *        EAX, EBX - Smallest and largest monitor line size
-     * AMD:   EDX - reserved
-     *        EAX, EBX - Smallest and largest monitor line size
-     *        ECX - extensions (ignored for now)
-     * VIA:   Reserved
-     * Safe to expose
-     */
-    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 5, 0);
-    if (pCurLeaf)
-    {
-        pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 1, 0);
-        if (!(pStdFeatureLeaf->uEcx & X86_CPUID_FEATURE_ECX_MONITOR))
-            pCurLeaf->uEax = pCurLeaf->uEbx = 0;
-
-        pCurLeaf->uEcx = pCurLeaf->uEdx = 0;
-        if (fMWaitExtensions)
-        {
-            pCurLeaf->uEcx = X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0;
-            /** @todo: for now we just expose host's MWAIT C-states, although conceptually
-               it shall be part of our power management virtualization model */
-#if 0
-            /* MWAIT sub C-states */
-            pCurLeaf->uEdx =
-                    (0 << 0)  /* 0 in C0 */ |
-                    (2 << 4)  /* 2 in C1 */ |
-                    (2 << 8)  /* 2 in C2 */ |
-                    (2 << 12) /* 2 in C3 */ |
-                    (0 << 16) /* 0 in C4 */
-                    ;
-#endif
-        }
-        else
-            pCurLeaf->uEcx = pCurLeaf->uEdx = 0;
-    }
-
-    /* Cpuid 0x800000005 & 0x800000006 contain information about L1, L2 & L3 cache and TLB identifiers.
-     * Safe to pass on to the guest.
-     *
-     * Intel: 0x800000005 reserved
-     *        0x800000006 L2 cache information
-     * AMD:   0x800000005 L1 cache information
-     *        0x800000006 L2/L3 cache information
-     * VIA:   0x800000005 TLB and L1 cache information
-     *        0x800000006 L2 cache information
-     */
-
-    /* Cpuid 0x800000007:
-     * Intel:             Reserved
-     * AMD:               EAX, EBX, ECX - reserved
-     *                    EDX: Advanced Power Management Information
-     * VIA:               Reserved
-     */
-    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, UINT32_C(0x80000007), 0);
-    if (pCurLeaf)
-    {
-        Assert(pCPUM->GuestFeatures.enmCpuVendor != CPUMCPUVENDOR_INVALID);
-
-        pCurLeaf->uEax = pCurLeaf->uEbx = pCurLeaf->uEcx = 0;
-
-        if (pCPUM->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
-        {
-            /* Only expose the TSC invariant capability bit to the guest. */
-            pCurLeaf->uEdx                  &= 0
-                                            //| X86_CPUID_AMD_ADVPOWER_EDX_TS
-                                            //| X86_CPUID_AMD_ADVPOWER_EDX_FID
-                                            //| X86_CPUID_AMD_ADVPOWER_EDX_VID
-                                            //| X86_CPUID_AMD_ADVPOWER_EDX_TTP
-                                            //| X86_CPUID_AMD_ADVPOWER_EDX_TM
-                                            //| X86_CPUID_AMD_ADVPOWER_EDX_STC
-                                            //| X86_CPUID_AMD_ADVPOWER_EDX_MC
-                                            //| X86_CPUID_AMD_ADVPOWER_EDX_HWPSTATE
-#if 0
-        /*
-         * We don't expose X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR, because newer
-         * Linux kernels blindly assume that the AMD performance counters work
-         * if this is set for 64 bits guests. (Can't really find a CPUID feature
-         * bit for them though.)
-         */
-                                            | X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR
-#endif
-                                            | 0;
-        }
-        else
-            pCurLeaf->uEdx = 0;
-    }
-
-    /* Cpuid 0x800000008:
-     * Intel:             EAX: Virtual/Physical address Size
-     *                    EBX, ECX, EDX - reserved
-     * AMD:               EBX, EDX - reserved
-     *                    EAX: Virtual/Physical/Guest address Size
-     *                    ECX: Number of cores + APICIdCoreIdSize
-     * VIA:               EAX: Virtual/Physical address Size
-     *                    EBX, ECX, EDX - reserved
-     */
-    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, UINT32_C(0x80000008), 0);
-    if (pCurLeaf)
-    {
-        /* Only expose the virtual and physical address sizes to the guest. */
-        pCurLeaf->uEax &= UINT32_C(0x0000ffff);
-        pCurLeaf->uEbx = pCurLeaf->uEdx = 0;  /* reserved */
-        /* Set APICIdCoreIdSize to zero (use legacy method to determine the number of cores per cpu)
-         * NC (0-7) Number of cores; 0 equals 1 core */
-        pCurLeaf->uEcx = 0;
-#ifdef VBOX_WITH_MULTI_CORE
-        if (    pVM->cCpus > 1
-            &&  pCPUM->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
-        {
-            /* Legacy method to determine the number of cores. */
-            pCurLeaf->uEcx |= (pVM->cCpus - 1); /* NC: Number of CPU cores - 1; 8 bits */
-            pExtFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves,
-                                                 UINT32_C(0x80000001), 0);
-            if (pExtFeatureLeaf)
-                pExtFeatureLeaf->uEcx |= X86_CPUID_AMD_FEATURE_ECX_CMPL;
-        }
-#endif
-    }
-
-
-    /*
-     * Limit it the number of entries, zapping the remainder.
-     *
-     * The limits are masking off stuff about power saving and similar, this
-     * is perhaps a bit crudely done as there is probably some relatively harmless
-     * info too in these leaves (like words about having a constant TSC).
-     */
-    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 0, 0);
-    if (pCurLeaf)
-    {
-        if (pCurLeaf->uEax > 5)
-        {
-            pCurLeaf->uEax = 5;
-            cpumR3CpuIdRemoveRange(pCPUM->GuestInfo.paCpuIdLeavesR3, &pCPUM->GuestInfo.cCpuIdLeaves,
-                                   pCurLeaf->uEax + 1, UINT32_C(0x000fffff));
-        }
-
-        /* NT4 hack, no zapping of extra leaves here. */
-        if (fNt4LeafLimit && pCurLeaf->uEax > 3)
-            pCurLeaf->uEax = 3;
-    }
-
-    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, UINT32_C(0x80000000), 0);
-    if (pCurLeaf)
-    {
-        if (pCurLeaf->uEax > UINT32_C(0x80000008))
-        {
-            pCurLeaf->uEax = UINT32_C(0x80000008);
-            cpumR3CpuIdRemoveRange(pCPUM->GuestInfo.paCpuIdLeavesR3, &pCPUM->GuestInfo.cCpuIdLeaves,
-                                   pCurLeaf->uEax + 1, UINT32_C(0x800fffff));
-        }
-    }
-
-    /*
-     * Centaur stuff (VIA).
-     *
-     * The important part here (we think) is to make sure the 0xc0000000
-     * function returns 0xc0000001. As for the features, we don't currently
-     * let on about any of those... 0xc0000002 seems to be some
-     * temperature/hz/++ stuff, include it as well (static).
-     */
-    pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, UINT32_C(0xc0000000), 0);
-    if (pCurLeaf)
-    {
-        if (   pCurLeaf->uEax >= UINT32_C(0xc0000000)
-            && pCurLeaf->uEax <= UINT32_C(0xc0000004))
-        {
-            pCurLeaf->uEax = RT_MIN(pCurLeaf->uEax, UINT32_C(0xc0000002));
-            cpumR3CpuIdRemoveRange(pCPUM->GuestInfo.paCpuIdLeavesR3, &pCPUM->GuestInfo.cCpuIdLeaves,
-                                   UINT32_C(0xc0000002), UINT32_C(0xc00fffff));
-
-            pCurLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves,
-                                          UINT32_C(0xc0000001), 0);
-            if (pCurLeaf)
-                pCurLeaf->uEdx = 0; /* all features hidden */
-        }
-        else
-            cpumR3CpuIdRemoveRange(pCPUM->GuestInfo.paCpuIdLeavesR3, &pCPUM->GuestInfo.cCpuIdLeaves,
-                                   UINT32_C(0xc0000000), UINT32_C(0xc00fffff));
-    }
-
-    /*
-     * Hypervisor identification.
-     *
-     * We only return minimal information, primarily ensuring that the
-     * 0x40000000 function returns 0x40000001 and identifying ourselves.
-     * Currently we do not support any hypervisor-specific interface.
-     */
-    NewLeaf.uLeaf        = UINT32_C(0x40000000);
-    NewLeaf.uSubLeaf     = 0;
-    NewLeaf.fSubLeafMask = 0;
-    NewLeaf.uEax         = UINT32_C(0x40000001);
-    NewLeaf.uEbx         = 0x786f4256 /* 'VBox' */;
-    NewLeaf.uEcx         = 0x786f4256 /* 'VBox' */;
-    NewLeaf.uEdx         = 0x786f4256 /* 'VBox' */;
-    NewLeaf.fFlags       = 0;
-    rc = cpumR3CpuIdInsert(&pCPUM->GuestInfo.paCpuIdLeavesR3, &pCPUM->GuestInfo.cCpuIdLeaves, &NewLeaf);
-    AssertLogRelRCReturn(rc, rc);
-
-    NewLeaf.uLeaf        = UINT32_C(0x40000001);
-    NewLeaf.uEax         = 0x656e6f6e;                            /* 'none' */
-    NewLeaf.uEbx         = 0;
-    NewLeaf.uEcx         = 0;
-    NewLeaf.uEdx         = 0;
-    NewLeaf.fFlags       = 0;
-    rc = cpumR3CpuIdInsert(&pCPUM->GuestInfo.paCpuIdLeavesR3, &pCPUM->GuestInfo.cCpuIdLeaves, &NewLeaf);
-    AssertLogRelRCReturn(rc, rc);
-
-    /*
-     * Mini CPU selection support for making Mac OS X happy.
-     */
-    if (pCPUM->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_INTEL)
-    {
-        pStdFeatureLeaf = cpumR3CpuIdGetLeaf(pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves, 1, 0);
-        uint32_t uCurIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(ASMGetCpuStepping(pStdFeatureLeaf->uEax),
-                                                                ASMGetCpuModelIntel(pStdFeatureLeaf->uEax),
-                                                                ASMGetCpuFamily(pStdFeatureLeaf->uEax),
-                                                                0);
-        if (uMaxIntelFamilyModelStep < uCurIntelFamilyModelStep)
-        {
-            uint32_t uNew = pStdFeatureLeaf->uEax & UINT32_C(0xf0003000);
-            uNew |= RT_BYTE1(uMaxIntelFamilyModelStep) & 0xf; /* stepping */
-            uNew |= (RT_BYTE2(uMaxIntelFamilyModelStep) & 0xf) << 4; /* 4 low model bits */
-            uNew |= (RT_BYTE2(uMaxIntelFamilyModelStep) >> 4) << 16; /* 4 high model bits */
-            uNew |= (RT_BYTE3(uMaxIntelFamilyModelStep) & 0xf) << 8; /* 4 low family bits */
-            if (RT_BYTE3(uMaxIntelFamilyModelStep) > 0xf) /* 8 high family bits, using intel's suggested calculation. */
-                uNew |= ( (RT_BYTE3(uMaxIntelFamilyModelStep) - (RT_BYTE3(uMaxIntelFamilyModelStep) & 0xf)) & 0xff ) << 20;
-            LogRel(("CPU: CPUID(0).EAX %#x -> %#x (uMaxIntelFamilyModelStep=%#x, uCurIntelFamilyModelStep=%#x\n",
-                    pStdFeatureLeaf->uEax, uNew, uMaxIntelFamilyModelStep, uCurIntelFamilyModelStep));
-            pStdFeatureLeaf->uEax = uNew;
-        }
-    }
-
-    /*
-     * MSR fudging.
-     */
-    /** @cfgm{CPUM/FudgeMSRs, boolean, true}
-     * Fudges some common MSRs if not present in the selected CPU database entry.
-     * This is for trying to keep VMs running when moved between different hosts
-     * and different CPU vendors. */
-    bool fEnable;
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "FudgeMSRs", &fEnable, true);       AssertRCReturn(rc, rc);
-    if (fEnable)
-    {
-        rc = cpumR3MsrApplyFudge(pVM);
-        AssertLogRelRCReturn(rc, rc);
-    }
-
-    /*
-     * Move the MSR and CPUID arrays over on the hypervisor heap, and explode
-     * guest CPU features again.
-     */
-    void *pvFree = pCPUM->GuestInfo.paCpuIdLeavesR3;
-    int rc1 = cpumR3CpuIdInstallAndExplodeLeaves(pVM, pCPUM, pCPUM->GuestInfo.paCpuIdLeavesR3, pCPUM->GuestInfo.cCpuIdLeaves);
-    RTMemFree(pvFree);
-
-    pvFree = pCPUM->GuestInfo.paMsrRangesR3;
-    int rc2 = MMHyperDupMem(pVM, pvFree,
-                            sizeof(pCPUM->GuestInfo.paMsrRangesR3[0]) * pCPUM->GuestInfo.cMsrRanges, 32,
-                            MM_TAG_CPUM_MSRS, (void **)&pCPUM->GuestInfo.paMsrRangesR3);
-    RTMemFree(pvFree);
-    AssertLogRelRCReturn(rc1, rc1);
-    AssertLogRelRCReturn(rc2, rc2);
-
-    pCPUM->GuestInfo.paMsrRangesR0 = MMHyperR3ToR0(pVM, pCPUM->GuestInfo.paMsrRangesR3);
-    pCPUM->GuestInfo.paMsrRangesRC = MMHyperR3ToRC(pVM, pCPUM->GuestInfo.paMsrRangesR3);
-    cpumR3MsrRegStats(pVM);
-
-    /*
-     * Some more configuration that we're applying at the end of everything
-     * via the CPUMSetGuestCpuIdFeature API.
-     */
-
-    /* Check if PAE was explicitely enabled by the user. */
-    rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnablePAE", &fEnable, false);      AssertRCReturn(rc, rc);
-    if (fEnable)
-        CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_PAE);
-
-    /* We don't normally enable NX for raw-mode, so give the user a chance to force it on. */
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "EnableNX", &fEnable, false);                 AssertRCReturn(rc, rc);
-    if (fEnable)
-        CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_NX);
-
-    /* We don't enable the Hypervisor Present bit by default, but it may be needed by some guests. */
-    rc = CFGMR3QueryBoolDef(pCpumCfg, "EnableHVP", &fEnable, false);                AssertRCReturn(rc, rc);
-    if (fEnable)
-        CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_HVP);
-
-#undef PORTABLE_DISABLE_FEATURE_BIT
-#undef PORTABLE_CLEAR_BITS_WHEN
-
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Applies relocations to data and code managed by this
- * component. This function will be called at init and
- * whenever the VMM need to relocate it self inside the GC.
- *
- * The CPUM will update the addresses used by the switcher.
- *
- * @param   pVM     The VM.
- */
-VMMR3DECL(void) CPUMR3Relocate(PVM pVM)
-{
-    LogFlow(("CPUMR3Relocate\n"));
-
-    pVM->cpum.s.GuestInfo.paMsrRangesRC   = MMHyperR3ToRC(pVM, pVM->cpum.s.GuestInfo.paMsrRangesR3);
-    pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = MMHyperR3ToRC(pVM, pVM->cpum.s.GuestInfo.paCpuIdLeavesR3);
-
-    /* Recheck the guest DRx values in raw-mode. */
-    for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
-        CPUMRecalcHyperDRx(&pVM->aCpus[iCpu], UINT8_MAX, false);
-}
-
-
-/**
- * Apply late CPUM property changes based on the fHWVirtEx setting
- *
- * @param   pVM                 Pointer to the VM.
- * @param   fHWVirtExEnabled    HWVirtEx enabled/disabled
- */
-VMMR3DECL(void) CPUMR3SetHWVirtEx(PVM pVM, bool fHWVirtExEnabled)
-{
-    /*
-     * Workaround for missing cpuid(0) patches when leaf 4 returns GuestCpuIdDef:
-     * If we miss to patch a cpuid(0).eax then Linux tries to determine the number
-     * of processors from (cpuid(4).eax >> 26) + 1.
-     *
-     * Note: this code is obsolete, but let's keep it here for reference.
-     *       Purpose is valid when we artificially cap the max std id to less than 4.
-     */
-    if (!fHWVirtExEnabled)
-    {
-        Assert(   pVM->cpum.s.aGuestCpuIdStd[4].eax == 0
-               || pVM->cpum.s.aGuestCpuIdStd[0].eax < 0x4);
-        pVM->cpum.s.aGuestCpuIdStd[4].eax = 0;
-    }
-}
-
-/**
- * Terminates the CPUM.
- *
- * Termination means cleaning up and freeing all resources,
- * the VM it self is at this point powered off or suspended.
- *
- * @returns VBox status code.
- * @param   pVM         Pointer to the VM.
- */
-VMMR3DECL(int) CPUMR3Term(PVM pVM)
-{
-#ifdef VBOX_WITH_CRASHDUMP_MAGIC
-    for (VMCPUID i = 0; i < pVM->cCpus; i++)
-    {
-        PVMCPU   pVCpu = &pVM->aCpus[i];
-        PCPUMCTX pCtx  = CPUMQueryGuestCtxPtr(pVCpu);
-
-        memset(pVCpu->cpum.s.aMagic, 0, sizeof(pVCpu->cpum.s.aMagic));
-        pVCpu->cpum.s.uMagic     = 0;
-        pCtx->dr[5]              = 0;
-    }
-#else
-    NOREF(pVM);
-#endif
-    return VINF_SUCCESS;
-}
-
-
-/**
- * Resets a virtual CPU.
- *
- * Used by CPUMR3Reset and CPU hot plugging.
- *
- * @param   pVM         Pointer to the cross context VM structure.
- * @param   pVCpu       Pointer to the cross context virtual CPU structure of
- *                      the CPU that is being reset.  This may differ from the
- *                      current EMT.
- */
-VMMR3DECL(void) CPUMR3ResetCpu(PVM pVM, PVMCPU pVCpu)
-{
-    /** @todo anything different for VCPU > 0? */
-    PCPUMCTX pCtx = &pVCpu->cpum.s.Guest;
-
-    /*
-     * Initialize everything to ZERO first.
-     */
-    uint32_t fUseFlags =  pVCpu->cpum.s.fUseFlags & ~CPUM_USED_FPU_SINCE_REM;
-    memset(pCtx, 0, sizeof(*pCtx));
-    pVCpu->cpum.s.fUseFlags  = fUseFlags;
-
-    pCtx->cr0                       = X86_CR0_CD | X86_CR0_NW | X86_CR0_ET;  //0x60000010
-    pCtx->eip                       = 0x0000fff0;
-    pCtx->edx                       = 0x00000600;   /* P6 processor */
-    pCtx->eflags.Bits.u1Reserved0   = 1;
-
-    pCtx->cs.Sel                    = 0xf000;
-    pCtx->cs.ValidSel               = 0xf000;
-    pCtx->cs.fFlags                 = CPUMSELREG_FLAGS_VALID;
-    pCtx->cs.u64Base                = UINT64_C(0xffff0000);
-    pCtx->cs.u32Limit               = 0x0000ffff;
-    pCtx->cs.Attr.n.u1DescType      = 1; /* code/data segment */
-    pCtx->cs.Attr.n.u1Present       = 1;
-    pCtx->cs.Attr.n.u4Type          = X86_SEL_TYPE_ER_ACC;
-
-    pCtx->ds.fFlags                 = CPUMSELREG_FLAGS_VALID;
-    pCtx->ds.u32Limit               = 0x0000ffff;
-    pCtx->ds.Attr.n.u1DescType      = 1; /* code/data segment */
-    pCtx->ds.Attr.n.u1Present       = 1;
-    pCtx->ds.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
-
-    pCtx->es.fFlags                 = CPUMSELREG_FLAGS_VALID;
-    pCtx->es.u32Limit               = 0x0000ffff;
-    pCtx->es.Attr.n.u1DescType      = 1; /* code/data segment */
-    pCtx->es.Attr.n.u1Present       = 1;
-    pCtx->es.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
-
-    pCtx->fs.fFlags                 = CPUMSELREG_FLAGS_VALID;
-    pCtx->fs.u32Limit               = 0x0000ffff;
-    pCtx->fs.Attr.n.u1DescType      = 1; /* code/data segment */
-    pCtx->fs.Attr.n.u1Present       = 1;
-    pCtx->fs.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
-
-    pCtx->gs.fFlags                 = CPUMSELREG_FLAGS_VALID;
-    pCtx->gs.u32Limit               = 0x0000ffff;
-    pCtx->gs.Attr.n.u1DescType      = 1; /* code/data segment */
-    pCtx->gs.Attr.n.u1Present       = 1;
-    pCtx->gs.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
-
-    pCtx->ss.fFlags                 = CPUMSELREG_FLAGS_VALID;
-    pCtx->ss.u32Limit               = 0x0000ffff;
-    pCtx->ss.Attr.n.u1Present       = 1;
-    pCtx->ss.Attr.n.u1DescType      = 1; /* code/data segment */
-    pCtx->ss.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
+    pCtx->ss.fFlags                 = CPUMSELREG_FLAGS_VALID;
+    pCtx->ss.u32Limit               = 0x0000ffff;
+    pCtx->ss.Attr.n.u1Present       = 1;
+    pCtx->ss.Attr.n.u1DescType      = 1; /* code/data segment */
+    pCtx->ss.Attr.n.u4Type          = X86_SEL_TYPE_RW_ACC;
 
     pCtx->idtr.cbIdt                = 0xffff;
     pCtx->gdtr.cbGdt                = 0xffff;
@@ -1924,14 +1019,22 @@ VMMR3DECL(void) CPUMR3ResetCpu(PVM pVM, PVMCPU pVCpu)
     pCtx->dr[6]                     = X86_DR6_INIT_VAL;
     pCtx->dr[7]                     = X86_DR7_INIT_VAL;
 
-    pCtx->fpu.FTW                   = 0x00;         /* All empty (abbridged tag reg edition). */
-    pCtx->fpu.FCW                   = 0x37f;
+    PX86FXSTATE pFpuCtx = &pCtx->pXStateR3->x87; AssertReleaseMsg(RT_VALID_PTR(pFpuCtx), ("%p\n", pFpuCtx));
+    pFpuCtx->FTW                    = 0x00;         /* All empty (abbridged tag reg edition). */
+    pFpuCtx->FCW                    = 0x37f;
 
     /* Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3A, Table 8-1.
        IA-32 Processor States Following Power-up, Reset, or INIT */
-    pCtx->fpu.MXCSR                 = 0x1F80;
-    pCtx->fpu.MXCSR_MASK            = 0xffff; /** @todo REM always changed this for us. Should probably check if the HW really
+    pFpuCtx->MXCSR                  = 0x1F80;
+    pFpuCtx->MXCSR_MASK             = 0xffff; /** @todo REM always changed this for us. Should probably check if the HW really
                                                         supports all bits, since a zero value here should be read as 0xffbf. */
+    pCtx->aXcr[0]                   = XSAVE_C_X87;
+    if (pVM->cpum.s.HostFeatures.cbMaxExtendedState >= RT_OFFSETOF(X86XSAVEAREA, Hdr))
+    {
+        /* The entire FXSAVE state needs loading when we switch to XSAVE/XRSTOR
+           as we don't know what happened before.  (Bother optimize later?) */
+        pCtx->pXStateR3->Hdr.bmXState = XSAVE_C_X87 | XSAVE_C_SSE;
+    }
 
     /*
      * MSRs.
@@ -2004,769 +1107,6 @@ VMMR3DECL(void) CPUMR3Reset(PVM pVM)
 }
 
 
-/**
- * Called both in pass 0 and the final pass.
- *
- * @param   pVM                 Pointer to the VM.
- * @param   pSSM                The saved state handle.
- */
-static void cpumR3SaveCpuId(PVM pVM, PSSMHANDLE pSSM)
-{
-    /*
-     * Save all the CPU ID leaves here so we can check them for compatibility
-     * upon loading.
-     */
-    SSMR3PutU32(pSSM, RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd));
-    SSMR3PutMem(pSSM, &pVM->cpum.s.aGuestCpuIdStd[0], sizeof(pVM->cpum.s.aGuestCpuIdStd));
-
-    SSMR3PutU32(pSSM, RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdExt));
-    SSMR3PutMem(pSSM, &pVM->cpum.s.aGuestCpuIdExt[0], sizeof(pVM->cpum.s.aGuestCpuIdExt));
-
-    SSMR3PutU32(pSSM, RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur));
-    SSMR3PutMem(pSSM, &pVM->cpum.s.aGuestCpuIdCentaur[0], sizeof(pVM->cpum.s.aGuestCpuIdCentaur));
-
-    SSMR3PutMem(pSSM, &pVM->cpum.s.GuestCpuIdDef, sizeof(pVM->cpum.s.GuestCpuIdDef));
-
-    /*
-     * Save a good portion of the raw CPU IDs as well as they may come in
-     * handy when validating features for raw mode.
-     */
-    CPUMCPUID   aRawStd[16];
-    for (unsigned i = 0; i < RT_ELEMENTS(aRawStd); i++)
-        ASMCpuIdExSlow(i, 0, 0, 0, &aRawStd[i].eax, &aRawStd[i].ebx, &aRawStd[i].ecx, &aRawStd[i].edx);
-    SSMR3PutU32(pSSM, RT_ELEMENTS(aRawStd));
-    SSMR3PutMem(pSSM, &aRawStd[0], sizeof(aRawStd));
-
-    CPUMCPUID   aRawExt[32];
-    for (unsigned i = 0; i < RT_ELEMENTS(aRawExt); i++)
-        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0, &aRawExt[i].eax, &aRawExt[i].ebx, &aRawExt[i].ecx, &aRawExt[i].edx);
-    SSMR3PutU32(pSSM, RT_ELEMENTS(aRawExt));
-    SSMR3PutMem(pSSM, &aRawExt[0], sizeof(aRawExt));
-}
-
-
-static int cpumR3LoadCpuIdOneGuestArray(PSSMHANDLE pSSM, uint32_t uBase, PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves)
-{
-    uint32_t cCpuIds;
-    int rc = SSMR3GetU32(pSSM, &cCpuIds);
-    if (RT_SUCCESS(rc))
-    {
-        if (cCpuIds < 64)
-        {
-            for (uint32_t i = 0; i < cCpuIds; i++)
-            {
-                CPUMCPUID CpuId;
-                rc = SSMR3GetMem(pSSM, &CpuId, sizeof(CpuId));
-                if (RT_FAILURE(rc))
-                    break;
-
-                CPUMCPUIDLEAF NewLeaf;
-                NewLeaf.uLeaf           = uBase + i;
-                NewLeaf.uSubLeaf        = 0;
-                NewLeaf.fSubLeafMask    = 0;
-                NewLeaf.uEax            = CpuId.eax;
-                NewLeaf.uEbx            = CpuId.ebx;
-                NewLeaf.uEcx            = CpuId.ecx;
-                NewLeaf.uEdx            = CpuId.edx;
-                NewLeaf.fFlags          = 0;
-                rc = cpumR3CpuIdInsert(ppaLeaves, pcLeaves, &NewLeaf);
-            }
-        }
-        else
-            rc = VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    }
-    if (RT_FAILURE(rc))
-    {
-        RTMemFree(*ppaLeaves);
-        *ppaLeaves = NULL;
-        *pcLeaves = 0;
-    }
-    return rc;
-}
-
-
-static int cpumR3LoadCpuIdGuestArrays(PSSMHANDLE pSSM, uint32_t uVersion, PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves)
-{
-    *ppaLeaves = NULL;
-    *pcLeaves = 0;
-
-    int rc = cpumR3LoadCpuIdOneGuestArray(pSSM, UINT32_C(0x00000000), ppaLeaves, pcLeaves);
-    if (RT_SUCCESS(rc))
-        rc = cpumR3LoadCpuIdOneGuestArray(pSSM, UINT32_C(0x80000000), ppaLeaves, pcLeaves);
-    if (RT_SUCCESS(rc))
-        rc = cpumR3LoadCpuIdOneGuestArray(pSSM, UINT32_C(0xc0000000), ppaLeaves, pcLeaves);
-
-    return rc;
-}
-
-
-/**
- * Loads the CPU ID leaves saved by pass 0.
- *
- * @returns VBox status code.
- * @param   pVM                 Pointer to the VM.
- * @param   pSSM                The saved state handle.
- * @param   uVersion            The format version.
- */
-static int cpumR3LoadCpuId(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion)
-{
-    AssertMsgReturn(uVersion >= CPUM_SAVED_STATE_VERSION_VER3_2, ("%u\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
-
-    /*
-     * Define a bunch of macros for simplifying the code.
-     */
-    /* Generic expression + failure message. */
-#define CPUID_CHECK_RET(expr, fmt) \
-    do { \
-        if (!(expr)) \
-        { \
-            char *pszMsg = RTStrAPrintf2 fmt; /* lack of variadic macros sucks */ \
-            if (fStrictCpuIdChecks) \
-            { \
-                int rcCpuid = SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, "%s", pszMsg); \
-                RTStrFree(pszMsg); \
-                return rcCpuid; \
-            } \
-            LogRel(("CPUM: %s\n", pszMsg)); \
-            RTStrFree(pszMsg); \
-        } \
-    } while (0)
-#define CPUID_CHECK_WRN(expr, fmt) \
-    do { \
-        if (!(expr)) \
-            LogRel(fmt); \
-    } while (0)
-
-    /* For comparing two values and bitch if they differs. */
-#define CPUID_CHECK2_RET(what, host, saved) \
-    do { \
-        if ((host) != (saved)) \
-        { \
-            if (fStrictCpuIdChecks) \
-                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
-                                         N_(#what " mismatch: host=%#x saved=%#x"), (host), (saved)); \
-            LogRel(("CPUM: " #what " differs: host=%#x saved=%#x\n", (host), (saved))); \
-        } \
-    } while (0)
-#define CPUID_CHECK2_WRN(what, host, saved) \
-    do { \
-        if ((host) != (saved)) \
-            LogRel(("CPUM: " #what " differs: host=%#x saved=%#x\n", (host), (saved))); \
-    } while (0)
-
-    /* For checking raw cpu features (raw mode). */
-#define CPUID_RAW_FEATURE_RET(set, reg, bit) \
-    do { \
-        if ((aHostRaw##set [1].reg & bit) != (aRaw##set [1].reg & bit)) \
-        { \
-            if (fStrictCpuIdChecks) \
-                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
-                                         N_(#bit " mismatch: host=%d saved=%d"), \
-                                         !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) ); \
-            LogRel(("CPUM: " #bit" differs: host=%d saved=%d\n", \
-                    !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) )); \
-        } \
-    } while (0)
-#define CPUID_RAW_FEATURE_WRN(set, reg, bit) \
-    do { \
-        if ((aHostRaw##set [1].reg & bit) != (aRaw##set [1].reg & bit)) \
-            LogRel(("CPUM: " #bit" differs: host=%d saved=%d\n", \
-                    !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) )); \
-    } while (0)
-#define CPUID_RAW_FEATURE_IGN(set, reg, bit) do { } while (0)
-
-    /* For checking guest features. */
-#define CPUID_GST_FEATURE_RET(set, reg, bit) \
-    do { \
-        if (    (aGuestCpuId##set [1].reg & bit) \
-            && !(aHostRaw##set [1].reg & bit) \
-            && !(aHostOverride##set [1].reg & bit) \
-           ) \
-        { \
-            if (fStrictCpuIdChecks) \
-                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
-                                         N_(#bit " is not supported by the host but has already exposed to the guest")); \
-            LogRel(("CPUM: " #bit " is not supported by the host but has already exposed to the guest\n")); \
-        } \
-    } while (0)
-#define CPUID_GST_FEATURE_WRN(set, reg, bit) \
-    do { \
-        if (    (aGuestCpuId##set [1].reg & bit) \
-            && !(aHostRaw##set [1].reg & bit) \
-            && !(aHostOverride##set [1].reg & bit) \
-           ) \
-            LogRel(("CPUM: " #bit " is not supported by the host but has already exposed to the guest\n")); \
-    } while (0)
-#define CPUID_GST_FEATURE_EMU(set, reg, bit) \
-    do { \
-        if (    (aGuestCpuId##set [1].reg & bit) \
-            && !(aHostRaw##set [1].reg & bit) \
-            && !(aHostOverride##set [1].reg & bit) \
-           ) \
-            LogRel(("CPUM: Warning - " #bit " is not supported by the host but already exposed to the guest. This may impact performance.\n")); \
-    } while (0)
-#define CPUID_GST_FEATURE_IGN(set, reg, bit) do { } while (0)
-
-    /* For checking guest features if AMD guest CPU. */
-#define CPUID_GST_AMD_FEATURE_RET(set, reg, bit) \
-    do { \
-        if (    (aGuestCpuId##set [1].reg & bit) \
-            &&  fGuestAmd \
-            && (!fGuestAmd || !(aHostRaw##set [1].reg & bit)) \
-            && !(aHostOverride##set [1].reg & bit) \
-           ) \
-        { \
-            if (fStrictCpuIdChecks) \
-                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
-                                         N_(#bit " is not supported by the host but has already exposed to the guest")); \
-            LogRel(("CPUM: " #bit " is not supported by the host but has already exposed to the guest\n")); \
-        } \
-    } while (0)
-#define CPUID_GST_AMD_FEATURE_WRN(set, reg, bit) \
-    do { \
-        if (    (aGuestCpuId##set [1].reg & bit) \
-            &&  fGuestAmd \
-            && (!fGuestAmd || !(aHostRaw##set [1].reg & bit)) \
-            && !(aHostOverride##set [1].reg & bit) \
-           ) \
-            LogRel(("CPUM: " #bit " is not supported by the host but has already exposed to the guest\n")); \
-    } while (0)
-#define CPUID_GST_AMD_FEATURE_EMU(set, reg, bit) \
-    do { \
-        if (    (aGuestCpuId##set [1].reg & bit) \
-            &&  fGuestAmd \
-            && (!fGuestAmd || !(aHostRaw##set [1].reg & bit)) \
-            && !(aHostOverride##set [1].reg & bit) \
-           ) \
-            LogRel(("CPUM: Warning - " #bit " is not supported by the host but already exposed to the guest. This may impact performance.\n")); \
-    } while (0)
-#define CPUID_GST_AMD_FEATURE_IGN(set, reg, bit) do { } while (0)
-
-    /* For checking AMD features which have a corresponding bit in the standard
-       range.  (Intel defines very few bits in the extended feature sets.) */
-#define CPUID_GST_FEATURE2_RET(reg, ExtBit, StdBit) \
-    do { \
-        if (    (aGuestCpuIdExt [1].reg    & (ExtBit)) \
-            && !(fHostAmd  \
-                 ? aHostRawExt[1].reg      & (ExtBit) \
-                 : aHostRawStd[1].reg      & (StdBit)) \
-            && !(aHostOverrideExt[1].reg   & (ExtBit)) \
-           ) \
-        { \
-            if (fStrictCpuIdChecks) \
-                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
-                                         N_(#ExtBit " is not supported by the host but has already exposed to the guest")); \
-            LogRel(("CPUM: " #ExtBit " is not supported by the host but has already exposed to the guest\n")); \
-        } \
-    } while (0)
-#define CPUID_GST_FEATURE2_WRN(reg, ExtBit, StdBit) \
-    do { \
-        if (    (aGuestCpuIdExt [1].reg    & (ExtBit)) \
-            && !(fHostAmd  \
-                 ? aHostRawExt[1].reg      & (ExtBit) \
-                 : aHostRawStd[1].reg      & (StdBit)) \
-            && !(aHostOverrideExt[1].reg   & (ExtBit)) \
-           ) \
-            LogRel(("CPUM: " #ExtBit " is not supported by the host but has already exposed to the guest\n")); \
-    } while (0)
-#define CPUID_GST_FEATURE2_EMU(reg, ExtBit, StdBit) \
-    do { \
-        if (    (aGuestCpuIdExt [1].reg    & (ExtBit)) \
-            && !(fHostAmd  \
-                 ? aHostRawExt[1].reg      & (ExtBit) \
-                 : aHostRawStd[1].reg      & (StdBit)) \
-            && !(aHostOverrideExt[1].reg   & (ExtBit)) \
-           ) \
-            LogRel(("CPUM: Warning - " #ExtBit " is not supported by the host but already exposed to the guest. This may impact performance.\n")); \
-    } while (0)
-#define CPUID_GST_FEATURE2_IGN(reg, ExtBit, StdBit) do { } while (0)
-
-    /*
-     * Load them into stack buffers first.
-     */
-    PCPUMCPUIDLEAF paLeaves;
-    uint32_t       cLeaves;
-    int rc = cpumR3LoadCpuIdGuestArrays(pSSM, uVersion, &paLeaves, &cLeaves);
-    AssertRCReturn(rc, rc);
-
-    /** @todo we'll be leaking paLeaves on error return... */
-
-    CPUMCPUID   GuestCpuIdDef;
-    rc = SSMR3GetMem(pSSM, &GuestCpuIdDef, sizeof(GuestCpuIdDef));
-    AssertRCReturn(rc, rc);
-
-    CPUMCPUID   aRawStd[16];
-    uint32_t    cRawStd;
-    rc = SSMR3GetU32(pSSM, &cRawStd); AssertRCReturn(rc, rc);
-    if (cRawStd > RT_ELEMENTS(aRawStd))
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    rc = SSMR3GetMem(pSSM, &aRawStd[0], cRawStd * sizeof(aRawStd[0]));
-    AssertRCReturn(rc, rc);
-    for (uint32_t i = cRawStd; i < RT_ELEMENTS(aRawStd); i++)
-        ASMCpuIdExSlow(i, 0, 0, 0, &aRawStd[i].eax, &aRawStd[i].ebx, &aRawStd[i].ecx, &aRawStd[i].edx);
-
-    CPUMCPUID   aRawExt[32];
-    uint32_t    cRawExt;
-    rc = SSMR3GetU32(pSSM, &cRawExt); AssertRCReturn(rc, rc);
-    if (cRawExt > RT_ELEMENTS(aRawExt))
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    rc = SSMR3GetMem(pSSM, &aRawExt[0], cRawExt * sizeof(aRawExt[0]));
-    AssertRCReturn(rc, rc);
-    for (uint32_t i = cRawExt; i < RT_ELEMENTS(aRawExt); i++)
-        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0, &aRawExt[i].eax, &aRawExt[i].ebx, &aRawExt[i].ecx, &aRawExt[i].edx);
-
-    /*
-     * Get the raw CPU IDs for the current host.
-     */
-    CPUMCPUID   aHostRawStd[16];
-    for (unsigned i = 0; i < RT_ELEMENTS(aHostRawStd); i++)
-        ASMCpuIdExSlow(i, 0, 0, 0, &aHostRawStd[i].eax, &aHostRawStd[i].ebx, &aHostRawStd[i].ecx, &aHostRawStd[i].edx);
-
-    CPUMCPUID   aHostRawExt[32];
-    for (unsigned i = 0; i < RT_ELEMENTS(aHostRawExt); i++)
-        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0,
-                       &aHostRawExt[i].eax, &aHostRawExt[i].ebx, &aHostRawExt[i].ecx, &aHostRawExt[i].edx);
-
-    /*
-     * Get the host and guest overrides so we don't reject the state because
-     * some feature was enabled thru these interfaces.
-     * Note! We currently only need the feature leaves, so skip rest.
-     */
-    PCFGMNODE   pOverrideCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM/HostCPUID");
-    CPUMCPUID   aHostOverrideStd[2];
-    memcpy(&aHostOverrideStd[0], &aHostRawStd[0], sizeof(aHostOverrideStd));
-    cpumR3CpuIdInitLoadOverrideSet(UINT32_C(0x00000000), &aHostOverrideStd[0], RT_ELEMENTS(aHostOverrideStd), pOverrideCfg);
-
-    CPUMCPUID   aHostOverrideExt[2];
-    memcpy(&aHostOverrideExt[0], &aHostRawExt[0], sizeof(aHostOverrideExt));
-    cpumR3CpuIdInitLoadOverrideSet(UINT32_C(0x80000000), &aHostOverrideExt[0], RT_ELEMENTS(aHostOverrideExt), pOverrideCfg);
-
-    /*
-     * This can be skipped.
-     */
-    bool fStrictCpuIdChecks;
-    CFGMR3QueryBoolDef(CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM"), "StrictCpuIdChecks", &fStrictCpuIdChecks, true);
-
-
-
-    /*
-     * For raw-mode we'll require that the CPUs are very similar since we don't
-     * intercept CPUID instructions for user mode applications.
-     */
-    if (!HMIsEnabled(pVM))
-    {
-        /* CPUID(0) */
-        CPUID_CHECK_RET(   aHostRawStd[0].ebx == aRawStd[0].ebx
-                        && aHostRawStd[0].ecx == aRawStd[0].ecx
-                        && aHostRawStd[0].edx == aRawStd[0].edx,
-                        (N_("CPU vendor mismatch: host='%.4s%.4s%.4s' saved='%.4s%.4s%.4s'"),
-                         &aHostRawStd[0].ebx, &aHostRawStd[0].edx, &aHostRawStd[0].ecx,
-                         &aRawStd[0].ebx, &aRawStd[0].edx, &aRawStd[0].ecx));
-        CPUID_CHECK2_WRN("Std CPUID max leaf",   aHostRawStd[0].eax, aRawStd[0].eax);
-        CPUID_CHECK2_WRN("Reserved bits 15:14", (aHostRawExt[1].eax >> 14) & 3, (aRawExt[1].eax >> 14) & 3);
-        CPUID_CHECK2_WRN("Reserved bits 31:28",  aHostRawExt[1].eax >> 28,       aRawExt[1].eax >> 28);
-
-        bool const fIntel = ASMIsIntelCpuEx(aRawStd[0].ebx, aRawStd[0].ecx, aRawStd[0].edx);
-
-        /* CPUID(1).eax */
-        CPUID_CHECK2_RET("CPU family",          ASMGetCpuFamily(aHostRawStd[1].eax),        ASMGetCpuFamily(aRawStd[1].eax));
-        CPUID_CHECK2_RET("CPU model",           ASMGetCpuModel(aHostRawStd[1].eax, fIntel), ASMGetCpuModel(aRawStd[1].eax, fIntel));
-        CPUID_CHECK2_WRN("CPU type",            (aHostRawStd[1].eax >> 12) & 3,             (aRawStd[1].eax >> 12) & 3 );
-
-        /* CPUID(1).ebx - completely ignore CPU count and APIC ID. */
-        CPUID_CHECK2_RET("CPU brand ID",         aHostRawStd[1].ebx & 0xff,                 aRawStd[1].ebx & 0xff);
-        CPUID_CHECK2_WRN("CLFLUSH chunk count", (aHostRawStd[1].ebx >> 8) & 0xff,           (aRawStd[1].ebx >> 8) & 0xff);
-
-        /* CPUID(1).ecx */
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SSE3);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_PCLMUL);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_DTES64);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_MONITOR);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_CPLDS);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_VMX);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_SMX);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_EST);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_TM2);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SSSE3);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_CNTXID);
-        CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(11) /*reserved*/ );
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_FMA);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_CX16);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_TPRUPDATE);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_PDCM);
-        CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(16) /*reserved*/);
-        CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(17) /*reserved*/);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_DCA);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SSE4_1);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SSE4_2);
-        CPUID_RAW_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_X2APIC);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_MOVBE);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_POPCNT);
-        CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(24) /*reserved*/);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_AES);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_XSAVE);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_OSXSAVE);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_AVX);
-        CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(29) /*reserved*/);
-        CPUID_RAW_FEATURE_RET(Std, ecx, RT_BIT_32(30) /*reserved*/);
-        CPUID_RAW_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_HVP);
-
-        /* CPUID(1).edx */
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_FPU);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_VME);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_DE);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PSE);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_TSC);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_MSR);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PAE);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_MCE);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_CX8);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_APIC);
-        CPUID_RAW_FEATURE_RET(Std, edx, RT_BIT_32(10) /*reserved*/);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_SEP);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_MTRR);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PGE);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_MCA);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_CMOV);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PAT);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PSE36);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PSN);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_CLFSH);
-        CPUID_RAW_FEATURE_RET(Std, edx, RT_BIT_32(20) /*reserved*/);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_DS);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_ACPI);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_MMX);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_FXSR);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_SSE);
-        CPUID_RAW_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_SSE2);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_SS);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_HTT);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_TM);
-        CPUID_RAW_FEATURE_RET(Std, edx, RT_BIT_32(30) /*JMPE/IA64*/);
-        CPUID_RAW_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PBE);
-
-        /* CPUID(2) - config, mostly about caches. ignore. */
-        /* CPUID(3) - processor serial number. ignore. */
-        /* CPUID(4) - config, cache and topology - takes ECX as input. ignore. */
-        /* CPUID(5) - mwait/monitor config. ignore. */
-        /* CPUID(6) - power management. ignore. */
-        /* CPUID(7) - ???. ignore. */
-        /* CPUID(8) - ???. ignore. */
-        /* CPUID(9) - DCA. ignore for now. */
-        /* CPUID(a) - PeMo info. ignore for now. */
-        /* CPUID(b) - topology info - takes ECX as input. ignore. */
-
-        /* CPUID(d) - XCR0 stuff - takes ECX as input. We only warn about the main level (ECX=0) for now. */
-        CPUID_CHECK_WRN(   aRawStd[0].eax     <  UINT32_C(0x0000000d)
-                        || aHostRawStd[0].eax >= UINT32_C(0x0000000d),
-                        ("CPUM: Standard leaf D was present on saved state host, not present on current.\n"));
-        if (   aRawStd[0].eax     >= UINT32_C(0x0000000d)
-            && aHostRawStd[0].eax >= UINT32_C(0x0000000d))
-        {
-            CPUID_CHECK2_WRN("Valid low XCR0 bits",             aHostRawStd[0xd].eax, aRawStd[0xd].eax);
-            CPUID_CHECK2_WRN("Valid high XCR0 bits",            aHostRawStd[0xd].edx, aRawStd[0xd].edx);
-            CPUID_CHECK2_WRN("Current XSAVE/XRSTOR area size",  aHostRawStd[0xd].ebx, aRawStd[0xd].ebx);
-            CPUID_CHECK2_WRN("Max XSAVE/XRSTOR area size",      aHostRawStd[0xd].ecx, aRawStd[0xd].ecx);
-        }
-
-        /* CPUID(0x80000000) - same as CPUID(0) except for eax.
-           Note! Intel have/is marking many of the fields here as reserved. We
-                 will verify them as if it's an AMD CPU. */
-        CPUID_CHECK_RET(   (aHostRawExt[0].eax >= UINT32_C(0x80000001) && aHostRawExt[0].eax <= UINT32_C(0x8000007f))
-                        || !(aRawExt[0].eax    >= UINT32_C(0x80000001) && aRawExt[0].eax     <= UINT32_C(0x8000007f)),
-                        (N_("Extended leaves was present on saved state host, but is missing on the current\n")));
-        if (aRawExt[0].eax >= UINT32_C(0x80000001) && aRawExt[0].eax     <= UINT32_C(0x8000007f))
-        {
-            CPUID_CHECK_RET(   aHostRawExt[0].ebx == aRawExt[0].ebx
-                            && aHostRawExt[0].ecx == aRawExt[0].ecx
-                            && aHostRawExt[0].edx == aRawExt[0].edx,
-                            (N_("CPU vendor mismatch: host='%.4s%.4s%.4s' saved='%.4s%.4s%.4s'"),
-                             &aHostRawExt[0].ebx, &aHostRawExt[0].edx, &aHostRawExt[0].ecx,
-                             &aRawExt[0].ebx,     &aRawExt[0].edx,     &aRawExt[0].ecx));
-            CPUID_CHECK2_WRN("Ext CPUID max leaf",   aHostRawExt[0].eax, aRawExt[0].eax);
-
-            /* CPUID(0x80000001).eax - same as CPUID(0).eax. */
-            CPUID_CHECK2_RET("CPU family",          ASMGetCpuFamily(aHostRawExt[1].eax),        ASMGetCpuFamily(aRawExt[1].eax));
-            CPUID_CHECK2_RET("CPU model",           ASMGetCpuModel(aHostRawExt[1].eax, fIntel), ASMGetCpuModel(aRawExt[1].eax, fIntel));
-            CPUID_CHECK2_WRN("CPU type",            (aHostRawExt[1].eax >> 12) & 3, (aRawExt[1].eax >> 12) & 3 );
-            CPUID_CHECK2_WRN("Reserved bits 15:14", (aHostRawExt[1].eax >> 14) & 3, (aRawExt[1].eax >> 14) & 3 );
-            CPUID_CHECK2_WRN("Reserved bits 31:28",  aHostRawExt[1].eax >> 28, aRawExt[1].eax >> 28);
-
-            /* CPUID(0x80000001).ebx - Brand ID (maybe), just warn if things differs. */
-            CPUID_CHECK2_WRN("CPU BrandID",          aHostRawExt[1].ebx & 0xffff, aRawExt[1].ebx & 0xffff);
-            CPUID_CHECK2_WRN("Reserved bits 16:27", (aHostRawExt[1].ebx >> 16) & 0xfff, (aRawExt[1].ebx >> 16) & 0xfff);
-            CPUID_CHECK2_WRN("PkgType",             (aHostRawExt[1].ebx >> 28) &   0xf, (aRawExt[1].ebx >> 28) &   0xf);
-
-            /* CPUID(0x80000001).ecx */
-            CPUID_RAW_FEATURE_IGN(Ext, ecx, X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF);
-            CPUID_RAW_FEATURE_IGN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_CMPL);
-            CPUID_RAW_FEATURE_IGN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_SVM);
-            CPUID_RAW_FEATURE_IGN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_EXT_APIC);
-            CPUID_RAW_FEATURE_IGN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_CR8L);
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_ABM);
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_SSE4A);
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_MISALNSSE);
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF);
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_OSVW);
-            CPUID_RAW_FEATURE_IGN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_IBS);
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_SSE5);
-            CPUID_RAW_FEATURE_IGN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_SKINIT);
-            CPUID_RAW_FEATURE_IGN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_WDT);
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(14));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(15));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(16));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(17));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(18));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(19));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(20));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(21));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(22));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(23));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(24));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(25));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(26));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(27));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(28));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(29));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(30));
-            CPUID_RAW_FEATURE_WRN(Ext, ecx, RT_BIT_32(31));
-
-            /* CPUID(0x80000001).edx */
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_FPU);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_VME);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_DE);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_PSE);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_TSC);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_MSR);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_PAE);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_MCE);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_CX8);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_APIC);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, RT_BIT_32(10) /*reserved*/);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_EXT_FEATURE_EDX_SEP);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_MTRR);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_PGE);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_MCA);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_CMOV);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_PAT);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_PSE36);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, RT_BIT_32(18) /*reserved*/);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, RT_BIT_32(19) /*reserved*/);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_EXT_FEATURE_EDX_NX);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, RT_BIT_32(21) /*reserved*/);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_AXMMX);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_MMX);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_FXSR);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_FFXSR);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_EXT_FEATURE_EDX_PAGE1GB);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_EXT_FEATURE_EDX_RDTSCP);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, RT_BIT_32(28) /*reserved*/);
-            CPUID_RAW_FEATURE_IGN(Ext, edx, X86_CPUID_EXT_FEATURE_EDX_LONG_MODE);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX);
-            CPUID_RAW_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_3DNOW);
-
-            /** @todo verify the rest as well. */
-        }
-    }
-
-
-
-    /*
-     * Verify that we can support the features already exposed to the guest on
-     * this host.
-     *
-     * Most of the features we're emulating requires intercepting instruction
-     * and doing it the slow way, so there is no need to warn when they aren't
-     * present in the host CPU.  Thus we use IGN instead of EMU on these.
-     *
-     * Trailing comments:
-     *      "EMU"  - Possible to emulate, could be lots of work and very slow.
-     *      "EMU?" - Can this be emulated?
-     */
-    CPUMCPUID aGuestCpuIdStd[2];
-    RT_ZERO(aGuestCpuIdStd);
-    cpumR3CpuIdGetLeafLegacy(paLeaves, cLeaves, 1, 0, &aGuestCpuIdStd[1]);
-
-    /* CPUID(1).ecx */
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SSE3);    // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_PCLMUL);  // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_DTES64);  // -> EMU?
-    CPUID_GST_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_MONITOR);
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_CPLDS);   // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_VMX);     // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SMX);     // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_EST);     // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_TM2);     // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SSSE3);   // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_CNTXID);  // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(11) /*reserved*/ );
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_FMA);     // -> EMU? what's this?
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_CX16);    // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_TPRUPDATE);//-> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_PDCM);    // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(16) /*reserved*/);
-    CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(17) /*reserved*/);
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_DCA);     // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SSE4_1);  // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_SSE4_2);  // -> EMU
-    CPUID_GST_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_X2APIC);
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_MOVBE);   // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_POPCNT);  // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(24) /*reserved*/);
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_AES);     // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_XSAVE);   // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_OSXSAVE); // -> EMU
-    CPUID_GST_FEATURE_RET(Std, ecx, X86_CPUID_FEATURE_ECX_AVX);     // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(29) /*reserved*/);
-    CPUID_GST_FEATURE_RET(Std, ecx, RT_BIT_32(30) /*reserved*/);
-    CPUID_GST_FEATURE_IGN(Std, ecx, X86_CPUID_FEATURE_ECX_HVP);     // Normally not set by host
-
-    /* CPUID(1).edx */
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_FPU);
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_VME);
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_DE);      // -> EMU?
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PSE);
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_TSC);     // -> EMU
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_MSR);     // -> EMU
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_PAE);
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_MCE);
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_CX8);     // -> EMU?
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_APIC);
-    CPUID_GST_FEATURE_RET(Std, edx, RT_BIT_32(10) /*reserved*/);
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_SEP);
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_MTRR);
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PGE);
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_MCA);
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_CMOV);    // -> EMU
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PAT);
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PSE36);
-    CPUID_GST_FEATURE_IGN(Std, edx, X86_CPUID_FEATURE_EDX_PSN);
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_CLFSH);   // -> EMU
-    CPUID_GST_FEATURE_RET(Std, edx, RT_BIT_32(20) /*reserved*/);
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_DS);      // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_ACPI);    // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_MMX);     // -> EMU
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_FXSR);    // -> EMU
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_SSE);     // -> EMU
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_SSE2);    // -> EMU
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_SS);      // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_HTT);     // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_TM);      // -> EMU?
-    CPUID_GST_FEATURE_RET(Std, edx, RT_BIT_32(30) /*JMPE/IA64*/);   // -> EMU
-    CPUID_GST_FEATURE_RET(Std, edx, X86_CPUID_FEATURE_EDX_PBE);     // -> EMU?
-
-    /* CPUID(0x80000000). */
-    CPUMCPUID aGuestCpuIdExt[2];
-    RT_ZERO(aGuestCpuIdExt);
-    if (cpumR3CpuIdGetLeafLegacy(paLeaves, cLeaves, UINT32_C(0x80000001), 0, &aGuestCpuIdExt[1]))
-    {
-        /** @todo deal with no 0x80000001 on the host. */
-        bool const fHostAmd  = ASMIsAmdCpuEx(aHostRawStd[0].ebx, aHostRawStd[0].ecx, aHostRawStd[0].edx);
-        bool const fGuestAmd = ASMIsAmdCpuEx(aGuestCpuIdExt[0].ebx, aGuestCpuIdExt[0].ecx, aGuestCpuIdExt[0].edx);
-
-        /* CPUID(0x80000001).ecx */
-        CPUID_GST_FEATURE_WRN(Ext, ecx, X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF);   // -> EMU
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_CMPL);    // -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_SVM);     // -> EMU
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_EXT_APIC);// ???
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_CR8L);    // -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_ABM);     // -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_SSE4A);   // -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_MISALNSSE);//-> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF);// -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_OSVW);    // -> EMU?
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_IBS);     // -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_SSE5);    // -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_SKINIT);  // -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, ecx, X86_CPUID_AMD_FEATURE_ECX_WDT);     // -> EMU
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(14));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(15));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(16));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(17));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(18));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(19));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(20));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(21));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(22));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(23));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(24));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(25));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(26));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(27));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(28));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(29));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(30));
-        CPUID_GST_AMD_FEATURE_WRN(Ext, ecx, RT_BIT_32(31));
-
-        /* CPUID(0x80000001).edx */
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_FPU,   X86_CPUID_FEATURE_EDX_FPU);     // -> EMU
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_VME,   X86_CPUID_FEATURE_EDX_VME);     // -> EMU
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_DE,    X86_CPUID_FEATURE_EDX_DE);      // -> EMU
-        CPUID_GST_FEATURE2_IGN(        edx, X86_CPUID_AMD_FEATURE_EDX_PSE,   X86_CPUID_FEATURE_EDX_PSE);
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_TSC,   X86_CPUID_FEATURE_EDX_TSC);     // -> EMU
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_MSR,   X86_CPUID_FEATURE_EDX_MSR);     // -> EMU
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_PAE,   X86_CPUID_FEATURE_EDX_PAE);
-        CPUID_GST_FEATURE2_IGN(        edx, X86_CPUID_AMD_FEATURE_EDX_MCE,   X86_CPUID_FEATURE_EDX_MCE);
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_CX8,   X86_CPUID_FEATURE_EDX_CX8);     // -> EMU?
-        CPUID_GST_FEATURE2_IGN(        edx, X86_CPUID_AMD_FEATURE_EDX_APIC,  X86_CPUID_FEATURE_EDX_APIC);
-        CPUID_GST_AMD_FEATURE_WRN(Ext, edx, RT_BIT_32(10) /*reserved*/);
-        CPUID_GST_FEATURE_IGN(    Ext, edx, X86_CPUID_EXT_FEATURE_EDX_SYSCALL);                              // On Intel: long mode only.
-        CPUID_GST_FEATURE2_IGN(        edx, X86_CPUID_AMD_FEATURE_EDX_MTRR,  X86_CPUID_FEATURE_EDX_MTRR);
-        CPUID_GST_FEATURE2_IGN(        edx, X86_CPUID_AMD_FEATURE_EDX_PGE,   X86_CPUID_FEATURE_EDX_PGE);
-        CPUID_GST_FEATURE2_IGN(        edx, X86_CPUID_AMD_FEATURE_EDX_MCA,   X86_CPUID_FEATURE_EDX_MCA);
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_CMOV,  X86_CPUID_FEATURE_EDX_CMOV);    // -> EMU
-        CPUID_GST_FEATURE2_IGN(        edx, X86_CPUID_AMD_FEATURE_EDX_PAT,   X86_CPUID_FEATURE_EDX_PAT);
-        CPUID_GST_FEATURE2_IGN(        edx, X86_CPUID_AMD_FEATURE_EDX_PSE36, X86_CPUID_FEATURE_EDX_PSE36);
-        CPUID_GST_AMD_FEATURE_WRN(Ext, edx, RT_BIT_32(18) /*reserved*/);
-        CPUID_GST_AMD_FEATURE_WRN(Ext, edx, RT_BIT_32(19) /*reserved*/);
-        CPUID_GST_FEATURE_RET(    Ext, edx, X86_CPUID_EXT_FEATURE_EDX_NX);
-        CPUID_GST_FEATURE_WRN(    Ext, edx, RT_BIT_32(21) /*reserved*/);
-        CPUID_GST_FEATURE_RET(    Ext, edx, X86_CPUID_AMD_FEATURE_EDX_AXMMX);
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_MMX,   X86_CPUID_FEATURE_EDX_MMX);     // -> EMU
-        CPUID_GST_FEATURE2_RET(        edx, X86_CPUID_AMD_FEATURE_EDX_FXSR,  X86_CPUID_FEATURE_EDX_FXSR);    // -> EMU
-        CPUID_GST_AMD_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_FFXSR);
-        CPUID_GST_AMD_FEATURE_RET(Ext, edx, X86_CPUID_EXT_FEATURE_EDX_PAGE1GB);
-        CPUID_GST_AMD_FEATURE_RET(Ext, edx, X86_CPUID_EXT_FEATURE_EDX_RDTSCP);
-        CPUID_GST_FEATURE_IGN(    Ext, edx, RT_BIT_32(28) /*reserved*/);
-        CPUID_GST_FEATURE_RET(    Ext, edx, X86_CPUID_EXT_FEATURE_EDX_LONG_MODE);
-        CPUID_GST_AMD_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX);
-        CPUID_GST_AMD_FEATURE_RET(Ext, edx, X86_CPUID_AMD_FEATURE_EDX_3DNOW);
-    }
-
-    /*
-     * We're good, commit the CPU ID leaves.
-     */
-    MMHyperFree(pVM, pVM->cpum.s.GuestInfo.paCpuIdLeavesR3);
-    pVM->cpum.s.GuestInfo.paCpuIdLeavesR0 = NIL_RTR0PTR;
-    pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = NIL_RTRCPTR;
-    pVM->cpum.s.GuestInfo.DefCpuId = GuestCpuIdDef;
-    rc = cpumR3CpuIdInstallAndExplodeLeaves(pVM, &pVM->cpum.s, paLeaves, cLeaves);
-    RTMemFree(paLeaves);
-    AssertLogRelRCReturn(rc, rc);
-
-
-#undef CPUID_CHECK_RET
-#undef CPUID_CHECK_WRN
-#undef CPUID_CHECK2_RET
-#undef CPUID_CHECK2_WRN
-#undef CPUID_RAW_FEATURE_RET
-#undef CPUID_RAW_FEATURE_WRN
-#undef CPUID_RAW_FEATURE_IGN
-#undef CPUID_GST_FEATURE_RET
-#undef CPUID_GST_FEATURE_WRN
-#undef CPUID_GST_FEATURE_EMU
-#undef CPUID_GST_FEATURE_IGN
-#undef CPUID_GST_FEATURE2_RET
-#undef CPUID_GST_FEATURE2_WRN
-#undef CPUID_GST_FEATURE2_EMU
-#undef CPUID_GST_FEATURE2_IGN
-#undef CPUID_GST_AMD_FEATURE_RET
-#undef CPUID_GST_AMD_FEATURE_WRN
-#undef CPUID_GST_AMD_FEATURE_EMU
-#undef CPUID_GST_AMD_FEATURE_IGN
-
-    return VINF_SUCCESS;
-}
 
 
 /**
@@ -2797,19 +1137,45 @@ static DECLCALLBACK(int) cpumR3SaveExec(PVM pVM, PSSMHANDLE pSSM)
     /*
      * Save.
      */
-    for (VMCPUID i = 0; i < pVM->cCpus; i++)
-    {
-        PVMCPU pVCpu = &pVM->aCpus[i];
-        SSMR3PutStructEx(pSSM, &pVCpu->cpum.s.Hyper, sizeof(pVCpu->cpum.s.Hyper), 0, g_aCpumCtxFields, NULL);
-    }
-
     SSMR3PutU32(pSSM, pVM->cCpus);
     SSMR3PutU32(pSSM, sizeof(pVM->aCpus[0].cpum.s.GuestMsrs.msr));
     for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
     {
         PVMCPU pVCpu = &pVM->aCpus[iCpu];
 
-        SSMR3PutStructEx(pSSM, &pVCpu->cpum.s.Guest, sizeof(pVCpu->cpum.s.Guest), 0, g_aCpumCtxFields, NULL);
+        SSMR3PutStructEx(pSSM, &pVCpu->cpum.s.Hyper,     sizeof(pVCpu->cpum.s.Hyper),     0, g_aCpumCtxFields, NULL);
+
+        PCPUMCTX pGstCtx = &pVCpu->cpum.s.Guest;
+        SSMR3PutStructEx(pSSM, pGstCtx,                  sizeof(*pGstCtx),                0, g_aCpumCtxFields, NULL);
+        SSMR3PutStructEx(pSSM, &pGstCtx->pXStateR3->x87, sizeof(pGstCtx->pXStateR3->x87), 0, g_aCpumX87Fields, NULL);
+        if (pGstCtx->fXStateMask != 0)
+            SSMR3PutStructEx(pSSM, &pGstCtx->pXStateR3->Hdr, sizeof(pGstCtx->pXStateR3->Hdr), 0, g_aCpumXSaveHdrFields, NULL);
+        if (pGstCtx->fXStateMask & XSAVE_C_YMM)
+        {
+            PCX86XSAVEYMMHI pYmmHiCtx = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_YMM_BIT, PCX86XSAVEYMMHI);
+            SSMR3PutStructEx(pSSM, pYmmHiCtx, sizeof(*pYmmHiCtx), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumYmmHiFields, NULL);
+        }
+        if (pGstCtx->fXStateMask & XSAVE_C_BNDREGS)
+        {
+            PCX86XSAVEBNDREGS pBndRegs = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_BNDREGS_BIT, PCX86XSAVEBNDREGS);
+            SSMR3PutStructEx(pSSM, pBndRegs, sizeof(*pBndRegs), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumBndRegsFields, NULL);
+        }
+        if (pGstCtx->fXStateMask & XSAVE_C_BNDCSR)
+        {
+            PCX86XSAVEBNDCFG pBndCfg = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_BNDCSR_BIT, PCX86XSAVEBNDCFG);
+            SSMR3PutStructEx(pSSM, pBndCfg, sizeof(*pBndCfg), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumBndCfgFields, NULL);
+        }
+        if (pGstCtx->fXStateMask & XSAVE_C_ZMM_HI256)
+        {
+            PCX86XSAVEZMMHI256 pZmmHi256 = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_ZMM_HI256_BIT, PCX86XSAVEZMMHI256);
+            SSMR3PutStructEx(pSSM, pZmmHi256, sizeof(*pZmmHi256), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumZmmHi256Fields, NULL);
+        }
+        if (pGstCtx->fXStateMask & XSAVE_C_ZMM_16HI)
+        {
+            PCX86XSAVEZMM16HI pZmm16Hi = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_ZMM_16HI_BIT, PCX86XSAVEZMM16HI);
+            SSMR3PutStructEx(pSSM, pZmm16Hi, sizeof(*pZmm16Hi), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumZmm16HiFields, NULL);
+        }
+
         SSMR3PutU32(pSSM, pVCpu->cpum.s.fUseFlags);
         SSMR3PutU32(pSSM, pVCpu->cpum.s.fChanged);
         AssertCompileSizeAlignment(pVCpu->cpum.s.GuestMsrs.msr, sizeof(uint64_t));
@@ -2837,10 +1203,15 @@ static DECLCALLBACK(int) cpumR3LoadPrep(PVM pVM, PSSMHANDLE pSSM)
  */
 static DECLCALLBACK(int) cpumR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
 {
+    int rc; /* Only for AssertRCReturn use. */
+
     /*
      * Validate version.
      */
-    if (    uVersion != CPUM_SAVED_STATE_VERSION
+    if (    uVersion != CPUM_SAVED_STATE_VERSION_XSAVE
+        &&  uVersion != CPUM_SAVED_STATE_VERSION_GOOD_CPUID_COUNT
+        &&  uVersion != CPUM_SAVED_STATE_VERSION_BAD_CPUID_COUNT
+        &&  uVersion != CPUM_SAVED_STATE_VERSION_PUT_STRUCT
         &&  uVersion != CPUM_SAVED_STATE_VERSION_MEM
         &&  uVersion != CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE
         &&  uVersion != CPUM_SAVED_STATE_VERSION_VER3_2
@@ -2864,30 +1235,47 @@ static DECLCALLBACK(int) cpumR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVers
         else if (uVersion <= CPUM_SAVED_STATE_VERSION_VER3_0)
             SSMR3HandleSetGCPtrSize(pSSM, HC_ARCH_BITS == 32 ? sizeof(RTGCPTR32) : sizeof(RTGCPTR));
 
+        /*
+         * Figure x86 and ctx field definitions to use for older states.
+         */
         uint32_t const  fLoad = uVersion > CPUM_SAVED_STATE_VERSION_MEM ? 0 : SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED;
-        PCSSMFIELD      paCpumCtxFields = g_aCpumCtxFields;
+        PCSSMFIELD      paCpumCtx1Fields = g_aCpumX87Fields;
+        PCSSMFIELD      paCpumCtx2Fields = g_aCpumCtxFields;
         if (uVersion == CPUM_SAVED_STATE_VERSION_VER1_6)
-            paCpumCtxFields = g_aCpumCtxFieldsV16;
+        {
+            paCpumCtx1Fields = g_aCpumX87FieldsV16;
+            paCpumCtx2Fields = g_aCpumCtxFieldsV16;
+        }
         else if (uVersion <= CPUM_SAVED_STATE_VERSION_MEM)
-            paCpumCtxFields = g_aCpumCtxFieldsMem;
+        {
+            paCpumCtx1Fields = g_aCpumX87FieldsMem;
+            paCpumCtx2Fields = g_aCpumCtxFieldsMem;
+        }
 
         /*
-         * Restore.
+         * The hyper state used to preceed the CPU count.  Starting with
+         * XSAVE it was moved down till after we've got the count.
          */
-        for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
+        if (uVersion < CPUM_SAVED_STATE_VERSION_XSAVE)
         {
-            PVMCPU   pVCpu = &pVM->aCpus[iCpu];
-            uint64_t uCR3  = pVCpu->cpum.s.Hyper.cr3;
-            uint64_t uRSP  = pVCpu->cpum.s.Hyper.rsp; /* see VMMR3Relocate(). */
-            SSMR3GetStructEx(pSSM, &pVCpu->cpum.s.Hyper, sizeof(pVCpu->cpum.s.Hyper), fLoad, paCpumCtxFields, NULL);
-            pVCpu->cpum.s.Hyper.cr3 = uCR3;
-            pVCpu->cpum.s.Hyper.rsp = uRSP;
+            for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
+            {
+                PVMCPU      pVCpu = &pVM->aCpus[iCpu];
+                X86FXSTATE  Ign;
+                SSMR3GetStructEx(pSSM, &Ign, sizeof(Ign), fLoad | SSMSTRUCT_FLAGS_NO_TAIL_MARKER, paCpumCtx1Fields, NULL);
+                uint64_t    uCR3  = pVCpu->cpum.s.Hyper.cr3;
+                uint64_t    uRSP  = pVCpu->cpum.s.Hyper.rsp; /* see VMMR3Relocate(). */
+                SSMR3GetStructEx(pSSM, &pVCpu->cpum.s.Hyper, sizeof(pVCpu->cpum.s.Hyper),
+                                 fLoad | SSMSTRUCT_FLAGS_NO_LEAD_MARKER, paCpumCtx2Fields, NULL);
+                pVCpu->cpum.s.Hyper.cr3 = uCR3;
+                pVCpu->cpum.s.Hyper.rsp = uRSP;
+            }
         }
 
         if (uVersion >= CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR)
         {
             uint32_t cCpus;
-            int rc = SSMR3GetU32(pSSM, &cCpus); AssertRCReturn(rc, rc);
+            rc = SSMR3GetU32(pSSM, &cCpus); AssertRCReturn(rc, rc);
             AssertLogRelMsgReturn(cCpus == pVM->cCpus, ("Mismatching CPU counts: saved: %u; configured: %u \n", cCpus, pVM->cCpus),
                                   VERR_SSM_UNEXPECTED_DATA);
         }
@@ -2899,34 +1287,148 @@ static DECLCALLBACK(int) cpumR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVers
         uint32_t cbMsrs = 0;
         if (uVersion > CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE)
         {
-            int rc = SSMR3GetU32(pSSM, &cbMsrs); AssertRCReturn(rc, rc);
+            rc = SSMR3GetU32(pSSM, &cbMsrs); AssertRCReturn(rc, rc);
             AssertLogRelMsgReturn(RT_ALIGN(cbMsrs, sizeof(uint64_t)) == cbMsrs, ("Size of MSRs is misaligned: %#x\n", cbMsrs),
                                   VERR_SSM_UNEXPECTED_DATA);
             AssertLogRelMsgReturn(cbMsrs <= sizeof(CPUMCTXMSRS) && cbMsrs > 0,  ("Size of MSRs is out of range: %#x\n", cbMsrs),
                                   VERR_SSM_UNEXPECTED_DATA);
         }
 
+        /*
+         * Do the per-CPU restoring.
+         */
         for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
         {
-            PVMCPU  pVCpu = &pVM->aCpus[iCpu];
-            SSMR3GetStructEx(pSSM, &pVCpu->cpum.s.Guest, sizeof(pVCpu->cpum.s.Guest), fLoad,
-                             paCpumCtxFields, NULL);
+            PVMCPU   pVCpu = &pVM->aCpus[iCpu];
+            PCPUMCTX pGstCtx = &pVCpu->cpum.s.Guest;
+
+            if (uVersion >= CPUM_SAVED_STATE_VERSION_XSAVE)
+            {
+                /*
+                 * The XSAVE saved state layout moved the hyper state down here.
+                 */
+                uint64_t    uCR3  = pVCpu->cpum.s.Hyper.cr3;
+                uint64_t    uRSP  = pVCpu->cpum.s.Hyper.rsp; /* see VMMR3Relocate(). */
+                rc = SSMR3GetStructEx(pSSM, &pVCpu->cpum.s.Hyper,     sizeof(pVCpu->cpum.s.Hyper),     0, g_aCpumCtxFields, NULL);
+                pVCpu->cpum.s.Hyper.cr3 = uCR3;
+                pVCpu->cpum.s.Hyper.rsp = uRSP;
+                AssertRCReturn(rc, rc);
+
+                /*
+                 * Start by restoring the CPUMCTX structure and the X86FXSAVE bits of the extended state.
+                 */
+                rc = SSMR3GetStructEx(pSSM, pGstCtx,                  sizeof(*pGstCtx),                0, g_aCpumCtxFields, NULL);
+                rc = SSMR3GetStructEx(pSSM, &pGstCtx->pXStateR3->x87, sizeof(pGstCtx->pXStateR3->x87), 0, g_aCpumX87Fields, NULL);
+                AssertRCReturn(rc, rc);
+
+                /* Check that the xsave/xrstor mask is valid (invalid results in #GP). */
+                if (pGstCtx->fXStateMask != 0)
+                {
+                    AssertLogRelMsgReturn(!(pGstCtx->fXStateMask & ~pVM->cpum.s.fXStateGuestMask),
+                                          ("fXStateMask=%#RX64 fXStateGuestMask=%#RX64\n",
+                                           pGstCtx->fXStateMask, pVM->cpum.s.fXStateGuestMask),
+                                          VERR_CPUM_INCOMPATIBLE_XSAVE_COMP_MASK);
+                    AssertLogRelMsgReturn(pGstCtx->fXStateMask & XSAVE_C_X87,
+                                          ("fXStateMask=%#RX64\n", pGstCtx->fXStateMask), VERR_CPUM_INVALID_XSAVE_COMP_MASK);
+                    AssertLogRelMsgReturn((pGstCtx->fXStateMask & (XSAVE_C_SSE | XSAVE_C_YMM)) != XSAVE_C_YMM,
+                                          ("fXStateMask=%#RX64\n", pGstCtx->fXStateMask), VERR_CPUM_INVALID_XSAVE_COMP_MASK);
+                    AssertLogRelMsgReturn(   (pGstCtx->fXStateMask & (XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI)) == 0
+                                          ||    (pGstCtx->fXStateMask & (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI))
+                                             ==                         (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI),
+                                          ("fXStateMask=%#RX64\n", pGstCtx->fXStateMask), VERR_CPUM_INVALID_XSAVE_COMP_MASK);
+                }
+
+                /* Check that the XCR0 mask is valid (invalid results in #GP). */
+                AssertLogRelMsgReturn(pGstCtx->aXcr[0] & XSAVE_C_X87, ("xcr0=%#RX64\n", pGstCtx->aXcr[0]), VERR_CPUM_INVALID_XCR0);
+                if (pGstCtx->aXcr[0] != XSAVE_C_X87)
+                {
+                    AssertLogRelMsgReturn(!(pGstCtx->aXcr[0] & ~(pGstCtx->fXStateMask | XSAVE_C_X87)),
+                                          ("xcr0=%#RX64 fXStateMask=%#RX64\n", pGstCtx->aXcr[0], pGstCtx->fXStateMask),
+                                          VERR_CPUM_INVALID_XCR0);
+                    AssertLogRelMsgReturn(pGstCtx->aXcr[0] & XSAVE_C_X87,
+                                          ("xcr0=%#RX64\n", pGstCtx->aXcr[0]), VERR_CPUM_INVALID_XSAVE_COMP_MASK);
+                    AssertLogRelMsgReturn((pGstCtx->aXcr[0] & (XSAVE_C_SSE | XSAVE_C_YMM)) != XSAVE_C_YMM,
+                                          ("xcr0=%#RX64\n", pGstCtx->aXcr[0]), VERR_CPUM_INVALID_XSAVE_COMP_MASK);
+                    AssertLogRelMsgReturn(   (pGstCtx->aXcr[0] & (XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI)) == 0
+                                          ||    (pGstCtx->aXcr[0] & (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI))
+                                             ==                     (XSAVE_C_SSE | XSAVE_C_YMM | XSAVE_C_OPMASK | XSAVE_C_ZMM_HI256 | XSAVE_C_ZMM_16HI),
+                                          ("xcr0=%#RX64\n", pGstCtx->aXcr[0]), VERR_CPUM_INVALID_XSAVE_COMP_MASK);
+                }
+
+                /* Check that the XCR1 is zero, as we don't implement it yet. */
+                AssertLogRelMsgReturn(!pGstCtx->aXcr[1], ("xcr1=%#RX64\n", pGstCtx->aXcr[1]), VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
+
+                /*
+                 * Restore the individual extended state components we support.
+                 */
+                if (pGstCtx->fXStateMask != 0)
+                {
+                    rc = SSMR3GetStructEx(pSSM, &pGstCtx->pXStateR3->Hdr, sizeof(pGstCtx->pXStateR3->Hdr),
+                                          0, g_aCpumXSaveHdrFields, NULL);
+                    AssertRCReturn(rc, rc);
+                    AssertLogRelMsgReturn(!(pGstCtx->pXStateR3->Hdr.bmXState & ~pGstCtx->fXStateMask),
+                                          ("bmXState=%#RX64 fXStateMask=%#RX64\n",
+                                           pGstCtx->pXStateR3->Hdr.bmXState, pGstCtx->fXStateMask),
+                                          VERR_CPUM_INVALID_XSAVE_HDR);
+                }
+                if (pGstCtx->fXStateMask & XSAVE_C_YMM)
+                {
+                    PX86XSAVEYMMHI pYmmHiCtx = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_YMM_BIT, PX86XSAVEYMMHI);
+                    SSMR3GetStructEx(pSSM, pYmmHiCtx, sizeof(*pYmmHiCtx), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumYmmHiFields, NULL);
+                }
+                if (pGstCtx->fXStateMask & XSAVE_C_BNDREGS)
+                {
+                    PX86XSAVEBNDREGS pBndRegs = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_BNDREGS_BIT, PX86XSAVEBNDREGS);
+                    SSMR3GetStructEx(pSSM, pBndRegs, sizeof(*pBndRegs), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumBndRegsFields, NULL);
+                }
+                if (pGstCtx->fXStateMask & XSAVE_C_BNDCSR)
+                {
+                    PX86XSAVEBNDCFG pBndCfg = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_BNDCSR_BIT, PX86XSAVEBNDCFG);
+                    SSMR3GetStructEx(pSSM, pBndCfg, sizeof(*pBndCfg), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumBndCfgFields, NULL);
+                }
+                if (pGstCtx->fXStateMask & XSAVE_C_ZMM_HI256)
+                {
+                    PX86XSAVEZMMHI256 pZmmHi256 = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_ZMM_HI256_BIT, PX86XSAVEZMMHI256);
+                    SSMR3GetStructEx(pSSM, pZmmHi256, sizeof(*pZmmHi256), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumZmmHi256Fields, NULL);
+                }
+                if (pGstCtx->fXStateMask & XSAVE_C_ZMM_16HI)
+                {
+                    PX86XSAVEZMM16HI pZmm16Hi = CPUMCTX_XSAVE_C_PTR(pGstCtx, XSAVE_C_ZMM_16HI_BIT, PX86XSAVEZMM16HI);
+                    SSMR3GetStructEx(pSSM, pZmm16Hi, sizeof(*pZmm16Hi), SSMSTRUCT_FLAGS_FULL_STRUCT, g_aCpumZmm16HiFields, NULL);
+                }
+            }
+            else
+            {
+                /*
+                 * Pre XSAVE saved state.
+                 */
+                SSMR3GetStructEx(pSSM, &pGstCtx->pXStateR3->x87, sizeof(pGstCtx->pXStateR3->x87),
+                                 fLoad | SSMSTRUCT_FLAGS_NO_TAIL_MARKER, paCpumCtx1Fields, NULL);
+                SSMR3GetStructEx(pSSM, pGstCtx, sizeof(*pGstCtx), fLoad | SSMSTRUCT_FLAGS_NO_LEAD_MARKER, paCpumCtx2Fields, NULL);
+            }
+
+            /*
+             * Restore a couple of flags and the MSRs.
+             */
             SSMR3GetU32(pSSM, &pVCpu->cpum.s.fUseFlags);
             SSMR3GetU32(pSSM, &pVCpu->cpum.s.fChanged);
+
+            rc = VINF_SUCCESS;
             if (uVersion > CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE)
-                SSMR3GetMem(pSSM, &pVCpu->cpum.s.GuestMsrs.au64[0], cbMsrs);
+                rc = SSMR3GetMem(pSSM, &pVCpu->cpum.s.GuestMsrs.au64[0], cbMsrs);
             else if (uVersion >= CPUM_SAVED_STATE_VERSION_VER3_0)
             {
                 SSMR3GetMem(pSSM, &pVCpu->cpum.s.GuestMsrs.au64[0], 2 * sizeof(uint64_t)); /* Restore two MSRs. */
-                SSMR3Skip(pSSM, 62 * sizeof(uint64_t));
+                rc = SSMR3Skip(pSSM, 62 * sizeof(uint64_t));
             }
+            AssertRCReturn(rc, rc);
 
             /* REM and other may have cleared must-be-one fields in DR6 and
                DR7, fix these. */
-            pVCpu->cpum.s.Guest.dr[6] &= ~(X86_DR6_RAZ_MASK | X86_DR6_MBZ_MASK);
-            pVCpu->cpum.s.Guest.dr[6] |= X86_DR6_RA1_MASK;
-            pVCpu->cpum.s.Guest.dr[7] &= ~(X86_DR7_RAZ_MASK | X86_DR7_MBZ_MASK);
-            pVCpu->cpum.s.Guest.dr[7] |= X86_DR7_RA1_MASK;
+            pGstCtx->dr[6] &= ~(X86_DR6_RAZ_MASK | X86_DR6_MBZ_MASK);
+            pGstCtx->dr[6] |= X86_DR6_RA1_MASK;
+            pGstCtx->dr[7] &= ~(X86_DR7_RAZ_MASK | X86_DR7_MBZ_MASK);
+            pGstCtx->dr[7] |= X86_DR7_RA1_MASK;
         }
 
         /* Older states does not have the internal selector register flags
@@ -2996,120 +1498,9 @@ static DECLCALLBACK(int) cpumR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVers
     /*
      * Guest CPUIDs.
      */
-    if (uVersion > CPUM_SAVED_STATE_VERSION_VER3_0)
+    if (uVersion >= CPUM_SAVED_STATE_VERSION_VER3_2)
         return cpumR3LoadCpuId(pVM, pSSM, uVersion);
-
-    /** @todo Merge the code below into cpumR3LoadCpuId when we've found out what is
-     *        actually required. */
-
-    /*
-     * Restore the CPUID leaves.
-     *
-     * Note that we support restoring less than the current amount of standard
-     * leaves because we've been allowed more is newer version of VBox.
-     */
-    uint32_t cElements;
-    int rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
-    if (cElements > RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdStd[0], cElements*sizeof(pVM->cpum.s.aGuestCpuIdStd[0]));
-
-    rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
-    if (cElements != RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdExt))
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdExt[0], sizeof(pVM->cpum.s.aGuestCpuIdExt));
-
-    rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
-    if (cElements != RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur))
-        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
-    SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdCentaur[0], sizeof(pVM->cpum.s.aGuestCpuIdCentaur));
-
-    SSMR3GetMem(pSSM, &pVM->cpum.s.GuestCpuIdDef, sizeof(pVM->cpum.s.GuestCpuIdDef));
-
-    /*
-     * Check that the basic cpuid id information is unchanged.
-     */
-    /** @todo we should check the 64 bits capabilities too! */
-    uint32_t au32CpuId[8] = {0,0,0,0, 0,0,0,0};
-    ASMCpuIdExSlow(0, 0, 0, 0, &au32CpuId[0], &au32CpuId[1], &au32CpuId[2], &au32CpuId[3]);
-    ASMCpuIdExSlow(1, 0, 0, 0, &au32CpuId[4], &au32CpuId[5], &au32CpuId[6], &au32CpuId[7]);
-    uint32_t au32CpuIdSaved[8];
-    rc = SSMR3GetMem(pSSM, &au32CpuIdSaved[0], sizeof(au32CpuIdSaved));
-    if (RT_SUCCESS(rc))
-    {
-        /* Ignore CPU stepping. */
-        au32CpuId[4]      &=  0xfffffff0;
-        au32CpuIdSaved[4] &=  0xfffffff0;
-
-        /* Ignore APIC ID (AMD specs). */
-        au32CpuId[5]      &= ~0xff000000;
-        au32CpuIdSaved[5] &= ~0xff000000;
-
-        /* Ignore the number of Logical CPUs (AMD specs). */
-        au32CpuId[5]      &= ~0x00ff0000;
-        au32CpuIdSaved[5] &= ~0x00ff0000;
-
-        /* Ignore some advanced capability bits, that we don't expose to the guest. */
-        au32CpuId[6]      &= ~(   X86_CPUID_FEATURE_ECX_DTES64
-                               |  X86_CPUID_FEATURE_ECX_VMX
-                               |  X86_CPUID_FEATURE_ECX_SMX
-                               |  X86_CPUID_FEATURE_ECX_EST
-                               |  X86_CPUID_FEATURE_ECX_TM2
-                               |  X86_CPUID_FEATURE_ECX_CNTXID
-                               |  X86_CPUID_FEATURE_ECX_TPRUPDATE
-                               |  X86_CPUID_FEATURE_ECX_PDCM
-                               |  X86_CPUID_FEATURE_ECX_DCA
-                               |  X86_CPUID_FEATURE_ECX_X2APIC
-                              );
-        au32CpuIdSaved[6] &= ~(   X86_CPUID_FEATURE_ECX_DTES64
-                               |  X86_CPUID_FEATURE_ECX_VMX
-                               |  X86_CPUID_FEATURE_ECX_SMX
-                               |  X86_CPUID_FEATURE_ECX_EST
-                               |  X86_CPUID_FEATURE_ECX_TM2
-                               |  X86_CPUID_FEATURE_ECX_CNTXID
-                               |  X86_CPUID_FEATURE_ECX_TPRUPDATE
-                               |  X86_CPUID_FEATURE_ECX_PDCM
-                               |  X86_CPUID_FEATURE_ECX_DCA
-                               |  X86_CPUID_FEATURE_ECX_X2APIC
-                              );
-
-        /* Make sure we don't forget to update the masks when enabling
-         * features in the future.
-         */
-        AssertRelease(!(pVM->cpum.s.aGuestCpuIdStd[1].ecx &
-                              (   X86_CPUID_FEATURE_ECX_DTES64
-                               |  X86_CPUID_FEATURE_ECX_VMX
-                               |  X86_CPUID_FEATURE_ECX_SMX
-                               |  X86_CPUID_FEATURE_ECX_EST
-                               |  X86_CPUID_FEATURE_ECX_TM2
-                               |  X86_CPUID_FEATURE_ECX_CNTXID
-                               |  X86_CPUID_FEATURE_ECX_TPRUPDATE
-                               |  X86_CPUID_FEATURE_ECX_PDCM
-                               |  X86_CPUID_FEATURE_ECX_DCA
-                               |  X86_CPUID_FEATURE_ECX_X2APIC
-                              )));
-        /* do the compare */
-        if (memcmp(au32CpuIdSaved, au32CpuId, sizeof(au32CpuIdSaved)))
-        {
-            if (SSMR3HandleGetAfter(pSSM) == SSMAFTER_DEBUG_IT)
-                LogRel(("cpumR3LoadExec: CpuId mismatch! (ignored due to SSMAFTER_DEBUG_IT)\n"
-                        "Saved=%.*Rhxs\n"
-                        "Real =%.*Rhxs\n",
-                        sizeof(au32CpuIdSaved), au32CpuIdSaved,
-                        sizeof(au32CpuId), au32CpuId));
-            else
-            {
-                LogRel(("cpumR3LoadExec: CpuId mismatch!\n"
-                        "Saved=%.*Rhxs\n"
-                        "Real =%.*Rhxs\n",
-                        sizeof(au32CpuIdSaved), au32CpuIdSaved,
-                        sizeof(au32CpuId), au32CpuId));
-                rc = VERR_SSM_LOAD_CPUID_MISMATCH;
-            }
-        }
-    }
-
-    return rc;
+    return cpumR3LoadCpuIdPre32(pVM, pSSM, uVersion);
 }
 
 
@@ -3360,50 +1751,150 @@ static void cpumR3InfoOne(PVM pVM, PCPUMCTX pCtx, PCCPUMCTXCORE pCtxCore, PCDBGF
                     pszPrefix, pCtx->tr.Sel, pCtx->tr.u64Base, pCtx->tr.u32Limit, pCtx->tr.Attr.u,
                     pszPrefix, pCtx->SysEnter.cs, pCtx->SysEnter.eip, pCtx->SysEnter.esp);
 
-            pHlp->pfnPrintf(pHlp,
-                "%sFCW=%04x %sFSW=%04x %sFTW=%04x %sFOP=%04x %sMXCSR=%08x %sMXCSR_MASK=%08x\n"
-                "%sFPUIP=%08x %sCS=%04x %sRsrvd1=%04x  %sFPUDP=%08x %sDS=%04x %sRsvrd2=%04x\n"
-                ,
-                pszPrefix, pCtx->fpu.FCW,   pszPrefix, pCtx->fpu.FSW, pszPrefix, pCtx->fpu.FTW, pszPrefix, pCtx->fpu.FOP,
-                pszPrefix, pCtx->fpu.MXCSR, pszPrefix, pCtx->fpu.MXCSR_MASK,
-                pszPrefix, pCtx->fpu.FPUIP, pszPrefix, pCtx->fpu.CS,  pszPrefix, pCtx->fpu.Rsrvd1,
-                pszPrefix, pCtx->fpu.FPUDP, pszPrefix, pCtx->fpu.DS,  pszPrefix, pCtx->fpu.Rsrvd2
-                );
-            unsigned iShift = (pCtx->fpu.FSW >> 11) & 7;
-            for (unsigned iST = 0; iST < RT_ELEMENTS(pCtx->fpu.aRegs); iST++)
+            pHlp->pfnPrintf(pHlp, "%sxcr=%016RX64 %sxcr1=%016RX64 %sxss=%016RX64 (fXStateMask=%016RX64)\n",
+                            pszPrefix, pCtx->aXcr[0], pszPrefix, pCtx->aXcr[1],
+                            pszPrefix, UINT64_C(0) /** @todo XSS */, pCtx->fXStateMask);
+            if (pCtx->CTX_SUFF(pXState))
             {
-                unsigned iFPR        = (iST + iShift) % RT_ELEMENTS(pCtx->fpu.aRegs);
-                unsigned uTag        = pCtx->fpu.FTW & (1 << iFPR) ? 1 : 0;
-                char     chSign      = pCtx->fpu.aRegs[0].au16[4] & 0x8000 ? '-' : '+';
-                unsigned iInteger    = (unsigned)(pCtx->fpu.aRegs[0].au64[0] >> 63);
-                uint64_t u64Fraction = pCtx->fpu.aRegs[0].au64[0] & UINT64_C(0x7fffffffffffffff);
-                unsigned uExponent   = pCtx->fpu.aRegs[0].au16[4] & 0x7fff;
-                /** @todo This isn't entirenly correct and needs more work! */
+                PX86FXSTATE pFpuCtx = &pCtx->CTX_SUFF(pXState)->x87;
                 pHlp->pfnPrintf(pHlp,
-                                "%sST(%u)=%sFPR%u={%04RX16'%08RX32'%08RX32} t%d %c%u.%022llu ^ %u",
-                                pszPrefix, iST, pszPrefix, iFPR,
-                                pCtx->fpu.aRegs[0].au16[4], pCtx->fpu.aRegs[0].au32[1], pCtx->fpu.aRegs[0].au32[0],
-                                uTag, chSign, iInteger, u64Fraction, uExponent);
-                if (pCtx->fpu.aRegs[0].au16[5] || pCtx->fpu.aRegs[0].au16[6] || pCtx->fpu.aRegs[0].au16[7])
-                    pHlp->pfnPrintf(pHlp, " res={%04RX16,%04RX16,%04RX16}\n",
-                                    pCtx->fpu.aRegs[0].au16[5], pCtx->fpu.aRegs[0].au16[6], pCtx->fpu.aRegs[0].au16[7]);
+                    "%sFCW=%04x %sFSW=%04x %sFTW=%04x %sFOP=%04x %sMXCSR=%08x %sMXCSR_MASK=%08x\n"
+                    "%sFPUIP=%08x %sCS=%04x %sRsrvd1=%04x  %sFPUDP=%08x %sDS=%04x %sRsvrd2=%04x\n"
+                    ,
+                    pszPrefix, pFpuCtx->FCW,   pszPrefix, pFpuCtx->FSW, pszPrefix, pFpuCtx->FTW, pszPrefix, pFpuCtx->FOP,
+                    pszPrefix, pFpuCtx->MXCSR, pszPrefix, pFpuCtx->MXCSR_MASK,
+                    pszPrefix, pFpuCtx->FPUIP, pszPrefix, pFpuCtx->CS,  pszPrefix, pFpuCtx->Rsrvd1,
+                    pszPrefix, pFpuCtx->FPUDP, pszPrefix, pFpuCtx->DS,  pszPrefix, pFpuCtx->Rsrvd2
+                    );
+                unsigned iShift = (pFpuCtx->FSW >> 11) & 7;
+                for (unsigned iST = 0; iST < RT_ELEMENTS(pFpuCtx->aRegs); iST++)
+                {
+                    unsigned iFPR        = (iST + iShift) % RT_ELEMENTS(pFpuCtx->aRegs);
+                    unsigned uTag        = pFpuCtx->FTW & (1 << iFPR) ? 1 : 0;
+                    char     chSign      = pFpuCtx->aRegs[0].au16[4] & 0x8000 ? '-' : '+';
+                    unsigned iInteger    = (unsigned)(pFpuCtx->aRegs[0].au64[0] >> 63);
+                    uint64_t u64Fraction = pFpuCtx->aRegs[0].au64[0] & UINT64_C(0x7fffffffffffffff);
+                    unsigned uExponent   = pFpuCtx->aRegs[0].au16[4] & 0x7fff;
+                    /** @todo This isn't entirenly correct and needs more work! */
+                    pHlp->pfnPrintf(pHlp,
+                                    "%sST(%u)=%sFPR%u={%04RX16'%08RX32'%08RX32} t%d %c%u.%022llu ^ %u (*)",
+                                    pszPrefix, iST, pszPrefix, iFPR,
+                                    pFpuCtx->aRegs[0].au16[4], pFpuCtx->aRegs[0].au32[1], pFpuCtx->aRegs[0].au32[0],
+                                    uTag, chSign, iInteger, u64Fraction, uExponent);
+                    if (pFpuCtx->aRegs[0].au16[5] || pFpuCtx->aRegs[0].au16[6] || pFpuCtx->aRegs[0].au16[7])
+                        pHlp->pfnPrintf(pHlp, " res={%04RX16,%04RX16,%04RX16}\n",
+                                        pFpuCtx->aRegs[0].au16[5], pFpuCtx->aRegs[0].au16[6], pFpuCtx->aRegs[0].au16[7]);
+                    else
+                        pHlp->pfnPrintf(pHlp, "\n");
+                }
+
+                /* XMM/YMM/ZMM registers. */
+                if (pCtx->fXStateMask & XSAVE_C_YMM)
+                {
+                    PCX86XSAVEYMMHI pYmmHiCtx = CPUMCTX_XSAVE_C_PTR(pCtx, XSAVE_C_YMM_BIT, PCX86XSAVEYMMHI);
+                    if (!(pCtx->fXStateMask & XSAVE_C_ZMM_HI256))
+                        for (unsigned i = 0; i < RT_ELEMENTS(pFpuCtx->aXMM); i++)
+                            pHlp->pfnPrintf(pHlp, "%sYMM%u%s=%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32\n",
+                                            pszPrefix, i, i < 10 ? " " : "",
+                                            pYmmHiCtx->aYmmHi[i].au32[3],
+                                            pYmmHiCtx->aYmmHi[i].au32[2],
+                                            pYmmHiCtx->aYmmHi[i].au32[1],
+                                            pYmmHiCtx->aYmmHi[i].au32[0],
+                                            pFpuCtx->aXMM[i].au32[3],
+                                            pFpuCtx->aXMM[i].au32[2],
+                                            pFpuCtx->aXMM[i].au32[1],
+                                            pFpuCtx->aXMM[i].au32[0]);
+                    else
+                    {
+                        PCX86XSAVEZMMHI256 pZmmHi256 = CPUMCTX_XSAVE_C_PTR(pCtx, XSAVE_C_ZMM_HI256_BIT, PCX86XSAVEZMMHI256);
+                        for (unsigned i = 0; i < RT_ELEMENTS(pFpuCtx->aXMM); i++)
+                            pHlp->pfnPrintf(pHlp,
+                                            "%sZMM%u%s=%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32''%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32\n",
+                                            pszPrefix, i, i < 10 ? " " : "",
+                                            pZmmHi256->aHi256Regs[i].au32[7],
+                                            pZmmHi256->aHi256Regs[i].au32[6],
+                                            pZmmHi256->aHi256Regs[i].au32[5],
+                                            pZmmHi256->aHi256Regs[i].au32[4],
+                                            pZmmHi256->aHi256Regs[i].au32[3],
+                                            pZmmHi256->aHi256Regs[i].au32[2],
+                                            pZmmHi256->aHi256Regs[i].au32[1],
+                                            pZmmHi256->aHi256Regs[i].au32[0],
+                                            pYmmHiCtx->aYmmHi[i].au32[3],
+                                            pYmmHiCtx->aYmmHi[i].au32[2],
+                                            pYmmHiCtx->aYmmHi[i].au32[1],
+                                            pYmmHiCtx->aYmmHi[i].au32[0],
+                                            pFpuCtx->aXMM[i].au32[3],
+                                            pFpuCtx->aXMM[i].au32[2],
+                                            pFpuCtx->aXMM[i].au32[1],
+                                            pFpuCtx->aXMM[i].au32[0]);
+
+                        PCX86XSAVEZMM16HI pZmm16Hi = CPUMCTX_XSAVE_C_PTR(pCtx, XSAVE_C_ZMM_16HI_BIT, PCX86XSAVEZMM16HI);
+                        for (unsigned i = 0; i < RT_ELEMENTS(pZmm16Hi->aRegs); i++)
+                            pHlp->pfnPrintf(pHlp,
+                                            "%sZMM%u=%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32''%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32'%08RX32\n",
+                                            pszPrefix, i + 16,
+                                            pZmm16Hi->aRegs[i].au32[15],
+                                            pZmm16Hi->aRegs[i].au32[14],
+                                            pZmm16Hi->aRegs[i].au32[13],
+                                            pZmm16Hi->aRegs[i].au32[12],
+                                            pZmm16Hi->aRegs[i].au32[11],
+                                            pZmm16Hi->aRegs[i].au32[10],
+                                            pZmm16Hi->aRegs[i].au32[9],
+                                            pZmm16Hi->aRegs[i].au32[8],
+                                            pZmm16Hi->aRegs[i].au32[7],
+                                            pZmm16Hi->aRegs[i].au32[6],
+                                            pZmm16Hi->aRegs[i].au32[5],
+                                            pZmm16Hi->aRegs[i].au32[4],
+                                            pZmm16Hi->aRegs[i].au32[3],
+                                            pZmm16Hi->aRegs[i].au32[2],
+                                            pZmm16Hi->aRegs[i].au32[1],
+                                            pZmm16Hi->aRegs[i].au32[0]);
+                    }
+                }
                 else
-                    pHlp->pfnPrintf(pHlp, "\n");
+                    for (unsigned i = 0; i < RT_ELEMENTS(pFpuCtx->aXMM); i++)
+                        pHlp->pfnPrintf(pHlp,
+                                        i & 1
+                                        ? "%sXMM%u%s=%08RX32'%08RX32'%08RX32'%08RX32\n"
+                                        : "%sXMM%u%s=%08RX32'%08RX32'%08RX32'%08RX32  ",
+                                        pszPrefix, i, i < 10 ? " " : "",
+                                        pFpuCtx->aXMM[i].au32[3],
+                                        pFpuCtx->aXMM[i].au32[2],
+                                        pFpuCtx->aXMM[i].au32[1],
+                                        pFpuCtx->aXMM[i].au32[0]);
+
+                if (pCtx->fXStateMask & XSAVE_C_OPMASK)
+                {
+                    PCX86XSAVEOPMASK pOpMask = CPUMCTX_XSAVE_C_PTR(pCtx, XSAVE_C_OPMASK_BIT, PCX86XSAVEOPMASK);
+                    for (unsigned i = 0; i < RT_ELEMENTS(pOpMask->aKRegs); i += 4)
+                        pHlp->pfnPrintf(pHlp, "%sK%u=%016RX64  %sK%u=%016RX64  %sK%u=%016RX64  %sK%u=%016RX64\n",
+                                        pszPrefix, i + 0, pOpMask->aKRegs[i + 0],
+                                        pszPrefix, i + 1, pOpMask->aKRegs[i + 1],
+                                        pszPrefix, i + 2, pOpMask->aKRegs[i + 2],
+                                        pszPrefix, i + 3, pOpMask->aKRegs[i + 3]);
+                }
+
+                if (pCtx->fXStateMask & XSAVE_C_BNDREGS)
+                {
+                    PCX86XSAVEBNDREGS pBndRegs = CPUMCTX_XSAVE_C_PTR(pCtx, XSAVE_C_BNDREGS_BIT, PCX86XSAVEBNDREGS);
+                    for (unsigned i = 0; i < RT_ELEMENTS(pBndRegs->aRegs); i += 2)
+                        pHlp->pfnPrintf(pHlp, "%sBNDREG%u=%016RX64/%016RX64  %sBNDREG%u=%016RX64/%016RX64\n",
+                                        pszPrefix, i, pBndRegs->aRegs[i].uLowerBound, pBndRegs->aRegs[i].uUpperBound,
+                                        pszPrefix, i + 1, pBndRegs->aRegs[i + 1].uLowerBound, pBndRegs->aRegs[i + 1].uUpperBound);
+                }
+
+                if (pCtx->fXStateMask & XSAVE_C_BNDCSR)
+                {
+                    PCX86XSAVEBNDCFG pBndCfg = CPUMCTX_XSAVE_C_PTR(pCtx, XSAVE_C_BNDCSR_BIT, PCX86XSAVEBNDCFG);
+                    pHlp->pfnPrintf(pHlp, "%sBNDCFG.CONFIG=%016RX64 %sBNDCFG.STATUS=%016RX64\n",
+                                    pszPrefix, pBndCfg->fConfig, pszPrefix, pBndCfg->fStatus);
+                }
+
+                for (unsigned i = 0; i < RT_ELEMENTS(pFpuCtx->au32RsrvdRest); i++)
+                    if (pFpuCtx->au32RsrvdRest[i])
+                        pHlp->pfnPrintf(pHlp, "%sRsrvdRest[i]=%RX32 (offset=%#x)\n",
+                                        pszPrefix, i, pFpuCtx->au32RsrvdRest[i], RT_OFFSETOF(X86FXSTATE, au32RsrvdRest[i]) );
             }
-            for (unsigned iXMM = 0; iXMM < RT_ELEMENTS(pCtx->fpu.aXMM); iXMM++)
-                pHlp->pfnPrintf(pHlp,
-                                iXMM & 1
-                                ? "%sXMM%u%s=%08RX32'%08RX32'%08RX32'%08RX32\n"
-                                : "%sXMM%u%s=%08RX32'%08RX32'%08RX32'%08RX32  ",
-                                pszPrefix, iXMM, iXMM < 10 ? " " : "",
-                                pCtx->fpu.aXMM[iXMM].au32[3],
-                                pCtx->fpu.aXMM[iXMM].au32[2],
-                                pCtx->fpu.aXMM[iXMM].au32[1],
-                                pCtx->fpu.aXMM[iXMM].au32[0]);
-            for (unsigned i = 0; i < RT_ELEMENTS(pCtx->fpu.au32RsrvdRest); i++)
-                if (pCtx->fpu.au32RsrvdRest[i])
-                    pHlp->pfnPrintf(pHlp, "%sRsrvdRest[i]=%RX32 (offset=%#x)\n",
-                                    pszPrefix, i, pCtx->fpu.au32RsrvdRest[i], RT_OFFSETOF(X86FXSTATE, au32RsrvdRest[i]) );
 
             pHlp->pfnPrintf(pHlp,
                 "%sEFER         =%016RX64\n"
@@ -3644,720 +2135,6 @@ static DECLCALLBACK(void) cpumR3InfoHost(PVM pVM, PCDBGFINFOHLP pHlp, const char
 #endif
 }
 
-
-/**
- * Get L1 cache / TLS associativity.
- */
-static const char *getCacheAss(unsigned u, char *pszBuf)
-{
-    if (u == 0)
-        return "res0  ";
-    if (u == 1)
-        return "direct";
-    if (u == 255)
-        return "fully";
-    if (u >= 256)
-        return "???";
-
-    RTStrPrintf(pszBuf, 16, "%d way", u);
-    return pszBuf;
-}
-
-
-/**
- * Get L2 cache associativity.
- */
-const char *getL2CacheAss(unsigned u)
-{
-    switch (u)
-    {
-        case 0:  return "off   ";
-        case 1:  return "direct";
-        case 2:  return "2 way ";
-        case 3:  return "res3  ";
-        case 4:  return "4 way ";
-        case 5:  return "res5  ";
-        case 6:  return "8 way ";
-        case 7:  return "res7  ";
-        case 8:  return "16 way";
-        case 9:  return "res9  ";
-        case 10: return "res10 ";
-        case 11: return "res11 ";
-        case 12: return "res12 ";
-        case 13: return "res13 ";
-        case 14: return "res14 ";
-        case 15: return "fully ";
-        default: return "????";
-    }
-}
-
-
-/**
- * Display the guest CpuId leaves.
- *
- * @param   pVM         Pointer to the VM.
- * @param   pHlp        The info helper functions.
- * @param   pszArgs     "terse", "default" or "verbose".
- */
-static DECLCALLBACK(void) cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
-{
-    /*
-     * Parse the argument.
-     */
-    unsigned iVerbosity = 1;
-    if (pszArgs)
-    {
-        pszArgs = RTStrStripL(pszArgs);
-        if (!strcmp(pszArgs, "terse"))
-            iVerbosity--;
-        else if (!strcmp(pszArgs, "verbose"))
-            iVerbosity++;
-    }
-
-    /*
-     * Start cracking.
-     */
-    CPUMCPUID   Host;
-    CPUMCPUID   Guest;
-    unsigned    cStdMax = pVM->cpum.s.aGuestCpuIdStd[0].eax;
-
-    uint32_t    cStdHstMax;
-    uint32_t    dummy;
-    ASMCpuIdExSlow(0, 0, 0, 0, &cStdHstMax, &dummy, &dummy, &dummy);
-
-    unsigned    cStdLstMax = RT_MAX(RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd), cStdHstMax);
-
-    pHlp->pfnPrintf(pHlp,
-                    "         RAW Standard CPUIDs\n"
-                    "     Function  eax      ebx      ecx      edx\n");
-    for (unsigned i = 0; i <= cStdLstMax ; i++)
-    {
-        if (i < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdStd))
-        {
-            Guest = pVM->cpum.s.aGuestCpuIdStd[i];
-            ASMCpuIdExSlow(i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
-
-            pHlp->pfnPrintf(pHlp,
-                            "Gst: %08x  %08x %08x %08x %08x%s\n"
-                            "Hst:           %08x %08x %08x %08x\n",
-                            i, Guest.eax, Guest.ebx, Guest.ecx, Guest.edx,
-                            i <= cStdMax ? "" : "*",
-                            Host.eax, Host.ebx, Host.ecx, Host.edx);
-        }
-        else
-        {
-            ASMCpuIdExSlow(i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
-
-            pHlp->pfnPrintf(pHlp,
-                            "Hst: %08x  %08x %08x %08x %08x\n",
-                            i, Host.eax, Host.ebx, Host.ecx, Host.edx);
-        }
-    }
-
-    /*
-     * If verbose, decode it.
-     */
-    if (iVerbosity)
-    {
-        Guest = pVM->cpum.s.aGuestCpuIdStd[0];
-        pHlp->pfnPrintf(pHlp,
-                        "Name:                            %.04s%.04s%.04s\n"
-                        "Supports:                        0-%x\n",
-                        &Guest.ebx, &Guest.edx, &Guest.ecx, Guest.eax);
-    }
-
-    /*
-     * Get Features.
-     */
-    bool const fIntel = ASMIsIntelCpuEx(pVM->cpum.s.aGuestCpuIdStd[0].ebx,
-                                        pVM->cpum.s.aGuestCpuIdStd[0].ecx,
-                                        pVM->cpum.s.aGuestCpuIdStd[0].edx);
-    if (cStdMax >= 1 && iVerbosity)
-    {
-        static const char * const s_apszTypes[4] = { "primary", "overdrive", "MP", "reserved" };
-
-        Guest = pVM->cpum.s.aGuestCpuIdStd[1];
-        uint32_t uEAX = Guest.eax;
-
-        pHlp->pfnPrintf(pHlp,
-                        "Family:                          %d  \tExtended: %d \tEffective: %d\n"
-                        "Model:                           %d  \tExtended: %d \tEffective: %d\n"
-                        "Stepping:                        %d\n"
-                        "Type:                            %d (%s)\n"
-                        "APIC ID:                         %#04x\n"
-                        "Logical CPUs:                    %d\n"
-                        "CLFLUSH Size:                    %d\n"
-                        "Brand ID:                        %#04x\n",
-                        (uEAX >> 8) & 0xf, (uEAX >> 20) & 0x7f, ASMGetCpuFamily(uEAX),
-                        (uEAX >> 4) & 0xf, (uEAX >> 16) & 0x0f, ASMGetCpuModel(uEAX, fIntel),
-                        ASMGetCpuStepping(uEAX),
-                        (uEAX >> 12) & 3, s_apszTypes[(uEAX >> 12) & 3],
-                        (Guest.ebx >> 24) & 0xff,
-                        (Guest.ebx >> 16) & 0xff,
-                        (Guest.ebx >>  8) & 0xff,
-                        (Guest.ebx >>  0) & 0xff);
-        if (iVerbosity == 1)
-        {
-            uint32_t uEDX = Guest.edx;
-            pHlp->pfnPrintf(pHlp, "Features EDX:                   ");
-            if (uEDX & RT_BIT(0))   pHlp->pfnPrintf(pHlp, " FPU");
-            if (uEDX & RT_BIT(1))   pHlp->pfnPrintf(pHlp, " VME");
-            if (uEDX & RT_BIT(2))   pHlp->pfnPrintf(pHlp, " DE");
-            if (uEDX & RT_BIT(3))   pHlp->pfnPrintf(pHlp, " PSE");
-            if (uEDX & RT_BIT(4))   pHlp->pfnPrintf(pHlp, " TSC");
-            if (uEDX & RT_BIT(5))   pHlp->pfnPrintf(pHlp, " MSR");
-            if (uEDX & RT_BIT(6))   pHlp->pfnPrintf(pHlp, " PAE");
-            if (uEDX & RT_BIT(7))   pHlp->pfnPrintf(pHlp, " MCE");
-            if (uEDX & RT_BIT(8))   pHlp->pfnPrintf(pHlp, " CX8");
-            if (uEDX & RT_BIT(9))   pHlp->pfnPrintf(pHlp, " APIC");
-            if (uEDX & RT_BIT(10))  pHlp->pfnPrintf(pHlp, " 10");
-            if (uEDX & RT_BIT(11))  pHlp->pfnPrintf(pHlp, " SEP");
-            if (uEDX & RT_BIT(12))  pHlp->pfnPrintf(pHlp, " MTRR");
-            if (uEDX & RT_BIT(13))  pHlp->pfnPrintf(pHlp, " PGE");
-            if (uEDX & RT_BIT(14))  pHlp->pfnPrintf(pHlp, " MCA");
-            if (uEDX & RT_BIT(15))  pHlp->pfnPrintf(pHlp, " CMOV");
-            if (uEDX & RT_BIT(16))  pHlp->pfnPrintf(pHlp, " PAT");
-            if (uEDX & RT_BIT(17))  pHlp->pfnPrintf(pHlp, " PSE36");
-            if (uEDX & RT_BIT(18))  pHlp->pfnPrintf(pHlp, " PSN");
-            if (uEDX & RT_BIT(19))  pHlp->pfnPrintf(pHlp, " CLFSH");
-            if (uEDX & RT_BIT(20))  pHlp->pfnPrintf(pHlp, " 20");
-            if (uEDX & RT_BIT(21))  pHlp->pfnPrintf(pHlp, " DS");
-            if (uEDX & RT_BIT(22))  pHlp->pfnPrintf(pHlp, " ACPI");
-            if (uEDX & RT_BIT(23))  pHlp->pfnPrintf(pHlp, " MMX");
-            if (uEDX & RT_BIT(24))  pHlp->pfnPrintf(pHlp, " FXSR");
-            if (uEDX & RT_BIT(25))  pHlp->pfnPrintf(pHlp, " SSE");
-            if (uEDX & RT_BIT(26))  pHlp->pfnPrintf(pHlp, " SSE2");
-            if (uEDX & RT_BIT(27))  pHlp->pfnPrintf(pHlp, " SS");
-            if (uEDX & RT_BIT(28))  pHlp->pfnPrintf(pHlp, " HTT");
-            if (uEDX & RT_BIT(29))  pHlp->pfnPrintf(pHlp, " TM");
-            if (uEDX & RT_BIT(30))  pHlp->pfnPrintf(pHlp, " 30");
-            if (uEDX & RT_BIT(31))  pHlp->pfnPrintf(pHlp, " PBE");
-            pHlp->pfnPrintf(pHlp, "\n");
-
-            uint32_t uECX = Guest.ecx;
-            pHlp->pfnPrintf(pHlp, "Features ECX:                   ");
-            if (uECX & RT_BIT(0))   pHlp->pfnPrintf(pHlp, " SSE3");
-            if (uECX & RT_BIT(1))   pHlp->pfnPrintf(pHlp, " PCLMUL");
-            if (uECX & RT_BIT(2))   pHlp->pfnPrintf(pHlp, " DTES64");
-            if (uECX & RT_BIT(3))   pHlp->pfnPrintf(pHlp, " MONITOR");
-            if (uECX & RT_BIT(4))   pHlp->pfnPrintf(pHlp, " DS-CPL");
-            if (uECX & RT_BIT(5))   pHlp->pfnPrintf(pHlp, " VMX");
-            if (uECX & RT_BIT(6))   pHlp->pfnPrintf(pHlp, " SMX");
-            if (uECX & RT_BIT(7))   pHlp->pfnPrintf(pHlp, " EST");
-            if (uECX & RT_BIT(8))   pHlp->pfnPrintf(pHlp, " TM2");
-            if (uECX & RT_BIT(9))   pHlp->pfnPrintf(pHlp, " SSSE3");
-            if (uECX & RT_BIT(10))  pHlp->pfnPrintf(pHlp, " CNXT-ID");
-            if (uECX & RT_BIT(11))  pHlp->pfnPrintf(pHlp, " 11");
-            if (uECX & RT_BIT(12))  pHlp->pfnPrintf(pHlp, " FMA");
-            if (uECX & RT_BIT(13))  pHlp->pfnPrintf(pHlp, " CX16");
-            if (uECX & RT_BIT(14))  pHlp->pfnPrintf(pHlp, " TPRUPDATE");
-            if (uECX & RT_BIT(15))  pHlp->pfnPrintf(pHlp, " PDCM");
-            if (uECX & RT_BIT(16))  pHlp->pfnPrintf(pHlp, " 16");
-            if (uECX & RT_BIT(17))  pHlp->pfnPrintf(pHlp, " PCID");
-            if (uECX & RT_BIT(18))  pHlp->pfnPrintf(pHlp, " DCA");
-            if (uECX & RT_BIT(19))  pHlp->pfnPrintf(pHlp, " SSE4.1");
-            if (uECX & RT_BIT(20))  pHlp->pfnPrintf(pHlp, " SSE4.2");
-            if (uECX & RT_BIT(21))  pHlp->pfnPrintf(pHlp, " X2APIC");
-            if (uECX & RT_BIT(22))  pHlp->pfnPrintf(pHlp, " MOVBE");
-            if (uECX & RT_BIT(23))  pHlp->pfnPrintf(pHlp, " POPCNT");
-            if (uECX & RT_BIT(24))  pHlp->pfnPrintf(pHlp, " TSCDEADL");
-            if (uECX & RT_BIT(25))  pHlp->pfnPrintf(pHlp, " AES");
-            if (uECX & RT_BIT(26))  pHlp->pfnPrintf(pHlp, " XSAVE");
-            if (uECX & RT_BIT(27))  pHlp->pfnPrintf(pHlp, " OSXSAVE");
-            if (uECX & RT_BIT(28))  pHlp->pfnPrintf(pHlp, " AVX");
-            if (uECX & RT_BIT(29))  pHlp->pfnPrintf(pHlp, " F16C");
-            if (uECX & RT_BIT(30))  pHlp->pfnPrintf(pHlp, " RDRAND");
-            if (uECX & RT_BIT(31))  pHlp->pfnPrintf(pHlp, " HVP");
-            pHlp->pfnPrintf(pHlp, "\n");
-        }
-        else
-        {
-            ASMCpuIdExSlow(1, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
-
-            X86CPUIDFEATEDX EdxHost  = *(PX86CPUIDFEATEDX)&Host.edx;
-            X86CPUIDFEATECX EcxHost  = *(PX86CPUIDFEATECX)&Host.ecx;
-            X86CPUIDFEATEDX EdxGuest = *(PX86CPUIDFEATEDX)&Guest.edx;
-            X86CPUIDFEATECX EcxGuest = *(PX86CPUIDFEATECX)&Guest.ecx;
-
-            pHlp->pfnPrintf(pHlp, "Mnemonic - Description                 = guest (host)\n");
-            pHlp->pfnPrintf(pHlp, "FPU - x87 FPU on Chip                  = %d (%d)\n",  EdxGuest.u1FPU,        EdxHost.u1FPU);
-            pHlp->pfnPrintf(pHlp, "VME - Virtual 8086 Mode Enhancements   = %d (%d)\n",  EdxGuest.u1VME,        EdxHost.u1VME);
-            pHlp->pfnPrintf(pHlp, "DE - Debugging extensions              = %d (%d)\n",  EdxGuest.u1DE,         EdxHost.u1DE);
-            pHlp->pfnPrintf(pHlp, "PSE - Page Size Extension              = %d (%d)\n",  EdxGuest.u1PSE,        EdxHost.u1PSE);
-            pHlp->pfnPrintf(pHlp, "TSC - Time Stamp Counter               = %d (%d)\n",  EdxGuest.u1TSC,        EdxHost.u1TSC);
-            pHlp->pfnPrintf(pHlp, "MSR - Model Specific Registers         = %d (%d)\n",  EdxGuest.u1MSR,        EdxHost.u1MSR);
-            pHlp->pfnPrintf(pHlp, "PAE - Physical Address Extension       = %d (%d)\n",  EdxGuest.u1PAE,        EdxHost.u1PAE);
-            pHlp->pfnPrintf(pHlp, "MCE - Machine Check Exception          = %d (%d)\n",  EdxGuest.u1MCE,        EdxHost.u1MCE);
-            pHlp->pfnPrintf(pHlp, "CX8 - CMPXCHG8B instruction            = %d (%d)\n",  EdxGuest.u1CX8,        EdxHost.u1CX8);
-            pHlp->pfnPrintf(pHlp, "APIC - APIC On-Chip                    = %d (%d)\n",  EdxGuest.u1APIC,       EdxHost.u1APIC);
-            pHlp->pfnPrintf(pHlp, "10 - Reserved                          = %d (%d)\n",  EdxGuest.u1Reserved1,  EdxHost.u1Reserved1);
-            pHlp->pfnPrintf(pHlp, "SEP - SYSENTER and SYSEXIT             = %d (%d)\n",  EdxGuest.u1SEP,        EdxHost.u1SEP);
-            pHlp->pfnPrintf(pHlp, "MTRR - Memory Type Range Registers     = %d (%d)\n",  EdxGuest.u1MTRR,       EdxHost.u1MTRR);
-            pHlp->pfnPrintf(pHlp, "PGE - PTE Global Bit                   = %d (%d)\n",  EdxGuest.u1PGE,        EdxHost.u1PGE);
-            pHlp->pfnPrintf(pHlp, "MCA - Machine Check Architecture       = %d (%d)\n",  EdxGuest.u1MCA,        EdxHost.u1MCA);
-            pHlp->pfnPrintf(pHlp, "CMOV - Conditional Move Instructions   = %d (%d)\n",  EdxGuest.u1CMOV,       EdxHost.u1CMOV);
-            pHlp->pfnPrintf(pHlp, "PAT - Page Attribute Table             = %d (%d)\n",  EdxGuest.u1PAT,        EdxHost.u1PAT);
-            pHlp->pfnPrintf(pHlp, "PSE-36 - 36-bit Page Size Extention    = %d (%d)\n",  EdxGuest.u1PSE36,      EdxHost.u1PSE36);
-            pHlp->pfnPrintf(pHlp, "PSN - Processor Serial Number          = %d (%d)\n",  EdxGuest.u1PSN,        EdxHost.u1PSN);
-            pHlp->pfnPrintf(pHlp, "CLFSH - CLFLUSH Instruction.           = %d (%d)\n",  EdxGuest.u1CLFSH,      EdxHost.u1CLFSH);
-            pHlp->pfnPrintf(pHlp, "20 - Reserved                          = %d (%d)\n",  EdxGuest.u1Reserved2,  EdxHost.u1Reserved2);
-            pHlp->pfnPrintf(pHlp, "DS - Debug Store                       = %d (%d)\n",  EdxGuest.u1DS,         EdxHost.u1DS);
-            pHlp->pfnPrintf(pHlp, "ACPI - Thermal Mon. & Soft. Clock Ctrl.= %d (%d)\n",  EdxGuest.u1ACPI,       EdxHost.u1ACPI);
-            pHlp->pfnPrintf(pHlp, "MMX - Intel MMX Technology             = %d (%d)\n",  EdxGuest.u1MMX,        EdxHost.u1MMX);
-            pHlp->pfnPrintf(pHlp, "FXSR - FXSAVE and FXRSTOR Instructions = %d (%d)\n",  EdxGuest.u1FXSR,       EdxHost.u1FXSR);
-            pHlp->pfnPrintf(pHlp, "SSE - SSE Support                      = %d (%d)\n",  EdxGuest.u1SSE,        EdxHost.u1SSE);
-            pHlp->pfnPrintf(pHlp, "SSE2 - SSE2 Support                    = %d (%d)\n",  EdxGuest.u1SSE2,       EdxHost.u1SSE2);
-            pHlp->pfnPrintf(pHlp, "SS - Self Snoop                        = %d (%d)\n",  EdxGuest.u1SS,         EdxHost.u1SS);
-            pHlp->pfnPrintf(pHlp, "HTT - Hyper-Threading Technology       = %d (%d)\n",  EdxGuest.u1HTT,        EdxHost.u1HTT);
-            pHlp->pfnPrintf(pHlp, "TM - Thermal Monitor                   = %d (%d)\n",  EdxGuest.u1TM,         EdxHost.u1TM);
-            pHlp->pfnPrintf(pHlp, "30 - Reserved                          = %d (%d)\n",  EdxGuest.u1Reserved3,  EdxHost.u1Reserved3);
-            pHlp->pfnPrintf(pHlp, "PBE - Pending Break Enable             = %d (%d)\n",  EdxGuest.u1PBE,        EdxHost.u1PBE);
-
-            pHlp->pfnPrintf(pHlp, "Supports SSE3                          = %d (%d)\n",  EcxGuest.u1SSE3,       EcxHost.u1SSE3);
-            pHlp->pfnPrintf(pHlp, "PCLMULQDQ                              = %d (%d)\n",  EcxGuest.u1PCLMULQDQ,  EcxHost.u1PCLMULQDQ);
-            pHlp->pfnPrintf(pHlp, "DS Area 64-bit layout                  = %d (%d)\n",  EcxGuest.u1DTE64,      EcxHost.u1DTE64);
-            pHlp->pfnPrintf(pHlp, "Supports MONITOR/MWAIT                 = %d (%d)\n",  EcxGuest.u1Monitor,    EcxHost.u1Monitor);
-            pHlp->pfnPrintf(pHlp, "CPL-DS - CPL Qualified Debug Store     = %d (%d)\n",  EcxGuest.u1CPLDS,      EcxHost.u1CPLDS);
-            pHlp->pfnPrintf(pHlp, "VMX - Virtual Machine Technology       = %d (%d)\n",  EcxGuest.u1VMX,        EcxHost.u1VMX);
-            pHlp->pfnPrintf(pHlp, "SMX - Safer Mode Extensions            = %d (%d)\n",  EcxGuest.u1SMX,        EcxHost.u1SMX);
-            pHlp->pfnPrintf(pHlp, "Enhanced SpeedStep Technology          = %d (%d)\n",  EcxGuest.u1EST,        EcxHost.u1EST);
-            pHlp->pfnPrintf(pHlp, "Terminal Monitor 2                     = %d (%d)\n",  EcxGuest.u1TM2,        EcxHost.u1TM2);
-            pHlp->pfnPrintf(pHlp, "Supplemental SSE3 instructions         = %d (%d)\n",  EcxGuest.u1SSSE3,      EcxHost.u1SSSE3);
-            pHlp->pfnPrintf(pHlp, "L1 Context ID                          = %d (%d)\n",  EcxGuest.u1CNTXID,     EcxHost.u1CNTXID);
-            pHlp->pfnPrintf(pHlp, "11 - Reserved                          = %d (%d)\n",  EcxGuest.u1Reserved1,  EcxHost.u1Reserved1);
-            pHlp->pfnPrintf(pHlp, "FMA extensions using YMM state         = %d (%d)\n",  EcxGuest.u1FMA,        EcxHost.u1FMA);
-            pHlp->pfnPrintf(pHlp, "CMPXCHG16B instruction                 = %d (%d)\n",  EcxGuest.u1CX16,       EcxHost.u1CX16);
-            pHlp->pfnPrintf(pHlp, "xTPR Update Control                    = %d (%d)\n",  EcxGuest.u1TPRUpdate,  EcxHost.u1TPRUpdate);
-            pHlp->pfnPrintf(pHlp, "Perf/Debug Capability MSR              = %d (%d)\n",  EcxGuest.u1PDCM,       EcxHost.u1PDCM);
-            pHlp->pfnPrintf(pHlp, "16 - Reserved                          = %d (%d)\n",  EcxGuest.u1Reserved2,  EcxHost.u1Reserved2);
-            pHlp->pfnPrintf(pHlp, "PCID - Process-context identifiers     = %d (%d)\n",  EcxGuest.u1PCID,       EcxHost.u1PCID);
-            pHlp->pfnPrintf(pHlp, "DCA - Direct Cache Access              = %d (%d)\n",  EcxGuest.u1DCA,        EcxHost.u1DCA);
-            pHlp->pfnPrintf(pHlp, "SSE4.1 instruction extensions          = %d (%d)\n",  EcxGuest.u1SSE4_1,     EcxHost.u1SSE4_1);
-            pHlp->pfnPrintf(pHlp, "SSE4.2 instruction extensions          = %d (%d)\n",  EcxGuest.u1SSE4_2,     EcxHost.u1SSE4_2);
-            pHlp->pfnPrintf(pHlp, "Supports the x2APIC extensions         = %d (%d)\n",  EcxGuest.u1x2APIC,     EcxHost.u1x2APIC);
-            pHlp->pfnPrintf(pHlp, "MOVBE instruction                      = %d (%d)\n",  EcxGuest.u1MOVBE,      EcxHost.u1MOVBE);
-            pHlp->pfnPrintf(pHlp, "POPCNT instruction                     = %d (%d)\n",  EcxGuest.u1POPCNT,     EcxHost.u1POPCNT);
-            pHlp->pfnPrintf(pHlp, "TSC-Deadline LAPIC timer mode          = %d (%d)\n",  EcxGuest.u1TSCDEADLINE,EcxHost.u1TSCDEADLINE);
-            pHlp->pfnPrintf(pHlp, "AESNI instruction extensions           = %d (%d)\n",  EcxGuest.u1AES,        EcxHost.u1AES);
-            pHlp->pfnPrintf(pHlp, "XSAVE/XRSTOR extended state feature    = %d (%d)\n",  EcxGuest.u1XSAVE,      EcxHost.u1XSAVE);
-            pHlp->pfnPrintf(pHlp, "Supports OSXSAVE                       = %d (%d)\n",  EcxGuest.u1OSXSAVE,    EcxHost.u1OSXSAVE);
-            pHlp->pfnPrintf(pHlp, "AVX instruction extensions             = %d (%d)\n",  EcxGuest.u1AVX,        EcxHost.u1AVX);
-            pHlp->pfnPrintf(pHlp, "16-bit floating point conversion instr = %d (%d)\n",  EcxGuest.u1F16C,       EcxHost.u1F16C);
-            pHlp->pfnPrintf(pHlp, "RDRAND instruction                     = %d (%d)\n",  EcxGuest.u1RDRAND,     EcxHost.u1RDRAND);
-            pHlp->pfnPrintf(pHlp, "Hypervisor Present (we're a guest)     = %d (%d)\n",  EcxGuest.u1HVP,        EcxHost.u1HVP);
-        }
-    }
-    if (cStdMax >= 2 && iVerbosity)
-    {
-        /** @todo */
-    }
-
-    /*
-     * Extended.
-     * Implemented after AMD specs.
-     */
-    unsigned    cExtMax = pVM->cpum.s.aGuestCpuIdExt[0].eax & 0xffff;
-
-    pHlp->pfnPrintf(pHlp,
-                    "\n"
-                    "         RAW Extended CPUIDs\n"
-                    "     Function  eax      ebx      ecx      edx\n");
-    bool fSupportsInvariantTsc = false;
-    for (unsigned i = 0; i < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdExt); i++)
-    {
-        Guest = pVM->cpum.s.aGuestCpuIdExt[i];
-        ASMCpuIdExSlow(0x80000000 | i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
-
-        if (   i == 7
-            && (Host.edx & X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR))
-        {
-            fSupportsInvariantTsc = true;
-        }
-        pHlp->pfnPrintf(pHlp,
-                        "Gst: %08x  %08x %08x %08x %08x%s\n"
-                        "Hst:           %08x %08x %08x %08x\n",
-                        0x80000000 | i, Guest.eax, Guest.ebx, Guest.ecx, Guest.edx,
-                        i <= cExtMax ? "" : "*",
-                        Host.eax, Host.ebx, Host.ecx, Host.edx);
-    }
-
-    /*
-     * Understandable output
-     */
-    if (iVerbosity)
-    {
-        Guest = pVM->cpum.s.aGuestCpuIdExt[0];
-        pHlp->pfnPrintf(pHlp,
-                        "Ext Name:                        %.4s%.4s%.4s\n"
-                        "Ext Supports:                    0x80000000-%#010x\n",
-                        &Guest.ebx, &Guest.edx, &Guest.ecx, Guest.eax);
-    }
-
-    if (iVerbosity && cExtMax >= 1)
-    {
-        Guest = pVM->cpum.s.aGuestCpuIdExt[1];
-        uint32_t uEAX = Guest.eax;
-        pHlp->pfnPrintf(pHlp,
-                        "Family:                          %d  \tExtended: %d \tEffective: %d\n"
-                        "Model:                           %d  \tExtended: %d \tEffective: %d\n"
-                        "Stepping:                        %d\n"
-                        "Brand ID:                        %#05x\n",
-                        (uEAX >> 8) & 0xf, (uEAX >> 20) & 0x7f, ASMGetCpuFamily(uEAX),
-                        (uEAX >> 4) & 0xf, (uEAX >> 16) & 0x0f, ASMGetCpuModel(uEAX, fIntel),
-                        ASMGetCpuStepping(uEAX),
-                        Guest.ebx & 0xfff);
-
-        if (iVerbosity == 1)
-        {
-            uint32_t uEDX = Guest.edx;
-            pHlp->pfnPrintf(pHlp, "Features EDX:                   ");
-            if (uEDX & RT_BIT(0))   pHlp->pfnPrintf(pHlp, " FPU");
-            if (uEDX & RT_BIT(1))   pHlp->pfnPrintf(pHlp, " VME");
-            if (uEDX & RT_BIT(2))   pHlp->pfnPrintf(pHlp, " DE");
-            if (uEDX & RT_BIT(3))   pHlp->pfnPrintf(pHlp, " PSE");
-            if (uEDX & RT_BIT(4))   pHlp->pfnPrintf(pHlp, " TSC");
-            if (uEDX & RT_BIT(5))   pHlp->pfnPrintf(pHlp, " MSR");
-            if (uEDX & RT_BIT(6))   pHlp->pfnPrintf(pHlp, " PAE");
-            if (uEDX & RT_BIT(7))   pHlp->pfnPrintf(pHlp, " MCE");
-            if (uEDX & RT_BIT(8))   pHlp->pfnPrintf(pHlp, " CX8");
-            if (uEDX & RT_BIT(9))   pHlp->pfnPrintf(pHlp, " APIC");
-            if (uEDX & RT_BIT(10))  pHlp->pfnPrintf(pHlp, " 10");
-            if (uEDX & RT_BIT(11))  pHlp->pfnPrintf(pHlp, " SCR");
-            if (uEDX & RT_BIT(12))  pHlp->pfnPrintf(pHlp, " MTRR");
-            if (uEDX & RT_BIT(13))  pHlp->pfnPrintf(pHlp, " PGE");
-            if (uEDX & RT_BIT(14))  pHlp->pfnPrintf(pHlp, " MCA");
-            if (uEDX & RT_BIT(15))  pHlp->pfnPrintf(pHlp, " CMOV");
-            if (uEDX & RT_BIT(16))  pHlp->pfnPrintf(pHlp, " PAT");
-            if (uEDX & RT_BIT(17))  pHlp->pfnPrintf(pHlp, " PSE36");
-            if (uEDX & RT_BIT(18))  pHlp->pfnPrintf(pHlp, " 18");
-            if (uEDX & RT_BIT(19))  pHlp->pfnPrintf(pHlp, " 19");
-            if (uEDX & RT_BIT(20))  pHlp->pfnPrintf(pHlp, " NX");
-            if (uEDX & RT_BIT(21))  pHlp->pfnPrintf(pHlp, " 21");
-            if (uEDX & RT_BIT(22))  pHlp->pfnPrintf(pHlp, " ExtMMX");
-            if (uEDX & RT_BIT(23))  pHlp->pfnPrintf(pHlp, " MMX");
-            if (uEDX & RT_BIT(24))  pHlp->pfnPrintf(pHlp, " FXSR");
-            if (uEDX & RT_BIT(25))  pHlp->pfnPrintf(pHlp, " FastFXSR");
-            if (uEDX & RT_BIT(26))  pHlp->pfnPrintf(pHlp, " Page1GB");
-            if (uEDX & RT_BIT(27))  pHlp->pfnPrintf(pHlp, " RDTSCP");
-            if (uEDX & RT_BIT(28))  pHlp->pfnPrintf(pHlp, " 28");
-            if (uEDX & RT_BIT(29))  pHlp->pfnPrintf(pHlp, " LongMode");
-            if (uEDX & RT_BIT(30))  pHlp->pfnPrintf(pHlp, " Ext3DNow");
-            if (uEDX & RT_BIT(31))  pHlp->pfnPrintf(pHlp, " 3DNow");
-            pHlp->pfnPrintf(pHlp, "\n");
-
-            uint32_t uECX = Guest.ecx;
-            pHlp->pfnPrintf(pHlp, "Features ECX:                   ");
-            if (uECX & RT_BIT(0))   pHlp->pfnPrintf(pHlp, " LAHF/SAHF");
-            if (uECX & RT_BIT(1))   pHlp->pfnPrintf(pHlp, " CMPL");
-            if (uECX & RT_BIT(2))   pHlp->pfnPrintf(pHlp, " SVM");
-            if (uECX & RT_BIT(3))   pHlp->pfnPrintf(pHlp, " ExtAPIC");
-            if (uECX & RT_BIT(4))   pHlp->pfnPrintf(pHlp, " CR8L");
-            if (uECX & RT_BIT(5))   pHlp->pfnPrintf(pHlp, " ABM");
-            if (uECX & RT_BIT(6))   pHlp->pfnPrintf(pHlp, " SSE4A");
-            if (uECX & RT_BIT(7))   pHlp->pfnPrintf(pHlp, " MISALNSSE");
-            if (uECX & RT_BIT(8))   pHlp->pfnPrintf(pHlp, " 3DNOWPRF");
-            if (uECX & RT_BIT(9))   pHlp->pfnPrintf(pHlp, " OSVW");
-            if (uECX & RT_BIT(10))  pHlp->pfnPrintf(pHlp, " IBS");
-            if (uECX & RT_BIT(11))  pHlp->pfnPrintf(pHlp, " SSE5");
-            if (uECX & RT_BIT(12))  pHlp->pfnPrintf(pHlp, " SKINIT");
-            if (uECX & RT_BIT(13))  pHlp->pfnPrintf(pHlp, " WDT");
-            for (unsigned iBit = 5; iBit < 32; iBit++)
-                if (uECX & RT_BIT(iBit))
-                    pHlp->pfnPrintf(pHlp, " %d", iBit);
-            pHlp->pfnPrintf(pHlp, "\n");
-        }
-        else
-        {
-            ASMCpuIdExSlow(0x80000001, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
-
-            uint32_t uEdxGst = Guest.edx;
-            uint32_t uEdxHst = Host.edx;
-            pHlp->pfnPrintf(pHlp, "Mnemonic - Description                 = guest (host)\n");
-            pHlp->pfnPrintf(pHlp, "FPU - x87 FPU on Chip                  = %d (%d)\n",  !!(uEdxGst & RT_BIT( 0)),  !!(uEdxHst & RT_BIT( 0)));
-            pHlp->pfnPrintf(pHlp, "VME - Virtual 8086 Mode Enhancements   = %d (%d)\n",  !!(uEdxGst & RT_BIT( 1)),  !!(uEdxHst & RT_BIT( 1)));
-            pHlp->pfnPrintf(pHlp, "DE - Debugging extensions              = %d (%d)\n",  !!(uEdxGst & RT_BIT( 2)),  !!(uEdxHst & RT_BIT( 2)));
-            pHlp->pfnPrintf(pHlp, "PSE - Page Size Extension              = %d (%d)\n",  !!(uEdxGst & RT_BIT( 3)),  !!(uEdxHst & RT_BIT( 3)));
-            pHlp->pfnPrintf(pHlp, "TSC - Time Stamp Counter               = %d (%d)\n",  !!(uEdxGst & RT_BIT( 4)),  !!(uEdxHst & RT_BIT( 4)));
-            pHlp->pfnPrintf(pHlp, "MSR - K86 Model Specific Registers     = %d (%d)\n",  !!(uEdxGst & RT_BIT( 5)),  !!(uEdxHst & RT_BIT( 5)));
-            pHlp->pfnPrintf(pHlp, "PAE - Physical Address Extension       = %d (%d)\n",  !!(uEdxGst & RT_BIT( 6)),  !!(uEdxHst & RT_BIT( 6)));
-            pHlp->pfnPrintf(pHlp, "MCE - Machine Check Exception          = %d (%d)\n",  !!(uEdxGst & RT_BIT( 7)),  !!(uEdxHst & RT_BIT( 7)));
-            pHlp->pfnPrintf(pHlp, "CX8 - CMPXCHG8B instruction            = %d (%d)\n",  !!(uEdxGst & RT_BIT( 8)),  !!(uEdxHst & RT_BIT( 8)));
-            pHlp->pfnPrintf(pHlp, "APIC - APIC On-Chip                    = %d (%d)\n",  !!(uEdxGst & RT_BIT( 9)),  !!(uEdxHst & RT_BIT( 9)));
-            pHlp->pfnPrintf(pHlp, "10 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(10)),  !!(uEdxHst & RT_BIT(10)));
-            pHlp->pfnPrintf(pHlp, "SEP - SYSCALL and SYSRET               = %d (%d)\n",  !!(uEdxGst & RT_BIT(11)),  !!(uEdxHst & RT_BIT(11)));
-            pHlp->pfnPrintf(pHlp, "MTRR - Memory Type Range Registers     = %d (%d)\n",  !!(uEdxGst & RT_BIT(12)),  !!(uEdxHst & RT_BIT(12)));
-            pHlp->pfnPrintf(pHlp, "PGE - PTE Global Bit                   = %d (%d)\n",  !!(uEdxGst & RT_BIT(13)),  !!(uEdxHst & RT_BIT(13)));
-            pHlp->pfnPrintf(pHlp, "MCA - Machine Check Architecture       = %d (%d)\n",  !!(uEdxGst & RT_BIT(14)),  !!(uEdxHst & RT_BIT(14)));
-            pHlp->pfnPrintf(pHlp, "CMOV - Conditional Move Instructions   = %d (%d)\n",  !!(uEdxGst & RT_BIT(15)),  !!(uEdxHst & RT_BIT(15)));
-            pHlp->pfnPrintf(pHlp, "PAT - Page Attribute Table             = %d (%d)\n",  !!(uEdxGst & RT_BIT(16)),  !!(uEdxHst & RT_BIT(16)));
-            pHlp->pfnPrintf(pHlp, "PSE-36 - 36-bit Page Size Extention    = %d (%d)\n",  !!(uEdxGst & RT_BIT(17)),  !!(uEdxHst & RT_BIT(17)));
-            pHlp->pfnPrintf(pHlp, "18 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(18)),  !!(uEdxHst & RT_BIT(18)));
-            pHlp->pfnPrintf(pHlp, "19 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(19)),  !!(uEdxHst & RT_BIT(19)));
-            pHlp->pfnPrintf(pHlp, "NX - No-Execute Page Protection        = %d (%d)\n",  !!(uEdxGst & RT_BIT(20)),  !!(uEdxHst & RT_BIT(20)));
-            pHlp->pfnPrintf(pHlp, "DS - Debug Store                       = %d (%d)\n",  !!(uEdxGst & RT_BIT(21)),  !!(uEdxHst & RT_BIT(21)));
-            pHlp->pfnPrintf(pHlp, "AXMMX - AMD Extensions to MMX Instr.   = %d (%d)\n",  !!(uEdxGst & RT_BIT(22)),  !!(uEdxHst & RT_BIT(22)));
-            pHlp->pfnPrintf(pHlp, "MMX - Intel MMX Technology             = %d (%d)\n",  !!(uEdxGst & RT_BIT(23)),  !!(uEdxHst & RT_BIT(23)));
-            pHlp->pfnPrintf(pHlp, "FXSR - FXSAVE and FXRSTOR Instructions = %d (%d)\n",  !!(uEdxGst & RT_BIT(24)),  !!(uEdxHst & RT_BIT(24)));
-            pHlp->pfnPrintf(pHlp, "25 - AMD fast FXSAVE and FXRSTOR Instr.= %d (%d)\n",  !!(uEdxGst & RT_BIT(25)),  !!(uEdxHst & RT_BIT(25)));
-            pHlp->pfnPrintf(pHlp, "26 - 1 GB large page support           = %d (%d)\n",  !!(uEdxGst & RT_BIT(26)),  !!(uEdxHst & RT_BIT(26)));
-            pHlp->pfnPrintf(pHlp, "27 - RDTSCP instruction                = %d (%d)\n",  !!(uEdxGst & RT_BIT(27)),  !!(uEdxHst & RT_BIT(27)));
-            pHlp->pfnPrintf(pHlp, "28 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(28)),  !!(uEdxHst & RT_BIT(28)));
-            pHlp->pfnPrintf(pHlp, "29 - AMD Long Mode                     = %d (%d)\n",  !!(uEdxGst & RT_BIT(29)),  !!(uEdxHst & RT_BIT(29)));
-            pHlp->pfnPrintf(pHlp, "30 - AMD Extensions to 3DNow!          = %d (%d)\n",  !!(uEdxGst & RT_BIT(30)),  !!(uEdxHst & RT_BIT(30)));
-            pHlp->pfnPrintf(pHlp, "31 - AMD 3DNow!                        = %d (%d)\n",  !!(uEdxGst & RT_BIT(31)),  !!(uEdxHst & RT_BIT(31)));
-
-            uint32_t uEcxGst = Guest.ecx;
-            uint32_t uEcxHst = Host.ecx;
-            pHlp->pfnPrintf(pHlp, "LahfSahf - LAHF/SAHF in 64-bit mode    = %d (%d)\n",  !!(uEcxGst & RT_BIT( 0)),  !!(uEcxHst & RT_BIT( 0)));
-            pHlp->pfnPrintf(pHlp, "CmpLegacy - Core MP legacy mode (depr) = %d (%d)\n",  !!(uEcxGst & RT_BIT( 1)),  !!(uEcxHst & RT_BIT( 1)));
-            pHlp->pfnPrintf(pHlp, "SVM - AMD VM Extensions                = %d (%d)\n",  !!(uEcxGst & RT_BIT( 2)),  !!(uEcxHst & RT_BIT( 2)));
-            pHlp->pfnPrintf(pHlp, "APIC registers starting at 0x400       = %d (%d)\n",  !!(uEcxGst & RT_BIT( 3)),  !!(uEcxHst & RT_BIT( 3)));
-            pHlp->pfnPrintf(pHlp, "AltMovCR8 - LOCK MOV CR0 means MOV CR8 = %d (%d)\n",  !!(uEcxGst & RT_BIT( 4)),  !!(uEcxHst & RT_BIT( 4)));
-            pHlp->pfnPrintf(pHlp, "5  - Advanced bit manipulation         = %d (%d)\n",  !!(uEcxGst & RT_BIT( 5)),  !!(uEcxHst & RT_BIT( 5)));
-            pHlp->pfnPrintf(pHlp, "6  - SSE4A instruction support         = %d (%d)\n",  !!(uEcxGst & RT_BIT( 6)),  !!(uEcxHst & RT_BIT( 6)));
-            pHlp->pfnPrintf(pHlp, "7  - Misaligned SSE mode               = %d (%d)\n",  !!(uEcxGst & RT_BIT( 7)),  !!(uEcxHst & RT_BIT( 7)));
-            pHlp->pfnPrintf(pHlp, "8  - PREFETCH and PREFETCHW instruction= %d (%d)\n",  !!(uEcxGst & RT_BIT( 8)),  !!(uEcxHst & RT_BIT( 8)));
-            pHlp->pfnPrintf(pHlp, "9  - OS visible workaround             = %d (%d)\n",  !!(uEcxGst & RT_BIT( 9)),  !!(uEcxHst & RT_BIT( 9)));
-            pHlp->pfnPrintf(pHlp, "10 - Instruction based sampling        = %d (%d)\n",  !!(uEcxGst & RT_BIT(10)),  !!(uEcxHst & RT_BIT(10)));
-            pHlp->pfnPrintf(pHlp, "11 - SSE5 support                      = %d (%d)\n",  !!(uEcxGst & RT_BIT(11)),  !!(uEcxHst & RT_BIT(11)));
-            pHlp->pfnPrintf(pHlp, "12 - SKINIT, STGI, and DEV support     = %d (%d)\n",  !!(uEcxGst & RT_BIT(12)),  !!(uEcxHst & RT_BIT(12)));
-            pHlp->pfnPrintf(pHlp, "13 - Watchdog timer support.           = %d (%d)\n",  !!(uEcxGst & RT_BIT(13)),  !!(uEcxHst & RT_BIT(13)));
-            pHlp->pfnPrintf(pHlp, "31:14 - Reserved                       = %#x (%#x)\n",   uEcxGst >> 14,          uEcxHst >> 14);
-        }
-    }
-
-    if (iVerbosity && cExtMax >= 2)
-    {
-        char szString[4*4*3+1] = {0};
-        uint32_t *pu32 = (uint32_t *)szString;
-        *pu32++ = pVM->cpum.s.aGuestCpuIdExt[2].eax;
-        *pu32++ = pVM->cpum.s.aGuestCpuIdExt[2].ebx;
-        *pu32++ = pVM->cpum.s.aGuestCpuIdExt[2].ecx;
-        *pu32++ = pVM->cpum.s.aGuestCpuIdExt[2].edx;
-        if (cExtMax >= 3)
-        {
-            *pu32++ = pVM->cpum.s.aGuestCpuIdExt[3].eax;
-            *pu32++ = pVM->cpum.s.aGuestCpuIdExt[3].ebx;
-            *pu32++ = pVM->cpum.s.aGuestCpuIdExt[3].ecx;
-            *pu32++ = pVM->cpum.s.aGuestCpuIdExt[3].edx;
-        }
-        if (cExtMax >= 4)
-        {
-            *pu32++ = pVM->cpum.s.aGuestCpuIdExt[4].eax;
-            *pu32++ = pVM->cpum.s.aGuestCpuIdExt[4].ebx;
-            *pu32++ = pVM->cpum.s.aGuestCpuIdExt[4].ecx;
-            *pu32++ = pVM->cpum.s.aGuestCpuIdExt[4].edx;
-        }
-        pHlp->pfnPrintf(pHlp, "Full Name:                       %s\n", szString);
-    }
-
-    if (iVerbosity && cExtMax >= 5)
-    {
-        uint32_t uEAX = pVM->cpum.s.aGuestCpuIdExt[5].eax;
-        uint32_t uEBX = pVM->cpum.s.aGuestCpuIdExt[5].ebx;
-        uint32_t uECX = pVM->cpum.s.aGuestCpuIdExt[5].ecx;
-        uint32_t uEDX = pVM->cpum.s.aGuestCpuIdExt[5].edx;
-        char sz1[32];
-        char sz2[32];
-
-        pHlp->pfnPrintf(pHlp,
-                        "TLB 2/4M Instr/Uni:              %s %3d entries\n"
-                        "TLB 2/4M Data:                   %s %3d entries\n",
-                        getCacheAss((uEAX >>  8) & 0xff, sz1), (uEAX >>  0) & 0xff,
-                        getCacheAss((uEAX >> 24) & 0xff, sz2), (uEAX >> 16) & 0xff);
-        pHlp->pfnPrintf(pHlp,
-                        "TLB 4K Instr/Uni:                %s %3d entries\n"
-                        "TLB 4K Data:                     %s %3d entries\n",
-                        getCacheAss((uEBX >>  8) & 0xff, sz1), (uEBX >>  0) & 0xff,
-                        getCacheAss((uEBX >> 24) & 0xff, sz2), (uEBX >> 16) & 0xff);
-        pHlp->pfnPrintf(pHlp, "L1 Instr Cache Line Size:        %d bytes\n"
-                        "L1 Instr Cache Lines Per Tag:    %d\n"
-                        "L1 Instr Cache Associativity:    %s\n"
-                        "L1 Instr Cache Size:             %d KB\n",
-                        (uEDX >> 0) & 0xff,
-                        (uEDX >> 8) & 0xff,
-                        getCacheAss((uEDX >> 16) & 0xff, sz1),
-                        (uEDX >> 24) & 0xff);
-        pHlp->pfnPrintf(pHlp,
-                        "L1 Data Cache Line Size:         %d bytes\n"
-                        "L1 Data Cache Lines Per Tag:     %d\n"
-                        "L1 Data Cache Associativity:     %s\n"
-                        "L1 Data Cache Size:              %d KB\n",
-                        (uECX >> 0) & 0xff,
-                        (uECX >> 8) & 0xff,
-                        getCacheAss((uECX >> 16) & 0xff, sz1),
-                        (uECX >> 24) & 0xff);
-    }
-
-    if (iVerbosity && cExtMax >= 6)
-    {
-        uint32_t uEAX = pVM->cpum.s.aGuestCpuIdExt[6].eax;
-        uint32_t uEBX = pVM->cpum.s.aGuestCpuIdExt[6].ebx;
-        uint32_t uEDX = pVM->cpum.s.aGuestCpuIdExt[6].edx;
-
-        pHlp->pfnPrintf(pHlp,
-                        "L2 TLB 2/4M Instr/Uni:           %s %4d entries\n"
-                        "L2 TLB 2/4M Data:                %s %4d entries\n",
-                        getL2CacheAss((uEAX >> 12) & 0xf),  (uEAX >>  0) & 0xfff,
-                        getL2CacheAss((uEAX >> 28) & 0xf),  (uEAX >> 16) & 0xfff);
-        pHlp->pfnPrintf(pHlp,
-                        "L2 TLB 4K Instr/Uni:             %s %4d entries\n"
-                        "L2 TLB 4K Data:                  %s %4d entries\n",
-                        getL2CacheAss((uEBX >> 12) & 0xf),  (uEBX >>  0) & 0xfff,
-                        getL2CacheAss((uEBX >> 28) & 0xf),  (uEBX >> 16) & 0xfff);
-        pHlp->pfnPrintf(pHlp,
-                        "L2 Cache Line Size:              %d bytes\n"
-                        "L2 Cache Lines Per Tag:          %d\n"
-                        "L2 Cache Associativity:          %s\n"
-                        "L2 Cache Size:                   %d KB\n",
-                        (uEDX >> 0) & 0xff,
-                        (uEDX >> 8) & 0xf,
-                        getL2CacheAss((uEDX >> 12) & 0xf),
-                        (uEDX >> 16) & 0xffff);
-    }
-
-    if (iVerbosity && cExtMax >= 7)
-    {
-        uint32_t uEDX = pVM->cpum.s.aGuestCpuIdExt[7].edx;
-
-        pHlp->pfnPrintf(pHlp, "Host Invariant-TSC support:      %RTbool\n", fSupportsInvariantTsc);
-        pHlp->pfnPrintf(pHlp, "APM Features:                   ");
-        if (uEDX & RT_BIT(0))   pHlp->pfnPrintf(pHlp, " TS");
-        if (uEDX & RT_BIT(1))   pHlp->pfnPrintf(pHlp, " FID");
-        if (uEDX & RT_BIT(2))   pHlp->pfnPrintf(pHlp, " VID");
-        if (uEDX & RT_BIT(3))   pHlp->pfnPrintf(pHlp, " TTP");
-        if (uEDX & RT_BIT(4))   pHlp->pfnPrintf(pHlp, " TM");
-        if (uEDX & RT_BIT(5))   pHlp->pfnPrintf(pHlp, " STC");
-        for (unsigned iBit = 6; iBit < 32; iBit++)
-        {
-            if (uEDX & X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR)
-                pHlp->pfnPrintf(pHlp, " TSCINVARIANT");
-            else if (uEDX & RT_BIT(iBit))
-                pHlp->pfnPrintf(pHlp, " %d", iBit);
-        }
-        pHlp->pfnPrintf(pHlp, "\n");
-    }
-
-    if (iVerbosity && cExtMax >= 8)
-    {
-        uint32_t uEAX = pVM->cpum.s.aGuestCpuIdExt[8].eax;
-        uint32_t uECX = pVM->cpum.s.aGuestCpuIdExt[8].ecx;
-
-        pHlp->pfnPrintf(pHlp,
-                        "Physical Address Width:          %d bits\n"
-                        "Virtual Address Width:           %d bits\n"
-                        "Guest Physical Address Width:    %d bits\n",
-                        (uEAX >> 0) & 0xff,
-                        (uEAX >> 8) & 0xff,
-                        (uEAX >> 16) & 0xff);
-        pHlp->pfnPrintf(pHlp,
-                        "Physical Core Count:             %d\n",
-                        (uECX >> 0) & 0xff);
-    }
-
-
-    /*
-     * Centaur.
-     */
-    unsigned cCentaurMax = pVM->cpum.s.aGuestCpuIdCentaur[0].eax & 0xffff;
-
-    pHlp->pfnPrintf(pHlp,
-                    "\n"
-                    "         RAW Centaur CPUIDs\n"
-                    "     Function  eax      ebx      ecx      edx\n");
-    for (unsigned i = 0; i < RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdCentaur); i++)
-    {
-        Guest = pVM->cpum.s.aGuestCpuIdCentaur[i];
-        ASMCpuIdExSlow(0xc0000000 | i, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
-
-        pHlp->pfnPrintf(pHlp,
-                        "Gst: %08x  %08x %08x %08x %08x%s\n"
-                        "Hst:           %08x %08x %08x %08x\n",
-                        0xc0000000 | i, Guest.eax, Guest.ebx, Guest.ecx, Guest.edx,
-                        i <= cCentaurMax ? "" : "*",
-                        Host.eax, Host.ebx, Host.ecx, Host.edx);
-    }
-
-    /*
-     * Understandable output
-     */
-    if (iVerbosity)
-    {
-        Guest = pVM->cpum.s.aGuestCpuIdCentaur[0];
-        pHlp->pfnPrintf(pHlp,
-                        "Centaur Supports:                0xc0000000-%#010x\n",
-                        Guest.eax);
-    }
-
-    if (iVerbosity && cCentaurMax >= 1)
-    {
-        ASMCpuIdExSlow(0xc0000001, 0, 0, 0, &Host.eax, &Host.ebx, &Host.ecx, &Host.edx);
-        uint32_t uEdxGst = pVM->cpum.s.aGuestCpuIdCentaur[1].edx;
-        uint32_t uEdxHst = Host.edx;
-
-        if (iVerbosity == 1)
-        {
-            pHlp->pfnPrintf(pHlp, "Centaur Features EDX:           ");
-            if (uEdxGst & RT_BIT(0))   pHlp->pfnPrintf(pHlp, " AIS");
-            if (uEdxGst & RT_BIT(1))   pHlp->pfnPrintf(pHlp, " AIS-E");
-            if (uEdxGst & RT_BIT(2))   pHlp->pfnPrintf(pHlp, " RNG");
-            if (uEdxGst & RT_BIT(3))   pHlp->pfnPrintf(pHlp, " RNG-E");
-            if (uEdxGst & RT_BIT(4))   pHlp->pfnPrintf(pHlp, " LH");
-            if (uEdxGst & RT_BIT(5))   pHlp->pfnPrintf(pHlp, " FEMMS");
-            if (uEdxGst & RT_BIT(6))   pHlp->pfnPrintf(pHlp, " ACE");
-            if (uEdxGst & RT_BIT(7))   pHlp->pfnPrintf(pHlp, " ACE-E");
-            /* possibly indicating MM/HE and MM/HE-E on older chips... */
-            if (uEdxGst & RT_BIT(8))   pHlp->pfnPrintf(pHlp, " ACE2");
-            if (uEdxGst & RT_BIT(9))   pHlp->pfnPrintf(pHlp, " ACE2-E");
-            if (uEdxGst & RT_BIT(10))  pHlp->pfnPrintf(pHlp, " PHE");
-            if (uEdxGst & RT_BIT(11))  pHlp->pfnPrintf(pHlp, " PHE-E");
-            if (uEdxGst & RT_BIT(12))  pHlp->pfnPrintf(pHlp, " PMM");
-            if (uEdxGst & RT_BIT(13))  pHlp->pfnPrintf(pHlp, " PMM-E");
-            for (unsigned iBit = 14; iBit < 32; iBit++)
-                if (uEdxGst & RT_BIT(iBit))
-                    pHlp->pfnPrintf(pHlp, " %d", iBit);
-            pHlp->pfnPrintf(pHlp, "\n");
-        }
-        else
-        {
-            pHlp->pfnPrintf(pHlp, "Mnemonic - Description                 = guest (host)\n");
-            pHlp->pfnPrintf(pHlp, "AIS - Alternate Instruction Set        = %d (%d)\n",  !!(uEdxGst & RT_BIT( 0)),  !!(uEdxHst & RT_BIT( 0)));
-            pHlp->pfnPrintf(pHlp, "AIS-E - AIS enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT( 1)),  !!(uEdxHst & RT_BIT( 1)));
-            pHlp->pfnPrintf(pHlp, "RNG - Random Number Generator          = %d (%d)\n",  !!(uEdxGst & RT_BIT( 2)),  !!(uEdxHst & RT_BIT( 2)));
-            pHlp->pfnPrintf(pHlp, "RNG-E - RNG enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT( 3)),  !!(uEdxHst & RT_BIT( 3)));
-            pHlp->pfnPrintf(pHlp, "LH - LongHaul MSR 0000_110Ah           = %d (%d)\n",  !!(uEdxGst & RT_BIT( 4)),  !!(uEdxHst & RT_BIT( 4)));
-            pHlp->pfnPrintf(pHlp, "FEMMS - FEMMS                          = %d (%d)\n",  !!(uEdxGst & RT_BIT( 5)),  !!(uEdxHst & RT_BIT( 5)));
-            pHlp->pfnPrintf(pHlp, "ACE - Advanced Cryptography Engine     = %d (%d)\n",  !!(uEdxGst & RT_BIT( 6)),  !!(uEdxHst & RT_BIT( 6)));
-            pHlp->pfnPrintf(pHlp, "ACE-E - ACE enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT( 7)),  !!(uEdxHst & RT_BIT( 7)));
-            /* possibly indicating MM/HE and MM/HE-E on older chips... */
-            pHlp->pfnPrintf(pHlp, "ACE2 - Advanced Cryptography Engine 2  = %d (%d)\n",  !!(uEdxGst & RT_BIT( 8)),  !!(uEdxHst & RT_BIT( 8)));
-            pHlp->pfnPrintf(pHlp, "ACE2-E - ACE enabled                   = %d (%d)\n",  !!(uEdxGst & RT_BIT( 9)),  !!(uEdxHst & RT_BIT( 9)));
-            pHlp->pfnPrintf(pHlp, "PHE - Padlock Hash Engine              = %d (%d)\n",  !!(uEdxGst & RT_BIT(10)),  !!(uEdxHst & RT_BIT(10)));
-            pHlp->pfnPrintf(pHlp, "PHE-E - PHE enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT(11)),  !!(uEdxHst & RT_BIT(11)));
-            pHlp->pfnPrintf(pHlp, "PMM - Montgomery Multiplier            = %d (%d)\n",  !!(uEdxGst & RT_BIT(12)),  !!(uEdxHst & RT_BIT(12)));
-            pHlp->pfnPrintf(pHlp, "PMM-E - PMM enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT(13)),  !!(uEdxHst & RT_BIT(13)));
-            pHlp->pfnPrintf(pHlp, "14 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(14)),  !!(uEdxHst & RT_BIT(14)));
-            pHlp->pfnPrintf(pHlp, "15 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(15)),  !!(uEdxHst & RT_BIT(15)));
-            pHlp->pfnPrintf(pHlp, "Parallax                               = %d (%d)\n",  !!(uEdxGst & RT_BIT(16)),  !!(uEdxHst & RT_BIT(16)));
-            pHlp->pfnPrintf(pHlp, "Parallax enabled                       = %d (%d)\n",  !!(uEdxGst & RT_BIT(17)),  !!(uEdxHst & RT_BIT(17)));
-            pHlp->pfnPrintf(pHlp, "Overstress                             = %d (%d)\n",  !!(uEdxGst & RT_BIT(18)),  !!(uEdxHst & RT_BIT(18)));
-            pHlp->pfnPrintf(pHlp, "Overstress enabled                     = %d (%d)\n",  !!(uEdxGst & RT_BIT(19)),  !!(uEdxHst & RT_BIT(19)));
-            pHlp->pfnPrintf(pHlp, "TM3 - Temperature Monitoring 3         = %d (%d)\n",  !!(uEdxGst & RT_BIT(20)),  !!(uEdxHst & RT_BIT(20)));
-            pHlp->pfnPrintf(pHlp, "TM3-E - TM3 enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT(21)),  !!(uEdxHst & RT_BIT(21)));
-            pHlp->pfnPrintf(pHlp, "RNG2 - Random Number Generator 2       = %d (%d)\n",  !!(uEdxGst & RT_BIT(22)),  !!(uEdxHst & RT_BIT(22)));
-            pHlp->pfnPrintf(pHlp, "RNG2-E - RNG2 enabled                  = %d (%d)\n",  !!(uEdxGst & RT_BIT(23)),  !!(uEdxHst & RT_BIT(23)));
-            pHlp->pfnPrintf(pHlp, "24 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(24)),  !!(uEdxHst & RT_BIT(24)));
-            pHlp->pfnPrintf(pHlp, "PHE2 - Padlock Hash Engine 2           = %d (%d)\n",  !!(uEdxGst & RT_BIT(25)),  !!(uEdxHst & RT_BIT(25)));
-            pHlp->pfnPrintf(pHlp, "PHE2-E - PHE2 enabled                  = %d (%d)\n",  !!(uEdxGst & RT_BIT(26)),  !!(uEdxHst & RT_BIT(26)));
-            for (unsigned iBit = 27; iBit < 32; iBit++)
-                if ((uEdxGst | uEdxHst) & RT_BIT(iBit))
-                    pHlp->pfnPrintf(pHlp, "Bit %d                                 = %d (%d)\n", iBit, !!(uEdxGst & RT_BIT(iBit)), !!(uEdxHst & RT_BIT(iBit)));
-            pHlp->pfnPrintf(pHlp, "\n");
-        }
-    }
-}
-
-
 /**
  * Structure used when disassembling and instructions in DBGF.
  * This is used so the reader function can get the stuff it needs.
@@ -4584,64 +2361,6 @@ VMMR3DECL(int) CPUMR3SetCR4Feature(PVM pVM, RTHCUINTREG fOr, RTHCUINTREG fAnd)
 
 
 /**
- * Gets a pointer to the array of standard CPUID leaves.
- *
- * CPUMR3GetGuestCpuIdStdMax() give the size of the array.
- *
- * @returns Pointer to the standard CPUID leaves (read-only).
- * @param   pVM         Pointer to the VM.
- * @remark  Intended for PATM.
- */
-VMMR3DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdStdRCPtr(PVM pVM)
-{
-    return RCPTRTYPE(PCCPUMCPUID)VM_RC_ADDR(pVM, &pVM->cpum.s.aGuestCpuIdStd[0]);
-}
-
-
-/**
- * Gets a pointer to the array of extended CPUID leaves.
- *
- * CPUMGetGuestCpuIdExtMax() give the size of the array.
- *
- * @returns Pointer to the extended CPUID leaves (read-only).
- * @param   pVM         Pointer to the VM.
- * @remark  Intended for PATM.
- */
-VMMR3DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdExtRCPtr(PVM pVM)
-{
-    return (RCPTRTYPE(PCCPUMCPUID))VM_RC_ADDR(pVM, &pVM->cpum.s.aGuestCpuIdExt[0]);
-}
-
-
-/**
- * Gets a pointer to the array of centaur CPUID leaves.
- *
- * CPUMGetGuestCpuIdCentaurMax() give the size of the array.
- *
- * @returns Pointer to the centaur CPUID leaves (read-only).
- * @param   pVM         Pointer to the VM.
- * @remark  Intended for PATM.
- */
-VMMR3DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdCentaurRCPtr(PVM pVM)
-{
-    return (RCPTRTYPE(PCCPUMCPUID))VM_RC_ADDR(pVM, &pVM->cpum.s.aGuestCpuIdCentaur[0]);
-}
-
-
-/**
- * Gets a pointer to the default CPUID leaf.
- *
- * @returns Pointer to the default CPUID leaf (read-only).
- * @param   pVM         Pointer to the VM.
- * @remark  Intended for PATM.
- */
-VMMR3DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdDefRCPtr(PVM pVM)
-{
-    return (RCPTRTYPE(PCCPUMCPUID))VM_RC_ADDR(pVM, &pVM->cpum.s.GuestCpuIdDef);
-}
-
-
-/**
  * Enters REM, gets and resets the changed flags (CPUM_CHANGED_*).
  *
  * Only REM should ever call this function!
@@ -4722,6 +2441,7 @@ VMMR3DECL(int) CPUMR3InitCompleted(PVM pVM)
     return VINF_SUCCESS;
 }
 
+
 /**
  * Called when the ring-0 init phases comleted.
  *
@@ -4747,3 +2467,4 @@ VMMR3DECL(void) CPUMR3LogCpuIds(PVM pVM)
     RTLogRelSetBuffering(fOldBuffered);
     LogRel(("******************** End of CPUID dump **********************\n"));
 }
+
diff --git a/src/VBox/VMM/VMMR3/CPUMDbg.cpp b/src/VBox/VMM/VMMR3/CPUMDbg.cpp
index cb6edc6..c96a35b 100644
--- a/src/VBox/VMM/VMMR3/CPUMDbg.cpp
+++ b/src/VBox/VMM/VMMR3/CPUMDbg.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2010-2012 Oracle Corporation
+ * Copyright (C) 2010-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -29,6 +29,7 @@
 #include <VBox/err.h>
 #include <VBox/log.h>
 #include <iprt/thread.h>
+#include <iprt/string.h>
 #include <iprt/uint128.h>
 
 
@@ -56,7 +57,7 @@ static DECLCALLBACK(int) cpumR3RegGet_Generic(void *pvUser, PCDBGFREGDESC pDesc,
 
 
 /**
- * @interface_method_impl{DBGFREGDESC, pfnGet}
+ * @interface_method_impl{DBGFREGDESC, pfnSet}
  */
 static DECLCALLBACK(int) cpumR3RegSet_Generic(void *pvUser, PCDBGFREGDESC pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask)
 {
@@ -104,6 +105,76 @@ static DECLCALLBACK(int) cpumR3RegSet_Generic(void *pvUser, PCDBGFREGDESC pDesc,
 /**
  * @interface_method_impl{DBGFREGDESC, pfnGet}
  */
+static DECLCALLBACK(int) cpumR3RegGet_XStateGeneric(void *pvUser, PCDBGFREGDESC pDesc, PDBGFREGVAL pValue)
+{
+    PVMCPU      pVCpu   = (PVMCPU)pvUser;
+    void const *pv      = (uint8_t const *)&pVCpu->cpum.s.Guest.pXStateR3 + pDesc->offRegister;
+
+    VMCPU_ASSERT_EMT(pVCpu);
+
+    switch (pDesc->enmType)
+    {
+        case DBGFREGVALTYPE_U8:        pValue->u8   = *(uint8_t  const *)pv; return VINF_SUCCESS;
+        case DBGFREGVALTYPE_U16:       pValue->u16  = *(uint16_t const *)pv; return VINF_SUCCESS;
+        case DBGFREGVALTYPE_U32:       pValue->u32  = *(uint32_t const *)pv; return VINF_SUCCESS;
+        case DBGFREGVALTYPE_U64:       pValue->u64  = *(uint64_t const *)pv; return VINF_SUCCESS;
+        case DBGFREGVALTYPE_U128:      pValue->u128 = *(PCRTUINT128U    )pv; return VINF_SUCCESS;
+        default:
+            AssertMsgFailedReturn(("%d %s\n", pDesc->enmType, pDesc->pszName), VERR_IPE_NOT_REACHED_DEFAULT_CASE);
+    }
+}
+
+
+/**
+ * @interface_method_impl{DBGFREGDESC, pfnSet}
+ */
+static DECLCALLBACK(int) cpumR3RegSet_XStateGeneric(void *pvUser, PCDBGFREGDESC pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask)
+{
+    PVMCPU      pVCpu = (PVMCPU)pvUser;
+    void       *pv    = (uint8_t *)&pVCpu->cpum.s.Guest.pXStateR3 + pDesc->offRegister;
+
+    VMCPU_ASSERT_EMT(pVCpu);
+
+    switch (pDesc->enmType)
+    {
+        case DBGFREGVALTYPE_U8:
+            *(uint8_t *)pv &= ~pfMask->u8;
+            *(uint8_t *)pv |= pValue->u8 & pfMask->u8;
+            return VINF_SUCCESS;
+
+        case DBGFREGVALTYPE_U16:
+            *(uint16_t *)pv &= ~pfMask->u16;
+            *(uint16_t *)pv |= pValue->u16 & pfMask->u16;
+            return VINF_SUCCESS;
+
+        case DBGFREGVALTYPE_U32:
+            *(uint32_t *)pv &= ~pfMask->u32;
+            *(uint32_t *)pv |= pValue->u32 & pfMask->u32;
+            return VINF_SUCCESS;
+
+        case DBGFREGVALTYPE_U64:
+            *(uint64_t *)pv &= ~pfMask->u64;
+            *(uint64_t *)pv |= pValue->u64 & pfMask->u64;
+            return VINF_SUCCESS;
+
+        case DBGFREGVALTYPE_U128:
+        {
+            RTUINT128U Val;
+            RTUInt128AssignAnd((PRTUINT128U)pv, RTUInt128AssignBitwiseNot(RTUInt128Assign(&Val, &pfMask->u128)));
+            RTUInt128AssignOr((PRTUINT128U)pv, RTUInt128AssignAnd(RTUInt128Assign(&Val, &pValue->u128), &pfMask->u128));
+            return VINF_SUCCESS;
+        }
+
+        default:
+            AssertMsgFailedReturn(("%d %s\n", pDesc->enmType, pDesc->pszName), VERR_IPE_NOT_REACHED_DEFAULT_CASE);
+    }
+}
+
+
+
+/**
+ * @interface_method_impl{DBGFREGDESC, pfnGet}
+ */
 static DECLCALLBACK(int) cpumR3RegSet_seg(void *pvUser, PCDBGFREGDESC pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask)
 {
     /** @todo perform a selector load, updating hidden selectors and stuff. */
@@ -167,23 +238,6 @@ static DECLCALLBACK(int) cpumR3RegSet_idtr(void *pvUser, PCDBGFREGDESC pDesc, PC
 
 
 /**
- * Is the FPU state in FXSAVE format or not.
- *
- * @returns true if it is, false if it's in FNSAVE.
- * @param   pVCpu               Pointer to the VMCPU.
- */
-DECLINLINE(bool) cpumR3RegIsFxSaveFormat(PVMCPU pVCpu)
-{
-#ifdef RT_ARCH_AMD64
-    NOREF(pVCpu);
-    return true;
-#else
-    return pVCpu->pVMR3->cpum.s.CPUFeatures.edx.u1FXSR;
-#endif
-}
-
-
-/**
  * Determins the tag register value for a CPU register when the FPU state
  * format is FXSAVE.
  *
@@ -228,20 +282,14 @@ static DECLCALLBACK(int) cpumR3RegGet_ftw(void *pvUser, PCDBGFREGDESC pDesc, PDB
     VMCPU_ASSERT_EMT(pVCpu);
     Assert(pDesc->enmType == DBGFREGVALTYPE_U16);
 
-    if (cpumR3RegIsFxSaveFormat(pVCpu))
-        pValue->u16 =  cpumR3RegCalcFpuTagFromFxSave(pFpu, 0)
-                    | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 1) <<  2)
-                    | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 2) <<  4)
-                    | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 3) <<  6)
-                    | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 4) <<  8)
-                    | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 5) << 10)
-                    | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 6) << 12)
-                    | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 7) << 14);
-    else
-    {
-        PCX86FPUSTATE pOldFpu = (PCX86FPUSTATE)pFpu;
-        pValue->u16 = pOldFpu->FTW;
-    }
+    pValue->u16 =  cpumR3RegCalcFpuTagFromFxSave(pFpu, 0)
+                | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 1) <<  2)
+                | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 2) <<  4)
+                | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 3) <<  6)
+                | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 4) <<  8)
+                | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 5) << 10)
+                | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 6) << 12)
+                | (cpumR3RegCalcFpuTagFromFxSave(pFpu, 7) << 14);
     return VINF_SUCCESS;
 }
 
@@ -256,6 +304,43 @@ static DECLCALLBACK(int) cpumR3RegSet_ftw(void *pvUser, PCDBGFREGDESC pDesc, PCD
 }
 
 
+/**
+ * @interface_method_impl{DBGFREGDESC, pfnGet}
+ */
+static DECLCALLBACK(int) cpumR3RegGet_Dummy(void *pvUser, PCDBGFREGDESC pDesc, PDBGFREGVAL pValue)
+{
+    switch (pDesc->enmType)
+    {
+        case DBGFREGVALTYPE_U8:        pValue->u8   = 0; return VINF_SUCCESS;
+        case DBGFREGVALTYPE_U16:       pValue->u16  = 0; return VINF_SUCCESS;
+        case DBGFREGVALTYPE_U32:       pValue->u32  = 0; return VINF_SUCCESS;
+        case DBGFREGVALTYPE_U64:       pValue->u64  = 0; return VINF_SUCCESS;
+        case DBGFREGVALTYPE_U128:
+            RT_ZERO(pValue->u128);
+            return VINF_SUCCESS;
+        case DBGFREGVALTYPE_DTR:
+            pValue->dtr.u32Limit = 0;
+            pValue->dtr.u64Base  = 0;
+            return VINF_SUCCESS;
+        case DBGFREGVALTYPE_R80:
+            RT_ZERO(pValue->r80Ex);
+            return VINF_SUCCESS;
+        default:
+            AssertMsgFailedReturn(("%d %s\n", pDesc->enmType, pDesc->pszName), VERR_IPE_NOT_REACHED_DEFAULT_CASE);
+    }
+}
+
+
+/**
+ * @interface_method_impl{DBGFREGDESC, pfnSet}
+ */
+static DECLCALLBACK(int) cpumR3RegSet_Dummy(void *pvUser, PCDBGFREGDESC pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask)
+{
+    NOREF(pvUser); NOREF(pDesc); NOREF(pValue); NOREF(pfMask);
+    return VERR_DBGF_READ_ONLY_REGISTER;
+}
+
+
 
 /*
  *
@@ -422,8 +507,8 @@ static DECLCALLBACK(int) cpumR3RegGstGet_msr(void *pvUser, PCDBGFREGDESC pDesc,
     VMCPU_ASSERT_EMT(pVCpu);
 
     uint64_t u64Value;
-    int rc = CPUMQueryGuestMsr(pVCpu, pDesc->offRegister, &u64Value);
-    if (RT_SUCCESS(rc))
+    VBOXSTRICTRC rcStrict = CPUMQueryGuestMsr(pVCpu, pDesc->offRegister, &u64Value);
+    if (rcStrict == VINF_SUCCESS)
     {
         switch (pDesc->enmType)
         {
@@ -433,9 +518,12 @@ static DECLCALLBACK(int) cpumR3RegGstGet_msr(void *pvUser, PCDBGFREGDESC pDesc,
             default:
                 AssertFailedReturn(VERR_IPE_NOT_REACHED_DEFAULT_CASE);
         }
+        return VBOXSTRICTRC_VAL(rcStrict);
     }
+
     /** @todo what to do about errors? */
-    return rc;
+    Assert(RT_FAILURE_NP(rcStrict));
+    return VBOXSTRICTRC_VAL(rcStrict);
 }
 
 
@@ -444,8 +532,7 @@ static DECLCALLBACK(int) cpumR3RegGstGet_msr(void *pvUser, PCDBGFREGDESC pDesc,
  */
 static DECLCALLBACK(int) cpumR3RegGstSet_msr(void *pvUser, PCDBGFREGDESC pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask)
 {
-    int         rc;
-    PVMCPU      pVCpu   = (PVMCPU)pvUser;
+    PVMCPU pVCpu = (PVMCPU)pvUser;
 
     VMCPU_ASSERT_EMT(pVCpu);
 
@@ -478,9 +565,12 @@ static DECLCALLBACK(int) cpumR3RegGstSet_msr(void *pvUser, PCDBGFREGDESC pDesc,
     if (fMask != fMaskMax)
     {
         uint64_t u64FullValue;
-        rc = CPUMQueryGuestMsr(pVCpu, pDesc->offRegister, &u64FullValue);
-        if (RT_FAILURE(rc))
-            return rc;
+        VBOXSTRICTRC rcStrict = CPUMQueryGuestMsr(pVCpu, pDesc->offRegister, &u64FullValue);
+        if (rcStrict != VINF_SUCCESS)
+        {
+            AssertRC(RT_FAILURE_NP(rcStrict));
+            return VBOXSTRICTRC_VAL(rcStrict);
+        }
         u64Value = (u64FullValue & ~fMask)
                  | (u64Value     &  fMask);
     }
@@ -488,7 +578,11 @@ static DECLCALLBACK(int) cpumR3RegGstSet_msr(void *pvUser, PCDBGFREGDESC pDesc,
     /*
      * Perform the assignment.
      */
-    return CPUMSetGuestMsr(pVCpu, pDesc->offRegister, u64Value);
+    VBOXSTRICTRC rcStrict = CPUMSetGuestMsr(pVCpu, pDesc->offRegister, u64Value);
+    if (rcStrict == VINF_SUCCESS)
+        return VINF_SUCCESS;
+    AssertRC(RT_FAILURE_NP(rcStrict));
+    return VBOXSTRICTRC_VAL(rcStrict);
 }
 
 
@@ -501,23 +595,11 @@ static DECLCALLBACK(int) cpumR3RegGstGet_stN(void *pvUser, PCDBGFREGDESC pDesc,
     VMCPU_ASSERT_EMT(pVCpu);
     Assert(pDesc->enmType == DBGFREGVALTYPE_R80);
 
-    if (cpumR3RegIsFxSaveFormat(pVCpu))
-    {
-        unsigned iReg = (pVCpu->cpum.s.Guest.fpu.FSW >> 11) & 7;
-        iReg += pDesc->offRegister;
-        iReg &= 7;
-        pValue->r80Ex = pVCpu->cpum.s.Guest.fpu.aRegs[iReg].r80Ex;
-    }
-    else
-    {
-        PCX86FPUSTATE pOldFpu = (PCX86FPUSTATE)&pVCpu->cpum.s.Guest.fpu;
-
-        unsigned iReg = (pOldFpu->FSW >> 11) & 7;
-        iReg += pDesc->offRegister;
-        iReg &= 7;
-
-        pValue->r80Ex = pOldFpu->regs[iReg].r80Ex;
-    }
+    PX86FXSTATE pFpuCtx = &pVCpu->cpum.s.Guest.CTX_SUFF(pXState)->x87;
+    unsigned iReg = (pFpuCtx->FSW >> 11) & 7;
+    iReg += pDesc->offRegister;
+    iReg &= 7;
+    pValue->r80Ex = pFpuCtx->aRegs[iReg].r80Ex;
 
     return VINF_SUCCESS;
 }
@@ -655,50 +737,6 @@ static DECLCALLBACK(int) cpumR3RegHyperSet_msr(void *pvUser, PCDBGFREGDESC pDesc
 }
 
 
-/**
- * @interface_method_impl{DBGFREGDESC, pfnGet}
- */
-static DECLCALLBACK(int) cpumR3RegHyperGet_stN(void *pvUser, PCDBGFREGDESC pDesc, PDBGFREGVAL pValue)
-{
-    PVMCPU      pVCpu   = (PVMCPU)pvUser;
-
-    VMCPU_ASSERT_EMT(pVCpu);
-    Assert(pDesc->enmType == DBGFREGVALTYPE_R80);
-
-    if (cpumR3RegIsFxSaveFormat(pVCpu))
-    {
-        unsigned iReg = (pVCpu->cpum.s.Guest.fpu.FSW >> 11) & 7;
-        iReg += pDesc->offRegister;
-        iReg &= 7;
-        pValue->r80Ex = pVCpu->cpum.s.Guest.fpu.aRegs[iReg].r80Ex;
-    }
-    else
-    {
-        PCX86FPUSTATE pOldFpu = (PCX86FPUSTATE)&pVCpu->cpum.s.Guest.fpu;
-
-        unsigned iReg = (pOldFpu->FSW >> 11) & 7;
-        iReg += pDesc->offRegister;
-        iReg &= 7;
-
-        pValue->r80Ex = pOldFpu->regs[iReg].r80Ex;
-    }
-
-    return VINF_SUCCESS;
-}
-
-
-/**
- * @interface_method_impl{DBGFREGDESC, pfnGet}
- */
-static DECLCALLBACK(int) cpumR3RegHyperSet_stN(void *pvUser, PCDBGFREGDESC pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask)
-{
-    /* There isn't a FPU context for the hypervisor yet, so no point in trying to set stuff. */
-    NOREF(pvUser); NOREF(pDesc); NOREF(pValue); NOREF(pfMask);
-    return VERR_ACCESS_DENIED;
-}
-
-
-
 /*
  * Set up aliases.
  */
@@ -946,13 +984,14 @@ static DBGFREGSUBFIELD const g_aCpumRegFields_cr4[] =
     DBGFREGSUBFIELD_RW("mce",     6,      1,  0),
     DBGFREGSUBFIELD_RW("pge",     7,      1,  0),
     DBGFREGSUBFIELD_RW("pce",     8,      1,  0),
-    DBGFREGSUBFIELD_RW("osfsxr",  9,      1,  0),
+    DBGFREGSUBFIELD_RW("osfxsr",  9,      1,  0),
     DBGFREGSUBFIELD_RW("osxmmeexcpt", 10, 1,  0),
-    DBGFREGSUBFIELD_RW("vmxe",   10,      1,  0),
-    DBGFREGSUBFIELD_RW("smxe",   13,      1,  0),
-    DBGFREGSUBFIELD_RW("pcide",  14,      1,  0),
-    DBGFREGSUBFIELD_RW("osxsave", 17,     1,  0),
-    DBGFREGSUBFIELD_RW("smep",   18,      1,  0),
+    DBGFREGSUBFIELD_RW("vmxe",   13,      1,  0),
+    DBGFREGSUBFIELD_RW("smxe",   14,      1,  0),
+    DBGFREGSUBFIELD_RW("pcide",  17,      1,  0),
+    DBGFREGSUBFIELD_RW("osxsave", 18,     1,  0),
+    DBGFREGSUBFIELD_RW("smep",   20,      1,  0),
+    DBGFREGSUBFIELD_RW("smap",   21,      1,  0),
     DBGFREGSUBFIELD_TERMINATOR()
 };
 
@@ -1068,10 +1107,10 @@ static DBGFREGSUBFIELD const g_aCpumRegFields_sf_mask[] =
     CPU_REG_RW_AS(#LName "_lim",    UName##_LIMIT,  U32, LName.u32Limit,        cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       NULL                )
 
 #define CPU_REG_MM(n) \
-    CPU_REG_RW_AS("mm" #n,          MM##n,          U64, fpu.aRegs[n].mmx,      cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       g_aCpumRegFields_mmN)
+    CPU_REG_XS_RW_AS("mm" #n,       MM##n,          U64, x87.aRegs[n].mmx, cpumR3RegGet_XStateGeneric, cpumR3RegSet_XStateGeneric, NULL,                       g_aCpumRegFields_mmN)
 
 #define CPU_REG_XMM(n) \
-    CPU_REG_RW_AS("xmm" #n,         XMM##n,         U128, fpu.aXMM[n].xmm,      cpumR3RegGet_Generic, cpumR3RegSet_Generic, NULL,                       g_aCpumRegFields_xmmN)
+    CPU_REG_XS_RW_AS("xmm" #n,      XMM##n,         U128, x87.aXMM[n].xmm, cpumR3RegGet_XStateGeneric, cpumR3RegSet_XStateGeneric, NULL,                       g_aCpumRegFields_xmmN)
 /** @} */
 
 
@@ -1084,6 +1123,10 @@ static DBGFREGDESC const g_aCpumRegGstDescs[] =
     { a_szName, DBGFREG_##a_RegSuff, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/,            RT_OFFSETOF(CPUMCPU, Guest.a_CpumCtxMemb), a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
 #define CPU_REG_RO_AS(a_szName, a_RegSuff, a_TypeSuff, a_CpumCtxMemb, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
     { a_szName, DBGFREG_##a_RegSuff, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, RT_OFFSETOF(CPUMCPU, Guest.a_CpumCtxMemb), a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
+#define CPU_REG_XS_RW_AS(a_szName, a_RegSuff, a_TypeSuff, a_XStateMemb, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
+    { a_szName, DBGFREG_##a_RegSuff, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/,            RT_OFFSETOF(X86XSAVEAREA, a_XStateMemb),   a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
+#define CPU_REG_XS_RO_AS(a_szName, a_RegSuff, a_TypeSuff, a_XStateMemb, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
+    { a_szName, DBGFREG_##a_RegSuff, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, RT_OFFSETOF(X86XSAVEAREA, a_XStateMemb), a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
 #define CPU_REG_MSR(a_szName, UName, a_TypeSuff, a_paSubFields) \
     CPU_REG_EX_AS(a_szName,         MSR_##UName,    a_TypeSuff, MSR_##UName,    cpumR3RegGstGet_msr,  cpumR3RegGstSet_msr,  NULL,                       a_paSubFields)
 #define CPU_REG_ST(n) \
@@ -1112,17 +1155,17 @@ static DBGFREGDESC const g_aCpumRegGstDescs[] =
     CPU_REG_SEG(GS, gs),
     CPU_REG_SEG(SS, ss),
     CPU_REG_REG(RIP, rip),
-    CPU_REG_RW_AS("rflags",         RFLAGS,         U64, rflags,                cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   g_aCpumRegAliases_rflags,   g_aCpumRegFields_rflags ),
-    CPU_REG_RW_AS("fcw",            FCW,            U16, fpu.FCW,               cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       g_aCpumRegFields_fcw    ),
-    CPU_REG_RW_AS("fsw",            FSW,            U16, fpu.FSW,               cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       g_aCpumRegFields_fsw    ),
-    CPU_REG_RO_AS("ftw",            FTW,            U16, fpu,                   cpumR3RegGet_ftw,       cpumR3RegSet_ftw,       NULL,                       g_aCpumRegFields_ftw    ),
-    CPU_REG_RW_AS("fop",            FOP,            U16, fpu.FOP,               cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
-    CPU_REG_RW_AS("fpuip",          FPUIP,          U32, fpu.FPUIP,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   g_aCpumRegAliases_fpuip,    NULL                    ),
-    CPU_REG_RW_AS("fpucs",          FPUCS,          U16, fpu.CS,                cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
-    CPU_REG_RW_AS("fpudp",          FPUDP,          U32, fpu.FPUDP,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   g_aCpumRegAliases_fpudp,    NULL                    ),
-    CPU_REG_RW_AS("fpuds",          FPUDS,          U16, fpu.DS,                cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
-    CPU_REG_RW_AS("mxcsr",          MXCSR,          U32, fpu.MXCSR,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       g_aCpumRegFields_mxcsr  ),
-    CPU_REG_RW_AS("mxcsr_mask",     MXCSR_MASK,     U32, fpu.MXCSR_MASK,        cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       g_aCpumRegFields_mxcsr  ),
+    CPU_REG_RW_AS("rflags",         RFLAGS,         U64, rflags,         cpumR3RegGet_Generic,         cpumR3RegSet_Generic,         g_aCpumRegAliases_rflags,   g_aCpumRegFields_rflags ),
+    CPU_REG_XS_RW_AS("fcw",         FCW,            U16, x87.FCW,        cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   NULL,                       g_aCpumRegFields_fcw    ),
+    CPU_REG_XS_RW_AS("fsw",         FSW,            U16, x87.FSW,        cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   NULL,                       g_aCpumRegFields_fsw    ),
+    CPU_REG_XS_RO_AS("ftw",         FTW,            U16, x87,            cpumR3RegGet_ftw,             cpumR3RegSet_ftw,             NULL,                       g_aCpumRegFields_ftw    ),
+    CPU_REG_XS_RW_AS("fop",         FOP,            U16, x87.FOP,        cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   NULL,                       NULL                    ),
+    CPU_REG_XS_RW_AS("fpuip",       FPUIP,          U32, x87.FPUIP,      cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   g_aCpumRegAliases_fpuip,    NULL                    ),
+    CPU_REG_XS_RW_AS("fpucs",       FPUCS,          U16, x87.CS,         cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   NULL,                       NULL                    ),
+    CPU_REG_XS_RW_AS("fpudp",       FPUDP,          U32, x87.FPUDP,      cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   g_aCpumRegAliases_fpudp,    NULL                    ),
+    CPU_REG_XS_RW_AS("fpuds",       FPUDS,          U16, x87.DS,         cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   NULL,                       NULL                    ),
+    CPU_REG_XS_RW_AS("mxcsr",       MXCSR,          U32, x87.MXCSR,      cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   NULL,                       g_aCpumRegFields_mxcsr  ),
+    CPU_REG_XS_RW_AS("mxcsr_mask",  MXCSR_MASK,     U32, x87.MXCSR_MASK, cpumR3RegGet_XStateGeneric,   cpumR3RegSet_XStateGeneric,   NULL,                       g_aCpumRegFields_mxcsr  ),
     CPU_REG_ST(0),
     CPU_REG_ST(1),
     CPU_REG_ST(2),
@@ -1212,10 +1255,10 @@ static DBGFREGDESC const g_aCpumRegHyperDescs[] =
     { a_szName, DBGFREG_##a_RegSuff, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/,            RT_OFFSETOF(CPUMCPU, Hyper.a_CpumCtxMemb), a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
 #define CPU_REG_RO_AS(a_szName, a_RegSuff, a_TypeSuff, a_CpumCtxMemb, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
     { a_szName, DBGFREG_##a_RegSuff, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, RT_OFFSETOF(CPUMCPU, Hyper.a_CpumCtxMemb), a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
+#define CPU_REG_DUMMY(a_szName, a_RegSuff, a_TypeSuff) \
+    { a_szName, DBGFREG_##a_RegSuff, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, 0, cpumR3RegGet_Dummy, cpumR3RegSet_Dummy, NULL, NULL}
 #define CPU_REG_MSR(a_szName, UName, a_TypeSuff, a_paSubFields) \
     CPU_REG_EX_AS(a_szName,         MSR_##UName,    a_TypeSuff, MSR_##UName,    cpumR3RegHyperGet_msr,  cpumR3RegHyperSet_msr,  NULL,                       a_paSubFields)
-#define CPU_REG_ST(n) \
-    CPU_REG_EX_AS("st" #n,          ST##n,          R80, n,                     cpumR3RegHyperGet_stN,  cpumR3RegHyperSet_stN,  NULL,                       g_aCpumRegFields_stN)
 
     CPU_REG_REG(RAX, rax),
     CPU_REG_REG(RCX, rcx),
@@ -1241,48 +1284,48 @@ static DBGFREGDESC const g_aCpumRegHyperDescs[] =
     CPU_REG_SEG(SS, ss),
     CPU_REG_REG(RIP, rip),
     CPU_REG_RW_AS("rflags",         RFLAGS,         U64, rflags,                cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   g_aCpumRegAliases_rflags,   g_aCpumRegFields_rflags ),
-    CPU_REG_RW_AS("fcw",            FCW,            U16, fpu.FCW,               cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       g_aCpumRegFields_fcw    ),
-    CPU_REG_RW_AS("fsw",            FSW,            U16, fpu.FSW,               cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       g_aCpumRegFields_fsw    ),
-    CPU_REG_RO_AS("ftw",            FTW,            U16, fpu,                   cpumR3RegGet_ftw,       cpumR3RegSet_ftw,       NULL,                       g_aCpumRegFields_ftw    ),
-    CPU_REG_RW_AS("fop",            FOP,            U16, fpu.FOP,               cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
-    CPU_REG_RW_AS("fpuip",          FPUIP,          U32, fpu.FPUIP,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   g_aCpumRegAliases_fpuip,    NULL                    ),
-    CPU_REG_RW_AS("fpucs",          FPUCS,          U16, fpu.CS,                cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
-    CPU_REG_RW_AS("fpudp",          FPUDP,          U32, fpu.FPUDP,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   g_aCpumRegAliases_fpudp,    NULL                    ),
-    CPU_REG_RW_AS("fpuds",          FPUDS,          U16, fpu.DS,                cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
-    CPU_REG_RW_AS("mxcsr",          MXCSR,          U32, fpu.MXCSR,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       g_aCpumRegFields_mxcsr  ),
-    CPU_REG_RW_AS("mxcsr_mask",     MXCSR_MASK,     U32, fpu.MXCSR_MASK,        cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       g_aCpumRegFields_mxcsr  ),
-    CPU_REG_ST(0),
-    CPU_REG_ST(1),
-    CPU_REG_ST(2),
-    CPU_REG_ST(3),
-    CPU_REG_ST(4),
-    CPU_REG_ST(5),
-    CPU_REG_ST(6),
-    CPU_REG_ST(7),
-    CPU_REG_MM(0),
-    CPU_REG_MM(1),
-    CPU_REG_MM(2),
-    CPU_REG_MM(3),
-    CPU_REG_MM(4),
-    CPU_REG_MM(5),
-    CPU_REG_MM(6),
-    CPU_REG_MM(7),
-    CPU_REG_XMM(0),
-    CPU_REG_XMM(1),
-    CPU_REG_XMM(2),
-    CPU_REG_XMM(3),
-    CPU_REG_XMM(4),
-    CPU_REG_XMM(5),
-    CPU_REG_XMM(6),
-    CPU_REG_XMM(7),
-    CPU_REG_XMM(8),
-    CPU_REG_XMM(9),
-    CPU_REG_XMM(10),
-    CPU_REG_XMM(11),
-    CPU_REG_XMM(12),
-    CPU_REG_XMM(13),
-    CPU_REG_XMM(14),
-    CPU_REG_XMM(15),
+    CPU_REG_DUMMY("fcw",            FCW,            U16),
+    CPU_REG_DUMMY("fsw",            FSW,            U16),
+    CPU_REG_DUMMY("ftw",            FTW,            U16),
+    CPU_REG_DUMMY("fop",            FOP,            U16),
+    CPU_REG_DUMMY("fpuip",          FPUIP,          U32),
+    CPU_REG_DUMMY("fpucs",          FPUCS,          U16),
+    CPU_REG_DUMMY("fpudp",          FPUDP,          U32),
+    CPU_REG_DUMMY("fpuds",          FPUDS,          U16),
+    CPU_REG_DUMMY("mxcsr",          MXCSR,          U32),
+    CPU_REG_DUMMY("mxcsr_mask",     MXCSR_MASK,     U32),
+    CPU_REG_DUMMY("st0",            ST0,            R80),
+    CPU_REG_DUMMY("st1",            ST1,            R80),
+    CPU_REG_DUMMY("st2",            ST2,            R80),
+    CPU_REG_DUMMY("st3",            ST3,            R80),
+    CPU_REG_DUMMY("st4",            ST4,            R80),
+    CPU_REG_DUMMY("st5",            ST5,            R80),
+    CPU_REG_DUMMY("st6",            ST6,            R80),
+    CPU_REG_DUMMY("st7",            ST7,            R80),
+    CPU_REG_DUMMY("mm0",            MM0,            U64),
+    CPU_REG_DUMMY("mm1",            MM1,            U64),
+    CPU_REG_DUMMY("mm2",            MM2,            U64),
+    CPU_REG_DUMMY("mm3",            MM3,            U64),
+    CPU_REG_DUMMY("mm4",            MM4,            U64),
+    CPU_REG_DUMMY("mm5",            MM5,            U64),
+    CPU_REG_DUMMY("mm6",            MM6,            U64),
+    CPU_REG_DUMMY("mm7",            MM7,            U64),
+    CPU_REG_DUMMY("xmm0",           XMM0,           U128),
+    CPU_REG_DUMMY("xmm1",           XMM1,           U128),
+    CPU_REG_DUMMY("xmm2",           XMM2,           U128),
+    CPU_REG_DUMMY("xmm3",           XMM3,           U128),
+    CPU_REG_DUMMY("xmm4",           XMM4,           U128),
+    CPU_REG_DUMMY("xmm5",           XMM5,           U128),
+    CPU_REG_DUMMY("xmm6",           XMM6,           U128),
+    CPU_REG_DUMMY("xmm7",           XMM7,           U128),
+    CPU_REG_DUMMY("xmm8",           XMM8,           U128),
+    CPU_REG_DUMMY("xmm9",           XMM9,           U128),
+    CPU_REG_DUMMY("xmm10",          XMM10,          U128),
+    CPU_REG_DUMMY("xmm11",          XMM11,          U128),
+    CPU_REG_DUMMY("xmm12",          XMM12,          U128),
+    CPU_REG_DUMMY("xmm13",          XMM13,          U128),
+    CPU_REG_DUMMY("xmm14",          XMM14,          U128),
+    CPU_REG_DUMMY("xmm15",          XMM15,          U128),
     CPU_REG_RW_AS("gdtr_base",      GDTR_BASE,      U64, gdtr.pGdt,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
     CPU_REG_RW_AS("gdtr_lim",       GDTR_LIMIT,     U16, gdtr.cbGdt,            cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
     CPU_REG_RW_AS("idtr_base",      IDTR_BASE,      U64, idtr.pIdt,             cpumR3RegGet_Generic,   cpumR3RegSet_Generic,   NULL,                       NULL                    ),
diff --git a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
index 706c034..240ff41 100644
--- a/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
+++ b/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013-2014 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -20,8 +20,12 @@
 *******************************************************************************/
 #define LOG_GROUP LOG_GROUP_CPUM
 #include <VBox/vmm/cpum.h>
+#include <VBox/vmm/dbgf.h>
+#include <VBox/vmm/hm.h>
+#include <VBox/vmm/ssm.h>
 #include "CPUMInternal.h"
 #include <VBox/vmm/vm.h>
+#include <VBox/vmm/mm.h>
 
 #include <VBox/err.h>
 #include <iprt/asm-amd64-x86.h>
@@ -31,6 +35,17 @@
 
 
 /*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** For sanity and avoid wasting hyper heap on buggy config / saved state. */
+#define CPUM_CPUID_MAX_LEAVES       2048
+/* Max size we accept for the XSAVE area. */
+#define CPUM_MAX_XSAVE_AREA_SIZE    10240
+/* Min size we accept for the XSAVE area. */
+#define CPUM_MIN_XSAVE_AREA_SIZE    0x240
+
+
+/*******************************************************************************
 *   Global Variables                                                           *
 *******************************************************************************/
 /**
@@ -193,7 +208,7 @@ VMMR3DECL(CPUMMICROARCH) CPUMR3CpuIdDetermineMicroarchEx(CPUMCPUVENDOR enmVendor
                  *     - Egypt:         20F10/JH-E1, 20F12/JH-E6
                  *     - Toledo:        20F32/JH-E6, 30F72/DH-E6 (single code variant).
                  *     - Manchester:    20FB1/BH-E4, 30FF2/BH-E4.
-                 *  - 90nm 2nd gen opteron ++, AMD-V introduced (might be missing in some cheeper models):
+                 *  - 90nm 2nd gen opteron ++, AMD-V introduced (might be missing in some cheaper models):
                  *     - Santa Ana:     40F32/JH-F2, /-F3
                  *     - Santa Rosa:    40F12/JH-F2, 40F13/JH-F3
                  *     - Windsor:       40F32/JH-F2, 40F33/JH-F3, C0F13/JH-F3, 40FB2/BH-F2, ??20FB1/BH-E4??.
@@ -510,7 +525,7 @@ VMMR3DECL(const char *) CPUMR3MicroarchName(CPUMMICROARCH enmMicroarch)
  * @param   uLeaf               The leaf to locate.
  * @param   uSubLeaf            The subleaf to locate.  Pass 0 if no subleaves.
  */
-PCPUMCPUIDLEAF cpumR3CpuIdGetLeaf(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uint32_t uLeaf, uint32_t uSubLeaf)
+static PCPUMCPUIDLEAF cpumR3CpuIdGetLeaf(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uint32_t uLeaf, uint32_t uSubLeaf)
 {
     /* Lazy bird does linear lookup here since this is only used for the
        occational CPUID overrides. */
@@ -532,15 +547,16 @@ PCPUMCPUIDLEAF cpumR3CpuIdGetLeaf(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uin
  * @param   uSubLeaf            The subleaf to locate.  Pass 0 if no subleaves.
  * @param   pLegacy             The legacy output leaf.
  */
-bool cpumR3CpuIdGetLeafLegacy(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uint32_t uLeaf, uint32_t uSubLeaf, PCPUMCPUID pLeagcy)
+static bool cpumR3CpuIdGetLeafLegacy(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uint32_t uLeaf, uint32_t uSubLeaf,
+                                     PCPUMCPUID pLegacy)
 {
     PCPUMCPUIDLEAF pLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, uLeaf, uSubLeaf);
     if (pLeaf)
     {
-        pLeagcy->eax = pLeaf->uEax;
-        pLeagcy->ebx = pLeaf->uEbx;
-        pLeagcy->ecx = pLeaf->uEcx;
-        pLeagcy->edx = pLeaf->uEdx;
+        pLegacy->uEax = pLeaf->uEax;
+        pLegacy->uEbx = pLeaf->uEbx;
+        pLegacy->uEcx = pLeaf->uEcx;
+        pLegacy->uEdx = pLeaf->uEdx;
         return true;
     }
     return false;
@@ -552,23 +568,68 @@ bool cpumR3CpuIdGetLeafLegacy(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uint32_
  *
  * @returns Pointer to the CPUID leaf array (*ppaLeaves) on success.  NULL on
  *          failure.
- * @param   ppaLeaves           Pointer to the variable holding the array
- *                              pointer (input/output).
- * @param   cLeaves             The current array size.
+ * @param   pVM         Pointer to the VM, used as the heap selector. Passing
+ *                      NULL uses the host-context heap, otherwise the VM's
+ *                      hyper heap is used.
+ * @param   ppaLeaves   Pointer to the variable holding the array pointer
+ *                      (input/output).
+ * @param   cLeaves     The current array size.
+ *
+ * @remarks This function will automatically update the R0 and RC pointers when
+ *          using the hyper heap, which means @a ppaLeaves and @a cLeaves must
+ *          be the corresponding VM's CPUID arrays (which is asserted).
  */
-static PCPUMCPUIDLEAF cpumR3CpuIdEnsureSpace(PCPUMCPUIDLEAF *ppaLeaves, uint32_t cLeaves)
+static PCPUMCPUIDLEAF cpumR3CpuIdEnsureSpace(PVM pVM, PCPUMCPUIDLEAF *ppaLeaves, uint32_t cLeaves)
 {
-    uint32_t cAllocated = RT_ALIGN(cLeaves, 16);
-    if (cLeaves + 1 > cAllocated)
+    /*
+     * If pVM is not specified, we're on the regular heap and can waste a
+     * little space to speed things up.
+     */
+    uint32_t cAllocated;
+    if (!pVM)
+    {
+        cAllocated = RT_ALIGN(cLeaves, 16);
+        if (cLeaves + 1 > cAllocated)
+        {
+            void *pvNew = RTMemRealloc(*ppaLeaves, (cAllocated + 16) * sizeof(**ppaLeaves));
+            if (pvNew)
+                *ppaLeaves = (PCPUMCPUIDLEAF)pvNew;
+            else
+            {
+                RTMemFree(*ppaLeaves);
+                *ppaLeaves = NULL;
+            }
+        }
+    }
+    /*
+     * Otherwise, we're on the hyper heap and are probably just inserting
+     * one or two leaves and should conserve space.
+     */
+    else
     {
-        void *pvNew = RTMemRealloc(*ppaLeaves, (cAllocated + 16) * sizeof(**ppaLeaves));
-        if (!pvNew)
+#ifdef IN_VBOX_CPU_REPORT
+        AssertReleaseFailed();
+#else
+        Assert(ppaLeaves == &pVM->cpum.s.GuestInfo.paCpuIdLeavesR3);
+        Assert(cLeaves == pVM->cpum.s.GuestInfo.cCpuIdLeaves);
+
+        size_t cb    = cLeaves       * sizeof(**ppaLeaves);
+        size_t cbNew = (cLeaves + 1) * sizeof(**ppaLeaves);
+        int rc = MMR3HyperRealloc(pVM, *ppaLeaves, cb, 32, MM_TAG_CPUM_CPUID, cbNew, (void **)ppaLeaves);
+        if (RT_SUCCESS(rc))
+        {
+            /* Update the R0 and RC pointers. */
+            pVM->cpum.s.GuestInfo.paCpuIdLeavesR0 = MMHyperR3ToR0(pVM, *ppaLeaves);
+            pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = MMHyperR3ToRC(pVM, *ppaLeaves);
+        }
+        else
         {
-            RTMemFree(*ppaLeaves);
             *ppaLeaves = NULL;
-            return NULL;
+            pVM->cpum.s.GuestInfo.paCpuIdLeavesR0 = NIL_RTR0PTR;
+            pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = NIL_RTRCPTR;
+            LogRel(("CPUM: cpumR3CpuIdEnsureSpace: MMR3HyperRealloc failed. rc=%Rrc\n", rc));
         }
-        *ppaLeaves   = (PCPUMCPUIDLEAF)pvNew;
+#endif
     }
     return *ppaLeaves;
 }
@@ -578,7 +639,7 @@ static PCPUMCPUIDLEAF cpumR3CpuIdEnsureSpace(PCPUMCPUIDLEAF *ppaLeaves, uint32_t
  * Append a CPUID leaf or sub-leaf.
  *
  * ASSUMES linear insertion order, so we'll won't need to do any searching or
- * replace anything.  Use cpumR3CpuIdInsert for those cases.
+ * replace anything.  Use cpumR3CpuIdInsert() for those cases.
  *
  * @returns VINF_SUCCESS or VERR_NO_MEMORY.  On error, *ppaLeaves is freed, so
  *          the caller need do no more work.
@@ -598,7 +659,7 @@ static int cpumR3CollectCpuIdInfoAddOne(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcL
                                         uint32_t uLeaf, uint32_t uSubLeaf, uint32_t fSubLeafMask,
                                         uint32_t uEax, uint32_t uEbx, uint32_t uEcx, uint32_t uEdx, uint32_t fFlags)
 {
-    if (!cpumR3CpuIdEnsureSpace(ppaLeaves, *pcLeaves))
+    if (!cpumR3CpuIdEnsureSpace(NULL /* pVM */, ppaLeaves, *pcLeaves))
         return VERR_NO_MEMORY;
 
     PCPUMCPUIDLEAF pNew = &(*ppaLeaves)[*pcLeaves];
@@ -621,55 +682,131 @@ static int cpumR3CollectCpuIdInfoAddOne(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcL
 
 
 /**
+ * Checks that we've updated the CPUID leaves array correctly.
+ *
+ * This is a no-op in non-strict builds.
+ *
+ * @param   paLeaves            The leaves array.
+ * @param   cLeaves             The number of leaves.
+ */
+static void cpumR3CpuIdAssertOrder(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves)
+{
+#ifdef VBOX_STRICT
+    for (uint32_t i = 1; i < cLeaves; i++)
+        if (paLeaves[i].uLeaf != paLeaves[i - 1].uLeaf)
+            AssertMsg(paLeaves[i].uLeaf > paLeaves[i - 1].uLeaf, ("%#x vs %#x\n", paLeaves[i].uLeaf, paLeaves[i - 1].uLeaf));
+        else
+        {
+            AssertMsg(paLeaves[i].uSubLeaf > paLeaves[i - 1].uSubLeaf,
+                      ("%#x: %#x vs %#x\n", paLeaves[i].uLeaf, paLeaves[i].uSubLeaf, paLeaves[i - 1].uSubLeaf));
+            AssertMsg(paLeaves[i].fSubLeafMask == paLeaves[i - 1].fSubLeafMask,
+                      ("%#x/%#x: %#x vs %#x\n", paLeaves[i].uLeaf, paLeaves[i].uSubLeaf, paLeaves[i].fSubLeafMask, paLeaves[i - 1].fSubLeafMask));
+            AssertMsg(paLeaves[i].fFlags == paLeaves[i - 1].fFlags,
+                      ("%#x/%#x: %#x vs %#x\n", paLeaves[i].uLeaf, paLeaves[i].uSubLeaf, paLeaves[i].fFlags, paLeaves[i - 1].fFlags));
+        }
+#else
+    NOREF(paLeaves);
+    NOREF(cLeaves);
+#endif
+}
+
+
+/**
  * Inserts a CPU ID leaf, replacing any existing ones.
  *
  * When inserting a simple leaf where we already got a series of subleaves with
  * the same leaf number (eax), the simple leaf will replace the whole series.
  *
- * This ASSUMES that the leave array is still on the normal heap and has only
- * been allocated/reallocated by the cpumR3CpuIdEnsureSpace function.
+ * When pVM is NULL, this ASSUMES that the leaves array is still on the normal
+ * host-context heap and has only been allocated/reallocated by the
+ * cpumR3CpuIdEnsureSpace function.
  *
  * @returns VBox status code.
+ * @param   pVM             Pointer to the VM, used as the heap selector.
+ *                          Passing NULL uses the host-context heap, otherwise
+ *                          the VM's hyper heap is used.
  * @param   ppaLeaves       Pointer to the the pointer to the array of sorted
- *                          CPUID leaves and sub-leaves.
- * @param   pcLeaves        Where we keep the leaf count for *ppaLeaves.
+ *                          CPUID leaves and sub-leaves. Must be NULL if using
+ *                          the hyper heap.
+ * @param   pcLeaves        Where we keep the leaf count for *ppaLeaves. Must be
+ *                          NULL if using the hyper heap.
  * @param   pNewLeaf        Pointer to the data of the new leaf we're about to
  *                          insert.
  */
-int cpumR3CpuIdInsert(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves, PCPUMCPUIDLEAF pNewLeaf)
+static int cpumR3CpuIdInsert(PVM pVM, PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves, PCPUMCPUIDLEAF pNewLeaf)
 {
+    /*
+     * Validate input parameters if we are using the hyper heap and use the VM's CPUID arrays.
+     */
+    if (pVM)
+    {
+        AssertReturn(!ppaLeaves, VERR_INVALID_PARAMETER);
+        AssertReturn(!pcLeaves, VERR_INVALID_PARAMETER);
+
+        ppaLeaves = &pVM->cpum.s.GuestInfo.paCpuIdLeavesR3;
+        pcLeaves  = &pVM->cpum.s.GuestInfo.cCpuIdLeaves;
+    }
+
     PCPUMCPUIDLEAF  paLeaves = *ppaLeaves;
     uint32_t        cLeaves  = *pcLeaves;
 
     /*
      * Validate the new leaf a little.
      */
-    AssertReturn(!(pNewLeaf->fFlags & ~CPUMCPUIDLEAF_F_SUBLEAVES_ECX_UNCHANGED), VERR_INVALID_FLAGS);
-    AssertReturn(pNewLeaf->fSubLeafMask != 0 || pNewLeaf->uSubLeaf == 0, VERR_INVALID_PARAMETER);
-    AssertReturn(RT_IS_POWER_OF_TWO(pNewLeaf->fSubLeafMask + 1), VERR_INVALID_PARAMETER);
-    AssertReturn((pNewLeaf->fSubLeafMask & pNewLeaf->uSubLeaf) == pNewLeaf->uSubLeaf, VERR_INVALID_PARAMETER);
-
+    AssertLogRelMsgReturn(!(pNewLeaf->fFlags & ~CPUMCPUIDLEAF_F_VALID_MASK),
+                          ("%#x/%#x: %#x", pNewLeaf->uLeaf, pNewLeaf->uSubLeaf, pNewLeaf->fFlags),
+                          VERR_INVALID_FLAGS);
+    AssertLogRelMsgReturn(pNewLeaf->fSubLeafMask != 0 || pNewLeaf->uSubLeaf == 0,
+                          ("%#x/%#x: %#x", pNewLeaf->uLeaf, pNewLeaf->uSubLeaf, pNewLeaf->fSubLeafMask),
+                          VERR_INVALID_PARAMETER);
+    AssertLogRelMsgReturn(RT_IS_POWER_OF_TWO(pNewLeaf->fSubLeafMask + 1),
+                          ("%#x/%#x: %#x", pNewLeaf->uLeaf, pNewLeaf->uSubLeaf, pNewLeaf->fSubLeafMask),
+                          VERR_INVALID_PARAMETER);
+    AssertLogRelMsgReturn((pNewLeaf->fSubLeafMask & pNewLeaf->uSubLeaf) == pNewLeaf->uSubLeaf,
+                          ("%#x/%#x: %#x", pNewLeaf->uLeaf, pNewLeaf->uSubLeaf, pNewLeaf->fSubLeafMask),
+                          VERR_INVALID_PARAMETER);
 
     /*
-     * Find insertion point. The lazy bird uses the same excuse as in
-     * cpumR3CpuIdGetLeaf().
+     * Find insertion point.  The lazy bird uses the same excuse as in
+     * cpumR3CpuIdGetLeaf(), but optimizes for linear insertion (saved state).
      */
-    uint32_t i = 0;
-    while (   i < cLeaves
-           && paLeaves[i].uLeaf < pNewLeaf->uLeaf)
-        i++;
+    uint32_t i;
+    if (   cLeaves > 0
+        && paLeaves[cLeaves - 1].uLeaf < pNewLeaf->uLeaf)
+    {
+        /* Add at end. */
+        i = cLeaves;
+    }
+    else if (   cLeaves > 0
+             && paLeaves[cLeaves - 1].uLeaf == pNewLeaf->uLeaf)
+    {
+        /* Either replacing the last leaf or dealing with sub-leaves. Spool
+           back to the first sub-leaf to pretend we did the linear search. */
+        i = cLeaves - 1;
+        while (   i > 0
+               && paLeaves[i - 1].uLeaf == pNewLeaf->uLeaf)
+            i--;
+    }
+    else
+    {
+        /* Linear search from the start. */
+        i = 0;
+        while (   i < cLeaves
+                  && paLeaves[i].uLeaf < pNewLeaf->uLeaf)
+            i++;
+    }
     if (   i < cLeaves
         && paLeaves[i].uLeaf == pNewLeaf->uLeaf)
     {
         if (paLeaves[i].fSubLeafMask != pNewLeaf->fSubLeafMask)
         {
             /*
-             * The subleaf mask differs, replace all existing leaves with the
+             * The sub-leaf mask differs, replace all existing leaves with the
              * same leaf number.
              */
             uint32_t c = 1;
             while (   i + c < cLeaves
-                   && paLeaves[i + c].uSubLeaf == pNewLeaf->uLeaf)
+                   && paLeaves[i + c].uLeaf == pNewLeaf->uLeaf)
                 c++;
             if (c > 1 && i + c < cLeaves)
             {
@@ -678,21 +815,25 @@ int cpumR3CpuIdInsert(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves, PCPUMCPUIDL
             }
 
             paLeaves[i] = *pNewLeaf;
+            cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves);
             return VINF_SUCCESS;
         }
 
-        /* Find subleaf insertion point. */
+        /* Find sub-leaf insertion point. */
         while (   i < cLeaves
-               && paLeaves[i].uSubLeaf < pNewLeaf->uSubLeaf)
+               && paLeaves[i].uSubLeaf < pNewLeaf->uSubLeaf
+               && paLeaves[i].uLeaf == pNewLeaf->uLeaf)
             i++;
 
         /*
          * If we've got an exactly matching leaf, replace it.
          */
-        if (   paLeaves[i].uLeaf    == pNewLeaf->uLeaf
+        if (   i < cLeaves
+            && paLeaves[i].uLeaf    == pNewLeaf->uLeaf
             && paLeaves[i].uSubLeaf == pNewLeaf->uSubLeaf)
         {
             paLeaves[i] = *pNewLeaf;
+            cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves);
             return VINF_SUCCESS;
         }
     }
@@ -700,7 +841,8 @@ int cpumR3CpuIdInsert(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves, PCPUMCPUIDL
     /*
      * Adding a new leaf at 'i'.
      */
-    paLeaves = cpumR3CpuIdEnsureSpace(ppaLeaves, cLeaves);
+    AssertLogRelReturn(cLeaves < CPUM_CPUID_MAX_LEAVES, VERR_TOO_MANY_CPUID_LEAVES);
+    paLeaves = cpumR3CpuIdEnsureSpace(pVM, ppaLeaves, cLeaves);
     if (!paLeaves)
         return VERR_NO_MEMORY;
 
@@ -708,6 +850,8 @@ int cpumR3CpuIdInsert(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves, PCPUMCPUIDL
         memmove(&paLeaves[i + 1], &paLeaves[i], (cLeaves - i) * sizeof(paLeaves[0]));
     *pcLeaves += 1;
     paLeaves[i] = *pNewLeaf;
+
+    cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves);
     return VINF_SUCCESS;
 }
 
@@ -722,7 +866,7 @@ int cpumR3CpuIdInsert(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves, PCPUMCPUIDL
  * @param   uFirst          The first leaf.
  * @param   uLast           The last leaf.
  */
-void cpumR3CpuIdRemoveRange(PCPUMCPUIDLEAF paLeaves, uint32_t *pcLeaves, uint32_t uFirst, uint32_t uLast)
+static void cpumR3CpuIdRemoveRange(PCPUMCPUIDLEAF paLeaves, uint32_t *pcLeaves, uint32_t uFirst, uint32_t uLast)
 {
     uint32_t cLeaves = *pcLeaves;
 
@@ -753,6 +897,8 @@ void cpumR3CpuIdRemoveRange(PCPUMCPUIDLEAF paLeaves, uint32_t *pcLeaves, uint32_
             memmove(&paLeaves[iFirst], &paLeaves[iEnd], (cLeaves - iEnd) * sizeof(paLeaves[0]));
         *pcLeaves = cLeaves -= (iEnd - iFirst);
     }
+
+    cpumR3CpuIdAssertOrder(paLeaves, *pcLeaves);
 }
 
 
@@ -764,7 +910,7 @@ void cpumR3CpuIdRemoveRange(PCPUMCPUIDLEAF paLeaves, uint32_t *pcLeaves, uint32_
  * @param   uLeaf               The leaf we're reading.
  * @param   pcSubLeaves         Number of sub-leaves accessible via ECX.
  * @param   pfFinalEcxUnchanged Whether ECX is passed thru when going beyond the
- *                              final sub-leaf.
+ *                              final sub-leaf (for leaf 0xb only).
  */
 static bool cpumR3IsEcxRelevantForCpuIdLeaf(uint32_t uLeaf, uint32_t *pcSubLeaves, bool *pfFinalEcxUnchanged)
 {
@@ -792,6 +938,7 @@ static bool cpumR3IsEcxRelevantForCpuIdLeaf(uint32_t uLeaf, uint32_t *pcSubLeave
     }
 
     /* Count sub-leaves. */
+    uint32_t cMinLeaves = uLeaf == 0xd ? 64 : 0;
     uint32_t cRepeats = 0;
     uSubLeaf = 0;
     for (;;)
@@ -801,14 +948,7 @@ static bool cpumR3IsEcxRelevantForCpuIdLeaf(uint32_t uLeaf, uint32_t *pcSubLeave
         /* Figuring out when to stop isn't entirely straight forward as we need
            to cover undocumented behavior up to a point and implementation shortcuts. */
 
-        /* 1. Look for zero values. */
-        if (   auCur[0] == 0
-            && auCur[1] == 0
-            && (auCur[2] == 0 || auCur[2] == uSubLeaf)
-            && (auCur[3] == 0 || uLeaf == 0xb /* edx is fixed */) )
-            break;
-
-        /* 2. Look for more than 4 repeating value sets. */
+        /* 1. Look for more than 4 repeating value sets. */
         if (   auCur[0] == auPrev[0]
             && auCur[1] == auPrev[1]
             && (    auCur[2] == auPrev[2]
@@ -816,18 +956,39 @@ static bool cpumR3IsEcxRelevantForCpuIdLeaf(uint32_t uLeaf, uint32_t *pcSubLeave
                     && auPrev[2] == uSubLeaf - 1) )
             && auCur[3] == auPrev[3])
         {
-            cRepeats++;
-            if (cRepeats > 4)
+            if (   uLeaf != 0xd
+                || uSubLeaf >= 64
+                || (   auCur[0] == 0
+                    && auCur[1] == 0
+                    && auCur[2] == 0
+                    && auCur[3] == 0
+                    && auPrev[2] == 0) )
+                cRepeats++;
+            if (cRepeats > 4 && uSubLeaf >= cMinLeaves)
                 break;
         }
         else
             cRepeats = 0;
 
+        /* 2. Look for zero values. */
+        if (   auCur[0] == 0
+            && auCur[1] == 0
+            && (auCur[2] == 0 || auCur[2] == uSubLeaf)
+            && (auCur[3] == 0 || uLeaf == 0xb /* edx is fixed */)
+            && uSubLeaf >= cMinLeaves)
+        {
+            cRepeats = 0;
+            break;
+        }
+
         /* 3. Leaf 0xb level type 0 check. */
         if (   uLeaf == 0xb
-            && (auCur[3]  & 0xff00) == 0
-            && (auPrev[3] & 0xff00) == 0)
+            && (auCur[2]  & 0xff00) == 0
+            && (auPrev[2] & 0xff00) == 0)
+        {
+            cRepeats = 0;
             break;
+        }
 
         /* 99. Give up. */
         if (uSubLeaf >= 128)
@@ -840,11 +1001,13 @@ static bool cpumR3IsEcxRelevantForCpuIdLeaf(uint32_t uLeaf, uint32_t *pcSubLeave
                 cDocLimit = 4;
             else if (uLeaf == 0x7)
                 cDocLimit = 1;
+            else if (uLeaf == 0xd)
+                cDocLimit = 63;
             else if (uLeaf == 0xf)
                 cDocLimit = 2;
             if (cDocLimit != UINT32_MAX)
             {
-                *pfFinalEcxUnchanged = auCur[2] == uSubLeaf;
+                *pfFinalEcxUnchanged = auCur[2] == uSubLeaf && uLeaf == 0xb;
                 *pcSubLeaves = cDocLimit + 3;
                 return true;
             }
@@ -859,13 +1022,71 @@ static bool cpumR3IsEcxRelevantForCpuIdLeaf(uint32_t uLeaf, uint32_t *pcSubLeave
     }
 
     /* Standard exit. */
-    *pfFinalEcxUnchanged = auCur[2] == uSubLeaf;
+    *pfFinalEcxUnchanged = auCur[2] == uSubLeaf && uLeaf == 0xb;
     *pcSubLeaves = uSubLeaf + 1 - cRepeats;
+    if (*pcSubLeaves == 0)
+        *pcSubLeaves = 1;
     return true;
 }
 
 
 /**
+ * Gets a CPU ID leaf.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pLeaf       Where to store the found leaf.
+ * @param   uLeaf       The leaf to locate.
+ * @param   uSubLeaf    The subleaf to locate.  Pass 0 if no subleaves.
+ */
+VMMR3DECL(int) CPUMR3CpuIdGetLeaf(PVM pVM, PCPUMCPUIDLEAF pLeaf, uint32_t uLeaf, uint32_t uSubLeaf)
+{
+    PCPUMCPUIDLEAF pcLeaf = cpumR3CpuIdGetLeaf(pVM->cpum.s.GuestInfo.paCpuIdLeavesR3, pVM->cpum.s.GuestInfo.cCpuIdLeaves,
+                                               uLeaf, uSubLeaf);
+    if (pcLeaf)
+    {
+        memcpy(pLeaf, pcLeaf, sizeof(*pLeaf));
+        return VINF_SUCCESS;
+    }
+
+    return VERR_NOT_FOUND;
+}
+
+
+/**
+ * Inserts a CPU ID leaf, replacing any existing ones.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pNewLeaf    Pointer to the leaf being inserted.
+ */
+VMMR3DECL(int) CPUMR3CpuIdInsert(PVM pVM, PCPUMCPUIDLEAF pNewLeaf)
+{
+    /*
+     * Validate parameters.
+     */
+    AssertReturn(pVM, VERR_INVALID_PARAMETER);
+    AssertReturn(pNewLeaf, VERR_INVALID_PARAMETER);
+
+    /*
+     * Disallow replacing CPU ID leaves that this API currently cannot manage.
+     * These leaves have dependencies on saved-states, see PATMCpuidReplacement().
+     * If you want to modify these leaves, use CPUMSetGuestCpuIdFeature().
+     */
+    if (   pNewLeaf->uLeaf == UINT32_C(0x00000000)  /* Standard */
+        || pNewLeaf->uLeaf == UINT32_C(0x00000001)
+        || pNewLeaf->uLeaf == UINT32_C(0x80000000)  /* Extended */
+        || pNewLeaf->uLeaf == UINT32_C(0x80000001)
+        || pNewLeaf->uLeaf == UINT32_C(0xc0000000)  /* Centaur */
+        || pNewLeaf->uLeaf == UINT32_C(0xc0000001) )
+    {
+        return VERR_NOT_SUPPORTED;
+    }
+
+    return cpumR3CpuIdInsert(pVM, NULL /* ppaLeaves */, NULL /* pcLeaves */, pNewLeaf);
+}
+
+/**
  * Collects CPUID leaves and sub-leaves, returning a sorted array of them.
  *
  * @returns VBox status code.
@@ -921,6 +1142,24 @@ VMMR3DECL(int) CPUMR3CpuIdCollectLeaves(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcL
             uint32_t cLeaves = uEax - uLeaf + 1;
             while (cLeaves-- > 0)
             {
+                ASMCpuIdExSlow(uLeaf, 0, 0, 0, &uEax, &uEbx, &uEcx, &uEdx);
+
+                uint32_t fFlags = 0;
+
+                /* There are currently three known leaves containing an APIC ID
+                   that needs EMT specific attention */
+                if (uLeaf == 1)
+                    fFlags |= CPUMCPUIDLEAF_F_CONTAINS_APIC_ID;
+                else if (uLeaf == 0xb && uEcx != 0)
+                    fFlags |= CPUMCPUIDLEAF_F_CONTAINS_APIC_ID;
+                else if (   uLeaf == UINT32_C(0x8000001e)
+                         && (   uEax
+                             || uEbx
+                             || uEdx
+                             || ASMIsAmdCpuEx((*ppaLeaves)[0].uEbx, (*ppaLeaves)[0].uEcx, (*ppaLeaves)[0].uEdx)) )
+                    fFlags |= CPUMCPUIDLEAF_F_CONTAINS_APIC_ID;
+
+
                 /* Check three times here to reduce the chance of CPU migration
                    resulting in false positives with things like the APIC ID. */
                 uint32_t cSubLeaves;
@@ -929,7 +1168,7 @@ VMMR3DECL(int) CPUMR3CpuIdCollectLeaves(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcL
                     && cpumR3IsEcxRelevantForCpuIdLeaf(uLeaf, &cSubLeaves, &fFinalEcxUnchanged)
                     && cpumR3IsEcxRelevantForCpuIdLeaf(uLeaf, &cSubLeaves, &fFinalEcxUnchanged))
                 {
-                    if (cSubLeaves > 16)
+                    if (cSubLeaves > (uLeaf == 0xd ? 68U : 16U))
                     {
                         /* This shouldn't happen.  But in case it does, file all
                            relevant details in the release log. */
@@ -951,22 +1190,22 @@ VMMR3DECL(int) CPUMR3CpuIdCollectLeaves(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcL
                         return VERR_CPUM_TOO_MANY_CPUID_SUBLEAVES;
                     }
 
+                    if (fFinalEcxUnchanged)
+                        fFlags |= CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES;
+
                     for (uint32_t uSubLeaf = 0; uSubLeaf < cSubLeaves; uSubLeaf++)
                     {
                         ASMCpuIdExSlow(uLeaf, 0, uSubLeaf, 0, &uEax, &uEbx, &uEcx, &uEdx);
                         int rc = cpumR3CollectCpuIdInfoAddOne(ppaLeaves, pcLeaves,
-                                                              uLeaf, uSubLeaf, UINT32_MAX, uEax, uEbx, uEcx, uEdx,
-                                                              uSubLeaf + 1 == cSubLeaves && fFinalEcxUnchanged
-                                                              ? CPUMCPUIDLEAF_F_SUBLEAVES_ECX_UNCHANGED : 0);
+                                                              uLeaf, uSubLeaf, UINT32_MAX, uEax, uEbx, uEcx, uEdx, fFlags);
                         if (RT_FAILURE(rc))
                             return rc;
                     }
                 }
                 else
                 {
-                    ASMCpuIdExSlow(uLeaf, 0, 0, 0, &uEax, &uEbx, &uEcx, &uEdx);
                     int rc = cpumR3CollectCpuIdInfoAddOne(ppaLeaves, pcLeaves,
-                                                          uLeaf, 0, 0, uEax, uEbx, uEcx, uEdx, 0);
+                                                          uLeaf, 0, 0, uEax, uEbx, uEcx, uEdx, fFlags);
                     if (RT_FAILURE(rc))
                         return rc;
                 }
@@ -1012,6 +1251,7 @@ VMMR3DECL(int) CPUMR3CpuIdCollectLeaves(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcL
         }
     }
 
+    cpumR3CpuIdAssertOrder(*ppaLeaves, *pcLeaves);
     return VINF_SUCCESS;
 }
 
@@ -1025,7 +1265,7 @@ VMMR3DECL(int) CPUMR3CpuIdCollectLeaves(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcL
  *                              will be set, even if the resulting method
  *                              doesn't actually needs it.
  */
-VMMR3DECL(int) CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUKNOWNCPUID penmUnknownMethod, PCPUMCPUID pDefUnknown)
+VMMR3DECL(int) CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUNKNOWNCPUID penmUnknownMethod, PCPUMCPUID pDefUnknown)
 {
     uint32_t uLastStd = ASMCpuId_EAX(0);
     uint32_t uLastExt = ASMCpuId_EAX(0x80000000);
@@ -1066,11 +1306,11 @@ VMMR3DECL(int) CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUKNOWNCPUID penmUnknownMe
     /*
      * Simple method, all zeros.
      */
-    *penmUnknownMethod = CPUMUKNOWNCPUID_DEFAULTS;
-    pDefUnknown->eax = 0;
-    pDefUnknown->ebx = 0;
-    pDefUnknown->ecx = 0;
-    pDefUnknown->edx = 0;
+    *penmUnknownMethod = CPUMUNKNOWNCPUID_DEFAULTS;
+    pDefUnknown->uEax = 0;
+    pDefUnknown->uEbx = 0;
+    pDefUnknown->uEcx = 0;
+    pDefUnknown->uEdx = 0;
 
     /*
      * Intel has been observed returning the last standard leaf.
@@ -1125,15 +1365,15 @@ VMMR3DECL(int) CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUKNOWNCPUID penmUnknownMe
 
         Log(("CPUM: cNeither=%d cSame=%d cLastWithEcx=%d cTotal=%d\n", cNeither, cSame, cLastWithEcx, cTotal));
         if (cSame == cTotal)
-            *penmUnknownMethod = CPUMUKNOWNCPUID_LAST_STD_LEAF;
+            *penmUnknownMethod = CPUMUNKNOWNCPUID_LAST_STD_LEAF;
         else if (cLastWithEcx == cTotal)
-            *penmUnknownMethod = CPUMUKNOWNCPUID_LAST_STD_LEAF_WITH_ECX;
+            *penmUnknownMethod = CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX;
         else
-            *penmUnknownMethod = CPUMUKNOWNCPUID_LAST_STD_LEAF;
-        pDefUnknown->eax = auLast[0];
-        pDefUnknown->ebx = auLast[1];
-        pDefUnknown->ecx = auLast[2];
-        pDefUnknown->edx = auLast[3];
+            *penmUnknownMethod = CPUMUNKNOWNCPUID_LAST_STD_LEAF;
+        pDefUnknown->uEax = auLast[0];
+        pDefUnknown->uEbx = auLast[1];
+        pDefUnknown->uEcx = auLast[2];
+        pDefUnknown->uEdx = auLast[3];
         return VINF_SUCCESS;
     }
 
@@ -1163,7 +1403,7 @@ VMMR3DECL(int) CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUKNOWNCPUID penmUnknownMe
     }
     if (cChecks == 0)
     {
-        *penmUnknownMethod = CPUMUKNOWNCPUID_PASSTHRU;
+        *penmUnknownMethod = CPUMUNKNOWNCPUID_PASSTHRU;
         return VINF_SUCCESS;
     }
 
@@ -1180,18 +1420,18 @@ VMMR3DECL(int) CPUMR3CpuIdDetectUnknownLeafMethod(PCPUMUKNOWNCPUID penmUnknownMe
  * @returns Read only name string.
  * @param   enmUnknownMethod    The method to translate.
  */
-VMMR3DECL(const char *) CPUMR3CpuIdUnknownLeafMethodName(CPUMUKNOWNCPUID enmUnknownMethod)
+VMMR3DECL(const char *) CPUMR3CpuIdUnknownLeafMethodName(CPUMUNKNOWNCPUID enmUnknownMethod)
 {
     switch (enmUnknownMethod)
     {
-        case CPUMUKNOWNCPUID_DEFAULTS:                  return "DEFAULTS";
-        case CPUMUKNOWNCPUID_LAST_STD_LEAF:             return "LAST_STD_LEAF";
-        case CPUMUKNOWNCPUID_LAST_STD_LEAF_WITH_ECX:    return "LAST_STD_LEAF_WITH_ECX";
-        case CPUMUKNOWNCPUID_PASSTHRU:                  return "PASSTHRU";
+        case CPUMUNKNOWNCPUID_DEFAULTS:                  return "DEFAULTS";
+        case CPUMUNKNOWNCPUID_LAST_STD_LEAF:             return "LAST_STD_LEAF";
+        case CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX:    return "LAST_STD_LEAF_WITH_ECX";
+        case CPUMUNKNOWNCPUID_PASSTHRU:                  return "PASSTHRU";
 
-        case CPUMUKNOWNCPUID_INVALID:
-        case CPUMUKNOWNCPUID_END:
-        case CPUMUKNOWNCPUID_32BIT_HACK:
+        case CPUMUNKNOWNCPUID_INVALID:
+        case CPUMUNKNOWNCPUID_END:
+        case CPUMUNKNOWNCPUID_32BIT_HACK:
             break;
     }
     return "Invalid-unknown-CPUID-method";
@@ -1275,6 +1515,27 @@ static PCCPUMCPUIDLEAF cpumR3CpuIdFindLeaf(PCCPUMCPUIDLEAF paLeaves, uint32_t cL
 }
 
 
+static PCCPUMCPUIDLEAF cpumR3CpuIdFindLeafEx(PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uint32_t uLeaf, uint32_t uSubLeaf)
+{
+    PCCPUMCPUIDLEAF pLeaf = cpumR3CpuIdFindLeaf(paLeaves, cLeaves, uLeaf);
+    if (   !pLeaf
+        || pLeaf->uSubLeaf != (uSubLeaf & pLeaf->fSubLeafMask))
+        return pLeaf;
+
+    /* Linear sub-leaf search. Lazy as usual. */
+    cLeaves -= pLeaf - paLeaves;
+    while (   cLeaves-- > 0
+           && pLeaf->uLeaf == uLeaf)
+    {
+        if (pLeaf->uSubLeaf == (uSubLeaf & pLeaf->fSubLeafMask))
+            return pLeaf;
+        pLeaf++;
+    }
+
+    return NULL;
+}
+
+
 int cpumR3CpuIdExplodeFeatures(PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, PCPUMFEATURES pFeatures)
 {
     RT_ZERO(*pFeatures);
@@ -1282,14 +1543,18 @@ int cpumR3CpuIdExplodeFeatures(PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, PCPUM
     {
         AssertLogRelReturn(paLeaves[0].uLeaf == 0, VERR_CPUM_IPE_1);
         AssertLogRelReturn(paLeaves[1].uLeaf == 1, VERR_CPUM_IPE_1);
+        PCCPUMCPUIDLEAF const pStd0Leaf = cpumR3CpuIdFindLeafEx(paLeaves, cLeaves, 0, 0);
+        AssertLogRelReturn(pStd0Leaf, VERR_CPUM_IPE_1);
+        PCCPUMCPUIDLEAF const pStd1Leaf = cpumR3CpuIdFindLeafEx(paLeaves, cLeaves, 1, 0);
+        AssertLogRelReturn(pStd1Leaf, VERR_CPUM_IPE_1);
 
-        pFeatures->enmCpuVendor = CPUMR3CpuIdDetectVendorEx(paLeaves[0].uEax,
-                                                            paLeaves[0].uEbx,
-                                                            paLeaves[0].uEcx,
-                                                            paLeaves[0].uEdx);
-        pFeatures->uFamily      = ASMGetCpuFamily(paLeaves[1].uEax);
-        pFeatures->uModel       = ASMGetCpuModel(paLeaves[1].uEax, pFeatures->enmCpuVendor == CPUMCPUVENDOR_INTEL);
-        pFeatures->uStepping    = ASMGetCpuStepping(paLeaves[1].uEax);
+        pFeatures->enmCpuVendor = CPUMR3CpuIdDetectVendorEx(pStd0Leaf->uEax,
+                                                            pStd0Leaf->uEbx,
+                                                            pStd0Leaf->uEcx,
+                                                            pStd0Leaf->uEdx);
+        pFeatures->uFamily      = ASMGetCpuFamily(pStd1Leaf->uEax);
+        pFeatures->uModel       = ASMGetCpuModel(pStd1Leaf->uEax, pFeatures->enmCpuVendor == CPUMCPUVENDOR_INTEL);
+        pFeatures->uStepping    = ASMGetCpuStepping(pStd1Leaf->uEax);
         pFeatures->enmMicroarch = CPUMR3CpuIdDetermineMicroarchEx((CPUMCPUVENDOR)pFeatures->enmCpuVendor,
                                                                   pFeatures->uFamily,
                                                                   pFeatures->uModel,
@@ -1298,23 +1563,50 @@ int cpumR3CpuIdExplodeFeatures(PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, PCPUM
         PCCPUMCPUIDLEAF pLeaf = cpumR3CpuIdFindLeaf(paLeaves, cLeaves, 0x80000008);
         if (pLeaf)
             pFeatures->cMaxPhysAddrWidth = pLeaf->uEax & 0xff;
-        else if (paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_PSE36)
+        else if (pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_PSE36)
             pFeatures->cMaxPhysAddrWidth = 36;
         else
             pFeatures->cMaxPhysAddrWidth = 32;
 
         /* Standard features. */
-        pFeatures->fMsr                 = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_MSR);
-        pFeatures->fApic                = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_APIC);
-        pFeatures->fX2Apic              = RT_BOOL(paLeaves[1].uEcx & X86_CPUID_FEATURE_ECX_X2APIC);
-        pFeatures->fPse                 = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_PSE);
-        pFeatures->fPse36               = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_PSE36);
-        pFeatures->fPae                 = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_PAE);
-        pFeatures->fPat                 = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_PAT);
-        pFeatures->fFxSaveRstor         = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_FXSR);
-        pFeatures->fSysEnter            = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_SEP);
-        pFeatures->fHypervisorPresent   = RT_BOOL(paLeaves[1].uEcx & X86_CPUID_FEATURE_ECX_HVP);
-        pFeatures->fMonitorMWait        = RT_BOOL(paLeaves[1].uEcx & X86_CPUID_FEATURE_ECX_MONITOR);
+        pFeatures->fMsr                 = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_MSR);
+        pFeatures->fApic                = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_APIC);
+        pFeatures->fX2Apic              = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_X2APIC);
+        pFeatures->fPse                 = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_PSE);
+        pFeatures->fPse36               = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_PSE36);
+        pFeatures->fPae                 = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_PAE);
+        pFeatures->fPat                 = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_PAT);
+        pFeatures->fFxSaveRstor         = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_FXSR);
+        pFeatures->fXSaveRstor          = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_XSAVE);
+        pFeatures->fOpSysXSaveRstor     = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_OSXSAVE);
+        pFeatures->fMmx                 = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_MMX);
+        pFeatures->fSse                 = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_SSE);
+        pFeatures->fSse2                = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_SSE2);
+        pFeatures->fSse3                = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_SSE3);
+        pFeatures->fSsse3               = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_SSSE3);
+        pFeatures->fSse41               = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_SSE4_1);
+        pFeatures->fSse42               = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_SSE4_2);
+        pFeatures->fAvx                 = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_AVX);
+        pFeatures->fTsc                 = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_TSC);
+        pFeatures->fSysEnter            = RT_BOOL(pStd1Leaf->uEdx & X86_CPUID_FEATURE_EDX_SEP);
+        pFeatures->fHypervisorPresent   = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_HVP);
+        pFeatures->fMonitorMWait        = RT_BOOL(pStd1Leaf->uEcx & X86_CPUID_FEATURE_ECX_MONITOR);
+
+        /* Structured extended features. */
+        PCCPUMCPUIDLEAF const pSxfLeaf0 = cpumR3CpuIdFindLeafEx(paLeaves, cLeaves, 7, 0);
+        if (pSxfLeaf0)
+        {
+            pFeatures->fAvx2                = RT_BOOL(pSxfLeaf0->uEcx & X86_CPUID_STEXT_FEATURE_EBX_AVX2);
+            pFeatures->fAvx512Foundation    = RT_BOOL(pSxfLeaf0->uEcx & X86_CPUID_STEXT_FEATURE_EBX_AVX512F);
+        }
+
+        /* MWAIT/MONITOR leaf. */
+        PCCPUMCPUIDLEAF const pMWaitLeaf = cpumR3CpuIdFindLeaf(paLeaves, cLeaves, 5);
+        if (pMWaitLeaf)
+        {
+            pFeatures->fMWaitExtensions = (pMWaitLeaf->uEcx & (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0))
+                                                           == (X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0);
+        }
 
         /* Extended features. */
         PCCPUMCPUIDLEAF const pExtLeaf  = cpumR3CpuIdFindLeaf(paLeaves, cLeaves, 0x80000001);
@@ -1325,6 +1617,11 @@ int cpumR3CpuIdExplodeFeatures(PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, PCPUM
             pFeatures->fNoExecute       = RT_BOOL(pExtLeaf->uEdx & X86_CPUID_EXT_FEATURE_EDX_NX);
             pFeatures->fLahfSahf        = RT_BOOL(pExtLeaf->uEcx & X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF);
             pFeatures->fRdTscP          = RT_BOOL(pExtLeaf->uEdx & X86_CPUID_EXT_FEATURE_EDX_RDTSCP);
+            pFeatures->fMovCr8In32Bit   = RT_BOOL(pExtLeaf->uEcx & X86_CPUID_AMD_FEATURE_ECX_CMPL);
+            pFeatures->f3DNow           = RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_3DNOW);
+            pFeatures->f3DNowPrefetch   = (pExtLeaf->uEcx & X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF)
+                                       || (pExtLeaf->uEdx & (  X86_CPUID_EXT_FEATURE_EDX_LONG_MODE
+                                                             | X86_CPUID_AMD_FEATURE_EDX_3DNOW));
         }
 
         if (   pExtLeaf
@@ -1338,6 +1635,9 @@ int cpumR3CpuIdExplodeFeatures(PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, PCPUM
             pFeatures->fPae            |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_PAE);
             pFeatures->fPat            |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_PAT);
             pFeatures->fFxSaveRstor    |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_FXSR);
+            pFeatures->fMmx            |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_MMX);
+            pFeatures->fTsc            |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_TSC);
+            pFeatures->fAmdMmxExts      = RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_AXMMX);
         }
 
         /*
@@ -1347,9 +1647,4666 @@ int cpumR3CpuIdExplodeFeatures(PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, PCPUM
                              && (pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_FFXSR)
                              && pFeatures->enmCpuVendor == CPUMCPUVENDOR_AMD
                              && pFeatures->uFamily >= 6 /* K7 and up */;
+
+        /*
+         * Max extended (/FPU) state.
+         */
+        pFeatures->cbMaxExtendedState = pFeatures->fFxSaveRstor ? sizeof(X86FXSTATE) : sizeof(X86FPUSTATE);
+        if (pFeatures->fXSaveRstor)
+        {
+            PCCPUMCPUIDLEAF const pXStateLeaf0 = cpumR3CpuIdFindLeafEx(paLeaves, cLeaves, 13, 0);
+            if (pXStateLeaf0)
+            {
+                if (   pXStateLeaf0->uEcx >= sizeof(X86FXSTATE)
+                    && pXStateLeaf0->uEcx <= CPUM_MAX_XSAVE_AREA_SIZE
+                    && RT_ALIGN_32(pXStateLeaf0->uEcx, 8) == pXStateLeaf0->uEcx
+                    && pXStateLeaf0->uEbx >= sizeof(X86FXSTATE)
+                    && pXStateLeaf0->uEbx <= pXStateLeaf0->uEcx
+                    && RT_ALIGN_32(pXStateLeaf0->uEbx, 8) == pXStateLeaf0->uEbx)
+                {
+                    pFeatures->cbMaxExtendedState = pXStateLeaf0->uEcx;
+
+                    PCCPUMCPUIDLEAF const pXStateLeaf1 = cpumR3CpuIdFindLeafEx(paLeaves, cLeaves, 13, 1);
+                    if (   pXStateLeaf1
+                        && pXStateLeaf1->uEbx > pFeatures->cbMaxExtendedState
+                        && pXStateLeaf1->uEbx <= CPUM_MAX_XSAVE_AREA_SIZE
+                        && (pXStateLeaf1->uEcx || pXStateLeaf1->uEdx) )
+                        pFeatures->cbMaxExtendedState = pXStateLeaf0->uEbx;
+                }
+                else
+                    AssertLogRelMsgFailedStmt(("Unexpected max/cur XSAVE area sizes: %#x/%#x\n", pXStateLeaf0->uEcx, pXStateLeaf0->uEbx),
+                                              pFeatures->fXSaveRstor = 0);
+            }
+            else
+                AssertLogRelMsgFailedStmt(("Expected leaf eax=0xd/ecx=0 with the XSAVE/XRSTOR feature!\n"),
+                                          pFeatures->fXSaveRstor = 0);
+        }
     }
     else
         AssertLogRelReturn(cLeaves == 0, VERR_CPUM_IPE_1);
     return VINF_SUCCESS;
 }
 
+
+/*
+ *
+ * Init related code.
+ * Init related code.
+ * Init related code.
+ *
+ *
+ */
+#ifdef VBOX_IN_VMM
+
+
+/**
+ * Gets an exactly matching leaf + sub-leaf in the CPUID leaf array.
+ *
+ * This ignores the fSubLeafMask.
+ *
+ * @returns Pointer to the matching leaf, or NULL if not found.
+ * @param   paLeaves            The CPUID leaves to search.  This is sorted.
+ * @param   cLeaves             The number of leaves in the array.
+ * @param   uLeaf               The leaf to locate.
+ * @param   uSubLeaf            The subleaf to locate.
+ */
+static PCPUMCPUIDLEAF cpumR3CpuIdGetExactLeaf(PCPUM pCpum, uint32_t uLeaf, uint32_t uSubLeaf)
+{
+    uint64_t        uNeedle   = RT_MAKE_U64(uSubLeaf, uLeaf);
+    PCPUMCPUIDLEAF  paLeaves  = pCpum->GuestInfo.paCpuIdLeavesR3;
+    uint32_t        iEnd      = pCpum->GuestInfo.cCpuIdLeaves;
+    if (iEnd)
+    {
+        uint32_t    iBegin   = 0;
+        for (;;)
+        {
+            uint32_t const i    = (iEnd - iBegin) / 2 + iBegin;
+            uint64_t const uCur = RT_MAKE_U64(paLeaves[i].uSubLeaf, paLeaves[i].uLeaf);
+            if (uNeedle < uCur)
+            {
+                if (i > iBegin)
+                    iEnd = i;
+                else
+                    break;
+            }
+            else if (uNeedle > uCur)
+            {
+                if (i + 1 < iEnd)
+                    iBegin = i + 1;
+                else
+                    break;
+            }
+            else
+                return &paLeaves[i];
+        }
+    }
+    return NULL;
+}
+
+
+/**
+ * Loads MSR range overrides.
+ *
+ * This must be called before the MSR ranges are moved from the normal heap to
+ * the hyper heap!
+ *
+ * @returns VBox status code (VMSetError called).
+ * @param   pVM                 Pointer to the cross context VM structure
+ * @param   pMsrNode            The CFGM node with the MSR overrides.
+ */
+static int cpumR3LoadMsrOverrides(PVM pVM, PCFGMNODE pMsrNode)
+{
+    for (PCFGMNODE pNode = CFGMR3GetFirstChild(pMsrNode); pNode; pNode = CFGMR3GetNextChild(pNode))
+    {
+        /*
+         * Assemble a valid MSR range.
+         */
+        CPUMMSRRANGE MsrRange;
+        MsrRange.offCpumCpu = 0;
+        MsrRange.fReserved  = 0;
+
+        int rc = CFGMR3GetName(pNode, MsrRange.szName, sizeof(MsrRange.szName));
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry (name is probably too long): %Rrc\n", rc);
+
+        rc = CFGMR3QueryU32(pNode, "First", &MsrRange.uFirst);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying mandatory 'First' value: %Rrc\n",
+                              MsrRange.szName, rc);
+
+        rc = CFGMR3QueryU32Def(pNode, "Last", &MsrRange.uLast, MsrRange.uFirst);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'Last' value: %Rrc\n",
+                              MsrRange.szName, rc);
+
+        char szType[32];
+        rc = CFGMR3QueryStringDef(pNode, "Type", szType, sizeof(szType), "FixedValue");
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'Type' value: %Rrc\n",
+                              MsrRange.szName, rc);
+        if (!RTStrICmp(szType, "FixedValue"))
+        {
+            MsrRange.enmRdFn = kCpumMsrRdFn_FixedValue;
+            MsrRange.enmWrFn = kCpumMsrWrFn_IgnoreWrite;
+
+            rc = CFGMR3QueryU64Def(pNode, "Value", &MsrRange.uValue, 0);
+            if (RT_FAILURE(rc))
+                return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'Value' value: %Rrc\n",
+                                  MsrRange.szName, rc);
+
+            rc = CFGMR3QueryU64Def(pNode, "WrGpMask", &MsrRange.fWrGpMask, 0);
+            if (RT_FAILURE(rc))
+                return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'WrGpMask' value: %Rrc\n",
+                                  MsrRange.szName, rc);
+
+            rc = CFGMR3QueryU64Def(pNode, "WrIgnMask", &MsrRange.fWrIgnMask, 0);
+            if (RT_FAILURE(rc))
+                return VMSetError(pVM, rc, RT_SRC_POS, "Invalid MSR entry '%s': Error querying 'WrIgnMask' value: %Rrc\n",
+                                  MsrRange.szName, rc);
+        }
+        else
+            return VMSetError(pVM, VERR_INVALID_PARAMETER, RT_SRC_POS,
+                              "Invalid MSR entry '%s': Unknown type '%s'\n", MsrRange.szName, szType);
+
+        /*
+         * Insert the range into the table (replaces/splits/shrinks existing
+         * MSR ranges).
+         */
+        rc = cpumR3MsrRangesInsert(NULL /* pVM */, &pVM->cpum.s.GuestInfo.paMsrRangesR3, &pVM->cpum.s.GuestInfo.cMsrRanges,
+                                   &MsrRange);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Error adding MSR entry '%s': %Rrc\n", MsrRange.szName, rc);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Loads CPUID leaf overrides.
+ *
+ * This must be called before the CPUID leaves are moved from the normal
+ * heap to the hyper heap!
+ *
+ * @returns VBox status code (VMSetError called).
+ * @param   pVM             Pointer to the cross context VM structure
+ * @param   pParentNode     The CFGM node with the CPUID leaves.
+ * @param   pszLabel        How to label the overrides we're loading.
+ */
+static int cpumR3LoadCpuIdOverrides(PVM pVM, PCFGMNODE pParentNode, const char *pszLabel)
+{
+    for (PCFGMNODE pNode = CFGMR3GetFirstChild(pParentNode); pNode; pNode = CFGMR3GetNextChild(pNode))
+    {
+        /*
+         * Get the leaf and subleaf numbers.
+         */
+        char szName[128];
+        int rc = CFGMR3GetName(pNode, szName, sizeof(szName));
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry (name is probably too long): %Rrc\n", pszLabel, rc);
+
+        /* The leaf number is either specified directly or thru the node name. */
+        uint32_t uLeaf;
+        rc = CFGMR3QueryU32(pNode, "Leaf", &uLeaf);
+        if (rc == VERR_CFGM_VALUE_NOT_FOUND)
+        {
+            rc = RTStrToUInt32Full(szName, 16, &uLeaf);
+            if (rc != VINF_SUCCESS)
+                return VMSetError(pVM, VERR_INVALID_NAME, RT_SRC_POS,
+                                  "Invalid %s entry: Invalid leaf number: '%s' \n", pszLabel, szName);
+        }
+        else if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'Leaf' value: %Rrc\n",
+                              pszLabel, szName, rc);
+
+        uint32_t uSubLeaf;
+        rc = CFGMR3QueryU32Def(pNode, "SubLeaf", &uSubLeaf, 0);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'SubLeaf' value: %Rrc\n",
+                              pszLabel, szName, rc);
+
+        uint32_t fSubLeafMask;
+        rc = CFGMR3QueryU32Def(pNode, "SubLeafMask", &fSubLeafMask, 0);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'SubLeafMask' value: %Rrc\n",
+                              pszLabel, szName, rc);
+
+        /*
+         * Look up the specified leaf, since the output register values
+         * defaults to any existing values.  This allows overriding a single
+         * register, without needing to know the other values.
+         */
+        PCCPUMCPUIDLEAF pLeaf = cpumR3CpuIdGetExactLeaf(&pVM->cpum.s, uLeaf, uSubLeaf);
+        CPUMCPUIDLEAF   Leaf;
+        if (pLeaf)
+            Leaf = *pLeaf;
+        else
+            RT_ZERO(Leaf);
+        Leaf.uLeaf          = uLeaf;
+        Leaf.uSubLeaf       = uSubLeaf;
+        Leaf.fSubLeafMask   = fSubLeafMask;
+
+        rc = CFGMR3QueryU32Def(pNode, "eax", &Leaf.uEax, Leaf.uEax);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'eax' value: %Rrc\n",
+                              pszLabel, szName, rc);
+        rc = CFGMR3QueryU32Def(pNode, "ebx", &Leaf.uEbx, Leaf.uEbx);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'ebx' value: %Rrc\n",
+                              pszLabel, szName, rc);
+        rc = CFGMR3QueryU32Def(pNode, "ecx", &Leaf.uEcx, Leaf.uEcx);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'ecx' value: %Rrc\n",
+                              pszLabel, szName, rc);
+        rc = CFGMR3QueryU32Def(pNode, "edx", &Leaf.uEdx, Leaf.uEdx);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Invalid %s entry '%s': Error querying 'edx' value: %Rrc\n",
+                              pszLabel, szName, rc);
+
+        /*
+         * Insert the leaf into the table (replaces existing ones).
+         */
+        rc = cpumR3CpuIdInsert(NULL /* pVM */, &pVM->cpum.s.GuestInfo.paCpuIdLeavesR3, &pVM->cpum.s.GuestInfo.cCpuIdLeaves,
+                               &Leaf);
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Error adding CPUID leaf entry '%s': %Rrc\n", szName, rc);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+
+/**
+ * Fetches overrides for a CPUID leaf.
+ *
+ * @returns VBox status code.
+ * @param   pLeaf               The leaf to load the overrides into.
+ * @param   pCfgNode            The CFGM node containing the overrides
+ *                              (/CPUM/HostCPUID/ or /CPUM/CPUID/).
+ * @param   iLeaf               The CPUID leaf number.
+ */
+static int cpumR3CpuIdFetchLeafOverride(PCPUMCPUID pLeaf, PCFGMNODE pCfgNode, uint32_t iLeaf)
+{
+    PCFGMNODE pLeafNode = CFGMR3GetChildF(pCfgNode, "%RX32", iLeaf);
+    if (pLeafNode)
+    {
+        uint32_t u32;
+        int rc = CFGMR3QueryU32(pLeafNode, "eax", &u32);
+        if (RT_SUCCESS(rc))
+            pLeaf->uEax = u32;
+        else
+            AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
+
+        rc = CFGMR3QueryU32(pLeafNode, "ebx", &u32);
+        if (RT_SUCCESS(rc))
+            pLeaf->uEbx = u32;
+        else
+            AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
+
+        rc = CFGMR3QueryU32(pLeafNode, "ecx", &u32);
+        if (RT_SUCCESS(rc))
+            pLeaf->uEcx = u32;
+        else
+            AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
+
+        rc = CFGMR3QueryU32(pLeafNode, "edx", &u32);
+        if (RT_SUCCESS(rc))
+            pLeaf->uEdx = u32;
+        else
+            AssertReturn(rc == VERR_CFGM_VALUE_NOT_FOUND, rc);
+
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Load the overrides for a set of CPUID leaves.
+ *
+ * @returns VBox status code.
+ * @param   paLeaves            The leaf array.
+ * @param   cLeaves             The number of leaves.
+ * @param   uStart              The start leaf number.
+ * @param   pCfgNode            The CFGM node containing the overrides
+ *                              (/CPUM/HostCPUID/ or /CPUM/CPUID/).
+ */
+static int cpumR3CpuIdInitLoadOverrideSet(uint32_t uStart, PCPUMCPUID paLeaves, uint32_t cLeaves, PCFGMNODE pCfgNode)
+{
+    for (uint32_t i = 0; i < cLeaves; i++)
+    {
+        int rc = cpumR3CpuIdFetchLeafOverride(&paLeaves[i], pCfgNode, uStart + i);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Init a set of host CPUID leaves.
+ *
+ * @returns VBox status code.
+ * @param   paLeaves            The leaf array.
+ * @param   cLeaves             The number of leaves.
+ * @param   uStart              The start leaf number.
+ * @param   pCfgNode            The /CPUM/HostCPUID/ node.
+ */
+static int cpumR3CpuIdInitHostSet(uint32_t uStart, PCPUMCPUID paLeaves, uint32_t cLeaves, PCFGMNODE pCfgNode)
+{
+    /* Using the ECX variant for all of them can't hurt... */
+    for (uint32_t i = 0; i < cLeaves; i++)
+        ASMCpuIdExSlow(uStart + i, 0, 0, 0, &paLeaves[i].uEax, &paLeaves[i].uEbx, &paLeaves[i].uEcx, &paLeaves[i].uEdx);
+
+    /* Load CPUID leaf override; we currently don't care if the user
+       specifies features the host CPU doesn't support. */
+    return cpumR3CpuIdInitLoadOverrideSet(uStart, paLeaves, cLeaves, pCfgNode);
+}
+
+
+/**
+ * Installs the CPUID leaves and explods the data into structures like
+ * GuestFeatures and CPUMCTX::aoffXState.
+ *
+ * @returns VBox status code.
+ * @param   pVM         The cross context VM handle.
+ * @param   pCpum       The CPUM part of @a VM.
+ * @param   paLeaves    The leaves.  These will be copied (but not freed).
+ * @param   cLeaves     The number of leaves.
+ */
+static int cpumR3CpuIdInstallAndExplodeLeaves(PVM pVM, PCPUM pCpum, PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves)
+{
+    cpumR3CpuIdAssertOrder(paLeaves, cLeaves);
+
+    /*
+     * Install the CPUID information.
+     */
+    int rc = MMHyperDupMem(pVM, paLeaves, sizeof(paLeaves[0]) * cLeaves, 32,
+                           MM_TAG_CPUM_CPUID, (void **)&pCpum->GuestInfo.paCpuIdLeavesR3);
+
+    AssertLogRelRCReturn(rc, rc);
+    pCpum->GuestInfo.cCpuIdLeaves = cLeaves;
+    pCpum->GuestInfo.paCpuIdLeavesR0 = MMHyperR3ToR0(pVM, pCpum->GuestInfo.paCpuIdLeavesR3);
+    pCpum->GuestInfo.paCpuIdLeavesRC = MMHyperR3ToRC(pVM, pCpum->GuestInfo.paCpuIdLeavesR3);
+    Assert(MMHyperR0ToR3(pVM, pCpum->GuestInfo.paCpuIdLeavesR0) == (void *)pCpum->GuestInfo.paCpuIdLeavesR3);
+    Assert(MMHyperRCToR3(pVM, pCpum->GuestInfo.paCpuIdLeavesRC) == (void *)pCpum->GuestInfo.paCpuIdLeavesR3);
+
+    /*
+     * Update the default CPUID leaf if necessary.
+     */
+    switch (pCpum->GuestInfo.enmUnknownCpuIdMethod)
+    {
+        case CPUMUNKNOWNCPUID_LAST_STD_LEAF:
+        case CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX:
+        {
+            /* We don't use CPUID(0).eax here because of the NT hack that only
+               changes that value without actually removing any leaves. */
+            uint32_t i = 0;
+            if (   pCpum->GuestInfo.cCpuIdLeaves > 0
+                && pCpum->GuestInfo.paCpuIdLeavesR3[0].uLeaf <= UINT32_C(0xff))
+            {
+                while (   i + 1 < pCpum->GuestInfo.cCpuIdLeaves
+                       && pCpum->GuestInfo.paCpuIdLeavesR3[i + 1].uLeaf <= UINT32_C(0xff))
+                    i++;
+                pCpum->GuestInfo.DefCpuId.uEax = pCpum->GuestInfo.paCpuIdLeavesR3[i].uEax;
+                pCpum->GuestInfo.DefCpuId.uEbx = pCpum->GuestInfo.paCpuIdLeavesR3[i].uEbx;
+                pCpum->GuestInfo.DefCpuId.uEcx = pCpum->GuestInfo.paCpuIdLeavesR3[i].uEcx;
+                pCpum->GuestInfo.DefCpuId.uEdx = pCpum->GuestInfo.paCpuIdLeavesR3[i].uEdx;
+            }
+            break;
+        }
+        default:
+            break;
+    }
+
+    /*
+     * Explode the guest CPU features.
+     */
+    rc = cpumR3CpuIdExplodeFeatures(pCpum->GuestInfo.paCpuIdLeavesR3, pCpum->GuestInfo.cCpuIdLeaves, &pCpum->GuestFeatures);
+    AssertLogRelRCReturn(rc, rc);
+
+    /*
+     * Adjust the scalable bus frequency according to the CPUID information
+     * we're now using.
+     */
+    if (CPUMMICROARCH_IS_INTEL_CORE7(pVM->cpum.s.GuestFeatures.enmMicroarch))
+        pCpum->GuestInfo.uScalableBusFreq = pCpum->GuestFeatures.enmMicroarch >= kCpumMicroarch_Intel_Core7_SandyBridge
+                                          ? UINT64_C(100000000)  /* 100MHz */
+                                          : UINT64_C(133333333); /* 133MHz */
+
+    /*
+     * Populate the legacy arrays.  Currently used for everything, later only
+     * for patch manager.
+     */
+    struct { PCPUMCPUID paCpuIds; uint32_t cCpuIds, uBase; } aOldRanges[] =
+    {
+        { pCpum->aGuestCpuIdPatmStd,        RT_ELEMENTS(pCpum->aGuestCpuIdPatmStd),     0x00000000 },
+        { pCpum->aGuestCpuIdPatmExt,        RT_ELEMENTS(pCpum->aGuestCpuIdPatmExt),     0x80000000 },
+        { pCpum->aGuestCpuIdPatmCentaur,    RT_ELEMENTS(pCpum->aGuestCpuIdPatmCentaur), 0xc0000000 },
+    };
+    for (uint32_t i = 0; i < RT_ELEMENTS(aOldRanges); i++)
+    {
+        uint32_t    cLeft       = aOldRanges[i].cCpuIds;
+        uint32_t    uLeaf       = aOldRanges[i].uBase + cLeft;
+        PCPUMCPUID  pLegacyLeaf = &aOldRanges[i].paCpuIds[cLeft];
+        while (cLeft-- > 0)
+        {
+            uLeaf--;
+            pLegacyLeaf--;
+
+            PCCPUMCPUIDLEAF pLeaf = cpumR3CpuIdGetExactLeaf(pCpum, uLeaf, 0 /* uSubLeaf */);
+            if (pLeaf)
+            {
+                pLegacyLeaf->uEax = pLeaf->uEax;
+                pLegacyLeaf->uEbx = pLeaf->uEbx;
+                pLegacyLeaf->uEcx = pLeaf->uEcx;
+                pLegacyLeaf->uEdx = pLeaf->uEdx;
+            }
+            else
+                *pLegacyLeaf = pCpum->GuestInfo.DefCpuId;
+        }
+    }
+
+    /*
+     * Configure XSAVE offsets according to the CPUID info.
+     */
+    memset(&pVM->aCpus[0].cpum.s.Guest.aoffXState[0], 0xff, sizeof(pVM->aCpus[0].cpum.s.Guest.aoffXState));
+    pVM->aCpus[0].cpum.s.Guest.aoffXState[XSAVE_C_X87_BIT] = 0;
+    pVM->aCpus[0].cpum.s.Guest.aoffXState[XSAVE_C_SSE_BIT] = 0;
+    for (uint32_t iComponent = XSAVE_C_SSE_BIT + 1; iComponent < 63; iComponent++)
+        if (pCpum->fXStateGuestMask & RT_BIT_64(iComponent))
+        {
+            PCPUMCPUIDLEAF pSubLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 0xd, iComponent);
+            AssertLogRelMsgReturn(pSubLeaf, ("iComponent=%#x\n"), VERR_CPUM_IPE_1);
+            AssertLogRelMsgReturn(pSubLeaf->fSubLeafMask >= iComponent, ("iComponent=%#x\n"), VERR_CPUM_IPE_1);
+            AssertLogRelMsgReturn(   pSubLeaf->uEax > 0
+                                  && pSubLeaf->uEbx >= CPUM_MIN_XSAVE_AREA_SIZE
+                                  && pSubLeaf->uEax <= pCpum->GuestFeatures.cbMaxExtendedState
+                                  && pSubLeaf->uEbx <= pCpum->GuestFeatures.cbMaxExtendedState
+                                  && pSubLeaf->uEbx + pSubLeaf->uEax <= pCpum->GuestFeatures.cbMaxExtendedState,
+                                  ("iComponent=%#x eax=%#x ebx=%#x cbMax=%#x\n", iComponent, pSubLeaf->uEax, pSubLeaf->uEbx,
+                                   pCpum->GuestFeatures.cbMaxExtendedState),
+                                  VERR_CPUM_IPE_1);
+            pVM->aCpus[0].cpum.s.Guest.aoffXState[iComponent] = pSubLeaf->uEbx;
+        }
+    memset(&pVM->aCpus[0].cpum.s.Hyper.aoffXState[0], 0xff, sizeof(pVM->aCpus[0].cpum.s.Hyper.aoffXState));
+
+    /* Copy the CPU #0  data to the other CPUs. */
+    for (VMCPUID iCpu = 1; iCpu < pVM->cCpus; iCpu++)
+    {
+        memcpy(&pVM->aCpus[iCpu].cpum.s.Guest.aoffXState[0], &pVM->aCpus[0].cpum.s.Guest.aoffXState[0],
+               sizeof(pVM->aCpus[iCpu].cpum.s.Guest.aoffXState));
+        memcpy(&pVM->aCpus[iCpu].cpum.s.Hyper.aoffXState[0], &pVM->aCpus[0].cpum.s.Hyper.aoffXState[0],
+               sizeof(pVM->aCpus[iCpu].cpum.s.Hyper.aoffXState));
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/** @name Instruction Set Extension Options
+ * @{  */
+/** Configuration option type (extended boolean, really). */
+typedef uint8_t CPUMISAEXTCFG;
+/** Always disable the extension. */
+#define CPUMISAEXTCFG_DISABLED              false
+/** Enable the extension if it's supported by the host CPU. */
+#define CPUMISAEXTCFG_ENABLED_SUPPORTED     true
+/** Enable the extension if it's supported by the host CPU, but don't let
+ * the portable CPUID feature disable it. */
+#define CPUMISAEXTCFG_ENABLED_PORTABLE      UINT8_C(127)
+/** Always enable the extension. */
+#define CPUMISAEXTCFG_ENABLED_ALWAYS        UINT8_C(255)
+/** @} */
+
+/**
+ * CPUID Configuration (from CFGM).
+ *
+ * @remarks  The members aren't document since we would only be duplicating the
+ *           \@cfgm entries in cpumR3CpuIdReadConfig.
+ */
+typedef struct CPUMCPUIDCONFIG
+{
+    bool            fNt4LeafLimit;
+    bool            fInvariantTsc;
+
+    CPUMISAEXTCFG   enmCmpXchg16b;
+    CPUMISAEXTCFG   enmMonitor;
+    CPUMISAEXTCFG   enmMWaitExtensions;
+    CPUMISAEXTCFG   enmSse41;
+    CPUMISAEXTCFG   enmSse42;
+    CPUMISAEXTCFG   enmAvx;
+    CPUMISAEXTCFG   enmAvx2;
+    CPUMISAEXTCFG   enmXSave;
+    CPUMISAEXTCFG   enmAesNi;
+    CPUMISAEXTCFG   enmPClMul;
+    CPUMISAEXTCFG   enmPopCnt;
+    CPUMISAEXTCFG   enmMovBe;
+    CPUMISAEXTCFG   enmRdRand;
+    CPUMISAEXTCFG   enmRdSeed;
+    CPUMISAEXTCFG   enmCLFlushOpt;
+
+    CPUMISAEXTCFG   enmAbm;
+    CPUMISAEXTCFG   enmSse4A;
+    CPUMISAEXTCFG   enmMisAlnSse;
+    CPUMISAEXTCFG   enm3dNowPrf;
+    CPUMISAEXTCFG   enmAmdExtMmx;
+
+    uint32_t        uMaxStdLeaf;
+    uint32_t        uMaxExtLeaf;
+    uint32_t        uMaxCentaurLeaf;
+    uint32_t        uMaxIntelFamilyModelStep;
+    char        szCpuName[128];
+} CPUMCPUIDCONFIG;
+/** Pointer to CPUID config (from CFGM). */
+typedef CPUMCPUIDCONFIG *PCPUMCPUIDCONFIG;
+
+
+/**
+ * Insert hypervisor identification leaves.
+ *
+ * We only return minimal information, primarily ensuring that the
+ * 0x40000000 function returns 0x40000001 and identifying ourselves.
+ * Hypervisor-specific interface is supported through GIM which will
+ * modify these leaves if required depending on the GIM provider.
+ *
+ * @returns VBox status code.
+ * @param   pCpum       The CPUM instance data.
+ * @param   pConfig     The CPUID configuration we've read from CFGM.
+ */
+static int cpumR3CpuIdPlantHypervisorLeaves(PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
+{
+    CPUMCPUIDLEAF NewLeaf;
+    NewLeaf.uLeaf        = UINT32_C(0x40000000);
+    NewLeaf.uSubLeaf     = 0;
+    NewLeaf.fSubLeafMask = 0;
+    NewLeaf.uEax         = UINT32_C(0x40000001);
+    NewLeaf.uEbx         = 0x786f4256 /* 'VBox' */;
+    NewLeaf.uEcx         = 0x786f4256 /* 'VBox' */;
+    NewLeaf.uEdx         = 0x786f4256 /* 'VBox' */;
+    NewLeaf.fFlags       = 0;
+    int rc = cpumR3CpuIdInsert(NULL /* pVM */, &pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves, &NewLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    NewLeaf.uLeaf        = UINT32_C(0x40000001);
+    NewLeaf.uEax         = 0x656e6f6e;                            /* 'none' */
+    NewLeaf.uEbx         = 0;
+    NewLeaf.uEcx         = 0;
+    NewLeaf.uEdx         = 0;
+    NewLeaf.fFlags       = 0;
+    rc = cpumR3CpuIdInsert(NULL /* pVM */, &pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves, &NewLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Mini CPU selection support for making Mac OS X happy.
+ *
+ * Executes the  /CPUM/MaxIntelFamilyModelStep config.
+ *
+ * @param   pCpum       The CPUM instance data.
+ * @param   pConfig     The CPUID configuration we've read from CFGM.
+ */
+static void cpumR3CpuIdLimitIntelFamModStep(PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
+{
+    if (pCpum->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_INTEL)
+    {
+        PCPUMCPUIDLEAF pStdFeatureLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 1, 0);
+        uint32_t uCurIntelFamilyModelStep = RT_MAKE_U32_FROM_U8(ASMGetCpuStepping(pStdFeatureLeaf->uEax),
+                                                                ASMGetCpuModelIntel(pStdFeatureLeaf->uEax),
+                                                                ASMGetCpuFamily(pStdFeatureLeaf->uEax),
+                                                                0);
+        uint32_t uMaxIntelFamilyModelStep = pConfig->uMaxIntelFamilyModelStep;
+        if (pConfig->uMaxIntelFamilyModelStep < uCurIntelFamilyModelStep)
+        {
+            uint32_t uNew = pStdFeatureLeaf->uEax & UINT32_C(0xf0003000);
+            uNew |= RT_BYTE1(uMaxIntelFamilyModelStep) & 0xf; /* stepping */
+            uNew |= (RT_BYTE2(uMaxIntelFamilyModelStep) & 0xf) << 4; /* 4 low model bits */
+            uNew |= (RT_BYTE2(uMaxIntelFamilyModelStep) >> 4) << 16; /* 4 high model bits */
+            uNew |= (RT_BYTE3(uMaxIntelFamilyModelStep) & 0xf) << 8; /* 4 low family bits */
+            if (RT_BYTE3(uMaxIntelFamilyModelStep) > 0xf) /* 8 high family bits, using intel's suggested calculation. */
+                uNew |= ( (RT_BYTE3(uMaxIntelFamilyModelStep) - (RT_BYTE3(uMaxIntelFamilyModelStep) & 0xf)) & 0xff ) << 20;
+            LogRel(("CPU: CPUID(0).EAX %#x -> %#x (uMaxIntelFamilyModelStep=%#x, uCurIntelFamilyModelStep=%#x\n",
+                    pStdFeatureLeaf->uEax, uNew, uMaxIntelFamilyModelStep, uCurIntelFamilyModelStep));
+            pStdFeatureLeaf->uEax = uNew;
+        }
+    }
+}
+
+
+
+/**
+ * Limit it the number of entries, zapping the remainder.
+ *
+ * The limits are masking off stuff about power saving and similar, this
+ * is perhaps a bit crudely done as there is probably some relatively harmless
+ * info too in these leaves (like words about having a constant TSC).
+ *
+ * @param   pCpum       The CPUM instance data.
+ * @param   pConfig     The CPUID configuration we've read from CFGM.
+ */
+static void cpumR3CpuIdLimitLeaves(PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
+{
+    /*
+     * Standard leaves.
+     */
+    uint32_t       uSubLeaf = 0;
+    PCPUMCPUIDLEAF pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 0, uSubLeaf);
+    if (pCurLeaf)
+    {
+        uint32_t uLimit = pCurLeaf->uEax;
+        if (uLimit <= UINT32_C(0x000fffff))
+        {
+            if (uLimit > pConfig->uMaxStdLeaf)
+            {
+                pCurLeaf->uEax = uLimit = pConfig->uMaxStdLeaf;
+                cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                                       uLimit + 1, UINT32_C(0x000fffff));
+            }
+
+            /* NT4 hack, no zapping of extra leaves here. */
+            if (pConfig->fNt4LeafLimit && uLimit > 3)
+                pCurLeaf->uEax = uLimit = 3;
+
+            while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x00000000), ++uSubLeaf)) != NULL)
+                pCurLeaf->uEax = uLimit;
+        }
+        else
+        {
+            LogRel(("CPUID: Invalid standard range: %#x\n", uLimit));
+            cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                                   UINT32_C(0x00000000), UINT32_C(0x0fffffff));
+        }
+    }
+
+    /*
+     * Extended leaves.
+     */
+    uSubLeaf = 0;
+    pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x80000000), uSubLeaf);
+    if (pCurLeaf)
+    {
+        uint32_t uLimit = pCurLeaf->uEax;
+        if (   uLimit >= UINT32_C(0x80000000)
+            && uLimit <= UINT32_C(0x800fffff))
+        {
+            if (uLimit > pConfig->uMaxExtLeaf)
+            {
+                pCurLeaf->uEax = uLimit = pConfig->uMaxExtLeaf;
+                cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                                       uLimit + 1, UINT32_C(0x800fffff));
+                while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x80000000), ++uSubLeaf)) != NULL)
+                    pCurLeaf->uEax = uLimit;
+            }
+        }
+        else
+        {
+            LogRel(("CPUID: Invalid extended range: %#x\n", uLimit));
+            cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                                   UINT32_C(0x80000000), UINT32_C(0x8ffffffd));
+        }
+    }
+
+    /*
+     * Centaur leaves (VIA).
+     */
+    uSubLeaf = 0;
+    pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0xc0000000), uSubLeaf);
+    if (pCurLeaf)
+    {
+        uint32_t uLimit = pCurLeaf->uEax;
+        if (   uLimit >= UINT32_C(0xc0000000)
+            && uLimit <= UINT32_C(0xc00fffff))
+        {
+            if (uLimit > pConfig->uMaxCentaurLeaf)
+            {
+                pCurLeaf->uEax = uLimit = pConfig->uMaxCentaurLeaf;
+                cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                                       uLimit + 1, UINT32_C(0xcfffffff));
+                while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0xc0000000), ++uSubLeaf)) != NULL)
+                    pCurLeaf->uEax = uLimit;
+            }
+        }
+        else
+        {
+            LogRel(("CPUID: Invalid centaur range: %#x\n", uLimit));
+            cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                                   UINT32_C(0xc0000000), UINT32_C(0xcfffffff));
+        }
+    }
+}
+
+
+/**
+ * Clears a CPUID leaf and all sub-leaves (to zero).
+ *
+ * @param   pCpum       The CPUM instance data.
+ * @param   uLeaf       The leaf to clear.
+ */
+static void cpumR3CpuIdZeroLeaf(PCPUM pCpum, uint32_t uLeaf)
+{
+    uint32_t       uSubLeaf = 0;
+    PCPUMCPUIDLEAF pCurLeaf;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, uLeaf, uSubLeaf)) != NULL)
+    {
+        pCurLeaf->uEax = 0;
+        pCurLeaf->uEbx = 0;
+        pCurLeaf->uEcx = 0;
+        pCurLeaf->uEdx = 0;
+        uSubLeaf++;
+    }
+}
+
+
+/**
+ * Sanitizes and adjust the CPUID leaves.
+ *
+ * Drop features that aren't virtualized (or virtualizable).  Adjust information
+ * and capabilities to fit the virtualized hardware.  Remove information the
+ * guest shouldn't have (because it's wrong in the virtual world or because it
+ * gives away host details) or that we don't have documentation for and no idea
+ * what means.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the cross context VM structure (for cCpus).
+ * @param   pCpum       The CPUM instance data.
+ * @param   pConfig     The CPUID configuration we've read from CFGM.
+ */
+static int cpumR3CpuIdSanitize(PVM pVM, PCPUM pCpum, PCPUMCPUIDCONFIG pConfig)
+{
+#define PORTABLE_CLEAR_BITS_WHEN(Lvl, a_pLeafReg, FeatNm, fMask, uValue) \
+    if ( pCpum->u8PortableCpuIdLevel >= (Lvl) && ((a_pLeafReg) & (fMask)) == (uValue) ) \
+    { \
+        LogRel(("PortableCpuId: " #a_pLeafReg "[" #FeatNm "]: %#x -> 0\n", (a_pLeafReg) & (fMask))); \
+        (a_pLeafReg) &= ~(uint32_t)(fMask); \
+    }
+#define PORTABLE_DISABLE_FEATURE_BIT(Lvl, a_pLeafReg, FeatNm, fBitMask) \
+    if ( pCpum->u8PortableCpuIdLevel >= (Lvl) && ((a_pLeafReg) & (fBitMask)) ) \
+    { \
+        LogRel(("PortableCpuId: " #a_pLeafReg "[" #FeatNm "]: 1 -> 0\n")); \
+        (a_pLeafReg) &= ~(uint32_t)(fBitMask); \
+    }
+#define PORTABLE_DISABLE_FEATURE_BIT_CFG(Lvl, a_pLeafReg, FeatNm, fBitMask, enmConfig) \
+    if (   pCpum->u8PortableCpuIdLevel >= (Lvl) \
+        && ((a_pLeafReg) & (fBitMask)) \
+        && (enmConfig) != CPUMISAEXTCFG_ENABLED_PORTABLE ) \
+    { \
+        LogRel(("PortableCpuId: " #a_pLeafReg "[" #FeatNm "]: 1 -> 0\n")); \
+        (a_pLeafReg) &= ~(uint32_t)(fBitMask); \
+    }
+    Assert(pCpum->GuestFeatures.enmCpuVendor != CPUMCPUVENDOR_INVALID);
+
+    /* Cpuid 1:
+     * EAX: CPU model, family and stepping.
+     *
+     * ECX + EDX: Supported features.  Only report features we can support.
+     * Note! When enabling new features the Synthetic CPU and Portable CPUID
+     *       options may require adjusting (i.e. stripping what was enabled).
+     *
+     * EBX: Branding, CLFLUSH line size, logical processors per package and
+     *      initial APIC ID.
+     */
+    PCPUMCPUIDLEAF pStdFeatureLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 1, 0); /* Note! Must refetch when used later. */
+    AssertLogRelReturn(pStdFeatureLeaf, VERR_CPUM_IPE_2);
+    AssertLogRelReturn(pStdFeatureLeaf->fSubLeafMask == 0, VERR_CPUM_IPE_2);
+
+    pStdFeatureLeaf->uEdx &= X86_CPUID_FEATURE_EDX_FPU
+                           | X86_CPUID_FEATURE_EDX_VME
+                           | X86_CPUID_FEATURE_EDX_DE
+                           | X86_CPUID_FEATURE_EDX_PSE
+                           | X86_CPUID_FEATURE_EDX_TSC
+                           | X86_CPUID_FEATURE_EDX_MSR
+                           //| X86_CPUID_FEATURE_EDX_PAE   - set later if configured.
+                           | X86_CPUID_FEATURE_EDX_MCE
+                           | X86_CPUID_FEATURE_EDX_CX8
+                           //| X86_CPUID_FEATURE_EDX_APIC  - set by the APIC device if present.
+                           //| RT_BIT_32(10)               - not defined
+                           /* Note! we don't report sysenter/sysexit support due to our inability to keep the IOPL part of eflags in sync while in ring 1 (see @bugref{1757}) */
+                           //| X86_CPUID_FEATURE_EDX_SEP
+                           | X86_CPUID_FEATURE_EDX_MTRR
+                           | X86_CPUID_FEATURE_EDX_PGE
+                           | X86_CPUID_FEATURE_EDX_MCA
+                           | X86_CPUID_FEATURE_EDX_CMOV
+                           | X86_CPUID_FEATURE_EDX_PAT     /* 16 */
+                           | X86_CPUID_FEATURE_EDX_PSE36
+                           //| X86_CPUID_FEATURE_EDX_PSN   - no serial number.
+                           | X86_CPUID_FEATURE_EDX_CLFSH
+                           //| RT_BIT_32(20)               - not defined
+                           //| X86_CPUID_FEATURE_EDX_DS    - no debug store.
+                           //| X86_CPUID_FEATURE_EDX_ACPI  - not supported (not DevAcpi, right?).
+                           | X86_CPUID_FEATURE_EDX_MMX
+                           | X86_CPUID_FEATURE_EDX_FXSR
+                           | X86_CPUID_FEATURE_EDX_SSE
+                           | X86_CPUID_FEATURE_EDX_SSE2
+                           //| X86_CPUID_FEATURE_EDX_SS    - no self snoop.
+                           //| X86_CPUID_FEATURE_EDX_HTT   - no hyperthreading/cores - see below.
+                           //| X86_CPUID_FEATURE_EDX_TM    - no thermal monitor.
+                           //| RT_BIT_32(30)               - not defined
+                           //| X86_CPUID_FEATURE_EDX_PBE   - no pending break enabled.
+                           ;
+    pStdFeatureLeaf->uEcx &= 0
+                           | X86_CPUID_FEATURE_ECX_SSE3
+                           | (pConfig->enmPClMul ? X86_CPUID_FEATURE_ECX_PCLMUL : 0)
+                           //| X86_CPUID_FEATURE_ECX_DTES64 - not implemented yet.
+                           /* Can't properly emulate monitor & mwait with guest SMP; force the guest to use hlt for idling VCPUs. */
+                           | ((pConfig->enmMonitor && pVM->cCpus == 1) ? X86_CPUID_FEATURE_ECX_MONITOR : 0)
+                           //| X86_CPUID_FEATURE_ECX_CPLDS - no CPL qualified debug store.
+                           //| X86_CPUID_FEATURE_ECX_VMX   - not virtualized yet.
+                           //| X86_CPUID_FEATURE_ECX_SMX   - not virtualized yet.
+                           //| X86_CPUID_FEATURE_ECX_EST   - no extended speed step.
+                           //| X86_CPUID_FEATURE_ECX_TM2   - no thermal monitor 2.
+                           | X86_CPUID_FEATURE_ECX_SSSE3
+                           //| X86_CPUID_FEATURE_ECX_CNTXID - no L1 context id (MSR++).
+                           //| X86_CPUID_FEATURE_ECX_FMA   - not implemented yet.
+                           | (pConfig->enmCmpXchg16b ? X86_CPUID_FEATURE_ECX_CX16 : 0)
+                           /* ECX Bit 14 - xTPR Update Control. Processor supports changing IA32_MISC_ENABLES[bit 23]. */
+                           //| X86_CPUID_FEATURE_ECX_TPRUPDATE
+                           //| X86_CPUID_FEATURE_ECX_PDCM  - not implemented yet.
+                           //| X86_CPUID_FEATURE_ECX_PCID  - not implemented yet.
+                           //| X86_CPUID_FEATURE_ECX_DCA   - not implemented yet.
+                           | (pConfig->enmSse41 ? X86_CPUID_FEATURE_ECX_SSE4_1 : 0)
+                           | (pConfig->enmSse42 ? X86_CPUID_FEATURE_ECX_SSE4_2 : 0)
+                           //| X86_CPUID_FEATURE_ECX_X2APIC - turned on later by the device if enabled.
+                           | (pConfig->enmMovBe ? X86_CPUID_FEATURE_ECX_MOVBE : 0)
+                           | (pConfig->enmPopCnt ? X86_CPUID_FEATURE_ECX_POPCNT : 0)
+                           //| X86_CPUID_FEATURE_ECX_TSCDEADL - not implemented yet.
+                           | (pConfig->enmAesNi ? X86_CPUID_FEATURE_ECX_AES : 0)
+                           | (pConfig->enmXSave ? X86_CPUID_FEATURE_ECX_XSAVE : 0 )
+                           //| X86_CPUID_FEATURE_ECX_OSXSAVE - mirrors CR4.OSXSAVE state, set dynamically.
+                           | (pConfig->enmAvx ? X86_CPUID_FEATURE_ECX_AVX : 0)
+                           //| X86_CPUID_FEATURE_ECX_F16C  - not implemented yet.
+                           | (pConfig->enmRdRand ? X86_CPUID_FEATURE_ECX_RDRAND : 0)
+                           //| X86_CPUID_FEATURE_ECX_HVP   - Set explicitly later.
+                           ;
+
+    if (pCpum->u8PortableCpuIdLevel > 0)
+    {
+        PORTABLE_CLEAR_BITS_WHEN(1, pStdFeatureLeaf->uEax, ProcessorType, (UINT32_C(3) << 12), (UINT32_C(2) << 12));
+        PORTABLE_DISABLE_FEATURE_BIT(    1, pStdFeatureLeaf->uEcx, SSSE3,  X86_CPUID_FEATURE_ECX_SSSE3);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, SSE4_1, X86_CPUID_FEATURE_ECX_SSE4_1, pConfig->enmSse41);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, SSE4_2, X86_CPUID_FEATURE_ECX_SSE4_2, pConfig->enmSse42);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, MOVBE,  X86_CPUID_FEATURE_ECX_MOVBE,  pConfig->enmMovBe);
+        PORTABLE_DISABLE_FEATURE_BIT(    1, pStdFeatureLeaf->uEcx, AES,    X86_CPUID_FEATURE_ECX_AES);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, PCLMUL, X86_CPUID_FEATURE_ECX_PCLMUL, pConfig->enmPClMul);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, POPCNT, X86_CPUID_FEATURE_ECX_POPCNT, pConfig->enmPopCnt);
+        PORTABLE_DISABLE_FEATURE_BIT(    1, pStdFeatureLeaf->uEcx, F16C,   X86_CPUID_FEATURE_ECX_F16C);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, XSAVE,  X86_CPUID_FEATURE_ECX_XSAVE,  pConfig->enmXSave);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, AVX,    X86_CPUID_FEATURE_ECX_AVX,    pConfig->enmAvx);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, RDRAND, X86_CPUID_FEATURE_ECX_RDRAND, pConfig->enmRdRand);
+        PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pStdFeatureLeaf->uEcx, CX16,   X86_CPUID_FEATURE_ECX_CX16,   pConfig->enmCmpXchg16b);
+        PORTABLE_DISABLE_FEATURE_BIT(    2, pStdFeatureLeaf->uEcx, SSE3,   X86_CPUID_FEATURE_ECX_SSE3);
+        PORTABLE_DISABLE_FEATURE_BIT(    3, pStdFeatureLeaf->uEdx, SSE2,   X86_CPUID_FEATURE_EDX_SSE2);
+        PORTABLE_DISABLE_FEATURE_BIT(    3, pStdFeatureLeaf->uEdx, SSE,    X86_CPUID_FEATURE_EDX_SSE);
+        PORTABLE_DISABLE_FEATURE_BIT(    3, pStdFeatureLeaf->uEdx, CLFSH,  X86_CPUID_FEATURE_EDX_CLFSH);
+        PORTABLE_DISABLE_FEATURE_BIT(    3, pStdFeatureLeaf->uEdx, CMOV,   X86_CPUID_FEATURE_EDX_CMOV);
+
+        Assert(!(pStdFeatureLeaf->uEdx & (  X86_CPUID_FEATURE_EDX_SEP
+                                          | X86_CPUID_FEATURE_EDX_PSN
+                                          | X86_CPUID_FEATURE_EDX_DS
+                                          | X86_CPUID_FEATURE_EDX_ACPI
+                                          | X86_CPUID_FEATURE_EDX_SS
+                                          | X86_CPUID_FEATURE_EDX_TM
+                                          | X86_CPUID_FEATURE_EDX_PBE
+                                          )));
+        Assert(!(pStdFeatureLeaf->uEcx & (  X86_CPUID_FEATURE_ECX_DTES64
+                                          | X86_CPUID_FEATURE_ECX_CPLDS
+                                          | X86_CPUID_FEATURE_ECX_VMX
+                                          | X86_CPUID_FEATURE_ECX_SMX
+                                          | X86_CPUID_FEATURE_ECX_EST
+                                          | X86_CPUID_FEATURE_ECX_TM2
+                                          | X86_CPUID_FEATURE_ECX_CNTXID
+                                          | X86_CPUID_FEATURE_ECX_FMA
+                                          | X86_CPUID_FEATURE_ECX_TPRUPDATE
+                                          | X86_CPUID_FEATURE_ECX_PDCM
+                                          | X86_CPUID_FEATURE_ECX_DCA
+                                          | X86_CPUID_FEATURE_ECX_OSXSAVE
+                                          )));
+    }
+
+    /* Set up APIC ID for CPU 0, configure multi core/threaded smp. */
+    pStdFeatureLeaf->uEbx &= UINT32_C(0x0000ffff); /* (APIC-ID := 0 and #LogCpus := 0) */
+#ifdef VBOX_WITH_MULTI_CORE
+    if (pVM->cCpus > 1)
+    {
+        /* If CPUID Fn0000_0001_EDX[HTT] = 1 then LogicalProcessorCount is the number of threads per CPU
+           core times the number of CPU cores per processor */
+        pStdFeatureLeaf->uEbx |= pVM->cCpus <= 0xff ? (pVM->cCpus << 16) : UINT32_C(0x00ff0000);
+        pStdFeatureLeaf->uEdx |= X86_CPUID_FEATURE_EDX_HTT;  /* necessary for hyper-threading *or* multi-core CPUs */
+    }
+#endif
+
+    /* Force standard feature bits. */
+    if (pConfig->enmPClMul == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_PCLMUL;
+    if (pConfig->enmMonitor == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_MONITOR;
+    if (pConfig->enmCmpXchg16b == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_CX16;
+    if (pConfig->enmSse41 == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_SSE4_1;
+    if (pConfig->enmSse42 == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_SSE4_2;
+    if (pConfig->enmMovBe == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_MOVBE;
+    if (pConfig->enmPopCnt == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_POPCNT;
+    if (pConfig->enmAesNi == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_AES;
+    if (pConfig->enmXSave == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_XSAVE;
+    if (pConfig->enmAvx == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_AVX;
+    if (pConfig->enmRdRand == CPUMISAEXTCFG_ENABLED_ALWAYS)
+        pStdFeatureLeaf->uEcx |= X86_CPUID_FEATURE_ECX_RDRAND;
+
+    pStdFeatureLeaf = NULL; /* Must refetch! */
+
+    /* Cpuid 0x80000001: (Similar, but in no way identical to 0x00000001.)
+     * AMD:
+     *  EAX: CPU model, family and stepping.
+     *
+     *  ECX + EDX: Supported features.  Only report features we can support.
+     *  Note! When enabling new features the Synthetic CPU and Portable CPUID
+     *        options may require adjusting (i.e. stripping what was enabled).
+     *  ASSUMES that this is ALWAYS the AMD defined feature set if present.
+     *
+     *  EBX: Branding ID and package type (or reserved).
+     *
+     * Intel and probably most others:
+     *  EAX: 0
+     *  EBX: 0
+     *  ECX + EDX: Subset of AMD features, mainly for AMD64 support.
+     */
+    PCPUMCPUIDLEAF pExtFeatureLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x80000001), 0);
+    if (pExtFeatureLeaf)
+    {
+        AssertLogRelReturn(pExtFeatureLeaf->fSubLeafMask == 0, VERR_CPUM_IPE_2);
+
+        pExtFeatureLeaf->uEdx &= X86_CPUID_AMD_FEATURE_EDX_FPU
+                               | X86_CPUID_AMD_FEATURE_EDX_VME
+                               | X86_CPUID_AMD_FEATURE_EDX_DE
+                               | X86_CPUID_AMD_FEATURE_EDX_PSE
+                               | X86_CPUID_AMD_FEATURE_EDX_TSC
+                               | X86_CPUID_AMD_FEATURE_EDX_MSR //?? this means AMD MSRs..
+                               //| X86_CPUID_AMD_FEATURE_EDX_PAE    - turned on when necessary
+                               //| X86_CPUID_AMD_FEATURE_EDX_MCE    - not virtualized yet.
+                               | X86_CPUID_AMD_FEATURE_EDX_CX8
+                               //| X86_CPUID_AMD_FEATURE_EDX_APIC   - set by the APIC device if present.
+                               //| RT_BIT_32(10)                    - reserved
+                               /* Note! We don't report sysenter/sysexit support due to our inability to keep the IOPL part of
+                                        eflags in sync while in ring 1 (see @bugref{1757}). HM enables them later. */
+                               //| X86_CPUID_EXT_FEATURE_EDX_SYSCALL
+                               | X86_CPUID_AMD_FEATURE_EDX_MTRR
+                               | X86_CPUID_AMD_FEATURE_EDX_PGE
+                               | X86_CPUID_AMD_FEATURE_EDX_MCA
+                               | X86_CPUID_AMD_FEATURE_EDX_CMOV
+                               | X86_CPUID_AMD_FEATURE_EDX_PAT
+                               | X86_CPUID_AMD_FEATURE_EDX_PSE36
+                               //| RT_BIT_32(18)                    - reserved
+                               //| RT_BIT_32(19)                    - reserved
+                               //| X86_CPUID_EXT_FEATURE_EDX_NX     - enabled later by PGM
+                               //| RT_BIT_32(21)                    - reserved
+                               | (pConfig->enmAmdExtMmx ? X86_CPUID_AMD_FEATURE_EDX_AXMMX : 0)
+                               | X86_CPUID_AMD_FEATURE_EDX_MMX
+                               | X86_CPUID_AMD_FEATURE_EDX_FXSR
+                               | X86_CPUID_AMD_FEATURE_EDX_FFXSR
+                               //| X86_CPUID_EXT_FEATURE_EDX_PAGE1GB
+                               | X86_CPUID_EXT_FEATURE_EDX_RDTSCP
+                               //| RT_BIT_32(28)                    - reserved
+                               //| X86_CPUID_EXT_FEATURE_EDX_LONG_MODE - turned on when necessary
+                               | X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX
+                               | X86_CPUID_AMD_FEATURE_EDX_3DNOW
+                               ;
+        pExtFeatureLeaf->uEcx &= X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF
+                               //| X86_CPUID_AMD_FEATURE_ECX_CMPL   - set below if applicable.
+                               //| X86_CPUID_AMD_FEATURE_ECX_SVM    - not virtualized.
+                               //| X86_CPUID_AMD_FEATURE_ECX_EXT_APIC
+                               /* Note: This could prevent teleporting from AMD to Intel CPUs! */
+                               | X86_CPUID_AMD_FEATURE_ECX_CR8L         /* expose lock mov cr0 = mov cr8 hack for guests that can use this feature to access the TPR. */
+                               | (pConfig->enmAbm       ? X86_CPUID_AMD_FEATURE_ECX_ABM : 0)
+                               | (pConfig->enmSse4A     ? X86_CPUID_AMD_FEATURE_ECX_SSE4A : 0)
+                               | (pConfig->enmMisAlnSse ? X86_CPUID_AMD_FEATURE_ECX_MISALNSSE : 0)
+                               | (pConfig->enm3dNowPrf  ? X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF : 0)
+                               //| X86_CPUID_AMD_FEATURE_ECX_OSVW
+                               //| X86_CPUID_AMD_FEATURE_ECX_IBS
+                               //| X86_CPUID_AMD_FEATURE_ECX_XOP
+                               //| X86_CPUID_AMD_FEATURE_ECX_SKINIT
+                               //| X86_CPUID_AMD_FEATURE_ECX_WDT
+                               //| RT_BIT_32(14)                    - reserved
+                               //| X86_CPUID_AMD_FEATURE_ECX_LWP    - not supported
+                               //| X86_CPUID_AMD_FEATURE_ECX_FMA4   - not yet virtualized.
+                               //| RT_BIT_32(17)                    - reserved
+                               //| RT_BIT_32(18)                    - reserved
+                               //| X86_CPUID_AMD_FEATURE_ECX_NODEID - not yet virtualized.
+                               //| RT_BIT_32(20)                    - reserved
+                               //| X86_CPUID_AMD_FEATURE_ECX_TBM    - not yet virtualized.
+                               //| X86_CPUID_AMD_FEATURE_ECX_TOPOEXT - not yet virtualized.
+                               //| RT_BIT_32(23)                    - reserved
+                               //| RT_BIT_32(24)                    - reserved
+                               //| RT_BIT_32(25)                    - reserved
+                               //| RT_BIT_32(26)                    - reserved
+                               //| RT_BIT_32(27)                    - reserved
+                               //| RT_BIT_32(28)                    - reserved
+                               //| RT_BIT_32(29)                    - reserved
+                               //| RT_BIT_32(30)                    - reserved
+                               //| RT_BIT_32(31)                    - reserved
+                               ;
+#ifdef VBOX_WITH_MULTI_CORE
+        if (   pVM->cCpus > 1
+            && pCpum->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
+            pExtFeatureLeaf->uEcx |= X86_CPUID_AMD_FEATURE_ECX_CMPL; /* CmpLegacy */
+#endif
+
+        if (pCpum->u8PortableCpuIdLevel > 0)
+        {
+            PORTABLE_DISABLE_FEATURE_BIT(    1, pExtFeatureLeaf->uEcx, CR8L,       X86_CPUID_AMD_FEATURE_ECX_CR8L);
+            PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pExtFeatureLeaf->uEcx, ABM,        X86_CPUID_AMD_FEATURE_ECX_ABM,       pConfig->enmAbm);
+            PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pExtFeatureLeaf->uEcx, SSE4A,      X86_CPUID_AMD_FEATURE_ECX_SSE4A,     pConfig->enmSse4A);
+            PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pExtFeatureLeaf->uEcx, MISALNSSE,  X86_CPUID_AMD_FEATURE_ECX_MISALNSSE, pConfig->enmMisAlnSse);
+            PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pExtFeatureLeaf->uEcx, 3DNOWPRF,   X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF,  pConfig->enm3dNowPrf);
+            PORTABLE_DISABLE_FEATURE_BIT(    1, pExtFeatureLeaf->uEcx, XOP,        X86_CPUID_AMD_FEATURE_ECX_XOP);
+            PORTABLE_DISABLE_FEATURE_BIT(    1, pExtFeatureLeaf->uEcx, TBM,        X86_CPUID_AMD_FEATURE_ECX_TBM);
+            PORTABLE_DISABLE_FEATURE_BIT(    1, pExtFeatureLeaf->uEcx, FMA4,       X86_CPUID_AMD_FEATURE_ECX_FMA4);
+            PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pExtFeatureLeaf->uEdx, AXMMX,      X86_CPUID_AMD_FEATURE_EDX_AXMMX,     pConfig->enmAmdExtMmx);
+            PORTABLE_DISABLE_FEATURE_BIT(    1, pExtFeatureLeaf->uEdx, 3DNOW,      X86_CPUID_AMD_FEATURE_EDX_3DNOW);
+            PORTABLE_DISABLE_FEATURE_BIT(    1, pExtFeatureLeaf->uEdx, 3DNOW_EX,   X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX);
+            PORTABLE_DISABLE_FEATURE_BIT(    1, pExtFeatureLeaf->uEdx, FFXSR,      X86_CPUID_AMD_FEATURE_EDX_FFXSR);
+            PORTABLE_DISABLE_FEATURE_BIT(    1, pExtFeatureLeaf->uEdx, RDTSCP,     X86_CPUID_EXT_FEATURE_EDX_RDTSCP);
+            PORTABLE_DISABLE_FEATURE_BIT(    2, pExtFeatureLeaf->uEcx, LAHF_SAHF,  X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF);
+            PORTABLE_DISABLE_FEATURE_BIT(    3, pExtFeatureLeaf->uEcx, CMOV,       X86_CPUID_AMD_FEATURE_EDX_CMOV);
+
+            Assert(!(pExtFeatureLeaf->uEcx & (  X86_CPUID_AMD_FEATURE_ECX_SVM
+                                              | X86_CPUID_AMD_FEATURE_ECX_EXT_APIC
+                                              | X86_CPUID_AMD_FEATURE_ECX_OSVW
+                                              | X86_CPUID_AMD_FEATURE_ECX_IBS
+                                              | X86_CPUID_AMD_FEATURE_ECX_SKINIT
+                                              | X86_CPUID_AMD_FEATURE_ECX_WDT
+                                              | X86_CPUID_AMD_FEATURE_ECX_LWP
+                                              | X86_CPUID_AMD_FEATURE_ECX_NODEID
+                                              | X86_CPUID_AMD_FEATURE_ECX_TOPOEXT
+                                              | UINT32_C(0xff964000)
+                                              )));
+            Assert(!(pExtFeatureLeaf->uEdx & (  RT_BIT(10)
+                                              | X86_CPUID_EXT_FEATURE_EDX_SYSCALL
+                                              | RT_BIT(18)
+                                              | RT_BIT(19)
+                                              | RT_BIT(21)
+                                              | X86_CPUID_AMD_FEATURE_EDX_AXMMX
+                                              | X86_CPUID_EXT_FEATURE_EDX_PAGE1GB
+                                              | RT_BIT(28)
+                                              )));
+        }
+
+        /* Force extended feature bits. */
+        if (pConfig->enmAbm       == CPUMISAEXTCFG_ENABLED_ALWAYS)
+            pExtFeatureLeaf->uEcx |= X86_CPUID_AMD_FEATURE_ECX_ABM;
+        if (pConfig->enmSse4A     == CPUMISAEXTCFG_ENABLED_ALWAYS)
+            pExtFeatureLeaf->uEcx |= X86_CPUID_AMD_FEATURE_ECX_SSE4A;
+        if (pConfig->enmMisAlnSse == CPUMISAEXTCFG_ENABLED_ALWAYS)
+            pExtFeatureLeaf->uEcx |= X86_CPUID_AMD_FEATURE_ECX_MISALNSSE;
+        if (pConfig->enm3dNowPrf  == CPUMISAEXTCFG_ENABLED_ALWAYS)
+            pExtFeatureLeaf->uEcx |= X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF;
+        if (pConfig->enmAmdExtMmx  == CPUMISAEXTCFG_ENABLED_ALWAYS)
+            pExtFeatureLeaf->uEdx |= X86_CPUID_AMD_FEATURE_EDX_AXMMX;
+    }
+    pExtFeatureLeaf = NULL; /* Must refetch! */
+
+
+    /* Cpuid 2:
+     * Intel: (Nondeterministic) Cache and TLB information
+     * AMD:   Reserved
+     * VIA:   Reserved
+     * Safe to expose.  Restrict the number of calls to 1 since we don't
+     * implement this kind of subleaves (is there hardware that does??).
+     */
+    uint32_t        uSubLeaf = 0;
+    PCPUMCPUIDLEAF  pCurLeaf;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 2, uSubLeaf)) != NULL)
+    {
+        if ((pCurLeaf->uEax & 0xff) > 1)
+        {
+            LogRel(("CpuId: Std[2].al: %d -> 1\n", pCurLeaf->uEax & 0xff));
+            pCurLeaf->uEax &= UINT32_C(0xffffff01);
+        }
+        uSubLeaf++;
+    }
+
+    /* Cpuid 3:
+     * Intel: EAX, EBX - reserved (transmeta uses these)
+     *        ECX, EDX - Processor Serial Number if available, otherwise reserved
+     * AMD:   Reserved
+     * VIA:   Reserved
+     * Safe to expose
+     */
+    pStdFeatureLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 1, 0);
+    if (!(pStdFeatureLeaf->uEdx & X86_CPUID_FEATURE_EDX_PSN))
+    {
+        uSubLeaf = 0;
+        while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 3, uSubLeaf)) != NULL)
+        {
+            pCurLeaf->uEcx = pCurLeaf->uEdx = 0;
+            if (pCpum->u8PortableCpuIdLevel > 0)
+                pCurLeaf->uEax = pCurLeaf->uEbx = 0;
+            uSubLeaf++;
+        }
+    }
+
+    /* Cpuid 4 + ECX:
+     * Intel: Deterministic Cache Parameters Leaf.
+     * AMD:   Reserved
+     * VIA:   Reserved
+     * Safe to expose, except for EAX:
+     *      Bits 25-14: Maximum number of addressable IDs for logical processors sharing this cache (see note)**
+     *      Bits 31-26: Maximum number of processor cores in this physical package**
+     * Note: These SMP values are constant regardless of ECX
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 4, uSubLeaf)) != NULL)
+    {
+        pCurLeaf->uEax &= UINT32_C(0x00003fff); /* Clear the #maxcores, #threads-sharing-cache (both are #-1).*/
+#ifdef VBOX_WITH_MULTI_CORE
+        if (   pVM->cCpus > 1
+            && pCpum->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_INTEL)
+        {
+            AssertReturn(pVM->cCpus <= 64, VERR_TOO_MANY_CPUS);
+            /* One logical processor with possibly multiple cores. */
+            /* See  http://www.intel.com/Assets/PDF/appnote/241618.pdf p. 29 */
+            pCurLeaf->uEax |= pVM->cCpus <= 0x40 ? ((pVM->cCpus - 1) << 26) : UINT32_C(0xfc000000); /* 6 bits only -> 64 cores! */
+        }
+#endif
+        uSubLeaf++;
+    }
+
+    /* Cpuid 5:     Monitor/mwait Leaf
+     * Intel: ECX, EDX - reserved
+     *        EAX, EBX - Smallest and largest monitor line size
+     * AMD:   EDX - reserved
+     *        EAX, EBX - Smallest and largest monitor line size
+     *        ECX - extensions (ignored for now)
+     * VIA:   Reserved
+     * Safe to expose
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 5, uSubLeaf)) != NULL)
+    {
+        pStdFeatureLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 1, 0);
+        if (!(pStdFeatureLeaf->uEcx & X86_CPUID_FEATURE_ECX_MONITOR))
+            pCurLeaf->uEax = pCurLeaf->uEbx = 0;
+
+        pCurLeaf->uEcx = pCurLeaf->uEdx = 0;
+        if (pConfig->enmMWaitExtensions)
+        {
+            pCurLeaf->uEcx = X86_CPUID_MWAIT_ECX_EXT | X86_CPUID_MWAIT_ECX_BREAKIRQIF0;
+            /** @todo: for now we just expose host's MWAIT C-states, although conceptually
+               it shall be part of our power management virtualization model */
+#if 0
+            /* MWAIT sub C-states */
+            pCurLeaf->uEdx =
+                    (0 << 0)  /* 0 in C0 */ |
+                    (2 << 4)  /* 2 in C1 */ |
+                    (2 << 8)  /* 2 in C2 */ |
+                    (2 << 12) /* 2 in C3 */ |
+                    (0 << 16) /* 0 in C4 */
+                    ;
+#endif
+        }
+        else
+            pCurLeaf->uEcx = pCurLeaf->uEdx = 0;
+        uSubLeaf++;
+    }
+
+    /* Cpuid 6: Digital Thermal Sensor and Power Management Paramenters.
+     * Intel: Various stuff.
+     * AMD: EAX, EBX, EDX - reserved.
+     *      ECX - Bit zero is EffFreq, indicating MSR_0000_00e7 and MSR_0000_00e8
+     *            present.  Same as intel.
+     * VIA: ??
+     *
+     * We clear everything here for now.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 6);
+
+    /* Cpuid 7 + ECX: Structured Extended Feature Flags Enumeration
+     * EAX: Number of sub leaves.
+     * EBX+ECX+EDX: Feature flags
+     *
+     * We only have documentation for one sub-leaf, so clear all other (no need
+     * to remove them as such, just set them to zero).
+     *
+     * Note! When enabling new features the Synthetic CPU and Portable CPUID
+     *       options may require adjusting (i.e. stripping what was enabled).
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 7, uSubLeaf)) != NULL)
+    {
+        switch (uSubLeaf)
+        {
+            case 0:
+            {
+                pCurLeaf->uEax  = 0;    /* Max ECX input is 0. */
+                pCurLeaf->uEbx &= 0
+                               //| X86_CPUID_STEXT_FEATURE_EBX_FSGSBASE          RT_BIT(0)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_TSC_ADJUST        RT_BIT(1)
+                               //| RT_BIT(2) - reserved
+                               //| X86_CPUID_STEXT_FEATURE_EBX_BMI1              RT_BIT(3)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_HLE               RT_BIT(4)
+                               | (pConfig->enmAvx2 ? X86_CPUID_STEXT_FEATURE_EBX_AVX2 : 0)
+                               //| RT_BIT(6) - reserved
+                               //| X86_CPUID_STEXT_FEATURE_EBX_SMEP              RT_BIT(7)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_BMI2              RT_BIT(8)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_ERMS              RT_BIT(9)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_INVPCID           RT_BIT(10)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_RTM               RT_BIT(11)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_PQM               RT_BIT(12)
+                               | X86_CPUID_STEXT_FEATURE_EBX_DEPR_FPU_CS_DS
+                               //| X86_CPUID_STEXT_FEATURE_EBX_MPE               RT_BIT(14)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_PQE               RT_BIT(15)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_AVX512F           RT_BIT(16)
+                               //| RT_BIT(17) - reserved
+                               | (pConfig->enmRdSeed ? X86_CPUID_STEXT_FEATURE_EBX_RDSEED : 0)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_ADX               RT_BIT(19)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_SMAP              RT_BIT(20)
+                               //| RT_BIT(21) - reserved
+                               //| RT_BIT(22) - reserved
+                               | (pConfig->enmCLFlushOpt ? X86_CPUID_STEXT_FEATURE_EBX_CLFLUSHOPT : 0)
+                               //| RT_BIT(24) - reserved
+                               //| X86_CPUID_STEXT_FEATURE_EBX_INTEL_PT          RT_BIT(25)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_AVX512PF          RT_BIT(26)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_AVX512ER          RT_BIT(27)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_AVX512CD          RT_BIT(28)
+                               //| X86_CPUID_STEXT_FEATURE_EBX_SHA               RT_BIT(29)
+                               //| RT_BIT(30) - reserved
+                               //| RT_BIT(31) - reserved
+                               ;
+                pCurLeaf->uEcx &= 0
+                               //| X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1 - we do not do vector functions yet.
+                               ;
+                pCurLeaf->uEdx &= 0;
+
+                if (pCpum->u8PortableCpuIdLevel > 0)
+                {
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, FSGSBASE,   X86_CPUID_STEXT_FEATURE_EBX_FSGSBASE);
+                    PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pCurLeaf->uEbx, AVX2,       X86_CPUID_STEXT_FEATURE_EBX_AVX2, pConfig->enmAvx2);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, SMEP,       X86_CPUID_STEXT_FEATURE_EBX_SMEP);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, BMI2,       X86_CPUID_STEXT_FEATURE_EBX_BMI2);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, INVPCID,    X86_CPUID_STEXT_FEATURE_EBX_INVPCID);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, AVX512F,    X86_CPUID_STEXT_FEATURE_EBX_AVX512F);
+                    PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pCurLeaf->uEbx, RDSEED,     X86_CPUID_STEXT_FEATURE_EBX_RDSEED, pConfig->enmRdSeed);
+                    PORTABLE_DISABLE_FEATURE_BIT_CFG(1, pCurLeaf->uEbx, CLFLUSHOPT, X86_CPUID_STEXT_FEATURE_EBX_RDSEED, pConfig->enmCLFlushOpt);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, AVX512PF,   X86_CPUID_STEXT_FEATURE_EBX_AVX512PF);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, AVX512ER,   X86_CPUID_STEXT_FEATURE_EBX_AVX512ER);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, AVX512CD,   X86_CPUID_STEXT_FEATURE_EBX_AVX512CD);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, SMAP,       X86_CPUID_STEXT_FEATURE_EBX_SMAP);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEbx, SHA,        X86_CPUID_STEXT_FEATURE_EBX_SHA);
+                    PORTABLE_DISABLE_FEATURE_BIT(    1, pCurLeaf->uEcx, PREFETCHWT1, X86_CPUID_STEXT_FEATURE_ECX_PREFETCHWT1);
+                }
+
+                /* Force standard feature bits. */
+                if (pConfig->enmAvx2 == CPUMISAEXTCFG_ENABLED_ALWAYS)
+                    pCurLeaf->uEbx |= X86_CPUID_STEXT_FEATURE_EBX_AVX2;
+                if (pConfig->enmRdSeed == CPUMISAEXTCFG_ENABLED_ALWAYS)
+                    pCurLeaf->uEbx |= X86_CPUID_STEXT_FEATURE_EBX_RDSEED;
+                if (pConfig->enmCLFlushOpt == CPUMISAEXTCFG_ENABLED_ALWAYS)
+                    pCurLeaf->uEbx |= X86_CPUID_STEXT_FEATURE_EBX_CLFLUSHOPT;
+                break;
+            }
+
+            default:
+                /* Invalid index, all values are zero. */
+                pCurLeaf->uEax = 0;
+                pCurLeaf->uEbx = 0;
+                pCurLeaf->uEcx = 0;
+                pCurLeaf->uEdx = 0;
+                break;
+        }
+        uSubLeaf++;
+    }
+
+    /* Cpuid 8: Marked as reserved by Intel and AMD.
+     * We zero this since we don't know what it may have been used for.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 8);
+
+    /* Cpuid 9: Direct Cache Access (DCA) Parameters
+     * Intel: EAX - Value of PLATFORM_DCA_CAP bits.
+     *        EBX, ECX, EDX - reserved.
+     * AMD:   Reserved
+     * VIA:   ??
+     *
+     * We zero this.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 9);
+
+    /* Cpuid 0xa: Architectural Performance Monitor Features
+     * Intel: EAX - Value of PLATFORM_DCA_CAP bits.
+     *        EBX, ECX, EDX - reserved.
+     * AMD:   Reserved
+     * VIA:   ??
+     *
+     * We zero this, for now at least.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 10);
+
+    /* Cpuid 0xb+ECX: x2APIC Features / Processor Topology.
+     * Intel: EAX - APCI ID shift right for next level.
+     *        EBX - Factory configured cores/threads at this level.
+     *        ECX - Level number (same as input) and level type (1,2,0).
+     *        EDX - Extended initial APIC ID.
+     * AMD:   Reserved
+     * VIA:   ??
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 11, uSubLeaf)) != NULL)
+    {
+        if (pCurLeaf->fFlags & CPUMCPUIDLEAF_F_CONTAINS_APIC_ID)
+        {
+            uint8_t bLevelType = RT_BYTE2(pCurLeaf->uEcx);
+            if (bLevelType == 1)
+            {
+                /* Thread level - we don't do threads at the moment. */
+                pCurLeaf->uEax = 0; /** @todo is this correct? Real CPUs never do 0 here, I think... */
+                pCurLeaf->uEbx = 1;
+            }
+            else if (bLevelType == 2)
+            {
+                /* Core level. */
+                pCurLeaf->uEax = 1; /** @todo real CPUs are supposed to be in the 4-6 range, not 1.  Our APIC ID assignments are a little special... */
+#ifdef VBOX_WITH_MULTI_CORE
+                while (RT_BIT_32(pCurLeaf->uEax) < pVM->cCpus)
+                    pCurLeaf->uEax++;
+#endif
+                pCurLeaf->uEbx = pVM->cCpus;
+            }
+            else
+            {
+                AssertLogRelMsg(bLevelType == 0, ("bLevelType=%#x uSubLeaf=%#x\n", bLevelType, uSubLeaf));
+                pCurLeaf->uEax = 0;
+                pCurLeaf->uEbx = 0;
+                pCurLeaf->uEcx = 0;
+            }
+            pCurLeaf->uEcx = (pCurLeaf->uEcx & UINT32_C(0xffffff00)) | (uSubLeaf & 0xff);
+            pCurLeaf->uEdx = 0;  /* APIC ID is filled in by CPUMGetGuestCpuId() at runtime.  Init for EMT(0) as usual. */
+        }
+        else
+        {
+            Assert(pCpum->GuestFeatures.enmCpuVendor != CPUMCPUVENDOR_INTEL);
+            pCurLeaf->uEax = 0;
+            pCurLeaf->uEbx = 0;
+            pCurLeaf->uEcx = 0;
+            pCurLeaf->uEdx = 0;
+        }
+        uSubLeaf++;
+    }
+
+    /* Cpuid 0xc: Marked as reserved by Intel and AMD.
+     * We zero this since we don't know what it may have been used for.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 12);
+
+    /* Cpuid 0xd + ECX: Processor Extended State Enumeration
+     * ECX=0:   EAX - Valid bits in XCR0[31:0].
+     *          EBX - Maximum state size as per current XCR0 value.
+     *          ECX - Maximum state size for all supported features.
+     *          EDX - Valid bits in XCR0[63:32].
+     * ECX=1:   EAX - Various X-features.
+     *          EBX - Maximum state size as per current XCR0|IA32_XSS value.
+     *          ECX - Valid bits in IA32_XSS[31:0].
+     *          EDX - Valid bits in IA32_XSS[63:32].
+     * ECX=N, where N in 2..63 and indicates a bit in XCR0 and/or IA32_XSS,
+     *        if the bit invalid all four registers are set to zero.
+     *          EAX - The state size for this feature.
+     *          EBX - The state byte offset of this feature.
+     *          ECX - Bit 0 indicates whether this sub-leaf maps to a valid IA32_XSS bit (=1) or a valid XCR0 bit (=0).
+     *          EDX - Reserved, but is set to zero if invalid sub-leaf index.
+     *
+     * Clear them all as we don't currently implement extended CPU state.
+     */
+    /* Figure out the supported XCR0/XSS mask component. */
+    uint64_t fGuestXcr0Mask = 0;
+    pStdFeatureLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 1, 0);
+    if (pStdFeatureLeaf && (pStdFeatureLeaf->uEcx & X86_CPUID_FEATURE_ECX_XSAVE))
+    {
+        fGuestXcr0Mask = XSAVE_C_X87 | XSAVE_C_SSE;
+        if (pStdFeatureLeaf && (pStdFeatureLeaf->uEcx & X86_CPUID_FEATURE_ECX_AVX))
+            fGuestXcr0Mask |= XSAVE_C_YMM;
+        pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 7, 0);
+        if (pCurLeaf && (pCurLeaf->uEbx & X86_CPUID_STEXT_FEATURE_EBX_AVX512F))
+            fGuestXcr0Mask |= XSAVE_C_ZMM_16HI | XSAVE_C_ZMM_HI256 | XSAVE_C_OPMASK;
+        fGuestXcr0Mask &= pCpum->fXStateHostMask;
+    }
+    pStdFeatureLeaf = NULL;
+    pCpum->fXStateGuestMask = fGuestXcr0Mask;
+
+    /* Work the sub-leaves. */
+    uint32_t cbXSaveMax = sizeof(X86FXSTATE);
+    for (uSubLeaf = 0; uSubLeaf < 63; uSubLeaf++)
+    {
+        pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, 13, uSubLeaf);
+        if (pCurLeaf)
+        {
+            if (fGuestXcr0Mask)
+            {
+                switch (uSubLeaf)
+                {
+                    case 0:
+                        pCurLeaf->uEax &= RT_LO_U32(fGuestXcr0Mask);
+                        pCurLeaf->uEdx &= RT_HI_U32(fGuestXcr0Mask);
+                        AssertLogRelMsgReturn((pCurLeaf->uEax & (XSAVE_C_X87 | XSAVE_C_SSE)) == (XSAVE_C_X87 | XSAVE_C_SSE),
+                                              ("CPUID(0xd/0).EAX missing mandatory X87 or SSE bits: %#RX32", pCurLeaf->uEax),
+                                              VERR_CPUM_IPE_1);
+                        cbXSaveMax = pCurLeaf->uEcx;
+                        AssertLogRelMsgReturn(cbXSaveMax <= CPUM_MAX_XSAVE_AREA_SIZE && cbXSaveMax >= CPUM_MIN_XSAVE_AREA_SIZE,
+                                              ("%#x max=%#x\n", cbXSaveMax, CPUM_MAX_XSAVE_AREA_SIZE), VERR_CPUM_IPE_2);
+                        AssertLogRelMsgReturn(pCurLeaf->uEbx >= CPUM_MIN_XSAVE_AREA_SIZE && pCurLeaf->uEbx <= cbXSaveMax,
+                                              ("ebx=%#x cbXSaveMax=%#x\n", pCurLeaf->uEbx, cbXSaveMax),
+                                              VERR_CPUM_IPE_2);
+                        continue;
+                    case 1:
+                        pCurLeaf->uEax &= 0;
+                        pCurLeaf->uEcx &= 0;
+                        pCurLeaf->uEdx &= 0;
+                        /** @todo what about checking ebx? */
+                        continue;
+                    default:
+                        if (fGuestXcr0Mask & RT_BIT_64(uSubLeaf))
+                        {
+                            AssertLogRelMsgReturn(   pCurLeaf->uEax <= cbXSaveMax
+                                                  && pCurLeaf->uEax >  0
+                                                  && pCurLeaf->uEbx < cbXSaveMax
+                                                  && pCurLeaf->uEbx >= CPUM_MIN_XSAVE_AREA_SIZE
+                                                  && pCurLeaf->uEbx + pCurLeaf->uEax <= cbXSaveMax,
+                                                  ("%#x: eax=%#x ebx=%#x cbMax=%#x\n", pCurLeaf->uEax, pCurLeaf->uEbx, cbXSaveMax),
+                                                  VERR_CPUM_IPE_2);
+                            AssertLogRel(!(pCurLeaf->uEcx & 1));
+                            pCurLeaf->uEcx = 0; /* Bit 0 should be zero (XCR0), the reset are reserved... */
+                            pCurLeaf->uEdx = 0; /* it's reserved... */
+                            continue;
+                        }
+                        break;
+                }
+            }
+
+            /* Clear the leaf. */
+            pCurLeaf->uEax = 0;
+            pCurLeaf->uEbx = 0;
+            pCurLeaf->uEcx = 0;
+            pCurLeaf->uEdx = 0;
+        }
+    }
+
+    /* Cpuid 0xe: Marked as reserved by Intel and AMD.
+     * We zero this since we don't know what it may have been used for.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 14);
+
+    /* Cpuid 0xf + ECX: Platform qualifity of service monitoring (PQM).
+     * We zero this as we don't currently virtualize PQM.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 15);
+
+    /* Cpuid 0x10 + ECX: Platform qualifity of service enforcement (PQE).
+     * We zero this as we don't currently virtualize PQE.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 16);
+
+    /* Cpuid 0x11: Marked as reserved by Intel and AMD.
+     * We zero this since we don't know what it may have been used for.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 17);
+
+    /* Cpuid 0x12 + ECX: SGX resource enumeration.
+     * We zero this as we don't currently virtualize this.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 18);
+
+    /* Cpuid 0x13: Marked as reserved by Intel and AMD.
+     * We zero this since we don't know what it may have been used for.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 19);
+
+    /* Cpuid 0x14 + ECX: Processor Trace (PT) capability enumeration.
+     * We zero this as we don't currently virtualize this.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 20);
+
+    /* Cpuid 0x15: Timestamp Counter / Core Crystal Clock info.
+     * Intel: uTscFrequency = uCoreCrystalClockFrequency * EBX / EAX.
+     *        EAX - denominator (unsigned).
+     *        EBX - numerator (unsigned).
+     *        ECX, EDX - reserved.
+     * AMD:   Reserved / undefined / not implemented.
+     * VIA:   Reserved / undefined / not implemented.
+     * We zero this as we don't currently virtualize this.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 21);
+
+    /* Cpuid 0x16: Processor frequency info
+     * Intel: EAX - Core base frequency in MHz.
+     *        EBX - Core maximum frequency in MHz.
+     *        ECX - Bus (reference) frequency in MHz.
+     *        EDX - Reserved.
+     * AMD:   Reserved / undefined / not implemented.
+     * VIA:   Reserved / undefined / not implemented.
+     * We zero this as we don't currently virtualize this.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, 22);
+
+    /* Cpuid 0x17..0x10000000: Unknown.
+     * We don't know these and what they mean, so remove them. */
+    cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                           UINT32_C(0x00000017), UINT32_C(0x0fffffff));
+
+
+    /* CpuId 0x40000000..0x4fffffff: Reserved for hypervisor/emulator.
+     * We remove all these as we're a hypervisor and must provide our own.
+     */
+    cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                           UINT32_C(0x40000000), UINT32_C(0x4fffffff));
+
+
+    /* Cpuid 0x80000000 is harmless. */
+
+    /* Cpuid 0x80000001 is handled with cpuid 1 way up above. */
+
+    /* Cpuid 0x80000002...0x80000004 contains the processor name and is considered harmless. */
+
+    /* Cpuid 0x800000005 & 0x800000006 contain information about L1, L2 & L3 cache and TLB identifiers.
+     * Safe to pass on to the guest.
+     *
+     * AMD:   0x800000005 L1 cache information
+     *        0x800000006 L2/L3 cache information
+     * Intel: 0x800000005 reserved
+     *        0x800000006 L2 cache information
+     * VIA:   0x800000005 TLB and L1 cache information
+     *        0x800000006 L2 cache information
+     */
+
+    /* Cpuid 0x800000007: Advanced Power Management Information.
+     * AMD:   EAX: Processor feedback capabilities.
+     *        EBX: RAS capabilites.
+     *        ECX: Advanced power monitoring interface.
+     *        EDX: Enhanced power management capabilities.
+     * Intel: EAX, EBX, ECX - reserved.
+     *        EDX - Invariant TSC indicator supported (bit 8), the rest is reserved.
+     * VIA:   Reserved
+     * We let the guest see EDX_TSCINVAR (and later maybe EDX_EFRO). Actually, we should set EDX_TSCINVAR.
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x80000007), uSubLeaf)) != NULL)
+    {
+        pCurLeaf->uEax = pCurLeaf->uEbx = pCurLeaf->uEcx = 0;
+        if (pCpum->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
+        {
+            pCurLeaf->uEdx &= 0
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_TS
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_FID
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_VID
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_TTP
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_TM
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_STC
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_MC
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_HWPSTATE
+#if 0   /*
+         * We don't expose X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR, because newer
+         * Linux kernels blindly assume that the AMD performance counters work
+         * if this is set for 64 bits guests. (Can't really find a CPUID feature
+         * bit for them though.)
+         */
+        /** @todo need to recheck this with new MSR emulation. */
+                           | X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR
+#endif
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_CPB       RT_BIT(9)
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_EFRO      RT_BIT(10)
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_PFI       RT_BIT(11)
+                           //| X86_CPUID_AMD_ADVPOWER_EDX_PA        RT_BIT(12)
+                           | 0;
+        }
+        else
+            pCurLeaf->uEdx &= X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR;
+        if (pConfig->fInvariantTsc)
+            pCurLeaf->uEdx |= X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR;
+        uSubLeaf++;
+    }
+
+    /* Cpuid 0x80000008:
+     * AMD:               EBX, EDX - reserved
+     *                    EAX: Virtual/Physical/Guest address Size
+     *                    ECX: Number of cores + APICIdCoreIdSize
+     * Intel:             EAX: Virtual/Physical address Size
+     *                    EBX, ECX, EDX - reserved
+     * VIA:               EAX: Virtual/Physical address Size
+     *                    EBX, ECX, EDX - reserved
+     *
+     * We only expose the virtual+pysical address size to the guest atm.
+     * On AMD we set the core count, but not the apic id stuff as we're
+     * currently not doing the apic id assignments in a complatible manner.
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x80000008), uSubLeaf)) != NULL)
+    {
+        pCurLeaf->uEax &= UINT32_C(0x0000ffff); /* Virtual & physical address sizes only. */
+        pCurLeaf->uEbx  = 0;  /* reserved */
+        pCurLeaf->uEdx  = 0;  /* reserved */
+
+        /* Set APICIdCoreIdSize to zero (use legacy method to determine the number of cores per cpu).
+         * Set core count to 0, indicating 1 core. Adjust if we're in multi core mode on AMD. */
+        pCurLeaf->uEcx = 0;
+#ifdef VBOX_WITH_MULTI_CORE
+        if (   pVM->cCpus > 1
+            && pCpum->GuestFeatures.enmCpuVendor == CPUMCPUVENDOR_AMD)
+            pCurLeaf->uEcx |= (pVM->cCpus - 1) & UINT32_C(0xff);
+#endif
+        uSubLeaf++;
+    }
+
+    /* Cpuid 0x80000009: Reserved
+     * We zero this since we don't know what it may have been used for.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, UINT32_C(0x80000009));
+
+    /* Cpuid 0x8000000a: SVM Information
+     * AMD: EAX - SVM revision.
+     *      EBX - Number of ASIDs.
+     *      ECX - Reserved.
+     *      EDX - SVM Feature identification.
+     * We clear all as we currently does not virtualize SVM.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, UINT32_C(0x8000000a));
+
+    /* Cpuid 0x8000000b thru 0x80000018: Reserved
+     * We clear these as we don't know what purpose they might have. */
+    for (uint32_t uLeaf = UINT32_C(0x8000000b); uLeaf <= UINT32_C(0x80000018); uLeaf++)
+        cpumR3CpuIdZeroLeaf(pCpum, uLeaf);
+
+    /* Cpuid 0x80000019: TLB configuration
+     * Seems to be harmless, pass them thru as is. */
+
+    /* Cpuid 0x8000001a: Peformance optimization identifiers.
+     * Strip anything we don't know what is or addresses feature we don't implement. */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x8000001a), uSubLeaf)) != NULL)
+    {
+        pCurLeaf->uEax &= RT_BIT_32(0) /* FP128 - use 1x128-bit instead of 2x64-bit. */
+                        | RT_BIT_32(1) /* MOVU - Prefere unaligned MOV over MOVL + MOVH. */
+                        //| RT_BIT_32(2) /* FP256 - use 1x256-bit instead of 2x128-bit. */
+                        ;
+        pCurLeaf->uEbx  = 0;  /* reserved */
+        pCurLeaf->uEcx  = 0;  /* reserved */
+        pCurLeaf->uEdx  = 0;  /* reserved */
+        uSubLeaf++;
+    }
+
+    /* Cpuid 0x8000001b: Instruct based sampling (IBS) information.
+     * Clear this as we don't currently virtualize this feature. */
+    cpumR3CpuIdZeroLeaf(pCpum, UINT32_C(0x8000001b));
+
+    /* Cpuid 0x8000001c: Lightweight profiling (LWP) information.
+     * Clear this as we don't currently virtualize this feature. */
+    cpumR3CpuIdZeroLeaf(pCpum, UINT32_C(0x8000001c));
+
+    /* Cpuid 0x8000001d+ECX: Get cache configuration descriptors.
+     * We need to sanitize the cores per cache (EAX[25:14]).
+     *
+     * This is very much the same as Intel's CPUID(4) leaf, except EAX[31:26]
+     * and EDX[2] are reserved here, and EAX[14:25] is documented having a
+     * slightly different meaning.
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x8000001d), uSubLeaf)) != NULL)
+    {
+#ifdef VBOX_WITH_MULTI_CORE
+        uint32_t cCores = ((pCurLeaf->uEax >> 14) & 0xfff) + 1;
+        if (cCores > pVM->cCpus)
+            cCores = pVM->cCpus;
+        pCurLeaf->uEax &= UINT32_C(0x00003fff);
+        pCurLeaf->uEax |= ((cCores - 1) & 0xfff) << 14;
+#else
+        pCurLeaf->uEax &= UINT32_C(0x00003fff);
+#endif
+        uSubLeaf++;
+    }
+
+    /* Cpuid 0x8000001e: Get APIC / unit / node information.
+     * If AMD, we configure it for our layout (on EMT(0)).  In the multi-core
+     * setup, we have one compute unit with all the cores in it.  Single node.
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0x8000001e), uSubLeaf)) != NULL)
+    {
+        pCurLeaf->uEax = 0; /* Extended APIC ID = EMT(0).idApic (== 0).  */
+        if (pCurLeaf->fFlags & CPUMCPUIDLEAF_F_CONTAINS_APIC_ID)
+        {
+#ifdef VBOX_WITH_MULTI_CORE
+            pCurLeaf->uEbx = pVM->cCpus < 0x100
+                           ? (pVM->cCpus - 1) << 8 : UINT32_C(0x0000ff00); /* Compute unit ID 0, core per unit. */
+#else
+            pCurLeaf->uEbx = 0; /* Compute unit ID 0, 1 core per unit. */
+#endif
+            pCurLeaf->uEcx = 0; /* Node ID 0, 1 node per CPU. */
+        }
+        else
+        {
+            Assert(pCpum->GuestFeatures.enmCpuVendor != CPUMCPUVENDOR_AMD);
+            pCurLeaf->uEbx = 0; /* Reserved. */
+            pCurLeaf->uEcx = 0; /* Reserved. */
+        }
+        pCurLeaf->uEdx = 0; /* Reserved. */
+        uSubLeaf++;
+    }
+
+    /* Cpuid 0x8000001f...0x8ffffffd: Unknown.
+     * We don't know these and what they mean, so remove them. */
+    cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                           UINT32_C(0x8000001f), UINT32_C(0x8ffffffd));
+
+    /* Cpuid 0x8ffffffe: Mystery AMD K6 leaf.
+     * Just pass it thru for now. */
+
+    /* Cpuid 0x8fffffff: Mystery hammer time leaf!
+     * Just pass it thru for now. */
+
+    /* Cpuid 0xc0000000: Centaur stuff.
+     * Harmless, pass it thru. */
+
+    /* Cpuid 0xc0000001: Centaur features.
+     * VIA: EAX - Family, model, stepping.
+     *      EDX - Centaur extended feature flags.  Nothing interesting, except may
+     *            FEMMS (bit 5), but VIA marks it as 'reserved', so never mind.
+     *      EBX, ECX - reserved.
+     * We keep EAX but strips the rest.
+     */
+    uSubLeaf = 0;
+    while ((pCurLeaf = cpumR3CpuIdGetExactLeaf(pCpum, UINT32_C(0xc0000001), uSubLeaf)) != NULL)
+    {
+        pCurLeaf->uEbx = 0;
+        pCurLeaf->uEcx = 0;
+        pCurLeaf->uEdx = 0; /* Bits 0 thru 9 are documented on sandpil.org, but we don't want them, except maybe 5 (FEMMS). */
+        uSubLeaf++;
+    }
+
+    /* Cpuid 0xc0000002: Old Centaur Current Performance Data.
+     * We only have fixed stale values, but should be harmless. */
+
+    /* Cpuid 0xc0000003: Reserved.
+     * We zero this since we don't know what it may have been used for.
+     */
+    cpumR3CpuIdZeroLeaf(pCpum, UINT32_C(0xc0000003));
+
+    /* Cpuid 0xc0000004: Centaur Performance Info.
+     * We only have fixed stale values, but should be harmless. */
+
+
+    /* Cpuid 0xc0000005...0xcfffffff: Unknown.
+     * We don't know these and what they mean, so remove them. */
+    cpumR3CpuIdRemoveRange(pCpum->GuestInfo.paCpuIdLeavesR3, &pCpum->GuestInfo.cCpuIdLeaves,
+                           UINT32_C(0xc0000005), UINT32_C(0xcfffffff));
+
+    return VINF_SUCCESS;
+#undef PORTABLE_DISABLE_FEATURE_BIT
+#undef PORTABLE_CLEAR_BITS_WHEN
+}
+
+
+/**
+ * Reads a value in /CPUM/IsaExts/ node.
+ *
+ * @returns VBox status code (error message raised).
+ * @param   pVM             The VM handle (for errors).
+ * @param   pIsaExts        The /CPUM/IsaExts node (can be NULL).
+ * @param   pszValueName    The value / extension name.
+ * @param   penmValue       Where to return the choice.
+ * @param   enmDefault      The default choice.
+ */
+static int cpumR3CpuIdReadIsaExtCfg(PVM pVM, PCFGMNODE pIsaExts, const char *pszValueName,
+                                    CPUMISAEXTCFG *penmValue, CPUMISAEXTCFG enmDefault)
+{
+    /*
+     * Try integer encoding first.
+     */
+    uint64_t uValue;
+    int rc = CFGMR3QueryInteger(pIsaExts, pszValueName, &uValue);
+    if (RT_SUCCESS(rc))
+        switch (uValue)
+        {
+            case 0: *penmValue = CPUMISAEXTCFG_DISABLED; break;
+            case 1: *penmValue = CPUMISAEXTCFG_ENABLED_SUPPORTED; break;
+            case 2: *penmValue = CPUMISAEXTCFG_ENABLED_ALWAYS; break;
+            case 9: *penmValue = CPUMISAEXTCFG_ENABLED_PORTABLE; break;
+            default:
+                return VMSetError(pVM, VERR_CPUM_INVALID_CONFIG_VALUE, RT_SRC_POS,
+                                  "Invalid config value for '/CPUM/IsaExts/%s': %llu (expected 0/'disabled', 1/'enabled', 2/'portable', or 9/'forced')",
+                                  pszValueName, uValue);
+        }
+    /*
+     * If missing, use default.
+     */
+    else if (rc == VERR_CFGM_VALUE_NOT_FOUND || rc == VERR_CFGM_NO_PARENT)
+        *penmValue = enmDefault;
+    else
+    {
+        if (rc == VERR_CFGM_NOT_INTEGER)
+        {
+            /*
+             * Not an integer, try read it as a string.
+             */
+            char szValue[32];
+            rc = CFGMR3QueryString(pIsaExts, pszValueName, szValue, sizeof(szValue));
+            if (RT_SUCCESS(rc))
+            {
+                RTStrToLower(szValue);
+                size_t cchValue = strlen(szValue);
+#define EQ(a_str) (cchValue == sizeof(a_str) - 1U && memcmp(szValue, a_str, sizeof(a_str) - 1))
+                if (     EQ("disabled") || EQ("disable") || EQ("off") || EQ("no"))
+                    *penmValue = CPUMISAEXTCFG_DISABLED;
+                else if (EQ("enabled")  || EQ("enable")  || EQ("on")  || EQ("yes"))
+                    *penmValue = CPUMISAEXTCFG_ENABLED_SUPPORTED;
+                else if (EQ("forced")   || EQ("force")   || EQ("always"))
+                    *penmValue = CPUMISAEXTCFG_ENABLED_ALWAYS;
+                else if (EQ("portable"))
+                    *penmValue = CPUMISAEXTCFG_ENABLED_PORTABLE;
+                else if (EQ("default")  || EQ("def"))
+                    *penmValue = enmDefault;
+                else
+                    return VMSetError(pVM, VERR_CPUM_INVALID_CONFIG_VALUE, RT_SRC_POS,
+                                      "Invalid config value for '/CPUM/IsaExts/%s': '%s' (expected 0/'disabled', 1/'enabled', 2/'portable', or 9/'forced')",
+                                      pszValueName, uValue);
+#undef EQ
+            }
+        }
+        if (RT_FAILURE(rc))
+            return VMSetError(pVM, rc, RT_SRC_POS, "Error reading config value '/CPUM/IsaExts/%s': %Rrc", pszValueName, rc);
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Reads a value in /CPUM/IsaExts/ node, forcing it to DISABLED if wanted.
+ *
+ * @returns VBox status code (error message raised).
+ * @param   pVM             The VM handle (for errors).
+ * @param   pIsaExts        The /CPUM/IsaExts node (can be NULL).
+ * @param   pszValueName    The value / extension name.
+ * @param   penmValue       Where to return the choice.
+ * @param   enmDefault      The default choice.
+ * @param   fAllowed        Allowed choice.  Applied both to the result and to
+ *                          the default value.
+ */
+static int cpumR3CpuIdReadIsaExtCfgEx(PVM pVM, PCFGMNODE pIsaExts, const char *pszValueName,
+                                      CPUMISAEXTCFG *penmValue, CPUMISAEXTCFG enmDefault, bool fAllowed)
+{
+    int rc;
+    if (fAllowed)
+        rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, pszValueName, penmValue, enmDefault);
+    else
+    {
+        rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, pszValueName, penmValue, false /*enmDefault*/);
+        if (RT_SUCCESS(rc) && *penmValue == CPUMISAEXTCFG_ENABLED_ALWAYS)
+            LogRel(("CPUM: Ignoring forced '%s'\n", pszValueName));
+        *penmValue = CPUMISAEXTCFG_DISABLED;
+    }
+    return rc;
+}
+
+
+/**
+ * Reads a value in /CPUM/IsaExts/ node that used to be located in /CPUM/.
+ *
+ * @returns VBox status code (error message raised).
+ * @param   pVM             The VM handle (for errors).
+ * @param   pIsaExts        The /CPUM/IsaExts node (can be NULL).
+ * @param   pCpumCfg        The /CPUM node (can be NULL).
+ * @param   pszValueName    The value / extension name.
+ * @param   penmValue       Where to return the choice.
+ * @param   enmDefault      The default choice.
+ */
+static int cpumR3CpuIdReadIsaExtCfgLegacy(PVM pVM, PCFGMNODE pIsaExts, PCFGMNODE pCpumCfg, const char *pszValueName,
+                                          CPUMISAEXTCFG *penmValue, CPUMISAEXTCFG enmDefault)
+{
+    if (CFGMR3Exists(pCpumCfg, pszValueName))
+    {
+        if (!CFGMR3Exists(pIsaExts, pszValueName))
+            LogRel(("Warning: /CPUM/%s is deprecated, use /CPUM/IsaExts/%s instead.\n", pszValueName, pszValueName));
+        else
+            return VMSetError(pVM, VERR_DUPLICATE, RT_SRC_POS,
+                              "Duplicate config values '/CPUM/%s' and '/CPUM/IsaExts/%s' - please remove the former!",
+                              pszValueName, pszValueName);
+
+        bool fLegacy;
+        int rc = CFGMR3QueryBoolDef(pCpumCfg, pszValueName, &fLegacy, enmDefault != CPUMISAEXTCFG_DISABLED);
+        if (RT_SUCCESS(rc))
+        {
+            *penmValue = fLegacy;
+            return VINF_SUCCESS;
+        }
+        return VMSetError(pVM, VERR_DUPLICATE, RT_SRC_POS, "Error querying '/CPUM/%s': %Rrc", pszValueName, rc);
+    }
+
+    return cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, pszValueName, penmValue, enmDefault);
+}
+
+
+static int cpumR3CpuIdReadConfig(PVM pVM, PCPUMCPUIDCONFIG pConfig, PCFGMNODE pCpumCfg, bool fNestedPagingAndFullGuestExec)
+{
+    int rc;
+
+    /** @cfgm{/CPUM/PortableCpuIdLevel, 8-bit, 0, 3, 0}
+     * When non-zero CPUID features that could cause portability issues will be
+     * stripped.  The higher the value the more features gets stripped.  Higher
+     * values should only be used when older CPUs are involved since it may
+     * harm performance and maybe also cause problems with specific guests. */
+    rc = CFGMR3QueryU8Def(pCpumCfg, "PortableCpuIdLevel", &pVM->cpum.s.u8PortableCpuIdLevel, 0);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/GuestCpuName, string}
+     * The name of the CPU we're to emulate.  The default is the host CPU.
+     * Note! CPUs other than "host" one is currently unsupported. */
+    rc = CFGMR3QueryStringDef(pCpumCfg, "GuestCpuName", pConfig->szCpuName, sizeof(pConfig->szCpuName), "host");
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/NT4LeafLimit, boolean, false}
+     * Limit the number of standard CPUID leaves to 0..3 to prevent NT4 from
+     * bugchecking with MULTIPROCESSOR_CONFIGURATION_NOT_SUPPORTED (0x3e).
+     * This option corresponds somewhat to IA32_MISC_ENABLES.BOOT_NT4[bit 22].
+     */
+    rc = CFGMR3QueryBoolDef(pCpumCfg, "NT4LeafLimit", &pConfig->fNt4LeafLimit, false);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/InvariantTsc, boolean, complicated}
+     * Set the invariant TSC flag in 0x80000007 if true, otherwas take default
+     * action.  By default the flag is passed thru as is from the host CPU, except
+     * on AMD CPUs where it's suppressed to avoid trouble from linux assuming we
+     * virtualize performance counters.
+     */
+    rc = CFGMR3QueryBoolDef(pCpumCfg, "InvariantTsc", &pConfig->fInvariantTsc, false);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/MaxIntelFamilyModelStep, uint32_t, UINT32_MAX}
+     * Restrict the reported CPU family+model+stepping of intel CPUs.  This is
+     * probably going to be a temporary hack, so don't depend on this.
+     * The 1st byte of the value is the stepping, the 2nd byte value is the model
+     * number and the 3rd byte value is the family, and the 4th value must be zero.
+     */
+    rc = CFGMR3QueryU32Def(pCpumCfg, "MaxIntelFamilyModelStep", &pConfig->uMaxIntelFamilyModelStep, UINT32_MAX);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/MaxStdLeaf, uint32_t, 0x00000016}
+     * The last standard leaf to keep.  The actual last value that is stored in EAX
+     * is RT_MAX(CPUID[0].EAX,/CPUM/MaxStdLeaf).  Leaves beyond the max leaf are
+     * removed.  (This works independently of and differently from NT4LeafLimit.)
+     * The default is usually set to what we're able to reasonably sanitize.
+     */
+    rc = CFGMR3QueryU32Def(pCpumCfg, "MaxStdLeaf", &pConfig->uMaxStdLeaf, UINT32_C(0x00000016));
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/MaxExtLeaf, uint32_t, 0x8000001e}
+     * The last extended leaf to keep.  The actual last value that is stored in EAX
+     * is RT_MAX(CPUID[0x80000000].EAX,/CPUM/MaxStdLeaf).  Leaves beyond the max
+     * leaf are removed.  The default is set to what we're able to sanitize.
+     */
+    rc = CFGMR3QueryU32Def(pCpumCfg, "MaxExtLeaf", &pConfig->uMaxExtLeaf, UINT32_C(0x8000001e));
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/MaxCentaurLeaf, uint32_t, 0xc0000004}
+     * The last extended leaf to keep.  The actual last value that is stored in EAX
+     * is RT_MAX(CPUID[0xc0000000].EAX,/CPUM/MaxCentaurLeaf).  Leaves beyond the max
+     * leaf are removed.  The default is set to what we're able to sanitize.
+     */
+    rc = CFGMR3QueryU32Def(pCpumCfg, "MaxCentaurLeaf", &pConfig->uMaxCentaurLeaf, UINT32_C(0xc0000004));
+    AssertLogRelRCReturn(rc, rc);
+
+
+    /*
+     * Instruction Set Architecture (ISA) Extensions.
+     */
+    PCFGMNODE pIsaExts = CFGMR3GetChild(pCpumCfg, "IsaExts");
+    if (pIsaExts)
+    {
+        rc = CFGMR3ValidateConfig(pIsaExts, "/CPUM/IsaExts/",
+                                   "CMPXCHG16B"
+                                  "|MONITOR"
+                                  "|MWaitExtensions"
+                                  "|SSE4.1"
+                                  "|SSE4.2"
+                                  "|AESNI"
+                                  "|PCLMUL"
+                                  "|POPCNT"
+                                  "|MOVBE"
+                                  "|RDRAND"
+                                  "|RDSEED"
+                                  "|CLFLUSHOPT"
+                                  , "" /*pszValidNodes*/, "CPUM" /*pszWho*/, 0 /*uInstance*/);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    /** @cfgm{/CPUM/IsaExts/CMPXCHG16B, boolean, depends}
+     * Expose CMPXCHG16B to the guest if supported by the host. For the time
+     * being the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfgLegacy(pVM, pIsaExts, pCpumCfg, "CMPXCHG16B", &pConfig->enmCmpXchg16b, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/MONITOR, boolean, true}
+     * Expose MONITOR/MWAIT instructions to the guest.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfgLegacy(pVM, pIsaExts, pCpumCfg, "MONITOR", &pConfig->enmMonitor, true);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/MWaitExtensions, boolean, false}
+     * Expose MWAIT extended features to the guest.  For now we expose just MWAIT
+     * break on interrupt feature (bit 1).
+     */
+    rc = cpumR3CpuIdReadIsaExtCfgLegacy(pVM, pIsaExts, pCpumCfg, "MWaitExtensions", &pConfig->enmMWaitExtensions, false);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/SSE4.1, boolean, true}
+     * Expose SSE4.1 to the guest if available.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfgLegacy(pVM, pIsaExts, pCpumCfg, "SSE4.1", &pConfig->enmSse41, true);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/SSE4.2, boolean, true}
+     * Expose SSE4.2 to the guest if available.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfgLegacy(pVM, pIsaExts, pCpumCfg, "SSE4.2", &pConfig->enmSse42, true);
+    AssertLogRelRCReturn(rc, rc);
+
+    bool const fMayHaveXSave = fNestedPagingAndFullGuestExec
+                            && pVM->cpum.s.HostFeatures.fXSaveRstor
+                            && pVM->cpum.s.HostFeatures.fOpSysXSaveRstor;
+
+    /** @cfgm{/CPUM/IsaExts/XSAVE, boolean, depends}
+     * Expose XSAVE/XRSTOR to the guest if available.  For the time being the
+     * default is to only expose this to VMs with nested paging and AMD-V or
+     * unrestricted guest execution mode.  Not possible to force this one without
+     * host support at the moment.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfgEx(pVM, pIsaExts, "XSAVE", &pConfig->enmXSave, fNestedPagingAndFullGuestExec,
+                                    fMayHaveXSave /*fAllowed*/);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/AVX, boolean, depends}
+     * Expose the AVX instruction set extensions to the guest if available and
+     * XSAVE is exposed too.  For the time being the default is to only expose this
+     * to VMs with nested paging and AMD-V or unrestricted guest execution mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfgEx(pVM, pIsaExts, "AVX", &pConfig->enmAvx, fNestedPagingAndFullGuestExec,
+                                    fMayHaveXSave && pConfig->enmXSave /*fAllowed*/);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/AVX2, boolean, depends}
+     * Expose the AVX2 instruction set extensions to the guest if available and
+     * XSAVE is exposed too. For the time being the default is to only expose this
+     * to VMs with nested paging and AMD-V or unrestricted guest execution mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfgEx(pVM, pIsaExts, "AVX2", &pConfig->enmAvx2, fNestedPagingAndFullGuestExec,
+                                    fMayHaveXSave && pConfig->enmXSave /*fAllowed*/);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/AESNI, isaextcfg, depends}
+     * Whether to expose the AES instructions to the guest.  For the time being the
+     * default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "AESNI", &pConfig->enmAesNi, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/PCLMUL, isaextcfg, depends}
+     * Whether to expose the PCLMULQDQ instructions to the guest.  For the time
+     * being the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "PCLMUL", &pConfig->enmPClMul, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/POPCNT, isaextcfg, depends}
+     * Whether to expose the POPCNT instructions to the guest.  For the time
+     * being the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "POPCNT", &pConfig->enmPopCnt, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/MOVBE, isaextcfg, depends}
+     * Whether to expose the MOVBE instructions to the guest.  For the time
+     * being the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "MOVBE", &pConfig->enmMovBe, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/RDRAND, isaextcfg, depends}
+     * Whether to expose the RDRAND instructions to the guest.  For the time being
+     * the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "RDRAND", &pConfig->enmRdRand, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/RDSEED, isaextcfg, depends}
+     * Whether to expose the RDSEED instructions to the guest.  For the time being
+     * the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "RDSEED", &pConfig->enmRdSeed, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/CLFLUSHOPT, isaextcfg, depends}
+     * Whether to expose the CLFLUSHOPT instructions to the guest.  For the time
+     * being the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "CLFLUSHOPT", &pConfig->enmCLFlushOpt, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+
+    /* AMD: */
+
+    /** @cfgm{/CPUM/IsaExts/ABM, isaextcfg, depends}
+     * Whether to expose the AMD ABM instructions to the guest.  For the time
+     * being the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "ABM", &pConfig->enmAbm, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/SSE4A, isaextcfg, depends}
+     * Whether to expose the AMD SSE4A instructions to the guest.  For the time
+     * being the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "SSE4A", &pConfig->enmSse4A, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/MISALNSSE, isaextcfg, depends}
+     * Whether to expose the AMD MisAlSse feature (MXCSR flag 17) to the guest.  For
+     * the time being the default is to only do this for VMs with nested paging and
+     * AMD-V or unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "MISALNSSE", &pConfig->enmMisAlnSse, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/3DNOWPRF, isaextcfg, depends}
+     * Whether to expose the AMD 3D Now! prefetch instructions to the guest.
+     * For the time being the default is to only do this for VMs with nested paging
+     * and AMD-V or unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "3DNOWPRF", &pConfig->enm3dNowPrf, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/CPUM/IsaExts/AXMMX, isaextcfg, depends}
+     * Whether to expose the AMD's MMX Extensions to the guest.  For the time being
+     * the default is to only do this for VMs with nested paging and AMD-V or
+     * unrestricted guest mode.
+     */
+    rc = cpumR3CpuIdReadIsaExtCfg(pVM, pIsaExts, "AXMMX", &pConfig->enmAmdExtMmx, fNestedPagingAndFullGuestExec);
+    AssertLogRelRCReturn(rc, rc);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Initializes the emulated CPU's CPUID & MSR information.
+ *
+ * @returns VBox status code.
+ * @param   pVM          Pointer to the VM.
+ */
+int cpumR3InitCpuIdAndMsrs(PVM pVM)
+{
+    PCPUM       pCpum    = &pVM->cpum.s;
+    PCFGMNODE   pCpumCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM");
+
+    /*
+     * Read the configuration.
+     */
+    CPUMCPUIDCONFIG Config;
+    RT_ZERO(Config);
+
+    int rc = cpumR3CpuIdReadConfig(pVM, &Config, pCpumCfg, HMAreNestedPagingAndFullGuestExecEnabled(pVM));
+    AssertRCReturn(rc, rc);
+
+    /*
+     * Get the guest CPU data from the database and/or the host.
+     *
+     * The CPUID and MSRs are currently living on the regular heap to avoid
+     * fragmenting the hyper heap (and because there isn't/wasn't any realloc
+     * API for the hyper heap).  This means special cleanup considerations.
+     */
+    rc = cpumR3DbGetCpuInfo(Config.szCpuName, &pCpum->GuestInfo);
+    if (RT_FAILURE(rc))
+        return rc == VERR_CPUM_DB_CPU_NOT_FOUND
+             ? VMSetError(pVM, rc, RT_SRC_POS,
+                          "Info on guest CPU '%s' could not be found. Please, select a different CPU.", Config.szCpuName)
+             : rc;
+
+    /** @cfgm{/CPUM/MSRs/[Name]/[First|Last|Type|Value|...],}
+     * Overrides the guest MSRs.
+     */
+    rc = cpumR3LoadMsrOverrides(pVM, CFGMR3GetChild(pCpumCfg, "MSRs"));
+
+    /** @cfgm{/CPUM/HostCPUID/[000000xx|800000xx|c000000x]/[eax|ebx|ecx|edx],32-bit}
+     * Overrides the CPUID leaf values (from the host CPU usually) used for
+     * calculating the guest CPUID leaves.  This can be used to preserve the CPUID
+     * values when moving a VM to a different machine.  Another use is restricting
+     * (or extending) the feature set exposed to the guest. */
+    if (RT_SUCCESS(rc))
+        rc = cpumR3LoadCpuIdOverrides(pVM, CFGMR3GetChild(pCpumCfg, "HostCPUID"), "HostCPUID");
+
+    if (RT_SUCCESS(rc) && CFGMR3GetChild(pCpumCfg, "CPUID")) /* 2nd override, now discontinued. */
+        rc = VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_NODE, RT_SRC_POS,
+                        "Found unsupported configuration node '/CPUM/CPUID/'. "
+                        "Please use IMachine::setCPUIDLeaf() instead.");
+
+    /*
+     * Pre-explode the CPUID info.
+     */
+    if (RT_SUCCESS(rc))
+        rc = cpumR3CpuIdExplodeFeatures(pCpum->GuestInfo.paCpuIdLeavesR3, pCpum->GuestInfo.cCpuIdLeaves, &pCpum->GuestFeatures);
+
+    /*
+     * Sanitize the cpuid information passed on to the guest.
+     */
+    if (RT_SUCCESS(rc))
+    {
+        rc = cpumR3CpuIdSanitize(pVM, pCpum, &Config);
+        if (RT_SUCCESS(rc))
+        {
+            cpumR3CpuIdLimitLeaves(pCpum, &Config);
+            cpumR3CpuIdLimitIntelFamModStep(pCpum, &Config);
+        }
+    }
+
+    /*
+     * Plant our own hypervisor CPUID leaves.
+     */
+    if (RT_SUCCESS(rc))
+        rc = cpumR3CpuIdPlantHypervisorLeaves(pCpum, &Config);
+
+    /*
+     * MSR fudging.
+     */
+    if (RT_SUCCESS(rc))
+    {
+        /** @cfgm{/CPUM/FudgeMSRs, boolean, true}
+         * Fudges some common MSRs if not present in the selected CPU database entry.
+         * This is for trying to keep VMs running when moved between different hosts
+         * and different CPU vendors. */
+        bool fEnable;
+        rc = CFGMR3QueryBoolDef(pCpumCfg, "FudgeMSRs", &fEnable, true); AssertRC(rc);
+        if (RT_SUCCESS(rc) && fEnable)
+        {
+            rc = cpumR3MsrApplyFudge(pVM);
+            AssertLogRelRC(rc);
+        }
+    }
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Move the MSR and CPUID arrays over on the hypervisor heap, and explode
+         * guest CPU features again.
+         */
+        void *pvFree = pCpum->GuestInfo.paCpuIdLeavesR3;
+        int rc1 = cpumR3CpuIdInstallAndExplodeLeaves(pVM, pCpum, pCpum->GuestInfo.paCpuIdLeavesR3,
+                                                     pCpum->GuestInfo.cCpuIdLeaves);
+        RTMemFree(pvFree);
+
+        pvFree = pCpum->GuestInfo.paMsrRangesR3;
+        int rc2 = MMHyperDupMem(pVM, pvFree,
+                                sizeof(pCpum->GuestInfo.paMsrRangesR3[0]) * pCpum->GuestInfo.cMsrRanges, 32,
+                                MM_TAG_CPUM_MSRS, (void **)&pCpum->GuestInfo.paMsrRangesR3);
+        RTMemFree(pvFree);
+        AssertLogRelRCReturn(rc1, rc1);
+        AssertLogRelRCReturn(rc2, rc2);
+
+        pCpum->GuestInfo.paMsrRangesR0 = MMHyperR3ToR0(pVM, pCpum->GuestInfo.paMsrRangesR3);
+        pCpum->GuestInfo.paMsrRangesRC = MMHyperR3ToRC(pVM, pCpum->GuestInfo.paMsrRangesR3);
+        cpumR3MsrRegStats(pVM);
+
+
+        /*
+         * Some more configuration that we're applying at the end of everything
+         * via the CPUMSetGuestCpuIdFeature API.
+         */
+
+        /* Check if PAE was explicitely enabled by the user. */
+        bool fEnable;
+        rc = CFGMR3QueryBoolDef(CFGMR3GetRoot(pVM), "EnablePAE", &fEnable, false);
+        AssertRCReturn(rc, rc);
+        if (fEnable)
+            CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_PAE);
+
+        /* We don't normally enable NX for raw-mode, so give the user a chance to force it on. */
+        rc = CFGMR3QueryBoolDef(pCpumCfg, "EnableNX", &fEnable, false);
+        AssertRCReturn(rc, rc);
+        if (fEnable)
+            CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_NX);
+
+        /* We don't enable the Hypervisor Present bit by default, but it may be needed by some guests. */
+        rc = CFGMR3QueryBoolDef(pCpumCfg, "EnableHVP", &fEnable, false);
+        AssertRCReturn(rc, rc);
+        if (fEnable)
+            CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_HVP);
+
+        return VINF_SUCCESS;
+    }
+
+    /*
+     * Failed before switching to hyper heap.
+     */
+    RTMemFree(pCpum->GuestInfo.paCpuIdLeavesR3);
+    pCpum->GuestInfo.paCpuIdLeavesR3 = NULL;
+    RTMemFree(pCpum->GuestInfo.paMsrRangesR3);
+    pCpum->GuestInfo.paMsrRangesR3 = NULL;
+    return rc;
+}
+
+
+
+/*
+ *
+ *
+ * Saved state related code.
+ * Saved state related code.
+ * Saved state related code.
+ *
+ *
+ */
+
+/**
+ * Called both in pass 0 and the final pass.
+ *
+ * @param   pVM                 Pointer to the VM.
+ * @param   pSSM                The saved state handle.
+ */
+void cpumR3SaveCpuId(PVM pVM, PSSMHANDLE pSSM)
+{
+    /*
+     * Save all the CPU ID leaves.
+     */
+    SSMR3PutU32(pSSM, sizeof(pVM->cpum.s.GuestInfo.paCpuIdLeavesR3[0]));
+    SSMR3PutU32(pSSM, pVM->cpum.s.GuestInfo.cCpuIdLeaves);
+    SSMR3PutMem(pSSM, pVM->cpum.s.GuestInfo.paCpuIdLeavesR3,
+                sizeof(pVM->cpum.s.GuestInfo.paCpuIdLeavesR3[0]) * pVM->cpum.s.GuestInfo.cCpuIdLeaves);
+
+    SSMR3PutMem(pSSM, &pVM->cpum.s.GuestInfo.DefCpuId, sizeof(pVM->cpum.s.GuestInfo.DefCpuId));
+
+    /*
+     * Save a good portion of the raw CPU IDs as well as they may come in
+     * handy when validating features for raw mode.
+     */
+    CPUMCPUID   aRawStd[16];
+    for (unsigned i = 0; i < RT_ELEMENTS(aRawStd); i++)
+        ASMCpuIdExSlow(i, 0, 0, 0, &aRawStd[i].uEax, &aRawStd[i].uEbx, &aRawStd[i].uEcx, &aRawStd[i].uEdx);
+    SSMR3PutU32(pSSM, RT_ELEMENTS(aRawStd));
+    SSMR3PutMem(pSSM, &aRawStd[0], sizeof(aRawStd));
+
+    CPUMCPUID   aRawExt[32];
+    for (unsigned i = 0; i < RT_ELEMENTS(aRawExt); i++)
+        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0, &aRawExt[i].uEax, &aRawExt[i].uEbx, &aRawExt[i].uEcx, &aRawExt[i].uEdx);
+    SSMR3PutU32(pSSM, RT_ELEMENTS(aRawExt));
+    SSMR3PutMem(pSSM, &aRawExt[0], sizeof(aRawExt));
+}
+
+
+static int cpumR3LoadOneOldGuestCpuIdArray(PSSMHANDLE pSSM, uint32_t uBase, PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves)
+{
+    uint32_t cCpuIds;
+    int rc = SSMR3GetU32(pSSM, &cCpuIds);
+    if (RT_SUCCESS(rc))
+    {
+        if (cCpuIds < 64)
+        {
+            for (uint32_t i = 0; i < cCpuIds; i++)
+            {
+                CPUMCPUID CpuId;
+                rc = SSMR3GetMem(pSSM, &CpuId, sizeof(CpuId));
+                if (RT_FAILURE(rc))
+                    break;
+
+                CPUMCPUIDLEAF NewLeaf;
+                NewLeaf.uLeaf           = uBase + i;
+                NewLeaf.uSubLeaf        = 0;
+                NewLeaf.fSubLeafMask    = 0;
+                NewLeaf.uEax            = CpuId.uEax;
+                NewLeaf.uEbx            = CpuId.uEbx;
+                NewLeaf.uEcx            = CpuId.uEcx;
+                NewLeaf.uEdx            = CpuId.uEdx;
+                NewLeaf.fFlags          = 0;
+                rc = cpumR3CpuIdInsert(NULL /* pVM */, ppaLeaves, pcLeaves, &NewLeaf);
+            }
+        }
+        else
+            rc = VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
+    }
+    if (RT_FAILURE(rc))
+    {
+        RTMemFree(*ppaLeaves);
+        *ppaLeaves = NULL;
+        *pcLeaves = 0;
+    }
+    return rc;
+}
+
+
+static int cpumR3LoadGuestCpuIdArray(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves)
+{
+    *ppaLeaves = NULL;
+    *pcLeaves = 0;
+
+    int rc;
+    if (uVersion > CPUM_SAVED_STATE_VERSION_PUT_STRUCT)
+    {
+        /*
+         * The new format. Starts by declaring the leave size and count.
+         */
+        uint32_t cbLeaf;
+        SSMR3GetU32(pSSM, &cbLeaf);
+        uint32_t cLeaves;
+        rc = SSMR3GetU32(pSSM, &cLeaves);
+        if (RT_SUCCESS(rc))
+        {
+            if (cbLeaf == sizeof(**ppaLeaves))
+            {
+                if (cLeaves <= CPUM_CPUID_MAX_LEAVES)
+                {
+                    /*
+                     * Load the leaves one by one.
+                     *
+                     * The uPrev stuff is a kludge for working around a week worth of bad saved
+                     * states during the CPUID revamp in March 2015.  We saved too many leaves
+                     * due to a bug in cpumR3CpuIdInstallAndExplodeLeaves, thus ending up with
+                     * garbage entires at the end of the array when restoring.  We also had
+                     * a subleaf insertion bug that triggered with the leaf 4 stuff below,
+                     * this kludge doesn't deal correctly with that, but who cares...
+                     */
+                    uint32_t uPrev = 0;
+                    for (uint32_t i = 0; i < cLeaves && RT_SUCCESS(rc); i++)
+                    {
+                        CPUMCPUIDLEAF Leaf;
+                        rc = SSMR3GetMem(pSSM, &Leaf, sizeof(Leaf));
+                        if (RT_SUCCESS(rc))
+                        {
+                            if (   uVersion != CPUM_SAVED_STATE_VERSION_BAD_CPUID_COUNT
+                                || Leaf.uLeaf >= uPrev)
+                            {
+                                rc = cpumR3CpuIdInsert(NULL /* pVM */, ppaLeaves, pcLeaves, &Leaf);
+                                uPrev = Leaf.uLeaf;
+                            }
+                            else
+                                uPrev = UINT32_MAX;
+                        }
+                    }
+                }
+                else
+                    rc = SSMR3SetLoadError(pSSM, VERR_TOO_MANY_CPUID_LEAVES, RT_SRC_POS,
+                                           "Too many CPUID leaves: %#x, max %#x", cLeaves, CPUM_CPUID_MAX_LEAVES);
+            }
+            else
+                rc = SSMR3SetLoadError(pSSM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED, RT_SRC_POS,
+                                       "CPUMCPUIDLEAF size differs: saved=%#x, our=%#x", cbLeaf, sizeof(**ppaLeaves));
+        }
+    }
+    else
+    {
+        /*
+         * The old format with its three inflexible arrays.
+         */
+        rc = cpumR3LoadOneOldGuestCpuIdArray(pSSM, UINT32_C(0x00000000), ppaLeaves, pcLeaves);
+        if (RT_SUCCESS(rc))
+            rc = cpumR3LoadOneOldGuestCpuIdArray(pSSM, UINT32_C(0x80000000), ppaLeaves, pcLeaves);
+        if (RT_SUCCESS(rc))
+            rc = cpumR3LoadOneOldGuestCpuIdArray(pSSM, UINT32_C(0xc0000000), ppaLeaves, pcLeaves);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Fake up leaf 4 on intel like we used to do in CPUMGetGuestCpuId earlier.
+             */
+            PCPUMCPUIDLEAF pLeaf = cpumR3CpuIdGetLeaf(*ppaLeaves, *pcLeaves, 0, 0);
+            if (   pLeaf
+                && ASMIsIntelCpuEx(pLeaf->uEbx, pLeaf->uEcx, pLeaf->uEdx))
+            {
+                CPUMCPUIDLEAF Leaf;
+                Leaf.uLeaf        = 4;
+                Leaf.fSubLeafMask = UINT32_MAX;
+                Leaf.uSubLeaf     = 0;
+                Leaf.uEdx = UINT32_C(0);          /* 3 flags, 0 is fine. */
+                Leaf.uEcx = UINT32_C(63);         /* sets - 1 */
+                Leaf.uEbx = (UINT32_C(7) << 22)   /* associativity -1 */
+                          | (UINT32_C(0) << 12)   /* phys line partitions - 1 */
+                          | UINT32_C(63);         /* system coherency line size - 1 */
+                Leaf.uEax = (RT_MIN(pVM->cCpus - 1, UINT32_C(0x3f)) << 26)  /* cores per package - 1 */
+                          | (UINT32_C(0) << 14)   /* threads per cache - 1 */
+                          | (UINT32_C(1) << 5)    /* cache level */
+                          | UINT32_C(1);          /* cache type (data) */
+                Leaf.fFlags       = 0;
+                rc = cpumR3CpuIdInsert(NULL /* pVM */, ppaLeaves, pcLeaves, &Leaf);
+                if (RT_SUCCESS(rc))
+                {
+                    Leaf.uSubLeaf = 1; /* Should've been cache type 2 (code), but buggy code made it data. */
+                    rc = cpumR3CpuIdInsert(NULL /* pVM */, ppaLeaves, pcLeaves, &Leaf);
+                }
+                if (RT_SUCCESS(rc))
+                {
+                    Leaf.uSubLeaf = 2; /* Should've been cache type 3 (unified), but buggy code made it data. */
+                    Leaf.uEcx = 4095;                   /* sets - 1 */
+                    Leaf.uEbx &= UINT32_C(0x003fffff);  /* associativity - 1 */
+                    Leaf.uEbx |= UINT32_C(23) << 22;
+                    Leaf.uEax &= UINT32_C(0xfc003fff);  /* threads per cache - 1 */
+                    Leaf.uEax |= RT_MIN(pVM->cCpus - 1, UINT32_C(0xfff)) << 14;
+                    Leaf.uEax &= UINT32_C(0xffffff1f);  /* level */
+                    Leaf.uEax |= UINT32_C(2) << 5;
+                    rc = cpumR3CpuIdInsert(NULL /* pVM */, ppaLeaves, pcLeaves, &Leaf);
+                }
+            }
+        }
+    }
+    return rc;
+}
+
+
+/**
+ * Loads the CPU ID leaves saved by pass 0, inner worker.
+ *
+ * @returns VBox status code.
+ * @param   pVM                 Pointer to the VM.
+ * @param   pSSM                The saved state handle.
+ * @param   uVersion            The format version.
+ * @param   paLeaves            Guest CPUID leaves loaded from the state.
+ * @param   cLeaves             The number of leaves in @a paLeaves.
+ */
+int cpumR3LoadCpuIdInner(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves)
+{
+    AssertMsgReturn(uVersion >= CPUM_SAVED_STATE_VERSION_VER3_2, ("%u\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+
+    /*
+     * Continue loading the state into stack buffers.
+     */
+    CPUMCPUID   GuestDefCpuId;
+    int rc = SSMR3GetMem(pSSM, &GuestDefCpuId, sizeof(GuestDefCpuId));
+    AssertRCReturn(rc, rc);
+
+    CPUMCPUID   aRawStd[16];
+    uint32_t    cRawStd;
+    rc = SSMR3GetU32(pSSM, &cRawStd); AssertRCReturn(rc, rc);
+    if (cRawStd > RT_ELEMENTS(aRawStd))
+        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
+    rc = SSMR3GetMem(pSSM, &aRawStd[0], cRawStd * sizeof(aRawStd[0]));
+    AssertRCReturn(rc, rc);
+    for (uint32_t i = cRawStd; i < RT_ELEMENTS(aRawStd); i++)
+        ASMCpuIdExSlow(i, 0, 0, 0, &aRawStd[i].uEax, &aRawStd[i].uEbx, &aRawStd[i].uEcx, &aRawStd[i].uEdx);
+
+    CPUMCPUID   aRawExt[32];
+    uint32_t    cRawExt;
+    rc = SSMR3GetU32(pSSM, &cRawExt); AssertRCReturn(rc, rc);
+    if (cRawExt > RT_ELEMENTS(aRawExt))
+        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
+    rc = SSMR3GetMem(pSSM, &aRawExt[0], cRawExt * sizeof(aRawExt[0]));
+    AssertRCReturn(rc, rc);
+    for (uint32_t i = cRawExt; i < RT_ELEMENTS(aRawExt); i++)
+        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0, &aRawExt[i].uEax, &aRawExt[i].uEbx, &aRawExt[i].uEcx, &aRawExt[i].uEdx);
+
+    /*
+     * Get the raw CPU IDs for the current host.
+     */
+    CPUMCPUID   aHostRawStd[16];
+    for (unsigned i = 0; i < RT_ELEMENTS(aHostRawStd); i++)
+        ASMCpuIdExSlow(i, 0, 0, 0, &aHostRawStd[i].uEax, &aHostRawStd[i].uEbx, &aHostRawStd[i].uEcx, &aHostRawStd[i].uEdx);
+
+    CPUMCPUID   aHostRawExt[32];
+    for (unsigned i = 0; i < RT_ELEMENTS(aHostRawExt); i++)
+        ASMCpuIdExSlow(i | UINT32_C(0x80000000), 0, 0, 0,
+                       &aHostRawExt[i].uEax, &aHostRawExt[i].uEbx, &aHostRawExt[i].uEcx, &aHostRawExt[i].uEdx);
+
+    /*
+     * Get the host and guest overrides so we don't reject the state because
+     * some feature was enabled thru these interfaces.
+     * Note! We currently only need the feature leaves, so skip rest.
+     */
+    PCFGMNODE   pOverrideCfg = CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM/HostCPUID");
+    CPUMCPUID   aHostOverrideStd[2];
+    memcpy(&aHostOverrideStd[0], &aHostRawStd[0], sizeof(aHostOverrideStd));
+    cpumR3CpuIdInitLoadOverrideSet(UINT32_C(0x00000000), &aHostOverrideStd[0], RT_ELEMENTS(aHostOverrideStd), pOverrideCfg);
+
+    CPUMCPUID   aHostOverrideExt[2];
+    memcpy(&aHostOverrideExt[0], &aHostRawExt[0], sizeof(aHostOverrideExt));
+    cpumR3CpuIdInitLoadOverrideSet(UINT32_C(0x80000000), &aHostOverrideExt[0], RT_ELEMENTS(aHostOverrideExt), pOverrideCfg);
+
+    /*
+     * This can be skipped.
+     */
+    bool fStrictCpuIdChecks;
+    CFGMR3QueryBoolDef(CFGMR3GetChild(CFGMR3GetRoot(pVM), "CPUM"), "StrictCpuIdChecks", &fStrictCpuIdChecks, true);
+
+    /*
+     * Define a bunch of macros for simplifying the santizing/checking code below.
+     */
+    /* Generic expression + failure message. */
+#define CPUID_CHECK_RET(expr, fmt) \
+    do { \
+        if (!(expr)) \
+        { \
+            char *pszMsg = RTStrAPrintf2 fmt; /* lack of variadic macros sucks */ \
+            if (fStrictCpuIdChecks) \
+            { \
+                int rcCpuid = SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, "%s", pszMsg); \
+                RTStrFree(pszMsg); \
+                return rcCpuid; \
+            } \
+            LogRel(("CPUM: %s\n", pszMsg)); \
+            RTStrFree(pszMsg); \
+        } \
+    } while (0)
+#define CPUID_CHECK_WRN(expr, fmt) \
+    do { \
+        if (!(expr)) \
+            LogRel(fmt); \
+    } while (0)
+
+    /* For comparing two values and bitch if they differs. */
+#define CPUID_CHECK2_RET(what, host, saved) \
+    do { \
+        if ((host) != (saved)) \
+        { \
+            if (fStrictCpuIdChecks) \
+                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
+                                         N_(#what " mismatch: host=%#x saved=%#x"), (host), (saved)); \
+            LogRel(("CPUM: " #what " differs: host=%#x saved=%#x\n", (host), (saved))); \
+        } \
+    } while (0)
+#define CPUID_CHECK2_WRN(what, host, saved) \
+    do { \
+        if ((host) != (saved)) \
+            LogRel(("CPUM: " #what " differs: host=%#x saved=%#x\n", (host), (saved))); \
+    } while (0)
+
+    /* For checking raw cpu features (raw mode). */
+#define CPUID_RAW_FEATURE_RET(set, reg, bit) \
+    do { \
+        if ((aHostRaw##set [1].reg & bit) != (aRaw##set [1].reg & bit)) \
+        { \
+            if (fStrictCpuIdChecks) \
+                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
+                                         N_(#bit " mismatch: host=%d saved=%d"), \
+                                         !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) ); \
+            LogRel(("CPUM: " #bit" differs: host=%d saved=%d\n", \
+                    !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) )); \
+        } \
+    } while (0)
+#define CPUID_RAW_FEATURE_WRN(set, reg, bit) \
+    do { \
+        if ((aHostRaw##set [1].reg & bit) != (aRaw##set [1].reg & bit)) \
+            LogRel(("CPUM: " #bit" differs: host=%d saved=%d\n", \
+                    !!(aHostRaw##set [1].reg & (bit)), !!(aRaw##set [1].reg & (bit)) )); \
+    } while (0)
+#define CPUID_RAW_FEATURE_IGN(set, reg, bit) do { } while (0)
+
+    /* For checking guest features. */
+#define CPUID_GST_FEATURE_RET(set, reg, bit) \
+    do { \
+        if (    (aGuestCpuId##set [1].reg & bit) \
+            && !(aHostRaw##set [1].reg & bit) \
+            && !(aHostOverride##set [1].reg & bit) \
+           ) \
+        { \
+            if (fStrictCpuIdChecks) \
+                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
+                                         N_(#bit " is not supported by the host but has already exposed to the guest")); \
+            LogRel(("CPUM: " #bit " is not supported by the host but has already exposed to the guest\n")); \
+        } \
+    } while (0)
+#define CPUID_GST_FEATURE_WRN(set, reg, bit) \
+    do { \
+        if (    (aGuestCpuId##set [1].reg & bit) \
+            && !(aHostRaw##set [1].reg & bit) \
+            && !(aHostOverride##set [1].reg & bit) \
+           ) \
+            LogRel(("CPUM: " #bit " is not supported by the host but has already exposed to the guest\n")); \
+    } while (0)
+#define CPUID_GST_FEATURE_EMU(set, reg, bit) \
+    do { \
+        if (    (aGuestCpuId##set [1].reg & bit) \
+            && !(aHostRaw##set [1].reg & bit) \
+            && !(aHostOverride##set [1].reg & bit) \
+           ) \
+            LogRel(("CPUM: Warning - " #bit " is not supported by the host but already exposed to the guest. This may impact performance.\n")); \
+    } while (0)
+#define CPUID_GST_FEATURE_IGN(set, reg, bit) do { } while (0)
+
+    /* For checking guest features if AMD guest CPU. */
+#define CPUID_GST_AMD_FEATURE_RET(set, reg, bit) \
+    do { \
+        if (    (aGuestCpuId##set [1].reg & bit) \
+            &&  fGuestAmd \
+            && (!fGuestAmd || !(aHostRaw##set [1].reg & bit)) \
+            && !(aHostOverride##set [1].reg & bit) \
+           ) \
+        { \
+            if (fStrictCpuIdChecks) \
+                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
+                                         N_(#bit " is not supported by the host but has already exposed to the guest")); \
+            LogRel(("CPUM: " #bit " is not supported by the host but has already exposed to the guest\n")); \
+        } \
+    } while (0)
+#define CPUID_GST_AMD_FEATURE_WRN(set, reg, bit) \
+    do { \
+        if (    (aGuestCpuId##set [1].reg & bit) \
+            &&  fGuestAmd \
+            && (!fGuestAmd || !(aHostRaw##set [1].reg & bit)) \
+            && !(aHostOverride##set [1].reg & bit) \
+           ) \
+            LogRel(("CPUM: " #bit " is not supported by the host but has already exposed to the guest\n")); \
+    } while (0)
+#define CPUID_GST_AMD_FEATURE_EMU(set, reg, bit) \
+    do { \
+        if (    (aGuestCpuId##set [1].reg & bit) \
+            &&  fGuestAmd \
+            && (!fGuestAmd || !(aHostRaw##set [1].reg & bit)) \
+            && !(aHostOverride##set [1].reg & bit) \
+           ) \
+            LogRel(("CPUM: Warning - " #bit " is not supported by the host but already exposed to the guest. This may impact performance.\n")); \
+    } while (0)
+#define CPUID_GST_AMD_FEATURE_IGN(set, reg, bit) do { } while (0)
+
+    /* For checking AMD features which have a corresponding bit in the standard
+       range.  (Intel defines very few bits in the extended feature sets.) */
+#define CPUID_GST_FEATURE2_RET(reg, ExtBit, StdBit) \
+    do { \
+        if (    (aGuestCpuIdExt [1].reg    & (ExtBit)) \
+            && !(fHostAmd  \
+                 ? aHostRawExt[1].reg      & (ExtBit) \
+                 : aHostRawStd[1].reg      & (StdBit)) \
+            && !(aHostOverrideExt[1].reg   & (ExtBit)) \
+           ) \
+        { \
+            if (fStrictCpuIdChecks) \
+                return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS, \
+                                         N_(#ExtBit " is not supported by the host but has already exposed to the guest")); \
+            LogRel(("CPUM: " #ExtBit " is not supported by the host but has already exposed to the guest\n")); \
+        } \
+    } while (0)
+#define CPUID_GST_FEATURE2_WRN(reg, ExtBit, StdBit) \
+    do { \
+        if (    (aGuestCpuId[1].reg        & (ExtBit)) \
+            && !(fHostAmd  \
+                 ? aHostRawExt[1].reg      & (ExtBit) \
+                 : aHostRawStd[1].reg      & (StdBit)) \
+            && !(aHostOverrideExt[1].reg   & (ExtBit)) \
+           ) \
+            LogRel(("CPUM: " #ExtBit " is not supported by the host but has already exposed to the guest\n")); \
+    } while (0)
+#define CPUID_GST_FEATURE2_EMU(reg, ExtBit, StdBit) \
+    do { \
+        if (    (aGuestCpuIdExt [1].reg    & (ExtBit)) \
+            && !(fHostAmd  \
+                 ? aHostRawExt[1].reg      & (ExtBit) \
+                 : aHostRawStd[1].reg      & (StdBit)) \
+            && !(aHostOverrideExt[1].reg   & (ExtBit)) \
+           ) \
+            LogRel(("CPUM: Warning - " #ExtBit " is not supported by the host but already exposed to the guest. This may impact performance.\n")); \
+    } while (0)
+#define CPUID_GST_FEATURE2_IGN(reg, ExtBit, StdBit) do { } while (0)
+
+    /*
+     * For raw-mode we'll require that the CPUs are very similar since we don't
+     * intercept CPUID instructions for user mode applications.
+     */
+    if (!HMIsEnabled(pVM))
+    {
+        /* CPUID(0) */
+        CPUID_CHECK_RET(   aHostRawStd[0].uEbx == aRawStd[0].uEbx
+                        && aHostRawStd[0].uEcx == aRawStd[0].uEcx
+                        && aHostRawStd[0].uEdx == aRawStd[0].uEdx,
+                        (N_("CPU vendor mismatch: host='%.4s%.4s%.4s' saved='%.4s%.4s%.4s'"),
+                         &aHostRawStd[0].uEbx, &aHostRawStd[0].uEdx, &aHostRawStd[0].uEcx,
+                         &aRawStd[0].uEbx, &aRawStd[0].uEdx, &aRawStd[0].uEcx));
+        CPUID_CHECK2_WRN("Std CPUID max leaf",   aHostRawStd[0].uEax, aRawStd[0].uEax);
+        CPUID_CHECK2_WRN("Reserved bits 15:14", (aHostRawExt[1].uEax >> 14) & 3, (aRawExt[1].uEax >> 14) & 3);
+        CPUID_CHECK2_WRN("Reserved bits 31:28",  aHostRawExt[1].uEax >> 28,       aRawExt[1].uEax >> 28);
+
+        bool const fIntel = ASMIsIntelCpuEx(aRawStd[0].uEbx, aRawStd[0].uEcx, aRawStd[0].uEdx);
+
+        /* CPUID(1).eax */
+        CPUID_CHECK2_RET("CPU family",          ASMGetCpuFamily(aHostRawStd[1].uEax),        ASMGetCpuFamily(aRawStd[1].uEax));
+        CPUID_CHECK2_RET("CPU model",           ASMGetCpuModel(aHostRawStd[1].uEax, fIntel), ASMGetCpuModel(aRawStd[1].uEax, fIntel));
+        CPUID_CHECK2_WRN("CPU type",            (aHostRawStd[1].uEax >> 12) & 3,             (aRawStd[1].uEax >> 12) & 3 );
+
+        /* CPUID(1).ebx - completely ignore CPU count and APIC ID. */
+        CPUID_CHECK2_RET("CPU brand ID",         aHostRawStd[1].uEbx & 0xff,                 aRawStd[1].uEbx & 0xff);
+        CPUID_CHECK2_WRN("CLFLUSH chunk count", (aHostRawStd[1].uEbx >> 8) & 0xff,           (aRawStd[1].uEbx >> 8) & 0xff);
+
+        /* CPUID(1).ecx */
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SSE3);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_PCLMUL);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_DTES64);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_MONITOR);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_CPLDS);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_VMX);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_SMX);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_EST);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_TM2);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SSSE3);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_CNTXID);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, RT_BIT_32(11) /*reserved*/ );
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_FMA);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_CX16);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_TPRUPDATE);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_PDCM);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, RT_BIT_32(16) /*reserved*/);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_PCID);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_DCA);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SSE4_1);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SSE4_2);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_X2APIC);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_MOVBE);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_POPCNT);
+        CPUID_RAW_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_TSCDEADL);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_AES);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_XSAVE);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_OSXSAVE);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_AVX);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_F16C);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_RDRAND);
+        CPUID_RAW_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_HVP);
+
+        /* CPUID(1).edx */
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_FPU);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_VME);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_DE);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PSE);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_TSC);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_MSR);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PAE);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_MCE);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_CX8);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_APIC);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, RT_BIT_32(10) /*reserved*/);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_SEP);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_MTRR);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PGE);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_MCA);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_CMOV);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PAT);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PSE36);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PSN);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_CLFSH);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, RT_BIT_32(20) /*reserved*/);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_DS);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_ACPI);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_MMX);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_FXSR);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_SSE);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_SSE2);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_SS);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_HTT);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_TM);
+        CPUID_RAW_FEATURE_RET(Std, uEdx, RT_BIT_32(30) /*JMPE/IA64*/);
+        CPUID_RAW_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PBE);
+
+        /* CPUID(2) - config, mostly about caches. ignore. */
+        /* CPUID(3) - processor serial number. ignore. */
+        /* CPUID(4) - config, cache and topology - takes ECX as input. ignore. */
+        /* CPUID(5) - mwait/monitor config. ignore. */
+        /* CPUID(6) - power management. ignore. */
+        /* CPUID(7) - ???. ignore. */
+        /* CPUID(8) - ???. ignore. */
+        /* CPUID(9) - DCA. ignore for now. */
+        /* CPUID(a) - PeMo info. ignore for now. */
+        /* CPUID(b) - topology info - takes ECX as input. ignore. */
+
+        /* CPUID(d) - XCR0 stuff - takes ECX as input. We only warn about the main level (ECX=0) for now. */
+        CPUID_CHECK_WRN(   aRawStd[0].uEax     <  UINT32_C(0x0000000d)
+                        || aHostRawStd[0].uEax >= UINT32_C(0x0000000d),
+                        ("CPUM: Standard leaf D was present on saved state host, not present on current.\n"));
+        if (   aRawStd[0].uEax     >= UINT32_C(0x0000000d)
+            && aHostRawStd[0].uEax >= UINT32_C(0x0000000d))
+        {
+            CPUID_CHECK2_WRN("Valid low XCR0 bits",             aHostRawStd[0xd].uEax, aRawStd[0xd].uEax);
+            CPUID_CHECK2_WRN("Valid high XCR0 bits",            aHostRawStd[0xd].uEdx, aRawStd[0xd].uEdx);
+            CPUID_CHECK2_WRN("Current XSAVE/XRSTOR area size",  aHostRawStd[0xd].uEbx, aRawStd[0xd].uEbx);
+/** @todo XSAVE: Stricter XSAVE feature checks for raw-mode. */
+            CPUID_CHECK2_WRN("Max XSAVE/XRSTOR area size",      aHostRawStd[0xd].uEcx, aRawStd[0xd].uEcx);
+        }
+
+        /* CPUID(0x80000000) - same as CPUID(0) except for eax.
+           Note! Intel have/is marking many of the fields here as reserved. We
+                 will verify them as if it's an AMD CPU. */
+        CPUID_CHECK_RET(   (aHostRawExt[0].uEax >= UINT32_C(0x80000001) && aHostRawExt[0].uEax <= UINT32_C(0x8000007f))
+                        || !(aRawExt[0].uEax    >= UINT32_C(0x80000001) && aRawExt[0].uEax     <= UINT32_C(0x8000007f)),
+                        (N_("Extended leaves was present on saved state host, but is missing on the current\n")));
+        if (aRawExt[0].uEax >= UINT32_C(0x80000001) && aRawExt[0].uEax     <= UINT32_C(0x8000007f))
+        {
+            CPUID_CHECK_RET(   aHostRawExt[0].uEbx == aRawExt[0].uEbx
+                            && aHostRawExt[0].uEcx == aRawExt[0].uEcx
+                            && aHostRawExt[0].uEdx == aRawExt[0].uEdx,
+                            (N_("CPU vendor mismatch: host='%.4s%.4s%.4s' saved='%.4s%.4s%.4s'"),
+                             &aHostRawExt[0].uEbx, &aHostRawExt[0].uEdx, &aHostRawExt[0].uEcx,
+                             &aRawExt[0].uEbx,     &aRawExt[0].uEdx,     &aRawExt[0].uEcx));
+            CPUID_CHECK2_WRN("Ext CPUID max leaf",   aHostRawExt[0].uEax, aRawExt[0].uEax);
+
+            /* CPUID(0x80000001).eax - same as CPUID(0).eax. */
+            CPUID_CHECK2_RET("CPU family",          ASMGetCpuFamily(aHostRawExt[1].uEax),        ASMGetCpuFamily(aRawExt[1].uEax));
+            CPUID_CHECK2_RET("CPU model",           ASMGetCpuModel(aHostRawExt[1].uEax, fIntel), ASMGetCpuModel(aRawExt[1].uEax, fIntel));
+            CPUID_CHECK2_WRN("CPU type",            (aHostRawExt[1].uEax >> 12) & 3, (aRawExt[1].uEax >> 12) & 3 );
+            CPUID_CHECK2_WRN("Reserved bits 15:14", (aHostRawExt[1].uEax >> 14) & 3, (aRawExt[1].uEax >> 14) & 3 );
+            CPUID_CHECK2_WRN("Reserved bits 31:28",  aHostRawExt[1].uEax >> 28, aRawExt[1].uEax >> 28);
+
+            /* CPUID(0x80000001).ebx - Brand ID (maybe), just warn if things differs. */
+            CPUID_CHECK2_WRN("CPU BrandID",          aHostRawExt[1].uEbx & 0xffff, aRawExt[1].uEbx & 0xffff);
+            CPUID_CHECK2_WRN("Reserved bits 16:27", (aHostRawExt[1].uEbx >> 16) & 0xfff, (aRawExt[1].uEbx >> 16) & 0xfff);
+            CPUID_CHECK2_WRN("PkgType",             (aHostRawExt[1].uEbx >> 28) &   0xf, (aRawExt[1].uEbx >> 28) &   0xf);
+
+            /* CPUID(0x80000001).ecx */
+            CPUID_RAW_FEATURE_IGN(Ext, uEcx, X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF);
+            CPUID_RAW_FEATURE_IGN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_CMPL);
+            CPUID_RAW_FEATURE_IGN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_SVM);
+            CPUID_RAW_FEATURE_IGN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_EXT_APIC);
+            CPUID_RAW_FEATURE_IGN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_CR8L);
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_ABM);
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_SSE4A);
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_MISALNSSE);
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF);
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_OSVW);
+            CPUID_RAW_FEATURE_IGN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_IBS);
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_XOP);
+            CPUID_RAW_FEATURE_IGN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_SKINIT);
+            CPUID_RAW_FEATURE_IGN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_WDT);
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(14));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(15));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(16));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(17));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(18));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(19));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(20));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(21));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(22));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(23));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(24));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(25));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(26));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(27));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(28));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(29));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(30));
+            CPUID_RAW_FEATURE_WRN(Ext, uEcx, RT_BIT_32(31));
+
+            /* CPUID(0x80000001).edx */
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_FPU);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_VME);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_DE);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_PSE);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_TSC);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_MSR);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_PAE);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_MCE);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_CX8);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_APIC);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, RT_BIT_32(10) /*reserved*/);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_SEP);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_MTRR);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_PGE);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_MCA);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_CMOV);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_PAT);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_PSE36);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, RT_BIT_32(18) /*reserved*/);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, RT_BIT_32(19) /*reserved*/);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_NX);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, RT_BIT_32(21) /*reserved*/);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_AXMMX);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_MMX);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_FXSR);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_FFXSR);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_PAGE1GB);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_RDTSCP);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, RT_BIT_32(28) /*reserved*/);
+            CPUID_RAW_FEATURE_IGN(Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_LONG_MODE);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX);
+            CPUID_RAW_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_3DNOW);
+
+            /** @todo verify the rest as well. */
+        }
+    }
+
+
+
+    /*
+     * Verify that we can support the features already exposed to the guest on
+     * this host.
+     *
+     * Most of the features we're emulating requires intercepting instruction
+     * and doing it the slow way, so there is no need to warn when they aren't
+     * present in the host CPU.  Thus we use IGN instead of EMU on these.
+     *
+     * Trailing comments:
+     *      "EMU"  - Possible to emulate, could be lots of work and very slow.
+     *      "EMU?" - Can this be emulated?
+     */
+    CPUMCPUID aGuestCpuIdStd[2];
+    RT_ZERO(aGuestCpuIdStd);
+    cpumR3CpuIdGetLeafLegacy(paLeaves, cLeaves, 1, 0, &aGuestCpuIdStd[1]);
+
+    /* CPUID(1).ecx */
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SSE3);    // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_PCLMUL);  // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_DTES64);  // -> EMU?
+    CPUID_GST_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_MONITOR);
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_CPLDS);   // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_VMX);     // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SMX);     // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_EST);     // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_TM2);     // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SSSE3);   // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_CNTXID);  // -> EMU
+    CPUID_GST_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_SDBG);
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_FMA);     // -> EMU? what's this?
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_CX16);    // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_TPRUPDATE);//-> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_PDCM);    // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, RT_BIT_32(16) /*reserved*/);
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_PCID);
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_DCA);     // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SSE4_1);  // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_SSE4_2);  // -> EMU
+    CPUID_GST_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_X2APIC);
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_MOVBE);   // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_POPCNT);  // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_TSCDEADL);
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_AES);     // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_XSAVE);   // -> EMU
+    CPUID_GST_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_OSXSAVE);
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_AVX);     // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_F16C);
+    CPUID_GST_FEATURE_RET(Std, uEcx, X86_CPUID_FEATURE_ECX_RDRAND);
+    CPUID_GST_FEATURE_IGN(Std, uEcx, X86_CPUID_FEATURE_ECX_HVP);     // Normally not set by host
+
+    /* CPUID(1).edx */
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_FPU);
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_VME);
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_DE);      // -> EMU?
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PSE);
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_TSC);     // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_MSR);     // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_PAE);
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_MCE);
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_CX8);     // -> EMU?
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_APIC);
+    CPUID_GST_FEATURE_RET(Std, uEdx, RT_BIT_32(10) /*reserved*/);
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_SEP);
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_MTRR);
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PGE);
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_MCA);
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_CMOV);    // -> EMU
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PAT);
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PSE36);
+    CPUID_GST_FEATURE_IGN(Std, uEdx, X86_CPUID_FEATURE_EDX_PSN);
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_CLFSH);   // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEdx, RT_BIT_32(20) /*reserved*/);
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_DS);      // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_ACPI);    // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_MMX);     // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_FXSR);    // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_SSE);     // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_SSE2);    // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_SS);      // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_HTT);     // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_TM);      // -> EMU?
+    CPUID_GST_FEATURE_RET(Std, uEdx, RT_BIT_32(30) /*JMPE/IA64*/);   // -> EMU
+    CPUID_GST_FEATURE_RET(Std, uEdx, X86_CPUID_FEATURE_EDX_PBE);     // -> EMU?
+
+    /* CPUID(0x80000000). */
+    CPUMCPUID aGuestCpuIdExt[2];
+    RT_ZERO(aGuestCpuIdExt);
+    if (cpumR3CpuIdGetLeafLegacy(paLeaves, cLeaves, UINT32_C(0x80000001), 0, &aGuestCpuIdExt[1]))
+    {
+        /** @todo deal with no 0x80000001 on the host. */
+        bool const fHostAmd  = ASMIsAmdCpuEx(aHostRawStd[0].uEbx, aHostRawStd[0].uEcx, aHostRawStd[0].uEdx);
+        bool const fGuestAmd = ASMIsAmdCpuEx(aGuestCpuIdExt[0].uEbx, aGuestCpuIdExt[0].uEcx, aGuestCpuIdExt[0].uEdx);
+
+        /* CPUID(0x80000001).ecx */
+        CPUID_GST_FEATURE_WRN(Ext, uEcx, X86_CPUID_EXT_FEATURE_ECX_LAHF_SAHF);   // -> EMU
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_CMPL);    // -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_SVM);     // -> EMU
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_EXT_APIC);// ???
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_CR8L);    // -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_ABM);     // -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_SSE4A);   // -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_MISALNSSE);//-> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_3DNOWPRF);// -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_OSVW);    // -> EMU?
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_IBS);     // -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_XOP);     // -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_SKINIT);  // -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEcx, X86_CPUID_AMD_FEATURE_ECX_WDT);     // -> EMU
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(14));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(15));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(16));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(17));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(18));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(19));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(20));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(21));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(22));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(23));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(24));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(25));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(26));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(27));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(28));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(29));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(30));
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEcx, RT_BIT_32(31));
+
+        /* CPUID(0x80000001).edx */
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_FPU,   X86_CPUID_FEATURE_EDX_FPU);     // -> EMU
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_VME,   X86_CPUID_FEATURE_EDX_VME);     // -> EMU
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_DE,    X86_CPUID_FEATURE_EDX_DE);      // -> EMU
+        CPUID_GST_FEATURE2_IGN(        uEdx, X86_CPUID_AMD_FEATURE_EDX_PSE,   X86_CPUID_FEATURE_EDX_PSE);
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_TSC,   X86_CPUID_FEATURE_EDX_TSC);     // -> EMU
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_MSR,   X86_CPUID_FEATURE_EDX_MSR);     // -> EMU
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_PAE,   X86_CPUID_FEATURE_EDX_PAE);
+        CPUID_GST_FEATURE2_IGN(        uEdx, X86_CPUID_AMD_FEATURE_EDX_MCE,   X86_CPUID_FEATURE_EDX_MCE);
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_CX8,   X86_CPUID_FEATURE_EDX_CX8);     // -> EMU?
+        CPUID_GST_FEATURE2_IGN(        uEdx, X86_CPUID_AMD_FEATURE_EDX_APIC,  X86_CPUID_FEATURE_EDX_APIC);
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEdx, RT_BIT_32(10) /*reserved*/);
+        CPUID_GST_FEATURE_IGN(    Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_SYSCALL);                              // On Intel: long mode only.
+        CPUID_GST_FEATURE2_IGN(        uEdx, X86_CPUID_AMD_FEATURE_EDX_MTRR,  X86_CPUID_FEATURE_EDX_MTRR);
+        CPUID_GST_FEATURE2_IGN(        uEdx, X86_CPUID_AMD_FEATURE_EDX_PGE,   X86_CPUID_FEATURE_EDX_PGE);
+        CPUID_GST_FEATURE2_IGN(        uEdx, X86_CPUID_AMD_FEATURE_EDX_MCA,   X86_CPUID_FEATURE_EDX_MCA);
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_CMOV,  X86_CPUID_FEATURE_EDX_CMOV);    // -> EMU
+        CPUID_GST_FEATURE2_IGN(        uEdx, X86_CPUID_AMD_FEATURE_EDX_PAT,   X86_CPUID_FEATURE_EDX_PAT);
+        CPUID_GST_FEATURE2_IGN(        uEdx, X86_CPUID_AMD_FEATURE_EDX_PSE36, X86_CPUID_FEATURE_EDX_PSE36);
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEdx, RT_BIT_32(18) /*reserved*/);
+        CPUID_GST_AMD_FEATURE_WRN(Ext, uEdx, RT_BIT_32(19) /*reserved*/);
+        CPUID_GST_FEATURE_RET(    Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_NX);
+        CPUID_GST_FEATURE_WRN(    Ext, uEdx, RT_BIT_32(21) /*reserved*/);
+        CPUID_GST_FEATURE_RET(    Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_AXMMX);
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_MMX,   X86_CPUID_FEATURE_EDX_MMX);     // -> EMU
+        CPUID_GST_FEATURE2_RET(        uEdx, X86_CPUID_AMD_FEATURE_EDX_FXSR,  X86_CPUID_FEATURE_EDX_FXSR);    // -> EMU
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_FFXSR);
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_PAGE1GB);
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_RDTSCP);
+        CPUID_GST_FEATURE_IGN(    Ext, uEdx, RT_BIT_32(28) /*reserved*/);
+        CPUID_GST_FEATURE_RET(    Ext, uEdx, X86_CPUID_EXT_FEATURE_EDX_LONG_MODE);
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_3DNOW_EX);
+        CPUID_GST_AMD_FEATURE_RET(Ext, uEdx, X86_CPUID_AMD_FEATURE_EDX_3DNOW);
+    }
+
+    /** @todo check leaf 7   */
+
+    /* CPUID(d) - XCR0 stuff - takes ECX as input.
+     * ECX=0:   EAX - Valid bits in XCR0[31:0].
+     *          EBX - Maximum state size as per current XCR0 value.
+     *          ECX - Maximum state size for all supported features.
+     *          EDX - Valid bits in XCR0[63:32].
+     * ECX=1:   EAX - Various X-features.
+     *          EBX - Maximum state size as per current XCR0|IA32_XSS value.
+     *          ECX - Valid bits in IA32_XSS[31:0].
+     *          EDX - Valid bits in IA32_XSS[63:32].
+     * ECX=N, where N in 2..63 and indicates a bit in XCR0 and/or IA32_XSS,
+     *        if the bit invalid all four registers are set to zero.
+     *          EAX - The state size for this feature.
+     *          EBX - The state byte offset of this feature.
+     *          ECX - Bit 0 indicates whether this sub-leaf maps to a valid IA32_XSS bit (=1) or a valid XCR0 bit (=0).
+     *          EDX - Reserved, but is set to zero if invalid sub-leaf index.
+     */
+    uint64_t fGuestXcr0Mask = 0;
+    PCPUMCPUIDLEAF pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x0000000d), 0);
+    if (   pCurLeaf
+        && (aGuestCpuIdStd[1].uEcx & X86_CPUID_FEATURE_ECX_XSAVE)
+        && (   pCurLeaf->uEax
+            || pCurLeaf->uEbx
+            || pCurLeaf->uEcx
+            || pCurLeaf->uEdx) )
+    {
+        fGuestXcr0Mask = RT_MAKE_U64(pCurLeaf->uEax, pCurLeaf->uEdx);
+        if (fGuestXcr0Mask & ~pVM->cpum.s.fXStateHostMask)
+            return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS,
+                                     N_("CPUID(0xd/0).EDX:EAX mismatch: %#llx saved, %#llx supported by the current host (XCR0 bits)"),
+                                     fGuestXcr0Mask, pVM->cpum.s.fXStateHostMask);
+        if ((fGuestXcr0Mask & (XSAVE_C_X87 | XSAVE_C_SSE)) != (XSAVE_C_X87 | XSAVE_C_SSE))
+            return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS,
+                                     N_("CPUID(0xd/0).EDX:EAX missing mandatory X87 or SSE bits: %#RX64"), fGuestXcr0Mask);
+
+        /* We don't support any additional features yet. */
+        pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x0000000d), 1);
+        if (pCurLeaf && pCurLeaf->uEax)
+            return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS,
+                                     N_("CPUID(0xd/1).EAX=%#x, expected zero"), pCurLeaf->uEax);
+        if (pCurLeaf && (pCurLeaf->uEcx || pCurLeaf->uEdx))
+            return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS,
+                                     N_("CPUID(0xd/1).EDX:ECX=%#llx, expected zero"),
+                                     RT_MAKE_U64(pCurLeaf->uEdx, pCurLeaf->uEcx));
+
+
+        for (uint32_t uSubLeaf = 2; uSubLeaf < 64; uSubLeaf++)
+        {
+            pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x0000000d), uSubLeaf);
+            if (pCurLeaf)
+            {
+                /* If advertised, the state component offset and size must match the one used by host. */
+                if (pCurLeaf->uEax || pCurLeaf->uEbx || pCurLeaf->uEcx || pCurLeaf->uEdx)
+                {
+                    CPUMCPUID RawHost;
+                    ASMCpuIdExSlow(UINT32_C(0x0000000d), 0, uSubLeaf, 0,
+                                   &RawHost.uEax, &RawHost.uEbx, &RawHost.uEcx, &RawHost.uEdx);
+                    if (   RawHost.uEbx != pCurLeaf->uEbx
+                        || RawHost.uEax != pCurLeaf->uEax)
+                        return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS,
+                                                 N_("CPUID(0xd/%#x).EBX/EAX=%#x/%#x, current host uses %#x/%#x (offset/size)"),
+                                                 uSubLeaf, pCurLeaf->uEbx, pCurLeaf->uEax, RawHost.uEbx, RawHost.uEax);
+                }
+            }
+        }
+    }
+    /* Clear leaf 0xd just in case we're loading an old state... */
+    else if (pCurLeaf)
+    {
+        AssertLogRel(uVersion <= CPUM_SAVED_STATE_VERSION_PUT_STRUCT);
+        for (uint32_t uSubLeaf = 0; uSubLeaf < 64; uSubLeaf++)
+        {
+            pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x0000000d), uSubLeaf);
+            if (pCurLeaf)
+                pCurLeaf->uEax = pCurLeaf->uEbx = pCurLeaf->uEcx = pCurLeaf->uEdx = 0;
+        }
+    }
+
+    /* Update the fXStateGuestMask value for the VM. */
+    if (pVM->cpum.s.fXStateGuestMask != fGuestXcr0Mask)
+    {
+        LogRel(("CPUM: fXStateGuestMask=%#llx -> %#llx\n", pVM->cpum.s.fXStateGuestMask, fGuestXcr0Mask));
+        pVM->cpum.s.fXStateGuestMask = fGuestXcr0Mask;
+        if (!fGuestXcr0Mask && (aGuestCpuIdStd[1].uEcx & X86_CPUID_FEATURE_ECX_XSAVE))
+            return SSMR3SetLoadError(pSSM, VERR_SSM_LOAD_CPUID_MISMATCH, RT_SRC_POS,
+                                     N_("Internal Processing Error: XSAVE feature bit enabled, but leaf 0xd is empty."));
+    }
+
+#undef CPUID_CHECK_RET
+#undef CPUID_CHECK_WRN
+#undef CPUID_CHECK2_RET
+#undef CPUID_CHECK2_WRN
+#undef CPUID_RAW_FEATURE_RET
+#undef CPUID_RAW_FEATURE_WRN
+#undef CPUID_RAW_FEATURE_IGN
+#undef CPUID_GST_FEATURE_RET
+#undef CPUID_GST_FEATURE_WRN
+#undef CPUID_GST_FEATURE_EMU
+#undef CPUID_GST_FEATURE_IGN
+#undef CPUID_GST_FEATURE2_RET
+#undef CPUID_GST_FEATURE2_WRN
+#undef CPUID_GST_FEATURE2_EMU
+#undef CPUID_GST_FEATURE2_IGN
+#undef CPUID_GST_AMD_FEATURE_RET
+#undef CPUID_GST_AMD_FEATURE_WRN
+#undef CPUID_GST_AMD_FEATURE_EMU
+#undef CPUID_GST_AMD_FEATURE_IGN
+
+    /*
+     * We're good, commit the CPU ID leaves.
+     */
+    MMHyperFree(pVM, pVM->cpum.s.GuestInfo.paCpuIdLeavesR3);
+    pVM->cpum.s.GuestInfo.paCpuIdLeavesR3 = NULL;
+    pVM->cpum.s.GuestInfo.paCpuIdLeavesR0 = NIL_RTR0PTR;
+    pVM->cpum.s.GuestInfo.paCpuIdLeavesRC = NIL_RTRCPTR;
+    pVM->cpum.s.GuestInfo.DefCpuId = GuestDefCpuId;
+    rc = cpumR3CpuIdInstallAndExplodeLeaves(pVM, &pVM->cpum.s, paLeaves, cLeaves);
+    AssertLogRelRCReturn(rc, rc);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Loads the CPU ID leaves saved by pass 0.
+ *
+ * @returns VBox status code.
+ * @param   pVM                 Pointer to the VM.
+ * @param   pSSM                The saved state handle.
+ * @param   uVersion            The format version.
+ */
+int cpumR3LoadCpuId(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion)
+{
+    AssertMsgReturn(uVersion >= CPUM_SAVED_STATE_VERSION_VER3_2, ("%u\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+
+    /*
+     * Load the CPUID leaves array first and call worker to do the rest, just so
+     * we can free the memory when we need to without ending up in column 1000.
+     */
+    PCPUMCPUIDLEAF paLeaves;
+    uint32_t       cLeaves;
+    int rc = cpumR3LoadGuestCpuIdArray(pVM, pSSM, uVersion, &paLeaves, &cLeaves);
+    AssertRC(rc);
+    if (RT_SUCCESS(rc))
+    {
+        rc = cpumR3LoadCpuIdInner(pVM, pSSM, uVersion, paLeaves, cLeaves);
+        RTMemFree(paLeaves);
+    }
+    return rc;
+}
+
+
+
+/**
+ * Loads the CPU ID leaves saved by pass 0 in an pre 3.2 saved state.
+ *
+ * @returns VBox status code.
+ * @param   pVM                 Pointer to the VM.
+ * @param   pSSM                The saved state handle.
+ * @param   uVersion            The format version.
+ */
+int cpumR3LoadCpuIdPre32(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion)
+{
+    AssertMsgReturn(uVersion < CPUM_SAVED_STATE_VERSION_VER3_2, ("%u\n", uVersion), VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION);
+
+    /*
+     * Restore the CPUID leaves.
+     *
+     * Note that we support restoring less than the current amount of standard
+     * leaves because we've been allowed more is newer version of VBox.
+     */
+    uint32_t cElements;
+    int rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
+    if (cElements > RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmStd))
+        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
+    SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdPatmStd[0], cElements*sizeof(pVM->cpum.s.aGuestCpuIdPatmStd[0]));
+
+    rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
+    if (cElements != RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmExt))
+        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
+    SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdPatmExt[0], sizeof(pVM->cpum.s.aGuestCpuIdPatmExt));
+
+    rc = SSMR3GetU32(pSSM, &cElements); AssertRCReturn(rc, rc);
+    if (cElements != RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmCentaur))
+        return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
+    SSMR3GetMem(pSSM, &pVM->cpum.s.aGuestCpuIdPatmCentaur[0], sizeof(pVM->cpum.s.aGuestCpuIdPatmCentaur));
+
+    SSMR3GetMem(pSSM, &pVM->cpum.s.GuestInfo.DefCpuId, sizeof(pVM->cpum.s.GuestInfo.DefCpuId));
+
+    /*
+     * Check that the basic cpuid id information is unchanged.
+     */
+    /** @todo we should check the 64 bits capabilities too! */
+    uint32_t au32CpuId[8] = {0,0,0,0, 0,0,0,0};
+    ASMCpuIdExSlow(0, 0, 0, 0, &au32CpuId[0], &au32CpuId[1], &au32CpuId[2], &au32CpuId[3]);
+    ASMCpuIdExSlow(1, 0, 0, 0, &au32CpuId[4], &au32CpuId[5], &au32CpuId[6], &au32CpuId[7]);
+    uint32_t au32CpuIdSaved[8];
+    rc = SSMR3GetMem(pSSM, &au32CpuIdSaved[0], sizeof(au32CpuIdSaved));
+    if (RT_SUCCESS(rc))
+    {
+        /* Ignore CPU stepping. */
+        au32CpuId[4]      &=  0xfffffff0;
+        au32CpuIdSaved[4] &=  0xfffffff0;
+
+        /* Ignore APIC ID (AMD specs). */
+        au32CpuId[5]      &= ~0xff000000;
+        au32CpuIdSaved[5] &= ~0xff000000;
+
+        /* Ignore the number of Logical CPUs (AMD specs). */
+        au32CpuId[5]      &= ~0x00ff0000;
+        au32CpuIdSaved[5] &= ~0x00ff0000;
+
+        /* Ignore some advanced capability bits, that we don't expose to the guest. */
+        au32CpuId[6]      &= ~(   X86_CPUID_FEATURE_ECX_DTES64
+                               |  X86_CPUID_FEATURE_ECX_VMX
+                               |  X86_CPUID_FEATURE_ECX_SMX
+                               |  X86_CPUID_FEATURE_ECX_EST
+                               |  X86_CPUID_FEATURE_ECX_TM2
+                               |  X86_CPUID_FEATURE_ECX_CNTXID
+                               |  X86_CPUID_FEATURE_ECX_TPRUPDATE
+                               |  X86_CPUID_FEATURE_ECX_PDCM
+                               |  X86_CPUID_FEATURE_ECX_DCA
+                               |  X86_CPUID_FEATURE_ECX_X2APIC
+                              );
+        au32CpuIdSaved[6] &= ~(   X86_CPUID_FEATURE_ECX_DTES64
+                               |  X86_CPUID_FEATURE_ECX_VMX
+                               |  X86_CPUID_FEATURE_ECX_SMX
+                               |  X86_CPUID_FEATURE_ECX_EST
+                               |  X86_CPUID_FEATURE_ECX_TM2
+                               |  X86_CPUID_FEATURE_ECX_CNTXID
+                               |  X86_CPUID_FEATURE_ECX_TPRUPDATE
+                               |  X86_CPUID_FEATURE_ECX_PDCM
+                               |  X86_CPUID_FEATURE_ECX_DCA
+                               |  X86_CPUID_FEATURE_ECX_X2APIC
+                              );
+
+        /* Make sure we don't forget to update the masks when enabling
+         * features in the future.
+         */
+        AssertRelease(!(pVM->cpum.s.aGuestCpuIdPatmStd[1].uEcx &
+                              (   X86_CPUID_FEATURE_ECX_DTES64
+                               |  X86_CPUID_FEATURE_ECX_VMX
+                               |  X86_CPUID_FEATURE_ECX_SMX
+                               |  X86_CPUID_FEATURE_ECX_EST
+                               |  X86_CPUID_FEATURE_ECX_TM2
+                               |  X86_CPUID_FEATURE_ECX_CNTXID
+                               |  X86_CPUID_FEATURE_ECX_TPRUPDATE
+                               |  X86_CPUID_FEATURE_ECX_PDCM
+                               |  X86_CPUID_FEATURE_ECX_DCA
+                               |  X86_CPUID_FEATURE_ECX_X2APIC
+                              )));
+        /* do the compare */
+        if (memcmp(au32CpuIdSaved, au32CpuId, sizeof(au32CpuIdSaved)))
+        {
+            if (SSMR3HandleGetAfter(pSSM) == SSMAFTER_DEBUG_IT)
+                LogRel(("cpumR3LoadExec: CpuId mismatch! (ignored due to SSMAFTER_DEBUG_IT)\n"
+                        "Saved=%.*Rhxs\n"
+                        "Real =%.*Rhxs\n",
+                        sizeof(au32CpuIdSaved), au32CpuIdSaved,
+                        sizeof(au32CpuId), au32CpuId));
+            else
+            {
+                LogRel(("cpumR3LoadExec: CpuId mismatch!\n"
+                        "Saved=%.*Rhxs\n"
+                        "Real =%.*Rhxs\n",
+                        sizeof(au32CpuIdSaved), au32CpuIdSaved,
+                        sizeof(au32CpuId), au32CpuId));
+                rc = VERR_SSM_LOAD_CPUID_MISMATCH;
+            }
+        }
+    }
+
+    return rc;
+}
+
+
+
+/*
+ *
+ *
+ * CPUID Info Handler.
+ * CPUID Info Handler.
+ * CPUID Info Handler.
+ *
+ *
+ */
+
+
+
+/**
+ * Get L1 cache / TLS associativity.
+ */
+static const char *getCacheAss(unsigned u, char *pszBuf)
+{
+    if (u == 0)
+        return "res0  ";
+    if (u == 1)
+        return "direct";
+    if (u == 255)
+        return "fully";
+    if (u >= 256)
+        return "???";
+
+    RTStrPrintf(pszBuf, 16, "%d way", u);
+    return pszBuf;
+}
+
+
+/**
+ * Get L2 cache associativity.
+ */
+const char *getL2CacheAss(unsigned u)
+{
+    switch (u)
+    {
+        case 0:  return "off   ";
+        case 1:  return "direct";
+        case 2:  return "2 way ";
+        case 3:  return "res3  ";
+        case 4:  return "4 way ";
+        case 5:  return "res5  ";
+        case 6:  return "8 way ";
+        case 7:  return "res7  ";
+        case 8:  return "16 way";
+        case 9:  return "res9  ";
+        case 10: return "res10 ";
+        case 11: return "res11 ";
+        case 12: return "res12 ";
+        case 13: return "res13 ";
+        case 14: return "res14 ";
+        case 15: return "fully ";
+        default: return "????";
+    }
+}
+
+
+/** CPUID(1).EDX field descriptions. */
+static DBGFREGSUBFIELD const g_aLeaf1EdxSubFields[] =
+{
+    DBGFREGSUBFIELD_RO("FPU\0"         "x87 FPU on Chip",                            0, 1, 0),
+    DBGFREGSUBFIELD_RO("VME\0"         "Virtual 8086 Mode Enhancements",             1, 1, 0),
+    DBGFREGSUBFIELD_RO("DE\0"          "Debugging extensions",                       2, 1, 0),
+    DBGFREGSUBFIELD_RO("PSE\0"         "Page Size Extension",                        3, 1, 0),
+    DBGFREGSUBFIELD_RO("TSC\0"         "Time Stamp Counter",                         4, 1, 0),
+    DBGFREGSUBFIELD_RO("MSR\0"         "Model Specific Registers",                   5, 1, 0),
+    DBGFREGSUBFIELD_RO("PAE\0"         "Physical Address Extension",                 6, 1, 0),
+    DBGFREGSUBFIELD_RO("MCE\0"         "Machine Check Exception",                    7, 1, 0),
+    DBGFREGSUBFIELD_RO("CX8\0"         "CMPXCHG8B instruction",                      8, 1, 0),
+    DBGFREGSUBFIELD_RO("APIC\0"        "APIC On-Chip",                               9, 1, 0),
+    DBGFREGSUBFIELD_RO("SEP\0"         "SYSENTER and SYSEXIT Present",              11, 1, 0),
+    DBGFREGSUBFIELD_RO("MTRR\0"        "Memory Type Range Registers",               12, 1, 0),
+    DBGFREGSUBFIELD_RO("PGE\0"         "PTE Global Bit",                            13, 1, 0),
+    DBGFREGSUBFIELD_RO("MCA\0"         "Machine Check Architecture",                14, 1, 0),
+    DBGFREGSUBFIELD_RO("CMOV\0"        "Conditional Move instructions",             15, 1, 0),
+    DBGFREGSUBFIELD_RO("PAT\0"         "Page Attribute Table",                      16, 1, 0),
+    DBGFREGSUBFIELD_RO("PSE-36\0"      "36-bit Page Size Extension",                17, 1, 0),
+    DBGFREGSUBFIELD_RO("PSN\0"         "Processor Serial Number",                   18, 1, 0),
+    DBGFREGSUBFIELD_RO("CLFSH\0"       "CLFLUSH instruction",                       19, 1, 0),
+    DBGFREGSUBFIELD_RO("DS\0"          "Debug Store",                               21, 1, 0),
+    DBGFREGSUBFIELD_RO("ACPI\0"        "Thermal Mon. & Soft. Clock Ctrl.",          22, 1, 0),
+    DBGFREGSUBFIELD_RO("MMX\0"         "Intel MMX Technology",                      23, 1, 0),
+    DBGFREGSUBFIELD_RO("FXSR\0"        "FXSAVE and FXRSTOR instructions",           24, 1, 0),
+    DBGFREGSUBFIELD_RO("SSE\0"         "SSE support",                               25, 1, 0),
+    DBGFREGSUBFIELD_RO("SSE2\0"        "SSE2 support",                              26, 1, 0),
+    DBGFREGSUBFIELD_RO("SS\0"          "Self Snoop",                                27, 1, 0),
+    DBGFREGSUBFIELD_RO("HTT\0"         "Hyper-Threading Technology",                28, 1, 0),
+    DBGFREGSUBFIELD_RO("TM\0"          "Therm. Monitor",                            29, 1, 0),
+    DBGFREGSUBFIELD_RO("PBE\0"         "Pending Break Enabled",                     31, 1, 0),
+    DBGFREGSUBFIELD_TERMINATOR()
+};
+
+/** CPUID(1).ECX field descriptions. */
+static DBGFREGSUBFIELD const g_aLeaf1EcxSubFields[] =
+{
+    DBGFREGSUBFIELD_RO("SSE3\0"       "SSE3 support",                                    0, 1, 0),
+    DBGFREGSUBFIELD_RO("PCLMUL\0"     "PCLMULQDQ support (for AES-GCM)",                 1, 1, 0),
+    DBGFREGSUBFIELD_RO("DTES64\0"     "DS Area 64-bit Layout",                           2, 1, 0),
+    DBGFREGSUBFIELD_RO("MONITOR\0"    "MONITOR/MWAIT instructions",                      3, 1, 0),
+    DBGFREGSUBFIELD_RO("CPL-DS\0"     "CPL Qualified Debug Store",                       4, 1, 0),
+    DBGFREGSUBFIELD_RO("VMX\0"        "Virtual Machine Extensions",                      5, 1, 0),
+    DBGFREGSUBFIELD_RO("SMX\0"        "Safer Mode Extensions",                           6, 1, 0),
+    DBGFREGSUBFIELD_RO("EST\0"        "Enhanced SpeedStep Technology",                   7, 1, 0),
+    DBGFREGSUBFIELD_RO("TM2\0"        "Terminal Monitor 2",                              8, 1, 0),
+    DBGFREGSUBFIELD_RO("SSSE3\0"      "Supplemental Streaming SIMD Extensions 3",        9, 1, 0),
+    DBGFREGSUBFIELD_RO("CNTX-ID\0"    "L1 Context ID",                                  10, 1, 0),
+    DBGFREGSUBFIELD_RO("SDBG\0"       "Silicon Debug interface",                        11, 1, 0),
+    DBGFREGSUBFIELD_RO("FMA\0"        "Fused Multiply Add extensions",                  12, 1, 0),
+    DBGFREGSUBFIELD_RO("CX16\0"       "CMPXCHG16B instruction",                         13, 1, 0),
+    DBGFREGSUBFIELD_RO("TPRUPDATE\0"  "xTPR Update Control",                            14, 1, 0),
+    DBGFREGSUBFIELD_RO("PDCM\0"       "Perf/Debug Capability MSR",                      15, 1, 0),
+    DBGFREGSUBFIELD_RO("PCID\0"       "Process Context Identifiers",                    17, 1, 0),
+    DBGFREGSUBFIELD_RO("DCA\0"        "Direct Cache Access",                            18, 1, 0),
+    DBGFREGSUBFIELD_RO("SSE4_1\0"     "SSE4_1 support",                                 19, 1, 0),
+    DBGFREGSUBFIELD_RO("SSE4_2\0"     "SSE4_2 support",                                 20, 1, 0),
+    DBGFREGSUBFIELD_RO("X2APIC\0"     "x2APIC support",                                 21, 1, 0),
+    DBGFREGSUBFIELD_RO("MOVBE\0"      "MOVBE instruction",                              22, 1, 0),
+    DBGFREGSUBFIELD_RO("POPCNT\0"     "POPCNT instruction",                             23, 1, 0),
+    DBGFREGSUBFIELD_RO("TSCDEADL\0"   "Time Stamp Counter Deadline",                    24, 1, 0),
+    DBGFREGSUBFIELD_RO("AES\0"        "AES instructions",                               25, 1, 0),
+    DBGFREGSUBFIELD_RO("XSAVE\0"      "XSAVE instruction",                              26, 1, 0),
+    DBGFREGSUBFIELD_RO("OSXSAVE\0"    "OSXSAVE instruction",                            27, 1, 0),
+    DBGFREGSUBFIELD_RO("AVX\0"        "AVX support",                                    28, 1, 0),
+    DBGFREGSUBFIELD_RO("F16C\0"       "16-bit floating point conversion instructions",  29, 1, 0),
+    DBGFREGSUBFIELD_RO("RDRAND\0"     "RDRAND instruction",                             30, 1, 0),
+    DBGFREGSUBFIELD_RO("HVP\0"        "Hypervisor Present (we're a guest)",             31, 1, 0),
+    DBGFREGSUBFIELD_TERMINATOR()
+};
+
+/** CPUID(7,0).EBX field descriptions. */
+static DBGFREGSUBFIELD const g_aLeaf7Sub0EbxSubFields[] =
+{
+    DBGFREGSUBFIELD_RO("FSGSBASE\0"     "RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE instr.",    0, 1, 0),
+    DBGFREGSUBFIELD_RO("TSCADJUST\0"    "Supports MSR_IA32_TSC_ADJUST",                  1, 1, 0),
+    DBGFREGSUBFIELD_RO("BMI1\0"         "Advanced Bit Manipulation extension 1",         3, 1, 0),
+    DBGFREGSUBFIELD_RO("HLE\0"          "Hardware Lock Elision",                         4, 1, 0),
+    DBGFREGSUBFIELD_RO("AVX2\0"         "Advanced Vector Extensions 2",                  5, 1, 0),
+    DBGFREGSUBFIELD_RO("SMEP\0"         "Supervisor Mode Execution Prevention",          7, 1, 0),
+    DBGFREGSUBFIELD_RO("BMI2\0"         "Advanced Bit Manipulation extension 2",         8, 1, 0),
+    DBGFREGSUBFIELD_RO("ERMS\0"         "Enhanced REP MOVSB/STOSB instructions",         9, 1, 0),
+    DBGFREGSUBFIELD_RO("INVPCID\0"      "INVPCID instruction",                          10, 1, 0),
+    DBGFREGSUBFIELD_RO("RTM\0"          "Restricted Transactional Memory",              11, 1, 0),
+    DBGFREGSUBFIELD_RO("PQM\0"          "Platform Quality of Service Monitoring",       12, 1, 0),
+    DBGFREGSUBFIELD_RO("DEPFPU_CS_DS\0" "Deprecates FPU CS, FPU DS values if set",      13, 1, 0),
+    DBGFREGSUBFIELD_RO("MPE\0"          "Intel Memory Protection Extensions",           14, 1, 0),
+    DBGFREGSUBFIELD_RO("PQE\0"          "Platform Quality of Service Enforcement",      15, 1, 0),
+    DBGFREGSUBFIELD_RO("AVX512F\0"      "AVX512 Foundation instructions",               16, 1, 0),
+    DBGFREGSUBFIELD_RO("RDSEED\0"       "RDSEED instruction",                           18, 1, 0),
+    DBGFREGSUBFIELD_RO("ADX\0"          "ADCX/ADOX instructions",                       19, 1, 0),
+    DBGFREGSUBFIELD_RO("SMAP\0"         "Supervisor Mode Access Prevention",            20, 1, 0),
+    DBGFREGSUBFIELD_RO("CLFLUSHOPT\0"   "CLFLUSHOPT (Cache Line Flush) instruction",    23, 1, 0),
+    DBGFREGSUBFIELD_RO("INTEL_PT\0"     "Intel Processor Trace",                        25, 1, 0),
+    DBGFREGSUBFIELD_RO("AVX512PF\0"     "AVX512 Prefetch instructions",                 26, 1, 0),
+    DBGFREGSUBFIELD_RO("AVX512ER\0"     "AVX512 Exponential & Reciprocal instructions", 27, 1, 0),
+    DBGFREGSUBFIELD_RO("AVX512CD\0"     "AVX512 Conflict Detection instructions",       28, 1, 0),
+    DBGFREGSUBFIELD_RO("SHA\0"          "Secure Hash Algorithm extensions",             29, 1, 0),
+    DBGFREGSUBFIELD_TERMINATOR()
+};
+
+/** CPUID(7,0).ECX field descriptions.   */
+static DBGFREGSUBFIELD const g_aLeaf7Sub0EcxSubFields[] =
+{
+    DBGFREGSUBFIELD_RO("PREFETCHWT1\0" "PREFETCHWT1 instruction",                        0, 1, 0),
+    DBGFREGSUBFIELD_RO("PKU\0"          "Protection Key for Usermode pages",             3, 1, 0),
+    DBGFREGSUBFIELD_RO("OSPKU\0"        "CR4.PKU mirror",                                4, 1, 0),
+    DBGFREGSUBFIELD_TERMINATOR()
+};
+
+
+/** CPUID(13,0).EAX+EDX, XCR0, ++ bit descriptions. */
+static DBGFREGSUBFIELD const g_aXSaveStateBits[] =
+{
+    DBGFREGSUBFIELD_RO("x87\0"       "Legacy FPU state",                                 0, 1, 0),
+    DBGFREGSUBFIELD_RO("SSE\0"       "128-bit SSE state",                                1, 1, 0),
+    DBGFREGSUBFIELD_RO("YMM_Hi128\0" "Upper 128 bits of YMM0-15 (AVX)",                  2, 1, 0),
+    DBGFREGSUBFIELD_RO("BNDREGS\0"   "MPX bound register state",                         3, 1, 0),
+    DBGFREGSUBFIELD_RO("BNDCSR\0"    "MPX bound config and status state",                4, 1, 0),
+    DBGFREGSUBFIELD_RO("Opmask\0"    "opmask state",                                     5, 1, 0),
+    DBGFREGSUBFIELD_RO("ZMM_Hi256\0" "Upper 256 bits of ZMM0-15 (AVX-512)",              6, 1, 0),
+    DBGFREGSUBFIELD_RO("Hi16_ZMM\0"  "512-bits ZMM16-31 state (AVX-512)",                7, 1, 0),
+    DBGFREGSUBFIELD_RO("LWP\0"       "Lightweight Profiling (AMD)",                     62, 1, 0),
+    DBGFREGSUBFIELD_TERMINATOR()
+};
+
+/** CPUID(13,1).EAX field descriptions.   */
+static DBGFREGSUBFIELD const g_aLeaf13Sub1EaxSubFields[] =
+{
+    DBGFREGSUBFIELD_RO("XSAVEOPT\0"  "XSAVEOPT is available",                            0, 1, 0),
+    DBGFREGSUBFIELD_RO("XSAVEC\0"    "XSAVEC and compacted XRSTOR supported",            1, 1, 0),
+    DBGFREGSUBFIELD_RO("XGETBC1\0"   "XGETBV with ECX=1 supported",                      2, 1, 0),
+    DBGFREGSUBFIELD_RO("XSAVES\0"    "XSAVES/XRSTORS and IA32_XSS supported",            3, 1, 0),
+    DBGFREGSUBFIELD_TERMINATOR()
+};
+
+
+/** CPUID(0x80000001,0).EDX field descriptions.   */
+static DBGFREGSUBFIELD const g_aExtLeaf1EdxSubFields[] =
+{
+    DBGFREGSUBFIELD_RO("FPU\0"          "x87 FPU on Chip",                               0, 1, 0),
+    DBGFREGSUBFIELD_RO("VME\0"          "Virtual 8086 Mode Enhancements",                1, 1, 0),
+    DBGFREGSUBFIELD_RO("DE\0"           "Debugging extensions",                          2, 1, 0),
+    DBGFREGSUBFIELD_RO("PSE\0"          "Page Size Extension",                           3, 1, 0),
+    DBGFREGSUBFIELD_RO("TSC\0"          "Time Stamp Counter",                            4, 1, 0),
+    DBGFREGSUBFIELD_RO("MSR\0"          "K86 Model Specific Registers",                  5, 1, 0),
+    DBGFREGSUBFIELD_RO("PAE\0"          "Physical Address Extension",                    6, 1, 0),
+    DBGFREGSUBFIELD_RO("MCE\0"          "Machine Check Exception",                       7, 1, 0),
+    DBGFREGSUBFIELD_RO("CX8\0"          "CMPXCHG8B instruction",                         8, 1, 0),
+    DBGFREGSUBFIELD_RO("APIC\0"         "APIC On-Chip",                                  9, 1, 0),
+    DBGFREGSUBFIELD_RO("SEP\0"          "SYSCALL/SYSRET",                               11, 1, 0),
+    DBGFREGSUBFIELD_RO("MTRR\0"         "Memory Type Range Registers",                  12, 1, 0),
+    DBGFREGSUBFIELD_RO("PGE\0"          "PTE Global Bit",                               13, 1, 0),
+    DBGFREGSUBFIELD_RO("MCA\0"          "Machine Check Architecture",                   14, 1, 0),
+    DBGFREGSUBFIELD_RO("CMOV\0"         "Conditional Move instructions",                15, 1, 0),
+    DBGFREGSUBFIELD_RO("PAT\0"          "Page Attribute Table",                         16, 1, 0),
+    DBGFREGSUBFIELD_RO("PSE-36\0"       "36-bit Page Size Extension",                   17, 1, 0),
+    DBGFREGSUBFIELD_RO("NX\0"           "No-Execute/Execute-Disable",                   20, 1, 0),
+    DBGFREGSUBFIELD_RO("AXMMX\0"        "AMD Extensions to MMX instructions",           22, 1, 0),
+    DBGFREGSUBFIELD_RO("MMX\0"          "Intel MMX Technology",                         23, 1, 0),
+    DBGFREGSUBFIELD_RO("FXSR\0"         "FXSAVE and FXRSTOR Instructions",              24, 1, 0),
+    DBGFREGSUBFIELD_RO("FFXSR\0"        "AMD fast FXSAVE and FXRSTOR instructions",     25, 1, 0),
+    DBGFREGSUBFIELD_RO("Page1GB\0"      "1 GB large page",                              26, 1, 0),
+    DBGFREGSUBFIELD_RO("RDTSCP\0"       "RDTSCP instruction",                           27, 1, 0),
+    DBGFREGSUBFIELD_RO("LM\0"           "AMD64 Long Mode",                              29, 1, 0),
+    DBGFREGSUBFIELD_RO("3DNOWEXT\0"     "AMD Extensions to 3DNow",                      30, 1, 0),
+    DBGFREGSUBFIELD_RO("3DNOW\0"        "AMD 3DNow",                                    31, 1, 0),
+    DBGFREGSUBFIELD_TERMINATOR()
+};
+
+/** CPUID(0x80000001,0).ECX field descriptions.   */
+static DBGFREGSUBFIELD const g_aExtLeaf1EcxSubFields[] =
+{
+    DBGFREGSUBFIELD_RO("LahfSahf\0"     "LAHF/SAHF support in 64-bit mode",              0, 1, 0),
+    DBGFREGSUBFIELD_RO("CmpLegacy\0"    "Core multi-processing legacy mode",             1, 1, 0),
+    DBGFREGSUBFIELD_RO("SVM\0"          "AMD VM extensions",                             2, 1, 0),
+    DBGFREGSUBFIELD_RO("EXTAPIC\0"      "AMD Extended APIC registers",                   3, 1, 0),
+    DBGFREGSUBFIELD_RO("CR8L\0"         "AMD LOCK MOV CR0 means MOV CR8",                4, 1, 0),
+    DBGFREGSUBFIELD_RO("ABM\0"          "AMD Advanced Bit Manipulation",                 5, 1, 0),
+    DBGFREGSUBFIELD_RO("SSE4A\0"        "SSE4A instructions",                            6, 1, 0),
+    DBGFREGSUBFIELD_RO("MISALIGNSSE\0"  "AMD Misaligned SSE mode",                       7, 1, 0),
+    DBGFREGSUBFIELD_RO("3DNOWPRF\0"     "AMD PREFETCH and PREFETCHW instructions",       8, 1, 0),
+    DBGFREGSUBFIELD_RO("OSVW\0"         "AMD OS Visible Workaround",                     9, 1, 0),
+    DBGFREGSUBFIELD_RO("IBS\0"          "Instruct Based Sampling",                      10, 1, 0),
+    DBGFREGSUBFIELD_RO("XOP\0"          "Extended Operation support",                   11, 1, 0),
+    DBGFREGSUBFIELD_RO("SKINIT\0"       "SKINIT, STGI, and DEV support",                12, 1, 0),
+    DBGFREGSUBFIELD_RO("WDT\0"          "AMD Watchdog Timer support",                   13, 1, 0),
+    DBGFREGSUBFIELD_RO("LWP\0"          "Lightweight Profiling support",                15, 1, 0),
+    DBGFREGSUBFIELD_RO("FMA4\0"         "Four operand FMA instruction support",         16, 1, 0),
+    DBGFREGSUBFIELD_RO("NodeId\0"       "NodeId in MSR C001_100C",                      19, 1, 0),
+    DBGFREGSUBFIELD_RO("TBM\0"          "Trailing Bit Manipulation instructions",       21, 1, 0),
+    DBGFREGSUBFIELD_RO("TOPOEXT\0"      "Topology Extensions",                          22, 1, 0),
+    DBGFREGSUBFIELD_TERMINATOR()
+};
+
+
+static void cpumR3CpuIdInfoMnemonicListU32(PCDBGFINFOHLP pHlp, uint32_t uVal, PCDBGFREGSUBFIELD pDesc,
+                                           const char *pszLeadIn, uint32_t cchWidth)
+{
+    if (pszLeadIn)
+        pHlp->pfnPrintf(pHlp, "%*s", cchWidth, pszLeadIn);
+
+    for (uint32_t iBit = 0; iBit < 32; iBit++)
+        if (RT_BIT_32(iBit) & uVal)
+        {
+            while (   pDesc->pszName != NULL
+                   && iBit >= (uint32_t)pDesc->iFirstBit + pDesc->cBits)
+                pDesc++;
+            if (   pDesc->pszName != NULL
+                && iBit - (uint32_t)pDesc->iFirstBit < (uint32_t)pDesc->cBits)
+            {
+                if (pDesc->cBits == 1)
+                    pHlp->pfnPrintf(pHlp, " %s", pDesc->pszName);
+                else
+                {
+                    uint32_t uFieldValue = uVal >> pDesc->iFirstBit;
+                    if (pDesc->cBits < 32)
+                        uFieldValue &= RT_BIT_32(pDesc->cBits) - UINT32_C(1);
+                    pHlp->pfnPrintf(pHlp, pDesc->cBits < 4 ? " %s=%u" : " %s=%#x", pDesc->pszName, uFieldValue);
+                    iBit = pDesc->iFirstBit + pDesc->cBits - 1;
+                }
+            }
+            else
+                pHlp->pfnPrintf(pHlp, " %u", iBit);
+        }
+    if (pszLeadIn)
+        pHlp->pfnPrintf(pHlp, "\n");
+}
+
+
+static void cpumR3CpuIdInfoMnemonicListU64(PCDBGFINFOHLP pHlp, uint64_t uVal, PCDBGFREGSUBFIELD pDesc,
+                                           const char *pszLeadIn, uint32_t cchWidth)
+{
+    if (pszLeadIn)
+        pHlp->pfnPrintf(pHlp, "%*s", cchWidth, pszLeadIn);
+
+    for (uint32_t iBit = 0; iBit < 64; iBit++)
+        if (RT_BIT_64(iBit) & uVal)
+        {
+            while (   pDesc->pszName != NULL
+                   && iBit >= (uint32_t)pDesc->iFirstBit + pDesc->cBits)
+                pDesc++;
+            if (   pDesc->pszName != NULL
+                && iBit - (uint32_t)pDesc->iFirstBit < (uint32_t)pDesc->cBits)
+            {
+                if (pDesc->cBits == 1)
+                    pHlp->pfnPrintf(pHlp, " %s", pDesc->pszName);
+                else
+                {
+                    uint64_t uFieldValue = uVal >> pDesc->iFirstBit;
+                    if (pDesc->cBits < 64)
+                        uFieldValue &= RT_BIT_64(pDesc->cBits) - UINT64_C(1);
+                    pHlp->pfnPrintf(pHlp, pDesc->cBits < 4 ? " %s=%llu" : " %s=%#llx", pDesc->pszName, uFieldValue);
+                    iBit = pDesc->iFirstBit + pDesc->cBits - 1;
+                }
+            }
+            else
+                pHlp->pfnPrintf(pHlp, " %u", iBit);
+        }
+    if (pszLeadIn)
+        pHlp->pfnPrintf(pHlp, "\n");
+}
+
+
+static void cpumR3CpuIdInfoValueWithMnemonicListU64(PCDBGFINFOHLP pHlp, uint64_t uVal, PCDBGFREGSUBFIELD pDesc,
+                                                    const char *pszLeadIn, uint32_t cchWidth)
+{
+    if (!uVal)
+        pHlp->pfnPrintf(pHlp, "%*s %#010x`%08x\n", cchWidth, pszLeadIn, RT_HI_U32(uVal), RT_LO_U32(uVal));
+    else
+    {
+        pHlp->pfnPrintf(pHlp, "%*s %#010x`%08x (", cchWidth, pszLeadIn, RT_HI_U32(uVal), RT_LO_U32(uVal));
+        cpumR3CpuIdInfoMnemonicListU64(pHlp, uVal, pDesc, NULL, 0);
+        pHlp->pfnPrintf(pHlp, " )\n");
+    }
+}
+
+
+static void cpumR3CpuIdInfoVerboseCompareListU32(PCDBGFINFOHLP pHlp, uint32_t uVal1, uint32_t uVal2, PCDBGFREGSUBFIELD pDesc,
+                                                 uint32_t cchWidth)
+{
+    uint32_t uCombined = uVal1 | uVal2;
+    for (uint32_t iBit = 0; iBit < 32; iBit++)
+        if (   (RT_BIT_32(iBit) & uCombined)
+            || (iBit == pDesc->iFirstBit && pDesc->pszName) )
+        {
+            while (   pDesc->pszName != NULL
+                   && iBit >= (uint32_t)pDesc->iFirstBit + pDesc->cBits)
+                pDesc++;
+
+            if (   pDesc->pszName != NULL
+                && iBit - (uint32_t)pDesc->iFirstBit < (uint32_t)pDesc->cBits)
+            {
+                size_t      cchMnemonic  = strlen(pDesc->pszName);
+                const char *pszDesc      = pDesc->pszName + cchMnemonic + 1;
+                size_t      cchDesc      = strlen(pszDesc);
+                uint32_t    uFieldValue1 = uVal1 >> pDesc->iFirstBit;
+                uint32_t    uFieldValue2 = uVal2 >> pDesc->iFirstBit;
+                if (pDesc->cBits < 32)
+                {
+                    uFieldValue1 &= RT_BIT_32(pDesc->cBits) - UINT32_C(1);
+                    uFieldValue2 &= RT_BIT_32(pDesc->cBits) - UINT32_C(1);
+                }
+
+                pHlp->pfnPrintf(pHlp,  pDesc->cBits < 4 ? "  %s - %s%*s= %u (%u)\n" : "  %s - %s%*s= %#x (%#x)\n",
+                                pDesc->pszName, pszDesc,
+                                cchMnemonic + 3 + cchDesc < cchWidth ? cchWidth - (cchMnemonic + 3 + cchDesc) : 1, "",
+                                uFieldValue1, uFieldValue2);
+
+                iBit = pDesc->iFirstBit + pDesc->cBits - 1U;
+                pDesc++;
+            }
+            else
+                pHlp->pfnPrintf(pHlp, "  %2u - Reserved%*s= %u (%u)\n", iBit, 13 < cchWidth ? cchWidth - 13 : 1, "",
+                                RT_BOOL(uVal1 & RT_BIT_32(iBit)), RT_BOOL(uVal2 & RT_BIT_32(iBit)));
+        }
+}
+
+
+/**
+ * Produces a detailed summary of standard leaf 0x00000001.
+ *
+ * @param   pHlp        The info helper functions.
+ * @param   paLeaves    The CPUID leaves array.
+ * @param   cLeaves     The number of leaves in the array.
+ * @param   pCurLeaf    The 0x00000001 leaf.
+ * @param   fVerbose    Whether to be very verbose or not.
+ * @param   fIntel      Set if intel CPU.
+ */
+static void cpumR3CpuIdInfoStdLeaf1Details(PCDBGFINFOHLP pHlp, PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves,
+                                           PCCPUMCPUIDLEAF pCurLeaf, bool fVerbose, bool fIntel)
+{
+    Assert(pCurLeaf); Assert(pCurLeaf->uLeaf == 1);
+    static const char * const s_apszTypes[4] = { "primary", "overdrive", "MP", "reserved" };
+    uint32_t uEAX = pCurLeaf->uEax;
+    uint32_t uEBX = pCurLeaf->uEbx;
+
+    pHlp->pfnPrintf(pHlp,
+                    "%36s %2d \tExtended: %d \tEffective: %d\n"
+                    "%36s %2d \tExtended: %d \tEffective: %d\n"
+                    "%36s %d\n"
+                    "%36s %d (%s)\n"
+                    "%36s %#04x\n"
+                    "%36s %d\n"
+                    "%36s %d\n"
+                    "%36s %#04x\n"
+                    ,
+                    "Family:",      (uEAX >> 8) & 0xf, (uEAX >> 20) & 0x7f, ASMGetCpuFamily(uEAX),
+                    "Model:",       (uEAX >> 4) & 0xf, (uEAX >> 16) & 0x0f, ASMGetCpuModel(uEAX, fIntel),
+                    "Stepping:",    ASMGetCpuStepping(uEAX),
+                    "Type:",        (uEAX >> 12) & 3, s_apszTypes[(uEAX >> 12) & 3],
+                    "APIC ID:",     (uEBX >> 24) & 0xff,
+                    "Logical CPUs:",(uEBX >> 16) & 0xff,
+                    "CLFLUSH Size:",(uEBX >>  8) & 0xff,
+                    "Brand ID:",    (uEBX >>  0) & 0xff);
+    if (fVerbose)
+    {
+        CPUMCPUID Host;
+        ASMCpuIdExSlow(1, 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+        pHlp->pfnPrintf(pHlp, "Features\n");
+        pHlp->pfnPrintf(pHlp, "  Mnemonic - Description                                  = guest (host)\n");
+        cpumR3CpuIdInfoVerboseCompareListU32(pHlp, pCurLeaf->uEdx, Host.uEdx, g_aLeaf1EdxSubFields, 56);
+        cpumR3CpuIdInfoVerboseCompareListU32(pHlp, pCurLeaf->uEcx, Host.uEcx, g_aLeaf1EcxSubFields, 56);
+    }
+    else
+    {
+        cpumR3CpuIdInfoMnemonicListU32(pHlp, pCurLeaf->uEdx, g_aLeaf1EdxSubFields, "Features EDX:", 36);
+        cpumR3CpuIdInfoMnemonicListU32(pHlp, pCurLeaf->uEcx, g_aLeaf1EcxSubFields, "Features ECX:", 36);
+    }
+}
+
+
+/**
+ * Produces a detailed summary of standard leaf 0x00000007.
+ *
+ * @param   pHlp        The info helper functions.
+ * @param   paLeaves    The CPUID leaves array.
+ * @param   cLeaves     The number of leaves in the array.
+ * @param   pCurLeaf    The first 0x00000007 leaf.
+ * @param   fVerbose    Whether to be very verbose or not.
+ */
+static void cpumR3CpuIdInfoStdLeaf7Details(PCDBGFINFOHLP pHlp, PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves,
+                                           PCCPUMCPUIDLEAF pCurLeaf, bool fVerbose)
+{
+    Assert(pCurLeaf); Assert(pCurLeaf->uLeaf == 7);
+    pHlp->pfnPrintf(pHlp, "Structured Extended Feature Flags Enumeration (leaf 7):\n");
+    for (;;)
+    {
+        CPUMCPUID Host;
+        ASMCpuIdExSlow(pCurLeaf->uLeaf, 0, pCurLeaf->uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+
+        switch (pCurLeaf->uSubLeaf)
+        {
+            case 0:
+                if (fVerbose)
+                {
+                    pHlp->pfnPrintf(pHlp, "  Mnemonic - Description                                  = guest (host)\n");
+                    cpumR3CpuIdInfoVerboseCompareListU32(pHlp, pCurLeaf->uEbx, Host.uEbx, g_aLeaf7Sub0EbxSubFields, 56);
+                    cpumR3CpuIdInfoVerboseCompareListU32(pHlp, pCurLeaf->uEcx, Host.uEcx, g_aLeaf7Sub0EcxSubFields, 56);
+                    if (pCurLeaf->uEdx || Host.uEdx)
+                        pHlp->pfnPrintf(pHlp, "%36 %#x (%#x)\n", "Ext Features EDX:", pCurLeaf->uEdx, Host.uEdx);
+                }
+                else
+                {
+                    cpumR3CpuIdInfoMnemonicListU32(pHlp, pCurLeaf->uEbx, g_aLeaf7Sub0EbxSubFields, "Ext Features EBX:", 36);
+                    cpumR3CpuIdInfoMnemonicListU32(pHlp, pCurLeaf->uEcx, g_aLeaf7Sub0EcxSubFields, "Ext Features ECX:", 36);
+                    if (pCurLeaf->uEdx)
+                        pHlp->pfnPrintf(pHlp, "%36 %#x\n", "Ext Features EDX:", pCurLeaf->uEdx);
+                }
+                break;
+
+            default:
+                if (pCurLeaf->uEdx || pCurLeaf->uEcx || pCurLeaf->uEbx)
+                    pHlp->pfnPrintf(pHlp, "Unknown extended feature sub-leaf #%u: EAX=%#x EBX=%#x ECX=%#x EDX=%#x\n",
+                                    pCurLeaf->uSubLeaf, pCurLeaf->uEax, pCurLeaf->uEbx, pCurLeaf->uEcx, pCurLeaf->uEdx);
+                break;
+
+        }
+
+        /* advance. */
+        pCurLeaf++;
+        if (   (uintptr_t)(pCurLeaf - paLeaves) >= cLeaves
+            || pCurLeaf->uLeaf != 0x7)
+            break;
+    }
+}
+
+
+/**
+ * Produces a detailed summary of standard leaf 0x0000000d.
+ *
+ * @param   pHlp        The info helper functions.
+ * @param   paLeaves    The CPUID leaves array.
+ * @param   cLeaves     The number of leaves in the array.
+ * @param   pCurLeaf    The first 0x00000007 leaf.
+ * @param   fVerbose    Whether to be very verbose or not.
+ */
+static void cpumR3CpuIdInfoStdLeaf13Details(PCDBGFINFOHLP pHlp, PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves,
+                                            PCCPUMCPUIDLEAF pCurLeaf, bool fVerbose)
+{
+    Assert(pCurLeaf); Assert(pCurLeaf->uLeaf == 13);
+    pHlp->pfnPrintf(pHlp, "Processor Extended State Enumeration (leaf 0xd):\n");
+    for (uint32_t uSubLeaf = 0; uSubLeaf < 64; uSubLeaf++)
+    {
+        CPUMCPUID Host;
+        ASMCpuIdExSlow(UINT32_C(0x0000000d), 0, uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+
+        switch (uSubLeaf)
+        {
+            case 0:
+                if (pCurLeaf && pCurLeaf->uSubLeaf == uSubLeaf)
+                    pHlp->pfnPrintf(pHlp, "%42s %#x/%#x\n", "XSAVE area cur/max size by XCR0, guest:",
+                                    pCurLeaf->uEbx, pCurLeaf->uEcx);
+                pHlp->pfnPrintf(pHlp, "%42s %#x/%#x\n", "XSAVE area cur/max size by XCR0, host:",  Host.uEbx, Host.uEcx);
+
+                if (pCurLeaf && pCurLeaf->uSubLeaf == uSubLeaf)
+                    cpumR3CpuIdInfoValueWithMnemonicListU64(pHlp, RT_MAKE_U64(pCurLeaf->uEax, pCurLeaf->uEdx), g_aXSaveStateBits,
+                                                            "Valid XCR0 bits, guest:", 42);
+                cpumR3CpuIdInfoValueWithMnemonicListU64(pHlp, RT_MAKE_U64(Host.uEax, Host.uEdx), g_aXSaveStateBits,
+                                                        "Valid XCR0 bits, host:", 42);
+                break;
+
+            case 1:
+                if (pCurLeaf && pCurLeaf->uSubLeaf == uSubLeaf)
+                    cpumR3CpuIdInfoMnemonicListU32(pHlp, pCurLeaf->uEax, g_aLeaf13Sub1EaxSubFields, "XSAVE features, guest:", 42);
+                cpumR3CpuIdInfoMnemonicListU32(pHlp, Host.uEax, g_aLeaf13Sub1EaxSubFields, "XSAVE features, host:", 42);
+
+                if (pCurLeaf && pCurLeaf->uSubLeaf == uSubLeaf)
+                    pHlp->pfnPrintf(pHlp, "%42s %#x\n", "XSAVE area cur size XCR0|XSS, guest:", pCurLeaf->uEbx);
+                pHlp->pfnPrintf(pHlp, "%42s %#x\n", "XSAVE area cur size XCR0|XSS, host:", Host.uEbx);
+
+                if (pCurLeaf && pCurLeaf->uSubLeaf == uSubLeaf)
+                    cpumR3CpuIdInfoValueWithMnemonicListU64(pHlp, RT_MAKE_U64(pCurLeaf->uEcx, pCurLeaf->uEdx), g_aXSaveStateBits,
+                                                            "  Valid IA32_XSS bits, guest:", 42);
+                cpumR3CpuIdInfoValueWithMnemonicListU64(pHlp, RT_MAKE_U64(Host.uEdx, Host.uEcx), g_aXSaveStateBits,
+                                                        "  Valid IA32_XSS bits, host:", 42);
+                break;
+
+            default:
+                if (   pCurLeaf
+                    && pCurLeaf->uSubLeaf == uSubLeaf
+                    && (pCurLeaf->uEax || pCurLeaf->uEbx || pCurLeaf->uEcx || pCurLeaf->uEdx) )
+                {
+                    pHlp->pfnPrintf(pHlp, "  State #%u, guest: off=%#06x, cb=%#06x %s", uSubLeaf, pCurLeaf->uEbx,
+                                    pCurLeaf->uEax, pCurLeaf->uEcx & RT_BIT_32(0) ? "XCR0-bit" : "IA32_XSS-bit");
+                    if (pCurLeaf->uEcx & ~RT_BIT_32(0))
+                        pHlp->pfnPrintf(pHlp, " ECX[reserved]=%#x\n", pCurLeaf->uEcx & ~RT_BIT_32(0));
+                    if (pCurLeaf->uEdx)
+                        pHlp->pfnPrintf(pHlp, " EDX[reserved]=%#x\n", pCurLeaf->uEdx);
+                    pHlp->pfnPrintf(pHlp, " --");
+                    cpumR3CpuIdInfoMnemonicListU64(pHlp, RT_BIT_64(uSubLeaf), g_aXSaveStateBits, NULL, 0);
+                    pHlp->pfnPrintf(pHlp, "\n");
+                }
+                if (Host.uEax || Host.uEbx || Host.uEcx || Host.uEdx)
+                {
+                    pHlp->pfnPrintf(pHlp, "  State #%u, host:  off=%#06x, cb=%#06x %s", uSubLeaf, Host.uEbx,
+                                    Host.uEax, Host.uEcx & RT_BIT_32(0) ? "XCR0-bit" : "IA32_XSS-bit");
+                    if (Host.uEcx & ~RT_BIT_32(0))
+                        pHlp->pfnPrintf(pHlp, " ECX[reserved]=%#x\n", Host.uEcx & ~RT_BIT_32(0));
+                    if (Host.uEdx)
+                        pHlp->pfnPrintf(pHlp, " EDX[reserved]=%#x\n", Host.uEdx);
+                    pHlp->pfnPrintf(pHlp, " --");
+                    cpumR3CpuIdInfoMnemonicListU64(pHlp, RT_BIT_64(uSubLeaf), g_aXSaveStateBits, NULL, 0);
+                    pHlp->pfnPrintf(pHlp, "\n");
+                }
+                break;
+
+        }
+
+        /* advance. */
+        if (pCurLeaf)
+        {
+            while (   (uintptr_t)(pCurLeaf - paLeaves) < cLeaves
+                   && pCurLeaf->uSubLeaf <= uSubLeaf
+                   && pCurLeaf->uLeaf == UINT32_C(0x0000000d))
+                pCurLeaf++;
+            if (   (uintptr_t)(pCurLeaf - paLeaves) >= cLeaves
+                || pCurLeaf->uLeaf != UINT32_C(0x0000000d))
+                pCurLeaf = NULL;
+        }
+    }
+}
+
+
+static PCCPUMCPUIDLEAF cpumR3CpuIdInfoRawRange(PCDBGFINFOHLP pHlp, PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves,
+                                               PCCPUMCPUIDLEAF pCurLeaf, uint32_t uUpToLeaf, const char *pszTitle)
+{
+    if (   (uintptr_t)(pCurLeaf - paLeaves) < cLeaves
+        && pCurLeaf->uLeaf <= uUpToLeaf)
+    {
+        pHlp->pfnPrintf(pHlp,
+                        "         %s\n"
+                        "     Leaf/sub-leaf  eax      ebx      ecx      edx\n", pszTitle);
+        while (   (uintptr_t)(pCurLeaf - paLeaves) < cLeaves
+               && pCurLeaf->uLeaf <= uUpToLeaf)
+        {
+            CPUMCPUID Host;
+            ASMCpuIdExSlow(pCurLeaf->uLeaf, 0, pCurLeaf->uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+            pHlp->pfnPrintf(pHlp,
+                            "Gst: %08x/%04x  %08x %08x %08x %08x\n"
+                            "Hst:                %08x %08x %08x %08x\n",
+                            pCurLeaf->uLeaf, pCurLeaf->uSubLeaf, pCurLeaf->uEax, pCurLeaf->uEbx, pCurLeaf->uEcx, pCurLeaf->uEdx,
+                            Host.uEax, Host.uEbx, Host.uEcx, Host.uEdx);
+            pCurLeaf++;
+        }
+    }
+
+    return pCurLeaf;
+}
+
+
+/**
+ * Display the guest CpuId leaves.
+ *
+ * @param   pVM         Pointer to the VM.
+ * @param   pHlp        The info helper functions.
+ * @param   pszArgs     "terse", "default" or "verbose".
+ */
+DECLCALLBACK(void) cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
+{
+    /*
+     * Parse the argument.
+     */
+    unsigned iVerbosity = 1;
+    if (pszArgs)
+    {
+        pszArgs = RTStrStripL(pszArgs);
+        if (!strcmp(pszArgs, "terse"))
+            iVerbosity--;
+        else if (!strcmp(pszArgs, "verbose"))
+            iVerbosity++;
+    }
+
+    uint32_t        uLeaf;
+    CPUMCPUID       Host;
+    uint32_t        cLeaves  = pVM->cpum.s.GuestInfo.cCpuIdLeaves;
+    PCPUMCPUIDLEAF  paLeaves = pVM->cpum.s.GuestInfo.paCpuIdLeavesR3;
+    PCCPUMCPUIDLEAF pCurLeaf;
+    PCCPUMCPUIDLEAF pNextLeaf;
+    bool const      fIntel = ASMIsIntelCpuEx(pVM->cpum.s.aGuestCpuIdPatmStd[0].uEbx,
+                                             pVM->cpum.s.aGuestCpuIdPatmStd[0].uEcx,
+                                             pVM->cpum.s.aGuestCpuIdPatmStd[0].uEdx);
+
+    /*
+     * Standard leaves.  Custom raw dump here due to ECX sub-leaves host handling.
+     */
+    uint32_t        cHstMax = ASMCpuId_EAX(0);
+    uint32_t        cGstMax = paLeaves[0].uLeaf == 0 ? paLeaves[0].uEax : 0;
+    uint32_t        cMax    = RT_MAX(cGstMax, cHstMax);
+    pHlp->pfnPrintf(pHlp,
+                    "         Raw Standard CPUID Leaves\n"
+                    "     Leaf/sub-leaf  eax      ebx      ecx      edx\n");
+    for (uLeaf = 0, pCurLeaf = paLeaves; uLeaf <= cMax; uLeaf++)
+    {
+        uint32_t cMaxSubLeaves = 1;
+        if (uLeaf == 4 || uLeaf == 7 || uLeaf == 0xb)
+            cMaxSubLeaves = 16;
+        else if (uLeaf == 0xd)
+            cMaxSubLeaves = 128;
+
+        for (uint32_t uSubLeaf = 0; uSubLeaf < cMaxSubLeaves; uSubLeaf++)
+        {
+            ASMCpuIdExSlow(uLeaf, 0, uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+            if (   (uintptr_t)(pCurLeaf - paLeaves) < cLeaves
+                && pCurLeaf->uLeaf    == uLeaf
+                && pCurLeaf->uSubLeaf == uSubLeaf)
+            {
+                pHlp->pfnPrintf(pHlp,
+                                "Gst: %08x/%04x  %08x %08x %08x %08x\n"
+                                "Hst:                %08x %08x %08x %08x\n",
+                                uLeaf, uSubLeaf, pCurLeaf->uEax, pCurLeaf->uEbx, pCurLeaf->uEcx, pCurLeaf->uEdx,
+                                Host.uEax, Host.uEbx, Host.uEcx, Host.uEdx);
+                pCurLeaf++;
+            }
+            else if (   uLeaf != 0xd
+                     || uSubLeaf <= 1
+                     || Host.uEbx != 0 )
+                pHlp->pfnPrintf(pHlp,
+                                "Hst: %08x/%04x  %08x %08x %08x %08x\n",
+                                uLeaf, uSubLeaf, Host.uEax, Host.uEbx, Host.uEcx, Host.uEdx);
+
+            /* Done? */
+            if (   (   (uintptr_t)(pCurLeaf - paLeaves) >= cLeaves
+                    || pCurLeaf->uLeaf != uLeaf)
+                && (   (uLeaf == 0x4 && ((Host.uEax & 0x000f) == 0 || (Host.uEax & 0x000f) >= 8))
+                    || (uLeaf == 0x7 && Host.uEax == 0)
+                    || (uLeaf == 0xb && ((Host.uEcx & 0xff00) == 0 || (Host.uEcx & 0xff00) >= 8))
+                    || (uLeaf == 0xb && (Host.uEcx & 0xff) != uSubLeaf)
+                    || (uLeaf == 0xd && uSubLeaf >= 128)
+                   )
+               )
+                break;
+        }
+    }
+    pNextLeaf = pCurLeaf;
+
+    /*
+     * If verbose, decode it.
+     */
+    if (iVerbosity && paLeaves[0].uLeaf == 0)
+        pHlp->pfnPrintf(pHlp,
+                        "%36s %.04s%.04s%.04s\n"
+                        "%36s 0x00000000-%#010x\n"
+                        ,
+                        "Name:", &paLeaves[0].uEbx, &paLeaves[0].uEdx, &paLeaves[0].uEcx,
+                        "Supports:", paLeaves[0].uEax);
+
+    if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x00000001), 0)) != NULL)
+        cpumR3CpuIdInfoStdLeaf1Details(pHlp, paLeaves, cLeaves, pCurLeaf, iVerbosity > 1, fIntel);
+
+    if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x00000007), 0)) != NULL)
+        cpumR3CpuIdInfoStdLeaf7Details(pHlp, paLeaves, cLeaves, pCurLeaf, iVerbosity > 1);
+
+    if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x0000000d), 0)) != NULL)
+        cpumR3CpuIdInfoStdLeaf13Details(pHlp, paLeaves, cLeaves, pCurLeaf, iVerbosity > 1);
+
+    pCurLeaf = pNextLeaf;
+
+    /*
+     * Hypervisor leaves.
+     *
+     * Unlike most of the other leaves reported, the guest hypervisor leaves
+     * aren't a subset of the host CPUID bits.
+     */
+    pCurLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, UINT32_C(0x3fffffff), "Unknown CPUID Leaves");
+
+    ASMCpuIdExSlow(UINT32_C(0x40000000), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+    cHstMax  = Host.uEax >= UINT32_C(0x40000001) && Host.uEax <= UINT32_C(0x40000fff) ? Host.uEax : 0;
+    cGstMax  = (uintptr_t)(pCurLeaf - paLeaves) < cLeaves && pCurLeaf->uLeaf == UINT32_C(0x40000000)
+             ? RT_MIN(pCurLeaf->uEax, UINT32_C(0x40000fff)) : 0;
+    cMax     = RT_MAX(cHstMax, cGstMax);
+    if (cMax >= UINT32_C(0x40000000))
+    {
+        pNextLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, cMax, "Raw Hypervisor CPUID Leaves");
+
+        /** @todo dump these in more detail. */
+
+        pCurLeaf = pNextLeaf;
+    }
+
+
+    /*
+     * Extended.  Custom raw dump here due to ECX sub-leaves host handling.
+     * Implemented after AMD specs.
+     */
+    pCurLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, UINT32_C(0x7fffffff), "Unknown CPUID Leaves");
+
+    ASMCpuIdExSlow(UINT32_C(0x80000000), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+    cHstMax  = ASMIsValidExtRange(Host.uEax) ? RT_MIN(Host.uEax, UINT32_C(0x80000fff)) : 0;
+    cGstMax  = (uintptr_t)(pCurLeaf - paLeaves) < cLeaves && pCurLeaf->uLeaf == UINT32_C(0x80000000)
+             ? RT_MIN(pCurLeaf->uEax, UINT32_C(0x80000fff)) : 0;
+    cMax     = RT_MAX(cHstMax, cGstMax);
+    if (cMax >= UINT32_C(0x80000000))
+    {
+
+        pHlp->pfnPrintf(pHlp,
+                        "         Raw Extended CPUID Leaves\n"
+                        "     Leaf/sub-leaf  eax      ebx      ecx      edx\n");
+        PCCPUMCPUIDLEAF pExtLeaf = pCurLeaf;
+        for (uLeaf = UINT32_C(0x80000000); uLeaf <= cMax; uLeaf++)
+        {
+            uint32_t cMaxSubLeaves = 1;
+            if (uLeaf == UINT32_C(0x8000001d))
+                cMaxSubLeaves = 16;
+
+            for (uint32_t uSubLeaf = 0; uSubLeaf < cMaxSubLeaves; uSubLeaf++)
+            {
+                ASMCpuIdExSlow(uLeaf, 0, uSubLeaf, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+                if (   (uintptr_t)(pCurLeaf - paLeaves) < cLeaves
+                    && pCurLeaf->uLeaf    == uLeaf
+                    && pCurLeaf->uSubLeaf == uSubLeaf)
+                {
+                    pHlp->pfnPrintf(pHlp,
+                                    "Gst: %08x/%04x  %08x %08x %08x %08x\n"
+                                    "Hst:                %08x %08x %08x %08x\n",
+                                    uLeaf, uSubLeaf, pCurLeaf->uEax, pCurLeaf->uEbx, pCurLeaf->uEcx, pCurLeaf->uEdx,
+                                    Host.uEax, Host.uEbx, Host.uEcx, Host.uEdx);
+                    pCurLeaf++;
+                }
+                else if (   uLeaf != 0xd
+                         || uSubLeaf <= 1
+                         || Host.uEbx != 0 )
+                    pHlp->pfnPrintf(pHlp,
+                                    "Hst: %08x/%04x  %08x %08x %08x %08x\n",
+                                    uLeaf, uSubLeaf, Host.uEax, Host.uEbx, Host.uEcx, Host.uEdx);
+
+                /* Done? */
+                if (   (   (uintptr_t)(pCurLeaf - paLeaves) >= cLeaves
+                        || pCurLeaf->uLeaf != uLeaf)
+                    && (uLeaf == UINT32_C(0x8000001d) && ((Host.uEax & 0x000f) == 0 || (Host.uEax & 0x000f) >= 8)) )
+                    break;
+            }
+        }
+        pNextLeaf = pCurLeaf;
+
+        /*
+         * Understandable output
+         */
+        if (iVerbosity)
+            pHlp->pfnPrintf(pHlp,
+                            "Ext Name:                        %.4s%.4s%.4s\n"
+                            "Ext Supports:                    0x80000000-%#010x\n",
+                            &pExtLeaf->uEbx, &pExtLeaf->uEdx, &pExtLeaf->uEcx, pExtLeaf->uEax);
+
+        pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000001), 0);
+        if (iVerbosity && pCurLeaf)
+        {
+            uint32_t uEAX = pCurLeaf->uEax;
+            pHlp->pfnPrintf(pHlp,
+                            "Family:                          %d  \tExtended: %d \tEffective: %d\n"
+                            "Model:                           %d  \tExtended: %d \tEffective: %d\n"
+                            "Stepping:                        %d\n"
+                            "Brand ID:                        %#05x\n",
+                            (uEAX >> 8) & 0xf, (uEAX >> 20) & 0x7f, ASMGetCpuFamily(uEAX),
+                            (uEAX >> 4) & 0xf, (uEAX >> 16) & 0x0f, ASMGetCpuModel(uEAX, fIntel),
+                            ASMGetCpuStepping(uEAX),
+                            pCurLeaf->uEbx & 0xfff);
+
+            if (iVerbosity == 1)
+            {
+                cpumR3CpuIdInfoMnemonicListU32(pHlp, pCurLeaf->uEdx, g_aExtLeaf1EdxSubFields, "Ext Features EDX:", 34);
+                cpumR3CpuIdInfoMnemonicListU32(pHlp, pCurLeaf->uEcx, g_aExtLeaf1EdxSubFields, "Ext Features ECX:", 34);
+            }
+            else
+            {
+                ASMCpuIdExSlow(0x80000001, 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+                pHlp->pfnPrintf(pHlp, "Ext Features\n");
+                pHlp->pfnPrintf(pHlp, "  Mnemonic - Description                                  = guest (host)\n");
+                cpumR3CpuIdInfoVerboseCompareListU32(pHlp, pCurLeaf->uEdx, Host.uEdx, g_aExtLeaf1EdxSubFields, 56);
+                cpumR3CpuIdInfoVerboseCompareListU32(pHlp, pCurLeaf->uEcx, Host.uEcx, g_aExtLeaf1EcxSubFields, 56);
+            }
+        }
+
+        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000002), 0)) != NULL)
+        {
+            char szString[4*4*3+1] = {0};
+            uint32_t *pu32 = (uint32_t *)szString;
+            *pu32++ = pCurLeaf->uEax;
+            *pu32++ = pCurLeaf->uEbx;
+            *pu32++ = pCurLeaf->uEcx;
+            *pu32++ = pCurLeaf->uEdx;
+            pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000003), 0);
+            if (pCurLeaf)
+            {
+                *pu32++ = pCurLeaf->uEax;
+                *pu32++ = pCurLeaf->uEbx;
+                *pu32++ = pCurLeaf->uEcx;
+                *pu32++ = pCurLeaf->uEdx;
+            }
+            pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000004), 0);
+            if (pCurLeaf)
+            {
+                *pu32++ = pCurLeaf->uEax;
+                *pu32++ = pCurLeaf->uEbx;
+                *pu32++ = pCurLeaf->uEcx;
+                *pu32++ = pCurLeaf->uEdx;
+            }
+            pHlp->pfnPrintf(pHlp, "Full Name:                       \"%s\"\n", szString);
+        }
+
+        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000005), 0)) != NULL)
+        {
+            uint32_t uEAX = pCurLeaf->uEax;
+            uint32_t uEBX = pCurLeaf->uEbx;
+            uint32_t uECX = pCurLeaf->uEcx;
+            uint32_t uEDX = pCurLeaf->uEdx;
+            char sz1[32];
+            char sz2[32];
+
+            pHlp->pfnPrintf(pHlp,
+                            "TLB 2/4M Instr/Uni:              %s %3d entries\n"
+                            "TLB 2/4M Data:                   %s %3d entries\n",
+                            getCacheAss((uEAX >>  8) & 0xff, sz1), (uEAX >>  0) & 0xff,
+                            getCacheAss((uEAX >> 24) & 0xff, sz2), (uEAX >> 16) & 0xff);
+            pHlp->pfnPrintf(pHlp,
+                            "TLB 4K Instr/Uni:                %s %3d entries\n"
+                            "TLB 4K Data:                     %s %3d entries\n",
+                            getCacheAss((uEBX >>  8) & 0xff, sz1), (uEBX >>  0) & 0xff,
+                            getCacheAss((uEBX >> 24) & 0xff, sz2), (uEBX >> 16) & 0xff);
+            pHlp->pfnPrintf(pHlp, "L1 Instr Cache Line Size:        %d bytes\n"
+                            "L1 Instr Cache Lines Per Tag:    %d\n"
+                            "L1 Instr Cache Associativity:    %s\n"
+                            "L1 Instr Cache Size:             %d KB\n",
+                            (uEDX >> 0) & 0xff,
+                            (uEDX >> 8) & 0xff,
+                            getCacheAss((uEDX >> 16) & 0xff, sz1),
+                            (uEDX >> 24) & 0xff);
+            pHlp->pfnPrintf(pHlp,
+                            "L1 Data Cache Line Size:         %d bytes\n"
+                            "L1 Data Cache Lines Per Tag:     %d\n"
+                            "L1 Data Cache Associativity:     %s\n"
+                            "L1 Data Cache Size:              %d KB\n",
+                            (uECX >> 0) & 0xff,
+                            (uECX >> 8) & 0xff,
+                            getCacheAss((uECX >> 16) & 0xff, sz1),
+                            (uECX >> 24) & 0xff);
+        }
+
+        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000006), 0)) != NULL)
+        {
+            uint32_t uEAX = pCurLeaf->uEax;
+            uint32_t uEBX = pCurLeaf->uEbx;
+            uint32_t uEDX = pCurLeaf->uEdx;
+
+            pHlp->pfnPrintf(pHlp,
+                            "L2 TLB 2/4M Instr/Uni:           %s %4d entries\n"
+                            "L2 TLB 2/4M Data:                %s %4d entries\n",
+                            getL2CacheAss((uEAX >> 12) & 0xf),  (uEAX >>  0) & 0xfff,
+                            getL2CacheAss((uEAX >> 28) & 0xf),  (uEAX >> 16) & 0xfff);
+            pHlp->pfnPrintf(pHlp,
+                            "L2 TLB 4K Instr/Uni:             %s %4d entries\n"
+                            "L2 TLB 4K Data:                  %s %4d entries\n",
+                            getL2CacheAss((uEBX >> 12) & 0xf),  (uEBX >>  0) & 0xfff,
+                            getL2CacheAss((uEBX >> 28) & 0xf),  (uEBX >> 16) & 0xfff);
+            pHlp->pfnPrintf(pHlp,
+                            "L2 Cache Line Size:              %d bytes\n"
+                            "L2 Cache Lines Per Tag:          %d\n"
+                            "L2 Cache Associativity:          %s\n"
+                            "L2 Cache Size:                   %d KB\n",
+                            (uEDX >> 0) & 0xff,
+                            (uEDX >> 8) & 0xf,
+                            getL2CacheAss((uEDX >> 12) & 0xf),
+                            (uEDX >> 16) & 0xffff);
+        }
+
+        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000007), 0)) != NULL)
+        {
+            uint32_t uEDX = pCurLeaf->uEdx;
+
+            pHlp->pfnPrintf(pHlp, "APM Features:                   ");
+            if (uEDX & RT_BIT(0))   pHlp->pfnPrintf(pHlp, " TS");
+            if (uEDX & RT_BIT(1))   pHlp->pfnPrintf(pHlp, " FID");
+            if (uEDX & RT_BIT(2))   pHlp->pfnPrintf(pHlp, " VID");
+            if (uEDX & RT_BIT(3))   pHlp->pfnPrintf(pHlp, " TTP");
+            if (uEDX & RT_BIT(4))   pHlp->pfnPrintf(pHlp, " TM");
+            if (uEDX & RT_BIT(5))   pHlp->pfnPrintf(pHlp, " STC");
+            if (uEDX & RT_BIT(6))   pHlp->pfnPrintf(pHlp, " MC");
+            if (uEDX & RT_BIT(7))   pHlp->pfnPrintf(pHlp, " HWPSTATE");
+            if (uEDX & RT_BIT(8))   pHlp->pfnPrintf(pHlp, " TscInvariant");
+            if (uEDX & RT_BIT(9))   pHlp->pfnPrintf(pHlp, " CPB");
+            if (uEDX & RT_BIT(10))  pHlp->pfnPrintf(pHlp, " EffFreqRO");
+            if (uEDX & RT_BIT(11))  pHlp->pfnPrintf(pHlp, " PFI");
+            if (uEDX & RT_BIT(12))  pHlp->pfnPrintf(pHlp, " PA");
+            for (unsigned iBit = 13; iBit < 32; iBit++)
+                if (uEDX & RT_BIT(iBit))
+                    pHlp->pfnPrintf(pHlp, " %d", iBit);
+            pHlp->pfnPrintf(pHlp, "\n");
+
+            ASMCpuIdExSlow(UINT32_C(0x80000007), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+            pHlp->pfnPrintf(pHlp, "Host Invariant-TSC support:      %RTbool\n",
+                            cHstMax >= UINT32_C(0x80000007) && (Host.uEdx & RT_BIT(8)));
+
+        }
+
+        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0x80000008), 0)) != NULL)
+        {
+            uint32_t uEAX = pCurLeaf->uEax;
+            uint32_t uECX = pCurLeaf->uEcx;
+
+            pHlp->pfnPrintf(pHlp,
+                            "Physical Address Width:          %d bits\n"
+                            "Virtual Address Width:           %d bits\n"
+                            "Guest Physical Address Width:    %d bits\n",
+                            (uEAX >> 0) & 0xff,
+                            (uEAX >> 8) & 0xff,
+                            (uEAX >> 16) & 0xff);
+            pHlp->pfnPrintf(pHlp,
+                            "Physical Core Count:             %d\n",
+                            (uECX >> 0) & 0xff);
+        }
+
+        pCurLeaf = pNextLeaf;
+    }
+
+
+
+    /*
+     * Centaur.
+     */
+    pCurLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, UINT32_C(0xbfffffff), "Unknown CPUID Leaves");
+
+    ASMCpuIdExSlow(UINT32_C(0xc0000000), 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+    cHstMax  = Host.uEax >= UINT32_C(0xc0000001) && Host.uEax <= UINT32_C(0xc0000fff)
+             ? RT_MIN(Host.uEax,      UINT32_C(0xc0000fff)) : 0;
+    cGstMax  = (uintptr_t)(pCurLeaf - paLeaves) < cLeaves && pCurLeaf->uLeaf == UINT32_C(0xc0000000)
+             ? RT_MIN(pCurLeaf->uEax, UINT32_C(0xc0000fff)) : 0;
+    cMax     = RT_MAX(cHstMax, cGstMax);
+    if (cMax >= UINT32_C(0xc0000000))
+    {
+        pNextLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, cMax, "Raw Centaur CPUID Leaves");
+
+        /*
+         * Understandable output
+         */
+        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0xc0000000), 0)) != NULL)
+            pHlp->pfnPrintf(pHlp,
+                            "Centaur Supports:                0xc0000000-%#010x\n",
+                            pCurLeaf->uEax);
+
+        if (iVerbosity && (pCurLeaf = cpumR3CpuIdGetLeaf(paLeaves, cLeaves, UINT32_C(0xc0000001), 0)) != NULL)
+        {
+            ASMCpuIdExSlow(0xc0000001, 0, 0, 0, &Host.uEax, &Host.uEbx, &Host.uEcx, &Host.uEdx);
+            uint32_t uEdxGst = pCurLeaf->uEdx;
+            uint32_t uEdxHst = Host.uEdx;
+
+            if (iVerbosity == 1)
+            {
+                pHlp->pfnPrintf(pHlp, "Centaur Features EDX:           ");
+                if (uEdxGst & RT_BIT(0))   pHlp->pfnPrintf(pHlp, " AIS");
+                if (uEdxGst & RT_BIT(1))   pHlp->pfnPrintf(pHlp, " AIS-E");
+                if (uEdxGst & RT_BIT(2))   pHlp->pfnPrintf(pHlp, " RNG");
+                if (uEdxGst & RT_BIT(3))   pHlp->pfnPrintf(pHlp, " RNG-E");
+                if (uEdxGst & RT_BIT(4))   pHlp->pfnPrintf(pHlp, " LH");
+                if (uEdxGst & RT_BIT(5))   pHlp->pfnPrintf(pHlp, " FEMMS");
+                if (uEdxGst & RT_BIT(6))   pHlp->pfnPrintf(pHlp, " ACE");
+                if (uEdxGst & RT_BIT(7))   pHlp->pfnPrintf(pHlp, " ACE-E");
+                /* possibly indicating MM/HE and MM/HE-E on older chips... */
+                if (uEdxGst & RT_BIT(8))   pHlp->pfnPrintf(pHlp, " ACE2");
+                if (uEdxGst & RT_BIT(9))   pHlp->pfnPrintf(pHlp, " ACE2-E");
+                if (uEdxGst & RT_BIT(10))  pHlp->pfnPrintf(pHlp, " PHE");
+                if (uEdxGst & RT_BIT(11))  pHlp->pfnPrintf(pHlp, " PHE-E");
+                if (uEdxGst & RT_BIT(12))  pHlp->pfnPrintf(pHlp, " PMM");
+                if (uEdxGst & RT_BIT(13))  pHlp->pfnPrintf(pHlp, " PMM-E");
+                for (unsigned iBit = 14; iBit < 32; iBit++)
+                    if (uEdxGst & RT_BIT(iBit))
+                        pHlp->pfnPrintf(pHlp, " %d", iBit);
+                pHlp->pfnPrintf(pHlp, "\n");
+            }
+            else
+            {
+                pHlp->pfnPrintf(pHlp, "Mnemonic - Description                 = guest (host)\n");
+                pHlp->pfnPrintf(pHlp, "AIS - Alternate Instruction Set        = %d (%d)\n",  !!(uEdxGst & RT_BIT( 0)),  !!(uEdxHst & RT_BIT( 0)));
+                pHlp->pfnPrintf(pHlp, "AIS-E - AIS enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT( 1)),  !!(uEdxHst & RT_BIT( 1)));
+                pHlp->pfnPrintf(pHlp, "RNG - Random Number Generator          = %d (%d)\n",  !!(uEdxGst & RT_BIT( 2)),  !!(uEdxHst & RT_BIT( 2)));
+                pHlp->pfnPrintf(pHlp, "RNG-E - RNG enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT( 3)),  !!(uEdxHst & RT_BIT( 3)));
+                pHlp->pfnPrintf(pHlp, "LH - LongHaul MSR 0000_110Ah           = %d (%d)\n",  !!(uEdxGst & RT_BIT( 4)),  !!(uEdxHst & RT_BIT( 4)));
+                pHlp->pfnPrintf(pHlp, "FEMMS - FEMMS                          = %d (%d)\n",  !!(uEdxGst & RT_BIT( 5)),  !!(uEdxHst & RT_BIT( 5)));
+                pHlp->pfnPrintf(pHlp, "ACE - Advanced Cryptography Engine     = %d (%d)\n",  !!(uEdxGst & RT_BIT( 6)),  !!(uEdxHst & RT_BIT( 6)));
+                pHlp->pfnPrintf(pHlp, "ACE-E - ACE enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT( 7)),  !!(uEdxHst & RT_BIT( 7)));
+                /* possibly indicating MM/HE and MM/HE-E on older chips... */
+                pHlp->pfnPrintf(pHlp, "ACE2 - Advanced Cryptography Engine 2  = %d (%d)\n",  !!(uEdxGst & RT_BIT( 8)),  !!(uEdxHst & RT_BIT( 8)));
+                pHlp->pfnPrintf(pHlp, "ACE2-E - ACE enabled                   = %d (%d)\n",  !!(uEdxGst & RT_BIT( 9)),  !!(uEdxHst & RT_BIT( 9)));
+                pHlp->pfnPrintf(pHlp, "PHE - Padlock Hash Engine              = %d (%d)\n",  !!(uEdxGst & RT_BIT(10)),  !!(uEdxHst & RT_BIT(10)));
+                pHlp->pfnPrintf(pHlp, "PHE-E - PHE enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT(11)),  !!(uEdxHst & RT_BIT(11)));
+                pHlp->pfnPrintf(pHlp, "PMM - Montgomery Multiplier            = %d (%d)\n",  !!(uEdxGst & RT_BIT(12)),  !!(uEdxHst & RT_BIT(12)));
+                pHlp->pfnPrintf(pHlp, "PMM-E - PMM enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT(13)),  !!(uEdxHst & RT_BIT(13)));
+                pHlp->pfnPrintf(pHlp, "14 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(14)),  !!(uEdxHst & RT_BIT(14)));
+                pHlp->pfnPrintf(pHlp, "15 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(15)),  !!(uEdxHst & RT_BIT(15)));
+                pHlp->pfnPrintf(pHlp, "Parallax                               = %d (%d)\n",  !!(uEdxGst & RT_BIT(16)),  !!(uEdxHst & RT_BIT(16)));
+                pHlp->pfnPrintf(pHlp, "Parallax enabled                       = %d (%d)\n",  !!(uEdxGst & RT_BIT(17)),  !!(uEdxHst & RT_BIT(17)));
+                pHlp->pfnPrintf(pHlp, "Overstress                             = %d (%d)\n",  !!(uEdxGst & RT_BIT(18)),  !!(uEdxHst & RT_BIT(18)));
+                pHlp->pfnPrintf(pHlp, "Overstress enabled                     = %d (%d)\n",  !!(uEdxGst & RT_BIT(19)),  !!(uEdxHst & RT_BIT(19)));
+                pHlp->pfnPrintf(pHlp, "TM3 - Temperature Monitoring 3         = %d (%d)\n",  !!(uEdxGst & RT_BIT(20)),  !!(uEdxHst & RT_BIT(20)));
+                pHlp->pfnPrintf(pHlp, "TM3-E - TM3 enabled                    = %d (%d)\n",  !!(uEdxGst & RT_BIT(21)),  !!(uEdxHst & RT_BIT(21)));
+                pHlp->pfnPrintf(pHlp, "RNG2 - Random Number Generator 2       = %d (%d)\n",  !!(uEdxGst & RT_BIT(22)),  !!(uEdxHst & RT_BIT(22)));
+                pHlp->pfnPrintf(pHlp, "RNG2-E - RNG2 enabled                  = %d (%d)\n",  !!(uEdxGst & RT_BIT(23)),  !!(uEdxHst & RT_BIT(23)));
+                pHlp->pfnPrintf(pHlp, "24 - Reserved                          = %d (%d)\n",  !!(uEdxGst & RT_BIT(24)),  !!(uEdxHst & RT_BIT(24)));
+                pHlp->pfnPrintf(pHlp, "PHE2 - Padlock Hash Engine 2           = %d (%d)\n",  !!(uEdxGst & RT_BIT(25)),  !!(uEdxHst & RT_BIT(25)));
+                pHlp->pfnPrintf(pHlp, "PHE2-E - PHE2 enabled                  = %d (%d)\n",  !!(uEdxGst & RT_BIT(26)),  !!(uEdxHst & RT_BIT(26)));
+                for (unsigned iBit = 27; iBit < 32; iBit++)
+                    if ((uEdxGst | uEdxHst) & RT_BIT(iBit))
+                        pHlp->pfnPrintf(pHlp, "Bit %d                                 = %d (%d)\n", iBit, !!(uEdxGst & RT_BIT(iBit)), !!(uEdxHst & RT_BIT(iBit)));
+                pHlp->pfnPrintf(pHlp, "\n");
+            }
+        }
+
+        pCurLeaf = pNextLeaf;
+    }
+
+    /*
+     * The remainder.
+     */
+    pCurLeaf = cpumR3CpuIdInfoRawRange(pHlp, paLeaves, cLeaves, pCurLeaf, UINT32_C(0xffffffff), "Unknown CPUID Leaves");
+}
+
+
+
+
+
+/*
+ *
+ *
+ * PATM interfaces.
+ * PATM interfaces.
+ * PATM interfaces.
+ *
+ *
+ */
+
+
+# if defined(VBOX_WITH_RAW_MODE) || defined(DOXYGEN_RUNNING)
+/** @name Patchmanager CPUID legacy table APIs
+ * @{
+ */
+
+/**
+ * Gets a pointer to the default CPUID leaf.
+ *
+ * @returns Raw-mode pointer to the default CPUID leaf (read-only).
+ * @param   pVM         Pointer to the VM.
+ * @remark  Intended for PATM only.
+ */
+VMMR3_INT_DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdPatmDefRCPtr(PVM pVM)
+{
+    return (RCPTRTYPE(PCCPUMCPUID))VM_RC_ADDR(pVM, &pVM->cpum.s.GuestInfo.DefCpuId);
+}
+
+
+/**
+ * Gets a number of standard CPUID leaves (PATM only).
+ *
+ * @returns Number of leaves.
+ * @param   pVM         Pointer to the VM.
+ * @remark  Intended for PATM - legacy, don't use in new code.
+ */
+VMMR3_INT_DECL(uint32_t) CPUMR3GetGuestCpuIdPatmStdMax(PVM pVM)
+{
+    return RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmStd);
+}
+
+
+/**
+ * Gets a number of extended CPUID leaves (PATM only).
+ *
+ * @returns Number of leaves.
+ * @param   pVM         Pointer to the VM.
+ * @remark  Intended for PATM - legacy, don't use in new code.
+ */
+VMMR3_INT_DECL(uint32_t) CPUMR3GetGuestCpuIdPatmExtMax(PVM pVM)
+{
+    return RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmExt);
+}
+
+
+/**
+ * Gets a number of centaur CPUID leaves.
+ *
+ * @returns Number of leaves.
+ * @param   pVM         Pointer to the VM.
+ * @remark  Intended for PATM - legacy, don't use in new code.
+ */
+VMMR3_INT_DECL(uint32_t) CPUMR3GetGuestCpuIdPatmCentaurMax(PVM pVM)
+{
+    return RT_ELEMENTS(pVM->cpum.s.aGuestCpuIdPatmCentaur);
+}
+
+
+/**
+ * Gets a pointer to the array of standard CPUID leaves.
+ *
+ * CPUMR3GetGuestCpuIdStdMax() give the size of the array.
+ *
+ * @returns Raw-mode pointer to the standard CPUID leaves (read-only).
+ * @param   pVM         Pointer to the VM.
+ * @remark  Intended for PATM - legacy, don't use in new code.
+ */
+VMMR3_INT_DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdPatmStdRCPtr(PVM pVM)
+{
+    return RCPTRTYPE(PCCPUMCPUID)VM_RC_ADDR(pVM, &pVM->cpum.s.aGuestCpuIdPatmStd[0]);
+}
+
+
+/**
+ * Gets a pointer to the array of extended CPUID leaves.
+ *
+ * CPUMGetGuestCpuIdExtMax() give the size of the array.
+ *
+ * @returns Raw-mode pointer to the extended CPUID leaves (read-only).
+ * @param   pVM         Pointer to the VM.
+ * @remark  Intended for PATM - legacy, don't use in new code.
+ */
+VMMR3_INT_DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdPatmExtRCPtr(PVM pVM)
+{
+    return (RCPTRTYPE(PCCPUMCPUID))VM_RC_ADDR(pVM, &pVM->cpum.s.aGuestCpuIdPatmExt[0]);
+}
+
+
+/**
+ * Gets a pointer to the array of centaur CPUID leaves.
+ *
+ * CPUMGetGuestCpuIdCentaurMax() give the size of the array.
+ *
+ * @returns Raw-mode pointer to the centaur CPUID leaves (read-only).
+ * @param   pVM         Pointer to the VM.
+ * @remark  Intended for PATM - legacy, don't use in new code.
+ */
+VMMR3_INT_DECL(RCPTRTYPE(PCCPUMCPUID)) CPUMR3GetGuestCpuIdPatmCentaurRCPtr(PVM pVM)
+{
+    return (RCPTRTYPE(PCCPUMCPUID))VM_RC_ADDR(pVM, &pVM->cpum.s.aGuestCpuIdPatmCentaur[0]);
+}
+
+/** @} */
+# endif /* VBOX_WITH_RAW_MODE || DOXYGEN_RUNNING */
+
+#endif /* VBOX_IN_VMM */
+
diff --git a/src/VBox/VMM/VMMR3/CPUMR3Db.cpp b/src/VBox/VMM/VMMR3/CPUMR3Db.cpp
index 26cfb85..1e4243c 100644
--- a/src/VBox/VMM/VMMR3/CPUMR3Db.cpp
+++ b/src/VBox/VMM/VMMR3/CPUMR3Db.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -22,6 +22,7 @@
 #include <VBox/vmm/cpum.h>
 #include "CPUMInternal.h"
 #include <VBox/vmm/vm.h>
+#include <VBox/vmm/mm.h>
 
 #include <VBox/err.h>
 #include <iprt/asm-amd64-x86.h>
@@ -60,7 +61,7 @@ typedef struct CPUMDBENTRY
     /** The number of CPUID leaves in the array paCpuIdLeaves points to. */
     uint32_t        cCpuIdLeaves;
     /** The method used to deal with unknown CPUID leaves. */
-    CPUMUKNOWNCPUID enmUnknownCpuId;
+    CPUMUNKNOWNCPUID enmUnknownCpuId;
     /** The default unknown CPUID value. */
     CPUMCPUID       DefUnknownCpuId;
 
@@ -296,25 +297,70 @@ static uint32_t cpumR3MsrRangesBinSearch(PCCPUMMSRRANGE paMsrRanges, uint32_t cM
  *
  * @returns Pointer to the MSR ranges on success, NULL on failure.  On failure
  *          @a *ppaMsrRanges is freed and set to NULL.
+ * @param   pVM             Pointer to the VM, used as the heap selector.
+ *                          Passing NULL uses the host-context heap, otherwise
+ *                          the VM's hyper heap is used.
  * @param   ppaMsrRanges    The variable pointing to the ranges (input/output).
  * @param   cMsrRanges      The current number of ranges.
  * @param   cNewRanges      The number of ranges to be added.
  */
-static PCPUMMSRRANGE cpumR3MsrRangesEnsureSpace(PCPUMMSRRANGE *ppaMsrRanges, uint32_t cMsrRanges, uint32_t cNewRanges)
+static PCPUMMSRRANGE cpumR3MsrRangesEnsureSpace(PVM pVM, PCPUMMSRRANGE *ppaMsrRanges, uint32_t cMsrRanges, uint32_t cNewRanges)
 {
-    uint32_t cMsrRangesAllocated = RT_ALIGN_32(cMsrRanges, 16);
+    uint32_t cMsrRangesAllocated;
+    if (!pVM)
+        cMsrRangesAllocated = RT_ALIGN_32(cMsrRanges, 16);
+    else
+    {
+        /*
+         * We're using the hyper heap now, but when the range array was copied over to it from
+         * the host-context heap, we only copy the exact size and not the ensured size.
+         * See @bugref{7270}.
+         */
+        cMsrRangesAllocated = cMsrRanges;
+    }
     if (cMsrRangesAllocated < cMsrRanges + cNewRanges)
     {
+        void    *pvNew;
         uint32_t cNew = RT_ALIGN_32(cMsrRanges + cNewRanges, 16);
-        void *pvNew = RTMemRealloc(*ppaMsrRanges, cNew * sizeof(**ppaMsrRanges));
-        if (!pvNew)
+        if (pVM)
+        {
+            Assert(ppaMsrRanges == &pVM->cpum.s.GuestInfo.paMsrRangesR3);
+            Assert(cMsrRanges   == pVM->cpum.s.GuestInfo.cMsrRanges);
+
+            size_t cb    = cMsrRangesAllocated * sizeof(**ppaMsrRanges);
+            size_t cbNew = cNew * sizeof(**ppaMsrRanges);
+            int rc = MMR3HyperRealloc(pVM, *ppaMsrRanges, cb, 32, MM_TAG_CPUM_MSRS, cbNew, &pvNew);
+            if (RT_FAILURE(rc))
+            {
+                *ppaMsrRanges = NULL;
+                pVM->cpum.s.GuestInfo.paMsrRangesR0 = NIL_RTR0PTR;
+                pVM->cpum.s.GuestInfo.paMsrRangesRC = NIL_RTRCPTR;
+                LogRel(("CPUM: cpumR3MsrRangesEnsureSpace: MMR3HyperRealloc failed. rc=%Rrc\n", rc));
+                return NULL;
+            }
+            *ppaMsrRanges = (PCPUMMSRRANGE)pvNew;
+        }
+        else
         {
-            RTMemFree(*ppaMsrRanges);
-            *ppaMsrRanges = NULL;
-            return NULL;
+            pvNew = RTMemRealloc(*ppaMsrRanges, cNew * sizeof(**ppaMsrRanges));
+            if (!pvNew)
+            {
+                RTMemFree(*ppaMsrRanges);
+                *ppaMsrRanges = NULL;
+                return NULL;
+            }
         }
         *ppaMsrRanges = (PCPUMMSRRANGE)pvNew;
     }
+
+    if (pVM)
+    {
+        /* Update R0 and RC pointers. */
+        Assert(ppaMsrRanges == &pVM->cpum.s.GuestInfo.paMsrRangesR3);
+        pVM->cpum.s.GuestInfo.paMsrRangesR0 = MMHyperR3ToR0(pVM, *ppaMsrRanges);
+        pVM->cpum.s.GuestInfo.paMsrRangesRC = MMHyperR3ToRC(pVM, *ppaMsrRanges);
+    }
+
     return *ppaMsrRanges;
 }
 
@@ -329,26 +375,43 @@ static PCPUMMSRRANGE cpumR3MsrRangesEnsureSpace(PCPUMMSRRANGE *ppaMsrRanges, uin
  * @retval  VINF_SUCCESS
  * @retval  VERR_NO_MEMORY
  *
+ * @param   pVM             Pointer to the VM, used as the heap selector.
+ *                          Passing NULL uses the host-context heap, otherwise
+ *                          the hyper heap.
  * @param   ppaMsrRanges    The variable pointing to the ranges (input/output).
- * @param   pcMsrRanges     The variable holding number of ranges.
+ *                          Must be NULL if using the hyper heap.
+ * @param   pcMsrRanges     The variable holding number of ranges. Must be NULL
+ *                          if using the hyper heap.
  * @param   pNewRange       The new range.
  */
-int cpumR3MsrRangesInsert(PCPUMMSRRANGE *ppaMsrRanges, uint32_t *pcMsrRanges, PCCPUMMSRRANGE pNewRange)
+int cpumR3MsrRangesInsert(PVM pVM, PCPUMMSRRANGE *ppaMsrRanges, uint32_t *pcMsrRanges, PCCPUMMSRRANGE pNewRange)
 {
-    uint32_t        cMsrRanges  = *pcMsrRanges;
-    PCPUMMSRRANGE   paMsrRanges = *ppaMsrRanges;
-
     Assert(pNewRange->uLast >= pNewRange->uFirst);
     Assert(pNewRange->enmRdFn > kCpumMsrRdFn_Invalid && pNewRange->enmRdFn < kCpumMsrRdFn_End);
     Assert(pNewRange->enmWrFn > kCpumMsrWrFn_Invalid && pNewRange->enmWrFn < kCpumMsrWrFn_End);
 
     /*
+     * Validate and use the VM's MSR ranges array if we are using the hyper heap.
+     */
+    if (pVM)
+    {
+        AssertReturn(!ppaMsrRanges, VERR_INVALID_PARAMETER);
+        AssertReturn(!pcMsrRanges,  VERR_INVALID_PARAMETER);
+
+        ppaMsrRanges = &pVM->cpum.s.GuestInfo.paMsrRangesR3;
+        pcMsrRanges  = &pVM->cpum.s.GuestInfo.cMsrRanges;
+    }
+
+    uint32_t        cMsrRanges  = *pcMsrRanges;
+    PCPUMMSRRANGE   paMsrRanges = *ppaMsrRanges;
+
+    /*
      * Optimize the linear insertion case where we add new entries at the end.
      */
     if (   cMsrRanges > 0
         && paMsrRanges[cMsrRanges - 1].uLast < pNewRange->uFirst)
     {
-        paMsrRanges = cpumR3MsrRangesEnsureSpace(ppaMsrRanges, cMsrRanges, 1);
+        paMsrRanges = cpumR3MsrRangesEnsureSpace(pVM, ppaMsrRanges, cMsrRanges, 1);
         if (!paMsrRanges)
             return VERR_NO_MEMORY;
         paMsrRanges[cMsrRanges] = *pNewRange;
@@ -366,7 +429,7 @@ int cpumR3MsrRangesInsert(PCPUMMSRRANGE *ppaMsrRanges, uint32_t *pcMsrRanges, PC
         if (   i >= cMsrRanges
             || pNewRange->uLast < paMsrRanges[i].uFirst)
         {
-            paMsrRanges = cpumR3MsrRangesEnsureSpace(ppaMsrRanges, cMsrRanges, 1);
+            paMsrRanges = cpumR3MsrRangesEnsureSpace(pVM, ppaMsrRanges, cMsrRanges, 1);
             if (!paMsrRanges)
                 return VERR_NO_MEMORY;
             if (i < cMsrRanges)
@@ -386,7 +449,7 @@ int cpumR3MsrRangesInsert(PCPUMMSRRANGE *ppaMsrRanges, uint32_t *pcMsrRanges, PC
         else if (   pNewRange->uFirst > paMsrRanges[i].uFirst
                  && pNewRange->uLast  < paMsrRanges[i].uLast)
         {
-            paMsrRanges = cpumR3MsrRangesEnsureSpace(ppaMsrRanges, cMsrRanges, 2);
+            paMsrRanges = cpumR3MsrRangesEnsureSpace(pVM, ppaMsrRanges, cMsrRanges, 2);
             if (!paMsrRanges)
                 return VERR_NO_MEMORY;
             if (i < cMsrRanges)
@@ -446,7 +509,7 @@ int cpumR3MsrRangesInsert(PCPUMMSRRANGE *ppaMsrRanges, uint32_t *pcMsrRanges, PC
             }
 
             /* Now, perform a normal insertion. */
-            paMsrRanges = cpumR3MsrRangesEnsureSpace(ppaMsrRanges, cMsrRanges, 1);
+            paMsrRanges = cpumR3MsrRangesEnsureSpace(pVM, ppaMsrRanges, cMsrRanges, 1);
             if (!paMsrRanges)
                 return VERR_NO_MEMORY;
             if (i < cMsrRanges)
@@ -474,7 +537,7 @@ static int cpumR3MsrApplyFudgeTable(PVM pVM, PCCPUMMSRRANGE paRanges, size_t cRa
         if (!cpumLookupMsrRange(pVM, paRanges[i].uFirst))
         {
             LogRel(("CPUM: MSR fudge: %#010x %s\n", paRanges[i].uFirst, paRanges[i].szName));
-            int rc = cpumR3MsrRangesInsert(&pVM->cpum.s.GuestInfo.paMsrRangesR3, &pVM->cpum.s.GuestInfo.cMsrRanges,
+            int rc = cpumR3MsrRangesInsert(NULL /* pVM */, &pVM->cpum.s.GuestInfo.paMsrRangesR3, &pVM->cpum.s.GuestInfo.cMsrRanges,
                                            &paRanges[i]);
             if (RT_FAILURE(rc))
                 return rc;
@@ -623,14 +686,14 @@ int cpumR3DbGetCpuInfo(const char *pszName, PCPUMINFO pInfo)
         }
 
         if (pEntry)
-            LogRel(("CPUM: Matched host CPU %s %#x/%#x/%#x %s with CPU DB entry '%s' (%s %#x/%#x/%#x %s).\n",
+            LogRel(("CPUM: Matched host CPU %s %#x/%#x/%#x %s with CPU DB entry '%s' (%s %#x/%#x/%#x %s)\n",
                     CPUMR3CpuVendorName(enmVendor), uFamily, uModel, uStepping, CPUMR3MicroarchName(enmMicroarch),
                     pEntry->pszName,  CPUMR3CpuVendorName((CPUMCPUVENDOR)pEntry->enmVendor), pEntry->uFamily, pEntry->uModel,
                     pEntry->uStepping, CPUMR3MicroarchName(pEntry->enmMicroarch) ));
         else
         {
             pEntry = g_apCpumDbEntries[0];
-            LogRel(("CPUM: No matching processor database entry %s %#x/%#x/%#x %s, falling back on '%s'.\n",
+            LogRel(("CPUM: No matching processor database entry %s %#x/%#x/%#x %s, falling back on '%s'\n",
                     CPUMR3CpuVendorName(enmVendor), uFamily, uModel, uStepping, CPUMR3MicroarchName(enmMicroarch),
                     pEntry->pszName));
         }
@@ -669,7 +732,7 @@ int cpumR3DbGetCpuInfo(const char *pszName, PCPUMINFO pInfo)
         pInfo->enmUnknownCpuIdMethod = pEntry->enmUnknownCpuId;
         pInfo->DefCpuId         = pEntry->DefUnknownCpuId;
 
-        LogRel(("CPUM: Using CPU DB entry '%s' (%s %#x/%#x/%#x %s).\n",
+        LogRel(("CPUM: Using CPU DB entry '%s' (%s %#x/%#x/%#x %s)\n",
                 pEntry->pszName, CPUMR3CpuVendorName((CPUMCPUVENDOR)pEntry->enmVendor),
                 pEntry->uFamily, pEntry->uModel, pEntry->uStepping, CPUMR3MicroarchName(pEntry->enmMicroarch) ));
     }
@@ -693,7 +756,7 @@ int cpumR3DbGetCpuInfo(const char *pszName, PCPUMINFO pInfo)
     uint32_t        cLeft   = pEntry->cMsrRanges;
     while (cLeft-- > 0)
     {
-        rc = cpumR3MsrRangesInsert(&paMsrs, &cMsrs, pCurMsr);
+        rc = cpumR3MsrRangesInsert(NULL /* pVM */, &paMsrs, &cMsrs, pCurMsr);
         if (RT_FAILURE(rc))
         {
             Assert(!paMsrs); /* The above function frees this. */
@@ -711,6 +774,25 @@ int cpumR3DbGetCpuInfo(const char *pszName, PCPUMINFO pInfo)
 
 
 /**
+ * Insert an MSR range into the VM.
+ *
+ * If the new MSR range overlaps existing ranges, the existing ones will be
+ * adjusted/removed to fit in the new one.
+ *
+ * @returns VBox status code.
+ * @param   pVM                 Pointer to the cross context VM structure.
+ * @param   pNewRange           Pointer to the MSR range being inserted.
+ */
+VMMR3DECL(int) CPUMR3MsrRangesInsert(PVM pVM, PCCPUMMSRRANGE pNewRange)
+{
+    AssertReturn(pVM, VERR_INVALID_PARAMETER);
+    AssertReturn(pNewRange, VERR_INVALID_PARAMETER);
+
+    return cpumR3MsrRangesInsert(pVM, NULL /* ppaMsrRanges */, NULL /* pcMsrRanges */, pNewRange);
+}
+
+
+/**
  * Register statistics for the MSRs.
  *
  * This must not be called before the MSRs have been finalized and moved to the
diff --git a/src/VBox/VMM/VMMR3/CSAM.cpp b/src/VBox/VMM/VMMR3/CSAM.cpp
index 86cce49..bdf3a98 100644
--- a/src/VBox/VMM/VMMR3/CSAM.cpp
+++ b/src/VBox/VMM/VMMR3/CSAM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -69,10 +69,10 @@
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-static DECLCALLBACK(int) csamr3Save(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
-static DECLCALLBACK(int) CSAMCodePageWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
-static DECLCALLBACK(int) CSAMCodePageInvalidate(PVM pVM, RTGCPTR GCPtr);
+static DECLCALLBACK(int) csamR3Save(PVM pVM, PSSMHANDLE pSSM);
+static DECLCALLBACK(int) csamR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
+static FNPGMR3VIRTHANDLER    csamR3CodePageWriteHandler;
+static FNPGMR3VIRTINVALIDATE csamR3CodePageInvalidate;
 
 bool                csamIsCodeScanned(PVM pVM, RTRCPTR pInstr, PCSAMPAGE *pPage);
 int                 csamR3CheckPageRecord(PVM pVM, RTRCPTR pInstr);
@@ -83,8 +83,8 @@ static void         csamMarkCode(PVM pVM, PCSAMPAGE pPage, RTRCPTR pInstr, uint3
 static int          csamAnalyseCodeStream(PVM pVM, RCPTRTYPE(uint8_t *) pInstrGC, RCPTRTYPE(uint8_t *) pCurInstrGC, bool fCode32,
                                           PFN_CSAMR3ANALYSE pfnCSAMR3Analyse, void *pUserData, PCSAMP2GLOOKUPREC pCacheRec);
 
-/** @todo Temporary for debugging. */
-static bool fInCSAMCodePageInvalidate = false;
+/** @todo "Temporary" for debugging. */
+static bool g_fInCsamR3CodePageInvalidate = false;
 
 #ifdef VBOX_WITH_DEBUGGER
 static FNDBGCCMD csamr3CmdOn;
@@ -250,12 +250,30 @@ VMMR3_INT_DECL(int) CSAMR3Init(PVM pVM)
     AssertRCReturn(rc, rc);
 
     /*
+     * Register virtual handler types.
+     */
+    rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_WRITE, false /*fRelocUserRC*/,
+                                         NULL /*pfnInvalidateR3 */,
+                                         csamR3CodePageWriteHandler,
+                                         "csamRCCodePageWritePfHandler",
+                                         "CSAM code page write handler",
+                                         &pVM->csam.s.hCodePageWriteType);
+    AssertLogRelRCReturn(rc, rc);
+    rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_WRITE, false /*fRelocUserRC*/,
+                                         csamR3CodePageInvalidate,
+                                         csamR3CodePageWriteHandler,
+                                         "csamRCCodePageWritePfHandler",
+                                         "CSAM code page write and invlpg handler",
+                                         &pVM->csam.s.hCodePageWriteAndInvPgType);
+    AssertLogRelRCReturn(rc, rc);
+
+    /*
      * Register save and load state notifiers.
      */
-    rc = SSMR3RegisterInternal(pVM, "CSAM", 0, CSAM_SSM_VERSION, sizeof(pVM->csam.s) + PAGE_SIZE*16,
+    rc = SSMR3RegisterInternal(pVM, "CSAM", 0, CSAM_SAVED_STATE_VERSION, sizeof(pVM->csam.s) + PAGE_SIZE*16,
                                NULL, NULL, NULL,
-                               NULL, csamr3Save, NULL,
-                               NULL, csamr3Load, NULL);
+                               NULL, csamR3Save, NULL,
+                               NULL, csamR3Load, NULL);
     AssertRCReturn(rc, rc);
 
     STAM_REG(pVM, &pVM->csam.s.StatNrTraps,          STAMTYPE_COUNTER,   "/CSAM/PageTraps",           STAMUNIT_OCCURENCES,     "The number of CSAM page traps.");
@@ -521,7 +539,7 @@ static DECLCALLBACK(int) SavePageState(PAVLPVNODECORE pNode, void *pVM1)
  * @param   pVM             Pointer to the VM.
  * @param   pSSM            SSM operation handle.
  */
-static DECLCALLBACK(int) csamr3Save(PVM pVM, PSSMHANDLE pSSM)
+static DECLCALLBACK(int) csamR3Save(PVM pVM, PSSMHANDLE pSSM)
 {
     CSAM csamInfo = pVM->csam.s;
     int  rc;
@@ -543,7 +561,7 @@ static DECLCALLBACK(int) csamr3Save(PVM pVM, PSSMHANDLE pSSM)
     rc = SSMR3PutMem(pSSM, csamInfo.pPDBitmapHC, CSAM_PGDIRBMP_CHUNKS*sizeof(RTHCPTR));
     AssertRCReturn(rc, rc);
 
-    for (unsigned i=0;i<CSAM_PGDIRBMP_CHUNKS;i++)
+    for (unsigned i = 0; i < CSAM_PGDIRBMP_CHUNKS; i++)
     {
         if(csamInfo.pPDBitmapHC[i])
         {
@@ -573,13 +591,13 @@ static DECLCALLBACK(int) csamr3Save(PVM pVM, PSSMHANDLE pSSM)
  * @param   uVersion        Data layout version.
  * @param   uPass           The data pass.
  */
-static DECLCALLBACK(int) csamr3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
+static DECLCALLBACK(int) csamR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
 {
     int  rc;
     CSAM csamInfo;
 
     Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
-    if (uVersion != CSAM_SSM_VERSION)
+    if (uVersion != CSAM_SAVED_STATE_VERSION)
     {
         AssertMsgFailed(("csamR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
@@ -1848,22 +1866,24 @@ static PCSAMPAGE csamCreatePageRecord(PVM pVM, RTRCPTR GCPtr, CSAMTAG enmTag, bo
     Assert(ret);
 
 #ifdef CSAM_MONITOR_CODE_PAGES
-    AssertRelease(!fInCSAMCodePageInvalidate);
+    AssertRelease(!g_fInCsamR3CodePageInvalidate);
 
     switch (enmTag)
     {
     case CSAM_TAG_PATM:
     case CSAM_TAG_REM:
-#ifdef CSAM_MONITOR_CSAM_CODE_PAGES
+# ifdef CSAM_MONITOR_CSAM_CODE_PAGES
     case CSAM_TAG_CSAM:
-#endif
-    {
-        rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, GCPtr, GCPtr + (PAGE_SIZE - 1) /* inclusive! */,
-                                         (fMonitorInvalidation) ? CSAMCodePageInvalidate : 0, CSAMCodePageWriteHandler, "CSAMGCCodePageWriteHandler", 0,
-                                         csamGetMonitorDescription(enmTag));
-        AssertMsg(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT, ("PGMR3HandlerVirtualRegisterEx %RRv failed with %Rrc\n", GCPtr, rc));
+# endif
+    {
+        rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, fMonitorInvalidation
+                                         ? pVM->csam.s.hCodePageWriteAndInvPgType : pVM->csam.s.hCodePageWriteType,
+                                         GCPtr, GCPtr + (PAGE_SIZE - 1) /* inclusive! */,
+                                         pPage, NIL_RTRCPTR, csamGetMonitorDescription(enmTag));
+        AssertMsg(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT,
+                  ("PGMR3HandlerVirtualRegister %RRv failed with %Rrc\n", GCPtr, rc));
         if (RT_FAILURE(rc))
-            Log(("PGMR3HandlerVirtualRegisterEx for %RRv failed with %Rrc\n", GCPtr, rc));
+            Log(("PGMR3HandlerVirtualRegister for %RRv failed with %Rrc\n", GCPtr, rc));
 
         /* Could fail, because it's already monitored. Don't treat that condition as fatal. */
 
@@ -1884,7 +1904,7 @@ static PCSAMPAGE csamCreatePageRecord(PVM pVM, RTRCPTR GCPtr, CSAMTAG enmTag, bo
 
     Log(("csamCreatePageRecord %RRv GCPhys=%RGp\n", GCPtr, pPage->page.GCPhys));
 
-#ifdef VBOX_WITH_STATISTICS
+# ifdef VBOX_WITH_STATISTICS
     switch (enmTag)
     {
     case CSAM_TAG_CSAM:
@@ -1899,7 +1919,7 @@ static PCSAMPAGE csamCreatePageRecord(PVM pVM, RTRCPTR GCPtr, CSAMTAG enmTag, bo
     default:
         break; /* to shut up GCC */
     }
-#endif
+# endif
 
 #endif
 
@@ -1920,7 +1940,7 @@ static PCSAMPAGE csamCreatePageRecord(PVM pVM, RTRCPTR GCPtr, CSAMTAG enmTag, bo
  */
 VMMR3DECL(int) CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag)
 {
-    PCSAMPAGEREC pPageRec = NULL;
+    ;
     int          rc;
     bool         fMonitorInvalidation;
     Assert(pVM->cCpus == 1);
@@ -1940,7 +1960,7 @@ VMMR3DECL(int) CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag)
     /** @todo implicit assumption */
     fMonitorInvalidation = (enmTag == CSAM_TAG_PATM);
 
-    pPageRec = (PCSAMPAGEREC)RTAvlPVGet(&pVM->csam.s.pPageTree, (AVLPVKEY)(uintptr_t)pPageAddrGC);
+    PCSAMPAGEREC pPageRec = (PCSAMPAGEREC)RTAvlPVGet(&pVM->csam.s.pPageTree, (AVLPVKEY)(uintptr_t)pPageAddrGC);
     if (pPageRec == NULL)
     {
         uint64_t fFlags;
@@ -1971,12 +1991,14 @@ VMMR3DECL(int) CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag)
     {
         Log(("CSAMR3MonitorPage: activate monitoring for %RRv\n", pPageAddrGC));
 
-        rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, pPageAddrGC, pPageAddrGC + (PAGE_SIZE - 1) /* inclusive! */,
-                                         (fMonitorInvalidation) ? CSAMCodePageInvalidate : 0, CSAMCodePageWriteHandler, "CSAMGCCodePageWriteHandler", 0,
-                                         csamGetMonitorDescription(enmTag));
-        AssertMsg(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT, ("PGMR3HandlerVirtualRegisterEx %RRv failed with %Rrc\n", pPageAddrGC, rc));
+        rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, fMonitorInvalidation
+                                         ? pVM->csam.s.hCodePageWriteAndInvPgType : pVM->csam.s.hCodePageWriteType,
+                                         pPageAddrGC, pPageAddrGC + (PAGE_SIZE - 1) /* inclusive! */,
+                                         pPageRec, NIL_RTRCPTR /*pvUserRC*/, csamGetMonitorDescription(enmTag));
+        AssertMsg(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT,
+                  ("PGMR3HandlerVirtualRegister %RRv failed with %Rrc\n", pPageAddrGC, rc));
         if (RT_FAILURE(rc))
-            Log(("PGMR3HandlerVirtualRegisterEx for %RRv failed with %Rrc\n", pPageAddrGC, rc));
+            Log(("PGMR3HandlerVirtualRegister for %RRv failed with %Rrc\n", pPageAddrGC, rc));
 
         /* Could fail, because it's already monitored. Don't treat that condition as fatal. */
 
@@ -1997,7 +2019,8 @@ VMMR3DECL(int) CSAMR3MonitorPage(PVM pVM, RTRCPTR pPageAddrGC, CSAMTAG enmTag)
         &&  fMonitorInvalidation)
     {
         Assert(pPageRec->page.fMonitorActive);
-        PGMHandlerVirtualChangeInvalidateCallback(pVM, pPageRec->page.pPageGC, CSAMCodePageInvalidate);
+        rc = PGMHandlerVirtualChangeType(pVM, pPageRec->page.pPageGC, pVM->csam.s.hCodePageWriteAndInvPgType);
+        AssertRC(rc);
         pPageRec->page.fMonitorInvalidation = true;
         STAM_COUNTER_INC(&pVM->csam.s.StatNrPagesInv);
 
@@ -2088,9 +2111,9 @@ static int csamRemovePageRecord(PVM pVM, RTRCPTR GCPtr)
             /* @todo -> this is expensive (cr3 reload)!!!
              * if this happens often, then reuse it instead!!!
              */
-            Assert(!fInCSAMCodePageInvalidate);
+            Assert(!g_fInCsamR3CodePageInvalidate);
             STAM_COUNTER_DEC(&pVM->csam.s.StatPageMonitor);
-            PGMHandlerVirtualDeregister(pVM, GCPtr);
+            PGMHandlerVirtualDeregister(pVM, pVCpu, GCPtr, false /*fHypervisor*/);
         }
         if (pPageRec->page.enmTag == CSAM_TAG_PATM)
         {
@@ -2148,25 +2171,29 @@ static DECLCALLBACK(void) CSAMDelayedWriteHandler(PVM pVM, RTRCPTR GCPtr, size_t
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   GCPtr           The virtual address the guest is writing to. (not correct if it's an alias!)
  * @param   pvPtr           The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
+ * @param   enmOrigin       Who is making this write.
  * @param   pvUser          User argument.
  */
-static DECLCALLBACK(int) CSAMCodePageWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser)
+static DECLCALLBACK(int) csamR3CodePageWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
+                                                    PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     int rc;
 
     Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType);
-    Log(("CSAMCodePageWriteHandler: write to %RGv size=%zu\n", GCPtr, cbBuf));
+    Log(("csamR3CodePageWriteHandler: write to %RGv size=%zu\n", GCPtr, cbBuf));
     NOREF(pvUser);
 
     if (    PAGE_ADDRESS(pvPtr) == PAGE_ADDRESS((uintptr_t)pvPtr + cbBuf - 1)
          && !memcmp(pvPtr, pvBuf, cbBuf))
     {
-        Log(("CSAMCodePageWriteHandler: dummy write -> ignore\n"));
+        Log(("csamR3CodePageWriteHandler: dummy write -> ignore\n"));
         return VINF_PGM_HANDLER_DO_DEFAULT;
     }
 
@@ -2174,11 +2201,12 @@ static DECLCALLBACK(int) CSAMCodePageWriteHandler(PVM pVM, RTGCPTR GCPtr, void *
         rc = PATMR3PatchWrite(pVM, GCPtr, (uint32_t)cbBuf);
     else
     {
+        AssertFailed(); /* PGM should make sure this does not happen anymore! */
         /* Queue the write instead otherwise we'll get concurrency issues. */
         /** @note in theory not correct to let it write the data first before disabling a patch!
          *        (if it writes the same data as the patch jump and we replace it with obsolete opcodes)
          */
-        Log(("CSAMCodePageWriteHandler: delayed write!\n"));
+        Log(("csamR3CodePageWriteHandler: delayed write!\n"));
         AssertCompileSize(RTRCPTR, 4);
         rc = VMR3ReqCallVoidNoWait(pVM, VMCPUID_ANY, (PFNRT)CSAMDelayedWriteHandler, 3, pVM, (RTRCPTR)GCPtr, cbBuf);
     }
@@ -2191,15 +2219,17 @@ static DECLCALLBACK(int) CSAMCodePageWriteHandler(PVM pVM, RTGCPTR GCPtr, void *
  * \#PF Handler callback for invalidation of virtual access handler ranges.
  *
  * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPtr           The virtual address the guest has changed.
  */
-static DECLCALLBACK(int) CSAMCodePageInvalidate(PVM pVM, RTGCPTR GCPtr)
+static DECLCALLBACK(int) csamR3CodePageInvalidate(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvUser)
 {
-    fInCSAMCodePageInvalidate = true;
-    LogFlow(("CSAMCodePageInvalidate %RGv\n", GCPtr));
+    g_fInCsamR3CodePageInvalidate = true;
+    LogFlow(("csamR3CodePageInvalidate %RGv\n", GCPtr));
     /** @todo We can't remove the page (which unregisters the virtual handler) as we are called from a DoWithAll on the virtual handler tree. Argh. */
     csamFlushPage(pVM, GCPtr, false /* don't remove page! */);
-    fInCSAMCodePageInvalidate = false;
+    g_fInCsamR3CodePageInvalidate = false;
     return VINF_SUCCESS;
 }
 
@@ -2327,10 +2357,10 @@ VMMR3_INT_DECL(int) CSAMR3MarkCode(PVM pVM, RTRCPTR pInstr, uint32_t cbInstr, bo
  *
  * @returns VBox status code.
  * @param   pVM         Pointer to the VM.
- * @param   pCtxCore    CPU context
- * @param   pInstrGC    Instruction pointer
+ * @param   pCtx        Guest CPU context.
+ * @param   pInstrGC    Instruction pointer.
  */
-VMMR3_INT_DECL(int) CSAMR3CheckCodeEx(PVM pVM, PCPUMCTXCORE pCtxCore, RTRCPTR pInstrGC)
+VMMR3_INT_DECL(int) CSAMR3CheckCodeEx(PVM pVM, PCPUMCTX pCtx, RTRCPTR pInstrGC)
 {
     Assert(!HMIsEnabled(pVM));
     if (EMIsRawRing0Enabled(pVM) == false || PATMIsPatchGCAddr(pVM, pInstrGC) == true)
@@ -2344,7 +2374,7 @@ VMMR3_INT_DECL(int) CSAMR3CheckCodeEx(PVM pVM, PCPUMCTXCORE pCtxCore, RTRCPTR pI
         /* Assuming 32 bits code for now. */
         Assert(CPUMGetGuestCodeBits(VMMGetCpu0(pVM)) == 32);
 
-        pInstrGC = SELMToFlat(pVM, DISSELREG_CS, pCtxCore, pInstrGC);
+        pInstrGC = SELMToFlat(pVM, DISSELREG_CS, CPUMCTX2CORE(pCtx), pInstrGC);
         return CSAMR3CheckCode(pVM, pInstrGC);
     }
     return VINF_SUCCESS;
diff --git a/src/VBox/VMM/VMMR3/DBGF.cpp b/src/VBox/VMM/VMMR3/DBGF.cpp
index bb4c735..553095c 100644
--- a/src/VBox/VMM/VMMR3/DBGF.cpp
+++ b/src/VBox/VMM/VMMR3/DBGF.cpp
@@ -140,15 +140,43 @@ VMMR3_INT_DECL(int) DBGFR3Init(PVM pVM)
     AssertCompile(sizeof(pUVM->dbgf.s)          <= sizeof(pUVM->dbgf.padding));
     AssertCompile(sizeof(pUVM->aCpus[0].dbgf.s) <= sizeof(pUVM->aCpus[0].dbgf.padding));
 
-    int rc = dbgfR3InfoInit(pUVM);
+    /*
+     * The usual sideways mountain climbing style of init:
+     */
+    int rc = dbgfR3InfoInit(pUVM); /* (First, initalizes the shared critical section.) */
     if (RT_SUCCESS(rc))
+    {
         rc = dbgfR3TraceInit(pVM);
-    if (RT_SUCCESS(rc))
-        rc = dbgfR3RegInit(pUVM);
-    if (RT_SUCCESS(rc))
-        rc = dbgfR3AsInit(pUVM);
-    if (RT_SUCCESS(rc))
-        rc = dbgfR3BpInit(pVM);
+        if (RT_SUCCESS(rc))
+        {
+            rc = dbgfR3RegInit(pUVM);
+            if (RT_SUCCESS(rc))
+            {
+                rc = dbgfR3AsInit(pUVM);
+                if (RT_SUCCESS(rc))
+                {
+                    rc = dbgfR3BpInit(pVM);
+                    if (RT_SUCCESS(rc))
+                    {
+                        rc = dbgfR3OSInit(pUVM);
+                        if (RT_SUCCESS(rc))
+                        {
+                            rc = dbgfR3PlugInInit(pUVM);
+                            if (RT_SUCCESS(rc))
+                            {
+                                return VINF_SUCCESS;
+                            }
+                            dbgfR3OSTerm(pUVM);
+                        }
+                    }
+                    dbgfR3AsTerm(pUVM);
+                }
+                dbgfR3RegTerm(pUVM);
+            }
+            dbgfR3TraceTerm(pVM);
+        }
+        dbgfR3InfoTerm(pUVM);
+    }
     return rc;
 }
 
@@ -163,6 +191,7 @@ VMMR3_INT_DECL(int) DBGFR3Term(PVM pVM)
 {
     PUVM pUVM = pVM->pUVM;
 
+    dbgfR3PlugInTerm(pUVM);
     dbgfR3OSTerm(pUVM);
     dbgfR3AsTerm(pUVM);
     dbgfR3RegTerm(pUVM);
diff --git a/src/VBox/VMM/VMMR3/DBGFCoreWrite.cpp b/src/VBox/VMM/VMMR3/DBGFCoreWrite.cpp
index 21a4e92..797ff65 100644
--- a/src/VBox/VMM/VMMR3/DBGFCoreWrite.cpp
+++ b/src/VBox/VMM/VMMR3/DBGFCoreWrite.cpp
@@ -219,7 +219,7 @@ static int Elf64WriteNoteHdr(RTFILE hFile, uint16_t Type, const char *pszName, c
 
     /*
      * Yell loudly and bail if we are going to be writing a core file that is not compatible with
-     * both Solaris and the 64-bit ELF spec. which dictates 8-byte alignment. See @bugref{5211} comment 3.
+     * both Solaris and the 64-bit ELF spec. which dictates 8-byte alignment. See @bugref{5211} comment #3.
      */
     if (cchNameAlign - cchName > 3)
     {
@@ -240,7 +240,7 @@ static int Elf64WriteNoteHdr(RTFILE hFile, uint16_t Type, const char *pszName, c
 
     Elf64_Nhdr ElfNoteHdr;
     RT_ZERO(ElfNoteHdr);
-    ElfNoteHdr.n_namesz = (Elf64_Word)cchName - 1; /* Again a discrepancy between ELF-64 and Solaris (@bugref{5211} comment 3), we will follow ELF-64 */
+    ElfNoteHdr.n_namesz = (Elf64_Word)cchName - 1; /* Again, a discrepancy between ELF-64 and Solaris (see @bugref{5211} comment #3), we will follow ELF-64 */
     ElfNoteHdr.n_type   = Type;
     ElfNoteHdr.n_descsz = (Elf64_Word)cbDataAlign;
 
diff --git a/src/VBox/VMM/VMMR3/DBGFInfo.cpp b/src/VBox/VMM/VMMR3/DBGFInfo.cpp
index a1b0ca1..ddabf29 100644
--- a/src/VBox/VMM/VMMR3/DBGFInfo.cpp
+++ b/src/VBox/VMM/VMMR3/DBGFInfo.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -78,6 +78,9 @@ static const DBGFINFOHLP g_dbgfR3InfoStdErrHlp =
 /**
  * Initialize the info handlers.
  *
+ * This is called first during the DBGF init process and thus does the shared
+ * critsect init.
+ *
  * @returns VBox status code.
  * @param   pUVM        The user mode VM handle.
  */
@@ -86,13 +89,13 @@ int dbgfR3InfoInit(PUVM pUVM)
     /*
      * Make sure we already didn't initialized in the lazy manner.
      */
-    if (RTCritSectIsInitialized(&pUVM->dbgf.s.InfoCritSect))
+    if (RTCritSectRwIsInitialized(&pUVM->dbgf.s.CritSect))
         return VINF_SUCCESS;
 
     /*
      * Initialize the crit sect.
      */
-    int rc = RTCritSectInit(&pUVM->dbgf.s.InfoCritSect);
+    int rc = RTCritSectRwInit(&pUVM->dbgf.s.CritSect);
     AssertRCReturn(rc, rc);
 
     /*
@@ -116,7 +119,7 @@ int dbgfR3InfoTerm(PUVM pUVM)
     /*
      * Delete the crit sect.
      */
-    int rc = RTCritSectDelete(&pUVM->dbgf.s.InfoCritSect);
+    int rc = RTCritSectRwDelete(&pUVM->dbgf.s.CritSect);
     AssertRC(rc);
     return rc;
 }
@@ -208,6 +211,7 @@ VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogRelHlp(void)
 
 /**
  * Handle registration worker.
+ *
  * This allocates the structure, initializes the common fields and inserts into the list.
  * Upon successful return the we're inside the crit sect and the caller must leave it.
  *
@@ -244,14 +248,14 @@ static int dbgfR3InfoRegister(PUVM pUVM, const char *pszName, const char *pszDes
 
         /* lazy init */
         rc = VINF_SUCCESS;
-        if (!RTCritSectIsInitialized(&pUVM->dbgf.s.InfoCritSect))
+        if (!RTCritSectRwIsInitialized(&pUVM->dbgf.s.CritSect))
             rc = dbgfR3InfoInit(pUVM);
         if (RT_SUCCESS(rc))
         {
             /*
              * Insert in alphabetical order.
              */
-            rc = RTCritSectEnter(&pUVM->dbgf.s.InfoCritSect);
+            rc = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect);
             AssertRC(rc);
             PDBGFINFO pPrev = NULL;
             PDBGFINFO pCur;
@@ -307,7 +311,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoRegisterDevice(PVM pVM, const char *pszName, const
         pInfo->enmType = DBGFINFOTYPE_DEV;
         pInfo->u.Dev.pfnHandler = pfnHandler;
         pInfo->u.Dev.pDevIns = pDevIns;
-        RTCritSectLeave(&pVM->pUVM->dbgf.s.InfoCritSect);
+        RTCritSectRwLeaveExcl(&pVM->pUVM->dbgf.s.CritSect);
     }
 
     return rc;
@@ -345,7 +349,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const
         pInfo->enmType = DBGFINFOTYPE_DRV;
         pInfo->u.Drv.pfnHandler = pfnHandler;
         pInfo->u.Drv.pDrvIns = pDrvIns;
-        RTCritSectLeave(&pVM->pUVM->dbgf.s.InfoCritSect);
+        RTCritSectRwLeaveExcl(&pVM->pUVM->dbgf.s.CritSect);
     }
 
     return rc;
@@ -397,7 +401,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, c
     {
         pInfo->enmType = DBGFINFOTYPE_INT;
         pInfo->u.Int.pfnHandler = pfnHandler;
-        RTCritSectLeave(&pVM->pUVM->dbgf.s.InfoCritSect);
+        RTCritSectRwLeaveExcl(&pVM->pUVM->dbgf.s.CritSect);
     }
 
     return rc;
@@ -436,7 +440,7 @@ VMMR3DECL(int) DBGFR3InfoRegisterExternal(PUVM pUVM, const char *pszName, const
         pInfo->enmType = DBGFINFOTYPE_EXT;
         pInfo->u.Ext.pfnHandler = pfnHandler;
         pInfo->u.Ext.pvUser = pvUser;
-        RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
+        RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect);
     }
 
     return rc;
@@ -466,7 +470,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoDeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, cons
     /*
      * Enumerate the info handlers and free the requested entries.
      */
-    int rc = RTCritSectEnter(&pUVM->dbgf.s.InfoCritSect); AssertRC(rc);
+    int rc = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); AssertRC(rc);
     rc = VERR_FILE_NOT_FOUND;
     PDBGFINFO pPrev = NULL;
     PDBGFINFO pInfo = pUVM->dbgf.s.pInfoFirst;
@@ -508,7 +512,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoDeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, cons
             }
         rc = VINF_SUCCESS;
     }
-    int rc2 = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
+    int rc2 = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect);
     AssertRC(rc2);
     AssertRC(rc);
     LogFlow(("DBGFR3InfoDeregisterDevice: returns %Rrc\n", rc));
@@ -538,7 +542,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoDeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, cons
     /*
      * Enumerate the info handlers and free the requested entries.
      */
-    int rc = RTCritSectEnter(&pUVM->dbgf.s.InfoCritSect); AssertRC(rc);
+    int rc = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); AssertRC(rc);
     rc = VERR_FILE_NOT_FOUND;
     PDBGFINFO pPrev = NULL;
     PDBGFINFO pInfo = pUVM->dbgf.s.pInfoFirst;
@@ -580,7 +584,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoDeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, cons
             }
         rc = VINF_SUCCESS;
     }
-    int rc2 = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
+    int rc2 = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect);
     AssertRC(rc2);
     AssertRC(rc);
     LogFlow(("DBGFR3InfoDeregisterDriver: returns %Rrc\n", rc));
@@ -607,7 +611,7 @@ static int dbgfR3InfoDeregister(PUVM pUVM, const char *pszName, DBGFINFOTYPE enm
      * Find the info handler.
      */
     size_t cchName = strlen(pszName);
-    int rc = RTCritSectEnter(&pUVM->dbgf.s.InfoCritSect);
+    int rc = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect);
     AssertRC(rc);
     rc = VERR_FILE_NOT_FOUND;
     PDBGFINFO pPrev = NULL;
@@ -625,7 +629,7 @@ static int dbgfR3InfoDeregister(PUVM pUVM, const char *pszName, DBGFINFOTYPE enm
             rc = VINF_SUCCESS;
             break;
         }
-    int rc2 = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
+    int rc2 = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect);
     AssertRC(rc2);
     AssertRC(rc);
     LogFlow(("dbgfR3InfoDeregister: returns %Rrc\n", rc));
@@ -693,7 +697,7 @@ static DECLCALLBACK(int) dbgfR3Info(PUVM pUVM, VMCPUID idCpu, const char *pszNam
      * Find the info handler.
      */
     size_t cchName = strlen(pszName);
-    int rc = RTCritSectEnter(&pUVM->dbgf.s.InfoCritSect);
+    int rc = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect);
     AssertRC(rc);
     PDBGFINFO pInfo = pUVM->dbgf.s.pInfoFirst;
     for (; pInfo; pInfo = pInfo->pNext)
@@ -704,55 +708,52 @@ static DECLCALLBACK(int) dbgfR3Info(PUVM pUVM, VMCPUID idCpu, const char *pszNam
     {
         /*
          * Found it.
-         *      Make a copy of it on the stack so we can leave the crit sect.
-         *      Switch on the type and invoke the handler.
          */
-        DBGFINFO Info = *pInfo;
-        rc = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
-        AssertRC(rc);
         rc = VINF_SUCCESS;
-        switch (Info.enmType)
+        switch (pInfo->enmType)
         {
             case DBGFINFOTYPE_DEV:
-                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
-                    rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)Info.u.Dev.pfnHandler, 3, Info.u.Dev.pDevIns, pHlp, pszArgs);
+                if (pInfo->fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
+                    rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)pInfo->u.Dev.pfnHandler, 3, pInfo->u.Dev.pDevIns, pHlp, pszArgs);
                 else
-                    Info.u.Dev.pfnHandler(Info.u.Dev.pDevIns, pHlp, pszArgs);
+                    pInfo->u.Dev.pfnHandler(pInfo->u.Dev.pDevIns, pHlp, pszArgs);
                 break;
 
             case DBGFINFOTYPE_DRV:
-                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
-                    rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)Info.u.Drv.pfnHandler, 3, Info.u.Drv.pDrvIns, pHlp, pszArgs);
+                if (pInfo->fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
+                    rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)pInfo->u.Drv.pfnHandler, 3, pInfo->u.Drv.pDrvIns, pHlp, pszArgs);
                 else
-                    Info.u.Drv.pfnHandler(Info.u.Drv.pDrvIns, pHlp, pszArgs);
+                    pInfo->u.Drv.pfnHandler(pInfo->u.Drv.pDrvIns, pHlp, pszArgs);
                 break;
 
             case DBGFINFOTYPE_INT:
                 if (RT_VALID_PTR(pUVM->pVM))
                 {
-                    if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
-                        rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)Info.u.Int.pfnHandler, 3, pUVM->pVM, pHlp, pszArgs);
+                    if (pInfo->fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
+                        rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)pInfo->u.Int.pfnHandler, 3, pUVM->pVM, pHlp, pszArgs);
                     else
-                        Info.u.Int.pfnHandler(pUVM->pVM, pHlp, pszArgs);
+                        pInfo->u.Int.pfnHandler(pUVM->pVM, pHlp, pszArgs);
                 }
                 else
                     rc = VERR_INVALID_VM_HANDLE;
                 break;
 
             case DBGFINFOTYPE_EXT:
-                if (Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
-                    rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)Info.u.Ext.pfnHandler, 3, Info.u.Ext.pvUser, pHlp, pszArgs);
+                if (pInfo->fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)
+                    rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)pInfo->u.Ext.pfnHandler, 3, pInfo->u.Ext.pvUser, pHlp, pszArgs);
                 else
-                    Info.u.Ext.pfnHandler(Info.u.Ext.pvUser, pHlp, pszArgs);
+                    pInfo->u.Ext.pfnHandler(pInfo->u.Ext.pvUser, pHlp, pszArgs);
                 break;
 
             default:
-                AssertMsgFailedReturn(("Invalid info type enmType=%d\n", Info.enmType), VERR_IPE_NOT_REACHED_DEFAULT_CASE);
+                AssertMsgFailedReturn(("Invalid info type enmType=%d\n", pInfo->enmType), VERR_IPE_NOT_REACHED_DEFAULT_CASE);
         }
+        int rc2 = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect);
+        AssertRC(rc2);
     }
     else
     {
-        rc = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
+        rc = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect);
         AssertRC(rc);
         rc = VERR_FILE_NOT_FOUND;
     }
@@ -866,7 +867,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoMulti(PVM pVM, const char *pszIncludePat, const ch
      * Enumerate the info handlers and call the ones matching.
      * Note! We won't leave the critical section here...
      */
-    int rc = RTCritSectEnter(&pUVM->dbgf.s.InfoCritSect);
+    int rc = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect);
     AssertRC(rc);
     rc = VWRN_NOT_FOUND;
     for (PDBGFINFO pInfo = pUVM->dbgf.s.pInfoFirst; pInfo; pInfo = pInfo->pNext)
@@ -914,7 +915,7 @@ VMMR3_INT_DECL(int) DBGFR3InfoMulti(PVM pVM, const char *pszIncludePat, const ch
             }
         }
     }
-    int rc2 = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
+    int rc2 = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect);
     AssertRC(rc2);
 
     return rc;
@@ -946,7 +947,7 @@ VMMR3DECL(int) DBGFR3InfoEnum(PUVM pUVM, PFNDBGFINFOENUM pfnCallback, void *pvUs
     /*
      * Enter and enumerate.
      */
-    int rc = RTCritSectEnter(&pUVM->dbgf.s.InfoCritSect);
+    int rc = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect);
     AssertRC(rc);
 
     rc = VINF_SUCCESS;
@@ -956,7 +957,7 @@ VMMR3DECL(int) DBGFR3InfoEnum(PUVM pUVM, PFNDBGFINFOENUM pfnCallback, void *pvUs
     /*
      * Leave and exit.
      */
-    int rc2 = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
+    int rc2 = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect);
     AssertRC(rc2);
 
     LogFlow(("DBGFR3InfoLog: returns %Rrc\n", rc));
@@ -979,7 +980,7 @@ static DECLCALLBACK(void) dbgfR3InfoHelp(PVM pVM, PCDBGFINFOHLP pHlp, const char
      * Enter and enumerate.
      */
     PUVM pUVM = pVM->pUVM;
-    int rc = RTCritSectEnter(&pUVM->dbgf.s.InfoCritSect);
+    int rc = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect);
     AssertRC(rc);
 
     if (pszArgs && *pszArgs)
@@ -1006,7 +1007,7 @@ static DECLCALLBACK(void) dbgfR3InfoHelp(PVM pVM, PCDBGFINFOHLP pHlp, const char
     /*
      * Leave and exit.
      */
-    rc = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);
+    rc = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect);
     AssertRC(rc);
 }
 
diff --git a/src/VBox/VMM/VMMR3/DBGFOS.cpp b/src/VBox/VMM/VMMR3/DBGFOS.cpp
index 902432e..1222d1c 100644
--- a/src/VBox/VMM/VMMR3/DBGFOS.cpp
+++ b/src/VBox/VMM/VMMR3/DBGFOS.cpp
@@ -35,11 +35,65 @@
 /*******************************************************************************
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-#define DBGF_OS_READ_LOCK(pUVM)      do { } while (0)
-#define DBGF_OS_READ_UNLOCK(pUVM)    do { } while (0)
 
-#define DBGF_OS_WRITE_LOCK(pUVM)     do { } while (0)
-#define DBGF_OS_WRITE_UNLOCK(pUVM)   do { } while (0)
+#define DBGF_OS_READ_LOCK(pUVM) \
+    do { int rcLock = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0)
+#define DBGF_OS_READ_UNLOCK(pUVM) \
+    do { int rcLock = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0)
+
+#define DBGF_OS_WRITE_LOCK(pUVM) \
+    do { int rcLock = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0)
+#define DBGF_OS_WRITE_UNLOCK(pUVM) \
+    do { int rcLock = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0)
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * EMT interface wrappers.
+ *
+ * The diggers expects to be called on an EMT.  To avoid the debugger+Main having
+ *
+ * Since the user (debugger/Main) shouldn't be calling directly into the digger code, but rather
+ */
+typedef struct DBGFOSEMTWRAPPER
+{
+    /** Pointer to the next list entry. */
+    struct DBGFOSEMTWRAPPER    *pNext;
+    /** The interface type.   */
+    DBGFOSINTERFACE             enmIf;
+    /** The digger interface pointer. */
+    union
+    {
+        /** Generic void pointer. */
+        void                    *pv;
+        /** DBGFOSINTERFACE_DMESG.*/
+        PDBGFOSIDMESG           pDmesg;
+    } uDigger;
+    /** The user mode VM handle. */
+    PUVM                        pUVM;
+    /** The wrapper interface union (consult enmIf). */
+    union
+    {
+        /** DBGFOSINTERFACE_DMESG.*/
+        DBGFOSIDMESG            Dmesg;
+    } uWrapper;
+} DBGFOSEMTWRAPPER;
+/** Pointer to an EMT interface wrapper.   */
+typedef DBGFOSEMTWRAPPER *PDBGFOSEMTWRAPPER;
+
+
+/**
+ * Internal init routine called by DBGFR3Init().
+ *
+ * @returns VBox status code.
+ * @param   pUVM    The user mode VM handle.
+ */
+int dbgfR3OSInit(PUVM pUVM)
+{
+    return VINF_SUCCESS;
+}
 
 
 /**
@@ -49,6 +103,8 @@
  */
 void dbgfR3OSTerm(PUVM pUVM)
 {
+    DBGF_OS_WRITE_LOCK(pUVM);
+
     /*
      * Terminate the current one.
      */
@@ -67,8 +123,19 @@ void dbgfR3OSTerm(PUVM pUVM)
         pUVM->dbgf.s.pOSHead = pOS->pNext;
         if (pOS->pReg->pfnDestruct)
             pOS->pReg->pfnDestruct(pUVM, pOS->abData);
+
+        PDBGFOSEMTWRAPPER pFree = pOS->pWrapperHead;
+        while ((pFree = pOS->pWrapperHead) != NULL)
+        {
+            pOS->pWrapperHead = pFree->pNext;
+            pFree->pNext = NULL;
+            MMR3HeapFree(pFree);
+        }
+
         MMR3HeapFree(pOS);
     }
+
+    DBGF_OS_WRITE_UNLOCK(pUVM);
 }
 
 
@@ -91,6 +158,7 @@ static DECLCALLBACK(int) dbgfR3OSRegister(PUVM pUVM, PDBGFOSREG pReg)
             Log(("dbgfR3OSRegister: %s -> VERR_ALREADY_LOADED\n", pReg->szName));
             return VERR_ALREADY_LOADED;
         }
+    DBGF_OS_READ_UNLOCK(pUVM);
 
     /*
      * Allocate a new structure, call the constructor and link it into the list.
@@ -204,6 +272,15 @@ static DECLCALLBACK(int) dbgfR3OSDeregister(PUVM pUVM, PDBGFOSREG pReg)
         pOS->pReg->pfnTerm(pUVM, pOS->abData);
     if (pOS->pReg->pfnDestruct)
         pOS->pReg->pfnDestruct(pUVM, pOS->abData);
+
+    PDBGFOSEMTWRAPPER pFree = pOS->pWrapperHead;
+    while ((pFree = pOS->pWrapperHead) != NULL)
+    {
+        pOS->pWrapperHead = pFree->pNext;
+        pFree->pNext = NULL;
+        MMR3HeapFree(pFree);
+    }
+
     MMR3HeapFree(pOS);
 
     return VINF_SUCCESS;
@@ -235,7 +312,7 @@ VMMR3DECL(int)  DBGFR3OSDeregister(PUVM pUVM, PCDBGFOSREG pReg)
     for (pOS = pUVM->dbgf.s.pOSHead; pOS; pOS = pOS->pNext)
         if (pOS->pReg == pReg)
             break;
-    DBGF_OS_READ_LOCK(pUVM);
+    DBGF_OS_READ_UNLOCK(pUVM);
 
     if (!pOS)
     {
@@ -266,6 +343,8 @@ static DECLCALLBACK(int) dbgfR3OSDetect(PUVM pUVM, char *pszName, size_t cchName
     /*
      * Cycle thru the detection routines.
      */
+    DBGF_OS_WRITE_LOCK(pUVM);
+
     PDBGFOS const pOldOS = pUVM->dbgf.s.pCurOS;
     pUVM->dbgf.s.pCurOS = NULL;
 
@@ -284,12 +363,16 @@ static DECLCALLBACK(int) dbgfR3OSDetect(PUVM pUVM, char *pszName, size_t cchName
             }
             if (pszName && cchName)
                 strncat(pszName, pNewOS->pReg->szName, cchName);
+
+            DBGF_OS_WRITE_UNLOCK(pUVM);
             return rc;
         }
 
     /* not found */
     if (pOldOS)
         pOldOS->pReg->pfnTerm(pUVM, pOldOS->abData);
+
+    DBGF_OS_WRITE_UNLOCK(pUVM);
     return VINF_DBGF_OS_NOT_DETCTED;
 }
 
@@ -338,6 +421,8 @@ static DECLCALLBACK(int) dbgfR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, s
     /*
      * Any known OS?
      */
+    DBGF_OS_READ_LOCK(pUVM);
+
     if (pUVM->dbgf.s.pCurOS)
     {
         int rc = VINF_SUCCESS;
@@ -360,9 +445,12 @@ static DECLCALLBACK(int) dbgfR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, s
             if (RT_FAILURE(rc2) || rc == VINF_SUCCESS)
                 rc = rc2;
         }
+
+        DBGF_OS_READ_UNLOCK(pUVM);
         return rc;
     }
 
+    DBGF_OS_READ_UNLOCK(pUVM);
     return VERR_DBGF_OS_NOT_DETCTED;
 }
 
@@ -404,6 +492,28 @@ VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, size_t cchN
 
 
 /**
+ * @interface_method_impl{DBGFOSIDMESG,pfnQueryKernelLog, Generic EMT wrapper.}
+ */
+static DECLCALLBACK(int) dbgfR3OSEmtIDmesg_QueryKernelLog(PDBGFOSIDMESG pThis, PUVM pUVM, uint32_t fFlags, uint32_t cMessages,
+                                                          char *pszBuf, size_t cbBuf, size_t *pcbActual)
+{
+    PDBGFOSEMTWRAPPER pWrapper = RT_FROM_MEMBER(pThis, DBGFOSEMTWRAPPER, uWrapper.Dmesg);
+    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+    AssertReturn(pUVM == pWrapper->pUVM, VERR_INVALID_VM_HANDLE);
+    AssertReturn(!fFlags, VERR_INVALID_FLAGS);
+    AssertReturn(cMessages > 0, VERR_INVALID_PARAMETER);
+    if (cbBuf)
+        AssertPtrReturn(pszBuf, VERR_INVALID_POINTER);
+    AssertPtrNullReturn(pcbActual, VERR_INVALID_POINTER);
+
+    return VMR3ReqPriorityCallWaitU(pWrapper->pUVM, 0 /*idDstCpu*/,
+                                   (PFNRT)pWrapper->uDigger.pDmesg->pfnQueryKernelLog, 7,
+                                    pWrapper->uDigger.pDmesg, pUVM, fFlags, cMessages, pszBuf, cbBuf, pcbActual);
+
+}
+
+
+/**
  * EMT worker for DBGFR3OSQueryInterface.
  *
  * @param   pUVM            The user mode VM handle.
@@ -412,17 +522,80 @@ VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, size_t cchN
  */
 static DECLCALLBACK(void) dbgfR3OSQueryInterface(PUVM pUVM, DBGFOSINTERFACE enmIf, void **ppvIf)
 {
-    if (pUVM->dbgf.s.pCurOS)
+    AssertPtrReturnVoid(ppvIf);
+    *ppvIf = NULL;
+    AssertReturnVoid(enmIf > DBGFOSINTERFACE_INVALID && enmIf < DBGFOSINTERFACE_END);
+    UVM_ASSERT_VALID_EXT_RETURN_VOID(pUVM);
+
+    /*
+     * Forward the query to the current OS.
+     */
+    DBGF_OS_READ_LOCK(pUVM);
+    PDBGFOS pOS = pUVM->dbgf.s.pCurOS;
+    if (pOS)
     {
-        *ppvIf = pUVM->dbgf.s.pCurOS->pReg->pfnQueryInterface(pUVM, pUVM->dbgf.s.pCurOS->abData, enmIf);
-        if (*ppvIf)
+        void *pvDiggerIf;
+        pvDiggerIf = pOS->pReg->pfnQueryInterface(pUVM, pUVM->dbgf.s.pCurOS->abData, enmIf);
+        if (pvDiggerIf)
         {
-            /** @todo Create EMT wrapper for the returned interface once we've defined one...
-             * Just keep a list of wrapper together with the OS instance. */
+            /*
+             * Do we have an EMT wrapper for this interface already?
+             *
+             * We ASSUME the interfaces are static and not dynamically allocated
+             * for each QueryInterface call.
+             */
+            PDBGFOSEMTWRAPPER pWrapper = pOS->pWrapperHead;
+            while (   pWrapper != NULL
+                   && (   pWrapper->uDigger.pv != pvDiggerIf
+                       && pWrapper->enmIf      != enmIf) )
+                pWrapper = pWrapper->pNext;
+            if (pWrapper)
+            {
+                *ppvIf = &pWrapper->uWrapper;
+                DBGF_OS_READ_UNLOCK(pUVM);
+                return;
+            }
+            DBGF_OS_READ_UNLOCK(pUVM);
+
+            /*
+             * Create a wrapper.
+             */
+            int rc = MMR3HeapAllocExU(pUVM, MM_TAG_DBGF_OS, sizeof(*pWrapper), (void **)&pWrapper);
+            if (RT_FAILURE(rc))
+                return;
+            pWrapper->uDigger.pv = pvDiggerIf;
+            pWrapper->pUVM       = pUVM;
+            pWrapper->enmIf      = enmIf;
+            switch (enmIf)
+            {
+                case DBGFOSINTERFACE_DMESG:
+                    pWrapper->uWrapper.Dmesg.u32Magic          = DBGFOSIDMESG_MAGIC;
+                    pWrapper->uWrapper.Dmesg.pfnQueryKernelLog = dbgfR3OSEmtIDmesg_QueryKernelLog;
+                    pWrapper->uWrapper.Dmesg.u32EndMagic       = DBGFOSIDMESG_MAGIC;
+                    break;
+                default:
+                    AssertFailed();
+                    MMR3HeapFree(pWrapper);
+                    return;
+            }
+
+            DBGF_OS_WRITE_LOCK(pUVM);
+            if (pUVM->dbgf.s.pCurOS == pOS)
+            {
+                pWrapper->pNext = pOS->pWrapperHead;
+                pOS->pWrapperHead = pWrapper;
+                *ppvIf = &pWrapper->uWrapper;
+                DBGF_OS_WRITE_UNLOCK(pUVM);
+            }
+            else
+            {
+                DBGF_OS_WRITE_UNLOCK(pUVM);
+                MMR3HeapFree(pWrapper);
+            }
+            return;
         }
     }
-    else
-        *ppvIf = NULL;
+    DBGF_OS_READ_UNLOCK(pUVM);
 }
 
 
@@ -447,3 +620,4 @@ VMMR3DECL(void *) DBGFR3OSQueryInterface(PUVM pUVM, DBGFOSINTERFACE enmIf)
     return pvIf;
 }
 
+
diff --git a/src/VBox/VMM/VMMR3/DBGFR3PlugIn.cpp b/src/VBox/VMM/VMMR3/DBGFR3PlugIn.cpp
new file mode 100644
index 0000000..500cc0f
--- /dev/null
+++ b/src/VBox/VMM/VMMR3/DBGFR3PlugIn.cpp
@@ -0,0 +1,614 @@
+/* $Id: DBGFR3PlugIn.cpp $ */
+/** @file
+ * DBGF - Debugger Facility, Plug-In Support.
+ */
+
+/*
+ * Copyright (C) 2008-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_DBGF
+#include <VBox/vmm/dbgf.h>
+#include <VBox/vmm/mm.h>
+#include "DBGFInternal.h"
+#include <VBox/vmm/uvm.h>
+#include <VBox/vmm/vm.h>
+#include <VBox/err.h>
+#include <VBox/log.h>
+#include <VBox/version.h>
+
+#include <iprt/alloca.h>
+#include <iprt/assert.h>
+#include <iprt/ctype.h>
+#include <iprt/env.h>
+#include <iprt/dir.h>
+#include <iprt/ldr.h>
+#include <iprt/param.h>
+#include <iprt/path.h>
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+
+#define DBGF_PLUG_IN_READ_LOCK(pUVM) \
+    do { int rcLock = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0)
+#define DBGF_PLUG_IN_READ_UNLOCK(pUVM) \
+    do { int rcLock = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0)
+
+#define DBGF_PLUG_IN_WRITE_LOCK(pUVM) \
+    do { int rcLock = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0)
+#define DBGF_PLUG_IN_WRITE_UNLOCK(pUVM) \
+    do { int rcLock = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0)
+
+/** Max allowed length of a plug-in name (excludes the path and suffix). */
+#define DBGFPLUGIN_MAX_NAME     64
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * Plug-in tracking record.
+ */
+typedef struct DBGFPLUGIN
+{
+    /** Pointer to the next plug-in. */
+    struct DBGFPLUGIN  *pNext;
+    /** The loader handle.  */
+    RTLDRMOD            hLdrMod;
+    /** The plug-in entry point. */
+    PFNDBGFPLUGIN       pfnEntry;
+    /** The name length. */
+    uint8_t             cchName;
+    /** The plug-in name (variable length).  */
+    char                szName[1];
+} DBGFPLUGIN;
+/** Pointer to plug-in tracking record. */
+typedef DBGFPLUGIN *PDBGFPLUGIN;
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static DECLCALLBACK(void) dbgfPlugInUnloadAll(PUVM pUVM);
+static FNDBGFHANDLERINT dbgfR3PlugInInfoList;
+
+
+/**
+ * Internal init routine called by DBGFR3Init().
+ *
+ * @returns VBox status code.
+ * @param   pUVM    The user mode VM handle.
+ */
+int dbgfR3PlugInInit(PUVM pUVM)
+{
+    return DBGFR3InfoRegisterInternal(pUVM->pVM, "plugins", "Lists the debugger plug-ins.", dbgfR3PlugInInfoList);
+}
+
+
+/**
+ * Internal cleanup routine called by DBGFR3Term().
+ *
+ * @param   pUVM    The user mode VM handle.
+ */
+void dbgfR3PlugInTerm(PUVM pUVM)
+{
+    dbgfPlugInUnloadAll(pUVM);
+}
+
+
+/**
+ * Extracts the plug-in name from a plug-in specifier that may or may not
+ * include path and/or suffix.
+ *
+ * @returns VBox status code.
+ *
+ * @param   pszDst      Where to return the name. At least DBGFPLUGIN_MAX_NAME
+ *                      worth of buffer space.
+ * @param   pszPlugIn   The plug-in module specifier to parse.
+ * @param   pErrInfo    Optional error information structure.
+ */
+static int dbgfPlugInExtractName(char *pszDst, const char *pszPlugIn, PRTERRINFO pErrInfo)
+{
+    /*
+     * Parse out the name stopping at the extension.
+     */
+    const char *pszName = RTPathFilename(pszPlugIn);
+    if (!pszName || !*pszName)
+        return VERR_INVALID_NAME;
+    if (!RTStrNICmp(pszName, RT_STR_TUPLE(DBGF_PLUG_IN_PREFIX)))
+    {
+        pszName += sizeof(DBGF_PLUG_IN_PREFIX) - 1;
+        if (!*pszName)
+            return RTErrInfoSetF(pErrInfo, VERR_INVALID_NAME, "Invalid plug-in name: nothing after the prefix");
+    }
+
+    int     ch;
+    size_t  cchName = 0;
+    while (   (ch = pszName[cchName]) != '\0'
+           && ch != '.')
+    {
+        if (   RT_C_IS_ALPHA(ch)
+            || (RT_C_IS_DIGIT(ch) && cchName != 0))
+            cchName++;
+        else
+        {
+            if (!RT_C_IS_DIGIT(ch))
+                return RTErrInfoSetF(pErrInfo, VERR_INVALID_NAME, "Invalid plug-in name: '%c' is not alphanumeric", ch);
+            return RTErrInfoSetF(pErrInfo, VERR_INVALID_NAME,
+                                 "Invalid plug-in name: Cannot start with a digit (after the prefix)");
+        }
+    }
+
+    if (cchName >= DBGFPLUGIN_MAX_NAME)
+        return RTErrInfoSetF(pErrInfo, VERR_INVALID_NAME, "Invalid plug-in name: too long (max %u)", DBGFPLUGIN_MAX_NAME);
+
+    /*
+     * We're very picky about the extension when present.
+     */
+    if (   ch == '.'
+        && RTStrICmp(&pszName[cchName], RTLdrGetSuff()))
+        return RTErrInfoSetF(pErrInfo, VERR_INVALID_NAME,
+                             "Invalid plug-in name: Suffix isn't the default dll/so/dylib one (%s): '%s'",
+                             RTLdrGetSuff(), &pszName[cchName]);
+
+    /*
+     * Copy it.
+     */
+    memcpy(pszDst, pszName, cchName);
+    pszDst[cchName] = '\0';
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Locate a loaded plug-in.
+ *
+ * @returns Pointer to the plug-in tracking structure.
+ * @param   pUVM                Pointer to the user-mode VM structure.
+ * @param   pszName             The name of the plug-in we're looking for.
+ * @param   ppPrev              Where to optionally return the pointer to the
+ *                              previous list member.
+ */
+static PDBGFPLUGIN dbgfR3PlugInLocate(PUVM pUVM, const char *pszName, PDBGFPLUGIN *ppPrev)
+{
+    PDBGFPLUGIN pPrev = NULL;
+    PDBGFPLUGIN pCur  = pUVM->dbgf.s.pPlugInHead;
+    while (pCur)
+    {
+        if (!RTStrICmp(pCur->szName, pszName))
+        {
+            if (ppPrev)
+                *ppPrev = pPrev;
+            return pCur;
+        }
+
+        /* advance */
+        pPrev = pCur;
+        pCur  = pCur->pNext;
+    }
+    return NULL;
+}
+
+
+/**
+ * Try load the specified plug-in module.
+ *
+ * @returns VINF_SUCCESS on success, path error or loader error on failure.
+ *
+ * @param   pPlugIn     The plug-in tracing record.
+ * @param   pszModule   Module name.
+ * @param   pErrInfo    Optional error information structure.
+ */
+static int dbgfR3PlugInTryLoad(PDBGFPLUGIN pPlugIn, const char *pszModule, PRTERRINFO pErrInfo)
+{
+    /*
+     * Load it and try resolve the entry point.
+     */
+    int rc = SUPR3HardenedVerifyPlugIn(pszModule, pErrInfo);
+    if (RT_SUCCESS(rc))
+        rc = RTLdrLoadEx(pszModule, &pPlugIn->hLdrMod, RTLDRLOAD_FLAGS_LOCAL, pErrInfo);
+    if (RT_SUCCESS(rc))
+    {
+        rc = RTLdrGetSymbol(pPlugIn->hLdrMod, DBGF_PLUG_IN_ENTRYPOINT, (void **)&pPlugIn->pfnEntry);
+        if (RT_SUCCESS(rc))
+        {
+            LogRel(("DBGF: Loaded Plug-In '%s' (%s).\n", pPlugIn->szName, pszModule));
+            return VINF_SUCCESS;
+        }
+
+        RTErrInfoSet(pErrInfo, rc, "Failed to locate plug-in entrypoint (" DBGF_PLUG_IN_ENTRYPOINT ")" );
+        LogRel(("DBGF: RTLdrGetSymbol('%s', '%s',) -> %Rrc\n", pszModule, DBGF_PLUG_IN_ENTRYPOINT, rc));
+
+        RTLdrClose(pPlugIn->hLdrMod);
+        pPlugIn->hLdrMod = NIL_RTLDRMOD;
+    }
+    return rc;
+}
+
+
+/**
+ * RTPathTraverseList callback.
+ *
+ * @returns See FNRTPATHTRAVERSER.
+ *
+ * @param   pchPath     See FNRTPATHTRAVERSER.
+ * @param   cchPath     See FNRTPATHTRAVERSER.
+ * @param   pvUser1     The plug-in specifier.
+ * @param   pvUser2     The plug-in tracking record.
+ */
+static DECLCALLBACK(int) dbgfR3PlugInLoadCallback(const char *pchPath, size_t cchPath, void *pvUser1, void *pvUser2)
+{
+    PDBGFPLUGIN pPlugIn   = (PDBGFPLUGIN)pvUser1;
+    PRTERRINFO  pErrInfo  = (PRTERRINFO)pvUser2;
+
+    /*
+     * Join the path and the specified plug-in name, adding prefix and suffix.
+     */
+    const char  *pszSuff   = RTLdrGetSuff();
+    size_t const cchSuff   = strlen(pszSuff);
+    size_t const cchModule = cchPath + sizeof(RTPATH_SLASH_STR) + sizeof(DBGF_PLUG_IN_PREFIX) + pPlugIn->cchName + cchSuff + 4;
+    char        *pszModule = (char *)alloca(cchModule);
+    AssertReturn(pszModule, VERR_TRY_AGAIN);
+    memcpy(pszModule, pchPath, cchPath);
+    pszModule[cchPath] = '\0';
+
+    int rc = RTPathAppend(pszModule, cchModule, DBGF_PLUG_IN_PREFIX);
+    AssertRCReturn(rc, VERR_TRY_AGAIN);
+    strcat(&pszModule[cchPath], pPlugIn->szName);
+    strcat(&pszModule[cchPath + sizeof(DBGF_PLUG_IN_PREFIX) - 1 + pPlugIn->cchName], pszSuff);
+    Assert(strlen(pszModule) < cchModule - 4);
+
+    if (RTPathExists(pszModule))
+    {
+        rc = dbgfR3PlugInTryLoad(pPlugIn, pszModule, pErrInfo);
+        if (RT_SUCCESS(rc))
+            return VINF_SUCCESS;
+    }
+
+    return VERR_TRY_AGAIN;
+}
+
+
+/**
+ * Loads a plug-in.
+ *
+ * @returns VBox status code.
+ * @param   pUVM                Pointer to the user-mode VM structure.
+ * @param   pszName             The plug-in name.
+ * @param   pszMaybeModule      Path to the plug-in, or just the
+ *                              plug-in name as specified by the user.  Ignored
+ *                              if no path.
+ * @param   pErrInfo            Optional error information structure.
+ */
+static DECLCALLBACK(int) dbgfR3PlugInLoad(PUVM pUVM, const char *pszName, const char *pszMaybeModule, PRTERRINFO pErrInfo)
+{
+    DBGF_PLUG_IN_WRITE_LOCK(pUVM);
+
+    /*
+     * Check if a plug-in by the given name already exists.
+     */
+    PDBGFPLUGIN pPlugIn = dbgfR3PlugInLocate(pUVM, pszName, NULL);
+    if (pPlugIn)
+    {
+        DBGF_PLUG_IN_WRITE_UNLOCK(pUVM);
+        return RTErrInfoSetF(pErrInfo, VERR_ALREADY_EXISTS, "A plug-in by the name '%s' already exists", pszName);
+    }
+
+    /*
+     * Create a module structure and we can pass around via RTPathTraverseList if needed.
+     */
+    size_t cbName = strlen(pszName) + 1;
+    pPlugIn = (PDBGFPLUGIN)MMR3HeapAllocZU(pUVM, MM_TAG_DBGF, RT_UOFFSETOF(DBGFPLUGIN, szName[cbName]));
+    if (RT_UNLIKELY(!pPlugIn))
+    {
+        DBGF_PLUG_IN_WRITE_UNLOCK(pUVM);
+        return VERR_NO_MEMORY;
+    }
+    memcpy(pPlugIn->szName, pszName, cbName);
+    pPlugIn->cchName = (uint8_t)cbName - 1;
+    Assert(pPlugIn->cchName == cbName - 1);
+
+    /*
+     * If the caller specified a path, try load exactly what was specified.
+     */
+    int rc;
+    if (RTPathHavePath(pszMaybeModule))
+        rc = dbgfR3PlugInTryLoad(pPlugIn, pszMaybeModule, pErrInfo);
+    else
+    {
+        /*
+         * No path specified, search for the plug-in using the canonical
+         * module name for it.
+         */
+        RTErrInfoClear(pErrInfo);
+
+        /* 1. The private architecture directory. */
+        char szPath[_4K];
+        rc = RTPathAppPrivateArch(szPath, sizeof(szPath));
+        if (RT_SUCCESS(rc))
+            rc = RTPathTraverseList(szPath, '\0', dbgfR3PlugInLoadCallback, pPlugIn, pErrInfo);
+        if (RT_FAILURE_NP(rc))
+        {
+            /* 2. The config value 'PlugInPath' */
+            int rc2 = CFGMR3QueryString(CFGMR3GetChild(CFGMR3GetRootU(pUVM), "/DBGF"), "PlugInPath", szPath, sizeof(szPath));
+            if (RT_SUCCESS(rc2))
+                rc = RTPathTraverseList(szPath, ';', dbgfR3PlugInLoadCallback, pPlugIn, pErrInfo);
+            if (RT_FAILURE_NP(rc))
+            {
+                /* 3. The VBOXDBG_PLUG_IN_PATH environment variable. */
+                rc2 = RTEnvGetEx(RTENV_DEFAULT, "VBOXDBG_PLUG_IN_PATH", szPath, sizeof(szPath), NULL);
+                if (RT_SUCCESS(rc2))
+                    rc = RTPathTraverseList(szPath, ';', dbgfR3PlugInLoadCallback, pPlugIn, pErrInfo);
+            }
+        }
+
+        if (rc == VERR_END_OF_STRING)
+            rc = VERR_FILE_NOT_FOUND;
+        if (pErrInfo && !RTErrInfoIsSet(pErrInfo))
+            RTErrInfoSetF(pErrInfo, rc, "Failed to locate '%s'", pPlugIn->szName);
+    }
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Try initialize it.
+         */
+        rc = pPlugIn->pfnEntry(DBGFPLUGINOP_INIT, pUVM, VBOX_VERSION);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Link it and we're good.
+             */
+            pPlugIn->pNext = pUVM->dbgf.s.pPlugInHead;
+            pUVM->dbgf.s.pPlugInHead = pPlugIn;
+
+            DBGF_PLUG_IN_WRITE_UNLOCK(pUVM);
+            return VINF_SUCCESS;
+        }
+
+        RTErrInfoSet(pErrInfo, rc, "Plug-in init failed");
+        LogRel(("DBGF: Plug-in '%s' failed during init: %Rrc\n", pPlugIn->szName));
+        RTLdrClose(pPlugIn->hLdrMod);
+    }
+    MMR3HeapFree(pPlugIn);
+
+    DBGF_PLUG_IN_WRITE_UNLOCK(pUVM);
+    return rc;
+}
+
+
+/**
+ * Load a debugging plug-in.
+ *
+ * @returns VBox status code.
+ * @retval  VERR_ALREADY_EXISTS if the module was already loaded.
+ * @retval  VINF_BUFFER_OVERFLOW if the actual plug-in name buffer was too small
+ *          (the plug-in was still successfully loaded).
+ * @param   pUVM        Pointer to the user-mode VM structure.
+ * @param   pszPlugIn   The plug-in name.  This may specify the exact path to
+ *                      the plug-in module, or it may just specify the core name
+ *                      of the plug-in without prefix, suffix and path.
+ * @param   pszActual   Buffer to return the actual plug-in name in. Optional.
+ *                      This will be returned on VERR_ALREADY_EXSIST too.
+ * @param   cbActual    The size of @a pszActual.
+ * @param   pErrInfo    Optional error information structure.
+ */
+VMMR3DECL(int) DBGFR3PlugInLoad(PUVM pUVM, const char *pszPlugIn, char *pszActual, size_t cbActual, PRTERRINFO pErrInfo)
+{
+    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+    AssertPtrReturn(pszPlugIn, VERR_INVALID_PARAMETER);
+
+    /*
+     * Extract the plug-in name.  Copy it to the return buffer as we'll want to
+     * return it in the VERR_ALREADY_EXISTS case too.
+     */
+    char szName[DBGFPLUGIN_MAX_NAME];
+    int rc = dbgfPlugInExtractName(szName, pszPlugIn, pErrInfo);
+    if (RT_SUCCESS(rc))
+    {
+        int rc2 = VINF_SUCCESS;
+        if (pszActual)
+            rc2 = RTStrCopy(pszActual, cbActual, szName);
+
+        /*
+         * Write lock releated DBGF bits and try load it.
+         */
+        rc = VMR3ReqPriorityCallWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)dbgfR3PlugInLoad, 4, pUVM, szName, pszPlugIn, pErrInfo);
+        if (rc2 != VINF_SUCCESS && RT_SUCCESS(rc))
+            rc = VINF_BUFFER_OVERFLOW;
+    }
+
+    return rc;
+}
+
+
+/**
+ * Load all plug-ins from the architechture private directory of VBox.
+ *
+ * @param   pUVM    Pointer to the user-mode VM structure.
+ */
+VMMR3DECL(void) DBGFR3PlugInLoadAll(PUVM pUVM)
+{
+    UVM_ASSERT_VALID_EXT_RETURN_VOID(pUVM);
+
+    /*
+     * Pass it on to EMT(0) if necessary (thanks to DBGFR3Os*).
+     */
+    if (VMR3GetVMCPUId(pUVM->pVM) != 0)
+    {
+        VMR3ReqPriorityCallVoidWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)DBGFR3PlugInLoadAll, 1, pUVM);
+        return;
+    }
+
+
+    /*
+     * Open the architecture specific directory with a filter on our prefix
+     * and names including a dot.
+     */
+    const char *pszSuff = RTLdrGetSuff();
+    size_t      cchSuff = strlen(pszSuff);
+
+    char szPath[RTPATH_MAX];
+    int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - cchSuff);
+    AssertRCReturnVoid(rc);
+    size_t offDir = strlen(szPath);
+
+    rc = RTPathAppend(szPath, sizeof(szPath) - cchSuff, DBGF_PLUG_IN_PREFIX "*");
+    AssertRCReturnVoid(rc);
+    strcat(szPath, pszSuff);
+
+    PRTDIR pDir;
+    rc = RTDirOpenFiltered(&pDir, szPath, RTDIRFILTER_WINNT, 0);
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Now read it and try load each of the plug-in modules.
+         */
+        RTDIRENTRY DirEntry;
+        while (RT_SUCCESS(RTDirRead(pDir, &DirEntry, NULL)))
+        {
+            szPath[offDir] = '\0';
+            rc = RTPathAppend(szPath, sizeof(szPath), DirEntry.szName);
+            if (RT_SUCCESS(rc))
+            {
+                char szName[DBGFPLUGIN_MAX_NAME];
+                rc = dbgfPlugInExtractName(szName, DirEntry.szName, NULL);
+                if (RT_SUCCESS(rc))
+                {
+                    DBGF_PLUG_IN_WRITE_LOCK(pUVM);
+                    dbgfR3PlugInLoad(pUVM, szName, szPath, NULL);
+                    DBGF_PLUG_IN_WRITE_UNLOCK(pUVM);
+                }
+            }
+        }
+
+        RTDirClose(pDir);
+    }
+}
+
+
+/**
+ * Unloads a plug-in by name (no path, prefix or suffix).
+ *
+ * @returns VBox status code.
+ * @retval  VERR_NOT_FOUND if the specified plug-in wasn't found.
+ * @param   pUVM        Pointer to the user-mode VM structure.
+ * @param   pszName     The name of the plug-in to unload.
+ */
+VMMR3DECL(int) DBGFR3PlugInUnload(PUVM pUVM, const char *pszName)
+{
+    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+
+    /*
+     * Pass it on to EMT(0) if necessary (thanks to DBGFR3Os*).
+     */
+    if (VMR3GetVMCPUId(pUVM->pVM) != 0)
+        return VMR3ReqPriorityCallWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)DBGFR3PlugInUnload, 2, pUVM, pszName);
+
+
+    /*
+     * Find the plug-in.
+     */
+    DBGF_PLUG_IN_WRITE_LOCK(pUVM);
+
+    int rc;
+    PDBGFPLUGIN pPrevPlugIn;
+    PDBGFPLUGIN pPlugIn = dbgfR3PlugInLocate(pUVM, pszName, &pPrevPlugIn);
+    if (pPlugIn)
+    {
+        /*
+         * Unlink, terminate, unload and free the plug-in.
+         */
+        if (pPrevPlugIn)
+            pPrevPlugIn->pNext = pPlugIn->pNext;
+        else
+            pUVM->dbgf.s.pPlugInHead = pPlugIn->pNext;
+
+        pPlugIn->pfnEntry(DBGFPLUGINOP_TERM, pUVM, 0);
+        RTLdrClose(pPlugIn->hLdrMod);
+
+        pPlugIn->pfnEntry = NULL;
+        pPlugIn->hLdrMod  = NIL_RTLDRMOD;
+        MMR3HeapFree(pPlugIn->pNext);
+    }
+    else
+        rc = VERR_NOT_FOUND;
+
+    DBGF_PLUG_IN_WRITE_UNLOCK(pUVM);
+    return rc;
+}
+
+
+/**
+ * Unload all plug-ins.
+ *
+ * @param   pUVM    Pointer to the user-mode VM structure.
+ */
+static DECLCALLBACK(void) dbgfPlugInUnloadAll(PUVM pUVM)
+{
+    DBGF_PLUG_IN_WRITE_LOCK(pUVM);
+
+    while (pUVM->dbgf.s.pPlugInHead)
+    {
+        PDBGFPLUGIN pPlugin = pUVM->dbgf.s.pPlugInHead;
+        pUVM->dbgf.s.pPlugInHead = pPlugin->pNext;
+
+        pPlugin->pfnEntry(DBGFPLUGINOP_TERM, pUVM, 0);
+
+        int rc2 = RTLdrClose(pPlugin->hLdrMod);
+        AssertRC(rc2);
+
+        pPlugin->pfnEntry = NULL;
+        pPlugin->hLdrMod  = NIL_RTLDRMOD;
+        MMR3HeapFree(pPlugin);
+    }
+
+    DBGF_PLUG_IN_WRITE_UNLOCK(pUVM);
+}
+
+
+/**
+ * Unloads all plug-ins.
+ *
+ * @param   pUVM    Pointer to the user-mode VM structure.
+ */
+VMMR3DECL(void) DBGFR3PlugInUnloadAll(PUVM pUVM)
+{
+    UVM_ASSERT_VALID_EXT_RETURN_VOID(pUVM);
+    /* Thanks to DBGFR3Os, this must be done on EMT(0). */
+    VMR3ReqPriorityCallVoidWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)dbgfPlugInUnloadAll, 1, pUVM);
+}
+
+
+
+/**
+ * @interface_method_impl{FNDBGFHANDLERINT, The 'plugins' info item.}
+ */
+static DECLCALLBACK(void) dbgfR3PlugInInfoList(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs)
+{
+    PDBGFPLUGIN pPlugIn = pVM->pUVM->dbgf.s.pPlugInHead;
+    if (pPlugIn)
+    {
+        pHlp->pfnPrintf(pHlp, "Debugging plug-in%s: %s", pPlugIn->pNext ? "s" : "", pPlugIn->szName);
+        while ((pPlugIn = pPlugIn->pNext) != NULL)
+            pHlp->pfnPrintf(pHlp, ", %s", pPlugIn->szName);
+        pHlp->pfnPrintf(pHlp, "\n");
+
+    }
+    else
+        pHlp->pfnPrintf(pHlp, "No plug-ins loaded\n");
+}
+
diff --git a/src/VBox/VMM/VMMR3/EM.cpp b/src/VBox/VMM/VMMR3/EM.cpp
index 6ee8cbf..678de20 100644
--- a/src/VBox/VMM/VMMR3/EM.cpp
+++ b/src/VBox/VMM/VMMR3/EM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -62,7 +62,6 @@
 #include <VBox/vmm/cpumdis.h>
 #include <VBox/dis.h>
 #include <VBox/disopcode.h>
-#include <VBox/vmm/dbgf.h>
 #include "VMMTracing.h"
 
 #include <iprt/asm.h>
@@ -1406,7 +1405,7 @@ EMSTATE emR3Reschedule(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx)
     {
         uint32_t u32Dummy, u32Features;
 
-        CPUMGetGuestCpuId(pVCpu, 1, &u32Dummy, &u32Dummy, &u32Dummy, &u32Features);
+        CPUMGetGuestCpuId(pVCpu, 1, 0, &u32Dummy, &u32Dummy, &u32Dummy, &u32Features);
         if (!(u32Features & X86_CPUID_FEATURE_EDX_PAE))
             return EMSTATE_REM;
     }
@@ -1716,7 +1715,7 @@ int emR3ForcedActions(PVM pVM, PVMCPU pVCpu, int rc)
             /** @todo: check for 16 or 32 bits code! (D bit in the code selector) */
             Log(("Forced action VMCPU_FF_CSAM_SCAN_PAGE\n"));
 
-            CSAMR3CheckCodeEx(pVM, CPUMCTX2CORE(pCtx), pCtx->eip);
+            CSAMR3CheckCodeEx(pVM, pCtx, pCtx->eip);
             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_CSAM_SCAN_PAGE);
         }
 #endif
@@ -1855,8 +1854,23 @@ int emR3ForcedActions(PVM pVM, PVMCPU pVCpu, int rc)
             }
         }
 
+        /*
+         * Forced unhalting of EMT.
+         */
+        if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_UNHALT))
+        {
+            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_UNHALT);
+            if (rc == VINF_EM_HALT)
+                rc = VINF_EM_RESCHEDULE;
+            else
+            {
+                rc2 = VINF_EM_RESCHEDULE;
+                UPDATE_RC();
+            }
+        }
+
         /* check that we got them all  */
-        Assert(!(VMCPU_FF_NORMAL_PRIORITY_MASK & ~(VMCPU_FF_REQUEST)));
+        Assert(!(VMCPU_FF_NORMAL_PRIORITY_MASK & ~(VMCPU_FF_REQUEST | VMCPU_FF_UNHALT)));
     }
 
     /*
@@ -2387,7 +2401,7 @@ VMMR3_INT_DECL(int) EMR3ExecuteVM(PVM pVM, PVMCPU pVCpu)
                     break;
 
                 /*
-                 * Guru mediations.
+                 * Triple fault.
                  */
                 case VINF_EM_TRIPLE_FAULT:
                     if (!pVM->em.s.fGuruOnTripleFault)
@@ -2551,7 +2565,7 @@ VMMR3_INT_DECL(int) EMR3ExecuteVM(PVM pVM, PVMCPU pVCpu)
                         rc = VMR3WaitHalted(pVM, pVCpu, false /*fIgnoreInterrupts*/);
                         if (   rc == VINF_SUCCESS
                             && VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC
-                                                        | VMCPU_FF_INTERRUPT_NMI  | VMCPU_FF_INTERRUPT_SMI))
+                                                        | VMCPU_FF_INTERRUPT_NMI  | VMCPU_FF_INTERRUPT_SMI | VMCPU_FF_UNHALT))
                         {
                             Log(("EMR3ExecuteVM: Triggering reschedule on pending IRQ after MWAIT\n"));
                             rc = VINF_EM_RESCHEDULE;
@@ -2561,9 +2575,9 @@ VMMR3_INT_DECL(int) EMR3ExecuteVM(PVM pVM, PVMCPU pVCpu)
                     {
                         rc = VMR3WaitHalted(pVM, pVCpu, !(CPUMGetGuestEFlags(pVCpu) & X86_EFL_IF));
                         if (   rc == VINF_SUCCESS
-                            && VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NMI | VMCPU_FF_INTERRUPT_SMI))
+                            && VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_NMI | VMCPU_FF_INTERRUPT_SMI | VMCPU_FF_UNHALT))
                         {
-                            Log(("EMR3ExecuteVM: Triggering reschedule on pending NMI/SMI after HLT\n"));
+                            Log(("EMR3ExecuteVM: Triggering reschedule on pending NMI/SMI/UNHALT after HLT\n"));
                             rc = VINF_EM_RESCHEDULE;
                         }
                     }
diff --git a/src/VBox/VMM/VMMR3/EMRaw.cpp b/src/VBox/VMM/VMMR3/EMRaw.cpp
index a9c4813..bc65430 100644
--- a/src/VBox/VMM/VMMR3/EMRaw.cpp
+++ b/src/VBox/VMM/VMMR3/EMRaw.cpp
@@ -128,11 +128,11 @@ int emR3RawResumeHyper(PVM pVM, PVMCPU pVCpu)
     /*
      * Resume execution.
      */
-    CPUMRawEnter(pVCpu, NULL);
+    CPUMRawEnter(pVCpu);
     CPUMSetHyperEFlags(pVCpu, CPUMGetHyperEFlags(pVCpu) | X86_EFL_RF);
     rc = VMMR3ResumeHyper(pVM, pVCpu);
     Log(("emR3RawResumeHyper: cs:eip=%RTsel:%RGr efl=%RGr - returned from GC with rc=%Rrc\n", pCtx->cs.Sel, pCtx->eip, pCtx->eflags, rc));
-    rc = CPUMRawLeave(pVCpu, NULL, rc);
+    rc = CPUMRawLeave(pVCpu, rc);
     VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK);
 
     /*
@@ -190,7 +190,7 @@ int emR3RawStep(PVM pVM, PVMCPU pVCpu)
      * Single step.
      * We do not start time or anything, if anything we should just do a few nanoseconds.
      */
-    CPUMRawEnter(pVCpu, NULL);
+    CPUMRawEnter(pVCpu);
     do
     {
         if (pVCpu->em.s.enmState == EMSTATE_DEBUG_HYPER)
@@ -203,7 +203,7 @@ int emR3RawStep(PVM pVM, PVMCPU pVCpu)
 #endif
     } while (   rc == VINF_SUCCESS
              || rc == VINF_EM_RAW_INTERRUPT);
-    rc = CPUMRawLeave(pVCpu, NULL, rc);
+    rc = CPUMRawLeave(pVCpu, rc);
     VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK);
 
     /*
@@ -617,7 +617,7 @@ static int emR3RawGuestTrap(PVM pVM, PVMCPU pVCpu)
         &&  !pCtx->eflags.Bits.u1VM)
     {
         Assert(!PATMIsPatchGCAddr(pVM, pCtx->eip));
-        CSAMR3CheckCodeEx(pVM, CPUMCTX2CORE(pCtx), pCtx->eip);
+        CSAMR3CheckCodeEx(pVM, pCtx, pCtx->eip);
     }
 
     /*
@@ -634,7 +634,7 @@ static int emR3RawGuestTrap(PVM pVM, PVMCPU pVCpu)
             && (cpu.pCurInstr->uOpcode == OP_MONITOR || cpu.pCurInstr->uOpcode == OP_MWAIT))
         {
             uint32_t u32Dummy, u32Features, u32ExtFeatures;
-            CPUMGetGuestCpuId(pVCpu, 1, &u32Dummy, &u32Dummy, &u32ExtFeatures, &u32Features);
+            CPUMGetGuestCpuId(pVCpu, 1, 0, &u32Dummy, &u32Dummy, &u32ExtFeatures, &u32Features);
             if (u32ExtFeatures & X86_CPUID_FEATURE_ECX_MONITOR)
             {
                 rc = TRPMResetTrap(pVCpu);
@@ -1428,7 +1428,7 @@ int emR3RawExecute(PVM pVM, PVMCPU pVCpu, bool *pfFFDone)
          * be modified a bit and some of the state components (IF, SS/CS RPL,
          * and perhaps EIP) needs to be stored with PATM.
          */
-        rc = CPUMRawEnter(pVCpu, NULL);
+        rc = CPUMRawEnter(pVCpu);
         if (rc != VINF_SUCCESS)
         {
             STAM_PROFILE_ADV_STOP(&pVCpu->em.s.StatRAWEntry, b);
@@ -1443,7 +1443,7 @@ int emR3RawExecute(PVM pVM, PVMCPU pVCpu, bool *pfFFDone)
             && !PATMIsPatchGCAddr(pVM, pCtx->eip))
         {
             STAM_PROFILE_ADV_SUSPEND(&pVCpu->em.s.StatRAWEntry, b);
-            CSAMR3CheckCodeEx(pVM, CPUMCTX2CORE(pCtx), pCtx->eip);
+            CSAMR3CheckCodeEx(pVM, pCtx, pCtx->eip);
             STAM_PROFILE_ADV_RESUME(&pVCpu->em.s.StatRAWEntry, b);
             if (    VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_PRE_RAW_MASK)
                 ||  VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_PRE_RAW_MASK))
@@ -1452,7 +1452,7 @@ int emR3RawExecute(PVM pVM, PVMCPU pVCpu, bool *pfFFDone)
                 VBOXVMM_EM_FF_RAW_RET(pVCpu, rc);
                 if (rc != VINF_SUCCESS)
                 {
-                    rc = CPUMRawLeave(pVCpu, NULL, rc);
+                    rc = CPUMRawLeave(pVCpu, rc);
                     break;
                 }
             }
@@ -1512,7 +1512,7 @@ int emR3RawExecute(PVM pVM, PVMCPU pVCpu, bool *pfFFDone)
          * Restore the real CPU state and deal with high priority post
          * execution FFs before doing anything else.
          */
-        rc = CPUMRawLeave(pVCpu, NULL, rc);
+        rc = CPUMRawLeave(pVCpu, rc);
         VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_RESUME_GUEST_MASK);
         if (    VM_FF_IS_PENDING(pVM, VM_FF_HIGH_PRIORITY_POST_MASK)
             ||  VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HIGH_PRIORITY_POST_MASK))
diff --git a/src/VBox/VMM/VMMR3/FTM.cpp b/src/VBox/VMM/VMMR3/FTM.cpp
index 2318f91..fe21ce2 100644
--- a/src/VBox/VMM/VMMR3/FTM.cpp
+++ b/src/VBox/VMM/VMMR3/FTM.cpp
@@ -924,7 +924,7 @@ static DECLCALLBACK(int) ftmR3PageTreeDestroyCallback(PAVLGCPHYSNODECORE pBaseNo
     if (pVM)    /* NULL when the VM is destroyed. */
     {
         /* Update the guest memory of the standby VM. */
-        int rc = PGMR3PhysWriteExternal(pVM, pNode->Core.Key, pNode->pPage, PAGE_SIZE, "FTMemSync");
+        int rc = PGMR3PhysWriteExternal(pVM, pNode->Core.Key, pNode->pPage, PAGE_SIZE, PGMACCESSORIGIN_FTM);
         AssertRC(rc);
     }
     RTMemFree(pNode);
diff --git a/src/VBox/VMM/VMMR3/GIM.cpp b/src/VBox/VMM/VMMR3/GIM.cpp
new file mode 100644
index 0000000..d25dbf4
--- /dev/null
+++ b/src/VBox/VMM/VMMR3/GIM.cpp
@@ -0,0 +1,619 @@
+/* $Id: GIM.cpp $ */
+/** @file
+ * GIM - Guest Interface Manager.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/** @page pg_gim        GIM - The Guest Interface Manager
+ *
+ * The Guest Interface Manager abstracts an interface provider through which
+ * guests may interact with the hypervisor.
+ *
+ * @see grp_gim
+ *
+ *
+ * @section sec_gim_provider   Providers
+ *
+ * A GIM provider implements a particular hypervisor interface such as Microsoft
+ * Hyper-V, Linux KVM and so on. It hooks into various components in the VMM to
+ * ease the guest in running under a recognized, virtualized environment.
+ *
+ * The GIM provider configured for the VM needs to be recognized by the guest OS
+ * in order to make use of features supported by the interface. Since it
+ * requires co-operation from the guest OS, a GIM provider may also referred to
+ * as a paravirtualization interface.
+ *
+ * One of the goals of having a paravirtualized interface is for enabling guests
+ * to be more accurate and efficient when operating in a virtualized
+ * environment. For instance, a guest OS which interfaces to VirtualBox through
+ * a GIM provider may rely on the provider for supplying the correct TSC
+ * frequency of the host processor. The guest can then avoid caliberating the
+ * TSC itself, resulting in higher accuracy and better performance.
+ *
+ * At most, only one GIM provider can be active for a running VM and cannot be
+ * changed during the lifetime of the VM.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include <VBox/log.h>
+#include "GIMInternal.h"
+#include <VBox/vmm/vm.h>
+#include <VBox/vmm/hm.h>
+#include <VBox/vmm/ssm.h>
+#include <VBox/vmm/pdmdev.h>
+
+#include <iprt/err.h>
+#include <iprt/string.h>
+
+/* Include all GIM providers. */
+#include "GIMMinimalInternal.h"
+#include "GIMHvInternal.h"
+#include "GIMKvmInternal.h"
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static DECLCALLBACK(int) gimR3Save(PVM pVM, PSSMHANDLE pSSM);
+static DECLCALLBACK(int) gimR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion, uint32_t uPass);
+static FNPGMPHYSHANDLER gimR3Mmio2WriteHandler;
+
+
+/**
+ * Initializes the GIM.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) GIMR3Init(PVM pVM)
+{
+    LogFlow(("GIMR3Init\n"));
+
+    /*
+     * Assert alignment and sizes.
+     */
+    AssertCompile(sizeof(pVM->gim.s) <= sizeof(pVM->gim.padding));
+
+    /*
+     * Initialize members.
+     */
+    pVM->gim.s.hSemiReadOnlyMmio2Handler = NIL_PGMPHYSHANDLERTYPE;
+
+    /*
+     * Register the saved state data unit.
+     */
+    int rc = SSMR3RegisterInternal(pVM, "GIM", 0 /* uInstance */, GIM_SAVED_STATE_VERSION, sizeof(GIM),
+                                   NULL /* pfnLivePrep */, NULL /* pfnLiveExec */, NULL /* pfnLiveVote*/,
+                                   NULL /* pfnSavePrep */, gimR3Save,              NULL /* pfnSaveDone */,
+                                   NULL /* pfnLoadPrep */, gimR3Load,              NULL /* pfnLoadDone */);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /*
+     * Read configuration.
+     */
+    PCFGMNODE pCfgNode = CFGMR3GetChild(CFGMR3GetRoot(pVM), "GIM/");
+
+    /** @cfgm{/GIM/Provider, string}
+     * The name of the GIM provider. The default is "none". */
+    char szProvider[64];
+    rc = CFGMR3QueryStringDef(pCfgNode, "Provider", szProvider, sizeof(szProvider), "None");
+    AssertLogRelRCReturn(rc, rc);
+
+    /** @cfgm{/GIM/Version, uint32_t}
+     * The interface version. The default is 0, which means "provide the most
+     * up-to-date implementation". */
+    uint32_t uVersion;
+    rc = CFGMR3QueryU32Def(pCfgNode, "Version", &uVersion, 0 /* default */);
+    AssertLogRelRCReturn(rc, rc);
+
+    /*
+     * Setup the GIM provider for this VM.
+     */
+    LogRel(("GIM: Using provider '%s' (Implementation version: %u)\n", szProvider, uVersion));
+    if (!RTStrCmp(szProvider, "None"))
+        pVM->gim.s.enmProviderId = GIMPROVIDERID_NONE;
+    else
+    {
+        pVM->gim.s.u32Version = uVersion;
+        /** @todo r=bird: Because u32Version is saved, it should be translated to the
+         *        'most up-to-date implementation' version number when 0. Otherwise,
+         *        we'll have abiguities when loading the state of older VMs. */
+        if (!RTStrCmp(szProvider, "Minimal"))
+        {
+            pVM->gim.s.enmProviderId = GIMPROVIDERID_MINIMAL;
+            rc = gimR3MinimalInit(pVM);
+        }
+        else if (!RTStrCmp(szProvider, "HyperV"))
+        {
+            pVM->gim.s.enmProviderId = GIMPROVIDERID_HYPERV;
+            rc = gimR3HvInit(pVM);
+        }
+        else if (!RTStrCmp(szProvider, "KVM"))
+        {
+            pVM->gim.s.enmProviderId = GIMPROVIDERID_KVM;
+            rc = gimR3KvmInit(pVM);
+        }
+        else
+            rc = VMR3SetError(pVM->pUVM, VERR_GIM_INVALID_PROVIDER, RT_SRC_POS, "Provider '%s' unknown.", szProvider);
+    }
+    return rc;
+}
+
+
+/**
+ * Initializes the remaining bits of the GIM provider.
+ *
+ * This is called after initializing HM and most other VMM components.
+ *
+ * @returns VBox status code.
+ * @param   pVM                 Pointer to the VM.
+ * @param   enmWhat             What has been completed.
+ * @thread  EMT(0)
+ */
+VMMR3_INT_DECL(int) GIMR3InitCompleted(PVM pVM)
+{
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_MINIMAL:
+            return gimR3MinimalInitCompleted(pVM);
+
+        case GIMPROVIDERID_HYPERV:
+            return gimR3HvInitCompleted(pVM);
+
+        case GIMPROVIDERID_KVM:
+            return gimR3KvmInitCompleted(pVM);
+
+        default:
+            break;
+    }
+
+    if (!TMR3CpuTickIsFixedRateMonotonic(pVM, true /* fWithParavirtEnabled */))
+        LogRel(("GIM: Warning!!! Host TSC is unstable. The guest may behave unpredictably with a paravirtualized clock.\n"));
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Applies relocations to data and code managed by this component.
+ *
+ * This function will be called at init and whenever the VMM need to relocate
+ * itself inside the GC.
+ *
+ * @param   pVM         Pointer to the VM.
+ * @param   offDelta    Relocation delta relative to old location.
+ */
+VMM_INT_DECL(void) GIMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
+{
+    LogFlow(("GIMR3Relocate\n"));
+
+    if (   pVM->gim.s.enmProviderId == GIMPROVIDERID_NONE
+        || HMIsEnabled(pVM))
+        return;
+
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_MINIMAL:
+        {
+            gimR3MinimalRelocate(pVM, offDelta);
+            break;
+        }
+
+        case GIMPROVIDERID_HYPERV:
+        {
+            gimR3HvRelocate(pVM, offDelta);
+            break;
+        }
+
+        case GIMPROVIDERID_KVM:
+        {
+            gimR3KvmRelocate(pVM, offDelta);
+            break;
+        }
+
+        default:
+        {
+            AssertMsgFailed(("Invalid provider Id %#x\n", pVM->gim.s.enmProviderId));
+            break;
+        }
+    }
+}
+
+
+/**
+ * Executes state-save operation.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pSSM            SSM operation handle.
+ */
+DECLCALLBACK(int) gimR3Save(PVM pVM, PSSMHANDLE pSSM)
+{
+    AssertReturn(pVM,  VERR_INVALID_PARAMETER);
+    AssertReturn(pSSM, VERR_SSM_INVALID_STATE);
+
+    /** @todo Save per-CPU data. */
+    int rc = VINF_SUCCESS;
+#if 0
+    SSMR3PutU32(pSSM, pVM->cCpus);
+    for (VMCPUID i = 0; i < pVM->cCpus; i++)
+    {
+        rc = SSMR3PutXYZ(pSSM, pVM->aCpus[i].gim.s.XYZ);
+    }
+#endif
+
+    /*
+     * Save per-VM data.
+     */
+    SSMR3PutU32(pSSM, pVM->gim.s.enmProviderId);
+    SSMR3PutU32(pSSM, pVM->gim.s.u32Version);
+
+    /*
+     * Save provider-specific data.
+     */
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            rc = gimR3HvSave(pVM, pSSM);
+            AssertRCReturn(rc, rc);
+            break;
+
+        case GIMPROVIDERID_KVM:
+            rc = gimR3KvmSave(pVM, pSSM);
+            AssertRCReturn(rc, rc);
+            break;
+
+        default:
+            break;
+    }
+
+    return rc;
+}
+
+
+/**
+ * Execute state load operation.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pSSM            SSM operation handle.
+ * @param   uVersion        Data layout version.
+ * @param   uPass           The data pass.
+ */
+DECLCALLBACK(int) gimR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion, uint32_t uPass)
+{
+    if (uPass != SSM_PASS_FINAL)
+        return VINF_SUCCESS;
+    if (uSSMVersion != GIM_SAVED_STATE_VERSION)
+        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
+
+    /** @todo Load per-CPU data. */
+    int rc;
+#if 0
+    for (VMCPUID i = 0; i < pVM->cCpus; i++)
+    {
+        rc = SSMR3PutXYZ(pSSM, pVM->aCpus[i].gim.s.XYZ);
+    }
+#endif
+
+    /*
+     * Load per-VM data.
+     */
+    uint32_t uProviderId;
+    uint32_t uProviderVersion;
+
+    rc = SSMR3GetU32(pSSM, &uProviderId);           AssertRCReturn(rc, rc);
+    rc = SSMR3GetU32(pSSM, &uProviderVersion);      AssertRCReturn(rc, rc);
+
+    if ((GIMPROVIDERID)uProviderId != pVM->gim.s.enmProviderId)
+        return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Saved GIM provider %u differs from the configured one (%u)."),
+                                uProviderId, pVM->gim.s.enmProviderId);
+#if 0 /** @todo r=bird: Figure out what you mean to do here with the version. */
+    if (uProviderVersion != pVM->gim.s.u32Version)
+        return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Saved GIM provider version %u differs from the configured one (%u)."),
+                                uProviderVersion, pVM->gim.s.u32Version);
+#else
+    pVM->gim.s.u32Version = uProviderVersion;
+#endif
+
+    /*
+     * Load provider-specific data.
+     */
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            rc = gimR3HvLoad(pVM, pSSM, uSSMVersion);
+            AssertRCReturn(rc, rc);
+            break;
+
+        case GIMPROVIDERID_KVM:
+            rc = gimR3KvmLoad(pVM, pSSM, uSSMVersion);
+            AssertRCReturn(rc, rc);
+            break;
+
+        default:
+            break;
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Terminates the GIM.
+ *
+ * Termination means cleaning up and freeing all resources,
+ * the VM itself is, at this point, powered off or suspended.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) GIMR3Term(PVM pVM)
+{
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimR3HvTerm(pVM);
+
+        case GIMPROVIDERID_KVM:
+            return gimR3KvmTerm(pVM);
+
+        default:
+            break;
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * The VM is being reset.
+ *
+ * For the GIM component this means unmapping and unregistering MMIO2 regions
+ * and other provider-specific resets.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(void) GIMR3Reset(PVM pVM)
+{
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimR3HvReset(pVM);
+
+        case GIMPROVIDERID_KVM:
+            return gimR3KvmReset(pVM);
+
+        default:
+            break;
+    }
+}
+
+
+/**
+ * Registers the GIM device with VMM.
+ *
+ * @param   pVM         Pointer to the VM.
+ * @param   pDevIns     Pointer to the GIM device instance.
+ */
+VMMR3DECL(void) GIMR3GimDeviceRegister(PVM pVM, PPDMDEVINS pDevIns)
+{
+    pVM->gim.s.pDevInsR3 = pDevIns;
+}
+
+
+/**
+ * Returns the array of MMIO2 regions that are expected to be registered and
+ * later mapped into the guest-physical address space for the GIM provider
+ * configured for the VM.
+ *
+ * @returns Pointer to an array of GIM MMIO2 regions, may return NULL.
+ * @param   pVM         Pointer to the VM.
+ * @param   pcRegions   Where to store the number of items in the array.
+ *
+ * @remarks The caller does not own and therefore must -NOT- try to free the
+ *          returned pointer.
+ */
+VMMR3DECL(PGIMMMIO2REGION) GIMR3GetMmio2Regions(PVM pVM, uint32_t *pcRegions)
+{
+    Assert(pVM);
+    Assert(pcRegions);
+
+    *pcRegions = 0;
+    switch (pVM->gim.s.enmProviderId)
+    {
+        case GIMPROVIDERID_HYPERV:
+            return gimR3HvGetMmio2Regions(pVM, pcRegions);
+
+        default:
+            break;
+    }
+
+    return NULL;
+}
+
+
+/**
+ * Unmaps a registered MMIO2 region in the guest address space and removes any
+ * access handlers for it.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pRegion     Pointer to the GIM MMIO2 region.
+ */
+VMMR3_INT_DECL(int) GIMR3Mmio2Unmap(PVM pVM, PGIMMMIO2REGION pRegion)
+{
+    AssertPtr(pVM);
+    AssertPtr(pRegion);
+
+    PPDMDEVINS pDevIns = pVM->gim.s.pDevInsR3;
+    AssertPtr(pDevIns);
+    if (pRegion->fMapped)
+    {
+        int rc = PGMHandlerPhysicalDeregister(pVM, pRegion->GCPhysPage);
+        AssertRC(rc);
+
+        rc = PDMDevHlpMMIO2Unmap(pDevIns, pRegion->iRegion, pRegion->GCPhysPage);
+        if (RT_SUCCESS(rc))
+        {
+            pRegion->fMapped    = false;
+            pRegion->GCPhysPage = NIL_RTGCPHYS;
+        }
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Write access handler for a mapped MMIO2 region. At present, this handler
+ * simply ignores writes.
+ *
+ * In the future we might want to let the GIM provider decide what the handler
+ * should do (like throwing #GP faults).
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           The cross context CPU structure for the calling EMT.
+ * @param   GCPhys          The guest-physical address of the region.
+ * @param   pvPhys          Pointer to the region in the guest address space.
+ * @param   pvBuf           Pointer to the data being read/written.
+ * @param   cbBuf           The size of the buffer in @a pvBuf.
+ * @param   enmAccessType   The type of access.
+ * @param   enmOrigin       Who is making the access.
+ * @param   pvUser          User argument (NULL, not used).
+ */
+static DECLCALLBACK(int) gimR3Mmio2WriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
+                                                PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
+{
+    /*
+     * Ignore writes to the mapped MMIO2 page.
+     */
+    Assert(enmAccessType == PGMACCESSTYPE_WRITE);
+    return VINF_SUCCESS;        /** @todo Hyper-V says we should #GP(0) fault for writes to the Hypercall and TSC page. */
+}
+
+
+/**
+ * Maps a registered MMIO2 region in the guest address space. The region will be
+ * made read-only and writes from the guest will be ignored.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pRegion         Pointer to the GIM MMIO2 region.
+ * @param   GCPhysRegion    Where in the guest address space to map the region.
+ */
+VMMR3_INT_DECL(int) GIMR3Mmio2Map(PVM pVM, PGIMMMIO2REGION pRegion, RTGCPHYS GCPhysRegion)
+{
+    PPDMDEVINS pDevIns = pVM->gim.s.pDevInsR3;
+    AssertPtr(pDevIns);
+
+    /* The guest-physical address must be page-aligned. */
+    if (GCPhysRegion & PAGE_OFFSET_MASK)
+    {
+        LogFunc(("%s: %#RGp not paging aligned\n", pRegion->szDescription, GCPhysRegion));
+        return VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS;
+    }
+
+    /* Allow only normal pages to be overlaid using our MMIO2 pages (disallow MMIO, ROM, reserved pages). */
+    /** @todo Hyper-V doesn't seem to be very strict about this, may be relax
+     *        later if some guest really requires it. */
+    if (!PGMPhysIsGCPhysNormal(pVM, GCPhysRegion))
+    {
+        LogFunc(("%s: %#RGp is not normal memory\n", pRegion->szDescription, GCPhysRegion));
+        return VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS;
+    }
+
+    if (!pRegion->fRegistered)
+    {
+        LogFunc(("%s: Region has not been registered.\n"));
+        return VERR_GIM_IPE_1;
+    }
+
+    /*
+     * Map the MMIO2 region over the specified guest-physical address.
+     */
+    int rc = PDMDevHlpMMIO2Map(pDevIns, pRegion->iRegion, GCPhysRegion);
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Install access-handlers for the mapped page to prevent (ignore) writes to it
+         * from the guest.
+         */
+        if (pVM->gim.s.hSemiReadOnlyMmio2Handler == NIL_PGMPHYSHANDLERTYPE)
+            rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE,
+                                                  gimR3Mmio2WriteHandler,
+                                                  NULL /* pszModR0 */, NULL /* pszHandlerR0 */,
+                                                  NULL /* pszModRC */, NULL /* pszHandlerRC */,
+                                                  "GIM read-only MMIO2 handler",
+                                                  &pVM->gim.s.hSemiReadOnlyMmio2Handler);
+        if (RT_SUCCESS(rc))
+        {
+            rc = PGMHandlerPhysicalRegister(pVM,  GCPhysRegion, GCPhysRegion + (pRegion->cbRegion - 1),
+                                            pVM->gim.s.hSemiReadOnlyMmio2Handler,
+                                            NULL /* pvUserR3 */, NIL_RTR0PTR /* pvUserR0 */, NIL_RTRCPTR /* pvUserRC */,
+                                            pRegion->szDescription);
+            if (RT_SUCCESS(rc))
+            {
+                pRegion->fMapped    = true;
+                pRegion->GCPhysPage = GCPhysRegion;
+                return rc;
+            }
+        }
+
+        PDMDevHlpMMIO2Unmap(pDevIns, pRegion->iRegion, GCPhysRegion);
+    }
+
+    return rc;
+}
+
+#if 0
+/**
+ * Registers the physical handler for the registered and mapped MMIO2 region.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pRegion     Pointer to the GIM MMIO2 region.
+ */
+VMMR3_INT_DECL(int) GIMR3Mmio2HandlerPhysicalRegister(PVM pVM, PGIMMMIO2REGION pRegion)
+{
+    AssertPtr(pRegion);
+    AssertReturn(pRegion->fRegistered, VERR_GIM_IPE_2);
+    AssertReturn(pRegion->fMapped, VERR_GIM_IPE_3);
+
+    return PGMR3HandlerPhysicalRegister(pVM,
+                                        PGMPHYSHANDLERKIND_WRITE,
+                                        pRegion->GCPhysPage, pRegion->GCPhysPage + (pRegion->cbRegion - 1),
+                                        gimR3Mmio2WriteHandler,  NULL /* pvUserR3 */,
+                                        NULL /* pszModR0 */, NULL /* pszHandlerR0 */, NIL_RTR0PTR /* pvUserR0 */,
+                                        NULL /* pszModRC */, NULL /* pszHandlerRC */, NIL_RTRCPTR /* pvUserRC */,
+                                        pRegion->szDescription);
+}
+
+
+/**
+ * Deregisters the physical handler for the MMIO2 region.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   pRegion     Pointer to the GIM MMIO2 region.
+ */
+VMMR3_INT_DECL(int) GIMR3Mmio2HandlerPhysicalDeregister(PVM pVM, PGIMMMIO2REGION pRegion)
+{
+    return PGMHandlerPhysicalDeregister(pVM, pRegion->GCPhysPage);
+}
+#endif
+
diff --git a/src/VBox/VMM/VMMR3/GIMHv.cpp b/src/VBox/VMM/VMMR3/GIMHv.cpp
new file mode 100644
index 0000000..99c711a
--- /dev/null
+++ b/src/VBox/VMM/VMMR3/GIMHv.cpp
@@ -0,0 +1,714 @@
+/* $Id: GIMHv.cpp $ */
+/** @file
+ * GIM - Guest Interface Manager, Hyper-V implementation.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include "GIMInternal.h"
+
+#include <iprt/assert.h>
+#include <iprt/err.h>
+#include <iprt/string.h>
+#include <iprt/mem.h>
+#include <iprt/spinlock.h>
+
+#include <VBox/vmm/cpum.h>
+#include <VBox/vmm/ssm.h>
+#include <VBox/vmm/vm.h>
+#include <VBox/vmm/hm.h>
+#include <VBox/vmm/pdmapi.h>
+#include <VBox/version.h>
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+//#define GIMHV_HYPERCALL                 "GIMHvHypercall"
+
+/**
+ * GIM Hyper-V saved-state version.
+ */
+#define GIM_HV_SAVED_STATE_VERSION          UINT32_C(1)
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+#ifdef VBOX_WITH_STATISTICS
+# define GIMHV_MSRRANGE(a_uFirst, a_uLast, a_szName) \
+    { (a_uFirst), (a_uLast), kCpumMsrRdFn_Gim, kCpumMsrWrFn_Gim, 0, 0, 0, 0, 0, a_szName, { 0 }, { 0 }, { 0 }, { 0 } }
+#else
+# define GIMHV_MSRRANGE(a_uFirst, a_uLast, a_szName) \
+    { (a_uFirst), (a_uLast), kCpumMsrRdFn_Gim, kCpumMsrWrFn_Gim, 0, 0, 0, 0, 0, a_szName }
+#endif
+
+/**
+ * Array of MSR ranges supported by Hyper-V.
+ */
+static CPUMMSRRANGE const g_aMsrRanges_HyperV[] =
+{
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE0_START,  MSR_GIM_HV_RANGE0_END,  "Hyper-V range 0"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE1_START,  MSR_GIM_HV_RANGE1_END,  "Hyper-V range 1"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE2_START,  MSR_GIM_HV_RANGE2_END,  "Hyper-V range 2"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE3_START,  MSR_GIM_HV_RANGE3_END,  "Hyper-V range 3"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE4_START,  MSR_GIM_HV_RANGE4_END,  "Hyper-V range 4"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE5_START,  MSR_GIM_HV_RANGE5_END,  "Hyper-V range 5"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE6_START,  MSR_GIM_HV_RANGE6_END,  "Hyper-V range 6"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE7_START,  MSR_GIM_HV_RANGE7_END,  "Hyper-V range 7"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE8_START,  MSR_GIM_HV_RANGE8_END,  "Hyper-V range 8"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE9_START,  MSR_GIM_HV_RANGE9_END,  "Hyper-V range 9"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE10_START, MSR_GIM_HV_RANGE10_END, "Hyper-V range 10"),
+    GIMHV_MSRRANGE(MSR_GIM_HV_RANGE11_START, MSR_GIM_HV_RANGE11_END, "Hyper-V range 11")
+};
+#undef GIMHV_MSRRANGE
+
+
+/**
+ * Initializes the Hyper-V GIM provider.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   uVersion    The interface version this VM should use.
+ */
+VMMR3_INT_DECL(int) gimR3HvInit(PVM pVM)
+{
+    AssertReturn(pVM, VERR_INVALID_PARAMETER);
+    AssertReturn(pVM->gim.s.enmProviderId == GIMPROVIDERID_HYPERV, VERR_INTERNAL_ERROR_5);
+
+    int rc;
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+
+    /*
+     * Determine interface capabilities based on the version.
+     */
+    if (!pVM->gim.s.u32Version)
+    {
+        /* Basic features. */
+        pHv->uBaseFeat = 0
+                       //| GIM_HV_BASE_FEAT_VP_RUNTIME_MSR
+                       | GIM_HV_BASE_FEAT_PART_TIME_REF_COUNT_MSR
+                       //| GIM_HV_BASE_FEAT_BASIC_SYNTH_IC
+                       //| GIM_HV_BASE_FEAT_SYNTH_TIMER_MSRS
+                       | GIM_HV_BASE_FEAT_APIC_ACCESS_MSRS
+                       | GIM_HV_BASE_FEAT_HYPERCALL_MSRS
+                       | GIM_HV_BASE_FEAT_VP_ID_MSR
+                       | GIM_HV_BASE_FEAT_VIRT_SYS_RESET_MSR
+                       //| GIM_HV_BASE_FEAT_STAT_PAGES_MSR
+                       | GIM_HV_BASE_FEAT_PART_REF_TSC_MSR
+                       //| GIM_HV_BASE_FEAT_GUEST_IDLE_STATE_MSR
+                       | GIM_HV_BASE_FEAT_TIMER_FREQ_MSRS
+                       //| GIM_HV_BASE_FEAT_DEBUG_MSRS
+                       ;
+
+        /* Miscellaneous features. */
+        pHv->uMiscFeat = GIM_HV_MISC_FEAT_TIMER_FREQ;
+
+        /* Hypervisor recommendations to the guest. */
+        pHv->uHyperHints = GIM_HV_HINT_MSR_FOR_SYS_RESET
+                         | GIM_HV_HINT_RELAX_TIME_CHECKS;
+    }
+
+    /*
+     * Populate the required fields in MMIO2 region records for registering.
+     */
+    AssertCompile(GIM_HV_PAGE_SIZE == PAGE_SIZE);
+    PGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX];
+    pRegion->iRegion    = GIM_HV_HYPERCALL_PAGE_REGION_IDX;
+    pRegion->fRCMapping = false;
+    pRegion->cbRegion   = PAGE_SIZE;
+    pRegion->GCPhysPage = NIL_RTGCPHYS;
+    RTStrCopy(pRegion->szDescription, sizeof(pRegion->szDescription), "Hyper-V hypercall page");
+
+    pRegion = &pHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];
+    pRegion->iRegion    = GIM_HV_REF_TSC_PAGE_REGION_IDX;
+    pRegion->fRCMapping = false;
+    pRegion->cbRegion   = PAGE_SIZE;
+    pRegion->GCPhysPage = NIL_RTGCPHYS;
+    RTStrCopy(pRegion->szDescription, sizeof(pRegion->szDescription), "Hyper-V TSC page");
+
+    /*
+     * Make sure the CPU ID bit are in accordance to the Hyper-V
+     * requirement and other paranoia checks.
+     * See "Requirements for implementing the Microsoft hypervisor interface" spec.
+     */
+    Assert(!(pHv->uPartFlags & (  GIM_HV_PART_FLAGS_CREATE_PART
+                                | GIM_HV_PART_FLAGS_ACCESS_MEMORY_POOL
+                                | GIM_HV_PART_FLAGS_ACCESS_PART_ID
+                                | GIM_HV_PART_FLAGS_ADJUST_MSG_BUFFERS
+                                | GIM_HV_PART_FLAGS_CREATE_PORT
+                                | GIM_HV_PART_FLAGS_ACCESS_STATS
+                                | GIM_HV_PART_FLAGS_CPU_MGMT
+                                | GIM_HV_PART_FLAGS_CPU_PROFILER)));
+    Assert((pHv->uBaseFeat & (GIM_HV_BASE_FEAT_HYPERCALL_MSRS | GIM_HV_BASE_FEAT_VP_ID_MSR))
+                          == (GIM_HV_BASE_FEAT_HYPERCALL_MSRS | GIM_HV_BASE_FEAT_VP_ID_MSR));
+    for (unsigned i = 0; i < RT_ELEMENTS(pHv->aMmio2Regions); i++)
+    {
+        PCGIMMMIO2REGION pcCur = &pHv->aMmio2Regions[i];
+        Assert(!pcCur->fRCMapping);
+        Assert(!pcCur->fMapped);
+        Assert(pcCur->GCPhysPage == NIL_RTGCPHYS);
+    }
+
+    /*
+     * Expose HVP (Hypervisor Present) bit to the guest.
+     */
+    CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_HVP);
+
+    /*
+     * Modify the standard hypervisor leaves for Hyper-V.
+     */
+    CPUMCPUIDLEAF HyperLeaf;
+    RT_ZERO(HyperLeaf);
+    HyperLeaf.uLeaf        = UINT32_C(0x40000000);
+    HyperLeaf.uEax         = UINT32_C(0x40000006); /* Minimum value for Hyper-V is 0x40000005. */
+    HyperLeaf.uEbx         = 0x7263694D;           /* 'Micr' */
+    HyperLeaf.uEcx         = 0x666F736F;           /* 'osof' */
+    HyperLeaf.uEdx         = 0x76482074;           /* 't Hv' */
+    rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    HyperLeaf.uLeaf        = UINT32_C(0x40000001);
+    HyperLeaf.uEax         = 0x31237648;           /* 'Hv#1' */
+    HyperLeaf.uEbx         = 0;                    /* Reserved */
+    HyperLeaf.uEcx         = 0;                    /* Reserved */
+    HyperLeaf.uEdx         = 0;                    /* Reserved */
+    rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    /*
+     * Add Hyper-V specific leaves.
+     */
+    HyperLeaf.uLeaf        = UINT32_C(0x40000002); /* MBZ until MSR_GIM_HV_GUEST_OS_ID is set by the guest. */
+    HyperLeaf.uEax         = 0;
+    HyperLeaf.uEbx         = 0;
+    HyperLeaf.uEcx         = 0;
+    HyperLeaf.uEdx         = 0;
+    rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    HyperLeaf.uLeaf        = UINT32_C(0x40000003);
+    HyperLeaf.uEax         = pHv->uBaseFeat;
+    HyperLeaf.uEbx         = pHv->uPartFlags;
+    HyperLeaf.uEcx         = pHv->uPowMgmtFeat;
+    HyperLeaf.uEdx         = pHv->uMiscFeat;
+    rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    HyperLeaf.uLeaf        = UINT32_C(0x40000004);
+    HyperLeaf.uEax         = pHv->uHyperHints;
+    HyperLeaf.uEbx         = 0xffffffff;
+    HyperLeaf.uEcx         = 0;
+    HyperLeaf.uEdx         = 0;
+    rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    /*
+     * Insert all MSR ranges of Hyper-V.
+     */
+    for (unsigned i = 0; i < RT_ELEMENTS(g_aMsrRanges_HyperV); i++)
+    {
+        rc = CPUMR3MsrRangesInsert(pVM, &g_aMsrRanges_HyperV[i]);
+        AssertLogRelRCReturn(rc, rc);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Initializes remaining bits of the Hyper-V provider.
+ *
+ * This is called after initializing HM and almost all other VMM components.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) gimR3HvInitCompleted(PVM pVM)
+{
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+
+    /*
+     * Determine interface capabilities based on the version.
+     */
+    if (!pVM->gim.s.u32Version)
+    {
+        /* Hypervisor capabilities; features used by the hypervisor. */
+        pHv->uHyperCaps  = HMIsNestedPagingActive(pVM)   ? GIM_HV_HOST_FEAT_NESTED_PAGING : 0;
+        pHv->uHyperCaps |= HMAreMsrBitmapsAvailable(pVM) ? GIM_HV_HOST_FEAT_MSR_BITMAP : 0;
+    }
+
+    CPUMCPUIDLEAF HyperLeaf;
+    RT_ZERO(HyperLeaf);
+    HyperLeaf.uLeaf        = UINT32_C(0x40000006);
+    HyperLeaf.uEax         = pHv->uHyperCaps;
+    HyperLeaf.uEbx         = 0;
+    HyperLeaf.uEcx         = 0;
+    HyperLeaf.uEdx         = 0;
+    int rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    return rc;
+}
+
+
+#if 0
+VMMR3_INT_DECL(int) gimR3HvInitFinalize(PVM pVM)
+{
+    pVM->gim.s.pfnHypercallR3 = &GIMHvHypercall;
+    if (!HMIsEnabled(pVM))
+    {
+        rc = PDMR3LdrGetSymbolRC(pVM, NULL /* pszModule */, GIMHV_HYPERCALL, &pVM->gim.s.pfnHypercallRC);
+        AssertRCReturn(rc, rc);
+    }
+    rc = PDMR3LdrGetSymbolR0(pVM, NULL /* pszModule */, GIMHV_HYPERCALL, &pVM->gim.s.pfnHypercallR0);
+    AssertRCReturn(rc, rc);
+}
+#endif
+
+
+/**
+ * Terminates the Hyper-V GIM provider.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) gimR3HvTerm(PVM pVM)
+{
+    gimR3HvReset(pVM);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Applies relocations to data and code managed by this component.
+ *
+ * This function will be called at init and whenever the VMM need to relocate
+ * itself inside the GC.
+ *
+ * @param   pVM         Pointer to the VM.
+ * @param   offDelta    Relocation delta relative to old location.
+ */
+VMMR3_INT_DECL(void) gimR3HvRelocate(PVM pVM, RTGCINTPTR offDelta)
+{
+#if 0
+    int rc = PDMR3LdrGetSymbolRC(pVM, NULL /* pszModule */, GIMHV_HYPERCALL, &pVM->gim.s.pfnHypercallRC);
+    AssertFatalRC(rc);
+#endif
+}
+
+
+/**
+ * This resets Hyper-V provider MSRs and unmaps whatever Hyper-V regions that
+ * the guest may have mapped.
+ *
+ * This is called when the VM is being reset.
+ *
+ * @param   pVM     Pointer to the VM.
+ * @thread EMT(0).
+ */
+VMMR3_INT_DECL(void) gimR3HvReset(PVM pVM)
+{
+    VM_ASSERT_EMT0(pVM);
+
+    /*
+     * Unmap MMIO2 pages that the guest may have setup.
+     */
+    LogRel(("GIM: HyperV: Resetting MMIO2 regions and MSRs\n"));
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+    for (unsigned i = 0; i < RT_ELEMENTS(pHv->aMmio2Regions); i++)
+    {
+        PGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[i];
+        GIMR3Mmio2Unmap(pVM, pRegion);
+    }
+
+    /*
+     * Reset MSRs.
+     */
+    pHv->u64GuestOsIdMsr = 0;
+    pHv->u64HypercallMsr = 0;
+    pHv->u64TscPageMsr   = 0;
+}
+
+
+/**
+ * Returns a pointer to the MMIO2 regions supported by Hyper-V.
+ *
+ * @returns Pointer to an array of MMIO2 regions.
+ * @param   pVM         Pointer to the VM.
+ * @param   pcRegions   Where to store the number of regions in the array.
+ */
+VMMR3_INT_DECL(PGIMMMIO2REGION) gimR3HvGetMmio2Regions(PVM pVM, uint32_t *pcRegions)
+{
+    Assert(GIMIsEnabled(pVM));
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+
+    *pcRegions = RT_ELEMENTS(pHv->aMmio2Regions);
+    Assert(*pcRegions <= UINT8_MAX);    /* See PGMR3PhysMMIO2Register(). */
+    return pHv->aMmio2Regions;
+}
+
+
+/**
+ * Hyper-V state-save operation.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ * @param   pSSM    Pointer to the SSM handle.
+ */
+VMMR3_INT_DECL(int) gimR3HvSave(PVM pVM, PSSMHANDLE pSSM)
+{
+    PCGIMHV pcHv = &pVM->gim.s.u.Hv;
+
+    /*
+     * Save the Hyper-V SSM version.
+     */
+    SSMR3PutU32(pSSM, GIM_HV_SAVED_STATE_VERSION);
+
+    /*
+     * Save per-VM MSRs.
+     */
+    SSMR3PutU64(pSSM, pcHv->u64GuestOsIdMsr);
+    SSMR3PutU64(pSSM, pcHv->u64HypercallMsr);
+    SSMR3PutU64(pSSM, pcHv->u64TscPageMsr);
+
+    /*
+     * Save Hyper-V features / capabilities.
+     */
+    SSMR3PutU32(pSSM, pcHv->uBaseFeat);
+    SSMR3PutU32(pSSM, pcHv->uPartFlags);
+    SSMR3PutU32(pSSM, pcHv->uPowMgmtFeat);
+    SSMR3PutU32(pSSM, pcHv->uMiscFeat);
+    SSMR3PutU32(pSSM, pcHv->uHyperHints);
+    SSMR3PutU32(pSSM, pcHv->uHyperCaps);
+
+    /*
+     * Save the Hypercall region.
+     */
+    PCGIMMMIO2REGION pcRegion = &pcHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX];
+    SSMR3PutU8(pSSM,     pcRegion->iRegion);
+    SSMR3PutBool(pSSM,   pcRegion->fRCMapping);
+    SSMR3PutU32(pSSM,    pcRegion->cbRegion);
+    SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage);
+    SSMR3PutStrZ(pSSM,   pcRegion->szDescription);
+
+    /*
+     * Save the reference TSC region.
+     */
+    pcRegion = &pcHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];
+    SSMR3PutU8(pSSM,     pcRegion->iRegion);
+    SSMR3PutBool(pSSM,   pcRegion->fRCMapping);
+    SSMR3PutU32(pSSM,    pcRegion->cbRegion);
+    SSMR3PutGCPhys(pSSM, pcRegion->GCPhysPage);
+    SSMR3PutStrZ(pSSM,   pcRegion->szDescription);
+    /* Save the TSC sequence so we can bump it on restore (as the CPU frequency/offset may change). */
+    uint32_t uTscSequence = 0;
+    if (   pcRegion->fMapped
+        && MSR_GIM_HV_REF_TSC_IS_ENABLED(pcHv->u64TscPageMsr))
+    {
+        PCGIMHVREFTSC pcRefTsc = (PCGIMHVREFTSC)pcRegion->pvPageR3;
+        uTscSequence = pcRefTsc->u32TscSequence;
+    }
+
+    return SSMR3PutU32(pSSM, uTscSequence);
+}
+
+
+/**
+ * Hyper-V state-load operation, final pass.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pSSM            Pointer to the SSM handle.
+ * @param   uSSMVersion     The GIM saved-state version.
+ */
+VMMR3_INT_DECL(int) gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion)
+{
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+
+    /*
+     * Load the Hyper-V SSM version first.
+     */
+    uint32_t uHvSavedStatVersion;
+    int rc = SSMR3GetU32(pSSM, &uHvSavedStatVersion);
+    AssertRCReturn(rc, rc);
+    if (uHvSavedStatVersion != GIM_HV_SAVED_STATE_VERSION)
+        return SSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS,
+                                 N_("Unsupported Hyper-V saved-state version %u (expected %u)."), uHvSavedStatVersion,
+                                 GIM_HV_SAVED_STATE_VERSION);
+
+    /*
+     * Load per-VM MSRs.
+     */
+    SSMR3GetU64(pSSM, &pHv->u64GuestOsIdMsr);
+    SSMR3GetU64(pSSM, &pHv->u64HypercallMsr);
+    SSMR3GetU64(pSSM, &pHv->u64TscPageMsr);
+
+    /*
+     * Load Hyper-V features / capabilities.
+     */
+    SSMR3GetU32(pSSM, &pHv->uBaseFeat);
+    SSMR3GetU32(pSSM, &pHv->uPartFlags);
+    SSMR3GetU32(pSSM, &pHv->uPowMgmtFeat);
+    SSMR3GetU32(pSSM, &pHv->uMiscFeat);
+    SSMR3GetU32(pSSM, &pHv->uHyperHints);
+    SSMR3GetU32(pSSM, &pHv->uHyperCaps);
+
+    /*
+     * Load and enable the Hypercall region.
+     */
+    PGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX];
+    SSMR3GetU8(pSSM,     &pRegion->iRegion);
+    SSMR3GetBool(pSSM,   &pRegion->fRCMapping);
+    SSMR3GetU32(pSSM,    &pRegion->cbRegion);
+    SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage);
+    rc = SSMR3GetStrZ(pSSM, pRegion->szDescription, sizeof(pRegion->szDescription));
+    AssertRCReturn(rc, rc);
+    if (MSR_GIM_HV_HYPERCALL_IS_ENABLED(pHv->u64HypercallMsr))
+    {
+        Assert(pRegion->GCPhysPage != NIL_RTGCPHYS);
+        if (RT_LIKELY(pRegion->fRegistered))
+        {
+            rc = gimR3HvEnableHypercallPage(pVM, pRegion->GCPhysPage);
+            if (RT_FAILURE(rc))
+                return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Failed to enable the hypercall page. GCPhys=%#RGp rc=%Rrc"),
+                                        pRegion->GCPhysPage, rc);
+        }
+        else
+            return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Hypercall MMIO2 region not registered. Missing GIM device?!"));
+    }
+
+    /*
+     * Load and enable the reference TSC region.
+     */
+    uint32_t uTscSequence;
+    pRegion = &pHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];
+    SSMR3GetU8(pSSM,     &pRegion->iRegion);
+    SSMR3GetBool(pSSM,   &pRegion->fRCMapping);
+    SSMR3GetU32(pSSM,    &pRegion->cbRegion);
+    SSMR3GetGCPhys(pSSM, &pRegion->GCPhysPage);
+    SSMR3GetStrZ(pSSM,    pRegion->szDescription, sizeof(pRegion->szDescription));
+    rc = SSMR3GetU32(pSSM, &uTscSequence);
+    AssertRCReturn(rc, rc);
+    if (MSR_GIM_HV_REF_TSC_IS_ENABLED(pHv->u64TscPageMsr))
+    {
+        Assert(pRegion->GCPhysPage != NIL_RTGCPHYS);
+        if (pRegion->fRegistered)
+        {
+            rc = gimR3HvEnableTscPage(pVM, pRegion->GCPhysPage, true /* fUseThisTscSeq */, uTscSequence);
+            if (RT_FAILURE(rc))
+                return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Failed to enable the TSC page. GCPhys=%#RGp rc=%Rrc"),
+                                        pRegion->GCPhysPage, rc);
+        }
+        else
+            return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("TSC-page MMIO2 region not registered. Missing GIM device?!"));
+    }
+
+    return rc;
+}
+
+
+/**
+ * Enables the Hyper-V TSC page.
+ *
+ * @returns VBox status code.
+ * @param   pVM                Pointer to the VM.
+ * @param   GCPhysTscPage      Where to map the TSC page.
+ * @param   fUseThisTscSeq     Whether to set the TSC sequence number to the one
+ *                             specified in @a uTscSeq.
+ * @param   uTscSeq            The TSC sequence value to use. Ignored if
+ *                             @a fUseThisTscSeq is false.
+ */
+VMMR3_INT_DECL(int) gimR3HvEnableTscPage(PVM pVM, RTGCPHYS GCPhysTscPage, bool fUseThisTscSeq, uint32_t uTscSeq)
+{
+    PPDMDEVINSR3    pDevIns = pVM->gim.s.pDevInsR3;
+    PGIMMMIO2REGION pRegion = &pVM->gim.s.u.Hv.aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];
+    AssertPtrReturn(pDevIns, VERR_GIM_DEVICE_NOT_REGISTERED);
+
+    int rc;
+    if (pRegion->fMapped)
+    {
+        /*
+         * Is it already enabled at the given guest-address?
+         */
+        if (pRegion->GCPhysPage == GCPhysTscPage)
+            return VINF_SUCCESS;
+
+        /*
+         * If it's mapped at a different address, unmap the previous address.
+         */
+        rc = gimR3HvDisableTscPage(pVM);
+        AssertRC(rc);
+    }
+
+    /*
+     * Map the TSC-page at the specified address.
+     */
+    Assert(!pRegion->fMapped);
+    rc = GIMR3Mmio2Map(pVM, pRegion, GCPhysTscPage);
+    if (RT_SUCCESS(rc))
+    {
+        Assert(pRegion->GCPhysPage == GCPhysTscPage);
+
+        /*
+         * Update the TSC scale. Windows guests expect a non-zero TSC sequence, otherwise
+         * they fallback to using the reference count MSR which is not ideal in terms of VM-exits.
+         *
+         * Also, Hyper-V normalizes the time in 10 MHz, see:
+         * http://technet.microsoft.com/it-it/sysinternals/dn553408%28v=vs.110%29
+         */
+        PGIMHVREFTSC pRefTsc = (PGIMHVREFTSC)pRegion->pvPageR3;
+        Assert(pRefTsc);
+
+        uint64_t const u64TscKHz = TMCpuTicksPerSecond(pVM) / UINT64_C(1000);
+        uint32_t       u32TscSeq = 1;
+        if (   fUseThisTscSeq
+            && uTscSeq < UINT32_C(0xfffffffe))
+            u32TscSeq = uTscSeq + 1;
+        pRefTsc->u32TscSequence  = u32TscSeq;
+        pRefTsc->u64TscScale     = ((INT64_C(10000) << 32) / u64TscKHz) << 32;
+        pRefTsc->i64TscOffset    = 0;
+
+        LogRel(("GIM: HyperV: Enabled TSC page at %#RGp - u64TscScale=%#RX64 u64TscKHz=%#RX64 (%'RU64) Seq=%#RU32\n",
+                GCPhysTscPage, pRefTsc->u64TscScale, u64TscKHz, u64TscKHz, pRefTsc->u32TscSequence));
+
+        TMR3CpuTickParavirtEnable(pVM);
+        return VINF_SUCCESS;
+    }
+    else
+        LogRelFunc(("GIMR3Mmio2Map failed. rc=%Rrc\n", rc));
+
+    return VERR_GIM_OPERATION_FAILED;
+}
+
+
+/**
+ * Disables the Hyper-V TSC page.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) gimR3HvDisableTscPage(PVM pVM)
+{
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+    PGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[GIM_HV_REF_TSC_PAGE_REGION_IDX];
+    if (pRegion->fMapped)
+    {
+        GIMR3Mmio2Unmap(pVM, pRegion);
+        Assert(!pRegion->fMapped);
+        LogRel(("GIM: HyperV: Disabled TSC-page\n"));
+
+        TMR3CpuTickParavirtDisable(pVM);
+        return VINF_SUCCESS;
+    }
+    return VERR_GIM_PVTSC_NOT_ENABLED;
+}
+
+
+/**
+ * Disables the Hyper-V Hypercall page.
+ *
+ * @returns VBox status code.
+ */
+VMMR3_INT_DECL(int) gimR3HvDisableHypercallPage(PVM pVM)
+{
+    PGIMHV pHv = &pVM->gim.s.u.Hv;
+    PGIMMMIO2REGION pRegion = &pHv->aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX];
+    if (pRegion->fMapped)
+    {
+        GIMR3Mmio2Unmap(pVM, pRegion);
+        Assert(!pRegion->fMapped);
+        for (VMCPUID i = 0; i < pVM->cCpus; i++)
+            VMMHypercallsDisable(&pVM->aCpus[i]);
+        LogRel(("GIM: HyperV: Disabled Hypercall-page\n"));
+        return VINF_SUCCESS;
+    }
+    return VERR_GIM_HYPERCALLS_NOT_ENABLED;
+}
+
+
+/**
+ * Enables the Hyper-V Hypercall page.
+ *
+ * @returns VBox status code.
+ * @param   pVM                     Pointer to the VM.
+ * @param   GCPhysHypercallPage     Where to map the hypercall page.
+ */
+VMMR3_INT_DECL(int) gimR3HvEnableHypercallPage(PVM pVM, RTGCPHYS GCPhysHypercallPage)
+{
+    PPDMDEVINSR3    pDevIns = pVM->gim.s.pDevInsR3;
+    PGIMMMIO2REGION pRegion = &pVM->gim.s.u.Hv.aMmio2Regions[GIM_HV_HYPERCALL_PAGE_REGION_IDX];
+    AssertPtrReturn(pDevIns, VERR_GIM_DEVICE_NOT_REGISTERED);
+
+    if (pRegion->fMapped)
+    {
+        /*
+         * Is it already enabled at the given guest-address?
+         */
+        if (pRegion->GCPhysPage == GCPhysHypercallPage)
+            return VINF_SUCCESS;
+
+        /*
+         * If it's mapped at a different address, unmap the previous address.
+         */
+        int rc2 = gimR3HvDisableHypercallPage(pVM);
+        AssertRC(rc2);
+    }
+
+    /*
+     * Map the hypercall-page at the specified address.
+     */
+    Assert(!pRegion->fMapped);
+    int rc = GIMR3Mmio2Map(pVM, pRegion, GCPhysHypercallPage);
+    if (RT_SUCCESS(rc))
+    {
+        Assert(pRegion->GCPhysPage == GCPhysHypercallPage);
+
+        /*
+         * Patch the hypercall-page.
+         */
+        size_t cbWritten = 0;
+        rc = VMMPatchHypercall(pVM, pRegion->pvPageR3, PAGE_SIZE, &cbWritten);
+        if (   RT_SUCCESS(rc)
+            && cbWritten < PAGE_SIZE)
+        {
+            uint8_t *pbLast = (uint8_t *)pRegion->pvPageR3 + cbWritten;
+            *pbLast = 0xc3;  /* RET */
+
+            /*
+             * Notify VMM that hypercalls are now enabled for all VCPUs.
+             */
+            for (VMCPUID i = 0; i < pVM->cCpus; i++)
+                VMMHypercallsEnable(&pVM->aCpus[i]);
+
+            LogRel(("GIM: HyperV: Enabled hypercalls at %#RGp\n", GCPhysHypercallPage));
+            return VINF_SUCCESS;
+        }
+        else
+        {
+            if (rc == VINF_SUCCESS)
+                rc = VERR_GIM_OPERATION_FAILED;
+            LogRel(("GIM: HyperV: VMMPatchHypercall failed. rc=%Rrc cbWritten=%u\n", rc, cbWritten));
+        }
+
+        GIMR3Mmio2Unmap(pVM, pRegion);
+    }
+
+    LogRel(("GIM: HyperV: GIMR3Mmio2Map failed. rc=%Rrc\n", rc));
+    return rc;
+}
+
diff --git a/src/VBox/VMM/VMMR3/GIMKvm.cpp b/src/VBox/VMM/VMMR3/GIMKvm.cpp
new file mode 100644
index 0000000..7878a24
--- /dev/null
+++ b/src/VBox/VMM/VMMR3/GIMKvm.cpp
@@ -0,0 +1,541 @@
+/* $Id: GIMKvm.cpp $ */
+/** @file
+ * GIM - Guest Interface Manager, KVM implementation.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include "GIMInternal.h"
+
+#include <iprt/asm-math.h>
+#include <iprt/assert.h>
+#include <iprt/err.h>
+#include <iprt/string.h>
+#include <iprt/mem.h>
+#include <iprt/spinlock.h>
+
+#include <VBox/vmm/cpum.h>
+#include <VBox/disopcode.h>
+#include <VBox/vmm/ssm.h>
+#include <VBox/vmm/vm.h>
+#include <VBox/vmm/hm.h>
+#include <VBox/vmm/pdmapi.h>
+#include <VBox/version.h>
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+
+/**
+ * GIM KVM saved-state version.
+ */
+#define GIM_KVM_SAVED_STATE_VERSION         UINT32_C(1)
+
+/**
+ * VBox internal struct. to passback to EMT rendezvous callback while enabling
+ * the KVM wall-clock.
+ */
+typedef struct KVMWALLCLOCKINFO
+{
+    /** Guest physical address of the wall-clock struct.  */
+    RTGCPHYS GCPhysWallClock;
+} KVMWALLCLOCKINFO;
+/** Pointer to the wall-clock info. struct. */
+typedef KVMWALLCLOCKINFO *PKVMWALLCLOCKINFO;
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+#ifdef VBOX_WITH_STATISTICS
+# define GIMKVM_MSRRANGE(a_uFirst, a_uLast, a_szName) \
+    { (a_uFirst), (a_uLast), kCpumMsrRdFn_Gim, kCpumMsrWrFn_Gim, 0, 0, 0, 0, 0, a_szName, { 0 }, { 0 }, { 0 }, { 0 } }
+#else
+# define GIMKVM_MSRRANGE(a_uFirst, a_uLast, a_szName) \
+    { (a_uFirst), (a_uLast), kCpumMsrRdFn_Gim, kCpumMsrWrFn_Gim, 0, 0, 0, 0, 0, a_szName }
+#endif
+
+/**
+ * Array of MSR ranges supported by KVM.
+ */
+static CPUMMSRRANGE const g_aMsrRanges_Kvm[] =
+{
+    GIMKVM_MSRRANGE(MSR_GIM_KVM_RANGE0_START, MSR_GIM_KVM_RANGE0_END, "KVM range 0"),
+    GIMKVM_MSRRANGE(MSR_GIM_KVM_RANGE1_START, MSR_GIM_KVM_RANGE1_END, "KVM range 1")
+};
+#undef GIMKVM_MSRRANGE
+
+
+/**
+ * Initializes the KVM GIM provider.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ * @param   uVersion    The interface version this VM should use.
+ */
+VMMR3_INT_DECL(int) gimR3KvmInit(PVM pVM)
+{
+    AssertReturn(pVM, VERR_INVALID_PARAMETER);
+    AssertReturn(pVM->gim.s.enmProviderId == GIMPROVIDERID_KVM, VERR_INTERNAL_ERROR_5);
+
+    int rc;
+    PGIMKVM pKvm = &pVM->gim.s.u.Kvm;
+
+    /*
+     * Determine interface capabilities based on the version.
+     */
+    if (!pVM->gim.s.u32Version)
+    {
+        /* Basic features. */
+        pKvm->uBaseFeat = 0
+                        | GIM_KVM_BASE_FEAT_CLOCK_OLD
+                        //| GIM_KVM_BASE_FEAT_NOP_IO_DELAY
+                        //|  GIM_KVM_BASE_FEAT_MMU_OP
+                        | GIM_KVM_BASE_FEAT_CLOCK
+                        //| GIM_KVM_BASE_FEAT_ASYNC_PF
+                        //| GIM_KVM_BASE_FEAT_STEAL_TIME
+                        //| GIM_KVM_BASE_FEAT_PV_EOI
+                        | GIM_KVM_BASE_FEAT_PV_UNHALT
+                        ;
+        /* Rest of the features are determined in gimR3KvmInitCompleted(). */
+    }
+
+    /*
+     * Expose HVP (Hypervisor Present) bit to the guest.
+     */
+    CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_HVP);
+
+    /*
+     * Modify the standard hypervisor leaves for KVM.
+     */
+    CPUMCPUIDLEAF HyperLeaf;
+    RT_ZERO(HyperLeaf);
+    HyperLeaf.uLeaf        = UINT32_C(0x40000000);
+    HyperLeaf.uEax         = UINT32_C(0x40000001); /* Minimum value for KVM is 0x40000001. */
+    HyperLeaf.uEbx         = 0x4B4D564B;           /* 'KVMK' */
+    HyperLeaf.uEcx         = 0x564B4D56;           /* 'VMKV' */
+    HyperLeaf.uEdx         = 0x0000004D;           /* 'M000' */
+    rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    /*
+     * Add KVM specific leaves.
+     */
+    HyperLeaf.uLeaf        = UINT32_C(0x40000001);
+    HyperLeaf.uEax         = pKvm->uBaseFeat;
+    HyperLeaf.uEbx         = 0;                    /* Reserved */
+    HyperLeaf.uEcx         = 0;                    /* Reserved */
+    HyperLeaf.uEdx         = 0;                    /* Reserved */
+    rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+    AssertLogRelRCReturn(rc, rc);
+
+    /*
+     * Insert all MSR ranges of KVM.
+     */
+    for (unsigned i = 0; i < RT_ELEMENTS(g_aMsrRanges_Kvm); i++)
+    {
+        rc = CPUMR3MsrRangesInsert(pVM, &g_aMsrRanges_Kvm[i]);
+        AssertLogRelRCReturn(rc, rc);
+    }
+
+    /*
+     * Setup hypercall and #UD handling.
+     */
+    for (VMCPUID i = 0; i < pVM->cCpus; i++)
+        VMMHypercallsEnable(&pVM->aCpus[i]);
+
+    if (ASMIsAmdCpu())
+    {
+        pKvm->fTrapXcptUD   = true;
+        pKvm->uOpCodeNative = OP_VMMCALL;
+    }
+    else
+    {
+        Assert(ASMIsIntelCpu() || ASMIsViaCentaurCpu());
+        pKvm->fTrapXcptUD   = false;
+        pKvm->uOpCodeNative = OP_VMCALL;
+    }
+
+    /* We always need to trap VMCALL/VMMCALL hypercall using #UDs for raw-mode VMs. */
+    if (!HMIsEnabled(pVM))
+        pKvm->fTrapXcptUD = true;
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Initializes remaining bits of the KVM provider.
+ *
+ * This is called after initializing HM and almost all other VMM components.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) gimR3KvmInitCompleted(PVM pVM)
+{
+    if (TMR3CpuTickIsFixedRateMonotonic(pVM, true /* fWithParavirtEnabled */))
+    {
+        /** @todo We might want to consider just enabling this bit *always*. As far
+         *        as I can see in the Linux guest, the "TSC_STABLE" bit is only
+         *        translated as a "monotonic" bit which even in Async systems we
+         *        -should- be reporting a strictly monotonic TSC to the guest.  */
+        PGIMKVM pKvm = &pVM->gim.s.u.Kvm;
+        pKvm->uBaseFeat |= GIM_KVM_BASE_FEAT_TSC_STABLE;
+
+        CPUMCPUIDLEAF HyperLeaf;
+        RT_ZERO(HyperLeaf);
+        HyperLeaf.uLeaf        = UINT32_C(0x40000001);
+        HyperLeaf.uEax         = pKvm->uBaseFeat;
+        HyperLeaf.uEbx         = 0;
+        HyperLeaf.uEcx         = 0;
+        HyperLeaf.uEdx         = 0;
+        int rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+        AssertLogRelRCReturn(rc, rc);
+    }
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Terminates the KVM GIM provider.
+ *
+ * @returns VBox status code.
+ * @param   pVM         Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) gimR3KvmTerm(PVM pVM)
+{
+    gimR3KvmReset(pVM);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Applies relocations to data and code managed by this component.
+ *
+ * This function will be called at init and whenever the VMM need to relocate
+ * itself inside the GC.
+ *
+ * @param   pVM         Pointer to the VM.
+ * @param   offDelta    Relocation delta relative to old location.
+ */
+VMMR3_INT_DECL(void) gimR3KvmRelocate(PVM pVM, RTGCINTPTR offDelta)
+{
+    NOREF(pVM); NOREF(offDelta);
+}
+
+
+/**
+ * This resets KVM provider MSRs and unmaps whatever KVM regions that
+ * the guest may have mapped.
+ *
+ * This is called when the VM is being reset.
+ *
+ * @param   pVM     Pointer to the VM.
+ * @thread EMT(0).
+ */
+VMMR3_INT_DECL(void) gimR3KvmReset(PVM pVM)
+{
+    VM_ASSERT_EMT0(pVM);
+    LogRel(("GIM: KVM: Resetting MSRs\n"));
+
+    /*
+     * Reset MSRs.
+     */
+    PGIMKVM pKvm = &pVM->gim.s.u.Kvm;
+    pKvm->u64WallClockMsr = 0;
+    for (VMCPUID iCpu = 0; iCpu < pVM->cCpus; iCpu++)
+    {
+        PGIMKVMCPU pKvmCpu = &pVM->aCpus[iCpu].gim.s.u.KvmCpu;
+        pKvmCpu->u64SystemTimeMsr = 0;
+    }
+}
+
+
+/**
+ * KVM state-save operation.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ * @param   pSSM    Pointer to the SSM handle.
+ */
+VMMR3_INT_DECL(int) gimR3KvmSave(PVM pVM, PSSMHANDLE pSSM)
+{
+    PCGIMKVM pcKvm = &pVM->gim.s.u.Kvm;
+
+    /*
+     * Save the KVM SSM version.
+     */
+    SSMR3PutU32(pSSM, GIM_KVM_SAVED_STATE_VERSION);
+
+    /*
+     * Save per-VCPU data.
+     */
+    for (uint32_t i = 0; i < pVM->cCpus; i++)
+    {
+        PCGIMKVMCPU pcKvmCpu = &pVM->aCpus[i].gim.s.u.KvmCpu;
+
+        /* Guest may alter flags (namely GIM_KVM_SYSTEM_TIME_FLAGS_GUEST_PAUSED bit). So re-read them from guest-memory. */
+        GIMKVMSYSTEMTIME SystemTime;
+        RT_ZERO(SystemTime);
+        if (MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(pcKvmCpu->u64SystemTimeMsr))
+        {
+            int rc = PGMPhysSimpleReadGCPhys(pVM, &SystemTime, pcKvmCpu->GCPhysSystemTime, sizeof(GIMKVMSYSTEMTIME));
+            AssertRCReturn(rc, rc);
+        }
+
+        SSMR3PutU64(pSSM, pcKvmCpu->u64SystemTimeMsr);
+        SSMR3PutU64(pSSM, pcKvmCpu->uTsc);
+        SSMR3PutU64(pSSM, pcKvmCpu->uVirtNanoTS);
+        SSMR3PutGCPhys(pSSM, pcKvmCpu->GCPhysSystemTime);
+        SSMR3PutU32(pSSM, pcKvmCpu->u32SystemTimeVersion);
+        SSMR3PutU8(pSSM, SystemTime.fFlags);
+    }
+
+    /*
+     * Save per-VM data.
+     */
+    SSMR3PutU64(pSSM, pcKvm->u64WallClockMsr);
+    return SSMR3PutU32(pSSM, pcKvm->uBaseFeat);
+}
+
+
+/**
+ * KVM state-load operation, final pass.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pSSM            Pointer to the SSM handle.
+ * @param   uSSMVersion     The GIM saved-state version.
+ */
+VMMR3_INT_DECL(int) gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion)
+{
+    /*
+     * Load the KVM SSM version first.
+     */
+    uint32_t uKvmSavedStatVersion;
+    int rc = SSMR3GetU32(pSSM, &uKvmSavedStatVersion);
+    AssertRCReturn(rc, rc);
+    if (uKvmSavedStatVersion != GIM_KVM_SAVED_STATE_VERSION)
+        return SSMR3SetLoadError(pSSM, VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION, RT_SRC_POS,
+                                 N_("Unsupported KVM saved-state version %u (expected %u)."), uKvmSavedStatVersion,
+                                 GIM_KVM_SAVED_STATE_VERSION);
+
+    /*
+     * Load per-VCPU data.
+     */
+    for (uint32_t i = 0; i < pVM->cCpus; i++)
+    {
+        PVMCPU     pVCpu   = &pVM->aCpus[i];
+        PGIMKVMCPU pKvmCpu = &pVCpu->gim.s.u.KvmCpu;
+
+        uint8_t fSystemTimeFlags = 0;
+        SSMR3GetU64(pSSM, &pKvmCpu->u64SystemTimeMsr);
+        SSMR3GetU64(pSSM, &pKvmCpu->uTsc);
+        SSMR3GetU64(pSSM, &pKvmCpu->uVirtNanoTS);
+        SSMR3GetGCPhys(pSSM, &pKvmCpu->GCPhysSystemTime);
+        SSMR3GetU32(pSSM, &pKvmCpu->u32SystemTimeVersion);
+        SSMR3GetU8(pSSM, &fSystemTimeFlags);
+
+        /* Enable the system-time struct. if necessary. */
+        if (MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(pKvmCpu->u64SystemTimeMsr))
+        {
+            Assert(!TMVirtualIsTicking(pVM));       /* paranoia. */
+            Assert(!TMCpuTickIsTicking(pVCpu));
+            rc = gimR3KvmEnableSystemTime(pVM, pVCpu, pKvmCpu, fSystemTimeFlags);
+            AssertRCReturn(rc, rc);
+        }
+    }
+
+    /*
+     * Load per-VM data.
+     */
+    PGIMKVM pKvm = &pVM->gim.s.u.Kvm;
+    SSMR3GetU64(pSSM, &pKvm->u64WallClockMsr);
+    rc = SSMR3GetU32(pSSM, &pKvm->uBaseFeat);
+    AssertRCReturn(rc, rc);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Enables the KVM VCPU system-time structure.
+ *
+ * @returns VBox status code.
+ * @param   pVM                Pointer to the VM.
+ * @param   pVCpu              Pointer to the VMCPU.
+ * @param   pKvmCpu            Pointer to the GIMKVMCPU with all fields
+ *                             populated by the caller.
+ * @param   fFlags             The system-time struct. flags.
+ *
+ * @remarks Don't do any release assertions here, these can be triggered by
+ *          guest R0 code.
+ */
+VMMR3_INT_DECL(int) gimR3KvmEnableSystemTime(PVM pVM, PVMCPU pVCpu, PGIMKVMCPU pKvmCpu, uint8_t fFlags)
+{
+    GIMKVMSYSTEMTIME SystemTime;
+    RT_ZERO(SystemTime);
+    SystemTime.u32Version  = pKvmCpu->u32SystemTimeVersion;
+    SystemTime.u64NanoTS   = pKvmCpu->uVirtNanoTS;
+    SystemTime.u64Tsc      = pKvmCpu->uTsc;
+    SystemTime.fFlags      = fFlags | GIM_KVM_SYSTEM_TIME_FLAGS_TSC_STABLE;
+
+    /*
+     * How the guest calculates the system time (nanoseconds):
+     *
+     * tsc = rdtsc - SysTime.u64Tsc
+     * if (SysTime.i8TscShift >= 0)
+     *     tsc <<= i8TscShift;
+     * else
+     *     tsc >>= -i8TscShift;
+     * time = ((tsc * SysTime.u32TscScale) >> 32) + SysTime.u64NanoTS
+     */
+    uint64_t u64TscFreq   = TMCpuTicksPerSecond(pVM);
+    SystemTime.i8TscShift = 0;
+    while (u64TscFreq > 2 * RT_NS_1SEC_64)
+    {
+        u64TscFreq >>= 1;
+        SystemTime.i8TscShift--;
+    }
+    uint32_t uTscFreqLo = (uint32_t)u64TscFreq;
+    while (uTscFreqLo <= RT_NS_1SEC)
+    {
+        uTscFreqLo <<= 1;
+        SystemTime.i8TscShift++;
+    }
+    SystemTime.u32TscScale = ASMDivU64ByU32RetU32(RT_NS_1SEC_64 << 32, uTscFreqLo);
+
+    Assert(!(SystemTime.u32Version & UINT32_C(1)));
+    Assert(PGMPhysIsGCPhysNormal(pVM, pKvmCpu->GCPhysSystemTime));
+    int rc = PGMPhysSimpleWriteGCPhys(pVM, pKvmCpu->GCPhysSystemTime, &SystemTime, sizeof(GIMKVMSYSTEMTIME));
+    if (RT_SUCCESS(rc))
+    {
+        LogRel(("GIM: KVM: VCPU%3d: Enabled system-time struct. at %#RGp - u32TscScale=%#RX32 i8TscShift=%d uVersion=%#RU32 "
+                "fFlags=%#x uTsc=%#RX64 uVirtNanoTS=%#RX64\n", pVCpu->idCpu, pKvmCpu->GCPhysSystemTime, SystemTime.u32TscScale,
+                SystemTime.i8TscShift, SystemTime.u32Version, SystemTime.fFlags, pKvmCpu->uTsc, pKvmCpu->uVirtNanoTS));
+        TMR3CpuTickParavirtEnable(pVM);
+    }
+    else
+        LogRel(("GIM: KVM: VCPU%3d: Failed to write system-time struct. at %#RGp. rc=%Rrc\n", pKvmCpu->GCPhysSystemTime, rc));
+
+    return rc;
+}
+
+
+/**
+ * Disables the KVM system-time struct.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) gimR3KvmDisableSystemTime(PVM pVM)
+{
+    TMR3CpuTickParavirtDisable(pVM);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * @callback_method_impl{PFNVMMEMTRENDEZVOUS,
+ *      Worker for gimR3KvmEnableWallClock}
+ */
+static DECLCALLBACK(VBOXSTRICTRC) gimR3KvmEnableWallClockCallback(PVM pVM, PVMCPU pVCpu, void *pvData)
+{
+    Assert(pvData);
+    PKVMWALLCLOCKINFO pWallClockInfo  = (PKVMWALLCLOCKINFO)pvData;
+    RTGCPHYS          GCPhysWallClock = pWallClockInfo->GCPhysWallClock;
+
+    /*
+     * Read the wall-clock version (sequence) from the guest.
+     */
+    uint32_t uVersion;
+    Assert(PGMPhysIsGCPhysNormal(pVM, GCPhysWallClock));
+    int rc = PGMPhysSimpleReadGCPhys(pVM, &uVersion, GCPhysWallClock, sizeof(uVersion));
+    if (RT_FAILURE(rc))
+    {
+        LogRel(("GIM: KVM: Failed to read wall-clock struct. version at %#RGp. rc=%Rrc\n", GCPhysWallClock, rc));
+        return rc;
+    }
+
+    /*
+     * Ensure the version is incrementally even.
+     */
+    if (!(uVersion & 1))
+        ++uVersion;
+    ++uVersion;
+
+    /*
+     * Update wall-clock guest struct. with UTC information.
+     */
+    RTTIMESPEC TimeSpec;
+    int32_t    iSec;
+    int32_t    iNano;
+    TMR3UtcNow(pVM, &TimeSpec);
+    RTTimeSpecGetSecondsAndNano(&TimeSpec, &iSec, &iNano);
+
+    GIMKVMWALLCLOCK WallClock;
+    RT_ZERO(WallClock);
+    AssertCompile(sizeof(uVersion) == sizeof(WallClock.u32Version));
+    WallClock.u32Version = uVersion;
+    WallClock.u32Sec     = iSec;
+    WallClock.u32Nano    = iNano;
+
+    /*
+     * Write out the wall-clock struct. to guest memory.
+     */
+    Assert(!(WallClock.u32Version & 1));
+    rc = PGMPhysSimpleWriteGCPhys(pVM, GCPhysWallClock, &WallClock, sizeof(GIMKVMWALLCLOCK));
+    if (RT_SUCCESS(rc))
+    {
+        LogRel(("GIM: KVM: Enabled wall-clock struct. at %#RGp - u32Sec=%u u32Nano=%u uVersion=%#RU32\n", GCPhysWallClock,
+                WallClock.u32Sec, WallClock.u32Nano, WallClock.u32Version));
+    }
+    else
+        LogRel(("GIM: KVM: Failed to write wall-clock struct. at %#RGp. rc=%Rrc\n", GCPhysWallClock, rc));
+    return rc;
+}
+
+
+/**
+ * Enables the KVM wall-clock structure.
+ *
+ * Since the wall-clock can be read by any VCPU but it is a global struct. in
+ * guest-memory, we do an EMT rendezvous here to be on the safe side. The
+ * alternative is to use an MMIO2 region and use the WallClock.u32Version field
+ * for transactional update. However, this MSR is rarely written to (typically
+ * once during bootup) it's currently not a performance issue especially since
+ * we're already in ring-3. If we really wanted better performance in this code
+ * path, we should be doing it in ring-0 with transactional update while make
+ * sure there is only 1 writer as well.
+ *
+ * @returns VBox status code.
+ * @param   pVM                Pointer to the VM.
+ * @param   GCPhysWallClock    Where the guest wall-clock structure is located.
+ * @param   uVersion           The version (sequence number) value to use.
+ *
+ * @remarks Don't do any release assertions here, these can be triggered by
+ *          guest R0 code.
+ */
+VMMR3_INT_DECL(int) gimR3KvmEnableWallClock(PVM pVM, RTGCPHYS GCPhysWallClock)
+{
+    KVMWALLCLOCKINFO WallClockInfo;
+    WallClockInfo.GCPhysWallClock = GCPhysWallClock;
+    return VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE, gimR3KvmEnableWallClockCallback, &WallClockInfo);
+}
+
diff --git a/src/VBox/VMM/VMMR3/GIMMinimal.cpp b/src/VBox/VMM/VMMR3/GIMMinimal.cpp
new file mode 100644
index 0000000..8ef3ae3
--- /dev/null
+++ b/src/VBox/VMM/VMMR3/GIMMinimal.cpp
@@ -0,0 +1,137 @@
+/* $Id: GIMMinimal.cpp $ */
+/** @file
+ * GIM - Guest Interface Manager, Minimal implementation.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP LOG_GROUP_GIM
+#include "GIMInternal.h"
+
+#include <iprt/assert.h>
+#include <iprt/err.h>
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/string.h>
+
+#include <VBox/vmm/cpum.h>
+#include <VBox/vmm/vm.h>
+#include <VBox/vmm/tm.h>
+#include <VBox/vmm/pdmapi.h>
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+
+/**
+ * Initializes the Minimal provider.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) gimR3MinimalInit(PVM pVM)
+{
+    AssertReturn(pVM, VERR_INVALID_PARAMETER);
+    AssertReturn(pVM->gim.s.enmProviderId == GIMPROVIDERID_MINIMAL, VERR_INTERNAL_ERROR_5);
+
+    /*
+     * Enable the Hypervisor Present.
+     */
+    CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_HVP);
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Initializes remaining bits of the Minimal provider.
+ * This is called after initializing HM and almost all other VMM components.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) gimR3MinimalInitCompleted(PVM pVM)
+{
+    /*
+     * Expose a generic hypervisor-agnostic leaf (originally defined VMware).
+     * The leaves range from  0x40000010 to 0x400000FF.
+     *
+     * This is done in the init. completed routine as we need PDM to be
+     * initialized (otherwise PDMApicGetTimerFreq() would fail).
+     */
+    CPUMCPUIDLEAF HyperLeaf;
+    int rc = CPUMR3CpuIdGetLeaf(pVM, &HyperLeaf, 0x40000000, 0 /* uSubLeaf */);
+    if (RT_SUCCESS(rc))
+    {
+        HyperLeaf.uEax         = UINT32_C(0x40000010);  /* Maximum leaf we implement. */
+        rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+        AssertLogRelRCReturn(rc, rc);
+
+        /*
+         * Insert missing zero leaves (you never know what missing leaves are
+         * going to return when read).
+         */
+        for (uint32_t uLeaf = UINT32_C(0x40000001); uLeaf < UINT32_C(0x40000010); uLeaf++)
+        {
+            rc = CPUMR3CpuIdGetLeaf(pVM, &HyperLeaf, uLeaf, 0 /* uSubLeaf */);
+            if (RT_FAILURE(rc))
+            {
+                RT_ZERO(HyperLeaf);
+                HyperLeaf.uLeaf = uLeaf;
+                rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+                AssertLogRelRCReturn(rc, rc);
+            }
+        }
+
+        /*
+         * Add the timing information hypervisor leaf.
+         * MacOS X uses this to determine the TSC, bus frequency. See @bugref{7270}.
+         *
+         * EAX - TSC frequency in KHz.
+         * EBX - APIC frequency in KHz.
+         * ECX, EDX - Reserved.
+         */
+        uint64_t uApicFreq;
+        rc = PDMApicGetTimerFreq(pVM, &uApicFreq);
+        AssertLogRelRCReturn(rc, rc);
+
+        RT_ZERO(HyperLeaf);
+        HyperLeaf.uLeaf        = UINT32_C(0x40000010);
+        HyperLeaf.uEax         = TMCpuTicksPerSecond(pVM) / UINT64_C(1000);
+        HyperLeaf.uEbx         = (uApicFreq + 500) / UINT64_C(1000);
+        rc = CPUMR3CpuIdInsert(pVM, &HyperLeaf);
+        AssertLogRelRCReturn(rc, rc);
+    }
+    else
+        LogRel(("GIM: Minimal: failed to get hypervisor leaf 0x40000000.\n"));
+
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Applies relocations to data and code managed by this component.
+ *
+ * This function will be called at init and whenever the VMM need to relocate
+ * itself inside the GC.
+ *
+ * @param   pVM         Pointer to the VM.
+ * @param   offDelta    Relocation delta relative to old location.
+ */
+VMMR3_INT_DECL(void) gimR3MinimalRelocate(PVM pVM, RTGCINTPTR offDelta)
+{
+    NOREF(pVM); NOREF(offDelta);
+}
+
diff --git a/src/VBox/VMM/VMMR3/HM.cpp b/src/VBox/VMM/VMMR3/HM.cpp
index 2e32634..462ec8c 100644
--- a/src/VBox/VMM/VMMR3/HM.cpp
+++ b/src/VBox/VMM/VMMR3/HM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -47,7 +47,6 @@
 #include <VBox/log.h>
 #include <iprt/asm.h>
 #include <iprt/asm-amd64-x86.h>
-#include <iprt/string.h>
 #include <iprt/env.h>
 #include <iprt/thread.h>
 
@@ -69,58 +68,63 @@ static const char * const g_apszVTxExitReasons[MAX_EXITREASON_STAT] =
     EXIT_REASON(VMX_EXIT_IO_SMI_IRQ         ,  5, "I/O system-management interrupt (SMI)."),
     EXIT_REASON(VMX_EXIT_SMI_IRQ            ,  6, "Other SMI."),
     EXIT_REASON(VMX_EXIT_INT_WINDOW         ,  7, "Interrupt window."),
-    EXIT_REASON_NIL(),
+    EXIT_REASON(VMX_EXIT_NMI_WINDOW         ,  8, "NMI window."),
     EXIT_REASON(VMX_EXIT_TASK_SWITCH        ,  9, "Task switch."),
-    EXIT_REASON(VMX_EXIT_CPUID              , 10, "Guest attempted to execute CPUID."),
+    EXIT_REASON(VMX_EXIT_CPUID              , 10, "CPUID instruction."),
     EXIT_REASON_NIL(),
-    EXIT_REASON(VMX_EXIT_HLT                , 12, "Guest attempted to execute HLT."),
-    EXIT_REASON(VMX_EXIT_INVD               , 13, "Guest attempted to execute INVD."),
-    EXIT_REASON(VMX_EXIT_INVLPG             , 14, "Guest attempted to execute INVLPG."),
-    EXIT_REASON(VMX_EXIT_RDPMC              , 15, "Guest attempted to execute RDPMC."),
-    EXIT_REASON(VMX_EXIT_RDTSC              , 16, "Guest attempted to execute RDTSC."),
-    EXIT_REASON(VMX_EXIT_RSM                , 17, "Guest attempted to execute RSM in SMM."),
-    EXIT_REASON(VMX_EXIT_VMCALL             , 18, "Guest attempted to execute VMCALL."),
-    EXIT_REASON(VMX_EXIT_VMCLEAR            , 19, "Guest attempted to execute VMCLEAR."),
-    EXIT_REASON(VMX_EXIT_VMLAUNCH           , 20, "Guest attempted to execute VMLAUNCH."),
-    EXIT_REASON(VMX_EXIT_VMPTRLD            , 21, "Guest attempted to execute VMPTRLD."),
-    EXIT_REASON(VMX_EXIT_VMPTRST            , 22, "Guest attempted to execute VMPTRST."),
-    EXIT_REASON(VMX_EXIT_VMREAD             , 23, "Guest attempted to execute VMREAD."),
-    EXIT_REASON(VMX_EXIT_VMRESUME           , 24, "Guest attempted to execute VMRESUME."),
-    EXIT_REASON(VMX_EXIT_VMWRITE            , 25, "Guest attempted to execute VMWRITE."),
-    EXIT_REASON(VMX_EXIT_VMXOFF             , 26, "Guest attempted to execute VMXOFF."),
-    EXIT_REASON(VMX_EXIT_VMXON              , 27, "Guest attempted to execute VMXON."),
+    EXIT_REASON(VMX_EXIT_HLT                , 12, "HLT instruction."),
+    EXIT_REASON(VMX_EXIT_INVD               , 13, "INVD instruction."),
+    EXIT_REASON(VMX_EXIT_INVLPG             , 14, "INVLPG instruction."),
+    EXIT_REASON(VMX_EXIT_RDPMC              , 15, "RDPMCinstruction."),
+    EXIT_REASON(VMX_EXIT_RDTSC              , 16, "RDTSC instruction."),
+    EXIT_REASON(VMX_EXIT_RSM                , 17, "RSM instruction in SMM."),
+    EXIT_REASON(VMX_EXIT_VMCALL             , 18, "VMCALL instruction."),
+    EXIT_REASON(VMX_EXIT_VMCLEAR            , 19, "VMCLEAR instruction."),
+    EXIT_REASON(VMX_EXIT_VMLAUNCH           , 20, "VMLAUNCH instruction."),
+    EXIT_REASON(VMX_EXIT_VMPTRLD            , 21, "VMPTRLD instruction."),
+    EXIT_REASON(VMX_EXIT_VMPTRST            , 22, "VMPTRST instruction."),
+    EXIT_REASON(VMX_EXIT_VMREAD             , 23, "VMREAD instruction."),
+    EXIT_REASON(VMX_EXIT_VMRESUME           , 24, "VMRESUME instruction."),
+    EXIT_REASON(VMX_EXIT_VMWRITE            , 25, "VMWRITE instruction."),
+    EXIT_REASON(VMX_EXIT_VMXOFF             , 26, "VMXOFF instruction."),
+    EXIT_REASON(VMX_EXIT_VMXON              , 27, "VMXON instruction."),
     EXIT_REASON(VMX_EXIT_MOV_CRX            , 28, "Control-register accesses."),
     EXIT_REASON(VMX_EXIT_MOV_DRX            , 29, "Debug-register accesses."),
     EXIT_REASON(VMX_EXIT_PORT_IO            , 30, "I/O instruction."),
-    EXIT_REASON(VMX_EXIT_RDMSR              , 31, "Guest attempted to execute RDMSR."),
-    EXIT_REASON(VMX_EXIT_WRMSR              , 32, "Guest attempted to execute WRMSR."),
+    EXIT_REASON(VMX_EXIT_RDMSR              , 31, "RDMSR instruction."),
+    EXIT_REASON(VMX_EXIT_WRMSR              , 32, "WRMSR instruction."),
     EXIT_REASON(VMX_EXIT_ERR_INVALID_GUEST_STATE,  33, "VM-entry failure due to invalid guest state."),
     EXIT_REASON(VMX_EXIT_ERR_MSR_LOAD       , 34, "VM-entry failure due to MSR loading."),
     EXIT_REASON_NIL(),
-    EXIT_REASON(VMX_EXIT_MWAIT              , 36, "Guest executed MWAIT."),
+    EXIT_REASON(VMX_EXIT_MWAIT              , 36, "MWAIT instruction."),
     EXIT_REASON(VMX_EXIT_MTF                , 37, "Monitor Trap Flag."),
     EXIT_REASON_NIL(),
-    EXIT_REASON(VMX_EXIT_MONITOR            , 39, "Guest attempted to execute MONITOR."),
-    EXIT_REASON(VMX_EXIT_PAUSE              , 40, "Guest attempted to execute PAUSE."),
+    EXIT_REASON(VMX_EXIT_MONITOR            , 39, "MONITOR instruction."),
+    EXIT_REASON(VMX_EXIT_PAUSE              , 40, "PAUSE instruction."),
     EXIT_REASON(VMX_EXIT_ERR_MACHINE_CHECK  , 41, "VM-entry failure due to machine-check."),
     EXIT_REASON_NIL(),
-    EXIT_REASON(VMX_EXIT_TPR_BELOW_THRESHOLD, 43, "TPR below threshold. Guest attempted to execute MOV to CR8."),
-    EXIT_REASON(VMX_EXIT_APIC_ACCESS        , 44, "APIC access. Guest attempted to access memory at a physical address on the APIC-access page."),
+    EXIT_REASON(VMX_EXIT_TPR_BELOW_THRESHOLD, 43, "TPR below threshold (MOV to CR8)."),
+    EXIT_REASON(VMX_EXIT_APIC_ACCESS        , 44, "APIC access."),
     EXIT_REASON_NIL(),
-    EXIT_REASON(VMX_EXIT_XDTR_ACCESS        , 46, "Access to GDTR or IDTR. Guest attempted to execute LGDT, LIDT, SGDT, or SIDT."),
-    EXIT_REASON(VMX_EXIT_TR_ACCESS          , 47, "Access to LDTR or TR. Guest attempted to execute LLDT, LTR, SLDT, or STR."),
-    EXIT_REASON(VMX_EXIT_EPT_VIOLATION      , 48, "EPT violation. An attempt to access memory with a guest-physical address was disallowed by the configuration of the EPT paging structures."),
-    EXIT_REASON(VMX_EXIT_EPT_MISCONFIG      , 49, "EPT misconfiguration. An attempt to access memory with a guest-physical address encountered a misconfigured EPT paging-structure entry."),
-    EXIT_REASON(VMX_EXIT_INVEPT             , 50, "Guest attempted to execute INVEPT."),
-    EXIT_REASON(VMX_EXIT_RDTSCP             , 51, "Guest attempted to execute RDTSCP."),
+    EXIT_REASON(VMX_EXIT_XDTR_ACCESS        , 46, "Access to GDTR or IDTR using LGDT, LIDT, SGDT, or SIDT."),
+    EXIT_REASON(VMX_EXIT_TR_ACCESS          , 47, "Access to LDTR or TR using LLDT, LTR, SLDT, or STR."),
+    EXIT_REASON(VMX_EXIT_EPT_VIOLATION      , 48, "EPT violation."),
+    EXIT_REASON(VMX_EXIT_EPT_MISCONFIG      , 49, "EPT misconfiguration."),
+    EXIT_REASON(VMX_EXIT_INVEPT             , 50, "INVEPT instruction."),
+    EXIT_REASON(VMX_EXIT_RDTSCP             , 51, "RDTSCP instruction."),
     EXIT_REASON(VMX_EXIT_PREEMPT_TIMER      , 52, "VMX-preemption timer expired."),
-    EXIT_REASON(VMX_EXIT_INVVPID            , 53, "Guest attempted to execute INVVPID."),
-    EXIT_REASON(VMX_EXIT_WBINVD             , 54, "Guest attempted to execute WBINVD."),
-    EXIT_REASON(VMX_EXIT_XSETBV             , 55, "Guest attempted to execute XSETBV."),
+    EXIT_REASON(VMX_EXIT_INVVPID            , 53, "INVVPID instruction."),
+    EXIT_REASON(VMX_EXIT_WBINVD             , 54, "WBINVD instruction."),
+    EXIT_REASON(VMX_EXIT_XSETBV             , 55, "XSETBV instruction."),
+    EXIT_REASON_NIL(),
+    EXIT_REASON(VMX_EXIT_RDRAND             , 57, "RDRAND instruction."),
+    EXIT_REASON(VMX_EXIT_INVPCID            , 58, "INVPCID instruction."),
+    EXIT_REASON(VMX_EXIT_VMFUNC             , 59, "VMFUNC instruction."),
+    EXIT_REASON_NIL(),
+    EXIT_REASON(VMX_EXIT_RDSEED             , 61, "RDSEED instruction."),
     EXIT_REASON_NIL(),
-    EXIT_REASON(VMX_EXIT_RDRAND             , 57, "Guest attempted to execute RDRAND."),
-    EXIT_REASON(VMX_EXIT_INVPCID            , 58, "Guest attempted to execute INVPCID."),
-    EXIT_REASON(VMX_EXIT_VMFUNC             , 59, "Guest attempted to execute VMFUNC.")
+    EXIT_REASON(VMX_EXIT_XSAVES             , 61, "XSAVES instruction."),
+    EXIT_REASON(VMX_EXIT_XRSTORS            , 62, "XRSTORS instruction.")
 };
 /** Exit reason descriptions for AMD-V, used to describe statistics. */
 static const char * const g_apszAmdVExitReasons[MAX_EXITREASON_STAT] =
@@ -341,7 +345,7 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
     /*
      * Register the saved state data unit.
      */
-    int rc = SSMR3RegisterInternal(pVM, "HWACCM", 0, HM_SSM_VERSION, sizeof(HM),
+    int rc = SSMR3RegisterInternal(pVM, "HWACCM", 0, HM_SAVED_STATE_VERSION, sizeof(HM),
                                    NULL, NULL, NULL,
                                    NULL, hmR3Save, NULL,
                                    NULL, hmR3Load, NULL);
@@ -349,17 +353,6 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
         return rc;
 
     /*
-     * Misc initialisation.
-     */
-#if 0
-    pVM->hm.s.vmx.fSupported = false;
-    pVM->hm.s.svm.fSupported = false;
-    pVM->hm.s.vmx.fEnabled   = false;
-    pVM->hm.s.svm.fEnabled   = false;
-    pVM->hm.s.fNestedPaging  = false;
-#endif
-
-    /*
      * Read configuration.
      */
     PCFGMNODE pCfgHM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "HM/");
@@ -409,7 +402,7 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
 
     /** @cfgm{/HM/TPRPatchingEnabled, bool, false}
      * Enables TPR patching for 32-bit windows guests with IO-APIC. */
-    rc = CFGMR3QueryBoolDef(pCfgHM, "TPRPatchingEnabled", &pVM->hm.s.fTRPPatchingAllowed, false);
+    rc = CFGMR3QueryBoolDef(pCfgHM, "TPRPatchingEnabled", &pVM->hm.s.fTprPatchingAllowed, false);
     AssertRCReturn(rc, rc);
 
     /** @cfgm{/HM/64bitEnabled, bool, 32-bit:false, 64-bit:true}
@@ -447,6 +440,12 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
     rc = CFGMR3QueryU32Def(pCfgHM, "MaxResumeLoops", &pVM->hm.s.cMaxResumeLoops, 0 /* set by R0 later */);
     AssertLogRelRCReturn(rc, rc);
 
+    /** @cfgm{/HM/UseVmxPreemptTimer, bool}
+     * Whether to make use of the VMX-preemption timer feature of the CPU if it's
+     * available. */
+    rc = CFGMR3QueryBoolDef(pCfgHM, "UseVmxPreemptTimer", &pVM->hm.s.vmx.fUsePreemptTimer, true);
+    AssertLogRelRCReturn(rc, rc);
+
     /*
      * Check if VT-x or AMD-v support according to the users wishes.
      */
@@ -459,12 +458,20 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
         if (RT_SUCCESS(rc))
         {
             if (fCaps & SUPVTCAPS_AMD_V)
-                LogRel(("HMR3Init: AMD-V%s\n", fCaps & SUPVTCAPS_NESTED_PAGING ? " w/ nested paging" : ""));
+            {
+                LogRel(("HM: HMR3Init: AMD-V%s\n", fCaps & SUPVTCAPS_NESTED_PAGING ? " w/ nested paging" : ""));
+                pVM->hm.s.svm.fSupported = true;
+            }
             else if (fCaps & SUPVTCAPS_VT_X)
             {
                 rc = SUPR3QueryVTxSupported();
                 if (RT_SUCCESS(rc))
-                    LogRel(("HMR3Init: VT-x%s\n", fCaps & SUPVTCAPS_NESTED_PAGING ? " w/ nested paging" : ""));
+                {
+                    LogRel(("HM: HMR3Init: VT-x%s%s\n",
+                            fCaps & SUPVTCAPS_NESTED_PAGING ? " w/ nested paging" : "",
+                            fCaps & SUPVTCAPS_VTX_UNRESTRICTED_GUEST ? " and unrestricted guest execution" : ""));
+                    pVM->hm.s.vmx.fSupported = true;
+                }
                 else
                 {
 #ifdef RT_OS_LINUX
@@ -476,7 +483,7 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
                         return VMSetError(pVM, rc, RT_SRC_POS, "The host kernel does not support VT-x.%s\n", pszMinReq);
 
                     /* Fall back to raw-mode. */
-                    LogRel(("HMR3Init: Falling back to raw-mode: The host kernel does not support VT-x.%s\n", pszMinReq));
+                    LogRel(("HM: HMR3Init: Falling back to raw-mode: The host kernel does not support VT-x.%s\n", pszMinReq));
                     pVM->fHMEnabled = false;
                 }
             }
@@ -490,6 +497,32 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
             pVM->fHMNeedRawModeCtx = HC_ARCH_BITS == 32
                                   && pVM->fHMEnabled
                                   && pVM->hm.s.fAllow64BitGuests;
+
+            /*
+             * Disable nested paging and unrestricted guest execution now if they're
+             * configured so that CPUM can make decisions based on our configuration.
+             */
+            Assert(!pVM->hm.s.fNestedPaging);
+            if (pVM->hm.s.fAllowNestedPaging)
+            {
+                if (fCaps & SUPVTCAPS_NESTED_PAGING)
+                    pVM->hm.s.fNestedPaging = true;
+                else
+                    pVM->hm.s.fAllowNestedPaging = false;
+            }
+
+            if (fCaps & SUPVTCAPS_VT_X)
+            {
+                Assert(!pVM->hm.s.vmx.fUnrestrictedGuest);
+                if (pVM->hm.s.vmx.fAllowUnrestricted)
+                {
+                    if (   (fCaps & SUPVTCAPS_VTX_UNRESTRICTED_GUEST)
+                        && pVM->hm.s.fNestedPaging)
+                        pVM->hm.s.vmx.fUnrestrictedGuest = true;
+                    else
+                        pVM->hm.s.vmx.fAllowUnrestricted = false;
+                }
+            }
         }
         else
         {
@@ -508,8 +541,8 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
                     pszMsg = "VT-x is disabled in the BIOS.";
                     break;
 
-                case VERR_VMX_MSR_SMX_VMXON_DISABLED:
-                    pszMsg = "VT-x is disabled in the BIOS for Safer-Mode/Trusted Extensions.";
+                case VERR_VMX_MSR_ALL_VMXON_DISABLED:
+                    pszMsg = "VT-x is disabled in the BIOS for all CPU modes.";
                     break;
 
                 case VERR_VMX_MSR_LOCKING_FAILED:
@@ -534,7 +567,7 @@ VMMR3_INT_DECL(int) HMR3Init(PVM pVM)
                 return VMSetError(pVM, rc, RT_SRC_POS, "SUPR3QueryVTCaps failed with %Rrc", rc);
 
             /* Fall back to raw-mode. */
-            LogRel(("HMR3Init: Falling back to raw-mode: %s\n", pszMsg));
+            LogRel(("HM: HMR3Init: Falling back to raw-mode: %s\n", pszMsg));
             pVM->fHMEnabled = false;
         }
     }
@@ -656,7 +689,7 @@ static int hmR3InitCPU(PVM pVM)
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestUD,            "/HM/CPU%d/Exit/Trap/Gst/#UD", "Guest #UD (undefined opcode) exception.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestSS,            "/HM/CPU%d/Exit/Trap/Gst/#SS", "Guest #SS (stack-segment fault) exception.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestNP,            "/HM/CPU%d/Exit/Trap/Gst/#NP", "Guest #NP (segment not present) exception.");
-        HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestGP,            "/HM/CPU%d/Exit/Trap/Gst/#GP", "Guest #GP (general protection) execption.");
+        HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestGP,            "/HM/CPU%d/Exit/Trap/Gst/#GP", "Guest #GP (general protection) exception.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestMF,            "/HM/CPU%d/Exit/Trap/Gst/#MF", "Guest #MF (x87 FPU error, math fault) exception.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestDE,            "/HM/CPU%d/Exit/Trap/Gst/#DE", "Guest #DE (divide error) exception.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitGuestDB,            "/HM/CPU%d/Exit/Trap/Gst/#DB", "Guest #DB (debug) exception.");
@@ -693,7 +726,6 @@ static int hmR3InitCPU(PVM pVM)
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitIOStringWrite,      "/HM/CPU%d/Exit/IO/WriteString", "String I/O write.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitIOStringRead,       "/HM/CPU%d/Exit/IO/ReadString", "String I/O read.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitIntWindow,          "/HM/CPU%d/Exit/IntWindow", "Interrupt-window exit. Guest is ready to receive interrupts again.");
-        HM_REG_COUNTER(&pVCpu->hm.s.StatExitMaxResume,          "/HM/CPU%d/Exit/MaxResume", "Maximum VMRESUME inner-loop counter reached.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitExtInt,             "/HM/CPU%d/Exit/ExtInt", "Host interrupt received.");
 #endif
         HM_REG_COUNTER(&pVCpu->hm.s.StatExitHostNmiInGC,        "/HM/CPU%d/Exit/HostNmiInGC", "Host NMI received while in guest context.");
@@ -709,6 +741,9 @@ static int hmR3InitCPU(PVM pVM)
         HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchHmToR3FF,         "/HM/CPU%d/Switch/HmToR3FF", "Exit to ring-3 due to pending timers, EMT rendezvous, critical section etc.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchExitToR3,         "/HM/CPU%d/Switch/ExitToR3", "Exit to ring-3 (total).");
         HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchLongJmpToR3,      "/HM/CPU%d/Switch/LongJmpToR3", "Longjump to ring-3.");
+        HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchMaxResumeLoops,   "/HM/CPU%d/Switch/MaxResumeToR3", "Maximum VMRESUME inner-loop counter reached.");
+        HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchHltToR3,          "/HM/CPU%d/Switch/HltToR3", "HLT causing us to go to ring-3.");
+        HM_REG_COUNTER(&pVCpu->hm.s.StatSwitchApicAccessToR3,   "/HM/CPU%d/Switch/ApicAccessToR3", "APIC access causing us to go to ring-3.");
 
         HM_REG_COUNTER(&pVCpu->hm.s.StatInjectInterrupt,        "/HM/CPU%d/EventInject/Interrupt", "Injected an external interrupt into the guest.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatInjectXcpt,             "/HM/CPU%d/EventInject/Trap", "Injected an exception into the guest.");
@@ -732,9 +767,9 @@ static int hmR3InitCPU(PVM pVM)
         HM_REG_COUNTER(&pVCpu->hm.s.StatTlbShootdown,           "/HM/CPU%d/Flush/Shootdown/Page", "Inter-VCPU request to flush queued guest page.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatTlbShootdownFlush,      "/HM/CPU%d/Flush/Shootdown/TLB", "Inter-VCPU request to flush entire guest-TLB.");
 
+        HM_REG_COUNTER(&pVCpu->hm.s.StatTscParavirt,            "/HM/CPU%d/TSC/Paravirt", "Paravirtualized TSC in effect.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatTscOffset,              "/HM/CPU%d/TSC/Offset", "TSC offsetting is in effect.");
-        HM_REG_COUNTER(&pVCpu->hm.s.StatTscIntercept,           "/HM/CPU%d/TSC/Intercept", "Guest is in catchup mode, intercept TSC accesses.");
-        HM_REG_COUNTER(&pVCpu->hm.s.StatTscInterceptOverFlow,   "/HM/CPU%d/TSC/InterceptOverflow", "TSC offset overflow, fallback to intercept TSC accesses.");
+        HM_REG_COUNTER(&pVCpu->hm.s.StatTscIntercept,           "/HM/CPU%d/TSC/Intercept", "Intercept TSC accesses.");
 
         HM_REG_COUNTER(&pVCpu->hm.s.StatDRxArmed,               "/HM/CPU%d/Debug/Armed", "Loaded guest-debug state while loading guest-state.");
         HM_REG_COUNTER(&pVCpu->hm.s.StatDRxContextSwitch,       "/HM/CPU%d/Debug/ContextSwitch", "Loaded guest-debug state on MOV DRx.");
@@ -811,7 +846,7 @@ static int hmR3InitCPU(PVM pVM)
         {
             STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatInjectedIrqs[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
                             "Injected event.",
-                            (j < 0x20) ? "/HM/CPU%d/EventInject/Event/Trap/%02X" : "/HM/CPU%d/EventInject/Event/IRQ/%02X", i, j);
+                            (j < 0x20) ? "/HM/CPU%d/EventInject/InjectTrap/%02X" : "/HM/CPU%d/EventInject/InjectIRQ/%02X", i, j);
         }
 
 #endif /* VBOX_WITH_STATISTICS */
@@ -917,8 +952,8 @@ static int hmR3InitFinalizeR0(PVM pVM)
                 return VM_SET_ERROR(pVM, VERR_VMX_NO_VMX, "VT-x is not available.");
             case VERR_VMX_MSR_VMXON_DISABLED:
                 return VM_SET_ERROR(pVM, VERR_VMX_NO_VMX, "VT-x is disabled in the BIOS.");
-            case VERR_VMX_MSR_SMX_VMXON_DISABLED:
-                return VM_SET_ERROR(pVM, VERR_VMX_NO_VMX, "VT-x is disabled in the BIOS for Safer-Mode/Trusted Extensions.");
+            case VERR_VMX_MSR_ALL_VMXON_DISABLED:
+                return VM_SET_ERROR(pVM, VERR_VMX_NO_VMX, "VT-x is disabled in the BIOS for all CPU modes.");
             case VERR_VMX_MSR_LOCKING_FAILED:
                 return VM_SET_ERROR(pVM, VERR_VMX_NO_VMX, "Failed to enable and lock VT-x features.");
 
@@ -950,8 +985,8 @@ static int hmR3InitFinalizeR0(PVM pVM)
     pVM->hm.s.fHasIoApic = PDMHasIoApic(pVM);
     if (!pVM->hm.s.fHasIoApic)
     {
-        Assert(!pVM->hm.s.fTRPPatchingAllowed); /* paranoia */
-        pVM->hm.s.fTRPPatchingAllowed = false;
+        Assert(!pVM->hm.s.fTprPatchingAllowed); /* paranoia */
+        pVM->hm.s.fTprPatchingAllowed = false;
     }
 
     /*
@@ -1054,6 +1089,10 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
         HMVMX_REPORT_FEATURE(val, zap, VMX_VMCS_CTRL_PROC_EXEC2_RDRAND_EXIT);
         HMVMX_REPORT_FEATURE(val, zap, VMX_VMCS_CTRL_PROC_EXEC2_INVPCID);
         HMVMX_REPORT_FEATURE(val, zap, VMX_VMCS_CTRL_PROC_EXEC2_VMFUNC);
+        HMVMX_REPORT_FEATURE(val, zap, VMX_VMCS_CTRL_PROC_EXEC2_VMCS_SHADOWING);
+        HMVMX_REPORT_FEATURE(val, zap, VMX_VMCS_CTRL_PROC_EXEC2_RDSEED_EXIT);
+        HMVMX_REPORT_FEATURE(val, zap, VMX_VMCS_CTRL_PROC_EXEC2_EPT_VE);
+        HMVMX_REPORT_FEATURE(val, zap, VMX_VMCS_CTRL_PROC_EXEC2_XSAVES);
     }
 
     LogRel(("HM: MSR_IA32_VMX_ENTRY_CTLS         = %#RX64\n", pVM->hm.s.vmx.Msrs.VmxEntry.u));
@@ -1157,9 +1196,20 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
         LogRel(("HM: VCPU%3d: VMCS physaddr          = %#RHp\n", i, pVM->aCpus[i].hm.s.vmx.HCPhysVmcs));
     }
 
-    if (pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_EPT)
-        pVM->hm.s.fNestedPaging = pVM->hm.s.fAllowNestedPaging;
+    /*
+     * EPT and unhampered guest execution are determined in HMR3Init, verify the sanity of that.
+     */
+    AssertLogRelReturn(   !pVM->hm.s.fNestedPaging
+                       || (pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_EPT),
+                       VERR_HM_IPE_1);
+    AssertLogRelReturn(   !pVM->hm.s.vmx.fUnrestrictedGuest
+                       || (   (pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_UNRESTRICTED_GUEST)
+                           && pVM->hm.s.fNestedPaging),
+                       VERR_HM_IPE_1);
 
+    /*
+     * Enable VPID of configured and supported.
+     */
     if (pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_VPID)
         pVM->hm.s.vmx.fVpid = pVM->hm.s.vmx.fAllowVpid;
 
@@ -1172,15 +1222,7 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
         && CPUMGetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_RDTSCP))
     {
         CPUMClearGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_RDTSCP);
-        LogRel(("HM: RDTSCP disabled.\n"));
-    }
-
-    /* Unrestricted guest execution also requires EPT. */
-    if (    pVM->hm.s.vmx.fAllowUnrestricted
-        &&  pVM->hm.s.fNestedPaging
-        &&  (pVM->hm.s.vmx.Msrs.VmxProcCtls2.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC2_UNRESTRICTED_GUEST))
-    {
-        pVM->hm.s.vmx.fUnrestrictedGuest = true;
+        LogRel(("HM: RDTSCP disabled\n"));
     }
 
     if (!pVM->hm.s.vmx.fUnrestrictedGuest)
@@ -1231,18 +1273,17 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
         }
         else
         {
-            /** @todo This cannot possibly work, there are other places which assumes
-             *        this allocation cannot fail (see HMR3CanExecuteGuest()). Make this
-             *        a failure case. */
             LogRel(("HM: No real mode VT-x support (PDMR3VMMDevHeapAlloc returned %Rrc)\n", rc));
             pVM->hm.s.vmx.pRealModeTSS = NULL;
             pVM->hm.s.vmx.pNonPagingModeEPTPageTable = NULL;
+            return VMSetError(pVM, rc, RT_SRC_POS,
+                              "HM failure: No real mode VT-x support (PDMR3VMMDevHeapAlloc returned %Rrc)", rc);
         }
     }
 
     LogRel((pVM->hm.s.fAllow64BitGuests
-            ? "HM: Guest support: 32-bit and 64-bit.\n"
-            : "HM: Guest support: 32-bit only.\n"));
+            ? "HM: Guest support: 32-bit and 64-bit\n"
+            : "HM: Guest support: 32-bit only\n"));
 
     /*
      * Call ring-0 to set up the VM.
@@ -1258,6 +1299,7 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
             LogRel(("HM: CPU[%u] Last instruction error  %#x\n", i, pVCpu->hm.s.vmx.LastError.u32InstrError));
             LogRel(("HM: CPU[%u] HM error                %#x (%u)\n", i, pVCpu->hm.s.u32HMError, pVCpu->hm.s.u32HMError));
         }
+        HMR3CheckError(pVM, rc);
         return VMSetError(pVM, rc, RT_SRC_POS, "VT-x setup failed: %Rrc", rc);
     }
 
@@ -1287,7 +1329,7 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
         if (pVM->hm.s.vmx.u64HostEfer & MSR_K6_EFER_NXE)
             CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_NX);
         else
-            LogRel(("HM: NX not enabled on the host, unavailable to PAE guest.\n"));
+            LogRel(("HM: NX not enabled on the host, unavailable to PAE guest\n"));
     }
 
     /*
@@ -1296,12 +1338,12 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
     if (pVM->hm.s.fNestedPaging)
     {
         LogRel(("HM: Nested paging enabled!\n"));
-        if (pVM->hm.s.vmx.enmFlushEpt == VMX_FLUSH_EPT_SINGLE_CONTEXT)
-            LogRel(("HM:   EPT flush type                = VMX_FLUSH_EPT_SINGLE_CONTEXT\n"));
-        else if (pVM->hm.s.vmx.enmFlushEpt == VMX_FLUSH_EPT_ALL_CONTEXTS)
-            LogRel(("HM:   EPT flush type                = VMX_FLUSH_EPT_ALL_CONTEXTS\n"));
-        else if (pVM->hm.s.vmx.enmFlushEpt == VMX_FLUSH_EPT_NOT_SUPPORTED)
-            LogRel(("HM:   EPT flush type                = VMX_FLUSH_EPT_NOT_SUPPORTED\n"));
+        if (pVM->hm.s.vmx.enmFlushEpt == VMXFLUSHEPT_SINGLE_CONTEXT)
+            LogRel(("HM:   EPT flush type                = VMXFLUSHEPT_SINGLE_CONTEXT\n"));
+        else if (pVM->hm.s.vmx.enmFlushEpt == VMXFLUSHEPT_ALL_CONTEXTS)
+            LogRel(("HM:   EPT flush type                = VMXFLUSHEPT_ALL_CONTEXTS\n"));
+        else if (pVM->hm.s.vmx.enmFlushEpt == VMXFLUSHEPT_NOT_SUPPORTED)
+            LogRel(("HM:   EPT flush type                = VMXFLUSHEPT_NOT_SUPPORTED\n"));
         else
             LogRel(("HM:   EPT flush type                = %d\n", pVM->hm.s.vmx.enmFlushEpt));
 
@@ -1313,7 +1355,7 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
         {
             /* Use large (2 MB) pages for our EPT PDEs where possible. */
             PGMSetLargePageUsage(pVM, true);
-            LogRel(("HM: Large page support enabled!\n"));
+            LogRel(("HM: Large page support enabled\n"));
         }
 #endif
     }
@@ -1323,33 +1365,24 @@ static int hmR3InitFinalizeR0Intel(PVM pVM)
     if (pVM->hm.s.vmx.fVpid)
     {
         LogRel(("HM: VPID enabled!\n"));
-        if (pVM->hm.s.vmx.enmFlushVpid == VMX_FLUSH_VPID_INDIV_ADDR)
-            LogRel(("HM:   VPID flush type               = VMX_FLUSH_VPID_INDIV_ADDR\n"));
-        else if (pVM->hm.s.vmx.enmFlushVpid == VMX_FLUSH_VPID_SINGLE_CONTEXT)
-            LogRel(("HM:   VPID flush type               = VMX_FLUSH_VPID_SINGLE_CONTEXT\n"));
-        else if (pVM->hm.s.vmx.enmFlushVpid == VMX_FLUSH_VPID_ALL_CONTEXTS)
-            LogRel(("HM:   VPID flush type               = VMX_FLUSH_VPID_ALL_CONTEXTS\n"));
-        else if (pVM->hm.s.vmx.enmFlushVpid == VMX_FLUSH_VPID_SINGLE_CONTEXT_RETAIN_GLOBALS)
-            LogRel(("HM:   VPID flush type               = VMX_FLUSH_VPID_SINGLE_CONTEXT_RETAIN_GLOBALS\n"));
+        if (pVM->hm.s.vmx.enmFlushVpid == VMXFLUSHVPID_INDIV_ADDR)
+            LogRel(("HM:   VPID flush type               = VMXFLUSHVPID_INDIV_ADDR\n"));
+        else if (pVM->hm.s.vmx.enmFlushVpid == VMXFLUSHVPID_SINGLE_CONTEXT)
+            LogRel(("HM:   VPID flush type               = VMXFLUSHVPID_SINGLE_CONTEXT\n"));
+        else if (pVM->hm.s.vmx.enmFlushVpid == VMXFLUSHVPID_ALL_CONTEXTS)
+            LogRel(("HM:   VPID flush type               = VMXFLUSHVPID_ALL_CONTEXTS\n"));
+        else if (pVM->hm.s.vmx.enmFlushVpid == VMXFLUSHVPID_SINGLE_CONTEXT_RETAIN_GLOBALS)
+            LogRel(("HM:   VPID flush type               = VMXFLUSHVPID_SINGLE_CONTEXT_RETAIN_GLOBALS\n"));
         else
             LogRel(("HM:   VPID flush type               = %d\n", pVM->hm.s.vmx.enmFlushVpid));
     }
-    else if (pVM->hm.s.vmx.enmFlushVpid == VMX_FLUSH_VPID_NOT_SUPPORTED)
-        LogRel(("HM: Ignoring VPID capabilities of CPU.\n"));
+    else if (pVM->hm.s.vmx.enmFlushVpid == VMXFLUSHVPID_NOT_SUPPORTED)
+        LogRel(("HM: Ignoring VPID capabilities of CPU\n"));
 
-    /*
-     * Check for preemption timer config override and log the state of it.
-     */
-    if (pVM->hm.s.vmx.fUsePreemptTimer)
-    {
-        PCFGMNODE pCfgHm = CFGMR3GetChild(CFGMR3GetRoot(pVM), "HM");
-        rc = CFGMR3QueryBoolDef(pCfgHm, "UsePreemptTimer", &pVM->hm.s.vmx.fUsePreemptTimer, true);
-        AssertLogRelRCReturn(rc, rc);
-    }
     if (pVM->hm.s.vmx.fUsePreemptTimer)
-        LogRel(("HM: VMX-preemption timer enabled (cPreemptTimerShift=%u).\n", pVM->hm.s.vmx.cPreemptTimerShift));
+        LogRel(("HM: VMX-preemption timer enabled (cPreemptTimerShift=%u)\n", pVM->hm.s.vmx.cPreemptTimerShift));
     else
-        LogRel(("HM: VMX-preemption timer disabled.\n"));
+        LogRel(("HM: VMX-preemption timer disabled\n"));
 
     return VINF_SUCCESS;
 }
@@ -1372,6 +1405,7 @@ static int hmR3InitFinalizeR0Amd(PVM pVM)
     uint32_t u32Stepping;
     if (HMAmdIsSubjectToErratum170(&u32Family, &u32Model, &u32Stepping))
         LogRel(("HM: AMD Cpu with erratum 170 family %#x model %#x stepping %#x\n", u32Family, u32Model, u32Stepping));
+    LogRel(("HM: Max resume loops                  = %u\n",     pVM->hm.s.cMaxResumeLoops));
     LogRel(("HM: CPUID 0x80000001.u32AMDFeatureECX = %#RX32\n", pVM->hm.s.cpuid.u32AMDFeatureECX));
     LogRel(("HM: CPUID 0x80000001.u32AMDFeatureEDX = %#RX32\n", pVM->hm.s.cpuid.u32AMDFeatureEDX));
     LogRel(("HM: AMD HWCR MSR                      = %#RX64\n", pVM->hm.s.svm.u64MsrHwcr));
@@ -1412,10 +1446,11 @@ static int hmR3InitFinalizeR0Amd(PVM pVM)
                 LogRel(("HM:   Reserved bit %u\n", iBit));
 
     /*
-     * Adjust feature(s).
+     * Nested paging is determined in HMR3Init, verify the sanity of that.
      */
-    if (pVM->hm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING)
-        pVM->hm.s.fNestedPaging = pVM->hm.s.fAllowNestedPaging;
+    AssertLogRelReturn(   !pVM->hm.s.fNestedPaging
+                       || (pVM->hm.s.svm.u32Features & AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING),
+                       VERR_HM_IPE_1);
 
     /*
      * Call ring-0 to set up the VM.
@@ -1465,11 +1500,11 @@ static int hmR3InitFinalizeR0Amd(PVM pVM)
     else if (CPUMGetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_PAE))
         CPUMSetGuestCpuIdFeature(pVM, CPUMCPUIDFEATURE_NX);
 
-    LogRel(("HM: TPR Patching %s.\n", (pVM->hm.s.fTRPPatchingAllowed) ? "enabled" : "disabled"));
+    LogRel(("HM: TPR patching %s\n", (pVM->hm.s.fTprPatchingAllowed) ? "enabled" : "disabled"));
 
     LogRel((pVM->hm.s.fAllow64BitGuests
-            ? "HM: Guest support: 32-bit and 64-bit.\n"
-            : "HM: Guest support: 32-bit only.\n"));
+            ? "HM: Guest support: 32-bit and 64-bit\n"
+            : "HM: Guest support: 32-bit only\n"));
 
     return VINF_SUCCESS;
 }
@@ -1839,7 +1874,7 @@ DECLCALLBACK(VBOXSTRICTRC) hmR3ReplaceTprInstr(PVM pVM, PVMCPU pVCpu, void *pvUs
      * issued. (The other CPU(s) might not yet have switched to protected
      * mode, nor have the correct memory context.)
      */
-    VMCPUID         idCpu  = (VMCPUID)(uintptr_t)pvUser;
+    VMCPUID idCpu = (VMCPUID)(uintptr_t)pvUser;
     if (pVCpu->idCpu != idCpu)
         return VINF_SUCCESS;
 
@@ -1847,14 +1882,14 @@ DECLCALLBACK(VBOXSTRICTRC) hmR3ReplaceTprInstr(PVM pVM, PVMCPU pVCpu, void *pvUs
      * We're racing other VCPUs here, so don't try patch the instruction twice
      * and make sure there is still room for our patch record.
      */
-    PCPUMCTX        pCtx   = CPUMQueryGuestCtxPtr(pVCpu);
+    PCPUMCTX    pCtx   = CPUMQueryGuestCtxPtr(pVCpu);
     PHMTPRPATCH pPatch = (PHMTPRPATCH)RTAvloU32Get(&pVM->hm.s.PatchTree, (AVLOU32KEY)pCtx->eip);
     if (pPatch)
     {
         Log(("hmR3ReplaceTprInstr: already patched %RGv\n", pCtx->rip));
         return VINF_SUCCESS;
     }
-    uint32_t const  idx = pVM->hm.s.cPatches;
+    uint32_t const idx = pVM->hm.s.cPatches;
     if (idx >= RT_ELEMENTS(pVM->hm.s.aPatches))
     {
         Log(("hmR3ReplaceTprInstr: no available patch slots (%RGv)\n", pCtx->rip));
@@ -2465,7 +2500,7 @@ VMMR3DECL(bool) HMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx)
     {
         /*
          * The VMM device heap is a requirement for emulating real mode or protected mode without paging with the unrestricted
-         * guest execution feature i missing (VT-x only).
+         * guest execution feature is missing (VT-x only).
          */
         if (fSupportsRealMode)
         {
@@ -2525,12 +2560,12 @@ VMMR3DECL(bool) HMR3CanExecuteGuest(PVM pVM, PCPUMCTX pCtx)
                 /* VT-x also chokes on invalid TR or LDTR selectors (minix). */
                 if (pCtx->gdtr.cbGdt)
                 {
-                    if (pCtx->tr.Sel > pCtx->gdtr.cbGdt)
+                    if ((pCtx->tr.Sel | X86_SEL_RPL_LDT) > pCtx->gdtr.cbGdt)
                     {
                         STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadTr);
                         return false;
                     }
-                    else if (pCtx->ldtr.Sel > pCtx->gdtr.cbGdt)
+                    else if ((pCtx->ldtr.Sel | X86_SEL_RPL_LDT) > pCtx->gdtr.cbGdt)
                     {
                         STAM_COUNTER_INC(&pVCpu->hm.s.StatVmxCheckBadLdt);
                         return false;
@@ -2665,7 +2700,7 @@ VMMR3_INT_DECL(void) HMR3NotifyEmulated(PVMCPU pVCpu)
 
 
 /**
- * Checks if we are currently using hardware accelerated raw mode.
+ * Checks if we are currently using hardware acceleration.
  *
  * @returns true if hardware acceleration is being used, otherwise false.
  * @param   pVCpu        Pointer to the VMCPU.
@@ -2677,8 +2712,7 @@ VMMR3_INT_DECL(bool) HMR3IsActive(PVMCPU pVCpu)
 
 
 /**
- * External interface for querying whether hardware accelerated raw mode is
- * enabled.
+ * External interface for querying whether hardware acceleration is enabled.
  *
  * @returns true if VT-x or AMD-V is being used, otherwise false.
  * @param   pUVM        The user mode VM handle.
@@ -2895,6 +2929,8 @@ VMMR3_INT_DECL(void) HMR3CheckError(PVM pVM, int iStatusCode)
         PVMCPU pVCpu = &pVM->aCpus[i];
         switch (iStatusCode)
         {
+            /** @todo r=ramshankar: Are all EMTs out of ring-0 at this point!? If not, we
+             *  might be getting inaccurate values for non-guru'ing EMTs. */
             case VERR_VMX_INVALID_VMCS_FIELD:
                 break;
 
@@ -2925,12 +2961,10 @@ VMMR3_INT_DECL(void) HMR3CheckError(PVM pVM, int iStatusCode)
                     LogRel(("HM: CPU[%u] ProcCtls2        %#RX32\n", i, pVCpu->hm.s.vmx.u32ProcCtls2));
                     LogRel(("HM: CPU[%u] EntryCtls        %#RX32\n", i, pVCpu->hm.s.vmx.u32EntryCtls));
                     LogRel(("HM: CPU[%u] ExitCtls         %#RX32\n", i, pVCpu->hm.s.vmx.u32ExitCtls));
-                    LogRel(("HM: CPU[%u] MSRBitmapPhys    %#RHp\n",  i, pVCpu->hm.s.vmx.HCPhysMsrBitmap));
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-                    LogRel(("HM: CPU[%u] GuestMSRPhys     %#RHp\n",  i, pVCpu->hm.s.vmx.HCPhysGuestMsr));
-                    LogRel(("HM: CPU[%u] HostMsrPhys      %#RHp\n",  i, pVCpu->hm.s.vmx.HCPhysHostMsr));
-                    LogRel(("HM: CPU[%u] cGuestMSRs       %u\n",     i, pVCpu->hm.s.vmx.cGuestMsrs));
-#endif
+                    LogRel(("HM: CPU[%u] HCPhysMsrBitmap  %#RHp\n",  i, pVCpu->hm.s.vmx.HCPhysMsrBitmap));
+                    LogRel(("HM: CPU[%u] HCPhysGuestMsr   %#RHp\n",  i, pVCpu->hm.s.vmx.HCPhysGuestMsr));
+                    LogRel(("HM: CPU[%u] HCPhysHostMsr    %#RHp\n",  i, pVCpu->hm.s.vmx.HCPhysHostMsr));
+                    LogRel(("HM: CPU[%u] cMsrs            %u\n",     i, pVCpu->hm.s.vmx.cMsrs));
                 }
                 /** @todo Log VM-entry event injection control fields
                  *        VMX_VMCS_CTRL_ENTRY_IRQ_INFO, VMX_VMCS_CTRL_ENTRY_EXCEPTION_ERRCODE
@@ -2950,6 +2984,15 @@ VMMR3_INT_DECL(void) HMR3CheckError(PVM pVM, int iStatusCode)
             case VERR_VMX_UNEXPECTED_INTERRUPTION_EXIT_TYPE:
             {
                 LogRel(("HM: CPU[%u] HM error         %#x (%u)\n", i, pVCpu->hm.s.u32HMError, pVCpu->hm.s.u32HMError));
+                LogRel(("HM: CPU[%u] idxExitHistoryFree    %u\n", i, pVCpu->hm.s.idxExitHistoryFree));
+                unsigned const idxLast = pVCpu->hm.s.idxExitHistoryFree > 0 ?
+                                                                            pVCpu->hm.s.idxExitHistoryFree - 1 :
+                                                                            RT_ELEMENTS(pVCpu->hm.s.auExitHistory) - 1;
+                for (unsigned k = 0; k < RT_ELEMENTS(pVCpu->hm.s.auExitHistory); k++)
+                {
+                    LogRel(("HM: CPU[%u] auExitHistory[%2u]   = %#x (%u) %s\n", i, k, pVCpu->hm.s.auExitHistory[k],
+                            pVCpu->hm.s.auExitHistory[k], idxLast == k ? "<-- Last" : ""));
+                }
                 break;
             }
         }
@@ -2957,8 +3000,8 @@ VMMR3_INT_DECL(void) HMR3CheckError(PVM pVM, int iStatusCode)
 
     if (iStatusCode == VERR_VMX_UNABLE_TO_START_VM)
     {
-        LogRel(("VERR_VMX_UNABLE_TO_START_VM: VM-entry allowed    %#RX32\n", pVM->hm.s.vmx.Msrs.VmxEntry.n.allowed1));
-        LogRel(("VERR_VMX_UNABLE_TO_START_VM: VM-entry disallowed %#RX32\n", pVM->hm.s.vmx.Msrs.VmxEntry.n.disallowed0));
+        LogRel(("HM: VERR_VMX_UNABLE_TO_START_VM: VM-entry allowed    %#RX32\n", pVM->hm.s.vmx.Msrs.VmxEntry.n.allowed1));
+        LogRel(("HM: VERR_VMX_UNABLE_TO_START_VM: VM-entry disallowed %#RX32\n", pVM->hm.s.vmx.Msrs.VmxEntry.n.disallowed0));
     }
     else if (iStatusCode == VERR_VMX_INVALID_VMXON_PTR)
         LogRel(("HM: HCPhysVmxEnableError         = %#RHp\n", pVM->hm.s.vmx.HCPhysVmxEnableError));
@@ -3073,9 +3116,9 @@ static DECLCALLBACK(int) hmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, u
     /*
      * Validate version.
      */
-    if (   uVersion != HM_SSM_VERSION
-        && uVersion != HM_SSM_VERSION_NO_PATCHING
-        && uVersion != HM_SSM_VERSION_2_0_X)
+    if (   uVersion != HM_SAVED_STATE_VERSION
+        && uVersion != HM_SAVED_STATE_VERSION_NO_PATCHING
+        && uVersion != HM_SAVED_STATE_VERSION_2_0_X)
     {
         AssertMsgFailed(("hmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
@@ -3089,7 +3132,7 @@ static DECLCALLBACK(int) hmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, u
         rc = SSMR3GetU64(pSSM, &pVM->aCpus[i].hm.s.Event.u64IntInfo);
         AssertRCReturn(rc, rc);
 
-        if (uVersion >= HM_SSM_VERSION_NO_PATCHING)
+        if (uVersion >= HM_SAVED_STATE_VERSION_NO_PATCHING)
         {
             uint32_t val;
             /** @todo See note in hmR3Save(). */
@@ -3102,7 +3145,7 @@ static DECLCALLBACK(int) hmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, u
         }
     }
 #ifdef VBOX_HM_WITH_GUEST_PATCHING
-    if (uVersion > HM_SSM_VERSION_NO_PATCHING)
+    if (uVersion > HM_SAVED_STATE_VERSION_NO_PATCHING)
     {
         rc = SSMR3GetGCPtr(pSSM, &pVM->hm.s.pGuestPatchMem);
         AssertRCReturn(rc, rc);
diff --git a/src/VBox/VMM/VMMR3/IEMR3.cpp b/src/VBox/VMM/VMMR3/IEMR3.cpp
index 0c08343..96be7b4 100644
--- a/src/VBox/VMM/VMMR3/IEMR3.cpp
+++ b/src/VBox/VMM/VMMR3/IEMR3.cpp
@@ -70,21 +70,12 @@ VMMR3DECL(int)      IEMR3Init(PVM pVM)
          */
         if (idCpu == 0)
         {
-            uint32_t uIgnored;
-            CPUMGetGuestCpuId(pVCpu, 1, &uIgnored, &uIgnored,
-                              &pVCpu->iem.s.fCpuIdStdFeaturesEcx, &pVCpu->iem.s.fCpuIdStdFeaturesEdx);
             pVCpu->iem.s.enmCpuVendor             = CPUMGetGuestCpuVendor(pVM);
-
-            ASMCpuId_ECX_EDX(1, &pVCpu->iem.s.fHostCpuIdStdFeaturesEcx, &pVCpu->iem.s.fHostCpuIdStdFeaturesEdx);
             pVCpu->iem.s.enmHostCpuVendor         = CPUMGetHostCpuVendor(pVM);
         }
         else
         {
-            pVCpu->iem.s.fCpuIdStdFeaturesEcx     = pVM->aCpus[0].iem.s.fCpuIdStdFeaturesEcx;
-            pVCpu->iem.s.fCpuIdStdFeaturesEdx     = pVM->aCpus[0].iem.s.fCpuIdStdFeaturesEdx;
             pVCpu->iem.s.enmCpuVendor             = pVM->aCpus[0].iem.s.enmCpuVendor;
-            pVCpu->iem.s.fHostCpuIdStdFeaturesEcx = pVM->aCpus[0].iem.s.fHostCpuIdStdFeaturesEcx;
-            pVCpu->iem.s.fHostCpuIdStdFeaturesEdx = pVM->aCpus[0].iem.s.fHostCpuIdStdFeaturesEdx;
             pVCpu->iem.s.enmHostCpuVendor         = pVM->aCpus[0].iem.s.enmHostCpuVendor;
         }
 
diff --git a/src/VBox/VMM/VMMR3/IOM.cpp b/src/VBox/VMM/VMMR3/IOM.cpp
index 667ce9f..53aeee8 100644
--- a/src/VBox/VMM/VMMR3/IOM.cpp
+++ b/src/VBox/VMM/VMMR3/IOM.cpp
@@ -41,10 +41,10 @@
  * access handlers. An MMIO range is registered with IOM which then registers it
  * with the PGM access handler sub-system. The access handler catches all
  * access and will be called in the context of a \#PF handler. In RC and R0 this
- * handler is IOMMMIOHandler while in ring-3 it's IOMR3MMIOHandler (although in
- * ring-3 there can be alternative ways). IOMMMIOHandler will attempt to emulate
- * the instruction that is doing the access and pass the corresponding reads /
- * writes to the device.
+ * handler is iomMmioPfHandler while in ring-3 it's iomR3MmioHandler (although
+ * in ring-3 there can be alternative ways). iomMmioPfHandler will attempt to
+ * emulate the instruction that is doing the access and pass the corresponding
+ * reads / writes to the device.
  *
  * Emulating I/O port access is less complex and should be slightly faster than
  * emulating MMIO, so in most cases we should encourage the OS to use port I/O.
@@ -68,7 +68,7 @@
  * special RAM range with the recompiler and in the three callbacks (for byte,
  * word and dword access) we call IOMMMIORead and IOMMMIOWrite directly. The
  * alternative ways that the physical memory access which goes via PGM will take
- * care of it by calling IOMR3MMIOHandler via the PGM access handler machinery
+ * care of it by calling iomR3MmioHandler via the PGM access handler machinery
  * - this shouldn't happen but it is an alternative...
  *
  *
@@ -181,46 +181,58 @@ VMMR3_INT_DECL(int) IOMR3Init(PVM pVM)
     {
         pVM->iom.s.pTreesRC = MMHyperR3ToRC(pVM, pVM->iom.s.pTreesR3);
         pVM->iom.s.pTreesR0 = MMHyperR3ToR0(pVM, pVM->iom.s.pTreesR3);
-        pVM->iom.s.pfnMMIOHandlerRC = NIL_RTGCPTR;
-        pVM->iom.s.pfnMMIOHandlerR0 = NIL_RTR0PTR;
 
         /*
-         * Info.
+         * Register the MMIO access handler type.
          */
-        DBGFR3InfoRegisterInternal(pVM, "ioport", "Dumps all IOPort ranges. No arguments.", &iomR3IOPortInfo);
-        DBGFR3InfoRegisterInternal(pVM, "mmio", "Dumps all MMIO ranges. No arguments.", &iomR3MMIOInfo);
+        rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_MMIO,
+                                              iomMmioHandler,
+                                              NULL, "iomMmioPfHandler",
+                                              NULL, "iomMmioPfHandler",
+                                              "MMIO",
+                                              &pVM->iom.s.hMmioHandlerType);
+        AssertRC(rc);
+        if (RT_SUCCESS(rc))
+        {
 
-        /*
-         * Statistics.
-         */
-        STAM_REG(pVM, &pVM->iom.s.StatRZMMIOHandler,      STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler",                      STAMUNIT_TICKS_PER_CALL, "Profiling of the IOMMMIOHandler() body, only success calls.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZMMIO1Byte,        STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Access1",              STAMUNIT_OCCURENCES,     "MMIO access by 1 byte counter.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZMMIO2Bytes,       STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Access2",              STAMUNIT_OCCURENCES,     "MMIO access by 2 bytes counter.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZMMIO4Bytes,       STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Access4",              STAMUNIT_OCCURENCES,     "MMIO access by 4 bytes counter.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZMMIO8Bytes,       STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Access8",              STAMUNIT_OCCURENCES,     "MMIO access by 8 bytes counter.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZMMIOFailures,     STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/MMIOFailures",         STAMUNIT_OCCURENCES,     "Number of times IOMMMIOHandler() didn't service the request.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstMov,          STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/MOV",             STAMUNIT_TICKS_PER_CALL, "Profiling of the MOV instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstCmp,          STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/CMP",             STAMUNIT_TICKS_PER_CALL, "Profiling of the CMP instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstAnd,          STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/AND",             STAMUNIT_TICKS_PER_CALL, "Profiling of the AND instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstOr,           STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/OR",              STAMUNIT_TICKS_PER_CALL, "Profiling of the OR instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstXor,          STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/XOR",             STAMUNIT_TICKS_PER_CALL, "Profiling of the XOR instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstBt,           STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/BT",              STAMUNIT_TICKS_PER_CALL, "Profiling of the BT instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstTest,         STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/TEST",            STAMUNIT_TICKS_PER_CALL, "Profiling of the TEST instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstXchg,         STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/XCHG",            STAMUNIT_TICKS_PER_CALL, "Profiling of the XCHG instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstStos,         STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/STOS",            STAMUNIT_TICKS_PER_CALL, "Profiling of the STOS instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstLods,         STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/LODS",            STAMUNIT_TICKS_PER_CALL, "Profiling of the LODS instruction emulation.");
+            /*
+             * Info.
+             */
+            DBGFR3InfoRegisterInternal(pVM, "ioport", "Dumps all IOPort ranges. No arguments.", &iomR3IOPortInfo);
+            DBGFR3InfoRegisterInternal(pVM, "mmio", "Dumps all MMIO ranges. No arguments.", &iomR3MMIOInfo);
+
+            /*
+             * Statistics.
+             */
+            STAM_REG(pVM, &pVM->iom.s.StatRZMMIOHandler,      STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler",                      STAMUNIT_TICKS_PER_CALL, "Profiling of the iomMmioPfHandler() body, only success calls.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZMMIO1Byte,        STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Access1",              STAMUNIT_OCCURENCES,     "MMIO access by 1 byte counter.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZMMIO2Bytes,       STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Access2",              STAMUNIT_OCCURENCES,     "MMIO access by 2 bytes counter.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZMMIO4Bytes,       STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Access4",              STAMUNIT_OCCURENCES,     "MMIO access by 4 bytes counter.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZMMIO8Bytes,       STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Access8",              STAMUNIT_OCCURENCES,     "MMIO access by 8 bytes counter.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZMMIOFailures,     STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/MMIOFailures",         STAMUNIT_OCCURENCES,     "Number of times iomMmioPfHandler() didn't service the request.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstMov,          STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/MOV",             STAMUNIT_TICKS_PER_CALL, "Profiling of the MOV instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstCmp,          STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/CMP",             STAMUNIT_TICKS_PER_CALL, "Profiling of the CMP instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstAnd,          STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/AND",             STAMUNIT_TICKS_PER_CALL, "Profiling of the AND instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstOr,           STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/OR",              STAMUNIT_TICKS_PER_CALL, "Profiling of the OR instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstXor,          STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/XOR",             STAMUNIT_TICKS_PER_CALL, "Profiling of the XOR instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstBt,           STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/BT",              STAMUNIT_TICKS_PER_CALL, "Profiling of the BT instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstTest,         STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/TEST",            STAMUNIT_TICKS_PER_CALL, "Profiling of the TEST instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstXchg,         STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/XCHG",            STAMUNIT_TICKS_PER_CALL, "Profiling of the XCHG instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstStos,         STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/STOS",            STAMUNIT_TICKS_PER_CALL, "Profiling of the STOS instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstLods,         STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/LODS",            STAMUNIT_TICKS_PER_CALL, "Profiling of the LODS instruction emulation.");
 #ifdef IOM_WITH_MOVS_SUPPORT
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstMovs,     STAMTYPE_PROFILE_ADV, "/IOM/RZ-MMIOHandler/Inst/MOVS",            STAMUNIT_TICKS_PER_CALL, "Profiling of the MOVS instruction emulation.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstMovsToMMIO,   STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/MOVS/ToMMIO",     STAMUNIT_TICKS_PER_CALL, "Profiling of the MOVS instruction emulation - Mem2MMIO.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstMovsFromMMIO, STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/MOVS/FromMMIO",   STAMUNIT_TICKS_PER_CALL, "Profiling of the MOVS instruction emulation - MMIO2Mem.");
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstMovsMMIO,     STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/MOVS/MMIO2MMIO",  STAMUNIT_TICKS_PER_CALL, "Profiling of the MOVS instruction emulation - MMIO2MMIO.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstMovs,     STAMTYPE_PROFILE_ADV, "/IOM/RZ-MMIOHandler/Inst/MOVS",            STAMUNIT_TICKS_PER_CALL, "Profiling of the MOVS instruction emulation.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstMovsToMMIO,   STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/MOVS/ToMMIO",     STAMUNIT_TICKS_PER_CALL, "Profiling of the MOVS instruction emulation - Mem2MMIO.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstMovsFromMMIO, STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/MOVS/FromMMIO",   STAMUNIT_TICKS_PER_CALL, "Profiling of the MOVS instruction emulation - MMIO2Mem.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstMovsMMIO,     STAMTYPE_PROFILE, "/IOM/RZ-MMIOHandler/Inst/MOVS/MMIO2MMIO",  STAMUNIT_TICKS_PER_CALL, "Profiling of the MOVS instruction emulation - MMIO2MMIO.");
 #endif
-        STAM_REG(pVM, &pVM->iom.s.StatRZInstOther,        STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Inst/Other",           STAMUNIT_OCCURENCES,     "Other instructions counter.");
-        STAM_REG(pVM, &pVM->iom.s.StatR3MMIOHandler,      STAMTYPE_COUNTER, "/IOM/R3-MMIOHandler",                      STAMUNIT_OCCURENCES,     "Number of calls to IOMR3MMIOHandler.");
-        STAM_REG(pVM, &pVM->iom.s.StatInstIn,             STAMTYPE_COUNTER, "/IOM/IOWork/In",                           STAMUNIT_OCCURENCES,     "Counter of any IN instructions.");
-        STAM_REG(pVM, &pVM->iom.s.StatInstOut,            STAMTYPE_COUNTER, "/IOM/IOWork/Out",                          STAMUNIT_OCCURENCES,     "Counter of any OUT instructions.");
-        STAM_REG(pVM, &pVM->iom.s.StatInstIns,            STAMTYPE_COUNTER, "/IOM/IOWork/Ins",                          STAMUNIT_OCCURENCES,     "Counter of any INS instructions.");
-        STAM_REG(pVM, &pVM->iom.s.StatInstOuts,           STAMTYPE_COUNTER, "/IOM/IOWork/Outs",                         STAMUNIT_OCCURENCES,     "Counter of any OUTS instructions.");
+            STAM_REG(pVM, &pVM->iom.s.StatRZInstOther,        STAMTYPE_COUNTER, "/IOM/RZ-MMIOHandler/Inst/Other",           STAMUNIT_OCCURENCES,     "Other instructions counter.");
+            STAM_REG(pVM, &pVM->iom.s.StatR3MMIOHandler,      STAMTYPE_COUNTER, "/IOM/R3-MMIOHandler",                      STAMUNIT_OCCURENCES,     "Number of calls to iomR3MmioHandler.");
+            STAM_REG(pVM, &pVM->iom.s.StatInstIn,             STAMTYPE_COUNTER, "/IOM/IOWork/In",                           STAMUNIT_OCCURENCES,     "Counter of any IN instructions.");
+            STAM_REG(pVM, &pVM->iom.s.StatInstOut,            STAMTYPE_COUNTER, "/IOM/IOWork/Out",                          STAMUNIT_OCCURENCES,     "Counter of any OUT instructions.");
+            STAM_REG(pVM, &pVM->iom.s.StatInstIns,            STAMTYPE_COUNTER, "/IOM/IOWork/Ins",                          STAMUNIT_OCCURENCES,     "Counter of any INS instructions.");
+            STAM_REG(pVM, &pVM->iom.s.StatInstOuts,           STAMTYPE_COUNTER, "/IOM/IOWork/Outs",                         STAMUNIT_OCCURENCES,     "Counter of any OUTS instructions.");
+        }
     }
 
     /* Redundant, but just in case we change something in the future */
@@ -308,9 +320,6 @@ VMMR3_INT_DECL(void) IOMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
     RTAvlroIOPortDoWithAll(&pVM->iom.s.pTreesR3->IOPortTreeRC, true, iomR3RelocateIOPortCallback, &offDelta);
     RTAvlroGCPhysDoWithAll(&pVM->iom.s.pTreesR3->MMIOTree,     true, iomR3RelocateMMIOCallback,   &offDelta);
 
-    if (pVM->iom.s.pfnMMIOHandlerRC != NIL_RTRCPTR)
-        pVM->iom.s.pfnMMIOHandlerRC += offDelta;
-
     /*
      * Reset the raw-mode cache (don't bother relocating it).
      */
@@ -1378,20 +1387,6 @@ IOMR3MmioRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t
                     VERR_INVALID_PARAMETER);
 
     /*
-     * Resolve the GC/R0 handler addresses lazily because of init order.
-     */
-    if (pVM->iom.s.pfnMMIOHandlerR0 == NIL_RTR0PTR)
-    {
-        if (!HMIsEnabled(pVM))
-        {
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "IOMMMIOHandler", &pVM->iom.s.pfnMMIOHandlerRC);
-            AssertLogRelRCReturn(rc, rc);
-        }
-        rc = PDMR3LdrGetSymbolR0(pVM, NULL, "IOMMMIOHandler", &pVM->iom.s.pfnMMIOHandlerR0);
-        AssertLogRelRCReturn(rc, rc);
-    }
-
-    /*
      * Allocate new range record and initialize it.
      */
     PIOMMMIORANGE pRange;
@@ -1428,10 +1423,8 @@ IOMR3MmioRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, uint32_t
         /*
          * Try register it with PGM and then insert it into the tree.
          */
-        rc = PGMR3PhysMMIORegister(pVM, GCPhysStart, cbRange,
-                                   IOMR3MMIOHandler, pRange,
-                                   pVM->iom.s.pfnMMIOHandlerR0, MMHyperR3ToR0(pVM, pRange),
-                                   pVM->iom.s.pfnMMIOHandlerRC, MMHyperR3ToRC(pVM, pRange), pszDesc);
+        rc = PGMR3PhysMMIORegister(pVM, GCPhysStart, cbRange, pVM->iom.s.hMmioHandlerType,
+                                   pRange, MMHyperR3ToR0(pVM, pRange), MMHyperR3ToRC(pVM, pRange), pszDesc);
         if (RT_SUCCESS(rc))
         {
             IOM_LOCK_EXCL(pVM);
diff --git a/src/VBox/VMM/VMMR3/MM.cpp b/src/VBox/VMM/VMMR3/MM.cpp
index a598739..315429c 100644
--- a/src/VBox/VMM/VMMR3/MM.cpp
+++ b/src/VBox/VMM/VMMR3/MM.cpp
@@ -308,7 +308,7 @@ VMMR3DECL(int) MMR3InitPaging(PVM pVM)
         AssertRCReturn(rc, rc);
     }
 
-    /** @cfgm{RamSize, uint64_t, 0, 16TB, 0}
+    /** @cfgm{/RamSize, uint64_t, 0, 16TB, 0}
      * Specifies the size of the base RAM that is to be set up during
      * VM initialization.
      */
@@ -323,7 +323,7 @@ VMMR3DECL(int) MMR3InitPaging(PVM pVM)
     cbRam &= X86_PTE_PAE_PG_MASK;
     pVM->mm.s.cbRamBase = cbRam;
 
-    /** @cfgm{RamHoleSize, uint32_t, 0, 4032MB, 512MB}
+    /** @cfgm{/RamHoleSize, uint32_t, 0, 4032MB, 512MB}
      * Specifies the size of the memory hole. The memory hole is used
      * to avoid mapping RAM to the range normally used for PCI memory regions.
      * Must be aligned on a 4MB boundary. */
@@ -342,7 +342,7 @@ VMMR3DECL(int) MMR3InitPaging(PVM pVM)
     else
         Log(("MM: %RU64 bytes of RAM with a hole at %RU64 up to 4GB.\n", cbRam, offRamHole));
 
-    /** @cfgm{MM/Policy, string, no overcommitment}
+    /** @cfgm{/MM/Policy, string, no overcommitment}
      * Specifies the policy to use when reserving memory for this VM. The recognized
      * value is 'no overcommitment' (default). See GMMPOLICY.
      */
@@ -362,7 +362,7 @@ VMMR3DECL(int) MMR3InitPaging(PVM pVM)
     else
         AssertMsgFailedReturn(("Configuration error: Failed to query string \"MM/Policy\", rc=%Rrc.\n", rc), rc);
 
-    /** @cfgm{MM/Priority, string, normal}
+    /** @cfgm{/MM/Priority, string, normal}
      * Specifies the memory priority of this VM. The priority comes into play when the
      * system is overcommitted and the VMs needs to be milked for memory. The recognized
      * values are 'low', 'normal' (default) and 'high'. See GMMPRIORITY.
@@ -502,6 +502,18 @@ VMMR3DECL(void) MMR3TermUVM(PUVM pUVM)
 
 
 /**
+ * Checks if the both VM and UVM parts of MM have been initialized.
+ *
+ * @returns true if initialized, false if not.
+ * @param   pVM         Pointer to the cross context VM structure.
+ */
+VMMR3_INT_DECL(bool) MMR3IsInitialized(PVM pVM)
+{
+    return pVM->mm.s.pHyperHeapR3 != NULL;
+}
+
+
+/**
  * Execute state save operation.
  *
  * @returns VBox status code.
diff --git a/src/VBox/VMM/VMMR3/MMHyper.cpp b/src/VBox/VMM/VMMR3/MMHyper.cpp
index 9143d98..f5fa005 100644
--- a/src/VBox/VMM/VMMR3/MMHyper.cpp
+++ b/src/VBox/VMM/VMMR3/MMHyper.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -38,7 +38,8 @@
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-static DECLCALLBACK(bool) mmR3HyperRelocateCallback(PVM pVM, RTGCPTR GCPtrOld, RTGCPTR GCPtrNew, PGMRELOCATECALL enmMode, void *pvUser);
+static DECLCALLBACK(bool) mmR3HyperRelocateCallback(PVM pVM, RTGCPTR GCPtrOld, RTGCPTR GCPtrNew, PGMRELOCATECALL enmMode,
+                                                    void *pvUser);
 static int mmR3HyperMap(PVM pVM, const size_t cb, const char *pszDesc, PRTGCPTR pGCPtr, PMMLOOKUPHYPER *ppLookup);
 static int mmR3HyperHeapCreate(PVM pVM, const size_t cb, PMMHYPERHEAP *ppHeap, PRTR0PTR pR0PtrHeap);
 static int mmR3HyperHeapMap(PVM pVM, PMMHYPERHEAP pHeap, PRTGCPTR ppHeapGC);
@@ -51,7 +52,7 @@ static DECLCALLBACK(void) mmR3HyperInfoHma(PVM pVM, PCDBGFINFOHLP pHlp, const ch
  * @returns The heap size in bytes.
  * @param   pVM     Pointer to the VM.
  */
-static uint32_t mmR3ComputeHyperHeapSize(PVM pVM)
+static uint32_t mmR3HyperComputeHeapSize(PVM pVM)
 {
     /*
      * Gather parameters.
@@ -123,7 +124,7 @@ int mmR3HyperInit(PVM pVM)
      */
     PCFGMNODE pMM = CFGMR3GetChild(CFGMR3GetRoot(pVM), "MM");
     uint32_t cbHyperHeap;
-    int rc = CFGMR3QueryU32Def(pMM, "cbHyperHeap", &cbHyperHeap, mmR3ComputeHyperHeapSize(pVM));
+    int rc = CFGMR3QueryU32Def(pMM, "cbHyperHeap", &cbHyperHeap, mmR3HyperComputeHeapSize(pVM));
     AssertLogRelRCReturn(rc, rc);
 
     cbHyperHeap = RT_ALIGN_32(cbHyperHeap, PAGE_SIZE);
@@ -148,7 +149,8 @@ int mmR3HyperInit(PVM pVM)
          */
         AssertRelease(pVM->cbSelf == RT_UOFFSETOF(VM, aCpus[pVM->cCpus]));
         RTGCPTR GCPtr;
-        rc = MMR3HyperMapPages(pVM, pVM, pVM->pVMR0, RT_ALIGN_Z(pVM->cbSelf, PAGE_SIZE) >> PAGE_SHIFT, pVM->paVMPagesR3, "VM", &GCPtr);
+        rc = MMR3HyperMapPages(pVM, pVM, pVM->pVMR0, RT_ALIGN_Z(pVM->cbSelf, PAGE_SIZE) >> PAGE_SHIFT, pVM->paVMPagesR3, "VM",
+                               &GCPtr);
         if (RT_SUCCESS(rc))
         {
             pVM->pVMRC = (RTRCPTR)GCPtr;
@@ -351,7 +353,8 @@ static DECLCALLBACK(bool) mmR3HyperRelocateCallback(PVM pVM, RTGCPTR GCPtrOld, R
             /*
              * Accepted!
              */
-            AssertMsg(GCPtrOld == pVM->mm.s.pvHyperAreaGC, ("GCPtrOld=%RGv pVM->mm.s.pvHyperAreaGC=%RGv\n", GCPtrOld, pVM->mm.s.pvHyperAreaGC));
+            AssertMsg(GCPtrOld == pVM->mm.s.pvHyperAreaGC,
+                      ("GCPtrOld=%RGv pVM->mm.s.pvHyperAreaGC=%RGv\n", GCPtrOld, pVM->mm.s.pvHyperAreaGC));
             Log(("Relocating the hypervisor from %RGv to %RGv\n", GCPtrOld, GCPtrNew));
 
             /*
@@ -411,9 +414,11 @@ VMMR3DECL(int) MMR3LockCall(PVM pVM)
  * @param   pszDesc     Description.
  * @param   pGCPtr      Where to store the GC address.
  */
-VMMR3DECL(int) MMR3HyperMapHCPhys(PVM pVM, void *pvR3, RTR0PTR pvR0, RTHCPHYS HCPhys, size_t cb, const char *pszDesc, PRTGCPTR pGCPtr)
+VMMR3DECL(int) MMR3HyperMapHCPhys(PVM pVM, void *pvR3, RTR0PTR pvR0, RTHCPHYS HCPhys, size_t cb,
+                                  const char *pszDesc, PRTGCPTR pGCPtr)
 {
-    LogFlow(("MMR3HyperMapHCPhys: pvR3=%p pvR0=%p HCPhys=%RHp cb=%d pszDesc=%p:{%s} pGCPtr=%p\n", pvR3, pvR0, HCPhys, (int)cb, pszDesc, pszDesc, pGCPtr));
+    LogFlow(("MMR3HyperMapHCPhys: pvR3=%p pvR0=%p HCPhys=%RHp cb=%d pszDesc=%p:{%s} pGCPtr=%p\n",
+             pvR3, pvR0, HCPhys, (int)cb, pszDesc, pszDesc, pGCPtr));
 
     /*
      * Validate input.
@@ -613,7 +618,8 @@ VMMR3DECL(int) MMR3HyperMapMMIO2(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion,
  * @param   pszDesc     Mapping description.
  * @param   pGCPtr      Where to store the GC address corresponding to pvR3.
  */
-VMMR3DECL(int) MMR3HyperMapPages(PVM pVM, void *pvR3, RTR0PTR pvR0, size_t cPages, PCSUPPAGE paPages, const char *pszDesc, PRTGCPTR pGCPtr)
+VMMR3DECL(int) MMR3HyperMapPages(PVM pVM, void *pvR3, RTR0PTR pvR0, size_t cPages, PCSUPPAGE paPages,
+                                 const char *pszDesc, PRTGCPTR pGCPtr)
 {
     LogFlow(("MMR3HyperMapPages: pvR3=%p pvR0=%p cPages=%zu paPages=%p pszDesc=%p:{%s} pGCPtr=%p\n",
              pvR3, pvR0, cPages, paPages, pszDesc, pszDesc, pGCPtr));
@@ -645,7 +651,9 @@ VMMR3DECL(int) MMR3HyperMapPages(PVM pVM, void *pvR3, RTR0PTR pvR0, size_t cPage
         {
             for (size_t i = 0; i < cPages; i++)
             {
-                AssertReleaseMsgReturn(paPages[i].Phys != 0 && paPages[i].Phys != NIL_RTHCPHYS && !(paPages[i].Phys & PAGE_OFFSET_MASK),
+                AssertReleaseMsgReturn(   paPages[i].Phys != 0
+                                       && paPages[i].Phys != NIL_RTHCPHYS
+                                       && !(paPages[i].Phys & PAGE_OFFSET_MASK),
                                        ("i=%#zx Phys=%RHp %s\n", i, paPages[i].Phys, pszDesc),
                                        VERR_INTERNAL_ERROR);
                 paHCPhysPages[i] = paPages[i].Phys;
@@ -807,7 +815,7 @@ static int mmR3HyperHeapCreate(PVM pVM, const size_t cb, PMMHYPERHEAP *ppHeap, P
     int rc = SUPR3PageAllocEx(cPages,
                               0 /*fFlags*/,
                               &pv,
-#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
+#if defined(VBOX_WITH_2X_4GB_ADDR_SPACE) || defined(VBOX_WITH_MORE_RING0_MEM_MAPPINGS)
                               &pvR0,
 #else
                               NULL,
@@ -815,7 +823,7 @@ static int mmR3HyperHeapCreate(PVM pVM, const size_t cb, PMMHYPERHEAP *ppHeap, P
                               paPages);
     if (RT_SUCCESS(rc))
     {
-#ifndef VBOX_WITH_2X_4GB_ADDR_SPACE
+#if !defined(VBOX_WITH_2X_4GB_ADDR_SPACE) && !defined(VBOX_WITH_MORE_RING0_MEM_MAPPINGS)
         pvR0 = (uintptr_t)pv;
 #endif
         memset(pv, 0, cbAligned);
@@ -1003,15 +1011,23 @@ VMMR3DECL(int) MMR3HyperAllocOnceNoRelEx(PVM pVM, size_t cb, unsigned uAlignment
     int rc = SUPR3PageAllocEx(cPages,
                               0 /*fFlags*/,
                               &pvPages,
+#ifdef VBOX_WITH_MORE_RING0_MEM_MAPPINGS
+                              &pvR0,
+#else
                               fFlags & MMHYPER_AONR_FLAGS_KERNEL_MAPPING ? &pvR0 : NULL,
+#endif
                               paPages);
     if (RT_SUCCESS(rc))
     {
+#ifdef VBOX_WITH_MORE_RING0_MEM_MAPPINGS
+        Assert(pvR0 != NIL_RTR0PTR);
+#else
         if (!(fFlags & MMHYPER_AONR_FLAGS_KERNEL_MAPPING))
-#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
+# ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
             pvR0 = NIL_RTR0PTR;
-#else
+# else
             pvR0 = (RTR0PTR)pvPages;
+# endif
 #endif
 
         memset(pvPages, 0, cbAligned);
@@ -1427,3 +1443,63 @@ static DECLCALLBACK(void) mmR3HyperInfoHma(PVM pVM, PCDBGFINFOHLP pHlp, const ch
         pLookup = (PMMLOOKUPHYPER)((uint8_t *)pLookup + pLookup->offNext);
     }
 }
+
+
+/**
+ * Re-allocates memory from the hyper heap.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pvOld           The existing block of memory in the hyper heap to
+ *                          re-allocate (can be NULL).
+ * @param   cbOld           Size of the existing block.
+ * @param   uAlignmentNew   Required memory alignment in bytes. Values are
+ *                          0,8,16,32 and PAGE_SIZE. 0 -> default alignment,
+ *                          i.e. 8 bytes.
+ * @param   enmTagNew       The statistics tag.
+ * @param   cbNew           The required size of the new block.
+ * @param   ppv             Where to store the address to the re-allocated
+ *                          block.
+ *
+ * @remarks This does not work like normal realloc() on failure, the memory
+ *          pointed to by @a pvOld is lost if there isn't sufficient space on
+ *          the hyper heap for the re-allocation to succeed.
+*/
+VMMR3DECL(int) MMR3HyperRealloc(PVM pVM, void *pvOld, size_t cbOld, unsigned uAlignmentNew, MMTAG enmTagNew, size_t cbNew,
+                                void **ppv)
+{
+    if (!pvOld)
+        return MMHyperAlloc(pVM, cbNew, uAlignmentNew, enmTagNew, ppv);
+
+    if (!cbNew && pvOld)
+        return MMHyperFree(pVM, pvOld);
+
+    if (cbOld == cbNew)
+        return VINF_SUCCESS;
+
+    size_t cbData = RT_MIN(cbNew, cbOld);
+    void *pvTmp = RTMemTmpAlloc(cbData);
+    if (RT_UNLIKELY(!pvTmp))
+    {
+        MMHyperFree(pVM, pvOld);
+        return VERR_NO_TMP_MEMORY;
+    }
+    memcpy(pvTmp, pvOld, cbData);
+
+    int rc = MMHyperFree(pVM, pvOld);
+    if (RT_SUCCESS(rc))
+    {
+        rc = MMHyperAlloc(pVM, cbNew, uAlignmentNew, enmTagNew, ppv);
+        if (RT_SUCCESS(rc))
+        {
+            Assert(cbData <= cbNew);
+            memcpy(*ppv, pvTmp, cbData);
+        }
+    }
+    else
+        AssertMsgFailed(("Failed to free hyper heap block pvOld=%p cbOld=%u\n", pvOld, cbOld));
+
+    RTMemTmpFree(pvTmp);
+    return rc;
+}
+
diff --git a/src/VBox/VMM/VMMR3/MMPagePool.cpp b/src/VBox/VMM/VMMR3/MMPagePool.cpp
index 6716e75..44b9b0c 100644
--- a/src/VBox/VMM/VMMR3/MMPagePool.cpp
+++ b/src/VBox/VMM/VMMR3/MMPagePool.cpp
@@ -62,7 +62,7 @@ int mmR3PagePoolInit(PVM pVM)
      * Allocate the pool structures.
      */
     /** @todo @bufref{1865}, at bufref{3202}: mapping the page pool page into
-     *        ring-0. Need to change the wasy we allocate it... */
+     *        ring-0. Need to change the ways we allocate it... */
     AssertReleaseReturn(sizeof(*pVM->mm.s.pPagePoolR3) + sizeof(*pVM->mm.s.pPagePoolLowR3) < PAGE_SIZE, VERR_INTERNAL_ERROR);
     int rc = SUPR3PageAllocEx(1, 0 /*fFlags*/, (void **)&pVM->mm.s.pPagePoolR3, NULL /*pR0Ptr*/, NULL /*paPages*/);
     if (RT_FAILURE(rc))
diff --git a/src/VBox/VMM/VMMR3/PATM.cpp b/src/VBox/VMM/VMMR3/PATM.cpp
index 6477371..26b5481 100644
--- a/src/VBox/VMM/VMMR3/PATM.cpp
+++ b/src/VBox/VMM/VMMR3/PATM.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -23,6 +23,7 @@
 #define LOG_GROUP LOG_GROUP_PATM
 #include <VBox/vmm/patm.h>
 #include <VBox/vmm/stam.h>
+#include <VBox/vmm/pdmapi.h>
 #include <VBox/vmm/pgm.h>
 #include <VBox/vmm/cpum.h>
 #include <VBox/vmm/cpumdis.h>
@@ -90,6 +91,7 @@ typedef struct
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
+static FNPGMR3VIRTHANDLER patmR3VirtPageHandler;
 
 static int          patmDisableUnusablePatch(PVM pVM, RTRCPTR pInstrGC, RTRCPTR pConflictAddr, PPATCHINFO pPatch);
 static int          patmActivateInt3Patch(PVM pVM, PPATCHINFO pPatch);
@@ -108,7 +110,7 @@ static void         patmPrintStat(PVM pVM, void *pvSample, char *pszBuf, size_t
 #define             patmPatchGCPtr2PatchHCPtr(pVM, pGC)      (pVM->patm.s.pPatchMemHC + (pGC - pVM->patm.s.pPatchMemGC))
 
 static int               patmReinit(PVM pVM);
-static DECLCALLBACK(int) RelocatePatches(PAVLOU32NODECORE pNode, void *pParam);
+static DECLCALLBACK(int) patmR3RelocatePatches(PAVLOU32NODECORE pNode, void *pParam);
 static RTRCPTR      patmR3GuestGCPtrToPatchGCPtrSimple(PVM pVM, RCPTRTYPE(uint8_t*) pInstrGC);
 static int          patmR3MarkDirtyPatch(PVM pVM, PPATCHINFO pPatch);
 
@@ -159,8 +161,8 @@ VMMR3_INT_DECL(int) PATMR3Init(PVM pVM)
     AssertCompile(VMCPU_FF_INTERRUPT_APIC == RT_BIT_32(0));
     AssertCompile(VMCPU_FF_INTERRUPT_PIC == RT_BIT_32(1));
 
-    AssertReleaseMsg(PATMInterruptFlag == (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST),
-                     ("Interrupt flags out of sync!! PATMInterruptFlag=%#x expected %#x. broken assembler?\n", PATMInterruptFlag, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST));
+    AssertReleaseMsg(g_fPatmInterruptFlag == (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST),
+                     ("Interrupt flags out of sync!! g_fPatmInterruptFlag=%#x expected %#x. broken assembler?\n", g_fPatmInterruptFlag, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST));
 
     /* Allocate patch memory and GC patch state memory. */
     pVM->patm.s.cbPatchMem = PATCH_MEMORY_SIZE;
@@ -217,9 +219,19 @@ VMMR3_INT_DECL(int) PATMR3Init(PVM pVM)
         return rc;
 
     /*
+     * Register the virtual page access handler type.
+     */
+    rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_ALL, false /*fRelocUserRC*/,
+                                         NULL /*pfnInvalidateR3*/,
+                                         patmR3VirtPageHandler,
+                                         "patmRCVirtPagePfHandler",
+                                         "PATMMonitorPatchJump", &pVM->patm.s.hMonitorPageType);
+    AssertRCReturn(rc, rc);
+
+    /*
      * Register save and load state notifiers.
      */
-    rc = SSMR3RegisterInternal(pVM, "PATM", 0, PATM_SSM_VERSION, sizeof(pVM->patm.s) + PATCH_MEMORY_SIZE  + PAGE_SIZE + PATM_STACK_TOTAL_SIZE + PAGE_SIZE,
+    rc = SSMR3RegisterInternal(pVM, "PATM", 0, PATM_SAVED_STATE_VERSION, sizeof(pVM->patm.s) + PATCH_MEMORY_SIZE  + PAGE_SIZE + PATM_STACK_TOTAL_SIZE + PAGE_SIZE,
                                NULL, NULL, NULL,
                                NULL, patmR3Save, NULL,
                                NULL, patmR3Load, NULL);
@@ -307,14 +319,14 @@ VMMR3_INT_DECL(int) PATMR3Init(PVM pVM)
     STAM_REG(pVM, &pVM->patm.s.StatCheckPendingIRQ,   STAMTYPE_COUNTER, "/PATM/GC/CheckIRQ" ,        STAMUNIT_OCCURENCES,     "Number of traps that ask to check for pending irqs.");
 #endif /* VBOX_WITH_STATISTICS */
 
-    Log(("PATMCallRecord.size           %d\n", PATMCallRecord.size));
-    Log(("PATMCallIndirectRecord.size   %d\n", PATMCallIndirectRecord.size));
-    Log(("PATMRetRecord.size            %d\n", PATMRetRecord.size));
-    Log(("PATMJumpIndirectRecord.size   %d\n", PATMJumpIndirectRecord.size));
-    Log(("PATMPopf32Record.size         %d\n", PATMPopf32Record.size));
-    Log(("PATMIretRecord.size           %d\n", PATMIretRecord.size));
-    Log(("PATMStiRecord.size            %d\n", PATMStiRecord.size));
-    Log(("PATMCheckIFRecord.size        %d\n", PATMCheckIFRecord.size));
+    Log(("g_patmCallRecord.cbFunction           %u\n", g_patmCallRecord.cbFunction));
+    Log(("g_patmCallIndirectRecord.cbFunction   %u\n", g_patmCallIndirectRecord.cbFunction));
+    Log(("g_patmRetRecord.cbFunction            %u\n", g_patmRetRecord.cbFunction));
+    Log(("g_patmJumpIndirectRecord.cbFunction   %u\n", g_patmJumpIndirectRecord.cbFunction));
+    Log(("g_patmPopf32Record.cbFunction         %u\n", g_patmPopf32Record.cbFunction));
+    Log(("g_patmIretRecord.cbFunction           %u\n", g_patmIretRecord.cbFunction));
+    Log(("g_patmStiRecord.cbFunction            %u\n", g_patmStiRecord.cbFunction));
+    Log(("g_patmCheckIFRecord.cbFunction        %u\n", g_patmCheckIFRecord.cbFunction));
 
     return rc;
 }
@@ -330,20 +342,44 @@ VMMR3_INT_DECL(int) PATMR3InitFinalize(PVM pVM)
     if (HMIsEnabled(pVM))
         return VINF_SUCCESS;
 
-    /* The GC state, stack and statistics must be read/write for the guest (supervisor only of course). */
+    /*
+     * The GC state, stack and statistics must be read/write for the guest
+     * (supervisor only of course).
+     *
+     * Remember, we run guest code at ring-1 and ring-2 levels, which are
+     * considered supervisor levels by the paging  structures.  We run the VMM
+     * in ring-0 with CR0.WP=0 and mapping all VMM structures as read-only
+     * pages.  The following structures are exceptions and must be mapped with
+     * write access so the ring-1 and ring-2 code can modify them.
+     */
     int rc = PGMMapSetPage(pVM, pVM->patm.s.pGCStateGC, PAGE_SIZE, X86_PTE_P | X86_PTE_A | X86_PTE_D | X86_PTE_RW);
-    if (RT_FAILURE(rc))
-        Log(("PATMR3InitFinalize: PGMMapSetPage failed with %Rrc!!\n", rc));
+    AssertLogRelMsgReturn(RT_SUCCESS(rc), ("Failed to make the GCState accessible to ring-1 and ring-2 code: %Rrc\n", rc), rc);
 
     rc = PGMMapSetPage(pVM, pVM->patm.s.pGCStackGC, PATM_STACK_TOTAL_SIZE, X86_PTE_P | X86_PTE_A | X86_PTE_D | X86_PTE_RW);
-    if (RT_FAILURE(rc))
-        Log(("PATMR3InitFinalize: PGMMapSetPage failed with %Rrc!!\n", rc));
+    AssertLogRelMsgReturn(RT_SUCCESS(rc), ("Failed to make the GCStack accessible to ring-1 and ring-2 code: %Rrc\n", rc), rc);
 
     rc = PGMMapSetPage(pVM, pVM->patm.s.pStatsGC, PATM_STAT_MEMSIZE, X86_PTE_P | X86_PTE_A | X86_PTE_D | X86_PTE_RW);
-    if (RT_FAILURE(rc))
-        Log(("PATMR3InitFinalize: PGMMapSetPage failed with %Rrc!!\n", rc));
+    AssertLogRelMsgReturn(RT_SUCCESS(rc), ("Failed to make the stats struct accessible to ring-1 and ring-2 code: %Rrc\n", rc), rc);
 
-    return rc;
+    /*
+     * Find the patch helper segment so we can identify code running there as patch code.
+     */
+    rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_PatchHlpBegin", &pVM->patm.s.pbPatchHelpersRC);
+    AssertLogRelMsgReturn(RT_SUCCESS(rc), ("Failed to resolve g_PatchHlpBegin: %Rrc\n", rc), rc);
+    pVM->patm.s.pbPatchHelpersR3 = (uint8_t *)MMHyperRCToR3(pVM, pVM->patm.s.pbPatchHelpersRC);
+    AssertLogRelReturn(pVM->patm.s.pbPatchHelpersR3 != NULL, VERR_INTERNAL_ERROR_3);
+
+    RTRCPTR RCPtrEnd;
+    rc = PDMR3LdrGetSymbolRC(pVM, NULL, "g_PatchHlpEnd", &RCPtrEnd);
+    AssertLogRelMsgReturn(RT_SUCCESS(rc), ("Failed to resolve g_PatchHlpEnd: %Rrc\n", rc), rc);
+
+    pVM->patm.s.cbPatchHelpers = RCPtrEnd - pVM->patm.s.pbPatchHelpersRC;
+    AssertLogRelMsgReturn(pVM->patm.s.cbPatchHelpers < _128K,
+                          ("%RRv-%RRv => %#x\n", pVM->patm.s.pbPatchHelpersRC, RCPtrEnd, pVM->patm.s.cbPatchHelpers),
+                          VERR_INTERNAL_ERROR_4);
+
+
+    return VINF_SUCCESS;
 }
 
 /**
@@ -459,53 +495,51 @@ static int patmReinit(PVM pVM)
  *
  * The PATM will update the addresses used by the switcher.
  *
- * @param   pVM     The VM.
+ * @param   pVM         The VM.
+ * @param   offDelta    The relocation delta.
  */
-VMMR3_INT_DECL(void) PATMR3Relocate(PVM pVM)
+VMMR3_INT_DECL(void) PATMR3Relocate(PVM pVM, RTRCINTPTR offDelta)
 {
     if (HMIsEnabled(pVM))
         return;
 
     RTRCPTR     GCPtrNew = MMHyperR3ToRC(pVM, pVM->patm.s.pGCStateHC);
-    RTRCINTPTR  delta = GCPtrNew - pVM->patm.s.pGCStateGC;
+    Assert((RTRCINTPTR)(GCPtrNew - pVM->patm.s.pGCStateGC) == offDelta);
 
-    Log(("PATMR3Relocate from %RRv to %RRv - delta %08X\n", pVM->patm.s.pGCStateGC, GCPtrNew, delta));
-    if (delta)
+    Log(("PATMR3Relocate from %RRv to %RRv - delta %08X\n", pVM->patm.s.pGCStateGC, GCPtrNew, offDelta));
+    if (offDelta)
     {
         PCPUMCTX pCtx;
 
         /* Update CPUMCTX guest context pointer. */
-        pVM->patm.s.pCPUMCtxGC   += delta;
+        pVM->patm.s.pCPUMCtxGC += offDelta;
 
-        pVM->patm.s.deltaReloc = delta;
+        pVM->patm.s.deltaReloc = offDelta;
+        RTAvloU32DoWithAll(&pVM->patm.s.PatchLookupTreeHC->PatchTree, true, patmR3RelocatePatches, (void *)pVM);
 
-        RTAvloU32DoWithAll(&pVM->patm.s.PatchLookupTreeHC->PatchTree, true, RelocatePatches, (void *)pVM);
+        pVM->patm.s.pGCStateGC        = GCPtrNew;
+        pVM->patm.s.pPatchMemGC       = MMHyperR3ToRC(pVM, pVM->patm.s.pPatchMemHC);
+        pVM->patm.s.pGCStackGC        = MMHyperR3ToRC(pVM, pVM->patm.s.pGCStackHC);
+        pVM->patm.s.pStatsGC          = MMHyperR3ToRC(pVM, pVM->patm.s.pStatsHC);
+        pVM->patm.s.PatchLookupTreeGC = MMHyperR3ToRC(pVM, pVM->patm.s.PatchLookupTreeHC);
 
-        pCtx = CPUMQueryGuestCtxPtr(VMMGetCpu(pVM));
+        if (pVM->patm.s.pfnSysEnterPatchGC)
+            pVM->patm.s.pfnSysEnterPatchGC += offDelta;
 
         /* If we are running patch code right now, then also adjust EIP. */
+        pCtx = CPUMQueryGuestCtxPtr(VMMGetCpu(pVM));
         if (PATMIsPatchGCAddr(pVM, pCtx->eip))
-            pCtx->eip += delta;
-
-        pVM->patm.s.pGCStateGC  = GCPtrNew;
-        pVM->patm.s.pPatchMemGC = MMHyperR3ToRC(pVM, pVM->patm.s.pPatchMemHC);
-
-        pVM->patm.s.pGCStackGC  = MMHyperR3ToRC(pVM, pVM->patm.s.pGCStackHC);
-
-        pVM->patm.s.pStatsGC    = MMHyperR3ToRC(pVM, pVM->patm.s.pStatsHC);
-
-        pVM->patm.s.PatchLookupTreeGC = MMHyperR3ToRC(pVM, pVM->patm.s.PatchLookupTreeHC);
-
-        if (pVM->patm.s.pfnSysEnterPatchGC)
-            pVM->patm.s.pfnSysEnterPatchGC += delta;
+            pCtx->eip += offDelta;
 
         /* Deal with the global patch functions. */
-        pVM->patm.s.pfnHelperCallGC += delta;
-        pVM->patm.s.pfnHelperRetGC  += delta;
-        pVM->patm.s.pfnHelperIretGC += delta;
-        pVM->patm.s.pfnHelperJumpGC += delta;
+        pVM->patm.s.pfnHelperCallGC += offDelta;
+        pVM->patm.s.pfnHelperRetGC  += offDelta;
+        pVM->patm.s.pfnHelperIretGC += offDelta;
+        pVM->patm.s.pfnHelperJumpGC += offDelta;
+
+        pVM->patm.s.pbPatchHelpersRC += offDelta;
 
-        RelocatePatches(&pVM->patm.s.pGlobalPatchRec->Core, (void *)pVM);
+        patmR3RelocatePatches(&pVM->patm.s.pGlobalPatchRec->Core, (void *)pVM);
     }
 }
 
@@ -729,7 +763,7 @@ static void patmLogRawPatchInstr(PVM pVM, PPATCHINFO pPatch, uint32_t fFlags,
  * @param   pNode       Current node
  * @param   pParam      Pointer to the VM.
  */
-static DECLCALLBACK(int) RelocatePatches(PAVLOU32NODECORE pNode, void *pParam)
+static DECLCALLBACK(int) patmR3RelocatePatches(PAVLOU32NODECORE pNode, void *pParam)
 {
     PPATMPATCHREC   pPatch = (PPATMPATCHREC)pNode;
     PVM             pVM = (PVM)pParam;
@@ -747,22 +781,26 @@ static DECLCALLBACK(int) RelocatePatches(PAVLOU32NODECORE pNode, void *pParam)
     delta = (RTRCINTPTR)pVM->patm.s.deltaReloc;
 
     /*
-     * Apply fixups
+     * Apply fixups.
      */
-    PRELOCREC pRec = 0;
-    AVLPVKEY  key  = 0;
-
-    while (true)
+    AVLPVKEY key = NULL;
+    for (;;)
     {
-        /* Get the record that's closest from above */
-        pRec = (PRELOCREC)RTAvlPVGetBestFit(&pPatch->patch.FixupTree, key, true);
-        if (pRec == 0)
+        /* Get the record that's closest from above (after or equal to key). */
+        PRELOCREC pRec = (PRELOCREC)RTAvlPVGetBestFit(&pPatch->patch.FixupTree, key, true);
+        if (!pRec)
             break;
 
-        key = (AVLPVKEY)(pRec->pRelocPos + 1);   /* search for the next record during the next round. */
+        key = (uint8_t *)pRec->Core.Key + 1;   /* search for the next record during the next round. */
 
         switch (pRec->uType)
         {
+        case FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL:
+            Assert(pRec->pDest == pRec->pSource); Assert(PATM_IS_ASMFIX(pRec->pSource));
+            Log(("Absolute patch template fixup type %#x at %RHv -> %RHv at %RRv\n", pRec->pSource, *(RTRCUINTPTR *)pRec->pRelocPos, *(RTRCINTPTR*)pRec->pRelocPos + delta, pRec->pRelocPos));
+            *(RTRCUINTPTR *)pRec->pRelocPos += delta;
+            break;
+
         case FIXUP_ABSOLUTE:
             Log(("Absolute fixup at %RRv %RHv -> %RHv at %RRv\n", pRec->pSource, *(RTRCUINTPTR *)pRec->pRelocPos, *(RTRCINTPTR*)pRec->pRelocPos + delta, pRec->pRelocPos));
             if (    !pRec->pSource
@@ -792,7 +830,10 @@ static DECLCALLBACK(int) RelocatePatches(PAVLOU32NODECORE pNode, void *pParam)
                     RTRCPTR pPage = pPatch->patch.pPrivInstrGC & PAGE_BASE_GC_MASK;
 
                     Log(("PATM: Patch page not present -> check later!\n"));
-                    rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_ALL, pPage, pPage + (PAGE_SIZE - 1) /* inclusive! */, 0, patmVirtPageHandler, "PATMGCMonitorPage", 0, "PATMMonitorPatchJump");
+                    rc = PGMR3HandlerVirtualRegister(pVM, VMMGetCpu(pVM), pVM->patm.s.hMonitorPageType,
+                                                     pPage,
+                                                     pPage + (PAGE_SIZE - 1) /* inclusive! */,
+                                                     (void *)(uintptr_t)pPage, pPage, NULL /*pszDesc*/);
                     Assert(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT);
                 }
                 else
@@ -870,8 +911,11 @@ static DECLCALLBACK(int) RelocatePatches(PAVLOU32NODECORE pNode, void *pParam)
                     ||  rc == VERR_PAGE_TABLE_NOT_PRESENT)
                 {
                     RTRCPTR pPage = pPatch->patch.pPrivInstrGC & PAGE_BASE_GC_MASK;
-
-                    rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_ALL, pPage, pPage + (PAGE_SIZE - 1) /* inclusive! */, 0, patmVirtPageHandler, "PATMGCMonitorPage", 0, "PATMMonitorPatchJump");
+                    Log(("PATM: Patch page not present -> check later!\n"));
+                    rc = PGMR3HandlerVirtualRegister(pVM, VMMGetCpu(pVM), pVM->patm.s.hMonitorPageType,
+                                                     pPage,
+                                                     pPage + (PAGE_SIZE - 1) /* inclusive! */,
+                                                     (void *)(uintptr_t)pPage, pPage, NULL /*pszDesc*/);
                     Assert(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT);
                 }
                 else
@@ -912,6 +956,13 @@ static DECLCALLBACK(int) RelocatePatches(PAVLOU32NODECORE pNode, void *pParam)
             break;
         }
 
+        case FIXUP_REL_HELPER_IN_PATCH_ASM_TMPL:
+        case FIXUP_CONSTANT_IN_PATCH_ASM_TMPL:
+            /* Only applicable when loading state. */
+            Assert(pRec->pDest == pRec->pSource);
+            Assert(PATM_IS_ASMFIX(pRec->pSource));
+            break;
+
         default:
             AssertMsg(0, ("Invalid fixup type!!\n"));
             return VERR_INVALID_PARAMETER;
@@ -932,18 +983,21 @@ static DECLCALLBACK(int) RelocatePatches(PAVLOU32NODECORE pNode, void *pParam)
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPtr           The virtual address the guest is writing to. (not correct if it's an alias!)
  * @param   pvPtr           The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
- * @param   pvUser          User argument.
+ * @param   enmOrigin       Who is making this write.
+ * @param   pvUser          The address of the guest page we're monitoring.
  */
-DECLCALLBACK(int) patmVirtPageHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
-                                      PGMACCESSTYPE enmAccessType, void *pvUser)
+static DECLCALLBACK(int) patmR3VirtPageHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
+                                               PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType);
-    NOREF(pvPtr); NOREF(pvBuf); NOREF(cbBuf); NOREF(pvUser);
+    NOREF(pVCpu); NOREF(pvPtr); NOREF(pvBuf); NOREF(cbBuf); NOREF(enmOrigin); NOREF(pvUser);
 
     /** @todo could be the wrong virtual address (alias) */
     pVM->patm.s.pvFaultMonitor = GCPtr;
@@ -989,41 +1043,6 @@ static DECLCALLBACK(int) DisableAllPatches(PAVLOU32NODECORE pNode, void *pVM)
 }
 
 #endif /* VBOX_WITH_DEBUGGER */
-#ifdef UNUSED_FUNCTIONS
-
-/**
- * Returns the host context pointer and size of the patch memory block
- *
- * @returns Host context pointer.
- * @param   pVM         Pointer to the VM.
- * @param   pcb         Size of the patch memory block
- * @internal
- */
-VMMR3_INT_DECL(void *) PATMR3QueryPatchMemHC(PVM pVM, uint32_t *pcb)
-{
-    AssertReturn(!HMIsEnabled(pVM), NULL);
-    if (pcb)
-        *pcb = pVM->patm.s.cbPatchMem;
-    return pVM->patm.s.pPatchMemHC;
-}
-
-
-/**
- * Returns the guest context pointer and size of the patch memory block
- *
- * @returns Guest context pointer.
- * @param   pVM         Pointer to the VM.
- * @param   pcb         Size of the patch memory block
- */
-VMMR3_INT_DECL(RTRCPTR) PATMR3QueryPatchMemGC(PVM pVM, uint32_t *pcb)
-{
-    AssertReturn(!HMIsEnabled(pVM), NIL_RTRCPTR);
-    if (pcb)
-        *pcb = pVM->patm.s.cbPatchMem;
-    return pVM->patm.s.pPatchMemGC;
-}
-
-#endif /* UNUSED_FUNCTIONS */
 
 /**
  * Returns the host context pointer of the GC context structure
@@ -1038,22 +1057,6 @@ VMMR3_INT_DECL(PPATMGCSTATE) PATMR3QueryGCStateHC(PVM pVM)
 }
 
 
-#ifdef UNUSED_FUNCTION
-/**
- * Checks whether the HC address is part of our patch region
- *
- * @returns true/false.
- * @param   pVM         Pointer to the VM.
- * @param   pAddrHC     Host context ring-3 address to check.
- */
-VMMR3_INT_DECL(bool) PATMR3IsPatchHCAddr(PVM pVM, void *pAddrHC)
-{
-    return (uintptr_t)pAddrHC >= (uintptr_t)pVM->patm.s.pPatchMemHC
-        && (uintptr_t)pAddrHC <  (uintptr_t)pVM->patm.s.pPatchMemHC + pVM->patm.s.cbPatchMem;
-}
-#endif
-
-
 /**
  * Allows or disallow patching of privileged instructions executed by the guest OS
  *
@@ -1100,9 +1103,15 @@ VMMR3DECL(bool) PATMR3IsEnabled(PUVM pUVM)
 VMMR3_INT_DECL(void *) PATMR3GCPtrToHCPtr(PVM pVM, RTRCPTR pAddrGC)
 {
     AssertReturn(!HMIsEnabled(pVM), NULL);
-    if (pVM->patm.s.pPatchMemGC <= pAddrGC && pVM->patm.s.pPatchMemGC + pVM->patm.s.cbPatchMem > pAddrGC)
-        return pVM->patm.s.pPatchMemHC + (pAddrGC - pVM->patm.s.pPatchMemGC);
-    return NULL;
+    RTRCUINTPTR offPatch = (RTRCUINTPTR)pAddrGC - (RTRCUINTPTR)pVM->patm.s.pPatchMemGC;
+    if (offPatch >= pVM->patm.s.cbPatchMem)
+    {
+        offPatch = (RTRCUINTPTR)pAddrGC - (RTRCUINTPTR)pVM->patm.s.pbPatchHelpersRC;
+        if (offPatch >= pVM->patm.s.cbPatchHelpers)
+            return NULL;
+        return pVM->patm.s.pbPatchHelpersR3 + offPatch;
+    }
+    return pVM->patm.s.pPatchMemHC + offPatch;
 }
 
 
@@ -1123,12 +1132,16 @@ R3PTRTYPE(uint8_t *) patmR3GCVirtToHCVirt(PVM pVM, PPATMP2GLOOKUPREC pCacheRec,
     R3PTRTYPE(uint8_t *) pHCPtr;
     uint32_t offset;
 
-    if (PATMIsPatchGCAddr(pVM, pGCPtr))
+    offset = (RTRCUINTPTR)pGCPtr - (RTRCUINTPTR)pVM->patm.s.pPatchMemGC;
+    if (offset < pVM->patm.s.cbPatchMem)
     {
+#ifdef VBOX_STRICT
         PPATCHINFO pPatch = (PPATCHINFO)pCacheRec->pPatch;
-        Assert(pPatch);
-        return PATCHCODE_PTR_HC(pPatch) + (pGCPtr - PATCHCODE_PTR_GC(pPatch));
+        Assert(pPatch); Assert(offset - pPatch->pPatchBlockOffset < pPatch->cbPatchBlockSize);
+#endif
+        return pVM->patm.s.pPatchMemHC + offset;
     }
+    /* Note! We're _not_ including the patch helpers here. */
 
     offset = pGCPtr & PAGE_OFFSET_MASK;
     if (pCacheRec->pGuestLoc == (pGCPtr & PAGE_BASE_GC_MASK))
@@ -2647,7 +2660,8 @@ static int patmGenJumpToPatch(PVM pVM, PPATCHINFO pPatch, PPATMP2GLOOKUPREC pCac
             // jmp [PatchCode]
             if (fAddFixup)
             {
-                if (patmPatchAddReloc32(pVM, pPatch, &pPB[1], FIXUP_REL_JMPTOPATCH, pPatch->pPrivInstrGC + pPatch->cbPatchJump, pPatch->pPatchJumpDestGC) != VINF_SUCCESS)
+                if (patmPatchAddReloc32(pVM, pPatch, &pPB[1], FIXUP_REL_JMPTOPATCH, pPatch->pPrivInstrGC + pPatch->cbPatchJump,
+                                        pPatch->pPatchJumpDestGC) != VINF_SUCCESS)
                 {
                     Log(("Relocation failed for the jump in the guest code!!\n"));
                     return VERR_PATCHING_REFUSED;
@@ -2663,7 +2677,8 @@ static int patmGenJumpToPatch(PVM pVM, PPATCHINFO pPatch, PPATMP2GLOOKUPREC pCac
             // jmp [PatchCode]
             if (fAddFixup)
             {
-                if (patmPatchAddReloc32(pVM, pPatch, &pPB[2], FIXUP_REL_JMPTOPATCH, pPatch->pPrivInstrGC + pPatch->cbPatchJump, pPatch->pPatchJumpDestGC) != VINF_SUCCESS)
+                if (patmPatchAddReloc32(pVM, pPatch, &pPB[2], FIXUP_REL_JMPTOPATCH, pPatch->pPrivInstrGC + pPatch->cbPatchJump,
+                                        pPatch->pPatchJumpDestGC) != VINF_SUCCESS)
                 {
                     Log(("Relocation failed for the jump in the guest code!!\n"));
                     return VERR_PATCHING_REFUSED;
@@ -2688,7 +2703,8 @@ static int patmGenJumpToPatch(PVM pVM, PPATCHINFO pPatch, PPATMP2GLOOKUPREC pCac
         // jmp [PatchCode]
         if (fAddFixup)
         {
-            if (patmPatchAddReloc32(pVM, pPatch, &pPB[1], FIXUP_REL_JMPTOPATCH, pPatch->pPrivInstrGC + SIZEOF_NEARJUMP32, PATCHCODE_PTR_GC(pPatch)) != VINF_SUCCESS)
+            if (patmPatchAddReloc32(pVM, pPatch, &pPB[1], FIXUP_REL_JMPTOPATCH, pPatch->pPrivInstrGC + SIZEOF_NEARJUMP32,
+                                    PATCHCODE_PTR_GC(pPatch)) != VINF_SUCCESS)
             {
                 Log(("Relocation failed for the jump in the guest code!!\n"));
                 return VERR_PATCHING_REFUSED;
@@ -2782,7 +2798,8 @@ static int patmGenCallToPatch(PVM pVM, PPATCHINFO pPatch, RTRCPTR pTargetGC, PPA
     // jmp [PatchCode]
     if (fAddFixup)
     {
-        if (patmPatchAddReloc32(pVM, pPatch, &pPB[1], FIXUP_REL_JMPTOPATCH, pPatch->pPrivInstrGC + SIZEOF_NEARJUMP32, pTargetGC) != VINF_SUCCESS)
+        if (patmPatchAddReloc32(pVM, pPatch, &pPB[1], FIXUP_REL_JMPTOPATCH,
+                                pPatch->pPrivInstrGC + SIZEOF_NEARJUMP32, pTargetGC) != VINF_SUCCESS)
         {
             Log(("Relocation failed for the jump in the guest code!!\n"));
             return VERR_PATCHING_REFUSED;
@@ -3610,7 +3627,7 @@ VMMR3_INT_DECL(int) PATMR3DuplicateFunctionRequest(PVM pVM, PCPUMCTX pCtx)
 
     if (pPatchTargetGC)
     {
-        /* Create a trampoline that also sets PATM_INTERRUPTFLAG. */
+        /* Create a trampoline that also sets PATM_ASMFIX_INTERRUPTFLAG. */
         rc = PATMR3InstallPatch(pVM, pBranchTarget, PATMFL_CODE32 | PATMFL_TRAMPOLINE);
     }
     else
@@ -4575,21 +4592,22 @@ VMMR3_INT_DECL(int) PATMR3InstallPatch(PVM pVM, RTRCPTR pInstrGC, uint64_t flags
 #ifndef DEBUG_sandervl
             /* Full breakdown for the GUI. */
             STAMR3RegisterF(pVM, &pVM->patm.s.pStatsHC[pPatchRec->patch.uPatchIdx], STAMTYPE_RATIO_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_GOOD_BAD, PATMPatchType(pVM, &pPatchRec->patch),
-                            "/PATM/Stats/PatchBD/0x%RRv", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.cbPatchBlockSize,STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,      NULL, "/PATM/Stats/PatchBD/0x%RRv/cbPatchBlockSize", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.cbPatchJump,     STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,      NULL, "/PATM/Stats/PatchBD/0x%RRv/cbPatchJump", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.cbPrivInstr,     STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,      NULL, "/PATM/Stats/PatchBD/0x%RRv/cbPrivInstr", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.cCodeWrites,     STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/Stats/PatchBD/0x%RRv/cCodeWrites", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.cInvalidWrites,  STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/Stats/PatchBD/0x%RRv/cInvalidWrites", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.cTraps,          STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/Stats/PatchBD/0x%RRv/cTraps", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.flags,           STAMTYPE_X32, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,       NULL, "/PATM/Stats/PatchBD/0x%RRv/flags", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.nrJumpRecs,      STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/Stats/PatchBD/0x%RRv/nrJumpRecs", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.nrFixups,        STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/Stats/PatchBD/0x%RRv/nrFixups", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.opcode,          STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/Stats/PatchBD/0x%RRv/opcode", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.uOldState,       STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,       NULL, "/PATM/Stats/PatchBD/0x%RRv/uOldState", pPatchRec->patch.pPrivInstrGC);
-            STAMR3RegisterF(pVM, &pPatchRec->patch.uOpMode,         STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,       NULL, "/PATM/Stats/PatchBD/0x%RRv/uOpMode", pPatchRec->patch.pPrivInstrGC);
+                            "/PATM/PatchBD/0x%RRv", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.pPatchBlockOffset,STAMTYPE_X32, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,     NULL, "/PATM/PatchBD/0x%RRv/offPatchBlock", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.cbPatchBlockSize,STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,      NULL, "/PATM/PatchBD/0x%RRv/cbPatchBlockSize", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.cbPatchJump,     STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,      NULL, "/PATM/PatchBD/0x%RRv/cbPatchJump", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.cbPrivInstr,     STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,      NULL, "/PATM/PatchBD/0x%RRv/cbPrivInstr", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.cCodeWrites,     STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/PatchBD/0x%RRv/cCodeWrites", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.cInvalidWrites,  STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/PatchBD/0x%RRv/cInvalidWrites", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.cTraps,          STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/PatchBD/0x%RRv/cTraps", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.flags,           STAMTYPE_X64, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,       NULL, "/PATM/PatchBD/0x%RRv/flags", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.nrJumpRecs,      STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/PatchBD/0x%RRv/nrJumpRecs", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.nrFixups,        STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/PatchBD/0x%RRv/nrFixups", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.opcode,          STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PATM/PatchBD/0x%RRv/opcode", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.uOldState,       STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,       NULL, "/PATM/PatchBD/0x%RRv/uOldState", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.uOpMode,         STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,       NULL, "/PATM/PatchBD/0x%RRv/uOpMode", pPatchRec->patch.pPrivInstrGC);
             /// @todo change the state to be a callback so we can get a state mnemonic instead.
-            STAMR3RegisterF(pVM, &pPatchRec->patch.uState,          STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,       NULL, "/PATM/Stats/PatchBD/0x%RRv/uState", pPatchRec->patch.pPrivInstrGC);
+            STAMR3RegisterF(pVM, &pPatchRec->patch.uState,          STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_NONE,       NULL, "/PATM/PatchBD/0x%RRv/uState", pPatchRec->patch.pPrivInstrGC);
 #endif
         }
 #endif
@@ -5628,7 +5646,7 @@ int patmR3RemovePatch(PVM pVM, PPATMPATCHREC pPatchRec, bool fForceRemove)
     if (PATM_STAT_INDEX_IS_VALID(pPatchRec->patch.uPatchIdx))
     {
         STAMR3DeregisterF(pVM->pUVM, "/PATM/Stats/Patch/0x%RRv", pPatchRec->patch.pPrivInstrGC);
-        STAMR3DeregisterF(pVM->pUVM, "/PATM/Stats/PatchBD/0x%RRv*", pPatchRec->patch.pPrivInstrGC);
+        STAMR3DeregisterF(pVM->pUVM, "/PATM/PatchBD/0x%RRv*", pPatchRec->patch.pPrivInstrGC);
     }
 #endif
 
@@ -5741,7 +5759,7 @@ int patmR3RefreshPatch(PVM pVM, PPATMPATCHREC pPatchRec)
     if (PATM_STAT_INDEX_IS_VALID(pPatchRec->patch.uPatchIdx))
     {
         STAMR3DeregisterF(pVM->pUVM, "/PATM/Stats/Patch/0x%RRv", pPatchRec->patch.pPrivInstrGC);
-        STAMR3DeregisterF(pVM->pUVM, "/PATM/Stats/PatchBD/0x%RRv*", pPatchRec->patch.pPrivInstrGC);
+        STAMR3DeregisterF(pVM->pUVM, "/PATM/PatchBD/0x%RRv*", pPatchRec->patch.pPrivInstrGC);
     }
 #endif
 
@@ -6525,13 +6543,15 @@ VMMR3_INT_DECL(int) PATMR3HandleTrap(PVM pVM, PCPUMCTX pCtx, RTRCPTR pEip, RTGCP
         /* Very bad. We crashed in emitted code. Probably stack? */
         if (pPatch)
         {
-            AssertReleaseMsg(pVM->patm.s.pGCStateHC->fPIF == 1,
-                            ("Crash in patch code %RRv (%RRv) esp=%RX32\nPatch state=%x flags=%RX64 fDirty=%d\n%s\n", pEip, pNewEip, CPUMGetGuestESP(pVCpu), pPatch->patch.uState, pPatch->patch.flags, pPatchToGuestRec->fDirty, szBuf));
+            AssertLogRelMsg(pVM->patm.s.pGCStateHC->fPIF == 1,
+                            ("Crash in patch code %RRv (%RRv) esp=%RX32\nPatch state=%x flags=%RX64 fDirty=%d\n%s\n",
+                             pEip, pNewEip, CPUMGetGuestESP(pVCpu), pPatch->patch.uState, pPatch->patch.flags,
+                             pPatchToGuestRec->fDirty, szBuf));
         }
         else
-            AssertReleaseMsg(pVM->patm.s.pGCStateHC->fPIF == 1,
+            AssertLogRelMsg(pVM->patm.s.pGCStateHC->fPIF == 1,
                             ("Crash in patch code %RRv (%RRv) esp=%RX32\n%s\n", pEip, pNewEip, CPUMGetGuestESP(pVCpu), szBuf));
-        EMR3FatalError(pVCpu, VERR_INTERNAL_ERROR);
+        EMR3FatalError(pVCpu, VERR_PATM_IPE_TRAP_IN_PATCH_CODE);
     }
 
     /* From here on, we must have a valid patch to guest translation. */
@@ -6674,11 +6694,12 @@ VMMR3_INT_DECL(int) PATMR3HandleTrap(PVM pVM, PCPUMCTX pCtx, RTRCPTR pEip, RTGCP
 VMMR3_INT_DECL(int) PATMR3HandleMonitoredPage(PVM pVM)
 {
     AssertReturn(!HMIsEnabled(pVM), VERR_PATM_HM_IPE);
+    PVMCPU pVCpu = VMMGetCpu0(pVM);
 
     RTRCPTR addr = pVM->patm.s.pvFaultMonitor;
     addr &= PAGE_BASE_GC_MASK;
 
-    int rc = PGMHandlerVirtualDeregister(pVM, addr);
+    int rc = PGMHandlerVirtualDeregister(pVM, pVCpu, addr, false /*fHypervisor*/);
     AssertRC(rc); NOREF(rc);
 
     PPATMPATCHREC pPatchRec = (PPATMPATCHREC)RTAvloU32GetBestFit(&pVM->patm.s.PatchLookupTreeHC->PatchTree, addr, false);
diff --git a/src/VBox/VMM/VMMR3/PATMA.asm b/src/VBox/VMM/VMMR3/PATMA.asm
index 2badb05..8a0d664 100644
--- a/src/VBox/VMM/VMMR3/PATMA.asm
+++ b/src/VBox/VMM/VMMR3/PATMA.asm
@@ -3,7 +3,7 @@
 ; PATM Assembly Routines.
 ;
 
-; Copyright (C) 2006-2012 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -31,358 +31,430 @@
 %include "VBox/asmdefs.mac"
 %include "VBox/err.mac"
 %include "iprt/x86.mac"
+%include "VBox/vmm/cpum.mac"
 %include "VBox/vmm/vm.mac"
 %include "PATMA.mac"
 
+
+;*******************************************************************************
+;*  Defined Constants And Macros                                               *
+;*******************************************************************************
 %ifdef DEBUG
 ; Noisy, but useful for debugging certain problems
 ;;;%define PATM_LOG_PATCHINSTR
 ;;%define PATM_LOG_PATCHIRET
 %endif
 
-BEGINCONST
+;;
+; Simple PATCHASMRECORD initializer
+; @param %1     The patch function name.
+; @param %2     The number of fixups.
+;
+%macro PATCHASMRECORD_INIT 2
+istruc PATCHASMRECORD
+    at PATCHASMRECORD.pbFunction,     RTCCPTR_DEF NAME(%1)
+    at PATCHASMRECORD.offJump,        DD          0
+    at PATCHASMRECORD.offRelJump,     DD          0
+    at PATCHASMRECORD.offSizeOverride,DD          0
+    at PATCHASMRECORD.cbFunction,     DD          NAME(%1 %+ _EndProc) - NAME(%1)
+    at PATCHASMRECORD.cRelocs,        DD          %2
+iend                                                         
+%endmacro
+
+;;
+; Simple PATCHASMRECORD initializer
+; @param %1     The patch function name.
+; @param %2     Jump lable.
+; @param %3     The number of fixups.
+;
+%macro PATCHASMRECORD_INIT_JUMP 3
+istruc PATCHASMRECORD
+    at PATCHASMRECORD.pbFunction,     RTCCPTR_DEF NAME(%1)
+    at PATCHASMRECORD.offJump,        DD          %2 - NAME(%1)
+    at PATCHASMRECORD.offRelJump,     DD          0
+    at PATCHASMRECORD.offSizeOverride,DD          0
+    at PATCHASMRECORD.cbFunction,     DD          NAME(%1 %+ _EndProc) - NAME(%1)
+    at PATCHASMRECORD.cRelocs,        DD          %3
+iend                                                         
+%endmacro
+
+;;
+; Simple PATCHASMRECORD initializer
+; @param %1     The patch function name.
+; @param %2     Jump lable (or nothing).
+; @param %3     Relative jump label (or nothing).
+; @param %4     Size override label (or nothing).
+; @param %5     The number of fixups.
+;
+%macro PATCHASMRECORD_INIT_EX 5
+istruc PATCHASMRECORD
+    at PATCHASMRECORD.pbFunction,     RTCCPTR_DEF NAME(%1)
+%ifid %2
+    at PATCHASMRECORD.offJump,        DD          %2 - NAME(%1)
+%else
+    at PATCHASMRECORD.offJump,        DD          0
+%endif
+%ifid %3
+    at PATCHASMRECORD.offRelJump,     DD          %3 - NAME(%1)
+%else
+    at PATCHASMRECORD.offRelJump,     DD          0
+%endif
+%ifid %4
+    at PATCHASMRECORD.offSizeOverride,DD          %4 - NAME(%1)
+%else
+    at PATCHASMRECORD.offSizeOverride,DD          0
+%endif
+    at PATCHASMRECORD.cbFunction,     DD          NAME(%1 %+ _EndProc) - NAME(%1)
+    at PATCHASMRECORD.cRelocs,        DD          %5
+iend                                                         
+%endmacro
+
+;;
+; Switches to the code section and aligns the function.
+;
+; @remarks This section must be different from the patch readonly data section!
+;
+%macro BEGIN_PATCH_CODE_SECTION 0
+BEGINCODE
+align 32
+%endmacro
+%macro BEGIN_PATCH_CODE_SECTION_NO_ALIGN 0
+BEGINCODE
+%endmacro
+
+;;
+; Switches to the data section for the read-only patch descriptor data and 
+; aligns it appropriately.
+;
+; @remarks This section must be different from the patch code section!
+;
+%macro BEGIN_PATCH_RODATA_SECTION 0
+BEGINDATA
+align 16
+%endmacro
+%macro BEGIN_PATCH_RODATA_SECTION_NO_ALIGN 0
+BEGINDATA
+%endmacro
+
+
+;;
+; Starts a patch.
+;
+; @param %1     The patch record name (externally visible).
+; @param %2     The patch function name (considered internal).
+;
+%macro BEGIN_PATCH 2
+; The patch record.
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME %1
+PATCHASMRECORD_INIT PATMCpuidReplacement, (RT_CONCAT(%1,_FixupEnd) - RT_CONCAT(%1,_FixupStart)) / 8
+RT_CONCAT(%1,_FixupStart):
+
+; The patch code.
+BEGIN_PATCH_CODE_SECTION
+BEGINPROC %2
+%endmacro
+
+;;
+; Emit a fixup.
+; @param %1     The fixup type.
+%macro PATCH_FIXUP 1
+BEGIN_PATCH_RODATA_SECTION_NO_ALIGN
+    dd      %1, 0
+BEGIN_PATCH_CODE_SECTION_NO_ALIGN
+%endmacro
+
+;;
+; Emit a fixup with extra info.
+; @param %1     The fixup type.
+; @param %2     The extra fixup info.
+%macro PATCH_FIXUP_2 2
+BEGIN_PATCH_RODATA_SECTION_NO_ALIGN
+    dd      %1, %2
+BEGIN_PATCH_CODE_SECTION_NO_ALIGN
+%endmacro
+
+;;
+; Ends a patch.
+; 
+; This terminates the function and fixup array.
+;
+; @param %1     The patch record name (externally visible).
+; @param %2     The patch function name (considered internal).
+;
+%macro END_PATCH 2
+ENDPROC %2
+
+; Terminate the fixup array.
+BEGIN_PATCH_RODATA_SECTION_NO_ALIGN
+RT_CONCAT(%1,_FixupEnd):
+    dd      0ffffffffh, 0ffffffffh
+BEGIN_PATCH_CODE_SECTION_NO_ALIGN
+%endmacro
+
 
+;
+; Switch to 32-bit mode (x86).
+;
 %ifdef RT_ARCH_AMD64
- BITS 32 ; switch to 32-bit mode (x86).
+ BITS 32 
 %endif
 
+
 %ifdef VBOX_WITH_STATISTICS
 ;
 ; Patch call statistics
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMStats
-PATMStats_Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushf
-    inc     dword [ss:PATM_ALLPATCHCALLS]
-    inc     dword [ss:PATM_PERPATCHCALLS]
+    inc     dword [ss:PATM_ASMFIX_ALLPATCHCALLS]
+    inc     dword [ss:PATM_ASMFIX_PERPATCHCALLS]
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMStats_End:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMStats
 
-
 ; Patch record for statistics
-GLOBALNAME PATMStatsRecord
-    RTCCPTR_DEF PATMStats_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMStats_End - PATMStats_Start
-    DD      4
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_ALLPATCHCALLS
-    DD      0
-    DD      PATM_PERPATCHCALLS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-%endif
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmStatsRecord
+    PATCHASMRECORD_INIT PATMStats, 4
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_ALLPATCHCALLS, 0
+    DD      PATM_ASMFIX_PERPATCHCALLS, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
+%endif ; VBOX_WITH_STATISTICS
+
 
 ;
-; Set PATM_INTERRUPTFLAG
+; Set PATM_ASMFIX_INTERRUPTFLAG
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMSetPIF
-PATMSetPIF_Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMSetPIF_End:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMSetPIF
 
-
-SECTION .data
-; Patch record for setting PATM_INTERRUPTFLAG
-GLOBALNAME PATMSetPIFRecord
-    RTCCPTR_DEF PATMSetPIF_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMSetPIF_End - PATMSetPIF_Start
-    DD      1
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+; Patch record for setting PATM_ASMFIX_INTERRUPTFLAG
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmSetPIFRecord
+    PATCHASMRECORD_INIT PATMSetPIF, 1
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
 ;
-; Clear PATM_INTERRUPTFLAG
+; Clear PATM_ASMFIX_INTERRUPTFLAG
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMClearPIF
-PATMClearPIF_Start:
     ; probe stack here as we can't recover from page faults later on
     not     dword [esp-64]
     not     dword [esp-64]
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
-PATMClearPIF_End:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
 ENDPROC     PATMClearPIF
 
-
-SECTION .data
-; Patch record for clearing PATM_INTERRUPTFLAG
-GLOBALNAME PATMClearPIFRecord
-    RTCCPTR_DEF PATMClearPIF_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMClearPIF_End - PATMClearPIF_Start
-    DD      1
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+; Patch record for clearing PATM_ASMFIX_INTERRUPTFLAG
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmClearPIFRecord
+    PATCHASMRECORD_INIT PATMClearPIF, 1
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
 ;
-; Clear PATM_INHIBITIRQADDR and fault if IF=0
+; Clear PATM_ASMFIX_INHIBITIRQADDR and fault if IF=0
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMClearInhibitIRQFaultIF0
-PATMClearInhibitIRQFaultIF0_Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
-    mov     dword [ss:PATM_INHIBITIRQADDR], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INHIBITIRQADDR], 0
     pushf
 
-    test    dword [ss:PATM_VMFLAGS], X86_EFL_IF
+    test    dword [ss:PATM_ASMFIX_VMFLAGS], X86_EFL_IF
     jz      PATMClearInhibitIRQFaultIF0_Fault
 
     ; if interrupts are pending, then we must go back to the host context to handle them!
-    test    dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
+    test    dword [ss:PATM_ASMFIX_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
     jz      PATMClearInhibitIRQFaultIF0_Continue
 
     ; Go to our hypervisor trap handler to dispatch the pending irq
-    mov     dword [ss:PATM_TEMP_EAX], eax
-    mov     dword [ss:PATM_TEMP_ECX], ecx
-    mov     dword [ss:PATM_TEMP_EDI], edi
-    mov     dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], eax
+    mov     dword [ss:PATM_ASMFIX_TEMP_ECX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_EDI], edi
+    mov     dword [ss:PATM_ASMFIX_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
     mov     eax, PATM_ACTION_DISPATCH_PENDING_IRQ
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
-    mov     edi, PATM_NEXTINSTRADDR
+    mov     edi, PATM_ASMFIX_NEXTINSTRADDR
     popfd                   ; restore flags we pushed above (the or instruction changes the flags as well)
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     ; does not return
 
 PATMClearInhibitIRQFaultIF0_Fault:
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 PATMClearInhibitIRQFaultIF0_Continue:
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMClearInhibitIRQFaultIF0_End:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMClearInhibitIRQFaultIF0
 
+; Patch record for clearing PATM_ASMFIX_INHIBITIRQADDR
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmClearInhibitIRQFaultIF0Record
+    PATCHASMRECORD_INIT PATMClearInhibitIRQFaultIF0, 12
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_INHIBITIRQADDR,     0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VM_FORCEDACTIONS,   0
+    DD      PATM_ASMFIX_TEMP_EAX,           0
+    DD      PATM_ASMFIX_TEMP_ECX,           0
+    DD      PATM_ASMFIX_TEMP_EDI,           0
+    DD      PATM_ASMFIX_TEMP_RESTORE_FLAGS, 0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+    DD      PATM_ASMFIX_NEXTINSTRADDR,      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      0ffffffffh, 0ffffffffh
+
 
-SECTION .data
-; Patch record for clearing PATM_INHIBITIRQADDR
-GLOBALNAME PATMClearInhibitIRQFaultIF0Record
-    RTCCPTR_DEF PATMClearInhibitIRQFaultIF0_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMClearInhibitIRQFaultIF0_End - PATMClearInhibitIRQFaultIF0_Start
-    DD      12
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INHIBITIRQADDR
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VM_FORCEDACTIONS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_ECX
-    DD      0
-    DD      PATM_TEMP_EDI
-    DD      0
-    DD      PATM_TEMP_RESTORE_FLAGS
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_NEXTINSTRADDR
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
-
-;
-; Clear PATM_INHIBITIRQADDR and continue if IF=0 (duplicated function only; never jump back to guest code afterwards!!)
 ;
+; Clear PATM_ASMFIX_INHIBITIRQADDR and continue if IF=0 (duplicated function only; never jump back to guest code afterwards!!)
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMClearInhibitIRQContIF0
-PATMClearInhibitIRQContIF0_Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
-    mov     dword [ss:PATM_INHIBITIRQADDR], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INHIBITIRQADDR], 0
     pushf
 
-    test    dword [ss:PATM_VMFLAGS], X86_EFL_IF
+    test    dword [ss:PATM_ASMFIX_VMFLAGS], X86_EFL_IF
     jz      PATMClearInhibitIRQContIF0_Continue
 
     ; if interrupts are pending, then we must go back to the host context to handle them!
-    test    dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
+    test    dword [ss:PATM_ASMFIX_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
     jz      PATMClearInhibitIRQContIF0_Continue
 
     ; Go to our hypervisor trap handler to dispatch the pending irq
-    mov     dword [ss:PATM_TEMP_EAX], eax
-    mov     dword [ss:PATM_TEMP_ECX], ecx
-    mov     dword [ss:PATM_TEMP_EDI], edi
-    mov     dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], eax
+    mov     dword [ss:PATM_ASMFIX_TEMP_ECX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_EDI], edi
+    mov     dword [ss:PATM_ASMFIX_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
     mov     eax, PATM_ACTION_DISPATCH_PENDING_IRQ
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
-    mov     edi, PATM_NEXTINSTRADDR
+    mov     edi, PATM_ASMFIX_NEXTINSTRADDR
     popfd                   ; restore flags we pushed above (the or instruction changes the flags as well)
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     ; does not return
 
 PATMClearInhibitIRQContIF0_Continue:
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMClearInhibitIRQContIF0_End:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMClearInhibitIRQContIF0
 
-
-SECTION .data
-; Patch record for clearing PATM_INHIBITIRQADDR
-GLOBALNAME PATMClearInhibitIRQContIF0Record
-    RTCCPTR_DEF PATMClearInhibitIRQContIF0_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMClearInhibitIRQContIF0_End - PATMClearInhibitIRQContIF0_Start
-    DD      11
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INHIBITIRQADDR
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VM_FORCEDACTIONS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_ECX
-    DD      0
-    DD      PATM_TEMP_EDI
-    DD      0
-    DD      PATM_TEMP_RESTORE_FLAGS
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_NEXTINSTRADDR
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+; Patch record for clearing PATM_ASMFIX_INHIBITIRQADDR
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmClearInhibitIRQContIF0Record
+    PATCHASMRECORD_INIT PATMClearInhibitIRQContIF0, 11
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0   
+    DD      PATM_ASMFIX_INHIBITIRQADDR,     0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VM_FORCEDACTIONS,   0
+    DD      PATM_ASMFIX_TEMP_EAX,           0
+    DD      PATM_ASMFIX_TEMP_ECX,           0
+    DD      PATM_ASMFIX_TEMP_EDI,           0
+    DD      PATM_ASMFIX_TEMP_RESTORE_FLAGS, 0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+    DD      PATM_ASMFIX_NEXTINSTRADDR,      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      0ffffffffh, 0ffffffffh
 
 
+;
+;
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMCliReplacement
-PATMCliStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushf
 %ifdef PATM_LOG_PATCHINSTR
     push    eax
     push    ecx
     mov     eax, PATM_ACTION_LOG_CLI
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     ecx
     pop     eax
 %endif
 
-    and     dword [ss:PATM_VMFLAGS], ~X86_EFL_IF
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], ~X86_EFL_IF
     popf
 
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMCliJump:
-    DD      PATM_JUMPDELTA
-PATMCliEnd:
+    DD      PATM_ASMFIX_JUMPDELTA
 ENDPROC     PATMCliReplacement
 
-
-SECTION .data
 ; Patch record for 'cli'
-GLOBALNAME PATMCliRecord
-    RTCCPTR_DEF PATMCliStart
-    DD      PATMCliJump - PATMCliStart
-    DD      0
-    DD      0
-    DD      PATMCliEnd - PATMCliStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmCliRecord
 %ifdef PATM_LOG_PATCHINSTR
-    DD      4
+    PATCHASMRECORD_INIT_JUMP PATMCliReplacement, PATMCliJump, 4
 %else
-    DD      3
+    PATCHASMRECORD_INIT_JUMP PATMCliReplacement, PATMCliJump, 3
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
 %ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION, 0
 %endif
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
 
+;
+;
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMStiReplacement
-PATMStiStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
-    mov     dword [ss:PATM_INHIBITIRQADDR], PATM_NEXTINSTRADDR
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INHIBITIRQADDR], PATM_ASMFIX_NEXTINSTRADDR
     pushf
 %ifdef PATM_LOG_PATCHINSTR
     push    eax
     push    ecx
     mov     eax, PATM_ACTION_LOG_STI
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     ecx
     pop     eax
 %endif
-    or      dword [ss:PATM_VMFLAGS], X86_EFL_IF
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], X86_EFL_IF
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMStiEnd:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMStiReplacement
 
-SECTION .data
 ; Patch record for 'sti'
-GLOBALNAME PATMStiRecord
-    RTCCPTR_DEF PATMStiStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMStiEnd - PATMStiStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmStiRecord
 %ifdef PATM_LOG_PATCHINSTR
-    DD      6
+    PATCHASMRECORD_INIT PATMStiReplacement, 6
 %else
-    DD      5
+    PATCHASMRECORD_INIT PATMStiReplacement, 5
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INHIBITIRQADDR
-    DD      0
-    DD      PATM_NEXTINSTRADDR
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,  0
+    DD      PATM_ASMFIX_INHIBITIRQADDR, 0
+    DD      PATM_ASMFIX_NEXTINSTRADDR,  0
 %ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION,  0
 %endif
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_VMFLAGS,        0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,  0
+    DD      0ffffffffh, 0ffffffffh
+
 
 ;
 ; Trampoline code for trap entry (without error code on the stack)
@@ -397,9 +469,9 @@ SECTION .text
 ; esp + 4  - CS
 ; esp      - EIP
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMTrapEntry
-PATMTrapEntryStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushf
 
 %ifdef PATM_LOG_PATCHIRET
@@ -408,7 +480,7 @@ PATMTrapEntryStart:
     push    edx
     lea     edx, dword [ss:esp+12+4]        ;3 dwords + pushed flags -> iret eip
     mov     eax, PATM_ACTION_LOG_GATE_ENTRY
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     edx
@@ -429,46 +501,35 @@ PATMTrapNoRing1:
 
     ; correct EFLAGS on the stack to include the current IOPL
     push    eax
-    mov     eax, dword [ss:PATM_VMFLAGS]
+    mov     eax, dword [ss:PATM_ASMFIX_VMFLAGS]
     and     eax, X86_EFL_IOPL
     and     dword [esp+16], ~X86_EFL_IOPL       ; esp+16 = eflags = esp+8+4(efl)+4(eax)
     or      dword [esp+16], eax
     pop     eax
 
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMTrapEntryJump:
-    DD      PATM_JUMPDELTA
-PATMTrapEntryEnd:
+    DD      PATM_ASMFIX_JUMPDELTA
 ENDPROC     PATMTrapEntry
 
-
-SECTION .data
 ; Patch record for trap gate entrypoint
-GLOBALNAME PATMTrapEntryRecord
-    RTCCPTR_DEF PATMTrapEntryStart
-    DD      PATMTrapEntryJump - PATMTrapEntryStart
-    DD      0
-    DD      0
-    DD      PATMTrapEntryEnd - PATMTrapEntryStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmTrapEntryRecord
 %ifdef PATM_LOG_PATCHIRET
-    DD      4
+    PATCHASMRECORD_INIT_JUMP PATMTrapEntry, PATMTrapEntryJump, 4
 %else
-    DD      3
+    PATCHASMRECORD_INIT_JUMP PATMTrapEntry, PATMTrapEntryJump, 3
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
 %ifdef PATM_LOG_PATCHIRET
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION, 0
 %endif
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
+
 
 ;
 ; Trampoline code for trap entry (with error code on the stack)
@@ -484,9 +545,10 @@ SECTION .text
 ; esp + 4  - EIP
 ; esp      - error code
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMTrapEntryErrorCode
 PATMTrapErrorCodeEntryStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushf
 
 %ifdef PATM_LOG_PATCHIRET
@@ -495,7 +557,7 @@ PATMTrapErrorCodeEntryStart:
     push    edx
     lea     edx, dword [ss:esp+12+4+4]        ;3 dwords + pushed flags + error code -> iret eip
     mov     eax, PATM_ACTION_LOG_GATE_ENTRY
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     edx
@@ -516,46 +578,34 @@ PATMTrapErrorCodeNoRing1:
 
     ; correct EFLAGS on the stack to include the current IOPL
     push    eax
-    mov     eax, dword [ss:PATM_VMFLAGS]
+    mov     eax, dword [ss:PATM_ASMFIX_VMFLAGS]
     and     eax, X86_EFL_IOPL
     and     dword [esp+20], ~X86_EFL_IOPL       ; esp+20 = eflags = esp+8+4(efl)+4(error code)+4(eax)
     or      dword [esp+20], eax
     pop     eax
 
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMTrapErrorCodeEntryJump:
-    DD      PATM_JUMPDELTA
-PATMTrapErrorCodeEntryEnd:
+    DD      PATM_ASMFIX_JUMPDELTA
 ENDPROC     PATMTrapEntryErrorCode
 
-
-SECTION .data
 ; Patch record for trap gate entrypoint
-GLOBALNAME PATMTrapEntryRecordErrorCode
-    RTCCPTR_DEF PATMTrapErrorCodeEntryStart
-    DD      PATMTrapErrorCodeEntryJump - PATMTrapErrorCodeEntryStart
-    DD      0
-    DD      0
-    DD      PATMTrapErrorCodeEntryEnd - PATMTrapErrorCodeEntryStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmTrapEntryRecordErrorCode
 %ifdef PATM_LOG_PATCHIRET
-    DD      4
+    PATCHASMRECORD_INIT_JUMP PATMTrapEntryErrorCode, PATMTrapErrorCodeEntryJump, 4
 %else
-    DD      3
+    PATCHASMRECORD_INIT_JUMP PATMTrapEntryErrorCode, PATMTrapErrorCodeEntryJump, 3
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
 %ifdef PATM_LOG_PATCHIRET
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION, 0
 %endif
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
 
 ;
@@ -571,9 +621,9 @@ SECTION .text
 ; esp + 4  - CS
 ; esp      - EIP
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMIntEntry
-PATMIntEntryStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushf
 
 %ifdef PATM_LOG_PATCHIRET
@@ -582,7 +632,7 @@ PATMIntEntryStart:
     push    edx
     lea     edx, dword [ss:esp+12+4]        ;3 dwords + pushed flags -> iret eip
     mov     eax, PATM_ACTION_LOG_GATE_ENTRY
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     edx
@@ -603,43 +653,32 @@ PATMIntNoRing1:
 
     ; correct EFLAGS on the stack to include the current IOPL
     push    eax
-    mov     eax, dword [ss:PATM_VMFLAGS]
+    mov     eax, dword [ss:PATM_ASMFIX_VMFLAGS]
     and     eax, X86_EFL_IOPL
     and     dword [esp+16], ~X86_EFL_IOPL       ; esp+16 = eflags = esp+8+4(efl)+4(eax)
     or      dword [esp+16], eax
     pop     eax
 
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMIntEntryEnd:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMIntEntry
 
-
-SECTION .data
 ; Patch record for interrupt gate entrypoint
-GLOBALNAME PATMIntEntryRecord
-    RTCCPTR_DEF PATMIntEntryStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMIntEntryEnd - PATMIntEntryStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmIntEntryRecord
 %ifdef PATM_LOG_PATCHIRET
-    DD      4
+    PATCHASMRECORD_INIT PATMIntEntry, 4
 %else
-    DD      3
+    PATCHASMRECORD_INIT PATMIntEntry, 3
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
 %ifdef PATM_LOG_PATCHIRET
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION, 0
 %endif
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
+
 
 ;
 ; Trampoline code for interrupt gate entry (*with* error code on the stack)
@@ -655,9 +694,9 @@ SECTION .text
 ; esp + 4  - EIP
 ; esp      - error code
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMIntEntryErrorCode
-PATMIntEntryErrorCodeStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushf
 
 %ifdef PATM_LOG_PATCHIRET
@@ -666,7 +705,7 @@ PATMIntEntryErrorCodeStart:
     push    edx
     lea     edx, dword [ss:esp+12+4+4]        ;3 dwords + pushed flags + error code -> iret eip
     mov     eax, PATM_ACTION_LOG_GATE_ENTRY
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     edx
@@ -687,50 +726,39 @@ PATMIntNoRing1_ErrorCode:
 
     ; correct EFLAGS on the stack to include the current IOPL
     push    eax
-    mov     eax, dword [ss:PATM_VMFLAGS]
+    mov     eax, dword [ss:PATM_ASMFIX_VMFLAGS]
     and     eax, X86_EFL_IOPL
     and     dword [esp+20], ~X86_EFL_IOPL       ; esp+20 = eflags = esp+8+4(efl)+4(eax)+4(error code)
     or      dword [esp+20], eax
     pop     eax
 
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMIntEntryErrorCodeEnd:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMIntEntryErrorCode
 
-
-SECTION .data
 ; Patch record for interrupt gate entrypoint
-GLOBALNAME PATMIntEntryRecordErrorCode
-    RTCCPTR_DEF PATMIntEntryErrorCodeStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMIntEntryErrorCodeEnd - PATMIntEntryErrorCodeStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmIntEntryRecordErrorCode
 %ifdef PATM_LOG_PATCHIRET
-    DD      4
+    PATCHASMRECORD_INIT PATMIntEntryErrorCode, 4
 %else
-    DD      3
+    PATCHASMRECORD_INIT PATMIntEntryErrorCode, 3
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
 %ifdef PATM_LOG_PATCHIRET
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION, 0
 %endif
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
+
 
 ;
 ; 32 bits Popf replacement that faults when IF remains 0
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMPopf32Replacement
-PATMPopf32Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
 %ifdef PATM_LOG_PATCHINSTR
     push    eax
     push    ecx
@@ -740,7 +768,7 @@ PATMPopf32Start:
     mov     eax, PATM_ACTION_LOG_POPF_IF0
 
 PATMPopf32_Log:
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     ecx
@@ -749,28 +777,28 @@ PATMPopf32_Log:
 
     test    dword [esp], X86_EFL_IF
     jnz     PATMPopf32_Ok
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 PATMPopf32_Ok:
     ; Note: we don't allow popf instructions to change the current IOPL; we simply ignore such changes (!!!)
     ; In this particular patch it's rather unlikely the pushf was included, so we have no way to check if the flags on the stack were correctly synced
     ; PATMPopf32Replacement_NoExit is different, because it's only used in IDT and function patches
-    or      dword [ss:PATM_VMFLAGS], X86_EFL_IF
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], X86_EFL_IF
 
     ; if interrupts are pending, then we must go back to the host context to handle them!
-    test    dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
+    test    dword [ss:PATM_ASMFIX_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
     jz      PATMPopf32_Continue
 
     ; Go to our hypervisor trap handler to dispatch the pending irq
-    mov     dword [ss:PATM_TEMP_EAX], eax
-    mov     dword [ss:PATM_TEMP_ECX], ecx
-    mov     dword [ss:PATM_TEMP_EDI], edi
-    mov     dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], eax
+    mov     dword [ss:PATM_ASMFIX_TEMP_ECX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_EDI], edi
+    mov     dword [ss:PATM_ASMFIX_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
     mov     eax, PATM_ACTION_DISPATCH_PENDING_IRQ
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
-    mov     edi, PATM_NEXTINSTRADDR
+    mov     edi, PATM_ASMFIX_NEXTINSTRADDR
 
     popfd                   ; restore flags we pushed above (the or instruction changes the flags as well)
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
@@ -778,60 +806,43 @@ PATMPopf32_Ok:
 
 PATMPopf32_Continue:
     popfd                   ; restore flags we pushed above
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMPopf32Jump:
-    DD      PATM_JUMPDELTA
-PATMPopf32End:
+    DD      PATM_ASMFIX_JUMPDELTA
 ENDPROC     PATMPopf32Replacement
 
-
-SECTION .data
 ; Patch record for 'popfd'
-GLOBALNAME PATMPopf32Record
-    RTCCPTR_DEF PATMPopf32Start
-    DD      PATMPopf32Jump - PATMPopf32Start
-    DD      0
-    DD      0
-    DD      PATMPopf32End - PATMPopf32Start
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmPopf32Record
 %ifdef PATM_LOG_PATCHINSTR
-    DD      12
+    PATCHASMRECORD_INIT_JUMP PATMPopf32Replacement, PATMPopf32Jump, 12
 %else
-    DD      11
+    PATCHASMRECORD_INIT_JUMP PATMPopf32Replacement, PATMPopf32Jump, 11
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
 %ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VM_FORCEDACTIONS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_ECX
-    DD      0
-    DD      PATM_TEMP_EDI
-    DD      0
-    DD      PATM_TEMP_RESTORE_FLAGS
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_NEXTINSTRADDR
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VM_FORCEDACTIONS,   0
+    DD      PATM_ASMFIX_TEMP_EAX,           0
+    DD      PATM_ASMFIX_TEMP_ECX,           0
+    DD      PATM_ASMFIX_TEMP_EDI,           0
+    DD      PATM_ASMFIX_TEMP_RESTORE_FLAGS, 0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+    DD      PATM_ASMFIX_NEXTINSTRADDR,      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      0ffffffffh, 0ffffffffh
 
+
+;
 ; no need to check the IF flag when popf isn't an exit point of a patch (e.g. function duplication)
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMPopf32Replacement_NoExit
-PATMPopf32_NoExitStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
 %ifdef PATM_LOG_PATCHINSTR
     push    eax
     push    ecx
@@ -841,7 +852,7 @@ PATMPopf32_NoExitStart:
     mov     eax, PATM_ACTION_LOG_POPF_IF0
 
 PATMPopf32_NoExitLog:
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     ecx
@@ -851,222 +862,171 @@ PATMPopf32_NoExitLog:
     jz      PATMPopf32_NoExit_Continue
 
     ; if interrupts are pending, then we must go back to the host context to handle them!
-    test    dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
+    test    dword [ss:PATM_ASMFIX_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
     jz      PATMPopf32_NoExit_Continue
 
     ; Go to our hypervisor trap handler to dispatch the pending irq
-    mov     dword [ss:PATM_TEMP_EAX], eax
-    mov     dword [ss:PATM_TEMP_ECX], ecx
-    mov     dword [ss:PATM_TEMP_EDI], edi
-    mov     dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], eax
+    mov     dword [ss:PATM_ASMFIX_TEMP_ECX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_EDI], edi
+    mov     dword [ss:PATM_ASMFIX_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
     mov     eax, PATM_ACTION_DISPATCH_PENDING_IRQ
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
-    mov     edi, PATM_NEXTINSTRADDR
+    mov     edi, PATM_ASMFIX_NEXTINSTRADDR
 
-    pop     dword [ss:PATM_VMFLAGS]     ; restore flags now (the or instruction changes the flags as well)
-    push    dword [ss:PATM_VMFLAGS]
+    pop     dword [ss:PATM_ASMFIX_VMFLAGS]     ; restore flags now (the or instruction changes the flags as well)
+    push    dword [ss:PATM_ASMFIX_VMFLAGS]
     popfd
 
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     ; does not return
 
 PATMPopf32_NoExit_Continue:
-    pop     dword [ss:PATM_VMFLAGS]
-    push    dword [ss:PATM_VMFLAGS]
+    pop     dword [ss:PATM_ASMFIX_VMFLAGS]
+    push    dword [ss:PATM_ASMFIX_VMFLAGS]
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMPopf32_NoExitEnd:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMPopf32Replacement_NoExit
 
-
-SECTION .data
 ; Patch record for 'popfd'
-GLOBALNAME PATMPopf32Record_NoExit
-    RTCCPTR_DEF PATMPopf32_NoExitStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMPopf32_NoExitEnd - PATMPopf32_NoExitStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmPopf32Record_NoExit
 %ifdef PATM_LOG_PATCHINSTR
-    DD      14
+    PATCHASMRECORD_INIT PATMPopf32Replacement_NoExit, 14
 %else
-    DD      13
+    PATCHASMRECORD_INIT PATMPopf32Replacement_NoExit, 13
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
 %ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
 %endif
-    DD      PATM_VM_FORCEDACTIONS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_ECX
-    DD      0
-    DD      PATM_TEMP_EDI
-    DD      0
-    DD      PATM_TEMP_RESTORE_FLAGS
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_NEXTINSTRADDR
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_VM_FORCEDACTIONS,   0
+    DD      PATM_ASMFIX_TEMP_EAX,           0
+    DD      PATM_ASMFIX_TEMP_ECX,           0
+    DD      PATM_ASMFIX_TEMP_EDI,           0
+    DD      PATM_ASMFIX_TEMP_RESTORE_FLAGS, 0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+    DD      PATM_ASMFIX_NEXTINSTRADDR,      0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      0ffffffffh, 0ffffffffh
 
 
 ;
 ; 16 bits Popf replacement that faults when IF remains 0
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMPopf16Replacement
-PATMPopf16Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     test    word [esp], X86_EFL_IF
     jnz     PATMPopf16_Ok
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 PATMPopf16_Ok:
     ; if interrupts are pending, then we must go back to the host context to handle them!
     ; @note we destroy the flags here, but that should really not matter (PATM_INT3 case)
-    test    dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
+    test    dword [ss:PATM_ASMFIX_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
     jz      PATMPopf16_Continue
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 PATMPopf16_Continue:
 
-    pop     word [ss:PATM_VMFLAGS]
-    push    word [ss:PATM_VMFLAGS]
-    and     dword [ss:PATM_VMFLAGS], PATM_VIRTUAL_FLAGS_MASK
-    or      dword [ss:PATM_VMFLAGS], PATM_VIRTUAL_FLAGS_MASK
+    pop     word [ss:PATM_ASMFIX_VMFLAGS]
+    push    word [ss:PATM_ASMFIX_VMFLAGS]
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], PATM_VIRTUAL_FLAGS_MASK
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], PATM_VIRTUAL_FLAGS_MASK
 
     DB      0x66    ; size override
     popf    ;after the and and or operations!! (flags must be preserved)
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 
     DB      0xE9
 PATMPopf16Jump:
-    DD      PATM_JUMPDELTA
-PATMPopf16End:
+    DD      PATM_ASMFIX_JUMPDELTA
 ENDPROC     PATMPopf16Replacement
 
-
-SECTION .data
 ; Patch record for 'popf'
-GLOBALNAME PATMPopf16Record
-    RTCCPTR_DEF PATMPopf16Start
-    DD      PATMPopf16Jump - PATMPopf16Start
-    DD      0
-    DD      0
-    DD      PATMPopf16End - PATMPopf16Start
-    DD      9
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_VM_FORCEDACTIONS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmPopf16Record
+    PATCHASMRECORD_INIT_JUMP PATMPopf16Replacement, PATMPopf16Jump, 9
+    DD      PATM_ASMFIX_INTERRUPTFLAG,    0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,    0
+    DD      PATM_ASMFIX_VM_FORCEDACTIONS, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,    0
+    DD      PATM_ASMFIX_VMFLAGS,          0
+    DD      PATM_ASMFIX_VMFLAGS,          0
+    DD      PATM_ASMFIX_VMFLAGS,          0
+    DD      PATM_ASMFIX_VMFLAGS,          0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,    0
+    DD      0ffffffffh, 0ffffffffh
+
 
 ;
 ; 16 bits Popf replacement that faults when IF remains 0
 ; @todo not necessary to fault in that case (see 32 bits version)
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMPopf16Replacement_NoExit
-PATMPopf16Start_NoExit:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     test    word [esp], X86_EFL_IF
     jnz     PATMPopf16_Ok_NoExit
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 PATMPopf16_Ok_NoExit:
     ; if interrupts are pending, then we must go back to the host context to handle them!
     ; @note we destroy the flags here, but that should really not matter (PATM_INT3 case)
-    test    dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
+    test    dword [ss:PATM_ASMFIX_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
     jz      PATMPopf16_Continue_NoExit
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 PATMPopf16_Continue_NoExit:
 
-    pop     word [ss:PATM_VMFLAGS]
-    push    word [ss:PATM_VMFLAGS]
-    and     dword [ss:PATM_VMFLAGS], PATM_VIRTUAL_FLAGS_MASK
-    or      dword [ss:PATM_VMFLAGS], PATM_VIRTUAL_FLAGS_MASK
+    pop     word [ss:PATM_ASMFIX_VMFLAGS]
+    push    word [ss:PATM_ASMFIX_VMFLAGS]
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], PATM_VIRTUAL_FLAGS_MASK
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], PATM_VIRTUAL_FLAGS_MASK
 
     DB      0x66    ; size override
     popf    ;after the and and or operations!! (flags must be preserved)
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMPopf16End_NoExit:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMPopf16Replacement_NoExit
 
-
-SECTION .data
 ; Patch record for 'popf'
-GLOBALNAME PATMPopf16Record_NoExit
-    RTCCPTR_DEF PATMPopf16Start_NoExit
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMPopf16End_NoExit - PATMPopf16Start_NoExit
-    DD      9
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_VM_FORCEDACTIONS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmPopf16Record_NoExit
+    PATCHASMRECORD_INIT PATMPopf16Replacement_NoExit, 9
+    DD      PATM_ASMFIX_INTERRUPTFLAG,    0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,    0
+    DD      PATM_ASMFIX_VM_FORCEDACTIONS, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,    0
+    DD      PATM_ASMFIX_VMFLAGS,          0
+    DD      PATM_ASMFIX_VMFLAGS,          0
+    DD      PATM_ASMFIX_VMFLAGS,          0
+    DD      PATM_ASMFIX_VMFLAGS,          0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,    0
+    DD      0ffffffffh, 0ffffffffh
 
 
+;
+;
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMPushf32Replacement
-PATMPushf32Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushfd
 %ifdef PATM_LOG_PATCHINSTR
     push    eax
     push    ecx
     mov     eax, PATM_ACTION_LOG_PUSHF
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     ecx
@@ -1077,45 +1037,36 @@ PATMPushf32Start:
     push    eax
     mov     eax, dword [esp+8]
     and     eax, PATM_FLAGS_MASK
-    or      eax, dword [ss:PATM_VMFLAGS]
+    or      eax, dword [ss:PATM_ASMFIX_VMFLAGS]
     mov     dword [esp+8], eax
     pop     eax
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMPushf32End:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMPushf32Replacement
 
-
-SECTION .data
 ; Patch record for 'pushfd'
-GLOBALNAME PATMPushf32Record
-    RTCCPTR_DEF PATMPushf32Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMPushf32End - PATMPushf32Start
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmPushf32Record
 %ifdef PATM_LOG_PATCHINSTR
-    DD      4
+    PATCHASMRECORD_INIT PATMPushf32Replacement, 4
 %else
-    DD      3
+    PATCHASMRECORD_INIT PATMPushf32Replacement, 3
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
 %ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION, 0
 %endif
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
 
+;
+;
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMPushf16Replacement
-PATMPushf16Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     DB      0x66    ; size override
     pushf
     DB      0x66    ; size override
@@ -1124,39 +1075,31 @@ PATMPushf16Start:
     xor     eax, eax
     mov     ax, word [esp+6]
     and     eax, PATM_FLAGS_MASK
-    or      eax, dword [ss:PATM_VMFLAGS]
+    or      eax, dword [ss:PATM_ASMFIX_VMFLAGS]
     mov     word [esp+6], ax
     pop     eax
 
     DB      0x66    ; size override
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMPushf16End:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC     PATMPushf16Replacement
 
-
-SECTION .data
 ; Patch record for 'pushf'
-GLOBALNAME PATMPushf16Record
-    RTCCPTR_DEF PATMPushf16Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMPushf16End - PATMPushf16Start
-    DD      3
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmPushf16Record
+    PATCHASMRECORD_INIT PATMPushf16Replacement, 3
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
 
+;
+;
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMPushCSReplacement
-PATMPushCSStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     push    cs
     pushfd
 
@@ -1169,49 +1112,42 @@ PATMPushCSStart:
 pushcs_notring1:
     popfd
 
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMPushCSJump:
-    DD      PATM_JUMPDELTA
-PATMPushCSEnd:
+    DD      PATM_ASMFIX_JUMPDELTA
 ENDPROC     PATMPushCSReplacement
 
-
-SECTION .data
 ; Patch record for 'push cs'
-GLOBALNAME PATMPushCSRecord
-    RTCCPTR_DEF PATMPushCSStart
-    DD      PATMPushCSJump - PATMPushCSStart
-    DD      0
-    DD      0
-    DD      PATMPushCSEnd - PATMPushCSStart
-    DD      2
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
-
-;;****************************************************
-;; Abstract:
-;;
-;; if eflags.NT==0 && iretstack.eflags.VM==0 && iretstack.eflags.IOPL==0
-;; then
-;;     if return to ring 0 (iretstack.new_cs & 3 == 0)
-;;     then
-;;          if iretstack.new_eflags.IF == 1 && iretstack.new_eflags.IOPL == 0
-;;          then
-;;              iretstack.new_cs |= 1
-;;          else
-;;              int 3
-;;     endif
-;;     uVMFlags &= ~X86_EFL_IF
-;;     iret
-;; else
-;;     int 3
-;;****************************************************
-;;
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmPushCSRecord
+    PATCHASMRECORD_INIT_JUMP PATMPushCSReplacement, PATMPushCSJump, 2
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
+
+
+;
+;
+;****************************************************
+; Abstract:
+;
+; if eflags.NT==0 && iretstack.eflags.VM==0 && iretstack.eflags.IOPL==0
+; then
+;     if return to ring 0 (iretstack.new_cs & 3 == 0)
+;     then
+;          if iretstack.new_eflags.IF == 1 && iretstack.new_eflags.IOPL == 0
+;          then
+;              iretstack.new_cs |= 1
+;          else
+;              int 3
+;     endif
+;     uVMFlags &= ~X86_EFL_IF
+;     iret
+; else
+;     int 3
+;****************************************************
+;
 ; Stack:
 ;
 ; esp + 32 - GS         (V86 only)
@@ -1224,9 +1160,9 @@ SECTION .text
 ; esp + 4  - CS
 ; esp      - EIP
 ;;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMIretReplacement
-PATMIretStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushfd
 
 %ifdef PATM_LOG_PATCHIRET
@@ -1235,7 +1171,7 @@ PATMIretStart:
     push    edx
     lea     edx, dword [ss:esp+12+4]        ;3 dwords + pushed flags -> iret eip
     mov     eax, PATM_ACTION_LOG_IRET
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     edx
@@ -1267,18 +1203,18 @@ iret_notring0:
 ; if interrupts are pending, then we must go back to the host context to handle them!
 ; Note: This is very important as pending pic interrupts can be overridden by apic interrupts if we don't check early enough (Fedora 5 boot)
 ; @@todo fix this properly, so we can dispatch pending interrupts in GC
-    test    dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC
+    test    dword [ss:PATM_ASMFIX_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC
     jz      iret_continue
 
 ; Go to our hypervisor trap handler to dispatch the pending irq
-    mov     dword [ss:PATM_TEMP_EAX], eax
-    mov     dword [ss:PATM_TEMP_ECX], ecx
-    mov     dword [ss:PATM_TEMP_EDI], edi
-    mov     dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], eax
+    mov     dword [ss:PATM_ASMFIX_TEMP_ECX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_EDI], edi
+    mov     dword [ss:PATM_ASMFIX_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
     mov     eax, PATM_ACTION_PENDING_IRQ_AFTER_IRET
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
-    mov     edi, PATM_CURINSTRADDR
+    mov     edi, PATM_ASMFIX_CURINSTRADDR
 
     popfd
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
@@ -1292,40 +1228,40 @@ iret_continue :
     push    eax
     mov     eax, dword [esp+16]
     and     eax, X86_EFL_IOPL
-    and     dword [ss:PATM_VMFLAGS], ~X86_EFL_IOPL
-    or      dword [ss:PATM_VMFLAGS], eax
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], ~X86_EFL_IOPL
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], eax
     pop     eax
     and     dword [esp+12], ~X86_EFL_IOPL
 
     ; Set IF again; below we make sure this won't cause problems.
-    or      dword [ss:PATM_VMFLAGS], X86_EFL_IF
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], X86_EFL_IF
 
     ; make sure iret is executed fully (including the iret below; cli ... iret can otherwise be interrupted)
-    mov     dword [ss:PATM_INHIBITIRQADDR], PATM_CURINSTRADDR
+    mov     dword [ss:PATM_ASMFIX_INHIBITIRQADDR], PATM_ASMFIX_CURINSTRADDR
 
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     iretd
     PATM_INT3
 
 iret_fault:
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 iret_fault1:
     nop
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 iret_clearIF:
     push    dword [esp+4]           ; eip to return to
     pushfd
     push    eax
-    push    PATM_FIXUP
+    push    PATM_ASMFIX_FIXUP
     DB      0E8h                    ; call
-    DD      PATM_IRET_FUNCTION
+    DD      PATM_ASMFIX_IRET_FUNCTION
     add     esp, 4                  ; pushed address of jump table
 
     cmp     eax, 0
@@ -1345,16 +1281,16 @@ iret_clearIF:
     push    eax
     mov     eax, dword [esp+16]
     and     eax, X86_EFL_IOPL
-    and     dword [ss:PATM_VMFLAGS], ~X86_EFL_IOPL
-    or      dword [ss:PATM_VMFLAGS], eax
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], ~X86_EFL_IOPL
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], eax
     pop     eax
     and     dword [esp+12], ~X86_EFL_IOPL
 
     ; Clear IF
-    and     dword [ss:PATM_VMFLAGS], ~X86_EFL_IF
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], ~X86_EFL_IF
     popfd
 
-                                                ; the patched destination code will set PATM_INTERRUPTFLAG after the return!
+                                                ; the patched destination code will set PATM_ASMFIX_INTERRUPTFLAG after the return!
     iretd
 
 iret_return_to_v86:
@@ -1362,11 +1298,11 @@ iret_return_to_v86:
     jz      iret_fault
 
     ; Go to our hypervisor trap handler to perform the iret to v86 code
-    mov     dword [ss:PATM_TEMP_EAX], eax
-    mov     dword [ss:PATM_TEMP_ECX], ecx
-    mov     dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], eax
+    mov     dword [ss:PATM_ASMFIX_TEMP_ECX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX
     mov     eax, PATM_ACTION_DO_V86_IRET
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
 
     popfd
@@ -1388,98 +1324,68 @@ PATMIretTable:
     DD      0                                   ; cAddresses
     TIMES PATCHJUMPTABLE_SIZE DB 0              ; lookup slots
 
-PATMIretEnd:
 ENDPROC     PATMIretReplacement
 
-SECTION .data
 ; Patch record for 'iretd'
-GLOBALNAME PATMIretRecord
-    RTCCPTR_DEF PATMIretStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMIretEnd- PATMIretStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmIretRecord
 %ifdef PATM_LOG_PATCHIRET
-    DD      26
+    PATCHASMRECORD_INIT PATMIretReplacement, 26
 %else
-    DD      25
+    PATCHASMRECORD_INIT PATMIretReplacement, 25
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
 %ifdef PATM_LOG_PATCHIRET
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
 %endif
-    DD      PATM_VM_FORCEDACTIONS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_ECX
-    DD      0
-    DD      PATM_TEMP_EDI
-    DD      0
-    DD      PATM_TEMP_RESTORE_FLAGS
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_CURINSTRADDR
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INHIBITIRQADDR
-    DD      0
-    DD      PATM_CURINSTRADDR
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_FIXUP
-    DD      PATMIretTable - PATMIretStart
-    DD      PATM_IRET_FUNCTION
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_ECX
-    DD      0
-    DD      PATM_TEMP_RESTORE_FLAGS
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      0ffffffffh
-SECTION .text
-
-;;****************************************************
-;; Abstract:
-;;
-;; if eflags.NT==0 && iretstack.eflags.VM==0 && iretstack.eflags.IOPL==0
-;; then
-;;     if return to ring 0 (iretstack.new_cs & 3 == 0)
-;;     then
-;;          if iretstack.new_eflags.IF == 1 && iretstack.new_eflags.IOPL == 0
-;;          then
-;;              iretstack.new_cs |= 1
-;;          else
-;;              int 3
-;;     endif
-;;     uVMFlags &= ~X86_EFL_IF
-;;     iret
-;; else
-;;     int 3
-;;****************************************************
-;;
+    DD      PATM_ASMFIX_VM_FORCEDACTIONS,   0
+    DD      PATM_ASMFIX_TEMP_EAX,           0
+    DD      PATM_ASMFIX_TEMP_ECX,           0
+    DD      PATM_ASMFIX_TEMP_EDI,           0
+    DD      PATM_ASMFIX_TEMP_RESTORE_FLAGS, 0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+    DD      PATM_ASMFIX_CURINSTRADDR,       0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_INHIBITIRQADDR,     0
+    DD      PATM_ASMFIX_CURINSTRADDR,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_FIXUP,              PATMIretTable - NAME(PATMIretReplacement)
+    DD      PATM_ASMFIX_IRET_FUNCTION,      0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_TEMP_EAX,           0
+    DD      PATM_ASMFIX_TEMP_ECX,           0
+    DD      PATM_ASMFIX_TEMP_RESTORE_FLAGS, 0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+    DD      0ffffffffh,              0ffffffffh
+
+
+;
+;
+;****************************************************
+; Abstract:
+;
+; if eflags.NT==0 && iretstack.eflags.VM==0 && iretstack.eflags.IOPL==0
+; then
+;     if return to ring 0 (iretstack.new_cs & 3 == 0)
+;     then
+;          if iretstack.new_eflags.IF == 1 && iretstack.new_eflags.IOPL == 0
+;          then
+;              iretstack.new_cs |= 1
+;          else
+;              int 3
+;     endif
+;     uVMFlags &= ~X86_EFL_IF
+;     iret
+; else
+;     int 3
+;****************************************************
+;
 ; Stack:
 ;
 ; esp + 32 - GS         (V86 only)
@@ -1491,10 +1397,10 @@ SECTION .text
 ; esp + 8  - EFLAGS
 ; esp + 4  - CS
 ; esp      - EIP
-;;
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMIretRing1Replacement
-PATMIretRing1Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushfd
 
 %ifdef PATM_LOG_PATCHIRET
@@ -1503,7 +1409,7 @@ PATMIretRing1Start:
     push    edx
     lea     edx, dword [ss:esp+12+4]        ;3 dwords + pushed flags -> iret eip
     mov     eax, PATM_ACTION_LOG_IRET
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
     pop     edx
@@ -1533,18 +1439,18 @@ iretring1_checkpendingirq:
 ; if interrupts are pending, then we must go back to the host context to handle them!
 ; Note: This is very important as pending pic interrupts can be overridden by apic interrupts if we don't check early enough (Fedora 5 boot)
 ; @@todo fix this properly, so we can dispatch pending interrupts in GC
-    test    dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC
+    test    dword [ss:PATM_ASMFIX_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC
     jz      iretring1_continue
 
 ; Go to our hypervisor trap handler to dispatch the pending irq
-    mov     dword [ss:PATM_TEMP_EAX], eax
-    mov     dword [ss:PATM_TEMP_ECX], ecx
-    mov     dword [ss:PATM_TEMP_EDI], edi
-    mov     dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], eax
+    mov     dword [ss:PATM_ASMFIX_TEMP_ECX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_EDI], edi
+    mov     dword [ss:PATM_ASMFIX_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX | PATM_RESTORE_EDI
     mov     eax, PATM_ACTION_PENDING_IRQ_AFTER_IRET
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
-    mov     edi, PATM_CURINSTRADDR
+    mov     edi, PATM_ASMFIX_CURINSTRADDR
 
     popfd
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
@@ -1578,40 +1484,40 @@ iretring1_notring01:
     push    eax
     mov     eax, dword [esp+16]
     and     eax, X86_EFL_IOPL
-    and     dword [ss:PATM_VMFLAGS], ~X86_EFL_IOPL
-    or      dword [ss:PATM_VMFLAGS], eax
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], ~X86_EFL_IOPL
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], eax
     pop     eax
     and     dword [esp+12], ~X86_EFL_IOPL
 
     ; Set IF again; below we make sure this won't cause problems.
-    or      dword [ss:PATM_VMFLAGS], X86_EFL_IF
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], X86_EFL_IF
 
     ; make sure iret is executed fully (including the iret below; cli ... iret can otherwise be interrupted)
-    mov     dword [ss:PATM_INHIBITIRQADDR], PATM_CURINSTRADDR
+    mov     dword [ss:PATM_ASMFIX_INHIBITIRQADDR], PATM_ASMFIX_CURINSTRADDR
 
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     iretd
     PATM_INT3
 
 iretring1_fault:
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 iretring1_fault1:
     nop
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 iretring1_clearIF:
     push    dword [esp+4]           ; eip to return to
     pushfd
     push    eax
-    push    PATM_FIXUP
+    push    PATM_ASMFIX_FIXUP
     DB      0E8h                    ; call
-    DD      PATM_IRET_FUNCTION
+    DD      PATM_ASMFIX_IRET_FUNCTION
     add     esp, 4                  ; pushed address of jump table
 
     cmp     eax, 0
@@ -1628,13 +1534,13 @@ iretring1_clearIF:
     push    eax
     mov     eax, dword [esp+16]
     and     eax, X86_EFL_IOPL
-    and     dword [ss:PATM_VMFLAGS], ~X86_EFL_IOPL
-    or      dword [ss:PATM_VMFLAGS], eax
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], ~X86_EFL_IOPL
+    or      dword [ss:PATM_ASMFIX_VMFLAGS], eax
     pop     eax
     and     dword [esp+12], ~X86_EFL_IOPL
 
     ; Clear IF
-    and     dword [ss:PATM_VMFLAGS], ~X86_EFL_IF
+    and     dword [ss:PATM_ASMFIX_VMFLAGS], ~X86_EFL_IF
     popfd
 
     test    dword [esp+8], 1
@@ -1646,13 +1552,13 @@ iretring1_clearIF:
 
     and     dword [esp+20], ~1      ; SS
     or      dword [esp+20], 2
-                                                ; the patched destination code will set PATM_INTERRUPTFLAG after the return!
+                                                ; the patched destination code will set PATM_ASMFIX_INTERRUPTFLAG after the return!
     iretd
 
 iretring1_clearIF_ring0:
     ; force ring 1 CS RPL
     or      dword [esp+8], 1
-                                                ; the patched destination code will set PATM_INTERRUPTFLAG after the return!
+                                                ; the patched destination code will set PATM_ASMFIX_INTERRUPTFLAG after the return!
     iretd
 
 iretring1_return_to_v86:
@@ -1660,11 +1566,11 @@ iretring1_return_to_v86:
     jz      iretring1_fault
 
     ; Go to our hypervisor trap handler to perform the iret to v86 code
-    mov     dword [ss:PATM_TEMP_EAX], eax
-    mov     dword [ss:PATM_TEMP_ECX], ecx
-    mov     dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], eax
+    mov     dword [ss:PATM_ASMFIX_TEMP_ECX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX
     mov     eax, PATM_ACTION_DO_V86_IRET
-    lock    or dword [ss:PATM_PENDINGACTION], eax
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], eax
     mov     ecx, PATM_ACTION_MAGIC
 
     popfd
@@ -1686,78 +1592,45 @@ PATMIretRing1Table:
     DD      0                                   ; cAddresses
     TIMES PATCHJUMPTABLE_SIZE DB 0              ; lookup slots
 
-PATMIretRing1End:
 ENDPROC     PATMIretRing1Replacement
 
-SECTION .data
 ; Patch record for 'iretd'
-GLOBALNAME PATMIretRing1Record
-    RTCCPTR_DEF PATMIretRing1Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMIretRing1End- PATMIretRing1Start
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmIretRing1Record
 %ifdef PATM_LOG_PATCHIRET
-    DD      26
+    PATCHASMRECORD_INIT PATMIretRing1Replacement, 26
 %else
-    DD      25
-%endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-%ifdef PATM_LOG_PATCHIRET
-    DD      PATM_PENDINGACTION
-    DD      0
+    PATCHASMRECORD_INIT PATMIretRing1Replacement, 25
 %endif
-    DD      PATM_VM_FORCEDACTIONS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_ECX
-    DD      0
-    DD      PATM_TEMP_EDI
-    DD      0
-    DD      PATM_TEMP_RESTORE_FLAGS
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_CURINSTRADDR
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INHIBITIRQADDR
-    DD      0
-    DD      PATM_CURINSTRADDR
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_FIXUP
-    DD      PATMIretRing1Table - PATMIretRing1Start
-    DD      PATM_IRET_FUNCTION
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_ECX
-    DD      0
-    DD      PATM_TEMP_RESTORE_FLAGS
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+%ifdef PATM_LOG_PATCHIRET            
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+%endif                               
+    DD      PATM_ASMFIX_VM_FORCEDACTIONS,   0
+    DD      PATM_ASMFIX_TEMP_EAX,           0
+    DD      PATM_ASMFIX_TEMP_ECX,           0
+    DD      PATM_ASMFIX_TEMP_EDI,           0
+    DD      PATM_ASMFIX_TEMP_RESTORE_FLAGS, 0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+    DD      PATM_ASMFIX_CURINSTRADDR,       0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_INHIBITIRQADDR,     0
+    DD      PATM_ASMFIX_CURINSTRADDR,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,      0
+    DD      PATM_ASMFIX_FIXUP,              PATMIretRing1Table - NAME(PATMIretRing1Replacement)
+    DD      PATM_ASMFIX_IRET_FUNCTION,      0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_VMFLAGS,            0
+    DD      PATM_ASMFIX_TEMP_EAX,           0
+    DD      PATM_ASMFIX_TEMP_ECX,           0
+    DD      PATM_ASMFIX_TEMP_RESTORE_FLAGS, 0
+    DD      PATM_ASMFIX_PENDINGACTION,      0
+    DD      0ffffffffh,              0ffffffffh
 
 
 ;
@@ -1770,16 +1643,15 @@ SECTION .text
 ;  +  4 Jump table address
 ;( +  0 return address )
 ;
-; @note assumes PATM_INTERRUPTFLAG is zero
+; @note assumes PATM_ASMFIX_INTERRUPTFLAG is zero
 ; @note assumes it can trash eax and eflags
 ;
 ; @returns eax=0 on failure
 ;          otherwise return address in eax
 ;
 ; @note NEVER change this without bumping the SSM version
-align 32
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMIretFunction
-PATMIretFunction_Start:
     push    ecx
     push    edx
     push    edi
@@ -1807,7 +1679,7 @@ PATMIretFunction_SearchStart:
 PATMIretFunction_AskHypervisor:
     ; 2) Query return patch address from the hypervisor
     ; @todo private ugly interface, since we have nothing generic at the moment
-    lock    or dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOOKUP_ADDRESS
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], PATM_ACTION_LOOKUP_ADDRESS
     mov     eax, PATM_ACTION_LOOKUP_ADDRESS
     mov     ecx, PATM_ACTION_MAGIC
     mov     edi, dword [esp+12+4]               ; jump table address
@@ -1823,7 +1695,7 @@ PATMIretFunction_SearchEnd:
     cmp     eax, 0
     jz      PATMIretFunction_Failure
 
-    add     eax, PATM_PATCHBASE
+    add     eax, PATM_ASMFIX_PATCHBASE
 
     pop     edi
     pop     edx
@@ -1837,112 +1709,48 @@ PATMIretFunction_Failure:
     pop     edx
     pop     ecx
     ret
-
-PATMIretFunction_End:
 ENDPROC     PATMIretFunction
 
-SECTION .data
-GLOBALNAME PATMIretFunctionRecord
-    RTCCPTR_DEF PATMIretFunction_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMIretFunction_End - PATMIretFunction_Start
-    DD      2
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_PATCHBASE
-    DD      0
-    DD      0ffffffffh
-SECTION .text
-
-
-align 32 ; yasm / nasm diff - remove me!
-BEGINPROC   PATMCpuidReplacement
-PATMCpuidStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmIretFunctionRecord
+    PATCHASMRECORD_INIT PATMIretFunction, 2
+    DD      PATM_ASMFIX_PENDINGACTION, 0
+    DD      PATM_ASMFIX_PATCHBASE,     0
+    DD      0ffffffffh, 0ffffffffh
+
+
+;
+; PATMCpuidReplacement
+;
+; Calls a helper function that does the job.
+;
+; This way we can change the CPUID structures and how we organize them without
+; breaking patches.  It also saves a bit of memory for patch code and fixups.
+;
+BEGIN_PATCH g_patmCpuidRecord, PATMCpuidReplacement
+    not     dword [esp-32]              ; probe stack before starting
+    not     dword [esp-32]
+
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
+PATCH_FIXUP PATM_ASMFIX_INTERRUPTFLAG
     pushf
 
-    cmp     eax, PATM_CPUID_STD_MAX
-    jb      cpuid_std
-    cmp     eax, 0x80000000
-    jb      cpuid_def
-    cmp     eax, PATM_CPUID_EXT_MAX
-    jb      cpuid_ext
-    cmp     eax, 0xc0000000
-    jb      cpuid_def
-    cmp     eax, PATM_CPUID_CENTAUR_MAX
-    jb      cpuid_centaur
-
-    ; Dirty assumptions in patmCorrectFixup about the pointer fixup order!!!!
-cpuid_def:
-    mov     eax, PATM_CPUID_DEF_PTR
-    jmp     cpuid_fetch
-
-cpuid_std:
-    mov     edx, PATM_CPUID_STD_PTR
-    jmp     cpuid_calc
-
-cpuid_ext:
-    and     eax, 0ffh                   ; strictly speaking not necessary.
-    mov     edx, PATM_CPUID_EXT_PTR
-    jmp     cpuid_calc
-
-cpuid_centaur:
-    and     eax, 0ffh                   ; strictly speaking not necessary.
-    mov     edx, PATM_CPUID_CENTAUR_PTR
-
-cpuid_calc:
-    lea     eax, [ss:eax * 4]              ; 4 entries...
-    lea     eax, [ss:eax * 4]              ; 4 bytes each
-    add     eax, edx
-
-cpuid_fetch:
-    mov     edx, [ss:eax + 12]             ; CPUMCPUID layout assumptions!
-    mov     ecx, [ss:eax + 8]
-    mov     ebx, [ss:eax + 4]
-    mov     eax, [ss:eax]
+    db      0e8h                        ; call
+    dd      PATM_ASMFIX_PATCH_HLP_CPUM_CPUID
+PATCH_FIXUP PATM_ASMFIX_PATCH_HLP_CPUM_CPUID
 
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-
-PATMCpuidEnd:
-ENDPROC PATMCpuidReplacement
-
-SECTION .data
-; Patch record for 'cpuid'
-GLOBALNAME PATMCpuidRecord
-    RTCCPTR_DEF PATMCpuidStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMCpuidEnd- PATMCpuidStart
-    DD      9
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_CPUID_STD_MAX
-    DD      0
-    DD      PATM_CPUID_EXT_MAX
-    DD      0
-    DD      PATM_CPUID_CENTAUR_MAX
-    DD      0
-    DD      PATM_CPUID_DEF_PTR
-    DD      0
-    DD      PATM_CPUID_STD_PTR
-    DD      0
-    DD      PATM_CPUID_EXT_PTR
-    DD      0
-    DD      PATM_CPUID_CENTAUR_PTR
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
+PATCH_FIXUP PATM_ASMFIX_INTERRUPTFLAG
+END_PATCH g_patmCpuidRecord, PATMCpuidReplacement
 
 
+;
+;
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMJEcxReplacement
-PATMJEcxStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushfd
 PATMJEcxSizeOverride:
     DB      0x90             ; nop
@@ -1950,39 +1758,32 @@ PATMJEcxSizeOverride:
     jnz     PATMJEcxContinue
 
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMJEcxJump:
-    DD      PATM_JUMPDELTA
+    DD      PATM_ASMFIX_JUMPDELTA
 
 PATMJEcxContinue:
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMJEcxEnd:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC PATMJEcxReplacement
 
-SECTION .data
 ; Patch record for 'JEcx'
-GLOBALNAME PATMJEcxRecord
-    RTCCPTR_DEF PATMJEcxStart
-    DD      0
-    DD      PATMJEcxJump - PATMJEcxStart
-    DD      PATMJEcxSizeOverride - PATMJEcxStart
-    DD      PATMJEcxEnd- PATMJEcxStart
-    DD      3
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
-
-align 32; yasm / nasm diffing. remove me!
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmJEcxRecord 
+    PATCHASMRECORD_INIT_EX PATMJEcxReplacement, , PATMJEcxJump, PATMJEcxSizeOverride, 3
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
+
+
+;
+;
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMLoopReplacement
-PATMLoopStart:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushfd
 PATMLoopSizeOverride:
     DB      0x90             ; nop
@@ -1990,41 +1791,33 @@ PATMLoopSizeOverride:
     jz      PATMLoopContinue
 
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMLoopJump:
-    DD      PATM_JUMPDELTA
+    DD      PATM_ASMFIX_JUMPDELTA
 
 PATMLoopContinue:
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMLoopEnd:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC PATMLoopReplacement
 
-SECTION .data
 ; Patch record for 'Loop'
-GLOBALNAME PATMLoopRecord
-    RTCCPTR_DEF PATMLoopStart
-    DD      0
-    DD      PATMLoopJump - PATMLoopStart
-    DD      PATMLoopSizeOverride - PATMLoopStart
-    DD      PATMLoopEnd- PATMLoopStart
-    DD      3
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmLoopRecord
+    PATCHASMRECORD_INIT_EX PATMLoopReplacement, , PATMLoopJump, PATMLoopSizeOverride, 3
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
-BEGINPROC   PATMLoopZReplacement
-PATMLoopZStart:
-    ; jump if ZF=1 AND (E)CX != 0
 
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
-    jnz     PATMLoopZEnd
+;
+; jump if ZF=1 AND (E)CX != 0
+;
+BEGIN_PATCH_CODE_SECTION
+BEGINPROC   PATMLoopZReplacement
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
+    jnz     NAME(PATMLoopZReplacement_EndProc)
     pushfd
 PATMLoopZSizeOverride:
     DB      0x90             ; nop
@@ -2032,42 +1825,33 @@ PATMLoopZSizeOverride:
     jz      PATMLoopZContinue
 
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMLoopZJump:
-    DD      PATM_JUMPDELTA
+    DD      PATM_ASMFIX_JUMPDELTA
 
 PATMLoopZContinue:
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMLoopZEnd:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC PATMLoopZReplacement
 
-SECTION .data
 ; Patch record for 'Loopz'
-GLOBALNAME PATMLoopZRecord
-    RTCCPTR_DEF PATMLoopZStart
-    DD      0
-    DD      PATMLoopZJump - PATMLoopZStart
-    DD      PATMLoopZSizeOverride - PATMLoopZStart
-    DD      PATMLoopZEnd- PATMLoopZStart
-    DD      3
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmLoopZRecord
+    PATCHASMRECORD_INIT_EX PATMLoopZReplacement, , PATMLoopZJump, PATMLoopZSizeOverride, 3
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
 
+;
+; jump if ZF=0 AND (E)CX != 0
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMLoopNZReplacement
-PATMLoopNZStart:
-    ; jump if ZF=0 AND (E)CX != 0
-
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
-    jz      PATMLoopNZEnd
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
+    jz      NAME(PATMLoopNZReplacement_EndProc)
     pushfd
 PATMLoopNZSizeOverride:
     DB      0x90             ; nop
@@ -2075,38 +1859,29 @@ PATMLoopNZSizeOverride:
     jz      PATMLoopNZContinue
 
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMLoopNZJump:
-    DD      PATM_JUMPDELTA
+    DD      PATM_ASMFIX_JUMPDELTA
 
 PATMLoopNZContinue:
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-PATMLoopNZEnd:
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
 ENDPROC PATMLoopNZReplacement
 
-SECTION .data
 ; Patch record for 'LoopNZ'
-GLOBALNAME PATMLoopNZRecord
-    RTCCPTR_DEF PATMLoopNZStart
-    DD      0
-    DD      PATMLoopNZJump - PATMLoopNZStart
-    DD      PATMLoopNZSizeOverride - PATMLoopNZStart
-    DD      PATMLoopNZEnd- PATMLoopNZStart
-    DD      3
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmLoopNZRecord
+    PATCHASMRECORD_INIT_EX PATMLoopNZReplacement, , PATMLoopNZJump, PATMLoopNZSizeOverride, 3
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
 
-align 32
+
+;
 ; Global patch function for indirect calls
-; Caller is responsible for clearing PATM_INTERRUPTFLAG and doing:
+; Caller is responsible for clearing PATM_ASMFIX_INTERRUPTFLAG and doing:
 ;  + 20 push    [pTargetGC]
 ;  + 16 pushfd
 ;  + 12 push    [JumpTableAddress]
@@ -2115,15 +1890,16 @@ align 32
 ;( +  0 return address )
 ;
 ; @note NEVER change this without bumping the SSM version
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC PATMLookupAndCall
-PATMLookupAndCallStart:
     push    eax
     push    edx
     push    edi
     push    ecx
 
     mov     eax, dword [esp+16+4]                   ; guest return address
-    mov     dword [ss:PATM_CALL_RETURN_ADDR], eax                               ; temporary storage
+    mov     dword [ss:PATM_ASMFIX_CALL_RETURN_ADDR], eax                               ; temporary storage
 
     mov     edx, dword [esp+16+20]  ; pushed target address
 
@@ -2143,7 +1919,7 @@ PATMLookupAndCall_SearchStart:
 PATMLookupAndCall_QueryPATM:
     ; nothing found -> let our trap handler try to find it
     ; @todo private ugly interface, since we have nothing generic at the moment
-    lock    or  dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOOKUP_ADDRESS
+    lock    or  dword [ss:PATM_ASMFIX_PENDINGACTION], PATM_ACTION_LOOKUP_ADDRESS
     mov     eax, PATM_ACTION_LOOKUP_ADDRESS
     mov     ecx, PATM_ACTION_MAGIC
     ; edx = GC address to find
@@ -2170,9 +1946,9 @@ PATMLookupAndCall_SearchEnd:
     je      near PATMLookupAndCall_Failure
 
     mov     ecx, eax                            ; ECX = target address (relative!)
-    add     ecx, PATM_PATCHBASE                 ; Make it absolute
+    add     ecx, PATM_ASMFIX_PATCHBASE                 ; Make it absolute
 
-    mov     edx, dword PATM_STACKPTR
+    mov     edx, dword PATM_ASMFIX_STACKPTR
     cmp     dword [ss:edx], PATM_STACK_SIZE
     ja      near PATMLookupAndCall_Failure                    ; should never happen actually!!!
     cmp     dword [ss:edx], 0
@@ -2180,18 +1956,18 @@ PATMLookupAndCall_SearchEnd:
 
     ; save the patch return address on our private stack
     sub     dword [ss:edx], 4                   ; sizeof(RTGCPTR)
-    mov     eax, dword PATM_STACKBASE
+    mov     eax, dword PATM_ASMFIX_STACKBASE
     add     eax, dword [ss:edx]                 ; stack base + stack position
     mov     edi, dword [esp+16+8]               ; PATM return address
     mov     dword [ss:eax], edi                 ; relative address of patch return (instruction following this block)
 
     ; save the original return address as well (checked by ret to make sure the guest hasn't messed around with the stack)
-    mov     edi, dword PATM_STACKBASE_GUEST
+    mov     edi, dword PATM_ASMFIX_STACKBASE_GUEST
     add     edi, dword [ss:edx]                 ; stack base (guest) + stack position
     mov     eax, dword [esp+16+4]               ; guest return address
     mov     dword [ss:edi], eax
 
-    mov     dword [ss:PATM_CALL_PATCH_TARGET_ADDR], ecx       ; temporarily store the target address
+    mov     dword [ss:PATM_ASMFIX_CALL_PATCH_TARGET_ADDR], ecx       ; temporarily store the target address
     pop     ecx
     pop     edi
     pop     edx
@@ -2203,7 +1979,7 @@ PATMLookupAndCall_SearchEnd:
     push    ecx
     push    edx
     lea     edx, [esp + 12 - 4]                 ; stack address to store return address
-    lock    or dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOG_CALL
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], PATM_ACTION_LOG_CALL
     mov     eax, PATM_ACTION_LOG_CALL
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
@@ -2212,65 +1988,48 @@ PATMLookupAndCall_SearchEnd:
     pop     eax
 %endif
 
-    push    dword [ss:PATM_CALL_RETURN_ADDR]   ; push original guest return address
-
-    ; the called function will set PATM_INTERRUPTFLAG (!!)
-    jmp     dword [ss:PATM_CALL_PATCH_TARGET_ADDR]
+    push    dword [ss:PATM_ASMFIX_CALL_RETURN_ADDR]   ; push original guest return address
 
-PATMLookupAndCallEnd:
-; returning here -> do not add code here or after the jmp!!!!!
+    ; the called function will set PATM_ASMFIX_INTERRUPTFLAG (!!)
+    jmp     dword [ss:PATM_ASMFIX_CALL_PATCH_TARGET_ADDR]
+    ; returning here -> do not add code here or after the jmp!!!!!
 ENDPROC PATMLookupAndCall
 
-SECTION .data
 ; Patch record for indirect calls and jumps
-GLOBALNAME PATMLookupAndCallRecord
-    RTCCPTR_DEF PATMLookupAndCallStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMLookupAndCallEnd - PATMLookupAndCallStart
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmLookupAndCallRecord
 %ifdef PATM_LOG_PATCHINSTR
-    DD      10
+    PATCHASMRECORD_INIT PATMLookupAndCall, 10
 %else
-    DD      9
+    PATCHASMRECORD_INIT PATMLookupAndCall, 9
 %endif
-    DD      PATM_CALL_RETURN_ADDR
-    DD      0
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_PATCHBASE
-    DD      0
-    DD      PATM_STACKPTR
-    DD      0
-    DD      PATM_STACKBASE
-    DD      0
-    DD      PATM_STACKBASE_GUEST
-    DD      0
-    DD      PATM_CALL_PATCH_TARGET_ADDR
-    DD      0
-%ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
-%endif
-    DD      PATM_CALL_RETURN_ADDR
-    DD      0
-    DD      PATM_CALL_PATCH_TARGET_ADDR
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_CALL_RETURN_ADDR,       0
+    DD      PATM_ASMFIX_PENDINGACTION,          0
+    DD      PATM_ASMFIX_PATCHBASE,              0
+    DD      PATM_ASMFIX_STACKPTR,               0
+    DD      PATM_ASMFIX_STACKBASE,              0
+    DD      PATM_ASMFIX_STACKBASE_GUEST,        0
+    DD      PATM_ASMFIX_CALL_PATCH_TARGET_ADDR, 0
+%ifdef PATM_LOG_PATCHINSTR               
+    DD      PATM_ASMFIX_PENDINGACTION,          0
+%endif                                   
+    DD      PATM_ASMFIX_CALL_RETURN_ADDR,       0
+    DD      PATM_ASMFIX_CALL_PATCH_TARGET_ADDR, 0
+    DD      0ffffffffh, 0ffffffffh
 
 
-align 32
+;
 ; Global patch function for indirect jumps
-; Caller is responsible for clearing PATM_INTERRUPTFLAG and doing:
+; Caller is responsible for clearing PATM_ASMFIX_INTERRUPTFLAG and doing:
 ;  +  8 push    [pTargetGC]
 ;  +  4 push    [JumpTableAddress]
 ;( +  0 return address )
-; And saving eflags in PATM_TEMP_EFLAGS
+; And saving eflags in PATM_ASMFIX_TEMP_EFLAGS
 ;
 ; @note NEVER change this without bumping the SSM version
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC PATMLookupAndJump
-PATMLookupAndJumpStart:
     push    eax
     push    edx
     push    edi
@@ -2294,7 +2053,7 @@ PATMLookupAndJump_SearchStart:
 PATMLookupAndJump_QueryPATM:
     ; nothing found -> let our trap handler try to find it
     ; @todo private ugly interface, since we have nothing generic at the moment
-    lock    or dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOOKUP_ADDRESS
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], PATM_ACTION_LOOKUP_ADDRESS
     mov     eax, PATM_ACTION_LOOKUP_ADDRESS
     mov     ecx, PATM_ACTION_MAGIC
     ; edx = GC address to find
@@ -2321,73 +2080,57 @@ PATMLookupAndJump_SearchEnd:
     je      near PATMLookupAndJump_Failure
 
     mov     ecx, eax                            ; ECX = target address (relative!)
-    add     ecx, PATM_PATCHBASE                 ; Make it absolute
+    add     ecx, PATM_ASMFIX_PATCHBASE                 ; Make it absolute
 
     ; save jump patch target
-    mov     dword [ss:PATM_TEMP_EAX], ecx
+    mov     dword [ss:PATM_ASMFIX_TEMP_EAX], ecx
     pop     ecx
     pop     edi
     pop     edx
     pop     eax
     add     esp, 12                             ; parameters + return address pushed by caller
     ; restore flags (just to be sure)
-    push    dword [ss:PATM_TEMP_EFLAGS]
+    push    dword [ss:PATM_ASMFIX_TEMP_EFLAGS]
     popfd
 
-    ; the jump destination will set PATM_INTERRUPTFLAG (!!)
-    jmp     dword [ss:PATM_TEMP_EAX]                      ; call duplicated patch destination address
-
-PATMLookupAndJumpEnd:
+    ; the jump destination will set PATM_ASMFIX_INTERRUPTFLAG (!!)
+    jmp     dword [ss:PATM_ASMFIX_TEMP_EAX]                      ; call duplicated patch destination address
 ENDPROC PATMLookupAndJump
 
-SECTION .data
 ; Patch record for indirect calls and jumps
-GLOBALNAME PATMLookupAndJumpRecord
-    RTCCPTR_DEF PATMLookupAndJumpStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMLookupAndJumpEnd - PATMLookupAndJumpStart
-    DD      5
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_PATCHBASE
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      PATM_TEMP_EFLAGS
-    DD      0
-    DD      PATM_TEMP_EAX
-    DD      0
-    DD      0ffffffffh
-SECTION .text
-
-
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmLookupAndJumpRecord
+    PATCHASMRECORD_INIT PATMLookupAndJump, 5
+    DD      PATM_ASMFIX_PENDINGACTION, 0
+    DD      PATM_ASMFIX_PATCHBASE,     0
+    DD      PATM_ASMFIX_TEMP_EAX,      0
+    DD      PATM_ASMFIX_TEMP_EFLAGS,   0
+    DD      PATM_ASMFIX_TEMP_EAX,      0
+    DD      0ffffffffh, 0ffffffffh
 
 
-align 32
 ; Patch function for static calls
 ; @note static calls have only one lookup slot!
-; Caller is responsible for clearing PATM_INTERRUPTFLAG and adding:
+; Caller is responsible for clearing PATM_ASMFIX_INTERRUPTFLAG and adding:
 ;   push    [pTargetGC]
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC PATMCall
-PATMCallStart:
     pushfd
-    push    PATM_FIXUP              ; fixup for jump table below
-    push    PATM_PATCHNEXTBLOCK
-    push    PATM_RETURNADDR
+    push    PATM_ASMFIX_FIXUP              ; fixup for jump table below
+    push    PATM_ASMFIX_PATCHNEXTBLOCK
+    push    PATM_ASMFIX_RETURNADDR
     DB      0E8h                    ; call
-    DD      PATM_LOOKUP_AND_CALL_FUNCTION
+    DD      PATM_ASMFIX_LOOKUP_AND_CALL_FUNCTION
     ; we only return in case of a failure
     add     esp, 12                 ; pushed address of jump table
     popfd
     add     esp, 4                  ; pushed by caller (changes the flags, but that shouldn't matter (@todo))
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 %ifdef DEBUG
     ; for disassembly
-    jmp     PATMCallEnd
+    jmp     NAME(PATMCall_EndProc)
 %endif
 
 align   4
@@ -2397,55 +2140,42 @@ PATMCallTable:
     DD      0                                   ; cAddresses
     TIMES PATCHDIRECTJUMPTABLE_SIZE DB 0        ; only one lookup slot
 
-PATMCallEnd:
-; returning here -> do not add code here or after the jmp!!!!!
+    ; returning here -> do not add code here or after the jmp!!!!!
 ENDPROC PATMCall
 
-SECTION .data
 ; Patch record for direct calls
-GLOBALNAME PATMCallRecord
-    RTCCPTR_DEF PATMCallStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMCallEnd - PATMCallStart
-    DD      5
-    DD      PATM_FIXUP
-    DD      PATMCallTable - PATMCallStart
-    DD      PATM_PATCHNEXTBLOCK
-    DD      0
-    DD      PATM_RETURNADDR
-    DD      0
-    DD      PATM_LOOKUP_AND_CALL_FUNCTION
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmCallRecord
+    PATCHASMRECORD_INIT PATMCall, 5
+    DD      PATM_ASMFIX_FIXUP,                     PATMCallTable - NAME(PATMCall)
+    DD      PATM_ASMFIX_PATCHNEXTBLOCK,            0
+    DD      PATM_ASMFIX_RETURNADDR,                0
+    DD      PATM_ASMFIX_LOOKUP_AND_CALL_FUNCTION,  0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,             0
+    DD      0ffffffffh, 0ffffffffh
 
 
-align 32
 ; Patch function for indirect calls
-; Caller is responsible for clearing PATM_INTERRUPTFLAG and adding:
+; Caller is responsible for clearing PATM_ASMFIX_INTERRUPTFLAG and adding:
 ;   push    [pTargetGC]
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC PATMCallIndirect
-PATMCallIndirectStart:
     pushfd
-    push    PATM_FIXUP              ; fixup for jump table below
-    push    PATM_PATCHNEXTBLOCK
-    push    PATM_RETURNADDR
+    push    PATM_ASMFIX_FIXUP              ; fixup for jump table below
+    push    PATM_ASMFIX_PATCHNEXTBLOCK
+    push    PATM_ASMFIX_RETURNADDR
     DB      0E8h                    ; call
-    DD      PATM_LOOKUP_AND_CALL_FUNCTION
+    DD      PATM_ASMFIX_LOOKUP_AND_CALL_FUNCTION
     ; we only return in case of a failure
     add     esp, 12                 ; pushed address of jump table
     popfd
     add     esp, 4                  ; pushed by caller (changes the flags, but that shouldn't matter (@todo))
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 %ifdef DEBUG
     ; for disassembly
-    jmp     PATMCallIndirectEnd
+    jmp     NAME(PATMCallIndirect_EndProc)
 %endif
 
 align   4
@@ -2455,60 +2185,48 @@ PATMCallIndirectTable:
     DD      0                                   ; cAddresses
     TIMES PATCHJUMPTABLE_SIZE DB 0              ; lookup slots
 
-PATMCallIndirectEnd:
-; returning here -> do not add code here or after the jmp!!!!!
+    ; returning here -> do not add code here or after the jmp!!!!!
 ENDPROC PATMCallIndirect
 
-SECTION .data
 ; Patch record for indirect calls
-GLOBALNAME PATMCallIndirectRecord
-    RTCCPTR_DEF PATMCallIndirectStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMCallIndirectEnd - PATMCallIndirectStart
-    DD      5
-    DD      PATM_FIXUP
-    DD      PATMCallIndirectTable - PATMCallIndirectStart
-    DD      PATM_PATCHNEXTBLOCK
-    DD      0
-    DD      PATM_RETURNADDR
-    DD      0
-    DD      PATM_LOOKUP_AND_CALL_FUNCTION
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmCallIndirectRecord
+    PATCHASMRECORD_INIT PATMCallIndirect, 5
+    DD      PATM_ASMFIX_FIXUP,                     PATMCallIndirectTable - NAME(PATMCallIndirect)
+    DD      PATM_ASMFIX_PATCHNEXTBLOCK,            0
+    DD      PATM_ASMFIX_RETURNADDR,                0
+    DD      PATM_ASMFIX_LOOKUP_AND_CALL_FUNCTION,  0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,             0
+    DD      0ffffffffh, 0ffffffffh
 
 
-align 32
+;
 ; Patch function for indirect jumps
-; Caller is responsible for clearing PATM_INTERRUPTFLAG and adding:
+; Caller is responsible for clearing PATM_ASMFIX_INTERRUPTFLAG and adding:
 ;   push    [pTargetGC]
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC PATMJumpIndirect
-PATMJumpIndirectStart:
     ; save flags (just to be sure)
     pushfd
-    pop     dword [ss:PATM_TEMP_EFLAGS]
+    pop     dword [ss:PATM_ASMFIX_TEMP_EFLAGS]
 
-    push    PATM_FIXUP              ; fixup for jump table below
+    push    PATM_ASMFIX_FIXUP              ; fixup for jump table below
     DB      0E8h                    ; call
-    DD      PATM_LOOKUP_AND_JUMP_FUNCTION
+    DD      PATM_ASMFIX_LOOKUP_AND_JUMP_FUNCTION
     ; we only return in case of a failure
     add     esp, 8                  ; pushed address of jump table + pushed target address
 
     ; restore flags (just to be sure)
-    push    dword [ss:PATM_TEMP_EFLAGS]
+    push    dword [ss:PATM_ASMFIX_TEMP_EFLAGS]
     popfd
 
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 %ifdef DEBUG
     ; for disassembly
-    jmp     PATMJumpIndirectEnd
+    jmp     NAME(PATMJumpIndirect_EndProc)
 %endif
 
 align   4
@@ -2518,47 +2236,35 @@ PATMJumpIndirectTable:
     DD      0                                   ; cAddresses
     TIMES PATCHJUMPTABLE_SIZE DB 0              ; lookup slots
 
-PATMJumpIndirectEnd:
-; returning here -> do not add code here or after the jmp!!!!!
+    ; returning here -> do not add code here or after the jmp!!!!!
 ENDPROC PATMJumpIndirect
 
-SECTION .data
 ; Patch record for indirect jumps
-GLOBALNAME PATMJumpIndirectRecord
-    RTCCPTR_DEF PATMJumpIndirectStart
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMJumpIndirectEnd - PATMJumpIndirectStart
-    DD      5
-    DD      PATM_TEMP_EFLAGS
-    DD      0
-    DD      PATM_FIXUP
-    DD      PATMJumpIndirectTable - PATMJumpIndirectStart
-    DD      PATM_LOOKUP_AND_JUMP_FUNCTION
-    DD      0
-    DD      PATM_TEMP_EFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmJumpIndirectRecord
+    PATCHASMRECORD_INIT PATMJumpIndirect, 5
+    DD      PATM_ASMFIX_TEMP_EFLAGS,               0
+    DD      PATM_ASMFIX_FIXUP,                     PATMJumpIndirectTable - NAME(PATMJumpIndirect)
+    DD      PATM_ASMFIX_LOOKUP_AND_JUMP_FUNCTION,  0
+    DD      PATM_ASMFIX_TEMP_EFLAGS,               0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,             0
+    DD      0ffffffffh, 0ffffffffh
+
 
 ;
 ; return from duplicated function
 ;
-align 32
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMRet
-PATMRet_Start:
     ; probe stack here as we can't recover from page faults later on
     not     dword [esp-32]
     not     dword [esp-32]
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushfd
     push    eax
-    push    PATM_FIXUP
+    push    PATM_ASMFIX_FIXUP
     DB      0E8h                    ; call
-    DD      PATM_RETURN_FUNCTION
+    DD      PATM_ASMFIX_RETURN_FUNCTION
     add     esp, 4                  ; pushed address of jump table
 
     cmp     eax, 0
@@ -2566,7 +2272,7 @@ PATMRet_Start:
 
     pop     eax
     popfd
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 %ifdef DEBUG
@@ -2585,28 +2291,18 @@ PATMRet_Success:
     pop     eax
     popf
                                                 ; caller will duplicate the ret or ret n instruction
-                                                ; the patched call will set PATM_INTERRUPTFLAG after the return!
-PATMRet_End:
+                                                ; the patched call will set PATM_ASMFIX_INTERRUPTFLAG after the return!
 ENDPROC     PATMRet
 
-SECTION .data
-GLOBALNAME PATMRetRecord
-    RTCCPTR_DEF PATMRet_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMRet_End - PATMRet_Start
-    DD      4
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_FIXUP
-    DD      PATMRetTable - PATMRet_Start
-    DD      PATM_RETURN_FUNCTION
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmRetRecord
+    PATCHASMRECORD_INIT PATMRet, 4
+    DD      PATM_ASMFIX_INTERRUPTFLAG,   0
+    DD      PATM_ASMFIX_FIXUP,           PATMRetTable - NAME(PATMRet)
+    DD      PATM_ASMFIX_RETURN_FUNCTION, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG,   0
+    DD      0ffffffffh, 0ffffffffh
+
 
 ;
 ; global function for implementing 'retn'
@@ -2618,16 +2314,16 @@ SECTION .text
 ;  +  4 Jump table address
 ;( +  0 return address )
 ;
-; @note assumes PATM_INTERRUPTFLAG is zero
+; @note assumes PATM_ASMFIX_INTERRUPTFLAG is zero
 ; @note assumes it can trash eax and eflags
 ;
 ; @returns eax=0 on failure
 ;          otherwise return address in eax
 ;
 ; @note NEVER change this without bumping the SSM version
-align 32
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMRetFunction
-PATMRetFunction_Start:
     push    ecx
     push    edx
     push    edi
@@ -2640,13 +2336,13 @@ PATMRetFunction_Start:
 
 
     ; 1) Check if the return patch address was pushed on the PATM stack
-    cmp     dword [ss:PATM_STACKPTR], PATM_STACK_SIZE
+    cmp     dword [ss:PATM_ASMFIX_STACKPTR], PATM_STACK_SIZE
     jae     near PATMRetFunction_FindReturnAddress
 
-    mov     edx, dword PATM_STACKPTR
+    mov     edx, dword PATM_ASMFIX_STACKPTR
 
     ; check if the return address is what we expect it to be
-    mov     eax, dword PATM_STACKBASE_GUEST
+    mov     eax, dword PATM_ASMFIX_STACKBASE_GUEST
     add     eax, dword [ss:edx]                 ; stack base + stack position
     mov     eax, dword [ss:eax]                 ; original return address
     cmp     eax, dword [esp+12+16]              ; pushed return address
@@ -2656,10 +2352,10 @@ PATMRetFunction_Start:
     jne     near PATMRetFunction_FindReturnAddress
 
     ; found it, convert relative to absolute patch address and return the result to the caller
-    mov     eax, dword PATM_STACKBASE
+    mov     eax, dword PATM_ASMFIX_STACKBASE
     add     eax, dword [ss:edx]                 ; stack base + stack position
     mov     eax, dword [ss:eax]                 ; relative patm return address
-    add     eax, PATM_PATCHBASE
+    add     eax, PATM_ASMFIX_PATCHBASE
 
 %ifdef PATM_LOG_PATCHINSTR
     push    eax
@@ -2668,7 +2364,7 @@ PATMRetFunction_Start:
     push    edx
     mov     edx, eax                            ; return address
     lea     ebx, [esp+16+12+16]                 ; stack address containing the return address
-    lock    or dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOG_RET
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], PATM_ACTION_LOG_RET
     mov     eax, PATM_ACTION_LOG_RET
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
@@ -2705,7 +2401,7 @@ PATMRetFunction_SearchStart:
 PATMRetFunction_AskHypervisor:
     ; 3) Query return patch address from the hypervisor
     ; @todo private ugly interface, since we have nothing generic at the moment
-    lock    or dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOOKUP_ADDRESS
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], PATM_ACTION_LOOKUP_ADDRESS
     mov     eax, PATM_ACTION_LOOKUP_ADDRESS
     mov     ecx, PATM_ACTION_MAGIC
     mov     edi, dword [esp+12+4]               ; jump table address
@@ -2721,7 +2417,7 @@ PATMRetFunction_SearchEnd:
     cmp     eax, 0
     jz      PATMRetFunction_Failure
 
-    add     eax, PATM_PATCHBASE
+    add     eax, PATM_ASMFIX_PATCHBASE
 
 %ifdef PATM_LOG_PATCHINSTR
     push    eax
@@ -2730,7 +2426,7 @@ PATMRetFunction_SearchEnd:
     push    edx
     mov     edx, eax                            ; return address
     lea     ebx, [esp+16+12+16]                 ; stack address containing the return address
-    lock    or dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOG_RET
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], PATM_ACTION_LOG_RET
     mov     eax, PATM_ACTION_LOG_RET
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
@@ -2752,72 +2448,55 @@ PATMRetFunction_Failure:
     pop     edx
     pop     ecx
     ret
-
-PATMRetFunction_End:
 ENDPROC     PATMRetFunction
 
-SECTION .data
-GLOBALNAME PATMRetFunctionRecord
-    RTCCPTR_DEF PATMRetFunction_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMRetFunction_End - PATMRetFunction_Start
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmRetFunctionRecord
 %ifdef PATM_LOG_PATCHINSTR
-    DD      9
+    PATCHASMRECORD_INIT PATMRetFunction, 9
 %else
-    DD      7
+    PATCHASMRECORD_INIT PATMRetFunction, 7
 %endif
-    DD      PATM_STACKPTR
-    DD      0
-    DD      PATM_STACKPTR
-    DD      0
-    DD      PATM_STACKBASE_GUEST
-    DD      0
-    DD      PATM_STACKBASE
-    DD      0
-    DD      PATM_PATCHBASE
-    DD      0
-%ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
+    DD      PATM_ASMFIX_STACKPTR,        0
+    DD      PATM_ASMFIX_STACKPTR,        0
+    DD      PATM_ASMFIX_STACKBASE_GUEST, 0
+    DD      PATM_ASMFIX_STACKBASE,       0
+    DD      PATM_ASMFIX_PATCHBASE,       0
+%ifdef PATM_LOG_PATCHINSTR        
+    DD      PATM_ASMFIX_PENDINGACTION,   0
+%endif                            
+    DD      PATM_ASMFIX_PENDINGACTION,   0
+    DD      PATM_ASMFIX_PATCHBASE,       0
+%ifdef PATM_LOG_PATCHINSTR        
+    DD      PATM_ASMFIX_PENDINGACTION,   0
 %endif
-    DD      PATM_PENDINGACTION
-    DD      0
-    DD      PATM_PATCHBASE
-    DD      0
-%ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
-%endif
-    DD      0ffffffffh
-SECTION .text
+    DD      0ffffffffh, 0ffffffffh
 
 
 ;
 ; Jump to original instruction if IF=1
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMCheckIF
-PATMCheckIF_Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushf
-    test    dword [ss:PATM_VMFLAGS], X86_EFL_IF
+    test    dword [ss:PATM_ASMFIX_VMFLAGS], X86_EFL_IF
     jnz     PATMCheckIF_Safe
     nop
 
     ; IF=0 -> unsafe, so we must call the duplicated function (which we don't do here)
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
-    jmp     PATMCheckIF_End
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
+    jmp     NAME(PATMCheckIF_EndProc)
 
 PATMCheckIF_Safe:
     ; invalidate the PATM stack as we'll jump back to guest code
-    mov     dword [ss:PATM_STACKPTR], PATM_STACK_SIZE
+    mov     dword [ss:PATM_ASMFIX_STACKPTR], PATM_STACK_SIZE
 
 %ifdef PATM_LOG_PATCHINSTR
     push    eax
     push    ecx
-    lock    or dword [ss:PATM_PENDINGACTION], PATM_ACTION_LOG_IF1
+    lock    or dword [ss:PATM_ASMFIX_PENDINGACTION], PATM_ACTION_LOG_IF1
     mov     eax, PATM_ACTION_LOG_IF1
     mov     ecx, PATM_ACTION_MAGIC
     db      0fh, 0bh        ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap)
@@ -2825,94 +2504,73 @@ PATMCheckIF_Safe:
     pop     eax
 %endif
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     ; IF=1 -> we can safely jump back to the original instruction
     DB      0xE9
 PATMCheckIF_Jump:
-    DD      PATM_JUMPDELTA
-PATMCheckIF_End:
+    DD      PATM_ASMFIX_JUMPDELTA
 ENDPROC     PATMCheckIF
 
-SECTION .data
 ; Patch record for call instructions
-GLOBALNAME PATMCheckIFRecord
-    RTCCPTR_DEF PATMCheckIF_Start
-    DD      PATMCheckIF_Jump - PATMCheckIF_Start
-    DD      0
-    DD      0
-    DD      PATMCheckIF_End - PATMCheckIF_Start
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmCheckIFRecord
 %ifdef PATM_LOG_PATCHINSTR
-    DD      6
+    PATCHASMRECORD_INIT_JUMP PATMCheckIF, PATMCheckIF_Jump, 6
 %else
-    DD      5
+    PATCHASMRECORD_INIT_JUMP PATMCheckIF, PATMCheckIF_Jump, 5
 %endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_STACKPTR
-    DD      0
-%ifdef PATM_LOG_PATCHINSTR
-    DD      PATM_PENDINGACTION
-    DD      0
-%endif
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_STACKPTR,      0
+%ifdef PATM_LOG_PATCHINSTR      
+    DD      PATM_ASMFIX_PENDINGACTION, 0
+%endif                          
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
+
 
 ;
 ; Jump back to guest if IF=1, else fault
 ;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC   PATMJumpToGuest_IF1
-PATMJumpToGuest_IF1_Start:
-    mov     dword [ss:PATM_INTERRUPTFLAG], 0
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 0
     pushf
-    test    dword [ss:PATM_VMFLAGS], X86_EFL_IF
+    test    dword [ss:PATM_ASMFIX_VMFLAGS], X86_EFL_IF
     jnz     PATMJumpToGuest_IF1_Safe
     nop
 
     ; IF=0 -> unsafe, so fault
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     PATM_INT3
 
 PATMJumpToGuest_IF1_Safe:
     ; IF=1 -> we can safely jump back to the original instruction
     popf
-    mov     dword [ss:PATM_INTERRUPTFLAG], 1
+    mov     dword [ss:PATM_ASMFIX_INTERRUPTFLAG], 1
     DB      0xE9
 PATMJumpToGuest_IF1_Jump:
-    DD      PATM_JUMPDELTA
-PATMJumpToGuest_IF1_End:
+    DD      PATM_ASMFIX_JUMPDELTA
 ENDPROC     PATMJumpToGuest_IF1
 
-SECTION .data
 ; Patch record for call instructions
+BEGIN_PATCH_RODATA_SECTION
 GLOBALNAME PATMJumpToGuest_IF1Record
-    RTCCPTR_DEF PATMJumpToGuest_IF1_Start
-    DD      PATMJumpToGuest_IF1_Jump - PATMJumpToGuest_IF1_Start
-    DD      0
-    DD      0
-    DD      PATMJumpToGuest_IF1_End - PATMJumpToGuest_IF1_Start
-    DD      4
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_VMFLAGS
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      PATM_INTERRUPTFLAG
-    DD      0
-    DD      0ffffffffh
-SECTION .text
-
-
-; check and correct RPL of pushed ss
+    PATCHASMRECORD_INIT_JUMP PATMJumpToGuest_IF1, PATMJumpToGuest_IF1_Jump, 4
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_VMFLAGS,       0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      PATM_ASMFIX_INTERRUPTFLAG, 0
+    DD      0ffffffffh, 0ffffffffh
+
+
+;
+; Check and correct RPL of pushed ss.
+;
+BEGIN_PATCH_CODE_SECTION
 BEGINPROC PATMMovFromSS
-PATMMovFromSS_Start:
     push    eax
     pushfd
     mov     ax, ss
@@ -2924,24 +2582,18 @@ PATMMovFromSS_Start:
 PATMMovFromSS_Continue:
     popfd
     pop     eax
-PATMMovFromSS_Start_End:
 ENDPROC PATMMovFromSS
 
-SECTION .data
-GLOBALNAME PATMMovFromSSRecord
-    RTCCPTR_DEF PATMMovFromSS_Start
-    DD      0
-    DD      0
-    DD      0
-    DD      PATMMovFromSS_Start_End - PATMMovFromSS_Start
-    DD      0
-    DD      0ffffffffh
+BEGIN_PATCH_RODATA_SECTION
+GLOBALNAME g_patmMovFromSSRecord
+    PATCHASMRECORD_INIT PATMMovFromSS, 0
+    DD      0ffffffffh, 0ffffffffh
 
 
 
 
-SECTION .rodata
-; For assertion during init (to make absolutely sure the flags are in sync in vm.mac & vm.h)
-GLOBALNAME PATMInterruptFlag
+;; For assertion during init (to make absolutely sure the flags are in sync in vm.mac & vm.h)
+BEGINCONST
+GLOBALNAME g_fPatmInterruptFlag
     DD      VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST
 
diff --git a/src/VBox/VMM/VMMR3/PATMA.mac b/src/VBox/VMM/VMMR3/PATMA.mac
index 7dd3185..086049b 100644
--- a/src/VBox/VMM/VMMR3/PATMA.mac
+++ b/src/VBox/VMM/VMMR3/PATMA.mac
@@ -1,10 +1,10 @@
 ; $Id: PATMA.mac $
 ;; @file
-; PATM macros & definitions (identical to PATMA.h!!)
+; PATM macros & definitions (identical to PATMA.h!).
 ;
 
 ;
-; Copyright (C) 2006-2010 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -18,65 +18,76 @@
 ; hardcoded dependency on single byte int 3
 %define PATM_INT3            int3
 
-%define PATM_VMFLAGS         0xF1ABCD00
+;; @name Patch Fixup Types
+; @remarks These fixups types are part of the saved state.
+; @{
+%define PATM_ASMFIX_VMFLAGS                     0xF1ABCD00
 %ifdef VBOX_WITH_STATISTICS
-%define PATM_ALLPATCHCALLS   0xF1ABCD01
-%define PATM_PERPATCHCALLS   0xF1ABCD02
+ %define PATM_ASMFIX_ALLPATCHCALLS              0xF1ABCD01
+ %define PATM_ASMFIX_PERPATCHCALLS              0xF1ABCD02
 %endif
-%define PATM_JUMPDELTA       0xF1ABCD03
+%define PATM_ASMFIX_JUMPDELTA                   0xF1ABCD03
 %ifdef VBOX_WITH_STATISTICS
-%define PATM_IRETEFLAGS      0xF1ABCD04
-%define PATM_IRETCS          0xF1ABCD05
-%define PATM_IRETEIP         0xF1ABCD06
+ %define PATM_ASMFIX_IRETEFLAGS                 0xF1ABCD04
+ %define PATM_ASMFIX_IRETCS                     0xF1ABCD05
+ %define PATM_ASMFIX_IRETEIP                    0xF1ABCD06
 %endif
-%define PATM_FIXUP           0xF1ABCD07
-%define PATM_PENDINGACTION   0xF1ABCD08
-%define PATM_CPUID_STD_PTR   0xF1ABCD09
-%define PATM_CPUID_EXT_PTR   0xF1ABCD0a
-%define PATM_CPUID_DEF_PTR   0xF1ABCD0b
-%define PATM_STACKBASE       0xF1ABCD0c    ;/** Stack to store our private patch return addresses */
-%define PATM_STACKBASE_GUEST 0xF1ABCD0d    ;/** Stack to store guest return addresses */
-%define PATM_STACKPTR        0xF1ABCD0e
-%define PATM_PATCHBASE       0xF1ABCD0f
-%define PATM_INTERRUPTFLAG   0xF1ABCD10
-%define PATM_INHIBITIRQADDR  0xF1ABCD11
-%define PATM_VM_FORCEDACTIONS  0xF1ABCD12
-%define PATM_TEMP_EAX                           0xF1ABCD13      ;/** Location for original EAX register */
-%define PATM_TEMP_ECX                           0xF1ABCD14      ;/** Location for original ECX register */
-%define PATM_TEMP_EDI                           0xF1ABCD15      ;/** Location for original EDI register */
-%define PATM_TEMP_EFLAGS                        0xF1ABCD16      ;/** Location for original eflags */
-%define PATM_TEMP_RESTORE_FLAGS                 0xF1ABCD17      ;/** Which registers to restore */
-%define PATM_CALL_PATCH_TARGET_ADDR             0xF1ABCD18
-%define PATM_CALL_RETURN_ADDR                   0xF1ABCD19
-%define PATM_CPUID_CENTAUR_PTR                  0xF1ABCD1A
+%define PATM_ASMFIX_FIXUP                       0xF1ABCD07
+%define PATM_ASMFIX_PENDINGACTION               0xF1ABCD08
+%define PATM_ASMFIX_CPUID_STD_PTR               0xF1ABCD09
+%define PATM_ASMFIX_CPUID_EXT_PTR               0xF1ABCD0a
+%define PATM_ASMFIX_CPUID_DEF_PTR               0xF1ABCD0b
+%define PATM_ASMFIX_STACKBASE                   0xF1ABCD0c  ;;< Stack to store our private patch return addresses
+%define PATM_ASMFIX_STACKBASE_GUEST             0xF1ABCD0d  ;;< Stack to store guest return addresses
+%define PATM_ASMFIX_STACKPTR                    0xF1ABCD0e
+%define PATM_ASMFIX_PATCHBASE                   0xF1ABCD0f
+%define PATM_ASMFIX_INTERRUPTFLAG               0xF1ABCD10
+%define PATM_ASMFIX_INHIBITIRQADDR              0xF1ABCD11
+%define PATM_ASMFIX_VM_FORCEDACTIONS            0xF1ABCD12
+%define PATM_ASMFIX_TEMP_EAX                    0xF1ABCD13  ;;< Location for original EAX register
+%define PATM_ASMFIX_TEMP_ECX                    0xF1ABCD14  ;;< Location for original ECX register
+%define PATM_ASMFIX_TEMP_EDI                    0xF1ABCD15  ;;< Location for original EDI register
+%define PATM_ASMFIX_TEMP_EFLAGS                 0xF1ABCD16  ;;< Location for original eflags
+%define PATM_ASMFIX_TEMP_RESTORE_FLAGS          0xF1ABCD17  ;;< Which registers to restore
+%define PATM_ASMFIX_CALL_PATCH_TARGET_ADDR      0xF1ABCD18
+%define PATM_ASMFIX_CALL_RETURN_ADDR            0xF1ABCD19
+%define PATM_ASMFIX_CPUID_CENTAUR_PTR           0xF1ABCD1a
+%define PATM_ASMFIX_REUSE_LATER_0               0xF1ABCD1b
+%define PATM_ASMFIX_REUSE_LATER_1               0xF1ABCD1c
+%define PATM_ASMFIX_REUSE_LATER_2               0xF1ABCD1d
+%define PATM_ASMFIX_REUSE_LATER_3               0xF1ABCD1e
+%define PATM_ASMFIX_PATCH_HLP_CPUM_CPUID        0xF1ABCD1f
 
 ;/* Anything larger doesn't require a fixup */
-%define PATM_NO_FIXUP        0xF1ABCE00
-%define PATM_CPUID_STD_MAX   0xF1ABCE00
-%define PATM_CPUID_EXT_MAX   0xF1ABCE01
-%define PATM_RETURNADDR      0xF1ABCE02
-%define PATM_PATCHNEXTBLOCK  0xF1ABCE03
-%define PATM_CALLTARGET      0xF1ABCE04    ; /* relative */
-%define PATM_NEXTINSTRADDR   0xF1ABCE05    ; /* absolute guest address of the next instruction */
-%define PATM_CURINSTRADDR    0xF1ABCE06    ; /* absolute guest address of the current instruction */
-%define PATM_LOOKUP_AND_CALL_FUNCTION           0xF1ABCE07   ; /** Relative address of global PATM lookup and call function. */
-%define PATM_RETURN_FUNCTION                    0xF1ABCE08   ; /** Relative address of global PATM return function. */
-%define PATM_LOOKUP_AND_JUMP_FUNCTION           0xF1ABCE09   ; /** Relative address of global PATM lookup and jump function. */
-%define PATM_IRET_FUNCTION                      0xF1ABCE0A   ; /** Relative address of global PATM iret function. */
-%define PATM_CPUID_CENTAUR_MAX                  0xF1ABCE0B
-
-
-; everything except IOPL, NT, IF, VM, VIF, VIP and RF
+%define PATM_ASMFIX_NO_FIXUP                    0xF1ABCE00
+%define PATM_ASMFIX_CPUID_STD_MAX               0xF1ABCE00
+%define PATM_ASMFIX_CPUID_EXT_MAX               0xF1ABCE01
+%define PATM_ASMFIX_RETURNADDR                  0xF1ABCE02
+%define PATM_ASMFIX_PATCHNEXTBLOCK              0xF1ABCE03
+%define PATM_ASMFIX_CALLTARGET                  0xF1ABCE04  ;;< relative call target
+%define PATM_ASMFIX_NEXTINSTRADDR               0xF1ABCE05  ;;< absolute guest address of the next instruction
+%define PATM_ASMFIX_CURINSTRADDR                0xF1ABCE06  ;;< absolute guest address of the current instruction
+%define PATM_ASMFIX_LOOKUP_AND_CALL_FUNCTION    0xF1ABCE07  ;;< Relative address of global PATM lookup and call function.
+%define PATM_ASMFIX_RETURN_FUNCTION             0xF1ABCE08  ;;< Relative address of global PATM return function.
+%define PATM_ASMFIX_LOOKUP_AND_JUMP_FUNCTION    0xF1ABCE09  ;;< Relative address of global PATM lookup and jump function.
+%define PATM_ASMFIX_IRET_FUNCTION               0xF1ABCE0A  ;;< Relative address of global PATM iret function.
+%define PATM_ASMFIX_CPUID_CENTAUR_MAX           0xF1ABCE0B
+;; @}
+
+
+;; Everything except IOPL, NT, IF, VM, VIF, VIP and RF 
 %define PATM_FLAGS_MASK      (X86_EFL_CF|X86_EFL_PF|X86_EFL_AF|X86_EFL_ZF|X86_EFL_SF|X86_EFL_TF|X86_EFL_DF|X86_EFL_OF|X86_EFL_AC|X86_EFL_ID)
 
 ; currently only IF & IOPL
 %define PATM_VIRTUAL_FLAGS_MASK (X86_EFL_IF|X86_EFL_IOPL)
 
-; PATM stack size (identical in PATMA.mac!!)
+; PATM stack size (identical in PATMA.h!!)
 %define PATM_STACK_SIZE                    (4096)
-%define PATM_STACK_TOTAL_SIZE              (2*PATM_STACK_SIZE)
+%define PATM_STACK_TOTAL_SIZE              (2 * PATM_STACK_SIZE)
+%define PATM_MAX_STACK                     (PATM_STACK_SIZE / RTRCPTR_CB)
 
-;/* Patch Manager pending actions (in GCSTATE). */
+;; @name Patch Manager pending actions (in GCSTATE).
+;; @{
 %define PATM_ACTION_LOOKUP_ADDRESS              1
 %define PATM_ACTION_DISPATCH_PENDING_IRQ        2
 %define PATM_ACTION_PENDING_IRQ_AFTER_IRET      3
@@ -91,15 +102,49 @@
 %define PATM_ACTION_LOG_RET                     12
 %define PATM_ACTION_LOG_CALL                    13
 %define PATM_ACTION_LOG_GATE_ENTRY              14
+;; @}
 
-;/* Magic dword found in ecx for patm pending actions. */
-%define PATM_ACTION_MAGIC          0xABCD4321
+;; Magic dword found in ecx for patm pending actions.
+%define PATM_ACTION_MAGIC                       0xABCD4321
 
+;; @name PATM_ASMFIX_TEMP_RESTORE_FLAGS
+;; @{
 %define PATM_RESTORE_EAX                        RT_BIT(0)
 %define PATM_RESTORE_ECX                        RT_BIT(1)
 %define PATM_RESTORE_EDI                        RT_BIT(2)
+;; @}
 
 
+;;
+; Relocation entry for PATCHASMRECORD.
+;
+struc PATCHASMRELOC
+    ;; The relocation type.
+    .uType              resd 1
+    ;; Additional information specific to the relocation type.
+    .uCode              resd 1
+endstruc
+
+;;
+; Assembly patch descriptor record.
+;
+struc PATCHASMRECORD
+    ;; Pointer to the patch code.
+    .pbFunction         RTCCPTR_RES 1
+    ;; Offset of the jump table?
+    .offJump            resd 1
+    ;; Used only by loop/loopz/loopnz. 
+    .offRelJump         resd 1        
+    ;; Size override byte position.
+    .offSizeOverride    resd 1        
+    ;; The size of the patch function.
+    .cbFunction         resd 1
+    ;; The number of relocations in aRelocs.
+    .cRelocs            resd 1
+    ;; Variable sized relocation table. (put after the iend, so no included)
+    ;.aRelocs            resb PATCHASMRELOC_size
+endstruc
+
 ;/* For indirect calls/jump (identical in PATMA.h & PATMA.mac!) */
 %define PATM_MAX_JUMPTABLE_ENTRIES        16
 
diff --git a/src/VBox/VMM/VMMR3/PATMPatch.cpp b/src/VBox/VMM/VMMR3/PATMPatch.cpp
index 33f4673..43ced91 100644
--- a/src/VBox/VMM/VMMR3/PATMPatch.cpp
+++ b/src/VBox/VMM/VMMR3/PATMPatch.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -22,6 +22,7 @@
 *******************************************************************************/
 #define LOG_GROUP LOG_GROUP_PATM
 #include <VBox/vmm/patm.h>
+#include <VBox/vmm/pdmapi.h>
 #include <VBox/vmm/pgm.h>
 #include <VBox/vmm/cpum.h>
 #include <VBox/vmm/mm.h>
@@ -44,7 +45,14 @@
 #include "PATMA.h"
 #include "PATMPatch.h"
 
-/* internal structure for passing more information about call fixups to patmPatchGenCode */
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * Internal structure for passing more information about call fixups to
+ * patmPatchGenCode.
+ */
 typedef struct
 {
     RTRCPTR   pTargetGC;
@@ -53,11 +61,55 @@ typedef struct
     RTRCPTR   pReturnGC;
 } PATMCALLINFO, *PPATMCALLINFO;
 
-int patmPatchAddReloc32(PVM pVM, PPATCHINFO pPatch, uint8_t *pRelocHC, uint32_t uType, RTRCPTR pSource, RTRCPTR pDest)
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** Value to use when not sure about the patch size. */
+#define PATCHGEN_DEF_SIZE   256
+
+#define PATCHGEN_PROLOG_NODEF(pVM, pPatch, a_cbMaxEmit) \
+    do { \
+        cbGivenPatchSize = (a_cbMaxEmit) + 16U /*jmp++*/; \
+        if (RT_LIKELY((pPatch)->pPatchBlockOffset + pPatch->uCurPatchOffset + cbGivenPatchSize < pVM->patm.s.cbPatchMem)) \
+            pPB = PATCHCODE_PTR_HC(pPatch) + pPatch->uCurPatchOffset; \
+        else \
+        { \
+            pVM->patm.s.fOutOfMemory = true; \
+            AssertMsgFailed(("offPatch=%#x + offEmit=%#x + a_cbMaxEmit=%#x + jmp -->  cbTotalWithFudge=%#x >= cbPatchMem=%#x", \
+                             (pPatch)->pPatchBlockOffset, pPatch->uCurPatchOffset, a_cbMaxEmit, \
+                             (pPatch)->pPatchBlockOffset + pPatch->uCurPatchOffset + cbGivenPatchSize, pVM->patm.s.cbPatchMem)); \
+            return VERR_NO_MEMORY; \
+        } \
+    } while (0)
+
+#define PATCHGEN_PROLOG(pVM, pPatch, a_cbMaxEmit) \
+    uint8_t *pPB; \
+    uint32_t cbGivenPatchSize; \
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, a_cbMaxEmit)
+
+#define PATCHGEN_EPILOG(pPatch, a_cbActual) \
+    do { \
+        AssertMsg((a_cbActual) <= cbGivenPatchSize, ("a_cbActual=%#x cbGivenPatchSize=%#x\n", a_cbActual, cbGivenPatchSize)); \
+        Assert((a_cbActual) <= 640); \
+        pPatch->uCurPatchOffset += (a_cbActual); \
+    } while (0)
+
+
+
+
+int patmPatchAddReloc32(PVM pVM, PPATCHINFO pPatch, uint8_t *pRelocHC, uint32_t uType,
+                        RTRCPTR pSource /*= 0*/, RTRCPTR pDest /*= 0*/)
 {
     PRELOCREC pRec;
 
-    Assert(uType == FIXUP_ABSOLUTE || ((uType == FIXUP_REL_JMPTOPATCH || uType == FIXUP_REL_JMPTOGUEST) && pSource && pDest));
+    Assert(   uType == FIXUP_ABSOLUTE
+           || (   (   uType == FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL
+                   || uType == FIXUP_CONSTANT_IN_PATCH_ASM_TMPL
+                   || uType == FIXUP_REL_HELPER_IN_PATCH_ASM_TMPL)
+               && pSource == pDest
+               && PATM_IS_ASMFIX(pSource))
+           || ((uType == FIXUP_REL_JMPTOPATCH || uType == FIXUP_REL_JMPTOGUEST) && pSource && pDest));
 
     LogFlow(("patmPatchAddReloc32 type=%d pRelocGC=%RRv source=%RRv dest=%RRv\n", uType, pRelocHC - pVM->patm.s.pPatchMemGC + pVM->patm.s.pPatchMemGC , pSource, pDest));
 
@@ -96,272 +148,280 @@ int patmPatchAddJump(PVM pVM, PPATCHINFO pPatch, uint8_t *pJumpHC, uint32_t offs
     return VINF_SUCCESS;
 }
 
-#define PATCHGEN_PROLOG_NODEF(pVM, pPatch)                                      \
-    pPB = PATCHCODE_PTR_HC(pPatch) + pPatch->uCurPatchOffset;            \
-                                                                               \
-    if (pPB + 256 >= pVM->patm.s.pPatchMemHC + pVM->patm.s.cbPatchMem)          \
-    {                                                                          \
-        pVM->patm.s.fOutOfMemory = true; \
-        Assert(pPB + 256 >= pVM->patm.s.pPatchMemHC + pVM->patm.s.cbPatchMem); \
-        return VERR_NO_MEMORY; \
-    }
-
-#define PATCHGEN_PROLOG(pVM, pPatch)                                      \
-    uint8_t *pPB;                                                         \
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
-
-
-#define PATCHGEN_EPILOG(pPatch, size) \
-    Assert(size <= 640);              \
-    pPatch->uCurPatchOffset += size;
-
-
-static uint32_t patmPatchGenCode(PVM pVM, PPATCHINFO pPatch, uint8_t *pPB, PPATCHASMRECORD pAsmRecord, RCPTRTYPE(uint8_t *) pReturnAddrGC, bool fGenJump,
+static uint32_t patmPatchGenCode(PVM pVM, PPATCHINFO pPatch, uint8_t *pPB, PCPATCHASMRECORD pAsmRecord,
+                                 RCPTRTYPE(uint8_t *) pReturnAddrGC, bool fGenJump,
                                  PPATMCALLINFO pCallInfo = 0)
 {
-    uint32_t i, j;
-
     Assert(fGenJump == false || pReturnAddrGC);
     Assert(fGenJump == false || pAsmRecord->offJump);
-    Assert(pAsmRecord && pAsmRecord->size > sizeof(pAsmRecord->uReloc[0]));
+    Assert(pAsmRecord);
+    Assert(pAsmRecord->cbFunction > sizeof(pAsmRecord->aRelocs[0].uType) * pAsmRecord->cRelocs);
 
     // Copy the code block
-    memcpy(pPB, pAsmRecord->pFunction, pAsmRecord->size);
+    memcpy(pPB, pAsmRecord->pbFunction, pAsmRecord->cbFunction);
 
     // Process all fixups
-    for (j=0,i=0;i<pAsmRecord->nrRelocs*2; i+=2)
+    uint32_t i, j;
+    for (j = 0, i = 0; i < pAsmRecord->cRelocs; i++)
     {
-        for (;j<pAsmRecord->size;j++)
+        for (; j < pAsmRecord->cbFunction; j++)
         {
-            if (*(uint32_t*)&pPB[j] == pAsmRecord->uReloc[i])
+            if (*(uint32_t*)&pPB[j] == pAsmRecord->aRelocs[i].uType)
             {
                 RCPTRTYPE(uint32_t *) dest;
 
 #ifdef VBOX_STRICT
-                if (pAsmRecord->uReloc[i] == PATM_FIXUP)
-                    Assert(pAsmRecord->uReloc[i+1] != 0);
+                if (pAsmRecord->aRelocs[i].uType == PATM_ASMFIX_FIXUP)
+                    Assert(pAsmRecord->aRelocs[i].uInfo != 0);
                 else
-                    Assert(pAsmRecord->uReloc[i+1] == 0);
+                    Assert(pAsmRecord->aRelocs[i].uInfo == 0);
 #endif
 
-                /**
-                 * BE VERY CAREFUL WITH THESE FIXUPS. TAKE INTO ACCOUNT THAT PROBLEMS MAY ARISE WHEN RESTORING A SAVED STATE WITH
-                 * A DIFFERENT HYPERVISOR LAYOUT.
+                /*
+                 * BE VERY CAREFUL WITH THESE FIXUPS. TAKE INTO ACCOUNT THAT PROBLEMS MAY ARISE WHEN RESTORING
+                 * A SAVED STATE WITH A DIFFERENT HYPERVISOR LAYOUT.
                  */
-                switch (pAsmRecord->uReloc[i])
+                uint32_t uRelocType = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
+                switch (pAsmRecord->aRelocs[i].uType)
                 {
-                case PATM_VMFLAGS:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uVMFlags);
-                    break;
-
-                case PATM_PENDINGACTION:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uPendingAction);
-                    break;
-
-                case PATM_FIXUP:
-                    /* Offset in uReloc[i+1] is from the base of the function. */
-                    dest = (RTGCUINTPTR32)pVM->patm.s.pPatchMemGC + pAsmRecord->uReloc[i+1] + (RTGCUINTPTR32)(pPB - pVM->patm.s.pPatchMemHC);
-                    break;
+                    /*
+                     * PATMGCSTATE member fixups.
+                     */
+                    case PATM_ASMFIX_VMFLAGS:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uVMFlags);
+                        break;
+                    case PATM_ASMFIX_PENDINGACTION:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uPendingAction);
+                        break;
+                    case PATM_ASMFIX_STACKPTR:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Psp);
+                        break;
+                    case PATM_ASMFIX_INTERRUPTFLAG:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, fPIF);
+                        break;
+                    case PATM_ASMFIX_INHIBITIRQADDR:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCPtrInhibitInterrupts);
+                        break;
+                    case PATM_ASMFIX_TEMP_EAX:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uEAX);
+                        break;
+                    case PATM_ASMFIX_TEMP_ECX:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uECX);
+                        break;
+                    case PATM_ASMFIX_TEMP_EDI:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uEDI);
+                        break;
+                    case PATM_ASMFIX_TEMP_EFLAGS:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.eFlags);
+                        break;
+                    case PATM_ASMFIX_TEMP_RESTORE_FLAGS:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uFlags);
+                        break;
+                    case PATM_ASMFIX_CALL_PATCH_TARGET_ADDR:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCCallPatchTargetAddr);
+                        break;
+                    case PATM_ASMFIX_CALL_RETURN_ADDR:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCCallReturnAddr);
+                        break;
 #ifdef VBOX_WITH_STATISTICS
-                case PATM_ALLPATCHCALLS:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uPatchCalls);
-                    break;
-
-                case PATM_IRETEFLAGS:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretEFlags);
-                    break;
-
-                case PATM_IRETCS:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretCS);
-                    break;
-
-                case PATM_IRETEIP:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretEIP);
-                    break;
-
-                case PATM_PERPATCHCALLS:
-                    dest = patmPatchQueryStatAddress(pVM, pPatch);
-                    break;
+                    case PATM_ASMFIX_ALLPATCHCALLS:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uPatchCalls);
+                        break;
+                    case PATM_ASMFIX_IRETEFLAGS:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretEFlags);
+                        break;
+                    case PATM_ASMFIX_IRETCS:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretCS);
+                        break;
+                    case PATM_ASMFIX_IRETEIP:
+                        dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, uIretEIP);
+                        break;
 #endif
-                case PATM_STACKPTR:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Psp);
-                    break;
 
-                /* The first part of our PATM stack is used to store offsets of patch return addresses; the 2nd
-                 * part to store the original return addresses.
-                 */
-                case PATM_STACKBASE:
-                    dest = pVM->patm.s.pGCStackGC;
-                    break;
-
-                case PATM_STACKBASE_GUEST:
-                    dest = pVM->patm.s.pGCStackGC + PATM_STACK_SIZE;
-                    break;
-
-                case PATM_RETURNADDR:   /* absolute guest address; no fixup required */
-                    Assert(pCallInfo && pAsmRecord->uReloc[i] >= PATM_NO_FIXUP);
-                    dest = pCallInfo->pReturnGC;
-                    break;
-
-                case PATM_PATCHNEXTBLOCK:  /* relative address of instruction following this block */
-                    Assert(pCallInfo && pAsmRecord->uReloc[i] >= PATM_NO_FIXUP);
-
-                    /** @note hardcoded assumption that we must return to the instruction following this block */
-                    dest = (uintptr_t)pPB - (uintptr_t)pVM->patm.s.pPatchMemHC + pAsmRecord->size;
-                    break;
-
-                case PATM_CALLTARGET:   /* relative to patch address; no fixup required */
-                    Assert(pCallInfo && pAsmRecord->uReloc[i] >= PATM_NO_FIXUP);
-
-                    /* Address must be filled in later. (see patmr3SetBranchTargets)  */
-                    patmPatchAddJump(pVM, pPatch, &pPB[j-1], 1, pCallInfo->pTargetGC, OP_CALL);
-                    dest = PATM_ILLEGAL_DESTINATION;
-                    break;
-
-                case PATM_PATCHBASE:    /* Patch GC base address */
-                    dest = pVM->patm.s.pPatchMemGC;
-                    break;
-
-                case PATM_CPUID_STD_PTR:
-                    /* @todo dirty hack when correcting this fixup (state restore) */
-                    dest = CPUMR3GetGuestCpuIdStdRCPtr(pVM);
-                    break;
-
-                case PATM_CPUID_EXT_PTR:
-                    /* @todo dirty hack when correcting this fixup (state restore) */
-                    dest = CPUMR3GetGuestCpuIdExtRCPtr(pVM);
-                    break;
-
-                case PATM_CPUID_CENTAUR_PTR:
-                    /* @todo dirty hack when correcting this fixup (state restore) */
-                    dest = CPUMR3GetGuestCpuIdCentaurRCPtr(pVM);
-                    break;
-
-                case PATM_CPUID_DEF_PTR:
-                    /* @todo dirty hack when correcting this fixup (state restore) */
-                    dest = CPUMR3GetGuestCpuIdDefRCPtr(pVM);
-                    break;
-
-                case PATM_CPUID_STD_MAX:
-                    dest = CPUMGetGuestCpuIdStdMax(pVM);
-                    break;
-
-                case PATM_CPUID_EXT_MAX:
-                    dest = CPUMGetGuestCpuIdExtMax(pVM);
-                    break;
-
-                case PATM_CPUID_CENTAUR_MAX:
-                    dest = CPUMGetGuestCpuIdCentaurMax(pVM);
-                    break;
-
-                case PATM_INTERRUPTFLAG:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, fPIF);
-                    break;
-
-                case PATM_INHIBITIRQADDR:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCPtrInhibitInterrupts);
-                    break;
-
-                case PATM_NEXTINSTRADDR:
-                    Assert(pCallInfo);
-                    /* pNextInstrGC can be 0 if several instructions, that inhibit irqs, follow each other */
-                    dest = pCallInfo->pNextInstrGC;
-                    break;
-
-                case PATM_CURINSTRADDR:
-                    Assert(pCallInfo);
-                    dest = pCallInfo->pCurInstrGC;
-                    break;
-
-                case PATM_VM_FORCEDACTIONS:
-                    /* @todo dirty assumptions when correcting this fixup during saved state loading. */
-                    dest = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions);
-                    break;
-
-                case PATM_TEMP_EAX:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uEAX);
-                    break;
-                case PATM_TEMP_ECX:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uECX);
-                    break;
-                case PATM_TEMP_EDI:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uEDI);
-                    break;
-                case PATM_TEMP_EFLAGS:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.eFlags);
-                    break;
-                case PATM_TEMP_RESTORE_FLAGS:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, Restore.uFlags);
-                    break;
-                case PATM_CALL_PATCH_TARGET_ADDR:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCCallPatchTargetAddr);
-                    break;
-                case PATM_CALL_RETURN_ADDR:
-                    dest = pVM->patm.s.pGCStateGC + RT_OFFSETOF(PATMGCSTATE, GCCallReturnAddr);
-                    break;
-
-                /* Relative address of global patm lookup and call function. */
-                case PATM_LOOKUP_AND_CALL_FUNCTION:
-                {
-                    RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
-                    Assert(pVM->patm.s.pfnHelperCallGC);
-                    Assert(sizeof(uint32_t) == sizeof(RTRCPTR));
 
-                    /* Relative value is target minus address of instruction after the actual call instruction. */
-                    dest = pVM->patm.s.pfnHelperCallGC - pInstrAfterCall;
-                    break;
-                }
-
-                case PATM_RETURN_FUNCTION:
-                {
-                    RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
-                    Assert(pVM->patm.s.pfnHelperRetGC);
-                    Assert(sizeof(uint32_t) == sizeof(RTRCPTR));
+                    case PATM_ASMFIX_FIXUP:
+                        /* Offset in aRelocs[i].uInfo is from the base of the function. */
+                        dest = (RTGCUINTPTR32)pVM->patm.s.pPatchMemGC + pAsmRecord->aRelocs[i].uInfo
+                             + (RTGCUINTPTR32)(pPB - pVM->patm.s.pPatchMemHC);
+                        break;
 
-                    /* Relative value is target minus address of instruction after the actual call instruction. */
-                    dest = pVM->patm.s.pfnHelperRetGC - pInstrAfterCall;
-                    break;
-                }
-
-                case PATM_IRET_FUNCTION:
-                {
-                    RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
-                    Assert(pVM->patm.s.pfnHelperIretGC);
-                    Assert(sizeof(uint32_t) == sizeof(RTRCPTR));
+#ifdef VBOX_WITH_STATISTICS
+                    case PATM_ASMFIX_PERPATCHCALLS:
+                        dest = patmPatchQueryStatAddress(pVM, pPatch);
+                        break;
+#endif
 
-                    /* Relative value is target minus address of instruction after the actual call instruction. */
-                    dest = pVM->patm.s.pfnHelperIretGC - pInstrAfterCall;
-                    break;
+                    /* The first part of our PATM stack is used to store offsets of patch return addresses; the 2nd
+                     * part to store the original return addresses.
+                     */
+                    case PATM_ASMFIX_STACKBASE:
+                        dest = pVM->patm.s.pGCStackGC;
+                        break;
+
+                    case PATM_ASMFIX_STACKBASE_GUEST:
+                        dest = pVM->patm.s.pGCStackGC + PATM_STACK_SIZE;
+                        break;
+
+                    case PATM_ASMFIX_RETURNADDR:   /* absolute guest address; no fixup required */
+                        Assert(pCallInfo && pAsmRecord->aRelocs[i].uType >= PATM_ASMFIX_NO_FIXUP);
+                        dest = pCallInfo->pReturnGC;
+                        break;
+
+                    case PATM_ASMFIX_PATCHNEXTBLOCK:  /* relative address of instruction following this block */
+                        Assert(pCallInfo && pAsmRecord->aRelocs[i].uType >= PATM_ASMFIX_NO_FIXUP);
+
+                        /** @note hardcoded assumption that we must return to the instruction following this block */
+                        dest = (uintptr_t)pPB - (uintptr_t)pVM->patm.s.pPatchMemHC + pAsmRecord->cbFunction;
+                        break;
+
+                    case PATM_ASMFIX_CALLTARGET:   /* relative to patch address; no fixup required */
+                        Assert(pCallInfo && pAsmRecord->aRelocs[i].uType >= PATM_ASMFIX_NO_FIXUP);
+
+                        /* Address must be filled in later. (see patmr3SetBranchTargets)  */
+                        patmPatchAddJump(pVM, pPatch, &pPB[j-1], 1, pCallInfo->pTargetGC, OP_CALL);
+                        dest = PATM_ILLEGAL_DESTINATION;
+                        break;
+
+                    case PATM_ASMFIX_PATCHBASE:    /* Patch GC base address */
+                        dest = pVM->patm.s.pPatchMemGC;
+                        break;
+
+                    case PATM_ASMFIX_NEXTINSTRADDR:
+                        Assert(pCallInfo);
+                        /* pNextInstrGC can be 0 if several instructions, that inhibit irqs, follow each other */
+                        dest = pCallInfo->pNextInstrGC;
+                        break;
+
+                    case PATM_ASMFIX_CURINSTRADDR:
+                        Assert(pCallInfo);
+                        dest = pCallInfo->pCurInstrGC;
+                        break;
+
+                    /* Relative address of global patm lookup and call function. */
+                    case PATM_ASMFIX_LOOKUP_AND_CALL_FUNCTION:
+                    {
+                        RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC
+                                                + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
+                        Assert(pVM->patm.s.pfnHelperCallGC);
+                        Assert(sizeof(uint32_t) == sizeof(RTRCPTR));
+
+                        /* Relative value is target minus address of instruction after the actual call instruction. */
+                        dest = pVM->patm.s.pfnHelperCallGC - pInstrAfterCall;
+                        break;
+                    }
+
+                    case PATM_ASMFIX_RETURN_FUNCTION:
+                    {
+                        RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC
+                                                + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
+                        Assert(pVM->patm.s.pfnHelperRetGC);
+                        Assert(sizeof(uint32_t) == sizeof(RTRCPTR));
+
+                        /* Relative value is target minus address of instruction after the actual call instruction. */
+                        dest = pVM->patm.s.pfnHelperRetGC - pInstrAfterCall;
+                        break;
+                    }
+
+                    case PATM_ASMFIX_IRET_FUNCTION:
+                    {
+                        RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC
+                                                + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
+                        Assert(pVM->patm.s.pfnHelperIretGC);
+                        Assert(sizeof(uint32_t) == sizeof(RTRCPTR));
+
+                        /* Relative value is target minus address of instruction after the actual call instruction. */
+                        dest = pVM->patm.s.pfnHelperIretGC - pInstrAfterCall;
+                        break;
+                    }
+
+                    case PATM_ASMFIX_LOOKUP_AND_JUMP_FUNCTION:
+                    {
+                        RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC
+                                                + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
+                        Assert(pVM->patm.s.pfnHelperJumpGC);
+                        Assert(sizeof(uint32_t) == sizeof(RTRCPTR));
+
+                        /* Relative value is target minus address of instruction after the actual call instruction. */
+                        dest = pVM->patm.s.pfnHelperJumpGC - pInstrAfterCall;
+                        break;
+                    }
+
+                    case PATM_ASMFIX_CPUID_STD_MAX: /* saved state only */
+                        dest = CPUMR3GetGuestCpuIdPatmStdMax(pVM);
+                        break;
+                    case PATM_ASMFIX_CPUID_EXT_MAX: /* saved state only */
+                        dest = CPUMR3GetGuestCpuIdPatmExtMax(pVM);
+                        break;
+                    case PATM_ASMFIX_CPUID_CENTAUR_MAX: /* saved state only */
+                        dest = CPUMR3GetGuestCpuIdPatmCentaurMax(pVM);
+                        break;
+
+                    /*
+                     * The following fixups needs to be recalculated when loading saved state
+                     * Note! Earlier saved state versions had different hacks for detecting some of these.
+                     */
+                    case PATM_ASMFIX_VM_FORCEDACTIONS:
+                        dest = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions);
+                        break;
+
+                    case PATM_ASMFIX_CPUID_DEF_PTR: /* saved state only */
+                        dest = CPUMR3GetGuestCpuIdPatmDefRCPtr(pVM);
+                        break;
+                    case PATM_ASMFIX_CPUID_STD_PTR: /* saved state only */
+                        dest = CPUMR3GetGuestCpuIdPatmStdRCPtr(pVM);
+                        break;
+                    case PATM_ASMFIX_CPUID_EXT_PTR: /* saved state only */
+                        dest = CPUMR3GetGuestCpuIdPatmExtRCPtr(pVM);
+                        break;
+                    case PATM_ASMFIX_CPUID_CENTAUR_PTR: /* saved state only */
+                        dest = CPUMR3GetGuestCpuIdPatmCentaurRCPtr(pVM);
+                        break;
+
+                    /*
+                     * The following fixups are constants and helper code calls that only
+                     * needs to be corrected when loading saved state.
+                     */
+                    case PATM_ASMFIX_HELPER_CPUM_CPUID:
+                    {
+                        int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "CPUMPatchHlpCpuId", &dest);
+                        AssertReleaseRCBreakStmt(rc, dest = PATM_ILLEGAL_DESTINATION);
+                        uRelocType = FIXUP_REL_HELPER_IN_PATCH_ASM_TMPL;
+                        break;
+                    }
+
+                    /*
+                     * Unknown fixup.
+                     */
+                    case PATM_ASMFIX_REUSE_LATER_0:
+                    case PATM_ASMFIX_REUSE_LATER_1:
+                    case PATM_ASMFIX_REUSE_LATER_2:
+                    case PATM_ASMFIX_REUSE_LATER_3:
+                    default:
+                        AssertReleaseMsgFailed(("Unknown fixup: %#x\n", pAsmRecord->aRelocs[i].uType));
+                        dest = PATM_ILLEGAL_DESTINATION;
+                        break;
                 }
 
-                case PATM_LOOKUP_AND_JUMP_FUNCTION:
+                if (uRelocType == FIXUP_REL_HELPER_IN_PATCH_ASM_TMPL)
                 {
-                    RTRCPTR pInstrAfterCall = pVM->patm.s.pPatchMemGC + (RTGCUINTPTR32)(&pPB[j] + sizeof(RTRCPTR) - pVM->patm.s.pPatchMemHC);
-                    Assert(pVM->patm.s.pfnHelperJumpGC);
-                    Assert(sizeof(uint32_t) == sizeof(RTRCPTR));
-
-                    /* Relative value is target minus address of instruction after the actual call instruction. */
-                    dest = pVM->patm.s.pfnHelperJumpGC - pInstrAfterCall;
-                    break;
+                    RTRCUINTPTR RCPtrAfter = pVM->patm.s.pPatchMemGC
+                                           + (RTRCUINTPTR)(&pPB[j + sizeof(RTRCPTR)] - pVM->patm.s.pPatchMemHC);
+                    dest -= RCPtrAfter;
                 }
 
-                default:
-                    dest = PATM_ILLEGAL_DESTINATION;
-                    AssertRelease(0);
-                    break;
-                }
+                *(PRTRCPTR)&pPB[j] = dest;
 
-                *(RTRCPTR *)&pPB[j] = dest;
-                if (pAsmRecord->uReloc[i] < PATM_NO_FIXUP)
+                if (pAsmRecord->aRelocs[i].uType < PATM_ASMFIX_NO_FIXUP)
                 {
-                    patmPatchAddReloc32(pVM, pPatch, &pPB[j], FIXUP_ABSOLUTE);
+                    patmPatchAddReloc32(pVM, pPatch, &pPB[j], uRelocType,
+                                        pAsmRecord->aRelocs[i].uType /*pSources*/, pAsmRecord->aRelocs[i].uType /*pDest*/);
                 }
                 break;
             }
         }
-        Assert(j < pAsmRecord->size);
+        Assert(j < pAsmRecord->cbFunction);
     }
-    Assert(pAsmRecord->uReloc[i] == 0xffffffff);
+    Assert(pAsmRecord->aRelocs[i].uInfo == 0xffffffff);
 
     /* Add the jump back to guest code (if required) */
     if (fGenJump)
@@ -374,19 +434,15 @@ static uint32_t patmPatchGenCode(PVM pVM, PPATCHINFO pPatch, uint8_t *pPB, PPATC
 
         *(uint32_t *)&pPB[pAsmRecord->offJump] = displ;
         patmPatchAddReloc32(pVM, pPatch, &pPB[pAsmRecord->offJump], FIXUP_REL_JMPTOGUEST,
-                        PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset + pAsmRecord->offJump - 1 + SIZEOF_NEARJUMP32,
-                        pReturnAddrGC);
+                            PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset + pAsmRecord->offJump - 1 + SIZEOF_NEARJUMP32,
+                            pReturnAddrGC);
     }
 
     // Calculate the right size of this patch block
     if ((fGenJump && pAsmRecord->offJump) || (!fGenJump && !pAsmRecord->offJump))
-    {
-        return pAsmRecord->size;
-    }
-    else {
-        // if a jump instruction is present and we don't want one, then subtract SIZEOF_NEARJUMP32
-        return pAsmRecord->size - SIZEOF_NEARJUMP32;
-    }
+        return pAsmRecord->cbFunction;
+    // if a jump instruction is present and we don't want one, then subtract SIZEOF_NEARJUMP32
+    return pAsmRecord->cbFunction - SIZEOF_NEARJUMP32;
 }
 
 /* Read bytes and check for overwritten instructions. */
@@ -414,11 +470,10 @@ static int patmPatchReadBytes(PVM pVM, uint8_t *pDest, RTRCPTR pSrc, uint32_t cb
 
 int patmPatchGenDuplicate(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pCurInstrGC)
 {
-    int rc = VINF_SUCCESS;
-    PATCHGEN_PROLOG(pVM, pPatch);
-
     uint32_t const cbInstrShutUpGcc = pCpu->cbInstr;
-    rc = patmPatchReadBytes(pVM, pPB, pCurInstrGC, cbInstrShutUpGcc);
+    PATCHGEN_PROLOG(pVM, pPatch, cbInstrShutUpGcc);
+
+    int rc = patmPatchReadBytes(pVM, pPB, pCurInstrGC, cbInstrShutUpGcc);
     AssertRC(rc);
     PATCHGEN_EPILOG(pPatch, cbInstrShutUpGcc);
     return rc;
@@ -428,16 +483,14 @@ int patmPatchGenIret(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, bool fSize
 {
     uint32_t size;
     PATMCALLINFO callInfo;
+    PCPATCHASMRECORD pPatchAsmRec = EMIsRawRing1Enabled(pVM) ? &g_patmIretRing1Record : &g_patmIretRecord;
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
 
     AssertMsg(fSizeOverride == false, ("operand size override!!\n"));
     callInfo.pCurInstrGC = pCurInstrGC;
 
-    if (EMIsRawRing1Enabled(pVM))
-        size = patmPatchGenCode(pVM, pPatch, pPB, &PATMIretRing1Record, 0, false, &callInfo);
-    else
-        size = patmPatchGenCode(pVM, pPatch, pPB, &PATMIretRecord, 0, false, &callInfo);
+    size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
 
     PATCHGEN_EPILOG(pPatch, size);
     return VINF_SUCCESS;
@@ -446,9 +499,9 @@ int patmPatchGenIret(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, bool fSize
 int patmPatchGenCli(PVM pVM, PPATCHINFO pPatch)
 {
     uint32_t size;
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmCliRecord.cbFunction);
 
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMCliRecord, 0, false);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCliRecord, 0, false);
 
     PATCHGEN_EPILOG(pPatch, size);
     return VINF_SUCCESS;
@@ -463,9 +516,9 @@ int patmPatchGenSti(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, RTRCPTR pNe
     uint32_t     size;
 
     Log(("patmPatchGenSti at %RRv; next %RRv\n", pCurInstrGC, pNextInstrGC));
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmStiRecord.cbFunction);
     callInfo.pNextInstrGC = pNextInstrGC;
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMStiRecord, 0, false, &callInfo);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmStiRecord, 0, false, &callInfo);
     PATCHGEN_EPILOG(pPatch, size);
 
     return VINF_SUCCESS;
@@ -476,8 +529,13 @@ int patmPatchGenPopf(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAdd
 {
     uint32_t        size;
     PATMCALLINFO    callInfo;
+    PCPATCHASMRECORD pPatchAsmRec;
+    if (fSizeOverride == true)
+        pPatchAsmRec = fGenJumpBack ? &g_patmPopf16Record : &g_patmPopf16Record_NoExit;
+    else
+        pPatchAsmRec = fGenJumpBack ? &g_patmPopf32Record : &g_patmPopf32Record_NoExit;
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
 
     callInfo.pNextInstrGC = pReturnAddrGC;
 
@@ -485,14 +543,8 @@ int patmPatchGenPopf(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAdd
 
     /* Note: keep IOPL in mind when changing any of this!! (see comments in PATMA.asm, PATMPopf32Replacement) */
     if (fSizeOverride == true)
-    {
         Log(("operand size override!!\n"));
-        size = patmPatchGenCode(pVM, pPatch, pPB, (fGenJumpBack) ? &PATMPopf16Record : &PATMPopf16Record_NoExit , pReturnAddrGC, fGenJumpBack, &callInfo);
-    }
-    else
-    {
-        size = patmPatchGenCode(pVM, pPatch, pPB, (fGenJumpBack) ? &PATMPopf32Record : &PATMPopf32Record_NoExit, pReturnAddrGC, fGenJumpBack, &callInfo);
-    }
+    size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, pReturnAddrGC, fGenJumpBack, &callInfo);
 
     PATCHGEN_EPILOG(pPatch, size);
     STAM_COUNTER_INC(&pVM->patm.s.StatGenPopf);
@@ -502,17 +554,10 @@ int patmPatchGenPopf(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAdd
 int patmPatchGenPushf(PVM pVM, PPATCHINFO pPatch, bool fSizeOverride)
 {
     uint32_t size;
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PCPATCHASMRECORD pPatchAsmRec = fSizeOverride == true ?  &g_patmPushf16Record : &g_patmPushf32Record;
+    PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
 
-    if (fSizeOverride == true)
-    {
-        Log(("operand size override!!\n"));
-        size = patmPatchGenCode(pVM, pPatch, pPB, &PATMPushf16Record, 0, false);
-    }
-    else
-    {
-        size = patmPatchGenCode(pVM, pPatch, pPB, &PATMPushf32Record, 0, false);
-    }
+    size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false);
 
     PATCHGEN_EPILOG(pPatch, size);
     return VINF_SUCCESS;
@@ -521,8 +566,8 @@ int patmPatchGenPushf(PVM pVM, PPATCHINFO pPatch, bool fSizeOverride)
 int patmPatchGenPushCS(PVM pVM, PPATCHINFO pPatch)
 {
     uint32_t size;
-    PATCHGEN_PROLOG(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMPushCSRecord, 0, false);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmPushCSRecord.cbFunction);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmPushCSRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
     return VINF_SUCCESS;
 }
@@ -530,23 +575,20 @@ int patmPatchGenPushCS(PVM pVM, PPATCHINFO pPatch)
 int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride)
 {
     uint32_t size = 0;
-    PPATCHASMRECORD pPatchAsmRec;
-
-    PATCHGEN_PROLOG(pVM, pPatch);
-
+    PCPATCHASMRECORD pPatchAsmRec;
     switch (opcode)
     {
     case OP_LOOP:
-        pPatchAsmRec = &PATMLoopRecord;
+        pPatchAsmRec = &g_patmLoopRecord;
         break;
     case OP_LOOPNE:
-        pPatchAsmRec = &PATMLoopNZRecord;
+        pPatchAsmRec = &g_patmLoopNZRecord;
         break;
     case OP_LOOPE:
-        pPatchAsmRec = &PATMLoopZRecord;
+        pPatchAsmRec = &g_patmLoopZRecord;
         break;
     case OP_JECXZ:
-        pPatchAsmRec = &PATMJEcxRecord;
+        pPatchAsmRec = &g_patmJEcxRecord;
         break;
     default:
         AssertMsgFailed(("PatchGenLoop: invalid opcode %d\n", opcode));
@@ -554,6 +596,7 @@ int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC,
     }
     Assert(pPatchAsmRec->offSizeOverride && pPatchAsmRec->offRelJump);
 
+    PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
     Log(("PatchGenLoop %d jump %d to %08x offrel=%d\n", opcode, pPatch->nrJumpRecs, pTargetGC, pPatchAsmRec->offRelJump));
 
     // Generate the patch code
@@ -575,7 +618,7 @@ int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC,
 int patmPatchGenRelJump(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride)
 {
     uint32_t offset = 0;
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
 
     // internal relative jumps from patch code to patch code; no relocation record required
 
@@ -686,7 +729,7 @@ int patmPatchGenCall(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCur
         return rc;
     AssertRCReturn(rc, rc);
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
     /* 2: We must push the target address onto the stack before appending the indirect call code. */
 
     if (fIndirect)
@@ -746,13 +789,14 @@ int patmPatchGenCall(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCur
     PATCHGEN_EPILOG(pPatch, offset);
 
     /* 3: Generate code to lookup address in our local cache; call hypervisor PATM code if it can't be located. */
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
+    PCPATCHASMRECORD pPatchAsmRec = fIndirect ? &g_patmCallIndirectRecord : &g_patmCallRecord;
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, pPatchAsmRec->cbFunction);
     callInfo.pReturnGC      = pCurInstrGC + pCpu->cbInstr;
     callInfo.pTargetGC      = (fIndirect) ? 0xDEADBEEF : pTargetGC;
-    size = patmPatchGenCode(pVM, pPatch, pPB, (fIndirect) ? &PATMCallIndirectRecord : &PATMCallRecord, 0, false, &callInfo);
+    size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
     PATCHGEN_EPILOG(pPatch, size);
 
-    /* Need to set PATM_INTERRUPTFLAG after the patched ret returns here. */
+    /* Need to set PATM_ASMFIX_INTERRUPTFLAG after the patched ret returns here. */
     rc = patmPatchGenSetPIF(pVM, pPatch, pCurInstrGC);
     if (rc == VERR_NO_MEMORY)
         return rc;
@@ -784,7 +828,7 @@ int patmPatchGenJump(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCur
         return rc;
     AssertRCReturn(rc, rc);
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
     /* 2: We must push the target address onto the stack before appending the indirect call code. */
 
     Log(("patmPatchGenIndirectJump\n"));
@@ -823,10 +867,10 @@ int patmPatchGenJump(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCur
     PATCHGEN_EPILOG(pPatch, offset);
 
     /* 3: Generate code to lookup address in our local cache; call hypervisor PATM code if it can't be located. */
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmJumpIndirectRecord.cbFunction);
     callInfo.pReturnGC      = pCurInstrGC + pCpu->cbInstr;
     callInfo.pTargetGC      = 0xDEADBEEF;
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMJumpIndirectRecord, 0, false, &callInfo);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmJumpIndirectRecord, 0, false, &callInfo);
     PATCHGEN_EPILOG(pPatch, size);
 
     STAM_COUNTER_INC(&pVM->patm.s.StatGenJump);
@@ -845,7 +889,6 @@ int patmPatchGenJump(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCur
  */
 int patmPatchGenRet(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pCurInstrGC)
 {
-    int size = 0, rc;
     RTRCPTR pPatchRetInstrGC;
 
     /* Remember start of this patch for below. */
@@ -865,21 +908,21 @@ int patmPatchGenRet(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uin
 
     /* Jump back to the original instruction if IF is set again. */
     Assert(!patmFindActivePatchByEntrypoint(pVM, pCurInstrGC));
-    rc = patmPatchGenCheckIF(pVM, pPatch, pCurInstrGC);
+    int rc = patmPatchGenCheckIF(pVM, pPatch, pCurInstrGC);
     AssertRCReturn(rc, rc);
 
     /* align this block properly to make sure the jump table will not be misaligned. */
-    PATCHGEN_PROLOG(pVM, pPatch);
-    size = (RTHCUINTPTR)pPB & 3;
+    PATCHGEN_PROLOG(pVM, pPatch, 4);
+    uint32_t size = (RTHCUINTPTR)pPB & 3;
     if (size)
         size = 4 - size;
 
-    for (int i=0;i<size;i++)
+    for (uint32_t i = 0; i < size; i++)
         pPB[i] = 0x90;   /* nop */
     PATCHGEN_EPILOG(pPatch, size);
 
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMRetRecord, 0, false);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmRetRecord.cbFunction);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmRetRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     STAM_COUNTER_INC(&pVM->patm.s.StatGenRet);
@@ -904,35 +947,33 @@ int patmPatchGenRet(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uin
  */
 int patmPatchGenGlobalFunctions(PVM pVM, PPATCHINFO pPatch)
 {
-    int size = 0;
-
     pVM->patm.s.pfnHelperCallGC = PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset;
-    PATCHGEN_PROLOG(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMLookupAndCallRecord, 0, false);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmLookupAndCallRecord.cbFunction);
+    uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmLookupAndCallRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     /* Round to next 8 byte boundary. */
     pPatch->uCurPatchOffset = RT_ALIGN_32(pPatch->uCurPatchOffset, 8);
 
     pVM->patm.s.pfnHelperRetGC = PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset;
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMRetFunctionRecord, 0, false);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmRetFunctionRecord.cbFunction);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmRetFunctionRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     /* Round to next 8 byte boundary. */
     pPatch->uCurPatchOffset = RT_ALIGN_32(pPatch->uCurPatchOffset, 8);
 
     pVM->patm.s.pfnHelperJumpGC = PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset;
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMLookupAndJumpRecord, 0, false);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmLookupAndJumpRecord.cbFunction);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmLookupAndJumpRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     /* Round to next 8 byte boundary. */
     pPatch->uCurPatchOffset = RT_ALIGN_32(pPatch->uCurPatchOffset, 8);
 
     pVM->patm.s.pfnHelperIretGC = PATCHCODE_PTR_GC(pPatch) + pPatch->uCurPatchOffset;
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMIretFunctionRecord, 0, false);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmIretFunctionRecord.cbFunction);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmIretFunctionRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     Log(("pfnHelperCallGC %RRv\n", pVM->patm.s.pfnHelperCallGC));
@@ -953,7 +994,7 @@ int patmPatchGenGlobalFunctions(PVM pVM, PPATCHINFO pPatch)
  */
 int patmPatchGenIllegalInstr(PVM pVM, PPATCHINFO pPatch)
 {
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, 1);
 
     pPB[0] = 0xCC;
 
@@ -974,13 +1015,13 @@ int patmPatchGenCheckIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC)
 {
     uint32_t size;
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmCheckIFRecord.cbFunction);
 
     /* Add lookup record for patch to guest address translation */
     patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pCurInstrGC, PATM_LOOKUP_PATCH2GUEST);
 
     /* Generate code to check for IF=1 before executing the call to the duplicated function. */
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMCheckIFRecord, pCurInstrGC, true);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCheckIFRecord, pCurInstrGC, true);
 
     PATCHGEN_EPILOG(pPatch, size);
     return VINF_SUCCESS;
@@ -997,12 +1038,12 @@ int patmPatchGenCheckIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC)
  */
 int patmPatchGenSetPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC)
 {
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmSetPIFRecord.cbFunction);
 
     /* Add lookup record for patch to guest address translation */
     patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
 
-    int size = patmPatchGenCode(pVM, pPatch, pPB, &PATMSetPIFRecord, 0, false);
+    uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmSetPIFRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
     return VINF_SUCCESS;
 }
@@ -1018,12 +1059,12 @@ int patmPatchGenSetPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC)
  */
 int patmPatchGenClearPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC)
 {
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmSetPIFRecord.cbFunction);
 
     /* Add lookup record for patch to guest address translation */
     patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
 
-    int size = patmPatchGenCode(pVM, pPatch, pPB, &PATMClearPIFRecord, 0, false);
+    uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmClearPIFRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
     return VINF_SUCCESS;
 }
@@ -1039,10 +1080,10 @@ int patmPatchGenClearPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC)
  */
 int patmPatchGenClearInhibitIRQ(PVM pVM, PPATCHINFO pPatch, RTRCPTR pNextInstrGC)
 {
-    int          size;
     PATMCALLINFO callInfo;
-
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PCPATCHASMRECORD pPatchAsmRec = pPatch->flags & PATMFL_DUPLICATE_FUNCTION
+                                  ? &g_patmClearInhibitIRQContIF0Record : &g_patmClearInhibitIRQFaultIF0Record;
+    PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
 
     Assert((pPatch->flags & (PATMFL_GENERATE_JUMPTOGUEST|PATMFL_DUPLICATE_FUNCTION)) != (PATMFL_GENERATE_JUMPTOGUEST|PATMFL_DUPLICATE_FUNCTION));
 
@@ -1051,10 +1092,7 @@ int patmPatchGenClearInhibitIRQ(PVM pVM, PPATCHINFO pPatch, RTRCPTR pNextInstrGC
 
     callInfo.pNextInstrGC = pNextInstrGC;
 
-    if (pPatch->flags & PATMFL_DUPLICATE_FUNCTION)
-        size = patmPatchGenCode(pVM, pPatch, pPB, &PATMClearInhibitIRQContIF0Record, 0, false, &callInfo);
-    else
-        size = patmPatchGenCode(pVM, pPatch, pPB, &PATMClearInhibitIRQFaultIF0Record, 0, false, &callInfo);
+    uint32_t size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false, &callInfo);
 
     PATCHGEN_EPILOG(pPatch, size);
     return VINF_SUCCESS;
@@ -1079,15 +1117,15 @@ int patmPatchGenIntEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pIntHandlerGC)
                                          TRPMForwardTrap takes care of the details. */
     {
         uint32_t size;
-        PATCHGEN_PROLOG(pVM, pPatch);
+        PCPATCHASMRECORD pPatchAsmRec = pPatch->flags & PATMFL_INTHANDLER_WITH_ERRORCODE
+                                      ? &g_patmIntEntryRecordErrorCode : &g_patmIntEntryRecord;
+        PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
 
         /* Add lookup record for patch to guest address translation */
         patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pIntHandlerGC, PATM_LOOKUP_PATCH2GUEST);
 
         /* Generate entrypoint for the interrupt handler (correcting CS in the interrupt stack frame) */
-        size = patmPatchGenCode(pVM, pPatch, pPB,
-                                (pPatch->flags & PATMFL_INTHANDLER_WITH_ERRORCODE) ? &PATMIntEntryRecordErrorCode : &PATMIntEntryRecord,
-                                0, false);
+        size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, 0, false);
 
         PATCHGEN_EPILOG(pPatch, size);
     }
@@ -1110,18 +1148,18 @@ int patmPatchGenIntEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pIntHandlerGC)
 int patmPatchGenTrapEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pTrapHandlerGC)
 {
     uint32_t size;
+    PCPATCHASMRECORD pPatchAsmRec = (pPatch->flags & PATMFL_TRAPHANDLER_WITH_ERRORCODE)
+                                  ? &g_patmTrapEntryRecordErrorCode : &g_patmTrapEntryRecord;
 
     Assert(!EMIsRawRing1Enabled(pVM));
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, pPatchAsmRec->cbFunction);
 
     /* Add lookup record for patch to guest address translation */
     patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pTrapHandlerGC, PATM_LOOKUP_PATCH2GUEST);
 
     /* Generate entrypoint for the trap handler (correcting CS in the interrupt stack frame) */
-    size = patmPatchGenCode(pVM, pPatch, pPB,
-                            (pPatch->flags & PATMFL_TRAPHANDLER_WITH_ERRORCODE) ? &PATMTrapEntryRecordErrorCode : &PATMTrapEntryRecord,
-                            pTrapHandlerGC, true);
+    size = patmPatchGenCode(pVM, pPatch, pPB, pPatchAsmRec, pTrapHandlerGC, true);
     PATCHGEN_EPILOG(pPatch, size);
 
     return VINF_SUCCESS;
@@ -1132,13 +1170,13 @@ int patmPatchGenStats(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC)
 {
     uint32_t size;
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmStatsRecord.cbFunction);
 
     /* Add lookup record for stats code -> guest handler. */
     patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pInstrGC, PATM_LOOKUP_PATCH2GUEST);
 
     /* Generate code to keep calling statistics for this patch */
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMStatsRecord, pInstrGC, false);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmStatsRecord, pInstrGC, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     return VINF_SUCCESS;
@@ -1159,7 +1197,7 @@ int patmPatchGenMovDebug(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu)
     unsigned reg, mod, rm, dbgreg;
     uint32_t offset;
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
 
     mod = 0;            //effective address (only)
     rm  = 5;            //disp32
@@ -1209,7 +1247,7 @@ int patmPatchGenMovControl(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu)
     int reg, mod, rm, ctrlreg;
     uint32_t offset;
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
 
     mod = 0;            //effective address (only)
     rm  = 5;            //disp32
@@ -1275,12 +1313,12 @@ int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR
 
     Assert(pPatch->flags & PATMFL_CODE32);
 
-    PATCHGEN_PROLOG(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMClearPIFRecord, 0, false);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmClearPIFRecord.cbFunction + 2 + g_patmMovFromSSRecord.cbFunction + 2 + g_patmSetPIFRecord.cbFunction);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmClearPIFRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     /* push ss */
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, 2);
     offset = 0;
     if (pCpu->fPrefix & DISPREFIX_OPSIZE)
         pPB[offset++] = 0x66;       /* size override -> 16 bits push */
@@ -1288,12 +1326,12 @@ int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR
     PATCHGEN_EPILOG(pPatch, offset);
 
     /* checks and corrects RPL of pushed ss*/
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMMovFromSSRecord, 0, false);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmMovFromSSRecord.cbFunction);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmMovFromSSRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     /* pop general purpose register */
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, 2);
     offset = 0;
     if (pCpu->fPrefix & DISPREFIX_OPSIZE)
         pPB[offset++] = 0x66; /* size override -> 16 bits pop */
@@ -1301,8 +1339,8 @@ int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR
     PATCHGEN_EPILOG(pPatch, offset);
 
 
-    PATCHGEN_PROLOG_NODEF(pVM, pPatch);
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMSetPIFRecord, 0, false);
+    PATCHGEN_PROLOG_NODEF(pVM, pPatch, g_patmSetPIFRecord.cbFunction);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmSetPIFRecord, 0, false);
     PATCHGEN_EPILOG(pPatch, size);
 
     return VINF_SUCCESS;
@@ -1328,7 +1366,7 @@ int patmPatchGenSldtStr(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR p
     /** @todo segment prefix (untested) */
     Assert(pCpu->fPrefix == DISPREFIX_NONE || pCpu->fPrefix == DISPREFIX_OPSIZE);
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
 
     if (pCpu->Param1.fUse == DISUSE_REG_GEN32 || pCpu->Param1.fUse == DISUSE_REG_GEN16)
     {
@@ -1457,7 +1495,7 @@ int patmPatchGenSxDT(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCur
 //5A                   pop         edx
 //58                   pop         eax
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, PATCHGEN_DEF_SIZE);
     pPB[offset++] = 0x50;              // push      eax
     pPB[offset++] = 0x52;              // push      edx
 
@@ -1516,9 +1554,9 @@ int patmPatchGenSxDT(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCur
 int patmPatchGenCpuid(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC)
 {
     uint32_t size;
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, g_patmCpuidRecord.cbFunction);
 
-    size = patmPatchGenCode(pVM, pPatch, pPB, &PATMCpuidRecord, 0, false);
+    size = patmPatchGenCode(pVM, pPatch, pPB, &g_patmCpuidRecord, 0, false);
 
     PATCHGEN_EPILOG(pPatch, size);
     NOREF(pCurInstrGC);
@@ -1547,7 +1585,7 @@ int patmPatchGenJumpToGuest(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pRe
         AssertRCReturn(rc, rc);
     }
 
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, PATMJumpToGuest_IF1Record.cbFunction);
 
     /* Add lookup record for patch to guest address translation */
     patmR3AddP2GLookupRecord(pVM, pPatch, pPB, pReturnAddrGC, PATM_LOOKUP_PATCH2GUEST);
@@ -1568,7 +1606,7 @@ int patmPatchGenPatchJump(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, RCPTR
     int     rc = VINF_SUCCESS;
 
     Assert(PATMIsPatchGCAddr(pVM, pPatchAddrGC));
-    PATCHGEN_PROLOG(pVM, pPatch);
+    PATCHGEN_PROLOG(pVM, pPatch, SIZEOF_NEARJUMP32);
 
     if (fAddLookupRecord)
     {
diff --git a/src/VBox/VMM/VMMR3/PATMR3Dbg.cpp b/src/VBox/VMM/VMMR3/PATMR3Dbg.cpp
index 96e39fc..0ccd732 100644
--- a/src/VBox/VMM/VMMR3/PATMR3Dbg.cpp
+++ b/src/VBox/VMM/VMMR3/PATMR3Dbg.cpp
@@ -240,10 +240,10 @@ static void patmR3DbgAddPatches(PVM pVM, RTDBGMOD hDbgMod)
     /*
      * Global functions and a start marker.
      */
-    ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperCallGC, PATMLookupAndCallRecord.size, "PATMLookupAndCall");
-    ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperRetGC,  PATMRetFunctionRecord.size,   "PATMRetFunction");
-    ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperJumpGC, PATMLookupAndJumpRecord.size, "PATMLookupAndJump");
-    ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperIretGC, PATMIretFunctionRecord.size,  "PATMIretFunction");
+    ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperCallGC, g_patmLookupAndCallRecord.cbFunction, "PATMLookupAndCall");
+    ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperRetGC,  g_patmRetFunctionRecord.cbFunction,   "PATMRetFunction");
+    ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperJumpGC, g_patmLookupAndJumpRecord.cbFunction, "PATMLookupAndJump");
+    ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pfnHelperIretGC, g_patmIretFunctionRecord.cbFunction,  "PATMIretFunction");
 
     ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pPatchMemGC, 0,  "PatchMemStart");
     ADD_FUNC(hDbgMod, pVM->patm.s.pPatchMemGC, pVM->patm.s.pGCStackGC, PATM_STACK_TOTAL_SIZE, "PATMStack");
diff --git a/src/VBox/VMM/VMMR3/PATMSSM.cpp b/src/VBox/VMM/VMMR3/PATMSSM.cpp
index ea44713..8f346f9 100644
--- a/src/VBox/VMM/VMMR3/PATMSSM.cpp
+++ b/src/VBox/VMM/VMMR3/PATMSSM.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -22,6 +22,7 @@
 *******************************************************************************/
 #define LOG_GROUP LOG_GROUP_PATM
 #include <VBox/vmm/patm.h>
+#include <VBox/vmm/pdmapi.h>
 #include <VBox/vmm/cpum.h>
 #include <VBox/vmm/cpumctx-v1_6.h>
 #include <VBox/vmm/mm.h>
@@ -141,7 +142,9 @@ typedef struct PATMPATCHRECSSM
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-static void patmCorrectFixup(PVM pVM, unsigned ulSSMVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec, int32_t offset, RTRCPTR *pFixup);
+static int patmCorrectFixup(PVM pVM, unsigned ulSSMVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec,
+                            int32_t offset, RTRCPTR *pFixup);
+
 
 /*******************************************************************************
 *   Global Variables                                                           *
@@ -560,24 +563,6 @@ static DECLCALLBACK(int) patmSaveFixupRecords(PAVLPVNODECORE pNode, void *pVM1)
     /* Zero rec.Core.Key since it's unused and may trigger SSM check due to the hack below. */
     rec.Core.Key = 0;
 
-    if (rec.uType == FIXUP_ABSOLUTE)
-    {
-        /* Core.Key abused to store the fixup type. */
-        if (*pFixup == pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions))
-            rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPU_FF_ACTION;
-        else
-        if (*pFixup == CPUMR3GetGuestCpuIdDefRCPtr(pVM))
-            rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_DEFAULT;
-        else
-        if (*pFixup == CPUMR3GetGuestCpuIdStdRCPtr(pVM))
-            rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_STANDARD;
-        else
-        if (*pFixup == CPUMR3GetGuestCpuIdExtRCPtr(pVM))
-            rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_EXTENDED;
-        else
-        if (*pFixup == CPUMR3GetGuestCpuIdCentaurRCPtr(pVM))
-            rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_CENTAUR;
-    }
 
     /* Save the lookup record. */
     int rc = SSMR3PutStructEx(pSSM, &rec, sizeof(rec), 0 /*fFlags*/, &g_aPatmRelocRec[0], NULL);
@@ -816,16 +801,16 @@ DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32
     PATM patmInfo;
     int  rc;
 
-    if (    uVersion != PATM_SSM_VERSION
-        &&  uVersion != PATM_SSM_VERSION_MEM
-        &&  uVersion != PATM_SSM_VERSION_FIXUP_HACK
-        &&  uVersion != PATM_SSM_VERSION_VER16
+    if (    uVersion != PATM_SAVED_STATE_VERSION
+        &&  uVersion != PATM_SAVED_STATE_VERSION_MEM
+        &&  uVersion != PATM_SAVED_STATE_VERSION_FIXUP_HACK
+        &&  uVersion != PATM_SAVED_STATE_VERSION_VER16
        )
     {
         AssertMsgFailed(("patmR3Load: Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
     }
-    uint32_t const fStructRestoreFlags = uVersion <= PATM_SSM_VERSION_MEM ? SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED : 0;
+    uint32_t const fStructRestoreFlags = uVersion <= PATM_SAVED_STATE_VERSION_MEM ? SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED : 0;
     Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
 
     pVM->patm.s.savedstate.pSSM = pSSM;
@@ -834,7 +819,7 @@ DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32
      * Restore PATM structure
      */
     RT_ZERO(patmInfo);
-    if (   uVersion == PATM_SSM_VERSION_MEM
+    if (   uVersion == PATM_SAVED_STATE_VERSION_MEM
         && SSMR3HandleRevision(pSSM) >= 86139
         && SSMR3HandleVersion(pSSM)  >= VBOX_FULL_VERSION_MAKE(4, 2, 51))
         rc = SSMR3GetStructEx(pSSM, &patmInfo, sizeof(patmInfo), SSMSTRUCT_FLAGS_MEM_BAND_AID_RELAXED,
@@ -897,7 +882,7 @@ DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32
      * Restore PATM stack page
      */
     uint32_t cbStack = PATM_STACK_TOTAL_SIZE;
-    if (uVersion > PATM_SSM_VERSION_MEM)
+    if (uVersion > PATM_SAVED_STATE_VERSION_MEM)
     {
         rc = SSMR3GetU32(pSSM, &cbStack);
         AssertRCReturn(rc, rc);
@@ -998,7 +983,8 @@ DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32
                         pFixup        = (RTRCPTR *)rec.pRelocPos;
                     }
 
-                    patmCorrectFixup(pVM, uVersion, patmInfo, &pPatchRec->patch, &rec, offset, pFixup);
+                    rc = patmCorrectFixup(pVM, uVersion, patmInfo, &pPatchRec->patch, &rec, offset, pFixup);
+                    AssertRCReturn(rc, rc);
                 }
 
                 rc = patmPatchAddReloc32(pVM, &pPatchRec->patch, rec.pRelocPos, rec.uType, rec.pSource, rec.pDest);
@@ -1084,7 +1070,8 @@ DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32
         pFixup = (RTRCPTR *)pRec->pRelocPos;
 
         /* Correct fixups that refer to PATM structures in the hypervisor region (their addresses might have changed). */
-        patmCorrectFixup(pVM, uVersion, patmInfo, &pVM->patm.s.pGlobalPatchRec->patch, pRec, offset, pFixup);
+        rc = patmCorrectFixup(pVM, uVersion, patmInfo, &pVM->patm.s.pGlobalPatchRec->patch, pRec, offset, pFixup);
+        AssertRCReturn(rc, rc);
     }
 
 #ifdef VBOX_WITH_STATISTICS
@@ -1105,235 +1092,335 @@ DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32
  *
  * @returns VBox status code.
  * @param   pVM             Pointer to the VM.
- * @param   ulSSMVersion    SSM version
+ * @param   uVersion        Saved state version.
  * @param   patmInfo        Saved PATM structure
  * @param   pPatch          Patch record
  * @param   pRec            Relocation record
  * @param   offset          Offset of referenced data/code
  * @param   pFixup          Fixup address
  */
-static void patmCorrectFixup(PVM pVM, unsigned ulSSMVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec, int32_t offset, RTRCPTR *pFixup)
+static int patmCorrectFixup(PVM pVM, unsigned uVersion, PATM &patmInfo, PPATCHINFO pPatch, PRELOCREC pRec,
+                            int32_t offset, RTRCPTR *pFixup)
 {
     int32_t delta = pVM->patm.s.pPatchMemGC - patmInfo.pPatchMemGC;
 
     switch (pRec->uType)
     {
     case FIXUP_ABSOLUTE:
+    case FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL:
     {
-        if (pRec->pSource && !PATMIsPatchGCAddr(pVM, (RTRCUINTPTR)pRec->pSource))
+        Assert(   pRec->uType != PATM_SAVED_STATE_VERSION_NO_RAW_MEM
+               || (pRec->pSource == pRec->pDest && PATM_IS_ASMFIX(pRec->pSource)) );
+
+        /* bird: What is this for exactly?  Only the MMIO fixups used to have pSource set. */
+        if (    pRec->pSource
+            && !PATMIsPatchGCAddr(pVM, (RTRCUINTPTR)pRec->pSource)
+            && pRec->uType != FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL)
             break;
 
-        if (    *pFixup >= patmInfo.pGCStateGC
-            &&  *pFixup <  patmInfo.pGCStateGC + sizeof(PATMGCSTATE))
+        RTRCPTR const uFixup = *pFixup;
+        if (    uFixup >= patmInfo.pGCStateGC
+            &&  uFixup <  patmInfo.pGCStateGC + sizeof(PATMGCSTATE))
         {
-            LogFlow(("Changing absolute GCState at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, *pFixup, (*pFixup - patmInfo.pGCStateGC) + pVM->patm.s.pGCStateGC));
-            *pFixup = (*pFixup - patmInfo.pGCStateGC) + pVM->patm.s.pGCStateGC;
+            LogFlow(("Changing absolute GCState at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, uFixup, (uFixup - patmInfo.pGCStateGC) + pVM->patm.s.pGCStateGC));
+            *pFixup = (uFixup - patmInfo.pGCStateGC) + pVM->patm.s.pGCStateGC;
         }
-        else
-        if (    *pFixup >= patmInfo.pCPUMCtxGC
-            &&  *pFixup <  patmInfo.pCPUMCtxGC + sizeof(CPUMCTX))
+        else if (   uFixup >= patmInfo.pCPUMCtxGC
+                 && uFixup <  patmInfo.pCPUMCtxGC + sizeof(CPUMCTX))
         {
-            LogFlow(("Changing absolute CPUMCTX at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, *pFixup, (*pFixup - patmInfo.pCPUMCtxGC) + pVM->patm.s.pCPUMCtxGC));
+            LogFlow(("Changing absolute CPUMCTX at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, uFixup, (uFixup - patmInfo.pCPUMCtxGC) + pVM->patm.s.pCPUMCtxGC));
 
             /* The CPUMCTX structure has completely changed, so correct the offsets too. */
-            if (ulSSMVersion == PATM_SSM_VERSION_VER16)
+            if (uVersion == PATM_SAVED_STATE_VERSION_VER16)
             {
-                unsigned uCPUMOffset = *pFixup - patmInfo.pCPUMCtxGC;
+                unsigned offCpumCtx = uFixup - patmInfo.pCPUMCtxGC;
 
                 /* ''case RT_OFFSETOF()'' does not work as gcc refuses to use & as a constant expression.
                  * Defining RT_OFFSETOF as __builtin_offsetof for gcc would make this possible. But this
                  * function is not available in older gcc versions, at least not in gcc-3.3 */
-                if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr0))
+                if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr0))
                 {
-                    LogFlow(("Changing dr[0] offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, dr[0])));
+                    LogFlow(("Changing dr[0] offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, dr[0])));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, dr[0]);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr1))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr1))
                 {
-                    LogFlow(("Changing dr[1] offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, dr[1])));
+                    LogFlow(("Changing dr[1] offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, dr[1])));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, dr[1]);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr2))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr2))
                 {
-                    LogFlow(("Changing dr[2] offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, dr[2])));
+                    LogFlow(("Changing dr[2] offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, dr[2])));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, dr[2]);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr3))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr3))
                 {
-                    LogFlow(("Changing dr[3] offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, dr[3])));
+                    LogFlow(("Changing dr[3] offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, dr[3])));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, dr[3]);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr4))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr4))
                 {
-                    LogFlow(("Changing dr[4] offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, dr[4])));
+                    LogFlow(("Changing dr[4] offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, dr[4])));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, dr[4]);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr5))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr5))
                 {
-                    LogFlow(("Changing dr[5] offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, dr[5])));
+                    LogFlow(("Changing dr[5] offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, dr[5])));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, dr[5]);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr6))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr6))
                 {
-                    LogFlow(("Changing dr[6] offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, dr[6])));
+                    LogFlow(("Changing dr[6] offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, dr[6])));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, dr[6]);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr7))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, dr7))
                 {
-                    LogFlow(("Changing dr[7] offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, dr[7])));
+                    LogFlow(("Changing dr[7] offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, dr[7])));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, dr[7]);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, cr0))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, cr0))
                 {
-                    LogFlow(("Changing cr0 offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, cr0)));
+                    LogFlow(("Changing cr0 offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, cr0)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, cr0);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, cr2))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, cr2))
                 {
-                    LogFlow(("Changing cr2 offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, cr2)));
+                    LogFlow(("Changing cr2 offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, cr2)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, cr2);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, cr3))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, cr3))
                 {
-                    LogFlow(("Changing cr3 offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, cr3)));
+                    LogFlow(("Changing cr3 offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, cr3)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, cr3);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, cr4))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, cr4))
                 {
-                    LogFlow(("Changing cr4 offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, cr4)));
+                    LogFlow(("Changing cr4 offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, cr4)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, cr4);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, tr))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, tr))
                 {
-                    LogFlow(("Changing tr offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, tr)));
+                    LogFlow(("Changing tr offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, tr)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, tr);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, ldtr))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, ldtr))
                 {
-                    LogFlow(("Changing ldtr offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, ldtr)));
+                    LogFlow(("Changing ldtr offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, ldtr)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, ldtr);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, gdtr.pGdt))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, gdtr.pGdt))
                 {
-                    LogFlow(("Changing pGdt offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, gdtr.pGdt)));
+                    LogFlow(("Changing pGdt offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, gdtr.pGdt)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, gdtr.pGdt);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, gdtr.cbGdt))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, gdtr.cbGdt))
                 {
-                    LogFlow(("Changing cbGdt offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, gdtr.cbGdt)));
+                    LogFlow(("Changing cbGdt offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, gdtr.cbGdt)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, gdtr.cbGdt);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, idtr.pIdt))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, idtr.pIdt))
                 {
-                    LogFlow(("Changing pIdt offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, idtr.pIdt)));
+                    LogFlow(("Changing pIdt offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, idtr.pIdt)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, idtr.pIdt);
                 }
-                else if (uCPUMOffset == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, idtr.cbIdt))
+                else if (offCpumCtx == (unsigned)RT_OFFSETOF(CPUMCTX_VER1_6, idtr.cbIdt))
                 {
-                    LogFlow(("Changing cbIdt offset from %x to %x\n", uCPUMOffset, RT_OFFSETOF(CPUMCTX, idtr.cbIdt)));
+                    LogFlow(("Changing cbIdt offset from %x to %x\n", offCpumCtx, RT_OFFSETOF(CPUMCTX, idtr.cbIdt)));
                     *pFixup = pVM->patm.s.pCPUMCtxGC + RT_OFFSETOF(CPUMCTX, idtr.cbIdt);
                 }
                 else
-                    AssertMsgFailed(("Unexpected CPUMCTX offset %x\n", uCPUMOffset));
+                    AssertMsgFailed(("Unexpected CPUMCTX offset %x\n", offCpumCtx));
             }
             else
-                *pFixup = (*pFixup - patmInfo.pCPUMCtxGC) + pVM->patm.s.pCPUMCtxGC;
+                *pFixup = (uFixup - patmInfo.pCPUMCtxGC) + pVM->patm.s.pCPUMCtxGC;
         }
-        else
-        if (    *pFixup >= patmInfo.pStatsGC
-            &&  *pFixup <  patmInfo.pStatsGC + PATM_STAT_MEMSIZE)
+        else if (   uFixup >= patmInfo.pStatsGC
+                 && uFixup <  patmInfo.pStatsGC + PATM_STAT_MEMSIZE)
         {
-            LogFlow(("Changing absolute Stats at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, *pFixup, (*pFixup - patmInfo.pStatsGC) + pVM->patm.s.pStatsGC));
-            *pFixup = (*pFixup - patmInfo.pStatsGC) + pVM->patm.s.pStatsGC;
+            LogFlow(("Changing absolute Stats at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, uFixup, (uFixup - patmInfo.pStatsGC) + pVM->patm.s.pStatsGC));
+            *pFixup = (uFixup - patmInfo.pStatsGC) + pVM->patm.s.pStatsGC;
         }
-        else
-        if (    *pFixup >= patmInfo.pGCStackGC
-            &&  *pFixup <  patmInfo.pGCStackGC + PATM_STACK_TOTAL_SIZE)
+        else if (   uFixup >= patmInfo.pGCStackGC
+                 && uFixup <  patmInfo.pGCStackGC + PATM_STACK_TOTAL_SIZE)
         {
-            LogFlow(("Changing absolute Stack at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, *pFixup, (*pFixup - patmInfo.pGCStackGC) + pVM->patm.s.pGCStackGC));
-            *pFixup = (*pFixup - patmInfo.pGCStackGC) + pVM->patm.s.pGCStackGC;
+            LogFlow(("Changing absolute Stack at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, uFixup, (uFixup - patmInfo.pGCStackGC) + pVM->patm.s.pGCStackGC));
+            *pFixup = (uFixup - patmInfo.pGCStackGC) + pVM->patm.s.pGCStackGC;
         }
-        else
-        if (    *pFixup >= patmInfo.pPatchMemGC
-            &&  *pFixup <  patmInfo.pPatchMemGC + patmInfo.cbPatchMem)
+        else if (   uFixup >= patmInfo.pPatchMemGC
+                 && uFixup <  patmInfo.pPatchMemGC + patmInfo.cbPatchMem)
         {
-            LogFlow(("Changing absolute PatchMem at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, *pFixup, (*pFixup - patmInfo.pPatchMemGC) + pVM->patm.s.pPatchMemGC));
-            *pFixup = (*pFixup - patmInfo.pPatchMemGC) + pVM->patm.s.pPatchMemGC;
+            LogFlow(("Changing absolute PatchMem at %RRv from %RRv to %RRv\n", patmInfo.pPatchMemGC + offset, uFixup, (uFixup - patmInfo.pPatchMemGC) + pVM->patm.s.pPatchMemGC));
+            *pFixup = (uFixup - patmInfo.pPatchMemGC) + pVM->patm.s.pPatchMemGC;
         }
-        else
-        /* Boldly ASSUMES:
+        /*
+         * For PATM_SAVED_STATE_VERSION_FIXUP_HACK and earlier boldly ASSUME:
          * 1. That pCPUMCtxGC is in the VM structure and that its location is
          *    at the first page of the same 4 MB chunk.
          * 2. That the forced actions were in the first 32 bytes of the VM
          *    structure.
-         * 3. That the CPUM leafs are less than 8KB into the structure. */
-        if (    ulSSMVersion <= PATM_SSM_VERSION_FIXUP_HACK
-            &&  *pFixup - (patmInfo.pCPUMCtxGC & UINT32_C(0xffc00000)) < UINT32_C(32))
+         * 3. That the CPUM leaves are less than 8KB into the structure.
+         */
+        else if (   uVersion <= PATM_SAVED_STATE_VERSION_FIXUP_HACK
+                 && uFixup - (patmInfo.pCPUMCtxGC & UINT32_C(0xffc00000)) < UINT32_C(32))
         {
-            LogFlow(("Changing fLocalForcedActions fixup from %RRv to %RRv\n", *pFixup, pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions)));
+            LogFlow(("Changing fLocalForcedActions fixup from %RRv to %RRv\n", uFixup, pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions)));
             *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions);
+            pRec->pSource = pRec->pDest = PATM_ASMFIX_VM_FORCEDACTIONS;
+            pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
         }
-        else
-        if (    ulSSMVersion <= PATM_SSM_VERSION_FIXUP_HACK
-            &&  *pFixup - (patmInfo.pCPUMCtxGC & UINT32_C(0xffc00000)) < UINT32_C(8192))
+        else if (   uVersion <= PATM_SAVED_STATE_VERSION_FIXUP_HACK
+                 && uFixup - (patmInfo.pCPUMCtxGC & UINT32_C(0xffc00000)) < UINT32_C(8192))
         {
             static int cCpuidFixup = 0;
-#ifdef LOG_ENABLED
-            RTRCPTR oldFixup = *pFixup;
-#endif
-            /* very dirty assumptions about the cpuid patch and cpuid ordering. */
-            switch(cCpuidFixup & 3)
+
+            /* Very dirty assumptions about the cpuid patch and cpuid ordering. */
+            switch (cCpuidFixup & 3)
             {
             case 0:
-                *pFixup = CPUMR3GetGuestCpuIdDefRCPtr(pVM);
+                *pFixup = CPUMR3GetGuestCpuIdPatmDefRCPtr(pVM);
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_CPUID_DEF_PTR;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
                 break;
             case 1:
-                *pFixup = CPUMR3GetGuestCpuIdStdRCPtr(pVM);
+                *pFixup = CPUMR3GetGuestCpuIdPatmStdRCPtr(pVM);
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_CPUID_STD_PTR;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
                 break;
             case 2:
-                *pFixup = CPUMR3GetGuestCpuIdExtRCPtr(pVM);
+                *pFixup = CPUMR3GetGuestCpuIdPatmExtRCPtr(pVM);
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_CPUID_EXT_PTR;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
                 break;
             case 3:
-                *pFixup = CPUMR3GetGuestCpuIdCentaurRCPtr(pVM);
+                *pFixup = CPUMR3GetGuestCpuIdPatmCentaurRCPtr(pVM);
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_CPUID_CENTAUR_PTR;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
                 break;
             }
-            LogFlow(("Changing cpuid fixup %d from %RRv to %RRv\n", cCpuidFixup, oldFixup, *pFixup));
+            LogFlow(("Changing cpuid fixup %d from %RRv to %RRv\n", cCpuidFixup, uFixup, *pFixup));
             cCpuidFixup++;
         }
-        else
-        if (ulSSMVersion >= PATM_SSM_VERSION_MEM)
+        /*
+         * For PATM_SAVED_STATE_VERSION_MEM thru PATM_SAVED_STATE_VERSION_NO_RAW_MEM
+         * we abused Core.Key to store the type for fixups needing correcting on load.
+         */
+        else if (   uVersion >= PATM_SAVED_STATE_VERSION_MEM
+                 && uVersion <= PATM_SAVED_STATE_VERSION_NO_RAW_MEM)
         {
-#ifdef LOG_ENABLED
-            RTRCPTR oldFixup = *pFixup;
-#endif
-            /* Core.Key abused to store the type of fixup */
+            /* Core.Key abused to store the type of fixup. */
             switch ((uintptr_t)pRec->Core.Key)
             {
             case PATM_FIXUP_CPU_FF_ACTION:
                 *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions);
-                LogFlow(("Changing cpu ff action fixup from %x to %x\n", oldFixup, *pFixup));
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_VM_FORCEDACTIONS;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
+                LogFlow(("Changing cpu ff action fixup from %x to %x\n", uFixup, *pFixup));
                 break;
             case PATM_FIXUP_CPUID_DEFAULT:
-                *pFixup = CPUMR3GetGuestCpuIdDefRCPtr(pVM);
-                LogFlow(("Changing cpuid def fixup from %x to %x\n", oldFixup, *pFixup));
+                *pFixup = CPUMR3GetGuestCpuIdPatmDefRCPtr(pVM);
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_CPUID_DEF_PTR;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
+                LogFlow(("Changing cpuid def fixup from %x to %x\n", uFixup, *pFixup));
                 break;
             case PATM_FIXUP_CPUID_STANDARD:
-                *pFixup = CPUMR3GetGuestCpuIdStdRCPtr(pVM);
-                LogFlow(("Changing cpuid std fixup from %x to %x\n", oldFixup, *pFixup));
+                *pFixup = CPUMR3GetGuestCpuIdPatmStdRCPtr(pVM);
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_CPUID_STD_PTR;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
+                LogFlow(("Changing cpuid std fixup from %x to %x\n", uFixup, *pFixup));
                 break;
             case PATM_FIXUP_CPUID_EXTENDED:
-                *pFixup = CPUMR3GetGuestCpuIdExtRCPtr(pVM);
-                LogFlow(("Changing cpuid ext fixup from %x to %x\n", oldFixup, *pFixup));
+                *pFixup = CPUMR3GetGuestCpuIdPatmExtRCPtr(pVM);
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_CPUID_EXT_PTR;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
+                LogFlow(("Changing cpuid ext fixup from %x to %x\n", uFixup, *pFixup));
                 break;
             case PATM_FIXUP_CPUID_CENTAUR:
-                *pFixup = CPUMR3GetGuestCpuIdCentaurRCPtr(pVM);
-                LogFlow(("Changing cpuid centaur fixup from %x to %x\n", oldFixup, *pFixup));
+                *pFixup = CPUMR3GetGuestCpuIdPatmCentaurRCPtr(pVM);
+                pRec->pSource = pRec->pDest = PATM_ASMFIX_CPUID_CENTAUR_PTR;
+                pRec->uType   = FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL;
+                LogFlow(("Changing cpuid centaur fixup from %x to %x\n", uFixup, *pFixup));
                 break;
             default:
-                AssertMsgFailed(("Unexpected fixup value %x\n", *pFixup));
+                AssertMsgFailed(("Unexpected fixup value %p\n", (uintptr_t)pRec->Core.Key));
                 break;
             }
         }
+        /*
+         * After PATM_SAVED_STATE_VERSION_NO_RAW_MEM we changed the fixup type
+         * and instead put the patch fixup code in the source and target addresses.
+         */
+        else if (   uVersion > PATM_SAVED_STATE_VERSION_NO_RAW_MEM
+                 && pRec->uType == FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL)
+        {
+            Assert(pRec->pSource == pRec->pDest); Assert(PATM_IS_ASMFIX(pRec->pSource));
+            switch (pRec->pSource)
+            {
+                case PATM_ASMFIX_VM_FORCEDACTIONS:
+                    *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions);
+                    break;
+                case PATM_ASMFIX_CPUID_DEF_PTR:
+                    *pFixup = CPUMR3GetGuestCpuIdPatmDefRCPtr(pVM);
+                    break;
+                case PATM_ASMFIX_CPUID_STD_PTR: /* Saved again patches only. */
+                    *pFixup = CPUMR3GetGuestCpuIdPatmStdRCPtr(pVM);
+                    break;
+                case PATM_ASMFIX_CPUID_EXT_PTR: /* Saved again patches only. */
+                    *pFixup = CPUMR3GetGuestCpuIdPatmExtRCPtr(pVM);
+                    break;
+                case PATM_ASMFIX_CPUID_CENTAUR_PTR: /* Saved again patches only. */
+                    *pFixup = CPUMR3GetGuestCpuIdPatmCentaurRCPtr(pVM);
+                    break;
+                case PATM_ASMFIX_REUSE_LATER_0: /* Was only used for a few days. Don't want to keep this legacy around.  */
+                case PATM_ASMFIX_REUSE_LATER_1:
+                    AssertLogRelMsgFailedReturn(("Unsupported PATM fixup. You have to discard this saved state or snapshot."),
+                                                VERR_INTERNAL_ERROR);
+                    break;
+            }
+        }
+        /*
+         * Constant that may change between VM version needs fixing up.
+         */
+        else if (pRec->uType == FIXUP_CONSTANT_IN_PATCH_ASM_TMPL)
+        {
+            AssertLogRelReturn(uVersion > PATM_SAVED_STATE_VERSION_NO_RAW_MEM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
+            Assert(pRec->pSource == pRec->pDest); Assert(PATM_IS_ASMFIX(pRec->pSource));
+            switch (pRec->pSource)
+            {
+                case PATM_ASMFIX_REUSE_LATER_2: /* Was only used for a few days. Don't want to keep this legacy around.  */
+                case PATM_ASMFIX_REUSE_LATER_3:
+                    AssertLogRelMsgFailedReturn(("Unsupported PATM fixup. You have to discard this saved state or snapshot."),
+                                                VERR_INTERNAL_ERROR);
+                    break;
+                default:
+                    AssertLogRelMsgFailed(("Unknown FIXUP_CONSTANT_IN_PATCH_ASM_TMPL fixup: %#x\n", pRec->pSource));
+                    return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
+            }
+        }
+        /*
+         * Relative fixups for calling or jumping to helper functions inside VMMRC.
+         * (The distance between the helper function and the patch is subject to
+         * new code being added to VMMRC as well as VM configurations influencing
+         * heap allocations and so on and so forth.)
+         */
+        else if (pRec->uType == FIXUP_REL_HELPER_IN_PATCH_ASM_TMPL)
+        {
+            AssertLogRelReturn(uVersion > PATM_SAVED_STATE_VERSION_NO_RAW_MEM, VERR_SSM_DATA_UNIT_FORMAT_CHANGED);
+            Assert(pRec->pSource == pRec->pDest); Assert(PATM_IS_ASMFIX(pRec->pSource));
+            int     rc;
+            RTRCPTR uRCPtrDest;
+            switch (pRec->pSource)
+            {
+                case PATM_ASMFIX_HELPER_CPUM_CPUID:
+                    rc = PDMR3LdrGetSymbolRC(pVM, NULL, "CPUMPatchHlpCpuId", &uRCPtrDest);
+                    AssertLogRelRCReturn(rc, rc);
+                    break;
+                default:
+                    AssertLogRelMsgFailed(("Unknown FIXUP_REL_HLP_CALL_IN_PATCH_ASM_TMPL fixup: %#x\n", pRec->pSource));
+                    return VERR_SSM_DATA_UNIT_FORMAT_CHANGED;
+            }
+            RTRCPTR uRCPtrAfter = pVM->patm.s.pPatchMemGC + ((uintptr_t)&pFixup[1] - (uintptr_t)pVM->patm.s.pPatchMemHC);
+            *pFixup = uRCPtrDest - uRCPtrAfter;
+        }
 
 #ifdef RT_OS_WINDOWS
         AssertCompile(RT_OFFSETOF(VM, fGlobalForcedActions) < 32);
@@ -1391,8 +1478,10 @@ static void patmCorrectFixup(PVM pVM, unsigned ulSSMVersion, PATM &patmInfo, PPA
             if (rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT)
             {
                 RTRCPTR pPage = pPatch->pPrivInstrGC & PAGE_BASE_GC_MASK;
-
-                rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_ALL, pPage, pPage + (PAGE_SIZE - 1) /* inclusive! */, 0, patmVirtPageHandler, "PATMGCMonitorPage", 0, "PATMMonitorPatchJump");
+                rc = PGMR3HandlerVirtualRegister(pVM, VMMGetCpu(pVM), pVM->patm.s.hMonitorPageType,
+                                                 pPage,
+                                                 pPage + (PAGE_SIZE - 1) /* inclusive! */,
+                                                 (void *)(uintptr_t)pPage, pPage, NULL /*pszDesc*/);
                 Assert(RT_SUCCESS(rc) || rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT);
             }
             else
@@ -1433,6 +1522,7 @@ static void patmCorrectFixup(PVM pVM, unsigned ulSSMVersion, PATM &patmInfo, PPA
         break;
 
     }
-}
+    }
+    return VINF_SUCCESS;
 }
 
diff --git a/src/VBox/VMM/VMMR3/PDM.cpp b/src/VBox/VMM/VMMR3/PDM.cpp
index 3579f40..d858fda 100644
--- a/src/VBox/VMM/VMMR3/PDM.cpp
+++ b/src/VBox/VMM/VMMR3/PDM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -37,7 +37,7 @@
  * Devices register themselves when the module containing them is loaded.  PDM
  * will call the entry point 'VBoxDevicesRegister' when loading a device module.
  * The device module will then use the supplied callback table to check the VMM
- * version and to register its devices.  Each device have an unique (for the
+ * version and to register its devices.  Each device has an unique (for the
  * configured VM) name.  The name is not only used in PDM but also in CFGM (to
  * organize device and device instance settings) and by anyone who wants to talk
  * to a specific device instance.
@@ -51,7 +51,7 @@
  *
  * Some devices are trusted devices, most are not.  The trusted devices are an
  * integrated part of the VM and can obtain the VM handle from their device
- * instance handles, thus enabling them to call any VM api.  Untrusted devices
+ * instance handles, thus enabling them to call any VM API.  Untrusted devices
  * can only use the callbacks provided during device instantiation.
  *
  * The main purpose in having DevHlps rather than just giving all the devices
@@ -63,8 +63,8 @@
  *
  * A device can provide a ring-0 and/or a raw-mode context extension to improve
  * the VM performance by handling exits and traps (respectively) without
- * requiring context switches (to ring-3).  Callbacks for MMIO and I/O ports can
- * needs to be registered specifically for the additional contexts for this to
+ * requiring context switches (to ring-3).  Callbacks for MMIO and I/O ports
+ * need to be registered specifically for the additional contexts for this to
  * make sense.  Also, the device has to be trusted to be loaded into R0/RC
  * because of the extra privilege it entails.  Note that raw-mode code and data
  * will be subject to relocation.
@@ -103,7 +103,7 @@
  *
  * The way USB devices work differs greatly from other devices though since they
  * aren't attaches directly to the PCI/ISA/whatever system buses but via a
- * USB host control (OHCI, UHCI or EHCI).  USB devices handles USB requests
+ * USB host control (OHCI, UHCI or EHCI).  USB devices handle USB requests
  * (URBs) and does not register I/O ports, MMIO ranges or PCI bus
  * devices/functions.
  *
@@ -119,7 +119,7 @@
  * For instance take a DVD/CD drive.  This can be connected to a SCSI
  * controller, an ATA controller or a SATA controller.  The basics of the DVD/CD
  * drive implementation remains the same - eject, insert, read, seek, and such.
- * (For the scsi case, you might wanna speak SCSI directly to, but that can of
+ * (For the scsi SCSCI, you might want to speak SCSI directly to, but that can of
  * course be fixed - see SCSI passthru.)  So, it
  * makes much sense to have a generic CD/DVD driver which implements this.
  *
@@ -135,10 +135,10 @@
  * the DVD/CD Driver will have a ISO, HostDVD or RAW (media) Driver attached.
  *
  * It is possible to configure many levels of drivers inserting filters, loggers,
- * or whatever you desire into the chain.  We're using this for network sniffing
+ * or whatever you desire into the chain.  We're using this for network sniffing,
  * for instance.
  *
- * The drivers are loaded in a similar manner to that of the device, namely by
+ * The drivers are loaded in a similar manner to that of a device, namely by
  * iterating a keyspace in CFGM, load the modules listed there and call
  * 'VBoxDriversRegister' with a callback table.
  *
@@ -147,14 +147,14 @@
  *
  * @section sec_pdm_ifs     Interfaces
  *
- * The pluggable drivers and devices exposes one standard interface (callback
+ * The pluggable drivers and devices expose one standard interface (callback
  * table) which is used to construct, destruct, attach, detach,( ++,) and query
  * other interfaces. A device will query the interfaces required for it's
  * operation during init and hot-plug.  PDM may query some interfaces during
  * runtime mounting too.
  *
  * An interface here means a function table contained within the device or
- * driver instance data. Its method are invoked with the function table pointer
+ * driver instance data. Its methods are invoked with the function table pointer
  * as the first argument and they will calculate the address of the device or
  * driver instance data from it. (This is one of the aspects which *might* have
  * been better done in C++.)
@@ -277,8 +277,12 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
 /** The PDM saved state version. */
-#define PDM_SAVED_STATE_VERSION             4
-#define PDM_SAVED_STATE_VERSION_PRE_NMI_FF  3
+#define PDM_SAVED_STATE_VERSION               5
+/** Before the PDM audio architecture was introduced there was an "AudioSniffer"
+ *  device which took care of multiplexing input/output audio data from/to various places.
+ *  Thus this device is not needed/used anymore. */
+#define PDM_SAVED_STATE_VERSION_PRE_PDM_AUDIO 4
+#define PDM_SAVED_STATE_VERSION_PRE_NMI_FF    3
 
 /** The number of nanoseconds a suspend callback needs to take before
  * PDMR3Suspend warns about it taking too long. */
@@ -485,6 +489,7 @@ VMMR3_INT_DECL(void) PDMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
         pVM->pdm.s.Apic.pfnBusDeliverRC     += offDelta;
         if (pVM->pdm.s.Apic.pfnLocalInterruptRC)
             pVM->pdm.s.Apic.pfnLocalInterruptRC += offDelta;
+        pVM->pdm.s.Apic.pfnGetTimerFreqRC   += offDelta;
         pVM->pdm.s.Apic.pfnWriteMSRRC       += offDelta;
         pVM->pdm.s.Apic.pfnReadMSRRC        += offDelta;
     }
@@ -895,7 +900,8 @@ static DECLCALLBACK(int) pdmR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersi
      * Validate version.
      */
     if (    uVersion != PDM_SAVED_STATE_VERSION
-        &&  uVersion != PDM_SAVED_STATE_VERSION_PRE_NMI_FF)
+        &&  uVersion != PDM_SAVED_STATE_VERSION_PRE_NMI_FF
+        &&  uVersion != PDM_SAVED_STATE_VERSION_PRE_PDM_AUDIO)
     {
         AssertMsgFailed(("Invalid version uVersion=%d!\n", uVersion));
         return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
@@ -1016,7 +1022,7 @@ static DECLCALLBACK(int) pdmR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersi
         /* Try locate it. */
         PPDMDEVINS pDevIns;
         for (pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextR3)
-            if (   !strcmp(szName, pDevIns->pReg->szName)
+            if (   !RTStrCmp(szName, pDevIns->pReg->szName)
                 && pDevIns->iInstance == iInstance)
             {
                 AssertLogRelMsgReturn(!(pDevIns->Internal.s.fIntFlags & PDMDEVINSINT_FLAGS_FOUND),
@@ -1025,11 +1031,23 @@ static DECLCALLBACK(int) pdmR3LoadExec(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersi
                 pDevIns->Internal.s.fIntFlags |= PDMDEVINSINT_FLAGS_FOUND;
                 break;
             }
+
         if (!pDevIns)
         {
-            LogRel(("Device '%s'/%d not found in current config\n", szName, iInstance));
-            if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
-                return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device '%s'/%d not found in current config"), szName, iInstance);
+            bool fSkip = false;
+
+#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
+            /* Skip the non-existing "AudioSniffer" device stored in the saved state. */
+            if (   uVersion <= PDM_SAVED_STATE_VERSION_PRE_PDM_AUDIO
+                && !RTStrCmp(szName, "AudioSniffer"))
+                fSkip = true;
+#endif
+            if (!fSkip)
+            {
+                LogRel(("Device '%s'/%d not found in current config\n", szName, iInstance));
+                if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT)
+                    return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device '%s'/%d not found in current config"), szName, iInstance);
+            }
         }
     }
 
@@ -2224,7 +2242,7 @@ VMMR3DECL(int) PDMR3QueryDevice(PUVM pUVM, const char *pszDevice, unsigned iInst
  */
 VMMR3DECL(int) PDMR3QueryDeviceLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase)
 {
-    LogFlow(("PDMR3QueryLun: pszDevice=%p:{%s} iInstance=%u iLun=%u ppBase=%p\n",
+    LogFlow(("PDMR3QueryDeviceLun: pszDevice=%p:{%s} iInstance=%u iLun=%u ppBase=%p\n",
              pszDevice, pszDevice, iInstance, iLun, ppBase));
     UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     VM_ASSERT_VALID_EXT_RETURN(pUVM->pVM, VERR_INVALID_VM_HANDLE);
diff --git a/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp b/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp
index 7267ac7..59fbc29 100644
--- a/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp
+++ b/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp
@@ -799,8 +799,7 @@ static int pdmacFileInitialize(PPDMASYNCCOMPLETIONEPCLASS pClassGlobals, PCFGMNO
 #endif
     if (RT_FAILURE(rc))
     {
-        LogRel(("AIO: Async I/O manager not supported (rc=%Rrc). Falling back to simple manager\n",
-                rc));
+        LogRel(("AIO: Async I/O manager not supported (rc=%Rrc). Falling back to simple manager\n", rc));
         pEpClassFile->enmMgrTypeOverride = PDMACEPFILEMGRTYPE_SIMPLE;
         pEpClassFile->enmEpBackendDefault = PDMACFILEEPBACKEND_BUFFERED;
     }
@@ -821,7 +820,7 @@ static int pdmacFileInitialize(PPDMASYNCCOMPLETIONEPCLASS pClassGlobals, PCFGMNO
             if (RT_FAILURE(rc))
                 return rc;
 
-            LogRel(("AIOMgr: Default manager type is \"%s\"\n", pdmacFileMgrTypeToName(pEpClassFile->enmMgrTypeOverride)));
+            LogRel(("AIOMgr: Default manager type is '%s'\n", pdmacFileMgrTypeToName(pEpClassFile->enmMgrTypeOverride)));
 
             /* Query default backend type */
             rc = CFGMR3QueryStringAllocDef(pCfgNode, "FileBackend", &pszVal, "NonBuffered");
@@ -832,7 +831,7 @@ static int pdmacFileInitialize(PPDMASYNCCOMPLETIONEPCLASS pClassGlobals, PCFGMNO
             if (RT_FAILURE(rc))
                 return rc;
 
-            LogRel(("AIOMgr: Default file backend is \"%s\"\n", pdmacFileBackendTypeToName(pEpClassFile->enmEpBackendDefault)));
+            LogRel(("AIOMgr: Default file backend is '%s'\n", pdmacFileBackendTypeToName(pEpClassFile->enmEpBackendDefault)));
 
 #ifdef RT_OS_LINUX
             if (   pEpClassFile->enmMgrTypeOverride == PDMACEPFILEMGRTYPE_ASYNC
@@ -969,7 +968,7 @@ static int pdmacFileEpInitialize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint,
     if (   rc == VERR_INVALID_FUNCTION
         || rc == VERR_INVALID_PARAMETER)
     {
-        LogRel(("pdmacFileEpInitialize: RTFileOpen %s / %08x failed with %Rrc\n",
+        LogRel(("AIOMgr: pdmacFileEpInitialize: RTFileOpen %s / %08x failed with %Rrc\n",
                pszUri, fFileFlags, rc));
         /*
          * Solaris doesn't support directio on ZFS so far. :-\
@@ -995,7 +994,7 @@ static int pdmacFileEpInitialize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint,
 
         if (RT_FAILURE(rc))
         {
-            LogRel(("pdmacFileEpInitialize: RTFileOpen %s / %08x failed AGAIN(!) with %Rrc\n",
+            LogRel(("AIOMgr: pdmacFileEpInitialize: RTFileOpen %s / %08x failed AGAIN(!) with %Rrc\n",
                         pszUri, fFileFlags, rc));
         }
     }
diff --git a/src/VBox/VMM/VMMR3/PDMBlkCache.cpp b/src/VBox/VMM/VMMR3/PDMBlkCache.cpp
index 7bd9811..17996a8 100644
--- a/src/VBox/VMM/VMMR3/PDMBlkCache.cpp
+++ b/src/VBox/VMM/VMMR3/PDMBlkCache.cpp
@@ -1129,7 +1129,7 @@ int pdmR3BlkCacheInit(PVM pVM)
                                        NULL, pdmR3BlkCacheLoadExec, NULL);
             if (RT_SUCCESS(rc))
             {
-                LogRel(("BlkCache: Cache successfully initialised. Cache size is %u bytes\n", pBlkCacheGlobal->cbMax));
+                LogRel(("BlkCache: Cache successfully initialized. Cache size is %u bytes\n", pBlkCacheGlobal->cbMax));
                 LogRel(("BlkCache: Cache commit interval is %u ms\n", pBlkCacheGlobal->u32CommitTimeoutMs));
                 LogRel(("BlkCache: Cache commit threshold is %u bytes\n", pBlkCacheGlobal->cbCommitDirtyThreshold));
                 pUVM->pdm.s.pBlkCacheGlobal = pBlkCacheGlobal;
@@ -1913,8 +1913,6 @@ static bool pdmBlkCacheReqUpdate(PPDMBLKCACHE pBlkCache, PPDMBLKCACHEREQ pReq,
     {
         if (fCallHandler)
             pdmBlkCacheReqComplete(pBlkCache, pReq);
-        else
-            RTMemFree(pReq);
         return true;
     }
 
@@ -2132,6 +2130,11 @@ VMMR3DECL(int) PDMR3BlkCacheRead(PPDMBLKCACHE pBlkCache, uint64_t off,
 
     if (!pdmBlkCacheReqUpdate(pBlkCache, pReq, rc, false))
         rc = VINF_AIO_TASK_PENDING;
+    else
+    {
+        rc = pReq->rcReq;
+        RTMemFree(pReq);
+    }
 
     LogFlowFunc((": Leave rc=%Rrc\n", rc));
 
@@ -2360,6 +2363,11 @@ VMMR3DECL(int) PDMR3BlkCacheWrite(PPDMBLKCACHE pBlkCache, uint64_t off,
 
     if (!pdmBlkCacheReqUpdate(pBlkCache, pReq, rc, false))
         rc = VINF_AIO_TASK_PENDING;
+    else
+    {
+        rc = pReq->rcReq;
+        RTMemFree(pReq);
+    }
 
     LogFlowFunc((": Leave rc=%Rrc\n", rc));
 
@@ -2536,6 +2544,11 @@ VMMR3DECL(int) PDMR3BlkCacheDiscard(PPDMBLKCACHE pBlkCache, PCRTRANGE paRanges,
 
     if (!pdmBlkCacheReqUpdate(pBlkCache, pReq, rc, false))
         rc = VINF_AIO_TASK_PENDING;
+    else
+    {
+        rc = pReq->rcReq;
+        RTMemFree(pReq);
+    }
 
     LogFlowFunc((": Leave rc=%Rrc\n", rc));
 
diff --git a/src/VBox/VMM/VMMR3/PDMDevHlp.cpp b/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
index 3e22938..5df8148 100644
--- a/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
+++ b/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
@@ -716,9 +716,9 @@ static DECLCALLBACK(int) pdmR3DevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhy
 
     int rc;
     if (VM_IS_EMT(pVM))
-        rc = PGMPhysRead(pVM, GCPhys, pvBuf, cbRead);
+        rc = PGMPhysRead(pVM, GCPhys, pvBuf, cbRead, PGMACCESSORIGIN_DEVICE);
     else
-        rc = PGMR3PhysReadExternal(pVM, GCPhys, pvBuf, cbRead);
+        rc = PGMR3PhysReadExternal(pVM, GCPhys, pvBuf, cbRead, PGMACCESSORIGIN_DEVICE);
 
     Log(("pdmR3DevHlp_PhysRead: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
     return rc;
@@ -744,9 +744,9 @@ static DECLCALLBACK(int) pdmR3DevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPh
 
     int rc;
     if (VM_IS_EMT(pVM))
-        rc = PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite);
+        rc = PGMPhysWrite(pVM, GCPhys, pvBuf, cbWrite, PGMACCESSORIGIN_DEVICE);
     else
-        rc = PGMR3PhysWriteExternal(pVM, GCPhys, pvBuf, cbWrite, pDevIns->pReg->szName);
+        rc = PGMR3PhysWriteExternal(pVM, GCPhys, pvBuf, cbWrite, PGMACCESSORIGIN_DEVICE);
 
     Log(("pdmR3DevHlp_PhysWrite: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
     return rc;
@@ -2312,6 +2312,16 @@ static DECLCALLBACK(PVMCPU) pdmR3DevHlp_GetVMCPU(PPDMDEVINS pDevIns)
 }
 
 
+/** @interface_method_impl{PDMDEVHLPR3,pfnGetCurrentCpuId} */
+static DECLCALLBACK(VMCPUID) pdmR3DevHlp_GetCurrentCpuId(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    VMCPUID idCpu = VMMGetCpuId(pDevIns->Internal.s.pVMR3);
+    LogFlow(("pdmR3DevHlp_GetCurrentCpuId: caller='%s'/%d for CPU %u\n", pDevIns->pReg->szName, pDevIns->iInstance, idCpu));
+    return idCpu;
+}
+
+
 /** @interface_method_impl{PDMDEVHLPR3,pfnPCIBusRegister} */
 static DECLCALLBACK(int) pdmR3DevHlp_PCIBusRegister(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3)
 {
@@ -2587,13 +2597,13 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
     PDMDEV_ASSERT_DEVINS(pDevIns);
     VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
     LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: pApicReg=%p:{.u32Version=%#x, .pfnGetInterruptR3=%p, .pfnSetBaseR3=%p, .pfnGetBaseR3=%p, "
-             ".pfnSetTPRR3=%p, .pfnGetTPRR3=%p, .pfnWriteMSR3=%p, .pfnReadMSR3=%p, .pfnBusDeliverR3=%p, .pfnLocalInterruptR3=%p, pszGetInterruptRC=%p:{%s}, pszSetBaseRC=%p:{%s}, pszGetBaseRC=%p:{%s}, "
-             ".pszSetTPRRC=%p:{%s}, .pszGetTPRRC=%p:{%s}, .pszWriteMSRRC=%p:{%s}, .pszReadMSRRC=%p:{%s}, .pszBusDeliverRC=%p:{%s}, .pszLocalInterruptRC=%p:{%s}} ppApicHlpR3=%p\n",
+             ".pfnSetTPRR3=%p, .pfnGetTPRR3=%p, .pfnWriteMSR3=%p, .pfnReadMSR3=%p, .pfnBusDeliverR3=%p, .pfnLocalInterruptR3=%p .pfnGetTimerFreqR3=%p, pszGetInterruptRC=%p:{%s}, pszSetBaseRC=%p:{%s}, pszGetBaseRC=%p:{%s}, "
+             ".pszSetTPRRC=%p:{%s}, .pszGetTPRRC=%p:{%s}, .pszWriteMSRRC=%p:{%s}, .pszReadMSRRC=%p:{%s}, .pszBusDeliverRC=%p:{%s}, .pszLocalInterruptRC=%p:{%s}, .pszGetTimerFreqRC=%p:{%s}} ppApicHlpR3=%p\n",
              pDevIns->pReg->szName, pDevIns->iInstance, pApicReg, pApicReg->u32Version, pApicReg->pfnGetInterruptR3, pApicReg->pfnSetBaseR3,
-             pApicReg->pfnGetBaseR3, pApicReg->pfnSetTPRR3, pApicReg->pfnGetTPRR3, pApicReg->pfnWriteMSRR3, pApicReg->pfnReadMSRR3, pApicReg->pfnBusDeliverR3, pApicReg->pfnLocalInterruptR3, pApicReg->pszGetInterruptRC,
+             pApicReg->pfnGetBaseR3, pApicReg->pfnSetTPRR3, pApicReg->pfnGetTPRR3, pApicReg->pfnWriteMSRR3, pApicReg->pfnReadMSRR3, pApicReg->pfnBusDeliverR3, pApicReg->pfnLocalInterruptR3, pApicReg->pfnGetTimerFreqR3, pApicReg->pszGetInterruptRC,
              pApicReg->pszGetInterruptRC, pApicReg->pszSetBaseRC, pApicReg->pszSetBaseRC, pApicReg->pszGetBaseRC, pApicReg->pszGetBaseRC,
              pApicReg->pszSetTPRRC, pApicReg->pszSetTPRRC, pApicReg->pszGetTPRRC, pApicReg->pszGetTPRRC, pApicReg->pszWriteMSRRC, pApicReg->pszWriteMSRRC, pApicReg->pszReadMSRRC, pApicReg->pszReadMSRRC, pApicReg->pszBusDeliverRC,
-             pApicReg->pszBusDeliverRC, pApicReg->pszLocalInterruptRC, pApicReg->pszLocalInterruptRC, ppApicHlpR3));
+             pApicReg->pszBusDeliverRC, pApicReg->pszLocalInterruptRC, pApicReg->pszLocalInterruptRC, pApicReg->pszGetTimerFreqRC, pApicReg->pszGetTimerFreqRC, ppApicHlpR3));
 
     /*
      * Validate input.
@@ -2613,7 +2623,8 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
         ||  !pApicReg->pfnWriteMSRR3
         ||  !pApicReg->pfnReadMSRR3
         ||  !pApicReg->pfnBusDeliverR3
-        ||  !pApicReg->pfnLocalInterruptR3)
+        ||  !pApicReg->pfnLocalInterruptR3
+        ||  !pApicReg->pfnGetTimerFreqR3)
     {
         Assert(pApicReg->pfnGetInterruptR3);
         Assert(pApicReg->pfnHasPendingIrqR3);
@@ -2625,6 +2636,7 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
         Assert(pApicReg->pfnReadMSRR3);
         Assert(pApicReg->pfnBusDeliverR3);
         Assert(pApicReg->pfnLocalInterruptR3);
+        Assert(pApicReg->pfnGetTimerFreqR3);
         LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc (R3 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
         return VERR_INVALID_PARAMETER;
     }
@@ -2637,7 +2649,8 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
             ||  pApicReg->pszWriteMSRRC
             ||  pApicReg->pszReadMSRRC
             ||  pApicReg->pszBusDeliverRC
-            ||  pApicReg->pszLocalInterruptRC)
+            ||  pApicReg->pszLocalInterruptRC
+            ||  pApicReg->pszGetTimerFreqRC)
         &&  (   !VALID_PTR(pApicReg->pszGetInterruptRC)
             ||  !VALID_PTR(pApicReg->pszHasPendingIrqRC)
             ||  !VALID_PTR(pApicReg->pszSetBaseRC)
@@ -2647,7 +2660,8 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
             ||  !VALID_PTR(pApicReg->pszWriteMSRRC)
             ||  !VALID_PTR(pApicReg->pszReadMSRRC)
             ||  !VALID_PTR(pApicReg->pszBusDeliverRC)
-            ||  !VALID_PTR(pApicReg->pszLocalInterruptRC))
+            ||  !VALID_PTR(pApicReg->pszLocalInterruptRC)
+            ||  !VALID_PTR(pApicReg->pszGetTimerFreqRC))
        )
     {
         Assert(VALID_PTR(pApicReg->pszGetInterruptRC));
@@ -2660,6 +2674,7 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
         Assert(VALID_PTR(pApicReg->pszWriteMSRRC));
         Assert(VALID_PTR(pApicReg->pszBusDeliverRC));
         Assert(VALID_PTR(pApicReg->pszLocalInterruptRC));
+        Assert(VALID_PTR(pApicReg->pszGetTimerFreqRC));
         LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc (RC callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
         return VERR_INVALID_PARAMETER;
     }
@@ -2672,7 +2687,8 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
             ||  pApicReg->pszWriteMSRR0
             ||  pApicReg->pszReadMSRR0
             ||  pApicReg->pszBusDeliverR0
-            ||  pApicReg->pszLocalInterruptR0)
+            ||  pApicReg->pszLocalInterruptR0
+            ||  pApicReg->pszGetTimerFreqR0)
         &&  (   !VALID_PTR(pApicReg->pszGetInterruptR0)
             ||  !VALID_PTR(pApicReg->pszHasPendingIrqR0)
             ||  !VALID_PTR(pApicReg->pszSetBaseR0)
@@ -2682,7 +2698,8 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
             ||  !VALID_PTR(pApicReg->pszReadMSRR0)
             ||  !VALID_PTR(pApicReg->pszWriteMSRR0)
             ||  !VALID_PTR(pApicReg->pszBusDeliverR0)
-            ||  !VALID_PTR(pApicReg->pszLocalInterruptR0))
+            ||  !VALID_PTR(pApicReg->pszLocalInterruptR0)
+            ||  !VALID_PTR(pApicReg->pszGetTimerFreqR0))
        )
     {
         Assert(VALID_PTR(pApicReg->pszGetInterruptR0));
@@ -2695,6 +2712,7 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
         Assert(VALID_PTR(pApicReg->pszWriteMSRR0));
         Assert(VALID_PTR(pApicReg->pszBusDeliverR0));
         Assert(VALID_PTR(pApicReg->pszLocalInterruptR0));
+        Assert(VALID_PTR(pApicReg->pszGetTimerFreqR0));
         LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc (R0 callbacks)\n", pDevIns->pReg->szName, pDevIns->iInstance, VERR_INVALID_PARAMETER));
         return VERR_INVALID_PARAMETER;
     }
@@ -2769,9 +2787,14 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
             rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszLocalInterruptRC, &pVM->pdm.s.Apic.pfnLocalInterruptRC);
             AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszLocalInterruptRC, rc));
         }
+        if (RT_SUCCESS(rc))
+        {
+            rc = pdmR3DevGetSymbolRCLazy(pDevIns, pApicReg->pszGetTimerFreqRC, &pVM->pdm.s.Apic.pfnGetTimerFreqRC);
+            AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szRCMod, pApicReg->pszGetTimerFreqRC, rc));
+        }
         if (RT_FAILURE(rc))
         {
-            LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
+            LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
             return rc;
         }
         pVM->pdm.s.Apic.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
@@ -2789,6 +2812,7 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
         pVM->pdm.s.Apic.pfnReadMSRRC        = 0;
         pVM->pdm.s.Apic.pfnBusDeliverRC     = 0;
         pVM->pdm.s.Apic.pfnLocalInterruptRC = 0;
+        pVM->pdm.s.Apic.pfnGetTimerFreqRC   = 0;
     }
 
     /*
@@ -2843,9 +2867,14 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
             rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszLocalInterruptR0, &pVM->pdm.s.Apic.pfnLocalInterruptR0);
             AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszLocalInterruptR0, rc));
         }
+        if (RT_SUCCESS(rc))
+        {
+            rc = pdmR3DevGetSymbolR0Lazy(pDevIns, pApicReg->pszGetTimerFreqR0, &pVM->pdm.s.Apic.pfnGetTimerFreqR0);
+            AssertMsgRC(rc, ("%s::%s rc=%Rrc\n", pDevIns->pReg->szR0Mod, pApicReg->pszGetTimerFreqR0, rc));
+        }
         if (RT_FAILURE(rc))
         {
-            LogFlow(("pdmR3DevHlp_IOAPICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
+            LogFlow(("pdmR3DevHlp_APICRegister: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc));
             return rc;
         }
         pVM->pdm.s.Apic.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
@@ -2863,6 +2892,7 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
         pVM->pdm.s.Apic.pfnReadMSRR0        = 0;
         pVM->pdm.s.Apic.pfnBusDeliverR0     = 0;
         pVM->pdm.s.Apic.pfnLocalInterruptR0 = 0;
+        pVM->pdm.s.Apic.pfnGetTimerFreqR0   = 0;
         pVM->pdm.s.Apic.pDevInsR0           = 0;
     }
 
@@ -2880,6 +2910,7 @@ static DECLCALLBACK(int) pdmR3DevHlp_APICRegister(PPDMDEVINS pDevIns, PPDMAPICRE
     pVM->pdm.s.Apic.pfnReadMSRR3        = pApicReg->pfnReadMSRR3;
     pVM->pdm.s.Apic.pfnBusDeliverR3     = pApicReg->pfnBusDeliverR3;
     pVM->pdm.s.Apic.pfnLocalInterruptR3 = pApicReg->pfnLocalInterruptR3;
+    pVM->pdm.s.Apic.pfnGetTimerFreqR3   = pApicReg->pfnGetTimerFreqR3;
     Log(("PDM: Registered APIC device '%s'/%d pDevIns=%p\n", pDevIns->pReg->szName, pDevIns->iInstance, pDevIns));
 
     /* set the helper pointer and return. */
@@ -3422,7 +3453,7 @@ static DECLCALLBACK(void) pdmR3DevHlp_GetCpuId(PPDMDEVINS pDevIns, uint32_t iLea
              pDevIns->pReg->szName, pDevIns->iInstance, iLeaf, pEax, pEbx, pEcx, pEdx));
     AssertPtr(pEax); AssertPtr(pEbx); AssertPtr(pEcx); AssertPtr(pEdx);
 
-    CPUMGetGuestCpuId(VMMGetCpu(pDevIns->Internal.s.pVMR3), iLeaf, pEax, pEbx, pEcx, pEdx);
+    CPUMGetGuestCpuId(VMMGetCpu(pDevIns->Internal.s.pVMR3), iLeaf, 0 /*iSubLeaf*/, pEax, pEbx, pEcx, pEdx);
 
     LogFlow(("pdmR3DevHlp_GetCpuId: caller='%s'/%d: returns void - *pEax=%#x *pEbx=%#x *pEcx=%#x *pEdx=%#x\n",
              pDevIns->pReg->szName, pDevIns->iInstance, *pEax, *pEbx, *pEcx, *pEdx));
@@ -3531,6 +3562,7 @@ const PDMDEVHLPR3 g_pdmR3DevHlpTrusted =
     pdmR3DevHlp_GetUVM,
     pdmR3DevHlp_GetVM,
     pdmR3DevHlp_GetVMCPU,
+    pdmR3DevHlp_GetCurrentCpuId,
     pdmR3DevHlp_RegisterVMMDevHeap,
     pdmR3DevHlp_UnregisterVMMDevHeap,
     pdmR3DevHlp_VMReset,
@@ -3577,6 +3609,15 @@ static DECLCALLBACK(PVMCPU) pdmR3DevHlp_Untrusted_GetVMCPU(PPDMDEVINS pDevIns)
 }
 
 
+/** @interface_method_impl{PDMDEVHLPR3,pfnGetCurrentCpuId} */
+static DECLCALLBACK(VMCPUID) pdmR3DevHlp_Untrusted_GetCurrentCpuId(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    AssertReleaseMsgFailed(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pReg->szName, pDevIns->iInstance));
+    return NIL_VMCPUID;
+}
+
+
 /** @interface_method_impl{PDMDEVHLPR3,pfnRegisterVMMDevHeap} */
 static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_RegisterVMMDevHeap(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RTR3PTR pvHeap, unsigned cbSize)
 {
@@ -3772,6 +3813,7 @@ const PDMDEVHLPR3 g_pdmR3DevHlpUnTrusted =
     pdmR3DevHlp_Untrusted_GetUVM,
     pdmR3DevHlp_Untrusted_GetVM,
     pdmR3DevHlp_Untrusted_GetVMCPU,
+    pdmR3DevHlp_Untrusted_GetCurrentCpuId,
     pdmR3DevHlp_Untrusted_RegisterVMMDevHeap,
     pdmR3DevHlp_Untrusted_UnregisterVMMDevHeap,
     pdmR3DevHlp_Untrusted_VMReset,
diff --git a/src/VBox/VMM/VMMR3/PDMDevice.cpp b/src/VBox/VMM/VMMR3/PDMDevice.cpp
index 789c330..918c0f8 100644
--- a/src/VBox/VMM/VMMR3/PDMDevice.cpp
+++ b/src/VBox/VMM/VMMR3/PDMDevice.cpp
@@ -171,7 +171,7 @@ int pdmR3DevInit(PVM pVM)
         Log(("PDM: No devices were configured!\n"));
         return VINF_SUCCESS;
     }
-    Log2(("PDM: cDevs=%d!\n", cDevs));
+    Log2(("PDM: cDevs=%u\n", cDevs));
 
     /*
      * Collect info on each device instance.
diff --git a/src/VBox/VMM/VMMR3/PDMDriver.cpp b/src/VBox/VMM/VMMR3/PDMDriver.cpp
index b9c40d3..b8e53b8 100644
--- a/src/VBox/VMM/VMMR3/PDMDriver.cpp
+++ b/src/VBox/VMM/VMMR3/PDMDriver.cpp
@@ -825,7 +825,8 @@ int pdmR3DrvDetach(PPDMDRVINS pDrvIns, uint32_t fFlags)
     if (pDrvIns->Internal.s.fDetaching)
     {
         AssertMsgFailed(("Recursive detach! '%s'/%d\n", pDrvIns->pReg->szName, pDrvIns->iInstance));
-        return VINF_SUCCESS;           }
+        return VINF_SUCCESS;
+    }
 
     /*
      * Check that we actually can detach this instance.
@@ -919,8 +920,7 @@ void pdmR3DrvDestroyChain(PPDMDRVINS pDrvIns, uint32_t fFlags)
                     if (pLun->pUsbIns->pReg->pfnDriverDetach)
                     {
                         /** @todo USB device locking? */
-                        /** @todo add flags to pfnDriverDetach. */
-                        pLun->pUsbIns->pReg->pfnDriverDetach(pLun->pUsbIns, pLun->iLun);
+                        pLun->pUsbIns->pReg->pfnDriverDetach(pLun->pUsbIns, pLun->iLun, fFlags);
                     }
                 }
             }
diff --git a/src/VBox/VMM/VMMR3/PDMLdr.cpp b/src/VBox/VMM/VMMR3/PDMLdr.cpp
index 3ff9397..72c45f0 100644
--- a/src/VBox/VMM/VMMR3/PDMLdr.cpp
+++ b/src/VBox/VMM/VMMR3/PDMLdr.cpp
@@ -101,7 +101,11 @@ int pdmR3LdrInitU(PUVM pUVM)
      */
     PVM pVM = pUVM->pVM; AssertPtr(pVM);
     if (!HMIsEnabled(pVM))
-        return PDMR3LdrLoadRC(pVM, NULL, VMMGC_MAIN_MODULE_NAME);
+    {
+        int rc = PDMR3LdrLoadRC(pVM, NULL, VMMGC_MAIN_MODULE_NAME);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
 #endif
     return VINF_SUCCESS;
 }
@@ -245,7 +249,7 @@ int pdmR3LoadR3U(PUVM pUVM, const char *pszFilename, const char *pszName)
     /*
      * Validate input.
      */
-    AssertMsg(PDMCritSectIsInitialized(&pUVM->pVM->pdm.s.CritSect), ("bad init order!\n"));
+    AssertMsg(RTCritSectIsInitialized(&pUVM->pdm.s.ListCritSect), ("bad init order!\n"));
     Assert(pszFilename);
     size_t cchFilename = strlen(pszFilename);
     Assert(pszName);
@@ -281,7 +285,7 @@ int pdmR3LoadR3U(PUVM pUVM, const char *pszFilename, const char *pszName)
      * Allocate the module list node and initialize it.
      */
     const char *pszSuff = RTLdrGetSuff();
-    size_t      cchSuff = RTPathHaveExt(pszFilename) ? 0 : strlen(pszSuff);
+    size_t      cchSuff = RTPathHasSuffix(pszFilename) ? 0 : strlen(pszSuff);
     PPDMMOD     pModule = (PPDMMOD)RTMemAllocZ(RT_OFFSETOF(PDMMOD, szFilename[cchFilename + cchSuff + 1]));
     if (pModule)
     {
@@ -438,6 +442,11 @@ static DECLCALLBACK(int) pdmR3GetImportRC(RTLDRMOD hLdrMod, const char *pszModul
  * region).
  *
  * @returns VBox status code.
+ * @retval  VINF_PDM_ALREADY_LOADED if the module is already loaded (name +
+ *          filename match).
+ * @retval  VERR_PDM_MODULE_NAME_CLASH if a different file has already been
+ *          loaded with the name module name.
+ *
  * @param   pVM             The VM to load it into.
  * @param   pszFilename     Filename of the module binary.
  * @param   pszName         Module name. Case sensitive and the length is limited!
@@ -447,35 +456,47 @@ VMMR3DECL(int) PDMR3LdrLoadRC(PVM pVM, const char *pszFilename, const char *pszN
     /*
      * Validate input.
      */
-    AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));
+    AssertMsg(MMR3IsInitialized(pVM), ("bad init order!\n"));
     AssertReturn(!HMIsEnabled(pVM), VERR_PDM_HM_IPE);
 
-    PUVM     pUVM = pVM->pUVM;
+    /*
+     * Find the file if not specified.
+     */
+    char *pszFile = NULL;
+    if (!pszFilename)
+        pszFilename = pszFile = pdmR3FileRC(pszName, NULL);
+
+    /*
+     * Check if a module by that name is already loaded.
+     */
+    int     rc;
+    PUVM    pUVM = pVM->pUVM;
     RTCritSectEnter(&pUVM->pdm.s.ListCritSect);
-    PPDMMOD  pCur = pUVM->pdm.s.pModules;
+    PPDMMOD pCur = pUVM->pdm.s.pModules;
     while (pCur)
     {
         if (!strcmp(pCur->szName, pszName))
         {
+            /* Name clash. Hopefully due to it being the same file. */
+            if (!strcmp(pCur->szFilename, pszFilename))
+                rc = VINF_PDM_ALREADY_LOADED;
+            else
+            {
+                rc = VERR_PDM_MODULE_NAME_CLASH;
+                AssertMsgFailed(("We've already got a module '%s' loaded!\n", pszName));
+            }
             RTCritSectLeave(&pUVM->pdm.s.ListCritSect);
-            AssertMsgFailed(("We've already got a module '%s' loaded!\n", pszName));
-            return VERR_PDM_MODULE_NAME_CLASH;
+            RTMemTmpFree(pszFile);
+            return rc;
         }
         /* next */
         pCur = pCur->pNext;
     }
 
     /*
-     * Find the file if not specified.
-     */
-    char *pszFile = NULL;
-    if (!pszFilename)
-        pszFilename = pszFile = pdmR3FileRC(pszName, NULL);
-
-    /*
      * Allocate the module list node.
      */
-    PPDMMOD     pModule = (PPDMMOD)RTMemAllocZ(sizeof(*pModule) + strlen(pszFilename));
+    PPDMMOD pModule = (PPDMMOD)RTMemAllocZ(sizeof(*pModule) + strlen(pszFilename));
     if (!pModule)
     {
         RTCritSectLeave(&pUVM->pdm.s.ListCritSect);
@@ -494,7 +515,7 @@ VMMR3DECL(int) PDMR3LdrLoadRC(PVM pVM, const char *pszFilename, const char *pszN
      */
     RTERRINFOSTATIC ErrInfo;
     RTErrInfoInitStatic(&ErrInfo);
-    int rc = SUPR3HardenedVerifyPlugIn(pszFilename, &ErrInfo.Core);
+    rc = SUPR3HardenedVerifyPlugIn(pszFilename, &ErrInfo.Core);
     if (RT_SUCCESS(rc))
     {
         RTErrInfoClear(&ErrInfo.Core);
@@ -726,12 +747,12 @@ VMMR3_INT_DECL(int) PDMR3LdrGetSymbolR3(PVM pVM, const char *pszModule, const ch
     AssertPtr(pVM);
     AssertPtr(pszModule);
     AssertPtr(ppvValue);
-    AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));
+    PUVM pUVM = pVM->pUVM;
+    AssertMsg(RTCritSectIsInitialized(&pUVM->pdm.s.ListCritSect), ("bad init order!\n"));
 
     /*
      * Find the module.
      */
-    PUVM pUVM = pVM->pUVM;
     RTCritSectEnter(&pUVM->pdm.s.ListCritSect);
     for (PPDMMOD pModule = pUVM->pdm.s.pModules; pModule; pModule = pModule->pNext)
     {
@@ -785,7 +806,8 @@ VMMR3DECL(int) PDMR3LdrGetSymbolR0(PVM pVM, const char *pszModule, const char *p
     AssertPtr(pVM);
     AssertPtrNull(pszModule);
     AssertPtr(ppvValue);
-    AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));
+    PUVM pUVM = pVM->pUVM;
+    AssertMsg(RTCritSectIsInitialized(&pUVM->pdm.s.ListCritSect), ("bad init order!\n"));
 
     if (!pszModule)
         pszModule = "VMMR0.r0";
@@ -793,7 +815,6 @@ VMMR3DECL(int) PDMR3LdrGetSymbolR0(PVM pVM, const char *pszModule, const char *p
     /*
      * Find the module.
      */
-    PUVM pUVM = pVM->pUVM;
     RTCritSectEnter(&pUVM->pdm.s.ListCritSect);
     for (PPDMMOD pModule = pUVM->pdm.s.pModules; pModule; pModule = pModule->pNext)
     {
@@ -841,7 +862,8 @@ VMMR3DECL(int) PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, const cha
     AssertPtr(pVM);
     AssertPtrNull(pszModule);
     AssertPtr(ppvValue);
-    AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));
+    PUVM pUVM = pVM->pUVM;
+    AssertMsg(RTCritSectIsInitialized(&pUVM->pdm.s.ListCritSect), ("bad init order!\n"));
 
     /*
      * Since we're lazy, we'll only check if the module is present
@@ -850,7 +872,6 @@ VMMR3DECL(int) PDMR3LdrGetSymbolR0Lazy(PVM pVM, const char *pszModule, const cha
     if (pszModule)
     {
         AssertMsgReturn(!strpbrk(pszModule, "/\\:\n\r\t"), ("pszModule=%s\n", pszModule), VERR_INVALID_PARAMETER);
-        PUVM    pUVM = pVM->pUVM;
         PPDMMOD pModule;
         RTCritSectEnter(&pUVM->pdm.s.ListCritSect);
         for (pModule = pUVM->pdm.s.pModules; pModule; pModule = pModule->pNext)
@@ -893,7 +914,7 @@ VMMR3DECL(int) PDMR3LdrGetSymbolRC(PVM pVM, const char *pszModule, const char *p
     AssertPtr(pVM);
     AssertPtrNull(pszModule);
     AssertPtr(pRCPtrValue);
-    AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));
+    AssertMsg(MMR3IsInitialized(pVM), ("bad init order!\n"));
 
     if (!pszModule)
         pszModule = "VMMGC.gc";
@@ -958,7 +979,7 @@ VMMR3DECL(int) PDMR3LdrGetSymbolRCLazy(PVM pVM, const char *pszModule, const cha
     AssertPtr(pVM);
     AssertPtrNull(pszModule);
     AssertPtr(pRCPtrValue);
-    AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));
+    AssertMsg(MMR3IsInitialized(pVM), ("bad init order!\n"));
 
     /*
      * Since we're lazy, we'll only check if the module is present
diff --git a/src/VBox/VMM/VMMR3/PDMUsb.cpp b/src/VBox/VMM/VMMR3/PDMUsb.cpp
index 0e39f05..496a8a7 100644
--- a/src/VBox/VMM/VMMR3/PDMUsb.cpp
+++ b/src/VBox/VMM/VMMR3/PDMUsb.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -120,7 +120,7 @@ int pdmR3UsbRegisterHub(PVM pVM, PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_
         LogRel(("pdmR3UsbRegisterHub: fClass=%#x expected %#x to be set\n", pDrvIns->pReg->fClass, PDM_DRVREG_CLASS_USB));
         return VERR_INVALID_PARAMETER;
     }
-    AssertMsgReturn(!(fVersions & ~(VUSB_STDVER_11 | VUSB_STDVER_20)), ("%#x\n", fVersions), VERR_INVALID_PARAMETER);
+    AssertMsgReturn(!(fVersions & ~(VUSB_STDVER_11 | VUSB_STDVER_20 | VUSB_STDVER_30)), ("%#x\n", fVersions), VERR_INVALID_PARAMETER);
     AssertPtrReturn(ppUsbHubHlp, VERR_INVALID_POINTER);
     AssertPtrReturn(pUsbHubReg, VERR_INVALID_POINTER);
     AssertReturn(pUsbHubReg->u32Version == PDM_USBHUBREG_VERSION, VERR_INVALID_MAGIC);
@@ -226,7 +226,7 @@ static DECLCALLBACK(int) pdmR3UsbReg_Register(PCPDMUSBREGCB pCallbacks, PCPDMUSB
                     &&  pdmR3IsValidName(pReg->szName),
                     ("Invalid name '%.s'\n", sizeof(pReg->szName), pReg->szName),
                     VERR_PDM_INVALID_USB_REGISTRATION);
-    AssertMsgReturn((pReg->fFlags & ~(PDM_USBREG_HIGHSPEED_CAPABLE)) == 0,
+    AssertMsgReturn((pReg->fFlags & ~(PDM_USBREG_HIGHSPEED_CAPABLE | PDM_USBREG_SUPERSPEED_CAPABLE | PDM_USBREG_EMULATED_DEVICE)) == 0,
                     ("fFlags=%#x\n", pReg->fFlags), VERR_PDM_INVALID_USB_REGISTRATION);
     AssertMsgReturn(pReg->cMaxInstances > 0,
                     ("Max instances %u! (USB Device %s)\n", pReg->cMaxInstances, pReg->szName),
@@ -439,13 +439,17 @@ static int pdmR3UsbFindHub(PVM pVM, uint32_t iUsbVersion, PPDMUSBHUB *ppHub)
         return VERR_PDM_NO_USB_HUBS;
 
     for (PPDMUSBHUB pCur = pVM->pdm.s.pUsbHubs; pCur; pCur = pCur->pNext)
-        if (    pCur->cAvailablePorts > 0
-            &&  (   (pCur->fVersions & iUsbVersion)
-                 || pCur->fVersions == VUSB_STDVER_11))
+        if (pCur->cAvailablePorts > 0)
         {
-            *ppHub = pCur;
+            /* First check for an exact match. */
             if (pCur->fVersions & iUsbVersion)
+            {
+                *ppHub = pCur;
                 break;
+            }
+            /* For high-speed USB 2.0 devices only, allow USB 1.1 fallback. */
+            if ((iUsbVersion & VUSB_STDVER_20) && (pCur->fVersions == VUSB_STDVER_11))
+                *ppHub = pCur;
         }
     if (*ppHub)
         return VINF_SUCCESS;
@@ -454,23 +458,49 @@ static int pdmR3UsbFindHub(PVM pVM, uint32_t iUsbVersion, PPDMUSBHUB *ppHub)
 
 
 /**
+ * Translates a USB vesion (a bit-mask) to USB speed (enum). Picks
+ * the highest available version.
+ *
+ * @returns VUSBSPEED enum
+ *
+ * @param   iUsbVersion     The USB version.
+ *
+ */
+static VUSBSPEED pdmR3UsbVer2Spd(uint32_t iUsbVersion)
+{
+    VUSBSPEED   enmSpd = VUSB_SPEED_UNKNOWN;
+    Assert(iUsbVersion);
+
+    if (iUsbVersion & VUSB_STDVER_30)
+        enmSpd = VUSB_SPEED_SUPER;
+    else if (iUsbVersion & VUSB_STDVER_20)
+        enmSpd = VUSB_SPEED_HIGH;
+    else if (iUsbVersion & VUSB_STDVER_11)
+        enmSpd = VUSB_SPEED_FULL;    /* Can't distinguish LS vs. FS. */
+
+    return enmSpd;
+}
+
+
+/**
  * Creates the device.
  *
  * @returns VBox status code.
- * @param   pVM             Pointer to the VM.
- * @param   pUsbDev         The USB device emulation.
- * @param   iInstance       -1 if not called by pdmR3UsbInstantiateDevices().
- * @param   pUuid           The UUID for this device.
- * @param   ppInstanceNode  Pointer to the device instance pointer. This is set to NULL if inserted
- *                          into the tree or cleaned up.
+ * @param   pVM                 Pointer to the VM.
+ * @param   pUsbDev             The USB device emulation.
+ * @param   iInstance           -1 if not called by pdmR3UsbInstantiateDevices().
+ * @param   pUuid               The UUID for this device.
+ * @param   ppInstanceNode      Pointer to the device instance pointer. This is set to NULL if inserted
+ *                              into the tree or cleaned up.
  *
- *                          In the pdmR3UsbInstantiateDevices() case (iInstance != -1) this is
- *                          the actual instance node and will not be cleaned up.
+ *                              In the pdmR3UsbInstantiateDevices() case (iInstance != -1) this is
+ *                              the actual instance node and will not be cleaned up.
  *
- * @parma   iUsbVersion     The USB version preferred by the device.
+ * @param   enmSpeed            The speed the USB device is operating at.
+ * @param   pszCaptureFilename  Path to the file for USB traffic capturing, optional.
  */
 static int pdmR3UsbCreateDevice(PVM pVM, PPDMUSBHUB pHub, PPDMUSB pUsbDev, int iInstance, PCRTUUID pUuid,
-                                PCFGMNODE *ppInstanceNode, uint32_t iUsbVersion)
+                                PCFGMNODE *ppInstanceNode, VUSBSPEED enmSpeed, const char *pszCaptureFilename)
 {
     const bool fAtRuntime = iInstance == -1;
     int rc;
@@ -584,7 +614,7 @@ static int pdmR3UsbCreateDevice(PVM pVM, PPDMUSBHUB pHub, PPDMUSB pUsbDev, int i
     pUsbIns->pszName                        = RTStrDup(pUsbDev->pReg->szName);
     //pUsbIns->fTracing                       = 0;
     pUsbIns->idTracing                      = ++pVM->pdm.s.idTracingOther;
-    pUsbIns->iUsbHubVersion                 = iUsbVersion;
+    pUsbIns->enmSpeed                       = enmSpeed;
 
     /*
      * Link it into all the lists.
@@ -628,7 +658,7 @@ static int pdmR3UsbCreateDevice(PVM pVM, PPDMUSBHUB pHub, PPDMUSB pUsbDev, int i
          * Attach it to the hub.
          */
         Log(("PDM: Attaching it...\n"));
-        rc = pHub->Reg.pfnAttachDevice(pHub->pDrvIns, pUsbIns, &pUsbIns->Internal.s.iPort);
+        rc = pHub->Reg.pfnAttachDevice(pHub->pDrvIns, pUsbIns, pszCaptureFilename, &pUsbIns->Internal.s.iPort);
         if (RT_SUCCESS(rc))
         {
             pHub->cAvailablePorts--;
@@ -715,6 +745,8 @@ int pdmR3UsbInstantiateDevices(PVM pVM)
         uint32_t    u32Order;
         /** VBox instance number. */
         uint32_t    iInstance;
+        /** Device UUID. */
+        RTUUID      Uuid;
     } *paUsbDevs = (struct USBDEVORDER *)alloca(sizeof(paUsbDevs[0]) * (cUsbDevs + 1)); /* (One extra for swapping) */
     Assert(paUsbDevs);
     int rc;
@@ -753,6 +785,23 @@ int pdmR3UsbInstantiateDevices(PVM pVM)
             if (pInstanceNode == pGlobal)
                 continue;
 
+            /* Use the configured UUID if present, create our own otherwise. */
+            char *pszUuid = NULL;
+
+            RTUuidClear(&paUsbDevs[i].Uuid);
+            rc = CFGMR3QueryStringAlloc(pInstanceNode, "UUID", &pszUuid);
+            if (RT_SUCCESS(rc))
+            {
+                AssertPtr(pszUuid);
+
+                rc = RTUuidFromStr(&paUsbDevs[i].Uuid, pszUuid);
+                AssertMsgRCReturn(rc, ("Failed to convert UUID from string! rc=%Rrc\n", rc), rc);
+                MMR3HeapFree(pszUuid);
+            }
+            else if (rc == VERR_CFGM_VALUE_NOT_FOUND)
+                rc = RTUuidCreate(&paUsbDevs[i].Uuid);
+
+            AssertRCReturn(rc, rc);
             paUsbDevs[i].pNode = pInstanceNode;
             paUsbDevs[i].pUsbDev = pUsbDev;
             paUsbDevs[i].u32Order = u32Order;
@@ -807,13 +856,15 @@ int pdmR3UsbInstantiateDevices(PVM pVM)
         CFGMR3SetRestrictedRoot(pConfigNode);
 
         /*
-         * Every device must support USB 1.x hubs; optionally, high-speed USB 2.0 hubs
+         * Every emulated device must support USB 1.x hubs; optionally, high-speed USB 2.0 hubs
          * might be also supported. This determines where to attach the device.
          */
         uint32_t iUsbVersion = VUSB_STDVER_11;
 
         if (paUsbDevs[i].pUsbDev->pReg->fFlags & PDM_USBREG_HIGHSPEED_CAPABLE)
             iUsbVersion |= VUSB_STDVER_20;
+        if (paUsbDevs[i].pUsbDev->pReg->fFlags & PDM_USBREG_SUPERSPEED_CAPABLE)
+            iUsbVersion |= VUSB_STDVER_30;
 
         /*
          * Find a suitable hub with free ports.
@@ -835,10 +886,8 @@ int pdmR3UsbInstantiateDevices(PVM pVM)
         /*
          * Create and attach the device.
          */
-        RTUUID Uuid;
-        rc = RTUuidCreate(&Uuid);
-        AssertRCReturn(rc, rc);
-        rc = pdmR3UsbCreateDevice(pVM, pHub, paUsbDevs[i].pUsbDev, paUsbDevs[i].iInstance, &Uuid, &paUsbDevs[i].pNode, iUsbVersion);
+        rc = pdmR3UsbCreateDevice(pVM, pHub, paUsbDevs[i].pUsbDev, paUsbDevs[i].iInstance, &paUsbDevs[i].Uuid,
+                                  &paUsbDevs[i].pNode, pdmR3UsbVer2Spd(iUsbVersion), NULL);
         if (RT_FAILURE(rc))
             return rc;
     } /* for device instances */
@@ -854,14 +903,16 @@ int pdmR3UsbInstantiateDevices(PVM pVM)
  * and try instantiate the emulated device.
  *
  * @returns VBox status code.
- * @param   pUVM            The user mode VM handle.
- * @param   pszDeviceName   The name of the PDM device to instantiate.
- * @param   pInstanceNode   The instance CFGM node.
- * @param   pUuid           The UUID to be associated with the device.
+ * @param   pUVM                The user mode VM handle.
+ * @param   pszDeviceName       The name of the PDM device to instantiate.
+ * @param   pInstanceNode       The instance CFGM node.
+ * @param   pUuid               The UUID to be associated with the device.
+ * @param   pszCaptureFilename  Path to the file for USB traffic capturing, optional.
  *
  * @thread EMT
  */
-VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pInstanceNode, PCRTUUID pUuid)
+VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName, PCFGMNODE pInstanceNode, PCRTUUID pUuid,
+                                            const char *pszCaptureFilename)
 {
     /*
      * Validate input.
@@ -890,6 +941,8 @@ VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName
     uint32_t iUsbVersion = VUSB_STDVER_11;
     if (pUsbDev->pReg->fFlags & PDM_USBREG_HIGHSPEED_CAPABLE)
         iUsbVersion |= VUSB_STDVER_20;
+    if (pUsbDev->pReg->fFlags & PDM_USBREG_SUPERSPEED_CAPABLE)
+        iUsbVersion |= VUSB_STDVER_30;
 
     /*
      * Find a suitable hub with free ports.
@@ -911,7 +964,8 @@ VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName
     /*
      * Create and attach the device.
      */
-    rc = pdmR3UsbCreateDevice(pVM, pHub, pUsbDev, -1, pUuid, &pInstanceNode, iUsbVersion);
+    rc = pdmR3UsbCreateDevice(pVM, pHub, pUsbDev, -1, pUuid, &pInstanceNode,
+                              pdmR3UsbVer2Spd(iUsbVersion), pszCaptureFilename);
     AssertRCReturn(rc, rc);
 
     return rc;
@@ -925,16 +979,17 @@ VMMR3DECL(int) PDMR3UsbCreateEmulatedDevice(PUVM pUVM, const char *pszDeviceName
  * and try instantiate the proxy device.
  *
  * @returns VBox status code.
- * @param   pUVM            The user mode VM handle.
- * @param   pUuid           The UUID to be associated with the device.
- * @param   fRemote         Whether it's a remove or local device.
- * @param   pszAddress      The address string.
- * @param   pvBackend       Pointer to the backend.
- * @param   iUsbVersion     The preferred USB version.
- * @param   fMaskedIfs      The interfaces to hide from the guest.
+ * @param   pUVM                The user mode VM handle.
+ * @param   pUuid               The UUID to be associated with the device.
+ * @param   fRemote             Whether it's a remove or local device.
+ * @param   pszAddress          The address string.
+ * @param   pvBackend           Pointer to the backend.
+ * @param   iUsbVersion         The preferred USB version.
+ * @param   fMaskedIfs          The interfaces to hide from the guest.
+ * @param   pszCaptureFilename  Path to the file for USB traffic capturing, optional.
  */
 VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend,
-                                         uint32_t iUsbVersion, uint32_t fMaskedIfs)
+                                         uint32_t iUsbVersion, uint32_t fMaskedIfs, const char *pszCaptureFilename)
 {
     /*
      * Validate input.
@@ -945,7 +1000,8 @@ VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, bool fRemote
     VM_ASSERT_EMT_RETURN(pVM, VERR_VM_THREAD_NOT_EMT);
     AssertPtrReturn(pUuid, VERR_INVALID_POINTER);
     AssertPtrReturn(pszAddress, VERR_INVALID_POINTER);
-    AssertReturn(    iUsbVersion == VUSB_STDVER_20
+    AssertReturn(    iUsbVersion == VUSB_STDVER_30
+                 ||  iUsbVersion == VUSB_STDVER_20
                  ||  iUsbVersion == VUSB_STDVER_11, VERR_INVALID_PARAMETER);
 
     /*
@@ -995,10 +1051,12 @@ VMMR3DECL(int) PDMR3UsbCreateProxyDevice(PUVM pUVM, PCRTUUID pUuid, bool fRemote
         return rc;
     }
 
+    VUSBSPEED enmSpeed = pdmR3UsbVer2Spd(iUsbVersion);
+
     /*
      * Finally, try to create it.
      */
-    rc = pdmR3UsbCreateDevice(pVM, pHub, pUsbDev, -1, pUuid, &pInstance, iUsbVersion);
+    rc = pdmR3UsbCreateDevice(pVM, pHub, pUsbDev, -1, pUuid, &pInstance, enmSpeed, pszCaptureFilename);
     if (RT_FAILURE(rc) && pInstance)
         CFGMR3RemoveNode(pInstance);
     return rc;
@@ -1044,7 +1102,7 @@ static void pdmR3UsbDestroyDevice(PVM pVM, PPDMUSBINS pUsbIns)
         pUsbIns->pReg->pfnDestruct(pUsbIns);
     }
     TMR3TimerDestroyUsb(pVM, pUsbIns);
-    //SSMR3DeregisterUsb(pVM, pUsbIns, NULL, 0);
+    SSMR3DeregisterUsb(pVM, pUsbIns, NULL, 0);
     pdmR3ThreadDestroyUsb(pVM, pUsbIns);
 #ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
     pdmR3AsyncCompletionTemplateDestroyUsb(pVM, pUsbIns);
@@ -1173,6 +1231,253 @@ VMMR3DECL(bool) PDMR3UsbHasHub(PUVM pUVM)
 }
 
 
+/**
+ * Locates a LUN.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the VM.
+ * @param   pszDevice       Device name.
+ * @param   iInstance       Device instance.
+ * @param   iLun            The Logical Unit to obtain the interface of.
+ * @param   ppLun           Where to store the pointer to the LUN if found.
+ * @thread  Try only do this in EMT...
+ */
+static int pdmR3UsbFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPPDMLUN ppLun)
+{
+    /*
+     * Iterate registered devices looking for the device.
+     */
+    size_t cchDevice = strlen(pszDevice);
+    for (PPDMUSB pUsbDev = pVM->pdm.s.pUsbDevs; pUsbDev; pUsbDev = pUsbDev->pNext)
+    {
+        if (    pUsbDev->cchName == cchDevice
+            &&  !memcmp(pUsbDev->pReg->szName, pszDevice, cchDevice))
+        {
+            /*
+             * Iterate device instances.
+             */
+            for (PPDMUSBINS pUsbIns = pUsbDev->pInstances; pUsbIns; pUsbIns = pUsbIns->Internal.s.pPerDeviceNext)
+            {
+                if (pUsbIns->iInstance == iInstance)
+                {
+                    /*
+                     * Iterate luns.
+                     */
+                    for (PPDMLUN pLun = pUsbIns->Internal.s.pLuns; pLun; pLun = pLun->pNext)
+                    {
+                        if (pLun->iLun == iLun)
+                        {
+                            *ppLun = pLun;
+                            return VINF_SUCCESS;
+                        }
+                    }
+                    return VERR_PDM_LUN_NOT_FOUND;
+                }
+            }
+            return VERR_PDM_DEVICE_INSTANCE_NOT_FOUND;
+        }
+    }
+    return VERR_PDM_DEVICE_NOT_FOUND;
+}
+
+
+/**
+ * Attaches a preconfigured driver to an existing device or driver instance.
+ *
+ * This is used to change drivers and suchlike at runtime.  The driver or device
+ * at the end of the chain will be told to attach to whatever is configured
+ * below it.
+ *
+ * @returns VBox status code.
+ * @param   pUVM            The user mode VM handle.
+ * @param   pszDevice       Device name.
+ * @param   iInstance       Device instance.
+ * @param   iLun            The Logical Unit to obtain the interface of.
+ * @param   fFlags          Flags, combination of the PDM_TACH_FLAGS_* \#defines.
+ * @param   ppBase          Where to store the base interface pointer. Optional.
+ *
+ * @thread  EMT
+ */
+VMMR3DECL(int)  PDMR3UsbDriverAttach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun, uint32_t fFlags,
+                                     PPPDMIBASE ppBase)
+{
+    LogFlow(("PDMR3UsbDriverAttach: pszDevice=%p:{%s} iDevIns=%d iLun=%d fFlags=%#x ppBase=%p\n",
+             pszDevice, pszDevice, iDevIns, iLun, fFlags, ppBase));
+    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+    PVM pVM = pUVM->pVM;
+    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
+    VM_ASSERT_EMT(pVM);
+
+    if (ppBase)
+        *ppBase = NULL;
+
+    /*
+     * Find the LUN in question.
+     */
+    PPDMLUN pLun;
+    int rc = pdmR3UsbFindLun(pVM, pszDevice, iDevIns, iLun, &pLun);
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Anything attached to the LUN?
+         */
+        PPDMDRVINS pDrvIns = pLun->pTop;
+        if (!pDrvIns)
+        {
+            /* No, ask the device to attach to the new stuff. */
+            PPDMUSBINS pUsbIns = pLun->pUsbIns;
+            if (pUsbIns->pReg->pfnDriverAttach)
+            {
+                rc = pUsbIns->pReg->pfnDriverAttach(pUsbIns, iLun, fFlags);
+                if (RT_SUCCESS(rc) && ppBase)
+                    *ppBase = pLun->pTop ? &pLun->pTop->IBase : NULL;
+            }
+            else
+                rc = VERR_PDM_DEVICE_NO_RT_ATTACH;
+        }
+        else
+        {
+            /* Yes, find the bottom most driver and ask it to attach to the new stuff. */
+            while (pDrvIns->Internal.s.pDown)
+                pDrvIns = pDrvIns->Internal.s.pDown;
+            if (pDrvIns->pReg->pfnAttach)
+            {
+                rc = pDrvIns->pReg->pfnAttach(pDrvIns, fFlags);
+                if (RT_SUCCESS(rc) && ppBase)
+                    *ppBase = pDrvIns->Internal.s.pDown
+                            ? &pDrvIns->Internal.s.pDown->IBase
+                            : NULL;
+            }
+            else
+                rc = VERR_PDM_DRIVER_NO_RT_ATTACH;
+        }
+    }
+
+    if (ppBase)
+        LogFlow(("PDMR3UsbDriverAttach: returns %Rrc *ppBase=%p\n", rc, *ppBase));
+    else
+        LogFlow(("PDMR3UsbDriverAttach: returns %Rrc\n", rc));
+    return rc;
+}
+
+
+/**
+ * Detaches the specified driver instance.
+ *
+ * This is used to replumb drivers at runtime for simulating hot plugging and
+ * media changes.
+ *
+ * This method allows detaching drivers from
+ * any driver or device by specifying the driver to start detaching at.  The
+ * only prerequisite is that the driver or device above implements the
+ * pfnDetach callback (PDMDRVREG / PDMUSBREG).
+ *
+ * @returns VBox status code.
+ * @param   pUVM            The user mode VM handle.
+ * @param   pszDevice       Device name.
+ * @param   iDevIns         Device instance.
+ * @param   iLun            The Logical Unit in which to look for the driver.
+ * @param   pszDriver       The name of the driver which to detach.  If NULL
+ *                          then the entire driver chain is detatched.
+ * @param   iOccurance      The occurrence of that driver in the chain.  This is
+ *                          usually 0.
+ * @param   fFlags          Flags, combination of the PDM_TACH_FLAGS_* \#defines.
+ * @thread  EMT
+ */
+VMMR3DECL(int)  PDMR3UsbDriverDetach(PUVM pUVM, const char *pszDevice, unsigned iDevIns, unsigned iLun,
+                                     const char *pszDriver, unsigned iOccurance, uint32_t fFlags)
+{
+    LogFlow(("PDMR3UsbDriverDetach: pszDevice=%p:{%s} iDevIns=%u iLun=%u pszDriver=%p:{%s} iOccurance=%u fFlags=%#x\n",
+             pszDevice, pszDevice, iDevIns, iLun, pszDriver, iOccurance, fFlags));
+    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+    PVM pVM = pUVM->pVM;
+    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
+    VM_ASSERT_EMT(pVM);
+    AssertPtr(pszDevice);
+    AssertPtrNull(pszDriver);
+    Assert(iOccurance == 0 || pszDriver);
+    Assert(!(fFlags & ~(PDM_TACH_FLAGS_NOT_HOT_PLUG)));
+
+    /*
+     * Find the LUN in question.
+     */
+    PPDMLUN pLun;
+    int rc = pdmR3UsbFindLun(pVM, pszDevice, iDevIns, iLun, &pLun);
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Locate the driver.
+         */
+        PPDMDRVINS pDrvIns = pLun->pTop;
+        if (pDrvIns)
+        {
+            if (pszDriver)
+            {
+                while (pDrvIns)
+                {
+                    if (!strcmp(pDrvIns->pReg->szName, pszDriver))
+                    {
+                        if (iOccurance == 0)
+                            break;
+                        iOccurance--;
+                    }
+                    pDrvIns = pDrvIns->Internal.s.pDown;
+                }
+            }
+            if (pDrvIns)
+                rc = pdmR3DrvDetach(pDrvIns, fFlags);
+            else
+                rc = VERR_PDM_DRIVER_INSTANCE_NOT_FOUND;
+        }
+        else
+            rc = VINF_PDM_NO_DRIVER_ATTACHED_TO_LUN;
+    }
+
+    LogFlow(("PDMR3UsbDriverDetach: returns %Rrc\n", rc));
+    return rc;
+}
+
+
+/**
+ * Query the interface of the top level driver on a LUN.
+ *
+ * @returns VBox status code.
+ * @param   pUVM            The user mode VM handle.
+ * @param   pszDevice       Device name.
+ * @param   iInstance       Device instance.
+ * @param   iLun            The Logical Unit to obtain the interface of.
+ * @param   ppBase          Where to store the base interface pointer.
+ * @remark  We're not doing any locking ATM, so don't try call this at times when the
+ *          device chain is known to be updated.
+ */
+VMMR3DECL(int)  PDMR3UsbQueryLun(PUVM pUVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMIBASE *ppBase)
+{
+    LogFlow(("PDMR3UsbQueryLun: pszDevice=%p:{%s} iInstance=%u iLun=%u ppBase=%p\n",
+             pszDevice, pszDevice, iInstance, iLun, ppBase));
+    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
+    PVM pVM = pUVM->pVM;
+    VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
+
+    /*
+     * Find the LUN.
+     */
+    PPDMLUN pLun;
+    int rc = pdmR3UsbFindLun(pVM, pszDevice, iInstance, iLun, &pLun);
+    if (RT_SUCCESS(rc))
+    {
+        if (pLun->pTop)
+        {
+            *ppBase = &pLun->pTop->IBase;
+            LogFlow(("PDMR3UsbQueryLun: return %Rrc and *ppBase=%p\n", VINF_SUCCESS, *ppBase));
+            return VINF_SUCCESS;
+        }
+        rc = VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN;
+    }
+    LogFlow(("PDMR3UsbQueryLun: returns %Rrc\n", rc));
+    return rc;
+}
+
+
 /** @name USB Device Helpers
  * @{
  */
@@ -1390,13 +1695,11 @@ static DECLCALLBACK(int) pdmR3UsbHlp_SSMRegister(PPDMUSBINS pUsbIns, uint32_t uV
              pfnSavePrep, pfnSaveExec, pfnSaveDone,
              pfnLoadPrep, pfnLoadExec, pfnLoadDone));
 
-    /** @todo
     int rc = SSMR3RegisterUsb(pUsbIns->Internal.s.pVM, pUsbIns, pUsbIns->pReg->szName, pUsbIns->iInstance,
                               uVersion, cbGuess,
                               pfnLivePrep, pfnLiveExec, pfnLiveVote,
                               pfnSavePrep, pfnSaveExec, pfnSaveDone,
-                              pfnLoadPrep, pfnLoadExec, pfnLoadDone); */
-    int rc = VERR_NOT_IMPLEMENTED; AssertFailed();
+                              pfnLoadPrep, pfnLoadExec, pfnLoadDone);
 
     LogFlow(("pdmR3UsbHlp_SSMRegister: caller='%s'/%d: returns %Rrc\n", pUsbIns->pReg->szName, pUsbIns->iInstance, rc));
     return rc;
diff --git a/src/VBox/VMM/VMMR3/PGM.cpp b/src/VBox/VMM/VMMR3/PGM.cpp
index 4801c0f..c7de201 100644
--- a/src/VBox/VMM/VMMR3/PGM.cpp
+++ b/src/VBox/VMM/VMMR3/PGM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -163,7 +163,7 @@
  * @subsection      sec_pgm_handlers_virt   Virtual Access Handlers
  *
  * We currently implement three types of virtual access handlers:  ALL, WRITE
- * and HYPERVISOR (WRITE). See PGMVIRTHANDLERTYPE for some more details.
+ * and HYPERVISOR (WRITE). See PGMVIRTHANDLERKIND for some more details.
  *
  * The HYPERVISOR access handlers is kept in a separate tree since it doesn't apply
  * to physical pages (PGMTREES::HyperVirtHandlers) and only needs to be consulted in
@@ -648,6 +648,22 @@
 
 
 /*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * Argument package for pgmR3RElocatePhysHnadler, pgmR3RelocateVirtHandler and
+ * pgmR3RelocateHyperVirtHandler.
+ */
+typedef struct PGMRELOCHANDLERARGS
+{
+    RTGCINTPTR  offDelta;
+    PVM         pVM;
+} PGMRELOCHANDLERARGS;
+/** Pointer to a page access handlere relocation argument package. */
+typedef PGMRELOCHANDLERARGS const *PCPGMRELOCHANDLERARGS;
+
+
+/*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
 static int                pgmR3InitPaging(PVM pVM);
@@ -1401,44 +1417,62 @@ VMMR3DECL(int) PGMR3Init(PVM pVM)
     {
         pVM->pgm.s.pTreesR0 = MMHyperR3ToR0(pVM, pVM->pgm.s.pTreesR3);
         pVM->pgm.s.pTreesRC = MMHyperR3ToRC(pVM, pVM->pgm.s.pTreesR3);
+    }
 
-        /*
-         * Allocate the zero page.
-         */
+    /*
+     * Allocate the zero page.
+     */
+    if (RT_SUCCESS(rc))
+    {
         rc = MMHyperAlloc(pVM, PAGE_SIZE, PAGE_SIZE, MM_TAG_PGM, &pVM->pgm.s.pvZeroPgR3);
+        if (RT_SUCCESS(rc))
+        {
+            pVM->pgm.s.pvZeroPgRC = MMHyperR3ToRC(pVM, pVM->pgm.s.pvZeroPgR3);
+            pVM->pgm.s.pvZeroPgR0 = MMHyperR3ToR0(pVM, pVM->pgm.s.pvZeroPgR3);
+            pVM->pgm.s.HCPhysZeroPg = MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvZeroPgR3);
+            AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS);
+        }
     }
+
+    /*
+     * Allocate the invalid MMIO page.
+     * (The invalid bits in HCPhysInvMmioPg are set later on init complete.)
+     */
     if (RT_SUCCESS(rc))
     {
-        pVM->pgm.s.pvZeroPgRC = MMHyperR3ToRC(pVM, pVM->pgm.s.pvZeroPgR3);
-        pVM->pgm.s.pvZeroPgR0 = MMHyperR3ToR0(pVM, pVM->pgm.s.pvZeroPgR3);
-        pVM->pgm.s.HCPhysZeroPg = MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvZeroPgR3);
-        AssertRelease(pVM->pgm.s.HCPhysZeroPg != NIL_RTHCPHYS);
-
-        /*
-         * Allocate the invalid MMIO page.
-         * (The invalid bits in HCPhysInvMmioPg are set later on init complete.)
-         */
         rc = MMHyperAlloc(pVM, PAGE_SIZE, PAGE_SIZE, MM_TAG_PGM, &pVM->pgm.s.pvMmioPgR3);
+        if (RT_SUCCESS(rc))
+        {
+            ASMMemFill32(pVM->pgm.s.pvMmioPgR3, PAGE_SIZE, 0xfeedface);
+            pVM->pgm.s.HCPhysMmioPg = MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvMmioPgR3);
+            AssertRelease(pVM->pgm.s.HCPhysMmioPg != NIL_RTHCPHYS);
+            pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg;
+        }
     }
+
+    /*
+     * Register the physical access handler protecting ROMs.
+     */
     if (RT_SUCCESS(rc))
-    {
-        ASMMemFill32(pVM->pgm.s.pvMmioPgR3, PAGE_SIZE, 0xfeedface);
-        pVM->pgm.s.HCPhysMmioPg = MMR3HyperHCVirt2HCPhys(pVM, pVM->pgm.s.pvMmioPgR3);
-        AssertRelease(pVM->pgm.s.HCPhysMmioPg != NIL_RTHCPHYS);
-        pVM->pgm.s.HCPhysInvMmioPg = pVM->pgm.s.HCPhysMmioPg;
+        rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE,
+                                              pgmPhysRomWriteHandler,
+                                              NULL, "pgmPhysRomWritePfHandler",
+                                              NULL, "pgmPhysRomWritePfHandler",
+                                              "ROM write protection",
+                                              &pVM->pgm.s.hRomPhysHandlerType);
 
-        /*
-         * Init the paging.
-         */
+    /*
+     * Init the paging.
+     */
+    if (RT_SUCCESS(rc))
         rc = pgmR3InitPaging(pVM);
-    }
+
+    /*
+     * Init the page pool.
+     */
     if (RT_SUCCESS(rc))
-    {
-        /*
-         * Init the page pool.
-         */
         rc = pgmR3PoolInit(pVM);
-    }
+
     if (RT_SUCCESS(rc))
     {
         for (VMCPUID i = 0; i < pVM->cCpus; i++)
@@ -1617,7 +1651,7 @@ static int pgmR3InitPaging(PVM pVM)
             if (ARCH_BITS != 64)
             {
                 AssertMsgFailed(("Host mode %d (64-bit) is not supported by non-64bit builds\n", pVM->pgm.s.enmHostMode));
-                LogRel(("Host mode %d (64-bit) is not supported by non-64bit builds\n", pVM->pgm.s.enmHostMode));
+                LogRel(("PGM: Host mode %d (64-bit) is not supported by non-64bit builds\n", pVM->pgm.s.enmHostMode));
                 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE;
             }
 #endif
@@ -1631,9 +1665,9 @@ static int pgmR3InitPaging(PVM pVM)
     {
         LogFlow(("pgmR3InitPaging: returns successfully\n"));
 #if HC_ARCH_BITS == 64
-        LogRel(("Debug: HCPhysInterPD=%RHp HCPhysInterPaePDPT=%RHp HCPhysInterPaePML4=%RHp\n",
+        LogRel(("PGM: HCPhysInterPD=%RHp HCPhysInterPaePDPT=%RHp HCPhysInterPaePML4=%RHp\n",
                 pVM->pgm.s.HCPhysInterPD, pVM->pgm.s.HCPhysInterPaePDPT, pVM->pgm.s.HCPhysInterPaePML4));
-        LogRel(("Debug: apInterPTs={%RHp,%RHp} apInterPaePTs={%RHp,%RHp} apInterPaePDs={%RHp,%RHp,%RHp,%RHp} pInterPaePDPT64=%RHp\n",
+        LogRel(("PGM: apInterPTs={%RHp,%RHp} apInterPaePTs={%RHp,%RHp} apInterPaePDs={%RHp,%RHp,%RHp,%RHp} pInterPaePDPT64=%RHp\n",
                 MMPage2Phys(pVM, pVM->pgm.s.apInterPTs[0]),    MMPage2Phys(pVM, pVM->pgm.s.apInterPTs[1]),
                 MMPage2Phys(pVM, pVM->pgm.s.apInterPaePTs[0]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePTs[1]),
                 MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[0]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[1]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[2]), MMPage2Phys(pVM, pVM->pgm.s.apInterPaePDs[3]),
@@ -1658,7 +1692,7 @@ static int pgmR3InitPaging(PVM pVM)
             case SUPPAGINGMODE_AMD64_GLOBAL_NX:     pszHostMode = "AMD64+PGE+NX"; break;
             default:                                pszHostMode = "???"; break;
         }
-        LogRel(("Host paging mode: %s\n", pszHostMode));
+        LogRel(("PGM: Host paging mode: %s\n", pszHostMode));
 
         return VINF_SUCCESS;
     }
@@ -2213,7 +2247,7 @@ VMMR3DECL(int) PGMR3InitFinalize(PVM pVM)
      * Update: More recent intel manuals specifies 40 bits just like AMD.
      */
     uint32_t u32Dummy, u32Features;
-    CPUMGetGuestCpuId(VMMGetCpu(pVM), 1, &u32Dummy, &u32Dummy, &u32Dummy, &u32Features);
+    CPUMGetGuestCpuId(VMMGetCpu(pVM), 1, 0, &u32Dummy, &u32Dummy, &u32Dummy, &u32Features);
     if (u32Features & X86_CPUID_FEATURE_EDX_PSE36)
         pVM->pgm.s.GCPhys4MBPSEMask = RT_BIT_64(RT_MAX(36, cMaxPhysAddrWidth)) - 1;
     else
@@ -2225,7 +2259,7 @@ VMMR3DECL(int) PGMR3InitFinalize(PVM pVM)
     if (pVM->pgm.s.fRamPreAlloc)
         rc = pgmR3PhysRamPreAllocate(pVM);
 
-    LogRel(("PGMR3InitFinalize: 4 MB PSE mask %RGp\n", pVM->pgm.s.GCPhys4MBPSEMask));
+    LogRel(("PGM: PGMR3InitFinalize: 4 MB PSE mask %RGp\n", pVM->pgm.s.GCPhys4MBPSEMask));
     return rc;
 }
 
@@ -2388,10 +2422,26 @@ VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
     /*
      * Physical and virtual handlers.
      */
-    RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysHandlers,     true, pgmR3RelocatePhysHandler,      &offDelta);
+    PGMRELOCHANDLERARGS Args = { offDelta, pVM };
+    RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysHandlers,     true, pgmR3RelocatePhysHandler,      &Args);
     pVM->pgm.s.pLastPhysHandlerRC = NIL_RTRCPTR;
-    RTAvlroGCPtrDoWithAll(&pVM->pgm.s.pTreesR3->VirtHandlers,      true, pgmR3RelocateVirtHandler,      &offDelta);
-    RTAvlroGCPtrDoWithAll(&pVM->pgm.s.pTreesR3->HyperVirtHandlers, true, pgmR3RelocateHyperVirtHandler, &offDelta);
+
+    PPGMPHYSHANDLERTYPEINT pCurPhysType;
+    RTListOff32ForEach(&pVM->pgm.s.pTreesR3->HeadPhysHandlerTypes, pCurPhysType, PGMPHYSHANDLERTYPEINT, ListNode)
+    {
+        if (pCurPhysType->pfnPfHandlerRC != NIL_RTRCPTR)
+            pCurPhysType->pfnPfHandlerRC += offDelta;
+    }
+
+    RTAvlroGCPtrDoWithAll(&pVM->pgm.s.pTreesR3->VirtHandlers,      true, pgmR3RelocateVirtHandler,      &Args);
+    RTAvlroGCPtrDoWithAll(&pVM->pgm.s.pTreesR3->HyperVirtHandlers, true, pgmR3RelocateHyperVirtHandler, &Args);
+
+    PPGMVIRTHANDLERTYPEINT pCurVirtType;
+    RTListOff32ForEach(&pVM->pgm.s.pTreesR3->HeadVirtHandlerTypes, pCurVirtType, PGMVIRTHANDLERTYPEINT, ListNode)
+    {
+        if (pCurVirtType->pfnPfHandlerRC != NIL_RTRCPTR)
+            pCurVirtType->pfnPfHandlerRC += offDelta;
+    }
 
     /*
      * The page pool.
@@ -2414,17 +2464,14 @@ VMMR3DECL(void) PGMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
  *
  * @returns 0 (continue enum)
  * @param   pNode       Pointer to a PGMPHYSHANDLER node.
- * @param   pvUser      Pointer to the offDelta. This is a pointer to the delta since we're
- *                      not certain the delta will fit in a void pointer for all possible configs.
+ * @param   pvUser      Pointer to a PGMRELOCHANDLERARGS.
  */
 static DECLCALLBACK(int) pgmR3RelocatePhysHandler(PAVLROGCPHYSNODECORE pNode, void *pvUser)
 {
-    PPGMPHYSHANDLER pHandler = (PPGMPHYSHANDLER)pNode;
-    RTGCINTPTR      offDelta = *(PRTGCINTPTR)pvUser;
-    if (pHandler->pfnHandlerRC)
-        pHandler->pfnHandlerRC += offDelta;
+    PPGMPHYSHANDLER         pHandler = (PPGMPHYSHANDLER)pNode;
+    PCPGMRELOCHANDLERARGS   pArgs    = (PCPGMRELOCHANDLERARGS)pvUser;
     if (pHandler->pvUserRC >= 0x10000)
-        pHandler->pvUserRC += offDelta;
+        pHandler->pvUserRC += pArgs->offDelta;
     return 0;
 }
 
@@ -2434,17 +2481,17 @@ static DECLCALLBACK(int) pgmR3RelocatePhysHandler(PAVLROGCPHYSNODECORE pNode, vo
  *
  * @returns 0 (continue enum)
  * @param   pNode       Pointer to a PGMVIRTHANDLER node.
- * @param   pvUser      Pointer to the offDelta. This is a pointer to the delta since we're
- *                      not certain the delta will fit in a void pointer for all possible configs.
+ * @param   pvUser      Pointer to a PGMRELOCHANDLERARGS.
  */
 static DECLCALLBACK(int) pgmR3RelocateVirtHandler(PAVLROGCPTRNODECORE pNode, void *pvUser)
 {
-    PPGMVIRTHANDLER pHandler = (PPGMVIRTHANDLER)pNode;
-    RTGCINTPTR      offDelta = *(PRTGCINTPTR)pvUser;
-    Assert(     pHandler->enmType == PGMVIRTHANDLERTYPE_ALL
-           ||   pHandler->enmType == PGMVIRTHANDLERTYPE_WRITE);
-    Assert(pHandler->pfnHandlerRC);
-    pHandler->pfnHandlerRC += offDelta;
+    PPGMVIRTHANDLER         pHandler = (PPGMVIRTHANDLER)pNode;
+    PCPGMRELOCHANDLERARGS   pArgs    = (PCPGMRELOCHANDLERARGS)pvUser;
+    Assert(PGMVIRTANDLER_GET_TYPE(pArgs->pVM, pHandler)->enmKind != PGMVIRTHANDLERKIND_HYPERVISOR);
+
+    if (   pHandler->pvUserRC != NIL_RTRCPTR
+        && PGMVIRTANDLER_GET_TYPE(pArgs->pVM, pHandler)->fRelocUserRC)
+        pHandler->pvUserRC += pArgs->offDelta;
     return 0;
 }
 
@@ -2454,16 +2501,17 @@ static DECLCALLBACK(int) pgmR3RelocateVirtHandler(PAVLROGCPTRNODECORE pNode, voi
  *
  * @returns 0 (continue enum)
  * @param   pNode       Pointer to a PGMVIRTHANDLER node.
- * @param   pvUser      Pointer to the offDelta. This is a pointer to the delta since we're
- *                      not certain the delta will fit in a void pointer for all possible configs.
+ * @param   pvUser      Pointer to a PGMRELOCHANDLERARGS.
  */
 static DECLCALLBACK(int) pgmR3RelocateHyperVirtHandler(PAVLROGCPTRNODECORE pNode, void *pvUser)
 {
-    PPGMVIRTHANDLER pHandler = (PPGMVIRTHANDLER)pNode;
-    RTGCINTPTR      offDelta = *(PRTGCINTPTR)pvUser;
-    Assert(pHandler->enmType == PGMVIRTHANDLERTYPE_HYPERVISOR);
-    Assert(pHandler->pfnHandlerRC);
-    pHandler->pfnHandlerRC  += offDelta;
+    PPGMVIRTHANDLER         pHandler = (PPGMVIRTHANDLER)pNode;
+    PCPGMRELOCHANDLERARGS   pArgs    = (PCPGMRELOCHANDLERARGS)pvUser;
+    Assert(PGMVIRTANDLER_GET_TYPE(pArgs->pVM, pHandler)->enmKind == PGMVIRTHANDLERKIND_HYPERVISOR);
+
+    if (   pHandler->pvUserRC != NIL_RTRCPTR
+        && PGMVIRTANDLER_GET_TYPE(pArgs->pVM, pHandler)->fRelocUserRC)
+        pHandler->pvUserRC += pArgs->offDelta;
     return 0;
 }
 
@@ -3577,7 +3625,7 @@ VMMR3DECL(int) PGMR3ChangeMode(PVM pVM, PVMCPU pVCpu, PGMMODE enmGuestMode)
         {
             uint32_t u32Dummy, u32Features;
 
-            CPUMGetGuestCpuId(pVCpu, 1, &u32Dummy, &u32Dummy, &u32Dummy, &u32Features);
+            CPUMGetGuestCpuId(pVCpu, 1, 0, &u32Dummy, &u32Dummy, &u32Dummy, &u32Features);
             if (!(u32Features & X86_CPUID_FEATURE_EDX_PAE))
                 return VMSetRuntimeError(pVM, VMSETRTERR_FLAGS_FATAL, "PAEmode",
                                          N_("The guest is trying to switch to the PAE mode which is currently disabled by default in VirtualBox. PAE support can be enabled using the VM settings (System/Processor)"));
@@ -4005,9 +4053,12 @@ static DECLCALLBACK(int) pgmR3CheckIntegrityPhysHandlerNode(PAVLROGCPHYSNODECORE
     PPGMCHECKINTARGS pArgs = (PPGMCHECKINTARGS)pvUser;
     PPGMPHYSHANDLER pCur = (PPGMPHYSHANDLER)pNode;
     AssertReleaseReturn(!((uintptr_t)pCur & 7), 1);
-    AssertReleaseMsg(pCur->Core.Key <= pCur->Core.KeyLast,("pCur=%p %RGp-%RGp %s\n", pCur, pCur->Core.Key, pCur->Core.KeyLast, pCur->pszDesc));
+    AssertReleaseMsg(pCur->Core.Key <= pCur->Core.KeyLast,
+                     ("pCur=%p %RGp-%RGp %s\n", pCur, pCur->Core.Key, pCur->Core.KeyLast, pCur->pszDesc));
     AssertReleaseMsg(   !pArgs->pPrevPhys
-                     || (pArgs->fLeftToRight ? pArgs->pPrevPhys->Core.KeyLast < pCur->Core.Key : pArgs->pPrevPhys->Core.KeyLast > pCur->Core.Key),
+                     || (  pArgs->fLeftToRight
+                         ? pArgs->pPrevPhys->Core.KeyLast < pCur->Core.Key
+                         : pArgs->pPrevPhys->Core.KeyLast > pCur->Core.Key),
                      ("pPrevPhys=%p %RGp-%RGp %s\n"
                       "     pCur=%p %RGp-%RGp %s\n",
                       pArgs->pPrevPhys, pArgs->pPrevPhys->Core.Key, pArgs->pPrevPhys->Core.KeyLast, pArgs->pPrevPhys->pszDesc,
diff --git a/src/VBox/VMM/VMMR3/PGMHandler.cpp b/src/VBox/VMM/VMMR3/PGMHandler.cpp
index bfffa97..fbe69b7 100644
--- a/src/VBox/VMM/VMMR3/PGMHandler.cpp
+++ b/src/VBox/VMM/VMMR3/PGMHandler.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -64,33 +64,91 @@ static DECLCALLBACK(int) pgmR3InfoHandlersVirtualOne(PAVLROGCPTRNODECORE pNode,
 
 
 
+
 /**
- * Register a access handler for a physical range.
+ * Register a physical page access handler type, extended version.
  *
  * @returns VBox status code.
- * @param   pVM             Pointer to the VM.
- * @param   enmType         Handler type. Any of the PGMPHYSHANDLERTYPE_PHYSICAL* enums.
- * @param   GCPhys          Start physical address.
- * @param   GCPhysLast      Last physical address. (inclusive)
- * @param   pfnHandlerR3    The R3 handler.
- * @param   pvUserR3        User argument to the R3 handler.
- * @param   pszModR0        The R0 handler module. NULL means the default R0 module.
- * @param   pszHandlerR0    The R0 handler symbol name.
- * @param   pvUserR0        User argument to the R0 handler.
- * @param   pszModRC        The RC handler module. NULL means the default RC
- *                          module.
- * @param   pszHandlerRC    The RC handler symbol name.
- * @param   pvUserRC        User argument to the RC handler. Values less than
- *                          0x10000 will not be relocated.
- * @param   pszDesc         Pointer to description string. This must not be freed.
+ * @param   pVM             Pointer to the cross context VM structure.
+ * @param   enmKind         The kind of access handler.
+ * @param   pfnHandlerR3    Pointer to the ring-3 handler callback.
+ * @param   pfnPfHandlerR0  Pointer to the ring-0 \#PF handler callback.
+ * @param   pfnPfHandlerRC  Pointer to the raw-mode context \#PF handler
+ *                          callback.
+ * @param   pszDesc         The type description.
+ * @param   phType          Where to return the type handle (cross context
+ *                          safe).
+ */
+VMMR3_INT_DECL(int) PGMR3HandlerPhysicalTypeRegisterEx(PVM pVM, PGMPHYSHANDLERKIND enmKind,
+                                                       PFNPGMPHYSHANDLER pfnHandlerR3,
+                                                       R0PTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerR0,
+                                                       RCPTRTYPE(PFNPGMRZPHYSPFHANDLER) pfnPfHandlerRC,
+                                                       const char *pszDesc, PPGMPHYSHANDLERTYPE phType)
+{
+    AssertPtrReturn(pfnHandlerR3, VERR_INVALID_POINTER);
+    AssertReturn(pfnPfHandlerR0 != NIL_RTR0PTR, VERR_INVALID_POINTER);
+    AssertReturn(pfnPfHandlerRC != NIL_RTRCPTR || HMIsEnabled(pVM), VERR_INVALID_POINTER);
+    AssertPtrReturn(pszDesc, VERR_INVALID_POINTER);
+    AssertReturn(   enmKind == PGMPHYSHANDLERKIND_WRITE
+                 || enmKind == PGMPHYSHANDLERKIND_ALL
+                 || enmKind == PGMPHYSHANDLERKIND_MMIO,
+                 VERR_INVALID_PARAMETER);
+
+    PPGMPHYSHANDLERTYPEINT pType;
+    int rc = MMHyperAlloc(pVM, sizeof(*pType), 0, MM_TAG_PGM_HANDLER_TYPES, (void **)&pType);
+    if (RT_SUCCESS(rc))
+    {
+        pType->u32Magic         = PGMPHYSHANDLERTYPEINT_MAGIC;
+        pType->cRefs            = 1;
+        pType->enmKind          = enmKind;
+        pType->uState           = enmKind == PGMPHYSHANDLERKIND_WRITE
+                                ? PGM_PAGE_HNDL_PHYS_STATE_WRITE : PGM_PAGE_HNDL_PHYS_STATE_ALL;
+        pType->pfnHandlerR3     = pfnHandlerR3;
+        pType->pfnPfHandlerR0   = pfnPfHandlerR0;
+        pType->pfnPfHandlerRC   = pfnPfHandlerRC;
+        pType->pszDesc          = pszDesc;
+
+        pgmLock(pVM);
+        RTListOff32Append(&pVM->pgm.s.CTX_SUFF(pTrees)->HeadPhysHandlerTypes, &pType->ListNode);
+        pgmUnlock(pVM);
+
+        *phType = MMHyperHeapPtrToOffset(pVM, pType);
+        LogFlow(("PGMR3HandlerPhysicalTypeRegisterEx: %p/%#x: enmKind=%d pfnHandlerR3=%RHv pfnHandlerR0=%RHv pfnHandlerRC=%RRv pszDesc=%s\n",
+                 pType, *phType, enmKind, pfnHandlerR3, pfnPfHandlerR0, pfnPfHandlerRC, pszDesc));
+        return VINF_SUCCESS;
+    }
+    *phType = NIL_PGMPHYSHANDLERTYPE;
+    return rc;
+}
+
+
+/**
+ * Register a physical page access handler type.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the cross context VM structure.
+ * @param   enmKind         The kind of access handler.
+ * @param   pfnHandlerR3    Pointer to the ring-3 handler callback.
+ * @param   pszModR0        The name of the ring-0 module, NULL is an alias for
+ *                          the main ring-0 module.
+ * @param   pszPfHandlerR0  The name of the ring-0 \#PF handler, NULL if the
+ *                          ring-3 handler should be called.
+ * @param   pszModRC        The name of the raw-mode context module, NULL is an
+ *                          alias for the main RC module.
+ * @param   pszPfHandlerRC  The name of the raw-mode context \#PF handler, NULL
+ *                          if the ring-3 handler should be called.
+ * @param   pszDesc         The type description.
+ * @param   phType          Where to return the type handle (cross context
+ *                          safe).
  */
-VMMR3DECL(int) PGMR3HandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS GCPhysLast,
-                                            PFNPGMR3PHYSHANDLER pfnHandlerR3, void *pvUserR3,
-                                            const char *pszModR0, const char *pszHandlerR0, RTR0PTR pvUserR0,
-                                            const char *pszModRC, const char *pszHandlerRC, RTRCPTR pvUserRC, const char *pszDesc)
+VMMR3DECL(int) PGMR3HandlerPhysicalTypeRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind,
+                                                R3PTRTYPE(PFNPGMPHYSHANDLER) pfnHandlerR3,
+                                                const char *pszModR0, const char *pszPfHandlerR0,
+                                                const char *pszModRC, const char *pszPfHandlerRC, const char *pszDesc,
+                                                PPGMPHYSHANDLERTYPE phType)
 {
-    LogFlow(("PGMR3HandlerPhysicalRegister: enmType=%d GCPhys=%RGp GCPhysLast=%RGp pfnHandlerR3=%RHv pvUserHC=%RHv pszModR0=%s pszHandlerR0=%s pvUserR0=%RHv pszModRC=%s pszHandlerRC=%s pvUser=%RRv pszDesc=%s\n",
-             enmType, GCPhys, GCPhysLast, pfnHandlerR3, pvUserR3, pszModR0, pszHandlerR0, pvUserR0, pszHandlerRC, pszModRC, pvUserRC, pszDesc));
+    LogFlow(("PGMR3HandlerPhysicalTypeRegister: enmKind=%d pfnHandlerR3=%RHv pszModR0=%s pszPfHandlerR0=%s pszModRC=%s pszPfHandlerRC=%s pszDesc=%s\n",
+             enmKind, pfnHandlerR3, pszModR0, pszPfHandlerR0, pszModRC, pszPfHandlerRC, pszDesc));
 
     /*
      * Validate input.
@@ -99,36 +157,34 @@ VMMR3DECL(int) PGMR3HandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType,
         pszModRC = VMMGC_MAIN_MODULE_NAME;
     if (!pszModR0)
         pszModR0 = VMMR0_MAIN_MODULE_NAME;
-    if (!pszHandlerR0)
-        pszHandlerR0 = "pgmPhysHandlerRedirectToHC";
-    if (!pszHandlerRC)
-        pszHandlerRC = "pgmPhysHandlerRedirectToHC";
+    if (!pszPfHandlerR0)
+        pszPfHandlerR0 = "pgmPhysPfHandlerRedirectToHC";
+    if (!pszPfHandlerRC)
+        pszPfHandlerRC = "pgmPhysPfHandlerRedirectToHC";
     AssertPtrReturn(pfnHandlerR3, VERR_INVALID_POINTER);
-    AssertPtrReturn(pszHandlerR0, VERR_INVALID_POINTER);
-    AssertPtrReturn(pszHandlerRC, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszPfHandlerR0, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszPfHandlerRC, VERR_INVALID_POINTER);
 
     /*
      * Resolve the R0 handler.
      */
-    R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0 = NIL_RTR0PTR;
-    int rc = VINF_SUCCESS;
-    rc = PDMR3LdrGetSymbolR0Lazy(pVM, pszModR0, NULL /*pszSearchPath*/, pszHandlerR0, &pfnHandlerR0);
+    R0PTRTYPE(PFNPGMR0PHYSPFHANDLER) pfnPfHandlerR0 = NIL_RTR0PTR;
+    int rc = PDMR3LdrGetSymbolR0Lazy(pVM, pszModR0, NULL /*pszSearchPath*/, pszPfHandlerR0, &pfnPfHandlerR0);
     if (RT_SUCCESS(rc))
     {
         /*
          * Resolve the GC handler.
          */
-        RTRCPTR pfnHandlerRC = NIL_RTRCPTR;
+        RTRCPTR pfnPfHandlerRC = NIL_RTRCPTR;
         if (!HMIsEnabled(pVM))
-            rc = PDMR3LdrGetSymbolRCLazy(pVM, pszModRC, NULL /*pszSearchPath*/, pszHandlerRC, &pfnHandlerRC);
+            rc = PDMR3LdrGetSymbolRCLazy(pVM, pszModRC, NULL /*pszSearchPath*/, pszPfHandlerRC, &pfnPfHandlerRC);
         if (RT_SUCCESS(rc))
-            return PGMHandlerPhysicalRegisterEx(pVM, enmType, GCPhys, GCPhysLast, pfnHandlerR3, pvUserR3,
-                                                pfnHandlerR0, pvUserR0, pfnHandlerRC, pvUserRC, pszDesc);
+            return PGMR3HandlerPhysicalTypeRegisterEx(pVM, enmKind, pfnHandlerR3, pfnPfHandlerR0, pfnPfHandlerRC, pszDesc, phType);
 
-        AssertMsgFailed(("Failed to resolve %s.%s, rc=%Rrc.\n", pszModRC, pszHandlerRC, rc));
+        AssertMsgFailed(("Failed to resolve %s.%s, rc=%Rrc.\n", pszModRC, pszPfHandlerRC, rc));
     }
     else
-        AssertMsgFailed(("Failed to resolve %s.%s, rc=%Rrc.\n", pszModR0, pszHandlerR0, rc));
+        AssertMsgFailed(("Failed to resolve %s.%s, rc=%Rrc.\n", pszModR0, pszPfHandlerR0, rc));
 
     return rc;
 }
@@ -194,12 +250,13 @@ static DECLCALLBACK(int) pgmR3HandlerPhysicalOneClear(PAVLROGCPHYSNODECORE pNode
  */
 static DECLCALLBACK(int) pgmR3HandlerPhysicalOneSet(PAVLROGCPHYSNODECORE pNode, void *pvUser)
 {
-    PPGMPHYSHANDLER pCur     = (PPGMPHYSHANDLER)pNode;
-    unsigned        uState   = pgmHandlerPhysicalCalcState(pCur);
-    PPGMRAMRANGE    pRamHint = NULL;
-    RTGCPHYS        GCPhys   = pCur->Core.Key;
-    RTUINT          cPages   = pCur->cPages;
-    PVM             pVM      = (PVM)pvUser;
+    PVM                     pVM       = (PVM)pvUser;
+    PPGMPHYSHANDLER         pCur      = (PPGMPHYSHANDLER)pNode;
+    PPGMPHYSHANDLERTYPEINT  pCurType  = PGMPHYSHANDLER_GET_TYPE(pVM, pCur);
+    unsigned                uState    = pCurType->uState;
+    PPGMRAMRANGE            pRamHint  = NULL;
+    RTGCPHYS                GCPhys    = pCur->Core.Key;
+    RTUINT                  cPages    = pCur->cPages;
     for (;;)
     {
         PPGMPAGE pPage;
@@ -217,126 +274,157 @@ static DECLCALLBACK(int) pgmR3HandlerPhysicalOneSet(PAVLROGCPHYSNODECORE pNode,
 
 
 /**
- * Register a access handler for a virtual range.
+ * Register a virtual page access handler type, extended version.
  *
  * @returns VBox status code.
- * @param   pVM             Pointer to the VM.
- * @param   enmType         Handler type. Any of the PGMVIRTHANDLERTYPE_* enums.
- * @param   GCPtr           Start address.
- * @param   GCPtrLast       Last address (inclusive).
- * @param   pfnInvalidateR3 The R3 invalidate callback (can be 0)
- * @param   pfnHandlerR3    The R3 handler.
- * @param   pszHandlerRC    The RC handler symbol name.
- * @param   pszModRC        The RC handler module.
- * @param   pszDesc         Pointer to description string. This must not be freed.
+ * @param   pVM             Pointer to the cross context VM structure.
+ * @param   enmKind         The kind of access handler.
+ * @param   fRelocUserRC    Whether the pvUserRC argument should be
+ *                          automatically relocated or not.
+ * @param   pfnInvalidateR3 Pointer to the ring-3 invalidation handler callback.
+ * @param   pfnHandlerR3    Pointer to the ring-3 handler callback.
+ * @param   pfnPfHandlerRC  Pointer to the raw-mode context handler callback.
+ * @param   pszDesc         The type description.
+ * @param   phType          Where to return the type handle (cross context
+ *                          safe).
+ * @remarks No virtual handlers when executing using HM (i.e. ring-0).
  */
-VMMR3DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast,
-                                           PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
-                                           PFNPGMR3VIRTHANDLER pfnHandlerR3,
-                                           const char *pszHandlerRC, const char *pszModRC,
-                                           const char *pszDesc)
+VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegisterEx(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
+                                                      PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
+                                                      PFNPGMR3VIRTHANDLER pfnHandlerR3,
+                                                      RCPTRTYPE(FNPGMRCVIRTPFHANDLER) pfnPfHandlerRC,
+                                                      const char *pszDesc, PPGMVIRTHANDLERTYPE phType)
 {
-    LogFlow(("PGMR3HandlerVirtualRegisterEx: enmType=%d GCPtr=%RGv GCPtrLast=%RGv pszHandlerRC=%p:{%s} pszModRC=%p:{%s} pszDesc=%s\n",
-             enmType, GCPtr, GCPtrLast, pszHandlerRC, pszHandlerRC, pszModRC, pszModRC, pszDesc));
+    AssertReturn(!HMIsEnabled(pVM), VERR_NOT_AVAILABLE); /* Not supported/relevant for VT-x and AMD-V. */
+    AssertReturn(RT_VALID_PTR(pfnHandlerR3) || enmKind == PGMVIRTHANDLERKIND_HYPERVISOR, VERR_INVALID_POINTER);
+    AssertPtrNullReturn(pfnInvalidateR3, VERR_INVALID_POINTER);
+    AssertReturn(pfnPfHandlerRC != NIL_RTRCPTR, VERR_INVALID_POINTER);
+    AssertPtrReturn(pszDesc, VERR_INVALID_POINTER);
+    AssertReturn(   enmKind == PGMVIRTHANDLERKIND_WRITE
+                 || enmKind == PGMVIRTHANDLERKIND_ALL
+                 || enmKind == PGMVIRTHANDLERKIND_HYPERVISOR,
+                 VERR_INVALID_PARAMETER);
+
+    PPGMVIRTHANDLERTYPEINT pType;
+    int rc = MMHyperAlloc(pVM, sizeof(*pType), 0, MM_TAG_PGM_HANDLER_TYPES, (void **)&pType);
+    if (RT_SUCCESS(rc))
+    {
+        pType->u32Magic         = PGMVIRTHANDLERTYPEINT_MAGIC;
+        pType->cRefs            = 1;
+        pType->enmKind          = enmKind;
+        pType->fRelocUserRC     = fRelocUserRC;
+        pType->uState           = enmKind == PGMVIRTHANDLERKIND_ALL
+                                ? PGM_PAGE_HNDL_VIRT_STATE_ALL : PGM_PAGE_HNDL_VIRT_STATE_WRITE;
+        pType->pfnInvalidateR3  = pfnInvalidateR3;
+        pType->pfnHandlerR3     = pfnHandlerR3;
+        pType->pfnPfHandlerRC   = pfnPfHandlerRC;
+        pType->pszDesc          = pszDesc;
+
+        pgmLock(pVM);
+        RTListOff32Append(&pVM->pgm.s.CTX_SUFF(pTrees)->HeadVirtHandlerTypes, &pType->ListNode);
+        pgmUnlock(pVM);
+
+        *phType = MMHyperHeapPtrToOffset(pVM, pType);
+        LogFlow(("PGMR3HandlerVirtualTypeRegisterEx: %p/%#x: enmKind=%d pfnInvalidateR3=%RHv pfnHandlerR3=%RHv pfnPfHandlerRC=%RRv pszDesc=%s\n",
+                 pType, *phType, enmKind, pfnInvalidateR3, pfnHandlerR3, pfnPfHandlerRC, pszDesc));
+        return VINF_SUCCESS;
+    }
+    *phType = NIL_PGMVIRTHANDLERTYPE;
+    return rc;
+}
+
 
-    /* Not supported/relevant for VT-x and AMD-V. */
-    if (HMIsEnabled(pVM))
-        return VERR_NOT_IMPLEMENTED;
+/**
+ * Register a physical page access handler type.
+ *
+ * @returns VBox status code.
+ * @param   pVM             Pointer to the cross context VM structure.
+ * @param   enmKind         The kind of access handler.
+ * @param   fRelocUserRC    Whether the pvUserRC argument should be
+ *                          automatically relocated or not.
+ * @param   pfnInvalidateR3 Pointer to the ring-3 invalidateion callback
+ *                          (optional, can be NULL).
+ * @param   pfnHandlerR3    Pointer to the ring-3 handler callback.
+ * @param   pszPfHandlerRC  The name of the raw-mode context handler.
+ * @param   pszDesc         The type description.
+ * @param   phType          Where to return the type handle (cross context
+ *                          safe).
+ * @remarks No virtual handlers when executing using HM (i.e. ring-0).
+ */
+VMMR3_INT_DECL(int) PGMR3HandlerVirtualTypeRegister(PVM pVM, PGMVIRTHANDLERKIND enmKind, bool fRelocUserRC,
+                                                    PFNPGMR3VIRTINVALIDATE pfnInvalidateR3,
+                                                    PFNPGMR3VIRTHANDLER pfnHandlerR3,
+                                                    const char *pszPfHandlerRC, const char *pszDesc,
+                                                    PPGMVIRTHANDLERTYPE phType)
+{
+    LogFlow(("PGMR3HandlerVirtualTypeRegister: enmKind=%d pfnInvalidateR3=%RHv pfnHandlerR3=%RHv pszPfHandlerRC=%s pszDesc=%s\n",
+             enmKind, pfnInvalidateR3, pfnHandlerR3, pszPfHandlerRC, pszDesc));
 
     /*
      * Validate input.
      */
-    if (!pszModRC)
-        pszModRC = VMMGC_MAIN_MODULE_NAME;
-    if (!pszModRC || !*pszModRC || !pszHandlerRC || !*pszHandlerRC)
-    {
-        AssertMsgFailed(("pfnHandlerGC or/and pszModRC is missing\n"));
-        return VERR_INVALID_PARAMETER;
-    }
+    AssertPtrReturn(pszPfHandlerRC, VERR_INVALID_POINTER);
 
     /*
      * Resolve the GC handler.
      */
-    RTRCPTR pfnHandlerRC;
-    int rc = PDMR3LdrGetSymbolRCLazy(pVM, pszModRC, NULL /*pszSearchPath*/, pszHandlerRC, &pfnHandlerRC);
+    RTRCPTR pfnPfHandlerRC = NIL_RTRCPTR;
+    int rc = PDMR3LdrGetSymbolRCLazy(pVM, VMMGC_MAIN_MODULE_NAME, NULL /*pszSearchPath*/, pszPfHandlerRC, &pfnPfHandlerRC);
     if (RT_SUCCESS(rc))
-        return PGMR3HandlerVirtualRegisterEx(pVM, enmType, GCPtr, GCPtrLast, pfnInvalidateR3,
-                                             pfnHandlerR3, pfnHandlerRC, pszDesc);
+        return PGMR3HandlerVirtualTypeRegisterEx(pVM, enmKind, fRelocUserRC,
+                                                 pfnInvalidateR3, pfnHandlerR3,
+                                                 pfnPfHandlerRC,
+                                                 pszDesc, phType);
 
-    AssertMsgFailed(("Failed to resolve %s.%s, rc=%Rrc.\n", pszModRC, pszHandlerRC, rc));
+    AssertMsgFailed(("Failed to resolve %s.%s, rc=%Rrc.\n", VMMGC_MAIN_MODULE_NAME, pszPfHandlerRC, rc));
     return rc;
 }
 
 
 /**
- * Register an access handler for a virtual range.
+ * Register a access handler for a virtual range.
  *
  * @returns VBox status code.
  * @param   pVM             Pointer to the VM.
- * @param   enmType         Handler type. Any of the PGMVIRTHANDLERTYPE_* enums.
+ * @param   hType           The handler type.
  * @param   GCPtr           Start address.
  * @param   GCPtrLast       Last address (inclusive).
- * @param   pfnInvalidateR3 The R3 invalidate callback (can be 0)
- * @param   pfnHandlerR3    The R3 handler.
- * @param   pfnHandlerRC    The RC handler.
+ * @param   pvUserR3        The ring-3 context user argument.
+ * @param   pvUserRC        The raw-mode context user argument.  Whether this is
+ *                          automatically relocated or not depends on the type.
  * @param   pszDesc         Pointer to description string. This must not be freed.
- * @thread  EMT
  */
-/** @todo create a template for virtual handlers (see async i/o), we're wasting space
- * duplicating the function pointers now. (Or we will once we add the missing callbacks.) */
-VMMDECL(int) PGMR3HandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType, RTGCPTR GCPtr, RTGCPTR GCPtrLast,
-                                           R3PTRTYPE(PFNPGMR3VIRTINVALIDATE) pfnInvalidateR3,
-                                           R3PTRTYPE(PFNPGMR3VIRTHANDLER) pfnHandlerR3,
-                                           RCPTRTYPE(PFNPGMRCVIRTHANDLER) pfnHandlerRC,
-                                           R3PTRTYPE(const char *) pszDesc)
+VMMR3_INT_DECL(int) PGMR3HandlerVirtualRegister(PVM pVM, PVMCPU pVCpu, PGMVIRTHANDLERTYPE hType, RTGCPTR GCPtr, RTGCPTR GCPtrLast,
+                                                void *pvUserR3, RTRCPTR pvUserRC, const char *pszDesc)
 {
-    Log(("PGMR3HandlerVirtualRegister: enmType=%d GCPtr=%RGv GCPtrLast=%RGv pfnInvalidateR3=%RHv pfnHandlerR3=%RHv pfnHandlerRC=%RRv pszDesc=%s\n",
-         enmType, GCPtr, GCPtrLast, pfnInvalidateR3, pfnHandlerR3, pfnHandlerRC, pszDesc));
-
-    /* Not supported/relevant for VT-x and AMD-V. */
-    if (HMIsEnabled(pVM))
-        return VERR_NOT_IMPLEMENTED;
+    AssertReturn(!HMIsEnabled(pVM), VERR_NOT_AVAILABLE); /* Not supported/relevant for VT-x and AMD-V. */
+    PPGMVIRTHANDLERTYPEINT pType = PGMVIRTHANDLERTYPEINT_FROM_HANDLE(pVM, hType);
+    Log(("PGMR3HandlerVirtualRegister: GCPhys=%RGp GCPhysLast=%RGp pvUserR3=%RHv pvUserGC=%RRv hType=%#x (%d, %s) pszDesc=%RHv:%s\n",
+         GCPtr, GCPtrLast, pvUserR3, pvUserRC, hType, pType->enmKind, R3STRING(pType->pszDesc), pszDesc, R3STRING(pszDesc)));
 
     /*
      * Validate input.
      */
-    switch (enmType)
+    AssertReturn(pType->u32Magic == PGMVIRTHANDLERTYPEINT_MAGIC, VERR_INVALID_HANDLE);
+    AssertMsgReturn(GCPtr < GCPtrLast, ("GCPtr >= GCPtrLast (%RGp >= %RGp)\n", GCPtr, GCPtrLast), VERR_INVALID_PARAMETER);
+    switch (pType->enmKind)
     {
-        case PGMVIRTHANDLERTYPE_ALL:
+        case PGMVIRTHANDLERKIND_ALL:
             AssertReleaseMsgReturn(   (GCPtr     & PAGE_OFFSET_MASK) == 0
                                    && (GCPtrLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK,
-                                   ("PGMVIRTHANDLERTYPE_ALL: GCPtr=%RGv GCPtrLast=%RGv\n", GCPtr, GCPtrLast),
+                                   ("PGMVIRTHANDLERKIND_ALL: GCPtr=%RGv GCPtrLast=%RGv\n", GCPtr, GCPtrLast),
                                    VERR_NOT_IMPLEMENTED);
             break;
-        case PGMVIRTHANDLERTYPE_WRITE:
-            if (!pfnHandlerR3)
-            {
-                AssertMsgFailed(("No HC handler specified!!\n"));
-                return VERR_INVALID_PARAMETER;
-            }
-            break;
-
-        case PGMVIRTHANDLERTYPE_HYPERVISOR:
-            if (pfnHandlerR3)
-            {
-                AssertMsgFailed(("R3 handler specified for hypervisor range!?!\n"));
-                return VERR_INVALID_PARAMETER;
-            }
+        case PGMVIRTHANDLERKIND_WRITE:
+        case PGMVIRTHANDLERKIND_HYPERVISOR:
             break;
         default:
-            AssertMsgFailed(("Invalid enmType! enmType=%d\n", enmType));
-            return VERR_INVALID_PARAMETER;
-    }
-    if (GCPtrLast < GCPtr)
-    {
-        AssertMsgFailed(("GCPtrLast < GCPtr (%#x < %#x)\n", GCPtrLast, GCPtr));
-        return VERR_INVALID_PARAMETER;
-    }
-    if (!pfnHandlerRC)
-    {
-        AssertMsgFailed(("pfnHandlerRC is missing\n"));
-        return VERR_INVALID_PARAMETER;
+            AssertMsgFailedReturn(("Invalid enmKind=%d!\n", pType->enmKind), VERR_INVALID_PARAMETER);
     }
+    AssertMsgReturn(   (RTRCUINTPTR)pvUserRC < 0x10000
+                    || MMHyperR3ToRC(pVM, MMHyperRCToR3(pVM, pvUserRC)) == pvUserRC,
+                    ("Not RC pointer! pvUserRC=%RRv\n", pvUserRC),
+                    VERR_INVALID_PARAMETER);
 
     /*
      * Allocate and initialize a new entry.
@@ -350,11 +438,10 @@ VMMDECL(int) PGMR3HandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType,
     pNew->Core.Key      = GCPtr;
     pNew->Core.KeyLast  = GCPtrLast;
 
-    pNew->enmType       = enmType;
-    pNew->pfnInvalidateR3 = pfnInvalidateR3;
-    pNew->pfnHandlerRC  = pfnHandlerRC;
-    pNew->pfnHandlerR3  = pfnHandlerR3;
-    pNew->pszDesc       = pszDesc;
+    pNew->hType         = hType;
+    pNew->pvUserRC      = pvUserRC;
+    pNew->pvUserR3      = pvUserR3;
+    pNew->pszDesc       = pszDesc ? pszDesc : pType->pszDesc;
     pNew->cb            = GCPtrLast - GCPtr + 1;
     pNew->cPages        = cPages;
     /* Will be synced at next guest execution attempt. */
@@ -372,7 +459,7 @@ VMMDECL(int) PGMR3HandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType,
      * The current implementation doesn't allow multiple handlers for
      * the same range this makes everything much simpler and faster.
      */
-    AVLROGCPTRTREE *pRoot = enmType != PGMVIRTHANDLERTYPE_HYPERVISOR
+    AVLROGCPTRTREE *pRoot = pType->enmKind != PGMVIRTHANDLERKIND_HYPERVISOR
                           ? &pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers
                           : &pVM->pgm.s.CTX_SUFF(pTrees)->HyperVirtHandlers;
     pgmLock(pVM);
@@ -400,17 +487,16 @@ VMMDECL(int) PGMR3HandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType,
     }
     if (RTAvlroGCPtrInsert(pRoot, &pNew->Core))
     {
-        if (enmType != PGMVIRTHANDLERTYPE_HYPERVISOR)
+        if (pType->enmKind != PGMVIRTHANDLERKIND_HYPERVISOR)
         {
-            PVMCPU pVCpu = VMMGetCpu(pVM);
-
             pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL | PGM_SYNC_CLEAR_PGM_POOL;
             VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
         }
+        PGMHandlerVirtualTypeRetain(pVM, hType);
         pgmUnlock(pVM);
 
 #ifdef VBOX_WITH_STATISTICS
-        rc = STAMR3RegisterF(pVM, &pNew->Stat, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc,
+        rc = STAMR3RegisterF(pVM, &pNew->Stat, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pNew->pszDesc,
                              "/PGM/VirtHandler/Calls/%RGv-%RGv", pNew->Core.Key, pNew->Core.KeyLast);
         AssertRC(rc);
 #endif
@@ -421,26 +507,38 @@ VMMDECL(int) PGMR3HandlerVirtualRegisterEx(PVM pVM, PGMVIRTHANDLERTYPE enmType,
     AssertFailed();
     MMHyperFree(pVM, pNew);
     return VERR_PGM_HANDLER_VIRTUAL_CONFLICT;
+
 }
 
 
 /**
- * Modify the page invalidation callback handler for a registered virtual range.
- * (add more when needed)
+ * Changes the type of a virtual handler.
+ *
+ * The new and old type must have the same access kind.
  *
  * @returns VBox status code.
  * @param   pVM             Pointer to the VM.
- * @param   GCPtr           Start address.
- * @param   pfnInvalidateR3 The R3 invalidate callback (can be 0)
- * @remarks Doesn't work with the hypervisor access handler type.
+ * @param   GCPtr           Start address of the virtual handler.
+ * @param   hNewType        The new handler type.
  */
-VMMDECL(int) PGMHandlerVirtualChangeInvalidateCallback(PVM pVM, RTGCPTR GCPtr, PFNPGMR3VIRTINVALIDATE pfnInvalidateR3)
+VMMR3_INT_DECL(int) PGMHandlerVirtualChangeType(PVM pVM, RTGCPTR GCPtr, PGMVIRTHANDLERTYPE hNewType)
 {
+    PPGMVIRTHANDLERTYPEINT pNewType = PGMVIRTHANDLERTYPEINT_FROM_HANDLE(pVM, hNewType);
+    AssertReturn(pNewType->u32Magic == PGMVIRTHANDLERTYPEINT_MAGIC, VERR_INVALID_HANDLE);
+
     pgmLock(pVM);
     PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrGet(&pVM->pgm.s.pTreesR3->VirtHandlers, GCPtr);
     if (pCur)
     {
-        pCur->pfnInvalidateR3 = pfnInvalidateR3;
+        PGMVIRTHANDLERTYPE     hOldType = pCur->hType;
+        PPGMVIRTHANDLERTYPEINT pOldType = PGMVIRTHANDLERTYPEINT_FROM_HANDLE(pVM, hOldType);
+        if (pOldType != pNewType)
+        {
+            AssertReturnStmt(pNewType->enmKind == pOldType->enmKind, pgmUnlock(pVM), VERR_ACCESS_DENIED);
+            PGMHandlerVirtualTypeRetain(pVM, hNewType);
+            pCur->hType = hNewType;
+            PGMHandlerVirtualTypeRelease(pVM, hOldType);
+        }
         pgmUnlock(pVM);
         return VINF_SUCCESS;
     }
@@ -449,67 +547,66 @@ VMMDECL(int) PGMHandlerVirtualChangeInvalidateCallback(PVM pVM, RTGCPTR GCPtr, P
     return VERR_INVALID_PARAMETER;
 }
 
+
 /**
  * Deregister an access handler for a virtual range.
  *
  * @returns VBox status code.
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU structure for the
+ *                      calling EMT.
  * @param   GCPtr       Start address.
- * @thread  EMT
+ * @param   fHypervisor Set if PGMVIRTHANDLERKIND_HYPERVISOR, false if not.
+ * @thread  EMT(pVCpu)
  */
-VMMDECL(int) PGMHandlerVirtualDeregister(PVM pVM, RTGCPTR GCPtr)
+VMMR3_INT_DECL(int) PGMHandlerVirtualDeregister(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, bool fHypervisor)
 {
     pgmLock(pVM);
 
-    /*
-     * Find the handler.
-     * We naturally assume GCPtr is a unique specification.
-     */
-    PPGMVIRTHANDLER pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, GCPtr);
-    if (RT_LIKELY(pCur))
+    PPGMVIRTHANDLER pCur;
+    if (!fHypervisor)
     {
-        Log(("PGMHandlerVirtualDeregister: Removing Virtual (%d) Range %RGv-%RGv %s\n", pCur->enmType,
-             pCur->Core.Key, pCur->Core.KeyLast, pCur->pszDesc));
-        Assert(pCur->enmType != PGMVIRTHANDLERTYPE_HYPERVISOR);
-
         /*
-         * Reset the flags and remove phys2virt nodes.
+         * Normal guest handler.
          */
+        pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->VirtHandlers, GCPtr);
+        AssertMsgReturnStmt(pCur, ("GCPtr=%RGv\n", GCPtr), pgmUnlock(pVM), VERR_INVALID_PARAMETER);
+        Assert(PGMVIRTANDLER_GET_TYPE(pVM, pCur)->enmKind != PGMVIRTHANDLERKIND_HYPERVISOR);
+
+        Log(("PGMHandlerVirtualDeregister: Removing Virtual (%d) Range %RGv-%RGv %s\n",
+             PGMVIRTANDLER_GET_TYPE(pVM, pCur)->enmKind, pCur->Core.Key, pCur->Core.KeyLast, pCur->pszDesc));
+
+        /* Reset the flags and remove phys2virt nodes. */
         for (uint32_t iPage = 0; iPage < pCur->cPages; iPage++)
             if (pCur->aPhysToVirt[iPage].offNextAlias & PGMPHYS2VIRTHANDLER_IN_TREE)
                 pgmHandlerVirtualClearPage(pVM, pCur, iPage);
 
-        /*
-         * Schedule CR3 sync.
-         */
-        PVMCPU pVCpu = VMMGetCpu(pVM);
-
+        /* Schedule CR3 sync. */
         pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL | PGM_SYNC_CLEAR_PGM_POOL;
         VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
     }
     else
     {
-        /* must be a hypervisor one then. */
+        /*
+         * Hypervisor one (hypervisor relocation or termination only).
+         */
         pCur = (PPGMVIRTHANDLER)RTAvlroGCPtrRemove(&pVM->pgm.s.CTX_SUFF(pTrees)->HyperVirtHandlers, GCPtr);
-        if (RT_UNLIKELY(!pCur))
-        {
-            pgmUnlock(pVM);
-#ifndef DEBUG_sander
-            AssertMsgFailed(("Range %#x not found!\n", GCPtr));
-#endif
-            return VERR_INVALID_PARAMETER;
-        }
+        AssertMsgReturnStmt(pCur, ("GCPtr=%RGv\n", GCPtr), pgmUnlock(pVM), VERR_INVALID_PARAMETER);
+        Assert(PGMVIRTANDLER_GET_TYPE(pVM, pCur)->enmKind == PGMVIRTHANDLERKIND_HYPERVISOR);
 
-        Log(("PGMHandlerVirtualDeregister: Removing Hyper Virtual (%d) Range %RGv-%RGv %s\n", pCur->enmType,
+        Log(("PGMHandlerVirtualDeregister: Removing Hyper Virtual Range %RGv-%RGv %s\n",
              pCur->Core.Key, pCur->Core.KeyLast, pCur->pszDesc));
-        Assert(pCur->enmType == PGMVIRTHANDLERTYPE_HYPERVISOR);
     }
 
     pgmUnlock(pVM);
 
+    /*
+     * Free it.
+     */
 #ifdef VBOX_WITH_STATISTICS
     STAMR3DeregisterF(pVM->pUVM, "/PGM/VirtHandler/Calls/%RGv-%RGv", pCur->Core.Key, pCur->Core.KeyLast);
 #endif
+    PGMHandlerVirtualTypeRelease(pVM, pCur->hType);
     MMHyperFree(pVM, pCur);
 
     return VINF_SUCCESS;
@@ -523,6 +620,8 @@ typedef struct PGMHANDLERINFOARG
 {
     /** The output helpers.*/
     PCDBGFINFOHLP   pHlp;
+    /** Pointer to the cross context VM handle. */
+    PVM             pVM;
     /** Set if statistics should be dumped. */
     bool            fStats;
 } PGMHANDLERINFOARG, *PPGMHANDLERINFOARG;
@@ -539,7 +638,7 @@ DECLCALLBACK(void) pgmR3InfoHandlers(PVM pVM, PCDBGFINFOHLP pHlp, const char *ps
     /*
      * Test input.
      */
-    PGMHANDLERINFOARG Args = { pHlp, /* .fStats = */ true };
+    PGMHANDLERINFOARG Args = { pHlp, pVM, /* .fStats = */ true };
     bool fPhysical = !pszArgs  || !*pszArgs;
     bool fVirtual = fPhysical;
     bool fHyper = fPhysical;
@@ -603,20 +702,22 @@ DECLCALLBACK(void) pgmR3InfoHandlers(PVM pVM, PCDBGFINFOHLP pHlp, const char *ps
  */
 static DECLCALLBACK(int) pgmR3InfoHandlersPhysicalOne(PAVLROGCPHYSNODECORE pNode, void *pvUser)
 {
-    PPGMPHYSHANDLER     pCur = (PPGMPHYSHANDLER)pNode;
-    PPGMHANDLERINFOARG  pArgs= (PPGMHANDLERINFOARG)pvUser;
-    PCDBGFINFOHLP       pHlp = pArgs->pHlp;
+    PPGMPHYSHANDLER        pCur     = (PPGMPHYSHANDLER)pNode;
+    PPGMHANDLERINFOARG     pArgs    = (PPGMHANDLERINFOARG)pvUser;
+    PCDBGFINFOHLP          pHlp     = pArgs->pHlp;
+    PPGMPHYSHANDLERTYPEINT pCurType = PGMPHYSHANDLER_GET_TYPE(pArgs->pVM, pCur);
     const char *pszType;
-    switch (pCur->enmType)
+    switch (pCurType->enmKind)
     {
-        case PGMPHYSHANDLERTYPE_MMIO:           pszType = "MMIO   "; break;
-        case PGMPHYSHANDLERTYPE_PHYSICAL_WRITE: pszType = "Write  "; break;
-        case PGMPHYSHANDLERTYPE_PHYSICAL_ALL:   pszType = "All    "; break;
-        default:                                pszType = "????"; break;
+        case PGMPHYSHANDLERKIND_MMIO:   pszType = "MMIO   "; break;
+        case PGMPHYSHANDLERKIND_WRITE:  pszType = "Write  "; break;
+        case PGMPHYSHANDLERKIND_ALL:    pszType = "All    "; break;
+        default:                        pszType = "????"; break;
     }
     pHlp->pfnPrintf(pHlp,
         "%RGp - %RGp  %RHv  %RHv  %RRv  %RRv  %s  %s\n",
-        pCur->Core.Key, pCur->Core.KeyLast, pCur->pfnHandlerR3, pCur->pvUserR3, pCur->pfnHandlerRC, pCur->pvUserRC, pszType, pCur->pszDesc);
+        pCur->Core.Key, pCur->Core.KeyLast, pCurType->pfnHandlerR3, pCur->pvUserR3, pCurType->pfnPfHandlerRC, pCur->pvUserRC,
+                    pszType, pCur->pszDesc);
 #ifdef VBOX_WITH_STATISTICS
     if (pArgs->fStats)
         pHlp->pfnPrintf(pHlp, "   cPeriods: %9RU64  cTicks: %11RU64  Min: %11RU64  Avg: %11RU64 Max: %11RU64\n",
@@ -636,19 +737,20 @@ static DECLCALLBACK(int) pgmR3InfoHandlersPhysicalOne(PAVLROGCPHYSNODECORE pNode
  */
 static DECLCALLBACK(int) pgmR3InfoHandlersVirtualOne(PAVLROGCPTRNODECORE pNode, void *pvUser)
 {
-    PPGMVIRTHANDLER     pCur = (PPGMVIRTHANDLER)pNode;
-    PPGMHANDLERINFOARG  pArgs= (PPGMHANDLERINFOARG)pvUser;
-    PCDBGFINFOHLP       pHlp = pArgs->pHlp;
+    PPGMVIRTHANDLER         pCur     = (PPGMVIRTHANDLER)pNode;
+    PPGMHANDLERINFOARG      pArgs    = (PPGMHANDLERINFOARG)pvUser;
+    PCDBGFINFOHLP           pHlp     = pArgs->pHlp;
+    PPGMVIRTHANDLERTYPEINT  pCurType = PGMVIRTANDLER_GET_TYPE(pArgs->pVM, pCur);
     const char *pszType;
-    switch (pCur->enmType)
+    switch (pCurType->enmKind)
     {
-        case PGMVIRTHANDLERTYPE_WRITE:      pszType = "Write  "; break;
-        case PGMVIRTHANDLERTYPE_ALL:        pszType = "All    "; break;
-        case PGMVIRTHANDLERTYPE_HYPERVISOR: pszType = "WriteHyp "; break;
+        case PGMVIRTHANDLERKIND_WRITE:      pszType = "Write  "; break;
+        case PGMVIRTHANDLERKIND_ALL:        pszType = "All    "; break;
+        case PGMVIRTHANDLERKIND_HYPERVISOR: pszType = "WriteHyp "; break;
         default:                            pszType = "????"; break;
     }
     pHlp->pfnPrintf(pHlp, "%RGv - %RGv  %RHv  %RRv  %s  %s\n",
-        pCur->Core.Key, pCur->Core.KeyLast, pCur->pfnHandlerR3, pCur->pfnHandlerRC, pszType, pCur->pszDesc);
+        pCur->Core.Key, pCur->Core.KeyLast, pCurType->pfnHandlerR3, pCurType->pfnPfHandlerRC, pszType, pCur->pszDesc);
 #ifdef VBOX_WITH_STATISTICS
     if (pArgs->fStats)
         pHlp->pfnPrintf(pHlp, "   cPeriods: %9RU64  cTicks: %11RU64  Min: %11RU64  Avg: %11RU64 Max: %11RU64\n",
diff --git a/src/VBox/VMM/VMMR3/PGMPhys.cpp b/src/VBox/VMM/VMMR3/PGMPhys.cpp
index 682d7ee..617f7a7 100644
--- a/src/VBox/VMM/VMMR3/PGMPhys.cpp
+++ b/src/VBox/VMM/VMMR3/PGMPhys.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -54,12 +54,6 @@
 #define PGMPHYS_FREE_PAGE_BATCH_SIZE    128
 
 
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
-static DECLCALLBACK(int) pgmR3PhysRomWriteHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
-
-
 /*
  * PGMR3PhysReadU8-64
  * PGMR3PhysWriteU8-64
@@ -92,9 +86,10 @@ static DECLCALLBACK(int) pgmR3PhysRomWriteHandler(PVM pVM, RTGCPHYS GCPhys, void
 /**
  * EMT worker for PGMR3PhysReadExternal.
  */
-static DECLCALLBACK(int) pgmR3PhysReadExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, void *pvBuf, size_t cbRead)
+static DECLCALLBACK(int) pgmR3PhysReadExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, void *pvBuf, size_t cbRead,
+                                                  PGMACCESSORIGIN enmOrigin)
 {
-    PGMPhysRead(pVM, *pGCPhys, pvBuf, cbRead);
+    PGMPhysRead(pVM, *pGCPhys, pvBuf, cbRead, enmOrigin);
     return VINF_SUCCESS;
 }
 
@@ -109,10 +104,11 @@ static DECLCALLBACK(int) pgmR3PhysReadExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, vo
  * @param   GCPhys          Physical address to read from.
  * @param   pvBuf           Where to read into.
  * @param   cbRead          How many bytes to read.
+ * @param   enmOrigin       Who is calling.
  *
  * @thread  Any but EMTs.
  */
-VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
+VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, PGMACCESSORIGIN enmOrigin)
 {
     VM_ASSERT_OTHER_THREAD(pVM);
 
@@ -148,8 +144,8 @@ VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size
                 {
                     pgmUnlock(pVM);
 
-                    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysReadExternalEMT, 4,
-                                                   pVM, &GCPhys, pvBuf, cbRead);
+                    return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysReadExternalEMT, 5,
+                                                   pVM, &GCPhys, pvBuf, cbRead, enmOrigin);
                 }
                 Assert(!PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage));
 
@@ -220,10 +216,11 @@ VMMR3DECL(int) PGMR3PhysReadExternal(PVM pVM, RTGCPHYS GCPhys, void *pvBuf, size
 /**
  * EMT worker for PGMR3PhysWriteExternal.
  */
-static DECLCALLBACK(int) pgmR3PhysWriteExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, const void *pvBuf, size_t cbWrite)
+static DECLCALLBACK(int) pgmR3PhysWriteExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, const void *pvBuf, size_t cbWrite,
+                                                   PGMACCESSORIGIN enmOrigin)
 {
     /** @todo VERR_EM_NO_MEMORY */
-    PGMPhysWrite(pVM, *pGCPhys, pvBuf, cbWrite);
+    PGMPhysWrite(pVM, *pGCPhys, pvBuf, cbWrite, enmOrigin);
     return VINF_SUCCESS;
 }
 
@@ -239,18 +236,17 @@ static DECLCALLBACK(int) pgmR3PhysWriteExternalEMT(PVM pVM, PRTGCPHYS pGCPhys, c
  * @param   GCPhys          Physical address to write to.
  * @param   pvBuf           What to write.
  * @param   cbWrite         How many bytes to write.
- * @param   pszWho          Who is writing.  For tracking down who is writing
- *                          after we've saved the state.
+ * @param   enmOrigin       Who is calling.
  *
  * @thread  Any but EMTs.
  */
-VMMDECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, const char *pszWho)
+VMMDECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite, PGMACCESSORIGIN enmOrigin)
 {
     VM_ASSERT_OTHER_THREAD(pVM);
 
     AssertMsg(!pVM->pgm.s.fNoMorePhysWrites,
-              ("Calling PGMR3PhysWriteExternal after pgmR3Save()! GCPhys=%RGp cbWrite=%#x pszWho=%s\n",
-               GCPhys, cbWrite, pszWho));
+              ("Calling PGMR3PhysWriteExternal after pgmR3Save()! GCPhys=%RGp cbWrite=%#x enmOrigin=%d\n",
+               GCPhys, cbWrite, enmOrigin));
     AssertMsgReturn(cbWrite > 0, ("don't even think about writing zero bytes!\n"), VINF_SUCCESS);
     LogFlow(("PGMR3PhysWriteExternal: %RGp %d\n", GCPhys, cbWrite));
 
@@ -292,8 +288,8 @@ VMMDECL(int) PGMR3PhysWriteExternal(PVM pVM, RTGCPHYS GCPhys, const void *pvBuf,
                     {
                         pgmUnlock(pVM);
 
-                        return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysWriteExternalEMT, 4,
-                                                       pVM, &GCPhys, pvBuf, cbWrite);
+                        return VMR3ReqPriorityCallWait(pVM, VMCPUID_ANY, (PFNRT)pgmR3PhysWriteExternalEMT, 5,
+                                                       pVM, &GCPhys, pvBuf, cbWrite, enmOrigin);
                     }
                 }
                 Assert(!PGM_PAGE_IS_MMIO_OR_SPECIAL_ALIAS(pPage));
@@ -1568,7 +1564,9 @@ static int pgmR3PhysRegisterHighRamChunk(PVM pVM, RTGCPHYS GCPhys, uint32_t cRam
     RTR0PTR      R0PtrChunk   = NIL_RTR0PTR;
     void        *pvChunk      = NULL;
     int rc = SUPR3PageAllocEx(cChunkPages, 0 /*fFlags*/, &pvChunk,
-#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
+#if defined(VBOX_WITH_MORE_RING0_MEM_MAPPINGS)
+                              &R0PtrChunk,
+#elif defined(VBOX_WITH_2X_4GB_ADDR_SPACE)
                               HMIsEnabled(pVM) ? &R0PtrChunk : NULL,
 #else
                               NULL,
@@ -1576,7 +1574,9 @@ static int pgmR3PhysRegisterHighRamChunk(PVM pVM, RTGCPHYS GCPhys, uint32_t cRam
                               paChunkPages);
     if (RT_SUCCESS(rc))
     {
-#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
+#if defined(VBOX_WITH_MORE_RING0_MEM_MAPPINGS)
+        Assert(R0PtrChunk != NIL_RTR0PTR);
+#elif defined(VBOX_WITH_2X_4GB_ADDR_SPACE)
         if (!HMIsEnabled(pVM))
             R0PtrChunk = NIL_RTR0PTR;
 #else
@@ -2167,19 +2167,14 @@ int pgmR3PhysRamTerm(PVM pVM)
  * @param   pVM             Pointer to the VM.
  * @param   GCPhys          The start of the MMIO region.
  * @param   cb              The size of the MMIO region.
- * @param   pfnHandlerR3    The address of the ring-3 handler. (IOMR3MMIOHandler)
+ * @param   hType           The physical access handler type registration.
  * @param   pvUserR3        The user argument for R3.
- * @param   pfnHandlerR0    The address of the ring-0 handler. (IOMMMIOHandler)
  * @param   pvUserR0        The user argument for R0.
- * @param   pfnHandlerRC    The address of the RC handler. (IOMMMIOHandler)
  * @param   pvUserRC        The user argument for RC.
  * @param   pszDesc         The description of the MMIO region.
  */
-VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb,
-                                     R3PTRTYPE(PFNPGMR3PHYSHANDLER) pfnHandlerR3, RTR3PTR pvUserR3,
-                                     R0PTRTYPE(PFNPGMR0PHYSHANDLER) pfnHandlerR0, RTR0PTR pvUserR0,
-                                     RCPTRTYPE(PFNPGMRCPHYSHANDLER) pfnHandlerRC, RTRCPTR pvUserRC,
-                                     R3PTRTYPE(const char *) pszDesc)
+VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, PGMPHYSHANDLERTYPE hType,
+                                     RTR3PTR pvUserR3, RTR0PTR pvUserR0, RTRCPTR pvUserRC, const char *pszDesc)
 {
     /*
      * Assert on some assumption.
@@ -2189,6 +2184,7 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb,
     AssertReturn(!(GCPhys & PAGE_OFFSET_MASK), VERR_INVALID_PARAMETER);
     AssertPtrReturn(pszDesc, VERR_INVALID_POINTER);
     AssertReturn(*pszDesc, VERR_INVALID_PARAMETER);
+    Assert(((PPGMPHYSHANDLERTYPEINT)MMHyperHeapOffsetToPtr(pVM, hType))->enmKind == PGMPHYSHANDLERKIND_MMIO);
 
     int rc = pgmLock(pVM);
     AssertRCReturn(rc, rc);
@@ -2301,10 +2297,7 @@ VMMR3DECL(int) PGMR3PhysMMIORegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb,
     /*
      * Register the access handler.
      */
-    rc = PGMHandlerPhysicalRegisterEx(pVM, PGMPHYSHANDLERTYPE_MMIO, GCPhys, GCPhysLast,
-                                      pfnHandlerR3, pvUserR3,
-                                      pfnHandlerR0, pvUserR0,
-                                      pfnHandlerRC, pvUserRC, pszDesc);
+    rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, hType, pvUserR3, pvUserR0, pvUserRC, pszDesc);
     if (    RT_FAILURE(rc)
         &&  !fRamExists)
     {
@@ -2476,7 +2469,7 @@ DECLINLINE(PPGMMMIO2RANGE) pgmR3PhysMMIO2Find(PVM pVM, PPDMDEVINS pDevIns, uint3
  * A MMIO2 range may overlap with base memory if a lot of RAM is configured for
  * the VM, in which case we'll drop the base memory pages.  Presently we will
  * make no attempt to preserve anything that happens to be present in the base
- * memory that is replaced, this is of course incorrectly but it's too much
+ * memory that is replaced, this is of course incorrect but it's too much
  * effort.
  *
  * @returns VBox status code.
@@ -2746,6 +2739,8 @@ VMMR3DECL(int) PGMR3PhysMMIO2Deregister(PVM pVM, PPDMDEVINS pDevIns, uint32_t iR
  *
  * @param   pVM             Pointer to the VM.
  * @param   pDevIns         The device instance owning the region.
+ * @param   iRegion         The index of the registered region.
+ * @param   GCPhys          The guest-physical address to be remapped.
  */
 VMMR3DECL(int) PGMR3PhysMMIO2Map(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS GCPhys)
 {
@@ -2839,6 +2834,8 @@ VMMR3DECL(int) PGMR3PhysMMIO2Map(PVM pVM, PPDMDEVINS pDevIns, uint32_t iRegion,
             AssertLogRelRCReturn(rc, rc); /* We're done for if this goes wrong. */
 
             RTHCPHYS const HCPhys = PGM_PAGE_GET_HCPHYS(pPageSrc);
+            uint32_t const idPage = PGM_PAGE_GET_PAGEID(pPageSrc);
+            PGM_PAGE_SET_PAGEID(pVM, pPageDst, idPage);
             PGM_PAGE_SET_HCPHYS(pVM, pPageDst, HCPhys);
             PGM_PAGE_SET_TYPE(pVM, pPageDst, PGMPAGETYPE_MMIO2);
             PGM_PAGE_SET_STATE(pVM, pPageDst, PGM_PAGE_STATE_ALLOCATED);
@@ -3329,17 +3326,15 @@ static int pgmR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys, RT
 #ifdef VBOX_WITH_REM
                 REMR3NotifyPhysRomRegister(pVM, GCPhys, cb, NULL, true /* fShadowed */);
 #endif
-                rc = PGMR3HandlerPhysicalRegister(pVM, PGMPHYSHANDLERTYPE_PHYSICAL_WRITE, GCPhys, GCPhysLast,
-                                                  pgmR3PhysRomWriteHandler, pRomNew,
-                                                  NULL, "pgmPhysRomWriteHandler", MMHyperCCToR0(pVM, pRomNew),
-                                                  NULL, "pgmPhysRomWriteHandler", MMHyperCCToRC(pVM, pRomNew), pszDesc);
+                rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, pVM->pgm.s.hRomPhysHandlerType,
+                                                pRomNew, MMHyperCCToR0(pVM, pRomNew), MMHyperCCToRC(pVM, pRomNew),
+                                                pszDesc);
             }
             else
             {
-                rc = PGMR3HandlerPhysicalRegister(pVM, PGMPHYSHANDLERTYPE_PHYSICAL_WRITE, GCPhys, GCPhysLast,
-                                                  pgmR3PhysRomWriteHandler, pRomNew,
-                                                  NULL, "pgmPhysRomWriteHandler", MMHyperCCToR0(pVM, pRomNew),
-                                                  NULL, "pgmPhysRomWriteHandler", MMHyperCCToRC(pVM, pRomNew), pszDesc);
+                rc = PGMHandlerPhysicalRegister(pVM, GCPhys, GCPhysLast, pVM->pgm.s.hRomPhysHandlerType,
+                                                pRomNew, MMHyperCCToR0(pVM, pRomNew), MMHyperCCToRC(pVM, pRomNew),
+                                                pszDesc);
 #ifdef VBOX_WITH_REM
                 REMR3NotifyPhysRomRegister(pVM, GCPhys, cb, NULL, false /* fShadowed */);
 #endif
@@ -3501,107 +3496,6 @@ VMMR3DECL(int) PGMR3PhysRomRegister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhys
 
 
 /**
- * \#PF Handler callback for ROM write accesses.
- *
- * @returns VINF_SUCCESS if the handler have carried out the operation.
- * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
- * @param   pVM             Pointer to the VM.
- * @param   GCPhys          The physical address the guest is writing to.
- * @param   pvPhys          The HC mapping of that address.
- * @param   pvBuf           What the guest is reading/writing.
- * @param   cbBuf           How much it's reading/writing.
- * @param   enmAccessType   The access type.
- * @param   pvUser          User argument.
- */
-static DECLCALLBACK(int) pgmR3PhysRomWriteHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
-                                                  PGMACCESSTYPE enmAccessType, void *pvUser)
-{
-    PPGMROMRANGE    pRom     = (PPGMROMRANGE)pvUser;
-    const uint32_t  iPage    = (GCPhys - pRom->GCPhys) >> PAGE_SHIFT;
-    Assert(iPage < (pRom->cb >> PAGE_SHIFT));
-    PPGMROMPAGE     pRomPage = &pRom->aPages[iPage];
-    Log5(("pgmR3PhysRomWriteHandler: %d %c %#08RGp %#04zx\n", pRomPage->enmProt, enmAccessType == PGMACCESSTYPE_READ ? 'R' : 'W', GCPhys, cbBuf));
-    NOREF(pvPhys);
-
-    if (enmAccessType == PGMACCESSTYPE_READ)
-    {
-        switch (pRomPage->enmProt)
-        {
-            /*
-             * Take the default action.
-             */
-            case PGMROMPROT_READ_ROM_WRITE_IGNORE:
-            case PGMROMPROT_READ_RAM_WRITE_IGNORE:
-            case PGMROMPROT_READ_ROM_WRITE_RAM:
-            case PGMROMPROT_READ_RAM_WRITE_RAM:
-                return VINF_PGM_HANDLER_DO_DEFAULT;
-
-            default:
-                AssertMsgFailedReturn(("enmProt=%d iPage=%d GCPhys=%RGp\n",
-                                       pRom->aPages[iPage].enmProt, iPage, GCPhys),
-                                      VERR_IPE_NOT_REACHED_DEFAULT_CASE);
-        }
-    }
-    else
-    {
-        Assert(enmAccessType == PGMACCESSTYPE_WRITE);
-        switch (pRomPage->enmProt)
-        {
-            /*
-             * Ignore writes.
-             */
-            case PGMROMPROT_READ_ROM_WRITE_IGNORE:
-            case PGMROMPROT_READ_RAM_WRITE_IGNORE:
-                return VINF_SUCCESS;
-
-            /*
-             * Write to the RAM page.
-             */
-            case PGMROMPROT_READ_ROM_WRITE_RAM:
-            case PGMROMPROT_READ_RAM_WRITE_RAM: /* yes this will get here too, it's *way* simpler that way. */
-            {
-                /* This should be impossible now, pvPhys doesn't work cross page anylonger. */
-                Assert(((GCPhys - pRom->GCPhys + cbBuf - 1) >> PAGE_SHIFT) == iPage);
-
-                /*
-                 * Take the lock, do lazy allocation, map the page and copy the data.
-                 *
-                 * Note that we have to bypass the mapping TLB since it works on
-                 * guest physical addresses and entering the shadow page would
-                 * kind of screw things up...
-                 */
-                int rc = pgmLock(pVM);
-                AssertRC(rc);
-
-                PPGMPAGE pShadowPage = &pRomPage->Shadow;
-                if (!PGMROMPROT_IS_ROM(pRomPage->enmProt))
-                {
-                    pShadowPage = pgmPhysGetPage(pVM, GCPhys);
-                    AssertLogRelReturn(pShadowPage, VERR_PGM_PHYS_PAGE_GET_IPE);
-                }
-
-                void *pvDstPage;
-                rc = pgmPhysPageMakeWritableAndMap(pVM, pShadowPage, GCPhys & X86_PTE_PG_MASK, &pvDstPage);
-                if (RT_SUCCESS(rc))
-                {
-                    memcpy((uint8_t *)pvDstPage + (GCPhys & PAGE_OFFSET_MASK), pvBuf, cbBuf);
-                    pRomPage->LiveSave.fWrittenTo = true;
-                }
-
-                pgmUnlock(pVM);
-                return rc;
-            }
-
-            default:
-                AssertMsgFailedReturn(("enmProt=%d iPage=%d GCPhys=%RGp\n",
-                                       pRom->aPages[iPage].enmProt, iPage, GCPhys),
-                                      VERR_IPE_NOT_REACHED_DEFAULT_CASE);
-        }
-    }
-}
-
-
-/**
  * Called by PGMR3MemSetup to reset the shadow, switch to the virgin, and verify
  * that the virgin part is untouched.
  *
@@ -4042,7 +3936,7 @@ static DECLCALLBACK(VBOXSTRICTRC) pgmR3PhysUnmapChunkRendezvous(PVM pVM, PVMCPU
                 /*
                  * Flush dangling PGM pointers (R3 & R0 ptrs to GC physical addresses).
                  */
-                /** todo: we should not flush chunks which include cr3 mappings. */
+                /** @todo We should not flush chunks which include cr3 mappings. */
                 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
                 {
                     PPGMCPU pPGM = &pVM->aCpus[idCpu].pgm.s;
diff --git a/src/VBox/VMM/VMMR3/PGMPhysRWTmpl.h b/src/VBox/VMM/VMMR3/PGMPhysRWTmpl.h
index 790e9f0..88712fe 100644
--- a/src/VBox/VMM/VMMR3/PGMPhysRWTmpl.h
+++ b/src/VBox/VMM/VMMR3/PGMPhysRWTmpl.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,12 +24,13 @@
  *
  * @param   pVM             Pointer to the VM.
  * @param   GCPhys          Physical address start reading from.
+ * @param   enmOrigin       Who is calling.
  */
-VMMDECL(PGMPHYS_DATATYPE) PGMPHYSFN_READNAME(PVM pVM, RTGCPHYS GCPhys)
+VMMDECL(PGMPHYS_DATATYPE) PGMPHYSFN_READNAME(PVM pVM, RTGCPHYS GCPhys, PGMACCESSORIGIN enmOrigin)
 {
     Assert(VM_IS_EMT(pVM));
     PGMPHYS_DATATYPE val;
-    PGMPhysRead(pVM, GCPhys, &val, sizeof(val));
+    PGMPhysRead(pVM, GCPhys, &val, sizeof(val), enmOrigin);
     return val;
 }
 
@@ -43,11 +44,12 @@ VMMDECL(PGMPHYS_DATATYPE) PGMPHYSFN_READNAME(PVM pVM, RTGCPHYS GCPhys)
  * @param   pVM             Pointer to the VM.
  * @param   GCPhys          Physical address to write to.
  * @param   val             What to write.
+ * @param   enmOrigin       Who is calling.
  */
-VMMDECL(void) PGMPHYSFN_WRITENAME(PVM pVM, RTGCPHYS GCPhys, PGMPHYS_DATATYPE val)
+VMMDECL(void) PGMPHYSFN_WRITENAME(PVM pVM, RTGCPHYS GCPhys, PGMPHYS_DATATYPE val, PGMACCESSORIGIN enmOrigin)
 {
     Assert(VM_IS_EMT(pVM));
-    PGMPhysWrite(pVM, GCPhys, &val, sizeof(val));
+    PGMPhysWrite(pVM, GCPhys, &val, sizeof(val), enmOrigin);
 }
 
 #undef PGMPHYSFN_READNAME
diff --git a/src/VBox/VMM/VMMR3/PGMPool.cpp b/src/VBox/VMM/VMMR3/PGMPool.cpp
index 6afc27e..89a14c9 100644
--- a/src/VBox/VMM/VMMR3/PGMPool.cpp
+++ b/src/VBox/VMM/VMMR3/PGMPool.cpp
@@ -113,7 +113,6 @@
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-static DECLCALLBACK(int) pgmR3PoolAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
 #ifdef VBOX_WITH_DEBUGGER
 static FNDBGCCMD pgmR3PoolCmdCheck;
 #endif
@@ -173,7 +172,7 @@ int pgmR3PoolInit(PVM pVM)
     cMaxPages = RT_ALIGN(cMaxPages, 16);
     if (cMaxPages > PGMPOOL_IDX_LAST)
         cMaxPages = PGMPOOL_IDX_LAST;
-    LogRel(("PGMPool: cMaxPages=%u (u64MaxPages=%llu)\n", cMaxPages, u64MaxPages));
+    LogRel(("PGM: PGMPool: cMaxPages=%u (u64MaxPages=%llu)\n", cMaxPages, u64MaxPages));
 
     /** todo:
      * We need to be much more careful with our allocation strategy here.
@@ -219,7 +218,7 @@ int pgmR3PoolInit(PVM pVM)
     rc = CFGMR3QueryBoolDef(pCfg, "CacheEnabled", &fCacheEnabled, true);
     AssertLogRelRCReturn(rc, rc);
 
-    LogRel(("pgmR3PoolInit: cMaxPages=%#RX16 cMaxUsers=%#RX16 cMaxPhysExts=%#RX16 fCacheEnable=%RTbool\n",
+    LogRel(("PGM: pgmR3PoolInit: cMaxPages=%#RX16 cMaxUsers=%#RX16 cMaxPhysExts=%#RX16 fCacheEnable=%RTbool\n",
              cMaxPages, cMaxUsers, cMaxPhysExts, fCacheEnabled));
 
     /*
@@ -279,8 +278,16 @@ int pgmR3PoolInit(PVM pVM)
     pPool->iAgeHead = NIL_PGMPOOL_IDX;
     pPool->iAgeTail = NIL_PGMPOOL_IDX;
     pPool->fCacheEnabled = fCacheEnabled;
-    pPool->pfnAccessHandlerR3 = pgmR3PoolAccessHandler;
-    pPool->pszAccessHandler = "Guest Paging Access Handler";
+
+    pPool->hAccessHandlerType = NIL_PGMPHYSHANDLERTYPE;
+    rc = PGMR3HandlerPhysicalTypeRegister(pVM, PGMPHYSHANDLERKIND_WRITE,
+                                          pgmPoolAccessHandler,
+                                          NULL, "pgmPoolAccessPfHandler",
+                                          NULL, "pgmPoolAccessPfHandler",
+                                          "Guest Paging Access Handler",
+                                          &pPool->hAccessHandlerType);
+    AssertLogRelRCReturn(rc, rc);
+
     pPool->HCPhysTree = 0;
 
     /*
@@ -410,19 +417,6 @@ void pgmR3PoolRelocate(PVM pVM)
     pVM->pgm.s.pPoolR3->pVMRC = pVM->pVMRC;
     pVM->pgm.s.pPoolR3->paUsersRC = MMHyperR3ToRC(pVM, pVM->pgm.s.pPoolR3->paUsersR3);
     pVM->pgm.s.pPoolR3->paPhysExtsRC = MMHyperR3ToRC(pVM, pVM->pgm.s.pPoolR3->paPhysExtsR3);
-
-    if (!HMIsEnabled(pVM))
-    {
-        int rc = PDMR3LdrGetSymbolRC(pVM, NULL, "pgmPoolAccessHandler", &pVM->pgm.s.pPoolR3->pfnAccessHandlerRC);
-        AssertReleaseRC(rc);
-    }
-
-    /* init order hack. */
-    if (!pVM->pgm.s.pPoolR3->pfnAccessHandlerR0)
-    {
-        int rc = PDMR3LdrGetSymbolR0(pVM, NULL, "pgmPoolAccessHandler", &pVM->pgm.s.pPoolR3->pfnAccessHandlerR0);
-        AssertReleaseRC(rc);
-    }
 }
 
 
@@ -495,119 +489,6 @@ VMMR3DECL(int) PGMR3PoolGrow(PVM pVM)
 }
 
 
-
-/**
- * Worker used by pgmR3PoolAccessHandler when it's invoked by an async thread.
- *
- * @param   pPool   The pool.
- * @param   pPage   The page.
- */
-static DECLCALLBACK(void) pgmR3PoolFlushReusedPage(PPGMPOOL pPool, PPGMPOOLPAGE pPage)
-{
-    /* for the present this should be safe enough I think... */
-    pgmLock(pPool->pVMR3);
-    if (    pPage->fReusedFlushPending
-        &&  pPage->enmKind != PGMPOOLKIND_FREE)
-        pgmPoolFlushPage(pPool, pPage);
-    pgmUnlock(pPool->pVMR3);
-}
-
-
-/**
- * \#PF Handler callback for PT write accesses.
- *
- * The handler can not raise any faults, it's mainly for monitoring write access
- * to certain pages.
- *
- * @returns VINF_SUCCESS if the handler has carried out the operation.
- * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
- * @param   pVM             Pointer to the VM.
- * @param   GCPhys          The physical address the guest is writing to.
- * @param   pvPhys          The HC mapping of that address.
- * @param   pvBuf           What the guest is reading/writing.
- * @param   cbBuf           How much it's reading/writing.
- * @param   enmAccessType   The access type.
- * @param   pvUser          User argument.
- */
-static DECLCALLBACK(int) pgmR3PoolAccessHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
-                                                PGMACCESSTYPE enmAccessType, void *pvUser)
-{
-    STAM_PROFILE_START(&pVM->pgm.s.pPoolR3->StatMonitorR3, a);
-    PPGMPOOL        pPool = pVM->pgm.s.pPoolR3;
-    PPGMPOOLPAGE    pPage = (PPGMPOOLPAGE)pvUser;
-    PVMCPU          pVCpu = VMMGetCpu(pVM);
-    LogFlow(("pgmR3PoolAccessHandler: GCPhys=%RGp %p:{.Core=%RHp, .idx=%d, .GCPhys=%RGp, .enmType=%d}\n",
-             GCPhys, pPage, pPage->Core.Key, pPage->idx, pPage->GCPhys, pPage->enmKind));
-
-    NOREF(pvBuf); NOREF(enmAccessType);
-
-    /*
-     * We don't have to be very sophisticated about this since there are relativly few calls here.
-     * However, we must try our best to detect any non-cpu accesses (disk / networking).
-     *
-     * Just to make life more interesting, we'll have to deal with the async threads too.
-     * We cannot flush a page if we're in an async thread because of REM notifications.
-     */
-    pgmLock(pVM);
-    if (PHYS_PAGE_ADDRESS(GCPhys) != PHYS_PAGE_ADDRESS(pPage->GCPhys))
-    {
-        /* Pool page changed while we were waiting for the lock; ignore. */
-        Log(("CPU%d: pgmR3PoolAccessHandler pgm pool page for %RGp changed (to %RGp) while waiting!\n", pVCpu->idCpu, PHYS_PAGE_ADDRESS(GCPhys), PHYS_PAGE_ADDRESS(pPage->GCPhys)));
-        pgmUnlock(pVM);
-        return VINF_PGM_HANDLER_DO_DEFAULT;
-    }
-
-    Assert(pPage->enmKind != PGMPOOLKIND_FREE);
-
-    /* @todo this code doesn't make any sense. remove the if (!pVCpu) block */
-    if (!pVCpu) /** @todo This shouldn't happen any longer, all access handlers will be called on an EMT. All ring-3 handlers, except MMIO, already own the PGM lock. @bugref{3170} */
-    {
-        Log(("pgmR3PoolAccessHandler: async thread, requesting EMT to flush the page: %p:{.Core=%RHp, .idx=%d, .GCPhys=%RGp, .enmType=%d}\n",
-             pPage, pPage->Core.Key, pPage->idx, pPage->GCPhys, pPage->enmKind));
-        STAM_COUNTER_INC(&pPool->StatMonitorR3Async);
-        if (!pPage->fReusedFlushPending)
-        {
-            pgmUnlock(pVM);
-            int rc = VMR3ReqCallVoidNoWait(pPool->pVMR3, VMCPUID_ANY, (PFNRT)pgmR3PoolFlushReusedPage, 2, pPool, pPage);
-            AssertRCReturn(rc, rc);
-            pgmLock(pVM);
-            pPage->fReusedFlushPending = true;
-            pPage->cModifications += 0x1000;
-        }
-
-        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhys, pvPhys, 0 /* unknown write size */);
-        /** @todo r=bird: making unsafe assumption about not crossing entries here! */
-        while (cbBuf > 4)
-        {
-            cbBuf -= 4;
-            pvPhys = (uint8_t *)pvPhys + 4;
-            GCPhys += 4;
-            pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhys, pvPhys, 0 /* unknown write size */);
-        }
-        STAM_PROFILE_STOP(&pPool->StatMonitorR3, a);
-    }
-    else if (    (   pPage->cModifications < 96 /* it's cheaper here. */
-                  || pgmPoolIsPageLocked(pPage)
-                  )
-             &&  cbBuf <= 4)
-    {
-        /* Clear the shadow entry. */
-        if (!pPage->cModifications++)
-            pgmPoolMonitorModifiedInsert(pPool, pPage);
-        /** @todo r=bird: making unsafe assumption about not crossing entries here! */
-        pgmPoolMonitorChainChanging(pVCpu, pPool, pPage, GCPhys, pvPhys, 0 /* unknown write size */);
-        STAM_PROFILE_STOP(&pPool->StatMonitorR3, a);
-    }
-    else
-    {
-        pgmPoolMonitorChainFlush(pPool, pPage); /* ASSUME that VERR_PGM_POOL_CLEARED can be ignored here and that FFs will deal with it in due time. */
-        STAM_PROFILE_STOP_EX(&pPool->StatMonitorR3, &pPool->StatMonitorR3FlushPage, a);
-    }
-    pgmUnlock(pVM);
-    return VINF_PGM_HANDLER_DO_DEFAULT;
-}
-
-
 /**
  * Rendezvous callback used by pgmR3PoolClearAll that clears all shadow pages
  * and all modification counters.
diff --git a/src/VBox/VMM/VMMR3/SELM.cpp b/src/VBox/VMM/VMMR3/SELM.cpp
index 1504a37..0590ad8 100644
--- a/src/VBox/VMM/VMMR3/SELM.cpp
+++ b/src/VBox/VMM/VMMR3/SELM.cpp
@@ -94,9 +94,9 @@
 static DECLCALLBACK(int)  selmR3Save(PVM pVM, PSSMHANDLE pSSM);
 static DECLCALLBACK(int)  selmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
 static DECLCALLBACK(int)  selmR3LoadDone(PVM pVM, PSSMHANDLE pSSM);
-static DECLCALLBACK(int)  selmR3GuestGDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
-static DECLCALLBACK(int)  selmR3GuestLDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
-static DECLCALLBACK(int)  selmR3GuestTSSWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPhys, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
+static FNPGMR3VIRTHANDLER selmR3GuestGDTWriteHandler;
+static FNPGMR3VIRTHANDLER selmR3GuestLDTWriteHandler;
+static FNPGMR3VIRTHANDLER selmR3GuestTSSWriteHandler;
 static DECLCALLBACK(void) selmR3InfoGdt(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
 static DECLCALLBACK(void) selmR3InfoGdtGuest(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
 static DECLCALLBACK(void) selmR3InfoLdt(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
@@ -188,6 +188,57 @@ VMMR3DECL(int) SELMR3Init(PVM pVM)
     memset(pVM->selm.s.Tss.IntRedirBitmap, 0xff, sizeof(pVM->selm.s.Tss.IntRedirBitmap));
 
     /*
+     * Register the virtual access handlers.
+     */
+    pVM->selm.s.hShadowGdtWriteHandlerType = NIL_PGMVIRTHANDLERTYPE;
+    pVM->selm.s.hShadowLdtWriteHandlerType = NIL_PGMVIRTHANDLERTYPE;
+    pVM->selm.s.hShadowTssWriteHandlerType = NIL_PGMVIRTHANDLERTYPE;
+    pVM->selm.s.hGuestGdtWriteHandlerType  = NIL_PGMVIRTHANDLERTYPE;
+    pVM->selm.s.hGuestLdtWriteHandlerType  = NIL_PGMVIRTHANDLERTYPE;
+    pVM->selm.s.hGuestTssWriteHandlerType  = NIL_PGMVIRTHANDLERTYPE;
+#ifdef VBOX_WITH_RAW_MODE
+    if (!HMIsEnabled(pVM))
+    {
+# ifdef SELM_TRACK_SHADOW_GDT_CHANGES
+        rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_HYPERVISOR, false /*fRelocUserRC*/,
+                                             NULL /*pfnInvalidateR3*/, NULL /*pfnHandlerR3*/,
+                                             "selmRCShadowGDTWritePfHandler",
+                                             "Shadow GDT write access handler", &pVM->selm.s.hShadowGdtWriteHandlerType);
+        AssertRCReturn(rc, rc);
+# endif
+# ifdef SELM_TRACK_SHADOW_TSS_CHANGES
+        rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_HYPERVISOR, false /*fRelocUserRC*/,
+                                             NULL /*pfnInvalidateR3*/, NULL /*pfnHandlerR3*/,
+                                             "selmRCShadowTSSWritePfHandler",
+                                             "Shadow TSS write access handler", &pVM->selm.s.hShadowTssWriteHandlerType);
+        AssertRCReturn(rc, rc);
+# endif
+# ifdef SELM_TRACK_SHADOW_LDT_CHANGES
+        rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_HYPERVISOR, false /*fRelocUserRC*/,
+                                             NULL /*pfnInvalidateR3*/, NULL /*pfnHandlerR3*/,
+                                             "selmRCShadowLDTWritePfHandler",
+                                             "Shadow LDT write access handler", &pVM->selm.s.hShadowLdtWriteHandlerType);
+        AssertRCReturn(rc, rc);
+# endif
+        rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_WRITE, false /*fRelocUserRC*/,
+                                             NULL /*pfnInvalidateR3*/, selmR3GuestGDTWriteHandler,
+                                             "selmRCGuestGDTWritePfHandler",
+                                             "Guest GDT write access handler", &pVM->selm.s.hGuestGdtWriteHandlerType);
+        AssertRCReturn(rc, rc);
+        rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_WRITE, false /*fRelocUserRC*/,
+                                             NULL /*pfnInvalidateR3*/, selmR3GuestLDTWriteHandler,
+                                             "selmRCGuestLDTWritePfHandler",
+                                             "Guest LDT write access handler", &pVM->selm.s.hGuestLdtWriteHandlerType);
+        AssertRCReturn(rc, rc);
+        rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_WRITE, false /*fRelocUserRC*/,
+                                             NULL /*pfnInvalidateR3*/, selmR3GuestTSSWriteHandler,
+                                             "selmRCGuestTSSWritePfHandler",
+                                             "Guest TSS write access handler", &pVM->selm.s.hGuestTssWriteHandlerType);
+        AssertRCReturn(rc, rc);
+    }
+#endif /* VBOX_WITH_RAW_MODE */
+
+    /*
      * Register the saved state data unit.
      */
     rc = SSMR3RegisterInternal(pVM, "selm", 1, SELM_SAVED_STATE_VERSION, sizeof(SELM),
@@ -498,29 +549,32 @@ VMMR3DECL(void) SELMR3Relocate(PVM pVM)
         /*
          * Update shadow GDT/LDT/TSS write access handlers.
          */
+        PVMCPU pVCpu = VMMGetCpu(pVM); NOREF(pVCpu);
         int rc; NOREF(rc);
 #ifdef SELM_TRACK_SHADOW_GDT_CHANGES
         if (pVM->selm.s.paGdtRC != NIL_RTRCPTR)
         {
-            rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.paGdtRC);
+            rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.paGdtRC, true /*fHypervisor*/);
             AssertRC(rc);
         }
         pVM->selm.s.paGdtRC = MMHyperR3ToRC(pVM, paGdt);
-        rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_HYPERVISOR, pVM->selm.s.paGdtRC,
+        rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->selm.s.hShadowGdtWriteHandlerType,
+                                         pVM->selm.s.paGdtRC,
                                          pVM->selm.s.paGdtRC + SELM_GDT_ELEMENTS * sizeof(paGdt[0]) - 1,
-                                         0, 0, "selmRCShadowGDTWriteHandler", 0, "Shadow GDT write access handler");
+                                         NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
         AssertRC(rc);
 #endif
 #ifdef SELM_TRACK_SHADOW_TSS_CHANGES
         if (pVM->selm.s.pvMonShwTssRC != RTRCPTR_MAX)
         {
-            rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.pvMonShwTssRC);
+            rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.pvMonShwTssRC, true /*fHypervisor*/);
             AssertRC(rc);
         }
         pVM->selm.s.pvMonShwTssRC = VM_RC_ADDR(pVM, &pVM->selm.s.Tss);
-        rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_HYPERVISOR, pVM->selm.s.pvMonShwTssRC,
+        rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->selm.s.hShadowTssWriteHandlerType,
+                                         pVM->selm.s.pvMonShwTssRC,
                                          pVM->selm.s.pvMonShwTssRC + sizeof(pVM->selm.s.Tss) - 1,
-                                         0, 0, "selmRCShadowTSSWriteHandler", 0, "Shadow TSS write access handler");
+                                         NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
         AssertRC(rc);
 #endif
 
@@ -530,15 +584,16 @@ VMMR3DECL(void) SELMR3Relocate(PVM pVM)
 #ifdef SELM_TRACK_SHADOW_LDT_CHANGES
         if (pVM->selm.s.pvLdtRC != RTRCPTR_MAX)
         {
-            rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.pvLdtRC);
+            rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.pvLdtRC, true /*fHypervisor*/);
             AssertRC(rc);
         }
 #endif
         pVM->selm.s.pvLdtRC = MMHyperR3ToRC(pVM, pVM->selm.s.pvLdtR3);
 #ifdef SELM_TRACK_SHADOW_LDT_CHANGES
-        rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_HYPERVISOR, pVM->selm.s.pvLdtRC,
+        rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->selm.s.hShadowLdtWriteHandlerType,
+                                         pVM->selm.s.pvLdtRC,
                                          pVM->selm.s.pvLdtRC + _64K + PAGE_SIZE - 1,
-                                         0, 0, "selmRCShadowLDTWriteHandler", 0, "Shadow LDT write access handler");
+                                         NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
         AssertRC(rc);
 #endif
     }
@@ -577,11 +632,12 @@ VMMR3DECL(void) SELMR3Reset(PVM pVM)
     /*
      * Uninstall guest GDT/LDT/TSS write access handlers.
      */
+    PVMCPU pVCpu = VMMGetCpu(pVM); NOREF(pVCpu);
     int rc = VINF_SUCCESS;
     if (pVM->selm.s.GuestGdtr.pGdt != RTRCPTR_MAX && pVM->selm.s.fGDTRangeRegistered)
     {
 #ifdef SELM_TRACK_GUEST_GDT_CHANGES
-        rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.GuestGdtr.pGdt);
+        rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.GuestGdtr.pGdt, false /*fHypervisor*/);
         AssertRC(rc);
 #endif
         pVM->selm.s.GuestGdtr.pGdt = RTRCPTR_MAX;
@@ -591,7 +647,7 @@ VMMR3DECL(void) SELMR3Reset(PVM pVM)
     if (pVM->selm.s.GCPtrGuestLdt != RTRCPTR_MAX)
     {
 #ifdef SELM_TRACK_GUEST_LDT_CHANGES
-        rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.GCPtrGuestLdt);
+        rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.GCPtrGuestLdt, false /*fHypervisor*/);
         AssertRC(rc);
 #endif
         pVM->selm.s.GCPtrGuestLdt = RTRCPTR_MAX;
@@ -599,7 +655,7 @@ VMMR3DECL(void) SELMR3Reset(PVM pVM)
     if (pVM->selm.s.GCPtrGuestTss != RTRCPTR_MAX)
     {
 #ifdef SELM_TRACK_GUEST_TSS_CHANGES
-        rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.GCPtrGuestTss);
+        rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.GCPtrGuestTss, false /*fHypervisor*/);
         AssertRC(rc);
 #endif
         pVM->selm.s.GCPtrGuestTss = RTRCPTR_MAX;
@@ -621,7 +677,6 @@ VMMR3DECL(void) SELMR3Reset(PVM pVM)
         /*
          * Default action when entering raw mode for the first time
          */
-        PVMCPU pVCpu = &pVM->aCpus[0];  /* raw mode implies on VCPU */
         VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS);
         VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT);
         VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT);
@@ -993,31 +1048,27 @@ static int selmR3UpdateShadowGdt(PVM pVM, PVMCPU pVCpu)
          */
         if (pVM->selm.s.GuestGdtr.pGdt != RTRCPTR_MAX && pVM->selm.s.fGDTRangeRegistered)
         {
-            rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.GuestGdtr.pGdt);
+            rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.GuestGdtr.pGdt, false /*fHypervisor*/);
             AssertRC(rc);
         }
-
-        rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE,
+        rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->selm.s.hGuestGdtWriteHandlerType,
                                          GDTR.pGdt, GDTR.pGdt + GDTR.cbGdt /* already inclusive */,
-                                         0, selmR3GuestGDTWriteHandler, "selmRCGuestGDTWriteHandler", 0,
-                                         "Guest GDT write access handler");
+                                         NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
 #  ifdef VBOX_WITH_RAW_RING1
         /** @todo !HACK ALERT!
          * Some guest OSes (QNX) share code and the GDT on the same page;
          * PGMR3HandlerVirtualRegister doesn't support more than one handler,
-         * so we kick out the  PATM handler as this one is more important.
-         * Fix this properly in PGMR3HandlerVirtualRegister?
+         * so we kick out the PATM handler as this one is more important. Fix this
+         * properly in PGMR3HandlerVirtualRegister?
          */
         if (rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT)
         {
             LogRel(("selmR3UpdateShadowGdt: Virtual handler conflict %RGv -> kick out PATM handler for the higher priority GDT page monitor\n", GDTR.pGdt));
-            rc = PGMHandlerVirtualDeregister(pVM, GDTR.pGdt & PAGE_BASE_GC_MASK);
+            rc = PGMHandlerVirtualDeregister(pVM, pVCpu, GDTR.pGdt & PAGE_BASE_GC_MASK, false /*fHypervisor*/);
             AssertRC(rc);
-
-            rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE,
+            rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->selm.s.hGuestGdtWriteHandlerType,
                                              GDTR.pGdt, GDTR.pGdt + GDTR.cbGdt /* already inclusive */,
-                                             0, selmR3GuestGDTWriteHandler, "selmRCGuestGDTWriteHandler", 0,
-                                             "Guest GDT write access handler");
+                                             NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
         }
 #  endif
         if (RT_FAILURE(rc))
@@ -1072,7 +1123,7 @@ static int selmR3UpdateShadowLdt(PVM pVM, PVMCPU pVCpu)
         CPUMSetHyperLDTR(pVCpu, 0);
         if (pVM->selm.s.GCPtrGuestLdt != RTRCPTR_MAX)
         {
-            rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.GCPtrGuestLdt);
+            rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.GCPtrGuestLdt, false /*fHypervisor*/);
             AssertRC(rc);
             pVM->selm.s.GCPtrGuestLdt = RTRCPTR_MAX;
         }
@@ -1105,7 +1156,7 @@ static int selmR3UpdateShadowLdt(PVM pVM, PVMCPU pVCpu)
         CPUMSetHyperLDTR(pVCpu, 0);
         if (pVM->selm.s.GCPtrGuestLdt != RTRCPTR_MAX)
         {
-            rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.GCPtrGuestLdt);
+            rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.GCPtrGuestLdt, false /*fHypervisor*/);
             AssertRC(rc);
             pVM->selm.s.GCPtrGuestLdt = RTRCPTR_MAX;
         }
@@ -1141,15 +1192,16 @@ static int selmR3UpdateShadowLdt(PVM pVM, PVMCPU pVCpu)
              */
             if (pVM->selm.s.GCPtrGuestLdt != RTRCPTR_MAX)
             {
-                rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.GCPtrGuestLdt);
+                rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.GCPtrGuestLdt, false /*fHypervisor*/);
                 AssertRC(rc);
             }
 #  ifdef LOG_ENABLED
             if (pDesc->Gen.u1Present)
                 Log(("LDT selector marked not present!!\n"));
 #  endif
-            rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, GCPtrLdt, GCPtrLdt + cbLdt /* already inclusive */,
-                                             0, selmR3GuestLDTWriteHandler, "selmRCGuestLDTWriteHandler", 0, "Guest LDT write access handler");
+            rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->selm.s.hGuestLdtWriteHandlerType,
+                                             GCPtrLdt, GCPtrLdt + cbLdt /* already inclusive */,
+                                             NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
             if (rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT)
             {
                 /** @todo investigate the various cases where conflicts happen and try avoid them by enh. the instruction emulation. */
@@ -1438,21 +1490,24 @@ VMMR3DECL(VBOXSTRICTRC) SELMR3UpdateFromCPUM(PVM pVM, PVMCPU pVCpu)
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPtr           The virtual address the guest is writing to. (not correct if it's an alias!)
  * @param   pvPtr           The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
- * @param   pvUser          User argument.
+ * @param   enmOrigin       Who is making this write.
+ * @param   pvUser          Unused.
  */
-static DECLCALLBACK(int) selmR3GuestGDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
-                                                    PGMACCESSTYPE enmAccessType, void *pvUser)
+static DECLCALLBACK(int) selmR3GuestGDTWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
+                                                    PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType);
     Log(("selmR3GuestGDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); NOREF(GCPtr); NOREF(cbBuf);
-    NOREF(pvPtr); NOREF(pvBuf); NOREF(pvUser);
+    NOREF(pvPtr); NOREF(pvBuf); NOREF(enmOrigin); NOREF(pvUser);
 
-    VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_SELM_SYNC_GDT);
+    VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_GDT);
     return VINF_PGM_HANDLER_DO_DEFAULT;
 }
 #endif
@@ -1467,21 +1522,24 @@ static DECLCALLBACK(int) selmR3GuestGDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPtr           The virtual address the guest is writing to. (not correct if it's an alias!)
  * @param   pvPtr           The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
- * @param   pvUser          User argument.
+ * @param   enmOrigin       Who is making this write.
+ * @param   pvUser          Unused.
  */
-static DECLCALLBACK(int) selmR3GuestLDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
-                                                    PGMACCESSTYPE enmAccessType, void *pvUser)
+static DECLCALLBACK(int) selmR3GuestLDTWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
+                                                    PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType);
     Log(("selmR3GuestLDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); NOREF(GCPtr); NOREF(cbBuf);
-    NOREF(pvPtr); NOREF(pvBuf); NOREF(pvUser);
+    NOREF(pvPtr); NOREF(pvBuf); NOREF(enmOrigin); NOREF(pvUser);
 
-    VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_SELM_SYNC_LDT);
+    VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT);
     return VINF_PGM_HANDLER_DO_DEFAULT;
 }
 #endif
@@ -1497,26 +1555,29 @@ static DECLCALLBACK(int) selmR3GuestLDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPtr           The virtual address the guest is writing to. (not correct if it's an alias!)
  * @param   pvPtr           The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
- * @param   pvUser          User argument.
+ * @param   enmOrigin       Who is making this write.
+ * @param   pvUser          Unused.
  */
-static DECLCALLBACK(int) selmR3GuestTSSWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
-                                                    PGMACCESSTYPE enmAccessType, void *pvUser)
+static DECLCALLBACK(int) selmR3GuestTSSWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
+                                                    PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType);
     Log(("selmR3GuestTSSWriteHandler: write %.*Rhxs to %RGv size %d\n", RT_MIN(8, cbBuf), pvBuf, GCPtr, cbBuf));
-    NOREF(pvBuf); NOREF(GCPtr); NOREF(cbBuf); NOREF(pvUser);NOREF(pvPtr);
+    NOREF(pvBuf); NOREF(GCPtr); NOREF(cbBuf); NOREF(enmOrigin); NOREF(pvUser); NOREF(pvPtr);
 
     /** @todo This can be optimized by checking for the ESP0 offset and tracking TR
      *        reloads in REM (setting VM_FF_SELM_SYNC_TSS if TR is reloaded). We
      *        should probably also deregister the virtual handler if TR.base/size
      *        changes while we're in REM. */
 
-    VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_SELM_SYNC_TSS);
+    VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_TSS);
     return VINF_PGM_HANDLER_DO_DEFAULT;
 }
 #endif
@@ -1702,7 +1763,7 @@ VMMR3DECL(int) SELMR3SyncTSS(PVM pVM, PVMCPU pVCpu)
         /* Release the old range first. */
         if (pVM->selm.s.GCPtrGuestTss != RTRCPTR_MAX)
         {
-            rc = PGMHandlerVirtualDeregister(pVM, pVM->selm.s.GCPtrGuestTss);
+            rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->selm.s.GCPtrGuestTss, false /*fHypervisor*/);
             AssertRC(rc);
         }
 
@@ -1710,9 +1771,9 @@ VMMR3DECL(int) SELMR3SyncTSS(PVM pVM, PVMCPU pVCpu)
         if (cbMonitoredTss != 0)
         {
 # ifdef SELM_TRACK_GUEST_TSS_CHANGES
-            rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, GCPtrTss, GCPtrTss + cbMonitoredTss - 1,
-                                             0, selmR3GuestTSSWriteHandler,
-                                             "selmRCGuestTSSWriteHandler", 0, "Guest TSS write access handler");
+            rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->selm.s.hGuestTssWriteHandlerType,
+                                             GCPtrTss, GCPtrTss + cbMonitoredTss - 1,
+                                             NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
             if (RT_FAILURE(rc))
             {
 #  ifdef VBOX_WITH_RAW_RING1
@@ -1725,12 +1786,12 @@ VMMR3DECL(int) SELMR3SyncTSS(PVM pVM, PVMCPU pVCpu)
                 if (rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT)
                 {
                     LogRel(("SELMR3SyncTSS: Virtual handler conflict %RGv -> kick out PATM handler for the higher priority TSS page monitor\n", GCPtrTss));
-                    rc = PGMHandlerVirtualDeregister(pVM, GCPtrTss & PAGE_BASE_GC_MASK);
+                    rc = PGMHandlerVirtualDeregister(pVM, pVCpu, GCPtrTss & PAGE_BASE_GC_MASK, false /*fHypervisor*/);
                     AssertRC(rc);
 
-                    rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, GCPtrTss, GCPtrTss + cbMonitoredTss - 1,
-                                                     0, selmR3GuestTSSWriteHandler,
-                                                     "selmRCGuestTSSWriteHandler", 0, "Guest TSS write access handler");
+                    rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->selm.s.hGuestTssWriteHandlerType,
+                                                     GCPtrTss, GCPtrTss + cbMonitoredTss - 1,
+                                                     NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
                     if (RT_FAILURE(rc))
                     {
                         STAM_PROFILE_STOP(&pVM->selm.s.StatUpdateFromCPUM, a);
diff --git a/src/VBox/VMM/VMMR3/SSM.cpp b/src/VBox/VMM/VMMR3/SSM.cpp
index 5d77327..f08cd77 100644
--- a/src/VBox/VMM/VMMR3/SSM.cpp
+++ b/src/VBox/VMM/VMMR3/SSM.cpp
@@ -1315,6 +1315,58 @@ SSMR3RegisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName, uint32_t u
 
 
 /**
+ * Register a PDM USB device data unit.
+ *
+ * @returns VBox status.
+ *
+ * @param   pVM             Pointer to the VM.
+ * @param   pUsbIns         USB instance.
+ * @param   pszName         Data unit name.
+ * @param   uInstance       The instance identifier of the data unit.
+ *                          This must together with the name be unique.
+ * @param   uVersion        Data layout version number.
+ * @param   cbGuess         The approximate amount of data in the unit.
+ *                          Only for progress indicators.
+ *
+ * @param   pfnLivePrep     Prepare live save callback, optional.
+ * @param   pfnLiveExec     Execute live save callback, optional.
+ * @param   pfnLiveVote     Vote live save callback, optional.
+ *
+ * @param   pfnSavePrep     Prepare save callback, optional.
+ * @param   pfnSaveExec     Execute save callback, optional.
+ * @param   pfnSaveDone     Done save callback, optional.
+ *
+ * @param   pfnLoadPrep     Prepare load callback, optional.
+ * @param   pfnLoadExec     Execute load callback, optional.
+ * @param   pfnLoadDone     Done load callback, optional.
+ */
+VMMR3_INT_DECL(int)
+SSMR3RegisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance, uint32_t uVersion, size_t cbGuess,
+                 PFNSSMUSBLIVEPREP pfnLivePrep, PFNSSMUSBLIVEEXEC pfnLiveExec, PFNSSMUSBLIVEVOTE pfnLiveVote,
+                 PFNSSMUSBSAVEPREP pfnSavePrep, PFNSSMUSBSAVEEXEC pfnSaveExec, PFNSSMUSBSAVEDONE pfnSaveDone,
+                 PFNSSMUSBLOADPREP pfnLoadPrep, PFNSSMUSBLOADEXEC pfnLoadExec, PFNSSMUSBLOADDONE pfnLoadDone)
+{
+    PSSMUNIT pUnit;
+    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit);
+    if (RT_SUCCESS(rc))
+    {
+        pUnit->enmType = SSMUNITTYPE_USB;
+        pUnit->u.Usb.pfnLivePrep = pfnLivePrep;
+        pUnit->u.Usb.pfnLiveExec = pfnLiveExec;
+        pUnit->u.Usb.pfnLiveVote = pfnLiveVote;
+        pUnit->u.Usb.pfnSavePrep = pfnSavePrep;
+        pUnit->u.Usb.pfnSaveExec = pfnSaveExec;
+        pUnit->u.Usb.pfnSaveDone = pfnSaveDone;
+        pUnit->u.Usb.pfnLoadPrep = pfnLoadPrep;
+        pUnit->u.Usb.pfnLoadExec = pfnLoadExec;
+        pUnit->u.Usb.pfnLoadDone = pfnLoadDone;
+        pUnit->u.Usb.pUsbIns = pUsbIns;
+    }
+    return rc;
+}
+
+
+/**
  * Register a internal data unit.
  *
  * @returns VBox status.
@@ -1345,7 +1397,7 @@ VMMR3DECL(int) SSMR3RegisterInternal(PVM pVM, const char *pszName, uint32_t uIns
     PFNSSMINTLOADPREP pfnLoadPrep, PFNSSMINTLOADEXEC pfnLoadExec, PFNSSMINTLOADDONE pfnLoadDone)
 {
     PSSMUNIT pUnit;
-    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit);
+    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL /* pszBefore */, &pUnit);
     if (RT_SUCCESS(rc))
     {
         pUnit->enmType = SSMUNITTYPE_INTERNAL;
@@ -1399,7 +1451,7 @@ VMMR3DECL(int) SSMR3RegisterExternal(PUVM pUVM, const char *pszName, uint32_t uI
     VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE);
 
     PSSMUNIT pUnit;
-    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL, &pUnit);
+    int rc = ssmR3Register(pVM, pszName, uInstance, uVersion, cbGuess, NULL /* pszBefore */, &pUnit);
     if (RT_SUCCESS(rc))
     {
         pUnit->enmType = SSMUNITTYPE_EXTERNAL;
@@ -1601,6 +1653,76 @@ VMMR3_INT_DECL(int) SSMR3DeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const cha
 
 
 /**
+ * Deregister one or more PDM USB device data units.
+ *
+ * @returns VBox status.
+ * @param   pVM             Pointer to the VM.
+ * @param   pUsbIns         USB device instance.
+ * @param   pszName         Data unit name.
+ *                          Use NULL to deregister all data units for that driver instance.
+ * @param   uInstance       The instance identifier of the data unit.
+ *                          This must together with the name be unique. Ignored if pszName is NULL.
+ * @remark  Only for dynamic data units and dynamic unloaded modules.
+ */
+VMMR3_INT_DECL(int) SSMR3DeregisterUsb(PVM pVM, PPDMUSBINS pUsbIns, const char *pszName, uint32_t uInstance)
+{
+    /*
+     * Validate input.
+     */
+    AssertMsgReturn(VALID_PTR(pUsbIns), ("pUsbIns is NULL!\n"), VERR_INVALID_PARAMETER);
+
+    /*
+     * Search the list.
+     */
+    size_t      cchName = pszName ? strlen(pszName) : 0;
+    int         rc = pszName ? VERR_SSM_UNIT_NOT_FOUND : VINF_SUCCESS;
+    PSSMUNIT    pUnitPrev = NULL;
+    PSSMUNIT    pUnit = pVM->ssm.s.pHead;
+    while (pUnit)
+    {
+        if (    pUnit->enmType == SSMUNITTYPE_USB
+            &&  (   !pszName
+                 || (   pUnit->cchName == cchName
+                     && !memcmp(pUnit->szName, pszName, cchName)
+                     && pUnit->u32Instance == uInstance))
+            )
+        {
+            if (pUnit->u.Usb.pUsbIns == pUsbIns)
+            {
+                /*
+                 * Unlink it, advance pointer, and free the node.
+                 */
+                PSSMUNIT pFree = pUnit;
+                pUnit = pUnit->pNext;
+                if (pUnitPrev)
+                    pUnitPrev->pNext = pUnit;
+                else
+                    pVM->ssm.s.pHead = pUnit;
+                pVM->ssm.s.cUnits--;
+                Log(("SSM: Removed data unit '%s' (pdm drv).\n", pFree->szName));
+                MMR3HeapFree(pFree);
+
+                if (pszName)
+                    return VINF_SUCCESS;
+                rc = VINF_SUCCESS;
+                continue;
+            }
+
+            AssertMsgReturn(!pszName,
+                            ("Caller is not owner! Owner=%p Caller=%p %s\n", pUnit->u.Usb.pUsbIns, pUsbIns, pszName),
+                            VERR_SSM_UNIT_NOT_OWNER);
+        }
+
+        /* next */
+        pUnitPrev = pUnit;
+        pUnit = pUnit->pNext;
+    }
+
+    return rc;
+}
+
+
+/**
  * Deregister a data unit.
  *
  * @returns VBox status.
@@ -3580,7 +3702,7 @@ VMMR3DECL(int) SSMR3PutStructEx(PSSMHANDLE pSSM, const void *pvStruct, size_t cb
     /*
      * Begin marker.
      */
-    if (!(fFlags & SSMSTRUCT_FLAGS_NO_MARKERS))
+    if (!(fFlags & (SSMSTRUCT_FLAGS_NO_MARKERS | SSMSTRUCT_FLAGS_NO_LEAD_MARKER)))
     {
         rc = SSMR3PutU32(pSSM, SSMR3STRUCT_BEGIN);
         if (RT_FAILURE(rc))
@@ -3591,7 +3713,7 @@ VMMR3DECL(int) SSMR3PutStructEx(PSSMHANDLE pSSM, const void *pvStruct, size_t cb
      * Put the fields
      */
     rc = VINF_SUCCESS;
-    uint32_t    off          = 0;
+    uint32_t off = 0;
     for (PCSSMFIELD pCur = paFields;
          pCur->cb != UINT32_MAX && pCur->off != UINT32_MAX;
          pCur++)
@@ -3813,7 +3935,7 @@ VMMR3DECL(int) SSMR3PutStructEx(PSSMHANDLE pSSM, const void *pvStruct, size_t cb
     /*
      * End marker
      */
-    if (!(fFlags & SSMSTRUCT_FLAGS_NO_MARKERS))
+    if (!(fFlags & (SSMSTRUCT_FLAGS_NO_MARKERS | SSMSTRUCT_FLAGS_NO_TAIL_MARKER)))
     {
         rc = SSMR3PutU32(pSSM, SSMR3STRUCT_END);
         if (RT_FAILURE(rc))
@@ -4368,6 +4490,9 @@ static int ssmR3SaveDoDoneRun(PVM pVM, PSSMHANDLE pSSM)
                 case SSMUNITTYPE_DRV:
                     rc = pUnit->u.Drv.pfnSaveDone(pUnit->u.Drv.pDrvIns, pSSM);
                     break;
+                case SSMUNITTYPE_USB:
+                    rc = pUnit->u.Usb.pfnSaveDone(pUnit->u.Usb.pUsbIns, pSSM);
+                    break;
                 case SSMUNITTYPE_INTERNAL:
                     rc = pUnit->u.Internal.pfnSaveDone(pVM, pSSM);
                     break;
@@ -4717,6 +4842,9 @@ static int ssmR3SaveDoExecRun(PVM pVM, PSSMHANDLE pSSM)
             case SSMUNITTYPE_DRV:
                 rc = pUnit->u.Drv.pfnSaveExec(pUnit->u.Drv.pDrvIns, pSSM);
                 break;
+            case SSMUNITTYPE_USB:
+                rc = pUnit->u.Usb.pfnSaveExec(pUnit->u.Usb.pUsbIns, pSSM);
+                break;
             case SSMUNITTYPE_INTERNAL:
                 rc = pUnit->u.Internal.pfnSaveExec(pVM, pSSM);
                 break;
@@ -4807,6 +4935,9 @@ static int ssmR3SaveDoPrepRun(PVM pVM, PSSMHANDLE pSSM)
                 case SSMUNITTYPE_DRV:
                     rc = pUnit->u.Drv.pfnSavePrep(pUnit->u.Drv.pDrvIns, pSSM);
                     break;
+                case SSMUNITTYPE_USB:
+                    rc = pUnit->u.Usb.pfnSavePrep(pUnit->u.Usb.pUsbIns, pSSM);
+                    break;
                 case SSMUNITTYPE_INTERNAL:
                     rc = pUnit->u.Internal.pfnSavePrep(pVM, pSSM);
                     break;
@@ -5150,6 +5281,9 @@ static int ssmR3LiveDoVoteRun(PVM pVM, PSSMHANDLE pSSM, uint32_t uPass)
                 case SSMUNITTYPE_DRV:
                     rc = pUnit->u.Drv.pfnLiveVote(pUnit->u.Drv.pDrvIns, pSSM, uPass);
                     break;
+                case SSMUNITTYPE_USB:
+                    rc = pUnit->u.Usb.pfnLiveVote(pUnit->u.Usb.pUsbIns, pSSM, uPass);
+                    break;
                 case SSMUNITTYPE_INTERNAL:
                     rc = pUnit->u.Internal.pfnLiveVote(pVM, pSSM, uPass);
                     break;
@@ -5290,6 +5424,9 @@ static int ssmR3LiveDoExecRun(PVM pVM, PSSMHANDLE pSSM, uint32_t uPass)
             case SSMUNITTYPE_DRV:
                 rc = pUnit->u.Drv.pfnLiveExec(pUnit->u.Drv.pDrvIns, pSSM, uPass);
                 break;
+            case SSMUNITTYPE_USB:
+                rc = pUnit->u.Usb.pfnLiveExec(pUnit->u.Usb.pUsbIns, pSSM, uPass);
+                break;
             case SSMUNITTYPE_INTERNAL:
                 rc = pUnit->u.Internal.pfnLiveExec(pVM, pSSM, uPass);
                 break;
@@ -5449,6 +5586,9 @@ static int ssmR3DoLivePrepRun(PVM pVM, PSSMHANDLE pSSM)
                 case SSMUNITTYPE_DRV:
                     rc = pUnit->u.Drv.pfnLivePrep(pUnit->u.Drv.pDrvIns, pSSM);
                     break;
+                case SSMUNITTYPE_USB:
+                    rc = pUnit->u.Usb.pfnLivePrep(pUnit->u.Usb.pUsbIns, pSSM);
+                    break;
                 case SSMUNITTYPE_INTERNAL:
                     rc = pUnit->u.Internal.pfnLivePrep(pVM, pSSM);
                     break;
@@ -6404,46 +6544,49 @@ VMMR3DECL(int) SSMR3GetStruct(PSSMHANDLE pSSM, void *pvStruct, PCSSMFIELD paFiel
          pCur->cb != UINT32_MAX && pCur->off != UINT32_MAX;
          pCur++)
     {
-        uint8_t *pbField = (uint8_t *)pvStruct + pCur->off;
-        switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
+        if (pCur->uFirstVer <= pSSM->u.Read.uCurUnitVer)
         {
-            case SSMFIELDTRANS_NO_TRANSFORMATION:
-                rc = ssmR3DataRead(pSSM, pbField, pCur->cb);
-                break;
+            uint8_t *pbField = (uint8_t *)pvStruct + pCur->off;
+            switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
+            {
+                case SSMFIELDTRANS_NO_TRANSFORMATION:
+                    rc = ssmR3DataRead(pSSM, pbField, pCur->cb);
+                    break;
 
-            case SSMFIELDTRANS_GCPTR:
-                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
-                break;
+                case SSMFIELDTRANS_GCPTR:
+                    AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
+                    break;
 
-            case SSMFIELDTRANS_GCPHYS:
-                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
-                break;
+                case SSMFIELDTRANS_GCPHYS:
+                    AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
+                    break;
 
-            case SSMFIELDTRANS_RCPTR:
-                AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
-                break;
+                case SSMFIELDTRANS_RCPTR:
+                    AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR), ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
+                    break;
 
-            case SSMFIELDTRANS_RCPTR_ARRAY:
+                case SSMFIELDTRANS_RCPTR_ARRAY:
+                {
+                    uint32_t const cEntries = pCur->cb / sizeof(RTRCPTR);
+                    AssertMsgBreakStmt(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = VINF_SUCCESS;
+                    for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
+                        rc = SSMR3GetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
+                    break;
+                }
+
+                default:
+                    AssertMsgFailedBreakStmt(("%#x\n", pCur->pfnGetPutOrTransformer), rc = VERR_SSM_FIELD_COMPLEX);
+            }
+            if (RT_FAILURE(rc))
             {
-                uint32_t const cEntries = pCur->cb / sizeof(RTRCPTR);
-                AssertMsgBreakStmt(pCur->cb == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", pCur->cb, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = VINF_SUCCESS;
-                for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
-                    rc = SSMR3GetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
-                break;
+                if (RT_SUCCESS(pSSM->rc))
+                    pSSM->rc = rc;
+                return rc;
             }
-
-            default:
-                AssertMsgFailedBreakStmt(("%#x\n", pCur->pfnGetPutOrTransformer), rc = VERR_SSM_FIELD_COMPLEX);
-        }
-        if (RT_FAILURE(rc))
-        {
-            if (RT_SUCCESS(pSSM->rc))
-                pSSM->rc = rc;
-            return rc;
         }
     }
 
@@ -6531,7 +6674,7 @@ VMMR3DECL(int) SSMR3GetStructEx(PSSMHANDLE pSSM, void *pvStruct, size_t cbStruct
     /*
      * Begin marker.
      */
-    if (!(fFlags & SSMSTRUCT_FLAGS_NO_MARKERS))
+    if (!(fFlags & (SSMSTRUCT_FLAGS_NO_MARKERS | SSMSTRUCT_FLAGS_NO_LEAD_MARKER)))
     {
         rc = SSMR3GetU32(pSSM, &u32Magic);
         if (RT_FAILURE(rc))
@@ -6567,182 +6710,185 @@ VMMR3DECL(int) SSMR3GetStructEx(PSSMHANDLE pSSM, void *pvStruct, size_t cbStruct
                         ("off=%#x offField=%#x (%s)\n", off, offField, pCur->pszName),
                         pSSM->rc = VERR_SSM_FIELD_NOT_CONSECUTIVE);
 
-        rc = VINF_SUCCESS;
-        uint8_t       *pbField  = (uint8_t *)pvStruct + offField;
-        switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
+        if (pCur->uFirstVer <= pSSM->u.Read.uCurUnitVer)
         {
-            case SSMFIELDTRANS_NO_TRANSFORMATION:
-                rc = ssmR3DataRead(pSSM, pbField, cbField);
-                break;
-
-            case SSMFIELDTRANS_GCPHYS:
-                AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
-                break;
+            rc = VINF_SUCCESS;
+            uint8_t       *pbField  = (uint8_t *)pvStruct + offField;
+            switch ((uintptr_t)pCur->pfnGetPutOrTransformer)
+            {
+                case SSMFIELDTRANS_NO_TRANSFORMATION:
+                    rc = ssmR3DataRead(pSSM, pbField, cbField);
+                    break;
 
-            case SSMFIELDTRANS_GCPTR:
-                AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
-                break;
+                case SSMFIELDTRANS_GCPHYS:
+                    AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3GetGCPhys(pSSM, (PRTGCPHYS)pbField);
+                    break;
 
-            case SSMFIELDTRANS_RCPTR:
-                AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
-                break;
+                case SSMFIELDTRANS_GCPTR:
+                    AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3GetGCPtr(pSSM, (PRTGCPTR)pbField);
+                    break;
 
-            case SSMFIELDTRANS_RCPTR_ARRAY:
-            {
-                uint32_t const cEntries = cbField / sizeof(RTRCPTR);
-                AssertMsgBreakStmt(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = VINF_SUCCESS;
-                for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
-                    rc = SSMR3GetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
-                break;
-            }
+                case SSMFIELDTRANS_RCPTR:
+                    AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3GetRCPtr(pSSM, (PRTRCPTR)pbField);
+                    break;
 
-            case SSMFIELDTRANS_HCPTR_NI:
-                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = ssmR3GetHCPtrNI(pSSM, (void **)pbField, fFlags);
-                break;
+                case SSMFIELDTRANS_RCPTR_ARRAY:
+                {
+                    uint32_t const cEntries = cbField / sizeof(RTRCPTR);
+                    AssertMsgBreakStmt(cbField == cEntries * sizeof(RTRCPTR) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = VINF_SUCCESS;
+                    for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
+                        rc = SSMR3GetRCPtr(pSSM, &((PRTRCPTR)pbField)[i]);
+                    break;
+                }
 
-            case SSMFIELDTRANS_HCPTR_NI_ARRAY:
-            {
-                uint32_t const cEntries = cbField / sizeof(void *);
-                AssertMsgBreakStmt(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = VINF_SUCCESS;
-                for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
-                    rc = ssmR3GetHCPtrNI(pSSM, &((void **)pbField)[i], fFlags);
-                break;
-            }
+                case SSMFIELDTRANS_HCPTR_NI:
+                    AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = ssmR3GetHCPtrNI(pSSM, (void **)pbField, fFlags);
+                    break;
 
-            case SSMFIELDTRANS_HCPTR_HACK_U32:
-                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                *(uintptr_t *)pbField = 0;
-                rc = ssmR3DataRead(pSSM, pbField, sizeof(uint32_t));
-                if ((fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE) && ssmR3GetHostBits(pSSM) == 64)
+                case SSMFIELDTRANS_HCPTR_NI_ARRAY:
                 {
-                    uint32_t u32;
-                    rc = ssmR3DataRead(pSSM, &u32, sizeof(uint32_t));
-                    AssertMsgBreakStmt(RT_FAILURE(rc) || u32 == 0 || (fFlags & SSMSTRUCT_FLAGS_SAVED_AS_MEM),
-                                       ("high=%#x low=%#x (%s)\n", u32, *(uint32_t *)pbField, pCur->pszName),
-                                       rc = VERR_SSM_FIELD_INVALID_VALUE);
+                    uint32_t const cEntries = cbField / sizeof(void *);
+                    AssertMsgBreakStmt(cbField == cEntries * sizeof(void *) && cEntries, ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = VINF_SUCCESS;
+                    for (uint32_t i = 0; i < cEntries && RT_SUCCESS(rc); i++)
+                        rc = ssmR3GetHCPtrNI(pSSM, &((void **)pbField)[i], fFlags);
+                    break;
                 }
-                break;
 
-            case SSMFIELDTRANS_U32_ZX_U64:
-                AssertMsgBreakStmt(cbField == sizeof(uint64_t), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                ((uint32_t *)pbField)[1] = 0;
-                rc = SSMR3GetU32(pSSM, (uint32_t *)pbField);
-                break;
+                case SSMFIELDTRANS_HCPTR_HACK_U32:
+                    AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    *(uintptr_t *)pbField = 0;
+                    rc = ssmR3DataRead(pSSM, pbField, sizeof(uint32_t));
+                    if ((fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE) && ssmR3GetHostBits(pSSM) == 64)
+                    {
+                        uint32_t u32;
+                        rc = ssmR3DataRead(pSSM, &u32, sizeof(uint32_t));
+                        AssertMsgBreakStmt(RT_FAILURE(rc) || u32 == 0 || (fFlags & SSMSTRUCT_FLAGS_SAVED_AS_MEM),
+                                           ("high=%#x low=%#x (%s)\n", u32, *(uint32_t *)pbField, pCur->pszName),
+                                           rc = VERR_SSM_FIELD_INVALID_VALUE);
+                    }
+                    break;
 
+                case SSMFIELDTRANS_U32_ZX_U64:
+                    AssertMsgBreakStmt(cbField == sizeof(uint64_t), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    ((uint32_t *)pbField)[1] = 0;
+                    rc = SSMR3GetU32(pSSM, (uint32_t *)pbField);
+                    break;
 
-            case SSMFIELDTRANS_IGNORE:
-                if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
-                    rc = SSMR3Skip(pSSM, cbField);
-                break;
 
-            case SSMFIELDTRANS_IGN_GCPHYS:
-                AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
-                    rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
-                break;
+                case SSMFIELDTRANS_IGNORE:
+                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
+                        rc = SSMR3Skip(pSSM, cbField);
+                    break;
 
-            case SSMFIELDTRANS_IGN_GCPTR:
-                AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
-                    rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
-                break;
+                case SSMFIELDTRANS_IGN_GCPHYS:
+                    AssertMsgBreakStmt(cbField == sizeof(RTGCPHYS), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
+                        rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
+                    break;
 
-            case SSMFIELDTRANS_IGN_RCPTR:
-                AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
-                    rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
-                break;
+                case SSMFIELDTRANS_IGN_GCPTR:
+                    AssertMsgBreakStmt(cbField == sizeof(RTGCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
+                        rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
+                    break;
 
-            case SSMFIELDTRANS_IGN_HCPTR:
-                AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
-                    rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
-                break;
+                case SSMFIELDTRANS_IGN_RCPTR:
+                    AssertMsgBreakStmt(cbField == sizeof(RTRCPTR), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
+                        rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
+                    break;
+
+                case SSMFIELDTRANS_IGN_HCPTR:
+                    AssertMsgBreakStmt(cbField == sizeof(void *), ("%#x (%s)\n", cbField, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
+                        rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
+                    break;
 
 
-            case SSMFIELDTRANS_OLD:
-                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3Skip(pSSM, pCur->cb);
-                break;
+                case SSMFIELDTRANS_OLD:
+                    AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3Skip(pSSM, pCur->cb);
+                    break;
 
-            case SSMFIELDTRANS_OLD_GCPHYS:
-                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
-                break;
+                case SSMFIELDTRANS_OLD_GCPHYS:
+                    AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPHYS) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPhys);
+                    break;
 
-            case SSMFIELDTRANS_OLD_GCPTR:
-                AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
-                break;
+                case SSMFIELDTRANS_OLD_GCPTR:
+                    AssertMsgBreakStmt(pCur->cb == sizeof(RTGCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3Skip(pSSM, pSSM->u.Read.cbGCPtr);
+                    break;
 
-            case SSMFIELDTRANS_OLD_RCPTR:
-                AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
-                break;
+                case SSMFIELDTRANS_OLD_RCPTR:
+                    AssertMsgBreakStmt(pCur->cb == sizeof(RTRCPTR) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3Skip(pSSM, sizeof(RTRCPTR));
+                    break;
 
-            case SSMFIELDTRANS_OLD_HCPTR:
-                AssertMsgBreakStmt(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
-                break;
+                case SSMFIELDTRANS_OLD_HCPTR:
+                    AssertMsgBreakStmt(pCur->cb == sizeof(void *) && pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) / 8);
+                    break;
 
-            case SSMFIELDTRANS_OLD_PAD_HC:
-                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) == 64 ? RT_HIWORD(pCur->cb) : RT_LOWORD(pCur->cb));
-                break;
+                case SSMFIELDTRANS_OLD_PAD_HC:
+                    AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    rc = SSMR3Skip(pSSM, ssmR3GetHostBits(pSSM) == 64 ? RT_HIWORD(pCur->cb) : RT_LOWORD(pCur->cb));
+                    break;
 
-            case SSMFIELDTRANS_OLD_PAD_MSC32:
-                AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
-                if (ssmR3IsHostMsc32(pSSM))
-                    rc = SSMR3Skip(pSSM, pCur->cb);
-                break;
+                case SSMFIELDTRANS_OLD_PAD_MSC32:
+                    AssertMsgBreakStmt(pCur->off == UINT32_MAX / 2, ("%#x %#x (%s)\n", pCur->cb, pCur->off, pCur->pszName), rc = VERR_SSM_FIELD_INVALID_SIZE);
+                    if (ssmR3IsHostMsc32(pSSM))
+                        rc = SSMR3Skip(pSSM, pCur->cb);
+                    break;
 
 
-            case SSMFIELDTRANS_PAD_HC:
-            case SSMFIELDTRANS_PAD_HC32:
-            case SSMFIELDTRANS_PAD_HC64:
-            case SSMFIELDTRANS_PAD_HC_AUTO:
-            case SSMFIELDTRANS_PAD_MSC32_AUTO:
-            {
-                uint32_t cb32    = RT_BYTE1(pCur->cb);
-                uint32_t cb64    = RT_BYTE2(pCur->cb);
-                uint32_t cbCtx   =    HC_ARCH_BITS == 64
-                                   || (   (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
-                                       && !SSM_HOST_IS_MSC_32)
-                                 ? cb64 : cb32;
-                uint32_t cbSaved =    ssmR3GetHostBits(pSSM) == 64
-                                   || (   (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
-                                       && !ssmR3IsHostMsc32(pSSM))
-                                 ? cb64 : cb32;
-                AssertMsgBreakStmt(    cbField == cbCtx
-                                   &&  (   (   pCur->off == UINT32_MAX / 2
-                                            && (   cbField == 0
-                                                || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
-                                                || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
+                case SSMFIELDTRANS_PAD_HC:
+                case SSMFIELDTRANS_PAD_HC32:
+                case SSMFIELDTRANS_PAD_HC64:
+                case SSMFIELDTRANS_PAD_HC_AUTO:
+                case SSMFIELDTRANS_PAD_MSC32_AUTO:
+                {
+                    uint32_t cb32    = RT_BYTE1(pCur->cb);
+                    uint32_t cb64    = RT_BYTE2(pCur->cb);
+                    uint32_t cbCtx   =    HC_ARCH_BITS == 64
+                                       || (   (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
+                                           && !SSM_HOST_IS_MSC_32)
+                                     ? cb64 : cb32;
+                    uint32_t cbSaved =    ssmR3GetHostBits(pSSM) == 64
+                                       || (   (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
+                                           && !ssmR3IsHostMsc32(pSSM))
+                                     ? cb64 : cb32;
+                    AssertMsgBreakStmt(    cbField == cbCtx
+                                       &&  (   (   pCur->off == UINT32_MAX / 2
+                                                && (   cbField == 0
+                                                    || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_HC_AUTO
+                                                    || (uintptr_t)pCur->pfnGetPutOrTransformer == SSMFIELDTRANS_PAD_MSC32_AUTO
+                                                   )
                                                )
-                                           )
-                                        || (pCur->off != UINT32_MAX / 2 && cbField != 0)
-                                        )
-                                   , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
-                                      cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
-                                   rc = VERR_SSM_FIELD_INVALID_PADDING_SIZE);
-                if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
-                    rc = SSMR3Skip(pSSM, cbSaved);
-                break;
-            }
+                                            || (pCur->off != UINT32_MAX / 2 && cbField != 0)
+                                            )
+                                       , ("cbField=%#x cb32=%#x cb64=%#x HC_ARCH_BITS=%u cbCtx=%#x cbSaved=%#x off=%#x\n",
+                                          cbField, cb32, cb64, HC_ARCH_BITS, cbCtx, cbSaved, pCur->off),
+                                       rc = VERR_SSM_FIELD_INVALID_PADDING_SIZE);
+                    if (fFlags & SSMSTRUCT_FLAGS_DONT_IGNORE)
+                        rc = SSMR3Skip(pSSM, cbSaved);
+                    break;
+                }
 
-            default:
-                AssertBreakStmt(pCur->pfnGetPutOrTransformer, rc = VERR_SSM_FIELD_INVALID_CALLBACK);
-                rc = pCur->pfnGetPutOrTransformer(pSSM, pCur, pvStruct, fFlags, true /*fGetOrPut*/, pvUser);
+                default:
+                    AssertBreakStmt(pCur->pfnGetPutOrTransformer, rc = VERR_SSM_FIELD_INVALID_CALLBACK);
+                    rc = pCur->pfnGetPutOrTransformer(pSSM, pCur, pvStruct, fFlags, true /*fGetOrPut*/, pvUser);
+                    break;
+            }
+            if (RT_FAILURE(rc))
                 break;
         }
-        if (RT_FAILURE(rc))
-            break;
 
         off = offField + cbField;
     }
@@ -6763,7 +6909,7 @@ VMMR3DECL(int) SSMR3GetStructEx(PSSMHANDLE pSSM, void *pvStruct, size_t cbStruct
     /*
      * End marker
      */
-    if (!(fFlags & SSMSTRUCT_FLAGS_NO_MARKERS))
+    if (!(fFlags & (SSMSTRUCT_FLAGS_NO_MARKERS | SSMSTRUCT_FLAGS_NO_TAIL_MARKER)))
     {
         rc = SSMR3GetU32(pSSM, &u32Magic);
         if (RT_FAILURE(rc))
@@ -8051,6 +8197,9 @@ static int ssmR3LoadExecV1(PVM pVM, PSSMHANDLE pSSM)
                             case SSMUNITTYPE_DRV:
                                 rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version, SSM_PASS_FINAL);
                                 break;
+                            case SSMUNITTYPE_USB:
+                                rc = pUnit->u.Usb.pfnLoadExec(pUnit->u.Usb.pUsbIns, pSSM, UnitHdr.u32Version, SSM_PASS_FINAL);
+                                break;
                             case SSMUNITTYPE_INTERNAL:
                                 rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version, SSM_PASS_FINAL);
                                 break;
@@ -8316,6 +8465,9 @@ static int ssmR3LoadExecV2(PVM pVM, PSSMHANDLE pSSM)
                 case SSMUNITTYPE_DRV:
                     rc = pUnit->u.Drv.pfnLoadExec(pUnit->u.Drv.pDrvIns, pSSM, UnitHdr.u32Version, UnitHdr.u32Pass);
                     break;
+                case SSMUNITTYPE_USB:
+                    rc = pUnit->u.Usb.pfnLoadExec(pUnit->u.Usb.pUsbIns, pSSM, UnitHdr.u32Version, UnitHdr.u32Pass);
+                    break;
                 case SSMUNITTYPE_INTERNAL:
                     rc = pUnit->u.Internal.pfnLoadExec(pVM, pSSM, UnitHdr.u32Version, UnitHdr.u32Pass);
                     break;
@@ -8488,6 +8640,9 @@ VMMR3DECL(int) SSMR3Load(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamO
                     case SSMUNITTYPE_DRV:
                         rc = pUnit->u.Drv.pfnLoadPrep(pUnit->u.Drv.pDrvIns, &Handle);
                         break;
+                    case SSMUNITTYPE_USB:
+                        rc = pUnit->u.Usb.pfnLoadPrep(pUnit->u.Usb.pUsbIns, &Handle);
+                        break;
                     case SSMUNITTYPE_INTERNAL:
                         rc = pUnit->u.Internal.pfnLoadPrep(pVM, &Handle);
                         break;
@@ -8561,6 +8716,9 @@ VMMR3DECL(int) SSMR3Load(PVM pVM, const char *pszFilename, PCSSMSTRMOPS pStreamO
                     case SSMUNITTYPE_DRV:
                         rc = pUnit->u.Drv.pfnLoadDone(pUnit->u.Drv.pDrvIns, &Handle);
                         break;
+                    case SSMUNITTYPE_USB:
+                        rc = pUnit->u.Usb.pfnLoadDone(pUnit->u.Usb.pUsbIns, &Handle);
+                        break;
                     case SSMUNITTYPE_INTERNAL:
                         rc = pUnit->u.Internal.pfnLoadDone(pVM, &Handle);
                         break;
diff --git a/src/VBox/VMM/VMMR3/STAM.cpp b/src/VBox/VMM/VMMR3/STAM.cpp
index 68f7224..bac352d 100644
--- a/src/VBox/VMM/VMMR3/STAM.cpp
+++ b/src/VBox/VMM/VMMR3/STAM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -1655,7 +1655,7 @@ VMMR3DECL(int)  STAMR3Reset(PUVM pUVM, const char *pszPat)
             }
         if (!fGVMMMatched)
         {
-            /** @todo match cpu leaves some rainy day.  */
+            /** @todo match cpu leaves some rainy day. */
         }
 
         /* GMM */
@@ -2663,7 +2663,7 @@ static void stamR3Ring0StatsUpdateMultiU(PUVM pUVM, const char * const *papszExp
         }
     if (!fUpdate)
     {
-        /** @todo check the cpu leaves - rainy day.   */
+        /** @todo check the cpu leaves - rainy day. */
     }
     if (fUpdate)
     {
diff --git a/src/VBox/VMM/VMMR3/TM.cpp b/src/VBox/VMM/VMMR3/TM.cpp
index f6f6c8e..933743b 100644
--- a/src/VBox/VMM/VMMR3/TM.cpp
+++ b/src/VBox/VMM/VMMR3/TM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -125,6 +125,7 @@
 #include <VBox/vmm/vmm.h>
 #include <VBox/vmm/mm.h>
 #include <VBox/vmm/hm.h>
+#include <VBox/vmm/gim.h>
 #include <VBox/vmm/ssm.h>
 #include <VBox/vmm/dbgf.h>
 #include <VBox/vmm/dbgftrace.h>
@@ -166,6 +167,7 @@
 *   Internal Functions                                                         *
 *******************************************************************************/
 static bool                 tmR3HasFixedTSC(PVM pVM);
+static const char *         tmR3GetTSCModeName(PVM pVM);
 static uint64_t             tmR3CalibrateTSC(PVM pVM);
 static DECLCALLBACK(int)    tmR3Save(PVM pVM, PSSMHANDLE pSSM);
 static DECLCALLBACK(int)    tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
@@ -179,6 +181,7 @@ static DECLCALLBACK(void)   tmR3CpuLoadTimer(PVM pVM, PTMTIMER pTimer, void *pvU
 static DECLCALLBACK(void)   tmR3TimerInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
 static DECLCALLBACK(void)   tmR3TimerInfoActive(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
 static DECLCALLBACK(void)   tmR3InfoClocks(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
+static DECLCALLBACK(VBOXSTRICTRC) tmR3CpuTickParavirtDisable(PVM pVM, PVMCPU pVCpu, void *pvData);
 
 
 /**
@@ -226,10 +229,12 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
      * the GIP into the guest context so we can do this calculation there
      * as well and save costly world switches.
      */
-    pVM->tm.s.pvGIPR3 = (void *)g_pSUPGlobalInfoPage;
+    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    pVM->tm.s.pvGIPR3 = (void *)pGip;
     AssertMsgReturn(pVM->tm.s.pvGIPR3, ("GIP support is now required!\n"), VERR_TM_GIP_REQUIRED);
-    AssertMsgReturn((g_pSUPGlobalInfoPage->u32Version >> 16) == (SUPGLOBALINFOPAGE_VERSION >> 16),
-                    ("Unsupported GIP version!\n"), VERR_TM_GIP_VERSION);
+    AssertMsgReturn((pGip->u32Version >> 16) == (SUPGLOBALINFOPAGE_VERSION >> 16),
+                    ("Unsupported GIP version %#x! (expected=%#x)\n", pGip->u32Version, SUPGLOBALINFOPAGE_VERSION),
+                    VERR_TM_GIP_VERSION);
 
     RTHCPHYS HCPhysGIP;
     rc = SUPR3GipGetPhys(&HCPhysGIP);
@@ -237,7 +242,7 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
 
     RTGCPTR GCPtr;
 #ifdef SUP_WITH_LOTS_OF_CPUS
-    rc = MMR3HyperMapHCPhys(pVM, pVM->tm.s.pvGIPR3, NIL_RTR0PTR, HCPhysGIP, (size_t)g_pSUPGlobalInfoPage->cPages * PAGE_SIZE,
+    rc = MMR3HyperMapHCPhys(pVM, pVM->tm.s.pvGIPR3, NIL_RTR0PTR, HCPhysGIP, (size_t)pGip->cPages * PAGE_SIZE,
                             "GIP", &GCPtr);
 #else
     rc = MMR3HyperMapHCPhys(pVM, pVM->tm.s.pvGIPR3, NIL_RTR0PTR, HCPhysGIP, PAGE_SIZE, "GIP", &GCPtr);
@@ -252,41 +257,39 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
     MMR3HyperReserve(pVM, PAGE_SIZE, "fence", NULL);
 
     /* Check assumptions made in TMAllVirtual.cpp about the GIP update interval. */
-    if (    g_pSUPGlobalInfoPage->u32Magic == SUPGLOBALINFOPAGE_MAGIC
-        &&  g_pSUPGlobalInfoPage->u32UpdateIntervalNS >= 250000000 /* 0.25s */)
+    if (    pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC
+        &&  pGip->u32UpdateIntervalNS >= 250000000 /* 0.25s */)
         return VMSetError(pVM, VERR_TM_GIP_UPDATE_INTERVAL_TOO_BIG, RT_SRC_POS,
                           N_("The GIP update interval is too big. u32UpdateIntervalNS=%RU32 (u32UpdateHz=%RU32)"),
-                          g_pSUPGlobalInfoPage->u32UpdateIntervalNS, g_pSUPGlobalInfoPage->u32UpdateHz);
-    LogRel(("TM: GIP - u32Mode=%d (%s) u32UpdateHz=%u\n", g_pSUPGlobalInfoPage->u32Mode,
-            g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_SYNC_TSC ? "SyncTSC"
-            : g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_ASYNC_TSC ? "AsyncTSC" : "Unknown",
-            g_pSUPGlobalInfoPage->u32UpdateHz));
+                          pGip->u32UpdateIntervalNS, pGip->u32UpdateHz);
 
-    /*
-     * Setup the VirtualGetRaw backend.
-     */
-    pVM->tm.s.VirtualGetRawDataR3.pu64Prev = &pVM->tm.s.u64VirtualRawPrev;
-    pVM->tm.s.VirtualGetRawDataR3.pfnBad = tmVirtualNanoTSBad;
-    pVM->tm.s.VirtualGetRawDataR3.pfnRediscover = tmVirtualNanoTSRediscover;
-    if (ASMCpuId_EDX(1) & X86_CPUID_FEATURE_EDX_SSE2)
-    {
-        if (g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_SYNC_TSC)
-            pVM->tm.s.pfnVirtualGetRawR3 = RTTimeNanoTSLFenceSync;
-        else
-            pVM->tm.s.pfnVirtualGetRawR3 = RTTimeNanoTSLFenceAsync;
-    }
-    else
+    /* Log GIP info that may come in handy. */
+    LogRel(("TM: GIP - u32Mode=%d (%s) u32UpdateHz=%u u32UpdateIntervalNS=%u enmUseTscDelta=%d (%s) fGetGipCpu=%#x cCpus=%d\n",
+            pGip->u32Mode, SUPGetGIPModeName(pGip), pGip->u32UpdateHz, pGip->u32UpdateIntervalNS,
+            pGip->enmUseTscDelta, SUPGetGIPTscDeltaModeName(pGip), pGip->fGetGipCpu, pGip->cCpus));
+    LogRel(("TM: GIP - u64CpuHz=%'RU64 (%#RX64)  SUPGetCpuHzFromGip => %'RU64\n",
+            pGip->u64CpuHz, pGip->u64CpuHz, SUPGetCpuHzFromGip(pGip)));
+    for (uint32_t iCpuSet = 0; iCpuSet < RT_ELEMENTS(pGip->aiCpuFromCpuSetIdx); iCpuSet++)
     {
-        if (g_pSUPGlobalInfoPage->u32Mode == SUPGIPMODE_SYNC_TSC)
-            pVM->tm.s.pfnVirtualGetRawR3 = RTTimeNanoTSLegacySync;
-        else
-            pVM->tm.s.pfnVirtualGetRawR3 = RTTimeNanoTSLegacyAsync;
+        uint16_t iGipCpu = pGip->aiCpuFromCpuSetIdx[iCpuSet];
+        if (iGipCpu != UINT16_MAX)
+            LogRel(("TM: GIP - CPU: iCpuSet=%#x idCpu=%#x idApic=%#x iGipCpu=%#x i64TSCDelta=%RI64 enmState=%d u64CpuHz=%RU64(*) cErrors=%u\n",
+                    iCpuSet, pGip->aCPUs[iGipCpu].idCpu, pGip->aCPUs[iGipCpu].idApic, iGipCpu, pGip->aCPUs[iGipCpu].i64TSCDelta,
+                    pGip->aCPUs[iGipCpu].enmState, pGip->aCPUs[iGipCpu].u64CpuHz, pGip->aCPUs[iGipCpu].cErrors));
     }
 
-    pVM->tm.s.VirtualGetRawDataRC.pu64Prev = MMHyperR3ToRC(pVM, (void *)&pVM->tm.s.u64VirtualRawPrev);
-    pVM->tm.s.VirtualGetRawDataR0.pu64Prev = MMHyperR3ToR0(pVM, (void *)&pVM->tm.s.u64VirtualRawPrev);
+    /*
+     * Setup the VirtualGetRaw backend.
+     */
+    pVM->tm.s.pfnVirtualGetRawR3                 = tmVirtualNanoTSRediscover;
+    pVM->tm.s.VirtualGetRawDataR3.pfnRediscover  = tmVirtualNanoTSRediscover;
+    pVM->tm.s.VirtualGetRawDataR3.pfnBad         = tmVirtualNanoTSBadPrev;
+    pVM->tm.s.VirtualGetRawDataR3.pfnBadCpuIndex = tmVirtualNanoTSBadCpuIndex;
+    pVM->tm.s.VirtualGetRawDataR3.pu64Prev       = &pVM->tm.s.u64VirtualRawPrev;
+    pVM->tm.s.VirtualGetRawDataRC.pu64Prev       = MMHyperR3ToRC(pVM, (void *)&pVM->tm.s.u64VirtualRawPrev);
+    pVM->tm.s.VirtualGetRawDataR0.pu64Prev       = MMHyperR3ToR0(pVM, (void *)&pVM->tm.s.u64VirtualRawPrev);
     AssertRelease(pVM->tm.s.VirtualGetRawDataR0.pu64Prev);
-    /* The rest is done in TMR3InitFinalize since it's too early to call PDM. */
+    /* The rest is done in TMR3InitFinalize() since it's too early to call PDM. */
 
     /*
      * Init the locks.
@@ -309,65 +312,113 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
     }
 
     /*
+     * Specific errors about some obsolete TM settings (remove after 2015-12-03).
+     */
+    if (CFGMR3Exists(pCfgHandle, "TSCVirtualized"))
+        return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS,
+                          N_("Configuration error: TM setting \"TSCVirtualized\" is no longer supported. Use the \"Mode\" setting instead."));
+    if (CFGMR3Exists(pCfgHandle, "UseRealTSC"))
+        return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS,
+                          N_("Configuration error: TM setting \"UseRealTSC\" is no longer supported. Use the \"Mode\" setting instead."));
+
+    if (CFGMR3Exists(pCfgHandle, "MaybeUseOffsettedHostTSC"))
+        return VMSetError(pVM, VERR_CFGM_CONFIG_UNKNOWN_VALUE, RT_SRC_POS,
+                          N_("Configuration error: TM setting \"MaybeUseOffsettedHostTSC\" is no longer supported. Use the \"Mode\" setting instead."));
+
+    /*
+     * Validate the rest of the TM settings.
+     */
+    rc = CFGMR3ValidateConfig(pCfgHandle, "/TM/",
+                              "TSCMode|"
+                              "TSCModeSwitchAllowed|"
+                              "TSCTicksPerSecond|"
+                              "TSCTiedToExecution|"
+                              "TSCNotTiedToHalt|"
+                              "ScheduleSlack|"
+                              "CatchUpStopThreshold|"
+                              "CatchUpGiveUpThreshold|"
+                              "CatchUpStartThreshold0|CatchUpStartThreshold1|CatchUpStartThreshold2|CatchUpStartThreshold3|"
+                              "CatchUpStartThreshold4|CatchUpStartThreshold5|CatchUpStartThreshold6|CatchUpStartThreshold7|"
+                              "CatchUpStartThreshold8|CatchUpStartThreshold9|"
+                              "CatchUpPrecentage0|CatchUpPrecentage1|CatchUpPrecentage2|CatchUpPrecentage3|"
+                              "CatchUpPrecentage4|CatchUpPrecentage5|CatchUpPrecentage6|CatchUpPrecentage7|"
+                              "CatchUpPrecentage8|CatchUpPrecentage9|"
+                              "UTCOffset|"
+                              "WarpDrivePercentage|"
+                              "HostHzMax|"
+                              "HostHzFudgeFactorTimerCpu|"
+                              "HostHzFudgeFactorOtherCpu|"
+                              "HostHzFudgeFactorCatchUp100|"
+                              "HostHzFudgeFactorCatchUp200|"
+                              "HostHzFudgeFactorCatchUp400|"
+                              "TimerMillies",
+                              "",
+                              "TM", 0);
+    if (RT_FAILURE(rc))
+        return rc;
+
+    /*
      * Determine the TSC configuration and frequency.
      */
-    /* mode */
-    /** @cfgm{/TM/TSCVirtualized,bool,true}
-     * Use a virtualize TSC, i.e. trap all TSC access. */
-    rc = CFGMR3QueryBool(pCfgHandle, "TSCVirtualized", &pVM->tm.s.fTSCVirtualized);
+    /** @cfgm{/TM/TSCMode, string, Depends on the CPU and VM config}
+     * The name of the TSC mode to use: VirtTSCEmulated, RealTSCOffset or Dynamic.
+     * The default depends on the VM configuration and the capabilities of the
+     * host CPU.  Other config options or runtime changes may override the TSC
+     * mode specified here.
+     */
+    char szTSCMode[32];
+    rc = CFGMR3QueryString(pCfgHandle, "TSCMode", szTSCMode, sizeof(szTSCMode));
     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
-        pVM->tm.s.fTSCVirtualized = true; /* trap rdtsc */
+    {
+        /** @todo Rainy-day/never: Dynamic mode isn't currently suitable for SMP VMs, so
+         * fall back on the more expensive emulated mode. With the current TSC handling
+         * (frequent switching between offsetted mode and taking VM exits, on all VCPUs
+         * without any kind of coordination) will lead to inconsistent TSC behavior with
+         * guest SMP, including TSC going backwards. */
+        pVM->tm.s.enmTSCMode = pVM->cCpus == 1 && tmR3HasFixedTSC(pVM) ? TMTSCMODE_DYNAMIC : TMTSCMODE_VIRT_TSC_EMULATED;
+    }
     else if (RT_FAILURE(rc))
-        return VMSetError(pVM, rc, RT_SRC_POS,
-                          N_("Configuration error: Failed to querying bool value \"UseRealTSC\""));
+        return VMSetError(pVM, rc, RT_SRC_POS, N_("Configuration error: Failed to querying string value \"TSCMode\""));
+    else
+    {
+        if (!RTStrCmp(szTSCMode, "VirtTSCEmulated"))
+            pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED;
+        else if (!RTStrCmp(szTSCMode, "RealTSCOffset"))
+            pVM->tm.s.enmTSCMode = TMTSCMODE_REAL_TSC_OFFSET;
+        else if (!RTStrCmp(szTSCMode, "Dynamic"))
+            pVM->tm.s.enmTSCMode = TMTSCMODE_DYNAMIC;
+        else
+            return VMSetError(pVM, rc, RT_SRC_POS, N_("Configuration error: Unrecognized TM TSC mode value \"%s\""), szTSCMode);
+    }
 
-    /* source */
-    /** @cfgm{/TM/UseRealTSC,bool,false}
-     * Use the real TSC as time source for the TSC instead of the synchronous
-     * virtual clock (false, default). */
-    rc = CFGMR3QueryBool(pCfgHandle, "UseRealTSC", &pVM->tm.s.fTSCUseRealTSC);
-    if (rc == VERR_CFGM_VALUE_NOT_FOUND)
-        pVM->tm.s.fTSCUseRealTSC = false; /* use virtual time */
-    else if (RT_FAILURE(rc))
-        return VMSetError(pVM, rc, RT_SRC_POS,
-                          N_("Configuration error: Failed to querying bool value \"UseRealTSC\""));
-    if (!pVM->tm.s.fTSCUseRealTSC)
-        pVM->tm.s.fTSCVirtualized = true;
-
-    /* TSC reliability */
-    /** @cfgm{/TM/MaybeUseOffsettedHostTSC,bool,detect}
-     * Whether the CPU has a fixed TSC rate and may be used in offsetted mode with
-     * VT-x/AMD-V execution.  This is autodetected in a very restrictive way by
-     * default. */
-    rc = CFGMR3QueryBool(pCfgHandle, "MaybeUseOffsettedHostTSC", &pVM->tm.s.fMaybeUseOffsettedHostTSC);
+    /**
+     * @cfgm{/TM/TSCModeSwitchAllowed, bool, Whether TM TSC mode switch is allowed
+     *      at runtime}
+     * When using paravirtualized guests, we dynamically switch TSC modes to a more
+     * optimal one for performance. This setting allows overriding this behaviour.
+     */
+    rc = CFGMR3QueryBool(pCfgHandle, "TSCModeSwitchAllowed", &pVM->tm.s.fTSCModeSwitchAllowed);
     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     {
-        if (!pVM->tm.s.fTSCUseRealTSC)
-            pVM->tm.s.fMaybeUseOffsettedHostTSC = tmR3HasFixedTSC(pVM);
-        else
-            pVM->tm.s.fMaybeUseOffsettedHostTSC = true;
-        /** @todo needs a better fix, for now disable offsetted mode for VMs
-         * with more than one VCPU. With the current TSC handling (frequent
-         * switching between offsetted mode and taking VM exits, on all VCPUs
-         * without any kind of coordination) it will lead to inconsistent TSC
-         * behavior with guest SMP, including TSC going backwards. */
-        if (pVM->cCpus != 1)
-            pVM->tm.s.fMaybeUseOffsettedHostTSC = false;
+        /* This is finally determined in TMR3InitFinalize() as GIM isn't initialized yet. */
+        pVM->tm.s.fTSCModeSwitchAllowed = true;
     }
+    else if (RT_FAILURE(rc))
+        return VMSetError(pVM, rc, RT_SRC_POS, N_("Configuration error: Failed to querying bool value \"TSCModeSwitchAllowed\""));
 
-    /** @cfgm{TM/TSCTicksPerSecond, uint32_t, Current TSC frequency from GIP}
+    /** @cfgm{/TM/TSCTicksPerSecond, uint32_t, Current TSC frequency from GIP}
      * The number of TSC ticks per second (i.e. the TSC frequency). This will
-     * override TSCUseRealTSC, TSCVirtualized and MaybeUseOffsettedHostTSC.
+     * override enmTSCMode.
      */
     rc = CFGMR3QueryU64(pCfgHandle, "TSCTicksPerSecond", &pVM->tm.s.cTSCTicksPerSecond);
     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     {
         pVM->tm.s.cTSCTicksPerSecond = tmR3CalibrateTSC(pVM);
-        if (    !pVM->tm.s.fTSCUseRealTSC
-            &&  pVM->tm.s.cTSCTicksPerSecond >= _4G)
+        if (   pVM->tm.s.enmTSCMode != TMTSCMODE_REAL_TSC_OFFSET
+            && pVM->tm.s.cTSCTicksPerSecond >= _4G)
         {
             pVM->tm.s.cTSCTicksPerSecond = _4G - 1; /* (A limitation of our math code) */
-            pVM->tm.s.fMaybeUseOffsettedHostTSC = false;
+            pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED;
         }
     }
     else if (RT_FAILURE(rc))
@@ -380,11 +431,10 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
                           pVM->tm.s.cTSCTicksPerSecond);
     else
     {
-        pVM->tm.s.fTSCUseRealTSC = pVM->tm.s.fMaybeUseOffsettedHostTSC = false;
-        pVM->tm.s.fTSCVirtualized = true;
+        pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED;
     }
 
-    /** @cfgm{TM/TSCTiedToExecution, bool, false}
+    /** @cfgm{/TM/TSCTiedToExecution, bool, false}
      * Whether the TSC should be tied to execution. This will exclude most of the
      * virtualization overhead, but will by default include the time spent in the
      * halt state (see TM/TSCNotTiedToHalt). This setting will override all other
@@ -396,14 +446,9 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
         return VMSetError(pVM, rc, RT_SRC_POS,
                           N_("Configuration error: Failed to querying bool value \"TSCTiedToExecution\""));
     if (pVM->tm.s.fTSCTiedToExecution)
-    {
-        /* tied to execution, override all other settings. */
-        pVM->tm.s.fTSCVirtualized = true;
-        pVM->tm.s.fTSCUseRealTSC = true;
-        pVM->tm.s.fMaybeUseOffsettedHostTSC = false;
-    }
+        pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED;
 
-    /** @cfgm{TM/TSCNotTiedToHalt, bool, true}
+    /** @cfgm{/TM/TSCNotTiedToHalt, bool, true}
      * For overriding the default of TM/TSCTiedToExecution, i.e. set this to false
      * to make the TSC freeze during HLT. */
     rc = CFGMR3QueryBoolDef(pCfgHandle, "TSCNotTiedToHalt", &pVM->tm.s.fTSCNotTiedToHalt, false);
@@ -411,20 +456,10 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
         return VMSetError(pVM, rc, RT_SRC_POS,
                           N_("Configuration error: Failed to querying bool value \"TSCNotTiedToHalt\""));
 
-    /* setup and report */
-    if (pVM->tm.s.fTSCVirtualized)
-        CPUMR3SetCR4Feature(pVM, X86_CR4_TSD, ~X86_CR4_TSD);
-    else
-        CPUMR3SetCR4Feature(pVM, 0, ~X86_CR4_TSD);
-    LogRel(("TM: cTSCTicksPerSecond=%#RX64 (%'RU64) fTSCVirtualized=%RTbool fTSCUseRealTSC=%RTbool\n"
-            "TM: fMaybeUseOffsettedHostTSC=%RTbool TSCTiedToExecution=%RTbool TSCNotTiedToHalt=%RTbool\n",
-            pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.fTSCVirtualized, pVM->tm.s.fTSCUseRealTSC,
-            pVM->tm.s.fMaybeUseOffsettedHostTSC, pVM->tm.s.fTSCTiedToExecution, pVM->tm.s.fTSCNotTiedToHalt));
-
     /*
      * Configure the timer synchronous virtual time.
      */
-    /** @cfgm{TM/ScheduleSlack, uint32_t, ns, 0, UINT32_MAX, 100000}
+    /** @cfgm{/TM/ScheduleSlack, uint32_t, ns, 0, UINT32_MAX, 100000}
      * Scheduling slack when processing timers. */
     rc = CFGMR3QueryU32(pCfgHandle, "ScheduleSlack", &pVM->tm.s.u32VirtualSyncScheduleSlack);
     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
@@ -433,7 +468,7 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
         return VMSetError(pVM, rc, RT_SRC_POS,
                           N_("Configuration error: Failed to querying 32-bit integer value \"ScheduleSlack\""));
 
-    /** @cfgm{TM/CatchUpStopThreshold, uint64_t, ns, 0, UINT64_MAX, 500000}
+    /** @cfgm{/TM/CatchUpStopThreshold, uint64_t, ns, 0, UINT64_MAX, 500000}
      * When to stop a catch-up, considering it successful. */
     rc = CFGMR3QueryU64(pCfgHandle, "CatchUpStopThreshold", &pVM->tm.s.u64VirtualSyncCatchUpStopThreshold);
     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
@@ -442,7 +477,7 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
         return VMSetError(pVM, rc, RT_SRC_POS,
                           N_("Configuration error: Failed to querying 64-bit integer value \"CatchUpStopThreshold\""));
 
-    /** @cfgm{TM/CatchUpGiveUpThreshold, uint64_t, ns, 0, UINT64_MAX, 60000000000}
+    /** @cfgm{/TM/CatchUpGiveUpThreshold, uint64_t, ns, 0, UINT64_MAX, 60000000000}
      * When to give up a catch-up attempt. */
     rc = CFGMR3QueryU64(pCfgHandle, "CatchUpGiveUpThreshold", &pVM->tm.s.u64VirtualSyncCatchUpGiveUpThreshold);
     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
@@ -452,9 +487,9 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
                           N_("Configuration error: Failed to querying 64-bit integer value \"CatchUpGiveUpThreshold\""));
 
 
-    /** @cfgm{TM/CatchUpPrecentage[0..9], uint32_t, %, 1, 2000, various}
+    /** @cfgm{/TM/CatchUpPrecentage[0..9], uint32_t, %, 1, 2000, various}
      * The catch-up percent for a given period.  */
-    /** @cfgm{TM/CatchUpStartThreshold[0..9], uint64_t, ns, 0, UINT64_MAX}
+    /** @cfgm{/TM/CatchUpStartThreshold[0..9], uint64_t, ns, 0, UINT64_MAX}
      * The catch-up period threshold, or if you like, when a period starts.  */
 #define TM_CFG_PERIOD(iPeriod, DefStart, DefPct) \
     do \
@@ -492,7 +527,7 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
     /*
      * Configure real world time (UTC).
      */
-    /** @cfgm{TM/UTCOffset, int64_t, ns, INT64_MIN, INT64_MAX, 0}
+    /** @cfgm{/TM/UTCOffset, int64_t, ns, INT64_MIN, INT64_MAX, 0}
      * The UTC offset. This is used to put the guest back or forwards in time.  */
     rc = CFGMR3QueryS64(pCfgHandle, "UTCOffset", &pVM->tm.s.offUTC);
     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
@@ -504,7 +539,7 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
     /*
      * Setup the warp drive.
      */
-    /** @cfgm{TM/WarpDrivePercentage, uint32_t, %, 0, 20000, 100}
+    /** @cfgm{/TM/WarpDrivePercentage, uint32_t, %, 0, 20000, 100}
      * The warp drive percentage, 100% is normal speed.  This is used to speed up
      * or slow down the virtual clock, which can be useful for fast forwarding
      * borring periods during tests. */
@@ -523,7 +558,10 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
                           pVM->tm.s.u32VirtualWarpDrivePercentage);
     pVM->tm.s.fVirtualWarpDrive = pVM->tm.s.u32VirtualWarpDrivePercentage != 100;
     if (pVM->tm.s.fVirtualWarpDrive)
-        LogRel(("TM: u32VirtualWarpDrivePercentage=%RI32\n", pVM->tm.s.u32VirtualWarpDrivePercentage));
+    {
+        pVM->tm.s.enmTSCMode = TMTSCMODE_VIRT_TSC_EMULATED;
+        LogRel(("TM: Warp-drive active. u32VirtualWarpDrivePercentage=%RI32\n", pVM->tm.s.u32VirtualWarpDrivePercentage));
+    }
 
     /*
      * Gather the Host Hz configuration values.
@@ -559,9 +597,19 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
                           N_("Configuration error: Failed to querying uint32_t value \"HostHzFudgeFactorCatchUp400\""));
 
     /*
+     * Finally, setup and report.
+     */
+    pVM->tm.s.enmOriginalTSCMode = pVM->tm.s.enmTSCMode;
+    CPUMR3SetCR4Feature(pVM, X86_CR4_TSD, ~X86_CR4_TSD);
+    LogRel(("TM: cTSCTicksPerSecond=%'RU64 (%#RX64) enmTSCMode=%d (%s)\n"
+            "TM: TSCTiedToExecution=%RTbool TSCNotTiedToHalt=%RTbool\n",
+            pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.enmTSCMode, tmR3GetTSCModeName(pVM),
+            pVM->tm.s.fTSCTiedToExecution, pVM->tm.s.fTSCNotTiedToHalt));
+
+    /*
      * Start the timer (guard against REM not yielding).
      */
-    /** @cfgm{TM/TimerMillies, uint32_t, ms, 1, 1000, 10}
+    /** @cfgm{/TM/TimerMillies, uint32_t, ms, 1, 1000, 10}
      * The watchdog timer interval.  */
     uint32_t u32Millies;
     rc = CFGMR3QueryU32(pCfgHandle, "TimerMillies", &u32Millies);
@@ -686,6 +734,7 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
     STAM_REG(pVM, &pVM->tm.s.StatVirtualResume,                       STAMTYPE_COUNTER, "/TM/VirtualResume",                   STAMUNIT_OCCURENCES, "The number of times TMR3TimerResume was called.");
 
     STAM_REG(pVM, &pVM->tm.s.StatTimerCallbackSetFF,                  STAMTYPE_COUNTER, "/TM/CallbackSetFF",                   STAMUNIT_OCCURENCES, "The number of times the timer callback set FF.");
+    STAM_REG(pVM, &pVM->tm.s.StatTimerCallback,                       STAMTYPE_COUNTER, "/TM/Callback",                        STAMUNIT_OCCURENCES, "The number of times the timer callback is invoked.");
 
     STAM_REG(pVM, &pVM->tm.s.StatTSCCatchupLE010,                     STAMTYPE_COUNTER, "/TM/TSC/Intercept/CatchupLE010",      STAMUNIT_OCCURENCES, "In catch-up mode, 10% or lower.");
     STAM_REG(pVM, &pVM->tm.s.StatTSCCatchupLE025,                     STAMTYPE_COUNTER, "/TM/TSC/Intercept/CatchupLE025",      STAMUNIT_OCCURENCES, "In catch-up mode, 25%-11%.");
@@ -768,16 +817,42 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
  *
  * @returns true if it has, false if it hasn't.
  *
- * @remark  This test doesn't bother with very old CPUs that don't do power
+ * @remarks This test doesn't bother with very old CPUs that don't do power
  *          management or any other stuff that might influence the TSC rate.
  *          This isn't currently relevant.
  */
 static bool tmR3HasFixedTSC(PVM pVM)
 {
+    /*
+     * ASSUME that if the GIP is in invariant TSC mode, it's because the CPU
+     * actually has invariant TSC.
+     */
+    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    if (pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC)
+        return true;
+
+    /*
+     * Go by features and model info from the CPUID instruction.
+     */
     if (ASMHasCpuId())
     {
         uint32_t uEAX, uEBX, uECX, uEDX;
 
+        /*
+         * By feature. (Used to be AMD specific, intel seems to have picked it up.)
+         */
+        ASMCpuId(0x80000000, &uEAX, &uEBX, &uECX, &uEDX);
+        if (uEAX >= 0x80000007 && ASMIsValidExtRange(uEAX))
+        {
+            ASMCpuId(0x80000007, &uEAX, &uEBX, &uECX, &uEDX);
+            if (   (uEDX & X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR) /* TscInvariant */
+                && pGip->u32Mode != SUPGIPMODE_ASYNC_TSC)       /* No fixed tsc if the gip timer is in async mode. */
+                return true;
+        }
+
+        /*
+         * By model.
+         */
         if (CPUMGetHostCpuVendor(pVM) == CPUMCPUVENDOR_AMD)
         {
             /*
@@ -787,16 +862,17 @@ static bool tmR3HasFixedTSC(PVM pVM)
              * older models, but this isn't relevant since the result is currently
              * only used for making a decision on AMD-V models.
              */
+#if 0 /* Promoted to generic */
             ASMCpuId(0x80000000, &uEAX, &uEBX, &uECX, &uEDX);
             if (uEAX >= 0x80000007)
             {
-                PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
-
                 ASMCpuId(0x80000007, &uEAX, &uEBX, &uECX, &uEDX);
                 if (   (uEDX & X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR) /* TscInvariant */
-                    && pGip->u32Mode == SUPGIPMODE_SYNC_TSC /* no fixed tsc if the gip timer is in async mode */)
+                    && (   pGip->u32Mode == SUPGIPMODE_SYNC_TSC     /* No fixed tsc if the gip timer is in async mode. */
+                        || pGip->u32Mode == SUPGIPMODE_INVARIANT_TSC))
                     return true;
             }
+#endif
         }
         else if (CPUMGetHostCpuVendor(pVM) == CPUMCPUVENDOR_INTEL)
         {
@@ -806,6 +882,7 @@ static bool tmR3HasFixedTSC(PVM pVM)
              * This test is lacking in the same way and for the same reasons
              * as the AMD test above.
              */
+            /** @todo use ASMGetCpuFamily() and ASMGetCpuModel() here. */
             ASMCpuId(1, &uEAX, &uEBX, &uECX, &uEDX);
             unsigned uModel  = (uEAX >> 4) & 0x0f;
             unsigned uFamily = (uEAX >> 8) & 0x0f;
@@ -825,6 +902,7 @@ static bool tmR3HasFixedTSC(PVM pVM)
              * This only checks for VIA CPU models Nano X2, Nano X3,
              * Eden X2 and QuadCore.
              */
+            /** @todo use ASMGetCpuFamily() and ASMGetCpuModel() here. */
             ASMCpuId(1, &uEAX, &uEBX, &uECX, &uEDX);
             unsigned uStepping = (uEAX & 0x0f);
             unsigned uModel    = (uEAX >> 4) & 0x0f;
@@ -833,9 +911,7 @@ static bool tmR3HasFixedTSC(PVM pVM)
                 && uModel    == 0x0f
                 && uStepping >= 0x0c
                 && uStepping <= 0x0f)
-            {
                 return true;
-            }
         }
     }
     return false;
@@ -849,29 +925,28 @@ static bool tmR3HasFixedTSC(PVM pVM)
  */
 static uint64_t tmR3CalibrateTSC(PVM pVM)
 {
+    uint64_t u64Hz;
+
     /*
-     * Use GIP when available present.
+     * Use GIP when available. Prefere the nominal one, no need to wait for it.
      */
-    uint64_t u64Hz = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage);
-    if (u64Hz != UINT64_MAX)
+    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
+    if (pGip)
     {
-        if (tmR3HasFixedTSC(pVM))
-            /* Sleep a bit to get a more reliable CpuHz value. */
-            RTThreadSleep(32);
-        else
-        {
-            /* Spin for 40ms to try push up the CPU frequency and get a more reliable CpuHz value. */
-            const uint64_t u64 = RTTimeMilliTS();
-            while ((RTTimeMilliTS() - u64) < 40 /*ms*/)
-                /* nothing */;
-        }
+        u64Hz = pGip->u64CpuHz;
+        if (u64Hz < _1T && u64Hz > _1M)
+            return u64Hz;
+        AssertFailed(); /* This shouldn't happen. */
 
-        u64Hz = SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage);
-        if (u64Hz != UINT64_MAX)
+        u64Hz = SUPGetCpuHzFromGip(pGip);
+        if (u64Hz < _1T && u64Hz > _1M)
             return u64Hz;
+
+        AssertFailed(); /* This shouldn't happen. */
     }
+    /* else: This should only happen in fake SUPLib mode, which we don't really support any more... */
 
-    /* call this once first to make sure it's initialized. */
+    /* Call this once first to make sure it's initialized. */
     RTTimeNanoTS();
 
     /*
@@ -943,38 +1018,22 @@ VMM_INT_DECL(int) TMR3InitFinalize(PVM pVM)
      */
     if (!HMIsEnabled(pVM))
     {
-        rc = PDMR3LdrGetSymbolRC(pVM, NULL, "tmVirtualNanoTSBad",          &pVM->tm.s.VirtualGetRawDataRC.pfnBad);
+        rc = PDMR3LdrGetSymbolRC(pVM, NULL, "tmVirtualNanoTSBadPrev",       &pVM->tm.s.VirtualGetRawDataRC.pfnBad);
         AssertRCReturn(rc, rc);
-        rc = PDMR3LdrGetSymbolRC(pVM, NULL, "tmVirtualNanoTSRediscover",   &pVM->tm.s.VirtualGetRawDataRC.pfnRediscover);
+        rc = PDMR3LdrGetSymbolRC(pVM, NULL, "tmVirtualNanoTSBadCpuIndex",   &pVM->tm.s.VirtualGetRawDataRC.pfnBadCpuIndex);
         AssertRCReturn(rc, rc);
-        if (pVM->tm.s.pfnVirtualGetRawR3       == RTTimeNanoTSLFenceSync)
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "RTTimeNanoTSLFenceSync",  &pVM->tm.s.pfnVirtualGetRawRC);
-        else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLFenceAsync)
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "RTTimeNanoTSLFenceAsync", &pVM->tm.s.pfnVirtualGetRawRC);
-        else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLegacySync)
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "RTTimeNanoTSLegacySync",  &pVM->tm.s.pfnVirtualGetRawRC);
-        else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLegacyAsync)
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "RTTimeNanoTSLegacyAsync", &pVM->tm.s.pfnVirtualGetRawRC);
-        else
-            AssertFatalFailed();
+        rc = PDMR3LdrGetSymbolRC(pVM, NULL, "tmVirtualNanoTSRediscover",    &pVM->tm.s.VirtualGetRawDataRC.pfnRediscover);
         AssertRCReturn(rc, rc);
+        pVM->tm.s.pfnVirtualGetRawRC = pVM->tm.s.VirtualGetRawDataRC.pfnRediscover;
     }
 
-    rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSBad",          &pVM->tm.s.VirtualGetRawDataR0.pfnBad);
+    rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSBadPrev",       &pVM->tm.s.VirtualGetRawDataR0.pfnBad);
     AssertRCReturn(rc, rc);
-    rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSRediscover",   &pVM->tm.s.VirtualGetRawDataR0.pfnRediscover);
+    rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSBadCpuIndex",   &pVM->tm.s.VirtualGetRawDataR0.pfnBadCpuIndex);
     AssertRCReturn(rc, rc);
-    if (pVM->tm.s.pfnVirtualGetRawR3       == RTTimeNanoTSLFenceSync)
-        rc = PDMR3LdrGetSymbolR0(pVM, NULL, "RTTimeNanoTSLFenceSync",  &pVM->tm.s.pfnVirtualGetRawR0);
-    else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLFenceAsync)
-        rc = PDMR3LdrGetSymbolR0(pVM, NULL, "RTTimeNanoTSLFenceAsync", &pVM->tm.s.pfnVirtualGetRawR0);
-    else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLegacySync)
-        rc = PDMR3LdrGetSymbolR0(pVM, NULL, "RTTimeNanoTSLegacySync",  &pVM->tm.s.pfnVirtualGetRawR0);
-    else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLegacyAsync)
-        rc = PDMR3LdrGetSymbolR0(pVM, NULL, "RTTimeNanoTSLegacyAsync", &pVM->tm.s.pfnVirtualGetRawR0);
-    else
-        AssertFatalFailed();
+    rc = PDMR3LdrGetSymbolR0(pVM, NULL, "tmVirtualNanoTSRediscover",    &pVM->tm.s.VirtualGetRawDataR0.pfnRediscover);
     AssertRCReturn(rc, rc);
+    pVM->tm.s.pfnVirtualGetRawR0 = pVM->tm.s.VirtualGetRawDataR0.pfnRediscover;
 
 #ifndef VBOX_WITHOUT_NS_ACCOUNTING
     /*
@@ -986,6 +1045,11 @@ VMM_INT_DECL(int) TMR3InitFinalize(PVM pVM)
         rc = TMTimerSetMillies(pTimer, 1000);
 #endif
 
+    /*
+     * GIM is now initialized. Determine if TSC mode switching is allowed (respecting CFGM override).
+     */
+    pVM->tm.s.fTSCModeSwitchAllowed &= tmR3HasFixedTSC(pVM) && GIMIsEnabled(pVM) && HMIsEnabled(pVM);
+    LogRel(("TM: TMR3InitFinalize: fTSCModeSwitchAllowed=%RTbool\n", pVM->tm.s.fTSCModeSwitchAllowed));
     return rc;
 }
 
@@ -1000,34 +1064,19 @@ VMM_INT_DECL(int) TMR3InitFinalize(PVM pVM)
  */
 VMM_INT_DECL(void) TMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
 {
-    int rc;
     LogFlow(("TMR3Relocate\n"));
-    NOREF(offDelta);
 
     pVM->tm.s.paTimerQueuesR0 = MMHyperR3ToR0(pVM, pVM->tm.s.paTimerQueuesR3);
 
     if (!HMIsEnabled(pVM))
     {
-        pVM->tm.s.pvGIPRC = MMHyperR3ToRC(pVM, pVM->tm.s.pvGIPR3);
-        pVM->tm.s.paTimerQueuesRC = MMHyperR3ToRC(pVM, pVM->tm.s.paTimerQueuesR3);
-        pVM->tm.s.VirtualGetRawDataRC.pu64Prev = MMHyperR3ToRC(pVM, (void *)&pVM->tm.s.u64VirtualRawPrev);
-        AssertFatal(pVM->tm.s.VirtualGetRawDataRC.pu64Prev);
-        rc = PDMR3LdrGetSymbolRC(pVM, NULL, "tmVirtualNanoTSBad",          &pVM->tm.s.VirtualGetRawDataRC.pfnBad);
-        AssertFatalRC(rc);
-        rc = PDMR3LdrGetSymbolRC(pVM, NULL, "tmVirtualNanoTSRediscover",   &pVM->tm.s.VirtualGetRawDataRC.pfnRediscover);
-        AssertFatalRC(rc);
-
-        if (pVM->tm.s.pfnVirtualGetRawR3       == RTTimeNanoTSLFenceSync)
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "RTTimeNanoTSLFenceSync",  &pVM->tm.s.pfnVirtualGetRawRC);
-        else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLFenceAsync)
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "RTTimeNanoTSLFenceAsync", &pVM->tm.s.pfnVirtualGetRawRC);
-        else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLegacySync)
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "RTTimeNanoTSLegacySync",  &pVM->tm.s.pfnVirtualGetRawRC);
-        else if (pVM->tm.s.pfnVirtualGetRawR3  == RTTimeNanoTSLegacyAsync)
-            rc = PDMR3LdrGetSymbolRC(pVM, NULL, "RTTimeNanoTSLegacyAsync", &pVM->tm.s.pfnVirtualGetRawRC);
-        else
-            AssertFatalFailed();
-        AssertFatalRC(rc);
+        pVM->tm.s.pvGIPRC           = MMHyperR3ToRC(pVM, pVM->tm.s.pvGIPR3);
+        pVM->tm.s.paTimerQueuesRC   = MMHyperR3ToRC(pVM, pVM->tm.s.paTimerQueuesR3);
+        pVM->tm.s.VirtualGetRawDataRC.pu64Prev       += offDelta;
+        pVM->tm.s.VirtualGetRawDataRC.pfnBad         += offDelta;
+        pVM->tm.s.VirtualGetRawDataRC.pfnBadCpuIndex += offDelta;
+        pVM->tm.s.VirtualGetRawDataRC.pfnRediscover  += offDelta;
+        pVM->tm.s.pfnVirtualGetRawRC                 += offDelta;
     }
 
     /*
@@ -1112,6 +1161,20 @@ VMM_INT_DECL(void) TMR3Reset(PVM pVM)
 
     PVMCPU pVCpuDst = &pVM->aCpus[pVM->tm.s.idTimerCpu];
     VMCPU_FF_CLEAR(pVCpuDst, VMCPU_FF_TIMER); /** @todo FIXME: this isn't right. */
+
+    /*
+     * Switch TM TSC mode back to the original mode after a reset for
+     * paravirtualized guests that alter the TM TSC mode during operation.
+     */
+    if (   pVM->tm.s.fTSCModeSwitchAllowed
+        && pVM->tm.s.enmTSCMode != pVM->tm.s.enmOriginalTSCMode)
+    {
+        VM_ASSERT_EMT0(pVM);
+        tmR3CpuTickParavirtDisable(pVM, &pVM->aCpus[0], NULL /* pvData */);
+    }
+    Assert(!GIMIsParavirtTscEnabled(pVM));
+    pVM->tm.s.fParavirtTscEnabled = false;
+
     TM_UNLOCK_TIMERS(pVM);
 }
 
@@ -1276,18 +1339,20 @@ static DECLCALLBACK(int) tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, u
         if (pVM->tm.s.u64LastPausedTSC < pVCpu->tm.s.u64TSC)
             pVM->tm.s.u64LastPausedTSC = pVCpu->tm.s.u64TSC;
 
-        if (pVM->tm.s.fTSCUseRealTSC)
+        if (pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET)
             pVCpu->tm.s.offTSCRawSrc = 0; /** @todo TSC restore stuff and HWACC. */
     }
 
     rc = SSMR3GetU64(pSSM, &u64Hz);
     if (RT_FAILURE(rc))
         return rc;
-    if (!pVM->tm.s.fTSCUseRealTSC)
+    if (pVM->tm.s.enmTSCMode != TMTSCMODE_REAL_TSC_OFFSET)
         pVM->tm.s.cTSCTicksPerSecond = u64Hz;
+    /** @todo Compare with real TSC rate even when restoring with real-tsc-offset
+     *        mode. */
 
-    LogRel(("TM: cTSCTicksPerSecond=%#RX64 (%'RU64) fTSCVirtualized=%RTbool fTSCUseRealTSC=%RTbool (state load)\n",
-            pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.fTSCVirtualized, pVM->tm.s.fTSCUseRealTSC));
+    LogRel(("TM: cTSCTicksPerSecond=%#RX64 (%'RU64) enmTSCMode=%d (%s) (state load)\n",
+            pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.cTSCTicksPerSecond, pVM->tm.s.enmTSCMode, tmR3GetTSCModeName(pVM)));
 
     /*
      * Make sure timers get rescheduled immediately.
@@ -1899,6 +1964,8 @@ static DECLCALLBACK(void) tmR3TimerCallback(PRTTIMER pTimer, void *pvUser, uint6
     NOREF(pTimer);
 
     AssertCompile(TMCLOCK_MAX == 4);
+    STAM_COUNTER_INC(&pVM->tm.s.StatTimerCallback);
+
 #ifdef DEBUG_Sander /* very annoying, keep it private. */
     if (VMCPU_FF_IS_SET(pVCpuDst, VMCPU_FF_TIMER))
         Log(("tmR3TimerCallback: timer event still pending!!\n"));
@@ -1919,7 +1986,7 @@ static DECLCALLBACK(void) tmR3TimerCallback(PRTTIMER pTimer, void *pvUser, uint6
 #ifdef VBOX_WITH_REM
         REMR3NotifyTimerPending(pVM, pVCpuDst);
 #endif
-        VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM /** @todo | VMNOTIFYFF_FLAGS_POKE ?*/);
+        VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM | VMNOTIFYFF_FLAGS_POKE);
         STAM_COUNTER_INC(&pVM->tm.s.StatTimerCallbackSetFF);
     }
 }
@@ -2801,6 +2868,7 @@ static DECLCALLBACK(int) tmR3SetWarpDrive(PUVM pUVM, uint32_t u32Percent)
     if (fPaused) /** @todo this isn't really working, but wtf. */
         TMR3NotifySuspend(pVM, pVCpu);
 
+    /** @todo Should switch TM mode to virt-tsc-emulated if it isn't already! */
     pVM->tm.s.u32VirtualWarpDrivePercentage = u32Percent;
     pVM->tm.s.fVirtualWarpDrive = u32Percent != 100;
     LogRel(("TM: u32VirtualWarpDrivePercentage=%RI32 fVirtualWarpDrive=%RTbool\n",
@@ -3011,6 +3079,149 @@ static DECLCALLBACK(void) tmR3CpuLoadTimer(PVM pVM, PTMTIMER pTimer, void *pvUse
 
 #endif /* !VBOX_WITHOUT_NS_ACCOUNTING */
 
+
+/**
+ * @callback_method_impl{PFNVMMEMTRENDEZVOUS,
+ *      Worker for TMR3CpuTickParavirtEnable}
+ */
+static DECLCALLBACK(VBOXSTRICTRC) tmR3CpuTickParavirtEnable(PVM pVM, PVMCPU pVCpuEmt, void *pvData)
+{
+    AssertPtr(pVM); Assert(pVM->tm.s.fTSCModeSwitchAllowed); NOREF(pVCpuEmt); NOREF(pvData);
+    Assert(pVM->tm.s.enmTSCMode != TMTSCMODE_REAL_TSC_OFFSET);
+    Assert(tmR3HasFixedTSC(pVM));
+
+    /*
+     * The return value of TMCpuTickGet() and the guest's TSC value for each
+     * CPU must remain constant across the TM TSC mode-switch.  Thus we have
+     * the following equation (new/old signifies the new/old tsc modes):
+     *      uNewTsc = uOldTsc
+     *
+     * Where (see tmCpuTickGetInternal):
+     *      uOldTsc = uRawOldTsc - offTscRawSrcOld
+     *      uNewTsc = uRawNewTsc - offTscRawSrcNew
+     *
+     * Solve it for offTscRawSrcNew without replacing uOldTsc:
+     *     uRawNewTsc - offTscRawSrcNew = uOldTsc
+     *  => -offTscRawSrcNew = uOldTsc - uRawNewTsc
+     *  => offTscRawSrcNew  = uRawNewTsc - uOldTsc
+     */
+    uint64_t uRawOldTsc = tmR3CpuTickGetRawVirtualNoCheck(pVM);
+    uint64_t uRawNewTsc = SUPReadTsc();
+    uint32_t cCpus = pVM->cCpus;
+    for (uint32_t i = 0; i < cCpus; i++)
+    {
+        PVMCPU   pVCpu   = &pVM->aCpus[i];
+        uint64_t uOldTsc = uRawOldTsc - pVCpu->tm.s.offTSCRawSrc;
+        pVCpu->tm.s.offTSCRawSrc = uRawNewTsc - uOldTsc;
+        Assert(uRawNewTsc - pVCpu->tm.s.offTSCRawSrc >= uOldTsc); /* paranoia^256 */
+    }
+
+    LogRel(("TM: Switching TSC mode from '%s' to '%s'\n", tmR3GetTSCModeNameEx(pVM->tm.s.enmTSCMode),
+            tmR3GetTSCModeNameEx(TMTSCMODE_REAL_TSC_OFFSET)));
+    pVM->tm.s.enmTSCMode = TMTSCMODE_REAL_TSC_OFFSET;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Notify TM that the guest has enabled usage of a paravirtualized TSC.
+ *
+ * This may perform a EMT rendezvous and change the TSC virtualization mode.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) TMR3CpuTickParavirtEnable(PVM pVM)
+{
+    int rc = VINF_SUCCESS;
+    if (pVM->tm.s.fTSCModeSwitchAllowed)
+    {
+        if (pVM->tm.s.enmTSCMode != TMTSCMODE_REAL_TSC_OFFSET)
+            rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE, tmR3CpuTickParavirtEnable, NULL);
+    }
+    else
+        LogRel(("TM: Host/VM is not suitable for using TSC mode '%s', request to change TSC mode ignored\n",
+                tmR3GetTSCModeNameEx(TMTSCMODE_REAL_TSC_OFFSET)));
+    pVM->tm.s.fParavirtTscEnabled = true;
+    return rc;
+}
+
+
+/**
+ * @callback_method_impl{PFNVMMEMTRENDEZVOUS,
+ *      Worker for TMR3CpuTickParavirtDisable}
+ */
+static DECLCALLBACK(VBOXSTRICTRC) tmR3CpuTickParavirtDisable(PVM pVM, PVMCPU pVCpuEmt, void *pvData)
+{
+    AssertPtr(pVM); Assert(pVM->tm.s.fTSCModeSwitchAllowed); NOREF(pVCpuEmt);
+    Assert(   pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET
+           && pVM->tm.s.enmTSCMode != pVM->tm.s.enmOriginalTSCMode);
+
+    /*
+     * See tmR3CpuTickParavirtEnable for an explanation of the conversion math.
+     */
+    uint64_t uRawOldTsc = SUPReadTsc();
+    uint64_t uRawNewTsc = tmR3CpuTickGetRawVirtualNoCheck(pVM);
+    uint32_t cCpus = pVM->cCpus;
+    for (uint32_t i = 0; i < cCpus; i++)
+    {
+        PVMCPU   pVCpu   = &pVM->aCpus[i];
+        uint64_t uOldTsc = uRawOldTsc - pVCpu->tm.s.offTSCRawSrc;
+        pVCpu->tm.s.offTSCRawSrc = uRawNewTsc - uOldTsc;
+        Assert(uRawNewTsc - pVCpu->tm.s.offTSCRawSrc >= uOldTsc); /* paranoia^256 */
+
+        /* Update the last-seen tick here as we havent't been updating it (as we don't
+           need it) while in pure TSC-offsetting mode. */
+        pVCpu->tm.s.u64TSCLastSeen = uOldTsc;
+    }
+
+    LogRel(("TM: Switching TSC mode from '%s' to '%s'\n", tmR3GetTSCModeNameEx(pVM->tm.s.enmTSCMode),
+            tmR3GetTSCModeNameEx(pVM->tm.s.enmOriginalTSCMode)));
+    pVM->tm.s.enmTSCMode = pVM->tm.s.enmOriginalTSCMode;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Notify TM that the guest has disabled usage of a paravirtualized TSC.
+ *
+ * If TMR3CpuTickParavirtEnable() changed the TSC virtualization mode, this will
+ * perform an EMT  rendezvous to revert those changes.
+ *
+ * @returns VBox status code.
+ * @param   pVM     Pointer to the VM.
+ */
+VMMR3_INT_DECL(int) TMR3CpuTickParavirtDisable(PVM pVM)
+{
+    int rc = VINF_SUCCESS;
+    if (   pVM->tm.s.fTSCModeSwitchAllowed
+        && pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET
+        && pVM->tm.s.enmTSCMode != pVM->tm.s.enmOriginalTSCMode)
+        rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE, tmR3CpuTickParavirtDisable, NULL);
+    pVM->tm.s.fParavirtTscEnabled = false;
+    return rc;
+}
+
+
+/**
+ * Check whether the guest can be presented a fixed rate & monotonic TSC.
+ *
+ * @returns true if TSC is stable, false otherwise.
+ * @param   pVM                     Pointer to the VM.
+ * @param   fWithParavirtEnabled    Whether it's fixed & monotonic when
+ *                                  paravirt. TSC is enabled or not.
+ *
+ * @remarks Must be called only after TMR3InitFinalize().
+ */
+VMMR3_INT_DECL(bool) TMR3CpuTickIsFixedRateMonotonic(PVM pVM, bool fWithParavirtEnabled)
+{
+    /** @todo figure out what exactly we want here later. */
+    NOREF(fWithParavirtEnabled);
+    return (   tmR3HasFixedTSC(pVM)                                        /* Host has fixed-rate TSC. */
+            && g_pSUPGlobalInfoPage->u32Mode != SUPGIPMODE_ASYNC_TSC);     /* GIP thinks it's monotonic. */
+}
+
+
 /**
  * Gets the 5 char clock name for the info tables.
  *
@@ -3146,13 +3357,12 @@ static DECLCALLBACK(void) tmR3InfoClocks(PVM pVM, PCDBGFINFOHLP pHlp, const char
          * TSC
          */
         pHlp->pfnPrintf(pHlp,
-                        "Cpu Tick: %18RU64 (%#016RX64) %RU64Hz %s%s",
+                        "Cpu Tick: %18RU64 (%#016RX64) %RU64Hz %s - virtualized",
                         u64TSC, u64TSC, TMCpuTicksPerSecond(pVM),
-                        pVCpu->tm.s.fTSCTicking ? "ticking" : "paused",
-                        pVM->tm.s.fTSCVirtualized ? " - virtualized" : "");
-        if (pVM->tm.s.fTSCUseRealTSC)
+                        pVCpu->tm.s.fTSCTicking ? "ticking" : "paused");
+        if (pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET)
         {
-            pHlp->pfnPrintf(pHlp, " - real tsc");
+            pHlp->pfnPrintf(pHlp, " - real tsc offset");
             if (pVCpu->tm.s.offTSCRawSrc)
                 pHlp->pfnPrintf(pHlp, "\n          offset %RU64", pVCpu->tm.s.offTSCRawSrc);
         }
@@ -3196,3 +3406,34 @@ static DECLCALLBACK(void) tmR3InfoClocks(PVM pVM, PCDBGFINFOHLP pHlp, const char
                     u64Real, u64Real, TMRealGetFreq(pVM));
 }
 
+
+/**
+ * Gets the descriptive TM TSC mode name given the enum value.
+ *
+ * @returns The name.
+ * @param   pVM      Pointer to the VM.
+ */
+static const char *tmR3GetTSCModeNameEx(TMTSCMODE enmMode)
+{
+    switch (enmMode)
+    {
+        case TMTSCMODE_REAL_TSC_OFFSET:    return "RealTscOffset";
+        case TMTSCMODE_VIRT_TSC_EMULATED:  return "VirtTscEmulated";
+        case TMTSCMODE_DYNAMIC:            return "Dynamic";
+        default:                           return "???";
+    }
+}
+
+
+/**
+ * Gets the descriptive TM TSC mode name.
+ *
+ * @returns The name.
+ * @param   pVM      Pointer to the VM.
+ */
+static const char *tmR3GetTSCModeName(PVM pVM)
+{
+    Assert(pVM);
+    return tmR3GetTSCModeNameEx(pVM->tm.s.enmTSCMode);
+}
+
diff --git a/src/VBox/VMM/VMMR3/TRPM.cpp b/src/VBox/VMM/VMMR3/TRPM.cpp
index 8c12949..9a67f36 100644
--- a/src/VBox/VMM/VMMR3/TRPM.cpp
+++ b/src/VBox/VMM/VMMR3/TRPM.cpp
@@ -441,7 +441,7 @@ static VBOXIDTE_GENERIC     g_aIdt[256] =
 static DECLCALLBACK(int) trpmR3Save(PVM pVM, PSSMHANDLE pSSM);
 static DECLCALLBACK(int) trpmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
 #ifdef TRPM_TRACK_GUEST_IDT_CHANGES
-static DECLCALLBACK(int) trpmR3GuestIDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
+static FNPGMR3VIRTHANDLER trpmR3GuestIDTWriteHandler;
 #endif
 
 
@@ -454,6 +454,7 @@ static DECLCALLBACK(int) trpmR3GuestIDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void
 VMMR3DECL(int) TRPMR3Init(PVM pVM)
 {
     LogFlow(("TRPMR3Init\n"));
+    int rc;
 
     /*
      * Assert sizes and alignments.
@@ -489,7 +490,7 @@ VMMR3DECL(int) TRPMR3Init(PVM pVM)
     if (pTRPMNode)
     {
         bool f;
-        int rc = CFGMR3QueryBool(pTRPMNode, "SafeToDropGuestIDTMonitoring", &f);
+        rc = CFGMR3QueryBool(pTRPMNode, "SafeToDropGuestIDTMonitoring", &f);
         if (RT_SUCCESS(rc))
             pVM->trpm.s.fSafeToDropGuestIDTMonitoring = f;
     }
@@ -506,12 +507,35 @@ VMMR3DECL(int) TRPMR3Init(PVM pVM)
     memcpy(&pVM->trpm.s.aIdt[0], &g_aIdt[0], sizeof(pVM->trpm.s.aIdt));
 
     /*
+     * Register virtual access handlers.
+     */
+    pVM->trpm.s.hShadowIdtWriteHandlerType = NIL_PGMVIRTHANDLERTYPE;
+    pVM->trpm.s.hGuestIdtWriteHandlerType  = NIL_PGMVIRTHANDLERTYPE;
+#ifdef VBOX_WITH_RAW_MODE
+    if (!HMIsEnabled(pVM))
+    {
+# ifdef TRPM_TRACK_SHADOW_IDT_CHANGES
+        rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_HYPERVISOR, false /*fRelocUserRC*/,
+                                             NULL /*pfnInvalidateR3*/, NULL /*pfnHandlerR3*/,
+                                             "trpmRCShadowIDTWritePfHandler",
+                                             "Shadow IDT write access handler", &pVM->trpm.s.hShadowIdtWriteHandlerType);
+        AssertRCReturn(rc, rc);
+# endif
+        rc = PGMR3HandlerVirtualTypeRegister(pVM, PGMVIRTHANDLERKIND_WRITE, false /*fRelocUserRC*/,
+                                             NULL /*pfnInvalidateR3*/, trpmR3GuestIDTWriteHandler,
+                                             "trpmRCGuestIDTWritePfHandler",
+                                             "Guest IDT write access handler", &pVM->trpm.s.hGuestIdtWriteHandlerType);
+        AssertRCReturn(rc, rc);
+    }
+#endif /* VBOX_WITH_RAW_MODE */
+
+    /*
      * Register the saved state data unit.
      */
-    int rc = SSMR3RegisterInternal(pVM, "trpm", 1, TRPM_SAVED_STATE_VERSION, sizeof(TRPM),
-                                   NULL, NULL, NULL,
-                                   NULL, trpmR3Save, NULL,
-                                   NULL, trpmR3Load, NULL);
+    rc = SSMR3RegisterInternal(pVM, "trpm", 1, TRPM_SAVED_STATE_VERSION, sizeof(TRPM),
+                               NULL, NULL, NULL,
+                               NULL, trpmR3Save, NULL,
+                               NULL, trpmR3Load, NULL);
     if (RT_FAILURE(rc))
         return rc;
 
@@ -691,12 +715,13 @@ VMMR3DECL(void) TRPMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
 # ifdef TRPM_TRACK_SHADOW_IDT_CHANGES
     if (pVM->trpm.s.pvMonShwIdtRC != RTRCPTR_MAX)
     {
-        rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.pvMonShwIdtRC);
+        rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->trpm.s.pvMonShwIdtRC, true /*fHypervisor*/);
         AssertRC(rc);
     }
     pVM->trpm.s.pvMonShwIdtRC = VM_RC_ADDR(pVM, &pVM->trpm.s.aIdt[0]);
-    rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_HYPERVISOR, pVM->trpm.s.pvMonShwIdtRC, pVM->trpm.s.pvMonShwIdtRC + sizeof(pVM->trpm.s.aIdt) - 1,
-                                     0, 0, "trpmRCShadowIDTWriteHandler", 0, "Shadow IDT write access handler");
+    rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->trpm.s.hShadowIdtWriteHandlerType,
+                                     pVM->trpm.s.pvMonShwIdtRC, pVM->trpm.s.pvMonShwIdtRC + sizeof(pVM->trpm.s.aIdt) - 1,
+                                     NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
     AssertRC(rc);
 # endif
 
@@ -774,7 +799,7 @@ VMMR3DECL(void) TRPMR3Reset(PVM pVM)
     {
         if (!pVM->trpm.s.fSafeToDropGuestIDTMonitoring)
         {
-            int rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.GuestIdtr.pIdt);
+            int rc = PGMHandlerVirtualDeregister(pVM, VMMGetCpu(pVM), pVM->trpm.s.GuestIdtr.pIdt, false /*fHypervisor*/);
             AssertRC(rc);
         }
         pVM->trpm.s.GuestIdtr.pIdt = RTRCPTR_MAX;
@@ -823,6 +848,16 @@ VMMR3_INT_DECL(int) TRPMR3GetImportRC(PVM pVM, const char *pszSymbol, PRTRCPTR p
         *pRCPtrValue = VM_RC_ADDR(pVM, &pVM->trpm);
     else if (!strcmp(pszSymbol, "g_TRPMCPU"))
         *pRCPtrValue = VM_RC_ADDR(pVM, &pVM->aCpus[0].trpm);
+    else if (!strcmp(pszSymbol, "g_trpmGuestCtx"))
+    {
+        PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(VMMGetCpuById(pVM, 0));
+        *pRCPtrValue = VM_RC_ADDR(pVM, pCtx);
+    }
+    else if (!strcmp(pszSymbol, "g_trpmHyperCtx"))
+    {
+        PCPUMCTX pCtx = CPUMGetHyperCtxPtr(VMMGetCpuById(pVM, 0));
+        *pRCPtrValue = VM_RC_ADDR(pVM, pCtx);
+    }
     else if (!strcmp(pszSymbol, "g_trpmGuestCtxCore"))
     {
         PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(VMMGetCpuById(pVM, 0));
@@ -1081,12 +1116,13 @@ VMMR3DECL(int) TRPMR3SyncIDT(PVM pVM, PVMCPU pVCpu)
              */
             if (pVM->trpm.s.GuestIdtr.pIdt != RTRCPTR_MAX)
             {
-                rc = PGMHandlerVirtualDeregister(pVM, pVM->trpm.s.GuestIdtr.pIdt);
+                rc = PGMHandlerVirtualDeregister(pVM, pVCpu, pVM->trpm.s.GuestIdtr.pIdt, false /*fHypervisor*/);
                 AssertRCReturn(rc, rc);
             }
             /* limit is including */
-            rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, IDTR.pIdt, IDTR.pIdt + IDTR.cbIdt /* already inclusive */,
-                                             0, trpmR3GuestIDTWriteHandler, "trpmRCGuestIDTWriteHandler", 0, "Guest IDT write access handler");
+            rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->trpm.s.hGuestIdtWriteHandlerType,
+                                             IDTR.pIdt, IDTR.pIdt + IDTR.cbIdt /* already inclusive */,
+                                             NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
 
             if (rc == VERR_PGM_HANDLER_VIRTUAL_CONFLICT)
             {
@@ -1095,8 +1131,9 @@ VMMR3DECL(int) TRPMR3SyncIDT(PVM pVM, PVMCPU pVCpu)
                 if (PAGE_ADDRESS(IDTR.pIdt) != PAGE_ADDRESS(IDTR.pIdt + IDTR.cbIdt))
                     CSAMR3RemovePage(pVM, IDTR.pIdt + IDTR.cbIdt);
 
-                rc = PGMR3HandlerVirtualRegister(pVM, PGMVIRTHANDLERTYPE_WRITE, IDTR.pIdt, IDTR.pIdt + IDTR.cbIdt /* already inclusive */,
-                                                 0, trpmR3GuestIDTWriteHandler, "trpmRCGuestIDTWriteHandler", 0, "Guest IDT write access handler");
+                rc = PGMR3HandlerVirtualRegister(pVM, pVCpu, pVM->trpm.s.hGuestIdtWriteHandlerType,
+                                                 IDTR.pIdt, IDTR.pIdt + IDTR.cbIdt /* already inclusive */,
+                                                 NULL /*pvUserR3*/, NIL_RTR0PTR /*pvUserRC*/, NULL /*pszDesc*/);
             }
 
             AssertRCReturn(rc, rc);
@@ -1143,22 +1180,25 @@ VMMR3DECL(int) TRPMR3SyncIDT(PVM pVM, PVMCPU pVCpu)
  * @returns VINF_SUCCESS if the handler have carried out the operation.
  * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
  * @param   pVM             Pointer to the VM.
+ * @param   pVCpu           Pointer to the cross context CPU context for the
+ *                          calling EMT.
  * @param   GCPtr           The virtual address the guest is writing to. (not correct if it's an alias!)
  * @param   pvPtr           The HC mapping of that address.
  * @param   pvBuf           What the guest is reading/writing.
  * @param   cbBuf           How much it's reading/writing.
  * @param   enmAccessType   The access type.
+ * @param   enmOrigin       The origin of this call.
  * @param   pvUser          User argument.
  */
-static DECLCALLBACK(int) trpmR3GuestIDTWriteHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
-                                                    PGMACCESSTYPE enmAccessType, void *pvUser)
+static DECLCALLBACK(int) trpmR3GuestIDTWriteHandler(PVM pVM, PVMCPU pVCpu, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf,
+                                                    PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
 {
     Assert(enmAccessType == PGMACCESSTYPE_WRITE); NOREF(enmAccessType);
     Log(("trpmR3GuestIDTWriteHandler: write to %RGv size %d\n", GCPtr, cbBuf)); NOREF(GCPtr); NOREF(cbBuf);
-    NOREF(pvPtr); NOREF(pvUser); NOREF(pvBuf);
+    NOREF(pvPtr); NOREF(pvUser); NOREF(pvBuf); NOREF(enmOrigin); NOREF(pvUser);
     Assert(!HMIsEnabled(pVM));
 
-    VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_TRPM_SYNC_IDT);
+    VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT);
     return VINF_PGM_HANDLER_DO_DEFAULT;
 }
 # endif /* TRPM_TRACK_GUEST_IDT_CHANGES */
diff --git a/src/VBox/VMM/VMMR3/VM.cpp b/src/VBox/VMM/VMMR3/VM.cpp
index a1e5f21..43cbda0 100644
--- a/src/VBox/VMM/VMMR3/VM.cpp
+++ b/src/VBox/VMM/VMMR3/VM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -66,6 +66,7 @@
 #include <VBox/vmm/ssm.h>
 #include <VBox/vmm/ftm.h>
 #include <VBox/vmm/hm.h>
+#include <VBox/vmm/gim.h>
 #include "VMInternal.h"
 #include <VBox/vmm/vm.h>
 #include <VBox/vmm/uvm.h>
@@ -984,40 +985,48 @@ static int vmR3InitRing3(PVM pVM, PUVM pUVM)
                                                                 rc = DBGFR3Init(pVM);
                                                                 if (RT_SUCCESS(rc))
                                                                 {
-                                                                    rc = PDMR3Init(pVM);
+                                                                    /* GIM must be init'd before PDM, gimdevR3Construct()
+                                                                       requires GIM provider to be setup. */
+                                                                    rc = GIMR3Init(pVM);
                                                                     if (RT_SUCCESS(rc))
                                                                     {
-                                                                        rc = PGMR3InitDynMap(pVM);
+                                                                        rc = PDMR3Init(pVM);
                                                                         if (RT_SUCCESS(rc))
-                                                                            rc = MMR3HyperInitFinalize(pVM);
+                                                                        {
+                                                                            rc = PGMR3InitDynMap(pVM);
+                                                                            if (RT_SUCCESS(rc))
+                                                                                rc = MMR3HyperInitFinalize(pVM);
 #ifdef VBOX_WITH_RAW_MODE
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = PATMR3InitFinalize(pVM);
+                                                                            if (RT_SUCCESS(rc))
+                                                                                rc = PATMR3InitFinalize(pVM);
 #endif
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = PGMR3InitFinalize(pVM);
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = SELMR3InitFinalize(pVM);
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = TMR3InitFinalize(pVM);
+                                                                            if (RT_SUCCESS(rc))
+                                                                                rc = PGMR3InitFinalize(pVM);
+                                                                            if (RT_SUCCESS(rc))
+                                                                                rc = SELMR3InitFinalize(pVM);
+                                                                            if (RT_SUCCESS(rc))
+                                                                                rc = TMR3InitFinalize(pVM);
 #ifdef VBOX_WITH_REM
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = REMR3InitFinalize(pVM);
+                                                                            if (RT_SUCCESS(rc))
+                                                                                rc = REMR3InitFinalize(pVM);
 #endif
-                                                                        if (RT_SUCCESS(rc))
-                                                                        {
-                                                                            PGMR3MemSetup(pVM, false /*fAtReset*/);
-                                                                            PDMR3MemSetup(pVM, false /*fAtReset*/);
+                                                                            if (RT_SUCCESS(rc))
+                                                                            {
+                                                                                PGMR3MemSetup(pVM, false /*fAtReset*/);
+                                                                                PDMR3MemSetup(pVM, false /*fAtReset*/);
+                                                                            }
+                                                                            if (RT_SUCCESS(rc))
+                                                                                rc = vmR3InitDoCompleted(pVM, VMINITCOMPLETED_RING3);
+                                                                            if (RT_SUCCESS(rc))
+                                                                            {
+                                                                                LogFlow(("vmR3InitRing3: returns %Rrc\n", VINF_SUCCESS));
+                                                                                return VINF_SUCCESS;
+                                                                            }
+
+                                                                            int rc2 = PDMR3Term(pVM);
+                                                                            AssertRC(rc2);
                                                                         }
-                                                                        if (RT_SUCCESS(rc))
-                                                                            rc = vmR3InitDoCompleted(pVM, VMINITCOMPLETED_RING3);
-                                                                        if (RT_SUCCESS(rc))
-                                                                        {
-                                                                            LogFlow(("vmR3InitRing3: returns %Rrc\n", VINF_SUCCESS));
-                                                                            return VINF_SUCCESS;
-                                                                        }
-
-                                                                        int rc2 = PDMR3Term(pVM);
+                                                                        int rc2 = GIMR3Term(pVM);
                                                                         AssertRC(rc2);
                                                                     }
                                                                     int rc2 = DBGFR3Term(pVM);
@@ -1164,7 +1173,7 @@ static int vmR3InitDoCompleted(PVM pVM, VMINITCOMPLETED enmWhat)
     if (RT_SUCCESS(rc))
         rc = HMR3InitCompleted(pVM, enmWhat);
     if (RT_SUCCESS(rc))
-        rc = PGMR3InitCompleted(pVM, enmWhat);
+        rc = PGMR3InitCompleted(pVM, enmWhat);  /** @todo Why is this not inside VMMR3InitCompleted()? */
 #ifndef VBOX_WITH_RAW_MODE
     if (enmWhat == VMINITCOMPLETED_RING3)
     {
@@ -1240,7 +1249,7 @@ VMMR3_INT_DECL(void) VMR3Relocate(PVM pVM, RTGCINTPTR offDelta)
     SELMR3Relocate(pVM);                /* !hack! fix stack! */
     TRPMR3Relocate(pVM, offDelta);
 #ifdef VBOX_WITH_RAW_MODE
-    PATMR3Relocate(pVM);
+    PATMR3Relocate(pVM, (RTRCINTPTR)offDelta);
     CSAMR3Relocate(pVM, offDelta);
 #endif
     IOMR3Relocate(pVM, offDelta);
@@ -2480,13 +2489,13 @@ DECLCALLBACK(int) vmR3Destroy(PVM pVM)
 #if defined(VBOX_WITH_STATISTICS) || defined(LOG_ENABLED)
         RTLogFlags(NULL, "nodisabled nobuffered");
 #endif
-#ifdef VBOX_WITH_STATISTICS
-        STAMR3Dump(pUVM, "*");
-#else
+//#ifdef VBOX_WITH_STATISTICS
+//        STAMR3Dump(pUVM, "*");
+//#else
         LogRel(("************************* Statistics *************************\n"));
         STAMR3DumpToReleaseLog(pUVM, "*");
         LogRel(("********************* End of statistics **********************\n"));
-#endif
+//#endif
 
         /*
          * Destroy the VM components.
@@ -2787,6 +2796,7 @@ static DECLCALLBACK(VBOXSTRICTRC) vmR3Reset(PVM pVM, PVMCPU pVCpu, void *pvUser)
         PATMR3Reset(pVM);
         CSAMR3Reset(pVM);
 #endif
+        GIMR3Reset(pVM);                /* This must come *before* PDM and TM. */
         PDMR3Reset(pVM);
         PGMR3Reset(pVM);
         SELMR3Reset(pVM);
@@ -3298,7 +3308,7 @@ static bool vmR3ValidateStateTransition(VMSTATE enmStateOld, VMSTATE enmStateNew
  */
 static void vmR3DoAtState(PVM pVM, PUVM pUVM, VMSTATE enmStateNew, VMSTATE enmStateOld)
 {
-    LogRel(("Changing the VM state from '%s' to '%s'.\n", VMR3GetStateName(enmStateOld),  VMR3GetStateName(enmStateNew)));
+    LogRel(("Changing the VM state from '%s' to '%s'\n", VMR3GetStateName(enmStateOld),  VMR3GetStateName(enmStateNew)));
 
     for (PVMATSTATE pCur = pUVM->vm.s.pAtState; pCur; pCur = pCur->pNext)
     {
diff --git a/src/VBox/VMM/VMMR3/VMEmt.cpp b/src/VBox/VMM/VMMR3/VMEmt.cpp
index e03688c..80f4b15 100644
--- a/src/VBox/VMM/VMMR3/VMEmt.cpp
+++ b/src/VBox/VMM/VMMR3/VMEmt.cpp
@@ -720,7 +720,7 @@ static DECLCALLBACK(int) vmR3HaltGlobal1Halt(PUVMCPU pUVCpu, const uint32_t fMas
                 rc = VINF_SUCCESS;
             else if (RT_FAILURE(rc))
             {
-                rc = vmR3FatalWaitError(pUVCpu, "VMMR0_DO_GVMM_SCHED_HALT->%Rrc\n", rc);
+                rc = vmR3FatalWaitError(pUVCpu, "vmR3HaltGlobal1Halt: VMMR0_DO_GVMM_SCHED_HALT->%Rrc\n", rc);
                 break;
             }
             else
@@ -786,7 +786,7 @@ static DECLCALLBACK(int) vmR3HaltGlobal1Wait(PUVMCPU pUVCpu)
             rc = VINF_SUCCESS;
         else if (RT_FAILURE(rc))
         {
-            rc = vmR3FatalWaitError(pUVCpu, "VMMR0_DO_GVMM_SCHED_HALT->%Rrc\n", rc);
+            rc = vmR3FatalWaitError(pUVCpu, "vmR3HaltGlobal1Wait: VMMR0_DO_GVMM_SCHED_HALT->%Rrc\n", rc);
             break;
         }
     }
diff --git a/src/VBox/VMM/VMMR3/VMM.cpp b/src/VBox/VMM/VMMR3/VMM.cpp
index aeb8bd6..f17e497 100644
--- a/src/VBox/VMM/VMMR3/VMM.cpp
+++ b/src/VBox/VMM/VMMR3/VMM.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -83,6 +83,7 @@
 #include <VBox/vmm/pdmcritsectrw.h>
 #include <VBox/vmm/pdmapi.h>
 #include <VBox/vmm/cpum.h>
+#include <VBox/vmm/gim.h>
 #include <VBox/vmm/mm.h>
 #include <VBox/vmm/iom.h>
 #include <VBox/vmm/trpm.h>
@@ -169,7 +170,7 @@ VMMR3_INT_DECL(int) VMMR3Init(PVM pVM)
     pVM->vmm.s.hEvtMulRendezvousDone            = NIL_RTSEMEVENTMULTI;
     pVM->vmm.s.hEvtRendezvousDoneCaller         = NIL_RTSEMEVENT;
 
-    /** @cfgm{YieldEMTInterval, uint32_t, 1, UINT32_MAX, 23, ms}
+    /** @cfgm{/YieldEMTInterval, uint32_t, 1, UINT32_MAX, 23, ms}
      * The EMT yield interval.  The EMT yielding is a hack we employ to play a
      * bit nicer with the rest of the system (like for instance the GUI).
      */
@@ -178,7 +179,7 @@ VMMR3_INT_DECL(int) VMMR3Init(PVM pVM)
     AssertMsgRCReturn(rc, ("Configuration error. Failed to query \"YieldEMTInterval\", rc=%Rrc\n", rc), rc);
 
 
-    /** @cfgm{VMM/UsePeriodicPreemptionTimers, boolean, true}
+    /** @cfgm{/VMM/UsePeriodicPreemptionTimers, boolean, true}
      * Controls whether we employ per-cpu preemption timers to limit the time
      * spent executing guest code.  This option is not available on all
      * platforms and we will silently ignore this setting then.  If we are
@@ -424,6 +425,8 @@ static void vmmR3InitRegisterStats(PVM pVM)
     STAM_REG(pVM, &pVM->vmm.s.StatRZRetMMIOReadWrite,       STAMTYPE_COUNTER, "/VMM/RZRet/MMIOReadWrite",       STAMUNIT_OCCURENCES, "Number of VINF_IOM_R3_MMIO_READ_WRITE returns.");
     STAM_REG(pVM, &pVM->vmm.s.StatRZRetMMIOPatchRead,       STAMTYPE_COUNTER, "/VMM/RZRet/MMIOPatchRead",       STAMUNIT_OCCURENCES, "Number of VINF_IOM_HC_MMIO_PATCH_READ returns.");
     STAM_REG(pVM, &pVM->vmm.s.StatRZRetMMIOPatchWrite,      STAMTYPE_COUNTER, "/VMM/RZRet/MMIOPatchWrite",      STAMUNIT_OCCURENCES, "Number of VINF_IOM_HC_MMIO_PATCH_WRITE returns.");
+    STAM_REG(pVM, &pVM->vmm.s.StatRZRetMSRRead,             STAMTYPE_COUNTER, "/VMM/RZRet/MSRRead",             STAMUNIT_OCCURENCES, "Number of VINF_CPUM_R3_MSR_READ returns.");
+    STAM_REG(pVM, &pVM->vmm.s.StatRZRetMSRWrite,            STAMTYPE_COUNTER, "/VMM/RZRet/MSRWrite",            STAMUNIT_OCCURENCES, "Number of VINF_CPUM_R3_MSR_WRITE returns.");
     STAM_REG(pVM, &pVM->vmm.s.StatRZRetLDTFault,            STAMTYPE_COUNTER, "/VMM/RZRet/LDTFault",            STAMUNIT_OCCURENCES, "Number of VINF_EM_EXECUTE_INSTRUCTION_GDT_FAULT returns.");
     STAM_REG(pVM, &pVM->vmm.s.StatRZRetGDTFault,            STAMTYPE_COUNTER, "/VMM/RZRet/GDTFault",            STAMUNIT_OCCURENCES, "Number of VINF_EM_EXECUTE_INSTRUCTION_LDT_FAULT returns.");
     STAM_REG(pVM, &pVM->vmm.s.StatRZRetIDTFault,            STAMTYPE_COUNTER, "/VMM/RZRet/IDTFault",            STAMUNIT_OCCURENCES, "Number of VINF_EM_EXECUTE_INSTRUCTION_IDT_FAULT returns.");
@@ -537,10 +540,10 @@ VMMR3_INT_DECL(int) VMMR3InitR0(PVM pVM)
     }
 
     /* Log whether thread-context hooks are used (on Linux this can depend on how the kernel is configured). */
-    if (pVM->aCpus[0].vmm.s.hR0ThreadCtx != NIL_RTTHREADCTX)
+    if (pVM->aCpus[0].vmm.s.hCtxHook != NIL_RTTHREADCTXHOOK)
         LogRel(("VMM: Thread-context hooks enabled!\n"));
     else
-        LogRel(("VMM: Thread-context hooks unavailable.\n"));
+        LogRel(("VMM: Thread-context hooks unavailable\n"));
 
     return rc;
 }
@@ -707,6 +710,13 @@ VMMR3_INT_DECL(int) VMMR3InitCompleted(PVM pVM, VMINITCOMPLETED enmWhat)
             LogRel(("VMM: fUsePeriodicPreemptionTimers=%RTbool\n", pVM->vmm.s.fUsePeriodicPreemptionTimers));
 
             /*
+             * Last chance for GIM to update its CPUID leaves if it requires
+             * knowledge/information from HM initialization.
+             */
+            rc = GIMR3InitCompleted(pVM);
+            AssertRCReturn(rc, rc);
+
+            /*
              * CPUM's post-initialization (print CPUIDs).
              */
             CPUMR3LogCpuIds(pVM);
@@ -1332,7 +1342,7 @@ VMMR3_INT_DECL(int) VMMR3RawRunGC(PVM pVM, PVMCPU pVCpu)
  */
 VMMR3_INT_DECL(int) VMMR3HmRunGC(PVM pVM, PVMCPU pVCpu)
 {
-    Log2(("VMMR3HmRunGC: (cs:eip=%04x:%08x)\n", CPUMGetGuestCS(pVCpu), CPUMGetGuestEIP(pVCpu)));
+    Log2(("VMMR3HmRunGC: (cs:rip=%04x:%RX64)\n", CPUMGetGuestCS(pVCpu), CPUMGetGuestRIP(pVCpu)));
 
     for (;;)
     {
@@ -1363,7 +1373,7 @@ VMMR3_INT_DECL(int) VMMR3HmRunGC(PVM pVM, PVMCPU pVCpu)
 #endif /* !LOG_ENABLED */
         if (rc != VINF_VMM_CALL_HOST)
         {
-            Log2(("VMMR3HmRunGC: returns %Rrc (cs:eip=%04x:%08x)\n", rc, CPUMGetGuestCS(pVCpu), CPUMGetGuestEIP(pVCpu)));
+            Log2(("VMMR3HmRunGC: returns %Rrc (cs:rip=%04x:%RX64)\n", rc, CPUMGetGuestCS(pVCpu), CPUMGetGuestRIP(pVCpu)));
             return rc;
         }
         rc = vmmR3ServiceCallRing3Request(pVM, pVCpu);
@@ -2402,11 +2412,19 @@ static DECLCALLBACK(void) vmmR3InfoFF(PVM pVM, PCDBGFINFOHLP pHlp, const char *p
         PRINT_FLAG(VMCPU_FF_,INTERRUPT_APIC);
         PRINT_FLAG(VMCPU_FF_,INTERRUPT_PIC);
         PRINT_FLAG(VMCPU_FF_,TIMER);
+        PRINT_FLAG(VMCPU_FF_,INTERRUPT_NMI);
+        PRINT_FLAG(VMCPU_FF_,INTERRUPT_SMI);
         PRINT_FLAG(VMCPU_FF_,PDM_CRITSECT);
+        PRINT_FLAG(VMCPU_FF_,UNHALT);
+        PRINT_FLAG(VMCPU_FF_,REQUEST);
+        PRINT_FLAG(VMCPU_FF_,HM_UPDATE_CR3);
+        PRINT_FLAG(VMCPU_FF_,HM_UPDATE_PAE_PDPES);
         PRINT_FLAG(VMCPU_FF_,PGM_SYNC_CR3);
         PRINT_FLAG(VMCPU_FF_,PGM_SYNC_CR3_NON_GLOBAL);
+        PRINT_FLAG(VMCPU_FF_,TLB_SHOOTDOWN);
         PRINT_FLAG(VMCPU_FF_,TLB_FLUSH);
         PRINT_FLAG(VMCPU_FF_,INHIBIT_INTERRUPTS);
+        PRINT_FLAG(VMCPU_FF_,BLOCK_NMIS);
         PRINT_FLAG(VMCPU_FF_,TO_R3);
 #ifdef VBOX_WITH_RAW_MODE
         PRINT_FLAG(VMCPU_FF_,TRPM_SYNC_IDT);
diff --git a/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp b/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp
index 56dc1d5..aa26353 100644
--- a/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp
+++ b/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp
@@ -600,6 +600,7 @@ VMMR3DECL(void) VMMR3FatalDump(PVM pVM, PVMCPU pVCpu, int rcErr)
 
         case VERR_IEM_INSTR_NOT_IMPLEMENTED:
         case VERR_IEM_ASPECT_NOT_IMPLEMENTED:
+        case VERR_PATM_IPE_TRAP_IN_PATCH_CODE:
         {
             DBGFR3Info(pVM->pUVM, "cpumguest", NULL, pHlp);
             DBGFR3Info(pVM->pUVM, "cpumguestinstr", NULL, pHlp);
diff --git a/src/VBox/VMM/VMMR3/VMMR3.def b/src/VBox/VMM/VMMR3/VMMR3.def
index 2b894bf..7ff7071 100644
--- a/src/VBox/VMM/VMMR3/VMMR3.def
+++ b/src/VBox/VMM/VMMR3/VMMR3.def
@@ -3,7 +3,7 @@
 ; VMM Ring-3 Context DLL - Definition file.
 
 ;
-; Copyright (C) 2010-2013 Oracle Corporation
+; Copyright (C) 2010-2014 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -116,6 +116,7 @@ EXPORTS
     DBGFR3RegNmQueryAllCount
     DBGFR3OSDeregister
     DBGFR3OSRegister
+    DBGFR3OSQueryInterface
     DBGFR3MemReadString
     DBGFR3MemRead
     DBGFR3MemScan
@@ -128,6 +129,10 @@ EXPORTS
     DBGFR3AsGetConfig
     DBGFR3CpuGetMode
     DBGFR3AddrFromSelOff
+    DBGFR3PlugInLoad
+    DBGFR3PlugInUnload
+    DBGFR3PlugInLoadAll
+    DBGFR3PlugInUnloadAll
 
     EMR3QueryExecutionPolicy
     EMR3SetExecutionPolicy
@@ -190,6 +195,9 @@ EXPORTS
     PDMR3UsbCreateProxyDevice
     PDMR3UsbDetachDevice
     PDMR3UsbHasHub
+    PDMR3UsbDriverAttach
+    PDMR3UsbDriverDetach
+    PDMR3UsbQueryLun
 
     PGMHandlerPhysicalPageTempOff
     PGMPhysReadGCPtr
diff --git a/src/VBox/VMM/VMMR3/VMMR3.rc b/src/VBox/VMM/VMMR3/VMMR3.rc
deleted file mode 100644
index dd9e188..0000000
--- a/src/VBox/VMM/VMMR3/VMMR3.rc
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id: VMMR3.rc $ */
-/** @file
- * VBoxVMM - Resource file containing version info.
- */
-
-/*
- * Copyright (C) 2015 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-#include <windows.h>
-#include <VBox/version.h>
-
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
-VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
-  FILESUBTYPE      VFT2_UNKNOWN
-BEGIN
-  BLOCK "StringFileInfo"
-  BEGIN
-    BLOCK "040904b0" // Lang=US English, CharSet=Unicode
-    BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
-      VALUE "FileDescription",  "VirtualBox VMM\0"
-      VALUE "FileVersion",      VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD "." VBOX_SVN_REV "\0"
-      VALUE "InternalName",     "VBoxVMM\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
-      VALUE "OriginalFilename", "VBoxVMM.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   VBOX_VERSION_MAJOR "." VBOX_VERSION_MINOR "." VBOX_VERSION_BUILD ".r" VBOX_SVN_REV "\0"
-    END
-  END
-  BLOCK "VarFileInfo"
-  BEGIN
-    VALUE "Translation", 0x409, 1200
-  END
-END
diff --git a/src/VBox/VMM/VMMR3/VMMSwitcher.cpp b/src/VBox/VMM/VMMR3/VMMSwitcher.cpp
index f6aa164..5730b24 100644
--- a/src/VBox/VMM/VMMR3/VMMSwitcher.cpp
+++ b/src/VBox/VMM/VMMR3/VMMSwitcher.cpp
@@ -282,11 +282,11 @@ int vmmR3SwitcherInit(PVM pVM)
                 paBadTries[i].HCPhys = pVM->vmm.s.HCPhysCoreCode;
                 paBadTries[i].cb     = pVM->vmm.s.cbCoreCode;
                 i++;
-                LogRel(("Failed to allocated and map core code: rc=%Rrc\n", rc));
+                LogRel(("VMM: Failed to allocated and map core code: rc=%Rrc\n", rc));
             }
             while (i-- > 0)
             {
-                LogRel(("Core code alloc attempt #%d: pvR3=%p pvR0=%p HCPhys=%RHp\n",
+                LogRel(("VMM: Core code alloc attempt #%d: pvR3=%p pvR0=%p HCPhys=%RHp\n",
                         i, paBadTries[i].pvR3, paBadTries[i].pvR0, paBadTries[i].HCPhys));
                 SUPR3ContFree(paBadTries[i].pvR3, paBadTries[i].cb >> PAGE_SHIFT);
             }
@@ -324,7 +324,7 @@ int vmmR3SwitcherInit(PVM pVM)
         {
             pVM->vmm.s.pvCoreCodeRC = GCPtr;
             MMR3HyperReserve(pVM, PAGE_SIZE, "fence", NULL);
-            LogRel(("CoreCode: R3=%RHv R0=%RHv RC=%RRv Phys=%RHp cb=%#x\n",
+            LogRel(("VMM: CoreCode: R3=%RHv R0=%RHv RC=%RRv Phys=%RHp cb=%#x\n",
                     pVM->vmm.s.pvCoreCodeR3, pVM->vmm.s.pvCoreCodeR0, pVM->vmm.s.pvCoreCodeRC, pVM->vmm.s.HCPhysCoreCode, pVM->vmm.s.cbCoreCode));
 
             /*
@@ -689,6 +689,7 @@ static void vmmR3SwitcherGenericRelocate(PVM pVM, PVMMSWITCHERDEF pSwitcher,
                 break;
             }
 
+#if 0 /* Reusable for XSAVE. */
             /*
              * Insert relative jump to specified target it FXSAVE/FXRSTOR isn't supported by the cpu.
              */
@@ -696,7 +697,7 @@ static void vmmR3SwitcherGenericRelocate(PVM pVM, PVMMSWITCHERDEF pSwitcher,
             {
                 uint32_t offTrg = *u.pu32++;
                 Assert(offTrg < pSwitcher->cbCode);
-                if (!CPUMSupportsFXSR(pVM))
+                if (!CPUMSupportsXSave(pVM))
                 {
                     *uSrc.pu8++ = 0xe9; /* jmp rel32 */
                     *uSrc.pu32++ = offTrg - (offSrc + 5);
@@ -708,6 +709,7 @@ static void vmmR3SwitcherGenericRelocate(PVM pVM, PVMMSWITCHERDEF pSwitcher,
                 }
                 break;
             }
+#endif
 
             /*
              * Insert relative jump to specified target it SYSENTER isn't used by the host.
diff --git a/src/VBox/VMM/VMMR3/VMMTests.cpp b/src/VBox/VMM/VMMR3/VMMTests.cpp
index 066c3c3..400eadd 100644
--- a/src/VBox/VMM/VMMR3/VMMTests.cpp
+++ b/src/VBox/VMM/VMMR3/VMMTests.cpp
@@ -494,8 +494,8 @@ VMMR3DECL(int) VMMDoTest(PVM pVM)
                 return RT_FAILURE(rc) ? rc : VERR_IPE_UNEXPECTED_INFO_STATUS;
             }
             uint64_t Ticks = ASMReadTSC() - StartTick;
-            if (Ticks < (SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage) / 10000))
-                RTPrintf("Warning: Ticks=%RU64 (< %RU64)\n", Ticks, SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage) / 10000);
+            if (Ticks < (SUPGetCpuHzFromGip(g_pSUPGlobalInfoPage) / 10000))
+                RTPrintf("Warning: Ticks=%RU64 (< %RU64)\n", Ticks, SUPGetCpuHzFromGip(g_pSUPGlobalInfoPage) / 10000);
         }
 
         /*
@@ -665,7 +665,7 @@ VMMR3DECL(int) VMMDoHmTest(PVM pVM)
     pHyperCtx = CPUMGetHyperCtxPtr(pVCpu);
 
     pHyperCtx->cr0 = X86_CR0_PE | X86_CR0_WP | X86_CR0_PG | X86_CR0_TS | X86_CR0_ET | X86_CR0_NE | X86_CR0_MP;
-    pHyperCtx->cr4 = X86_CR4_PGE | X86_CR4_OSFSXR | X86_CR4_OSXMMEEXCPT;
+    pHyperCtx->cr4 = X86_CR4_PGE | X86_CR4_OSFXSR | X86_CR4_OSXMMEEXCPT;
     PGMChangeMode(pVCpu, pHyperCtx->cr0, pHyperCtx->cr4, pHyperCtx->msrEFER);
     PGMSyncCR3(pVCpu, pHyperCtx->cr0, CR3Phys, pHyperCtx->cr4, true);
 
diff --git a/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_3200.h b/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_3200.h
index 774e2ae..e46c4e8 100644
--- a/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_3200.h
+++ b/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_3200.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for AMD Athlon(tm) 64 Processor 3200+.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_Athlon_64_3200[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_Athlon_64_3200[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x68747541, 0x444d4163, 0x69746e65, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x00000f48, 0x00000800, 0x00000000, 0x078bfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x00000f48, 0x00000800, 0x00000000, 0x078bfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x80000000, 0x00000000, 0x00000000, 0x80000018, 0x68747541, 0x444d4163, 0x69746e65, 0 },
     { 0x80000001, 0x00000000, 0x00000000, 0x00000f48, 0x0000010a, 0x00000000, 0xe1d3fbff, 0 },
     { 0x80000002, 0x00000000, 0x00000000, 0x20444d41, 0x6c687441, 0x74286e6f, 0x3620296d, 0 },
@@ -62,7 +62,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_Athlon_64_3200[] =
 /**
  * MSR ranges for AMD Athlon(tm) 64 Processor 3200+.
  */
-static CPUMMSRRANGE const g_aMsrRanges_AMD_Athlon_64_3200[] = 
+static CPUMMSRRANGE const g_aMsrRanges_AMD_Athlon_64_3200[] =
 {
     MAL(0x00000000, "IA32_P5_MC_ADDR", 0x00000402),
     MAL(0x00000001, "IA32_P5_MC_TYPE", 0x00000401),
@@ -195,7 +195,7 @@ static CPUMMSRRANGE const g_aMsrRanges_AMD_Athlon_64_3200[] =
 /**
  * Database entry for AMD Athlon(tm) 64 Processor 3200+.
  */
-static CPUMDBENTRY const g_Entry_AMD_Athlon_64_3200 = 
+static CPUMDBENTRY const g_Entry_AMD_Athlon_64_3200 =
 {
     /*.pszName          = */ "AMD Athlon 64 3200+",
     /*.pszFullName      = */ "AMD Athlon(tm) 64 Processor 3200+",
@@ -209,7 +209,7 @@ static CPUMDBENTRY const g_Entry_AMD_Athlon_64_3200 =
     /*.cMaxPhysAddrWidth= */ 40,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_AMD_Athlon_64_3200),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_AMD_Athlon_64_3200)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_DEFAULTS,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_DEFAULTS,
     /*.DefUnknownCpuId  = */ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_AMD_Athlon_64_3200)),
diff --git a/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h b/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h
index 8da33fc..7621e6d 100644
--- a/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h
+++ b/src/VBox/VMM/VMMR3/cpus/AMD_Athlon_64_X2_Dual_Core_4200.h
@@ -10,7 +10,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -32,7 +32,7 @@
 static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_Athlon_64_X2_Dual_Core_4200[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x68747541, 0x444d4163, 0x69746e65, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x00040fb2, 0x01020800, 0x00002001, 0x178bfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x00040fb2, 0x01020800, 0x00002001, 0x178bfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x80000000, 0x00000000, 0x00000000, 0x80000018, 0x68747541, 0x444d4163, 0x69746e65, 0 },
     { 0x80000001, 0x00000000, 0x00000000, 0x00040fb2, 0x000008d1, 0x0000001f, 0xebd3fbff, 0 },
     { 0x80000002, 0x00000000, 0x00000000, 0x20444d41, 0x6c687441, 0x74286e6f, 0x3620296d, 0 },
@@ -217,7 +217,7 @@ static CPUMDBENTRY const g_Entry_AMD_Athlon_64_X2_Dual_Core_4200 =
     /*.cMaxPhysAddrWidth= */ 40,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_AMD_Athlon_64_X2_Dual_Core_4200),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_AMD_Athlon_64_X2_Dual_Core_4200)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_DEFAULTS,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_DEFAULTS,
     /*.DefUnknownCpuId  = */ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_AMD_Athlon_64_X2_Dual_Core_4200)),
diff --git a/src/VBox/VMM/VMMR3/cpus/AMD_FX_8150_Eight_Core.h b/src/VBox/VMM/VMMR3/cpus/AMD_FX_8150_Eight_Core.h
index f798207..30a8da0 100644
--- a/src/VBox/VMM/VMMR3/cpus/AMD_FX_8150_Eight_Core.h
+++ b/src/VBox/VMM/VMMR3/cpus/AMD_FX_8150_Eight_Core.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for AMD FX(tm)-8150 Eight-Core Processor.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_FX_8150_Eight_Core[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_FX_8150_Eight_Core[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x0000000d, 0x68747541, 0x444d4163, 0x69746e65, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x00600f12, 0x02080800, 0x1e98220b, 0x178bfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x00600f12, 0x02080800, 0x1e98220b, 0x178bfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
@@ -75,7 +75,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_FX_8150_Eight_Core[] =
     { 0x8000001d, 0x00000002, UINT32_MAX, 0x00004143, 0x03c0003f, 0x000007ff, 0x00000001, 0 },
     { 0x8000001d, 0x00000003, UINT32_MAX, 0x0001c163, 0x0fc0003f, 0x000007ff, 0x00000001, 0 },
     { 0x8000001d, 0x00000004, UINT32_MAX, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
-    { 0x8000001e, 0x00000000, 0x00000000, 0x00000012, 0x00000101, 0x00000000, 0x00000000, 0 },
+    { 0x8000001e, 0x00000000, 0x00000000, 0x00000012, 0x00000101, 0x00000000, 0x00000000, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
 };
 #endif /* !CPUM_DB_STANDALONE */
 
@@ -84,7 +84,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_FX_8150_Eight_Core[] =
 /**
  * MSR ranges for AMD FX(tm)-8150 Eight-Core Processor.
  */
-static CPUMMSRRANGE const g_aMsrRanges_AMD_FX_8150_Eight_Core[] = 
+static CPUMMSRRANGE const g_aMsrRanges_AMD_FX_8150_Eight_Core[] =
 {
     MAL(0x00000000, "IA32_P5_MC_ADDR", 0x00000402),
     MAL(0x00000001, "IA32_P5_MC_TYPE", 0x00000401),
@@ -354,7 +354,7 @@ static CPUMMSRRANGE const g_aMsrRanges_AMD_FX_8150_Eight_Core[] =
 /**
  * Database entry for AMD FX(tm)-8150 Eight-Core Processor.
  */
-static CPUMDBENTRY const g_Entry_AMD_FX_8150_Eight_Core = 
+static CPUMDBENTRY const g_Entry_AMD_FX_8150_Eight_Core =
 {
     /*.pszName          = */ "AMD FX-8150 Eight-Core",
     /*.pszFullName      = */ "AMD FX(tm)-8150 Eight-Core Processor",
@@ -368,7 +368,7 @@ static CPUMDBENTRY const g_Entry_AMD_FX_8150_Eight_Core =
     /*.cMaxPhysAddrWidth= */ 48,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_AMD_FX_8150_Eight_Core),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_AMD_FX_8150_Eight_Core)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_DEFAULTS,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_DEFAULTS,
     /*.DefUnknownCpuId  = */ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_AMD_FX_8150_Eight_Core)),
diff --git a/src/VBox/VMM/VMMR3/cpus/AMD_Phenom_II_X6_1100T.h b/src/VBox/VMM/VMMR3/cpus/AMD_Phenom_II_X6_1100T.h
index 8caceec..0175079 100644
--- a/src/VBox/VMM/VMMR3/cpus/AMD_Phenom_II_X6_1100T.h
+++ b/src/VBox/VMM/VMMR3/cpus/AMD_Phenom_II_X6_1100T.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for AMD Phenom(tm) II X6 1100T Processor.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_Phenom_II_X6_1100T[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_Phenom_II_X6_1100T[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x00000006, 0x68747541, 0x444d4163, 0x69746e65, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x00100fa0, 0x01060800, 0x00802009, 0x178bfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x00100fa0, 0x01060800, 0x00802009, 0x178bfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
@@ -69,7 +69,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_AMD_Phenom_II_X6_1100T[] =
 /**
  * MSR ranges for AMD Phenom(tm) II X6 1100T Processor.
  */
-static CPUMMSRRANGE const g_aMsrRanges_AMD_Phenom_II_X6_1100T[] = 
+static CPUMMSRRANGE const g_aMsrRanges_AMD_Phenom_II_X6_1100T[] =
 {
     MAL(0x00000000, "IA32_P5_MC_ADDR", 0x00000402),
     MAL(0x00000001, "IA32_P5_MC_TYPE", 0x00000401),
@@ -243,7 +243,7 @@ static CPUMMSRRANGE const g_aMsrRanges_AMD_Phenom_II_X6_1100T[] =
 /**
  * Database entry for AMD Phenom(tm) II X6 1100T Processor.
  */
-static CPUMDBENTRY const g_Entry_AMD_Phenom_II_X6_1100T = 
+static CPUMDBENTRY const g_Entry_AMD_Phenom_II_X6_1100T =
 {
     /*.pszName          = */ "AMD Phenom II X6 1100T",
     /*.pszFullName      = */ "AMD Phenom(tm) II X6 1100T Processor",
@@ -257,7 +257,7 @@ static CPUMDBENTRY const g_Entry_AMD_Phenom_II_X6_1100T =
     /*.cMaxPhysAddrWidth= */ 48,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_AMD_Phenom_II_X6_1100T),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_AMD_Phenom_II_X6_1100T)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_DEFAULTS,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_DEFAULTS,
     /*.DefUnknownCpuId  = */ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_AMD_Phenom_II_X6_1100T)),
diff --git a/src/VBox/VMM/VMMR3/cpus/Intel_Core_i5_3570.h b/src/VBox/VMM/VMMR3/cpus/Intel_Core_i5_3570.h
index 1de7709..ad1f5aa 100644
--- a/src/VBox/VMM/VMMR3/cpus/Intel_Core_i5_3570.h
+++ b/src/VBox/VMM/VMMR3/cpus/Intel_Core_i5_3570.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i5_3570[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i5_3570[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x0000000d, 0x756e6547, 0x6c65746e, 0x49656e69, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x000306a9, 0x04100800, 0x7fbae3ff, 0xbfebfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x000306a9, 0x04100800, 0x7fbae3ff, 0xbfebfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x76035a01, 0x00f0b0ff, 0x00000000, 0x00ca0000, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, 0x00000000, 0x1c004121, 0x01c0003f, 0x0000003f, 0x00000000, 0 },
@@ -37,7 +37,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i5_3570[] =
     { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x0000000a, 0x00000000, 0x00000000, 0x07300803, 0x00000000, 0x00000000, 0x00000603, 0 },
-    { 0x0000000b, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000100, 0x00000004, 0 },
+    { 0x0000000b, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000100, 0x00000004, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x0000000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x0000000d, 0x00000000, 0x00000000, 0x00000007, 0x00000340, 0x00000340, 0x00000000, 0 },
     { 0x80000000, 0x00000000, 0x00000000, 0x80000008, 0x00000000, 0x00000000, 0x00000000, 0 },
@@ -57,7 +57,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i5_3570[] =
 /**
  * MSR ranges for Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz.
  */
-static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i5_3570[] = 
+static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i5_3570[] =
 {
     MFX(0x00000000, "IA32_P5_MC_ADDR", Ia32P5McAddr, Ia32P5McAddr, 0, UINT64_C(0xffffffffffffffe0), 0), /* value=0x1f */
     MFX(0x00000001, "IA32_P5_MC_TYPE", Ia32P5McType, Ia32P5McType, 0, 0, UINT64_MAX), /* value=0x0 */
@@ -310,7 +310,7 @@ static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i5_3570[] =
 /**
  * Database entry for Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz.
  */
-static CPUMDBENTRY const g_Entry_Intel_Core_i5_3570 = 
+static CPUMDBENTRY const g_Entry_Intel_Core_i5_3570 =
 {
     /*.pszName          = */ "Intel Core i5-3570",
     /*.pszFullName      = */ "Intel(R) Core(TM) i5-3570 CPU @ 3.40GHz",
@@ -324,7 +324,7 @@ static CPUMDBENTRY const g_Entry_Intel_Core_i5_3570 =
     /*.cMaxPhysAddrWidth= */ 36,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_Intel_Core_i5_3570),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_Intel_Core_i5_3570)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
     /*.DefUnknownCpuId  = */ { 0x00000007, 0x00000340, 0x00000340, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_Intel_Core_i5_3570)),
diff --git a/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_2635QM.h b/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_2635QM.h
index 42567f8..0179660 100644
--- a/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_2635QM.h
+++ b/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_2635QM.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_2635QM[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_2635QM[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x0000000d, 0x756e6547, 0x6c65746e, 0x49656e69, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x000206a7, 0x04100800, 0x1fbae3bf, 0xbfebfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x000206a7, 0x04100800, 0x1fbae3bf, 0xbfebfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x76035a01, 0x00f0b2ff, 0x00000000, 0x00ca0000, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, UINT32_MAX, 0x1c004121, 0x01c0003f, 0x0000003f, 0x00000000, 0 },
@@ -41,6 +41,8 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_2635QM[] =
     { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x0000000a, 0x00000000, 0x00000000, 0x07300403, 0x00000000, 0x00000000, 0x00000603, 0 },
+    /** @todo the b entry here is WRONG!   */
+    { 0x0000000b, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 | CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x0000000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x0000000d, 0x00000000, UINT32_MAX, 0x00000007, 0x00000340, 0x00000340, 0x00000000, 0 },
     { 0x0000000d, 0x00000001, UINT32_MAX, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0 },
@@ -63,7 +65,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_2635QM[] =
 /**
  * MSR ranges for Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz.
  */
-static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_2635QM[] = 
+static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_2635QM[] =
 {
     MFX(0x00000000, "IA32_P5_MC_ADDR", Ia32P5McAddr, Ia32P5McAddr, 0, UINT64_C(0xffffffffffffffe0), 0), /* value=0x1f */
     MFX(0x00000001, "IA32_P5_MC_TYPE", Ia32P5McType, Ia32P5McType, 0, 0, UINT64_MAX), /* value=0x0 */
@@ -301,7 +303,7 @@ static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_2635QM[] =
 /**
  * Database entry for Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz.
  */
-static CPUMDBENTRY const g_Entry_Intel_Core_i7_2635QM = 
+static CPUMDBENTRY const g_Entry_Intel_Core_i7_2635QM =
 {
     /*.pszName          = */ "Intel Core i7-2635QM",
     /*.pszFullName      = */ "Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz",
@@ -315,7 +317,7 @@ static CPUMDBENTRY const g_Entry_Intel_Core_i7_2635QM =
     /*.cMaxPhysAddrWidth= */ 36,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_Intel_Core_i7_2635QM),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_Intel_Core_i7_2635QM)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
     /*.DefUnknownCpuId  = */ { 0x00000007, 0x00000340, 0x00000340, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_Intel_Core_i7_2635QM)),
diff --git a/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3820QM.h b/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3820QM.h
index 6738392..5444ed9 100644
--- a/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3820QM.h
+++ b/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3820QM.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_3820QM[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_3820QM[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x0000000d, 0x756e6547, 0x6c65746e, 0x49656e69, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x000306a9, 0x02100800, 0x7fbae3ff, 0xbfebfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x000306a9, 0x02100800, 0x7fbae3ff, 0xbfebfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x76035a01, 0x00f0b2ff, 0x00000000, 0x00ca0000, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, 0x00000000, 0x1c004121, 0x01c0003f, 0x0000003f, 0x00000000, 0 },
@@ -37,7 +37,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_3820QM[] =
     { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000009, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x0000000a, 0x00000000, 0x00000000, 0x07300403, 0x00000000, 0x00000000, 0x00000603, 0 },
-    { 0x0000000b, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000100, 0x00000002, 0 },
+    { 0x0000000b, 0x00000000, 0x00000000, 0x00000001, 0x00000002, 0x00000100, 0x00000002, 0 | CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x0000000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x0000000d, 0x00000000, 0x00000000, 0x00000007, 0x00000340, 0x00000340, 0x00000000, 0 },
     { 0x80000000, 0x00000000, 0x00000000, 0x80000008, 0x00000000, 0x00000000, 0x00000000, 0 },
@@ -57,7 +57,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_3820QM[] =
 /**
  * MSR ranges for Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz.
  */
-static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_3820QM[] = 
+static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_3820QM[] =
 {
     MFX(0x00000000, "IA32_P5_MC_ADDR", Ia32P5McAddr, Ia32P5McAddr, 0, UINT64_C(0xffffffffffffffe0), 0), /* value=0x1f */
     MFX(0x00000001, "IA32_P5_MC_TYPE", Ia32P5McType, Ia32P5McType, 0, 0, UINT64_MAX), /* value=0x0 */
@@ -352,7 +352,7 @@ static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_3820QM[] =
 /**
  * Database entry for Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz.
  */
-static CPUMDBENTRY const g_Entry_Intel_Core_i7_3820QM = 
+static CPUMDBENTRY const g_Entry_Intel_Core_i7_3820QM =
 {
     /*.pszName          = */ "Intel Core i7-3820QM",
     /*.pszFullName      = */ "Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz",
@@ -366,7 +366,7 @@ static CPUMDBENTRY const g_Entry_Intel_Core_i7_3820QM =
     /*.cMaxPhysAddrWidth= */ 36,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_Intel_Core_i7_3820QM),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_Intel_Core_i7_3820QM)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
     /*.DefUnknownCpuId  = */ { 0x00000007, 0x00000340, 0x00000340, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.apaMsrRanges[]   = */
diff --git a/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3960X.h b/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3960X.h
index c8a122c..10d44ef 100644
--- a/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3960X.h
+++ b/src/VBox/VMM/VMMR3/cpus/Intel_Core_i7_3960X.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_3960X[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_3960X[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x0000000d, 0x756e6547, 0x6c65746e, 0x49656e69, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x000206d6, 0x02200800, 0x1fbee3bf, 0xbfebfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x000206d6, 0x02200800, 0x1fbee3bf, 0xbfebfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x76035a01, 0x00f0b2ff, 0x00000000, 0x00ca0000, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, UINT32_MAX, 0x3c004121, 0x01c0003f, 0x0000003f, 0x00000000, 0 },
@@ -41,9 +41,9 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_3960X[] =
     { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000009, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x0000000a, 0x00000000, 0x00000000, 0x07300403, 0x00000000, 0x00000000, 0x00000603, 0 },
-    { 0x0000000b, 0x00000000, UINT32_MAX, 0x00000001, 0x00000002, 0x00000100, 0x00000002, 0 },
-    { 0x0000000b, 0x00000001, UINT32_MAX, 0x00000005, 0x0000000c, 0x00000201, 0x00000002, 0 },
-    { 0x0000000b, 0x00000002, UINT32_MAX, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0 | CPUMCPUIDLEAF_F_SUBLEAVES_ECX_UNCHANGED },
+    { 0x0000000b, 0x00000000, UINT32_MAX, 0x00000001, 0x00000002, 0x00000100, 0x00000002, 0 | CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
+    { 0x0000000b, 0x00000001, UINT32_MAX, 0x00000005, 0x0000000c, 0x00000201, 0x00000002, 0 | CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
+    { 0x0000000b, 0x00000002, UINT32_MAX, 0x00000000, 0x00000000, 0x00000002, 0x00000002, 0 | CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x0000000c, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x0000000d, 0x00000000, UINT32_MAX, 0x00000007, 0x00000340, 0x00000340, 0x00000000, 0 },
     { 0x0000000d, 0x00000001, UINT32_MAX, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0 },
@@ -66,7 +66,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Core_i7_3960X[] =
 /**
  * MSR ranges for Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz.
  */
-static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_3960X[] = 
+static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_3960X[] =
 {
     MFX(0x00000000, "IA32_P5_MC_ADDR", Ia32P5McAddr, Ia32P5McAddr, 0, UINT64_C(0xffffffffffffffe0), 0), /* value=0x1f */
     MFX(0x00000001, "IA32_P5_MC_TYPE", Ia32P5McType, Ia32P5McType, 0, 0, UINT64_MAX), /* value=0x0 */
@@ -340,7 +340,7 @@ static CPUMMSRRANGE const g_aMsrRanges_Intel_Core_i7_3960X[] =
 /**
  * Database entry for Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz.
  */
-static CPUMDBENTRY const g_Entry_Intel_Core_i7_3960X = 
+static CPUMDBENTRY const g_Entry_Intel_Core_i7_3960X =
 {
     /*.pszName          = */ "Intel Core i7-3960X",
     /*.pszFullName      = */ "Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz",
@@ -354,7 +354,7 @@ static CPUMDBENTRY const g_Entry_Intel_Core_i7_3960X =
     /*.cMaxPhysAddrWidth= */ 46,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_Intel_Core_i7_3960X),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_Intel_Core_i7_3960X)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX,
     /*.DefUnknownCpuId  = */ { 0x00000007, 0x00000340, 0x00000340, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_Intel_Core_i7_3960X)),
diff --git a/src/VBox/VMM/VMMR3/cpus/Intel_Pentium_4_3_00GHz.h b/src/VBox/VMM/VMMR3/cpus/Intel_Pentium_4_3_00GHz.h
index be6f329..7deb3f2 100644
--- a/src/VBox/VMM/VMMR3/cpus/Intel_Pentium_4_3_00GHz.h
+++ b/src/VBox/VMM/VMMR3/cpus/Intel_Pentium_4_3_00GHz.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for Intel(R) Pentium(R) 4 CPU 3.00GHz.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Pentium_4_3_00GHz[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Pentium_4_3_00GHz[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x00000005, 0x756e6547, 0x6c65746e, 0x49656e69, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x00000f43, 0x00020800, 0x0000649d, 0xbfebfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x00000f43, 0x00020800, 0x0000649d, 0xbfebfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x605b5001, 0x00000000, 0x00000000, 0x007d7040, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, UINT32_MAX, 0x00004121, 0x01c0003f, 0x0000001f, 0x00000000, 0 },
@@ -51,7 +51,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Pentium_4_3_00GHz[] =
 /**
  * MSR ranges for Intel(R) Pentium(R) 4 CPU 3.00GHz.
  */
-static CPUMMSRRANGE const g_aMsrRanges_Intel_Pentium_4_3_00GHz[] = 
+static CPUMMSRRANGE const g_aMsrRanges_Intel_Pentium_4_3_00GHz[] =
 {
     MFO(0x00000000, "IA32_P5_MC_ADDR", Ia32P5McAddr), /* value=0xc55df88 */
     MFO(0x00000001, "IA32_P5_MC_TYPE", Ia32P5McType), /* value=0xbe000300`1008081f */
@@ -248,7 +248,7 @@ static CPUMMSRRANGE const g_aMsrRanges_Intel_Pentium_4_3_00GHz[] =
 /**
  * Database entry for Intel(R) Pentium(R) 4 CPU 3.00GHz.
  */
-static CPUMDBENTRY const g_Entry_Intel_Pentium_4_3_00GHz = 
+static CPUMDBENTRY const g_Entry_Intel_Pentium_4_3_00GHz =
 {
     /*.pszName          = */ "Intel Pentium 4 3.00GHz",
     /*.pszFullName      = */ "Intel(R) Pentium(R) 4 CPU 3.00GHz",
@@ -262,7 +262,7 @@ static CPUMDBENTRY const g_Entry_Intel_Pentium_4_3_00GHz =
     /*.cMaxPhysAddrWidth= */ 36,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_Intel_Pentium_4_3_00GHz),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_Intel_Pentium_4_3_00GHz)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_LAST_STD_LEAF,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_LAST_STD_LEAF,
     /*.DefUnknownCpuId  = */ { 0x00000040, 0x00000040, 0x00000000, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_Intel_Pentium_4_3_00GHz)),
diff --git a/src/VBox/VMM/VMMR3/cpus/Intel_Pentium_M_processor_2_00GHz.h b/src/VBox/VMM/VMMR3/cpus/Intel_Pentium_M_processor_2_00GHz.h
index fe287df..97b3bd8 100644
--- a/src/VBox/VMM/VMMR3/cpus/Intel_Pentium_M_processor_2_00GHz.h
+++ b/src/VBox/VMM/VMMR3/cpus/Intel_Pentium_M_processor_2_00GHz.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for Intel(R) Pentium(R) M processor 2.00GHz.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Pentium_M_processor_2_00GHz[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Pentium_M_processor_2_00GHz[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x756e6547, 0x6c65746e, 0x49656e69, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x000006d6, 0x00000816, 0x00000180, 0xafe9f9bf, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x000006d6, 0x00000816, 0x00000180, 0xafe9f9bf, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x02b3b001, 0x000000f0, 0x00000000, 0x2c04307d, 0 },
     { 0x80000000, 0x00000000, 0x00000000, 0x80000004, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x80000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
@@ -42,7 +42,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Pentium_M_processor_2_00GHz[] =
 /**
  * MSR ranges for Intel(R) Pentium(R) M processor 2.00GHz.
  */
-static CPUMMSRRANGE const g_aMsrRanges_Intel_Pentium_M_processor_2_00GHz[] = 
+static CPUMMSRRANGE const g_aMsrRanges_Intel_Pentium_M_processor_2_00GHz[] =
 {
     MFI(0x00000000, "IA32_P5_MC_ADDR", Ia32P5McAddr), /* value=0x0 */
     MFI(0x00000001, "IA32_P5_MC_TYPE", Ia32P5McType), /* value=0x0 */
@@ -187,7 +187,7 @@ static CPUMMSRRANGE const g_aMsrRanges_Intel_Pentium_M_processor_2_00GHz[] =
 /**
  * Database entry for Intel(R) Pentium(R) M processor 2.00GHz.
  */
-static CPUMDBENTRY const g_Entry_Intel_Pentium_M_processor_2_00GHz = 
+static CPUMDBENTRY const g_Entry_Intel_Pentium_M_processor_2_00GHz =
 {
     /*.pszName          = */ "Intel Pentium M processor 2.00GHz",
     /*.pszFullName      = */ "Intel(R) Pentium(R) M processor 2.00GHz",
@@ -201,7 +201,7 @@ static CPUMDBENTRY const g_Entry_Intel_Pentium_M_processor_2_00GHz =
     /*.cMaxPhysAddrWidth= */ 32,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_Intel_Pentium_M_processor_2_00GHz),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_Intel_Pentium_M_processor_2_00GHz)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_LAST_STD_LEAF,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_LAST_STD_LEAF,
     /*.DefUnknownCpuId  = */ { 0x02b3b001, 0x000000f0, 0x00000000, 0x2c04307d },
     /*.fMsrMask         = */ UINT32_C(0x3fff),
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_Intel_Pentium_M_processor_2_00GHz)),
diff --git a/src/VBox/VMM/VMMR3/cpus/Intel_Xeon_X5482_3_20GHz.h b/src/VBox/VMM/VMMR3/cpus/Intel_Xeon_X5482_3_20GHz.h
index 548f556..51fd26c 100644
--- a/src/VBox/VMM/VMMR3/cpus/Intel_Xeon_X5482_3_20GHz.h
+++ b/src/VBox/VMM/VMMR3/cpus/Intel_Xeon_X5482_3_20GHz.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for Intel(R) Xeon(R) CPU           X5482  @ 3.20GHz.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Xeon_X5482_3_20GHz[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Xeon_X5482_3_20GHz[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x0000000a, 0x756e6547, 0x6c65746e, 0x49656e69, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x00010676, 0x04040800, 0x000ce3bd, 0xbfebfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x00010676, 0x04040800, 0x000ce3bd, 0xbfebfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x05b0b101, 0x005657f0, 0x00000000, 0x2cb4304e, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, 0x00000000, 0x0c000121, 0x01c0003f, 0x0000003f, 0x00000001, 0 },
@@ -54,7 +54,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Intel_Xeon_X5482_3_20GHz[] =
 /**
  * MSR ranges for Intel(R) Xeon(R) CPU           X5482  @ 3.20GHz.
  */
-static CPUMMSRRANGE const g_aMsrRanges_Intel_Xeon_X5482_3_20GHz[] = 
+static CPUMMSRRANGE const g_aMsrRanges_Intel_Xeon_X5482_3_20GHz[] =
 {
     MFO(0x00000000, "IA32_P5_MC_ADDR", Ia32P5McAddr), /* value=0x610010 */
     MFX(0x00000001, "IA32_P5_MC_TYPE", Ia32P5McType, Ia32P5McType, 0, 0, UINT64_MAX), /* value=0x0 */
@@ -216,7 +216,7 @@ static CPUMMSRRANGE const g_aMsrRanges_Intel_Xeon_X5482_3_20GHz[] =
 /**
  * Database entry for Intel(R) Xeon(R) CPU           X5482  @ 3.20GHz.
  */
-static CPUMDBENTRY const g_Entry_Intel_Xeon_X5482_3_20GHz = 
+static CPUMDBENTRY const g_Entry_Intel_Xeon_X5482_3_20GHz =
 {
     /*.pszName          = */ "Intel Xeon X5482 3.20GHz",
     /*.pszFullName      = */ "Intel(R) Xeon(R) CPU           X5482  @ 3.20GHz",
@@ -230,7 +230,7 @@ static CPUMDBENTRY const g_Entry_Intel_Xeon_X5482_3_20GHz =
     /*.cMaxPhysAddrWidth= */ 38,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_Intel_Xeon_X5482_3_20GHz),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_Intel_Xeon_X5482_3_20GHz)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_LAST_STD_LEAF,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_LAST_STD_LEAF,
     /*.DefUnknownCpuId  = */ { 0x07280202, 0x00000000, 0x00000000, 0x00000503 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_Intel_Xeon_X5482_3_20GHz)),
diff --git a/src/VBox/VMM/VMMR3/cpus/Quad_Core_AMD_Opteron_2384.h b/src/VBox/VMM/VMMR3/cpus/Quad_Core_AMD_Opteron_2384.h
index 04041a2..a2525b4 100644
--- a/src/VBox/VMM/VMMR3/cpus/Quad_Core_AMD_Opteron_2384.h
+++ b/src/VBox/VMM/VMMR3/cpus/Quad_Core_AMD_Opteron_2384.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for Quad-Core AMD Opteron(tm) Processor 2384.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_Quad_Core_AMD_Opteron_2384[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_Quad_Core_AMD_Opteron_2384[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x00000005, 0x68747541, 0x444d4163, 0x69746e65, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x00100f42, 0x06040800, 0x00802009, 0x178bfbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x00100f42, 0x06040800, 0x00802009, 0x178bfbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
@@ -68,7 +68,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_Quad_Core_AMD_Opteron_2384[] =
 /**
  * MSR ranges for Quad-Core AMD Opteron(tm) Processor 2384.
  */
-static CPUMMSRRANGE const g_aMsrRanges_Quad_Core_AMD_Opteron_2384[] = 
+static CPUMMSRRANGE const g_aMsrRanges_Quad_Core_AMD_Opteron_2384[] =
 {
     MAL(0x00000000, "IA32_P5_MC_ADDR", 0x00000402),
     MAL(0x00000001, "IA32_P5_MC_TYPE", 0x00000401),
@@ -241,7 +241,7 @@ static CPUMMSRRANGE const g_aMsrRanges_Quad_Core_AMD_Opteron_2384[] =
 /**
  * Database entry for Quad-Core AMD Opteron(tm) Processor 2384.
  */
-static CPUMDBENTRY const g_Entry_Quad_Core_AMD_Opteron_2384 = 
+static CPUMDBENTRY const g_Entry_Quad_Core_AMD_Opteron_2384 =
 {
     /*.pszName          = */ "Quad-Core AMD Opteron 2384",
     /*.pszFullName      = */ "Quad-Core AMD Opteron(tm) Processor 2384",
@@ -255,7 +255,7 @@ static CPUMDBENTRY const g_Entry_Quad_Core_AMD_Opteron_2384 =
     /*.cMaxPhysAddrWidth= */ 48,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_Quad_Core_AMD_Opteron_2384),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_Quad_Core_AMD_Opteron_2384)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_DEFAULTS,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_DEFAULTS,
     /*.DefUnknownCpuId  = */ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_Quad_Core_AMD_Opteron_2384)),
diff --git a/src/VBox/VMM/VMMR3/cpus/VIA_QuadCore_L4700_1_2_GHz.h b/src/VBox/VMM/VMMR3/cpus/VIA_QuadCore_L4700_1_2_GHz.h
index 1c14391..b0952c1 100644
--- a/src/VBox/VMM/VMMR3/cpus/VIA_QuadCore_L4700_1_2_GHz.h
+++ b/src/VBox/VMM/VMMR3/cpus/VIA_QuadCore_L4700_1_2_GHz.h
@@ -5,7 +5,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -24,10 +24,10 @@
 /**
  * CPUID leaves for VIA QuadCore L4700 @ 1.2+ GHz.
  */
-static CPUMCPUIDLEAF const g_aCpuIdLeaves_VIA_QuadCore_L4700_1_2_GHz[] = 
+static CPUMCPUIDLEAF const g_aCpuIdLeaves_VIA_QuadCore_L4700_1_2_GHz[] =
 {
     { 0x00000000, 0x00000000, 0x00000000, 0x0000000a, 0x746e6543, 0x736c7561, 0x48727561, 0 },
-    { 0x00000001, 0x00000000, 0x00000000, 0x000006fd, 0x06080800, 0x008863a9, 0xbfc9fbff, 0 },
+    { 0x00000001, 0x00000000, 0x00000000, 0x000006fd, 0x06080800, 0x008863a9, 0xbfc9fbff, 0 | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID },
     { 0x00000002, 0x00000000, 0x00000000, 0x02b3b001, 0x00000000, 0x00000000, 0x2c04307d, 0 },
     { 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0 },
     { 0x00000004, 0x00000000, 0x00000000, 0x1c000021, 0x03c0003f, 0x0000003f, 0x00000000, 0 },
@@ -59,7 +59,7 @@ static CPUMCPUIDLEAF const g_aCpuIdLeaves_VIA_QuadCore_L4700_1_2_GHz[] =
 /**
  * MSR ranges for VIA QuadCore L4700 @ 1.2+ GHz.
  */
-static CPUMMSRRANGE const g_aMsrRanges_VIA_QuadCore_L4700_1_2_GHz[] = 
+static CPUMMSRRANGE const g_aMsrRanges_VIA_QuadCore_L4700_1_2_GHz[] =
 {
     RVI(0x00000000, 0x00000005, "ZERO_0000_0000_THRU_0000_0005", 0),
     MFX(0x00000006, "IA32_MONITOR_FILTER_LINE_SIZE", Ia32MonitorFilterLineSize, Ia32MonitorFilterLineSize, 0, UINT64_C(0xffffffffffff0000), 0), /* value=0x40 */
@@ -375,7 +375,7 @@ static CPUMMSRRANGE const g_aMsrRanges_VIA_QuadCore_L4700_1_2_GHz[] =
 /**
  * Database entry for VIA QuadCore L4700 @ 1.2+ GHz.
  */
-static CPUMDBENTRY const g_Entry_VIA_QuadCore_L4700_1_2_GHz = 
+static CPUMDBENTRY const g_Entry_VIA_QuadCore_L4700_1_2_GHz =
 {
     /*.pszName          = */ "VIA QuadCore L4700 1.2+ GHz",
     /*.pszFullName      = */ "VIA QuadCore L4700 @ 1.2+ GHz",
@@ -389,7 +389,7 @@ static CPUMDBENTRY const g_Entry_VIA_QuadCore_L4700_1_2_GHz =
     /*.cMaxPhysAddrWidth= */ 36,
     /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_VIA_QuadCore_L4700_1_2_GHz),
     /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_VIA_QuadCore_L4700_1_2_GHz)),
-    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_DEFAULTS,
+    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_DEFAULTS,
     /*.DefUnknownCpuId  = */ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     /*.fMsrMask         = */ UINT32_MAX,
     /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_VIA_QuadCore_L4700_1_2_GHz)),
diff --git a/src/VBox/VMM/VMMRC/CPUMRC.cpp b/src/VBox/VMM/VMMRC/CPUMRC.cpp
index 5c79783..098dbbc 100644
--- a/src/VBox/VMM/VMMRC/CPUMRC.cpp
+++ b/src/VBox/VMM/VMMRC/CPUMRC.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/VMM/VMMRC/CPUMRCA.asm b/src/VBox/VMM/VMMRC/CPUMRCA.asm
index 36d7fa2..e84e5a6 100644
--- a/src/VBox/VMM/VMMRC/CPUMRCA.asm
+++ b/src/VBox/VMM/VMMRC/CPUMRCA.asm
@@ -3,7 +3,8 @@
 ; CPUM - Raw-mode Context Assembly Routines.
 ;
 
-; Copyright (C) 2006-2012 Oracle Corporation
+;
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -43,31 +44,6 @@ extern NAME(CPUMRCAssertPreExecutionSanity)
 
 BEGINCODE
 
-;; Macro for FXSAVE/FXRSTOR leaky behaviour on AMD CPUs, see cpumR3CheckLeakyFpu().
-; Cleans the FPU state, if necessary, before restoring the FPU.
-;
-; This macro ASSUMES CR0.TS is not set!
-; @remarks Trashes xAX!!
-; Changes here should also be reflected in CPUMR0A.asm's copy!
-%macro CLEANFPU 0
-    test    dword [xDX + CPUMCPU.fUseFlags], CPUM_USE_FFXSR_LEAKY
-    jz      .nothing_to_clean
-
-    xor     eax, eax
-    fnstsw  ax               ; Get FSW
-    test    eax, RT_BIT(7)   ; If FSW.ES (bit 7) is set, clear it to not cause FPU exceptions
-                             ; while clearing & loading the FPU bits in 'clean_fpu'
-    jz      clean_fpu
-    fnclex
-
-.clean_fpu:
-    ffree   st7              ; Clear FPU stack register(7)'s tag entry to prevent overflow if a wraparound occurs
-                             ; for the upcoming push (load)
-    fild    dword [xDX + CPUMCPU.Guest.fpu] ; Explicit FPU load to overwrite FIP, FOP, FDP registers in the FPU.
-
-.nothing_to_clean:
-%endmacro
-
 
 ;;
 ; Handles lazy FPU saving and restoring.
@@ -81,162 +57,138 @@ BEGINCODE
 ;
 ; @returns  0 if caller should continue execution.
 ; @returns  VINF_EM_RAW_GUEST_TRAP if a guest trap should be generated.
-; @param    pCPUMCPU  x86:[esp+4] GCC:rdi MSC:rcx     CPUMCPU pointer
+; @param    pCpumCpu    [ebp+8]     Pointer to the CPUMCPU.
 ;
 align 16
 BEGINPROC   cpumHandleLazyFPUAsm
-    ;
-    ; Figure out what to do.
-    ;
-    ; There are two basic actions:
-    ;   1. Save host fpu and restore guest fpu.
-    ;   2. Generate guest trap.
-    ;
-    ; When entering the hypervisor we'll always enable MP (for proper wait
-    ; trapping) and TS (for intercepting all fpu/mmx/sse stuff). The EM flag
-    ; is taken from the guest OS in order to get proper SSE handling.
-    ;
-    ;
-    ; Actions taken depending on the guest CR0 flags:
-    ;
-    ;   3    2    1
-    ;  TS | EM | MP | FPUInstr | WAIT :: VMM Action
-    ; ------------------------------------------------------------------------
-    ;   0 |  0 |  0 | Exec     | Exec :: Clear TS & MP, Save HC, Load GC.
-    ;   0 |  0 |  1 | Exec     | Exec :: Clear TS, Save HC, Load GC.
-    ;   0 |  1 |  0 | #NM      | Exec :: Clear TS & MP, Save HC, Load GC;
-    ;   0 |  1 |  1 | #NM      | Exec :: Clear TS, Save HC, Load GC.
-    ;   1 |  0 |  0 | #NM      | Exec :: Clear MP, Save HC, Load GC. (EM is already cleared.)
-    ;   1 |  0 |  1 | #NM      | #NM  :: Go to host taking trap there.
-    ;   1 |  1 |  0 | #NM      | Exec :: Clear MP, Save HC, Load GC. (EM is already set.)
-    ;   1 |  1 |  1 | #NM      | #NM  :: Go to host taking trap there.
-
-    ;
-    ; Before taking any of these actions we're checking if we have already
-    ; loaded the GC FPU. Because if we have, this is an trap for the guest - raw ring-3.
-    ;
-%ifdef RT_ARCH_AMD64
- %ifdef RT_OS_WINDOWS
-    mov     xDX, rcx
- %else
-    mov     xDX, rdi
- %endif
-%else
-    mov     xDX, dword [esp + 4]
-%endif
-    test    dword [xDX + CPUMCPU.fUseFlags], CPUM_USED_FPU
-    jz      hlfpua_not_loaded
-    jmp     hlfpua_to_host
+        push    ebp
+        mov     ebp, esp
+        push    ebx
+        push    esi
+        mov     ebx, [ebp + 8]
+%define pCpumCpu ebx
+%define pXState  esi
+
+        ;
+        ; Figure out what to do.
+        ;
+        ; There are two basic actions:
+        ;   1. Save host fpu and restore guest fpu.
+        ;   2. Generate guest trap.
+        ;
+        ; When entering the hypervisor we'll always enable MP (for proper wait
+        ; trapping) and TS (for intercepting all fpu/mmx/sse stuff). The EM flag
+        ; is taken from the guest OS in order to get proper SSE handling.
+        ;
+        ;
+        ; Actions taken depending on the guest CR0 flags:
+        ;
+        ;   3    2    1
+        ;  TS | EM | MP | FPUInstr | WAIT :: VMM Action
+        ; ------------------------------------------------------------------------
+        ;   0 |  0 |  0 | Exec     | Exec :: Clear TS & MP, Save HC, Load GC.
+        ;   0 |  0 |  1 | Exec     | Exec :: Clear TS, Save HC, Load GC.
+        ;   0 |  1 |  0 | #NM      | Exec :: Clear TS & MP, Save HC, Load GC;
+        ;   0 |  1 |  1 | #NM      | Exec :: Clear TS, Save HC, Load GC.
+        ;   1 |  0 |  0 | #NM      | Exec :: Clear MP, Save HC, Load GC. (EM is already cleared.)
+        ;   1 |  0 |  1 | #NM      | #NM  :: Go to host taking trap there.
+        ;   1 |  1 |  0 | #NM      | Exec :: Clear MP, Save HC, Load GC. (EM is already set.)
+        ;   1 |  1 |  1 | #NM      | #NM  :: Go to host taking trap there.
+
+        ;
+        ; Before taking any of these actions we're checking if we have already
+        ; loaded the GC FPU. Because if we have, this is an trap for the guest - raw ring-3.
+        ;
+        test    dword [pCpumCpu + CPUMCPU.fUseFlags], CPUM_USED_FPU
+        jz      hlfpua_not_loaded
+        jmp     hlfpua_guest_trap
 
     ;
     ; Take action.
     ;
 align 16
 hlfpua_not_loaded:
-    mov     eax, [xDX + CPUMCPU.Guest.cr0]
-    and     eax, X86_CR0_MP | X86_CR0_EM | X86_CR0_TS
-%ifdef RT_ARCH_AMD64
-    lea     r8, [hlfpuajmp1 wrt rip]
-    jmp     qword [rax*4 + r8]
-%else
-    jmp     dword [eax*2 + hlfpuajmp1]
-%endif
+        mov     eax, [pCpumCpu + CPUMCPU.Guest.cr0]
+        and     eax, X86_CR0_MP | X86_CR0_EM | X86_CR0_TS
+        jmp     dword [eax*2 + hlfpuajmp1]
 align 16
 ;; jump table using fpu related cr0 flags as index.
 hlfpuajmp1:
-    RTCCPTR_DEF hlfpua_switch_fpu_ctx
-    RTCCPTR_DEF hlfpua_switch_fpu_ctx
-    RTCCPTR_DEF hlfpua_switch_fpu_ctx
-    RTCCPTR_DEF hlfpua_switch_fpu_ctx
-    RTCCPTR_DEF hlfpua_switch_fpu_ctx
-    RTCCPTR_DEF hlfpua_to_host
-    RTCCPTR_DEF hlfpua_switch_fpu_ctx
-    RTCCPTR_DEF hlfpua_to_host
+        RTCCPTR_DEF hlfpua_switch_fpu_ctx
+        RTCCPTR_DEF hlfpua_switch_fpu_ctx
+        RTCCPTR_DEF hlfpua_switch_fpu_ctx
+        RTCCPTR_DEF hlfpua_switch_fpu_ctx
+        RTCCPTR_DEF hlfpua_switch_fpu_ctx
+        RTCCPTR_DEF hlfpua_guest_trap
+        RTCCPTR_DEF hlfpua_switch_fpu_ctx
+        RTCCPTR_DEF hlfpua_guest_trap
 ;; and mask for cr0.
 hlfpu_afFlags:
-    RTCCPTR_DEF ~(X86_CR0_TS | X86_CR0_MP)
-    RTCCPTR_DEF ~(X86_CR0_TS)
-    RTCCPTR_DEF ~(X86_CR0_TS | X86_CR0_MP)
-    RTCCPTR_DEF ~(X86_CR0_TS)
-    RTCCPTR_DEF ~(X86_CR0_MP)
-    RTCCPTR_DEF 0
-    RTCCPTR_DEF ~(X86_CR0_MP)
-    RTCCPTR_DEF 0
-
-    ;
-    ; Action - switch FPU context and change cr0 flags.
-    ;
+        RTCCPTR_DEF ~(X86_CR0_TS | X86_CR0_MP)
+        RTCCPTR_DEF ~(X86_CR0_TS)
+        RTCCPTR_DEF ~(X86_CR0_TS | X86_CR0_MP)
+        RTCCPTR_DEF ~(X86_CR0_TS)
+        RTCCPTR_DEF ~(X86_CR0_MP)
+        RTCCPTR_DEF 0
+        RTCCPTR_DEF ~(X86_CR0_MP)
+        RTCCPTR_DEF 0
+
+        ;
+        ; Action - switch FPU context and change cr0 flags.
+        ;
 align 16
 hlfpua_switch_fpu_ctx:
-    ; Paranoia. This function was previously used in ring-0, not any longer.
-%ifdef IN_RING3
-%error "This function is not written for ring-3"
-%endif
-%ifdef IN_RING0
-%error "This function is not written for ring-0"
-%endif
-
-    mov     xCX, cr0
-%ifdef RT_ARCH_AMD64
-    lea     r8, [hlfpu_afFlags wrt rip]
-    and     rcx, [rax*4 + r8]                   ; calc the new cr0 flags.
-%else
-    and     ecx, [eax*2 + hlfpu_afFlags]        ; calc the new cr0 flags.
-%endif
-    mov     xAX, cr0
-    and     xAX, ~(X86_CR0_TS | X86_CR0_EM)
-    mov     cr0, xAX                            ; clear flags so we don't trap here.
-%ifndef RT_ARCH_AMD64
-    mov     eax, edx                            ; Calculate the PCPUM pointer
-    sub     eax, [edx + CPUMCPU.offCPUM]
-    test    dword [eax + CPUM.CPUFeatures.edx], X86_CPUID_FEATURE_EDX_FXSR
-    jz short hlfpua_no_fxsave
-%endif
-
-%ifdef RT_ARCH_AMD64
-    ; Use explicit REX prefix. See @bugref{6398}.
-    o64 fxsave  [xDX + CPUMCPU.Host.fpu]
-%else
-    fxsave  [xDX + CPUMCPU.Host.fpu]
-%endif
-    or      dword [xDX + CPUMCPU.fUseFlags], (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM)
-    fxrstor [xDX + CPUMCPU.Guest.fpu]           ; raw-mode guest is always 32-bit. See @bugref{7138}.
+        mov     ecx, cr0
+        mov     edx, ecx
+        and     ecx, [eax*2 + hlfpu_afFlags] ; Calc the new cr0 flags. Do NOT use ECX until we restore it!
+        and     edx, ~(X86_CR0_TS | X86_CR0_EM)
+        mov     cr0, edx                ; Clear flags so we don't trap here.
+
+        mov     eax, [pCpumCpu + CPUMCPU.Host.fXStateMask]
+        mov     pXState, [pCpumCpu + CPUMCPU.Host.pXStateRC]
+        or      eax, eax
+        jz      hlfpua_host_fxsave
+        mov     edx, [pCpumCpu + CPUMCPU.Host.fXStateMask + 4]
+        xsave   [pXState]
+        jmp     hlfpua_host_done
+hlfpua_host_fxsave:
+        fxsave  [pXState]
+hlfpua_host_done:
+
+        mov     eax, [pCpumCpu + CPUMCPU.Guest.fXStateMask]
+        mov     pXState, [pCpumCpu + CPUMCPU.Guest.pXStateRC]
+        or      eax, eax
+        jz      hlfpua_guest_fxrstor
+        mov     edx, [pCpumCpu + CPUMCPU.Guest.fXStateMask + 4]
+        xrstor  [pXState]
+        jmp     hlfpua_guest_done
+hlfpua_guest_fxrstor:
+        fxrstor [pXState]
+hlfpua_guest_done:
 
 hlfpua_finished_switch:
+        or      dword [pCpumCpu + CPUMCPU.fUseFlags], (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM)
 
-    ; Load new CR0 value.
-    ;; @todo Optimize the many unconditional CR0 writes.
-    mov     cr0, xCX                            ; load the new cr0 flags.
-
-    ; return continue execution.
-    xor     eax, eax
-    ret
-
-%ifndef RT_ARCH_AMD64
-; legacy support.
-hlfpua_no_fxsave:
-    fnsave  [xDX + CPUMCPU.Host.fpu]
-    or      dword [xDX + CPUMCPU.fUseFlags], dword (CPUM_USED_FPU | CPUM_USED_FPU_SINCE_REM) ; yasm / nasm
-    mov     eax, [xDX + CPUMCPU.Guest.fpu]      ; control word
-    not     eax                                 ; 1 means exception ignored (6 LS bits)
-    and     eax, byte 03Fh                      ; 6 LS bits only
-    test    eax, [xDX + CPUMCPU.Guest.fpu + 4]  ; status word
-    jz short hlfpua_no_exceptions_pending
-    ; technically incorrect, but we certainly don't want any exceptions now!!
-    and     dword [xDX + CPUMCPU.Guest.fpu + 4], ~03Fh
-hlfpua_no_exceptions_pending:
-    frstor  [xDX + CPUMCPU.Guest.fpu]
-    jmp near hlfpua_finished_switch
-%endif ; !RT_ARCH_AMD64
+        ; Load new CR0 value.
+        mov     cr0, ecx                ; load the new cr0 flags.
 
+        ; return continue execution.
+        pop     esi
+        pop     ebx
+        xor     eax, eax
+        leave
+        ret
 
-    ;
-    ; Action - Generate Guest trap.
-    ;
+        ;
+        ; Action - Generate Guest trap.
+        ;
 hlfpua_action_4:
-hlfpua_to_host:
-    mov     eax, VINF_EM_RAW_GUEST_TRAP
-    ret
+hlfpua_guest_trap:
+        pop     esi
+        pop     ebx
+        mov     eax, VINF_EM_RAW_GUEST_TRAP
+        leave
+        ret
 ENDPROC     cpumHandleLazyFPUAsm
 
 
@@ -256,47 +208,47 @@ ENDPROC     cpumHandleLazyFPUAsm
 ; VMMRCDECL(void) CPUMGCCallGuestTrapHandler(PCPUMCTXCORE pRegFrame, uint32_t selCS, RTGCPTR pHandler, uint32_t eflags, uint32_t selSS, RTGCPTR pEsp);
 align 16
 BEGINPROC_EXPORTED CPUMGCCallGuestTrapHandler
-    mov     ebp, esp
-
-    ; construct iret stack frame
-    push    dword [ebp + 20]                ; SS
-    push    dword [ebp + 24]                ; ESP
-    push    dword [ebp + 16]                ; EFLAGS
-    push    dword [ebp + 8]                 ; CS
-    push    dword [ebp + 12]                ; EIP
-
-    ;
-    ; enable WP
-    ;
+        mov     ebp, esp
+
+        ; construct iret stack frame
+        push    dword [ebp + 20]        ; SS
+        push    dword [ebp + 24]        ; ESP
+        push    dword [ebp + 16]        ; EFLAGS
+        push    dword [ebp + 8]         ; CS
+        push    dword [ebp + 12]        ; EIP
+
+        ;
+        ; enable WP
+        ;
 %ifdef ENABLE_WRITE_PROTECTION
-    mov     eax, cr0
-    or      eax, X86_CR0_WRITE_PROTECT
-    mov     cr0, eax
+        mov     eax, cr0
+        or      eax, X86_CR0_WRITE_PROTECT
+        mov     cr0, eax
 %endif
 
-    ; restore CPU context (all except cs, eip, ss, esp & eflags; which are restored or overwritten by iret)
-    mov     ebp, [ebp + 4]                  ; pRegFrame
-    mov     ebx, [ebp + CPUMCTXCORE.ebx]
-    mov     ecx, [ebp + CPUMCTXCORE.ecx]
-    mov     edx, [ebp + CPUMCTXCORE.edx]
-    mov     esi, [ebp + CPUMCTXCORE.esi]
-    mov     edi, [ebp + CPUMCTXCORE.edi]
-
-    ;; @todo  load segment registers *before* enabling WP.
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_GS | CPUM_HANDLER_CTXCORE_IN_EBP
-    mov     gs, [ebp + CPUMCTXCORE.gs.Sel]
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_FS | CPUM_HANDLER_CTXCORE_IN_EBP
-    mov     fs, [ebp + CPUMCTXCORE.fs.Sel]
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_ES | CPUM_HANDLER_CTXCORE_IN_EBP
-    mov     es, [ebp + CPUMCTXCORE.es.Sel]
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_DS | CPUM_HANDLER_CTXCORE_IN_EBP
-    mov     ds, [ebp + CPUMCTXCORE.ds.Sel]
-
-    mov     eax, [ebp + CPUMCTXCORE.eax]
-    mov     ebp, [ebp + CPUMCTXCORE.ebp]
-
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_IRET
-    iret
+        ; restore CPU context (all except cs, eip, ss, esp & eflags; which are restored or overwritten by iret)
+        mov     ebp, [ebp + 4]          ; pRegFrame
+        mov     ebx, [ebp + CPUMCTXCORE.ebx]
+        mov     ecx, [ebp + CPUMCTXCORE.ecx]
+        mov     edx, [ebp + CPUMCTXCORE.edx]
+        mov     esi, [ebp + CPUMCTXCORE.esi]
+        mov     edi, [ebp + CPUMCTXCORE.edi]
+
+        ;; @todo  load segment registers *before* enabling WP.
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_GS | CPUM_HANDLER_CTXCORE_IN_EBP
+        mov     gs, [ebp + CPUMCTXCORE.gs.Sel]
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_FS | CPUM_HANDLER_CTXCORE_IN_EBP
+        mov     fs, [ebp + CPUMCTXCORE.fs.Sel]
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_ES | CPUM_HANDLER_CTXCORE_IN_EBP
+        mov     es, [ebp + CPUMCTXCORE.es.Sel]
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_DS | CPUM_HANDLER_CTXCORE_IN_EBP
+        mov     ds, [ebp + CPUMCTXCORE.ds.Sel]
+
+        mov     eax, [ebp + CPUMCTXCORE.eax]
+        mov     ebp, [ebp + CPUMCTXCORE.ebp]
+
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_IRET
+        iret
 ENDPROC CPUMGCCallGuestTrapHandler
 
 
@@ -311,39 +263,39 @@ ENDPROC CPUMGCCallGuestTrapHandler
 ;VMMRCDECL(void) CPUMGCCallV86Code(PCPUMCTXCORE pRegFrame);
 align 16
 BEGINPROC CPUMGCCallV86Code
-    mov     ebp, [esp + 4]                  ; pRegFrame
-
-    ; construct iret stack frame
-    push    dword [ebp + CPUMCTXCORE.gs.Sel]
-    push    dword [ebp + CPUMCTXCORE.fs.Sel]
-    push    dword [ebp + CPUMCTXCORE.ds.Sel]
-    push    dword [ebp + CPUMCTXCORE.es.Sel]
-    push    dword [ebp + CPUMCTXCORE.ss.Sel]
-    push    dword [ebp + CPUMCTXCORE.esp]
-    push    dword [ebp + CPUMCTXCORE.eflags]
-    push    dword [ebp + CPUMCTXCORE.cs.Sel]
-    push    dword [ebp + CPUMCTXCORE.eip]
-
-    ;
-    ; enable WP
-    ;
+        mov     ebp, [esp + 4]          ; pRegFrame
+
+        ; construct iret stack frame
+        push    dword [ebp + CPUMCTXCORE.gs.Sel]
+        push    dword [ebp + CPUMCTXCORE.fs.Sel]
+        push    dword [ebp + CPUMCTXCORE.ds.Sel]
+        push    dword [ebp + CPUMCTXCORE.es.Sel]
+        push    dword [ebp + CPUMCTXCORE.ss.Sel]
+        push    dword [ebp + CPUMCTXCORE.esp]
+        push    dword [ebp + CPUMCTXCORE.eflags]
+        push    dword [ebp + CPUMCTXCORE.cs.Sel]
+        push    dword [ebp + CPUMCTXCORE.eip]
+
+        ;
+        ; enable WP
+        ;
 %ifdef ENABLE_WRITE_PROTECTION
-    mov     eax, cr0
-    or      eax, X86_CR0_WRITE_PROTECT
-    mov     cr0, eax
+        mov     eax, cr0
+        or      eax, X86_CR0_WRITE_PROTECT
+        mov     cr0, eax
 %endif
 
-    ; restore CPU context (all except cs, eip, ss, esp, eflags, ds, es, fs & gs; which are restored or overwritten by iret)
-    mov     eax, [ebp + CPUMCTXCORE.eax]
-    mov     ebx, [ebp + CPUMCTXCORE.ebx]
-    mov     ecx, [ebp + CPUMCTXCORE.ecx]
-    mov     edx, [ebp + CPUMCTXCORE.edx]
-    mov     esi, [ebp + CPUMCTXCORE.esi]
-    mov     edi, [ebp + CPUMCTXCORE.edi]
-    mov     ebp, [ebp + CPUMCTXCORE.ebp]
-
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_IRET
-    iret
+        ; restore CPU context (all except cs, eip, ss, esp, eflags, ds, es, fs & gs; which are restored or overwritten by iret)
+        mov     eax, [ebp + CPUMCTXCORE.eax]
+        mov     ebx, [ebp + CPUMCTXCORE.ebx]
+        mov     ecx, [ebp + CPUMCTXCORE.ecx]
+        mov     edx, [ebp + CPUMCTXCORE.edx]
+        mov     esi, [ebp + CPUMCTXCORE.esi]
+        mov     edi, [ebp + CPUMCTXCORE.edi]
+        mov     ebp, [ebp + CPUMCTXCORE.ebp]
+
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_IRET
+        iret
 ENDPROC CPUMGCCallV86Code
 
 
@@ -356,82 +308,80 @@ ENDPROC CPUMGCCallV86Code
 ;
 ; This call never returns!
 ;
-; @param    edx     Pointer to CPUM structure.
+; @param    edx     Pointer to CPUMCPU structure.
 ;
 align 16
 BEGINPROC_EXPORTED CPUMGCResumeGuest
 %ifdef VBOX_STRICT
-    ; Call CPUM to check sanity.
-    push    edx
-    mov     edx, IMP(g_VM)
-    push    edx
-    call    NAME(CPUMRCAssertPreExecutionSanity)
-    add     esp, 4
-    pop     edx
+        ; Call CPUM to check sanity.
+        push    edx
+        mov     edx, IMP(g_VM)
+        push    edx
+        call    NAME(CPUMRCAssertPreExecutionSanity)
+        add     esp, 4
+        pop     edx
 %endif
 
-    ; Convert to CPUMCPU pointer
-    add     edx, [edx + CPUM.offCPUMCPU0]
-    ;
-    ; Setup iretd
-    ;
-    push    dword [edx + CPUMCPU.Guest.ss.Sel]
-    push    dword [edx + CPUMCPU.Guest.esp]
-    push    dword [edx + CPUMCPU.Guest.eflags]
-    push    dword [edx + CPUMCPU.Guest.cs.Sel]
-    push    dword [edx + CPUMCPU.Guest.eip]
-
-    ;
-    ; Restore registers.
-    ;
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_ES
-    mov     es,  [edx + CPUMCPU.Guest.es.Sel]
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_FS
-    mov     fs,  [edx + CPUMCPU.Guest.fs.Sel]
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_GS
-    mov     gs,  [edx + CPUMCPU.Guest.gs.Sel]
+        ;
+        ; Setup iretd
+        ;
+        push    dword [edx + CPUMCPU.Guest.ss.Sel]
+        push    dword [edx + CPUMCPU.Guest.esp]
+        push    dword [edx + CPUMCPU.Guest.eflags]
+        push    dword [edx + CPUMCPU.Guest.cs.Sel]
+        push    dword [edx + CPUMCPU.Guest.eip]
+
+        ;
+        ; Restore registers.
+        ;
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_ES
+        mov     es,  [edx + CPUMCPU.Guest.es.Sel]
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_FS
+        mov     fs,  [edx + CPUMCPU.Guest.fs.Sel]
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_GS
+        mov     gs,  [edx + CPUMCPU.Guest.gs.Sel]
 
 %ifdef VBOX_WITH_STATISTICS
-    ;
-    ; Statistics.
-    ;
-    push    edx
-    mov     edx, IMP(g_VM)
-    lea     edx, [edx + VM.StatTotalQemuToGC]
-    STAM_PROFILE_ADV_STOP edx
-
-    mov     edx, IMP(g_VM)
-    lea     edx, [edx + VM.StatTotalInGC]
-    STAM_PROFILE_ADV_START edx
-    pop     edx
+        ;
+        ; Statistics.
+        ;
+        push    edx
+        mov     edx, IMP(g_VM)
+        lea     edx, [edx + VM.StatTotalQemuToGC]
+        STAM_PROFILE_ADV_STOP edx
+
+        mov     edx, IMP(g_VM)
+        lea     edx, [edx + VM.StatTotalInGC]
+        STAM_PROFILE_ADV_START edx
+        pop     edx
 %endif
 
-    ;
-    ; enable WP
-    ;
+        ;
+        ; enable WP
+        ;
 %ifdef ENABLE_WRITE_PROTECTION
-    mov     eax, cr0
-    or      eax, X86_CR0_WRITE_PROTECT
-    mov     cr0, eax
+        mov     eax, cr0
+        or      eax, X86_CR0_WRITE_PROTECT
+        mov     cr0, eax
 %endif
 
-    ;
-    ; Continue restore.
-    ;
-    mov     esi, [edx + CPUMCPU.Guest.esi]
-    mov     edi, [edx + CPUMCPU.Guest.edi]
-    mov     ebp, [edx + CPUMCPU.Guest.ebp]
-    mov     ebx, [edx + CPUMCPU.Guest.ebx]
-    mov     ecx, [edx + CPUMCPU.Guest.ecx]
-    mov     eax, [edx + CPUMCPU.Guest.eax]
-    push    dword [edx + CPUMCPU.Guest.ds.Sel]
-    mov     edx, [edx + CPUMCPU.Guest.edx]
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_DS
-    pop     ds
-
-    ; restart execution.
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_IRET
-    iretd
+        ;
+        ; Continue restore.
+        ;
+        mov     esi, [edx + CPUMCPU.Guest.esi]
+        mov     edi, [edx + CPUMCPU.Guest.edi]
+        mov     ebp, [edx + CPUMCPU.Guest.ebp]
+        mov     ebx, [edx + CPUMCPU.Guest.ebx]
+        mov     ecx, [edx + CPUMCPU.Guest.ecx]
+        mov     eax, [edx + CPUMCPU.Guest.eax]
+        push    dword [edx + CPUMCPU.Guest.ds.Sel]
+        mov     edx, [edx + CPUMCPU.Guest.edx]
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_DS
+        pop     ds
+
+        ; restart execution.
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_IRET
+        iretd
 ENDPROC     CPUMGCResumeGuest
 
 
@@ -444,78 +394,76 @@ ENDPROC     CPUMGCResumeGuest
 ;
 ; This call never returns!
 ;
-; @param    edx     Pointer to CPUM structure.
+; @param    edx     Pointer to CPUMCPU structure.
 ;
 align 16
 BEGINPROC_EXPORTED CPUMGCResumeGuestV86
 %ifdef VBOX_STRICT
-    ; Call CPUM to check sanity.
-    push    edx
-    mov     edx, IMP(g_VM)
-    push    edx
-    call    NAME(CPUMRCAssertPreExecutionSanity)
-    add     esp, 4
-    pop     edx
+        ; Call CPUM to check sanity.
+        push    edx
+        mov     edx, IMP(g_VM)
+        push    edx
+        call    NAME(CPUMRCAssertPreExecutionSanity)
+        add     esp, 4
+        pop     edx
 %endif
 
-    ; Convert to CPUMCPU pointer
-    add     edx, [edx + CPUM.offCPUMCPU0]
-    ;
-    ; Setup iretd
-    ;
-    push    dword [edx + CPUMCPU.Guest.gs.Sel]
-    push    dword [edx + CPUMCPU.Guest.fs.Sel]
-    push    dword [edx + CPUMCPU.Guest.ds.Sel]
-    push    dword [edx + CPUMCPU.Guest.es.Sel]
+        ;
+        ; Setup iretd
+        ;
+        push    dword [edx + CPUMCPU.Guest.gs.Sel]
+        push    dword [edx + CPUMCPU.Guest.fs.Sel]
+        push    dword [edx + CPUMCPU.Guest.ds.Sel]
+        push    dword [edx + CPUMCPU.Guest.es.Sel]
 
-    push    dword [edx + CPUMCPU.Guest.ss.Sel]
-    push    dword [edx + CPUMCPU.Guest.esp]
+        push    dword [edx + CPUMCPU.Guest.ss.Sel]
+        push    dword [edx + CPUMCPU.Guest.esp]
 
-    push    dword [edx + CPUMCPU.Guest.eflags]
-    push    dword [edx + CPUMCPU.Guest.cs.Sel]
-    push    dword [edx + CPUMCPU.Guest.eip]
+        push    dword [edx + CPUMCPU.Guest.eflags]
+        push    dword [edx + CPUMCPU.Guest.cs.Sel]
+        push    dword [edx + CPUMCPU.Guest.eip]
 
-    ;
-    ; Restore registers.
-    ;
+        ;
+        ; Restore registers.
+        ;
 
 %ifdef VBOX_WITH_STATISTICS
-    ;
-    ; Statistics.
-    ;
-    push    edx
-    mov     edx, IMP(g_VM)
-    lea     edx, [edx + VM.StatTotalQemuToGC]
-    STAM_PROFILE_ADV_STOP edx
-
-    mov     edx, IMP(g_VM)
-    lea     edx, [edx + VM.StatTotalInGC]
-    STAM_PROFILE_ADV_START edx
-    pop     edx
+        ;
+        ; Statistics.
+        ;
+        push    edx
+        mov     edx, IMP(g_VM)
+        lea     edx, [edx + VM.StatTotalQemuToGC]
+        STAM_PROFILE_ADV_STOP edx
+
+        mov     edx, IMP(g_VM)
+        lea     edx, [edx + VM.StatTotalInGC]
+        STAM_PROFILE_ADV_START edx
+        pop     edx
 %endif
 
-    ;
-    ; enable WP
-    ;
+        ;
+        ; enable WP
+        ;
 %ifdef ENABLE_WRITE_PROTECTION
-    mov     eax, cr0
-    or      eax, X86_CR0_WRITE_PROTECT
-    mov     cr0, eax
+        mov     eax, cr0
+        or      eax, X86_CR0_WRITE_PROTECT
+        mov     cr0, eax
 %endif
 
-    ;
-    ; Continue restore.
-    ;
-    mov     esi, [edx + CPUMCPU.Guest.esi]
-    mov     edi, [edx + CPUMCPU.Guest.edi]
-    mov     ebp, [edx + CPUMCPU.Guest.ebp]
-    mov     ecx, [edx + CPUMCPU.Guest.ecx]
-    mov     ebx, [edx + CPUMCPU.Guest.ebx]
-    mov     eax, [edx + CPUMCPU.Guest.eax]
-    mov     edx, [edx + CPUMCPU.Guest.edx]
-
-    ; restart execution.
-    TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_IRET
-    iretd
+        ;
+        ; Continue restore.
+        ;
+        mov     esi, [edx + CPUMCPU.Guest.esi]
+        mov     edi, [edx + CPUMCPU.Guest.edi]
+        mov     ebp, [edx + CPUMCPU.Guest.ebp]
+        mov     ecx, [edx + CPUMCPU.Guest.ecx]
+        mov     ebx, [edx + CPUMCPU.Guest.ebx]
+        mov     eax, [edx + CPUMCPU.Guest.eax]
+        mov     edx, [edx + CPUMCPU.Guest.edx]
+
+        ; restart execution.
+        TRPM_NP_GP_HANDLER NAME(cpumRCHandleNPAndGP), CPUM_HANDLER_IRET
+        iretd
 ENDPROC     CPUMGCResumeGuestV86
 
diff --git a/src/VBox/VMM/VMMRC/CPUMRCPatchHlp.asm b/src/VBox/VMM/VMMRC/CPUMRCPatchHlp.asm
new file mode 100644
index 0000000..3e7e559
--- /dev/null
+++ b/src/VBox/VMM/VMMRC/CPUMRCPatchHlp.asm
@@ -0,0 +1,194 @@
+; $Id: CPUMRCPatchHlp.asm $
+;; @file
+; CPUM - Patch Helpers.
+;
+
+; Copyright (C) 2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+
+
+;*******************************************************************************
+;* Header Files                                                                *
+;*******************************************************************************
+%include "VBox/asmdefs.mac"
+%include "VBox/vmm/cpum.mac"
+%include "CPUMInternal.mac"
+%include "VBox/vmm/vm.mac"
+%include "VMMRC.mac"
+
+
+;*******************************************************************************
+;*  External Symbols                                                           *
+;*******************************************************************************
+extern IMPNAME(g_VM)
+
+
+BEGIN_PATCH_HLP_SEG
+
+;;
+; Helper for PATMCpuidReplacement. 
+; 
+; We have at most 32 bytes of stack to play with, .
+;
+; @input    eax, ecx(, edx, ebx)
+; @output   eax, ebx, ecx, ebx
+;
+; @uses     eflags (caller saves them)
+;
+BEGINPROC_EXPORTED CPUMPatchHlpCpuId
+    ; Save the registers we use for passthru and sub-leaf matching (eax is not used).
+    push    edx
+    push    ecx
+    push    ebx
+
+    ; Use edi as VM pointer.
+    push    edi
+    mov     edi, IMP_SEG(ss, g_VM)
+
+%define CPUMCPUIDLEAF_SIZE_LOG2 5       ; ASSUMES CPUMCPUIDLEAF_size == 32
+
+    ;
+    ; Perform a binary search looking for leaf with the EAX value.
+    ;             
+    mov     edx, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.cCpuIdLeaves]   
+    mov     ecx, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.paCpuIdLeavesRC]
+    test    edx, edx
+    jz      cpuid_unknown
+    shl     edx, CPUMCPUIDLEAF_SIZE_LOG2
+    add     edx, ecx                    ; edx = end (exclusive); ecx = start.
+
+cpuid_lookup_leaf:
+    ; Find the middle element
+    mov     ebx, edx
+cpuid_lookup_leaf_ebx_loeaded:
+    sub     ebx, ecx
+    shr     ebx, 1 + CPUMCPUIDLEAF_SIZE_LOG2
+    shl     ebx, CPUMCPUIDLEAF_SIZE_LOG2
+    add     ebx, ecx                    ; ebx = middle element.
+
+    ; Compare.
+    cmp     eax, [ss:ebx + CPUMCPUIDLEAF.uLeaf]
+    jae     cpuid_lookup_split_up
+
+    ; The leaf is before ebx.
+cpuid_lookup_split_down:
+    cmp     ecx, ebx                    ; start == middle? if so, we failed.
+    mov     edx, ebx                    ; end = middle;
+    jne     cpuid_lookup_leaf_ebx_loeaded
+    jmp     cpuid_unknown
+
+    ; The leaf is at or after ebx.
+cpuid_lookup_split_up:
+    je      cpuid_match_eax
+    lea     ecx, [ebx + CPUMCPUIDLEAF_size] ; start = middle + 1
+    cmp     ecx, edx                    ; middle + 1 == start? if so, we failed.
+    jne     cpuid_lookup_leaf
+    jmp     cpuid_unknown
+
+    ;
+    ; We've to a matching leaf, does the sub-leaf match too?
+    ;
+cpuid_match_eax:    
+    mov     ecx, [esp + 4]
+    and     ecx, [ss:ebx + CPUMCPUIDLEAF.fSubLeafMask]
+    cmp     ecx, [ss:ebx + CPUMCPUIDLEAF.uSubLeaf]
+    je      cpuid_fetch
+    ja      cpuid_lookup_subleaf_forwards
+
+    ;
+    ; Search backwards.
+    ;
+cpuid_lookup_subleaf_backwards:
+    mov     edx, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.paCpuIdLeavesRC] ; edx = first leaf
+
+cpuid_lookup_subleaf_backwards_loop:
+    cmp     ebx, edx                    ; Is there a leaf before the current? 
+    jbe     cpuid_subleaf_not_found     ; If not we're out of luck.
+    cmp     eax, [ss:ebx - CPUMCPUIDLEAF_size + CPUMCPUIDLEAF.uLeaf]
+    jne     cpuid_subleaf_not_found     ; If the leaf before us does not have the same leaf number, we failed.
+    sub     ebx, CPUMCPUIDLEAF_size
+    cmp     ecx, [ss:ebx + CPUMCPUIDLEAF.uSubLeaf]
+    je      cpuid_fetch                 ; If the subleaf matches, we're good!.
+    jb      cpuid_lookup_subleaf_backwards_loop ; Still hope if the subleaf we're seeking is smaller.
+    jmp     cpuid_subleaf_not_found     ; Too bad.
+
+    ;
+    ; Search forward until we've got a matching sub-leaf (or not).  
+    ;
+cpuid_lookup_subleaf_forwards:
+    ; Calculate the last leaf address.
+    mov     edx, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.cCpuIdLeaves]   
+    dec     edx
+    shl     edx, CPUMCPUIDLEAF_SIZE_LOG2
+    add     edx, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.paCpuIdLeavesRC] ; edx = last leaf (inclusive)
+
+cpuid_subleaf_lookup:
+    cmp     ebx, edx
+    jae     cpuid_subleaf_not_found
+    cmp     eax, [ss:ebx + CPUMCPUIDLEAF_size + CPUMCPUIDLEAF.uLeaf]
+    jne     cpuid_subleaf_not_found
+    add     ebx, CPUMCPUIDLEAF_size
+    cmp     ecx, [ss:ebx + CPUMCPUIDLEAF.uSubLeaf]    
+    ja      cpuid_subleaf_lookup
+    je      cpuid_fetch
+    
+    ;
+    ; Out of range sub-leaves aren't quite as easy and pretty as we emulate them
+    ; here, but we do an adequate job.
+    ;    
+cpuid_subleaf_not_found:
+    xor     ecx, ecx
+    test    dword [ss:ebx + CPUMCPUIDLEAF.fFlags], CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES
+    jz      cpuid_load_zeros_except_ecx
+    mov     ecx, [esp + 4]
+    and     ecx, 0ffh
+cpuid_load_zeros_except_ecx:
+    xor     edx, edx
+    xor     eax, eax
+    xor     ebx, ebx
+    jmp     cpuid_done
+
+    ;
+    ; Different CPUs have different ways of dealing with unknown CPUID leaves.
+    ;
+cpuid_unknown:
+    mov     ebx, IMP_SEG(ss, g_VM)
+    mov     dword [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.enmUnknownCpuIdMethod], CPUMUNKNOWNCPUID_PASSTHRU
+    je      cpuid_unknown_passthru
+    ; Load the default cpuid leaf.
+cpuid_unknown_def_leaf:
+    mov     edx, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.DefCpuId + CPUMCPUID.uEdx]
+    mov     ecx, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.DefCpuId + CPUMCPUID.uEcx]
+    mov     eax, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.DefCpuId + CPUMCPUID.uEax]
+    mov     ebx, [ss:edi + VM.cpum + CPUM.GuestInfo + CPUMINFO.DefCpuId + CPUMCPUID.uEbx]
+    jmp     cpuid_done
+    ; Pass thru the input values unmodified (eax is still virgin).
+cpuid_unknown_passthru:
+    mov     edx, [esp + 8]
+    mov     ecx, [esp + 4]
+    mov     ebx, [esp]
+    jmp     cpuid_done
+
+    ;
+    ; Normal return.
+    ;
+cpuid_fetch:
+    mov     edx, [ss:ebx + CPUMCPUIDLEAF.uEdx]
+    mov     ecx, [ss:ebx + CPUMCPUIDLEAF.uEcx]
+    mov     eax, [ss:ebx + CPUMCPUIDLEAF.uEax]
+    mov     ebx, [ss:ebx + CPUMCPUIDLEAF.uEbx]
+             
+cpuid_done:
+    pop     edi
+    add     esp, 12
+    ret
+ENDPROC CPUMPatchHlpCpuId
+
diff --git a/src/VBox/VMM/VMMRC/CSAMRC.cpp b/src/VBox/VMM/VMMRC/CSAMRC.cpp
index f1745f8..071bf07 100644
--- a/src/VBox/VMM/VMMRC/CSAMRC.cpp
+++ b/src/VBox/VMM/VMMRC/CSAMRC.cpp
@@ -45,6 +45,8 @@
 #include <iprt/asm-amd64-x86.h>
 #include <iprt/string.h>
 
+
+
 /**
  * \#PF Handler callback for virtual access handler ranges. (CSAM self-modifying
  * code monitor)
@@ -54,19 +56,22 @@
  *
  * @returns VBox status code (appropriate for GC return).
  * @param   pVM         Pointer to the VM.
- * @param   uErrorCode   CPU Error code.
+ * @param   pVCpu       Pointer to the cross context CPU context for the calling
+ *                      EMT.
+ * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      Ignored.
  */
-VMMRCDECL(int) CSAMGCCodePageWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) csamRCCodePageWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                             RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
     PPATMGCSTATE pPATMGCState;
     bool         fPatchCode = PATMIsPatchGCAddr(pVM, pRegFrame->eip);
     int          rc;
-    PVMCPU       pVCpu = VMMGetCpu0(pVM);
     NOREF(uErrorCode);
 
     Assert(pVM->csam.s.cDirtyPages < CSAM_MAX_DIRTY_PAGES);
@@ -80,10 +85,10 @@ VMMRCDECL(int) CSAMGCCodePageWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
     Assert(pPATMGCState);
 
     Assert(pPATMGCState->fPIF || fPatchCode);
-    /** When patch code is executing instructions that must complete, then we must *never* interrupt it. */
+    /* When patch code is executing instructions that must complete, then we must *never* interrupt it. */
     if (!pPATMGCState->fPIF && fPatchCode)
     {
-        Log(("CSAMGCCodePageWriteHandler: fPIF=0 -> stack fault in patch generated code at %08RX32!\n", pRegFrame->eip));
+        Log(("csamRCCodePageWriteHandler: fPIF=0 -> stack fault in patch generated code at %08RX32!\n", pRegFrame->eip));
         /** @note there are cases when pages previously used for code are now used for stack; patch generated code will fault (pushf))
          *  Just make the page r/w and continue.
          */
@@ -103,7 +108,7 @@ VMMRCDECL(int) CSAMGCCodePageWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
     else
         cpl = (pRegFrame->ss.Sel & X86_SEL_RPL);
 
-    Log(("CSAMGCCodePageWriteHandler: code page write at %RGv original address %RGv (cpl=%d)\n", pvFault, (RTGCUINTPTR)pvRange + offRange, cpl));
+    Log(("csamRCCodePageWriteHandler: code page write at %RGv original address %RGv (cpl=%d)\n", pvFault, (RTGCUINTPTR)pvRange + offRange, cpl));
 
     /* If user code is modifying one of our monitored pages, then we can safely make it r/w as it's no longer being used for supervisor code. */
     if (cpl != 3)
@@ -130,7 +135,7 @@ VMMRCDECL(int) CSAMGCCodePageWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
     /*
      * Make this particular page R/W. The VM_FF_CSAM_FLUSH_DIRTY_PAGE handler will reset it to readonly again.
      */
-    Log(("CSAMGCCodePageWriteHandler: enabled r/w for page %RGv\n", pvFault));
+    Log(("csamRCCodePageWriteHandler: enabled r/w for page %RGv\n", pvFault));
     rc = PGMShwMakePageWritable(pVCpu, pvFault, PGM_MK_PG_IS_WRITE_FAULT);
     AssertMsgRC(rc, ("PGMShwModifyPage -> rc=%Rrc\n", rc));
     ASMInvalidatePage((void *)(uintptr_t)pvFault);
diff --git a/src/VBox/VMM/VMMRC/PATMRC.cpp b/src/VBox/VMM/VMMRC/PATMRC.cpp
index a7474b4..bc4aaf7 100644
--- a/src/VBox/VMM/VMMRC/PATMRC.cpp
+++ b/src/VBox/VMM/VMMRC/PATMRC.cpp
@@ -49,16 +49,20 @@
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
- * @param   uErrorCode   CPU Error code.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
+ * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      The physical address of the guest page being monitored.
  */
-VMMRCDECL(int) PATMGCMonitorPage(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) patmRCVirtPagePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                        RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
-    NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange);
+    NOREF(pVCpu); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange); NOREF(pvUser);
     pVM->patm.s.pvFaultMonitor = (RTRCPTR)(RTRCUINTPTR)pvFault;
     return VINF_PATM_CHECK_PATCH_PAGE;
 }
diff --git a/src/VBox/VMM/VMMRC/PDMRCDevice.cpp b/src/VBox/VMM/VMMRC/PDMRCDevice.cpp
index 342e2f9..e103a77 100644
--- a/src/VBox/VMM/VMMRC/PDMRCDevice.cpp
+++ b/src/VBox/VMM/VMMRC/PDMRCDevice.cpp
@@ -200,7 +200,7 @@ static DECLCALLBACK(int) pdmRCDevHlp_PhysRead(PPDMDEVINS pDevIns, RTGCPHYS GCPhy
     LogFlow(("pdmRCDevHlp_PhysRead: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbRead=%#x\n",
              pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbRead));
 
-    int rc = PGMPhysRead(pDevIns->Internal.s.pVMRC, GCPhys, pvBuf, cbRead);
+    int rc = PGMPhysRead(pDevIns->Internal.s.pVMRC, GCPhys, pvBuf, cbRead, PGMACCESSORIGIN_DEVICE);
     AssertRC(rc); /** @todo track down the users for this bugger. */
 
     Log(("pdmRCDevHlp_PhysRead: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, rc));
@@ -215,7 +215,7 @@ static DECLCALLBACK(int) pdmRCDevHlp_PhysWrite(PPDMDEVINS pDevIns, RTGCPHYS GCPh
     LogFlow(("pdmRCDevHlp_PhysWrite: caller=%p/%d: GCPhys=%RGp pvBuf=%p cbWrite=%#x\n",
              pDevIns, pDevIns->iInstance, GCPhys, pvBuf, cbWrite));
 
-    int rc = PGMPhysWrite(pDevIns->Internal.s.pVMRC, GCPhys, pvBuf, cbWrite);
+    int rc = PGMPhysWrite(pDevIns->Internal.s.pVMRC, GCPhys, pvBuf, cbWrite, PGMACCESSORIGIN_DEVICE);
     AssertRC(rc); /** @todo track down the users for this bugger. */
 
     Log(("pdmRCDevHlp_PhysWrite: caller=%p/%d: returns %Rrc\n", pDevIns, pDevIns->iInstance, rc));
@@ -318,6 +318,16 @@ static DECLCALLBACK(PVMCPU) pdmRCDevHlp_GetVMCPU(PPDMDEVINS pDevIns)
 }
 
 
+/** @interface_method_impl{PDMDEVHLPRC,pfnGetCurrentCpuId} */
+static DECLCALLBACK(VMCPUID) pdmRCDevHlp_GetCurrentCpuId(PPDMDEVINS pDevIns)
+{
+    PDMDEV_ASSERT_DEVINS(pDevIns);
+    VMCPUID idCpu = VMMGetCpuId(pDevIns->Internal.s.pVMRC);
+    LogFlow(("pdmRCDevHlp_GetCurrentCpuId: caller='%p'/%d for CPU %u\n", pDevIns, pDevIns->iInstance, idCpu));
+    return idCpu;
+}
+
+
 /** @interface_method_impl{PDMDEVHLPRC,pfnTMTimeVirtGet} */
 static DECLCALLBACK(uint64_t) pdmRCDevHlp_TMTimeVirtGet(PPDMDEVINS pDevIns)
 {
@@ -376,6 +386,7 @@ extern DECLEXPORT(const PDMDEVHLPRC) g_pdmRCDevHlp =
     pdmRCDevHlp_PATMSetMMIOPatchInfo,
     pdmRCDevHlp_GetVM,
     pdmRCDevHlp_GetVMCPU,
+    pdmRCDevHlp_GetCurrentCpuId,
     pdmRCDevHlp_TMTimeVirtGet,
     pdmRCDevHlp_TMTimeVirtGetFreq,
     pdmRCDevHlp_TMTimeVirtGetNano,
diff --git a/src/VBox/VMM/VMMRC/SELMRC.cpp b/src/VBox/VMM/VMMRC/SELMRC.cpp
index 65367f3..905c7f2 100644
--- a/src/VBox/VMM/VMMRC/SELMRC.cpp
+++ b/src/VBox/VMM/VMMRC/SELMRC.cpp
@@ -222,12 +222,13 @@ static void selmRCSyncGDTSegRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame,
 }
 
 
-
 /**
  * \#PF Virtual Handler callback for Guest write access to the Guest's own GDT.
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
@@ -235,11 +236,11 @@ static void selmRCSyncGDTSegRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame,
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
  */
-VMMRCDECL(int) selmRCGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) selmRCGuestGDTWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                             RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
-    PVMCPU pVCpu = VMMGetCpu0(pVM);
-    LogFlow(("selmRCGuestGDTWriteHandler errcode=%x fault=%RGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange));
-    NOREF(pvRange);
+    LogFlow(("selmRCGuestGDTWritePfHandler errcode=%x fault=%RGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange));
+    NOREF(pvRange); NOREF(pvUser);
 
     /*
      * Check if any selectors might be affected.
@@ -321,20 +322,24 @@ VMMRCDECL(int) selmRCGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode   CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      Unused.
  */
-VMMRCDECL(int) selmRCGuestLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) selmRCGuestLDTWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                             RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
     /** @todo To be implemented. */
     ////LogCom(("selmRCGuestLDTWriteHandler: eip=%08X pvFault=%RGv pvRange=%RGv\r\n", pRegFrame->eip, pvFault, pvRange));
-    NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange);
+    NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange); NOREF(pvUser);
 
-    VMCPU_FF_SET(VMMGetCpu0(pVM), VMCPU_FF_SELM_SYNC_LDT);
+    VMCPU_FF_SET(pVCpu, VMCPU_FF_SELM_SYNC_LDT);
     STAM_COUNTER_INC(&pVM->selm.s.StatRCWriteGuestLDT);
     return VINF_EM_RAW_EMULATE_INSTR_LDT_FAULT;
 }
@@ -374,18 +379,21 @@ DECLINLINE(int) selmRCReadTssBits(PVM pVM, void *pvDst, void const *pvSrc, size_
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      Unused.
  */
-VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) selmRCGuestTSSWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                             RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
-    PVMCPU pVCpu = VMMGetCpu0(pVM);
-    LogFlow(("selmRCGuestTSSWriteHandler errcode=%x fault=%RGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange));
-    NOREF(pvRange);
+    LogFlow(("selmRCGuestTSSWritePfHandler errcode=%x fault=%RGv offRange=%08x\n", (uint32_t)uErrorCode, pvFault, offRange));
+    NOREF(pvRange); NOREF(pvUser);
 
     /*
      * Try emulate the access.
@@ -408,7 +416,7 @@ VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
                  ||  pGuestTss->ss0  != (pVM->selm.s.Tss.ss1 & ~1)) /* undo raw-r0 */
            )
         {
-            Log(("selmRCGuestTSSWriteHandler: R0 stack: %RTsel:%RGv -> %RTsel:%RGv\n",
+            Log(("selmRCGuestTSSWritePfHandler: R0 stack: %RTsel:%RGv -> %RTsel:%RGv\n",
                  (RTSEL)(pVM->selm.s.Tss.ss1 & ~1), (RTGCPTR)pVM->selm.s.Tss.esp1, (RTSEL)pGuestTss->ss0, (RTGCPTR)pGuestTss->esp0));
             pVM->selm.s.Tss.esp1 = pGuestTss->esp0;
             pVM->selm.s.Tss.ss1  = pGuestTss->ss0 | 1;
@@ -422,7 +430,7 @@ VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
                       ||  pGuestTss->ss1  != ((pVM->selm.s.Tss.ss2 & ~2) | 1)) /* undo raw-r1 */
                 )
         {
-            Log(("selmRCGuestTSSWriteHandler: R1 stack: %RTsel:%RGv -> %RTsel:%RGv\n",
+            Log(("selmRCGuestTSSWritePfHandler: R1 stack: %RTsel:%RGv -> %RTsel:%RGv\n",
                  (RTSEL)((pVM->selm.s.Tss.ss2 & ~2) | 1), (RTGCPTR)pVM->selm.s.Tss.esp2, (RTSEL)pGuestTss->ss1, (RTGCPTR)pGuestTss->esp1));
             pVM->selm.s.Tss.esp2 = pGuestTss->esp1;
             pVM->selm.s.Tss.ss2  = (pGuestTss->ss1 & ~1) | 2;
@@ -446,7 +454,7 @@ VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
                      ||  s.ss0  != (pVM->selm.s.Tss.ss1 & ~1)) /* undo raw-r0 */
                )
             {
-                Log(("selmRCGuestTSSWriteHandler: R0 stack: %RTsel:%RGv -> %RTsel:%RGv [x-page]\n",
+                Log(("selmRCGuestTSSWritePfHandler: R0 stack: %RTsel:%RGv -> %RTsel:%RGv [x-page]\n",
                      (RTSEL)(pVM->selm.s.Tss.ss1 & ~1), (RTGCPTR)pVM->selm.s.Tss.esp1, (RTSEL)s.ss0, (RTGCPTR)s.esp0));
                 pVM->selm.s.Tss.esp1 = s.esp0;
                 pVM->selm.s.Tss.ss1  = s.ss0 | 1;
@@ -527,17 +535,21 @@ VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode   CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      Unused.
  */
-VMMRCDECL(int) selmRCShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) selmRCShadowGDTWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                              RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
-    LogRel(("FATAL ERROR: selmRCShadowGDTWriteHandler: eip=%08X pvFault=%RGv pvRange=%RGv\r\n", pRegFrame->eip, pvFault, pvRange));
-    NOREF(pVM); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange);
+    LogRel(("FATAL ERROR: selmRCShadowGDTWritePfHandler: eip=%08X pvFault=%RGv pvRange=%RGv\r\n", pRegFrame->eip, pvFault, pvRange));
+    NOREF(pVM); NOREF(pVCpu); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange); NOREF(pvUser);
     return VERR_SELM_SHADOW_GDT_WRITE;
 }
 #endif
@@ -549,18 +561,22 @@ VMMRCDECL(int) selmRCShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCT
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode   CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      Unused.
  */
-VMMRCDECL(int) selmRCShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) selmRCShadowLDTWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                              RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
-    LogRel(("FATAL ERROR: selmRCShadowLDTWriteHandler: eip=%08X pvFault=%RGv pvRange=%RGv\r\n", pRegFrame->eip, pvFault, pvRange));
+    LogRel(("FATAL ERROR: selmRCShadowLDTWritePfHandler: eip=%08X pvFault=%RGv pvRange=%RGv\r\n", pRegFrame->eip, pvFault, pvRange));
     Assert(pvFault - (uintptr_t)pVM->selm.s.pvLdtRC < (unsigned)(65536U + PAGE_SIZE));
-    NOREF(pVM); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange);
+    NOREF(pVM); NOREF(pVCpu); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange); NOREF(pvUser);
     return VERR_SELM_SHADOW_LDT_WRITE;
 }
 #endif
@@ -572,17 +588,21 @@ VMMRCDECL(int) selmRCShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCT
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode   CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      Unused.
  */
-VMMRCDECL(int) selmRCShadowTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) selmRCShadowTSSWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                              RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
-    LogRel(("FATAL ERROR: selmRCShadowTSSWriteHandler: eip=%08X pvFault=%RGv pvRange=%RGv\r\n", pRegFrame->eip, pvFault, pvRange));
-    NOREF(pVM); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange);
+    LogRel(("FATAL ERROR: selmRCShadowTSSWritePfHandler: eip=%08X pvFault=%RGv pvRange=%RGv\r\n", pRegFrame->eip, pvFault, pvRange));
+    NOREF(pVM); NOREF(pVCpu); NOREF(uErrorCode); NOREF(pRegFrame); NOREF(pvFault); NOREF(pvRange); NOREF(offRange); NOREF(pvUser);
     return VERR_SELM_SHADOW_TSS_WRITE;
 }
 #endif
diff --git a/src/VBox/VMM/VMMRC/TRPMRC.cpp b/src/VBox/VMM/VMMRC/TRPMRC.cpp
index 0654c7e..0405fea 100644
--- a/src/VBox/VMM/VMMRC/TRPMRC.cpp
+++ b/src/VBox/VMM/VMMRC/TRPMRC.cpp
@@ -94,16 +94,19 @@ VMMRCDECL(void) TRPMGCHyperReturnToHost(PVM pVM, int rc)
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
  * @param   uErrorCode   CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      Unused.
  */
-VMMRCDECL(int) trpmRCGuestIDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) trpmRCGuestIDTWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                             RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
-    PVMCPU      pVCpu = VMMGetCpu0(pVM);
     uint16_t    cbIDT;
     RTGCPTR     GCPtrIDT    = (RTGCPTR)CPUMGetGuestIDTR(pVCpu, &cbIDT);
 #ifdef VBOX_STRICT
@@ -113,7 +116,7 @@ VMMRCDECL(int) trpmRCGuestIDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
 
     AssertMsg(offRange < (uint32_t)cbIDT+1, ("pvFault=%RGv GCPtrIDT=%RGv-%RGv pvRange=%RGv\n", pvFault, GCPtrIDT, GCPtrIDTEnd, pvRange));
     Assert((RTGCPTR)(RTRCUINTPTR)pvRange == GCPtrIDT);
-    NOREF(uErrorCode);
+    NOREF(uErrorCode); NOREF(pvUser);
 
 #if 0
     /* Note! this causes problems in Windows XP as instructions following the update can be dangerous (str eax has been seen) */
@@ -142,7 +145,7 @@ VMMRCDECL(int) trpmRCGuestIDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
     NOREF(iGate);
 #endif
 
-    Log(("trpmRCGuestIDTWriteHandler: eip=%RGv write to gate %x offset %x\n", pRegFrame->eip, iGate, offRange));
+    Log(("trpmRCGuestIDTWritePfHandler: eip=%RGv write to gate %x offset %x\n", pRegFrame->eip, iGate, offRange));
 
     /** @todo Check which IDT entry and keep the update cost low in TRPMR3SyncIDT() and CSAMCheckGates(). */
     VMCPU_FF_SET(pVCpu, VMCPU_FF_TRPM_SYNC_IDT);
@@ -157,18 +160,21 @@ VMMRCDECL(int) trpmRCGuestIDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTX
  *
  * @returns VBox status code (appropriate for trap handling and GC return).
  * @param   pVM         Pointer to the VM.
- * @param   uErrorCode   CPU Error code.
+ * @param   pVCpu       Pointer to the cross context CPU context for the
+ *                      calling EMT.
+ * @param   uErrorCode  CPU Error code.
  * @param   pRegFrame   Trap register frame.
  * @param   pvFault     The fault address (cr2).
  * @param   pvRange     The base address of the handled virtual range.
  * @param   offRange    The offset of the access into this range.
  *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
+ * @param   pvUser      Unused.
  */
-VMMRCDECL(int) trpmRCShadowIDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange)
+DECLEXPORT(int) trpmRCShadowIDTWritePfHandler(PVM pVM, PVMCPU pVCpu, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
+                                              RTGCPTR pvRange, uintptr_t offRange, void *pvUser)
 {
-    PVMCPU pVCpu = VMMGetCpu0(pVM);
-    LogRel(("FATAL ERROR: trpmRCShadowIDTWriteHandler: eip=%08X pvFault=%RGv pvRange=%08RGv\r\n", pRegFrame->eip, pvFault, pvRange));
-    NOREF(uErrorCode); NOREF(offRange);
+    LogRel(("FATAL ERROR: trpmRCShadowIDTWritePfHandler: eip=%08X pvFault=%RGv pvRange=%08RGv\r\n", pRegFrame->eip, pvFault, pvRange));
+    NOREF(uErrorCode); NOREF(offRange); NOREF(pvUser);
 
     /*
      * If we ever get here, then the guest has *probably* executed an SIDT
diff --git a/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp b/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp
index 3587db6..7fe898e 100644
--- a/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp
+++ b/src/VBox/VMM/VMMRC/TRPMRCHandlers.cpp
@@ -26,6 +26,7 @@
 #include <VBox/vmm/pdmapi.h>
 #include <VBox/vmm/dbgf.h>
 #include <VBox/vmm/em.h>
+#include <VBox/vmm/gim.h>
 #include <VBox/vmm/csam.h>
 #include <VBox/vmm/patm.h>
 #include <VBox/vmm/mm.h>
@@ -245,7 +246,7 @@ static int trpmGCExitTrap(PVM pVM, PVMCPU pVCpu, int rc, PCPUMCTXCORE pRegFrame)
         /* Pending interrupt: dispatch it. */
         else if (    VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC)
                  && !VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS)
-                 &&  PATMAreInterruptsEnabledByCtxCore(pVM, pRegFrame)
+                 &&  PATMAreInterruptsEnabledByCtx(pVM, CPUMCTX_FROM_CORE(pRegFrame))
            )
         {
             uint8_t u8Interrupt;
@@ -594,7 +595,7 @@ DECLASM(int) TRPMGCTrap06Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame)
             Log(("TRPMGCTrap06Handler: pc=%08x op=%d\n", pRegFrame->eip, Cpu.pCurInstr->uOpcode));
 #ifdef DTRACE_EXPERIMENT /** @todo fix/remove/permanent-enable this when DIS/PATM handles invalid lock sequences. */
             Assert(!PATMIsPatchGCAddr(pVM, pRegFrame->eip));
-            rc = TRPMForwardTrap(pVCpu, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, 0x6);
+            rc = TRPMForwardTrap(pVCpu, pRegFrame, X86_XCPT_UD, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, X86_XCPT_UD);
             Assert(rc == VINF_EM_RAW_GUEST_TRAP);
 #else
             rc = VINF_EM_RAW_EMULATE_INSTR;
@@ -608,6 +609,16 @@ DECLASM(int) TRPMGCTrap06Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame)
             LogFlow(("TRPMGCTrap06Handler: -> EMInterpretInstructionCPU\n"));
             rc = EMInterpretInstructionDisasState(pVCpu, &Cpu, pRegFrame, PC, EMCODETYPE_SUPERVISOR);
         }
+        else if (GIMShouldTrapXcptUD(pVCpu))
+        {
+            LogFlow(("TRPMGCTrap06Handler: -> GIMXcptUD\n"));
+            rc = GIMXcptUD(pVCpu, CPUMCTX_FROM_CORE(pRegFrame), &Cpu);
+            if (RT_FAILURE(rc))
+            {
+                LogFlow(("TRPMGCTrap06Handler: -> GIMXcptUD -> VINF_EM_RAW_EMULATE_INSTR\n"));
+                rc = VINF_EM_RAW_EMULATE_INSTR;
+            }
+        }
         /* Never generate a raw trap here; it might be an instruction, that requires emulation. */
         else
         {
@@ -618,7 +629,7 @@ DECLASM(int) TRPMGCTrap06Handler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame)
     else
     {
         LogFlow(("TRPMGCTrap06Handler: -> TRPMForwardTrap\n"));
-        rc = TRPMForwardTrap(pVCpu, pRegFrame, 0x6, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, 0x6);
+        rc = TRPMForwardTrap(pVCpu, pRegFrame, X86_XCPT_UD, 0, TRPM_TRAP_NO_ERRORCODE, TRPM_TRAP, X86_XCPT_UD);
         Assert(rc == VINF_EM_RAW_GUEST_TRAP);
     }
 
@@ -823,7 +834,7 @@ static int trpmGCTrap0dHandlerRing0(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFram
 #ifdef PATM_EMULATE_SYSENTER
         case OP_SYSEXIT:
         case OP_SYSRET:
-            rc = PATMSysCall(pVM, pRegFrame, pCpu);
+            rc = PATMSysCall(pVM, CPUMCTX_FROM_CORE(pRegFrame), pCpu);
             TRPM_EXIT_DBG_HOOK(0xd);
             return trpmGCExitTrap(pVM, pVCpu, rc, pRegFrame);
 #endif
@@ -927,7 +938,7 @@ static int trpmGCTrap0dHandlerRing3(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFram
         case OP_SYSCALL:
         case OP_SYSENTER:
 #ifdef PATM_EMULATE_SYSENTER
-            rc = PATMSysCall(pVM, pRegFrame, pCpu);
+            rc = PATMSysCall(pVM, CPUMCTX_FROM_CORE(pRegFrame), pCpu);
             if (rc == VINF_SUCCESS)
             {
                 TRPM_EXIT_DBG_HOOK(0xd);
@@ -1203,6 +1214,8 @@ DECLASM(int) TRPMGCTrap0dHandler(PTRPMCPU pTrpmCpu, PCPUMCTXCORE pRegFrame)
         case VINF_IOM_R3_MMIO_WRITE:
         case VINF_IOM_R3_MMIO_READ:
         case VINF_IOM_R3_MMIO_READ_WRITE:
+        case VINF_CPUM_R3_MSR_READ:
+        case VINF_CPUM_R3_MSR_WRITE:
         case VINF_PATM_PATCH_INT3:
         case VINF_EM_NO_MEMORY:
         case VINF_EM_RAW_TO_R3:
diff --git a/src/VBox/VMM/VMMRC/VMMRC.cpp b/src/VBox/VMM/VMMRC/VMMRC.cpp
index 06e2003..eb44d1a 100644
--- a/src/VBox/VMM/VMMRC/VMMRC.cpp
+++ b/src/VBox/VMM/VMMRC/VMMRC.cpp
@@ -135,8 +135,8 @@ VMMRCDECL(int) VMMGCEntry(PVM pVM, unsigned uOperation, unsigned uArg, ...)
          */
         case VMMGC_DO_TESTCASE_INTERRUPT_MASKING:
         {
-            uint64_t u64MaxTicks = (SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage) != ~(uint64_t)0
-                                    ? SUPGetCpuHzFromGIP(g_pSUPGlobalInfoPage)
+            uint64_t u64MaxTicks = (SUPGetCpuHzFromGip(g_pSUPGlobalInfoPage) != ~(uint64_t)0
+                                    ? SUPGetCpuHzFromGip(g_pSUPGlobalInfoPage)
                                     : _2G)
                                    / 10000;
             uint64_t u64StartTSC = ASMReadTSC();
diff --git a/src/VBox/VMM/VMMRC/VMMRC.def b/src/VBox/VMM/VMMRC/VMMRC.def
index 76dcb19..b6ceafd 100644
--- a/src/VBox/VMM/VMMRC/VMMRC.def
+++ b/src/VBox/VMM/VMMRC/VMMRC.def
@@ -3,7 +3,7 @@
 ; VMM Raw-mode Context DLL - Definition file.
 
 ;
-; Copyright (C) 2006-2012 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -64,6 +64,7 @@ EXPORTS
     TRPMGCHandlerTrap12
     MMGCRamWriteNoTrapHandler
     MMGCRamReadNoTrapHandler
+    VMMGetCpu
     VMMGetSvnRev
     VMMRCProbeFire
     vmmGCLoggerFlush
@@ -91,9 +92,11 @@ EXPORTS
     RTAssertMsg2Weak
     RTAssertShouldPanic
     RTLogDefaultInstance
-    RTTimeNanoTSLegacySync
+    RTTimeNanoTSLegacySyncInvarNoDelta
+    RTTimeNanoTSLegacySyncInvarWithDelta
     RTTimeNanoTSLegacyAsync
-    RTTimeNanoTSLFenceSync
+    RTTimeNanoTSLFenceSyncInvarNoDelta
+    RTTimeNanoTSLFenceSyncInvarWithDelta
     RTTimeNanoTSLFenceAsync
     RTTimeNanoTS
     RTCrc32
diff --git a/src/VBox/VMM/VMMRC/VMMRC.mac b/src/VBox/VMM/VMMRC/VMMRC.mac
index 1584bcf..8378785 100644
--- a/src/VBox/VMM/VMMRC/VMMRC.mac
+++ b/src/VBox/VMM/VMMRC/VMMRC.mac
@@ -25,11 +25,18 @@
 ; Set the output segment to one of the special VMMR0 segments.
 ; @param    %1      The segment name.
 ; @remark   Use BEGINCODE to switch back to the code segment.
+
+;; @def VMMR0_SEG_CODE
+; Set the output segment to one of the special VMMR0 code segments.
+; @param    %1      The segment name.
 %ifdef ASM_FORMAT_OMF
  %macro VMMR0_SEG 1
- segment VMMR0.%1 public CLASS=CONST align=1 use32
+ segment VMMR0.%1 public CLASS=CONST align=1 use32 flat
+ %endmacro
+
+ %macro VMMR0_CODE_SEG 1
+ segment VMMR0.%1 public CLASS=CODE align=16 use32 flat
  %endmacro
- %define VMMR0_SEG_DEFINED
 %endif
 
 %ifdef ASM_FORMAT_ELF
@@ -41,7 +48,15 @@
    [section .VMMR0.%1 ]
   %endif
  %endmacro
- %define VMMR0_SEG_DEFINED
+
+ %macro VMMR0_CODE_SEG 1
+  %ifndef DEFINED_VMMR0_CODE_SEG.%1
+   %define DEFINED_VMMR0_CODE_SEG.%1 1
+   [section .VMMR0.%1 progbits alloc exec nowrite align=16 ]
+  %else
+   [section .VMMR0.%1 ]
+  %endif
+ %endmacro
 %endif
 
 %ifdef ASM_FORMAT_MACHO
@@ -59,18 +74,48 @@
   [section VMMR0.%1 rdata align=1 ]
   %endmacro
  %endif
- %define VMMR0_SEG_DEFINED
+
+ %ifdef __YASM__
+  %macro VMMR0_CODE_SEG 1
+   %ifndef DEFINED_VMMR0_CODE_SEG.%1
+    %define DEFINED_VMMR0_CODE_SEG.%1 1
+    [section VMMR0 %1 exec align=16 ]
+   %else
+    [section VMMR0 %1 ]
+   %endif
+  %endmacro
+ %else
+  %macro VMMR0_CODE_SEG 1
+  [section VMMR0.%1 exec align=16 ]
+  %endmacro
+ %endif
 %endif
 
 %ifdef ASM_FORMAT_PE
  %macro VMMR0_SEG 1
- [section .rdata$VMMR0.%1 align=1 ]
+  %ifndef DEFINED_VMMR0_SEG.%1
+   %define DEFINED_VMMR0_SEG.%1 1
+   [section .rdata$VMMR0.%1 align=1 ]
+  %else
+   [section .rdata$VMMR0.%1]
+  %endif
+ %endmacro
+
+ %macro VMMR0_CODE_SEG 1
+  %ifndef DEFINED_VMMR0_CODE_SEG.%1
+   %define DEFINED_VMMR0_CODE_SEG.%1 1
+   [section .text$VMMR0.%1 align=16 ]
+  %else
+   [section .text$VMMR0.%1]
+  %endif
  %endmacro
- %define VMMR0_SEG_DEFINED
 %endif
 
-%ifndef VMMR0_SEG_DEFINED
- %error "VMMR0_SEG / ASM_FORMAT_xxx"
+%ifnmacro VMMR0_SEG
+ %error "VMMR0_CODE_SEG / ASM_FORMAT_xxx"
+%endif
+%ifnmacro VMMR0_CODE_SEG
+ %error "VMMR0_CODE_SEG / ASM_FORMAT_xxx"
 %endif
 
 
@@ -137,4 +182,13 @@ TRPM_HANDLER Trap0d, 0, %1, %2
 %endmacro
 
 
+
+;; @def PATCH_HLP_SEG
+; Set the output segment a special code segment for patch helpers (runs in ring-1 or ring-2).
+; @param    %1      The segment name.
+; @remark   Use BEGINCODE to switch back to the code segment.
+%macro BEGIN_PATCH_HLP_SEG 0
+VMMR0_CODE_SEG PatchHlp
+%endmacro
+
 %endif
diff --git a/src/VBox/VMM/VMMRC/VMMRC0.asm b/src/VBox/VMM/VMMRC/VMMRC0.asm
index bd3cf69..b86ab7c 100644
--- a/src/VBox/VMM/VMMRC/VMMRC0.asm
+++ b/src/VBox/VMM/VMMRC/VMMRC0.asm
@@ -1,10 +1,10 @@
 ; $Id: VMMRC0.asm $
 ;; @file
-; VMMGC0 - The first object module in the link.
+; VMMRC0 - The first object module in the link.
 ;
 
 ;
-; Copyright (C) 2006-2010 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -33,4 +33,8 @@ GLOBALNAME g_aTrap0dHandlers
 VMMR0_SEG Trap0e
 GLOBALNAME g_aTrap0eHandlers
 
+;;
+; Start the patch helper segment
+BEGIN_PATCH_HLP_SEG
+EXPORTEDNAME g_PatchHlpBegin
 
diff --git a/src/VBox/VMM/VMMRC/VMMRC99.asm b/src/VBox/VMM/VMMRC/VMMRC99.asm
index 6dd4454..0c87911 100644
--- a/src/VBox/VMM/VMMRC/VMMRC99.asm
+++ b/src/VBox/VMM/VMMRC/VMMRC99.asm
@@ -1,9 +1,9 @@
 ; $Id: VMMRC99.asm $
 ;; @file
-; VMMGC99 - The last object module in the link.
+; VMMRC99 - The last object module in the link.
 ;
 
-; Copyright (C) 2006-2010 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -21,19 +21,26 @@
 ; End the Trap0b segment.
 VMMR0_SEG Trap0b
 GLOBALNAME g_aTrap0bHandlersEnd
-    dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+    dd  0, 0, 0, 0,  0, 0, 0, 0,   0, 0, 0, 0,  0, 0, 0, 0
 
 
 ;;
 ; End the Trap0d segment.
 VMMR0_SEG Trap0d
 GLOBALNAME g_aTrap0dHandlersEnd
-    dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+    dd  0, 0, 0, 0,  0, 0, 0, 0,   0, 0, 0, 0,  0, 0, 0, 0
 
 
 ;;
 ; End the Trap0e segment.
 VMMR0_SEG Trap0e
 GLOBALNAME g_aTrap0eHandlersEnd
-    dd 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+    dd  0, 0, 0, 0,  0, 0, 0, 0,   0, 0, 0, 0,  0, 0, 0, 0
+
+
+;;
+; End the patch helper segment
+BEGIN_PATCH_HLP_SEG
+EXPORTEDNAME g_PatchHlpEnd
+    dd  0, 0, 0, 0,  0, 0, 0, 0,   0, 0, 0, 0,  0, 0, 0, 0
 
diff --git a/src/VBox/VMM/VMMRZ/PGMRZDynMap.cpp b/src/VBox/VMM/VMMRZ/PGMRZDynMap.cpp
index 1329ef2..c4cd2d2 100644
--- a/src/VBox/VMM/VMMRZ/PGMRZDynMap.cpp
+++ b/src/VBox/VMM/VMMRZ/PGMRZDynMap.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2008-2012 Oracle Corporation
+ * Copyright (C) 2008-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -53,12 +53,12 @@
 /** The number of pages we reserve per CPU. */
 # define PGMR0DYNMAP_PAGES_PER_CPU          256
 /** The minimum number of pages we reserve per CPU.
- * This must be equal or larger than the autoset size.  */
+ * This must be equal or larger than the autoset size. */
 # define PGMR0DYNMAP_PAGES_PER_CPU_MIN      64
 /** Calcs the overload threshold (safety margin).  Current set at 50%. */
 # define PGMR0DYNMAP_CALC_OVERLOAD(cPages)  ((cPages) / 2)
 /** The number of guard pages.
- * @remarks Never do tuning of the hashing or whatnot with a strict build!  */
+ * @remarks Never do tuning of the hashing or whatnot with a strict build! */
 # if defined(VBOX_STRICT)
 #  define PGMR0DYNMAP_GUARD_PAGES           1
 # else
@@ -72,7 +72,7 @@
 #if 0
 /** Define this to just clear the present bit on guard pages.
  * The alternative is to replace the entire PTE with an bad not-present
- * PTE. Either way, XNU will screw us. :-/   */
+ * PTE. Either way, XNU will screw us. :-/ */
 # define PGMR0DYNMAP_GUARD_NP
 #endif
 /** The dummy PTE value for a page. */
@@ -129,7 +129,7 @@
 #ifdef IN_RC
 # define PGMRZDYNMAP_CUR_CPU()              (0)
 #else
-# define PGMRZDYNMAP_CUR_CPU()              RTMpCpuIdToSetIndex(RTMpCpuId())
+# define PGMRZDYNMAP_CUR_CPU()              RTMpCurSetIndex()
 #endif
 
 /** PGMRZDYNMAP::u32Magic. (Jens Christian Bugge Wesseltoft) */
@@ -199,7 +199,7 @@ typedef struct PGMR0DYNMAPENTRY
 {
     /** The physical address of the currently mapped page.
      * This is duplicate for three reasons: cache locality, cache policy of the PT
-     * mappings and sanity checks.   */
+     * mappings and sanity checks. */
     RTHCPHYS                    HCPhys;
     /** Pointer to the page. */
     void                       *pvPage;
@@ -219,7 +219,7 @@ typedef struct PGMR0DYNMAPENTRY
     RTCPUSET                    PendingSet;
 } PGMR0DYNMAPENTRY;
 /** Pointer a mapping cache entry for the ring-0.
- * @sa PPGMRZDYNMAPENTRY, PPGMRCDYNMAPENTRY,  */
+ * @sa PPGMRZDYNMAPENTRY, PPGMRCDYNMAPENTRY, */
 typedef PGMR0DYNMAPENTRY *PPGMR0DYNMAPENTRY;
 
 
@@ -239,7 +239,7 @@ typedef struct PGMR0DYNMAP
     uint32_t                    u32Magic;
     /** Spinlock serializing the normal operation of the cache. */
     RTSPINLOCK                  hSpinlock;
-    /** Array for tracking and managing the pages.  */
+    /** Array for tracking and managing the pages. */
     PPGMR0DYNMAPENTRY           paPages;
     /** The cache size given as a number of pages. */
     uint32_t                    cPages;
@@ -297,14 +297,14 @@ typedef PGMR0DYNMAPPGLVL *PPGMR0DYNMAPPGLVL;
 #endif
 
 /** Mapping cache entry for the current context.
- * @sa PGMR0DYNMAPENTRY, PGMRCDYNMAPENTRY  */
+ * @sa PGMR0DYNMAPENTRY, PGMRCDYNMAPENTRY */
 typedef CTX_MID(PGM,DYNMAPENTRY) PGMRZDYNMAPENTRY;
 /** Pointer a mapping cache entry for the current context.
- * @sa PGMR0DYNMAPENTRY, PGMRCDYNMAPENTRY  */
+ * @sa PGMR0DYNMAPENTRY, PGMRCDYNMAPENTRY */
 typedef PGMRZDYNMAPENTRY *PPGMRZDYNMAPENTRY;
 
 /** Pointer to the mapping cache instance for the current context.
- * @sa PGMR0DYNMAP, PGMRCDYNMAP  */
+ * @sa PGMR0DYNMAP, PGMRCDYNMAP */
 typedef CTX_MID(PGM,DYNMAP) *PPGMRZDYNMAP;
 
 
diff --git a/src/VBox/VMM/VMMRZ/VMMRZ.cpp b/src/VBox/VMM/VMMRZ/VMMRZ.cpp
index e78f41f..68168f8 100644
--- a/src/VBox/VMM/VMMRZ/VMMRZ.cpp
+++ b/src/VBox/VMM/VMMRZ/VMMRZ.cpp
@@ -133,7 +133,7 @@ VMMRZDECL(void) VMMRZCallRing3Disable(PVMCPU pVCpu)
 #endif
 
     Assert(pVCpu->vmm.s.cCallRing3Disabled < 16);
-    if (ASMAtomicIncU32(&pVCpu->vmm.s.cCallRing3Disabled) == 1) /** @todo replace with unordered variant (ASMAtomicUoIncU32). */
+    if (ASMAtomicUoIncU32(&pVCpu->vmm.s.cCallRing3Disabled) == 1)
     {
         /** @todo it might make more sense to just disable logging here, then we
          * won't flush away important bits... but that goes both ways really. */
@@ -154,7 +154,7 @@ VMMRZDECL(void) VMMRZCallRing3Disable(PVMCPU pVCpu)
 
 
 /**
- * Counters VMMRZCallRing3Disable and re-enables host calls.
+ * Counters VMMRZCallRing3Disable() and re-enables host calls.
  *
  * @param   pVCpu               The CPU struct for the calling EMT.
  * @thread  EMT.
@@ -167,7 +167,7 @@ VMMRZDECL(void) VMMRZCallRing3Enable(PVMCPU pVCpu)
 #endif
 
     Assert(pVCpu->vmm.s.cCallRing3Disabled > 0);
-    if (ASMAtomicDecU32(&pVCpu->vmm.s.cCallRing3Disabled) == 0) /** @todo replace with unordered variant (ASMAtomicUoDecU32). */
+    if (ASMAtomicUoDecU32(&pVCpu->vmm.s.cCallRing3Disabled) == 0)
     {
 #ifdef IN_RC
         pVCpu->pVMRC->vmm.s.fRCLoggerFlushingDisabled = false;
diff --git a/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac b/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac
index ed2b87a..7afd280 100644
--- a/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac
+++ b/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2013 Oracle Corporation
+; Copyright (C) 2006-2014 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -52,7 +52,7 @@ BITS 64
 ;;
 ; The C interface.
 ;
-; @param    pVM  GCC: rdi  MSC:rcx  The VM handle.
+; @param    pVM  gcc: rdi  msc:rcx  The VM handle.
 ;
 BEGINPROC vmmR0ToRawMode
 %ifdef DEBUG_STUFF
@@ -130,6 +130,23 @@ gth64_notherm:
     jnc     gth64_nocmci
     and     dword [r8 + APIC_REG_LVT_CMCI], ~APIC_REG_LVT_MASKED
 gth64_nocmci:
+    shr     ecx, 1
+    jnc     gth64_noeilvt0
+    and     dword [r8 + APIC_REG_EILVT0], ~APIC_REG_LVT_MASKED
+gth64_noeilvt0:
+    shr     ecx, 1
+    jnc     gth64_noeilvt1
+    and     dword [r8 + APIC_REG_EILVT1], ~APIC_REG_LVT_MASKED
+gth64_noeilvt1:
+    shr     ecx, 1
+    jnc     gth64_noeilvt2
+    and     dword [r8 + APIC_REG_EILVT2], ~APIC_REG_LVT_MASKED
+gth64_noeilvt2:
+    shr     ecx, 1
+    jnc     gth64_noeilvt3
+    and     dword [r8 + APIC_REG_EILVT3], ~APIC_REG_LVT_MASKED
+gth64_noeilvt3:
+
     jmp     gth64_apic_done
 
     ; x2APIC mode:
@@ -338,7 +355,9 @@ BEGINPROC vmmR0ToRawModeAsm
     cmp     byte [rdx + r8 + CPUMCPU.fX2Apic], 1
     je      htg_x2apic
 
-    ; Legacy xAPIC mode:
+    ; Legacy xAPIC mode. No write completion required when writing to the
+    ; LVT registers as we have mapped the APIC page non-cacheable and the
+    ; MMIO is CPU-local.
     mov     rbx, [rdx + r8 + CPUMCPU.pvApicBase]
     or      rbx, rbx
     jz      htg_apic_done
@@ -351,7 +370,6 @@ BEGINPROC vmmR0ToRawModeAsm
     or      edi, 0x01
     or      eax, APIC_REG_LVT_MASKED
     mov     [rbx + APIC_REG_LVT_LINT0], eax
-    mov     eax, [rbx + APIC_REG_LVT_LINT0] ; write completion
 htg_nolint0:
     mov     eax, [rbx + APIC_REG_LVT_LINT1]
     mov     ecx, eax
@@ -361,7 +379,6 @@ htg_nolint0:
     or      edi, 0x02
     or      eax, APIC_REG_LVT_MASKED
     mov     [rbx + APIC_REG_LVT_LINT1], eax
-    mov     eax, [rbx + APIC_REG_LVT_LINT1] ; write completion
 htg_nolint1:
     mov     eax, [rbx + APIC_REG_LVT_PC]
     mov     ecx, eax
@@ -371,10 +388,10 @@ htg_nolint1:
     or      edi, 0x04
     or      eax, APIC_REG_LVT_MASKED
     mov     [rbx + APIC_REG_LVT_PC], eax
-    mov     eax, [rbx + APIC_REG_LVT_PC] ; write completion
 htg_nopc:
     mov     eax, [rbx + APIC_REG_VERSION]
     shr     eax, 16
+    push    rax
     cmp     al, 5
     jb      htg_notherm
     je      htg_nocmci
@@ -386,7 +403,6 @@ htg_nopc:
     or      edi, 0x10
     or      eax, APIC_REG_LVT_MASKED
     mov     [rbx + APIC_REG_LVT_CMCI], eax
-    mov     eax, [rbx + APIC_REG_LVT_CMCI] ; write completion
 htg_nocmci:
     mov     eax, [rbx + APIC_REG_LVT_THMR]
     mov     ecx, eax
@@ -396,8 +412,33 @@ htg_nocmci:
     or      edi, 0x08
     or      eax, APIC_REG_LVT_MASKED
     mov     [rbx + APIC_REG_LVT_THMR], eax
-    mov     eax, [rbx + APIC_REG_LVT_THMR] ; write completion
 htg_notherm:
+    pop     rax
+    test    ah, ah
+    jns     htg_noeilvt
+
+    ; AMD Extended LVT registers
+    mov     esi, [rbx + 0x400]
+    shr     esi, 16
+    and     esi, 0xff
+    jz      htg_noeilvt
+    mov     ebp, 0x20
+htg_tsteilvtx:
+    mov     eax, [rbx + APIC_REG_EILVT0]
+    mov     ecx, eax
+    and     ecx, (APIC_REG_LVT_MASKED | APIC_REG_LVT_MODE_MASK)
+    cmp     ecx, APIC_REG_LVT_MODE_NMI
+    jne     htg_noeilvtx
+    or      edi, ebp
+    or      eax, APIC_REG_LVT_MASKED
+    mov     [rbx + APIC_REG_EILVT0], eax
+htg_noeilvtx:
+    add     rbx, 0x10                    ; clobbers rbx!
+    shl     ebp, 1
+    dec     esi
+    jnz     htg_tsteilvtx
+
+htg_noeilvt:
     mov     [rdx + r8 + CPUMCPU.fApicDisVectors], edi
     jmp     htg_apic_done
 
@@ -523,7 +564,7 @@ htg_debug_regs_no:
 
     ;
     ; CR4.AndMask and CR4.OrMask are set in CPUMR3Init based on the presence of
-    ; FXSAVE support on the host CPU
+    ; FXSAVE and XSAVE support on the host CPU
     ;
     and     ecx, [rdx + CPUM.CR4.AndMask]
     or      eax, ecx
@@ -1097,14 +1138,37 @@ gth_sysenter_no:
     ; Using fxrstor should ensure that we're not causing unwanted exception on the host.
     mov     esi, [rdx + r8 + CPUMCPU.fUseFlags] ; esi == use flags.
     test    esi, CPUM_USED_FPU
-    jz short gth_fpu_no
+    jz      gth_fpu_no
     mov     rcx, cr0
     and     rcx, ~(X86_CR0_TS | X86_CR0_EM)
     mov     cr0, rcx
 
-    fxsave  [rdx + r8 + CPUMCPU.Guest.fpu]  
-    o64 fxrstor [rdx + r8 + CPUMCPU.Host.fpu]       ; Restore 64-bit host FPU state. See @bugref{7138}
-    jmp short gth_fpu_no
+    mov     r10, rdx                    ; Save rdx.
+
+    mov     eax, [r10 + r8 + CPUMCPU.Guest.fXStateMask]
+    mov     r9, [r10 + r8 + CPUMCPU.Guest.pXStateR0]
+    or      eax, eax
+    jz      gth_fpu_guest_fxsave
+    mov     edx, [r10 + r8 + CPUMCPU.Guest.fXStateMask + 4]
+    xsave   [r9]
+    jmp     gth_fpu_host
+gth_fpu_guest_fxsave:
+    fxsave  [r9]
+
+gth_fpu_host:
+    mov     eax, [r10 + r8 + CPUMCPU.Host.fXStateMask]
+    mov     r9, [r10 + r8 + CPUMCPU.Host.pXStateR0]
+    or      eax, eax
+    jz      gth_fpu_host_fxrstor
+    mov     edx, [r10 + r8 + CPUMCPU.Host.fXStateMask + 4]
+    xrstor  [r9]                        ; We saved 32-bit state, so only restore 32-bit.
+    jmp     gth_fpu_done
+gth_fpu_host_fxrstor:
+    fxrstor [r9]                        ; We saved 32-bit state, so only restore 32-bit.
+
+gth_fpu_done:
+    mov     rdx, r10                    ; Restore rdx.
+    jmp     gth_fpu_no
 
 ALIGNCODE(16)
 gth_fpu_no:
diff --git a/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac b/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac
index b396e9a..ba37308 100644
--- a/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac
+++ b/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac
@@ -331,7 +331,9 @@ BEGINPROC vmmR0ToRawModeAsm
     cmp     byte [edx + CPUMCPU.fX2Apic], 1
     je      htg_x2apic
 
-    ; Legacy xAPIC mode:
+    ; Legacy xAPIC mode. No write completion required when writing to the
+    ; LVT registers as we have mapped the APIC pages as non-cacheable and
+    ; the MMIO is CPU-local.
     mov     ebx, [edx + CPUMCPU.pvApicBase]
     or      ebx, ebx
     jz      htg_apic_done
@@ -343,7 +345,6 @@ BEGINPROC vmmR0ToRawModeAsm
     or      edi, 0x01
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_LINT0], eax
-    mov     eax, [ebx + APIC_REG_LVT_LINT0] ; write completion
 htg_nolint0:
     mov     eax, [ebx + APIC_REG_LVT_LINT1]
     mov     ecx, eax
@@ -353,7 +354,6 @@ htg_nolint0:
     or      edi, 0x02
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_LINT1], eax
-    mov     eax, [ebx + APIC_REG_LVT_LINT1] ; write completion
 htg_nolint1:
     mov     eax, [ebx + APIC_REG_LVT_PC]
     mov     ecx, eax
@@ -363,7 +363,6 @@ htg_nolint1:
     or      edi, 0x04
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_PC], eax
-    mov     eax, [ebx + APIC_REG_LVT_PC] ; write completion
 htg_nopc:
     mov     eax, [ebx + APIC_REG_VERSION]
     shr     eax, 16
@@ -378,7 +377,6 @@ htg_nopc:
     or      edi, 0x10
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_CMCI], eax
-    mov     eax, [ebx + APIC_REG_LVT_CMCI] ; write completion
 htg_nocmci:
     mov     eax, [ebx + APIC_REG_LVT_THMR]
     mov     ecx, eax
@@ -388,7 +386,6 @@ htg_nocmci:
     or      edi, 0x08
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_THMR], eax
-    mov     eax, [ebx + APIC_REG_LVT_THMR] ; write completion
 htg_notherm:
     mov     [edx + CPUMCPU.fApicDisVectors], edi
     jmp     htg_apic_done
@@ -501,7 +498,7 @@ htg_apic_done:
     ;; relevant for 32-bit, but whatever) and X86_CR4_VMXE must be cleared.
     ;;
     and     esi, X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE | X86_CR4_PSE | X86_CR4_PAE \
-               | X86_CR4_MCE | X86_CR4_OSFSXR | X86_CR4_OSXMMEEXCPT | X86_CR4_SMXE | X86_CR4_OSXSAVE
+               | X86_CR4_MCE | X86_CR4_OSFXSR | X86_CR4_OSXMMEEXCPT | X86_CR4_SMXE | X86_CR4_OSXSAVE
     mov     cr4, esi
 
     ;;
@@ -649,8 +646,6 @@ GLOBALNAME ICEnterTarget
     lidt    [rdx + CPUMCPU.Hyper.idtr]
 %endif
 
-    ; load the hypervisor function address
-    mov     r9, [rdx + CPUMCPU.Hyper.eip]
     DEBUG64_S_CHAR('8')
 
     ; Check if we need to restore the guest FPU state
@@ -666,8 +661,19 @@ GLOBALNAME ICEnterTarget
     mov     rcx, rax                    ; save old CR0
     and     rax, ~(X86_CR0_TS | X86_CR0_EM)
     mov     cr0, rax
-    ; Use explicit REX prefix. See @bugref{6398}.
-    o64 fxrstor [rdx + CPUMCPU.Guest.fpu]
+
+    mov     eax, [rdx + CPUMCPU.Guest.fXStateMask]
+    mov     ebx, [rdx + CPUMCPU.Guest.pXStateRC]
+    or      eax, eax
+    jz      htg_fpu_fxrstor
+    mov     r9, rdx
+    mov     edx, [rdx + CPUMCPU.Guest.fXStateMask + 4]
+    o64 xsave [rbx]
+    mov     rdx, r9
+    jmp     htg_fpu_done
+htg_fpu_fxrstor:
+    o64 fxrstor [rbx]                   ; (use explicit REX prefix, see @bugref{6398})
+htg_fpu_done:
     mov     cr0, rcx                    ; and restore old CR0 again
 
     and     dword [rdx + CPUMCPU.fUseFlags], ~CPUM_SYNC_FPU_STATE
@@ -727,10 +733,12 @@ htg_debug_done:
 
     ; parameter for all helper functions (pCtx)
     DEBUG64_CHAR('9')
-    lea     rsi, [rdx + CPUMCPU.Guest.fpu]
+    lea     rsi, [rdx + CPUMCPU.Guest]
     lea     rax, [htg_return wrt rip]
     push    rax                         ; return address
 
+    ; load the hypervisor function address
+    mov     r9, [rdx + CPUMCPU.Hyper.eip]
     cmp     r9d, HM64ON32OP_VMXRCStartVM64
     jz      NAME(VMXRCStartVM64)
     cmp     r9d, HM64ON32OP_SVMRCVMRun64
@@ -772,25 +780,6 @@ ENDPROC vmmR0ToRawModeAsm
 ;
 ;
 
-
-
-; Load the corresponding guest MSR (trashes rdx & rcx)
-%macro LOADGUESTMSR 2
-    mov     rcx, %1
-    mov     edx, dword [rsi + %2 + 4]
-    mov     eax, dword [rsi + %2]
-    wrmsr
-%endmacro
-
-; Save a guest MSR (trashes rdx & rcx)
-; Only really useful for gs kernel base as that one can be changed behind our back (swapgs)
-%macro SAVEGUESTMSR 2
-    mov     rcx, %1
-    rdmsr
-    mov     dword [rsi + %2], eax
-    mov     dword [rsi + %2 + 4], edx
-%endmacro
-
 ;; @def MYPUSHSEGS
 ; Macro saving all segment registers on the stack.
 ; @param 1  full width register name
@@ -819,6 +808,8 @@ ENDPROC vmmR0ToRawModeAsm
 ; * @param   HCPhysCpuPage  VMXON physical address  [rsp+8]
 ; * @param   HCPhysVmcs     VMCS physical address   [rsp+16]
 ; * @param   pCache         VMCS cache              [rsp+24]
+; * @param   pVM            The VM handle           [rbp+28h]
+; * @param   pVM            The VMCPU handle.       [rbp+30h]
 ; * @param   pCtx           Guest context (rsi)
 ; */
 BEGINPROC VMXRCStartVM64
@@ -963,6 +954,7 @@ ALIGN(16)
 
     ; Manual save and restore:
     ;  - General purpose registers except RIP, RSP
+    ;  - XCR0
     ;
     ; Trashed:
     ;  - CR2 (we don't care)
@@ -971,18 +963,35 @@ ALIGN(16)
     ;  - DR7 (reset to 0x400)
     ;  - EFLAGS (reset to RT_BIT(1); not relevant)
 
-%ifndef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-    ; Load the guest LSTAR, CSTAR, SFMASK & KERNEL_GSBASE MSRs.
-    LOADGUESTMSR MSR_K8_LSTAR,          CPUMCTX.msrLSTAR
-    LOADGUESTMSR MSR_K6_STAR,           CPUMCTX.msrSTAR
-    LOADGUESTMSR MSR_K8_SF_MASK,        CPUMCTX.msrSFMASK
-    LOADGUESTMSR MSR_K8_KERNEL_GS_BASE, CPUMCTX.msrKERNELGSBASE
-%endif
-
 %ifdef VBOX_WITH_CRASHDUMP_MAGIC
     mov     qword [rbx + VMCSCACHE.uPos], 5
 %endif
 
+    ;
+    ; Save the host XCR0 and load the guest one if necessary.
+    ; Note! Trashes rdx and rcx.
+    ;
+    mov     rax, [rbp + 30h]            ; pVCpu
+    test    byte [rax + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
+    jz      .xcr0_before_skip
+
+    xor     ecx, ecx
+    xgetbv                              ; Save the host one on the stack.
+    push    rdx
+    push    rax
+
+    mov     eax, [xSI + CPUMCTX.aXcr]   ; Load the guest one.
+    mov     edx, [xSI + CPUMCTX.aXcr + 4]
+    xor     ecx, ecx                    ; paranoia
+    xsetbv
+
+    push    0                           ; Indicate that we must restore XCR0 (popped into ecx, thus 0).
+    jmp     .xcr0_before_done
+
+.xcr0_before_skip:
+    push    3fh                         ; indicate that we need not.
+.xcr0_before_done:
+
     ; Save the pCtx pointer
     push    rsi
 
@@ -1057,12 +1066,14 @@ ALIGNCODE(16)
 
     pop     rsi         ; pCtx (needed in rsi by the macros below)
 
-%ifndef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-    SAVEGUESTMSR MSR_K8_KERNEL_GS_BASE, CPUMCTX.msrKERNELGSBASE
-    SAVEGUESTMSR MSR_K8_SF_MASK,        CPUMCTX.msrSFMASK
-    SAVEGUESTMSR MSR_K6_STAR,           CPUMCTX.msrSTAR
-    SAVEGUESTMSR MSR_K8_LSTAR,          CPUMCTX.msrLSTAR
-%endif
+    ; Restore the host xcr0 if necessary.
+    pop     rcx
+    test    ecx, ecx
+    jnz     .xcr0_after_skip
+    pop     rax
+    pop     rdx
+    xsetbv                              ; ecx is already zero.
+.xcr0_after_skip:
 
 %ifdef VMX_USE_CACHED_VMCS_ACCESSES
     pop     rdi         ; Saved pCache
@@ -1141,6 +1152,15 @@ ALIGN(16)
 .vmstart64_invalid_vmcs_ptr:
     pop     rsi         ; pCtx (needed in rsi by the macros below)
 
+    ; Restore the host xcr0 if necessary.
+    pop     rcx
+    test    ecx, ecx
+    jnz     .xcr0_after_skip2
+    pop     rax
+    pop     rdx
+    xsetbv                              ; ecx is already zero.
+.xcr0_after_skip2:
+
 %ifdef VMX_USE_CACHED_VMCS_ACCESSES
     pop     rdi         ; pCache
  %ifdef VBOX_WITH_CRASHDUMP_MAGIC
@@ -1163,6 +1183,15 @@ ALIGN(16)
 .vmstart64_start_failed:
     pop     rsi         ; pCtx (needed in rsi by the macros below)
 
+    ; Restore the host xcr0 if necessary.
+    pop     rcx
+    test    ecx, ecx
+    jnz     .xcr0_after_skip3
+    pop     rax
+    pop     rdx
+    xsetbv                              ; ecx is already zero.
+.xcr0_after_skip3:
+
 %ifdef VMX_USE_CACHED_VMCS_ACCESSES
     pop     rdi         ; pCache
 
@@ -1184,14 +1213,16 @@ ALIGN(16)
 ENDPROC VMXRCStartVM64
 
 
-;/**
-; * Prepares for and executes VMRUN (64 bits guests)
-; *
-; * @returns VBox status code
-; * @param   HCPhysVMCB     Physical address of host VMCB       (rsp+8)
-; * @param   HCPhysVMCB     Physical address of guest VMCB      (rsp+16)
-; * @param   pCtx           Guest context                       (rsi)
-; */
+;;
+; Prepares for and executes VMRUN (64 bits guests)
+;
+; @returns  VBox status code
+; @param    HCPhysVMCB      Physical address of host VMCB       [rbp+10h]
+; @param    HCPhysVMCB      Physical address of guest VMCB      [rbp+18h]
+; @param    pVM             The VM handle                       [rbp+20h]
+; @param    pVCpu           The VMCPU handle.                   [rbp+28h]
+; @param    pCtx            Guest context                       [rsi]
+;
 BEGINPROC SVMRCVMRun64
     push    rbp
     mov     rbp, rsp
@@ -1207,6 +1238,30 @@ BEGINPROC SVMRCVMRun64
     ;  - DRx (presumably not changed at all)
     ;  - DR7 (reset to 0x400)
 
+    ;
+    ; Save the host XCR0 and load the guest one if necessary.
+    ;
+    mov     rax, [rbp + 28h]            ; pVCpu
+    test    byte [rax + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
+    jz      .xcr0_before_skip
+
+    xor     ecx, ecx
+    xgetbv                              ; Save the host one on the stack.
+    push    rdx
+    push    rax
+
+    mov     eax, [xSI + CPUMCTX.aXcr]   ; Load the guest one.
+    mov     edx, [xSI + CPUMCTX.aXcr + 4]
+    xor     ecx, ecx                    ; paranoia
+    xsetbv
+
+    push    0                           ; Indicate that we must restore XCR0 (popped into ecx, thus 0).
+    jmp     .xcr0_before_done
+
+.xcr0_before_skip:
+    push    3fh                         ; indicate that we need not.
+.xcr0_before_done:
+
     ; Save the Guest CPU context pointer.
     push    rsi                             ; Push for saving the state at the end
 
@@ -1274,6 +1329,17 @@ BEGINPROC SVMRCVMRun64
     mov     qword [rax + CPUMCTX.r14], r14
     mov     qword [rax + CPUMCTX.r15], r15
 
+    ;
+    ; Restore the host xcr0 if necessary.
+    ;
+    pop     rcx
+    test    ecx, ecx
+    jnz     .xcr0_after_skip
+    pop     rax
+    pop     rdx
+    xsetbv                              ; ecx is already zero.
+.xcr0_after_skip:
+
     mov     eax, VINF_SUCCESS
 
     popf
@@ -1294,9 +1360,18 @@ BEGINPROC HMRCSaveGuestFPU64
     and     rax, ~(X86_CR0_TS | X86_CR0_EM)
     mov     cr0, rax
 
-    ; Use explicit REX prefix. See @bugref{6398}.
-    o64 fxsave  [rsi + CPUMCTX.fpu]
+    mov     eax, [rsi + CPUMCTX.fXStateMask]
+    mov     ebx, [rsi + CPUMCTX.pXStateRC]
+    test    eax, eax
+    jz      .use_fxsave
+    mov     edx, [rsi + CPUMCTX.fXStateMask + 4]
+    o64 xsave [rbx]
+    jmp     .done
+
+.use_fxsave:
+    o64 fxsave  [rbx]                   ; (use explicit REX prefix, see @bugref{6398})
 
+.done:
     mov     cr0, rcx                    ; and restore old CR0 again
 
     mov     eax, VINF_SUCCESS
diff --git a/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac b/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac
index adc3c7b..b8d0fe0 100644
--- a/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac
+++ b/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac
@@ -224,7 +224,9 @@ BEGINPROC vmmR0ToRawModeAsm
     cmp     byte [edx + CPUMCPU.fX2Apic], 1
     je      htg_x2apic
 
-    ; Legacy xAPIC mode:
+    ; Legacy xAPIC mode. No write completion required when writing to the
+    ; LVT registers as we have mapped the APIC page non-cacheable and the
+    ; MMIO is CPU-local.
     mov     ebx, [edx + CPUMCPU.pvApicBase]
     or      ebx, ebx
     jz      htg_apic_done
@@ -238,7 +240,6 @@ BEGINPROC vmmR0ToRawModeAsm
     or      edi, 0x01
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_LINT0], eax
-    mov     eax, [ebx + APIC_REG_LVT_LINT0] ; write completion
 htg_nolint0:
     mov     eax, [ebx + APIC_REG_LVT_LINT1]
     mov     ecx, eax
@@ -248,7 +249,6 @@ htg_nolint0:
     or      edi, 0x02
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_LINT1], eax
-    mov     eax, [ebx + APIC_REG_LVT_LINT1] ; write completion
 htg_nolint1:
     mov     eax, [ebx + APIC_REG_LVT_PC]
     mov     ecx, eax
@@ -258,7 +258,6 @@ htg_nolint1:
     or      edi, 0x04
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_PC], eax
-    mov     eax, [ebx + APIC_REG_LVT_PC] ; write completion
 htg_nopc:
     mov     eax, [ebx + APIC_REG_VERSION]
     shr     eax, 16
@@ -273,7 +272,6 @@ htg_nopc:
     or      edi, 0x10
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_CMCI], eax
-    mov     eax, [ebx + APIC_REG_LVT_CMCI] ; write completion
 htg_nocmci:
     mov     eax, [ebx + APIC_REG_LVT_THMR]
     mov     ecx, eax
@@ -283,7 +281,6 @@ htg_nocmci:
     or      edi, 0x08
     or      eax, APIC_REG_LVT_MASKED
     mov     [ebx + APIC_REG_LVT_THMR], eax
-    mov     eax, [ebx + APIC_REG_LVT_THMR] ; write completion
 htg_notherm:
     mov     [edx + CPUMCPU.fApicDisVectors], edi
     jmp     htg_apic_done
@@ -422,7 +419,7 @@ htg_debug_regs_no:
 
     ;
     ; CR4.AndMask and CR4.OrMask are set in CPUMR3Init based on the presence of
-    ; FXSAVE support on the host CPU
+    ; FXSAVE and XSAVE support on the host CPU
     ;
     CPUM_FROM_CPUMCPU(edx)
     and     ecx, [edx + CPUM.CR4.AndMask]
@@ -992,27 +989,31 @@ gth_syscall_no:
     and     ecx, ~(X86_CR0_TS | X86_CR0_EM)
     mov     cr0, ecx
 
-    FIXUP FIX_NO_FXSAVE_JMP, 0, gth_no_fxsave - NAME(Start) ; this will insert a jmp gth_no_fxsave if fxsave isn't supported.
-    fxsave  [edx + CPUMCPU.Guest.fpu]
-    fxrstor [edx + CPUMCPU.Host.fpu]
-    jmp near gth_fpu_no
-
-gth_no_fxsave:
-    fnsave  [edx + CPUMCPU.Guest.fpu]
-    mov     eax, [edx + CPUMCPU.Host.fpu]     ; control word
-    not     eax                            ; 1 means exception ignored (6 LS bits)
-    and     eax, byte 03Fh                 ; 6 LS bits only
-    test    eax, [edx + CPUMCPU.Host.fpu + 4] ; status word
-    jz      gth_no_exceptions_pending
-
-    ; technically incorrect, but we certainly don't want any exceptions now!!
-    and     dword [edx + CPUMCPU.Host.fpu + 4], ~03Fh
-
-gth_no_exceptions_pending:
-    frstor  [edx + CPUMCPU.Host.fpu]
-    jmp short gth_fpu_no
+    mov     ebx, edx                    ; save edx
 
-ALIGNCODE(16)
+    mov     eax, [ebx + CPUMCPU.Guest.fXStateMask]
+    mov     ecx, [ebx + CPUMCPU.Guest.pXStateR0]
+    test    eax, eax
+    jz      gth_fpu_guest_fxsave
+    mov     edx, [ebx + CPUMCPU.Guest.fXStateMask + 4]
+    xsave   [ecx]
+    jmp     gth_fpu_host
+gth_fpu_guest_fxsave:
+    fxsave  [ecx]
+
+gth_fpu_host:
+    mov     eax, [ebx + CPUMCPU.Host.fXStateMask]
+    mov     ecx, [ebx + CPUMCPU.Host.pXStateR0]
+    test    eax, eax
+    jz      gth_fpu_host_fxrstor
+    mov     edx, [ebx + CPUMCPU.Host.fXStateMask + 4]
+    xrstor  [ecx]
+    jmp     gth_fpu_done
+gth_fpu_host_fxrstor:
+    fxrstor [ecx]
+
+gth_fpu_done:
+    mov     edx, ebx                    ; restore edx
 gth_fpu_no:
 
     ; Control registers.
@@ -1022,7 +1023,7 @@ gth_fpu_no:
     mov     cr4, ecx
     mov     ecx, [edx + CPUMCPU.Host.cr0]
     mov     cr0, ecx
-    ;mov     ecx, [edx + CPUMCPU.Host.cr2] ; assumes this is waste of time.
+    ;mov     ecx, [edx + CPUMCPU.Host.cr2] ; assumes this is a waste of time.
     ;mov     cr2, ecx
 
     ; restore debug registers (if modified) (esi must still be fUseFlags!)
diff --git a/src/VBox/VMM/dtrace/return-to-ring-3-aggregation-1.d b/src/VBox/VMM/dtrace/return-to-ring-3-aggregation-1.d
new file mode 100644
index 0000000..741e0dd
--- /dev/null
+++ b/src/VBox/VMM/dtrace/return-to-ring-3-aggregation-1.d
@@ -0,0 +1,36 @@
+/* $Id: return-to-ring-3-aggregation-1.d $ */
+/** @file
+ * DTracing VBox - return to ring-3 aggregation test \#1.
+ */
+
+/*
+ * Copyright (C) 2012-2016 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#pragma D option quiet
+
+
+vboxvmm:::r0-vmm-return-to-ring3-hm
+{
+    @g_aHmRcs[args[2]] = count();
+}
+
+vboxvmm:::r0-vmm-return-to-ring3-rc
+{
+    @g_aRawRcs[args[2]] = count();
+}
+
+END
+{
+    printa(" rcHm=%04d   %@8u times\n", @g_aHmRcs);
+    printa(" rcRaw=%04d   %@8u times\n", @g_aRawRcs);
+}
+
diff --git a/src/VBox/VMM/dtrace/vmexit-reason-aggregation-1.d b/src/VBox/VMM/dtrace/vmexit-reason-aggregation-1.d
new file mode 100644
index 0000000..01e5afd
--- /dev/null
+++ b/src/VBox/VMM/dtrace/vmexit-reason-aggregation-1.d
@@ -0,0 +1,36 @@
+/* $Id: vmexit-reason-aggregation-1.d $ */
+/** @file
+ * DTracing VBox - vmexit reason aggregation test \#1.
+ */
+
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#pragma D option quiet
+
+
+vboxvmm:::r0-hmsvm-vmexit
+{
+    @g_aSvmExits[args[2]] = count();
+}
+
+vboxvmm:::r0-hmvmx-vmexit-noctx
+{
+    @g_aVmxExits[args[2]] = count();
+}
+
+END
+{
+    printa(" svmexit=%#04llx   %@10u times\n", @g_aSvmExits);
+    printa(" vmxexit=%#04llx   %@10u times\n", @g_aVmxExits);
+}
+
diff --git a/src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d b/src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d
index 0064d8d..5856b84 100644
--- a/src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d
+++ b/src/VBox/VMM/dtrace/vmexit-rip-aggregation-1.d
@@ -17,9 +17,10 @@
 
 #pragma D option quiet
 
+
 vboxvmm:::r0-hmsvm-vmexit,vboxvmm:::r0-hmvmx-vmexit
 {
-    /* printf("cs:rip=%02x:%08llx", args[1]->cs, args[1]->rip.rip);*/
+    /*printf("cs:rip=%02x:%08llx", args[1]->cs.Sel, args[1]->rip.rip);*/
     @g_aRips[args[1]->rip.rip] = count();
     /*@g_aRips[args[0]->cpum.s.Guest.rip.rip] = count(); - alternative access route */
 }
diff --git a/src/VBox/VMM/include/CPUMInternal.h b/src/VBox/VMM/include/CPUMInternal.h
index 7aae9c7..8ec19e4 100644
--- a/src/VBox/VMM/include/CPUMInternal.h
+++ b/src/VBox/VMM/include/CPUMInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -26,6 +26,13 @@
 #else
 # pragma D depends_on library x86.d
 # pragma D depends_on library cpumctx.d
+
+/* Some fudging. */
+typedef uint32_t CPUMMICROARCH;
+typedef uint32_t CPUMUNKNOWNCPUID;
+typedef struct CPUMCPUIDLEAF *PCPUMCPUIDLEAF;
+typedef struct CPUMMSRRANGE  *PCPUMMSRRANGE;
+typedef uint64_t STAMCOUNTER;
 #endif
 
 
@@ -96,7 +103,7 @@
 /** Sync the debug state on next entry (32->64 switcher only). */
 #define CPUM_SYNC_DEBUG_REGS_GUEST      RT_BIT(17)
 /** Sync the debug state on next entry (32->64 switcher only).
- * Almost the same as CPUM_USE_DEBUG_REGS_HYPER in the raw-mode switchers.  */
+ * Almost the same as CPUM_USE_DEBUG_REGS_HYPER in the raw-mode switchers. */
 #define CPUM_SYNC_DEBUG_REGS_HYPER      RT_BIT(18)
 /** Host CPU requires fxsave/fxrstor leaky bit handling. */
 #define CPUM_USE_FFXSR_LEAKY            RT_BIT(19)
@@ -112,623 +119,36 @@
 #endif
 
 
-/**
- * MSR read functions.
- */
-typedef enum CPUMMSRRDFN
-{
-    /** Invalid zero value. */
-    kCpumMsrRdFn_Invalid = 0,
-    /** Return the CPUMMSRRANGE::uValue. */
-    kCpumMsrRdFn_FixedValue,
-    /** Alias to the MSR range starting at the MSR given by
-     * CPUMMSRRANGE::uValue.  Must be used in pair with
-     * kCpumMsrWrFn_MsrAlias. */
-    kCpumMsrRdFn_MsrAlias,
-    /** Write only register, GP all read attempts. */
-    kCpumMsrRdFn_WriteOnly,
-
-    kCpumMsrRdFn_Ia32P5McAddr,
-    kCpumMsrRdFn_Ia32P5McType,
-    kCpumMsrRdFn_Ia32TimestampCounter,
-    kCpumMsrRdFn_Ia32PlatformId,            /**< Takes real CPU value for reference. */
-    kCpumMsrRdFn_Ia32ApicBase,
-    kCpumMsrRdFn_Ia32FeatureControl,
-    kCpumMsrRdFn_Ia32BiosSignId,            /**< Range value returned. */
-    kCpumMsrRdFn_Ia32SmmMonitorCtl,
-    kCpumMsrRdFn_Ia32PmcN,
-    kCpumMsrRdFn_Ia32MonitorFilterLineSize,
-    kCpumMsrRdFn_Ia32MPerf,
-    kCpumMsrRdFn_Ia32APerf,
-    kCpumMsrRdFn_Ia32MtrrCap,               /**< Takes real CPU value for reference.  */
-    kCpumMsrRdFn_Ia32MtrrPhysBaseN,         /**< Takes register number. */
-    kCpumMsrRdFn_Ia32MtrrPhysMaskN,         /**< Takes register number. */
-    kCpumMsrRdFn_Ia32MtrrFixed,             /**< Takes CPUMCPU offset. */
-    kCpumMsrRdFn_Ia32MtrrDefType,
-    kCpumMsrRdFn_Ia32Pat,
-    kCpumMsrRdFn_Ia32SysEnterCs,
-    kCpumMsrRdFn_Ia32SysEnterEsp,
-    kCpumMsrRdFn_Ia32SysEnterEip,
-    kCpumMsrRdFn_Ia32McgCap,
-    kCpumMsrRdFn_Ia32McgStatus,
-    kCpumMsrRdFn_Ia32McgCtl,
-    kCpumMsrRdFn_Ia32DebugCtl,
-    kCpumMsrRdFn_Ia32SmrrPhysBase,
-    kCpumMsrRdFn_Ia32SmrrPhysMask,
-    kCpumMsrRdFn_Ia32PlatformDcaCap,
-    kCpumMsrRdFn_Ia32CpuDcaCap,
-    kCpumMsrRdFn_Ia32Dca0Cap,
-    kCpumMsrRdFn_Ia32PerfEvtSelN,           /**< Range value indicates the register number. */
-    kCpumMsrRdFn_Ia32PerfStatus,            /**< Range value returned. */
-    kCpumMsrRdFn_Ia32PerfCtl,               /**< Range value returned. */
-    kCpumMsrRdFn_Ia32FixedCtrN,             /**< Takes register number of start of range. */
-    kCpumMsrRdFn_Ia32PerfCapabilities,      /**< Takes reference value. */
-    kCpumMsrRdFn_Ia32FixedCtrCtrl,
-    kCpumMsrRdFn_Ia32PerfGlobalStatus,      /**< Takes reference value. */
-    kCpumMsrRdFn_Ia32PerfGlobalCtrl,
-    kCpumMsrRdFn_Ia32PerfGlobalOvfCtrl,
-    kCpumMsrRdFn_Ia32PebsEnable,
-    kCpumMsrRdFn_Ia32ClockModulation,       /**< Range value returned. */
-    kCpumMsrRdFn_Ia32ThermInterrupt,        /**< Range value returned. */
-    kCpumMsrRdFn_Ia32ThermStatus,           /**< Range value returned. */
-    kCpumMsrRdFn_Ia32Therm2Ctl,             /**< Range value returned. */
-    kCpumMsrRdFn_Ia32MiscEnable,            /**< Range value returned. */
-    kCpumMsrRdFn_Ia32McCtlStatusAddrMiscN,  /**< Takes bank number. */
-    kCpumMsrRdFn_Ia32McNCtl2,               /**< Takes register number of start of range. */
-    kCpumMsrRdFn_Ia32DsArea,
-    kCpumMsrRdFn_Ia32TscDeadline,
-    kCpumMsrRdFn_Ia32X2ApicN,
-    kCpumMsrRdFn_Ia32DebugInterface,
-    kCpumMsrRdFn_Ia32VmxBase,               /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxPinbasedCtls,       /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxProcbasedCtls,      /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxExitCtls,           /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxEntryCtls,          /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxMisc,               /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxCr0Fixed0,          /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxCr0Fixed1,          /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxCr4Fixed0,          /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxCr4Fixed1,          /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxVmcsEnum,           /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxProcBasedCtls2,     /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxEptVpidCap,         /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxTruePinbasedCtls,   /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxTrueProcbasedCtls,  /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxTrueExitCtls,       /**< Takes real value as reference. */
-    kCpumMsrRdFn_Ia32VmxTrueEntryCtls,      /**< Takes real value as reference. */
-
-    kCpumMsrRdFn_Amd64Efer,
-    kCpumMsrRdFn_Amd64SyscallTarget,
-    kCpumMsrRdFn_Amd64LongSyscallTarget,
-    kCpumMsrRdFn_Amd64CompSyscallTarget,
-    kCpumMsrRdFn_Amd64SyscallFlagMask,
-    kCpumMsrRdFn_Amd64FsBase,
-    kCpumMsrRdFn_Amd64GsBase,
-    kCpumMsrRdFn_Amd64KernelGsBase,
-    kCpumMsrRdFn_Amd64TscAux,
-
-    kCpumMsrRdFn_IntelEblCrPowerOn,
-    kCpumMsrRdFn_IntelI7CoreThreadCount,
-    kCpumMsrRdFn_IntelP4EbcHardPowerOn,
-    kCpumMsrRdFn_IntelP4EbcSoftPowerOn,
-    kCpumMsrRdFn_IntelP4EbcFrequencyId,
-    kCpumMsrRdFn_IntelP6FsbFrequency,       /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelPlatformInfo,
-    kCpumMsrRdFn_IntelFlexRatio,            /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelPkgCStConfigControl,
-    kCpumMsrRdFn_IntelPmgIoCaptureBase,
-    kCpumMsrRdFn_IntelLastBranchFromToN,
-    kCpumMsrRdFn_IntelLastBranchFromN,
-    kCpumMsrRdFn_IntelLastBranchToN,
-    kCpumMsrRdFn_IntelLastBranchTos,
-    kCpumMsrRdFn_IntelBblCrCtl,
-    kCpumMsrRdFn_IntelBblCrCtl3,
-    kCpumMsrRdFn_IntelI7TemperatureTarget,  /**< Range value returned. */
-    kCpumMsrRdFn_IntelI7MsrOffCoreResponseN,/**< Takes register number. */
-    kCpumMsrRdFn_IntelI7MiscPwrMgmt,
-    kCpumMsrRdFn_IntelP6CrN,
-    kCpumMsrRdFn_IntelCpuId1FeatureMaskEcdx,
-    kCpumMsrRdFn_IntelCpuId1FeatureMaskEax,
-    kCpumMsrRdFn_IntelCpuId80000001FeatureMaskEcdx,
-    kCpumMsrRdFn_IntelI7SandyAesNiCtl,
-    kCpumMsrRdFn_IntelI7TurboRatioLimit,    /**< Returns range value. */
-    kCpumMsrRdFn_IntelI7LbrSelect,
-    kCpumMsrRdFn_IntelI7SandyErrorControl,
-    kCpumMsrRdFn_IntelI7VirtualLegacyWireCap,/**< Returns range value. */
-    kCpumMsrRdFn_IntelI7PowerCtl,
-    kCpumMsrRdFn_IntelI7SandyPebsNumAlt,
-    kCpumMsrRdFn_IntelI7PebsLdLat,
-    kCpumMsrRdFn_IntelI7PkgCnResidencyN,     /**< Takes C-state number. */
-    kCpumMsrRdFn_IntelI7CoreCnResidencyN,    /**< Takes C-state number. */
-    kCpumMsrRdFn_IntelI7SandyVrCurrentConfig,/**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7SandyVrMiscConfig,   /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7SandyRaplPowerUnit,  /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7SandyPkgCnIrtlN,     /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7SandyPkgC2Residency, /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPkgPowerLimit,   /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPkgEnergyStatus, /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPkgPerfStatus,   /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPkgPowerInfo,    /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplDramPowerLimit,  /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplDramEnergyStatus,/**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplDramPerfStatus,  /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplDramPowerInfo,   /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPp0PowerLimit,   /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPp0EnergyStatus, /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPp0Policy,       /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPp0PerfStatus,   /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPp1PowerLimit,   /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPp1EnergyStatus, /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7RaplPp1Policy,       /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7IvyConfigTdpNominal, /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7IvyConfigTdpLevel1,  /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7IvyConfigTdpLevel2,  /**< Takes real value as reference. */
-    kCpumMsrRdFn_IntelI7IvyConfigTdpControl,
-    kCpumMsrRdFn_IntelI7IvyTurboActivationRatio,
-    kCpumMsrRdFn_IntelI7UncPerfGlobalCtrl,
-    kCpumMsrRdFn_IntelI7UncPerfGlobalStatus,
-    kCpumMsrRdFn_IntelI7UncPerfGlobalOvfCtrl,
-    kCpumMsrRdFn_IntelI7UncPerfFixedCtrCtrl,
-    kCpumMsrRdFn_IntelI7UncPerfFixedCtr,
-    kCpumMsrRdFn_IntelI7UncCBoxConfig,
-    kCpumMsrRdFn_IntelI7UncArbPerfCtrN,
-    kCpumMsrRdFn_IntelI7UncArbPerfEvtSelN,
-    kCpumMsrRdFn_IntelCore2EmttmCrTablesN,  /**< Range value returned. */
-    kCpumMsrRdFn_IntelCore2SmmCStMiscInfo,
-    kCpumMsrRdFn_IntelCore1ExtConfig,
-    kCpumMsrRdFn_IntelCore1DtsCalControl,
-    kCpumMsrRdFn_IntelCore2PeciControl,
-
-    kCpumMsrRdFn_P6LastBranchFromIp,
-    kCpumMsrRdFn_P6LastBranchToIp,
-    kCpumMsrRdFn_P6LastIntFromIp,
-    kCpumMsrRdFn_P6LastIntToIp,
-
-    kCpumMsrRdFn_AmdFam15hTscRate,
-    kCpumMsrRdFn_AmdFam15hLwpCfg,
-    kCpumMsrRdFn_AmdFam15hLwpCbAddr,
-    kCpumMsrRdFn_AmdFam10hMc4MiscN,
-    kCpumMsrRdFn_AmdK8PerfCtlN,
-    kCpumMsrRdFn_AmdK8PerfCtrN,
-    kCpumMsrRdFn_AmdK8SysCfg,               /**< Range value returned. */
-    kCpumMsrRdFn_AmdK8HwCr,
-    kCpumMsrRdFn_AmdK8IorrBaseN,
-    kCpumMsrRdFn_AmdK8IorrMaskN,
-    kCpumMsrRdFn_AmdK8TopOfMemN,
-    kCpumMsrRdFn_AmdK8NbCfg1,
-    kCpumMsrRdFn_AmdK8McXcptRedir,
-    kCpumMsrRdFn_AmdK8CpuNameN,
-    kCpumMsrRdFn_AmdK8HwThermalCtrl,        /**< Range value returned. */
-    kCpumMsrRdFn_AmdK8SwThermalCtrl,
-    kCpumMsrRdFn_AmdK8FidVidControl,        /**< Range value returned. */
-    kCpumMsrRdFn_AmdK8FidVidStatus,         /**< Range value returned. */
-    kCpumMsrRdFn_AmdK8McCtlMaskN,
-    kCpumMsrRdFn_AmdK8SmiOnIoTrapN,
-    kCpumMsrRdFn_AmdK8SmiOnIoTrapCtlSts,
-    kCpumMsrRdFn_AmdK8IntPendingMessage,
-    kCpumMsrRdFn_AmdK8SmiTriggerIoCycle,
-    kCpumMsrRdFn_AmdFam10hMmioCfgBaseAddr,
-    kCpumMsrRdFn_AmdFam10hTrapCtlMaybe,
-    kCpumMsrRdFn_AmdFam10hPStateCurLimit,   /**< Returns range value. */
-    kCpumMsrRdFn_AmdFam10hPStateControl,    /**< Returns range value. */
-    kCpumMsrRdFn_AmdFam10hPStateStatus,     /**< Returns range value. */
-    kCpumMsrRdFn_AmdFam10hPStateN,          /**< Returns range value. This isn't an register index! */
-    kCpumMsrRdFn_AmdFam10hCofVidControl,    /**< Returns range value. */
-    kCpumMsrRdFn_AmdFam10hCofVidStatus,     /**< Returns range value. */
-    kCpumMsrRdFn_AmdFam10hCStateIoBaseAddr,
-    kCpumMsrRdFn_AmdFam10hCpuWatchdogTimer,
-    kCpumMsrRdFn_AmdK8SmmBase,
-    kCpumMsrRdFn_AmdK8SmmAddr,
-    kCpumMsrRdFn_AmdK8SmmMask,
-    kCpumMsrRdFn_AmdK8VmCr,
-    kCpumMsrRdFn_AmdK8IgnNe,
-    kCpumMsrRdFn_AmdK8SmmCtl,
-    kCpumMsrRdFn_AmdK8VmHSavePa,
-    kCpumMsrRdFn_AmdFam10hVmLockKey,
-    kCpumMsrRdFn_AmdFam10hSmmLockKey,
-    kCpumMsrRdFn_AmdFam10hLocalSmiStatus,
-    kCpumMsrRdFn_AmdFam10hOsVisWrkIdLength,
-    kCpumMsrRdFn_AmdFam10hOsVisWrkStatus,
-    kCpumMsrRdFn_AmdFam16hL2IPerfCtlN,
-    kCpumMsrRdFn_AmdFam16hL2IPerfCtrN,
-    kCpumMsrRdFn_AmdFam15hNorthbridgePerfCtlN,
-    kCpumMsrRdFn_AmdFam15hNorthbridgePerfCtrN,
-    kCpumMsrRdFn_AmdK7MicrocodeCtl,         /**< Returns range value. */
-    kCpumMsrRdFn_AmdK7ClusterIdMaybe,       /**< Returns range value. */
-    kCpumMsrRdFn_AmdK8CpuIdCtlStd07hEbax,
-    kCpumMsrRdFn_AmdK8CpuIdCtlStd06hEcx,
-    kCpumMsrRdFn_AmdK8CpuIdCtlStd01hEdcx,
-    kCpumMsrRdFn_AmdK8CpuIdCtlExt01hEdcx,
-    kCpumMsrRdFn_AmdK8PatchLevel,           /**< Returns range value. */
-    kCpumMsrRdFn_AmdK7DebugStatusMaybe,
-    kCpumMsrRdFn_AmdK7BHTraceBaseMaybe,
-    kCpumMsrRdFn_AmdK7BHTracePtrMaybe,
-    kCpumMsrRdFn_AmdK7BHTraceLimitMaybe,
-    kCpumMsrRdFn_AmdK7HardwareDebugToolCfgMaybe,
-    kCpumMsrRdFn_AmdK7FastFlushCountMaybe,
-    kCpumMsrRdFn_AmdK7NodeId,
-    kCpumMsrRdFn_AmdK7DrXAddrMaskN,      /**< Takes register index. */
-    kCpumMsrRdFn_AmdK7Dr0DataMatchMaybe,
-    kCpumMsrRdFn_AmdK7Dr0DataMaskMaybe,
-    kCpumMsrRdFn_AmdK7LoadStoreCfg,
-    kCpumMsrRdFn_AmdK7InstrCacheCfg,
-    kCpumMsrRdFn_AmdK7DataCacheCfg,
-    kCpumMsrRdFn_AmdK7BusUnitCfg,
-    kCpumMsrRdFn_AmdK7DebugCtl2Maybe,
-    kCpumMsrRdFn_AmdFam15hFpuCfg,
-    kCpumMsrRdFn_AmdFam15hDecoderCfg,
-    kCpumMsrRdFn_AmdFam10hBusUnitCfg2,
-    kCpumMsrRdFn_AmdFam15hCombUnitCfg,
-    kCpumMsrRdFn_AmdFam15hCombUnitCfg2,
-    kCpumMsrRdFn_AmdFam15hCombUnitCfg3,
-    kCpumMsrRdFn_AmdFam15hExecUnitCfg,
-    kCpumMsrRdFn_AmdFam15hLoadStoreCfg2,
-    kCpumMsrRdFn_AmdFam10hIbsFetchCtl,
-    kCpumMsrRdFn_AmdFam10hIbsFetchLinAddr,
-    kCpumMsrRdFn_AmdFam10hIbsFetchPhysAddr,
-    kCpumMsrRdFn_AmdFam10hIbsOpExecCtl,
-    kCpumMsrRdFn_AmdFam10hIbsOpRip,
-    kCpumMsrRdFn_AmdFam10hIbsOpData,
-    kCpumMsrRdFn_AmdFam10hIbsOpData2,
-    kCpumMsrRdFn_AmdFam10hIbsOpData3,
-    kCpumMsrRdFn_AmdFam10hIbsDcLinAddr,
-    kCpumMsrRdFn_AmdFam10hIbsDcPhysAddr,
-    kCpumMsrRdFn_AmdFam10hIbsCtl,
-    kCpumMsrRdFn_AmdFam14hIbsBrTarget,
-
-    /** End of valid MSR read function indexes. */
-    kCpumMsrRdFn_End
-} CPUMMSRRDFN;
-
-/**
- * MSR write functions.
- */
-typedef enum CPUMMSRWRFN
-{
-    /** Invalid zero value. */
-    kCpumMsrWrFn_Invalid = 0,
-    /** Writes are ignored, the fWrGpMask is observed though. */
-    kCpumMsrWrFn_IgnoreWrite,
-    /** Writes cause GP(0) to be raised, the fWrGpMask should be UINT64_MAX. */
-    kCpumMsrWrFn_ReadOnly,
-    /** Alias to the MSR range starting at the MSR given by
-     * CPUMMSRRANGE::uValue.  Must be used in pair with
-     * kCpumMsrRdFn_MsrAlias. */
-    kCpumMsrWrFn_MsrAlias,
-
-    kCpumMsrWrFn_Ia32P5McAddr,
-    kCpumMsrWrFn_Ia32P5McType,
-    kCpumMsrWrFn_Ia32TimestampCounter,
-    kCpumMsrWrFn_Ia32ApicBase,
-    kCpumMsrWrFn_Ia32FeatureControl,
-    kCpumMsrWrFn_Ia32BiosSignId,
-    kCpumMsrWrFn_Ia32BiosUpdateTrigger,
-    kCpumMsrWrFn_Ia32SmmMonitorCtl,
-    kCpumMsrWrFn_Ia32PmcN,
-    kCpumMsrWrFn_Ia32MonitorFilterLineSize,
-    kCpumMsrWrFn_Ia32MPerf,
-    kCpumMsrWrFn_Ia32APerf,
-    kCpumMsrWrFn_Ia32MtrrPhysBaseN,         /**< Takes register number. */
-    kCpumMsrWrFn_Ia32MtrrPhysMaskN,         /**< Takes register number. */
-    kCpumMsrWrFn_Ia32MtrrFixed,             /**< Takes CPUMCPU offset. */
-    kCpumMsrWrFn_Ia32MtrrDefType,
-    kCpumMsrWrFn_Ia32Pat,
-    kCpumMsrWrFn_Ia32SysEnterCs,
-    kCpumMsrWrFn_Ia32SysEnterEsp,
-    kCpumMsrWrFn_Ia32SysEnterEip,
-    kCpumMsrWrFn_Ia32McgStatus,
-    kCpumMsrWrFn_Ia32McgCtl,
-    kCpumMsrWrFn_Ia32DebugCtl,
-    kCpumMsrWrFn_Ia32SmrrPhysBase,
-    kCpumMsrWrFn_Ia32SmrrPhysMask,
-    kCpumMsrWrFn_Ia32PlatformDcaCap,
-    kCpumMsrWrFn_Ia32Dca0Cap,
-    kCpumMsrWrFn_Ia32PerfEvtSelN,           /**< Range value indicates the register number. */
-    kCpumMsrWrFn_Ia32PerfStatus,
-    kCpumMsrWrFn_Ia32PerfCtl,
-    kCpumMsrWrFn_Ia32FixedCtrN,             /**< Takes register number of start of range. */
-    kCpumMsrWrFn_Ia32PerfCapabilities,
-    kCpumMsrWrFn_Ia32FixedCtrCtrl,
-    kCpumMsrWrFn_Ia32PerfGlobalStatus,
-    kCpumMsrWrFn_Ia32PerfGlobalCtrl,
-    kCpumMsrWrFn_Ia32PerfGlobalOvfCtrl,
-    kCpumMsrWrFn_Ia32PebsEnable,
-    kCpumMsrWrFn_Ia32ClockModulation,
-    kCpumMsrWrFn_Ia32ThermInterrupt,
-    kCpumMsrWrFn_Ia32ThermStatus,
-    kCpumMsrWrFn_Ia32Therm2Ctl,
-    kCpumMsrWrFn_Ia32MiscEnable,
-    kCpumMsrWrFn_Ia32McCtlStatusAddrMiscN,  /**< Takes bank number. */
-    kCpumMsrWrFn_Ia32McNCtl2,               /**< Takes register number of start of range. */
-    kCpumMsrWrFn_Ia32DsArea,
-    kCpumMsrWrFn_Ia32TscDeadline,
-    kCpumMsrWrFn_Ia32X2ApicN,
-    kCpumMsrWrFn_Ia32DebugInterface,
-
-    kCpumMsrWrFn_Amd64Efer,
-    kCpumMsrWrFn_Amd64SyscallTarget,
-    kCpumMsrWrFn_Amd64LongSyscallTarget,
-    kCpumMsrWrFn_Amd64CompSyscallTarget,
-    kCpumMsrWrFn_Amd64SyscallFlagMask,
-    kCpumMsrWrFn_Amd64FsBase,
-    kCpumMsrWrFn_Amd64GsBase,
-    kCpumMsrWrFn_Amd64KernelGsBase,
-    kCpumMsrWrFn_Amd64TscAux,
-    kCpumMsrWrFn_IntelEblCrPowerOn,
-    kCpumMsrWrFn_IntelP4EbcHardPowerOn,
-    kCpumMsrWrFn_IntelP4EbcSoftPowerOn,
-    kCpumMsrWrFn_IntelP4EbcFrequencyId,
-    kCpumMsrWrFn_IntelFlexRatio,
-    kCpumMsrWrFn_IntelPkgCStConfigControl,
-    kCpumMsrWrFn_IntelPmgIoCaptureBase,
-    kCpumMsrWrFn_IntelLastBranchFromToN,
-    kCpumMsrWrFn_IntelLastBranchFromN,
-    kCpumMsrWrFn_IntelLastBranchToN,
-    kCpumMsrWrFn_IntelLastBranchTos,
-    kCpumMsrWrFn_IntelBblCrCtl,
-    kCpumMsrWrFn_IntelBblCrCtl3,
-    kCpumMsrWrFn_IntelI7TemperatureTarget,
-    kCpumMsrWrFn_IntelI7MsrOffCoreResponseN, /**< Takes register number. */
-    kCpumMsrWrFn_IntelI7MiscPwrMgmt,
-    kCpumMsrWrFn_IntelP6CrN,
-    kCpumMsrWrFn_IntelCpuId1FeatureMaskEcdx,
-    kCpumMsrWrFn_IntelCpuId1FeatureMaskEax,
-    kCpumMsrWrFn_IntelCpuId80000001FeatureMaskEcdx,
-    kCpumMsrWrFn_IntelI7SandyAesNiCtl,
-    kCpumMsrWrFn_IntelI7TurboRatioLimit,
-    kCpumMsrWrFn_IntelI7LbrSelect,
-    kCpumMsrWrFn_IntelI7SandyErrorControl,
-    kCpumMsrWrFn_IntelI7PowerCtl,
-    kCpumMsrWrFn_IntelI7SandyPebsNumAlt,
-    kCpumMsrWrFn_IntelI7PebsLdLat,
-    kCpumMsrWrFn_IntelI7SandyVrCurrentConfig,
-    kCpumMsrWrFn_IntelI7SandyVrMiscConfig,
-    kCpumMsrWrFn_IntelI7SandyPkgCnIrtlN,
-    kCpumMsrWrFn_IntelI7RaplPkgPowerLimit,
-    kCpumMsrWrFn_IntelI7RaplDramPowerLimit,
-    kCpumMsrWrFn_IntelI7RaplPp0PowerLimit,
-    kCpumMsrWrFn_IntelI7RaplPp0Policy,
-    kCpumMsrWrFn_IntelI7RaplPp1PowerLimit,
-    kCpumMsrWrFn_IntelI7RaplPp1Policy,
-    kCpumMsrWrFn_IntelI7IvyConfigTdpControl,
-    kCpumMsrWrFn_IntelI7IvyTurboActivationRatio,
-    kCpumMsrWrFn_IntelI7UncPerfGlobalCtrl,
-    kCpumMsrWrFn_IntelI7UncPerfGlobalStatus,
-    kCpumMsrWrFn_IntelI7UncPerfGlobalOvfCtrl,
-    kCpumMsrWrFn_IntelI7UncPerfFixedCtrCtrl,
-    kCpumMsrWrFn_IntelI7UncPerfFixedCtr,
-    kCpumMsrWrFn_IntelI7UncArbPerfCtrN,
-    kCpumMsrWrFn_IntelI7UncArbPerfEvtSelN,
-    kCpumMsrWrFn_IntelCore2EmttmCrTablesN,
-    kCpumMsrWrFn_IntelCore2SmmCStMiscInfo,
-    kCpumMsrWrFn_IntelCore1ExtConfig,
-    kCpumMsrWrFn_IntelCore1DtsCalControl,
-    kCpumMsrWrFn_IntelCore2PeciControl,
-
-    kCpumMsrWrFn_P6LastIntFromIp,
-    kCpumMsrWrFn_P6LastIntToIp,
-
-    kCpumMsrWrFn_AmdFam15hTscRate,
-    kCpumMsrWrFn_AmdFam15hLwpCfg,
-    kCpumMsrWrFn_AmdFam15hLwpCbAddr,
-    kCpumMsrWrFn_AmdFam10hMc4MiscN,
-    kCpumMsrWrFn_AmdK8PerfCtlN,
-    kCpumMsrWrFn_AmdK8PerfCtrN,
-    kCpumMsrWrFn_AmdK8SysCfg,
-    kCpumMsrWrFn_AmdK8HwCr,
-    kCpumMsrWrFn_AmdK8IorrBaseN,
-    kCpumMsrWrFn_AmdK8IorrMaskN,
-    kCpumMsrWrFn_AmdK8TopOfMemN,
-    kCpumMsrWrFn_AmdK8NbCfg1,
-    kCpumMsrWrFn_AmdK8McXcptRedir,
-    kCpumMsrWrFn_AmdK8CpuNameN,
-    kCpumMsrWrFn_AmdK8HwThermalCtrl,
-    kCpumMsrWrFn_AmdK8SwThermalCtrl,
-    kCpumMsrWrFn_AmdK8FidVidControl,
-    kCpumMsrWrFn_AmdK8McCtlMaskN,
-    kCpumMsrWrFn_AmdK8SmiOnIoTrapN,
-    kCpumMsrWrFn_AmdK8SmiOnIoTrapCtlSts,
-    kCpumMsrWrFn_AmdK8IntPendingMessage,
-    kCpumMsrWrFn_AmdK8SmiTriggerIoCycle,
-    kCpumMsrWrFn_AmdFam10hMmioCfgBaseAddr,
-    kCpumMsrWrFn_AmdFam10hTrapCtlMaybe,
-    kCpumMsrWrFn_AmdFam10hPStateControl,
-    kCpumMsrWrFn_AmdFam10hPStateStatus,
-    kCpumMsrWrFn_AmdFam10hPStateN,
-    kCpumMsrWrFn_AmdFam10hCofVidControl,
-    kCpumMsrWrFn_AmdFam10hCofVidStatus,
-    kCpumMsrWrFn_AmdFam10hCStateIoBaseAddr,
-    kCpumMsrWrFn_AmdFam10hCpuWatchdogTimer,
-    kCpumMsrWrFn_AmdK8SmmBase,
-    kCpumMsrWrFn_AmdK8SmmAddr,
-    kCpumMsrWrFn_AmdK8SmmMask,
-    kCpumMsrWrFn_AmdK8VmCr,
-    kCpumMsrWrFn_AmdK8IgnNe,
-    kCpumMsrWrFn_AmdK8SmmCtl,
-    kCpumMsrWrFn_AmdK8VmHSavePa,
-    kCpumMsrWrFn_AmdFam10hVmLockKey,
-    kCpumMsrWrFn_AmdFam10hSmmLockKey,
-    kCpumMsrWrFn_AmdFam10hLocalSmiStatus,
-    kCpumMsrWrFn_AmdFam10hOsVisWrkIdLength,
-    kCpumMsrWrFn_AmdFam10hOsVisWrkStatus,
-    kCpumMsrWrFn_AmdFam16hL2IPerfCtlN,
-    kCpumMsrWrFn_AmdFam16hL2IPerfCtrN,
-    kCpumMsrWrFn_AmdFam15hNorthbridgePerfCtlN,
-    kCpumMsrWrFn_AmdFam15hNorthbridgePerfCtrN,
-    kCpumMsrWrFn_AmdK7MicrocodeCtl,
-    kCpumMsrWrFn_AmdK7ClusterIdMaybe,
-    kCpumMsrWrFn_AmdK8CpuIdCtlStd07hEbax,
-    kCpumMsrWrFn_AmdK8CpuIdCtlStd06hEcx,
-    kCpumMsrWrFn_AmdK8CpuIdCtlStd01hEdcx,
-    kCpumMsrWrFn_AmdK8CpuIdCtlExt01hEdcx,
-    kCpumMsrWrFn_AmdK8PatchLoader,
-    kCpumMsrWrFn_AmdK7DebugStatusMaybe,
-    kCpumMsrWrFn_AmdK7BHTraceBaseMaybe,
-    kCpumMsrWrFn_AmdK7BHTracePtrMaybe,
-    kCpumMsrWrFn_AmdK7BHTraceLimitMaybe,
-    kCpumMsrWrFn_AmdK7HardwareDebugToolCfgMaybe,
-    kCpumMsrWrFn_AmdK7FastFlushCountMaybe,
-    kCpumMsrWrFn_AmdK7NodeId,
-    kCpumMsrWrFn_AmdK7DrXAddrMaskN,      /**< Takes register index. */
-    kCpumMsrWrFn_AmdK7Dr0DataMatchMaybe,
-    kCpumMsrWrFn_AmdK7Dr0DataMaskMaybe,
-    kCpumMsrWrFn_AmdK7LoadStoreCfg,
-    kCpumMsrWrFn_AmdK7InstrCacheCfg,
-    kCpumMsrWrFn_AmdK7DataCacheCfg,
-    kCpumMsrWrFn_AmdK7BusUnitCfg,
-    kCpumMsrWrFn_AmdK7DebugCtl2Maybe,
-    kCpumMsrWrFn_AmdFam15hFpuCfg,
-    kCpumMsrWrFn_AmdFam15hDecoderCfg,
-    kCpumMsrWrFn_AmdFam10hBusUnitCfg2,
-    kCpumMsrWrFn_AmdFam15hCombUnitCfg,
-    kCpumMsrWrFn_AmdFam15hCombUnitCfg2,
-    kCpumMsrWrFn_AmdFam15hCombUnitCfg3,
-    kCpumMsrWrFn_AmdFam15hExecUnitCfg,
-    kCpumMsrWrFn_AmdFam15hLoadStoreCfg2,
-    kCpumMsrWrFn_AmdFam10hIbsFetchCtl,
-    kCpumMsrWrFn_AmdFam10hIbsFetchLinAddr,
-    kCpumMsrWrFn_AmdFam10hIbsFetchPhysAddr,
-    kCpumMsrWrFn_AmdFam10hIbsOpExecCtl,
-    kCpumMsrWrFn_AmdFam10hIbsOpRip,
-    kCpumMsrWrFn_AmdFam10hIbsOpData,
-    kCpumMsrWrFn_AmdFam10hIbsOpData2,
-    kCpumMsrWrFn_AmdFam10hIbsOpData3,
-    kCpumMsrWrFn_AmdFam10hIbsDcLinAddr,
-    kCpumMsrWrFn_AmdFam10hIbsDcPhysAddr,
-    kCpumMsrWrFn_AmdFam10hIbsCtl,
-    kCpumMsrWrFn_AmdFam14hIbsBrTarget,
-
-    /** End of valid MSR write function indexes. */
-    kCpumMsrWrFn_End
-} CPUMMSRWRFN;
-
-/**
- * MSR range.
- */
-typedef struct CPUMMSRRANGE
-{
-    /** The first MSR. [0] */
-    uint32_t    uFirst;
-    /** The last MSR. [4] */
-    uint32_t    uLast;
-    /** The read function (CPUMMSRRDFN). [8] */
-    uint16_t    enmRdFn;
-    /** The write function (CPUMMSRWRFN). [10] */
-    uint16_t    enmWrFn;
-    /** The offset of the 64-bit MSR value relative to the start of CPUMCPU.
-     * UINT16_MAX if not used by the read and write functions.  [12] */
-    uint16_t    offCpumCpu;
-    /** Reserved for future hacks. [14] */
-    uint16_t    fReserved;
-    /** The init/read value. [16]
-     * When enmRdFn is kCpumMsrRdFn_INIT_VALUE, this is the value returned on RDMSR.
-     * offCpumCpu must be UINT16_MAX in that case, otherwise it must be a valid
-     * offset into CPUM. */
-    uint64_t    uValue;
-    /** The bits to ignore when writing. [24]   */
-    uint64_t    fWrIgnMask;
-    /** The bits that will cause a GP(0) when writing. [32]
-     * This is always checked prior to calling the write function.  Using
-     * UINT64_MAX effectively marks the MSR as read-only. */
-    uint64_t    fWrGpMask;
-    /** The register name, if applicable. [40] */
-    char        szName[56];
-
-#ifdef VBOX_WITH_STATISTICS
-    /** The number of reads. */
-    STAMCOUNTER cReads;
-    /** The number of writes. */
-    STAMCOUNTER cWrites;
-    /** The number of times ignored bits were written. */
-    STAMCOUNTER cIgnoredBits;
-    /** The number of GPs generated. */
-    STAMCOUNTER cGps;
-#endif
-} CPUMMSRRANGE;
-#ifdef VBOX_WITH_STATISTICS
-AssertCompileSize(CPUMMSRRANGE, 128);
-#else
-AssertCompileSize(CPUMMSRRANGE, 96);
-#endif
-/** Pointer to an MSR range. */
-typedef CPUMMSRRANGE *PCPUMMSRRANGE;
-/** Pointer to a const MSR range. */
-typedef CPUMMSRRANGE const *PCCPUMMSRRANGE;
-
-
-
-
-/**
- * CPU features and quirks.
- * This is mostly exploded CPUID info.
- */
-typedef struct CPUMFEATURES
-{
-    /** The CPU vendor (CPUMCPUVENDOR). */
-    uint8_t         enmCpuVendor;
-    /** The CPU family. */
-    uint8_t         uFamily;
-    /** The CPU model. */
-    uint8_t         uModel;
-    /** The CPU stepping. */
-    uint8_t         uStepping;
-    /** The microarchitecture. */
-    CPUMMICROARCH   enmMicroarch;
-    /** The maximum physical address with of the CPU. */
-    uint8_t         cMaxPhysAddrWidth;
-    /** Alignment padding.  */
-    uint8_t         abPadding[3];
-
-    /** Supports MSRs.  */
-    uint32_t        fMsr : 1;
-    /** Supports the page size extension (4/2 MB pages). */
-    uint32_t        fPse : 1;
-    /** Supports 36-bit page size extension (4 MB pages can map memory above
-     *  4GB). */
-    uint32_t        fPse36 : 1;
-    /** Supports physical address extension (PAE).  */
-    uint32_t        fPae : 1;
-    /** Page attribute table (PAT) support (page level cache control). */
-    uint32_t        fPat : 1;
-    /** Supports the FXSAVE and FXRSTOR instructions. */
-    uint32_t        fFxSaveRstor : 1;
-    /** Intel SYSENTER/SYSEXIT support */
-    uint32_t        fSysEnter : 1;
-    /** First generation APIC. */
-    uint32_t        fApic : 1;
-    /** Second generation APIC. */
-    uint32_t        fX2Apic : 1;
-    /** Hypervisor present. */
-    uint32_t        fHypervisorPresent : 1;
-    /** MWAIT & MONITOR instructions supported. */
-    uint32_t        fMonitorMWait : 1;
-
-    /** AMD64: Supports long mode.  */
-    uint32_t        fLongMode : 1;
-    /** AMD64: SYSCALL/SYSRET support. */
-    uint32_t        fSysCall : 1;
-    /** AMD64: No-execute page table bit. */
-    uint32_t        fNoExecute : 1;
-    /** AMD64: Supports LAHF & SAHF instructions in 64-bit mode. */
-    uint32_t        fLahfSahf : 1;
-    /** AMD64: Supports RDTSCP. */
-    uint32_t        fRdTscP : 1;
-
-    /** Indicates that FPU instruction and data pointers may leak.
-     * This generally applies to recent AMD CPUs, where the FPU IP and DP pointer
-     * is only saved and restored if an exception is pending.   */
-    uint32_t        fLeakyFxSR : 1;
-
-    /** Alignment padding.  */
-    uint32_t        fPadding : 9;
-
-    uint64_t        auPadding[2];
-} CPUMFEATURES;
-AssertCompileSize(CPUMFEATURES, 32);
-/** Pointer to a CPU feature structure. */
-typedef CPUMFEATURES *PCPUMFEATURES;
-/** Pointer to a const CPU feature structure. */
-typedef CPUMFEATURES const *PCCPUMFEATURES;
+/** @name CPUM Saved State Version.
+ * @{ */
+/** The current saved state version. */
+#define CPUM_SAVED_STATE_VERSION                CPUM_SAVED_STATE_VERSION_XSAVE
+/** The saved state version including XSAVE state. */
+#define CPUM_SAVED_STATE_VERSION_XSAVE          17
+/** The saved state version with good CPUID leaf count. */
+#define CPUM_SAVED_STATE_VERSION_GOOD_CPUID_COUNT 16
+/** CPUID changes with explode forgetting to update the leaf count on
+ * restore, resulting in garbage being saved restoring+saving old states). */
+#define CPUM_SAVED_STATE_VERSION_BAD_CPUID_COUNT 15
+/** The saved state version before the CPUIDs changes. */
+#define CPUM_SAVED_STATE_VERSION_PUT_STRUCT     14
+/** The saved state version before using SSMR3PutStruct. */
+#define CPUM_SAVED_STATE_VERSION_MEM            13
+/** The saved state version before introducing the MSR size field. */
+#define CPUM_SAVED_STATE_VERSION_NO_MSR_SIZE    12
+/** The saved state version of 3.2, 3.1 and 3.3 trunk before the hidden
+ * selector register change (CPUM_CHANGED_HIDDEN_SEL_REGS_INVALID). */
+#define CPUM_SAVED_STATE_VERSION_VER3_2         11
+/** The saved state version of 3.0 and 3.1 trunk before the teleportation
+ * changes. */
+#define CPUM_SAVED_STATE_VERSION_VER3_0         10
+/** The saved state version for the 2.1 trunk before the MSR changes. */
+#define CPUM_SAVED_STATE_VERSION_VER2_1_NOMSR   9
+/** The saved state version of 2.0, used for backwards compatibility. */
+#define CPUM_SAVED_STATE_VERSION_VER2_0         8
+/** The saved state version of 1.6, used for backwards compatibility. */
+#define CPUM_SAVED_STATE_VERSION_VER1_6         6
+/** @} */
 
 
 /**
@@ -747,11 +167,12 @@ typedef struct CPUMINFO
     /** The index of the first extended CPUID leaf in the array.
      *  Set to cCpuIdLeaves if none present. */
     uint32_t                    iFirstExtCpuIdLeaf;
-    /** Alignment padding.  */
+    /** Alignment padding. */
     uint32_t                    uPadding;
     /** How to handle unknown CPUID leaves. */
-    CPUMUKNOWNCPUID             enmUnknownCpuIdMethod;
-    /** For use with CPUMUKNOWNCPUID_DEFAULTS. */
+    CPUMUNKNOWNCPUID            enmUnknownCpuIdMethod;
+    /** For use with CPUMUNKNOWNCPUID_DEFAULTS (DB & VM),
+     * CPUMUNKNOWNCPUID_LAST_STD_LEAF (VM) and CPUMUNKNOWNCPUID_LAST_STD_LEAF_WITH_ECX (VM). */
     CPUMCPUID                   DefCpuId;
 
     /** Scalable bus frequency used for reporting other frequencies. */
@@ -786,10 +207,6 @@ typedef CPUMINFO const *CPCPUMINFO;
  */
 typedef struct CPUMHOSTCTX
 {
-    /** FPU state. (16-byte alignment)
-     * @remark On x86, the format isn't necessarily X86FXSTATE (not important). */
-    X86FXSTATE      fpu;
-
     /** General purpose register, selectors, flags and more
      * @{ */
 #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
@@ -889,7 +306,7 @@ typedef struct CPUMHOSTCTX
     /** @} */
 
     /* padding to get 64byte aligned size */
-    uint8_t         auPadding[16+32];
+    uint8_t         auPadding[20];
 
 #elif HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
 
@@ -935,15 +352,28 @@ typedef struct CPUMHOSTCTX
 
     /* padding to get 32byte aligned size */
 # ifdef VBOX_WITH_HYBRID_32BIT_KERNEL
-    uint8_t         auPadding[16];
+    uint8_t         auPadding[52];
 # else
-    uint8_t         auPadding[8+32];
+    uint8_t         auPadding[4];
 # endif
 
 #else
 # error HC_ARCH_BITS not defined
 #endif
+
+    /** Pointer to the FPU/SSE/AVX/XXXX state raw-mode mapping. */
+    RCPTRTYPE(PX86XSAVEAREA)    pXStateRC;
+    /** Pointer to the FPU/SSE/AVX/XXXX state ring-0 mapping. */
+    R0PTRTYPE(PX86XSAVEAREA)    pXStateR0;
+    /** Pointer to the FPU/SSE/AVX/XXXX state ring-3 mapping. */
+    R3PTRTYPE(PX86XSAVEAREA)    pXStateR3;
+    /** The XCR0 register. */
+    uint64_t                    xcr0;
+    /** The mask to pass to XSAVE/XRSTOR in EDX:EAX.  If zero we use
+     *  FXSAVE/FXRSTOR (since bit 0 will always be set, we only need to test it). */
+    uint64_t                    fXStateMask;
 } CPUMHOSTCTX;
+AssertCompileSizeAlignment(CPUMHOSTCTX, 64);
 /** Pointer to the saved host CPU state. */
 typedef CPUMHOSTCTX *PCPUMHOSTCTX;
 
@@ -961,23 +391,6 @@ typedef struct CPUM
      */
     uint32_t                fHostUseFlags;
 
-    /** Host CPU Features - ECX */
-    struct
-    {
-        /** edx part */
-        X86CPUIDFEATEDX     edx;
-        /** ecx part */
-        X86CPUIDFEATECX     ecx;
-    } CPUFeatures;
-    /** Host extended CPU features. */
-    struct
-    {
-        /** edx part */
-        uint32_t            edx;
-        /** ecx part */
-        uint32_t            ecx;
-    } CPUFeaturesExt;
-
     /** CR4 mask */
     struct
     {
@@ -985,34 +398,36 @@ typedef struct CPUM
         uint32_t            OrMask;
     } CR4;
 
-    /** The (more) portable CPUID level.  */
+    /** The (more) portable CPUID level. */
     uint8_t                 u8PortableCpuIdLevel;
     /** Indicates that a state restore is pending.
      * This is used to verify load order dependencies (PGM). */
     bool                    fPendingRestore;
-    uint8_t                 abPadding[HC_ARCH_BITS == 64 ? 6 : 2];
-
-    /** The standard set of CpuId leaves. */
-    CPUMCPUID               aGuestCpuIdStd[6];
-    /** The extended set of CpuId leaves. */
-    CPUMCPUID               aGuestCpuIdExt[10];
-    /** The centaur set of CpuId leaves. */
-    CPUMCPUID               aGuestCpuIdCentaur[4];
-    /** The hypervisor specific set of CpuId leaves. */
-    CPUMCPUID               aGuestCpuIdHyper[4];
-    /** The default set of CpuId leaves. */
-    CPUMCPUID               GuestCpuIdDef;
+    uint8_t                 abPadding0[6];
 
-#if HC_ARCH_BITS == 32
-    uint8_t                 abPadding2[4];
-#endif
+    /** XSAVE/XRTOR components we can expose to the guest mask. */
+    uint64_t                fXStateGuestMask;
+    /** XSAVE/XRSTOR host mask.  Only state components in this mask can be exposed
+     * to the guest.  This is 0 if no XSAVE/XRSTOR bits can be exposed. */
+    uint64_t                fXStateHostMask;
+    uint8_t                 abPadding1[24];
 
+    /** Host CPU feature information.
+     * Externaly visible via the VM structure, aligned on 64-byte boundrary. */
+    CPUMFEATURES            HostFeatures;
+    /** Guest CPU feature information.
+     * Externaly visible via that VM structure, aligned with HostFeatures. */
+    CPUMFEATURES            GuestFeatures;
     /** Guest CPU info. */
     CPUMINFO                GuestInfo;
-    /** Guest CPU feature information. */
-    CPUMFEATURES            GuestFeatures;
-    /** Host CPU feature information. */
-    CPUMFEATURES            HostFeatures;
+
+
+    /** The standard set of CpuId leaves. */
+    CPUMCPUID               aGuestCpuIdPatmStd[6];
+    /** The extended set of CpuId leaves. */
+    CPUMCPUID               aGuestCpuIdPatmExt[10];
+    /** The centaur set of CpuId leaves. */
+    CPUMCPUID               aGuestCpuIdPatmCentaur[4];
 
     /** @name MSR statistics.
      * @{ */
@@ -1025,6 +440,8 @@ typedef struct CPUM
     STAMCOUNTER             cMsrReadsUnknown;
     /** @} */
 } CPUM;
+AssertCompileMemberOffset(CPUM, HostFeatures, 64);
+AssertCompileMemberOffset(CPUM, GuestFeatures, 96);
 /** Pointer to the CPUM instance data residing in the shared VM structure. */
 typedef CPUM *PCPUM;
 
@@ -1034,23 +451,6 @@ typedef CPUM *PCPUM;
 typedef struct CPUMCPU
 {
     /**
-     * Hypervisor context.
-     * Aligned on a 64-byte boundary.
-     */
-    CPUMCTX                 Hyper;
-
-    /**
-     * Saved host context. Only valid while inside GC.
-     * Aligned on a 64-byte boundary.
-     */
-    CPUMHOSTCTX             Host;
-
-#ifdef VBOX_WITH_CRASHDUMP_MAGIC
-    uint8_t                 aMagic[56];
-    uint64_t                uMagic;
-#endif
-
-    /**
      * Guest context.
      * Aligned on a 64-byte boundary.
      */
@@ -1100,8 +500,19 @@ typedef struct CPUMCPU
     /** Have we entered the recompiler? */
     bool                    fRemEntered;
 
-    /** Align the structure on a 64-byte boundary. */
+    /** Align the next member on a 64-bit boundrary. */
     uint8_t                 abPadding2[64 - 16 - (HC_ARCH_BITS == 64 ? 8 : 4) - 4 - 1 - 2];
+
+    /** Saved host context.  Only valid while inside RC or HM contexts.
+     * Must be aligned on a 64-byte boundary. */
+    CPUMHOSTCTX             Host;
+    /** Hypervisor context. Must be aligned on a 64-byte boundary. */
+    CPUMCTX                 Hyper;
+
+#ifdef VBOX_WITH_CRASHDUMP_MAGIC
+    uint8_t                 aMagic[56];
+    uint64_t                uMagic;
+#endif
 } CPUMCPU;
 /** Pointer to the CPUMCPU instance data residing in the shared VMCPU structure. */
 typedef CPUMCPU *PCPUMCPU;
@@ -1109,18 +520,20 @@ typedef CPUMCPU *PCPUMCPU;
 #ifndef VBOX_FOR_DTRACE_LIB
 RT_C_DECLS_BEGIN
 
-PCPUMCPUIDLEAF      cpumCpuIdGetLeaf(PVM pVM, uint32_t uLeaf, uint32_t uSubLeaf);
+PCPUMCPUIDLEAF      cpumCpuIdGetLeaf(PVM pVM, uint32_t uLeaf);
+PCPUMCPUIDLEAF      cpumCpuIdGetLeafEx(PVM pVM, uint32_t uLeaf, uint32_t uSubLeaf, bool *pfExactSubLeafHit);
 
 #ifdef IN_RING3
 int                 cpumR3DbgInit(PVM pVM);
-PCPUMCPUIDLEAF      cpumR3CpuIdGetLeaf(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uint32_t uLeaf, uint32_t uSubLeaf);
-bool                cpumR3CpuIdGetLeafLegacy(PCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, uint32_t uLeaf, uint32_t uSubLeaf,
-                                             PCPUMCPUID pLeagcy);
-int                 cpumR3CpuIdInsert(PCPUMCPUIDLEAF *ppaLeaves, uint32_t *pcLeaves, PCPUMCPUIDLEAF pNewLeaf);
-void                cpumR3CpuIdRemoveRange(PCPUMCPUIDLEAF paLeaves, uint32_t *pcLeaves, uint32_t uFirst, uint32_t uLast);
 int                 cpumR3CpuIdExplodeFeatures(PCCPUMCPUIDLEAF paLeaves, uint32_t cLeaves, PCPUMFEATURES pFeatures);
+int                 cpumR3InitCpuIdAndMsrs(PVM pVM);
+void                cpumR3SaveCpuId(PVM pVM, PSSMHANDLE pSSM);
+int                 cpumR3LoadCpuId(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion);
+int                 cpumR3LoadCpuIdPre32(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion);
+DECLCALLBACK(void)  cpumR3CpuIdInfo(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
+
 int                 cpumR3DbGetCpuInfo(const char *pszName, PCPUMINFO pInfo);
-int                 cpumR3MsrRangesInsert(PCPUMMSRRANGE *ppaMsrRanges, uint32_t *pcMsrRanges, PCCPUMMSRRANGE pNewRange);
+int                 cpumR3MsrRangesInsert(PVM pVM, PCPUMMSRRANGE *ppaMsrRanges, uint32_t *pcMsrRanges, PCCPUMMSRRANGE pNewRange);
 int                 cpumR3MsrApplyFudge(PVM pVM);
 int                 cpumR3MsrRegStats(PVM pVM);
 int                 cpumR3MsrStrictInitChecks(void);
diff --git a/src/VBox/VMM/include/CPUMInternal.mac b/src/VBox/VMM/include/CPUMInternal.mac
index d633750..56950ed 100644
--- a/src/VBox/VMM/include/CPUMInternal.mac
+++ b/src/VBox/VMM/include/CPUMInternal.mac
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2012 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -16,6 +16,26 @@
 ;
 
 %include "VBox/asmdefs.mac"
+%include "VBox/vmm/cpum.mac"
+
+;;
+; CPU info
+struc CPUMINFO
+    .cMsrRanges             resd 1                  ; uint32_t
+    .fMsrMask               resd 1                  ; uint32_t
+    .cCpuIdLeaves           resd 1                  ; uint32_t
+    .iFirstExtCpuIdLeaf     resd 1                  ; uint32_t
+    .uPadding               resd 1                  ; uint32_t
+    .enmUnknownCpuIdMethod  resd 1                  ; CPUMUNKNOWNCPUID
+    .DefCpuId               resb CPUMCPUID_size     ; CPUMCPUID
+    .uScalableBusFreq       resq 1                  ; uint64_t
+    .paMsrRangesR0          RTR0PTR_RES 1           ; R0PTRTYPE(PCPUMMSRRANGE)
+    .paCpuIdLeavesR0        RTR0PTR_RES 1           ; R0PTRTYPE(PCPUMCPUIDLEAF)
+    .paMsrRangesR3          RTR3PTR_RES 1           ; R3PTRTYPE(PCPUMMSRRANGE)
+    .paCpuIdLeavesR3        RTR3PTR_RES 1           ; R3PTRTYPE(PCPUMCPUIDLEAF)
+    .paMsrRangesRC          RTRCPTR_RES 1           ; RCPTRTYPE(PCPUMMSRRANGE)
+    .paCpuIdLeavesRC        RTRCPTR_RES 1           ; RCPTRTYPE(PCPUMCPUIDLEAF)
+endstruc
 
 
 %define CPUM_USED_FPU                   RT_BIT(0)
@@ -44,7 +64,6 @@
 
 %define VMMGCRET_USED_FPU               040000000h
 
-%define FPUSTATE_SIZE                   512
 
 ;; if anyone figures how to do %if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL) in
 ; nasm please tell / fix this hack.
@@ -56,279 +75,46 @@
 
 struc CPUM
     ;...
-    .offCPUMCPU0          resd    1
-    .fHostUseFlags        resd    1
-
-    ; CPUID eax=1
-    .CPUFeatures.edx      resd    1
-    .CPUFeatures.ecx      resd    1
-
-    ; CPUID eax=0x80000001
-    .CPUFeaturesExt.edx   resd    1
-    .CPUFeaturesExt.ecx   resd    1
+    .offCPUMCPU0                resd    1
+    .fHostUseFlags              resd    1
 
     ; CR4 masks
-    .CR4.AndMask          resd    1
-    .CR4.OrMask           resd    1
+    .CR4.AndMask                resd    1
+    .CR4.OrMask                 resd    1
     ; entered rawmode?
-    .u8PortableCpuIdLevel resb    1
-    .fPendingRestore      resb    1
-%if RTHCPTR_CB == 8
-    .abPadding            resb    6
-%else
-    .abPadding            resb    2
-%endif
+    .u8PortableCpuIdLevel       resb    1
+    .fPendingRestore            resb    1
 
-    ; CPUID leafs
-    .aGuestCpuIdStd       resb    16*6
-    .aGuestCpuIdExt       resb    16*10
-    .aGuestCpuIdCentaur   resb    16*4
-    .aGuestCpuIdHyper     resb    16*4
-    .GuestCpuIdDef        resb    16
+    alignb 8
+    .fXStateGuestMask           resq    1
+    .fXStateHostMask            resq    1
 
-%if HC_ARCH_BITS == 32
-    .abPadding2           resb    4
-%endif
-
-    .GuestInfo            resb    RTHCPTR_CB*4 + RTRCPTR_CB*2 + 4*12
-    .GuestFeatures        resb    32
-    .HostFeatures         resb    32
-
-    .cMsrWrites                 resq  1
-    .cMsrWritesToIgnoredBits    resq  1
-    .cMsrWritesRaiseGp          resq  1
-    .cMsrWritesUnknown          resq  1
-    .cMsrReads                  resq  1
-    .cMsrReadsRaiseGp           resq  1
-    .cMsrReadsUnknown           resq  1
+    alignb 64
+    .HostFeatures               resb    32
+    .GuestFeatures              resb    32
+    .GuestInfo                  resb    RTHCPTR_CB*4 + RTRCPTR_CB*2 + 4*12
+
+    ; Patch manager saved state compatability CPUID leaf arrays
+    .aGuestCpuIdPatmStd         resb    16*6
+    .aGuestCpuIdPatmExt         resb    16*10
+    .aGuestCpuIdPatmCentaur     resb    16*4
+
+    alignb 8
+    .cMsrWrites                 resq    1
+    .cMsrWritesToIgnoredBits    resq    1
+    .cMsrWritesRaiseGp          resq    1
+    .cMsrWritesUnknown          resq    1
+    .cMsrReads                  resq    1
+    .cMsrReadsRaiseGp           resq    1
+    .cMsrReadsUnknown           resq    1
 endstruc
 
 struc CPUMCPU
     ;
-    ; Hypervisor Context.
-    ;
-    .Hyper.fpu                resb    512
-    .Hyper.eax                resq    1
-    .Hyper.ecx                resq    1
-    .Hyper.edx                resq    1
-    .Hyper.ebx                resq    1
-    .Hyper.esp                resq    1
-    .Hyper.ebp                resq    1
-    .Hyper.esi                resq    1
-    .Hyper.edi                resq    1
-    .Hyper.r8                 resq    1
-    .Hyper.r9                 resq    1
-    .Hyper.r10                resq    1
-    .Hyper.r11                resq    1
-    .Hyper.r12                resq    1
-    .Hyper.r13                resq    1
-    .Hyper.r14                resq    1
-    .Hyper.r15                resq    1
-    .Hyper.es.Sel             resw    1
-    .Hyper.es.PaddingSel      resw    1
-    .Hyper.es.ValidSel        resw    1
-    .Hyper.es.fFlags          resw    1
-    .Hyper.es.u64Base         resq    1
-    .Hyper.es.u32Limit        resd    1
-    .Hyper.es.Attr            resd    1
-    .Hyper.cs.Sel             resw    1
-    .Hyper.cs.PaddingSel      resw    1
-    .Hyper.cs.ValidSel        resw    1
-    .Hyper.cs.fFlags          resw    1
-    .Hyper.cs.u64Base         resq    1
-    .Hyper.cs.u32Limit        resd    1
-    .Hyper.cs.Attr            resd    1
-    .Hyper.ss.Sel             resw    1
-    .Hyper.ss.PaddingSel      resw    1
-    .Hyper.ss.ValidSel        resw    1
-    .Hyper.ss.fFlags          resw    1
-    .Hyper.ss.u64Base         resq    1
-    .Hyper.ss.u32Limit        resd    1
-    .Hyper.ss.Attr            resd    1
-    .Hyper.ds.Sel             resw    1
-    .Hyper.ds.PaddingSel      resw    1
-    .Hyper.ds.ValidSel        resw    1
-    .Hyper.ds.fFlags          resw    1
-    .Hyper.ds.u64Base         resq    1
-    .Hyper.ds.u32Limit        resd    1
-    .Hyper.ds.Attr            resd    1
-    .Hyper.fs.Sel             resw    1
-    .Hyper.fs.PaddingSel      resw    1
-    .Hyper.fs.ValidSel        resw    1
-    .Hyper.fs.fFlags          resw    1
-    .Hyper.fs.u64Base         resq    1
-    .Hyper.fs.u32Limit        resd    1
-    .Hyper.fs.Attr            resd    1
-    .Hyper.gs.Sel             resw    1
-    .Hyper.gs.PaddingSel      resw    1
-    .Hyper.gs.ValidSel        resw    1
-    .Hyper.gs.fFlags          resw    1
-    .Hyper.gs.u64Base         resq    1
-    .Hyper.gs.u32Limit        resd    1
-    .Hyper.gs.Attr            resd    1
-    .Hyper.eip                resq    1
-    .Hyper.eflags             resq    1
-    .Hyper.cr0                resq    1
-    .Hyper.cr2                resq    1
-    .Hyper.cr3                resq    1
-    .Hyper.cr4                resq    1
-    .Hyper.dr                 resq    8
-    .Hyper.gdtrPadding        resw    3
-    .Hyper.gdtr               resw    0
-    .Hyper.gdtr.cbGdt         resw    1
-    .Hyper.gdtr.pGdt          resq    1
-    .Hyper.idtrPadding        resw    3
-    .Hyper.idtr               resw    0
-    .Hyper.idtr.cbIdt         resw    1
-    .Hyper.idtr.pIdt          resq    1
-    .Hyper.ldtr.Sel           resw    1
-    .Hyper.ldtr.PaddingSel    resw    1
-    .Hyper.ldtr.ValidSel      resw    1
-    .Hyper.ldtr.fFlags        resw    1
-    .Hyper.ldtr.u64Base       resq    1
-    .Hyper.ldtr.u32Limit      resd    1
-    .Hyper.ldtr.Attr          resd    1
-    .Hyper.tr.Sel             resw    1
-    .Hyper.tr.PaddingSel      resw    1
-    .Hyper.tr.ValidSel        resw    1
-    .Hyper.tr.fFlags          resw    1
-    .Hyper.tr.u64Base         resq    1
-    .Hyper.tr.u32Limit        resd    1
-    .Hyper.tr.Attr            resd    1
-    .Hyper.SysEnter.cs        resb    8
-    .Hyper.SysEnter.eip       resb    8
-    .Hyper.SysEnter.esp       resb    8
-    .Hyper.msrEFER            resb    8
-    .Hyper.msrSTAR            resb    8
-    .Hyper.msrPAT             resb    8
-    .Hyper.msrLSTAR           resb    8
-    .Hyper.msrCSTAR           resb    8
-    .Hyper.msrSFMASK          resb    8
-    .Hyper.msrKERNELGSBASE    resb    8
-    .Hyper.msrApicBase        resb    8
-
-    ;
-    ; Host context state
-    ;
-    alignb 64
-    .Host.fpu            resb    FPUSTATE_SIZE
-
-%if HC_ARCH_BITS == 64 || fVBOX_WITH_HYBRID_32BIT_KERNEL
-    ;.Host.rax            resq    1 - scratch
-    .Host.rbx            resq    1
-    ;.Host.rcx            resq    1 - scratch
-    ;.Host.rdx            resq    1 - scratch
-    .Host.rdi            resq    1
-    .Host.rsi            resq    1
-    .Host.rbp            resq    1
-    .Host.rsp            resq    1
-    ;.Host.r8             resq    1 - scratch
-    ;.Host.r9             resq    1 - scratch
-    .Host.r10            resq    1
-    .Host.r11            resq    1
-    .Host.r12            resq    1
-    .Host.r13            resq    1
-    .Host.r14            resq    1
-    .Host.r15            resq    1
-    ;.Host.rip            resd    1 - scratch
-    .Host.rflags         resq    1
-%endif
-%if HC_ARCH_BITS == 32
-    ;.Host.eax            resd    1 - scratch
-    .Host.ebx            resd    1
-    ;.Host.edx            resd    1 - scratch
-    ;.Host.ecx            resd    1 - scratch
-    .Host.edi            resd    1
-    .Host.esi            resd    1
-    .Host.ebp            resd    1
-    .Host.eflags         resd    1
-    ;.Host.eip            resd    1 - scratch
-    ; lss pair!
-    .Host.esp            resd    1
-%endif
-    .Host.ss             resw    1
-    .Host.ssPadding      resw    1
-    .Host.gs             resw    1
-    .Host.gsPadding      resw    1
-    .Host.fs             resw    1
-    .Host.fsPadding      resw    1
-    .Host.es             resw    1
-    .Host.esPadding      resw    1
-    .Host.ds             resw    1
-    .Host.dsPadding      resw    1
-    .Host.cs             resw    1
-    .Host.csPadding      resw    1
-
-%if HC_ARCH_BITS == 32 && fVBOX_WITH_HYBRID_32BIT_KERNEL == 0
-    .Host.cr0            resd    1
-    ;.Host.cr2            resd    1 - scratch
-    .Host.cr3            resd    1
-    .Host.cr4            resd    1
-
-    .Host.dr0            resd    1
-    .Host.dr1            resd    1
-    .Host.dr2            resd    1
-    .Host.dr3            resd    1
-    .Host.dr6            resd    1
-    .Host.dr7            resd    1
-
-    .Host.gdtr           resb    6           ; GDT limit + linear address
-    .Host.gdtrPadding    resw    1
-    .Host.idtr           resb    6           ; IDT limit + linear address
-    .Host.idtrPadding    resw    1
-    .Host.ldtr           resw    1
-    .Host.ldtrPadding    resw    1
-    .Host.tr             resw    1
-    .Host.trPadding      resw    1
-
-    .Host.SysEnterPadding resd   1
-    .Host.SysEnter.cs    resq    1
-    .Host.SysEnter.eip   resq    1
-    .Host.SysEnter.esp   resq    1
-    .Host.efer           resq    1
-
-%else ; 64-bit
-
-    .Host.cr0            resq    1
-    ;.Host.cr2            resq    1 - scratch
-    .Host.cr3            resq    1
-    .Host.cr4            resq    1
-    .Host.cr8            resq    1
-
-    .Host.dr0            resq    1
-    .Host.dr1            resq    1
-    .Host.dr2            resq    1
-    .Host.dr3            resq    1
-    .Host.dr6            resq    1
-    .Host.dr7            resq    1
-
-    .Host.gdtr           resb    10         ; GDT limit + linear address
-    .Host.gdtrPadding    resw    1
-    .Host.idtr           resb    10         ; IDT limit + linear address
-    .Host.idtrPadding    resw    1
-    .Host.ldtr           resw    1
-    .Host.ldtrPadding    resw    1
-    .Host.tr             resw    1
-    .Host.trPadding      resw    1
-
-    .Host.SysEnter.cs    resq    1
-    .Host.SysEnter.eip   resq    1
-    .Host.SysEnter.esp   resq    1
-    .Host.FSbase         resq    1
-    .Host.GSbase         resq    1
-    .Host.efer           resq    1
-%endif ; 64-bit
-
-%ifdef VBOX_WITH_CRASHDUMP_MAGIC
-    .aMagic              resb    56
-    .uMagic              resq    1
-%endif
-    ;
     ; Guest context state
-    ; (Identical to the .Hyper chunk above.)
+    ; (Identical to the .Hyper chunk below.)
     ;
-    alignb 64
-    .Guest.fpu                resb    512
+    .Guest                    resq    0
     .Guest.eax                resq    1
     .Guest.ecx                resq    1
     .Guest.edx                resq    1
@@ -427,9 +213,15 @@ struc CPUMCPU
     .Guest.msrSFMASK          resb    8
     .Guest.msrKERNELGSBASE    resb    8
     .Guest.msrApicBase        resb    8
-
+    .Guest.aXcr               resq    2
+    .Guest.fXStateMask        resq    1
+    .Guest.pXStateR0      RTR0PTR_RES 1
+    .Guest.pXStateR3      RTR3PTR_RES 1
+    .Guest.pXStateRC      RTRCPTR_RES 1
+    .Guest.aoffXState         resw    64
 
     alignb 64
+    .GuestMsrs                resq    0
     .GuestMsrs.au64           resq    64
 
     ;
@@ -452,6 +244,246 @@ struc CPUMCPU
     .fRemEntered          resb    1
 
     .abPadding2           resb    (64 - 16 - RTR0PTR_CB - 4 - 1 - 2)
+
+    ;
+    ; Host context state
+    ;
+    alignb 64
+    .Host                resb    0
+%if HC_ARCH_BITS == 64 || fVBOX_WITH_HYBRID_32BIT_KERNEL
+    ;.Host.rax            resq    1 - scratch
+    .Host.rbx            resq    1
+    ;.Host.rcx            resq    1 - scratch
+    ;.Host.rdx            resq    1 - scratch
+    .Host.rdi            resq    1
+    .Host.rsi            resq    1
+    .Host.rbp            resq    1
+    .Host.rsp            resq    1
+    ;.Host.r8             resq    1 - scratch
+    ;.Host.r9             resq    1 - scratch
+    .Host.r10            resq    1
+    .Host.r11            resq    1
+    .Host.r12            resq    1
+    .Host.r13            resq    1
+    .Host.r14            resq    1
+    .Host.r15            resq    1
+    ;.Host.rip            resd    1 - scratch
+    .Host.rflags         resq    1
+%endif
+%if HC_ARCH_BITS == 32
+    ;.Host.eax            resd    1 - scratch
+    .Host.ebx            resd    1
+    ;.Host.edx            resd    1 - scratch
+    ;.Host.ecx            resd    1 - scratch
+    .Host.edi            resd    1
+    .Host.esi            resd    1
+    .Host.ebp            resd    1
+    .Host.eflags         resd    1
+    ;.Host.eip            resd    1 - scratch
+    ; lss pair!
+    .Host.esp            resd    1
+%endif
+    .Host.ss             resw    1
+    .Host.ssPadding      resw    1
+    .Host.gs             resw    1
+    .Host.gsPadding      resw    1
+    .Host.fs             resw    1
+    .Host.fsPadding      resw    1
+    .Host.es             resw    1
+    .Host.esPadding      resw    1
+    .Host.ds             resw    1
+    .Host.dsPadding      resw    1
+    .Host.cs             resw    1
+    .Host.csPadding      resw    1
+
+%if HC_ARCH_BITS == 32 && fVBOX_WITH_HYBRID_32BIT_KERNEL == 0
+    .Host.cr0            resd    1
+    ;.Host.cr2            resd    1 - scratch
+    .Host.cr3            resd    1
+    .Host.cr4            resd    1
+
+    .Host.dr0            resd    1
+    .Host.dr1            resd    1
+    .Host.dr2            resd    1
+    .Host.dr3            resd    1
+    .Host.dr6            resd    1
+    .Host.dr7            resd    1
+
+    .Host.gdtr           resb    6           ; GDT limit + linear address
+    .Host.gdtrPadding    resw    1
+    .Host.idtr           resb    6           ; IDT limit + linear address
+    .Host.idtrPadding    resw    1
+    .Host.ldtr           resw    1
+    .Host.ldtrPadding    resw    1
+    .Host.tr             resw    1
+    .Host.trPadding      resw    1
+
+    .Host.SysEnterPadding resd   1
+    .Host.SysEnter.cs    resq    1
+    .Host.SysEnter.eip   resq    1
+    .Host.SysEnter.esp   resq    1
+    .Host.efer           resq    1
+    .Host.auPadding      resb    (20)
+
+%else ; 64-bit
+
+    .Host.cr0            resq    1
+    ;.Host.cr2            resq    1 - scratch
+    .Host.cr3            resq    1
+    .Host.cr4            resq    1
+    .Host.cr8            resq    1
+
+    .Host.dr0            resq    1
+    .Host.dr1            resq    1
+    .Host.dr2            resq    1
+    .Host.dr3            resq    1
+    .Host.dr6            resq    1
+    .Host.dr7            resq    1
+
+    .Host.gdtr           resb    10         ; GDT limit + linear address
+    .Host.gdtrPadding    resw    1
+    .Host.idtr           resb    10         ; IDT limit + linear address
+    .Host.idtrPadding    resw    1
+    .Host.ldtr           resw    1
+    .Host.ldtrPadding    resw    1
+    .Host.tr             resw    1
+    .Host.trPadding      resw    1
+
+    .Host.SysEnter.cs    resq    1
+    .Host.SysEnter.eip   resq    1
+    .Host.SysEnter.esp   resq    1
+    .Host.FSbase         resq    1
+    .Host.GSbase         resq    1
+    .Host.efer           resq    1
+ %if fVBOX_WITH_HYBRID_32BIT_KERNEL
+    .Host.auPadding      resb    54
+ %else
+    .Host.auPadding      resb    4
+ %endif
+%endif ; 64-bit
+    .Host.pXStateRC RTRCPTR_RES  1
+    alignb RTR0PTR_CB
+    .Host.pXStateR0 RTR0PTR_RES  1
+    .Host.pXStateR3 RTR3PTR_RES  1
+    alignb 8
+    .Host.xcr0           resq    1
+    .Host.fXStateMask    resq    1
+
+    ;
+    ; Hypervisor Context (same as .Guest above).
+    ;
+    alignb 64
+    .Hyper                    resq    0
+    .Hyper.eax                resq    1
+    .Hyper.ecx                resq    1
+    .Hyper.edx                resq    1
+    .Hyper.ebx                resq    1
+    .Hyper.esp                resq    1
+    .Hyper.ebp                resq    1
+    .Hyper.esi                resq    1
+    .Hyper.edi                resq    1
+    .Hyper.r8                 resq    1
+    .Hyper.r9                 resq    1
+    .Hyper.r10                resq    1
+    .Hyper.r11                resq    1
+    .Hyper.r12                resq    1
+    .Hyper.r13                resq    1
+    .Hyper.r14                resq    1
+    .Hyper.r15                resq    1
+    .Hyper.es.Sel             resw    1
+    .Hyper.es.PaddingSel      resw    1
+    .Hyper.es.ValidSel        resw    1
+    .Hyper.es.fFlags          resw    1
+    .Hyper.es.u64Base         resq    1
+    .Hyper.es.u32Limit        resd    1
+    .Hyper.es.Attr            resd    1
+    .Hyper.cs.Sel             resw    1
+    .Hyper.cs.PaddingSel      resw    1
+    .Hyper.cs.ValidSel        resw    1
+    .Hyper.cs.fFlags          resw    1
+    .Hyper.cs.u64Base         resq    1
+    .Hyper.cs.u32Limit        resd    1
+    .Hyper.cs.Attr            resd    1
+    .Hyper.ss.Sel             resw    1
+    .Hyper.ss.PaddingSel      resw    1
+    .Hyper.ss.ValidSel        resw    1
+    .Hyper.ss.fFlags          resw    1
+    .Hyper.ss.u64Base         resq    1
+    .Hyper.ss.u32Limit        resd    1
+    .Hyper.ss.Attr            resd    1
+    .Hyper.ds.Sel             resw    1
+    .Hyper.ds.PaddingSel      resw    1
+    .Hyper.ds.ValidSel        resw    1
+    .Hyper.ds.fFlags          resw    1
+    .Hyper.ds.u64Base         resq    1
+    .Hyper.ds.u32Limit        resd    1
+    .Hyper.ds.Attr            resd    1
+    .Hyper.fs.Sel             resw    1
+    .Hyper.fs.PaddingSel      resw    1
+    .Hyper.fs.ValidSel        resw    1
+    .Hyper.fs.fFlags          resw    1
+    .Hyper.fs.u64Base         resq    1
+    .Hyper.fs.u32Limit        resd    1
+    .Hyper.fs.Attr            resd    1
+    .Hyper.gs.Sel             resw    1
+    .Hyper.gs.PaddingSel      resw    1
+    .Hyper.gs.ValidSel        resw    1
+    .Hyper.gs.fFlags          resw    1
+    .Hyper.gs.u64Base         resq    1
+    .Hyper.gs.u32Limit        resd    1
+    .Hyper.gs.Attr            resd    1
+    .Hyper.eip                resq    1
+    .Hyper.eflags             resq    1
+    .Hyper.cr0                resq    1
+    .Hyper.cr2                resq    1
+    .Hyper.cr3                resq    1
+    .Hyper.cr4                resq    1
+    .Hyper.dr                 resq    8
+    .Hyper.gdtrPadding        resw    3
+    .Hyper.gdtr               resw    0
+    .Hyper.gdtr.cbGdt         resw    1
+    .Hyper.gdtr.pGdt          resq    1
+    .Hyper.idtrPadding        resw    3
+    .Hyper.idtr               resw    0
+    .Hyper.idtr.cbIdt         resw    1
+    .Hyper.idtr.pIdt          resq    1
+    .Hyper.ldtr.Sel           resw    1
+    .Hyper.ldtr.PaddingSel    resw    1
+    .Hyper.ldtr.ValidSel      resw    1
+    .Hyper.ldtr.fFlags        resw    1
+    .Hyper.ldtr.u64Base       resq    1
+    .Hyper.ldtr.u32Limit      resd    1
+    .Hyper.ldtr.Attr          resd    1
+    .Hyper.tr.Sel             resw    1
+    .Hyper.tr.PaddingSel      resw    1
+    .Hyper.tr.ValidSel        resw    1
+    .Hyper.tr.fFlags          resw    1
+    .Hyper.tr.u64Base         resq    1
+    .Hyper.tr.u32Limit        resd    1
+    .Hyper.tr.Attr            resd    1
+    .Hyper.SysEnter.cs        resb    8
+    .Hyper.SysEnter.eip       resb    8
+    .Hyper.SysEnter.esp       resb    8
+    .Hyper.msrEFER            resb    8
+    .Hyper.msrSTAR            resb    8
+    .Hyper.msrPAT             resb    8
+    .Hyper.msrLSTAR           resb    8
+    .Hyper.msrCSTAR           resb    8
+    .Hyper.msrSFMASK          resb    8
+    .Hyper.msrKERNELGSBASE    resb    8
+    .Hyper.msrApicBase        resb    8
+    .Hyper.aXcr               resq    2
+    .Hyper.fXStateMask        resq    1
+    .Hyper.pXStateR0      RTR0PTR_RES 1
+    .Hyper.pXStateR3      RTR3PTR_RES 1
+    .Hyper.pXStateRC      RTRCPTR_RES 1
+    .Hyper.aoffXState         resw    64
+    alignb 64
+
+%ifdef VBOX_WITH_CRASHDUMP_MAGIC
+    .aMagic              resb    56
+    .uMagic              resq    1
+%endif
 endstruc
 
 
diff --git a/src/VBox/VMM/include/CSAMInternal.h b/src/VBox/VMM/include/CSAMInternal.h
index 7e6f4fb..f4d5371 100644
--- a/src/VBox/VMM/include/CSAMInternal.h
+++ b/src/VBox/VMM/include/CSAMInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -38,7 +38,7 @@
 
 /** @} */
 
-#define CSAM_SSM_VERSION                        14
+#define CSAM_SAVED_STATE_VERSION                14
 
 #define CSAM_PGDIRBMP_CHUNKS                    1024
 
@@ -155,8 +155,8 @@ typedef struct CSAM
     uint32_t            iDangerousInstr;
 
     RCPTRTYPE(RTRCPTR *)  pPDBitmapGC;
-    RCPTRTYPE(RTHCPTR *)    pPDHCBitmapGC;
-    R3PTRTYPE(uint8_t **)   pPDBitmapHC;
+    RCPTRTYPE(RTHCPTR *)  pPDHCBitmapGC;
+    R3PTRTYPE(uint8_t **) pPDBitmapHC;
     R3PTRTYPE(RTRCPTR  *) pPDGCBitmapHC;
 
     /* Temporary storage during load/save state */
@@ -174,11 +174,16 @@ typedef struct CSAM
 
     /* To keep track of possible code pages */
     uint32_t            cPossibleCodePages;
-    RTRCPTR           pvPossibleCodePage[CSAM_MAX_CODE_PAGES_FLUSH];
+    RTRCPTR             pvPossibleCodePage[CSAM_MAX_CODE_PAGES_FLUSH];
 
     /* call addresses reported by the recompiler */
-    RTRCPTR           pvCallInstruction[16];
-    RTUINT              iCallInstruction;
+    RTRCPTR             pvCallInstruction[16];
+    uint32_t            iCallInstruction;
+
+    /** Code page write access handler type. */
+    PGMVIRTHANDLERTYPE  hCodePageWriteType;
+    /** Code page write & invalidation access handler type. */
+    PGMVIRTHANDLERTYPE  hCodePageWriteAndInvPgType;
 
     /* Set when scanning has started. */
     bool                fScanningStarted;
@@ -277,7 +282,7 @@ inline RTRCPTR CSAMResolveBranch(PDISCPUSTATE pCpu, RTRCPTR pBranchInstrGC)
 }
 
 RT_C_DECLS_BEGIN
-VMMRCDECL(int) CSAMGCCodePageWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) csamRCCodePageWritePfHandler;
 RT_C_DECLS_END
 
 #endif
diff --git a/src/VBox/VMM/include/DBGFInternal.h b/src/VBox/VMM/include/DBGFInternal.h
index 8e01d2d..b530170 100644
--- a/src/VBox/VMM/include/DBGFInternal.h
+++ b/src/VBox/VMM/include/DBGFInternal.h
@@ -170,11 +170,13 @@ typedef struct DBGFINFO
 typedef struct DBGFOS
 {
     /** Pointer to the registration record. */
-    PCDBGFOSREG pReg;
+    PCDBGFOSREG                 pReg;
     /** Pointer to the next OS we've registered. */
-    struct DBGFOS *pNext;
+    struct DBGFOS              *pNext;
+    /** List of EMT interface wrappers. */
+    struct DBGFOSEMTWRAPPER    *pWrapperHead;
     /** The instance data (variable size). */
-    uint8_t abData[16];
+    uint8_t                     abData[16];
 } DBGFOS;
 /** Pointer to guest OS digger instance. */
 typedef DBGFOS *PDBGFOS;
@@ -182,6 +184,7 @@ typedef DBGFOS *PDBGFOS;
 typedef DBGFOS const *PCDBGFOS;
 
 
+
 /**
  * Converts a DBGF pointer into a VM pointer.
  * @returns Pointer to the VM structure the CPUM is part of.
@@ -276,6 +279,7 @@ typedef struct DBGFCPU
 /** Pointer to DBGFCPU data. */
 typedef DBGFCPU *PDBGFCPU;
 
+struct DBGFOSEMTWRAPPER;
 
 /**
  * The DBGF data kept in the UVM.
@@ -313,17 +317,22 @@ typedef struct DBGFUSERPERVM
     /** Alignment padding. */
     bool                        afAlignment2[3];
 
+    /** Critical section protecting the Guest OS Digger data, the info handlers
+     * and the plugins.  These share to give the best possible plugin unload
+     * race protection. */
+    RTCRITSECTRW                CritSect;
+    /** Head of the LIFO of loaded DBGF plugins. */
+    R3PTRTYPE(struct DBGFPLUGIN *) pPlugInHead;
     /** The current Guest OS digger. */
     R3PTRTYPE(PDBGFOS)          pCurOS;
     /** The head of the Guest OS digger instances. */
     R3PTRTYPE(PDBGFOS)          pOSHead;
-
     /** List of registered info handlers. */
     R3PTRTYPE(PDBGFINFO)        pInfoFirst;
-    /** Critical section protecting the above list. */
-    RTCRITSECT                  InfoCritSect;
 
 } DBGFUSERPERVM;
+typedef DBGFUSERPERVM *PDBGFUSERPERVM;
+typedef DBGFUSERPERVM const *PCDBGFUSERPERVM;
 
 /**
  * The per-CPU DBGF data kept in the UVM.
@@ -343,12 +352,15 @@ void dbgfR3AsRelocate(PUVM pUVM, RTGCUINTPTR offDelta);
 int  dbgfR3BpInit(PVM pVM);
 int  dbgfR3InfoInit(PUVM pUVM);
 int  dbgfR3InfoTerm(PUVM pUVM);
+int  dbgfR3OSInit(PUVM pUVM);
 void dbgfR3OSTerm(PUVM pUVM);
 int  dbgfR3RegInit(PUVM pUVM);
 void dbgfR3RegTerm(PUVM pUVM);
 int  dbgfR3TraceInit(PVM pVM);
 void dbgfR3TraceRelocate(PVM pVM);
 void dbgfR3TraceTerm(PVM pVM);
+int  dbgfR3PlugInInit(PUVM pUVM);
+void dbgfR3PlugInTerm(PUVM pUVM);
 
 
 
diff --git a/src/VBox/VMM/include/EMHandleRCTmpl.h b/src/VBox/VMM/include/EMHandleRCTmpl.h
index ef54f34..fcb8827 100644
--- a/src/VBox/VMM/include/EMHandleRCTmpl.h
+++ b/src/VBox/VMM/include/EMHandleRCTmpl.h
@@ -223,6 +223,14 @@ int emR3HmHandleRC(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, int rc)
             rc = emR3ExecuteInstruction(pVM, pVCpu, "MMIO");
             break;
 
+        /*
+         * Machine specific register access - emulate the instruction.
+         */
+        case VINF_CPUM_R3_MSR_READ:
+        case VINF_CPUM_R3_MSR_WRITE:
+            rc = emR3ExecuteInstruction(pVM, pVCpu, "MSR");
+            break;
+
 #ifdef EMHANDLERC_WITH_HM
         /*
          * (MM)IO intensive code block detected; fall back to the recompiler for better performance
@@ -274,6 +282,19 @@ int emR3HmHandleRC(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, int rc)
             rc = emR3ExecuteInstruction(pVM, pVCpu, "EMUL: ");
             break;
 
+        case VINF_EM_RAW_INJECT_TRPM_EVENT:
+#ifdef VBOX_WITH_FIRST_IEM_STEP
+            rc = VBOXSTRICTRC_VAL(IEMInjectTrpmEvent(pVCpu));
+            /* The following condition should be removed when IEM_IMPLEMENTS_TASKSWITCH becomes true. */
+            if (rc == VERR_IEM_ASPECT_NOT_IMPLEMENTED)
+                rc = emR3ExecuteInstruction(pVM, pVCpu, "EVENT: ");
+#else
+            /* Do the same thing as VINF_EM_RAW_EMULATE_INSTR. */
+            rc = emR3ExecuteInstruction(pVM, pVCpu, "EVENT: ");
+#endif
+            break;
+
+
 #ifdef EMHANDLERC_WITH_PATM
         /*
          * Stale selector and iret traps => REM.
diff --git a/src/VBox/VMM/include/GIMHvInternal.h b/src/VBox/VMM/include/GIMHvInternal.h
new file mode 100644
index 0000000..48980b9
--- /dev/null
+++ b/src/VBox/VMM/include/GIMHvInternal.h
@@ -0,0 +1,534 @@
+/* $Id: GIMHvInternal.h $ */
+/** @file
+ * GIM - Hyper-V, Internal header file.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___GIMHvInternal_h
+#define ___GIMHvInternal_h
+
+#include <VBox/vmm/gim.h>
+#include <VBox/vmm/cpum.h>
+
+
+/** @name Hyper-V base feature identification.
+ * Features based on current partition privileges (per-VM).
+ * @{
+ */
+/** Virtual processor runtime MSR available. */
+#define GIM_HV_BASE_FEAT_VP_RUNTIME_MSR           RT_BIT(0)
+/** Partition reference counter MSR available. */
+#define GIM_HV_BASE_FEAT_PART_TIME_REF_COUNT_MSR  RT_BIT(1)
+/** Basic Synthetic Interrupt Controller MSRs available. */
+#define GIM_HV_BASE_FEAT_BASIC_SYNTH_IC           RT_BIT(2)
+/** Synthetic Timer MSRs available. */
+#define GIM_HV_BASE_FEAT_SYNTH_TIMER_MSRS         RT_BIT(3)
+/** APIC access MSRs (EOI, ICR, TPR) available. */
+#define GIM_HV_BASE_FEAT_APIC_ACCESS_MSRS         RT_BIT(4)
+/** Hypercall MSRs available. */
+#define GIM_HV_BASE_FEAT_HYPERCALL_MSRS           RT_BIT(5)
+/** Access to VCPU index MSR available. */
+#define GIM_HV_BASE_FEAT_VP_ID_MSR                RT_BIT(6)
+/** Virtual system reset MSR available. */
+#define GIM_HV_BASE_FEAT_VIRT_SYS_RESET_MSR       RT_BIT(7)
+/** Statistic pages MSRs available. */
+#define GIM_HV_BASE_FEAT_STAT_PAGES_MSR           RT_BIT(8)
+/** Paritition reference TSC MSR available. */
+#define GIM_HV_BASE_FEAT_PART_REF_TSC_MSR         RT_BIT(9)
+/** Virtual guest idle state MSR available. */
+#define GIM_HV_BASE_FEAT_GUEST_IDLE_STATE_MSR     RT_BIT(10)
+/** Timer frequency MSRs (TSC and APIC) available. */
+#define GIM_HV_BASE_FEAT_TIMER_FREQ_MSRS          RT_BIT(11)
+/** Debug MSRs available. */
+#define GIM_HV_BASE_FEAT_DEBUG_MSRS               RT_BIT(12)
+/** @}  */
+
+/** @name Hyper-V partition-creation feature identification.
+ * Indicates flags specified during partition creation.
+ * @{
+ */
+/** Create partitions. */
+#define GIM_HV_PART_FLAGS_CREATE_PART             RT_BIT(0)
+/** Access partition Id. */
+#define GIM_HV_PART_FLAGS_ACCESS_PART_ID          RT_BIT(1)
+/** Access memory pool. */
+#define GIM_HV_PART_FLAGS_ACCESS_MEMORY_POOL      RT_BIT(2)
+/** Adjust message buffers. */
+#define GIM_HV_PART_FLAGS_ADJUST_MSG_BUFFERS      RT_BIT(3)
+/** Post messages. */
+#define GIM_HV_PART_FLAGS_POST_MSGS               RT_BIT(4)
+/** Signal events. */
+#define GIM_HV_PART_FLAGS_SIGNAL_EVENTS           RT_BIT(5)
+/** Create port. */
+#define GIM_HV_PART_FLAGS_CREATE_PORT             RT_BIT(6)
+/** Connect port. */
+#define GIM_HV_PART_FLAGS_CONNECT_PORT            RT_BIT(7)
+/** Access statistics. */
+#define GIM_HV_PART_FLAGS_ACCESS_STATS            RT_BIT(8)
+/** Debugging.*/
+#define GIM_HV_PART_FLAGS_DEBUGGING               RT_BIT(11)
+/** CPU management. */
+#define GIM_HV_PART_FLAGS_CPU_MGMT                RT_BIT(12)
+/** CPU profiler. */
+#define GIM_HV_PART_FLAGS_CPU_PROFILER            RT_BIT(13)
+/** Enable expanded stack walking. */
+#define GIM_HV_PART_FLAGS_EXPANDED_STACK_WALK     RT_BIT(14)
+/** @}  */
+
+/** @name Hyper-V power management feature identification.
+ * @{
+ */
+/** Maximum CPU power state C0. */
+#define GIM_HV_PM_MAX_CPU_POWER_STATE_C0          RT_BIT(0)
+/** Maximum CPU power state C1. */
+#define GIM_HV_PM_MAX_CPU_POWER_STATE_C1          RT_BIT(1)
+/** Maximum CPU power state C2. */
+#define GIM_HV_PM_MAX_CPU_POWER_STATE_C2          RT_BIT(2)
+/** Maximum CPU power state C3. */
+#define GIM_HV_PM_MAX_CPU_POWER_STATE_C3          RT_BIT(3)
+/** HPET is required to enter C3 power state. */
+#define GIM_HV_PM_HPET_REQD_FOR_C3                RT_BIT(4)
+/** @}  */
+
+/** @name Hyper-V miscellaneous feature identification.
+ * Miscellaneous features available for the current partition.
+ * @{
+ */
+/** MWAIT instruction available. */
+#define GIM_HV_MISC_FEAT_MWAIT                    RT_BIT(0)
+/** Guest debugging support available. */
+#define GIM_HV_MISC_FEAT_GUEST_DEBUGGING          RT_BIT(1)
+/** Performance monitor support is available. */
+#define GIM_HV_MISC_FEAT_PERF_MON                 RT_BIT(2)
+/** Support for physical CPU dynamic partitioning events. */
+#define GIM_HV_MISC_FEAT_PCPU_DYN_PART_EVENT      RT_BIT(3)
+/** Support for passing hypercall input parameter block via XMM registers. */
+#define GIM_HV_MISC_FEAT_XMM_HYPERCALL_INPUT      RT_BIT(4)
+/** Support for virtual guest idle state. */
+#define GIM_HV_MISC_FEAT_GUEST_IDLE_STATE         RT_BIT(5)
+/** Support for hypervisor sleep state. */
+#define GIM_HV_MISC_FEAT_HYPERVISOR_SLEEP_STATE   RT_BIT(6)
+/** Support for querying NUMA distances. */
+#define GIM_HV_MISC_FEAT_QUERY_NUMA_DISTANCE      RT_BIT(7)
+/** Support for determining timer frequencies. */
+#define GIM_HV_MISC_FEAT_TIMER_FREQ               RT_BIT(8)
+/** Support for injecting synthetic machine checks. */
+#define GIM_HV_MISC_FEAT_INJECT_SYNTH_MC_XCPT     RT_BIT(9)
+/** Support for guest crash MSRs. */
+#define GIM_HV_MISC_FEAT_GUEST_CRASH_MSRS         RT_BIT(10)
+/** Support for debug MSRs. */
+#define GIM_HV_MISC_FEAT_DEBUG_MSRS               RT_BIT(11)
+/** Npiep1 Available */ /** @todo What the heck is this? */
+#define GIM_HV_MISC_FEAT_NPIEP1                   RT_BIT(12)
+/** Disable hypervisor available. */
+#define GIM_HV_MISC_FEAT_DISABLE_HYPERVISOR       RT_BIT(13)
+/** @}  */
+
+/** @name Hyper-V implementation recommendations.
+ * Recommendations from the hypervisor for the guest for optimal performance.
+ * @{
+ */
+/** Use hypercall for address space switches rather than MOV CR3. */
+#define GIM_HV_HINT_HYPERCALL_FOR_PROCESS_SWITCH  RT_BIT(0)
+/** Use hypercall for local TLB flushes rather than INVLPG/MOV CR3. */
+#define GIM_HV_HINT_HYPERCALL_FOR_TLB_FLUSH       RT_BIT(1)
+/** Use hypercall for inter-CPU TLB flushes rather than IPIs. */
+#define GIM_HV_HINT_HYPERCALL_FOR_TLB_SHOOTDOWN   RT_BIT(2)
+/** Use MSRs for APIC access (EOI, ICR, TPR) rather than MMIO. */
+#define GIM_HV_HINT_MSR_FOR_APIC_ACCESS           RT_BIT(3)
+/** Use hypervisor provided MSR for a system reset. */
+#define GIM_HV_HINT_MSR_FOR_SYS_RESET             RT_BIT(4)
+/** Relax timer-related checks (watchdogs/deadman timeouts) that rely on
+ *  timely deliver of external interrupts. */
+#define GIM_HV_HINT_RELAX_TIME_CHECKS             RT_BIT(5)
+/** Use DMA remapping. */
+#define GIM_HV_HINT_DMA_REMAPPING                 RT_BIT(6)
+/** Use interrupt remapping. */
+#define GIM_HV_HINT_INTERRUPT_REMAPPING           RT_BIT(7)
+/** Use X2APIC MSRs rather than MMIO. */
+#define GIM_HV_HINT_X2APIC_MSRS                   RT_BIT(8)
+/** Deprecate Auto EOI (end of interrupt). */
+#define GIM_HV_HINT_DEPRECATE_AUTO_EOI            RT_BIT(9)
+/** @}  */
+
+
+/** @name Hyper-V implementation hardware features.
+ * Which hardware features are in use by the hypervisor.
+ * @{
+ */
+/** APIC overlay is used. */
+#define GIM_HV_HOST_FEAT_AVIC                     RT_BIT(0)
+/** MSR bitmaps is used. */
+#define GIM_HV_HOST_FEAT_MSR_BITMAP               RT_BIT(1)
+/** Architectural performance counter supported. */
+#define GIM_HV_HOST_FEAT_PERF_COUNTER             RT_BIT(2)
+/** Nested paging is used. */
+#define GIM_HV_HOST_FEAT_NESTED_PAGING            RT_BIT(3)
+/** DMA remapping is used. */
+#define GIM_HV_HOST_FEAT_DMA_REMAPPING            RT_BIT(4)
+/** Interrupt remapping is used. */
+#define GIM_HV_HOST_FEAT_INTERRUPT_REMAPPING      RT_BIT(5)
+/** Memory patrol scrubber is present. */
+#define GIM_HV_HOST_FEAT_MEM_PATROL_SCRUBBER      RT_BIT(6)
+/** @}  */
+
+
+/** @name Hyper-V MSRs.
+ * @{
+ */
+/** Start of range 0. */
+#define MSR_GIM_HV_RANGE0_START                   UINT32_C(0x40000000)
+/** Guest OS identification (R/W) */
+#define MSR_GIM_HV_GUEST_OS_ID                    UINT32_C(0x40000000)
+/** Enable hypercall interface (R/W) */
+#define MSR_GIM_HV_HYPERCALL                      UINT32_C(0x40000001)
+/** Virtual processor's (VCPU) index (R) */
+#define MSR_GIM_HV_VP_INDEX                       UINT32_C(0x40000002)
+/** Reset operation (R/W) */
+#define MSR_GIM_HV_RESET                          UINT32_C(0x40000003)
+/** End of range 0. */
+#define MSR_GIM_HV_RANGE0_END                     MSR_GIM_HV_RESET
+
+/** Start of range 1. */
+#define MSR_GIM_HV_RANGE1_START                   UINT32_C(0x40000010)
+/** Virtual processor's (VCPU) runtime (R) */
+#define MSR_GIM_HV_VP_RUNTIME                     UINT32_C(0x40000010)
+/** End of range 1. */
+#define MSR_GIM_HV_RANGE1_END                     MSR_GIM_HV_VP_RUNTIME
+
+/** Start of range 2. */
+#define MSR_GIM_HV_RANGE2_START                   UINT32_C(0x40000020)
+/** Per-VM reference counter (R) */
+#define MSR_GIM_HV_TIME_REF_COUNT                 UINT32_C(0x40000020)
+/** Per-VM TSC page (R/W) */
+#define MSR_GIM_HV_REF_TSC                        UINT32_C(0x40000021)
+/** Frequency of TSC in Hz as reported by the hypervisor (R) */
+#define MSR_GIM_HV_TSC_FREQ                       UINT32_C(0x40000022)
+/** Frequency of LAPIC in Hz as reported by the hypervisor (R) */
+#define MSR_GIM_HV_APIC_FREQ                      UINT32_C(0x40000023)
+/** End of range 2. */
+#define MSR_GIM_HV_RANGE2_END                     MSR_GIM_HV_APIC_FREQ
+
+/** Start of range 3. */
+#define MSR_GIM_HV_RANGE3_START                   UINT32_C(0x40000070)
+/** Access to APIC EOI (End-Of-Interrupt) register (W) */
+#define MSR_GIM_HV_EOI                            UINT32_C(0x40000070)
+/** Access to APIC ICR (Interrupt Command) register (R/W) */
+#define MSR_GIM_HV_ICR                            UINT32_C(0x40000071)
+/** Access to APIC TPR (Task Priority) register (R/W) */
+#define MSR_GIM_HV_TPR                            UINT32_C(0x40000072)
+/** Enables lazy EOI processing (R/W) */
+#define MSR_GIM_HV_APIC_ASSIST_PAGE               UINT32_C(0x40000073)
+/** End of range 3. */
+#define MSR_GIM_HV_RANGE3_END                     MSR_GIM_HV_APIC_ASSIST_PAGE
+
+/** Start of range 4. */
+#define MSR_GIM_HV_RANGE4_START                   UINT32_C(0x40000080)
+/** Control behaviour of synthetic interrupt controller (R/W) */
+#define MSR_GIM_HV_SCONTROL                       UINT32_C(0x40000080)
+/** Synthetic interrupt controller version (R) */
+#define MSR_GIM_HV_SVERSION                       UINT32_C(0x40000081)
+/** Base address of synthetic interrupt event flag (R/W) */
+#define MSR_GIM_HV_SIEFP                          UINT32_C(0x40000082)
+/** Base address of synthetic interrupt parameter page (R/W) */
+#define MSR_GIM_HV_SIMP                           UINT32_C(0x40000083)
+/** End-Of-Message in synthetic interrupt parameter page (W) */
+#define MSR_GIM_HV_EOM                            UINT32_C(0x40000084)
+/** End of range 4. */
+#define MSR_GIM_HV_RANGE4_END                     MSR_GIM_HV_EOM
+
+/** Start of range 5. */
+#define MSR_GIM_HV_RANGE5_START                   UINT32_C(0x40000090)
+/** Configures synthetic interrupt source 0 (R/W) */
+#define MSR_GIM_HV_SINT0                          UINT32_C(0x40000090)
+/** Configures synthetic interrupt source 1 (R/W) */
+#define MSR_GIM_HV_SINT1                          UINT32_C(0x40000091)
+/** Configures synthetic interrupt source 2 (R/W) */
+#define MSR_GIM_HV_SINT2                          UINT32_C(0x40000092)
+/** Configures synthetic interrupt source 3 (R/W) */
+#define MSR_GIM_HV_SINT3                          UINT32_C(0x40000093)
+/** Configures synthetic interrupt source 4 (R/W) */
+#define MSR_GIM_HV_SINT4                          UINT32_C(0x40000094)
+/** Configures synthetic interrupt source 5 (R/W) */
+#define MSR_GIM_HV_SINT5                          UINT32_C(0x40000095)
+/** Configures synthetic interrupt source 6 (R/W) */
+#define MSR_GIM_HV_SINT6                          UINT32_C(0x40000096)
+/** Configures synthetic interrupt source 7 (R/W) */
+#define MSR_GIM_HV_SINT7                          UINT32_C(0x40000097)
+/** Configures synthetic interrupt source 8 (R/W) */
+#define MSR_GIM_HV_SINT8                          UINT32_C(0x40000098)
+/** Configures synthetic interrupt source 9 (R/W) */
+#define MSR_GIM_HV_SINT9                          UINT32_C(0x40000099)
+/** Configures synthetic interrupt source 10 (R/W) */
+#define MSR_GIM_HV_SINT10                         UINT32_C(0x4000009A)
+/** Configures synthetic interrupt source 11 (R/W) */
+#define MSR_GIM_HV_SINT11                         UINT32_C(0x4000009B)
+/** Configures synthetic interrupt source 12 (R/W) */
+#define MSR_GIM_HV_SINT12                         UINT32_C(0x4000009C)
+/** Configures synthetic interrupt source 13 (R/W) */
+#define MSR_GIM_HV_SINT13                         UINT32_C(0x4000009D)
+/** Configures synthetic interrupt source 14 (R/W) */
+#define MSR_GIM_HV_SINT14                         UINT32_C(0x4000009E)
+/** Configures synthetic interrupt source 15 (R/W) */
+#define MSR_GIM_HV_SINT15                         UINT32_C(0x4000009F)
+/** End of range 5. */
+#define MSR_GIM_HV_RANGE5_END                     MSR_GIM_HV_SINT15
+
+/** Start of range 6. */
+#define MSR_GIM_HV_RANGE6_START                   UINT32_C(0x400000B0)
+/** Configures register for synthetic timer 0 (R/W) */
+#define MSR_GIM_HV_STIMER0_CONFIG                 UINT32_C(0x400000B0)
+/** Expiration time or period for synthetic timer 0 (R/W) */
+#define MSR_GIM_HV_STIMER0_COUNT                  UINT32_C(0x400000B1)
+/** Configures register for synthetic timer 1 (R/W) */
+#define MSR_GIM_HV_STIMER1_CONFIG                 UINT32_C(0x400000B2)
+/** Expiration time or period for synthetic timer 1 (R/W) */
+#define MSR_GIM_HV_STIMER1_COUNT                  UINT32_C(0x400000B3)
+/** Configures register for synthetic timer 2 (R/W) */
+#define MSR_GIM_HV_STIMER2_CONFIG                 UINT32_C(0x400000B4)
+/** Expiration time or period for synthetic timer 2 (R/W) */
+#define MSR_GIM_HV_STIMER2_COUNT                  UINT32_C(0x400000B5)
+/** Configures register for synthetic timer 3 (R/W) */
+#define MSR_GIM_HV_STIMER3_CONFIG                 UINT32_C(0x400000B6)
+/** Expiration time or period for synthetic timer 3 (R/W) */
+#define MSR_GIM_HV_STIMER3_COUNT                  UINT32_C(0x400000B7)
+/** End of range 6. */
+#define MSR_GIM_HV_RANGE6_END                     MSR_GIM_HV_STIMER3_COUNT
+
+/** Start of range 7. */
+#define MSR_GIM_HV_RANGE7_START                   UINT32_C(0x400000C1)
+/** Trigger to transition to power state C1 (R) */
+#define MSR_GIM_HV_POWER_STATE_TRIGGER_C1         UINT32_C(0x400000C1)
+/** Trigger to transition to power state C2 (R) */
+#define MSR_GIM_HV_POWER_STATE_TRIGGER_C2         UINT32_C(0x400000C2)
+/** Trigger to transition to power state C3 (R) */
+#define MSR_GIM_HV_POWER_STATE_TRIGGER_C3         UINT32_C(0x400000C3)
+/** End of range 7. */
+#define MSR_GIM_HV_RANGE7_END                     MSR_GIM_HV_POWER_STATE_TRIGGER_C3
+
+/** Start of range 8. */
+#define MSR_GIM_HV_RANGE8_START                   UINT32_C(0x400000D1)
+/** Configure the recipe for power state transitions to C1 (R/W) */
+#define MSR_GIM_HV_POWER_STATE_CONFIG_C1          UINT32_C(0x400000D1)
+/** Configure the recipe for power state transitions to C2 (R/W) */
+#define MSR_GIM_HV_POWER_STATE_CONFIG_C2          UINT32_C(0x400000D2)
+/** Configure the recipe for power state transitions to C3 (R/W) */
+#define MSR_GIM_HV_POWER_STATE_CONFIG_C3          UINT32_C(0x400000D3)
+/** End of range 8. */
+#define MSR_GIM_HV_RANGE8_END                     MSR_GIM_HV_POWER_STATE_CONFIG_C3
+
+/** Start of range 9. */
+#define MSR_GIM_HV_RANGE9_START                   UINT32_C(0x400000E0)
+/** Map the guest's retail partition stats page (R/W) */
+#define MSR_GIM_HV_STATS_PART_RETAIL_PAGE         UINT32_C(0x400000E0)
+/** Map the guest's internal partition stats page (R/W) */
+#define MSR_GIM_HV_STATS_PART_INTERNAL_PAGE       UINT32_C(0x400000E1)
+/** Map the guest's retail VP stats page (R/W) */
+#define MSR_GIM_HV_STATS_VP_RETAIL_PAGE           UINT32_C(0x400000E2)
+/** Map the guest's internal VP stats page (R/W) */
+#define MSR_GIM_HV_STATS_VP_INTERNAL_PAGE         UINT32_C(0x400000E3)
+/** End of range 9. */
+#define MSR_GIM_HV_RANGE9_END                     MSR_GIM_HV_STATS_VP_INTERNAL_PAGE
+
+/** Start of range 10. */
+#define MSR_GIM_HV_RANGE10_START                  UINT32_C(0x400000F0)
+/** Trigger the guest's transition to idle power state (R) */
+#define MSR_GIM_HV_GUEST_IDLE                     UINT32_C(0x400000F0)
+/** Synthetic debug control. */
+#define MSR_GIM_HV_SYNTH_DEBUG_CONTROL            UINT32_C(0x400000F1)
+/** Synthetic debug status. */
+#define MSR_GIM_HV_SYNTH_DEBUG_STATUS             UINT32_C(0x400000F2)
+/** Synthetic debug send buffer. */
+#define MSR_GIM_HV_SYNTH_DEBUG_SEND_BUFFER        UINT32_C(0x400000F3)
+/** Synthetic debug receive buffer. */
+#define MSR_GIM_HV_SYNTH_DEBUG_RECEIVE_BUFFER     UINT32_C(0x400000F4)
+/** Synthetic debug pending buffer. */
+#define MSR_GIM_HV_SYNTH_DEBUG_PENDING_BUFFER     UINT32_C(0x400000F5)
+/** End of range 10. */
+#define MSR_GIM_HV_RANGE10_END                    MSR_GIM_HV_SYNTH_DEBUG_PENDING_BUFFER
+
+/** Start of range 11. */
+#define MSR_GIM_HV_RANGE11_START                  UINT32_C(0x40000100)
+/** Guest crash MSR 0. */
+#define MSR_GIM_HV_CRASH_P0                       UINT32_C(0x40000100)
+/** Guest crash MSR 1. */
+#define MSR_GIM_HV_CRASH_P1                       UINT32_C(0x40000101)
+/** Guest crash MSR 2. */
+#define MSR_GIM_HV_CRASH_P2                       UINT32_C(0x40000102)
+/** Guest crash MSR 3. */
+#define MSR_GIM_HV_CRASH_P3                       UINT32_C(0x40000103)
+/** Guest crash MSR 4. */
+#define MSR_GIM_HV_CRASH_P4                       UINT32_C(0x40000104)
+/** Guest crash control. */
+#define MSR_GIM_HV_CRASH_CTL                      UINT32_C(0x40000105)
+/** End of range 11. */
+#define MSR_GIM_HV_RANGE11_END                    MSR_GIM_HV_CRASH_CTL
+/** @} */
+
+AssertCompile(MSR_GIM_HV_RANGE0_START  <= MSR_GIM_HV_RANGE0_END);
+AssertCompile(MSR_GIM_HV_RANGE1_START  <= MSR_GIM_HV_RANGE1_END);
+AssertCompile(MSR_GIM_HV_RANGE2_START  <= MSR_GIM_HV_RANGE2_END);
+AssertCompile(MSR_GIM_HV_RANGE3_START  <= MSR_GIM_HV_RANGE3_END);
+AssertCompile(MSR_GIM_HV_RANGE4_START  <= MSR_GIM_HV_RANGE4_END);
+AssertCompile(MSR_GIM_HV_RANGE5_START  <= MSR_GIM_HV_RANGE5_END);
+AssertCompile(MSR_GIM_HV_RANGE6_START  <= MSR_GIM_HV_RANGE6_END);
+AssertCompile(MSR_GIM_HV_RANGE7_START  <= MSR_GIM_HV_RANGE7_END);
+AssertCompile(MSR_GIM_HV_RANGE8_START  <= MSR_GIM_HV_RANGE8_END);
+AssertCompile(MSR_GIM_HV_RANGE9_START  <= MSR_GIM_HV_RANGE9_END);
+AssertCompile(MSR_GIM_HV_RANGE10_START <= MSR_GIM_HV_RANGE10_END);
+AssertCompile(MSR_GIM_HV_RANGE11_START <= MSR_GIM_HV_RANGE11_END);
+
+/** @name Hyper-V MSR - Reset (MSR_GIM_HV_RESET).
+ * @{
+ */
+/** The hypercall enable bit. */
+#define MSR_GIM_HV_RESET_BIT                      RT_BIT_64(0)
+/** Whether the hypercall-page is enabled or not. */
+#define MSR_GIM_HV_RESET_IS_SET(a)                RT_BOOL((a) & MSR_GIM_HV_RESET_BIT)
+/** @} */
+
+/** @name Hyper-V MSR - Hypercall (MSR_GIM_HV_HYPERCALL).
+ * @{
+ */
+/** Guest-physical page frame number of the hypercall-page. */
+#define MSR_GIM_HV_HYPERCALL_GUEST_PFN(a)         ((a) >> 12)
+/** The hypercall enable bit. */
+#define MSR_GIM_HV_HYPERCALL_ENABLE_BIT           RT_BIT_64(0)
+/** Whether the hypercall-page is enabled or not. */
+#define MSR_GIM_HV_HYPERCALL_IS_ENABLED(a)        RT_BOOL((a) & MSR_GIM_HV_HYPERCALL_ENABLE_BIT)
+/** @} */
+
+/** @name Hyper-V MSR - Reference TSC (MSR_GIM_HV_REF_TSC).
+ * @{
+ */
+/** Guest-physical page frame number of the TSC-page. */
+#define MSR_GIM_HV_REF_TSC_GUEST_PFN(a)           ((a) >> 12)
+/** The TSC-page enable bit. */
+#define MSR_GIM_HV_REF_TSC_ENABLE_BIT             RT_BIT_64(0)
+/** Whether the TSC-page is enabled or not. */
+#define MSR_GIM_HV_REF_TSC_IS_ENABLED(a)          RT_BOOL((a) & MSR_GIM_HV_REF_TSC_ENABLE_BIT)
+/** @} */
+
+/** Hyper-V page size.  */
+#define GIM_HV_PAGE_SIZE                          0x1000
+
+/**
+ * MMIO2 region indices.
+ */
+/** The hypercall page region. */
+#define GIM_HV_HYPERCALL_PAGE_REGION_IDX          UINT8_C(0)
+/** The TSC page region. */
+#define GIM_HV_REF_TSC_PAGE_REGION_IDX            UINT8_C(1)
+/** The maximum region index (must be <= UINT8_MAX). */
+#define GIM_HV_REGION_IDX_MAX                     GIM_HV_REF_TSC_PAGE_REGION_IDX
+
+/**
+ * Hyper-V TSC (HV_REFERENCE_TSC_PAGE) structure placed in the TSC reference
+ * page.
+ */
+typedef struct GIMHVREFTSC
+{
+    uint32_t u32TscSequence;
+    uint32_t uReserved0;
+    uint64_t u64TscScale;
+    int64_t  i64TscOffset;
+} GIMHVTSCPAGE;
+/** Pointer to Hyper-V reference TSC. */
+typedef GIMHVREFTSC *PGIMHVREFTSC;
+/** Pointer to a const Hyper-V reference TSC. */
+typedef GIMHVREFTSC const *PCGIMHVREFTSC;
+
+
+/**
+ * GIM Hyper-V VM instance data.
+ * Changes to this must checked against the padding of the gim union in VM!
+ */
+typedef struct GIMHV
+{
+    /** @name MSRs.
+     *  { */
+    /** Guest OS identity MSR. */
+    uint64_t                    u64GuestOsIdMsr;
+    /** Hypercall MSR. */
+    uint64_t                    u64HypercallMsr;
+    /** Reference TSC page MSR. */
+    uint64_t                    u64TscPageMsr;
+    /** @}  */
+
+    /** @name CPUID features.
+     *  { */
+    /** Basic features. */
+    uint32_t                    uBaseFeat;
+    /** Partition flags. */
+    uint32_t                    uPartFlags;
+    /** Power management. */
+    uint32_t                    uPowMgmtFeat;
+    /** Miscellaneous. */
+    uint32_t                    uMiscFeat;
+    /** Hypervisor hints to the guest. */
+    uint32_t                    uHyperHints;
+    /** Hypervisor capabilities. */
+    uint32_t                    uHyperCaps;
+    /** @} */
+
+    /** Per-VM R0 Spinlock for protecting EMT writes to the TSC page. */
+    RTSPINLOCK                  hSpinlockR0;
+#if HC_ARCH_BITS == 32
+    uint32_t                    u32Alignment1;
+#endif
+
+    /** Array of MMIO2 regions. */
+    GIMMMIO2REGION              aMmio2Regions[GIM_HV_REGION_IDX_MAX + 1];
+} GIMHV;
+/** Pointer to per-VM GIM Hyper-V instance data. */
+typedef GIMHV *PGIMHV;
+/** Pointer to const per-VM GIM Hyper-V instance data. */
+typedef GIMHV const *PCGIMHV;
+AssertCompileMemberAlignment(GIMHV, aMmio2Regions, 8);
+AssertCompileMemberAlignment(GIMHV, hSpinlockR0, sizeof(uintptr_t));
+
+RT_C_DECLS_BEGIN
+
+#ifdef IN_RING0
+VMMR0_INT_DECL(int)             gimR0HvInitVM(PVM pVM);
+VMMR0_INT_DECL(int)             gimR0HvTermVM(PVM pVM);
+VMMR0_INT_DECL(int)             gimR0HvUpdateParavirtTsc(PVM pVM, uint64_t u64Offset);
+#endif /* IN_RING0 */
+
+#ifdef IN_RING3
+VMMR3_INT_DECL(int)             gimR3HvInit(PVM pVM);
+VMMR3_INT_DECL(int)             gimR3HvInitCompleted(PVM pVM);
+VMMR3_INT_DECL(int)             gimR3HvTerm(PVM pVM);
+VMMR3_INT_DECL(void)            gimR3HvRelocate(PVM pVM, RTGCINTPTR offDelta);
+VMMR3_INT_DECL(void)            gimR3HvReset(PVM pVM);
+VMMR3_INT_DECL(PGIMMMIO2REGION) gimR3HvGetMmio2Regions(PVM pVM, uint32_t *pcRegions);
+VMMR3_INT_DECL(int)             gimR3HvSave(PVM pVM, PSSMHANDLE pSSM);
+VMMR3_INT_DECL(int)             gimR3HvLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion);
+
+VMMR3_INT_DECL(int)             gimR3HvDisableTscPage(PVM pVM);
+VMMR3_INT_DECL(int)             gimR3HvEnableTscPage(PVM pVM, RTGCPHYS GCPhysTscPage, bool fUseThisTscSeq, uint32_t uTscSeq);
+VMMR3_INT_DECL(int)             gimR3HvDisableHypercallPage(PVM pVM);
+VMMR3_INT_DECL(int)             gimR3HvEnableHypercallPage(PVM pVM, RTGCPHYS GCPhysHypercallPage);
+#endif /* IN_RING3 */
+
+VMM_INT_DECL(bool)              gimHvIsParavirtTscEnabled(PVM pVM);
+VMM_INT_DECL(bool)              gimHvAreHypercallsEnabled(PVMCPU pVCpu);
+VMM_INT_DECL(int)               gimHvHypercall(PVMCPU pVCpu, PCPUMCTX pCtx);
+VMM_INT_DECL(VBOXSTRICTRC)      gimHvReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
+VMM_INT_DECL(VBOXSTRICTRC)      gimHvWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uRawValue);
+
+RT_C_DECLS_END
+
+#endif
+
diff --git a/src/VBox/VMM/include/GIMInternal.h b/src/VBox/VMM/include/GIMInternal.h
new file mode 100644
index 0000000..f00956a
--- /dev/null
+++ b/src/VBox/VMM/include/GIMInternal.h
@@ -0,0 +1,114 @@
+/* $Id: GIMInternal.h $ */
+/** @file
+ * GIM - Internal header file.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___GIMInternal_h
+#define ___GIMInternal_h
+
+#include <VBox/vmm/gim.h>
+#include <VBox/vmm/pgm.h>
+#include "GIMHvInternal.h"
+#include "GIMKvmInternal.h"
+#include "GIMMinimalInternal.h"
+
+RT_C_DECLS_BEGIN
+
+/** @defgroup grp_gim_int       Internal
+ * @ingroup grp_gim
+ * @internal
+ * @{
+ */
+
+/** The saved state version. */
+#define GIM_SAVED_STATE_VERSION         1
+
+/**
+ * GIM VM Instance data.
+ * Changes to this must checked against the padding of the gim union in VM!
+ */
+typedef struct GIM
+{
+    /** The provider that is active for this VM. */
+    GIMPROVIDERID                    enmProviderId;
+    /** The interface implementation version. */
+    uint32_t                         u32Version;
+
+    /** Physical access handler type for semi-read-only MMIO2 memory. Lazy creation. */
+    PGMPHYSHANDLERTYPE              hSemiReadOnlyMmio2Handler;
+    /** Alignment padding. */
+    uint32_t                        u32Padding;
+
+    /** Pointer to the GIM device - ring-3 context. */
+    R3PTRTYPE(PPDMDEVINS)            pDevInsR3;
+#if 0
+    /** Pointer to the provider's ring-3 hypercall handler. */
+    R3PTRTYPE(PFNGIMHYPERCALL)       pfnHypercallR3;
+    /** Pointer to the provider's ring-0 hypercall handler. */
+    R0PTRTYPE(PFNGIMHYPERCALL)       pfnHypercallR0;
+    /** Pointer to the provider's raw-mode context hypercall handler. */
+    RCPTRTYPE(PFNGIMHYPERCALL)       pfnHypercallRC;
+
+    /** Pointer to the provider's ring-3 MSR-read handler. */
+    R3PTRTYPE(PFNGIMRDMSR)           pfnReadMsrR3;
+    /** Pointer to the provider's ring-0 MSR-read handler. */
+    R0PTRTYPE(PFNGIMRDMSR)           pfnReadMsrR0;
+    /** Pointer to the provider's raw-mode context MSR-read handler. */
+    RCPTRTYPE(PFNGIMRDMSR)           pfnReadMsrRC;
+
+    /** Pointer to the provider's ring-3 MSR-read handler. */
+    R3PTRTYPE(PFNGIMWDMSR)           pfnWriteMsrR3;
+    /** Pointer to the provider's ring-0 MSR-read handler. */
+    R0PTRTYPE(PFNGIMWDMSR)           pfnWriteMsrRR0;
+    /** Pointer to the provider's raw-mode context MSR-read handler. */
+    RCPTRTYPE(PFNGIMWDMSR)           pfnWriteMsrRRC;
+#endif
+
+    union
+    {
+        GIMHV  Hv;
+        GIMKVM Kvm;
+    } u;
+} GIM;
+/** Pointer to GIM VM instance data. */
+typedef GIM *PGIM;
+
+
+/**
+ * GIM VMCPU Instance data.
+ */
+typedef struct GIMCPU
+{
+    union
+    {
+        GIMKVMCPU KvmCpu;
+    } u;
+} GIMCPU;
+/** Pointer to GIM VMCPU instance data. */
+typedef GIMCPU *PGIMCPU;
+
+#ifdef IN_RING3
+VMMR3_INT_DECL(int)           GIMR3Mmio2Unmap(PVM pVM, PGIMMMIO2REGION pRegion);
+VMMR3_INT_DECL(int)           GIMR3Mmio2Map(PVM pVM, PGIMMMIO2REGION pRegion, RTGCPHYS GCPhysRegion);
+VMMR3_INT_DECL(int)           GIMR3Mmio2HandlerPhysicalRegister(PVM pVM, PGIMMMIO2REGION pRegion);
+VMMR3_INT_DECL(int)           GIMR3Mmio2HandlerPhysicalDeregister(PVM pVM, PGIMMMIO2REGION pRegion);
+#endif /* IN_RING3 */
+
+/** @} */
+
+RT_C_DECLS_END
+
+#endif
+
diff --git a/src/VBox/VMM/include/GIMKvmInternal.h b/src/VBox/VMM/include/GIMKvmInternal.h
new file mode 100644
index 0000000..c6c93e6
--- /dev/null
+++ b/src/VBox/VMM/include/GIMKvmInternal.h
@@ -0,0 +1,270 @@
+/* $Id: GIMKvmInternal.h $ */
+/** @file
+ * GIM - KVM, Internal header file.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___GIMKvmInternal_h
+#define ___GIMKvmInternal_h
+
+#include <VBox/vmm/gim.h>
+#include <VBox/vmm/cpum.h>
+
+
+/** @name KVM base features.
+ * @{
+ */
+/** Old, deprecated clock source available. */
+#define GIM_KVM_BASE_FEAT_CLOCK_OLD                RT_BIT(0)
+/** No need for artifical delays on IO operations. */
+#define GIM_KVM_BASE_FEAT_NOP_IO_DELAY             RT_BIT(1)
+/** MMU op supported (deprecated, unused). */
+#define GIM_KVM_BASE_FEAT_MMU_OP                   RT_BIT(2)
+/** Clock source available. */
+#define GIM_KVM_BASE_FEAT_CLOCK                    RT_BIT(3)
+/** Asynchronous page faults supported. */
+#define GIM_KVM_BASE_FEAT_ASYNC_PF                 RT_BIT(4)
+/** Steal time (VCPU not executing guest code time in ns) available. */
+#define GIM_KVM_BASE_FEAT_STEAL_TIME               RT_BIT(5)
+/** Paravirtualized EOI (end-of-interrupt) supported. */
+#define GIM_KVM_BASE_FEAT_PV_EOI                   RT_BIT(6)
+/** Paravirtualized spinlock (unhalting VCPU) supported. */
+#define GIM_KVM_BASE_FEAT_PV_UNHALT                RT_BIT(7)
+/** The TSC is stable (fixed rate, monotonic). */
+#define GIM_KVM_BASE_FEAT_TSC_STABLE               RT_BIT(24)
+/** @}  */
+
+
+/** @name KVM MSRs.
+ * @{
+ */
+/** Start of range 0. */
+#define MSR_GIM_KVM_RANGE0_START                   UINT32_C(0x11)
+/** Old, deprecated wall clock. */
+#define MSR_GIM_KVM_WALL_CLOCK_OLD                 UINT32_C(0x11)
+/** Old, deprecated System time. */
+#define MSR_GIM_KVM_SYSTEM_TIME_OLD                UINT32_C(0x12)
+/** End of range 0. */
+#define MSR_GIM_KVM_RANGE0_END                     MSR_GIM_KVM_SYSTEM_TIME_OLD
+
+/** Start of range 1. */
+#define MSR_GIM_KVM_RANGE1_START                   UINT32_C(0x4b564d00)
+/** Wall clock. */
+#define MSR_GIM_KVM_WALL_CLOCK                     UINT32_C(0x4b564d00)
+/** System time. */
+#define MSR_GIM_KVM_SYSTEM_TIME                    UINT32_C(0x4b564d01)
+/** Asynchronous page fault. */
+#define MSR_GIM_KVM_ASYNC_PF                       UINT32_C(0x4b564d02)
+/** Steal time. */
+#define MSR_GIM_KVM_STEAL_TIME                     UINT32_C(0x4b564d03)
+/** Paravirtualized EOI (end-of-interrupt). */
+#define MSR_GIM_KVM_EOI                            UINT32_C(0x4b564d04)
+/** End of range 1. */
+#define MSR_GIM_KVM_RANGE1_END                     MSR_GIM_KVM_EOI
+
+AssertCompile(MSR_GIM_KVM_RANGE0_START <= MSR_GIM_KVM_RANGE0_END);
+AssertCompile(MSR_GIM_KVM_RANGE1_START <= MSR_GIM_KVM_RANGE1_END);
+
+/** KVM page size.  */
+#define GIM_KVM_PAGE_SIZE                          0x1000
+
+/**
+ * MMIO2 region indices.
+ */
+/** The system time page(s) region. */
+#define GIM_KVM_SYSTEM_TIME_PAGE_REGION_IDX        UINT8_C(0)
+/** The steal time page(s) region. */
+#define GIM_KVM_STEAL_TIME_PAGE_REGION_IDX         UINT8_C(1)
+/** The maximum region index (must be <= UINT8_MAX). */
+#define GIM_KVM_REGION_IDX_MAX                     GIM_KVM_STEAL_TIME_PAGE_REGION_IDX
+
+/**
+ * KVM system-time structure (GIM_KVM_SYSTEM_TIME_FLAGS_XXX) flags.
+ * See "Documentation/virtual/kvm/api.txt".
+ */
+/** The TSC is stable (monotonic). */
+#define GIM_KVM_SYSTEM_TIME_FLAGS_TSC_STABLE       RT_BIT(0)
+/** The guest VCPU has been paused by the hypervisor. */
+#define GIM_KVM_SYSTEM_TIME_FLAGS_GUEST_PAUSED     RT_BIT(1)
+/** */
+
+/** @name KVM MSR - System time (MSR_GIM_KVM_SYSTEM_TIME and
+ * MSR_GIM_KVM_SYSTEM_TIME_OLD).
+ * @{
+ */
+/** The system-time enable bit. */
+#define MSR_GIM_KVM_SYSTEM_TIME_ENABLE_BIT        RT_BIT_64(0)
+/** Whether the system-time struct. is enabled or not. */
+#define MSR_GIM_KVM_SYSTEM_TIME_IS_ENABLED(a)     RT_BOOL((a) & MSR_GIM_KVM_SYSTEM_TIME_ENABLE_BIT)
+/** Guest-physical address of the system-time struct. */
+#define MSR_GIM_KVM_SYSTEM_TIME_GUEST_GPA(a)      ((a) & ~MSR_GIM_KVM_SYSTEM_TIME_ENABLE_BIT)
+/** @} */
+
+/** @name KVM MSR - Wall clock (MSR_GIM_KVM_WALL_CLOCK and
+ * MSR_GIM_KVM_WALL_CLOCK_OLD).
+ * @{
+ */
+/** Guest-physical address of the wall-clock struct. */
+#define MSR_GIM_KVM_WALL_CLOCK_GUEST_GPA(a)        (a)
+/** @} */
+
+
+/** @name KVM Hypercall operations.
+ *  @{ */
+#define KVM_HYPERCALL_OP_VAPIC_POLL_IRQ            1
+#define KVM_HYPERCALL_OP_MMU                       2
+#define KVM_HYPERCALL_OP_FEATURES                  3
+#define KVM_HYPERCALL_OP_KICK_CPU                  5
+/** @} */
+
+/** @name KVM Hypercall return values.
+ *  @{ */
+/* Return values for hypercalls */
+#define KVM_HYPERCALL_RET_SUCCESS                  0
+#define KVM_HYPERCALL_RET_ENOSYS                   (uint64_t)(-1000)
+#define KVM_HYPERCALL_RET_EFAULT                   (uint64_t)(-14)
+#define KVM_HYPERCALL_RET_E2BIG                    (uint64_t)(-7)
+#define KVM_HYPERCALL_RET_EPERM                    (uint64_t)(-1)
+/** @} */
+
+/**
+ * KVM per-VCPU system-time structure.
+ */
+typedef struct GIMKVMSYSTEMTIME
+{
+    /** Version (sequence number). */
+    uint32_t        u32Version;
+    /** Alignment padding. */
+    uint32_t        u32Padding0;
+    /** TSC time stamp.  */
+    uint64_t        u64Tsc;
+    /** System time in nanoseconds. */
+    uint64_t        u64NanoTS;
+    /** TSC to system time scale factor. */
+    uint32_t        u32TscScale;
+    /** TSC frequency shift.  */
+    int8_t          i8TscShift;
+    /** Clock source (GIM_KVM_SYSTEM_TIME_FLAGS_XXX) flags. */
+    uint8_t         fFlags;
+    /** Alignment padding. */
+    uint8_t         abPadding0[2];
+} GIMKVMSYSTEMTIME;
+/** Pointer to KVM system-time struct. */
+typedef GIMKVMSYSTEMTIME *PGIMKVMSYSTEMTIME;
+/** Pointer to a const KVM system-time struct. */
+typedef GIMKVMSYSTEMTIME const *PCGIMKVMSYSTEMTIME;
+AssertCompileSize(GIMKVMSYSTEMTIME, 32);
+
+
+/**
+ * KVM per-VM wall-clock structure.
+ */
+typedef struct GIMKVMWALLCLOCK
+{
+    /** Version (sequence number). */
+    uint32_t        u32Version;
+    /** Number of seconds since boot. */
+    uint32_t        u32Sec;
+    /** Number of nanoseconds since boot. */
+    uint32_t        u32Nano;
+} GIMKVMWALLCLOCK;
+/** Pointer to KVM wall-clock struct. */
+typedef GIMKVMWALLCLOCK *PGIMKVMWALLCLOCK;
+/** Pointer to a const KVM wall-clock struct. */
+typedef GIMKVMWALLCLOCK const *PCGIMKVMWALLCLOCK;
+AssertCompileSize(GIMKVMWALLCLOCK, 12);
+
+
+/**
+ * GIM KVMV VM instance data.
+ * Changes to this must checked against the padding of the gim union in VM!
+ */
+typedef struct GIMKVM
+{
+    /** Wall-clock MSR. */
+    uint64_t                    u64WallClockMsr;
+
+    /**  CPUID features: Basic. */
+    uint32_t                    uBaseFeat;
+
+    /** Whether GIM needs to trap #UD exceptions. */
+    bool                        fTrapXcptUD;
+    /** Disassembler opcode of hypercall instruction native for this host CPU. */
+    uint16_t                    uOpCodeNative;
+} GIMKVM;
+/** Pointer to per-VM GIM KVM instance data. */
+typedef GIMKVM *PGIMKVM;
+/** Pointer to const per-VM GIM KVM instance data. */
+typedef GIMKVM const *PCGIMKVM;
+
+/**
+ * GIM KVMV VCPU instance data.
+ * Changes to this must checked against the padding of the gim union in VMCPU!
+ */
+typedef struct GIMKVMCPU
+{
+    /** System-time MSR. */
+    uint64_t                    u64SystemTimeMsr;
+    /** The guest-physical address of the system-time struct. */
+    RTGCPHYS                    GCPhysSystemTime;
+    /** The version (sequence number) of the system-time struct. */
+    uint32_t                    u32SystemTimeVersion;
+    /** The guest TSC value while enabling the system-time MSR. */
+    uint64_t                    uTsc;
+    /** The guest virtual time while enabling the system-time MSR. */
+    uint64_t                    uVirtNanoTS;
+} GIMKVMCPU;
+/** Pointer to per-VCPU GIM KVM instance data. */
+typedef GIMKVMCPU *PGIMKVMCPU;
+/** Pointer to const per-VCPU GIM KVM instance data. */
+typedef GIMKVMCPU const *PCGIMKVMCPU;
+
+
+RT_C_DECLS_BEGIN
+
+#ifdef IN_RING0
+#if 0
+VMMR0_INT_DECL(int)             gimR0KvmInitVM(PVM pVM);
+VMMR0_INT_DECL(int)             gimR0KvmTermVM(PVM pVM);
+VMMR0_INT_DECL(int)             gimR0KvmUpdateParavirtTsc(PVM pVM, uint64_t u64Offset);
+#endif
+#endif /* IN_RING0 */
+
+#ifdef IN_RING3
+VMMR3_INT_DECL(int)             gimR3KvmInit(PVM pVM);
+VMMR3_INT_DECL(int)             gimR3KvmInitCompleted(PVM pVM);
+VMMR3_INT_DECL(int)             gimR3KvmTerm(PVM pVM);
+VMMR3_INT_DECL(void)            gimR3KvmRelocate(PVM pVM, RTGCINTPTR offDelta);
+VMMR3_INT_DECL(void)            gimR3KvmReset(PVM pVM);
+VMMR3_INT_DECL(int)             gimR3KvmSave(PVM pVM, PSSMHANDLE pSSM);
+VMMR3_INT_DECL(int)             gimR3KvmLoad(PVM pVM, PSSMHANDLE pSSM, uint32_t uSSMVersion);
+
+VMMR3_INT_DECL(int)             gimR3KvmDisableSystemTime(PVM pVM);
+VMMR3_INT_DECL(int)             gimR3KvmEnableSystemTime(PVM pVM, PVMCPU pVCpu, PGIMKVMCPU pKvmCpu, uint8_t fFlags);
+VMMR3_INT_DECL(int)             gimR3KvmEnableWallClock(PVM pVM, RTGCPHYS GCPhysSysTime);
+#endif /* IN_RING3 */
+
+VMM_INT_DECL(bool)              gimKvmIsParavirtTscEnabled(PVM pVM);
+VMM_INT_DECL(bool)              gimKvmAreHypercallsEnabled(PVMCPU pVCpu);
+VMM_INT_DECL(int)               gimKvmHypercall(PVMCPU pVCpu, PCPUMCTX pCtx);
+VMM_INT_DECL(VBOXSTRICTRC)      gimKvmReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
+VMM_INT_DECL(VBOXSTRICTRC)      gimKvmWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uRawValue);
+VMM_INT_DECL(bool)              gimKvmShouldTrapXcptUD(PVMCPU pVCpu);
+VMM_INT_DECL(int)               gimKvmXcptUD(PVMCPU pVCpu, PCPUMCTX pCtx, PDISCPUSTATE pDis);
+
+
+RT_C_DECLS_END
+
+#endif
+
diff --git a/src/VBox/VMM/include/GIMMinimalInternal.h b/src/VBox/VMM/include/GIMMinimalInternal.h
new file mode 100644
index 0000000..d26d2c9
--- /dev/null
+++ b/src/VBox/VMM/include/GIMMinimalInternal.h
@@ -0,0 +1,35 @@
+/* $Id: GIMMinimalInternal.h $ */
+/** @file
+ * GIM - Minimal, Internal header file.
+ */
+
+/*
+ * Copyright (C) 2014-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#ifndef ___GIMMinimalInternal_h
+#define ___GIMMinimalInternal_h
+
+#include <iprt/cdefs.h>
+#include <VBox/types.h>
+
+RT_C_DECLS_BEGIN
+
+#ifdef IN_RING3
+VMMR3_INT_DECL(int)         gimR3MinimalInit(PVM pVM);
+VMMR3_INT_DECL(int)         gimR3MinimalInitCompleted(PVM pVM);
+VMMR3_INT_DECL(void)        gimR3MinimalRelocate(PVM pVM, RTGCINTPTR offDelta);
+#endif /* IN_RING3 */
+
+RT_C_DECLS_END
+
+#endif
+
diff --git a/src/VBox/VMM/include/HMInternal.h b/src/VBox/VMM/include/HMInternal.h
index 0139cae..6744d92 100644
--- a/src/VBox/VMM/include/HMInternal.h
+++ b/src/VBox/VMM/include/HMInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -31,6 +31,7 @@
 #include <iprt/cpuset.h>
 #include <iprt/mp.h>
 #include <iprt/avl.h>
+#include <iprt/string.h>
 
 #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL) || defined (VBOX_WITH_64_BITS_GUESTS)
 /* Enable 64 bits guest support. */
@@ -47,17 +48,6 @@
 # define HM_PROFILE_EXIT_DISPATCH
 #endif
 
-/* The MSR auto load/store used to not work for KERNEL_GS_BASE MSR, thus we
- * used to handle this MSR manually. See @bugref{6208}. This was clearly visible while
- * booting Solaris 11 (11.1 b19) VMs with 2 Cpus. This is no longer the case and we
- * always auto load/store the KERNEL_GS_BASE MSR.
- *
- * Note: don't forget to update the assembly files while modifying this!
- */
-/** @todo This define should always be in effect and the define itself removed
-  after 'sufficient' testing. */
-# define VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-
 RT_C_DECLS_BEGIN
 
 
@@ -68,15 +58,15 @@ RT_C_DECLS_BEGIN
  */
 
 /** @def HMCPU_CF_CLEAR
- * Clears a HM-context flag for the given VCPU.
+ * Clears a HM-context flag.
  *
  * @param   pVCpu   Pointer to the VMCPU.
  * @param   fFlag   The flag to clear.
  */
 #define HMCPU_CF_CLEAR(pVCpu, fFlag)              (ASMAtomicUoAndU32(&(pVCpu)->hm.s.fContextUseFlags, ~(fFlag)))
 
-/** @def VMCPU_FF_SET
- * Sets a HM-context flag for the given VCPU.
+/** @def HMCPU_CF_SET
+ * Sets a HM-context flag.
  *
  * @param   pVCpu   Pointer to the VMCPU.
  * @param   fFlag   The flag to set.
@@ -132,6 +122,19 @@ RT_C_DECLS_BEGIN
 #define HMCPU_CF_VALUE(pVCpu)                     (ASMAtomicUoReadU32(&(pVCpu)->hm.s.fContextUseFlags))
 
 
+/** Resets/initializes the VM-exit/#VMEXIT history array. */
+#define HMCPU_EXIT_HISTORY_RESET(pVCpu)           (memset(&(pVCpu)->hm.s.auExitHistory, 0xff, sizeof((pVCpu)->hm.s.auExitHistory)))
+
+/** Updates the VM-exit/#VMEXIT history array. */
+#define HMCPU_EXIT_HISTORY_ADD(pVCpu, a_ExitReason) \
+    do { \
+        AssertMsg((pVCpu)->hm.s.idxExitHistoryFree < RT_ELEMENTS((pVCpu)->hm.s.auExitHistory), ("%u\n", (pVCpu)->hm.s.idxExitHistoryFree)); \
+        (pVCpu)->hm.s.auExitHistory[(pVCpu)->hm.s.idxExitHistoryFree++] = (uint16_t)(a_ExitReason); \
+        if ((pVCpu)->hm.s.idxExitHistoryFree == RT_ELEMENTS((pVCpu)->hm.s.auExitHistory)) \
+            (pVCpu)->hm.s.idxExitHistoryFree = 0; \
+        (pVCpu)->hm.s.auExitHistory[(pVCpu)->hm.s.idxExitHistoryFree] = UINT16_MAX; \
+    } while (0)
+
 /** Maximum number of exit reason statistics counters. */
 #define MAX_EXITREASON_STAT        0x100
 #define MASK_EXITREASON_STAT       0xff
@@ -142,7 +145,7 @@ RT_C_DECLS_BEGIN
  * have been changed since last they were reset.
  * @{
  */
-#define HM_CHANGED_GUEST_CR0                     RT_BIT(0)
+#define HM_CHANGED_GUEST_CR0                     RT_BIT(0)      /* Shared */
 #define HM_CHANGED_GUEST_CR3                     RT_BIT(1)
 #define HM_CHANGED_GUEST_CR4                     RT_BIT(2)
 #define HM_CHANGED_GUEST_GDTR                    RT_BIT(3)
@@ -150,7 +153,7 @@ RT_C_DECLS_BEGIN
 #define HM_CHANGED_GUEST_LDTR                    RT_BIT(5)
 #define HM_CHANGED_GUEST_TR                      RT_BIT(6)
 #define HM_CHANGED_GUEST_SEGMENT_REGS            RT_BIT(7)
-#define HM_CHANGED_GUEST_DEBUG                   RT_BIT(8)
+#define HM_CHANGED_GUEST_DEBUG                   RT_BIT(8)      /* Shared */
 #define HM_CHANGED_GUEST_RIP                     RT_BIT(9)
 #define HM_CHANGED_GUEST_RSP                     RT_BIT(10)
 #define HM_CHANGED_GUEST_RFLAGS                  RT_BIT(11)
@@ -159,18 +162,20 @@ RT_C_DECLS_BEGIN
 #define HM_CHANGED_GUEST_SYSENTER_EIP_MSR        RT_BIT(14)
 #define HM_CHANGED_GUEST_SYSENTER_ESP_MSR        RT_BIT(15)
 #define HM_CHANGED_GUEST_EFER_MSR                RT_BIT(16)
+#define HM_CHANGED_GUEST_LAZY_MSRS               RT_BIT(17)     /* Shared */
+#define HM_CHANGED_GUEST_XCPT_INTERCEPTS         RT_BIT(18)
 /* VT-x specific state. */
-#define HM_CHANGED_VMX_GUEST_AUTO_MSRS           RT_BIT(17)
-#define HM_CHANGED_VMX_GUEST_ACTIVITY_STATE      RT_BIT(18)
-#define HM_CHANGED_VMX_GUEST_APIC_STATE          RT_BIT(19)
-#define HM_CHANGED_VMX_ENTRY_CTLS                RT_BIT(20)
-#define HM_CHANGED_VMX_EXIT_CTLS                 RT_BIT(21)
+#define HM_CHANGED_VMX_GUEST_AUTO_MSRS           RT_BIT(19)
+#define HM_CHANGED_VMX_GUEST_ACTIVITY_STATE      RT_BIT(20)
+#define HM_CHANGED_VMX_GUEST_APIC_STATE          RT_BIT(21)
+#define HM_CHANGED_VMX_ENTRY_CTLS                RT_BIT(22)
+#define HM_CHANGED_VMX_EXIT_CTLS                 RT_BIT(23)
 /* AMD-V specific state. */
-#define HM_CHANGED_SVM_GUEST_APIC_STATE          RT_BIT(17)
-#define HM_CHANGED_SVM_RESERVED1                 RT_BIT(18)
-#define HM_CHANGED_SVM_RESERVED2                 RT_BIT(19)
-#define HM_CHANGED_SVM_RESERVED3                 RT_BIT(20)
-#define HM_CHANGED_SVM_RESERVED4                 RT_BIT(21)
+#define HM_CHANGED_SVM_GUEST_APIC_STATE          RT_BIT(19)
+#define HM_CHANGED_SVM_RESERVED1                 RT_BIT(20)
+#define HM_CHANGED_SVM_RESERVED2                 RT_BIT(21)
+#define HM_CHANGED_SVM_RESERVED3                 RT_BIT(22)
+#define HM_CHANGED_SVM_RESERVED4                 RT_BIT(23)
 
 #define HM_CHANGED_ALL_GUEST                     (  HM_CHANGED_GUEST_CR0                \
                                                   | HM_CHANGED_GUEST_CR3                \
@@ -189,17 +194,20 @@ RT_C_DECLS_BEGIN
                                                   | HM_CHANGED_GUEST_SYSENTER_EIP_MSR   \
                                                   | HM_CHANGED_GUEST_SYSENTER_ESP_MSR   \
                                                   | HM_CHANGED_GUEST_EFER_MSR           \
+                                                  | HM_CHANGED_GUEST_LAZY_MSRS          \
+                                                  | HM_CHANGED_GUEST_XCPT_INTERCEPTS    \
                                                   | HM_CHANGED_VMX_GUEST_AUTO_MSRS      \
                                                   | HM_CHANGED_VMX_GUEST_ACTIVITY_STATE \
                                                   | HM_CHANGED_VMX_GUEST_APIC_STATE     \
                                                   | HM_CHANGED_VMX_ENTRY_CTLS           \
                                                   | HM_CHANGED_VMX_EXIT_CTLS)
 
-#define HM_CHANGED_HOST_CONTEXT                  RT_BIT(22)
+#define HM_CHANGED_HOST_CONTEXT                  RT_BIT(24)
 
 /* Bits shared between host and guest. */
 #define HM_CHANGED_HOST_GUEST_SHARED_STATE       (  HM_CHANGED_GUEST_CR0                \
-                                                  | HM_CHANGED_GUEST_DEBUG)
+                                                  | HM_CHANGED_GUEST_DEBUG              \
+                                                  | HM_CHANGED_GUEST_LAZY_MSRS)
 /** @} */
 
 /** Maximum number of page flushes we are willing to remember before considering a full TLB flush. */
@@ -212,19 +220,40 @@ RT_C_DECLS_BEGIN
 /** Total guest mapped memory needed. */
 #define HM_VTX_TOTAL_DEVHEAP_MEM        (HM_EPT_IDENTITY_PG_TABLE_SIZE + HM_VTX_TSS_SIZE)
 
+
+/** @name Macros for enabling and disabling preemption.
+ * These are really just for hiding the RTTHREADPREEMPTSTATE and asserting that
+ * preemption has already been disabled when there is no context hook.
+ * @{ */
+#ifdef VBOX_STRICT
+# define HM_DISABLE_PREEMPT() \
+    RTTHREADPREEMPTSTATE PreemptStateInternal = RTTHREADPREEMPTSTATE_INITIALIZER; \
+    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD) || VMMR0ThreadCtxHookIsEnabled(pVCpu)); \
+    RTThreadPreemptDisable(&PreemptStateInternal)
+#else
+# define HM_DISABLE_PREEMPT() \
+    RTTHREADPREEMPTSTATE PreemptStateInternal = RTTHREADPREEMPTSTATE_INITIALIZER; \
+    RTThreadPreemptDisable(&PreemptStateInternal)
+#endif /* VBOX_STRICT */
+#define HM_RESTORE_PREEMPT()    do { RTThreadPreemptRestore(&PreemptStateInternal); } while(0)
+/** @} */
+
+
 /** Enable for TPR guest patching. */
 #define VBOX_HM_WITH_GUEST_PATCHING
 
-/** HM SSM version
+/** @name HM saved state versions
+ * @{
  */
 #ifdef VBOX_HM_WITH_GUEST_PATCHING
-# define HM_SSM_VERSION                 5
-# define HM_SSM_VERSION_NO_PATCHING     4
+# define HM_SAVED_STATE_VERSION                 5
+# define HM_SAVED_STATE_VERSION_NO_PATCHING     4
 #else
-# define HM_SSM_VERSION                 4
-# define HM_SSM_VERSION_NO_PATCHING     4
+# define HM_SAVED_STATE_VERSION                 4
+# define HM_SAVED_STATE_VERSION_NO_PATCHING     4
 #endif
-#define HM_SSM_VERSION_2_0_X            3
+#define HM_SAVED_STATE_VERSION_2_0_X            3
+/** @} */
 
 /**
  * Global per-cpu information. (host)
@@ -233,7 +262,7 @@ typedef struct HMGLOBALCPUINFO
 {
     /** The CPU ID. */
     RTCPUID             idCpu;
-    /** The memory object   */
+    /** The VM_HSAVE_AREA (AMD-V) / VMXON region (Intel) memory backing. */
     RTR0MEMOBJ          hMemObj;
     /** Current ASID (AMD-V) / VPID (Intel). */
     uint32_t            uCurrentAsid;
@@ -320,38 +349,29 @@ typedef struct HM
 {
     /** Set when we've initialized VMX or SVM. */
     bool                        fInitialized;
-
     /** Set if nested paging is enabled. */
     bool                        fNestedPaging;
-
     /** Set if nested paging is allowed. */
     bool                        fAllowNestedPaging;
-
     /** Set if large pages are enabled (requires nested paging). */
     bool                        fLargePages;
-
     /** Set if we can support 64-bit guests or not. */
     bool                        fAllow64BitGuests;
-
     /** Set if an IO-APIC is configured for this VM. */
     bool                        fHasIoApic;
-
     /** Set when TPR patching is allowed. */
-    bool                        fTRPPatchingAllowed;
-
+    bool                        fTprPatchingAllowed;
     /** Set when we initialize VT-x or AMD-V once for all CPUs. */
     bool                        fGlobalInit;
-
     /** Set when TPR patching is active. */
     bool                        fTPRPatchingActive;
     bool                        u8Alignment[3];
 
-    /** Host kernel flags that HM might need to know (SUPKERNFEATURES_XXX). */
+    /** Host kernel flags that HM might need to know (SUPKERNELFEATURES_XXX). */
     uint32_t                    uHostKernelFeatures;
 
     /** Maximum ASID allowed. */
     uint32_t                    uMaxAsid;
-
     /** The maximum number of resumes loops allowed in ring-0 (safety precaution).
      * This number is set much higher when RTThreadPreemptIsPending is reliable. */
     uint32_t                    cMaxResumeLoops;
@@ -362,12 +382,12 @@ typedef struct HM
     RTGCPTR                     pFreeGuestPatchMem;
     /** Size of the guest patch memory block. */
     uint32_t                    cbGuestPatchMem;
-    uint32_t                    uPadding1;
+    uint32_t                    u32Alignment0;
 
 #if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
     /** 32 to 64 bits switcher entrypoint. */
     R0PTRTYPE(PFNHMSWITCHERHC)  pfnHost32ToGuest64R0;
-    RTR0PTR                     uPadding2;
+    RTR0PTR                     pvR0Alignment0;
 #endif
 
     struct
@@ -375,22 +395,16 @@ typedef struct HM
         /** Set by the ring-0 side of HM to indicate VMX is supported by the
          *  CPU. */
         bool                        fSupported;
-
         /** Set when we've enabled VMX. */
         bool                        fEnabled;
-
         /** Set if VPID is supported. */
         bool                        fVpid;
-
         /** Set if VT-x VPID is allowed. */
         bool                        fAllowVpid;
-
         /** Set if unrestricted guest execution is in use (real and protected mode without paging). */
         bool                        fUnrestrictedGuest;
-
         /** Set if unrestricted guest execution is allowed to be used. */
         bool                        fAllowUnrestricted;
-
         /** Whether we're using the preemption timer or not. */
         bool                        fUsePreemptTimer;
         /** The shift mask employed by the VMX-Preemption timer. */
@@ -398,29 +412,25 @@ typedef struct HM
 
         /** Virtual address of the TSS page used for real mode emulation. */
         R3PTRTYPE(PVBOXTSS)         pRealModeTSS;
-
         /** Virtual address of the identity page table used for real mode and protected mode without paging emulation in EPT mode. */
         R3PTRTYPE(PX86PD)           pNonPagingModeEPTPageTable;
 
-        /** R0 memory object for the APIC-access page. */
-        RTR0MEMOBJ                  hMemObjApicAccess;
         /** Physical address of the APIC-access page. */
         RTHCPHYS                    HCPhysApicAccess;
+        /** R0 memory object for the APIC-access page. */
+        RTR0MEMOBJ                  hMemObjApicAccess;
         /** Virtual address of the APIC-access page. */
         R0PTRTYPE(uint8_t *)        pbApicAccess;
 
 #ifdef VBOX_WITH_CRASHDUMP_MAGIC
-        RTR0MEMOBJ                  hMemObjScratch;
         RTHCPHYS                    HCPhysScratch;
+        RTR0MEMOBJ                  hMemObjScratch;
         R0PTRTYPE(uint8_t *)        pbScratch;
 #endif
 
         /** Internal Id of which flush-handler to use for tagged-TLB entries. */
-        unsigned                    uFlushTaggedTlb;
-
-#if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS)
-        uint32_t                    u32Alignment;
-#endif
+        uint32_t                    uFlushTaggedTlb;
+        uint32_t                    u32Alignment0;
         /** Host CR4 value (set by ring-0 VMX init) */
         uint64_t                    u64HostCr4;
 
@@ -428,14 +438,14 @@ typedef struct HM
         uint64_t                    u64HostEfer;
         /** Whether the CPU supports VMCS fields for swapping EFER. */
         bool                        fSupportsVmcsEfer;
-        bool                        afAlignment1[7];
+        uint8_t                     u8Alignment2[7];
 
         /** VMX MSR values */
         VMXMSRS                     Msrs;
 
         /** Flush types for invept & invvpid; they depend on capabilities. */
-        VMX_FLUSH_EPT               enmFlushEpt;
-        VMX_FLUSH_VPID              enmFlushVpid;
+        VMXFLUSHEPT                 enmFlushEpt;
+        VMXFLUSHVPID                enmFlushVpid;
 
         /** Host-physical address for a failing VMXON instruction. */
         RTHCPHYS                    HCPhysVmxEnableError;
@@ -452,11 +462,12 @@ typedef struct HM
         bool                        fAlwaysFlushTLB;
         /** Set when the hack to ignore VERR_SVM_IN_USE is active. */
         bool                        fIgnoreInUseError;
+        uint8_t                     u8Alignment0[4];
 
-        /** R0 memory object for the IO bitmap (12kb). */
-        RTR0MEMOBJ                  hMemObjIOBitmap;
         /** Physical address of the IO bitmap (12kb). */
         RTHCPHYS                    HCPhysIOBitmap;
+        /** R0 memory object for the IO bitmap (12kb). */
+        RTR0MEMOBJ                  hMemObjIOBitmap;
         /** Virtual address of the IO bitmap. */
         R0PTRTYPE(void *)           pvIOBitmap;
 
@@ -465,13 +476,13 @@ typedef struct HM
 
         /** SVM revision. */
         uint32_t                    u32Rev;
-
         /** SVM feature bits from cpuid 0x8000000a */
         uint32_t                    u32Features;
     } svm;
 
     /**
-     * AVL tree with all patches (active or disabled) sorted by guest instruction address
+     * AVL tree with all patches (active or disabled) sorted by guest instruction
+     * address.
      */
     AVLOU32TREE                     PatchTree;
     uint32_t                        cPatches;
@@ -501,7 +512,9 @@ typedef HM *PHM;
 /* Maximum number of cached entries. */
 #define VMCSCACHE_MAX_ENTRY                             128
 
-/* Structure for storing read and write VMCS actions. */
+/**
+ * Structure for storing read and write VMCS actions.
+ */
 typedef struct VMCSCACHE
 {
 #ifdef VBOX_WITH_CRASHDUMP_MAGIC
@@ -559,6 +572,7 @@ typedef struct VMCSCACHE
 } VMCSCACHE;
 /** Pointer to VMCSCACHE. */
 typedef VMCSCACHE *PVMCSCACHE;
+AssertCompileSizeAlignment(VMCSCACHE, 8);
 
 /** VMX StartVM function. */
 typedef DECLCALLBACK(int) FNHMVMXSTARTVM(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
@@ -572,6 +586,9 @@ typedef R0PTRTYPE(FNHMSVMVMRUN *) PFNHMSVMVMRUN;
 
 /**
  * HM VMCPU Instance data.
+ *
+ * Note! If you change members of this struct, make sure to check if the
+ * assembly counterpart in HMInternal.mac needs to be updated as well.
  */
 typedef struct HMCPU
 {
@@ -589,7 +606,17 @@ typedef struct HMCPU
     bool                        fLeaveDone;
     /** Whether we're using the hyper DR7 or guest DR7. */
     bool                        fUsingHyperDR7;
-    uint8_t                     abAlignment[1];
+    /** Whether to preload the guest-FPU state to avoid #NM VM-exit overhead. */
+    bool                        fPreloadGuestFpu;
+    /** Set if XCR0 needs to be loaded and saved when entering and exiting guest
+     * code execution. */
+    bool                        fLoadSaveGuestXcr0;
+
+    /** Whether #UD needs to be intercepted (required by certain GIM providers). */
+    bool                        fGIMTrapXcptUD;
+    /** Whether paravirt. hypercalls are enabled. */
+    bool                        fHypercallsEnabled;
+    uint8_t                     u8Alignment0[5];
 
     /** World switch exit counter. */
     volatile uint32_t           cWorldSwitchExits;
@@ -609,18 +636,11 @@ typedef struct HMCPU
 
     struct
     {
-        /** Physical address of the VM control structure (VMCS). */
-        RTHCPHYS                    HCPhysVmcs;
-        /** R0 memory object for the VM control structure (VMCS). */
-        RTR0MEMOBJ                  hMemObjVmcs;
-        /** Virtual address of the VM control structure (VMCS). */
-        R0PTRTYPE(void *)           pvVmcs;
         /** Ring 0 handlers for VT-x. */
         PFNHMVMXSTARTVM             pfnStartVM;
 #if HC_ARCH_BITS == 32
-        uint32_t                    u32Alignment1;
+        uint32_t                    u32Alignment0;
 #endif
-
         /** Current VMX_VMCS32_CTRL_PIN_EXEC. */
         uint32_t                    u32PinCtls;
         /** Current VMX_VMCS32_CTRL_PROC_EXEC. */
@@ -632,16 +652,6 @@ typedef struct HMCPU
         /** Current VMX_VMCS32_CTRL_ENTRY. */
         uint32_t                    u32EntryCtls;
 
-        /** Physical address of the virtual APIC page for TPR caching. */
-        RTHCPHYS                    HCPhysVirtApic;
-        /** R0 memory object for the virtual APIC page for TPR caching. */
-        RTR0MEMOBJ                  hMemObjVirtApic;
-        /** Virtual address of the virtual APIC page for TPR caching. */
-        R0PTRTYPE(uint8_t *)        pbVirtApic;
-#if HC_ARCH_BITS == 32
-        uint32_t                    u32Alignment2;
-#endif
-
         /** Current CR0 mask. */
         uint32_t                    u32CR0Mask;
         /** Current CR4 mask. */
@@ -650,8 +660,21 @@ typedef struct HMCPU
         uint32_t                    u32XcptBitmap;
         /** The updated-guest-state mask. */
         volatile uint32_t           fUpdatedGuestState;
-        /** Current EPTP. */
-        RTHCPHYS                    HCPhysEPTP;
+        uint32_t                    u32Alignment1;
+
+        /** Physical address of the VM control structure (VMCS). */
+        RTHCPHYS                    HCPhysVmcs;
+        /** R0 memory object for the VM control structure (VMCS). */
+        RTR0MEMOBJ                  hMemObjVmcs;
+        /** Virtual address of the VM control structure (VMCS). */
+        R0PTRTYPE(void *)           pvVmcs;
+
+        /** Physical address of the virtual APIC page for TPR caching. */
+        RTHCPHYS                    HCPhysVirtApic;
+        /** R0 memory object for the virtual APIC page for TPR caching. */
+        RTR0MEMOBJ                  hMemObjVirtApic;
+        /** Virtual address of the virtual APIC page for TPR caching. */
+        R0PTRTYPE(uint8_t *)        pbVirtApic;
 
         /** Physical address of the MSR bitmap. */
         RTHCPHYS                    HCPhysMsrBitmap;
@@ -660,7 +683,6 @@ typedef struct HMCPU
         /** Virtual address of the MSR bitmap. */
         R0PTRTYPE(void *)           pvMsrBitmap;
 
-#ifdef VBOX_WITH_AUTO_MSR_LOAD_RESTORE
         /** Physical address of the VM-entry MSR-load and VM-exit MSR-store area (used
          *  for guest MSRs). */
         RTHCPHYS                    HCPhysGuestMsr;
@@ -678,13 +700,26 @@ typedef struct HMCPU
         /** Virtual address of the VM-exit MSR-load area (used for host MSRs). */
         R0PTRTYPE(void *)           pvHostMsr;
 
-        /** Number of automatically loaded/restored guest MSRs during
-         *  the world switch. */
-        uint32_t                    cGuestMsrs;
-        /** Number of automatically loaded/restored host MSRs during
-         *  the world switch. */
-        uint32_t                    cHostMsrs;
-#endif /* VBOX_WITH_AUTO_MSR_LOAD_RESTORE */
+        /** Current EPTP. */
+        RTHCPHYS                    HCPhysEPTP;
+
+        /** Number of guest/host MSR pairs in the auto-load/store area. */
+        uint32_t                    cMsrs;
+        /** Whether the host MSR values are up-to-date in the auto-load/store area. */
+        bool                        fUpdatedHostMsrs;
+        uint8_t                     u8Alignment0[3];
+
+        /** Host LSTAR MSR value to restore lazily while leaving VT-x. */
+        uint64_t                    u64HostLStarMsr;
+        /** Host STAR MSR value to restore lazily while leaving VT-x. */
+        uint64_t                    u64HostStarMsr;
+        /** Host SF_MASK MSR value to restore lazily while leaving VT-x. */
+        uint64_t                    u64HostSFMaskMsr;
+        /** Host KernelGS-Base MSR value to restore lazily while leaving VT-x. */
+        uint64_t                    u64HostKernelGSBaseMsr;
+        /** A mask of which MSRs have been swapped and need restoration. */
+        uint32_t                    fLazyMsrs;
+        uint32_t                    u32Alignment2;
 
         /** The cached APIC-base MSR used for identifying when to map the HC physical APIC-access page. */
         uint64_t                    u64MsrApicBase;
@@ -707,6 +742,7 @@ typedef struct HMCPU
             uint32_t                fRealOnV86Active;
         } RealMode;
 
+        /** VT-x error-reporting (mainly for ring-3 propagation). */
         struct
         {
             uint64_t                u64VMCSPhys;
@@ -715,54 +751,54 @@ typedef struct HMCPU
             uint32_t                u32ExitReason;
             RTCPUID                 idEnteredCpu;
             RTCPUID                 idCurrentCpu;
-            uint32_t                u32Padding;
+            uint32_t                u32Alignment0;
         } LastError;
 
-        /** State of the VMCS. */
+        /** Current state of the VMCS. */
         uint32_t                    uVmcsState;
         /** Which host-state bits to restore before being preempted. */
         uint32_t                    fRestoreHostFlags;
         /** The host-state restoration structure. */
         VMXRESTOREHOST              RestoreHost;
+
         /** Set if guest was executing in real mode (extra checks). */
         bool                        fWasInRealMode;
-        /** Padding.  */
-        uint32_t                    u32Padding;
+        uint8_t                     u8Alignment1[7];
     } vmx;
 
     struct
     {
-        /** R0 memory object for the host VMCB which holds additional host-state. */
-        RTR0MEMOBJ                  hMemObjVmcbHost;
+        /** Ring 0 handlers for VT-x. */
+        PFNHMSVMVMRUN               pfnVMRun;
+#if HC_ARCH_BITS == 32
+        uint32_t                    u32Alignment0;
+#endif
+
         /** Physical address of the host VMCB which holds additional host-state. */
         RTHCPHYS                    HCPhysVmcbHost;
+        /** R0 memory object for the host VMCB which holds additional host-state. */
+        RTR0MEMOBJ                  hMemObjVmcbHost;
         /** Virtual address of the host VMCB which holds additional host-state. */
         R0PTRTYPE(void *)           pvVmcbHost;
 
-        /** R0 memory object for the guest VMCB. */
-        RTR0MEMOBJ                  hMemObjVmcb;
         /** Physical address of the guest VMCB. */
         RTHCPHYS                    HCPhysVmcb;
+        /** R0 memory object for the guest VMCB. */
+        RTR0MEMOBJ                  hMemObjVmcb;
         /** Virtual address of the guest VMCB. */
         R0PTRTYPE(void *)           pvVmcb;
 
-        /** Ring 0 handlers for VT-x. */
-        PFNHMSVMVMRUN               pfnVMRun;
-
-        /** R0 memory object for the MSR bitmap (8 KB). */
-        RTR0MEMOBJ                  hMemObjMsrBitmap;
         /** Physical address of the MSR bitmap (8 KB). */
         RTHCPHYS                    HCPhysMsrBitmap;
+        /** R0 memory object for the MSR bitmap (8 KB). */
+        RTR0MEMOBJ                  hMemObjMsrBitmap;
         /** Virtual address of the MSR bitmap. */
         R0PTRTYPE(void *)           pvMsrBitmap;
 
         /** Whether VTPR with V_INTR_MASKING set is in effect, indicating
          *  we should check if the VTPR changed on every VM-exit. */
         bool                        fSyncVTpr;
-        uint8_t                     u8Align[7];
-
-        /** Alignment padding. */
-        uint32_t                    u32Padding;
+        uint8_t                     u8Alignment0[7];
     } svm;
 
     /** Event injection state. */
@@ -792,7 +828,7 @@ typedef struct HMCPU
     {
         /** Pending IO operation type. */
         HMPENDINGIO             enmType;
-        uint32_t                uPadding;
+        uint32_t                u32Alignment0;
         RTGCPTR                 GCPtrRip;
         RTGCPTR                 GCPtrRipNext;
         union
@@ -823,9 +859,14 @@ typedef struct HMCPU
     {
         RTGCPTR             aPages[HM_MAX_TLB_SHOOTDOWN_PAGES];
         uint32_t            cPages;
-        uint32_t            u32Padding; /**< Explicit alignment padding. */
+        uint32_t            u32Alignment0; /**< Explicit alignment padding. */
     } TlbShootdown;
 
+    /** VT-x/AMD-V VM-exit/#VMXEXIT history, circular array. */
+    uint16_t                auExitHistory[31];
+    /** The index of the next free slot in the history array. */
+    uint16_t                idxExitHistoryFree;
+
     /** For saving stack space, the disassembler state is allocated here instead of
      * on the stack. */
     DISCPUSTATE             DisState;
@@ -859,6 +900,7 @@ typedef struct HMCPU
     STAMCOUNTER             StatExitGuestUD;
     STAMCOUNTER             StatExitGuestSS;
     STAMCOUNTER             StatExitGuestNP;
+    STAMCOUNTER             StatExitGuestTS;
     STAMCOUNTER             StatExitGuestGP;
     STAMCOUNTER             StatExitGuestDE;
     STAMCOUNTER             StatExitGuestDB;
@@ -874,6 +916,7 @@ typedef struct HMCPU
     STAMCOUNTER             StatExitRdtsc;
     STAMCOUNTER             StatExitRdtscp;
     STAMCOUNTER             StatExitRdpmc;
+    STAMCOUNTER             StatExitVmcall;
     STAMCOUNTER             StatExitRdrand;
     STAMCOUNTER             StatExitCli;
     STAMCOUNTER             StatExitSti;
@@ -898,7 +941,6 @@ typedef struct HMCPU
     STAMCOUNTER             StatExitIOStringWrite;
     STAMCOUNTER             StatExitIOStringRead;
     STAMCOUNTER             StatExitIntWindow;
-    STAMCOUNTER             StatExitMaxResume;
     STAMCOUNTER             StatExitExtInt;
     STAMCOUNTER             StatExitHostNmiInGC;
     STAMCOUNTER             StatExitPreemptTimer;
@@ -930,10 +972,13 @@ typedef struct HMCPU
     STAMCOUNTER             StatSwitchHmToR3FF;
     STAMCOUNTER             StatSwitchExitToR3;
     STAMCOUNTER             StatSwitchLongJmpToR3;
+    STAMCOUNTER             StatSwitchMaxResumeLoops;
+    STAMCOUNTER             StatSwitchHltToR3;
+    STAMCOUNTER             StatSwitchApicAccessToR3;
 
+    STAMCOUNTER             StatTscParavirt;
     STAMCOUNTER             StatTscOffset;
     STAMCOUNTER             StatTscIntercept;
-    STAMCOUNTER             StatTscInterceptOverFlow;
 
     STAMCOUNTER             StatExitReasonNpf;
     STAMCOUNTER             StatDRxArmed;
@@ -968,23 +1013,25 @@ typedef struct HMCPU
     STAMPROFILEADV          StatExitDispatch;
 #endif
 } HMCPU;
-/** Pointer to HM VM instance data. */
+/** Pointer to HM VMCPU instance data. */
 typedef HMCPU *PHMCPU;
+AssertCompileMemberAlignment(HMCPU, vmx, 8);
+AssertCompileMemberAlignment(HMCPU, svm, 8);
+AssertCompileMemberAlignment(HMCPU, Event, 8);
 
 
 #ifdef IN_RING0
-
 VMMR0DECL(PHMGLOBALCPUINFO) HMR0GetCurrentCpu(void);
 VMMR0DECL(PHMGLOBALCPUINFO) HMR0GetCurrentCpuEx(RTCPUID idCpu);
 
 
-#ifdef VBOX_STRICT
+# ifdef VBOX_STRICT
 VMMR0DECL(void) HMDumpRegs(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
 VMMR0DECL(void) HMR0DumpDescriptor(PCX86DESCHC pDesc, RTSEL Sel, const char *pszMsg);
-#else
-# define HMDumpRegs(a, b ,c)            do { } while (0)
-# define HMR0DumpDescriptor(a, b, c)    do { } while (0)
-#endif
+# else
+#  define HMDumpRegs(a, b ,c)            do { } while (0)
+#  define HMR0DumpDescriptor(a, b, c)    do { } while (0)
+# endif /* VBOX_STRICT */
 
 # ifdef VBOX_WITH_KERNEL_USING_XMM
 DECLASM(int) HMR0VMXStartVMWrapXMM(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu, PFNHMVMXSTARTVM pfnStartVM);
@@ -1004,7 +1051,7 @@ DECLASM(void) HMR0Get64bitGdtrAndIdtr(PX86XDTR64 pGdtr, PX86XDTR64 pIdtr);
  * @returns CR3
  */
 DECLASM(uint64_t) HMR0Get64bitCR3(void);
-# endif
+# endif  /* VBOX_WITH_HYBRID_32BIT_KERNEL */
 
 #endif /* IN_RING0 */
 
diff --git a/src/VBox/VMM/include/HMInternal.mac b/src/VBox/VMM/include/HMInternal.mac
index 02ae331..6345dbd 100644
--- a/src/VBox/VMM/include/HMInternal.mac
+++ b/src/VBox/VMM/include/HMInternal.mac
@@ -20,8 +20,6 @@
  %endif
 %endif
 
-%define VBOX_WITH_AUTO_MSR_LOAD_RESTORE
-
 ;Maximum number of cached entries.
 %define VMCSCACHE_MAX_ENTRY                             128
 
@@ -64,3 +62,28 @@ struc VMCSCACHE
 %endif
 endstruc
 
+
+struc HMCPU
+        .fForceTLBFlush         resb    1
+        .fActive                resb    1
+        .fCheckedTLBFlush       resb    1
+        .fSingleInstruction     resb    1
+        .fClearTrapFlag         resb    1
+        .fLeaveDone             resb    1
+        .fUsingHyperDR7         resb    1
+        .fPreloadGuestFpu       resb    1
+        .fLoadSaveGuestXcr0     resb    1
+        .fGIMTrapXcptUD         resb    1
+        .fHypercallsEnabled     resb    1
+        alignb 8
+        .cWorldSwitchExits      resd    1
+        .fContextUseFlags       resd    1
+        .idLastCpu              resd    1
+        .cTlbFlushes            resd    1
+        .uCurrentAsid           resd    1
+        .u32HMError             resd    1
+        alignb 8
+        .u64HostTscAux          resq    1
+
+        ; incomplete to save unnecessary pain...
+endstruc
diff --git a/src/VBox/VMM/include/IEMInternal.h b/src/VBox/VMM/include/IEMInternal.h
index 7b1b25a..5b6a708 100644
--- a/src/VBox/VMM/include/IEMInternal.h
+++ b/src/VBox/VMM/include/IEMInternal.h
@@ -189,11 +189,11 @@ typedef IEMVERIFYEVTREC *PIEMVERIFYEVTREC;
  */
 typedef struct IEMCPU
 {
-    /** Pointer to the CPU context - ring-3 contex. */
+    /** Pointer to the CPU context - ring-3 context. */
     R3PTRTYPE(PCPUMCTX)     pCtxR3;
-    /** Pointer to the CPU context - ring-0 contex. */
+    /** Pointer to the CPU context - ring-0 context. */
     R0PTRTYPE(PCPUMCTX)     pCtxR0;
-    /** Pointer to the CPU context - raw-mode contex. */
+    /** Pointer to the CPU context - raw-mode context. */
     RCPTRTYPE(PCPUMCTX)     pCtxRC;
 
     /** Offset of the VMCPU structure relative to this structure (negative). */
@@ -372,22 +372,12 @@ typedef struct IEMCPU
 
     /** @name Target CPU information.
      * @{ */
-    /** EDX value of CPUID(1).
-     * @remarks Some bits are subject to change and must be queried dynamically. */
-    uint32_t                fCpuIdStdFeaturesEdx;
-    /** ECX value of CPUID(1).
-     * @remarks Some bits are subject to change and must be queried dynamically. */
-    uint32_t                fCpuIdStdFeaturesEcx;
     /** The CPU vendor. */
     CPUMCPUVENDOR           enmCpuVendor;
     /** @} */
 
     /** @name Host CPU information.
      * @{ */
-    /** EDX value of CPUID(1). */
-    uint32_t                fHostCpuIdStdFeaturesEdx;
-    /** ECX value of CPUID(1). */
-    uint32_t                fHostCpuIdStdFeaturesEcx;
     /** The CPU vendor. */
     CPUMCPUVENDOR           enmHostCpuVendor;
     /** @} */
@@ -522,6 +512,23 @@ typedef IEMCPU const *PCIEMCPU;
 /** @} */
 
 /**
+ * Possible hardware task switch sources.
+ */
+typedef enum IEMTASKSWITCH
+{
+    /** Task switch caused by an interrupt/exception. */
+    IEMTASKSWITCH_INT_XCPT = 1,
+    /** Task switch caused by a far CALL. */
+    IEMTASKSWITCH_CALL,
+    /** Task switch caused by a far JMP. */
+    IEMTASKSWITCH_JUMP,
+    /** Task switch caused by an IRET. */
+    IEMTASKSWITCH_IRET
+} IEMTASKSWITCH;
+AssertCompileSize(IEMTASKSWITCH, 4);
+
+
+/**
  * Tests if verification mode is enabled.
  *
  * This expands to @c false when IEM_VERIFICATION_MODE is not defined and
diff --git a/src/VBox/VMM/include/IOMInternal.h b/src/VBox/VMM/include/IOMInternal.h
index 1b80383..078e768 100644
--- a/src/VBox/VMM/include/IOMInternal.h
+++ b/src/VBox/VMM/include/IOMInternal.h
@@ -319,13 +319,9 @@ typedef struct IOM
     /** Pointer to the trees - R0 ptr. */
     R0PTRTYPE(PIOMTREES)            pTreesR0;
 
-    /** The ring-0 address of IOMMMIOHandler. */
-    R0PTRTYPE(PFNPGMR0PHYSHANDLER)  pfnMMIOHandlerR0;
-    /** The RC address of IOMMMIOHandler. */
-    RCPTRTYPE(PFNPGMRCPHYSHANDLER)  pfnMMIOHandlerRC;
-#if HC_ARCH_BITS == 64
-    RTRCPTR                         padding;
-#endif
+    /** MMIO physical access handler type.   */
+    PGMPHYSHANDLERTYPE              hMmioHandlerType;
+    uint32_t                        u32Padding;
 
     /** Lock serializing EMT access to IOM. */
 #ifdef IOM_WITH_CRIT_SECT_RW
@@ -425,12 +421,10 @@ void                iomMmioFreeRange(PVM pVM, PIOMMMIORANGE pRange);
 PIOMMMIOSTATS       iomR3MMIOStatsCreate(PVM pVM, RTGCPHYS GCPhys, const char *pszDesc);
 #endif /* IN_RING3 */
 
-VMMDECL(int)        IOMMMIOHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault,
-                                   RTGCPHYS GCPhysFault, void *pvUser);
-#ifdef IN_RING3
-DECLCALLBACK(int)   IOMR3MMIOHandler(PVM pVM, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
-                                     PGMACCESSTYPE enmAccessType, void *pvUser);
+#ifndef IN_RING3
+DECLEXPORT(FNPGMRZPHYSPFHANDLER)    iomMmioPfHandler;
 #endif
+PGM_ALL_CB2_DECL(FNPGMPHYSHANDLER)  iomMmioHandler;
 
 /* IOM locking helpers. */
 #ifdef IOM_WITH_CRIT_SECT_RW
diff --git a/src/VBox/VMM/include/PATMA.h b/src/VBox/VMM/include/PATMA.h
index cfe44f2..cf53e51 100644
--- a/src/VBox/VMM/include/PATMA.h
+++ b/src/VBox/VMM/include/PATMA.h
@@ -1,10 +1,10 @@
 /* $Id: PATMA.h $ */
 /** @file
- * PATM macros & definitions (identical to PATMA.mac!!)
+ * PATM macros & definitions (identical to PATMA.mac!).
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -18,66 +18,81 @@
 #ifndef ___PATMA_H
 #define ___PATMA_H
 
-
-#define PATM_VMFLAGS                            0xF1ABCD00
+/** @name Patch Fixup Types
+ * @remarks These fixups types are part of the saved state.
+ * @{ */
+#define PATM_ASMFIX_VMFLAGS                     0xF1ABCD00
 #ifdef VBOX_WITH_STATISTICS
-#define PATM_ALLPATCHCALLS                      0xF1ABCD01
-#define PATM_PERPATCHCALLS                      0xF1ABCD02
+# define PATM_ASMFIX_ALLPATCHCALLS              0xF1ABCD01
+# define PATM_ASMFIX_PERPATCHCALLS              0xF1ABCD02
 #endif
-#define PATM_JUMPDELTA                          0xF1ABCD03
+#define PATM_ASMFIX_JUMPDELTA                   0xF1ABCD03
 #ifdef VBOX_WITH_STATISTICS
-#define PATM_IRETEFLAGS                         0xF1ABCD04
-#define PATM_IRETCS                             0xF1ABCD05
-#define PATM_IRETEIP                            0xF1ABCD06
+# define PATM_ASMFIX_IRETEFLAGS                 0xF1ABCD04
+# define PATM_ASMFIX_IRETCS                     0xF1ABCD05
+# define PATM_ASMFIX_IRETEIP                    0xF1ABCD06
 #endif
-#define PATM_FIXUP                              0xF1ABCD07
-#define PATM_PENDINGACTION                      0xF1ABCD08
-#define PATM_CPUID_STD_PTR                      0xF1ABCD09
-#define PATM_CPUID_EXT_PTR                      0xF1ABCD0a
-#define PATM_CPUID_DEF_PTR                      0xF1ABCD0b
-#define PATM_STACKBASE                          0xF1ABCD0c    /** Stack to store our private patch return addresses */
-#define PATM_STACKBASE_GUEST                    0xF1ABCD0d    /** Stack to store guest return addresses */
-#define PATM_STACKPTR                           0xF1ABCD0e
-#define PATM_PATCHBASE                          0xF1ABCD0f
-#define PATM_INTERRUPTFLAG                      0xF1ABCD10
-#define PATM_INHIBITIRQADDR                     0xF1ABCD11
-#define PATM_VM_FORCEDACTIONS                   0xF1ABCD12
-#define PATM_TEMP_EAX                           0xF1ABCD13      /** Location for original EAX register */
-#define PATM_TEMP_ECX                           0xF1ABCD14      /** Location for original ECX register */
-#define PATM_TEMP_EDI                           0xF1ABCD15      /** Location for original EDI register */
-#define PATM_TEMP_EFLAGS                        0xF1ABCD16      /** Location for original eflags */
-#define PATM_TEMP_RESTORE_FLAGS                 0xF1ABCD17      /** Which registers to restore */
-#define PATM_CALL_PATCH_TARGET_ADDR             0xF1ABCD18
-#define PATM_CALL_RETURN_ADDR                   0xF1ABCD19
-#define PATM_CPUID_CENTAUR_PTR                  0xF1ABCD1a
+#define PATM_ASMFIX_FIXUP                       0xF1ABCD07
+#define PATM_ASMFIX_PENDINGACTION               0xF1ABCD08
+#define PATM_ASMFIX_CPUID_STD_PTR               0xF1ABCD09  /**< Legacy, saved state only. */
+#define PATM_ASMFIX_CPUID_EXT_PTR               0xF1ABCD0a  /**< Legacy, saved state only. */
+#define PATM_ASMFIX_CPUID_DEF_PTR               0xF1ABCD0b  /**< Legacy, saved state only. */
+#define PATM_ASMFIX_STACKBASE                   0xF1ABCD0c  /**< Stack to store our private patch return addresses */
+#define PATM_ASMFIX_STACKBASE_GUEST             0xF1ABCD0d  /**< Stack to store guest return addresses */
+#define PATM_ASMFIX_STACKPTR                    0xF1ABCD0e
+#define PATM_ASMFIX_PATCHBASE                   0xF1ABCD0f
+#define PATM_ASMFIX_INTERRUPTFLAG               0xF1ABCD10
+#define PATM_ASMFIX_INHIBITIRQADDR              0xF1ABCD11
+#define PATM_ASMFIX_VM_FORCEDACTIONS            0xF1ABCD12
+#define PATM_ASMFIX_TEMP_EAX                    0xF1ABCD13  /**< Location for original EAX register */
+#define PATM_ASMFIX_TEMP_ECX                    0xF1ABCD14  /**< Location for original ECX register */
+#define PATM_ASMFIX_TEMP_EDI                    0xF1ABCD15  /**< Location for original EDI register */
+#define PATM_ASMFIX_TEMP_EFLAGS                 0xF1ABCD16  /**< Location for original eflags */
+#define PATM_ASMFIX_TEMP_RESTORE_FLAGS          0xF1ABCD17  /**< Which registers to restore */
+#define PATM_ASMFIX_CALL_PATCH_TARGET_ADDR      0xF1ABCD18
+#define PATM_ASMFIX_CALL_RETURN_ADDR            0xF1ABCD19
+#define PATM_ASMFIX_CPUID_CENTAUR_PTR           0xF1ABCD1a  /**< Legacy, saved state only. */
+#define PATM_ASMFIX_REUSE_LATER_0               0xF1ABCD1b
+#define PATM_ASMFIX_REUSE_LATER_1               0xF1ABCD1c
+#define PATM_ASMFIX_REUSE_LATER_2               0xF1ABCD1d
+#define PATM_ASMFIX_REUSE_LATER_3               0xF1ABCD1e
+#define PATM_ASMFIX_HELPER_CPUM_CPUID           0xF1ABCD1f
 
 /* Anything larger doesn't require a fixup */
-#define PATM_NO_FIXUP                           0xF1ABCE00
-#define PATM_CPUID_STD_MAX                      0xF1ABCE00
-#define PATM_CPUID_EXT_MAX                      0xF1ABCE01
-#define PATM_RETURNADDR                         0xF1ABCE02
-#define PATM_PATCHNEXTBLOCK                     0xF1ABCE03
-#define PATM_CALLTARGET                         0xF1ABCE04    /** relative call target */
-#define PATM_NEXTINSTRADDR                      0xF1ABCE05    /** absolute guest address of the next instruction */
-#define PATM_CURINSTRADDR                       0xF1ABCE06    /** absolute guest address of the current instruction */
-#define PATM_LOOKUP_AND_CALL_FUNCTION           0xF1ABCE07    /** Relative address of global PATM lookup and call function. */
-#define PATM_RETURN_FUNCTION                    0xF1ABCE08    /** Relative address of global PATM return function. */
-#define PATM_LOOKUP_AND_JUMP_FUNCTION           0xF1ABCE09    /** Relative address of global PATM lookup and jump function. */
-#define PATM_IRET_FUNCTION                      0xF1ABCE0A    /** Relative address of global PATM iret function. */
-#define PATM_CPUID_CENTAUR_MAX                  0xF1ABCE0B
-
-// everything except IOPL, NT, IF, VM, VIF, VIP and RF
-#define PATM_FLAGS_MASK                         (X86_EFL_CF|X86_EFL_PF|X86_EFL_AF|X86_EFL_ZF|X86_EFL_SF|X86_EFL_TF|X86_EFL_DF|X86_EFL_OF|X86_EFL_AC|X86_EFL_ID)
-
-// currently only IF & IOPL
-#define PATM_VIRTUAL_FLAGS_MASK                 (X86_EFL_IF|X86_EFL_IOPL)
+#define PATM_ASMFIX_NO_FIXUP                    0xF1ABCE00
+#define PATM_ASMFIX_CPUID_STD_MAX               0xF1ABCE00
+#define PATM_ASMFIX_CPUID_EXT_MAX               0xF1ABCE01
+#define PATM_ASMFIX_RETURNADDR                  0xF1ABCE02
+#define PATM_ASMFIX_PATCHNEXTBLOCK              0xF1ABCE03
+#define PATM_ASMFIX_CALLTARGET                  0xF1ABCE04  /**< relative call target */
+#define PATM_ASMFIX_NEXTINSTRADDR               0xF1ABCE05  /**< absolute guest address of the next instruction */
+#define PATM_ASMFIX_CURINSTRADDR                0xF1ABCE06  /**< absolute guest address of the current instruction */
+#define PATM_ASMFIX_LOOKUP_AND_CALL_FUNCTION    0xF1ABCE07  /**< Relative address of global PATM lookup and call function. */
+#define PATM_ASMFIX_RETURN_FUNCTION             0xF1ABCE08  /**< Relative address of global PATM return function. */
+#define PATM_ASMFIX_LOOKUP_AND_JUMP_FUNCTION    0xF1ABCE09  /**< Relative address of global PATM lookup and jump function. */
+#define PATM_ASMFIX_IRET_FUNCTION               0xF1ABCE0A  /**< Relative address of global PATM iret function. */
+#define PATM_ASMFIX_CPUID_CENTAUR_MAX           0xF1ABCE0B
+
+/** Identifies an patch fixup type value (with reasonable accuracy). */
+#define PATM_IS_ASMFIX(a_uValue) \
+    ( ((a_uValue) & UINT32_C(0xfffffC00)) == UINT32_C(0xF1ABCC00) && ((a_uValue) & UINT32_C(0xff)) < UINT32_C(0x30) )
+/** @} */
+
+
+/** Everything except IOPL, NT, IF, VM, VIF, VIP and RF */
+#define PATM_FLAGS_MASK                         (  X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF \
+                                                 | X86_EFL_TF | X86_EFL_DF | X86_EFL_OF | X86_EFL_AC | X86_EFL_ID)
+
+/** Flags that PATM virtualizes. Currently only IF & IOPL. */
+#define PATM_VIRTUAL_FLAGS_MASK                 (X86_EFL_IF | X86_EFL_IOPL)
 
 /* PATM stack size (identical in PATMA.mac!!) */
-#define PATM_STACK_SIZE                         (PAGE_SIZE)
-#define PATM_STACK_TOTAL_SIZE                   (2*PATM_STACK_SIZE)
+#define PATM_STACK_SIZE                         (4096)
+#define PATM_STACK_TOTAL_SIZE                   (2 * PATM_STACK_SIZE)
 #define PATM_MAX_STACK                          (PATM_STACK_SIZE/sizeof(RTRCPTR))
 
-/* Patch Manager pending actions (in GCSTATE). */
+/** @name Patch Manager pending actions (in GCSTATE).
+ * @{  */
 #define PATM_ACTION_LOOKUP_ADDRESS              1
 #define PATM_ACTION_DISPATCH_PENDING_IRQ        2
 #define PATM_ACTION_PENDING_IRQ_AFTER_IRET      3
@@ -92,25 +107,51 @@
 #define PATM_ACTION_LOG_RET                     12
 #define PATM_ACTION_LOG_CALL                    13
 #define PATM_ACTION_LOG_GATE_ENTRY              14
+/** @} */
 
-/* Magic dword found in ecx for patm pending actions. */
+/** Magic dword found in ecx for patm pending actions. */
 #define PATM_ACTION_MAGIC                       0xABCD4321
 
-/** PATM_TEMP_RESTORE_FLAGS */
+/** @name PATM_ASMFIX_TEMP_RESTORE_FLAGS
+ * @{ */
 #define PATM_RESTORE_EAX                        RT_BIT(0)
 #define PATM_RESTORE_ECX                        RT_BIT(1)
 #define PATM_RESTORE_EDI                        RT_BIT(2)
+/** @} */
 
+/** Relocation entry for PATCHASMRECORD. */
+typedef struct PATCHASMRELOC
+{
+    /** The relocation type. */
+    uint32_t uType;
+    /** Additional information specific to the relocation type. */
+    uint32_t uInfo;
+} PATCHASMRELOC;
+typedef PATCHASMRELOC const *PCPATCHASMRELOC;
+
+/**
+ * Assembly patch descriptor record.
+ */
 typedef struct
 {
-    uint8_t *pFunction;
-    uint32_t offJump;
-    uint32_t offRelJump;        //used only by loop/loopz/loopnz
-    uint32_t offSizeOverride;   //size override byte position
-    uint32_t size;
-    uint32_t nrRelocs;
-    uint32_t uReloc[1];
-} PATCHASMRECORD, *PPATCHASMRECORD;
+    /** Pointer to the patch code. */
+    uint8_t        *pbFunction;
+    /** Offset of the jump table? */
+    uint32_t        offJump;
+    /** Used only by loop/loopz/loopnz. */
+    uint32_t        offRelJump;
+    /** Size override byte position. */
+    uint32_t        offSizeOverride;
+    /** The size of the patch function. */
+    uint32_t        cbFunction;
+    /** The number of relocations in aRelocs. */
+    uint32_t        cRelocs;
+    /** Variable sized relocation table. */
+    PATCHASMRELOC   aRelocs[1];
+} PATCHASMRECORD;
+/** Pointer to a const patch descriptor record. */
+typedef PATCHASMRECORD const *PCPATCHASMRECORD;
+
 
 /* For indirect calls/jump (identical in PATMA.h & PATMA.mac!) */
 /** @note MUST BE A POWER OF TWO! */
@@ -136,52 +177,55 @@ typedef struct
 
 RT_C_DECLS_BEGIN
 
-extern PATCHASMRECORD PATMCliRecord;
-extern PATCHASMRECORD PATMStiRecord;
-extern PATCHASMRECORD PATMPopf32Record;
-extern PATCHASMRECORD PATMPopf16Record;
-extern PATCHASMRECORD PATMPopf16Record_NoExit;
-extern PATCHASMRECORD PATMPopf32Record_NoExit;
-extern PATCHASMRECORD PATMPushf32Record;
-extern PATCHASMRECORD PATMPushf16Record;
-extern PATCHASMRECORD PATMIretRecord;
-extern PATCHASMRECORD PATMIretRing1Record;
-extern PATCHASMRECORD PATMCpuidRecord;
-extern PATCHASMRECORD PATMLoopRecord;
-extern PATCHASMRECORD PATMLoopZRecord;
-extern PATCHASMRECORD PATMLoopNZRecord;
-extern PATCHASMRECORD PATMJEcxRecord;
-extern PATCHASMRECORD PATMIntEntryRecord;
-extern PATCHASMRECORD PATMIntEntryRecordErrorCode;
-extern PATCHASMRECORD PATMTrapEntryRecord;
-extern PATCHASMRECORD PATMTrapEntryRecordErrorCode;
-extern PATCHASMRECORD PATMPushCSRecord;
-
-extern PATCHASMRECORD PATMCheckIFRecord;
+/** @name Patch Descriptor Records (in PATMA.asm)
+ * @{ */
+extern PATCHASMRECORD g_patmCliRecord;
+extern PATCHASMRECORD g_patmStiRecord;
+extern PATCHASMRECORD g_patmPopf32Record;
+extern PATCHASMRECORD g_patmPopf16Record;
+extern PATCHASMRECORD g_patmPopf16Record_NoExit;
+extern PATCHASMRECORD g_patmPopf32Record_NoExit;
+extern PATCHASMRECORD g_patmPushf32Record;
+extern PATCHASMRECORD g_patmPushf16Record;
+extern PATCHASMRECORD g_patmIretRecord;
+extern PATCHASMRECORD g_patmIretRing1Record;
+extern PATCHASMRECORD g_patmCpuidRecord;
+extern PATCHASMRECORD g_patmLoopRecord;
+extern PATCHASMRECORD g_patmLoopZRecord;
+extern PATCHASMRECORD g_patmLoopNZRecord;
+extern PATCHASMRECORD g_patmJEcxRecord;
+extern PATCHASMRECORD g_patmIntEntryRecord;
+extern PATCHASMRECORD g_patmIntEntryRecordErrorCode;
+extern PATCHASMRECORD g_patmTrapEntryRecord;
+extern PATCHASMRECORD g_patmTrapEntryRecordErrorCode;
+extern PATCHASMRECORD g_patmPushCSRecord;
+
+extern PATCHASMRECORD g_patmCheckIFRecord;
 extern PATCHASMRECORD PATMJumpToGuest_IF1Record;
 
-extern PATCHASMRECORD PATMCallRecord;
-extern PATCHASMRECORD PATMCallIndirectRecord;
-extern PATCHASMRECORD PATMRetRecord;
-extern PATCHASMRECORD PATMJumpIndirectRecord;
+extern PATCHASMRECORD g_patmCallRecord;
+extern PATCHASMRECORD g_patmCallIndirectRecord;
+extern PATCHASMRECORD g_patmRetRecord;
+extern PATCHASMRECORD g_patmJumpIndirectRecord;
 
-extern PATCHASMRECORD PATMLookupAndCallRecord;
-extern PATCHASMRECORD PATMRetFunctionRecord;
-extern PATCHASMRECORD PATMLookupAndJumpRecord;
-extern PATCHASMRECORD PATMIretFunctionRecord;
+extern PATCHASMRECORD g_patmLookupAndCallRecord;
+extern PATCHASMRECORD g_patmRetFunctionRecord;
+extern PATCHASMRECORD g_patmLookupAndJumpRecord;
+extern PATCHASMRECORD g_patmIretFunctionRecord;
 
-extern PATCHASMRECORD PATMStatsRecord;
+extern PATCHASMRECORD g_patmStatsRecord;
 
-extern PATCHASMRECORD PATMSetPIFRecord;
-extern PATCHASMRECORD PATMClearPIFRecord;
+extern PATCHASMRECORD g_patmSetPIFRecord;
+extern PATCHASMRECORD g_patmClearPIFRecord;
 
-extern PATCHASMRECORD PATMSetInhibitIRQRecord;
-extern PATCHASMRECORD PATMClearInhibitIRQFaultIF0Record;
-extern PATCHASMRECORD PATMClearInhibitIRQContIF0Record;
+extern PATCHASMRECORD g_patmSetInhibitIRQRecord;
+extern PATCHASMRECORD g_patmClearInhibitIRQFaultIF0Record;
+extern PATCHASMRECORD g_patmClearInhibitIRQContIF0Record;
 
-extern PATCHASMRECORD PATMMovFromSSRecord;
+extern PATCHASMRECORD g_patmMovFromSSRecord;
+/** @} */
 
-extern const uint32_t PATMInterruptFlag;
+extern const uint32_t g_fPatmInterruptFlag;
 
 RT_C_DECLS_END
 
diff --git a/src/VBox/VMM/include/PATMInternal.h b/src/VBox/VMM/include/PATMInternal.h
index 837f9ed..525cb14 100644
--- a/src/VBox/VMM/include/PATMInternal.h
+++ b/src/VBox/VMM/include/PATMInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -31,13 +31,17 @@
 
 /** @name Saved state version numbers.
  * @{ */
+/** New concept of helper code (for CPUID). */
+#define PATM_SAVED_STATE_VERSION                    58
+/** New fixup type FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL. */
+#define PATM_SAVED_STATE_VERSION_FORGET_THIS_ONE    57
 /** Uses normal structure serialization with markers and everything. */
-#define PATM_SSM_VERSION                    56
+#define PATM_SAVED_STATE_VERSION_NO_RAW_MEM         56
 /** Last version which saves structures as raw memory. */
-#define PATM_SSM_VERSION_MEM                55
-#define PATM_SSM_VERSION_FIXUP_HACK         54
-#define PATM_SSM_VERSION_FIXUP_HACK         54
-#define PATM_SSM_VERSION_VER16              53
+#define PATM_SAVED_STATE_VERSION_MEM                55
+#define PATM_SAVED_STATE_VERSION_FIXUP_HACK         54
+#define PATM_SAVED_STATE_VERSION_FIXUP_HACK         54
+#define PATM_SAVED_STATE_VERSION_VER16              53
 /** @}  */
 
 /* Enable for call patching. */
@@ -65,7 +69,7 @@
 #define PATMFL_CODE_MONITORED               RT_BIT_64(24) /** code pages of guest monitored for self-modifying code. */
 #define PATMFL_CALLABLE_AS_FUNCTION         RT_BIT_64(25) /** cli and pushf blocks can be used as callable functions. */
 #define PATMFL_GLOBAL_FUNCTIONS             RT_BIT_64(26) /** fake patch for global patm functions. */
-#define PATMFL_TRAMPOLINE                   RT_BIT_64(27) /** trampoline patch that clears PATM_INTERRUPTFLAG and jumps to patch destination */
+#define PATMFL_TRAMPOLINE                   RT_BIT_64(27) /** trampoline patch that clears PATM_ASMFIX_INTERRUPTFLAG and jumps to patch destination */
 #define PATMFL_GENERATE_SETPIF              RT_BIT_64(28) /** generate set PIF for the next instruction */
 #define PATMFL_INSTR_HINT                   RT_BIT_64(29) /** Generate patch, but don't activate it. */
 #define PATMFL_PATCHED_GUEST_CODE           RT_BIT_64(30) /** Patched guest code. */
@@ -97,9 +101,29 @@
 /* Maximum nr of invalid writes before a patch is disabled. */
 #define PATM_MAX_INVALID_WRITES            16384
 
+/** @name FIXUP_XXX - RELOCREC::uType values.
+ * @{ */
+/** Absolute fixup.  With one exception (MMIO cache), this does not take any
+ * source or destination.  @sa FIXUP_ABSOLUTE_ASM.  */
 #define FIXUP_ABSOLUTE                     0
 #define FIXUP_REL_JMPTOPATCH               1
 #define FIXUP_REL_JMPTOGUEST               2
+/** Absolute fixup in patch assembly code template.
+ *
+ * The source and desination addresses both set to the patch fixup type (see
+ * PATM_IS_ASMFIX and friends in PATMA.h).  This is recent addition (CPUID
+ * subleaf code), so when loading older saved states this is usally represented
+ * as FIXUP_ABSOLUTE. */
+#define FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL   3
+/** Constant value that only needs fixing up when loading state.  Structure
+ * size, member offset, or similar.  The source and destination address are set
+ * like for FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL.  */
+#define FIXUP_CONSTANT_IN_PATCH_ASM_TMPL   4
+/** Relative call to a patch helper routine in VMMRC.  The source and destination
+ * address are set like for FIXUP_ABSOLUTE_IN_PATCH_ASM_TMPL.  */
+#define FIXUP_REL_HELPER_IN_PATCH_ASM_TMPL 5
+/** @} */
+
 
 #define PATM_ILLEGAL_DESTINATION           0xDEADBEEF
 
@@ -152,9 +176,6 @@ typedef struct
     RTRCPTR                     pDest;
 } RELOCREC, *PRELOCREC;
 
-/* forward decl */
-struct _PATCHINFO;
-
 /* Cache record for guest to host pointer conversions. */
 typedef struct
 {
@@ -257,7 +278,7 @@ typedef struct TRAMPREC *PTRAMPREC;
 /**
  * Patch information.
  */
-typedef struct _PATCHINFO
+typedef struct PATCHINFO
 {
     /** Current patch state (enabled, disabled, etc.). */
     uint32_t                    uState;
@@ -429,10 +450,19 @@ typedef struct PATM
     /** Delta to the new relocated HMA area.
      * Used only during PATMR3Relocate(). */
     int32_t                     deltaReloc;
+
+    /** The ring-3 address of the PatchHlp segment (for PATMReadPatchCode). */
+    R3PTRTYPE(uint8_t *)        pbPatchHelpersR3;
+    /** The raw-mode address of the PatchHlp segment. */
+    RCPTRTYPE(uint8_t *)        pbPatchHelpersRC;
+    /** Size of the PatchHlp segment containing the callable helper code.   */
+    uint32_t                    cbPatchHelpers;
+
     /** GC PATM state pointer - HC pointer. */
     R3PTRTYPE(PPATMGCSTATE)     pGCStateHC;
     /** GC PATM state pointer - RC pointer. */
     RCPTRTYPE(PPATMGCSTATE)     pGCStateGC;
+
     /** PATM stack page for call instruction execution.
      * 2 parts: one for our private stack and one to store the original return
      * address. */
@@ -441,13 +471,15 @@ typedef struct PATM
     R3PTRTYPE(RTRCPTR *)        pGCStackHC;
     /** GC pointer to CPUMCTX structure. */
     RCPTRTYPE(PCPUMCTX)         pCPUMCtxGC;
+
     /** GC statistics pointer. */
     RCPTRTYPE(PSTAMRATIOU32)    pStatsGC;
     /** HC statistics pointer. */
     R3PTRTYPE(PSTAMRATIOU32)    pStatsHC;
-    /* Current free index value (uPatchRun/uPatchTrap arrays). */
+
+    /** Current free index value (uPatchRun/uPatchTrap arrays). */
     uint32_t                    uCurrentPatchIdx;
-    /* Temporary counter for patch installation call depth. (in order not to go on forever) */
+    /** Temporary counter for patch installation call depth. (in order not to go on forever) */
     uint32_t                    ulCallDepth;
     /** Number of page lookup records. */
     uint32_t                    cPageRecords;
@@ -495,7 +527,11 @@ typedef struct PATM
     /** Debug module for the patch memory. */
     RTDBGMOD                    hDbgModPatchMem;
 
-#if HC_ARCH_BITS == 32
+    /** Virtual page access handler type (patmVirtPageHandler,
+     * PATMGCMonitorPage). */
+    PGMVIRTHANDLERTYPE          hMonitorPageType;
+
+#if HC_ARCH_BITS == 64
     /** Align statistics on a 8 byte boundary. */
     uint32_t                    u32Alignment1;
 #endif
@@ -562,8 +598,6 @@ typedef struct PATM
 
 
 
-DECLCALLBACK(int) patmVirtPageHandler(PVM pVM, RTGCPTR GCPtr, void *pvPtr, void *pvBuf, size_t cbBuf, PGMACCESSTYPE enmAccessType, void *pvUser);
-
 DECLCALLBACK(int) patmR3Save(PVM pVM, PSSMHANDLE pSSM);
 DECLCALLBACK(int) patmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
 
@@ -602,20 +636,7 @@ int             patmAddBranchToLookupCache(PVM pVM, RTRCPTR pJumpTableGC, RTRCPT
 R3PTRTYPE(uint8_t *) patmR3GCVirtToHCVirt(PVM pVM, PPATMP2GLOOKUPREC pCacheRec, RCPTRTYPE(uint8_t *) pGCPtr);
 
 RT_C_DECLS_BEGIN
-/**
- * #PF Virtual Handler callback for Guest access a page monitored by PATM
- *
- * @returns VBox status code (appropriate for trap handling and GC return).
- * @param   pVM         Pointer to the VM.
- * @param   uErrorCode   CPU Error code.
- * @param   pRegFrame   Trap register frame.
- * @param   pvFault     The fault address (cr2).
- * @param   pvRange     The base address of the handled virtual range.
- * @param   offRange    The offset of the access into this range.
- *                      (If it's a EIP range this is the EIP, if not it's pvFault.)
- */
-VMMRCDECL(int) PATMGCMonitorPage(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
-
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) patmRCVirtPagePfHandler;
 RT_C_DECLS_END
 
 /**
diff --git a/src/VBox/VMM/include/PDMInternal.h b/src/VBox/VMM/include/PDMInternal.h
index e247e73..7d32f63 100644
--- a/src/VBox/VMM/include/PDMInternal.h
+++ b/src/VBox/VMM/include/PDMInternal.h
@@ -580,6 +580,8 @@ typedef struct PDMAPIC
                                                      uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
     /** @copydoc PDMAPICREG::pfnLocalInterruptR3 */
     DECLR3CALLBACKMEMBER(int,       pfnLocalInterruptR3,(PPDMDEVINS pDevIns, uint8_t u8Pin, uint8_t u8Level));
+    /** @copydoc PDMAPICREG::pfnGetTimerFreqR3 */
+    DECLR3CALLBACKMEMBER(uint64_t,  pfnGetTimerFreqR3,(PPDMDEVINS pDevIns));
 
     /** Pointer to the APIC device instance - R0 Ptr. */
     PPDMDEVINSR0                    pDevInsR0;
@@ -604,6 +606,8 @@ typedef struct PDMAPIC
                                                      uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
     /** @copydoc PDMAPICREG::pfnLocalInterruptR3 */
     DECLR0CALLBACKMEMBER(int,       pfnLocalInterruptR0,(PPDMDEVINS pDevIns, uint8_t u8Pin, uint8_t u8Level));
+    /** @copydoc PDMAPICREG::pfnGetTimerFreqR3 */
+    DECLR0CALLBACKMEMBER(uint64_t,  pfnGetTimerFreqR0,(PPDMDEVINS pDevIns));
 
     /** Pointer to the APIC device instance - RC Ptr. */
     PPDMDEVINSRC                    pDevInsRC;
@@ -628,8 +632,8 @@ typedef struct PDMAPIC
                                                      uint8_t iVector, uint8_t u8Polarity, uint8_t u8TriggerMode, uint32_t uTagSrc));
     /** @copydoc PDMAPICREG::pfnLocalInterruptR3 */
     DECLRCCALLBACKMEMBER(int,       pfnLocalInterruptRC,(PPDMDEVINS pDevIns, uint8_t u8Pin, uint8_t u8Level));
-    RTRCPTR                         RCPtrAlignment;
-
+    /** @copydoc PDMAPICREG::pfnGetTimerFreqR3 */
+    DECLRCCALLBACKMEMBER(uint64_t,  pfnGetTimerFreqRC,(PPDMDEVINS pDevIns));
 } PDMAPIC;
 
 
@@ -1271,7 +1275,6 @@ DECLCALLBACK(bool) pdmR3DevHlpQueueConsumer(PVM pVM, PPDMQUEUEITEMCORE pItem);
 int         pdmR3UsbLoadModules(PVM pVM);
 int         pdmR3UsbInstantiateDevices(PVM pVM);
 PPDMUSB     pdmR3UsbLookup(PVM pVM, const char *pszName);
-int         pdmR3UsbFindLun(PVM pVM, const char *pszDevice, unsigned iInstance, unsigned iLun, PPDMLUN *ppLun);
 int         pdmR3UsbRegisterHub(PVM pVM, PPDMDRVINS pDrvIns, uint32_t fVersions, uint32_t cPorts, PCPDMUSBHUBREG pUsbHubReg, PPCPDMUSBHUBHLP ppUsbHubHlp);
 int         pdmR3UsbVMInitComplete(PVM pVM);
 
diff --git a/src/VBox/VMM/include/PGMInline.h b/src/VBox/VMM/include/PGMInline.h
index 995cad9..30f28d9 100644
--- a/src/VBox/VMM/include/PGMInline.h
+++ b/src/VBox/VMM/include/PGMInline.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -1199,50 +1199,6 @@ DECLINLINE(PPGMPHYSHANDLER) pgmHandlerPhysicalLookup(PVM pVM, RTGCPHYS GCPhys)
 
 
 /**
- * Gets the page state for a physical handler.
- *
- * @returns The physical handler page state.
- * @param   pCur    The physical handler in question.
- */
-DECLINLINE(unsigned) pgmHandlerPhysicalCalcState(PPGMPHYSHANDLER pCur)
-{
-    switch (pCur->enmType)
-    {
-        case PGMPHYSHANDLERTYPE_PHYSICAL_WRITE:
-            return PGM_PAGE_HNDL_PHYS_STATE_WRITE;
-
-        case PGMPHYSHANDLERTYPE_MMIO:
-        case PGMPHYSHANDLERTYPE_PHYSICAL_ALL:
-            return PGM_PAGE_HNDL_PHYS_STATE_ALL;
-
-        default:
-            AssertFatalMsgFailed(("Invalid type %d\n", pCur->enmType));
-    }
-}
-
-
-/**
- * Gets the page state for a virtual handler.
- *
- * @returns The virtual handler page state.
- * @param   pCur    The virtual handler in question.
- * @remarks This should never be used on a hypervisor access handler.
- */
-DECLINLINE(unsigned) pgmHandlerVirtualCalcState(PPGMVIRTHANDLER pCur)
-{
-    switch (pCur->enmType)
-    {
-        case PGMVIRTHANDLERTYPE_WRITE:
-            return PGM_PAGE_HNDL_VIRT_STATE_WRITE;
-        case PGMVIRTHANDLERTYPE_ALL:
-            return PGM_PAGE_HNDL_VIRT_STATE_ALL;
-        default:
-            AssertFatalMsgFailed(("Invalid type %d\n", pCur->enmType));
-    }
-}
-
-
-/**
  * Clears one physical page of a virtual handler.
  *
  * @param   pVM         Pointer to the VM.
diff --git a/src/VBox/VMM/include/PGMInternal.h b/src/VBox/VMM/include/PGMInternal.h
index fff44af..0b67d46 100644
--- a/src/VBox/VMM/include/PGMInternal.h
+++ b/src/VBox/VMM/include/PGMInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -39,6 +39,7 @@
 #include <iprt/assert.h>
 #include <iprt/avl.h>
 #include <iprt/critsect.h>
+#include <iprt/list-off32.h>
 #include <iprt/sha.h>
 
 
@@ -493,16 +494,16 @@ typedef X86PTPAE            PGMSHWPTPAE;
 
 #endif
 
-/** Pointer to a shadow PAE PTE.  */
+/** Pointer to a shadow PAE PTE. */
 typedef PGMSHWPTEPAE       *PPGMSHWPTEPAE;
-/** Pointer to a const shadow PAE PTE.  */
+/** Pointer to a const shadow PAE PTE. */
 typedef PGMSHWPTEPAE const *PCPGMSHWPTEPAE;
 
-/** Pointer to a shadow PAE page table.  */
+/** Pointer to a shadow PAE page table. */
 typedef PGMSHWPTPAE        *PPGMSHWPTPAE;
-/** Pointer to a const shadow PAE page table.  */
+/** Pointer to a const shadow PAE page table. */
 typedef PGMSHWPTPAE const  *PCPGMSHWPTPAE;
-/** @}  */
+/** @} */
 
 
 /** Size of the GCPtrConflict array in PGMMAPPING.
@@ -574,6 +575,48 @@ typedef struct PGMMAPPING *PPGMMAPPING;
 
 
 /**
+ * Physical page access handler type registration.
+ */
+typedef struct PGMPHYSHANDLERTYPEINT
+{
+    /** Number of references.   */
+    uint32_t volatile                   cRefs;
+    /** Magic number (PGMPHYSHANDLERTYPEINT_MAGIC). */
+    uint32_t                            u32Magic;
+    /** Link of handler types anchored in PGMTREES::HeadPhysHandlerTypes.   */
+    RTLISTOFF32NODE                     ListNode;
+    /** The kind of accesses we're handling. */
+    PGMPHYSHANDLERKIND                  enmKind;
+    /** The PGM_PAGE_HNDL_PHYS_STATE_XXX value corresponding to enmKind. */
+    uint32_t                            uState;
+    /** Pointer to RC callback function for \#PFs. */
+    RCPTRTYPE(PFNPGMRZPHYSPFHANDLER)    pfnPfHandlerRC;
+    /** Explicit alignment padding. */
+    RTRCPTR                             RCPtrPadding;
+    /** Pointer to R3 callback function. */
+    R3PTRTYPE(PFNPGMPHYSHANDLER)        pfnHandlerR3;
+    /** Pointer to R0 callback function for \#PFs. */
+    R0PTRTYPE(PFNPGMRZPHYSPFHANDLER)    pfnPfHandlerR0;
+    /** Description / Name. For easing debugging. */
+    R3PTRTYPE(const char *)             pszDesc;
+} PGMPHYSHANDLERTYPEINT;
+/** Pointer to a physical access handler type registration. */
+typedef PGMPHYSHANDLERTYPEINT *PPGMPHYSHANDLERTYPEINT;
+/** Magic value for the physical handler callbacks (Robert A. Heinlein). */
+#define PGMPHYSHANDLERTYPEINT_MAGIC        UINT32_C(0x19070707)
+/** Magic value for the physical handler callbacks. */
+#define PGMPHYSHANDLERTYPEINT_MAGIC_DEAD   UINT32_C(0x19880508)
+
+/**
+ * Converts a handle to a pointer.
+ * @returns PPGMPHYSHANDLERTYPEINT
+ * @param   a_pVM           Pointer to the cross context VM structure.
+ * @param   a_hType         Physical access handler type handle.
+ */
+#define PGMPHYSHANDLERTYPEINT_FROM_HANDLE(a_pVM, a_hType) ((PPGMPHYSHANDLERTYPEINT)MMHyperHeapOffsetToPtr(a_pVM, a_hType))
+
+
+/**
  * Physical page access handler structure.
  *
  * This is used to keep track of physical address ranges
@@ -582,26 +625,23 @@ typedef struct PGMMAPPING *PPGMMAPPING;
 typedef struct PGMPHYSHANDLER
 {
     AVLROGCPHYSNODECORE                 Core;
-    /** Access type. */
-    PGMPHYSHANDLERTYPE                  enmType;
     /** Number of pages to update. */
     uint32_t                            cPages;
     /** Set if we have pages that have been aliased. */
     uint32_t                            cAliasedPages;
     /** Set if we have pages that have temporarily been disabled. */
     uint32_t                            cTmpOffPages;
-    /** Pointer to R3 callback function. */
-    R3PTRTYPE(PFNPGMR3PHYSHANDLER)      pfnHandlerR3;
+    /** Registered handler type handle (heap offset). */
+    PGMPHYSHANDLERTYPE                  hType;
+    /** User argument for RC handlers. */
+    RCPTRTYPE(void *)                   pvUserRC;
+#if HC_ARCH_BITS == 64
+    RTRCPTR                             Padding0; /**< Explicit alignment padding. */
+#endif
     /** User argument for R3 handlers. */
     R3PTRTYPE(void *)                   pvUserR3;
-    /** Pointer to R0 callback function. */
-    R0PTRTYPE(PFNPGMR0PHYSHANDLER)      pfnHandlerR0;
     /** User argument for R0 handlers. */
     R0PTRTYPE(void *)                   pvUserR0;
-    /** Pointer to RC callback function. */
-    RCPTRTYPE(PFNPGMRCPHYSHANDLER)      pfnHandlerRC;
-    /** User argument for RC handlers. */
-    RCPTRTYPE(void *)                   pvUserRC;
     /** Description / Name. For easing debugging. */
     R3PTRTYPE(const char *)             pszDesc;
 #ifdef VBOX_WITH_STATISTICS
@@ -612,6 +652,15 @@ typedef struct PGMPHYSHANDLER
 /** Pointer to a physical page access handler structure. */
 typedef PGMPHYSHANDLER *PPGMPHYSHANDLER;
 
+/**
+ * Gets the type record for a physical handler (no reference added).
+ * @returns PPGMPHYSHANDLERTYPEINT
+ * @param   a_pVM           Pointer to the cross context VM structure.
+ * @param   a_pPhysHandler  Pointer to the physical handler structure
+ *                          (PGMPHYSHANDLER).
+ */
+#define PGMPHYSHANDLER_GET_TYPE(a_pVM, a_pPhysHandler) PGMPHYSHANDLERTYPEINT_FROM_HANDLE(a_pVM, (a_pPhysHandler)->hType)
+
 
 /**
  * Cache node for the physical addresses covered by a virtual handler.
@@ -643,6 +692,49 @@ typedef PGMPHYS2VIRTHANDLER *PPGMPHYS2VIRTHANDLER;
 
 
 /**
+ * Virtual page access handler type registration.
+ */
+typedef struct PGMVIRTANDLERTYPEINT
+{
+    /** Number of references.   */
+    uint32_t volatile                   cRefs;
+    /** Magic number (PGMVIRTHANDLERTYPEINT_MAGIC). */
+    uint32_t                            u32Magic;
+    /** Link of handler types anchored in PGMTREES::HeadVirtHandlerTypes. */
+    RTLISTOFF32NODE                     ListNode;
+    /** The kind of accesses we're handling. */
+    PGMVIRTHANDLERKIND                  enmKind;
+    /** The PGM_PAGE_HNDL_PHYS_STATE_XXX value corresponding to enmKind. */
+    uint32_t                            uState;
+    /** Whether the pvUserRC argument should be automatically relocated or not. */
+    bool                                fRelocUserRC;
+    bool                                afPadding[3];
+    /** Pointer to RC callback function for \#PFs. */
+    RCPTRTYPE(PFNPGMRCVIRTPFHANDLER)    pfnPfHandlerRC;
+    /** Pointer to the R3 callback function for invalidation. */
+    R3PTRTYPE(PFNPGMR3VIRTINVALIDATE)   pfnInvalidateR3;
+    /** Pointer to R3 callback function. */
+    R3PTRTYPE(PFNPGMR3VIRTHANDLER)      pfnHandlerR3;
+    /** Description / Name. For easing debugging. */
+    R3PTRTYPE(const char *)             pszDesc;
+} PGMVIRTHANDLERTYPEINT;
+/** Pointer to a virtual access handler type registration. */
+typedef PGMVIRTHANDLERTYPEINT *PPGMVIRTHANDLERTYPEINT;
+/** Magic value for the virtual handler callbacks (Sir Arthur Charles Clarke). */
+#define PGMVIRTHANDLERTYPEINT_MAGIC        UINT32_C(0x19171216)
+/** Magic value for the virtual handler callbacks. */
+#define PGMVIRTHANDLERTYPEINT_MAGIC_DEAD   UINT32_C(0x20080319)
+
+/**
+ * Converts a handle to a pointer.
+ * @returns PPGMVIRTHANDLERTYPEINT
+ * @param   a_pVM           Pointer to the cross context VM structure.
+ * @param   a_hType         Vitual access handler type handle.
+ */
+#define PGMVIRTHANDLERTYPEINT_FROM_HANDLE(a_pVM, a_hType) ((PPGMVIRTHANDLERTYPEINT)MMHyperHeapOffsetToPtr(a_pVM, a_hType))
+
+
+/**
  * Virtual page access handler structure.
  *
  * This is used to keep track of virtual address ranges
@@ -653,32 +745,36 @@ typedef struct PGMVIRTHANDLER
     /** Core node for the tree based on virtual ranges. */
     AVLROGCPTRNODECORE                  Core;
     /** Size of the range (in bytes). */
-    RTGCPTR                             cb;
+    uint32_t                            cb;
     /** Number of cache pages. */
     uint32_t                            cPages;
-    /** Access type. */
-    PGMVIRTHANDLERTYPE                  enmType;
-    /** Pointer to the RC callback function. */
-    RCPTRTYPE(PFNPGMRCVIRTHANDLER)      pfnHandlerRC;
-#if HC_ARCH_BITS == 64
-    RTRCPTR                             padding;
-#endif
-    /** Pointer to the R3 callback function for invalidation. */
-    R3PTRTYPE(PFNPGMR3VIRTINVALIDATE)   pfnInvalidateR3;
-    /** Pointer to the R3 callback function. */
-    R3PTRTYPE(PFNPGMR3VIRTHANDLER)      pfnHandlerR3;
+    /** Registered handler type handle (heap offset). */
+    PGMVIRTHANDLERTYPE                  hType;
+    /** User argument for RC handlers. */
+    RCPTRTYPE(void *)                   pvUserRC;
+    /** User argument for R3 handlers. */
+    R3PTRTYPE(void *)                   pvUserR3;
     /** Description / Name. For easing debugging. */
     R3PTRTYPE(const char *)             pszDesc;
 #ifdef VBOX_WITH_STATISTICS
     /** Profiling of this handler. */
     STAMPROFILE                         Stat;
 #endif
-    /** Array of cached physical addresses for the monitored ranged.  */
+    /** Array of cached physical addresses for the monitored ranged. */
     PGMPHYS2VIRTHANDLER                 aPhysToVirt[HC_ARCH_BITS == 32 ? 1 : 2];
 } PGMVIRTHANDLER;
 /** Pointer to a virtual page access handler structure. */
 typedef PGMVIRTHANDLER *PPGMVIRTHANDLER;
 
+/**
+ * Gets the type record for a virtual handler (no reference added).
+ * @returns PPGMVIRTHANDLERTYPEINT
+ * @param   a_pVM           Pointer to the cross context VM structure.
+ * @param   a_pVirtHandler  Pointer to the virtual handler structure
+ *                          (PGMVIRTHANDLER).
+ */
+#define PGMVIRTANDLER_GET_TYPE(a_pVM, a_pVirtHandler) PGMVIRTHANDLERTYPEINT_FROM_HANDLE(a_pVM, (a_pVirtHandler)->hType)
+
 
 /** @name Page type predicates.
  * @{ */
@@ -1320,7 +1416,7 @@ typedef PPGMPAGE *PPPGMPAGE;
 
 
 #if 0
-/** Enables sanity checking of write monitoring using CRC-32.  */
+/** Enables sanity checking of write monitoring using CRC-32. */
 # define PGMLIVESAVERAMPAGE_WITH_CRC32
 #endif
 
@@ -1346,10 +1442,10 @@ typedef struct PGMLIVESAVERAMPAGE
     uint32_t    fWriteMonitored : 1;
     /** Whether the page is/was write monitored earlier in this pass. */
     uint32_t    fWriteMonitoredJustNow : 1;
-    /** Bits reserved for future use.  */
+    /** Bits reserved for future use. */
     uint32_t    u2Reserved : 2;
 #ifdef PGMLIVESAVERAMPAGE_WITH_CRC32
-    /** CRC-32 for the page. This is for internal consistency checks.  */
+    /** CRC-32 for the page. This is for internal consistency checks. */
     uint32_t    u32Crc;
 #endif
 } PGMLIVESAVERAMPAGE;
@@ -1570,7 +1666,7 @@ typedef struct PGMLIVESAVEMMIO2PAGE
     bool        fReserved;
     /** CRC-32 for the first half of the page.
      * This is used together with u32CrcH2 to quickly detect changes in the page
-     * during the non-final passes.  */
+     * during the non-final passes. */
     uint32_t    u32CrcH1;
     /** CRC-32 for the second half of the page. */
     uint32_t    u32CrcH2;
@@ -1633,9 +1729,9 @@ typedef PGMMMIO2RANGE *PPGMMMIO2RANGE;
 #define PGM_MMIO2_MAX_PAGE_COUNT                    UINT32_C(0x00ffffff)
 /** Makes a MMIO2 page ID out of a MMIO2 range ID and page index number. */
 #define PGM_MMIO2_PAGEID_MAKE(a_idMmio2, a_iPage)   ( ((uint32_t)(a_idMmio2) << 24) | (uint32_t)(a_iPage) )
-/** Gets the MMIO2 range ID from an MMIO2 page ID.  */
+/** Gets the MMIO2 range ID from an MMIO2 page ID. */
 #define PGM_MMIO2_PAGEID_GET_MMIO2_ID(a_idPage)     ( (uint8_t)((a_idPage) >> 24) )
-/** Gets the MMIO2 page index from an MMIO2 page ID.  */
+/** Gets the MMIO2 page index from an MMIO2 page ID. */
 #define PGM_MMIO2_PAGEID_GET_IDX(a_idPage)          ( ((a_idPage) & UINT32_C(0x00ffffff)) )
 /** @} */
 
@@ -1816,7 +1912,7 @@ typedef struct PGMRCDYNMAPENTRY
 {
     /** The physical address of the currently mapped page.
      * This is duplicate for three reasons: cache locality, cache policy of the PT
-     * mappings and sanity checks.   */
+     * mappings and sanity checks. */
     RTHCPHYS                    HCPhys;
     /** Pointer to the page. */
     RTRCPTR                     pvPage;
@@ -1850,7 +1946,7 @@ typedef struct PGMRCDYNMAP
 {
     /** The usual magic number / eye catcher (PGMRZDYNMAP_MAGIC). */
     uint32_t                        u32Magic;
-    /** Array for tracking and managing the pages.  */
+    /** Array for tracking and managing the pages. */
     RCPTRTYPE(PPGMRCDYNMAPENTRY)    paPages;
     /** The cache size given as a number of pages. */
     uint32_t                        cPages;
@@ -1896,7 +1992,7 @@ typedef struct PGMMAPSETENTRY
     /** The number inlined references.
      * The max is UINT16_MAX - 1. */
     uint16_t                    cInlinedRefs;
-    /** Unreferences.  */
+    /** Unreferences. */
     uint16_t                    cUnrefs;
 
 #if HC_ARCH_BITS == 32
@@ -2070,21 +2166,21 @@ typedef enum PGMPOOLKIND
     /** The entry is free (=unused). */
     PGMPOOLKIND_FREE,
 
-    /** Shw: 32-bit page table;     Gst: no paging  */
+    /** Shw: 32-bit page table;     Gst: no paging. */
     PGMPOOLKIND_32BIT_PT_FOR_PHYS,
-    /** Shw: 32-bit page table;     Gst: 32-bit page table.  */
+    /** Shw: 32-bit page table;     Gst: 32-bit page table. */
     PGMPOOLKIND_32BIT_PT_FOR_32BIT_PT,
-    /** Shw: 32-bit page table;     Gst: 4MB page.  */
+    /** Shw: 32-bit page table;     Gst: 4MB page. */
     PGMPOOLKIND_32BIT_PT_FOR_32BIT_4MB,
-    /** Shw: PAE page table;        Gst: no paging  */
+    /** Shw: PAE page table;        Gst: no paging. */
     PGMPOOLKIND_PAE_PT_FOR_PHYS,
     /** Shw: PAE page table;        Gst: 32-bit page table. */
     PGMPOOLKIND_PAE_PT_FOR_32BIT_PT,
-    /** Shw: PAE page table;        Gst: Half of a 4MB page.  */
+    /** Shw: PAE page table;        Gst: Half of a 4MB page. */
     PGMPOOLKIND_PAE_PT_FOR_32BIT_4MB,
     /** Shw: PAE page table;        Gst: PAE page table. */
     PGMPOOLKIND_PAE_PT_FOR_PAE_PT,
-    /** Shw: PAE page table;        Gst: 2MB page.  */
+    /** Shw: PAE page table;        Gst: 2MB page. */
     PGMPOOLKIND_PAE_PT_FOR_PAE_2MB,
 
     /** Shw: 32-bit page directory. Gst: 32-bit page directory. */
@@ -2113,21 +2209,21 @@ typedef enum PGMPOOLKIND
 
     /** Shw: 64-bit page directory pointer table;   Gst: 64-bit page directory pointer table. */
     PGMPOOLKIND_64BIT_PDPT_FOR_64BIT_PDPT,
-    /** Shw: 64-bit page directory pointer table;   Gst: no paging  */
+    /** Shw: 64-bit page directory pointer table;   Gst: no paging. */
     PGMPOOLKIND_64BIT_PDPT_FOR_PHYS,
     /** Shw: 64-bit page directory table;           Gst: 64-bit page directory table. */
     PGMPOOLKIND_64BIT_PD_FOR_64BIT_PD,
-    /** Shw: 64-bit page directory table;           Gst: no paging  */
+    /** Shw: 64-bit page directory table;           Gst: no paging. */
     PGMPOOLKIND_64BIT_PD_FOR_PHYS, /* 24 */
 
     /** Shw: 64-bit PML4;                           Gst: 64-bit PML4. */
     PGMPOOLKIND_64BIT_PML4,
 
-    /** Shw: EPT page directory pointer table;      Gst: no paging  */
+    /** Shw: EPT page directory pointer table;      Gst: no paging. */
     PGMPOOLKIND_EPT_PDPT_FOR_PHYS,
-    /** Shw: EPT page directory table;              Gst: no paging  */
+    /** Shw: EPT page directory table;              Gst: no paging. */
     PGMPOOLKIND_EPT_PD_FOR_PHYS,
-    /** Shw: EPT page table;                        Gst: no paging  */
+    /** Shw: EPT page table;                        Gst: no paging. */
     PGMPOOLKIND_EPT_PT_FOR_PHYS,
 
     /** Shw: Root Nested paging table. */
@@ -2230,7 +2326,7 @@ typedef struct PGMPOOLPAGE
     RTGCPTR             GCPtrLastAccessHandlerRip;
     RTGCPTR             GCPtrLastAccessHandlerFault;
     uint64_t            cLastAccessHandler;
-    /** @}  */
+    /** @} */
     /** Used to indicate that this page can't be flushed. Important for cr3 root pages or shadow pae pd pages. */
     uint32_t volatile   cLocked;
 #if GC_ARCH_BITS == 64
@@ -2269,7 +2365,7 @@ typedef struct PGMPOOL
     PVMR0                       pVMR0;
     /** The VM handle - RC Ptr. */
     PVMRC                       pVMRC;
-    /** The max pool size. This includes the special IDs.  */
+    /** The max pool size. This includes the special IDs. */
     uint16_t                    cMaxPages;
     /** The current pool size. */
     uint16_t                    cCurPages;
@@ -2313,18 +2409,8 @@ typedef struct PGMPOOL
     uint16_t                    iModifiedHead;
     /** The current number of modified pages. */
     uint16_t                    cModifiedPages;
-    /** Access handler, RC. */
-    RCPTRTYPE(PFNPGMRCPHYSHANDLER)  pfnAccessHandlerRC;
-    /** Access handler, R0. */
-    R0PTRTYPE(PFNPGMR0PHYSHANDLER)  pfnAccessHandlerR0;
-    /** Access handler, R3. */
-    R3PTRTYPE(PFNPGMR3PHYSHANDLER)  pfnAccessHandlerR3;
-    /** The access handler description (R3 ptr). */
-    R3PTRTYPE(const char *)         pszAccessHandler;
-# if HC_ARCH_BITS == 32
-    /** Alignment padding. */
-    uint32_t                    u32Padding2;
-# endif
+    /** Physical access handler type registration handle. */
+    PGMPHYSHANDLERTYPE          hAccessHandlerType;
     /** Next available slot (in aDirtyPages). */
     uint32_t                    idxFreeDirtyPage;
     /** Number of active dirty pages. */
@@ -2610,9 +2696,12 @@ DECLINLINE(void *) pgmPoolMapPageStrict(PPGMPOOLPAGE a_pPage, const char *pszCal
 
 
 /**
- * Trees are using self relative offsets as pointers.
- * So, all its data, including the root pointer, must be in the heap for HC and GC
- * to have the same layout.
+ * Roots and anchors for trees and list employing self relative offsets as
+ * pointers.
+ *
+ * When using self-relative offsets instead of pointers, the offsets needs to be
+ * the same in all offsets.  Thus the roots and anchors needs to live on the
+ * hyper heap just like the nodes.
  */
 typedef struct PGMTREES
 {
@@ -2624,6 +2713,12 @@ typedef struct PGMTREES
     AVLROGCPHYSTREE                 PhysToVirtHandlers;
     /** Virtual access handlers for the hypervisor (AVL range + GC ptr tree). */
     AVLROGCPTRTREE                  HyperVirtHandlers;
+    /** List of physical access handler types (offset pointers) of type
+     * PGMPHYSHANDLERTYPEINT.  This is needed for relocations. */
+    RTLISTOFF32ANCHOR               HeadPhysHandlerTypes;
+    /** List of virtual access handler types (offset pointers) of type
+     * PGMVIRTHANDLERTYPEINT.  This is needed for relocations. */
+    RTLISTOFF32ANCHOR               HeadVirtHandlerTypes;
 } PGMTREES;
 /** Pointer to PGM trees. */
 typedef PGMTREES *PPGMTREES;
@@ -2639,7 +2734,7 @@ typedef struct PGMPTWALKCORE
     RTGCPTR         GCPtr;
 
     /** The guest physical address that is the result of the walk.
-     * @remarks only valid if fSucceeded is set.  */
+     * @remarks only valid if fSucceeded is set. */
     RTGCPHYS        GCPhys;
 
     /** Set if the walk succeeded, i.d. GCPhys is valid. */
@@ -3105,7 +3200,7 @@ typedef struct PGM
     /** Offset of the PGMCPU structure relative to VMCPU. */
     int32_t                         offVCpuPGM;
 
-    /** @cfgm{RamPreAlloc, boolean, false}
+    /** @cfgm{/RamPreAlloc, boolean, false}
      * Indicates whether the base RAM should all be allocated before starting
      * the VM (default), or if it should be allocated when first written to.
      */
@@ -3115,7 +3210,7 @@ typedef struct PGM
      * detection. */
     bool                            fPhysWriteMonitoringEngaged;
     /** Set if the CPU has less than 52-bit physical address width.
-     * This is used  */
+     * This is used */
     bool                            fLessThan52PhysicalAddressBits;
     /** Set when nested paging is active.
      * This is meant to save calls to HMIsNestedPagingActive and let the
@@ -3156,10 +3251,15 @@ typedef struct PGM
     /** The address of the previous RAM range mapping. */
     RTGCPTR                         GCPtrPrevRamRangeMapping;
 
+    /** Physical access handler type for ROM protection. */
+    PGMPHYSHANDLERTYPE              hRomPhysHandlerType;
+    /** Alignment padding.   */
+    uint32_t                        u32Padding;
+
     /** 4 MB page mask; 32 or 36 bits depending on PSE-36 (identical for all VCPUs) */
     RTGCPHYS                        GCPhys4MBPSEMask;
     /** Mask containing the invalid bits of a guest physical address.
-     * @remarks this does not stop at bit 52.  */
+     * @remarks this does not stop at bit 52. */
     RTGCPHYS                        GCPhysInvAddrMask;
 
 
@@ -3189,7 +3289,7 @@ typedef struct PGM
      * The index into this table is made up from */
     R3PTRTYPE(PPGMMODEDATA)         paModeData;
     RTR3PTR                         R3PtrAlignment0;
-    /** MMIO2 lookup array for ring-3.  Indexed by idMmio2 minus 1.  */
+    /** MMIO2 lookup array for ring-3.  Indexed by idMmio2 minus 1. */
     R3PTRTYPE(PPGMMMIO2RANGE)       apMmio2RangesR3[PGM_MMIO2_MAX_RANGES];
 
     /** RAM range TLB for R0. */
@@ -3210,7 +3310,7 @@ typedef struct PGM
     /** R0 pointer corresponding to PGM::pRomRangesR3. */
     R0PTRTYPE(PPGMROMRANGE)         pRomRangesR0;
     RTR0PTR                         R0PtrAlignment0;
-    /** MMIO2 lookup array for ring-3.  Indexed by idMmio2 minus 1.  */
+    /** MMIO2 lookup array for ring-3.  Indexed by idMmio2 minus 1. */
     R0PTRTYPE(PPGMMMIO2RANGE)       apMmio2RangesR0[PGM_MMIO2_MAX_RANGES];
 
     /** RAM range TLB for RC. */
@@ -3278,14 +3378,14 @@ typedef struct PGM
     RCPTRTYPE(uint8_t *)            pbDynPageMapBaseGC;
     /** The address of the raw-mode context mapping cache. */
     RCPTRTYPE(PPGMRCDYNMAP)         pRCDynMap;
-    /** The address of the ring-0 mapping cache if we're making use of it.  */
+    /** The address of the ring-0 mapping cache if we're making use of it. */
     RTR0PTR                         pvR0DynMapUsed;
 
     /** Hack: Number of deprecated page mapping locks taken by the current lock
      *  owner via pgmPhysGCPhys2CCPtrInternalDepr. */
     uint32_t                        cDeprecatedPageLocks;
 #if HC_ARCH_BITS == 64
-    /** Alignment padding.  */
+    /** Alignment padding. */
     uint32_t                        u32Alignment2;
 #endif
 
@@ -3314,8 +3414,9 @@ typedef struct PGM
         PGMCHUNKR3MAPTLB            Tlb;
         /** The number of mapped chunks. */
         uint32_t                    c;
-        /** The maximum number of mapped chunks.
-         * @cfgm    PGM/MaxRing3Chunks */
+        /** @cfgm{/PGM/MaxRing3Chunks, uint32_t, host dependent}
+         * The maximum number of mapped chunks.  On 64-bit this is unlimited by default,
+         * on 32-bit it defaults to 1 or 3 GB depending on the host. */
         uint32_t                    cMax;
         /** The current time.  This is incremented whenever a chunk is inserted. */
         uint32_t                    iNow;
@@ -3393,11 +3494,11 @@ typedef struct PGM
         /** Per type statistics. */
         struct
         {
-            /** The number of ready pages.  */
+            /** The number of ready pages. */
             uint32_t                cReadyPages;
             /** The number of dirty pages. */
             uint32_t                cDirtyPages;
-            /** The number of ready zero pages.  */
+            /** The number of ready zero pages. */
             uint32_t                cZeroPages;
             /** The number of write monitored pages. */
             uint32_t                cMonitoredPages;
@@ -3406,7 +3507,7 @@ typedef struct PGM
                                     Ram;
         /** The number of ignored pages in the RAM ranges (i.e. MMIO, MMIO2 and ROM). */
         uint32_t                    cIgnoredPages;
-        /** Indicates that a live save operation is active.  */
+        /** Indicates that a live save operation is active. */
         bool                        fActive;
         /** Padding. */
         bool                        afReserved[2];
@@ -3421,7 +3522,7 @@ typedef struct PGM
         /** The number of saved pages.  This is used to get some kind of estimate of the
          * link speed so we can decide when we're done.  It is reset after the first
          * 7 passes so the speed estimate doesn't get inflated by the initial set of
-         * zero pages.   */
+         * zero pages. */
         uint64_t                    cSavedPages;
         /** The nanosecond timestamp when cSavedPages was 0. */
         uint64_t                    uSaveStartNS;
@@ -3475,7 +3576,7 @@ typedef struct PGM
     R0PTRTYPE(PGMSTATS *)           pStatsR0;
     RCPTRTYPE(PGMSTATS *)           pStatsRC;
     RTRCPTR                         RCPtrAlignment;
-    /** @}  */
+    /** @} */
 #endif
 } PGM;
 #ifndef IN_TSTVMSTRUCTGC /* HACK */
@@ -3840,7 +3941,7 @@ typedef struct PGMCPU
     uint64_t                        fGst64ShadowedBigPdeMask;
     /** Mask containing the big page PDE bits that we shadow in the PTE. */
     uint64_t                        fGst64ShadowedBigPde4PteMask;
-    /** @}  */
+    /** @} */
 
     /** Pointer to the page of the current active CR3 - R3 Ptr. */
     R3PTRTYPE(PPGMPOOLPAGE)         pShwPageCR3R3;
@@ -3942,7 +4043,7 @@ typedef struct PGMCPU
     STAMCOUNTER                     cA20Changes;
     /** @} */
 
-#ifdef VBOX_WITH_STATISTICS /** @todo move this chunk to the heap.  */
+#ifdef VBOX_WITH_STATISTICS /** @todo move this chunk to the heap. */
     /** @name Statistics
      * @{ */
     /** RC: Pointer to the statistics. */
@@ -3957,7 +4058,7 @@ typedef struct PGMCPU
     R3PTRTYPE(PGMCPUSTATS *)        pStatsR3;
     /** Alignment padding. */
     RTR3PTR                         pPaddingR3;
-    /** @}  */
+    /** @} */
 #endif /* VBOX_WITH_STATISTICS */
 } PGMCPU;
 /** Pointer to the per-cpu PGM data. */
@@ -4044,8 +4145,11 @@ int             pgmPhysGCPhys2CCPtrInternalDepr(PVM pVM, PPGMPAGE pPage, RTGCPHY
 int             pgmPhysGCPhys2CCPtrInternal(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, void **ppv, PPGMPAGEMAPLOCK pLock);
 int             pgmPhysGCPhys2CCPtrInternalReadOnly(PVM pVM, PPGMPAGE pPage, RTGCPHYS GCPhys, const void **ppv, PPGMPAGEMAPLOCK pLock);
 void            pgmPhysReleaseInternalPageMappingLock(PVM pVM, PPGMPAGEMAPLOCK pLock);
-VMMDECL(int)    pgmPhysHandlerRedirectToHC(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
-VMMDECL(int)    pgmPhysRomWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPHYS GCPhysFault, void *pvUser);
+PGM_ALL_CB2_DECL(FNPGMPHYSHANDLER) pgmPhysRomWriteHandler;
+#ifndef IN_RING3
+DECLEXPORT(FNPGMRZPHYSPFHANDLER) pgmPhysPfHandlerRedirectToHC;
+DECLEXPORT(FNPGMRZPHYSPFHANDLER) pgmPhysRomWritePfHandler;
+#endif
 int             pgmPhysFreePage(PVM pVM, PGMMFREEPAGESREQ pReq, uint32_t *pcPendingPages, PPGMPAGE pPage, RTGCPHYS GCPhys);
 void            pgmPhysInvalidRamRangeTlbs(PVM pVM);
 void            pgmPhysInvalidatePageMapTLB(PVM pVM);
@@ -4100,9 +4204,12 @@ int             pgmPoolTrackUpdateGCPhys(PVM pVM, RTGCPHYS GCPhysPage, PPGMPAGE
 void            pgmPoolTracDerefGCPhysHint(PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTHCPHYS HCPhys, RTGCPHYS GCPhysHint, uint16_t iPte);
 uint16_t        pgmPoolTrackPhysExtAddref(PVM pVM, PPGMPAGE pPhysPage, uint16_t u16, uint16_t iShwPT, uint16_t iPte);
 void            pgmPoolTrackPhysExtDerefGCPhys(PPGMPOOL pPool, PPGMPOOLPAGE pPoolPage, PPGMPAGE pPhysPage, uint16_t iPte);
-void            pgmPoolMonitorChainChanging(PVMCPU pVCpu, PPGMPOOL pPool, PPGMPOOLPAGE pPage, RTGCPHYS GCPhysFault, CTXTYPE(RTGCPTR, RTHCPTR, RTGCPTR) pvAddress, unsigned cbWrite);
 int             pgmPoolMonitorChainFlush(PPGMPOOL pPool, PPGMPOOLPAGE pPage);
 void            pgmPoolMonitorModifiedInsert(PPGMPOOL pPool, PPGMPOOLPAGE pPage);
+PGM_ALL_CB2_DECL(FNPGMPHYSHANDLER) pgmPoolAccessHandler;
+#ifndef IN_RING3
+DECLEXPORT(FNPGMRZPHYSPFHANDLER)   pgmPoolAccessPfHandler;
+#endif
 
 void            pgmPoolAddDirtyPage(PVM pVM, PPGMPOOL pPool, PPGMPOOLPAGE pPage);
 void            pgmPoolResetDirtyPages(PVM pVM);
diff --git a/src/VBox/VMM/include/REMInternal.h b/src/VBox/VMM/include/REMInternal.h
index 1f41096..3007f59 100644
--- a/src/VBox/VMM/include/REMInternal.h
+++ b/src/VBox/VMM/include/REMInternal.h
@@ -78,7 +78,7 @@ typedef struct REMHANDLERNOTIFICATION
         {
             RTGCPHYS            GCPhys;
             RTGCPHYS            cb;
-            PGMPHYSHANDLERTYPE  enmType;
+            PGMPHYSHANDLERKIND  enmKind;
             bool                fHasHCHandler;
         } PhysicalRegister;
 
@@ -86,7 +86,7 @@ typedef struct REMHANDLERNOTIFICATION
         {
             RTGCPHYS            GCPhys;
             RTGCPHYS            cb;
-            PGMPHYSHANDLERTYPE  enmType;
+            PGMPHYSHANDLERKIND  enmKind;
             bool                fHasHCHandler;
             bool                fRestoreAsRAM;
         } PhysicalDeregister;
@@ -96,7 +96,7 @@ typedef struct REMHANDLERNOTIFICATION
             RTGCPHYS            GCPhysOld;
             RTGCPHYS            GCPhysNew;
             RTGCPHYS            cb;
-            PGMPHYSHANDLERTYPE  enmType;
+            PGMPHYSHANDLERKIND  enmKind;
             bool                fHasHCHandler;
             bool                fRestoreAsRAM;
         } PhysicalModify;
diff --git a/src/VBox/VMM/include/SELMInternal.h b/src/VBox/VMM/include/SELMInternal.h
index f5c0e02..349ab8c 100644
--- a/src/VBox/VMM/include/SELMInternal.h
+++ b/src/VBox/VMM/include/SELMInternal.h
@@ -22,6 +22,7 @@
 #include <VBox/types.h>
 #include <VBox/vmm/stam.h>
 #include <VBox/vmm/cpum.h>
+#include <VBox/vmm/pgm.h>
 #include <VBox/log.h>
 #include <iprt/x86.h>
 
@@ -102,6 +103,12 @@ typedef struct SELM
     /** Flat CS, DS, 64 bit mode CS, TSS & trap 8 TSS. */
     RTSEL                   aHyperSel[SELM_HYPER_SEL_MAX];
 
+    /** @name GDT
+     * @{ */
+    /** Shadow GDT virtual write access handler type. */
+    PGMVIRTHANDLERTYPE      hShadowGdtWriteHandlerType;
+    /** Guest GDT virtual write access handler type. */
+    PGMVIRTHANDLERTYPE      hGuestGdtWriteHandlerType;
     /** Pointer to the GCs - R3 Ptr.
      * This size is governed by SELM_GDT_ELEMENTS. */
     R3PTRTYPE(PX86DESC)     paGdtR3;
@@ -113,10 +120,18 @@ typedef struct SELM
      * The pGdt member is set to RTRCPTR_MAX if we're not monitoring the guest GDT. */
     VBOXGDTR                GuestGdtr;
     /** The current (last) effective Guest GDT size. */
-    RTUINT                  cbEffGuestGdtLimit;
-
-    uint32_t                padding0;
-
+    uint32_t                cbEffGuestGdtLimit;
+    /** Indicates that the Guest GDT access handler have been registered. */
+    bool                    fGDTRangeRegistered;
+    /** @} */
+    bool                    padding0[3];
+
+    /** @name LDT
+     * @{ */
+    /** Shadow LDT virtual write access handler type. */
+    PGMVIRTHANDLERTYPE      hShadowLdtWriteHandlerType;
+    /** Guest LDT virtual write access handler type. */
+    PGMVIRTHANDLERTYPE      hGuestLdtWriteHandlerType;
     /** R3 pointer to the LDT shadow area in HMA. */
     R3PTRTYPE(void *)       pvLdtR3;
     /** RC pointer to the LDT shadow area in HMA. */
@@ -128,19 +143,25 @@ typedef struct SELM
      * RTRCPTR_MAX if not monitored. */
     RTGCPTR                 GCPtrGuestLdt;
     /** Current LDT limit, both Guest and Shadow. */
-    RTUINT                  cbLdtLimit;
+    uint32_t                cbLdtLimit;
     /** Current LDT offset relative to pvLdtR3/pvLdtRC. */
-    RTUINT                  offLdtHyper;
+    uint32_t                offLdtHyper;
 #if HC_ARCH_BITS == 32 && GC_ARCH_BITS == 64
     uint32_t                padding2[2];
 #endif
+    /** @} */
+
+    /** @name TSS
+     * @{ */
     /** TSS. (This is 16 byte aligned!)
       * @todo I/O bitmap & interrupt redirection table? */
     VBOXTSS                 Tss;
-
     /** TSS for trap 08 (\#DF). */
     VBOXTSS                 TssTrap08;
-
+    /** Shadow TSS virtual write access handler type. */
+    PGMVIRTHANDLERTYPE      hShadowTssWriteHandlerType;
+    /** Guerst TSS virtual write access handler type. */
+    PGMVIRTHANDLERTYPE      hGuestTssWriteHandlerType;
     /** Monitored shadow TSS address. */
     RCPTRTYPE(void *)       pvMonShwTssRC;
 #if GC_ARCH_BITS == 64
@@ -150,24 +171,21 @@ typedef struct SELM
      * RTRCPTR_MAX if not monitored. */
     RTGCPTR                 GCPtrGuestTss;
     /** The size of the guest TSS. */
-    RTUINT                  cbGuestTss;
+    uint32_t                cbGuestTss;
     /** Set if it's a 32-bit TSS. */
     bool                    fGuestTss32Bit;
+    /** Indicates whether the TSS stack selector & base address need to be refreshed.  */
+    bool                    fSyncTSSRing0Stack;
     /** The size of the Guest's TSS part we're monitoring. */
-    RTUINT                  cbMonitoredGuestTss;
+    uint32_t                cbMonitoredGuestTss;
     /** The guest TSS selector at last sync (part of monitoring).
      * Contains RTSEL_MAX if not set. */
     RTSEL                   GCSelTss;
     /** The last known offset of the I/O bitmap.
      * This is only used if we monitor the bitmap. */
     uint16_t                offGuestIoBitmap;
-
-    /** Indicates that the Guest GDT access handler have been registered. */
-    bool                    fGDTRangeRegistered;
-
-    /** Indicates whether the TSS stack selector & base address need to be refreshed.  */
-    bool                    fSyncTSSRing0Stack;
-    bool                    fPadding2[4];
+    /** @} */
+    uint16_t                padding4[3];
 
     /** SELMR3UpdateFromCPUM() profiling. */
     STAMPROFILE             StatUpdateFromCPUM;
@@ -211,13 +229,12 @@ typedef struct SELM
 
 RT_C_DECLS_BEGIN
 
-VMMRCDECL(int) selmRCGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
-VMMRCDECL(int) selmRCGuestLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
-VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
-
-VMMRCDECL(int) selmRCShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
-VMMRCDECL(int) selmRCShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
-VMMRCDECL(int) selmRCShadowTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) selmRCGuestGDTWritePfHandler;
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) selmRCGuestLDTWritePfHandler;
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) selmRCGuestTSSWritePfHandler;
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) selmRCShadowGDTWritePfHandler;
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) selmRCShadowLDTWritePfHandler;
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) selmRCShadowTSSWritePfHandler;
 
 void           selmSetRing1Stack(PVM pVM, uint32_t ss, RTGCPTR32 esp);
 #ifdef VBOX_WITH_RAW_RING1
diff --git a/src/VBox/VMM/include/SSMInternal.h b/src/VBox/VMM/include/SSMInternal.h
index ccfe3e4..23d2195 100644
--- a/src/VBox/VMM/include/SSMInternal.h
+++ b/src/VBox/VMM/include/SSMInternal.h
@@ -41,6 +41,8 @@ typedef enum SSMUNITTYPE
     SSMUNITTYPE_DEV = 1,
     /** PDM Driver. */
     SSMUNITTYPE_DRV,
+    /** PDM USB device. */
+    SSMUNITTYPE_USB,
     /** VM Internal. */
     SSMUNITTYPE_INTERNAL,
     /** External Wrapper. */
@@ -120,6 +122,31 @@ typedef struct SSMUNIT
             PPDMDRVINS          pDrvIns;
         } Drv;
 
+        /** SSMUNITTYPE_USB. */
+        struct
+        {
+            /** Prepare live save. */
+            PFNSSMUSBLIVEPREP   pfnLivePrep;
+            /** Execute live save. */
+            PFNSSMUSBLIVEEXEC   pfnLiveExec;
+            /** Vote live save complete. */
+            PFNSSMUSBLIVEVOTE   pfnLiveVote;
+            /** Prepare save. */
+            PFNSSMUSBSAVEPREP   pfnSavePrep;
+            /** Execute save. */
+            PFNSSMUSBSAVEEXEC   pfnSaveExec;
+            /** Done save. */
+            PFNSSMUSBSAVEDONE   pfnSaveDone;
+            /** Prepare load. */
+            PFNSSMUSBLOADPREP   pfnLoadPrep;
+            /** Execute load. */
+            PFNSSMUSBLOADEXEC   pfnLoadExec;
+            /** Done load. */
+            PFNSSMUSBLOADDONE   pfnLoadDone;
+            /** USB instance. */
+            PPDMUSBINS          pUsbIns;
+        } Usb;
+
         /** SSMUNITTYPE_INTERNAL. */
         struct
         {
@@ -231,6 +258,17 @@ AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadExec, u.Drv.pfnLoadExec);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadDone, u.Drv.pfnLoadDone);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey,       u.Drv.pDrvIns);
 
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.Usb.pfnLivePrep);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.Usb.pfnLiveExec);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.Usb.pfnLiveVote);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSavePrep, u.Usb.pfnSavePrep);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveExec, u.Usb.pfnSaveExec);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnSaveDone, u.Usb.pfnSaveDone);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadPrep, u.Usb.pfnLoadPrep);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadExec, u.Usb.pfnLoadExec);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLoadDone, u.Usb.pfnLoadDone);
+AssertCompile2MemberOffsets(SSMUNIT, u.Common.pvKey,       u.Usb.pUsbIns);
+
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLivePrep, u.Internal.pfnLivePrep);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveExec, u.Internal.pfnLiveExec);
 AssertCompile2MemberOffsets(SSMUNIT, u.Common.pfnLiveVote, u.Internal.pfnLiveVote);
diff --git a/src/VBox/VMM/include/TMInternal.h b/src/VBox/VMM/include/TMInternal.h
index a1bd51c..ce0359b 100644
--- a/src/VBox/VMM/include/TMInternal.h
+++ b/src/VBox/VMM/include/TMInternal.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -315,6 +315,24 @@ AssertCompileMemberAlignment(TMCPULOADSTATE, cNsPrevTotal, 8);
 /** Pointer to a CPU load data set. */
 typedef TMCPULOADSTATE *PTMCPULOADSTATE;
 
+
+/**
+ * TSC mode.
+ *
+ * The main modes of how TM implements the TSC clock (TMCLOCK_TSC).
+ */
+typedef enum TMTSCMODE
+{
+    /** The guest TSC is an emulated, virtual TSC. */
+    TMTSCMODE_VIRT_TSC_EMULATED = 1,
+    /** The guest TSC is an offset of the real TSC. */
+    TMTSCMODE_REAL_TSC_OFFSET,
+    /** The guest TSC is dynamically derived through emulating or offsetting. */
+    TMTSCMODE_DYNAMIC
+} TMTSCMODE;
+AssertCompileSize(TMTSCMODE, sizeof(uint32_t));
+
+
 /**
  * Converts a TM pointer into a VM pointer.
  * @returns Pointer to the VM structure the TM is part of.
@@ -333,30 +351,30 @@ typedef struct TM
      * See TM2VM(). */
     RTUINT                      offVM;
 
-    /** Set if we fully virtualize the TSC, i.e. intercept all rdtsc instructions.
-     * Config variable: TSCVirtualized (bool) */
-    bool                        fTSCVirtualized;
-    /** Set if we use the real TSC as time source or if we use the virtual clock.
-     * If fTSCVirtualized is set we maintain a offset to the TSC and pausing/resuming the
-     * ticking. fTSCVirtualized = false implies fTSCUseRealTSC = true.
-     * Config variable: TSCUseRealTSC (bool) */
-    bool                        fTSCUseRealTSC;
-    /** Flag indicating that the host TSC is suitable for use in AMD-V and VT-x mode.
-     * Config variable: MaybeUseOffsettedHostTSC (boolean) */
-    bool                        fMaybeUseOffsettedHostTSC;
+    /** The current TSC mode of the VM.
+     *  Config variable: Mode (string). */
+    TMTSCMODE                   enmTSCMode;
+    /** The original TSC mode of the VM. */
+    TMTSCMODE                   enmOriginalTSCMode;
+    /** Alignment padding. */
+    uint32_t                    u32Alignment0;
     /** Whether the TSC is tied to the execution of code.
      * Config variable: TSCTiedToExecution (bool) */
     bool                        fTSCTiedToExecution;
     /** Modifier for fTSCTiedToExecution which pauses the TSC while halting if true.
      * Config variable: TSCNotTiedToHalt (bool) */
     bool                        fTSCNotTiedToHalt;
-    bool                        afAlignment0[2]; /**< alignment padding */
+    /** Whether TM TSC mode switching is allowed at runtime. */
+    bool                        fTSCModeSwitchAllowed;
+    /** Whether the guest has enabled use of paravirtualized TSC. */
+    bool                        fParavirtTscEnabled;
     /** The ID of the virtual CPU that normally runs the timers. */
     VMCPUID                     idTimerCpu;
 
     /** The number of CPU clock ticks per second (TMCLOCK_TSC).
      * Config variable: TSCTicksPerSecond (64-bit unsigned int)
-     * The config variable implies fTSCVirtualized = true and fTSCUseRealTSC = false. */
+     * The config variable implies @c enmTSCMode would be
+     * TMTSCMODE_VIRT_TSC_EMULATED. */
     uint64_t                    cTSCTicksPerSecond;
     /** The TSC difference introduced by pausing the VM. */
     uint64_t                    offTSCPause;
@@ -373,7 +391,8 @@ typedef struct TM
     bool volatile               fVirtualSyncTicking;
     /** Virtual timer synchronous time catch-up active. */
     bool volatile               fVirtualSyncCatchUp;
-    bool                        afAlignment1[1]; /**< alignment padding */
+    /** Alignment padding. */
+    bool                        afAlignment1[1];
     /** WarpDrive percentage.
      * 100% is normal (fVirtualSyncNormal == true). When other than 100% we apply
      * this percentage to the raw time source for the period it's been valid in,
@@ -400,9 +419,9 @@ typedef struct TM
     RTTIMENANOTSDATARC          VirtualGetRawDataRC;
     /** Pointer to the ring-3 tmVirtualGetRawNanoTS worker function. */
     R3PTRTYPE(PFNTIMENANOTSINTERNAL) pfnVirtualGetRawR3;
-    /** Pointer to the ring-3 tmVirtualGetRawNanoTS worker function. */
+    /** Pointer to the ring-0 tmVirtualGetRawNanoTS worker function. */
     R0PTRTYPE(PFNTIMENANOTSINTERNAL) pfnVirtualGetRawR0;
-    /** Pointer to the ring-3 tmVirtualGetRawNanoTS worker function. */
+    /** Pointer to the raw-mode tmVirtualGetRawNanoTS worker function. */
     RCPTRTYPE(PFNTIMENANOTSINTERNAL) pfnVirtualGetRawRC;
     /** Alignment. */
     RTRCPTR                     AlignmentRCPtr;
@@ -445,24 +464,24 @@ typedef struct TM
     bool volatile               fHzHintNeedsUpdating;
     /** Alignment */
     bool                        afAlignment2[3];
-    /** @cfgm{TM/HostHzMax, uint32_t, Hz, 0, UINT32_MAX, 20000}
+    /** @cfgm{/TM/HostHzMax, uint32_t, Hz, 0, UINT32_MAX, 20000}
      * The max host Hz frequency hint returned by TMCalcHostTimerFrequency.  */
     uint32_t                    cHostHzMax;
-    /** @cfgm{TM/HostHzFudgeFactorTimerCpu, uint32_t, Hz, 0, UINT32_MAX, 111}
+    /** @cfgm{/TM/HostHzFudgeFactorTimerCpu, uint32_t, Hz, 0, UINT32_MAX, 111}
      * The number of Hz TMCalcHostTimerFrequency adds for the timer CPU.  */
     uint32_t                    cPctHostHzFudgeFactorTimerCpu;
-    /** @cfgm{TM/HostHzFudgeFactorOtherCpu, uint32_t, Hz, 0, UINT32_MAX, 110}
+    /** @cfgm{/TM/HostHzFudgeFactorOtherCpu, uint32_t, Hz, 0, UINT32_MAX, 110}
      * The number of Hz TMCalcHostTimerFrequency adds for the other CPUs. */
     uint32_t                    cPctHostHzFudgeFactorOtherCpu;
-    /** @cfgm{TM/HostHzFudgeFactorCatchUp100, uint32_t, Hz, 0, UINT32_MAX, 300}
+    /** @cfgm{/TM/HostHzFudgeFactorCatchUp100, uint32_t, Hz, 0, UINT32_MAX, 300}
      *  The fudge factor (expressed in percent) that catch-up percentages below
      * 100% is multiplied by. */
     uint32_t                    cPctHostHzFudgeFactorCatchUp100;
-    /** @cfgm{TM/HostHzFudgeFactorCatchUp200, uint32_t, Hz, 0, UINT32_MAX, 250}
+    /** @cfgm{/TM/HostHzFudgeFactorCatchUp200, uint32_t, Hz, 0, UINT32_MAX, 250}
      * The fudge factor (expressed in percent) that catch-up percentages
      * 100%-199% is multiplied by. */
     uint32_t                    cPctHostHzFudgeFactorCatchUp200;
-    /** @cfgm{TM/HostHzFudgeFactorCatchUp400, uint32_t, Hz, 0, UINT32_MAX, 200}
+    /** @cfgm{/TM/HostHzFudgeFactorCatchUp400, uint32_t, Hz, 0, UINT32_MAX, 200}
      * The fudge factor (expressed in percent) that catch-up percentages
      * 200%-399% is multiplied by. */
     uint32_t                    cPctHostHzFudgeFactorCatchUp400;
@@ -633,6 +652,7 @@ typedef struct TM
     STAMPROFILE                 StatVirtualSyncFF;
     /** The timer callback. */
     STAMCOUNTER                 StatTimerCallbackSetFF;
+    STAMCOUNTER                 StatTimerCallback;
 
     /** Calls to TMCpuTickSet. */
     STAMCOUNTER                 StatTSCSet;
@@ -671,8 +691,8 @@ typedef struct TMCPU
     bool                        fTSCTicking;
     bool                        afAlignment0[3]; /**< alignment padding */
 
-    /** The offset between the raw TSC source and the Guest TSC.
-     * Only valid if fTicking is set and and fTSCUseRealTSC is clear. */
+    /** The offset between the host tick (TSC/virtual depending on the TSC mode) and
+     *  the guest tick. */
     uint64_t                    offTSCRawSrc;
 
     /** The guest TSC when fTicking is cleared. */
@@ -738,6 +758,7 @@ void                    tmTimerQueueSchedule(PVM pVM, PTMTIMERQUEUE pQueue);
 void                    tmTimerQueuesSanityChecks(PVM pVM, const char *pszWhere);
 #endif
 
+uint64_t                tmR3CpuTickGetRawVirtualNoCheck(PVM pVM);
 int                     tmCpuTickPause(PVMCPU pVCpu);
 int                     tmCpuTickPauseLocked(PVM pVM, PVMCPU pVCpu);
 int                     tmCpuTickResume(PVM pVM, PVMCPU pVCpu);
@@ -745,8 +766,14 @@ int                     tmCpuTickResumeLocked(PVM pVM, PVMCPU pVCpu);
 
 int                     tmVirtualPauseLocked(PVM pVM);
 int                     tmVirtualResumeLocked(PVM pVM);
-DECLEXPORT(void)        tmVirtualNanoTSBad(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS, uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS);
+DECLEXPORT(void)        tmVirtualNanoTSBadPrev(PRTTIMENANOTSDATA pData, uint64_t u64NanoTS,
+                                               uint64_t u64DeltaPrev, uint64_t u64PrevNanoTS);
 DECLEXPORT(uint64_t)    tmVirtualNanoTSRediscover(PRTTIMENANOTSDATA pData);
+DECLEXPORT(uint64_t)    tmVirtualNanoTSBadCpuIndex(PRTTIMENANOTSDATA pData, uint16_t idApic, uint16_t iCpuSet, uint16_t iGipCpu);
+
+#ifdef IN_RING3
+static const char *     tmR3GetTSCModeNameEx(TMTSCMODE enmMode);
+#endif
 
 
 /**
@@ -780,7 +807,6 @@ DECLEXPORT(uint64_t)    tmVirtualNanoTSRediscover(PRTTIMENANOTSDATA pData);
 #define TM_ASSERT_TIMER_LOCK_OWNERSHIP(a_pVM) \
     Assert(PDMCritSectIsOwner(&(a_pVM)->tm.s.TimerCritSect))
 
-
 /** @} */
 
 RT_C_DECLS_END
diff --git a/src/VBox/VMM/include/TRPMInternal.h b/src/VBox/VMM/include/TRPMInternal.h
index 90a4219..0be7a7c 100644
--- a/src/VBox/VMM/include/TRPMInternal.h
+++ b/src/VBox/VMM/include/TRPMInternal.h
@@ -22,6 +22,7 @@
 #include <VBox/types.h>
 #include <VBox/vmm/stam.h>
 #include <VBox/vmm/cpum.h>
+#include <VBox/vmm/pgm.h>
 
 
 
@@ -125,9 +126,12 @@ typedef struct TRPM
     RCPTRTYPE(void *)       pvMonShwIdtRC;
     /** Current (last) Guest's IDTR. */
     VBOXIDTR                GuestIdtr;
-
     /** padding. */
     uint8_t                 au8Padding[2];
+    /** Shadow IDT virtual write access handler type. */
+    PGMVIRTHANDLERTYPE      hShadowIdtWriteHandlerType;
+    /** Guest IDT virtual write access handler type. */
+    PGMVIRTHANDLERTYPE      hGuestIdtWriteHandlerType;
 
     /** Checked trap & interrupt handler array */
     RCPTRTYPE(void *)       aGuestTrapHandler[256];
@@ -244,8 +248,8 @@ typedef TRPMCPU *PTRPMCPU;
 #pragma pack()
 
 
-VMMRCDECL(int) trpmRCGuestIDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
-VMMRCDECL(int) trpmRCShadowIDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) trpmRCGuestIDTWritePfHandler;
+DECLEXPORT(FNPGMRCVIRTPFHANDLER) trpmRCShadowIDTWritePfHandler;
 
 /**
  * Clear guest trap/interrupt gate handler
diff --git a/src/VBox/VMM/include/TRPMInternal.mac b/src/VBox/VMM/include/TRPMInternal.mac
index 6228db9..2485c1e 100644
--- a/src/VBox/VMM/include/TRPMInternal.mac
+++ b/src/VBox/VMM/include/TRPMInternal.mac
@@ -35,9 +35,11 @@ struc TRPM
     .au32IdtPatched     resd 8
     .aTmpTrapHandlers   RTRCPTR_RES 256
 
-    .pvMonShwIdtRC            RTRCPTR_RES 1
-    .GuestIdtr          resb 10
-    .au8Padding         resb 2
+    .pvMonShwIdtRC                  RTRCPTR_RES 1
+    .GuestIdtr                      resb 10
+    .au8Padding                     resb 2
+    .hShadowIdtWriteHandlerType     resd 1
+    .hGuestIdtWriteHandlerType      resd 1
 
     .aGuestTrapHandler  RTRCPTR_RES 256
 
diff --git a/src/VBox/VMM/include/VMMInternal.h b/src/VBox/VMM/include/VMMInternal.h
index fa3f253..d02c738 100644
--- a/src/VBox/VMM/include/VMMInternal.h
+++ b/src/VBox/VMM/include/VMMInternal.h
@@ -343,6 +343,8 @@ typedef struct VMM
     STAMCOUNTER                 StatRZRetMMIOPatchRead;
     STAMCOUNTER                 StatRZRetMMIOPatchWrite;
     STAMCOUNTER                 StatRZRetMMIOReadWrite;
+    STAMCOUNTER                 StatRZRetMSRRead;
+    STAMCOUNTER                 StatRZRetMSRWrite;
     STAMCOUNTER                 StatRZRetLDTFault;
     STAMCOUNTER                 StatRZRetGDTFault;
     STAMCOUNTER                 StatRZRetIDTFault;
@@ -417,25 +419,18 @@ typedef struct VMMCPU
      * This is NULL if logging is disabled. */
     R0PTRTYPE(PVMMR0LOGGER)     pR0LoggerR0;
 
-    /** @name Thread-context hooks.
-     *  @{*/
-    R0PTRTYPE(RTTHREADCTX)      hR0ThreadCtx;
-#if HC_ARCH_BITS == 32
-    uint32_t                    u32Padding;
-#else
-    uint64_t                    u64Padding;
-#endif
-    /** @} */
+    /** Thread context switching hook (ring-0). */
+    RTTHREADCTXHOOK             hCtxHook;
 
     /** @name Rendezvous
      * @{ */
     /** Whether the EMT is executing a rendezvous right now. For detecting
      *  attempts at recursive rendezvous. */
     bool volatile               fInRendezvous;
-    bool                        afPadding[HC_ARCH_BITS == 32 ? 3 : 7];
+    bool                        afPadding[HC_ARCH_BITS == 32 ? 3+4 : 7+8];
     /** @} */
 
-    /** @name Raw-mode context tracting data.
+    /** @name Raw-mode context tracing data.
      * @{ */
     SUPDRVTRACERUSRCTX          TracerCtx;
     /** @} */
diff --git a/src/VBox/VMM/include/VMMInternal.mac b/src/VBox/VMM/include/VMMInternal.mac
index 6318671..0b2ae30 100644
--- a/src/VBox/VMM/include/VMMInternal.mac
+++ b/src/VBox/VMM/include/VMMInternal.mac
@@ -107,18 +107,13 @@ struc VMMCPU
         .pR0LoggerR3            RTR3PTR_RES 1
         .pR0LoggerR0            RTR0PTR_RES 1
 
-        .hR0ThreadCtx           RTR0PTR_RES 1
-%if HC_ARCH_BITS == 32
-        .u32Padding             resd 1
-%else
-        .u64Padding             resq 1
-%endif
+        .hCtxHook               RTR0PTR_RES 1
 
         .fInRendezvous          resb 1
 %if HC_ARCH_BITS == 32
-        .afPadding              resb 3
+        .afPadding              resb 3+4
 %else
-        .afPadding              resb 7
+        .afPadding              resb 7+8
 %endif
 
         alignb 8
diff --git a/src/VBox/VMM/include/VMMSwitcher.h b/src/VBox/VMM/include/VMMSwitcher.h
index a46e9d9..2141d41 100644
--- a/src/VBox/VMM/include/VMMSwitcher.h
+++ b/src/VBox/VMM/include/VMMSwitcher.h
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -42,7 +42,7 @@
 #define FIX_HYPER_DS            19
 #define FIX_HYPER_TSS           20
 #define FIX_GC_TSS_GDTE_DW2     21
-#define FIX_NO_FXSAVE_JMP       24
+/*#define FIX_NO_FXSAVE_JMP       24 - reusable */
 #define FIX_NO_SYSENTER_JMP     25
 #define FIX_NO_SYSCALL_JMP      26
 #define FIX_HC_32BIT            27
diff --git a/src/VBox/VMM/include/VMMSwitcher.mac b/src/VBox/VMM/include/VMMSwitcher.mac
index ec861c6..856d078 100644
--- a/src/VBox/VMM/include/VMMSwitcher.mac
+++ b/src/VBox/VMM/include/VMMSwitcher.mac
@@ -4,7 +4,7 @@
 ;
 
 ;
-; Copyright (C) 2006-2013 Oracle Corporation
+; Copyright (C) 2006-2015 Oracle Corporation
 ;
 ; This file is part of VirtualBox Open Source Edition (OSE), as
 ; available from http://www.virtualbox.org. This file is free software;
@@ -84,7 +84,7 @@ endstruc
 %define FIX_HYPER_DS            19
 %define FIX_HYPER_TSS           20
 %define FIX_GC_TSS_GDTE_DW2     21
-%define FIX_NO_FXSAVE_JMP       24
+;%define FIX_NO_FXSAVE_JMP       24 - reusable
 %define FIX_NO_SYSENTER_JMP     25
 %define FIX_NO_SYSCALL_JMP      26
 %define FIX_HC_32BIT            27
diff --git a/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py b/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
index 6d506d1..23063cb 100755
--- a/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
+++ b/src/VBox/VMM/testcase/Instructions/InstructionTestGen.py
@@ -20,7 +20,7 @@ Foundation, in version 2 as it comes in the "COPYING" file of the
 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 """
-__version__ = "$Revision: 90928 $";
+__version__ = "$Revision: 90927 $";
 
 
 # pylint: disable=C0103,R0913
diff --git a/src/VBox/VMM/testcase/Instructions/itgTableDaa.py b/src/VBox/VMM/testcase/Instructions/itgTableDaa.py
index 04c6319..f0e0ee0 100644
--- a/src/VBox/VMM/testcase/Instructions/itgTableDaa.py
+++ b/src/VBox/VMM/testcase/Instructions/itgTableDaa.py
@@ -18,7 +18,7 @@ Foundation, in version 2 as it comes in the "COPYING" file of the
 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 """
-__version__ = "$Revision: 90928 $";
+__version__ = "$Revision: 90927 $";
 
 
 ## The 32-bit GCC (C99) program that produced the table below.
diff --git a/src/VBox/VMM/testcase/Instructions/itgTableDas.py b/src/VBox/VMM/testcase/Instructions/itgTableDas.py
index 702b95f..0582fe0 100644
--- a/src/VBox/VMM/testcase/Instructions/itgTableDas.py
+++ b/src/VBox/VMM/testcase/Instructions/itgTableDas.py
@@ -18,7 +18,7 @@ Foundation, in version 2 as it comes in the "COPYING" file of the
 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 """
-__version__ = "$Revision: 90928 $";
+__version__ = "$Revision: 90927 $";
 
 
 ## The 32-bit GCC (C99) program that produced the table below.
diff --git a/src/VBox/VMM/testcase/Makefile.kmk b/src/VBox/VMM/testcase/Makefile.kmk
index 2789416..5ea5a6b 100644
--- a/src/VBox/VMM/testcase/Makefile.kmk
+++ b/src/VBox/VMM/testcase/Makefile.kmk
@@ -70,9 +70,10 @@ ifndef VBOX_ONLY_EXTPACKS_USE_IMPLIBS
   	tstCompressionBenchmark \
 	tstIEMCheckMc \
   	tstVMMR0CallHost-1 \
-  	tstVMMR0CallHost-2
+  	tstVMMR0CallHost-2 \
+	tstX86-FpuSaveRestore
   ifn1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), solaris.x86 solaris.amd64 win.amd64 ) ## TODO: Fix the code.
-   PROGRAMS  +=  tstX86-1
+   PROGRAMS += tstX86-1
   endif
   ifdef VBOX_WITH_RAW_MODE
    if defined(VBOX_WITH_HARDENING) && "$(KBUILD_TARGET)" == "win"
@@ -354,6 +355,10 @@ tstX86-1_TEMPLATE       = VBOXR3TSTEXE
 tstX86-1_SOURCES        = tstX86-1.cpp tstX86-1A.asm
 tstX86-1_LIBS           = $(LIB_RUNTIME)
 
+tstX86-FpuSaveRestore_TEMPLATE = VBOXR3TSTEXE
+tstX86-FpuSaveRestore_SOURCES  = tstX86-FpuSaveRestore.cpp tstX86-FpuSaveRestoreA.asm
+tstX86-FpuSaveRestore_LIBS     = $(LIB_RUNTIME)
+
 ifdef VBOX_WITH_RAW_MODE
 
  #
@@ -455,6 +460,13 @@ ifdef VBOX_WITH_PDM_ASYNC_COMPLETION
  tstPDMAsyncCompletionStress_LIBS       = $(LIB_VMM) $(LIB_REM) $(LIB_RUNTIME)
 endif
 
+ifndef VBOX_ONLY_EXTPACKS
+PROGRAMS += tstSSM-2
+tstSSM-2_TEMPLATE       = VBOXR3TSTEXE
+tstSSM-2_DEFS           = IN_VMM_STATIC
+tstSSM-2_SOURCES        = tstSSM-2.cpp
+tstSSM-2_LIBS           = $(PATH_STAGE_LIB)/SSMStandalone$(VBOX_SUFF_LIB)
+endif
 
 #
 # Generate VM structure tests.
@@ -516,16 +528,6 @@ $(VBOX_VMM_TESTCASE_OUT_DIR)/tstInstrEmul.run: $$(tstInstrEmul_1_STAGE_TARGET) |
 #
 # Some handcrafted support targets for tstAsmStructs.
 #
-
-ifeq ($(KBUILD_HOST),win)
- ifndef TOOL_MINGW32
-  include $(KBUILD_PATH)/tools/MINGW32.kmk
- endif
- VBOX_NM ?= $(PATH_TOOL_MINGW32)/bin/nm.exe -p
-else
- VBOX_NM ?= nm -p
-endif
-
 MY_ASA_ASM_STUFF = \
 		$(addprefix -D, \
 			$(DEFS) \
@@ -609,6 +611,7 @@ $(VBOX_VMM_TESTCASE_OUT_DIR)/tstAsmStructsHC.h: $(VBOX_VMM_TESTCASE_OUT_DIR)/tst
 		-e '/VMCPU_size$$/d' \
 		-e '/VMMCPU_size$$/d' \
 		-e '/SUPDRVTRACERUSRCTX32_size$$/d' \
+		-e '/HMCPU_size$$/d' \
 		\
 		-e '/00[0-9a-fA-F]* [aA] [^_.]*_size$$/!d' \
 		-e 's/\(00[0-9a-fA-F]*\) [aA] \([^_.]*\)_size/    CHECK_SIZE(\2, 0x0\1);/' \
diff --git a/src/VBox/VMM/testcase/tstAnimate.cpp b/src/VBox/VMM/testcase/tstAnimate.cpp
index ba8eea1..745043b 100644
--- a/src/VBox/VMM/testcase/tstAnimate.cpp
+++ b/src/VBox/VMM/testcase/tstAnimate.cpp
@@ -310,7 +310,7 @@ static DECLCALLBACK(int) loadMem(PVM pVM, RTFILE File, uint64_t *poff)
 
             /* Write that page to the guest - skip known rom areas for now. */
             if (GCPhys < 0xa0000 || GCPhys >= 0x100000) /* ASSUME size of a8Page is a power of 2. */
-                PGMPhysWrite(pVM, GCPhys, &au8Page, cbRead);
+                PGMPhysWrite(pVM, GCPhys, &au8Page, cbRead, PGMACCESSORIGIN_DEBUGGER);
             GCPhys += cbRead;
         }
     }
diff --git a/src/VBox/VMM/testcase/tstHelp.h b/src/VBox/VMM/testcase/tstHelp.h
index 1a3bba8..a9f58d4 100644
--- a/src/VBox/VMM/testcase/tstHelp.h
+++ b/src/VBox/VMM/testcase/tstHelp.h
@@ -36,7 +36,8 @@ RT_C_DECLS_END
     do { \
         if (off != RT_OFFSETOF(type, m)) \
         { \
-            printf("error! %#010x %s  Off by %d!! (off=%#x)\n", RT_OFFSETOF(type, m), #type "." #m, off - RT_OFFSETOF(type, m), off); \
+            printf("error! %#010x %s  Off by %d!! (expected off=%#x)\n", \
+                   RT_OFFSETOF(type, m), #type "." #m, off - RT_OFFSETOF(type, m), (int)off); \
             rc++; \
         } \
         /*else */ \
@@ -52,7 +53,8 @@ RT_C_DECLS_END
     do { \
         if (size != sizeof(type)) \
         { \
-            printf("error! sizeof(%s): %#x (%d)  Off by %d!!\n", #type, (int)sizeof(type), (int)sizeof(type), (int)(sizeof(type) - size)); \
+            printf("error! sizeof(%s): %#x (%d)  Off by %d!! (expected %#x)\n", \
+                   #type, (int)sizeof(type), (int)sizeof(type), (int)(sizeof(type) - size), (int)size); \
             rc++; \
         } \
         else \
diff --git a/src/VBox/VMM/testcase/tstIEMCheckMc.cpp b/src/VBox/VMM/testcase/tstIEMCheckMc.cpp
index 1ae3e8b..760bf71 100644
--- a/src/VBox/VMM/testcase/tstIEMCheckMc.cpp
+++ b/src/VBox/VMM/testcase/tstIEMCheckMc.cpp
@@ -107,6 +107,7 @@ typedef VBOXSTRICTRC (* PFNIEMOP)(PIEMCPU pIemCpu);
 #define IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE(a_szPrf)      do { } while (0)
 #define IEMOP_HLP_DONE_DECODING()                           do { } while (0)
 #define IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX()            do { } while (0)
+#define IEMOP_HLP_DONE_DECODING_NO_LOCK_REPZ_OR_REPNZ_PREFIXES()                                    do { } while (0)
 #define IEMOP_HLP_DECODED_NL_1(a_uDisOpNo, a_fIemOpFlags, a_uDisParam0, a_fDisOpType)               do { } while (0)
 #define IEMOP_HLP_DECODED_NL_2(a_uDisOpNo, a_fIemOpFlags, a_uDisParam0, a_uDisParam1, a_fDisOpType) do { } while (0)
 #define IEMOP_RAISE_DIVIDE_ERROR()                          VERR_TRPM_ACTIVE_TRAP
@@ -137,14 +138,10 @@ typedef VBOXSTRICTRC (* PFNIEMOP)(PIEMCPU pIemCpu);
 #define IEM_IS_REAL_OR_V86_MODE(a_pIemCpu)                  (g_fRandom)
 #define IEM_IS_LONG_MODE(a_pIemCpu)                         (g_fRandom)
 #define IEM_IS_REAL_MODE(a_pIemCpu)                         (g_fRandom)
-#define IEM_IS_AMD_CPUID_FEATURE_PRESENT_ECX(a_fEcx)        (g_fRandom)
-#define IEM_IS_AMD_CPUID_FEATURE_PRESENT_EDX(a_fEdx)        (g_fRandom)
-#define IEM_IS_AMD_CPUID_FEATURES_ANY_PRESENT(a_fEdx, a_fEcx) (g_fRandom)
-#define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(a_fEdx)      (g_fRandom)
-#define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_ECX(a_fEcx)      (g_fRandom)
-#define IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX_ON_HOST(a_fEdx) (g_fRandom)
 #define IEM_IS_GUEST_CPU_AMD(a_pIemCpu)                     (g_fRandom)
 #define IEM_IS_GUEST_CPU_INTEL(a_pIemCpu)                   (g_fRandom)
+#define IEM_GET_GUEST_CPU_FEATURES(a_pIemCpu)               ((PCCPUMFEATURES)(uintptr_t)42)
+#define IEM_GET_HOST_CPU_FEATURES(a_pIemCpu)                ((PCCPUMFEATURES)(uintptr_t)88)
 
 #define iemRecalEffOpSize(a_pIemCpu)                        do { } while (0)
 
@@ -496,6 +493,7 @@ IEMOPMEDIAF2 g_iemAImpl_pcmpeqd;
 #define IEM_MC_FETCH_MEM_S32_SX_U64(a_u64Dst, a_iSeg, a_GCPtrMem)       do { CHK_GCPTR(a_GCPtrMem); } while (0)
 #define IEM_MC_FETCH_MEM_U64(a_u64Dst, a_iSeg, a_GCPtrMem)              do { CHK_GCPTR(a_GCPtrMem); } while (0)
 #define IEM_MC_FETCH_MEM_U64_ALIGN_U128(a_u64Dst, a_iSeg, a_GCPtrMem)   do { CHK_GCPTR(a_GCPtrMem); } while (0)
+#define IEM_MC_FETCH_MEM_I64(a_i64Dst, a_iSeg, a_GCPtrMem)              do { CHK_GCPTR(a_GCPtrMem); CHK_TYPE(int64_t, a_i64Dst); } while (0)
 
 #define IEM_MC_FETCH_MEM_U8_DISP(a_u8Dst, a_iSeg, a_GCPtrMem, a_offDisp) \
     do { CHK_GCPTR(a_GCPtrMem); CHK_CONST(uint8_t, a_offDisp); CHK_TYPE(uint8_t, a_u8Dst); } while (0)
diff --git a/src/VBox/VMM/testcase/tstSSM-2.cpp b/src/VBox/VMM/testcase/tstSSM-2.cpp
new file mode 100644
index 0000000..adca3db
--- /dev/null
+++ b/src/VBox/VMM/testcase/tstSSM-2.cpp
@@ -0,0 +1,81 @@
+/* $Id: tstSSM-2.cpp $ */
+/** @file
+ * Saved State Manager Testcase: Extract the content of a saved state.
+ */
+
+/*
+ * Copyright (C) 2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <VBox/vmm/ssm.h>
+
+#include <VBox/log.h>
+#include <iprt/getopt.h>
+#include <iprt/err.h>
+#include <iprt/file.h>
+#include <iprt/path.h>
+#include <iprt/stream.h>
+
+static RTEXITCODE extractUnit(const char *pszFilename, const char *pszUnitname, const char *pszOutputFilename)
+{
+    PSSMHANDLE pSSM;
+    int rc = SSMR3Open(pszFilename, 0, &pSSM);
+    RTEXITCODE rcExit = RTEXITCODE_FAILURE;
+    if (RT_SUCCESS(rc))
+    {
+        RTFILE hFile;
+        rc = RTFileOpen(&hFile, pszOutputFilename, RTFILE_O_DENY_NONE | RTFILE_O_WRITE | RTFILE_O_CREATE);
+        if (RT_SUCCESS(rc))
+        {
+            uint32_t version = 0;
+            rc = SSMR3Seek(pSSM, pszUnitname, 0 /* iInstance */, &version);
+            size_t cbUnit = 0;
+            if (RT_SUCCESS(rc))
+            {
+                for (;;)
+                {
+                    uint8_t u8;
+                    rc = SSMR3GetU8(pSSM, &u8);
+                    if (RT_FAILURE(rc))
+                        break;
+                    size_t cbWritten;
+                    rc = RTFileWrite(hFile, &u8, sizeof(u8), &cbWritten);
+                    cbUnit++;
+                }
+                RTPrintf("Unit size %zu bytes, version %d\n", cbUnit, version);
+            }
+            else
+                RTPrintf("Cannot find unit '%s' (%Rrc)\n", pszUnitname, rc);
+            RTFileClose(hFile);
+        }
+        else
+            RTPrintf("Cannot open output file '%s' (%Rrc)\n", pszOutputFilename, rc);
+        SSMR3Close(pSSM);
+    }
+    else
+        RTPrintf("Cannot open SSM file '%s' (%Rrc)\n", pszFilename, rc);
+    return rcExit;
+}
+
+int main(int argc, char **argv)
+{
+    if (argc != 4)
+    {
+        RTPrintf("Usage: %s <SSM filename> <SSM unitname> <outfile>\n", RTPathFilename(argv[0]));
+        /* don't fail by default */
+        return RTEXITCODE_SUCCESS;
+    }
+    return extractUnit(argv[1], argv[2], argv[3]);
+}
diff --git a/src/VBox/VMM/testcase/tstVMM.cpp b/src/VBox/VMM/testcase/tstVMM.cpp
index eb13edf..d35bbb8 100644
--- a/src/VBox/VMM/testcase/tstVMM.cpp
+++ b/src/VBox/VMM/testcase/tstVMM.cpp
@@ -54,8 +54,10 @@ static uint32_t g_cCpus = 1;
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
-VMMR3DECL(int) VMMDoTest(PVM pVM);    /* Linked into VMM, see ../VMMTests.cpp. */
-VMMR3DECL(int) VMMDoBruteForceMsrs(PVM pVM); /* Ditto. */
+VMMR3DECL(int) VMMDoTest(PVM pVM);              /* Linked into VMM, see ../VMMTests.cpp. */
+VMMR3DECL(int) VMMDoBruteForceMsrs(PVM pVM);    /* Ditto. */
+VMMR3DECL(int) VMMDoKnownMsrs(PVM pVM);         /* Ditto. */
+VMMR3DECL(int) VMMDoMsrExperiments(PVM pVM);    /* Ditto. */
 
 
 /** Dummy timer callback. */
@@ -213,7 +215,7 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
     };
     enum
     {
-        kTstVMMTest_VMM,  kTstVMMTest_TM, kTstVMMTest_MSRs
+        kTstVMMTest_VMM,  kTstVMMTest_TM, kTstVMMTest_MSRs, kTstVMMTest_KnownMSRs, kTstVMMTest_MSRExperiments
     } enmTestOpt = kTstVMMTest_VMM;
 
     int ch;
@@ -235,6 +237,10 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
                     enmTestOpt = kTstVMMTest_TM;
                 else if (!strcmp("msr", ValueUnion.psz) || !strcmp("msrs", ValueUnion.psz))
                     enmTestOpt = kTstVMMTest_MSRs;
+                else if (!strcmp("known-msr", ValueUnion.psz) || !strcmp("known-msrs", ValueUnion.psz))
+                    enmTestOpt = kTstVMMTest_KnownMSRs;
+                else if (!strcmp("msr-experiments", ValueUnion.psz))
+                    enmTestOpt = kTstVMMTest_MSRExperiments;
                 else
                 {
                     RTPrintf("tstVMM: unknown test: '%s'\n", ValueUnion.psz);
@@ -243,11 +249,11 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
                 break;
 
             case 'h':
-                RTPrintf("usage: tstVMM [--cpus|-c cpus] [--test <vmm|tm|msr>]\n");
+                RTPrintf("usage: tstVMM [--cpus|-c cpus] [--test <vmm|tm|msrs|known-msrs>]\n");
                 return 1;
 
             case 'V':
-                RTPrintf("$Revision: 94787 $\n");
+                RTPrintf("$Revision: 94786 $\n");
                 return 0;
 
             default:
@@ -313,6 +319,35 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char **envp)
                     RTTestFailed(hTest, "The MSR test can only be run with one VCpu!\n");
                 break;
             }
+
+            case kTstVMMTest_KnownMSRs:
+            {
+                RTTestSub(hTest, "Known MSRs");
+                if (g_cCpus == 1)
+                {
+                    rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)VMMDoKnownMsrs, 1, pVM);
+                    if (RT_FAILURE(rc))
+                        RTTestFailed(hTest, "VMMDoKnownMsrs failed: rc=%Rrc\n", rc);
+                }
+                else
+                    RTTestFailed(hTest, "The MSR test can only be run with one VCpu!\n");
+                break;
+            }
+
+            case kTstVMMTest_MSRExperiments:
+            {
+                RTTestSub(hTest, "MSR Experiments");
+                if (g_cCpus == 1)
+                {
+                    rc = VMR3ReqCallWaitU(pUVM, 0 /*idDstCpu*/, (PFNRT)VMMDoMsrExperiments, 1, pVM);
+                    if (RT_FAILURE(rc))
+                        RTTestFailed(hTest, "VMMDoMsrExperiments failed: rc=%Rrc\n", rc);
+                }
+                else
+                    RTTestFailed(hTest, "The MSR test can only be run with one VCpu!\n");
+                break;
+            }
+
         }
 
         /*
diff --git a/src/VBox/VMM/testcase/tstVMStruct.h b/src/VBox/VMM/testcase/tstVMStruct.h
index 902b0fd..d5a918a 100644
--- a/src/VBox/VMM/testcase/tstVMStruct.h
+++ b/src/VBox/VMM/testcase/tstVMStruct.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (C) 2006-2013 Oracle Corporation
+ * Copyright (C) 2006-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -28,19 +28,14 @@
     GEN_CHECK_SIZE(CPUM);    // has .mac
     GEN_CHECK_OFF(CPUM, offCPUMCPU0);
     GEN_CHECK_OFF(CPUM, fHostUseFlags);
-    GEN_CHECK_OFF(CPUM, CPUFeatures);
-    GEN_CHECK_OFF(CPUM, CPUFeaturesExt);
-    GEN_CHECK_OFF(CPUM, CPUFeaturesExt);
     GEN_CHECK_OFF(CPUM, CR4);
 #ifndef VBOX_FOR_DTRACE_LIB
     GEN_CHECK_OFF(CPUM, u8PortableCpuIdLevel);
     GEN_CHECK_OFF(CPUM, fPendingRestore);
 #endif
-    GEN_CHECK_OFF(CPUM, aGuestCpuIdStd);
-    GEN_CHECK_OFF(CPUM, aGuestCpuIdExt);
-    GEN_CHECK_OFF(CPUM, aGuestCpuIdCentaur);
-    GEN_CHECK_OFF(CPUM, aGuestCpuIdHyper);
-    GEN_CHECK_OFF(CPUM, GuestCpuIdDef);
+    GEN_CHECK_OFF(CPUM, aGuestCpuIdPatmStd);
+    GEN_CHECK_OFF(CPUM, aGuestCpuIdPatmExt);
+    GEN_CHECK_OFF(CPUM, aGuestCpuIdPatmCentaur);
 
     GEN_CHECK_SIZE(CPUMCPU); // has .mac
     GEN_CHECK_OFF(CPUMCPU, Hyper);
@@ -64,7 +59,9 @@
     GEN_CHECK_OFF(CPUMCPU, fRemEntered);
 
     GEN_CHECK_SIZE(CPUMHOSTCTX);
-    GEN_CHECK_OFF(CPUMHOSTCTX, fpu);
+    GEN_CHECK_OFF(CPUMHOSTCTX, pXStateR3);
+    GEN_CHECK_OFF(CPUMHOSTCTX, pXStateR0);
+    GEN_CHECK_OFF(CPUMHOSTCTX, pXStateRC);
 #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
     GEN_CHECK_OFF(CPUMHOSTCTX, rbx);
     GEN_CHECK_OFF(CPUMHOSTCTX, rdi);
@@ -133,7 +130,9 @@
 #endif
 
     GEN_CHECK_SIZE(CPUMCTX);
-    GEN_CHECK_OFF(CPUMCTX, fpu);
+    GEN_CHECK_OFF(CPUMCTX, pXStateR0);
+    GEN_CHECK_OFF(CPUMCTX, pXStateR3);
+    GEN_CHECK_OFF(CPUMCTX, pXStateRC);
     GEN_CHECK_OFF(CPUMCTX, rdi);
     GEN_CHECK_OFF(CPUMCTX, rsi);
     GEN_CHECK_OFF(CPUMCTX, rbp);
@@ -776,29 +775,45 @@
     GEN_CHECK_SIZE(PGMPHYSHANDLER);
     GEN_CHECK_OFF(PGMPHYSHANDLER, Core);
     GEN_CHECK_SIZE(((PPGMPHYSHANDLER)0)->Core);
-    GEN_CHECK_OFF(PGMPHYSHANDLER, enmType);
     GEN_CHECK_OFF(PGMPHYSHANDLER, cPages);
     GEN_CHECK_OFF(PGMPHYSHANDLER, cAliasedPages);
     GEN_CHECK_OFF(PGMPHYSHANDLER, cTmpOffPages);
-    GEN_CHECK_OFF(PGMPHYSHANDLER, pfnHandlerR3);
+    GEN_CHECK_OFF(PGMPHYSHANDLER, hType);
     GEN_CHECK_OFF(PGMPHYSHANDLER, pvUserR3);
-    GEN_CHECK_OFF(PGMPHYSHANDLER, pfnHandlerR0);
     GEN_CHECK_OFF(PGMPHYSHANDLER, pvUserR0);
-    GEN_CHECK_OFF(PGMPHYSHANDLER, pfnHandlerRC);
     GEN_CHECK_OFF(PGMPHYSHANDLER, pvUserRC);
-    GEN_CHECK_OFF(PGMPHYSHANDLER, pszDesc);
+    //GEN_CHECK_OFF(PGMPHYSHANDLER, pszDesc);
+    GEN_CHECK_SIZE(PGMPHYSHANDLERTYPEINT);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, u32Magic);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, cRefs);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, ListNode);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, enmKind);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, uState);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, pfnHandlerR3);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, pfnPfHandlerR0);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, pfnPfHandlerRC);
+    GEN_CHECK_OFF(PGMPHYSHANDLERTYPEINT, pszDesc);
     GEN_CHECK_SIZE(PGMPHYS2VIRTHANDLER);
     GEN_CHECK_OFF(PGMPHYS2VIRTHANDLER, Core);
     GEN_CHECK_OFF(PGMPHYS2VIRTHANDLER, offVirtHandler);
     GEN_CHECK_SIZE(PGMVIRTHANDLER);
     GEN_CHECK_OFF(PGMVIRTHANDLER, Core);
-    GEN_CHECK_OFF(PGMVIRTHANDLER, enmType);
+    GEN_CHECK_OFF(PGMVIRTHANDLER, hType);
     GEN_CHECK_OFF(PGMVIRTHANDLER, cb);
-    GEN_CHECK_OFF(PGMVIRTHANDLER, pfnHandlerR3);
-    GEN_CHECK_OFF(PGMVIRTHANDLER, pfnHandlerRC);
-    GEN_CHECK_OFF(PGMVIRTHANDLER, pszDesc);
     GEN_CHECK_OFF(PGMVIRTHANDLER, cPages);
+    GEN_CHECK_OFF(PGMVIRTHANDLER, pszDesc);
     GEN_CHECK_OFF(PGMVIRTHANDLER, aPhysToVirt);
+    GEN_CHECK_SIZE(PGMVIRTHANDLERTYPEINT);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, u32Magic);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, cRefs);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, ListNode);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, enmKind);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, uState);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, fRelocUserRC);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, pfnPfHandlerRC);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, pfnInvalidateR3);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, pfnHandlerR3);
+    GEN_CHECK_OFF(PGMVIRTHANDLERTYPEINT, pszDesc);
     GEN_CHECK_SIZE(PGMPAGE);
     GEN_CHECK_OFF_DOT(PGMPAGE, s.cReadLocksY);
     GEN_CHECK_OFF_DOT(PGMPAGE, s.cWriteLocksY);
@@ -960,17 +975,17 @@
     GEN_CHECK_OFF(REMHANDLERNOTIFICATION, u);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalRegister.GCPhys);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalRegister.cb);
-    GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalRegister.enmType);
+    GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalRegister.enmKind);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalRegister.fHasHCHandler);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalDeregister.GCPhys);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalDeregister.cb);
-    GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalDeregister.enmType);
+    GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalDeregister.enmKind);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalDeregister.fHasHCHandler);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalDeregister.fRestoreAsRAM);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalModify.GCPhysOld);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalModify.GCPhysNew);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalModify.cb);
-    GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalModify.enmType);
+    GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalModify.enmKind);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalModify.fHasHCHandler);
     GEN_CHECK_OFF_DOT(REMHANDLERNOTIFICATION, u.PhysicalModify.fRestoreAsRAM);
     GEN_CHECK_OFF(REMHANDLERNOTIFICATION, idxSelf);
@@ -983,10 +998,14 @@
     GEN_CHECK_OFF(SELM, aHyperSel[SELM_HYPER_SEL_CS64]);
     GEN_CHECK_OFF(SELM, aHyperSel[SELM_HYPER_SEL_TSS]);
     GEN_CHECK_OFF(SELM, aHyperSel[SELM_HYPER_SEL_TSS_TRAP08]);
+    GEN_CHECK_OFF(SELM, hShadowGdtWriteHandlerType);
+    GEN_CHECK_OFF(SELM, hGuestGdtWriteHandlerType);
     GEN_CHECK_OFF(SELM, paGdtR3);
     GEN_CHECK_OFF(SELM, paGdtRC);
     GEN_CHECK_OFF(SELM, GuestGdtr);
     GEN_CHECK_OFF(SELM, cbEffGuestGdtLimit);
+    GEN_CHECK_OFF(SELM, hShadowLdtWriteHandlerType);
+    GEN_CHECK_OFF(SELM, hGuestLdtWriteHandlerType);
     GEN_CHECK_OFF(SELM, pvLdtR3);
     GEN_CHECK_OFF(SELM, pvLdtRC);
     GEN_CHECK_OFF(SELM, GCPtrGuestLdt);
@@ -994,6 +1013,8 @@
     GEN_CHECK_OFF(SELM, offLdtHyper);
     GEN_CHECK_OFF(SELM, Tss);
     GEN_CHECK_OFF(SELM, TssTrap08);
+    GEN_CHECK_OFF(SELM, hShadowTssWriteHandlerType);
+    GEN_CHECK_OFF(SELM, hGuestTssWriteHandlerType);
     GEN_CHECK_OFF(SELM, pvMonShwTssRC);
     GEN_CHECK_OFF(SELM, GCPtrGuestTss);
     GEN_CHECK_OFF(SELM, cbGuestTss);
@@ -1011,7 +1032,7 @@
     //GEN_CHECK_OFF(TM, pvGIPR0);
     GEN_CHECK_OFF(TM, pvGIPRC);
     GEN_CHECK_OFF(TMCPU, fTSCTicking);
-    GEN_CHECK_OFF(TM, fTSCUseRealTSC);
+    GEN_CHECK_OFF(TM, enmTSCMode);
     GEN_CHECK_OFF(TM, fTSCTiedToExecution);
     GEN_CHECK_OFF(TMCPU, offTSCRawSrc);
     GEN_CHECK_OFF(TMCPU, u64TSC);
diff --git a/src/VBox/VMM/testcase/tstVMStructDTrace.cpp b/src/VBox/VMM/testcase/tstVMStructDTrace.cpp
index d30d9b7..584b6da 100644
--- a/src/VBox/VMM/testcase/tstVMStructDTrace.cpp
+++ b/src/VBox/VMM/testcase/tstVMStructDTrace.cpp
@@ -44,6 +44,7 @@
 #include "HMInternal.h"
 #include "VMMInternal.h"
 #include "DBGFInternal.h"
+#include "GIMInternal.h"
 #include "STAMInternal.h"
 #include "EMInternal.h"
 #include "IEMInternal.h"
diff --git a/src/VBox/VMM/testcase/tstVMStructRC.cpp b/src/VBox/VMM/testcase/tstVMStructRC.cpp
index 3be4e26..49a0efe 100644
--- a/src/VBox/VMM/testcase/tstVMStructRC.cpp
+++ b/src/VBox/VMM/testcase/tstVMStructRC.cpp
@@ -73,6 +73,7 @@ AssertCompileSize(RTHCPHYS, 8);
 #include "PATMInternal.h"
 #include "VMMInternal.h"
 #include "DBGFInternal.h"
+#include "GIMInternal.h"
 #include "STAMInternal.h"
 #include "CSAMInternal.h"
 #include "EMInternal.h"
diff --git a/src/VBox/VMM/testcase/tstVMStructSize.cpp b/src/VBox/VMM/testcase/tstVMStructSize.cpp
index 133549e..83449f8 100644
--- a/src/VBox/VMM/testcase/tstVMStructSize.cpp
+++ b/src/VBox/VMM/testcase/tstVMStructSize.cpp
@@ -6,7 +6,7 @@
  */
 
 /*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2014 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -43,6 +43,7 @@
 #include "HMInternal.h"
 #include "VMMInternal.h"
 #include "DBGFInternal.h"
+#include "GIMInternal.h"
 #include "STAMInternal.h"
 #include "VMInternal.h"
 #include "EMInternal.h"
@@ -225,6 +226,7 @@ int main()
     CHECK_PADDING_VM(64, tm);
     PRINT_OFFSET(VM, tm.s.VirtualSyncLock);
     CHECK_PADDING_VM(64, dbgf);
+    CHECK_PADDING_VM(64, gim);
     CHECK_PADDING_VM(64, ssm);
     CHECK_PADDING_VM(64, rem);
     CHECK_PADDING_VM(8, vm);
@@ -241,6 +243,7 @@ int main()
     CHECK_PADDING_VMCPU(64, pdm);
     CHECK_PADDING_VMCPU(64, iom);
     CHECK_PADDING_VMCPU(64, dbgf);
+    CHECK_PADDING_VMCPU(64, gim);
 #if 0
     PRINT_OFFSET(VMCPU, abAlignment2);
 #endif
@@ -294,7 +297,6 @@ int main()
     CHECK_SIZE_ALIGNMENT(VMCPU, 4096);
 
     /* cpumctx */
-    CHECK_MEMBER_ALIGNMENT(CPUMCTX, fpu, 32);
     CHECK_MEMBER_ALIGNMENT(CPUMCTX, rax, 32);
     CHECK_MEMBER_ALIGNMENT(CPUMCTX, idtr.pIdt, 8);
     CHECK_MEMBER_ALIGNMENT(CPUMCTX, gdtr.pGdt, 8);
@@ -404,14 +406,21 @@ int main()
 
     /* hm - 32-bit gcc won't align uint64_t naturally, so check. */
     CHECK_MEMBER_ALIGNMENT(HM, uMaxAsid, 8);
-    CHECK_MEMBER_ALIGNMENT(HM, vmx.u64HostCr4, 8);
-    CHECK_MEMBER_ALIGNMENT(HM, vmx.Msrs.u64FeatureCtrl, 8);
-    CHECK_MEMBER_ALIGNMENT(HM, StatTprPatchSuccess, 8);
-    CHECK_MEMBER_ALIGNMENT(HMCPU, StatEntry, 8);
-    CHECK_MEMBER_ALIGNMENT(HMCPU, vmx.HCPhysVmcs, sizeof(RTHCPHYS));
-    CHECK_MEMBER_ALIGNMENT(HMCPU, vmx.u32PinCtls, 8);
-    CHECK_MEMBER_ALIGNMENT(HMCPU, DisState, 8);
+    CHECK_MEMBER_ALIGNMENT(HM, vmx, 8);
+    CHECK_MEMBER_ALIGNMENT(HM, vmx.Msrs, 8);
+    CHECK_MEMBER_ALIGNMENT(HM, svm, 8);
+    CHECK_MEMBER_ALIGNMENT(HM, PatchTree, 8);
+    CHECK_MEMBER_ALIGNMENT(HM, aPatches, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, vmx, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, vmx.pfnStartVM, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, vmx.HCPhysVmcs, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, vmx.LastError, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, svm, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, svm.pfnVMRun, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, Event, 8);
     CHECK_MEMBER_ALIGNMENT(HMCPU, Event.u64IntInfo, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, DisState, 8);
+    CHECK_MEMBER_ALIGNMENT(HMCPU, StatEntry, 8);
 
     /* Make sure the set is large enough and has the correct size. */
     CHECK_SIZE(VMCPUSET, 32);
diff --git a/src/VBox/VMM/testcase/tstX86-FpuSaveRestore.cpp b/src/VBox/VMM/testcase/tstX86-FpuSaveRestore.cpp
new file mode 100644
index 0000000..b21754a
--- /dev/null
+++ b/src/VBox/VMM/testcase/tstX86-FpuSaveRestore.cpp
@@ -0,0 +1,116 @@
+/* $Id: tstX86-FpuSaveRestore.cpp $ */
+/** @file
+ * tstX86-FpuSaveRestore - Experimenting with saving and restoring FPU.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/initterm.h>
+#include <iprt/message.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+#include <iprt/x86.h>
+
+DECLASM(void) MyFpuPrepXcpt(void);
+DECLASM(void) MyFpuSave(PX86FXSTATE pState);
+DECLASM(void) MyFpuStoreEnv(PX86FSTENV32P pEnv);
+DECLASM(void) MyFpuRestore(PX86FXSTATE pState);
+DECLASM(void) MyFpuLoadEnv(PX86FSTENV32P pEnv);
+
+int main()
+{
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("tstX86-FpuSaveRestore", &hTest);
+    RTTestBanner(hTest);
+
+
+
+    RTTestSub(hTest, "CS/DS Selector");
+
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "Initial state (0x20 will be subtracted from IP):\n");
+    /* Trigger an exception to make sure we've got something to look at. */
+    MyFpuPrepXcpt();
+    static X86FXSTATE FxState;
+    MyFpuSave(&FxState);
+    static X86FSTENV32P FpuEnv;
+    MyFpuStoreEnv(&FpuEnv);
+#ifdef RT_ARCH_AMD64
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FxState IP=%#06x%04x%08x\n",  FxState.Rsrvd1, FxState.CS, FxState.FPUIP);
+#else
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FxState CS:IP=%#06x:%#010x\n",  FxState.CS, FxState.FPUIP);
+#endif
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FpuEnv  CS:IP=%#06x:%#010x\n",  FpuEnv.FPUCS, FpuEnv.FPUIP);
+
+    /* Modify the state a little so we can tell the difference. */
+    static X86FXSTATE FxState2;
+    FxState2 = FxState;
+    FxState2.FPUIP -= 0x20;
+    static X86FSTENV32P FpuEnv2;
+    FpuEnv2 = FpuEnv;
+    FpuEnv2.FPUIP  -= 0x20;
+
+    /* Just do FXRSTOR. */
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "Just FXRSTOR:\n");
+    MyFpuRestore(&FxState2);
+
+    static X86FXSTATE FxStateJustRestore;
+    MyFpuSave(&FxStateJustRestore);
+    static X86FSTENV32P FpuEnvJustRestore;
+    MyFpuStoreEnv(&FpuEnvJustRestore);
+#ifdef RT_ARCH_AMD64
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FxState IP=%#06x%04x%08x\n",  FxStateJustRestore.Rsrvd1, FxStateJustRestore.CS, FxStateJustRestore.FPUIP);
+#else
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FxState CS:IP=%#06x:%#010x\n",  FxStateJustRestore.CS, FxStateJustRestore.FPUIP);
+#endif
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FpuEnv  CS:IP=%#06x:%#010x\n",  FpuEnvJustRestore.FPUCS, FpuEnvJustRestore.FPUIP);
+
+
+    /* FXRSTORE + FLDENV */
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "FXRSTOR first, then FLDENV:\n");
+    MyFpuRestore(&FxState2);
+    MyFpuLoadEnv(&FpuEnv2);
+
+    static X86FXSTATE FxStateRestoreLoad;
+    MyFpuSave(&FxStateRestoreLoad);
+    static X86FSTENV32P FpuEnvRestoreLoad;
+    MyFpuStoreEnv(&FpuEnvRestoreLoad);
+#ifdef RT_ARCH_AMD64
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FxState IP=%#06x%04x%08x\n",  FxStateRestoreLoad.Rsrvd1, FxStateRestoreLoad.CS, FxStateRestoreLoad.FPUIP);
+#else
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FxState CS:IP=%#06x:%#010x\n",  FxStateRestoreLoad.CS, FxStateRestoreLoad.FPUIP);
+#endif
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FpuEnv  CS:IP=%#06x:%#010x\n",  FpuEnvRestoreLoad.FPUCS, FpuEnvRestoreLoad.FPUIP);
+
+    /* Reverse the order (FLDENV + FXRSTORE). */
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "FLDENV first, then FXRSTOR:\n");
+    MyFpuLoadEnv(&FpuEnv2);
+    MyFpuRestore(&FxState2);
+
+    static X86FXSTATE FxStateLoadRestore;
+    MyFpuSave(&FxStateLoadRestore);
+    static X86FSTENV32P FpuEnvLoadRestore;
+    MyFpuStoreEnv(&FpuEnvLoadRestore);
+#ifdef RT_ARCH_AMD64
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FxState IP=%#06x%04x%08x\n",  FxStateLoadRestore.Rsrvd1, FxStateLoadRestore.CS, FxStateLoadRestore.FPUIP);
+#else
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FxState CS:IP=%#06x:%#010x\n",  FxStateLoadRestore.CS, FxStateLoadRestore.FPUIP);
+#endif
+    RTTestIPrintf(RTTESTLVL_ALWAYS,  "  FpuEnv  CS:IP=%#06x:%#010x\n",  FpuEnvLoadRestore.FPUCS, FpuEnvLoadRestore.FPUIP);
+
+
+    return RTTestSummaryAndDestroy(hTest);
+}
diff --git a/src/VBox/VMM/testcase/tstX86-FpuSaveRestoreA.asm b/src/VBox/VMM/testcase/tstX86-FpuSaveRestoreA.asm
new file mode 100644
index 0000000..3680553
--- /dev/null
+++ b/src/VBox/VMM/testcase/tstX86-FpuSaveRestoreA.asm
@@ -0,0 +1,117 @@
+; $Id: tstX86-FpuSaveRestoreA.asm $
+;; @file
+; tstX86-FpuSaveRestore - Experimenting with saving and restoring FPU, assembly bits.
+;
+
+;
+; Copyright (C) 2013 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+
+
+
+;*******************************************************************************
+;*  Header Files                                                               *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+
+
+;*******************************************************************************
+;*  Global Variables                                                           *
+;*******************************************************************************
+BEGINCODE
+g_r80_Zero:     dt 0.0
+g_r80_One:      dt 1.0
+
+
+BEGINCODE
+
+;; Prepares a FPU exception.
+BEGINPROC MyFpuPrepXcpt
+        fld tword [g_r80_One  xWrtRIP]
+        fld tword [g_r80_Zero xWrtRIP]
+        fdiv    st0
+        ret
+ENDPROC   MyFpuPrepXcpt
+
+
+;; Same as above, just different address.
+BEGINPROC MyFpuPrepXcpt2
+        fld tword [g_r80_One  xWrtRIP]
+        fld tword [g_r80_Zero xWrtRIP]
+        fdiv    st0
+        ret
+ENDPROC   MyFpuPrepXcpt2
+
+
+BEGINPROC MyFpuSave
+%ifdef ASM_CALL64_MSC
+        o64 fxsave  [rcx]
+%elifdef ASM_CALL64_GCC
+        o64 fxsave  [rdi]
+%elifdef RT_ARCH_X86
+        mov         ecx, [esp + 4]
+        fxsave      [ecx]
+%else
+ %error "Unsupported architecture."
+        bad arch
+%endif
+        ret
+ENDPROC   MyFpuSave
+
+
+BEGINPROC MyFpuStoreEnv
+%ifdef ASM_CALL64_MSC
+        fstenv  [rcx]
+%elifdef ASM_CALL64_GCC
+        fstenv  [rdi]
+%elifdef RT_ARCH_X86
+        mov     ecx, [esp + 4]
+        fstenv  [ecx]
+%else
+ %error "Unsupported architecture."
+        bad arch
+%endif
+        ret
+ENDPROC   MyFpuStoreEnv
+
+
+BEGINPROC MyFpuRestore
+%ifdef ASM_CALL64_MSC
+        o64 fxrstor [rcx]
+%elifdef ASM_CALL64_GCC
+        o64 fxrstor [rdi]
+%elifdef RT_ARCH_X86
+        mov         ecx, [esp + 4]
+        fxrstor     [ecx]
+%else
+ %error "Unsupported architecture."
+        bad arch
+%endif
+        ret
+ENDPROC   MyFpuRestore
+
+
+BEGINPROC MyFpuLoadEnv
+%ifdef ASM_CALL64_MSC
+        fldenv  [rcx]
+%elifdef ASM_CALL64_GCC
+        fldenv  [rdi]
+%elifdef RT_ARCH_X86
+        mov     ecx, [esp + 4]
+        fldenv  [ecx]
+%else
+ %error "Unsupported architecture."
+        bad arch
+%endif
+        ret
+ENDPROC   MyFpuLoadEnv
+
diff --git a/src/VBox/VMM/tools/Makefile.kmk b/src/VBox/VMM/tools/Makefile.kmk
index 0c32195..ec5b995 100644
--- a/src/VBox/VMM/tools/Makefile.kmk
+++ b/src/VBox/VMM/tools/Makefile.kmk
@@ -53,7 +53,7 @@ endif
 #
 # CPU report program (CPUM DB).
 #
-#PROGRAMS += VBoxCpuReport - not on 4.3, supdrv interface currently missing.
+PROGRAMS += VBoxCpuReport
 VBoxCpuReport_TEMPLATE := VBoxR3Static
 VBoxCpuReport_DEFS      = IN_VMM_R3 IN_VBOX_CPU_REPORT
 VBoxCpuReport_INCS      = ../include
diff --git a/src/VBox/VMM/tools/VBoxCpuReport.cpp b/src/VBox/VMM/tools/VBoxCpuReport.cpp
index 940c43b..d2fea48 100644
--- a/src/VBox/VMM/tools/VBoxCpuReport.cpp
+++ b/src/VBox/VMM/tools/VBoxCpuReport.cpp
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright (C) 2013 Oracle Corporation
+ * Copyright (C) 2013-2015 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
  * available from http://www.virtualbox.org. This file is free software;
@@ -4388,10 +4388,15 @@ static int produceCpuIdArray(const char *pszNameC, const char *pszCpuDesc)
         {
             vbCpuRepPrintf("0");
             uint32_t fFlags = paLeaves[i].fFlags;
-            if (paLeaves[i].fFlags & CPUMCPUIDLEAF_F_SUBLEAVES_ECX_UNCHANGED)
+            if (paLeaves[i].fFlags & CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES)
             {
-                vbCpuRepPrintf(" | CPUMCPUIDLEAF_F_SUBLEAVES_ECX_UNCHANGED");
-                fFlags &= ~CPUMCPUIDLEAF_F_SUBLEAVES_ECX_UNCHANGED;
+                vbCpuRepPrintf(" | CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES");
+                fFlags &= ~CPUMCPUIDLEAF_F_INTEL_TOPOLOGY_SUBLEAVES;
+            }
+            if (paLeaves[i].fFlags & CPUMCPUIDLEAF_F_CONTAINS_APIC_ID)
+            {
+                vbCpuRepPrintf(" | CPUMCPUIDLEAF_F_CONTAINS_APIC_ID");
+                fFlags &= ~CPUMCPUIDLEAF_F_CONTAINS_APIC_ID;
             }
             if (fFlags)
             {
@@ -4588,7 +4593,7 @@ static int produceCpuReport(void)
                        " */\n"
                        "\n"
                        "/*\n"
-                       " * Copyright (C) 2013 Oracle Corporation\n"
+                       " * Copyright (C) 2013-2015 Oracle Corporation\n"
                        " *\n"
                        " * This file is part of VirtualBox Open Source Edition (OSE), as\n"
                        " * available from http://www.virtualbox.org. This file is free software;\n"
@@ -4614,7 +4619,7 @@ static int produceCpuReport(void)
     if (RT_FAILURE(rc))
         return rc;
 
-    CPUMUKNOWNCPUID enmUnknownMethod;
+    CPUMUNKNOWNCPUID enmUnknownMethod;
     CPUMCPUID       DefUnknown;
     rc = CPUMR3CpuIdDetectUnknownLeafMethod(&enmUnknownMethod, &DefUnknown);
     if (RT_FAILURE(rc))
@@ -4649,7 +4654,7 @@ static int produceCpuReport(void)
                    "    /*.cMaxPhysAddrWidth= */ %u,\n"
                    "    /*.paCpuIdLeaves    = */ NULL_ALONE(g_aCpuIdLeaves_%s),\n"
                    "    /*.cCpuIdLeaves     = */ ZERO_ALONE(RT_ELEMENTS(g_aCpuIdLeaves_%s)),\n"
-                   "    /*.enmUnknownCpuId  = */ CPUMUKNOWNCPUID_%s,\n"
+                   "    /*.enmUnknownCpuId  = */ CPUMUNKNOWNCPUID_%s,\n"
                    "    /*.DefUnknownCpuId  = */ { %#010x, %#010x, %#010x, %#010x },\n"
                    "    /*.fMsrMask         = */ %s,\n"
                    "    /*.cMsrRanges       = */ ZERO_ALONE(RT_ELEMENTS(g_aMsrRanges_%s)),\n"
@@ -4672,10 +4677,10 @@ static int produceCpuReport(void)
                    szNameC,
                    szNameC,
                    CPUMR3CpuIdUnknownLeafMethodName(enmUnknownMethod),
-                   DefUnknown.eax,
-                   DefUnknown.ebx,
-                   DefUnknown.ecx,
-                   DefUnknown.edx,
+                   DefUnknown.uEax,
+                   DefUnknown.uEbx,
+                   DefUnknown.uEcx,
+                   DefUnknown.uEdx,
                    szMsrMask,
                    szNameC,
                    szNameC,
diff --git a/src/VBox/ValidationKit/Config.kmk b/src/VBox/ValidationKit/Config.kmk
new file mode 100644
index 0000000..c9ff640
--- /dev/null
+++ b/src/VBox/ValidationKit/Config.kmk
@@ -0,0 +1,237 @@
+# $Id: Config.kmk $
+## @file
+# kBuild Configuration file for the VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+VBOX_VALIDATIONKIT_CONFIG_KMK_INCLUDED = 1
+
+# Include the top-level configure file.
+ifndef VBOX_ROOT_CONFIG_KMK_INCLUDED
+ include $(PATH_ROOT)/Config.kmk
+endif
+
+#
+# Globals
+#
+VBOX_PATH_VALIDATIONKIT_SRC := $(PATH_ROOT)/src/VBox/ValidationKit
+
+
+#
+# Base template that drops the -static flag since we only want to use the
+# static version of our own libraries and not the system libs.
+#
+TEMPLATE_VBoxValidationKitR3Base = VBox Validation Kit ring-3 program base, both guest and host.
+TEMPLATE_VBoxValidationKitR3Base_EXTENDS = VBoxR3Static
+ifn1of ($(KBUILD_TARGET), darwin solaris win)
+ TEMPLATE_VBoxValidationKitR3Base_CFLAGS          = $(filter-out -static, $(TEMPLATE_VBoxR3Static_CFLAGS))
+ TEMPLATE_VBoxValidationKitR3Base_CXXFLAGS        = $(filter-out -static, $(TEMPLATE_VBoxR3Static_CXXFLAGS))
+ TEMPLATE_VBoxValidationKitR3Base_OBJCFLAGS       = $(filter-out -static, $(TEMPLATE_VBoxR3Static_OBJCFLAGS))
+ TEMPLATE_VBoxValidationKitR3Base_LDFLAGS         = $(filter-out -static, $(TEMPLATE_VBoxR3Static_LDFLAGS))
+endif
+TEMPLATE_VBoxValidationKitR3Base_LIBS = $(TEMPLATE_VBoxR3Static_LIBS)
+if1of ($(KBUILD_TARGET), linux)
+ TEMPLATE_VBoxValidationKitR3Base_LIBS += supc++ crypt
+ TEMPLATE_VBoxValidationKitR3Base_LDTOOL = $(subst GXX,GCC,$(TEMPLATE_VBoxR3Static_TOOL))
+endif
+TEMPLATE_VBoxValidationKitR3Base_LDFLAGS.darwin = $(TEMPLATE_VBoxR3Static_LDFLAGS.darwin) -framework IOKit
+
+#
+# Template for building ring-3 progams for the Validation Kit.
+# These programs can run on any host or guest.
+#
+TEMPLATE_VBoxValidationKitR3 = VBox Validation Kit ring-3 program, both guest and host.
+TEMPLATE_VBoxValidationKitR3_EXTENDS = VBoxValidationKitR3Base
+TEMPLATE_VBoxValidationKitR3_EXTENDS_BY = appending
+TEMPLATE_VBoxValidationKitR3_INST = $(INST_VALIDATIONKIT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
+TEMPLATE_VBoxValidationKitR3_SDKS.win = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
+TEMPLATE_VBoxValidationKitR3_DEFS = IN_RT_R3
+TEMPLATE_VBoxValidationKitR3_LIBS.darwin = iconv
+TEMPLATE_VBoxValidationKitR3_LIBS.freebsd = iconv
+TEMPLATE_VBoxValidationKitR3_LIBS = \
+	$(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
+ifdef IPRT_WITH_KSTUFF
+ TEMPLATE_VBoxValidationKitR3_LIBS += \
+ 	$(PATH_STAGE_LIB)/VBox-kStuffStatic$(VBOX_SUFF_LIB) \
+ 	$(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
+endif
+ifeq ($(KBUILD_TARGET),solaris)
+ TEMPLATE_VBoxValidationKitR3_LIBS += \
+	kstat \
+	nsl \
+	contract
+ if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
+  TEMPLATE_VBoxValidationKitR3_LIBS += \
+  	smbios
+ endif
+endif
+ifneq ($(KBUILD_TARGET),win)
+ TEMPLATE_VBoxValidationKitR3_LIBS += \
+ 	$(SDK_VBOX_ZLIB_LIBS)
+endif
+
+# Make VCC100 output work on NT4, W2K, XP and W2K3.
+TEMPLATE_VBoxValidationKitR3_LIBS.win.x86 = \
+       $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/oldnames.lib \
+       $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/libcmt$(VBOX_VCC_CRT_TYPE).lib \
+       $(PATH_TOOL_$(TEMPLATE_VBoxValidationKitR3_TOOL.win.x86)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
+	$(PATH_STAGE_LIB)/RuntimeR3VccTricks$(VBOX_SUFF_LIB)
+ifeq ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),win.x86)
+TEMPLATE_VBoxValidationKitR3_POST_CMDS = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION) $(out)$$(NLTAB))$(TEMPLATE_VBoxValidationKitR3Base_POST_CMDS)$$(NLTAB)
+endif
+TEMPLATE_VBoxValidationKitR3_LNK_DEPS.win.x86  = $(if $(eq $(tool_do),LINK_LIBRARY),,$(VBOX_PE_SET_VERSION))
+
+#TODO: TEMPLATE_VBoxValidationKitR3_EXTENDS = VBOXGUESTR3EXE
+
+
+#
+# Template for building ring-3 progams for the Validation Kit.
+# These programs can run on the host and may take advantage of the support
+# driver when installed.
+#
+TEMPLATE_VBoxValidationKitR3Host = VBox Validation Kit ring-3 program, mainly host.
+TEMPLATE_VBoxValidationKitR3Host_EXTENDS = VBoxValidationKitR3Base
+TEMPLATE_VBoxValidationKitR3Host_EXTENDS_BY = appending
+TEMPLATE_VBoxValidationKitR3Host_INST = $(INST_VALIDATIONKIT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
+TEMPLATE_VBoxValidationKitR3Host_SDKS.win = ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_NTDLL
+TEMPLATE_VBoxValidationKitR3Host_DEFS = IN_RT_R3 IN_SUP_R3
+TEMPLATE_VBoxValidationKitR3Host_LIBS.darwin = iconv
+TEMPLATE_VBoxValidationKitR3Host_LIBS.freebsd = iconv
+TEMPLATE_VBoxValidationKitR3Host_LIBS = \
+	$(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB) \
+	$(PATH_STAGE_LIB)/SUPR3Static$(VBOX_SUFF_LIB) \
+	$(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
+ifdef IPRT_WITH_KSTUFF
+ TEMPLATE_VBoxValidationKitR3Host_LIBS += \
+ 	$(PATH_STAGE_LIB)/VBox-kStuffStatic$(VBOX_SUFF_LIB) \
+ 	$(PATH_STAGE_LIB)/RuntimeR3$(VBOX_SUFF_LIB)
+endif
+ifeq ($(KBUILD_TARGET),solaris)
+ TEMPLATE_VBoxValidationKitR3Host_LIBS += \
+	kstat \
+	nsl \
+	contract
+ if1of ($(KBUILD_TARGET_ARCH), amd64 x86)
+  TEMPLATE_VBoxValidationKitR3Host_LIBS += \
+  	smbios
+ endif
+endif
+
+#
+# Template for building agnostic ring-0 host modules for the Validation Kit.
+#
+TEMPLATE_VBoxValidationKitR0 = VBox Validation Kit agnostic ring-0 host module.
+TEMPLATE_VBoxValidationKitR0_EXTENDS = VBoxR0
+TEMPLATE_VBoxValidationKitR0_EXTENDS_BY = appending
+TEMPLATE_VBoxValidationKitR0_INST = $(INST_VALIDATIONKIT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
+TEMPLATE_VBoxValidationKitR0_DEFS = IN_RT_R0
+TEMPLATE_VBoxValidationKitR0_LIBS = \
+	$(PATH_STAGE_LIB)/RuntimeR0$(VBOX_SUFF_LIB)
+if1of ($(KBUILD_TARGET),os2 win)
+ TEMPLATE_VBoxValidationKitR0_LIBS += \
+ 	$(PATH_STAGE_LIB)/SUPR0$(VBOX_SUFF_LIB)
+endif
+
+#
+# List of python sources that should be linted and unittested.
+#
+VBOX_VALIDATIONKIT_PYTHON_SOURCES     :=
+VBOX_VALIDATIONKIT_PYLINT_TARGETS     :=
+VBOX_VALIDATIONKIT_PYUNITTEST_EXCLUDE :=
+
+ifdef VBOX_WITH_PYLINT
+ TESTING +=
+endif
+
+#
+# Process python sources.
+#
+if1of ($(KBUILD_TARGET), win os2)
+ VBOX_PYTHONPATH_VALIDATIONKIT = $(PYTHONPATH);$(VBOX_PATH_VALIDATIONKIT_SRC);$(VBOX_PATH_VALIDATIONKIT_SRC)/testboxscript;$(VBOX_PATH_VALIDATIONKIT_SRC)/testmanager
+else
+ VBOX_PYTHONPATH_VALIDATIONKIT = $(PYTHONPATH):$(VBOX_PATH_VALIDATIONKIT_SRC):$(VBOX_PATH_VALIDATIONKIT_SRC)/testboxscript:$(VBOX_PATH_VALIDATIONKIT_SRC)/testmanager
+endif
+BLDDIRS += $(PATH_TARGET)/pylint $(PATH_TARGET)/pyunittest
+
+define def_vbox_validationkit_py_check
+$(eval name:=$(basename $(notdir $(py))))
+
+pylint::   $(name)-py-phony.o
+$(name).o: $(name)-py-phony.o
+$(PATH_TARGET)/pylint/$(name).o $(name)-py-phony.o:: $(py) | $(PATH_TARGET)/pylint/
+ifdef VBOX_WITH_PYLINT
+	$(QUIET2)$(call MSG_L1,Subjecting $(py) to pylint...)
+	$(QUIET)$(REDIRECT) -C "$(dir $(py))" -E LC_ALL=C -E PYTHONPATH="$(VBOX_PYTHONPATH_VALIDATIONKIT)" -- \
+		$(VBOX_PYLINT) --rcfile=$(VBOX_PATH_VALIDATIONKIT_SRC)/pylintrc $$(VBOX_PYLINT_FLAGS) $$($(py)_VBOX_PYLINT_FLAGS) ./$(notdir $(py))
+endif
+	$(QUIET)$(APPEND) -t "$(PATH_TARGET)/pylint/$(name).o"
+
+ifn1of ($(py),$(VBOX_VALIDATIONKIT_PYUNITTEST_EXCLUDE))
+pyunittest:: $(name)-pyunittest.o
+$(PATH_TARGET)/pyunittest/$(name).o $(name)-pyunittest.o:: $(py) | $(PATH_TARGET)/pyunittest/
+	$(QUIET2)$(call MSG_L1,Unittesting Python source $(py)...)
+	$(QUIET)$(REDIRECT) -E LC_ALL=C -E PYTHONPATH="$(VBOX_PYTHONPATH_VALIDATIONKIT)" -C $(dir $(py)) \
+		-- $(VBOX_BLD_PYTHON) -m unittest -v $(notdir $(basename $(py)))
+	$(QUIET)$(APPEND) -t "$(PATH_TARGET)/pyunittest/$(name).o"
+VBOX_VALIDATIONKIT_PYUNITTEST_TARGETS += $(PATH_TARGET)/pyunittest/$(name).o
+
+TESTING += $(name)-pyunittest.o
+endif
+TESTING += $(name)-py-phony.o
+VBOX_VALIDATIONKIT_PYLINT_TARGETS     += $(PATH_TARGET)/pylint/$(name).o
+endef # def_vbox_validationkit_py_check
+
+
+define def_vbox_validationkit_process_python_sources
+$(if-expr $(words $(_SUB_MAKEFILE_STACK)) <= 0 || "$1" == "FORCE", \
+	$(foreach py, $(VBOX_VALIDATIONKIT_PYTHON_SOURCES), $(eval $(def_vbox_validationkit_py_check))),)
+endef
+
+
+
+#
+# http://www.jshint.com
+#
+VBOX_JSHINT       ?= jshint
+VBOX_JSHINT_FLAGS := --config $(VBOX_PATH_VALIDATIONKIT_SRC)/jshintrc.js --verbose
+ifndef VBOX_WITH_JSHINT
+ VBOX_WITH_JSHINT := $(which $(VBOX_JSHINT))
+endif
+
+#
+# List of javascript sources that should be checked and linted.
+#
+VBOX_VALIDATIONKIT_JS_SOURCES :=
+
+define def_vbox_validationkit_js_check
+$(eval name:=$(basename $(notdir $(js))))
+$(name).o $(name).obj:: # $(PATH_SUB_CURRENT)/$(js)
+	-$(REDIRECT) -E LC_ALL=C  -C $(dir $(js)) -- $$(VBOX_JSHINT) ./$(notdir $(js)) $$(VBOX_JSHINT_FLAGS)
+jslint:: $(name).o
+endef
+
+define def_vbox_validationkit_process_js_sources
+$(if-expr $(words $(_SUB_MAKEFILE_STACK)) <= 0, \
+	$(foreach js, $(VBOX_VALIDATIONKIT_JS_SOURCES), $(eval $(def_vbox_validationkit_js_check))),)
+endef
+
diff --git a/src/VBox/ValidationKit/Makefile.kmk b/src/VBox/ValidationKit/Makefile.kmk
new file mode 100644
index 0000000..991ff18
--- /dev/null
+++ b/src/VBox/ValidationKit/Makefile.kmk
@@ -0,0 +1,272 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+# Make sure our Config.kmk is included.
+ifndef VBOX_VALIDATIONKIT_CONFIG_KMK_INCLUDED
+ include $(PATH_SUB_CURRENT)/Config.kmk
+endif
+
+# Collect install targets
+VBOX_VALIDATIONKIT_INSTALLS := $(INSTALLS)
+
+#
+# Include sub-makefiles.
+#
+include $(PATH_SUB_CURRENT)/tests/Makefile.kmk
+ifneq ($(KBUILD_HOST),os2)	 # need yasm
+ include $(PATH_SUB_CURRENT)/bootsectors/Makefile.kmk
+endif
+include $(PATH_SUB_CURRENT)/utils/Makefile.kmk
+include $(PATH_SUB_CURRENT)/common/Makefile.kmk
+include $(PATH_SUB_CURRENT)/testboxscript/Makefile.kmk
+include $(PATH_SUB_CURRENT)/testdriver/Makefile.kmk
+include $(PATH_SUB_CURRENT)/testmanager/Makefile.kmk
+
+#
+# Globals.
+#
+
+# The current target is enabled by default.
+VBOX_WITH_VALIDATIONKIT_PACKING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) = 1
+
+
+#
+# Install the test driver framework.
+#
+INSTALLS += ValidationKit-testdriver
+ValidationKit-testdriver_TEMPLATE = VBoxValidationKitR3
+ValidationKit-testdriver_INST = $(INST_VALIDATIONKIT)testdriver/
+ValidationKit-testdriver_MODE = a+r,u+w
+ValidationKit-testdriver_SOURCES := \
+	$(PATH_SUB_CURRENT)/testdriver/__init__.py \
+	$(PATH_SUB_CURRENT)/testdriver/base.py \
+	$(PATH_SUB_CURRENT)/testdriver/reporter.py \
+	$(PATH_SUB_CURRENT)/testdriver/tst-txsclient.py \
+	$(PATH_SUB_CURRENT)/testdriver/txsclient.py \
+	$(PATH_SUB_CURRENT)/testdriver/vbox.py \
+	$(PATH_SUB_CURRENT)/testdriver/vboxcon.py \
+	$(PATH_SUB_CURRENT)/testdriver/vboxtestvms.py \
+	$(PATH_SUB_CURRENT)/testdriver/vboxwrappers.py \
+	$(PATH_SUB_CURRENT)/testdriver/winbase.py \
+	$(PATH_SUB_CURRENT)/testdriver/win-vbox-net-uninstall.ps1
+ValidationKit-testdriver_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/testdriver/vboxinstaller.py
+$(PATH_SUB_CURRENT)/testdriver/txsclient.py_VBOX_PYCHECKER_FLAGS = --no-reimport
+
+
+#
+# Packing target.
+#
+ifndef VBOX_WITHOUT_VALIDATIONKIT_ZIP
+
+ VBOX_VALIDATIONKIT_INSTALLS := $(filter-out $(VBOX_VALIDATIONKIT_INSTALLS), $(INSTALLS))
+
+ #
+ # VBoxValidationKit.zip.
+ # TODO: Don't pack the python stuff multiple times?  Lazy works for now.
+ #
+ PACKING += $(PATH_OUT)/VBoxValidationKit.zip
+ $(PATH_OUT)/VBoxValidationKit.zip: \
+ 		$(VBOX_PATH_VALIDATIONKIT)/VBoxValidationKit.iso \
+ 		$(VBOX_PATH_VALIDATIONKIT)/ \
+               $$(foreach inst, $$(VBOX_VALIDATIONKIT_INSTALLS), \
+			$$(filter $(PATH_STAGE)/$(INST_VALIDATIONKIT)%, $$($$(inst)_2_STAGE_TARGETS)))
+	$(call MSG_L1,Packing the Test Suite $@)
+	$(QUIET)$(RM) -f $@
+	$(foreach os, darwin freebsd linux os2 solaris win,$(foreach arch, x86 amd64 \
+	,$(if-expr defined(VBOX_WITH_VALIDATIONKIT_PACKING.$(os).$(arch))\
+		,$(NLTAB)$(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE)/$(os).$(arch)/$(KBUILD_TYPE)/ \
+			-- zip$(HOSTSUFF_EXE) -r9 $@ $(INST_VALIDATIONKIT) -x '*.pyc',)))
+
+ #
+ # VBoxTestBoxScript.zip - For setting up the testboxes.
+ #
+ PACKING += $(PATH_OUT)/VBoxTestBoxScript.zip
+ $(PATH_OUT)/VBoxTestBoxScript.zip: \
+ 		$$(testboxscript_2_STAGE_TARGETS) \
+ 		$$(testboxscript-common_2_STAGE_TARGETS) \
+ 		$$(TestBoxHelper_2_STAGE_TARGETS)
+	$(call MSG_L1,Packing the TestBox Script files to $@)
+	$(QUIET)$(RM) -f $@
+	$(foreach os, darwin freebsd linux os2 solaris win,$(foreach arch, x86 amd64 \
+	,$(if-expr defined(VBOX_WITH_VALIDATIONKIT_PACKING.$(os).$(arch))\
+		,$(NLTAB)$(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE)/$(os).$(arch)/$(KBUILD_TYPE)/ \
+			-- zip$(HOSTSUFF_EXE) -r9 $@ $(INST_TESTBOXSCRIPT) -x '*.pyc',)))
+
+endif # !VBOX_WITHOUT_VALIDATIONKIT_ZIP
+
+
+#
+# Automatically lint python code during build.
+#
+if defined(VBOX_WITH_PYLINT) && !defined(VBOX_WITHOUT_AUTO_PYLINT)
+ OTHERS      += $(PATH_TARGET)/pylint.run
+ OTHER_CLEAN += $(PATH_TARGET)/pylint.run
+ $(PATH_TARGET)/pylint.run: \
+ 		$$(filter-out %/testboxscript.o, $$(VBOX_VALIDATIONKIT_PYLINT_TARGETS)) \
+		$$(VBOX_VALIDATIONKIT_PYUNITTEST_TARGETS)
+	$(QUIET)$(APPEND) -t "$@"
+endif
+
+$(evalcall def_vbox_validationkit_process_python_sources,FORCE)
+$(evalcall def_vbox_validationkit_process_js_sources,FORCE)
+include $(FILE_KBUILD_SUB_FOOTER)
+
+
+
+
+#
+# Construct the file spec for creating the Validation Kit guest iso.
+#
+VBOX_VALIDATIONKIT_FILESPEC = \
+	$(VBOX_PATH_VALIDATIONKIT)/vboxtxs-readme.txt
+ifneq ($(KBUILD_HOST),os2)
+ VBOX_VALIDATIONKIT_FILESPEC += \
+	$(VBOX_PATH_VALIDATIONKIT)/bootsectors/bootsector-pae.img \
+	$(VBOX_PATH_VALIDATIONKIT)/bootsectors/bootsector-shutdown.img
+endif
+
+# Generate VBOX_PATH_VALIDATIONKIT.os.arch variables.
+$(foreach os, darwin freebsd linux os2 solaris win,$(foreach arch, x86 amd64, \
+	$(eval VBOX_PATH_VALIDATIONKIT.$(os).$(arch) = $(PATH_OUT_BASE)/$(os).$(arch)/$(KBUILD_TYPE)/$(INST_VALIDATIONKIT)$(os)/$(arch)) \
+))
+
+# Common files first.
+define def_vbox_validationkit_common_files
+ ifdef VBOX_WITH_VALIDATIONKIT_PACKING.$(os).$(arch)
+  VBOX_VALIDATIONKIT_FILESPEC += \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/exceptionsR3$(TMP_SUFF_EXE) \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/cpu-alloc-all-mem$(TMP_SUFF_EXE) \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/cpu-numa$(TMP_SUFF_EXE) \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/NetPerf$(TMP_SUFF_EXE) \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/LoadGenerator$(TMP_SUFF_EXE) \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/loadgeneratorR0.r0 \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/TestExecService$(TMP_SUFF_EXE) \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/vts_rm$(TMP_SUFF_EXE) \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/vts_tar$(TMP_SUFF_EXE) \
+      	$$(VBOX_PATH_VALIDATIONKIT.$(os).$(arch))/xmmsaving$(TMP_SUFF_EXE)
+ endif
+endef
+
+TMP_SUFF_EXE=.exe
+$(foreach os, os2 win,$(foreach arch, x86 amd64, \
+	$(eval $(def_vbox_validationkit_common_files)) \
+))
+TMP_SUFF_EXE=
+$(foreach os, darwin freebsd linux solaris,$(foreach arch, x86 amd64, \
+	$(eval $(def_vbox_validationkit_common_files)) \
+))
+
+# OS specific files - Linux
+ifdef VBOX_WITH_VALIDATIONKIT_PACKING.linux.x86
+ VBOX_VALIDATIONKIT_FILESPEC += \
+ 	$(VBOX_PATH_VALIDATIONKIT.linux.x86)/UsbTest
+endif
+ifdef VBOX_WITH_VALIDATIONKIT_PACKING.linux.amd64
+ VBOX_VALIDATIONKIT_FILESPEC += \
+ 	$(VBOX_PATH_VALIDATIONKIT.linux.amd64)/UsbTest
+endif
+ifdef VBOX_WITH_VALIDATIONKIT_PACKING.linux.x86
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.linux.x86)/../vboxtxs)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.linux.x86)/../vboxtxs-nat)
+
+else ifdef VBOX_WITH_VALIDATIONKIT_PACKING.linux.amd64
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.linux.amd64)/../vboxtxs)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.linux.amd64)/../vboxtxs-nat)
+endif
+
+# OS specific files - OS/2
+ifdef VBOX_WITH_VALIDATIONKIT_PACKING.os2.x86
+ VBOX_VALIDATIONKIT_FILESPEC += \
+ 	$(VBOX_PATH_VALIDATIONKIT.os2.x86)/libc06.dll \
+ 	$(VBOX_PATH_VALIDATIONKIT.os2.x86)/libc061.dll \
+ 	$(VBOX_PATH_VALIDATIONKIT.os2.x86)/libc062.dll \
+ 	$(VBOX_PATH_VALIDATIONKIT.os2.x86)/libc063.dll \
+ 	$(VBOX_PATH_VALIDATIONKIT.os2.x86)/libc064.dll \
+ 	$(VBOX_PATH_VALIDATIONKIT.os2.x86)/libc065.dll
+endif
+
+# OS specific files - Solaris
+ifdef VBOX_WITH_VALIDATIONKIT_PACKING.solaris.x86
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.solaris.x86)/../vboxtxs.sh)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.solaris.x86)/../vboxtxs.xml)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.solaris.x86)/../vboxtxs-sol10.xml)
+else ifdef VBOX_WITH_VALIDATIONKIT_PACKING.solaris.amd64
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.solaris.amd64)/../vboxtxs.sh)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.solaris.amd64)/../vboxtxs.xml)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.solaris.amd64)/../vboxtxs-sol10.xml)
+endif
+
+# OS specific files - Windows
+ifdef VBOX_WITH_VALIDATIONKIT_PACKING.win.x86
+ VBOX_VALIDATIONKIT_FILESPEC += \
+ 	$(VBOX_PATH_VALIDATIONKIT.win.x86)/ntSetFreq.exe \
+ 	$(VBOX_PATH_VALIDATIONKIT.win.x86)/ntTimeSources.exe
+endif
+ifdef VBOX_WITH_VALIDATIONKIT_PACKING.win.amd64
+ VBOX_VALIDATIONKIT_FILESPEC += \
+ 	$(VBOX_PATH_VALIDATIONKIT.win.amd64)/ntSetFreq.exe \
+ 	$(VBOX_PATH_VALIDATIONKIT.win.amd64)/ntTimeSources.exe
+endif
+ifdef VBOX_WITH_VALIDATIONKIT_PACKING.win.x86
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.win.x86)/../vboxtxs.cmd)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.win.x86)/../vboxtxs.reg)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.win.x86)/../vboxtxs-nat.cmd)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.win.x86)/../vboxtxs-nat.reg)
+else ifdef VBOX_WITH_VALIDATIONKIT_PACKING.win.amd64
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.win.amd64)/../vboxtxs.cmd)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.win.amd64)/../vboxtxs.reg)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.win.amd64)/../vboxtxs-nat.cmd)
+ VBOX_VALIDATIONKIT_FILESPEC += $(abspath $(VBOX_PATH_VALIDATIONKIT.win.amd64)/../vboxtxs-nat.reg)
+endif
+
+
+#
+# Build the Validation Kit guest ISO.
+#
+$(VBOX_PATH_VALIDATIONKIT)/VBoxValidationKit.iso: \
+		$(filter-out %=deleteme=, $(subst =,=deleteme= , $(VBOX_VALIDATIONKIT_FILESPEC))) \
+		$(VBOX_SVN_REV_KMK) \
+		$(VBOX_PATH_VALIDATIONKIT_SRC)/Makefile.kmk
+	$(call MSG_TOOL,mkisofs,,$@)
+	$(QUIET)$(MKDIR) -p $(@D)
+ifneq ($(KBUILD_TARGET),os2)
+	$(ECHO) VBOX_VALIDATIONKIT_FILESPEC $(VBOX_VALIDATIONKIT_FILESPEC)
+endif
+# use iso-level 3 which is the most ISO conforming level with least restrictions; iso-level 4 maps to iso-level 2
+# with some extra restrictions removal (not conforming to ISO9660) which some platforms like Solaris 10 does not like.
+	$(VBOX_MKISOFS) -rational-rock -r -joliet -iso-level 3 \
+		-volid "VBOXVALKIT_$(VBOX_VERSION_STRING_RAW)_$(VBOX_SVN_REV)" -l -graft-points -o $@ \
+		$(foreach spec,$(VBOX_VALIDATIONKIT_FILESPEC) \
+			,$(if $(findstring =,$(spec)),$(spec), $(lastword $(subst /$(INST_VALIDATIONKIT), ,$(spec))=$(spec))))
+
+# Alias for creating the iso.
+.PHONY: validationkit-iso
+validationkit-iso: $(VBOX_PATH_VALIDATIONKIT)/VBoxValidationKit.iso
+
diff --git a/src/VBox/ValidationKit/ValidationKitCodingGuidelines.cpp b/src/VBox/ValidationKit/ValidationKitCodingGuidelines.cpp
new file mode 100644
index 0000000..cdd069a
--- /dev/null
+++ b/src/VBox/ValidationKit/ValidationKitCodingGuidelines.cpp
@@ -0,0 +1,75 @@
+/* $Id: ValidationKitCodingGuidelines.cpp $ */
+/** @file
+ * VirtualBox Validation Kit - Coding Guidelines.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/** @page pg_validationkit_guideline    Validation Kit Coding Guidelines
+ *
+ * The guidelines extends the VBox coding guidelines (@ref pg_vbox_guideline)
+ * and currently only defines python prefixes and linting.
+ *
+ *
+ * @section sec_validationkit_guideline_python      Python
+ *
+ * Python is a typeless language so using prefixes to indicate the intended
+ * type of a variable or attribute can be very helpful.
+ *
+ * Type prefixes:
+ *      - 'b' for byte (octect).
+ *      - 'ch' for a single character.
+ *      - 'f' for boolean and flags.
+ *      - 'fn' for function or method references.
+ *      - 'fp' for floating point values.
+ *      - 'i' for integers.
+ *      - 'l' for long integers.
+ *      - 'o' for objects, structures and anything with attributes that doesn't
+ *        match any of the other type prefixes.
+ *      - 'r' for a range or xrange.
+ *      - 's' for a string (can be unicode).
+ *      - 'su' for a unicode string when the distinction is important.
+ *
+ * Collection qualifiers:
+ *      - 'a' for a list or an array.
+ *      - 'd' for a dictionary.
+ *      - 'h' for a hash.
+ *      - 't' for a tuple.
+ *
+ * Other qualifiers:
+ *      - 'c' for a count. Implies integer or long integer type. Higest
+ *        priority.
+ *      - 'sec' for a second value. Implies long integer type.
+ *      - 'ms' for a millisecond value. Implies long integer type.
+ *      - 'us' for a microsecond value. Implies long integer type.
+ *      - 'ns' for a nanosecond value. Implies long integer type.
+ *
+ * The 'ms', 'us', 'ns' and 'se' qualifiers can be capitalized when prefixed by
+ * 'c', e.g. cMsElapsed.  While this technically means they are no longer a
+ * prefix, it's easier to read and everyone understands what it means.
+ *
+ * The type collection qualifiers comes first, then the other qualifiers and
+ * finally the type qualifier.
+ *
+ */
+
diff --git a/src/VBox/ValidationKit/bootsectors/Makefile.kmk b/src/VBox/ValidationKit/bootsectors/Makefile.kmk
new file mode 100644
index 0000000..736455d
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/Makefile.kmk
@@ -0,0 +1,190 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Bootsector Tests for Test Drivers or standalone testing.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+#
+# Boot Sector "Linker" tool.
+#
+TOOL_VBoxBootSectorLd      = Joins one or more BS2 object files into a floppy img.
+TOOL_VBoxBootSectorLd_LINK_MISCBIN_OUTPUT =
+TOOL_VBoxBootSectorLd_LINK_MISCBIN_DEPEND =
+TOOL_VBoxBootSectorLd_LINK_MISCBIN_DEPORD = $(VBoxBs2Linker_1_TARGET)
+define TOOL_VBoxBootSectorLd_LINK_MISCBIN_CMDS
+	$(VBoxBs2Linker_1_TARGET) -o $(out) $(objs) $(othersrc)
+endef
+
+BLDPROGS += VBoxBs2Linker
+VBoxBs2Linker_TEMPLATE = VBoxBldProg
+VBoxBs2Linker_SOURCES = VBoxBs2Linker.cpp
+
+
+#
+# Makes a boot sector test image.
+#
+TEMPLATE_VBoxBsTestImg = kBuild tool config for building boot sector stuff.
+TEMPLATE_VBoxBsTestImg_INST    = $(INST_VALIDATIONKIT)bootsectors/
+TEMPLATE_VBoxBsTestImg_BINSUFF = .img
+TEMPLATE_VBoxBsTestImg_MODE    = 0644
+TEMPLATE_VBoxBsTestImg_ASTOOL  = YASM
+TEMPLATE_VBoxBsTestImg_ASFLAGS:= -f bin -P $(PATH_SUB_CURRENT)/bootsector2-first.mac $(VBOX_YASM_Wno-segreg-in-64bit) --mapfile
+TEMPLATE_VBoxBsTestImg_ASDEFS  = ASM_FORMAT_BIN
+TEMPLATE_VBoxBsTestImg_INCS    = \
+	. \
+	../../VMM/testcase/Instructions
+TEMPLATE_VBoxBsTestImg_LDTOOL  = VBoxBootSectorLd
+
+
+#
+# The boot sector tests.
+#
+MISCBINS += bootsector-shutdown
+bootsector-shutdown_TEMPLATE = VBoxBsTestImg
+bootsector-shutdown_SOURCES = bootsector-shutdown.asm
+
+MISCBINS += bootsector-pae
+bootsector-pae_TEMPLATE = VBoxBsTestImg
+bootsector-pae_SOURCES = bootsector-pae.asm
+
+MISCBINS += bootsector-empty
+bootsector-empty_TEMPLATE = VBoxBsTestImg
+bootsector-empty_SOURCES = bootsector-empty.asm
+
+MISCBINS += bootsector2-test1
+bootsector2-test1_TEMPLATE = VBoxBsTestImg
+bootsector2-test1_SOURCES = bootsector2-test1.asm
+
+MISCBINS += bootsector2-cpu-hidden-regs-1
+bootsector2-cpu-hidden-regs-1_TEMPLATE = VBoxBsTestImg
+bootsector2-cpu-hidden-regs-1_SOURCES = bootsector2-cpu-hidden-regs-1.asm
+
+MISCBINS += bootsector2-cpu-instr-1
+bootsector2-cpu-instr-1_TEMPLATE = VBoxBsTestImg
+bootsector2-cpu-instr-1_SOURCES = bootsector2-cpu-instr-1.asm
+
+MISCBINS += bootsector2-cpu-pf-1
+bootsector2-cpu-pf-1_TEMPLATE = VBoxBsTestImg
+bootsector2-cpu-pf-1_SOURCES = bootsector2-cpu-pf-1.asm
+
+MISCBINS += bootsector2-cpu-xcpt-1
+bootsector2-cpu-xcpt-1_TEMPLATE = VBoxBsTestImg
+bootsector2-cpu-xcpt-1_SOURCES = bootsector2-cpu-xcpt-1.asm
+
+MISCBINS += bootsector2-cpu-xcpt-2
+bootsector2-cpu-xcpt-2_TEMPLATE = VBoxBsTestImg
+bootsector2-cpu-xcpt-2_SOURCES = bootsector2-cpu-xcpt-2.asm
+
+MISCBINS += bootsector2-cpu-a20-1
+bootsector2-cpu-a20-1_TEMPLATE = VBoxBsTestImg
+bootsector2-cpu-a20-1_SOURCES = bootsector2-cpu-a20-1.asm
+
+MISCBINS += bootsector2-cpu-basic-1
+bootsector2-cpu-basic-1_TEMPLATE = VBoxBsTestImg
+bootsector2-cpu-basic-1_SOURCES = bootsector2-cpu-basic-1.asm
+
+MISCBINS += bootsector2-boot-registers-1
+bootsector2-boot-registers-1_TEMPLATE = VBoxBsTestImg
+bootsector2-boot-registers-1_SOURCES = bootsector2-boot-registers-1.asm
+
+MISCBINS += bootsector2-triple-fault-1
+bootsector2-triple-fault-1_TEMPLATE = VBoxBsTestImg
+bootsector2-triple-fault-1_SOURCES = bootsector2-triple-fault-1.asm
+
+
+ifeq ($(USERNAME),birdxx)
+ if1of ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
+#
+# Generated instruction tests (work in progress).
+#
+
+VBOX_PATH_VBINSTST = $(PATH_ROOT)/src/VBox/VMM/testcase/Instructions
+VBOX_VBINSTST_GEN  = $(VBOX_PATH_VBINSTST)/InstructionTestGen.py
+VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN   = $(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) \
+		--split 3 --target bs2-r0-64 --output-base $(bootsectors_0_OUTDIR)/VBInsTst-64 --test-size tiny
+VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES = $(shell $(VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN) --makefile-mode)
+
+#$$(bootsectors_0_OUTDIR)/VBInsTst.ts + $$(VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES): $(VBOX_VBINSTST_GEN) | $$(dir $$@)
+#	$(VBOX_BOOTSECTOR2_VBINSTST_AMD64_GEN)
+#	$(APPEND) -t $@
+#
+#bootsectors_SOURCES += $(bootsectors_0_OUTDIR)/bootsector2-vbinstst-1.img
+#bootsectors_CLEAN += $(VBOX_BOOTSECTOR2_VBINSTST_AMD64_FILES)
+#
+#$$(bootsectors_0_OUTDIR)/bootsector2-vbinstst-1.img: \
+#		$(PATH_SUB_CURRENT)/bootsector2-vbinstst-64-1.asm \
+#     		$$(bootsectors_0_OUTDIR)/VBInsTst-64.asm
+#	$(TOOL_$(VBOX_ASTOOL)_AS) -f bin -D ASM_FORMAT_BIN -I $(dir $@) -I $(PATH_ROOT)/include -I $(VBOX_PATH_VBINSTST) -o $@ -L nasm -l $@.lst $<
+
+MISCBINS += bootsector2-vbinstst-kernel
+bootsector2-vbinstst-kernel_TEMPLATE = VBoxBsTestImg
+bootsector2-vbinstst-kernel_SOURCES = \
+	bootsector2-vbinstst-kernel.asm
+
+
+MISCBINS += bootsector2-vbinstst-64-1
+bootsector2-vbinstst-64-1_TEMPLATE = VBoxBsTestImg
+bootsector2-vbinstst-64-1_DEFS = \
+	BS2_BIG_IMAGE_LM64 \
+	BS2_BIG_IMAGE_GEN_SOURCE_FILE=bs2-vbinstst-64-1.asm \
+	BS2_BIG_IMAGE_GEN_TEST_NAME=\"bs2-vbinstst-64-1\"
+bootsector2-vbinstst-64-1_INCS = $(bootsector2-vbinstst-64-1_0_OUTDIR)/
+bootsector2-vbinstst-64-1_SOURCES = \
+	bootsector2-vbinstst-kernel.asm \
+	bootsector2-vbinstst-big-template.asm
+bootsector2-vbinstst-64-1_INTERMEDIATES = \
+	$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm
+bootsector2-vbinstst-64-1_CLEAN = \
+	$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm
+
+$$(bootsector2-vbinstst-64-1_0_OUTDIR)/bs2-vbinstst-64-1.asm: $(VBOX_VBINSTST_GEN) | $$(dir $$@)
+	$(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) --target bs2-r0-64-big --output-base $(basename $@) --test-size medium
+
+MISCBINS += bootsector2-vbinstst-32-1
+bootsector2-vbinstst-32-1_TEMPLATE = VBoxBsTestImg
+bootsector2-vbinstst-32-1_DEFS = \
+	BS2_BIG_IMAGE_PP32 \
+	BS2_BIG_IMAGE_GEN_SOURCE_FILE=bs2-vbinstst-32-1.asm \
+	BS2_BIG_IMAGE_GEN_TEST_NAME=\"bs2-vbinstst-32-1\"
+bootsector2-vbinstst-32-1_INCS = $(bootsector2-vbinstst-32-1_0_OUTDIR)/
+bootsector2-vbinstst-32-1_SOURCES = \
+	bootsector2-vbinstst-kernel.asm \
+	bootsector2-vbinstst-big-template.asm
+bootsector2-vbinstst-32-1_INTERMEDIATES = \
+	$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm
+bootsector2-vbinstst-32-1_CLEAN = \
+	$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm
+
+$$(bootsector2-vbinstst-32-1_0_OUTDIR)/bs2-vbinstst-32-1.asm: $(VBOX_VBINSTST_GEN) | $$(dir $$@)
+	$(VBOX_BLD_PYTHON) $(VBOX_VBINSTST_GEN) --target bs2-r0-32-big --output-base $(basename $@) --test-size medium
+
+ endif
+endif # bird-only
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/bootsectors/VBoxBs2Linker.cpp b/src/VBox/ValidationKit/bootsectors/VBoxBs2Linker.cpp
new file mode 100644
index 0000000..b9fd8e5
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/VBoxBs2Linker.cpp
@@ -0,0 +1,210 @@
+/* $Id: VBoxBs2Linker.cpp $ */
+/** @file
+ * VirtualBox Validation Kit - Boot Sector 2 "linker".
+ */
+
+/*
+ * Copyright (C) 2006-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <iprt/types.h>
+
+
+int main(int argc, char **argv)
+{
+    const char  *pszOutput   = NULL;
+    const char **papszInputs = (const char **)calloc(argc, sizeof(const char *));
+    unsigned     cInputs     = 0;
+
+    /*
+     * Scan the arguments.
+     */
+    for (int i = 1; i < argc; i++)
+    {
+        if (argv[i][0] == '-')
+        {
+            const char *pszOpt = &argv[i][1];
+            if (*pszOpt == '-')
+            {
+                /* Convert long options to short ones. */
+                pszOpt--;
+                if (!strcmp(pszOpt, "--output"))
+                    pszOpt = "o";
+                else if (!strcmp(pszOpt, "--version"))
+                    pszOpt = "V";
+                else if (!strcmp(pszOpt, "--help"))
+                    pszOpt = "h";
+                else
+                {
+                    fprintf(stderr, "syntax errro: Unknown options '%s'\n", pszOpt);
+                    return 2;
+                }
+            }
+
+            /* Process the list of short options. */
+            while (*pszOpt)
+            {
+                switch (*pszOpt++)
+                {
+                    case 'o':
+                    {
+                        const char *pszValue = pszOpt;
+                        pszOpt = strchr(pszOpt, '\0');
+                        if (*pszValue == '=')
+                            pszValue++;
+                        else if (!*pszValue)
+                        {
+                            if (i + 1 >= argc)
+                            {
+                                fprintf(stderr, "syntax error: The --output option expects a filename.\n");
+                                return 12;
+                            }
+                            pszValue = argv[++i];
+                        }
+                        if (pszOutput)
+                        {
+                            fprintf(stderr, "Only one output file is allowed. You've specified '%s' and '%s'\n",
+                                    pszOutput, pszValue);
+                            return 2;
+                        }
+                        pszOutput = pszValue;
+                        pszOpt = "";
+                        break;
+                    }
+
+                    case 'V':
+                        printf("%s\n", "$Revision: 96152 $");
+                        return 0;
+
+                    case '?':
+                    case 'h':
+                        printf("usage: %s [options] -o <output> <input1> [input2 ... [inputN]]\n",
+                               argv[0]);
+                        return 0;
+                }
+            }
+        }
+        else
+            papszInputs[cInputs++] = argv[i];
+    }
+
+    if (!pszOutput)
+    {
+        fprintf(stderr, "syntax error: No output file was specified (-o or --output).\n");
+        return 2;
+    }
+    if (cInputs == 0)
+    {
+        fprintf(stderr, "syntax error: No input files was specified.\n");
+        return 2;
+    }
+
+
+    /*
+     * Do the job.
+     */
+    /* Open the output file. */
+#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
+    FILE *pOutput = fopen(pszOutput, "wb");
+#else
+    FILE *pOutput = fopen(pszOutput, "w");
+#endif
+    if (!pOutput)
+    {
+        fprintf(stderr, "error: Failed to open output file '%s' for writing\n", pszOutput);
+        return 1;
+    }
+
+    /* Copy the input files to the output file, with sector padding applied. */
+    int rcExit = 0;
+    size_t off = 0;
+    for (unsigned i = 0; i < cInputs && rcExit == 0; i++)
+    {
+#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
+        FILE *pInput = fopen(papszInputs[i], "rb");
+#else
+        FILE *pInput = fopen(papszInputs[i], "r");
+#endif
+        if (pInput)
+        {
+            for (;;)
+            {
+                /* Read a block from the input file. */
+                uint8_t abBuf[4096];
+                size_t cbRead = fread(abBuf, sizeof(uint8_t), 4096, pInput);
+                if (!cbRead || ferror(pInput))
+                    break;
+
+                /* Padd the end of the file if necessary. */
+                if (cbRead != 4096 && !feof(pInput))
+                {
+                    fprintf(stderr, "error: fread returned %u bytes, but we're not at the end of the file yet...\n",
+                            (unsigned)cbRead);
+                    rcExit = 1;
+                    break;
+                }
+                if ((cbRead & 0x1ff) != 0)
+                {
+                    memset(&abBuf[cbRead], 0, 4096 - cbRead);
+                    cbRead = (cbRead + 0x1ff) & ~0x1ffU;
+                }
+
+                /* Write the block to the output file. */
+                if (fwrite(abBuf, sizeof(uint8_t), cbRead, pOutput) == cbRead)
+                    off += cbRead;
+                else
+                {
+                    fprintf(stderr, "error: fwrite failed\n");
+                    rcExit = 1;
+                    break;
+                }
+            }
+
+            if (ferror(pInput))
+            {
+                fprintf(stderr, "error: Error reading '%s'.\n", papszInputs[i]);
+                rcExit = 1;
+            }
+            fclose(pInput);
+        }
+        else
+        {
+            fprintf(stderr, "error: Failed to open '%s' for reading.\n", papszInputs[i]);
+            rcExit = 1;
+        }
+    }
+
+    /* Finally, close the output file (can fail because of buffered data). */
+    if (fclose(stderr) != 0)
+    {
+        fprintf(stderr, "error: Error closing '%s'.\n", pszOutput);
+        rcExit = 1;
+    }
+
+    return rcExit;
+}
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector-empty.asm b/src/VBox/ValidationKit/bootsectors/bootsector-empty.asm
new file mode 100644
index 0000000..d24fd92
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector-empty.asm
@@ -0,0 +1,61 @@
+; $Id: bootsector-empty.asm $
+;; @file
+; Empty bootsector can be used as example
+;
+
+;
+; Copyright (C) 2012-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+
+
+;; The boot sector load address.
+%define BS_ADDR         0x7c00
+%define PDP_ADDR        0x9000
+%define PD_ADDR         0xa000
+
+
+BITS 16
+start:
+    ; Start with a jump just to follow the convention.
+    jmp short the_code
+    nop
+times 3ah db 0
+
+the_code:
+    ; put the code here
+
+
+
+hlt_again:
+    hlt
+    cli
+    jmp hlt_again
+
+    ;
+    ; The GDT.
+    ;
+padding:
+times 510 - (padding - start) db 0
+    db 055h, 0aah
+
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector-pae.asm b/src/VBox/ValidationKit/bootsectors/bootsector-pae.asm
new file mode 100644
index 0000000..2103eb4
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector-pae.asm
@@ -0,0 +1,163 @@
+; $Id: bootsector-pae.asm $
+;; @file
+; Bootsector that switches the CPU info PAE mode.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+
+
+;; The boot sector load address.
+%define BS_ADDR         0x7c00
+%define PDP_ADDR        0x9000
+%define PD_ADDR         0xa000
+
+
+BITS 16
+start:
+    ; Start with a jump just to follow the convention.
+    jmp short the_code
+    nop
+times 3ah db 0
+
+the_code:
+    cli
+    xor     edx, edx
+    mov     ds, dx                      ; Use 0 based addresses
+
+    ;
+    ; Create a paging hierarchy
+    ;
+    mov     cx, 4
+    xor     esi, esi                    ; physical address
+    mov     ebx, PDP_ADDR
+    mov     edi, PD_ADDR
+pdptr_loop:
+    ; The page directory pointer entry.
+    mov     dword [ebx], edi
+    or      word [bx], X86_PDPE_P
+    mov     dword [ebx + 4], edx
+
+    ; The page directory.
+pd_loop:
+    mov     dword [edi], esi
+    or      word [di], X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_PS
+    mov     dword [edi + 4], 0
+    add     esi, 0x00200000             ; 2MB
+    add     di, 8
+    test    di, 0fffh
+    jnz     pd_loop
+
+    add     bx, 8
+    loop    pdptr_loop
+
+    ;
+    ; Switch to protected mode.
+    ;
+    lgdt [(gdtr - start) + BS_ADDR]
+    lidt [(idtr_null - start) + BS_ADDR]
+
+    mov     eax, PDP_ADDR
+    mov     cr3, eax
+
+    mov     eax, cr4
+    or      eax, X86_CR4_PAE | X86_CR4_PSE
+    mov     cr4, eax
+
+    mov     eax, cr0
+    or      eax, X86_CR0_PE | X86_CR0_PG
+    mov     cr0, eax
+    jmp far 0x0008:((code32_start - start) + BS_ADDR) ; 8=32-bit CS
+
+BITS 32
+code32_start:
+    mov     ax, 0x10
+    mov     ds, ax
+    mov     es, ax
+    mov     fs, ax
+    mov     gs, ax
+    mov     ax, 0x18
+    mov     es, ax
+    mov     esp, 0x80000
+
+    ; eye catchers
+    mov     eax, 0xCafeBabe
+    mov     ebx, eax
+    mov     ecx, eax
+    mov     edx, eax
+    mov     edi, eax
+    mov     esi, eax
+    mov     ebp, eax
+
+    ;
+    ; Boch shutdown request.
+    ;
+    mov bl, 64
+    mov dx, 08900h
+retry:
+    mov ecx, 8
+    mov esi, (szShutdown - start) + BS_ADDR
+    rep outsb
+    dec bl
+    jnz retry
+    ; Shutdown failed!
+hlt_again:
+    hlt
+    cli
+    jmp hlt_again
+
+    ;
+    ; The GDT.
+    ;
+align 8, db 0
+gdt:
+    dw  0,      0, 0,      0            ; null selector
+    dw  0xffff, 0, 0x9b00, 0x00cf       ; 32 bit flat code  segment (0x08)
+    dw  0xffff, 0, 0x9300, 0x00cf       ; 32 bit flat data  segment (0x10)
+    dw  0xffff, 0, 0x9300, 0x00cf       ; 32 bit flat stack segment (0x18)
+
+gdtr:
+    dw  8*4-1                           ; limit 15:00
+    dw  (gdt - start) + BS_ADDR         ; base  15:00
+    db  0                               ; base  23:16
+    db  0                               ; unused
+
+idtr_null:
+    dw  0                               ; limit 15:00
+    dw  (gdt - start) + BS_ADDR         ; base  15:00
+    db  0                               ; base  23:16
+    db  0                               ; unused
+
+szShutdown:
+    db 'Shutdown', 0
+
+    ;
+    ; Padd the remainder of the sector with zeros and
+    ; end it with the dos signature.
+    ;
+padding:
+times 510 - (padding - start) db 0
+    db 055h, 0aah
+
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector-shutdown.asm b/src/VBox/ValidationKit/bootsectors/bootsector-shutdown.asm
new file mode 100644
index 0000000..717d12f
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector-shutdown.asm
@@ -0,0 +1,76 @@
+; $Id: bootsector-shutdown.asm $
+;; @file
+; Bootsector for grub chainloading that shutdowns the VM.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+BITS 16
+start:
+    ; Start with a jump just to follow the convention.
+    jmp short the_code
+    nop
+times 3ah db 0
+
+the_code:
+    cli
+
+    ;
+    ; Boch shutdown request - write "Shutdown" byte by byte to port 08900h.
+    ;
+    mov cx, 64
+    mov dx, 08900h
+retry:
+    mov al, 'S'
+    out dx, al
+    mov al, 'h'
+    out dx, al
+    mov al, 'u'
+    out dx, al
+    mov al, 't'
+    out dx, al
+    mov al, 'd'
+    out dx, al
+    mov al, 'o'
+    out dx, al
+    mov al, 'w'
+    out dx, al
+    mov al, 'n'
+    out dx, al
+    loop retry
+
+    ;
+    ; Shutdown failed!
+    ;
+
+    ;; @todo print some message before halting.
+    hlt
+
+    ;
+    ; Padd the remainder of the sector with zeros and
+    ; end it with the dos signature.
+    ;
+padding:
+times 510 - (padding - start) db 0
+    db 055h, 0aah
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-api.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-api.mac
new file mode 100644
index 0000000..409669f
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-api.mac
@@ -0,0 +1,152 @@
+; $Id: bootsector2-api.mac $
+;; @file
+; Bootsector2 API definition for use by split images (kernel < 1MB < image).
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%ifndef ___bootsector2_api_mac
+%define ___bootsector2_api_mac
+
+;*******************************************************************************
+;*      Header Files                                                           *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "bootsector2-structures.mac"
+
+;;
+; The load address for big images.
+%define BS2_BIG_LOAD_ADDR       0x120000
+
+
+;;
+; API Template for lazy birds.
+;
+%macro BS2_API_TEMPLATE 0,
+
+ BS2_API_TEMPLATE_ACTION(Bs2DisableA20)
+ BS2_API_TEMPLATE_ACTION(Bs2DisableA20ViaKbd)
+ BS2_API_TEMPLATE_ACTION(Bs2DisableA20ViaPortA)
+ BS2_API_TEMPLATE_ACTION(Bs2DisableNX)
+ BS2_API_TEMPLATE_ACTION(Bs2EnableA20)
+ BS2_API_TEMPLATE_ACTION(Bs2EnableA20ViaKbd)
+ BS2_API_TEMPLATE_ACTION(Bs2EnableA20ViaPortA)
+ BS2_API_TEMPLATE_ACTION(Bs2EnableNX)
+ BS2_API_TEMPLATE_ACTION(Bs2IsNXSupported)
+ BS2_API_TEMPLATE_ACTION(Bs2KbdRead)
+ BS2_API_TEMPLATE_ACTION(Bs2KbdWait)
+ BS2_API_TEMPLATE_ACTION(Bs2KbdWrite)
+ BS2_API_TEMPLATE_ACTION(Bs2PanicIfVMMDevTestingIsMissing)
+ BS2_API_TEMPLATE_ACTION(Bs2SetupNX)
+ BS2_API_TEMPLATE_ACTION(CalcBenchmarkIterations)
+ BS2_API_TEMPLATE_ACTION(CalcTestPerSecond)
+ BS2_API_TEMPLATE_ACTION(GetElapsedNanoTS)
+ BS2_API_TEMPLATE_ACTION(GetNanoTS)
+ BS2_API_TEMPLATE_ACTION(PrintChr)
+ BS2_API_TEMPLATE_ACTION(PrintF)
+ BS2_API_TEMPLATE_ACTION(PrintStr)
+ BS2_API_TEMPLATE_ACTION(PrintStrColonSpaces)
+ BS2_API_TEMPLATE_ACTION(PrintStrSpacesColonSpace)
+ BS2_API_TEMPLATE_ACTION(PrintU32)
+ BS2_API_TEMPLATE_ACTION(ReportResult)
+ BS2_API_TEMPLATE_ACTION(Shutdown)
+ BS2_API_TEMPLATE_ACTION(StrFormatF)
+ BS2_API_TEMPLATE_ACTION(StrFormatV)
+ BS2_API_TEMPLATE_ACTION(StrLen)
+ BS2_API_TEMPLATE_ACTION(TestCheckTrap)
+ BS2_API_TEMPLATE_ACTION(TestDumpCurrentRegisters)
+ BS2_API_TEMPLATE_ACTION(TestDumpRegisters)
+ BS2_API_TEMPLATE_ACTION(TestFailed)
+ BS2_API_TEMPLATE_ACTION(TestFailedF)
+ BS2_API_TEMPLATE_ACTION(TestInit)
+ BS2_API_TEMPLATE_ACTION(TestRestoreRegisters)
+ BS2_API_TEMPLATE_ACTION(TestSaveRegisters)
+ BS2_API_TEMPLATE_ACTION(testSendStrCmd)
+ BS2_API_TEMPLATE_ACTION(TestSkipped)
+ BS2_API_TEMPLATE_ACTION(TestSub)
+ BS2_API_TEMPLATE_ACTION(testSubCleanup)
+ BS2_API_TEMPLATE_ACTION(TestSubDone)
+ BS2_API_TEMPLATE_ACTION(TestSubErrorCount)
+ BS2_API_TEMPLATE_ACTION(TestTerm)
+ BS2_API_TEMPLATE_ACTION(TestValueReg)
+ BS2_API_TEMPLATE_ACTION(TestValueU32)
+ BS2_API_TEMPLATE_ACTION(TestInstallTrapRecs)
+
+%endmacro
+
+
+;;
+; This defines the API pointers.
+;
+ABSOLUTE 0x500
+;; Start the structure with a magic number.
+NAME(g_u32Bs2ApiMagic):    resd 1
+;; And a version number.
+NAME(g_u32Bs2ApiVersion):  resd 1
+
+; The real mode and v8086 mode entry points (far pointers).
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) NAME(g_pfn %+ a_Name %+ _r86): resd 1
+BS2_API_TEMPLATE
+
+; The 16-bit protected mode entry points (far pointers).
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) NAME(g_pfn %+ a_Name %+ _p16): resd 1
+BS2_API_TEMPLATE
+
+; The 32-bit protected mode entry points (flat pointers).
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) NAME(g_pfn %+ a_Name %+ _p32): resd 1
+BS2_API_TEMPLATE
+
+; The 64-bit protected (long) mode entry points.
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) NAME(g_pfn %+ a_Name %+ _p64): resq 1
+BS2_API_TEMPLATE
+
+;; End the structure with a magic so it's integrity can be verified.
+NAME(g_u32Bs2ApiEndMagic) resd 1
+
+;;
+; The current API magic value (Douglas Carl Engelbart).
+%define BS2_API_MAGIC       0x19250130
+
+;;
+; The current API version.
+%define BS2_API_VERSION     0x00010000
+
+BEGINCODE
+
+
+;; @name Service trap vector interface.
+; @{
+%define BS2_SYSCALL_TO_RING0        0
+%define BS2_SYSCALL_TO_RING1        1
+%define BS2_SYSCALL_TO_RING2        2
+%define BS2_SYSCALL_TO_RING3        3
+
+;; The service vector.
+%define BS2_TRAP_SYSCALL            20h
+;; @}
+
+%endif
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-boot-registers-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-boot-registers-1.asm
new file mode 100644
index 0000000..568e30f
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-boot-registers-1.asm
@@ -0,0 +1,77 @@
+; $Id: bootsector2-boot-registers-1.asm $
+;; @file
+; Bootsector that prints the register status at boot.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+;
+; Initialize in real mode, preserving the registers.
+;
+%define BS2_INIT_RM
+%define BS2_INIT_SAVE_REGS
+%include "bootsector2-common-init-code.mac"
+
+main:
+        mov     ax, BS2_REG_SAVE_ADDR
+        call    NAME(TestDumpRegisters_r86)
+
+        xor     ax, ax
+        mov     al, [es:di]
+        push    ax
+        mov     al, [es:di + 1]
+        push    ax
+        mov     al, [es:di + 2]
+        push    ax
+        mov     al, [es:di + 3]
+        push    ax
+        push    ds
+        push    .s_szPnpFmt1
+        call    NAME(PrintF_r86)
+        pop     ax
+        push    .s_szPnpFmt2
+        call    NAME(PrintF_r86)
+        pop     ax
+        push    .s_szPnpFmt3
+        call    NAME(PrintF_r86)
+
+        call    NAME(Bs2Panic)
+
+.s_szPnpFmt1:
+        db      'es:di -> %RX8 %RX8 %RX8 %RX8 ',0
+.s_szPnpFmt2:
+        db      '%c%c%c%c', 0
+.s_szPnpFmt3:
+        db      13, 10, 0
+
+;
+; Pad the image so it loads cleanly.
+;
+BS2_PAD_IMAGE
+the_end:
+
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-end.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-end.mac
new file mode 100644
index 0000000..208e47a
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-end.mac
@@ -0,0 +1,42 @@
+; $Id: bootsector2-common-end.mac $
+;; @file
+; Boot sector 2 - End of code.
+;
+; @note Don't forget to cinldue bootsector2-common-traprec-end.mac!
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;
+; Terminate the trap records if opened.
+;
+%ifdef BS2_WITH_TRAPRECS
+ BS2_TRAP_RECS_END
+%endif
+
+;
+; Pad the image so it loads cleanly.
+;
+BEGINEND
+the_end:
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-init-code.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-init-code.mac
new file mode 100644
index 0000000..07c5178
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-init-code.mac
@@ -0,0 +1,2295 @@
+; $Id: bootsector2-common-init-code.mac $
+;; @file
+; Common bootsector code init.
+;
+; In addition to initialize the stack at %7bf0 it loads the first 512KB of the
+; floppy image at %7c00.  The control is handed over with interrupts disabled
+; to a 'main' function defined by the includer.
+;
+; The following defines controls the mode we call main in:
+;       - BS2_INIT_RM (default)
+;       - BS2_INIT_PE32
+;       - BS2_INIT_PP32
+;       - BS2_INIT_PAE32
+;       - BS2_INIT_LM64
+;
+; The following defines controls code inclusion:
+;       - BS2_INC_RM
+;       - BS2_INC_PE
+;       - BS2_INC_PE16
+;       - BS2_INC_PE32
+;       - BS2_INC_PEV86
+;       - BS2_INC_PP
+;       - BS2_INC_PP16
+;       - BS2_INC_PP32
+;       - BS2_INC_PPV86
+;       - BS2_INC_PAE
+;       - BS2_INC_PAE16
+;       - BS2_INC_PAE32
+;       - BS2_INC_PAEV86
+;       - BS2_INC_LM
+;       - BS2_INC_LM16
+;       - BS2_INC_LM32
+;       - BS2_INC_LM64
+;       - BS2_INC_CMN_R86
+;       - BS2_INC_CMN_V86
+;       - BS2_INC_CMN_P16
+;       - BS2_INC_CMN_P32
+;       - BS2_INC_CMN_P64
+;       - BS2_WITH_TRAPS
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;*******************************************************************************
+;*      Header Files                                                           *
+;*******************************************************************************
+%include "bootsector2-structures.mac"
+%include "bootsector2-common-macros-1.mac"
+
+
+;*******************************************************************************
+;*      Defined Constants And Macros                                           *
+;*******************************************************************************
+;; @name Static Memory Allocation
+; @{
+;; The boot sector load address.
+%define BS2_ADDR                07c00h
+;; The stack is located before the code (and will overflow into the interrupt
+; table and other essential system data).
+%define STACK_ADDR              (BS2_ADDR - 256)
+
+%ifdef BS2_WITH_TRAPS
+;; The address of the ring-0 stack in bs2Tss32BitDf.
+%define BS2_DF_R0_STACK_ADDR    06800h
+;; The address of the ring-0 stack in TSSxx.
+%define BS2_R0_STACK_ADDR       06000h
+;; The address of the ring-1 stack in TSSxx.
+%define BS2_R1_STACK_ADDR       05000h
+;; The address of the ring-2 stack in TSSxx.
+%define BS2_R2_STACK_ADDR       04800h
+%endif ; BS2_WITH_TRAPS
+
+;;
+; Where we save the boot registers during init.
+%define BS2_REG_SAVE_ADDR       06000h
+
+;; The start of the memory area used for paging, stacks and so forth.
+%define BS2_PXX_BASE            080000h
+
+;; The page map level 4 address (all entries point to BS2_LM_PDP_ADDR).
+%define BS2_LM_PML4_ADDR        080000h
+;; The long mode page directory pointer table address.
+%define BS2_LM_PDP_ADDR         081000h
+;; The PAE page directory pointer table address.
+%define BS2_PAE_PDP_ADDR        082000h
+;; The address of the 4 PAE page directories.  Also used by long mode.
+%define BS2_PAE_PD_ADDR         083000h
+;; The address of the 32-bit page directory.
+%define BS2_32B_PD_ADDR         087000h
+;; User page table #0.
+%define BS2_USER_PX_0_ADDR      088000h
+;; User page table #1.
+%define BS2_USER_PX_1_ADDR      089000h
+;; User page table #2.
+%define BS2_USER_PX_2_ADDR      08a000h
+;; User page table #3.
+%define BS2_USER_PX_3_ADDR      08b000h
+;; User page table #4.
+%define BS2_USER_PX_4_ADDR      08c000h
+;; User page table #5.
+%define BS2_USER_PX_5_ADDR      08d000h
+;; User page table #6.
+%define BS2_USER_PX_6_ADDR      08e000h
+;; User page table #7.
+%define BS2_USER_PX_7_ADDR      08f000h
+;; The selector to use when accessing the PDP and PD from real mode.
+%define BS2_PXX_SEL             08000h
+;; Converts a BS2_P*_ADDR into a BS2_PXX_SEL selector offset.
+%define BS2_PXX_OFF(Addr)       ( (Addr) - (BS2_PXX_SEL * 16) )
+
+;; The base address in the default address spaces of the range where we are
+; free to muck about as much as we like.  (This is a virtual address.)
+%define BS2_MUCK_ABOUT_BASE     000400000h
+
+; We have some free space here 090000h...09a000h (stacks moved)
+
+;; The address of the LDT.
+%define BS2_LDT_BASE            09b000h
+;; The size of the LDT in bytes.
+%define BS2_LDT_SIZE            001fffh
+
+;; The start of the memory area used for paging, stacks and so forth.
+%define BS2_PXX_LAST            09ffffh
+;; @}
+
+
+;;
+; @name Group of 32-bit, 16-bit and 64-bit selectors for one ring.
+; @{
+%define BS2_SEL_GRP_CS32            00h
+%define BS2_SEL_GRP_DS32            08h
+%define BS2_SEL_GRP_SS32            10h
+%define BS2_SEL_GRP_CS16            18h
+%define BS2_SEL_GRP_DS16            20h
+%define BS2_SEL_GRP_SS16            28h
+%define BS2_SEL_GRP_CS64            30h
+%define BS2_SEL_GRP_DS64            38h
+%define BS2_SEL_GRP_SS64            38h
+%define BS2_SEL_GRP_SIZE            40h
+;; @}
+
+
+;; Move to program.
+%ifndef BS2_WITHOUT_RAW_MODE
+ %define BS2_WITH_RAW_MODE
+%endif
+
+; Implicit code inclusion based on the init mode.
+%ifdef BS2_INIT_PE32
+ %define BS2_INC_PE32
+%elifdef BS2_INIT_PP32
+ %define BS2_INC_PP32
+%elifdef BS2_INIT_PAE32
+ %define BS2_INC_PAE32
+%elifdef BS2_INIT_LM64
+ %define BS2_INC_LM64
+%else
+ %define BS2_INIT_RM                    ; the default
+ %define BS2_INC_RM
+%endif
+
+; Aliases.
+%ifdef BS2_INC_PE
+ %define BS2_INC_PE16
+ %define BS2_INC_PE32
+ %define BS2_INC_PEV86
+%endif
+%ifdef BS2_INC_PP
+ %define BS2_INC_PP16
+ %define BS2_INC_PP32
+ %define BS2_INC_PPV86
+%endif
+%ifdef BS2_INC_PAE
+ %define BS2_INC_PAE16
+ %define BS2_INC_PAE32
+ %define BS2_INC_PAEV86
+%endif
+%ifdef BS2_INC_LM
+ %define BS2_INC_LM16
+ %define BS2_INC_LM32
+ %define BS2_INC_LM64
+%endif
+
+; Common code.
+%ifdef BS2_INC_RM
+ %define BS2_INC_CMN_R86
+%endif
+%ifdef BS2_INC_PE16
+ %define BS2_INC_CMN_P16
+ %define BS2_INC_CMN_PE
+ %define BS2_INC_CMN_PM
+%endif
+%ifdef BS2_INC_PE32
+ %define BS2_INC_CMN_P32
+ %define BS2_INC_CMN_PE
+ %define BS2_INC_CMN_PM
+%endif
+%ifdef BS2_INC_PEV86
+ %define BS2_INC_CMN_R86
+ %define BS2_INC_CMN_V86
+ %define BS2_INC_CMN_PE
+ %define BS2_INC_CMN_PM
+%endif
+%ifdef BS2_INC_PP16
+ %define BS2_INC_CMN_P16
+ %define BS2_INC_CMN_PP
+ %define BS2_INC_CMN_PM
+%endif
+%ifdef BS2_INC_PP32
+ %define BS2_INC_CMN_P32
+ %define BS2_INC_CMN_PP
+ %define BS2_INC_CMN_PM
+%endif
+%ifdef BS2_INC_PPV86
+ %define BS2_INC_CMN_R86
+ %define BS2_INC_CMN_V86
+ %define BS2_INC_CMN_PP
+ %define BS2_INC_CMN_PM
+%endif
+%ifdef BS2_INC_PAE16
+ %define BS2_INC_CMN_P16
+ %define BS2_INC_CMN_PAE
+ %define BS2_INC_CMN_PM
+ %define BS2_INC_CMN_PAE_LM
+%endif
+%ifdef BS2_INC_PAE32
+ %define BS2_INC_CMN_P32
+ %define BS2_INC_CMN_PAE
+ %define BS2_INC_CMN_PM
+ %define BS2_INC_CMN_PAE_LM
+%endif
+%ifdef BS2_INC_PAEV86
+ %define BS2_INC_CMN_R86
+ %define BS2_INC_CMN_V86
+ %define BS2_INC_CMN_PAE
+ %define BS2_INC_CMN_PM
+ %define BS2_INC_CMN_PAE_LM
+%endif
+%ifdef BS2_INC_LM16
+ %define BS2_INC_CMN_P16
+ %define BS2_INC_CMN_LM
+ %define BS2_INC_CMN_PAE_LM
+%endif
+%ifdef BS2_INC_LM32
+ %define BS2_INC_CMN_P32
+ %define BS2_INC_CMN_LM
+ %define BS2_INC_CMN_PAE_LM
+%endif
+%ifdef BS2_INC_LM64
+ %define BS2_INC_CMN_LM64
+ %define BS2_INC_CMN_LM
+ %define BS2_INC_CMN_PAE_LM
+%endif
+
+
+;
+; Misc defines.
+;
+;; The offset of the TSS32.CR3 field.
+%define BS2_TSS32_CR3_OFF       01ch
+
+
+;*******************************************************************************
+;*      Structures and Typedefs                                                *
+;*******************************************************************************
+
+
+;
+; Start with a jump just to follow the convention.
+; Also declare all segments/sections to establish them and their order.
+;
+        ORG BS2_ADDR
+
+section .text                                                   valign=16  align=16     progbits
+section .data       vfollows=.text          follows=.text       valign=16  align=16     progbits
+section .texthigh   vfollows=.data          follows=.data       valign=16  align=16     progbits
+section .traprecs   vfollows=.texthigh      follows=.texthigh   valign=8   align=8      progbits
+section .end        vfollows=.traprecs      follows=.traprecs   valign=512 align=512    progbits
+
+%define BEGINCODELOW    section .text     ;;< For 16-bit code.
+%define BEGINCODEHIGH   section .texthigh ;;< For 32-bit and 64-bit code.
+%define BEGINEND        section .end      ;;< For aligning image to 512 bytes.
+
+BEGINCODELOW
+BITS 16
+start:
+        jmp short bs2InitCode
+        nop
+        nop                             ; alignment
+
+;
+; Abuse the bios parameter block area for data storage.
+;
+gdtr:
+        dw  bs2GdtEnd - bs2Gdt - 1          ; limit 15:00
+        dw  bs2Gdt                          ; base  15:00
+        db  0                               ; base  23:16
+        db  0                               ; unused
+
+idtr_null:
+        dw  0                               ; limit 15:00
+        dw  bs2Gdt                          ; base  15:00
+        db  0                               ; base  23:16
+        db  0                               ; unused
+
+%ifdef BS2_WITH_TRAPS
+ %ifdef BS2_INC_CMN_PM
+idtr_32bit:
+        dw  bs2Idt32bitEnd - bs2Idt32bit -1 ; limit 15:00
+        dw  bs2Idt32bit                     ; base  15:00
+        db  0                               ; base  23:16
+        db  0                               ; unused
+ %endif
+
+ %ifdef BS2_INC_CMN_LM
+idtr_64bit:
+        dw  bs2Idt64bitEnd - bs2Idt64bit -1 ; limit 15:00
+        dw  bs2Idt64bit                     ; base  15:00
+        db  0                               ; base  23:16
+        db  0                               ; unused
+ %endif
+
+%elifdef BS2_WITH_RAW_MODE
+idtr_dummy_32bit:
+        dw  bs2DummyIdt32bitEnd - bs2DummyIdt32bit -1   ; limit 15:00
+        dw  bs2DummyIdt32bit                            ; base  15:00
+        db  0                                           ; base  23:16
+        db  0                                           ; unused
+%endif
+
+idtr_real_mode:
+        dw  01ffh                           ; limit 15:00
+        dw  0                               ; base  15:00
+        db  0                               ; base  23:16
+        db  0                               ; unused
+
+g_achHex:
+        db '0123456789abcdef', 0
+
+g_bBootDrv:
+        db  80h                             ; Not in the official BPB location, but whatever.
+g_fCpuIntel:
+        db 0
+g_fCpuAmd:
+        db 0
+
+bs2BpbPadding:
+        times 3dh - (bs2BpbPadding - start) db 0
+
+
+;
+; Where to real init code starts.
+;
+bs2InitCode:
+        cli
+
+%ifdef BS2_INIT_SAVE_REGS
+        ; save the registers if we've been asked to do so.
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.rax], eax
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.rsp], esp
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.rbp], ebp
+        mov     ax, ss
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.ss], ax
+        mov     ax, ds
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.ds], ax
+        mov     ax, es
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.es], ax
+        mov     ax, fs
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.fs], ax
+        mov     ax, gs
+%endif
+
+        ; set up the segment reisters and stack.
+        xor     eax, eax
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+        mov     ss, ax
+        mov     esp, STACK_ADDR
+        mov     [esp],  eax             ; clear the first 16 bytes
+        mov     [esp + 04h],  eax
+        mov     [esp + 08h],  eax       ; fake rbp.
+        mov     [esp + 0ch],  eax       ; fake ebp and bp
+        mov     ebp, esp
+
+%ifdef BS2_INIT_SAVE_REGS
+        ; Save more registers now that ds is known and the stack is usable.
+        pushfd
+        pop     eax
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.rflags], eax
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.rbx], ebx
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.rcx], ecx
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.rdx], edx
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.rsi], esi
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.rdi], edi
+%endif
+
+        ; Make sure caching is enabled and alignment is off.
+        mov     eax, cr0
+%ifdef BS2_INIT_SAVE_REGS
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.cr0], eax
+%endif
+        and     eax, ~(X86_CR0_NW | X86_CR0_CD | X86_CR0_AM)
+        mov     cr0, eax
+
+        ; Load all the code.
+        call    bs2InitLoadImage
+        mov     [g_bBootDrv], dl
+
+        ; Initialize the data structures for the included modes requiring this.
+%ifdef BS2_INC_CMN_PP
+        call    bs2InitPagedProtMode
+%endif
+%ifdef BS2_INC_CMN_PAE
+        call    bs2InitPaeProtMode
+%endif
+%ifdef BS2_INC_CMN_LM
+        call    bs2InitLongMode
+%endif
+
+        ; Entered the desired mode.
+%ifdef BS2_INIT_PE32
+        call    Bs2EnterMode_rm_pe32
+BITS 32
+%endif
+%ifdef BS2_INIT_PP32
+        call    Bs2EnterMode_rm_pp32
+BITS 32
+%endif
+%ifdef BS2_INIT_PAE32
+        call    Bs2EnterMode_rm_pae32
+BITS 32
+%endif
+%ifdef BS2_INIT_LM64
+        call    Bs2EnterMode_rm_lm64
+BITS 64
+%endif
+%ifdef BS2_INIT_RM
+        call    SetCpuModeGlobals_rm
+%endif
+
+%ifdef BS2_WITH_RAW_MODE
+        ;
+        ; Mask interrupts and then set IF.
+        ;
+        mov     al, 0ffh
+        out     021h, al
+        out     0a1h, al
+        sti
+%endif
+
+        jmp     bs2DoneInit
+
+
+;;
+; Loads the image off the floppy.
+;
+; This uses the the_end label to figure out the length.  For this to work
+; cleanly the label must be aligned on a sector boundrary.  Use BS2_PAD_IMAGE
+; to make sure this is the case.
+;
+; Clobbers everything except ebp and esp.  Panics on failure.
+;
+; @param    dl          The boot drive number (from BIOS).
+; @uses     ax, cx, bx, esi, di
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2InitLoadImage
+        push    bp
+        mov     bp, sp
+        push    es
+%define bSavedDiskNo    byte [bp - 04h]
+        push    dx
+%define bMaxSector      byte [bp - 06h]
+        push    0
+%define bMaxHead        byte [bp - 08h]
+        push    0
+%define bMaxCylinder    byte [bp - 0ah]
+        push    0
+
+        ;
+        ; Try figure the geometry.
+        ;
+        mov     ah, 08h
+        int     13h
+        jc      .failure
+        mov     bMaxSector, cl
+        mov     bMaxHead, dh
+        mov     bMaxCylinder, ch
+        mov     dl, bSavedDiskNo
+
+        ;
+        ; Reload all the sectors one at a time (avoids problems).
+        ;
+        lea     esi, [dword the_end]
+        sub     esi, start
+        shr     esi, 9                  ; si = number of sectors to load.
+        mov     di, BS2_ADDR / 16       ; The current load segment.
+        mov     cx, 0001h               ; ch/cylinder=0 (0-based); cl/sector=1 (1-based)
+        xor     dh, dh                  ; dh/head=0
+.the_load_loop:
+        xor     bx, bx
+        mov     es, di                  ; es:bx -> buffer
+        mov     ax, 0201h               ; al=1 sector; ah=read function
+        int     13h
+        jc      .failure
+
+        ; advance to the next sector/head/cylinder.
+        inc     cl
+        cmp     cl, bMaxSector
+        jbe     .adv_addr
+
+        mov     cl, 1
+        inc     dh
+        cmp     dh, bMaxHead
+        jbe     .adv_addr
+
+        mov     dh, 0
+        inc     ch
+
+.adv_addr:
+        add     di, 512 / 16
+        dec     si
+        jnz     .the_load_loop
+
+        add     sp, 3*2
+        pop     dx
+        pop     es
+        leave
+        ret
+
+        ;
+        ; Something went wrong, display a message.
+        ;
+.failure:
+        pusha
+
+        ; print message
+        mov     si, .s_szErrMsg
+        mov     ah, 0eh
+        xor     bx, bx
+.failure_next_char:
+        lodsb
+        int     10h
+        cmp     si, .s_szErrMsgEnd
+        jb      .failure_next_char
+
+        ; format the error number.
+        movzx   bx, byte [bp - 2 - 1]    ; read the ah of the pusha frame
+        shr     bl, 4
+        mov     al, [bx + g_achHex]
+        int     10h
+
+        movzx   bx, byte [bp - 2 - 1]    ; read the ah of the pusha frame
+        and     bl, 0fh
+        mov     al, [bx + g_achHex]
+        int     10h
+
+        ; panic
+        popa
+        call    Bs2Panic
+.s_szErrMsg:
+        db 13, 10, 'read error: '
+.s_szErrMsgEnd:
+ENDPROC bs2InitLoadImage
+
+;; Pads the image so bs2InitLoadImage can load it without trouble.
+%macro BS2_PAD_IMAGE 0
+bs2PadImageLabel:
+;        times ( (512*18*2) - ( (bs2PadImageLabel - start) % (512*18*2) ) ) db 0        ; track aligned size.
+        times ( 512 - ( (bs2PadImageLabel - start) % 512 ) ) db 0                       ; sector aligned size.
+;        times ( 10000h - BS2_ADDR - (bs2PadImageLabel - start) ) db 0                   ; full segment 0 size.
+%endmacro
+
+
+;;
+; Shutdown routine that will work in real and protected  mode, providing
+; that SS is valid that we can load it into DS.
+;
+; Does not return.
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2Shutdown
+        cli
+        mov     bl, 64
+        mov     dx, 08900h
+        mov     ax, ss
+        mov     ds, ax
+.retry:
+        mov     ecx, 8
+        mov     esi, .s_szShutdown
+        rep outsb
+        dec     bl
+        jnz     .retry
+        ; Shutdown failed!
+        jmp     Bs2Panic
+.s_szShutdown:
+        db      'Shutdown', 0
+ENDPROC Bs2Shutdown
+
+
+;;
+; Panic routine for real mode.
+;
+; Does not return.
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2Panic
+        cli
+.hlt_again:
+        hlt
+        jmp     .hlt_again
+ENDPROC Bs2Panic
+
+
+;
+; Padd the remainder of the sector with zeros and
+; end it with the dos signature.
+;
+bs2Padding:
+        times 510 - (bs2Padding - start) db 0
+        db 055h, 0aah
+
+
+;
+; The GDT (X86DESCGENERIC).
+;
+align 8, db 0
+bs2Gdt:
+        dw  00000h, 00000h, 00000h, 00000h      ; null selector
+%define BS2_SEL_R0_BASE                         08h
+%define BS2_SEL_CS32                            08h
+        dw  0ffffh, 00000h, 09b00h, 000cfh      ; 32-bit flat code  segment.
+%define BS2_SEL_DS32                            10h
+        dw  0ffffh, 00000h, 09300h, 000cfh      ; 32-bit flat data  segment.
+%define BS2_SEL_SS32                            18h
+        dw  0ffffh, 00000h, 09300h, 000cfh      ; 32-bit flat stack segment.
+%define BS2_SEL_CS16                            20h
+        dw  0ffffh, 00000h, 09b00h, 00000h      ; 16-bit code segment with base 0.
+%define BS2_SEL_DS16                            28h
+        dw  0ffffh, 00000h, 09300h, 00000h      ; 16-bit data segment with base 0.
+%define BS2_SEL_SS16                            30h
+        dw  0ffffh, 00000h, 09300h, 00000h      ; 16-bit stack segment with base 0.
+%define BS2_SEL_CS64                            38h
+        dw  0ffffh, 00000h, 09a00h, 000afh      ; 64-bit code segment.
+%define BS2_SEL_DS64                            40h
+%define BS2_SEL_SS64                            40h
+        dw  0ffffh, 00000h, 09300h, 000afh      ; 64-bit stack and data segment.
+        dw  00000h, 00000h, 00000h, 00000h      ; Unused
+%define BS2_SEL_MMIO16                          50h
+%define BS2_SEL_MMIO16_BASE                     0100000h
+        dw  0ffffh, 00000h, 09310h, 00000h      ; 16-bit VMMDev MMIO segment with base 0100000h.
+        dw  00000h, 00000h, 00000h, 00000h      ; Unused
+%define BS2_SEL_LDT                             60h ; LDT usage requires manual LLDT and setting up.
+        dw  BS2_LDT_SIZE, BS2_LDT_BASE & 0xffff, 08200h | ((BS2_LDT_BASE >> 16) & 0xff), 00000h
+        dw  00000h, 00000h, 00000h, 00000h      ; zero for 64-bit mode.
+%define BS2_SEL_CS16_EO                         70h
+        dw  0fffeh, 00000h, 09800h, 00000h      ; 16-bit code segment with base 0, not accessed, execute only, short limit.
+        dw  00000h, 00000h, 00000h, 00000h      ; unused.
+%ifdef BS2_WITH_TRAPS
+ %ifdef BS2_INC_CMN_PM
+  %define BS2_SEL_TSS32                         80h
+        dw  (bs2Tss32BitEnd - bs2Tss32Bit) - 1  ; 32-bit TSS.
+        dw  bs2Tss32Bit
+        db  0
+        db  X86_SEL_TYPE_SYS_386_TSS_AVAIL | 0x80
+        dw  0
+  %define BS2_SEL_TSS32_DF                      88h
+        dw  (bs2Tss32BitDfEnd - bs2Tss32BitDf) - 1; 32-bit TSS, double fault.
+        dw  bs2Tss32BitDf
+        db  0
+        db  X86_SEL_TYPE_SYS_386_TSS_AVAIL | 0x80
+        dw  0
+ %else
+        dw  00000h, 00000h, 00000h, 00000h
+        dw  00000h, 00000h, 00000h, 00000h
+ %endif
+ %ifdef BS2_INC_CMN_LM
+  %define BS2_SEL_TSS64                         90h
+        dw  (bs2Tss64BitEnd - bs2Tss64Bit) - 1  ; 32-bit TSS.
+        dw  bs2Tss64Bit
+        db  0
+        db  AMD64_SEL_TYPE_SYS_TSS_AVAIL | 0x80
+        dw  0
+        dw  00000h, 00000h, 00000h, 00000h      ; 2nd half of the 64-bit selector (not necessary).
+ %else
+        dw  00000h, 00000h, 00000h, 00000h
+        dw  00000h, 00000h, 00000h, 00000h
+ %endif
+%endif
+        ; Ring-1 selectors.
+%define BS2_SEL_R1_BASE                         0a0h
+%define BS2_SEL_R1_CS32                         0a0h
+        dw  0ffffh, 00000h, 0bb00h, 000cfh      ; Ring-1 32-bit flat code  segment.
+%define BS2_SEL_R1_DS32                         0a8h
+        dw  0ffffh, 00000h, 0b300h, 000cfh      ; Ring-1 32-bit flat data  segment.
+%define BS2_SEL_R1_SS32                         0b0h
+        dw  0ffffh, 00000h, 0b300h, 000cfh      ; Ring-1 32-bit flat stack segment.
+%define BS2_SEL_R1_CS16                         0b8h
+        dw  0ffffh, 00000h, 0bb00h, 00000h      ; Ring-1 16-bit code segment with base 0.
+%define BS2_SEL_R1_DS16                         0c0h
+        dw  0ffffh, 00000h, 0b300h, 00000h      ; Ring-1 16-bit data segment with base 0.
+%define BS2_SEL_R1_SS16                         0c8h
+        dw  0ffffh, 00000h, 0b300h, 00000h      ; Ring-1 16-bit stack segment with base 0.
+%define BS2_SEL_R1_CS64                         0d0h
+        dw  0ffffh, 00000h, 0ba00h, 000afh      ; Ring-1 64-bit code segment.
+%define BS2_SEL_R1_DS64                         0d8h
+%define BS2_SEL_R1_SS64                         0d8h
+        dw  0ffffh, 00000h, 0b300h, 000afh      ; Ring-1 64-bit stack and data segment.
+
+        ; Ring-2 selectors.
+%define BS2_SEL_R2_BASE                         0e0h
+%define BS2_SEL_R2_CS32                         0e0h
+        dw  0ffffh, 00000h, 0db00h, 000cfh      ; Ring-2 32-bit flat code  segment.
+%define BS2_SEL_R2_DS32                         0e8h
+        dw  0ffffh, 00000h, 0d300h, 000cfh      ; Ring-2 32-bit flat data  segment.
+%define BS2_SEL_R2_SS32                         0f0h
+        dw  0ffffh, 00000h, 0d300h, 000cfh      ; Ring-2 32-bit flat stack segment.
+%define BS2_SEL_R2_CS16                         0f8h
+        dw  0ffffh, 00000h, 0db00h, 00000h      ; Ring-2 16-bit code segment with base 0.
+%define BS2_SEL_R2_DS16                         0f0h
+        dw  0ffffh, 00000h, 0d300h, 00000h      ; Ring-2 16-bit data segment with base 0.
+%define BS2_SEL_R2_SS16                         108h
+        dw  0ffffh, 00000h, 0d300h, 00000h      ; Ring-2 16-bit stack segment with base 0.
+%define BS2_SEL_R2_CS64                         110h
+        dw  0ffffh, 00000h, 0da00h, 000afh      ; Ring-2 64-bit code segment.
+%define BS2_SEL_R2_DS64                         118h
+%define BS2_SEL_R2_SS64                         118h
+        dw  0ffffh, 00000h, 0d300h, 000afh      ; Ring-2 64-bit stack and data segment.
+
+        ; Ring-3 selectors.
+%define BS2_SEL_R3_BASE                         120h
+%define BS2_SEL_R3_CS32                         120h
+        dw  0ffffh, 00000h, 0fb00h, 000cfh      ; Ring-3 32-bit flat code  segment.
+%define BS2_SEL_R3_DS32                         128h
+        dw  0ffffh, 00000h, 0f300h, 000cfh      ; Ring-3 32-bit flat data  segment.
+%define BS2_SEL_R3_SS32                         130h
+        dw  0ffffh, 00000h, 0f300h, 000cfh      ; Ring-3 32-bit flat stack segment.
+%define BS2_SEL_R3_CS16                         138h
+        dw  0ffffh, 00000h, 0fb00h, 00000h      ; Ring-3 16-bit code segment with base 0.
+%define BS2_SEL_R3_DS16                         140h
+        dw  0ffffh, 00000h, 0f300h, 00000h      ; Ring-3 16-bit data segment with base 0.
+%define BS2_SEL_R3_SS16                         148h
+        dw  0ffffh, 00000h, 0f300h, 00000h      ; Ring-3 16-bit stack segment with base 0.
+%define BS2_SEL_R3_CS64                         150h
+        dw  0ffffh, 00000h, 0fa00h, 000afh      ; Ring-1 64-bit code segment.
+%define BS2_SEL_R3_DS64                         158h
+%define BS2_SEL_R3_SS64                         158h
+        dw  0ffffh, 00000h, 0f300h, 000afh      ; Ring-1 64-bit stack and data segment.
+
+        ; Here follows a bunch of spare GDT entries for (ab)use in testing.
+%define BS2_SEL_SPARE0                          160h
+bs2GdtSpare0:
+        dq 0
+%define BS2_SEL_SPARE1                          (BS2_SEL_SPARE0 + 08h)
+bs2GdtSpare1:
+        dq 0
+%define BS2_SEL_SPARE2                          (BS2_SEL_SPARE0 + 10h)
+bs2GdtSpare2:
+        dq 0
+%define BS2_SEL_SPARE3                          (BS2_SEL_SPARE0 + 18h)
+bs2GdtSpare3:
+        dq 0
+bs2GdtEnd:
+
+
+%ifndef BS2_WITH_TRAPS
+ %ifdef BS2_WITH_RAW_MODE
+;
+; Dummy 32-bit IDT for making CSAM happy.
+;
+align 16, db 0
+bs2DummyIdt32bit:
+        dw 0, 0, 0, 0
+        dw 0, 0, 0, 0
+        dw 0, 0, 0, 0
+        dw 0, 0, 0, 0
+bs2DummyIdt32bitEnd
+ %endif
+%endif
+
+
+;
+; Mode initialization routines.
+;
+
+%ifdef BS2_INC_CMN_PP
+;;
+; Initializes the paged protected mode structures during init.
+;
+; @uses     ebx, esi
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2InitPagedProtMode
+        push    ds
+
+        ;
+        ; Create a paging hierarchy
+        ;
+        mov     bx, BS2_PXX_SEL
+        mov     ds, bx
+        mov     ebx, BS2_PXX_OFF(BS2_32B_PD_ADDR)
+        xor     esi, esi                    ; physical address
+
+        ; The page directory.
+.pd_loop:
+        mov     dword [bx], esi
+        or      word [bx], X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_PS | X86_PDE4M_US
+        add     esi, _4M
+        add     bx, 4
+        test    bx, 0fffh
+        jnz     .pd_loop
+
+%ifdef BS2_WITH_RAW_MODE
+        ;
+        ; Make sure there is some free space for the hypervisor near the top
+        ; of the address space (last 4MB is mapped).
+        ;
+        and     byte [bx - 08h], 0feh
+        and     byte [bx - 0ch], 0feh
+        and     byte [bx - 10h], 0feh
+        and     byte [bx - 14h], 0feh
+%endif
+
+        pop     ds
+        ret
+ENDPROC   bs2InitPagedProtMode
+%endif ; BS2_INC_CMN_PP
+
+
+%ifdef BS2_INC_CMN_PAE_LM
+;;
+; Initializes the PAE page directories.
+;
+; Assumes ds is set to BS2_PXX_SEL already and that edx is zero.
+;
+; @uses         ebx, esi
+; @internal
+;
+BEGINPROC bs2InitPaePageDirs
+        mov     esi, X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_PS | X86_PDE4M_US
+        mov     ebx, BS2_PXX_OFF(BS2_PAE_PD_ADDR)
+.pd_loop:
+        mov     [bx], esi
+        mov     [bx + 4], edx
+        add     esi, _2M
+        add     bx, 8
+        test    bx, 0fffh
+        jnz     .pd_loop
+        cmp     bx, BS2_PXX_OFF(BS2_PAE_PD_ADDR + 4*_4K)
+        jne     .pd_loop
+
+%ifdef BS2_WITH_RAW_MODE
+        ;
+        ; Make sure there is some free space for the hypervisor near the top
+        ; of the address space (last 4MB is mapped).
+        ;
+        and     byte [bx - 10h], 0feh
+        and     byte [bx - 18h], 0feh
+        and     byte [bx - 20h], 0feh
+        and     byte [bx - 28h], 0feh
+%endif
+
+        ret
+ENDPROC   bs2InitPaePageDirs
+%endif ; BS2_INC_CMN_PAE_LM
+
+
+%ifdef BS2_INC_CMN_PAE
+;;
+; Initializes the PAE protected mode structures during init.
+;
+; @uses     edx, ebx, esi.
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2InitPaeProtMode
+        push    ds
+
+        mov     dx, BS2_PXX_SEL
+        mov     ds, dx
+        xor     edx, edx
+
+        ;
+        ; Join paths with long mode.
+        ;
+        call    bs2InitPaePageDirs
+
+        ;
+        ; Create the page directory pointer table.
+        ;
+        mov     ebx, BS2_PXX_OFF(BS2_PAE_PDP_ADDR)
+        mov     dword [bx],       (BS2_PAE_PD_ADDR        ) | X86_PDPE_P
+        mov     dword [bx + 04h], edx
+        mov     dword [bx + 08h], (BS2_PAE_PD_ADDR + 1000h) | X86_PDPE_P
+        mov     dword [bx + 0ch], edx
+        mov     dword [bx + 10h], (BS2_PAE_PD_ADDR + 2000h) | X86_PDPE_P
+        mov     dword [bx + 14h], edx
+        mov     dword [bx + 18h], (BS2_PAE_PD_ADDR + 3000h) | X86_PDPE_P
+        mov     dword [bx + 1ch], edx
+
+        pop     ds
+        ret
+ENDPROC   bs2InitPaeProtMode
+%endif ; BS2_INC_CMN_PAE
+
+
+%ifdef BS2_INC_CMN_LM
+;;
+; Initializes the long mode structures during init.
+;
+; @uses     edx, ebx, esi
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2InitLongMode
+        push    ds
+
+        mov     dx, BS2_PXX_SEL
+        mov     ds, dx
+        xor     edx, edx
+
+        ;
+        ; Join paths with the PAE code.
+        ;
+        call    bs2InitPaePageDirs
+
+        ;
+        ; Create the long mode page directory pointer table.
+        ;
+        mov     ebx, BS2_PXX_OFF(BS2_LM_PDP_ADDR)
+.pdptr_loop:
+        mov     dword [bx],       (BS2_PAE_PD_ADDR        ) | X86_PDPE_P | X86_PDPE_RW | X86_PDPE_US
+        mov     dword [bx + 04h], edx
+        mov     dword [bx + 08h], (BS2_PAE_PD_ADDR + 1000h) | X86_PDPE_P | X86_PDPE_RW | X86_PDPE_US
+        mov     dword [bx + 0ch], edx
+        mov     dword [bx + 10h], (BS2_PAE_PD_ADDR + 2000h) | X86_PDPE_P | X86_PDPE_RW | X86_PDPE_US
+        mov     dword [bx + 14h], edx
+        mov     dword [bx + 18h], (BS2_PAE_PD_ADDR + 3000h) | X86_PDPE_P | X86_PDPE_RW | X86_PDPE_US
+        mov     dword [bx + 1ch], edx
+        add     bx, 20h
+        test    bx, 0fffh
+        jnz     .pdptr_loop
+
+        ;
+        ; Set up the page map level 4 table, all entries mapping the same PDPTR.
+        ;
+        mov     ebx, BS2_PXX_OFF(BS2_LM_PML4_ADDR)
+.pml4_loop:
+        mov     dword [bx], BS2_LM_PDP_ADDR | X86_PML4E_P | X86_PML4E_RW | X86_PML4E_US
+        mov     dword [bx + 4], edx
+        add     bx, 8
+        test    bx, 0fffh
+        jnz     .pml4_loop
+
+        pop     ds
+        ret
+ENDPROC   bs2InitLongMode
+%endif ; BS2_INC_CMN_LM
+
+
+
+;
+; Routines for entering the different modes.
+;
+
+%ifdef BS2_INC_RM
+;;
+; Dummy.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_rm
+        ret
+ENDPROC Bs2EnterMode_rm_rm
+%endif ; BS2_INC_RM
+
+
+%ifdef BS2_INC_PE16
+;;
+; Enters unpaged protected mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 16-bit selectors.
+;           ebp and esp converted to 32/16-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_pe16
+        push    eax
+        pushfd
+        cli
+%ifndef BS2_NOINC_COMMON
+        push    word SetCpuModeGlobals_pe16
+%endif
+
+        ;
+        ; Switch to protected mode.
+        ;
+        xor     ax, ax
+        mov     ds, ax
+        lgdt    [gdtr]
+%ifdef BS2_WITH_TRAPS
+        lidt    [idtr_32bit]
+%elifdef BS2_WITH_RAW_MODE
+        lidt    [idtr_dummy_32bit]
+%else
+        lidt    [idtr_null]
+%endif
+
+        mov     eax, cr0
+        or      eax, X86_CR0_PE
+        and     eax, 0ffffffffh - X86_CR0_PG
+        mov     cr0, eax
+        jmp far BS2_SEL_CS16:bs2ProtModeCode16Start_p16
+ENDPROC   Bs2EnterMode_rm_pe16
+%endif ; BS2_INC_PE16
+
+
+%ifdef BS2_INC_PE32
+;;
+; Enters unpaged protected mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 32-bit selectors.
+;           ebp and esp converted to 32-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_pe32
+        push    word 0
+        push    eax
+        pushfd
+        cli
+%ifndef BS2_NOINC_COMMON
+        push    dword SetCpuModeGlobals_pe32
+%endif
+
+        ; Do the mode switch.
+        xor     ax, ax
+        mov     ds, ax
+        lgdt    [gdtr]
+%ifdef BS2_WITH_TRAPS
+        lidt    [idtr_32bit]
+%elifdef BS2_WITH_RAW_MODE
+        lidt    [idtr_dummy_32bit]
+%else
+        lidt    [idtr_null]
+%endif
+
+        mov     eax, cr0
+        or      eax, X86_CR0_PE
+        and     eax, 0ffffffffh - X86_CR0_PG
+        mov     cr0, eax
+        jmp far BS2_SEL_CS32:bs2ProtModeCode32Start_p32
+ENDPROC   Bs2EnterMode_rm_pe32
+%endif ; BS2_INC_PE32
+
+
+;; @todo BS2_INC_PEV86
+
+
+%ifdef BS2_INC_PP16
+;;
+; Enters paged protected mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 16-bit selectors.
+;           ebp and esp converted to 16/32-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_pp16
+        push    eax
+        pushfd
+        cli
+%ifndef BS2_NOINC_COMMON
+        push    word SetCpuModeGlobals_pp16
+%endif
+
+        ; Do the mode switch.
+        xor     ax, ax
+        mov     ds, ax
+        lgdt    [gdtr]
+%ifdef BS2_WITH_TRAPS
+        lidt    [idtr_32bit]
+%elifdef BS2_WITH_RAW_MODE
+        lidt    [idtr_dummy_32bit]
+%else
+        lidt    [idtr_null]
+%endif
+
+        mov     eax, BS2_32B_PD_ADDR
+        mov     cr3, eax
+%ifdef BS2_WITH_TRAPS
+        mov     [bs2Tss32BitDf + BS2_TSS32_CR3_OFF], eax
+%endif
+
+        mov     eax, cr4
+        or      eax, X86_CR4_PSE
+        and     eax, ~X86_CR4_PAE
+        mov     cr4, eax
+
+        mov     eax, cr0
+        or      eax, X86_CR0_PE | X86_CR0_PG | X86_CR0_WP
+        mov     cr0, eax
+        jmp far BS2_SEL_CS16:bs2ProtModeCode16Start_p16
+ENDPROC   Bs2EnterMode_rm_pp16
+%endif ; BS2_INC_PP16
+
+
+%ifdef BS2_INC_PP32
+;;
+; Enters paged protected mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 32-bit selectors.
+;           ebp and esp converted to 32-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_pp32
+        push    word 0
+        push    eax
+        pushfd
+        cli
+%ifndef BS2_NOINC_COMMON
+        push    dword SetCpuModeGlobals_pp32
+%endif
+
+        ; Do the mode switch.
+        xor     ax, ax
+        mov     ds, ax
+        lgdt    [gdtr]
+%ifdef BS2_WITH_TRAPS
+        lidt    [idtr_32bit]
+%elifdef BS2_WITH_RAW_MODE
+        lidt    [idtr_dummy_32bit]
+%else
+        lidt    [idtr_null]
+%endif
+
+        mov     eax, BS2_32B_PD_ADDR
+        mov     cr3, eax
+%ifdef BS2_WITH_TRAPS
+        mov     [bs2Tss32BitDf + BS2_TSS32_CR3_OFF], eax
+%endif
+
+        mov     eax, cr4
+        or      eax, X86_CR4_PSE
+        and     eax, ~X86_CR4_PAE
+        mov     cr4, eax
+
+        mov     eax, cr0
+        or      eax, X86_CR0_PE | X86_CR0_PG | X86_CR0_WP
+        mov     cr0, eax
+        jmp far BS2_SEL_CS32:bs2ProtModeCode32Start_p32
+ENDPROC   Bs2EnterMode_rm_pp32
+%endif ; BS2_INC_PP16
+
+
+;; @todo BS2_INC_PPV86
+
+
+%ifdef BS2_INC_PAE16
+;;
+; Enters PAE protected mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 16-bit selectors.
+;           ebp and esp converted to 16/32-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_pae16
+        push    eax
+        pushfd
+        cli
+%ifndef BS2_NOINC_COMMON
+        push    word SetCpuModeGlobals_pae16
+%endif
+
+        ; Do the mode switch.
+        xor     ax, ax
+        mov     ds, ax
+        lgdt    [gdtr]
+%ifdef BS2_WITH_TRAPS
+        lidt    [idtr_32bit]
+%elifdef BS2_WITH_RAW_MODE
+        lidt    [idtr_dummy_32bit]
+%else
+        lidt    [idtr_null]
+%endif
+
+        mov     eax, BS2_PAE_PDP_ADDR
+        mov     cr3, eax
+%ifdef BS2_WITH_TRAPS
+        mov     [bs2Tss32BitDf + BS2_TSS32_CR3_OFF], eax
+%endif
+
+        mov     eax, cr4
+        or      eax, X86_CR4_PAE | X86_CR4_PSE
+        mov     cr4, eax
+
+        mov     eax, cr0
+        or      eax, X86_CR0_PE | X86_CR0_PG | X86_CR0_WP
+        mov     cr0, eax
+        jmp far BS2_SEL_CS16:bs2ProtModeCode16Start_p16
+ENDPROC   Bs2EnterMode_rm_pae16
+%endif ; BS2_INC_PAE16
+
+
+%ifdef BS2_INC_PAE32
+;;
+; Enters PAE protected mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 32-bit selectors.
+;           ebp and esp converted to 32-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_pae32
+        push    word 0
+        push    eax
+        pushfd
+        cli
+%ifndef BS2_NOINC_COMMON
+        push    dword SetCpuModeGlobals_pae32
+%endif
+
+        ; Do the mode switch.
+        xor     ax, ax
+        mov     ds, ax
+        lgdt    [gdtr]
+%ifdef BS2_WITH_TRAPS
+        lidt    [idtr_32bit]
+%elifdef BS2_WITH_RAW_MODE
+        lidt    [idtr_dummy_32bit]
+%else
+        lidt    [idtr_null]
+%endif
+
+        mov     eax, BS2_PAE_PDP_ADDR
+        mov     cr3, eax
+%ifdef BS2_WITH_TRAPS
+        mov     [bs2Tss32BitDf + BS2_TSS32_CR3_OFF], eax
+%endif
+
+        mov     eax, cr4
+        or      eax, X86_CR4_PAE | X86_CR4_PSE
+        mov     cr4, eax
+
+        mov     eax, cr0
+        or      eax, X86_CR0_PE | X86_CR0_PG | X86_CR0_WP
+        mov     cr0, eax
+        jmp far BS2_SEL_CS32:bs2ProtModeCode32Start_p32
+ENDPROC   Bs2EnterMode_rm_pae32
+%endif ; BS2_INC_PAE32
+
+
+;; @todo BS2_INC_PAEV86
+
+
+%ifdef BS2_INC_LM16
+;;
+; Enters long mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 16-bit selectors.
+;           rbp and rsp converted to 16/32/64-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_lm16
+        call    Bs2EnterMode_rm_lm64
+BITS 64
+        call    Bs2Thunk_lm64_lm16
+BITS 16
+        ret
+ENDPROC   Bs2EnterMode_rm_lm16
+%endif ; BS2_INC_LM16
+
+
+%ifdef BS2_INC_LM32
+;;
+; Enters long mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 32-bit selectors.
+;           rbp and rsp converted to 16/32/64-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_lm32
+        ; Change the return address into a 32-bit one.
+        push    word 0                  ; Reserved 2 extra bytes for 32-bit return address.
+        push    eax                     ; Save eax.
+        movzx   eax, word [esp + 6h]    ; Read narrow return address.
+        mov     [esp + 4h], eax         ; Store wide return address.
+        pop     eax                     ; Restore eax.
+
+        ; Do the mode switch and thunking.
+        call    Bs2EnterMode_rm_lm64
+BITS 64
+        call    Bs2Thunk_lm64_lm32
+BITS 32
+        ret
+ENDPROC   Bs2EnterMode_rm_lm32
+%endif ; BS2_INC_LM32
+
+
+%ifdef BS2_INC_LM64
+;;
+; Enters long mode from real mode (cs = 0).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 64-bit selectors.
+;           rbp and rsp converted to 64-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2EnterMode_rm_lm64
+        push    word 0                  ; reserve bytes for 64-bit return address.
+        push    dword 0
+        push    dword 0                 ; rax
+        push    eax
+        push    dword 0                 ; rcx
+        push    ecx
+        push    dword 0                 ; rdx
+        push    edx
+        push    dword 0                 ; rflags
+        pushfd
+        cli
+
+        ; Fix the return address.
+        mov     ax, [esp + 20h + 6h]
+        mov     word [esp + 20h + 6h], 0
+        mov     [esp + 20h], ax
+
+        ;
+        ; Switch to long mode.
+        ;
+        xor     ax, ax
+        mov     ds, ax
+        lgdt    [gdtr]
+%ifdef BS2_WITH_TRAPS
+        lidt    [idtr_64bit]
+%else
+        lidt    [idtr_null]
+%endif
+
+        mov     eax, BS2_LM_PML4_ADDR
+        mov     cr3, eax
+
+        mov     eax, cr4
+        or      eax, X86_CR4_PAE | X86_CR4_PSE
+        mov     cr4, eax
+
+        mov     ecx, MSR_K6_EFER
+        rdmsr
+        or      eax, MSR_K6_EFER_LME
+        wrmsr
+
+        mov     eax, cr0
+        or      eax, X86_CR0_PE | X86_CR0_PG | X86_CR0_WP
+        mov     cr0, eax
+        jmp far BS2_SEL_CS64:.code64_start
+
+BITS 64
+.code64_start:
+        mov     eax, BS2_SEL_DS64
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+        mov     ax, BS2_SEL_SS64
+        mov     ss, ax
+%ifdef BS2_WITH_TRAPS
+        btr     dword [bs2Gdt + BS2_SEL_TSS64 + 32/8], 1+8      ; busy -> avail
+ %ifndef BS2_WITH_MANUAL_LTR
+        mov     ax, BS2_SEL_TSS64
+        ltr     ax
+ %endif
+%endif
+
+        and     ebp, 0ffffh
+        and     esp, 0ffffh
+        and     edi, 0ffffffffh
+        and     esi, 0ffffffffh
+        and     ebx, 0ffffffffh
+
+%ifndef BS2_NOINC_COMMON
+        call    SetCpuModeGlobals_lm64
+%endif
+
+        popf
+        pop     rdx
+        pop     rcx
+        pop     rax
+        ret
+ENDPROC   Bs2EnterMode_rm_lm64
+%endif ; BS2_INC_PAE32
+
+
+
+%ifdef BS2_INC_CMN_P16
+;;
+; Code shared by the three 16-bit protected mode switchers.
+;
+; @internal
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2ProtModeCode16Start_p16
+        ; Initialize the registers.
+        mov     ax, BS2_SEL_DS16
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+        mov     ax, BS2_SEL_SS16
+        mov     ss, ax
+        and     esp, 0ffffh
+        and     ebp, 0ffffh
+%ifdef BS2_WITH_TRAPS
+        btr     word [bs2Gdt + BS2_SEL_TSS32    + 32/8], 1+8    ; busy -> avail
+        btr     word [bs2Gdt + BS2_SEL_TSS32_DF + 32/8], 1+8    ; busy -> avail
+ %ifndef BS2_WITH_MANUAL_LTR
+        mov     ax, BS2_SEL_TSS32
+        ltr     ax
+ %endif
+%endif
+
+%ifndef BS2_NOINC_COMMON
+        ; Set up mode specific global variables.
+        pop     ax
+        call    ax
+%endif
+
+        popfd
+        pop     eax
+        ret
+ENDPROC   bs2ProtModeCode16Start_p16
+%endif ; BS2_INC_CMN_P16
+
+
+%ifdef BS2_INC_CMN_P32
+;;
+; Code shared by the three 32-bit protected mode switchers.
+;
+; @internal
+;
+BEGINCODELOW
+BITS 32
+BEGINPROC bs2ProtModeCode32Start_p32
+        ; Initialize the registers.
+        mov     ax, BS2_SEL_DS32
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+        mov     ax, BS2_SEL_SS32
+        mov     ss, ax
+        and     esp, 0ffffh
+        and     ebp, 0ffffh
+%ifdef BS2_WITH_TRAPS
+        btr     dword [bs2Gdt + BS2_SEL_TSS32    + 32/8], 1+8   ; busy -> avail
+        btr     dword [bs2Gdt + BS2_SEL_TSS32_DF + 32/8], 1+8   ; busy -> avail
+ %ifndef BS2_WITH_MANUAL_LTR
+        mov     ax, BS2_SEL_TSS32
+        ltr     ax
+ %endif
+%endif
+
+%ifndef BS2_NOINC_COMMON
+        ; Set up mode specific global variables.
+        pop     eax
+        call    eax
+%endif
+
+        ; Make the return address 32-bit and then return.
+        movzx   eax, word [esp + 0ah]
+        mov     [esp + 8h], eax
+        popfd
+        pop     eax
+        ret
+ENDPROC   bs2ProtModeCode32Start_p32
+%endif ; BS2_INC_CMN_P32
+
+
+
+;
+; Routines for exitting the different modes.
+;
+
+
+%ifdef BS2_INC_RM
+;;
+; Dummy.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2ExitMode_rm
+        ret
+ENDPROC Bs2ExitMode_rm
+%endif ; BS2_INC_RM
+
+
+%ifdef BS2_INC_PE16
+;;
+; See bs2ExitMode_p16.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2ExitMode_pe16
+        push    bs2ExitModeCleanupNop_rm
+        jmp     bs2ExitMode_p16
+ENDPROC Bs2ExitMode_pe16
+%endif ; BS2_INC_PE16
+
+
+%ifdef BS2_INC_PE32
+;;
+; See bs2ExitMode_p32.
+BEGINCODEHIGH
+BITS 32
+BEGINPROC Bs2ExitMode_pe32
+        push    bs2ExitModeCleanupNop_rm
+        jmp     bs2ExitMode_p32
+ENDPROC Bs2ExitMode_pe32
+%endif ; BS2_INC_PE32
+
+
+%ifdef BS2_INC_PEV86
+;;
+; See Bs2ExitMode_v86.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2ExitMode_pev86
+        push    bs2ExitModeCleanupNop_rm
+        jmp     Bs2ExitMode_pv86
+ENDPROC Bs2ExitMode_pev86
+%endif ; BS2_INC_PEV86
+
+
+%ifdef BS2_INC_PP16
+;;
+; See bs2ExitMode_p16.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2ExitMode_pp16
+        push    bs2ExitModeCleanupNop_rm
+        jmp     bs2ExitMode_p16
+ENDPROC Bs2ExitMode_pp16
+%endif ; BS2_INC_PP16
+
+
+%ifdef BS2_INC_PP32
+;;
+; See bs2ExitMode_p32.
+BEGINCODEHIGH
+BITS 32
+BEGINPROC Bs2ExitMode_pp32
+        push    bs2ExitModeCleanupNop_rm
+        jmp     bs2ExitMode_p32
+ENDPROC Bs2ExitMode_pp32
+%endif ; BS2_INC_PP32
+
+
+%ifdef BS2_INC_PPV86
+;;
+; See Bs2ExitMode_v86.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2ExitMode_ppv86
+        push    bs2ExitModeCleanupNop_rm
+        jmp     Bs2ExitMode_pv86
+ENDPROC Bs2ExitMode_ppv86
+%endif ; BS2_INC_PPV86
+
+
+
+%ifdef BS2_INC_PAE16
+;;
+; See bs2ExitMode_p16.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2ExitMode_pae16
+        push    bs2ExitModeCleanupPae_rm
+        jmp     bs2ExitMode_p16
+ENDPROC Bs2ExitMode_pae16
+%endif ; BS2_INC_pae16
+
+
+%ifdef BS2_INC_PAE32
+;;
+; See bs2ExitMode_p32.
+BEGINCODEHIGH
+BITS 32
+BEGINPROC Bs2ExitMode_pae32
+        push    bs2ExitModeCleanupPae_rm
+        jmp     bs2ExitMode_p32
+ENDPROC Bs2ExitMode_pae32
+%endif ; BS2_INC_PAE32
+
+
+%ifdef BS2_INC_PAEV86
+;;
+; See Bs2ExitMode_v86.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2ExitMode_paev86
+        push    bs2ExitModeCleanupPae_rm
+        jmp     Bs2ExitMode_pv86
+ENDPROC Bs2ExitMode_paev86
+%endif ; BS2_INC_PAEV86
+
+
+%ifdef BS2_INC_LM16
+;;
+; See bs2ExitMode_p16.
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2ExitMode_lm16
+        push    bs2ExitModeCleanupLm_rm
+        jmp     bs2ExitMode_p16
+ENDPROC Bs2ExitMode_lm16
+%endif ; BS2_INC_lm16
+
+
+%ifdef BS2_INC_LM32
+;;
+; See bs2ExitMode_p32.
+BEGINCODEHIGH
+BITS 32
+BEGINPROC Bs2ExitMode_lm32
+        push    bs2ExitModeCleanupLm_rm
+        jmp     bs2ExitMode_p32
+ENDPROC Bs2ExitMode_lm32
+%endif ; BS2_INC_LM32
+
+
+%ifdef BS2_INC_LM64
+;;
+; See Bs2ExitMode_v86.
+BEGINCODELOW
+BITS 64
+BEGINPROC Bs2ExitMode_lm64
+        call    Bs2Thunk_lm64_lm16
+BITS 16
+        pop     dword [esp]
+        pop     word [esp]
+        push    bs2ExitModeCleanupLm_rm
+        jmp     bs2ExitMode_p16
+ENDPROC Bs2ExitMode_lm64
+%endif ; BS2_INC_LM64
+
+
+; Isn't there a better way to do this in yasm?
+%ifdef BS2_INC_CMN_P16
+ %define BS2_INC_BS2EXITMODE_P16
+%elifdef BS2_INC_CMN_LM
+ %define BS2_INC_BS2EXITMODE_P16
+%endif
+
+%ifdef BS2_INC_BS2EXITMODE_P16
+;;
+; Exit 16-bit protected or long mode (cs = CS16, ss = SS16).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with the 0 selector.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2ExitMode_p16
+        push    eax
+        pushfd
+        cli
+
+        ; Make sure we've got the right SS and CS values (paranoia).
+        mov     ax, BS2_SEL_SS16
+        mov     ss, ax
+        jmp far BS2_SEL_CS16:.code16_start
+
+.code16_start:
+        ; Turn off paging and protected mode.
+        mov     eax, cr0
+        and     eax, 0ffffffffh - X86_CR0_PE - X86_CR0_PG
+        mov     cr0, eax
+        jmp far 0000:.real_mode_start
+
+.real_mode_start:
+        ; Load the correct real mode segment registers.
+        xor     ax, ax
+        mov     ss, ax
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+
+        ; Load the real mode idtr.
+        lidt    [idtr_real_mode]
+
+        ; Cleanup.
+        mov     ax, [esp + 8h]
+        call    ax
+
+%ifndef BS2_NOINC_COMMON
+        ; Set globals.
+        call    SetCpuModeGlobals_rm
+%endif
+
+        popfd
+        pop     eax
+        add     sp, 2h                  ; cleanup routine address
+        ret
+ENDPROC   bs2ExitMode_p16
+%endif ; BS2_INC_CMN_P16
+
+
+%ifdef BS2_INC_CMN_P32
+;;
+; Exit 32-bit protected or long mode (cs = CS32, ss = SS32).
+;
+; The return address as well as the stack registers must be somewhere within
+; the first 64KB of the address space.
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with the 0 selector.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 32
+BEGINPROC bs2ExitMode_p32
+        push    eax
+        mov     eax, [esp + 8h]         ; return address
+        mov     [esp + 0ah], ax
+        mov     eax, [esp + 4h]         ; cleanup routine address
+        mov     [esp + 08h], ax
+        pop     eax
+        add     esp, 4h
+
+        call    Bs2Thunk_p32_p16
+BITS 16
+        jmp     bs2ExitMode_p16
+ENDPROC   bs2ExitMode_p32
+%endif ; BS2_INC_CMN_P32
+
+
+;;
+; Dummy cleanup routine.
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2ExitModeCleanupNop_rm
+        ret
+ENDPROC   bs2ExitModeCleanupNop_rm
+
+
+%ifdef BS2_INC_CMN_PAE
+;;
+; Cleans up after leaving PAE mode.
+; @uses     nothing
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2ExitModeCleanupPae_rm
+        push    eax
+        mov     eax, cr4
+        and     eax, ~X86_CR4_PAE
+        mov     cr4, eax
+        pop     eax
+        ret
+ENDPROC   bs2ExitModeCleanupPae_rm
+%endif
+
+
+%ifdef BS2_INC_CMN_LM
+;;
+; Cleans up after leaving long mode.
+; @uses     nothing
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2ExitModeCleanupLm_rm
+        push    eax
+        push    edx
+        push    ecx
+
+        mov     ecx, MSR_K6_EFER
+        rdmsr
+        and     eax, ~MSR_K6_EFER_LME
+        wrmsr
+
+        pop     ecx
+        pop     edx
+        pop     eax
+        ret
+ENDPROC   bs2ExitModeCleanupLm_rm
+%endif
+
+
+
+;
+; Thunking routines for switching between 16/32/64-bit code.
+;
+
+
+%ifdef BS2_INC_CMN_PM
+;;
+; Switches from 32-bit to 16-bit mode ({eip,esp,ebp} < 64KB).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 16-bit selectors.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 32
+BEGINPROC Bs2Thunk_p32_p16
+        push    eax
+        pushf
+        cli
+        mov     ax, BS2_SEL_SS16
+        jmp far BS2_SEL_CS16:.code16_start
+BITS 16
+.code16_start:
+        mov     ss, ax
+        mov     ax, BS2_SEL_DS16
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+
+        ; Fix the return address and then return.
+        mov     ax, [esp + 08h]
+        mov     [esp + 0ah], ax
+        popfd
+        pop     eax
+        add     sp, 2h
+        ret
+ENDPROC   Bs2Thunk_p32_p16
+ %define Bs2Thunk_p32_pe16  Bs2Thunk_p32_p16 ; Alternative name for TMPL_NM
+ %define Bs2Thunk_p32_pp16  Bs2Thunk_p32_p16 ; Alternative name for TMPL_NM
+ %define Bs2Thunk_p32_pae16 Bs2Thunk_p32_p16 ; Alternative name for TMPL_NM
+%endif ; BS2_INC_CMN_PM
+
+
+%ifdef BS2_INC_CMN_PM
+;;
+; Switches from 16-bit to 32-bit mode (cs = CS16, ds = DS16).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 32-bit selectors.
+;           ebp and esp converted to 32bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2Thunk_p16_p32
+        push    word 0
+        push    eax
+        pushfd
+        cli
+        jmp far BS2_SEL_CS32:.code32_start
+BITS 32
+.code32_start:
+        mov     eax, BS2_SEL_SS32
+        mov     ss, ax
+        mov     ax, BS2_SEL_DS32
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+        and     ebp, 0ffffh
+        and     esp, 0ffffh
+
+        ; Fix the return address and then return.
+        movzx   eax, word [esp + 0ah]
+        mov     [esp + 08h], eax
+        popfd
+        pop     eax
+        ret
+ENDPROC   Bs2Thunk_p16_p32
+ %define Bs2Thunk_p16_pe32  Bs2Thunk_p16_p32 ; Alternative name for TMPL_NM
+ %define Bs2Thunk_p16_pp32  Bs2Thunk_p16_p32 ; Alternative name for TMPL_NM
+ %define Bs2Thunk_p16_pae32 Bs2Thunk_p16_p32 ; Alternative name for TMPL_NM
+%endif ; BS2_INC_CMN_PM
+
+
+%ifdef BS2_INC_CMN_LM
+;;
+; Switches from 64-bit to 16-bit mode ({rip,rsp,rbp} < 64KB).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 16-bit selectors.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 64
+BEGINPROC Bs2Thunk_lm64_lm16
+        push    rax
+        pushf
+        cli
+        mov     ax, BS2_SEL_SS16
+        push    BS2_SEL_CS16
+        push    .code16_start
+        retf
+BITS 16
+.code16_start:
+        mov     ss, ax
+        mov     ax, BS2_SEL_DS16
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+
+        ; Fix the return address and then return.
+        mov     ax, [esp + 10h]
+        mov     [esp + 16h], ax
+        popfd
+        add     sp, 4h
+        pop     eax
+        add     sp, 4h + 6h
+        ret
+ENDPROC   Bs2Thunk_lm64_lm16
+ %define Bs2Thunk_p64_lm16 Bs2Thunk_lm64_lm16 ; Alternative name for TMPL_NM
+%endif ; BS2_INC_CMN_LM
+
+
+%ifdef BS2_INC_LM16
+;;
+; Switches from 16-bit to 64-bit mode (cs = CS16, ss = SS16).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 64-bit selectors.
+;           rbp and rsp converted to 16/32/64-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2Thunk_lm16_lm64
+        push    word 0
+        push    dword 0
+        push    dword 0
+        push    eax
+        push    dword 0
+        pushfd
+        cli
+        mov     eax, BS2_SEL_SS64
+        jmp far BS2_SEL_CS64:.code64_start
+BITS 64
+.code64_start:
+        mov     ss, ax
+        mov     ax, BS2_SEL_DS64
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+
+        and     ebp, 0ffffh
+        and     esp, 0ffffh
+        and     edi, 0ffffffffh
+        and     esi, 0ffffffffh
+        and     ebx, 0ffffffffh
+
+        ; Fix the return address and then return.
+        movzx   rax, word [rsp + 16h]
+        mov     [rsp + 10h], rax
+        popf
+        pop     rax
+        ret
+ENDPROC   Bs2Thunk_lm16_lm64
+ %define Bs2Thunk_p16_lm64 Bs2Thunk_lm16_lm64 ; Alternative name for TMPL_NM
+%endif ; BS2_INC_LM16
+
+
+%ifdef BS2_INC_LM32
+;;
+; Switches from 64-bit to 32-bit mode ({rip,rsp,rbp} < 4GB).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 32-bit selectors.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODEHIGH
+BITS 64
+BEGINPROC Bs2Thunk_lm64_lm32
+        push    rax
+        pushf
+        cli
+        mov     ax, BS2_SEL_SS32
+        push    BS2_SEL_CS32
+        push    .code32_start
+        retf
+BITS 32
+.code32_start:
+        mov     ss, ax
+        mov     ax, BS2_SEL_DS32
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+
+        ; Fix the return address and then return.
+        mov     eax, [esp + 10h]
+        mov     [esp + 14h], eax
+        popfd
+        mov     eax, [esp + 4h]
+        lea     esp, [esp + 10h]
+        ret
+ENDPROC   Bs2Thunk_lm64_lm32
+ %define Bs2Thunk_p64_lm32 Bs2Thunk_lm64_lm32 ; Alternative name for TMPL_NM
+%endif ; BS2_INC_LM32
+
+
+%ifdef BS2_INC_LM32
+;;
+; Switches from 32-bit to 64-bit mode (cs = CS32, ss = SS32).
+;
+; @returns  cs,ds,ss,es,gs,fs loaded with 64-bit selectors.
+;           rbp and rsp converted to 32/64-bit.
+;           All other registers are preserved.
+; @uses     nothing
+;
+BEGINCODEHIGH
+BITS 32
+BEGINPROC Bs2Thunk_lm32_lm64
+        push    dword 0
+        push    dword 0
+        push    eax
+        push    dword 0
+        pushfd
+        cli
+        mov     eax, BS2_SEL_SS64
+        jmp far BS2_SEL_CS64:.code64_start
+BITS 64
+.code64_start:
+        mov     ss, ax
+        mov     ax, BS2_SEL_DS64
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+
+        and     ebp, 0ffffffffh
+        and     esp, 0ffffffffh
+        and     edi, 0ffffffffh
+        and     esi, 0ffffffffh
+        and     ebx, 0ffffffffh
+
+        ; Fix the return address and then return.
+        mov     eax, [rsp + 14h]
+        mov     [rsp + 10h], rax
+        popf
+        pop     rax
+        ret
+ENDPROC   Bs2Thunk_lm32_lm64
+ %define Bs2Thunk_p32_lm64 Bs2Thunk_lm32_lm64 ; Alternative name for TMPL_NM
+%endif ; BS2_INC_LM32
+
+
+
+
+;
+; Routines for checking if mode is supported or not.
+;
+; @returns al=1 & ZF=0 if supported, al=0 & ZF=1 if not.
+; @uses    nothing.
+;
+
+; These are easy.
+BEGINCODELOW
+BITS 16
+BEGINPROC bs2IsModeSupportedYes_rm
+GLOBALNAME Bs2IsModeSupported_rm_rm
+GLOBALNAME Bs2IsModeSupported_rm_pe16
+GLOBALNAME Bs2IsModeSupported_rm_pe32
+GLOBALNAME Bs2IsModeSupported_rm_pev86
+GLOBALNAME Bs2IsModeSupported_rm_pp16
+GLOBALNAME Bs2IsModeSupported_rm_pp32
+GLOBALNAME Bs2IsModeSupported_rm_ppv86
+        mov     al, 1
+        test    al, al
+        ret
+ENDPROC   bs2IsModeSupportedYes_rm
+
+
+%ifdef BS2_INC_CMN_PAE
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2IsPaeSupported_16
+GLOBALNAME Bs2IsModeSupported_rm_pae16
+GLOBALNAME Bs2IsModeSupported_rm_pae32
+GLOBALNAME Bs2IsModeSupported_rm_paev86
+        push    eax
+        push    ebx
+        push    ecx
+        push    edx
+
+        mov     eax, 0
+        cpuid
+        cmp     eax, 1
+        jb      .no
+        cmp     eax, 1000h
+        ja      .no
+
+        mov     eax, 1
+        cpuid
+        test    edx, X86_CPUID_FEATURE_EDX_PAE
+
+        pop     edx
+        pop     ecx
+        pop     ebx
+        pop     eax
+
+        mov     al, 0
+        jz      .no
+        mov     al, 1
+.no:
+        ret
+ENDPROC   Bs2IsPaeSupported_16
+%endif ; BS2_INC_CMN_PAE
+
+
+%ifdef BS2_INC_CMN_LM
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2IsLongModeSupported_16
+GLOBALNAME Bs2IsModeSupported_rm_lm16
+GLOBALNAME Bs2IsModeSupported_rm_lm32
+GLOBALNAME Bs2IsModeSupported_rm_lm64
+        push    eax
+        push    ebx
+        push    ecx
+        push    edx
+
+        mov     eax, 080000000h
+        cpuid
+        cmp     eax, 080000001h
+        jb      .no
+        cmp     eax, 080001000h
+        ja      .no
+
+        mov     eax, 080000001h
+        cpuid
+        test    edx, X86_CPUID_EXT_FEATURE_EDX_LONG_MODE
+
+        pop     edx
+        pop     ecx
+        pop     ebx
+        pop     eax
+
+        mov     al, 0
+        jz      .no
+        mov     al, 1
+.no:
+        ret
+ENDPROC   Bs2IsLongModeSupported_16
+%endif ; BS2_INC_CMN_LM
+
+
+;
+; Include addition init/base code.
+;
+%ifdef BS2_WITH_TRAPS
+ %include "bootsector2-common-init-traps.mac"
+%endif
+
+
+;
+; Include common code.
+;
+%ifndef BS2_NOINC_COMMON
+ %include "bootsector2-common-routines.mac"
+%endif
+
+;
+; Include trap records if requested.
+;
+%ifdef BS2_WITH_TRAPRECS
+ %include "bootsector2-common-traprec.mac"
+%endif
+
+;
+; Map stuff for the initial environment.
+;
+%ifdef BS2_INIT_RM
+ %define TMPL_RM
+%endif
+%ifdef BS2_INIT_PE32
+ %define TMPL_PE32
+%endif
+%ifdef BS2_INIT_PP32
+ %define TMPL_PP32
+%endif
+%ifdef BS2_INIT_PAE32
+ %define TMPL_PAE32
+%endif
+%ifdef BS2_INIT_LM64
+ %define TMPL_LM64
+%endif
+%include "bootsector2-template-header.mac"
+
+
+;
+; Where we jump after initialization.
+;
+TMPL_BEGINCODE
+BITS TMPL_BITS
+bs2DoneInit:
+%ifdef BS2_INIT_SAVE_REGS
+        mov     eax, cr2
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.cr2], eax
+        mov     eax, cr3
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.cr3], eax
+        mov     eax, cr4
+        mov     [BS2_REG_SAVE_ADDR + BS2REGS.cr4], eax
+        mov     byte [BS2_REG_SAVE_ADDR + BS2REGS.cBits], 16
+        xor     eax, eax
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.cs], ax
+        mov     ax, start
+        mov     [cs:BS2_REG_SAVE_ADDR + BS2REGS.rip], eax
+%endif
+
+%ifdef BS2_WITH_TRAPRECS
+        ;
+        ; Install the trap records.
+        ;
+        BS2_TRAP_RECS_INSTALL
+%endif
+
+        ;
+        ; Detect the CPU.
+        ;
+        xor     eax, eax
+        mov     [g_fCpuIntel], al
+        mov     [g_fCpuAmd],   al
+        cpuid
+        cmp     ecx, 0x444d4163
+        jne     .not_amd
+        cmp     edx, 0x69746e65
+        jne     .not_amd
+        cmp     ebx, 0x68747541
+        jne     .not_amd
+        mov     byte [g_fCpuAmd], 1
+        jmp     .not_intel
+
+.not_amd:
+        cmp     ecx, 0x6c65746e
+        jne     .not_intel
+        cmp     edx, 0x49656e69
+        jne     .not_intel
+        cmp     ebx, 0x756e6547
+        jne     .not_intel
+        mov     byte [g_fCpuIntel], 1
+.not_intel:
+
+        ;
+        ; Call the user 'main' procedure (shouldn't return).
+        ;
+        call    main
+.panic_again
+        call    Bs2Panic
+        jmp     .panic_again
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-init-traps.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-init-traps.mac
new file mode 100644
index 0000000..beef716
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-init-traps.mac
@@ -0,0 +1,1605 @@
+; $Id: bootsector2-common-init-traps.mac $
+;; @file
+; Common bootsector code init, traps.
+;
+; This is included from bootsector2-common-init-code.mac and was split out of
+; that file to keep the size manageable.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%ifndef BS2_WITH_TRAPS
+ %error "huh? BS2_WITH_TRAPS is not defined!"
+%endif
+
+
+;*******************************************************************************
+;*      Header Files                                                           *
+;*******************************************************************************
+%include "bootsector2-structures.mac"
+%include "bootsector2-api.mac"
+
+
+;*******************************************************************************
+;*      Global Variables                                                       *
+;*******************************************************************************
+BEGINCODELOW
+ALIGNDATA(8)
+;; Where to resume execution after a trap (if g_fTrapPrepared is set).
+; @internal
+g_TrapResumeRIP:
+        dq      0
+;; Set if we've prepared for a trap.
+; @internal
+g_fTrapPrepared:
+        db      0
+;; Benchmark indicator.
+; This is set to the expected trap number when we're benchmarking and 0ffh when
+; we aren't benchmarking.
+; @internal
+g_u8TrapBenchmarkNo:
+        db      0ffh
+        db      0                       ; alignment padding.
+;; The last trap number.
+GLOBALNAME g_u8LastTrapNo
+        db      0
+;; The number of traps since last call to Bs2TrapReset.
+GLOBALNAME g_u32cTraps
+        dd      0
+;; The last trap error code.
+GLOBALNAME g_u64LastTrapErr
+        dq      0
+;; The register frame of the last trap (BS2REGS).
+GLOBALNAME g_LastTrapRegs
+        times (BS2REGS_size) db 0
+
+;; The RFLAGS/EFLAGS inside last invoked trap handler.
+GLOBALNAME g_u64LastTrapHandlerRFlags
+        dq      0
+;; The CS inside last invoked trap handler.
+GLOBALNAME g_u16LastTrapHandlerCS
+        dw      0
+;; The SS inside last invoked trap handler.
+GLOBALNAME g_u16LastTrapHandlerSS
+        dw      0
+        dw  0,0 ; alignment
+;; The RSP inside the last invoked trap handler, i.e. when bs2Trap_XX_32bit is
+; entered, so including fake error code and vector number.
+GLOBALNAME g_u64LastTrapHandlerRSP
+        dq      0
+
+;;
+; Pointer to an array of BS2TRAPREC1 records.
+GLOBALNAME g_paTrapRecs
+        dq      0
+;; Number of entries in the array g_paTrapRecs points to.
+GLOBALNAME g_cTrapRecs
+        dd      0
+;; The index of the last BS2TRAPREC1 we hit.
+GLOBALNAME g_iTrapRecLast
+        dd      0
+;; The base address the BS2TRAPREC.offWhere values are relative to.
+GLOBALNAME g_pTrapRecBase
+        dq      0
+
+
+;;
+; Reset all the trap globals to default.
+;
+; This undos the effect of any previous Bs2TrapPrepare call.
+;
+; @uses     nothing.
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2TrapReset_rm16
+        push    xBP
+        mov     xBP, xSP
+        push    ds
+        push    word 0
+        pop     ds
+
+        mov     dword [g_u32cTraps],          0
+        mov     byte  [g_u8LastTrapNo],       0ffh
+        mov     dword [g_u64LastTrapErr],     0
+        mov     dword [g_u64LastTrapErr + 4], 0
+        mov     dword [g_TrapResumeRIP],      0
+        mov     dword [g_TrapResumeRIP + 4],  0
+        mov     byte  [g_u8TrapBenchmarkNo],  0ffh
+        mov     byte  [g_fTrapPrepared],      0
+
+        pop     ds
+        leave
+        ret
+ENDPROC   Bs2TrapReset_rm16
+
+
+;;
+; Reset all the trap globals to default.
+;
+; This undos the effect of any previous Bs2TrapPrepare call.
+;
+; @uses     nothing.
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2TrapReset_p16
+        push    ds
+        push    BS2_SEL_DS16
+        pop     ds
+
+        mov     dword [g_u32cTraps],          0
+        mov     byte  [g_u8LastTrapNo],       0ffh
+        mov     dword [g_u64LastTrapErr],     0
+        mov     dword [g_u64LastTrapErr + 4], 0
+        mov     dword [g_TrapResumeRIP],      0
+        mov     dword [g_TrapResumeRIP + 4],  0
+        mov     byte  [g_u8TrapBenchmarkNo],  0ffh
+        mov     byte  [g_fTrapPrepared],      0
+
+        pop     ds
+        ret
+ENDPROC   Bs2TrapReset_p16
+
+
+
+;;
+; Reset all the trap globals to default.
+;
+; This undos the effect of any previous Bs2TrapPrepare call.
+;
+; @uses     nothing.
+;
+BEGINCODEHIGH
+BITS 32
+BEGINPROC Bs2TrapReset_p32
+        push    ds
+        push    BS2_SEL_DS32
+        pop     ds
+
+        mov     dword [g_u32cTraps],          0
+        mov     byte  [g_u8LastTrapNo],       0ffh
+        mov     dword [g_u64LastTrapErr],     0
+        mov     dword [g_u64LastTrapErr + 4], 0
+        mov     dword [g_TrapResumeRIP],      0
+        mov     dword [g_TrapResumeRIP + 4],  0
+        mov     byte  [g_u8TrapBenchmarkNo],  0ffh
+        mov     byte  [g_fTrapPrepared],      0
+
+        pop     ds
+        ret
+ENDPROC   Bs2TrapReset_p32
+
+
+;;
+; Reset all the trap globals to default.
+;
+; This undos the effect of any previous Bs2TrapPrepare call.
+;
+; @uses     nothing.
+;
+BEGINCODEHIGH
+BITS 64
+BEGINPROC Bs2TrapReset_p64
+        mov     dword [g_u32cTraps],          0
+        mov     byte  [g_u8LastTrapNo],       0ffh
+        mov     qword [g_u64LastTrapErr],     0
+        mov     qword [g_TrapResumeRIP],      0
+        mov     byte  [g_u8TrapBenchmarkNo],  0ffh
+        mov     byte  [g_fTrapPrepared],      0
+        ret
+ENDPROC   Bs2TrapReset_p64
+
+
+
+;;
+; Prepare for a test that will trap.
+;
+; @param    xAX         Where to resume after the trap.
+; @param    dl          Set to 0ffh for tests and the expected trap number when
+;                       preparing a benchmark.
+; @uses     nothing.
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2TrapPrepare_rm16
+        push    xBP
+        mov     xBP, xSP
+        push    ds
+        push    word 0
+        pop     ds
+
+        mov     dword [g_u32cTraps],          0
+        mov     byte  [g_u8LastTrapNo],       0ffh
+        mov     dword [g_u64LastTrapErr],     0
+        mov     dword [g_u64LastTrapErr + 4], 0
+        mov     word [g_TrapResumeRIP],       ax
+        mov     word  [g_TrapResumeRIP + 2],  0
+        mov     dword [g_TrapResumeRIP + 4],  0
+        mov     byte  [g_u8TrapBenchmarkNo],  dl
+        mov     byte  [g_fTrapPrepared],      1
+
+        pop     ds
+        leave
+        ret
+ENDPROC   Bs2TrapPrepare_rm16
+
+
+;;
+; Prepare for a test that will trap.
+;
+; @param    ax          Where to resume after the trap.
+; @param    dl          Set to 0ffh for tests and the expected trap number when
+;                       preparing a benchmark.
+; @uses     nothing.
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC Bs2TrapPrepare_p16
+        push    ds
+        push    BS2_SEL_DS16
+        pop     ds
+
+        mov     dword [g_u32cTraps],          0
+        mov     byte  [g_u8LastTrapNo],       0ffh
+        mov     dword [g_u64LastTrapErr],     0
+        mov     dword [g_u64LastTrapErr + 4], 0
+        mov     word [g_TrapResumeRIP],       ax
+        mov     word  [g_TrapResumeRIP + 2],  0
+        mov     dword [g_TrapResumeRIP + 4],  0
+        mov     byte  [g_u8TrapBenchmarkNo],  dl
+        mov     byte  [g_fTrapPrepared],      1
+
+        pop     ds
+        ret
+ENDPROC   Bs2TrapPrepare_p16
+
+
+;;
+; Prepare for a test that will trap.
+;
+; @param    eax         Where to resume after the trap.
+; @param    dl          Set to 0ffh for tests and the expected trap number when
+;                       preparing a benchmark.
+; @uses     nothing.
+;
+BEGINCODEHIGH
+BITS 32
+BEGINPROC Bs2TrapPrepare_p32
+        push    ds
+        push    BS2_SEL_DS32
+        pop     ds
+
+        mov     dword [g_u32cTraps],          0
+        mov     byte  [g_u8LastTrapNo],       0ffh
+        mov     dword [g_u64LastTrapErr],     0
+        mov     dword [g_u64LastTrapErr + 4], 0
+        mov     dword [g_TrapResumeRIP],      eax
+        mov     dword [g_TrapResumeRIP + 4],  0
+        mov     byte  [g_u8TrapBenchmarkNo],  dl
+        mov     byte  [g_fTrapPrepared],      1
+
+        pop     ds
+        ret
+ENDPROC   Bs2TrapPrepare_p32
+
+
+;;
+; Prepare for a test that will trap.
+;
+; @param    rax         Where to resume after the trap.
+; @param    dl          Set to 0ffh for tests and the expected trap number when
+;                       preparing a benchmark.
+; @uses     nothing.
+;
+BEGINCODEHIGH
+BITS 64
+BEGINPROC Bs2TrapPrepare_p64
+        mov     dword [g_u32cTraps],          0
+        mov     byte  [g_u8LastTrapNo],       0ffh
+        mov     qword [g_u64LastTrapErr],     0
+        mov     qword [g_TrapResumeRIP],      rax
+        mov     byte  [g_u8TrapBenchmarkNo],  dl
+        mov     byte  [g_fTrapPrepared],      1
+        ret
+ENDPROC   Bs2TrapPrepare_p64
+
+
+BEGINCODELOW ; The TSSes, IDTs and handlers must be 16-bit addressable.
+
+%ifdef BS2_INC_CMN_PM
+;
+; 32-bit TSS (X86TSS32).
+;
+ALIGNDATA(16)
+bs2Tss32Bit:
+        dw      07fffh                  ; selPrev - Back link to previous task. (static)
+        dw      0h                      ; padding1;
+        dd      BS2_R0_STACK_ADDR       ; esp0    - Ring-0 stack pointer. (static)
+        dw      BS2_SEL_SS32            ; ss0
+        dw      0                       ; padding
+        dd      BS2_R1_STACK_ADDR       ; esp1    - Ring-1 stack pointer. (static)
+        dw      0                       ; ss1
+        dw      0                       ; padding
+        dd      BS2_R2_STACK_ADDR       ; esp2    - Ring-1 stack pointer. (static)
+        dw      0                       ; ss2
+        dw      0                       ; padding
+        dd      0ffffffffh              ; cr3     - Page directory for the task. (static)
+        dd      0                       ; eip     - EIP before task switch.
+        dd      0                       ; eflags  - EFLAGS before task switch.
+        dd      0                       ; eax     - EAX before task switch.
+        dd      0                       ; ecx     - ECX before task switch.
+        dd      0                       ; edx     - EDX before task switch.
+        dd      0                       ; ebx     - EBX before task switch.
+        dd      0                       ; esp     - ESP before task switch.
+        dd      0                       ; ebp     - EBP before task switch.
+        dd      0                       ; esi     - ESI before task switch.
+        dd      0                       ; edi     - EDI before task switch.
+        dw      0, 0                    ; es,pad  - ES before task switch.
+        dw      0, 0                    ; cs,pad  - CS before task switch.
+        dw      0, 0                    ; ss,pad  - SS before task switch.
+        dw      0, 0                    ; ds,pad  - DS before task switch.
+        dw      0, 0                    ; fs,pad  - FS before task switch.
+        dw      0, 0                    ; gs,pad  - GS before task switch.
+        dw      0, 0                    ; ldt,pad - LDTR before task switch.
+        dw      0                       ; fDebugTrap - Debug trap flag.
+        dw      7fffh                   ; offIoBitmap - Offset relative to the TSS of the
+                                        ; start of the I/O Bitmap and the end of the
+                                        ; interrupt redirection bitmap.
+        ; IntRedirBitmap - 32 bytes for the virtual interrupt redirection bitmap. (VME)
+bs2Tss32BitEnd:
+times (68h - (bs2Tss32BitEnd - bs2Tss32Bit)) db 0
+times ((bs2Tss32BitEnd - bs2Tss32Bit) - 68h) db 0
+
+
+;
+; 32-bit TSS for #DF (X86TSS32).
+;
+ALIGNDATA(16)
+bs2Tss32BitDf:
+        dw      07fffh                  ; selPrev - Back link to previous task. (static)
+        dw      0h                      ; padding1;
+        dd      BS2_DF_R0_STACK_ADDR    ; esp0    - Ring-0 stack pointer. (static)
+        dw      BS2_SEL_SS32            ; ss0
+        dw      0                       ; padding
+        dd      0                       ; esp1    - Ring-1 stack pointer. (static)
+        dw      0                       ; ss1
+        dw      0                       ; padding
+        dd      0                       ; esp2    - Ring-1 stack pointer. (static)
+        dw      0                       ; ss2
+        dw      0                       ; padding
+        dd      0ffffffffh              ; cr3     - Page directory for the task. (static)
+        dd      bs2Trap_08h_32bit       ; eip    - EIP before task switch. */
+        dd      0                       ; eflags - EFLAGS before task switch. */
+        dd      0                       ; eax    - EAX before task switch. */
+        dd      0                       ; ecx    - ECX before task switch. */
+        dd      0                       ; edx    - EDX before task switch. */
+        dd      0                       ; ebx    - EBX before task switch. */
+        dd      BS2_DF_R0_STACK_ADDR    ; esp    - ESP before task switch. */
+        dd      0                       ; ebp    - EBP before task switch. */
+        dd      0                       ; esi    - ESI before task switch. */
+        dd      0                       ; edi    - EDI before task switch. */
+        dw      BS2_SEL_DS32, 0         ; es,pad - ES before task switch. */
+        dw      BS2_SEL_CS32, 0         ; cs,pad - CS before task switch. */
+        dw      BS2_SEL_SS32, 0         ; ss,pad - SS before task switch. */
+        dw      BS2_SEL_DS32, 0         ; ds,pad - DS before task switch. */
+        dw      BS2_SEL_DS32, 0         ; fs,pad - FS before task switch. */
+        dw      BS2_SEL_DS32, 0         ; gs,pad - GS before task switch. */
+        dw      0, 0                    ; ldt,pad- LDTR before task switch. */
+        dw      0                       ; fDebugTrap - Debug trap flag.
+        dw      7fffh                   ; offIoBitmap - Offset relative to the TSS of the
+                                        ; start of the I/O Bitmap and the end of the
+                                        ; interrupt redirection bitmap.
+        ; IntRedirBitmap - 32 bytes for the virtual interrupt redirection bitmap. (VME)
+bs2Tss32BitDfEnd:
+times (68h - (bs2Tss32BitDfEnd - bs2Tss32BitDf)) db 0
+times ((bs2Tss32BitDfEnd - bs2Tss32BitDf) - 68h) db 0
+
+
+;
+; 32-bit IDT (X86DESCGATE).
+;
+ALIGNDATA(16)
+bs2Idt32bit:
+        dw bs2Trap_00h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_01h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_02h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+bs2Idt32bit_BP:
+        dw bs2Trap_03h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_04h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_05h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_06h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_07h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw             0, BS2_SEL_TSS32_DF, 08500h, 00000h ; p=1 dpl=0 type=taskgate
+        dw bs2Trap_09h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_0ah_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_0bh_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_0ch_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_0dh_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_0eh_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_0fh_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_10h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_11h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_12h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_13h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_14h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_15h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_16h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_17h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_18h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_19h_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_1ah_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_1bh_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_1ch_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_1dh_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_1eh_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2Trap_1fh_32bit, BS2_SEL_CS32, 08e00h, 00000h ; p=1 dpl=0 type=int32gate
+        dw bs2TrapService32bit,BS2_SEL_CS32,0ee00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=3 type=int32gate
+%define BS2_TRAP_SERVICE_NO     30h
+;; @todo
+bs2Idt32bitEnd
+
+;
+; 32-bit trap handlers.
+;
+BITS 32
+%macro bs2Trap_XX_32bit_macro 1
+bs2Trap_ %+ %1 %+ _32bit:
+        push    %1
+        jmp     bs2Trap_XX_32bit
+%endmacro
+%macro bs2Trap_XX_32bit_macro_no_err 1
+bs2Trap_ %+ %1 %+ _32bit:
+        push    0
+        push    %1
+        jmp     bs2Trap_XX_32bit
+%endmacro
+        bs2Trap_XX_32bit_macro_no_err 00h
+        bs2Trap_XX_32bit_macro_no_err 01h
+        bs2Trap_XX_32bit_macro_no_err 02h
+        bs2Trap_XX_32bit_macro_no_err 03h
+        bs2Trap_XX_32bit_macro_no_err 04h
+        bs2Trap_XX_32bit_macro_no_err 05h
+        bs2Trap_XX_32bit_macro_no_err 06h
+        bs2Trap_XX_32bit_macro_no_err 07h
+        bs2Trap_XX_32bit_macro        08h
+        bs2Trap_XX_32bit_macro_no_err 09h
+        bs2Trap_XX_32bit_macro        0ah
+        bs2Trap_XX_32bit_macro        0bh
+        bs2Trap_XX_32bit_macro        0ch
+        bs2Trap_XX_32bit_macro        0dh
+        bs2Trap_XX_32bit_macro        0eh
+        bs2Trap_XX_32bit_macro_no_err 0fh
+        bs2Trap_XX_32bit_macro_no_err 10h
+        bs2Trap_XX_32bit_macro        11h
+        bs2Trap_XX_32bit_macro_no_err 12h
+        bs2Trap_XX_32bit_macro_no_err 13h
+        bs2Trap_XX_32bit_macro_no_err 14h
+        bs2Trap_XX_32bit_macro_no_err 15h
+        bs2Trap_XX_32bit_macro_no_err 16h
+        bs2Trap_XX_32bit_macro_no_err 17h
+        bs2Trap_XX_32bit_macro_no_err 18h
+        bs2Trap_XX_32bit_macro_no_err 19h
+        bs2Trap_XX_32bit_macro_no_err 1ah
+        bs2Trap_XX_32bit_macro_no_err 1bh
+        bs2Trap_XX_32bit_macro_no_err 1ch
+        bs2Trap_XX_32bit_macro_no_err 1dh
+        bs2Trap_XX_32bit_macro_no_err 1eh
+        bs2Trap_XX_32bit_macro_no_err 1fh
+
+;;
+; Common 32-bit trap handler.
+;
+;       return GS                         ebp + 2ch - v86
+;       return FS                         ebp + 28h - v86
+;       return DS                         ebp + 24h - v86
+;       return ES                         ebp + 20h - v86
+;       return SS                         ebp + 1ch - higher privilege
+;       return ESP                        ebp + 18h - higher privilege
+;       return EFLAGS                     ebp + 14h
+;       return CS                         ebp + 10h
+;       return EIP                        ebp + 0ch
+;       error code                        ebp + 08h
+;       vector #                          ebp + 04h
+BITS 32
+BEGINCODEHIGH
+BEGINPROC bs2Trap_XX_32bit
+        push    ebp                     ; ebp + 00h
+        mov     ebp, esp
+        pushfd                          ; ebp - 04h
+        push    eax                     ; ebp - 08h
+        push    ebx                     ; ebp - 0ch
+        push    ecx                     ; ebp - 10h
+        push    ds                      ; ebp - 14h
+
+        mov     eax, ss                 ; load flat DS. Using SS here because of conforming IDTE.CS tests.
+        mov     ds, ax
+
+        ;
+        ; Benchmark mode? Then resume the action right away!
+        ;
+        mov     eax, [ebp + 04h]
+        cmp     [g_u8TrapBenchmarkNo], al
+        jne     .test_mode
+        cmp     byte [g_fTrapPrepared], 0
+        je      .test_mode
+        mov     eax, [g_TrapResumeRIP]
+        mov     [ebp + 0ch], eax
+
+        pop     ds
+        pop     ecx
+        pop     ebx
+        ;pop     eax
+        ;popfd
+        leave
+        add     esp, 08h                ; Skip the vector # and  error code.
+        xor     eax, eax
+        iret
+
+
+        ;
+        ; Update the globals.
+        ;
+.test_mode:
+        xor     ecx, ecx                ; zero register
+        inc     dword [g_u32cTraps]
+        mov     eax, [ebp + 04h]
+        mov     [g_u8LastTrapNo], al
+        mov     eax, [ebp + 08h]
+        mov     [g_u64LastTrapErr],     eax
+        mov     [g_u64LastTrapErr + 4], ecx
+        mov     eax, [ebp - 04h]
+        mov     [g_u64LastTrapHandlerRFlags], eax
+        mov     dword [g_u64LastTrapHandlerRFlags + 4], ecx
+        mov     ax, cs
+        mov     [g_u16LastTrapHandlerCS], ax
+        mov     ax, ss
+        mov     [g_u16LastTrapHandlerSS], ax
+        lea     eax, [ebp + 4]
+        mov     [g_u64LastTrapHandlerRSP], eax
+        mov     [g_u64LastTrapHandlerRSP + 4], ecx
+
+        ;
+        ; Save the registers.
+        ;
+        lea     ebx, [g_LastTrapRegs]
+        mov     eax, [ebp - 08h]
+        mov     [ebx + BS2REGS.rax],     eax
+        mov     [ebx + BS2REGS.rax + 4], ecx
+        mov     eax, [ebp - 0ch]
+        mov     [ebx + BS2REGS.rbx],     eax
+        mov     [ebx + BS2REGS.rbx + 4], ecx
+        mov     eax, [ebp - 10h]
+        mov     [ebx + BS2REGS.rcx],     eax
+        mov     [ebx + BS2REGS.rcx + 4], ecx
+        mov     [ebx + BS2REGS.rdx],     edx
+        mov     [ebx + BS2REGS.rdx + 4], ecx
+        mov     [ebx + BS2REGS.rdi],     edi
+        mov     [ebx + BS2REGS.rdi + 4], ecx
+        mov     [ebx + BS2REGS.rsi],     esi
+        mov     [ebx + BS2REGS.rsi + 4], ecx
+        mov     eax, [ebp]
+        mov     [ebx + BS2REGS.rbp],     eax
+        mov     [ebx + BS2REGS.rbp + 4], ecx
+        mov     eax, [ebp + 0ch]
+        mov     [ebx + BS2REGS.rip],     eax
+        mov     [ebx + BS2REGS.rip + 4], ecx
+        mov     [ebx + BS2REGS.r8],      ecx
+        mov     [ebx + BS2REGS.r8  + 4], ecx
+        mov     [ebx + BS2REGS.r9],      ecx
+        mov     [ebx + BS2REGS.r9  + 4], ecx
+        mov     [ebx + BS2REGS.r10],     ecx
+        mov     [ebx + BS2REGS.r10 + 4], ecx
+        mov     [ebx + BS2REGS.r11],     ecx
+        mov     [ebx + BS2REGS.r11 + 4], ecx
+        mov     [ebx + BS2REGS.r12],     ecx
+        mov     [ebx + BS2REGS.r12 + 4], ecx
+        mov     [ebx + BS2REGS.r13],     ecx
+        mov     [ebx + BS2REGS.r13 + 4], ecx
+        mov     [ebx + BS2REGS.r14],     ecx
+        mov     [ebx + BS2REGS.r14 + 4], ecx
+        mov     [ebx + BS2REGS.r15],     ecx
+        mov     [ebx + BS2REGS.r15 + 4], ecx
+        mov     eax, [ebp + 14h]
+        mov     [ebx + BS2REGS.rflags],  eax
+        mov     [ebx + BS2REGS.rflags+4],ecx
+        mov     eax, [ebp + 10h]
+        mov     [ebx + BS2REGS.cs],      ax
+        mov     [ebx + BS2REGS.cBits], byte 32
+
+        ; Part of the stack varies depending on the trap context.
+        test    dword [ebx + BS2REGS.rflags], X86_EFL_VM
+        jnz     .v86
+        test    ax, 7h
+        jz      .ring0
+
+.ring0:
+        lea     eax, [ebp + 18h]
+        mov     [ebx + BS2REGS.rsp],     eax
+        mov     [ebx + BS2REGS.rsp + 4], ecx
+        mov     [ebx + BS2REGS.ss], ss
+        mov     eax, [ebp - 14h]
+        mov     [ebx + BS2REGS.ds], ax
+        mov     [ebx + BS2REGS.es], es
+        mov     [ebx + BS2REGS.fs], fs
+        mov     [ebx + BS2REGS.gs], gs
+        jmp     .do_crX
+
+.higher_privilege:
+        mov     eax, [ebp + 18h]
+        mov     [ebx + BS2REGS.rsp],     eax
+        mov     [ebx + BS2REGS.rsp + 4], ecx
+        mov     eax, [ebp + 20h]
+        mov     [ebx + BS2REGS.ss], ax
+        mov     eax, [ebp - 14h]
+        mov     [ebx + BS2REGS.ds], ax
+        mov     [ebx + BS2REGS.es], es
+        mov     [ebx + BS2REGS.fs], fs
+        mov     [ebx + BS2REGS.gs], gs
+        jmp     .do_crX
+
+.v86:
+        mov     eax, [ebp + 18h]
+        mov     [ebx + BS2REGS.rsp],     eax
+        mov     [ebx + BS2REGS.rsp + 4], ecx
+        mov     eax, [ebp + 1ch]
+        mov     [ebx + BS2REGS.ss], ax
+        mov     eax, [ebp + 24h]
+        mov     [ebx + BS2REGS.ds], ax
+        mov     eax, [ebp + 20h]
+        mov     [ebx + BS2REGS.es], ax
+        mov     eax, [ebp + 28h]
+        mov     [ebx + BS2REGS.fs], ax
+        mov     eax, [ebp + 2ch]
+        mov     [ebx + BS2REGS.gs], ax
+        ;jmp     .do_crX
+
+.do_crX:
+        ; The CRx registers are only accessible from ring-0 (CS=conforming, CPL < 0)
+        test    byte [ebx + BS2REGS.ss], 3
+        jnz     .skip_crX
+        mov     eax, cr0
+        mov     [ebx + BS2REGS.cr0],     eax
+        mov     [ebx + BS2REGS.cr0 + 4], ecx
+        mov     eax, cr2
+        mov     [ebx + BS2REGS.cr2],     eax
+        mov     [ebx + BS2REGS.cr2 + 4], ecx
+        mov     eax, cr3
+        mov     [ebx + BS2REGS.cr3],     eax
+        mov     [ebx + BS2REGS.cr3 + 4], ecx
+        mov     eax, cr4
+        mov     [ebx + BS2REGS.cr4],     eax
+        mov     [ebx + BS2REGS.cr4 + 4], ecx
+        mov     [ebx + BS2REGS.cr8],     ecx
+        mov     [ebx + BS2REGS.cr8 + 4], ecx
+.skip_crX:
+
+        ;
+        ; Advance to a prepared resume position or panic.
+        ;
+        cmp     byte [g_fTrapPrepared], 0
+        je      .no_resume_pos
+        mov     byte [g_fTrapPrepared], 0
+        mov     eax, [g_TrapResumeRIP]
+        mov     [ebp + 0ch], eax
+
+.resume:
+%ifdef BS2_WITH_XCPT_DB_CLEARING_TF
+        cmp     byte [ebp + 04h], X86_XCPT_DB ; make sure we won't trap again due to a TF.
+        jne     .resume_no_clear_trap_flags
+        and     word [ebp + 14h], ~X86_EFL_TF
+.resume_no_clear_trap_flags:
+%endif
+        pop     ds
+        pop     ecx
+        pop     ebx
+        pop     eax
+        ;popfd
+        leave
+        add     esp, 8h
+        iret
+
+
+.no_resume_pos:
+        ;
+        ; Look for a trap record.
+        ;
+        mov     ecx, [g_cTrapRecs]      ; the number of records.
+        test    ecx, ecx
+        jz      .panic
+        mov     eax, [g_LastTrapRegs + BS2REGS.rip]
+        sub     eax, [g_pTrapRecBase]   ; the offWhere we're looking for.
+        jb      .panic
+
+        ; Look starting at the previous record first.
+        mov     ebx, [g_iTrapRecLast]
+        sub     ecx, ebx
+        jbe     .traprec_loop2          ; g_iTrapRecLast is out of range.
+        shl     ebx, BS2TRAPREC_SIZE_SHIFT
+        add     ebx, [g_paTrapRecs]     ; ebx points to the record we hit last time.
+.traprec_loop1_next:
+        cmp     [ebx + BS2TRAPREC.offWhere], eax
+        je      .traprec_found
+        add     ebx, BS2TRAPREC_size
+        dec     ecx
+        jnz     .traprec_loop1_next
+
+        ; Start searching from the start, stopping at the previous record.
+.traprec_loop2:
+        mov     ecx, [g_iTrapRecLast]
+        or      ecx, ecx
+        jz      .panic                  ; not found.
+        mov     ebx, [g_paTrapRecs]
+.traprec_loop2_next:
+        cmp     [ebx + BS2TRAPREC.offWhere], eax
+        je      .traprec_found
+        add     ebx, BS2TRAPREC_size
+        dec     ecx
+        jnz     .traprec_loop2_next
+        jmp     .panic                  ; not found
+
+.traprec_found:
+        ; Remember the hit for the next trap.
+        mov     eax, ebx
+        sub     eax, [g_paTrapRecs]
+        shr     eax, BS2TRAPREC_SIZE_SHIFT
+        mov     [g_iTrapRecLast], eax
+
+        ;
+        ; Fail the test if we got the wrong trap or error code.
+        ;
+        mov     al, [g_u8LastTrapNo]
+        cmp     al, [ebx + BS2TRAPREC.u8TrapNo]
+        je      .traprec_ok_trap
+        push    eax
+        movzx   eax, byte [ebx + BS2TRAPREC.u8TrapNo]
+        push    eax
+        push    .s_szWrongTrap
+        call    NAME(TestFailedF_p32)
+        add     esp, 12
+
+.traprec_ok_trap:
+        mov     ax, [g_u64LastTrapErr]
+        cmp     ax, [ebx + BS2TRAPREC.u16ErrCd]
+        je      .traprec_ok_err_cd
+        push    eax
+        movzx   eax, word [ebx + BS2TRAPREC.u16ErrCd]
+        push    eax
+        push    .s_szWrongErrCd
+        call    NAME(TestFailedF_p32)
+        add     esp, 12
+
+.traprec_ok_err_cd:
+        ;
+        ; Advance the EIP and resume execution.
+        ;
+        movzx   eax, byte [ebx + BS2TRAPREC.offResumeAddend]
+        add     eax, [g_LastTrapRegs + BS2REGS.rip]
+        mov     [ebp + 0ch], eax
+        jmp     .resume
+
+
+        ;
+        ; Write panic message and then halt.
+        ;
+.panic:
+        push    dword [g_LastTrapRegs + BS2REGS.rflags]
+        push    dword [g_LastTrapRegs + BS2REGS.ss]
+        push    dword [g_LastTrapRegs + BS2REGS.gs]
+        push    dword [g_LastTrapRegs + BS2REGS.fs]
+        push    dword [g_LastTrapRegs + BS2REGS.es]
+        push    dword [g_LastTrapRegs + BS2REGS.ds]
+        push    dword [g_LastTrapRegs + BS2REGS.cs]
+        ; line break
+        push    dword [g_LastTrapRegs + BS2REGS.cr4]
+        push    dword [g_LastTrapRegs + BS2REGS.cr3]
+        push    dword [g_LastTrapRegs + BS2REGS.cr0]
+        push    dword [g_LastTrapRegs + BS2REGS.rbp]
+        push    dword [g_LastTrapRegs + BS2REGS.rsp]
+        push    dword [g_LastTrapRegs + BS2REGS.rip]
+        ; line break
+        push    dword [g_LastTrapRegs + BS2REGS.rdi]
+        push    dword [g_LastTrapRegs + BS2REGS.rsi]
+        push    dword [g_LastTrapRegs + BS2REGS.rdx]
+        push    dword [g_LastTrapRegs + BS2REGS.rcx]
+        push    dword [g_LastTrapRegs + BS2REGS.rbx]
+        push    dword [g_LastTrapRegs + BS2REGS.rax]
+        ; line break
+        mov     eax, [ebp + 08h]
+        push    eax
+        mov     eax, cr2
+        push    eax
+        mov     eax, [ebp + 0ch]
+        push    eax
+        movzx   eax, word [ebp + 10h]
+        push    eax
+        movzx   eax, byte [ebp + 04h]
+        push    eax
+        push    .s_szPanicMsg
+        call    NAME(TestFailedF_p32)
+
+        call    Bs2Panic
+        jmp     .panic                  ; paranoia
+
+.s_szPanicMsg:
+        db 'trap #%RX8 at %RX16:%RX32 cr2=%RX32 err=%RX32', 13, 10
+        db 'eax=%RX32 ebx=%RX32 ecx=%RX32 edx=%RX32 esi=%RX32 edi=%RX32', 13, 10
+        db 'eip=%RX32 esp=%RX32 ebp=%RX32 cr0=%RX32 cr3=%RX32 cr4=%RX32', 13, 10
+        db 'cs=%RX16 ds=%RX16 es=%RX16 fs=%RX16 gs=%RX16 ss=%RX16               eflags=%RX32', 13, 10
+        db 0
+.s_szWrongTrap:
+        db 'Expected trap %RX8 got %RX8', 13, 10, 0
+.s_szWrongErrCd:
+        db 'Expected errcd %RX16 got %RX16', 13, 10, 0
+ENDPROC   bs2Trap_XX_32bit
+
+;;
+; Service IRQ handler, 32-bit version.
+;
+; Takes requests in eax and later maybe parameters in other registers.
+;
+;       return GS                         ebp + 24h - v86
+;       return FS                         ebp + 20h - v86
+;       return DS                         ebp + 1ch - v86
+;       return ES                         ebp + 18h - v86
+;       return SS                         ebp + 14h - higher privilege
+;       return ESP                        ebp + 10h - higher privilege
+;       return EFLAGS                     ebp + 0ch
+;       return CS                         ebp + 08h
+;       return EIP                        ebp + 04h
+BEGINCODELOW
+BEGINPROC bs2TrapService32bit
+        jmp     .highsegment
+BEGINCODEHIGH
+.highsegment:
+        push    ebp                     ; ebp
+        mov     ebp, esp
+        push    eax                     ; ebp - 04h
+        push    edx                     ; ebp - 08h
+        push    ecx                     ; ebp - 0ch
+        push    ebx                     ; ebp - 10h
+        push    ds                      ; ebp - 14h
+
+        mov     dx, ss
+        mov     ds, dx
+
+        ;
+        ; Classify the caller context in cl.
+        ;; @todo What if CS on the stack is conforming?
+        ;
+%define BS2_TRP_SRV_CALLER_SAME_RING    0
+%define BS2_TRP_SRV_CALLER_OTHER_RING   1
+%define BS2_TRP_SRV_CALLER_VM           2
+        test    dword [ebp + 0ch], X86_EFL_VM
+        jnz     .vm_ctx
+
+        mov     cx, ss
+        mov     ch, [ebp + 08h]         ; cs
+        and     cx, 00303h
+        cmp     ch, cl
+        jz      .same_ctx
+        mov     cl, BS2_TRP_SRV_CALLER_OTHER_RING
+        jmp     .done_ctx
+.vm_ctx:
+        mov     cl, BS2_TRP_SRV_CALLER_VM
+        jmp     .done_ctx
+.same_ctx:
+        mov     cl, BS2_TRP_SRV_CALLER_SAME_RING
+.done_ctx:
+
+        ;
+        ; Switch (eax).
+        ;
+        cmp     eax, BS2_SYSCALL_TO_RING3
+        jbe     .to_ringX
+
+        ; Unknown request.
+.failure:
+        mov     eax, -1
+.return:                                ; careful with ebp here!
+        pop     ds
+        pop     ebx
+        pop     ecx
+        pop     edx
+        ;pop     eax
+        leave
+        iretd
+
+        ;
+        ; Switching to the ring specified by eax.
+        ; Annoying that ss:esp isn't always restored.
+        ;
+.to_ringX:
+        cmp     cl, BS2_TRP_SRV_CALLER_VM
+        je      .failure
+        sub     al, BS2_SYSCALL_TO_RING0
+
+        ; Fake missing stack registers if necessary.
+        cmp     cl, BS2_TRP_SRV_CALLER_SAME_RING
+        jnz     .have_stack_regs
+
+        sub     esp, 8h
+        sub     ebp, 8h
+        xor     ebx, ebx
+.move_more:
+        mov     edx, [esp + 8 + ebx]
+        mov     [esp + ebx], edx
+        add     ebx, 4
+        cmp     ebx, 9*4
+        jb      .move_more
+
+        mov     dx, ss
+        mov     [ebp + 14h], edx
+        lea     edx, [ebp + 18h]
+        mov     [ebp + 10h], edx
+
+.have_stack_regs:
+        ; Translate the selector registers
+        mov     dx, [ebp - 14h]
+        call    bs2SRegToRing
+        mov     [ebp - 14h], dx
+
+        mov     dx, es
+        call    bs2SRegToRing
+        mov     es, dx
+
+        mov     dx, fs
+        call    bs2SRegToRing
+        mov     fs, dx
+
+        mov     dx, gs
+        call    bs2SRegToRing
+        mov     gs, dx
+
+        mov     dx, [ebp + 08h]         ; cs
+        call    bs2SRegToRing
+        mov     [ebp + 08h], dx
+
+        mov     dx, [ebp + 14h]         ; ss
+        call    bs2SRegToRing
+        mov     [ebp + 14h], dx
+
+        or      dword [ebp + 0ch], X86_EFL_IOPL ; set IOPL=3
+
+        ; If the desired target is ring-0 we cannot use iret.
+        cmp     al, 0
+        je      .iret_to_ring_with_stack
+
+.done_success:
+        xor     eax, eax
+        jmp     .return
+
+.iret_to_ring_with_stack:
+        ;
+        ; Move the iret-to-same-ring to the desired return position. By also
+        ; moving the saved ebp we make the leave instruction do stack
+        ; adjusting/switching for us.
+        ;
+        cli                             ; paranoia, it's disable already.
+        mov     eax, [ebp + 10h]
+        lea     edx, [ebp + 18h]
+        cmp     eax, edx
+        lea     ecx, [ebp + 08h]        ; same stack, just shifted 8 bytes
+        je      .move_iret_and_ebp
+        mov     ecx, [ebp + 10h]        ; different stack.
+        sub     ecx, 10h
+.move_iret_and_ebp:
+        mov     edx, [ebp + 0ch]
+        mov     eax, [ebp + 08h]
+        mov     [ecx + 0ch], edx
+        mov     [ecx + 08h], eax
+        mov     edx, [ebp + 04h]
+        mov     eax, [ebp + 00h]
+        mov     [ecx + 04h], edx
+        mov     [ecx + 00h], eax
+        mov     ebp, ecx
+        xor     eax, eax
+        jmp     .return
+
+ENDPROC   bs2TrapService32bit
+
+%endif ; BS2_INC_CMN_PM
+
+
+%ifdef BS2_INC_CMN_LM
+;
+; 64-bit TSS (X86TSS64).
+;
+BEGINCODELOW
+ALIGNDATA(16)
+bs2Tss64Bit:
+        dd      0                       ; 00h - u32Reserved - Reserved.
+        dq      BS2_R0_STACK_ADDR       ; 04h - rsp0  - Ring-0 stack pointer. (static)
+        dq      BS2_R1_STACK_ADDR       ; 1ch - rsp1  - Ring-1 stack pointer. (static)
+        dq      BS2_R2_STACK_ADDR       ; 14h - rsp2  - Ring-2 stack pointer. (static)
+        dq      0                       ; 2ch - reserved
+        dq      BS2_DF_R0_STACK_ADDR    ; 24h - ist1;
+        dq      BS2_R0_STACK_ADDR       ; 3ch - ist2;
+        dq      BS2_R0_STACK_ADDR       ; 34h - ist3;
+        dq      BS2_R0_STACK_ADDR       ; 4ch - ist4;
+        dq      BS2_R0_STACK_ADDR       ; 44h - ist5;
+        dq      BS2_R0_STACK_ADDR       ; 5ch - ist6;
+        dq      BS2_R0_STACK_ADDR       ; 54h - ist7;
+        dw      0,0,0,0,0               ; 6ch - reserved
+        dw      0                       ; 76h - offIoBitmap - Offset relative to the TSS of the
+                                        ; 00h - start of the I/O Bitmap and the end of the
+                                        ; 00h - interrupt redirection bitmap.
+bs2Tss64BitEnd:
+times (68h - (bs2Tss64BitEnd - bs2Tss64Bit)) db 0
+times ((bs2Tss64BitEnd - bs2Tss64Bit) - 68h) db 0
+
+;
+; 64-bit IDT (X86DESC64GATE).
+;
+BEGINCODELOW
+ALIGNDATA(16)
+bs2Idt64bit:
+        dw bs2Trap_00h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_01h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_02h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+bs2Idt64bit_BP:
+        dw bs2Trap_03h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_04h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_05h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_06h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_07h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_08h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_09h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_0ah_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_0bh_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_0ch_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_0dh_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_0eh_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_0fh_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_10h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_11h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_12h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_13h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_14h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_15h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_16h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_17h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_18h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_19h_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_1ah_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_1bh_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_1ch_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_1dh_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_1eh_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2Trap_1fh_64bit, BS2_SEL_CS64, 08e00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=0 type=int64gate
+        dw bs2TrapService64bit,BS2_SEL_CS64,0ee00h, 00000h, 0, 0, 0, 0 ; p=1 dpl=3 type=int64gate
+bs2Idt64bitEnd
+
+
+;
+; 64-bit trap handlers.
+;
+BITS 64
+%macro bs2Trap_XX_64bit_macro 1
+BEGINCODELOW
+bs2Trap_ %+ %1 %+ _64bit:
+        push    %1
+        jmp     bs2Trap_XX_64bit
+%endmacro
+%macro bs2Trap_XX_64bit_macro_no_err 1
+bs2Trap_ %+ %1 %+ _64bit:
+        push    0
+        push    %1
+        jmp     bs2Trap_XX_64bit
+%endmacro
+        bs2Trap_XX_64bit_macro_no_err 00h
+        bs2Trap_XX_64bit_macro_no_err 01h
+        bs2Trap_XX_64bit_macro_no_err 02h
+        bs2Trap_XX_64bit_macro_no_err 03h
+        bs2Trap_XX_64bit_macro_no_err 04h
+        bs2Trap_XX_64bit_macro_no_err 05h
+        bs2Trap_XX_64bit_macro_no_err 06h
+        bs2Trap_XX_64bit_macro_no_err 07h
+        bs2Trap_XX_64bit_macro        08h
+        bs2Trap_XX_64bit_macro_no_err 09h
+        bs2Trap_XX_64bit_macro        0ah
+        bs2Trap_XX_64bit_macro        0bh
+        bs2Trap_XX_64bit_macro        0ch
+        bs2Trap_XX_64bit_macro        0dh
+        bs2Trap_XX_64bit_macro        0eh
+        bs2Trap_XX_64bit_macro_no_err 0fh
+        bs2Trap_XX_64bit_macro_no_err 10h
+        bs2Trap_XX_64bit_macro        11h
+        bs2Trap_XX_64bit_macro_no_err 12h
+        bs2Trap_XX_64bit_macro_no_err 13h
+        bs2Trap_XX_64bit_macro_no_err 14h
+        bs2Trap_XX_64bit_macro_no_err 15h
+        bs2Trap_XX_64bit_macro_no_err 16h
+        bs2Trap_XX_64bit_macro_no_err 17h
+        bs2Trap_XX_64bit_macro_no_err 18h
+        bs2Trap_XX_64bit_macro_no_err 19h
+        bs2Trap_XX_64bit_macro_no_err 1ah
+        bs2Trap_XX_64bit_macro_no_err 1bh
+        bs2Trap_XX_64bit_macro_no_err 1ch
+        bs2Trap_XX_64bit_macro_no_err 1dh
+        bs2Trap_XX_64bit_macro_no_err 1eh
+        bs2Trap_XX_64bit_macro_no_err 1fh
+
+;;
+; Common 64-bit trap handler.
+;
+;       return SS                         rbp + 38h
+;       return RSP                        rbp + 30h
+;       return RFLAGS                     rbp + 28h
+;       return CS                         rbp + 20h
+;       return RIP                        rbp + 18h
+;       error code                        rbp + 10h
+;       vector #                          rbp + 08h
+BEGINCODEHIGH
+BEGINPROC bs2Trap_XX_64bit
+        push    rbp                     ; rbp + 00h
+        mov     rbp, rsp
+        pushfq                          ; rbp - 08h
+        push    rax                     ; rbp - 10h
+        push    rbx                     ; rbp - 18h
+
+        ;
+        ; Benchmark mode? Then resume the action right away!
+        ;
+        mov     rax, [rbp + 08h]
+        cmp     [g_u8TrapBenchmarkNo], al
+        jne     .test_mode
+        cmp     byte [g_fTrapPrepared], 0
+        je      .test_mode
+        mov     rax, [g_TrapResumeRIP]
+        mov     [rbp + 18h], rax
+
+        pop     rbx
+        ;pop     rax
+        ;popfq
+        leave
+        add     rsp, 10h                ; Skip the vector # and  error code.
+        xor     rax, rax
+        iretq
+
+        ;
+        ; Save the trap information
+        ;
+.test_mode:
+        inc     dword [g_u32cTraps]
+        mov     rax, [rbp + 08h]
+        mov     [g_u8LastTrapNo], al
+        mov     rax, [rbp + 10h]
+        mov     [g_u64LastTrapErr], rax
+        mov     rax, [rbp - 08h]
+        mov     [g_u64LastTrapHandlerRFlags], rax
+        mov     ax, cs
+        mov     [g_u16LastTrapHandlerCS], ax
+        mov     ax, ss
+        mov     [g_u16LastTrapHandlerSS], ax
+        lea     rax, [rbp + 8]
+        mov     [g_u64LastTrapHandlerRSP], rax
+
+        ; Save the registers.
+        lea     rbx, [g_LastTrapRegs]
+        mov     rax, [rbp - 10h]
+        mov     [rbx + BS2REGS.rax], rax
+        mov     rax, [rbp - 18h]
+        mov     [rbx + BS2REGS.rbx], rax
+        mov     [rbx + BS2REGS.rcx], rcx
+        mov     [rbx + BS2REGS.rdx], rdx
+        mov     [rbx + BS2REGS.rdi], rdi
+        mov     [rbx + BS2REGS.rsi], rsi
+        mov     rax, [rbp]
+        mov     [rbx + BS2REGS.rbp], rax
+        mov     rax, [rbp + 30h]
+        mov     [rbx + BS2REGS.rsp], rax
+        mov     rax, [rbp + 18h]
+        mov     [rbx + BS2REGS.rip], rax
+        mov     [rbx + BS2REGS.r8],  r8
+        mov     [rbx + BS2REGS.r9],  r9
+        mov     [rbx + BS2REGS.r10], r10
+        mov     [rbx + BS2REGS.r11], r11
+        mov     [rbx + BS2REGS.r12], r12
+        mov     [rbx + BS2REGS.r13], r13
+        mov     [rbx + BS2REGS.r14], r14
+        mov     [rbx + BS2REGS.r15], r15
+        mov     rax, [rbp + 28h]
+        mov     [rbx + BS2REGS.rflags], rax
+        mov     rax, [rbp + 20h]
+        mov     [rbx + BS2REGS.cs], ax
+        mov     [rbx + BS2REGS.ds], ds
+        mov     [rbx + BS2REGS.es], es
+        mov     [rbx + BS2REGS.fs], fs
+        mov     [rbx + BS2REGS.gs], gs
+        mov     rax, [rbp + 38h]
+        mov     [rbx + BS2REGS.ss], ax
+        mov     [rbx + BS2REGS.cBits], byte 64
+
+        ; The CRx registers are only accessible from ring-0 (CS=conforming, CPL < 0)
+        test    byte [rbx + BS2REGS.ss], 3
+        jnz     .skip_crX
+        mov     rax, cr0
+        mov     [rbx + BS2REGS.cr0], rax
+        mov     rax, cr2
+        mov     [rbx + BS2REGS.cr2], rax
+        mov     rax, cr3
+        mov     [rbx + BS2REGS.cr3], rax
+        mov     rax, cr4
+        mov     [rbx + BS2REGS.cr4], rax
+        mov     rax, cr8
+        mov     [rbx + BS2REGS.cr8], rax
+.skip_crX:
+
+        ;
+        ; Advance to a prepared resume position or panic.
+        ;
+        cmp     byte [g_fTrapPrepared], 0
+        je      .no_resume_pos
+        mov     byte [g_fTrapPrepared], 0
+        mov     rax, [g_TrapResumeRIP]
+        mov     [rbp + 18h], rax
+        jmp     .resume
+
+.resume:
+%ifdef BS2_WITH_XCPT_DB_CLEARING_TF
+        cmp     byte [rbp + 08h], X86_XCPT_DB ; make sure we won't trap again due to a TF.
+        jne     .resume_no_clear_trap_flags
+        and     word [rbp + 28h], ~X86_EFL_TF
+.resume_no_clear_trap_flags:
+%endif
+        pop     rbx
+        pop     rax
+        ;popfq
+        leave
+        add     rsp, 10h
+        iretq
+
+
+.no_resume_pos:
+        ;
+        ; Look for a trap record.
+        ;
+        push    rcx
+
+        mov     ecx, [g_cTrapRecs]      ; the number of records.
+        test    ecx, ecx
+        jz      .panic
+        mov     rax, [g_LastTrapRegs + BS2REGS.rip]
+        sub     rax, [g_pTrapRecBase]   ; the offWhere we're looking for.
+        jb      .panic
+        mov     rbx, _4G
+        cmp     rax, rbx
+        jae     .panic                  ; out of range.
+
+        ; Look starting at the previous record first.
+        mov     ebx, [g_iTrapRecLast]
+        sub     ecx, ebx
+        jbe     .traprec_loop2          ; g_iTrapRecLast is out of range.
+        shl     rbx, BS2TRAPREC_SIZE_SHIFT
+        add     rbx, [g_paTrapRecs]     ; ebx points to the record we hit last time.
+.traprec_loop1_next:
+        cmp     [rbx + BS2TRAPREC.offWhere], eax
+        je      .traprec_found
+        add     rbx, BS2TRAPREC_size
+        dec     ecx
+        jnz     .traprec_loop1_next
+
+        ; Start searching from the start, stopping at the previous record.
+.traprec_loop2:
+        mov     ecx, [g_iTrapRecLast]
+        or      ecx, ecx
+        jz      .panic                  ; not found.
+        mov     rbx, [g_paTrapRecs]
+.traprec_loop2_next:
+        cmp     [rbx + BS2TRAPREC.offWhere], eax
+        je      .traprec_found
+        add     rbx, BS2TRAPREC_size
+        dec     ecx
+        jnz     .traprec_loop2_next
+        jmp     .panic                  ; not found
+
+.traprec_found:
+        ; Remember the hit for the next trap.
+        mov     rax, rbx
+        sub     rax, [g_paTrapRecs]
+        shr     rax, BS2TRAPREC_SIZE_SHIFT
+        mov     [g_iTrapRecLast], eax
+
+        ;
+        ; Fail the test if we got the wrong trap or error code.
+        ;
+        mov     al, [g_u8LastTrapNo wrt rip]
+        cmp     al, [rbx + BS2TRAPREC.u8TrapNo]
+        je      .traprec_ok_trap
+        push    rax
+        movzx   rax, byte [rbx + BS2TRAPREC.u8TrapNo]
+        push    rax
+        push    .s_szWrongTrap
+        call    NAME(TestFailedF_p64)
+        add     rsp, 24
+
+.traprec_ok_trap:
+        mov     ax, [g_u64LastTrapErr wrt rip]
+        cmp     ax, [rbx + BS2TRAPREC.u16ErrCd]
+        je      .traprec_ok_err_cd
+        push    rax
+        movzx   rax, word [rbx + BS2TRAPREC.u16ErrCd]
+        push    rax
+        push    .s_szWrongErrCd
+        call    NAME(TestFailedF_p64)
+        add     rsp, 24
+
+.traprec_ok_err_cd:
+        ;
+        ; Advance the EIP and resume execution.
+        ;
+        movzx   rax, byte [rbx + BS2TRAPREC.offResumeAddend]
+        add     rax, [g_LastTrapRegs + BS2REGS.rip]
+        mov     [rbp + 18h], rax
+
+        pop     rcx
+        jmp     .resume
+
+
+        ;
+        ; Format a panic message and halt.
+        ;
+.panic:
+        lea     rbx, [g_LastTrapRegs]
+        ; line break
+        movzx   eax, word [rbx + BS2REGS.ss]
+        push    rax
+        movzx   eax, word [rbx + BS2REGS.gs]
+        push    rax
+        movzx   eax, word [rbx + BS2REGS.fs]
+        push    rax
+        movzx   eax, word [rbx + BS2REGS.es]
+        push    rax
+        movzx   eax, word [rbx + BS2REGS.ds]
+        push    rax
+        movzx   eax, word [rbx + BS2REGS.cs]
+        push    rax
+        ; line break
+        push    qword [rbx + BS2REGS.rbp]
+        push    qword [rbx + BS2REGS.rsp]
+        push    qword [rbx + BS2REGS.rip]
+        ; line break
+        push    qword [rbx + BS2REGS.rflags]
+        push    qword [rbx + BS2REGS.r15]
+        push    qword [rbx + BS2REGS.r14]
+        ; line break
+        push    qword [rbx + BS2REGS.r13]
+        push    qword [rbx + BS2REGS.r12]
+        push    qword [rbx + BS2REGS.r11]
+        ; line break
+        push    qword [rbx + BS2REGS.r10]
+        push    qword [rbx + BS2REGS.r9]
+        push    qword [rbx + BS2REGS.r8]
+        ; line break
+        push    qword [rbx + BS2REGS.rdi]
+        push    qword [rbx + BS2REGS.rsi]
+        push    qword [rbx + BS2REGS.rdx]
+        ; line break
+        push    qword [rbx + BS2REGS.rcx]
+        push    qword [rbx + BS2REGS.rbx]
+        push    qword [rbx + BS2REGS.rax]
+        ; line break
+        mov     eax, [rbx + BS2REGS.cr8]
+        push    rax
+        mov     eax, [rbx + BS2REGS.cr4]
+        push    rax
+        mov     eax, [rbx + BS2REGS.cr3]
+        push    rax
+        mov     eax, [rbx + BS2REGS.cr0]
+        push    rax
+        ; line break
+        push    qword [rbp + 10h]
+        push    qword [rbx + BS2REGS.cr2]
+        push    qword [rbx + BS2REGS.rip]
+        movzx   eax, word [rbp + BS2REGS.ss]
+        push    rax
+        movzx   eax, byte [rbp + 08h]
+        push    rax
+        push    .s_szPanicMsg
+        call    NAME(TestFailedF_p64)
+
+        call    Bs2Panic
+        jmp     .panic                  ; paranoia
+
+.s_szPanicMsg:
+        db      'trap #%RX8 at %RX16:%RX64 cr2=%RX64 err=%RX64', 13, 10
+        db      'cr0=%RX64 cr3=%RX64 cr4=%RX64 cr8=%RX16', 13, 10
+        db      'rax=%RX64 rbx=%RX64 rcx=%RX64', 13, 10
+        db      'rdx=%RX64 rsi=%RX64 rdi=%RX64', 13, 10
+        db      'r8 =%RX64 r9 =%RX64 r10=%RX64', 13, 10
+        db      'r11=%RX64 r12=%RX64 r13=%RX64', 13, 10
+        db      'r14=%RX64 r15=%RX64 rfl=%RX64', 13, 10
+        db      'rip=%RX64 rsp=%RX64 rbp=%RX64 ', 13, 10
+        db      'cs=%RX16 ds=%RX16 es=%RX16 fs=%RX16 gs=%RX16 ss=%RX16', 13, 10
+        db      0
+.s_szWrongTrap:
+        db 'Expected trap %RX8 got %RX8', 13, 10, 0
+.s_szWrongErrCd:
+        db 'Expected errcd %RX16 got %RX16', 13, 10, 0
+ENDPROC   bs2Trap_XX_64bit
+
+
+;;
+; Service IRQ handler.
+;
+; Takes requests in eax and later maybe parameters in other registers.
+;
+;       return SS                         rbp + 28h
+;       return RSP                        rbp + 20h
+;       return RFLAGS                     rbp + 18h
+;       return CS                         rbp + 10h
+;       return RIP                        rbp + 08h
+BEGINCODELOW
+BEGINPROC bs2TrapService64bit
+        jmp     .highsegment
+BEGINCODEHIGH
+.highsegment:
+        push    rbp
+        mov     rbp, rsp
+        push    rax
+        push    rdx
+        push    rcx
+
+
+        ;
+        ; Switch (eax).
+        ;
+        cmp     eax, BS2_SYSCALL_TO_RING3
+        jbe     .to_ringX
+
+        ; Unknown request.
+        mov     rax, -1
+.return:
+        pop     rcx
+        pop     rdx
+        ;pop     rax
+        leave
+        iretq
+
+        ;
+        ; Switching to the ring specified by eax.
+        ;
+.to_ringX:
+        sub     eax, BS2_SYSCALL_TO_RING0 ; al = new ring number.
+
+        mov     dx, ds
+        call    bs2SRegToRing
+        mov     ds, dx
+
+        mov     dx, es
+        call    bs2SRegToRing
+        mov     es, dx
+
+        mov     dx, fs
+        call    bs2SRegToRing
+        mov     fs, dx
+
+        mov     dx, gs
+        call    bs2SRegToRing
+        mov     gs, dx
+
+        mov     dx, [rbp + 10h]         ; cs
+        call    bs2SRegToRing
+        mov     [rbp + 10h], dx
+
+        mov     dx, [rbp + 28h]         ; ss
+        call    bs2SRegToRing
+        mov     [rbp + 28h], dx
+
+        or      dword [ebp + 18h], X86_EFL_IOPL ; set IOPL=3
+
+        jmp     .done_success
+
+.done_success:
+        xor     eax, eax
+        jmp     .return
+
+ENDPROC   bs2TrapService64bit
+
+%endif ; BS2_INC_CMN_LM
+
+
+;;
+; Converts a segment value (dx) to the ring specified by al.
+;
+; If the selector isn't a known CS, DS or SS selector it will be set to null.
+;
+; @returns      dx
+; @param        al              The desired ring.
+; @param        dx              The segment to convert.
+;
+; @remarks  WARNING! This has to work exactly the same both in 32-bit and 64-bit mode.
+;
+BEGINCODEHIGH
+BITS 32
+BEGINPROC bs2SRegToRing
+        ;
+        ; Classify the incoming selector.
+        ;
+        cmp     dx, BS2_SEL_R0_BASE
+        jb      .null
+        cmp     dx, BS2_SEL_R0_BASE + BS2_SEL_GRP_SIZE
+        jb      .ring0
+
+        cmp     dx, BS2_SEL_R1_BASE
+        jb      .miss
+        cmp     dx, BS2_SEL_R1_BASE + BS2_SEL_GRP_SIZE
+        jb      .ring1
+
+        cmp     dx, BS2_SEL_R2_BASE
+        jb      .miss
+        cmp     dx, BS2_SEL_R2_BASE + BS2_SEL_GRP_SIZE
+        jb      .ring2
+
+        cmp     dx, BS2_SEL_R3_BASE
+        jb      .miss
+        cmp     dx, BS2_SEL_R3_BASE + BS2_SEL_GRP_SIZE
+        jb      .ring3
+        jmp     .miss
+
+        ;
+        ; Convert the incoming selector to ring-0 and then from ring-0 to the
+        ; desired one.
+        ;
+.ring0:
+        cmp     al, 0
+        je      .done
+
+        add     dx, BS2_SEL_R1_BASE - BS2_SEL_R0_BASE
+        cmp     al, 1
+        je      .done
+
+        add     dx, BS2_SEL_R2_BASE - BS2_SEL_R1_BASE
+        cmp     al, 2
+        je      .done
+
+        add     dx, BS2_SEL_R3_BASE - BS2_SEL_R2_BASE
+        cmp     al, 3
+        je      .done
+.panic:
+        hlt
+        jmp     .panic
+
+.ring1:
+        sub     dx, BS2_SEL_R1_BASE - BS2_SEL_R0_BASE
+        jmp     .ring0
+.ring2:
+        sub     dx, BS2_SEL_R2_BASE - BS2_SEL_R0_BASE
+        jmp     .ring0
+.ring3:
+        sub     dx, BS2_SEL_R3_BASE - BS2_SEL_R0_BASE
+        jmp     .ring0
+
+.done:
+        and     dl, ~3h
+        or      dl, al                  ; set the RPL
+        ret
+
+.miss:
+.null:
+        xor     dx, dx
+        ret
+ENDPROC   bs2SRegToRing
+
+BEGINCODELOW
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-macros-1.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-macros-1.mac
new file mode 100644
index 0000000..40a578a
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-macros-1.mac
@@ -0,0 +1,50 @@
+; $Id: bootsector2-common-macros-1.mac $
+;; @file
+; Common bootsector macros.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;;
+; Asserts a test.
+;
+; @param    %1  First cmp operand.
+; @param    %2  First cmp operand.
+; @param    %3  Which kind of conditional jump to make
+; @param    %4  The message to print (format string, no arguments please).
+;
+%macro TEST_ASSERT_SIMPLE 4
+        cmp     %1, %2
+        %3      %%.ok
+        push    dword __LINE__
+ %ifdef TMPL_16BIT
+        push    ds
+ %endif
+        push    %%.s_szMsg
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, sCB*2
+        jmp     %%.ok
+%%.s_szMsg: db %4, " (0x%RX32)", 0
+%%.ok:
+%endmacro
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines-template-1.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines-template-1.mac
new file mode 100644
index 0000000..2aa776b
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines-template-1.mac
@@ -0,0 +1,2641 @@
+; $Id: bootsector2-common-routines-template-1.mac $
+;; @file
+; bootsector2 common routines - template containing code common to related modes.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bootsector2-template-header.mac"
+ALIGNCODE(32)
+GLOBALNAME TMPL_NM_CMN(g_szMode)
+        db TMPL_MODE_STR, 0
+
+
+;;
+; Shutdown routine.
+;
+; Does not return.
+;
+; @uses     N/A
+;
+BEGINPROC TMPL_NM_CMN(Shutdown)
+%ifdef TMPL_16BIT
+        jmp     Bs2Shutdown
+%else
+        cli
+        mov     bl, 64
+        mov     dx, 08900h
+        mov     ax, ss
+        mov     ds, ax
+.retry:
+        mov     ecx, 8
+        mov     esi, .s_szShutdown
+        rep outsb
+        dec     bl
+        jnz     .retry
+        ; Shutdown failed!
+        jmp     Bs2Panic
+.s_szShutdown:
+        db      'Shutdown', 0
+%endif
+ENDPROC   TMPL_NM_CMN(Shutdown)
+
+
+;;
+; Prints a 32-bit unsigned integer on the screen.
+;
+; @param    eax         The value to print.
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(PrintU32)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sDX
+        push    sCX
+        push    sBX
+%ifdef TMPL_16BIT
+        push    ds
+
+        mov     cx, ss
+        mov     ds, cx
+%endif
+
+        ; Allocate a stack buffer and terminate it. ds:bx points ot the end.
+        sub     xSP, 30h
+        mov     xBX, xSP
+        add     xBX, 2fh
+        mov     byte [xBX], 0
+
+        mov     ecx, 10                 ; what to divide by
+.next:
+        xor     edx, edx
+        div     ecx                     ; edx:eax / ecx -> eax and rest in edx.
+        add     dl, '0'
+        dec     xBX
+        mov     [xBX], dl
+        cmp     eax, 0
+        jnz     .next
+
+        ; Print the string.
+        mov     xAX, xBX
+        call    TMPL_NM_CMN(PrintStr)
+
+        add     xSP, 30h
+%ifdef TMPL_16BIT
+        pop     ds
+%endif
+        pop     sBX
+        pop     sCX
+        pop     sDX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(PrintU32)
+
+
+;;
+; Equivalent to RTPrintf, but a max output length of 1KB.
+;
+; @remarks  This uses an entirely STACK BASED CALLING CONVENTION where the
+;           caller does the cleanup (cdecl sans volatile regs).
+;
+; @param    fpszFormat          The format string (far pointer on 16-bit
+;                               systems). See StrFormatV for format details.
+; @param    ...                 Zero or more format string arguments.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(PrintF)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xDX
+        push    xCX
+        push    xBX
+%ifdef TMPL_16BIT
+        push    ds
+        push    es
+        push    fs
+%endif
+        sub     xSP, 0400h              ; string buffer (1024 bytes)
+
+        ;
+        ; Format the failure string and call TestFailed.
+        ;
+%ifdef TMPL_16BIT
+        mov     ax, ss                  ; buffer address.
+        mov     ds, ax
+        mov     ax, sp
+        mov     xDX, 0400h              ; buffer size.
+        les     cx, [bp + 4]            ; format string
+        mov     bx, ss                  ; argument list
+        mov     fs, bx
+        mov     bx, bp
+        add     bx, 8
+%else
+        mov     xAX, xSP                ; buffer address
+        mov     xDX, 0400h              ; buffer size
+        mov     xCX, [xBP + xCB * 2]    ; format string
+        lea     xBX, [xBP + xCB * 3]    ; argument list.
+%endif
+        call    TMPL_NM_CMN(StrFormatV)
+        call    TMPL_NM_CMN(PrintStr)
+
+        add     xSP, 0400h
+%ifdef TMPL_16BIT
+        pop     fs
+        pop     es
+        pop     ds
+%endif
+        pop     xBX
+        pop     xCX
+        pop     xDX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(PrintF)
+
+
+;;
+; Print a string followed by a semicolon and at least one space.
+;
+; @param    ds:ax       The string to print.
+; @param    dx          The desired minimum length of the output. That is
+;                       string + colon + spaces.
+; @uses     nothing.
+;
+BEGINPROC TMPL_NM_CMN(PrintStrColonSpaces)
+        push    xBP
+        mov     xBP, xSP
+        push    xAX
+        push    xCX
+
+        call    TMPL_NM_CMN(PrintStr)
+        call    TMPL_NM_CMN(StrLen)
+        mov     cx, ax
+        mov     al, ':'
+        call    TMPL_NM_CMN(PrintChr)
+        inc     cx
+        mov     al, ' '
+.next_space:
+        call    TMPL_NM_CMN(PrintChr)
+        inc     cx
+        cmp     cx, dx
+        jb      .next_space
+
+        pop     xCX
+        pop     xAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(PrintStrColonSpaces)
+
+
+;;
+; Print a string followed by a 0+ spaces, a semicolon and a space.
+;
+; @param    ds:ax       The string to print.
+; @param    dx          The desired minimum length of the output. That is
+;                       string + spaces + colon + space.
+; @uses     nothing.
+;
+BEGINPROC TMPL_NM_CMN(PrintStrSpacesColonSpace)
+        push    xBP
+        mov     xBP, xSP
+        push    xAX
+        push    xCX
+
+        call    TMPL_NM_CMN(PrintStr)
+        call    TMPL_NM_CMN(StrLen)
+        mov     cx, ax
+        inc     cx
+        mov     al, ' '
+.next_space:
+        inc     cx
+        cmp     cx, dx
+        jae     .done_spaces
+        call    TMPL_NM_CMN(PrintChr)
+        jmp     .next_space
+.done_spaces:
+        mov     al, ':'
+        call    TMPL_NM_CMN(PrintChr)
+        mov     al, ' '
+        call    TMPL_NM_CMN(PrintChr)
+
+        pop     xCX
+        pop     xAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(PrintStrSpacesColonSpace)
+
+
+;;
+; Store the current nanosecond timestamp in [ax] (qword).
+;
+; @param    ds:ax       Where to store the 64-bit timestamp.
+;
+; @uses nothing
+;
+BEGINPROC TMPL_NM_CMN(GetNanoTS)
+        push    sAX
+        push    sCX
+        push    xDX
+%ifdef TMPL_16BIT
+        movzx   ecx, ax
+%else
+        mov     xCX, xAX
+%endif
+
+        mov     dx, VMMDEV_TESTING_IOPORT_TS_LOW
+        in      eax, dx
+        mov     [sCX], eax
+
+        mov     dx, VMMDEV_TESTING_IOPORT_TS_HIGH
+        in      eax, dx
+        mov     [sCX + 4], eax
+
+        pop     xDX
+        pop     sCX
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM_CMN(GetNanoTS)
+
+
+
+;;
+; Calculates the time elapsed since [ax] (qword), storing it at [ax] (qword).
+;
+; @param    ds:ax       Where to get the start timestamp (input) and where
+;                       to store the time elapsed (output). qword
+;
+; @uses nothing
+;
+BEGINPROC TMPL_NM_CMN(GetElapsedNanoTS)
+        push    sAX
+        push    sCX
+        push    xDX
+%ifdef TMPL_16BIT
+        movzx   ecx, ax
+%else
+        mov     xCX, xAX
+%endif
+
+        mov     dx, VMMDEV_TESTING_IOPORT_TS_LOW
+        in      eax, dx
+        sub     eax, [sCX]
+        mov     [sCX], eax
+
+        mov     dx, VMMDEV_TESTING_IOPORT_TS_HIGH
+        in      eax, dx
+        sbb     eax, [sCX + 4]
+        mov     [sCX + 4], eax
+
+        pop     xDX
+        pop     sCX
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM_CMN(GetElapsedNanoTS)
+
+
+;;
+; Sends a command to VMMDev followed by a single string.
+;
+; If the VMMDev is not present or is not being used, this function will
+; do nothing.
+;
+; @param    eax         The command.
+; @param    ds:dx       The string (zero terminated).
+; @uses     nothing
+; @internal
+;
+BEGINPROC TMPL_NM_CMN(testSendStrCmd)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xDX
+
+        cmp     byte [g_fbBs2VMMDevTesting], 0
+        je      .no_vmmdev
+
+        mov     dx, VMMDEV_TESTING_IOPORT_CMD
+        out     dx, eax
+
+        mov     dx, VMMDEV_TESTING_IOPORT_DATA
+        pop     xBX
+        push    xBX
+        dec     xBX
+.next_char:
+        inc     xBX
+        mov     al, [xBX]
+        out     dx, al
+        test    al, al
+        jnz     .next_char
+
+.no_vmmdev:
+        pop     xDX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(testSendStrCmd)
+
+
+;;
+; Equivalent to RTTestCreate + RTTestBanner
+;
+; @param    DS16:xAX            Pointer to a zero terminated string naming the
+;                               test.  Must be a global constant.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(TestInit)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xDX
+
+        ; Initialize the globals.
+        mov     [g_npszBs2Test], xAX
+        xor     eax, eax
+        mov     [g_uscBs2TestErrors], ax
+        mov     [g_npszBs2SubTest], eax
+        mov     [g_uscBs2SubTestAtErrors], ax
+        mov     byte [g_fbBs2SubTestReported], 1
+        mov     [g_uscBs2SubTests], ax
+        mov     [g_uscBs2SubTestsFailed], ax
+
+        ; Print the name. RTTestBanner
+        mov     xAX, [g_npszBs2Test]
+        call    TMPL_NM_CMN(PrintStr)
+        mov     xAX, .s_szTesting
+        call    TMPL_NM_CMN(PrintStr)
+
+        ; Report it to the VMMDev.
+        mov     eax, VMMDEV_TESTING_CMD_INIT
+        mov     xDX, [g_npszBs2Test]
+        call    TMPL_NM_CMN(testSendStrCmd)
+
+        pop     xDX
+        pop     sAX
+        leave
+        ret
+.s_szTesting:
+        db ': TESTING...', 13, 10, 0
+ENDPROC   TMPL_NM_CMN(TestInit)
+
+
+;;
+; rtTestSubTestReport
+; @uses     nothing
+; @internal
+BEGINPROC TMPL_NM_CMN(testSubTestReport)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sCX
+        push    xDX
+
+        ; Check if there is anything to do.
+        cmp     byte [g_fbBs2SubTestReported], 0
+        jne     .done
+        xor     xAX, xAX                ; load the sub test name pointer for later
+        mov     xAX, [g_npszBs2SubTest]
+        test    xAX, xAX
+        jz      .done
+
+        ; Start the printing.
+        mov     dx, 48
+        call    TMPL_NM_CMN(PrintStrSpacesColonSpace)
+
+        mov     byte [g_fbBs2SubTestReported], 1
+        mov     cx, [g_uscBs2TestErrors]
+        sub     cx, [g_uscBs2SubTestAtErrors]
+        and     ecx, 0ffffh
+        jnz     .failed
+
+        ; passed
+        mov     xAX, .s_szPassed
+        call    TMPL_NM_CMN(PrintStr)
+        jmp     .vmmdev
+
+        ; failed
+.failed:
+        mov     xAX, .s_szFailure
+        call    TMPL_NM_CMN(PrintStr)
+        mov     eax, ecx
+        call    TMPL_NM_CMN(PrintU32)
+        mov     xAX, .s_szFailureEnd
+        call    TMPL_NM_CMN(PrintStr)
+
+        ; report to VMMDev
+.vmmdev:
+        cmp     byte [g_fbBs2VMMDevTesting], 0
+        je      .no_vmmdev
+
+        mov     dx, VMMDEV_TESTING_IOPORT_CMD
+        mov     eax, VMMDEV_TESTING_CMD_SUB_DONE
+        out     dx, eax
+
+        mov     dx, VMMDEV_TESTING_IOPORT_DATA
+        mov     eax, ecx
+        out     dx, eax
+
+.no_vmmdev:
+.done:
+        pop     xDX
+        pop     sCX
+        pop     sAX
+        leave
+        ret
+.s_szPassed:
+        db 'PASSED', 13, 10, 0
+.s_szFailure:
+        db 'FAILED (', 0
+.s_szFailureEnd:
+        db ' errors)', 13, 10, 0
+ENDPROC   TMPL_NM_CMN(testSubTestReport)
+
+
+;;
+; rtTestSubCleanup
+; @uses     nothing
+; @internal
+BEGINPROC TMPL_NM_CMN(testSubCleanup)
+        push    xBP
+        mov     xBP, xSP
+
+        cmp     dword [g_npszBs2SubTest], 0
+        je      .cleaned_up
+
+        call    TMPL_NM_CMN(testSubTestReport)
+        mov     dword [g_npszBs2SubTest], 0
+        mov     byte [g_fbBs2SubTestReported], 0
+
+.cleaned_up:
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(testSubCleanup)
+
+
+;;
+; Equivalent to RTTestSub.
+;
+; @param    ds:xAX      Pointer to a zero terminated string naming the sub test.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(TestSub)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xDX
+
+        ; Complete and cleanup any current sub test.
+        call    TMPL_NM_CMN(testSubCleanup)
+
+        ; Start a new sub test.
+        inc     word [g_uscBs2SubTests]
+        mov     dx, [g_uscBs2TestErrors]
+        mov     [g_uscBs2SubTestAtErrors], dx
+        mov     [g_npszBs2SubTest], xAX
+        mov     byte [g_fbBs2SubTestReported], 0
+
+        ; Report it to the VMMDev.
+        mov     xDX, xAX
+        mov     eax, VMMDEV_TESTING_CMD_SUB_NEW
+        call    TMPL_NM_CMN(testSendStrCmd)
+
+        pop     xDX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(TestSub)
+
+
+;;
+; Calculates the error count for the current sub test.
+;
+; @returns  ax          Error count for the current sub test.
+; @uses     ax
+;
+BEGINPROC TMPL_NM_CMN(TestSubErrorCount)
+        pushf
+
+        mov     ax, [g_uscBs2TestErrors]
+        sub     ax, [g_uscBs2SubTestAtErrors]
+
+        popf
+        ret
+ENDPROC   TMPL_NM_CMN(TestSubErrorCount)
+
+
+
+;;
+; Equivalent to RTTestValue.
+;
+; @param    ds:ax       The value name.
+; @param    edx         The 32-bit value to report.
+; @param    cl          The unit (VMMDEV_TESTING_UNIT_XXX).
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(TestValueU32)
+        push    xBP
+        mov     xBP, xSP
+        push    sDX
+        push    sCX
+        push    sAX
+        push    sSI
+        pushf
+        cld
+
+        mov     xSI, xAX                ; xSI = name
+
+        ; Print it.
+        mov     dx, 48
+        call    TMPL_NM_CMN(PrintStrSpacesColonSpace)
+        mov     eax, [xBP - sCB]
+        call    TMPL_NM_CMN(PrintU32)
+        mov     al, ' '
+        call    TMPL_NM_CMN(PrintChr)
+        movzx   sAX, cl                 ; ASSUMES correct input.
+        mov     edx, eax                ; edx = unit
+        shl     xAX, 4                  ; * 16
+        add     xAX, g_aszBs2TestUnitNames
+        call    TMPL_NM_CMN(PrintStr)
+        mov     al, 13
+        call    TMPL_NM_CMN(PrintChr)
+        mov     al, 10
+        call    TMPL_NM_CMN(PrintChr)
+
+        ; Report it to the host.
+        cmp     byte [g_fbBs2VMMDevTesting], 0
+        je      .no_vmmdev
+        mov     ecx, edx                ; ecx = unit
+
+        mov     dx, VMMDEV_TESTING_IOPORT_CMD
+        mov     eax, VMMDEV_TESTING_CMD_VALUE
+        out     dx, eax
+
+        mov     dx, VMMDEV_TESTING_IOPORT_DATA
+        mov     eax, [xBP - sCB]
+        out     dx, eax                 ; value - low dword
+        xor     eax, eax
+        out     dx, eax                 ; value - high dword
+        mov     eax, ecx
+        out     dx, eax                 ; unit
+.next_char:
+        lodsb
+        out     dx, al
+        test    al, al
+        jnz     .next_char
+
+.no_vmmdev:
+        popf
+        pop     sSI
+        pop     sAX
+        pop     sCX
+        pop     sDX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(TestValueU32)
+
+
+;;
+; RTTestValue + DBGFR3RegNmQueryU64.
+;
+; @param    ds:ax       The value name and register name separated by a colon.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(TestValueReg)
+        push    xBP
+        mov     xBP, xSP
+        push    sDX
+        push    sAX
+        push    sSI
+        pushf
+        cld
+
+        mov     xSI, xAX                ; xSI = name
+
+        ; Report it to the host.
+        cmp     byte [g_fbBs2VMMDevTesting], 0
+        je      .no_vmmdev
+
+        mov     dx, VMMDEV_TESTING_IOPORT_CMD
+        mov     eax, VMMDEV_TESTING_CMD_VALUE_REG
+        out     dx, eax
+
+        mov     dx, VMMDEV_TESTING_IOPORT_DATA
+.next_char:
+        lodsb
+        out     dx, al
+        test    al, al
+        jnz     .next_char
+
+.no_vmmdev:
+        popf
+        pop     sSI
+        pop     sAX
+        pop     sDX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(TestValueReg)
+
+
+;;
+; Equivalent to RTTestFailed("%s", ds:xAX).
+;
+; @param    ds:xAX      Failure explanation.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(TestFailed)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xDX
+
+        ; Increment the error count.
+        inc     word [g_uscBs2TestErrors]
+
+        ; Print failure message.
+        call    TMPL_NM_CMN(PrintStr)
+
+        ; Report it to the VMMDev.
+        mov     xDX, xAX
+        mov     eax, VMMDEV_TESTING_CMD_FAILED
+        call    TMPL_NM_CMN(testSendStrCmd)
+
+        pop     xDX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(TestFailed)
+
+
+;;
+; Equivalent to RTTestFailed.
+;
+; @remarks  This uses an entirely STACK BASED CALLING CONVENTION where the
+;           caller does the cleanup (cdecl sans volatile regs).
+;
+; @param    fpszFormat          The format string (far pointer on 16-bit
+;                               systems). See StrFormatV for format details.
+; @param    ...                 Zero or more format string arguments.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(TestFailedF)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xDX
+        push    xCX
+        push    xBX
+%ifdef TMPL_16BIT
+        push    ds
+        push    es
+        push    fs
+%endif
+        sub     xSP, 0400h              ; string buffer (1024 bytes)
+
+        ;
+        ; Format the failure string and call TestFailed.
+        ;
+%ifdef TMPL_16BIT
+        mov     ax, ss                  ; buffer address.
+        mov     ds, ax
+        mov     ax, sp
+        mov     xDX, 0400h              ; buffer size.
+        les     cx, [bp + 4]            ; format string
+        mov     bx, ss                  ; argument list
+        mov     fs, bx
+        mov     bx, bp
+        add     bx, 8
+%else
+        mov     xAX, xSP                ; buffer address
+        mov     xDX, 0400h              ; buffer size
+        mov     xCX, [xBP + xCB * 2]    ; format string
+        lea     xBX, [xBP + xCB * 3]    ; argument list.
+%endif
+        call    TMPL_NM_CMN(StrFormatV)
+        call    TMPL_NM_CMN(TestFailed)
+
+        add     xSP, 0400h
+%ifdef TMPL_16BIT
+        pop     fs
+        pop     es
+        pop     ds
+%endif
+        pop     xBX
+        pop     xCX
+        pop     xDX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(TestFailedF)
+
+
+;;
+; Equivalent to RTTestSkipped("%s", ds:xAX).
+;
+; @param    ds:xAX      Explanation.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(TestSkipped)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xDX
+
+        ; Print reason.
+        call    TMPL_NM_CMN(PrintStr)
+
+        ; Report it to the VMMDev.
+        mov     xDX, xAX
+        mov     eax, VMMDEV_TESTING_CMD_SKIPPED
+        call    TMPL_NM_CMN(testSendStrCmd)
+
+        pop     xDX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(TestSkipped)
+
+
+
+;;
+; Equivalent to RTTestSubDone.
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(TestSubDone)
+        jmp     TMPL_NM_CMN(testSubCleanup)
+ENDPROC   TMPL_NM_CMN(TestSubDone)
+
+
+;;
+; Equivalent to RTTestSummaryAndDestroy, does not return.
+;
+BEGINPROC TMPL_NM_CMN(TestTerm)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sCX
+        push    xDX
+
+        ; Complete and cleanup any current sub test.
+        call    TMPL_NM_CMN(testSubCleanup)
+
+        ; Print test summary.
+        mov     xAX, [g_npszBs2Test]
+        call    TMPL_NM_CMN(PrintStr)
+
+        mov     cx, [g_uscBs2TestErrors]
+        and     ecx, 0ffffh
+        jnz     .failure
+
+        ; success
+        mov     xAX, .s_szSuccess
+        call    TMPL_NM_CMN(PrintStr)
+        jmp     .vmmdev
+
+        ; failure
+.failure:
+        mov     xAX, .s_szFailure
+        call    TMPL_NM_CMN(PrintStr)
+        mov     eax, ecx
+        call    TMPL_NM_CMN(PrintU32)
+        mov     xAX, .s_szFailureEnd
+        call    TMPL_NM_CMN(PrintStr)
+
+        ; report to VMMDev
+.vmmdev:
+        cmp     byte [g_fbBs2VMMDevTesting], 0
+        je      .no_vmmdev
+
+        mov     dx, VMMDEV_TESTING_IOPORT_CMD
+        mov     eax, VMMDEV_TESTING_CMD_TERM
+        out     dx, eax
+
+        mov     dx, VMMDEV_TESTING_IOPORT_DATA
+        mov     eax, ecx
+        out     dx, eax
+.no_vmmdev:
+
+        ; Shut down the VM by default.
+        call    TMPL_NM_CMN(Shutdown)
+
+        pop     xDX
+        pop     sCX
+        pop     sAX
+        leave
+        ret
+.s_szSuccess:
+        db ': SUCCESS', 13, 10, 0
+.s_szFailure:
+        db ': FAILURE - ', 0
+.s_szFailureEnd:
+        db ' errors', 13, 10, 0
+ENDPROC TMPL_NM_CMN(TestTerm)
+
+
+
+
+;;
+; Report a result (elapsed time).
+;
+; @param    ds:ax       Pointer to the elapsed time.
+; @param    edx         The number of tests executed.
+; @param    ds:cx       The test description.
+;
+; @users    nothing
+;
+BEGINPROC TMPL_NM_CMN(ReportResult)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sDX
+        push    xCX
+
+%if 0
+        push    sDX
+        push    xCX
+        push    sDX
+        mov     edx, [sAX]
+        push    sDX
+        mov     edx, [sAX + 4]
+        push    sDX
+        push    .szDbg
+        call    TMPL_NM_CMN(PrintF)
+        add     xSP, 4 * sCB + xCB
+        pop     sDX
+        jmp     .end_debug
+.szDbg:
+        db 'ReportResult(%RX32.%RX32, %RX32, %s)', 13, 10, 0
+.end_debug:
+%endif
+
+        call    TMPL_NM_CMN(CalcTestPerSecond)
+        mov     edx, eax
+        mov     xAX, xCX
+        mov     cl, VMMDEV_TESTING_UNIT_INSTRS_PER_SEC
+        call    TMPL_NM_CMN(TestValueU32)
+
+        pop     xCX
+        pop     sDX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(ReportResult)
+
+
+%ifdef BS2_WITH_TRAPS
+;;
+; Checks a trap, complains if not the expected one.
+;
+; @param    al          The expected trap number.
+; @param    sDX         The expected trap error code.
+; @param    sCX         The expected fault eip.
+; @param    sBX         The expected fault address.
+; @returns  al=1 and ZF=0 on success.
+; @returns  al=0 and ZF=1 on failure
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(TestCheckTrap)
+        push    xBP
+        mov     xBP, xSP
+%define a_u8ExpectedTrapNo      byte  [xBP - xCB]
+        push    xAX
+%define a_uExpectedErr          sPRE [xBP - xCB - sCB*1]
+        push    sDX
+%define a_uExpectedFaultPC      sPRE [xBP - xCB - sCB*2]
+        push    sCX
+%define a_uExpectedFaultAddr    sPRE [xBP - xCB - sCB*3]
+        push    sBX
+
+        ; Any traps at all?
+        cmp     dword [g_u32cTraps], 0
+        jne     .trapped
+        mov     xAX, .s_szNoTrap
+        jmp     .failed
+.trapped:
+
+        ; Exactly one trap.
+        cmp     dword [g_u32cTraps], 1
+        je      .one_trap
+        mov     xAX, .s_szToManyTraps
+        jmp     .failed
+.one_trap:
+
+        ; The right trap.
+        cmp     byte [g_u8LastTrapNo], al
+        je      .right_trap_no
+        mov     xAX, .s_szWrongTrapNo
+        jmp     .failed
+.right_trap_no:
+
+        ; The right error code.
+        cmp     [g_u64LastTrapErr], sDX
+%ifndef TMPL_64BIT
+        jne     .bad_err_cd
+        cmp     dword [g_u64LastTrapErr + 4], 0
+%endif
+        je      .right_err_cd
+.bad_err_cd:
+        mov     xAX, .s_szWrongErrCd
+        jmp     .failed
+.right_err_cd:
+
+        ; The fault PC.
+        cmp     [g_LastTrapRegs + BS2REGS.rip], sCX
+%ifndef TMPL_64BIT
+        jne     .bad_pc
+        cmp     dword [g_LastTrapRegs + BS2REGS.rip + 4], 0
+%endif
+        je      .right_pc
+.bad_pc:
+        mov     xAX, .s_szWrongPc
+        jmp     .failed
+.right_pc:
+
+
+        ; The fault address (PF only).
+        cmp     al, 0eh
+        jne     .right_fault_address
+        cmp     [g_LastTrapRegs + BS2REGS.cr2], sBX
+%ifndef TMPL_64BIT
+        jne     .bad_fault_address
+        cmp     dword [g_LastTrapRegs + BS2REGS.cr2 + 4], 0
+%endif
+        je      .right_fault_address
+.bad_fault_address:
+        mov     xAX, .s_szWrongFaultAddress
+        jmp     .failed
+.right_fault_address:
+
+        pop     sBX
+        pop     sCX
+        pop     sDX
+        pop     xAX
+        leave
+        mov     al, 1
+        test    al, al
+        ret
+
+        ;
+        ; Reportfailure
+        ;
+.failed:
+        mov     xDX, xSP                ; save xSP - lazy bird.
+        cmp     a_u8ExpectedTrapNo, 0eh
+        jne     .not_pf2
+%ifndef TMPL_64BIT
+        push    dword 0
+%endif
+        push    a_uExpectedFaultAddr
+.not_pf1:
+%ifndef TMPL_64BIT
+        push    dword 0
+%endif
+        push    a_uExpectedErr
+%ifndef TMPL_64BIT
+        push    dword 0
+%endif
+        push    a_uExpectedFaultPC
+        movzx   xBX, a_u8ExpectedTrapNo
+        push    xBX
+        ; line break
+        cmp     a_u8ExpectedTrapNo, 0eh
+        jne     .not_pf2
+%ifndef TMPL_64BIT
+        push    dword [g_LastTrapRegs + BS2REGS.cr2 + 4]
+%endif
+        push    sPRE [g_LastTrapRegs + BS2REGS.cr2]
+.not_pf2:
+%ifndef TMPL_64BIT
+        push    dword [g_u64LastTrapErr + 4]
+%endif
+        push    sPRE [g_u64LastTrapErr]
+%ifndef TMPL_64BIT
+        push    dword [g_LastTrapRegs + BS2REGS.rip + 4]
+%endif
+        push    sPRE [g_LastTrapRegs + BS2REGS.rip]
+        movzx   xBX, byte [g_u8LastTrapNo]
+        push    xBX
+        push    xAX                     ; msg
+        mov     xAX, .s_szFailureMsg
+        cmp     a_u8ExpectedTrapNo, 0eh
+        jne     .not_pf3
+        mov     xAX, .s_szFailurePfMsg
+.not_pf3:
+        push    xAX                     ; format string
+        call    TMPL_NM_CMN(TestFailedF)
+        mov     xSP, xDX                ; clean up call frame
+
+.done:
+        pop     sBX
+        pop     sCX
+        pop     sDX
+        pop     xAX
+        leave
+        xor     al, al
+        ret
+
+.s_szFailureMsg:
+        db '%s', 13, 10
+        db ' got trap %RX8 pc=%RX64 err=%RX64', 13, 10
+        db ' expected %RX8 pc=%RX64 err=%RX64', 13, 10, 0
+.s_szFailurePfMsg:
+        db '%s', 13, 10
+        db ' got trap %RX8 pc=%RX64 err=%RX64 cr2=%RX64', 13, 10,
+        db ' expected %RX8 pc=%RX64 err=%RX64 cr2=%RX64', 13, 10, 0
+.s_szNoTrap:
+        db 'no traps', 0
+.s_szToManyTraps:
+        db 'too many traps', 0
+.s_szWrongTrapNo:
+        db 'wrong trap number', 0
+.s_szWrongErrCd:
+        db 'wrong error code', 0
+.s_szWrongPc:
+        db 'wrong xIP', 0
+.s_szWrongFaultAddress:
+        db 'wrong fault address', 0
+%undef a_u8ExpectedTrapNo
+%undef a_u32ExpectedErr
+%undef a_u32ExpectedFaultPC
+%undef a_u32ExpectedFaultAddr
+ENDPROC   TMPL_NM_CMN(TestCheckTrap)
+%endif ; BS2_WITH_TRAPS
+
+
+%ifdef BS2_WITH_TRAPS
+;;
+; Installs the active list of trap records (BS2TRAPREC).
+;
+; @param    sAX         Flat address of the trap records (BS2TRAPREC).
+;                       Assumes that DS is FLAT.
+; @param    edx         The number of trap records.
+; @param    sCX         Flat image base address, i.e. what BS2TRAPREC.offWhere
+;                       is relative to.
+; @returns  al=1 and ZF=0 on success.
+; @returns  al=0 and ZF=1 on failure
+;
+; @uses     sAX (return value)
+;
+BEGINPROC TMPL_NM_CMN(TestInstallTrapRecs)
+        push    xBP
+        mov     xBP, xSP
+        push    sDX
+        push    sBX
+        push    sCX
+        push    sDI
+        push    sSI
+
+        ; Make sure the record array is within limits.
+        cmp     edx, _4M
+        jae     .nok
+
+        ; Scan the trap records.
+        mov     sDI, sAX
+        mov     esi, edx
+        or      esi, esi
+        jnz     .ok
+.next:
+        cmp     dword [sDI + BS2TRAPREC.offWhere], _2G
+        jae     .nok
+
+        cmp     dword [sDI + BS2TRAPREC.offResumeAddend], 0
+        je      .nok
+        cmp     dword [sDI + BS2TRAPREC.offResumeAddend], 0xff
+        je      .nok
+
+        cmp     dword [sDI + BS2TRAPREC.u8TrapNo], X86_XCPT_MAX
+        ja      .nok
+
+        ; next.
+        add     sDI, BS2TRAPREC_size
+        dec     esi
+        jnz     .next
+
+        ; Set the global variables.
+.ok:
+        xor     esi, esi
+        mov     [g_paTrapRecs + 4], esi
+        mov     [g_paTrapRecs], sAX
+        mov     [g_cTrapRecs], edx
+        mov     [g_iTrapRecLast], esi
+        mov     [g_pTrapRecBase + 4], esi
+        mov     [g_pTrapRecBase], sCX
+        mov     eax, 1
+        or      eax, eax
+
+.done:
+        pop     sSI
+        pop     sDI
+        pop     sBX
+        pop     sCX
+        pop     sDX
+        leave
+        ret
+
+.nok:
+        xor     eax, eax
+        jmp     .done
+ENDPROC   TMPL_NM_CMN(TestInstallTrapRecs)
+%endif ; BS2_WITH_TRAPS
+
+
+;;
+; Calculate the number of tests executed per second.
+;
+; @param    ds:ax       Pointer to the elapsed time.
+; @param    edx         The number of tests executed.
+; @returns  The tests per second in eax.
+;
+; @uses     eax (return value)
+;
+BEGINPROC TMPL_NM_CMN(CalcTestPerSecond)
+        push    xBP
+        mov     xBP, xSP
+        push    sDX
+        push    sCX
+%ifdef TMPL_16BIT
+        movzx   eax, ax
+%endif
+
+        ; Calc NS per test.
+        mov     ecx, edx
+        cmp     ecx, 0
+        jz      .div_zero
+        movzx   eax, ax
+        mov     edx, [sAX + 4]
+        cmp     edx, ecx
+        jae     .div_overflow
+        mov     eax, [sAX]
+        shld    edx, eax, 10
+        shl     eax,10
+        div     ecx                     ; eax = NS per test
+
+        ; Calc tests per second.
+        mov     ecx, eax
+        cmp     ecx, 0
+        jz      .div_zero
+        mov     edx, 0xee
+        mov     eax, 0x6b280000         ; 1024G
+        div     ecx                     ; eax = tests per second
+
+.done:
+        pop     sCX
+        pop     sDX
+        leave
+        ret
+
+.div_zero:
+        mov     eax, 0
+        jmp     .done
+
+.div_overflow:
+        mov     eax, 4242424242
+        jmp     .done
+ENDPROC   TMPL_NM_CMN(CalcTestPerSecond)
+
+
+;;
+; Calculate the number of iterations for a benchmark based on the time a short
+; calibration run too.
+;
+; @param    ds:xAX      Pointer to the elapsed time.
+; @param    edx         The number of tests iterations executed.
+; @param    ecx         The desired test length, in seconds.
+; @returns  The tests iterations in eax.
+;
+; @uses     eax (return value)
+;
+BEGINPROC TMPL_NM_CMN(CalcBenchmarkIterations)
+        push    xBP
+        mov     xBP, xSP
+        push    sDX
+        push    sCX
+%ifdef TMPL_16BIT
+        movzx   eax, ax
+%endif
+
+        ; Calc NS per test.
+        mov     ecx, edx
+        cmp     ecx, 0
+        jz      .div_zero
+        movzx   eax, ax
+        mov     edx, [sAX + 4]
+        cmp     edx, ecx
+        jae     .div_overflow
+        mov     eax, [sAX]
+        div     ecx                     ; eax = NS per test
+
+        ; Calc tests per second.
+        mov     ecx, eax
+        cmp     ecx, 0
+        jz      .div_zero
+        xor     edx, edx
+        mov     eax, 1000000000         ; 1G
+        div     ecx                     ; eax = tests per second
+
+        ; Multiply this up to the desired number of seconds.
+        mov     edx, [xBP - xCB*2]
+        mul     edx
+        test    edx, edx
+        jnz      .mult_32bit_overflow
+        cmp     eax, _64K
+        jle     .too_small
+
+.done:
+        pop     sCX
+        pop     sDX
+        leave
+        ret
+
+.too_small:
+        mov     eax, _64K
+        jmp     .done
+
+.mult_32bit_overflow:
+        mov     eax, 0ffff0000h
+        jmp     .done
+
+.div_zero:
+        mov     eax, [xBP - xCB]
+        shl     eax, 8
+        jmp     .fudge
+
+.div_overflow:
+        mov     eax, [xBP - xCB]
+        shr     eax, 4
+.fudge:
+        add     eax, 10
+        jmp     .done
+ENDPROC   TMPL_NM_CMN(CalcBenchmarkIterations)
+
+
+;;
+; Prints a string on the screen.
+;
+; @param    ds:ax       The string to find the length of.
+; @returns  The string length in ax.
+;
+; @uses     ax (return value)
+;
+BEGINPROC TMPL_NM_CMN(StrLen)
+        push    xBP
+        mov     xBP, xSP
+        push    xBX
+
+        mov     xBX, xAX
+        dec     xBX
+.next:
+        inc     xBX
+        cmp     byte [xBX], byte 0
+        jnz     .next
+
+        xchg    xAX, xBX
+        sub     xAX, xBX
+
+        pop     xBX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(StrLen)
+
+
+
+;;
+; Simple string format, taking an argument list.
+;
+; Implemented:
+;       - %RX8
+;       - %RX16
+;       - %RX32
+;       - %RX64
+;       - %s
+;
+; Planned:
+;       - %RU8
+;       - %RU16
+;       - %RU32
+;       - %RU64
+;       - %RI8
+;       - %RI16
+;       - %RI32
+;       - %RI64
+;
+; @param        ds:xAX          The buffer address.
+; @param        xDX             The buffer size.
+; @param        es:xCX          The format string.
+; @param        fs:xBX          The argument list.
+; @uses         nothing
+;
+BEGINPROC TMPL_NM_CMN(StrFormatV)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sDX
+        push    sCX
+        push    sBX
+        push    sDI
+        push    sSI
+        pushf
+        cld
+%ifdef TMPL_16BIT
+        push    ds
+        push    es
+        push    fs
+        push    gs
+
+        mov     si, ds
+        mov     di, es
+        mov     ds, di
+        mov     es, si
+        mov     di, ax                  ; es:di    -> output buffer.
+        mov     si, cx                  ; ds:si    -> format string.
+%define a_pArgs                 [fs:bx]
+%define a_pu32ArgsHighDW        dword [fs:bx + 4]
+%else
+        mov     xDI, xAX                ; (es:)xDI -> output buffer.
+        mov     xSI, xCX                ; (ds:)xSI -> format string.
+%define a_pArgs                 [xBX]
+%define a_pu32ArgsHighDW        dword [xBX + 4]
+%endif
+        xchg    xCX, xDX                ; xCX=buffer size.
+
+        ;
+        ; Make sure we've got space for a terminator char in the output buffer.
+        ;
+        test    xCX, xCX
+        jz      .return
+        dec     xCX
+        jz      .done
+
+        ;
+        ; In this loop we're free to use sDX and (with some caution) sAX.
+        ;
+.format_loop:
+        lodsb
+        test    al, al
+        jz      .done
+        cmp     al, '%'
+        je      .switch
+
+        ; Emit the character in al if there is room for it.
+.emit_al:
+        test    xCX, xCX
+        jz      .done
+        stosb
+        dec     xCX
+        jmp     .format_loop
+
+        ; Try recognize the format specifier.
+.switch:
+        lodsb
+        cmp     al, 's'
+        je      .switch_case_string
+        cmp     al, 'c'
+        je      .switch_case_char
+        cmp     al, 'R'
+        jne     .switch_default
+        lodsb
+        cmp     al, 'X'
+        jne     .switch_case_number
+        cmp     al, 'U'
+        jne     .switch_case_number
+        cmp     al, 'I'
+        jne     .switch_case_number
+
+.switch_default:
+        test    al, al
+        jz      .done
+        mov     al, '!'
+        jmp     .emit_al
+
+        ; parse the number part.
+.switch_case_number:
+        mov     ah, al                  ; ah = {X,U,I}
+        lodsb
+        cmp     al, '8'
+        je      .switch_case_number_8bit
+        cmp     al, '1'
+        je      .switch_case_number_16bit
+        cmp     al, '3'
+        je      .switch_case_number_32bit
+        cmp     al, '6'
+        je      .switch_case_number_64bit
+        jmp     .switch_default
+
+
+        ;
+        ; Common code for 8-bit, 16-bit and 32-bit.
+        ;
+        ; The first part load the value into edx, ah={X,U,I},
+        ; al=(max-hex, max-unsigned-dec).
+        ;
+.switch_case_number_8bit:
+        mov     al, (2 << 4) | 2
+        movzx   edx, byte a_pArgs
+        add     xBX, xCB
+        cmp     ah, 'I'
+        jne     .switch_case_number_common_32bit_hex_or_unsigned
+        movsx   edx, dl
+        jmp     .switch_case_number_common_32bit_signed
+
+.switch_case_number_16bit:
+        lodsb
+        cmp     al, '6'
+        jne     .switch_default
+        mov     al, (4 << 4) | 5
+        movzx   edx, word a_pArgs
+        add     xBX, xCB
+        cmp     ah, 'I'
+        jne     .switch_case_number_common_32bit_hex_or_unsigned
+        movsx   edx, dx
+        jmp     .switch_case_number_common_32bit_signed
+
+.switch_case_number_32bit:
+        lodsb
+        cmp     al, '2'
+        jne     .switch_default
+        mov     al, (8 << 4) | 10
+        mov     edx, dword a_pArgs
+        add     xBX, sCB
+        cmp     ah, 'I'
+        je      .switch_case_number_common_32bit_signed
+
+.switch_case_number_common_32bit_hex_or_unsigned:
+        cmp     ah, 'X'
+        jne     .switch_case_number_common_32bit_unsigned
+        shr     al, 4
+        and     xAX, 0fh
+        cmp     xCX, xAX
+        jb      .switch_case_number_bad_buf
+        call    .format_32bit_hex_subroutine
+        jmp     .format_loop
+
+.switch_case_number_common_32bit_unsigned:
+        and     xAX, 0fh
+        cmp     xCX, xAX
+        jb      .switch_case_number_bad_buf
+        call    .format_32bit_dec_subroutine
+        jmp     .format_loop
+
+.switch_case_number_common_32bit_signed:
+        cmp     edx, 0
+        jge     .switch_case_number_common_32bit_unsigned
+        and     xAX, 0fh
+        inc     xAX                     ; sign char
+        cmp     xCX, xAX
+        jb      .switch_case_number_bad_buf
+        ; Emit the minus sign, invert the value and join the unsigned formatting.
+        push    xAX
+        mov     al, '-'
+        stosb
+        dec     xCX
+        pop     xAX
+        neg     edx
+        call    .format_32bit_dec_subroutine
+        jmp     .format_loop
+
+
+        ;
+        ; 64-bit is special, to simplify we treat all formats as hex...
+        ;
+.switch_case_number_64bit:
+        lodsb
+        cmp     al, '4'
+        jne     .switch_default
+        cmp     ah, 'X'
+        je      .switch_case_number_64bit_hex
+        cmp     ah, 'I'
+        je      .switch_case_number_64bit_signed
+        jmp     .switch_case_number_64bit_unsigned
+
+.switch_case_number_64bit_hex:
+        mov     eax, dword a_pArgs
+        mov     edx, a_pu32ArgsHighDW
+        add     xBX, 8
+        cmp     xCX, 8+1+8
+        jb      .switch_case_number_bad_buf
+        ; Simple, format it as two 32-bit hex values.
+        push    sAX
+        mov     eax, 8
+        call    .format_32bit_hex_subroutine
+        mov     al, 27h                 ; '\'' - how do we escape this with yasm?
+        stosb
+        dec     xCX
+        pop     sDX
+        mov     eax, 8
+        call    .format_32bit_hex_subroutine
+        jmp     .format_loop
+
+.switch_case_number_64bit_unsigned:
+        cmp     xCX, 19
+        jb      .switch_case_number_bad_buf
+.switch_case_number_64bit_unsigned_format_it:
+        ;; @todo implement me
+        jmp     .switch_case_number_64bit_hex
+
+.switch_case_number_64bit_signed:
+        mov     eax, dword a_pArgs
+        mov     edx, a_pu32ArgsHighDW
+        add     xBX, 8
+        cmp     xCX, 20
+        jb      .switch_case_number_bad_buf
+        test    edx, 080000000h
+        jz      .switch_case_number_64bit_unsigned_format_it
+        ; Emit the minus sign, invert the value and join the unsigned formatting.
+        push    xAX
+        mov     al, '-'
+        stosb
+        dec     xCX
+        pop     xAX
+        neg     eax
+        neg     edx
+        jmp     .switch_case_number_64bit_unsigned_format_it
+
+
+        ; The remaining buffer is too small to hold the number.
+.switch_case_number_bad_buf:
+        mov     al, '^'
+        jmp     .emit_al
+
+
+        ;
+        ; Emit a string.
+        ;
+.switch_case_string:
+%ifdef TMPL_16BIT
+        lgs     dx, a_pArgs
+        add     xBX, 4
+%else
+        mov     xDX, a_pArgs
+        add     xBX, xCB
+%endif
+        test    xCX, xCX
+.switch_case_string_loop:
+        jz      .done
+%ifdef TMPL_16BIT
+        mov     al, [gs:edx]
+%else
+        mov     al, [xDX]
+%endif
+        test    al, al
+        jz      .format_loop
+        inc     xDX
+        stosb
+        dec     xCX
+        jmp     .switch_case_string_loop
+
+        ;
+        ; Emit a char.
+        ;
+.switch_case_char:
+        mov     al, byte a_pArgs
+        add     xBX, xCB
+        jmp     .emit_al
+
+
+        ;
+        ; Done, just emit the terminator char.
+        ;
+.done:
+        xor     al, al
+        stosb
+
+.return:
+%ifdef TMPL_16BIT
+        pop     gs
+        pop     fs
+        pop     es
+        pop     ds
+%endif
+        popf
+        pop     sSI
+        pop     sDI
+        pop     sBX
+        pop     sCX
+        pop     sDX
+        pop     sAX
+        leave
+        ret
+%undef a_pArgs
+%undef a_pu32ArgsHighDW
+
+;;
+; Internal subroutine for formatting a hex number into the buffer.
+; @param        al      The precision (2, 4, 8).
+; @param        edx     The value.
+;
+; @uses         ecx, edi
+;
+.format_32bit_hex_subroutine:
+        push    xAX
+        push    sDX
+        push    xBX
+
+        ; Rotate edx into position.
+        mov     ebx, 8
+        sub     bl, al
+        shl     bl, 2
+        xchg    cl, bl
+        rol     edx, cl
+        xchg    bl, cl
+
+        mov     bl, al                  ; Width counter
+.format_32bit_hex_subroutine_next:
+        rol     edx, 4
+        mov     eax, edx
+        and     eax, 0fh
+        add     sAX, g_achHex
+        mov     al, [cs:sAX]
+        stosb
+        dec     xCX
+        dec     bl
+        jnz     .format_32bit_hex_subroutine_next
+
+        pop     xBX
+        pop     sDX
+        pop     xAX
+        ret
+
+
+;;
+; Internal subroutine for formatting a hex number into the buffer.
+; @param        al      The max precision (2, 5, 10).
+; @param        edx     The value.
+; @param        xCX     Counter register to decrement as characters are emited.
+; @param        es:xDI  Where to write the output, xDI is updated.
+;
+; @uses         xCX, xDI
+;
+.format_32bit_dec_subroutine:
+%if 0   ;; @todo implement this
+        sub     xSP, 20h
+        ; Format in reverse order into a stack buffer.
+
+        ; Append the stack buffer to the string, reversing it in the process.
+
+        add     xSP, 20h
+%else
+        call    .format_32bit_hex_subroutine
+%endif
+        ret
+
+ENDPROC   TMPL_NM_CMN(StrFormatV)
+
+
+;;
+; Very limited RTStrPrintf version.
+;
+; @remarks  This uses an entirely STACK BASED CALLING CONVENTION where the
+;           caller does the cleanup (cdecl sans volatile regs).
+;
+; @param    fpszBuf             The output buffer.
+; @param    cbBuf               The output buffer size (natural size).
+; @param    fpszFormat          The format string (far pointer in 16-bit).
+;                               See StrFormatV for format.
+; @param    ...                 Zero or more format string arguments.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM_CMN(StrFormatF)
+        push    xBP
+        mov     xBP, xSP
+        push    xAX
+        push    xDX
+        push    xCX
+        push    xBX
+%ifdef TMPL_16BIT
+        push    ds
+        push    es
+        push    fs
+
+        lds     xAX, [bp + 04h]
+        mov     dx,  [bp + 08h]
+        les     xCX, [bp + 0ah]
+        mov     bx, ss
+        mov     fs, bx
+        mov     bx, bp
+        add     bx, 0eh
+%else
+        mov     xAX, [xBP + xCB * 2]
+        mov     xDX, [xBP + xCB * 3]
+        mov     xCX, [xBP + xCB * 4]
+        lea     xBX, [xBP + xCB * 5]
+%endif
+        call    TMPL_NM_CMN(StrFormatV)
+
+%ifdef TMPL_16BIT
+        pop     fs
+        pop     es
+        pop     ds
+%endif
+        pop     xBX
+        pop     xCX
+        pop     xDX
+        pop     xAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(StrFormatF)
+
+
+;;
+; Dumps the CPU registers.
+;
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(TestDumpCurrentRegisters)
+%ifndef TMPL_64BIT
+        push    xBP
+        mov     xBP, xSP
+        push    eax
+        pushfd
+
+        push    dword [xBP - sCB - 4]   ; eflags
+        mov     eax, cr2
+        push    eax
+        xor     eax, eax
+        mov     eax, gs
+        push    eax
+        mov     eax, fs
+        push    eax
+        mov     eax, es
+        push    eax
+        mov     eax, ds
+        push    eax
+        mov     eax, cs
+        push    eax
+
+        mov     eax, cr4
+        push    eax
+        mov     eax, cr3
+        push    eax
+        mov     eax, cr0
+        push    eax
+        mov     eax, ebp                ; return EBP
+        mov     xAX, [xBP]
+        push    eax
+
+        mov     eax, ebp                ; return ESP
+        add     xAX, xCB
+        push    eax
+
+        mov     xAX, [xBP + xCB]        ; return EIP
+ %ifdef TMPL_16BIT
+        movzx   eax, ax
+ %endif
+        push    eax
+
+        push    edi
+        push    esi
+        push    edx
+        push    ecx
+        push    ebx
+        push    dword [xBP - sCB]       ; eax
+
+ %ifdef TMPL_16BIT
+        push    cs
+ %endif
+        push    .s_szRegFmt
+        call    TMPL_NM_CMN(PrintF)
+
+        popfd
+        pop     eax
+        leave
+        ret
+
+.s_szRegFmt:
+        db      'eax=%RX32 ebx=%RX32 ecx=%RX32 edx=%RX32 esi=%RX32 edi=%RX32', 13, 10
+        db      'eip=%RX32 esp=%RX32 ebp=%RX32 cr0=%RX32 cr3=%RX32 cr4=%RX32', 13, 10
+        db      'cs=%RX16 ds=%RX16 es=%RX16 fs=%RX16 gs=%RX16 ss=%RX16 cr2=%RX32  eflags=%RX32', 13, 10, 0
+
+%else  ; 64-bit
+        push    .s_szRegFmt
+        call TMPL_NM_CMN(PrintF)
+        ret
+
+.s_szRegFmt:
+        db      'TestDumpCurrentRegisters not implemented', 13, 10, 0
+
+%endif ; 64-bit
+ENDPROC   TMPL_NM_CMN(TestDumpCurrentRegisters)
+
+
+
+;;
+; Dumps the CPU registers.
+;
+; @param    ds:xAX              Pointer to the register frame to dump.
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(TestDumpRegisters)
+        push    xBP
+        mov     xBP, xSP
+        pushf
+        push    sDX
+        push    sBX
+        mov     xBX, xAX
+
+        cmp     byte [xBX + BS2REGS.cBits], 64
+        je      .dump_64bit_regs
+
+        push    -1                      ; sanity
+        mov     edx, [xBX + BS2REGS.rflags]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.cr2]
+        push    sDX
+        xor     edx, edx
+        mov     dx, [xBX + BS2REGS.ss]
+        push    xDX
+        mov     dx, [xBX + BS2REGS.gs]
+        push    xDX
+        mov     dx, [xBX + BS2REGS.fs]
+        push    xDX
+        mov     dx, [xBX + BS2REGS.es]
+        push    xDX
+        mov     dx, [xBX + BS2REGS.ds]
+        push    xDX
+        mov     dx, [xBX + BS2REGS.cs]
+        push    xDX
+
+        mov     edx, [xBX + BS2REGS.cr4]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.cr3]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.cr0]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.rbp]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.rsp]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.rip]
+        push    sDX
+
+        mov     edx, [xBX + BS2REGS.rdi]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.rsi]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.rdx]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.rcx]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.rbx]
+        push    sDX
+        mov     edx, [xBX + BS2REGS.rax]
+        push    sDX
+
+%ifdef TMPL_16BIT
+        push    cs
+%endif
+        push    .s_szReg32Fmt
+        call    TMPL_NM_CMN(PrintF)
+        jmp     .return
+
+.dump_64bit_regs:
+%ifdef TMPL_16BIT
+        push    cs
+%endif
+        push    .s_szReg64Fmt
+        call    TMPL_NM_CMN(PrintF)
+
+.return:
+        lea     xSP, [xBP - sCB*2 - xCB]
+        pop     sBX
+        pop     sDX
+        popf
+        leave
+        ret
+
+.s_szReg32Fmt:
+        db      'eax=%RX32 ebx=%RX32 ecx=%RX32 edx=%RX32 esi=%RX32 edi=%RX32', 13, 10
+        db      'eip=%RX32 esp=%RX32 ebp=%RX32 cr0=%RX32 cr3=%RX32 cr4=%RX32', 13, 10
+        db      'cs=%RX16 ds=%RX16 es=%RX16 fs=%RX16 gs=%RX16 ss=%RX16 cr2=%RX32  eflags=%RX32', 13, 10
+        db      0
+
+.s_szReg64Fmt:
+        db      'TestDumpCurrentRegisters not implemented', 13, 10, 0
+ENDPROC   TMPL_NM_CMN(TestDumpRegisters)
+
+
+;;
+; Saves the CPU registers.
+;
+; @param    ds:xAX              Pointer to the register frame to dump.
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(TestSaveRegisters)
+        push    xBP
+        mov     xBP, xSP
+%ifdef TMPL_16BIT
+        pushfd
+%else
+        pushf                           ; - 1*sCB
+%endif
+        push    sBX                     ; - 2*sCB
+        push    sAX                     ; - 3*sCB
+        push    sDX                     ; - 4*sCB
+
+        xor     edx, edx                ; zero register.
+        mov     xBX, xAX                ; xBX for addressing, xAX for scratch.
+
+%ifdef TMPL_64BIT
+        mov     rax, [xSP + sCB*1]
+        mov     [xBX + BS2REGS.rax], rax
+        mov     rax, [xSP + sCB*2]
+        mov     [xBX + BS2REGS.rbx], rax
+        mov     [xBX + BS2REGS.rcx], rcx
+        mov     rax, [xSP]
+        mov     [xBX + BS2REGS.rdx], rax
+        mov     [xBX + BS2REGS.rdi], rdi
+        mov     [xBX + BS2REGS.rsi], rsi
+        mov     rax, [xBP]
+        mov     [xBX + BS2REGS.rbp], rax
+        lea     rax, [xBP + 16]
+        mov     [xBX + BS2REGS.rsp], rax
+        mov     rax, [xBP + 8]
+        mov     [xBX + BS2REGS.rip], rax
+        mov     [xBX + BS2REGS.r8],  r8
+        mov     [xBX + BS2REGS.r9],  r9
+        mov     [xBX + BS2REGS.r10], r10
+        mov     [xBX + BS2REGS.r11], r11
+        mov     [xBX + BS2REGS.r12], r12
+        mov     [xBX + BS2REGS.r13], r13
+        mov     [xBX + BS2REGS.r14], r14
+        mov     [xBX + BS2REGS.r15], r15
+        mov     rax, [xBP - sCB]
+        mov     [xBX + BS2REGS.rflags], rax
+        mov     ax, cs
+        mov     [xBX + BS2REGS.cs], ax
+        mov     ax, ds
+        mov     [xBX + BS2REGS.ds], ax
+        mov     ax, es
+        mov     [xBX + BS2REGS.es], ax
+        mov     ax, fs
+        mov     [xBX + BS2REGS.fs], ax
+        mov     ax, gs
+        mov     [xBX + BS2REGS.gs], ax
+        mov     ax, ss
+        mov     [xBX + BS2REGS.ss], ax
+        mov     byte [xBX + BS2REGS.cBits], 64
+        mov     [xBX + BS2REGS.pad    ], dl
+        mov     [xBX + BS2REGS.pad + 1], dx
+        mov     rax, cr0
+        mov     [xBX + BS2REGS.cr0], rax
+        mov     rax, cr2
+        mov     [xBX + BS2REGS.cr2], rax
+        mov     rax, cr3
+        mov     [xBX + BS2REGS.cr3], rax
+        mov     rax, cr4
+        mov     [xBX + BS2REGS.cr4], rax
+        mov     rax, cr8
+        mov     [xBX + BS2REGS.cr8], rax
+%else ; !TMPL_64
+        mov     eax, [xBP - sCB*3]
+        mov     dword [xBX + BS2REGS.rax], eax
+        mov     dword [xBX + BS2REGS.rax + 4], edx
+        mov     eax, [xBP - sCB*2]
+        mov     dword [xBX + BS2REGS.rbx], eax
+        mov     dword [xBX + BS2REGS.rbx + 4], edx
+        mov     dword [xBX + BS2REGS.rcx], ecx
+        mov     dword [xBX + BS2REGS.rcx + 4], edx
+        mov     eax, [xBP - sCB*4]
+        mov     dword [xBX + BS2REGS.rdx], eax
+        mov     dword [xBX + BS2REGS.rdx + 4], edx
+        mov     dword [xBX + BS2REGS.rdi], edi
+        mov     dword [xBX + BS2REGS.rdi + 4], edx
+        mov     dword [xBX + BS2REGS.rsi], esi
+        mov     dword [xBX + BS2REGS.rsi + 4], edx
+        mov     eax, ebp
+        mov     ax, [xBP]
+        mov     dword [xBX + BS2REGS.rbp], eax
+        mov     dword [xBX + BS2REGS.rbp + 4], edx
+ %ifdef TMPL_16BIT
+        mov     eax, esp
+        mov     ax, bp
+        sub     ax, 4
+ %else
+        lea     eax, [ebp + 8]
+ %endif
+        mov     dword [xBX + BS2REGS.rsp], eax
+        mov     dword [xBX + BS2REGS.rsp + 4], edx
+ %ifdef TMPL_16BIT
+        movzx   eax, word [xBP + 2]
+ %else
+        mov     eax, [xBP + 4]
+ %endif
+        mov     dword [xBX + BS2REGS.rip], eax
+        mov     dword [xBX + BS2REGS.rip + 4], edx
+        mov     dword [xBX + BS2REGS.r8    ], edx
+        mov     dword [xBX + BS2REGS.r8 + 4], edx
+        mov     dword [xBX + BS2REGS.r9    ], edx
+        mov     dword [xBX + BS2REGS.r9 + 4], edx
+        mov     dword [xBX + BS2REGS.r10    ], edx
+        mov     dword [xBX + BS2REGS.r10 + 4], edx
+        mov     dword [xBX + BS2REGS.r11    ], edx
+        mov     dword [xBX + BS2REGS.r11 + 4], edx
+        mov     dword [xBX + BS2REGS.r12    ], edx
+        mov     dword [xBX + BS2REGS.r12 + 4], edx
+        mov     dword [xBX + BS2REGS.r13    ], edx
+        mov     dword [xBX + BS2REGS.r13 + 4], edx
+        mov     dword [xBX + BS2REGS.r14    ], edx
+        mov     dword [xBX + BS2REGS.r14 + 4], edx
+        mov     dword [xBX + BS2REGS.r15    ], edx
+        mov     dword [xBX + BS2REGS.r15 + 4], edx
+        mov     eax, [xBP - sCB]
+        mov     dword [xBX + BS2REGS.rflags], eax
+        mov     dword [xBX + BS2REGS.rflags + 4], edx
+        mov     ax, cs
+        mov     [xBX + BS2REGS.cs], ax
+        mov     ax, ds
+        mov     [xBX + BS2REGS.ds], ax
+        mov     ax, es
+        mov     [xBX + BS2REGS.es], ax
+        mov     ax, fs
+        mov     [xBX + BS2REGS.fs], ax
+        mov     ax, gs
+        mov     [xBX + BS2REGS.gs], ax
+        mov     ax, ss
+        mov     [xBX + BS2REGS.ss], ax
+ %ifdef TMPL_16BIT
+        mov     byte [xBX + BS2REGS.cBits], 16
+ %else
+        mov     byte [xBX + BS2REGS.cBits], 32
+ %endif
+        mov     [xBX + BS2REGS.pad    ], dl
+        mov     [xBX + BS2REGS.pad + 1], dx
+        mov     eax, cr0
+        mov     dword [xBX + BS2REGS.cr0], eax
+        mov     dword [xBX + BS2REGS.cr0 + 4], edx
+        mov     eax, cr2
+        mov     dword [xBX + BS2REGS.cr2], eax
+        mov     dword [xBX + BS2REGS.cr2 + 4], edx
+        mov     eax, cr3
+        mov     dword [xBX + BS2REGS.cr3], eax
+        mov     dword [xBX + BS2REGS.cr3 + 4], edx
+        mov     eax, cr4
+        mov     dword [xBX + BS2REGS.cr4], eax
+        mov     dword [xBX + BS2REGS.cr4 + 4], edx
+        mov     dword [xBX + BS2REGS.cr8], edx
+        mov     dword [xBX + BS2REGS.cr8 + 4], edx
+%endif  ; !TMPL_64
+
+.return:
+        pop     sDX
+        pop     sAX
+        pop     sBX
+%ifdef TMPL_16BIT
+        popfd
+%else
+        popf
+%endif
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(TestSaveRegisters)
+
+
+;;
+; Restores the CPU registers, except for rsp, rip, cs, ss and ds.
+;
+; @param    ds:xAX              Pointer to the register frame to dump.
+; @uses     All, but RSP, RIP, CS, SS and DS.
+;
+BEGINPROC TMPL_NM_CMN(TestRestoreRegisters)
+        push    xBP
+        mov     xBP, xSP
+%ifdef TMPL_16BIT
+        pushfd
+%else
+        pushf                           ; - 1*sCB
+%endif
+        push    sBX                     ; - 2*sCB
+        push    sAX                     ; - 3*sCB
+
+        mov     xBX, xAX                ; xBX for addressing, xAX for scratch.
+
+        mov     sAX, [xBX + BS2REGS.rax]
+        mov     [xBP - 3*sCB], sAX
+        mov     sAX, [xBX + BS2REGS.rbx]
+        mov     [xBP - 2*sCB], sAX
+        mov     sCX, [xBX + BS2REGS.rcx]
+        mov     sDX, [xBX + BS2REGS.rdx]
+        mov     sDI, [xBX + BS2REGS.rdi]
+        mov     sSI, [xBX + BS2REGS.rsi]
+        ; skip rsp, rbp or rip.
+%ifdef TMPL_64BIT
+        mov     r8,  [xBX + BS2REGS.r8]
+        mov     r9,  [xBX + BS2REGS.r9]
+        mov     r10, [xBX + BS2REGS.r10]
+        mov     r11, [xBX + BS2REGS.r11]
+        mov     r12, [xBX + BS2REGS.r12]
+        mov     r13, [xBX + BS2REGS.r13]
+        mov     r14, [xBX + BS2REGS.r14]
+        mov     r15, [xBX + BS2REGS.r15]
+%endif
+        mov     sAX, [xBX + BS2REGS.rflags]
+        mov     [xBP - sCB], sAX
+        ; skip cs & ds.
+        mov     ax, [xBX + BS2REGS.es]
+        mov     es, ax
+        mov     ax, [xBX + BS2REGS.fs]
+        mov     fs, ax
+        mov     ax, [xBX + BS2REGS.gs]
+        mov     gs, ax
+        ; skip ss
+        mov     sAX, [xBX + BS2REGS.cr0]
+        mov     cr0, sAX
+        mov     sAX, [xBX + BS2REGS.cr2]
+        mov     cr2, sAX
+        mov     sAX, [xBX + BS2REGS.cr3]
+        mov     cr3, sAX
+        mov     sAX, [xBX + BS2REGS.cr4]
+        mov     cr4, sAX
+
+.return:
+        pop     sAX
+        pop     sBX
+%ifdef TMPL_16BIT
+        popfd
+%else
+        popf
+%endif
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(TestRestoreRegisters)
+
+
+;;
+; Enables the A20 gate.
+;
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2EnableA20)
+        call    TMPL_NM_CMN(Bs2EnableA20ViaPortA)
+;        call    TMPL_NM_CMN(Bs2EnableA20ViaKbd)
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2EnableA20)
+
+
+;;
+; Disables the A20 gate.
+;
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2DisableA20)
+        ; Must call both because they may be ORed together on real HW.
+        call    TMPL_NM_CMN(Bs2DisableA20ViaKbd)
+        call    TMPL_NM_CMN(Bs2DisableA20ViaPortA)
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2DisableA20)
+
+
+;;
+; Waits for the keyboard controller to become ready.
+;
+; @uses         Nothing
+;
+BEGINPROC TMPL_NM_CMN(Bs2KbdWait)
+        push    xAX
+
+.check_status:
+        in      al, 64h
+        test    al, 1                   ; KBD_STAT_OBF
+        jnz     .read_data_and_status
+        test    al, 2                   ; KBD_STAT_IBF
+        jnz     .check_status
+
+        pop     xAX
+        ret
+
+.read_data_and_status:
+        in      al, 60h
+        jmp     .check_status
+ENDPROC   TMPL_NM_CMN(Bs2KbdWait)
+
+
+;;
+; Sends a read command to the keyboard controller and gets the result.
+;
+; The caller is responsible for making sure the keyboard controller is ready
+; for a command (call Bs2KbdWait if unsure).
+;
+; @param        al              The read command.
+; @returns      The value read is returned.
+; @uses         al (obviously)
+;
+BEGINPROC TMPL_NM_CMN(Bs2KbdRead)
+        out     64h, al                 ; Write the command.
+
+.check_status:
+        in      al, 64h
+        test    al, 1                   ; KBD_STAT_OBF
+        jz      .check_status
+
+        in      al, 60h                 ; Read the data.
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2KbdRead)
+
+
+;;
+; Sends a write command to the keyboard controller and then sends the data.
+;
+; The caller is responsible for making sure the keyboard controller is ready
+; for a command (call Bs2KbdWait if unsure).
+;
+; @param        al              The write command.
+; @param        ah              The data to write.
+; @uses         Nothing.
+;
+; @todo         Return status?
+;
+BEGINPROC TMPL_NM_CMN(Bs2KbdWrite)
+        out     64h, al                 ; Write the command.
+        call    TMPL_NM_CMN(Bs2KbdWait)
+
+        xchg    al, ah
+        out     60h, al                 ; Write the data.
+        call    TMPL_NM_CMN(Bs2KbdWait)
+        xchg    al, ah
+
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2KbdWrite)
+
+
+;;
+; Enables the A20 gate via the keyboard controller.
+;
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2EnableA20ViaKbd)
+        push    xAX
+        pushf
+        cli
+
+        call    TMPL_NM_CMN(Bs2KbdWait)
+        mov     al, 0d0h                ; KBD_CCMD_READ_OUTPORT
+        call    TMPL_NM_CMN(Bs2KbdRead)
+
+        mov     ah, 002h
+        or      ah, al
+        mov     al, 0d1h                ; KBD_CCMD_WRITE_OUTPORT
+        call    TMPL_NM_CMN(Bs2KbdWrite)
+
+        mov     al, 0ffh                ; KBD_CMD_RESET
+        out     64h, al
+        call    TMPL_NM_CMN(Bs2KbdWait)
+
+        popf
+        pop     xAX
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2EnableA20ViaKbd)
+
+
+;;
+; Disables the A20 gate via the keyboard controller.
+;
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2DisableA20ViaKbd)
+        push    xAX
+        pushf
+        cli
+
+        call    TMPL_NM_CMN(Bs2KbdWait)
+        mov     al, 0d0h                ; KBD_CCMD_READ_OUTPORT
+        call    TMPL_NM_CMN(Bs2KbdRead)
+
+        mov     ah, 0fdh                ; ~2
+        and     ah, al
+        mov     al, 0d1h                ; KBD_CCMD_WRITE_OUTPORT
+        call    TMPL_NM_CMN(Bs2KbdWrite)
+
+        mov     al, 0ffh                ; KBD_CMD_RESET
+        out     64h, al
+        call    TMPL_NM_CMN(Bs2KbdWait)
+
+        popf
+        pop     xAX
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2DisableA20ViaKbd)
+
+
+;;
+; Enables the A20 gate via control port A (PS/2 style).
+;
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2EnableA20ViaPortA)
+        push    xAX
+
+        ; Use Control port A, assuming a PS/2 style system.
+        in      al, 092h
+        test    al, 02h
+        jnz     .done                   ; avoid trouble writing back the same value.
+        or      al, 2                   ; enable the A20 gate.
+        out     092h, al
+
+.done:
+        pop     xAX
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2EnableA20ViaPortA)
+
+
+;;
+; Disables the A20 gate via control port A (PS/2 style).
+;
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2DisableA20ViaPortA)
+        push    xAX
+
+        ; Use Control port A, assuming a PS/2 style system.
+        in      al, 092h
+        test    al, 02h
+        jz      .done                   ; avoid trouble writing back the same value.
+        and     al, 0fdh                ; disable the A20 gate.
+        out     092h, al
+
+.done:
+        pop     xAX
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2DisableA20ViaPortA)
+
+
+;;
+; Checks if the no-execution bit is supported.
+;
+; @returns  AL=1 and ZF=0 if supported.
+; @returns  AL=0 and ZF=1 if not.
+; @uses     al
+;
+BEGINPROC TMPL_NM_CMN(Bs2IsNXSupported)
+        push    xBP
+        mov     xBP, xSP
+        push    sBX
+        push    sDX
+        push    sCX
+        push    sAX
+
+        mov     eax, 080000000h
+        cpuid
+        cmp     eax, 080000001h
+        jb      .not_supported
+        cmp     eax, 080001000h
+        jae     .not_supported
+
+        mov     eax, 080000001h
+        cpuid
+        test    edx, X86_CPUID_EXT_FEATURE_EDX_NX
+        jz      .not_supported
+
+        ; supported
+        pop     sAX
+        mov     al, 1
+
+.return:
+        pop     sCX
+        pop     sDX
+        pop     sBX
+        leave
+        ret
+.not_supported:
+        pop     sAX
+        xor     al, al
+        jmp .return
+ENDPROC   TMPL_NM_CMN(Bs2IsNXSupported)
+
+
+;;
+; Sets EFER.NXE=al if NXE is supported.
+;
+; @param    al          0 if NXE should be disabled, non-zero if it should
+;                       be enabled.
+; @uses     nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2SetupNX)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sDX
+        push    sCX
+
+        call    TMPL_NM_CMN(Bs2IsNXSupported)
+        jz      .done
+
+        mov     ecx, MSR_K6_EFER
+        rdmsr
+        test    byte [xBP - sCB], 0ffh
+        jz      .disable_it
+        or      eax, MSR_K6_EFER_NXE
+        jmp     .set_it
+.disable_it:
+        and     eax, ~MSR_K6_EFER_NXE
+.set_it:
+        wrmsr
+
+.done:
+        pop     sCX
+        pop     sDX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2SetupNX)
+
+
+;;
+; Disables NX if supported.
+;
+; @uses     nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2DisableNX)
+        push    xBP
+        mov     xBP, xSP
+        push    xAX
+
+        xor     al, al
+        call    TMPL_NM_CMN(Bs2SetupNX)
+
+        pop     xAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2DisableNX)
+
+
+;;
+; Enables NX if supported.
+;
+; @uses     nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2EnableNX)
+        push    xBP
+        mov     xBP, xSP
+        push    xAX
+
+        mov     al, 1
+        call    TMPL_NM_CMN(Bs2SetupNX)
+
+        pop     xAX
+        leave
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2EnableNX)
+
+
+;;
+; Panics if the testing feature of the VMMDev is missing.
+;
+; A message will be printed.
+;
+; @uses     Nothing.
+;
+BEGINPROC TMPL_NM_CMN(Bs2PanicIfVMMDevTestingIsMissing)
+        push    xDX
+        push    sAX
+
+        xor     eax, eax
+        mov     dx, VMMDEV_TESTING_IOPORT_NOP
+        in      eax, dx
+        cmp     eax, VMMDEV_TESTING_NOP_RET
+        je      .ok
+
+        mov     xAX, .s_szMissingVMMDevTesting
+        call    TMPL_NM_CMN(PrintStr)
+        call    Bs2Panic
+
+.ok:
+        pop     sAX
+        pop     xDX
+        ret
+
+.s_szMissingVMMDevTesting:
+        db 'fatal error: The testing feature of the VMMDevVMMDev is not present!', 13, 10, 0
+ENDPROC   TMPL_NM_CMN(Bs2PanicIfVMMDevTestingIsMissing)
+
+
+
+%ifdef BS2_WITH_TRAPS
+
+;;
+; Switches to ring-0 from whatever the current mode is.
+;
+; @uses cs, ss, ds, es, fs, gs
+;
+BEGINPROC TMPL_NM_CMN(Bs2ToRing0)
+        push    sAX
+        mov     sAX, BS2_SYSCALL_TO_RING0
+        int     BS2_TRAP_SYSCALL
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2ToRing0)
+
+;;
+; Switches to ring-1 from whatever the current mode is.
+;
+; @uses cs, ss, ds, es, fs, gs
+;
+BEGINPROC TMPL_NM_CMN(Bs2ToRing1)
+        push    sAX
+        mov     sAX, BS2_SYSCALL_TO_RING1
+        int     BS2_TRAP_SYSCALL
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2ToRing1)
+
+;;
+; Switches to ring-0 from whatever the current mode is.
+;
+; @uses cs, ss, ds, es, fs, gs
+;
+BEGINPROC TMPL_NM_CMN(Bs2ToRing2)
+        push    sAX
+        mov     sAX, BS2_SYSCALL_TO_RING2
+        int     BS2_TRAP_SYSCALL
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2ToRing2)
+
+;;
+; Switches to ring-3 from whatever the current mode is.
+;
+; @uses cs, ss, ds, es, fs, gs
+;
+BEGINPROC TMPL_NM_CMN(Bs2ToRing3)
+        push    sAX
+        mov     sAX, BS2_SYSCALL_TO_RING3
+        int     BS2_TRAP_SYSCALL
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM_CMN(Bs2ToRing3)
+
+;;
+; Switches the given ring from whatever the current mode is.
+;
+; @param AL     The desired ring.
+; @uses cs, ss, ds, es, fs, gs
+;
+BEGINPROC TMPL_NM_CMN(Bs2ToRingN)
+        pushf
+        cmp     al, 3
+        je      .ring3
+        cmp     al, 2
+        je      .ring2
+        cmp     al, 1
+        je      .ring1
+.ring0:
+        call    TMPL_NM_CMN(Bs2ToRing0)
+.done:
+        popf
+        ret
+
+.ring1:
+        call    TMPL_NM_CMN(Bs2ToRing1)
+        jmp     .done
+.ring2:
+        call    TMPL_NM_CMN(Bs2ToRing2)
+        jmp     .done
+.ring3:
+        call    TMPL_NM_CMN(Bs2ToRing3)
+        jmp     .done
+ENDPROC   TMPL_NM_CMN(Bs2ToRingN)
+
+%endif ; BS2_WITH_TRAPS
+
+
+
+;
+; Wrapper for dynamically calling the right specific method.
+; This avoid putting large portions of the code in the 2nd template.
+;
+
+TMPL_NM_CMN(g_pfnPrintStrInternal): TMPL_PTR_DEF 0
+TMPL_NM_CMN(g_pfnPrintChrInternal): TMPL_PTR_DEF 0
+
+BEGINPROC TMPL_NM_CMN(PrintStr)
+        jmp     [TMPL_NM_CMN(g_pfnPrintStrInternal)]
+ENDPROC   TMPL_NM_CMN(PrintStr)
+
+BEGINPROC TMPL_NM_CMN(PrintChr)
+        jmp     [TMPL_NM_CMN(g_pfnPrintChrInternal)]
+ENDPROC   TMPL_NM_CMN(PrintChr)
+
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines-template-2.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines-template-2.mac
new file mode 100644
index 0000000..c45e6fe
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines-template-2.mac
@@ -0,0 +1,214 @@
+; $Id: bootsector2-common-routines-template-2.mac $
+;; @file
+; bootsector2 common routines - template containing code specific to each mode.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bootsector2-template-header.mac"
+ALIGNCODE(32)
+GLOBALNAME TMPL_NM(g_szMode)
+        db TMPL_MODE_STR, 0
+
+
+;;
+; Prints a string on the screen.
+;
+; @param    ds:ax       The string to print (null terminated).
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(PrintStr)
+        push    xBP
+        mov     xBP, xSP
+        push    xAX
+        push    xBX
+        push    xSI
+
+        mov     xSI, xAX
+.next:
+        lodsb
+        test    al, al
+        jz      .done
+%ifdef TMPL_HAVE_BIOS
+        mov     bx, 0ff00h
+        mov     ah, 0eh
+        int     10h
+%else
+        call TMPL_NM(PrintChr)
+%endif
+        jmp     .next
+
+.done:
+        pop     xSI
+        pop     xBX
+        pop     xAX
+        leave
+        ret
+ENDPROC   TMPL_NM(PrintStr)
+
+
+;;
+; Prints a string on the screen.
+;
+; @param    al          The character to print.
+;
+; @uses     nothing
+;
+BEGINCODELOW
+BEGINPROC TMPL_NM(PrintChr)
+        push    xBP
+        mov     xBP, xSP
+        push    xAX
+        push    xBX
+
+%ifndef TMPL_HAVE_BIOS
+ %ifdef BS2_WITH_TRAPS
+        mov     bx, cs
+        and     xBX, 0x3
+        push    xBX
+        jz      .ring_ok
+        call    TMPL_NM_CMN(Bs2ToRing0)
+.ring_ok:
+ %endif
+
+        mov     bl, al
+        call    TMPL_NM(LeaveCpuMode)
+        mov     al, bl
+BITS 16
+%endif
+
+        mov     bx, 0ff00h
+        mov     ah, 0eh
+        int     10h
+
+%ifndef TMPL_HAVE_BIOS
+        call TMPL_NM(EnterCpuMode)
+BITS TMPL_BITS
+ %ifdef BS2_WITH_TRAPS
+        pop     xAX
+        test    al, al
+        jz      .ring_restored
+        call    TMPL_NM_CMN(Bs2ToRingN)
+.ring_restored:
+ %endif
+%endif
+
+        pop     xBX
+        pop     xAX
+        leave
+        ret
+ENDPROC   TMPL_NM(PrintChr)
+TMPL_BEGINCODE
+
+
+%ifndef TMPL_HAVE_BIOS
+
+;;
+; Leaves the current CPU mode and returns to real mode.
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(LeaveCpuMode)
+        jmp     TMPL_NM(Bs2ExitMode)
+ENDPROC   TMPL_NM(LeaveCpuMode)
+
+
+;;
+; Undo what LeaveCpuMode did.
+;
+; @uses     nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(EnterCpuMode)
+        jmp TMPL_NM(Bs2EnterMode_rm)
+ENDPROC   TMPL_NM(EnterCpuMode)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+%endif ; TMPL_HAVE_BIOS
+
+
+;;
+; Sets the global variable for the current CPU mode.
+;
+; @uses     nothing.
+;
+BEGINPROC TMPL_NM(SetCpuModeGlobals)
+%ifdef TMPL_CMN_PE
+ %ifdef BS2_INC_PE16
+        mov     word  [g_pfnPrintStrInternal_p16], PrintStr_pe16
+        mov     word  [g_pfnPrintChrInternal_p16], PrintChr_pe16
+ %endif
+ %ifdef BS2_INC_PE32
+        mov     dword [g_pfnPrintStrInternal_p32], PrintStr_pe32
+        mov     dword [g_pfnPrintChrInternal_p32], PrintChr_pe32
+ %endif
+
+%elifdef TMPL_CMN_PP
+ %ifdef BS2_INC_PP16
+        mov     word  [g_pfnPrintStrInternal_p16], PrintStr_pp16
+        mov     word  [g_pfnPrintChrInternal_p16], PrintChr_pp16
+ %endif
+ %ifdef BS2_INC_PP32
+        mov     dword [g_pfnPrintStrInternal_p32], PrintStr_pp32
+        mov     dword [g_pfnPrintChrInternal_p32], PrintChr_pp32
+ %endif
+
+%elifdef TMPL_CMN_PAE
+ %ifdef BS2_INC_PAE16
+        mov     word  [g_pfnPrintStrInternal_p16], PrintStr_pae16
+        mov     word  [g_pfnPrintChrInternal_p16], PrintChr_pae16
+ %endif
+ %ifdef BS2_INC_PAE32
+        mov     dword [g_pfnPrintStrInternal_p32], PrintStr_pae32
+        mov     dword [g_pfnPrintChrInternal_p32], PrintChr_pae32
+ %endif
+
+%elifdef TMPL_CMN_LM
+ %ifdef BS2_INC_LM16
+        mov     word  [g_pfnPrintStrInternal_p16], PrintStr_lm16
+        mov     word  [g_pfnPrintChrInternal_p16], PrintChr_lm16
+ %endif
+ %ifdef BS2_INC_LM32
+        mov     dword [g_pfnPrintStrInternal_p32], PrintStr_lm32
+        mov     dword [g_pfnPrintChrInternal_p32], PrintChr_lm32
+ %endif
+ %ifdef BS2_INC_LM64
+        mov     dword [g_pfnPrintStrInternal_p64], PrintStr_lm64
+        mov     dword [g_pfnPrintChrInternal_p64], PrintChr_lm64
+ %endif
+
+%elifdef TMPL_16BIT
+        mov     word [TMPL_NM_CMN(g_pfnPrintStrInternal)], TMPL_NM(PrintStr)
+        mov     word [TMPL_NM_CMN(g_pfnPrintChrInternal)], TMPL_NM(PrintChr)
+%else
+ %error "missing case"
+%endif
+        ret
+ENDPROC   TMPL_NM(SetCpuModeGlobals)
+
+
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines.mac
new file mode 100644
index 0000000..195b041
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines.mac
@@ -0,0 +1,222 @@
+; $Id: bootsector2-common-routines.mac $
+;; @file
+; Common bootsector routines.
+;
+; This is just a bit file with common code that can be included at the end of
+; a bootsector2-xxx.asm file.  Conventions (used elsewhere as well):
+;    - _rm    - real-mode function suffix.
+;    - _r86   - common real and virtual 8086 mode suffix.
+;    - _p16   - common 16-bit protected mode suffix.
+;    - _p32   - common 32-bit protected mode suffix.
+;    - _p64   - common 64-bit long mode suffix.
+;    - _pe16  - 16-bit unpaged protected mode suffix.
+;    - _pe32  - 32-bit unpaged protected mode suffix.
+;    - _pev86 - v8086 unpaged protected mode suffix.
+;    - _pp16  - 16-bit paged protected mode suffix.
+;    - _pp32  - 32-bit paged protected mode suffix.
+;    - _ppv86 - v8086 paged protected mode suffix.
+;    - _pae16 - 16-bit pae protected mode suffix.
+;    - _pae32 - 32-bit pae protected mode suffix.
+;    - _paev86- v8086 pae protected mode suffix.
+;    - _lm16  - 16-bit long mode suffix.
+;    - _lm32  - 32-bit long mode suffix.
+;    - _lm64  - 64-bit long mode suffix.
+;
+; The routines uses a custom register based calling convention for all cpu
+; modes so that the users can template multi mode code.  To make life easy for
+; the programmer all registers are preserved with the exception of rflags and
+; any return registers that may be used.  Routines that does not return
+; anything will only clobber eflags.
+;
+; The parameter register allocation order:
+;       rax, rdx, rcx, rbx, rsi, rdi(, r8, r9, r10, r11)
+;
+; When pointers are passed by 16-bit code, segments registers are allocated in
+; the following order:
+;       ds, es, fs, gs.
+;
+; The return register allocations are:
+;       - edx:eax for 64-bit values in 16 and 32-bit mode,
+;       - eax for 32-bit,
+;       - ax for 16-bit,
+;       - al for 8-bit.
+;
+; Routines may use other calling convensions will be named differently.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;*******************************************************************************
+;*      Structures and Typedefs                                                *
+;*******************************************************************************
+
+
+;*******************************************************************************
+;*      Global Variables                                                       *
+;*******************************************************************************
+BEGINCODELOW
+ALIGNDATA(32)
+;; Indicates whether the VMMDev is operational.
+GLOBALNAME g_fbBs2VMMDevTesting
+        db 1
+        db 0                            ; padding
+
+;; The test name (DS16:xxx).
+g_npszBs2Test:
+        dd 0
+;; The number of tests that have failed.
+g_uscBs2TestErrors:
+        dw 0
+;; The subtest name (DS16:xxx).
+g_npszBs2SubTest
+        dd 0
+;; The start error count of the current subtest.
+g_uscBs2SubTestAtErrors:
+        dw 0
+;; Whether we've reported the sub-test result or not.
+g_fbBs2SubTestReported:
+        db 0
+        db 0                            ; padding
+;; The number of sub tests.
+g_uscBs2SubTests:
+        dw 0
+;; The number of sub tests that failed.
+g_uscBs2SubTestsFailed:
+        dw 0
+
+
+;; VMMDEV_TESTING_UNIT_XXX -> string
+g_aszBs2TestUnitNames:
+        db 'i','n','v',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db '%',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'b','y','t','e','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'b','y','t','e','s','/','s',  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'K','B',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'K','B','/','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'M','B',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'M','B','/','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'p','a','c','k','e','t','s',  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'p','a','c','k','e','t','s','/','s',  0,  0,  0,  0,  0,  0,  0
+        db 'f','r','a','m','e','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'f','r','a','m','e','s','/',  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'o','c','c',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'o','c','c','/','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'r','n','d','t','r','p',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'c','a','l','l','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'c','a','l','l','s','/','s',  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 's',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'm','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'n','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'n','s','/','c','a','l','l',  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'n','s','/','f','r','a','m','e',  0,  0,  0,  0,  0,  0,  0,  0
+        db 'n','s','/','o','c','c',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'n','s','/','p','a','c','k','e','t',  0,  0,  0,  0,  0,  0,  0
+        db 'n','s','/','r','n','d','t','r','p',  0,  0,  0,  0,  0,  0,  0
+        db 'i','n','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'i','n','s','/','s',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 ; none
+        db 'p','p','1','k',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'p','p','1','0','k',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'p','p','m',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        db 'p','p','b',  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+        ;    0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  a,  b,  c,  d,  e,  f
+
+
+;
+; Instantiate the common template code.
+;
+%ifdef BS2_INC_CMN_R86
+ %define TMPL_RM
+ %include "bootsector2-common-routines-template-1.mac"
+%endif
+%ifdef BS2_INC_CMN_P16
+ %define TMPL_PE16
+ %include "bootsector2-common-routines-template-1.mac"
+%endif
+%ifdef BS2_INC_CMN_P32
+ %define TMPL_PE32
+ %include "bootsector2-common-routines-template-1.mac"
+%endif
+%ifdef BS2_INC_LM64
+ %define TMPL_LM64
+ %include "bootsector2-common-routines-template-1.mac"
+%endif
+
+;
+; Instantiate the mode specific code.
+;
+%ifdef BS2_INC_RM
+ %define TMPL_RM
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PE16
+ %define TMPL_PE16
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PE32
+ %define TMPL_PE32
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PEV86
+ %define TMPL_PEV86
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PP16
+ %define TMPL_PP16
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PP32
+ %define TMPL_PP32
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PPV86
+ %define TMPL_PPV86
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PAE16
+ %define TMPL_PAE16
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PAE32
+ %define TMPL_PAE32
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_PAEV86
+ %define TMPL_PAEV86
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_LM16
+ %define TMPL_LM16
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_LM32
+ %define TMPL_LM32
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+%ifdef BS2_INC_LM64
+ %define TMPL_LM64
+ %include "bootsector2-common-routines-template-2.mac"
+%endif
+
+BEGINCODELOW
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-traprec-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-traprec-template.mac
new file mode 100644
index 0000000..39c7bbb
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-traprec-template.mac
@@ -0,0 +1,105 @@
+; $Id: bootsector2-common-traprec-template.mac $
+;; @file
+; Boot sector 2 - Trap Records, Code Template.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%include "bootsector2-template-header.mac"
+
+
+;;
+; Internal worker for reporting a missing trap
+;
+; The callee cleans up the arguments on the stack.
+;
+; @param    [xBP + xCB*2]   bExpected   Expected exception number.
+; @param    [xBP + xCB*2+1] szExpected  The name of the exception (2 bytes + terminator).
+; @uses     None
+;
+BEGINPROC TMPL_NM_CMN(TestFailedMissingTrapInternal)
+        push    xBP
+        mov     xBP, xSP
+        pushf
+        push    sAX
+
+        movzx   eax, byte [xBP + xCB*2]
+        push    xAX
+        lea     sAX, [sBP + xCB*2+1]
+%ifdef TMPL_16BIT
+        push    ss
+%endif
+        push    xAX
+%ifdef TMPL_16BIT
+        push    cs
+%endif
+        push    .szFmt
+        call    TMPL_NM_CMN(TestFailedF)
+%ifdef TMPL_16BIT
+        add     xSP, xCB*5
+%else
+        add     xSP, xCB*3
+%endif
+
+        pop     sAX
+        popf
+        leave
+        ret     sCB
+.szFmt: db 'Missing trap #%s (%RX8)', 13, 10, 0
+ENDPROC   TMPL_NM_CMN(TestFailedMissingTrapInternal)
+
+%ifndef TestFailedMissingTrapTemplate_defined
+ ;;
+ ; Internal template.
+ %macro TestFailedMissingTrapTemplate 4
+   BEGINPROC TMPL_NM_CMN(TestFailedMissingTrap_%1)
+       push    dword RT_MAKE_U32_FROM_U8(%1, %2, %3, %4)
+       call    TMPL_NM_CMN(TestFailedMissingTrapInternal)
+       ret
+   ENDPROC   TMPL_NM_CMN(TestFailedMissingTrap_%1)
+ %endmacro
+ %define TestFailedMissingTrapTemplate_defined
+%endif
+
+TestFailedMissingTrapTemplate X86_XCPT_DE,  'D', 'E', 0
+TestFailedMissingTrapTemplate X86_XCPT_DB,  'D', 'B', 0
+TestFailedMissingTrapTemplate X86_XCPT_NMI, 'N', 'M', 0
+TestFailedMissingTrapTemplate X86_XCPT_BP,  'B', 'P', 0
+TestFailedMissingTrapTemplate X86_XCPT_OF,  'O', 'F', 0
+TestFailedMissingTrapTemplate X86_XCPT_BR,  'B', 'R', 0
+TestFailedMissingTrapTemplate X86_XCPT_UD,  'U', 'D', 0
+TestFailedMissingTrapTemplate X86_XCPT_NM,  'N', 'M', 0
+;TestFailedMissingTrapTemplate X86_XCPT_DF,  'D', 'F', 0
+;TestFailedMissingTrapTemplate X86_XCPT_CO_SEG_OVERRUN, 'C', 'O', 0
+TestFailedMissingTrapTemplate X86_XCPT_TS,  'T', 'S', 0
+TestFailedMissingTrapTemplate X86_XCPT_NP,  'N', 'P', 0
+TestFailedMissingTrapTemplate X86_XCPT_SS,  'S', 'S', 0
+TestFailedMissingTrapTemplate X86_XCPT_GP,  'G', 'P', 0
+TestFailedMissingTrapTemplate X86_XCPT_PF,  'P', 'F', 0
+TestFailedMissingTrapTemplate X86_XCPT_MF,  'M', 'F', 0
+TestFailedMissingTrapTemplate X86_XCPT_AC,  'A', 'C', 0
+;TestFailedMissingTrapTemplate X86_XCPT_MC,  'M', 'C', 0
+TestFailedMissingTrapTemplate X86_XCPT_XF,  'X', 'F', 0
+
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-common-traprec.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-common-traprec.mac
new file mode 100644
index 0000000..e613e41
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-common-traprec.mac
@@ -0,0 +1,199 @@
+; $Id: bootsector2-common-traprec.mac $
+;; @file
+; Boot sector 2 - Trap Records.
+;
+; @note Don't forget to cinldue bootsector2-common-traprec-end.mac!
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%ifndef ___bootsector2_common_traprec_mac___
+%define ___bootsector2_common_traprec_mac___
+
+
+;*******************************************************************************
+;*  Header Files                                                               *
+;*******************************************************************************
+%include "iprt/x86.mac"
+
+
+;*******************************************************************************
+;*  Defined Constants And Macros                                               *
+;*******************************************************************************
+;;
+; The base address for the records (only important for 64-bit code
+; loaded above 4GB).
+; We use 0 by default so we don't create too complex expressions for YASM.
+%ifndef BS2_TRAP_RECS_BASE
+ %define BS2_TRAP_RECS_BASE     0
+%endif
+
+;;
+; Macro to emit an trapping instruction.
+;
+; @param    1       The trap number (X86_XCPT_XXX).
+; @param    2       The error code, 0 if none.
+; @param    3+      The instruction.
+;
+; @sa BS2_TRAP_BRANCH_INSTR
+;
+%macro BS2_TRAP_INSTR 3+,
+        [section .traprecs]
+    istruc BS2TRAPREC
+        at BS2TRAPREC.offWhere,           dd (%%trapinstr - BS2_TRAP_RECS_BASE)
+        at BS2TRAPREC.offResumeAddend,    db (%%resume - %%trapinstr)
+        at BS2TRAPREC.u8TrapNo,           db %1
+        at BS2TRAPREC.u16ErrCd,           dw %2
+    iend
+        __SECT__
+ %if %1 != X86_XCPT_BP
+  %%trapinstr:
+        %3
+ %else
+        %3
+  %%trapinstr:
+ %endif
+        call    TMPL_NM_CMN(TestFailedMissingTrap_ %+ %1)
+ %%resume:
+%endmacro
+
+;;
+; Macro to emit an trapping instruction.
+;
+; @param    1       The trap number (X86_XCPT_XXX).
+; @param    2       The error code, 0 if none.
+; @param    3       The name of the branch label.
+; @param    4+      The instruction.
+;
+%macro BS2_TRAP_BRANCH_INSTR 4+,
+        [section .traprecs]
+    istruc BS2TRAPREC
+        at BS2TRAPREC.offWhere,           dd (%%trapinstr - BS2_TRAP_RECS_BASE)
+        at BS2TRAPREC.offResumeAddend,    db (%%resume - %%trapinstr)
+        at BS2TRAPREC.u8TrapNo,           db %1
+        at BS2TRAPREC.u16ErrCd,           dw %2
+    iend
+        __SECT__
+ %%trapinstr:
+        %4
+ %3:
+        call    TMPL_NM_CMN(TestFailedMissingTrap_ %+ %1)
+ %%resume:
+%endmacro
+
+;;
+; Sets up the trap records section.
+; @internal
+%macro BS2_TRAP_RECS_BEGIN 0,
+        [section .traprecs] ; Declared in bootsector2-common-init-code.mac
+        dq 0ffffffffeeeeeeeeh
+g_aTrapRecs:
+        __SECT__
+%endmacro
+
+;;
+; Terminates the trap records section.
+; @internal
+%macro BS2_TRAP_RECS_END 0,
+        [section .traprecs]
+g_aTrapRecsEnd:
+        dq 0ddddddddcccccccch
+        __SECT__
+%endmacro
+
+
+;;
+; Macro for installing the trap records.
+;
+; This must be invoked prior the the traps.
+;
+; @uses Stack
+;
+%macro BS2_TRAP_RECS_INSTALL 0,
+        push    sAX
+        push    sDX
+        push    sCX
+
+        mov     sAX, NAME(g_aTrapRecs)
+        mov     edx, NAME(g_aTrapRecsEnd) - NAME(g_aTrapRecs)
+        shr     edx, BS2TRAPREC_SIZE_SHIFT
+        mov     sCX, BS2_TRAP_RECS_BASE
+        call    TMPL_NM_CMN(TestInstallTrapRecs)
+
+        pop     sAX
+        pop     sDX
+        pop     sCX
+%endmacro
+
+
+;;
+; Macro for uninstalling the trap records.
+;
+; @uses Stack
+;
+%macro BS2_TRAP_RECS_UNINSTALL 0,
+        push    sAX
+        push    sDX
+        push    sCX
+
+        xor     sAX, sAX
+        xor     edx, edx
+        xor     sCX, sCX
+        call    TMPL_NM_CMN(TestInstallTrapRecs)
+
+        pop     sAX
+        pop     sDX
+        pop     sCX
+%endmacro
+
+
+;
+; Setup the trap record segment.
+;
+BS2_TRAP_RECS_BEGIN
+BEGINCODELOW
+
+
+;
+; Instantiate code templates.
+;
+%ifdef BS2_INC_CMN_R86
+ %define TMPL_RM
+ %include "bootsector2-common-traprec-template.mac"
+%endif
+%ifdef BS2_INC_CMN_P16
+ %define TMPL_PE16
+ %include "bootsector2-common-traprec-template.mac"
+%endif
+%ifdef BS2_INC_CMN_P32
+ %define TMPL_PE32
+ %include "bootsector2-common-traprec-template.mac"
+%endif
+%ifdef BS2_INC_LM64
+ %define TMPL_LM64
+ %include "bootsector2-common-traprec-template.mac"
+%endif
+
+BEGINCODELOW
+
+%endif
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-a20-1-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-a20-1-template.mac
new file mode 100644
index 0000000..a05c7f6
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-a20-1-template.mac
@@ -0,0 +1,375 @@
+; $Id: bootsector2-cpu-a20-1-template.mac $
+;; @file
+; bootsector2 A20 - multi mode template.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bootsector2-template-header.mac"
+
+
+;;
+; Inner loop dealing with one 64KB segment.
+;
+BEGINPROC TMPL_NM(TestA20_EnabledInner)
+.inner_loop:
+        mov     ah, [es:xDI]
+        mov     al, [ds:xSI]
+        cmp     al, ah
+        jne     .inner_next
+
+        not     al
+        mov     [es:xDI], al
+        cmp     al, [ds:xSI]
+        mov     [es:xDI], ah
+        je      .failed
+
+.inner_next:
+        inc     xDI
+        inc     xSI
+        dec     ecx
+        jnz     .inner_loop
+
+        clc
+        ret
+
+.failed:
+        push    sBX
+        push    sAX
+        push    sSI
+        push    sDI
+%ifdef TMPL_16BIT
+        push    cs
+%endif
+        push    .s_szModifiyError
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, sCB * 5
+        stc
+        ret
+.s_szModifiyError:
+        db      TMPL_MODE_STR, '- Same memory; EDI=%RX32 ESI=%RX32 EAX=%RX32 EBX=%RX32', 13, 10, 0
+ENDPROC   TMPL_NM(TestA20_EnabledInner)
+
+
+;;
+; Inner loop dealing with one 64KB segment.
+;
+BEGINPROC TMPL_NM(TestA20_DisabledInner)
+.inner_loop:
+        mov     ah, [es:xDI]
+        mov     al, [ds:xSI]
+        cmp     al, ah
+        jne     .failed1
+
+        not     al
+        mov     [es:xDI], al
+        cmp     al, [ds:xSI]
+        mov     [es:xDI], ah
+        jne     .failed2
+
+        inc     xDI
+        inc     xSI
+        dec     ecx
+        jnz     .inner_loop
+
+        clc
+        ret
+
+.failed1:
+        push    sCX
+        push    sBX
+        push    sAX
+        push    sSI
+        push    sDI
+%ifdef TMPL_16BIT
+        push    cs
+%endif
+        push    .s_szNotEqual
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, sCB * 6
+        stc
+        ret
+.s_szNotEqual:
+        db      TMPL_MODE_STR, ' - Not equal; EDI=%RX32 ESI=%RX32 EAX=%RX32 EBX=%RX32 ECX=%RX32', 13, 10, 0
+
+.failed2:
+        push    sCX
+        push    sBX
+        push    sAX
+        push    sSI
+        push    sDI
+%ifdef TMPL_16BIT
+        push    cs
+%endif
+        push    .s_szModifiyError
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, sCB * 6
+        stc
+        ret
+
+.s_szModifiyError:
+        db      TMPL_MODE_STR, ' - Modify error; EDI=%RX32 ESI=%RX32 EAX=%RX32 EBX=%RX32 ECX=%RX32', 13, 10, 0
+ENDPROC   TMPL_NM(TestA20_DisabledInner)
+
+
+;;
+; Scans memory calling sDX for each segment.
+;
+BEGINPROC TMPL_NM(TestA20_ScanMemory)
+        push    sAX
+        push    sBX
+        push    sCX
+        push    sDX
+        push    sSI
+        push    sDI
+        pushf
+        cli
+%ifdef TMPL_16BIT
+        push    es
+        push    ds
+%endif
+
+        ;
+        ; The outer loop walks a segment (64 KB) at a time.
+        ;
+        mov     ebx, _1M
+.outer_loop:
+
+        ; Set up the registers.
+%ifdef TMPL_CMN_R86
+        mov     ax,  0ffffh
+        mov     edi, 00010h
+        mov     es, ax
+        mov     ax,  00000h
+        mov     esi, 00000h
+        mov     ds, ax
+        mov     ecx, 01000h             ; at 101000 there is a VMMDevTesting MMIO page.
+%elifdef TMPL_16BIT
+        ;; @todo need a selector we can modify.
+        jmp     .done
+
+%else
+        mov     edi, ebx
+        mov     esi, ebx
+        and     esi, ~_1M
+        mov     ecx, _64K
+%endif
+%ifndef TMPL_CMN_R86
+        ; Should we skip this segment or only check parts of it?
+        cmp     esi, edi                ; affected by A20?
+        je      .outer_next
+
+%if BS2_PXX_LAST != 09ffffh
+ %error BS2_PXX_LAST does not have the expected value.
+%endif
+        cmp     ebx, BS2_PXX_BASE + _1M ; don't mess with page tables, stacks, MMIO or ROMs.
+        jb      .not_low_rom_mmio_region
+        cmp     ebx, _1M + _1M
+        jb      .outer_next
+.not_low_rom_mmio_region:
+
+        cmp     ebx, BS2_ADDR + _1M
+        ja      .not_bs2
+        mov     ecx, BS2_ADDR           ; don't overwrite our own code.
+.not_bs2:
+        cmp     ebx, _1M
+        jne     .not_VMMDevTestingMMIO
+        mov     ecx, 1000h              ; don't bother with the MMIO
+.not_VMMDevTestingMMIO:
+%endif ; TMPL_CMN_R86
+
+        ; Invoke the callback.
+        call    xDX
+        jc      .failure
+
+%ifndef TMPL_CMN_R86
+.outer_next:
+        add     ebx, _64K
+        cmp     ebx, 32*_1M
+        jbe     .outer_loop
+%endif
+
+.done:
+%ifdef TMPL_16BIT
+        pop     ds
+        pop     es
+%endif
+        popf
+        pop     sDI
+        pop     sSI
+        pop     sDX
+        pop     sCX
+        pop     sBX
+        pop     sAX
+        ret
+
+.failure:
+%if 1
+        cmp     ebx, _1M
+        je      .contine_at_next_MB
+        cmp     ebx, _2M
+        je      .contine_at_next_MB
+        cmp     ebx, _1M + _2M
+        je      .contine_at_next_MB
+        cmp     ebx, _4M
+        je      .contine_at_next_MB
+%endif
+        jmp     .done
+
+.contine_at_next_MB:
+        add     ebx, _1M
+        jmp     .outer_loop
+ENDPROC   TMPL_NM(TestA20_ScanMemory)
+
+
+BEGINPROC TMPL_NM(TestA20_Enabled)
+        push    sDX
+        mov     xDX, TMPL_NM(TestA20_EnabledInner)
+        call    TMPL_NM(TestA20_ScanMemory)
+        pop     sDX
+        ret
+ENDPROC   TMPL_NM(TestA20_Enabled)
+
+
+;;
+; Checks that the first 64KB at 1MB wraps is the same physical memory as at
+; address 0.
+;
+BEGINPROC TMPL_NM(TestA20_Disabled)
+        push    sDX
+        mov     xDX, TMPL_NM(TestA20_DisabledInner)
+        call    TMPL_NM(TestA20_ScanMemory)
+        pop     sDX
+        ret
+ENDPROC   TMPL_NM(TestA20_Disabled)
+
+
+BEGINPROC TMPL_NM(TestA20_FlushAll)
+        push    sAX
+        wbinvd
+        mov     sAX, cr3
+        mov     cr3, sAX
+        wbinvd
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM(TestA20_FlushAll)
+
+
+
+;;
+; Do the A20 tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(TestA20_rm)
+        push    eax
+
+        mov     ax, .s_szTestName
+        call    TestSub_r86
+
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .skip_not_supported
+
+        ;
+        ; Do tests with A20 enabled.
+        ;
+        call    Bs2EnableA20_r86
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+        call    TMPL_NM(TestA20_FlushAll)
+        call    TMPL_NM(TestA20_Enabled)
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+        call    TestSubErrorCount_r86
+        cmp     ax, 0
+        jne     .done
+
+        ;
+        ; Do tests with A20 disabled.
+        ;
+        call    Bs2DisableA20_r86
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+        call    TMPL_NM(TestA20_FlushAll)
+        call    TMPL_NM(TestA20_Disabled)
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+        call    TestSubErrorCount_r86
+        cmp     ax, 0
+        jne     .done
+
+%ifndef TMPL_CMN_V86
+        ;
+        ; Change A20 state without leaving and entering the CPU mode.
+        ;
+        call    Bs2EnableA20_r86
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+        call    TMPL_NM(TestA20_Enabled)
+
+        call    TMPL_NM_CMN(Bs2DisableA20)
+        call    TMPL_NM(TestA20_FlushAll)
+        call    TMPL_NM(TestA20_Disabled)
+
+        call    TMPL_NM_CMN(Bs2EnableA20)
+        call    TMPL_NM(TestA20_FlushAll)
+        call    TMPL_NM(TestA20_Enabled)
+
+        call    TMPL_NM_CMN(Bs2DisableA20)
+        call    TMPL_NM(TestA20_FlushAll)
+        call    TMPL_NM(TestA20_Disabled)
+
+        call    TMPL_NM_CMN(Bs2EnableA20)
+        call    TMPL_NM(TestA20_FlushAll)
+        call    TMPL_NM(TestA20_Enabled)
+
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+%endif ; !TMPL_CMN_V86
+
+.done:
+        call    Bs2DisableA20_r86
+.done1:
+        call    TestSubDone_r86
+
+        pop     eax
+        ret
+
+.skip_not_supported:
+        mov     eax, .s_szSkipNotSupported
+        call    TestSkipped_r86
+        jmp     .done1
+
+.s_szTestName:
+        db      TMPL_MODE_STR, 0
+.s_szSkipNotSupported:
+        db      TMPL_MODE_STR, ' is not supported by the CPU', 10, 13, 0
+ENDPROC TMPL_NM(TestA20_rm)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-a20-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-a20-1.asm
new file mode 100644
index 0000000..e35aa89
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-a20-1.asm
@@ -0,0 +1,376 @@
+; $Id: bootsector2-cpu-a20-1.asm $
+;; @file
+; Bootsector that checks the A20 emulation.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+;
+; Include and execute the init code.
+;
+%define BS2_WITH_TRAPS
+%define BS2_INIT_RM
+%define BS2_INC_PE16
+%define BS2_INC_PE32
+%define BS2_INC_PP32
+%define BS2_INC_PAE32
+%define BS2_INC_LM64
+%include "bootsector2-common-init-code.mac"
+
+
+;
+; The benchmark driver
+;
+BEGINPROC main
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+
+        ;
+        ; The actual tests.
+        ;
+        call    TestA20_1               ; must come first
+        call    TestA20_rm_rm
+        ;call    TestA20_rm_pe16
+        call    TestA20_rm_pe32
+        call    TestA20_rm_pp32
+        ;call    TestA20_rm_pp16
+        call    TestA20_rm_pae32
+        call    TestA20_rm_lm64
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        call    Bs2Panic
+
+.s_szTstName:
+        db      'tstA20-1', 0
+.s_szInitialA20Status:
+        db      'Initial A20 state', 0
+ENDPROC   main
+
+
+;
+; Do some initial tests.
+;
+BEGINPROC TestA20_1
+        push    eax
+        push    edx
+        push    ecx
+        push    ebx
+        push    edi
+
+        ;
+        ; Check that the A20 gate is disabled when we come from the BIOS.
+        ;
+        mov     ax, .s_szInitialA20Status
+        call    TestSub_r86
+
+        call    IsA20GateEnabled_rm
+        mov     di, ax                  ; save A20 state in AX for bios test.
+        cmp     al, 0
+        je      .initial_state_done
+        mov     ax, .s_szBadInitialA20Status
+        call    TestFailed_r86
+        jmp     .initial_state_done
+.s_szInitialA20Status:
+        db      'Initial A20 state', 0
+.s_szBadInitialA20Status:
+        db      'Initial A20 state is enabled, expected disabled', 10, 13, 0
+.initial_state_done:
+        call    TestSubDone_r86
+
+        ;
+        ; Disable it via the BIOS interface and check.
+        ;
+        mov     ax, .s_szBios
+        call    TestSub_r86
+
+        ; query support
+        mov     ax, 2403h
+        int     15h
+        jnc     .bios_2403_ok
+        movzx   edx, ax
+        mov     ax, .s_szBios2403Error
+        mov     cl, VMMDEV_TESTING_UNIT_NONE
+        call    TestValueU32_r86
+        jmp     .bios_2403_done
+.bios_2403_ok:
+        movzx   edx, al
+        mov     ax, .s_szBios2403Mask
+        mov     cl, VMMDEV_TESTING_UNIT_NONE
+        call    TestValueU32_r86
+.bios_2403_done:
+
+        ; Check what the bios thinks the state is.
+        call    BiosIsA20GateEnabled_rm
+        cmp     ax, di
+        je      .bios_2402_done
+        push    di
+        push    ax
+        push    word ds
+        push    word .s_szBios2402Error
+        call    TestFailedF_r86
+        add     sp, 8
+.bios_2402_done:
+
+        ; Loop to make sure we get all transitions and ends up with A20 disabled.
+        mov     cx, 10h
+.bios_loop:
+        ; enable it
+        mov     ax, 2401h
+        push    cx                      ; paranoia that seems necessary for at least one AMI bios.
+        int     15h
+        pop     cx
+        jnc     .bios_continue1
+        mov     ax, .s_szBiosFailed2401
+        jmp     .bios_failed
+.bios_continue1:
+
+        call    IsA20GateEnabled_rm
+        cmp     al, 1
+        je      .bios_continue2
+        mov     ax, .s_szBiosEnableFailed
+        jmp     .bios_failed
+.bios_continue2:
+
+        ; disable
+        mov     ax, 2400h
+        push    cx                      ; paranoia that seems necessary for at least one AMI bios.
+        int     15h
+        pop     cx
+        jnc     .bios_continue3
+        mov     ax, .s_szBiosFailed2400
+        jmp     .bios_failed
+.bios_continue3:
+        call    IsA20GateEnabled_rm
+        cmp     al, 0
+        je      .bios_continue4
+        mov     ax, .s_szBiosDisableFailed
+        jmp     .bios_failed
+.bios_continue4:
+
+        loop    .bios_loop
+        jmp     .bios_done
+.s_szBios:
+        db      'INT 15h AH=24 A20 Gate interface', 0
+.s_szBios2403Mask:
+        db      'AX=2403 return (AL)', 0
+.s_szBios2403Error:
+        db      'AX=2403 error (AX)', 10, 13,  0
+.s_szBios2402Error:
+        db      '2402h -> AX=%RX16 expected %RX16', 10, 13, 0
+.s_szBiosFailed2400:
+        db      '2400h interface failed', 10, 13, 0
+.s_szBiosFailed2401:
+        db      '2401h interface failed', 10, 13, 0
+.s_szBiosDisableFailed:
+        db      'BIOS failed to disable A20 (or bad CPU)', 10, 13, 0
+.s_szBiosEnableFailed:
+        db      'BIOS failed to enable A20', 10, 13, 0
+.bios_failed:
+        call    TestFailed_r86
+.bios_done:
+        call    TestSubDone_r86
+        call    Bs2DisableA20ViaPortA_r86
+        call    Bs2DisableA20ViaKbd_r86
+
+        ;
+        ; Test the fast A20 gate interface.
+        ;
+        mov     ax, .s_szFastA20
+        call    TestSub_r86
+
+        mov     cx, 10h
+.fast_loop:
+        call    Bs2EnableA20ViaPortA_r86
+        call    IsA20GateEnabled_rm
+        cmp     al, 1
+        mov     ax, .s_szFastEnableFailed
+        jne     .fast_failed
+
+        call    Bs2DisableA20ViaPortA_r86
+        call    IsA20GateEnabled_rm
+        cmp     al, 0
+        mov     ax, .s_szFastDisableFailed
+        jne     .fast_failed
+        loop    .fast_loop
+
+        jmp     .fast_done
+.s_szFastA20:
+        db      'Fast A20 Gate Interface', 0
+.s_szFastDisableFailed:
+        db      'Fast A20 gate disabling failed', 10, 13, 0
+.s_szFastEnableFailed:
+        db      'Fast A20 gate enabling failed', 10, 13, 0
+.fast_failed:
+        call    TestFailed_r86
+.fast_done:
+        call    TestSubDone_r86
+        call    Bs2DisableA20ViaPortA_r86
+        call    Bs2DisableA20ViaKbd_r86
+
+        ;
+        ; Test the keyboard interface.
+        ;
+        mov     ax, .s_szKeyboardA20
+        call    TestSub_r86
+
+        mov     cx, 10h
+.kbd_loop:
+        call    Bs2EnableA20ViaKbd_r86
+        call    IsA20GateEnabled_rm
+        cmp     al, 1
+        mov     ax, .s_szKbdEnableFailed
+        jne     .kbd_failed
+
+        call    Bs2DisableA20ViaKbd_r86
+        call    IsA20GateEnabled_rm
+        cmp     al, 0
+        mov     ax, .s_szKbdDisableFailed
+        jne     .kbd_failed
+        loop    .kbd_loop
+
+        jmp     .kbd_done
+.s_szKeyboardA20:
+        db      'Keyboard A20 Gate Interface', 0
+.s_szKbdDisableFailed:
+        db      'Disabling the A20 gate via the keyboard controller failed', 10, 13, 0
+.s_szKbdEnableFailed:
+        db      'Enabling the A20 gate via the keyboard controller failed', 10, 13, 0
+.kbd_failed:
+        call    TestFailed_r86
+.kbd_done:
+        call    TestSubDone_r86
+        call    Bs2DisableA20ViaPortA_r86
+        call    Bs2DisableA20ViaKbd_r86
+
+        pop     edi
+        pop     ebx
+        pop     ecx
+        pop     edx
+        pop     eax
+        ret
+ENDPROC   TestA20_1
+
+
+;;
+; Checks if the A20 gate is enabled.
+;
+; This is do by temporarily changing a word at address 0000000h and see if this
+; is reflected at address 0100000h (1 MB).  The word written is
+; ~*(word *)0x100000h to make sure it won't accidentally match.
+;
+; @returns ax   1 if enabled, 0 if disabled.
+;
+BEGINPROC IsA20GateEnabled_rm
+        push    ds
+        push    es
+        push    dx
+        pushf
+        cli
+
+.once_again:
+        xor     ax, ax
+        mov     ds, ax
+        dec     ax
+        mov     es, ax
+
+        mov     ax, [es:0010h]          ; 0ffff:0010 => 0100000h (1 MB)
+        mov     dx, [ds:0000h]          ; 00000:0000 => 0000000h - save it
+        not     ax
+        mov     [ds:0000h], ax          ; 0000000h - write ~[0100000h]
+        cmp     [es:0010h], ax          ; 0100000h - same as 0000000h if A20 is disabled.
+        mov     [ds:0000h], dx          ; 0000000h - restore original value
+        setne   al
+        movzx   ax, al
+
+        popf
+        pop     dx
+        pop     es
+        pop     ds
+        ret
+ENDPROC   IsA20GateEnabled_rm
+
+;;
+; Checks if the BIOS thinks the A20 gate is enabled.
+;
+; @returns ax   1 if enabled, 0 if disabled.
+;
+BEGINPROC BiosIsA20GateEnabled_rm
+        push    ecx
+        push    eax
+
+        mov     ax, 2402h
+        int     15h
+        jnc     .ok
+        mov      al, 080h
+.ok:
+        mov     cx, ax
+        pop     eax
+        mov     ax, cx
+        pop     ecx
+        ret
+ENDPROC   BiosIsA20GateEnabled_rm
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+%define TMPL_RM
+%include "bootsector2-cpu-a20-1-template.mac"
+;%define TMPL_CMN_V86
+;%include "bootsector2-cpu-a20-1-template.mac"
+%define TMPL_PE16
+%include "bootsector2-cpu-a20-1-template.mac"
+%define TMPL_PE32
+%include "bootsector2-cpu-a20-1-template.mac"
+;%define TMPL_PP16
+;%include "bootsector2-cpu-a20-1-template.mac"
+%define TMPL_PP32
+%include "bootsector2-cpu-a20-1-template.mac"
+;%define TMPL_PAE16
+;%include "bootsector2-cpu-a20-1-template.mac"
+%define TMPL_PAE32
+%include "bootsector2-cpu-a20-1-template.mac"
+;%define TMPL_LM16
+;%include "bootsector2-cpu-a20-1-template.mac"
+;%define TMPL_LM32
+;%include "bootsector2-cpu-a20-1-template.mac"
+%define TMPL_LM64
+%include "bootsector2-cpu-a20-1-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-basic-1-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-basic-1-template.mac
new file mode 100644
index 0000000..5c07907
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-basic-1-template.mac
@@ -0,0 +1,74 @@
+; $Id: bootsector2-cpu-basic-1-template.mac $
+;; @file
+; bootsector2 basic #1 - multi mode template.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bootsector2-template-header.mac"
+
+
+;;
+; Do the tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(TestBasic1_rm)
+        push    eax
+
+        mov     ax, .s_szTestName
+        call    TestSub_r86
+
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .skip_not_supported
+
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+        ; Later, currently just getting thru the mode switch is good enough.
+        nop
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+.done1:
+        call    TestSubDone_r86
+
+        pop     eax
+        ret
+
+.skip_not_supported:
+        mov     eax, .s_szSkipNotSupported
+        call    TestSkipped_r86
+        jmp     .done1
+
+.s_szTestName:
+        db      TMPL_MODE_STR, 0
+.s_szSkipNotSupported:
+        db      TMPL_MODE_STR, ' is not supported by the CPU', 10, 13, 0
+ENDPROC TMPL_NM(TestBasic1_rm)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-basic-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-basic-1.asm
new file mode 100644
index 0000000..d73c2da
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-basic-1.asm
@@ -0,0 +1,119 @@
+; $Id: bootsector2-cpu-basic-1.asm $
+;; @file
+; Bootsector that checks the basic CPU operation.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+;
+; Include and execute the init code.
+;
+%define BS2_WITH_TRAPS
+%define BS2_INIT_RM
+%define BS2_INC_PE16
+%define BS2_INC_PE32
+%define BS2_INC_PP16
+%define BS2_INC_PP32
+%define BS2_INC_PAE32
+%define BS2_INC_PAE16
+%define BS2_INC_LM16
+%define BS2_INC_LM32
+%define BS2_INC_LM64
+%include "bootsector2-common-init-code.mac"
+
+
+;
+; The benchmark driver
+;
+BEGINPROC main
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+
+        ;
+        ; The actual tests.
+        ;
+        call    TestBasic1_rm_rm
+        call    TestBasic1_rm_pe16
+        call    TestBasic1_rm_pe32
+        call    TestBasic1_rm_pp32
+        call    TestBasic1_rm_pp16
+        call    TestBasic1_rm_pae16
+        call    TestBasic1_rm_pae32
+        call    TestBasic1_rm_lm64
+        call    TestBasic1_rm_lm32
+        call    TestBasic1_rm_lm16
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        call    Bs2Panic
+
+.s_szTstName:
+        db      'tstBasic1-1', 0
+.s_szInitialBasic1Status:
+        db      'Initial Basic1 state', 0
+ENDPROC   main
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+%define TMPL_RM
+%include "bootsector2-cpu-basic-1-template.mac"
+;%define TMPL_CMN_V86
+;%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_PE16
+%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_PE32
+%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_PP16
+%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_PP32
+%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_PAE16
+%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_PAE32
+%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_LM16
+%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_LM32
+%include "bootsector2-cpu-basic-1-template.mac"
+%define TMPL_LM64
+%include "bootsector2-cpu-basic-1-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-hidden-regs-1-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-hidden-regs-1-template.mac
new file mode 100644
index 0000000..f3f4799
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-hidden-regs-1-template.mac
@@ -0,0 +1,342 @@
+; $Id: bootsector2-cpu-hidden-regs-1-template.mac $
+;; @file
+; bootsector2 hidden CPU registers - multi mode template.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bootsector2-template-header.mac"
+
+;;
+; Helper for reporting several register values at in a sequence.
+;
+BEGINPROC TMPL_NM(TestValueRegSZZ)
+        push    sAX
+        push    sBX
+
+        mov     xBX, xAX
+.next:
+        mov     xAX, xBX
+        call    TMPL_NM_CMN(TestValueReg)
+.inner_next:
+        inc     xBX
+        cmp     byte [xBX], 0
+        jne     .inner_next
+
+        inc     xBX
+        cmp     byte [xBX], 0
+        je      .done
+        jmp     .next
+
+.done
+        pop     sBX
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM(TestValueRegSZZ)
+
+;;
+; Tests various LDTR values
+;
+BEGINPROC TMPL_NM(doLdtrTests)
+        push    sAX
+
+        ; The inital LDT.
+        mov     sAX, .szLdtrInitial
+        call    TMPL_NM(TestValueRegSZZ)
+
+        ; Load our LDT
+        mov     eax, BS2_SEL_LDT
+        lldt    ax
+        mov     sAX, .szLdtrValid
+        call    TMPL_NM(TestValueRegSZZ)
+
+        ; NULL LDTR.
+        xor     eax, eax
+        lldt    ax
+        mov     sAX, .szLdtr0
+        call    TMPL_NM(TestValueRegSZZ)
+
+        ; NULL(1) LDTR.
+        mov     eax, 1
+        lldt    ax
+        mov     sAX, .szLdtr1
+        call    TMPL_NM(TestValueRegSZZ)
+
+        ; NULL(2) LDTR.
+        mov     eax, 2
+        lldt    ax
+        mov     sAX, .szLdtr2
+        call    TMPL_NM(TestValueRegSZZ)
+
+        ; NULL(3) LDTR.
+        mov     eax, 3
+        lldt    ax
+        mov     sAX, .szLdtr3
+        call    TMPL_NM(TestValueRegSZZ)
+
+.done
+        pop     sAX
+        ret
+
+.szLdtrInitial:
+        db      'LDTR(Initial) sel:ldtr', 0
+        db      'LDTR(Initial) base:ldtr_base', 0
+        db      'LDTR(Initial) limit:ldtr_lim', 0
+        db      'LDTR(Initial) attr:ldtr_attr', 0
+        db      0
+.szLdtrValid:
+        db      'LDTR(Valid) sel:ldtr', 0
+        db      'LDTR(Valid) base:ldtr_base', 0
+        db      'LDTR(Valid) limit:ldtr_lim', 0
+        db      'LDTR(Valid) attr:ldtr_attr', 0
+        db      0
+.szLdtr0:
+        db      'LDTR(0) sel:ldtr', 0
+        db      'LDTR(0) base:ldtr_base', 0
+        db      'LDTR(0) limit:ldtr_lim', 0
+        db      'LDTR(0) attr:ldtr_attr', 0
+        db      0
+.szLdtr1:
+        db      'LDTR(1) sel:ldtr', 0
+        db      'LDTR(1) base:ldtr_base', 0
+        db      'LDTR(1) limit:ldtr_lim', 0
+        db      'LDTR(1) attr:ldtr_attr', 0
+        db      0
+.szLdtr2:
+        db      'LDTR(2) sel:ldtr', 0
+        db      'LDTR(2) base:ldtr_base', 0
+        db      'LDTR(2) limit:ldtr_lim', 0
+        db      'LDTR(2) attr:ldtr_attr', 0
+        db      0
+.szLdtr3:
+        db      'LDTR(3) sel:ldtr', 0
+        db      'LDTR(3) base:ldtr_base', 0
+        db      'LDTR(3) limit:ldtr_lim', 0
+        db      'LDTR(3) attr:ldtr_attr', 0
+        db      0
+ENDPROC   TMPL_NM(doLdtrTests)
+
+
+;;
+; Tests various LDTR values
+;
+BEGINPROC TMPL_NM(doTrTests)
+        push    sAX
+
+        ; Initial TR values.
+        mov     sAX, .szTrInitial
+        call    TMPL_NM(TestValueRegSZZ)
+        jmp     .next1
+.szTrInitial:
+        db      'TR(Initial) sel:tr', 0
+        db      'TR(Initial) base:tr_base', 0
+        db      'TR(Initial) limit:tr_lim', 0
+        db      'TR(Initial) attr:tr_attr', 0
+        db      0
+.next1:
+
+        ; Our TR.
+%ifdef TMPL_CMN_LM
+        mov     ax, BS2_SEL_TSS64
+        ltr     ax
+        mov     sAX, .szTrTss64
+        call    TMPL_NM(TestValueRegSZZ)
+        jmp     .next2
+.szTrTss64:
+        db      'TR(64) sel:tr', 0
+        db      'TR(64) base:tr_base', 0
+        db      'TR(64) limit:tr_lim', 0
+        db      'TR(64) attr:tr_attr', 0
+        db      0
+
+%elifdef TMPL_PP32
+        mov     ax, BS2_SEL_TSS32
+        ltr     ax
+        mov     sAX, .szTrTss32
+        call    TMPL_NM(TestValueRegSZZ)
+        jmp     .next2
+.szTrTss32:
+        db      'TR(32) sel:tr', 0
+        db      'TR(32) base:tr_base', 0
+        db      'TR(32) limit:tr_lim', 0
+        db      'TR(32) attr:tr_attr', 0
+        db      0
+;%elifdef TMPL_PP16
+;        mov     ax, BS2_SEL_TSS16
+;        mov     sAX, .szTrTss16
+;        call    TMPL_NM(TestValueRegSZZ)
+%endif
+.next2:
+
+        ; Note! Loading 0 into TR is not possible, unlike with LDTR.
+
+.done
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM(doTrTests)
+
+
+;;
+; Test loading of NULL selectors.
+;
+BEGINPROC TMPL_NM(doNullSelTests)
+        push    sAX
+        push    xBX
+        push    gs
+
+        mov     ax, ss
+        mov     gs, ax
+        mov     sAX, .szGsSs
+        call    TMPL_NM(TestValueRegSZZ)
+
+        xor     eax, eax
+        mov     gs, ax
+        mov     sAX, .szGs0
+        call    TMPL_NM(TestValueRegSZZ)
+
+        mov     ax, 3
+        mov     gs, ax
+        mov     sAX, .szGs3
+        call    TMPL_NM(TestValueRegSZZ)
+
+%ifdef TMPL_64BIT
+        pushf
+        cli
+        mov     bx, ss
+        mov     ax, 0
+        mov     ss, ax
+        mov     sAX, .szSs0
+        call    TMPL_NM(TestValueRegSZZ)
+        mov     ss, bx
+        popf
+
+        call    TMPL_NM_CMN(Bs2ToRing2)
+        mov     bx, ss
+        mov     ax, 2
+        mov     ss, ax
+        mov     sAX, .szSs1Ring2
+        call    TMPL_NM(TestValueRegSZZ)
+        mov     ss, bx
+
+        test    byte [g_fCpuAmd], 1
+        jz      .not_amd
+        mov     ax, 3
+        mov     ss, ax
+        mov     sAX, .szSs3Ring2
+        call    TMPL_NM(TestValueRegSZZ)
+
+.not_amd:
+        call    TMPL_NM_CMN(Bs2ToRing0)
+
+%endif
+
+        pop     gs
+        pop     xBX
+        pop     sAX
+        ret
+
+.szGsSs:
+        db      'GS(ss) sel:gs', 0
+        db      'GS(ss) base:gs_base', 0
+        db      'GS(ss) limit:gs_lim', 0
+        db      'GS(ss) attr:gs_attr', 0
+        db      0
+.szGs0:
+        db      'GS(0) sel:gs', 0
+        db      'GS(0) base:gs_base', 0
+        db      'GS(0) limit:gs_lim', 0
+        db      'GS(0) attr:gs_attr', 0
+        db      0
+.szGs3:
+        db      'GS(3) sel:gs', 0
+        db      'GS(3) base:gs_base', 0
+        db      'GS(3) limit:gs_lim', 0
+        db      'GS(3) attr:gs_attr', 0
+        db      0
+%ifdef TMPL_64BIT
+.szSs0:
+        db      'SS(0) sel:ss', 0
+        db      'SS(0) base:ss_base', 0
+        db      'SS(0) limit:ss_lim', 0
+        db      'SS(0) attr:ss_attr', 0
+        db      0
+.szSs1Ring2
+        db      'ring-2 SS(2) sel:ss', 0
+        db      'ring-2 SS(2) base:ss_base', 0
+        db      'ring-2 SS(2) limit:ss_lim', 0
+        db      'ring-2 SS(2) attr:ss_attr', 0
+        db      0
+.szSs3Ring2
+        db      'ring-2 SS(3) sel:ss', 0
+        db      'ring-2 SS(3) base:ss_base', 0
+        db      'ring-2 SS(3) limit:ss_lim', 0
+        db      'ring-2 SS(3) attr:ss_attr', 0
+        db      0
+%endif
+ENDPROC   TMPL_NM(doNullSelTests)
+
+
+BEGINPROC TMPL_NM(doTestsWorker)
+        push    sAX
+
+        mov     xAX, .s_szSubTest
+        call    TMPL_NM_CMN(TestSub)
+        call    TMPL_NM(doLdtrTests)
+        call    TMPL_NM(doTrTests)
+        call    TMPL_NM(doNullSelTests)
+
+.done
+        pop     sAX
+        ret
+
+.s_szSubTest:
+        db      TMPL_MODE_STR, 0
+ENDPROC   TMPL_NM(doTestsWorker)
+
+
+;;
+; Do the tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(doTests_rm)
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+
+        call    TMPL_NM(doTestsWorker)
+
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+.done:
+        ret
+ENDPROC TMPL_NM(doTests_rm)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-hidden-regs-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-hidden-regs-1.asm
new file mode 100644
index 0000000..9f06720
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-hidden-regs-1.asm
@@ -0,0 +1,275 @@
+; $Id: bootsector2-cpu-hidden-regs-1.asm $
+;; @file
+; Bootsector that shows/tests the content of hidden CPU registers.
+;
+; Requires VMMDevTesting. Enable it via VBoxManage:
+;   VBoxManage setextradata bs-cpu-hidden-regs-1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+;
+; Include and execute the init code.
+;
+        %define BS2_INIT_RM
+        %define BS2_INC_PE16
+        %define BS2_INC_PE32
+        %define BS2_INC_PP32
+        %define BS2_INC_LM64
+        %define BS2_WITH_TRAPS
+        %define BS2_WITH_MANUAL_LTR
+        %include "bootsector2-common-init-code.mac"
+
+
+;
+; The benchmark driver
+;
+BEGINPROC main
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+        call    Bs2EnableA20_r86
+        call    Bs2PanicIfVMMDevTestingIsMissing_r86
+
+        call    reportPostBiosValues
+        call    rmTests
+        call    doTests_rm_pe32
+        call    doTests_rm_pp32
+        call    doTests_rm_lm64
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        call    Bs2Panic
+
+.s_szTstName:
+        db      'tstCpuHidRegs', 0
+ENDPROC   main
+
+
+;
+; Reports the values of interesting hidden registers as we start the test, i.e.
+; right after the BIOS completed.
+;
+BEGINPROC reportPostBiosValues
+        push    ax
+        push    bx
+        mov     ax, .s_szTstInitial
+        call    TestSub_r86
+
+        mov     ax, .s_szzStart
+        call    TestValueRegSZZ_rm
+
+.done
+        pop     bx
+        pop     ax
+        ret
+
+.s_szzStart:
+        db      'BIOS - ldtr:ldtr', 0;
+        db      'BIOS - ldtr_base:ldtr_base', 0;
+        db      'BIOS - ldtr_limit:ldtr_lim', 0;
+        db      'BIOS - ldtr_attr:ldtr_attr', 0;
+        db      'BIOS - tr:tr', 0;
+        db      'BIOS - tr_base:tr_base', 0;
+        db      'BIOS - tr_limit:tr_lim', 0;
+        db      'BIOS - tr_attr:tr_attr', 0;
+        db      'BIOS - cs:cs', 0;
+        db      'BIOS - cs_base:cs_base', 0;
+        db      'BIOS - cs_limit:cs_lim', 0;
+        db      'BIOS - cs_attr:cs_attr', 0;
+        db      'BIOS - ss:ss', 0;
+        db      'BIOS - ss_base:ss_base', 0;
+        db      'BIOS - ss_limit:ss_lim', 0;
+        db      'BIOS - ss_attr:ss_attr', 0;
+        db      'BIOS - ds:ds', 0;
+        db      'BIOS - ds_base:ds_base', 0;
+        db      'BIOS - ds_limit:ds_lim', 0;
+        db      'BIOS - ds_attr:ds_attr', 0;
+        db      0,0,0,0 ; terminator
+.s_szTstInitial:
+        db      'Post BIOS Values', 0
+ENDPROC   reportPostBiosValues
+
+
+;
+; Reports the values of interesting hidden registers as we start the test, i.e.
+; right after the BIOS completed.
+;
+BEGINPROC rmTests
+        push    eax
+        push    ebx
+        pushfd
+        cli
+
+        mov     ax, .s_szTstRM
+        call    TestSub_r86
+
+        ; Check if CS changes when leaving protected mode.
+        mov     ax, .s_szzRMPre
+        call    TestValueRegSZZ_rm
+        mov     byte [cs:.s_dwDummy], 1
+        call    Bs2EnterMode_rm_pe32
+BITS 32
+        mov     eax, .s_szzProt32
+        call    TestValueRegSZZ_pe32
+        ; mov     word [cs:.s_dwDummy], 2 - this shall GP(CS).
+        call    Bs2ExitMode_pe32
+BITS 16
+        mov     ax, .s_szzRMPost
+        call    TestValueRegSZZ_rm
+        mov     dword [cs:.s_dwDummy], 3
+
+        ;
+        ; What happens if we make CS32 execute-only and return to real-mode.
+        ;
+        mov     byte [cs:.s_dwDummy], 1
+        call    Bs2EnterMode_rm_pe16
+        jmp     BS2_SEL_CS16_EO:.loaded_cs16_eo
+.loaded_cs16_eo:
+        mov     eax, .s_szzProtEO
+        call    TestValueRegSZZ_pe16
+        ; mov     ax, word [cs:.s_dwDummy] - this shall GP(CS).
+        ; mov     word [cs:.s_dwDummy], 2 - this shall GP(CS).
+
+        ; Leave real-mode ourselves.
+        mov     eax, cr0
+        and     eax, ~X86_CR0_PE
+        mov     cr0, eax
+
+        ; All but cs gets reloaded.
+        xor     ax, ax
+        mov     ss, ax
+        mov     ds, ax
+        mov     es, ax
+        mov     fs, ax
+        mov     gs, ax
+
+        ; Display CS and do a test.
+        mov     ax, .s_szzRMEO
+        call    TestValueRegSZZ_rm
+
+        mov     ax, [cs:.s_dwDummy]      ; works on intel
+        mov     dword [cs:.s_dwDummy], 3 ; ditto
+
+        jmp     far 0000:.load_rm_cs
+.load_rm_cs:
+        ; Display CS to check that it remained unchanged.
+        mov     ax, .s_szzRMEO2
+        call    TestValueRegSZZ_rm
+
+        ; Cleanup everything properly.
+        call    Bs2EnterMode_rm_pe32
+BITS 32
+        call    Bs2ExitMode_pe32
+BITS 16
+
+        popfd
+        pop     ebx
+        pop     eax
+        ret
+
+.s_dwDummy:
+        dd      0
+.s_szzRMPre:
+        db      'RM Pre  - cs:cs', 0;
+        db      'RM Pre  - cs_base:cs_base', 0;
+        db      'RM Pre  - cs_limit:cs_lim', 0;
+        db      'RM Pre  - cs_attr:cs_attr', 0;
+        db      0,0,0,0 ; terminator
+.s_szzProt32:
+        db      'Prot32  - cs:cs', 0;
+        db      'Prot32  - cs_base:cs_base', 0;
+        db      'Prot32  - cs_limit:cs_lim', 0;
+        db      'Prot32  - cs_attr:cs_attr', 0;
+        db      0,0,0,0 ; terminator
+.s_szzRMPost:
+        db      'RM Post - cs:cs', 0;
+        db      'RM Post - cs_base:cs_base', 0;
+        db      'RM Post - cs_limit:cs_lim', 0;
+        db      'RM Post - cs_attr:cs_attr', 0;
+        db      0,0,0,0 ; terminator
+.s_szzProtEO:
+        db      'Prot 16 EO,L-1,NA - cs:cs', 0;
+        db      'Prot 16 EO,L-1,NA - cs_base:cs_base', 0;
+        db      'Prot 16 EO,L-1,NA - cs_limit:cs_lim', 0;
+        db      'Prot 16 EO,L-1,NA - cs_attr:cs_attr', 0;
+        db      0,0,0,0 ; terminator
+.s_szzRMEO:
+        db      'RM Post EO,L-1,NA - cs:cs', 0;
+        db      'RM Post EO,L-1,NA - cs_base:cs_base', 0;
+        db      'RM Post EO,L-1,NA - cs_limit:cs_lim', 0;
+        db      'RM Post EO,L-1,NA - cs_attr:cs_attr', 0;
+        db      0,0,0,0 ; terminator
+.s_szzRMEO2:
+        db      'RM CS(0) EO,L-1  - cs:cs', 0;
+        db      'RM CS(0) EO,L-1  - cs_base:cs_base', 0;
+        db      'RM CS(0) EO,L-1  - cs_limit:cs_lim', 0;
+        db      'RM CS(0) EO,L-1  - cs_attr:cs_attr', 0;
+        db      0,0,0,0 ; terminator
+.s_szTstRM:
+        db      'Real Mode Test', 0
+ENDPROC   rmTests
+
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+%define TMPL_RM
+%include "bootsector2-cpu-hidden-regs-1-template.mac"
+;%define TMPL_CMN_V86
+;%include "bootsector2-cpu-hidden-regs-1-template.mac"
+%define TMPL_PE16
+%include "bootsector2-cpu-hidden-regs-1-template.mac"
+%define TMPL_PE32
+%include "bootsector2-cpu-hidden-regs-1-template.mac"
+;%define TMPL_PP16
+;%include "bootsector2-cpu-hidden-regs-1-template.mac"
+%define TMPL_PP32
+%include "bootsector2-cpu-hidden-regs-1-template.mac"
+;%define TMPL_PAE16
+;%include "bootsector2-cpu-hidden-regs-1-template.mac"
+;%define TMPL_PAE32
+;%include "bootsector2-cpu-hidden-regs-1-template.mac"
+;%define TMPL_LM16
+;%include "bootsector2-cpu-hidden-regs-1-template.mac"
+;%define TMPL_LM32
+;%include "bootsector2-cpu-hidden-regs-1-template.mac"
+%define TMPL_LM64
+%include "bootsector2-cpu-hidden-regs-1-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-instr-1-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-instr-1-template.mac
new file mode 100644
index 0000000..b7cb62f
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-instr-1-template.mac
@@ -0,0 +1,315 @@
+; $Id: bootsector2-cpu-instr-1-template.mac $
+;; @file
+; Bootsector test for misc instruction - multi mode template.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bootsector2-template-header.mac"
+
+
+
+;;
+; Memory fence instructions (SSE2).
+;
+; @uses No registers, but BS2_SEL_SPARE0 is trashed.
+;
+BEGINPROC TMPL_NM(TestMemFences)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+        sub     xSP, 80h                ; iret stack frame space.
+        mov     xSI, xSP                ; Save the stack register.
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+        ;
+        ; SSE2 supported?
+        ;
+        mov     eax, 1
+        xor     ecx, ecx
+        cpuid
+        test    edx, X86_CPUID_FEATURE_EDX_SSE2
+        jz      .skip
+
+        ;
+        ; Check that the standard instruction encodings work.
+        ;
+        mov     xBX, [xSP + 10h]
+        mov     [xSP], xAX
+        mfence
+        mov     [xSP], xCX
+        mov     xBX, [xSP + 08h]
+        sfence
+        mov     [xSP], xDX
+        mov     xBX, [xSP]
+        lfence
+        mov     bx, [xSP + 04h]
+
+
+        ;
+        ; The instruction encodings in the intel manual may open the RM as well
+        ; as prefixes open to interpretation.  AMD sets RM=0 in their docs.
+        ;
+        ;       lfence = 0f,ea,e8
+        ;       mfence = 0f,ea,f0
+        ;       sfence = 0f,ea,f8
+        ;       (RM is the lower 3 bits of the last byte.)
+
+%assign MY_RM 0xe8
+%rep 18h
+        db                                                       0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_CS,        0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_DS,        0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_ES,        0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_FS,        0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_GS,        0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_SS,        0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_SIZE_ADDR, 0fh, 0aeh, MY_RM
+        BS2_TRAP_INSTR X86_XCPT_UD, 0,  db X86_OP_PRF_SIZE_OP,   0fh, 0aeh, MY_RM ; (used in group)
+        BS2_TRAP_INSTR X86_XCPT_UD, 0,  db X86_OP_PRF_LOCK,      0fh, 0aeh, MY_RM ; (used in group)
+        BS2_TRAP_INSTR X86_XCPT_UD, 0,  db X86_OP_PRF_REPZ,      0fh, 0aeh, MY_RM ; (used in group)
+        BS2_TRAP_INSTR X86_XCPT_UD, 0,  db X86_OP_PRF_REPNZ,     0fh, 0aeh, MY_RM ; (used in group)
+%ifdef TMPL_64BIT
+ %assign MY_REX 0x40
+ %rep 10h
+        ; Rex prefixes doesn't change anything.
+        db                                                       MY_REX, 0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_CS,        MY_REX, 0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_DS,        MY_REX, 0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_ES,        MY_REX, 0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_FS,        MY_REX, 0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_GS,        MY_REX, 0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_SS,        MY_REX, 0fh, 0aeh, MY_RM
+        db                                 X86_OP_PRF_SIZE_ADDR, MY_REX, 0fh, 0aeh, MY_RM
+        BS2_TRAP_INSTR X86_XCPT_UD, 0,  db X86_OP_PRF_SIZE_OP,   MY_REX, 0fh, 0aeh, MY_RM ; (used in group)
+        BS2_TRAP_INSTR X86_XCPT_UD, 0,  db X86_OP_PRF_LOCK,      MY_REX, 0fh, 0aeh, MY_RM ; (used in group)
+        BS2_TRAP_INSTR X86_XCPT_UD, 0,  db X86_OP_PRF_REPZ,      MY_REX, 0fh, 0aeh, MY_RM ; (used in group)
+        BS2_TRAP_INSTR X86_XCPT_UD, 0,  db X86_OP_PRF_REPNZ,     MY_REX, 0fh, 0aeh, MY_RM ; (used in group)
+  %assign MY_REX (MY_REX + 1)
+ %endrep
+%endif
+ %assign MY_RM (MY_RM + 1)
+%endrep
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+.done:
+        mov     xSP, xSI
+        add     xSP, 80h
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.skip:
+        mov     xAX, .s_szSse2Missing
+        call    TMPL_NM_CMN(TestSubDone)
+        jmp     .done
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', mfence et al.', 0
+.s_szSse2Missing:
+        db      'SSE2 is missing', 0
+ENDPROC   TMPL_NM(TestMemFences)
+
+
+;;
+; Proving intel manual wrong about using REX.X for BSWAP R8-R15 on 64-bit.
+; Checking the 'undefined' 16-bit bswap behavior.
+;
+; @uses No registers, but BS2_SEL_SPARE0 is trashed.
+;
+BEGINPROC TMPL_NM(TestBSwap)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+        sub     xSP, 80h                ; iret stack frame space.
+        mov     xSI, xSP                ; Save the stack register.
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+        ;
+        ; Assert sanity.
+        ;
+        mov     eax, 11223344h
+        bswap   eax
+        TEST_ASSERT_SIMPLE eax, 44332211h, jz, "32-bit BSWAP EAX"
+
+        ;
+        ; Buggy manual (325383-041US, December 2011).
+        ;
+%ifdef TMPL_64BIT
+        push    r8
+
+        mov     r8d, 55667788h
+        mov     eax, 55667788h
+        db X86_OP_REX_X
+        bswap   eax                     ; does it access r8 or eax?
+        TEST_ASSERT_SIMPLE eax, 88776655h, jz, "REX.X BSWAP EAX - Wrong EAX."
+        TEST_ASSERT_SIMPLE r8,  55667788h, jz, "REX.X BSWAP EAX - Wrong R8."
+
+        mov     r8d, 55667788h
+        mov     eax, 55667788h
+        db X86_OP_REX_R
+        bswap   eax                     ; does it access r8 or eax?
+        TEST_ASSERT_SIMPLE eax, 88776655h, jz, "REX.R BSWAP EAX - Wrong EAX."
+        TEST_ASSERT_SIMPLE r8,  55667788h, jz, "REX.R BSWAP EAX - Wrong R8."
+
+        mov     r8d, 55667788h
+        mov     eax, 55667788h
+        db X86_OP_REX_B
+        bswap   eax                     ; does it access r8 or eax?
+        TEST_ASSERT_SIMPLE rax, 55667788h, jz, "REX.B BSWAP R8D - Wrong RAX."
+        TEST_ASSERT_SIMPLE r8d, 88776655h, jz, "REX.B BSWAP R8D - Wrong R8D."
+
+        pop     r8
+%endif
+
+        ;
+        ; 'Undefined' 16-bit behavior.
+        ;
+        ; Zeroing of the lower 16-bits has been observed on:
+        ;       - Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz
+        ;
+%ifndef TestBSwap16_defined
+ %define TestBSwap16_defined
+ %macro TestBSwap16 3,
+        mov     %3, %2                  ; save the primary register.
+  %ifdef TMPL_64BIT
+        mov     %2, 0ffffffff98765432h  ; Set the upper bit as well.
+  %else
+        mov     %2, 98765432h
+  %endif
+  %ifndef TMPL_16BIT
+        db X86_OP_PRF_SIZE_OP
+  %endif
+        bswap   %1
+        xchg    %2, %3                  ; Restore and save the result (xSP).
+        TEST_ASSERT_SIMPLE %3, 98760000h, jz, "Unexpected 16-bit BSWAP error."
+ %endmacro
+%endif
+
+        TestBSwap16 eax, sAX, sSI
+        TestBSwap16 ebx, sBX, sSI
+        TestBSwap16 ecx, sCX, sSI
+        TestBSwap16 edx, sDX, sSI
+        TestBSwap16 esp, sSP, sSI
+        TestBSwap16 ebp, sBP, sSI
+        TestBSwap16 edi, sDI, sSI
+        TestBSwap16 esi, sSI, sDI
+%ifdef TMPL_64BIT
+        TestBSwap16 r8d,   r8, rax
+        TestBSwap16 r9d,   r9, rax
+        TestBSwap16 r10d, r10, rax
+        TestBSwap16 r11d, r11, rax
+        TestBSwap16 r12d, r12, rax
+        TestBSwap16 r13d, r13, rax
+        TestBSwap16 r14d, r14, rax
+        TestBSwap16 r15d, r15, rax
+%endif
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+.done:
+        mov     xSP, xSI
+        add     xSP, 80h
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', bswap', 0
+ENDPROC   TMPL_NM(TestBSwap)
+
+
+;;
+; Do the tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(DoTestsForMode_rm)
+        push    bp
+        mov     bp, sp
+        push    ax
+
+        ;
+        ; Check if the mode and NX is supported, do the switch.
+        ;
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+
+        ;
+        ; Test exception handler basics using INT3 and #BP.
+        ;
+
+        call    TMPL_NM(TestMemFences)
+        call    TMPL_NM(TestBSwap)
+
+        ;
+        ; Back to real mode.
+        ;
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+        call    Bs2DisableNX_r86
+
+.done:
+        pop     ax
+        leave
+        ret
+ENDPROC TMPL_NM(DoTestsForMode_rm)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+%include "bootsector2-template-footer.mac"
+
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-instr-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-instr-1.asm
new file mode 100644
index 0000000..c19f17d
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-instr-1.asm
@@ -0,0 +1,110 @@
+; $Id: bootsector2-cpu-instr-1.asm $
+;; @file
+; Bootsector test for misc instructions.
+;
+; Recommended (but not necessary):
+;   VBoxManage setextradata bs-cpu-instr-1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;*******************************************************************************
+;*      Header Files                                                           *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+; Include and execute the init code.
+%define BS2_INIT_RM
+%define BS2_WITH_TRAPS
+%define BS2_INC_RM
+%define BS2_INC_PE32
+%define BS2_INC_PP32
+%define BS2_INC_PAE32
+%define BS2_INC_LM32
+%define BS2_INC_LM64
+%define BS2_WITH_TRAPRECS
+%include "bootsector2-common-init-code.mac"
+
+
+;
+; The main() function.
+;
+BEGINPROC main
+        BITS 16
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+        call    Bs2EnableA20_r86
+
+
+        ;
+        ; Execute the tests
+        ;
+%if 1
+        call    NAME(DoTestsForMode_rm_pe32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_pp32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_pae32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_lm64)
+%endif
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        ret
+
+.s_szTstName:
+        db      'tstCpuInstr1', 0
+ENDPROC   main
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+%define TMPL_PE32
+%include "bootsector2-cpu-instr-1-template.mac"
+%define TMPL_PP32
+%include "bootsector2-cpu-instr-1-template.mac"
+%define TMPL_PAE32
+%include "bootsector2-cpu-instr-1-template.mac"
+%define TMPL_LM64
+%include "bootsector2-cpu-instr-1-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-pf-1-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-pf-1-template.mac
new file mode 100644
index 0000000..5084bd4
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-pf-1-template.mac
@@ -0,0 +1,1051 @@
+; $Id: bootsector2-cpu-pf-1-template.mac $
+;; @file
+; Bootsector test for various types of #PFs - multi mode template.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bootsector2-template-header.mac"
+
+
+;*******************************************************************************
+;*      Defined Constants And Macros                                           *
+;*******************************************************************************
+%undef BIG_PAGE_SIZE
+%undef PXE_SIZE
+%ifdef TMPL_CMN_PP
+ %define BIG_PAGE_SIZE  _4M
+ %define PXE_SIZE       4
+%else
+ %define BIG_PAGE_SIZE  _2M
+ %define PXE_SIZE       8
+%endif
+
+
+;;
+; Do the tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(DoTestsForMode_rm)
+        push    bp
+        mov     bp, sp
+        push    ax
+
+        ;
+        ; Check if the mode and NX is supported, do the switch.
+        ;
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        mov     ax, [bp - 2]
+        test    al, al
+        jz      .nx_disabled
+        call    Bs2IsNXSupported_r86
+        jz      .done
+        call    Bs2EnableNX_r86
+.nx_disabled:
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+
+        ;
+        ; Do the tests.
+        ;
+        call    TMPL_NM(TestNotPresent)
+        ;; @todo call    TMPL_NM(TestReadOnly)
+        ;; @todo call    TMPL_NM(TestSupervisor)
+        ;; @todo call    TMPL_NM(TestReservedBits)
+
+        ;
+        ; Back to real mode.
+        ;
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+        call    Bs2DisableNX_r86
+
+.done:
+        pop     ax
+        leave
+        ret
+ENDPROC TMPL_NM(DoTestsForMode_rm)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+;;
+; Do the tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(DoBenchmarksForMode_rm)
+        push    bp
+        mov     bp, sp
+        push    ax
+
+        ;
+        ; Check if the mode and NX is supported, do the switch.
+        ;
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+
+        ;
+        ; Do the tests.
+        ;
+        call    TMPL_NM(BenchmarkNotPresent)
+
+        ;
+        ; Back to real mode.
+        ;
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+.done:
+        pop     ax
+        leave
+        ret
+ENDPROC TMPL_NM(DoBenchmarksForMode_rm)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+;;
+; Does the page-not-present tests.
+;
+; @param    al          Set if NXE=1, clear if NXE=0.
+;
+; @uses nothing
+;
+BEGINPROC TMPL_NM(TestNotPresent)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+
+        ;
+        ; Setup sCX for all the following tests.
+        ;
+        xor     sCX, sCX
+        test    al, al
+        jz      .no_nxe
+        mov     sCX, X86_TRAP_PF_ID
+.no_nxe:
+
+        ;
+        ; First test, big page not present.
+        ;
+        mov     xAX, .s_szBigPageNotPresent
+        test    sCX, sCX
+        jz      .test1_nxe
+        mov     xAX, .s_szBigPageNotPresentNX
+.test1_nxe:
+        call    TMPL_NM_CMN(TestSub)
+        call    TMPL_NM(TestFillTestAreaWithRet)
+
+        mov     sAX, TST_SCRATCH_PD_BASE
+        call    TMPL_NM(TestGetPdeAddr)
+        and     byte [sAX], ~X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        mov     sAX, TST_SCRATCH_PD_BASE
+        mov     sDX, 0                  ; err code
+        call    TMPL_NM(TestHammerPage)
+        jz      .test1_cleanup
+
+        mov     sAX, TST_SCRATCH_PD_BASE + (BIG_PAGE_SIZE / 2 - _4K)
+        call    TMPL_NM(TestHammerPage)
+        jz      .test1_cleanup
+
+        mov     sAX, TST_SCRATCH_PD_BASE + (BIG_PAGE_SIZE - _4K)
+        call    TMPL_NM(TestHammerPage)
+        jz      .test1_cleanup
+
+.test1_cleanup:
+        mov     sAX, TST_SCRATCH_PD_BASE
+        call    TMPL_NM(TestGetPdeAddr)
+        or      byte [sAX], X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        ;
+        ; The second test, normal page not present.
+        ;
+        mov     xAX, .s_szPageNotPresent
+        test    sCX, sCX
+        jz      .test2_nxe
+        mov     xAX, .s_szPageNotPresentNX
+.test2_nxe:
+        call    TMPL_NM_CMN(TestSub)
+
+        mov     sAX, TST_SCRATCH_PD_BASE
+        call    TMPL_NM(TstPutPageTableAt)
+
+        ; Make the first and last page not-present.
+        and     byte [BS2_USER_PX_0_ADDR], ~X86_PTE_P
+        and     byte [BS2_USER_PX_0_ADDR + 01000h - PXE_SIZE], ~X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        ; Do the tests.
+        mov     sAX, TST_SCRATCH_PD_BASE
+        mov     sDX, 0                  ; err code
+        call    TMPL_NM(TestHammerPage)
+        jz      .test2_cleanup
+
+        mov     sAX, TST_SCRATCH_PD_BASE + (BIG_PAGE_SIZE - _4K)
+        call    TMPL_NM(TestHammerPage)
+        jz      .test2_cleanup
+
+.test2_cleanup:
+        mov     sAX, TST_SCRATCH_PD_BASE
+        call    TMPL_NM(TstRestoreBigPageAt)
+
+
+%if PXE_SIZE == 8 ; PAE or LM
+        ;
+        ; The third test, mark a page directory pointer entry not present.
+        ;
+        mov     xAX, .s_szPdpeNotPresent
+        test    sCX, sCX
+        jz      .test3_nxe
+        mov     xAX, .s_szPdpeNotPresentNX
+.test3_nxe:
+        call    TMPL_NM_CMN(TestSub)
+        call    TMPL_NM(TestFillTestAreaWithRet)
+
+        mov     sAX, TST_SCRATCH_PDPT_BASE
+        call    TMPL_NM(TestGetPdpeAddr)
+        and     byte [sAX], ~X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        mov     sAX, TST_SCRATCH_PDPT_BASE
+        mov     sDX, 0                  ; err code
+        call    TMPL_NM(TestHammerPage)
+        jz      .test3_cleanup
+
+        mov     sAX, TST_SCRATCH_PDPT_BASE + (BIG_PAGE_SIZE / 2 - _4K)
+        call    TMPL_NM(TestHammerPage)
+        jz      .test3_cleanup
+
+        mov     sAX, TST_SCRATCH_PDPT_BASE + (BIG_PAGE_SIZE - _4K)
+        call    TMPL_NM(TestHammerPage)
+        jz      .test3_cleanup
+
+.test3_cleanup:
+        mov     sAX, TST_SCRATCH_PDPT_BASE
+        call    TMPL_NM(TestGetPdpeAddr)
+        or      byte [sAX], X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+%endif ; PAE || LM
+
+
+%ifdef TMPL_LM64
+        ;
+        ; The fourth test, mark a page map level 4 entry not present.
+        ;
+        mov     xAX, .s_szPml4eNotPresent
+        test    sCX, sCX
+        jz      .test4_nxe
+        mov     xAX, .s_szPml4eNotPresentNX
+.test4_nxe:
+        call    TMPL_NM_CMN(TestSub)
+        call    TMPL_NM(TestFillTestAreaWithRet)
+
+        mov     sAX, TST_SCRATCH_PML4_BASE
+        call    TMPL_NM(TestGetPml4eAddr)
+        and     byte [sAX], ~X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        mov     sAX, TST_SCRATCH_PML4_BASE
+        mov     sDX, 0                  ; err code
+        call    TMPL_NM(TestHammerPage)
+        jz      .test4_cleanup
+
+        mov     sAX, TST_SCRATCH_PML4_BASE + (BIG_PAGE_SIZE / 2 - _4K)
+        call    TMPL_NM(TestHammerPage)
+        jz      .test4_cleanup
+
+        mov     sAX, TST_SCRATCH_PML4_BASE + (BIG_PAGE_SIZE - _4K)
+        call    TMPL_NM(TestHammerPage)
+        jz      .test4_cleanup
+
+.test4_cleanup:
+        mov     sAX, TST_SCRATCH_PML4_BASE
+        call    TMPL_NM(TestGetPml4eAddr)
+        or      byte [sAX], X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+%endif
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szBigPageNotPresent:
+        db      TMPL_MODE_STR, ', !NX, big page NP', 0
+.s_szBigPageNotPresentNX:
+        db      TMPL_MODE_STR, ',  NX, big page NP', 0
+.s_szPageNotPresent:
+        db      TMPL_MODE_STR, ', !NX, page NP', 0
+.s_szPageNotPresentNX:
+        db      TMPL_MODE_STR, ',  NX, page NP', 0
+%if PXE_SIZE == 8 ; PAE or LM
+.s_szPdpeNotPresent:
+        db      TMPL_MODE_STR, ', !NX, PDPE NP', 0
+.s_szPdpeNotPresentNX:
+        db      TMPL_MODE_STR, ',  NX, PDPE NP', 0
+%endif
+%ifdef TMPL_LM64
+.s_szPml4eNotPresent:
+        db      TMPL_MODE_STR, ', !NX, PML4E NP', 0
+.s_szPml4eNotPresentNX:
+        db      TMPL_MODE_STR, ',  NX, PML4E NP', 0
+%endif
+ENDPROC   TMPL_NM(TestNotPresent)
+
+
+
+;;
+; Does the page-not-present benchmark.
+;
+; @uses nothing
+;
+BEGINPROC TMPL_NM(BenchmarkNotPresent)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    sCX
+        push    sDX
+        push    xDI
+        push    xSI
+        sub     xSP, 20h
+
+        call    TMPL_NM(TestFillTestAreaWithRet)
+
+        ;
+        ; The First benchmark: Big page not present.
+        ;
+
+        ; Mark the big test page not present.
+        mov     sAX, TST_SCRATCH_PD_BASE
+        call    TMPL_NM(TestGetPdeAddr)
+        and     byte [sAX], ~X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        ; Benchmark.
+        mov     sAX, TST_SCRATCH_PD_BASE
+        mov     xDX, .s_szBigPageNotPresent
+        mov     xCX, .s_szBigPageNotPresentFailed
+        call    TMPL_NM(TstBenchmark32BitReads)
+
+        ; Cleanup.
+        mov     sAX, TST_SCRATCH_PD_BASE
+        call    TMPL_NM(TestGetPdeAddr)
+        or      byte [sAX], X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        ;
+        ; The second benchmark: Normal page not present.
+        ;
+
+        ; Replace the big page with a page table and make the first and last
+        ; pages not-present.
+        mov     sAX, TST_SCRATCH_PD_BASE
+        call    TMPL_NM(TstPutPageTableAt)
+
+        and     byte [BS2_USER_PX_0_ADDR], ~X86_PTE_P
+        and     byte [BS2_USER_PX_0_ADDR + 01000h - PXE_SIZE], ~X86_PTE_P
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        ; Benchmark.
+        mov     sAX, TST_SCRATCH_PD_BASE
+        mov     xDX, .s_szPageNotPresent
+        mov     xCX, .s_szPageNotPresentFailed
+        call    TMPL_NM(TstBenchmark32BitReads)
+
+        ; Cleanup
+        mov     sAX, TST_SCRATCH_PD_BASE
+        call    TMPL_NM(TstRestoreBigPageAt)
+
+
+        ;
+        ; Done.
+        ;
+        add     xSP, 20h
+        pop     xSI
+        pop     xDI
+        pop     sDX
+        pop     sCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szBigPageNotPresent:
+        db      TMPL_MODE_STR, ', read NP big page', 0
+.s_szBigPageNotPresentFailed:
+        db      TMPL_MODE_STR, ', reading NP big page failed', 13, 10, 0
+.s_szPageNotPresent:
+        db      TMPL_MODE_STR, ', read NP page', 0
+.s_szPageNotPresentFailed:
+        db      TMPL_MODE_STR, ', reading NP page failed', 13, 10, 0
+ENDPROC   TMPL_NM(BenchmarkNotPresent)
+
+
+;;
+; Benchmark 32-bit reads at a give location.
+;
+; Will report the result under the name given via xDX.  Will report any test
+; failure giving the string pointed to by xCX as explanation.
+;
+; @param    sAX         The location to do the reads.
+; @param    xDX         The test value name.
+; @param    xCX         The failure string
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(TstBenchmark32BitReads)
+        push    xBP
+        mov     xBP, xSP
+%define a_pu32Test              [xBP - sCB]
+        push    sAX
+%define a_pszValue              [xBP - sCB*2]
+        push    sDX
+%define a_pszFailure            [xBP - sCB*3]
+        push    sCX
+        push    sSI
+        push    sDI
+%define u64NanoTS               [xBP - sCB*5 - 8h]
+        sub     xSP, 8h
+
+        ;
+        ; Calibrate the test so it doesn't take forever.
+        ;
+        mov     xAX, .calibrate_resume
+        mov     dl, 0eh
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+        mov     ecx, TST_CALIBRATE_LOOP_COUNT
+
+        lea     xAX, u64NanoTS
+        call    TMPL_NM_CMN(GetNanoTS)
+
+.calibrate_loop:
+        mov     sAX, a_pu32Test
+        mov     esi, [sAX]
+.calibrate_resume:
+        test    sAX, sAX
+        jnz     .failure
+        dec     ecx
+        jnz     .calibrate_loop
+
+        lea     xAX, u64NanoTS
+        call    TMPL_NM_CMN(GetElapsedNanoTS)
+        call    TMPL_NM_CMN(Bs2TrapReset)
+
+        ; Figure out how many iterations is required for the full benchmark.
+        mov     ecx, TST_BENCHMARK_PERIOD_IN_SECS
+        mov     edx, TST_CALIBRATE_LOOP_COUNT
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(CalcBenchmarkIterations)
+        mov     ecx, eax                ; iteration count.
+
+        ;
+        ; Do the full benchmark run.
+        ;
+        mov     xAX, .bench_resume
+        mov     dl, 0eh
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+        mov     edx, ecx                ; save test count for ReportResult.
+
+        lea     xAX, u64NanoTS
+        call    TMPL_NM_CMN(GetNanoTS)
+.bench_loop:
+        mov     xAX, a_pu32Test
+        mov     esi, [eax]
+.bench_resume:
+        test    eax, eax
+        jnz     .failure
+        dec     ecx
+        jnz     .bench_loop
+
+        lea     xAX, u64NanoTS
+        call    TMPL_NM_CMN(GetElapsedNanoTS)
+        call    TMPL_NM_CMN(Bs2TrapReset)
+
+        mov     xCX, a_pszValue
+        lea     xAX, u64NanoTS
+        call    TMPL_NM_CMN(ReportResult)
+
+.return:
+        pop     sDI
+        pop     sSI
+        pop     sCX
+        pop     sDX
+        pop     sAX
+        leave
+        ret
+
+.failure:
+        call    TMPL_NM_CMN(Bs2TrapReset)
+        mov     xAX, a_pszFailure
+        call    TMPL_NM_CMN(TestFailed)
+        jmp     .return
+
+%undef a_pszFailure
+%undef a_pu32Test
+%undef a_pszValue
+%undef a_pszFailure
+%undef u64NanoTS
+ENDPROC   TMPL_NM(TstBenchmark32BitReads)
+
+
+;;
+; Fills the test area with return instructions.
+;
+; @uses     nothing.
+;
+BEGINPROC TMPL_NM(TestFillTestAreaWithRet)
+        push    xBP
+        mov     xBP, xSP
+        push    xDI
+        push    xCX
+        push    xAX
+
+        mov     xDI, TST_SCRATCH_PD_BASE
+        mov     xCX, (_4M + _4M) / 4
+        mov     eax, 0c3c3c3c3h
+        rep stosd
+
+        mov     xDI, TST_SCRATCH_PDPT_BASE
+        mov     xCX, (_4M + _4M) / 4
+        mov     eax, 0c3c3c3c3h
+        rep stosd
+
+%ifdef TMPL_LM64
+        mov     xDI, TST_SCRATCH_PML4_BASE
+        mov     xCX, (_4M + _4M) / 8
+        mov     rax, 0c3c3c3c3c3c3c3c3h
+        rep stosq
+%endif
+
+        pop     xAX
+        pop     xCX
+        pop     xDI
+        leave
+        ret
+ENDPROC   TMPL_NM(TestFillTestAreaWithRet)
+
+
+;;
+; Gets the page directory address.
+;
+; ASSUMES identity mapped page translation tables.
+;
+; @returns  ds:xAX      The page directory address.
+; @param    sAX         The virtual address in question.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(TestGetPdeAddr)
+        push    xBP
+        mov     xBP, xSP
+        push    sBX
+        push    sCX
+
+%ifdef TMPL_CMN_PP
+        ; PDPE
+        shr     sAX, X86_PD_SHIFT
+        and     sAX, X86_PD_MASK
+        shl     sAX, 2
+        mov     sBX, cr3
+        and     sBX, X86_CR3_PAGE_MASK
+        add     sAX, sBX
+
+%else
+ %ifdef TMPL_CMN_LM
+        ; PML4E
+        mov     sCX, sAX
+        shr     sCX, X86_PML4_SHIFT
+        and     sCX, X86_PML4_MASK
+        shl     sCX, 3
+        mov     sBX, cr3
+        and     sBX, X86_CR3_AMD64_PAGE_MASK & 0ffffffffh
+        add     sBX, sCX
+        mov     sBX, [sBX]
+        and     sBX, X86_PDPE_PG_MASK & 0ffffffffh
+ %else
+        mov     sBX, cr3
+        and     sBX, X86_CR3_PAE_PAGE_MASK
+ %endif
+
+        ; PDPE
+        mov     sCX, sAX
+        shr     sCX, X86_PDPT_SHIFT
+ %ifdef TMPL_CMN_LM
+        and     sCX, X86_PDPT_MASK_AMD64
+ %else
+        and     sCX, X86_PDPT_MASK_PAE
+ %endif
+        shl     sCX, 3
+        add     sBX, xCX
+        mov     sBX, [sBX]
+        and     sBX, X86_PDPE_PG_MASK & 0ffffffffh
+
+        ; PDE
+        shr     sAX, X86_PD_PAE_SHIFT
+        and     sAX, X86_PD_PAE_MASK
+        shl     sAX, 3
+        add     sAX, sBX
+%endif
+
+        pop     sCX
+        pop     sBX
+        leave
+        ret
+ENDPROC   TMPL_NM(TestGetPdeAddr)
+
+
+%if PXE_SIZE == 8 ; PAE or LM
+;;
+; Gets the page directory pointer entry for an address.
+;
+; ASSUMES identity mapped page translation tables.
+;
+; @returns  ds:xAX      The pointer to the PDPE.
+; @param    sAX         The virtual address in question.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(TestGetPdpeAddr)
+        push    xBP
+        mov     xBP, xSP
+        push    sBX
+        push    sCX
+
+%ifdef TMPL_CMN_PP
+ %error "misconfig"
+%endif
+
+%ifdef TMPL_CMN_LM
+        ; PML4E
+        mov     sCX, sAX
+        shr     sCX, X86_PML4_SHIFT
+        and     sCX, X86_PML4_MASK
+        shl     sCX, 3
+        mov     sBX, cr3
+        and     sBX, X86_CR3_AMD64_PAGE_MASK & 0ffffffffh
+        add     sBX, sCX
+        mov     sBX, [sBX]
+        and     sBX, X86_PDPE_PG_MASK & 0ffffffffh
+%else
+        mov     sBX, cr3
+        and     sBX, X86_CR3_PAE_PAGE_MASK
+%endif
+
+        ; PDPE
+        shr     sAX, X86_PDPT_SHIFT
+%ifdef TMPL_CMN_LM
+        and     sAX, X86_PDPT_MASK_AMD64
+%else
+        and     sAX, X86_PDPT_MASK_PAE
+%endif
+        shl     sAX, 3
+        add     sAX, sBX
+
+        pop     sCX
+        pop     sBX
+        leave
+        ret
+ENDPROC   TMPL_NM(TestGetPdpeAddr)
+%endif ; PAE or LM
+
+
+%ifdef TMPL_CMN_LM
+;;
+; Gets the page map level 4 entry for an address.
+;
+; ASSUMES identity mapped page translation tables.
+;
+; @returns  rax        The pointer to the PML4E.
+; @param    rax        The virtual address in question.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(TestGetPml4eAddr)
+        push    xBP
+        mov     xBP, xSP
+        push    rbx
+
+        ; PML4E
+        shr     rax, X86_PML4_SHIFT
+        and     rax, X86_PML4_MASK
+        shl     rax, 3
+        mov     rbx, cr3
+        and     rbx, X86_CR3_AMD64_PAGE_MASK & 0ffffffffh
+        add     rax, rbx
+
+        pop     rbx
+        leave
+        ret
+ENDPROC   TMPL_NM(TestGetPml4eAddr)
+%endif ; TMPL_CMN_LM
+
+
+;;
+; Initialize page table #0 and hooks it up at the specified address.
+;
+; The page table will have identity mapped pages.  The TLBs are flushed
+; wholesale.  The caller will have to reconstruct the PDE when finished.
+;
+; @param    sAX         The virtual address (big page -> page table).
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(TstPutPageTableAt)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sCX
+        push    sDI
+        push    sSI
+
+        ; initialize a page table.
+        mov     sDI, BS2_USER_PX_0_ADDR
+        mov     sSI, sAX
+.init_loop:
+%if PXE_SIZE == 8
+        mov     [sDI + 4], dword 0
+        mov     [sDI], sSI
+%else
+        mov     [sDI], esi
+%endif
+        or      byte [sDI], X86_PTE_P | X86_PTE_RW
+        add     sSI, _4K
+        add     sDI, PXE_SIZE
+        test    sDI, 0fffh
+        jnz     .init_loop
+
+        ; hook it up instead of the big page.
+        and     sAX, ~(BIG_PAGE_SIZE - 1)
+        mov     sDI, sAX
+        call    TMPL_NM(TestGetPdeAddr)
+        mov     dword [sAX], BS2_USER_PX_0_ADDR | X86_PDE_P | X86_PDE_RW | X86_PDE_RW
+%if PXE_SIZE == 8
+        mov     dword [sAX + 4], 0
+%endif
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        ; Make sure it works.
+        mov     eax, 0c3c3c3c3h
+        mov     ecx, BIG_PAGE_SIZE / 4
+        rep stosd
+
+        pop     sSI
+        pop     sDI
+        pop     sCX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM(TstPutPageTableAt)
+
+
+;;
+; Restores the big page for a virtual address, undoing harm done by a
+; previous TstPutPageTableAt call.
+;
+; @param    sAX         The virtual address to restore to a big page.
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(TstRestoreBigPageAt)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sCX
+        push    sDI
+
+        ; Set it up, inheriting bits from the previous PDE.
+        and     sAX, ~(BIG_PAGE_SIZE - 1)
+        mov     sDI, sAX                ; save it for later.
+        call    TMPL_NM(TestGetPdeAddr)
+        mov     sCX, [sAX - PXE_SIZE]
+        and     sCX, X86_PDE4M_US | X86_PDE4M_RW | X86_PDE4M_G | X86_PDE4M_PAT | X86_PDE4M_AVL | X86_PDE4M_PCD | X86_PDE4M_PWT
+        or      sCX, X86_PDE4M_P | X86_PDE4M_PS
+        or      sCX, sDI
+%if PXE_SIZE == 8
+        mov     dword [sAX + 4], 0
+        mov     [sAX], sCX
+%else
+        mov     [sAX], ecx
+%endif
+        mov     sAX, cr3
+        mov     cr3, sAX
+
+        ; Make sure it works.
+        mov     eax, 0c3c3c3c3h
+        mov     ecx, BIG_PAGE_SIZE / 4
+        rep stosd
+
+        pop     sDI
+        pop     sCX
+        pop     sAX
+        leave
+        ret
+ENDPROC   TMPL_NM(TstRestoreBigPageAt)
+
+
+
+;;
+; Hammers a page.
+;
+; Accesses a page in a few different ways, expecting all of the accesses to
+; cause some kind of page fault.  The caller just makes sure the page causes
+; a fault and points us to it.
+;
+; @returns  al=1, ZF=0 on success.
+; @returns  al=0, ZF=1 on failure.
+; @param    sAX                 The page.
+; @param    sDX                 The base error code to expect.
+; @param    xCX                 X86_TRAP_PF_ID if NXE, otherwise 0.
+; @uses     al
+;
+BEGINPROC TMPL_NM(TestHammerPage)
+        push    xBP
+        mov     xBP, xSP
+        push    sBX
+%define a_uErrorExec    sPRE [xBP - sCB*2]
+        push    sCX
+%define a_uErrorFixed   sPRE [xBP - sCB*3]
+        push    sDX
+        push    sDI
+        push    sSI
+%define a_pPage         sPRE [xBP - sCB*6]
+        push    sAX
+
+        ;
+        ; First reads of different sizes.
+        ;
+        mov     sDI, a_pPage
+.read_byte_loop:
+        mov     dl, 0ffh
+        mov     xAX, .read_byte_resume
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+.read_byte:
+        mov     cl, byte [sDI]
+.read_byte_resume:
+        mov     eax, 0eh                ; trap #
+        mov     sDX, a_uErrorFixed      ; err
+        mov     sCX, .read_byte         ; fault eip
+        mov     sBX, sDI                ; fault address.
+        call    TMPL_NM_CMN(TestCheckTrap)
+        jz      .failed
+        inc     sDI
+        test    sDI, 0fffh
+        jnz     .read_byte_loop
+
+        mov     sDI, a_pPage
+.read_word_loop:
+        mov     dl, 0ffh
+        mov     xAX, .read_word_resume
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+.read_word:
+        mov     cx, word [sDI]
+.read_word_resume:
+        mov     eax, 0eh                ; trap #
+        mov     sDX, a_uErrorFixed      ; err
+        mov     sCX, .read_word         ; fault eip
+        mov     sBX, sDI                ; fault address.
+        call    TMPL_NM_CMN(TestCheckTrap)
+        jz      .failed
+        inc     sDI
+        test    sDI, 0fffh
+        jnz     .read_word_loop
+
+        mov     sDI, a_pPage
+.read_dword_loop:
+        mov     dl, 0ffh
+        mov     xAX, .read_dword_resume
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+.read_dword:
+        mov     ecx, dword [sDI]
+.read_dword_resume:
+        mov     eax, 0eh                ; trap #
+        mov     sDX, a_uErrorFixed      ; err
+        mov     sCX, .read_dword        ; fault eip
+        mov     sBX, sDI                ; fault address.
+        call    TMPL_NM_CMN(TestCheckTrap)
+        jz      .failed
+        inc     sDI
+        test    sDI, 0fffh
+        jnz     .read_dword_loop
+
+        ;
+        ; Then writes of different sizes.
+        ;
+        mov     sDI, a_pPage
+.write_byte_loop:
+        mov     dl, 0ffh
+        mov     xAX, .write_byte_resume
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+.write_byte:
+        mov     byte [sDI], 0c3h        ; (ret instruction)
+.write_byte_resume:
+        mov     eax, 0eh                ; trap #
+        mov     sDX, a_uErrorFixed      ; err
+        or      sDX, X86_TRAP_PF_RW
+        mov     sCX, .write_byte        ; fault eip
+        mov     sBX, sDI                ; fault address.
+        call    TMPL_NM_CMN(TestCheckTrap)
+        jz      .failed
+        inc     sDI
+        test    sDI, 0fffh
+        jnz     .write_byte_loop
+
+        mov     sDI, a_pPage
+.write_word_loop:
+        mov     dl, 0ffh
+        mov     xAX, .write_word_resume
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+.write_word:
+        mov     word [sDI], 0c3c3h      ; (2 ret instructions)
+.write_word_resume:
+        mov     eax, 0eh                ; trap #
+        mov     sDX, a_uErrorFixed      ; err
+        or      sDX, X86_TRAP_PF_RW
+        mov     sCX, .write_word        ; fault eip
+        mov     sBX, sDI                ; fault address.
+        call    TMPL_NM_CMN(TestCheckTrap)
+        jz      .failed
+        inc     sDI
+        test    sDI, 0fffh
+        jnz     .write_word_loop
+
+        mov     sDI, a_pPage
+.write_dword_loop:
+        mov     dl, 0ffh
+        mov     xAX, .write_dword_resume
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+.write_dword:
+        mov     dword [sDI], 0c3c3c3c3h ; (4 ret instructions)
+.write_dword_resume:
+        mov     eax, 0eh                ; trap #
+        mov     sDX, a_uErrorFixed      ; err
+        or      sDX, X86_TRAP_PF_RW
+        mov     sCX, .write_dword       ; fault eip
+        mov     sBX, sDI                ; fault address.
+        call    TMPL_NM_CMN(TestCheckTrap)
+        jz      .failed
+        inc     sDI
+        test    sDI, 0fffh
+        jnz     .write_dword_loop
+
+        ;
+        ; Execute access.
+        ;
+        mov     sDI, a_pPage
+        mov     xSI, xSP
+.call_loop:
+        mov     dl, 0ffh
+        mov     xAX, .call_resume
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+        call    sDI
+.call_resume:
+        mov     xSP, xSI                ; restore xSP since the call will change it before #PF'ing.
+        mov     eax, 0eh                ; trap #
+        mov     sDX, a_uErrorFixed      ; err
+        or      sDX, a_uErrorExec
+        mov     sCX, sDI                ; fault eip
+        mov     sBX, sDI                ; fault address.
+        call    TMPL_NM_CMN(TestCheckTrap)
+        jz      .failed
+        inc     sDI
+        test    sDI, 0fffh
+        jnz     .call_loop
+
+
+        mov     sDI, a_pPage
+        mov     xSI, xSP
+.jmp_loop:
+        mov     dl, 0ffh
+        mov     xAX, .jmp_resume
+        call    TMPL_NM_CMN(Bs2TrapPrepare)
+        push    .jmp_resume             ; push a return address in case of failure.
+        jmp     sDI
+.jmp_resume:
+        mov     xSP, xSI                ; restore xSP in case the jmp didn't trap.
+        mov     eax, 0eh                ; trap #
+        mov     sDX, a_uErrorFixed      ; err
+        or      sDX, a_uErrorExec
+        mov     sCX, sDI                ; fault eip
+        mov     sBX, sDI                ; fault address.
+        call    TMPL_NM_CMN(TestCheckTrap)
+        jz      .failed
+        inc     sDI
+        test    sDI, 0fffh
+        jnz     .jmp_loop
+
+        ; successfull return.
+        pop     sAX
+        xor     al, al
+        inc     al
+.return:
+        pop     sSI
+        pop     sDI
+        pop     sDX
+        pop     sCX
+        pop     sBX
+        leave
+        ret
+
+.failed:
+        pop     sAX
+        xor     al, al
+        jmp     .return
+%undef a_uErrorFixed
+%undef a_uErrorExec
+%undef a_pPage
+ENDPROC   TMPL_NM(TestHammerPage)
+
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-pf-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-pf-1.asm
new file mode 100644
index 0000000..23f77bb
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-pf-1.asm
@@ -0,0 +1,154 @@
+; $Id: bootsector2-cpu-pf-1.asm $
+;; @file
+; Bootsector test for various types of #PFs.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;*******************************************************************************
+;*      Header Files                                                           *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+
+;*******************************************************************************
+;*      Defined Constants And Macros                                           *
+;*******************************************************************************
+;; Base address at which we can start testing page tables and page directories.
+%define TST_SCRATCH_PD_BASE             BS2_MUCK_ABOUT_BASE
+;; Base address at which we can start testing the page pointer table.
+%define TST_SCRATCH_PDPT_BASE           (1 << X86_PDPT_SHIFT)
+;; Base address at which we can start testing the page map level 4.
+%define TST_SCRATCH_PML4_BASE           ((1 << X86_PML4_SHIFT) + TST_SCRATCH_PD_BASE)
+
+;; The number of loops done during calibration.
+%define TST_CALIBRATE_LOOP_COUNT        10000
+;; The desired benchmark period (seconds).
+%define TST_BENCHMARK_PERIOD_IN_SECS    2
+
+
+
+;
+; Include and execute the init code.
+;
+        %define BS2_INIT_RM
+        %define BS2_WITH_TRAPS
+        %define BS2_INC_RM
+;        %define BS2_INC_PP16
+        %define BS2_INC_PP32
+;        %define BS2_INC_PAE16
+        %define BS2_INC_PAE32
+;        %define BS2_INC_LM16
+;        %define BS2_INC_LM32
+        %define BS2_INC_LM64
+        %include "bootsector2-common-init-code.mac"
+
+
+;
+; The benchmark driver
+;
+BEGINPROC main
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+        call    Bs2EnableA20_r86
+
+        ;
+        ; Execute the tests
+        ;
+%if 1
+ %if 1
+        xor     eax, eax                ; NXE=0 (N/A)
+        call    NAME(DoTestsForMode_rm_pp32)
+ %endif
+ %if 1
+        xor     eax, eax                ; NXE=0
+        call    NAME(DoTestsForMode_rm_pae32)
+        mov     eax, 1                  ; NXE=1
+        call    NAME(DoTestsForMode_rm_pae32)
+ %endif
+ %if 1
+        xor     eax, eax                ; NXE=0
+        call    NAME(DoTestsForMode_rm_lm64)
+        mov     eax, 1                  ; NXE=1
+        call    NAME(DoTestsForMode_rm_lm64)
+ %endif
+%endif
+
+        ;
+        ; Execute benchmarks.
+        ;
+%if 1
+        mov     ax, .s_szTstBenchmark
+        call    NAME(TestSub_r86)
+        call    NAME(DoBenchmarksForMode_rm_pp32)
+        call    NAME(DoBenchmarksForMode_rm_pae32)
+        call    NAME(DoBenchmarksForMode_rm_lm64)
+        call    NAME(TestSubDone_r86)
+%endif
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        ret
+
+.s_szTstBenchmark:
+        db      'Benchmark', 0
+.s_szTstName:
+        db      'tstIOIntr', 0
+.s_szTstX:
+        db      'X', 0
+ENDPROC   main
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+;%define TMPL_PP16
+;%include "bootsector2-cpu-pf-1-template.mac"
+%define TMPL_PP32
+%include "bootsector2-cpu-pf-1-template.mac"
+;%define TMPL_PAE16
+;%include "bootsector2-cpu-pf-1-template.mac"
+%define TMPL_PAE32
+%include "bootsector2-cpu-pf-1-template.mac"
+;%define TMPL_LM16
+;%include "bootsector2-cpu-pf-1-template.mac"
+;%define TMPL_LM32
+;%include "bootsector2-cpu-pf-1-template.mac"
+%define TMPL_LM64
+%include "bootsector2-cpu-pf-1-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-1-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-1-template.mac
new file mode 100644
index 0000000..081bac0
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-1-template.mac
@@ -0,0 +1,1963 @@
+; $Id: bootsector2-cpu-xcpt-1-template.mac $
+;; @file
+; Bootsector test for basic exceptions - multi mode template.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bootsector2-template-header.mac"
+
+
+;*******************************************************************************
+;*  Defined Constants And Macros                                               *
+;*******************************************************************************
+;;
+; Some 32/64 macros.
+;
+%if TMPL_BITS == 32
+ %define bs2Idt_BP      bs2Idt32bit_BP
+ %define MY_R0_CS       BS2_SEL_CS32
+ %define MY_R1_CS       BS2_SEL_R1_CS32
+ %define MY_R2_CS       BS2_SEL_R2_CS32
+ %define MY_R3_CS       BS2_SEL_R3_CS32
+
+ %define MY_R0_DS       BS2_SEL_DS32
+ %define MY_R1_DS       BS2_SEL_R1_DS32
+ %define MY_R2_DS       BS2_SEL_R2_DS32
+ %define MY_R3_DS       BS2_SEL_R3_DS32
+
+ %define MY_R0_SS       BS2_SEL_SS32
+ %define MY_R1_SS       BS2_SEL_R1_SS32
+ %define MY_R2_SS       BS2_SEL_R2_SS32
+ %define MY_R3_SS       BS2_SEL_R3_SS32
+
+%else
+ %define bs2Idt_BP      bs2Idt64bit_BP
+ %define MY_R0_CS       BS2_SEL_CS64
+ %define MY_R1_CS       BS2_SEL_R1_CS64
+ %define MY_R2_CS       BS2_SEL_R2_CS64
+ %define MY_R3_CS       BS2_SEL_R3_CS64
+
+ %define MY_R0_DS       BS2_SEL_DS64
+ %define MY_R1_DS       BS2_SEL_R1_DS64
+ %define MY_R2_DS       BS2_SEL_R2_DS64
+ %define MY_R3_DS       BS2_SEL_R3_DS64
+
+ %define MY_R0_SS       BS2_SEL_SS64
+ %define MY_R1_SS       BS2_SEL_R1_SS64
+ %define MY_R2_SS       BS2_SEL_R2_SS64
+ %define MY_R3_SS       BS2_SEL_R3_SS64
+%endif
+
+%ifdef TMPL_64BIT
+ %assign MY_IS_64BIT 1
+%else
+ %assign MY_IS_64BIT 0
+%endif
+
+
+;*******************************************************************************
+;*      Global Variables                                                       *
+;*******************************************************************************
+%ifndef CPU_XCPT_1_GLOBALS
+ %define CPU_XCPT_1_GLOBALS
+ g_szWrongIfStateFmt:
+        db 'Wrong IF state (0x%RX32) on line 0x%RX32', 0
+ g_szWrongHandlerCsFmt:
+        db 'Wrong handler CS=%RX16, expected %RX16 (line 0x%RX32)', 0
+ g_szWrongCurCsFmt:
+        db 'Wrong CS=%RX16, expected %RX16 (line 0x%RX32)', 0
+ g_szWrongCurSRegFmt_fs:
+        db 'Wrong FS=%RX16, expected %RX16 (line 0x%RX32)', 0
+ g_szWrongCurSRegFmt_ss:
+        db 'Wrong SS=%RX16, expected %RX16 (line 0x%RX32)', 0
+
+
+;;
+; Asserts a test.
+;
+; @param    %1  First cmp operand.
+; @param    %2  First cmp operand.
+; @param    %3  Which kind of conditional jump to make
+; @param    %4  The message to print (format string, no arguments please).
+;
+%macro ASSERT_SIMPLE 4
+        cmp     %1, %2
+        %3      %%.ok
+        push    dword __LINE__
+ %ifdef TMPL_16BIT
+        push    ds
+ %endif
+        push    %%.s_szMsg
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, sCB*2
+        jmp     %%.ok
+%%.s_szMsg: db %4, " (0x%RX32)", 0
+%%.ok:
+%endmacro
+
+
+ ;;
+ ; Asserts that the IF flag is set or clear when the trap handler was called.
+ ;
+ ; @param 1      jnz or jz.
+ ;
+ ; @uses         rax, flags, and stack.
+ ;
+ %macro ASSERT_TRAP_EFLAGS_IF 1
+        test    word [g_u64LastTrapHandlerRFlags xWrtRIP], X86_EFL_IF
+        %1      %%.ok
+  %ifdef TMPL_LM64
+        push    __LINE__
+        push    qword [g_u64LastTrapHandlerRFlags xWrtRIP]
+        lea     rax, [g_szWrongIfStateFmt wrt RIP]
+        push    rax
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 24
+  %elifdef TMPL_16
+        push    dword __LINE__
+        push    dword [g_u64LastTrapHandlerRFlags]
+        push    cs
+        push    g_szWrongIfStateFmt
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 12
+  %else
+        push    __LINE__
+        push    dword [g_u64LastTrapHandlerRFlags]
+        push    g_szWrongIfStateFmt
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 12
+  %endif
+ %%.ok:
+ %endmacro
+
+
+ ;;
+ ; Asserts that a certain CS value when the trap handler was called.
+ ;
+ ; @param 1     The CS value.
+ ;
+ ; @uses        rax, flags, and stack.
+ ;
+ %macro ASSERT_TRAP_CS_VALUE 1
+        cmp     word [g_u16LastTrapHandlerCS xWrtRIP], (%1)
+        je      %%.ok
+  %ifdef TMPL_LM64
+        push    __LINE__
+        push    (%1)
+        movzx   eax, word [g_u16LastTrapHandlerCS xWrtRIP]
+        push    rax
+        lea     rax, [g_szWrongHandlerCsFmt wrt RIP]
+        push    rax
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 32
+  %elifdef TMPL_16
+        push    dword __LINE__
+        push    word (%1)
+        push    word [g_u16LastTrapHandlerCS]
+        push    cs
+        push    g_szWrongHandlerCsFmt
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 12
+  %else
+        push    __LINE__
+        push    (%1)
+        movzx   eax, word [g_u16LastTrapHandlerCS]
+        push    eax
+        push    g_szWrongHandlerCsFmt
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 16
+  %endif
+ %%.ok:
+ %endmacro
+
+ ;;
+ ; Asserts that a certain CS value right now, CS being loaded in BX.
+ ;
+ ; @param bx    The CS value.
+ ; @param 1     The expected CS value.
+ ;
+ ; @uses        rax, flags, and stack.
+ ;
+ %macro ASSERT_CUR_CS_VALUE_IN_BX 1
+        cmp     bx, (%1)
+        je      %%.ok
+  %ifdef TMPL_LM64
+        push    __LINE__
+        push    (%1)
+        push    rbx
+        lea     rax, [g_szWrongCurCsFmt wrt RIP]
+        push    rax
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 32
+  %elifdef TMPL_16
+        push    dword __LINE__
+        push    word (%1)
+        push    bx
+        push    g_szWrongCurCsFmt
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 12
+  %else
+        push    __LINE__
+        push    (%1)
+        push    ebx
+        push    g_szWrongCurCsFmt
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 16
+  %endif
+ %%.ok:
+ %endmacro
+
+ ;;
+ ; Asserts that the given segment register has a certain value right now.
+ ;
+ ; @param 1     The segment register
+ ; @param 2     The value.
+ ;
+ ; @uses        rax, flags, and stack.
+ ;
+ %macro ASSERT_CUR_SREG_VALUE 2
+        mov     ax, %1
+        cmp     ax, (%2)
+        je      %%.ok
+  %ifdef TMPL_LM64
+        push    __LINE__
+        push    (%2)
+        push    rax
+        lea     rax, [g_szWrongCurSRegFmt_ %+ %1 wrt RIP]
+        push    rax
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 32
+  %elifdef TMPL_16
+        push    dword __LINE__
+        push    word (%2)
+        push    ax
+        push    g_szWrongCurSRegFmt_ %+ %1
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 12
+  %else
+        push    __LINE__
+        push    (%2)
+        push    eax
+        push    g_szWrongCurSRegFmt_ %+ %1
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, 16
+  %endif
+ %%.ok:
+ %endmacro
+
+
+%endif
+
+
+;;
+; Checks different gate types.
+;
+BEGINPROC TMPL_NM(TestGateType)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+
+        ;
+        ; Check that int3 works and save the IDTE before making changes.
+        ;
+        ; We'll be changing X86DESCGATE.u4Type, which starts at bit 0x28 (that
+        ; is byte 5) and is 4-bit wide, and X86DESCGATE.u1DescType, which is
+        ; at bit 2c.
+        ;
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3 ; check that int3 works before we start messing around...
+
+%ifdef TMPL_LM64
+        push    qword [bs2Idt_BP     xWrtRIP]
+        push    qword [bs2Idt_BP + 8 xWrtRIP]
+%else
+        push    dword [bs2Idt_BP     xWrtRIP]
+        push    dword [bs2Idt_BP + 4 xWrtRIP]
+%endif
+        mov     xDI, xSP                ; for catching stack errors
+
+        ;
+        ; Check all kinds of none system selectors first (they should all GP(3+IDT))
+        ;
+%assign u4Type 0
+%rep 16
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], RT_BIT(4) | u4Type
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+ %assign u4Type (u4Type + 1)
+%endrep
+
+        ;
+        ; Illegal system types.
+        ;
+%ifdef TMPL_LM64
+ %assign u4Type 0
+ %rep 14
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], u4Type
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+  %assign u4Type (u4Type + 1)
+ %endrep
+%else
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_UNDEFINED
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_286_TSS_AVAIL
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_LDT
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_286_TSS_BUSY
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_286_CALL_GATE
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_UNDEFINED2
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_386_TSS_AVAIL
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_UNDEFINED3
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_386_TSS_BUSY
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_UNDEFINED4
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_386_CALL_GATE
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+%endif
+
+        ;
+        ; Legal types.
+        ;
+        pushf
+        sti                             ; make sure interrupts are enabled.
+
+%ifdef TMPL_LM64
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], AMD64_SEL_TYPE_SYS_INT_GATE
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_EFLAGS_IF jz
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], AMD64_SEL_TYPE_SYS_TRAP_GATE
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_EFLAGS_IF jnz
+%else
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_386_INT_GATE
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_EFLAGS_IF jz
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_386_TRAP_GATE
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_EFLAGS_IF jnz
+
+        ;; @todo X86_SEL_TYPE_SYS_TASK_GATE, X86_SEL_TYPE_SYS_286_INT_GATE, X86_SEL_TYPE_SYS_286_TRAP_GATE, X86_SEL_TYPE_SYS_386_CALL_GATE
+%endif
+
+        popf
+
+        ;
+        ; Check that a not-present gate GPs. The not-present bit is 0x2f.
+        ;
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+%ifdef TMPL_LM64
+        or      byte [bs2Idt_BP + 5  xWrtRIP], AMD64_SEL_TYPE_SYS_INT_GATE
+%else
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_386_TRAP_GATE
+%endif
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 07fh
+        BS2_TRAP_INSTR X86_XCPT_NP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        ;
+        ; Restore the descriptor and make sure it works.
+        ;
+        ASSERT_SIMPLE xDI, xSP, je, "Someone busted xSP during this test."
+%ifdef TMPL_LM64
+        pop     qword [bs2Idt_BP + 8 xWrtRIP]
+        pop     qword [bs2Idt_BP     xWrtRIP]
+%else
+        pop     dword [bs2Idt_BP + 4 xWrtRIP]
+        pop     dword [bs2Idt_BP     xWrtRIP]
+%endif
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', IDTE type checks', 0
+ENDPROC   TMPL_NM(TestGateType)
+
+
+;;
+; Checks different code selector types.
+;
+; @uses No registers, but BS2_SEL_SPARE0 is trashed.
+;
+BEGINPROC TMPL_NM(TestCodeSelector)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+
+        ;
+        ; Modify the first extra selector to be various kinds of invalid code
+        ; selectors.
+        ;
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3 ; check that int3 works before we start messing around...
+
+%ifdef TMPL_LM64
+        push    qword [bs2Idt_BP     xWrtRIP]
+        push    qword [bs2Idt_BP + 8 xWrtRIP]
+%else
+        push    dword [bs2Idt_BP     xWrtRIP]
+        push    dword [bs2Idt_BP + 4 xWrtRIP]
+%endif
+
+        mov     ecx, [bs2Gdt + MY_R0_CS  xWrtRIP]
+        mov     [bs2GdtSpare0  xWrtRIP], ecx
+        mov     ecx, [bs2Gdt + MY_R0_CS + 4  xWrtRIP]
+        mov     [bs2GdtSpare0 + 4  xWrtRIP], ecx ; GdtSpare0 is a copy of the CS descriptor now.
+
+        mov     word [bs2Idt_BP + 2  xWrtRIP], BS2_SEL_SPARE0
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3 ; check again to make sure the CS copy is fine.
+
+
+        ; Data selector (u4Type starts at bit 0x28, that is byte 5) .
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RO
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RO_ACC
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RW
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RW_ACC
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RO_DOWN
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RO_DOWN_ACC
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RW_DOWN
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RW_DOWN_ACC
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        ; Executable selector types (works fine).
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_EO
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_EO_ACC
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_ACC
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_EO_CONF
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_EO_CONF_ACC
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_CONF
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_CONF_ACC
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        ;
+        ; Test with the code selector set to NULL.
+        ;
+        mov     word [bs2Idt_BP + 2  xWrtRIP], 0
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, int3
+
+        mov     word [bs2Idt_BP + 2  xWrtRIP], 1
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, int3
+
+        mov     word [bs2Idt_BP + 2  xWrtRIP], 2
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, int3
+
+        mov     word [bs2Idt_BP + 2  xWrtRIP], 3
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, int3
+
+        mov     word [bs2Idt_BP + 2  xWrtRIP], BS2_SEL_SPARE0 ; restore our CS
+
+        ;
+        ; Test with the code selector marked as not present but otherwise valid.
+        ;
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_ACC
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 07fh
+        BS2_TRAP_INSTR X86_XCPT_NP, BS2_SEL_SPARE0, int3
+
+        ;
+        ; Invalid CS selector and not present, we should get a GP.
+        ; Intel states that the present bit is checked after the type.
+        ;
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 070h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RW_DOWN_ACC
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+%ifdef TMPL_LM64
+        ; Long mode variations on invalid (L and D bits) pitted against NP.
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 070h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_ACC
+        and     byte [bs2GdtSpare0 + 6  xWrtRIP], ~(RT_BIT(5) | RT_BIT(6))      ; (0x35=u1Long, 0x36=u1DefBig) = (0, 0)
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        or      byte [bs2GdtSpare0 + 6  xWrtRIP], RT_BIT(6)                     ; (0x35=u1Long, 0x36=u1DefBig) = (0, 1)
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        or      byte [bs2GdtSpare0 + 6  xWrtRIP], RT_BIT(5)                     ; (0x35=u1Long, 0x36=u1DefBig) = (1, 1)
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 6  xWrtRIP], ~(RT_BIT(5) | RT_BIT(6))
+        or      byte [bs2GdtSpare0 + 6  xWrtRIP], RT_BIT(5)                     ; restored
+%endif
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 070h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_ACC | 080h    ; restore CS to present & valid.
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3                                     ; make sure this is so.
+
+        ;
+        ; Check the CS DPL vs IDTE DPL.
+        ; X86DESCGENERIC.u2Dpl is at bit 0x2d (i.e. in byte 5).
+        ;
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], ~(RT_BIT(5) | RT_BIT(6))
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], 0                             ; CS.DPL == 0 == CPL
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], ~(RT_BIT(5) | RT_BIT(6))
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], 1 << 5                        ; CS.DPL == 1 < CPL
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], ~(RT_BIT(5) | RT_BIT(6))
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], 2 << 5                        ; CS.DPL == 2 < CPL
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], ~(RT_BIT(5) | RT_BIT(6))
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], 3 << 5                        ; CS.DPL == 3 < CPL
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        ; Restore.
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 010h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_ACC | 080h    ; restore CS to present, valid and DPL=0
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3                                     ; make sure it's restored.
+
+        ;
+        ; Is RPL is ignored? Yes, it is.
+        ;
+        and     word [bs2Idt_BP + 2  xWrtRIP], X86_SEL_MASK_OFF_RPL             ; RPL = 0
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0
+
+        and     word [bs2Idt_BP + 2  xWrtRIP], X86_SEL_MASK_OFF_RPL
+        or      byte [bs2Idt_BP + 2  xWrtRIP], 1                                ; RPL = 1
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0
+
+        and     word [bs2Idt_BP + 2  xWrtRIP], X86_SEL_MASK_OFF_RPL
+        or      byte [bs2Idt_BP + 2  xWrtRIP], 2                                ; RPL = 2
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0
+
+        and     word [bs2Idt_BP + 2  xWrtRIP], X86_SEL_MASK_OFF_RPL
+        or      byte [bs2Idt_BP + 2  xWrtRIP], 3                                ; RPL = 3
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0
+
+        ;
+        ; Conforming CS.
+        ;
+        or      byte [bs2Idt_BP + 5  xWrtRIP], (3 << 5)                         ; IDTE.DPL = 3
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 090h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_CONF_ACC      ; CS.DPL=0, code, read, conforming
+
+        call    TMPL_NM_CMN(Bs2ToRing1)
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        call    TMPL_NM_CMN(Bs2ToRing0)
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0 | 1
+
+        call    TMPL_NM_CMN(Bs2ToRing2)
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        call    TMPL_NM_CMN(Bs2ToRing0)
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0 | 2
+
+        call    TMPL_NM_CMN(Bs2ToRing3)
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        call    TMPL_NM_CMN(Bs2ToRing0)
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0 | 3
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0 | 0
+
+        ; RPL is ignored. Only CPL matters.
+        or      byte [bs2Idt_BP + 2  xWrtRIP], (3 << 5)                         ; IDTE.CS.RPL=3
+        call    TMPL_NM_CMN(Bs2ToRing2)
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        call    TMPL_NM_CMN(Bs2ToRing0)
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0 | 2
+
+        and     word [bs2Idt_BP + 2  xWrtRIP], X86_SEL_MASK_OFF_RPL
+        or      byte [bs2Idt_BP + 2  xWrtRIP], (1 << 5)                         ; IDTE.CS.RPL=1
+        call    TMPL_NM_CMN(Bs2ToRing2)
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        call    TMPL_NM_CMN(Bs2ToRing0)
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0 | 2
+
+        and     word [bs2Idt_BP + 2  xWrtRIP], X86_SEL_MASK_OFF_RPL
+        or      byte [bs2Idt_BP + 2  xWrtRIP], (2 << 5)                         ; IDTE.CS.RPL=2
+        call    TMPL_NM_CMN(Bs2ToRing2)
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        call    TMPL_NM_CMN(Bs2ToRing0)
+        ASSERT_TRAP_CS_VALUE BS2_SEL_SPARE0 | 2
+
+        ; Change the CS.DPL to 1 and try it from ring-0.
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 09fh
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], (1 << 5)                      ; CS.DPL=1
+        BS2_TRAP_INSTR X86_XCPT_GP, BS2_SEL_SPARE0, int3
+
+        ; Restore.
+        and     word [bs2Idt_BP + 2  xWrtRIP], X86_SEL_MASK_OFF_RPL
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0x9f                             ; IDTE.DPL=0
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 010h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_ER_ACC | 080h    ; restore CS to present, valid and DPL=0
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3                                     ; make sure it's restored.
+
+        ;
+        ; Limit / canonical checks.
+        ;
+        ; Messing with X86DESCGENERIC.u16LimitLow which is at bit 0,
+        ; X86DESCGENERIC.u4LimitHigh which is at bit 0x30, and
+        ; X86DESCGENERIC.u1Granularity which is at bit 0x37.
+        ;
+        mov     word [bs2GdtSpare0      xWrtRIP], 0010h
+        and     byte [bs2GdtSpare0 + 6  xWrtRIP], 070h                  ; setting limit to 0x10, ASSUMES IDTE.off > 0x10
+%ifdef TMPL_LM64
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+%else
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, int3
+%endif
+
+%ifdef TMPL_LM64
+        or      dword [bs2Idt_BP + 8  xWrtRIP], 0x007f7f33
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, int3
+%endif
+
+        ; Who takes precedence? CS NP or the above GP? NP does.
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 07fh
+        BS2_TRAP_INSTR X86_XCPT_NP, BS2_SEL_SPARE0, int3
+
+
+%ifdef TMPL_LM64
+        ; Who takes precedence? IDTE NP or the not canoncial GP? NP does.
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], 80h
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 07fh
+        BS2_TRAP_INSTR X86_XCPT_NP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+%endif
+
+        ;
+        ; Restore the descriptor and make sure it works.
+        ;
+%ifdef TMPL_LM64
+        pop     qword [bs2Idt_BP + 8 xWrtRIP]
+        pop     qword [bs2Idt_BP     xWrtRIP]
+%else
+        pop     dword [bs2Idt_BP + 4 xWrtRIP]
+        pop     dword [bs2Idt_BP     xWrtRIP]
+%endif
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', IDTE CS checks', 0
+ENDPROC   TMPL_NM(TestCodeSelector)
+
+
+;;
+; Checks that the IDTE type is checked before the CS type.
+;
+; @uses No registers, but BS2_SEL_SPARE0 is trashed.
+;
+BEGINPROC TMPL_NM(TestCheckOrderCsTypeVsIdteType)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+
+        ;
+        ; Check the int3 and save its IDTE.
+        ;
+        ; We'll be changing X86DESCGATE.u4Type, which starts at bit 0x28 (that
+        ; is byte 5) and is 4-bit wide, and X86DESCGATE.u1DescType, which is
+        ; at bit 2c.
+        ;
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3 ; check that int3 works before we start messing around...
+
+%ifdef TMPL_LM64
+        push    qword [bs2Idt_BP     xWrtRIP]
+        push    qword [bs2Idt_BP + 8 xWrtRIP]
+%else
+        push    dword [bs2Idt_BP     xWrtRIP]
+        push    dword [bs2Idt_BP + 4 xWrtRIP]
+%endif
+
+        ;
+        ; Make a copy of our CS descriptor into spare one and make INT3 use it.
+        ;
+        mov     ecx, [bs2Gdt + MY_R0_CS  xWrtRIP]
+        mov     [bs2GdtSpare0  xWrtRIP], ecx
+        mov     ecx, [bs2Gdt + MY_R0_CS + 4  xWrtRIP]
+        mov     [bs2GdtSpare0 + 4  xWrtRIP], ecx ; GdtSpare0 is a copy of the CS descriptor now.
+
+        mov     word [bs2Idt_BP + 2  xWrtRIP], BS2_SEL_SPARE0
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3 ; check again to make sure the CS copy is fine.
+
+        ;
+        ; Make both the IDTE type and CS invalid, we should end up with a IDT GP not the CS one.
+        ; CS = data selector and IDTE invalid 0 type.
+        ;
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 0f0h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_RO
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0e0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_UNDEFINED
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        ;
+        ; Make the IDTE not-present but otherwise fine, keeping CS invalid.
+        ;
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 070h
+%ifdef TMPL_LM64
+        or      byte [bs2Idt_BP + 5  xWrtRIP], AMD64_SEL_TYPE_SYS_INT_GATE
+%else
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_386_TRAP_GATE
+%endif
+        BS2_TRAP_INSTR X86_XCPT_NP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        ;
+        ; Make the CS not present as well.
+        ;
+        and     byte [bs2GdtSpare0 + 5  xWrtRIP], 070h
+        or      byte [bs2GdtSpare0 + 5  xWrtRIP], X86_SEL_TYPE_EO
+        BS2_TRAP_INSTR X86_XCPT_NP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        ;
+        ; CS not present, IDTE invalid but present.
+        ;
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 0f0h
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_UNDEFINED | 0x80
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        ;
+        ; CS NULL, IDTE invalid but present.
+        ;
+        mov     word [bs2Idt_BP + 2  xWrtRIP], 0
+        BS2_TRAP_INSTR X86_XCPT_GP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        ;
+        ; CS NULL, IDTE valid but not present.
+        ;
+        and     byte [bs2Idt_BP + 5  xWrtRIP], 070h
+%ifdef TMPL_LM64
+        or      byte [bs2Idt_BP + 5  xWrtRIP], AMD64_SEL_TYPE_SYS_INT_GATE
+%else
+        or      byte [bs2Idt_BP + 5  xWrtRIP], X86_SEL_TYPE_SYS_386_TRAP_GATE
+%endif
+        BS2_TRAP_INSTR X86_XCPT_NP, (3 << X86_TRAP_ERR_SEL_SHIFT) | X86_TRAP_ERR_IDT, int3
+
+        ;
+        ; Restore the descriptor and make sure it works.
+        ;
+%ifdef TMPL_LM64
+        pop     qword [bs2Idt_BP + 8 xWrtRIP]
+        pop     qword [bs2Idt_BP     xWrtRIP]
+%else
+        pop     dword [bs2Idt_BP + 4 xWrtRIP]
+        pop     dword [bs2Idt_BP     xWrtRIP]
+%endif
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', IDTE.type before CS.type', 0
+ENDPROC   TMPL_NM(TestCheckOrderCsTypeVsIdteType)
+
+
+;;
+; Checks stack switching behavior.
+;
+; @uses none
+;
+BEGINPROC TMPL_NM(TestStack)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+        pushf
+        cli
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+
+        ;
+        ; Check the int3, save its IDTE, then make it ring-3 accessible.
+        ;
+        ; X86DESCGENERIC.u2Dpl is at bit 0x2d (i.e. in byte 5).
+        ;
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3 ; check that int3 works before we start messing around...
+
+%ifdef TMPL_LM64
+        push    qword [bs2Idt_BP     xWrtRIP]
+        push    qword [bs2Idt_BP + 8 xWrtRIP]
+%else
+        push    dword [bs2Idt_BP     xWrtRIP]
+        push    dword [bs2Idt_BP + 4 xWrtRIP]
+%endif
+
+        and     byte [bs2Idt_BP + 5  xWrtRIP], ~(RT_BIT(5) | RT_BIT(6))
+        or      byte [bs2Idt_BP + 5  xWrtRIP], 3 << 5       ; DPL == 3
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+
+        ;
+        ; In ring-0 no stack switching is performed.
+        ;
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        mov     xBX, [g_u64LastTrapHandlerRSP]
+%ifdef TMPL_64BIT
+        mov     rax, rsp
+        and     rax, ~15
+        sub     rax, 7*8
+%else
+        lea     eax, [esp - 5*4]
+%endif
+        ASSERT_SIMPLE sAX, xBX, je, "Wrong xSP value for ring-0 -> ring-0 int3."
+        mov     bx, [g_u16LastTrapHandlerSS]
+        mov     ax, ss
+        ASSERT_SIMPLE ax, bx, je, "Wrong SS value for ring-0 -> ring-0 int3."
+
+        ;
+        ; Switch to ring-1 and watch stack switching take place.
+        ;
+        call    TMPL_NM_CMN(Bs2ToRing1)
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        mov     xBX, [g_u64LastTrapHandlerRSP]
+        mov     sAX, BS2_R0_STACK_ADDR
+%ifdef TMPL_64BIT
+        and     rax, ~15
+        sub     rax, 7*8
+%else
+        sub     eax, 7*4
+%endif
+        ASSERT_SIMPLE sAX, xBX, je, "Wrong xSP value for ring-1 -> ring-0 int3."
+        mov     bx, [g_u16LastTrapHandlerSS]
+%ifdef TMPL_64BIT
+        mov     ax, 0
+%else
+        mov     ax, MY_R0_SS
+%endif
+        ASSERT_SIMPLE ax, bx, je, "Wrong SS value for ring-1 -> ring-0 int3."
+
+        call    TMPL_NM_CMN(Bs2ToRing0)
+
+        ;
+        ; Missaligned stack, ring-0 -> ring-0.
+        ;
+        mov     xDI, xSP                ; save the stack pointer.
+%rep 15
+        sub     xSP, 1h
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        mov     xBX, [g_u64LastTrapHandlerRSP]
+%ifdef TMPL_64BIT
+        mov     rax, rsp
+        and     rax, ~15
+        sub     rax, 7*8
+%else
+        lea     eax, [esp - 5*4]
+%endif
+        ASSERT_SIMPLE sAX, xBX, je, "Wrong xSP value for ring-0 -> ring-0 int3, w/ unaligned stack."
+        mov     bx, [g_u16LastTrapHandlerSS]
+        mov     ax, ss
+        ASSERT_SIMPLE ax, bx, je, "Wrong SS value for ring-0 -> ring-0 int3, w/ unaligned stack."
+
+%endrep
+        mov     xSP, xDI                ; restore the stack pointer.
+
+        ;
+        ; Missaligned stack, ring-1 -> ring-0.
+        ;
+        call    TMPL_NM_CMN(Bs2ToRing1)
+
+        mov     sSI, BS2_R0_STACK_ADDR - 16
+%rep 16
+        add     sSI, 1
+%ifdef TMPL_64BIT
+        mov     [bs2Tss64Bit + 4], sSI
+%else
+        mov     [bs2Tss32Bit + 4], sSI
+%endif
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        mov     xBX, [g_u64LastTrapHandlerRSP]
+        mov     sAX, sSI
+%ifdef TMPL_64BIT
+        and     rax, ~15
+        sub     rax, 7*8
+%else
+        sub     eax, 7*4
+%endif
+        ASSERT_SIMPLE sAX, xBX, je, "Wrong xSP value for ring-1 -> ring-0 int3, w/ unaligned ring-0 stack."
+        mov     bx, [g_u16LastTrapHandlerSS]
+%ifdef TMPL_64BIT
+        mov     ax, 0
+%else
+        mov     ax, MY_R0_SS
+%endif
+        ASSERT_SIMPLE sAX, xBX, je, "Wrong SS value for ring-1 -> ring-0 int3, w/ unaligned ring-0 stack."
+
+%endrep
+        call    TMPL_NM_CMN(Bs2ToRing0)
+
+
+%ifdef TMPL_64BIT
+        ;
+        ; Stack table (AMD64 only), ring-0 -> ring-0.
+        ;
+        and     byte [bs2Idt_BP + 4], ~7
+        or      byte [bs2Idt_BP + 4], 3             ; IDTE.IST=3
+
+        mov     rdi, [bs2Tss64Bit + X86TSS64.ist3]
+        mov     rsi, BS2_R0_STACK_ADDR - 128
+ %rep 16
+        sub     rsi, 1h
+        mov     [bs2Tss64Bit + X86TSS64.ist3], rsi
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        mov     rbx, [g_u64LastTrapHandlerRSP]
+        mov     rax, rsi
+        and     rax, ~15
+        sub     rax, 7*8
+        ASSERT_SIMPLE rax, rbx, je, "Wrong xSP value for ring-0 -> ring-0 int3, w/ unaligned IST."
+        mov     bx, [g_u16LastTrapHandlerSS]
+        mov     ax, ss
+        ASSERT_SIMPLE ax, bx, je, "Wrong SS value for ring-0 -> ring-0 int3, w/ unaligned IST."
+
+ %endrep
+
+        ; Continue in ring-1,2,3.
+ %assign uCurRing 1
+ %rep 3
+        call    TMPL_NM_CMN(Bs2ToRing %+ uCurRing)
+  %rep 16
+        sub     rsi, 1h
+        mov     [bs2Tss64Bit + X86TSS64.ist3], rsi
+
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        mov     rbx, [g_u64LastTrapHandlerRSP]
+        mov     rax, rsi
+        and     rax, ~15
+        sub     rax, 7*8
+        ASSERT_SIMPLE rax, rbx, je, "Wrong xSP value for ring-X -> ring-0 int3, w/ unaligned IST."
+        mov     bx, [g_u16LastTrapHandlerSS]
+        mov     ax, 0
+        ASSERT_SIMPLE ax, bx, je, "Wrong SS value for ring-X -> ring-0 int3, w/ unaligned IST."
+  %endrep
+        call    TMPL_NM_CMN(Bs2ToRing0)
+  %assign uCurRing (uCurRing + 1)
+ %endrep
+
+        mov     [bs2Tss64Bit + X86TSS64.ist3], rdi  ; restore original value
+        and     byte [bs2Idt_BP + 4], ~7            ; IDTE.IST=0
+
+
+        ;
+        ; Check SS handling when interrupting 32-bit code with a 64-bit handler.
+        ;
+        call    Bs2Thunk_lm64_lm32
+        BITS 32
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        mov     bx, [g_u16LastTrapHandlerSS]
+        mov     ax, ss
+        call    Bs2Thunk_lm32_lm64
+        BITS 64
+        ASSERT_SIMPLE ax, bx, je, "Wrong SS value for ring-0-32 -> ring-0-64 int3, w/ 32-bit stack."
+
+        call    Bs2Thunk_lm64_lm32
+        BITS 32
+        mov     cx, ss
+        mov     ax, BS2_SEL_SS16
+        mov     ss, ax
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+        mov     bx, [g_u16LastTrapHandlerSS]
+        mov     ss, cx
+        call    Bs2Thunk_lm32_lm64
+        BITS 64
+        ASSERT_SIMPLE ax, bx, je, "Wrong SS value for ring-0-32 -> ring-0-64 int3, w/ 16-bit stack."
+
+%endif ; TMPL_64BIT
+
+
+        ;
+        ; Restore the descriptor and make sure it works.
+        ;
+%ifdef TMPL_LM64
+        pop     qword [bs2Idt_BP + 8 xWrtRIP]
+        pop     qword [bs2Idt_BP     xWrtRIP]
+%else
+        pop     dword [bs2Idt_BP + 4 xWrtRIP]
+        pop     dword [bs2Idt_BP     xWrtRIP]
+%endif
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+
+        popf
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', Stack switching', 0
+ENDPROC   TMPL_NM(TestStack)
+
+
+
+;;
+; Loads MY_R0_CS into CS.
+;
+; @uses stack, cs, flags
+;
+BEGINPROC TMPL_NM(TestLoadMyCS)
+        push    0
+        push    xAX
+
+        ; Make it a far return with MY_R0_CS + CPL.
+        mov     xAX, [xSP + xCB*2]
+        mov     [xSP + xCB*1], xAX
+        mov     xAX, ss
+%ifdef TMPL_64BIT
+        sub     xAX, BS2_SEL_GRP_SS64 - BS2_SEL_GRP_CS64
+%elifdef TMPL_32BIT
+        sub     xAX, BS2_SEL_GRP_SS32 - BS2_SEL_GRP_CS32
+%elifdef TMPL_16BIT
+        sub     xAX, BS2_SEL_GRP_SS16 - BS2_SEL_GRP_CS16
+%else
+        TMPL_xxBIT is not defined
+%endif
+        mov     [xSP + xCB*2], xAX
+
+        pop     xAX
+        retf
+ENDPROC   TMPL_NM(TestLoadMyCS)
+
+
+;;
+; Checks our understanding of how conforming segments are handled.
+;
+; @uses No registers, but BS2_SEL_SPARE0 is trashed.
+;
+BEGINPROC TMPL_NM(TestConforming)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+        ;
+        ; Check the int3.
+        ;
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3 ; check that int3 works before we start messing around...
+
+        mov     xDI, xSP                ; save the stack pointer.
+        sub     xSP, 20h
+
+        ;
+        ; In this test we will do various experiments with code using a
+        ; conforming CS. The main purpose is to check that CS.RPL is always the
+        ; same as CPL, despite earlier beliefs to the contrary.  Because if it
+        ; is different, iret cannot dermine the CPL to return to among other
+        ; interesting problems.
+        ;
+        mov     ecx, [bs2Gdt + MY_R0_CS  xWrtRIP]
+        mov     [bs2GdtSpare0  xWrtRIP], ecx
+        mov     ecx, [bs2Gdt + MY_R0_CS + 4  xWrtRIP]
+        mov     [bs2GdtSpare0 + 4  xWrtRIP], ecx ; GdtSpare0 is a copy of the CS descriptor now.
+        and     byte [bs2GdtSpare0 + 5], 0x90 ; DPL = 0
+        or      byte [bs2GdtSpare0 + 5], X86_SEL_TYPE_ER_CONF_ACC
+
+%assign uCurRing 0
+%rep 4
+        ; Far jumps.
+ %assign uSpecifiedRpl 0
+ %rep 4
+        call    TMPL_NM_CMN(Bs2ToRing %+ uCurRing)
+        lea     xAX, [.far_jmp_target_ %+ uSpecifiedRpl %+ uCurRing]
+  %ifdef TMPL_64BIT ; AMD doesn't have an jmp far m16:m64 instruction, it ignores REX.W apparently. Intel does though.
+                    ; Tested on: Bulldozer
+        mov     dword [xSP + 4], BS2_SEL_SPARE0 | uSpecifiedRpl
+        mov     [xSP], eax
+        jmp     far dword [xSP]
+  %else
+        mov     dword [xSP + xCB], BS2_SEL_SPARE0 | uSpecifiedRpl
+        mov     [xSP], xAX
+        jmp     far xPRE [xSP]
+  %endif
+.far_jmp_target_ %+ uSpecifiedRpl %+ uCurRing:
+        mov     bx, cs
+        call    TMPL_NM(TestLoadMyCS)
+        call    TMPL_NM_CMN(Bs2ToRing0)
+        ASSERT_CUR_CS_VALUE_IN_BX BS2_SEL_SPARE0 | uCurRing
+  %assign uSpecifiedRpl uSpecifiedRpl + 1
+ %endrep
+
+        ; Far calls.
+ %assign uSpecifiedRpl 0
+ %rep 4
+        call    TMPL_NM_CMN(Bs2ToRing %+ uCurRing)
+        mov     xSI, xSP
+        lea     xAX, [.far_call_target_ %+ uSpecifiedRpl %+ uCurRing]
+  %ifdef TMPL_64BIT ; AMD doesn't have an call far m16:m64 instruction, it ignores REX.W apparently. Intel does though.
+                    ; Tested on: Bulldozer
+        mov     dword [xSP + 4], BS2_SEL_SPARE0 | uSpecifiedRpl
+        mov     [xSP], eax
+        call    far dword [xSP]
+  %else
+        mov     dword [xSP + xCB], BS2_SEL_SPARE0 | uSpecifiedRpl
+        mov     [xSP], xAX
+        call    far xPRE [xSP]
+  %endif
+.far_call_target_ %+ uSpecifiedRpl %+ uCurRing:
+        mov     bx, cs
+  %ifdef TMPL_64BIT
+        add     xSP, 4 * 2
+  %else
+        add     xSP, xCB * 2
+  %endif
+        call    TMPL_NM(TestLoadMyCS)
+        call    TMPL_NM_CMN(Bs2ToRing0)
+        ASSERT_CUR_CS_VALUE_IN_BX BS2_SEL_SPARE0 | uCurRing
+  %assign uSpecifiedRpl uSpecifiedRpl + 1
+ %endrep
+
+ %assign uCurRing uCurRing + 1
+%endrep
+
+        ;
+        ; While at it, lets check something about RPL and non-conforming
+        ; segments.  The check when loading is supposed to be RPL >= DPL,
+        ; except for when loading SS, where RPL = DPL = CPL.
+        ;
+
+        ; ring-0
+        mov     dx, MY_R0_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R0_DS | 0
+        mov     dx, MY_R0_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+
+        ; ring-0 - Lower DPL isn't an issue, only RPL vs DPL.
+        mov     dx, MY_R1_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R1_DS | 0
+        mov     dx, MY_R1_DS | 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R1_DS | 1
+        mov     dx, MY_R1_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   fs, dx
+
+        mov     dx, MY_R2_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R2_DS | 0
+        mov     dx, MY_R2_DS | 2
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R2_DS | 2
+        mov     dx, MY_R2_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   fs, dx
+
+        mov     dx, MY_R3_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 0
+        mov     dx, MY_R3_DS | 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 1
+        mov     dx, MY_R3_DS | 2
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 2
+        mov     dx, MY_R3_DS | 3
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 3
+
+        ; ring-0 - What works above doesn't work with ss.
+        mov     dx, MY_R1_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   ss, dx
+        mov     dx, MY_R1_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   ss, dx
+        mov     dx, MY_R1_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   ss, dx
+        mov     dx, MY_R2_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+
+
+        ; ring-1
+        call    TMPL_NM_CMN(Bs2ToRing1)
+
+        mov     dx, MY_R1_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R1_DS | 0
+        mov     dx, MY_R1_DS | 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R1_DS | 1
+        mov     dx, MY_R1_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   fs, dx
+        mov     dx, MY_R1_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   fs, dx
+
+        mov     dx, MY_R0_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+
+        ; ring-1 - Lower DPL isn't an issue, only RPL vs DPL.
+        mov     dx, MY_R2_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R2_DS | 0
+        mov     dx, MY_R2_DS | 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R2_DS | 1
+        mov     dx, MY_R2_DS | 2
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R2_DS | 2
+        mov     dx, MY_R2_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   fs, dx
+
+        mov     dx, MY_R3_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 0
+        mov     dx, MY_R3_DS | 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 1
+        mov     dx, MY_R3_DS | 2
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 2
+        mov     dx, MY_R3_DS | 3
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 3
+
+        ; ring-1 - What works above doesn't work with ss.
+        mov     dx, MY_R1_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   ss, dx
+        mov     dx, MY_R1_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   ss, dx
+        mov     dx, MY_R2_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+
+
+        ; ring-2
+        call    TMPL_NM_CMN(Bs2ToRing2)
+
+        mov     dx, MY_R2_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R2_DS | 0
+        mov     dx, MY_R2_DS | 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R2_DS | 1
+        mov     dx, MY_R2_DS | 2
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R2_DS | 2
+        mov     dx, MY_R2_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   fs, dx
+
+        mov     dx, MY_R0_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R1_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   fs, dx
+        mov     dx, MY_R1_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   fs, dx
+
+        ; ring-2 - Lower DPL isn't an issue, only RPL vs DPL.
+        mov     dx, MY_R3_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 0
+        mov     dx, MY_R3_DS | 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 1
+        mov     dx, MY_R3_DS | 2
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 2
+        mov     dx, MY_R3_DS | 3
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 3
+
+        ; ring-2 - What works above doesn't work with ss.
+        mov     dx, MY_R2_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   ss, dx
+        mov     dx, MY_R2_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+
+
+        ; ring-3
+        call    TMPL_NM_CMN(Bs2ToRing3)
+
+        mov     dx, MY_R3_DS | 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 0
+        mov     dx, MY_R3_DS | 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 1
+        mov     dx, MY_R3_DS | 2
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 2
+        mov     dx, MY_R3_DS | 3
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, MY_R3_DS | 3
+
+        mov     dx, MY_R0_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+        mov     dx, MY_R0_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R0_DS, mov   fs, dx
+
+        mov     dx, MY_R1_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   fs, dx
+        mov     dx, MY_R1_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R1_DS, mov   fs, dx
+
+        mov     dx, MY_R2_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   fs, dx
+        mov     dx, MY_R2_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   fs, dx
+        mov     dx, MY_R2_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   fs, dx
+        mov     dx, MY_R2_DS | 3
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R2_DS, mov   fs, dx
+
+        ; ring-0 - What works above doesn't work with ss.
+        mov     dx, MY_R3_DS | 0
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 1
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+        mov     dx, MY_R3_DS | 2
+        BS2_TRAP_INSTR X86_XCPT_GP, MY_R3_DS, mov   ss, dx
+
+        call    TMPL_NM_CMN(Bs2ToRing0)
+
+
+        ;
+        ; One more odd thing, NULL selectors and RPL.
+        ;
+        pushf
+        cli
+
+%assign uCurRing 0
+%rep 4
+        ; Null sectors.
+        call    TMPL_NM_CMN(Bs2ToRing %+ uCurRing)
+        mov     si, ss
+
+        mov     dx, 0
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, 0
+ %if MY_IS_64BIT == 0 || uCurRing != 0
+  %ifdef TMPL_64BIT ; AMD is doing something inconsistent.
+   %if uCurRing != 3
+        test    byte [g_fCpuAmd], 1
+        jz      .null_0_not_amd_ %+ uCurRing
+        mov     ss, dx
+        ASSERT_CUR_SREG_VALUE ss, 0
+        jmp     .null_0_next_ %+ uCurRing
+.null_0_not_amd_ %+ uCurRing:
+   %endif
+  %endif
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, mov   ss, dx
+.null_0_next_ %+ uCurRing:
+ %else
+        mov     ss, dx
+        ASSERT_CUR_SREG_VALUE ss, 0
+ %endif
+        mov     ss, si
+
+        mov     dx, 1
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, 1
+ %if MY_IS_64BIT == 0 || uCurRing != 1
+  %ifdef TMPL_64BIT ; AMD is doing something inconsistent.
+   %if uCurRing != 3
+        test    byte [g_fCpuAmd], 1
+        jz      .null_1_not_amd_ %+ uCurRing
+        mov     ss, dx
+        ASSERT_CUR_SREG_VALUE ss, 1
+        jmp     .null_1_next_ %+ uCurRing
+.null_1_not_amd_ %+ uCurRing:
+   %endif
+  %endif
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, mov   ss, dx
+.null_1_next_ %+ uCurRing:
+ %else
+        mov     ss, dx
+        ASSERT_CUR_SREG_VALUE ss, 1
+ %endif
+        mov     ss, si
+
+        mov     dx, 2
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, 2
+ %if MY_IS_64BIT == 0 || uCurRing != 2
+  %ifdef TMPL_64BIT ; AMD is doing something inconsistent.
+   %if uCurRing != 3
+        test    byte [g_fCpuAmd], 1
+        jz      .null_2_not_amd_ %+ uCurRing
+        mov     ss, dx
+        ASSERT_CUR_SREG_VALUE ss, 2
+        jmp     .null_2_next_ %+ uCurRing
+.null_2_not_amd_ %+ uCurRing:
+   %endif
+  %endif
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, mov   ss, dx
+.null_2_next_ %+ uCurRing:
+ %else
+        mov     ss, dx
+        ASSERT_CUR_SREG_VALUE ss, 2
+ %endif
+        mov     ss, si
+
+        mov     dx, 3
+        mov     fs, dx
+        ASSERT_CUR_SREG_VALUE fs, 3
+ %ifdef TMPL_64BIT ; AMD is doing something inconsistent.
+  %if uCurRing != 3
+        test    byte [g_fCpuAmd], 1
+        jz      .null_3_not_amd_ %+ uCurRing
+        mov     ss, dx
+        ASSERT_CUR_SREG_VALUE ss, 3
+        jmp     .null_3_next_ %+ uCurRing
+.null_3_not_amd_ %+ uCurRing:
+  %endif
+ %endif
+        BS2_TRAP_INSTR X86_XCPT_GP, 0, mov   ss, dx
+.null_3_next_ %+ uCurRing:
+        mov     ss, si
+
+ %assign uCurRing uCurRing + 1
+%endrep
+        call    TMPL_NM_CMN(Bs2ToRing0)
+
+        ; Restore the selectors.
+        mov     dx, MY_R0_DS
+        mov     ds, dx
+        mov     es, dx
+        mov     fs, dx
+        mov     gs, dx
+        popf
+
+
+        ;
+        ; Restore the descriptor and make sure it works.
+        ;
+        mov     xSP, xDI                ; restore the stack pointer.
+        BS2_TRAP_INSTR X86_XCPT_BP, 0, int3
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', Conforming CS, ++', 0
+ENDPROC   TMPL_NM(TestConforming)
+
+
+
+;;
+; Returning from interrupt/trap/whatever handlers.
+;
+; @uses No registers, but BS2_SEL_SPARE0 is trashed.
+;
+BEGINPROC TMPL_NM(TestReturn)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+        sub     xSP, 80h                ; iret stack frame space.
+        mov     xSI, xSP                ; Save the stack register.
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+%ifdef TMPL_64BIT
+        pushfq
+        pop     rdi                     ; rdi contains good flags register value.
+
+        ;
+        ; 64-bit mode: IRETQ unconditional pop of SS:RSP.
+        ;
+        mov     qword [rsp + 20h], MY_R0_SS
+        mov     [rsp + 18h], rsp
+        mov     [rsp + 10h], rdi
+        mov     qword [rsp + 08h], MY_R0_CS
+        lea     rax, [.resume1 wrt rip]
+        mov     [rsp + 00h], rax
+        iretq
+
+.resume1:
+        pushfq
+        pop     rbx
+        ASSERT_SIMPLE rsp, rsi, je, "Wrong RSP after IRETQ."
+        mov     rsp, rsi
+        ASSERT_SIMPLE rbx, rdi, je, "Wrong flags after IRETQ."
+        mov     ax, ss
+        ASSERT_SIMPLE ax, MY_R0_SS, je, "Wrong SS after IRETQ."
+        mov     ax, cs
+        ASSERT_SIMPLE ax, MY_R0_CS, je, "Wrong CS after IRETQ."
+
+        ; 64-bit mode: The NT flag causes #GP(0)
+        mov     qword [rsp + 20h], MY_R0_SS
+        lea     rax, [rsp - 100h]
+        mov     [rsp + 18h], rax
+        mov     [rsp + 10h], rdi
+        mov     qword [rsp + 08h], MY_R0_CS
+        lea     rax, [.resume2 wrt rip]
+        mov     [rsp + 00h], rax
+        push    rdi
+        or      dword [rsp], X86_EFL_NT
+        popfq
+        BS2_TRAP_BRANCH_INSTR X86_XCPT_GP, 0, .resume2, iretq
+        pushfq
+        pop     rbx
+        push    rdi
+        popfq
+        ASSERT_SIMPLE rsp, rsi, je, "Wrong RSP after IRETQ."
+        mov     rsp, rsi
+        mov     rax, rdi
+        or      rax, X86_EFL_NT
+        ASSERT_SIMPLE rbx, rax, je, "Wrong flags after IRETQ GP(0)-NT."
+        mov     ax, ss
+        ASSERT_SIMPLE ax, MY_R0_SS, je, "Wrong SS after IRETQ."
+        mov     ax, cs
+        ASSERT_SIMPLE ax, MY_R0_CS, je, "Wrong CS after IRETQ."
+
+        ; 64-bit mode: The VM flag is disregarded.
+        mov     qword [rsp + 20h], MY_R0_SS
+        lea     rax, [rsp - 88h]
+        mov     [rsp + 18h], rax
+        mov     [rsp + 10h], rdi
+        or      dword [rsp + 10h], X86_EFL_VM
+        mov     qword [rsp + 08h], MY_R0_CS
+        lea     rax, [.resume3 wrt rip]
+        mov     [rsp + 00h], rax
+        iretq
+.resume3:
+        pushfq
+        pop     rbx
+        add     rsp, 88h
+        ASSERT_SIMPLE rsp, rsi, je, "Wrong RSP after IRETQ."
+        mov     rsp, rsi
+        mov     rax, rdi
+        ASSERT_SIMPLE rbx, rax, je, "Wrong flags after IRETQ GP(0)-NT."
+        mov     ax, ss
+        ASSERT_SIMPLE ax, MY_R0_SS, je, "Wrong SS after IRETQ."
+        mov     ax, cs
+        ASSERT_SIMPLE ax, MY_R0_CS, je, "Wrong CS after IRETQ."
+
+        ;
+        ; 64-bit mode: IRETD unconditionally pops SS:ESP as well.
+        ;
+        mov     dword [rsp + 10h], MY_R0_SS
+        lea     eax, [esp - 18h]
+        mov     [rsp + 0ch], eax
+        mov     [rsp + 08h], edi
+        mov     dword [rsp + 04h], MY_R0_CS
+        lea     eax, [.resume20 wrt rip]
+        mov     [rsp + 00h], eax
+        iretd
+.resume20:
+        pushfq
+        pop     rbx
+        add     rsp, 18h
+        ASSERT_SIMPLE rsp, rsi, je, "Wrong RSP after IRETD."
+        mov     rsp, rsi
+        ASSERT_SIMPLE rbx, rdi, je, "Wrong flags after IRETD."
+        mov     ax, ss
+        ASSERT_SIMPLE ax, MY_R0_SS, je, "Wrong SS after IRETD."
+        mov     ax, cs
+        ASSERT_SIMPLE ax, MY_R0_CS, je, "Wrong CS after IRETD."
+
+        ;
+        ; 64-bit mode: IRET unconditionally pops SS:SP as well.
+        ;
+        mov     word [rsp + 08h], MY_R0_SS
+        lea     eax, [esp - 1ah]
+        mov     [rsp + 06h], ax
+        mov     [rsp + 04h], di
+        mov     word [rsp + 02h], MY_R0_CS
+        mov     word [rsp + 00h], .resume30
+        o16 iret
+BEGINCODELOW
+.resume30:
+        jmp     .high1
+BEGINCODEHIGH
+.high1:
+        pushfq
+        pop     rbx
+        add     rsp, 1ah
+        ASSERT_SIMPLE rsp, rsi, je, "Wrong RSP after IRET."
+        mov     rsp, rsi
+        ASSERT_SIMPLE rbx, rdi, je, "Wrong flags after IRET."
+        mov     ax, ss
+        ASSERT_SIMPLE ax, MY_R0_SS, je, "Wrong SS after IRET."
+        mov     ax, cs
+        ASSERT_SIMPLE ax, MY_R0_CS, je, "Wrong CS after IRET."
+
+
+%elifdef TMPL_32BIT
+        ; later...
+%endif
+
+        ;
+        ; Returning to 16-bit code, what happens to upper ESP bits?
+        ;
+        cli
+        mov     xBX, xSP                ; save the current stack address
+
+        mov     sAX, BS2_SEL_R3_SS16 | 3
+        push    sAX                     ; Return SS
+        movzx   edi, bx
+        or      edi, 0xdead0000
+        push    sDI                     ; Return sSP
+%ifdef TMPL_64BIT
+        pushfq
+%else
+        pushfd
+%endif
+        mov     sAX, BS2_SEL_R3_CS16 | 3
+        push    sAX                     ; Return CS
+        lea     sAX, [.resume100 xWrtRIP]
+        push    sAX                     ; Return sIP
+%ifdef TMPL_64BIT
+        iretq
+%else
+        iretd
+%endif
+
+BEGINCODELOW
+BITS 16
+.resume100:
+        xchg    ebx, esp
+        call    Bs2ToRing0_p16
+        call    TMPL_NM(Bs2Thunk_p16)
+BITS TMPL_BITS
+        jmp     .high100
+BEGINCODEHIGH
+.high100:
+        and     edi, 0ffffh
+        ASSERT_SIMPLE ebx, edi, je, "IRET to 16-bit didn't restore ESP as expected [#1]."
+
+%ifndef TMPL_16BIT
+        ;
+        ; Take two on 16-bit return, does the high word of ESP leak?
+        ;
+        cli
+        mov     sBX, sSP                ; save the current stack address
+        mov     xSP, BS2_MUCK_ABOUT_BASE + 1000h
+
+        mov     sAX, BS2_SEL_R3_SS16 | 3
+        push    sAX                     ; Return SS
+        mov     sDI, sBX
+        push    sDI                     ; Return sSP
+ %ifdef TMPL_64BIT
+        pushfq
+ %else
+        pushfd
+ %endif
+        mov     sAX, BS2_SEL_R3_CS16 | 3
+        push    sAX                     ; Return CS
+        lea     sAX, [.resume101 xWrtRIP]
+        push    sAX                     ; Return sIP
+ %ifdef TMPL_64BIT
+        iretq
+ %else
+        iretd
+ %endif
+
+BEGINCODELOW
+BITS 16
+.resume101:
+        xchg    ebx, esp
+        call    Bs2ToRing0_p16
+        call    TMPL_NM(Bs2Thunk_p16)
+BITS TMPL_BITS
+        jmp     .high101
+BEGINCODEHIGH
+.high101:
+        or      edi, (BS2_MUCK_ABOUT_BASE + 1000h) & 0ffff0000h
+        ASSERT_SIMPLE ebx, edi, je, "IRET to 16-bit didn't restore ESP as expected [#2]."
+%endif ; Not 16-bit.
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM_CMN(TestSubDone)
+
+        mov     xSP, xSI
+        add     xSP, 80h
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', IRET', 0
+ENDPROC   TMPL_NM(TestReturn)
+
+;;
+; Do the tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(DoTestsForMode_rm)
+        push    bp
+        mov     bp, sp
+        push    ax
+
+        ;
+        ; Check if the mode and NX is supported, do the switch.
+        ;
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+
+        ;
+        ; Test exception handler basics using INT3 and #BP.
+        ;
+
+        call    TMPL_NM(TestGateType)
+        call    TMPL_NM(TestCodeSelector)
+        call    TMPL_NM(TestCheckOrderCsTypeVsIdteType)
+        call    TMPL_NM(TestStack)
+        call    TMPL_NM(TestConforming)
+        call    TMPL_NM(TestReturn)
+
+        ;
+        ; Back to real mode.
+        ;
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+        call    Bs2DisableNX_r86
+
+.done:
+        pop     ax
+        leave
+        ret
+ENDPROC TMPL_NM(DoTestsForMode_rm)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-1.asm
new file mode 100644
index 0000000..13b1af8
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-1.asm
@@ -0,0 +1,128 @@
+; $Id: bootsector2-cpu-xcpt-1.asm $
+;; @file
+; Bootsector test for basic exception stuff.
+;
+; Recommended (but not necessary):
+;   VBoxManage setextradata bs-cpu-xcpt-1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;*******************************************************************************
+;*      Header Files                                                           *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+
+;*******************************************************************************
+;*      Defined Constants And Macros                                           *
+;*******************************************************************************
+;; Base address at which we can start testing page tables and page directories.
+%define TST_SCRATCH_PD_BASE             BS2_MUCK_ABOUT_BASE
+;; Base address at which we can start testing the page pointer table.
+%define TST_SCRATCH_PDPT_BASE           (1 << X86_PDPT_SHIFT)
+;; Base address at which we can start testing the page map level 4.
+%define TST_SCRATCH_PML4_BASE           ((1 << X86_PML4_SHIFT) + TST_SCRATCH_PD_BASE)
+
+
+;
+; Include and execute the init code.
+;
+        %define BS2_INIT_RM
+        %define BS2_WITH_TRAPS
+        %define BS2_INC_RM
+        %define BS2_INC_PE16
+        %define BS2_INC_PE32
+        %define BS2_INC_PP16
+        %define BS2_INC_PP32
+        %define BS2_INC_PAE16
+        %define BS2_INC_PAE32
+        %define BS2_INC_LM16
+        %define BS2_INC_LM32
+        %define BS2_INC_LM64
+        %define BS2_WITH_TRAPRECS
+        %include "bootsector2-common-init-code.mac"
+
+
+;
+; The main() function.
+;
+BEGINPROC main
+        BITS 16
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+        call    Bs2EnableA20_r86
+
+
+        ;
+        ; Execute the tests
+        ;
+%if 1
+        call    NAME(DoTestsForMode_rm_pe32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_pp32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_pae32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_lm64)
+%endif
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        ret
+
+.s_szTstName:
+        db      'tstCpuXcpt1', 0
+ENDPROC   main
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+%define TMPL_PE32
+%include "bootsector2-cpu-xcpt-1-template.mac"
+%define TMPL_PP32
+%include "bootsector2-cpu-xcpt-1-template.mac"
+%define TMPL_PAE32
+%include "bootsector2-cpu-xcpt-1-template.mac"
+%define TMPL_LM64
+%include "bootsector2-cpu-xcpt-1-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-2-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-2-template.mac
new file mode 100644
index 0000000..fb95a94
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-2-template.mac
@@ -0,0 +1,501 @@
+; $Id: bootsector2-cpu-xcpt-2-template.mac $
+;; @file
+; Bootsector test for debug exceptions - multi mode template.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bootsector2-template-header.mac"
+
+
+;*******************************************************************************
+;*  Defined Constants And Macros                                               *
+;*******************************************************************************
+;;
+; Some 32/64 macros.
+;
+%if TMPL_BITS == 32
+ %define bs2Idt_BP      bs2Idt32bit_BP
+ %define MY_R0_CS       BS2_SEL_CS32
+ %define MY_R1_CS       BS2_SEL_R1_CS32
+ %define MY_R2_CS       BS2_SEL_R2_CS32
+ %define MY_R3_CS       BS2_SEL_R3_CS32
+
+ %define MY_R0_DS       BS2_SEL_DS32
+ %define MY_R1_DS       BS2_SEL_R1_DS32
+ %define MY_R2_DS       BS2_SEL_R2_DS32
+ %define MY_R3_DS       BS2_SEL_R3_DS32
+
+ %define MY_R0_SS       BS2_SEL_SS32
+ %define MY_R1_SS       BS2_SEL_R1_SS32
+ %define MY_R2_SS       BS2_SEL_R2_SS32
+ %define MY_R3_SS       BS2_SEL_R3_SS32
+
+%else
+ %define bs2Idt_BP      bs2Idt64bit_BP
+ %define MY_R0_CS       BS2_SEL_CS64
+ %define MY_R1_CS       BS2_SEL_R1_CS64
+ %define MY_R2_CS       BS2_SEL_R2_CS64
+ %define MY_R3_CS       BS2_SEL_R3_CS64
+
+ %define MY_R0_DS       BS2_SEL_DS64
+ %define MY_R1_DS       BS2_SEL_R1_DS64
+ %define MY_R2_DS       BS2_SEL_R2_DS64
+ %define MY_R3_DS       BS2_SEL_R3_DS64
+
+ %define MY_R0_SS       BS2_SEL_SS64
+ %define MY_R1_SS       BS2_SEL_R1_SS64
+ %define MY_R2_SS       BS2_SEL_R2_SS64
+ %define MY_R3_SS       BS2_SEL_R3_SS64
+%endif
+
+%ifdef TMPL_64BIT
+ %assign MY_IS_64BIT 1
+%else
+ %assign MY_IS_64BIT 0
+%endif
+
+;; Uncomment this to do lots more iterations (takes time!).
+%define QUICK_TEST
+
+
+;*******************************************************************************
+;*      Global Variables                                                       *
+;*******************************************************************************
+%ifndef CPU_XCPT_1_GLOBALS
+ %define CPU_XCPT_1_GLOBALS
+
+;;
+; Asserts a test.
+;
+; @param    %1  First cmp operand.
+; @param    %2  First cmp operand.
+; @param    %3  Which kind of conditional jump to make
+; @param    %4  The message to print (format string, no arguments please).
+;
+ %macro ASSERT_SIMPLE 4
+        cmp     %1, %2
+        %3      %%.ok
+        cli                             ; raw-mode hack
+        push    dword __LINE__
+  %ifdef TMPL_16BIT
+        push    ds
+  %endif
+        push    %%.s_szMsg
+        call    TMPL_NM_CMN(TestFailedF)
+        add     xSP, sCB*2
+        ;hlt
+        sti
+        jmp     %%.ok
+ %%.s_szMsg: db %4, " (0x%RX32)", 0
+ %%.ok:
+ %endmacro
+
+%endif
+
+
+;;
+; Disable the breakpoints as well as check RA1 bits.
+;
+; @changes DRx
+;
+BEGINPROC TMPL_NM(DisableBps)
+        push    sAX
+        push    sBX
+        sPUSHF
+
+        xor     eax, eax
+        mov     dr7, sAX
+        mov     dr6, sAX
+        mov     dr0, sAX
+        mov     dr1, sAX
+        mov     dr2, sAX
+        mov     dr3, sAX
+
+        mov     sAX, dr6
+        mov     ebx, X86_DR6_RA1_MASK
+        ASSERT_SIMPLE sAX, xBX, je, "Wrong DR6 value (RA1)."
+        mov     sAX, dr7
+        mov     ebx, X86_DR7_RA1_MASK
+        ASSERT_SIMPLE sAX, sBX, je, "Wrong DR7 value (RA1)."
+
+        sPOPF
+        pop     sBX
+        pop     sAX
+        ret
+ENDPROC   TMPL_NM(DisableBps)
+
+
+;;
+; Checks different gate types.
+;
+BEGINPROC TMPL_NM(TestStepping)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+
+        ;
+        ; Step one instruction a lot of times to catch DR6 mismanagement.
+        ;
+%ifdef QUICK_TEST
+        mov     ecx, 0x1000
+%else
+        mov     ecx, 0x80000
+%endif
+.the_1st_loop:
+
+        mov     eax, X86_DR6_INIT_VAL
+        mov     dr6, sAX
+        mov     eax, 0x12345678
+        mov     ebx, 0xaabbccdd
+        sPUSHF
+        or      word [xSP], X86_EFL_TF
+        sPOPF
+        xchg ebx, eax
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, nop
+        ASSERT_SIMPLE eax, 0xaabbccdd, je, "xchg wasn't executed (eax)."
+        ASSERT_SIMPLE ebx, 0x12345678, je, "xchg wasn't executed (ebx)."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_BS), je, "Wrong DR6 value."
+
+        dec     ecx
+        jnz     .the_1st_loop
+
+        ;
+        ; Check that certain bits in DR6 is preserved and others not.
+        ;
+%ifdef QUICK_TEST
+        mov     ecx, 0x200
+%else
+        mov     ecx, 0x20000
+%endif
+.the_2nd_loop:
+        mov     eax, X86_DR6_INIT_VAL | X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3 | X86_DR6_BT | X86_DR6_BD
+        mov     dr6, sAX
+        mov     eax, 0x12345678
+        mov     ebx, 0xaabbccdd
+        sPUSHF
+        or      word [xSP], X86_EFL_TF
+        sPOPF
+        xchg ebx, eax
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, nop
+        ASSERT_SIMPLE eax, 0xaabbccdd, je, "xchg wasn't executed (eax)."
+        ASSERT_SIMPLE ebx, 0x12345678, je, "xchg wasn't executed (ebx)."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_BS | X86_DR6_INIT_VAL | X86_DR6_BT | X86_DR6_BD), je, "Wrong DR6 value."
+
+        dec     ecx
+        jnz     .the_2nd_loop
+
+        ;
+        ; Done.
+        ;
+        cli                             ; raw-mode hack
+        call    TMPL_NM_CMN(TestSubDone)
+        sti
+
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', EFLAGS.TF stepping', 0
+ENDPROC   TMPL_NM(TestGateType)
+
+
+;;
+; Check execution breakpoint.
+;
+BEGINPROC TMPL_NM(TestBpExec)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+
+        ;
+        ; Arm all 4 breakpoints and check DR6 management.
+        ;
+%ifdef QUICK_TEST
+        mov     ecx, 0x1000
+%else
+        mov     ecx, 0x80000
+%endif
+        lea     sAX, [.bp_dr0 xWrtRIP]
+        mov     dr0, sAX
+        lea     sAX, [.bp_dr1 xWrtRIP]
+        mov     dr1, sAX
+        lea     sAX, [.bp_dr2 xWrtRIP]
+        mov     dr2, sAX
+        lea     sAX, [.bp_dr3 xWrtRIP]
+        mov     dr3, sAX
+        mov     eax, X86_DR7_RA1_MASK | X86_DR7_G0 | X86_DR7_G1 | X86_DR7_G2 | X86_DR7_G3 | X86_DR7_GE
+        mov     dr7, sAX
+
+.the_loop:
+        mov     eax, X86_DR6_INIT_VAL | X86_DR6_BS | X86_DR6_BT | X86_DR6_BD
+        mov     dr6, sAX
+
+        mov     eax, 0x12345678
+        mov     ebx, 0xaabbccdd
+.bp_dr0:
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, xchg ebx, eax
+        ASSERT_SIMPLE eax, 0x12345678, je, "xchg was executed (eax)."
+        ASSERT_SIMPLE ebx, 0xaabbccdd, je, "xchg was executed (ebx)."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_BS | X86_DR6_BT | X86_DR6_BD | X86_DR6_B0), je, "Wrong DR6 value (dr0)."
+
+        mov     eax, 0x12345678
+        mov     ebx, 0xaabbccdd
+.bp_dr1:
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, xchg ebx, eax
+        ASSERT_SIMPLE eax, 0x12345678, je, "xchg was executed (eax)."
+        ASSERT_SIMPLE ebx, 0xaabbccdd, je, "xchg was executed (ebx)."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_BS | X86_DR6_BT | X86_DR6_BD | X86_DR6_B1), je, "Wrong DR6 value (dr1)."
+
+        mov     eax, 0x12345678
+        mov     ebx, 0xaabbccdd
+.bp_dr2:
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, xchg ebx, eax
+        ASSERT_SIMPLE eax, 0x12345678, je, "xchg was executed (eax)."
+        ASSERT_SIMPLE ebx, 0xaabbccdd, je, "xchg was executed (ebx)."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_BS | X86_DR6_BT | X86_DR6_BD | X86_DR6_B2), je, "Wrong DR6 value (dr2)."
+
+        mov     eax, 0x12345678
+        mov     ebx, 0xaabbccdd
+.bp_dr3:
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, xchg ebx, eax
+        ASSERT_SIMPLE eax, 0x12345678, je, "xchg was executed (eax)."
+        ASSERT_SIMPLE ebx, 0xaabbccdd, je, "xchg was executed (ebx)."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_BS | X86_DR6_BT | X86_DR6_BD | X86_DR6_B3), je, "Wrong DR6 value (dr3)."
+
+        dec     ecx
+        jnz     .the_loop
+
+        ;
+        ; Touch the code, making sure the BPs don't trigger on data access.
+        ;
+        mov     al, [.bp_dr0 xWrtRIP]
+        mov     [.bp_dr0 xWrtRIP], al
+        mov     al, [.bp_dr1 xWrtRIP]
+        mov     [.bp_dr1 xWrtRIP], al
+        mov     al, [.bp_dr2 xWrtRIP]
+        mov     [.bp_dr2 xWrtRIP], al
+        mov     al, [.bp_dr3 xWrtRIP]
+        mov     [.bp_dr3 xWrtRIP], al
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM(DisableBps)
+        cli                             ; raw-mode hack
+        call    TMPL_NM_CMN(TestSubDone)
+        sti
+
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', Exec BP', 0
+ENDPROC   TMPL_NM(TestBpExec)
+
+
+;;
+; Check I/O breakpoints.
+;
+BEGINPROC TMPL_NM(TestBpIo)
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    xBX
+        push    xCX
+        push    xDX
+        push    xDI
+        push    xSI
+
+        mov     xAX, .s_szSubTestName
+        call    TMPL_NM_CMN(TestSub)
+
+
+        ;
+        ; Arm all 4 breakpoints and check range handling and such.
+        ;
+        mov     sAX, cr4
+        or      sAX, X86_CR4_DE
+        mov     cr4, sAX
+
+%ifdef QUICK_TEST
+        mov     ecx, 1000
+%else
+        mov     ecx, 4096
+%endif
+        mov     sAX, 84h
+        mov     dr0, sAX
+        mov     sAX, 85h
+        mov     dr1, sAX
+        mov     sAX, 86h
+        mov     dr2, sAX
+        mov     sAX, 8ch
+        mov     dr3, sAX
+        mov     eax, X86_DR7_RA1_MASK | X86_DR7_LE | X86_DR7_GE \
+                   | X86_DR7_L0 | X86_DR7_G0 | X86_DR7_RW(0, X86_DR7_RW_IO) | X86_DR7_LEN(0, X86_DR7_LEN_BYTE) \
+                   | X86_DR7_L1 | X86_DR7_G1 | X86_DR7_RW(1, X86_DR7_RW_IO) | X86_DR7_LEN(1, X86_DR7_LEN_WORD) \
+                   | X86_DR7_L2 | X86_DR7_G2 | X86_DR7_RW(2, X86_DR7_RW_IO) | X86_DR7_LEN(2, X86_DR7_LEN_DWORD) \
+                   | X86_DR7_L3 | X86_DR7_G3 | X86_DR7_RW(3, X86_DR7_RW_IO) | X86_DR7_LEN(3, X86_DR7_LEN_DWORD)
+        mov     dr7, sAX
+
+.the_loop:
+        mov     eax, X86_DR6_INIT_VAL
+        mov     dr6, sAX
+
+        mov     eax, 0x12345678
+        in eax, 84h
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, nop
+        ASSERT_SIMPLE eax, 0x12345678, jne, "in was not executed."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_B0), je, "Wrong DR6 value (dr0)."
+
+        mov     ebx, 0x12345678
+        in eax, 85h
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, nop
+        ASSERT_SIMPLE eax, 0x12345678, jne, "in was not executed."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_B1), je, "Wrong DR6 value (dr1)."
+
+        mov     eax, 0x12345678
+        in eax, 86h
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, nop
+        ASSERT_SIMPLE eax, 0x12345678, jne, "in was not executed."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_B2), je, "Wrong DR6 value (dr2)."
+
+        mov     eax, 0x12345678
+        in eax, 8ch
+        BS2_TRAP_INSTR X86_XCPT_DB, 0, nop
+        ASSERT_SIMPLE eax, 0x12345678, jne, "in was not executed."
+        mov     sAX, dr6
+        ASSERT_SIMPLE eax, (X86_DR6_INIT_VAL | X86_DR6_B3), je, "Wrong DR6 value (dr3)."
+
+        dec     ecx
+        jnz     .the_loop
+
+        ;
+        ; Done.
+        ;
+        call    TMPL_NM(DisableBps)
+        cli                             ; raw-mode hack
+        call    TMPL_NM_CMN(TestSubDone)
+        sti
+
+        pop     xSI
+        pop     xDI
+        pop     xDX
+        pop     xCX
+        pop     xBX
+        pop     sAX
+        leave
+        ret
+
+.s_szSubTestName:
+        db      TMPL_MODE_STR, ', I/O BP', 0
+ENDPROC   TMPL_NM(TestBpIo)
+
+
+;;
+; Do the tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(DoTestsForMode_rm)
+        push    bp
+        mov     bp, sp
+        push    ax
+
+        ;
+        ; Check if the mode and NX is supported, do the switch.
+        ;
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+        pushf
+        sti                             ; raw-mode hacks
+
+        ;
+        ; Do the testing.
+        ;
+
+        call    TMPL_NM(TestStepping)
+        call    TMPL_NM(TestBpExec)
+        call    TMPL_NM(TestBpIo)
+
+        ;
+        ; Back to real mode.
+        ;
+        popf
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+        call    Bs2DisableNX_r86
+
+.done:
+        pop     ax
+        leave
+        ret
+ENDPROC TMPL_NM(DoTestsForMode_rm)
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-2.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-2.asm
new file mode 100644
index 0000000..c545b46
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-cpu-xcpt-2.asm
@@ -0,0 +1,119 @@
+; $Id: bootsector2-cpu-xcpt-2.asm $
+;; @file
+; Bootsector test for debug exceptions.
+;
+; Recommended (but not necessary):
+;   VBoxManage setextradata bs-cpu-xcpt-2 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;*******************************************************************************
+;*      Header Files                                                           *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+
+;
+; Include and execute the init code.
+;
+        %define BS2_INIT_RM
+        %define BS2_WITH_TRAPS
+        %define BS2_INC_RM
+        %define BS2_INC_PE16
+        %define BS2_INC_PE32
+        %define BS2_INC_PP16
+        %define BS2_INC_PP32
+        %define BS2_INC_PAE16
+        %define BS2_INC_PAE32
+        %define BS2_INC_LM16
+        %define BS2_INC_LM32
+        %define BS2_INC_LM64
+        %define BS2_WITH_TRAPRECS
+        %define BS2_WITH_XCPT_DB_CLEARING_TF
+        %include "bootsector2-common-init-code.mac"
+
+
+;
+; The main() function.
+;
+BEGINPROC main
+        BITS 16
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+        call    Bs2EnableA20_r86
+        cli                             ; raw-mode hack
+
+
+        ;
+        ; Execute the tests
+        ;
+%if 1
+        call    NAME(DoTestsForMode_rm_pe32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_pp32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_pae32)
+%endif
+%if 1
+        call    NAME(DoTestsForMode_rm_lm64)
+%endif
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        ret
+
+.s_szTstName:
+        db      'tstCpuXcpt2', 0
+ENDPROC   main
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+%define TMPL_PE32
+%include "bootsector2-cpu-xcpt-2-template.mac"
+%define TMPL_PP32
+%include "bootsector2-cpu-xcpt-2-template.mac"
+%define TMPL_PAE32
+%include "bootsector2-cpu-xcpt-2-template.mac"
+%define TMPL_LM64
+%include "bootsector2-cpu-xcpt-2-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-first.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-first.mac
new file mode 100644
index 0000000..2b1d7da
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-first.mac
@@ -0,0 +1,74 @@
+; $Id: bootsector2-first.mac $
+;; @file
+; bootsector2 first include file - works around YASM / kBuild issues.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%ifndef ___bootsector2_first_mac
+%define ___bootsector2_first_mac
+
+;
+; Undefine thing that shouldn't be defined if we're targeting the
+; binary format directly. These macros comes from DEFS in Config.kmk.
+;
+%ifdef ASM_FORMAT_BIN
+ %undef RT_ARCH_AMD64
+ %undef RT_ARCH_X86
+
+ %undef RT_OS_DARWIN
+ %undef RT_OS_FREEBSD
+ %undef RT_OS_HAIKU
+ %undef RT_OS_LINUX
+ %undef RT_OS_NETBSD
+ %undef RT_OS_OPENBSD
+ %undef RT_OS_OS2
+ %undef RT_OS_WINDOWS
+
+ %undef __AMD64__
+ %undef __x86_64__
+ %undef __i386__
+ %undef __I386__
+ %undef __x86__
+ %undef __X86__
+
+ %undef __WIN__
+ %undef __WIN32__
+ %undef __WIN64__
+%endif
+
+
+;
+; Include standard includes.
+;
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+
+;
+; Open the code segment.
+;
+BEGINCODE
+
+%endif
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-structures.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-structures.mac
new file mode 100644
index 0000000..71d93b1
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-structures.mac
@@ -0,0 +1,91 @@
+; $Id: bootsector2-structures.mac $
+;; @file
+; Common structures.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+%ifndef ___bootsector2_structures_mac___
+%define ___bootsector2_structures_mac___
+
+
+;;
+; Registers.  Used by traps and such.
+;
+struc BS2REGS
+        .rax    resq 1
+        .rbx    resq 1
+        .rcx    resq 1
+        .rdx    resq 1
+        .rdi    resq 1
+        .rsi    resq 1
+        .rbp    resq 1
+        .rsp    resq 1
+        .rip    resq 1
+        .r8     resq 1
+        .r9     resq 1
+        .r10    resq 1
+        .r11    resq 1
+        .r12    resq 1
+        .r13    resq 1
+        .r14    resq 1
+        .r15    resq 1
+        .rflags resq 1
+        .cs     resw 1
+        .ds     resw 1
+        .es     resw 1
+        .fs     resw 1
+        .gs     resw 1
+        .ss     resw 1
+        .cBits  resb 1
+        .pad    resb 3
+        .cr0    resq 1
+        .cr2    resq 1
+        .cr3    resq 1
+        .cr4    resq 1
+        .cr8    resq 1
+        ;; @todo Add floating point registers when they are active.
+endstruc
+
+
+
+;;
+; Trap record.
+;
+struc BS2TRAPREC
+        ;; The trap location relative to the base address given at
+        ; registration time.
+        .offWhere               resd 1
+        ;; What to add to .offWhere to calculate the resume address.
+        .offResumeAddend        resb 1
+        ;; The trap number.
+        .u8TrapNo               resb 1
+        ;; The error code if the trap takes one.
+        .u16ErrCd               resw 1
+endstruc
+
+;; The size shift.
+%define BS2TRAPREC_SIZE_SHIFT   3
+
+
+%endif
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-template-footer.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-template-footer.mac
new file mode 100644
index 0000000..197af09
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-template-footer.mac
@@ -0,0 +1,106 @@
+; $Id: bootsector2-template-footer.mac $
+;; @file
+; bootsector2 footer for multi-mode code templates.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;
+; Undefine macros defined by the header.
+;
+; Note! The following is useful for verifying that all macros are included here:
+;
+;       for i in `grep "%define" bootsector2-template-header.mac \
+;                 | sed -e 's/^ *%define *//' -e 's/^\([^() ]*\).*$/\1/' \
+;                 | sort -u`
+;       do
+;               if ! grep -wF "%undef $i" bootsector2-template-footer.mac; then
+;                       echo $i
+;               fi
+;       done
+;
+%undef TMPL_RM
+%undef TMPL_PE16
+%undef TMPL_PE32
+%undef TMPL_PEV86
+%undef TMPL_PP16
+%undef TMPL_PP32
+%undef TMPL_PPV86
+%undef TMPL_PAE16
+%undef TMPL_PAE32
+%undef TMPL_PAEV86
+%undef TMPL_LM16
+%undef TMPL_LM32
+%undef TMPL_LM64
+
+%undef TMPL_CMN_PE
+%undef TMPL_CMN_PP
+%undef TMPL_CMN_PAE
+%undef TMPL_CMN_LM
+%undef TMPL_CMN_V86
+
+%undef TMPL_CMN_P16
+%undef TMPL_CMN_P32
+%undef TMPL_CMN_P64
+%undef TMPL_CMN_R16
+%undef TMPL_CMN_R86
+
+%undef TMPL_NM
+%undef TMPL_NM_CMN
+%undef TMPL_MODE
+%undef TMPL_MODE_STR
+%undef TMPL_16BIT
+%undef TMPL_32BIT
+%undef TMPL_64BIT
+%undef TMPL_BITS
+%undef TMPL_PTR_DEF
+%undef TMPL_HAVE_BIOS
+%undef TMPL_BEGINCODE
+
+%undef xCB
+%undef xDEF
+%undef xRES
+%undef xPRE
+%undef xSP
+%undef xBP
+%undef xAX
+%undef xBX
+%undef xCX
+%undef xDX
+%undef xDI
+%undef xSI
+%undef xWrtRIP
+
+%undef sCB
+%undef sDEF
+%undef sRES
+%undef sPRE
+%undef sSP
+%undef sBP
+%undef sAX
+%undef sBX
+%undef sCX
+%undef sDX
+%undef sDI
+%undef sSI
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-template-header.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-template-header.mac
new file mode 100644
index 0000000..99533da
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-template-header.mac
@@ -0,0 +1,793 @@
+; $Id: bootsector2-template-header.mac $
+;; @file
+; bootsector2 header for multi-mode code templates.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+;
+; Check and expand the mode defines.
+; One of the following must be defined:
+;       - TMPL_RM    - real mode.
+;       - TMPL_PE16  - 16-bit protected mode, unpaged.
+;       - TMPL_PE32  - 32-bit protected mode, unpaged.
+;       - TMPL_PEV86 - virtual 8086 mode under protected mode, unpaged.
+;       - TMPL_PP16  - 16-bit protected mode, paged.
+;       - TMPL_PP32  - 32-bit protected mode, paged.
+;       - TMPL_PPV86 - virtual 8086 mode under protected mode, paged.
+;       - TMPL_PAE16 - 16-bit protected mode with PAE (paged).
+;       - TMPL_PAE32 - 16-bit protected mode with PAE (paged).
+;       - TMPL_PAEV86- virtual 8086 mode under protected mode with PAE (paged).
+;       - TMPL_LM16  - 16-bit long mode (paged).
+;       - TMPL_LM32  - 32-bit long mode (paged).
+;       - TMPL_LM64  - 64-bit long mode (paged).
+;
+; Derived indicators:
+;       - TMPL_CMN_PE  = TMPL_PE16  | TMPL_PE32  | TMPL_PEV86
+;       - TMPL_CMN_PP  = TMPL_PP16  | TMPL_PP32  | TMPL_PPV86
+;       - TMPL_CMN_PAE = TMPL_PAE16 | TMPL_PAE32 | TMPL_PAEV86
+;       - TMPL_CMN_LM  = TMPL_LM16  | TMPL_LM32  | TMPL_LM64
+;       - TMPL_CMN_V86 = TMPL_PEV86 | TMPL_PPV86 | TMPL_PAEV86
+;       - TMPL_CMN_R86 = TMPL_CMN_V86 | TMPL_RM
+;
+%ifdef TMPL_RM
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_RM' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_RM' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_RM' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_RM' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_RM' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_RM' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_RM' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_RM' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_RM' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_RM' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_RM' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_RM' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_16BIT
+ %define TMPL_BITS              16
+ %define TMPL_PTR_DEF           dw
+ %define TMPL_NM(Name)          Name %+ _rm
+ %define TMPL_NM_CMN(Name)      Name %+ _r86
+ %define TMPL_MODE_STR          'real mode'
+ %define TMPL_HAVE_BIOS
+ %define TMPL_CMN_R86
+%endif
+
+%ifdef TMPL_PE16
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PE16' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_PE16' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_RM' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_PE16' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PE16' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_PE16' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_PE16' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_PE16' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_PE32' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PE16' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PE16' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PE16' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PE
+ %define TMPL_CMN_P16
+ %define TMPL_16BIT
+ %define TMPL_BITS              16
+ %define TMPL_PTR_DEF           dw
+ %define TMPL_NM(Name)          Name %+ _pe16
+ %define TMPL_NM_CMN(Name)      Name %+ _p16
+ %define TMPL_MODE_STR          '16-bit unpaged protected mode'
+%endif
+
+%ifdef TMPL_PE32
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PE32' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_PE32' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_PE32' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_PE32' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PE32' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_PE32' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_PE32' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_PE32' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAE86
+  %error "Both 'TMPL_PE32' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PE32' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PE32' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PE32' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PE
+ %define TMPL_CMN_P32
+ %define TMPL_32BIT
+ %define TMPL_BITS              32
+ %define TMPL_PTR_DEF           dd
+ %define TMPL_NM(Name)          Name %+ _pe32
+ %define TMPL_NM_CMN(Name)      Name %+ _p32
+ %define TMPL_MODE_STR          '32-bit unpaged protected mode'
+%endif
+
+%ifdef TMPL_PEV86
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PEV86' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_PEV86' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PEV86' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_PEV86' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PEV86' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_PEV86' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_PEV86' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_PEV86' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAE86
+  %error "Both 'TMPL_PEV86' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PEV86' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PEV86' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PEV86' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PE
+ %define TMPL_CMN_V86
+ %define TMPL_CMN_R86
+ %define TMPL_16BIT
+ %define TMPL_BITS              16
+ %define TMPL_PTR_DEF           dw
+ %define TMPL_NM(Name)          Name %+ _pev86
+ %define TMPL_NM_CMN(Name)      Name %+ _r86
+ %define TMPL_MODE_STR          'v8086 unpaged protected mode'
+%endif
+
+%ifdef TMPL_PP16
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PP16' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_PP16' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_PP16' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_PP16' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PP16' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_PP32' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_PP16' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_PP16' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_PP16' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PP16' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PP16' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PP16' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PP
+ %define TMPL_CMN_P16
+ %define TMPL_16BIT
+ %define TMPL_BITS              16
+ %define TMPL_PTR_DEF           dw
+ %define TMPL_NM(Name)          Name %+ _pp16
+ %define TMPL_NM_CMN(Name)      Name %+ _p16
+ %define TMPL_MODE_STR          '16-bit paged protected mode'
+%endif
+
+%ifdef TMPL_PP32
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PP32' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_PP32' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_PP32' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_PP32' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_PP32' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_PP32' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_PP32' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_PP32' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_PP32' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PP32' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PP32' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PP32' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PP
+ %define TMPL_CMN_P32
+ %define TMPL_32BIT
+ %define TMPL_BITS              32
+ %define TMPL_PTR_DEF           dd
+ %define TMPL_NM(Name)          Name %+ _pp32
+ %define TMPL_NM_CMN(Name)      Name %+ _p32
+ %define TMPL_MODE_STR          '32-bit paged protected mode'
+%endif
+
+%ifdef TMPL_PPV86
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PPV86' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_PPV86' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_PPV86' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_PPV86' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_PPV86' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PPV86' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_PPV86' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_PPV86' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_PPV86' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PPV86' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PPV86' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PPV86' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PP
+ %define TMPL_CMN_V86
+ %define TMPL_CMN_R86
+ %define TMPL_16BIT
+ %define TMPL_BITS              16
+ %define TMPL_PTR_DEF           dw
+ %define TMPL_NM(Name)          Name %+ _ppv86
+ %define TMPL_NM_CMN(Name)      Name %+ _r86
+ %define TMPL_MODE_STR          'v8086 paged protected mode'
+%endif
+
+%ifdef TMPL_PAE16
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PAE16' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_PAE16' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_PAE16' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_PAE16' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_PAE16' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PAE16' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_PAE16' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_PAE16' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PAE16' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_PAE16' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PAE16' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PAE16' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PAE
+ %define TMPL_16BIT
+ %define TMPL_CMN_P16
+ %define TMPL_BITS              16
+ %define TMPL_PTR_DEF           dw
+ %define TMPL_NM(Name)          Name %+ _pae16
+ %define TMPL_NM_CMN(Name)      Name %+ _p16
+ %define TMPL_MODE_STR          '16-bit pae protected mode'
+%endif
+
+%ifdef TMPL_PAE32
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PAE32' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_PAE32' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_PAE32' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_PAE32' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_PAE32' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PAE32' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_PAE32' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_PAE32' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_PAE32' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PAE32' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PAE32' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PAE32' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PAE
+ %define TMPL_CMN_P32
+ %define TMPL_32BIT
+ %define TMPL_BITS              32
+ %define TMPL_PTR_DEF           dd
+ %define TMPL_NM(Name)          Name %+ _pae32
+ %define TMPL_NM_CMN(Name)      Name %+ _p32
+ %define TMPL_MODE_STR          '32-bit pae protected mode'
+%endif
+
+%ifdef TMPL_PAEV86
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_PAEV86' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_PAEV86' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_PAEV86' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_PAEV86' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_PAEV86' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_PAEV86' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_PAEV86' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_PAEV86' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_PAEV86' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_PAEV86' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_PAEV86' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_PAEV86' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_PAE
+ %define TMPL_CMN_V86
+ %define TMPL_CMN_R86
+ %define TMPL_16BIT
+ %define TMPL_BITS              16
+ %define TMPL_PTR_DEF           dw
+ %define TMPL_NM(Name)          Name %+ _paev86
+ %define TMPL_NM_CMN(Name)      Name %+ _r86
+ %define TMPL_MODE_STR          'v8086 pae protected mode'
+%endif
+
+%ifdef TMPL_LM16
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_LM16' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_LM16' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_LM16' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_LM16' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_LM16' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_LM16' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_LM16' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_LM16' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_LM16' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_LM16' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_LM16' and 'TMPL_LM32' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_LM16' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_LM
+ %define TMPL_CMN_P16
+ %define TMPL_16BIT
+ %define TMPL_BITS              16
+ %define TMPL_PTR_DEF           dw
+ %define TMPL_NM(Name)          Name %+ _lm16
+ %define TMPL_NM_CMN(Name)      Name %+ _p16
+ %define TMPL_MODE_STR          '16-bit long mode'
+%endif
+
+%ifdef TMPL_LM32
+ %ifdef TMPL_RM
+  %error "Both 'TMPL_LM32' and 'TMPL_RM' are defined."
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_LM32' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_LM32' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_LM32' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_LM32' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_LM32' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_LM32' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_LM32' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_LM32' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_LM32' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_LM32' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM64
+  %error "Both 'TMPL_LM32' and 'TMPL_LM64' are defined."
+ %endif
+ %define TMPL_CMN_LM
+ %define TMPL_CMN_P32
+ %define TMPL_32BIT
+ %define TMPL_BITS              32
+ %define TMPL_PTR_DEF           dd
+ %define TMPL_NM(Name)          Name %+ _lm32
+ %define TMPL_NM_CMN(Name)      Name %+ _p32
+ %define TMPL_MODE_STR          '32-bit long mode'
+%endif
+
+%ifdef TMPL_LM64
+ %ifdef TMPL_RM
+  %error ""Both 'TMPL_LM64' and 'TMPL_RM' are defined.""
+ %endif
+ %ifdef TMPL_PE16
+  %error "Both 'TMPL_LM64' and 'TMPL_PE16' are defined."
+ %endif
+ %ifdef TMPL_PE32
+  %error "Both 'TMPL_LM64' and 'TMPL_PE32' are defined."
+ %endif
+ %ifdef TMPL_PEV86
+  %error "Both 'TMPL_LM64' and 'TMPL_PEV86' are defined."
+ %endif
+ %ifdef TMPL_PP16
+  %error "Both 'TMPL_LM64' and 'TMPL_PP16' are defined."
+ %endif
+ %ifdef TMPL_PP32
+  %error "Both 'TMPL_LM64' and 'TMPL_PP32' are defined."
+ %endif
+ %ifdef TMPL_PPV86
+  %error "Both 'TMPL_LM64' and 'TMPL_PPV86' are defined."
+ %endif
+ %ifdef TMPL_PAE16
+  %error "Both 'TMPL_LM64' and 'TMPL_PAE16' are defined."
+ %endif
+ %ifdef TMPL_PAE32
+  %error "Both 'TMPL_LM64' and 'TMPL_PAE32' are defined."
+ %endif
+ %ifdef TMPL_PAEV86
+  %error "Both 'TMPL_LM64' and 'TMPL_PAEV86' are defined."
+ %endif
+ %ifdef TMPL_LM16
+  %error "Both 'TMPL_LM64' and 'TMPL_LM16' are defined."
+ %endif
+ %ifdef TMPL_LM32
+  %error "Both 'TMPL_LM64' and 'TMPL_LM32' are defined."
+ %endif
+ %define TMPL_CMN_LM
+ %define TMPL_CMN_P64
+ %define TMPL_64BIT
+ %define TMPL_BITS              64
+ %define TMPL_PTR_DEF           dq
+ %define TMPL_NM(Name)          Name %+ _lm64
+ %define TMPL_NM_CMN(Name)      Name %+ _p64
+ %define TMPL_MODE_STR          '64-bit long mode'
+%endif
+
+%ifndef TMPL_MODE_STR
+ %error "internal error"
+%endif
+
+
+;
+; Register aliases.
+;
+%ifdef TMPL_64BIT
+ %define xCB  8
+ %define xDEF dq
+ %define xRES resq
+ %define xPRE qword
+ %define xSP  rsp
+ %define xBP  rbp
+ %define xAX  rax
+ %define xBX  rbx
+ %define xCX  rcx
+ %define xDX  rdx
+ %define xDI  rdi
+ %define xSI  rsi
+ %define xWrtRIP wrt rip
+ %define xPUSHF pushq
+ %define xPOPF  popfq
+%else
+ %ifdef TMPL_32BIT
+  %define xCB  4
+  %define xDEF dd
+  %define xRES resd
+  %define xPRE dword
+  %define xSP  esp
+  %define xBP  ebp
+  %define xAX  eax
+  %define xBX  ebx
+  %define xCX  ecx
+  %define xDX  edx
+  %define xDI  edi
+  %define xSI  esi
+  %define xWrtRIP
+  %define xPUSHF pushfd
+  %define xPOPF  popfd
+ %else
+  %ifndef TMPL_16BIT
+   %error "TMPL_XXBIT is not defined."
+  %endif
+  %define xCB  2
+  %define xDEF dw
+  %define xRES resw
+  %define xPRE word
+  %define xSP  sp
+  %define xBP  bp
+  %define xAX  ax
+  %define xBX  bx
+  %define xCX  cx
+  %define xDX  dx
+  %define xDI  di
+  %define xSI  si
+  %define xWrtRIP
+  %define xPUSHF pushf
+  %define xPOPF  popf
+ %endif
+%endif
+
+;
+; Register names corresponding to the max size for pop/push <reg>.
+;
+; 16-bit can push both 32-bit and 16-bit registers.  This 's' prefixed variant
+; is used when 16-bit should use the 32-bit register.
+;
+%ifdef TMPL_64BIT
+ %define sCB  8
+ %define sDEF dq
+ %define sRES resq
+ %define sPRE qword
+ %define sSP  rsp
+ %define sBP  rbp
+ %define sAX  rax
+ %define sBX  rbx
+ %define sCX  rcx
+ %define sDX  rdx
+ %define sDI  rdi
+ %define sSI  rsi
+ %define sPUSHF pushfq
+ %define sPOPF  popfq
+%else
+ %define sCB  4
+ %define sDEF dd
+ %define sRES resd
+ %define sPRE dword
+ %define sSP  esp
+ %define sBP  ebp
+ %define sAX  eax
+ %define sBX  ebx
+ %define sCX  ecx
+ %define sDX  edx
+ %define sDI  edi
+ %define sSI  esi
+ %define sPUSHF pushfd
+ %define sPOPF  popfd
+%endif
+
+;
+; Default code segment.
+;
+%ifdef TMPL_64BIT
+ %define TMPL_BEGINCODE BEGINCODEHIGH
+%elifdef TMPL_32BIT
+ %define TMPL_BEGINCODE BEGINCODEHIGH
+%elifdef TMPL_16BIT
+ %define TMPL_BEGINCODE BEGINCODELOW
+%else
+ %error "Missing TMPL_xxBIT!"
+%endif
+TMPL_BEGINCODE
+
+;
+; Change the bitness.
+;
+%ifdef TMPL_64BIT
+BITS 64
+%else
+ %ifdef TMPL_32BIT
+BITS 32
+ %else
+BITS 16
+ %endif
+%endif
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-test1-template.mac b/src/VBox/ValidationKit/bootsectors/bootsector2-test1-template.mac
new file mode 100644
index 0000000..7aef28d
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-test1-template.mac
@@ -0,0 +1,756 @@
+; $Id: bootsector2-test1-template.mac $
+;; @file
+; bootsector2 test1 - multi mode template.
+;
+
+;
+; Copyright (C) 2007-2015 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "bootsector2-template-header.mac"
+
+;;
+; Run the CPUID benchmark for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(BenchmarkCpuId_rm)
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sBX
+        push    sCX
+        push    sDX
+        push    sDI
+        sub     sSP, 20h
+
+        ; Get the current time.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetNanoTS)
+
+        ; Do the test.
+        mov     edi, TEST_INSTRUCTION_COUNT_IO / 4
+.again:
+        mov     eax, 1
+        cpuid
+        mov     eax, 1
+        cpuid
+        mov     eax, 1
+        cpuid
+        mov     eax, 1
+        cpuid
+        dec     edi
+        jnz     .again
+
+        ; Calc the elapsed time and report the result.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetElapsedNanoTS)
+
+        mov     xCX, .s_szTestName
+        mov     edx, TEST_INSTRUCTION_COUNT_IO
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(ReportResult)
+
+        add     sSP, 20h
+        pop     sDI
+        pop     sDX
+        pop     sCX
+        pop     sBX
+        pop     sAX
+        leave
+
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+.done:
+        ret
+
+.s_szTestName:
+        db TMPL_MODE_STR, ', CPUID', 0
+ENDPROC TMPL_NM(BenchmarkCpuId_rm)
+
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+;;
+; Run the RDTSC benchmark for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(BenchmarkRdTsc_rm)
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sBX
+        push    sCX
+        push    sDX
+        push    sDI
+        sub     sSP, 20h
+
+        ; Get the current time.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetNanoTS)
+
+        ; Do the test.
+        mov     edi, TEST_INSTRUCTION_COUNT_RDTSC / 4
+.again:
+        rdtsc
+        rdtsc
+        rdtsc
+        rdtsc
+        dec     edi
+        jnz     .again
+
+        ; Calc the elapsed time and report the result.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetElapsedNanoTS)
+
+        mov     xCX, .s_szTestName
+        mov     edx, TEST_INSTRUCTION_COUNT_RDTSC
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(ReportResult)
+
+        add     sSP, 20h
+        pop     sDI
+        pop     sDX
+        pop     sCX
+        pop     sBX
+        pop     sAX
+        leave
+
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+.done:
+        ret
+
+.s_szTestName:
+        db TMPL_MODE_STR, ', RDTSC', 0
+ENDPROC TMPL_NM(BenchmarkRdTsc_rm)
+
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+;;
+; Run the Read CR4 benchmark for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(BenchmarkRdCr4_rm)
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sBX
+        push    sCX
+        push    sDX
+        push    sDI
+        sub     sSP, 20h
+
+        ; Get the current time.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetNanoTS)
+
+        ; Do the test.
+        mov     edi, TEST_INSTRUCTION_COUNT_READCR4 / 4
+.again:
+        mov     sAX, cr4
+        mov     sAX, cr4
+        mov     sAX, cr4
+        mov     sAX, cr4
+        dec     edi
+        jnz     .again
+
+        ; Calc the elapsed time and report the result.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetElapsedNanoTS)
+
+        mov     xCX, .s_szTestName
+        mov     edx, TEST_INSTRUCTION_COUNT_READCR4
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(ReportResult)
+
+        add     sSP, 20h
+        pop     sDI
+        pop     sDX
+        pop     sCX
+        pop     sBX
+        pop     sAX
+        leave
+
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+.done:
+        ret
+
+.s_szTestName:
+        db TMPL_MODE_STR, ', Read CR4', 0
+ENDPROC TMPL_NM(BenchmarkRdCr4_rm)
+
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+;;
+; Prologue for the I/O port tests.
+%ifndef HaveIoPortPrologue
+%define HaveIoPortPrologue
+%macro IoPortPrologue 2
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sDX
+        push    sCX
+        sub     xSP, 20h
+
+        ; Get the current time.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetNanoTS)
+
+        ; Do the test.
+        mov     dx, %2
+        mov     ecx, (%1) / 5
+%endmacro
+%endif
+
+
+;;
+; Epilogue for the I/O port tests.
+%ifndef HaveIoPortEpilogue
+%define HaveIoPortEpilogue
+%macro IoPortEpilogue 1
+        ; Calc the elapsed time and report the result.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetElapsedNanoTS)
+
+        mov     xCX, .s_szTestName
+        mov     edx, (%1)
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(ReportResult)
+
+        add     xSP, 20h
+        pop     sCX
+        pop     sDX
+        pop     sAX
+        leave
+        ret
+%endmacro
+%endif
+
+
+;;
+; Benchmarks: IN eax, NOP
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkIoPortNop32In)
+        IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
+.again:
+        in      eax, dx
+        in      eax, dx
+        in      eax, dx
+        in      eax, dx
+        in      eax, dx
+        dec     ecx
+        jnz     .again
+        IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 32-bit IN', 0
+ENDPROC TMPL_NM(BenchmarkIoPortNop32In)
+
+
+;;
+; Benchmarks: OUT NOP, eax
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkIoPortNop32Out)
+        IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
+.again:
+        out     dx, eax
+        out     dx, eax
+        out     dx, eax
+        out     dx, eax
+        out     dx, eax
+        dec     ecx
+        jnz     .again
+        IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 32-bit OUT', 0
+ENDPROC TMPL_NM(BenchmarkIoPortNop32Out)
+
+
+;;
+; Benchmarks: IN ax, NOP
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkIoPortNop16In)
+        IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
+.again:
+        in      ax, dx
+        in      ax, dx
+        in      ax, dx
+        in      ax, dx
+        in      ax, dx
+        dec     ecx
+        jnz     .again
+        IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 16-bit IN', 0
+ENDPROC TMPL_NM(BenchmarkIoPortNop16In)
+
+
+;;
+; Benchmarks: OUT NOP, ax
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkIoPortNop16Out)
+        IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
+.again:
+        out     dx, ax
+        out     dx, ax
+        out     dx, ax
+        out     dx, ax
+        out     dx, ax
+        dec     ecx
+        jnz     .again
+        IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 16-bit OUT', 0
+ENDPROC TMPL_NM(BenchmarkIoPortNop16Out)
+
+
+;;
+; Benchmarks: IN al, NOP
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkIoPortNop8In)
+        IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
+.again:
+        in      al, dx
+        in      al, dx
+        in      al, dx
+        in      al, dx
+        in      al, dx
+        dec     ecx
+        jnz     .again
+        IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 8-bit IN', 0
+ENDPROC TMPL_NM(BenchmarkIoPortNop8In)
+
+
+;;
+; Benchmarks: OUT NOP, al
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkIoPortNop8Out)
+        IoPortPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_IOPORT_NOP
+.again:
+        out     dx, al
+        out     dx, al
+        out     dx, al
+        out     dx, al
+        out     dx, al
+        dec     ecx
+        jnz     .again
+        IoPortEpilogue TEST_INSTRUCTION_COUNT_IO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 8-bit OUT', 0
+ENDPROC TMPL_NM(BenchmarkIoPortNop8Out)
+
+
+;;
+; Benchmarks: IN eax, NOP_R3
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkIoPortRing3Nop32In)
+        IoPortPrologue TEST_INSTRUCTION_COUNT_IO / 4, VMMDEV_TESTING_IOPORT_NOP_R3
+.again:
+        in      eax, dx
+        in      eax, dx
+        in      eax, dx
+        in      eax, dx
+        in      eax, dx
+        dec     ecx
+        jnz     .again
+        IoPortEpilogue TEST_INSTRUCTION_COUNT_IO / 4
+.s_szTestName:
+        db TMPL_MODE_STR, ', 32-bit IN-to-ring-3', 0
+ENDPROC TMPL_NM(BenchmarkIoPortRing3Nop32In)
+
+
+;;
+; Benchmarks: OUT NOP_R3, eax
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkIoPortRing3Nop32Out)
+        IoPortPrologue TEST_INSTRUCTION_COUNT_IO / 4, VMMDEV_TESTING_IOPORT_NOP_R3
+.again:
+        out     dx, eax
+        out     dx, eax
+        out     dx, eax
+        out     dx, eax
+        out     dx, eax
+        dec     ecx
+        jnz     .again
+        IoPortEpilogue TEST_INSTRUCTION_COUNT_IO / 4
+.s_szTestName:
+        db TMPL_MODE_STR, ', 32-bit OUT-to-ring-3', 0
+ENDPROC TMPL_NM(BenchmarkIoPortRing3Nop32Out)
+
+
+%undef IoPortPrologue
+%undef IoPortEpilogue
+
+
+;;
+; Run the I/O benchmarks for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(BenchmarkIoPortNop_rm)
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+
+        call    TMPL_NM(BenchmarkIoPortNop32In)
+        call    TMPL_NM(BenchmarkIoPortNop32Out)
+%ifndef QUICK_TEST
+        call    TMPL_NM(BenchmarkIoPortNop16In)
+        call    TMPL_NM(BenchmarkIoPortNop16Out)
+        call    TMPL_NM(BenchmarkIoPortNop8In)
+        call    TMPL_NM(BenchmarkIoPortNop8Out)
+%endif
+        call    TMPL_NM(BenchmarkIoPortRing3Nop32In)
+        call    TMPL_NM(BenchmarkIoPortRing3Nop32Out)
+
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+.done:
+        ret
+ENDPROC TMPL_NM(BenchmarkIoPortNop_rm)
+
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+
+
+;;
+; Prologue for the MMIO tests.
+%ifndef HaveMmioPrologue
+%define HaveMmioPrologue
+%macro MmioPrologue 2
+        push    xBP
+        mov     xBP, xSP
+        push    sAX
+        push    sDX
+        push    sCX
+        push    sBX
+        sub     xSP, 20h
+
+        ; Get the current time.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetNanoTS)
+
+        ; Do the test - X million 32-bit IN instructions.
+%ifdef TMPL_16BIT
+        mov     dx, ds                  ; save ds
+ %ifdef TMPL_RM
+        mov     bx, VMMDEV_TESTING_MMIO_RM_SEL
+        mov     ds, bx
+        mov     ebx, VMMDEV_TESTING_MMIO_RM_OFF(%2)
+ %else
+        mov     bx, BS2_SEL_MMIO16
+        mov     ds, bx
+        mov     ebx, %2 - BS2_SEL_MMIO16_BASE
+ %endif
+%else
+        mov     xBX, %2
+%endif
+        mov     ecx, (%1) / 5
+%endmacro
+%endif
+
+;;
+; Epilogue for the MMIO tests.
+%ifndef HaveMmioEpilogue
+%define HaveMmioEpilogue
+%macro MmioEpilogue 1
+%ifdef TMPL_16BIT
+        mov     ds, dx                  ; restore ds
+%endif
+
+        ; Calc the elapsed time and report the result.
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(GetElapsedNanoTS)
+
+        mov     xCX, .s_szTestName
+        mov     edx, (%1)
+        mov     xAX, xSP
+        call    TMPL_NM_CMN(ReportResult)
+
+        add     xSP, 20h
+        pop     sBX
+        pop     sCX
+        pop     sDX
+        pop     sAX
+        leave
+        ret
+%endmacro
+%endif
+
+
+;;
+; Benchmarks: MOV eax, [NOP]
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkMmioNop32Read)
+        MmioPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_MMIO_NOP
+.again:
+        mov     eax, [sBX]
+        mov     eax, [sBX]
+        mov     eax, [sBX]
+        mov     eax, [sBX]
+        mov     eax, [sBX]
+        dec     ecx
+        jnz     .again
+        MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 32-bit read', 0
+ENDPROC TMPL_NM(BenchmarkMmioNop32Read)
+
+
+;;
+; Benchmarks: MOV [NOP], eax
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkMmioNop32Write)
+        MmioPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_MMIO_NOP
+.again:
+        mov     [sBX], eax
+        mov     [sBX], eax
+        mov     [sBX], eax
+        mov     [sBX], eax
+        mov     [sBX], eax
+        dec     ecx
+        jnz     .again
+        MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 32-bit write', 0
+ENDPROC TMPL_NM(BenchmarkMmioNop32Write)
+
+
+;;
+; Benchmarks: MOV ax, [NOP]
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkMmioNop16Read)
+        MmioPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_MMIO_NOP
+.again:
+        mov     ax, [xBX]
+        mov     ax, [xBX]
+        mov     ax, [xBX]
+        mov     ax, [xBX]
+        mov     ax, [xBX]
+        dec     ecx
+        jnz     .again
+        MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 16-bit read', 0
+ENDPROC TMPL_NM(BenchmarkMmioNop16Read)
+
+
+;;
+; Benchmarks: MOV [NOP], ax
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkMmioNop16Write)
+        MmioPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_MMIO_NOP
+.again:
+        mov     [xBX], ax
+        mov     [xBX], ax
+        mov     [xBX], ax
+        mov     [xBX], ax
+        mov     [xBX], ax
+        dec     ecx
+        jnz     .again
+        MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 16-bit write', 0
+ENDPROC TMPL_NM(BenchmarkMmioNop16Write)
+
+
+;;
+; Benchmarks: MOV al, [NOP]
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkMmioNop8Read)
+        MmioPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_MMIO_NOP
+.again:
+        mov     al, [xBX]
+        mov     al, [xBX]
+        mov     al, [xBX]
+        mov     al, [xBX]
+        mov     al, [xBX]
+        dec     ecx
+        jnz     .again
+        MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 8-bit read', 0
+ENDPROC TMPL_NM(BenchmarkMmioNop8Read)
+
+
+;;
+; Benchmarks: MOV [NOP], al
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkMmioNop8Write)
+        MmioPrologue TEST_INSTRUCTION_COUNT_IO, VMMDEV_TESTING_MMIO_NOP
+.again:
+        mov     [xBX], al
+        mov     [xBX], al
+        mov     [xBX], al
+        mov     [xBX], al
+        mov     [xBX], al
+        dec     ecx
+        jnz     .again
+        MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO
+.s_szTestName:
+        db TMPL_MODE_STR, ', 8-bit write', 0
+ENDPROC TMPL_NM(BenchmarkMmioNop8Write)
+
+
+;;
+; Benchmarks: MOV eax, [NOP_R3]
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkMmioRing3Nop32Read)
+        MmioPrologue TEST_INSTRUCTION_COUNT_IO / 4, VMMDEV_TESTING_MMIO_NOP_R3
+.again:
+        mov     eax, [sBX]
+        mov     eax, [sBX]
+        mov     eax, [sBX]
+        mov     eax, [sBX]
+        mov     eax, [sBX]
+        dec     ecx
+        jnz     .again
+        MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO / 4
+.s_szTestName:
+        db TMPL_MODE_STR, ', 32-bit read-to-ring-3', 0
+ENDPROC TMPL_NM(BenchmarkMmioRing3Nop32Read)
+
+
+;;
+; Benchmarks: MOV [NOP_R3], eax
+;
+; @uses     nothing
+;
+BEGINPROC TMPL_NM(BenchmarkMmioRing3Nop32Write)
+        MmioPrologue TEST_INSTRUCTION_COUNT_IO / 4, VMMDEV_TESTING_MMIO_NOP_R3
+.again:
+        mov     [sBX], eax
+        mov     [sBX], eax
+        mov     [sBX], eax
+        mov     [sBX], eax
+        mov     [sBX], eax
+        dec     ecx
+        jnz     .again
+        MmioEpilogue TEST_INSTRUCTION_COUNT_MMIO / 4
+.s_szTestName:
+        db TMPL_MODE_STR, ', 32-bit write-to-ring-3', 0
+ENDPROC TMPL_NM(BenchmarkMmioRing3Nop32Write)
+
+
+%undef MmioPrologue
+%undef MmioEpilogue
+
+
+;;
+; Do the MMIO tests for this mode.
+;
+; @uses nothing
+;
+BEGINCODELOW
+BITS 16
+BEGINPROC TMPL_NM(BenchmarkMmioNop_rm)
+        call    TMPL_NM(Bs2IsModeSupported_rm)
+        jz      .done
+        call    TMPL_NM(Bs2EnterMode_rm)
+BITS TMPL_BITS
+
+        call    TMPL_NM(BenchmarkMmioNop32Read)
+        call    TMPL_NM(BenchmarkMmioNop32Write)
+%ifndef QUICK_TEST
+        call    TMPL_NM(BenchmarkMmioNop16Read)
+        call    TMPL_NM(BenchmarkMmioNop16Write)
+        call    TMPL_NM(BenchmarkMmioNop8Read)
+        call    TMPL_NM(BenchmarkMmioNop8Write)
+%endif
+        call    TMPL_NM(BenchmarkMmioRing3Nop32Read)
+        call    TMPL_NM(BenchmarkMmioRing3Nop32Write)
+
+        call    TMPL_NM(Bs2ExitMode)
+BITS 16
+.done:
+        ret
+ENDPROC TMPL_NM(BenchmarkMmioNop_rm)
+
+TMPL_BEGINCODE
+BITS TMPL_BITS
+
+
+%include "bootsector2-template-footer.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-test1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-test1.asm
new file mode 100644
index 0000000..e085511
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-test1.asm
@@ -0,0 +1,187 @@
+; $Id: bootsector2-test1.asm $
+;; @file
+; Bootsector that benchmarks I/O and MMIO roundtrip time.
+;   VBoxManage setextradata bs-test1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
+;   VBoxManage setextradata bs-test1 VBoxInternal/Devices/VMMDev/0/Config/TestingMMIO  1
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+;; The number of instructions to test.
+%define TEST_INSTRUCTION_COUNT_IO       2000000
+
+;; The number of RDTSC instructions to test.
+%define TEST_INSTRUCTION_COUNT_RDTSC    4000000
+
+;; The number of RDTSC instructions to test.
+%define TEST_INSTRUCTION_COUNT_READCR4  1000000
+
+;; The number of instructions to test.
+%define TEST_INSTRUCTION_COUNT_MMIO     750000
+
+;; Define this to drop unnecessary test variations.
+%define QUICK_TEST
+
+;
+; Include and execute the init code.
+;
+        %define BS2_INIT_RM
+        %define BS2_INC_PE16
+        %define BS2_INC_PE32
+        %define BS2_INC_PP32
+        %define BS2_INC_PAE32
+        %define BS2_INC_LM64
+        %include "bootsector2-common-init-code.mac"
+
+
+;
+; The benchmark driver
+;
+BEGINPROC main
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+        call    Bs2EnableA20_r86
+        call    Bs2PanicIfVMMDevTestingIsMissing_r86
+
+        ;
+        ; CPUID.
+        ;
+        mov     ax, .s_szTstCpuId
+        call    TestSub_r86
+        call    BenchmarkCpuId_rm_pp32
+        call    BenchmarkCpuId_rm_pae32
+        call    BenchmarkCpuId_rm_lm64
+        call    BenchmarkCpuId_rm_pe16
+        call    BenchmarkCpuId_rm_pe32
+        call    BenchmarkCpuId_rm_rm
+
+        ;
+        ; RDTSC.
+        ;
+        mov     ax, .s_szTstRdTsc
+        call    TestSub_r86
+        call    BenchmarkRdTsc_rm_pp32
+        call    BenchmarkRdTsc_rm_pae32
+        call    BenchmarkRdTsc_rm_lm64
+        call    BenchmarkRdTsc_rm_pe16
+        call    BenchmarkRdTsc_rm_pe32
+        call    BenchmarkRdTsc_rm_rm
+
+        ;
+        ; Read CR4
+        ;
+        mov     ax, .s_szTstRdCr4
+        call    TestSub_r86
+        call    BenchmarkRdCr4_rm_pp32
+        call    BenchmarkRdCr4_rm_pae32
+        call    BenchmarkRdCr4_rm_lm64
+        call    BenchmarkRdCr4_rm_pe16
+        call    BenchmarkRdCr4_rm_pe32
+        call    BenchmarkRdCr4_rm_rm
+
+        ;
+        ; I/O port access.
+        ;
+        mov     ax, .s_szTstNopIoPort
+        call    TestSub_r86
+        call    BenchmarkIoPortNop_rm_rm
+        call    BenchmarkIoPortNop_rm_pe16
+        call    BenchmarkIoPortNop_rm_pe32
+        call    BenchmarkIoPortNop_rm_pp32
+        call    BenchmarkIoPortNop_rm_pae32
+        call    BenchmarkIoPortNop_rm_lm64
+
+        ;
+        ; MMIO access.
+        ;
+        mov     ax, .s_szTstNopMmio
+        call    TestSub_r86
+        call    BenchmarkMmioNop_rm_pp32
+        call    BenchmarkMmioNop_rm_pae32
+        call    BenchmarkMmioNop_rm_lm64
+        call    BenchmarkMmioNop_rm_pe16
+        call    BenchmarkMmioNop_rm_pe32
+        call    BenchmarkMmioNop_rm_rm
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        call    Bs2Panic
+
+.s_szTstName:
+        db      'tstIOIntr', 0
+.s_szTstCpuId:
+        db      'CPUID EAX=1', 0
+.s_szTstRdTsc:
+        db      'RDTSC', 0
+.s_szTstRdCr4:
+        db      'Read CR4', 0
+.s_szTstNopIoPort:
+        db      'NOP I/O Port Access', 0
+.s_szTstNopMmio:
+        db      'NOP MMIO Access', 0
+ENDPROC   main
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+%define TMPL_RM
+%include "bootsector2-test1-template.mac"
+;%define TMPL_CMN_V86
+;%include "bootsector2-test1-template.mac"
+%define TMPL_PE16
+%include "bootsector2-test1-template.mac"
+%define TMPL_PE32
+%include "bootsector2-test1-template.mac"
+;%define TMPL_PP16
+;%include "bootsector2-test1-template.mac"
+%define TMPL_PP32
+%include "bootsector2-test1-template.mac"
+;%define TMPL_PAE16
+;%include "bootsector2-test1-template.mac"
+%define TMPL_PAE32
+%include "bootsector2-test1-template.mac"
+;%define TMPL_LM16
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_LM32
+;%include "bootsector2-test1-template.mac"
+%define TMPL_LM64
+%include "bootsector2-test1-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-triple-fault-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-triple-fault-1.asm
new file mode 100644
index 0000000..56a1d24
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-triple-fault-1.asm
@@ -0,0 +1,380 @@
+; $Id: bootsector2-triple-fault-1.asm $
+;; @file
+; Bootsector for testing triple faults.
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+;; The number of instructions to test.
+%define TEST_INSTRUCTION_COUNT_IO       2000000
+
+;; The number of instructions to test.
+%define TEST_INSTRUCTION_COUNT_MMIO     750000
+
+;; Define this to drop unnecessary test variations.
+%define QUICK_TEST
+
+;
+; Include and execute the init code.
+;
+        %define BS2_INIT_RM
+        %define BS2_INC_PE16
+        %define BS2_INC_PE32
+        %define BS2_INC_PP32
+        %define BS2_INC_PAE32
+        %define BS2_INC_LM64
+        %include "bootsector2-common-init-code.mac"
+
+
+;
+; The test driver
+;
+BEGINPROC main
+        ;
+        ; Test prologue.
+        ;
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+        call    Bs2EnableA20_r86
+
+        ;
+        ; Did we get here from a reboot triggered below?
+        ;
+        push    ds
+        mov     ax, 2000h               ; 128 KB is enough for the test program
+.boot_check_loop:
+        mov     ds, ax
+        cmp     dword [0], 064726962h
+        jne     .boot_check_next
+        cmp     dword [4], 062697264h
+        je      .warm_reset_broken
+
+.boot_check_next:
+        mov     dword [0], 064726962h
+        mov     dword [4], 062697264h
+        add     ax, 1000h
+        cmp     ax, 8000h
+        jbe     .boot_check_loop
+        pop     ds
+        jmp     .fine
+
+.warm_reset_broken:
+        pop     ds
+        mov     ax, .s_szWarmResetBroken
+        call    NAME(TestFailed_r86)
+        jmp     .done
+.s_szWarmResetBroken:
+        db      'Warm reset vector support is broken', 0dh, 0ah, 0
+.fine:
+
+        ;
+        ; Test that the warm reset interface works.
+        ;
+        mov     ax, .s_szPrecondTest5
+        call    NAME(TestSub_r86)
+        mov     al, 05h
+        call    NAME(SetWarmResetJmp)
+        cmp     ax, 0
+        jne     .precond_test_A
+        call    NAME(TestReboot_r86)
+
+.precond_test_A:
+        mov     ax, .s_szPrecondTestA
+        call    NAME(TestSub_r86)
+        mov     al, 0Ah
+        call    NAME(SetWarmResetJmp)
+        cmp     ax, 0
+        jne     .precond_test_A_passed
+        call    NAME(TestReboot_r86)
+.precond_test_A_passed:
+        call    NAME(TestSubDone_r86)
+
+        ;
+        ; The real tests.
+        ;
+
+
+        ;
+        ; We're done.
+        ;
+.done:
+        call    NAME(TestTerm_r86)
+        call    Bs2Panic
+
+.s_szTstName:
+        db      'tstTriple', 0
+.s_szPrecondTest5:
+        db      'Shutdown Action 5', 0
+.s_szPrecondTestA:
+        db      'Shutdown Action A', 0
+ENDPROC   main
+
+
+
+;;
+; Sets up the warm reset vector.
+;
+; @param    ax          Where to resume exeuction.
+; @param    dl          Shutdown action command to use, 5h or Fh.
+;
+; @uses     nothing
+;
+BEGINPROC SetUpWarmReset
+        push    bp
+        mov     bp, sp
+        push    eax
+        push    ebx
+        push    ecx
+        push    edx
+        push    edi
+        push    esi
+        push    es
+
+        ;
+        ; Set up the warm reboot vector.
+        ;
+        mov     bx, 40h
+        mov     es, bx
+
+        mov     ecx, [es:67h]           ; debug
+        mov     word [es:67h], ax
+        mov     bx, cs
+        mov     word [es:67h+2], bx
+
+        mov     bx, [es:72h]            ; debug
+        mov     word [es:72h], 1234h    ; warm reboot
+
+        wbinvd
+
+        mov     al, 0fh
+        out     70h, al                 ; set register index
+        in      al, 71h
+        mov     ah, al                  ; debug
+        mov     al, dl                  ; shutdown action command
+        out     71h, al                 ; set cmos[f] = a - invoke testResume as early as possible.
+        in      al, 71h                 ; debug / paranoia
+        movzx   si, al
+
+        ; Debug print.
+%if 1
+        mov     di, sp                  ; save sp (lazy bird)
+        in      al, 64h
+        push    ax                      ; kbd status
+        push    si                      ; cmos[f] after
+        mov     al, ah                  ; cmos[f] before
+        push    ax
+        push    word [0472h]            ; 40:72 word after
+        push    bx                      ; 40:72 word before
+        push    word [0467h]            ; 40:67 far addr after
+        push    word [0469h]
+        push    cx                      ; 40:67 far addr before
+        shr     ecx, 16
+        push    dx
+        push    ds
+        push    .s_szDebugFmt
+        call    NAME(PrintF_r86)
+        mov     sp, di                  ; restore sp.
+;.forever:
+;        cli
+;        hlt
+;        jmp     .forever
+%endif
+
+        pop     es
+        pop     esi
+        pop     edi
+        pop     edx
+        pop     ecx
+        pop     ebx
+        pop     eax
+        leave
+        ret
+
+.s_szDebugFmt:
+        db      'dbg: 40:67=%RX16:%RX16 (%RX16:%RX16) 40:72=%RX16 (%RX16) cmos[f]=%RX8 (%RX8) kbdsts=%RX8', 0dh, 0ah, 0
+ENDPROC   SetUpWarmReset
+
+
+;;
+; Sets up the warm reset vector.
+;
+; @returns  ax = 0 on setup call, ax = 1 on resume return.
+; @param    al          Shutdown action command to use, 5h or Fh.
+; @uses     ax
+;
+BEGINPROC SetWarmResetJmp
+        push    bp
+        mov     bp, sp
+        push    dx
+
+        mov     dl, al
+        mov     ax, .resume
+        call    NAME(SetUpWarmReset)
+
+%ifdef DEBUG
+        push    cs
+        push    .s_szDbg1
+        call    NAME(PrintF_r86)
+        add     sp, 4
+%endif
+
+        mov     ax, .s_ResumeRegs
+        call    NAME(TestSaveRegisters_r86)
+
+%ifdef DEBUG
+        push    cs
+        push    .s_szDbg2
+        call    NAME(PrintF_r86)
+        add     sp, 4
+%endif
+
+        mov     dx, [bp - 2]
+        mov     [.s_ResumeRegs + BS2REGS.rdx], dx
+        mov     ax, bp
+        add     ax, 4
+        mov     [.s_ResumeRegs + BS2REGS.rsp], ax
+        mov     ax, [bp]
+        mov     [.s_ResumeRegs + BS2REGS.rbp], ax
+        mov     ax, [bp + 2]
+        mov     [.s_ResumeRegs + BS2REGS.rip], ax
+        mov     word [.s_ResumeRegs + BS2REGS.rax], 1
+
+%ifdef DEBUG
+        push    cs
+        push    .s_szDbg3
+        call    NAME(PrintF_r86)
+        add     sp, 4
+%endif
+
+        xor     ax, ax
+.done:
+        pop     dx
+        leave
+        ret
+
+.resume:
+        cli
+        xor     ax, ax
+        mov     ds, ax
+        mov     es, ax
+        mov     ax, [.s_ResumeRegs + BS2REGS.ss]
+        mov     ss, ax
+        mov     esp, [.s_ResumeRegs + BS2REGS.rsp]
+        mov     ebp, [.s_ResumeRegs + BS2REGS.rbp]
+
+%ifdef DEBUG
+        push    ds
+        push    .s_szDbg4
+        call    NAME(PrintF_r86)
+        add     sp, 4
+%endif
+
+        mov     ax, .s_ResumeRegs
+        call    NAME(TestRestoreRegisters_r86)
+        mov     ax, [.s_ResumeRegs + BS2REGS.rip]
+        push    ax
+        mov     ax, 1
+        ret
+        ;jmp     word [.s_ResumeRegs + BS2REGS.rip]
+
+.s_ResumeRegs:
+        times (BS2REGS_size) db 0
+%ifdef DEBUG
+.s_szDbg1:
+        db 'dbg 1', 0dh, 0ah, 0
+.s_szDbg2:
+        db 'dbg 2', 0dh, 0ah, 0
+.s_szDbg3:
+        db 'dbg 3', 0dh, 0ah, 0
+.s_szDbg4:
+        db 'dbg 4', 0dh, 0ah, 0
+%endif
+ENDPROC   SetWarmResetJmp
+
+
+;;
+; Reboot the machine.  Will not return.
+;
+BEGINPROC TestReboot_r86
+%ifdef DEBUG
+        ; Debug
+        push    ds
+        push    .s_szDbg
+        call    NAME(PrintF_r86)
+%endif
+        ; Via port A
+        in      al, 92h
+        and     al, ~1
+        out     92h, al
+        or      al, 1
+        out     92h, al
+        in      al, 92h
+.forever:
+        cli
+        hlt
+        jmp     .forever
+%ifdef DEBUG
+.s_szDbg:
+        db 'Rebooting...', 0dh, 0ah, 0
+%endif
+ENDPROC   TestReboot_r86
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+;%define TMPL_RM
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_CMN_V86
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_PE16
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_PE32
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_PP16
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_PP32
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_PAE16
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_PAE32
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_LM16
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_LM32
+;%include "bootsector2-test1-template.mac"
+;%define TMPL_LM64
+;%include "bootsector2-test1-template.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-64-1.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-64-1.asm
new file mode 100644
index 0000000..c07a55d
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-64-1.asm
@@ -0,0 +1,111 @@
+; $Id: bootsector2-vbinstst-64-1.asm $
+;; @file
+; Bootsector tests instructions in 64-bit mode.
+;   VBoxManage setextradata bs-vbinstst-64-1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "VBox/VMMDevTesting.mac"
+
+;
+; Include and execute the init code.
+;
+        %define BS2_INIT_RM
+        %define BS2_INC_LM64
+        %define BS2_WITH_TRAPS
+        %include "bootsector2-common-init-code.mac"
+
+
+;
+; The benchmark driver
+;
+BEGINPROC main
+        ;
+        ; Test prologue.
+        ;
+        cli
+        mov     ax, .s_szTstName
+        call    TestInit_r86
+        call    Bs2EnableA20_r86
+        call    Bs2PanicIfVMMDevTestingIsMissing_r86
+        lea     eax, [dword the_end]
+        cmp     eax, dword 80000h
+        jae     .size_nok
+
+
+        ;
+        ; Do the testing.
+        ;
+        call    Bs2IsModeSupported_rm_lm64
+        jz      .done
+        call    Bs2EnterMode_rm_lm64
+BITS 64
+
+        call    TestInstrMain_lm64
+
+        call    TestSubDone_p64
+        call    Bs2ExitMode_lm64
+BITS 16
+.done:
+
+        ;
+        ; We're done.
+        ;
+        call    TestTerm_r86
+        call    Bs2Panic
+        jmp     .done
+
+.size_nok:
+        push    eax
+        push    word ds
+        push    .s_szSizeNok
+        call    TestFailedF_r86
+        jmp     .done
+
+.s_szSizeNok:
+        db      'Test is too big (%RX32)', 0
+.s_szTstName:
+        db      'VBInsTst-64-1', 0
+ENDPROC   main
+
+
+;
+; Instantiate the template code.
+;
+%include "bootsector2-template-footer.mac"  ; reset the initial environemnt.
+
+%define TMPL_LM64
+%include "bootsector2-template-header.mac"
+BITS 64
+%include "VBInsTst-64.asm"
+%include "bootsector2-template-footer.mac"
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-big-template.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-big-template.asm
new file mode 100644
index 0000000..63a964b
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-big-template.asm
@@ -0,0 +1,81 @@
+; $Id: bootsector2-vbinstst-big-template.asm $
+;; @file
+; Boot Sector 2 with big instruction test image template.  For use with
+; bootsector2-vbinstst-kernel.asm.  Requires:
+;   VBoxManage setextradata bs-vbinstst-64-1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;
+; Set up the assembler environment.
+;
+%include "bootsector2-first.mac"
+%include "bootsector2-api.mac"
+
+%include "bootsector2-template-footer.mac"
+%ifdef BS2_BIG_IMAGE_LM64
+ %define TMPL_LM64
+ %include "bootsector2-template-header.mac"
+        BITS 64
+
+%elifdef BS2_BIG_IMAGE_PAE32
+ %define TMPL_PAE32
+ %include "bootsector2-template-header.mac"
+        BITS 32
+
+%elifdef BS2_BIG_IMAGE_PP32
+ %define TMPL_PP32
+ %include "bootsector2-template-header.mac"
+        BITS 32
+
+%else
+ %error Do not know which mode to run in.
+        mov bad,instr
+%endif
+
+
+        ORG BS2_BIG_LOAD_ADDR
+
+;
+; The entry point is the first byte in the image.
+;
+bs2_big_image_start:
+entrypoint:
+        mov     xAX, .s_szTestName
+        call    [TMPL_NM_CMN(g_pfnTestInit) xWrtRIP]
+        call    TMPL_NM(TestInstrMain)
+        call    [TMPL_NM_CMN(g_pfnTestTerm) xWrtRIP]
+.hltloop:
+        hlt
+        jmp     .hltloop
+
+.s_szTestName:
+        db BS2_BIG_IMAGE_GEN_TEST_NAME, 0
+
+
+;
+; Instantiate the template code.
+;
+%include "BS2_BIG_IMAGE_GEN_SOURCE_FILE"
+
diff --git a/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-kernel.asm b/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-kernel.asm
new file mode 100644
index 0000000..8855d48
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/bootsector2-vbinstst-kernel.asm
@@ -0,0 +1,517 @@
+; $Id: bootsector2-vbinstst-kernel.asm $
+;; @file
+; bootsector #2 kernel for big instruction testcases.
+;   VBoxManage setextradata bs-vbinstst-64-1 VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled  1
+;
+
+;
+; Copyright (C) 2007-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;
+; This is always the first include file.
+;
+%include "bootsector2-first.mac"
+
+;
+; Include and execute the init code.
+;
+        %define BS2_INIT_RM
+        %define BS2_WITH_TRAPS
+        %define BS2_WITHOUT_RAW_MODE ; causes troubles with PIC/floppy.
+
+        %define BS2_INC_RM
+        %define BS2_INC_PE16
+        %define BS2_INC_PE32
+        %define BS2_INC_PP16
+        %define BS2_INC_PP32
+        %define BS2_INC_PAE16
+        %define BS2_INC_PAE32
+        %define BS2_INC_LM16
+        %define BS2_INC_LM32
+        %define BS2_INC_LM64
+        %include "bootsector2-common-init-code.mac"
+        %include "bootsector2-api.mac"
+        %include "iprt/formats/pe.mac"
+        %include "iprt/formats/mz.mac"
+
+
+BEGINCODE
+BEGINPROC main
+;
+; Set up the runtime environment.
+;
+        call    Bs2EnableA20_r86
+
+        ; 16-bit real mode.
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) mov dword [NAME(g_pfn %+ a_Name %+ _r86)], dword NAME(a_Name %+ _r86)
+        BS2_API_TEMPLATE
+
+        ; 16-bit protected mode.
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) mov word [NAME(g_pfn %+ a_Name %+ _p16)], word NAME(a_Name %+ _p16)
+        BS2_API_TEMPLATE
+        mov     eax, BS2_SEL_CS16
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) mov [NAME(g_pfn %+ a_Name %+ _p16) + 2], ax
+        BS2_API_TEMPLATE
+
+        ; 32-bit
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) mov dword [NAME(g_pfn %+ a_Name %+ _p32)], dword NAME(a_Name %+ _p32)
+        BS2_API_TEMPLATE
+
+        ; 64-bit
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) mov dword [NAME(g_pfn %+ a_Name %+ _p64)], dword NAME(a_Name %+ _p64)
+        BS2_API_TEMPLATE
+        xor eax, eax
+%undef BS2_API_TEMPLATE_ACTION
+%define BS2_API_TEMPLATE_ACTION(a_Name) mov dword [NAME(g_pfn %+ a_Name %+ _p64) + 4], eax
+        BS2_API_TEMPLATE
+
+        ; The magic markers and version number.
+        mov     dword [g_u32Bs2ApiMagic],    BS2_API_MAGIC
+        mov     dword [g_u32Bs2ApiEndMagic], BS2_API_MAGIC
+        mov     dword [g_u32Bs2ApiVersion],  BS2_API_VERSION
+
+;
+; Load the extended image into high memory.
+;
+        mov     dl, [g_bBootDrv]
+        call    NAME(bs2LoadBigImage)
+
+;
+; Hand control over to the extended image.
+;
+%ifdef BS2_BIG_IMAGE_LM64
+        call    Bs2EnterMode_rm_lm64
+BITS 64
+        mov     eax, BS2_BIG_LOAD_ADDR
+        call    rax
+        call    Bs2ExitMode_lm64
+BITS 16
+
+%elifdef BS2_BIG_IMAGE_PP32
+        call    Bs2EnterMode_rm_pp32
+BITS 32
+        mov     eax, BS2_BIG_LOAD_ADDR
+        call    eax
+        call    Bs2ExitMode_pp32
+BITS 16
+
+%elifdef BS2_BIG_IMAGE_PAE32
+        call    Bs2EnterMode_rm_pae32
+BITS 32
+        mov     eax, BS2_BIG_LOAD_ADDR
+        call    eax
+        call    Bs2ExitMode_pae32
+BITS 16
+
+%else
+        ;
+        ; Probe the image, looking for an executable format we can deal with.
+        ; Not doing a lot of checking here, but who cares right now...
+        ;
+        call    Bs2EnterMode_rm_pp32
+BITS 32
+        mov     eax, BS2_BIG_LOAD_ADDR
+        cmp     word [eax], IMAGE_DOS_SIGNATURE
+        jne     .not_dos
+        add     eax, [eax + IMAGE_DOS_HEADER.e_lfanew]
+.not_dos:
+        cmp     dword [eax], IMAGE_NT_SIGNATURE
+        je      .is_pe
+        mov     eax, BS2_BIG_LOAD_ADDR
+        jmp     .start_32
+
+.is_pe:
+        lea     edx, [eax + IMAGE_NT_HEADERS32.FileHeader]
+        cmp     word [edx + IMAGE_FILE_HEADER.Machine], IMAGE_FILE_MACHINE_I386
+        je      .is_pe32
+        cmp     word [edx + IMAGE_FILE_HEADER.Machine], IMAGE_FILE_MACHINE_AMD64
+        je      .is_pe64
+        jmp     .panic_32
+
+.is_pe32:
+        add     edx, IMAGE_FILE_HEADER_size
+        mov     eax, [edx + IMAGE_OPTIONAL_HEADER32.AddressOfEntryPoint]
+        add     eax, BS2_BIG_LOAD_ADDR
+        jmp     .start_32
+
+.is_pe64:
+        add     edx, IMAGE_FILE_HEADER_size
+        mov     eax, [edx + IMAGE_OPTIONAL_HEADER64.AddressOfEntryPoint]
+        add     eax, BS2_BIG_LOAD_ADDR
+        jmp     .start_64
+
+        ; Start executing at eax in 32-bit mode (current).
+.start_32:
+        call    eax
+.panic_32:
+        call    Bs2ExitMode_pp32
+BITS 16
+        jmp     .panic
+
+        ; Start executing at eax in 64-bit mode.
+BITS 32
+.start_64:
+        call    Bs2ExitMode_pp32
+BITS 16
+        call    Bs2EnterMode_rm_lm64
+BITS 64
+        mov     eax, eax
+        call    rax
+        call    Bs2ExitMode_lm64
+BITS 16
+        jmp     .panic
+
+.panic:
+%endif
+        call    Bs2Panic
+ENDPROC main
+
+
+
+
+;;
+; Loads the big image off the floppy.
+;
+; This uses the the_end label to figure out the starting offset.
+; The length is assumed to be the whole floppy.
+;
+; Clobbers nothing, except for 68KB of memory beyond the_end.
+;
+; @param    dl          The boot drive number (from BIOS).
+;
+BITS 16
+BEGINPROC bs2LoadBigImage
+        push    ebp
+        movzx   ebp, sp
+
+%define bSavedDiskNo    byte [bp - 02h]
+        push    dx
+%define bMaxSector      byte [bp - 04h]
+        push    0
+%define bMaxHead        byte [bp - 06h]
+        push    0
+%define bMaxCylinder    byte [bp - 08h]
+        push    0
+%define pbHighDst       dword [bp - 0ch]
+        push    dword BS2_BIG_LOAD_ADDR
+%define SegTemp         word [bp - 0eh]
+        push    0
+%define fStatus         byte [bp - 10h]
+        push    0
+
+        push    es
+        push    ds
+        push    eax
+        push    edx
+        push    ecx
+        push    ebx
+        push    edi
+        push    esi
+        push    ebp
+
+        ; Display message.
+        push    cs
+        push    .s_szLoadingBigImage
+        call    PrintF_r86
+        add     sp, 4
+
+
+        ;
+        ; Try figure the geometry.  This defines how much we'll read.
+        ;
+        mov     ah, 08h
+        xor     di, di                  ; (es:di = 0000:0000 works around some buggy bioses, says wikipedia.)
+        mov     es, di
+        int     13h
+        jc      .param_error
+        mov     bMaxSector, cl          ; Do the cl[7:6]+ch stuff so we can address 255 sectors on the fake 63MB floppy.
+        mov     bMaxHead, dh
+        mov     bMaxCylinder, ch        ; See above.
+        mov     dl, bSavedDiskNo
+%if 0
+        movzx   ax, bMaxCylinder
+        push    ax
+        movzx   cx, bMaxHead
+        push    cx
+        movzx   ax, bMaxSector
+        push    ax
+        push    ds
+        push    .s_szDbgParam
+        call    PrintF_r86
+        jmp     .dprintf_param_done
+.s_szDbgParam:
+        db 13, 10, 'Floppy params max: sectors=%RX16 heads=%RX16 cylinders=%RX16', 13, 10, 0
+.dprintf_param_done:
+%endif
+
+        ;
+        ; Skip the kernel image (this could be done more efficiently, but this
+        ; also does the trick).
+        ;
+        lea     eax, [dword the_end]
+        sub     eax, start
+        shr     eax, 9                  ; sectors to skip
+        mov     cx, 0001h               ; sector (1-based), cylinder (0-based).
+        xor     dh, dh                  ; head (0-based).
+.skip_one_more:
+        inc     cl
+        cmp     cl, bMaxSector
+        jbe     .decrement_sector_count
+
+        mov     cl, 1
+        inc     dh
+        cmp     dh, bMaxHead            ; ASSUMES bMaxHead < 255.
+        jbe     .decrement_sector_count
+
+        mov     dh, 0
+        inc     ch
+
+.decrement_sector_count:
+        dec     ax
+        jnz     .skip_one_more
+
+
+
+        ;
+        ; Load loop. We load and copy 64 KB at the time into the high location.
+        ; Fixed registers (above): dl=drive, cl[7:6]:ch=cylinder, dh=head, cl[5:0]=sector.
+        ;
+        lea     eax, [dword the_end + 0ffffh]
+        and     eax, 0ffff0000h
+        shr     eax, 4
+        mov     SegTemp, ax             ; the 64KB segment we use for temporary storage.
+
+.the_load_loop:
+        mov     al, '.'
+        call    PrintChr_r86
+
+        ; Fill the segment with int3s (in case we don't read a full 64KB).
+        mov     eax, 0cccccccch
+        mov     di, SegTemp
+        mov     es, di
+        xor     edi, edi
+        push    ecx
+        cld
+        mov     cx, 4000h
+        rep stosd
+        pop     ecx
+
+        ;
+        ; Load a bunch of sectors into the temp segment.
+        ;
+        xor     ebx, ebx
+.the_sector_load_loop:
+        ; Figure how many sectors we can read without switching track or side.
+        movzx   ax, bMaxSector
+        sub     al, cl
+        inc     al                      ; al = sectors left to read in the current track on the current side.
+        mov     di, bx
+        shr     di, 9                   ; bx/512 = current sector offset.
+        neg     di
+        add     di, 10000h / 512        ; di = sectors left to read in the 64KB buffer.
+        cmp     ax, di                  ; ax = min(ax, di)
+        jbe     .use_ax_sector_count1
+        mov     ax, di
+.use_ax_sector_count1:
+        cmp     ax, 64                  ; ax = min(ax,64) - Our BIOS limitation is 72, play safe.
+        jbe     .use_ax_sector_count2
+        mov     ax, 64
+.use_ax_sector_count2:
+        mov     di, ax                  ; save the number of sectors we read
+
+        ; Do the reading.
+%if 0
+        push    bx
+        push    ax
+        push    dx
+        push    cx
+        push    cs
+        push    .s_szDbgRead
+        call    PrintF_r86
+        jmp     .after_read_dprintf
+.s_szDbgRead: db 'Reading CX=%RX16 DX=%RX16 AX=%RX16 BX=%RX16', 13, 10, 0
+.after_read_dprintf:
+%endif
+        push    bx
+        mov     ah, 02h                 ; ah=read function
+        int     13h
+        pop     bx
+        jc      .read_error
+
+        ; advance to the next sector/head/cylinder and address (lazy impl).
+.advance_another_sector:
+        cmp     cl, bMaxSector
+        je      .next_head
+        inc     cl
+        jmp     .adv_addr
+
+.next_head:
+        mov     cl, 1
+        cmp     dh, bMaxHead
+        je      .next_cylinder
+        inc     dh
+        jmp     .adv_addr
+
+.next_cylinder:
+        mov     dh, 0
+        cmp     ch, bMaxCylinder        ; No the cl[7:6]+ch stuff so we can address 255 sectors on the fake 63MB floppy.
+        jb      .update_ch
+        mov     fStatus, 1
+        jmp     .move_block
+.update_ch:
+        inc     ch
+
+.adv_addr:
+        add     bx, 512
+        dec     di
+        jnz     .advance_another_sector
+
+        test    bx, bx
+        jnz     .the_sector_load_loop
+
+.move_block:
+        ;
+        ; Copy the memory into high mem.
+        ;
+%if 0
+        mov     edi, pbHighDst
+        push    edi
+        push    cs
+        push    .s_szDbgMove
+        call    PrintF_r86
+        jmp     .after_move_dprintf
+.s_szDbgMove: db 'Moving memory to EDI=%RX32', 13, 10, 0
+.after_move_dprintf:
+%endif
+
+        push    ecx
+        push    edx
+        push    ds
+        push    es
+        call    Bs2EnterMode_rm_pp32
+BITS 32
+        ; Copy
+        mov     edi, pbHighDst
+        movzx   esi, SegTemp
+        shl     esi, 4
+        mov     ecx, 10000h / 4
+        cld
+        rep movsd
+
+        ; Verify
+        mov     edi, pbHighDst
+        movzx   esi, SegTemp
+        shl     esi, 4
+        mov     ecx, 10000h / 4
+        cld
+        repe cmpsd
+        je      .mem_verified_ok
+        mov     fStatus, 2
+
+.mem_verified_ok:
+        mov     pbHighDst, edi
+
+        call    Bs2ExitMode_pp32
+BITS 16
+        pop     es
+        pop     ds
+        pop     edx
+        pop     ecx
+
+        ; Continue reading and copying?
+        cmp     fStatus, 0
+        je      .the_load_loop
+
+        ; Do we quit the loop on a failure?
+        cmp     fStatus, 2
+        je      .verify_failed_msg
+
+        ;
+        ; Done, so end the current message line.
+        ;
+        mov     al, 13
+        call    PrintChr_r86
+        mov     al, 10
+        call    PrintChr_r86
+
+
+        pop     esi
+        pop     edi
+        pop     ebx
+        pop     ecx
+        pop     edx
+        pop     eax
+        pop     ds
+        pop     es
+        mov     sp, bp
+        pop     ebp
+        ret
+
+
+        ;
+        ; Something went wrong, display a message.
+        ;
+.verify_failed_msg:
+        mov     edi, pbHighDst
+        push    edi
+        push    cs
+        push    .s_szVerifyFailed
+        jmp     .print_message_and_panic
+
+.param_error:
+        push    ax
+        push    cs
+        push    .s_szParamError
+        jmp     .print_message_and_panic
+
+.read_error:
+        push    ax
+        push    cs
+        push    .s_szReadError
+        jmp     .print_message_and_panic
+
+.print_message_and_panic:
+        call    PrintF_r86
+        call    Bs2Panic
+        jmp     .print_message_and_panic
+
+.s_szReadError:
+        db 13, 10, 'Error reading: %RX8', 13, 10, 0
+.s_szParamError:
+        db 13, 10, 'Error getting params: %RX8', 13, 10, 0
+.s_szVerifyFailed:
+        db 13, 10, 'Failed to move block high... (%RX32) Got enough memory configured?', 13, 10, 0
+.s_szLoadingBigImage:
+        db 'Loading 2nd image.', 0
+ENDPROC bs2LoadBigImage
+
+
+;
+; End sections and image.
+;
+%include "bootsector2-common-end.mac"
+
diff --git a/src/VBox/ValidationKit/bootsectors/todo.txt b/src/VBox/ValidationKit/bootsectors/todo.txt
new file mode 100644
index 0000000..0d8d407
--- /dev/null
+++ b/src/VBox/ValidationKit/bootsectors/todo.txt
@@ -0,0 +1,10 @@
+$Id: todo.txt $
+
+Tripple fault variations:
+ - VT-x + NP: #PF w/ bad 32-bit IDT (set u1DescType=1). Injection causes #GP(73) loop. (r63775 cpu-pf-1)
+ - HWACCM (?): Enable PAE with bad PDPE for the next instr/jmp. Loops in at least one setup.
+
+Special General Protection Faults:
+ - Bad IDT entry. For instance X86DESCGATE::u1DescType = 1 (!system) of the #PF
+   entry and trigger a page fault.  VT-x then tries to raise #GP(0x73).
+
diff --git a/src/VBox/ValidationKit/common/Makefile.kmk b/src/VBox/ValidationKit/common/Makefile.kmk
new file mode 100644
index 0000000..623860b
--- /dev/null
+++ b/src/VBox/ValidationKit/common/Makefile.kmk
@@ -0,0 +1,65 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Common Python Code.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# Install targets for the two zip files.
+#
+
+INSTALLS += testboxscript-common
+testboxscript-common_TEMPLATE = VBoxValidationKitR3
+testboxscript-common_INST = $(INST_TESTBOXSCRIPT)common/
+testboxscript-common_SOURCES = \
+	__init__.py \
+	utils.py \
+	webutils.py \
+	constants/__init__.py=>constants/__init__.py \
+	constants/tbreq.py=>constants/tbreq.py \
+	constants/tbresp.py=>constants/tbresp.py \
+	constants/result.py=>constants/result.py \
+	constants/rtexitcode.py=>constants/rtexitcode.py \
+	constants/valueunit.py=>constants/valueunit.py
+
+INSTALLS += validationkit-common
+validationkit-common_TEMPLATE = VBoxValidationKitR3
+validationkit-common_INST     = $(INST_VALIDATIONKIT)common/
+validationkit-common_SOURCES  = $(testboxscript-common_SOURCES)
+
+
+#
+# Generate pylint and pychecker targets.
+#
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += \
+	$(wildcard \
+		$(PATH_SUB_CURRENT)/*.py \
+		$(PATH_SUB_CURRENT)/*/*.py \
+		)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/common/__init__.py b/src/VBox/ValidationKit/common/__init__.py
new file mode 100644
index 0000000..bb84ee6
--- /dev/null
+++ b/src/VBox/ValidationKit/common/__init__.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# $Id: __init__.py $
+
+"""
+Common code between testmanager, testbox and testdriver.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+from common import constants;
+from common import utils;
+from common import webutils;
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ValidationKit/common/constants/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ValidationKit/common/constants/Makefile.kup
diff --git a/src/VBox/ValidationKit/common/constants/__init__.py b/src/VBox/ValidationKit/common/constants/__init__.py
new file mode 100644
index 0000000..d67c662
--- /dev/null
+++ b/src/VBox/ValidationKit/common/constants/__init__.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+# $Id: __init__.py $
+
+"""
+Constants.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+from common.constants import tbreq;
+from common.constants import tbresp;
+from common.constants import result;
+from common.constants import rtexitcode;
+from common.constants import valueunit;
+
diff --git a/src/VBox/ValidationKit/common/constants/result.py b/src/VBox/ValidationKit/common/constants/result.py
new file mode 100644
index 0000000..bfea06b
--- /dev/null
+++ b/src/VBox/ValidationKit/common/constants/result.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+# $Id: result.py $
+
+"""
+Test statuses.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+PASSED      = 'PASSED';
+SKIPPED     = 'SKIPPED';
+ABORTED     = 'ABORTED';
+BAD_TESTBOX = 'BAD_TESTBOX';
+FAILED      = 'FAILED';
+TIMED_OUT   = 'TIMED_OUT';
+REBOOTED    = 'REBOOTED';
+
+## List of valid result valies.
+g_kasValidResults = [ PASSED, SKIPPED, ABORTED, BAD_TESTBOX, FAILED, TIMED_OUT, REBOOTED, ];
diff --git a/src/VBox/ValidationKit/common/constants/rtexitcode.py b/src/VBox/ValidationKit/common/constants/rtexitcode.py
new file mode 100644
index 0000000..cef21a4
--- /dev/null
+++ b/src/VBox/ValidationKit/common/constants/rtexitcode.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+# $Id: rtexitcode.py $
+
+"""
+RTEXITCODE from iprt/types.h.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+## Success.
+RTEXITCODE_SUCCESS = 0;
+SUCCESS = RTEXITCODE_SUCCESS;
+## General failure.
+RTEXITCODE_FAILURE = 1;
+FAILURE = RTEXITCODE_FAILURE;
+## Invalid arguments.
+RTEXITCODE_SYNTAX = 2;
+SYNTAX  = RTEXITCODE_SYNTAX;
+##  Initialization failure.
+RTEXITCODE_INIT = 3;
+INIT    = RTEXITCODE_INIT;
+## Test skipped.
+RTEXITCODE_SKIPPED = 4;
+SKIPPED = RTEXITCODE_SKIPPED;
+
diff --git a/src/VBox/ValidationKit/common/constants/tbreq.py b/src/VBox/ValidationKit/common/constants/tbreq.py
new file mode 100644
index 0000000..8754bc3
--- /dev/null
+++ b/src/VBox/ValidationKit/common/constants/tbreq.py
@@ -0,0 +1,120 @@
+# -*- coding: utf-8 -*-
+# $Id: tbreq.py $
+
+"""
+Test Manager Requests from the TestBox Script.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+## @name Test Manager actions
+# @{
+## TestBox sign-on.
+SIGNON                  = 'SIGNON'
+## TestBox request for a command while busy (EXEC).
+REQUEST_COMMAND_BUSY    = 'REQUEST_COMMAND_BUSY'
+## TestBox request for a command while idling.
+REQUEST_COMMAND_IDLE    = 'REQUEST_COMMAND_IDLE'
+## TestBox ACKs a command.
+COMMAND_ACK             = 'COMMAND_ACK'
+## TestBox NACKs a command.
+COMMAND_NACK            = 'COMMAND_NACK'
+## TestBox NACKs an unsupported command.
+COMMAND_NOTSUP          = 'COMMAND_NOTSUP'
+## TestBox adds to the main log.
+LOG_MAIN                = 'LOG_MAIN'
+## TestBox uploads a file to the current test result.
+UPLOAD                  = 'UPLOAD'
+## TestBox reports completion of an EXEC command.
+EXEC_COMPLETED          = 'EXEC_COMPLETED'
+## Push more "XML" results to the server.
+XML_RESULTS             = 'XML_RESULTS';
+## @}
+
+
+## @name Parameters for all actions.
+# @{
+ALL_PARAM_ACTION            = 'ACTION'
+ALL_PARAM_TESTBOX_ID        = 'TESTBOX_ID'      ##< Not supplied by SIGNON.
+ALL_PARAM_TESTBOX_UUID      = 'TESTBOX_UUID'
+## @}
+
+## @name SIGNON parameters.
+# @{
+SIGNON_PARAM_OS                 = 'OS';
+SIGNON_PARAM_OS_VERSION         = 'OS_VERSION';
+SIGNON_PARAM_CPU_VENDOR         = 'CPU_VENDOR';
+SIGNON_PARAM_CPU_ARCH           = 'CPU_ARCH';
+SIGNON_PARAM_CPU_NAME           = 'CPU_NAME';
+SIGNON_PARAM_CPU_REVISION       = 'CPU_REVISION';
+SIGNON_PARAM_CPU_COUNT          = 'CPU_COUNT';
+SIGNON_PARAM_HAS_HW_VIRT        = 'HAS_HW_VIRT';
+SIGNON_PARAM_HAS_NESTED_PAGING  = 'HAS_NESTED_PAGING';
+SIGNON_PARAM_HAS_64_BIT_GUEST   = 'HAS_64_BIT_GUST';
+SIGNON_PARAM_HAS_IOMMU          = 'HAS_IOMMU';
+SIGNON_PARAM_MEM_SIZE           = 'MEM_SIZE';
+SIGNON_PARAM_SCRATCH_SIZE       = 'SCRATCH_SIZE';
+SIGNON_PARAM_REPORT             = 'REPORT';
+SIGNON_PARAM_SCRIPT_REV         = 'SCRIPT_REV';
+SIGNON_PARAM_PYTHON_VERSION     = 'PYTHON_VERSION';
+## @}
+
+## @name Parameters for actions reporting results.
+# @{
+RESULT_PARAM_TEST_SET_ID    = 'TEST_SET_ID'
+## @}
+
+## @name EXEC_COMPLETED parameters.
+# @{
+EXEC_COMPLETED_PARAM_RESULT = 'EXEC_RESULT'
+## @}
+
+## @name COMMAND_ACK, COMMAND_NACK and COMMAND_NOTSUP parameters.
+# @{
+## The name of the command that's being
+COMMAND_ACK_PARAM_CMD_NAME = 'CMD_NAME'
+## @}
+
+## @name LOG_MAIN parameters.
+## The log body.
+LOG_PARAM_BODY             = 'LOG_BODY'
+## @}
+
+## @name UPLOAD_FILE parameters.
+## The file name.
+UPLOAD_PARAM_NAME          = 'UPLOAD_NAME';
+## The MIME type of the file.
+UPLOAD_PARAM_MIME          = 'UPLOAD_MIME';
+## The kind of file.
+UPLOAD_PARAM_KIND          = 'UPLOAD_KIND';
+## The file description.
+UPLOAD_PARAM_DESC          = 'UPLOAD_DESC';
+## @}
+
+## @name XML_RESULT parameters.
+## The "XML" body.
+XML_RESULT_PARAM_BODY      = 'XML_BODY'
+## @}
+
diff --git a/src/VBox/ValidationKit/common/constants/tbresp.py b/src/VBox/ValidationKit/common/constants/tbresp.py
new file mode 100644
index 0000000..c4ec18a
--- /dev/null
+++ b/src/VBox/ValidationKit/common/constants/tbresp.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+# $Id: tbresp.py $
+
+"""
+Test Manager Responses to the TestBox Script.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+## All test manager actions responses to the testbox include a RESULT field.
+ALL_PARAM_RESULT = 'RESULT'
+
+## @name Statuses (returned in ALL_PARAM_RESULT).
+## Acknowledgement.
+STATUS_ACK  = 'ACK'
+## Negative acknowledgement.
+STATUS_NACK = 'NACK'
+## The testbox is dead, i.e. it no longer exists with the test manager.
+# @note Not used by the SIGNON action, but all the rest uses it.
+STATUS_DEAD = 'DEAD'
+## @}
+
+## @name Command names (returned in ALL_PARAM_RESULT).
+# @{
+CMD_IDLE               = 'IDLE'
+CMD_WAIT               = 'WAIT'
+CMD_EXEC               = 'EXEC'
+CMD_ABORT              = 'ABORT'
+CMD_REBOOT             = 'REBOOT'
+CMD_UPGRADE            = 'UPGRADE'
+CMD_UPGRADE_AND_REBOOT = 'UPGRADE_AND_REBOOT'
+CMD_SPECIAL            = 'SPECIAL'
+## @ }
+
+## @name SIGNON parameter names.
+# @{
+## The TestBox ID.
+SIGNON_PARAM_ID     = 'TESTBOX_ID'
+## The TestBox name.
+SIGNON_PARAM_NAME   = 'TESTBOX_NAME'
+## @}
+
+
+## @name EXEC parameter names
+# @{
+## The test set id, used for reporting results.
+EXEC_PARAM_RESULT_ID        = 'TEST_SET_ID'
+## The file to download/copy and unpack into TESTBOX_SCRIPT.
+EXEC_PARAM_SCRIPT_ZIPS      = 'SCRIPT_ZIPS'
+## The testcase invocation command line (bourne shell style).
+EXEC_PARAM_SCRIPT_CMD_LINE  = 'SCRIPT_CMD_LINE'
+## The testcase timeout in seconds.
+EXEC_PARAM_TIMEOUT          = 'TIMEOUT'
+## @}
+
+## @name UPGRADE and @name UPGRADE_AND_REBOOT parameter names.
+# @{
+## A URL for downloading new version of Test Box Script archive
+UPGRADE_PARAM_URL       = 'DOWNLOAD_URL'
+## @}
+
diff --git a/src/VBox/ValidationKit/common/constants/valueunit.py b/src/VBox/ValidationKit/common/constants/valueunit.py
new file mode 100644
index 0000000..c5f1efc
--- /dev/null
+++ b/src/VBox/ValidationKit/common/constants/valueunit.py
@@ -0,0 +1,128 @@
+# -*- coding: utf-8 -*-
+# $Id: valueunit.py $
+
+"""
+Test Value Unit Definititions.
+
+This must correspond 1:1 with include/iprt/test.h and
+include/VBox/VMMDevTesting.h.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+
+## @name Unit constants.
+## Used everywhere.
+## @note Using upper case here so we can copy, past and chop from the other
+#        headers.
+## @{
+PCT                     = 0x01;
+BYTES                   = 0x02;
+BYTES_PER_SEC           = 0x03;
+KILOBYTES               = 0x04;
+KILOBYTES_PER_SEC       = 0x05;
+MEGABYTES               = 0x06;
+MEGABYTES_PER_SEC       = 0x07;
+PACKETS                 = 0x08;
+PACKETS_PER_SEC         = 0x09;
+FRAMES                  = 0x0a;
+FRAMES_PER_SEC          = 0x0b;
+OCCURRENCES             = 0x0c;
+OCCURRENCES_PER_SEC     = 0x0d;
+CALLS                   = 0x0e;
+CALLS_PER_SEC           = 0x0f;
+ROUND_TRIP              = 0x10;
+SECS                    = 0x11;
+MS                      = 0x12;
+NS                      = 0x13;
+NS_PER_CALL             = 0x14;
+NS_PER_FRAME            = 0x15;
+NS_PER_OCCURRENCE       = 0x16;
+NS_PER_PACKET           = 0x17;
+NS_PER_ROUND_TRIP       = 0x18;
+INSTRS                  = 0x19;
+INSTRS_PER_SEC          = 0x1a;
+NONE                    = 0x1b;
+PP1K                    = 0x1c;
+PP10K                   = 0x1d;
+PPM                     = 0x1e;
+PPB                     = 0x1f;
+END                     = 0x20;
+## @}
+
+
+## Translate constant to string.
+g_asNames = \
+[
+    'invalid',          # 0
+    '%',
+    'bytes',
+    'bytes/s',
+    'KiB',
+    'KiB/s',
+    'MiB',
+    'MiB/s',
+    'packets',
+    'packets/s',
+    'frames',
+    'frames/s',
+    'occurrences',
+    'occurrences/s',
+    'calls',
+    'calls/s',
+    'roundtrips',
+    's',
+    'ms',
+    'ns',
+    'ns/call',
+    'ns/frame',
+    'ns/occurrences',
+    'ns/packet',
+    'ns/roundtrips',
+    'ins',
+    'ins/s',
+    '',                 # none
+    'pp1k',
+    'pp10k',
+    'ppm',
+    'ppb',
+];
+assert g_asNames[PP1K] == 'pp1k';
+
+
+## Translation table for XML -> number.
+g_kdNameToConst = \
+{
+    'KB':               KILOBYTES,
+    'KB/s':             KILOBYTES_PER_SEC,
+    'MB':               MEGABYTES,
+    'MB/s':             MEGABYTES_PER_SEC,
+    'occurrences':      OCCURRENCES,
+    'occurrences/s':    OCCURRENCES_PER_SEC,
+
+};
+for i in range(1, len(g_asNames)):
+    g_kdNameToConst[g_asNames[i]] = i;
+
diff --git a/src/VBox/ValidationKit/common/utils.py b/src/VBox/ValidationKit/common/utils.py
new file mode 100644
index 0000000..396bd7a
--- /dev/null
+++ b/src/VBox/ValidationKit/common/utils.py
@@ -0,0 +1,1475 @@
+# -*- coding: utf-8 -*-
+# $Id: utils.py $
+# pylint: disable=C0302
+
+"""
+Common Utility Functions.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96862 $"
+
+
+# Standard Python imports.
+import datetime;
+import os;
+import platform;
+import re;
+import stat;
+import subprocess;
+import sys;
+import tarfile;
+import time;
+import traceback;
+import unittest;
+import zipfile
+
+if sys.platform == 'win32':
+    import win32api;            # pylint: disable=F0401
+    import win32con;            # pylint: disable=F0401
+    import win32console;        # pylint: disable=F0401
+    import win32process;        # pylint: disable=F0401
+else:
+    import signal;
+
+# Python 3 hacks:
+if sys.version_info[0] >= 3:
+    long = int;     # pylint: disable=W0622,C0103
+
+
+#
+# Host OS and CPU.
+#
+
+def getHostOs():
+    """
+    Gets the host OS name (short).
+
+    See the KBUILD_OSES variable in kBuild/header.kmk for possible return values.
+    """
+    sPlatform = platform.system();
+    if sPlatform in ('Linux', 'Darwin', 'Solaris', 'FreeBSD', 'NetBSD', 'OpenBSD'):
+        sPlatform = sPlatform.lower();
+    elif sPlatform == 'Windows':
+        sPlatform = 'win';
+    elif sPlatform == 'SunOS':
+        sPlatform = 'solaris';
+    else:
+        raise Exception('Unsupported platform "%s"' % (sPlatform,));
+    return sPlatform;
+
+g_sHostArch = None;
+
+def getHostArch():
+    """
+    Gets the host CPU architecture.
+
+    See the KBUILD_ARCHES variable in kBuild/header.kmk for possible return values.
+    """
+    global g_sHostArch;
+    if g_sHostArch is None:
+        sArch = platform.machine();
+        if sArch in ('i386', 'i486', 'i586', 'i686', 'i786', 'i886', 'x86'):
+            sArch = 'x86';
+        elif sArch in ('AMD64', 'amd64', 'x86_64'):
+            sArch = 'amd64';
+        elif sArch == 'i86pc': # SunOS
+            if platform.architecture()[0] == '64bit':
+                sArch = 'amd64';
+            else:
+                try:
+                    sArch = processOutputChecked(['/usr/bin/isainfo', '-n',]);
+                except:
+                    pass;
+                sArch = sArch.strip();
+                if sArch != 'amd64':
+                    sArch = 'x86';
+        else:
+            raise Exception('Unsupported architecture/machine "%s"' % (sArch,));
+        g_sHostArch = sArch;
+    return g_sHostArch;
+
+
+def getHostOsDotArch():
+    """
+    Gets the 'os.arch' for the host.
+    """
+    return '%s.%s' % (getHostOs(), getHostArch());
+
+
+def isValidOs(sOs):
+    """
+    Validates the OS name.
+    """
+    if sOs in ('darwin', 'dos', 'dragonfly', 'freebsd', 'haiku', 'l4', 'linux', 'netbsd', 'nt', 'openbsd', \
+               'os2', 'solaris', 'win', 'os-agnostic'):
+        return True;
+    return False;
+
+
+def isValidArch(sArch):
+    """
+    Validates the CPU architecture name.
+    """
+    if sArch in ('x86', 'amd64', 'sparc32', 'sparc64', 's390', 's390x', 'ppc32', 'ppc64', \
+               'mips32', 'mips64', 'ia64', 'hppa32', 'hppa64', 'arm', 'alpha'):
+        return True;
+    return False;
+
+def isValidOsDotArch(sOsDotArch):
+    """
+    Validates the 'os.arch' string.
+    """
+
+    asParts = sOsDotArch.split('.');
+    if asParts.length() != 2:
+        return False;
+    return isValidOs(asParts[0]) \
+       and isValidArch(asParts[1]);
+
+def getHostOsVersion():
+    """
+    Returns the host OS version.  This is platform.release with additional
+    distro indicator on linux.
+    """
+    sVersion = platform.release();
+    sOs = getHostOs();
+    if sOs == 'linux':
+        sDist = '';
+        try:
+            # try /etc/lsb-release first to distinguish between Debian and Ubuntu
+            oFile = open('/etc/lsb-release');
+            for sLine in oFile:
+                oMatch = re.search(r'(?:DISTRIB_DESCRIPTION\s*=)\s*"*(.*)"', sLine);
+                if oMatch is not None:
+                    sDist = oMatch.group(1).strip();
+        except:
+            pass;
+        if sDist:
+            sVersion += ' / ' + sDist;
+        else:
+            asFiles = \
+            [
+                [ '/etc/debian_version', 'Debian v'],
+                [ '/etc/gentoo-release', '' ],
+                [ '/etc/oracle-release', '' ],
+                [ '/etc/redhat-release', '' ],
+                [ '/etc/SuSE-release', '' ],
+            ];
+            for sFile, sPrefix in asFiles:
+                if os.path.isfile(sFile):
+                    try:
+                        oFile = open(sFile);
+                        sLine = oFile.readline();
+                        oFile.close();
+                    except:
+                        continue;
+                    sLine = sLine.strip()
+                    if len(sLine) > 0:
+                        sVersion += ' / ' + sPrefix + sLine;
+                    break;
+
+    elif sOs == 'solaris':
+        sVersion = platform.version();
+        if os.path.isfile('/etc/release'):
+            try:
+                oFile = open('/etc/release');
+                sLast = oFile.readlines()[-1];
+                oFile.close();
+                sLast = sLast.strip();
+                if len(sLast) > 0:
+                    sVersion += ' (' + sLast + ')';
+            except:
+                pass;
+
+    elif sOs == 'darwin':
+        sOsxVersion = platform.mac_ver()[0];
+        codenames = {"4": "Tiger",
+                     "5": "Leopard",
+                     "6": "Snow Leopard",
+                     "7": "Lion",
+                     "8": "Mountain Lion",
+                     "9": "Mavericks",
+                     "10": "Yosemite"}
+        sVersion += ' / OS X ' + sOsxVersion + ' (' + codenames[sOsxVersion.split('.')[1]] + ')'
+
+    return sVersion;
+
+#
+# File system.
+#
+
+def openNoInherit(sFile, sMode = 'r'):
+    """
+    Wrapper around open() that tries it's best to make sure the file isn't
+    inherited by child processes.
+
+    This is a best effort thing at the moment as it doesn't synchronizes with
+    child process spawning in any way.  Thus it can be subject to races in
+    multithreaded programs.
+    """
+
+    try:
+        from fcntl import FD_CLOEXEC, F_GETFD, F_SETFD, fcntl; # pylint: disable=F0401
+    except:
+        return open(sFile, sMode);
+
+    oFile = open(sFile, sMode)
+    #try:
+    fcntl(oFile, F_SETFD, fcntl(oFile, F_GETFD) | FD_CLOEXEC);
+    #except:
+    #    pass;
+    return oFile;
+
+def noxcptReadLink(sPath, sXcptRet):
+    """
+    No exceptions os.readlink wrapper.
+    """
+    try:
+        sRet = os.readlink(sPath); # pylint: disable=E1101
+    except:
+        sRet = sXcptRet;
+    return sRet;
+
+def readFile(sFile, sMode = 'rb'):
+    """
+    Reads the entire file.
+    """
+    oFile = open(sFile, sMode);
+    sRet = oFile.read();
+    oFile.close();
+    return sRet;
+
+def noxcptReadFile(sFile, sXcptRet, sMode = 'rb'):
+    """
+    No exceptions common.readFile wrapper.
+    """
+    try:
+        sRet = readFile(sFile, sMode);
+    except:
+        sRet = sXcptRet;
+    return sRet;
+
+def noxcptRmDir(sDir, oXcptRet = False):
+    """
+    No exceptions os.rmdir wrapper.
+    """
+    oRet = True;
+    try:
+        os.rmdir(sDir);
+    except:
+        oRet = oXcptRet;
+    return oRet;
+
+def noxcptDeleteFile(sFile, oXcptRet = False):
+    """
+    No exceptions os.remove wrapper.
+    """
+    oRet = True;
+    try:
+        os.remove(sFile);
+    except:
+        oRet = oXcptRet;
+    return oRet;
+
+
+#
+# SubProcess.
+#
+
+def _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs):
+    """
+    If the "executable" is a python script, insert the python interpreter at
+    the head of the argument list so that it will work on systems which doesn't
+    support hash-bang scripts.
+    """
+
+    asArgs = dKeywordArgs.get('args');
+    if asArgs is None:
+        asArgs = aPositionalArgs[0];
+
+    if asArgs[0].endswith('.py'):
+        if sys.executable is not None  and  len(sys.executable) > 0:
+            asArgs.insert(0, sys.executable);
+        else:
+            asArgs.insert(0, 'python');
+
+        # paranoia...
+        if dKeywordArgs.get('args') is not None:
+            dKeywordArgs['args'] = asArgs;
+        else:
+            aPositionalArgs = (asArgs,) + aPositionalArgs[1:];
+    return None;
+
+def processCall(*aPositionalArgs, **dKeywordArgs):
+    """
+    Wrapper around subprocess.call to deal with its absense in older
+    python versions.
+    Returns process exit code (see subprocess.poll).
+    """
+    assert dKeywordArgs.get('stdout') == None;
+    assert dKeywordArgs.get('stderr') == None;
+    _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs);
+    oProcess = subprocess.Popen(*aPositionalArgs, **dKeywordArgs);
+    return oProcess.wait();
+
+def processOutputChecked(*aPositionalArgs, **dKeywordArgs):
+    """
+    Wrapper around subprocess.check_output to deal with its absense in older
+    python versions.
+    """
+    _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs);
+    oProcess = subprocess.Popen(stdout=subprocess.PIPE, *aPositionalArgs, **dKeywordArgs);
+
+    sOutput, _ = oProcess.communicate();
+    iExitCode  = oProcess.poll();
+
+    if iExitCode is not 0:
+        asArgs = dKeywordArgs.get('args');
+        if asArgs is None:
+            asArgs = aPositionalArgs[0];
+        print(sOutput);
+        raise subprocess.CalledProcessError(iExitCode, asArgs);
+
+    return str(sOutput); # str() make pylint happy.
+
+g_fOldSudo = None;
+def _sudoFixArguments(aPositionalArgs, dKeywordArgs, fInitialEnv = True):
+    """
+    Adds 'sudo' (or similar) to the args parameter, whereever it is.
+    """
+
+    # Are we root?
+    fIsRoot = True;
+    try:
+        fIsRoot = os.getuid() == 0; # pylint: disable=E1101
+    except:
+        pass;
+
+    # If not, prepend sudo (non-interactive, simulate initial login).
+    if fIsRoot is not True:
+        asArgs = dKeywordArgs.get('args');
+        if asArgs is None:
+            asArgs = aPositionalArgs[0];
+
+        # Detect old sudo.
+        global g_fOldSudo;
+        if g_fOldSudo is None:
+            try:
+                sVersion = processOutputChecked(['sudo', '-V']);
+            except:
+                sVersion = '1.7.0';
+            sVersion = sVersion.strip().split('\n')[0];
+            sVersion = sVersion.replace('Sudo version', '').strip();
+            g_fOldSudo = len(sVersion) >= 4 \
+                     and sVersion[0] == '1' \
+                     and sVersion[1] == '.' \
+                     and sVersion[2] <= '6' \
+                     and sVersion[3] == '.';
+
+        asArgs.insert(0, 'sudo');
+        if not g_fOldSudo:
+            asArgs.insert(1, '-n');
+        if fInitialEnv and not g_fOldSudo:
+            asArgs.insert(1, '-i');
+
+        # paranoia...
+        if dKeywordArgs.get('args') is not None:
+            dKeywordArgs['args'] = asArgs;
+        else:
+            aPositionalArgs = (asArgs,) + aPositionalArgs[1:];
+    return None;
+
+
+def sudoProcessCall(*aPositionalArgs, **dKeywordArgs):
+    """
+    sudo (or similar) + subprocess.call
+    """
+    _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs);
+    _sudoFixArguments(aPositionalArgs, dKeywordArgs);
+    return processCall(*aPositionalArgs, **dKeywordArgs);
+
+def sudoProcessOutputChecked(*aPositionalArgs, **dKeywordArgs):
+    """
+    sudo (or similar) + subprocess.check_output.
+    """
+    _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs);
+    _sudoFixArguments(aPositionalArgs, dKeywordArgs);
+    return processOutputChecked(*aPositionalArgs, **dKeywordArgs);
+
+def sudoProcessOutputCheckedNoI(*aPositionalArgs, **dKeywordArgs):
+    """
+    sudo (or similar) + subprocess.check_output, except '-i' isn't used.
+    """
+    _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs);
+    _sudoFixArguments(aPositionalArgs, dKeywordArgs, False);
+    return processOutputChecked(*aPositionalArgs, **dKeywordArgs);
+
+def sudoProcessPopen(*aPositionalArgs, **dKeywordArgs):
+    """
+    sudo (or similar) + subprocess.Popen.
+    """
+    _processFixPythonInterpreter(aPositionalArgs, dKeywordArgs);
+    _sudoFixArguments(aPositionalArgs, dKeywordArgs);
+    return subprocess.Popen(*aPositionalArgs, **dKeywordArgs);
+
+
+#
+# Generic process stuff.
+#
+
+def processInterrupt(uPid):
+    """
+    Sends a SIGINT or equivalent to interrupt the specified process.
+    Returns True on success, False on failure.
+
+    On Windows hosts this may not work unless the process happens to be a
+    process group leader.
+    """
+    if sys.platform == 'win32':
+        try:
+            win32console.GenerateConsoleCtrlEvent(win32con.CTRL_BREAK_EVENT, uPid); # pylint
+            fRc = True;
+        except:
+            fRc = False;
+    else:
+        try:
+            os.kill(uPid, signal.SIGINT);
+            fRc = True;
+        except:
+            fRc = False;
+    return fRc;
+
+def sendUserSignal1(uPid):
+    """
+    Sends a SIGUSR1 or equivalent to nudge the process into shutting down
+    (VBoxSVC) or something.
+    Returns True on success, False on failure or if not supported (win).
+
+    On Windows hosts this may not work unless the process happens to be a
+    process group leader.
+    """
+    if sys.platform == 'win32':
+        fRc = False;
+    else:
+        try:
+            os.kill(uPid, signal.SIGUSR1); # pylint: disable=E1101
+            fRc = True;
+        except:
+            fRc = False;
+    return fRc;
+
+def processTerminate(uPid):
+    """
+    Terminates the process in a nice manner (SIGTERM or equivalent).
+    Returns True on success, False on failure.
+    """
+    fRc = False;
+    if sys.platform == 'win32':
+        try:
+            hProcess = win32api.OpenProcess(win32con.PROCESS_TERMINATE, False, uPid);
+        except:
+            pass;
+        else:
+            try:
+                win32process.TerminateProcess(hProcess, 0x40010004); # DBG_TERMINATE_PROCESS
+                fRc = True;
+            except:
+                pass;
+            win32api.CloseHandle(hProcess)
+    else:
+        try:
+            os.kill(uPid, signal.SIGTERM);
+            fRc = True;
+        except:
+            pass;
+    return fRc;
+
+def processKill(uPid):
+    """
+    Terminates the process with extreme prejudice (SIGKILL).
+    Returns True on success, False on failure.
+    """
+    if sys.platform == 'win32':
+        fRc = processTerminate(uPid);
+    else:
+        try:
+            os.kill(uPid, signal.SIGKILL); # pylint: disable=E1101
+            fRc = True;
+        except:
+            fRc = False;
+    return fRc;
+
+def processKillWithNameCheck(uPid, sName):
+    """
+    Like processKill(), but checks if the process name matches before killing
+    it.  This is intended for killing using potentially stale pid values.
+
+    Returns True on success, False on failure.
+    """
+
+    if processCheckPidAndName(uPid, sName) is not True:
+        return False;
+    return processKill(uPid);
+
+
+def processExists(uPid):
+    """
+    Checks if the specified process exits.
+    This will only work if we can signal/open the process.
+
+    Returns True if it positively exists, False otherwise.
+    """
+    if sys.platform == 'win32':
+        fRc = False;
+        try:
+            hProcess = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, False, uPid);
+        except:
+            pass;
+        else:
+            win32api.CloseHandle(hProcess)
+            fRc = True;
+    else:
+        try:
+            os.kill(uPid, 0);
+            fRc = True;
+        except:
+            fRc = False;
+    return fRc;
+
+def processCheckPidAndName(uPid, sName):
+    """
+    Checks if a process PID and NAME matches.
+    """
+    fRc = processExists(uPid);
+    if fRc is not True:
+        return False;
+
+    if sys.platform == 'win32':
+        try:
+            from win32com.client import GetObject; # pylint: disable=F0401
+            oWmi = GetObject('winmgmts:');
+            aoProcesses = oWmi.InstancesOf('Win32_Process');
+            for oProcess in aoProcesses:
+                if long(oProcess.Properties_("ProcessId").Value) == uPid:
+                    sCurName = oProcess.Properties_("Name").Value;
+                    #reporter.log2('uPid=%s sName=%s sCurName=%s' % (uPid, sName, sCurName));
+                    sName    = sName.lower();
+                    sCurName = sCurName.lower();
+                    if os.path.basename(sName) == sName:
+                        sCurName = os.path.basename(sCurName);
+
+                    if   sCurName == sName \
+                      or sCurName + '.exe' == sName \
+                      or sCurName == sName  + '.exe':
+                        fRc = True;
+                    break;
+        except:
+            #reporter.logXcpt('uPid=%s sName=%s' % (uPid, sName));
+            pass;
+    else:
+        if sys.platform in ('linux2', ):
+            asPsCmd = ['/bin/ps',     '-p', '%u' % (uPid,), '-o', 'fname='];
+        elif sys.platform in ('sunos5',):
+            asPsCmd = ['/usr/bin/ps', '-p', '%u' % (uPid,), '-o', 'fname='];
+        elif sys.platform in ('darwin',):
+            asPsCmd = ['/bin/ps',     '-p', '%u' % (uPid,), '-o', 'ucomm='];
+        else:
+            asPsCmd = None;
+
+        if asPsCmd is not None:
+            try:
+                oPs = subprocess.Popen(asPsCmd, stdout=subprocess.PIPE);
+                sCurName = oPs.communicate()[0];
+                iExitCode = oPs.wait();
+            except:
+                #reporter.logXcpt();
+                return False;
+
+            # ps fails with non-zero exit code if the pid wasn't found.
+            if iExitCode is not 0:
+                return False;
+            if sCurName is None:
+                return False;
+            sCurName = sCurName.strip();
+            if sCurName is '':
+                return False;
+
+            if os.path.basename(sName) == sName:
+                sCurName = os.path.basename(sCurName);
+            elif os.path.basename(sCurName) == sCurName:
+                sName = os.path.basename(sName);
+
+            if sCurName != sName:
+                return False;
+
+            fRc = True;
+    return fRc;
+
+
+class ProcessInfo(object):
+    """Process info."""
+    def __init__(self, iPid):
+        self.iPid       = iPid;
+        self.iParentPid = None;
+        self.sImage     = None;
+        self.sName      = None;
+        self.asArgs     = None;
+        self.sCwd       = None;
+        self.iGid       = None;
+        self.iUid       = None;
+        self.iProcGroup = None;
+        self.iSessionId = None;
+
+    def loadAll(self):
+        """Load all the info."""
+        sOs = getHostOs();
+        if sOs == 'linux':
+            sProc = '/proc/%s/' % (self.iPid,);
+            if self.sImage   is None: self.sImage = noxcptReadLink(sProc + 'exe', None);
+            if self.sCwd     is None: self.sCwd   = noxcptReadLink(sProc + 'cwd', None);
+            if self.asArgs   is None: self.asArgs = noxcptReadFile(sProc + 'cmdline', '').split('\x00');
+        elif sOs == 'solaris':
+            sProc = '/proc/%s/' % (self.iPid,);
+            if self.sImage   is None: self.sImage = noxcptReadLink(sProc + 'path/a.out', None);
+            if self.sCwd     is None: self.sCwd   = noxcptReadLink(sProc + 'path/cwd', None);
+        else:
+            pass;
+        if self.sName is None and self.sImage is not None:
+            self.sName = self.sImage;
+
+    def windowsGrabProcessInfo(self, oProcess):
+        """Windows specific loadAll."""
+        try:    self.sName      = oProcess.Properties_("Name").Value;
+        except: pass;
+        try:    self.sImage     = oProcess.Properties_("ExecutablePath").Value;
+        except: pass;
+        try:    self.asArgs     = oProcess.Properties_("CommandLine").Value; ## @todo split it.
+        except: pass;
+        try:    self.iParentPid = oProcess.Properties_("ParentProcessId").Value;
+        except: pass;
+        try:    self.iSessionId = oProcess.Properties_("SessionId").Value;
+        except: pass;
+        if self.sName is None and self.sImage is not None:
+            self.sName = self.sImage;
+
+    def getBaseImageName(self):
+        """
+        Gets the base image name if available, use the process name if not available.
+        Returns image/process base name or None.
+        """
+        sRet = self.sImage if self.sName is None else self.sName;
+        if sRet is None:
+            self.loadAll();
+            sRet = self.sImage if self.sName is None else self.sName;
+            if sRet is None:
+                if self.asArgs is None or len(self.asArgs) == 0:
+                    return None;
+                sRet = self.asArgs[0];
+                if len(sRet) == 0:
+                    return None;
+        return os.path.basename(sRet);
+
+    def getBaseImageNameNoExeSuff(self):
+        """
+        Same as getBaseImageName, except any '.exe' or similar suffix is stripped.
+        """
+        sRet = self.getBaseImageName();
+        if sRet is not None and len(sRet) > 4 and sRet[-4] == '.':
+            if (sRet[-4:]).lower() in [ '.exe', '.com', '.msc', '.vbs', '.cmd', '.bat' ]:
+                sRet = sRet[:-4];
+        return sRet;
+
+
+def processListAll(): # pylint: disable=R0914
+    """
+    Return a list of ProcessInfo objects for all the processes in the system
+    that the current user can see.
+    """
+    asProcesses = [];
+
+    sOs = getHostOs();
+    if sOs == 'win':
+        from win32com.client import GetObject; # pylint: disable=F0401
+        oWmi = GetObject('winmgmts:');
+        aoProcesses = oWmi.InstancesOf('Win32_Process');
+        for oProcess in aoProcesses:
+            try:
+                iPid = int(oProcess.Properties_("ProcessId").Value);
+            except:
+                continue;
+            oMyInfo = ProcessInfo(iPid);
+            oMyInfo.windowsGrabProcessInfo(oProcess);
+            asProcesses.append(oMyInfo);
+
+    elif sOs in [ 'linux', 'solaris' ]:
+        try:
+            asDirs = os.listdir('/proc');
+        except:
+            asDirs = [];
+        for sDir in asDirs:
+            if sDir.isdigit():
+                asProcesses.append(ProcessInfo(int(sDir),));
+
+    elif sOs == 'darwin':
+        # Try our best to parse ps output. (Not perfect but does the job most of the time.)
+        try:
+            sRaw = processOutputChecked([ '/bin/ps', '-A',
+                                          '-o', 'pid=',
+                                          '-o', 'ppid=',
+                                          '-o', 'pgid=',
+                                          '-o', 'sess=',
+                                          '-o', 'uid=',
+                                          '-o', 'gid=',
+                                          '-o', 'comm=' ]);
+        except:
+            return asProcesses;
+
+        for sLine in sRaw.split('\n'):
+            sLine = sLine.lstrip();
+            if len(sLine) < 7 or not sLine[0].isdigit():
+                continue;
+
+            iField   = 0;
+            off      = 0;
+            aoFields = [None, None, None, None, None, None, None];
+            while iField < 7:
+                # Eat whitespace.
+                while off < len(sLine) and (sLine[off] == ' ' or sLine[off] == '\t'):
+                    off += 1;
+
+                # Final field / EOL.
+                if iField == 6:
+                    aoFields[6] = sLine[off:];
+                    break;
+                if off >= len(sLine):
+                    break;
+
+                # Generic field parsing.
+                offStart = off;
+                off += 1;
+                while off < len(sLine) and sLine[off] != ' ' and sLine[off] != '\t':
+                    off += 1;
+                try:
+                    if iField != 3:
+                        aoFields[iField] = int(sLine[offStart:off]);
+                    else:
+                        aoFields[iField] = long(sLine[offStart:off], 16); # sess is a hex address.
+                except:
+                    pass;
+                iField += 1;
+
+            if aoFields[0] is not None:
+                oMyInfo = ProcessInfo(aoFields[0]);
+                oMyInfo.iParentPid = aoFields[1];
+                oMyInfo.iProcGroup = aoFields[2];
+                oMyInfo.iSessionId = aoFields[3];
+                oMyInfo.iUid       = aoFields[4];
+                oMyInfo.iGid       = aoFields[5];
+                oMyInfo.sName      = aoFields[6];
+                asProcesses.append(oMyInfo);
+
+    return asProcesses;
+
+
+def processCollectCrashInfo(uPid, fnLog, fnCrashFile):
+    """
+    Looks for information regarding the demise of the given process.
+    """
+    sOs = getHostOs();
+    if sOs == 'darwin':
+        #
+        # On darwin we look for crash and diagnostic reports.
+        #
+        asLogDirs = [
+            u'/Library/Logs/DiagnosticReports/',
+            u'/Library/Logs/CrashReporter/',
+            u'~/Library/Logs/DiagnosticReports/',
+            u'~/Library/Logs/CrashReporter/',
+        ];
+        for sDir in asLogDirs:
+            sDir = os.path.expanduser(sDir);
+            if not os.path.isdir(sDir):
+                continue;
+            try:
+                asDirEntries = os.listdir(sDir);
+            except:
+                continue;
+            for sEntry in asDirEntries:
+                # Only interested in .crash files.
+                _, sSuff = os.path.splitext(sEntry);
+                if sSuff != '.crash':
+                    continue;
+
+                # The pid can be found at the end of the first line.
+                sFull = os.path.join(sDir, sEntry);
+                try:
+                    oFile = open(sFull, 'r');
+                    sFirstLine = oFile.readline();
+                    oFile.close();
+                except:
+                    continue;
+                if len(sFirstLine) <= 4 or sFirstLine[-2] != ']':
+                    continue;
+                offPid = len(sFirstLine) - 3;
+                while offPid > 1 and sFirstLine[offPid - 1].isdigit():
+                    offPid -= 1;
+                try:    uReportPid = int(sFirstLine[offPid:-2]);
+                except: continue;
+
+                # Does the pid we found match?
+                if uReportPid == uPid:
+                    fnLog('Found crash report for %u: %s' % (uPid, sFull,));
+                    fnCrashFile(sFull, False);
+    elif sOs == 'win':
+        #
+        # Getting WER reports would be great, however we have trouble match the
+        # PID to those as they seems not to mention it in the brief reports.
+        # Instead we'll just look for crash dumps in C:\CrashDumps (our custom
+        # location - see the windows readme for the testbox script) and what
+        # the MSDN article lists for now.
+        #
+        # It's been observed on Windows server 2012 that the dump files takes
+        # the form: <processimage>.<decimal-pid>.dmp
+        #
+        asDmpDirs = [
+            u'%SystemDrive%/CrashDumps/',                   # Testboxes.
+            u'%LOCALAPPDATA%/CrashDumps/',                  # MSDN example.
+            u'%WINDIR%/ServiceProfiles/LocalServices/',     # Local and network service.
+            u'%WINDIR%/ServiceProfiles/NetworkSerices/',
+            u'%WINDIR%/ServiceProfiles/',
+            u'%WINDIR%/System32/Config/SystemProfile/',     # System services.
+        ];
+        sMatchSuffix = '.%u.dmp' % (uPid,);
+
+        for sDir in asDmpDirs:
+            sDir = os.path.expandvars(sDir);
+            if not os.path.isdir(sDir):
+                continue;
+            try:
+                asDirEntries = os.listdir(sDir);
+            except:
+                continue;
+            for sEntry in asDirEntries:
+                if sEntry.endswith(sMatchSuffix):
+                    sFull = os.path.join(sDir, sEntry);
+                    fnLog('Found crash dump for %u: %s' % (uPid, sFull,));
+                    fnCrashFile(sFull, True);
+
+    else:
+        pass; ## TODO
+    return None;
+
+
+#
+# Time.
+#
+
+def timestampNano():
+    """
+    Gets a nanosecond timestamp.
+    """
+    if sys.platform == 'win32':
+        return long(time.clock() * 1000000000);
+    return long(time.time() * 1000000000);
+
+def timestampMilli():
+    """
+    Gets a millisecond timestamp.
+    """
+    if sys.platform == 'win32':
+        return long(time.clock() * 1000);
+    return long(time.time() * 1000);
+
+def timestampSecond():
+    """
+    Gets a second timestamp.
+    """
+    if sys.platform == 'win32':
+        return long(time.clock());
+    return long(time.time());
+
+def getTimePrefix():
+    """
+    Returns a timestamp prefix, typically used for logging. UTC.
+    """
+    try:
+        oNow = datetime.datetime.utcnow();
+        sTs = '%02u:%02u:%02u.%06u' % (oNow.hour, oNow.minute, oNow.second, oNow.microsecond);
+    except:
+        sTs = 'getTimePrefix-exception';
+    return sTs;
+
+def getTimePrefixAndIsoTimestamp():
+    """
+    Returns current UTC as log prefix and iso timestamp.
+    """
+    try:
+        oNow = datetime.datetime.utcnow();
+        sTsPrf = '%02u:%02u:%02u.%06u' % (oNow.hour, oNow.minute, oNow.second, oNow.microsecond);
+        sTsIso = formatIsoTimestamp(oNow);
+    except:
+        sTsPrf = sTsIso = 'getTimePrefix-exception';
+    return (sTsPrf, sTsIso);
+
+def formatIsoTimestamp(oNow):
+    """Formats the datetime object as an ISO timestamp."""
+    assert oNow.tzinfo is None;
+    sTs = '%s.%09uZ' % (oNow.strftime('%Y-%m-%dT%H:%M:%S'), oNow.microsecond * 1000);
+    return sTs;
+
+def getIsoTimestamp():
+    """Returns the current UTC timestamp as a string."""
+    return formatIsoTimestamp(datetime.datetime.utcnow());
+
+
+def getLocalHourOfWeek():
+    """ Local hour of week (0 based). """
+    oNow = datetime.datetime.now();
+    return (oNow.isoweekday() - 1) * 24 + oNow.hour;
+
+
+def formatIntervalSeconds(cSeconds):
+    """ Format a seconds interval into a nice 01h 00m 22s string  """
+    # Two simple special cases.
+    if cSeconds < 60:
+        return '%ss' % (cSeconds,);
+    if cSeconds < 3600:
+        cMins = cSeconds / 60;
+        cSecs = cSeconds % 60;
+        if cSecs == 0:
+            return '%sm' % (cMins,);
+        return '%sm %ss' % (cMins, cSecs,);
+
+    # Generic and a bit slower.
+    cDays     = cSeconds / 86400;
+    cSeconds %= 86400;
+    cHours    = cSeconds / 3600;
+    cSeconds %= 3600;
+    cMins     = cSeconds / 60;
+    cSecs     = cSeconds % 60;
+    sRet = '';
+    if cDays > 0:
+        sRet = '%sd ' % (cDays,);
+    if cHours > 0:
+        sRet += '%sh ' % (cHours,);
+    if cMins > 0:
+        sRet += '%sm ' % (cMins,);
+    if cSecs > 0:
+        sRet += '%ss ' % (cSecs,);
+    assert len(sRet) > 0; assert sRet[-1] == ' ';
+    return sRet[:-1];
+
+def formatIntervalSeconds2(oSeconds):
+    """
+    Flexible input version of formatIntervalSeconds for use in WUI forms where
+    data is usually already string form.
+    """
+    if isinstance(oSeconds, int) or isinstance(oSeconds, long):
+        return formatIntervalSeconds(oSeconds);
+    if not isString(oSeconds):
+        try:
+            lSeconds = long(oSeconds);
+        except:
+            pass;
+        else:
+            if lSeconds >= 0:
+                return formatIntervalSeconds2(lSeconds);
+    return oSeconds;
+
+def parseIntervalSeconds(sString):
+    """
+    Reverse of formatIntervalSeconds.
+
+    Returns (cSeconds, sError), where sError is None on success.
+    """
+
+    # We might given non-strings, just return them without any fuss.
+    if not isString(sString):
+        if isinstance(sString, int) or isinstance(sString, long) or  sString is None:
+            return (sString, None);
+        ## @todo time/date objects?
+        return (int(sString), None);
+
+    # Strip it and make sure it's not empty.
+    sString = sString.strip();
+    if len(sString) == 0:
+        return (0, 'Empty interval string.');
+
+    #
+    # Split up the input into a list of 'valueN, unitN, ...'.
+    #
+    # Don't want to spend too much time trying to make re.split do exactly what
+    # I need here, so please forgive the extra pass I'm making here.
+    #
+    asRawParts = re.split(r'\s*([0-9]+)\s*([^0-9,;]*)[\s,;]*', sString);
+    asParts    = [];
+    for sPart in asRawParts:
+        sPart = sPart.strip();
+        if len(sPart) > 0:
+            asParts.append(sPart);
+    if len(asParts) == 0:
+        return (0, 'Empty interval string or something?');
+
+    #
+    # Process them one or two at the time.
+    #
+    cSeconds   = 0;
+    asErrors   = [];
+    i          = 0;
+    while i < len(asParts):
+        sNumber = asParts[i];
+        i += 1;
+        if sNumber.isdigit():
+            iNumber = int(sNumber);
+
+            sUnit = 's';
+            if i < len(asParts) and not asParts[i].isdigit():
+                sUnit = asParts[i];
+                i += 1;
+
+            sUnitLower = sUnit.lower();
+            if sUnitLower in [ 's', 'se', 'sec', 'second', 'seconds' ]:
+                pass;
+            elif sUnitLower in [ 'm', 'mi', 'min', 'minute', 'minutes' ]:
+                iNumber *= 60;
+            elif sUnitLower in [ 'h', 'ho', 'hou', 'hour', 'hours' ]:
+                iNumber *= 3600;
+            elif sUnitLower in [ 'd', 'da', 'day', 'days' ]:
+                iNumber *= 86400;
+            elif sUnitLower in [ 'w', 'week', 'weeks' ]:
+                iNumber *= 7 * 86400;
+            else:
+                asErrors.append('Unknown unit "%s".' % (sUnit,));
+            cSeconds += iNumber;
+        else:
+            asErrors.append('Bad number "%s".' % (sNumber,));
+    return (cSeconds, None if len(asErrors) == 0 else ' '.join(asErrors));
+
+def formatIntervalHours(cHours):
+    """ Format a hours interval into a nice 1w 2d 1h string. """
+    # Simple special cases.
+    if cHours < 24:
+        return '%sh' % (cHours,);
+
+    # Generic and a bit slower.
+    cWeeks    = cHours / (7 * 24);
+    cHours   %= 7 * 24;
+    cDays     = cHours / 24;
+    cHours   %= 24;
+    sRet = '';
+    if cWeeks > 0:
+        sRet = '%sw ' % (cWeeks,);
+    if cDays > 0:
+        sRet = '%sd ' % (cDays,);
+    if cHours > 0:
+        sRet += '%sh ' % (cHours,);
+    assert len(sRet) > 0; assert sRet[-1] == ' ';
+    return sRet[:-1];
+
+def parseIntervalHours(sString):
+    """
+    Reverse of formatIntervalHours.
+
+    Returns (cHours, sError), where sError is None on success.
+    """
+
+    # We might given non-strings, just return them without any fuss.
+    if not isString(sString):
+        if isinstance(sString, int) or isinstance(sString, long) or  sString is None:
+            return (sString, None);
+        ## @todo time/date objects?
+        return (int(sString), None);
+
+    # Strip it and make sure it's not empty.
+    sString = sString.strip();
+    if len(sString) == 0:
+        return (0, 'Empty interval string.');
+
+    #
+    # Split up the input into a list of 'valueN, unitN, ...'.
+    #
+    # Don't want to spend too much time trying to make re.split do exactly what
+    # I need here, so please forgive the extra pass I'm making here.
+    #
+    asRawParts = re.split(r'\s*([0-9]+)\s*([^0-9,;]*)[\s,;]*', sString);
+    asParts    = [];
+    for sPart in asRawParts:
+        sPart = sPart.strip();
+        if len(sPart) > 0:
+            asParts.append(sPart);
+    if len(asParts) == 0:
+        return (0, 'Empty interval string or something?');
+
+    #
+    # Process them one or two at the time.
+    #
+    cHours     = 0;
+    asErrors   = [];
+    i          = 0;
+    while i < len(asParts):
+        sNumber = asParts[i];
+        i += 1;
+        if sNumber.isdigit():
+            iNumber = int(sNumber);
+
+            sUnit = 'h';
+            if i < len(asParts) and not asParts[i].isdigit():
+                sUnit = asParts[i];
+                i += 1;
+
+            sUnitLower = sUnit.lower();
+            if sUnitLower in [ 'h', 'ho', 'hou', 'hour', 'hours' ]:
+                pass;
+            elif sUnitLower in [ 'd', 'da', 'day', 'days' ]:
+                iNumber *= 24;
+            elif sUnitLower in [ 'w', 'week', 'weeks' ]:
+                iNumber *= 7 * 24;
+            else:
+                asErrors.append('Unknown unit "%s".' % (sUnit,));
+            cHours += iNumber;
+        else:
+            asErrors.append('Bad number "%s".' % (sNumber,));
+    return (cHours, None if len(asErrors) == 0 else ' '.join(asErrors));
+
+
+#
+# Introspection.
+#
+
+def getCallerName(oFrame=None, iFrame=2):
+    """
+    Returns the name of the caller's caller.
+    """
+    if oFrame is None:
+        try:
+            raise Exception();
+        except:
+            oFrame = sys.exc_info()[2].tb_frame.f_back;
+        while iFrame > 1:
+            if oFrame is not None:
+                oFrame = oFrame.f_back;
+            iFrame = iFrame - 1;
+    if oFrame is not None:
+        sName = '%s:%u' % (oFrame.f_code.co_name, oFrame.f_lineno);
+        return sName;
+    return "unknown";
+
+
+def getXcptInfo(cFrames = 1):
+    """
+    Gets text detailing the exception. (Good for logging.)
+    Returns list of info strings.
+    """
+
+    #
+    # Try get exception info.
+    #
+    try:
+        oType, oValue, oTraceback = sys.exc_info();
+    except:
+        oType = oValue = oTraceback = None;
+    if oType is not None:
+
+        #
+        # Try format the info
+        #
+        asRet = [];
+        try:
+            try:
+                asRet = asRet + traceback.format_exception_only(oType, oValue);
+                asTraceBack = traceback.format_tb(oTraceback);
+                if cFrames is not None and cFrames <= 1:
+                    asRet.append(asTraceBack[-1]);
+                else:
+                    asRet.append('Traceback:')
+                    for iFrame in range(min(cFrames, len(asTraceBack))):
+                        asRet.append(asTraceBack[-iFrame - 1]);
+                    asRet.append('Stack:')
+                    asRet = asRet + traceback.format_stack(oTraceback.tb_frame.f_back, cFrames);
+            except:
+                asRet.append('internal-error: Hit exception #2! %s' % (traceback.format_exc(),));
+
+            if len(asRet) == 0:
+                asRet.append('No exception info...');
+        except:
+            asRet.append('internal-error: Hit exception! %s' % (traceback.format_exc(),));
+    else:
+        asRet = ['Couldn\'t find exception traceback.'];
+    return asRet;
+
+
+#
+# TestSuite stuff.
+#
+
+def isRunningFromCheckout(cScriptDepth = 1):
+    """
+    Checks if we're running from the SVN checkout or not.
+    """
+
+    try:
+        sFile = __file__;
+        cScriptDepth = 1;
+    except:
+        sFile = sys.argv[0];
+
+    sDir = os.path.abspath(sFile);
+    while cScriptDepth >= 0:
+        sDir = os.path.dirname(sDir);
+        if    os.path.exists(os.path.join(sDir, 'Makefile.kmk')) \
+           or os.path.exists(os.path.join(sDir, 'Makefile.kup')):
+            return True;
+        cScriptDepth -= 1;
+
+    return False;
+
+
+#
+# Bourne shell argument fun.
+#
+
+
+def argsSplit(sCmdLine):
+    """
+    Given a bourne shell command line invocation, split it up into arguments
+    assuming IFS is space.
+    Returns None on syntax error.
+    """
+    ## @todo bourne shell argument parsing!
+    return sCmdLine.split(' ');
+
+def argsGetFirst(sCmdLine):
+    """
+    Given a bourne shell command line invocation, get return the first argument
+    assuming IFS is space.
+    Returns None on invalid syntax, otherwise the parsed and unescaped argv[0] string.
+    """
+    asArgs = argsSplit(sCmdLine);
+    if asArgs is None  or  len(asArgs) == 0:
+        return None;
+
+    return asArgs[0];
+
+#
+# String helpers.
+#
+
+def stricmp(sFirst, sSecond):
+    """
+    Compares to strings in an case insensitive fashion.
+
+    Python doesn't seem to have any way of doing the correctly, so this is just
+    an approximation using lower.
+    """
+    if sFirst == sSecond:
+        return 0;
+    sLower1 = sFirst.lower();
+    sLower2 = sSecond.lower();
+    if sLower1 == sLower2:
+        return 0;
+    if sLower1 < sLower2:
+        return -1;
+    return 1;
+
+
+#
+# Misc.
+#
+
+def versionCompare(sVer1, sVer2):
+    """
+    Compares to version strings in a fashion similar to RTStrVersionCompare.
+    """
+
+    ## @todo implement me!!
+
+    if sVer1 == sVer2:
+        return 0;
+    if sVer1 < sVer2:
+        return -1;
+    return 1;
+
+
+def formatNumber(lNum, sThousandSep = ' '):
+    """
+    Formats a decimal number with pretty separators.
+    """
+    sNum = str(lNum);
+    sRet = sNum[-3:];
+    off  = len(sNum) - 3;
+    while off > 0:
+        off -= 3;
+        sRet = sNum[(off if off >= 0 else 0):(off + 3)] + sThousandSep + sRet;
+    return sRet;
+
+
+def formatNumberNbsp(lNum):
+    """
+    Formats a decimal number with pretty separators.
+    """
+    sRet = formatNumber(lNum);
+    return unicode(sRet).replace(' ', u'\u00a0');
+
+
+def isString(oString):
+    """
+    Checks if the object is a string object, hiding difference between python 2 and 3.
+
+    Returns True if it's a string of some kind.
+    Returns False if not.
+    """
+    if sys.version_info[0] >= 3:
+        return isinstance(oString, str);
+    return isinstance(oString, basestring);
+
+
+def hasNonAsciiCharacters(sText):
+    """
+    Returns True is specified string has non-ASCII characters.
+    """
+    sTmp = unicode(sText, errors='ignore') if isinstance(sText, str) else sText
+    return not all(ord(cChar) < 128 for cChar in sTmp)
+
+
+def chmodPlusX(sFile):
+    """
+    Makes the specified file or directory executable.
+    Returns success indicator, no exceptions.
+
+    Note! Symbolic links are followed and the target will be changed.
+    """
+    try:
+        oStat = os.stat(sFile);
+    except:
+        return False;
+    try:
+        os.chmod(sFile, oStat.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH);
+    except:
+        return False;
+    return True;
+
+
+def unpackFile(sArchive, sDstDir, fnLog, fnError = None):
+    """
+    Unpacks the given file if it has a know archive extension, otherwise do
+    nothing.
+
+    Returns list of the extracted files (full path) on success.
+    Returns empty list if not a supported archive format.
+    Returns None on failure.  Raises no exceptions.
+    """
+    if fnError is None:
+        fnError = fnLog;
+
+    asMembers = [];
+
+    sBaseNameLower = os.path.basename(sArchive).lower();
+    if sBaseNameLower.endswith('.zip'):
+        fnLog('Unzipping "%s" to "%s"...' % (sArchive, sDstDir));
+        try:
+            oZipFile = zipfile.ZipFile(sArchive, 'r')
+            asMembers = oZipFile.namelist();
+            for sMember in asMembers:
+                if sMember.endswith('/'):
+                    os.makedirs(os.path.join(sDstDir, sMember.replace('/', os.path.sep)), 0775);
+                else:
+                    oZipFile.extract(sMember, sDstDir);
+            oZipFile.close();
+        except Exception, oXcpt:
+            fnError('Error unpacking "%s" into "%s": %s' % (sArchive, sDstDir, oXcpt));
+            return None;
+
+    elif sBaseNameLower.endswith('.tar') \
+      or sBaseNameLower.endswith('.tar.gz') \
+      or sBaseNameLower.endswith('.tgz') \
+      or sBaseNameLower.endswith('.tar.bz2'):
+        fnLog('Untarring "%s" to "%s"...' % (sArchive, sDstDir));
+        try:
+            oTarFile = tarfile.open(sArchive, 'r:*');
+            asMembers = [oTarInfo.name for oTarInfo in oTarFile.getmembers()];
+            oTarFile.extractall(sDstDir);
+            oTarFile.close();
+        except Exception, oXcpt:
+            fnError('Error unpacking "%s" into "%s": %s' % (sArchive, sDstDir, oXcpt));
+            return None;
+
+    else:
+        fnLog('Not unpacking "%s".' % (sArchive,));
+        return [];
+
+    #
+    # Change asMembers to local slashes and prefix with path.
+    #
+    asMembersRet = [];
+    for sMember in asMembers:
+        asMembersRet.append(os.path.join(sDstDir, sMember.replace('/', os.path.sep)));
+
+    return asMembersRet;
+
+
+def getDiskUsage(sPath):
+    """
+    Get free space of a partition that corresponds to specified sPath in MB.
+
+    Returns partition free space value in MB.
+    """
+    if platform.system() == 'Windows':
+        import ctypes
+        oCTypeFreeSpace = ctypes.c_ulonglong(0);
+        ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(sPath), None, None,
+                                                   ctypes.pointer(oCTypeFreeSpace));
+        cbFreeSpace = oCTypeFreeSpace.value;
+    else:
+        oStats = os.statvfs(sPath); # pylint: disable=E1101
+        cbFreeSpace = long(oStats.f_frsize) * oStats.f_bfree;
+
+    # Convert to MB
+    cMbFreeSpace = long(cbFreeSpace) / (1024 * 1024);
+
+    return cMbFreeSpace;
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class BuildCategoryDataTestCase(unittest.TestCase):
+    def testIntervalSeconds(self):
+        self.assertEqual(parseIntervalSeconds(formatIntervalSeconds(3600)), (3600, None));
+        self.assertEqual(parseIntervalSeconds(formatIntervalSeconds(1209438593)), (1209438593, None));
+        self.assertEqual(parseIntervalSeconds('123'), (123, None));
+        self.assertEqual(parseIntervalSeconds(123), (123, None));
+        self.assertEqual(parseIntervalSeconds(99999999999), (99999999999, None));
+        self.assertEqual(parseIntervalSeconds(''), (0, 'Empty interval string.'));
+        self.assertEqual(parseIntervalSeconds('1X2'), (3, 'Unknown unit "X".'));
+        self.assertEqual(parseIntervalSeconds('1 Y3'), (4, 'Unknown unit "Y".'));
+        self.assertEqual(parseIntervalSeconds('1 Z 4'), (5, 'Unknown unit "Z".'));
+        self.assertEqual(parseIntervalSeconds('1 hour 2m 5second'), (3725, None));
+        self.assertEqual(parseIntervalSeconds('1 hour,2m ; 5second'), (3725, None));
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/common/webutils.py b/src/VBox/ValidationKit/common/webutils.py
new file mode 100644
index 0000000..bfd39ec
--- /dev/null
+++ b/src/VBox/ValidationKit/common/webutils.py
@@ -0,0 +1,204 @@
+# -*- coding: utf-8 -*-
+# $Id: webutils.py $
+
+"""
+Common Web Utility Functions.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard Python imports.
+import os;
+import shutil;
+import sys;
+import unittest;
+
+# Validation Kit imports.
+from common import utils;
+
+# Python 3 hacks:
+if sys.version_info[0] < 3:
+    from urllib         import urlopen      as urllib_urlopen;
+    from urllib2        import quote        as urllib_quote;
+    from urllib         import urlencode    as urllib_urlencode;
+else:
+    from urllib.parse   import quote        as urllib_quote;        # pylint: disable=F0401,E0611
+    from urllib.parse   import urlencode    as urllib_urlencode;    # pylint: disable=F0401,E0611
+    from urllib.request import urlopen      as urllib_urlopen;      # pylint: disable=F0401,E0611
+
+
+def escapeElem(sText):
+    """
+    Escapes special character to HTML-safe sequences.
+    """
+    sText = sText.replace('&', '&')
+    sText = sText.replace('<', '<')
+    return sText.replace('>', '>')
+
+def escapeAttr(sText):
+    """
+    Escapes special character to HTML-safe sequences.
+    """
+    sText = sText.replace('&', '&')
+    sText = sText.replace('<', '<')
+    sText = sText.replace('>', '>')
+    return sText.replace('"', '"')
+
+def escapeElemToStr(oObject):
+    """
+    Stringifies the object and hands it to escapeElem.
+    """
+    if utils.isString(oObject):
+        return escapeElem(oObject);
+    return escapeElem(str(oObject));
+
+def escapeAttrToStr(oObject):
+    """
+    Stringifies the object and hands it to escapeAttr.  May return unicode string.
+    """
+    return escapeAttr(oObject);
+
+def escapeAttrJavaScriptStringDQ(sText):
+    """ Escapes a javascript string that is to be emitted between double quotes. """
+    if '"' not in sText:
+        chMin = min(sText);
+        if ord(chMin) >= 0x20:
+            return sText;
+
+    sRet = '';
+    for ch in sText:
+        if ch == '"':
+            sRet += '\\"';
+        elif ord(ch) >= 0x20:
+            sRet += ch;
+        elif ch == '\n':
+            sRet += '\\n';
+        elif ch == '\r':
+            sRet += '\\r';
+        elif ch == '\t':
+            sRet += '\\t';
+        else:
+            sRet += '\\x%02x' % (ch,);
+    return sRet;
+
+def quoteUrl(sText):
+    """
+    See urllib.quote().
+    """
+    return urllib_quote(sText);
+
+def encodeUrlParams(dParams):
+    """
+    See urllib.urlencode().
+    """
+    return urllib_urlencode(dParams, doseq=True)
+
+def hasSchema(sUrl):
+    """
+    Checks if the URL has a schema (e.g. http://) or is file/server relative.
+    Returns True if schema is present, False if not.
+    """
+    iColon = sUrl.find(':');
+    if iColon > 0:
+        sSchema = sUrl[0:iColon];
+        if len(sSchema) >= 2 and len(sSchema) < 16 and sSchema.islower() and sSchema.isalpha():
+            return True;
+    return False;
+
+def getFilename(sUrl):
+    """
+    Extracts the filename from the URL.
+    """
+    ## @TODO This isn't entirely correct. Use the urlparser instead!
+    sFilename = os.path.basename(sUrl.replace('/', os.path.sep));
+    return sFilename;
+
+
+def downloadFile(sUrlFile, sDstFile, sLocalPrefix, fnLog, fnError = None, fNoProxies=True):
+    """
+    Downloads the given file if an URL is given, otherwise assume it's
+    something on the build share and copy it from there.
+
+    Raises no exceptions, returns log + success indicator instead.
+
+    Note! This method may use proxies configured on the system and the
+          http_proxy, ftp_proxy, no_proxy environment variables.
+
+    @todo Fixed build burn here. Please set default value for fNoProxies
+          to appropriate one.
+    """
+    if fnError is None:
+        fnError = fnLog;
+
+    if  sUrlFile.startswith('http://') \
+     or sUrlFile.startswith('https://') \
+     or sUrlFile.startswith('ftp://'):
+        # Download the file.
+        fnLog('Downloading "%s" to "%s"...' % (sUrlFile, sDstFile));
+        try:
+            ## @todo We get 404.html content instead of exceptions here, which is confusing and should be addressed.
+            if fNoProxies:
+                oSrc = urllib_urlopen(sUrlFile);
+            else:
+                oSrc = urllib_urlopen(sUrlFile, proxies = dict());
+            oDst = utils.openNoInherit(sDstFile, 'wb');
+            oDst.write(oSrc.read());
+            oDst.close();
+            oSrc.close();
+        except Exception, oXcpt:
+            fnError('Error downloading "%s" to "%s": %s' % (sUrlFile, sDstFile, oXcpt));
+            return False;
+    else:
+        # Assumes file from the build share.
+        sSrcPath = os.path.join(sLocalPrefix, sUrlFile);
+        fnLog('Copying "%s" to "%s"...' % (sSrcPath, sDstFile));
+        try:
+            shutil.copyfile(sSrcPath, sDstFile);
+        except Exception, oXcpt:
+            fnError('Error copying "%s" to "%s": %s' % (sSrcPath, sDstFile, oXcpt));
+            return False;
+
+    return True;
+
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class CommonUtilsTestCase(unittest.TestCase):
+    def testHasSchema(self):
+        self.assertTrue(hasSchema('http://www.oracle.com/'));
+        self.assertTrue(hasSchema('https://virtualbox.com/'));
+        self.assertFalse(hasSchema('://virtualbox.com/'));
+        self.assertFalse(hasSchema('/usr/bin'));
+        self.assertFalse(hasSchema('usr/bin'));
+        self.assertFalse(hasSchema('bin'));
+        self.assertFalse(hasSchema('C:\\WINNT'));
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/docs/AutomaticTestingRevamp.html b/src/VBox/ValidationKit/docs/AutomaticTestingRevamp.html
new file mode 100644
index 0000000..63caa83
--- /dev/null
+++ b/src/VBox/ValidationKit/docs/AutomaticTestingRevamp.html
@@ -0,0 +1,1357 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
+<title></title>
+<style type="text/css">
+
+/*
+:Author: David Goodger (goodger at python.org)
+:Id: $Id: AutomaticTestingRevamp.html $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+
+See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+  border: 0 }
+
+table.borderless td, table.borderless th {
+  /* Override padding for "table.docutils td" with "! important".
+     The right padding separates the table cells. */
+  padding: 0 0.5em 0 0 ! important }
+
+.first {
+  /* Override more specific margin styles with "! important". */
+  margin-top: 0 ! important }
+
+.last, .with-subtitle {
+  margin-bottom: 0 ! important }
+
+.hidden {
+  display: none }
+
+a.toc-backref {
+  text-decoration: none ;
+  color: black }
+
+blockquote.epigraph {
+  margin: 2em 5em ; }
+
+dl.docutils dd {
+  margin-bottom: 0.5em }
+
+object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
+  overflow: hidden;
+}
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+  font-weight: bold }
+*/
+
+div.abstract {
+  margin: 2em 5em }
+
+div.abstract p.topic-title {
+  font-weight: bold ;
+  text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+  margin: 2em ;
+  border: medium outset ;
+  padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+  font-weight: bold ;
+  font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title, .code .error {
+  color: red ;
+  font-weight: bold ;
+  font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+   compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+  margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+  margin-top: 0.5em }
+*/
+
+div.dedication {
+  margin: 2em 5em ;
+  text-align: center ;
+  font-style: italic }
+
+div.dedication p.topic-title {
+  font-weight: bold ;
+  font-style: normal }
+
+div.figure {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+div.footer, div.header {
+  clear: both;
+  font-size: smaller }
+
+div.line-block {
+  display: block ;
+  margin-top: 1em ;
+  margin-bottom: 1em }
+
+div.line-block div.line-block {
+  margin-top: 0 ;
+  margin-bottom: 0 ;
+  margin-left: 1.5em }
+
+div.sidebar {
+  margin: 0 0 0.5em 1em ;
+  border: medium outset ;
+  padding: 1em ;
+  background-color: #ffffee ;
+  width: 40% ;
+  float: right ;
+  clear: right }
+
+div.sidebar p.rubric {
+  font-family: sans-serif ;
+  font-size: medium }
+
+div.system-messages {
+  margin: 5em }
+
+div.system-messages h1 {
+  color: red }
+
+div.system-message {
+  border: medium outset ;
+  padding: 1em }
+
+div.system-message p.system-message-title {
+  color: red ;
+  font-weight: bold }
+
+div.topic {
+  margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+  margin-top: 0.4em }
+
+h1.title {
+  text-align: center }
+
+h2.subtitle {
+  text-align: center }
+
+hr.docutils {
+  width: 75% }
+
+img.align-left, .figure.align-left, object.align-left {
+  clear: left ;
+  float: left ;
+  margin-right: 1em }
+
+img.align-right, .figure.align-right, object.align-right {
+  clear: right ;
+  float: right ;
+  margin-left: 1em }
+
+img.align-center, .figure.align-center, object.align-center {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+.align-left {
+  text-align: left }
+
+.align-center {
+  clear: both ;
+  text-align: center }
+
+.align-right {
+  text-align: right }
+
+/* reset inner alignment in figures */
+div.align-right {
+  text-align: inherit }
+
+/* div.align-center * { */
+/*   text-align: left } */
+
+ol.simple, ul.simple {
+  margin-bottom: 1em }
+
+ol.arabic {
+  list-style: decimal }
+
+ol.loweralpha {
+  list-style: lower-alpha }
+
+ol.upperalpha {
+  list-style: upper-alpha }
+
+ol.lowerroman {
+  list-style: lower-roman }
+
+ol.upperroman {
+  list-style: upper-roman }
+
+p.attribution {
+  text-align: right ;
+  margin-left: 50% }
+
+p.caption {
+  font-style: italic }
+
+p.credits {
+  font-style: italic ;
+  font-size: smaller }
+
+p.label {
+  white-space: nowrap }
+
+p.rubric {
+  font-weight: bold ;
+  font-size: larger ;
+  color: maroon ;
+  text-align: center }
+
+p.sidebar-title {
+  font-family: sans-serif ;
+  font-weight: bold ;
+  font-size: larger }
+
+p.sidebar-subtitle {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+p.topic-title {
+  font-weight: bold }
+
+pre.address {
+  margin-bottom: 0 ;
+  margin-top: 0 ;
+  font: inherit }
+
+pre.literal-block, pre.doctest-block, pre.math, pre.code {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+pre.code .ln { color: grey; } /* line numbers */
+pre.code, code { background-color: #eeeeee }
+pre.code .comment, code .comment { color: #5C6576 }
+pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
+pre.code .literal.string, code .literal.string { color: #0C5404 }
+pre.code .name.builtin, code .name.builtin { color: #352B84 }
+pre.code .deleted, code .deleted { background-color: #DEB0A1}
+pre.code .inserted, code .inserted { background-color: #A3D289}
+
+span.classifier {
+  font-family: sans-serif ;
+  font-style: oblique }
+
+span.classifier-delimiter {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+span.interpreted {
+  font-family: sans-serif }
+
+span.option {
+  white-space: nowrap }
+
+span.pre {
+  white-space: pre }
+
+span.problematic {
+  color: red }
+
+span.section-subtitle {
+  /* font-size relative to parent (h1..h6 element) */
+  font-size: 80% }
+
+table.citation {
+  border-left: solid 1px gray;
+  margin-left: 1px }
+
+table.docinfo {
+  margin: 2em 4em }
+
+table.docutils {
+  margin-top: 0.5em ;
+  margin-bottom: 0.5em }
+
+table.footnote {
+  border-left: solid 1px black;
+  margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+  padding-left: 0.5em ;
+  padding-right: 0.5em ;
+  vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+  font-weight: bold ;
+  text-align: left ;
+  white-space: nowrap ;
+  padding-left: 0 }
+
+/* "booktabs" style (no vertical lines) */
+table.docutils.booktabs {
+  border: 0px;
+  border-top: 2px solid;
+  border-bottom: 2px solid;
+  border-collapse: collapse;
+}
+table.docutils.booktabs * {
+  border: 0px;
+}
+table.docutils.booktabs th {
+  border-bottom: thin solid;
+  text-align: left;
+}
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+  font-size: 100% }
+
+ul.auto-toc {
+  list-style-type: none }
+
+</style>
+</head>
+<body>
+<div class="document">
+
+
+<div class="section" id="revamp-of-automatic-virtualbox-testing">
+<h1>Revamp of Automatic VirtualBox Testing</h1>
+<div class="section" id="introduction">
+<h2>Introduction</h2>
+<p>This is the design document for a revamped automatic testing framework.
+The revamp aims at replacing the current tinderbox based testing by a new
+system that is written from scratch.</p>
+<p>The old system is not easy to work with and was never meant to be used for
+managing tests, after all it just a simple a build manager tailored for
+contiguous building.  Modifying the existing tinderbox system to do what
+we want would require fundamental changes that would render it useless as
+a build manager, it would therefore end up as a fork.  The amount of work
+required would probably be about the same as writing a new system from
+scratch.  Other considerations, such as the license of the tinderbox
+system (MPL) and language it is realized in (Perl), are also in favor of
+doing it from scratch.</p>
+<p>The language envisioned for the new automatic testing framework is Python.  This
+is for several reasons:</p>
+<blockquote>
+<ul class="simple">
+<li>The VirtualBox API has Python bindings.</li>
+<li>Python is used quite a bit inside Sun (dunno about Oracle).</li>
+<li>Works relatively well with Apache for the server side bits.</li>
+<li>It is more difficult to produce write-only code in Python (alias the
+we-don't-like-perl argument).</li>
+<li>You don't need to compile stuff.</li>
+</ul>
+</blockquote>
+<p>Note that the author of this document has no special training as a test
+engineer and may therefore be using the wrong terms here and there.  The
+primary focus is to express what we need to do in order to improve
+testing.</p>
+<p>This document is written in reStructuredText (rst) which just happens to
+be used by Python, the primary language for this revamp.  For more
+information on reStructuredText: <a class="reference external" href="http://docutils.sourceforge.net/rst.html">http://docutils.sourceforge.net/rst.html</a></p>
+</div>
+</div>
+<div class="section" id="definitions-glossary">
+<h1>Definitions / Glossary</h1>
+<dl class="docutils">
+<dt>sub-test driver</dt>
+<dd>A set of test cases that can be used by more than one test driver.  Could
+also be called a test unit, in the pascal sense of unit, if it wasn't so
+easily confused with 'unit test'.</dd>
+<dt>test</dt>
+<dd>This is somewhat ambiguous and this document try avoid using it where
+possible.  When used it normally refers to doing testing by executing one or
+more testcases.</dd>
+<dt>test case</dt>
+<dd>A set of inputs, test programs and expected results. It validates system
+requirements and generates a pass or failed status.  A basic unit of testing.
+Note that we use the term in a rather broad sense.</dd>
+<dt>test driver</dt>
+<dd>A program/script used to execute a test.  Also known as a test harness.
+Generally abbreviated 'td'.  It can have sub-test drivers.</dd>
+<dt>test manager</dt>
+<dd>Software managing the automatic testing.  This is a web application that runs
+on a dedicated server (tindertux).</dd>
+<dt>test set</dt>
+<dd>The output of testing activity.  Logs, results, ++.  Our usage of this should
+probably be renamed to 'test run'.</dd>
+<dt>test group</dt>
+<dd>A collection of related test cases.</dd>
+<dt>testbox</dt>
+<dd>A computer that does testing.</dd>
+<dt>testbox script</dt>
+<dd>Script executing orders from the test manager on a testbox.  Started
+automatically upon bootup.</dd>
+<dt>testing</dt>
+<dd>todo</dd>
+<dt>TODO: Check that we've got all this right and make them more exact</dt>
+<dd>where possible.</dd>
+</dl>
+<p>See also <a class="reference external" href="http://encyclopedia2.thefreedictionary.com/testing%20types">http://encyclopedia2.thefreedictionary.com/testing%20types</a>
+and <a class="reference external" href="http://www.aptest.com/glossary.html">http://www.aptest.com/glossary.html</a> .</p>
+</div>
+<div class="section" id="objectives">
+<h1>Objectives</h1>
+<blockquote>
+<ul class="simple">
+<li>A scalable test manager (>200 testboxes).</li>
+<li>Optimize the web user interface (WUI) for typical workflows and analysis.</li>
+<li>Efficient and flexibile test configuration.</li>
+<li>Import test result from other test systems (logo testing, VDI, ++).</li>
+<li>Easy to add lots of new testscripts.</li>
+<li>Run tests locally without a manager.</li>
+<li>Revamp a bit at the time.</li>
+</ul>
+</blockquote>
+</div>
+<div class="section" id="the-testbox-side">
+<h1>The Testbox Side</h1>
+<p>Each testbox has a unique name corresponding to its DNS zone entry.  When booted
+a testbox script is started automatically.  This script will query the test
+manager for orders and execute them.  The core order downloads and executes a
+test driver with parameters (configuration) from the server.  The test driver
+does all the necessary work for executing the test.  In a typical VirtualBox
+test this means picking a build, installing it, configuring VMs, running the
+test VMs, collecting the results, submitting them to the server, and finally
+cleaning up afterwards.</p>
+<p>The testbox environment which the test drivers are executed in will have a
+number of environment variables for determining location of the source images
+and other test data, scratch space, test set id, server URL, and so on and so
+forth.</p>
+<p>On startup, the testbox script will look for crash dumps and similar on
+systems where this is possible.  If any sign of a crash is found, it will
+put any dumps and reports in the upload directory and inform the test
+manager before reporting for duty.  In order to generate the proper file
+names and report the crash in the right test set as well as prevent
+reporting crashes unrelated to automatic testing, the testbox script will
+keep information (test set id, ++) in a separate scratch directory
+(${TESTBOX_PATH_SCRATCH}/../testbox) and make sure it is synced to the
+disk (both files and directories).</p>
+<p>After checking for crashes, the testbox script will clean up any previous test
+which might be around.  This involves first invoking the test script in cleanup
+mode and the wiping the scratch space.</p>
+<p>When reporting for duty the script will submit information about the host: OS
+name, OS version, OS bitness, CPU vendor, total number of cores, VT-x support,
+AMD-V support, amount of memory, amount of scratch space, and anything else that
+can be found useful for scheduling tests or filtering test configurations.</p>
+<div class="section" id="testbox-script-orders">
+<h2>Testbox Script Orders</h2>
+<p>The orders are kept in a queue on the server and the testbox script will fetch
+them one by one.  Orders that cannot be executed at the moment will be masked in
+the query from the testbox.</p>
+<dl class="docutils">
+<dt>Execute Test Driver</dt>
+<dd>Downloads and executes the a specified test driver with the given
+configuration (arguments).  Only one test driver can be executed at a time.
+The server can specify more than one ZIP file to be downloaded and unpacked
+before executing the test driver.  The testbox script may cache these zip
+files using http time stamping.</dd>
+<dt>Abort Test Driver</dt>
+<dd>Aborts the current test driver.  This will drop a hint to the driver and give
+it 60 seconds to shut down the normal way.  If that fails, the testbox script
+will kill the driver processes (SIGKILL or equivalent), invoke the
+testdriver in cleanup mode, and finally wipe the scratch area.  Should either
+of the last two steps fail in some way, the testbox will be rebooted.</dd>
+<dt>Idle</dt>
+<dd>Ask again in X seconds, where X is specified by the server.</dd>
+<dt>Reboot</dt>
+<dd>Reboot the testbox.  If a test driver is current running, an attempt at
+aborting it (Abort Test Driver) will be made first.</dd>
+<dt>Update</dt>
+<dd>Updates the testbox script.  The order includes a server relative path to the
+new testbox script.  This can only be executed when no test driver is
+currently being executed.</dd>
+</dl>
+</div>
+<div class="section" id="testbox-environment-variables">
+<h2>Testbox Environment: Variables</h2>
+<dl class="docutils">
+<dt>COMSPEC</dt>
+<dd>This will be set to C:WindowsSystem32cmd.exe on Windows.</dd>
+<dt>PATH</dt>
+<dd>This will contain the kBuild binary directory for the host platform.</dd>
+<dt>SHELL</dt>
+<dd>This will be set to point to kmk_ash(.exe) on all platforms.</dd>
+<dt>TESTBOX_NAME</dt>
+<dd>The testbox name.
+This is not required by the local reporter.</dd>
+<dt>TESTBOX_PATH_BUILDS</dt>
+<dd>The absolute path to where the build repository can be found.  This should be
+a read only mount when possible.</dd>
+<dt>TESTBOX_PATH_RESOURCES</dt>
+<dd>The absolute path to where static test resources like ISOs and VDIs can be
+found.  The test drivers knows the layout of this.  This should be a read only
+mount when possible.</dd>
+<dt>TESTBOX_PATH_SCRATCH</dt>
+<dd>The absolute path to the scratch space.  This is the current directory when
+starting the test driver.  It will be wiped automatically after executing the
+test.
+(Envisioned as ${TESTBOX_PATH_SCRIPTS}/../scratch and that
+${TESTBOX_PATH_SCRATCH}/ will be automatically wiped by the testbox script.)</dd>
+<dt>TESTBOX_PATH_SCRIPTS</dt>
+<dd>The absolute path to the test driver and the other files that was unzipped
+together with it.  This is also where the test-driver-abort file will be put.
+(Envisioned as ${TESTBOX_PATH_SCRATCH}/../driver, see above.)</dd>
+<dt>TESTBOX_PATH_UPLOAD</dt>
+<dd>The absolute path to the upload directory for the testbox.  This is for
+putting VOBs, PNGs, core dumps, crash dumps, and such on.  The files should be
+bzipped or zipped if they aren't compress already.  The names should contain
+the testbox and test set ID.</dd>
+<dt>TESTBOX_REPORTER</dt>
+<dd>The name of the test reporter back end.  If not present, it will default to
+the local reporter.</dd>
+<dt>TESTBOX_TEST_SET_ID</dt>
+<dd>The test set ID if we're running.
+This is not required by the local reporter.</dd>
+<dt>TESTBOX_MANAGER_URL</dt>
+<dd>The URL to the test manager.
+This is not required by the local reporter.</dd>
+<dt>TESTBOX_XYZ</dt>
+<dd>There will probably be some more of these.</dd>
+</dl>
+</div>
+<div class="section" id="testbox-environment-core-utilities">
+<h2>Testbox Environment: Core Utilities</h2>
+<p>The testbox will not provide the typical unix /bin and /usr/bin utilities.  In
+other words, cygwin will not be used on Windows!</p>
+<p>The testbox will provide the unixy utilties that ships with kBuild and possibly
+some additional ones from tools/<em>.</em>/bin in the VirtualBox tree (wget, unzip,
+zip, and so on).  The test drivers will avoid invoking any of these utilites
+directly and instead rely on generic utility methods in the test driver
+framework.  That way we can more easily reimplement the functionality of the
+core utilites and drop the dependency on them.  It also allows us to quickly
+work around platform specific oddities and bugs.</p>
+</div>
+<div class="section" id="test-drivers">
+<h2>Test Drivers</h2>
+<p>The test drivers are programs that will do the actual testing.  In addition to
+run under the testbox script, they can be executed in the VirtualBox development
+environment.  This is important for bug analysis and for simplifying local
+testing by the developers before commiting changes.  It also means the test
+drivers can be developed locally in the VirtualBox development environment.</p>
+<p>The main difference between executing a driver under the testbox script and
+running it manually is that there is no test manager in the latter case.  The
+test result reporter will not talk to the server, but report things to a local
+log file and/or standard out/err.  When invoked manually, all the necessary
+arguments will need to be specified by hand of course - it should be possible
+to extract them from a test set as well.</p>
+<p>For the early implementation stages, an implementation of the reporter interface
+that talks to the tinderbox base test manager will be needed.  This will be
+dropped later on when a new test manager is ready.</p>
+<p>As hinted at in other sections, there will be a common framework
+(libraries/packages/classes) for taking care of the tedious bits that every
+test driver needs to do.  Sharing code is essential to easing test driver
+development as well as reducing their complexity.  The framework will contain:</p>
+<blockquote>
+<ul>
+<li><p class="first">A generic way of submitting output.  This will be a generic interface with
+multiple implementation, the TESTBOX_REPORTER environment variable
+will decide which of them to use.  The interface will have very specific
+methods to allow the reporter to do a best possible job in reporting the
+results to the test manager.</p>
+</li>
+<li><dl class="first docutils">
+<dt>Helpers for typical tasks, like:</dt>
+<dd><ul class="first last simple">
+<li>Copying files.</li>
+<li>Deleting files, directory trees and scratch space.</li>
+<li>Unzipping files.</li>
+<li>Creating ISOs</li>
+<li>And such things.</li>
+</ul>
+</dd>
+</dl>
+</li>
+<li><p class="first">Helpers for installing and uninstalling VirtualBox.</p>
+</li>
+<li><p class="first">Helpers for defining VMs. (The VBox API where available.)</p>
+</li>
+<li><p class="first">Helpers for controlling VMs. (The VBox API where available.)</p>
+</li>
+</ul>
+</blockquote>
+<p>The VirtualBox bits will be separate from the more generic ones, simply because
+this is cleaner it will allow us to reuse the system for testing other products.</p>
+<p>The framework will be packaged in a zip file other than the test driver so we
+don't waste time and space downloading the same common code.</p>
+<p>The test driver will poll for the file
+${TESTBOX_PATH_SCRIPTS}/test-driver-abort and abort all testing when it sees it.</p>
+<p>The test driver can be invoked in three modes: execute, help and cleanup.  The
+default is execute mode, the help shows an configuration summary and the cleanup
+is for cleaning up after a reboot or aborted run.  The latter is done by the
+testbox script on startup and after abort - the driver is expected to clean up
+by itself after a normal run.</p>
+</div>
+</div>
+<div class="section" id="the-server-side">
+<h1>The Server Side</h1>
+<p>The server side will be implemented using a webserver (apache), a database
+(postgres) and cgi scripts (Python).  In addition a cron job (Python) running
+once a minute will generate static html for frequently used pages and maybe
+execute some other tasks for driving the testing forwards.  The order queries
+from the testbox script is the primary driving force in the system.  The total
+makes up the test manager.</p>
+<p>The test manager can be split up into three rough parts:</p>
+<blockquote>
+<ul class="simple">
+<li>Configuration (of tests, testgroups and testboxes).</li>
+<li>Execution     (of tests, collecting and organizing the output).</li>
+<li>Analysis      (of test output, mostly about presentation).</li>
+</ul>
+</blockquote>
+</div>
+<div class="section" id="test-manager-requirements">
+<h1>Test Manager: Requirements</h1>
+<p>List of requirements:</p>
+<blockquote>
+<ul>
+<li><p class="first">Two level testing - L1 quick smoke tests and L2 longer tests performed on
+builds passing L1.  (Klaus (IIRC) ment this could be realized using
+test dependency.)</p>
+</li>
+<li><p class="first">Black listing builds (by revision or similar) known to be bad.</p>
+</li>
+<li><p class="first">Distinguish between build types so we can do a portion of the testing with
+strict builds.</p>
+</li>
+<li><p class="first">Easy to re-configure build source for testing different branch or for
+testing a release candidate. (Directory based is fine.)</p>
+</li>
+<li><p class="first">Useful to be able to partition testboxes (run specific builds on some
+boxes, let an engineer have a few boxes for a while).</p>
+</li>
+<li><p class="first">Interation with ILOM/...: reset systems.</p>
+</li>
+<li><p class="first">Be able to suspend testing on selected testboxes when doing maintance
+(where automatically resuming testing on reboot is undesired) or similar
+activity.</p>
+</li>
+<li><p class="first">Abort testing on seleced testboxes.</p>
+</li>
+<li><p class="first">Scheduling of tests requiring more than one testbox.</p>
+</li>
+<li><p class="first">Scheduling of tests that cannot be executing concurrently on several
+machines because of some global resource like an iSCSI target.</p>
+</li>
+<li><p class="first">Jump the scheduling queue.  Scheduling of specified test the next time a
+testbox is available (optionally specifying which testbox to schedule it
+on).</p>
+</li>
+<li><dl class="first docutils">
+<dt>Configure tests with variable configuration to get better coverage. Two modes:</dt>
+<dd><ul class="first last simple">
+<li>TM generates the permutations based on one or more sets of test script arguments.</li>
+<li>Each configuration permuation is specified manually.</li>
+</ul>
+</dd>
+</dl>
+</li>
+<li><p class="first">Test specification needs to be flexible (select tests, disable test, test
+scheduling (run certain tests nightly), ... ).</p>
+</li>
+<li><p class="first">Test scheduling by hour+weekday and by priority.</p>
+</li>
+<li><p class="first">Test dependencies (test A depends on test B being successful).</p>
+</li>
+<li><p class="first">Historize all configuration data, in particular test configs (permutations
+included) and testboxes.</p>
+</li>
+<li><p class="first">Test sets has at a minimum a build reference, a testbox reference and a
+primary log associated with it.</p>
+</li>
+<li><dl class="first docutils">
+<dt>Test sets stores further result as a recursive collection of:</dt>
+<dd><ul class="first last simple">
+<li>hierachical subtest name (slash sep)</li>
+<li>test parameters / config</li>
+<li>bool fail/succ</li>
+<li>attributes (typed?)</li>
+<li>test time</li>
+<li>e.g. throughput</li>
+<li>subresults</li>
+<li>log</li>
+<li>screenshots, video,...</li>
+</ul>
+</dd>
+</dl>
+</li>
+<li><p class="first">The test sets database structure needs to designed such that data mining
+can be done in an efficient manner.</p>
+</li>
+<li><p class="first">Presentation/analysis: graphs!, categorize bugs, columns reorganizing
+grouped by test (hierarchical), overviews, result for last day.</p>
+</li>
+</ul>
+</blockquote>
+</div>
+<div class="section" id="test-manager-configuration">
+<h1>Test Manager: Configuration</h1>
+<div class="section" id="testboxes">
+<h2>Testboxes</h2>
+<p>Configuration of testboxes doesn't involve much work normally.  A testbox
+is added manually to the test manager by entering the DNS entry and/or IP
+address (the test manager resolves the missing one when necessary) as well as
+the system UUID (when obtainable - should be displayed by the testbox script
+installer).  Queries from unregistered testboxes will be declined as a kind of
+security measure, the incident should be logged in the webserver log if
+possible.   In later dealings with the client the System UUID will be the key
+identifier.  It's permittable for the IP address to change when the testbox
+isn't online, but not while testing (just imagine live migration tests and
+network tests).  Ideally, the testboxes should not change IP address.</p>
+<p>The testbox edit function must allow changing the name and system UUID.</p>
+<p>One further idea for the testbox configuration is indicating what they are
+capable of to filter out tests and test configurations that won't work on that
+testbox.  To examplify this take the ACP2 installation test.  If the test
+manager does not make sure the testbox have VT-x or AMD-v capabilities, the test
+is surely going to fail.  Other testbox capabilities would be total number of
+CPU cores, memory size, scratch space.  These testbox capabilities should be
+collected automatically on bootup by the testbox script together with OS name,
+OS version and OS bitness.</p>
+<p>A final thought, instead of outright declining all requests from new testboxes,
+we could record the unregistered testboxes with ip, UUID, name, os info and
+capabilities but mark them as inactive.  The test operator can then activate
+them on an activation page or edit the testbox or something.</p>
+</div>
+<div class="section" id="testcases">
+<h2>Testcases</h2>
+<p>We use the term testcase for a test.</p>
+</div>
+<div class="section" id="testgroups">
+<h2>Testgroups</h2>
+<p>Testcases are organized into groups.  A testcase can be member of more than one
+group.  The testcase gets a priority assigned to it in connection with the
+group membership.</p>
+<p>Testgroups are picked up by a testbox partition (aka scheduling group) and a
+prioirty, scheduling time restriction and dependencies on other test groups are
+associated with the assignment.  A testgroup can be used by several testbox
+partitions.</p>
+<p>(This used to be called 'testsuites' but was renamed to avoid confusion with
+the VBox Test Suite.)</p>
+</div>
+<div class="section" id="scheduling">
+<h2>Scheduling</h2>
+<p>The initial scheduler will be modelled after what we're doing already on in the
+tinderbox driven testing.  It's best described as a best effort continuous
+integration scheduler.  Meaning, it will always use the latest build suitable
+for a testcase.  It will schedule on a testcase level, using the combined
+priority of the testcase in the test group and the test group with the testbox
+partition, trying to spread the test case argument varation out accordingly
+over the whole scheduilng queue.  Which argument variation to start with, is
+not undefined (random would be best).</p>
+<p>Later, we may add other schedulers as needed.</p>
+</div>
+</div>
+<div class="section" id="the-test-manager-database">
+<h1>The Test Manager Database</h1>
+<p>First a general warning:</p>
+<blockquote>
+The guys working on this design are not database experts, web
+programming experts or similar, rather we are low level guys
+who's main job is x86 & AMD64 virtualization.  So, please don't
+be too hard on us. :-)</blockquote>
+<p>A logical table layout can be found in TestManagerDatabaseMap.png (created by
+Oracle SQL Data Modeler, stored in TestManagerDatabase.dmd).  The physical
+database layout can be found in TestManagerDatabaseInit.pgsql postgreSQL
+script.  The script is commented.</p>
+<div class="section" id="data-history">
+<h2>Data History</h2>
+<p>We need to somehow track configuration changes over time.  We also need to
+be able to query the exact configuration a test set was run with so we can
+understand and make better use of the results.</p>
+<p>There are different techniques for archiving this, one is tuple-versioning
+( <a class="reference external" href="http://en.wikipedia.org/wiki/Tuple-versioning">http://en.wikipedia.org/wiki/Tuple-versioning</a> ), another is log trigger
+( <a class="reference external" href="http://en.wikipedia.org/wiki/Log_trigger">http://en.wikipedia.org/wiki/Log_trigger</a> ).  We use tuple-versioning in
+this database, with 'effective' as start date field name and 'expire' as
+the end (exclusive).</p>
+<p>Tuple-versioning has a shortcomming wrt to keys, both primary and foreign.
+The primary key of a table employing tuple-versioning is really
+'id' + 'valid_period', where the latter is expressed using two fields
+([effective...expire-1]).  Only, how do you tell the database engine that
+it should not allow overlapping valid_periods?  Useful suggestions are
+welcomed. :-)</p>
+<p>Foreign key references to a table using tuple-versioning is running into
+trouble because of the time axsis and that to our knowledge foreign keys
+must reference exactly one row in the other table.  When time is involved
+what we wish to tell the database is that at any given time, there actually
+is exactly one row we want to match in the other table, only we've no idea
+how to express this.  So, many foreign keys are not expressed in SQL of this
+database.</p>
+<p>In some cases, we extend the tuple-versioning with a generation ID so that
+normal foreign key referencing can be used.  We only use this for recording
+(references in testset) and scheduling (schedqueue), as using it more widely
+would force updates (gen_id changes) to propagate into all related tables.</p>
+<dl class="docutils">
+<dt>See also:</dt>
+<dd><ul class="first last simple">
+<li><a class="reference external" href="http://en.wikipedia.org/wiki/Slowly_changing_dimension">http://en.wikipedia.org/wiki/Slowly_changing_dimension</a></li>
+<li><a class="reference external" href="http://en.wikipedia.org/wiki/Change_data_capture">http://en.wikipedia.org/wiki/Change_data_capture</a></li>
+<li><a class="reference external" href="http://en.wikipedia.org/wiki/Temporal_database">http://en.wikipedia.org/wiki/Temporal_database</a></li>
+</ul>
+</dd>
+</dl>
+</div>
+</div>
+<div class="section" id="test-manager-execution">
+<h1>Test Manager: Execution</h1>
+</div>
+<div class="section" id="test-manager-scenarios">
+<h1>Test Manager: Scenarios</h1>
+<div class="section" id="testbox-signs-on-at-bootup">
+<h2>#1 - Testbox Signs On (At Bootup)</h2>
+<dl class="docutils">
+<dt>The testbox supplies a number of inputs when reporting for duty:</dt>
+<dd><ul class="first last simple">
+<li>IP address.</li>
+<li>System UUID.</li>
+<li>OS name.</li>
+<li>OS version.</li>
+<li>CPU architecture.</li>
+<li>CPU count (= threads).</li>
+<li>CPU VT-x/AMD-V capability.</li>
+<li>CPU nested paging capability.</li>
+<li>Chipset I/O MMU capability.</li>
+<li>Memory size.</li>
+<li>Scratch size space (for testing).</li>
+<li>Testbox Script revision.</li>
+</ul>
+</dd>
+<dt>Results:</dt>
+<dd><ul class="first last simple">
+<li>ACK or NACK.</li>
+<li>Testbox ID and name on ACK.</li>
+</ul>
+</dd>
+</dl>
+<p>After receiving a ACK the testbox will ask for work to do, i.e. continue with
+scenario #2.  In the NACK case, it will sleep for 60 seconds and try again.</p>
+<p>Actions:</p>
+<ol class="arabic">
+<li><p class="first">Validate the testbox by looking the UUID up in the TestBoxes table.
+If not found, NACK the request.  SQL:</p>
+<pre class="literal-block">
+SELECT  idTestBox, sName
+FROM    TestBoxes
+WHERE   uuidSystem = :sUuid
+  AND   tsExpire = 'infinity'::timestamp;
+</pre>
+</li>
+<li><p class="first">Check if any of the information by testbox script has changed.  The two
+sizes are normalized first, memory size rounded to nearest 4 MB and scratch
+space is rounded down to nearest 64 MB.  If anything changed, insert a new
+row in the testbox table and historize the current one, i.e. set
+OLD.tsExpire to NEW.tsEffective and get a new value for NEW.idGenTestBox.</p>
+</li>
+<li><dl class="first docutils">
+<dt>Check with TestBoxStatuses:</dt>
+<dd><ol class="first last loweralpha simple">
+<li>If there is an row for the testbox in it already clean up change it
+to 'idle' state and deal with any open testset like described in
+scenario #9.</li>
+<li>If there is no row, add one with 'idle' state.</li>
+</ol>
+</dd>
+</dl>
+</li>
+<li><p class="first">ACK the request and pass back the idTestBox.</p>
+</li>
+</ol>
+<dl class="docutils">
+<dt>Note! Testbox.enabled is not checked here, that is only relevant when it asks</dt>
+<dd>for a new task (scenario #2 and #5).</dd>
+<dt>Note! Should the testbox script detect changes in any of the inputs, it should</dt>
+<dd>redo the sign in.</dd>
+<dt>Note! In scenario #8, the box will not sign on until it has done the reboot and</dt>
+<dd>cleanup reporting!</dd>
+</dl>
+</div>
+<div class="section" id="testbox-asks-for-work-to-do">
+<h2>#2 - Testbox Asks For Work To Do</h2>
+<dl class="docutils">
+<dt>Inputs:</dt>
+<dd><ul class="first last simple">
+<li>The testbox is supplying its IP indirectly.</li>
+<li>The testbox should supply its UUID and ID directly.</li>
+</ul>
+</dd>
+<dt>Results:</dt>
+<dd><ul class="first last simple">
+<li>IDLE, WAIT, EXEC, REBOOT, UPGRADE, UPGRADE-AND-REBOOT, SPECIAL or DEAD.</li>
+</ul>
+</dd>
+</dl>
+<p>Actions:</p>
+<ol class="arabic">
+<li><p class="first">Validate the ID and IP by selecting the currently valid testbox row:</p>
+<pre class="literal-block">
+SELECT  idGenTestBox, fEnabled, idSchedGroup, enmPendingCmd
+FROM    TestBoxes
+WHERE   id = :id
+  AND   uuidSystem = :sUuid
+  AND   ip = :ip
+  AND   tsExpire = 'infinity'::timestamp;
+</pre>
+<p>If NOT found return DEAD to the testbox client (it will go back to sign on
+mode and retry every 60 seconds or so - see scenario #1).</p>
+<dl class="docutils">
+<dt>Note! The WUI will do all necessary clean-ups when deleting a testbox, so</dt>
+<dd><p class="first last">contrary to the initial plans, we don't need to do anything more for
+the DEAD status.</p>
+</dd>
+</dl>
+</li>
+<li><p class="first">Check with TestBoxStatuses (maybe joined with query from 1).</p>
+<p>If enmState is 'gang-gathering': Goto scenario #6 on timeout or pending
+'abort' or 'reboot' command.  Otherwise, tell the testbox to WAIT [done].</p>
+<p>If enmState is 'gang-testing': The gang has been gathered and execution
+has been triggered.  Goto 5.</p>
+<p>If enmState is not 'idle', change it to 'idle'.</p>
+<p>If idTestSet is not NULL, CALL scenario #9 to it up.</p>
+<p>If there is a pending abort command, remove it.</p>
+<p>If there is a pending command and the old state doesn't indicate that it was
+being executed, GOTO scenario #3.</p>
+<dl class="docutils">
+<dt>Note! There should be a TestBoxStatuses row after executing scenario #1,</dt>
+<dd><p class="first last">however should none be found for some funky reason, returning DEAD
+will fix the problem (see above)</p>
+</dd>
+</dl>
+</li>
+<li><p class="first">If the testbox was marked as disabled, respond with an IDLE command to the
+testbox [done]. (Note! Must do this after TestBoxStatuses maintainance from
+point 2, or abandond tests won't be cleaned up after a testbox is disabled.)</p>
+</li>
+<li><p class="first">Consider testcases in the scheduling queue, pick the first one which the
+testbox can execute.  There is a concurrency issue here, so we put and
+exclusive lock on the SchedQueues table while considering its content.</p>
+<p>The cursor we open looks something like this:</p>
+<pre class="literal-block">
+SELECT  idItem, idGenTestCaseArgs,
+        idTestSetGangLeader, cMissingGangMembers
+FROM    SchedQueues
+WHERE   idSchedGroup = :idSchedGroup
+   AND  (   bmHourlySchedule is NULL
+         OR get_bit(bmHourlySchedule, :iHourOfWeek) = 1 ) --< does this work?
+ORDER BY ASC idItem;
+</pre>
+</li>
+</ol>
+<blockquote>
+<p>If there no rows are returned (this can happen because no testgroups are
+associated with this scheduling group, the scheduling group is disabled,
+or because the queue is being regenerated), we will tell the testbox to
+IDLE [done].</p>
+<dl class="docutils">
+<dt>For each returned row we will:</dt>
+<dd><ol class="first last loweralpha">
+<li><p class="first">Check testcase/group dependencies.</p>
+</li>
+<li><p class="first">Select a build (and default testsuite) satisfying the dependencies.</p>
+</li>
+<li><p class="first">Check the testcase requirements with that build in mind.</p>
+</li>
+<li><p class="first">If idTestSetGangLeader is NULL, try allocate the necessary resources.</p>
+</li>
+<li><p class="first">If it didn't check out, fetch the next row and redo from (a).</p>
+</li>
+<li><p class="first">Tentatively create a new test set row.</p>
+</li>
+<li><dl class="first docutils">
+<dt>If not gang scheduling:</dt>
+<dd><ul class="first last simple">
+<li>Next state: 'testing'</li>
+</ul>
+</dd>
+<dt>ElIf we're the last gang participant:</dt>
+<dd><ul class="first last simple">
+<li>Set idTestSetGangLeader to NULL.</li>
+<li>Set cMissingGangMembers to 0.</li>
+<li>Next state: 'gang-testing'</li>
+</ul>
+</dd>
+<dt>ElIf we're the first gang member:</dt>
+<dd><ul class="first last simple">
+<li>Set cMissingGangMembers to TestCaseArgs.cGangMembers - 1.</li>
+<li>Set idTestSetGangLeader to our idTestSet.</li>
+<li>Next state: 'gang-gathering'</li>
+</ul>
+</dd>
+<dt>Else:</dt>
+<dd><ul class="first last simple">
+<li>Decrement cMissingGangMembers.</li>
+<li>Next state: 'gang-gathering'</li>
+</ul>
+</dd>
+<dt>If we're not gang scheduling OR cMissingGangMembers is 0:</dt>
+<dd><p class="first last">Move the scheduler queue entry to the end of the queue.</p>
+</dd>
+</dl>
+<p>Update our TestBoxStatuses row with the new state and test set.
+COMMIT;</p>
+</li>
+</ol>
+</dd>
+</dl>
+</blockquote>
+<ol class="arabic" start="5">
+<li><dl class="first docutils">
+<dt>If state is 'testing' or 'gang-testing':</dt>
+<dd><p class="first">EXEC reponse.</p>
+<p class="last">The EXEC response for a gang scheduled testcase includes a number of
+extra arguments so that the script knows the position of the testbox
+it is running on and of the other members.  This means the that the
+TestSet.iGangMemberNo is passed using --gang-member-no and the IP
+addresses of the all gang members using --gang-ipv4-<memb-no> <ip>.</p>
+</dd>
+<dt>Else (state is 'gang-gathering'):</dt>
+<dd><p class="first last">WAIT</p>
+</dd>
+</dl>
+</li>
+</ol>
+</div>
+<div class="section" id="pending-command-when-testbox-asks-for-work">
+<h2>#3 - Pending Command When Testbox Asks For Work</h2>
+<p>This is a subfunction of scenario #2 and #5.</p>
+<p>As seen in scenario #2, the testbox will send 'abort' commands to /dev/null
+when it finds one when not executing a test.  This includes when it reports
+that the test has completed (no need to abort a completed test, wasting lot
+of effort when standing at the finish line).</p>
+<p>The other commands, though, are passed back to the testbox.  The testbox
+script will respond with an ACK or NACK as it sees fit.  If NACKed, the
+pending command will be removed (pending_cmd set to none) and that's it.
+If ACKed, the state of the testbox will change to that appropriate for the
+command and the pending_cmd set to none.  Should the testbox script fail to
+respond, the command will be repeated the next time it asks for work.</p>
+</div>
+<div class="section" id="testbox-uploads-results-during-test">
+<h2>#4 - Testbox Uploads Results During Test</h2>
+<p>TODO</p>
+</div>
+<div class="section" id="testbox-completes-test-and-asks-for-work">
+<h2>#5 - Testbox Completes Test and Asks For Work</h2>
+<p>This is very similar to scenario #2</p>
+<p>TODO</p>
+</div>
+<div class="section" id="gang-gathering-timeout">
+<h2>#6 - Gang Gathering Timeout</h2>
+<p>This is a subfunction of scenario #2.</p>
+<p>When gathering a gang of testboxes for a testcase, we do not want to wait
+forever and have testboxes doing nothing for hours while waiting for partners.
+So, the gathering has a reasonable timeout (imagine something like 20-30 mins).</p>
+<p>Also, we need some way of dealing with 'abort' and 'reboot' commands being
+issued while waiting.  The easy way out is pretent it's a time out.</p>
+<p>When changing the status to 'gang-timeout' we have to be careful.  First of all,
+we need to exclusively lock the SchedQueues and TestBoxStatuses (in that order)
+and re-query our status.  If it changed redo the checks in scenario #2 point 2.</p>
+<p>If we still want to timeout/abort, change the state from 'gang-gathering' to
+'gang-gathering-timedout' on all the gang members that has gathered so far.
+Then reset the scheduling queue record and move it to the end of the queue.</p>
+<p>When acting on 'gang-timeout' the TM will fail the testset in a manner similar
+to scenario #9.  No need to repeat that.</p>
+</div>
+<div class="section" id="gang-cleanup">
+<h2>#7 - Gang Cleanup</h2>
+<p>When a testbox completes a gang scheduled test, we will have to serialize
+resource cleanup (both globally and on testboxes) as they stop.  More details
+can be found in the documentation of 'gang-cleanup'.</p>
+<p>So, the transition from 'gang-testing' is always to 'gang-cleanup'.  When we
+can safely leave 'gang-cleanup' is decided by the query:</p>
+<pre class="literal-block">
+SELECT  COUNT(*)
+FROM    TestBoxStatuses,
+        TestSets
+WHERE   TestSets.idTestSetGangLeader = :idTestSetGangLeader
+    AND TestSets.idTestBox = TestBoxStatuses.idTestBox
+    AND TestBoxStatuses.enmState = 'gang-running'::TestBoxState_T;
+</pre>
+<p>As long as there are testboxes still running, we stay in the 'gang-cleanup'
+state.  Once there are none, we continue closing the testset and such.</p>
+</div>
+<div class="section" id="testbox-reports-a-crash-during-test-execution">
+<h2>#8 - Testbox Reports A Crash During Test Execution</h2>
+<p>TODO</p>
+</div>
+<div class="section" id="cleaning-up-abandond-testcase">
+<h2>#9 - Cleaning Up Abandond Testcase</h2>
+<p>This is a subfunction of scenario #1 and #2.  The actions taken are the same in
+both situations.  The precondition for taking this path is that the row in the
+testboxstatus table is refering to a testset (i.e. testset_id is not NULL).</p>
+<p>Actions:</p>
+<ol class="arabic">
+<li><dl class="first docutils">
+<dt>If the testset is incomplete, we need to completed:</dt>
+<dd><ol class="first last loweralpha simple">
+<li>Add a message to the root TestResults row, creating one if necesary,
+that explains that the test was abandond.  This is done
+by inserting/finding the string into/in TestResultStrTab and adding
+a row to TestResultMsgs with idStrMsg set to that string id and
+enmLevel set to 'failure'.</li>
+<li>Mark the testset as failed.</li>
+</ol>
+</dd>
+</dl>
+</li>
+<li><p class="first">Free any global resources referenced by the test set.  This is done by
+deleting all rows in GlobalResourceStatuses matching the testbox id.</p>
+</li>
+<li><p class="first">Set the idTestSet to NULL in the TestBoxStatuses row.</p>
+</li>
+</ol>
+</div>
+<div class="section" id="cleaning-up-a-disabled-dead-testbox">
+<h2>#10 - Cleaning Up a Disabled/Dead TestBox</h2>
+<p>The UI needs to be able to clean up the remains of a testbox which for some
+reason is out of action.  Normal cleaning up of abandond testcases requires
+that the testbox signs on or asks for work, but if the testbox is dead or
+in some way indisposed, it won't be doing any of that.  So, the testbox
+sheriff needs to have a way of cleaning up after it.</p>
+<p>It's basically a manual scenario #9 but with some safe guards, like checking
+that the box hasn't been active for the last 1-2 mins (max idle/wait time * 2).</p>
+<dl class="docutils">
+<dt>Note! When disabling a box that still executing the testbox script, this</dt>
+<dd>cleanup isn't necessary as it will happen automatically.   Also, it's
+probably desirable that the testbox finishes what ever it is doing first
+before going dormant.</dd>
+</dl>
+</div>
+</div>
+<div class="section" id="test-manager-analysis">
+<h1>Test Manager: Analysis</h1>
+<p>One of the testbox sheriff's tasks is to try figure out the reason why something
+failed.  The test manager will provide facilities for doing so from very early
+in it's implementation.</p>
+<p>We need to work out some useful status reports for the early implementation.
+Later there will be more advanced analysis tools, where for instance we can
+create graphs from selected test result values or test execution times.</p>
+</div>
+<div class="section" id="implementation-plan">
+<h1>Implementation Plan</h1>
+<p>This has changed for various reasons.  The current plan is to implement the
+infrastructure (TM & testbox script) first and do a small deployment with the
+2-5 test drivers in the Testsuite as basis.  Once the bugs are worked out, we
+will convert the rest of the tests and start adding new ones.</p>
+<p>We just need to finally get this done, no point in doing it piecemeal by now!</p>
+<div class="section" id="test-manager-implementation-sub-tasks">
+<h2>Test Manager Implementation Sub-Tasks</h2>
+<p>The implementation of the test manager and adjusting/completing of the testbox
+script and the test drivers are tasks which can be done by more than one
+person.  Splitting up the TM implementation into smaller tasks should allow
+parallel development of different tasks and get us working code sooner.</p>
+</div>
+<div class="section" id="milestone-1">
+<h2>Milestone #1</h2>
+<p>The goal is to getting the fundamental testmanager engine implemented, debugged
+and working.  With the exception of testboxes, the configuration will be done
+via SQL inserts.</p>
+<p>Tasks in somewhat prioritized order:</p>
+<blockquote>
+<ul class="simple">
+<li>Kick off test manager.  It will live in testmanager/.  Salvage as much as
+possible from att/testserv.  Create basic source and file layout.</li>
+<li>Adjust the testbox script, part one.  There currently is a testbox script
+in att/testbox, this shall be moved up into testboxscript/.  The script
+needs to be adjusted according to the specification layed down earlier
+in this document.  Installers or installation scripts for all relevant
+host OSes are required.  Left for part two is result reporting beyond the
+primary log.  This task must be 100% feature complete, on all host OSes,
+there is no room for FIXME, XXX or @todo here.</li>
+<li>Implement the schedule queue generator.</li>
+<li>Implement the testbox dispatcher in TM.  Support all the testbox script
+responses implemented above, including upgrading the testbox script.</li>
+<li>Implement simple testbox management page.</li>
+<li>Implement some basic activity and result reports so that we can see
+what's going on.</li>
+<li>Create a testmanager / testbox test setup.  This lives in selftest/.<ol class="arabic">
+<li>Set up something that runs, no fiddly bits. Debug till it works.</li>
+<li>Create a setup that tests testgroup dependencies, i.e. real tests
+depending on smoke tests.</li>
+<li>Create a setup that exercises testcase dependency.</li>
+<li>Create a setup that exercises global resource allocation.</li>
+<li>Create a setup that exercises gang scheduling.</li>
+</ol>
+</li>
+<li>Check that all features work.</li>
+</ul>
+</blockquote>
+</div>
+<div class="section" id="milestone-2">
+<h2>Milestone #2</h2>
+<p>The goal is getting to VBox testing.</p>
+<p>Tasks in somewhat prioritized order:</p>
+<blockquote>
+<ul class="simple">
+<li>Implement full result reporting in the testbox script and testbox driver.
+A testbox script specific reporter needs to be implemented for the
+testdriver framework.  The testbox script needs to forward the results to
+the test manager, or alternatively the testdriver report can talk
+directly to the TM.</li>
+<li>Implement the test manager side of the test result reporting.</li>
+<li>Extend the selftest with some setup that report all kinds of test
+results.</li>
+<li>Implement script/whatever feeding builds to the test manager from the
+tinderboxes.</li>
+<li>The toplevel test driver is a VBox thing that must be derived from the
+base TestDriver class or maybe the VBox one.  It should move from
+toptestdriver to testdriver and be renamed to vboxtltd or smth.</li>
+<li>Create a vbox testdriver that boots the t-xppro VM once and that's it.</li>
+<li>Create a selftest setup which tests booting t-xppro taking builds from
+the tinderbox.</li>
+</ul>
+</blockquote>
+</div>
+<div class="section" id="milestone-3">
+<h2>Milestone #3</h2>
+<p>The goal for this milestone is configuration and converting current testscases,
+the result will be the a minimal test deployment (4-5 new testboxes).</p>
+<p>Tasks in somewhat prioritized order:</p>
+<blockquote>
+<ul class="simple">
+<li>Implement testcase configuration.</li>
+<li>Implement testgroup configuration.</li>
+<li>Implement build source configuration.</li>
+<li>Implement scheduling group configuration.</li>
+<li>Implement global resource configuration.</li>
+<li>Re-visit the testbox configuration.</li>
+<li>Black listing of builds.</li>
+<li>Implement simple failure analysis and reporting.</li>
+<li>Implement the initial smoke tests modelled on the current smoke tests.</li>
+<li>Implement installation tests for Windows guests.</li>
+<li>Implement installation tests for Linux guests.</li>
+<li>Implement installation tests for Solaris guest.</li>
+<li>Implement installation tests for OS/2 guest.</li>
+<li>Set up a small test deployment.</li>
+</ul>
+</blockquote>
+</div>
+<div class="section" id="further-work">
+<h2>Further work</h2>
+<p>After milestone #3 has been reached and issues found by the other team members
+have been addressed, we will probably go for full deployment.</p>
+<p>Beyond this point we will need to improve reporting and analysis.  There may be
+configuration aspects needing reporting as well.</p>
+<p>Once deployed, a golden rule will be that all new features shall have test
+coverage.  Preferrably, implemented by someone else and prior to the feature
+implementation.</p>
+</div>
+</div>
+<div class="section" id="discussion-logs">
+<h1>Discussion Logs</h1>
+<div class="section" id="various-discussions-with-michal-and-or-klaus">
+<h2>2009-07-21,22,23 Various Discussions with Michal and/or Klaus</h2>
+<ul class="simple">
+<li>Scheduling of tests requiring more than one testbox.</li>
+<li>Scheduling of tests that cannot be executing concurrently on several machines
+because of some global resource like an iSCSI target.</li>
+<li>Manually create the test config permutations instead of having the test
+manager create all possible ones and wasting time.</li>
+<li>Distinguish between built types so we can run smoke tests on strick builds as
+well as release ones.</li>
+</ul>
+</div>
+<div class="section" id="brief-discussion-with-michal">
+<h2>2009-07-20 Brief Discussion with Michal</h2>
+<ul class="simple">
+<li>Installer for the testbox script to make bringing up a new testbox even
+smoother.</li>
+</ul>
+</div>
+<div class="section" id="raw-input">
+<h2>2009-07-16 Raw Input</h2>
+<ul>
+<li><dl class="first docutils">
+<dt>test set. recursive collection of:</dt>
+<dd><ul class="first last simple">
+<li>hierachical subtest name (slash sep)</li>
+<li>test parameters / config</li>
+<li>bool fail/succ</li>
+<li>attributes (typed?)</li>
+<li>test time</li>
+<li>e.g. throughput</li>
+<li>subresults</li>
+<li>log</li>
+<li>screenshots,....</li>
+</ul>
+</dd>
+</dl>
+</li>
+<li><p class="first">client package (zip) dl from server (maybe client caching)</p>
+</li>
+<li><dl class="first docutils">
+<dt>thoughts on bits to do at once.</dt>
+<dd><ul class="first last simple">
+<li>We <em>really</em> need the basic bits ASAP.</li>
+<li>client -> support for test driver</li>
+<li>server -> controls configs</li>
+<li>cleanup on both sides</li>
+</ul>
+</dd>
+</dl>
+</li>
+</ul>
+</div>
+<div class="section" id="id1">
+<h2>2009-07-15 Raw Input</h2>
+<ul class="simple">
+<li>testing should start automatically</li>
+<li>switching to branch too tedious</li>
+<li>useful to be able to partition testboxes (run specific builds on some boxes, let an engineer have a few boxes for a while).</li>
+<li>test specification needs to be more flexible (select tests, disable test, test scheduling (run certain tests nightly), ... )</li>
+<li>testcase dependencies (blacklisting builds, run smoketests on box A before long tests on box B, ...)</li>
+<li>more testing flexibility, more test than just install/moke. For instance unit tests, benchmarks, ...</li>
+<li>presentation/analysis: graphs!, categorize bugs, columns reorganizing grouped by test (hierarchical), overviews, result for last day.</li>
+<li>testcase specificion, variables (e.g. I/O-APIC, SMP, HWVIRT, SATA...) as sub-tests</li>
+<li>interation with ILOM/...: reset systems</li>
+<li>Changes needs LDAP authentication</li>
+<li>historize all configuration  w/ name</li>
+<li>ability to run testcase locally (provided the VDI/ISO/whatever extra requirements can be met).</li>
+</ul>
+<hr class="docutils" />
+<table class="docutils footnote" frame="void" id="id2" rules="none">
+<colgroup><col class="label" /><col /></colgroup>
+<tbody valign="top">
+<tr><td class="label">[1]</td><td>no such footnote</td></tr>
+</tbody>
+</table>
+<hr class="docutils" />
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field"><th class="field-name">Status:</th><td class="field-body">$Id: AutomaticTestingRevamp.html $</td>
+</tr>
+<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Copyright (C) 2010-2014 Oracle Corporation.</td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
+</div>
+</body>
+</html>
diff --git a/src/VBox/ValidationKit/docs/AutomaticTestingRevamp.txt b/src/VBox/ValidationKit/docs/AutomaticTestingRevamp.txt
new file mode 100644
index 0000000..3e6e824
--- /dev/null
+++ b/src/VBox/ValidationKit/docs/AutomaticTestingRevamp.txt
@@ -0,0 +1,1062 @@
+
+Revamp of Automatic VirtualBox Testing
+======================================
+
+
+Introduction
+------------
+
+This is the design document for a revamped automatic testing framework.
+The revamp aims at replacing the current tinderbox based testing by a new
+system that is written from scratch.
+
+The old system is not easy to work with and was never meant to be used for
+managing tests, after all it just a simple a build manager tailored for
+contiguous building.  Modifying the existing tinderbox system to do what
+we want would require fundamental changes that would render it useless as
+a build manager, it would therefore end up as a fork.  The amount of work
+required would probably be about the same as writing a new system from
+scratch.  Other considerations, such as the license of the tinderbox
+system (MPL) and language it is realized in (Perl), are also in favor of
+doing it from scratch.
+
+The language envisioned for the new automatic testing framework is Python.  This
+is for several reasons:
+
+  - The VirtualBox API has Python bindings.
+  - Python is used quite a bit inside Sun (dunno about Oracle).
+  - Works relatively well with Apache for the server side bits.
+  - It is more difficult to produce write-only code in Python (alias the
+    we-don't-like-perl argument).
+  - You don't need to compile stuff.
+
+Note that the author of this document has no special training as a test
+engineer and may therefore be using the wrong terms here and there.  The
+primary focus is to express what we need to do in order to improve
+testing.
+
+This document is written in reStructuredText (rst) which just happens to
+be used by Python, the primary language for this revamp.  For more
+information on reStructuredText: http://docutils.sourceforge.net/rst.html
+
+
+Definitions / Glossary
+======================
+
+sub-test driver
+  A set of test cases that can be used by more than one test driver.  Could
+  also be called a test unit, in the pascal sense of unit, if it wasn't so
+  easily confused with 'unit test'.
+
+test
+  This is somewhat ambiguous and this document try avoid using it where
+  possible.  When used it normally refers to doing testing by executing one or
+  more testcases.
+
+test case
+  A set of inputs, test programs and expected results. It validates system
+  requirements and generates a pass or failed status.  A basic unit of testing.
+  Note that we use the term in a rather broad sense.
+
+test driver
+  A program/script used to execute a test.  Also known as a test harness.
+  Generally abbreviated 'td'.  It can have sub-test drivers.
+
+test manager
+  Software managing the automatic testing.  This is a web application that runs
+  on a dedicated server (tindertux).
+
+test set
+  The output of testing activity.  Logs, results, ++.  Our usage of this should
+  probably be renamed to 'test run'.
+
+test group
+  A collection of related test cases.
+
+testbox
+  A computer that does testing.
+
+testbox script
+  Script executing orders from the test manager on a testbox.  Started
+  automatically upon bootup.
+
+testing
+  todo
+
+TODO: Check that we've got all this right and make them more exact
+      where possible.
+
+See also http://encyclopedia2.thefreedictionary.com/testing%20types
+and http://www.aptest.com/glossary.html .
+
+
+
+Objectives
+==========
+
+ - A scalable test manager (>200 testboxes).
+ - Optimize the web user interface (WUI) for typical workflows and analysis.
+ - Efficient and flexibile test configuration.
+ - Import test result from other test systems (logo testing, VDI, ++).
+ - Easy to add lots of new testscripts.
+ - Run tests locally without a manager.
+ - Revamp a bit at the time.
+
+
+
+The Testbox Side
+================
+
+Each testbox has a unique name corresponding to its DNS zone entry.  When booted
+a testbox script is started automatically.  This script will query the test
+manager for orders and execute them.  The core order downloads and executes a
+test driver with parameters (configuration) from the server.  The test driver
+does all the necessary work for executing the test.  In a typical VirtualBox
+test this means picking a build, installing it, configuring VMs, running the
+test VMs, collecting the results, submitting them to the server, and finally
+cleaning up afterwards.
+
+The testbox environment which the test drivers are executed in will have a
+number of environment variables for determining location of the source images
+and other test data, scratch space, test set id, server URL, and so on and so
+forth.
+
+On startup, the testbox script will look for crash dumps and similar on
+systems where this is possible.  If any sign of a crash is found, it will
+put any dumps and reports in the upload directory and inform the test
+manager before reporting for duty.  In order to generate the proper file
+names and report the crash in the right test set as well as prevent
+reporting crashes unrelated to automatic testing, the testbox script will
+keep information (test set id, ++) in a separate scratch directory
+(${TESTBOX_PATH_SCRATCH}/../testbox) and make sure it is synced to the
+disk (both files and directories).
+
+After checking for crashes, the testbox script will clean up any previous test
+which might be around.  This involves first invoking the test script in cleanup
+mode and the wiping the scratch space.
+
+When reporting for duty the script will submit information about the host: OS
+name, OS version, OS bitness, CPU vendor, total number of cores, VT-x support,
+AMD-V support, amount of memory, amount of scratch space, and anything else that
+can be found useful for scheduling tests or filtering test configurations.
+
+
+
+Testbox Script Orders
+---------------------
+
+The orders are kept in a queue on the server and the testbox script will fetch
+them one by one.  Orders that cannot be executed at the moment will be masked in
+the query from the testbox.
+
+Execute Test Driver
+  Downloads and executes the a specified test driver with the given
+  configuration (arguments).  Only one test driver can be executed at a time.
+  The server can specify more than one ZIP file to be downloaded and unpacked
+  before executing the test driver.  The testbox script may cache these zip
+  files using http time stamping.
+
+Abort Test Driver
+  Aborts the current test driver.  This will drop a hint to the driver and give
+  it 60 seconds to shut down the normal way.  If that fails, the testbox script
+  will kill the driver processes (SIGKILL or equivalent), invoke the
+  testdriver in cleanup mode, and finally wipe the scratch area.  Should either
+  of the last two steps fail in some way, the testbox will be rebooted.
+
+Idle
+  Ask again in X seconds, where X is specified by the server.
+
+Reboot
+  Reboot the testbox.  If a test driver is current running, an attempt at
+  aborting it (Abort Test Driver) will be made first.
+
+Update
+  Updates the testbox script.  The order includes a server relative path to the
+  new testbox script.  This can only be executed when no test driver is
+  currently being executed.
+
+
+Testbox Environment: Variables
+------------------------------
+
+COMSPEC
+  This will be set to C:\Windows\System32\cmd.exe on Windows.
+
+PATH
+  This will contain the kBuild binary directory for the host platform.
+
+SHELL
+  This will be set to point to kmk_ash(.exe) on all platforms.
+
+TESTBOX_NAME
+  The testbox name.
+  This is not required by the local reporter.
+
+TESTBOX_PATH_BUILDS
+  The absolute path to where the build repository can be found.  This should be
+  a read only mount when possible.
+
+TESTBOX_PATH_RESOURCES
+  The absolute path to where static test resources like ISOs and VDIs can be
+  found.  The test drivers knows the layout of this.  This should be a read only
+  mount when possible.
+
+TESTBOX_PATH_SCRATCH
+  The absolute path to the scratch space.  This is the current directory when
+  starting the test driver.  It will be wiped automatically after executing the
+  test.
+  (Envisioned as ${TESTBOX_PATH_SCRIPTS}/../scratch and that
+  ${TESTBOX_PATH_SCRATCH}/ will be automatically wiped by the testbox script.)
+
+TESTBOX_PATH_SCRIPTS
+  The absolute path to the test driver and the other files that was unzipped
+  together with it.  This is also where the test-driver-abort file will be put.
+  (Envisioned as ${TESTBOX_PATH_SCRATCH}/../driver, see above.)
+
+TESTBOX_PATH_UPLOAD
+  The absolute path to the upload directory for the testbox.  This is for
+  putting VOBs, PNGs, core dumps, crash dumps, and such on.  The files should be
+  bzipped or zipped if they aren't compress already.  The names should contain
+  the testbox and test set ID.
+
+TESTBOX_REPORTER
+  The name of the test reporter back end.  If not present, it will default to
+  the local reporter.
+
+TESTBOX_TEST_SET_ID
+  The test set ID if we're running.
+  This is not required by the local reporter.
+
+TESTBOX_MANAGER_URL
+  The URL to the test manager.
+  This is not required by the local reporter.
+
+TESTBOX_XYZ
+  There will probably be some more of these.
+
+
+Testbox Environment: Core Utilities
+-----------------------------------
+
+The testbox will not provide the typical unix /bin and /usr/bin utilities.  In
+other words, cygwin will not be used on Windows!
+
+The testbox will provide the unixy utilties that ships with kBuild and possibly
+some additional ones from tools/*.*/bin in the VirtualBox tree (wget, unzip,
+zip, and so on).  The test drivers will avoid invoking any of these utilites
+directly and instead rely on generic utility methods in the test driver
+framework.  That way we can more easily reimplement the functionality of the
+core utilites and drop the dependency on them.  It also allows us to quickly
+work around platform specific oddities and bugs.
+
+
+Test Drivers
+------------
+
+The test drivers are programs that will do the actual testing.  In addition to
+run under the testbox script, they can be executed in the VirtualBox development
+environment.  This is important for bug analysis and for simplifying local
+testing by the developers before commiting changes.  It also means the test
+drivers can be developed locally in the VirtualBox development environment.
+
+The main difference between executing a driver under the testbox script and
+running it manually is that there is no test manager in the latter case.  The
+test result reporter will not talk to the server, but report things to a local
+log file and/or standard out/err.  When invoked manually, all the necessary
+arguments will need to be specified by hand of course - it should be possible
+to extract them from a test set as well.
+
+For the early implementation stages, an implementation of the reporter interface
+that talks to the tinderbox base test manager will be needed.  This will be
+dropped later on when a new test manager is ready.
+
+As hinted at in other sections, there will be a common framework
+(libraries/packages/classes) for taking care of the tedious bits that every
+test driver needs to do.  Sharing code is essential to easing test driver
+development as well as reducing their complexity.  The framework will contain:
+
+    - A generic way of submitting output.  This will be a generic interface with
+      multiple implementation, the TESTBOX_REPORTER environment variable
+      will decide which of them to use.  The interface will have very specific
+      methods to allow the reporter to do a best possible job in reporting the
+      results to the test manager.
+
+    - Helpers for typical tasks, like:
+        - Copying files.
+        - Deleting files, directory trees and scratch space.
+        - Unzipping files.
+        - Creating ISOs
+        - And such things.
+
+    - Helpers for installing and uninstalling VirtualBox.
+
+    - Helpers for defining VMs. (The VBox API where available.)
+
+    - Helpers for controlling VMs. (The VBox API where available.)
+
+The VirtualBox bits will be separate from the more generic ones, simply because
+this is cleaner it will allow us to reuse the system for testing other products.
+
+The framework will be packaged in a zip file other than the test driver so we
+don't waste time and space downloading the same common code.
+
+The test driver will poll for the file
+${TESTBOX_PATH_SCRIPTS}/test-driver-abort and abort all testing when it sees it.
+
+The test driver can be invoked in three modes: execute, help and cleanup.  The
+default is execute mode, the help shows an configuration summary and the cleanup
+is for cleaning up after a reboot or aborted run.  The latter is done by the
+testbox script on startup and after abort - the driver is expected to clean up
+by itself after a normal run.
+
+
+
+The Server Side
+===============
+
+The server side will be implemented using a webserver (apache), a database
+(postgres) and cgi scripts (Python).  In addition a cron job (Python) running
+once a minute will generate static html for frequently used pages and maybe
+execute some other tasks for driving the testing forwards.  The order queries
+from the testbox script is the primary driving force in the system.  The total
+makes up the test manager.
+
+The test manager can be split up into three rough parts:
+
+  - Configuration (of tests, testgroups and testboxes).
+  - Execution     (of tests, collecting and organizing the output).
+  - Analysis      (of test output, mostly about presentation).
+
+
+Test Manager: Requirements
+==========================
+
+List of requirements:
+
+  - Two level testing - L1 quick smoke tests and L2 longer tests performed on
+    builds passing L1.  (Klaus (IIRC) ment this could be realized using
+    test dependency.)
+  - Black listing builds (by revision or similar) known to be bad.
+  - Distinguish between build types so we can do a portion of the testing with
+    strict builds.
+  - Easy to re-configure build source for testing different branch or for
+    testing a release candidate. (Directory based is fine.)
+  - Useful to be able to partition testboxes (run specific builds on some
+    boxes, let an engineer have a few boxes for a while).
+  - Interation with ILOM/...: reset systems.
+  - Be able to suspend testing on selected testboxes when doing maintance
+    (where automatically resuming testing on reboot is undesired) or similar
+    activity.
+  - Abort testing on seleced testboxes.
+  - Scheduling of tests requiring more than one testbox.
+  - Scheduling of tests that cannot be executing concurrently on several
+    machines because of some global resource like an iSCSI target.
+  - Jump the scheduling queue.  Scheduling of specified test the next time a
+    testbox is available (optionally specifying which testbox to schedule it
+    on).
+  - Configure tests with variable configuration to get better coverage. Two modes:
+      - TM generates the permutations based on one or more sets of test script arguments.
+      - Each configuration permuation is specified manually.
+  - Test specification needs to be flexible (select tests, disable test, test
+    scheduling (run certain tests nightly), ... ).
+  - Test scheduling by hour+weekday and by priority.
+  - Test dependencies (test A depends on test B being successful).
+  - Historize all configuration data, in particular test configs (permutations
+    included) and testboxes.
+  - Test sets has at a minimum a build reference, a testbox reference and a
+    primary log associated with it.
+  - Test sets stores further result as a recursive collection of:
+      - hierachical subtest name (slash sep)
+      - test parameters / config
+      - bool fail/succ
+      - attributes (typed?)
+      - test time
+      - e.g. throughput
+      - subresults
+      - log
+      - screenshots, video,...
+  - The test sets database structure needs to designed such that data mining
+    can be done in an efficient manner.
+  - Presentation/analysis: graphs!, categorize bugs, columns reorganizing
+    grouped by test (hierarchical), overviews, result for last day.
+
+
+
+Test Manager: Configuration
+===========================
+
+
+Testboxes
+---------
+
+Configuration of testboxes doesn't involve much work normally.  A testbox
+is added manually to the test manager by entering the DNS entry and/or IP
+address (the test manager resolves the missing one when necessary) as well as
+the system UUID (when obtainable - should be displayed by the testbox script
+installer).  Queries from unregistered testboxes will be declined as a kind of
+security measure, the incident should be logged in the webserver log if
+possible.   In later dealings with the client the System UUID will be the key 
+identifier.  It's permittable for the IP address to change when the testbox
+isn't online, but not while testing (just imagine live migration tests and 
+network tests).  Ideally, the testboxes should not change IP address.
+
+The testbox edit function must allow changing the name and system UUID.
+
+One further idea for the testbox configuration is indicating what they are
+capable of to filter out tests and test configurations that won't work on that
+testbox.  To examplify this take the ACP2 installation test.  If the test
+manager does not make sure the testbox have VT-x or AMD-v capabilities, the test
+is surely going to fail.  Other testbox capabilities would be total number of
+CPU cores, memory size, scratch space.  These testbox capabilities should be
+collected automatically on bootup by the testbox script together with OS name,
+OS version and OS bitness.
+
+A final thought, instead of outright declining all requests from new testboxes,
+we could record the unregistered testboxes with ip, UUID, name, os info and
+capabilities but mark them as inactive.  The test operator can then activate
+them on an activation page or edit the testbox or something.
+
+
+Testcases
+---------
+
+We use the term testcase for a test.
+
+
+Testgroups
+----------
+
+Testcases are organized into groups.  A testcase can be member of more than one
+group.  The testcase gets a priority assigned to it in connection with the
+group membership.
+
+Testgroups are picked up by a testbox partition (aka scheduling group) and a
+prioirty, scheduling time restriction and dependencies on other test groups are
+associated with the assignment.  A testgroup can be used by several testbox
+partitions.
+
+(This used to be called 'testsuites' but was renamed to avoid confusion with
+the VBox Test Suite.)
+
+
+Scheduling
+----------
+
+The initial scheduler will be modelled after what we're doing already on in the
+tinderbox driven testing.  It's best described as a best effort continuous
+integration scheduler.  Meaning, it will always use the latest build suitable
+for a testcase.  It will schedule on a testcase level, using the combined
+priority of the testcase in the test group and the test group with the testbox
+partition, trying to spread the test case argument varation out accordingly
+over the whole scheduilng queue.  Which argument variation to start with, is
+not undefined (random would be best).
+
+Later, we may add other schedulers as needed.
+
+
+
+The Test Manager Database
+=========================
+
+First a general warning:
+
+    The guys working on this design are not database experts, web
+    programming experts or similar, rather we are low level guys
+    who's main job is x86 & AMD64 virtualization.  So, please don't
+    be too hard on us. :-)
+
+
+A logical table layout can be found in TestManagerDatabaseMap.png (created by
+Oracle SQL Data Modeler, stored in TestManagerDatabase.dmd).  The physical
+database layout can be found in TestManagerDatabaseInit.pgsql postgreSQL
+script.  The script is commented.
+
+
+Data History
+------------
+
+We need to somehow track configuration changes over time.  We also need to
+be able to query the exact configuration a test set was run with so we can
+understand and make better use of the results.
+
+There are different techniques for archiving this, one is tuple-versioning
+( http://en.wikipedia.org/wiki/Tuple-versioning ), another is log trigger
+( http://en.wikipedia.org/wiki/Log_trigger ).  We use tuple-versioning in
+this database, with 'effective' as start date field name and 'expire' as
+the end (exclusive).
+
+Tuple-versioning has a shortcomming wrt to keys, both primary and foreign.
+The primary key of a table employing tuple-versioning is really
+'id' + 'valid_period', where the latter is expressed using two fields
+([effective...expire-1]).  Only, how do you tell the database engine that
+it should not allow overlapping valid_periods?  Useful suggestions are
+welcomed. :-)
+
+Foreign key references to a table using tuple-versioning is running into
+trouble because of the time axsis and that to our knowledge foreign keys
+must reference exactly one row in the other table.  When time is involved
+what we wish to tell the database is that at any given time, there actually
+is exactly one row we want to match in the other table, only we've no idea
+how to express this.  So, many foreign keys are not expressed in SQL of this
+database.
+
+In some cases, we extend the tuple-versioning with a generation ID so that
+normal foreign key referencing can be used.  We only use this for recording
+(references in testset) and scheduling (schedqueue), as using it more widely
+would force updates (gen_id changes) to propagate into all related tables.
+
+See also:
+    - http://en.wikipedia.org/wiki/Slowly_changing_dimension
+    - http://en.wikipedia.org/wiki/Change_data_capture
+    - http://en.wikipedia.org/wiki/Temporal_database
+
+
+
+Test Manager: Execution
+=======================
+
+
+
+Test Manager: Scenarios
+=======================
+
+
+
+#1 - Testbox Signs On (At Bootup)
+---------------------------------
+
+The testbox supplies a number of inputs when reporting for duty:
+    - IP address.
+    - System UUID.
+    - OS name.
+    - OS version.
+    - CPU architecture.
+    - CPU count (= threads).
+    - CPU VT-x/AMD-V capability.
+    - CPU nested paging capability.
+    - Chipset I/O MMU capability.
+    - Memory size.
+    - Scratch size space (for testing).
+    - Testbox Script revision.
+
+Results:
+    - ACK or NACK.
+    - Testbox ID and name on ACK.
+
+After receiving a ACK the testbox will ask for work to do, i.e. continue with
+scenario #2.  In the NACK case, it will sleep for 60 seconds and try again.
+
+
+Actions:
+
+1. Validate the testbox by looking the UUID up in the TestBoxes table.
+   If not found, NACK the request.  SQL::
+
+        SELECT  idTestBox, sName
+        FROM    TestBoxes
+        WHERE   uuidSystem = :sUuid
+          AND   tsExpire = 'infinity'::timestamp;
+
+2. Check if any of the information by testbox script has changed.  The two
+   sizes are normalized first, memory size rounded to nearest 4 MB and scratch
+   space is rounded down to nearest 64 MB.  If anything changed, insert a new
+   row in the testbox table and historize the current one, i.e. set
+   OLD.tsExpire to NEW.tsEffective and get a new value for NEW.idGenTestBox.
+
+3. Check with TestBoxStatuses:
+        a) If there is an row for the testbox in it already clean up change it
+           to 'idle' state and deal with any open testset like described in
+           scenario #9.
+        b) If there is no row, add one with 'idle' state.
+
+4. ACK the request and pass back the idTestBox.
+
+
+Note! Testbox.enabled is not checked here, that is only relevant when it asks
+      for a new task (scenario #2 and #5).
+
+Note! Should the testbox script detect changes in any of the inputs, it should
+      redo the sign in.
+
+Note! In scenario #8, the box will not sign on until it has done the reboot and 
+      cleanup reporting!
+
+
+#2 - Testbox Asks For Work To Do
+---------------------------------
+
+
+Inputs:
+    - The testbox is supplying its IP indirectly.
+    - The testbox should supply its UUID and ID directly.
+
+Results:
+    - IDLE, WAIT, EXEC, REBOOT, UPGRADE, UPGRADE-AND-REBOOT, SPECIAL or DEAD.
+
+Actions:
+
+1. Validate the ID and IP by selecting the currently valid testbox row::
+
+     SELECT  idGenTestBox, fEnabled, idSchedGroup, enmPendingCmd
+     FROM    TestBoxes
+     WHERE   id = :id
+       AND   uuidSystem = :sUuid
+       AND   ip = :ip
+       AND   tsExpire = 'infinity'::timestamp;
+
+   If NOT found return DEAD to the testbox client (it will go back to sign on 
+   mode and retry every 60 seconds or so - see scenario #1).
+
+   Note! The WUI will do all necessary clean-ups when deleting a testbox, so
+         contrary to the initial plans, we don't need to do anything more for 
+         the DEAD status.
+
+2. Check with TestBoxStatuses (maybe joined with query from 1).
+
+   If enmState is 'gang-gathering': Goto scenario #6 on timeout or pending
+   'abort' or 'reboot' command.  Otherwise, tell the testbox to WAIT [done].
+
+   If enmState is 'gang-testing': The gang has been gathered and execution
+   has been triggered.  Goto 5.
+
+   If enmState is not 'idle', change it to 'idle'.
+
+   If idTestSet is not NULL, CALL scenario #9 to it up.
+
+   If there is a pending abort command, remove it.
+
+   If there is a pending command and the old state doesn't indicate that it was
+   being executed, GOTO scenario #3.
+
+   Note! There should be a TestBoxStatuses row after executing scenario #1,
+         however should none be found for some funky reason, returning DEAD
+         will fix the problem (see above)
+
+3. If the testbox was marked as disabled, respond with an IDLE command to the
+   testbox [done]. (Note! Must do this after TestBoxStatuses maintainance from
+   point 2, or abandond tests won't be cleaned up after a testbox is disabled.)
+
+4. Consider testcases in the scheduling queue, pick the first one which the
+   testbox can execute.  There is a concurrency issue here, so we put and
+   exclusive lock on the SchedQueues table while considering its content.
+
+   The cursor we open looks something like this::
+
+     SELECT  idItem, idGenTestCaseArgs,
+             idTestSetGangLeader, cMissingGangMembers
+     FROM    SchedQueues
+     WHERE   idSchedGroup = :idSchedGroup
+        AND  (   bmHourlySchedule is NULL
+              OR get_bit(bmHourlySchedule, :iHourOfWeek) = 1 ) --< does this work?
+     ORDER BY ASC idItem;
+
+  If there no rows are returned (this can happen because no testgroups are
+  associated with this scheduling group, the scheduling group is disabled,
+  or because the queue is being regenerated), we will tell the testbox to
+  IDLE [done].
+
+  For each returned row we will:
+     a) Check testcase/group dependencies.
+     b) Select a build (and default testsuite) satisfying the dependencies.
+     c) Check the testcase requirements with that build in mind.
+     d) If idTestSetGangLeader is NULL, try allocate the necessary resources.
+     e) If it didn't check out, fetch the next row and redo from (a).
+     f) Tentatively create a new test set row.
+     g) If not gang scheduling:
+            - Next state: 'testing'
+        ElIf we're the last gang participant:
+            - Set idTestSetGangLeader to NULL.
+            - Set cMissingGangMembers to 0.
+            - Next state: 'gang-testing'
+        ElIf we're the first gang member:
+            - Set cMissingGangMembers to TestCaseArgs.cGangMembers - 1.
+            - Set idTestSetGangLeader to our idTestSet.
+            - Next state: 'gang-gathering'
+        Else:
+            - Decrement cMissingGangMembers.
+            - Next state: 'gang-gathering'
+
+        If we're not gang scheduling OR cMissingGangMembers is 0:
+            Move the scheduler queue entry to the end of the queue.
+
+        Update our TestBoxStatuses row with the new state and test set.
+        COMMIT;
+
+5. If state is 'testing' or 'gang-testing':
+        EXEC reponse.
+
+        The EXEC response for a gang scheduled testcase includes a number of
+        extra arguments so that the script knows the position of the testbox
+        it is running on and of the other members.  This means the that the
+        TestSet.iGangMemberNo is passed using --gang-member-no and the IP
+        addresses of the all gang members using --gang-ipv4-<memb-no> <ip>.
+   Else (state is 'gang-gathering'):
+        WAIT
+
+
+
+#3 - Pending Command When Testbox Asks For Work
+-----------------------------------------------
+
+This is a subfunction of scenario #2 and #5.
+
+As seen in scenario #2, the testbox will send 'abort' commands to /dev/null
+when it finds one when not executing a test.  This includes when it reports
+that the test has completed (no need to abort a completed test, wasting lot
+of effort when standing at the finish line).
+
+The other commands, though, are passed back to the testbox.  The testbox
+script will respond with an ACK or NACK as it sees fit.  If NACKed, the
+pending command will be removed (pending_cmd set to none) and that's it.
+If ACKed, the state of the testbox will change to that appropriate for the
+command and the pending_cmd set to none.  Should the testbox script fail to
+respond, the command will be repeated the next time it asks for work.
+
+
+
+#4 - Testbox Uploads Results During Test
+----------------------------------------
+
+
+TODO
+
+
+#5 - Testbox Completes Test and Asks For Work
+---------------------------------------------
+
+This is very similar to scenario #2
+
+TODO
+
+
+#6 - Gang Gathering Timeout
+---------------------------
+
+This is a subfunction of scenario #2.
+
+When gathering a gang of testboxes for a testcase, we do not want to wait
+forever and have testboxes doing nothing for hours while waiting for partners.
+So, the gathering has a reasonable timeout (imagine something like 20-30 mins).
+
+Also, we need some way of dealing with 'abort' and 'reboot' commands being
+issued while waiting.  The easy way out is pretent it's a time out.
+
+When changing the status to 'gang-timeout' we have to be careful.  First of all,
+we need to exclusively lock the SchedQueues and TestBoxStatuses (in that order)
+and re-query our status.  If it changed redo the checks in scenario #2 point 2.
+
+If we still want to timeout/abort, change the state from 'gang-gathering' to
+'gang-gathering-timedout' on all the gang members that has gathered so far.
+Then reset the scheduling queue record and move it to the end of the queue.
+
+
+When acting on 'gang-timeout' the TM will fail the testset in a manner similar
+to scenario #9.  No need to repeat that.
+
+
+
+#7 - Gang Cleanup
+-----------------
+
+When a testbox completes a gang scheduled test, we will have to serialize
+resource cleanup (both globally and on testboxes) as they stop.  More details
+can be found in the documentation of 'gang-cleanup'.
+
+So, the transition from 'gang-testing' is always to 'gang-cleanup'.  When we
+can safely leave 'gang-cleanup' is decided by the query::
+
+        SELECT  COUNT(*)
+        FROM    TestBoxStatuses,
+                TestSets
+        WHERE   TestSets.idTestSetGangLeader = :idTestSetGangLeader
+            AND TestSets.idTestBox = TestBoxStatuses.idTestBox
+            AND TestBoxStatuses.enmState = 'gang-running'::TestBoxState_T;
+
+As long as there are testboxes still running, we stay in the 'gang-cleanup'
+state.  Once there are none, we continue closing the testset and such.
+
+
+
+#8 - Testbox Reports A Crash During Test Execution
+--------------------------------------------------
+
+TODO
+
+
+#9 - Cleaning Up Abandond Testcase
+----------------------------------
+
+This is a subfunction of scenario #1 and #2.  The actions taken are the same in
+both situations.  The precondition for taking this path is that the row in the
+testboxstatus table is refering to a testset (i.e. testset_id is not NULL).
+
+
+Actions:
+
+1. If the testset is incomplete, we need to completed:
+        a) Add a message to the root TestResults row, creating one if necesary,
+           that explains that the test was abandond.  This is done
+           by inserting/finding the string into/in TestResultStrTab and adding
+           a row to TestResultMsgs with idStrMsg set to that string id and
+           enmLevel set to 'failure'.
+        b) Mark the testset as failed.
+
+2. Free any global resources referenced by the test set.  This is done by
+   deleting all rows in GlobalResourceStatuses matching the testbox id.
+
+3. Set the idTestSet to NULL in the TestBoxStatuses row.
+
+
+
+#10 - Cleaning Up a Disabled/Dead TestBox
+-----------------------------------------
+
+The UI needs to be able to clean up the remains of a testbox which for some
+reason is out of action.  Normal cleaning up of abandond testcases requires
+that the testbox signs on or asks for work, but if the testbox is dead or
+in some way indisposed, it won't be doing any of that.  So, the testbox
+sheriff needs to have a way of cleaning up after it.
+
+It's basically a manual scenario #9 but with some safe guards, like checking
+that the box hasn't been active for the last 1-2 mins (max idle/wait time * 2).
+
+
+Note! When disabling a box that still executing the testbox script, this
+      cleanup isn't necessary as it will happen automatically.   Also, it's
+      probably desirable that the testbox finishes what ever it is doing first
+      before going dormant.
+
+
+
+Test Manager: Analysis
+=======================
+
+One of the testbox sheriff's tasks is to try figure out the reason why something
+failed.  The test manager will provide facilities for doing so from very early
+in it's implementation.
+
+
+We need to work out some useful status reports for the early implementation.
+Later there will be more advanced analysis tools, where for instance we can
+create graphs from selected test result values or test execution times.
+
+
+
+Implementation Plan
+===================
+
+This has changed for various reasons.  The current plan is to implement the
+infrastructure (TM & testbox script) first and do a small deployment with the
+2-5 test drivers in the Testsuite as basis.  Once the bugs are worked out, we
+will convert the rest of the tests and start adding new ones.
+
+We just need to finally get this done, no point in doing it piecemeal by now!
+
+
+Test Manager Implementation Sub-Tasks
+-------------------------------------
+
+The implementation of the test manager and adjusting/completing of the testbox
+script and the test drivers are tasks which can be done by more than one 
+person.  Splitting up the TM implementation into smaller tasks should allow 
+parallel development of different tasks and get us working code sooner.
+
+
+Milestone #1 
+------------
+
+The goal is to getting the fundamental testmanager engine implemented, debugged
+and working.  With the exception of testboxes, the configuration will be done 
+via SQL inserts.
+
+Tasks in somewhat prioritized order:
+
+    - Kick off test manager.  It will live in testmanager/.  Salvage as much as
+      possible from att/testserv.  Create basic source and file layout.
+
+    - Adjust the testbox script, part one.  There currently is a testbox script
+      in att/testbox, this shall be moved up into testboxscript/.  The script
+      needs to be adjusted according to the specification layed down earlier
+      in this document.  Installers or installation scripts for all relevant 
+      host OSes are required.  Left for part two is result reporting beyond the
+      primary log.  This task must be 100% feature complete, on all host OSes, 
+      there is no room for FIXME, XXX or @todo here.
+
+    - Implement the schedule queue generator.
+
+    - Implement the testbox dispatcher in TM.  Support all the testbox script
+      responses implemented above, including upgrading the testbox script.
+
+    - Implement simple testbox management page.
+
+    - Implement some basic activity and result reports so that we can see 
+      what's going on.
+
+    - Create a testmanager / testbox test setup.  This lives in selftest/. 
+      
+      1. Set up something that runs, no fiddly bits. Debug till it works.
+      2. Create a setup that tests testgroup dependencies, i.e. real tests
+         depending on smoke tests.
+      3. Create a setup that exercises testcase dependency.
+      4. Create a setup that exercises global resource allocation.
+      5. Create a setup that exercises gang scheduling.
+
+    - Check that all features work.
+
+
+Milestone #2
+------------
+
+The goal is getting to VBox testing.
+
+Tasks in somewhat prioritized order:
+
+    - Implement full result reporting in the testbox script and testbox driver.
+      A testbox script specific reporter needs to be implemented for the 
+      testdriver framework.  The testbox script needs to forward the results to
+      the test manager, or alternatively the testdriver report can talk 
+      directly to the TM.
+
+    - Implement the test manager side of the test result reporting.
+
+    - Extend the selftest with some setup that report all kinds of test 
+      results.
+
+    - Implement script/whatever feeding builds to the test manager from the 
+      tinderboxes.
+
+    - The toplevel test driver is a VBox thing that must be derived from the
+      base TestDriver class or maybe the VBox one.  It should move from 
+      toptestdriver to testdriver and be renamed to vboxtltd or smth.
+
+    - Create a vbox testdriver that boots the t-xppro VM once and that's it.
+
+    - Create a selftest setup which tests booting t-xppro taking builds from 
+      the tinderbox.
+
+
+Milestone #3
+------------
+
+The goal for this milestone is configuration and converting current testscases,
+the result will be the a minimal test deployment (4-5 new testboxes).
+    
+Tasks in somewhat prioritized order:
+
+    - Implement testcase configuration.
+
+    - Implement testgroup configuration.
+
+    - Implement build source configuration.
+
+    - Implement scheduling group configuration.
+
+    - Implement global resource configuration.
+
+    - Re-visit the testbox configuration.
+
+    - Black listing of builds.
+
+    - Implement simple failure analysis and reporting.
+
+    - Implement the initial smoke tests modelled on the current smoke tests.
+
+    - Implement installation tests for Windows guests.
+
+    - Implement installation tests for Linux guests.
+
+    - Implement installation tests for Solaris guest.
+
+    - Implement installation tests for OS/2 guest.
+
+    - Set up a small test deployment.
+
+
+Further work
+------------
+
+After milestone #3 has been reached and issues found by the other team members 
+have been addressed, we will probably go for full deployment.  
+
+Beyond this point we will need to improve reporting and analysis.  There may be
+configuration aspects needing reporting as well.  
+
+Once deployed, a golden rule will be that all new features shall have test 
+coverage.  Preferrably, implemented by someone else and prior to the feature 
+implementation.
+
+
+
+
+Discussion Logs
+===============
+
+2009-07-21,22,23 Various Discussions with Michal and/or Klaus
+-------------------------------------------------------------
+
+- Scheduling of tests requiring more than one testbox.
+- Scheduling of tests that cannot be executing concurrently on several machines
+  because of some global resource like an iSCSI target.
+- Manually create the test config permutations instead of having the test
+  manager create all possible ones and wasting time.
+- Distinguish between built types so we can run smoke tests on strick builds as
+  well as release ones.
+
+
+2009-07-20 Brief Discussion with Michal
+----------------------------------------
+
+- Installer for the testbox script to make bringing up a new testbox even
+  smoother.
+
+
+2009-07-16 Raw Input
+--------------------
+
+- test set. recursive collection of:
+    - hierachical subtest name (slash sep)
+    - test parameters / config
+    - bool fail/succ
+    - attributes (typed?)
+    - test time
+    - e.g. throughput
+    - subresults
+    - log
+    - screenshots,....
+
+- client package (zip) dl from server (maybe client caching)
+
+
+- thoughts on bits to do at once.
+    - We *really* need the basic bits ASAP.
+    - client -> support for test driver
+    - server -> controls configs
+    - cleanup on both sides
+
+
+2009-07-15 Raw Input
+--------------------
+
+- testing should start automatically
+- switching to branch too tedious
+- useful to be able to partition testboxes (run specific builds on some boxes, let an engineer have a few boxes for a while).
+- test specification needs to be more flexible (select tests, disable test, test scheduling (run certain tests nightly), ... )
+- testcase dependencies (blacklisting builds, run smoketests on box A before long tests on box B, ...)
+- more testing flexibility, more test than just install/moke. For instance unit tests, benchmarks, ...
+- presentation/analysis: graphs!, categorize bugs, columns reorganizing grouped by test (hierarchical), overviews, result for last day.
+- testcase specificion, variables (e.g. I/O-APIC, SMP, HWVIRT, SATA...) as sub-tests
+- interation with ILOM/...: reset systems
+- Changes needs LDAP authentication
+- historize all configuration  w/ name
+- ability to run testcase locally (provided the VDI/ISO/whatever extra requirements can be met).
+
+
+-----
+
+.. [1] no such footnote
+
+-----
+
+:Status: $Id: AutomaticTestingRevamp.txt $
+:Copyright: Copyright (C) 2010-2014 Oracle Corporation.
+
diff --git a/src/VBox/ValidationKit/docs/Makefile.kmk b/src/VBox/ValidationKit/docs/Makefile.kmk
new file mode 100644
index 0000000..83cce6b
--- /dev/null
+++ b/src/VBox/ValidationKit/docs/Makefile.kmk
@@ -0,0 +1,40 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Makefile for generating .html from .txt.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+GENERATED_FILES = AutomaticTestingRevamp.html VBoxValidationKitReadMe.html
+RST2HTML := $(firstword $(which $(foreach pyver, 3.2 3.1 3.0 2.8 2.7 2.6 2.5 2.4 ,rst2html-$(pyver).py) ) rst2html.py)
+
+all: $(GENERATED_FILES)
+
+clean:
+	kmk_builtin_rm -f -- $(GENERATED_FILES)
+
+AutomaticTestingRevamp.html: AutomaticTestingRevamp.txt
+	LC_ALL=C $(RST2HTML) --no-generator AutomaticTestingRevamp.txt AutomaticTestingRevamp.html
+
+VBoxValidationKitReadMe.html: VBoxValidationKitReadMe.txt
+	LC_ALL=C $(RST2HTML) --no-generator VBoxValidationKitReadMe.txt VBoxValidationKitReadMe.html
+
diff --git a/src/VBox/ValidationKit/docs/VBoxValidationKitReadMe.html b/src/VBox/ValidationKit/docs/VBoxValidationKitReadMe.html
new file mode 100644
index 0000000..5ae3578
--- /dev/null
+++ b/src/VBox/ValidationKit/docs/VBoxValidationKitReadMe.html
@@ -0,0 +1,445 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
+<title>The VirtualBox Validation Kit</title>
+<style type="text/css">
+
+/*
+:Author: David Goodger (goodger at python.org)
+:Id: $Id: VBoxValidationKitReadMe.html $
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+
+See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+  border: 0 }
+
+table.borderless td, table.borderless th {
+  /* Override padding for "table.docutils td" with "! important".
+     The right padding separates the table cells. */
+  padding: 0 0.5em 0 0 ! important }
+
+.first {
+  /* Override more specific margin styles with "! important". */
+  margin-top: 0 ! important }
+
+.last, .with-subtitle {
+  margin-bottom: 0 ! important }
+
+.hidden {
+  display: none }
+
+a.toc-backref {
+  text-decoration: none ;
+  color: black }
+
+blockquote.epigraph {
+  margin: 2em 5em ; }
+
+dl.docutils dd {
+  margin-bottom: 0.5em }
+
+object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
+  overflow: hidden;
+}
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+  font-weight: bold }
+*/
+
+div.abstract {
+  margin: 2em 5em }
+
+div.abstract p.topic-title {
+  font-weight: bold ;
+  text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+  margin: 2em ;
+  border: medium outset ;
+  padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+  font-weight: bold ;
+  font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title, .code .error {
+  color: red ;
+  font-weight: bold ;
+  font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+   compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+  margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+  margin-top: 0.5em }
+*/
+
+div.dedication {
+  margin: 2em 5em ;
+  text-align: center ;
+  font-style: italic }
+
+div.dedication p.topic-title {
+  font-weight: bold ;
+  font-style: normal }
+
+div.figure {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+div.footer, div.header {
+  clear: both;
+  font-size: smaller }
+
+div.line-block {
+  display: block ;
+  margin-top: 1em ;
+  margin-bottom: 1em }
+
+div.line-block div.line-block {
+  margin-top: 0 ;
+  margin-bottom: 0 ;
+  margin-left: 1.5em }
+
+div.sidebar {
+  margin: 0 0 0.5em 1em ;
+  border: medium outset ;
+  padding: 1em ;
+  background-color: #ffffee ;
+  width: 40% ;
+  float: right ;
+  clear: right }
+
+div.sidebar p.rubric {
+  font-family: sans-serif ;
+  font-size: medium }
+
+div.system-messages {
+  margin: 5em }
+
+div.system-messages h1 {
+  color: red }
+
+div.system-message {
+  border: medium outset ;
+  padding: 1em }
+
+div.system-message p.system-message-title {
+  color: red ;
+  font-weight: bold }
+
+div.topic {
+  margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+  margin-top: 0.4em }
+
+h1.title {
+  text-align: center }
+
+h2.subtitle {
+  text-align: center }
+
+hr.docutils {
+  width: 75% }
+
+img.align-left, .figure.align-left, object.align-left {
+  clear: left ;
+  float: left ;
+  margin-right: 1em }
+
+img.align-right, .figure.align-right, object.align-right {
+  clear: right ;
+  float: right ;
+  margin-left: 1em }
+
+img.align-center, .figure.align-center, object.align-center {
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+.align-left {
+  text-align: left }
+
+.align-center {
+  clear: both ;
+  text-align: center }
+
+.align-right {
+  text-align: right }
+
+/* reset inner alignment in figures */
+div.align-right {
+  text-align: inherit }
+
+/* div.align-center * { */
+/*   text-align: left } */
+
+ol.simple, ul.simple {
+  margin-bottom: 1em }
+
+ol.arabic {
+  list-style: decimal }
+
+ol.loweralpha {
+  list-style: lower-alpha }
+
+ol.upperalpha {
+  list-style: upper-alpha }
+
+ol.lowerroman {
+  list-style: lower-roman }
+
+ol.upperroman {
+  list-style: upper-roman }
+
+p.attribution {
+  text-align: right ;
+  margin-left: 50% }
+
+p.caption {
+  font-style: italic }
+
+p.credits {
+  font-style: italic ;
+  font-size: smaller }
+
+p.label {
+  white-space: nowrap }
+
+p.rubric {
+  font-weight: bold ;
+  font-size: larger ;
+  color: maroon ;
+  text-align: center }
+
+p.sidebar-title {
+  font-family: sans-serif ;
+  font-weight: bold ;
+  font-size: larger }
+
+p.sidebar-subtitle {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+p.topic-title {
+  font-weight: bold }
+
+pre.address {
+  margin-bottom: 0 ;
+  margin-top: 0 ;
+  font: inherit }
+
+pre.literal-block, pre.doctest-block, pre.math, pre.code {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+pre.code .ln { color: grey; } /* line numbers */
+pre.code, code { background-color: #eeeeee }
+pre.code .comment, code .comment { color: #5C6576 }
+pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
+pre.code .literal.string, code .literal.string { color: #0C5404 }
+pre.code .name.builtin, code .name.builtin { color: #352B84 }
+pre.code .deleted, code .deleted { background-color: #DEB0A1}
+pre.code .inserted, code .inserted { background-color: #A3D289}
+
+span.classifier {
+  font-family: sans-serif ;
+  font-style: oblique }
+
+span.classifier-delimiter {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+span.interpreted {
+  font-family: sans-serif }
+
+span.option {
+  white-space: nowrap }
+
+span.pre {
+  white-space: pre }
+
+span.problematic {
+  color: red }
+
+span.section-subtitle {
+  /* font-size relative to parent (h1..h6 element) */
+  font-size: 80% }
+
+table.citation {
+  border-left: solid 1px gray;
+  margin-left: 1px }
+
+table.docinfo {
+  margin: 2em 4em }
+
+table.docutils {
+  margin-top: 0.5em ;
+  margin-bottom: 0.5em }
+
+table.footnote {
+  border-left: solid 1px black;
+  margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+  padding-left: 0.5em ;
+  padding-right: 0.5em ;
+  vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+  font-weight: bold ;
+  text-align: left ;
+  white-space: nowrap ;
+  padding-left: 0 }
+
+/* "booktabs" style (no vertical lines) */
+table.docutils.booktabs {
+  border: 0px;
+  border-top: 2px solid;
+  border-bottom: 2px solid;
+  border-collapse: collapse;
+}
+table.docutils.booktabs * {
+  border: 0px;
+}
+table.docutils.booktabs th {
+  border-bottom: thin solid;
+  text-align: left;
+}
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+  font-size: 100% }
+
+ul.auto-toc {
+  list-style-type: none }
+
+</style>
+</head>
+<body>
+<div class="document" id="the-virtualbox-validation-kit">
+<h1 class="title">The VirtualBox Validation Kit</h1>
+
+<div class="section" id="introduction">
+<h1>Introduction</h1>
+<p>The VirtualBox Validation Kit is our new public tool for doing automated
+testing of VirtualBox.  We are continually working on adding new features
+and guest operating systems to our battery of tests.</p>
+<p>We warmly welcome contributions, new ideas for good tests and fixes.</p>
+</div>
+<div class="section" id="directory-layout">
+<h1>Directory Layout</h1>
+<dl class="docutils">
+<dt>./docs/</dt>
+<dd><p class="first">The documentation for the test suite mostly lives here, the exception being
+readme.txt files that are better off living near what they concern.</p>
+<p class="last">For a definition of terms used here, see the Definitions / Glossary section
+of ./docs/AutomaticTestingRevamp.txt / ./docs/AutomaticTestingRevamp.html.</p>
+</dd>
+<dt>./testdriver/</dt>
+<dd><p class="first">Python module implementing the base test drivers and supporting stuff.
+The base test driver implementation is found in ./testdriver/base.py while
+the VBox centric specialization is in ./testdriver/vbox.py. Various VBox
+API wrappers that makes things easier to use and glosses over a lot of API
+version differences that live in ./testdriver/vboxwrappers.py.</p>
+<p>Test VM collections are often managed thru ./testdriver/vboxtestvms.py, but
+doesn't necessarily have to be, it's up to the individual test driver.</p>
+<p>For logging, reporting result, uploading useful files and such we have a
+reporter singleton sub-package, ./testdriver/reporter.py.  It implements
+both local (for local testing) and remote (for testboxes + test manager)
+reporting.</p>
+<p class="last">There is also a VBoxTXS client implementation in txsclient.py and a stacked
+test driver for installing VBox (vboxinstaller.py).  Most test drivers will
+use the TXS client indirectly thru vbox.py methods.  The installer driver
+is a special trick for the testbox+testmanager setup.</p>
+</dd>
+<dt>./tests/</dt>
+<dd>The python scripts driving the tests.  These are organized by what they
+test and are all derived from the base classes in ./testdriver (mostly from
+vbox.py of course).  Most tests use one or more VMs from a standard set of
+preconfigured VMs defined by ./testdriver/vboxtestvms.py (mentioned above),
+though the installation tests used prepared ISOs and floppy images.</dd>
+<dt>./vms/</dt>
+<dd>Text documents describing the preconfigured test VMs defined by
+./testdrive/vboxtestvms.py.  This will also contain description of how to
+prepare installation ISOs when we get around to it (soon).</dd>
+<dt>./utils/</dt>
+<dd><p class="first">Test utilities and lower level test programs, compiled from C, C++ and
+Assembly mostly.  Generally available for both host and guest, i.e. in the
+zip and on the VBoxValidationKit.iso respectively.</p>
+<p>The Test eXecution Service (VBoxTXS) found in ./utils/TestExecServ is one
+of the more important utilities.  It implements a remote execution service
+for running programs/tests inside VMs and on other test boxes. See
+./utils/TestExecServ/vboxtxs-readme.txt for more details.</p>
+<p class="last">A simple network bandwidth and latency test program can be found in
+./utils/network/NetPerf.cpp.</p>
+</dd>
+<dt>./bootsectors/</dt>
+<dd><p class="first">Boot sector test environment.  This allows creating floppy images in
+assembly that tests specific CPU or device behaviour.  Most tests can be
+put on a USB stick, floppy or similar and booted up on real hardware for
+comparison.  All floppy images can be used for manual testing by developers
+and most will be used by test drivers (./tests/<em>/td</em>.py) sooner or later.</p>
+<p class="last">The boot sector environment is heavily bound to yasm and it's ability to
+link binary images for single assembly input units.  There is a "library"
+of standard initialization code and runtime code, which include switch to
+all (well V8086 mode is still missing, but we'll get that done eventually)
+processor modes and paging modes.  The image specific code is split into
+init/driver code and test template, the latter can be instantiated for each
+process execution+paging mode.</p>
+</dd>
+<dt>./common/</dt>
+<dd>Python package containing common python code.</dd>
+<dt>./testboxscript/</dt>
+<dd>The testbox script.  This is installed on testboxes used for automatic
+testing with the testmanager.</dd>
+<dt>./testmanager/</dt>
+<dd>The VirtualBox Test Manager (server side code).  This is written in Python
+and currently uses postgresql as database backend for no particular reason
+other than that it was already installed on the server the test manager was
+going to run on.  It's relatively generic, though there are of course
+things in there that are of more use when testing VirtualBox than other
+things.  A more detailed account (though perhaps a little dated) of the
+test manager can be found in ./docs/AutomaticTestingRevamp.txt and
+./docs/AutomaticTestingRevamp.html.</dd>
+<dt>./testanalysis/</dt>
+<dd>A start a local test result analysis, comparing network test output.  We'll
+probably be picking this up again later.</dd>
+<dt>./snippets/</dt>
+<dd>Various code snippets that may be turned into real tests at some point.</dd>
+</dl>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field"><th class="field-name">Status:</th><td class="field-body">$Id: VBoxValidationKitReadMe.html $</td>
+</tr>
+<tr class="field"><th class="field-name">Copyright:</th><td class="field-body">Copyright (C) 2010-2014 Oracle Corporation.</td>
+</tr>
+</tbody>
+</table>
+</div>
+</div>
+</body>
+</html>
diff --git a/src/VBox/ValidationKit/docs/VBoxValidationKitReadMe.txt b/src/VBox/ValidationKit/docs/VBoxValidationKitReadMe.txt
new file mode 100644
index 0000000..0a4a177
--- /dev/null
+++ b/src/VBox/ValidationKit/docs/VBoxValidationKitReadMe.txt
@@ -0,0 +1,114 @@
+
+The VirtualBox Validation Kit
+=============================
+
+
+Introduction
+------------
+
+The VirtualBox Validation Kit is our new public tool for doing automated
+testing of VirtualBox.  We are continually working on adding new features
+and guest operating systems to our battery of tests.
+
+We warmly welcome contributions, new ideas for good tests and fixes.
+
+
+Directory Layout
+----------------
+
+./docs/
+    The documentation for the test suite mostly lives here, the exception being
+    readme.txt files that are better off living near what they concern.
+
+    For a definition of terms used here, see the Definitions / Glossary section
+    of ./docs/AutomaticTestingRevamp.txt / ./docs/AutomaticTestingRevamp.html.
+
+./testdriver/
+    Python module implementing the base test drivers and supporting stuff.
+    The base test driver implementation is found in ./testdriver/base.py while
+    the VBox centric specialization is in ./testdriver/vbox.py. Various VBox
+    API wrappers that makes things easier to use and glosses over a lot of API
+    version differences that live in ./testdriver/vboxwrappers.py.
+
+    Test VM collections are often managed thru ./testdriver/vboxtestvms.py, but
+    doesn't necessarily have to be, it's up to the individual test driver.
+
+    For logging, reporting result, uploading useful files and such we have a
+    reporter singleton sub-package, ./testdriver/reporter.py.  It implements
+    both local (for local testing) and remote (for testboxes + test manager)
+    reporting.
+
+    There is also a VBoxTXS client implementation in txsclient.py and a stacked
+    test driver for installing VBox (vboxinstaller.py).  Most test drivers will
+    use the TXS client indirectly thru vbox.py methods.  The installer driver
+    is a special trick for the testbox+testmanager setup.
+
+./tests/
+    The python scripts driving the tests.  These are organized by what they
+    test and are all derived from the base classes in ./testdriver (mostly from
+    vbox.py of course).  Most tests use one or more VMs from a standard set of
+    preconfigured VMs defined by ./testdriver/vboxtestvms.py (mentioned above),
+    though the installation tests used prepared ISOs and floppy images.
+
+./vms/
+    Text documents describing the preconfigured test VMs defined by
+    ./testdrive/vboxtestvms.py.  This will also contain description of how to
+    prepare installation ISOs when we get around to it (soon).
+
+./utils/
+    Test utilities and lower level test programs, compiled from C, C++ and
+    Assembly mostly.  Generally available for both host and guest, i.e. in the
+    zip and on the VBoxValidationKit.iso respectively.
+
+    The Test eXecution Service (VBoxTXS) found in ./utils/TestExecServ is one
+    of the more important utilities.  It implements a remote execution service
+    for running programs/tests inside VMs and on other test boxes. See
+    ./utils/TestExecServ/vboxtxs-readme.txt for more details.
+
+    A simple network bandwidth and latency test program can be found in
+    ./utils/network/NetPerf.cpp.
+
+./bootsectors/
+    Boot sector test environment.  This allows creating floppy images in
+    assembly that tests specific CPU or device behaviour.  Most tests can be
+    put on a USB stick, floppy or similar and booted up on real hardware for
+    comparison.  All floppy images can be used for manual testing by developers
+    and most will be used by test drivers (./tests/*/td*.py) sooner or later.
+
+    The boot sector environment is heavily bound to yasm and it's ability to
+    link binary images for single assembly input units.  There is a "library"
+    of standard initialization code and runtime code, which include switch to
+    all (well V8086 mode is still missing, but we'll get that done eventually)
+    processor modes and paging modes.  The image specific code is split into
+    init/driver code and test template, the latter can be instantiated for each
+    process execution+paging mode.
+
+./common/
+    Python package containing common python code.
+
+./testboxscript/
+    The testbox script.  This is installed on testboxes used for automatic
+    testing with the testmanager.
+
+./testmanager/
+    The VirtualBox Test Manager (server side code).  This is written in Python
+    and currently uses postgresql as database backend for no particular reason
+    other than that it was already installed on the server the test manager was
+    going to run on.  It's relatively generic, though there are of course
+    things in there that are of more use when testing VirtualBox than other
+    things.  A more detailed account (though perhaps a little dated) of the
+    test manager can be found in ./docs/AutomaticTestingRevamp.txt and
+    ./docs/AutomaticTestingRevamp.html.
+
+./testanalysis/
+    A start a local test result analysis, comparing network test output.  We'll
+    probably be picking this up again later.
+
+./snippets/
+    Various code snippets that may be turned into real tests at some point.
+
+
+
+:Status: $Id: VBoxValidationKitReadMe.txt $
+:Copyright: Copyright (C) 2010-2014 Oracle Corporation.
+
diff --git a/src/VBox/ValidationKit/jshintrc.js b/src/VBox/ValidationKit/jshintrc.js
new file mode 100644
index 0000000..c4e4e3d
--- /dev/null
+++ b/src/VBox/ValidationKit/jshintrc.js
@@ -0,0 +1,8 @@
+/* $Id: jshintrc.js $ */
+/** @file
+ * JSHint configuration file.
+ */
+{
+    "laxbreak": true
+}
+
diff --git a/src/VBox/ValidationKit/readme.txt b/src/VBox/ValidationKit/readme.txt
new file mode 100644
index 0000000..ac747f2
--- /dev/null
+++ b/src/VBox/ValidationKit/readme.txt
@@ -0,0 +1,3 @@
+
+See docs/VBoxValidationKitReadMe.txt  or docs/VBoxValidationKitReadMe.html.
+
diff --git a/src/VBox/ValidationKit/snippets/alloc-1.c b/src/VBox/ValidationKit/snippets/alloc-1.c
new file mode 100644
index 0000000..f799bd0
--- /dev/null
+++ b/src/VBox/ValidationKit/snippets/alloc-1.c
@@ -0,0 +1,99 @@
+/* $Id: alloc-1.c $ */
+/** @file
+ * Allocate lots of memory, portable ANSI C code.
+ */
+
+/*
+ * Copyright (C) 2007-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <stdlib.h>
+#include <stdio.h>
+
+
+int main(int argc, char **argv)
+{
+    unsigned      uPct;
+    unsigned long cbDone;
+    unsigned long cMBs = 1024;
+    unsigned long cb;
+
+    /*
+     * Some quick and dirty argument parsing.
+     */
+    if (argc == 2)
+        cMBs = strtoul(argv[1], 0, 0);
+    if (!cMBs || argc > 2)
+    {
+        printf("usage: alloc-1 [MBs]\n");
+        return 1;
+    }
+    cb = cMBs * 1024 * 1024;
+    if (cb / (1024 * 1024) != cMBs)
+        cb = ~(unsigned long)0 / (1024 * 1024) * (1024 * 1024);
+    printf("alloc-1: allocating %lu MB (%lu bytes)\n", cb/1024/1024, cb);
+
+    /*
+     * The allocation loop.
+     */
+    printf("alloc-1: 0%%");
+    fflush(stdout);
+    cbDone = 0;
+    uPct = 0;
+    while (cbDone < cb)
+    {
+        unsigned      uPctNow;
+        unsigned long cbThis = cb > 10*1024*1024 ? 10*1024*1024 : cb;
+        char         *pb = malloc(cbThis);
+        if (!pb)
+        {
+            printf("\nalloc-1: calloc failed, cbDone=%lu MB (%lu bytes)\n",
+                   cbDone/1024/1024/1024, cbDone);
+            return 1;
+        }
+        cbDone += cbThis;
+
+        /* touch the memory. */
+        while (cbThis >= 0x1000)
+        {
+            *pb = (char)cbThis;
+            pb += 0x1000;
+            cbThis -= 0x1000;
+        }
+
+        /* progress */
+        uPctNow = 100.0 * cbDone / cb;
+        if (uPctNow != uPct && !(uPctNow & 1))
+        {
+            if (!(uPctNow % 10))
+                printf("%u%%", (unsigned)uPctNow);
+            else
+                printf(".");
+            fflush(stdout);
+        }
+        uPct = uPctNow;
+    }
+
+    printf("\nalloc-1: done\n");
+    return 0;
+}
diff --git a/src/VBox/ValidationKit/snippets/time-1.c b/src/VBox/ValidationKit/snippets/time-1.c
new file mode 100644
index 0000000..7f5e655
--- /dev/null
+++ b/src/VBox/ValidationKit/snippets/time-1.c
@@ -0,0 +1,112 @@
+/* $Id: time-1.c $ */
+/** @file
+ * Query the time and check that it always goes forward, POSIX only.
+ */
+
+/*
+ * Copyright (C) 2011-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <stdio.h>
+#include <time.h>
+#include <sys/time.h>
+
+
+
+int main()
+{
+    unsigned            cErrors = 0;
+#ifdef USE_CLOCK_MONOTONIC
+    struct timespec     aTs[2];
+    struct timespec    *pCur    = &aTs[0];
+    struct timespec    *pPrev   = &aTs[1];
+    struct timespec    *pTmp;
+#else
+    struct timeval      aTv[2];
+    struct timeval     *pCur    = &aTv[0];
+    struct timeval     *pPrev   = &aTv[1];
+    struct timeval     *pTmp;
+#endif
+
+#ifdef USE_CLOCK_MONOTONIC
+    clock_gettime(CLOCK_MONOTONIC, pPrev);
+#else
+    gettimeofday(pPrev, NULL);
+#endif
+    for (;;)
+    {
+#ifdef USE_CLOCK_MONOTONIC
+        clock_gettime(CLOCK_MONOTONIC, pCur);
+#else
+        gettimeofday(pCur, NULL);
+#endif
+
+        if (   pCur->tv_sec == pPrev->tv_sec
+#ifdef USE_CLOCK_MONOTONIC
+            && pCur->tv_nsec < pPrev->tv_nsec
+#else
+            && pCur->tv_usec < pPrev->tv_usec
+#endif
+           )
+        {
+#ifdef USE_CLOCK_MONOTONIC
+            printf("tv_nsec in the past: %ld.%09d < %ld.%09d - %u nsec\n",
+                   (long)pCur->tv_sec,  (unsigned)pCur->tv_nsec,
+                   (long)pPrev->tv_sec, (unsigned)pPrev->tv_nsec,
+                   (unsigned)pPrev->tv_nsec - (unsigned)pCur->tv_nsec);
+#else
+            printf("tv_usec in the past: %ld.%06d < %ld.%06d - %u usec\n",
+                   (long)pCur->tv_sec,  (unsigned)pCur->tv_usec,
+                   (long)pPrev->tv_sec, (unsigned)pPrev->tv_usec,
+                   (unsigned)pPrev->tv_usec - (unsigned)pCur->tv_usec);
+#endif
+            cErrors++;
+            if (cErrors > 1000)
+                break;
+        }
+        else if (pCur->tv_sec < pPrev->tv_sec)
+        {
+#ifdef USE_CLOCK_MONOTONIC
+            printf("tv_sec  in the past: %ld.%09d < %ld.%09d\n",
+                   (long)pCur->tv_sec,  (unsigned)pCur->tv_nsec,
+                   (long)pPrev->tv_sec, (unsigned)pPrev->tv_nsec);
+#else
+            printf("tv_sec  in the past: %ld.%06d < %ld.%06d\n",
+                   (long)pCur->tv_sec,  (unsigned)pCur->tv_usec,
+                   (long)pPrev->tv_sec, (unsigned)pPrev->tv_usec);
+#endif
+            cErrors++;
+            if (cErrors > 1000)
+                break;
+        }
+        else
+        {
+            /* swap */
+            pTmp  = pPrev;
+            pPrev = pCur;
+            pCur  = pTmp;
+        }
+    }
+
+    return 1;
+}
diff --git a/src/VBox/ValidationKit/td-dummy.py b/src/VBox/ValidationKit/td-dummy.py
new file mode 100755
index 0000000..d44766d
--- /dev/null
+++ b/src/VBox/ValidationKit/td-dummy.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+
+__version__ = "$Id: td-dummy.py $"
+
+import sys
+sys.path.insert(0, "../");
+import testdriver.reporter as reporter
+import testdriver.vbox
+
+
+class DummyTestDriver(testdriver.vbox.TestDriver):
+    """
+    Dummy Test driver for testing the package layout.
+    """
+
+    def __init__(self):
+        testdriver.vbox.TestDriver.__init__(self);
+        self.dummy = 1;
+
+    def main(self):
+        print "works";
+        reporter.log("the reporter works")
+        self.dump();
+        return 0;
+
+
+td = DummyTestDriver();
+sys.exit(td.main());
+
diff --git a/src/VBox/ValidationKit/testanalysis/Makefile.kmk b/src/VBox/ValidationKit/testanalysis/Makefile.kmk
new file mode 100644
index 0000000..2a4aac1
--- /dev/null
+++ b/src/VBox/ValidationKit/testanalysis/Makefile.kmk
@@ -0,0 +1,35 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Python Test Driver.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testanalysis/__init__.py b/src/VBox/ValidationKit/testanalysis/__init__.py
new file mode 100644
index 0000000..2c3f96c
--- /dev/null
+++ b/src/VBox/ValidationKit/testanalysis/__init__.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# $Id: __init__.py $
+
+"""
+Test analysis package
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+__all__     = ["reader", "diff", "reporting"]
+
diff --git a/src/VBox/ValidationKit/testanalysis/diff.py b/src/VBox/ValidationKit/testanalysis/diff.py
new file mode 100644
index 0000000..1822bf3
--- /dev/null
+++ b/src/VBox/ValidationKit/testanalysis/diff.py
@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+# $Id: diff.py $
+
+"""
+Diff two test sets.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+__all__     = ['BaselineDiff', ];
+
+
+def _findBaselineTest(oBaseline, oTest):
+    """ Recursively finds the the test in oBaseline corresponding to oTest. """
+    if oTest.oParent is None:
+        return oBaseline;
+    oBaseline = _findBaselineTest(oBaseline, oTest.oParent);
+    if oBaseline is not None:
+        for oBaseTest in oBaseline.aoChildren:
+            if oBaseTest.sName == oTest.sName:
+                return oBaseTest;
+    return None;
+
+def _findBaselineTestValue(oBaseline, oValue):
+    """ Finds the baseline value corresponding to oValue. """
+    oBaseTest = _findBaselineTest(oBaseline, oValue.oTest);
+    if oBaseTest is not None:
+        for oBaseValue in oBaseTest.aoValues:
+            if oBaseValue.sName == oValue.sName:
+                return oBaseValue;
+    return None;
+
+def baselineDiff(oTestTree, oBaseline):
+    """
+    Diffs oTestTree against oBaseline, adding diff info to oTestTree.
+    Returns oTestTree on success, None on failure (complained already).
+    """
+
+    aoStack  = [];
+    aoStack.append((oTestTree, 0));
+    while len(aoStack) > 0:
+        oCurTest, iChild = aoStack.pop();
+
+        # depth first
+        if iChild < len(oCurTest.aoChildren):
+            aoStack.append((oCurTest, iChild + 1));
+            aoStack.append((oCurTest.aoChildren[iChild], 0));
+            continue;
+
+        # do value diff.
+        for i in range(len(oCurTest.aoValues)):
+            oBaseVal = _findBaselineTestValue(oBaseline, oCurTest.aoValues[i]);
+            if oBaseVal is not None:
+                try:
+                    lBase = long(oBaseVal.sValue);
+                    lTest = long(oCurTest.aoValues[i].sValue);
+                except:
+                    try:
+                        if oBaseVal.sValue == oCurTest.aoValues[i].sValue:
+                            oCurTest.aoValues[i].sValue += '|';
+                        else:
+                            oCurTest.aoValues[i].sValue += '|%s' % (oBaseVal.sValue);
+                    except:
+                        oCurTest.aoValues[i].sValue += '|%s' % (oBaseVal.sValue);
+                else:
+                    if lTest > lBase:
+                        oCurTest.aoValues[i].sValue += '|+%u' % (lTest - lBase);
+                    elif lTest < lBase:
+                        oCurTest.aoValues[i].sValue += '|-%u' % (lBase - lTest);
+                    else:
+                        oCurTest.aoValues[i].sValue += '|0';
+            else:
+                oCurTest.aoValues[i].sValue += '|N/A';
+
+    return oTestTree;
diff --git a/src/VBox/ValidationKit/testanalysis/reader.py b/src/VBox/ValidationKit/testanalysis/reader.py
new file mode 100644
index 0000000..38f3f7a
--- /dev/null
+++ b/src/VBox/ValidationKit/testanalysis/reader.py
@@ -0,0 +1,291 @@
+# -*- coding: utf-8 -*-
+# $Id: reader.py $
+
+"""
+XML reader module.
+
+This produces a test result tree that can be processed and passed to
+reporting.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+__all__     = ['ParseTestResult', ]
+
+# Standard python imports.
+import os
+import traceback
+
+# pylint: disable=C0111
+
+class Value(object):
+    """
+    Represents a value.  Usually this is benchmark result or parameter.
+    """
+    def __init__(self, oTest, hsAttrs):
+        self.oTest      = oTest;
+        self.sName      = hsAttrs['name'];
+        self.sUnit      = hsAttrs['unit'];
+        self.sTimestamp = hsAttrs['timestamp'];
+        self.sValue     = '';
+        self.sDiff      = None;
+
+    # parsing
+
+    def addData(self, sData):
+        self.sValue    += sData;
+
+    # debug
+
+    def printValue(self, cIndent):
+        print '%sValue: name=%s timestamp=%s unit=%s value="%s"' \
+                % (''.ljust(cIndent*2), self.sName, self.sTimestamp, self.sUnit, self.sValue);
+
+
+class Test(object):
+    """
+    Nested test result.
+    """
+    def __init__(self, oParent, hsAttrs):
+        self.aoChildren     = [];
+        self.aoValues       = [];
+        self.oParent        = oParent;
+        self.sName          = hsAttrs['name'];
+        self.sStartTS       = hsAttrs['timestamp'];
+        self.sEndTS         = None;
+        self.sStatus        = None;
+        self.cErrors        = -1;
+        self.sStatusDiff    = None;
+        self.cErrorsDiff    = None;
+
+    # parsing
+
+    def addChild(self, oChild):
+        self.aoChildren.append(oChild);
+        return oChild;
+
+    def addValue(self, hsAttrs):
+        oValue = hsAttrs['value'];
+        self.aoValues.append(oValue);
+        return oValue;
+
+    def markPassed(self, hsAttrs):
+        try:    self.sEndTS = hsAttrs['timestamp'];
+        except: pass;
+        self.sStatus = 'passed';
+        self.cErrors = 0;
+
+    def markSkipped(self, hsAttrs):
+        try:    self.sEndTS = hsAttrs['timestamp'];
+        except: pass;
+        self.sStatus = 'skipped';
+        self.cErrors = 0;
+
+    def markFailed(self, hsAttrs):
+        try:    self.sEndTS = hsAttrs['timestamp'];
+        except: pass;
+        self.sStatus = 'failed';
+        self.cErrors = int(hsAttrs['errors']);
+
+    def markEnd(self, hsAttrs):
+        try:    self.sEndTS = hsAttrs['timestamp'];
+        except: pass;
+        if self.sStatus is None:
+            self.sStatus = 'end';
+            self.cErrors = 0;
+
+    def mergeInIncludedTest(self, oTest):
+        """ oTest will be robbed. """
+        if oTest is not None:
+            for oChild in oTest.aoChildren:
+                oChild.oParent = self;
+                self.aoChildren.append(oChild);
+            for oValue in oTest.aoValues:
+                oValue.oTest = self;
+                self.aoValues.append(oValue);
+            oTest.aoChildren = [];
+            oTest.aoValues   = [];
+
+    # debug
+
+    def printTree(self, iLevel = 0):
+        print '%sTest: name=%s start=%s end=%s' % (''.ljust(iLevel*2), self.sName, self.sStartTS, self.sEndTS);
+        for oChild in self.aoChildren:
+            oChild.printTree(iLevel + 1);
+        for oValue in self.aoValues:
+            oValue.printValue(iLevel + 1);
+
+    # getters / queries
+
+    def getFullNameWorker(self, cSkipUpper):
+        if self.oParent is None:
+            return (self.sName, 0);
+        sName, iLevel = self.oParent.getFullNameWorker(cSkipUpper);
+        if iLevel < cSkipUpper:
+            sName = self.sName;
+        else:
+            sName += ', ' + self.sName;
+        return (sName, iLevel + 1);
+
+    def getFullName(self, cSkipUpper = 2):
+        return self.getFullNameWorker(cSkipUpper)[0];
+
+    def matchFilters(self, asFilters):
+        """
+        Checks if the all of the specified filter strings are substrings
+        of the full test name.  Returns True / False.
+        """
+        sName = self.getFullName();
+        for sFilter in asFilters:
+            if sName.find(sFilter) < 0:
+                return False;
+        return True;
+
+    # manipulation
+
+    def filterTestsWorker(self, asFilters):
+        # depth first
+        i = 0;
+        while i < len(self.aoChildren):
+            if self.aoChildren[i].filterTestsWorker(asFilters):
+                i += 1;
+            else:
+                self.aoChildren[i].oParent = None;
+                del self.aoChildren[i];
+
+        # If we have children, they must've matched up.
+        if len(self.aoChildren) != 0:
+            return True;
+        return self.matchFilters(asFilters);
+
+    def filterTests(self, asFilters):
+        if len(asFilters) > 0:
+            self.filterTestsWorker(asFilters)
+        return self;
+
+
+class XmlLogReader(object):
+    """
+    XML log reader class.
+    """
+
+    def __init__(self, sXmlFile):
+        self.sXmlFile = sXmlFile;
+        self.oRoot    = Test(None, {'name': 'root', 'timestamp': ''});
+        self.oTest    = self.oRoot;
+        self.iLevel   = 0;
+        self.oValue   = None;
+
+    def parse(self):
+        try:
+            oFile = open(self.sXmlFile, 'r');
+        except:
+            traceback.print_exc();
+            return False;
+
+        from xml.parsers.expat import ParserCreate
+        oParser = ParserCreate();
+        oParser.StartElementHandler  = self.handleElementStart;
+        oParser.CharacterDataHandler = self.handleElementData;
+        oParser.EndElementHandler    = self.handleElementEnd;
+        try:
+            oParser.ParseFile(oFile);
+        except:
+            traceback.print_exc();
+            oFile.close();
+            return False;
+        oFile.close();
+        return True;
+
+    def handleElementStart(self, sName, hsAttrs):
+        #print '%s%s: %s' % (''.ljust(self.iLevel * 2), sName, str(hsAttrs));
+        if sName == 'Test' or sName == 'SubTest':
+            self.iLevel += 1;
+            self.oTest = self.oTest.addChild(Test(self.oTest, hsAttrs));
+        elif sName == 'Value':
+            self.oValue = self.oTest.addValue(hsAttrs);
+        elif sName == 'End':
+            self.oTest.markEnd(hsAttrs);
+        elif sName == 'Passed':
+            self.oTest.markPassed(hsAttrs);
+        elif sName == 'Skipped':
+            self.oTest.markSkipped(hsAttrs);
+        elif sName == 'Failed':
+            self.oTest.markFailed(hsAttrs);
+        elif sName == 'Include':
+            self.handleInclude(hsAttrs);
+        else:
+            print 'Unknonwn element "%s"' % (sName);
+
+    def handleElementData(self, sData):
+        if self.oValue is not None:
+            self.oValue.addData(sData);
+        elif sData.strip() != '':
+            print 'Unexpected data "%s"' % (sData);
+        return True;
+
+    def handleElementEnd(self, sName):
+        if sName == 'Test' or sName == 'Subtest':
+            self.iLevel -= 1;
+            self.oTest = self.oTest.oParent;
+        elif sName == 'Value':
+            self.oValue = None;
+        return True;
+
+    def handleInclude(self, hsAttrs):
+        # relative or absolute path.
+        sXmlFile = hsAttrs['filename'];
+        if not os.path.isabs(sXmlFile):
+            sXmlFile = os.path.join(os.path.dirname(self.sXmlFile), sXmlFile);
+
+        # Try parse it.
+        oSub = parseTestResult(sXmlFile);
+        if oSub is None:
+            print 'error: failed to parse include "%s"' % (sXmlFile);
+        else:
+            # Skip the root and the next level before merging it the subtest and
+            # values in to the current test.  The reason for this is that the
+            # include is the output of some sub-program we've run and we don't need
+            # the extra test level it automatically adds.
+            #
+            # More benchmark heuristics: Walk down until we find more than one
+            # test or values.
+            oSub2 = oSub;
+            while len(oSub2.aoChildren) == 1 and len(oSub2.aoValues) == 0:
+                oSub2 = oSub2.aoChildren[0];
+            if len(oSub2.aoValues) == 0:
+                oSub2 = oSub;
+            self.oTest.mergeInIncludedTest(oSub2);
+        return True;
+
+def parseTestResult(sXmlFile):
+    """
+    Parses the test results in the XML.
+    Returns result tree.
+    Returns None on failure.
+    """
+    oXlr = XmlLogReader(sXmlFile);
+    if oXlr.parse():
+        return oXlr.oRoot;
+    return None;
+
diff --git a/src/VBox/ValidationKit/testanalysis/reporting.py b/src/VBox/ValidationKit/testanalysis/reporting.py
new file mode 100644
index 0000000..aef5505
--- /dev/null
+++ b/src/VBox/ValidationKit/testanalysis/reporting.py
@@ -0,0 +1,302 @@
+# -*- coding: utf-8 -*-
+# $Id: reporting.py $
+
+"""
+Test Result Report Writer.
+
+This takes a processed test result tree and creates a HTML, re-structured text,
+or normal text report from it.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+__all__     = ['HtmlReport', 'RstReport', 'TextReport'];
+
+
+def tryAddThousandSeparators(sPotentialInterger):
+    """ Apparently, python 3.0(/3.1) has(/will have) support for this..."""
+    # Try convert the string/value to a long.
+    try:
+        lVal = long(sPotentialInterger);
+        lVal = long(sPotentialInterger);
+    except:
+        return sPotentialInterger;
+
+    # Convert it back to a string (paranoia) and build up the new string.
+    sOld      = str(lVal);
+    chSign    = '';
+    if sOld[0] == '-':
+        chSign = '-';
+        sOld = sOld[1:];
+    elif sPotentialInterger[0] == '+':
+        chSign = '+';
+    cchDigits = len(sOld);
+    iDigit    = 0
+    sNewVal   = '';
+    while iDigit < cchDigits:
+        if (iDigit % 3) == 0 and iDigit > 0:
+            sNewVal = ' ' + sNewVal;
+        sNewVal = sOld[cchDigits - iDigit - 1] + sNewVal;
+        iDigit += 1;
+    return chSign + sNewVal;
+
+
+class Table(object):
+    """
+    A table as a header as well as data rows, thus this class.
+    """
+    def __init__(self, oTest, fSplitDiff):
+        self.aasRows  = [];
+        self.asHeader = ['Test',];
+        self.asUnits  = ['',];
+        for oValue in oTest.aoValues:
+            self.asHeader.append(oValue.sName);
+            self.asUnits.append(oValue.sUnit);
+        self.addRow(oTest, fSplitDiff);
+
+    def addRow(self, oTest, fSplitDiff):
+        """Adds a row."""
+        asRow = [oTest.getFullName(),];
+        for oValue in oTest.aoValues:
+            asRow.append(oValue.sValue);
+        if not fSplitDiff:
+            self.aasRows.append(asRow);
+        else:
+            # Split cells into multiple rows on '|'. Omit the first column.
+            iRow = 0;
+            asThisRow = [asRow[0], ];
+            fMoreTodo = True;
+            while fMoreTodo:
+                for i in range(1, len(asRow)):
+                    asSplit = asRow[i].split('|');
+                    asThisRow.append(asSplit[0]);
+                    asRow[i] = '|'.join(asSplit[1:])
+                self.aasRows.append(asThisRow);
+
+                # Done?
+                fMoreTodo = False;
+                for i in range(1, len(asRow)):
+                    if len(asRow[i]):
+                        fMoreTodo = True;
+                asThisRow = ['', ];
+                iRow += 1;
+
+            # Readability hack: Add an extra row if there are diffs.
+            if iRow > 1:
+                asRow[0] = '';
+                self.aasRows.append(asRow);
+
+        return True;
+
+    def hasTheSameHeadingAsTest(self, oTest):
+        """ Checks if the test values has the same heading."""
+        i = 1;
+        for oValue in oTest.aoValues:
+            if self.asHeader[i] != oValue.sName:
+                return False;
+            if self.asUnits[i]  != oValue.sUnit:
+                return False;
+            i += 1;
+        return True;
+
+    def hasTheSameHeadingAsTable(self, oTable):
+        """ Checks if the other table has the same heading."""
+        if len(oTable.asHeader) != len(self.asHeader):
+            return False;
+        for i in range(len(self.asHeader)):
+            if self.asHeader[i] != oTable.asHeader[i]:
+                return False;
+            if self.asUnits[i]  != oTable.asUnits[i]:
+                return False;
+        return True;
+
+    def appendTable(self, oTable):
+        """ Append the rows in oTable.  oTable has the same heading as us. """
+        self.aasRows.extend(oTable.aasRows);
+        return True;
+
+    # manipulation and stuff
+
+    def optimizeUnit(self):
+        """ Turns bytes into KB, MB or GB. """
+        ## @todo
+        pass;
+
+    def addThousandSeparators(self):
+        """ Adds thousand separators to make numbers more readable. """
+        for iRow in range(len(self.aasRows)):
+            for iColumn in range(1, len(self.aasRows[iRow])):
+                asValues = self.aasRows[iRow][iColumn].split('|');
+                for i in range(len(asValues)):
+                    asValues[i] = tryAddThousandSeparators(asValues[i]);
+                self.aasRows[iRow][iColumn] = '|'.join(asValues);
+        return True;
+
+    def getRowWidths(self):
+        """Figure out the column withs."""
+        # Header is first.
+        acchColumns = [];
+        for i in range(len(self.asHeader)):
+            cch = 1;
+            asWords = self.asHeader[i].split();
+            for s in asWords:
+                if len(s) > cch:
+                    cch = len(s);
+            if i > 0 and len(self.asUnits[i]) > cch:
+                cch = len(self.asUnits[i]);
+            acchColumns.append(cch);
+
+        # Check out all cells.
+        for asColumns in self.aasRows:
+            for i in range(len(asColumns)):
+                if len(asColumns[i]) > acchColumns[i]:
+                    acchColumns[i] = len(asColumns[i]);
+        return acchColumns;
+
+
+def tabelizeTestResults(oTest, fSplitDiff):
+    """
+    Break the test results down into a list of tables containing the values.
+
+    TODO: Handle passed / failed stuff too. Not important for benchmarks.
+    """
+    # Pass 1
+    aoTables = [];
+    aoStack  = [];
+    aoStack.append((oTest, 0));
+    while len(aoStack) > 0:
+        oCurTest, iChild =  aoStack.pop();
+
+        # depth first
+        if iChild < len(oCurTest.aoChildren):
+            aoStack.append((oCurTest, iChild + 1));
+            aoStack.append((oCurTest.aoChildren[iChild], 0));
+            continue;
+
+        # values -> row
+        if len(oCurTest.aoValues) > 0:
+            if len(aoTables) > 0 and aoTables[len(aoTables) - 1].hasTheSameHeadingAsTest(oCurTest):
+                aoTables[len(aoTables) - 1].addRow(oCurTest, fSplitDiff);
+            else:
+                aoTables.append(Table(oCurTest, fSplitDiff));
+
+    # Pass 2 - Combine tables with the same heading.
+    aoTables2 = [];
+    for oTable in aoTables:
+        for i in range(len(aoTables2)):
+            if aoTables2[i].hasTheSameHeadingAsTable(oTable):
+                aoTables2[i].appendTable(oTable);
+                oTable = None;
+                break;
+        if oTable is not None:
+            aoTables2.append(oTable);
+
+    return aoTables2;
+
+def produceHtmlReport(oTest):
+    """
+    Produce an HTML report on stdout (via print).
+    """
+    print 'not implemented: %s' % (oTest);
+    return False;
+
+def produceReStructuredTextReport(oTest):
+    """
+    Produce a ReStructured text report on stdout (via print).
+    """
+    print 'not implemented: %s' % (oTest);
+    return False;
+
+def produceTextReport(oTest):
+    """
+    Produce a text report on stdout (via print).
+    """
+
+    #
+    # Report header.
+    #
+    ## @todo later
+
+    #
+    # Tabelize the the results and display the tables.
+    #
+    aoTables = tabelizeTestResults(oTest, True)
+    for oTable in aoTables:
+        ## @todo do max/min on the columns where we can do [GMK]B(/s).
+        oTable.addThousandSeparators();
+        acchColumns = oTable.getRowWidths();
+
+        # The header.
+        # This is a bit tedious and the solution isn't entirely elegant due
+        # to the pick-it-up-as-you-go-along python skills.
+        aasHeader = [];
+        aasHeader.append([]);
+        for i in range(len(oTable.asHeader)):
+            aasHeader[0].append('');
+
+        for iColumn in range(len(oTable.asHeader)):
+            asWords = oTable.asHeader[iColumn].split();
+            iLine   = 0;
+            for s in asWords:
+                if len(aasHeader[iLine][iColumn]) <= 0:
+                    aasHeader[iLine][iColumn] = s;
+                elif len(s) + 1 + len(aasHeader[iLine][iColumn]) <= acchColumns[iColumn]:
+                    aasHeader[iLine][iColumn] += ' ' + s;
+                else:
+                    iLine += 1;
+                    if iLine >= len(aasHeader):  # There must be a better way to do this...
+                        aasHeader.append([]);
+                        for i in range(len(oTable.asHeader)):
+                            aasHeader[iLine].append('');
+                    aasHeader[iLine][iColumn] = s;
+
+        for asLine in aasHeader:
+            sLine = '';
+            for i in range(len(asLine)):
+                if i > 0: sLine += '  ';
+                sLine += asLine[i].center(acchColumns[i]);
+            print sLine;
+
+        # Units.
+        sLine = '';
+        for i in range(len(oTable.asUnits)):
+            if i > 0: sLine += '  ';
+            sLine += oTable.asUnits[i].center(acchColumns[i]);
+        print sLine;
+
+        # Separator line.
+        sLine = '';
+        for i in range(len(oTable.asHeader)):
+            if i > 0: sLine += '  '
+            sLine += '=' * acchColumns[i];
+        print sLine;
+
+        # The rows.
+        for asColumns in oTable.aasRows:
+            sText = asColumns[0].ljust(acchColumns[0]);
+            for i in range(1, len(asColumns)):
+                sText += '  ' + asColumns[i].rjust(acchColumns[i]);
+            print sText;
+
+    return None;
+
diff --git a/src/VBox/ValidationKit/testanalysis/tst-a1.py b/src/VBox/ValidationKit/testanalysis/tst-a1.py
new file mode 100755
index 0000000..be85ac2
--- /dev/null
+++ b/src/VBox/ValidationKit/testanalysis/tst-a1.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tst-a1.py $
+
+"""
+Analyzer Experiment  1.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+import os.path
+import sys
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testanalysis import reader    ## @todo fix testanalysis/__init__.py.
+from testanalysis import reporting
+from testanalysis import diff
+
+
+def usage():
+    """ Display usage """
+    print 'usage: %s [options] <testresults.xml> [baseline.xml]' % (sys.argv[0]);
+    print ''
+    print 'options:'
+    print '  --filter <test-sub-string>'
+    return 1;
+
+def main(asArgs):
+    """ C styl main(). """
+    # Parse arguments
+    sTestFile = None;
+    sBaseFile = None;
+    asFilters = [];
+    iArg = 1;
+    while iArg < len(asArgs):
+        if asArgs[iArg] == '--filter':
+            iArg += 1;
+            asFilters.append(asArgs[iArg]);
+        elif asArgs[iArg].startswith('--help'):
+            return usage();
+        elif asArgs[iArg].startswith('--'):
+            print 'syntax error: unknown option "%s"' % (asArgs[iArg]);
+            return usage();
+        elif sTestFile is None:
+            sTestFile = asArgs[iArg];
+        elif sBaseFile is None:
+            sBaseFile = asArgs[iArg];
+        else:
+            print 'syntax error: too many file names: %s' % (asArgs[iArg])
+            return usage();
+        iArg += 1;
+
+    # Down to business
+    oTestTree = reader.parseTestResult(sTestFile);
+    if oTestTree is None:
+        return 1;
+    oTestTree = oTestTree.filterTests(asFilters)
+
+    if sBaseFile is not None:
+        oBaseline = reader.parseTestResult(sBaseFile);
+        if oBaseline is None:
+            return 1;
+        oTestTree = diff.baselineDiff(oTestTree, oBaseline);
+        if oTestTree is None:
+            return 1;
+
+    reporting.produceTextReport(oTestTree);
+    return 0;
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/testboxscript/Makefile.kmk b/src/VBox/ValidationKit/testboxscript/Makefile.kmk
new file mode 100644
index 0000000..19add1b
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/Makefile.kmk
@@ -0,0 +1,83 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - TestBox Script.
+#
+
+#
+# Copyright (C) 2012-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+#
+# The TestBox script.
+#
+INSTALLS += testboxscript
+testboxscript_TEMPLATE = VBoxValidationKitR3
+testboxscript_INST = $(INST_TESTBOXSCRIPT)testboxscript/
+testboxscript_EXEC_SOURCES = \
+	testboxscript.py \
+	testboxscript_real.py \
+	setup.sh
+testboxscript_SOURCES = \
+	testboxcommand.py \
+	testboxcommons.py \
+	testboxconnection.py \
+	testboxtasks.py \
+	testboxupgrade.py
+
+testboxscript_SOURCES.darwin = \
+	darwin/setup-routines.sh=>darwin/setup-routines.sh
+
+testboxscript_EXEC_SOURCES.linux = \
+	linux/testboxscript-service.sh=>linux/testboxscript-service.sh
+testboxscript_SOURCES.linux = \
+       ../../Installer/linux/routines.sh=>linux/setup-installer-routines.sh \
+	linux/setup-routines.sh=>linux/setup-routines.sh
+
+testboxscript_SOURCES.solaris = \
+	solaris/setup-routines.sh=>solaris/setup-routines.sh \
+
+testboxscript_SOURCES.win = \
+	win/autoexec-testbox.cmd=>win/autoexec-testbox.cmd \
+	win/readme.txt=>win/readme.txt
+
+
+#
+# Helper program, mostly for obtaining system information.
+#
+PROGRAMS += TestBoxHelper
+TestBoxHelper_TEMPLATE = VBoxValidationKitR3
+TestBoxHelper_INST     = $(INST_TESTBOXSCRIPT)$(KBUILD_TARGET)/$(KBUILD_TARGET_ARCH)/
+TestBoxHelper_SOURCES  = TestBoxHelper.cpp
+TestBoxHelper_LIBS.win = $(PATH_SDK_$(VBOX_WINDDK)_LIB)/wbemuuid.lib
+TestBoxHelper_LDFLAGS.darwin = -framework CoreFoundation
+
+
+#
+# Generate pylint & pychecker targets.
+#
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testboxscript/TestBoxHelper.cpp b/src/VBox/ValidationKit/testboxscript/TestBoxHelper.cpp
new file mode 100644
index 0000000..80a33e2
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/TestBoxHelper.cpp
@@ -0,0 +1,442 @@
+/* $Id: TestBoxHelper.cpp $ */
+/** @file
+ * VirtualBox Validation Kit - Testbox C Helper Utility.
+ */
+
+/*
+ * Copyright (C) 2012-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/buildconfig.h>
+#include <iprt/env.h>
+#include <iprt/initterm.h>
+#include <iprt/message.h>
+#include <iprt/mp.h>
+#include <iprt/string.h>
+#include <iprt/stream.h>
+#include <iprt/system.h>
+
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+# include <iprt/x86.h>
+# include <iprt/asm-amd64-x86.h>
+#endif
+
+#ifdef RT_OS_DARWIN
+# include <sys/types.h>
+# include <sys/sysctl.h>
+#endif
+
+
+/**
+ * Generates a kind of report of the hardware, software and whatever else we
+ * think might be useful to know about the testbox.
+ */
+static RTEXITCODE handlerReport(int argc, char **argv)
+{
+    NOREF(argc); NOREF(argv);
+
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+    /*
+     * For now, a simple CPUID dump.  Need to figure out how to share code
+     * like this with other bits, putting it in IPRT.
+     */
+    RTPrintf("CPUID Dump\n"
+             "Leaf      eax      ebx      ecx      edx\n"
+             "---------------------------------------------\n");
+    static uint32_t const s_auRanges[] =
+    {
+        UINT32_C(0x00000000),
+        UINT32_C(0x80000000),
+        UINT32_C(0x80860000),
+        UINT32_C(0xc0000000),
+        UINT32_C(0x40000000),
+    };
+    for (uint32_t iRange = 0; iRange < RT_ELEMENTS(s_auRanges); iRange++)
+    {
+        uint32_t const uFirst = s_auRanges[iRange];
+
+        uint32_t uEax, uEbx, uEcx, uEdx;
+        ASMCpuIdExSlow(uFirst, 0, 0, 0, &uEax, &uEbx, &uEcx, &uEdx);
+        if (uEax >= uFirst && uEax < uFirst + 100)
+        {
+            uint32_t const cLeafs = RT_MIN(uEax - uFirst + 1, 32);
+            for (uint32_t iLeaf = 0; iLeaf < cLeafs; iLeaf++)
+            {
+                uint32_t uLeaf = uFirst + iLeaf;
+                ASMCpuIdExSlow(uLeaf, 0, 0, 0, &uEax, &uEbx, &uEcx, &uEdx);
+
+                /* Clear APIC IDs to avoid submitting new reports all the time. */
+                if (uLeaf == 1)
+                    uEbx &= UINT32_C(0x00ffffff);
+                if (uLeaf == 0xb)
+                    uEdx  = 0;
+                if (uLeaf == 0x8000001e)
+                    uEax  = 0;
+
+                /* Clear some other node/cpu/core/thread ids. */
+                if (uLeaf == 0x8000001e)
+                {
+                    uEbx &= UINT32_C(0xffffff00);
+                    uEcx &= UINT32_C(0xffffff00);
+                }
+
+                RTPrintf("%08x: %08x %08x %08x %08x\n", uLeaf, uEax, uEbx, uEcx, uEdx);
+            }
+        }
+    }
+    RTPrintf("\n");
+
+    /*
+     * DMI info.
+     */
+    RTPrintf("DMI Info\n"
+             "--------\n");
+    static const struct { const char *pszName; RTSYSDMISTR enmDmiStr; } s_aDmiStrings[] =
+    {
+        { "Product Name",           RTSYSDMISTR_PRODUCT_NAME },
+        { "Product version",        RTSYSDMISTR_PRODUCT_VERSION },
+        { "Product UUID",           RTSYSDMISTR_PRODUCT_UUID },
+        { "Product Serial",         RTSYSDMISTR_PRODUCT_SERIAL },
+        { "System Manufacturer",    RTSYSDMISTR_MANUFACTURER },
+    };
+    for (uint32_t iDmiString = 0; iDmiString < RT_ELEMENTS(s_aDmiStrings); iDmiString++)
+    {
+        char szTmp[4096];
+        RT_ZERO(szTmp);
+        int rc = RTSystemQueryDmiString(s_aDmiStrings[iDmiString].enmDmiStr, szTmp, sizeof(szTmp) - 1);
+        if (RT_SUCCESS(rc))
+            RTPrintf("%25s: %s\n", s_aDmiStrings[iDmiString].pszName, RTStrStrip(szTmp));
+        else
+            RTPrintf("%25s: %s [rc=%Rrc]\n", s_aDmiStrings[iDmiString].pszName, RTStrStrip(szTmp), rc);
+    }
+    RTPrintf("\n");
+
+#else
+#endif
+
+    /*
+     * Dump the environment.
+     */
+    RTPrintf("Environment\n"
+             "-----------\n");
+    RTENV hEnv;
+    int rc = RTEnvClone(&hEnv, RTENV_DEFAULT);
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t cVars = RTEnvCountEx(hEnv);
+        for (uint32_t iVar = 0; iVar < cVars; iVar++)
+        {
+            char szVar[1024];
+            char szValue[16384];
+            rc = RTEnvGetByIndexEx(hEnv, iVar, szVar, sizeof(szVar), szValue, sizeof(szValue));
+
+            /* zap the value of variables that are subject to change. */
+            if (   (RT_SUCCESS(rc) || rc == VERR_BUFFER_OVERFLOW)
+                && (   !strcmp(szVar, "TESTBOX_SCRIPT_REV")
+                    || !strcmp(szVar, "TESTBOX_ID")
+                    || !strcmp(szVar, "TESTBOX_SCRATCH_SIZE")
+                    || !strcmp(szVar, "TESTBOX_TIMEOUT")
+                    || !strcmp(szVar, "TESTBOX_TIMEOUT_ABS")
+                    || !strcmp(szVar, "TESTBOX_TEST_SET_ID")
+                   )
+               )
+               strcpy(szValue, "<volatile>");
+
+            if (RT_SUCCESS(rc))
+                RTPrintf("%25s=%s\n", szVar, szValue);
+            else if (rc == VERR_BUFFER_OVERFLOW)
+                RTPrintf("%25s=%s [VERR_BUFFER_OVERFLOW]\n", szVar, szValue);
+            else
+                RTPrintf("rc=%Rrc\n", rc);
+        }
+        RTEnvDestroy(hEnv);
+    }
+
+    /** @todo enumerate volumes and whatnot.  */
+
+    int cch = RTPrintf("\n");
+    return cch > 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+}
+
+
+/** Print the total memory size in bytes. */
+static RTEXITCODE handlerMemSize(int argc, char **argv)
+{
+    NOREF(argc); NOREF(argv);
+
+    uint64_t cb;
+    int rc = RTSystemQueryTotalRam(&cb);
+    if (RT_SUCCESS(rc))
+    {
+        int cch = RTPrintf("%llu\n", cb);
+        return cch > 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+    }
+    RTPrintf("%Rrc\n", rc);
+    return RTEXITCODE_FAILURE;
+}
+
+typedef enum { HWVIRTTYPE_NONE, HWVIRTTYPE_VTX, HWVIRTTYPE_AMDV } HWVIRTTYPE;
+static HWVIRTTYPE isHwVirtSupported(void)
+{
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+    uint32_t uEax, uEbx, uEcx, uEdx;
+
+    /* VT-x */
+    ASMCpuId(0x00000000, &uEax, &uEbx, &uEcx, &uEdx);
+    if (ASMIsValidStdRange(uEax))
+    {
+        ASMCpuId(0x00000001, &uEax, &uEbx, &uEcx, &uEdx);
+        if (uEcx & X86_CPUID_FEATURE_ECX_VMX)
+            return HWVIRTTYPE_VTX;
+    }
+
+    /* AMD-V */
+    ASMCpuId(0x80000000, &uEax, &uEbx, &uEcx, &uEdx);
+    if (ASMIsValidExtRange(uEax))
+    {
+        ASMCpuId(0x80000001, &uEax, &uEbx, &uEcx, &uEdx);
+        if (uEcx & X86_CPUID_AMD_FEATURE_ECX_SVM)
+            return HWVIRTTYPE_AMDV;
+    }
+#endif
+
+    return HWVIRTTYPE_NONE;
+}
+
+/** Print the 'true' if VT-x or AMD-v is supported, 'false' it not. */
+static RTEXITCODE handlerCpuHwVirt(int argc, char **argv)
+{
+    NOREF(argc); NOREF(argv);
+    int cch = RTPrintf(isHwVirtSupported() != HWVIRTTYPE_NONE ? "true\n" : "false\n");
+    return cch > 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+}
+
+
+/** Print the 'true' if nested paging is supported, 'false' if not and
+ * 'dunno' if we cannot tell. */
+static RTEXITCODE handlerCpuNestedPaging(int argc, char **argv)
+{
+    NOREF(argc); NOREF(argv);
+    HWVIRTTYPE  enmHwVirt  = isHwVirtSupported();
+    int         fSupported = -1;
+
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+    if (enmHwVirt == HWVIRTTYPE_AMDV)
+    {
+        uint32_t uEax, uEbx, uEcx, uEdx;
+        ASMCpuId(0x80000000, &uEax, &uEbx, &uEcx, &uEdx);
+        if (ASMIsValidExtRange(uEax) && uEax >= 0x8000000a)
+        {
+            ASMCpuId(0x8000000a, &uEax, &uEbx, &uEcx, &uEdx);
+            if (uEdx & RT_BIT(0) /* AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING */)
+                fSupported = 1;
+            else
+                fSupported = 0;
+        }
+    }
+#endif
+
+    int cch = RTPrintf(fSupported == 1 ? "true\n" : fSupported == 0 ? "false\n" : "dunno\n");
+    return cch > 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+}
+
+
+/** Print the 'true' if long mode guests are supported, 'false' if not and
+ * 'dunno' if we cannot tell. */
+static RTEXITCODE handlerCpuLongMode(int argc, char **argv)
+{
+    NOREF(argc); NOREF(argv);
+    HWVIRTTYPE  enmHwVirt  = isHwVirtSupported();
+    int         fSupported = 0;
+
+    if (enmHwVirt != HWVIRTTYPE_NONE)
+    {
+#if defined(RT_ARCH_AMD64)
+        fSupported = 1; /* We're running long mode, so it must be supported. */
+
+#elif defined(RT_ARCH_X86)
+# ifdef RT_OS_DARWIN
+        /* On darwin, we just ask the kernel via sysctl. Rules are a bit different here. */
+        int     f64bitCapable = 0;
+        size_t  cbParameter   = sizeof(f64bitCapable);
+        int rc = sysctlbyname("hw.cpu64bit_capable", &f64bitCapable, &cbParameter, NULL, NULL);
+        if (rc != -1)
+            fSupported = f64bitCapable != 0;
+        else
+# endif
+        {
+            /* PAE and HwVirt are required */
+            uint32_t uEax, uEbx, uEcx, uEdx;
+            ASMCpuId(0x00000000, &uEax, &uEbx, &uEcx, &uEdx);
+            if (ASMIsValidStdRange(uEax))
+            {
+                ASMCpuId(0x00000001, &uEax, &uEbx, &uEcx, &uEdx);
+                if (uEdx & X86_CPUID_FEATURE_EDX_PAE)
+                {
+                    /* AMD will usually advertise long mode in 32-bit mode. Intel OTOH,
+                       won't necessarily do so. */
+                    ASMCpuId(0x80000000, &uEax, &uEbx, &uEcx, &uEdx);
+                    if (ASMIsValidExtRange(uEax))
+                    {
+                        ASMCpuId(0x80000001, &uEax, &uEbx, &uEcx, &uEdx);
+                        if (uEdx & X86_CPUID_EXT_FEATURE_EDX_LONG_MODE)
+                            fSupported = 1;
+                        else if (enmHwVirt != HWVIRTTYPE_AMDV)
+                            fSupported = -1;
+                    }
+                }
+            }
+        }
+#endif
+    }
+
+    int cch = RTPrintf(fSupported == 1 ? "true\n" : fSupported == 0 ? "false\n" : "dunno\n");
+    return cch > 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+}
+
+
+/** Print the CPU 'revision', if available. */
+static RTEXITCODE handlerCpuRevision(int argc, char **argv)
+{
+    NOREF(argc); NOREF(argv);
+
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+    uint32_t uEax, uEbx, uEcx, uEdx;
+    ASMCpuId(0, &uEax, &uEbx, &uEcx, &uEdx);
+    if (ASMIsValidStdRange(uEax) && uEax >= 1)
+    {
+        uint32_t uEax1 = ASMCpuId_EAX(1);
+        uint32_t uVersion = (ASMGetCpuFamily(uEax1) << 24)
+                          | (ASMGetCpuModel(uEax1, ASMIsIntelCpuEx(uEbx, uEcx, uEdx)) << 8)
+                          | ASMGetCpuStepping(uEax1);
+        int cch = RTPrintf("%#x\n", uVersion);
+        return cch > 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+    }
+#endif
+    return RTEXITCODE_FAILURE;
+}
+
+
+/** Print the CPU name, if available. */
+static RTEXITCODE handlerCpuName(int argc, char **argv)
+{
+    NOREF(argc); NOREF(argv);
+
+    char szTmp[1024];
+    int rc = RTMpGetDescription(NIL_RTCPUID, szTmp, sizeof(szTmp));
+    if (RT_SUCCESS(rc))
+    {
+        int cch = RTPrintf("%s\n", RTStrStrip(szTmp));
+        return cch > 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+    }
+    return RTEXITCODE_FAILURE;
+}
+
+
+/** Print the CPU vendor name, 'GenuineIntel' and such. */
+static RTEXITCODE handlerCpuVendor(int argc, char **argv)
+{
+    NOREF(argc); NOREF(argv);
+
+#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
+    uint32_t uEax, uEbx, uEcx, uEdx;
+    ASMCpuId(0, &uEax, &uEbx, &uEcx, &uEdx);
+    int cch = RTPrintf("%.04s%.04s%.04s\n", &uEbx, &uEdx, &uEcx);
+#else
+    int cch = RTPrintf("%s\n", RTBldCfgTargetArch());
+#endif
+    return cch > 0 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+}
+
+
+
+int main(int argc, char **argv)
+{
+    int rc = RTR3InitExe(argc, &argv, 0);
+    if (RT_FAILURE(rc))
+        return RTMsgInitFailure(rc);
+
+    /*
+     * The first argument is a command.  Figure out which and call its handler.
+     */
+    static const struct
+    {
+        const char     *pszCommand;
+        RTEXITCODE    (*pfnHandler)(int argc, char **argv);
+        bool            fNoArgs;
+    } s_aHandlers[] =
+    {
+        { "cpuvendor",      handlerCpuVendor,       true },
+        { "cpuname",        handlerCpuName,         true },
+        { "cpurevision",    handlerCpuRevision,     true },
+        { "cpuhwvirt",      handlerCpuHwVirt,       true },
+        { "nestedpaging",   handlerCpuNestedPaging, true },
+        { "longmode",       handlerCpuLongMode,     true },
+        { "memsize",        handlerMemSize,         true },
+        { "report",         handlerReport,          true }
+    };
+
+    if (argc < 2)
+        return RTMsgErrorExit(RTEXITCODE_SYNTAX, "expected command as the first argument");
+
+    for (unsigned i = 0; i < RT_ELEMENTS(s_aHandlers); i++)
+    {
+        if (!strcmp(argv[1], s_aHandlers[i].pszCommand))
+        {
+            if (   s_aHandlers[i].fNoArgs
+                && argc != 2)
+                return RTMsgErrorExit(RTEXITCODE_SYNTAX, "the command '%s' does not take any arguments", argv[1]);
+            return s_aHandlers[i].pfnHandler(argc - 1, argv + 1);
+        }
+    }
+
+    /*
+     * Help or version query?
+     */
+    for (int i = 1; i < argc; i++)
+        if (   !strcmp(argv[i], "--help")
+            || !strcmp(argv[i], "-h")
+            || !strcmp(argv[i], "-?")
+            || !strcmp(argv[i], "help") )
+        {
+            RTPrintf("usage: %s <cmd> [cmd specific args]\n"
+                     "\n"
+                     "commands:\n", argv[0]);
+            for (unsigned j = 0; j < RT_ELEMENTS(s_aHandlers); j++)
+                RTPrintf("    %s\n", s_aHandlers[j].pszCommand);
+            return RTEXITCODE_FAILURE;
+        }
+        else if (   !strcmp(argv[i], "--version")
+                 || !strcmp(argv[i], "-V") )
+        {
+            RTPrintf("%sr%u", RTBldCfgVersion(),  RTBldCfgRevision());
+            return argc == 2 ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+        }
+
+    /*
+     * Syntax error.
+     */
+    return RTMsgErrorExit(RTEXITCODE_SYNTAX, "unknown command '%s'", argv[1]);
+}
+
diff --git a/src/VBox/ValidationKit/testboxscript/darwin/setup-routines.sh b/src/VBox/ValidationKit/testboxscript/darwin/setup-routines.sh
new file mode 100644
index 0000000..c7571af
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/darwin/setup-routines.sh
@@ -0,0 +1,238 @@
+# $Id: setup-routines.sh $
+## @file
+# VirtualBox Validation Kit - TestBoxScript Service Setup on Mac OS X (darwin).
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+MY_CONFIG_FILE=/Library/LaunchDaemons/org.virtualbox.testboxscript.plist
+
+##
+# Checks for a boolean option pair --$2/--no-$2 in the XMLARGS variable,
+# storing the result in the TESTBOXSCRIPT_XXX variable $1.
+darwin_check_for_option_bool() {
+    MY_TMP=`echo "${XMLARGS}" | sed -ne 's|^.*<string>--'"$2"'</string>.*$|yes|p'`
+    if [ -n "${MY_TMP}" ]; then
+        eval $1="yes";
+    fi
+    MY_TMP=`echo "${XMLARGS}" | sed -ne 's|^.*<string>--no-'"$2"'</string>.*$|yes|p'`
+    if [ -n "${MY_TMP}" ]; then
+        eval $1="no";
+    fi
+    return 0;
+}
+
+##
+# Checks for an option $2 taking an argument, storing the result in the
+# TESTBOXSCRIPT_XXX variable $1.
+darwin_check_for_option_arg() {
+    MY_TMP=`echo "${XMLARGS}" | sed -ne 's|^.*<string>--'"$2"'</string> *<string>\([^<>]*\)</string>.*$|\1|p'`
+    if [ -n "${MY_TMP}" ]; then
+        eval $1="\"${MY_TMP}\"";
+    fi
+    return 0;
+}
+
+##
+# Loads config values from the current installation.
+#
+os_load_config() {
+    if [ -r "${MY_CONFIG_FILE}" ]; then
+        # User.
+        MY_TMP=`/usr/bin/tr '\n' ' ' < "${MY_CONFIG_FILE}" \
+                | /usr/bin/sed \
+                  -e 's/  */ /g' \
+                  -e 's|\(</[[:alnum:]]*>\)<|\1 <|g' \
+                  -e 's|^.*<key>UserName</key> *<string>\([^<>]*\)</string>.*$|\1|'`;
+        if [ -n "${MY_TMP}" ]; then
+            TESTBOXSCRIPT_USER="${MY_TMP}";
+        fi
+
+        # Arguments.
+        XMLARGS=`/usr/bin/tr '\n' ' ' < "${MY_CONFIG_FILE}" \
+                | /usr/bin/sed \
+                  -e 's/  */ /g' \
+                  -e 's|\(</[[:alnum:]]*>\)<|\1 <|g' \
+                  -e 's|^.*ProgramArguments</key> *<array> *\(.*\)</array>.*$|\1|'`;
+
+        darwin_check_for_option_arg  TESTBOXSCRIPT_SYSTEM_UUID      system-uuid
+        darwin_check_for_option_arg  TESTBOXSCRIPT_SCRATCH_ROOT     scratch-root
+        darwin_check_for_option_arg  TESTBOXSCRIPT_TEST_MANAGER     test-manager
+        darwin_check_for_option_bool TESTBOXSCRIPT_HWVIRT           hwvirt
+        darwin_check_for_option_bool TESTBOXSCRIPT_NESTED_PAGING    nested-paging
+        darwin_check_for_option_bool TESTBOXSCRIPT_IOMMU            io-mmu
+        darwin_check_for_option_arg  TESTBOXSCRIPT_BUILDS_PATH      builds-path
+        darwin_check_for_option_arg  TESTBOXSCRIPT_BUILDS_TYPE      builds-server-type
+        darwin_check_for_option_arg  TESTBOXSCRIPT_BUILDS_NAME      builds-server-name
+        darwin_check_for_option_arg  TESTBOXSCRIPT_BUILDS_SHARE     builds-server-share
+        darwin_check_for_option_arg  TESTBOXSCRIPT_BUILDS_USER      builds-server-user
+        darwin_check_for_option_arg  TESTBOXSCRIPT_BUILDS_PASSWD    builds-server-passwd
+        darwin_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_PATH    testrsrc-path
+        darwin_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_TYPE    testrsrc-server-type
+        darwin_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_NAME    testrsrc-server-name
+        darwin_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_SHARE   testrsrc-server-share
+        darwin_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_USER    testrsrc-server-user
+        darwin_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_PASSWD  testrsrc-server-passwd
+
+        ## @TODO darwin_check_for_option_arg  TESTBOXSCRIPT_PYTHON           python
+    fi
+}
+
+##
+# Adds an argument ($1) to MY_ARGV (XML plist format).
+#
+darwin_add_args() {
+    while [ $# -gt 0 ];
+    do
+        case "$1" in
+            *\<* | *\>* | *\&*)
+                MY_TMP='`echo "$1" | sed -e 's/&/&/g' -e 's/</</g' -e 's/>/>/g'`';
+                MY_ARGV="${MY_ARGV}  <string>${MY_TMP}</string>";
+                ;;
+            *)
+                MY_ARGV="${MY_ARGV}  <string>$1</string>";
+                ;;
+        esac
+        shift;
+    done
+    MY_ARGV="${MY_ARGV}"'
+  ';
+    return 0;
+}
+
+os_install_service() {
+    MY_ARGV=""
+    if [ -n "${TESTBOXSCRIPT_PYTHON}" ]; then
+        darwin_add_args "${TESTBOXSCRIPT_PYTHON}"
+    fi
+    darwin_add_args "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py"
+
+    if [ "${TESTBOXSCRIPT_HWVIRT}"        = "yes" ]; then darwin_add_args "--hwvirt"; fi
+    if [ "${TESTBOXSCRIPT_HWVIRT}"        = "no"  ]; then darwin_add_args "--no-hwvirt"; fi
+    if [ "${TESTBOXSCRIPT_NESTED_PAGING}" = "yes" ]; then darwin_add_args "--nested-paging"; fi
+    if [ "${TESTBOXSCRIPT_NESTED_PAGING}" = "no"  ]; then darwin_add_args "--no-nested-paging"; fi
+    if [ "${TESTBOXSCRIPT_IOMMU}"         = "yes" ]; then darwin_add_args "--io-mmu"; fi
+    if [ "${TESTBOXSCRIPT_IOMMU}"         = "no"  ]; then darwin_add_args "--no-io-mmu"; fi
+    if [ -n "${TESTBOXSCRIPT_SYSTEM_UUID}"   ]; then darwin_add_args "--system-uuid" "${TESTBOXSCRIPT_SYSTEM_UUID}"; fi
+    if [ -n "${TESTBOXSCRIPT_TEST_MANAGER}"  ]; then darwin_add_args "--test-manager" "${TESTBOXSCRIPT_TEST_MANAGER}"; fi
+    if [ -n "${TESTBOXSCRIPT_SCRATCH_ROOT}"  ]; then darwin_add_args "--scratch-root" "${TESTBOXSCRIPT_SCRATCH_ROOT}"; fi
+
+    if [ -n "${TESTBOXSCRIPT_BUILDS_PATH}"   ]; then darwin_add_args "--builds-path"            "${TESTBOXSCRIPT_BUILDS_PATH}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_TYPE}"   ]; then darwin_add_args "--builds-server-type"     "${TESTBOXSCRIPT_BUILDS_TYPE}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_NAME}"   ]; then darwin_add_args "--builds-server-name"     "${TESTBOXSCRIPT_BUILDS_NAME}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_SHARE}"  ]; then darwin_add_args "--builds-server-share"    "${TESTBOXSCRIPT_BUILDS_SHARE}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_USER}"   ]; then darwin_add_args "--builds-server-user"     "${TESTBOXSCRIPT_BUILDS_USER}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_PASSWD}" ]; then darwin_add_args "--builds-server-passwd"   "${TESTBOXSCRIPT_BUILDS_PASSWD}"; fi
+    if [ -n "${TESTBOXSCRIPT_TESTRSRC_PATH}" ]; then darwin_add_args "--testrsrc-path"          "${TESTBOXSCRIPT_PATH_TESTRSRC}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_TYPE}"   ]; then darwin_add_args "--testrsrc-server-type"   "${TESTBOXSCRIPT_TESTRSRC_TYPE}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_NAME}"   ]; then darwin_add_args "--testrsrc-server-name"   "${TESTBOXSCRIPT_TESTRSRC_NAME}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_SHARE}"  ]; then darwin_add_args "--testrsrc-server-share"  "${TESTBOXSCRIPT_TESTRSRC_SHARE}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_USER}"   ]; then darwin_add_args "--testrsrc-server-user"   "${TESTBOXSCRIPT_TESTRSRC_USER}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_PASSWD}" ]; then darwin_add_args "--testrsrc-server-passwd" "${TESTBOXSCRIPT_TESTRSRC_PASSWD}"; fi
+
+    # Note! It's not possible to use screen 4.0.3 with the launchd due to buggy
+    #       "setsid off" handling (and possible other things).
+    cat > "${MY_CONFIG_FILE}" <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+  <key>Label</key>            <string>org.virtualbox.testboxscript</string>
+  <key>UserName</key>         <string>${TESTBOXSCRIPT_USER}</string>
+  <key>WorkingDirectory</key> <string>${TESTBOXSCRIPT_DIR}</string>
+  <key>Enabled</key>          <true/>
+  <key>RunAtLoad</key>        <true/>
+  <key>KeepAlive</key>        <true/>
+  <key>StandardInPath</key>   <string>/dev/null</string>
+  <key>StandardOutPath</key>  <string>/dev/null</string>
+  <key>StandardErrorPath</key> <string>/dev/null</string>
+  <key>ProgramArguments</key>
+  <array>
+  ${MY_ARGV}</array>
+</dict>
+</plist>
+EOF
+
+    return 0;
+}
+
+os_enable_service() {
+    launchctl load "${MY_CONFIG_FILE}"
+    return 0;
+}
+
+os_disable_service() {
+    if [ -r "${MY_CONFIG_FILE}" ]; then
+        launchctl unload "${MY_CONFIG_FILE}"
+    fi
+    return 0;
+}
+
+os_add_user() {
+    NEWUID=$(expr `dscl . -readall /Users UniqueID | sed -ne 's/UniqueID: *\([0123456789]*\) *$/\1/p' | sort -n | tail -1 ` + 1)
+    if [ -z "$NEWUID" -o "${NEWUID}" -lt 502 ]; then
+        NEWUID=502;
+    fi
+
+    dscl . -create "/Users/${TESTBOXSCRIPT_USER}" UserShell         /bin/bash
+    dscl . -create "/Users/${TESTBOXSCRIPT_USER}" RealName          "VBox Test User"
+    dscl . -create "/Users/${TESTBOXSCRIPT_USER}" UniqueID          ${NEWUID}
+    dscl . -create "/Users/${TESTBOXSCRIPT_USER}" PrimaryGroupID    80
+    dscl . -create "/Users/${TESTBOXSCRIPT_USER}" NFSHomeDirectory  "/Users/vbox"
+    dscl . -passwd "/Users/${TESTBOXSCRIPT_USER}" "password"
+    mkdir -p "/Users/${TESTBOXSCRIPT_USER}"
+}
+
+os_final_message() {
+    cat <<EOF
+
+Additional things to do:"
+    1. Change the 'Energy Saver' options to never turn off the computer:
+       $ systemsetup -setsleep Never
+    2. Check 'Restart automatically if the computer freezes' if available in
+       the 'Energy Saver' settings.
+       $ systemsetup -setrestartfreeze on
+    3. In the 'Sharing' panel enable (VBox/Oracle):
+         a) 'Remote Login' so ssh works.
+             $ systemsetup -setremotelogin on
+         b) 'Remote Management, tick all the checkboxes in the sheet dialog.
+            Open the 'Computer Settings' and check 'Show Remote Management
+            status in nmenu bar', 'Anyone may request permission to control
+            screen' and 'VNC viewers may control screen with password'. Set the
+            VNC password to 'password'.
+    4. Make sure the proxy is configured correctly for your network by going to
+       the 'Network' panel, open 'Advanced...'. For Oracle this means 'TCP/IP'
+       should be configured by 'DHCP' (IPv4) and 'automatically' (IPv6), and
+       the 'Proxies' tab should have 'Automatic Proxy Configuration' checked
+       with the URL containing 'http://wpad.oracle.com/wpad.dat'. (Make sure
+       to hit OK to close the dialog.)
+    5. Configure NTP to the nearest local time source. For VBox/Oracle this
+       means wei01-time.de.oracle.com:
+       $ systemsetup -setnetworktimeserver wei01-time.de.oracle.com
+    6. Configure the vbox (pw:password) account for automatic login.
+    7. Configure the kernel to keep symbols:
+       $ sudo nvram boot-args="keepsyms=1"
+
+Enjoy!
+EOF
+}
+
diff --git a/src/VBox/ValidationKit/testboxscript/linux/setup-routines.sh b/src/VBox/ValidationKit/testboxscript/linux/setup-routines.sh
new file mode 100755
index 0000000..ce65f7a
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/linux/setup-routines.sh
@@ -0,0 +1,98 @@
+#!/bin/sh
+# $Id: setup-routines.sh $
+## @file
+# VirtualBox Validation Kit - TestBoxScript Service Setup.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+
+# Load the routines we share with the linux installer.
+if test ! -r "${DIR}/linux/setup-installer-routines.sh" -a -r "${DIR}/../../Installer/linux/routines.sh"; then
+    . "${DIR}/../../Installer/linux/routines.sh"
+else
+    . "${DIR}/linux/setup-installer-routines.sh"
+fi
+
+
+os_load_config() {
+    if [ -d /etc/conf.d/ ]; then
+        MY_CONFIG_FILE="/etc/conf.d/testboxscript"
+    elif [ -d /etc/default/ ]; then
+        MY_CONFIG_FILE="/etc/default/testboxscript"
+    else
+        echo "Port me!"
+        exit 1;
+    fi
+    if [ -r "${MY_CONFIG_FILE}" ]; then
+        . "${MY_CONFIG_FILE}"
+    fi
+}
+
+os_install_service() {
+    #
+    # Install the runlevel script.
+    #
+    install_init_script "${TESTBOXSCRIPT_DIR}/testboxscript/linux/testboxscript-service.sh" "testboxscript-service"
+    set +e
+    delrunlevel "testboxscript-service" > /dev/null 2>&1
+    addrunlevel "testboxscript-service" 90 10
+    set -e
+
+    #
+    # Install the configuration file.
+    #
+    echo "# Generated by $0."            >  "${MY_CONFIG_FILE}"
+    set | sed -n -e '/^TESTBOXSCRIPT_/p' >> "${MY_CONFIG_FILE}"
+    return 0;
+}
+
+os_enable_service() {
+    /etc/init.d/testboxscript-service start
+    return 0;
+}
+
+os_disable_service() {
+    if [ -f /etc/init.d/testboxscript-service ]; then
+        /etc/init.d/testboxscript-service stop || true # Ignore
+    fi
+    return 0;
+}
+
+os_add_user() {
+    ADD_GROUPS=""
+    if ! grep -q wheel /etc/group; then
+        ADD_GROUPS="-G wheel"
+    fi
+    set -e
+    useradd -m -U -p password -s /bin/bash ${ADD_GROUPS} "${TESTBOXSCRIPT_USER}"
+    set +e
+    return 0;
+}
+
+check_for_cifs() {
+    test -x /sbin/mount.cifs -o -x /usr/sbin/mount.cifs
+    grep -wq cifs /proc/filesystems || modprobe cifs;
+    # Note! If modprobe doesn't work above, /sbin and /usr/sbin are probably missing from the search PATH.
+    return 0;
+}
+
diff --git a/src/VBox/ValidationKit/testboxscript/linux/testboxscript-service.sh b/src/VBox/ValidationKit/testboxscript/linux/testboxscript-service.sh
new file mode 100755
index 0000000..a23567b
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/linux/testboxscript-service.sh
@@ -0,0 +1,499 @@
+#!/bin/sh
+## @file
+# VirtualBox Validation Kit - TestBoxScript service init script.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+# chkconfig: 35 35 65
+# description: TestBoxScript service
+#
+### BEGIN INIT INFO
+# Provides:       testboxscript-service
+# Required-Start: $network
+# Required-Stop:
+# Default-Start:  2 3 4 5
+# Default-Stop:   0 1 6
+# Description:    TestBoxScript service
+### END INIT INFO
+
+
+PATH=$PATH:/bin:/sbin:/usr/sbin
+
+#
+# Load config and set up defaults.
+#
+service_name="testboxscript"
+
+[ -r /etc/default/${service_name} ] && . /etc/default/${service_name}
+[ -r /etc/conf.d/${service_name}  ] && . /etc/conf.d/${service_name}
+
+if [ -z "${TESTBOXSCRIPT_DIR}" ]; then
+    TESTBOXSCRIPT_DIR="/opt/testboxscript"
+fi
+if [ -z "${TESTBOXSCRIPT_USER}" ]; then
+    TESTBOXSCRIPT_USER="vbox"
+fi
+binary="${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py"
+binary_real="${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript_real.py"
+
+
+
+#
+# Detect and abstract distro
+#
+[ -f /etc/debian_release -a -f /lib/lsb/init-functions ] || NOLSB=yes
+
+system=unknown
+if [ -f /etc/redhat-release ]; then
+    system=redhat
+    PIDFILE="/var/run/${service_name}-service.pid"
+elif [ -f /etc/SuSE-release ]; then
+    system=suse
+    PIDFILE="/var/lock/subsys/${service_name}-service"
+elif [ -f /etc/debian_version ]; then
+    system=debian
+    PIDFILE="/var/run/${service_name}-service"
+elif [ -f /etc/gentoo-release ]; then
+    system=gentoo
+    PIDFILE="/var/run/${service_name}-service"
+elif [ -f /etc/arch-release ]; then
+     system=arch
+     PIDFILE="/var/run/${service_name}-service"
+elif [ -f /etc/slackware-version ]; then
+    system=slackware
+    PIDFILE="/var/run/${service_name}-service"
+elif [ -f /etc/lfs-release ]; then
+    system=lfs
+    PIDFILE="/var/run/${service_name}-service.pid"
+else
+    system=other
+    if [ -d /var/run -a -w /var/run ]; then
+        PIDFILE="/var/run/${service_name}-service"
+    fi
+fi
+
+
+#
+# Generic implementation.
+#
+
+## Query daemon status.
+# $1 = daemon-user; $2 = binary name
+# returns 0 if running, 1 if started but no longer running, 3 if not started.
+# When 0 is return the pid variable contains a list of relevant pids.
+my_query_status() {
+    a_USER="$1";
+    a_BINARY="$2";
+    pid="";
+    if [ -f "${PIDFILE}" -a -s "${PIDFILE}" ]; then
+        MY_LINE="";
+        read MY_LINE < "${PIDFILE}";
+        for MY_PID in `echo $MY_LINE | sed -e 's/[^0123456789 ]/ /g'`;
+        do
+            if [ "`stat -c '%U' /proc/$MY_PID 2> /dev/null `" = "$a_USER" ]; then
+                pid="${pid} ${MY_PID}";
+            fi
+        done
+        if [ -n "${pid}" ]; then
+            RETVAL=0;
+        else
+            RETVAL=1;
+        fi
+    else
+        RETVAL=3
+    fi
+    return $RETVAL;
+}
+
+## Starts detached daeamon in screen.
+# $1 = daemon-user; $2+ = daemon and its arguments
+my_start_daemon() {
+    a_USER="$1"
+    shift
+    if touch "${PIDFILE}" && chown "${a_USER}" -- "${PIDFILE}"; then
+        ARGS=""
+        while [ $# -gt 0 ];
+        do
+            ARGS="$ARGS '$1'";
+            shift
+        done
+        ARGS="$ARGS --pidfile '$PIDFILE'";
+        su - "${a_USER}" -c "screen -S ${service_name} -d -m ${ARGS} ";
+        RETVAL=$?;
+        if [ $RETVAL -eq 0 ]; then
+            sleep 0.6;
+            if [ ! -s "$PIDFILE" ]; then sleep 1; fi
+            if [ ! -s "$PIDFILE" ]; then sleep 2; fi
+            if [ ! -s "$PIDFILE" ]; then sleep 3; fi
+            if [ -s "$PIDFILE" ]; then
+                RETVAL=0;
+            else
+                RETVAL=1;
+            fi
+        else
+            fail_msg "su failed with exit code $RETVAL";
+        fi
+    else
+        fail_msg "Failed to create pid file and change it's ownership to ${a_USER}."
+        RETVAL=1;
+    fi
+    return $RETVAL;
+}
+
+## Stops the daemon.
+# $1 = daemon-user; $2 = binary name
+my_stop_daemon() {
+    a_USER="$1";
+    a_BINARY="$2";
+    my_query_status "$a_USER" "$a_BINARY"
+    RETVAL=$?
+    if [ $RETVAL -eq 0 -a -n "$pid" ]; then
+        kill $pid;
+    fi
+    sleep 0.6
+    if my_query_status "$a_USER" "$a_BINARY"; then sleep 1; fi
+    if my_query_status "$a_USER" "$a_BINARY"; then sleep 2; fi
+    if my_query_status "$a_USER" "$a_BINARY"; then sleep 3; fi
+    if ! my_query_status "$a_USER" "$a_BINARY"; then
+        rm -f -- "${PIDFILE}"
+        return 0;
+    fi
+    return 1;
+}
+
+if [ -z "$NOLSB" ]; then
+    . /lib/lsb/init-functions
+    fail_msg() {
+        echo ""
+        log_failure_msg "$1"
+    }
+    succ_msg() {
+        log_success_msg " done."
+    }
+    begin_msg() {
+        log_daemon_msg "$@"
+    }
+else
+    fail_msg() {
+        echo " ...fail!"
+        echo "$@"
+    }
+    succ_msg() {
+        echo " ...done."
+    }
+    begin_msg() {
+        echo -n "$1"
+    }
+fi
+
+#
+# System specific overrides.
+#
+
+if [ "$system" = "redhat" ]; then
+    . /etc/init.d/functions
+    if [ -n "$NOLSB" ]; then
+        fail_msg() {
+            echo_failure
+            echo
+        }
+        succ_msg() {
+            echo_success
+            echo
+        }
+        begin_msg() {
+            echo -n "$1"
+        }
+    fi
+fi
+
+if [ "$system" = "suse" ]; then
+    . /etc/rc.status
+    if [ -n "$NOLSB" ]; then
+        fail_msg() {
+            rc_failed 1
+            rc_status -v
+        }
+        succ_msg() {
+            rc_reset
+            rc_status -v
+        }
+        begin_msg() {
+            echo -n "$1"
+        }
+    fi
+fi
+
+if [ "$system" = "debian" ]; then
+    # Share my_start_daemon and my_stop_daemon with gentoo
+    if [ -n "$NOLSB" ]; then
+        fail_msg() {
+            echo " ...fail!"
+        }
+        succ_msg() {
+            echo " ...done."
+        }
+        begin_msg() {
+            echo -n "$1"
+       }
+    fi
+fi
+
+if [ "$system" = "gentoo" ]; then
+    if [ -f /sbin/functions.sh ]; then
+        . /sbin/functions.sh
+    elif [ -f /etc/init.d/functions.sh ]; then
+        . /etc/init.d/functions.sh
+    fi
+    # Share my_start_daemon and my_stop_daemon with debian.
+    if [ -n "$NOLSB" ]; then
+        if [ "`which $0`" = "/sbin/rc" ]; then
+            shift
+        fi
+    fi
+fi
+
+if [ "$system" = "debian" -o  "$system" = "gentoo" ]; then
+    #my_start_daemon() {
+    #    usr="$1"
+    #    shift
+    #    bin="$1"
+    #    shift
+    #    echo usr=$usr
+    #    start-stop-daemon --start --background  --pidfile "${PIDFILE}" --make-pidfile --chuid "${usr}" --user "${usr}" \
+    #        --exec $bin -- $@
+    #}
+    my_stop_daemon() {
+        a_USER="$1"
+        a_BINARY="$2"
+        start-stop-daemon --stop --user "${a_USER}" --pidfile "${PIDFILE}"
+        RETVAL=$?
+        rm -f "${PIDFILE}"
+        return $RETVAL
+    }
+fi
+
+if [ "$system" = "arch" ]; then
+    USECOLOR=yes
+    . /etc/rc.d/functions
+    if [ -n "$NOLSB" ]; then
+        fail_msg() {
+            stat_fail
+        }
+        succ_msg() {
+            stat_done
+        }
+        begin_msg() {
+            stat_busy "$1"
+        }
+    fi
+fi
+
+if [ "$system" = "lfs" ]; then
+    . /etc/rc.d/init.d/functions
+    if [ -n "$NOLSB" ]; then
+        fail_msg() {
+            echo_failure
+        }
+        succ_msg() {
+            echo_ok
+        }
+        begin_msg() {
+            echo $1
+        }
+    fi
+fi
+
+#
+# Implement the actions.
+#
+check_single_user() {
+    if [ -n "$2" ]; then
+        fail_msg "TESTBOXSCRIPT_USER must not contain multiple users!"
+        exit 1
+    fi
+}
+
+#
+# Open ports at the firewall:
+#   6000..6100 / TCP for VRDP
+#   5000..5032 / TCP for netperf
+#   5000..5032 / UDP for netperf
+#
+set_iptables() {
+    if [ -x /sbin/iptables ]; then
+        I="/sbin/iptables -j ACCEPT -A INPUT -m state --state NEW"
+        if ! /sbin/iptables -L INPUT | grep -q "testsuite vrdp"; then
+            $I -m tcp -p tcp --dport 6000:6100 -m comment --comment "testsuite vrdp"
+        fi
+        if ! /sbin/iptables -L INPUT | grep -q "testsuite perftcp"; then
+            $I -m tcp -p tcp --dport 5000:5032 -m comment --comment "testsuite perftcp"
+        fi
+        if ! /sbin/iptables -L INPUT | grep -q "testsuite perfudp"; then
+            $I -m udp -p udp --dport 5000:5032 -m comment --comment "testsuite perfudp"
+        fi
+    fi
+}
+
+
+start() {
+    if [ ! -f "${PIDFILE}" ]; then
+        begin_msg "Starting TestBoxScript";
+
+        #
+        # Verify config and installation.
+        #
+        if [ ! -d "$TESTBOXSCRIPT_DIR"  -o  ! -r "$binary"  -o  ! -r "$binary_real" ]; then
+            fail_msg "Cannot find TestBoxScript installation under '$TESTBOXSCRIPT_DIR'!"
+            exit 0;
+        fi
+        ## @todo check ownership (for upgrade purposes)
+        check_single_user $TESTBOXSCRIPT_USER
+
+        #
+        # Open some ports in the firewall
+        # Allows to access VMs remotely by VRDP, netperf
+        #
+        set_iptables
+
+        #
+        # Set execute bits to make installation (unzip) easier.
+        #
+        chmod a+x  > /dev/null 2>&1  \
+            "${binary}" \
+            "${binary_real}" \
+            "${TESTBOXSCRIPT_DIR}/linux/amd64/TestBoxHelper" \
+            "${TESTBOXSCRIPT_DIR}/linux/x86/TestBoxHelper"
+
+        #
+        # Start the daemon as the specified user.
+        #
+        PARAMS=""
+        if [ "${TESTBOXSCRIPT_HWVIRT}"        = "yes" ]; then PARAMS="${PARAMS} --hwvirt"; fi
+        if [ "${TESTBOXSCRIPT_HWVIRT}"        = "no"  ]; then PARAMS="${PARAMS} --no-hwvirt"; fi
+        if [ "${TESTBOXSCRIPT_NESTED_PAGING}" = "yes" ]; then PARAMS="${PARAMS} --nested-paging"; fi
+        if [ "${TESTBOXSCRIPT_NESTED_PAGING}" = "no"  ]; then PARAMS="${PARAMS} --no-nested-paging"; fi
+        if [ "${TESTBOXSCRIPT_IOMMU}"         = "yes" ]; then PARAMS="${PARAMS} --io-mmu"; fi
+        if [ "${TESTBOXSCRIPT_IOMMU}"         = "no"  ]; then PARAMS="${PARAMS} --no-io-mmu"; fi
+        if [ -n "${TESTBOXSCRIPT_SYSTEM_UUID}"   ]; then PARAMS="${PARAMS} --system-uuid '${TESTBOXSCRIPT_SYSTEM_UUID}'"; fi
+        if [ -n "${TESTBOXSCRIPT_TEST_MANAGER}"  ]; then PARAMS="${PARAMS} --test-manager '${TESTBOXSCRIPT_TEST_MANAGER}'"; fi
+        if [ -n "${TESTBOXSCRIPT_SCRATCH_ROOT}"  ]; then PARAMS="${PARAMS} --scratch-root '${TESTBOXSCRIPT_SCRATCH_ROOT}'"; fi
+
+        if [ -n "${TESTBOXSCRIPT_BUILDS_PATH}"   ]; then PARAMS="${PARAMS} --builds-path '${TESTBOXSCRIPT_BUILDS_PATH}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_TYPE}"   ]; then PARAMS="${PARAMS} --builds-server-type   '${TESTBOXSCRIPT_BUILDS_TYPE}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_NAME}"   ]; then PARAMS="${PARAMS} --builds-server-name   '${TESTBOXSCRIPT_BUILDS_NAME}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_SHARE}"  ]; then PARAMS="${PARAMS} --builds-server-share  '${TESTBOXSCRIPT_BUILDS_SHARE}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_USER}"   ]; then PARAMS="${PARAMS} --builds-server-user   '${TESTBOXSCRIPT_BUILDS_USER}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_PASSWD}" ]; then PARAMS="${PARAMS} --builds-server-passwd '${TESTBOXSCRIPT_BUILDS_PASSWD}'"; fi
+        if [ -n "${TESTBOXSCRIPT_TESTRSRC_PATH}" ]; then PARAMS="${PARAMS} --testrsrc-path '${TESTBOXSCRIPT_PATH_TESTRSRC}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_TYPE}"   ]; then PARAMS="${PARAMS} --testrsrc-server-type   '${TESTBOXSCRIPT_TESTRSRC_TYPE}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_NAME}"   ]; then PARAMS="${PARAMS} --testrsrc-server-name   '${TESTBOXSCRIPT_TESTRSRC_NAME}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_SHARE}"  ]; then PARAMS="${PARAMS} --testrsrc-server-share  '${TESTBOXSCRIPT_TESTRSRC_SHARE}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_USER}"   ]; then PARAMS="${PARAMS} --testrsrc-server-user   '${TESTBOXSCRIPT_TESTRSRC_USER}'"; fi
+        if [ -n "${TESTBOXSCRIPT_BUILDS_PASSWD}" ]; then PARAMS="${PARAMS} --testrsrc-server-passwd '${TESTBOXSCRIPT_TESTRSRC_PASSWD}'"; fi
+
+        if [ -n "${TESTBOXSCRIPT_PYTHON}" ]; then
+            my_start_daemon "${TESTBOXSCRIPT_USER}" "${TESTBOXSCRIPT_PYTHON}" "${binary}" ${PARAMS}
+        else
+            my_start_daemon "${TESTBOXSCRIPT_USER}" "${binary}" ${PARAMS}
+        fi
+        RETVAL=$?
+
+        if [ $RETVAL -eq 0 ]; then
+            succ_msg
+        else
+            fail_msg
+        fi
+    else
+        succ_msg "Already running."
+        RETVAL=0
+    fi
+    return $RETVAL
+}
+
+stop() {
+    if [ -f "${PIDFILE}" ]; then
+        begin_msg "Stopping TestBoxScript";
+        my_stop_daemon "${TESTBOXSCRIPT_USER}" "${binary}"
+        RETVAL=$?
+        if [ $RETVAL -eq 0 ]; then
+            succ_msg
+        else
+            fail_msg
+        fi
+    else
+        RETVAL=0
+    fi
+    return $RETVAL
+}
+
+restart() {
+    stop && sleep 1 && start
+}
+
+status() {
+    echo -n "Checking for TestBoxScript"
+    my_query_status "${TESTBOXSCRIPT_USER}" "${binary}"
+    RETVAL=$?
+    if [ ${RETVAL} -eq 0 ]; then
+        echo " ...running"
+    elif [ ${RETVAL} -eq 3 ]; then
+        echo " ...stopped"
+    elif [ ${RETVAL} -eq 1 ]; then
+        echo " ...started but not running"
+    else
+        echo " ...unknown status '${RETVAL}'"
+    fi
+}
+
+
+#
+# main().
+#
+case "$1" in
+    start)
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    restart)
+        restart
+        ;;
+    force-reload)
+        restart
+        ;;
+    status)
+        status
+        ;;
+    setup)
+        ;;
+    cleanup)
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|restart|status}"
+        exit 1
+esac
+
+exit $RETVAL
+
diff --git a/src/VBox/ValidationKit/testboxscript/setup.sh b/src/VBox/ValidationKit/testboxscript/setup.sh
new file mode 100755
index 0000000..930c1db
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/setup.sh
@@ -0,0 +1,485 @@
+#!/usr/bin/env bash
+# $Id: setup.sh $
+## @file
+# VirtualBox Validation Kit - TestBoxScript Service Setup on Unixy platforms.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+
+#
+# !WARNING! Running the whole script in exit-on-failure mode.
+#
+# Note! Looking at the ash sources, it seems flags will be saved and restored
+#       when calling functions.  That's comforting.
+#
+set -e
+#set -x # debug only, disable!
+
+##
+# Get the host OS name, returning it in RETVAL.
+#
+get_host_os() {
+    RETVAL=`uname`
+    case "$RETVAL" in
+        Darwin|darwin)
+            RETVAL=darwin
+            ;;
+
+        DragonFly)
+            RETVAL=dragonfly
+            ;;
+
+        freebsd|FreeBSD|FREEBSD)
+            RETVAL=freebsd
+            ;;
+
+        Haiku)
+            RETVAL=haiku
+            ;;
+
+        linux|Linux|GNU/Linux|LINUX)
+            RETVAL=linux
+            ;;
+
+        netbsd|NetBSD|NETBSD)
+            RETVAL=netbsd
+            ;;
+
+        openbsd|OpenBSD|OPENBSD)
+            RETVAL=openbsd
+            ;;
+
+        os2|OS/2|OS2)
+            RETVAL=os2
+            ;;
+
+        SunOS)
+            RETVAL=solaris
+            ;;
+
+        WindowsNT|CYGWIN_NT-*)
+            RETVAL=win
+            ;;
+
+        *)
+            echo "$0: unknown os $RETVAL" 1>&2
+            exit 1
+            ;;
+    esac
+    return 0;
+}
+
+##
+# Get the host OS/CPU arch, returning it in RETVAL.
+#
+get_host_arch() {
+    if [ "${HOST_OS}" = "solaris" ]; then
+        RETVAL=`isainfo | cut -f 1 -d ' '`
+    else
+        RETVAL=`uname -m`
+    fi
+    case "${RETVAL}" in
+        amd64|AMD64|x86_64|k8|k8l|k9|k10)
+            RETVAL='amd64'
+            ;;
+        x86|i86pc|ia32|i[3456789]86|BePC)
+            RETVAL='x86'
+            ;;
+        sparc32|sparc|sparcv8|sparcv7|sparcv8e)
+            RETVAL='sparc32'
+            ;;
+        sparc64|sparcv9)
+            RETVAL='sparc64'
+            ;;
+        s390)
+            RETVAL='s390'
+            ;;
+        s390x)
+            RETVAL='s390x'
+            ;;
+        ppc32|ppc|powerpc)
+            RETVAL='ppc32'
+            ;;
+        ppc64|powerpc64)
+            RETVAL='ppc64'
+            ;;
+        mips32|mips)
+            RETVAL='mips32'
+            ;;
+        mips64)
+            RETVAL='mips64'
+            ;;
+        ia64)
+            RETVAL='ia64'
+            ;;
+        hppa32|parisc32|parisc)
+            RETVAL='hppa32'
+            ;;
+        hppa64|parisc64)
+            RETVAL='hppa64'
+            ;;
+        arm|armv4l|armv5tel|armv5tejl)
+            RETVAL='arm'
+            ;;
+        alpha)
+            RETVAL='alpha'
+            ;;
+
+        *)
+            echo "$0: unknown cpu/arch - $RETVAL" 1>&$2
+            exit 1
+            ;;
+    esac
+    return 0;
+}
+
+
+##
+# Loads config values from the current installation.
+#
+os_load_config() {
+    echo "os_load_config is not implemented" 2>&1
+    exit 1
+}
+
+##
+# Installs, configures and starts the service.
+#
+os_install_service() {
+    echo "os_install_service is not implemented" 2>&1
+    exit 1
+}
+
+##
+# Enables (starts) the service.
+os_enable_service() {
+    echo "os_enable_service is not implemented" 2>&1
+    return 0;
+}
+
+##
+# Disables (stops) the service.
+os_disable_service() {
+    echo "os_disable_service is not implemented" 2>&1
+    return 0;
+}
+
+##
+# Adds the testbox user
+#
+os_add_user() {
+    echo "os_add_user is not implemented" 2>&1
+    exit 1
+}
+
+##
+# Prints a final message after successful script execution.
+# This can contain additional instructions which needs to be carried out
+# manually or similar.
+os_final_message() {
+    return 0;
+}
+
+##
+# Checks the installation, verifying that files are there and scripts work fine.
+#
+check_testboxscript_install() {
+
+    # Presence
+    test -r "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py"
+    test -r "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript_real.py"
+    test -r "${TESTBOXSCRIPT_DIR}/testboxscript/linux/testboxscript-service.sh" -o "${HOST_OS}" != "linux"
+    test -r "${TESTBOXSCRIPT_DIR}/${HOST_OS}/${HOST_ARCH}/TestBoxHelper"
+
+    # Zip file may be missing the x bits, so set them.
+    chmod a+x \
+        "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py" \
+        "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript_real.py" \
+        "${TESTBOXSCRIPT_DIR}/${HOST_OS}/${HOST_ARCH}/TestBoxHelper"
+
+
+    # Check that the scripts work.
+    set +e
+    "${TESTBOXSCRIPT_PYTHON}" "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py" --version > /dev/null
+    if [ $? -ne 2 ]; then
+        echo "$0: error: testboxscript.py didn't respons correctly to the --version option."
+        exit 1;
+    fi
+
+    "${TESTBOXSCRIPT_PYTHON}" "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript_real.py" --version > /dev/null
+    if [ $? -ne 2 ]; then
+        echo "$0: error: testboxscript.py didn't respons correctly to the --version option."
+        exit 1;
+    fi
+    set -e
+
+    return 0;
+}
+
+##
+# Check that sudo is installed.
+#
+check_for_sudo() {
+    which sudo
+    test -f "${MY_ETC_SUDOERS}"
+}
+
+##
+# Check that sudo is installed.
+#
+check_for_cifs() {
+    return 0;
+}
+
+##
+# Checks if the testboxscript_user exists.
+does_testboxscript_user_exist() {
+    id "${TESTBOXSCRIPT_USER}" > /dev/null 2>&1
+    return $?;
+}
+
+##
+# hushes up the root login.
+maybe_hush_up_root_login() {
+    # This is a solaris hook.
+    return 0;
+}
+
+##
+# Adds the testbox user and make sure it has unrestricted sudo access.
+maybe_add_testboxscript_user() {
+    if ! does_testboxscript_user_exist; then
+        os_add_user "${TESTBOXSCRIPT_USER}"
+    fi
+
+    SUDOERS_LINE="${TESTBOXSCRIPT_USER} ALL=(ALL) NOPASSWD: ALL"
+    if ! ${MY_FGREP} -q "${SUDOERS_LINE}" ${MY_ETC_SUDOERS}; then
+        echo "# begin tinderboxscript setup.sh" >> ${MY_ETC_SUDOERS}
+        echo "${SUDOERS_LINE}"                  >> ${MY_ETC_SUDOERS}
+        echo "# end tinderboxscript setup.sh"   >> ${MY_ETC_SUDOERS}
+    fi
+
+    maybe_hush_up_root_login;
+}
+
+
+##
+# Test the user.
+#
+test_user() {
+    su - "${TESTBOXSCRIPT_USER}" -c "true"
+
+    # sudo 1.7.0 adds the -n option.
+    MY_TMP="`sudo -V 2>&1 | head -1 | sed -e 's/^.*version 1\.[6543210]\..*$/old/'`"
+    if [ "${MY_TMP}" != "old" ]; then
+        echo "Warning: If sudo starts complaining about not having a tty,"
+        echo "         disable the requiretty option in /etc/sudoers."
+        su - "${TESTBOXSCRIPT_USER}" -c "sudo -n -i true"
+    else
+        echo "Warning: You've got an old sudo installed. If it starts"
+        echo "         complaining about not having a tty, disable the"
+        echo "         requiretty option in /etc/sudoers."
+        su - "${TESTBOXSCRIPT_USER}" -c "sudo true"
+    fi
+}
+
+
+##
+# Grants the user write access to the testboxscript files so it can perform
+# upgrades.
+#
+grant_user_testboxscript_write_access() {
+    chown -R "${TESTBOXSCRIPT_USER}" "${TESTBOXSCRIPT_DIR}"
+}
+
+##
+# Check the proxy setup.
+#
+check_proxy_config() {
+    if [ -n "${http_proxy}"  -o  -n "${ftp_proxy}" ]; then
+        if [ -z "${no_proxy}" ]; then
+            echo "Error: Env.vars. http_proxy/ftp_proxy without no_proxy is going to break upgrade among other things."
+            exit 1
+        fi
+    fi
+}
+
+
+#
+#
+# main()
+#
+#
+
+
+#
+# Get our bearings and include the host specific code.
+#
+MY_ETC_SUDOERS="/etc/sudoers"
+MY_FGREP=fgrep
+DIR=`dirname "$0"`
+DIR=`cd "${DIR}"; /bin/pwd`
+
+get_host_os
+HOST_OS=${RETVAL}
+get_host_arch
+HOST_ARCH=${RETVAL}
+
+. "${DIR}/${HOST_OS}/setup-routines.sh"
+
+
+#
+# Config.
+#
+TESTBOXSCRIPT_PYTHON=""
+TESTBOXSCRIPT_USER=""
+TESTBOXSCRIPT_HWVIRT=""
+TESTBOXSCRIPT_IOMMU=""
+TESTBOXSCRIPT_NESTED_PAGING=""
+TESTBOXSCRIPT_SYSTEM_UUID=""
+TESTBOXSCRIPT_PATH_TESTRSRC=""
+TESTBOXSCRIPT_TEST_MANAGER=""
+TESTBOXSCRIPT_SCRATCH_ROOT=""
+TESTBOXSCRIPT_BUILDS_PATH=""
+TESTBOXSCRIPT_BUILDS_TYPE="cifs"
+TESTBOXSCRIPT_BUILDS_NAME="solserv.de.oracle.com"
+TESTBOXSCRIPT_BUILDS_SHARE="builds"
+TESTBOXSCRIPT_BUILDS_USER="guestr"
+TESTBOXSCRIPT_BUILDS_PASSWD="guestr"
+TESTBOXSCRIPT_TESTRSRC_PATH=""
+TESTBOXSCRIPT_TESTRSRC_TYPE="cifs"
+TESTBOXSCRIPT_TESTRSRC_NAME="solserv.de.oracle.com"
+TESTBOXSCRIPT_TESTRSRC_SHARE="testrsrc"
+TESTBOXSCRIPT_TESTRSRC_USER="guestr"
+TESTBOXSCRIPT_TESTRSRC_PASSWD="guestr"
+declare -a TESTBOXSCRIPT_ENVVARS
+
+# Load old config values (platform specific).
+os_load_config
+
+# Set defaults.
+if [ -z "${TESTBOXSCRIPT_USER}" ]; then
+    TESTBOXSCRIPT_USER=vbox;
+fi;
+TESTBOXSCRIPT_DIR=`dirname "${DIR}"`
+
+
+#
+# Parse arguments.
+#
+while test $# -gt 0;
+do
+    case "$1" in
+        -h|--help)
+            echo "TestBox Script setup utility."
+            echo "";
+            echo "Usage: setup.sh [options]";
+            echo "";
+            echo "Options:";
+            echo "    Later...";
+            exit 0;
+            ;;
+        -V|--version)
+            echo '$Revision: 96152 $'
+            exit 0;
+            ;;
+
+        --python)                   TESTBOXSCRIPT_PYTHON="$2"; shift;;
+        --test-manager)             TESTBOXSCRIPT_TEST_MANAGER="$2"; shift;;
+        --scratch-root)             TESTBOXSCRIPT_SCRATCH_ROOT="$2"; shift;;
+        --system-uuid)              TESTBOXSCRIPT_SYSTEM_UUID="$2"; shift;;
+        --hwvirt)                   TESTBOXSCRIPT_HWVIRT="yes";;
+        --no-hwvirt)                TESTBOXSCRIPT_HWVIRT="no";;
+        --nested-paging)            TESTBOXSCRIPT_NESTED_PAGING="yes";;
+        --no-nested-paging)         TESTBOXSCRIPT_NESTED_PAGING="no";;
+        --io-mmu)                   TESTBOXSCRIPT_IOMMU="yes";;
+        --no-io-mmu)                TESTBOXSCRIPT_IOMMU="no";;
+        --builds-path)              TESTBOXSCRIPT_BUILDS_PATH="$2"; shift;;
+        --builds-server-type)       TESTBOXSCRIPT_BUILDS_TYPE="$2"; shift;;
+        --builds-server-name)       TESTBOXSCRIPT_BUILDS_NAME="$2"; shift;;
+        --builds-server-share)      TESTBOXSCRIPT_BUILDS_SHARE="$2"; shift;;
+        --builds-server-user)       TESTBOXSCRIPT_BUILDS_USER="$2"; shift;;
+        --builds-server-passwd)     TESTBOXSCRIPT_BUILDS_PASSWD="$2"; shift;;
+        --testrsrc-path)            TESTBOXSCRIPT_TESTRSRC_PATH="$2"; shift;;
+        --testrsrc-server-type)     TESTBOXSCRIPT_TESTRSRC_TYPE="$2"; shift;;
+        --testrsrc-server-name)     TESTBOXSCRIPT_TESTRSRC_NAME="$2"; shift;;
+        --testrsrc-server-share)    TESTBOXSCRIPT_TESTRSRC_SHARE="$2"; shift;;
+        --testrsrc-server-user)     TESTBOXSCRIPT_TESTRSRC_USER="$2"; shift;;
+        --testrsrc-server-passwd)   TESTBOXSCRIPT_TESTRSRC_PASSWD="$2"; shift;;
+        *)
+            echo 'Syntax error: Unknown option:' "$1" >&2;
+            exit 1;
+            ;;
+    esac
+    shift;
+done
+
+
+#
+# Find usable python if not already specified.
+#
+if [ -z "${TESTBOXSCRIPT_PYTHON}" ]; then
+    set +e
+    MY_PYTHON_VER_TEST="\
+import sys;\
+x = sys.version_info[0] == 2 and (sys.version_info[1] >= 6 or (sys.version_info[1] == 5 and sys.version_info[2] >= 1));\
+sys.exit(not x);\
+";
+    for python in python2.7 python2.6 python2.5 python;
+    do
+        python=`which ${python} 2> /dev/null`
+        if [ -n "${python}" -a -x "${python}" ]; then
+            if ${python} -c "${MY_PYTHON_VER_TEST}"; then
+                TESTBOXSCRIPT_PYTHON="${python}";
+                break;
+            fi
+        fi
+    done
+    set -e
+    test -n "${TESTBOXSCRIPT_PYTHON}";
+fi
+
+
+#
+# Do the job
+#
+set -e
+check_testboxscript_install;
+check_for_sudo;
+check_for_cifs;
+check_proxy_config;
+
+maybe_add_testboxscript_user;
+test_user;
+
+grant_user_testboxscript_write_access;
+
+os_disable_service;
+os_install_service;
+os_enable_service;
+
+#
+# That's all folks.
+#
+echo "done"
+os_final_message;
diff --git a/src/VBox/ValidationKit/testboxscript/solaris/setup-routines.sh b/src/VBox/ValidationKit/testboxscript/solaris/setup-routines.sh
new file mode 100644
index 0000000..11947dd
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/solaris/setup-routines.sh
@@ -0,0 +1,383 @@
+# $Id: setup-routines.sh $
+## @file
+# VirtualBox Validation Kit - TestBoxScript Service Setup on Solaris.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+#
+# Detect solaris version.
+#
+MY_SOLARIS_VER=`uname -r`
+case "${MY_SOLARIS_VER}" in
+    5.10) MY_SOLARIS_VER=10;;
+    5.11) MY_SOLARIS_VER=11;;
+    5.12) MY_SOLARIS_VER=12;;
+    *)
+        echo "Your solaris version (${MY_SOLARIS_VER}) is not supported." >&2
+        exit 1;;
+esac
+
+#
+# Overriding setup.sh bits.
+#
+MY_FGREP="/usr/xpg4/bin/fgrep" # The other one does grok -q.
+if [ ! -f "${MY_ETC_SUDOERS}"  -a  -f "/opt/csw/etc/sudoers" ]; then
+    MY_ETC_SUDOERS=/opt/csw/etc/sudoers # Sudo isn't standard on S10.
+fi
+
+#
+# Solaris variables.
+#
+MY_SVC_TMP="/tmp/testboxscript.xml"
+MY_SVC_FMRI="svc:/system/virtualbox/testboxscript"
+MY_SVCCFG="/usr/sbin/svccfg"
+MY_SVCADM="/usr/sbin/svcadm"
+MY_TR="/usr/bin/tr"
+MY_TAB=`printf "\t"`
+if test "${MY_SOLARIS_VER}" -lt 11; then ## No gsed on S10?? ARG!
+    MY_SED="/usr/xpg4/bin/sed"
+else
+    MY_SED="/usr/bin/gsed"
+fi
+if test "${MY_SOLARIS_VER}" -lt 11; then
+    MY_SCREEN="/opt/csw/bin/screen"
+else
+    MY_SCREEN="screen"
+fi
+
+
+check_for_cifs() {
+    if [ ! -f /usr/kernel/fs/amd64/smbfs -a ! -f /usr/kernel/fs/smbfs -a  "${MY_SOLARIS_VER}" -ge 11 ]; then
+        echo "error: smbfs client not installed?" >&2
+        echo "Please install smbfs client support:" >&2
+        echo "     pkg install system/file-system/smb" >&2
+        echo "     svcadm enable svc:/system/idmap" >&2
+        echo "     svcadm enable svc:/network/smb/client" >&2
+        echo "     svcs svc:/system/idmap" >&2
+        return 1;
+    fi
+    return 0;
+}
+
+##
+# Checks for a boolean option pair --$2/--no-$2 in the XMLARGS variable,
+# storing the result in the TESTBOXSCRIPT_XXX variable $1.
+solaris_check_for_option_bool() {
+    MY_TMP=`echo "${XMLARGS} " | ${MY_SED} -ne "s/^.*[ \"]--$2[ \"].*\$/yes/p"`
+    if [ -n "${MY_TMP}" ]; then
+        eval $1="yes";
+    fi
+    MY_TMP=`echo "${XMLARGS} " | ${MY_SED} -ne "s/^.*[ \"]--no-$2[ \"].*\$/yes/p"`
+    if [ -n "${MY_TMP}" ]; then
+        eval $1="no";
+    fi
+    return 0;
+}
+
+##
+# Checks for an option $2 taking an argument, storing the result in the
+# TESTBOXSCRIPT_XXX variable $1.
+solaris_check_for_option_arg() {
+    # ASSUMES no quoted option values nor any escaped spaces.
+    MY_TMP=`echo "${XMLARGS} " | ${MY_SED} -ne "s/^.*[ \"]--$2  *\([^ \"]*\)[ \"].*\$/\1/p"`
+    if [ -n "${MY_TMP}" ]; then
+        eval $1="\"${MY_TMP}\"";
+    fi
+    return 0;
+}
+
+##
+# Loads config values from the current installation.
+#
+os_load_config() {
+    #
+    # Adjust defaults.
+    #
+    # - Use NFS instead of CIFS because S10 doesn't have smbfs and S11 has
+    #   problems getting the password.
+    # - Pass the PATH along so we'll find sudo and other stuff later.
+    #
+    TESTBOXSCRIPT_BUILDS_TYPE="nfs"
+    TESTBOXSCRIPT_TESTRSRC_TYPE="nfs"
+    TESTBOXSCRIPT_ENVVARS[${#TESTBOXSCRIPT_ENVVARS[@]}]="PATH=${PATH}";
+
+    # Load old current.
+    if "${MY_SVCCFG}" "export" "${MY_SVC_FMRI}" > /dev/null 2>&1; then
+        # User. ASSUMES single quoted attribs.
+        MY_TMP=`"${MY_SVCCFG}" "export" "${MY_SVC_FMRI}" \
+                | ${MY_TR} '\n' ' ' \
+               `;
+        MY_TMP=`echo "${MY_TMP} " \
+                | ${MY_SED} \
+                  -e 's/>  */> /g' \
+                  -e 's/  *\/>/ \/>/g' \
+                  -e 's/^.*<method_credential \([^>]*\) \/>.*$/\1/' \
+                  -e "s/^.*user='\([^']*\)'.*\$/\1/" \
+               `;
+        if [ -n "${MY_TMP}" ]; then
+            TESTBOXSCRIPT_USER="${MY_TMP}";
+        fi
+
+        # Arguments. ASSUMES sub-elements. ASSUMES single quoted attribs.
+        XMLARGS=`"${MY_SVCCFG}" "export" "${MY_SVC_FMRI}" \
+                 | ${MY_TR} '\n' ' ' \
+                `;
+        XMLARGS=`echo "${XMLARGS} " \
+                 | ${MY_SED} \
+                   -e 's/>  */> /g' \
+                   -e 's/  *\/>/ \/>/g' \
+                   -e "s/^.*<exec_method \([^>]*\)name='start'\([^>]*\)>.*\$/\1 \2/" \
+                   -e "s/^.*exec='\([^']*\)'.*\$/\1/" \
+                   -e 's/"/"/g' \
+                   -e 's/</</g' \
+                   -e 's/>/>/g' \
+                   -e 's/&/&/g' \
+                `;
+
+        solaris_check_for_option_arg  TESTBOXSCRIPT_SYSTEM_UUID      system-uuid
+        solaris_check_for_option_arg  TESTBOXSCRIPT_SCRATCH_ROOT     scratch-root
+        solaris_check_for_option_arg  TESTBOXSCRIPT_TEST_MANAGER     test-manager
+        solaris_check_for_option_bool TESTBOXSCRIPT_HWVIRT           hwvirt
+        solaris_check_for_option_bool TESTBOXSCRIPT_NESTED_PAGING    nested-paging
+        solaris_check_for_option_bool TESTBOXSCRIPT_IOMMU            io-mmu
+        solaris_check_for_option_arg  TESTBOXSCRIPT_BUILDS_PATH      builds-path
+        solaris_check_for_option_arg  TESTBOXSCRIPT_BUILDS_TYPE      builds-server-type
+        solaris_check_for_option_arg  TESTBOXSCRIPT_BUILDS_NAME      builds-server-name
+        solaris_check_for_option_arg  TESTBOXSCRIPT_BUILDS_SHARE     builds-server-share
+        solaris_check_for_option_arg  TESTBOXSCRIPT_BUILDS_USER      builds-server-user
+        solaris_check_for_option_arg  TESTBOXSCRIPT_BUILDS_PASSWD    builds-server-passwd
+        solaris_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_PATH    testrsrc-path
+        solaris_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_TYPE    testrsrc-server-type
+        solaris_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_NAME    testrsrc-server-name
+        solaris_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_SHARE   testrsrc-server-share
+        solaris_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_USER    testrsrc-server-user
+        solaris_check_for_option_arg  TESTBOXSCRIPT_TESTRSRC_PASSWD  testrsrc-server-passwd
+
+        ## @TODO solaris_check_for_option_arg  TESTBOXSCRIPT_PYTHON           python
+        ## @TODO solaris_check_for_option_arg  TESTBOXSCRIPT_ENVVARS          putenv - Multiple occurences possible.
+    fi
+}
+
+##
+# Adds one or more arguments to MY_ARGV after checking them for conformity.
+#
+solaris_add_args() {
+    while [ $# -gt 0 ];
+    do
+        case "$1" in
+            *\ *)
+                echo "error: Space in option value is not allowed ($1)" >&2
+                exit 1;
+                ;;
+            *${MY_TAB}*)
+                echo "error: Tab in option value is not allowed ($1)" >&2
+                exit 1;
+                ;;
+            *\&*)
+                echo "error: Ampersand in option value is not allowed ($1)" >&2
+                exit 1;
+                ;;
+            *\<*)
+                echo "error: Greater-than in option value is not allowed ($1)" >&2
+                exit 1;
+                ;;
+            *\>*)
+                echo "error: Less-than in option value is not allowed ($1)" >&2
+                exit 1;
+                ;;
+            *)
+                MY_ARGV="${MY_ARGV} $1";
+                ;;
+        esac
+        shift;
+    done
+    return 0;
+}
+
+##
+# Installs, configures and starts the service.
+#
+os_install_service() {
+    # Only NFS for S10.
+    if [ "${MY_SOLARIS_VER}" -lt 11 ]; then
+        if [ "${TESTBOXSCRIPT_BUILDS_TYPE}" != "nfs" -o "${TESTBOXSCRIPT_TESTRSRC_TYPE}" != "nfs" ]; then
+            echo "On solaris 10 both share types must be 'nfs', cifs (smbfs) is not supported." >&2
+            return 1;
+        fi
+    fi
+
+    # Calc the command line.
+    MY_ARGV=""
+    if [ -n "${TESTBOXSCRIPT_PYTHON}" ]; then
+        solaris_add_args "${TESTBOXSCRIPT_PYTHON}"
+    fi
+    solaris_add_args "${TESTBOXSCRIPT_DIR}/testboxscript/testboxscript.py"
+
+    if [ "${TESTBOXSCRIPT_HWVIRT}"        = "yes" ]; then solaris_add_args "--hwvirt"; fi
+    if [ "${TESTBOXSCRIPT_HWVIRT}"        = "no"  ]; then solaris_add_args "--no-hwvirt"; fi
+    if [ "${TESTBOXSCRIPT_NESTED_PAGING}" = "yes" ]; then solaris_add_args "--nested-paging"; fi
+    if [ "${TESTBOXSCRIPT_NESTED_PAGING}" = "no"  ]; then solaris_add_args "--no-nested-paging"; fi
+    if [ "${TESTBOXSCRIPT_IOMMU}"         = "yes" ]; then solaris_add_args "--io-mmu"; fi
+    if [ "${TESTBOXSCRIPT_IOMMU}"         = "no"  ]; then solaris_add_args "--no-io-mmu"; fi
+    if [ -n "${TESTBOXSCRIPT_SYSTEM_UUID}"     ]; then solaris_add_args "--system-uuid" "${TESTBOXSCRIPT_SYSTEM_UUID}"; fi
+    if [ -n "${TESTBOXSCRIPT_TEST_MANAGER}"    ]; then solaris_add_args "--test-manager" "${TESTBOXSCRIPT_TEST_MANAGER}"; fi
+    if [ -n "${TESTBOXSCRIPT_SCRATCH_ROOT}"    ]; then solaris_add_args "--scratch-root" "${TESTBOXSCRIPT_SCRATCH_ROOT}"; fi
+
+    if [ -n "${TESTBOXSCRIPT_BUILDS_PATH}"     ]; then solaris_add_args "--builds-path"            "${TESTBOXSCRIPT_BUILDS_PATH}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_TYPE}"     ]; then solaris_add_args "--builds-server-type"     "${TESTBOXSCRIPT_BUILDS_TYPE}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_NAME}"     ]; then solaris_add_args "--builds-server-name"     "${TESTBOXSCRIPT_BUILDS_NAME}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_SHARE}"    ]; then solaris_add_args "--builds-server-share"    "${TESTBOXSCRIPT_BUILDS_SHARE}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_USER}"     ]; then solaris_add_args "--builds-server-user"     "${TESTBOXSCRIPT_BUILDS_USER}"; fi
+    if [ -n "${TESTBOXSCRIPT_BUILDS_PASSWD}"   ]; then solaris_add_args "--builds-server-passwd"   "${TESTBOXSCRIPT_BUILDS_PASSWD}"; fi
+    if [ -n "${TESTBOXSCRIPT_TESTRSRC_PATH}"   ]; then solaris_add_args "--testrsrc-path"          "${TESTBOXSCRIPT_PATH_TESTRSRC}"; fi
+    if [ -n "${TESTBOXSCRIPT_TESTRSRC_TYPE}"   ]; then solaris_add_args "--testrsrc-server-type"   "${TESTBOXSCRIPT_TESTRSRC_TYPE}"; fi
+    if [ -n "${TESTBOXSCRIPT_TESTRSRC_NAME}"   ]; then solaris_add_args "--testrsrc-server-name"   "${TESTBOXSCRIPT_TESTRSRC_NAME}"; fi
+    if [ -n "${TESTBOXSCRIPT_TESTRSRC_SHARE}"  ]; then solaris_add_args "--testrsrc-server-share"  "${TESTBOXSCRIPT_TESTRSRC_SHARE}"; fi
+    if [ -n "${TESTBOXSCRIPT_TESTRSRC_USER}"   ]; then solaris_add_args "--testrsrc-server-user"   "${TESTBOXSCRIPT_TESTRSRC_USER}"; fi
+    if [ -n "${TESTBOXSCRIPT_TESTRSRC_PASSWD}" ]; then solaris_add_args "--testrsrc-server-passwd" "${TESTBOXSCRIPT_TESTRSRC_PASSWD}"; fi
+    i=0
+    while [ "${i}" -lt "${#TESTBOXSCRIPT_ENVVARS[@]}" ];
+    do
+        solaris_add_args "--putenv" "${TESTBOXSCRIPT_ENVVARS[${i}]}"
+        i=$((${i} + 1))
+    done
+
+    # Create the service xml config file.
+    cat > "${MY_SVC_TMP}" <<EOF
+<?xml version='1.0'?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type='manifest' name='export'>
+    <service name='system/virtualbox/testboxscript' type='service' version='1'>
+        <create_default_instance enabled='false' />
+        <single_instance/>
+
+        <!-- Wait for the network to start up -->
+        <dependency name='milestone-network' grouping='require_all' restart_on='none' type='service'>
+            <service_fmri value='svc:/milestone/network:default' />
+        </dependency>
+
+        <!-- We wish to be started as late as possible... so go crazy with deps. -->
+        <dependency name='milestone-devices' grouping='require_all' restart_on='none' type='service'>
+            <service_fmri value='svc:/milestone/devices:default' />
+        </dependency>
+        <dependency name='multi-user'        grouping='require_all' restart_on='none' type='service'>
+            <service_fmri value='svc:/milestone/multi-user:default' />
+        </dependency>
+        <dependency name='multi-user-server' grouping='require_all' restart_on='none' type='service'>
+            <service_fmri value='svc:/milestone/multi-user-server:default' />
+        </dependency>
+        <dependency name='filesystem-local'  grouping='require_all' restart_on='none' type='service'>
+            <service_fmri value='svc:/system/filesystem/local:default' />
+        </dependency>
+        <dependency name='filesystem-autofs' grouping='require_all' restart_on='none' type='service'>
+            <service_fmri value='svc:/system/filesystem/autofs:default' />
+        </dependency>
+EOF
+    if [ "`uname -r`" = "5.10" ]; then # Seems to be gone in S11?
+        cat >> "${MY_SVC_TMP}" <<EOF
+            <dependency name='filesystem-volfs'  grouping='require_all' restart_on='none' type='service'>
+            <service_fmri value='svc:/system/filesystem/volfs:default' />
+        </dependency>
+EOF
+    fi
+    cat >> "${MY_SVC_TMP}" <<EOF
+        <!-- start + stop methods -->
+        <exec_method type='method' name='start' exec='${MY_SCREEN} -S testboxscript -d -m ${MY_ARGV}'
+            timeout_seconds='30'>
+            <method_context working_directory='${TESTBOXSCRIPT_DIR}'>
+                <method_credential user='${TESTBOXSCRIPT_USER}' />
+                <method_environment>
+                    <envvar name='PATH' value='${PATH}' />
+                </method_environment>
+            </method_context>
+        </exec_method>
+
+        <exec_method type='method' name='stop' exec=':kill' timeout_seconds='60' />
+
+        <property_group name='startd' type='framework'>
+            <!-- sub-process core dumps/signals should not restart session -->
+            <propval name='ignore_error' type='astring' value='core,signal' />
+        </property_group>
+
+        <!-- Description -->
+        <template>
+            <common_name>
+                <loctext xml:lang='C'>VirtualBox TestBox Script</loctext>
+            </common_name>
+        </template>
+    </service>
+</service_bundle>
+EOF
+
+    # Install the service, replacing old stuff.
+    if "${MY_SVCCFG}" "export" "${MY_SVC_FMRI}" > /dev/null 2>&1; then
+        "${MY_SVCCFG}" "delete" "${MY_SVC_FMRI}"
+    fi
+    "${MY_SVCCFG}" "import" "${MY_SVC_TMP}"
+    rm -f "${MY_SVC_TMP}"
+    return 0;
+}
+
+os_enable_service() {
+    "${MY_SVCADM}" "enable" "${MY_SVC_FMRI}"
+    return 0;
+}
+
+os_disable_service() {
+    if "${MY_SVCCFG}" "export" "${MY_SVC_FMRI}" > /dev/null 2>&1; then
+        "${MY_SVCADM}" "disable" "${MY_SVC_FMRI}"
+        sleep 1
+    fi
+    return 0;
+}
+
+os_add_user() {
+    useradd -m -s /usr/bin/bash -G staff "${TESTBOXSCRIPT_USER}"
+    passwd "${TESTBOXSCRIPT_USER}" # This sucker prompts, seemingly no way around that.
+    return 0;
+}
+
+
+maybe_hush_up_root_login() {
+    # We don't want /etc/profile to display /etc/motd, quotas and mail status
+    # every time we do sudo -i... It may screw up serious if we parse the
+    # output of the command we sudid.
+    > ~root/.hushlogin
+    return 0;
+}
+
+os_final_message() {
+    cat <<EOF
+
+Additional things to do:"
+    1. Configure NTP:
+         a) echo "server wei01-time.de.oracle.com" >  /etc/inet/ntp.conf
+            echo "driftfile /var/ntp/ntp.drift"    >> /etc/inet/ntp.conf
+         b) Enable the service: svcadm enable ntp
+         c) Sync once in case of big diff: ntpdate wei01-time.de.oracle.com
+         d) Check that it works: ntpq -p
+
+Enjoy!
+EOF
+}
+
diff --git a/src/VBox/ValidationKit/testboxscript/testboxcommand.py b/src/VBox/ValidationKit/testboxscript/testboxcommand.py
new file mode 100644
index 0000000..a9eb6e4
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/testboxcommand.py
@@ -0,0 +1,356 @@
+# -*- coding: utf-8 -*-
+# $Id: testboxcommand.py $
+
+"""
+TestBox Script - Command Processor.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports.
+import os;
+import sys;
+import threading;
+
+# Validation Kit imports.
+from common             import constants;
+from common             import utils, webutils;
+import testboxcommons;
+from testboxcommons     import TestBoxException;
+from testboxscript      import TBS_EXITCODE_NEED_UPGRADE;
+from testboxupgrade     import upgradeFromZip;
+from testboxtasks       import TestBoxExecTask, TestBoxCleanupTask, TestBoxTestDriverTask;
+
+# Figure where we are.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksTestScriptDir = os.path.dirname(os.path.abspath(__file__));
+
+
+
+class TestBoxCommand(object):
+    """
+    Implementation of Test Box command.
+    """
+
+    ## The time to wait on the current task to abort.
+    kcSecStopTimeout = 360
+    ## The time to wait on the current task to abort before rebooting.
+    kcSecStopBeforeRebootTimeout = 360
+
+    def __init__(self, oTestBoxScript):
+        """
+        Class instance init
+        """
+        self._oTestBoxScript = oTestBoxScript;
+        self._oCurTaskLock   = threading.RLock();
+        self._oCurTask       = None;
+
+        # List of available commands and their handlers
+        self._dfnCommands    = \
+        {
+            constants.tbresp.CMD_IDLE:                 self._cmdIdle,
+            constants.tbresp.CMD_WAIT:                 self._cmdWait,
+            constants.tbresp.CMD_EXEC:                 self._cmdExec,
+            constants.tbresp.CMD_ABORT:                self._cmdAbort,
+            constants.tbresp.CMD_REBOOT:               self._cmdReboot,
+            constants.tbresp.CMD_UPGRADE:              self._cmdUpgrade,
+            constants.tbresp.CMD_UPGRADE_AND_REBOOT:   self._cmdUpgradeAndReboot,
+            constants.tbresp.CMD_SPECIAL:              self._cmdSpecial,
+        }
+
+    def _cmdIdle(self, oResponse, oConnection):
+        """
+        Idle response, no ACK.
+        """
+        oResponse.checkParameterCount(1);
+
+        # The dispatch loop will delay for us, so nothing to do here.
+        _ = oConnection; # Leave the connection open.
+        return True;
+
+    def _cmdWait(self, oResponse, oConnection):
+        """
+        Gang scheduling wait response, no ACK.
+        """
+        oResponse.checkParameterCount(1);
+
+        # The dispatch loop will delay for us, so nothing to do here.
+        _ = oConnection; # Leave the connection open.
+        return True;
+
+    def _cmdExec(self, oResponse, oConnection):
+        """
+        Execute incoming command
+        """
+
+        # Check if required parameters given and make a little sense.
+        idResult        = oResponse.getIntChecked(   constants.tbresp.EXEC_PARAM_RESULT_ID, 1);
+        sScriptZips     = oResponse.getStringChecked(constants.tbresp.EXEC_PARAM_SCRIPT_ZIPS);
+        sScriptCmdLine  = oResponse.getStringChecked(constants.tbresp.EXEC_PARAM_SCRIPT_CMD_LINE);
+        cSecTimeout     = oResponse.getIntChecked(   constants.tbresp.EXEC_PARAM_TIMEOUT, 30);
+        oResponse.checkParameterCount(5);
+
+        sScriptFile     = utils.argsGetFirst(sScriptCmdLine);
+        if sScriptFile is None:
+            raise TestBoxException('Bad script command line: "%s"' % (sScriptCmdLine,));
+        if len(os.path.basename(sScriptFile)) < len('t.py'):
+            raise TestBoxException('Script file name too short: "%s"' % (sScriptFile,));
+        if len(sScriptZips) < len('x.zip'):
+            raise TestBoxException('Script zip name too short: "%s"' % (sScriptFile,));
+
+        # One task at the time.
+        if self.isRunning():
+            raise TestBoxException('Already running other command');
+
+        # Don't bother running the task without the shares mounted.
+        self._oTestBoxScript.mountShares(); # Raises exception on failure.
+
+        # Kick off the task and ACK the command.
+        self._oCurTaskLock.acquire();
+        try:
+            self._oCurTask = TestBoxExecTask(self._oTestBoxScript, idResult = idResult, sScriptZips = sScriptZips,
+                                             sScriptCmdLine = sScriptCmdLine, cSecTimeout = cSecTimeout);
+        finally:
+            self._oCurTaskLock.release();
+        oConnection.sendAckAndClose(constants.tbresp.CMD_EXEC);
+        return True;
+
+    def _cmdAbort(self, oResponse, oConnection):
+        """
+        Abort background task
+        """
+        oResponse.checkParameterCount(1);
+        oConnection.sendAck(constants.tbresp.CMD_ABORT);
+
+        oCurTask = self._getCurTask();
+        if oCurTask is not None:
+            oCurTask.terminate();
+            oCurTask.flushLogOnConnection(oConnection);
+            oConnection.close();
+            oCurTask.wait(self.kcSecStopTimeout);
+
+        return True;
+
+    def doReboot(self):
+        """
+        Worker common to _cmdReboot and _doUpgrade that performs a system reboot.
+        """
+        # !! Not more exceptions beyond this point !!
+        testboxcommons.log('Rebooting');
+
+        # Stop anything that might be executing at this point.
+        oCurTask = self._getCurTask();
+        if oCurTask is not None:
+            oCurTask.terminate();
+            oCurTask.wait(self.kcSecStopBeforeRebootTimeout);
+
+        # Invoke shutdown command line utility.
+        sOs = utils.getHostOs();
+        asCmd2 = None;
+        if sOs == 'win':
+            asCmd = ['shutdown', '/r', '/t', '0'];
+        elif sOs == 'os2':
+            asCmd = ['setboot', '/B'];
+        elif sOs in ('solaris',):
+            asCmd = ['/usr/sbin/reboot', '-p'];
+            asCmd2 = ['/usr/sbin/reboot']; # Hack! S10 doesn't have -p, but don't know how to reliably detect S10.
+        else:
+            asCmd = ['/sbin/shutdown', '-r', 'now'];
+        try:
+            utils.sudoProcessOutputChecked(asCmd);
+        except Exception, oXcpt:
+            if asCmd2 is not None:
+                try:
+                    utils.sudoProcessOutputChecked(asCmd2);
+                except Exception, oXcpt:
+                    testboxcommons.log('Error executing reboot command "%s" as well as "%s": %s' % (asCmd, asCmd2, oXcpt));
+                    return False;
+            testboxcommons.log('Error executing reboot command "%s": %s' % (asCmd, oXcpt));
+            return False;
+
+        # Quit the script.
+        while True:
+            sys.exit(32);
+        return True;
+
+    def _cmdReboot(self, oResponse, oConnection):
+        """
+        Reboot Test Box
+        """
+        oResponse.checkParameterCount(1);
+        oConnection.sendAckAndClose(constants.tbresp.CMD_REBOOT);
+        return self.doReboot();
+
+    def _doUpgrade(self, oResponse, oConnection, fReboot):
+        """
+        Common worker for _cmdUpgrade and _cmdUpgradeAndReboot.
+        Will sys.exit on success!
+        """
+
+        #
+        # The server specifies a ZIP archive with the new scripts. It's ASSUMED
+        # that the zip is of selected files at g_ksValidationKitDir in SVN.  It's
+        # further ASSUMED that we're executing from
+        #
+        sZipUrl = oResponse.getStringChecked(constants.tbresp.UPGRADE_PARAM_URL)
+        oResponse.checkParameterCount(2);
+
+        if utils.isRunningFromCheckout():
+            raise TestBoxException('Cannot upgrade when running from the tree!');
+        oConnection.sendAckAndClose(constants.tbresp.CMD_UPGRADE_AND_REBOOT if fReboot else constants.tbresp.CMD_UPGRADE);
+
+        testboxcommons.log('Upgrading...');
+
+        #
+        # Download the file and install it.
+        #
+        sDstFile = os.path.join(g_ksTestScriptDir, 'VBoxTestBoxScript.zip');
+        if os.path.exists(sDstFile):
+            os.unlink(sDstFile);
+        fRc = webutils.downloadFile(sZipUrl, sDstFile, self._oTestBoxScript.getPathBuilds(), testboxcommons.log);
+        if fRc is not True:
+            return False;
+
+        if upgradeFromZip(sDstFile) is not True:
+            return False;
+
+        #
+        # Restart the system or the script (we have a parent script which
+        # respawns us when we quit).
+        #
+        if fReboot:
+            self.doReboot();
+        sys.exit(TBS_EXITCODE_NEED_UPGRADE);
+
+    def _cmdUpgrade(self, oResponse, oConnection):
+        """
+        Upgrade Test Box Script
+        """
+        return self._doUpgrade(oResponse, oConnection, False);
+
+    def _cmdUpgradeAndReboot(self, oResponse, oConnection):
+        """
+        Upgrade Test Box Script
+        """
+        return self._doUpgrade(oResponse, oConnection, True);
+
+    def _cmdSpecial(self, oResponse, oConnection):
+        """
+        Reserved for future fun.
+        """
+        oConnection.sendReplyAndClose(constants.tbreq.COMMAND_NOTSUP, constants.tbresp.CMD_SPECIAL);
+        testboxcommons.log('Special command %s not supported...' % (oResponse,));
+        return False;
+
+
+    def handleCommand(self, oResponse, oConnection):
+        """
+        Handles a command from the test manager.
+
+        Some commands will close the connection, others (generally the simple
+        ones) wont, leaving the caller the option to use it for log flushing.
+
+        Returns success indicator.
+        Raises no exception.
+        """
+        try:
+            sCmdName = oResponse.getStringChecked(constants.tbresp.ALL_PARAM_RESULT);
+        except Exception, oXcpt:
+            oConnection.close();
+            return False;
+
+        # Do we know the command?
+        fRc = False;
+        if sCmdName in self._dfnCommands:
+            testboxcommons.log(sCmdName);
+            try:
+                # Execute the handler.
+                fRc = self._dfnCommands[sCmdName](oResponse, oConnection)
+            except Exception, oXcpt:
+                # NACK the command if an exception is raised during parameter validation.
+                testboxcommons.log1Xcpt('Exception executing "%s": %s' % (sCmdName, oXcpt));
+                if oConnection.isConnected():
+                    try:
+                        oConnection.sendReplyAndClose(constants.tbreq.COMMAND_NACK, sCmdName);
+                    except Exception, oXcpt2:
+                        testboxcommons.log('Failed to NACK "%s": %s' % (sCmdName, oXcpt2));
+        elif sCmdName in [constants.tbresp.STATUS_DEAD, constants.tbresp.STATUS_NACK]:
+            testboxcommons.log('Received status in stead of command: %s' % (sCmdName, ));
+        else:
+            # NOTSUP the unknown command.
+            testboxcommons.log('Received unknown command: %s' % (sCmdName, ));
+            try:
+                oConnection.sendReplyAndClose(constants.tbreq.COMMAND_NOTSUP, sCmdName);
+            except Exception, oXcpt:
+                testboxcommons.log('Failed to NOTSUP "%s": %s' % (sCmdName, oXcpt));
+        return fRc;
+
+    def resumeIncompleteCommand(self):
+        """
+        Resumes an incomplete command at startup.
+
+        The EXEC commands saves essential state information in the scratch area
+        so we can resume them in case the testbox panics or is rebooted.
+        Current "resume" means doing cleanups, but we may need to implement
+        test scenarios involving rebooting the testbox later.
+
+        Returns (idTestBox, sTestBoxName, True) if a command was resumed,
+        otherwise (-1, '', False).  Raises no exceptions.
+        """
+
+        try:
+            oTask = TestBoxCleanupTask(self._oTestBoxScript);
+        except:
+            return (-1, '', False);
+
+        self._oCurTaskLock.acquire();
+        self._oCurTask = oTask;
+        self._oCurTaskLock.release();
+
+        return (oTask.idTestBox, oTask.sTestBoxName, True);
+
+    def isRunning(self):
+        """
+        Check if we're running a task or not.
+        """
+        oCurTask = self._getCurTask();
+        return oCurTask is not None and oCurTask.isRunning();
+
+    def flushLogOnConnection(self, oGivenConnection):
+        """
+        Flushes the log of any running task with a log buffer.
+        """
+        oCurTask = self._getCurTask();
+        if oCurTask is not None and isinstance(oCurTask, TestBoxTestDriverTask):
+            return oCurTask.flushLogOnConnection(oGivenConnection);
+        return None;
+
+    def _getCurTask(self):
+        """ Gets the current task in a paranoidly safe manny. """
+        self._oCurTaskLock.acquire();
+        oCurTask = self._oCurTask;
+        self._oCurTaskLock.release();
+        return oCurTask;
+
diff --git a/src/VBox/ValidationKit/testboxscript/testboxcommons.py b/src/VBox/ValidationKit/testboxscript/testboxcommons.py
new file mode 100644
index 0000000..623af17
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/testboxcommons.py
@@ -0,0 +1,136 @@
+# -*- coding: utf-8 -*-
+# $Id: testboxcommons.py $
+
+"""
+TestBox Script - Common Functions and Classes.
+
+This module contains constants and functions that are useful for all
+the files in this (testbox) directory.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import sys
+import traceback
+
+# Validation Kit imports.
+from common import utils;
+
+#
+# Exceptions.
+#
+
+class TestBoxException(Exception):
+    """
+    Custom exception class
+    """
+    pass
+
+#
+# Logging.
+#
+
+def log(sMessage, sCaller = None, sTsPrf = None):
+    """
+    Print out a message and flush stdout
+    """
+    if sTsPrf is None: sTsPrf = utils.getTimePrefix();
+    print('[%s] %s' % (sTsPrf, sMessage,));
+    sys.stdout.flush();
+    _ = sCaller;
+
+def log2(sMessage, sCaller = None, sTsPrf = None):
+    """
+    Debug logging, will later be disabled by default.
+    """
+    if True:
+        if sTsPrf is None: sTsPrf = utils.getTimePrefix();
+        print('[%s] %s' % (sTsPrf, sMessage,));
+        sys.stdout.flush()
+        _ = sCaller;
+
+def _logXcptWorker(fnLogger, sPrefix = '', sText = None, cFrames = 1, fnLogger1 = log):
+    """
+    Log an exception, optionally with a preceeding message and more than one
+    call frame.
+    """
+    ## @todo skip all this if iLevel is too high!
+
+    # Try get exception info.
+    sTsPrf = utils.getTimePrefix();
+    try:
+        oType, oValue, oTraceback = sys.exc_info();
+    except:
+        oType = oValue = oTraceback = None;
+    if oType is not None:
+
+        # Try format the info
+        try:
+            rc      = 0;
+            sCaller = utils.getCallerName(oTraceback.tb_frame);
+            if sText is not None:
+                rc = fnLogger('%s%s' % (sPrefix, sText), sCaller, sTsPrf);
+            asInfo = [];
+            try:
+                asInfo = asInfo + traceback.format_exception_only(oType, oValue);
+                if cFrames is not None and cFrames <= 1:
+                    asInfo = asInfo + traceback.format_tb(oTraceback, 1);
+                else:
+                    asInfo.append('Traceback:')
+                    asInfo = asInfo + traceback.format_tb(oTraceback, cFrames);
+                    asInfo.append('Stack:')
+                    asInfo = asInfo + traceback.format_stack(oTraceback.tb_frame.f_back, cFrames);
+            except:
+                fnLogger1('internal-error: Hit exception #2! %s' % (traceback.format_exc()), sCaller, sTsPrf);
+
+            if len(asInfo) > 0:
+                # Do the logging.
+                for sItem in asInfo:
+                    asLines = sItem.splitlines();
+                    for sLine in asLines:
+                        rc = fnLogger('%s%s' % (sPrefix, sLine), sCaller, sTsPrf);
+
+            else:
+                fnLogger('No exception info...', sCaller, sTsPrf);
+                rc = -3;
+        except:
+            fnLogger1('internal-error: Hit exception! %s' % (traceback.format_exc()), None, sTsPrf);
+            rc = -2;
+    else:
+        fnLogger1('internal-error: No exception! %s' % (utils.getCallerName(iFrame=3)), utils.getCallerName(iFrame=3), sTsPrf);
+        rc = -1;
+
+    return rc;
+
+
+def log1Xcpt(sText = None, cFrames = 1):
+    """Logs an exception."""
+    return _logXcptWorker(log, '', sText, cFrames);
+
+def log2Xcpt(sText = None, cFrames = 1):
+    """Debug logging of an exception."""
+    return _logXcptWorker(log2, '', sText, cFrames);
+
diff --git a/src/VBox/ValidationKit/testboxscript/testboxconnection.py b/src/VBox/ValidationKit/testboxscript/testboxconnection.py
new file mode 100644
index 0000000..0683d01
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/testboxconnection.py
@@ -0,0 +1,296 @@
+# -*- coding: utf-8 -*-
+# $Id: testboxconnection.py $
+
+"""
+TestBox Script - HTTP Connection Handling.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import httplib
+import urllib
+import urlparse
+import sys
+
+# Validation Kit imports.
+from common import constants
+from common import utils
+import testboxcommons
+
+
+
+class TestBoxResponse(object):
+    """
+    Response object return by TestBoxConnection.request().
+    """
+    def __init__(self, oResponse):
+        """
+        Convert the HTTPResponse to a dictionary, raising TestBoxException on
+        malformed response.
+        """
+        if oResponse is not None:
+            # Read the whole response (so we can log it).
+            sBody = oResponse.read();
+
+            # Check the content type.
+            sContentType = oResponse.getheader('Content-Type');
+            if sContentType is None  or  sContentType != 'application/x-www-form-urlencoded; charset=utf-8':
+                testboxcommons.log('SERVER RESPONSE: Content-Type: %s' % (sContentType,));
+                testboxcommons.log('SERVER RESPONSE: %s' % (sBody.rstrip(),))
+                raise testboxcommons.TestBoxException('Invalid server response type: "%s"' % (sContentType,));
+
+            # Parse the body (this should be the exact reverse of what
+            # TestBoxConnection.postRequestRaw).
+            ##testboxcommons.log2('SERVER RESPONSE: "%s"' % (sBody,))
+            self._dResponse = urlparse.parse_qs(sBody, strict_parsing=True);
+
+            # Convert the dictionary from 'field:values' to 'field:value'. Fail
+            # if a field has more than one value (i.e. given more than once).
+            for sField in self._dResponse:
+                if len(self._dResponse[sField]) != 1:
+                    raise testboxcommons.TestBoxException('The field "%s" appears more than once in the server response' \
+                                                          % (sField,));
+                self._dResponse[sField] = self._dResponse[sField][0]
+        else:
+            # Special case, dummy response object.
+            self._dResponse = dict();
+        # Done.
+
+    def getStringChecked(self, sField):
+        """
+        Check if specified field is present in server response and returns it as string.
+        If not present, a fitting exception will be raised.
+        """
+        if not sField in self._dResponse:
+            raise testboxcommons.TestBoxException('Required data (' + str(sField) + ') was not found in server response');
+        return str(self._dResponse[sField]).strip();
+
+    def getIntChecked(self, sField, iMin = None, iMax = None):
+        """
+        Check if specified field is present in server response and returns it as integer.
+        If not present, a fitting exception will be raised.
+
+        The iMin and iMax values are inclusive.
+        """
+        if not sField in self._dResponse:
+            raise testboxcommons.TestBoxException('Required data (' + str(sField) + ') was not found in server response')
+        try:
+            iValue = int(self._dResponse[sField]);
+        except:
+            raise testboxcommons.TestBoxException('Malformed integer field %s: "%s"' % (sField, self._dResponse[sField]));
+
+        if   (iMin is not None and iValue < iMin) \
+          or (iMax is not None and iValue > iMax):
+            raise testboxcommons.TestBoxException('Value (%d) of field %s is out of range [%s..%s]' \
+                                                  % (iValue, sField, iMin, iMax));
+        return iValue;
+
+    def checkParameterCount(self, cExpected):
+        """
+        Checks the parameter count, raise TestBoxException if it doesn't meet
+        the expectations.
+        """
+        if len(self._dResponse) != cExpected:
+            raise testboxcommons.TestBoxException('Expected %d parameters, server sent %d' % (cExpected, len(self._dResponse)));
+        return True;
+
+    def toString(self):
+        """
+        Convers the response to a string (for debugging purposes).
+        """
+        return str(self._dResponse);
+
+
+class TestBoxConnection(object):
+    """
+    Wrapper around HTTPConnection.
+    """
+
+    def __init__(self, sTestManagerUrl, sTestBoxId, sTestBoxUuid, fLongTimeout = False):
+        """
+        Constructor.
+        """
+        self._oConn             = None;
+        self._oParsedUrl        = urlparse.urlparse(sTestManagerUrl);
+        self._sTestBoxId        = sTestBoxId;
+        self._sTestBoxUuid      = sTestBoxUuid;
+
+        #
+        # Connect to it - may raise exception on failure.
+        # When connecting we're using a 15 second timeout, we increase it later.
+        #
+        if self._oParsedUrl.scheme == 'https': # pylint: disable=E1101
+            fnCtor = httplib.HTTPSConnection;
+        else:
+            fnCtor = httplib.HTTPConnection;
+        if     sys.version_info[0] >= 3 \
+           or (sys.version_info[0] == 2 and sys.version_info[1] >= 6):
+
+            self._oConn = fnCtor(self._oParsedUrl.hostname, timeout=15);
+        else:
+            self._oConn = fnCtor(self._oParsedUrl.hostname);
+
+        if self._oConn.sock is None:
+            self._oConn.connect();
+
+        #
+        # Increase the timeout for the non-connect operations.
+        #
+        try:
+            self._oConn.sock.settimeout(5*60 if fLongTimeout else 1 * 60);
+        except:
+            pass;
+
+        ##testboxcommons.log2('hostname=%s timeout=%u' % (self._oParsedUrl.hostname, self._oConn.sock.gettimeout()));
+
+    def __del__(self):
+        """ Makes sure the connection is really closed on destruction """
+        self.close()
+
+    def close(self):
+        """ Closes the connection """
+        if self._oConn is not None:
+            self._oConn.close();
+            self._oConn = None;
+
+    def postRequestRaw(self, sAction, dParams):
+        """
+        Posts a request to the test manager and gets the response.  The dParams
+        argument is a dictionary of unencoded key-value pairs (will be
+        modified).
+        Raises exception on failure.
+        """
+        dHeader = \
+        {
+            'Content-Type':     'application/x-www-form-urlencoded; charset=utf-8',
+            'User-Agent':       'TestBoxScript/%s.0 (%s, %s)' % (__version__, utils.getHostOs(), utils.getHostArch()),
+            'Accept':           'text/plain,application/x-www-form-urlencoded',
+            'Accept-Encoding':  'identity',
+            'Cache-Control':    'max-age=0',
+            'Connection':       'keep-alive',
+        };
+        sServerPath = '/%s/testboxdisp.py' % (self._oParsedUrl.path.strip('/'),); # pylint: disable=E1101
+        dParams[constants.tbreq.ALL_PARAM_ACTION] = sAction;
+        sBody = urllib.urlencode(dParams);
+        ##testboxcommons.log2('sServerPath=%s' % (sServerPath,));
+        try:
+            self._oConn.request('POST', sServerPath, sBody, dHeader);
+            oResponse = self._oConn.getresponse();
+            oResponse2 = TestBoxResponse(oResponse);
+        except:
+            testboxcommons.log2Xcpt();
+            raise
+        return oResponse2;
+
+    def postRequest(self, sAction, dParams = None):
+        """
+        Posts a request to the test manager, prepending the testbox ID and
+        UUID to the arguments, and gets the response. The dParams argument is a
+        is a dictionary of unencoded key-value pairs (will be modified).
+        Raises exception on failure.
+        """
+        if dParams is None:
+            dParams = dict();
+        dParams[constants.tbreq.ALL_PARAM_TESTBOX_ID]   = self._sTestBoxId;
+        dParams[constants.tbreq.ALL_PARAM_TESTBOX_UUID] = self._sTestBoxUuid;
+        return self.postRequestRaw(sAction, dParams);
+
+    def sendReply(self, sReplyAction, sCmdName):
+        """
+        Sends a reply to a test manager command.
+        Raises exception on failure.
+        """
+        return self.postRequest(sReplyAction, { constants.tbreq.COMMAND_ACK_PARAM_CMD_NAME: sCmdName });
+
+    def sendReplyAndClose(self, sReplyAction, sCmdName):
+        """
+        Sends a reply to a test manager command and closes the connection.
+        Raises exception on failure.
+        """
+        self.sendReply(sReplyAction, sCmdName);
+        self.close();
+        return True;
+
+    def sendAckAndClose(self, sCmdName):
+        """
+        Acks a command and closes the connection to the test manager.
+        Raises exception on failure.
+        """
+        return self.sendReplyAndClose(constants.tbreq.COMMAND_ACK, sCmdName);
+
+    def sendAck(self, sCmdName):
+        """
+        Acks a command.
+        Raises exception on failure.
+        """
+        return self.sendReply(constants.tbreq.COMMAND_ACK, sCmdName);
+
+    @staticmethod
+    def sendSignOn(sTestManagerUrl, dParams):
+        """
+        Sends a sign-on request to the server, returns the response (TestBoxResponse).
+        No exceptions will be raised.
+        """
+        oConnection = None;
+        try:
+            oConnection = TestBoxConnection(sTestManagerUrl, None, None);
+            return oConnection.postRequestRaw(constants.tbreq.SIGNON, dParams);
+        except:
+            testboxcommons.log2Xcpt();
+            if oConnection is not None: # Be kind to apache.
+                try:    oConnection.close();
+                except: pass;
+
+        return TestBoxResponse(None);
+
+    @staticmethod
+    def requestCommandWithConnection(sTestManagerUrl, sTestBoxId, sTestBoxUuid, fBusy):
+        """
+        Queries the test manager for a command and returns its respons + an open
+        connection for acking/nack the command (and maybe more).
+
+        No exceptions will be raised.  On failure (None, None) will be returned.
+        """
+        oConnection = None;
+        try:
+            oConnection = TestBoxConnection(sTestManagerUrl, sTestBoxId, sTestBoxUuid, fLongTimeout = not fBusy);
+            if fBusy:
+                oResponse = oConnection.postRequest(constants.tbreq.REQUEST_COMMAND_BUSY);
+            else:
+                oResponse = oConnection.postRequest(constants.tbreq.REQUEST_COMMAND_IDLE);
+            return (oResponse, oConnection);
+        except:
+            testboxcommons.log2Xcpt();
+            if oConnection is not None: # Be kind to apache.
+                try:    oConnection.close();
+                except: pass;
+        return (None, None);
+
+    def isConnected(self):
+        """
+        Checks if we are still connected.
+        """
+        return self._oConn is not None;
diff --git a/src/VBox/ValidationKit/testboxscript/testboxscript.py b/src/VBox/ValidationKit/testboxscript/testboxscript.py
new file mode 100755
index 0000000..13564c7
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/testboxscript.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: testboxscript.py $
+
+"""
+TestBox Script Wrapper.
+
+This script aimes at respawning the Test Box Script when it terminates
+abnormally or due to an UPGRADE request.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+import subprocess
+import sys
+import os
+import time
+
+
+## @name Test Box script exit statuses (see also RTEXITCODE)
+# @remarks These will _never_ change
+# @{
+TBS_EXITCODE_FAILURE        = 1         # RTEXITCODE_FAILURE
+TBS_EXITCODE_SYNTAX         = 2         # RTEXITCODE_SYNTAX
+TBS_EXITCODE_NEED_UPGRADE   = 9
+## @}
+
+
+class TestBoxScriptWrapper(object): # pylint: disable=R0903
+    """
+    Wrapper class
+    """
+
+    TESTBOX_SCRIPT_FILENAME = 'testboxscript_real.py'
+
+    def __init__(self):
+        """
+        Init
+        """
+        self.task = None
+
+    def __del__(self):
+        """
+        Cleanup
+        """
+        if self.task is not None:
+            print 'Wait for child task...'
+            self.task.terminate()
+            self.task.wait()
+            print 'done. Exiting'
+            self.task = None;
+
+    def run(self):
+        """
+        Start spawning the real TestBox script.
+        """
+
+        # Figure out where we live first.
+        try:
+            __file__
+        except:
+            __file__ = sys.argv[0];
+        sTestBoxScriptDir = os.path.dirname(os.path.abspath(__file__));
+
+        # Construct the argument list for the real script (same dir).
+        sRealScript = os.path.join(sTestBoxScriptDir, TestBoxScriptWrapper.TESTBOX_SCRIPT_FILENAME);
+        asArgs = sys.argv[1:];
+        asArgs.insert(0, sRealScript);
+        if sys.executable is not None and len(sys.executable) > 0:
+            asArgs.insert(0, sys.executable);
+
+        # Look for --pidfile <name> and write a pid file.
+        sPidFile = None;
+        for i in range(len(asArgs)):
+            if asArgs[i] == '--pidfile' and i + 1 < len(asArgs):
+                sPidFile = asArgs[i + 1];
+                break;
+            if asArgs[i] == '--':
+                break;
+        if sPidFile is not None and len(sPidFile) > 0:
+            oPidFile = open(sPidFile, 'w');
+            oPidFile.write(str(os.getpid()));
+            oPidFile.close();
+
+        # Execute the testbox script almost forever in a relaxed loop.
+        rcExit = TBS_EXITCODE_FAILURE;
+        while True:
+            self.task = subprocess.Popen(asArgs, shell=False);
+            rcExit = self.task.wait();
+            self.task = None;
+            if rcExit == TBS_EXITCODE_SYNTAX:
+                break;
+
+            # Relax.
+            time.sleep(1);
+        return rcExit;
+
+if __name__ == '__main__':
+    sys.exit(TestBoxScriptWrapper().run());
+
diff --git a/src/VBox/ValidationKit/testboxscript/testboxscript_real.py b/src/VBox/ValidationKit/testboxscript/testboxscript_real.py
new file mode 100755
index 0000000..ecab1e4
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/testboxscript_real.py
@@ -0,0 +1,982 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: testboxscript_real.py $
+
+"""
+TestBox Script - main().
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import math
+import multiprocessing
+import os
+from optparse import OptionParser
+import platform
+import random
+import shutil
+import sys
+import tempfile
+import time
+import uuid
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksTestScriptDir = os.path.dirname(os.path.abspath(__file__));
+g_ksValidationKitDir = os.path.dirname(g_ksTestScriptDir);
+sys.path.extend([g_ksTestScriptDir, g_ksValidationKitDir]);
+
+# Validation Kit imports.
+from common             import constants;
+from common             import utils;
+import testboxcommons;
+from testboxcommons     import TestBoxException;
+from testboxcommand     import TestBoxCommand;
+from testboxconnection  import TestBoxConnection;
+from testboxscript      import TBS_EXITCODE_SYNTAX, TBS_EXITCODE_FAILURE;
+
+
+class TestBoxScriptException(Exception):
+    """ For raising exceptions during TestBoxScript.__init__. """
+    pass;
+
+
+class TestBoxScript(object):
+    """
+    Implementation of the test box script.
+    Communicate with test manager and perform offered actions.
+    """
+
+    ## @name Class Constants.
+    # @{
+
+    # Scratch space round value (MB).
+    kcMbScratchSpaceRounding = 64
+    # Memory size round value (MB).
+    kcMbMemoryRounding = 4
+    # A NULL UUID in string form.
+    ksNullUuid = '00000000-0000-0000-0000-000000000000';
+    # The minimum dispatch loop delay.
+    kcSecMinDelay = 12;
+    # The maximum dispatch loop delay (inclusive).
+    kcSecMaxDelay = 24;
+    # The minimum sign-on delay.
+    kcSecMinSignOnDelay = 30;
+    # The maximum sign-on delay (inclusive).
+    kcSecMaxSignOnDelay = 60;
+
+    # Keys for config params
+    VALUE = 'value'
+    FN = 'fn'                           # pylint: disable=C0103
+
+    ## @}
+
+
+    def __init__(self, oOptions):
+        """
+        Initialize internals
+        """
+        self._oOptions        = oOptions;
+        self._sTestBoxHelper  = None;
+
+        # Signed-on state
+        self._cSignOnAttempts = 0;
+        self._fSignedOn       = False;
+        self._fNeedReSignOn   = False;
+        self._fFirstSignOn    = True;
+        self._idTestBox       = None;
+        self._sTestBoxName    = '';
+        self._sTestBoxUuid    = self.ksNullUuid; # convenience, assigned below.
+
+        # Command processor.
+        self._oCommand = TestBoxCommand(self);
+
+        #
+        # Scratch dir setup.  Use /var/tmp instead of /tmp because we may need
+        # many many GBs for some test scenarios and /tmp can be backed by swap
+        # or be a fast+small disk of some kind, while /var/tmp is normally
+        # larger, if slower.  /var/tmp is generally not cleaned up on reboot,
+        # /tmp often is, this would break host panic / triple-fault detection.
+        #
+        if self._oOptions.sScratchRoot is None:
+            if utils.getHostOs() in ('win', 'os2', 'haiku', 'dos'):
+                # We need *lots* of space, so avoid /tmp as it may be a memory
+                # file system backed by the swap file, or worse.
+                self._oOptions.sScratchRoot = tempfile.gettempdir();
+            else:
+                self._oOptions.sScratchRoot = '/var/tmp';
+            sSubDir = 'testbox';
+            try:
+                sSubDir = '%s-%u' % (sSubDir, os.getuid()); # pylint: disable=E1101
+            except:
+                pass;
+            self._oOptions.sScratchRoot = os.path.join(self._oOptions.sScratchRoot, sSubDir);
+
+        self._sScratchSpill   = os.path.join(self._oOptions.sScratchRoot, 'scratch');
+        self._sScratchScripts = os.path.join(self._oOptions.sScratchRoot, 'scripts');
+        self._sScratchState   = os.path.join(self._oOptions.sScratchRoot, 'state');   # persistant storage.
+
+        for sDir in [self._oOptions.sScratchRoot, self._sScratchSpill, self._sScratchScripts, self._sScratchState]:
+            if not os.path.isdir(sDir):
+                os.makedirs(sDir, 0700);
+
+        # We count consecutive reinitScratch failures and will reboot the
+        # testbox after a while in the hope that it will correct the issue.
+        self._cReinitScratchErrors = 0;
+
+        #
+        # Mount builds and test resources if requested.
+        #
+        self.mountShares();
+
+        #
+        # Sign-on parameters: Packed into list of records of format:
+        # { <Parameter ID>: { <Current value>, <Check function> } }
+        #
+        self._ddSignOnParams = \
+        {
+            constants.tbreq.ALL_PARAM_TESTBOX_UUID:        { self.VALUE: self._getHostSystemUuid(),    self.FN: None },
+            constants.tbreq.SIGNON_PARAM_OS:               { self.VALUE: utils.getHostOs(),            self.FN: None },
+            constants.tbreq.SIGNON_PARAM_OS_VERSION:       { self.VALUE: utils.getHostOsVersion(),     self.FN: None },
+            constants.tbreq.SIGNON_PARAM_CPU_ARCH:         { self.VALUE: utils.getHostArch(),          self.FN: None },
+            constants.tbreq.SIGNON_PARAM_CPU_VENDOR:       { self.VALUE: self._getHostCpuVendor(),     self.FN: None },
+            constants.tbreq.SIGNON_PARAM_CPU_NAME:         { self.VALUE: self._getHostCpuName(),       self.FN: None },
+            constants.tbreq.SIGNON_PARAM_CPU_REVISION:     { self.VALUE: self._getHostCpuRevision(),   self.FN: None },
+            constants.tbreq.SIGNON_PARAM_HAS_HW_VIRT:      { self.VALUE: self._hasHostHwVirt(),        self.FN: None },
+            constants.tbreq.SIGNON_PARAM_HAS_NESTED_PAGING:{ self.VALUE: self._hasHostNestedPaging(),  self.FN: None },
+            constants.tbreq.SIGNON_PARAM_HAS_64_BIT_GUEST: { self.VALUE: self._can64BitGuest(),        self.FN: None },
+            constants.tbreq.SIGNON_PARAM_HAS_IOMMU:        { self.VALUE: self._hasHostIoMmu(),         self.FN: None },
+            constants.tbreq.SIGNON_PARAM_SCRIPT_REV:       { self.VALUE: self._getScriptRev(),         self.FN: None },
+            constants.tbreq.SIGNON_PARAM_REPORT:           { self.VALUE: self._getHostReport(),        self.FN: None },
+            constants.tbreq.SIGNON_PARAM_PYTHON_VERSION:   { self.VALUE: self._getPythonHexVersion(),  self.FN: None },
+            constants.tbreq.SIGNON_PARAM_CPU_COUNT:        { self.VALUE: None,     self.FN: multiprocessing.cpu_count },
+            constants.tbreq.SIGNON_PARAM_MEM_SIZE:         { self.VALUE: None,     self.FN: self._getHostMemSize },
+            constants.tbreq.SIGNON_PARAM_SCRATCH_SIZE:     { self.VALUE: None,     self.FN: self._getFreeScratchSpace },
+        }
+        for sItem in self._ddSignOnParams:
+            if self._ddSignOnParams[sItem][self.FN] is not None:
+                self._ddSignOnParams[sItem][self.VALUE] = self._ddSignOnParams[sItem][self.FN]()
+
+        testboxcommons.log('Starting Test Box script (%s)' % __version__)
+        testboxcommons.log('Test Manager URL: %s' % self._oOptions.sTestManagerUrl,)
+        testboxcommons.log('Scratch root path: %s' % self._oOptions.sScratchRoot,)
+        for sItem in self._ddSignOnParams:
+            testboxcommons.log('Sign-On value %18s: %s' % (sItem, self._ddSignOnParams[sItem][self.VALUE]));
+
+        #
+        # The System UUID is the primary identification of the machine, so
+        # refuse to cooperate if it's NULL.
+        #
+        self._sTestBoxUuid = self.getSignOnParam(constants.tbreq.ALL_PARAM_TESTBOX_UUID);
+        if self._sTestBoxUuid == self.ksNullUuid:
+            raise TestBoxScriptException('Couldn\'t determine the System UUID, please use --system-uuid to specify it.');
+
+        #
+        # Export environment variables, clearing any we don't know yet.
+        #
+        for sEnvVar in self._oOptions.asEnvVars:
+            iEqual = sEnvVar.find('=');
+            if iEqual == -1:    # No '=', remove it.
+                if sEnvVar in os.environ:
+                    del os.environ[sEnvVar];
+            elif iEqual > 0:    # Set it.
+                os.environ[sEnvVar[:iEqual]] = sEnvVar[iEqual+1:];
+            else:               # Starts with '=', bad user.
+                raise TestBoxScriptException('Invalid -E argument: "%s"' % (sEnvVar,));
+
+        os.environ['TESTBOX_PATH_BUILDS']       = self._oOptions.sBuildsPath;
+        os.environ['TESTBOX_PATH_RESOURCES']    = self._oOptions.sTestRsrcPath;
+        os.environ['TESTBOX_PATH_SCRATCH']      = self._sScratchSpill;
+        os.environ['TESTBOX_PATH_SCRIPTS']      = self._sScratchScripts;
+        os.environ['TESTBOX_PATH_UPLOAD']       = self._sScratchSpill; ## @todo drop the UPLOAD dir?
+        os.environ['TESTBOX_HAS_HW_VIRT']       = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_HAS_HW_VIRT);
+        os.environ['TESTBOX_HAS_NESTED_PAGING'] = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_HAS_NESTED_PAGING);
+        os.environ['TESTBOX_HAS_IOMMU']         = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_HAS_IOMMU);
+        os.environ['TESTBOX_SCRIPT_REV']        = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_SCRIPT_REV);
+        os.environ['TESTBOX_CPU_COUNT']         = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_CPU_COUNT);
+        os.environ['TESTBOX_MEM_SIZE']          = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_MEM_SIZE);
+        os.environ['TESTBOX_SCRATCH_SIZE']      = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_SCRATCH_SIZE);
+        os.environ['TESTBOX_MANAGER_URL']       = self._oOptions.sTestManagerUrl;
+        os.environ['TESTBOX_UUID']              = self._sTestBoxUuid;
+        os.environ['TESTBOX_REPORTER']          = 'remote';
+        os.environ['TESTBOX_NAME']              = '';
+        os.environ['TESTBOX_ID']                = '';
+        os.environ['TESTBOX_TEST_SET_ID']       = '';
+        os.environ['TESTBOX_TIMEOUT']           = '0';
+        os.environ['TESTBOX_TIMEOUT_ABS']       = '0';
+
+        if utils.getHostOs() is 'win':
+            os.environ['COMSPEC']            = os.path.join(os.environ['SystemRoot'], 'System32', 'cmd.exe');
+        # Currently omitting any kBuild tools.
+
+    def mountShares(self):
+        """
+        Mounts the shares.
+        Raises exception on failure.
+        """
+        self._mountShare(self._oOptions.sBuildsPath, self._oOptions.sBuildsServerType, self._oOptions.sBuildsServerName,
+                         self._oOptions.sBuildsServerShare,
+                         self._oOptions.sBuildsServerUser, self._oOptions.sBuildsServerPasswd, 'builds');
+        self._mountShare(self._oOptions.sTestRsrcPath, self._oOptions.sTestRsrcServerType, self._oOptions.sTestRsrcServerName,
+                         self._oOptions.sTestRsrcServerShare,
+                         self._oOptions.sTestRsrcServerUser, self._oOptions.sTestRsrcServerPasswd, 'testrsrc');
+        return True;
+
+    def _mountShare(self, sMountPoint, sType, sServer, sShare, sUser, sPassword, sWhat):
+        """
+        Mounts the specified share if needed.
+        Raises exception on failure.
+        """
+        # Only mount if the type is specified.
+        if sType is None:
+            return True;
+
+        # Test if already mounted.
+        sTestFile = os.path.join(sMountPoint + os.path.sep, sShare + '.txt');
+        if os.path.isfile(sTestFile):
+            return True;
+
+        #
+        # Platform specific mount code.
+        #
+        sHostOs = utils.getHostOs()
+        if sHostOs in ('darwin', 'freebsd'):
+            utils.sudoProcessCall(['/sbin/umount', sMountPoint]);
+            utils.sudoProcessCall(['/bin/mkdir', '-p', sMountPoint]);
+            utils.sudoProcessCall(['/usr/sbin/chown', str(os.getuid()), sMountPoint]); # pylint: disable=E1101
+            if sType == 'cifs':
+                # Note! no smb://server/share stuff here, 10.6.8 didn't like it.
+                utils.processOutputChecked(['/sbin/mount_smbfs', '-o', 'automounted,nostreams,soft,noowners,noatime,rdonly',
+                                            '-f', '0555', '-d', '0555',
+                                            '//%s:%s@%s/%s' % (sUser, sPassword, sServer, sShare),
+                                            sMountPoint]);
+            else:
+                raise TestBoxScriptException('Unsupported server type %s.' % (sType,));
+
+        elif sHostOs == 'linux':
+            utils.sudoProcessCall(['/bin/umount', sMountPoint]);
+            utils.sudoProcessCall(['/bin/mkdir', '-p', sMountPoint]);
+            if sType == 'cifs':
+                utils.sudoProcessOutputChecked(['/bin/mount', '-t', 'cifs',
+                                                '-o',
+                                                  'user=' + sUser
+                                                + ',password=' + sPassword
+                                                + ',sec=ntlmv2'
+                                                + ',uid=' + str(os.getuid()) # pylint: disable=E1101
+                                                + ',gid=' + str(os.getgid()) # pylint: disable=E1101
+                                                + ',nounix,file_mode=0555,dir_mode=0555,soft,ro',
+                                                '//%s/%s' % (sServer, sShare),
+                                                sMountPoint]);
+            elif sType == 'nfs':
+                utils.sudoProcessOutputChecked(['/bin/mount', '-t', 'nfs',
+                                                '-o', 'soft,ro',
+                                                '%s:%s' % (sServer, sShare if sShare.find('/') >= 0 else ('/export/' + sShare)),
+                                                sMountPoint]);
+
+            else:
+                raise TestBoxScriptException('Unsupported server type %s.' % (sType,));
+
+        elif sHostOs == 'solaris':
+            utils.sudoProcessCall(['/sbin/umount', sMountPoint]);
+            utils.sudoProcessCall(['/bin/mkdir', '-p', sMountPoint]);
+            if sType == 'cifs':
+                ## @todo This stuff doesn't work on wei01-x4600b.de.oracle.com running 11.1. FIXME!
+                oPasswdFile = tempfile.TemporaryFile();
+                oPasswdFile.write(sPassword + '\n');
+                oPasswdFile.flush();
+                utils.sudoProcessOutputChecked(['/sbin/mount', '-F', 'smbfs',
+                                                '-o',
+                                                  'user=' + sUser
+                                                + ',uid=' + str(os.getuid()) # pylint: disable=E1101
+                                                + ',gid=' + str(os.getgid()) # pylint: disable=E1101
+                                                + ',fileperms=0555,dirperms=0555,noxattr,ro',
+                                                '//%s/%s' % (sServer, sShare),
+                                                sMountPoint],
+                                               stdin = oPasswdFile);
+                oPasswdFile.close();
+            elif sType == 'nfs':
+                utils.sudoProcessOutputChecked(['/sbin/mount', '-F', 'nfs',
+                                                '-o', 'noxattr,ro',
+                                                '%s:%s' % (sServer, sShare if sShare.find('/') >= 0 else ('/export/' + sShare)),
+                                                sMountPoint]);
+
+            else:
+                raise TestBoxScriptException('Unsupported server type %s.' % (sType,));
+
+
+        elif sHostOs == 'win':
+            if sType != 'cifs':
+                raise TestBoxScriptException('Only CIFS mounts are supported on Windows.');
+            utils.processCall(['net', 'use', sMountPoint, '/d']);
+            utils.processOutputChecked(['net', 'use', sMountPoint,
+                                        '\\\\' + sServer + '\\' + sShare,
+                                        sPassword,
+                                        '/USER:' + sUser,]);
+        else:
+            raise TestBoxScriptException('Unsupported host %s' % (sHostOs,));
+
+        #
+        # Re-test.
+        #
+        if not os.path.isfile(sTestFile):
+            raise TestBoxException('Failed to mount %s (%s[%s]) at %s: %s not found'
+                                   % (sWhat, sServer, sShare, sMountPoint, sTestFile));
+
+        return True;
+
+    ## @name Signon property releated methods.
+    # @{
+
+    def _getHelperOutput(self, sCmd):
+        """
+        Invokes TestBoxHelper to obtain information hard to access from python.
+        """
+        if self._sTestBoxHelper is None:
+            if not utils.isRunningFromCheckout():
+                # See VBoxTestBoxScript.zip for layout.
+                self._sTestBoxHelper = os.path.join(g_ksValidationKitDir, utils.getHostOs(), utils.getHostArch(), \
+                                                    'TestBoxHelper');
+            else: # Only for in-tree testing, so don't bother be too accurate right now.
+                sType = os.environ.get('KBUILD_TYPE', os.environ.get('BUILD_TYPE', 'debug'));
+                self._sTestBoxHelper = os.path.join(g_ksValidationKitDir, os.pardir, os.pardir, os.pardir, 'out', \
+                                                    utils.getHostOsDotArch(), sType, 'testboxscript', \
+                                                    utils.getHostOs(), utils.getHostArch(), \
+                                                    'TestBoxHelper');
+            if utils.getHostOs() in ['win', 'os2']:
+                self._sTestBoxHelper += '.exe';
+
+        return utils.processOutputChecked([self._sTestBoxHelper, sCmd]).strip();
+
+    def _getHelperOutputTristate(self, sCmd, fDunnoValue):
+        """
+        Invokes TestBoxHelper to obtain information hard to access from python.
+        """
+        sValue = self._getHelperOutput(sCmd);
+        sValue = sValue.lower();
+        if sValue == 'true':
+            return True;
+        if sValue == 'false':
+            return False;
+        if sValue != 'dunno' and sValue != 'none':
+            raise TestBoxException('Unexpected response "%s" to helper command "%s"' % (sValue, sCmd));
+        return fDunnoValue;
+
+
+    @staticmethod
+    def _isUuidGood(sUuid):
+        """
+        Checks if the UUID looks good.
+
+        There are systems with really bad UUIDs, for instance
+        "03000200-0400-0500-0006-000700080009".
+        """
+        if sUuid == TestBoxScript.ksNullUuid:
+            return False;
+        sUuid = sUuid.lower();
+        for sDigit in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']:
+            if sUuid.count(sDigit) > 16:
+                return False;
+        return True;
+
+    def _getHostSystemUuid(self):
+        """
+        Get the system UUID string from the System, return null-uuid if
+        unable to get retrieve it.
+        """
+        if self._oOptions.sSystemUuid is not None:
+            return self._oOptions.sSystemUuid;
+
+        sUuid = self.ksNullUuid;
+
+        #
+        # Try get at the firmware UUID.
+        #
+        if utils.getHostOs() == 'linux':
+            # NOTE: This requires to have kernel option enabled:
+            #       Firmware Drivers -> Export DMI identification via sysfs to userspace
+            if os.path.exists('/sys/devices/virtual/dmi/id/product_uuid'):
+                try:
+                    sVar = utils.sudoProcessOutputChecked(['cat', '/sys/devices/virtual/dmi/id/product_uuid']);
+                    sUuid = str(uuid.UUID(sVar.strip()));
+                except:
+                    pass;
+            ## @todo consider dmidecoder? What about EFI systems?
+
+        elif utils.getHostOs() == 'win':
+            # Windows: WMI
+            try:
+                import win32com.client;  # pylint: disable=F0401
+                oWmi  = win32com.client.Dispatch('WbemScripting.SWbemLocator');
+                oWebm = oWmi.ConnectServer('.', 'root\\cimv2');
+                for oItem in oWebm.ExecQuery('SELECT * FROM Win32_ComputerSystemProduct'):
+                    if oItem.UUID != None:
+                        sUuid = str(uuid.UUID(oItem.UUID));
+            except:
+                pass;
+
+        elif utils.getHostOs() == 'darwin':
+            try:
+                sVar = utils.processOutputChecked(['/bin/sh', '-c',
+                                                   '/usr/sbin/ioreg -k IOPlatformUUID' \
+                                                   + '| /usr/bin/grep IOPlatformUUID' \
+                                                   + '| /usr/bin/head -1']);
+                sVar = sVar.strip()[-(len(self.ksNullUuid) + 1):-1];
+                sUuid = str(uuid.UUID(sVar));
+            except:
+                pass;
+
+        elif utils.getHostOs() == 'solaris':
+            # Solaris: The smbios util.
+            try:
+                sVar = utils.processOutputChecked(['/bin/sh', '-c',
+                                                   '/usr/sbin/smbios ' \
+                                                   + '| /usr/xpg4/bin/sed -ne \'s/^.*UUID: *//p\'' \
+                                                   + '| /usr/bin/head -1']);
+                sUuid = str(uuid.UUID(sVar.strip()));
+            except:
+                pass;
+
+        if self._isUuidGood(sUuid):
+            return sUuid;
+
+        #
+        # Try add the MAC address.
+        # uuid.getnode may provide it, or it may return a random number...
+        #
+        lMacAddr = uuid.getnode();
+        sNode = '%012x' % (lMacAddr,)
+        if lMacAddr == uuid.getnode() and lMacAddr != 0 and len(sNode) == 12:
+            return sUuid[:-12] + sNode;
+
+        return sUuid;
+
+    def _getHostCpuVendor(self):
+        """
+        Get the CPUID vendor string on intel HW.
+        """
+        return self._getHelperOutput('cpuvendor');
+
+    def _getHostCpuName(self):
+        """
+        Get the CPU name/description string.
+        """
+        return self._getHelperOutput('cpuname');
+
+    def _getHostCpuRevision(self):
+        """
+        Get the CPU revision (family/model/stepping) value.
+        """
+        return self._getHelperOutput('cpurevision');
+
+    def _hasHostHwVirt(self):
+        """
+        Check if the host supports AMD-V or VT-x
+        """
+        if self._oOptions.fHasHwVirt is None:
+            self._oOptions.fHasHwVirt = self._getHelperOutput('cpuhwvirt');
+        return self._oOptions.fHasHwVirt;
+
+    def _hasHostNestedPaging(self):
+        """
+        Check if the host supports nested paging.
+        """
+        if not self._hasHostHwVirt():
+            return False;
+        if self._oOptions.fHasNestedPaging is None:
+            self._oOptions.fHasNestedPaging = self._getHelperOutputTristate('nestedpaging', False);
+        return self._oOptions.fHasNestedPaging;
+
+    def _can64BitGuest(self):
+        """
+        Check if the we (VBox) can run 64-bit guests.
+        """
+        if not self._hasHostHwVirt():
+            return False;
+        if self._oOptions.fCan64BitGuest is None:
+            self._oOptions.fCan64BitGuest = self._getHelperOutputTristate('longmode', True);
+        return self._oOptions.fCan64BitGuest;
+
+    def _hasHostIoMmu(self):
+        """
+        Check if the host has an I/O MMU of the VT-d kind.
+        """
+        if not self._hasHostHwVirt():
+            return False;
+        if self._oOptions.fHasIoMmu is None:
+            ## @todo Any way to figure this one out on any host OS?
+            self._oOptions.fHasIoMmu = False;
+        return self._oOptions.fHasIoMmu;
+
+    def _getHostReport(self):
+        """
+        Generate a report about the host hardware and software.
+        """
+        return self._getHelperOutput('report');
+
+
+    def _getHostMemSize(self):
+        """
+        Gets the amount of physical memory on the host (and accessible to the
+        OS, i.e. don't report stuff over 4GB if Windows doesn't wanna use it).
+        Unit: MiB.
+        """
+        cMbMemory = long(self._getHelperOutput('memsize').strip()) / (1024 * 1024);
+
+        # Round it.
+        cMbMemory = long(math.floor(cMbMemory / self.kcMbMemoryRounding)) * self.kcMbMemoryRounding;
+        return cMbMemory;
+
+    def _getFreeScratchSpace(self):
+        """
+        Get free space on the volume where scratch directory is located and
+        return it in bytes rounded down to nearest 64MB
+        (currently works on Linux only)
+        Unit: MiB.
+        """
+        if platform.system() == 'Windows':
+            import ctypes
+            cTypeMbFreeSpace = ctypes.c_ulonglong(0)
+            ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(self._oOptions.sScratchRoot), None, None,
+                                                       ctypes.pointer(cTypeMbFreeSpace))
+            cMbFreeSpace = cTypeMbFreeSpace.value
+        else:
+            stats = os.statvfs(self._oOptions.sScratchRoot); # pylint: disable=E1101
+            cMbFreeSpace = stats.f_frsize * stats.f_bfree
+
+        # Convert to MB
+        cMbFreeSpace = long(cMbFreeSpace) /(1024 * 1024)
+
+        # Round free space size
+        cMbFreeSpace = long(math.floor(cMbFreeSpace / self.kcMbScratchSpaceRounding)) * self.kcMbScratchSpaceRounding;
+        return cMbFreeSpace;
+
+    def _getScriptRev(self):
+        """
+        The script (subversion) revision number.
+        """
+        return __version__[11:-1].strip();
+
+    def _getPythonHexVersion(self):
+        """
+        The python hex version number.
+        """
+        uHexVersion = getattr(sys, 'hexversion', None);
+        if uHexVersion is None:
+            uHexVersion = (sys.version_info[0] << 24) | (sys.version_info[1] << 16) | (sys.version_info[2] << 8);
+            if sys.version_info[3] == 'final':
+                uHexVersion |= 0xf0;
+        return uHexVersion;
+
+    # @}
+
+    def openTestManagerConnection(self):
+        """
+        Opens up a connection to the test manager.
+
+        Raises exception on failure.
+        """
+        return TestBoxConnection(self._oOptions.sTestManagerUrl, self._idTestBox, self._sTestBoxUuid);
+
+    def getSignOnParam(self, sName):
+        """
+        Returns a sign-on parameter value as string.
+        Raises exception if the name is incorrect.
+        """
+        return str(self._ddSignOnParams[sName][self.VALUE]);
+
+    def getPathState(self):
+        """
+        Get the path to the state dir in the scratch area.
+        """
+        return self._sScratchState;
+
+    def getPathScripts(self):
+        """
+        Get the path to the scripts dir (TESTBOX_PATH_SCRIPTS) in the scratch area.
+        """
+        return self._sScratchScripts;
+
+    def getPathSpill(self):
+        """
+        Get the path to the spill dir (TESTBOX_PATH_SCRATCH) in the scratch area.
+        """
+        return self._sScratchSpill;
+
+    def getPathBuilds(self):
+        """
+        Get the path to the builds.
+        """
+        return self._oOptions.sBuildsPath;
+
+    def getTestBoxId(self):
+        """
+        Get the TestBox ID for state saving purposes.
+        """
+        return self._idTestBox;
+
+    def getTestBoxName(self):
+        """
+        Get the TestBox name for state saving purposes.
+        """
+        return self._sTestBoxName;
+
+    def reinitScratch(self, fnLog = testboxcommons.log, fUseTheForce = None):
+        """
+        Wipes the scratch directories and re-initializes them.
+
+        No exceptions raise, returns success indicator instead.
+        """
+        if fUseTheForce is None:
+            fUseTheForce = self._fFirstSignOn;
+
+        class ErrorCallback(object): # pylint: disable=R0903
+            """
+            Callbacks + state for the cleanup.
+            """
+            def __init__(self):
+                self.fRc = True;
+            def onErrorCallback(self, sFnName, sPath, aXcptInfo):
+                """ Logs error during shutil.rmtree operation. """
+                fnLog('Error removing "%s": fn=%s %s' % (sPath, sFnName, aXcptInfo[1]));
+                self.fRc = False;
+        oRc = ErrorCallback();
+
+        #
+        # Cleanup.
+        #
+        for sName in os.listdir(self._oOptions.sScratchRoot):
+            sFullName = os.path.join(self._oOptions.sScratchRoot, sName);
+            try:
+                if os.path.isdir(sFullName):
+                    shutil.rmtree(sFullName, False, oRc.onErrorCallback);
+                else:
+                    os.remove(sFullName);
+                if os.path.exists(sFullName):
+                    raise Exception('Still exists after deletion, weird.');
+            except Exception, oXcpt:
+                if    fUseTheForce is True \
+                  and utils.getHostOs() not in ['win', 'os2'] \
+                  and len(sFullName) >= 8 \
+                  and sFullName[0] == '/' \
+                  and sFullName[1] != '/' \
+                  and sFullName.find('/../') < 0:
+                    fnLog('Problems deleting "%s" (%s) using the force...' % (sFullName, oXcpt));
+                    try:
+                        if os.path.isdir(sFullName):
+                            iRc = utils.sudoProcessCall(['/bin/rm', '-Rf', sFullName])
+                        else:
+                            iRc = utils.sudoProcessCall(['/bin/rm', '-f', sFullName])
+                        if iRc != 0:
+                            raise Exception('exit code %s' % iRc);
+                        if os.path.exists(sFullName):
+                            raise Exception('Still exists after forced deletion, weird^2.');
+                    except:
+                        fnLog('Error sudo deleting "%s": %s' % (sFullName, oXcpt));
+                        oRc.fRc = False;
+                else:
+                    fnLog('Error deleting "%s": %s' % (sFullName, oXcpt));
+                    oRc.fRc = False;
+
+        #
+        # Re-create the directories.
+        #
+        for sDir in [self._oOptions.sScratchRoot, self._sScratchSpill, self._sScratchScripts, self._sScratchState]:
+            if not os.path.isdir(sDir):
+                try:
+                    os.makedirs(sDir, 0700);
+                except Exception, oXcpt:
+                    fnLog('Error creating "%s": %s' % (sDir, oXcpt));
+                    oRc.fRc = False;
+
+        if oRc.fRc is True:
+            self._cReinitScratchErrors = 0;
+        else:
+            self._cReinitScratchErrors += 1;
+        return oRc.fRc;
+
+    def _doSignOn(self):
+        """
+        Worker for _maybeSignOn that does the actual signing on.
+        """
+        assert not self._oCommand.isRunning();
+
+        # Reset the siged-on state.
+        testboxcommons.log('Signing-on...')
+        self._fSignedOn = False
+        self._idTestBox = None
+        self._cSignOnAttempts += 1;
+
+        # Assemble SIGN-ON request parameters and send the request.
+        dParams = {};
+        for sParam in self._ddSignOnParams:
+            dParams[sParam] = self._ddSignOnParams[sParam][self.VALUE];
+        oResponse = TestBoxConnection.sendSignOn(self._oOptions.sTestManagerUrl, dParams);
+
+        # Check response.
+        try:
+            sResult = oResponse.getStringChecked(constants.tbresp.ALL_PARAM_RESULT);
+            if sResult != constants.tbresp.STATUS_ACK:
+                raise TestBoxException('Result is %s' % (sResult,));
+            oResponse.checkParameterCount(3);
+            idTestBox    = oResponse.getIntChecked(constants.tbresp.SIGNON_PARAM_ID, 1, 0x7ffffffe);
+            sTestBoxName = oResponse.getStringChecked(constants.tbresp.SIGNON_PARAM_NAME);
+        except TestBoxException, err:
+            testboxcommons.log('Failed to sign-on: %s' % (str(err),))
+            testboxcommons.log('Server response: %s' % (oResponse.toString(),));
+            return False;
+
+        # Successfully signed on, update the state.
+        self._fSignedOn       = True;
+        self._fNeedReSignOn   = False;
+        self._cSignOnAttempts = 0;
+        self._idTestBox       = idTestBox;
+        self._sTestBoxName    = sTestBoxName;
+
+        # Update the environment.
+        os.environ['TESTBOX_ID']            = str(self._idTestBox);
+        os.environ['TESTBOX_NAME']          = sTestBoxName;
+        os.environ['TESTBOX_CPU_COUNT']     = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_CPU_COUNT);
+        os.environ['TESTBOX_MEM_SIZE']      = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_MEM_SIZE);
+        os.environ['TESTBOX_SCRATCH_SIZE']  = self.getSignOnParam(constants.tbreq.SIGNON_PARAM_SCRATCH_SIZE);
+
+        testboxcommons.log('Successfully signed-on with Test Box ID #%s and given the name "%s"' \
+                           % (self._idTestBox, self._sTestBoxName));
+
+        # Set up the scratch area.
+        self.reinitScratch(fUseTheForce = self._fFirstSignOn);
+
+        self._fFirstSignOn = False;
+        return True;
+
+    def _maybeSignOn(self):
+        """
+        Check if Test Box parameters were changed
+        and do sign-in in case of positive result
+        """
+
+        # Skip sign-on check if background command is currently in
+        # running state (avoid infinite signing on).
+        if self._oCommand.isRunning():
+            return None;
+
+        # Refresh sign-on parameters, changes triggers sign-on.
+        fNeedSignOn = (True if not self._fSignedOn or self._fNeedReSignOn else False)
+        for item in self._ddSignOnParams:
+            if self._ddSignOnParams[item][self.FN] is None:
+                continue
+
+            sOldValue = self._ddSignOnParams[item][self.VALUE]
+            self._ddSignOnParams[item][self.VALUE] = self._ddSignOnParams[item][self.FN]()
+            if sOldValue != self._ddSignOnParams[item][self.VALUE]:
+                fNeedSignOn = True
+                testboxcommons.log('Detected %s parameter change: %s -> %s' %
+                                   (item, sOldValue, self._ddSignOnParams[item][self.VALUE]))
+
+        if fNeedSignOn:
+            self._doSignOn();
+        return None;
+
+    def dispatch(self):
+        """
+        Receive orders from Test Manager and execute them
+        """
+
+        (self._idTestBox, self._sTestBoxName, self._fSignedOn) = self._oCommand.resumeIncompleteCommand();
+        self._fNeedReSignOn = self._fSignedOn;
+        if self._fSignedOn:
+            os.environ['TESTBOX_ID']   = str(self._idTestBox);
+            os.environ['TESTBOX_NAME'] = self._sTestBoxName;
+
+        while True:
+            # Make sure we're signed on before trying to do anything.
+            self._maybeSignOn();
+            while not self._fSignedOn:
+                iFactor = 1 if self._cSignOnAttempts < 100 else 4;
+                time.sleep(random.randint(self.kcSecMinSignOnDelay * iFactor, self.kcSecMaxSignOnDelay * iFactor));
+                self._maybeSignOn();
+
+            # Retrieve and handle command from the TM.
+            (oResponse, oConnection) = TestBoxConnection.requestCommandWithConnection(self._oOptions.sTestManagerUrl,
+                                                                                      self._idTestBox,
+                                                                                      self._sTestBoxUuid,
+                                                                                      self._oCommand.isRunning());
+            if oResponse is not None:
+                self._oCommand.handleCommand(oResponse, oConnection);
+            if oConnection is not None:
+                if oConnection.isConnected():
+                    self._oCommand.flushLogOnConnection(oConnection);
+                oConnection.close();
+
+            # Automatically reboot if scratch init fails.
+            if self._cReinitScratchErrors > 8 and self.reinitScratch() is False:
+                testboxcommons.log('Scratch does not initialize cleanly after %d attempts, rebooting...'
+                                   % ( self._cReinitScratchErrors, ));
+                self._oCommand.doReboot();
+
+            # delay a wee bit before looping.
+            ## @todo We shouldn't bother the server too frequently.  We should try combine the test reporting done elsewhere
+            # with the command retrieval done here.  I believe tinderclient.pl is capable of doing that.
+            iFactor = 1;
+            if self._cReinitScratchErrors > 0:
+                iFactor = 4;
+            time.sleep(random.randint(self.kcSecMinDelay * iFactor, self.kcSecMaxDelay * iFactor));
+
+        # Not reached.
+
+
+    @staticmethod
+    def main():
+        """
+        Main function a la C/C++. Returns exit code.
+        """
+
+        #
+        # Parse arguments.
+        #
+        if utils.getHostOs() in ('win', 'os2'):
+            sDefTestRsrc = 'T:';
+            sDefBuilds   = 'U:';
+        elif utils.getHostOs() == 'darwin':
+            sDefTestRsrc = '/Volumes/testrsrc';
+            sDefBuilds   = '/Volumes/builds';
+        else:
+            sDefTestRsrc = '/mnt/testrsrc';
+            sDefBuilds   = '/mnt/builds';
+
+        class MyOptionParser(OptionParser):
+            """ We need to override the exit code on --help, error and so on. """
+            def __init__(self, *args, **kwargs):
+                OptionParser.__init__(self, *args, **kwargs);
+            def exit(self, status = 0, msg = None):
+                OptionParser.exit(self, TBS_EXITCODE_SYNTAX, msg);
+
+        parser = MyOptionParser(version=__version__[11:-1].strip());
+        for sMixed, sDefault, sDesc in [('Builds', sDefBuilds, 'builds'),  ('TestRsrc', sDefTestRsrc, 'test resources') ]:
+            sLower = sMixed.lower();
+            sPrefix = 's' + sMixed;
+            parser.add_option('--' + sLower + '-path',
+                              dest=sPrefix + 'Path',         metavar='<abs-path>', default=sDefault,
+                              help='Where ' + sDesc + ' can be found');
+            parser.add_option('--' + sLower + '-server-type',
+                              dest=sPrefix + 'ServerType',   metavar='<nfs|cifs>', default=None,
+                              help='The type of server, cifs or nfs. If empty (default), we won\'t try mount anything.');
+            parser.add_option('--' + sLower + '-server-name',
+                              dest=sPrefix + 'ServerName',   metavar='<server>',   default='solserv.de.oracle.com',
+                              help='The name of the server with the builds.');
+            parser.add_option('--' + sLower + '-server-share',
+                              dest=sPrefix + 'ServerShare',  metavar='<share>',    default=sLower,
+                              help='The name of the builds share.');
+            parser.add_option('--' + sLower + '-server-user',
+                              dest=sPrefix + 'ServerUser',   metavar='<user>',     default='guestr',
+                              help='The user name to use when accessing the ' + sDesc + ' share.');
+            parser.add_option('--' + sLower + '-server-passwd', '--' + sLower + '-server-password',
+                              dest=sPrefix + 'ServerPasswd', metavar='<password>', default='guestr',
+                              help='The password to use when accessing the ' + sDesc + ' share.');
+
+        parser.add_option("--test-manager", metavar="<url>",
+                          dest="sTestManagerUrl",
+                          help="Test Manager URL",
+                          default="http://tindertux.de.oracle.com/testmanager")
+        parser.add_option("--scratch-root", metavar="<abs-path>",
+                          dest="sScratchRoot",
+                          help="Path to the scratch directory",
+                          default=None)
+        parser.add_option("--system-uuid", metavar="<uuid>",
+                          dest="sSystemUuid",
+                          help="The system UUID of the testbox, used for uniquely identifiying the machine",
+                          default=None)
+        parser.add_option("--hwvirt",
+                          dest="fHasHwVirt", action="store_true", default=None,
+                          help="Hardware virtualization available in the CPU");
+        parser.add_option("--no-hwvirt",
+                          dest="fHasHwVirt", action="store_false", default=None,
+                          help="Hardware virtualization not available in the CPU");
+        parser.add_option("--nested-paging",
+                          dest="fHasNestedPaging", action="store_true", default=None,
+                          help="Nested paging is available");
+        parser.add_option("--no-nested-paging",
+                          dest="fHasNestedPaging", action="store_false", default=None,
+                          help="Nested paging is not available");
+        parser.add_option("--64-bit-guest",
+                          dest="fCan64BitGuest", action="store_true", default=None,
+                          help="Host can execute 64-bit guests");
+        parser.add_option("--no-64-bit-guest",
+                          dest="fCan64BitGuest", action="store_false", default=None,
+                          help="Host cannot execute 64-bit guests");
+        parser.add_option("--io-mmu",
+                          dest="fHasIoMmu", action="store_true", default=None,
+                          help="I/O MMU available");
+        parser.add_option("--no-io-mmu",
+                          dest="fHasIoMmu", action="store_false", default=None,
+                          help="No I/O MMU available");
+        parser.add_option("--pidfile",
+                          dest="sPidFile", default=None,
+                          help="For the parent script, ignored.");
+        parser.add_option("-E", "--putenv", metavar = "<variable>=<value>", action = "append",
+                          dest = "asEnvVars", default = [],
+                          help = "Sets an environment variable. Can be repeated.");
+
+        (oOptions, args) = parser.parse_args()
+        # Check command line
+        if args != []:
+            parser.print_help();
+            return TBS_EXITCODE_SYNTAX;
+
+        if oOptions.sSystemUuid is not None:
+            uuid.UUID(oOptions.sSystemUuid);
+        if   not oOptions.sTestManagerUrl.startswith('http://') \
+         and not oOptions.sTestManagerUrl.startswith('https://'):
+            print('Syntax error: Invalid test manager URL "%s"' % (oOptions.sTestManagerUrl,));
+            return TBS_EXITCODE_SYNTAX;
+
+        for sPrefix in ['sBuilds', 'sTestRsrc']:
+            sType = getattr(oOptions, sPrefix + 'ServerType');
+            if sType is None or len(sType.strip()) == 0:
+                setattr(oOptions, sPrefix + 'ServerType', None);
+            elif sType not in ['cifs', 'nfs']:
+                print('Syntax error: Invalid server type "%s"' % (sType,));
+                return TBS_EXITCODE_SYNTAX;
+
+
+        #
+        # Instantiate the testbox script and start dispatching work.
+        #
+        try:
+            oTestBoxScript = TestBoxScript(oOptions);
+        except TestBoxScriptException, oXcpt:
+            print('Error: %s' % (oXcpt,));
+            return TBS_EXITCODE_SYNTAX;
+        oTestBoxScript.dispatch();
+
+        # Not supposed to get here...
+        return TBS_EXITCODE_FAILURE;
+
+
+
+if __name__ == '__main__':
+    sys.exit(TestBoxScript.main());
+
diff --git a/src/VBox/ValidationKit/testboxscript/testboxtasks.py b/src/VBox/ValidationKit/testboxscript/testboxtasks.py
new file mode 100644
index 0000000..6078b98
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/testboxtasks.py
@@ -0,0 +1,916 @@
+# -*- coding: utf-8 -*-
+# $Id: testboxtasks.py $
+
+"""
+TestBox Script - Async Tasks.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+from datetime import datetime
+import os
+import re
+import signal;
+import sys
+import subprocess
+import threading
+import time
+
+# Validation Kit imports.
+from common import constants
+from common import utils;
+from common import webutils;
+import testboxcommons
+
+# Figure where we are.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksTestScriptDir = os.path.dirname(os.path.abspath(__file__));
+
+
+
+class TestBoxBaseTask(object):
+    """
+    Asynchronous task employing a thread to do the actual work.
+    """
+
+    ## Time to wait for a task to terminate.
+    kcSecTerminateTimeout = 60
+
+    def __init__(self, oTestBoxScript, cSecTimeout, fnThreadProc):
+        self._oTestBoxScript    = oTestBoxScript;
+        self._cSecTimeout       = cSecTimeout;
+        self._tsSecStarted      = utils.timestampSecond();
+        self.__oRLock           = threading.RLock();
+        self._oCv               = threading.Condition(self.__oRLock);
+        self._fRunning          = True;     # Protected by lock.
+        self._fShouldTerminate  = False;    # Protected by lock.
+
+        # Spawn the worker thread.
+        self._oThread           = threading.Thread(target=fnThreadProc);
+        self._oThread.daemon    = True;
+        self._oThread.start();
+
+    def _lock(self):
+        """ Take the CV lock. """
+        self._oCv.acquire();
+
+    def _unlock(self):
+        """ Release the CV lock. """
+        self._oCv.release();
+
+    def _complete(self):
+        """
+        Indicate that the task is complete, waking up the main thread.
+        Usually called at the end of the thread procedure.
+        """
+        self._lock();
+        self._fRunning = False;
+        self._oCv.notifyAll();
+        self._unlock();
+
+    def isRunning(self):
+        """ Check if the task is still running. """
+        self._lock();
+        fRunning = self._fRunning;
+        self._unlock();
+        return fRunning;
+
+    def wait(self, cSecTimeout):
+        """ Wait for the task to complete. """
+        self._lock();
+        fRunning = self._fRunning;
+        if fRunning is True and cSecTimeout > 0:
+            self._oCv.wait(cSecTimeout)
+        self._unlock();
+        return fRunning;
+
+    def terminate(self, cSecTimeout = kcSecTerminateTimeout):
+        """ Terminate the task. """
+        self._lock();
+        self._fShouldTerminate = True;
+        self._unlock();
+
+        return self.wait(cSecTimeout);
+
+    def _shouldTerminate(self):
+        """
+        Returns True if we should terminate, False if not.
+        """
+        self._lock();
+        fShouldTerminate = self._fShouldTerminate == True;
+        self._unlock();
+        return fShouldTerminate;
+
+
+class TestBoxTestDriverTask(TestBoxBaseTask):
+    """
+    Base class for tasks involving test drivers.
+    """
+
+    ## When to flush the backlog of log messages.
+    kcchMaxBackLog = 32768;
+
+    ## The backlog sync time (seconds).
+    kcSecBackLogFlush = 30;
+
+    ## The timeout for the cleanup job (5 mins).
+    kcSecCleanupTimeout = 300;
+    ## The timeout to wait for the abort command before killing it.
+    kcSecAbortTimeout = 300;
+
+    ## The timeout to wait for the final output to be processed.
+    kcSecFinalOutputTimeout = 180;
+    ## The timeout to wait for the abort command output to be processed.
+    kcSecAbortCmdOutputTimeout = 30;
+    ## The timeout to wait for the terminate output to be processed.
+    kcSecTerminateOutputTimeout = 30;
+    ## The timeout to wait for the kill output to be processed.
+    kcSecKillOutputTimeout = 30;
+
+    ## The timeout for talking to the test manager.
+    ksecTestManagerTimeout = 60;
+
+
+    def __init__(self, oTestBoxScript, fnThreadProc, cSecTimeout, idResult, sScriptCmdLine):
+        """
+        Class instance init
+        """
+        # Init our instance data.
+        self._idResult          = idResult;
+        self._sScriptCmdLine    = sScriptCmdLine;
+        self._oChild            = None;
+        self._oBackLogLock      = threading.RLock();
+        self._oBackLogFlushLock = threading.RLock();
+        self._asBackLog         = [];
+        self._cchBackLog        = 0;
+        self._secTsBackLogFlush = utils.timestampSecond();
+
+        # Init super.
+        TestBoxBaseTask.__init__(self, oTestBoxScript, cSecTimeout, fnThreadProc);
+
+    def terminate(self, cSecTimeout = kcSecCleanupTimeout):
+        """ Reimplement with higher default timeout. """
+        return TestBoxBaseTask.terminate(self, cSecTimeout);
+
+    def _logFlush(self, oGivenConnection = None):
+        """
+        Flushes the log to the test manager.
+
+        No exceptions.
+        """
+        fRc = True;
+        self._oBackLogFlushLock.acquire();
+
+        # Grab the current back log.
+        self._oBackLogLock.acquire();
+        asBackLog = self._asBackLog;
+        self._asBackLog  = [];
+        self._cchBackLog = 0;
+        self._secTsBackLogFlush = utils.timestampSecond();
+        self._oBackLogLock.release();
+
+        # If there is anything to flush, flush it.
+        if len(asBackLog) > 0:
+            sBody = '';
+            for sLine in asBackLog:
+                sBody += sLine + '\n';
+
+            oConnection = None;
+            try:
+                if oGivenConnection is None:
+                    oConnection = self._oTestBoxScript.openTestManagerConnection();
+                    oConnection.postRequest(constants.tbreq.LOG_MAIN, {constants.tbreq.LOG_PARAM_BODY: sBody});
+                    oConnection.close();
+                else:
+                    oGivenConnection.postRequest(constants.tbreq.LOG_MAIN, {constants.tbreq.LOG_PARAM_BODY: sBody});
+            except Exception, oXcpt:
+                testboxcommons.log('_logFlush error: %s' % (oXcpt,));
+                if len(sBody) < self.kcchMaxBackLog * 4:
+                    self._oBackLogLock.acquire();
+                    asBackLog.extend(self._asBackLog);
+                    self._asBackLog = asBackLog;
+                    # Don't restore _cchBackLog as there is no point in retrying immediately.
+                    self._oBackLogLock.release();
+                if oConnection is not None: # Be kind to apache.
+                    try:    oConnection.close();
+                    except: pass;
+                fRc = False;
+
+        self._oBackLogFlushLock.release();
+        return fRc;
+
+    def flushLogOnConnection(self, oConnection):
+        """
+        Attempts to flush the logon the given connection.
+
+        No exceptions.
+        """
+        return self._logFlush(oConnection);
+
+    def _logInternal(self, sMessage, fPrefix = True, fFlushCheck = False):
+        """
+        Internal logging.
+        Won't flush the backlog, returns a flush indicator so the caller can
+        do it instead.
+        """
+        if fPrefix:
+            try:
+                oNow = datetime.utcnow();
+                sTs = '%02u:%02u:%02u.%06u ' % (oNow.hour, oNow.minute, oNow.second, oNow.microsecond);
+            except Exception, oXcpt:
+                sTs = 'oXcpt=%s ' % (oXcpt);
+            sFullMsg = sTs + sMessage;
+        else:
+            sFullMsg = sMessage;
+
+        self._oBackLogLock.acquire();
+        self._asBackLog.append(sFullMsg);
+        cchBackLog = self._cchBackLog + len(sFullMsg) + 1;
+        self._cchBackLog = cchBackLog;
+        secTsBackLogFlush = self._secTsBackLogFlush;
+        self._oBackLogLock.release();
+
+        testboxcommons.log(sFullMsg);
+        return fFlushCheck \
+            and (   cchBackLog >= self.kcchMaxBackLog \
+                 or utils.timestampSecond() - secTsBackLogFlush >= self.kcSecBackLogFlush);
+
+    def _log(self, sMessage):
+        """
+        General logging function, will flush.
+        """
+        if self._logInternal(sMessage, fFlushCheck = True):
+            self._logFlush();
+        return True;
+
+    def _reportDone(self, sResult):
+        """
+        Report EXEC job done to the test manager.
+
+        sResult is a value from constants.result.
+        """
+        ## @todo optimize this to use one server connection.
+
+        #
+        # Log it.
+        #
+        assert sResult in constants.result.g_kasValidResults;
+        self._log('Done %s' % (sResult,));
+
+        #
+        # Report it.
+        #
+        fRc = True;
+        secStart = utils.timestampSecond();
+        while True:
+            self._logFlush(); ## @todo Combine this with EXEC_COMPLETED.
+            oConnection = None;
+            try:
+                oConnection = self._oTestBoxScript.openTestManagerConnection();
+                oConnection.postRequest(constants.tbreq.EXEC_COMPLETED, {constants.tbreq.EXEC_COMPLETED_PARAM_RESULT: sResult});
+                oConnection.close();
+            except Exception, oXcpt:
+                if utils.timestampSecond() - secStart < self.ksecTestManagerTimeout:
+                    self._log('_reportDone exception (%s) - retrying...' % (oXcpt,));
+                    time.sleep(2);
+                    continue;
+                self._log('_reportDone error: %s' % (oXcpt,));
+                if oConnection is not None: # Be kind to apache.
+                    try:    oConnection.close();
+                    except: pass;
+                fRc = False;
+            break;
+
+        #
+        # Mark the task as completed.
+        #
+        self._complete();
+        return fRc;
+
+    def _assembleArguments(self, sAction, fWithInterpreter = True):
+        """
+        Creates an argument array for subprocess.Popen, splitting the
+        sScriptCmdLine like bourne shell would.
+        fWithInterpreter is used (False) when checking that the script exists.
+
+        Returns None on bad input.
+        """
+
+        #
+        # This is a good place to export the test set id to the environment.
+        #
+        os.environ['TESTBOX_TEST_SET_ID'] = str(self._idResult);
+        cTimeoutLeft = utils.timestampSecond() - self._tsSecStarted;
+        cTimeoutLeft = 0 if cTimeoutLeft >= self._cSecTimeout else self._cSecTimeout - cTimeoutLeft;
+        os.environ['TESTBOX_TIMEOUT']     = str(cTimeoutLeft);
+        os.environ['TESTBOX_TIMEOUT_ABS'] = str(self._tsSecStarted + self._cSecTimeout);
+
+        #
+        # Do replacements and split the command line into arguments.
+        #
+        if self._sScriptCmdLine.find('@ACTION@') >= 0:
+            sCmdLine = self._sScriptCmdLine.replace('@ACTION@', sAction);
+        else:
+            sCmdLine = self._sScriptCmdLine + ' ' + sAction;
+        for sVar in [ 'TESTBOX_PATH_BUILDS', 'TESTBOX_PATH_RESOURCES', 'TESTBOX_PATH_SCRATCH', 'TESTBOX_PATH_SCRIPTS',
+                      'TESTBOX_PATH_UPLOAD', 'TESTBOX_UUID', 'TESTBOX_REPORTER', 'TESTBOX_ID', 'TESTBOX_TEST_SET_ID',
+                      'TESTBOX_TIMEOUT', 'TESTBOX_TIMEOUT_ABS' ]:
+            if sCmdLine.find('${' + sVar + '}') >= 0:
+                sCmdLine = sCmdLine.replace('${' + sVar + '}', os.environ[sVar]);
+
+        asArgs = utils.argsSplit(sCmdLine);
+
+        #
+        # Massage argv[0]:
+        #   - Convert portable slashes ('/') to the flavor preferred by the
+        #     OS we're currently running on.
+        #   - Run python script thru the current python interpreter (important
+        #     on systems that doesn't sport native hash-bang script execution).
+        #
+        asArgs[0] = asArgs[0].replace('/', os.path.sep);
+        if not os.path.isabs(asArgs[0]):
+            asArgs[0] = os.path.join(self._oTestBoxScript.getPathScripts(), asArgs[0]);
+
+        if asArgs[0].endswith('.py') and fWithInterpreter:
+            if sys.executable is not None  and  len(sys.executable) > 0:
+                asArgs.insert(0, sys.executable);
+            else:
+                asArgs.insert(0, 'python');
+
+        return asArgs;
+
+    def _outputThreadProc(self, oChild, oStdOut, sAction):
+        """
+        Thread procedure for the thread that reads the output of the child
+        process.  We use a dedicated thread for this purpose since non-blocking
+        I/O may be hard to keep portable according to hints around the web...
+        """
+        oThread = oChild.oOutputThread;
+        while not oThread.fPleaseQuit:
+            # Get a line.
+            try:
+                sLine = oStdOut.readline();
+            except Exception, oXcpt:
+                self._log('child (%s) pipe I/O error: %s' % (sAction, oXcpt,));
+                break;
+
+            # EOF?
+            if len(sLine) == 0:
+                break;
+
+            # Strip trailing new line (DOS and UNIX).
+            if sLine.endswith("\r\n"):
+                sLine = sLine[0:-2];
+            elif sLine.endswith("\n"):
+                sLine = sLine[0:-1];
+
+            # Log it.
+            if self._logInternal(sLine, fPrefix = False, fFlushCheck = True):
+                self._logFlush();
+
+        # Close the stdout pipe in case we were told to get lost.
+        try:
+            oStdOut.close();
+        except Exception, oXcpt:
+            self._log('warning: Exception closing stdout pipe of "%s" child: %s' % (sAction, oXcpt,));
+
+        # This is a bit hacky, but try reap the child so it won't hang as
+        # defunkt during abort/timeout.
+        if oChild.poll() is None:
+            for _ in range(15):
+                time.sleep(0.2);
+                if oChild.poll() is not None:
+                    break;
+
+        oChild = None;
+        return None;
+
+    def _spawnChild(self, sAction):
+        """
+        Spawns the child process, returning success indicator + child object.
+        """
+
+        # Argument list.
+        asArgs = self._assembleArguments(sAction)
+        if asArgs is None:
+            self._log('Malformed command line: "%s"' % (self._sScriptCmdLine,));
+            return (False, None);
+
+        # Spawn child.
+        try:
+            oChild = subprocess.Popen(asArgs,
+                                      shell      = False,
+                                      bufsize    = -1,
+                                      stdout     = subprocess.PIPE,
+                                      stderr     = subprocess.STDOUT,
+                                      cwd        = self._oTestBoxScript.getPathSpill(),
+                                      universal_newlines = True,
+                                      close_fds  = (False if utils.getHostOs() == 'win' else True),
+                                      preexec_fn = (None if utils.getHostOs() in ['win', 'os2']
+                                                    else os.setsid)); # pylint: disable=E1101
+        except Exception, oXcpt:
+            self._log('Error creating child process %s: %s' % (asArgs, oXcpt));
+            return (False, None);
+
+        oChild.sTestBoxScriptAction = sAction;
+
+        # Start output thread, extending the child object to keep track of it.
+        oChild.oOutputThread = threading.Thread(target=self._outputThreadProc, args=(oChild, oChild.stdout, sAction))
+        oChild.oOutputThread.daemon = True;
+        oChild.oOutputThread.fPleaseQuit = False; # Our extension.
+        oChild.oOutputThread.start();
+
+        return (True, oChild);
+
+    def _monitorChild(self, cSecTimeout, fTryKillCommand = True, oChild = None):
+        """
+        Monitors the child process.  If the child executes longer that
+        cSecTimeout allows, we'll terminate it.
+        Returns Success indicator and constants.result value.
+        """
+
+        if oChild is None:
+            oChild = self._oChild;
+
+        iProcGroup = oChild.pid;
+        if utils.getHostOs() in ['win', 'os2'] or iProcGroup <= 0:
+            iProcGroup = -2;
+
+        #
+        # Do timeout processing and check the health of the child.
+        #
+        sResult   = constants.result.PASSED;
+        seStarted = utils.timestampSecond();
+        while True:
+            # Check status.
+            iRc = oChild.poll();
+            if iRc is not None:
+                self._log('Child doing "%s" completed with exit code %d' % (oChild.sTestBoxScriptAction, iRc));
+                oChild.oOutputThread.join(self.kcSecFinalOutputTimeout);
+
+                if oChild is self._oChild:
+                    self._oChild = None;
+
+                if iRc == constants.rtexitcode.SKIPPED:
+                    return (True, constants.result.SKIPPED);
+                if iRc != constants.rtexitcode.SUCCESS:
+                    return (False, constants.result.FAILED);
+                return (True, constants.result.PASSED);
+
+            # Check for abort first, since that has less of a stigma.
+            if self._shouldTerminate() is True:
+                sResult = constants.result.ABORTED;
+                break;
+
+            # Check timeout.
+            cSecElapsed = utils.timestampSecond() - seStarted;
+            if cSecElapsed > cSecTimeout:
+                self._log('Timeout: %u secs (limit %u secs)' % (cSecElapsed, cSecTimeout));
+                sResult = constants.result.TIMED_OUT;
+                break;
+
+            # Wait.
+            cSecLeft = cSecTimeout - cSecElapsed;
+            oChild.oOutputThread.join(15 if cSecLeft > 15 else (cSecLeft + 1));
+
+        #
+        # If the child is still alive, try use the abort command to stop it
+        # very gently.  This let's the testdriver clean up daemon processes
+        # and such that our code below won't catch.
+        #
+        if fTryKillCommand and oChild.poll() is None:
+            self._log('Attempting to abort child...');
+            (fRc2, oAbortChild) = self._spawnChild('abort');
+            if oAbortChild is not None and fRc2 is True:
+                self._monitorChild(self.kcSecAbortTimeout, False, oAbortChild);
+                oAbortChild = None;
+
+        #
+        # If the child is still alive, try the polite way.
+        #
+        if oChild.poll() is None:
+            self._log('Attempting to terminate child doing "%s"...' % (oChild.sTestBoxScriptAction,));
+
+            if iProcGroup > 0:
+                try:
+                    os.killpg(iProcGroup, signal.SIGTERM); # pylint: disable=E1101
+                except Exception, oXcpt:
+                    self._log('killpg() failed: %s' % (oXcpt,));
+
+            try:
+                self._oChild.terminate();
+                oChild.oOutputThread.join(self.kcSecTerminateOutputTimeout);
+            except Exception, oXcpt:
+                self._log('terminate() failed: %s' % (oXcpt,));
+
+        #
+        # If the child doesn't respond to polite, kill it.  Always do a killpg
+        # should there be any processes left in the group.
+        #
+        if iProcGroup > 0:
+            try:
+                os.killpg(iProcGroup, signal.SIGKILL); # pylint: disable=E1101
+            except Exception, oXcpt:
+                self._log('killpg() failed: %s' % (oXcpt,));
+
+        if oChild.poll() is None:
+            self._log('Attemting to kill child doing "%s"...' % (oChild.sTestBoxScriptAction,));
+            try:
+                self._oChild.kill();
+                oChild.oOutputThread.join(self.kcSecKillOutputTimeout);
+            except Exception, oXcpt:
+                self._log('kill() failed: %s' % (oXcpt,));
+
+        #
+        # Give the whole mess a couple of more seconds to respond in case the
+        # output thread exitted prematurely for some weird reason.
+        #
+        if oChild.poll() is None:
+            time.sleep(2);
+            time.sleep(2);
+            time.sleep(2);
+
+        iRc = oChild.poll();
+        if iRc is not None:
+            self._log('Child doing "%s" aborted with exit code %d' % (oChild.sTestBoxScriptAction, iRc));
+        else:
+            self._log('Child doing "%s" is still running, giving up...' % (oChild.sTestBoxScriptAction,));
+            ## @todo in this case we should probably try reboot the testbox...
+            oChild.oOutputThread.fPleaseQuit = True;
+
+        if oChild is self._oChild:
+            self._oChild = None;
+        return (False, sResult);
+
+    def _terminateChild(self):
+        """
+        Terminates the child forcefully.
+        """
+        if self._oChild is not None:
+            pass;
+
+    def _cleanupAfter(self):
+        """
+        Cleans up after a test failure. (On success, cleanup is implicit.)
+        """
+        assert self._oChild is None;
+
+        #
+        # Tell the script to clean up.
+        #
+        if len(self._sScriptCmdLine) > 0: # can be empty if cleanup crashed.
+            (fRc, self._oChild) = self._spawnChild('cleanup-after');
+            if fRc is True:
+                (fRc, _) = self._monitorChild(self.kcSecCleanupTimeout, False);
+                self._terminateChild();
+        else:
+            fRc = False;
+
+        #
+        # Wipe the stuff clean.
+        #
+        fRc2 = self._oTestBoxScript.reinitScratch(fnLog = self._log);
+
+        return fRc and fRc2;
+
+
+
+class TestBoxCleanupTask(TestBoxTestDriverTask):
+    """
+    Special asynchronous task for cleaning up a stale test when starting the
+    testbox script.  It's assumed that the reason for the stale test lies in
+    it causing a panic, reboot, or similar, so we'll also try collect some
+    info about recent system crashes and reboots.
+    """
+
+    def __init__(self, oTestBoxScript):
+        # Read the old state, throwing a fit if it's invalid.
+        sScriptState   = oTestBoxScript.getPathState();
+        sScriptCmdLine = self._readStateFile(os.path.join(sScriptState, 'script-cmdline.txt'));
+        sResultId      = self._readStateFile(os.path.join(sScriptState, 'result-id.txt'));
+        try:
+            idResult = int(sResultId);
+            if idResult <= 0 or idResult >= 0x7fffffff:
+                raise Exception('');
+        except:
+            raise Exception('Invalid id value "%s" found in %s' % (sResultId, os.path.join(sScriptState, 'result-id.txt')));
+
+        sTestBoxId   = self._readStateFile(os.path.join(sScriptState, 'testbox-id.txt'));
+        try:
+            self.idTestBox = int(sTestBoxId);
+            if self.idTestBox <= 0 or self.idTestBox >= 0x7fffffff:
+                raise Exception('');
+        except:
+            raise Exception('Invalid id value "%s" found in %s' % (sTestBoxId, os.path.join(sScriptState, 'testbox-id.txt')));
+        self.sTestBoxName = self._readStateFile(os.path.join(sScriptState, 'testbox-name.txt'));
+
+        # Init super.
+        TestBoxTestDriverTask.__init__(self, oTestBoxScript, self._threadProc, self.kcSecCleanupTimeout,
+                                       idResult, sScriptCmdLine);
+
+    @staticmethod
+    def _readStateFile(sPath):
+        """
+        Reads a state file, returning a string on success and otherwise raising
+        an exception.
+        """
+        try:
+            oFile = open(sPath, "rb");
+            sStr = oFile.read();
+            oFile.close();
+            return sStr.strip();
+        except Exception, oXcpt:
+            raise Exception('Failed to read "%s": %s' % (sPath, oXcpt));
+
+    def _threadProc(self):
+        """
+        Perform the actual clean up on script startup.
+        """
+
+        #
+        # First make sure we won't repeat this exercise should it turn out to
+        # trigger another reboot/panic/whatever.
+        #
+        sScriptCmdLine = os.path.join(self._oTestBoxScript.getPathState(), 'script-cmdline.txt');
+        try:
+            os.remove(sScriptCmdLine);
+            oFile = open(sScriptCmdLine, 'wb');
+            oFile.close();
+        except Exception, oXcpt:
+            self._log('Error truncating "%s": %s' % (sScriptCmdLine, oXcpt));
+
+        #
+        # Report the incident.
+        #
+        self._log('Seems we rebooted!');
+        self._log('script-cmdline="%s"' % (self._sScriptCmdLine));
+        self._log('result-id=%d' % (self._idResult));
+        self._log('testbox-id=%d' % (self.idTestBox));
+        self._log('testbox-name=%s' % (self.sTestBoxName));
+        self._logFlush();
+
+        # System specific info.
+        sOs = utils.getHostOs();
+        if sOs == 'darwin':
+            self._log('NVRAM Panic Info:\n%s\n' % (self.darwinGetPanicInfo(),));
+
+        self._logFlush();
+        ## @todo Add some special command for reporting this situation so we get something
+        #        useful in the event log.
+
+        #
+        # Do the cleaning up.
+        #
+        self._cleanupAfter();
+
+        self._reportDone(constants.result.REBOOTED);
+        return False;
+
+    def darwinGetPanicInfo(self):
+        """
+        Returns a string with the aapl,panic-info content.
+        """
+        # Retriev the info.
+        try:
+            sRawInfo = utils.processOutputChecked(['nvram', 'aapl,panic-info']);
+        except Exception, oXcpt:
+            return 'exception running nvram: %s' % (oXcpt,);
+
+        # Decode (%xx) and decompact it (7-bit -> 8-bit).
+        ahDigits = \
+        {
+            '0': 0,  '1': 1,  '2': 2,  '3': 3,  '4': 4,  '5': 5,  '6': 6,  '7': 7,
+            '8': 8,  '9': 9,  'a': 10, 'b': 11, 'c': 12, 'd': 13, 'e': 14, 'f': 15,
+        };
+        sInfo = '';
+        off   = len('aapl,panic-info') + 1;
+        iBit  = 0;
+        bLow  = 0;
+
+        while off < len(sRawInfo):
+            # isprint is used to determine whether to %xx or %c it, so we have to
+            # be a little careful before assuming % sequences are hex bytes.
+            if    sRawInfo[off] == '%' \
+              and off + 3 <= len(sRawInfo) \
+              and sRawInfo[off + 1] in ahDigits \
+              and sRawInfo[off + 2] in ahDigits:
+                bCur = ahDigits[sRawInfo[off + 1]] * 0x10 + ahDigits[sRawInfo[off + 2]];
+                off += 3;
+            else:
+                bCur = ord(sRawInfo[off]);
+                off += 1;
+
+            sInfo += chr(((bCur & (0x7f >> iBit)) << iBit) | bLow);
+            bLow = bCur >> (7 - iBit);
+
+            if iBit < 6:
+                iBit += 1;
+            else:
+                # Final bit in sequence.
+                sInfo += chr(bLow);
+                bLow = 0;
+                iBit = 0;
+
+        # Expand shorthand.
+        sInfo = sInfo.replace('@', 'com.apple.');
+        sInfo = sInfo.replace('>', 'com.apple.driver.');
+        sInfo = sInfo.replace('|', 'com.apple.iokit.');
+        sInfo = sInfo.replace('$', 'com.apple.security.');
+        sInfo = sInfo.replace('!A', 'Apple');
+        sInfo = sInfo.replace('!a', 'Action');
+        sInfo = sInfo.replace('!B', 'Bluetooth');
+        sInfo = sInfo.replace('!C', 'Controller');
+        sInfo = sInfo.replace('!F', 'Family');
+        sInfo = sInfo.replace('!I', 'Intel');
+        sInfo = sInfo.replace('!U', 'AppleUSB');
+        sInfo = sInfo.replace('!P', 'Profile');
+
+        # Done.
+        return sInfo
+
+
+class TestBoxExecTask(TestBoxTestDriverTask):
+    """
+    Implementation of a asynchronous EXEC task.
+
+    This uses a thread for doing the actual work, i.e. starting and monitoring
+    the child process, processing its output, and more.
+    """
+
+    def __init__(self, oTestBoxScript, idResult, sScriptZips, sScriptCmdLine, cSecTimeout):
+        """
+        Class instance init
+        """
+        # Init our instance data.
+        self._sScriptZips = sScriptZips;
+
+        # Init super.
+        TestBoxTestDriverTask.__init__(self, oTestBoxScript, self._threadProc, cSecTimeout, idResult, sScriptCmdLine);
+
+    @staticmethod
+    def _writeStateFile(sPath, sContent):
+        """
+        Writes a state file, raising an exception on failure.
+        """
+        try:
+            oFile = open(sPath, "wb");
+            oFile.write(sContent);
+            oFile.flush();
+            try:     os.fsync(oFile.fileno());
+            except:  pass;
+            oFile.close();
+        except Exception, oXcpt:
+            raise Exception('Failed to write "%s": %s' % (sPath, oXcpt));
+        return True;
+
+    def _saveState(self):
+        """
+        Saves the task state on disk so we can launch a TestBoxCleanupTask job
+        if the test should cause system panic or similar.
+
+        Note! May later be extended to support tests that reboots the host.
+        """
+        sScriptState = self._oTestBoxScript.getPathState();
+        try:
+            self._writeStateFile(os.path.join(sScriptState, 'script-cmdline.txt'), self._sScriptCmdLine);
+            self._writeStateFile(os.path.join(sScriptState, 'result-id.txt'),      str(self._idResult));
+            self._writeStateFile(os.path.join(sScriptState, 'testbox-id.txt'),     str(self._oTestBoxScript.getTestBoxId()));
+            self._writeStateFile(os.path.join(sScriptState, 'testbox-name.txt'),   self._oTestBoxScript.getTestBoxName());
+        except Exception, oXcpt:
+            self._log('Failed to write state: %s' % (oXcpt,));
+            return False;
+        return True;
+
+    def _downloadAndUnpackScriptZips(self):
+        """
+        Downloads/copies the script ZIPs into TESTBOX_SCRIPT and unzips them to
+        the same directory.
+
+        Raises no exceptions, returns log + success indicator instead.
+        """
+        sPathScript = self._oTestBoxScript.getPathScripts();
+        asArchives = self._sScriptZips.split(',');
+        for sArchive in asArchives:
+            sArchive = sArchive.strip();
+            if len(sArchive) == 0:
+                continue;
+
+            # Figure the destination name (in scripts).
+            sDstFile = webutils.getFilename(sArchive);
+            if   len(sDstFile) < 1 \
+              or re.search('[^a-zA-Z0-9 !#$%&\'()@^_`{}~.-]', sDstFile) is not None: # FAT charset sans 128-255 + '.'.
+                self._log('Malformed script zip filename: %s' % (sArchive,));
+                return False;
+            sDstFile = os.path.join(sPathScript, sDstFile);
+
+            # Do the work.
+            if webutils.downloadFile(sArchive, sDstFile, self._oTestBoxScript.getPathBuilds(), self._log, self._log) is not True:
+                return False;
+            asFiles = utils.unpackFile(sDstFile, sPathScript, self._log, self._log);
+            if asFiles is None:
+                return False;
+
+            # Since zip files doesn't always include mode masks, set the X bit
+            # of all of them so we can execute binaries and hash-bang scripts.
+            for sFile in asFiles:
+                utils.chmodPlusX(sFile);
+
+        return True;
+
+    def _threadProc(self):
+        """
+        Do the work of an EXEC command.
+        """
+
+        sResult = constants.result.PASSED;
+
+        #
+        # Start by preparing the scratch directories.
+        #
+        # Note! Failures at this stage are not treated as real errors since
+        #       they may be caused by the previous test and other circumstances
+        #       so we don't want to go fail a build because of this.
+        #
+        fRc = self._oTestBoxScript.reinitScratch(self._logInternal);
+        fNeedCleanUp = fRc;
+        if fRc is True:
+            fRc = self._downloadAndUnpackScriptZips();
+            testboxcommons.log2('_threadProc: _downloadAndUnpackScriptZips -> %s' % (fRc,));
+        if fRc is not True:
+            sResult = constants.result.BAD_TESTBOX;
+
+        #
+        # Make sure the script exists.
+        #
+        if fRc is True:
+            sScript = self._assembleArguments('none', fWithInterpreter = False)[0];
+            if not os.path.exists(sScript):
+                self._log('The test driver script "%s" cannot be found.' % (sScript,));
+                sDir = sScript;
+                while len(sDir) > 3:
+                    sDir = os.path.dirname(sDir);
+                    if os.path.exists(sDir):
+                        self._log('First existing parent directory is "%s".' % (sDir,));
+                        break;
+                fRc = False;
+
+        if fRc is True:
+            #
+            # Start testdriver script.
+            #
+            fRc = self._saveState();
+            if fRc:
+                (fRc, self._oChild) = self._spawnChild('all');
+                testboxcommons.log2('_threadProc: _spawnChild -> %s, %s' % (fRc, self._oChild));
+            if fRc:
+                (fRc, sResult) = self._monitorChild(self._cSecTimeout);
+                testboxcommons.log2('_threadProc: _monitorChild -> %s' % (fRc,));
+
+                # If the run failed, do explicit cleanup.
+                if fRc is not True:
+                    testboxcommons.log2('_threadProc: explicit cleanups...');
+                    self._terminateChild();
+                    self._cleanupAfter();
+                    fNeedCleanUp = False;
+            assert self._oChild is None;
+
+        #
+        # Clean up scratch.
+        #
+        if fNeedCleanUp:
+            if self._oTestBoxScript.reinitScratch(self._logInternal) is not True:
+                self._log('post run reinitScratch failed.');
+                fRc = False;
+
+        #
+        # Report status and everything back to the test manager.
+        #
+        if fRc is False and sResult == constants.result.PASSED:
+            sResult = constants.result.FAILED;
+        self._reportDone(sResult);
+        return fRc;
+
diff --git a/src/VBox/ValidationKit/testboxscript/testboxupgrade.py b/src/VBox/ValidationKit/testboxscript/testboxupgrade.py
new file mode 100644
index 0000000..5a8235e
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/testboxupgrade.py
@@ -0,0 +1,318 @@
+# -*- coding: utf-8 -*-
+# $Id: testboxupgrade.py $
+
+"""
+TestBox Script - Upgrade from local file ZIP.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports.
+import os
+import shutil
+import sys
+import subprocess
+import threading
+import uuid;
+import zipfile
+
+# Validation Kit imports.
+import testboxcommons
+from testboxscript import TBS_EXITCODE_SYNTAX;
+from common import utils;
+
+# Figure where we are.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksTestScriptDir = os.path.dirname(os.path.abspath(__file__));
+g_ksValidationKitDir  = os.path.dirname(g_ksTestScriptDir);
+
+
+def _doUpgradeThreadProc(oStdOut, asBuf):
+    """Thread procedure for the upgrade test drive."""
+    asBuf.append(oStdOut.read());
+    return True;
+
+
+def _doUpgradeCheckZip(oZip):
+    """
+    Check that the essential files are there.
+    Returns list of members on success, None on failure.
+    """
+    asMembers = oZip.namelist();
+    if   ('testboxscript/testboxscript/testboxscript.py'      not in asMembers) \
+      or ('testboxscript/testboxscript/testboxscript_real.py' not in asMembers):
+        testboxcommons.log('Missing one or both testboxscripts (members: %s)' % (asMembers,));
+        return None;
+
+    for sMember in asMembers:
+        if not sMember.startswith('testboxscript/'):
+            testboxcommons.log('zip file contains member outside testboxscript/: "%s"' % (sMember,));
+            return None;
+        if sMember.find('/../') > 0 or sMember.endswith('/..'):
+            testboxcommons.log('zip file contains member with escape sequence: "%s"' % (sMember,));
+            return None;
+
+    return asMembers;
+
+def _doUpgradeUnzipAndCheck(oZip, sUpgradeDir, asMembers):
+    """
+    Unzips the files into sUpdateDir, does chmod(755) on all files and
+    checks that there are no symlinks or special files.
+    Returns True/False.
+    """
+    #
+    # Extract the files.
+    #
+    if os.path.exists(sUpgradeDir):
+        shutil.rmtree(sUpgradeDir);
+    for sMember in asMembers:
+        if sMember.endswith('/'):
+            os.makedirs(os.path.join(sUpgradeDir, sMember.replace('/', os.path.sep)), 0775);
+        else:
+            oZip.extract(sMember, sUpgradeDir);
+
+    #
+    # Make all files executable and make sure only owner can write to them.
+    # While at it, also check that there are only files and directory, no
+    # symbolic links or special stuff.
+    #
+    for sMember in asMembers:
+        sFull = os.path.join(sUpgradeDir, sMember);
+        if sMember.endswith('/'):
+            if not os.path.isdir(sFull):
+                testboxcommons.log('Not directory: "%s"' % sFull);
+                return False;
+        else:
+            if not os.path.isfile(sFull):
+                testboxcommons.log('Not regular file: "%s"' % sFull);
+                return False;
+            try:
+                os.chmod(sFull, 0755);
+            except Exception, oXcpt:
+                testboxcommons.log('warning chmod error on %s: %s' % (sFull, oXcpt));
+    return True;
+
+def _doUpgradeTestRun(sUpgradeDir):
+    """
+    Do a testrun of the new script, to make sure it doesn't fail with
+    to run in any way because of old python, missing import or generally
+    busted upgrade.
+    Returns True/False.
+    """
+    asArgs = [os.path.join(sUpgradeDir, 'testboxscript', 'testboxscript', 'testboxscript.py'), '--version' ];
+    testboxcommons.log('Testing the new testbox script (%s)...' % (asArgs[0],));
+    if sys.executable is not None and len(sys.executable) > 0:
+        asArgs.insert(0, sys.executable);
+    oChild = subprocess.Popen(asArgs, shell = False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT);
+
+    asBuf = []
+    oThread = threading.Thread(target=_doUpgradeThreadProc, args=(oChild.stdout, asBuf));
+    oThread.daemon = True;
+    oThread.start();
+    oThread.join(30);
+
+    iStatus = oChild.poll();
+    if iStatus is None:
+        testboxcommons.log('Checking the new testboxscript timed out.');
+        oChild.terminate();
+        oThread.join(5);
+        return False;
+    if iStatus is not TBS_EXITCODE_SYNTAX:
+        testboxcommons.log('The new testboxscript returned %d instead of %d during check.' \
+                           % (iStatus, TBS_EXITCODE_SYNTAX));
+        return False;
+
+    sOutput = ''.join(asBuf);
+    sOutput = sOutput.strip();
+    try:
+        iNewVersion = int(sOutput);
+    except:
+        testboxcommons.log('The new testboxscript returned an unparseable version string: "%s"!' % (sOutput,));
+        return False;
+    testboxcommons.log('New script version: %s' % (iNewVersion,));
+    return True;
+
+def _doUpgradeApply(sUpgradeDir, asMembers):
+    """
+    # Apply the directories and files from the upgrade.
+    returns True/False/Exception.
+    """
+
+    #
+    # Create directories first since that's least intrusive.
+    #
+    for sMember in asMembers:
+        if sMember[-1] == '/':
+            sMember = sMember[len('testboxscript/'):];
+            if sMember != '':
+                sFull = os.path.join(g_ksValidationKitDir, sMember);
+                if not os.path.isdir(sFull):
+                    os.makedirs(sFull, 0755);
+
+    #
+    # Move the files into place.
+    #
+    fRc = True;
+    asOldFiles = [];
+    for sMember in asMembers:
+        if sMember[-1] != '/':
+            sSrc = os.path.join(sUpgradeDir, sMember);
+            sDst = os.path.join(g_ksValidationKitDir, sMember[len('testboxscript/'):]);
+
+            # Move the old file out of the way first.
+            sDstRm = None;
+            if os.path.exists(sDst):
+                testboxcommons.log2('Info: Installing "%s"' % (sDst,));
+                sDstRm = '%s-delete-me-%s' % (sDst, uuid.uuid4(),);
+                try:
+                    os.rename(sDst, sDstRm);
+                except Exception, oXcpt:
+                    testboxcommons.log('Error: failed to rename (old) "%s" to "%s": %s' % (sDst, sDstRm, oXcpt));
+                    try:
+                        shutil.copy(sDst, sDstRm);
+                    except Exception, oXcpt:
+                        testboxcommons.log('Error: failed to copy (old) "%s" to "%s": %s' % (sDst, sDstRm, oXcpt));
+                        break;
+                    try:
+                        os.unlink(sDst);
+                    except Exception, oXcpt:
+                        testboxcommons.log('Error: failed to unlink (old) "%s": %s' % (sDst, oXcpt));
+                        break;
+
+            # Move/copy the new one into place.
+            testboxcommons.log2('Info: Installing "%s"' % (sDst,));
+            try:
+                os.rename(sSrc, sDst);
+            except Exception, oXcpt:
+                testboxcommons.log('Warning: failed to rename (new) "%s" to "%s": %s' % (sSrc, sDst, oXcpt));
+                try:
+                    shutil.copy(sSrc, sDst);
+                except:
+                    testboxcommons.log('Error: failed to copy (new) "%s" to "%s": %s' % (sSrc, sDst, oXcpt));
+                    fRc = False;
+                    break;
+
+    #
+    # Roll back on failure.
+    #
+    if fRc is not True:
+        testboxcommons.log('Attempting to roll back old files...');
+        for sDstRm in asOldFiles:
+            sDst = sDstRm[:sDstRm.rfind('-delete-me')];
+            testboxcommons.log2('Info: Rolling back "%s" (%s)' % (sDst, os.path.basename(sDstRm)));
+            try:
+                shutil.move(sDstRm, sDst);
+            except:
+                testboxcommons.log('Error: failed to rollback "%s" onto "%s": %s' % (sDstRm, sDst, oXcpt));
+        return False;
+    return True;
+
+def _doUpgradeRemoveOldStuff(sUpgradeDir, asMembers):
+    """
+    Clean up all obsolete files and directories.
+    Returns True (shouldn't fail or raise any exceptions).
+    """
+
+    try:
+        shutil.rmtree(sUpgradeDir, ignore_errors = True);
+    except:
+        pass;
+
+    asKnownFiles = [];
+    asKnownDirs  = [];
+    for sMember in asMembers:
+        sMember = sMember[len('testboxscript/'):];
+        if sMember == '':
+            continue;
+        if sMember[-1] == '/':
+            asKnownDirs.append(os.path.normpath(os.path.join(g_ksValidationKitDir, sMember[:-1])));
+        else:
+            asKnownFiles.append(os.path.normpath(os.path.join(g_ksValidationKitDir, sMember)));
+
+    for sDirPath, asDirs, asFiles in os.walk(g_ksValidationKitDir, topdown=False):
+        for sDir in asDirs:
+            sFull = os.path.normpath(os.path.join(sDirPath, sDir));
+            if sFull not in asKnownDirs:
+                testboxcommons.log2('Info: Removing obsolete directory "%s"' % (sFull,));
+                try:
+                    os.rmdir(sFull);
+                except Exception, oXcpt:
+                    testboxcommons.log('Warning: failed to rmdir obsolete dir "%s": %s' % (sFull, oXcpt));
+
+        for sFile in asFiles:
+            sFull = os.path.normpath(os.path.join(sDirPath, sFile));
+            if sFull not in asKnownFiles:
+                testboxcommons.log2('Info: Removing obsolete file "%s"' % (sFull,));
+                try:
+                    os.unlink(sFull);
+                except Exception, oXcpt:
+                    testboxcommons.log('Warning: failed to unlink obsolete file "%s": %s' % (sFull, oXcpt));
+    return True;
+
+def upgradeFromZip(sZipFile):
+    """
+    Upgrade the testboxscript install using the specified zip file.
+    Returns True/False.
+    """
+
+    # A little precaution.
+    if utils.isRunningFromCheckout():
+        testboxcommons.log('Use "svn up" to "upgrade" your source tree!');
+        return False;
+
+    #
+    # Prepare.
+    #
+    # Note! Don't bother cleaning up files and dirs in the error paths,
+    #       they'll be restricted to the one zip and the one upgrade dir.
+    #       We'll remove them next time we upgrade.
+    #
+    oZip = zipfile.ZipFile(sZipFile, 'r');
+    asMembers = _doUpgradeCheckZip(oZip);
+    if asMembers is None:
+        return False;
+
+    sUpgradeDir = os.path.join(g_ksTestScriptDir, 'upgrade');
+    testboxcommons.log('Unzipping "%s" to "%s"...' % (sZipFile, sUpgradeDir));
+    if _doUpgradeUnzipAndCheck(oZip, sUpgradeDir, asMembers) is not True:
+        return False;
+    oZip.close();
+
+    if _doUpgradeTestRun(sUpgradeDir) is not True:
+        return False;
+
+    #
+    # Execute.
+    #
+    if _doUpgradeApply(sUpgradeDir, asMembers) is not True:
+        return False;
+    _doUpgradeRemoveOldStuff(sUpgradeDir, asMembers);
+    return True;
+
+
+# For testing purposes.
+if __name__ == '__main__':
+    sys.exit(upgradeFromZip(sys.argv[1]));
+
diff --git a/src/VBox/ValidationKit/testboxscript/win/autoexec-testbox.cmd b/src/VBox/ValidationKit/testboxscript/win/autoexec-testbox.cmd
new file mode 100644
index 0000000..4313c3c
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/win/autoexec-testbox.cmd
@@ -0,0 +1,5 @@
+ at echo "$Id: autoexec-testbox.cmd $"
+ at echo on
+%SystemDrive%\Python27\python.exe %SystemDrive%\testboxscript\testboxscript\testboxscript.py --testrsrc-server-type=cifs --builds-server-type=cifs
+pause
+
diff --git a/src/VBox/ValidationKit/testboxscript/win/readme.txt b/src/VBox/ValidationKit/testboxscript/win/readme.txt
new file mode 100644
index 0000000..4733788
--- /dev/null
+++ b/src/VBox/ValidationKit/testboxscript/win/readme.txt
@@ -0,0 +1,107 @@
+$Id: readme.txt $
+
+
+Preparations:
+
+1. Install Python 2.7.x from python.org to C:\Python27.  Matching bit count as
+   the host windows version.
+
+2. Install the win32 extension for python.
+
+3. Append C:\Python27 to the system PATH.
+
+4. Disable UAC.
+
+   Windows 8 / 8.1 / Server 2012: Set the following key to zero:
+   "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\EnableLUA"
+
+5. Disable Automatic updates. (No rebooting during tests, thank you!)
+
+6. Go to the group policy editor (gpedit.msc) and change "Computer Configuration"
+   -> "Windows Settings" -> "Security Settings" -> "Local Policies"
+   -> "Security Options" -> "Network security: LAN Manager authentication level"
+   to "Send LM & NTLM- use NTLMv2 session security if negotiated".  This fixed
+   passing the password as an argument to "NET USE" (don't ask why!).
+
+6b. While in the group policy editor, make sure that  "Computer Configuration"
+   -> "Windows Settings" -> "Security Settings" -> "Local Policies"
+   -> "Account Policy" -> "Password must meet complexity requirements" is
+   disabled so the vbox account can be created later one.
+
+7. Need to disable the error popups blocking testing.
+
+   Set "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows\ErrorMode"
+   to 2.  This immediately disables hard error popups (missing DLLs and such).
+
+   Then there are the sending info to microsoft, debug, dump, look for solution
+   questions we don't want.  Not entirely sure what's required here yet, but
+   the following stuff might hopefully help (update after testing):
+
+   On Windows XP:
+
+   Go "Control Panel" -> "System Properties" -> "Advanced"
+   -> "Error Reporting" and check "Disable error reporting"
+   and uncheck "But notify me when critical erorr occurs".
+
+   On Windows Vista and later:
+
+   In gpedit change the following settings under "Computer Configuration"
+   -> "Administrative Templates" ->  "Windows Components"
+   -> "Windows Error Reporting":
+        1) Enable "Prevent display of the user interface for critical errors".
+   ... -> "Advanced Error Reporting Settings":
+        1) Enable "Configure Report Archive" and set it to "Store All" for
+           up to 500 (or less) reports.
+        2) Disable "Configure Report Queue".
+
+   Run 'serverWerOptin /disable'.
+
+   Then set "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\DontShowUI"
+   to 1. (Could do all the above from regedit if we wanted...)
+
+7b. Configure application crash dumps on Vista SP1 and later:
+
+   Set the following values under the key
+   HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps:
+        DumpFolder     [string] = C:\CrashDumps
+        DumpCount       [dword] = 10
+        DumpType        [dword] = 1  (minidump)
+        CustomDumpFlags [dword] = 0
+
+   See also http://msdn.microsoft.com/en-us/library/windows/desktop/bb787181%28v=vs.85%29.aspx
+
+8. Install firefox or chrome, download the latest testboxscript*.zip from
+   the build box.
+
+9. Create a user named "vbox" with password "password".  Must be an
+   Administrator user!
+
+10. Configure user "vbox" to log in automatically via "control userpasswords2".
+
+11. Open up the port ranges 6000-6100 (VRDP) for TCP traffic and 5000-5032
+    (NetPerf) for both TCP and UDP traffic in the Windows Firewall.
+    From the command line (recommended in vista):
+        for /L %i in (6000,1,6100) do netsh firewall add portopening TCP %i "VRDP %i"
+        for /L %i in (5000,1,5032) do netsh firewall add portopening TCP %i "NetPerf %i TCP"
+        for /L %i in (5000,1,5032) do netsh firewall add portopening UDP %i "NetPerf %i UDP"
+
+20. Setup time server to "wei01-time.de.oracle.com" and update date/time.
+
+21. Activate windows. "https://linserv.de.oracle.com/vbox/wiki/MSDN Volume License Keys"
+
+22. Disable loading CONIME. Set "HKEY_CURRENT_USER\Console\LoadConIme" to 0.
+
+23. Windows 2012 R2: If you experience mouse pointer problems connecting with rdesktop,
+    open the mouse pointer settings and disable mouse pointer shadow.
+
+The install:
+
+23. Unzip (/ copy) the content of the testboxscript-*.zip to C:\testboxscript.
+
+24. Copy C:\testboxscript\testboxscript\win\autoexec-testbox.cmd to C:\.
+
+25. Create a shortcut to C:\autoexec-testbox.cmd and drag it into
+    "Start" -> "All Programs" -> "Startup".
+
+That's currently it.
+
diff --git a/src/VBox/ValidationKit/testdriver/Makefile.kmk b/src/VBox/ValidationKit/testdriver/Makefile.kmk
new file mode 100644
index 0000000..1ab8c6c
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/Makefile.kmk
@@ -0,0 +1,38 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Python Test Driver.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(filter-out %/winbase.py %/vboxcon.py, $(wildcard $(PATH_SUB_CURRENT)/*.py))
+ifeq ($(KBUILD_HOST),win)
+ VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(PATH_SUB_CURRENT)/winbase.py
+endif
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testdriver/__init__.py b/src/VBox/ValidationKit/testdriver/__init__.py
new file mode 100644
index 0000000..c5419b3
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/__init__.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# $Id: __init__.py $
+
+"""
+Test driver package
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+
+__version__ = "$Revision: 96152 $";
+
diff --git a/src/VBox/ValidationKit/testdriver/base.py b/src/VBox/ValidationKit/testdriver/base.py
new file mode 100644
index 0000000..9eff618
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/base.py
@@ -0,0 +1,1722 @@
+# -*- coding: utf-8 -*-
+# $Id: base.py $
+# pylint: disable=C0302
+
+"""
+Base testdriver module.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os
+import os.path
+import signal
+import socket
+import stat
+import subprocess
+import sys
+import time
+import thread
+import threading
+import traceback
+import tempfile;
+import unittest;
+
+# Validation Kit imports.
+from common                 import utils;
+from common.constants       import rtexitcode;
+from testdriver             import reporter;
+if sys.platform == 'win32':
+    from testdriver         import winbase;
+
+# Figure where we are.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)));
+
+
+#
+# Some utility functions.
+#
+
+def exeSuff():
+    """
+    Returns the executable suffix.
+    """
+    if os.name == 'nt' or os.name == 'os2':
+        return '.exe';
+    return '';
+
+def searchPath(sExecName):
+    """
+    Searches the PATH for the specified executable name, returning the first
+    existing file/directory/whatever.  The return is abspath'ed.
+    """
+    sSuff = exeSuff();
+
+    sPath = os.getenv('PATH', os.getenv('Path', os.path.defpath));
+    aPaths = sPath.split(os.path.pathsep)
+    for sDir in aPaths:
+        sFullExecName = os.path.join(sDir, sExecName);
+        if os.path.exists(sFullExecName):
+            return os.path.abspath(sFullExecName);
+        sFullExecName += sSuff;
+        if os.path.exists(sFullExecName):
+            return os.path.abspath(sFullExecName);
+    return sExecName;
+
+def getEnv(sVar, sLocalAlternative = None):
+    """
+    Tries to get an environment variable, optionally with a local run alternative.
+    Will raise an exception if sLocalAlternative is None and the variable is
+    empty or missing.
+    """
+    try:
+        sVal = os.environ.get(sVar, None);
+        if sVal is None:
+            raise GenError('environment variable "%s" is missing' % (sVar));
+        if sVal == "":
+            raise GenError('environment variable "%s" is empty' % (sVar));
+    except:
+        if sLocalAlternative is None  or  not reporter.isLocal():
+            raise
+        sVal = sLocalAlternative;
+    return sVal;
+
+def getDirEnv(sVar, sAlternative = None, fLocalReq = False, fTryCreate = False):
+    """
+    Tries to get an environment variable specifying a directory path.
+
+    Resolves it into an absolute path and verifies its existance before
+    returning it.
+
+    If the environment variable is empty or isn't set, or if the directory
+    doesn't exist or isn't a directory, sAlternative is returned instead.
+    If sAlternative is None, then we'll raise a GenError.  For local runs we'll
+    only do this if fLocalReq is True.
+    """
+    assert sAlternative is None or fTryCreate is False;
+    try:
+        sVal = os.environ.get(sVar, None);
+        if sVal is None:
+            raise GenError('environment variable "%s" is missing' % (sVar));
+        if sVal == "":
+            raise GenError('environment variable "%s" is empty' % (sVar));
+
+        sVal = os.path.abspath(sVal);
+        if not os.path.isdir(sVal):
+            if not fTryCreate  or  os.path.exists(sVal):
+                reporter.error('the value of env.var. "%s" is not a dir: "%s"' % (sVar, sVal));
+                raise GenError('the value of env.var. "%s" is not a dir: "%s"' % (sVar, sVal));
+            try:
+                os.makedirs(sVal, 0700);
+            except:
+                reporter.error('makedirs failed on the value of env.var. "%s": "%s"' % (sVar, sVal));
+                raise GenError('makedirs failed on the value of env.var. "%s": "%s"' % (sVar, sVal));
+    except:
+        if sAlternative is None:
+            if reporter.isLocal() and fLocalReq:
+                raise;
+            sVal = None;
+        else:
+            sVal = os.path.abspath(sAlternative);
+    return sVal;
+
+def timestampMilli():
+    """
+    Gets a millisecond timestamp.
+    """
+    if sys.platform == 'win32':
+        return long(time.clock() * 1000);
+    return long(time.time() * 1000);
+
+def timestampNano():
+    """
+    Gets a nanosecond timestamp.
+    """
+    if sys.platform == 'win32':
+        return long(time.clock() * 1000000000);
+    return long(time.time() * 1000000000);
+
+def tryGetHostByName(sName):
+    """
+    Wrapper around gethostbyname.
+    """
+    if sName is not None:
+        try:
+            sIpAddr = socket.gethostbyname(sName);
+        except:
+            reporter.errorXcpt('gethostbyname(%s)' % (sName));
+        else:
+            if sIpAddr == '0.0.0.0':
+                reporter.error('gethostbyname(%s) -> %s' % (sName, sIpAddr));
+                raise;
+            sName = sIpAddr;
+    return sName;
+
+def processInterrupt(uPid):
+    """
+    Sends a SIGINT or equivalent to interrupt the specified process.
+    Returns True on success, False on failure.
+
+    On Windows hosts this may not work unless the process happens to be a
+    process group leader.
+    """
+    if sys.platform == 'win32':
+        fRc = winbase.processInterrupt(uPid)
+    else:
+        try:
+            os.kill(uPid, signal.SIGINT);
+            fRc = True;
+        except:
+            reporter.logXcpt('uPid=%s' % (uPid,));
+            fRc = False;
+    return fRc;
+
+def sendUserSignal1(uPid):
+    """
+    Sends a SIGUSR1 or equivalent to nudge the process into shutting down
+    (VBoxSVC) or something.
+    Returns True on success, False on failure or if not supported (win).
+
+    On Windows hosts this may not work unless the process happens to be a
+    process group leader.
+    """
+    if sys.platform == 'win32':
+        fRc = False;
+    else:
+        try:
+            os.kill(uPid, signal.SIGUSR1); # pylint: disable=E1101
+            fRc = True;
+        except:
+            reporter.logXcpt('uPid=%s' % (uPid,));
+            fRc = False;
+    return fRc;
+
+def processTerminate(uPid):
+    """
+    Terminates the process in a nice manner (SIGTERM or equivalent).
+    Returns True on success, False on failure (logged).
+    """
+    fRc = False;
+    if sys.platform == 'win32':
+        fRc = winbase.processTerminate(uPid);
+    else:
+        try:
+            os.kill(uPid, signal.SIGTERM);
+            fRc = True;
+        except:
+            reporter.logXcpt('uPid=%s' % (uPid,));
+    return fRc;
+
+def processKill(uPid):
+    """
+    Terminates the process with extreme prejudice (SIGKILL).
+    Returns True on success, False on failure.
+    """
+    fRc = False;
+    if sys.platform == 'win32':
+        fRc = winbase.processKill(uPid);
+    else:
+        try:
+            os.kill(uPid, signal.SIGKILL); # pylint: disable=E1101
+            fRc = True;
+        except:
+            reporter.logXcpt('uPid=%s' % (uPid,));
+    return fRc;
+
+def processKillWithNameCheck(uPid, sName):
+    """
+    Like processKill(), but checks if the process name matches before killing
+    it.  This is intended for killing using potentially stale pid values.
+
+    Returns True on success, False on failure.
+    """
+
+    if processCheckPidAndName(uPid, sName) is not True:
+        return False;
+    return processKill(uPid);
+
+
+def processExists(uPid):
+    """
+    Checks if the specified process exits.
+    This will only work if we can signal/open the process.
+
+    Returns True if it positively exists, False otherwise.
+    """
+    if sys.platform == 'win32':
+        fRc = winbase.processExists(uPid);
+    else:
+        try:
+            os.kill(uPid, 0);
+            fRc = True;
+        except:
+            reporter.logXcpt('uPid=%s' % (uPid,));
+            fRc = False;
+    return fRc;
+
+def processCheckPidAndName(uPid, sName):
+    """
+    Checks if a process PID and NAME matches.
+    """
+    if sys.platform == 'win32':
+        fRc = winbase.processCheckPidAndName(uPid, sName);
+    else:
+        if sys.platform in ('linux2', ):
+            asPsCmd = ['/bin/ps',     '-p', '%u' % (uPid,), '-o', 'fname='];
+        elif sys.platform in ('sunos5',):
+            asPsCmd = ['/usr/bin/ps', '-p', '%u' % (uPid,), '-o', 'fname='];
+        elif sys.platform in ('darwin',):
+            asPsCmd = ['/bin/ps',     '-p', '%u' % (uPid,), '-o', 'ucomm='];
+        else:
+            asPsCmd = None;
+
+        if asPsCmd is not None:
+            try:
+                oPs = subprocess.Popen(asPsCmd, stdout=subprocess.PIPE);
+                sCurName = oPs.communicate()[0];
+                iExitCode = oPs.wait();
+            except:
+                reporter.logXcpt();
+                return False;
+
+            # ps fails with non-zero exit code if the pid wasn't found.
+            if iExitCode is not 0:
+                return False;
+            if sCurName is None:
+                return False;
+            sCurName = sCurName.strip();
+            if sCurName is '':
+                return False;
+
+            if os.path.basename(sName) == sName:
+                sCurName = os.path.basename(sCurName);
+            elif os.path.basename(sCurName) == sCurName:
+                sName = os.path.basename(sName);
+
+            if sCurName != sName:
+                return False;
+
+            fRc = True;
+    return fRc;
+
+
+
+#
+# Classes
+#
+
+class GenError(Exception):
+    """
+    Exception class which only purpose it is to allow us to only catch our own
+    exceptions.  Better design later.
+    """
+
+    def __init__(self, sWhat = "whatever"):
+        Exception.__init__(self);
+        self.sWhat = sWhat
+
+    def str(self):
+        """Get the message string."""
+        return self.sWhat;
+
+
+class InvalidOption(GenError):
+    """
+    Exception thrown by TestDriverBase.parseOption(). It contains the error message.
+    """
+    def __init__(self, sWhat):
+        GenError.__init__(self, sWhat);
+
+
+class QuietInvalidOption(GenError):
+    """
+    Exception thrown by TestDriverBase.parseOption(). Error already printed, just
+    return failure.
+    """
+    def __init__(self):
+        GenError.__init__(self, "");
+
+
+class TdTaskBase(object):
+    """
+    The base task.
+    """
+
+    def __init__(self, sCaller):
+        self.sDbgCreated    = '%s: %s' % (utils.getTimePrefix(), sCaller);
+        self.fSignalled     = False;
+        self.__oRLock       = threading.RLock();
+        self.oCv            = threading.Condition(self.__oRLock);
+        self.oOwner         = None;
+        self.msStart        = timestampMilli();
+        self.oLocker        = None;
+
+    def __del__(self):
+        """In case we need it later on."""
+        pass;
+
+    def toString(self):
+        """
+        Stringifies the object, mostly as a debug aid.
+        """
+        return '<%s: fSignalled=%s, __oRLock=%s, oCv=%s, oOwner=%s, oLocker=%s, msStart=%s, sDbgCreated=%s>' \
+             % (type(self).__name__, self.fSignalled, self.__oRLock, self.oCv, repr(self.oOwner), self.oLocker, self.msStart,
+                self.sDbgCreated,);
+
+    def __str__(self):
+        return self.toString();
+
+    def lockTask(self):
+        """ Wrapper around oCv.acquire(). """
+        if True: # change to False for debugging deadlocks.
+            self.oCv.acquire();
+        else:
+            msStartWait = timestampMilli();
+            while self.oCv.acquire(0) is False:
+                if timestampMilli() - msStartWait > 30*1000:
+                    reporter.error('!!! timed out waiting for %s' % (self, ));
+                    traceback.print_stack();
+                    reporter.logAllStacks()
+                    self.oCv.acquire();
+                    break;
+                time.sleep(0.5);
+        self.oLocker = thread.get_ident()
+        return None;
+
+    def unlockTask(self):
+        """ Wrapper around oCv.release(). """
+        self.oLocker = None;
+        self.oCv.release();
+        return None;
+
+    def getAgeAsMs(self):
+        """
+        Returns the number of milliseconds the task has existed.
+        """
+        return timestampMilli() - self.msStart;
+
+    def setTaskOwner(self, oOwner):
+        """
+        Sets or clears the task owner.  (oOwner can be None.)
+
+        Returns the previous owner, this means None if not owned.
+        """
+        self.lockTask();
+        oOldOwner = self.oOwner;
+        self.oOwner = oOwner;
+        self.unlockTask();
+        return oOldOwner;
+
+    def signalTaskLocked(self):
+        """
+        Variant of signalTask that can be called while owning the lock.
+        """
+        fOld = self.fSignalled;
+        if not fOld:
+            reporter.log2('signalTaskLocked(%s)' % (self,));
+        self.fSignalled = True;
+        self.oCv.notifyAll()
+        if self.oOwner is not None:
+            self.oOwner.notifyAboutReadyTask(self);
+        return fOld;
+
+    def signalTask(self):
+        """
+        Signals the task, internal use only.
+
+        Returns the previous state.
+        """
+        self.lockTask();
+        fOld = self.signalTaskLocked();
+        self.unlockTask();
+        return fOld
+
+    def resetTaskLocked(self):
+        """
+        Variant of resetTask that can be called while owning the lock.
+        """
+        fOld = self.fSignalled;
+        self.fSignalled = False;
+        return fOld;
+
+    def resetTask(self):
+        """
+        Resets the task signal, internal use only.
+
+        Returns the previous state.
+        """
+        self.lockTask();
+        fOld = self.resetTaskLocked();
+        self.unlockTask();
+        return fOld
+
+    def pollTask(self, fLocked = False):
+        """
+        Poll the signal status of the task.
+        Returns True if signalled, False if not.
+
+        Override this method.
+        """
+        if not fLocked:
+            self.lockTask();
+        fState = self.fSignalled;
+        if not fLocked:
+            self.unlockTask();
+        return fState
+
+    def waitForTask(self, cMsTimeout = 0):
+        """
+        Waits for the task to be signalled.
+
+        Returns True if the task is/became ready before the timeout expired.
+        Returns False if the task is still not after cMsTimeout have elapsed.
+
+        Overriable.
+        """
+        self.lockTask();
+
+        fState = self.pollTask(True);
+        if not fState:
+            # Don't wait more than 1s.  This allow lazy state polling.
+            msStart = timestampMilli();
+            while not fState:
+                cMsElapsed = timestampMilli() - msStart;
+                if cMsElapsed >= cMsTimeout:
+                    break;
+
+                cMsWait = cMsTimeout - cMsElapsed
+                if cMsWait > 1000:
+                    cMsWait = 1000;
+                try:
+                    self.oCv.wait(cMsWait / 1000)
+                except:
+                    pass;
+                fState = self.pollTask(True);
+
+        self.unlockTask();
+        return fState;
+
+
+class Process(TdTaskBase):
+    """
+    Child Process.
+    """
+
+    def __init__(self, sName, asArgs, uPid, hWin = None, uTid = None):
+        TdTaskBase.__init__(self, utils.getCallerName());
+        self.sName      = sName;
+        self.asArgs     = asArgs;
+        self.uExitCode  = -127;
+        self.uPid       = uPid;
+        self.hWin       = hWin;
+        self.uTid       = uTid;
+        self.sKindCrashReport = None;
+        self.sKindCrashDump   = None;
+
+    def toString(self):
+        return '<%s uExitcode=%s, uPid=%s, sName=%s, asArgs=%s, hWin=%s, uTid=%s>' \
+             % (TdTaskBase.toString(self), self.uExitCode, self.uPid, self.sName, self.asArgs, self.hWin, self.uTid);
+
+    #
+    # Instantiation methods.
+    #
+
+    @staticmethod
+    def spawn(sName, *asArgsIn):
+        """
+        Similar to os.spawnl(os.P_NOWAIT,).
+
+        """
+        # Make argument array (can probably use asArgsIn directly, but wtf).
+        asArgs = [];
+        for sArg in asArgsIn:
+            asArgs.append(sArg);
+
+        # Special case: Windows.
+        if sys.platform == 'win32':
+            (uPid, hProcess, uTid) = winbase.processCreate(searchPath(sName), asArgs);
+            if uPid == -1:
+                return None;
+            return Process(sName, asArgs, uPid, hProcess, uTid);
+
+        # Unixy.
+        try:
+            uPid = os.spawnv(os.P_NOWAIT, sName, asArgs);
+        except:
+            reporter.logXcpt('sName=%s' % (sName,));
+            return None;
+        return Process(sName, asArgs, uPid);
+
+    @staticmethod
+    def spawnp(sName, *asArgsIn):
+        """
+        Similar to os.spawnlp(os.P_NOWAIT,).
+
+        """
+        return Process.spawn(searchPath(sName), *asArgsIn);
+
+    #
+    # Task methods
+    #
+
+    def pollTask(self, fLocked = False):
+        """
+        Overridden pollTask method.
+        """
+        if not fLocked:
+            self.lockTask();
+
+        fRc = self.fSignalled;
+        if not fRc:
+            if sys.platform == 'win32':
+                if winbase.processPollByHandle(self.hWin):
+                    try:
+                        (uPid, uStatus) = os.waitpid(self.hWin, 0);
+                        if uPid == self.hWin or uPid == self.uPid:
+                            self.hWin = None; # waitpid closed it, so it's now invalid.
+                            uPid = self.uPid;
+                    except:
+                        reporter.logXcpt();
+                        uPid    = self.uPid;
+                        uStatus = 0xffffffff;
+                else:
+                    uPid    = 0;
+                    uStatus = 0;
+            else:
+                try:
+                    (uPid, uStatus) = os.waitpid(self.uPid, os.WNOHANG); # pylint: disable=E1101
+                except:
+                    reporter.logXcpt();
+                    uPid    = self.uPid;
+                    uStatus = 0xffffffff;
+
+            # Got anything?
+            if uPid == self.uPid:
+                self.uExitCode = uStatus;
+                reporter.log('Process %u -> %u (%#x)' % (uPid, uStatus, uStatus));
+                self.signalTaskLocked();
+                if self.uExitCode != 0 and (self.sKindCrashReport is not None or self.sKindCrashDump is not None):
+                    reporter.error('Process "%s" returned/crashed with a non-zero status code!! rc=%u sig=%u%s (raw=%#x)'
+                                   % ( self.sName, self.uExitCode >> 8, self.uExitCode & 0x7f,
+                                       ' w/ core' if self.uExitCode & 0x80 else '', self.uExitCode))
+                    utils.processCollectCrashInfo(self.uPid, reporter.log, self._addCrashFile);
+
+            fRc = self.fSignalled;
+        if not fLocked:
+            self.unlockTask();
+        return fRc;
+
+    def _addCrashFile(self, sFile, fBinary):
+        """
+        Helper for adding a crash report or dump to the test report.
+        """
+        sKind = self.sKindCrashDump if fBinary else self.sKindCrashReport;
+        if sKind is not None:
+            reporter.addLogFile(sFile, sKind);
+        return None;
+
+
+    #
+    # Methods
+    #
+
+    def enableCrashReporting(self, sKindCrashReport, sKindCrashDump):
+        """
+        Enabling (or disables) automatic crash reporting on systems where that
+        is possible.  The two file kind parameters are on the form
+        'crash/log/client' and 'crash/dump/client'.  If both are None,
+        reporting will be disabled.
+        """
+        self.sKindCrashReport = sKindCrashReport;
+        self.sKindCrashDump   = sKindCrashDump;
+        return True;
+
+    def isRunning(self):
+        """
+        Returns True if the process is still running, False if not.
+        """
+        return not self.pollTask();
+
+    def wait(self, cMsTimeout = 0):
+        """
+        Wait for the process to exit.
+
+        Returns True if the process exited withint the specified wait period.
+        Returns False if still running.
+        """
+        return self.waitForTask(cMsTimeout);
+
+    def getExitCode(self):
+        """
+        Returns the exit code of the process.
+        The process must have exited or the result will be wrong.
+        """
+        if self.isRunning():
+            return -127;
+        return self.uExitCode >> 8;
+
+    def interrupt(self):
+        """
+        Sends a SIGINT or equivalent to interrupt the process.
+        Returns True on success, False on failure.
+
+        On Windows hosts this may not work unless the process happens to be a
+        process group leader.
+        """
+        if sys.platform == 'win32':
+            return winbase.postThreadMesssageQuit(self.uTid);
+        return processInterrupt(self.uPid);
+
+    def sendUserSignal1(self):
+        """
+        Sends a SIGUSR1 or equivalent to nudge the process into shutting down
+        (VBoxSVC) or something.
+        Returns True on success, False on failure.
+
+        On Windows hosts this may not work unless the process happens to be a
+        process group leader.
+        """
+        #if sys.platform == 'win32':
+        #    return winbase.postThreadMesssageClose(self.uTid);
+        return sendUserSignal1(self.uPid);
+
+    def terminate(self):
+        """
+        Terminates the process in a nice manner (SIGTERM or equivalent).
+        Returns True on success, False on failure (logged).
+        """
+        if sys.platform == 'win32':
+            return winbase.processTerminateByHandle(self.hWin);
+        return processTerminate(self.uPid);
+
+    def getPid(self):
+        """ Returns the process id. """
+        return self.uPid;
+
+
+class SubTestDriverBase(object):
+    """
+    The base sub-test driver.
+
+    It helps thinking of these as units/sets/groups of tests, where the test
+    cases are (mostly) realized in python.
+
+    The sub-test drivers are subordinates of one or more test drivers.  They
+    can be viewed as test code libraries that is responsible for parts of a
+    test driver run in different setups.  One example would be testing a guest
+    additions component, which is applicable both to freshly installed guest
+    additions and VMs with old guest.
+
+    The test drivers invokes the sub-test drivers in a private manner during
+    test execution, but some of the generic bits are done automagically by the
+    base class: options, help, various other actions.
+    """
+
+    def __init__(self, sName, oTstDrv):
+        self.sName              = sName;
+        self.oTstDrv            = oTstDrv;
+
+
+    def showUsage(self):
+        """
+        Show usage information if any.
+
+        The default implementation only prints the name.
+        """
+        reporter.log('');
+        reporter.log('Options for sub-test driver %s:' % (self.sName,));
+        return True;
+
+    def parseOption(self, asArgs, iArg):
+        """
+        Parse an option. Override this.
+
+        @param  asArgs      The argument vector.
+        @param  iArg        The index of the current argument.
+
+        @returns The index of the next argument if consumed, @a iArg if not.
+
+        @throws  InvalidOption or QuietInvalidOption on syntax error or similar.
+        """
+        _ = asArgs;
+        return iArg;
+
+
+class TestDriverBase(object): # pylint: disable=R0902
+    """
+    The base test driver.
+    """
+
+    def __init__(self):
+        self.fInterrupted       = False;
+
+        # Actions.
+        self.asSpecialActions   = ['extract', 'abort'];
+        self.asNormalActions    = ['cleanup-before', 'verify', 'config', 'execute', 'cleanup-after' ];
+        self.asActions          = [];
+        self.sExtractDstPath    = None;
+
+        # Options.
+        self.fNoWipeClean       = False;
+
+        # Tasks - only accessed by one thread atm, so no need for locking.
+        self.aoTasks            = [];
+
+        # Host info.
+        self.sHost              = utils.getHostOs();
+        self.sHostArch          = utils.getHostArch();
+
+        #
+        # Get our bearings and adjust the environment.
+        #
+        if not utils.isRunningFromCheckout():
+            self.sBinPath = os.path.join(g_ksValidationKitDir, utils.getHostOs(), utils.getHostArch());
+        else:
+            self.sBinPath = os.path.join(g_ksValidationKitDir, os.pardir, os.pardir, os.pardir, 'out', utils.getHostOsDotArch(),
+                                         os.environ.get('KBUILD_TYPE', os.environ.get('BUILD_TYPE', 'debug')),
+                                         'validationkit', utils.getHostOs(), utils.getHostArch());
+        self.sOrgShell = os.environ.get('SHELL');
+        self.sOurShell = os.path.join(self.sBinPath, 'vts_shell' + exeSuff()); # No shell yet.
+        os.environ['SHELL'] = self.sOurShell;
+
+        self.sScriptPath = getDirEnv('TESTBOX_PATH_SCRIPTS');
+        if self.sScriptPath is None:
+            self.sScriptPath = os.path.abspath(os.path.join(os.getcwd(), '..'));
+        os.environ['TESTBOX_PATH_SCRIPTS'] = self.sScriptPath;
+
+        self.sScratchPath = getDirEnv('TESTBOX_PATH_SCRATCH', fTryCreate = True);
+        if self.sScratchPath is None:
+            sTmpDir = tempfile.gettempdir();
+            if sTmpDir == '/tmp': # /var/tmp is generally more suitable on all platforms.
+                sTmpDir = '/var/tmp';
+            self.sScratchPath = os.path.abspath(os.path.join(sTmpDir, 'VBoxTestTmp'));
+            if not os.path.isdir(self.sScratchPath):
+                os.makedirs(self.sScratchPath, 0700);
+        os.environ['TESTBOX_PATH_SCRATCH'] = self.sScratchPath;
+
+        self.sTestBoxName  = getEnv(   'TESTBOX_NAME', 'local');
+        self.sTestSetId    = getEnv(   'TESTBOX_TEST_SET_ID', 'local');
+        self.sBuildPath    = getDirEnv('TESTBOX_PATH_BUILDS');
+        self.sUploadPath   = getDirEnv('TESTBOX_PATH_UPLOAD');
+        self.sResourcePath = getDirEnv('TESTBOX_PATH_RESOURCES');
+        if self.sResourcePath is None:
+            if self.sHost == 'darwin':      self.sResourcePath = "/Volumes/testrsrc/";
+            elif self.sHost == 'freebsd':   self.sResourcePath = "/mnt/testrsrc/";
+            elif self.sHost == 'linux':     self.sResourcePath = "/mnt/testrsrc/";
+            elif self.sHost == 'os2':       self.sResourcePath = "T:/";
+            elif self.sHost == 'solaris':   self.sResourcePath = "/mnt/testrsrc/";
+            elif self.sHost == 'win':       self.sResourcePath = "T:/";
+            else: raise GenError('unknown host OS "%s"' % (self.sHost));
+
+        # PID file for the testdriver.
+        self.sPidFile = os.path.join(self.sScratchPath, 'testdriver.pid');
+
+        # Some stuff for the log...
+        reporter.log('scratch: %s' % (self.sScratchPath,));
+
+        # Get the absolute timeout (seconds since epoch, see
+        # utils.timestampSecond()). None if not available.
+        self.secTimeoutAbs = os.environ.get('TESTBOX_TIMEOUT_ABS', None);
+        if self.secTimeoutAbs is not None:
+            self.secTimeoutAbs = long(self.secTimeoutAbs);
+
+        # Distance from secTimeoutAbs that timeouts should be adjusted to.
+        self.secTimeoutFudge = 30;
+
+        # List of sub-test drivers (SubTestDriverBase derivatives).
+        self.aoSubTstDrvs    = [];
+
+    def dump(self):
+        """
+        For debugging. --> __str__?
+        """
+        print >> sys.stderr, "testdriver.base: sBinPath          = '%s'" % self.sBinPath;
+        print >> sys.stderr, "testdriver.base: sScriptPath       = '%s'" % self.sScriptPath;
+        print >> sys.stderr, "testdriver.base: sScratchPath      = '%s'" % self.sScratchPath;
+        print >> sys.stderr, "testdriver.base: sTestBoxName      = '%s'" % self.sTestBoxName;
+        print >> sys.stderr, "testdriver.base: sBuildPath        = '%s'" % self.sBuildPath;
+        print >> sys.stderr, "testdriver.base: sResourcePath     = '%s'" % self.sResourcePath;
+        print >> sys.stderr, "testdriver.base: sUploadPath       = '%s'" % self.sUploadPath;
+        print >> sys.stderr, "testdriver.base: sTestSetId        = '%s'" % self.sTestSetId;
+        print >> sys.stderr, "testdriver.base: sHost             = '%s'" % self.sHost;
+        print >> sys.stderr, "testdriver.base: sHostArch         = '%s'" % self.sHostArch;
+        print >> sys.stderr, "testdriver.base: asSpecialActions  = '%s'" % self.asSpecialActions;
+        print >> sys.stderr, "testdriver.base: asNormalActions   = '%s'" % self.asNormalActions;
+        print >> sys.stderr, "testdriver.base: asActions         = '%s'" % self.asActions;
+
+    #
+    # Resource utility methods.
+    #
+
+    def isResourceFile(self, sFile):
+        """
+        Checks if sFile is in in the resource set.
+        """
+        ## @todo need to deal with stuff in the validationkit.zip and similar.
+        asRsrcs = self.getResourceSet();
+        if sFile in asRsrcs:
+            return os.path.isfile(os.path.join(self.sResourcePath, sFile));
+        for sRsrc in asRsrcs:
+            if sFile.startswith(sRsrc):
+                sFull = os.path.join(self.sResourcePath, sRsrc);
+                if os.path.isdir(sFull):
+                    return os.path.isfile(os.path.join(self.sResourcePath, sRsrc));
+        return False;
+
+    def getFullResourceName(self, sName):
+        """
+        Returns the full resource name.
+        """
+        if os.path.isabs(sName): ## @todo Hack. Need to deal properly with stuff in the validationkit.zip and similar.
+            return sName;
+        return os.path.join(self.sResourcePath, sName);
+
+    #
+    # Scratch related utility methods.
+    #
+
+    def __wipeScratchRecurse(self, sDir):
+        """
+        Deletes all file and sub-directories in sDir.
+        Returns the number of errors.
+        """
+        try:
+            asNames = os.listdir(sDir);
+        except:
+            reporter.errorXcpt('os.listdir("%s")' % (sDir));
+            return False;
+
+        cErrors = 0;
+        for sName in asNames:
+            # Build full path and lstat the object.
+            sFullName = os.path.join(sDir, sName)
+            try:
+                oStat = os.lstat(sFullName);
+            except:
+                reporter.errorXcpt('lstat("%s")' % (sFullName));
+                cErrors = cErrors + 1;
+                continue;
+
+            if stat.S_ISDIR(oStat.st_mode):
+                # Directory - recurse and try remove it.
+                cErrors = cErrors + self.__wipeScratchRecurse(sFullName);
+                try:
+                    os.rmdir(sFullName);
+                except:
+                    reporter.errorXcpt('rmdir("%s")' % (sFullName));
+                    cErrors = cErrors + 1;
+            else:
+                # File, symlink, fifo or something - remove/unlink.
+                try:
+                    os.remove(sFullName);
+                except:
+                    reporter.errorXcpt('remove("%s")' % (sFullName));
+                    cErrors = cErrors + 1;
+        return cErrors;
+
+    def wipeScratch(self):
+        """
+        Removes the content of the scratch directory.
+        Returns True on no errors, False + log entries on errors.
+        """
+        cErrors = self.__wipeScratchRecurse(self.sScratchPath);
+        return cErrors == 0;
+
+    #
+    # Sub-test driver related methods.
+    #
+
+    def addSubTestDriver(self, oSubTstDrv):
+        """
+        Adds a sub-test driver.
+
+        Returns True on success, false on failure.
+        """
+        assert isinstance(oSubTstDrv, SubTestDriverBase);
+        if oSubTstDrv in self.aoSubTstDrvs:
+            reporter.error('Attempt at adding sub-test driver %s twice.' % (oSubTstDrv.sName,));
+            return False;
+        self.aoSubTstDrvs.append(oSubTstDrv);
+        return True;
+
+    def showSubTstDrvUsage(self):
+        """
+        Shows the usage of the sub-test drivers.
+        """
+        for oSubTstDrv in self.aoSubTstDrvs:
+            oSubTstDrv.showUsage();
+        return True;
+
+    def subTstDrvParseOption(self, asArgs, iArgs):
+        """
+        Lets the sub-test drivers have a go at the option.
+        Returns the index of the next option if handled, otherwise iArgs.
+        """
+        for oSubTstDrv in self.aoSubTstDrvs:
+            iNext = oSubTstDrv.parseOption(asArgs, iArgs)
+            if iNext != iArgs:
+                assert iNext > iArgs;
+                assert iNext <= len(asArgs);
+                return iNext;
+        return iArgs;
+
+
+    #
+    # Task related methods.
+    #
+
+    def addTask(self, oTask):
+        """
+        Adds oTask to the task list.
+
+        Returns True if the task was added.
+
+        Returns False if the task was already in the task list.
+        """
+        if oTask in self.aoTasks:
+            return False;
+        #reporter.log2('adding task %s' % (oTask,));
+        self.aoTasks.append(oTask);
+        oTask.setTaskOwner(self);
+        #reporter.log2('tasks now in list: %d - %s' % (len(self.aoTasks), self.aoTasks));
+        return True;
+
+    def removeTask(self, oTask):
+        """
+        Removes oTask to the task list.
+
+        Returns oTask on success and None on failure.
+        """
+        try:
+            #reporter.log2('removing task %s' % (oTask,));
+            self.aoTasks.remove(oTask);
+        except:
+            return None;
+        else:
+            oTask.setTaskOwner(None);
+        #reporter.log2('tasks left: %d - %s' % (len(self.aoTasks), self.aoTasks));
+        return oTask;
+
+    def removeAllTasks(self):
+        """
+        Removes all the task from the task list.
+
+        Returns None.
+        """
+        aoTasks = self.aoTasks;
+        self.aoTasks = [];
+        for oTask in aoTasks:
+            oTask.setTaskOwner(None);
+        return None;
+
+    def notifyAboutReadyTask(self, oTask):
+        """
+        Notificiation that there is a ready task.  May be called owning the
+        task lock, so be careful wrt deadlocks.
+
+        Remember to call super when overriding this.
+        """
+        if oTask is None: pass; # lint
+        return None;
+
+    def pollTasks(self):
+        """
+        Polls the task to see if any of them are ready.
+        Returns the ready task, None if none are ready.
+        """
+        for oTask in self.aoTasks:
+            if oTask.pollTask():
+                return oTask;
+        return None;
+
+    def waitForTasksSleepWorker(self, cMsTimeout):
+        """
+        Overriable method that does the sleeping for waitForTask().
+
+        cMsTimeout will not be larger than 1000, so there is normally no need
+        to do any additional splitting up of the polling interval.
+
+        Returns True if cMillieSecs elapsed.
+        Returns False if some exception was raised while we waited or
+        there turned out to be nothing to wait on.
+        """
+        try:
+            self.aoTasks[0].waitForTask(cMsTimeout);
+            return True;
+        except Exception, oXcpt:
+            reporter.log("waitForTasksSleepWorker: %s" % (str(oXcpt),));
+            return False;
+
+    def waitForTasks(self, cMsTimeout):
+        """
+        Waits for any of the tasks to require attention or a KeyboardInterrupt.
+        Returns the ready task on success, None on timeout or interrupt.
+        """
+        try:
+            #reporter.log2('waitForTasks: cMsTimeout=%d' % (cMsTimeout,));
+
+            if cMsTimeout == 0:
+                return self.pollTasks();
+
+            if len(self.aoTasks) == 0:
+                return None;
+
+            fMore = True;
+            if cMsTimeout < 0:
+                while fMore:
+                    oTask = self.pollTasks();
+                    if oTask is not None:
+                        return oTask;
+                    fMore = self.waitForTasksSleepWorker(1000);
+            else:
+                msStart = timestampMilli();
+                while fMore:
+                    oTask = self.pollTasks();
+                    if oTask is not None:
+                        #reporter.log2('waitForTasks: returning %s, msStart=%d' % \
+                        #              (oTask, msStart));
+                        return oTask;
+
+                    cMsElapsed = timestampMilli() - msStart;
+                    if cMsElapsed > cMsTimeout: # not ==, we want the final waitForEvents.
+                        break;
+                    if cMsTimeout - cMsElapsed > 1000:
+                        fMore = self.waitForTasksSleepWorker(1000);
+                    else:
+                        fMore = self.waitForTasksSleepWorker(cMsTimeout - cMsElapsed);
+        except KeyboardInterrupt:
+            self.fInterrupted = True;
+            reporter.errorXcpt('KeyboardInterrupt', 6);
+        except:
+            reporter.errorXcpt(None, 6);
+        return None;
+
+    #
+    # PID file management methods.
+    #
+
+    def pidFileRead(self):
+        """
+        Worker that reads the PID file.
+        Returns list of PID, empty if no file.
+        """
+        aiPids = [];
+        if os.path.isfile(self.sPidFile):
+            try:
+                oFile = utils.openNoInherit(self.sPidFile, 'r');
+                sContent = str(oFile.read());
+                oFile.close();
+            except:
+                reporter.errorXcpt();
+                return aiPids;
+
+            sContent = str(sContent).strip().replace('\n', ' ').replace('\r', ' ').replace('\t', ' ');
+            for sPid in sContent.split(' '):
+                if sPid.isdigit():
+                    try:
+                        aiPids.append(int(sPid));
+                    except:
+                        reporter.logXcpt('sPid=%s' % (sPid,));
+                else:
+                    reporter.log('%s: "%s"' % (self.sPidFile, sPid));
+
+        return aiPids;
+
+    def pidFileAdd(self, iPid, fSudo = False):
+        """
+        Adds a PID to the PID file, creating the file if necessary.
+        """
+        _ = fSudo; ## @todo remember sudo (root) children.
+        try:
+            oFile = utils.openNoInherit(self.sPidFile, 'a');
+            oFile.write(str(iPid) + '\n');
+            oFile.close();
+        except:
+            reporter.errorXcpt();
+            return False;
+        reporter.log2('pidFileAdd: added PID %d (new content: %s)' % (iPid, self.pidFileRead(),));
+        return True;
+
+    def pidFileRemove(self, iPid, fQuiet = False):
+        """
+        Removes a PID from the PID file.
+        """
+        aiPids = self.pidFileRead();
+        if iPid not in aiPids:
+            if not fQuiet:
+                reporter.log('pidFileRemove could not find %s in the PID file (content: %s)' % (iPid, aiPids));
+            return False;
+
+        aiPids.remove(iPid);
+        sPid = '';
+        for iPid2 in aiPids:
+            sPid += '%s\n' % (iPid2,);
+
+        try:
+            oFile = utils.openNoInherit(self.sPidFile, 'w');
+            oFile.write(sPid);
+            oFile.close();
+        except:
+            reporter.errorXcpt();
+            return False;
+
+        reporter.log2('pidFileRemove: removed PID %d (new content: %s)' % (iPid, self.pidFileRead(),));
+        return True;
+
+    def pidFileDelete(self):
+        """Creates the testdriver PID file."""
+        if os.path.isfile(self.sPidFile):
+            try:
+                os.unlink(self.sPidFile);
+            except:
+                reporter.logXcpt();
+                return False;
+        return True;
+
+    #
+    # Misc helper methods.
+    #
+
+    def requireMoreArgs(self, cMinNeeded, asArgs, iArg):
+        """
+        Checks that asArgs has at least cMinNeeded args following iArg.
+
+        Returns iArg + 1 if it checks out fine.
+        Raise appropritate exception if not, ASSUMING that the current argument
+        is found at iArg.
+        """
+        assert cMinNeeded >= 1;
+        if iArg + cMinNeeded > len(asArgs):
+            if cMinNeeded > 1:
+                raise InvalidOption('The "%s" option takes %s values' % (asArgs[iArg], cMinNeeded,));
+            raise InvalidOption('The "%s" option takes 1 value' % (asArgs[iArg],));
+        return iArg + 1;
+
+    def getBinTool(self, sName):
+        """
+        Returns the full path to the given binary validation kit tool.
+        """
+        return os.path.join(self.sBinPath, sName) + exeSuff();
+
+    def adjustTimeoutMs(self, cMsTimeout, cMsMinimum = None):
+        """
+        Adjusts the given timeout (milliseconds) to take TESTBOX_TIMEOUT_ABS
+        and cMsMinimum (optional) into account.
+
+        Returns adjusted timeout.
+        Raises no exceptions.
+        """
+        if self.secTimeoutAbs is not None:
+            cMsToDeadline = self.secTimeoutAbs * 1000 - utils.timestampMilli();
+            if cMsToDeadline >= 0:
+                # Adjust for fudge and enforce the minimum timeout
+                cMsToDeadline -= self.secTimeoutFudge * 1000;
+                if cMsToDeadline < (cMsMinimum if cMsMinimum is not None else 10000):
+                    cMsToDeadline = cMsMinimum if cMsMinimum is not None else 10000;
+
+                # Is the timeout beyond the (adjusted) deadline, if so change it.
+                if cMsTimeout > cMsToDeadline:
+                    reporter.log('adjusting timeout: %s ms -> %s ms (deadline)\n' % (cMsTimeout, cMsToDeadline,));
+                    return cMsToDeadline;
+
+            #else: Don't bother, we've passed the deadline.
+
+        # Only enforce the minimum timeout if specified.
+        if cMsMinimum is not None and cMsTimeout < cMsMinimum:
+            reporter.log('adjusting timeout: %s ms -> %s ms (minimum)\n' % (cMsTimeout, cMsMinimum,));
+            cMsTimeout = cMsMinimum;
+
+        return cMsTimeout;
+
+    def prepareResultFile(self, sName = 'results.xml'):
+        """
+        Given a base name (no path, but extension if required), a scratch file
+        name is computed and any previous file removed.
+
+        Returns the full path to the file sName.
+        Raises exception on failure.
+        """
+        sXmlFile = os.path.join(self.sScratchPath, sName);
+        if os.path.exists(sXmlFile):
+            os.unlink(sXmlFile);
+        return sXmlFile;
+
+
+    #
+    # Overridable methods.
+    #
+
+    def showUsage(self):
+        """
+        Shows the usage.
+
+        When overriding this, call super first.
+        """
+        sName = os.path.basename(sys.argv[0]);
+        reporter.log('Usage: %s [options] <action(s)>' % (sName,));
+        reporter.log('');
+        reporter.log('Actions (in execution order):');
+        reporter.log('  cleanup-before');
+        reporter.log('      Cleanups done at the start of testing.');
+        reporter.log('  verify');
+        reporter.log('      Verify that all necessary resources are present.');
+        reporter.log('  config');
+        reporter.log('      Configure the tests.');
+        reporter.log('  execute');
+        reporter.log('      Execute the tests.');
+        reporter.log('  cleanup-after');
+        reporter.log('      Cleanups done at the end of the testing.');
+        reporter.log('');
+        reporter.log('Special Actions:');
+        reporter.log('  all');
+        reporter.log('      Alias for: %s' % (' '.join(self.asNormalActions),));
+        reporter.log('  extract <path>');
+        reporter.log('      Extract the test resources and put them in the specified');
+        reporter.log('      path for off side/line testing.');
+        reporter.log('  abort');
+        reporter.log('      Aborts the test.');
+        reporter.log('');
+        reporter.log('Base Options:');
+        reporter.log('  -h, --help');
+        reporter.log('      Show this help message.');
+        reporter.log('  -v, --verbose');
+        reporter.log('      Increase logging verbosity, repeat for more logging.');
+        reporter.log('  -d, --debug');
+        reporter.log('      Increase the debug logging level, repeat for more info.');
+        reporter.log('  --no-wipe-clean');
+        reporter.log('      Do not wipe clean the scratch area during the two clean up');
+        reporter.log('      actions.  This is for facilitating nested test driver execution.');
+        return True;
+
+    def parseOption(self, asArgs, iArg):
+        """
+        Parse an option. Override this.
+
+        Keyword arguments:
+        asArgs -- The argument vector.
+        iArg   -- The index of the current argument.
+
+        Returns iArg if the option was not recognized.
+        Returns the index of the next argument when something is consumed.
+        In the event of a syntax error, a InvalidOption or QuietInvalidOption
+        should be thrown.
+        """
+
+        if asArgs[iArg] in ('--help', '-help', '-h', '-?', '/?', '/help', '/H', '-H'):
+            self.showUsage();
+            self.showSubTstDrvUsage();
+            raise QuietInvalidOption();
+
+        # options
+        if asArgs[iArg] in ('--verbose', '-v'):
+            reporter.incVerbosity()
+        elif asArgs[iArg] in ('--debug', '-d'):
+            reporter.incDebug()
+        elif asArgs[iArg] == '--no-wipe-clean':
+            self.fNoWipeClean = True;
+        elif (asArgs[iArg] == 'all' or asArgs[iArg] in self.asNormalActions) \
+          and self.asActions in self.asSpecialActions:
+            raise InvalidOption('selected special action "%s" already' % (self.asActions[0], ));
+        # actions
+        elif asArgs[iArg] == 'all':
+            self.asActions = [ 'all' ];
+        elif asArgs[iArg] in self.asNormalActions:
+            self.asActions.append(asArgs[iArg])
+        elif asArgs[iArg] in self.asSpecialActions:
+            if self.asActions != []:
+                raise InvalidOption('selected special action "%s" already' % (self.asActions[0], ));
+            self.asActions = [ asArgs[iArg] ];
+            # extact <destination>
+            if asArgs[iArg] == 'extract':
+                iArg = iArg + 1;
+                if iArg >= len(asArgs): raise InvalidOption('The "extract" action requires a destination directory');
+                self.sExtractDstPath = asArgs[iArg];
+        else:
+            return iArg;
+        return iArg + 1;
+
+    def completeOptions(self):
+        """
+        This method is called after parsing all the options.
+        Returns success indicator. Use the reporter to complain.
+
+        Overriable, call super.
+        """
+        return True;
+
+    def getResourceSet(self):
+        """
+        Returns a set of file and/or directory names relative to
+        TESTBOX_PATH_RESOURCES.
+
+        Override this.
+        """
+        return [];
+
+    def actionExtract(self):
+        """
+        Handle the action that extracts the test resources for off site use.
+        Returns a success indicator and error details with the reporter.
+
+        Usually no need to override this.
+        """
+        reporter.error('the extract action is not implemented')
+        return False;
+
+    def actionVerify(self):
+        """
+        Handle the action that verify the test resources.
+        Returns a success indicator and error details with the reporter.
+
+        There is usually no need to override this.
+        """
+
+        asRsrcs = self.getResourceSet();
+        for sRsrc in asRsrcs:
+            # Go thru some pain to catch escape sequences.
+            if sRsrc.find("//") >= 0:
+                reporter.error('Double slash test resource name: "%s"' % (sRsrc));
+                return False;
+            if   sRsrc == ".." \
+              or sRsrc.startswith("../") \
+              or sRsrc.find("/../") >= 0 \
+              or sRsrc.endswith("/.."):
+                reporter.error('Relative path in test resource name: "%s"' % (sRsrc));
+                return False;
+
+            sFull = os.path.normpath(os.path.abspath(os.path.join(self.sResourcePath, sRsrc)));
+            if not sFull.startswith(os.path.normpath(self.sResourcePath)):
+                reporter.error('sFull="%s" self.sResourcePath=%s' % (sFull, self.sResourcePath));
+                reporter.error('The resource "%s" seems to specify a relative path' % (sRsrc));
+                return False;
+
+            reporter.log2('Checking for resource "%s" at "%s" ...' % (sRsrc, sFull));
+            if os.path.isfile(sFull):
+                try:
+                    oFile = utils.openNoInherit(sFull, "rb");
+                    oFile.close();
+                except Exception, oXcpt:
+                    reporter.error('The file resource "%s" cannot be accessed: %s' % (sFull, oXcpt));
+                    return False;
+            elif os.path.isdir(sFull):
+                if not os.path.isdir(os.path.join(sFull, '.')):
+                    reporter.error('The directory resource "%s" cannot be accessed' % (sFull));
+                    return False;
+            elif os.path.exists(sFull):
+                reporter.error('The resource "%s" is not a file or directory' % (sFull));
+                return False;
+            else:
+                reporter.error('The resource "%s" was not found' % (sFull));
+                return False;
+        return True;
+
+    def actionConfig(self):
+        """
+        Handle the action that configures the test.
+        Returns True (success), False (failure) or None (skip the test),
+        posting complaints and explanations with the reporter.
+
+        Override this.
+        """
+        return True;
+
+    def actionExecute(self):
+        """
+        Handle the action that executes the test.
+
+        Returns True (success), False (failure) or None (skip the test),
+        posting complaints and explanations with the reporter.
+
+        Override this.
+        """
+        return True;
+
+    def actionCleanupBefore(self):
+        """
+        Handle the action that cleans up spills from previous tests before
+        starting the tests.  This is mostly about wiping the scratch space
+        clean in local runs.  On a testbox the testbox script will use the
+        cleanup-after if the test is interrupted.
+
+        Returns True (success), False (failure) or None (skip the test),
+        posting complaints and explanations with the reporter.
+
+        Override this, but call super to wipe the scratch directory.
+        """
+        if self.fNoWipeClean is False:
+            self.wipeScratch();
+        return True;
+
+    def actionCleanupAfter(self):
+        """
+        Handle the action that cleans up all spills from executing the test.
+
+        Returns True (success) or False (failure) posting complaints and
+        explanations with the reporter.
+
+        Override this, but call super to wipe the scratch directory.
+        """
+        if self.fNoWipeClean is False:
+            self.wipeScratch();
+        return True;
+
+    def actionAbort(self):
+        """
+        Handle the action that aborts a (presumed) running testdriver, making
+        sure to include all it's children.
+
+        Returns True (success) or False (failure) posting complaints and
+        explanations with the reporter.
+
+        Override this, but call super to kill the testdriver script and any
+        other process covered by the testdriver PID file.
+        """
+
+        aiPids = self.pidFileRead();
+        reporter.log('The pid file contained: %s' % (aiPids,));
+
+        #
+        # Try convince the processes to quit with increasing impoliteness.
+        #
+        if sys.platform == 'win32':
+            afnMethods = [ processInterrupt, processTerminate ];
+        else:
+            afnMethods = [ sendUserSignal1, processInterrupt, processTerminate, processKill ];
+        for fnMethod in afnMethods:
+            for iPid in aiPids:
+                fnMethod(iPid);
+
+            for i in range(10):
+                if i > 0:
+                    time.sleep(1);
+
+                for j in range(len(aiPids) - 1, -1, -1):
+                    iPid = aiPids[j];
+                    if not processExists(iPid):
+                        reporter.log('%s terminated' % (iPid,));
+                        self.pidFileRemove(iPid, fQuiet = True);
+                        aiPids.pop(j);
+
+                if len(aiPids) == 0:
+                    reporter.log('All done.');
+                    return True;
+
+                if i in [4, 8]:
+                    reporter.log('Still waiting for: %s (method=%s)' % (aiPids, fnMethod,));
+
+        reporter.log('Failed to terminate the following processes: %s' % (aiPids,));
+        return False;
+
+
+    def onExit(self, iRc):
+        """
+        Hook for doing very important cleanups on the way out.
+
+        iRc is the exit code or -1 in the case of an unhandled exception.
+        Returns nothing and shouldn't raise exceptions (will be muted+ignored).
+        """
+        _ = iRc;
+        return None;
+
+
+    #
+    # main() - don't override anything!
+    #
+
+    def main(self, asArgs = None):
+        """
+        The main function of the test driver.
+
+        Keyword arguments:
+        asArgs -- The argument vector.  Defaults to sys.argv.
+
+        Returns exit code. No exceptions.
+        """
+
+        #
+        # Wrap worker in exception handler and always call a 'finally' like
+        # method to do crucial cleanups on the way out.
+        #
+        try:
+            iRc = self.innerMain(asArgs);
+        except:
+            try:
+                self.onExit(-1);
+            except:
+                reporter.logXcpt();
+            raise;
+        self.onExit(iRc);
+        return iRc;
+
+
+    def innerMain(self, asArgs = None):
+        """
+        Exception wrapped main() worker.
+        """
+
+        # parse the arguments.
+        if asArgs is None:
+            asArgs = list(sys.argv);
+        iArg = 1;
+        try:
+            while iArg < len(asArgs):
+                iNext = self.parseOption(asArgs, iArg);
+                if iNext == iArg:
+                    iNext = self.subTstDrvParseOption(asArgs, iArg);
+                    if iNext == iArg:
+                        raise InvalidOption('unknown option: %s' % (asArgs[iArg]))
+                iArg = iNext;
+        except QuietInvalidOption, oXcpt:
+            return rtexitcode.RTEXITCODE_SYNTAX;
+        except InvalidOption, oXcpt:
+            reporter.error(oXcpt.str());
+            return rtexitcode.RTEXITCODE_SYNTAX;
+        except:
+            reporter.error('unexpected exception while parsing argument #%s' % (iArg));
+            traceback.print_exc();
+            return rtexitcode.RTEXITCODE_SYNTAX;
+
+        if not self.completeOptions():
+            return rtexitcode.RTEXITCODE_SYNTAX;
+
+        if self.asActions == []:
+            reporter.error('no action was specified');
+            reporter.error('valid actions: %s' % (self.asNormalActions + self.asSpecialActions + ['all']));
+            return rtexitcode.RTEXITCODE_SYNTAX;
+
+        # execte the actions.
+        fRc = True;         # Tristate - True (success), False (failure), None (skipped).
+        asActions = self.asActions;
+        if 'extract' in asActions:
+            reporter.log('*** extract action ***');
+            asActions.remove('extract');
+            fRc = self.actionExtract();
+            reporter.log('*** extract action completed (fRc=%s) ***' % (fRc));
+        elif 'abort' in asActions:
+            reporter.log('*** abort action ***');
+            asActions.remove('abort');
+            fRc = self.actionAbort();
+            reporter.log('*** abort action completed (fRc=%s) ***' % (fRc));
+        else:
+            if asActions == [ 'all' ]:
+                asActions = self.asNormalActions;
+
+            if 'verify' in asActions:
+                reporter.log('*** verify action ***');
+                asActions.remove('verify');
+                fRc = self.actionVerify();
+                if fRc is True: reporter.log("verified succeeded");
+                else:           reporter.log("verified failed (fRc=%s)" % (fRc,));
+                reporter.log('*** verify action completed (fRc=%s) ***' % (fRc,));
+
+            if 'cleanup-before' in asActions:
+                reporter.log('*** cleanup-before action ***');
+                asActions.remove('cleanup-before');
+                fRc2 = self.actionCleanupBefore();
+                if fRc2 is not True: reporter.log("cleanup-before failed");
+                if fRc2 is not True and fRc is True: fRc = fRc2;
+                reporter.log('*** cleanup-before action completed (fRc2=%s, fRc=%s) ***' % (fRc2, fRc,));
+
+            self.pidFileAdd(os.getpid());
+
+            if 'config' in asActions and fRc is True:
+                asActions.remove('config');
+                reporter.log('*** config action ***');
+                fRc = self.actionConfig();
+                if fRc is True: reporter.log("config succeeded");
+                else:           reporter.log("config failed");
+                reporter.log('*** config action completed (fRc=%s) ***' % (fRc,));
+
+            if 'execute' in asActions and fRc is True:
+                asActions.remove('execute');
+                reporter.log('*** execute action ***');
+                fRc = self.actionExecute();
+                if fRc is True: reporter.log("execute succeeded");
+                else:           reporter.log("execute failed (fRc=%s)" % (fRc,));
+                reporter.testCleanup();
+                reporter.log('*** execute action completed (fRc=%s) ***' % (fRc,));
+
+            if 'cleanup-after' in asActions:
+                reporter.log('*** cleanup-after action ***');
+                asActions.remove('cleanup-after');
+                fRc2 = self.actionCleanupAfter();
+                if fRc2 is not True: reporter.log("cleanup-after failed");
+                if fRc2 is not True and fRc is True: fRc = fRc2;
+                reporter.log('*** cleanup-after action completed (fRc2=%s, fRc=%s) ***' % (fRc2, fRc,));
+
+            self.pidFileRemove(os.getpid());
+
+        if asActions != [] and fRc is True:
+            reporter.error('unhandled actions: %s' % (asActions,));
+            fRc = False;
+
+        # Done
+        if fRc is None:
+            reporter.log('*****************************************');
+            reporter.log('*** The test driver SKIPPED the test. ***');
+            reporter.log('*****************************************');
+            return rtexitcode.RTEXITCODE_SKIPPED;
+        if fRc is not True:
+            reporter.error('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
+            reporter.error('!!! The test driver FAILED (in case we forgot to mention it). !!!');
+            reporter.error('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
+            return rtexitcode.RTEXITCODE_FAILURE;
+        reporter.log('*******************************************');
+        reporter.log('*** The test driver exits successfully. ***');
+        reporter.log('*******************************************');
+        return rtexitcode.RTEXITCODE_SUCCESS;
+
+# The old, deprecated name.
+TestDriver = TestDriverBase; # pylint: disable=C0103
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class TestDriverBaseTestCase(unittest.TestCase):
+    def setUp(self):
+        self.oTstDrv = TestDriverBase();
+        self.oTstDrv.pidFileDelete();
+
+    def tearDown(self):
+        pass; # clean up scratch dir and such.
+
+    def testPidFile(self):
+        aiPids = [os.getpid() + 1, os.getpid() + 2];
+        self.assertTrue(self.oTstDrv.pidFileAdd(aiPids[0]));
+        self.assertEqual(self.oTstDrv.pidFileRead(), aiPids[0:1]);
+        self.assertTrue(self.oTstDrv.pidFileAdd(aiPids[1]));
+        self.assertEqual(self.oTstDrv.pidFileRead(), aiPids[0:2]);
+        self.assertTrue(self.oTstDrv.pidFileDelete());
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testdriver/reporter.py b/src/VBox/ValidationKit/testdriver/reporter.py
new file mode 100644
index 0000000..7b16915
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/reporter.py
@@ -0,0 +1,1384 @@
+# -*- coding: utf-8 -*-
+# $Id: reporter.py $
+# pylint: disable=C0302
+
+"""
+Testdriver reporter module.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 97254 $"
+
+
+# Standard Python imports.
+import array
+import datetime
+import errno
+import os
+import os.path
+import sys
+import time
+import threading
+import traceback
+
+# Validation Kit imports.
+from common import utils;
+
+## test reporter instance
+g_oReporter = None;
+g_sReporterName = None;
+g_oLock = threading.Lock();
+
+
+
+class PythonLoggingStream(object):
+    """
+    Python logging => testdriver/reporter.py stream.
+    """
+
+    def write(self, sText):
+        """Writes python log message to our stream."""
+        if g_oReporter != None:
+            sText = sText.rstrip("\r\n");
+            #g_oReporter.log(0, 'python: %s' % (sText), utils.getCallerName(), utils.getTimePrefix());
+        return True;
+
+    def flush(self):
+        """Flushes the stream."""
+        return True;
+
+
+class ReporterBase(object):
+    """
+    Base class for the reporters.
+    """
+
+    def __init__(self):
+        self.iVerbose   = 1;
+        self.iDebug     = 0;
+        self.cErrors    = 0;
+        self.fTimedOut  = False; # Once set, it trickles all the way up.
+        self.atTests    = [];
+        self.sName      = os.path.splitext(os.path.basename(sys.argv[0]))[0];
+
+        # Hook into the python logging.
+        import logging;
+        logging.basicConfig(stream = PythonLoggingStream(),
+                            level  = logging.DEBUG,
+                            format = '%(name)-12s %(levelname)-8s %(message)s');
+    #
+    # Introspection and configuration.
+    #
+
+    def isLocal(self):
+        """Is this a local reporter?"""
+        return False;
+
+    def incVerbosity(self):
+        """Increases the verbosity level."""
+        self.iVerbose += 1;
+
+    def incDebug(self):
+        """Increases the debug level."""
+        self.iDebug += 1;
+
+    #
+    # Generic logging.
+    #
+
+    def log(self, iLevel, sText, sCaller, sTsPrf):
+        """
+        Writes the specfied text to the log if iLevel is less or requal
+        to iVerbose.
+        """
+        _ = iLevel; _ = sText; _ = sCaller; _ = sTsPrf;
+        return 0;
+
+    #
+    # XML output from the reporter.
+    #
+
+    def _xmlEscAttr(self, sValue):
+        """Escapes an XML attribute value."""
+        sValue = sValue.replace('&',  '&');
+        sValue = sValue.replace('<',  '<');
+        sValue = sValue.replace('>',  '>');
+        #sValue = sValue.replace('\'', ''');
+        sValue = sValue.replace('"',  '"');
+        sValue = sValue.replace('\n', '&#xA');
+        sValue = sValue.replace('\r', '&#xD');
+        return sValue;
+
+    def _xmlWrite(self, asText, fIndent = True):
+        """XML output function for the reporter."""
+        _ = asText; _ = fIndent;
+        return None;
+
+    def xmlFlush(self, fRetry = False, fForce = False):
+        """Flushes XML output if buffered."""
+        _ = fRetry; _ = fForce;
+        return None;
+
+    #
+    # XML output from child.
+    #
+
+    def subXmlStart(self, oFileWrapper):
+        """Called by the file wrapper when the first bytes are written to the test pipe."""
+        _ = oFileWrapper;
+        return None;
+
+    def subXmlWrite(self, oFileWrapper, sRawXml, sCaller):
+        """Called by the file wrapper write method for test pipes."""
+        return self.log(0, 'raw xml%s: %s' % (oFileWrapper.sPrefix, sRawXml), sCaller, utils.getTimePrefix());
+
+    def subXmlEnd(self, oFileWrapper):
+        """Called by the file wrapper __del__ method for test pipes."""
+        _ = oFileWrapper;
+        return None;
+
+    #
+    # File output.
+    #
+
+    def addLogFile(self, oSrcFile, sSrcFilename, sAltName, sDescription, sKind, sCaller, sTsPrf):
+        """
+        Adds the file to the report.
+        Returns True on success, False on failure.
+        """
+        _ = oSrcFile; _ = sSrcFilename; _ = sAltName; _ = sDescription; _ = sKind; _ = sCaller; _ = sTsPrf;
+        return True;
+
+    #
+    # Test reporting
+    #
+
+    def _testGetFullName(self):
+        """
+        Mangles the test names in atTest into a single name to make it easier
+        to spot where we are.
+        """
+        sName = '';
+        for t in self.atTests:
+            if sName != '':
+                sName += ', ';
+            sName += t[0];
+        return sName;
+
+    def testIncErrors(self):
+        """Increates the error count."""
+        self.cErrors += 1;
+        return self.cErrors;
+
+    def testSetTimedOut(self):
+        """Sets time out indicator for the current test and increases the error counter."""
+        self.fTimedOut = True;
+        self.cErrors += 1;
+        return None;
+
+    def testStart(self, sName, sCaller):
+        """ Starts a new test, may be nested. """
+        (sTsPrf, sTsIso) = utils.getTimePrefixAndIsoTimestamp();
+        self._xmlWrite([ '<Test timestamp="%s" name="%s">' % (sTsIso, self._xmlEscAttr(sName),), ]);
+        self.atTests.append((sName, self.cErrors, self.fTimedOut));
+        self.fTimedOut = False;
+        return self.log(1, '%-50s: TESTING' % (self._testGetFullName()), sCaller, sTsPrf);
+
+    def testValue(self, sName, sValue, sUnit, sCaller):
+        """ Reports a benchmark value or something simiarlly useful. """
+        (sTsPrf, sTsIso) = utils.getTimePrefixAndIsoTimestamp();
+        self._xmlWrite([ '<Value timestamp="%s" name="%s" unit="%s" value="%s"/>'
+                         % (sTsIso, self._xmlEscAttr(sName), self._xmlEscAttr(sUnit), self._xmlEscAttr(sValue)), ]);
+        return self.log(0, '  %-48s: %12s %s' % (sName, sValue, sUnit), sCaller, sTsPrf);
+
+    def testFailure(self, sDetails, sCaller):
+        """ Reports a failure. """
+        (sTsPrf, sTsIso) = utils.getTimePrefixAndIsoTimestamp();
+        self.cErrors = self.cErrors + 1;
+        self._xmlWrite([ '<FailureDetails timestamp="%s" text="%s"/>' % (sTsIso, self._xmlEscAttr(sDetails),), ]);
+        return self.log(0, sDetails, sCaller, sTsPrf);
+
+    def testDone(self, fSkipped, sCaller):
+        """
+        Marks the current test as DONE, pops it and maks the next test on the
+        stack current.
+        Returns (name, errors).
+        """
+        (sTsPrf, sTsIso) = utils.getTimePrefixAndIsoTimestamp();
+        sFullName        = self._testGetFullName();
+
+        # safe pop
+        if len(self.atTests) <= 0:
+            self.log(0, 'testDone on empty test stack!', sCaller, sTsPrf);
+            return ('internal error', 0);
+        fTimedOut = self.fTimedOut;
+        sName, cErrorsStart, self.fTimedOut = self.atTests.pop();
+
+        # log + xml.
+        cErrors = self.cErrors - cErrorsStart;
+        if cErrors == 0:
+            if fSkipped is not True:
+                self._xmlWrite([ '  <Passed timestamp="%s"/>' % (sTsIso,), '</Test>' ],);
+                self.log(1, '%-50s: PASSED' % (sFullName,), sCaller, sTsPrf);
+            else:
+                self._xmlWrite([ '  <Skipped timestamp="%s"/>' % (sTsIso,), '</Test>' ]);
+                self.log(1, '%-50s: SKIPPED' % (sFullName,), sCaller, sTsPrf);
+        elif fTimedOut:
+            self._xmlWrite([ '  <TimedOut timestamp="%s" errors="%d"/>' % (sTsIso, cErrors), '</Test>' ]);
+            self.log(0, '%-50s: TIMED-OUT - %d errors' % (sFullName, cErrors), sCaller, sTsPrf);
+        else:
+            self._xmlWrite([ '  <Failed timestamp="%s" errors="%d"/>' % (sTsIso, cErrors), '</Test>' ]);
+            self.log(0, '%-50s: FAILED - %d errors' % (sFullName, cErrors), sCaller, sTsPrf);
+
+        # Flush buffers when reaching the last test.
+        if len(self.atTests) == 0:
+            self.xmlFlush(fRetry = True);
+
+        return (sName, cErrors);
+
+    def testErrorCount(self):
+        """
+        Returns the number of errors accumulated by the current test.
+        """
+        cTests = len(self.atTests);
+        if cTests <= 0:
+            return self.cErrors;
+        return self.cErrors - self.atTests[cTests - 1][1];
+
+    def testCleanup(self, sCaller):
+        """
+        Closes all open test as failed.
+        Returns True if no open tests, False if there were open tests.
+        """
+        if len(self.atTests) == 0:
+            return True;
+        for _ in range(len(self.atTests)):
+            self.testFailure('Test not closed by test drver', sCaller)
+            self.testDone(False, sCaller);
+        return False;
+
+
+
+class LocalReporter(ReporterBase):
+    """
+    Local reporter instance.
+    """
+
+    def __init__(self):
+        ReporterBase.__init__(self);
+        self.oLogFile   = None;
+        self.oXmlFile   = None;
+        self.fXmlOk     = True;
+        self.iSubXml    = 0;
+        self.iOtherFile = 0;
+        self.fnGetIsoTimestamp  = utils.getIsoTimestamp;    # Hack to get a timestamp in __del__.
+        self.oStdErr            = sys.stderr;               # Hack for __del__ output.
+
+        #
+        # Figure the main log directory.
+        #
+        try:
+            import user;
+            self.sDefLogDir = os.path.abspath(os.path.join(user.home, "VBoxTestLogs"));
+        except:
+            self.sDefLogDir = os.path.abspath("VBoxTestLogs");
+        try:
+            sLogDir = os.path.abspath(os.environ.get('TESTBOX_REPORTER_LOG_DIR', self.sDefLogDir));
+            if not os.path.isdir(sLogDir):
+                os.makedirs(sLogDir, 0750);
+        except:
+            sLogDir = self.sDefLogDir;
+            if not os.path.isdir(sLogDir):
+                os.makedirs(sLogDir, 0750);
+
+        #
+        # Make a subdirectory for this test run.
+        #
+        sTs = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H-%M-%S.log');
+        self.sLogDir = sLogDir = os.path.join(sLogDir, '%s-%s' % (sTs, self.sName));
+        try:
+            os.makedirs(self.sLogDir, 0750);
+        except:
+            self.sLogDir = '%s-%s' % (self.sLogDir, os.getpid());
+            os.makedirs(self.sLogDir, 0750);
+
+        #
+        # Open the log file and write a header.
+        #
+        sLogName = os.path.join(self.sLogDir, 'testsuite.log');
+        sTsIso = utils.getIsoTimestamp();
+        self.oLogFile = utils.openNoInherit(sLogName, "w");
+        self.oLogFile.write(('Created log file at %s.\nRunning: %s' % (sTsIso, sys.argv)).encode('utf-8'));
+
+        #
+        # Open the xml log file and write the mandatory introduction.
+        #
+        # Note! This is done here and not in the base class because the remote
+        #       logger doesn't really need this.  It doesn't need the outer
+        #       test wrapper either.
+        #
+        sXmlName = os.path.join(self.sLogDir, 'testsuite.xml');
+        self.oXmlFile = utils.openNoInherit(sXmlName, "w");
+        self._xmlWrite([ '<?xml version="1.0" encoding="UTF-8" ?>',
+                         '<Test timestamp="%s" name="%s">' % (sTsIso, self._xmlEscAttr(self.sName),), ],
+                       fIndent = False);
+
+    def __del__(self):
+        """Ends and completes the log files."""
+        try:    sTsIso = self.fnGetIsoTimestamp();
+        except Exception, oXcpt:
+            sTsIso = str(oXcpt);
+
+        if self.oLogFile is not None:
+            try:
+                self.oLogFile.write(('\nThe End %s\n' % (sTsIso,)).encode('utf-8'));
+                self.oLogFile.close();
+            except: pass;
+            self.oLogFile = None;
+
+        if self.oXmlFile is not None:
+            self._closeXml(sTsIso);
+            self.oXmlFile = None;
+
+    def _closeXml(self, sTsIso):
+        """Closes the XML file."""
+        if self.oXmlFile is not None:
+            # pop the test stack
+            while len(self.atTests) > 0:
+                sName, cErrorsStart, self.fTimedOut = self.atTests.pop();
+                self._xmlWrite([ '<End timestamp="%s" errors="%d"/>' % (sTsIso, self.cErrors - cErrorsStart,),
+                                 '</%s>' % (sName,), ]);
+
+            # The outer one is not on the stack.
+            self._xmlWrite([ '  <End timestamp="%s"/>' % (sTsIso,),
+                             '</Test>', ], fIndent = False);
+            try:
+                self.oXmlFile.close();
+                self.oXmlFile = None;
+            except:
+                pass;
+
+    def _xmlWrite(self, asText, fIndent = True):
+        """Writes to the XML file."""
+        for sText in asText:
+            if fIndent:
+                sIndent = ''.ljust((len(self.atTests) + 1) * 2);
+                sText = sIndent + sText;
+            sText += '\n';
+
+            try:
+                self.oXmlFile.write(sText.encode('utf-8'));
+            except:
+                if self.fXmlOk:
+                    traceback.print_exc();
+                    self.fXmlOk = False;
+                return False;
+        return True;
+
+    #
+    # Overridden methods.
+    #
+
+    def isLocal(self):
+        """Is this a local reporter?"""
+        return True;
+
+    def log(self, iLevel, sText, sCaller, sTsPrf):
+        if iLevel <= self.iVerbose:
+            # format it.
+            if self.iDebug > 0:
+                sLogText = '%s %30s: %s' % (sTsPrf, sCaller, sText);
+            else:
+                sLogText = '%s %s' % (sTsPrf, sText);
+
+            # output it.
+            sAscii = sLogText.encode('ascii', 'replace');
+            if self.iDebug == 0:
+                print >> self.oStdErr, '%s: %s' % (self.sName, sAscii)
+            else:
+                print >> self.oStdErr, '%s' % (sAscii)
+            sLogText += '\n';
+            try:
+                self.oLogFile.write(sLogText.encode('utf-8'));
+            except:
+                pass;
+        return 0;
+
+    def addLogFile(self, oSrcFile, sSrcFilename, sAltName, sDescription, sKind, sCaller, sTsPrf):
+        # Figure the destination filename.
+        iOtherFile = self.iOtherFile;
+        self.iOtherFile += 1;
+        sDstFilename = os.path.join(self.sLogDir, 'other-%d-%s.log' \
+                                    % (iOtherFile, os.path.splitext(os.path.basename(sSrcFilename))[0]));
+        self.log(0, 'Other log file: %s - %s (%s)' % (sDstFilename, sDescription, sSrcFilename), sCaller, sTsPrf);
+
+        # Open the destination file and copy over the data.
+        fRc = True;
+        try:
+            oDstFile = utils.openNoInherit(sDstFilename, 'w');
+        except Exception, oXcpt:
+            self.log(0, 'error opening %s: %s' % (sDstFilename, oXcpt), sCaller, sTsPrf);
+        else:
+            while True:
+                try:
+                    abBuf = oSrcFile.read(65536);
+                except Exception, oXcpt:
+                    fRc = False;
+                    self.log(0, 'error reading %s: %s' % (sSrcFilename, oXcpt), sCaller, sTsPrf);
+                else:
+                    try:
+                        oDstFile.write(abBuf);
+                    except Exception, oXcpt:
+                        fRc = False;
+                        self.log(0, 'error writing %s: %s' % (sDstFilename, oXcpt), sCaller, sTsPrf);
+                    else:
+                        if len(abBuf) > 0:
+                            continue;
+                break;
+            oDstFile.close();
+
+            # Leave a mark in the XML log.
+            self._xmlWrite('<LogFile timestamp="%s" filename="%s" source="%s" kind="%s" ok="%s">%s</LogFile>\n'
+                % (utils.getIsoTimestamp(), self._xmlEscAttr(os.path.basename(sDstFilename)), self._xmlEscAttr(sSrcFilename), \
+                   self._xmlEscAttr(sKind), fRc, self._xmlEscAttr(sDescription)) );
+        _ = sAltName;
+        return fRc;
+
+    def subXmlStart(self, oFileWrapper):
+        # Open a new file and just include it from the main XML.
+        iSubXml = self.iSubXml;
+        self.iSubXml += 1;
+        sSubXmlName = os.path.join(self.sLogDir, 'sub-%d.xml' % (iSubXml,));
+        try:
+            oFileWrapper.oSubXmlFile = utils.openNoInherit(sSubXmlName, "w");
+        except:
+            errorXcpt('open(%s)' % oFileWrapper.oSubXmlName);
+            oFileWrapper.oSubXmlFile = None;
+        else:
+            self._xmlWrite('<Include timestamp="%s" filename="%s"/>\n'
+                    % (utils.getIsoTimestamp(), self._xmlEscAttr(os.path.basename(sSubXmlName))));
+        return None;
+
+    def subXmlWrite(self, oFileWrapper, sRawXml, sCaller):
+        if oFileWrapper.oSubXmlFile is not None:
+            try:
+                oFileWrapper.oSubXmlFile.write(sRawXml);
+            except:
+                pass;
+        if sCaller is None: pass; # pychecker - NOREF
+        return None;
+
+    def subXmlEnd(self, oFileWrapper):
+        if oFileWrapper.oSubXmlFile is not None:
+            try:
+                oFileWrapper.oSubXmlFile.close();
+                oFileWrapper.oSubXmlFile = None;
+            except:
+                pass;
+        return None;
+
+
+
+class RemoteReporter(ReporterBase):
+    """
+    Reporter that talks to the test manager server.
+    """
+
+
+    ## The XML sync min time (seconds).
+    kcSecXmlFlushMin    = 30;
+    ## The XML sync max time (seconds).
+    kcSecXmlFlushMax    = 120;
+    ## The XML sync idle time before flushing (seconds).
+    kcSecXmlFlushIdle   = 5;
+    ## The XML sync line count threshold.
+    kcLinesXmlFlush     = 512;
+
+    ## The retry timeout.
+    kcSecTestManagerRetryTimeout    = 120;
+    ## The request timeout.
+    kcSecTestManagerRequestTimeout  = 30;
+
+
+    def __init__(self):
+        ReporterBase.__init__(self);
+        self.sTestManagerUrl    = os.environ.get('TESTBOX_MANAGER_URL');
+        self.sTestBoxUuid       = os.environ.get('TESTBOX_UUID');
+        self.idTestBox          = int(os.environ.get('TESTBOX_ID'));
+        self.idTestSet          = int(os.environ.get('TESTBOX_TEST_SET_ID'));
+        self._asXml             = [];
+        self._secTsXmlFlush     = utils.timestampSecond();
+        self._secTsXmlLast      = self._secTsXmlFlush;
+        self._fXmlFlushing      = False;
+        self.oOutput            = sys.stdout; # Hack for __del__ output.
+        self.fFlushEachLine     = True;
+        self.fDebugXml          = 'TESTDRIVER_REPORTER_DEBUG_XML' in os.environ;
+
+        # Prepare the TM connecting.
+        import urlparse;
+        import httplib;
+        import urllib;
+        from common import constants;
+
+        self._fnUrlEncode       = urllib.urlencode;
+        self._fnUrlParseQs      = urlparse.parse_qs;
+        self._oParsedTmUrl      = urlparse.urlparse(self.sTestManagerUrl);
+
+        if     sys.version_info[0] >= 3 \
+           or (sys.version_info[0] == 2 and sys.version_info[1] >= 6):
+            if self._oParsedTmUrl.scheme == 'https': # pylint: disable=E1101
+                self._fnTmConnect = lambda: httplib.HTTPSConnection(self._oParsedTmUrl.hostname,
+                                                                    timeout = self.kcSecTestManagerRequestTimeout);
+            else:
+                self._fnTmConnect = lambda: httplib.HTTPConnection( self._oParsedTmUrl.hostname,
+                                                                    timeout = self.kcSecTestManagerRequestTimeout);
+        else:
+            if self._oParsedTmUrl.scheme == 'https': # pylint: disable=E1101
+                self._fnTmConnect = lambda: httplib.HTTPSConnection(self._oParsedTmUrl.hostname);
+            else:
+                self._fnTmConnect = lambda: httplib.HTTPConnection( self._oParsedTmUrl.hostname);
+        self._dHttpHeader = \
+        {
+            'Content-Type':     'application/x-www-form-urlencoded; charset=utf-8',
+            'User-Agent':       'TestDriverReporter/%s.0 (%s, %s)' % (__version__, utils.getHostOs(), utils.getHostArch(),),
+            'Accept':           'text/plain,application/x-www-form-urlencoded',
+            'Accept-Encoding':  'identity',
+            'Cache-Control':    'max-age=0',
+            #'Connection':       'keep-alive',
+        };
+
+        dParams = {
+            constants.tbreq.ALL_PARAM_TESTBOX_UUID:     self.sTestBoxUuid,
+            constants.tbreq.ALL_PARAM_TESTBOX_ID:       self.idTestBox,
+            constants.tbreq.RESULT_PARAM_TEST_SET_ID:   self.idTestSet,
+        };
+        self._sTmServerPath = '/%s/testboxdisp.py?%s' \
+                            % ( self._oParsedTmUrl.path.strip('/'), # pylint: disable=E1101
+                                urllib.urlencode(dParams), );
+
+    def __del__(self):
+        """Flush pending log messages?"""
+        if len(self._asXml) > 0:
+            self._xmlDoFlush(self._asXml, fRetry = True, fDtor = True);
+
+    def _writeOutput(self, sText):
+        """ Does the actual writing and flushing. """
+        print >> self.oOutput, sText.encode('ascii', 'replace');
+        if self.fFlushEachLine: self.oOutput.flush();
+        return None;
+
+    #
+    # Talking to TM.
+    #
+
+    def _processTmStatusResponse(self, oConn, sOperation, fClose = True):
+        """
+        Processes HTTP reponse from the test manager.
+        Returns True, False or None.  None should be retried, the others not.
+        May raise exception on HTTP issue (retry ok).
+        """
+        import httplib;
+        from common import constants;
+
+        # Read the response and (optionally) close the connection.
+        oResponse = oConn.getresponse();
+        try:
+            sRspBody  = oResponse.read();
+        except httplib.IncompleteRead, oXcpt:
+            self._writeOutput('%s: %s: Warning: httplib.IncompleteRead: %s [expected %s, got %s]'
+                              % (utils.getTimePrefix(), sOperation, oXcpt, oXcpt.expected, len(oXcpt.partial),));
+            sRspBody = oXcpt.partial;
+        if fClose is True:
+            try:    oConn.close();
+            except: pass;
+
+        # Check the content type.
+        sContentType = oResponse.getheader('Content-Type');
+        if sContentType is not None  and  sContentType == 'application/x-www-form-urlencoded; charset=utf-8':
+
+            # Parse the body and check the RESULT parameter.
+            dResponse = self._fnUrlParseQs(sRspBody, strict_parsing = True);
+            sResult   = dResponse.get(constants.tbresp.ALL_PARAM_RESULT, None);
+            if isinstance(sResult, list):
+                sResult = sResult[0] if len(sResult) == 1 else '%d results' % (len(sResult),);
+
+            if sResult is not None:
+                if sResult == constants.tbresp.STATUS_ACK:
+                    return True;
+                if sResult == constants.tbresp.STATUS_NACK:
+                    self._writeOutput('%s: %s: Failed (%s). (dResponse=%s)'
+                                      % (utils.getTimePrefix(), sOperation, sResult, dResponse,));
+                return False;
+
+            self._writeOutput('%s: %s: Failed - dResponse=%s' % (utils.getTimePrefix(), sOperation, dResponse,));
+        else:
+            self._writeOutput('%s: %s: Unexpected Content-Type: %s' % (utils.getTimePrefix(), sOperation, sContentType,));
+            self._writeOutput('%s: %s: Body: %s' % (utils.getTimePrefix(), sOperation, sRspBody,));
+        return None;
+
+    def _doUploadFile(self, oSrcFile, sSrcFilename, sDescription, sKind, sMime):
+        """ Uploads the given file to the test manager. """
+
+        # Prepare header and url.
+        dHeader = dict(self._dHttpHeader);
+        dHeader['Content-Type'] = 'application/octet-stream';
+        self._writeOutput('%s: _doUploadFile: sHeader=%s' % (utils.getTimePrefix(), dHeader,));
+        oSrcFile.seek(0, 2);
+        self._writeOutput('%s: _doUploadFile: size=%d' % (utils.getTimePrefix(), oSrcFile.tell(),));
+        oSrcFile.seek(0);
+
+        from common import constants;
+        sUrl = self._sTmServerPath + '&' \
+             + self._fnUrlEncode({ constants.tbreq.UPLOAD_PARAM_NAME: os.path.basename(sSrcFilename),
+                                   constants.tbreq.UPLOAD_PARAM_DESC: sDescription,
+                                   constants.tbreq.UPLOAD_PARAM_KIND: sKind,
+                                   constants.tbreq.UPLOAD_PARAM_MIME: sMime,
+                                   constants.tbreq.ALL_PARAM_ACTION:  constants.tbreq.UPLOAD,
+                                });
+
+        # Retry loop.
+        secStart = utils.timestampSecond();
+        while True:
+            try:
+                oConn = self._fnTmConnect();
+                oConn.request('POST', sUrl, oSrcFile.read(), dHeader);
+                fRc = self._processTmStatusResponse(oConn, '_doUploadFile', fClose = True);
+                oConn.close();
+                if fRc is not None:
+                    return fRc;
+            except:
+                logXcpt('warning: exception during UPLOAD request');
+
+            if utils.timestampSecond() - secStart >= self.kcSecTestManagerRetryTimeout:
+                self._writeOutput('%s: _doUploadFile: Timed out.' % (utils.getTimePrefix(),));
+                break;
+            try: oSrcFile.seek(0);
+            except:
+                logXcpt();
+                break;
+            self._writeOutput('%s: _doUploadFile: Retrying...' % (utils.getTimePrefix(), ));
+            time.sleep(2);
+
+        return False;
+
+    def _xmlDoFlush(self, asXml, fRetry = False, fDtor = False):
+        """
+        The code that does the actual talking to the server.
+        Used by both xmlFlush and __del__.
+        """
+        secStart = utils.timestampSecond();
+        while True:
+            fRc = None;
+            try:
+                # Post.
+                from common import constants;
+                sPostBody = self._fnUrlEncode({constants.tbreq.XML_RESULT_PARAM_BODY: '\n'.join(asXml),});
+                oConn = self._fnTmConnect();
+                oConn.request('POST',
+                              self._sTmServerPath + ('&%s=%s' % (constants.tbreq.ALL_PARAM_ACTION, constants.tbreq.XML_RESULTS)),
+                              sPostBody,
+                              self._dHttpHeader);
+
+                fRc = self._processTmStatusResponse(oConn, '_xmlDoFlush', fClose = True);
+                if fRc is True:
+                    if self.fDebugXml:
+                        self._writeOutput('_xmlDoFlush:\n%s' % ('\n'.join(asXml),));
+                    return (None, False);
+                if fRc is False:
+                    self._writeOutput('_xmlDoFlush: Failed - we should abort the test, really.');
+                    return (None, True);
+            except Exception, oXcpt:
+                if not fDtor:
+                    logXcpt('warning: exception during XML_RESULTS request');
+                else:
+                    self._writeOutput('warning: exception during XML_RESULTS request: %s' % (oXcpt,));
+
+            if   fRetry is not True \
+              or utils.timestampSecond() - secStart >= self.kcSecTestManagerRetryTimeout:
+                break;
+            time.sleep(2);
+
+        return (asXml, False);
+
+
+    #
+    # Overridden methods.
+    #
+
+    def isLocal(self):
+        return False;
+
+    def log(self, iLevel, sText, sCaller, sTsPrf):
+        if iLevel <= self.iVerbose:
+            if self.iDebug > 0:
+                sLogText = '%s %30s: %s' % (sTsPrf, sCaller, sText);
+            else:
+                sLogText = '%s %s: %s' % (sTsPrf, self.sName, sText);
+            self._writeOutput(sLogText);
+        return 0;
+
+    def addLogFile(self, oSrcFile, sSrcFilename, sAltName, sDescription, sKind, sCaller, sTsPrf):
+        fRc = True;
+        if sKind in [ 'text', 'log', ]  or  sKind.startswith('log/'):
+            self.log(0, '*** Uploading "%s" - KIND: "%s" - DESC: "%s" ***'
+                        % (sSrcFilename, sKind, sDescription),  sCaller, sTsPrf);
+            g_oLock.release();
+            self._doUploadFile(oSrcFile, sAltName, sDescription, sKind, 'text/plain');
+            g_oLock.acquire();
+        elif sKind.startswith('screenshot/'):
+            self.log(0, '*** Uploading "%s" - KIND: "%s" - DESC: "%s" ***'
+                        % (sSrcFilename, sKind, sDescription),  sCaller, sTsPrf);
+            g_oLock.release();
+            self._doUploadFile(oSrcFile, sAltName, sDescription, sKind, 'image/png');
+            g_oLock.acquire();
+        else:
+            self.log(0, '*** UNKNOWN FILE "%s" - KIND "%s" - DESC "%s" ***'
+                     % (sSrcFilename, sKind, sDescription),  sCaller, sTsPrf);
+        return fRc;
+
+    def xmlFlush(self, fRetry = False, fForce = False):
+        """
+        Flushes the XML back log. Called with the lock held, may leave it
+        while communicating with the server.
+        """
+        if not self._fXmlFlushing:
+            asXml = self._asXml;
+            self._asXml = [];
+            if len(asXml) > 0  or  fForce is True:
+                self._fXmlFlushing = True;
+
+                g_oLock.release();
+                (asXml, fIncErrors) = self._xmlDoFlush(asXml, fRetry = fRetry);
+                g_oLock.acquire();
+
+                if fIncErrors:
+                    self.testIncErrors();
+
+                self._fXmlFlushing = False;
+                if asXml is None:
+                    self._secTsXmlFlush = utils.timestampSecond();
+                else:
+                    self._asXml = asXml + self._asXml;
+                return True;
+
+            self._secTsXmlFlush = utils.timestampSecond();
+        return False;
+
+    def _xmlFlushIfNecessary(self):
+        """Flushes the XML back log if necessary."""
+        tsNow = utils.timestampSecond();
+        cSecs     = tsNow - self._secTsXmlFlush;
+        cSecsLast = tsNow - self._secTsXmlLast;
+        self._secTsXmlLast = tsNow;
+
+        # Absolute flush thresholds.
+        if cSecs >= self.kcSecXmlFlushMax:
+            return self.xmlFlush();
+        if len(self._asXml) >= self.kcLinesXmlFlush:
+            return self.xmlFlush();
+
+        # Flush if idle long enough.
+        if    cSecs     >= self.kcSecXmlFlushMin \
+          and cSecsLast >= self.kcSecXmlFlushIdle:
+            return self.xmlFlush();
+
+        return False;
+
+    def _xmlWrite(self, asText, fIndent = True):
+        """XML output function for the reporter."""
+        self._asXml += asText;
+        self._xmlFlushIfNecessary();
+        _ = fIndent; # No pretty printing, thank you.
+        return None;
+
+    def subXmlStart(self, oFileWrapper):
+        oFileWrapper.sXmlBuffer = '';
+        return None;
+
+    def subXmlWrite(self, oFileWrapper, sRawXml, sCaller):
+        oFileWrapper.sXmlBuffer += sRawXml;
+        _ = sCaller;
+        return None;
+
+    def subXmlEnd(self, oFileWrapper):
+        sRawXml = oFileWrapper.sXmlBuffer;
+        ## @todo should validate the document here and maybe auto terminate things.  Adding some hints to have the server do
+        # this instead.
+        g_oLock.acquire();
+        self._asXml += [ '<PushHint testdepth="%d"/>' % (len(self.atTests),),
+                         sRawXml,
+                         '<PopHint  testdepth="%d"/>' % (len(self.atTests),),];
+        self._xmlFlushIfNecessary();
+        g_oLock.release();
+        return None;
+
+
+#
+# Helpers
+#
+
+def logXcptWorker(iLevel, fIncErrors, sPrefix="", sText=None, cFrames=1):
+    """
+    Log an exception, optionally with a preceeding message and more than one
+    call frame.
+    """
+    g_oLock.acquire();
+    if fIncErrors:
+        g_oReporter.testIncErrors();
+
+    ## @todo skip all this if iLevel is too high!
+
+    # Try get exception info.
+    sTsPrf = utils.getTimePrefix();
+    try:
+        oType, oValue, oTraceback = sys.exc_info();
+    except:
+        oType = oValue = oTraceback = None;
+    if oType is not None:
+
+        # Try format the info
+        try:
+            rc      = 0;
+            sCaller = utils.getCallerName(oTraceback.tb_frame);
+            if sText is not None:
+                rc = g_oReporter.log(iLevel, "%s%s" % (sPrefix, sText), sCaller, sTsPrf);
+            asInfo = [];
+            try:
+                asInfo = asInfo + traceback.format_exception_only(oType, oValue);
+                if cFrames is not None and cFrames <= 1:
+                    asInfo = asInfo + traceback.format_tb(oTraceback, 1);
+                else:
+                    asInfo.append('Traceback:')
+                    asInfo = asInfo + traceback.format_tb(oTraceback, cFrames);
+                    asInfo.append('Stack:')
+                    asInfo = asInfo + traceback.format_stack(oTraceback.tb_frame.f_back, cFrames);
+            except:
+                g_oReporter.log(0, 'internal-error: Hit exception #2! %s' % (traceback.format_exc()), sCaller, sTsPrf);
+
+            if len(asInfo) > 0:
+                # Do the logging.
+                for sItem in asInfo:
+                    asLines = sItem.splitlines();
+                    for sLine in asLines:
+                        rc = g_oReporter.log(iLevel, '%s%s' % (sPrefix, sLine), sCaller, sTsPrf);
+
+            else:
+                g_oReporter.log(iLevel, 'No exception info...', sCaller, sTsPrf);
+                rc = -3;
+        except:
+            g_oReporter.log(0, 'internal-error: Hit exception! %s' % (traceback.format_exc()), None, sTsPrf);
+            rc = -2;
+    else:
+        g_oReporter.log(0, 'internal-error: No exception! %s'
+                      % (utils.getCallerName(iFrame=3)), utils.getCallerName(iFrame=3), sTsPrf);
+        rc = -1;
+
+    g_oLock.release();
+    return rc;
+
+#
+# The public Classes
+#
+class FileWrapper(object):
+    """ File like class for TXS EXEC and similar. """
+    def __init__(self, sPrefix):
+        self.sPrefix = sPrefix;
+
+    def read(self, cb):
+        """file.read"""
+        _ = cb;
+        return "";
+
+    def write(self, sText):
+        """file.write"""
+        if isinstance(sText, array.array):
+            try:
+                sText = sText.tostring();
+            except:
+                pass;
+        g_oLock.acquire();
+        try:
+            sTsPrf  = utils.getTimePrefix();
+            sCaller = utils.getCallerName();
+            asLines = sText.splitlines();
+            for sLine in asLines:
+                g_oReporter.log(0, '%s: %s' % (self.sPrefix, sLine), sCaller, sTsPrf);
+        except:
+            traceback.print_exc();
+        g_oLock.release();
+        return None;
+
+class FileWrapperTestPipe(object):
+    """ File like class for the test pipe (TXS EXEC and similar). """
+    def __init__(self):
+        self.sPrefix  = '';
+        self.fStarted = False;
+        self.fClosed  = False;
+
+    def __del__(self):
+        self.close();
+
+    def close(self):
+        """ file.close """
+        if self.fStarted is True and self.fClosed is False:
+            self.fClosed = True;
+            try:    g_oReporter.subXmlEnd(self);
+            except:
+                try:    traceback.print_exc();
+                except: pass;
+        return True;
+
+    def read(self, cb = None):
+        """file.read"""
+        _ = cb;
+        return "";
+
+    def write(self, sText):
+        """file.write"""
+        # lazy start.
+        if self.fStarted is not True:
+            try:
+                g_oReporter.subXmlStart(self);
+            except:
+                traceback.print_exc();
+            self.fStarted = True;
+
+        if isinstance(sText, array.array):
+            try:
+                sText = sText.tostring();
+            except:
+                pass;
+        try:
+            g_oReporter.subXmlWrite(self, sText, utils.getCallerName());
+        except:
+            traceback.print_exc();
+        return None;
+
+
+#
+# The public APIs.
+#
+
+def log(sText):
+    """Writes the specfied text to the log."""
+    g_oLock.acquire();
+    try:
+        rc = g_oReporter.log(1, sText, utils.getCallerName(), utils.getTimePrefix());
+    except:
+        rc = -1;
+    g_oLock.release();
+    return rc;
+
+def logXcpt(sText=None, cFrames=1):
+    """
+    Log an exception, optionally with a preceeding message and more than one
+    call frame.
+    """
+    return logXcptWorker(1, False, "", sText, cFrames);
+
+def log2(sText):
+    """Log level 2: Writes the specfied text to the log."""
+    g_oLock.acquire();
+    try:
+        rc = g_oReporter.log(2, sText, utils.getCallerName(), utils.getTimePrefix());
+    except:
+        rc = -1;
+    g_oLock.release();
+    return rc;
+
+def log2Xcpt(sText=None, cFrames=1):
+    """
+    Log level 2: Log an exception, optionally with a preceeding message and
+    more than one call frame.
+    """
+    return logXcptWorker(2, False, "", sText, cFrames);
+
+def maybeErr(fIsError, sText):
+    """ Maybe error or maybe normal log entry. """
+    if fIsError is True:
+        return error(sText);
+    return log(sText);
+
+def maybeErrXcpt(fIsError, sText=None, cFrames=1):
+    """ Maybe error or maybe normal log exception entry. """
+    if fIsError is True:
+        return errorXcpt(sText, cFrames);
+    return logXcpt(sText, cFrames);
+
+def maybeLog(fIsNotError, sText):
+    """ Maybe error or maybe normal log entry. """
+    if fIsNotError is not True:
+        return error(sText);
+    return log(sText);
+
+def maybeLogXcpt(fIsNotError, sText=None, cFrames=1):
+    """ Maybe error or maybe normal log exception entry. """
+    if fIsNotError is not True:
+        return errorXcpt(sText, cFrames);
+    return logXcpt(sText, cFrames);
+
+def error(sText):
+    """
+    Writes the specfied error message to the log.
+
+    This will add an error to the current test.
+
+    Always returns False for the convenience of methods returning boolean
+    success indicators.
+    """
+    g_oLock.acquire();
+    g_oReporter.testIncErrors();
+    try:
+        g_oReporter.log(0, 'error: %s' % (sText), utils.getCallerName(), utils.getTimePrefix());
+    except:
+        pass;
+    g_oLock.release();
+    return False;
+
+def errorXcpt(sText=None, cFrames=1):
+    """
+    Log an error caused by an exception.  If sText is given, it will preceed
+    the exception information.  cFrames can be used to display more stack.
+
+    This will add an error to the current test.
+
+    Always returns False for the convenience of methods returning boolean
+    success indicators.
+    """
+    logXcptWorker(0, True, "error: ", sText, cFrames);
+    return False;
+
+def errorTimeout(sText):
+    """
+    Flags the current test as having timed out and writes the specified message to the log.
+
+    This will add an error to the current test.
+
+    Always returns False for the convenience of methods returning boolean
+    success indicators.
+    """
+    g_oLock.acquire();
+    g_oReporter.testSetTimedOut();
+    try:
+        g_oReporter.log(0, 'timeout-error: %s' % (sText), utils.getCallerName(), utils.getTimePrefix());
+    except:
+        pass;
+    g_oLock.release();
+    return False;
+
+def fatal(sText):
+    """
+    Writes a fatal error to the log.
+
+    This will add an error to the current test.
+
+    Always returns False for the convenience of methods returning boolean
+    success indicators.
+    """
+    g_oLock.acquire();
+    g_oReporter.testIncErrors();
+    try:
+        g_oReporter.log(0, 'fatal error: %s' % (sText), utils.getCallerName(), utils.getTimePrefix());
+    except:
+        pass
+    g_oLock.release();
+    return False;
+
+def fatalXcpt(sText=None, cFrames=1):
+    """
+    Log a fatal error caused by an exception.  If sText is given, it will
+    preceed the exception information.  cFrames can be used to display more
+    stack.
+
+    This will add an error to the current test.
+
+    Always returns False for the convenience of methods returning boolean
+    success indicators.
+    """
+    logXcptWorker(1, True, "fatal error: ", sText, cFrames);
+    return False;
+
+def addLogFile(sFilename, sKind, sDescription = '', sAltName = None):
+    """
+    Adds the specified log file to the report if the file exists.
+
+    The sDescription is a free form description of the log file.
+
+    The sKind parameter is for adding some machine parsable hint what kind of
+    log file this really is.
+
+    Returns True on success, False on failure (no ENOENT errors are logged).
+    """
+    sTsPrf  = utils.getTimePrefix();
+    sCaller = utils.getCallerName();
+    fRc     = False;
+    if sAltName is None:
+        sAltName = sFilename;
+
+    try:
+        oSrcFile = utils.openNoInherit(sFilename, 'rb');
+    except IOError, oXcpt:
+        if oXcpt.errno != errno.ENOENT:
+            logXcpt('addLogFile(%s,%s,%s)' % (sFilename, sDescription, sKind));
+        else:
+            logXcpt('addLogFile(%s,%s,%s) IOError' % (sFilename, sDescription, sKind));
+    except:
+        logXcpt('addLogFile(%s,%s,%s)' % (sFilename, sDescription, sKind));
+    else:
+        g_oLock.acquire();
+        fRc = g_oReporter.addLogFile(oSrcFile, sFilename, sAltName, sDescription, sKind, sCaller, sTsPrf);
+        g_oLock.release();
+        oSrcFile.close();
+    return fRc;
+
+def isLocal():
+    """Is this a local reporter?"""
+    return g_oReporter.isLocal()
+
+def incVerbosity():
+    """Increases the verbosity level."""
+    return g_oReporter.incVerbosity()
+
+def incDebug():
+    """Increases the debug level."""
+    return g_oReporter.incDebug()
+
+def getErrorCount():
+    """
+    Get the current error count for the entire test run.
+    """
+    g_oLock.acquire();
+    cErrors = g_oReporter.cErrors;
+    g_oLock.release();
+    return cErrors;
+
+
+#
+# Test reporting, a bit similar to RTTestI*.
+#
+
+def testStart(sName):
+    """
+    Starts a new test (pushes it).
+    """
+    g_oLock.acquire();
+    rc = g_oReporter.testStart(sName, utils.getCallerName());
+    g_oLock.release();
+    return rc;
+
+def testValue(sName, sValue, sUnit):
+    """
+    Reports a benchmark value or something simiarlly useful.
+    """
+    g_oLock.acquire();
+    rc = g_oReporter.testValue(sName, str(sValue), sUnit, utils.getCallerName());
+    g_oLock.release();
+    return rc;
+
+def testFailure(sDetails):
+    """
+    Reports a failure.
+    We count these calls and testDone will use them to report PASSED or FAILED.
+
+    Returns False so that a return False line can be saved.
+    """
+    g_oLock.acquire();
+    g_oReporter.testFailure(sDetails, utils.getCallerName());
+    g_oLock.release();
+    return False;
+
+def testFailureXcpt(sDetails = ''):
+    """
+    Reports a failure with exception.
+    We count these calls and testDone will use them to report PASSED or FAILED.
+
+    Returns False so that a return False line can be saved.
+    """
+    # Extract exception info.
+    try:
+        oType, oValue, oTraceback  = sys.exc_info();
+    except:
+        oType = oValue, oTraceback = None;
+    if oType is not None:
+        sCaller = utils.getCallerName(oTraceback.tb_frame);
+        sXcpt   = ' '.join(traceback.format_exception_only(oType, oValue));
+    else:
+        sCaller = utils.getCallerName();
+        sXcpt   = 'No exception at %s' % (sCaller,);
+
+    # Use testFailure to do the work.
+    g_oLock.acquire();
+    if sDetails == '':
+        g_oReporter.testFailure('Exception: %s' % (sXcpt,), sCaller);
+    else:
+        g_oReporter.testFailure('%s: %s' % (sDetails, sXcpt), sCaller);
+    g_oLock.release();
+    return False;
+
+def testDone(fSkipped = False):
+    """
+    Completes the current test (pops it), logging PASSED / FAILURE.
+
+    Returns a tuple with the name of the test and its error count.
+    """
+    g_oLock.acquire();
+    rc = g_oReporter.testDone(fSkipped, utils.getCallerName());
+    g_oLock.release();
+    return rc;
+
+def testErrorCount():
+    """
+    Gets the error count of the current test.
+
+    Returns the number of errors.
+    """
+    g_oLock.acquire();
+    cErrors = g_oReporter.testErrorCount();
+    g_oLock.release();
+    return cErrors;
+
+def testCleanup():
+    """
+    Closes all open tests with a generic error condition.
+
+    Returns True if no open tests, False if something had to be closed with failure.
+    """
+    g_oLock.acquire();
+    fRc = g_oReporter.testCleanup(utils.getCallerName());
+    g_oReporter.xmlFlush(fRetry = False, fForce = True);
+    g_oLock.release();
+    return fRc;
+
+
+#
+# Sub XML stuff.
+#
+
+def addSubXmlFile(sFilename):
+    """
+    Adds a sub-xml result file to the party.
+    """
+    fRc = False;
+    try:
+        oSrcFile = utils.openNoInherit(sFilename, 'r');
+    except IOError, oXcpt:
+        if oXcpt.errno != errno.ENOENT:
+            logXcpt('addSubXmlFile(%s)' % (sFilename,));
+    except:
+        logXcpt('addSubXmlFile(%s)' % (sFilename,));
+    else:
+        try:
+            oWrapper = FileWrapperTestPipe()
+            oWrapper.write(oSrcFile.read());
+            oWrapper.close();
+        except:
+            logXcpt('addSubXmlFile(%s)' % (sFilename,));
+        oSrcFile.close();
+
+    return fRc;
+
+
+#
+# Other useful debugging tools.
+#
+
+def logAllStacks(cFrames = None):
+    """
+    Logs the stacks of all python threads.
+    """
+    sTsPrf  = utils.getTimePrefix();
+    sCaller = utils.getCallerName();
+    g_oLock.acquire();
+
+    cThread = 0;
+    for idThread, oStack in sys._current_frames().items(): # >=2.5, a bit ugly - pylint: disable=W0212
+        try:
+            if cThread > 0:
+                g_oReporter.log(1, '', sCaller, sTsPrf);
+            g_oReporter.log(1, 'Thread %s (%#x)' % (idThread, idThread), sCaller, sTsPrf);
+            try:
+                asInfo = traceback.format_stack(oStack, cFrames);
+            except:
+                g_oReporter.log(1, '  Stack formatting failed w/ exception', sCaller, sTsPrf);
+            else:
+                for sInfo in asInfo:
+                    asLines = sInfo.splitlines();
+                    for sLine in asLines:
+                        g_oReporter.log(1, sLine, sCaller, sTsPrf);
+        except:
+            pass;
+        cThread += 1;
+
+    g_oLock.release();
+    return None;
+
+def checkTestManagerConnection():
+    """
+    Checks the connection to the test manager.
+
+    Returns True if the connection is fine, False if not, None if not remote
+    reporter.
+
+    Note! This as the sideeffect of flushing XML.
+    """
+    g_oLock.acquire();
+    fRc = g_oReporter.xmlFlush(fRetry = False, fForce = True);
+    g_oLock.release();
+    return fRc;
+
+def flushall():
+    """
+    Flushes all output streams, both standard and logger related.
+    """
+    try:    sys.stdout.flush();
+    except: pass;
+    try:    sys.stderr.flush();
+    except: pass;
+
+    # Note! Current no logger specific streams to flush.
+
+    return True;
+
+
+#
+# Module initialization.
+#
+
+def _InitReporterModule():
+    """
+    Instantiate the test reporter.
+    """
+    global g_oReporter, g_sReporterName
+
+    g_sReporterName = os.getenv("TESTBOX_REPORTER", "local");
+    if g_sReporterName == "local":
+        g_oReporter = LocalReporter();
+    elif g_sReporterName == "remote":
+        g_oReporter = RemoteReporter();
+    else:
+        print >> sys.stderr, os.path.basename(__file__) + ": Unknown TESTBOX_REPORTER value: '" + g_sReporterName + "'";
+        raise Exception("Unknown TESTBOX_REPORTER value '" + g_sReporterName + "'");
+
+if __name__ != "checker": # pychecker avoidance.
+    _InitReporterModule();
+
diff --git a/src/VBox/ValidationKit/testdriver/tst-txsclient.py b/src/VBox/ValidationKit/testdriver/tst-txsclient.py
new file mode 100644
index 0000000..0b0e859
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/tst-txsclient.py
@@ -0,0 +1,287 @@
+# -*- coding: utf-8 -*-
+# $Id: tst-txsclient.py $
+
+"""
+Simple testcase for txsclient.py.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports.
+import os
+import sys
+import types
+
+# Validation Kit imports.
+sys.path.insert(0, '.');
+sys.path.insert(0, '..');
+import testdriver.txsclient as txsclient
+import testdriver.reporter as reporter
+from common import utils;
+
+g_cTests = 0;
+g_cFailures = 0
+
+def boolRes(rc, fExpect = True):
+    """Checks a boolean result."""
+    global g_cTests, g_cFailures;
+    g_cTests = g_cTests + 1;
+    if isinstance(rc, types.BooleanType):
+        if rc == fExpect:
+            return 'PASSED';
+    g_cFailures = g_cFailures + 1;
+    return 'FAILED';
+
+def stringRes(rc, sExpect):
+    """Checks a string result."""
+    global g_cTests, g_cFailures;
+    g_cTests = g_cTests + 1;
+    if isinstance(rc, basestring):
+        if rc == sExpect:
+            return 'PASSED';
+    g_cFailures = g_cFailures + 1;
+    return 'FAILED';
+
+def main(asArgs): # pylint: disable=C0111,R0914,R0915
+    cMsTimeout      = 30*1000;
+    sAddress        = 'localhost';
+    uPort           = None;
+    fReversedSetup  = False;
+    fReboot         = False;
+    fStdTests       = True;
+
+    i = 1;
+    while i < len(asArgs):
+        if asArgs[i] == '--hostname':
+            sAddress = asArgs[i + 1];
+            i = i + 2;
+        elif asArgs[i] == '--port':
+            uPort = int(asArgs[i + 1]);
+            i = i + 2;
+        elif asArgs[i] == '--reversed-setup':
+            fReversedSetup = True;
+            i = i + 1;
+        elif asArgs[i] == '--timeout':
+            cMsTimeout = long(asArgs[i + 1]);
+            i = i + 2;
+        elif asArgs[i] == '--reboot':
+            fReboot   = True;
+            fStdTests = False;
+            i = i + 1;
+        elif asArgs[i] == '--help':
+            print 'tst-txsclient.py [--hostname <addr|name>] [--port <num>] [--timeout <cMS>] [--reboot] [--reversed-setup]'
+            return 0;
+        else:
+            print 'Unknown argument: %s' % (asArgs[i]);
+            return 2;
+
+    if uPort is None:
+        oSession = txsclient.openTcpSession(cMsTimeout, sAddress, fReversedSetup = fReversedSetup);
+    else:
+        oSession = txsclient.openTcpSession(cMsTimeout, sAddress, uPort = uPort, fReversedSetup = fReversedSetup);
+    if oSession is None:
+        print 'openTcpSession failed';
+        return 1;
+
+    fDone = oSession.waitForTask(30*1000);
+    print 'connect: waitForTask -> %s, result %s' % (fDone, oSession.getResult());
+    if fDone is True and oSession.isSuccess():
+        if fStdTests:
+            # Get the UUID of the remote instance.
+            sUuid = oSession.syncUuid();
+            if sUuid is not False:
+                print '%s: UUID = %s' % (boolRes(True), sUuid);
+            else:
+                print '%s: UUID' % (boolRes(False),);
+
+            # Create and remove a directory on the scratch area.
+            rc = oSession.syncMkDir('${SCRATCH}/testdir1');
+            print '%s: MKDIR(${SCRATCH}/testdir1) -> %s' % (boolRes(rc), rc);
+
+            rc = oSession.syncIsDir('${SCRATCH}/testdir1');
+            print '%s: ISDIR(${SCRATCH}/testdir1) -> %s' % (boolRes(rc), rc);
+
+            rc = oSession.syncRmDir('${SCRATCH}/testdir1');
+            print '%s: RMDIR(${SCRATCH}/testdir1) -> %s' % (boolRes(rc), rc);
+
+            # Create a two-level subdir.
+            rc = oSession.syncMkDirPath('${SCRATCH}/testdir2/subdir1');
+            print '%s: MKDRPATH(${SCRATCH}/testdir2/subdir1) -> %s' % (boolRes(rc), rc);
+
+            rc = oSession.syncIsDir('${SCRATCH}/testdir2');
+            print '%s: ISDIR(${SCRATCH}/testdir2) -> %s' % (boolRes(rc), rc);
+            rc = oSession.syncIsDir('${SCRATCH}/testdir2/');
+            print '%s: ISDIR(${SCRATCH}/testdir2/) -> %s' % (boolRes(rc), rc);
+            rc = oSession.syncIsDir('${SCRATCH}/testdir2/subdir1');
+            print '%s: ISDIR(${SCRATCH}/testdir2/subdir1) -> %s' % (boolRes(rc), rc);
+
+            rc = oSession.syncRmTree('${SCRATCH}/testdir2');
+            print '%s: RMTREE(${SCRATCH}/testdir2) -> %s' % (boolRes(rc), rc);
+
+            # Check out a simple file.
+            rc = oSession.syncUploadString('howdy', '${SCRATCH}/howdyfile');
+            print '%s: PUT FILE(${SCRATCH}/howdyfile) -> %s' % (boolRes(rc), rc);
+
+            rc = oSession.syncUploadString('howdy-replaced', '${SCRATCH}/howdyfile');
+            print '%s: PUT FILE(${SCRATCH}/howdyfile) -> %s' % (boolRes(rc), rc);
+
+            rc = oSession.syncDownloadString('${SCRATCH}/howdyfile');
+            print '%s: GET FILE(${SCRATCH}/howdyfile) -> "%s" expected "howdy-replaced"' % (stringRes(rc, 'howdy-replaced'), rc);
+
+            rc = oSession.syncIsFile('${SCRATCH}/howdyfile');
+            print '%s: ISFILE(${SCRATCH}/howdyfile) -> %s' % (boolRes(rc), rc);
+            rc = oSession.syncIsDir('${SCRATCH}/howdyfile');
+            print '%s: ISDIR(${SCRATCH}/howdyfile) -> %s' % (boolRes(rc, False), rc);
+            rc = oSession.syncIsSymlink('${SCRATCH}/howdyfile');
+            print '%s: ISSYMLNK(${SCRATCH}/howdyfile) -> %s' % (boolRes(rc, False), rc);
+
+            rc = oSession.syncRmFile('${SCRATCH}/howdyfile');
+            print '%s: RMFILE(${SCRATCH}/howdyfile) -> %s' % (boolRes(rc), rc);
+
+            # Unicode filename (may or may not work, LANG/LC_TYPE dependent on some hosts).
+            rc = oSession.syncUploadString('howdy', u'${SCRATCH}/Schröder');
+            print (u'%s: PUT FILE(${SCRATCH}/Schröder) -> %s' % (boolRes(rc), rc)).encode('ascii', 'replace');
+
+            rc = oSession.syncIsFile(u'${SCRATCH}/Schröder');
+            print (u'%s: ISFILE(${SCRATCH}/Schröder) -> %s' % (boolRes(rc), rc)).encode('ascii', 'replace');
+
+            rc = oSession.syncRmFile(u'${SCRATCH}/Schröder');
+            print (u'%s: RMFILE(${SCRATCH}/Schröder) -> %s' % (boolRes(rc), rc)).encode('ascii', 'replace');
+
+            # Finally, some file uploading and downloading with unicode filenames.
+            strUpFile  = 'tst-txsclient-upload.bin';
+            strDwnFile = 'tst-txsclient-download.bin';
+            try:
+                abRandFile = os.urandom(257897);
+            except:
+                print 'INFO: no urandom... falling back on a simple string.'
+                abRandFile = 'asdflkjasdlfkjasdlfkjq023942relwjgkna9epr865u2nm345;hndafgoukhasre5kb2453km';
+                for i in range(1, 64):
+                    abRandFile += abRandFile;
+            try:
+                oLocalFile = utils.openNoInherit(strUpFile, 'w+b');
+                oLocalFile.write(abRandFile);
+                oLocalFile.close();
+                rc = True;
+            except:
+                rc = False;
+                print('%s: creating file (%s) to upload failed....' % (boolRes(rc), strUpFile));
+
+            if rc is True:
+                rc = oSession.syncUploadFile(strUpFile, '${SCRATCH}/tst-txsclient-uploaded.bin')
+                print('%s: PUT FILE(%s, ${SCRATCH}/tst-txsclient-uploaded.bin) -> %s' % (boolRes(rc), strUpFile, rc));
+
+                rc = oSession.syncDownloadFile('${SCRATCH}/tst-txsclient-uploaded.bin', strDwnFile)
+                print('%s: GET FILE(${SCRATCH}/tst-txsclient-uploaded.bin, tst-txsclient-downloaded.txt) -> %s'
+                      % (boolRes(rc), rc));
+
+                try:
+                    oLocalFile = utils.openNoInherit(strDwnFile, "rb");
+                    abDwnFile = oLocalFile.read();
+                    oLocalFile.close();
+                    if abRandFile == abDwnFile:
+                        print '%s: downloaded file matches the uploaded file' % (boolRes(True),);
+                    else:
+                        print '%s: downloaded file does not match the uploaded file' % (boolRes(False),);
+                        print 'abRandFile=%s' % (abRandFile,);
+                        print 'abDwnFile =%s' % (abRandFile,);
+                except:
+                    print '%s: reading downloaded file (%s) failed....' % (boolRes(False), strDwnFile);
+
+                rc = oSession.syncRmFile(u'${SCRATCH}/tst-txsclient-uploaded.bin');
+                print '%s: RMFILE(${SCRATCH}/tst-txsclient-uploaded.bin) -> %s' % (boolRes(rc), rc);
+
+            try:    os.remove(strUpFile);
+            except: pass;
+            try:    os.remove(strDwnFile);
+            except: pass;
+
+            # Execute some simple thing, if available.
+            # Intentionally skip this test if file is not available due to
+            # another inserted CD-ROM (e.g. not TestSuite.iso).
+            sProg = '${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}';
+            rc = oSession.syncIsFile(sProg, 30 * 1000, True);
+            if rc is True:
+                rc = oSession.syncExecEx(sProg, (sProg, '--help'));
+                print '%s: EXEC(%s ${SCRATCH}) -> %s' % (boolRes(rc), sProg, rc);
+
+                rc = oSession.syncExecEx(sProg, (sProg, 'there', 'is no such', 'parameter'), \
+                                         oStdOut='${SCRATCH}/stdout', \
+                                         oStdErr='${SCRATCH}/stderr');
+                print('%s: EXEC(%s there is not such parameter > ${SCRATCH}/stdout 2> ${SCRATCH}/stderr) -> %s'
+                      % (boolRes(rc, False), sProg, rc));
+
+                rc = oSession.syncDownloadString('${SCRATCH}/stdout');
+                print 'INFO:   GET FILE(${SCRATCH}/stdout) -> "%s"' % (rc);
+                rc = oSession.syncDownloadString('${SCRATCH}/stderr');
+                print 'INFO:   GET FILE(${SCRATCH}/stderr) -> "%s"' % (rc);
+
+                print 'TESTING: syncExec...'
+                rc = oSession.syncExec(sProg, (sProg, '--version'));
+                print '%s: EXEC(%s --version) -> %s' % (boolRes(rc), sProg, rc);
+
+                print 'TESTING: syncExec...'
+                rc = oSession.syncExec(sProg, (sProg, '--help'));
+                print '%s: EXEC(%s --help) -> %s' % (boolRes(rc), sProg, rc);
+
+                #print 'TESTING: syncExec sleep 30...'
+                #rc = oSession.syncExec('/usr/bin/sleep', ('/usr/bin/sleep', '30'));
+                #print '%s: EXEC(/bin/sleep 30) -> %s' % (boolRes(rc), rc);
+            else:
+                print 'SKIP:   Execution of %s skipped, does not exist on CD-ROM' % (sProg,);
+
+            # Execute a non-existing file on CD-ROM.
+            sProg = '${CDROM}/${OS/ARCH}/NonExisting${EXESUFF}';
+            rc = oSession.syncExecEx(sProg, (sProg,), oStdIn = '/dev/null', oStdOut = '/dev/null', \
+                                     oStdErr = '/dev/null', oTestPipe = '/dev/null', \
+                                     sAsUser = '', cMsTimeout = 3600000, fIgnoreErrors = True);
+            if rc is None:
+                rc = True;
+            else:
+                reporter.error('Unexpected value \"%s\" while executing non-existent file "%s"' % (rc, sProg));
+            print '%s: EXEC(%s ${SCRATCH}) -> %s' % (boolRes(rc), sProg, rc);
+
+            # Done
+            rc = oSession.syncDisconnect();
+            print '%s: disconnect() -> %s' % (boolRes(rc), rc);
+
+        elif fReboot:
+            print 'TESTING: syncReboot...'
+            rc = oSession.syncReboot();
+            print '%s: REBOOT() -> %s' % (boolRes(rc), rc);
+
+    if g_cFailures != 0:
+        print 'tst-txsclient.py: %u out of %u test failed' % (g_cFailures, g_cTests);
+        return 1;
+    print 'tst-txsclient.py: all %u tests passed!' % (g_cTests);
+    return 0;
+
+
+if __name__ == '__main__':
+    reporter.incVerbosity();
+    reporter.incVerbosity();
+    reporter.incVerbosity();
+    reporter.incVerbosity();
+    sys.exit(main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/testdriver/txsclient.py b/src/VBox/ValidationKit/testdriver/txsclient.py
new file mode 100644
index 0000000..8222fd2
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/txsclient.py
@@ -0,0 +1,2113 @@
+# -*- coding: utf-8 -*-
+# $Id: txsclient.py $
+# pylint: disable=C0302
+
+"""
+Test eXecution Service Client.
+"""
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard Python imports.
+import array
+import errno
+import os
+import select
+import socket
+import threading
+import time
+import types
+import zlib
+import uuid
+
+# Validation Kit imports.
+from common     import utils;
+from testdriver import base;
+from testdriver import reporter;
+from testdriver.base    import TdTaskBase;
+
+#
+# Helpers for decoding data received from the TXS.
+# These are used both the Session and Transport classes.
+#
+
+def getU32(abData, off):
+    """Get a U32 field."""
+    return abData[off] \
+         + abData[off + 1] * 256 \
+         + abData[off + 2] * 65536 \
+         + abData[off + 3] * 16777216;
+
+def getSZ(abData, off, sDefault = None):
+    """
+    Get a zero-terminated string field.
+    Returns sDefault if the string is invalid.
+    """
+    cchStr = getSZLen(abData, off);
+    if cchStr >= 0:
+        abStr = abData[off:(off + cchStr)];
+        try:
+            return abStr.tostring().decode('utf_8');
+        except:
+            reporter.errorXcpt('getSZ(,%u)' % (off));
+    return sDefault;
+
+def getSZLen(abData, off):
+    """
+    Get the length of a zero-terminated string field, in bytes.
+    Returns -1 if off is beyond the data packet or not properly terminated.
+    """
+    cbData = len(abData);
+    if off >= cbData:
+        return -1;
+
+    offCur = off;
+    while abData[offCur] != 0:
+        offCur = offCur + 1;
+        if offCur >= cbData:
+            return -1;
+
+    return offCur - off;
+
+def isValidOpcodeEncoding(sOpcode):
+    """
+    Checks if the specified opcode is valid or not.
+    Returns True on success.
+    Returns False if it is invalid, details in the log.
+    """
+    sSet1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+    sSet2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ ";
+    if len(sOpcode) != 8:
+        reporter.error("invalid opcode length: %s" % (len(sOpcode)));
+        return False;
+    for i in range(0, 1):
+        if sSet1.find(sOpcode[i]) < 0:
+            reporter.error("invalid opcode char #%u: %s" % (i, sOpcode));
+            return False;
+    for i in range(2, 7):
+        if sSet2.find(sOpcode[i]) < 0:
+            reporter.error("invalid opcode char #%u: %s" % (i, sOpcode));
+            return False;
+    return True;
+
+#
+# Helper for encoding data sent to the TXS.
+#
+
+def u32ToByteArray(u32):
+    """Encodes the u32 value as a little endian byte (B) array."""
+    return array.array('B', \
+                       (  u32             % 256, \
+                         (u32 / 256)      % 256, \
+                         (u32 / 65536)    % 256, \
+                         (u32 / 16777216) % 256) );
+
+
+
+class TransportBase(object):
+    """
+    Base class for the transport layer.
+    """
+
+    def __init__(self, sCaller):
+        self.sDbgCreated    = '%s: %s' % (utils.getTimePrefix(), sCaller);
+        self.fDummy         = 0;
+        self.abReadAheadHdr = array.array('B');
+
+    def toString(self):
+        """
+        Stringify the instance for logging and debugging.
+        """
+        return '<%s: abReadAheadHdr=%s, sDbgCreated=%s>' % (type(self).__name__, self.abReadAheadHdr, self.sDbgCreated);
+
+    def __str__(self):
+        return self.toString();
+
+    def cancelConnect(self):
+        """
+        Cancels any pending connect() call.
+        Returns None;
+        """
+        return None;
+
+    def connect(self, cMsTimeout):
+        """
+        Quietly attempts to connect to the TXS.
+
+        Returns True on success.
+        Returns False on retryable errors (no logging).
+        Returns None on fatal errors with details in the log.
+
+        Override this method, don't call super.
+        """
+        _ = cMsTimeout;
+        return False;
+
+    def disconnect(self, fQuiet = False):
+        """
+        Disconnect from the TXS.
+
+        Returns True.
+
+        Override this method, don't call super.
+        """
+        _ = fQuiet;
+        return True;
+
+    def sendBytes(self, abBuf, cMsTimeout):
+        """
+        Sends the bytes in the buffer abBuf to the TXS.
+
+        Returns True on success.
+        Returns False on failure and error details in the log.
+
+        Override this method, don't call super.
+
+        Remarks: len(abBuf) is always a multiple of 16.
+        """
+        _ = abBuf; _ = cMsTimeout;
+        return False;
+
+    def recvBytes(self, cb, cMsTimeout, fNoDataOk):
+        """
+        Receive cb number of bytes from the TXS.
+
+        Returns the bytes (array('B')) on success.
+        Returns None on failure and error details in the log.
+
+        Override this method, don't call super.
+
+        Remarks: cb is always a multiple of 16.
+        """
+        _ = cb; _ = cMsTimeout; _ = fNoDataOk;
+        return False;
+
+    def isConnectionOk(self):
+        """
+        Checks if the connection is OK.
+
+        Returns True if it is.
+        Returns False if it isn't (caller should call diconnect).
+
+        Override this method, don't call super.
+        """
+        return True;
+
+    def isRecvPending(self, cMsTimeout = 0):
+        """
+        Checks if there is incoming bytes, optionally waiting cMsTimeout
+        milliseconds for something to arrive.
+
+        Returns True if there is, False if there isn't.
+
+        Override this method, don't call super.
+        """
+        _ = cMsTimeout;
+        return False;
+
+    def sendMsgInt(self, sOpcode, cMsTimeout, abPayload = array.array('B')):
+        """
+        Sends a message (opcode + encoded payload).
+
+        Returns True on success.
+        Returns False on failure and error details in the log.
+        """
+        # Fix + check the opcode.
+        if len(sOpcode) < 2:
+            reporter.fatal('sendMsgInt: invalid opcode length: %d (\"%s\")' % (len(sOpcode), sOpcode));
+            return False;
+        sOpcode = sOpcode.ljust(8);
+        if not isValidOpcodeEncoding(sOpcode):
+            reporter.fatal('sendMsgInt: invalid opcode encoding: \"%s\"' % (sOpcode));
+            return False;
+
+        # Start construct the message.
+        cbMsg = 16 + len(abPayload);
+        abMsg = array.array('B');
+        abMsg.extend(u32ToByteArray(cbMsg));
+        abMsg.extend((0, 0, 0, 0));     # uCrc32
+        try:
+            abMsg.extend(array.array('B', \
+                                     ( ord(sOpcode[0]), \
+                                       ord(sOpcode[1]), \
+                                       ord(sOpcode[2]), \
+                                       ord(sOpcode[3]), \
+                                       ord(sOpcode[4]), \
+                                       ord(sOpcode[5]), \
+                                       ord(sOpcode[6]), \
+                                       ord(sOpcode[7]) ) ) );
+            if len(abPayload) > 0:
+                abMsg.extend(abPayload);
+        except:
+            reporter.fatalXcpt('sendMsgInt: packing problem...');
+            return False;
+
+        # checksum it, padd it and send it off.
+        uCrc32 = zlib.crc32(abMsg[8:]);
+        abMsg[4:8] = u32ToByteArray(uCrc32);
+
+        while len(abMsg) % 16:
+            abMsg.append(0);
+
+        reporter.log2('sendMsgInt: op=%s len=%d to=%d' % (sOpcode, len(abMsg), cMsTimeout));
+        return self.sendBytes(abMsg, cMsTimeout);
+
+    def recvMsg(self, cMsTimeout, fNoDataOk = False):
+        """
+        Receives a message from the TXS.
+
+        Returns the message three-tuple: length, opcode, payload.
+        Returns (None, None, None) on failure and error details in the log.
+        """
+
+        # Read the header.
+        if len(self.abReadAheadHdr) > 0:
+            assert(len(self.abReadAheadHdr) == 16);
+            abHdr = self.abReadAheadHdr;
+            self.abReadAheadHdr = array.array('B');
+        else:
+            abHdr = self.recvBytes(16, cMsTimeout, fNoDataOk);
+            if abHdr is None:
+                return (None, None, None);
+        if len(abHdr) != 16:
+            reporter.fatal('recvBytes(16) returns %d bytes!' % (len(abHdr)));
+            return (None, None, None);
+
+        # Unpack and validate the header.
+        cbMsg   = getU32(abHdr, 0);
+        uCrc32  = getU32(abHdr, 4);
+        sOpcode = abHdr[8:16].tostring().decode('ascii');
+
+        if cbMsg < 16:
+            reporter.fatal('recvMsg: message length is out of range: %s (min 16 bytes)' % (cbMsg));
+            return (None, None, None);
+        if cbMsg > 1024*1024:
+            reporter.fatal('recvMsg: message length is out of range: %s (max 1MB)' % (cbMsg));
+            return (None, None, None);
+        if not isValidOpcodeEncoding(sOpcode):
+            reporter.fatal('recvMsg: invalid opcode \"%s\"' % (sOpcode));
+            return (None, None, None);
+
+        # Get the payload (if any), dropping the padding.
+        abPayload = array.array('B');
+        if cbMsg > 16:
+            if cbMsg % 16:
+                cbPadding = 16 - (cbMsg % 16);
+            else:
+                cbPadding = 0;
+            abPayload = self.recvBytes(cbMsg - 16 + cbPadding, cMsTimeout, False);
+            if abPayload is None:
+                self.abReadAheadHdr = abHdr;
+                if not fNoDataOk    :
+                    reporter.log('recvMsg: failed to recv payload bytes!');
+                return (None, None, None);
+
+            while cbPadding > 0:
+                abPayload.pop();
+                cbPadding = cbPadding - 1;
+
+        # Check the CRC-32.
+        if uCrc32 != 0:
+            uActualCrc32 = zlib.crc32(abHdr[8:]);
+            if cbMsg > 16:
+                uActualCrc32 = zlib.crc32(abPayload, uActualCrc32);
+            uActualCrc32 = uActualCrc32 & 0xffffffff;
+            if uCrc32 != uActualCrc32:
+                reporter.fatal('recvMsg: crc error: expected %s, got %s' % (hex(uCrc32), hex(uActualCrc32)));
+                return (None, None, None);
+
+        reporter.log2('recvMsg: op=%s len=%d' % (sOpcode, len(abPayload)));
+        return (cbMsg, sOpcode, abPayload);
+
+    def sendMsg(self, sOpcode, cMsTimeout, aoPayload = ()):
+        """
+        Sends a message (opcode + payload tuple).
+
+        Returns True on success.
+        Returns False on failure and error details in the log.
+        Returns None if you pass the incorrectly typed parameters.
+        """
+        # Encode the payload.
+        abPayload = array.array('B');
+        for o in aoPayload:
+            try:
+                if isinstance(o, basestring):
+                    # the primitive approach...
+                    sUtf8 = o.encode('utf_8');
+                    for i in range(0, len(sUtf8)):
+                        abPayload.append(ord(sUtf8[i]))
+                    abPayload.append(0);
+                elif isinstance(o, types.LongType):
+                    if o < 0 or o > 0xffffffff:
+                        reporter.fatal('sendMsg: uint32_t payload is out of range: %s' % (hex(o)));
+                        return None;
+                    abPayload.extend(u32ToByteArray(o));
+                elif isinstance(o, array.array):
+                    abPayload.extend(o);
+                else:
+                    reporter.fatal('sendMsg: unexpected payload type: %s (%s) (aoPayload=%s)' % (type(o), o, aoPayload));
+                    return None;
+            except:
+                reporter.fatalXcpt('sendMsg: screwed up the encoding code...');
+                return None;
+        return self.sendMsgInt(sOpcode, cMsTimeout, abPayload);
+
+
+class Session(TdTaskBase):
+    """
+    A Test eXecution Service (TXS) client session.
+    """
+
+    def __init__(self, oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = False):
+        """
+        Construct a TXS session.
+
+        This starts by connecting to the TXS and will enter the signalled state
+        when connected or the timeout has been reached.
+        """
+        TdTaskBase.__init__(self, utils.getCallerName());
+        self.oTransport     = oTransport;
+        self.sStatus        = "";
+        self.cMsTimeout     = 0;
+        self.fErr           = True;     # Whether to report errors as error.
+        self.msStart        = 0;
+        self.oThread        = None;
+        self.fnTask         = self.taskDummy;
+        self.aTaskArgs      = None;
+        self.oTaskRc        = None;
+        self.t3oReply       = (None, None, None);
+        self.fScrewedUpMsgState = False;
+        self.fTryConnect    = fTryConnect;
+
+        if not self.startTask(cMsTimeout, False, "connecting", self.taskConnect, (cMsIdleFudge,)):
+            raise base.GenError("startTask failed");
+
+    def __del__(self):
+        """Make sure to cancel the task when deleted."""
+        self.cancelTask();
+
+    def toString(self):
+        return '<%s fnTask=%s, aTaskArgs=%s, sStatus=%s, oTaskRc=%s, cMsTimeout=%s,' \
+               ' msStart=%s, fTryConnect=%s, fErr=%s, fScrewedUpMsgState=%s, t3oReply=%s oTransport=%s, oThread=%s>' \
+             % (TdTaskBase.toString(self), self.fnTask, self.aTaskArgs, self.sStatus, self.oTaskRc, self.cMsTimeout,
+                self.msStart, self.fTryConnect, self.fErr, self.fScrewedUpMsgState, self.t3oReply, self.oTransport, self.oThread);
+
+    def taskDummy(self):
+        """Place holder to catch broken state handling."""
+        raise Exception();
+
+    def startTask(self, cMsTimeout, fIgnoreErrors, sStatus, fnTask, aArgs = ()):
+        """
+        Kicks of a new task.
+
+        cMsTimeout:         The task timeout in milliseconds. Values less than
+                            500 ms will be adjusted to 500 ms. This means it is
+                            OK to use negative value.
+        sStatus:            The task status.
+        fnTask:             The method that'll execute the task.
+        aArgs:              Arguments to pass to fnTask.
+
+        Returns True on success, False + error in log on failure.
+        """
+        if not self.cancelTask():
+            reporter.maybeErr(not fIgnoreErrors, 'txsclient.Session.startTask: failed to cancel previous task.');
+            return False;
+
+        # Change status and make sure we're the
+        self.lockTask();
+        if self.sStatus != "":
+            self.unlockTask();
+            reporter.maybeErr(not fIgnoreErrors, 'txsclient.Session.startTask: race.');
+            return False;
+        self.sStatus        = "setup";
+        self.oTaskRc        = None;
+        self.t3oReply       = (None, None, None);
+        self.resetTaskLocked();
+        self.unlockTask();
+
+        self.cMsTimeout     = max(cMsTimeout, 500);
+        self.fErr           = not fIgnoreErrors;
+        self.fnTask         = fnTask;
+        self.aTaskArgs      = aArgs;
+        self.oThread        = threading.Thread(target=self.taskThread, args=(), name=('TXS-%s' % (sStatus)));
+        self.oThread.setDaemon(True);
+        self.msStart        = base.timestampMilli();
+
+        self.lockTask();
+        self.sStatus        = sStatus;
+        self.unlockTask();
+        self.oThread.start();
+
+        return True;
+
+    def cancelTask(self, fSync = True):
+        """
+        Attempts to cancel any pending tasks.
+        Returns success indicator (True/False).
+        """
+        self.lockTask();
+
+        if self.sStatus == "":
+            self.unlockTask();
+            return True;
+        if self.sStatus == "setup":
+            self.unlockTask();
+            return False;
+        if self.sStatus == "cancelled":
+            self.unlockTask();
+            return False;
+
+        reporter.log('txsclient: cancelling "%s"...' % (self.sStatus));
+        if self.sStatus == 'connecting':
+            self.oTransport.cancelConnect();
+
+        self.sStatus = "cancelled";
+        oThread = self.oThread;
+        self.unlockTask();
+
+        if not fSync:
+            return False;
+
+        oThread.join(61.0);
+        return oThread.isAlive();
+
+    def taskThread(self):
+        """
+        The task thread function.
+        This does some housekeeping activities around the real task method call.
+        """
+        if not self.isCancelled():
+            try:
+                fnTask = self.fnTask;
+                oTaskRc = fnTask(*self.aTaskArgs);
+            except:
+                reporter.fatalXcpt('taskThread', 15);
+                oTaskRc = None;
+        else:
+            reporter.log('taskThread: cancelled already');
+
+        self.lockTask();
+
+        reporter.log('taskThread: signalling task with status "%s", oTaskRc=%s' % (self.sStatus, oTaskRc));
+        self.oTaskRc = oTaskRc;
+        self.oThread = None;
+        self.sStatus = '';
+        self.signalTaskLocked();
+
+        self.unlockTask();
+        return None;
+
+    def isCancelled(self):
+        """Internal method for checking if the task has been cancelled."""
+        self.lockTask();
+        sStatus = self.sStatus;
+        self.unlockTask();
+        if sStatus == "cancelled":
+            return True;
+        return False;
+
+    def hasTimedOut(self):
+        """Internal method for checking if the task has timed out or not."""
+        cMsLeft = self.getMsLeft();
+        if cMsLeft <= 0:
+            return True;
+        return False;
+
+    def getMsLeft(self, cMsMin = 0, cMsMax = -1):
+        """Gets the time left until the timeout."""
+        cMsElapsed = base.timestampMilli() - self.msStart;
+        if cMsElapsed < 0:
+            return cMsMin;
+        cMsLeft = self.cMsTimeout - cMsElapsed;
+        if cMsLeft <= cMsMin:
+            return cMsMin;
+        if cMsLeft > cMsMax and cMsMax > 0:
+            return cMsMax
+        return cMsLeft;
+
+    def recvReply(self, cMsTimeout = None, fNoDataOk = False):
+        """
+        Wrapper for TransportBase.recvMsg that stashes the response away
+        so the client can inspect it later on.
+        """
+        if cMsTimeout == None:
+            cMsTimeout = self.getMsLeft(500);
+        cbMsg, sOpcode, abPayload = self.oTransport.recvMsg(cMsTimeout, fNoDataOk);
+        self.lockTask();
+        self.t3oReply = (cbMsg, sOpcode, abPayload);
+        self.unlockTask();
+        return (cbMsg, sOpcode, abPayload);
+
+    def recvAck(self, fNoDataOk = False):
+        """
+        Receives an ACK or error response from the TXS.
+
+        Returns True on success.
+        Returns False on timeout or transport error.
+        Returns (sOpcode, sDetails) tuple on failure.  The opcode is stripped
+        and there are always details of some sort or another.
+        """
+        cbMsg, sOpcode, abPayload = self.recvReply(None, fNoDataOk);
+        if cbMsg is None:
+            return False;
+        sOpcode = sOpcode.strip()
+        if sOpcode == "ACK":
+            return True;
+        return (sOpcode, getSZ(abPayload, 0, sOpcode));
+
+    def recvAckLogged(self, sCommand, fNoDataOk = False):
+        """
+        Wrapper for recvAck and logging.
+        Returns True on success (ACK).
+        Returns False on time, transport error and errors signalled by TXS.
+        """
+        rc = self.recvAck(fNoDataOk);
+        if rc is not True  and  not fNoDataOk:
+            if rc is False:
+                reporter.maybeErr(self.fErr, 'recvAckLogged: %s transport error' % (sCommand));
+            else:
+                reporter.maybeErr(self.fErr, 'recvAckLogged: %s response was %s: %s' % (sCommand, rc[0], rc[1]));
+                rc = False;
+        return rc;
+
+    def recvTrueFalse(self, sCommand):
+        """
+        Receives a TRUE/FALSE response from the TXS.
+        Returns True on TRUE, False on FALSE and None on error/other (logged).
+        """
+        cbMsg, sOpcode, abPayload = self.recvReply();
+        if cbMsg is None:
+            reporter.maybeErr(self.fErr, 'recvAckLogged: %s transport error' % (sCommand));
+            return None;
+
+        sOpcode = sOpcode.strip()
+        if sOpcode == "TRUE":
+            return True;
+        if sOpcode == "FALSE":
+            return False;
+        reporter.maybeErr(self.fErr, 'recvAckLogged: %s response was %s: %s' % (sCommand, sOpcode, getSZ(abPayload, 0, sOpcode)));
+        return None;
+
+    def sendMsg(self, sOpcode, aoPayload = (), cMsTimeout = None):
+        """
+        Wrapper for TransportBase.sendMsg that inserts the correct timeout.
+        """
+        if cMsTimeout == None:
+            cMsTimeout = self.getMsLeft(500);
+        return self.oTransport.sendMsg(sOpcode, cMsTimeout, aoPayload);
+
+    def asyncToSync(self, fnAsync, *aArgs):
+        """
+        Wraps an asynchronous task into a synchronous operation.
+
+        Returns False on failure, task return status on success.
+        """
+        rc = fnAsync(*aArgs);
+        if rc is False:
+            reporter.log2('asyncToSync(%s): returns False (#1)' % (fnAsync));
+            return rc;
+
+        rc = self.waitForTask(self.cMsTimeout + 5000);
+        if rc is False:
+            reporter.maybeErrXcpt(self.fErr, 'asyncToSync: waitForTask failed...');
+            self.cancelTask();
+            #reporter.log2('asyncToSync(%s): returns False (#2)' % (fnAsync, rc));
+            return False;
+
+        rc = self.getResult();
+        #reporter.log2('asyncToSync(%s): returns %s' % (fnAsync, rc));
+        return rc;
+
+    #
+    # Connection tasks.
+    #
+
+    def taskConnect(self, cMsIdleFudge):
+        """Tries to connect to the TXS"""
+        while not self.isCancelled():
+            reporter.log2('taskConnect: connecting ...');
+            rc = self.oTransport.connect(self.getMsLeft(500));
+            if rc is True:
+                reporter.log('taskConnect: succeeded');
+                return self.taskGreet(cMsIdleFudge);
+            if rc is None:
+                reporter.log2('taskConnect: unable to connect');
+                return None;
+            if self.hasTimedOut():
+                reporter.log2('taskConnect: timed out');
+                if not self.fTryConnect:
+                    reporter.maybeErr(self.fErr, 'taskConnect: timed out');
+                return False;
+            time.sleep(self.getMsLeft(1, 1000) / 1000.0);
+        if not self.fTryConnect:
+            reporter.maybeErr(self.fErr, 'taskConnect: cancelled');
+        return False;
+
+    def taskGreet(self, cMsIdleFudge):
+        """Greets the TXS"""
+        rc = self.sendMsg("HOWDY", ());
+        if rc is True:
+            rc = self.recvAckLogged("HOWDY", self.fTryConnect);
+        if rc is True:
+            while cMsIdleFudge > 0:
+                cMsIdleFudge -= 1000;
+                time.sleep(1);
+        else:
+            self.oTransport.disconnect(self.fTryConnect);
+        return rc;
+
+    def taskBye(self):
+        """Says goodbye to the TXS"""
+        rc = self.sendMsg("BYE");
+        if rc is True:
+            rc = self.recvAckLogged("BYE");
+        self.oTransport.disconnect();
+        return rc;
+
+    def taskUuid(self):
+        """Gets the TXS UUID"""
+        rc = self.sendMsg("UUID");
+        if rc is True:
+            rc = False;
+            cbMsg, sOpcode, abPayload = self.recvReply();
+            if cbMsg is not None:
+                sOpcode = sOpcode.strip()
+                if sOpcode == "ACK UUID":
+                    sUuid = getSZ(abPayload, 0);
+                    if sUuid is not None:
+                        sUuid = '{%s}' % (sUuid,)
+                        try:
+                            _ = uuid.UUID(sUuid);
+                            rc = sUuid;
+                        except:
+                            reporter.errorXcpt('taskUuid got an invalid UUID string %s' % (sUuid,));
+                    else:
+                        reporter.maybeErr(self.fErr, 'taskUuid did not get a UUID string.');
+                else:
+                    reporter.maybeErr(self.fErr, 'taskUuid got a bad reply: %s' % (sOpcode,));
+            else:
+                reporter.maybeErr(self.fErr, 'taskUuid got 3xNone from recvReply.');
+        return rc;
+
+    #
+    # Process task
+    # pylint: disable=C0111
+    #
+
+    def taskExecEx(self, sExecName, fFlags, asArgs, asAddEnv, oStdIn, oStdOut, oStdErr, oTestPipe, sAsUser): # pylint: disable=R0913,R0914,R0915,C0301
+        # Construct the payload.
+        aoPayload = [long(fFlags), '%s' % (sExecName), long(len(asArgs))];
+        for sArg in asArgs:
+            aoPayload.append('%s' % (sArg));
+        aoPayload.append(long(len(asAddEnv)));
+        for sPutEnv in asAddEnv:
+            aoPayload.append('%s' % (sPutEnv));
+        for o in (oStdIn, oStdOut, oStdErr, oTestPipe):
+            if isinstance(o, basestring):
+                aoPayload.append(o);
+            elif o is not None:
+                aoPayload.append('|');
+                o.uTxsClientCrc32 = zlib.crc32('');
+            else:
+                aoPayload.append('');
+        aoPayload.append('%s' % (sAsUser));
+        aoPayload.append(long(self.cMsTimeout));
+
+        # Kick of the EXEC command.
+        rc = self.sendMsg('EXEC', aoPayload)
+        if rc is True:
+            rc = self.recvAckLogged('EXEC');
+        if rc is True:
+            # Loop till the process completes, feed input to the TXS and
+            # receive output from it.
+            sFailure                  = "";
+            msPendingInputReply       = None;
+            cbMsg, sOpcode, abPayload = (None, None, None);
+            while True:
+                # Pending input?
+                if     msPendingInputReply is None \
+                   and oStdIn is not None \
+                   and not isinstance(oStdIn, basestring):
+                    try:
+                        abInput = oStdIn.read(65536);
+                    except:
+                        reporter.errorXcpt('read standard in');
+                        sFailure = 'exception reading stdin';
+                        rc = None;
+                        break;
+                    if len(abInput) > 0:
+                        oStdIn.uTxsClientCrc32 = zlib.crc32(abInput, oStdIn.uTxsClientCrc32);
+                        rc = self.sendMsg('STDIN', (long(oStdIn.uTxsClientCrc32 & 0xffffffff), abInput));
+                        if rc is not True:
+                            sFailure = 'sendMsg failure';
+                            break;
+                        msPendingInputReply = base.timestampMilli();
+                        continue;
+
+                # Wait for input (500 ms timeout).
+                if cbMsg is None:
+                    cbMsg, sOpcode, abPayload = self.recvReply(cMsTimeout=500, fNoDataOk=True);
+                    if cbMsg == None:
+                        # Check for time out before restarting the loop.
+                        # Note! Only doing timeout checking here does mean that
+                        #       the TXS may prevent us from timing out by
+                        #       flooding us with data.  This is unlikely though.
+                        if    self.hasTimedOut() \
+                         and (   msPendingInputReply is None \
+                              or base.timestampMilli() - msPendingInputReply > 30000):
+                            reporter.maybeErr(self.fErr, 'taskExecEx: timed out');
+                            sFailure = 'timeout';
+                            rc = None;
+                            break;
+                        # Check that the connection is OK.
+                        if not self.oTransport.isConnectionOk():
+                            self.oTransport.disconnect();
+                            sFailure = 'disconnected';
+                            rc = False;
+                            break;
+                        continue;
+
+                # Handle the response.
+                sOpcode = sOpcode.rstrip();
+                if sOpcode == 'STDOUT':
+                    oOut = oStdOut;
+                elif sOpcode == 'STDERR':
+                    oOut = oStdErr;
+                elif sOpcode == 'TESTPIPE':
+                    oOut = oTestPipe;
+                else:
+                    oOut = None;
+                if oOut is not None:
+                    # Output from the process.
+                    if len(abPayload) < 4:
+                        sFailure = 'malformed output packet (%s, %u bytes)' % (sOpcode, cbMsg);
+                        reporter.maybeErr(self.fErr, 'taskExecEx: %s' % (sFailure));
+                        rc = None;
+                        break;
+                    uStreamCrc32 = getU32(abPayload, 0);
+                    oOut.uTxsClientCrc32 = zlib.crc32(abPayload[4:], oOut.uTxsClientCrc32);
+                    if uStreamCrc32 != (oOut.uTxsClientCrc32 & 0xffffffff):
+                        sFailure = 'crc error - mine=%#x their=%#x (%s, %u bytes)' \
+                            % (oOut.uTxsClientCrc32 & 0xffffffff, uStreamCrc32, sOpcode, cbMsg);
+                        reporter.maybeErr(self.fErr, 'taskExecEx: %s' % (sFailure));
+                        rc = None;
+                        break;
+                    try:
+                        oOut.write(abPayload[4:]);
+                    except:
+                        sFailure = 'exception writing %s' % (sOpcode);
+                        reporter.errorXcpt('taskExecEx: %s' % (sFailure));
+                        rc = None;
+                        break;
+                elif sOpcode == 'STDINIGN' and msPendingInputReply is not None:
+                    # Standard input is ignored.  Ignore this condition for now.
+                    msPendingInputReply = None;
+                    reporter.log('taskExecEx: Standard input is ignored... why?');
+                    del oStdIn.uTxsClientCrc32;
+                    oStdIn = '/dev/null';
+                elif  (sOpcode == 'STDINMEM' or sOpcode == 'STDINBAD' or sOpcode == 'STDINCRC')\
+                  and msPendingInputReply is not None:
+                    # TXS STDIN error, abort.
+                    # TODO: STDINMEM - consider undoing the previous stdin read and try resubmitt it.
+                    msPendingInputReply = None;
+                    sFailure = 'TXS is out of memory for std input buffering';
+                    reporter.maybeErr(self.fErr, 'taskExecEx: %s' % (sFailure));
+                    rc = None;
+                    break;
+                elif sOpcode == 'ACK' and msPendingInputReply is not None:
+                    msPendingInputReply = None;
+                elif sOpcode.startswith('PROC '):
+                    # Process status message, handle it outside the loop.
+                    rc = True;
+                    break;
+                else:
+                    sFailure = 'Unexpected opcode %s' % (sOpcode);
+                    reporter.maybeErr(self.fErr, 'taskExecEx: %s' % (sFailure));
+                    rc = None;
+                    break;
+                # Clear the message.
+                cbMsg, sOpcode, abPayload = (None, None, None);
+
+            # If we sent an STDIN packet and didn't get a reply yet, we'll give
+            # TXS some 5 seconds to reply to this.  If we don't wait here we'll
+            # get screwed later on if we mix it up with the reply to some other
+            # command.  Hackish.
+            if msPendingInputReply is not None:
+                cbMsg2, sOpcode2, abPayload2 = self.oTransport.recvMsg(5000);
+                if cbMsg2 is not None:
+                    reporter.log('taskExecEx: Out of order STDIN, got reply: %s, %s, %s [ignored]'
+                                 % (cbMsg2, sOpcode2, abPayload2));
+                    msPendingInputReply = None;
+                else:
+                    reporter.maybeErr(self.fErr, 'taskExecEx: Pending STDIN, no reply after 5 secs!');
+                    self.fScrewedUpMsgState = True;
+
+            # Parse the exit status (True), abort (None) or do nothing (False).
+            if rc is True:
+                if sOpcode == 'PROC OK':
+                    rc = True;
+                else:
+                    # Do proper parsing some other day if needed:
+                    #   PROC TOK, PROC TOA, PROC DWN, PROC DOO,
+                    #   PROC NOK + rc, PROC SIG + sig, PROC ABD, FAILED.
+                    rc = False;
+            else:
+                if rc is None:
+                    # Abort it.
+                    reporter.log('taskExecEx: sending ABORT...');
+                    rc = self.sendMsg('ABORT');
+                    while rc is True:
+                        cbMsg, sOpcode, abPayload = self.oTransport.recvMsg(30000);
+                        if cbMsg is None:
+                            reporter.maybeErr(self.fErr, 'taskExecEx: Pending ABORT, no reply after 30 secs!')
+                            self.fScrewedUpMsgState = True;
+                            break;
+                        if sOpcode.startswith('PROC '):
+                            reporter.log('taskExecEx: ABORT reply: %s, %s, %s [ignored]' % (cbMsg, sOpcode, abPayload));
+                            break;
+                        reporter.log('taskExecEx: ABORT in process, ignoring reply: %s, %s, %s' % (cbMsg, sOpcode, abPayload));
+                        # Check that the connection is OK before looping.
+                        if not self.oTransport.isConnectionOk():
+                            self.oTransport.disconnect();
+                            break;
+
+                # Fake response with the reason why we quit.
+                if sFailure is not None:
+                    self.t3oReply = (0, 'EXECFAIL', sFailure);
+                rc = None;
+        else:
+            rc = None;
+
+        # Cleanup.
+        for o in (oStdIn, oStdOut, oStdErr, oTestPipe):
+            if o is not None and not isinstance(o, basestring):
+                del o.uTxsClientCrc32;      # pylint: disable=E1103
+        reporter.log('taskExecEx: returns %s' % (rc));
+        return rc;
+
+    #
+    # Admin tasks
+    #
+
+    def hlpRebootShutdownWaitForAck(self, sCmd):
+        """Wait for reboot/shutodwn ACK."""
+        rc = self.recvAckLogged(sCmd);
+        if rc is True:
+            # poll a little while for server to disconnect.
+            uMsStart = base.timestampMilli();
+            while self.oTransport.isConnectionOk() \
+              and base.timestampMilli() - uMsStart >= 5000:
+                if self.oTransport.isRecvPending(min(500, self.getMsLeft())):
+                    break;
+            self.oTransport.disconnect();
+        return rc;
+
+    def taskReboot(self):
+        rc = self.sendMsg('REBOOT');
+        if rc is True:
+            rc = self.hlpRebootShutdownWaitForAck('REBOOT');
+        return rc;
+
+    def taskShutdown(self):
+        rc = self.sendMsg('SHUTDOWN');
+        if rc is True:
+            rc = self.hlpRebootShutdownWaitForAck('SHUTDOWN');
+        return rc;
+
+    #
+    # CD/DVD control tasks.
+    #
+
+    ## TODO
+
+    #
+    # File system tasks
+    #
+
+    def taskMkDir(self, sRemoteDir, fMode):
+        rc = self.sendMsg('MKDIR', (fMode, sRemoteDir));
+        if rc is True:
+            rc = self.recvAckLogged('MKDIR');
+        return rc;
+
+    def taskMkDirPath(self, sRemoteDir, fMode):
+        rc = self.sendMsg('MKDRPATH', (fMode, sRemoteDir));
+        if rc is True:
+            rc = self.recvAckLogged('MKDRPATH');
+        return rc;
+
+    def taskMkSymlink(self, sLinkTarget, sLink):
+        rc = self.sendMsg('MKSYMLNK', (sLinkTarget, sLink));
+        if rc is True:
+            rc = self.recvAckLogged('MKSYMLNK');
+        return rc;
+
+    def taskRmDir(self, sRemoteDir):
+        rc = self.sendMsg('RMDIR', (sRemoteDir,));
+        if rc is True:
+            rc = self.recvAckLogged('RMDIR');
+        return rc;
+
+    def taskRmFile(self, sRemoteFile):
+        rc = self.sendMsg('RMFILE', (sRemoteFile,));
+        if rc is True:
+            rc = self.recvAckLogged('RMFILE');
+        return rc;
+
+    def taskRmSymlink(self, sRemoteSymlink):
+        rc = self.sendMsg('RMSYMLNK', (sRemoteSymlink,));
+        if rc is True:
+            rc = self.recvAckLogged('RMSYMLNK');
+        return rc;
+
+    def taskRmTree(self, sRemoteTree):
+        rc = self.sendMsg('RMTREE', (sRemoteTree,));
+        if rc is True:
+            rc = self.recvAckLogged('RMTREE');
+        return rc;
+
+    #def "CHMOD   "
+    #def "CHOWN   "
+    #def "CHGRP   "
+
+    def taskIsDir(self, sRemoteDir):
+        rc = self.sendMsg('ISDIR', (sRemoteDir,));
+        if rc is True:
+            rc = self.recvTrueFalse('ISDIR');
+        return rc;
+
+    def taskIsFile(self, sRemoteFile):
+        rc = self.sendMsg('ISFILE', (sRemoteFile,));
+        if rc is True:
+            rc = self.recvTrueFalse('ISFILE');
+        return rc;
+
+    def taskIsSymlink(self, sRemoteSymlink):
+        rc = self.sendMsg('ISSYMLNK', (sRemoteSymlink,));
+        if rc is True:
+            rc = self.recvTrueFalse('ISSYMLNK');
+        return rc;
+
+    #def "STAT    "
+    #def "LSTAT   "
+    #def "LIST    "
+
+    def taskUploadFile(self, sLocalFile, sRemoteFile):
+        #
+        # Open the local file (make sure it exist before bothering TXS) and
+        # tell TXS that we want to upload a file.
+        #
+        try:
+            oLocalFile = utils.openNoInherit(sLocalFile, 'rb');
+        except:
+            reporter.errorXcpt('taskUpload: failed to open "%s"' % (sLocalFile));
+            return False;
+
+        # Common cause with taskUploadStr
+        rc = self.taskUploadCommon(oLocalFile, sRemoteFile);
+
+        # Cleanup.
+        oLocalFile.close();
+        return rc;
+
+    def taskUploadString(self, sContent, sRemoteFile):
+        # Wrap sContent in a file like class.
+        class InStringFile(object): # pylint: disable=R0903
+            def __init__(self, sContent):
+                self.sContent = sContent;
+                self.off      = 0;
+
+            def read(self, cbMax):
+                cbLeft = len(self.sContent) - self.off;
+                if cbLeft == 0:
+                    return "";
+                if cbLeft <= cbMax:
+                    sRet = self.sContent[self.off:(self.off + cbLeft)];
+                else:
+                    sRet = self.sContent[self.off:(self.off + cbMax)];
+                self.off = self.off + len(sRet);
+                return sRet;
+
+        oLocalString = InStringFile(sContent);
+        return self.taskUploadCommon(oLocalString, sRemoteFile);
+
+    def taskUploadCommon(self, oLocalFile, sRemoteFile):
+        """Common worker used by taskUploadFile and taskUploadString."""
+        # Command + ACK.
+        rc = self.sendMsg('PUT FILE', (sRemoteFile,));
+        if rc is True:
+            rc = self.recvAckLogged('PUT FILE');
+        if rc is True:
+            #
+            # Push data packets until eof.
+            #
+            uMyCrc32 = zlib.crc32("");
+            while True:
+                # Read up to 64 KB of data.
+                try:
+                    sRaw = oLocalFile.read(65536);
+                except:
+                    rc = None;
+                    break;
+
+                # Convert to array - this is silly!
+                abBuf = array.array('B');
+                for i in range(len(sRaw)):
+                    abBuf.append(ord(sRaw[i]));
+                sRaw = None;
+
+                # Update the file stream CRC and send it off.
+                uMyCrc32 = zlib.crc32(abBuf, uMyCrc32);
+                if len(abBuf) == 0:
+                    rc = self.sendMsg('DATA EOF', (long(uMyCrc32 & 0xffffffff), ));
+                else:
+                    rc = self.sendMsg('DATA    ', (long(uMyCrc32 & 0xffffffff), abBuf));
+                if rc is False:
+                    break;
+
+                # Wait for the reply.
+                rc = self.recvAck();
+                if rc is not True:
+                    if rc is False:
+                        reporter.maybeErr(self.fErr, 'taskUpload: transport error waiting for ACK');
+                    else:
+                        reporter.maybeErr(self.fErr, 'taskUpload: DATA response was %s: %s' % (rc[0], rc[1]));
+                        rc = False;
+                    break;
+
+                # EOF?
+                if len(abBuf) == 0:
+                    break;
+
+            # Send ABORT on ACK and I/O errors.
+            if rc is None:
+                rc = self.sendMsg('ABORT');
+                if rc is True:
+                    self.recvAckLogged('ABORT');
+                rc = False;
+        return rc;
+
+    def taskDownloadFile(self, sRemoteFile, sLocalFile):
+        try:
+            oLocalFile = utils.openNoInherit(sLocalFile, 'wb');
+        except:
+            reporter.errorXcpt('taskDownload: failed to open "%s"' % (sLocalFile));
+            return False;
+
+        rc = self.taskDownloadCommon(sRemoteFile, oLocalFile);
+
+        oLocalFile.close();
+        if rc is False:
+            try:
+                os.remove(sLocalFile);
+            except:
+                reporter.errorXcpt();
+        return rc;
+
+    def taskDownloadString(self, sRemoteFile):
+        # Wrap sContent in a file like class.
+        class OutStringFile(object): # pylint: disable=R0903
+            def __init__(self):
+                self.asContent = [];
+
+            def write(self, sBuf):
+                self.asContent.append(sBuf);
+                return None;
+
+        oLocalString = OutStringFile();
+        rc = self.taskDownloadCommon(sRemoteFile, oLocalString);
+        if rc is True:
+            if len(oLocalString.asContent) == 0:
+                rc = '';
+            else:
+                rc = ''.join(oLocalString.asContent);
+        return rc;
+
+    def taskDownloadCommon(self, sRemoteFile, oLocalFile):
+        """Common worker for taskDownloadFile and taskDownloadString."""
+        rc = self.sendMsg('GET FILE', (sRemoteFile,))
+        if rc is True:
+            #
+            # Process data packets until eof.
+            #
+            uMyCrc32 = zlib.crc32("");
+            while rc is True:
+                cbMsg, sOpcode, abPayload = self.recvReply();
+                if cbMsg is None:
+                    reporter.maybeErr(self.fErr, 'taskDownload got 3xNone from recvReply.');
+                    rc = None;
+                    break;
+
+                # Validate.
+                sOpcode = sOpcode.rstrip();
+                if sOpcode != 'DATA' and sOpcode != 'DATA EOF':
+                    reporter.maybeErr(self.fErr, 'taskDownload got a error reply: opcode="%s" details="%s"'
+                                      % (sOpcode, getSZ(abPayload, 0, "None")));
+                    rc = False;
+                    break;
+                if sOpcode == 'DATA' and len(abPayload) < 4:
+                    reporter.maybeErr(self.fErr, 'taskDownload got a bad DATA packet: len=%u' % (len(abPayload)));
+                    rc = None;
+                    break;
+                if sOpcode == 'DATA EOF' and len(abPayload) != 4:
+                    reporter.maybeErr(self.fErr, 'taskDownload got a bad EOF packet: len=%u' % (len(abPayload)));
+                    rc = None;
+                    break;
+
+                # Check the CRC (common for both packets).
+                uCrc32 = getU32(abPayload, 0);
+                if sOpcode == 'DATA':
+                    uMyCrc32 = zlib.crc32(abPayload[4:], uMyCrc32);
+                if uCrc32 != (uMyCrc32 & 0xffffffff):
+                    reporter.maybeErr(self.fErr, 'taskDownload got a bad CRC: mycrc=%s remotecrc=%s'
+                                      % (hex(uMyCrc32), hex(uCrc32)));
+                    rc = None;
+                    break;
+                if sOpcode == 'DATA EOF':
+                    rc = self.sendMsg('ACK');
+                    break;
+
+                # Finally, push the data to the file.
+                try:
+                    oLocalFile.write(abPayload[4:].tostring());
+                except:
+                    reporter.errorXcpt('I/O error writing to "%s"' % (sRemoteFile));
+                    rc = None;
+                    break;
+                rc = self.sendMsg('ACK');
+
+            # Send NACK on validation and I/O errors.
+            if rc is None:
+                rc = self.sendMsg('NACK');
+                rc = False;
+        return rc;
+
+    def taskUnpackFile(self, sRemoteFile, sRemoteDir):
+        rc = self.sendMsg('UNPKFILE', (sRemoteFile, sRemoteDir));
+        if rc is True:
+            rc = self.recvAckLogged('UNPKFILE');
+        return rc;
+
+    # pylint: enable=C0111
+
+
+    #
+    # Public methods - generic task queries
+    #
+
+    def isSuccess(self):
+        """Returns True if the task completed successfully, otherwise False."""
+        self.lockTask();
+        sStatus = self.sStatus;
+        oTaskRc = self.oTaskRc;
+        self.unlockTask();
+        if sStatus != "":
+            return False;
+        if oTaskRc is False or oTaskRc is None:
+            return False;
+        return True;
+
+    def getResult(self):
+        """
+        Returns the result of a completed task.
+        Returns None if not completed yet or no previous task.
+        """
+        self.lockTask();
+        sStatus = self.sStatus;
+        oTaskRc = self.oTaskRc;
+        self.unlockTask();
+        if sStatus != "":
+            return None;
+        return oTaskRc;
+
+    def getLastReply(self):
+        """
+        Returns the last reply three-tuple: cbMsg, sOpcode, abPayload.
+        Returns a None, None, None three-tuple if there was no last reply.
+        """
+        self.lockTask();
+        t3oReply = self.t3oReply;
+        self.unlockTask();
+        return t3oReply;
+
+    #
+    # Public methods - connection.
+    #
+
+    def asyncDisconnect(self, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a disconnect task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success and False on failure.
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "bye", self.taskBye);
+
+    def syncDisconnect(self, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncDisconnect, cMsTimeout, fIgnoreErrors);
+
+    def asyncUuid(self, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a task for getting the TXS UUID.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns UUID string (in {}) on success and False on failure.
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "bye", self.taskUuid);
+
+    def syncUuid(self, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncUuid, cMsTimeout, fIgnoreErrors);
+
+    #
+    # Public methods - execution.
+    #
+
+    def asyncExecEx(self, sExecName, asArgs = (), asAddEnv = (), # pylint: disable=R0913
+                    oStdIn = None, oStdOut = None, oStdErr = None, oTestPipe = None,
+                    sAsUser = "", cMsTimeout = 3600000, fIgnoreErrors = False):
+        """
+        Initiates a exec process task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True if the process exited normally with status code 0.
+        The task returns None if on failure prior to executing the process, and
+        False if the process exited with a different status or in an abnormal
+        manner.  Both None and False are logged of course and further info can
+        also be obtained by getLastReply().
+
+        The oStdIn, oStdOut, oStdErr and oTestPipe specifiy how to deal with
+        these streams.  If None, no special action is taken and the output goes
+        to where ever the TXS sends its output, and ditto for input.
+            - To send to / read from the bitbucket, pass '/dev/null'.
+            - To redirect to/from a file, just specify the remote filename.
+            - To append to a file use '>>' followed by the remote filename.
+            - To pipe the stream to/from the TXS, specify a file like
+              object.  For StdIn a non-blocking read() method is required. For
+              the other a write() method is required.  Watch out for deadlock
+              conditions between StdIn and StdOut/StdErr/TestPipe piping.
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "exec", self.taskExecEx,
+                              (sExecName, long(0), asArgs, asAddEnv, oStdIn,
+                               oStdOut, oStdErr, oTestPipe, sAsUser));
+
+    def syncExecEx(self, sExecName, asArgs = (), asAddEnv = (), # pylint: disable=R0913
+                   oStdIn = '/dev/null', oStdOut = '/dev/null',
+                   oStdErr = '/dev/null', oTestPipe = '/dev/null',
+                   sAsUser = '', cMsTimeout = 3600000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncExecEx, sExecName, asArgs, asAddEnv, oStdIn, oStdOut, \
+                                                  oStdErr, oTestPipe, sAsUser, cMsTimeout, fIgnoreErrors);
+
+    def asyncExec(self, sExecName, asArgs = (), asAddEnv = (), sAsUser = "", fWithTestPipe = True, sPrefix = '', \
+                  cMsTimeout = 3600000, fIgnoreErrors = False):
+        """
+        Initiates a exec process test task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True if the process exited normally with status code 0.
+        The task returns None if on failure prior to executing the process, and
+        False if the process exited with a different status or in an abnormal
+        manner.  Both None and False are logged of course and further info can
+        also be obtained by getLastReply().
+
+        Standard in is taken from /dev/null.  While both standard output and
+        standard error goes directly to reporter.log().  The testpipe is piped
+        to reporter.xxxx.
+        """
+
+        sStdIn    = '/dev/null';
+        oStdOut   = reporter.FileWrapper('%sstdout' % sPrefix);
+        oStdErr   = reporter.FileWrapper('%sstderr' % sPrefix);
+        if fWithTestPipe:   oTestPipe = reporter.FileWrapperTestPipe();
+        else:               oTestPipe = '/dev/null';
+
+        return self.startTask(cMsTimeout, fIgnoreErrors, "exec", self.taskExecEx,
+                              (sExecName, long(0), asArgs, asAddEnv, sStdIn, oStdOut, oStdErr, oTestPipe, sAsUser));
+
+    def syncExec(self, sExecName, asArgs = (), asAddEnv = (), sAsUser = '', fWithTestPipe = True, sPrefix = '',
+                 cMsTimeout = 3600000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncExec, sExecName, asArgs, asAddEnv, sAsUser, fWithTestPipe, sPrefix, \
+            cMsTimeout, fIgnoreErrors);
+
+    #
+    # Public methods - file system
+    #
+
+    def asyncReboot(self, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a reboot task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).  The
+        session will be disconnected on successful task completion.
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "reboot", self.taskReboot, ());
+
+    def syncReboot(self, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncReboot, cMsTimeout, fIgnoreErrors);
+
+    def asyncShutdown(self, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a shutdown task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "shutdown", self.taskShutdown, ());
+
+    def syncShutdown(self, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncShutdown, cMsTimeout, fIgnoreErrors);
+
+
+    #
+    # Public methods - file system
+    #
+
+    def asyncMkDir(self, sRemoteDir, fMode = 0700, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a mkdir task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "mkDir", self.taskMkDir, (sRemoteDir, long(fMode)));
+
+    def syncMkDir(self, sRemoteDir, fMode = 0700, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncMkDir, sRemoteDir, long(fMode), cMsTimeout, fIgnoreErrors);
+
+    def asyncMkDirPath(self, sRemoteDir, fMode = 0700, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a mkdir -p task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "mkDirPath", self.taskMkDirPath, (sRemoteDir, long(fMode)));
+
+    def syncMkDirPath(self, sRemoteDir, fMode = 0700, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncMkDirPath, sRemoteDir, long(fMode), cMsTimeout, fIgnoreErrors);
+
+    def asyncMkSymlink(self, sLinkTarget, sLink, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a symlink task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "mkSymlink", self.taskMkSymlink, (sLinkTarget, sLink));
+
+    def syncMkSymlink(self, sLinkTarget, sLink, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncMkSymlink, sLinkTarget, sLink, cMsTimeout, fIgnoreErrors);
+
+    def asyncRmDir(self, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a rmdir task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "rmDir", self.taskRmDir, (sRemoteDir,));
+
+    def syncRmDir(self, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncRmDir, sRemoteDir, cMsTimeout, fIgnoreErrors);
+
+    def asyncRmFile(self, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a rmfile task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "rmFile", self.taskRmFile, (sRemoteFile,));
+
+    def syncRmFile(self, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncRmFile, sRemoteFile, cMsTimeout, fIgnoreErrors);
+
+    def asyncRmSymlink(self, sRemoteSymlink, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a rmsymlink task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "rmSymlink", self.taskRmSymlink, (sRemoteSymlink,));
+
+    def syncRmSymlink(self, sRemoteSymlink, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncRmSymlink, sRemoteSymlink, cMsTimeout, fIgnoreErrors);
+
+    def asyncRmTree(self, sRemoteTree, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a rmtree task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "rmTree", self.taskRmTree, (sRemoteTree,));
+
+    def syncRmTree(self, sRemoteTree, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncRmTree, sRemoteTree, cMsTimeout, fIgnoreErrors);
+
+    #def "CHMOD   "
+    #def "CHOWN   "
+    #def "CHGRP   "
+
+    def asyncIsDir(self, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a is-dir query task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True if it's a directory, False if it isn't, and
+        None on error (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "isDir", self.taskIsDir, (sRemoteDir,));
+
+    def syncIsDir(self, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncIsDir, sRemoteDir, cMsTimeout, fIgnoreErrors);
+
+    def asyncIsFile(self, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a is-file query task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True if it's a file, False if it isn't, and None on
+        error (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "isFile", self.taskIsFile, (sRemoteFile,));
+
+    def syncIsFile(self, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncIsFile, sRemoteFile, cMsTimeout, fIgnoreErrors);
+
+    def asyncIsSymlink(self, sRemoteSymlink, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a is-symbolic-link query task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True if it's a symbolic linke, False if it isn't, and
+        None on error (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "isSymlink", self.taskIsSymlink, (sRemoteSymlink,));
+
+    def syncIsSymlink(self, sRemoteSymlink, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncIsSymlink, sRemoteSymlink, cMsTimeout, fIgnoreErrors);
+
+    #def "STAT    "
+    #def "LSTAT   "
+    #def "LIST    "
+
+    def asyncUploadFile(self, sLocalFile, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a download query task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "upload", self.taskUploadFile, (sLocalFile, sRemoteFile));
+
+    def syncUploadFile(self, sLocalFile, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncUploadFile, sLocalFile, sRemoteFile, cMsTimeout, fIgnoreErrors);
+
+    def asyncUploadString(self, sContent, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a upload string task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "uploadString", self.taskUploadString, (sContent, sRemoteFile));
+
+    def syncUploadString(self, sContent, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncUploadString, sContent, sRemoteFile, cMsTimeout, fIgnoreErrors);
+
+    def asyncDownloadFile(self, sRemoteFile, sLocalFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a download file task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "downloadFile", self.taskDownloadFile, (sRemoteFile, sLocalFile));
+
+    def syncDownloadFile(self, sRemoteFile, sLocalFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncDownloadFile, sRemoteFile, sLocalFile, cMsTimeout, fIgnoreErrors);
+
+    def asyncDownloadString(self, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a download string task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns a byte string on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "downloadString", self.taskDownloadString, (sRemoteFile,));
+
+    def syncDownloadString(self, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncDownloadString, sRemoteFile, cMsTimeout, fIgnoreErrors);
+
+    def asyncUnpackFile(self, sRemoteFile, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        """
+        Initiates a unpack file task.
+
+        Returns True on success, False on failure (logged).
+
+        The task returns True on success, False on failure (logged).
+        """
+        return self.startTask(cMsTimeout, fIgnoreErrors, "unpackFile", self.taskUnpackFile, \
+                              (sRemoteFile, sRemoteDir));
+
+    def syncUnpackFile(self, sRemoteFile, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        """Synchronous version."""
+        return self.asyncToSync(self.asyncUnpackFile, sRemoteFile, sRemoteDir, cMsTimeout, fIgnoreErrors);
+
+
+class TransportTcp(TransportBase):
+    """
+    TCP transport layer for the TXS client session class.
+    """
+
+    def __init__(self, sHostname, uPort, fReversedSetup):
+        """
+        Save the parameters. The session will call us back to make the
+        connection later on its worker thread.
+        """
+        TransportBase.__init__(self, utils.getCallerName());
+        self.sHostname        = sHostname;
+        self.fReversedSetup   = fReversedSetup;
+        self.uPort            = uPort if uPort is not None else 5042 if fReversedSetup is False else 5048;
+        self.oSocket          = None;
+        self.oWakeupW         = None;
+        self.oWakeupR         = None;
+        self.fConnectCanceled = False;
+        self.fIsConnecting    = False;
+        self.oCv              = threading.Condition();
+        self.abReadAhead      = array.array('B');
+
+    def toString(self):
+        return '<%s sHostname=%s, fReversedSetup=%s, uPort=%s, oSocket=%s,'\
+               ' fConnectCanceled=%s, fIsConnecting=%s, oCv=%s, abReadAhead=%s>' \
+             % (TransportBase.toString(self), self.sHostname, self.fReversedSetup, self.uPort, self.oSocket,
+                self.fConnectCanceled, self.fIsConnecting, self.oCv, self.abReadAhead);
+
+    def __isInProgressXcpt(self, oXcpt):
+        """ In progress exception? """
+        try:
+            if isinstance(oXcpt, socket.error):
+                try:
+                    if oXcpt[0] == errno.EINPROGRESS:
+                        return True;
+                except: pass;
+                # Windows?
+                try:
+                    if oXcpt[0] == errno.EWOULDBLOCK:
+                        return True;
+                except: pass;
+        except:
+            pass;
+        return False;
+
+    def __isWouldBlockXcpt(self, oXcpt):
+        """ Would block exception? """
+        try:
+            if isinstance(oXcpt, socket.error):
+                try:
+                    if oXcpt[0] == errno.EWOULDBLOCK:
+                        return True;
+                except: pass;
+                try:
+                    if oXcpt[0] == errno.EAGAIN:
+                        return True;
+                except: pass;
+        except:
+            pass;
+        return False;
+
+    def __isConnectionReset(self, oXcpt):
+        """ Connection reset by Peer or others. """
+        try:
+            if isinstance(oXcpt, socket.error):
+                try:
+                    if oXcpt[0] == errno.ECONNRESET:
+                        return True;
+                except: pass;
+                try:
+                    if oXcpt[0] == errno.ENETRESET:
+                        return True;
+                except: pass;
+        except:
+            pass;
+        return False;
+
+    def _closeWakeupSockets(self):
+        """ Closes the wakup sockets.  Caller should own the CV. """
+        oWakeupR = self.oWakeupR;
+        self.oWakeupR = None;
+        if oWakeupR is not None:
+            oWakeupR.close();
+
+        oWakeupW = self.oWakeupW;
+        self.oWakeupW = None;
+        if oWakeupW is not None:
+            oWakeupW.close();
+
+        return None;
+
+    def cancelConnect(self):
+        # This is bad stuff.
+        self.oCv.acquire();
+        reporter.log2('TransportTcp::cancelConnect: fIsConnecting=%s oSocket=%s' % (self.fIsConnecting, self.oSocket));
+        self.fConnectCanceled = True;
+        if self.fIsConnecting:
+            oSocket = self.oSocket;
+            self.oSocket = None;
+            if oSocket is not None:
+                reporter.log2('TransportTcp::cancelConnect: closing the socket');
+                oSocket.close();
+
+            oWakeupW = self.oWakeupW;
+            self.oWakeupW = None;
+            if oWakeupW is not None:
+                reporter.log2('TransportTcp::cancelConnect: wakeup call');
+                try:    oWakeupW.send('cancelled!\n');
+                except: reporter.logXcpt();
+                try:    oWakeupW.shutdown(socket.SHUT_WR);
+                except: reporter.logXcpt();
+                oWakeupW.close();
+        self.oCv.release();
+
+    def _connectAsServer(self, oSocket, oWakeupR, cMsTimeout):
+        """ Connects to the TXS server as server, i.e. the reversed setup. """
+        assert(self.fReversedSetup);
+
+        reporter.log2('TransportTcp::_connectAsServer: oSocket=%s, cMsTimeout=%u' % (oSocket, cMsTimeout));
+
+        # Workaround for bind() failure...
+        try:
+            oSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1);
+        except:
+            reporter.errorXcpt('socket.listen(1) failed');
+            return None;
+
+        # Bind the socket and make it listen.
+        try:
+            oSocket.bind((self.sHostname, self.uPort));
+        except:
+            reporter.errorXcpt('socket.bind((%s,%s)) failed' % (self.sHostname, self.uPort));
+            return None;
+        try:
+            oSocket.listen(1);
+        except:
+            reporter.errorXcpt('socket.listen(1) failed');
+            return None;
+
+        # Accept connections.
+        oClientSocket = None;
+        tClientAddr   = None;
+        try:
+            (oClientSocket, tClientAddr) = oSocket.accept();
+        except socket.error, e:
+            if not self.__isInProgressXcpt(e):
+                raise;
+
+            # Do the actual waiting.
+            reporter.log2('TransportTcp::accept: operation in progress (%s)...' % (e,));
+            try:
+                select.select([oSocket, oWakeupR], [], [oSocket, oWakeupR], cMsTimeout / 1000.0);
+            except socket.error, e:
+                if e[0] != errno.EBADF  or  not self.fConnectCanceled:
+                    raise;
+                reporter.log('socket.select() on accept was canceled');
+                return None;
+            except:
+                reporter.logXcpt('socket.select() on accept');
+
+            # Try accept again.
+            try:
+                (oClientSocket, tClientAddr) = oSocket.accept();
+            except socket.error, e:
+                if not self.__isInProgressXcpt(e):
+                    if e[0] != errno.EBADF  or  not self.fConnectCanceled:
+                        raise;
+                    reporter.log('socket.accept() was canceled');
+                    return None;
+                reporter.log('socket.accept() timed out');
+                return False;
+            except:
+                reporter.errorXcpt('socket.accept() failed');
+                return None;
+        except:
+            reporter.errorXcpt('socket.accept() failed');
+            return None;
+
+        # Store the connected socket and throw away the server socket.
+        self.oCv.acquire();
+        if not self.fConnectCanceled:
+            self.oSocket.close();
+            self.oSocket = oClientSocket;
+            self.sHostname = "%s:%s" % (tClientAddr[0], tClientAddr[1]);
+        self.oCv.release();
+        return True;
+
+    def _connectAsClient(self, oSocket, oWakeupR, cMsTimeout):
+        """ Connects to the TXS server as client. """
+        assert(not self.fReversedSetup);
+
+        # Connect w/ timeouts.
+        rc = None;
+        try:
+            oSocket.connect((self.sHostname, self.uPort));
+            rc = True;
+        except socket.error, e:
+            iRc = e[0];
+            if self.__isInProgressXcpt(e):
+                # Do the actual waiting.
+                reporter.log2('TransportTcp::connect: operation in progress (%s)...' % (e,));
+                try:
+                    ttRc = select.select([oWakeupR], [oSocket], [oSocket, oWakeupR], cMsTimeout / 1000.0);
+                    if len(ttRc[1]) + len(ttRc[2]) == 0:
+                        raise socket.error(errno.ETIMEDOUT, 'select timed out');
+                    iRc = oSocket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR);
+                    rc = iRc == 0;
+                except socket.error, e:
+                    iRc = e[0];
+                except:
+                    iRc = -42;
+                    reporter.fatalXcpt('socket.select() on connect failed');
+
+            if rc is True:
+                pass;
+            elif  iRc == errno.ECONNREFUSED \
+               or iRc == errno.EHOSTUNREACH \
+               or iRc == errno.EINTR \
+               or iRc == errno.ENETDOWN \
+               or iRc == errno.ENETUNREACH \
+               or iRc == errno.ETIMEDOUT:
+                rc = False; # try again.
+            else:
+                if iRc != errno.EBADF  or  not self.fConnectCanceled:
+                    reporter.fatalXcpt('socket.connect((%s,%s)) failed; iRc=%s' % (self.sHostname, self.uPort, iRc));
+            reporter.log2('TransportTcp::connect: rc=%s iRc=%s' % (rc, iRc));
+        except:
+            reporter.fatalXcpt('socket.connect((%s,%s)) failed' % (self.sHostname, self.uPort));
+        return rc;
+
+
+    def connect(self, cMsTimeout):
+        # Create a non-blocking socket.
+        reporter.log2('TransportTcp::connect: cMsTimeout=%s sHostname=%s uPort=%s' % (cMsTimeout, self.sHostname, self.uPort));
+        try:
+            oSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0);
+        except:
+            reporter.fatalXcpt('socket.socket() failed');
+            return None;
+        try:
+            oSocket.setblocking(0);
+        except:
+            oSocket.close();
+            reporter.fatalXcpt('socket.socket() failed');
+            return None;
+
+        # Create wakeup socket pair for unix (select doesn't wake up on socket close on Linux).
+        oWakeupR = None;
+        oWakeupW = None;
+        if hasattr(socket, 'socketpair'):
+            try:    (oWakeupR, oWakeupW) = socket.socketpair();         # pylint: disable=E1101
+            except: reporter.logXcpt('socket.socketpair() failed');
+
+        # Update the state.
+        self.oCv.acquire();
+        rc = None;
+        if not self.fConnectCanceled:
+            self.oSocket       = oSocket;
+            self.oWakeupW      = oWakeupW;
+            self.oWakeupR      = oWakeupR;
+            self.fIsConnecting = True;
+            self.oCv.release();
+
+            # Try connect.
+            if oWakeupR is None:
+                oWakeupR = oSocket; # Avoid select failure.
+            if self.fReversedSetup:
+                rc = self._connectAsServer(oSocket, oWakeupR, cMsTimeout);
+            else:
+                rc = self._connectAsClient(oSocket, oWakeupR, cMsTimeout);
+            oSocket = None;
+
+            # Update the state and cleanup on failure/cancel.
+            self.oCv.acquire();
+            if rc is True  and  self.fConnectCanceled:
+                rc = False;
+            self.fIsConnecting = False;
+
+        if rc is not True:
+            if self.oSocket is not None:
+                self.oSocket.close();
+                self.oSocket = None;
+            self._closeWakeupSockets();
+        self.oCv.release();
+
+        reporter.log2('TransportTcp::connect: returning %s' % (rc,));
+        return rc;
+
+    def disconnect(self, fQuiet = False):
+        if self.oSocket is not None:
+            self.abReadAhead = array.array('B');
+
+            # Try a shutting down the socket gracefully (draining it).
+            try:
+                self.oSocket.shutdown(socket.SHUT_WR);
+            except:
+                if not fQuiet:
+                    reporter.error('shutdown(SHUT_WR)');
+            try:
+                self.oSocket.setblocking(0);    # just in case it's not set.
+                sData = "1";
+                while len(sData) > 0:
+                    sData = self.oSocket.recv(16384);
+            except:
+                pass;
+
+            # Close it.
+            self.oCv.acquire();
+            try:    self.oSocket.setblocking(1);
+            except: pass;
+            self.oSocket.close();
+            self.oSocket = None;
+        else:
+            self.oCv.acquire();
+        self._closeWakeupSockets();
+        self.oCv.release();
+
+    def sendBytes(self, abMsg, cMsTimeout):
+        if self.oSocket is None:
+            reporter.error('TransportTcp.sendBytes: No connection.');
+            return False;
+
+        # Try send it all.
+        try:
+            cbSent = self.oSocket.send(abMsg);
+            if cbSent == len(abMsg):
+                return True;
+        except Exception, oXcpt:
+            if not self.__isWouldBlockXcpt(oXcpt):
+                reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(abMsg)));
+                return False;
+            cbSent = 0;
+
+        # Do a timed send.
+        msStart = base.timestampMilli();
+        while True:
+            cMsElapsed = base.timestampMilli() - msStart;
+            if cMsElapsed > cMsTimeout:
+                reporter.error('TranportTcp.sendBytes: %s bytes timed out (1)' % (len(abMsg)));
+                break;
+
+            # wait.
+            try:
+                ttRc = select.select([], [self.oSocket], [self.oSocket], (cMsTimeout - cMsElapsed) / 1000.0);
+                if len(ttRc[2]) > 0 and len(ttRc[1]) == 0:
+                    reporter.error('TranportTcp.sendBytes: select returned with exception');
+                    break;
+                if len(ttRc[1]) == 0:
+                    reporter.error('TranportTcp.sendBytes: %s bytes timed out (2)' % (len(abMsg)));
+                    break;
+            except:
+                reporter.errorXcpt('TranportTcp.sendBytes: select failed');
+                break;
+
+            # Try send more.
+            try:
+                cbSent += self.oSocket.send(abMsg[cbSent:]);
+                if cbSent == len(abMsg):
+                    return True;
+            except Exception, oXcpt:
+                if not self.__isWouldBlockXcpt(oXcpt):
+                    reporter.errorXcpt('TranportTcp.sendBytes: %s bytes' % (len(abMsg)));
+                    break;
+
+        return False;
+
+    def __returnReadAheadBytes(self, cb):
+        """ Internal worker for recvBytes. """
+        assert(len(self.abReadAhead) >= cb);
+        abRet = self.abReadAhead[:cb];
+        self.abReadAhead = self.abReadAhead[cb:];
+        return abRet;
+
+    def recvBytes(self, cb, cMsTimeout, fNoDataOk):
+        if self.oSocket is None:
+            reporter.error('TransportTcp.recvBytes(%s,%s): No connection.' % (cb, cMsTimeout));
+            return None;
+
+        # Try read in some more data without bothering with timeout handling first.
+        if len(self.abReadAhead) < cb:
+            try:
+                abBuf = self.oSocket.recv(cb - len(self.abReadAhead));
+                if len(abBuf) > 0:
+                    self.abReadAhead.extend(array.array('B', abBuf));
+            except Exception, oXcpt:
+                if not self.__isWouldBlockXcpt(oXcpt):
+                    reporter.errorXcpt('TranportTcp.recvBytes: 0/%s bytes' % (cb,));
+                    return None;
+
+        if len(self.abReadAhead) >= cb:
+            return self.__returnReadAheadBytes(cb);
+
+        # Timeout loop.
+        msStart = base.timestampMilli();
+        while True:
+            cMsElapsed = base.timestampMilli() - msStart;
+            if cMsElapsed > cMsTimeout:
+                if not fNoDataOk or len(self.abReadAhead) > 0:
+                    reporter.error('TranportTcp.recvBytes: %s/%s bytes timed out (1)' % (len(self.abReadAhead), cb));
+                break;
+
+            # Wait.
+            try:
+                ttRc = select.select([self.oSocket], [], [self.oSocket], (cMsTimeout - cMsElapsed) / 1000.0);
+                if len(ttRc[2]) > 0 and len(ttRc[0]) == 0:
+                    reporter.error('TranportTcp.recvBytes: select returned with exception');
+                    break;
+                if len(ttRc[0]) == 0:
+                    if not fNoDataOk or len(self.abReadAhead) > 0:
+                        reporter.error('TranportTcp.recvBytes: %s/%s bytes timed out (2) fNoDataOk=%s'
+                                       % (len(self.abReadAhead), cb, fNoDataOk));
+                    break;
+            except:
+                reporter.errorXcpt('TranportTcp.recvBytes: select failed');
+                break;
+
+            # Try read more.
+            try:
+                abBuf = self.oSocket.recv(cb - len(self.abReadAhead));
+                if len(abBuf) == 0:
+                    reporter.error('TranportTcp.recvBytes: %s/%s bytes (%s) - connection has been shut down'
+                                   % (len(self.abReadAhead), cb, fNoDataOk));
+                    self.disconnect();
+                    return None;
+
+                self.abReadAhead.extend(array.array('B', abBuf));
+
+            except Exception, oXcpt:
+                reporter.log('recv => exception %s' % (oXcpt,));
+                if not self.__isWouldBlockXcpt(oXcpt):
+                    if not fNoDataOk  or  not self.__isConnectionReset(oXcpt)  or  len(self.abReadAhead) > 0:
+                        reporter.errorXcpt('TranportTcp.recvBytes: %s/%s bytes (%s)' % (len(self.abReadAhead), cb, fNoDataOk));
+                    break;
+
+            # Done?
+            if len(self.abReadAhead) >= cb:
+                return self.__returnReadAheadBytes(cb);
+
+        #reporter.log('recv => None len(self.abReadAhead) -> %d' % (len(self.abReadAhead), ));
+        return None;
+
+    def isConnectionOk(self):
+        if self.oSocket is None:
+            return False;
+        try:
+            ttRc = select.select([], [], [self.oSocket], 0.0);
+            if len(ttRc[2]) > 0:
+                return False;
+
+            self.oSocket.send(array.array('B')); # send zero bytes.
+        except:
+            return False;
+        return True;
+
+    def isRecvPending(self, cMsTimeout = 0):
+        try:
+            ttRc = select.select([self.oSocket], [], [], cMsTimeout / 1000.0);
+            if len(ttRc[0]) == 0:
+                return False;
+        except:
+            pass;
+        return True;
+
+
+def openTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0):
+    """
+    Opens a connection to a Test Execution Service via TCP, given its name.
+    """
+    reporter.log2('openTcpSession(%s, %s, %s, %s, %s)' % \
+                  (cMsTimeout, sHostname, uPort, fReversedSetup, cMsIdleFudge));
+    try:
+        oTransport = TransportTcp(sHostname, uPort, fReversedSetup);
+        oSession = Session(oTransport, cMsTimeout, cMsIdleFudge);
+    except:
+        reporter.errorXcpt(None, 15);
+        return None;
+    return oSession;
+
+
+def tryOpenTcpSession(cMsTimeout, sHostname, uPort = None, fReversedSetup = False, cMsIdleFudge = 0):
+    """
+    Tries to open a connection to a Test Execution Service via TCP, given its name.
+
+    This differs from openTcpSession in that it won't log a connection failure
+    as an error.
+    """
+    try:
+        oTransport = TransportTcp(sHostname, uPort, fReversedSetup);
+        oSession = Session(oTransport, cMsTimeout, cMsIdleFudge, fTryConnect = True);
+    except:
+        reporter.errorXcpt(None, 15);
+        return None;
+    return oSession;
+
diff --git a/src/VBox/ValidationKit/testdriver/vbox.py b/src/VBox/ValidationKit/testdriver/vbox.py
new file mode 100644
index 0000000..d3e68f3
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/vbox.py
@@ -0,0 +1,3233 @@
+# -*- coding: utf-8 -*-
+# $Id: vbox.py $
+# pylint: disable=C0302
+
+"""
+VirtualBox Specific base testdriver.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2015 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 100279 $"
+
+
+# Standard Python imports.
+import os
+import platform
+import sys
+import threading
+import time
+import traceback
+import datetime
+
+# Figure out where the validation kit lives and make sure it's in the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)));
+if g_ksValidationKitDir not in sys.path:
+    sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from common     import utils;
+from testdriver import base;
+from testdriver import reporter;
+from testdriver import vboxcon;
+from testdriver import vboxtestvms;
+
+
+#
+# Exception and Error Unification Hacks.
+# Note! This is pretty gross stuff. Be warned!
+# TODO: Find better ways of doing these things, preferrably in vboxapi.
+#
+
+ComException = None;                                                            # pylint: disable=C0103
+__fnComExceptionGetAttr__ = None;                                               # pylint: disable=C0103
+
+def __MyDefaultGetAttr(oSelf, sName):
+    """ __getattribute__/__getattr__ default fake."""
+    try:
+        oAttr = oSelf.__dict__[sName];
+    except:
+        oAttr = dir(oSelf)[sName];
+    return oAttr;
+
+def __MyComExceptionGetAttr(oSelf, sName):
+    """ ComException.__getattr__ wrapper - both XPCOM and COM.  """
+    try:
+        oAttr = __fnComExceptionGetAttr__(oSelf, sName);
+    except AttributeError:
+        if platform.system() == 'Windows':
+            if sName == 'errno':
+                oAttr = __fnComExceptionGetAttr__(oSelf, 'hresult');
+            elif sName == 'msg':
+                oAttr = __fnComExceptionGetAttr__(oSelf, 'strerror');
+            else:
+                raise;
+        else:
+            if sName == 'hresult':
+                oAttr = __fnComExceptionGetAttr__(oSelf, 'errno');
+            elif sName == 'strerror':
+                oAttr = __fnComExceptionGetAttr__(oSelf, 'msg');
+            elif sName == 'excepinfo':
+                oAttr = None;
+            elif sName == 'argerror':
+                oAttr = None;
+            else:
+                raise;
+    #print '__MyComExceptionGetAttr(,%s) -> "%s"' % (sName, oAttr);
+    return oAttr;
+
+def __deployExceptionHacks__(oNativeComExceptionClass):
+    """
+    Deploys the exception and error hacks that helps unifying COM and XPCOM
+    exceptions and errors.
+    """
+    global ComException                                                         # pylint: disable=C0103
+    global __fnComExceptionGetAttr__                                            # pylint: disable=C0103
+
+    # Hook up our attribute getter for the exception class (ASSUMES new-style).
+    if __fnComExceptionGetAttr__ is None:
+        try:
+            __fnComExceptionGetAttr__ = getattr(oNativeComExceptionClass, '__getattr__');
+        except:
+            try:
+                __fnComExceptionGetAttr__ = getattr(oNativeComExceptionClass, '__getattribute__');
+            except:
+                __fnComExceptionGetAttr__ = __MyDefaultGetAttr;
+        setattr(oNativeComExceptionClass, '__getattr__', __MyComExceptionGetAttr)
+
+    # Make the modified classes accessible (are there better ways to do this?)
+    ComException = oNativeComExceptionClass
+    return None;
+
+
+
+#
+# Utility functions.
+#
+
+def isIpAddrValid(sIpAddr):
+    """
+    Checks if a IPv4 address looks valid.   This will return false for
+    localhost and similar.
+    Returns True / False.
+    """
+    if sIpAddr is None:                 return False;
+    if len(sIpAddr.split('.')) != 4:    return False;
+    if sIpAddr.endswith('.0'):          return False;
+    if sIpAddr.endswith('.255'):        return False;
+    if sIpAddr.startswith('127.'):      return False;
+    if sIpAddr.startswith('169.254.'):  return False;
+    if sIpAddr.startswith('192.0.2.'):  return False;
+    if sIpAddr.startswith('224.0.0.'):  return False;
+    return True;
+
+def stringifyErrorInfo(oErrInfo):
+    """
+    Stringifies the error information in a IVirtualBoxErrorInfo object.
+
+    Returns string with error info.
+    """
+    try:
+        rc          = oErrInfo.resultCode;
+        sText       = oErrInfo.text;
+        sIid        = oErrInfo.interfaceID;
+        sComponent  = oErrInfo.component;
+    except:
+        sRet = 'bad error object (%s)?' % (oErrInfo,);
+        traceback.print_exc();
+    else:
+        sRet = 'rc=%s text="%s" IID=%s component=%s' % (ComError.toString(rc), sText, sIid, sComponent);
+    return sRet;
+
+def reportError(oErr, sText):
+    """
+    Report a VirtualBox error on oErr.  oErr can be IVirtualBoxErrorInfo
+    or IProgress.  Anything else is ignored.
+
+    Returns the same a reporter.error().
+    """
+    try:
+        oErrObj = oErr.errorInfo;   # IProgress.
+    except:
+        oErrObj = oErr;
+    reporter.error(sText);
+    return reporter.error(stringifyErrorInfo(oErrObj));
+
+
+#
+# Classes
+#
+
+class ComError(object):
+    """
+    Unified COM and XPCOM status code repository.
+    This works more like a module than a class since it's replacing a module.
+    """
+
+    # The VBOX_E_XXX bits:
+    __VBOX_E_BASE = -2135228416;
+    VBOX_E_OBJECT_NOT_FOUND         = __VBOX_E_BASE + 1;
+    VBOX_E_INVALID_VM_STATE         = __VBOX_E_BASE + 2;
+    VBOX_E_VM_ERROR                 = __VBOX_E_BASE + 3;
+    VBOX_E_FILE_ERROR               = __VBOX_E_BASE + 4;
+    VBOX_E_IPRT_ERROR               = __VBOX_E_BASE + 5;
+    VBOX_E_PDM_ERROR                = __VBOX_E_BASE + 6;
+    VBOX_E_INVALID_OBJECT_STATE     = __VBOX_E_BASE + 7;
+    VBOX_E_HOST_ERROR               = __VBOX_E_BASE + 8;
+    VBOX_E_NOT_SUPPORTED            = __VBOX_E_BASE + 9;
+    VBOX_E_XML_ERROR                = __VBOX_E_BASE + 10;
+    VBOX_E_INVALID_SESSION_STATE    = __VBOX_E_BASE + 11;
+    VBOX_E_OBJECT_IN_USE            = __VBOX_E_BASE + 12;
+    VBOX_E_DONT_CALL_AGAIN          = __VBOX_E_BASE + 13;
+
+    # Reverse lookup table.
+    dDecimalToConst = {}; # pylint: disable=C0103
+
+    def __init__(self):
+        raise base.GenError('No instances, please');
+
+    @staticmethod
+    def copyErrors(oNativeComErrorClass):
+        """
+        Copy all error codes from oNativeComErrorClass to this class and
+        install compatability mappings.
+        """
+
+        # First, add the VBOX_E_XXX constants to dDecimalToConst.
+        for sAttr in dir(ComError):
+            if sAttr.startswith('VBOX_E'):
+                oAttr = getattr(ComError, sAttr);
+                ComError.dDecimalToConst[oAttr] = sAttr;
+
+        # Copy all error codes from oNativeComErrorClass to this class.
+        for sAttr in dir(oNativeComErrorClass):
+            if sAttr[0].isupper():
+                oAttr = getattr(oNativeComErrorClass, sAttr);
+                setattr(ComError, sAttr, oAttr);
+                if type(oAttr) is int:
+                    ComError.dDecimalToConst[oAttr] = sAttr;
+
+        # Install mappings to the other platform.
+        if platform.system() == 'Windows':
+            ComError.NS_OK = ComError.S_OK;
+            ComError.NS_ERROR_FAILURE         = ComError.E_FAIL;
+            ComError.NS_ERROR_ABORT           = ComError.E_ABORT;
+            ComError.NS_ERROR_NULL_POINTER    = ComError.E_POINTER;
+            ComError.NS_ERROR_NO_INTERFACE    = ComError.E_NOINTERFACE;
+            ComError.NS_ERROR_INVALID_ARG     = ComError.E_INVALIDARG;
+            ComError.NS_ERROR_OUT_OF_MEMORY   = ComError.E_OUTOFMEMORY;
+            ComError.NS_ERROR_NOT_IMPLEMENTED = ComError.E_NOTIMPL;
+            ComError.NS_ERROR_UNEXPECTED      = ComError.E_UNEXPECTED;
+        else:
+            ComError.E_ACCESSDENIED           = -2147024891; # see VBox/com/defs.h
+            ComError.S_OK                     = ComError.NS_OK;
+            ComError.E_FAIL                   = ComError.NS_ERROR_FAILURE;
+            ComError.E_ABORT                  = ComError.NS_ERROR_ABORT;
+            ComError.E_POINTER                = ComError.NS_ERROR_NULL_POINTER;
+            ComError.E_NOINTERFACE            = ComError.NS_ERROR_NO_INTERFACE;
+            ComError.E_INVALIDARG             = ComError.NS_ERROR_INVALID_ARG;
+            ComError.E_OUTOFMEMORY            = ComError.NS_ERROR_OUT_OF_MEMORY;
+            ComError.E_NOTIMPL                = ComError.NS_ERROR_NOT_IMPLEMENTED;
+            ComError.E_UNEXPECTED             = ComError.NS_ERROR_UNEXPECTED;
+            ComError.DISP_E_EXCEPTION         = -2147352567; # For COM compatability only.
+        return True;
+
+    @staticmethod
+    def equal(oXcpt, hr):
+        """
+        Checks if the ComException e is not equal to the COM status code hr.
+        This takes DISP_E_EXCEPTION & excepinfo into account.
+
+        This method can be used with any Exception derivate, however it will
+        only return True for classes similar to the two ComException variants.
+        """
+        if platform.system() == 'Windows':
+            # The DISP_E_EXCEPTION + excptinfo fun needs checking up, only
+            # empirical info on it so far.
+            try:
+                hrXcpt = oXcpt.hresult;
+            except AttributeError:
+                return False;
+            if hrXcpt == ComError.DISP_E_EXCEPTION and oXcpt.excepinfo is not None:
+                hrXcpt = oXcpt.excepinfo[5];
+        else:
+            try:
+                hrXcpt = oXcpt.errno;
+            except AttributeError:
+                return False;
+        return hrXcpt == hr;
+
+    @staticmethod
+    def notEqual(oXcpt, hr):
+        """
+        Checks if the ComException e is not equal to the COM status code hr.
+        See equal() for more details.
+        """
+        return not ComError.equal(oXcpt, hr)
+
+    @staticmethod
+    def toString(hr):
+        """
+        Converts the specified COM status code to a string.
+        """
+        try:
+            sStr = ComError.dDecimalToConst[int(hr)];
+        except KeyError:
+            hrLong = long(hr);
+            sStr = '%#x (%d)' % (hrLong, hrLong);
+        return sStr;
+
+
+class Build(object): # pylint: disable=R0903
+    """
+    A VirtualBox build.
+
+    Note! After dropping the installation of VBox from this code and instead
+          realizing that with the vboxinstall.py wrapper driver, this class is
+          of much less importance and contains unnecessary bits and pieces.
+    """
+
+    def __init__(self, oDriver, strInstallPath):
+        """
+        Construct a build object from a build file name and/or install path.
+        """
+        # Initialize all members first.
+        self.oDriver      = oDriver;
+        self.sInstallPath = strInstallPath;
+        self.sSdkPath     = None;
+        self.sSrcRoot     = None;
+        self.sKind        = None;
+        self.sDesignation = None;
+        self.sType        = None;
+        self.sOs          = None;
+        self.sArch        = None;
+        self.sGuestAdditionsIso = None;
+
+        # Figure out the values as best we can.
+        if strInstallPath is None:
+            #
+            # Both parameters are None, which means we're falling back on a
+            # build in the development tree.
+            #
+            self.sKind = "development";
+
+            if self.sType is None:
+                self.sType = os.environ.get("KBUILD_TYPE",        os.environ.get("BUILD_TYPE",        "release"));
+            if self.sOs is None:
+                self.sOs   = os.environ.get("KBUILD_TARGET",      os.environ.get("BUILD_TARGET",      oDriver.sHost));
+            if self.sArch is None:
+                self.sArch = os.environ.get("KBUILD_TARGET_ARCH", os.environ.get("BUILD_TARGET_ARCH", oDriver.sHostArch));
+
+            sOut = os.path.join('out', self.sOs + '.' + self.sArch, self.sType);
+            sSearch = os.environ.get('VBOX_TD_DEV_TREE', os.path.dirname(__file__)); # Env.var. for older trees or testboxscript.
+            sCandidat = None;
+            for i in range(0, 10):                                          # pylint: disable=W0612
+                sBldDir = os.path.join(sSearch, sOut);
+                if os.path.isdir(sBldDir):
+                    sCandidat = os.path.join(sBldDir, 'bin', 'VBoxSVC' + base.exeSuff());
+                    if os.path.isfile(sCandidat):
+                        self.sSdkPath = os.path.join(sBldDir, 'bin/sdk');
+                        break;
+                    sCandidat = os.path.join(sBldDir, 'dist/VirtualBox.app/Contents/MacOS/VBoxSVC');
+                    if os.path.isfile(sCandidat):
+                        self.sSdkPath = os.path.join(sBldDir, 'dist/sdk');
+                        break;
+                sSearch = os.path.abspath(os.path.join(sSearch, '..'));
+            if sCandidat is None or not os.path.isfile(sCandidat):
+                raise base.GenError();
+            self.sInstallPath = os.path.abspath(os.path.dirname(sCandidat));
+            self.sSrcRoot     = os.path.abspath(sSearch);
+
+            self.sDesignation = os.environ.get('TEST_BUILD_DESIGNATION', None);
+            if self.sDesignation is None:
+                try:
+                    oFile = utils.openNoInherit(os.path.join(self.sSrcRoot, sOut, 'revision.kmk'), 'r');
+                except:
+                    pass;
+                else:
+                    s = oFile.readline();
+                    oFile.close();
+                    import re;
+                    oMatch = re.search("VBOX_SVN_REV=(\\d+)", s);
+                    if oMatch is not None:
+                        self.sDesignation = oMatch.group(1);
+
+                if self.sDesignation is None:
+                    self.sDesignation = 'XXXXX'
+        else:
+            #
+            # We've been pointed to an existing installation, this could be
+            # in the out dir of a svn checkout, untarred VBoxAll or a real
+            # installation directory.
+            #
+            self.sKind        = "preinstalled";
+            self.sType        = "release";
+            self.sOs          = oDriver.sHost;
+            self.sArch        = oDriver.sHostArch;
+            self.sInstallPath = os.path.abspath(strInstallPath);
+            self.sSdkPath     = os.path.join(self.sInstallPath, 'sdk');
+            self.sSrcRoot     = None;
+            self.sDesignation = os.environ.get('TEST_BUILD_DESIGNATION', 'XXXXX');
+            ## @todo Much more work is required here.
+
+            # Do some checks.
+            sVMMR0 = os.path.join(self.sInstallPath, 'VMMR0.r0');
+            if not os.path.isfile(sVMMR0) and utils.getHostOs() == 'solaris': # solaris is special.
+                sVMMR0 = os.path.join(self.sInstallPath, 'amd64' if utils.getHostArch() == 'amd64' else 'i386', 'VMMR0.r0');
+            if not os.path.isfile(sVMMR0):
+                raise base.GenError('%s is missing' % (sVMMR0,));
+
+        # Guest additions location is different on windows for some _stupid_ reason.
+        if self.sOs == 'win' and self.sKind != 'development':
+            self.sGuestAdditionsIso = '%s/VBoxGuestAdditions.iso' % (self.sInstallPath,);
+        elif self.sOs == 'darwin':
+            self.sGuestAdditionsIso = '%s/VBoxGuestAdditions.iso' % (self.sInstallPath,);
+        else:
+            self.sGuestAdditionsIso = '%s/additions/VBoxGuestAdditions.iso' % (self.sInstallPath,);
+
+        # __init__ end;
+
+    def dump(self):
+        """ Status dumper for debugging. """
+        print >> sys.stderr, "testdriver.vbox.Build: sInstallPath= '%s'" % self.sInstallPath;
+        print >> sys.stderr, "testdriver.vbox.Build: sSdkPath    = '%s'" % self.sSdkPath;
+        print >> sys.stderr, "testdriver.vbox.Build: sSrcRoot    = '%s'" % self.sSrcRoot;
+        print >> sys.stderr, "testdriver.vbox.Build: sKind       = '%s'" % self.sKind;
+        print >> sys.stderr, "testdriver.vbox.Build: sDesignation= '%s'" % self.sDesignation;
+        print >> sys.stderr, "testdriver.vbox.Build: sType       = '%s'" % self.sType;
+        print >> sys.stderr, "testdriver.vbox.Build: sOs         = '%s'" % self.sOs;
+        print >> sys.stderr, "testdriver.vbox.Build: sArch       = '%s'" % self.sArch;
+
+    def isDevBuild(self):
+        """ Returns True if it's development build (kind), otherwise False. """
+        return self.sKind == 'development';
+
+
+class EventHandlerBase(object):
+    """
+    Base class for both Console and VirtualBox event handlers.
+    """
+
+    def __init__(self, dArgs, fpApiVer, sName = None):
+        self.oVBoxMgr   = dArgs['oVBoxMgr'];
+        self.oEventSrc  = dArgs['oEventSrc']; # Console/VirtualBox for < 3.3
+        self.oListener  = dArgs['oListener'];
+        self.fPassive   = self.oListener != None;
+        self.sName      = sName
+        self.fShutdown  = False;
+        self.oThread    = None;
+        self.fpApiVer   = fpApiVer;
+
+    def threadForPassiveMode(self):
+        """
+        The thread procedure for the event processing thread.
+        """
+        assert self.fPassive is not None;
+        while not self.fShutdown:
+            try:
+                oEvt = self.oEventSrc.getEvent(self.oListener, 500);
+            except:
+                if not self.oVBoxMgr.xcptIsDeadInterface(): reporter.logXcpt();
+                else: reporter.log('threadForPassiveMode/%s: interface croaked (ignored)' % (self.sName,));
+                break;
+            if oEvt:
+                self.handleEvent(oEvt);
+                try:
+                    self.oEventSrc.eventProcessed(self.oListener, oEvt);
+                except:
+                    reporter.logXcpt();
+                    break;
+        self.unregister(fWaitForThread = False);
+        return None;
+
+    def startThreadForPassiveMode(self):
+        """
+        Called when working in passive mode.
+        """
+        self.oThread = threading.Thread(target = self.threadForPassiveMode, \
+            args=(), name=('PAS-%s' % (self.sName,)));
+        self.oThread.setDaemon(True)
+        self.oThread.start();
+        return None;
+
+    def unregister(self, fWaitForThread = True):
+        """
+        Unregister the event handler.
+        """
+        self.fShutdown = True;
+
+        fRc = False;
+        if self.oEventSrc is not None:
+            if self.fpApiVer < 3.3:
+                try:
+                    self.oEventSrc.unregisterCallback(self.oListener);
+                    fRc = True;
+                except:
+                    reporter.errorXcpt('unregisterCallback failed on %s' % (self.oListener,));
+            else:
+                try:
+                    self.oEventSrc.unregisterListener(self.oListener);
+                    fRc = True;
+                except:
+                    if self.oVBoxMgr.xcptIsDeadInterface():
+                        reporter.log('unregisterListener failed on %s because of dead interface (%s)'
+                                     % (self.oListener, self.oVBoxMgr.xcptToString(),));
+                    else:
+                        reporter.errorXcpt('unregisterListener failed on %s' % (self.oListener,));
+
+        if    self.oThread is not None \
+          and self.oThread != threading.current_thread():
+            self.oThread.join();
+            self.oThread = None;
+
+        _ = fWaitForThread;
+        return fRc;
+
+    def handleEvent(self, oEvt):
+        """
+        Compatibility wrapper that child classes implement.
+        """
+        _ = oEvt;
+        return None;
+
+    @staticmethod
+    def registerDerivedEventHandler(oVBoxMgr, fpApiVer, oSubClass, dArgsCopy,
+                                    oSrcParent, sSrcParentNm, sICallbackNm,
+                                    fMustSucceed = True, sLogSuffix = ''):
+        """
+        Registers the callback / event listener.
+        """
+        dArgsCopy['oVBoxMgr'] = oVBoxMgr;
+        dArgsCopy['oListener'] = None;
+        if fpApiVer < 3.3:
+            dArgsCopy['oEventSrc'] = oSrcParent;
+            try:
+                oRet = oVBoxMgr.createCallback(sICallbackNm, oSubClass, dArgsCopy);
+            except:
+                reporter.errorXcpt('%s::registerCallback(%s) failed%s' % (sSrcParentNm, oRet, sLogSuffix));
+            else:
+                try:
+                    oSrcParent.registerCallback(oRet);
+                    return oRet;
+                except Exception, oXcpt:
+                    if fMustSucceed or ComError.notEqual(oXcpt, ComError.E_UNEXPECTED):
+                        reporter.errorXcpt('%s::registerCallback(%s)%s' % (sSrcParentNm, oRet, sLogSuffix));
+        else:
+            fPassive = sys.platform == 'win32'; # or webservices.
+            try:
+                oEventSrc = oSrcParent.eventSource;
+                dArgsCopy['oEventSrc'] = oEventSrc;
+                if not fPassive:
+                    oListener = oRet = oVBoxMgr.createListener(oSubClass, dArgsCopy);
+                else:
+                    oListener = oEventSrc.createListener();
+                    dArgsCopy['oListener'] = oListener;
+                    oRet = oSubClass(dArgsCopy);
+            except:
+                reporter.errorXcpt('%s::eventSource.createListener(%s) failed%s' % (sSrcParentNm, oListener, sLogSuffix));
+            else:
+                try:
+                    oEventSrc.registerListener(oListener, [vboxcon.VBoxEventType_Any], not fPassive);
+                except Exception, oXcpt:
+                    if fMustSucceed or ComError.notEqual(oXcpt, ComError.E_UNEXPECTED):
+                        reporter.errorXcpt('%s::eventSource.registerListener(%s) failed%s' \
+                                           % (sSrcParentNm, oListener, sLogSuffix));
+                else:
+                    if not fPassive:
+                        if sys.platform == 'win32':
+                            from win32com.server.util import unwrap # pylint: disable=F0401
+                            oRet = unwrap(oRet);
+                        oRet.oListener = oListener;
+                    else:
+                        oRet.startThreadForPassiveMode();
+                    return oRet;
+        return None;
+
+
+
+
+class ConsoleEventHandlerBase(EventHandlerBase):
+    """
+    Base class for handling IConsole events.
+
+    The class has IConsoleCallback (<=3.2) compatible callback methods which
+    the user can override as needed.
+
+    Note! This class must not inherit from object or we'll get type errors in VBoxPython.
+    """
+    def __init__(self, dArgs, sName = None):
+        self.oSession   = dArgs['oSession'];
+        self.oConsole   = dArgs['oConsole'];
+        if sName is None:
+            sName       = self.oSession.sName;
+        EventHandlerBase.__init__(self, dArgs, self.oSession.fpApiVer, sName);
+
+
+    # pylint: disable=C0111,R0913,W0613
+    def onMousePointerShapeChange(self, fVisible, fAlpha, xHot, yHot, cx, cy, abShape):
+        reporter.log2('onMousePointerShapeChange/%s' % (self.sName));
+    def onMouseCapabilityChange(self, fSupportsAbsolute, *aArgs): # Extra argument was added in 3.2.
+        reporter.log2('onMouseCapabilityChange/%s' % (self.sName));
+    def onKeyboardLedsChange(self, fNumLock, fCapsLock, fScrollLock):
+        reporter.log2('onKeyboardLedsChange/%s' % (self.sName));
+    def onStateChange(self, eState):
+        reporter.log2('onStateChange/%s' % (self.sName));
+    def onAdditionsStateChange(self):
+        reporter.log2('onAdditionsStateChange/%s' % (self.sName));
+    def onNetworkAdapterChange(self, oNic):
+        reporter.log2('onNetworkAdapterChange/%s' % (self.sName));
+    def onSerialPortChange(self, oPort):
+        reporter.log2('onSerialPortChange/%s' % (self.sName));
+    def onParallelPortChange(self, oPort):
+        reporter.log2('onParallelPortChange/%s' % (self.sName));
+    def onStorageControllerChange(self):
+        reporter.log2('onStorageControllerChange/%s' % (self.sName));
+    def onMediumChange(self, attachment):
+        reporter.log2('onMediumChange/%s' % (self.sName));
+    def onCPUChange(self, iCpu, fAdd):
+        reporter.log2('onCPUChange/%s' % (self.sName));
+    def onVRDPServerChange(self):
+        reporter.log2('onVRDPServerChange/%s' % (self.sName));
+    def onRemoteDisplayInfoChange(self):
+        reporter.log2('onRemoteDisplayInfoChange/%s' % (self.sName));
+    def onUSBControllerChange(self):
+        reporter.log2('onUSBControllerChange/%s' % (self.sName));
+    def onUSBDeviceStateChange(self, oDevice, fAttached, oError):
+        reporter.log2('onUSBDeviceStateChange/%s' % (self.sName));
+    def onSharedFolderChange(self, fGlobal):
+        reporter.log2('onSharedFolderChange/%s' % (self.sName));
+    def onRuntimeError(self, fFatal, sErrId, sMessage):
+        reporter.log2('onRuntimeError/%s' % (self.sName));
+    def onCanShowWindow(self):
+        reporter.log2('onCanShowWindow/%s' % (self.sName));
+        return True
+    def onShowWindow(self):
+        reporter.log2('onShowWindow/%s' % (self.sName));
+        return None;
+
+    # pylint: enable=C0111,R0913,W0613
+
+    def handleEvent(self, oEvt):
+        """
+        Compatibility wrapper.
+        """
+        try:
+            oEvtBase = self.oVBoxMgr.queryInterface(oEvt, 'IEvent');
+            eType = oEvtBase.type;
+        except:
+            reporter.logXcpt();
+            return None;
+        if eType == vboxcon.VBoxEventType_OnRuntimeError:
+            try:
+                oEvtIt = self.oVBoxMgr.queryInterface(oEvtBase, 'IRuntimeErrorEvent');
+                return self.onRuntimeError(oEvtIt.fatal, oEvtIt.id, oEvtIt.message)
+            except:
+                reporter.logXcpt();
+        ## @todo implement the other events.
+        if eType != vboxcon.VBoxEventType_OnMousePointerShapeChanged:
+            reporter.log2('%s/%s' % (str(eType), self.sName));
+        return None;
+
+
+class VirtualBoxEventHandlerBase(EventHandlerBase):
+    """
+    Base class for handling IVirtualBox events.
+
+    The class has IConsoleCallback (<=3.2) compatible callback methods which
+    the user can override as needed.
+
+    Note! This class must not inherit from object or we'll get type errors in VBoxPython.
+    """
+    def __init__(self, dArgs, sName = "emanon"):
+        self.oVBoxMgr  = dArgs['oVBoxMgr'];
+        self.oVBox     = dArgs['oVBox'];
+        EventHandlerBase.__init__(self, dArgs, self.oVBox.fpApiVer, sName);
+
+    # pylint: disable=C0111,W0613
+    def onMachineStateChange(self, sMachineId, eState):
+        pass;
+    def onMachineDataChange(self, sMachineId):
+        pass;
+    def onExtraDataCanChange(self, sMachineId, sKey, sValue):
+        # The COM bridge does tuples differently. Not very funny if you ask me... ;-)
+        if self.oVBoxMgr.type == 'MSCOM':
+            return '', 0, True;
+        return True, ''
+    def onExtraDataChange(self, sMachineId, sKey, sValue):
+        pass;
+    def onMediumRegistered(self, sMediumId, eMediumType, fRegistered):
+        pass;
+    def onMachineRegistered(self, sMachineId, fRegistered):
+        pass;
+    def onSessionStateChange(self, sMachineId, eState):
+        pass;
+    def onSnapshotTaken(self, sMachineId, sSnapshotId):
+        pass;
+    def onSnapshotDiscarded(self, sMachineId, sSnapshotId):
+        pass;
+    def onSnapshotChange(self, sMachineId, sSnapshotId):
+        pass;
+    def onGuestPropertyChange(self, sMachineId, sName, sValue, sFlags):
+        pass;
+    # pylint: enable=C0111,W0613
+
+    def handleEvent(self, oEvt):
+        """
+        Compatibility wrapper.
+        """
+        try:
+            oEvtBase = self.oVBoxMgr.queryInterface(oEvt, 'IEvent');
+            eType = oEvtBase.type;
+        except:
+            reporter.logXcpt();
+            return None;
+        if eType == vboxcon.VBoxEventType_OnMachineStateChanged:
+            try:
+                oEvtIt = self.oVBoxMgr.queryInterface(oEvtBase, 'IMachineStateChangedEvent');
+                return self.onMachineStateChange(oEvtIt.machineId, oEvtIt.state)
+            except:
+                reporter.logXcpt();
+        elif eType == vboxcon.VBoxEventType_OnGuestPropertyChanged:
+            try:
+                oEvtIt = self.oVBoxMgr.queryInterface(oEvtBase, 'IGuestPropertyChangedEvent');
+                return self.onGuestPropertyChange(oEvtIt.machineId, oEvtIt.name, oEvtIt.value, oEvtIt.flags);
+            except:
+                reporter.logXcpt();
+        ## @todo implement the other events.
+        reporter.log2('%s/%s' % (str(eType), self.sName));
+        return None;
+
+
+class SessionConsoleEventHandler(ConsoleEventHandlerBase):
+    """
+    For catching machine state changes and waking up the task machinery at that point.
+    """
+    def __init__(self, dArgs):
+        ConsoleEventHandlerBase.__init__(self, dArgs);
+
+    def onMachineStateChange(self, sMachineId, eState):                         # pylint: disable=W0613
+        """ Just interrupt the wait loop here so it can check again. """
+        self.oVBoxMgr.interruptWaitEvents();
+
+
+
+class TestDriver(base.TestDriver):                                              # pylint: disable=R0902
+    """
+    This is the VirtualBox test driver.
+    """
+
+    def __init__(self):
+        base.TestDriver.__init__(self);
+        self.fImportedVBoxApi   = False;
+        self.fpApiVer           = 3.2;
+        self.oBuild             = None;
+        self.oVBoxMgr           = None;
+        self.oVBox              = None;
+        self.aoRemoteSessions   = [];
+        self.aoVMs              = []; ## @todo not sure if this list will be of any use.
+        self.oTestVmManager     = vboxtestvms.TestVmManager(self.sResourcePath);
+        self.oTestVmSet         = vboxtestvms.TestVmSet();
+        self.sSessionTypeDef    = 'headless';
+        self.sSessionType       = self.sSessionTypeDef;
+        self.fEnableVrdp        = True;
+        self.uVrdpBasePortDef   = 6000;
+        self.uVrdpBasePort      = self.uVrdpBasePortDef;
+        self.sDefBridgedNic     = None;
+        self.fUseDefaultSvc     = False;
+        self.sLogSelfGroups     = '';
+        self.sLogSelfFlags      = 'time';
+        self.sLogSelfDest       = '';
+        self.sLogSessionGroups  = '';
+        self.sLogSessionFlags   = 'time';
+        self.sLogSessionDest    = '';
+        self.sLogSvcGroups      = '';
+        self.sLogSvcFlags       = 'time';
+        self.sLogSvcDest        = '';
+        self.sSelfLogFile       = None;
+        self.sVBoxSvcLogFile    = None;
+        self.oVBoxSvcProcess    = None;
+        self.sVBoxSvcPidFile    = None;
+        self.fVBoxSvcInDebugger = False;
+        self.sVBoxValidationKit     = None;
+        self.sVBoxValidationKitIso  = None;
+        self.sVBoxBootSectors   = None;
+        self.fAlwaysUploadLogs  = False;
+        self.fAlwaysUploadScreenshots = False;
+
+        # Quietly detect build and validation kit.
+        self._detectBuild(False);
+        self._detectValidationKit(False);
+
+        # Make sure all debug logs goes to the scratch area unless
+        # specified otherwise (more of this later on).
+        if 'VBOX_LOG_DEST' not in os.environ:
+            os.environ['VBOX_LOG_DEST'] = 'dir=%s' % (self.sScratchPath);
+
+    def dump(self):
+        """
+        Dump object state, for debugging.
+        """
+        base.TestDriver.dump(self);
+        print >> sys.stderr, "testdriver.vbox: fImportedVBoxApi  = '%s'" % self.fImportedVBoxApi;
+        print >> sys.stderr, "testdriver.vbox: fpApiVer          = '%s'" % self.fpApiVer;
+        print >> sys.stderr, "testdriver.vbox: oBuild            = '%s'" % self.oBuild;
+        print >> sys.stderr, "testdriver.vbox: oVBoxMgr          = '%s'" % self.oVBoxMgr;
+        print >> sys.stderr, "testdriver.vbox: oVBox             = '%s'" % self.oVBox;
+        print >> sys.stderr, "testdriver.vbox: aoRemoteSessions  = '%s'" % self.aoRemoteSessions;
+        print >> sys.stderr, "testdriver.vbox: aoVMs             = '%s'" % self.aoVMs;
+        print >> sys.stderr, "testdriver.vbox: sVBoxValidationKit    = '%s'" % self.sVBoxValidationKit;
+        print >> sys.stderr, "testdriver.vbox: sVBoxValidationKitIso = '%s'" % self.sVBoxValidationKitIso;
+        print >> sys.stderr, "testdriver.vbox: sVBoxBootSectors  = '%s'" % self.sVBoxBootSectors;
+        if self.oBuild is not None:
+            self.oBuild.dump();
+
+    def _detectBuild(self, fQuiet = False):
+        """
+        This is used internally to try figure a locally installed build when
+        running tests manually.
+        """
+        if self.oBuild is not None:
+            return True;
+
+        # Try dev build first since that's where I'll be using it first..
+        if True:
+            try:
+                self.oBuild = Build(self, None);
+                return True;
+            except base.GenError:
+                pass;
+
+        # Try default installation locations.
+        if self.sHost == 'win':
+            sProgFiles = os.environ.get('ProgramFiles', 'C:\\Program Files');
+            asLocs = [
+                os.path.join(sProgFiles, 'Oracle', 'VirtualBox'),
+                os.path.join(sProgFiles, 'OracleVM', 'VirtualBox'),
+                os.path.join(sProgFiles, 'Sun', 'VirtualBox'),
+            ];
+        elif self.sHost == 'solaris':
+            asLocs = [ '/opt/VirtualBox-3.2', '/opt/VirtualBox-3.1', '/opt/VirtualBox-3.0', '/opt/VirtualBox' ];
+        elif self.sHost == 'darwin':
+            asLocs = [ '/Applications/VirtualBox.app/Contents/MacOS' ];
+        elif self.sHost == 'linux':
+            asLocs = [ '/opt/VirtualBox-3.2', '/opt/VirtualBox-3.1', '/opt/VirtualBox-3.0', '/opt/VirtualBox' ];
+        else:
+            asLocs = [ '/opt/VirtualBox' ];
+        if 'VBOX_INSTALL_PATH' in os.environ:
+            asLocs.insert(0, os.environ['VBOX_INSTALL_PATH']);
+
+        for sLoc in asLocs:
+            try:
+                self.oBuild = Build(self, sLoc);
+                return True;
+            except base.GenError:
+                pass;
+
+        if not fQuiet:
+            reporter.error('failed to find VirtualBox installation');
+        return False;
+
+    def _detectValidationKit(self, fQuiet = False):
+        """
+        This is used internally by the constructor to try locate an unzipped
+        VBox Validation Kit somewhere in the immediate proximity.
+        """
+        if self.sVBoxValidationKit is not None:
+            return True;
+
+        #
+        # Normally it's found where we're running from, which is the same as
+        # the script directly on the testboxes.
+        #
+        asCandidates = [self.sScriptPath, ];
+        if g_ksValidationKitDir not in asCandidates:
+            asCandidates.append(g_ksValidationKitDir);
+        if os.getcwd() not in asCandidates:
+            asCandidates.append(os.getcwd());
+        if self.oBuild is not None  and  self.oBuild.sInstallPath not in asCandidates:
+            asCandidates.append(self.oBuild.sInstallPath);
+
+        #
+        # When working out of the tree, we'll search the current directory
+        # as well as parent dirs.
+        #
+        for sDir in list(asCandidates):
+            for i in range(10):
+                sDir = os.path.dirname(sDir);
+                if sDir not in asCandidates:
+                    asCandidates.append(sDir);
+
+        #
+        # Do the searching.
+        #
+        sCandidate = None;
+        for i in range(len(asCandidates)):
+            sCandidate = asCandidates[i];
+            if os.path.isfile(os.path.join(sCandidate, 'VBoxValidationKit.iso')):
+                break;
+            sCandidate = os.path.join(sCandidate, 'validationkit');
+            if os.path.isfile(os.path.join(sCandidate, 'VBoxValidationKit.iso')):
+                break;
+            sCandidate = None;
+
+        fRc = sCandidate is not None;
+        if fRc is False:
+            if not fQuiet:
+                reporter.error('failed to find VBox Validation Kit installation (candidates: %s)' % (asCandidates,));
+            sCandidate = os.path.join(self.sScriptPath, 'validationkit'); # Don't leave the values as None.
+
+        #
+        # Set the member values.
+        #
+        self.sVBoxValidationKit     = sCandidate;
+        self.sVBoxValidationKitIso  = os.path.join(sCandidate, 'VBoxValidationKit.iso');
+        self.sVBoxBootSectors   = os.path.join(sCandidate, 'bootsectors');
+        return fRc;
+
+    def importVBoxApi(self):
+        """
+        Import the 'vboxapi' module from the VirtualBox build we're using and
+        instantiate the two basic objects.
+
+        This will try detect an development or installed build if no build has
+        been associated with the driver yet.
+        """
+        if self.fImportedVBoxApi:
+            return True;
+
+        ## @todo split up this messy function.
+
+        # Make sure we've got our own VirtualBox config and VBoxSVC (on XPCOM at least).
+        if not self.fUseDefaultSvc:
+            os.environ['VBOX_USER_HOME']    = os.path.join(self.sScratchPath, 'VBoxUserHome');
+            sUser = os.environ.get('USERNAME', os.environ.get('USER', os.environ.get('LOGNAME', 'unknown')));
+            os.environ['VBOX_IPC_SOCKETID'] = sUser + '-VBoxTest';
+
+        # Do the detecting.
+        self._detectBuild();
+        if self.oBuild is None:
+            return False;
+
+        # Avoid crashing when loading the 32-bit module (or whatever it is that goes bang).
+        if     self.oBuild.sArch == 'x86' \
+           and self.sHost == 'darwin' \
+           and platform.architecture()[0] == '64bit' \
+           and self.oBuild.sKind == 'development' \
+           and os.getenv('VERSIONER_PYTHON_PREFER_32_BIT') != 'yes':
+            print "WARNING: 64-bit python on darwin, 32-bit VBox development build => crash"
+            print "WARNING:   bash-3.2$ /usr/bin/python2.5 ./testdriver"
+            print "WARNING: or"
+            print "WARNING:   bash-3.2$ VERSIONER_PYTHON_PREFER_32_BIT=yes ./testdriver"
+            return False;
+
+        # Start VBoxSVC and load the vboxapi bits.
+        if self._startVBoxSVC() is True:
+            assert(self.oVBoxSvcProcess is not None);
+
+            sSavedSysPath = sys.path;
+            self._setupVBoxApi();
+            sys.path = sSavedSysPath;
+
+            # Adjust the default machine folder.
+            if self.fImportedVBoxApi and not self.fUseDefaultSvc and self.fpApiVer >= 4.0:
+                sNewFolder = os.path.join(self.sScratchPath, 'VBoxUserHome', 'Machines');
+                try:
+                    self.oVBox.systemProperties.defaultMachineFolder = sNewFolder;
+                except:
+                    self.fImportedVBoxApi = False;
+                    self.oVBoxMgr = None;
+                    self.oVBox    = None;
+                    reporter.logXcpt("defaultMachineFolder exception (sNewFolder=%s)" % (sNewFolder,));
+
+            # Kill VBoxSVC on failure.
+            if self.oVBoxMgr is None:
+                self._stopVBoxSVC();
+        else:
+            assert(self.oVBoxSvcProcess is None);
+        return self.fImportedVBoxApi;
+
+    def _startVBoxSVC(self): # pylint: disable=R0915
+        """ Starts VBoxSVC. """
+        assert(self.oVBoxSvcProcess is None);
+
+        # Setup vbox logging for VBoxSVC now and start it manually.  This way
+        # we can control both logging and shutdown.
+        self.sVBoxSvcLogFile = '%s/VBoxSVC-debug.log' % (self.sScratchPath,);
+        try:    os.remove(self.sVBoxSvcLogFile);
+        except: pass;
+        os.environ['VBOX_LOG']       = self.sLogSvcGroups;
+        os.environ['VBOX_LOG_FLAGS'] = '%s append' % (self.sLogSvcFlags,);  # Append becuse of VBoxXPCOMIPCD.
+        if self.sLogSvcDest:
+            os.environ['VBOX_LOG_DEST'] = self.sLogSvcDest;
+        else:
+            os.environ['VBOX_LOG_DEST'] = 'file=%s' % (self.sVBoxSvcLogFile,);
+        os.environ['VBOXSVC_RELEASE_LOG_FLAGS'] = 'time append';
+
+        # Always leave a pid file behind so we can kill it during cleanup-before.
+        self.sVBoxSvcPidFile = '%s/VBoxSVC.pid' % (self.sScratchPath,);
+        fWritePidFile = True;
+
+        cMsFudge      = 1;
+        sVBoxSVC      = '%s/VBoxSVC' % (self.oBuild.sInstallPath,); ## @todo .exe and stuff.
+        if self.fVBoxSvcInDebugger:
+            if self.sHost in ('darwin', 'freebsd', 'linux', 'solaris', ):
+                # Start VBoxSVC in gdb in a new terminal.
+                #sTerm = '/usr/bin/gnome-terminal'; - doesn't work, some fork+exec stuff confusing us.
+                sTerm = '/usr/bin/xterm';
+                if not os.path.isfile(sTerm): sTerm = '/usr/X11/bin/xterm';
+                if not os.path.isfile(sTerm): sTerm = '/usr/X11R6/bin/xterm';
+                if not os.path.isfile(sTerm): sTerm = '/usr/bin/xterm';
+                if not os.path.isfile(sTerm): sTerm = 'xterm';
+                sGdb = '/usr/bin/gdb';
+                if not os.path.isfile(sGdb): sGdb = '/usr/local/bin/gdb';
+                if not os.path.isfile(sGdb): sGdb = '/usr/sfw/bin/gdb';
+                if not os.path.isfile(sGdb): sGdb = 'gdb';
+                sGdbCmdLine = '%s --args %s --pidfile %s' % (sGdb, sVBoxSVC, self.sVBoxSvcPidFile);
+                reporter.log('term="%s" gdb="%s"' % (sTerm, sGdbCmdLine));
+                os.environ['SHELL'] = self.sOrgShell; # Non-working shell may cause gdb and/or the term problems.
+                self.oVBoxSvcProcess = base.Process.spawnp(sTerm, sTerm, '-e', sGdbCmdLine);
+                os.environ['SHELL'] = self.sOurShell;
+                if self.oVBoxSvcProcess is not None:
+                    reporter.log('Press enter or return after starting VBoxSVC in the debugger...');
+                    sys.stdin.read(1);
+                fWritePidFile = False;
+
+            elif self.sHost == 'win':
+                sWinDbg = 'c:\\Program Files\\Debugging Tools for Windows\\windbg.exe';
+                if not os.path.isfile(sWinDbg): sWinDbg = 'c:\\Program Files\\Debugging Tools for Windows (x64)\\windbg.exe';
+                if not os.path.isfile(sWinDbg): sWinDbg = 'c:\\Programme\\Debugging Tools for Windows\\windbg.exe'; # Localization rulez!  pylint: disable=C0301
+                if not os.path.isfile(sWinDbg): sWinDbg = 'c:\\Programme\\Debugging Tools for Windows (x64)\\windbg.exe';
+                if not os.path.isfile(sWinDbg): sWinDbg = 'windbg'; # WinDbg must be in the path; better than nothing.
+                # Assume that everything WinDbg needs is defined using the environment variables.
+                # See WinDbg help for more information.
+                reporter.log('windbg="%s"' % (sWinDbg));
+                self.oVBoxSvcProcess = base.Process.spawn(sWinDbg, sWinDbg, sVBoxSVC + base.exeSuff());
+                if self.oVBoxSvcProcess is not None:
+                    reporter.log('Press enter or return after starting VBoxSVC in the debugger...');
+                    sys.stdin.read(1);
+                fWritePidFile = False;
+                ## @todo add a pipe interface similar to xpcom if feasible, i.e. if
+                # we can get actual handle values for pipes in python.
+
+            else:
+                reporter.error('Port me!');
+        else: # Run without a debugger attached.
+            if self.sHost in ('darwin', 'freebsd', 'linux', 'solaris', ):
+                #
+                # XPCOM - We can use a pipe to let VBoxSVC notify us when it's ready.
+                #
+                iPipeR, iPipeW = os.pipe();
+                os.environ['NSPR_INHERIT_FDS'] = 'vboxsvc:startup-pipe:5:0x%x' % (iPipeW,);
+                reporter.log2("NSPR_INHERIT_FDS=%s" % (os.environ['NSPR_INHERIT_FDS']));
+
+                self.oVBoxSvcProcess = base.Process.spawn(sVBoxSVC, sVBoxSVC, '--auto-shutdown'); # SIGUSR1 requirement.
+                try: # Try make sure we get the SIGINT and not VBoxSVC.
+                    os.setpgid(self.oVBoxSvcProcess.getPid(), 0); # pylint: disable=E1101
+                    os.setpgid(0, 0);                             # pylint: disable=E1101
+                except:
+                    reporter.logXcpt();
+
+                os.close(iPipeW);
+                try:
+                    sResponse = os.read(iPipeR, 32);
+                except:
+                    reporter.logXcpt();
+                    sResponse = None;
+                os.close(iPipeR);
+
+                if sResponse is None  or  sResponse.strip() != 'READY':
+                    reporter.error('VBoxSVC failed starting up... (sResponse=%s)' % (sResponse,));
+                    if not self.oVBoxSvcProcess.wait(5000):
+                        self.oVBoxSvcProcess.terminate(2500);
+                    self.oVBoxSvcProcess.wait(5000);
+                    self.oVBoxSvcProcess = None;
+
+            elif self.sHost == 'win':
+                #
+                # Windows - Just fudge it for now.
+                #
+                cMsFudge = 2000;
+                self.oVBoxSvcProcess = base.Process.spawn(sVBoxSVC, sVBoxSVC);
+
+            else:
+                reporter.error('Port me!');
+
+            #
+            # Enable automatic crash reporting if we succeeded.
+            #
+            if self.oVBoxSvcProcess is not None:
+                self.oVBoxSvcProcess.enableCrashReporting('crash/report/svc', 'crash/dump/svc');
+
+        #
+        # Fudge and pid file.
+        #
+        if self.oVBoxSvcProcess != None and not self.oVBoxSvcProcess.wait(cMsFudge):
+            if fWritePidFile:
+                iPid = self.oVBoxSvcProcess.getPid();
+                try:
+                    oFile = utils.openNoInherit(self.sVBoxSvcPidFile, "w+");
+                    oFile.write('%s' % (iPid,));
+                    oFile.close();
+                except:
+                    reporter.logXcpt('sPidFile=%s' % (self.sVBoxSvcPidFile,));
+                reporter.log('VBoxSVC PID=%u' % (iPid,));
+
+            #
+            # Finally add the task so we'll notice when it dies in a relatively timely manner.
+            #
+            self.addTask(self.oVBoxSvcProcess);
+        else:
+            self.oVBoxSvcProcess = None;
+            try:    os.remove(self.sVBoxSvcPidFile);
+            except: pass;
+
+        return self.oVBoxSvcProcess != None;
+
+
+    def _killVBoxSVCByPidFile(self, sPidFile):
+        """ Kill a VBoxSVC given the pid from it's pid file. """
+
+        # Read the pid file.
+        if not os.path.isfile(sPidFile):
+            return False;
+        try:
+            oFile = utils.openNoInherit(sPidFile, "r");
+            sPid = oFile.readline().strip();
+            oFile.close();
+        except:
+            reporter.logXcpt('sPidfile=%s' % (sPidFile,));
+            return False;
+
+        # Convert the pid to an integer and validate the range a little bit.
+        try:
+            iPid = long(sPid);
+        except:
+            reporter.logXcpt('sPidfile=%s sPid="%s"' % (sPidFile, sPid));
+            return False;
+        if iPid <= 0:
+            reporter.log('negative pid - sPidfile=%s sPid="%s" iPid=%d' % (sPidFile, sPid, iPid));
+            return False;
+
+        # Take care checking that it's VBoxSVC we're about to inhume.
+        if base.processCheckPidAndName(iPid, "VBoxSVC") is not True:
+            reporter.log('Ignoring stale VBoxSVC pid file (pid=%s)' % (iPid,));
+            return False;
+
+        # Loop thru our different ways of getting VBoxSVC to terminate.
+        for aHow in [ [ base.sendUserSignal1,  5000, 'Dropping VBoxSVC a SIGUSR1 hint...'], \
+                      [ base.processInterrupt, 5000, 'Dropping VBoxSVC a SIGINT hint...'], \
+                      [ base.processTerminate, 7500, 'VBoxSVC is still around, killing it...'] ]:
+            reporter.log(aHow[2]);
+            if aHow[0](iPid) is True:
+                msStart = base.timestampMilli();
+                while base.timestampMilli() - msStart < 5000 \
+                  and base.processExists(iPid):
+                    time.sleep(0.2);
+
+            fRc = not base.processExists(iPid);
+            if fRc is True:
+                break;
+        if fRc:
+            reporter.log('Successfully killed VBoxSVC (pid=%s)' % (iPid,));
+        else:
+            reporter.log('Failed to kill VBoxSVC (pid=%s)' % (iPid,));
+        return fRc;
+
+    def _stopVBoxSVC(self):
+        """
+        Stops VBoxSVC.  Try the polite way first.
+        """
+
+        if self.oVBoxSvcProcess:
+            self.removeTask(self.oVBoxSvcProcess);
+            self.oVBoxSvcProcess.enableCrashReporting(None, None); # Disables it.
+
+        fRc = False;
+        if   self.oVBoxSvcProcess is not None \
+         and not self.fVBoxSvcInDebugger:
+            # by process object.
+            if self.oVBoxSvcProcess.isRunning():
+                reporter.log('Dropping VBoxSVC a SIGUSR1 hint...');
+                if  not self.oVBoxSvcProcess.sendUserSignal1() \
+                 or not self.oVBoxSvcProcess.wait(5000):
+                    reporter.log('Dropping VBoxSVC a SIGINT hint...');
+                    if  not self.oVBoxSvcProcess.interrupt() \
+                     or not self.oVBoxSvcProcess.wait(5000):
+                        reporter.log('VBoxSVC is still around, killing it...');
+                        self.oVBoxSvcProcess.terminate();
+                        self.oVBoxSvcProcess.wait(7500);
+            else:
+                reporter.log('VBoxSVC is no longer running...');
+            if not self.oVBoxSvcProcess.isRunning():
+                self.oVBoxSvcProcess = None;
+        else:
+            # by pid file.
+            self._killVBoxSVCByPidFile('%s/VBoxSVC.pid' % (self.sScratchPath,));
+        return fRc;
+
+    def _setupVBoxApi(self):
+        """
+        Import and set up the vboxapi.
+        The caller saves and restores sys.path.
+        """
+
+        # Setup vbox logging for self (the test driver).
+        self.sSelfLogFile = '%s/VBoxTestDriver.log' % (self.sScratchPath,);
+        try:    os.remove(self.sSelfLogFile);
+        except: pass;
+        os.environ['VBOX_LOG']       = self.sLogSelfGroups;
+        os.environ['VBOX_LOG_FLAGS'] = '%s append' % (self.sLogSelfFlags, );
+        if self.sLogSelfDest:
+            os.environ['VBOX_LOG_DEST'] = self.sLogSelfDest;
+        else:
+            os.environ['VBOX_LOG_DEST'] = 'file=%s' % (self.sSelfLogFile,);
+        os.environ['VBOX_RELEASE_LOG_FLAGS'] = 'time append';
+
+        # Hack the sys.path + environment so the vboxapi can be found.
+        sys.path.insert(0, self.oBuild.sInstallPath);
+        if self.oBuild.sSdkPath is not None:
+            sys.path.insert(0, os.path.join(self.oBuild.sSdkPath, 'installer'))
+            sys.path.insert(1, os.path.join(self.oBuild.sSdkPath, 'bindings', 'xpcom', 'python'))
+        os.environ['VBOX_PROGRAM_PATH'] = self.oBuild.sInstallPath;
+        reporter.log("sys.path: %s" % (sys.path));
+
+        try:
+            # pylint: disable=F0401
+            from vboxapi import VirtualBoxManager
+            if self.sHost == 'win':
+                from pythoncom import com_error as NativeComExceptionClass  # pylint: disable=E0611
+                import winerror                 as NativeComErrorClass
+            else:
+                from xpcom import Exception     as NativeComExceptionClass
+                from xpcom import nsError       as NativeComErrorClass
+            # pylint: enable=F0401
+        except:
+            traceback.print_exc();
+            return False;
+
+        __deployExceptionHacks__(NativeComExceptionClass)
+        ComError.copyErrors(NativeComErrorClass);
+
+        # Create the manager.
+        try:
+            self.oVBoxMgr = VirtualBoxManager(None, None)
+        except:
+            self.oVBoxMgr = None;
+            reporter.logXcpt('VirtualBoxManager exception');
+            return False;
+
+        # Figure the API version.
+        try:
+            oVBox = self.oVBoxMgr.getVirtualBox();
+            try:
+                sVer = oVBox.version;
+            except:
+                reporter.logXcpt('Failed to get VirtualBox version, assuming 4.0.0');
+                sVer = "4.0.0";
+            if sVer.startswith("5.0") or (sVer.startswith("4.3.5") and len(sVer) == 6):
+                self.fpApiVer = 5.0;
+            elif sVer.startswith("4.3") or (sVer.startswith("4.2.5") and len(sVer) == 6):
+                self.fpApiVer = 4.3;
+            elif sVer.startswith("4.2."):
+                self.fpApiVer = 4.2; ## @todo Fudge: Add (proper) 4.2 API support. Unmount medium etc?
+            elif sVer.startswith("4.1.") or (sVer.startswith("4.0.5") and len(sVer) == 6):
+                self.fpApiVer = 4.1;
+            elif sVer.startswith("4.0."):
+                self.fpApiVer = 4.0;
+            elif sVer.startswith("3.2."):
+                self.fpApiVer = 3.2;
+            elif sVer.startswith("3.1."):
+                self.fpApiVer = 3.1;
+            elif sVer.startswith("3.0."):
+                self.fpApiVer = 3.0;
+            else:
+                raise base.GenError('Unknown version "%s"' % (sVer,));
+
+            self._patchVBoxMgr();
+
+            from testdriver.vboxwrappers import VirtualBoxWrapper;
+            self.oVBox = VirtualBoxWrapper(oVBox, self.oVBoxMgr, self.fpApiVer, self);
+            vboxcon.goHackModuleClass.oVBoxMgr  = self.oVBoxMgr; # VBoxConstantWrappingHack.
+            vboxcon.fpApiVer                    = self.fpApiVer
+            self.fImportedVBoxApi = True;
+            reporter.log('Found version %s (%s)' % (self.fpApiVer, sVer));
+        except:
+            self.oVBoxMgr = None;
+            self.oVBox    = None;
+            reporter.logXcpt("getVirtualBox exception");
+            return False;
+        return True;
+
+    def _patchVBoxMgr(self):
+        """
+        Glosses over missing self.oVBoxMgr methods on older VBox versions.
+        """
+
+        def _xcptGetResult(oSelf, oXcpt = None):
+            """ See vboxapi. """
+            _ = oSelf;
+            if oXcpt is None: oXcpt = sys.exc_info()[1];
+            if sys.platform == 'win32':
+                import winerror;                                            # pylint: disable=F0401
+                hrXcpt = oXcpt.hresult;
+                if hrXcpt == winerror.DISP_E_EXCEPTION:
+                    hrXcpt = oXcpt.excepinfo[5];
+            else:
+                hrXcpt = oXcpt.error;
+            return hrXcpt;
+
+        def _xcptIsDeadInterface(oSelf, oXcpt = None):
+            """ See vboxapi. """
+            return oSelf.xcptGetStatus(oXcpt) in [
+                0x80004004, -2147467260, # NS_ERROR_ABORT
+                0x800706be, -2147023170, # NS_ERROR_CALL_FAILED (RPC_S_CALL_FAILED)
+                0x800706ba, -2147023174, # RPC_S_SERVER_UNAVAILABLE.
+                0x800706be, -2147023170, # RPC_S_CALL_FAILED.
+                0x800706bf, -2147023169, # RPC_S_CALL_FAILED_DNE.
+                0x80010108, -2147417848, # RPC_E_DISCONNECTED.
+                0x800706b5, -2147023179, # RPC_S_UNKNOWN_IF
+            ];
+
+        def _xcptIsOurXcptKind(oSelf, oXcpt = None):
+            """ See vboxapi. """
+            _ = oSelf;
+            if oXcpt is None: oXcpt = sys.exc_info()[1];
+            if sys.platform == 'win32':
+                from pythoncom import com_error as NativeComExceptionClass  # pylint: disable=F0401,E0611
+            else:
+                from xpcom import Exception     as NativeComExceptionClass  # pylint: disable=F0401
+            return isinstance(oXcpt, NativeComExceptionClass);
+
+        def _xcptIsEqual(oSelf, oXcpt, hrStatus):
+            """ See vboxapi. """
+            hrXcpt = oSelf.xcptGetResult(oXcpt);
+            return hrXcpt == hrStatus or hrXcpt == hrStatus - 0x100000000;
+
+        def _xcptToString(oSelf, oXcpt):
+            """ See vboxapi. """
+            _ = oSelf;
+            if oXcpt is None: oXcpt = sys.exc_info()[1];
+            return str(oXcpt);
+
+        # Add utilities found in newer vboxapi revision.
+        if not hasattr(self.oVBoxMgr, 'xcptIsDeadInterface'):
+            import types;
+            self.oVBoxMgr.xcptGetResult         = types.MethodType(_xcptGetResult,       self.oVBoxMgr);
+            self.oVBoxMgr.xcptIsDeadInterface   = types.MethodType(_xcptIsDeadInterface, self.oVBoxMgr);
+            self.oVBoxMgr.xcptIsOurXcptKind     = types.MethodType(_xcptIsOurXcptKind,   self.oVBoxMgr);
+            self.oVBoxMgr.xcptIsEqual           = types.MethodType(_xcptIsEqual,         self.oVBoxMgr);
+            self.oVBoxMgr.xcptToString          = types.MethodType(_xcptToString,        self.oVBoxMgr);
+
+
+    def _teardownVBoxApi(self):
+        """
+        Drop all VBox object references and shutdown com/xpcom.
+        """
+        if not self.fImportedVBoxApi:
+            return True;
+
+        self.aoRemoteSessions = [];
+        self.aoVMs            = [];
+        self.oVBoxMgr         = None;
+        self.oVBox            = None;
+
+        try:
+            import gc
+            gc.collect();
+        except:
+            reporter.logXcpt();
+        self.fImportedVBoxApi = False;
+
+        if self.sHost == 'win':
+            pass; ## TODO shutdown COM if possible/necessary?
+        else:
+            try:
+                from xpcom import _xpcom as _xpcom;     # pylint: disable=F0401
+                hrc   = _xpcom.NS_ShutdownXPCOM();
+                cIfs  = _xpcom._GetInterfaceCount();    # pylint: disable=W0212
+                cObjs = _xpcom._GetGatewayCount();      # pylint: disable=W0212
+                if cObjs == 0 and cIfs == 0:
+                    reporter.log('actionCleanupAfter: NS_ShutdownXPCOM -> %s, nothing left behind.' % (hrc, ));
+                else:
+                    reporter.log('actionCleanupAfter: NS_ShutdownXPCOM -> %s, leaving %s objects and %s interfaces behind...' \
+                                 % (hrc, cObjs, cIfs));
+                    if hasattr(_xpcom, '_DumpInterfaces'):
+                        try:
+                            _xpcom._DumpInterfaces();   # pylint: disable=W0212
+                        except:
+                            reporter.logXcpt('actionCleanupAfter: _DumpInterfaces failed');
+            except:
+                reporter.logXcpt();
+
+        try:
+            gc.collect();
+            time.sleep(0.5); # fudge factory
+        except:
+            reporter.logXcpt();
+        return True;
+
+    def _powerOffAllVms(self):
+        """
+        Tries to power off all running VMs.
+        """
+        for oSession in self.aoRemoteSessions:
+            uPid = oSession.getPid();
+            if uPid is not None:
+                reporter.log('_powerOffAllVms: PID is %s for %s, trying to kill it.' % (uPid, oSession.sName,));
+                base.processKill(uPid);
+            else:
+                reporter.log('_powerOffAllVms: No PID for %s' % (oSession.sName,));
+            oSession.close();
+        return None;
+
+
+
+    #
+    # Build type, OS and arch getters.
+    #
+
+    def getBuildType(self):
+        """
+        Get the build type.
+        """
+        if not self._detectBuild():
+            return 'release';
+        return self.oBuild.sType;
+
+    def getBuildOs(self):
+        """
+        Get the build OS.
+        """
+        if not self._detectBuild():
+            return self.sHost;
+        return self.oBuild.sOs;
+
+    def getBuildArch(self):
+        """
+        Get the build arch.
+        """
+        if not self._detectBuild():
+            return self.sHostArch;
+        return self.oBuild.sArch;
+
+    def getGuestAdditionsIso(self):
+        """
+        Get the path to the guest addition iso.
+        """
+        if not self._detectBuild():
+            return None;
+        return self.oBuild.sGuestAdditionsIso;
+
+    #
+    # Override everything from the base class so the testdrivers don't have to
+    # check whether we have overridden a method or not.
+    #
+
+    def showUsage(self):
+        rc = base.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('Generic VirtualBox Options:');
+        reporter.log('  --vbox-session-type <type>');
+        reporter.log('      Sets the session type.  Typical values are: gui, headless, sdl');
+        reporter.log('      Default: %s' % (self.sSessionTypeDef));
+        reporter.log('  --vrdp, --no-vrdp');
+        reporter.log('      Enables VRDP, ports starting at 6000');
+        reporter.log('      Default: --vrdp');
+        reporter.log('  --vrdp-base-port <port>');
+        reporter.log('      Sets the base for VRDP port assignments.');
+        reporter.log('      Default: %s' % (self.uVrdpBasePortDef));
+        reporter.log('  --vbox-default-bridged-nic <interface>');
+        reporter.log('      Sets the default interface for bridged networking.');
+        reporter.log('      Default: autodetect');
+        reporter.log('  --vbox-use-svc-defaults');
+        reporter.log('      Use default locations and files for VBoxSVC.  This is useful');
+        reporter.log('      for automatically configuring the test VMs for debugging.');
+        reporter.log('  --vbox-self-log');
+        reporter.log('      The VBox logger group settings for the testdriver.');
+        reporter.log('  --vbox-self-log-flags');
+        reporter.log('      The VBox logger flags settings for the testdriver.');
+        reporter.log('  --vbox-self-log-dest');
+        reporter.log('      The VBox logger destination settings for the testdriver.');
+        reporter.log('  --vbox-session-log');
+        reporter.log('      The VM session logger group settings.');
+        reporter.log('  --vbox-session-log-flags');
+        reporter.log('      The VM session logger flags.');
+        reporter.log('  --vbox-session-log-dest');
+        reporter.log('      The VM session logger destination settings.');
+        reporter.log('  --vbox-svc-log');
+        reporter.log('      The VBoxSVC logger group settings.');
+        reporter.log('  --vbox-svc-log-flags');
+        reporter.log('      The VBoxSVC logger flag settings.');
+        reporter.log('  --vbox-svc-log-dest');
+        reporter.log('      The VBoxSVC logger destination settings.');
+        reporter.log('  --vbox-log');
+        reporter.log('      The VBox logger group settings for everyone.');
+        reporter.log('  --vbox-log-flags');
+        reporter.log('      The VBox logger flags settings for everyone.');
+        reporter.log('  --vbox-log-dest');
+        reporter.log('      The VBox logger destination settings for everyone.');
+        reporter.log('  --vbox-svc-debug');
+        reporter.log('      Start VBoxSVC in a debugger');
+        reporter.log('  --vbox-always-upload-logs');
+        reporter.log('      Whether to always upload log files, or only do so on failure.');
+        reporter.log('  --vbox-always-upload-screenshots');
+        reporter.log('      Whether to always upload final screen shots, or only do so on failure.');
+        if self.oTestVmSet is not None:
+            self.oTestVmSet.showUsage();
+        return rc;
+
+    def parseOption(self, asArgs, iArg): # pylint: disable=R0915
+        if asArgs[iArg] == '--vbox-session-type':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-session-type" takes an argument');
+            self.sSessionType = asArgs[iArg];
+        elif asArgs[iArg] == '--vrdp':
+            self.fEnableVrdp = True;
+        elif asArgs[iArg] == '--no-vrdp':
+            self.fEnableVrdp = False;
+        elif asArgs[iArg] == '--vrdp-base-port':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vrdp-base-port" takes an argument');
+            try:    self.uVrdpBasePort = int(asArgs[iArg]);
+            except: raise base.InvalidOption('The "--vrdp-base-port" value "%s" is not a valid integer', asArgs[iArg]);
+            if self.uVrdpBasePort <= 0 or self.uVrdpBasePort >= 65530:
+                raise base.InvalidOption('The "--vrdp-base-port" value "%s" is not in the valid range (1..65530)', asArgs[iArg]);
+        elif asArgs[iArg] == '--vbox-default-bridged-nic':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-default-bridged-nic" takes an argument');
+            self.sDefBridgedNic = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-use-svc-defaults':
+            self.fUseDefaultSvc = True;
+        elif asArgs[iArg] == '--vbox-self-log':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-self-log" takes an argument');
+            self.sLogSelfGroups = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-self-log-flags':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-self-log-flags" takes an argument');
+            self.sLogSelfFlags = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-self-log-dest':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-self-log-dest" takes an argument');
+            self.sLogSelfDest = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-session-log':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-session-log" takes an argument');
+            self.sLogSessionGroups = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-session-log-flags':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-session-log-flags" takes an argument');
+            self.sLogSessionFlags = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-session-log-dest':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-session-log-dest" takes an argument');
+            self.sLogSessionDest = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-svc-log':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-svc-log" takes an argument');
+            self.sLogSvcGroups = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-svc-log-flags':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-svc-log-flags" takes an argument');
+            self.sLogSvcFlags = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-svc-log-dest':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-svc-log-dest" takes an argument');
+            self.sLogSvcDest = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-log':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-log" takes an argument');
+            self.sLogSelfGroups    = asArgs[iArg];
+            self.sLogSessionGroups = asArgs[iArg];
+            self.sLogSvcGroups     = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-log-flags':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-svc-flags" takes an argument');
+            self.sLogSelfFlags     = asArgs[iArg];
+            self.sLogSessionFlags  = asArgs[iArg];
+            self.sLogSvcFlags      = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-log-dest':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--vbox-log-dest" takes an argument');
+            self.sLogSelfDest     = asArgs[iArg];
+            self.sLogSessionDest  = asArgs[iArg];
+            self.sLogSvcDest      = asArgs[iArg];
+        elif asArgs[iArg] == '--vbox-svc-debug':
+            self.fVBoxSvcInDebugger = True;
+        elif asArgs[iArg] == '--vbox-always-upload-logs':
+            self.fAlwaysUploadLogs = True;
+        elif asArgs[iArg] == '--vbox-always-upload-screenshots':
+            self.fAlwaysUploadScreenshots = True;
+        else:
+            # Relevant for selecting VMs to test?
+            if self.oTestVmSet is not None:
+                iRc = self.oTestVmSet.parseOption(asArgs, iArg);
+                if iRc != iArg:
+                    return iRc;
+
+            # Hand it to the base class.
+            return base.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        return base.TestDriver.completeOptions(self);
+
+    def getResourceSet(self):
+        if self.oTestVmSet is not None:
+            return self.oTestVmSet.getResourceSet();
+        return base.TestDriver.getResourceSet(self);
+
+    def actionExtract(self):
+        return base.TestDriver.actionExtract(self);
+
+    def actionVerify(self):
+        return base.TestDriver.actionVerify(self);
+
+    def actionConfig(self):
+        return base.TestDriver.actionConfig(self);
+
+    def actionExecute(self):
+        return base.TestDriver.actionExecute(self);
+
+    def actionCleanupBefore(self):
+        """
+        Kill any VBoxSVC left behind by a previous test run.
+        """
+        self._killVBoxSVCByPidFile('%s/VBoxSVC.pid' % (self.sScratchPath,));
+        return base.TestDriver.actionCleanupBefore(self);
+
+    def actionCleanupAfter(self):
+        """
+        Clean up the VBox bits and then call the base driver.
+
+        If your test driver overrides this, it should normally call us at the
+        end of the job.
+        """
+
+        # Kill any left over VM processes.
+        self._powerOffAllVms();
+
+        # Drop all VBox object references and shutdown xpcom then
+        # terminating VBoxSVC,  with extreme prejudice if need be.
+        self._teardownVBoxApi();
+        self._stopVBoxSVC();
+
+        # Add the VBoxSVC and testdriver debug+release log files.
+        if self.fAlwaysUploadLogs or reporter.getErrorCount() > 0:
+            if self.sVBoxSvcLogFile is not None  and  os.path.isfile(self.sVBoxSvcLogFile):
+                reporter.addLogFile(self.sVBoxSvcLogFile, 'log/debug/svc', 'Debug log file for VBoxSVC');
+                self.sVBoxSvcLogFile = None;
+
+            if self.sSelfLogFile is not None  and  os.path.isfile(self.sSelfLogFile):
+                reporter.addLogFile(self.sSelfLogFile, 'log/debug/client', 'Debug log file for the test driver');
+                self.sSelfLogFile = None;
+
+            sVBoxSvcRelLog = os.path.join(self.sScratchPath, 'VBoxUserHome', 'VBoxSVC.log');
+            if os.path.isfile(sVBoxSvcRelLog):
+                reporter.addLogFile(sVBoxSvcRelLog, 'log/release/svc', 'Release log file for VBoxSVC');
+            for sSuff in [ '.1', '.2', '.3', '.4', '.5', '.6', '.7', '.8' ]:
+                if os.path.isfile(sVBoxSvcRelLog + sSuff):
+                    reporter.addLogFile(sVBoxSvcRelLog + sSuff, 'log/release/svc', 'Release log file for VBoxSVC');
+            # Testbox debugging - START - TEMPORARY, REMOVE ASAP.
+            if self.sHost in ('darwin', 'freebsd', 'linux', 'solaris', ):
+                try:
+                    print '> ls -la %s' % (os.path.join(self.sScratchPath, 'VBoxUserHome'),);
+                    utils.processCall(['ls', '-la', os.path.join(self.sScratchPath, 'VBoxUserHome')]);
+                    print '> ls -la %s' % (self.sScratchPath,);
+                    utils.processCall(['ls', '-la', self.sScratchPath]);
+                except: pass;
+            # Testbox debugging - END   - TEMPORARY, REMOVE ASAP.
+
+        # Finally, call the base driver to wipe the scratch space.
+        return base.TestDriver.actionCleanupAfter(self);
+
+    def actionAbort(self):
+        """
+        Terminate VBoxSVC if we've got a pid file.
+        """
+        self._killVBoxSVCByPidFile('%s/VBoxSVC.pid' % (self.sScratchPath,));
+        return base.TestDriver.actionAbort(self);
+
+    def onExit(self, iRc):
+        """
+        Stop VBoxSVC if we've started it.
+        """
+        if self.oVBoxSvcProcess is not None:
+            reporter.log('*** Shutting down the VBox API... (iRc=%s)' % (iRc,));
+            self._powerOffAllVms();
+            self._teardownVBoxApi();
+            self._stopVBoxSVC();
+            reporter.log('*** VBox API shutdown done.');
+        return base.TestDriver.onExit(self, iRc);
+
+
+    #
+    # Task wait method override.
+    #
+
+    def notifyAboutReadyTask(self, oTask):
+        """
+        Overriding base.TestDriver.notifyAboutReadyTask.
+        """
+        try:
+            self.oVBoxMgr.interruptWaitEvents();
+            reporter.log2('vbox.notifyAboutReadyTask: called interruptWaitEvents');
+        except:
+            reporter.logXcpt('vbox.notifyAboutReadyTask');
+        return base.TestDriver.notifyAboutReadyTask(self, oTask);
+
+    def waitForTasksSleepWorker(self, cMsTimeout):
+        """
+        Overriding base.TestDriver.waitForTasksSleepWorker.
+        """
+        try:
+            rc = self.oVBoxMgr.waitForEvents(int(cMsTimeout));
+            _ = rc; #reporter.log2('vbox.waitForTasksSleepWorker(%u): true (waitForEvents -> %s)' % (cMsTimeout, rc));
+            return True;
+        except KeyboardInterrupt:
+            raise;
+        except:
+            reporter.logXcpt('vbox.waitForTasksSleepWorker');
+            return False;
+
+    #
+    # Utility methods.
+    #
+
+    def processEvents(self, cMsTimeout = 0):
+        """
+        Processes events, returning after the first batch has been processed
+        or the time limit has been reached.
+
+        Only Ctrl-C exception, no return.
+        """
+        try:
+            self.oVBoxMgr.waitForEvents(cMsTimeout);
+        except KeyboardInterrupt:
+            raise;
+        except:
+            pass;
+        return None;
+
+    def processPendingEvents(self):
+        """ processEvents(0) - no waiting. """
+        return self.processEvents(0);
+
+    def sleep(self, cSecs):
+        """
+        Sleep for a specified amount of time, processing XPCOM events all the while.
+        """
+        cMsTimeout = long(cSecs * 1000);
+        msStart    = base.timestampMilli();
+        self.processEvents(0);
+        while True:
+            cMsElapsed = base.timestampMilli() - msStart;
+            if cMsElapsed > cMsTimeout:
+                break;
+            #reporter.log2('cMsTimeout=%s - cMsElapsed=%d => %s' % (cMsTimeout, cMsElapsed, cMsTimeout - cMsElapsed));
+            self.processEvents(cMsTimeout - cMsElapsed);
+        return None;
+
+    def _logVmInfoUnsafe(self, oVM):                                            # pylint: disable=R0915,R0912
+        """
+        Internal worker for logVmInfo that is wrapped in try/except.
+
+        This is copy, paste, search, replace and edit of infoCmd from vboxshell.py.
+        """
+        oOsType = self.oVBox.getGuestOSType(oVM.OSTypeId)
+        reporter.log("  Name:               %s" % (oVM.name));
+        reporter.log("  ID:                 %s" % (oVM.id));
+        reporter.log("  OS Type:            %s - %s" % (oVM.OSTypeId, oOsType.description));
+        reporter.log("  Machine state:      %s" % (oVM.state));
+        reporter.log("  Session state:      %s" % (oVM.sessionState));
+        if self.fpApiVer >= 4.2:
+            reporter.log("  Session PID:        %u (%#x)" % (oVM.sessionPID, oVM.sessionPID));
+        else:
+            reporter.log("  Session PID:        %u (%#x)" % (oVM.sessionPid, oVM.sessionPid));
+        if self.fpApiVer >= 5.0:
+            reporter.log("  Session Name:       %s" % (oVM.sessionName));
+        else:
+            reporter.log("  Session Name:       %s" % (oVM.sessionType));
+        reporter.log("  CPUs:               %s" % (oVM.CPUCount));
+        reporter.log("  RAM:                %sMB" % (oVM.memorySize));
+        reporter.log("  VRAM:               %sMB" % (oVM.VRAMSize));
+        reporter.log("  Monitors:           %s" % (oVM.monitorCount));
+        reporter.log("  Firmware:           %s" % (oVM.firmwareType));
+        reporter.log("  HwVirtEx:           %s" % (oVM.getHWVirtExProperty(vboxcon.HWVirtExPropertyType_Enabled)));
+        reporter.log("  VPID support:       %s" % (oVM.getHWVirtExProperty(vboxcon.HWVirtExPropertyType_VPID)));
+        reporter.log("  Nested paging:      %s" % (oVM.getHWVirtExProperty(vboxcon.HWVirtExPropertyType_NestedPaging)));
+        if self.fpApiVer >= 4.2 and hasattr(vboxcon, 'CPUPropertyType_LongMode'):
+            reporter.log("  Long-mode:          %s" % (oVM.getCPUProperty(vboxcon.CPUPropertyType_LongMode)));
+        if self.fpApiVer >= 3.2:
+            reporter.log("  PAE:                %s" % (oVM.getCPUProperty(vboxcon.CPUPropertyType_PAE)));
+            if self.fpApiVer < 5.0:
+                reporter.log("  Synthetic CPU:      %s" % (oVM.getCPUProperty(vboxcon.CPUPropertyType_Synthetic)));
+        else:
+            reporter.log("  PAE:                %s" % (oVM.getCpuProperty(vboxcon.CpuPropertyType_PAE)));
+            reporter.log("  Synthetic CPU:      %s" % (oVM.getCpuProperty(vboxcon.CpuPropertyType_Synthetic)));
+        reporter.log("  ACPI:               %s" % (oVM.BIOSSettings.ACPIEnabled));
+        reporter.log("  IO-APIC:            %s" % (oVM.BIOSSettings.IOAPICEnabled));
+        if self.fpApiVer >= 3.2:
+            if self.fpApiVer >= 4.2:
+                reporter.log("  HPET:               %s" % (oVM.HPETEnabled));
+            else:
+                reporter.log("  HPET:               %s" % (oVM.hpetEnabled));
+        reporter.log("  3D acceleration:    %s" % (oVM.accelerate3DEnabled));
+        reporter.log("  2D acceleration:    %s" % (oVM.accelerate2DVideoEnabled));
+        reporter.log("  TeleporterEnabled:  %s" % (oVM.teleporterEnabled));
+        reporter.log("  TeleporterPort:     %s" % (oVM.teleporterPort));
+        reporter.log("  TeleporterAddress:  %s" % (oVM.teleporterAddress));
+        reporter.log("  TeleporterPassword: %s" % (oVM.teleporterPassword));
+        reporter.log("  Clipboard mode:     %s" % (oVM.clipboardMode));
+        if self.fpApiVer >= 4.0:
+            reporter.log("  VRDP server:        %s" % (oVM.VRDEServer.enabled));
+            try:    sPorts = oVM.VRDEServer.getVRDEProperty("TCP/Ports");
+            except: sPorts = "";
+            reporter.log("  VRDP server ports:  %s" % (sPorts));
+            reporter.log("  VRDP auth:          %s (%s)" % (oVM.VRDEServer.authType, oVM.VRDEServer.authLibrary));
+        else:
+            reporter.log("  VRDP server:        %s" % (oVM.VRDPServer.enabled));
+            reporter.log("  VRDP server ports:  %s" % (oVM.VRDPServer.ports));
+        reporter.log("  Last changed:       %s" % (oVM.lastStateChange));
+
+        aoControllers = self.oVBoxMgr.getArray(oVM, 'storageControllers')
+        if aoControllers:
+            reporter.log("  Controllers:");
+        for oCtrl in aoControllers:
+            reporter.log("    %s %s bus: %s type: %s" % (oCtrl.name, oCtrl.controllerType, oCtrl.bus, oCtrl.controllerType));
+
+        self.processPendingEvents();
+        aoAttachments = self.oVBoxMgr.getArray(oVM, 'mediumAttachments')
+        if aoAttachments:
+            reporter.log("  Attachments:");
+        for oAtt in aoAttachments:
+            sCtrl = "Controller: %s port: %s device: %s type: %s" % (oAtt.controller, oAtt.port, oAtt.device, oAtt.type);
+            oMedium = oAtt.medium
+            if oAtt.type == vboxcon.DeviceType_HardDisk:
+                reporter.log("    %s: HDD" % sCtrl);
+                reporter.log("      Id:             %s" % (oMedium.id));
+                reporter.log("      Name:           %s" % (oMedium.name));
+                reporter.log("      Format:         %s" % (oMedium.format));
+                reporter.log("      Location:       %s" % (oMedium.location));
+
+            if oAtt.type == vboxcon.DeviceType_DVD:
+                reporter.log("    %s: DVD" % sCtrl);
+                if oMedium:
+                    reporter.log("      Id:             %s" % (oMedium.id));
+                    reporter.log("      Name:           %s" % (oMedium.name));
+                    if oMedium.hostDrive:
+                        reporter.log("      Host DVD        %s" % (oMedium.location));
+                        if oAtt.passthrough:
+                            reporter.log("      [passthrough mode]");
+                    else:
+                        reporter.log("      Virtual image:  %s" % (oMedium.location));
+                        reporter.log("      Size:           %s" % (oMedium.size));
+                else:
+                    reporter.log("      empty");
+
+            if oAtt.type == vboxcon.DeviceType_Floppy:
+                reporter.log("    %s: Floppy" % sCtrl);
+                if oMedium:
+                    reporter.log("      Id:             %s" % (oMedium.id));
+                    reporter.log("      Name:           %s" % (oMedium.name));
+                    if oMedium.hostDrive:
+                        reporter.log("      Host floppy:    %s" % (oMedium.location));
+                    else:
+                        reporter.log("      Virtual image:  %s" % (oMedium.location));
+                        reporter.log("      Size:           %s" % (oMedium.size));
+                else:
+                    reporter.log("      empty");
+            self.processPendingEvents();
+
+        reporter.log("  Network Adapter:");
+        for iSlot in range(0, 32):
+            try:    oNic = oVM.getNetworkAdapter(iSlot)
+            except: break;
+            if not oNic.enabled:
+                reporter.log2("    slot #%d found but not enabled, skipping" % (iSlot,));
+                continue;
+            if   oNic.adapterType == vboxcon.NetworkAdapterType_Am79C973:   sType = "PCNet";
+            elif oNic.adapterType == vboxcon.NetworkAdapterType_Am79C970A:  sType = "PCNetOld";
+            elif oNic.adapterType == vboxcon.NetworkAdapterType_I82545EM:   sType = "E1000";
+            elif oNic.adapterType == vboxcon.NetworkAdapterType_I82540EM:   sType = "E1000Desk";
+            elif oNic.adapterType == vboxcon.NetworkAdapterType_I82543GC:   sType = "E1000Srv2";
+            elif oNic.adapterType == vboxcon.NetworkAdapterType_Virtio:     sType = "Virtio";
+            else: sType = "unknown %s" % (oNic.adapterType);
+            reporter.log("    slot #%d: type: %s (%s) MAC Address: %s lineSpeed: %s" % \
+                         (iSlot, sType, oNic.adapterType, oNic.MACAddress, oNic.lineSpeed) );
+
+            if   oNic.attachmentType == vboxcon.NetworkAttachmentType_NAT:
+                reporter.log("    attachmentType: NAT (%s)" % (oNic.attachmentType));
+                if self.fpApiVer >= 4.1:
+                    reporter.log("    nat-network:    %s" % (oNic.NATNetwork,));
+            elif oNic.attachmentType == vboxcon.NetworkAttachmentType_Bridged:
+                reporter.log("    attachmentType: Bridged (%s)" % (oNic.attachmentType));
+                if self.fpApiVer >= 4.1:
+                    reporter.log("    hostInterface:  %s" % (oNic.bridgedInterface));
+                else:
+                    reporter.log("    hostInterface:  %s" % (oNic.hostInterface));
+            elif oNic.attachmentType == vboxcon.NetworkAttachmentType_Internal:
+                reporter.log("    attachmentType: Internal (%s)" % (oNic.attachmentType));
+                reporter.log("    intnet-name:    %s" % (oNic.internalNetwork,));
+            elif oNic.attachmentType == vboxcon.NetworkAttachmentType_HostOnly:
+                reporter.log("    attachmentType: HostOnly (%s)" % (oNic.attachmentType));
+                if self.fpApiVer >= 4.1:
+                    reporter.log("    hostInterface:  %s" % (oNic.hostOnlyInterface));
+                else:
+                    reporter.log("    hostInterface:  %s" % (oNic.hostInterface));
+            else:
+                if self.fpApiVer >= 4.1:
+                    if oNic.attachmentType == vboxcon.NetworkAttachmentType_Generic:
+                        reporter.log("    attachmentType: Generic (%s)" % (oNic.attachmentType));
+                        reporter.log("    generic-driver: %s" % (oNic.GenericDriver));
+                    else:
+                        reporter.log("    attachmentType: unknown-%s" % (oNic.attachmentType));
+                else:
+                    reporter.log("    attachmentType: unknown-%s" % (oNic.attachmentType));
+            if oNic.traceEnabled:
+                reporter.log("    traceFile:      %s" % (oNic.traceFile));
+            self.processPendingEvents();
+        return True;
+
+    def logVmInfo(self, oVM):                                                   # pylint: disable=R0915,R0912
+        """
+        Logs VM configuration details.
+
+        This is copy, past, search, replace and edit of infoCmd from vboxshell.py.
+        """
+        try:
+            fRc = self._logVmInfoUnsafe(oVM);
+        except:
+            reporter.logXcpt();
+            fRc = False;
+        return fRc;
+
+    def logVmInfoByName(self, sName):
+        """
+        logVmInfo + getVmByName.
+        """
+        return self.logVmInfo(self.getVmByName(sName));
+
+    def tryFindGuestOsId(self, sIdOrDesc):
+        """
+        Takes a guest OS ID or Description and returns the ID.
+        If nothing matching it is found, the input is returned unmodified.
+        """
+
+        if self.fpApiVer >= 4.0:
+            if sIdOrDesc == 'Solaris (64 bit)':
+                sIdOrDesc = 'Oracle Solaris 10 5/09 and earlier (64 bit)';
+
+        try:
+            aoGuestTypes = self.oVBoxMgr.getArray(self.oVBox, 'GuestOSTypes');
+        except:
+            reporter.logXcpt();
+        else:
+            for oGuestOS in aoGuestTypes:
+                try:
+                    sId   = oGuestOS.id;
+                    sDesc = oGuestOS.description;
+                except:
+                    reporter.logXcpt();
+                else:
+                    if sIdOrDesc == sId or sIdOrDesc == sDesc:
+                        sIdOrDesc = sId;
+                        break;
+        self.processPendingEvents();
+        return sIdOrDesc
+
+    def resourceFindVmHd(self, sVmName, sFlavor):
+        """
+        Search the test resources for the most recent VM HD.
+
+        Returns path relative to the test resource root.
+        """
+        ## @todo implement a proper search algo here.
+        return '4.2/' + sFlavor + '/' + sVmName + '/t-' + sVmName + '.vdi';
+
+
+    #
+    # VM Api wrappers that logs errors, hides exceptions and other details.
+    #
+
+    # pylint: disable=R0913,R0914
+    def createTestVM(self, sName, iGroup, sHd = None, cMbRam = None, cCpus = 1, fVirtEx = None, fNestedPaging = None, \
+                     sDvdImage = None, sKind = "Other", fIoApic = None, fPae = None, fFastBootLogo = True, \
+                     eNic0Type = None, eNic0AttachType = None, sNic0NetName = 'default', sNic0MacAddr = 'grouped', \
+                     sFloppy = None, fNatForwardingForTxs = None, sHddControllerType = 'IDE Controller', \
+                     fVmmDevTestingPart = None, fVmmDevTestingMmio = False):
+        """
+        Creates a test VM with a immutable HD from the test resources.
+        """
+        if not self.importVBoxApi():
+            return None;
+
+        # create + register the VM
+        try:
+            if self.fpApiVer >= 4.2: # Introduces grouping (third parameter, empty for now).
+                oVM = self.oVBox.createMachine("", sName, [], self.tryFindGuestOsId(sKind), "");
+            elif self.fpApiVer >= 4.0:
+                oVM = self.oVBox.createMachine("", sName, self.tryFindGuestOsId(sKind), "", False);
+            elif self.fpApiVer >= 3.2:
+                oVM = self.oVBox.createMachine(sName, self.tryFindGuestOsId(sKind), "", "", False);
+            else:
+                oVM = self.oVBox.createMachine(sName, self.tryFindGuestOsId(sKind), "", "");
+            try:
+                oVM.saveSettings();
+                try:
+                    self.oVBox.registerMachine(oVM);
+                except:
+                    raise;
+            except:
+                if self.fpApiVer >= 4.0:
+                    try:
+                        if self.fpApiVer >= 4.3:
+                            oProgress = oVM.deleteConfig(None);
+                        else:
+                            oProgress = oVM.delete(None);
+                        self.waitOnProgress(oProgress);
+                    except:
+                        reporter.logXcpt();
+                else:
+                    try:    oVM.deleteSettings();
+                    except: reporter.logXcpt();
+                raise;
+        except:
+            reporter.errorXcpt('failed to create vm "%s"' % (sName));
+            return None;
+
+        # Configure the VM.
+        fRc = True;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            fRc = oSession.setupPreferredConfig();
+
+            if fRc and cMbRam is not None :
+                fRc = oSession.setRamSize(cMbRam);
+            if fRc and cCpus is not None:
+                fRc = oSession.setCpuCount(cCpus);
+            if fRc and fVirtEx is not None:
+                fRc = oSession.enableVirtEx(fVirtEx);
+            if fRc and fNestedPaging is not None:
+                fRc = oSession.enableNestedPaging(fNestedPaging);
+            if fRc and fIoApic is not None:
+                fRc = oSession.enableIoApic(fIoApic);
+            if fRc and fPae is not None:
+                fRc = oSession.enablePae(fPae);
+            if fRc and sDvdImage is not None:
+                fRc = oSession.attachDvd(sDvdImage);
+            if fRc and sHd is not None:
+                fRc = oSession.attachHd(sHd, sHddControllerType);
+            if fRc and sFloppy is not None:
+                fRc = oSession.attachFloppy(sFloppy);
+            if fRc and eNic0Type is not None:
+                fRc = oSession.setNicType(eNic0Type, 0);
+            if fRc and (eNic0AttachType is not None  or  (sNic0NetName is not None and sNic0NetName != 'default')):
+                fRc = oSession.setNicAttachment(eNic0AttachType, sNic0NetName, 0);
+            if fRc and sNic0MacAddr is not None:
+                if sNic0MacAddr == 'grouped':
+                    sNic0MacAddr = '%02u' % (iGroup);
+                fRc = oSession.setNicMacAddress(sNic0MacAddr, 0);
+            if fRc and fNatForwardingForTxs is True:
+                fRc = oSession.setupNatForwardingForTxs();
+            if fRc and fFastBootLogo is not None:
+                fRc = oSession.setupBootLogo(fFastBootLogo);
+            if fRc and self.fEnableVrdp:
+                fRc = oSession.setupVrdp(True, self.uVrdpBasePort + iGroup);
+            if fRc and fVmmDevTestingPart is not None:
+                fRc = oSession.enableVmmDevTestingPart(fVmmDevTestingPart, fVmmDevTestingMmio);
+
+            if fRc: fRc = oSession.saveSettings();
+            if not fRc:   oSession.discardSettings(True);
+            oSession.close();
+        if not fRc:
+            try:    self.oVBox.unregisterMachine(oVM.id);
+            except: pass;
+            if self.fpApiVer >= 4.0:
+                try:
+                    if self.fpApiVer >= 4.3:
+                        oProgress = oVM.deleteConfig(None);
+                    else:
+                        oProgress = oVM.delete(None);
+                    self.waitOnProgress(oProgress);
+                except:
+                    reporter.logXcpt();
+            else:
+                try:    oVM.deleteSettings();
+                except: reporter.logXcpt();
+            return None;
+
+        # success.
+        reporter.log('created "%s" with name "%s"' % (oVM.id, sName));
+        self.aoVMs.append(oVM);
+        self.logVmInfo(oVM); # testing...
+        return oVM;
+    # pylint: enable=R0913,R0914
+
+    def addTestMachine(self, sNameOrId, fQuiet = False):
+        """
+        Adds an already existing (that is, configured) test VM to the
+        test VM list.
+        """
+        # find + add the VM to the list.
+        try:
+            if self.fpApiVer >= 4.0:
+                oVM = self.oVBox.findMachine(sNameOrId);
+            else:
+                reporter.error('Port me!'); ## @todo Add support for older version < 4.0.
+        except:
+            reporter.errorXcpt('could not find vm "%s"' % (sNameOrId,));
+            return None;
+
+        self.aoVMs.append(oVM);
+        if not fQuiet:
+            reporter.log('Added "%s" with name "%s"' % (oVM.id, sNameOrId));
+            self.logVmInfo(oVM);
+        return oVM;
+
+    def openSession(self, oVM):
+        """
+        Opens a session for the VM.  Returns the a Session wrapper object that
+        will automatically close the session when the wrapper goes out of scope.
+
+        On failure None is returned and an error is logged.
+        """
+        try:
+            sUuid = oVM.id;
+        except:
+            reporter.errorXcpt('failed to get the UUID for VM "%s"' % (oVM,));
+            return None;
+
+        # This loop is a kludge to deal with us racing the closing of the
+        # direct session of a previous VM run. See waitOnDirectSessionClose.
+        for i in range(10):
+            try:
+                if self.fpApiVer <= 3.2:
+                    oSession = self.oVBoxMgr.openMachineSession(sUuid);
+                else:
+                    oSession = self.oVBoxMgr.openMachineSession(oVM);
+                break;
+            except:
+                if i == 9:
+                    reporter.errorXcpt('failed to open session for "%s" ("%s")' % (sUuid, oVM));
+                    return None;
+                if i > 0:
+                    reporter.logXcpt('warning: failed to open session for "%s" ("%s") - retrying in %u secs' % (sUuid, oVM, i));
+            self.waitOnDirectSessionClose(oVM, 5000 + i * 1000);
+        from testdriver.vboxwrappers import SessionWrapper;
+        return SessionWrapper(oSession, oVM, self.oVBox, self.oVBoxMgr, self, False);
+
+    def getVmByName(self, sName):
+        """
+        Get a test VM by name.  Returns None if not found, logged.
+        """
+        # Look it up in our 'cache'.
+        for oVM in self.aoVMs:
+            try:
+                #reporter.log2('cur: %s / %s (oVM=%s)' % (oVM.name, oVM.id, oVM));
+                if oVM.name == sName:
+                    return oVM;
+            except:
+                reporter.errorXcpt('failed to get the name from the VM "%s"' % (oVM));
+
+        # Look it up the standard way.
+        return self.addTestMachine(sName, fQuiet = True);
+
+    def getVmByUuid(self, sUuid):
+        """
+        Get a test VM by uuid.  Returns None if not found, logged.
+        """
+        # Look it up in our 'cache'.
+        for oVM in self.aoVMs:
+            try:
+                if oVM.id == sUuid:
+                    return oVM;
+            except:
+                reporter.errorXcpt('failed to get the UUID from the VM "%s"' % (oVM));
+
+        # Look it up the standard way.
+        return self.addTestMachine(sUuid, fQuiet = True);
+
+    def waitOnProgress(self, oProgress, cMsTimeout = 1000000, fErrorOnTimeout = True, cMsInterval = 1000):
+        """
+        Waits for a progress object to complete.  Returns the status code.
+        """
+        # Wait for progress no longer than cMsTimeout time period.
+        tsStart = datetime.datetime.now()
+        while True:
+            self.processPendingEvents();
+            try:
+                if oProgress.completed:
+                    break;
+            except:
+                return -1;
+            self.processPendingEvents();
+
+            tsNow = datetime.datetime.now()
+            tsDelta = tsNow - tsStart
+            if ((tsDelta.microseconds + tsDelta.seconds * 1000000) / 1000) > cMsTimeout:
+                if fErrorOnTimeout:
+                    reporter.errorTimeout('Timeout while waiting for progress.')
+                return -1
+
+            try:    oProgress.waitForCompletion(cMsInterval);
+            except: return -2;
+
+        try:    rc = oProgress.resultCode;
+        except: rc = -2;
+        self.processPendingEvents();
+        return rc;
+
+    def waitOnDirectSessionClose(self, oVM, cMsTimeout):
+        """
+        Waits for the VM process to close it's current direct session.
+
+        Returns None.
+        """
+        # Get the original values so we're not subject to
+        try:
+            eCurState =             oVM.sessionState;
+            if self.fpApiVer >= 5.0:
+                sCurName  = sOrgName  = oVM.sessionName;
+            else:
+                sCurName  = sOrgName  = oVM.sessionType;
+            if self.fpApiVer >= 4.2:
+                iCurPid   = iOrgPid   = oVM.sessionPID;
+            else:
+                iCurPid   = iOrgPid   = oVM.sessionPid;
+        except Exception, oXcpt:
+            if ComError.notEqual(oXcpt, ComError.E_ACCESSDENIED):
+                reporter.logXcpt();
+            self.processPendingEvents();
+            return None;
+        self.processPendingEvents();
+
+        msStart = base.timestampMilli();
+        while iCurPid  == iOrgPid \
+          and sCurName == sOrgName \
+          and sCurName != '' \
+          and base.timestampMilli() - msStart < cMsTimeout \
+          and (   eCurState == vboxcon.SessionState_Unlocking \
+               or eCurState == vboxcon.SessionState_Spawning \
+               or eCurState == vboxcon.SessionState_Locked):
+            self.processEvents(1000);
+            try:
+                eCurState = oVM.sessionState;
+                sCurName  = oVM.sessionName if self.fpApiVer >= 5.0 else oVM.sessionType;
+                iCurPid   = oVM.sessionPID if self.fpApiVer >= 4.2 else oVM.sessionPid;
+            except Exception, oXcpt:
+                if ComError.notEqual(oXcpt, ComError.E_ACCESSDENIED):
+                    reporter.logXcpt();
+                break;
+            self.processPendingEvents();
+        self.processPendingEvents();
+        return None;
+
+    def uploadStartupLogFile(self, oVM, sVmName):
+        """
+        Uploads the VBoxStartup.log when present.
+        """
+        fRc = True;
+        try:
+            sLogFile = os.path.join(oVM.logFolder, 'VBoxStartup.log');
+        except:
+            reporter.logXcpt();
+            fRc = False;
+        else:
+            if os.path.isfile(sLogFile):
+                reporter.addLogFile(sLogFile, 'log/release/vm', '%s startup log' % (sVmName, ),
+                                    sAltName = '%s-%s' % (sVmName, os.path.basename(sLogFile),));
+        return fRc;
+
+    def startVmEx(self, oVM, fWait = True, sType = None, sName = None, asEnv = None): # pylint: disable=R0914,R0915
+        """
+        Start the VM, returning the VM session and progress object on success.
+        The session is also added to the task list and to the aoRemoteSessions set.
+
+        asEnv is a list of string on the putenv() form.
+
+        On failure (None, None) is returned and an error is logged.
+        """
+        # Massage and check the input.
+        if sType is None:
+            sType = self.sSessionType;
+        if sName is None:
+            try:    sName = oVM.name;
+            except: sName = 'bad-vm-handle';
+        reporter.log2('startVmEx: sName=%s fWait=%s sType=%s' % (sName, fWait, sType));
+        if oVM is None:
+            return (None, None);
+
+        ## @todo Do this elsewhere.
+        # Hack alert. Disables all annoying GUI popups.
+        if sType == 'gui' and len(self.aoRemoteSessions) == 0:
+            try:
+                self.oVBox.setExtraData('GUI/Input/AutoCapture', 'false');
+                if self.fpApiVer >= 3.2:
+                    self.oVBox.setExtraData('GUI/LicenseAgreed', '8');
+                else:
+                    self.oVBox.setExtraData('GUI/LicenseAgreed', '7');
+                self.oVBox.setExtraData('GUI/RegistrationData',  'triesLeft=0');
+                self.oVBox.setExtraData('GUI/SUNOnlineData',     'triesLeft=0');
+                self.oVBox.setExtraData('GUI/SuppressMessages',  'confirmVMReset,remindAboutMouseIntegrationOn,'
+                                        'remindAboutMouseIntegrationOff,remindAboutPausedVMInput,confirmInputCapture,'
+                                        'confirmGoingFullscreen,remindAboutInaccessibleMedia,remindAboutWrongColorDepth,'
+                                        'confirmRemoveMedium,allPopupPanes,allMessageBoxes,all');
+                self.oVBox.setExtraData('GUI/UpdateDate',        'never');
+                self.oVBox.setExtraData('GUI/PreventBetaWarning', self.oVBox.version);
+            except:
+                reporter.logXcpt();
+
+        # The UUID for the name.
+        try:
+            sUuid = oVM.id;
+        except:
+            reporter.errorXcpt('failed to get the UUID for VM "%s"' % (oVM));
+            return (None, None);
+        self.processPendingEvents();
+
+        # Construct the environment.
+        sLogFile = '%s/VM-%s.log' % (self.sScratchPath, sUuid);
+        try:    os.remove(sLogFile);
+        except: pass;
+        if self.sLogSessionDest:
+            sLogDest = self.sLogSessionDest;
+        else:
+            sLogDest = 'file=%s' % sLogFile;
+        sEnv = 'VBOX_LOG=%s\nVBOX_LOG_FLAGS=%s\nVBOX_LOG_DEST=%s\nVBOX_RELEASE_LOG_FLAGS=append time' \
+             % (self.sLogSessionGroups, self.sLogSessionFlags, sLogDest,);
+        if sType == 'gui':
+            sEnv += '\nVBOX_GUI_DBG_ENABLED=1'
+        if asEnv is not None and len(asEnv) > 0:
+            sEnv += '\n' + ('\n'.join(asEnv));
+
+        # Shortcuts for local testing.
+        oProgress = oWrapped = None;
+        oTestVM = self.oTestVmSet.findTestVmByName(sName) if self.oTestVmSet is not None else None;
+        try:
+            if    oTestVM is not None \
+              and oTestVM.fSnapshotRestoreCurrent is True:
+                if oVM.state is vboxcon.MachineState_Running:
+                    reporter.log2('Machine "%s" already running.' % (sName,));
+                    oProgress = None;
+                    oWrapped  = self.openSession(oVM);
+                else:
+                    reporter.log2('Checking if snapshot for machine "%s" exists.' % (sName,));
+                    oSessionWrapperRestore = self.openSession(oVM);
+                    if oSessionWrapperRestore is not None:
+                        oSnapshotCur = oVM.currentSnapshot;
+                        if oSnapshotCur is not None:
+                            reporter.log2('Restoring snapshot for machine "%s".' % (sName,));
+                            oSessionWrapperRestore.restoreSnapshot(oSnapshotCur);
+                            reporter.log2('Current snapshot for machine "%s" restored.' % (sName,));
+                        else:
+                            reporter.log('warning: no current snapshot for machine "%s" found.' % (sName,));
+                    oSessionWrapperRestore.close();
+        except:
+            reporter.errorXcpt();
+            return (None, None);
+
+        # Open a remote session, wait for this operation to complete.
+        # (The loop is a kludge to deal with us racing the closing of the
+        # direct session of a previous VM run. See waitOnDirectSessionClose.)
+        if oWrapped is None:
+            for i in range(10):
+                try:
+                    if   self.fpApiVer < 4.3 \
+                      or (self.fpApiVer == 4.3 and not hasattr(self.oVBoxMgr, 'getSessionObject')):
+                        oSession = self.oVBoxMgr.mgr.getSessionObject(self.oVBox);  # pylint: disable=E1101
+                    else:
+                        oSession = self.oVBoxMgr.getSessionObject(self.oVBox);      # pylint: disable=E1101
+                    if self.fpApiVer < 3.3:
+                        oProgress = self.oVBox.openRemoteSession(oSession, sUuid, sType, sEnv);
+                    else:
+                        oProgress = oVM.launchVMProcess(oSession, sType, sEnv);
+                    break;
+                except:
+                    if i == 9:
+                        reporter.errorXcpt('failed to start VM "%s" ("%s"), aborting.' % (sUuid, sName));
+                        return (None, None);
+                    oSession = None;
+                    if i >= 0:
+                        reporter.logXcpt('warning: failed to start VM "%s" ("%s") - retrying in %u secs.' % (sUuid, oVM, i));     # pylint: disable=C0301
+                self.waitOnDirectSessionClose(oVM, 5000 + i * 1000);
+        if fWait and oProgress is not None:
+            rc = self.waitOnProgress(oProgress);
+            if rc < 0:
+                self.waitOnDirectSessionClose(oVM, 5000);
+                try:
+                    if oSession is not None:
+                        oSession.close();
+                except: pass;
+                reportError(oProgress, 'failed to open session for "%s"' % (sName));
+                self.uploadStartupLogFile(oVM, sName);
+                return (None, None);
+            reporter.log2('waitOnProgress -> %s' % (rc,));
+
+        # Wrap up the session object and push on to the list before returning it.
+        if oWrapped is None:
+            from testdriver.vboxwrappers import SessionWrapper;
+            oWrapped = SessionWrapper(oSession, oVM, self.oVBox, self.oVBoxMgr, self, True, sName, sLogFile);
+
+        oWrapped.registerEventHandlerForTask();
+        self.aoRemoteSessions.append(oWrapped);
+        if oWrapped is not self.aoRemoteSessions[len(self.aoRemoteSessions) - 1]:
+            reporter.error('not by reference: oWrapped=%s aoRemoteSessions[%s]=%s'
+                           % (oWrapped, len(self.aoRemoteSessions) - 1,
+                              self.aoRemoteSessions[len(self.aoRemoteSessions) - 1]));
+        self.addTask(oWrapped);
+
+        reporter.log2('startVmEx: oSession=%s, oSessionWrapper=%s, oProgress=%s' % (oSession, oWrapped, oProgress));
+
+        from testdriver.vboxwrappers import ProgressWrapper;
+        return (oWrapped, ProgressWrapper(oProgress, self.oVBoxMgr, self,
+                                          'starting %s' % (sName,)) if oProgress else None);
+
+    def startVm(self, oVM, sType=None, sName = None, asEnv = None):
+        """ Simplified version of startVmEx.  """
+        oSession, _ = self.startVmEx(oVM, True, sType, sName, asEnv = asEnv);
+        return oSession;
+
+    def startVmByNameEx(self, sName, fWait=True, sType=None, asEnv = None):
+        """
+        Start the VM, returning the VM session and progress object on success.
+        The session is also added to the task list and to the aoRemoteSessions set.
+
+        On failure (None, None) is returned and an error is logged.
+        """
+        oVM = self.getVmByName(sName);
+        if oVM is None:
+            return (None, None);
+        return self.startVmEx(oVM, fWait, sType, sName, asEnv = asEnv);
+
+    def startVmByName(self, sName, sType=None, asEnv = None):
+        """
+        Start the VM, returning the VM session on success.  The session is
+        also added to the task list and to the aoRemoteSessions set.
+
+        On failure None is returned and an error is logged.
+        """
+        oSession, _ = self.startVmByNameEx(sName, True, sType, asEnv = asEnv);
+        return oSession;
+
+    def terminateVmBySession(self, oSession, oProgress = None, fTakeScreenshot = None):
+        """
+        Terminates the VM specified by oSession and adds the release logs to
+        the test report.
+
+        This will try archive this by using powerOff, but will resort to
+        tougher methods if that fails.
+
+        The session will always be removed from the task list.
+        The session will be closed unless we fail to kill the process.
+        The session will be removed from the remote session list if closed.
+
+        The progress object (a wrapper!) is for teleportation and similar VM
+        operations, it will be attempted canceled before powering off the VM.
+        Failures are logged but ignored.
+        The progress object will always be removed from the task list.
+
+        Returns True if powerOff and session close both succeed.
+        Returns False if on failure (logged), including when we successfully
+        kill the VM process.
+        """
+        reporter.log2('terminateVmBySession: oSession=%s (pid=%s) oProgress=%s' % (oSession.sName, oSession.getPid(), oProgress));
+
+        # Call getPid first to make sure the PID is cached in the wrapper.
+        oSession.getPid();
+
+        #
+        # Take Screenshot and upload it (see below) to Test Manager if appropriate/requested.
+        #
+        sLastScreenshotPath = None
+        if fTakeScreenshot is True  or  self.fAlwaysUploadScreenshots  or  reporter.testErrorCount() > 0:
+            sLastScreenshotPath = os.path.join(self.sScratchPath, "LastScreenshot-%s.png" % oSession.sName)
+            fRc = oSession.takeScreenshot(sLastScreenshotPath)
+            if fRc is not True:
+                sLastScreenshotPath = None
+
+        #
+        # Terminate the VM
+        #
+
+        # Cancel the progress object if specified.
+        if oProgress is not None:
+            if not oProgress.isCompleted()  and  oProgress.isCancelable():
+                reporter.log2('terminateVmBySession: canceling "%s"...' % (oProgress.sName));
+                try:
+                    oProgress.o.cancel();
+                except:
+                    reporter.logXcpt();
+                else:
+                    oProgress.wait();
+            self.removeTask(oProgress);
+
+        # Check if the VM has terminated by it self before powering it off.
+        fClose = True;
+        fRc = oSession.pollTask();
+        if fRc is not True:
+            reporter.log('terminateVmBySession: powering off "%s"...' % (oSession.sName,));
+            fRc = oSession.powerOff(fFudgeOnFailure = False);
+        if fRc is not True:
+            # power off failed, try terminate it in a nice manner.
+            fRc = False;
+            uPid = oSession.getPid();
+            if uPid is not None:
+                reporter.error('terminateVmBySession: Terminating PID %u (VM %s)' % (uPid, oSession.sName));
+                fClose = base.processTerminate(uPid);
+                if fClose is True:
+                    self.waitOnDirectSessionClose(oSession.oVM, 5000);
+                    fClose = oSession.waitForTask(1000);
+
+                if fClose is not True:
+                    # Being nice failed...
+                    reporter.error('terminateVmBySession: Termination failed, trying to kill PID %u (VM %s) instead' \
+                                   % (uPid, oSession.sName));
+                    fClose = base.processKill(uPid);
+                    if fClose is True:
+                        self.waitOnDirectSessionClose(oSession.oVM, 5000);
+                        fClose = oSession.waitForTask(1000);
+                    if fClose is not True:
+                        reporter.error('terminateVmBySession: Failed to kill PID %u (VM %s)' % (uPid, oSession.sName));
+
+        # The final steps.
+        if fClose is True:
+            oSession.close();
+            self.waitOnDirectSessionClose(oSession.oVM, 10000);
+            try:
+                eState = oSession.oVM.state;
+            except:
+                reporter.logXcpt();
+            else:
+                if eState == vboxcon.MachineState_Aborted:
+                    reporter.error('terminateVmBySession: The VM "%s" aborted!' % (oSession.sName,));
+        self.removeTask(oSession);
+
+        #
+        # Add the release log, debug log and a screenshot of the VM to the test report.
+        #
+        if self.fAlwaysUploadLogs or reporter.testErrorCount() > 0:
+            oSession.addLogsToReport();
+
+        # Add a screenshot if it has been requested and taken successfully.
+        if sLastScreenshotPath is not None:
+            if reporter.testErrorCount() > 0:
+                reporter.addLogFile(sLastScreenshotPath, 'screenshot/failure', 'Last VM screenshot');
+            else:
+                reporter.addLogFile(sLastScreenshotPath, 'screenshot/success', 'Last VM screenshot');
+
+        return fRc;
+
+
+    #
+    # Some information query functions (mix).
+    #
+    # Methods require the VBox API.  If the information is provided by both
+    # the testboxscript as well as VBox API, we'll check if it matches.
+    #
+
+    def _hasHostCpuFeature(self, sEnvVar, sEnum, fpApiMinVer, fQuiet):
+        """
+        Common Worker for hasHostNestedPaging() and hasHostHwVirt().
+
+        Returns True / False.
+        Raises exception on environment / host mismatch.
+        """
+        fEnv = os.environ.get(sEnvVar, None);
+        if fEnv is not None:
+            fEnv = fEnv.lower() not in [ 'false', 'f', 'not', 'no', 'n', '0', ];
+
+        fVBox = None;
+        self.importVBoxApi();
+        if self.fpApiVer >= fpApiMinVer and hasattr(vboxcon, sEnum):
+            try:
+                fVBox = self.oVBox.host.getProcessorFeature(getattr(vboxcon, sEnum));
+            except:
+                if not fQuiet:
+                    reporter.logXcpt();
+
+        if fVBox is not None:
+            if fEnv is not None:
+                if fEnv != fVBox and not fQuiet:
+                    reporter.log('TestBox configuration overwritten: fVBox=%s (%s) vs. fEnv=%s (%s)'
+                                 % (fVBox, sEnum, fEnv, sEnvVar));
+                return fEnv;
+            return fVBox;
+        if fEnv is not None:
+            return fEnv;
+        return False;
+
+    def hasHostHwVirt(self, fQuiet = False):
+        """
+        Checks if hardware assisted virtualization is supported by the host.
+
+        Returns True / False.
+        Raises exception on environment / host mismatch.
+        """
+        return self._hasHostCpuFeature('TESTBOX_HAS_HW_VIRT', 'ProcessorFeature_HWVirtEx', 3.1, fQuiet);
+
+    def hasHostNestedPaging(self, fQuiet = False):
+        """
+        Checks if nested paging is supported by the host.
+
+        Returns True / False.
+        Raises exception on environment / host mismatch.
+        """
+        return self._hasHostCpuFeature('TESTBOX_HAS_NESTED_PAGING', 'ProcessorFeature_NestedPaging', 4.2, fQuiet) \
+           and self.hasHostHwVirt(fQuiet);
+
+    def hasHostLongMode(self, fQuiet = False):
+        """
+        Checks if the host supports 64-bit guests.
+
+        Returns True / False.
+        Raises exception on environment / host mismatch.
+        """
+        # Note that the testboxscript doesn't export this variable atm.
+        return self._hasHostCpuFeature('TESTBOX_HAS_LONG_MODE', 'ProcessorFeature_LongMode', 3.1, fQuiet);
+
+    def getHostCpuCount(self, fQuiet = False):
+        """
+        Returns the number of CPUs on the host.
+
+        Returns True / False.
+        Raises exception on environment / host mismatch.
+        """
+        cEnv = os.environ.get('TESTBOX_CPU_COUNT', None);
+        if cEnv is not None:
+            cEnv = int(cEnv);
+
+        try:
+            cVBox = self.oVBox.host.processorOnlineCount;
+        except:
+            if not fQuiet:
+                reporter.logXcpt();
+            cVBox = None;
+
+        if cVBox is not None:
+            if cEnv is not None:
+                assert cVBox == cEnv, 'Misconfigured TestBox: VBox: %u CPUs, testboxscript: %u CPUs' % (cVBox, cEnv);
+            return cVBox;
+        if cEnv is not None:
+            return cEnv;
+        return 1;
+
+    def _getHostCpuDesc(self, fQuiet = False):
+        """
+        Internal method used for getting the host CPU description from VBoxSVC.
+        Returns description string, on failure an empty string is returned.
+        """
+        try:
+            return self.oVBox.host.getProcessorDescription(0);
+        except:
+            if not fQuiet:
+                reporter.logXcpt();
+        return '';
+
+    def isHostCpuAmd(self, fQuiet = False):
+        """
+        Checks if the host CPU vendor is AMD.
+
+        Returns True / False.
+        """
+        sCpuDesc = self._getHostCpuDesc(fQuiet);
+        return sCpuDesc.startswith("AMD") or sCpuDesc == 'AuthenticAMD';
+
+    def isHostCpuIntel(self, fQuiet = False):
+        """
+        Checks if the host CPU vendor is Intel.
+
+        Returns True / False.
+        """
+        sCpuDesc = self._getHostCpuDesc(fQuiet);
+        return sCpuDesc.startswith("Intel") or sCpuDesc == 'GenuineIntel';
+
+    def isHostCpuVia(self, fQuiet = False):
+        """
+        Checks if the host CPU vendor is VIA (or Centaur).
+
+        Returns True / False.
+        """
+        sCpuDesc = self._getHostCpuDesc(fQuiet);
+        return sCpuDesc.startswith("VIA") or sCpuDesc == 'CentaurHauls';
+
+
+    #
+    # Testdriver execution methods.
+    #
+
+    def handleTask(self, oTask, sMethod):
+        """
+        Callback method for handling unknown tasks in the various run loops.
+
+        The testdriver should override this if it already tasks running when
+        calling startVmAndConnectToTxsViaTcp, txsRunTest or similar methods.
+        Call super to handle unknown tasks.
+
+        Returns True if handled, False if not.
+        """
+        reporter.error('%s: unknown task %s' % (sMethod, oTask));
+        return False;
+
+    def txsDoTask(self, oSession, oTxsSession, fnAsync, aArgs):
+        """
+        Generic TXS task wrapper which waits both on the TXS and the session tasks.
+
+        Returns False on error, logged.
+
+        Returns task result on success.
+        """
+        # All async methods ends with the following to args.
+        cMsTimeout    = aArgs[-2];
+        fIgnoreErrors = aArgs[-1];
+
+        fRemoveVm  = self.addTask(oSession);
+        fRemoveTxs = self.addTask(oTxsSession);
+
+        rc = fnAsync(*aArgs); # pylint: disable=W0142
+        if rc is True:
+            rc = False;
+            oTask = self.waitForTasks(cMsTimeout + 1);
+            if oTask is oTxsSession:
+                if oTxsSession.isSuccess():
+                    rc = oTxsSession.getResult();
+                elif fIgnoreErrors is True:
+                    reporter.log(  'txsDoTask: task failed (%s)' % (oTxsSession.getLastReply()[1],));
+                else:
+                    reporter.error('txsDoTask: task failed (%s)' % (oTxsSession.getLastReply()[1],));
+            else:
+                oTxsSession.cancelTask();
+                if oTask is None:
+                    if fIgnoreErrors is True:
+                        reporter.log(  'txsDoTask: The task timed out.');
+                    else:
+                        reporter.errorTimeout('txsDoTask: The task timed out.');
+                elif oTask is oSession:
+                    reporter.error('txsDoTask: The VM terminated unexpectedly');
+                else:
+                    if fIgnoreErrors is True:
+                        reporter.log(  'txsDoTask: An unknown task %s was returned' % (oTask,));
+                    else:
+                        reporter.error('txsDoTask: An unknown task %s was returned' % (oTask,));
+        else:
+            reporter.error('txsDoTask: fnAsync returned %s' % (rc,));
+
+        if fRemoveTxs:
+            self.removeTask(oTxsSession);
+        if fRemoveVm:
+            self.removeTask(oSession);
+        return rc;
+
+    # pylint: disable=C0111
+
+    def txsDisconnect(self, oSession, oTxsSession, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncDisconnect,
+                              (self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsUuid(self, oSession, oTxsSession, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncUuid,
+                              (self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsMkDir(self, oSession, oTxsSession, sRemoteDir, fMode = 0700, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncMkDir,
+                              (sRemoteDir, fMode, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsMkDirPath(self, oSession, oTxsSession, sRemoteDir, fMode = 0700, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncMkDirPath,
+                              (sRemoteDir, fMode, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsMkSymlink(self, oSession, oTxsSession, sLinkTarget, sLink, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncMkSymlink,
+                              (sLinkTarget, sLink, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsRmDir(self, oSession, oTxsSession, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncRmDir,
+                              (sRemoteDir, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsRmFile(self, oSession, oTxsSession, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncRmFile,
+                              (sRemoteFile, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsRmSymlink(self, oSession, oTxsSession, sRemoteSymlink, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncRmSymlink,
+                              (sRemoteSymlink, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsRmTree(self, oSession, oTxsSession, sRemoteTree, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncRmTree,
+                              (sRemoteTree, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsIsDir(self, oSession, oTxsSession, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncIsDir,
+                              (sRemoteDir, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsIsFile(self, oSession, oTxsSession, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncIsFile,
+                              (sRemoteFile, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsIsSymlink(self, oSession, oTxsSession, sRemoteSymlink, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncIsSymlink,
+                              (sRemoteSymlink, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsUploadFile(self, oSession, oTxsSession, sLocalFile, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncUploadFile, \
+                              (sLocalFile, sRemoteFile, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsUploadString(self, oSession, oTxsSession, sContent, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncUploadString, \
+                              (sContent, sRemoteFile, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsDownloadFile(self, oSession, oTxsSession, sRemoteFile, sLocalFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncDownloadFile, \
+                              (sRemoteFile, sLocalFile, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsDownloadFiles(self, oSession, oTxsSession, asFiles, fIgnoreErrors = False):
+        """
+        Convenience function to get files from the guest and stores it
+        into the scratch directory for later (manual) review.
+
+        Returns True on success.
+
+        Returns False on failure, logged.
+        """
+        fRc = True;
+        for sGstFile in asFiles:
+            ## @todo Check for already existing files on the host and create a new
+            #        name for the current file to download.
+            sTmpFile = os.path.join(self.sScratchPath, 'tmp-' + os.path.basename(sGstFile));
+            reporter.log2('Downloading file "%s" to "%s" ...' % (sGstFile, sTmpFile));
+            fRc = self.txsDownloadFile(oSession, oTxsSession, sGstFile, sTmpFile, 30 * 1000, fIgnoreErrors);
+            try:    os.unlink(sTmpFile);
+            except: pass;
+            if fRc:
+                reporter.addLogFile(sTmpFile, 'misc/other', 'guest - ' + sGstFile);
+            else:
+                if fIgnoreErrors is not True:
+                    reporter.error('error downloading file "%s" to "%s"' % (sGstFile, sTmpFile));
+                    return fRc;
+                reporter.log('warning: file "%s" was not downloaded, ignoring.' % (sGstFile,));
+        return True;
+
+    def txsDownloadString(self, oSession, oTxsSession, sRemoteFile, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncDownloadString,
+                              (sRemoteFile, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    def txsUnpackFile(self, oSession, oTxsSession, sRemoteFile, sRemoteDir, cMsTimeout = 30000, fIgnoreErrors = False):
+        return self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncUnpackFile, \
+                              (sRemoteFile, sRemoteDir, self.adjustTimeoutMs(cMsTimeout), fIgnoreErrors));
+
+    # pylint: enable=C0111
+
+    def txsCdWait(self, oSession, oTxsSession, cMsTimeout = 30000, sFileCdWait = 'vboxtxs-readme.txt'):
+        """
+        Mostly an internal helper for txsRebootAndReconnectViaTcp and
+        startVmAndConnectToTxsViaTcp that waits for the CDROM drive to become
+        ready.  It does this by polling for a file it knows to exist on the CD.
+
+        Returns True on success.
+
+        Returns False on failure, logged.
+        """
+
+        fRemoveVm   = self.addTask(oSession);
+        fRemoveTxs  = self.addTask(oTxsSession);
+        cMsTimeout  = self.adjustTimeoutMs(cMsTimeout);
+        msStart     = base.timestampMilli();
+        cMsTimeout2 = cMsTimeout;
+        fRc         = oTxsSession.asyncIsFile('${CDROM}/%s' % (sFileCdWait), cMsTimeout2);
+        if fRc is True:
+            while True:
+                # wait for it to complete.
+                oTask = self.waitForTasks(cMsTimeout2 + 1);
+                if oTask is not oTxsSession:
+                    oTxsSession.cancelTask();
+                    if oTask is None:
+                        reporter.errorTimeout('txsToCdWait: The task timed out (after %s ms).'
+                                              % (base.timestampMilli() - msStart,));
+                    elif oTask is oSession:
+                        reporter.error('txsToCdWait: The VM terminated unexpectedly');
+                    else:
+                        reporter.error('txsToCdWait: An unknown task %s was returned' % (oTask,));
+                    fRc = False;
+                    break;
+                if oTxsSession.isSuccess():
+                    break;
+
+                # Check for timeout.
+                cMsElapsed = base.timestampMilli() - msStart;
+                if cMsElapsed >= cMsTimeout:
+                    reporter.error('txsToCdWait: timed out');
+                    fRc = False;
+                    break;
+
+                # delay.
+                self.sleep(1);
+
+                # resubmitt the task.
+                cMsTimeout2 = msStart + cMsTimeout - base.timestampMilli();
+                if cMsTimeout2 < 500:
+                    cMsTimeout2 = 500;
+                fRc = oTxsSession.asyncIsFile('${CDROM}/%s' % (sFileCdWait), cMsTimeout2);
+                if fRc is not True:
+                    reporter.error('txsToCdWait: asyncIsFile failed');
+                    break;
+        else:
+            reporter.error('txsToCdWait: asyncIsFile failed');
+
+        if fRemoveTxs:
+            self.removeTask(oTxsSession);
+        if fRemoveVm:
+            self.removeTask(oSession);
+        return fRc;
+
+    def txsDoConnectViaTcp(self, oSession, cMsTimeout, fNatForwardingForTxs = False):
+        """
+        Mostly an internal worker for connecting to TXS via TCP used by the
+        *ViaTcp methods.
+
+        Returns a tuplet with True/False and TxsSession/None depending on the
+        result. Errors are logged.
+        """
+
+        reporter.log2('txsDoConnectViaTcp: oSession=%s, cMsTimeout=%s, fNatForwardingForTxs=%s'
+                      % (oSession, cMsTimeout, fNatForwardingForTxs));
+
+        cMsTimeout = self.adjustTimeoutMs(cMsTimeout);
+        oTxsConnect = oSession.txsConnectViaTcp(cMsTimeout, fNatForwardingForTxs = fNatForwardingForTxs);
+        if oTxsConnect is not None:
+            self.addTask(oTxsConnect);
+            fRemoveVm = self.addTask(oSession);
+            oTask     = self.waitForTasks(cMsTimeout + 1);
+            reporter.log2('txsDoConnectViaTcp: waitForTasks returned %s' % (oTask,));
+            self.removeTask(oTxsConnect);
+            if oTask is oTxsConnect:
+                oTxsSession = oTxsConnect.getResult();
+                if oTxsSession is not None:
+                    reporter.log('txsDoConnectViaTcp: Connected to TXS on %s.' % (oTxsSession.oTransport.sHostname,));
+                    return (True, oTxsSession);
+
+                reporter.error('txsDoConnectViaTcp: failed to connect to TXS.');
+            else:
+                oTxsConnect.cancelTask();
+                if oTask is None:
+                    reporter.errorTimeout('txsDoConnectViaTcp: connect stage 1 timed out');
+                elif oTask is oSession:
+                    oSession.reportPrematureTermination('txsDoConnectViaTcp: ');
+                else:
+                    reporter.error('txsDoConnectViaTcp: unknown/wrong task %s' % (oTask,));
+            if fRemoveVm:
+                self.removeTask(oSession);
+        else:
+            reporter.error('txsDoConnectViaTcp: txsConnectViaTcp failed');
+        return (False, None);
+
+    def startVmAndConnectToTxsViaTcp(self, sVmName, fCdWait = False, cMsTimeout = 15*60000, \
+                                     cMsCdWait = 30000, sFileCdWait = 'vboxtxs-readme.txt', \
+                                     fNatForwardingForTxs = False):
+        """
+        Starts the specified VM and tries to connect to its TXS via TCP.
+        The VM will be powered off if TXS doesn't respond before the specified
+        time has elapsed.
+
+        Returns a the VM and TXS sessions (a two tuple) on success.  The VM
+        session is in the task list, the TXS session is not.
+        Returns (None, None) on failure, fully logged.
+        """
+
+        # Zap the guest IP to make sure we're not getting a stale entry
+        # (unless we're restoring the VM of course).
+        oTestVM = self.oTestVmSet.findTestVmByName(sVmName) if self.oTestVmSet is not None else None;
+        if oTestVM is None \
+          or oTestVM.fSnapshotRestoreCurrent is False:
+            try:
+                oSession1 = self.openSession(self.getVmByName(sVmName));
+                oSession1.delGuestPropertyValue('/VirtualBox/GuestInfo/Net/0/V4/IP');
+                oSession1.saveSettings(True);
+                del oSession1;
+            except:
+                reporter.logXcpt();
+
+        # Start the VM.
+        reporter.log('startVmAndConnectToTxsViaTcp: Starting(/preparing) "%s" (timeout %s s)...' % (sVmName, cMsTimeout / 1000));
+        oSession = self.startVmByName(sVmName);
+        if oSession is not None:
+            # Connect to TXS.
+            reporter.log2('startVmAndConnectToTxsViaTcp: Started(/prepared) "%s", connecting to TXS ...' % (sVmName,));
+            (fRc, oTxsSession) = self.txsDoConnectViaTcp(oSession, cMsTimeout, fNatForwardingForTxs);
+            if fRc is True:
+                if fCdWait:
+                    # Wait for CD?
+                    fRc = self.txsCdWait(oSession, oTxsSession, cMsCdWait, sFileCdWait);
+                    if fRc is not True:
+                        reporter.error('startVmAndConnectToTxsViaTcp: txsCdWait failed');
+                if fRc is True:
+                    # Success!
+                    return (oSession, oTxsSession);
+            else:
+                reporter.error('startVmAndConnectToTxsViaTcp: txsDoConnectViaTcp failed');
+            # If something went wrong while waiting for TXS to be started - take VM screenshot before terminate it
+            self.terminateVmBySession(oSession);
+        return (None, None);
+
+    def txsRebootAndReconnectViaTcp(self, oSession, oTxsSession, fCdWait = False, cMsTimeout = 15*60000, \
+                                    cMsCdWait = 30000, sFileCdWait = 'vboxtxs-readme.txt', fNatForwardingForTxs = False):
+        """
+        Executes the TXS reboot command
+
+        Returns A tuple of True and the new TXS session on success.
+
+        Returns A tuple of False and either the old TXS session or None on failure.
+        """
+        reporter.log2('txsRebootAndReconnect: cMsTimeout=%u' % (cMsTimeout,));
+
+        #
+        # This stuff is a bit complicated because of rebooting being kind of
+        # disruptive to the TXS and such...  The protocol is that TXS will:
+        #   - ACK the reboot command.
+        #   - Shutdown the transport layer, implicitly disconnecting us.
+        #   - Execute the reboot operation.
+        #   - On failure, it will be re-init the transport layer and be
+        #     available pretty much immediately. UUID unchanged.
+        #   - On success, it will be respawed after the reboot (hopefully),
+        #     with a different UUID.
+        #
+        fRc = False;
+        iStart = base.timestampMilli();
+
+        # Get UUID.
+        cMsTimeout2 = min(60000, cMsTimeout);
+        sUuidBefore = self.txsUuid(oSession, oTxsSession, self.adjustTimeoutMs(cMsTimeout2, 60000));
+        if sUuidBefore is not False:
+            # Reboot.
+            cMsElapsed  = base.timestampMilli() - iStart;
+            cMsTimeout2 = cMsTimeout - cMsElapsed;
+            fRc = self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncReboot,
+                                 (self.adjustTimeoutMs(cMsTimeout2, 60000), False));
+            if fRc is True:
+                # Reconnect.
+                if fNatForwardingForTxs is True:
+                    self.sleep(22); # NAT fudge - Two fixes are wanted: 1. TXS connect retries.  2. Main API reboot/reset hint.
+                cMsElapsed = base.timestampMilli() - iStart;
+                (fRc, oTxsSession) = self.txsDoConnectViaTcp(oSession, cMsTimeout - cMsElapsed, fNatForwardingForTxs);
+                if fRc is True:
+                    # Check the UUID.
+                    cMsElapsed  = base.timestampMilli() - iStart;
+                    cMsTimeout2 = min(60000, cMsTimeout - cMsElapsed);
+                    sUuidAfter  = self.txsDoTask(oSession, oTxsSession, oTxsSession.asyncUuid,
+                                                 (self.adjustTimeoutMs(cMsTimeout2, 60000), False));
+                    if sUuidBefore is not False:
+                        if sUuidAfter != sUuidBefore:
+                            reporter.log('The guest rebooted (UUID %s -> %s)' % (sUuidBefore, sUuidAfter))
+
+                            # Do CD wait if specified.
+                            if fCdWait:
+                                fRc = self.txsCdWait(oSession, oTxsSession, cMsCdWait, sFileCdWait);
+                                if fRc is not True:
+                                    reporter.error('txsRebootAndReconnectViaTcp: txsCdWait failed');
+                        else:
+                            reporter.error('txsRebootAndReconnectViaTcp: failed to get UUID (after)');
+                    else:
+                        reporter.error('txsRebootAndReconnectViaTcp: did not reboot (UUID %s)' % (sUuidBefore,));
+                else:
+                    reporter.error('txsRebootAndReconnectViaTcp: txsDoConnectViaTcp failed');
+            else:
+                reporter.error('txsRebootAndReconnectViaTcp: reboot failed');
+        else:
+            reporter.error('txsRebootAndReconnectViaTcp: failed to get UUID (before)');
+        return (fRc, oTxsSession);
+
+    # pylint: disable=R0914,R0913
+
+    def txsRunTest(self, oTxsSession, sTestName, cMsTimeout, sExecName, asArgs = (), asAddEnv = (), sAsUser = ""):
+        """
+        Executes the specified test task, waiting till it completes or times out.
+
+        The VM session (if any) must be in the task list.
+
+        Returns True if we executed the task and nothing abnormal happend.
+        Query the process status from the TXS session.
+
+        Returns False if some unexpected task was signalled or we failed to
+        submit the job.
+        """
+        reporter.testStart(sTestName);
+        reporter.log2('txsRunTest: cMsTimeout=%u sExecName=%s asArgs=%s' % (cMsTimeout, sExecName, asArgs));
+
+        # Submit the job.
+        fRc = False;
+        if oTxsSession.asyncExec(sExecName, asArgs, asAddEnv, sAsUser, cMsTimeout = self.adjustTimeoutMs(cMsTimeout)):
+            self.addTask(oTxsSession);
+
+            # Wait for the job to complete.
+            while True:
+                oTask = self.waitForTasks(cMsTimeout + 1);
+                if oTask is None:
+                    reporter.log('txsRunTest: waitForTasks timed out');
+                    break;
+                if oTask is oTxsSession:
+                    fRc = True;
+                    reporter.log('txsRunTest: isSuccess=%s getResult=%s' % (oTxsSession.isSuccess(), oTxsSession.getResult()));
+                    break;
+                if not self.handleTask(oTask, 'txsRunTest'):
+                    break;
+
+            self.removeTask(oTxsSession);
+            if not oTxsSession.pollTask():
+                oTxsSession.cancelTask();
+        else:
+            reporter.error('txsRunTest: asyncExec failed');
+
+        reporter.testDone();
+        return fRc;
+
+    def txsRunTestRedirectStd(self, oTxsSession, sTestName, cMsTimeout, sExecName, asArgs = (), asAddEnv = (), sAsUser = "",
+                              oStdIn = '/dev/null', oStdOut = '/dev/null', oStdErr = '/dev/null', oTestPipe = '/dev/null'):
+        """
+        Executes the specified test task, waiting till it completes or times out,
+        redirecting stdin, stdout and stderr to the given objects.
+
+        The VM session (if any) must be in the task list.
+
+        Returns True if we executed the task and nothing abnormal happend.
+        Query the process status from the TXS session.
+
+        Returns False if some unexpected task was signalled or we failed to
+        submit the job.
+        """
+        reporter.testStart(sTestName);
+        reporter.log2('txsRunTestRedirectStd: cMsTimeout=%u sExecName=%s asArgs=%s' % (cMsTimeout, sExecName, asArgs));
+
+        # Submit the job.
+        fRc = False;
+        if oTxsSession.asyncExecEx(sExecName, asArgs, asAddEnv, oStdIn, oStdOut, oStdErr,
+                                   oTestPipe, sAsUser, cMsTimeout = self.adjustTimeoutMs(cMsTimeout)):
+            self.addTask(oTxsSession);
+
+            # Wait for the job to complete.
+            while True:
+                oTask = self.waitForTasks(cMsTimeout + 1);
+                if oTask is None:
+                    reporter.log('txsRunTestRedirectStd: waitForTasks timed out');
+                    break;
+                if oTask is oTxsSession:
+                    fRc = True;
+                    reporter.log('txsRunTestRedirectStd: isSuccess=%s getResult=%s'
+                                 % (oTxsSession.isSuccess(), oTxsSession.getResult()));
+                    break;
+                if not self.handleTask(oTask, 'txsRunTestRedirectStd'):
+                    break;
+
+            self.removeTask(oTxsSession);
+            if not oTxsSession.pollTask():
+                oTxsSession.cancelTask();
+        else:
+            reporter.error('txsRunTestRedirectStd: asyncExec failed');
+
+        reporter.testDone();
+        return fRc;
+
+    def txsRunTest2(self, oTxsSession1, oTxsSession2, sTestName, cMsTimeout,
+            sExecName1, asArgs1,
+            sExecName2, asArgs2,
+            asAddEnv1 = (), sAsUser1 = '', fWithTestPipe1 = True,
+            asAddEnv2 = (), sAsUser2 = '', fWithTestPipe2 = True):
+        """
+        Executes the specified test tasks, waiting till they complete or
+        times out.  The 1st task is started after the 2nd one.
+
+        The VM session (if any) must be in the task list.
+
+        Returns True if we executed the task and nothing abnormal happend.
+        Query the process status from the TXS sessions.
+
+        Returns False if some unexpected task was signalled or we failed to
+        submit the job.
+        """
+        reporter.testStart(sTestName);
+
+        # Submit the jobs.
+        fRc = False;
+        if oTxsSession1.asyncExec(sExecName1, asArgs1, asAddEnv1, sAsUser1, fWithTestPipe1, '1-',
+                                  self.adjustTimeoutMs(cMsTimeout)):
+            self.addTask(oTxsSession1);
+
+            self.sleep(2); # fudge! grr
+
+            if oTxsSession2.asyncExec(sExecName2, asArgs2, asAddEnv2, sAsUser2, fWithTestPipe2, '2-',
+                                      self.adjustTimeoutMs(cMsTimeout)):
+                self.addTask(oTxsSession2);
+
+                # Wait for the jobs to complete.
+                cPendingJobs = 2;
+                while True:
+                    oTask = self.waitForTasks(cMsTimeout + 1);
+                    if oTask is None:
+                        reporter.log('txsRunTest2: waitForTasks timed out');
+                        break;
+
+                    if oTask is oTxsSession1 or oTask is oTxsSession2:
+                        if oTask is oTxsSession1:   iTask = 1;
+                        else:                       iTask = 2;
+                        reporter.log('txsRunTest2: #%u - isSuccess=%s getResult=%s' \
+                                     % (iTask,  oTask.isSuccess(), oTask.getResult()));
+                        self.removeTask(oTask);
+                        cPendingJobs -= 1;
+                        if cPendingJobs <= 0:
+                            fRc = True;
+                            break;
+
+                    elif not self.handleTask(oTask, 'txsRunTest'):
+                        break;
+
+                self.removeTask(oTxsSession2);
+                if not oTxsSession2.pollTask():
+                    oTxsSession2.cancelTask();
+            else:
+                reporter.error('txsRunTest2: asyncExec #2 failed');
+
+            self.removeTask(oTxsSession1);
+            if not oTxsSession1.pollTask():
+                oTxsSession1.cancelTask();
+        else:
+            reporter.error('txsRunTest2: asyncExec #1 failed');
+
+        reporter.testDone();
+        return fRc;
+
+    # pylint: enable=R0914,R0913
+
diff --git a/src/VBox/ValidationKit/testdriver/vboxcon.py b/src/VBox/ValidationKit/testdriver/vboxcon.py
new file mode 100644
index 0000000..a83282a
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/vboxcon.py
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+# $Id: vboxcon.py $
+
+"""
+VirtualBox Constants.
+
+See VBoxConstantWrappingHack for details.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import sys
+
+
+class VBoxConstantWrappingHack(object):                                         # pylint: disable=R0903
+    """
+    This is a hack to avoid the self.oVBoxMgr.constants.MachineState_Running
+    uglyness that forces one into the rigth margin...  Anyone using this module
+    can get to the constants easily by:
+
+        import testdriver.vbox as vbox
+        if self.o.machine.state == vbox.MachineState_Running:
+            do stuff;
+
+    For our own convenience we have a global variable 'vbox' that refers to the
+    instance of this class so we can do the same thing from within the module
+    as well (if we didn't we'd have to do testdriver.vbox.MachineState_Running).
+    """
+    def __init__(self, oWrapped):
+        self.oWrapped = oWrapped;
+        self.oVBoxMgr = None;
+        self.fpApiVer = 99.0;
+
+    def __getattr__(self, sName):
+        # Our self.
+        try:
+            return getattr(self.oWrapped, sName)
+        except AttributeError:
+            # The VBox constants.
+            if self.oVBoxMgr is None:
+                raise;
+            try:
+                return getattr(self.oVBoxMgr.constants, sName);
+            except AttributeError:
+                # Do some compatability mappings to keep it working with
+                # older versions.
+                if self.fpApiVer < 3.3:
+                    if sName == 'SessionState_Locked':
+                        return getattr(self.oVBoxMgr.constants, 'SessionState_Open');
+                    if sName == 'SessionState_Unlocked':
+                        return getattr(self.oVBoxMgr.constants, 'SessionState_Closed');
+                    if sName == 'SessionState_Unlocking':
+                        return getattr(self.oVBoxMgr.constants, 'SessionState_Closing');
+                raise;
+
+
+goHackModuleClass = VBoxConstantWrappingHack(sys.modules[__name__]);                         # pylint: disable=C0103
+sys.modules[__name__] = goHackModuleClass;
+
diff --git a/src/VBox/ValidationKit/testdriver/vboxinstaller.py b/src/VBox/ValidationKit/testdriver/vboxinstaller.py
new file mode 100755
index 0000000..ca22987
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/vboxinstaller.py
@@ -0,0 +1,895 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+VirtualBox Installer Wrapper Driver.
+
+This installs VirtualBox, starts a sub driver which does the real testing,
+and then uninstall VirtualBox afterwards.  This reduces the complexity of the
+other VBox test drivers.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 98725 $"
+
+
+# Standard Python imports.
+import os
+import sys
+import re
+#import socket
+import tempfile
+import time
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from common             import utils, webutils;
+from testdriver         import reporter;
+from testdriver.base    import TestDriverBase;
+
+
+
+class VBoxInstallerTestDriver(TestDriverBase):
+    """
+    Implementation of a top level test driver.
+    """
+
+
+    ## State file indicating that we've skipped installation.
+    ksVar_Skipped = 'vboxinstaller-skipped';
+
+
+    def __init__(self):
+        TestDriverBase.__init__(self);
+        self._asSubDriver   = [];   # The sub driver and it's arguments.
+        self._asBuildUrls   = [];   # The URLs passed us on the command line.
+        self._asBuildFiles  = [];   # The downloaded file names.
+        self._fAutoInstallPuelExtPack = True;
+
+    #
+    # Base method we override
+    #
+
+    def showUsage(self):
+        rc = TestDriverBase.showUsage(self);
+        #             0         1         2         3         4         5         6         7         8
+        #             012345678901234567890123456789012345678901234567890123456789012345678901234567890
+        reporter.log('');
+        reporter.log('vboxinstaller Options:');
+        reporter.log('  --vbox-build    <url[,url2[,..]]>');
+        reporter.log('      Comma separated list of URL to file to download and install or/and');
+        reporter.log('      unpack.  URLs without a schema are assumed to be files on the');
+        reporter.log('      build share and will be copied off it.');
+        reporter.log('  --no-puel-extpack');
+        reporter.log('      Indicates that the PUEL extension pack should not be installed if found.');
+        reporter.log('      The default is to install it if found in the vbox-build.');
+        reporter.log('  --');
+        reporter.log('      Indicates the end of our parameters and the start of the sub');
+        reporter.log('      testdriver and its arguments.');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):
+        """
+        Parse our arguments.
+        """
+        if asArgs[iArg] == '--':
+            # End of our parameters and start of the sub driver invocation.
+            iArg = self.requireMoreArgs(1, asArgs, iArg);
+            assert len(self._asSubDriver) == 0;
+            self._asSubDriver = asArgs[iArg:];
+            self._asSubDriver[0] = self._asSubDriver[0].replace('/', os.path.sep);
+            iArg = len(asArgs) - 1;
+        elif asArgs[iArg] == '--vbox-build':
+            # List of files to copy/download and install.
+            iArg = self.requireMoreArgs(1, asArgs, iArg);
+            self._asBuildUrls = asArgs[iArg].split(',');
+        elif asArgs[iArg] == '--no-puel-extpack':
+            self._fAutoInstallPuelExtPack = False;
+        elif asArgs[iArg] == '--puel-extpack':
+            self._fAutoInstallPuelExtPack = True;
+        else:
+            return TestDriverBase.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        #
+        # Check that we've got what we need.
+        #
+        if len(self._asBuildUrls) == 0:
+            reporter.error('No build files specfiied ("--vbox-build file1[,file2[...]]")');
+            return False;
+        if len(self._asSubDriver) == 0:
+            reporter.error('No sub testdriver specified. (" -- test/stuff/tdStuff1.py args")');
+            return False;
+
+        #
+        # Construct _asBuildFiles as an array parallel to _asBuildUrls.
+        #
+        for sUrl in self._asBuildUrls:
+            sDstFile = os.path.join(self.sScratchPath, webutils.getFilename(sUrl));
+            self._asBuildFiles.append(sDstFile);
+
+        return TestDriverBase.completeOptions(self);
+
+    def actionExtract(self):
+        reporter.error('vboxinstall does not support extracting resources, you have to do that using the sub testdriver.');
+        return False;
+
+    def actionCleanupBefore(self):
+        """
+        Kills all VBox process we see.
+
+        This is only supposed to execute on a testbox so we don't need to go
+        all complicated wrt other users.
+        """
+        return self._killAllVBoxProcesses();
+
+    def actionConfig(self):
+        """
+        Install VBox and pass on the configure request to the sub testdriver.
+        """
+        fRc = self._installVBox();
+        if fRc is None: self._persistentVarSet(self.ksVar_Skipped, 'true');
+        else:           self._persistentVarUnset(self.ksVar_Skipped);
+
+        ## @todo vbox.py still has bugs preventing us from invoking it seperately with each action.
+        if fRc is True and 'execute' not in self.asActions and 'all' not in self.asActions:
+            fRc = self._executeSubDriver([ 'verify', ]);
+        if fRc is True and 'execute' not in self.asActions and 'all' not in self.asActions:
+            fRc = self._executeSubDriver([ 'config', ]);
+        return fRc;
+
+    def actionExecute(self):
+        """
+        Execute the sub testdriver.
+        """
+        return self._executeSubDriver(self.asActions);
+
+    def actionCleanupAfter(self):
+        """
+        Forward this to the sub testdriver, then uninstall VBox.
+        """
+        fRc = True;
+        if 'execute' not in self.asActions and 'all' not in self.asActions:
+            fRc = self._executeSubDriver([ 'cleanup-after', ]);
+
+        if not self._killAllVBoxProcesses():
+            fRc = False;
+
+        if not self._uninstallVBox(self._persistentVarExists(self.ksVar_Skipped)):
+            fRc = False;
+
+        if utils.getHostOs() == 'darwin':
+            self._darwinUnmountDmg(fIgnoreError = True); # paranoia
+
+        if not TestDriverBase.actionCleanupAfter(self):
+            fRc = False;
+
+        return fRc;
+
+
+    def actionAbort(self):
+        """
+        Forward this to the sub testdriver first, then do the default pid file
+        based cleanup and finally swipe the scene with the heavy artillery.
+        """
+        fRc1 = self._executeSubDriver([ 'abort', ]);
+        fRc2 = TestDriverBase.actionAbort(self);
+        fRc3 = self._killAllVBoxProcesses();
+        return fRc1 and fRc2 and fRc3;
+
+
+    #
+    # Persistent variables.
+    #
+    ## @todo integrate into the base driver. Persisten accross scratch wipes?
+
+    def __persistentVarCalcName(self, sVar):
+        """Returns the (full) filename for the given persistent variable."""
+        assert re.match(r'^[a-zA-Z0-9_-]*$', sVar) is not None;
+        return os.path.join(self.sScratchPath, 'persistent-%s.var' % (sVar,));
+
+    def _persistentVarSet(self, sVar, sValue = ''):
+        """
+        Sets a persistent variable.
+
+        Returns True on success, False + reporter.error on failure.
+
+        May raise exception if the variable name is invalid or something
+        unexpected happens.
+        """
+        sFull = self.__persistentVarCalcName(sVar);
+        try:
+            oFile = open(sFull, 'w');
+            if len(sValue) > 0:
+                oFile.write(sValue.encode('utf-8'));
+            oFile.close();
+        except:
+            reporter.errorXcpt('Error creating "%s"' % (sFull,));
+            return False;
+        return True;
+
+    def _persistentVarUnset(self, sVar):
+        """
+        Unsets a persistent variable.
+
+        Returns True on success, False + reporter.error on failure.
+
+        May raise exception if the variable name is invalid or something
+        unexpected happens.
+        """
+        sFull = self.__persistentVarCalcName(sVar);
+        if os.path.exists(sFull):
+            try:
+                os.unlink(sFull);
+            except:
+                reporter.errorXcpt('Error unlinking "%s"' % (sFull,));
+                return False;
+        return True;
+
+    def _persistentVarExists(self, sVar):
+        """
+        Checks if a persistent variable exists.
+
+        Returns true/false.
+
+        May raise exception if the variable name is invalid or something
+        unexpected happens.
+        """
+        return os.path.exists(self.__persistentVarCalcName(sVar));
+
+    def _persistentVarGet(self, sVar):
+        """
+        Gets the value of a persistent variable.
+
+        Returns variable value on success.
+        Returns None if the variable doesn't exist or if an
+        error (reported) occured.
+
+        May raise exception if the variable name is invalid or something
+        unexpected happens.
+        """
+        sFull = self.__persistentVarCalcName(sVar);
+        if not os.path.exists(sFull):
+            return None;
+        try:
+            oFile = open(sFull, 'r');
+            sValue = oFile.read().decode('utf-8');
+            oFile.close();
+        except:
+            reporter.errorXcpt('Error creating "%s"' % (sFull,));
+            return None;
+        return sValue;
+
+
+    #
+    # Helpers.
+    #
+
+    def _killAllVBoxProcesses(self):
+        """
+        Kills all virtual box related processes we find in the system.
+        """
+
+        for iIteration in range(22):
+            # Gather processes to kill.
+            aoTodo = [];
+            for oProcess in utils.processListAll():
+                sBase = oProcess.getBaseImageNameNoExeSuff();
+                if sBase is None:
+                    continue;
+                sBase = sBase.lower();
+                if sBase in [ 'vboxsvc', 'virtualbox', 'virtualboxvm', 'vboxheadless', 'vboxmanage', 'vboxsdl', 'vboxwebsrv',
+                              'vboxautostart', 'vboxballoonctrl', 'vboxbfe', 'vboxextpackhelperapp', 'vboxnetdhcp',
+                              'vboxnetadpctl', 'vboxtestogl', 'vboxtunctl', 'vboxvmmpreload', 'vboxxpcomipcd', 'vmCreator', ]:
+                    aoTodo.append(oProcess);
+                if iIteration in [0, 21]  and  sBase in [ 'windbg', 'gdb', 'gdb-i386-apple-darwin', ]:
+                    reporter.log('Warning: debugger running: %s (%s)' % (oProcess.iPid, sBase,));
+            if len(aoTodo) == 0:
+                return True;
+
+            # Kill.
+            for oProcess in aoTodo:
+                reporter.log('Loop #%d - Killing %s (%s)'
+                             % (iIteration, oProcess.iPid, oProcess.sImage if oProcess.sName is None else oProcess.sName,));
+                utils.processKill(oProcess.iPid); # No mercy.
+
+            # Check if they're all dead like they should be.
+            time.sleep(0.1);
+            for oProcess in aoTodo:
+                if utils.processExists(oProcess.iPid):
+                    time.sleep(2);
+                    break;
+
+        return False;
+
+    def _executeSync(self, asArgs):
+        """
+        Executes a child process synchronously.
+        Returns True if the process executed successfully and returned 0,
+        otherwise False is returned.
+        """
+        reporter.log('Executing: %s' % (asArgs, ));
+        reporter.flushall();
+        try:
+            iRc = utils.processCall(asArgs, shell = False, close_fds = False);
+        except:
+            reporter.errorXcpt();
+            return False;
+        reporter.log('Exit code: %s (%s)' % (iRc, asArgs));
+        return iRc is 0;
+
+    def _sudoExecuteSync(self, asArgs):
+        """
+        Executes a sudo child process synchronously.
+        Returns a tuple [True, 0] if the process executed successfully
+        and returned 0, otherwise [False, rc] is returned.
+        """
+        reporter.log('Executing [sudo]: %s' % (asArgs, ));
+        reporter.flushall();
+        iRc = 0;
+        try:
+            iRc = utils.sudoProcessCall(asArgs, shell = False, close_fds = False);
+        except:
+            reporter.errorXcpt();
+            return (False, 0);
+        reporter.log('Exit code [sudo]: %s (%s)' % (iRc, asArgs));
+        return (iRc is 0, iRc);
+
+    def _executeSubDriver(self, asActions):
+        """
+        Execute the sub testdriver with the specified action.
+        """
+        asArgs = list(self._asSubDriver)
+        asArgs.append('--no-wipe-clean');
+        asArgs.extend(asActions);
+        return self._executeSync(asArgs);
+
+    def _maybeUnpackArchive(self, sMaybeArchive, fNonFatal = False):
+        """
+        Attempts to unpack the given build file.
+        Updates _asBuildFiles.
+        Returns True/False. No exceptions.
+        """
+        asMembers = utils.unpackFile(sMaybeArchive, self.sScratchPath, reporter.log,
+                                     reporter.log if fNonFatal else reporter.error);
+        if asMembers is None:
+            return False;
+        self._asBuildFiles.extend(asMembers);
+        return True;
+
+
+    def _installVBox(self):
+        """
+        Download / copy the build files into the scratch area and install them.
+        """
+        reporter.testStart('Installing VirtualBox');
+        reporter.log('CWD=%s' % (os.getcwd(),)); # curious
+
+        #
+        # Download the build files.
+        #
+        for i in range(len(self._asBuildUrls)):
+            if webutils.downloadFile(self._asBuildUrls[i], self._asBuildFiles[i],
+                                     self.sBuildPath, reporter.log, reporter.log) is not True:
+                reporter.testDone(fSkipped = True);
+                return None; # Failed to get binaries, probably deleted. Skip the test run.
+
+        #
+        # Unpack anything we know what is and append it to the build files
+        # list.  This allows us to use VBoxAll*.tar.gz files.
+        #
+        for sFile in list(self._asBuildFiles):
+            if self._maybeUnpackArchive(sFile, fNonFatal = True) is not True:
+                reporter.testDone(fSkipped = True);
+                return None; # Failed to unpack. Probably local error, like busy
+                             # DLLs on windows, no reason for failing the build.
+
+        #
+        # Go to system specific installation code.
+        #
+        sHost = utils.getHostOs()
+        if   sHost == 'darwin':     fRc = self._installVBoxOnDarwin();
+        elif sHost == 'linux':      fRc = self._installVBoxOnLinux();
+        elif sHost == 'solaris':    fRc = self._installVBoxOnSolaris();
+        elif sHost == 'win':        fRc = self._installVBoxOnWindows();
+        else:
+            reporter.error('Unsupported host "%s".' % (sHost,));
+        if fRc is False:
+            reporter.testFailure('Installation error.');
+
+        #
+        # Install the extension pack.
+        #
+        if fRc is True  and  self._fAutoInstallPuelExtPack:
+            fRc = self._installExtPack();
+            if fRc is False:
+                reporter.testFailure('Extension pack installation error.');
+
+        # Some debugging...
+        try:
+            cMbFreeSpace = utils.getDiskUsage(self.sScratchPath);
+            reporter.log('Disk usage after VBox install: %d MB available at %s' % (cMbFreeSpace, self.sScratchPath,));
+        except:
+            reporter.logXcpt('Unable to get disk free space. Ignored. Continuing.');
+
+        reporter.testDone();
+        return fRc;
+
+    def _uninstallVBox(self, fIgnoreError = False):
+        """
+        Uninstall VirtualBox.
+        """
+        reporter.testStart('Uninstalling VirtualBox');
+
+        sHost = utils.getHostOs()
+        if   sHost == 'darwin':     fRc = self._uninstallVBoxOnDarwin();
+        elif sHost == 'linux':      fRc = self._uninstallVBoxOnLinux();
+        elif sHost == 'solaris':    fRc = self._uninstallVBoxOnSolaris();
+        elif sHost == 'win':        fRc = self._uninstallVBoxOnWindows();
+        else:
+            reporter.error('Unsupported host "%s".' % (sHost,));
+        if fRc is False and not fIgnoreError:
+            reporter.testFailure('Uninstallation failed.');
+
+        fRc2 = self._uninstallAllExtPacks();
+        if not fRc2 and fRc:
+            fRc = fRc2;
+
+        reporter.testDone(fSkipped = (fRc is None));
+        return fRc;
+
+    def _findFile(self, sRegExp, fMandatory = False):
+        """
+        Returns the first build file that matches the given regular expression
+        (basename only).
+
+        Returns None if no match was found, logging it as an error if
+        fMandatory is set.
+        """
+        oRegExp = re.compile(sRegExp);
+
+        for sFile in self._asBuildFiles:
+            if oRegExp.match(os.path.basename(sFile)) and os.path.exists(sFile):
+                return sFile;
+
+        if fMandatory:
+            reporter.error('Failed to find a file matching "%s" in %s.' % (sRegExp, self._asBuildFiles,));
+        return None;
+
+    def _waitForTestManagerConnectivity(self, cSecTimeout):
+        """
+        Check and wait for network connectivity to the test manager.
+
+        This is used with the windows installation and uninstallation since
+        these usually disrupts network connectivity when installing the filter
+        driver.  If we proceed to quickly, we might finish the test at a time
+        when we cannot report to the test manager and thus end up with an
+        abandonded test error.
+        """
+        cSecElapsed = 0;
+        secStart    = utils.timestampSecond();
+        while reporter.checkTestManagerConnection() is False:
+            cSecElapsed = utils.timestampSecond() - secStart;
+            if cSecElapsed >= cSecTimeout:
+                reporter.log('_waitForTestManagerConnectivity: Giving up after %u secs.' % (cSecTimeout,));
+                return False;
+            time.sleep(2);
+
+        if cSecElapsed > 0:
+            reporter.log('_waitForTestManagerConnectivity: Waited %s secs.' % (cSecTimeout,));
+        return True;
+
+
+    #
+    # Darwin (Mac OS X).
+    #
+
+    def _darwinDmgPath(self):
+        """ Returns the path to the DMG mount."""
+        return os.path.join(self.sScratchPath, 'DmgMountPoint');
+
+    def _darwinUnmountDmg(self, fIgnoreError):
+        """
+        Umount any DMG on at the default mount point.
+        """
+        sMountPath = self._darwinDmgPath();
+        if not os.path.exists(sMountPath):
+            return True;
+
+        # Unmount.
+        fRc = self._executeSync(['hdiutil', 'detach', sMountPath ]);
+        if not fRc and not fIgnoreError:
+            reporter.error('Failed to unmount DMG at %s' % sMountPath);
+
+        # Remove dir.
+        try:
+            os.rmdir(sMountPath);
+        except:
+            if not fIgnoreError:
+                reporter.errorXcpt('Failed to remove directory %s' % sMountPath);
+        return fRc;
+
+    def _darwinMountDmg(self, sDmg):
+        """
+        Mount the DMG at the default mount point.
+        """
+        self._darwinUnmountDmg(fIgnoreError = True)
+
+        sMountPath = self._darwinDmgPath();
+        if not os.path.exists(sMountPath):
+            try:
+                os.mkdir(sMountPath, 0755);
+            except:
+                reporter.logXcpt();
+                return False;
+
+        return self._executeSync(['hdiutil', 'attach', '-readonly', '-mount', 'required', '-mountpoint', sMountPath, sDmg, ]);
+
+    def _installVBoxOnDarwin(self):
+        """ Installs VBox on Mac OS X."""
+        sDmg = self._findFile('^VirtualBox-.*\\.dmg$');
+        if sDmg is None:
+            return False;
+
+        # Mount the DMG.
+        fRc = self._darwinMountDmg(sDmg);
+        if fRc is not True:
+            return False;
+
+        # Uninstall any previous vbox version first.
+        sUninstaller = os.path.join(self._darwinDmgPath(), 'VirtualBox_Uninstall.tool');
+        fRc, _ = self._sudoExecuteSync([sUninstaller, '--unattended',]);
+        if fRc is True:
+
+            # Install the package.
+            sPkg = os.path.join(self._darwinDmgPath(), 'VirtualBox.pkg');
+            fRc, _ = self._sudoExecuteSync(['installer', '-verbose', '-dumplog', '-pkg', sPkg, '-target', '/']);
+
+        # Unmount the DMG and we're done.
+        if not self._darwinUnmountDmg(fIgnoreError = False):
+            fRc = False;
+        return fRc;
+
+    def _uninstallVBoxOnDarwin(self):
+        """ Uninstalls VBox on Mac OS X."""
+
+        # Is VirtualBox installed? If not, don't try uninstall it.
+        sVBox = self._getVBoxInstallPath(fFailIfNotFound = False);
+        if sVBox is None:
+            return True;
+
+        # Find the dmg.
+        sDmg = self._findFile('^VirtualBox-.*\\.dmg$');
+        if sDmg is None:
+            return False;
+        if not os.path.exists(sDmg):
+            return True;
+
+        # Mount the DMG.
+        fRc = self._darwinMountDmg(sDmg);
+        if fRc is not True:
+            return False;
+
+        # Execute the uninstaller.
+        sUninstaller = os.path.join(self._darwinDmgPath(), 'VirtualBox_Uninstall.tool');
+        fRc, _ = self._sudoExecuteSync([sUninstaller, '--unattended',]);
+
+        # Unmount the DMG and we're done.
+        if not self._darwinUnmountDmg(fIgnoreError = False):
+            fRc = False;
+        return fRc;
+
+    #
+    # GNU/Linux
+    #
+
+    def _installVBoxOnLinux(self):
+        """ Installs VBox on Linux."""
+        sRun = self._findFile('^VirtualBox-.*\\.run$');
+        if sRun is None:
+            return False;
+        utils.chmodPlusX(sRun);
+
+        # Install the new one.
+        fRc, _ = self._sudoExecuteSync([sRun,]);
+        return fRc;
+
+    def _uninstallVBoxOnLinux(self):
+        """ Uninstalls VBox on Linux."""
+
+        # Is VirtualBox installed? If not, don't try uninstall it.
+        sVBox = self._getVBoxInstallPath(fFailIfNotFound = False);
+        if sVBox is None:
+            return True;
+
+        # Find the .run file and use it.
+        sRun = self._findFile('^VirtualBox-.*\\.run$', fMandatory = False);
+        if sRun is not None:
+            utils.chmodPlusX(sRun);
+            fRc, _ = self._sudoExecuteSync([sRun, 'uninstall']);
+            return fRc;
+
+        # Try the installed uninstaller.
+        for sUninstaller in [os.path.join(sVBox, 'uninstall.sh'), '/opt/VirtualBox/uninstall.sh', ]:
+            if os.path.isfile(sUninstaller):
+                reporter.log('Invoking "%s"...' % (sUninstaller,));
+                fRc, _ = self._sudoExecuteSync([sUninstaller, 'uninstall']);
+                return fRc;
+
+        reporter.log('Did not find any VirtualBox install to uninstall.');
+        return True;
+
+
+    #
+    # Solaris
+    #
+
+    def _generateAutoResponseOnSolaris(self):
+        """
+        Generates an autoresponse file on solaris, returning the name.
+        None is return on failure.
+        """
+        sPath = os.path.join(self.sScratchPath, 'SolarisAutoResponse');
+        oFile = utils.openNoInherit(sPath, 'wt');
+        oFile.write('basedir=default\n'
+                    'runlevel=nocheck\n'
+                    'conflict=quit\n'
+                    'setuid=nocheck\n'
+                    'action=nocheck\n'
+                    'partial=quit\n'
+                    'instance=unique\n'
+                    'idepend=quit\n'
+                    'rdepend=quit\n'
+                    'space=quit\n'
+                    'mail=\n');
+        oFile.close();
+        return sPath;
+
+    def _installVBoxOnSolaris(self):
+        """ Installs VBox on Solaris."""
+        sPkg = self._findFile('^VirtualBox-.*\\.pkg$', fMandatory = False);
+        if sPkg is None:
+            sTar = self._findFile('^VirtualBox-.*-SunOS-.*\\.tar.gz$', fMandatory = False);
+            if sTar is not None:
+                if self._maybeUnpackArchive(sTar) is not True:
+                    return False;
+        sPkg = self._findFile('^VirtualBox-.*\\.pkg$', fMandatory = True);
+        sRsp = self._findFile('^autoresponse$', fMandatory = True);
+        if sPkg is None or sRsp is None:
+            return False;
+
+        # Uninstall first (ignore result).
+        self._uninstallVBoxOnSolaris();
+
+        # Install the new one.
+        fRc, _ = self._sudoExecuteSync(['pkgadd', '-d', sPkg, '-n', '-a', sRsp, 'SUNWvbox']);
+        return fRc;
+
+    def _uninstallVBoxOnSolaris(self):
+        """ Uninstalls VBox on Solaris."""
+        reporter.flushall();
+        if utils.processCall(['pkginfo', '-q', 'SUNWvbox']) != 0:
+            return True;
+        sRsp = self._generateAutoResponseOnSolaris();
+        fRc, _ = self._sudoExecuteSync(['pkgrm', '-n', '-a', sRsp, 'SUNWvbox']);
+        return fRc;
+
+    #
+    # Windows
+    #
+
+    def _installVBoxOnWindows(self):
+        """ Installs VBox on Windows."""
+        sExe = self._findFile('^VirtualBox-.*-(MultiArch|Win).exe$');
+        if sExe is None:
+            return False;
+
+        # TEMPORARY HACK - START
+        # It seems that running the NDIS cleanup script upon uninstallation is not
+        # a good idea, so let's run it before installing VirtualBox.
+        #sHostName = socket.getfqdn();
+        #if    not sHostName.startswith('testboxwin3') \
+        #  and not sHostName.startswith('testboxharp2') \
+        #  and not sHostName.startswith('wei01-b6ka-3') \
+        #  and utils.getHostOsVersion() in ['8', '8.1', '9', '2008Server', '2008ServerR2', '2012Server']:
+        #    reporter.log('Peforming extra NDIS cleanup...');
+        #    sMagicScript = os.path.abspath(os.path.join(g_ksValidationKitDir, 'testdriver', 'win-vbox-net-uninstall.ps1'));
+        #    fRc2, _ = self._sudoExecuteSync(['powershell.exe', '-Command', 'set-executionpolicy unrestricted']);
+        #    if not fRc2:
+        #        reporter.log('set-executionpolicy failed.');
+        #    self._sudoExecuteSync(['powershell.exe', '-Command', 'get-executionpolicy']);
+        #    fRc2, _ = self._sudoExecuteSync(['powershell.exe', '-File', sMagicScript]);
+        #    if not fRc2:
+        #        reporter.log('NDIS cleanup failed.');
+        # TEMPORARY HACK - END
+
+        # Uninstall any previous vbox version first.
+        fRc = self._uninstallVBoxOnWindows();
+        if fRc is not True:
+            return None; # There shouldn't be anything to uninstall, and if there is, it's not our fault.
+
+        # Install the new one.
+        asArgs = [sExe, '-vvvv', '--silent', '--logging'];
+        asArgs.extend(['--msiparams', 'REBOOT=ReallySuppress']);
+        sVBoxInstallPath = os.environ.get('VBOX_INSTALL_PATH', None);
+        if sVBoxInstallPath is not None:
+            asArgs.extend(['INSTALLDIR="%s"' % (sVBoxInstallPath,)]);
+        fRc2, iRc = self._sudoExecuteSync(asArgs);
+        if fRc2 is False:
+            if iRc == 3010: # ERROR_SUCCESS_REBOOT_REQUIRED
+                reporter.log('Note: Installer required a reboot to complete installation');
+                # Optional, don't fail.
+            else:
+                fRc = False;
+        sLogFile = os.path.join(tempfile.gettempdir(), 'VirtualBox', 'VBoxInstallLog.txt');
+        if      sLogFile is not None \
+            and os.path.isfile(sLogFile):
+            reporter.addLogFile(sLogFile, 'log/installer', "Verbose MSI installation log file");
+        self._waitForTestManagerConnectivity(30);
+        return fRc;
+
+    def _uninstallVBoxOnWindows(self):
+        """
+        Uninstalls VBox on Windows, all installations we find to be on the safe side...
+        """
+
+        import win32com.client; # pylint: disable=F0401
+        win32com.client.gencache.EnsureModule('{000C1092-0000-0000-C000-000000000046}', 1033, 1, 0);
+        oInstaller = win32com.client.Dispatch('WindowsInstaller.Installer',
+                                              resultCLSID = '{000C1090-0000-0000-C000-000000000046}')
+
+        # Search installed products for VirtualBox.
+        asProdCodes = [];
+        for sProdCode in oInstaller.Products:
+            try:
+                sProdName = oInstaller.ProductInfo(sProdCode, "ProductName");
+            except:
+                reporter.logXcpt();
+                continue;
+            #reporter.log('Info: %s=%s' % (sProdCode, sProdName));
+            if  sProdName.startswith('Oracle VM VirtualBox') \
+             or sProdName.startswith('Sun VirtualBox'):
+                asProdCodes.append([sProdCode, sProdName]);
+
+        # Before we start uninstalling anything, just ruthlessly kill any
+        # msiexec process we might find hanging around.
+        cKilled = 0;
+        for oProcess in utils.processListAll():
+            sBase = oProcess.getBaseImageNameNoExeSuff();
+            if sBase is not None and sBase.lower() in [ 'msiexec', ]:
+                reporter.log('Killing MSI process: %s (%s)' % (oProcess.iPid, sBase));
+                utils.processKill(oProcess.iPid);
+                cKilled += 1;
+        if cKilled > 0:
+            time.sleep(16); # fudge.
+
+        # Do the uninstalling.
+        fRc = True;
+        sLogFile = os.path.join(self.sScratchPath, 'VBoxUninstallLog.txt');
+        for sProdCode, sProdName in asProdCodes:
+            reporter.log('Uninstalling %s (%s)...' % (sProdName, sProdCode));
+            fRc2, iRc = self._sudoExecuteSync(['msiexec', '/uninstall', sProdCode, '/quiet', '/passive', '/norestart',
+                                               '/L*v', '%s' % (sLogFile), ]);
+            if fRc2 is False:
+                if iRc == 3010: # ERROR_SUCCESS_REBOOT_REQUIRED
+                    reporter.log('Note: Uninstaller required a reboot to complete uninstallation');
+                    # Optional, don't fail.
+                else:
+                    fRc = False;
+            reporter.addLogFile(sLogFile, 'log/uninstaller', "Verbose MSI uninstallation log file");
+
+        self._waitForTestManagerConnectivity(30);
+        if fRc is False and os.path.isfile(sLogFile):
+            reporter.addLogFile(sLogFile, 'log/uninstaller');
+        return fRc;
+
+
+    #
+    # Extension pack.
+    #
+
+    def _getVBoxInstallPath(self, fFailIfNotFound):
+        """ Returns the default VBox installation path. """
+        sHost = utils.getHostOs();
+        if sHost == 'win':
+            sProgFiles = os.environ.get('ProgramFiles', 'C:\\Program Files');
+            asLocs = [
+                os.path.join(sProgFiles, 'Oracle', 'VirtualBox'),
+                os.path.join(sProgFiles, 'OracleVM', 'VirtualBox'),
+                os.path.join(sProgFiles, 'Sun', 'VirtualBox'),
+            ];
+        elif sHost == 'linux' or sHost == 'solaris':
+            asLocs = [ '/opt/VirtualBox', '/opt/VirtualBox-3.2', '/opt/VirtualBox-3.1', '/opt/VirtualBox-3.0'];
+        elif sHost == 'darwin':
+            asLocs = [ '/Applications/VirtualBox.app/Contents/MacOS' ];
+        else:
+            asLocs = [ '/opt/VirtualBox' ];
+        if 'VBOX_INSTALL_PATH' in os.environ:
+            asLocs.insert(0, os.environ.get('VBOX_INSTALL_PATH', None));
+
+        for sLoc in asLocs:
+            if os.path.isdir(sLoc):
+                return sLoc;
+        if fFailIfNotFound:
+            reporter.error('Failed to locate VirtualBox installation: %s' % (asLocs,));
+        else:
+            reporter.log2('Failed to locate VirtualBox installation: %s' % (asLocs,));
+        return None;
+
+    def _installExtPack(self):
+        """ Installs the extension pack. """
+        sVBox = self._getVBoxInstallPath(fFailIfNotFound = True);
+        if sVBox is None:
+            return False;
+        sExtPackDir = os.path.join(sVBox, 'ExtensionPacks');
+
+        if self._uninstallAllExtPacks() is not True:
+            return False;
+
+        sExtPack = self._findFile('Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack');
+        if sExtPack is None:
+            sExtPack = self._findFile('Oracle_VM_VirtualBox_Extension_Pack.*.vbox-extpack');
+        if sExtPack is None:
+            return True;
+
+        sDstDir = os.path.join(sExtPackDir, 'Oracle_VM_VirtualBox_Extension_Pack');
+        reporter.log('Installing extension pack "%s" to "%s"...' % (sExtPack, sExtPackDir));
+        fRc, _ = self._sudoExecuteSync([ self.getBinTool('vts_tar'),
+                                         '--extract',
+                                         '--verbose',
+                                         '--gzip',
+                                         '--file',                sExtPack,
+                                         '--directory',           sDstDir,
+                                         '--file-mode-and-mask',  '0644',
+                                         '--file-mode-or-mask',   '0644',
+                                         '--dir-mode-and-mask',   '0755',
+                                         '--dir-mode-or-mask',    '0755',
+                                         '--owner',               '0',
+                                         '--group',               '0',
+                                       ]);
+        return fRc;
+
+    def _uninstallAllExtPacks(self):
+        """ Uninstalls all extension packs. """
+        sVBox = self._getVBoxInstallPath(fFailIfNotFound = False);
+        if sVBox is None:
+            return True;
+
+        sExtPackDir = os.path.join(sVBox, 'ExtensionPacks');
+        if not os.path.exists(sExtPackDir):
+            return True;
+
+        fRc, _ = self._sudoExecuteSync([self.getBinTool('vts_rm'), '-Rfv', '--', sExtPackDir]);
+        return fRc;
+
+
+
+if __name__ == '__main__':
+    sys.exit(VBoxInstallerTestDriver().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/testdriver/vboxtestvms.py b/src/VBox/ValidationKit/testdriver/vboxtestvms.py
new file mode 100644
index 0000000..2f46a95
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/vboxtestvms.py
@@ -0,0 +1,946 @@
+# -*- coding: utf-8 -*-
+# $Id: vboxtestvms.py $
+
+"""
+VirtualBox Test VMs
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 99376 $"
+
+# Standard Python imports.
+import re;
+import random;
+import socket;
+
+# Validation Kit imports.
+from testdriver import base;
+from testdriver import reporter;
+from testdriver import vboxcon;
+
+
+# All virtualization modes.
+g_asVirtModes      = ['hwvirt', 'hwvirt-np', 'raw',];
+# All virtualization modes except for raw-mode.
+g_asVirtModesNoRaw = ['hwvirt', 'hwvirt-np',];
+# Dictionary mapping the virtualization mode mnemonics to a little less cryptic
+# strings used in test descriptions.
+g_dsVirtModeDescs  = {
+    'raw'       : 'Raw-mode',
+    'hwvirt'    : 'HwVirt',
+    'hwvirt-np' : 'NestedPaging'
+};
+
+# Arch constants.
+g_k32    = 32;                          # pylint: disable=C0103
+g_k64    = 64;                          # pylint: disable=C0103
+g_k32_64 = 96;                          # pylint: disable=C0103
+
+# Array indexes.
+g_iGuestOsType = 0;
+g_iKind        = 1;
+g_iArch        = 2;
+g_iMinCpu      = 3;
+g_iMaxCpu      = 4;
+g_iRegEx       = 5;
+
+# Table translating from VM name core to a more detailed guest info.
+# pylint: disable=C0301
+g_aaNameToDetails = \
+[
+    [ 'WindowsNT4',     'WindowsNT4',            g_k32,    1,  32, ['nt4',    'nt4sp[0-9]']],                             # max cpus??
+    [ 'Windows2000',    'Windows2000',           g_k32,    1,  32, ['w2k',    'w2ksp[0-9]', 'win2k', 'win2ksp[0-9]']],    # max cpus??
+    [ 'WindowsXP',      'WindowsXP',             g_k32,    1,  32, ['xp',     'xpsp[0-9]']],
+    [ 'WindowsXP_64',   'WindowsXP_64',          g_k64,    1,  32, ['xp64',   'xp64sp[0-9]']],
+    [ 'Windows2003',    'Windows2003',           g_k32,    1,  32, ['w2k3',   'w2k3sp[0-9]', 'win2k3', 'win2k3sp[0-9]']],
+    [ 'WindowsVista',   'WindowsVista',          g_k32,    1,  32, ['vista',  'vistasp[0-9]']],
+    [ 'Windows2008',    'Windows2008',           g_k32,    1,  64, ['w2k8',   'w2k8sp[0-9]', 'win2k8', 'win2k8sp[0-9]']],     # max cpus/cores??
+    [ 'Windows2008_64', 'Windows2008_64',        g_k64,    1,  64, ['w2k8r2', 'w2k8r2sp[0-9]', 'win2k8r2', 'win2k8r2sp[0-9]']], # max cpus/cores??
+    [ 'Windows7',       'Windows7',              g_k32,    1,  32, ['w7',     'w7sp[0-9]', 'win7',]],        # max cpus/cores??
+    [ 'Windows7_64',    'Windows7_64',           g_k64,    1,  64, ['w7-64',  'w7sp[0-9]-64', 'win7-64',]],  # max cpus/cores??
+    [ 'Windows8',       'Windows8',              g_k32,    1,  32, ['w8',     'w8sp[0-9]', 'win8',]],        # max cpus/cores??
+    [ 'Windows8_64',    'Windows8_64',           g_k64,    1,  64, ['w8-64',  'w8sp[0-9]-64', 'win8-64',]],  # max cpus/cores??
+    [ 'Windows81',      'Windows81',             g_k32,    1,  32, ['w81',    'w81sp[0-9]', 'win81',]],       # max cpus/cores??
+    [ 'Windows81_64',   'Windows81_64',          g_k64,    1,  64, ['w81-64', 'w81sp[0-9]-64', 'win81-64',]], # max cpus/cores??
+    [ 'Linux',          'Debian',                g_k32,    1, 256, ['deb[0-9]*', 'debian[0-9]*', ]],
+    [ 'Linux_64',       'Debian_64',             g_k64,    1, 256, ['deb[0-9]*-64', 'debian[0-9]*-64', ]],
+    [ 'Linux',          'RedHat',                g_k32,    1, 256, ['rhel',   'rhel[0-9]', 'rhel[0-9]u[0-9]']],
+    [ 'Linux',          'Fedora',                g_k32,    1, 256, ['fedora', 'fedora[0-9]*', ]],
+    [ 'Linux_64',       'Fedora_64',             g_k64,    1, 256, ['fedora-64', 'fedora[0-9]*-64', ]],
+    [ 'Linux',          'Oracle',                g_k32,    1, 256, ['ols[0-9]*', 'oel[0-9]*', ]],
+    [ 'Linux_64',       'Oracle_64',             g_k64,    1, 256, ['ols[0-9]*-64', 'oel[0-9]*-64', ]],
+    [ 'Linux',          'OpenSUSE',              g_k32,    1, 256, ['opensuse[0-9]*', 'suse[0-9]*', ]],
+    [ 'Linux_64',       'OpenSUSE_64',           g_k64,    1, 256, ['opensuse[0-9]*-64', 'suse[0-9]*-64', ]],
+    [ 'Linux',          'Ubuntu',                g_k32,    1, 256, ['ubuntu[0-9]*', ]],
+    [ 'Linux_64',       'Ubuntu_64',             g_k64,    1, 256, ['ubuntu[0-9]*-64', ]],
+    [ 'Solaris',        'Solaris',               g_k32,    1, 256, ['sol10',  'sol10u[0-9]']],
+    [ 'Solaris_64',     'Solaris_64',            g_k64,    1, 256, ['sol10-64', 'sol10u-64[0-9]']],
+    [ 'Solaris_64',     'Solaris11_64',          g_k64,    1, 256, ['sol11u1']],
+    [ 'BSD',            'FreeBSD_64',            g_k32_64, 1, 1, ['bs-.*']], # boot sectors, wanted 64-bit type.
+];
+
+
+## @name Guest OS type string constants.
+## @{
+g_ksGuestOsTypeDarwin  = 'darwin';
+g_ksGuestOsTypeFreeBSD = 'freebsd';
+g_ksGuestOsTypeLinux   = 'linux';
+g_ksGuestOsTypeOS2     = 'os2';
+g_ksGuestOsTypeSolaris = 'solaris';
+g_ksGuestOsTypeWindows = 'windows';
+## @}
+
+## @name String constants for paravirtualization providers.
+## @{
+g_ksParavirtProviderNone    = 'none';
+g_ksParavirtProviderDefault = 'default';
+g_ksParavirtProviderLegacy  = 'legacy';
+g_ksParavirtProviderMinimal = 'minimal';
+g_ksParavirtProviderHyperV  = 'hyperv';
+g_ksParavirtProviderKVM     = 'kvm';
+## @}
+
+## Valid paravirtualization providers.
+g_kasParavirtProviders = ( g_ksParavirtProviderNone, g_ksParavirtProviderDefault, g_ksParavirtProviderLegacy,
+                           g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM );
+
+# Mapping for support of paravirtualisation providers per guest OS.
+#g_kdaParavirtProvidersSupported = {
+#    g_ksGuestOsTypeDarwin  : ( g_ksParavirtProviderMinimal, ),
+#    g_ksGuestOsTypeFreeBSD : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, ),
+#    g_ksGuestOsTypeLinux   : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM),
+#    g_ksGuestOsTypeOS2     : ( g_ksParavirtProviderNone, ),
+#    g_ksGuestOsTypeSolaris : ( g_ksParavirtProviderNone, ),
+#    g_ksGuestOsTypeWindows : ( g_ksParavirtProviderNone, g_ksParavirtProviderMinimal, g_ksParavirtProviderHyperV, )
+#}
+# Temporary tweak:
+#   since for the most guests g_ksParavirtProviderNone is almost the same as g_ksParavirtProviderMinimal,
+#   g_ksParavirtProviderMinimal is removed from the list in order to get maximum number of unique choices
+#   during independent test runs when paravirt provider is taken randomly.
+g_kdaParavirtProvidersSupported = {
+    g_ksGuestOsTypeDarwin  : ( g_ksParavirtProviderMinimal, ),
+    g_ksGuestOsTypeFreeBSD : ( g_ksParavirtProviderNone, ),
+    g_ksGuestOsTypeLinux   : ( g_ksParavirtProviderNone, g_ksParavirtProviderHyperV, g_ksParavirtProviderKVM),
+    g_ksGuestOsTypeOS2     : ( g_ksParavirtProviderNone, ),
+    g_ksGuestOsTypeSolaris : ( g_ksParavirtProviderNone, ),
+    g_ksGuestOsTypeWindows : ( g_ksParavirtProviderNone, g_ksParavirtProviderHyperV, )
+}
+
+
+# pylint: enable=C0301
+
+def _intersects(asSet1, asSet2):
+    """
+    Checks if any of the strings in set 1 matches any of the regular
+    expressions in set 2.
+    """
+    for sStr1 in asSet1:
+        for sRx2 in asSet2:
+            if re.match(sStr1, sRx2 + '$'):
+                return True;
+    return False;
+
+
+class TestVm(object):
+    """
+    A Test VM - name + VDI/whatever.
+
+    This is just a data object.
+    """
+
+    def __init__(self, oSet, sVmName, sHd = None, sKind = None, acCpusSup = None, asVirtModesSup = None, # pylint: disable=R0913
+                 fIoApic = None, fPae = None, sNic0AttachType = None, sHddControllerType = 'IDE Controller',
+                 sFloppy = None, fVmmDevTestingPart = None, fVmmDevTestingMmio = False, asParavirtModesSup = None,
+                 fRandomPvPMode = False):
+        self.oSet                    = oSet;
+        self.sVmName                 = sVmName;
+        self.sHd                     = sHd;          # Relative to the testrsrc root.
+        self.acCpusSup               = acCpusSup;
+        self.asVirtModesSup          = asVirtModesSup;
+        self.asParavirtModesSup      = asParavirtModesSup;
+        self.sKind                   = sKind;
+        self.sGuestOsType            = None;
+        self.sDvdImage               = None;         # Relative to the testrsrc root.
+        self.fIoApic                 = fIoApic;
+        self.fPae                    = fPae;
+        self.sNic0AttachType         = sNic0AttachType;
+        self.sHddControllerType      = sHddControllerType;
+        self.sFloppy                 = sFloppy;      # Relative to the testrsrc root, except when it isn't...
+        self.fVmmDevTestingPart      = fVmmDevTestingPart;
+        self.fVmmDevTestingMmio      = fVmmDevTestingMmio;
+
+        self.fSnapshotRestoreCurrent = False;        # Whether to restore execution on the current snapshot.
+        self.fSkip                   = False;        # All VMs are included in the configured set by default.
+        self.aInfo                   = None;
+        self._guessStuff(fRandomPvPMode);
+
+    def _mkCanonicalGuestOSType(self, sType):
+        """
+        Convert guest OS type into constant representation.
+        Raise exception if specified @param sType is unknown.
+        """
+        if sType.lower().startswith('darwin'):
+            return g_ksGuestOsTypeDarwin
+        if sType.lower().startswith('bsd'):
+            return g_ksGuestOsTypeFreeBSD
+        if sType.lower().startswith('linux'):
+            return g_ksGuestOsTypeLinux
+        if sType.lower().startswith('os2'):
+            return g_ksGuestOsTypeOS2
+        if sType.lower().startswith('solaris'):
+            return g_ksGuestOsTypeSolaris
+        if sType.lower().startswith('windows'):
+            return g_ksGuestOsTypeWindows
+        raise base.GenError(sWhat="unknown guest OS kind: %s" % str(sType))
+
+    def _guessStuff(self, fRandomPvPMode):
+        """
+        Used by the constructor to guess stuff.
+        """
+
+        sNm     = self.sVmName.lower().strip();
+        asSplit = sNm.replace('-', ' ').split(' ');
+
+        if self.sKind is None:
+            # From name.
+            for aInfo in g_aaNameToDetails:
+                if _intersects(asSplit, aInfo[g_iRegEx]):
+                    self.aInfo        = aInfo;
+                    self.sGuestOsType = self._mkCanonicalGuestOSType(aInfo[g_iGuestOsType])
+                    self.sKind        = aInfo[g_iKind];
+                    break;
+            if self.sKind is None:
+                reporter.fatal('The OS of test VM "%s" cannot be guessed' % (self.sVmName,));
+
+            # Check for 64-bit, if required and supported.
+            if self.aInfo[g_iArch] == g_k32_64  and  _intersects(asSplit, ['64', 'amd64']):
+                self.sKind = self.sKind + '_64';
+        else:
+            # Lookup the kind.
+            for aInfo in g_aaNameToDetails:
+                if self.sKind == aInfo[g_iKind]:
+                    self.aInfo = aInfo;
+                    break;
+            if self.aInfo is None:
+                reporter.fatal('The OS of test VM "%s" with sKind="%s" cannot be guessed' % (self.sVmName, self.sKind));
+
+        # Translate sKind into sGuest OS Type.
+        if self.sGuestOsType is None:
+            if self.aInfo is not None:
+                self.sGuestOsType = self._mkCanonicalGuestOSType(self.aInfo[g_iGuestOsType])
+            elif self.sKind.find("Windows") >= 0:
+                self.sGuestOsType = g_ksGuestOsTypeWindows
+            elif self.sKind.find("Linux") >= 0:
+                self.sGuestOsType = g_ksGuestOsTypeLinux;
+            elif self.sKind.find("Solaris") >= 0:
+                self.sGuestOsType = g_ksGuestOsTypeSolaris;
+            else:
+                reporter.fatal('The OS of test VM "%s", sKind="%s" cannot be guessed' % (self.sVmName, self.sKind));
+
+        # Restrict modes and such depending on the OS.
+        if self.asVirtModesSup is None:
+            self.asVirtModesSup = list(g_asVirtModes);
+            if self.sGuestOsType in (g_ksGuestOsTypeOS2, g_ksGuestOsTypeDarwin):
+                self.asVirtModesSup = [sVirtMode for sVirtMode in self.asVirtModesSup if sVirtMode != 'raw'];
+            if self.sKind.find('_64') > 0:
+                self.asVirtModesSup = [sVirtMode for sVirtMode in self.asVirtModesSup if sVirtMode != 'raw'];
+            # TEMPORARY HACK - START
+            sHostName = socket.getfqdn();
+            if sHostName.startswith('testboxpile1'):
+                self.asVirtModesSup = [sVirtMode for sVirtMode in self.asVirtModesSup if sVirtMode != 'raw'];
+            # TEMPORARY HACK - END
+
+        # Restrict the CPU count depending on the OS and/or percieved SMP readiness.
+        if self.acCpusSup is None:
+            if _intersects(asSplit, ['uni']):
+                self.acCpusSup = [1];
+            elif self.aInfo is not None:
+                self.acCpusSup = [i for i in range(self.aInfo[g_iMinCpu], self.aInfo[g_iMaxCpu]) ];
+            else:
+                self.acCpusSup = [1];
+
+        # Figure relevant PV modes based on the OS.
+        if self.asParavirtModesSup is None:
+            self.asParavirtModesSup = g_kdaParavirtProvidersSupported[self.sGuestOsType];
+            ## @todo Remove this hack as soon as we've got around to explictly configure test variations
+            ## on the server side. Client side random is interesting but not the best option.
+            if fRandomPvPMode:
+                random.seed();
+                self.asParavirtModesSup = (random.choice(self.asParavirtModesSup),);
+
+        return True;
+
+    def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode = None):
+        """
+        actionExecute worker that finds and reconfigure a test VM.
+
+        Returns (fRc, oVM) where fRc is True, None or False and oVM is a
+        VBox VM object that is only present when rc is True.
+        """
+
+        fRc = False;
+        oVM = oTestDrv.getVmByName(self.sVmName);
+        if oVM is not None:
+            if self.fSnapshotRestoreCurrent is True:
+                fRc = True;
+            else:
+                fHostSupports64bit = oTestDrv.hasHostLongMode();
+                if self.is64bitRequired() and not fHostSupports64bit:
+                    fRc = None; # Skip the test.
+                elif self.isViaIncompatible() and oTestDrv.isHostCpuVia():
+                    fRc = None; # Skip the test.
+                else:
+                    oSession = oTestDrv.openSession(oVM);
+                    if oSession is not None:
+                        fRc =         oSession.enableVirtEx(sVirtMode != 'raw');
+                        fRc = fRc and oSession.enableNestedPaging(sVirtMode == 'hwvirt-np');
+                        fRc = fRc and oSession.setCpuCount(cCpus);
+
+                        if sParavirtMode is not None and oSession.fpApiVer >= 5.0:
+                            adParavirtProviders = {
+                                g_ksParavirtProviderNone   : vboxcon.ParavirtProvider_None,
+                                g_ksParavirtProviderDefault: vboxcon.ParavirtProvider_Default,
+                                g_ksParavirtProviderLegacy : vboxcon.ParavirtProvider_Legacy,
+                                g_ksParavirtProviderMinimal: vboxcon.ParavirtProvider_Minimal,
+                                g_ksParavirtProviderHyperV : vboxcon.ParavirtProvider_HyperV,
+                                g_ksParavirtProviderKVM    : vboxcon.ParavirtProvider_KVM,
+                            };
+                            fRc = fRc and oSession.setParavirtProvider(adParavirtProviders[sParavirtMode]);
+
+                        fCfg64Bit = self.is64bitRequired() or (self.is64bit() and fHostSupports64bit and sVirtMode != 'raw');
+                        fRc = fRc and oSession.enableLongMode(fCfg64Bit);
+                        if fCfg64Bit: # This is to avoid GUI pedantic warnings in the GUI. Sigh.
+                            oOsType = oSession.getOsType();
+                            if oOsType is not None:
+                                if oOsType.is64Bit and sVirtMode == 'raw':
+                                    assert(oOsType.id[-3:] == '_64');
+                                    fRc = fRc and oSession.setOsType(oOsType.id[:-3]);
+                                elif not oOsType.is64Bit and sVirtMode != 'raw':
+                                    fRc = fRc and oSession.setOsType(oOsType.id + '_64');
+
+                        fRc = fRc and oSession.saveSettings();
+                        if not oSession.close():
+                            fRc = False;
+            if fRc is True:
+                return (True, oVM);
+        return (fRc, None);
+
+
+    def isWindows(self):
+        """ Checks if it's a Windows VM. """
+        return self.sGuestOsType == g_ksGuestOsTypeWindows;
+
+    def isOS2(self):
+        """ Checks if it's an OS/2 VM. """
+        return self.sGuestOsType == g_ksGuestOsTypeOS2;
+
+    def is64bit(self):
+        """ Checks if it's a 64-bit VM. """
+        return self.sKind.find('_64') >= 0;
+
+    def is64bitRequired(self):
+        """ Check if 64-bit is required or not. """
+        return (self.aInfo[g_iArch] & g_k64) != 0;
+
+    def isLoggedOntoDesktop(self):
+        """ Checks if the test VM is logging onto a graphical desktop by default. """
+        if self.isWindows():
+            return True;
+        if self.isOS2():
+            return True;
+        if self.sVmName.find('-desktop'):
+            return True;
+        return False;
+
+    def isViaIncompatible(self):
+        """
+        Identifies VMs that doesn't work on VIA.
+
+        Returns True if NOT supported on VIA, False if it IS supported.
+        """
+        # Oracle linux doesn't like VIA in our experience
+        if self.aInfo[g_iKind] in ['Oracle', 'Oracle_64']:
+            return True;
+        # OS/2: "The system detected an internal processing error at location
+        # 0168:fff1da1f - 000e:ca1f. 0a8606fd
+        if self.isOS2():
+            return True;
+        # Windows NT4 before SP4 won't work because of cmpxchg8b not being
+        # detected, leading to a STOP 3e(80,0,0,0).
+        if self.aInfo[g_iKind] == 'WindowsNT4':
+            if self.sVmName.find('sp') < 0:
+                return True; # no service pack.
+            if   self.sVmName.find('sp0') >= 0 \
+              or self.sVmName.find('sp1') >= 0 \
+              or self.sVmName.find('sp2') >= 0 \
+              or self.sVmName.find('sp3') >= 0:
+                return True;
+        return False;
+
+
+
+class BootSectorTestVm(TestVm):
+    """
+    A Boot Sector Test VM.
+    """
+
+    def __init__(self, oSet, sVmName, sFloppy = None, asVirtModesSup = None, f64BitRequired = False):
+        self.f64BitRequired = f64BitRequired;
+        if asVirtModesSup is None:
+            asVirtModesSup = list(g_asVirtModes);
+        TestVm.__init__(self, oSet, sVmName,
+                        acCpusSup = [1,],
+                        sFloppy = sFloppy,
+                        asVirtModesSup = asVirtModesSup,
+                        fPae = True,
+                        fIoApic = True,
+                        fVmmDevTestingPart = True,
+                        fVmmDevTestingMmio = True,
+                        );
+
+    def is64bitRequired(self):
+        return self.f64BitRequired;
+
+
+
+class TestVmSet(object):
+    """
+    A set of Test VMs.
+    """
+
+    def __init__(self, oTestVmManager = None, acCpus = None, asVirtModes = None, fIgnoreSkippedVm = False):
+        self.oTestVmManager = oTestVmManager;
+        if acCpus is None:
+            acCpus = [1, 2];
+        self.acCpusDef      = acCpus;
+        self.acCpus         = acCpus;
+        if asVirtModes is None:
+            asVirtModes = list(g_asVirtModes);
+        self.asVirtModesDef = asVirtModes;
+        self.asVirtModes    = asVirtModes;
+        self.aoTestVms      = [];
+        self.fIgnoreSkippedVm = fIgnoreSkippedVm;
+        self.asParavirtModes = None; ##< If None, use the first PV mode of the test VM, otherwise all modes in this list.
+
+    def findTestVmByName(self, sVmName):
+        """
+        Returns the TestVm object with the given name.
+        Returns None if not found.
+        """
+        for oTestVm in self.aoTestVms:
+            if oTestVm.sVmName == sVmName:
+                return oTestVm;
+        return None;
+
+    def getAllVmNames(self, sSep = ':'):
+        """
+        Returns names of all the test VMs in the set separated by
+                sSep (defaults to ':').
+        """
+        sVmNames = '';
+        for oTestVm in self.aoTestVms:
+            if sVmNames == '':
+                sVmNames = oTestVm.sVmName;
+            else:
+                sVmNames = sVmNames + sSep + oTestVm.sVmName;
+        return sVmNames;
+
+    def showUsage(self):
+        """
+        Invoked by vbox.TestDriver.
+        """
+        reporter.log('');
+        reporter.log('Test VM selection and general config options:');
+        reporter.log('  --virt-modes   <m1[:m2[:]]');
+        reporter.log('      Default: %s' % (':'.join(self.asVirtModesDef)));
+        reporter.log('  --skip-virt-modes <m1[:m2[:]]');
+        reporter.log('      Use this to avoid hwvirt or hwvirt-np when not supported by the host');
+        reporter.log('      since we cannot detect it using the main API. Use after --virt-modes.');
+        reporter.log('  --cpu-counts   <c1[:c2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
+        reporter.log('  --test-vms     <vm1[:vm2[:...]]>');
+        reporter.log('      Test the specified VMs in the given order. Use this to change');
+        reporter.log('      the execution order or limit the choice of VMs');
+        reporter.log('      Default: %s  (all)' % (self.getAllVmNames(),));
+        reporter.log('  --skip-vms     <vm1[:vm2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        reporter.log('  --snapshot-restore-current');
+        reporter.log('      Restores the current snapshot and resumes execution.');
+        reporter.log('  --paravirt-modes   <pv1[:pv2[:]]>');
+        reporter.log('      Set of paravirtualized providers (modes) to tests. Intersected with what the test VM supports.');
+        reporter.log('      Default is the first PV mode the test VMs support, generally same as "legacy".');
+        ## @todo Add more options for controlling individual VMs.
+        return True;
+
+    def parseOption(self, asArgs, iArg):
+        """
+        Parses the set test vm set options (--test-vms and --skip-vms), modifying the set
+        Invoked by the testdriver method with the same name.
+
+        Keyword arguments:
+        asArgs -- The argument vector.
+        iArg   -- The index of the current argument.
+
+        Returns iArg if the option was not recognized and the caller should handle it.
+        Returns the index of the next argument when something is consumed.
+
+        In the event of a syntax error, a InvalidOption or QuietInvalidOption
+        is thrown.
+        """
+
+        if asArgs[iArg] == '--virt-modes':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
+
+            self.asVirtModes = asArgs[iArg].split(':');
+            for s in self.asVirtModes:
+                if s not in self.asVirtModesDef:
+                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asVirtModesDef)));
+
+        elif asArgs[iArg] == '--skip-virt-modes':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--skip-virt-modes" takes a colon separated list of modes');
+
+            for s in asArgs[iArg].split(':'):
+                if s not in self.asVirtModesDef:
+                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asVirtModesDef)));
+                if s in self.asVirtModes:
+                    self.asVirtModes.remove(s);
+
+        elif asArgs[iArg] == '--cpu-counts':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
+
+            self.acCpus = [];
+            for s in asArgs[iArg].split(':'):
+                try: c = int(s);
+                except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
+                if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
+                self.acCpus.append(c);
+
+        elif asArgs[iArg] == '--test-vms':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--test-vms" takes colon separated list');
+
+            for oTestVm in self.aoTestVms:
+                oTestVm.fSkip = True;
+
+            asTestVMs = asArgs[iArg].split(':');
+            for s in asTestVMs:
+                oTestVm = self.findTestVmByName(s);
+                if oTestVm is None:
+                    raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
+                                             % (s, self.getAllVmNames(' ')));
+                oTestVm.fSkip = False;
+
+        elif asArgs[iArg] == '--skip-vms':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--skip-vms" takes colon separated list');
+
+            asTestVMs = asArgs[iArg].split(':');
+            for s in asTestVMs:
+                oTestVm = self.findTestVmByName(s);
+                if oTestVm is None:
+                    reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s,));
+                else:
+                    oTestVm.fSkip = True;
+
+        elif asArgs[iArg] == '--snapshot-restore-current':
+            for oTestVm in self.aoTestVms:
+                if oTestVm.fSkip is False:
+                    oTestVm.fSnapshotRestoreCurrent = True;
+                    reporter.log('VM "%s" will be restored.' % (oTestVm.sVmName));
+
+        elif asArgs[iArg] == '--paravirt-modes':
+            iArg += 1
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--paravirt-modes" takes a colon separated list of modes');
+
+            self.asParavirtModes = asArgs[iArg].split(':')
+            for sPvMode in self.asParavirtModes:
+                if sPvMode not in g_kasParavirtProviders:
+                    raise base.InvalidOption('The "--paravirt-modes" value "%s" is not valid; valid values are: %s'
+                                             % (sPvMode, ', '.join(g_kasParavirtProviders),));
+            if len(self.asParavirtModes) == 0:
+                self.asParavirtModes = None;
+
+        else:
+            return iArg;
+        return iArg + 1;
+
+    def getResourceSet(self):
+        """
+        Implements base.TestDriver.getResourceSet
+        """
+        asResources = [];
+        for oTestVm in self.aoTestVms:
+            if not oTestVm.fSkip:
+                if oTestVm.sHd is not None:
+                    asResources.append(oTestVm.sHd);
+                if oTestVm.sDvdImage is not None:
+                    asResources.append(oTestVm.sDvdImage);
+        return asResources;
+
+    def actionConfig(self, oTestDrv, eNic0AttachType = None, sDvdImage = None):
+        """
+        For base.TestDriver.actionConfig. Configure the VMs with defaults and
+        a few tweaks as per arguments.
+
+        Returns True if successful.
+        Returns False if not.
+        """
+
+        for oTestVm in self.aoTestVms:
+            if oTestVm.fSkip:
+                continue;
+
+            if oTestVm.fSnapshotRestoreCurrent:
+                # If we want to restore a VM we don't need to create
+                # the machine anymore -- so just add it to the test VM list.
+                oVM = oTestDrv.addTestMachine(oTestVm.sVmName);
+            else:
+                ## @todo This could possibly be moved to the TestVM object.
+                if sDvdImage is not None:
+                    sMyDvdImage = sDvdImage;
+                else:
+                    sMyDvdImage = oTestVm.sDvdImage;
+
+                if eNic0AttachType is not None:
+                    eMyNic0AttachType = eNic0AttachType;
+                elif oTestVm.sNic0AttachType is None:
+                    eMyNic0AttachType = None;
+                elif oTestVm.sNic0AttachType == 'nat':
+                    eMyNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
+                elif oTestVm.sNic0AttachType == 'bridged':
+                    eMyNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
+                else:
+                    assert False, oTestVm.sNic0AttachType;
+
+                oVM = oTestDrv.createTestVM(oTestVm.sVmName, 1, \
+                                            sHd                = oTestVm.sHd, \
+                                            sKind              = oTestVm.sKind, \
+                                            fIoApic            = oTestVm.fIoApic, \
+                                            fPae               = oTestVm.fPae, \
+                                            eNic0AttachType    = eMyNic0AttachType, \
+                                            sDvdImage          = sMyDvdImage, \
+                                            sHddControllerType = oTestVm.sHddControllerType,
+                                            sFloppy            = oTestVm.sFloppy,
+                                            fVmmDevTestingPart = oTestVm.fVmmDevTestingPart,
+                                            fVmmDevTestingMmio = oTestVm.fVmmDevTestingPart);
+            if oVM is None:
+                return False;
+
+        return True;
+
+    def _removeUnsupportedVirtModes(self, oTestDrv):
+        """
+        Removes unsupported virtualization modes.
+        """
+        if 'hwvirt' in self.asVirtModes and not oTestDrv.hasHostHwVirt():
+            reporter.log('Hardware assisted virtualization is not available on the host, skipping it.');
+            self.asVirtModes.remove('hwvirt');
+
+        if 'hwvirt-np' in self.asVirtModes and not oTestDrv.hasHostNestedPaging():
+            reporter.log('Nested paging not supported by the host, skipping it.');
+            self.asVirtModes.remove('hwvirt-np');
+        return True;
+
+    def actionExecute(self, oTestDrv, fnCallback): # pylint: disable=R0914
+        """
+        For base.TestDriver.actionExecute.  Calls the callback function for
+        each of the VMs and basic configuration variations (virt-mode and cpu
+        count).
+
+        Returns True if all fnCallback calls returned True, otherwise False.
+
+        The callback can return True, False or None. The latter is for when the
+        test is skipped.  (True is for success, False is for failure.)
+        """
+
+        self._removeUnsupportedVirtModes(oTestDrv);
+        cMaxCpus = oTestDrv.getHostCpuCount();
+
+        #
+        # The test loop.
+        #
+        fRc = True;
+        for oTestVm in self.aoTestVms:
+            if oTestVm.fSkip and self.fIgnoreSkippedVm:
+                reporter.log2('Ignoring VM %s (fSkip = True).' % (oTestVm.sVmName,));
+                continue;
+            reporter.testStart(oTestVm.sVmName);
+            if oTestVm.fSkip:
+                reporter.testDone(fSkipped = True);
+                continue;
+
+            # Intersect the supported modes and the ones being testing.
+            asVirtModesSup = [sMode for sMode in oTestVm.asVirtModesSup if sMode in self.asVirtModes];
+
+            # Ditto for CPUs.
+            acCpusSup      = [cCpus for cCpus in oTestVm.acCpusSup      if cCpus in self.acCpus];
+
+            # Ditto for paravirtualization modes, except if not specified we got a less obvious default.
+            if self.asParavirtModes is not None  and  oTestDrv.fpApiVer >= 5.0:
+                asParavirtModes = [sPvMode for sPvMode in oTestVm.asParavirtModesSup if sPvMode in self.asParavirtModes];
+                assert None not in asParavirtModes;
+            elif oTestDrv.fpApiVer >= 5.0:
+                asParavirtModes = (oTestVm.asParavirtModesSup[0],);
+                assert asParavirtModes[0] is not None;
+            else:
+                asParavirtModes = (None,);
+
+            for cCpus in acCpusSup:
+                if cCpus == 1:
+                    reporter.testStart('1 cpu');
+                else:
+                    reporter.testStart('%u cpus' % (cCpus));
+                    if cCpus > cMaxCpus:
+                        reporter.testDone(fSkipped = True);
+                        continue;
+
+                cTests = 0;
+                for sVirtMode in asVirtModesSup:
+                    if sVirtMode == 'raw' and cCpus > 1:
+                        continue;
+                    reporter.testStart('%s' % ( g_dsVirtModeDescs[sVirtMode], ) );
+                    cStartTests = cTests;
+
+                    for sParavirtMode in asParavirtModes:
+                        if sParavirtMode is not None:
+                            assert oTestDrv.fpApiVer >= 5.0;
+                            reporter.testStart('%s' % ( sParavirtMode, ) );
+
+                        # Reconfigure the VM.
+                        try:
+                            (rc2, oVM) = oTestVm.getReconfiguredVm(oTestDrv, cCpus, sVirtMode, sParavirtMode = sParavirtMode);
+                        except KeyboardInterrupt:
+                            raise;
+                        except:
+                            reporter.errorXcpt(cFrames = 9);
+                            rc2 = False;
+                        if rc2 is True:
+                            # Do the testing.
+                            try:
+                                rc2 = fnCallback(oVM, oTestVm);
+                            except KeyboardInterrupt:
+                                raise;
+                            except:
+                                reporter.errorXcpt(cFrames = 9);
+                                rc2 = False;
+                            if rc2 is False:
+                                reporter.maybeErr(reporter.testErrorCount() == 0, 'fnCallback failed');
+                        elif rc2 is False:
+                            reporter.log('getReconfiguredVm failed');
+                        if rc2 is False:
+                            fRc = False;
+
+                        cTests = cTests + (rc2 is not None);
+                        if sParavirtMode is not None:
+                            reporter.testDone(fSkipped = (rc2 is None));
+
+                    reporter.testDone(fSkipped = cTests == cStartTests);
+
+                reporter.testDone(fSkipped = cTests == 0);
+
+            _, cErrors = reporter.testDone();
+            if cErrors > 0:
+                fRc = False;
+        return fRc;
+
+    def enumerateTestVms(self, fnCallback):
+        """
+        Enumerates all the 'active' VMs.
+
+        Returns True if all fnCallback calls returned True.
+        Returns False if any returned False.
+        Returns None immediately if fnCallback returned None.
+        """
+        fRc = True;
+        for oTestVm in self.aoTestVms:
+            if not oTestVm.fSkip:
+                fRc2 = fnCallback(oTestVm);
+                if fRc2 is None:
+                    return fRc2;
+                fRc = fRc and fRc2;
+        return fRc;
+
+
+
+class TestVmManager(object):
+    """
+    Test VM manager.
+    """
+
+    def __init__(self, sResourcePath):
+        self.sResourcePath = sResourcePath;
+
+
+    def getStandardVmSet(self, sTxsTransport):
+        """
+        Gets the set of standard test VMs.
+
+        This is supposed to do something seriously clever, like searching the
+        testrsrc tree for usable VMs, but for the moment it's all hard coded. :-)
+        """
+
+        oSet = TestVmSet(oTestVmManager = self);
+
+        oTestVm = TestVm(oSet, 'tst-nt4sp1', sHd = '4.2/' + sTxsTransport + '/nt4sp1/t-nt4sp1.vdi',
+                         sKind = 'WindowsNT4', acCpusSup = [1]);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xppro', sHd = '4.2/' + sTxsTransport + '/xppro/t-xppro.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33));
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-nt4sp6', sHd = '4.2/nt4sp6/t-nt4sp6.vdi',
+                         sKind = 'WindowsNT4', acCpusSup = range(1, 33));
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-2ksp4', sHd = '4.2/win2ksp4/t-win2ksp4.vdi',
+                         sKind = 'Windows2000', acCpusSup = range(1, 33));
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2', sHd = '4.2/xpsp2/t-winxpsp2.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halaacpi', sHd = '4.2/xpsp2/t-winxp-halaacpi.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halacpi', sHd = '4.2/xpsp2/t-winxp-halacpi.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halapic', sHd = '4.2/xpsp2/t-winxp-halapic.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halmacpi', sHd = '4.2/xpsp2/t-winxp-halmacpi.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halmps', sHd = '4.2/xpsp2/t-winxp-halmps.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-win7', sHd = '4.2/win7-32/t-win7.vdi',
+                         sKind = 'Windows7', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-win8', sHd = '4.2/win8-32/t-win8.vdi',
+                         sKind = 'Windows8', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        return oSet;
+
+    def getSmokeVmSet(self):
+        """
+        Gets a representative set of VMs for smoke testing.
+        """
+
+        oSet = TestVmSet(oTestVmManager = self);
+
+        oTestVm = TestVm(oSet, 'tst-nt4sp1', sHd = '4.2/nat/nt4sp1/t-nt4sp1.vdi',
+                         sKind = 'WindowsNT4', acCpusSup = [1], sNic0AttachType = 'nat');
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xppro', sHd = '4.2/nat/xppro/t-xppro.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), sNic0AttachType = 'nat');
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-rhel5', sHd = '3.0/tcp/rhel5.vdi',
+                         sKind = 'RedHat', acCpusSup = range(1, 33), fIoApic = True, sNic0AttachType = 'nat');
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-win2k3ent', sHd = '3.0/tcp/win2k3ent-acpi.vdi',
+                         sKind = 'Windows2003', acCpusSup = range(1, 33), fPae = True, sNic0AttachType = 'bridged');
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-sol10', sHd = '3.0/tcp/solaris10.vdi',
+                         sKind = 'Solaris', acCpusSup = range(1, 33), fPae = True, sNic0AttachType = 'bridged');
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-sol10-64', sHd = '3.0/tcp/solaris10.vdi',
+                         sKind = 'Solaris_64', acCpusSup = range(1, 33), sNic0AttachType = 'bridged');
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-sol11u1', sHd = '4.2/nat/sol11u1/t-sol11u1.vdi',
+                         sKind = 'Solaris11_64', acCpusSup = range(1, 33), sNic0AttachType = 'nat',
+                         fIoApic = True, sHddControllerType = 'SATA Controller');
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-nt4sp6', sHd = '4.2/nt4sp6/t-nt4sp6.vdi',
+                         sKind = 'WindowsNT4', acCpusSup = range(1, 33));
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-2ksp4', sHd = '4.2/win2ksp4/t-win2ksp4.vdi',
+                         sKind = 'Windows2000', acCpusSup = range(1, 33));
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2', sHd = '4.2/xpsp2/t-winxpsp2.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halaacpi', sHd = '4.2/xpsp2/t-winxp-halaacpi.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halacpi', sHd = '4.2/xpsp2/t-winxp-halacpi.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halapic', sHd = '4.2/xpsp2/t-winxp-halapic.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halmacpi', sHd = '4.2/xpsp2/t-winxp-halmacpi.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-xpsp2-halmps', sHd = '4.2/xpsp2/t-winxp-halmps.vdi',
+                         sKind = 'WindowsXP', acCpusSup = range(2, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-win7', sHd = '4.2/win7-32/t-win7.vdi',
+                         sKind = 'Windows7', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        oTestVm = TestVm(oSet, 'tst-win8', sHd = '4.2/win8-32/t-win8.vdi',
+                         sKind = 'Windows8', acCpusSup = range(1, 33), fIoApic = True);
+        oSet.aoTestVms.append(oTestVm);
+
+        return oSet;
+
+    def shutUpPyLint(self):
+        """ Shut up already! """
+        return self.sResourcePath;
+
diff --git a/src/VBox/ValidationKit/testdriver/vboxwrappers.py b/src/VBox/ValidationKit/testdriver/vboxwrappers.py
new file mode 100644
index 0000000..5602572
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/vboxwrappers.py
@@ -0,0 +1,2707 @@
+# -*- coding: utf-8 -*-
+# $Id: vboxwrappers.py $
+# pylint: disable=C0302
+
+"""
+VirtualBox Wrapper Classes
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2015 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 100185 $"
+
+
+# Standard Python imports.
+import array
+import os
+import socket
+import sys
+
+# Validation Kit imports.
+from common     import utils;
+from testdriver import base;
+from testdriver import reporter;
+from testdriver import txsclient;
+from testdriver import vboxcon;
+from testdriver import vbox;
+from testdriver.base    import TdTaskBase;
+
+
+def _ControllerNameToBus(sController):
+    """ Translate a controller name to a storage bus. """
+    if sController == "IDE Controller":
+        iType = vboxcon.StorageBus_IDE;
+    elif sController == "SATA Controller":
+        iType = vboxcon.StorageBus_SATA;
+    elif sController == "Floppy Controller":
+        iType = vboxcon.StorageBus_Floppy;
+    elif sController == "SAS Controller":
+        iType = vboxcon.StorageBus_SAS;
+    elif sController == "SCSI Controller":
+        iType = vboxcon.StorageBus_SCSI;
+    else:
+        iType = vboxcon.StorageBus_Null;
+    return iType;
+
+def _nameMachineState(eState):
+    """ Gets the name (string) of a machine state."""
+    if eState == vboxcon.MachineState_PoweredOff: return 'PoweredOff';
+    if eState == vboxcon.MachineState_Saved: return 'Saved';
+    if eState == vboxcon.MachineState_Teleported: return 'Teleported';
+    if eState == vboxcon.MachineState_Aborted: return 'Aborted';
+    if eState == vboxcon.MachineState_Running: return 'Running';
+    if eState == vboxcon.MachineState_Paused: return 'Paused';
+    if eState == vboxcon.MachineState_Stuck: return 'GuruMeditation';
+    if eState == vboxcon.MachineState_Teleporting: return 'Teleporting';
+    if eState == vboxcon.MachineState_LiveSnapshotting: return 'LiveSnapshotting';
+    if eState == vboxcon.MachineState_Starting: return 'Starting';
+    if eState == vboxcon.MachineState_Stopping: return 'Stopping';
+    if eState == vboxcon.MachineState_Saving: return 'Saving';
+    if eState == vboxcon.MachineState_Restoring: return 'Restoring';
+    if eState == vboxcon.MachineState_TeleportingPausedVM: return 'TeleportingPausedVM';
+    if eState == vboxcon.MachineState_TeleportingIn: return 'TeleportingIn';
+    if eState == vboxcon.MachineState_FaultTolerantSyncing: return 'FaultTolerantSyncing';
+    if eState == vboxcon.MachineState_DeletingSnapshotOnline: return 'DeletingSnapshotOnline';
+    if eState == vboxcon.MachineState_DeletingSnapshotPaused: return 'DeletingSnapshotPaused';
+    if eState == vboxcon.MachineState_RestoringSnapshot: return 'RestoringSnapshot';
+    if eState == vboxcon.MachineState_DeletingSnapshot: return 'DeletingSnapshot';
+    if eState == vboxcon.MachineState_SettingUp: return 'SettingUp';
+    return 'Unknown-%s' % (eState,);
+
+
+class VirtualBoxWrapper(object): # pylint: disable=R0903
+    """
+    Wrapper around the IVirtualBox object that adds some (hopefully) useful
+    utility methods
+
+    The real object can be accessed thru the o member.  That said, members can
+    be accessed directly as well.
+    """
+
+    def __init__(self, oVBox, oVBoxMgr, fpApiVer, oTstDrv):
+        self.o          = oVBox;
+        self.oVBoxMgr   = oVBoxMgr;
+        self.fpApiVer   = fpApiVer;
+        self.oTstDrv    = oTstDrv;
+
+    def __getattr__(self, sName):
+        # Try ourselves first.
+        try:
+            oAttr = self.__dict__[sName];
+        except:
+            #try:
+            #    oAttr = dir(self)[sName];
+            #except AttributeError:
+            oAttr = getattr(self.o, sName);
+        return oAttr;
+
+    #
+    # Utilities.
+    #
+
+    def registerDerivedEventHandler(self, oSubClass, dArgs = None):
+        """
+        Create an instance of the given VirtualBoxEventHandlerBase sub-class
+        and register it.
+
+        The new instance is returned on success.  None is returned on error.
+        """
+        dArgsCopy = dArgs.copy() if dArgs is not None else dict();
+        dArgsCopy['oVBox'] = self;
+        return oSubClass.registerDerivedEventHandler(self.oVBoxMgr, self.fpApiVer, oSubClass, dArgsCopy,
+                                                     self.o, 'IVirtualBox', 'IVirtualBoxCallback');
+
+    def deleteHdByLocation(self, sHdLocation):
+        """
+        Deletes a disk image from the host, given it's location.
+        Returns True on success and False on failure. Error information is logged.
+        """
+        try:
+            oIMedium = self.oVBox.findHardDisk(sHdLocation);
+        except:
+            try:
+                if self.fpApiVer >= 4.1:
+                    oIMedium = self.oVBox.openMedium(sHdLocation, vboxcon.DeviceType_HardDisk,
+                                                     vboxcon.AccessMode_ReadWrite, False);
+                elif self.fpApiVer >= 4.0:
+                    oIMedium = self.oVBox.openMedium(sHdLocation, vboxcon.DeviceType_HardDisk,
+                                                     vboxcon.AccessMode_ReadWrite);
+                else:
+                    oIMedium = self.oVBox.openHardDisk(sHdLocation, vboxcon.AccessMode_ReadOnly, False, "", False, "");
+            except:
+                return reporter.errorXcpt('failed to open hd "%s"' % (sHdLocation));
+        return self.deleteHdByMedium(oIMedium)
+
+    def deleteHdByMedium(self, oIMedium):
+        """
+        Deletes a disk image from the host, given an IMedium reference.
+        Returns True on success and False on failure. Error information is logged.
+        """
+        try:    oProgressCom = oIMedium.deleteStorage();
+        except: return reporter.errorXcpt('deleteStorage() for disk %s failed' % (oIMedium,));
+        try:    oProgress = ProgressWrapper(oProgressCom, self.oVBoxMgr, self.oTstDrv, 'delete disk %s' % (oIMedium.location));
+        except: return reporter.errorXcpt();
+        oProgress.wait();
+        oProgress.logResult();
+        return oProgress.isSuccess();
+
+
+
+class ProgressWrapper(TdTaskBase):
+    """
+    Wrapper around a progress object for making it a task and providing useful
+    utility methods.
+    The real progress object can be accessed thru the o member.
+    """
+
+    def __init__(self, oProgress, oVBoxMgr, oTstDrv, sName):
+        TdTaskBase.__init__(self, utils.getCallerName());
+        self.o          = oProgress;
+        self.oVBoxMgr   = oVBoxMgr;
+        self.oTstDrv    = oTstDrv;
+        self.sName      = sName;
+
+    def toString(self):
+        return '<%s sName=%s, oProgress=%s >' \
+             % (TdTaskBase.toString(self), self.sName, self.o);
+
+    #
+    # TdTaskBase overrides.
+    #
+
+    def pollTask(self, fLocked = False):
+        """
+        Overrides TdTaskBase.pollTask().
+
+        This method returns False until the progress object has completed.
+        """
+        self.doQuickApiTest();
+        try:
+            try:
+                if self.o.completed:
+                    return True;
+            except:
+                pass;
+        finally:
+            self.oTstDrv.processPendingEvents();
+        return False;
+
+    def waitForTask(self, cMsTimeout = 0):
+        """
+        Overrides TdTaskBase.waitForTask().
+        Process XPCOM/COM events while waiting.
+        """
+        msStart = base.timestampMilli();
+        fState  = self.pollTask(False);
+        while not fState:
+            cMsElapsed = base.timestampMilli() - msStart;
+            if cMsElapsed > cMsTimeout:
+                break;
+            cMsToWait = cMsTimeout - cMsElapsed;
+            if cMsToWait > 500:
+                cMsToWait = 500;
+            try:
+                self.o.waitForCompletion(cMsToWait);
+            except KeyboardInterrupt: raise;
+            except: pass;
+            fState = self.pollTask(False);
+        return fState;
+
+    #
+    # Utility methods.
+    #
+
+    def isSuccess(self):
+        """
+        Tests if the progress object completed successfully.
+        Returns True on success, False on failure or incomplete.
+        """
+        if not self.isCompleted():
+            return False;
+        return self.getResult() >= 0;
+
+    def isCompleted(self):
+        """
+        Wrapper around IProgress.completed.
+        """
+        return self.pollTask();
+
+    def isCancelable(self):
+        """
+        Wrapper around IProgress.cancelable.
+        """
+        try:
+            fRc = self.o.cancelable;
+        except:
+            reporter.logXcpt();
+            fRc = False;
+        return fRc;
+
+    def wasCanceled(self):
+        """
+        Wrapper around IProgress.canceled.
+        """
+        try:
+            fRc = self.o.canceled;
+        except:
+            reporter.logXcpt(self.sName);
+            fRc = False;
+        return fRc;
+
+    def cancel(self):
+        """
+        Wrapper around IProgress.cancel()
+        Returns True on success, False on failure (logged as error).
+        """
+        try:
+            self.o.cancel();
+        except:
+            reporter.errorXcpt(self.sName);
+            return False;
+        return True;
+
+    def getResult(self):
+        """
+        Wrapper around IProgress.resultCode.
+        """
+        try:
+            iRc = self.o.resultCode;
+        except:
+            reporter.logXcpt(self.sName);
+            iRc = -1;
+        return iRc;
+
+    def getErrInfoResultCode(self):
+        """
+        Wrapper around IProgress.errorInfo.resultCode.
+
+        Returns the string on success, -1 on bad objects (logged as error), and
+        -2 on missing errorInfo object.
+        """
+        iRc = -1;
+        try:
+            oErrInfo = self.o.errorInfo;
+        except:
+            reporter.errorXcpt(self.sName);
+        else:
+            if oErrInfo is None:
+                iRc = -2;
+            else:
+                try:
+                    iRc = oErrInfo.resultCode;
+                except:
+                    reporter.errorXcpt();
+        return iRc;
+
+    def getErrInfoText(self):
+        """
+        Wrapper around IProgress.errorInfo.text.
+
+        Returns the string on success, None on failure.  Missing errorInfo is
+        not logged as an error, all other failures are.
+        """
+        sText = None;
+        try:
+            oErrInfo = self.o.errorInfo;
+        except:
+            reporter.log2Xcpt(self.sName);
+        else:
+            if oErrInfo is not None:
+                try:
+                    sText = oErrInfo.text;
+                except:
+                    reporter.errorXcpt();
+        return sText;
+
+    def stringifyErrorInfo(self):
+        """
+        Formats IProgress.errorInfo into a string.
+        """
+        try:
+            oErrInfo = self.o.errorInfo;
+        except:
+            reporter.logXcpt(self.sName);
+            sErr = 'no error info';
+        else:
+            sErr = vbox.stringifyErrorInfo(oErrInfo);
+        return sErr;
+
+    def stringifyResult(self):
+        """
+        Stringify the result.
+        """
+        if self.isCompleted():
+            if self.wasCanceled():
+                sRet = 'Progress %s: Canceled, hrc=%s' % (self.sName, vbox.ComError.toString(self.getResult()));
+            elif self.getResult() == 0:
+                sRet = 'Progress %s: Success' % (self.sName,);
+            elif self.getResult() > 0:
+                sRet = 'Progress %s: Success (hrc=%s)' % (self.sName, vbox.ComError.toString(self.getResult()));
+            else:
+                sRet = 'Progress %s: Failed! %s' % (self.sName, self.stringifyErrorInfo());
+        else:
+            sRet = 'Progress %s: Not completed yet...' % (self.sName);
+        return sRet;
+
+    def logResult(self, fIgnoreErrors = False):
+        """ Logs the result. """
+        sText = self.stringifyResult();
+        if      self.isCompleted() and self.getResult() < 0 \
+            and fIgnoreErrors is False:
+            return reporter.error(sText);
+        return reporter.log(sText);
+
+    def waitOnProgress(self, cMsInterval = 1000):
+        """
+        See vbox.TestDriver.waitOnProgress.
+        """
+        self.doQuickApiTest();
+        return self.oTstDrv.waitOnProgress(self.o, cMsInterval);
+
+    def wait(self, cMsTimeout = 60000, fErrorOnTimeout = True, cMsInterval = 1000):
+        """
+        Wait on the progress object for a while.
+
+        Returns the resultCode of the progress object if completed.
+        Returns -1 on timeout, logged as error if fErrorOnTimeout is set.
+        Returns -2 is the progress object is invalid or waitForCompletion
+        fails (logged as errors).
+        """
+        msStart = base.timestampMilli();
+        while True:
+            self.oTstDrv.processPendingEvents();
+            self.doQuickApiTest();
+            try:
+                if self.o.completed:
+                    break;
+            except:
+                reporter.errorXcpt(self.sName);
+                return -2;
+            self.oTstDrv.processPendingEvents();
+
+            cMsElapsed = base.timestampMilli() - msStart;
+            if cMsElapsed > cMsTimeout:
+                if fErrorOnTimeout:
+                    reporter.error('Timing out after waiting for %u s on "%s"' % (cMsTimeout / 1000, self.sName))
+                return -1;
+
+            try:
+                self.o.waitForCompletion(cMsInterval);
+            except:
+                reporter.errorXcpt(self.sName);
+                return -2;
+
+        try:
+            rc = self.o.resultCode;
+        except:
+            rc = -2;
+            reporter.errorXcpt(self.sName);
+        self.oTstDrv.processPendingEvents();
+        return rc;
+
+    def waitForOperation(self, iOperation, cMsTimeout = 60000, fErrorOnTimeout = True, cMsInterval = 1000, \
+                         fIgnoreErrors = False):
+        """
+        Wait for the completion of a operation.
+
+        Negative iOperation values are relative to operationCount (this
+        property may changed at runtime).
+
+        Returns 0 if the operation completed normally.
+        Returns -1 on timeout, logged as error if fErrorOnTimeout is set.
+        Returns -2 is the progress object is invalid or waitForCompletion
+        fails (logged as errors).
+        Returns -3 if if the operation completed with an error, this is logged
+        as an error.
+        """
+        msStart = base.timestampMilli();
+        while True:
+            self.oTstDrv.processPendingEvents();
+            self.doQuickApiTest();
+            try:
+                iCurrentOperation = self.o.operation;
+                cOperations       = self.o.operationCount;
+                if iOperation >= 0:
+                    iRealOperation = iOperation;
+                else:
+                    iRealOperation = cOperations + iOperation;
+
+                if iCurrentOperation > iRealOperation:
+                    return 0;
+                if iCurrentOperation == iRealOperation \
+                   and iRealOperation >= cOperations - 1 \
+                   and self.o.completed:
+                    if self.o.resultCode < 0:
+                        self.logResult(fIgnoreErrors);
+                        return -3;
+                    return 0;
+            except:
+                if fIgnoreErrors:
+                    reporter.logXcpt();
+                else:
+                    reporter.errorXcpt();
+                return -2;
+            self.oTstDrv.processPendingEvents();
+
+            cMsElapsed = base.timestampMilli() - msStart;
+            if cMsElapsed > cMsTimeout:
+                if fErrorOnTimeout:
+                    if fIgnoreErrors:
+                        reporter.log('Timing out after waiting for %u s on "%s" operation %d' \
+                                     % (cMsTimeout / 1000, self.sName, iOperation))
+                    else:
+                        reporter.error('Timing out after waiting for %u s on "%s" operation %d' \
+                                       % (cMsTimeout / 1000, self.sName, iOperation))
+                return -1;
+
+            try:
+                self.o.waitForOperationCompletion(iRealOperation, cMsInterval);
+            except:
+                if fIgnoreErrors:
+                    reporter.logXcpt(self.sName);
+                else:
+                    reporter.errorXcpt(self.sName);
+                return -2;
+        # Not reached.
+
+    def doQuickApiTest(self):
+        """
+        Queries everything that is stable and easy to get at and checks that
+        they don't throw errors.
+        """
+        if True:
+            try:
+                iPct        = self.o.operationPercent;
+                sDesc       = self.o.description;
+                fCancelable = self.o.cancelable;
+                cSecsRemain = self.o.timeRemaining;
+                fCanceled   = self.o.canceled;
+                fCompleted  = self.o.completed;
+                iOp         = self.o.operation;
+                cOps        = self.o.operationCount;
+                iOpPct      = self.o.operationPercent;
+                sOpDesc     = self.o.operationDescription;
+            except:
+                reporter.errorXcpt('%s: %s' % (self.sName, self.o,));
+                return False;
+            try:
+                # Very noisy -- only enable for debugging purposes.
+                #reporter.log2('%s: op=%u/%u/%s: %u%%; total=%u%% cancel=%s/%s compl=%s rem=%us; desc=%s' \
+                #              % (self.sName, iOp, cOps, sOpDesc, iOpPct, iPct, fCanceled, fCancelable, fCompleted, \
+                #                 cSecsRemain, sDesc));
+                _ = iPct; _ = sDesc;  _ = fCancelable; _ = cSecsRemain; _ = fCanceled; _ = fCompleted; _ = iOp;
+                _ = cOps; _ = iOpPct; _ = sOpDesc;
+            except:
+                reporter.errorXcpt();
+                return False;
+
+        return True;
+
+
+class SessionWrapper(TdTaskBase):
+    """
+    Wrapper around a machine session.  The real session object can be accessed
+    thru the o member (short is good, right :-).
+    """
+
+    def __init__(self, oSession, oVM, oVBox, oVBoxMgr, oTstDrv, fRemoteSession, sFallbackName = None, sLogFile = None):
+        """
+        Initializes the session wrapper.
+        """
+        TdTaskBase.__init__(self, utils.getCallerName());
+        self.o                      = oSession;
+        self.oVBox                  = oVBox;
+        self.oVBoxMgr               = oVBoxMgr;
+        self.oVM                    = oVM;  # Not the session machine. Useful backdoor...
+        self.oTstDrv                = oTstDrv;
+        self.fpApiVer               = oTstDrv.fpApiVer;
+        self.fRemoteSession         = fRemoteSession;
+        self.sLogFile               = sLogFile;
+        self.oConsoleEventHandler   = None;
+        self.uPid                   = None;
+
+        try:
+            self.sName              = oSession.machine.name;
+        except:
+            if sFallbackName is not None:
+                self.sName          = sFallbackName;
+            else:
+                try:    self.sName  = str(oSession.machine);
+                except: self.sName  = 'is-this-vm-already-off'
+
+        try:
+            self.sUuid              = oSession.machine.id;
+        except:
+            self.sUuid              = None;
+
+        # Try cache the SessionPID.
+        self.getPid();
+
+    def __del__(self):
+        """
+        Destructor that makes sure the callbacks are deregistered and
+        that the session is closed.
+        """
+        if self.oConsoleEventHandler is not None:
+            self.oConsoleEventHandler.unregister();
+            self.oConsoleEventHandler = None;
+
+        if self.o is not None:
+            try:
+                self.close();
+                reporter.log('close session %s' % (self.o));
+            except:
+                pass;
+            self.o = None;
+
+        TdTaskBase.__del__(self);
+
+    def toString(self):
+        return '<%s: sUuid=%s, sName=%s, uPid=%s, sDbgCreated=%s, fRemoteSession=%s, oSession=%s,' \
+               ' oConsoleEventHandler=%s, oVM=%s >' \
+             % (type(self).__name__, self.sUuid, self.sName, self.uPid, self.sDbgCreated, self.fRemoteSession,
+                self.o, self.oConsoleEventHandler, self.oVM,);
+
+    def __str__(self):
+        return self.toString();
+
+    #
+    # TdTaskBase overrides.
+    #
+
+    def __pollTask(self):
+        """ Internal poller """
+        # Poll for events after doing the remote GetState call, otherwise we
+        # might end up sleepless because XPCOM queues a cleanup event.
+        try:
+            try:
+                eState = self.o.machine.state;
+            except Exception, oXcpt:
+                if vbox.ComError.notEqual(oXcpt, vbox.ComError.E_UNEXPECTED):
+                    reporter.logXcpt();
+                return True;
+        finally:
+            self.oTstDrv.processPendingEvents();
+
+        # Switch
+        if eState == vboxcon.MachineState_Running:
+            return False;
+        if eState == vboxcon.MachineState_Paused:
+            return False;
+        if eState == vboxcon.MachineState_Teleporting:
+            return False;
+        if eState == vboxcon.MachineState_LiveSnapshotting:
+            return False;
+        if eState == vboxcon.MachineState_Starting:
+            return False;
+        if eState == vboxcon.MachineState_Stopping:
+            return False;
+        if eState == vboxcon.MachineState_Saving:
+            return False;
+        if eState == vboxcon.MachineState_Restoring:
+            return False;
+        if eState == vboxcon.MachineState_TeleportingPausedVM:
+            return False;
+        if eState == vboxcon.MachineState_TeleportingIn:
+            return False;
+
+        # *Beeep* fudge!
+        if self.fpApiVer < 3.2 \
+          and eState == vboxcon.MachineState_PoweredOff \
+          and self.getAgeAsMs() < 3000:
+            return False;
+
+        reporter.log('SessionWrapper::pollTask: eState=%s' % (eState));
+        return True;
+
+
+    def pollTask(self, fLocked = False):
+        """
+        Overrides TdTaskBase.pollTask().
+
+        This method returns False while the VM is online and running normally.
+        """
+        fRc = self.__pollTask();
+
+        # HACK ALERT: Lazily try registering the console event handler if
+        #             we're not ready.
+        if not fRc and self.oConsoleEventHandler is None:
+            self.registerEventHandlerForTask();
+
+        # HACK ALERT: Lazily try get the PID and add it to the PID file.
+        if not fRc and self.uPid is None:
+            self.getPid();
+
+        return fRc;
+
+    def waitForTask(self, cMsTimeout = 0):
+        """
+        Overrides TdTaskBase.waitForTask().
+        Process XPCOM/COM events while waiting.
+        """
+        msStart = base.timestampMilli();
+        fState  = self.pollTask(False);
+        while not fState:
+            cMsElapsed = base.timestampMilli() - msStart;
+            if cMsElapsed > cMsTimeout:
+                break;
+            try:    self.oVBoxMgr.waitForEvents(cMsTimeout - cMsElapsed);
+            except KeyboardInterrupt: raise;
+            except: pass;
+            fState = self.pollTask(False);
+        return fState;
+
+    def setTaskOwner(self, oOwner):
+        """
+        HACK ALERT!
+        Overrides TdTaskBase.setTaskOwner() so we can try call
+        registerEventHandlerForTask() again when when the testdriver calls
+        addTask() after VM has been spawned.  Related to pollTask() above.
+
+        The testdriver must not add the task too early for this to work!
+        """
+        if oOwner is not None:
+            self.registerEventHandlerForTask()
+        return TdTaskBase.setTaskOwner(self, oOwner);
+
+
+    #
+    # Task helpers.
+    #
+
+    def registerEventHandlerForTask(self):
+        """
+        Registers the console event handlers for working the task state.
+        """
+        if self.oConsoleEventHandler is not None:
+            return True;
+        self.oConsoleEventHandler = self.registerDerivedEventHandler(vbox.SessionConsoleEventHandler, {}, False);
+        return self.oConsoleEventHandler is not None;
+
+
+    def assertPoweredOff(self):
+        """
+        Asserts that the VM is powered off, reporting an error if not.
+        Returns True if powered off, False + error msg if not.
+        """
+        try:
+            try:
+                eState = self.oVM.state;
+            except Exception:
+                reporter.errorXcpt();
+                return True;
+        finally:
+            self.oTstDrv.processPendingEvents();
+
+        if eState == vboxcon.MachineState_PoweredOff:
+            return True;
+        reporter.error('Expected machine state "PoweredOff", machine is in the "%s" state instead.'
+                       % (_nameMachineState(eState),));
+        return False;
+
+
+    def getMachineStateWithName(self):
+        """
+        Gets the current machine state both as a constant number/whatever and
+        as a human readable string.  On error, the constants will be set to
+        None and the string will be the error message.
+        """
+        try:
+            eState = self.oVM.state;
+        except:
+            return (None, '[error getting state: %s]' % (self.oVBoxMgr.xcptToString(),));
+        finally:
+            self.oTstDrv.processPendingEvents();
+        return (eState, _nameMachineState(eState));
+
+    def reportPrematureTermination(self, sPrefix = ''):
+        """
+        Reports a premature virtual machine termination.
+        Returns False to facilitate simpler error paths.
+        """
+
+        reporter.error(sPrefix + 'The virtual machine terminated prematurely!!');
+        (enmState, sStateNm) = self.getMachineStateWithName();
+        reporter.error(sPrefix + 'Machine state: %s' % (sStateNm,));
+
+        if    enmState is not None \
+          and enmState == vboxcon.MachineState_Aborted \
+          and self.uPid is not None:
+            #
+            # Look for process crash info.
+            #
+            def addCrashFile(sLogFile, fBinary):
+                """ processCollectCrashInfo callback. """
+                reporter.addLogFile(sLogFile, 'crash/dump/vm' if fBinary else 'crash/report/vm');
+            utils.processCollectCrashInfo(self.uPid, reporter.log, addCrashFile);
+
+        return False;
+
+
+
+    #
+    # ISession / IMachine / ISomethingOrAnother wrappers.
+    #
+
+    def close(self):
+        """
+        Closes the session if it's open and removes it from the
+        vbox.TestDriver.aoRemoteSessions list.
+        Returns success indicator.
+        """
+        fRc = True;
+        if self.o is not None:
+            # Get the pid in case we need to kill the process later on.
+            self.getPid();
+
+            # Try close it.
+            try:
+                if self.fpApiVer < 3.3:
+                    self.o.close();
+                else:
+                    self.o.unlockMachine();
+                self.o = None;
+            except KeyboardInterrupt:
+                raise;
+            except:
+                # Kludge to ignore VBoxSVC's closing of our session when the
+                # direct session closes / VM process terminates.  Fun!
+                try:    fIgnore = self.o.state == vboxcon.SessionState_Unlocked;
+                except: fIgnore = False;
+                if not fIgnore:
+                    reporter.errorXcpt('ISession::unlockMachine failed on %s' % (self.o));
+                    fRc = False;
+
+            # Remove it from the remote session list if applicable (not 100% clean).
+            if fRc and self.fRemoteSession:
+                try:
+                    if self in self.oTstDrv.aoRemoteSessions:
+                        reporter.log2('SessionWrapper::close: Removing myself from oTstDrv.aoRemoteSessions');
+                        self.oTstDrv.aoRemoteSessions.remove(self)
+                except:
+                    reporter.logXcpt();
+
+                if self.uPid is not None:
+                    self.oTstDrv.pidFileRemove(self.uPid);
+
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def saveSettings(self, fClose = False):
+        """
+        Saves the settings and optionally closes the session.
+        Returns success indicator.
+        """
+        try:
+            try:
+                self.o.machine.saveSettings();
+            except:
+                reporter.errorXcpt('saveSettings failed on %s' % (self.o));
+                return False;
+        finally:
+            self.oTstDrv.processPendingEvents();
+        if fClose:
+            return self.close();
+        return True;
+
+    def discardSettings(self, fClose = False):
+        """
+        Discards the settings and optionally closes the session.
+        """
+        try:
+            try:
+                self.o.machine.discardSettings();
+            except:
+                reporter.errorXcpt('discardSettings failed on %s' % (self.o));
+                return False;
+        finally:
+            self.oTstDrv.processPendingEvents();
+        if fClose:
+            return self.close();
+        return True;
+
+    def enableVirtEx(self, fEnable):
+        """
+        Enables or disables AMD-V/VT-x.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        # Enable/disable it.
+        fRc = True;
+        try:
+            self.o.machine.setHWVirtExProperty(vboxcon.HWVirtExPropertyType_Enabled, fEnable);
+        except:
+            reporter.errorXcpt('failed to set HWVirtExPropertyType_Enabled=%s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('set HWVirtExPropertyType_Enabled=%s for "%s"' % (fEnable, self.sName));
+
+        # Force/unforce it.
+        if fRc and hasattr(vboxcon, 'HWVirtExPropertyType_Force'):
+            try:
+                self.o.machine.setHWVirtExProperty(vboxcon.HWVirtExPropertyType_Force, fEnable);
+            except:
+                reporter.errorXcpt('failed to set HWVirtExPropertyType_Force=%s for "%s"' % (fEnable, self.sName));
+                fRc = False;
+            else:
+                reporter.log('set HWVirtExPropertyType_Force=%s for "%s"' % (fEnable, self.sName));
+        else:
+            reporter.log('Warning! vboxcon has no HWVirtExPropertyType_Force attribute.');
+            ## @todo Modify CFGM to do the same for old VBox versions?
+
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enableNestedPaging(self, fEnable):
+        """
+        Enables or disables nested paging..
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        ## @todo Add/remove force CFGM thing, we don't want fallback logic when testing.
+        fRc = True;
+        try:
+            self.o.machine.setHWVirtExProperty(vboxcon.HWVirtExPropertyType_NestedPaging, fEnable);
+        except:
+            reporter.errorXcpt('failed to set HWVirtExPropertyType_NestedPaging=%s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('set HWVirtExPropertyType_NestedPaging=%s for "%s"' % (fEnable, self.sName));
+            self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enableLongMode(self, fEnable):
+        """
+        Enables or disables LongMode.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        # Supported.
+        if self.fpApiVer < 4.2  or  not hasattr(vboxcon, 'HWVirtExPropertyType_LongMode'):
+            return True;
+
+        # Enable/disable it.
+        fRc = True;
+        try:
+            self.o.machine.setCPUProperty(vboxcon.CPUPropertyType_LongMode, fEnable);
+        except:
+            reporter.errorXcpt('failed to set CPUPropertyType_LongMode=%s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('set CPUPropertyType_LongMode=%s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enablePae(self, fEnable):
+        """
+        Enables or disables PAE
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            if self.fpApiVer >= 3.2:    # great, ain't it?
+                self.o.machine.setCPUProperty(vboxcon.CPUPropertyType_PAE, fEnable);
+            else:
+                self.o.machine.setCpuProperty(vboxcon.CpuPropertyType_PAE, fEnable);
+        except:
+            reporter.errorXcpt('failed to set CPUPropertyType_PAE=%s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('set CPUPropertyType_PAE=%s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enableIoApic(self, fEnable):
+        """
+        Enables or disables the IO-APIC
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            self.o.machine.BIOSSettings.IOAPICEnabled = fEnable;
+        except:
+            reporter.errorXcpt('failed to set BIOSSettings.IOAPICEnabled=%s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('set BIOSSettings.IOAPICEnabled=%s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enableHpet(self, fEnable):
+        """
+        Enables or disables the HPET
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            if self.fpApiVer >= 4.2:
+                self.o.machine.HPETEnabled = fEnable;
+            else:
+                self.o.machine.hpetEnabled = fEnable;
+        except:
+            reporter.errorXcpt('failed to set HpetEnabled=%s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('set HpetEnabled=%s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enableUsbHid(self, fEnable):
+        """
+        Enables or disables the USB HID
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            if fEnable:
+                if self.fpApiVer >= 4.3:
+                    cOhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_OHCI);
+                    if cOhciCtls == 0:
+                        self.o.machine.AddUSBController('OHCI', vboxcon.USBControllerType_OHCI);
+                else:
+                    self.o.machine.usbController.enabled = True;
+
+                if self.fpApiVer >= 4.2:
+                    self.o.machine.pointingHIDType = vboxcon.PointingHIDType_ComboMouse;
+                    self.o.machine.keyboardHIDType = vboxcon.KeyboardHIDType_ComboKeyboard;
+                else:
+                    self.o.machine.pointingHidType = vboxcon.PointingHidType_ComboMouse;
+                    self.o.machine.keyboardHidType = vboxcon.KeyboardHidType_ComboKeyboard;
+            else:
+                if self.fpApiVer >= 4.2:
+                    self.o.machine.pointingHIDType = vboxcon.PointingHIDType_PS2Mouse;
+                    self.o.machine.keyboardHIDType = vboxcon.KeyboardHIDType_PS2Keyboard;
+                else:
+                    self.o.machine.pointingHidType = vboxcon.PointingHidType_PS2Mouse;
+                    self.o.machine.keyboardHidType = vboxcon.KeyboardHidType_PS2Keyboard;
+        except:
+            reporter.errorXcpt('failed to change UsbHid to %s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('changed UsbHid to %s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enableUsbOhci(self, fEnable):
+        """
+        Enables or disables the USB OHCI controller
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            if fEnable:
+                if self.fpApiVer >= 4.3:
+                    cOhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_OHCI);
+                    if cOhciCtls == 0:
+                        self.o.machine.AddUSBController('OHCI', vboxcon.USBControllerType_OHCI);
+                else:
+                    self.o.machine.usbController.enabled = True;
+            else:
+                if self.fpApiVer >= 4.3:
+                    cOhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_OHCI);
+                    if cOhciCtls == 1:
+                        self.o.machine.RemoveUSBController('OHCI');
+                else:
+                    self.o.machine.usbController.enabled = False;
+        except:
+            reporter.errorXcpt('failed to change OHCI to %s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('changed OHCI to %s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enableUsbEhci(self, fEnable):
+        """
+        Enables or disables the USB EHCI controller, enables also OHCI if it is still disabled.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            if fEnable:
+                if self.fpApiVer >= 4.3:
+                    cOhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_OHCI);
+                    if cOhciCtls == 0:
+                        self.o.machine.addUSBController('OHCI', vboxcon.USBControllerType_OHCI);
+
+                    cEhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_EHCI);
+                    if cEhciCtls == 0:
+                        self.o.machine.addUSBController('EHCI', vboxcon.USBControllerType_EHCI);
+                else:
+                    self.o.machine.usbController.enabled = True;
+                    self.o.machine.usbController.enabledEHCI = True;
+            else:
+                if self.fpApiVer >= 4.3:
+                    cEhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_EHCI);
+                    if cEhciCtls == 1:
+                        self.o.machine.RemoveUSBController('EHCI');
+                else:
+                    self.o.machine.usbController.enabledEHCI = False;
+        except:
+            reporter.errorXcpt('failed to change EHCI to %s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('changed EHCI to %s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def enableUsbXhci(self, fEnable):
+        """
+        Enables or disables the USB XHCI controller. Error information is logged.
+        """
+        fRc = True;
+        try:
+            if fEnable:
+                cXhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_XHCI);
+                if cXhciCtls == 0:
+                    self.o.machine.addUSBController('XHCI', vboxcon.USBControllerType_XHCI);
+            else:
+                cXhciCtls = self.o.machine.getUSBControllerCountByType(vboxcon.USBControllerType_XHCI);
+                if cXhciCtls == 1:
+                    self.o.machine.RemoveUSBController('XHCI');
+        except:
+            reporter.errorXcpt('failed to change XHCI to %s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('changed XHCI to %s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def setFirmwareType(self, eType):
+        """
+        Sets the firmware type.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            self.o.machine.firmwareType = eType;
+        except:
+            reporter.errorXcpt('failed to set firmwareType=%s for "%s"' % (eType, self.sName));
+            fRc = False;
+        else:
+            reporter.log('set firmwareType=%s for "%s"' % (eType, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def setupBootLogo(self, fEnable, cMsLogoDisplay = 0):
+        """
+        Sets up the boot logo.  fEnable toggles the fade and boot menu
+        settings as well as the mode.
+        """
+        fRc = True;
+        try:
+            self.o.machine.BIOSSettings.logoFadeIn       = not fEnable;
+            self.o.machine.BIOSSettings.logoFadeOut      = not fEnable;
+            self.o.machine.BIOSSettings.logoDisplayTime  = cMsLogoDisplay;
+            if fEnable:
+                self.o.machine.BIOSSettings.bootMenuMode = vboxcon.BIOSBootMenuMode_Disabled;
+            else:
+                self.o.machine.BIOSSettings.bootMenuMode = vboxcon.BIOSBootMenuMode_MessageAndMenu;
+        except:
+            reporter.errorXcpt('failed to set logoFadeIn/logoFadeOut/bootMenuMode=%s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+        else:
+            reporter.log('set logoFadeIn/logoFadeOut/bootMenuMode=%s for "%s"' % (fEnable, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def setupVrdp(self, fEnable, uPort = None):
+        """
+        Configures VRDP.
+        """
+        fRc = True;
+        try:
+            if self.fpApiVer >= 4.0:
+                self.o.machine.VRDEServer.enabled = fEnable;
+            else:
+                self.o.machine.VRDPServer.enabled = fEnable;
+        except:
+            reporter.errorXcpt('failed to set VRDEServer::enabled=%s for "%s"' % (fEnable, self.sName));
+            fRc = False;
+
+        if uPort is not None and fRc:
+            try:
+                if self.fpApiVer >= 4.0:
+                    self.o.machine.VRDEServer.setVRDEProperty("TCP/Ports", str(uPort));
+                else:
+                    self.o.machine.VRDPServer.ports = str(uPort);
+            except:
+                reporter.errorXcpt('failed to set VRDEServer::ports=%s for "%s"' % (uPort, self.sName));
+                fRc = False;
+        if fRc:
+            reporter.log('set VRDEServer.enabled/ports=%s/%s for "%s"' % (fEnable, uPort, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def getNicDriverNameFromType(self, eNicType):
+        """
+        Helper that translate the adapter type into a driver name.
+        """
+        if    eNicType == vboxcon.NetworkAdapterType_Am79C970A \
+           or eNicType == vboxcon.NetworkAdapterType_Am79C973:
+            sName = 'pcnet';
+        elif    eNicType == vboxcon.NetworkAdapterType_I82540EM \
+             or eNicType == vboxcon.NetworkAdapterType_I82543GC \
+             or eNicType == vboxcon.NetworkAdapterType_I82545EM:
+            sName = 'e1000';
+        elif eNicType == vboxcon.NetworkAdapterType_Virtio:
+            sName = 'virtio-net';
+        else:
+            reporter.error('Unknown adapter type "%s" (VM: "%s")' % (eNicType, self.sName));
+            sName = 'pcnet';
+        return sName;
+
+    def setupNatForwardingForTxs(self, iNic = 0, iHostPort = 5042):
+        """
+        Sets up NAT forwarding for port 5042 if applicable, cleans up if not.
+        """
+        try:
+            oNic = self.o.machine.getNetworkAdapter(iNic);
+        except:
+            reporter.errorXcpt('getNetworkAdapter(%s) failed for "%s"' % (iNic, self.sName));
+            return False;
+
+        # Nuke the old setup for all possible adapter types (in case we're
+        # called after it changed).
+        for sName in ('pcnet', 'e1000', 'virtio-net'):
+            for sConfig in ('VBoxInternal/Devices/%s/%u/LUN#0/AttachedDriver/Config' % (sName, iNic), \
+                            'VBoxInternal/Devices/%s/%u/LUN#0/Config' % (sName, iNic)):
+                try:
+                    self.o.machine.setExtraData('%s/txs/Protocol'  % (sConfig), '');
+                    self.o.machine.setExtraData('%s/txs/HostPort'  % (sConfig), '');
+                    self.o.machine.setExtraData('%s/txs/GuestPort' % (sConfig), '');
+                except:
+                    reporter.errorXcpt();
+
+        # Set up port forwarding if NAT attachment.
+        try:
+            eAttType = oNic.attachmentType;
+        except:
+            reporter.errorXcpt('attachmentType on %s failed for "%s"' % (iNic, self.sName));
+            return False;
+        if eAttType != vboxcon.NetworkAttachmentType_NAT:
+            return True;
+
+        try:
+            eNicType = oNic.adapterType;
+            fTraceEnabled = oNic.traceEnabled;
+        except:
+            reporter.errorXcpt('attachmentType/traceEnabled on %s failed for "%s"' % (iNic, self.sName));
+            return False;
+
+        if self.fpApiVer >= 4.1:
+            try:
+                if self.fpApiVer >= 4.2:
+                    oNatEngine = oNic.NATEngine;
+                else:
+                    oNatEngine = oNic.natDriver;
+            except:
+                reporter.errorXcpt('Failed to get INATEngine data on "%s"' % (self.sName));
+                return False;
+            try:    oNatEngine.removeRedirect('txs');
+            except: pass;
+            try:
+                oNatEngine.addRedirect('txs', vboxcon.NATProtocol_TCP, '127.0.0.1', '%s' % (iHostPort), '', '5042');
+            except:
+                reporter.errorXcpt('Failed to add a addRedirect redirect on "%s"' % (self.sName));
+                return False;
+
+        else:
+            sName = self.getNicDriverNameFromType(eNicType);
+            if fTraceEnabled:
+                sConfig = 'VBoxInternal/Devices/%s/%u/LUN#0/AttachedDriver/Config' % (sName, iNic)
+            else:
+                sConfig = 'VBoxInternal/Devices/%s/%u/LUN#0/Config' % (sName, iNic)
+
+            try:
+                self.o.machine.setExtraData('%s/txs/Protocol'  % (sConfig), 'TCP');
+                self.o.machine.setExtraData('%s/txs/HostPort'  % (sConfig), '%s' % (iHostPort));
+                self.o.machine.setExtraData('%s/txs/GuestPort' % (sConfig), '5042');
+            except:
+                reporter.errorXcpt('Failed to set NAT extra data on "%s"' % (self.sName));
+                return False;
+        return True;
+
+    def setNicType(self, eType, iNic = 0):
+        """
+        Sets the NIC type of the specified NIC.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        try:
+            try:
+                oNic = self.o.machine.getNetworkAdapter(iNic);
+            except:
+                reporter.errorXcpt('getNetworkAdapter(%s) failed for "%s"' % (iNic, self.sName));
+                return False;
+            try:
+                oNic.adapterType = eType;
+            except:
+                reporter.errorXcpt('failed to set NIC type on slot %s to %s for VM "%s"' % (iNic, eType, self.sName));
+                return False;
+        finally:
+            self.oTstDrv.processPendingEvents();
+
+        if not self.setupNatForwardingForTxs(iNic):
+            return False;
+        reporter.log('set NIC type on slot %s to %s for VM "%s"' % (iNic, eType, self.sName));
+        return True;
+
+    def setNicTraceEnabled(self, fTraceEnabled, sTraceFile, iNic = 0):
+        """
+        Sets the NIC trace enabled flag and file path.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        try:
+            try:
+                oNic = self.o.machine.getNetworkAdapter(iNic);
+            except:
+                reporter.errorXcpt('getNetworkAdapter(%s) failed for "%s"' % (iNic, self.sName));
+                return False;
+            try:
+                oNic.traceEnabled = fTraceEnabled;
+                oNic.traceFile = sTraceFile;
+            except:
+                reporter.errorXcpt('failed to set NIC trace flag on slot %s to %s for VM "%s"' \
+                                   % (iNic, fTraceEnabled, self.sName));
+                return False;
+        finally:
+            self.oTstDrv.processPendingEvents();
+
+        if not self.setupNatForwardingForTxs(iNic):
+            return False;
+        reporter.log('set NIC trace on slot %s to "%s" (path "%s") for VM "%s"' %
+                        (iNic, fTraceEnabled, sTraceFile, self.sName));
+        return True;
+
+    def getDefaultNicName(self, eAttachmentType):
+        """
+        Return the default network / interface name for the NIC attachment type.
+        """
+        sRetName = '';
+        if eAttachmentType == vboxcon.NetworkAttachmentType_Bridged:
+            if self.oTstDrv.sDefBridgedNic is not None:
+                sRetName = self.oTstDrv.sDefBridgedNic;
+            else:
+                sRetName = 'eth0';
+                try:
+                    aoHostNics = self.oVBoxMgr.getArray(self.oVBox.host, 'networkInterfaces');
+                    for oHostNic in aoHostNics:
+                        if   oHostNic.interfaceType == vboxcon.HostNetworkInterfaceType_Bridged \
+                         and oHostNic.status == vboxcon.HostNetworkInterfaceStatus_Up:
+                            sRetName = oHostNic.name;
+                            break;
+                except:
+                    reporter.errorXcpt();
+        elif eAttachmentType == vboxcon.NetworkAttachmentType_HostOnly:
+            try:
+                aoHostNics = self.oVBoxMgr.getArray(self.oVBox.host, 'networkInterfaces');
+                for oHostNic in aoHostNics:
+                    if oHostNic.interfaceType == vboxcon.HostNetworkInterfaceType_HostOnly:
+                        if oHostNic.status == vboxcon.HostNetworkInterfaceStatus_Up:
+                            sRetName = oHostNic.name;
+                            break;
+                        if sRetName == '':
+                            sRetName = oHostNic.name;
+            except:
+                reporter.errorXcpt();
+            if sRetName == '':
+                sRetName = 'HostInterfaceNetwork-vboxnet0';
+        elif eAttachmentType == vboxcon.NetworkAttachmentType_Internal:
+            sRetName = 'VBoxTest';
+        elif eAttachmentType == vboxcon.NetworkAttachmentType_NAT:
+            sRetName = '';
+        else:
+            reporter.error('eAttachmentType=%s is not known' % (eAttachmentType));
+        return sRetName;
+
+    def setNicAttachment(self, eAttachmentType, sName = None, iNic = 0):
+        """
+        Sets the attachment type of the specified NIC.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        try:
+            oNic = self.o.machine.getNetworkAdapter(iNic);
+        except:
+            reporter.errorXcpt('getNetworkAdapter(%s) failed for "%s"' % (iNic, self.sName));
+            return False;
+
+        try:
+            if eAttachmentType is not None:
+                try:
+                    if self.fpApiVer >= 4.1:
+                        oNic.attachmentType = eAttachmentType;
+                    else:
+                        if eAttachmentType == vboxcon.NetworkAttachmentType_NAT:
+                            oNic.attachToNAT();
+                        elif eAttachmentType == vboxcon.NetworkAttachmentType_Bridged:
+                            oNic.attachToBridgedInterface();
+                        elif eAttachmentType == vboxcon.NetworkAttachmentType_Internal:
+                            oNic.attachToInternalNetwork();
+                        elif eAttachmentType == vboxcon.NetworkAttachmentType_HostOnly:
+                            oNic.attachToHostOnlyInterface();
+                        else:
+                            raise base.GenError("eAttachmentType=%s is invalid" % (eAttachmentType));
+                except:
+                    reporter.errorXcpt('failed to set the attachment type on slot %s to %s for VM "%s"' \
+                        % (iNic, eAttachmentType, self.sName));
+                    return False;
+            else:
+                try:
+                    eAttachmentType = oNic.attachmentType;
+                except:
+                    reporter.errorXcpt('failed to get the attachment type on slot %s for VM "%s"' % (iNic, self.sName));
+                    return False;
+        finally:
+            self.oTstDrv.processPendingEvents();
+
+        if sName is not None:
+            # Resolve the special 'default' name.
+            if sName == 'default':
+                sName = self.getDefaultNicName(eAttachmentType);
+
+            # The name translate to different attributes depending on the
+            # attachment type.
+            try:
+                if eAttachmentType == vboxcon.NetworkAttachmentType_Bridged:
+                    ## @todo check this out on windows, may have to do a
+                    # translation of the name there or smth IIRC.
+                    try:
+                        if self.fpApiVer >= 4.1:
+                            oNic.bridgedInterface = sName;
+                        else:
+                            oNic.hostInterface = sName;
+                    except:
+                        reporter.errorXcpt('failed to set the hostInterface property on slot %s to "%s" for VM "%s"' \
+                            % (iNic, sName, self.sName));
+                        return False;
+                elif eAttachmentType == vboxcon.NetworkAttachmentType_HostOnly:
+                    try:
+                        if self.fpApiVer >= 4.1:
+                            oNic.hostOnlyInterface = sName;
+                        else:
+                            oNic.hostInterface = sName;
+                    except:
+                        reporter.errorXcpt('failed to set the internalNetwork property on slot %s to "%s" for VM "%s"' \
+                            % (iNic, sName, self.sName));
+                        return False;
+                elif eAttachmentType == vboxcon.NetworkAttachmentType_Internal:
+                    try:
+                        oNic.internalNetwork = sName;
+                    except:
+                        reporter.errorXcpt('failed to set the internalNetwork property on slot %s to "%s" for VM "%s"' \
+                            % (iNic, sName, self.sName));
+                        return False;
+                elif eAttachmentType == vboxcon.NetworkAttachmentType_NAT:
+                    try:
+                        oNic.NATNetwork = sName;
+                    except:
+                        reporter.errorXcpt('failed to set the NATNetwork property on slot %s to "%s" for VM "%s"' \
+                            % (iNic, sName, self.sName));
+                        return False;
+            finally:
+                self.oTstDrv.processPendingEvents();
+
+        if not self.setupNatForwardingForTxs(iNic):
+            return False;
+        reporter.log('set NIC type on slot %s to %s for VM "%s"' % (iNic, eAttachmentType, self.sName));
+        return True;
+
+    def setNicMacAddress(self, sMacAddr, iNic = 0):
+        """
+        Sets the MAC address of the specified NIC.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+
+        # Resolve missing MAC address prefix
+        cchMacAddr = len(sMacAddr) > 0;
+        if cchMacAddr > 0 and cchMacAddr < 12:
+            sHostName = '';
+            try:
+                sHostName = socket.getfqdn();
+                if sys.platform == 'win32' \
+                 and sHostName.endswith('.sun.com') \
+                 and not sHostName.endswith('.germany.sun.com'):
+                    sHostName = socket.gethostname(); # klugde.
+                abHostIP = socket.inet_aton(socket.gethostbyname(sHostName));
+            except:
+                reporter.errorXcpt('failed to determin the host IP for "%s".' % (sHostName,));
+                abHostIP = array.array('B', (0x80, 0x86, 0x00, 0x00)).tostring();
+            sDefaultMac = '%02X%02X%02X%02X%02X%02X' \
+                % (0x02, ord(abHostIP[0]), ord(abHostIP[1]), ord(abHostIP[2]), ord(abHostIP[3]), iNic);
+            sMacAddr = sDefaultMac[0:(11 - cchMacAddr)] + sMacAddr;
+
+        # Get the NIC object and try set it address.
+        try:
+            oNic = self.o.machine.getNetworkAdapter(iNic);
+        except:
+            reporter.errorXcpt('getNetworkAdapter(%s) failed for "%s"' % (iNic, self.sName));
+            return False;
+
+        try:
+            oNic.MACAddress = sMacAddr;
+        except:
+            reporter.errorXcpt('failed to set the MAC address on slot %s to "%s" for VM "%s"' \
+                % (iNic, sMacAddr, self.sName));
+            return False;
+
+        reporter.log('set MAC address on slot %s to %s for VM "%s"' % (iNic, sMacAddr, self.sName));
+        return True;
+
+    def setRamSize(self, cMB):
+        """
+        Set the RAM size of the VM.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            self.o.machine.memorySize = cMB;
+        except:
+            reporter.errorXcpt('failed to set the RAM size of "%s" to %s' % (self.sName, cMB));
+            fRc = False;
+        else:
+            reporter.log('set the RAM size of "%s" to %s' % (self.sName, cMB));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def setVRamSize(self, cMB):
+        """
+        Set the RAM size of the VM.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            self.o.machine.VRAMSize = cMB;
+        except:
+            reporter.errorXcpt('failed to set the VRAM size of "%s" to %s' % (self.sName, cMB));
+            fRc = False;
+        else:
+            reporter.log('set the VRAM size of "%s" to %s' % (self.sName, cMB));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def setCpuCount(self, cCpus):
+        """
+        Set the number of CPUs.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            self.o.machine.CPUCount = cCpus;
+        except:
+            reporter.errorXcpt('failed to set the CPU count of "%s" to %s' % (self.sName, cCpus));
+            fRc = False;
+        else:
+            reporter.log('set the CPU count of "%s" to %s' % (self.sName, cCpus));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def ensureControllerAttached(self, sController):
+        """
+        Makes sure the specified controller is attached to the VM, attaching it
+        if necessary.
+        """
+        try:
+            try:
+                self.o.machine.getStorageControllerByName(sController);
+            except:
+                iType = _ControllerNameToBus(sController);
+                try:
+                    self.o.machine.addStorageController(sController, iType);
+                    reporter.log('added storage controller "%s" (type %s) to %s' % (sController, iType, self.sName));
+                except:
+                    reporter.errorXcpt('addStorageController("%s",%s) failed on "%s"' % (sController, iType, self.sName) );
+                    return False;
+        finally:
+            self.oTstDrv.processPendingEvents();
+        return True;
+
+    def setStorageControllerPortCount(self, sController, iPortCount):
+        """
+        Set maximum ports count for storage controller
+        """
+        try:
+            oCtl = self.o.machine.getStorageControllerByName(sController)
+            oCtl.portCount = iPortCount
+            self.oTstDrv.processPendingEvents()
+            reporter.log('set controller "%s" port count to value %d' % (sController, iPortCount))
+            return True
+        except:
+            reporter.log('unable to set storage controller "%s" ports count to %d' % (sController, iPortCount))
+
+        return False
+
+    def setBootOrder(self, iPosition, eType):
+        """
+        Set guest boot order type
+        @param iPosition    boot order position
+        @param eType        device type (vboxcon.DeviceType_HardDisk,
+                            vboxcon.DeviceType_DVD, vboxcon.DeviceType_Floppy)
+        """
+        try:
+            self.o.machine.setBootOrder(iPosition, eType)
+        except:
+            return reporter.errorXcpt('Unable to set boot order.')
+
+        reporter.log('Set boot order [%d] for device %s' % (iPosition, str(eType)))
+        self.oTstDrv.processPendingEvents();
+
+        return True
+
+    def setStorageControllerType(self, eType, sController = "IDE Controller"):
+        """
+        Similar to ensureControllerAttached, except it will change the type.
+        """
+        try:
+            oCtl = self.o.machine.getStorageControllerByName(sController);
+        except:
+            iType = _ControllerNameToBus(sController);
+            try:
+                oCtl = self.o.machine.addStorageController(sController, iType);
+                reporter.log('added storage controller "%s" (type %s) to %s' % (sController, iType, self.sName));
+            except:
+                reporter.errorXcpt('addStorageController("%s",%s) failed on "%s"' % (sController, iType, self.sName) );
+                return False;
+        try:
+            oCtl.controllerType = eType;
+        except:
+            reporter.errorXcpt('failed to set controller type of "%s" on "%s" to %s' % (sController, self.sName, eType) );
+            return False;
+        reporter.log('set controller type of "%s" on "%s" to %s' % (sController, self.sName, eType) );
+        self.oTstDrv.processPendingEvents();
+        return True;
+
+    def attachDvd(self, sImage = None, sController = "IDE Controller", iPort = 1, iDevice = 0):
+        """
+        Attaches a DVD drive to a VM, optionally with an ISO inserted.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        # Input validation.
+        if sImage is not None and not self.oTstDrv.isResourceFile(sImage)\
+            and not os.path.isabs(sImage): ## fixme - testsuite unzip ++
+            reporter.fatal('"%s" is not in the resource set' % (sImage));
+            return None;
+
+        if not self.ensureControllerAttached(sController):
+            return False;
+
+        # Find/register the image if specified.
+        oImage = None;
+        sImageUuid = "";
+        if sImage is not None:
+            sFullName = self.oTstDrv.getFullResourceName(sImage)
+            try:
+                oImage = self.oVBox.findDVDImage(sFullName);
+            except:
+                try:
+                    if self.fpApiVer >= 4.1:
+                        oImage = self.oVBox.openMedium(sFullName, vboxcon.DeviceType_DVD, vboxcon.AccessMode_ReadOnly, False);
+                    elif self.fpApiVer >= 4.0:
+                        oImage = self.oVBox.openMedium(sFullName, vboxcon.DeviceType_DVD, vboxcon.AccessMode_ReadOnly);
+                    else:
+                        oImage = self.oVBox.openDVDImage(sFullName, "");
+                except vbox.ComException, oXcpt:
+                    if oXcpt.errno != -1:
+                        reporter.errorXcpt('failed to open DVD image "%s" xxx' % (sFullName));
+                    else:
+                        reporter.errorXcpt('failed to open DVD image "%s" yyy' % (sFullName));
+                    return False;
+                except:
+                    reporter.errorXcpt('failed to open DVD image "%s"' % (sFullName));
+                    return False;
+            try:
+                sImageUuid = oImage.id;
+            except:
+                reporter.errorXcpt('failed to get the UUID of "%s"' % (sFullName));
+                return False;
+
+        # Attach the DVD.
+        fRc = True;
+        try:
+            if self.fpApiVer >= 4.0:
+                self.o.machine.attachDevice(sController, iPort, iDevice, vboxcon.DeviceType_DVD, oImage);
+            else:
+                self.o.machine.attachDevice(sController, iPort, iDevice, vboxcon.DeviceType_DVD, sImageUuid);
+        except:
+            reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
+                               % (sController, iPort, iDevice, sImageUuid, self.sName) );
+            fRc = False;
+        else:
+            reporter.log('attached DVD to %s, image="%s"' % (self.sName, sImage));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def attachHd(self, sHd, sController = "IDE Controller", iPort = 0, iDevice = 0, fImmutable = True, fForceResource = True):
+        """
+        Attaches a HD to a VM.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        # Input validation.
+        if fForceResource and not self.oTstDrv.isResourceFile(sHd):
+            reporter.fatal('"%s" is not in the resource set' % (sHd,));
+            return None;
+
+        if not self.ensureControllerAttached(sController):
+            return False;
+
+        # Find the HD, registering it if necessary (as immutable).
+        if fForceResource:
+            sFullName = self.oTstDrv.getFullResourceName(sHd);
+        else:
+            sFullName = sHd;
+        try:
+            oHd = self.oVBox.findHardDisk(sFullName);
+        except:
+            try:
+                if self.fpApiVer >= 4.1:
+                    oHd = self.oVBox.openMedium(sFullName, vboxcon.DeviceType_HardDisk, vboxcon.AccessMode_ReadOnly, False);
+                elif self.fpApiVer >= 4.0:
+                    oHd = self.oVBox.openMedium(sFullName, vboxcon.DeviceType_HardDisk, vboxcon.AccessMode_ReadOnly);
+                else:
+                    oHd = self.oVBox.openHardDisk(sFullName, vboxcon.AccessMode_ReadOnly, False, "", False, "");
+            except:
+                reporter.errorXcpt('failed to open hd "%s"' % (sFullName));
+                return False;
+        try:
+            if fImmutable:
+                oHd.type = vboxcon.MediumType_Immutable;
+            else:
+                oHd.type = vboxcon.MediumType_Normal;
+        except:
+            if fImmutable:
+                reporter.errorXcpt('failed to set hd "%s" immutable' % (sHd));
+            else:
+                reporter.errorXcpt('failed to set hd "%s" normal' % (sHd));
+            return False;
+
+        # Attach it.
+        fRc = True;
+        try:
+            if self.fpApiVer >= 4.0:
+                self.o.machine.attachDevice(sController, iPort, iDevice, vboxcon.DeviceType_HardDisk, oHd);
+            else:
+                self.o.machine.attachDevice(sController, iPort, iDevice, vboxcon.DeviceType_HardDisk, oHd.id);
+        except:
+            reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
+                               % (sController, iPort, iDevice, oHd.id, self.sName) );
+            fRc = False;
+        else:
+            reporter.log('attached "%s" to %s' % (sHd, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def createBaseHd(self, sHd, sFmt = "VDI", cb = 10*1024*1024*1024):
+        """
+        Creates a base HD.
+        Returns Medium object on success and None on failure.  Error information is logged.
+        """
+        try:
+            if self.fpApiVer >= 5.0:
+                oHd = self.oVBox.createMedium(sFmt, sHd, vboxcon.AccessMode_ReadWrite, vboxcon.DeviceType_HardDisk);
+            else:
+                oHd = self.oVBox.createHardDisk(sFmt, sHd);
+            oProgressXpcom = oHd.createBaseStorage(cb, (vboxcon.MediumVariant_Standard, ))
+            oProgress = ProgressWrapper(oProgressXpcom, self.oVBoxMgr, self.oTstDrv, 'create base disk %s' % (sHd));
+            oProgress.wait();
+            oProgress.logResult();
+        except:
+            reporter.errorXcpt('failed to create base hd "%s"' % (sHd));
+            oHd = None
+
+        return oHd;
+
+    def createDiffHd(self, oParentHd, sHd, sFmt = "VDI"):
+        """
+        Creates a differencing HD.
+        Returns Medium object on success and None on failure.  Error information is logged.
+        """
+        try:
+            if self.fpApiVer >= 5.0:
+                oHd = self.oVBox.createMedium(sFmt, sHd, vboxcon.AccessMode_ReadWrite, vboxcon.DeviceType_HardDisk);
+            else:
+                oHd = self.oVBox.createHardDisk(sFmt, sHd);
+            oProgressXpcom = oParentHd.createDiffStorage(oHd, (vboxcon.MediumVariant_Standard, ))
+            oProgress = ProgressWrapper(oProgressXpcom, self.oVBoxMgr, self.oTstDrv, 'create diff disk %s' % (sHd));
+            oProgress.wait();
+            oProgress.logResult();
+        except:
+            reporter.errorXcpt('failed to create diff hd "%s"' % (sHd));
+            oHd = None
+
+        return oHd;
+
+    def createAndAttachHd(self, sHd, sFmt = "VDI", sController = "IDE Controller", cb = 10*1024*1024*1024, \
+                          iPort = 0, iDevice = 0, fImmutable = True):
+        """
+        Creates and attaches a HD to a VM.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        if not self.ensureControllerAttached(sController):
+            return False;
+
+        oHd = self.createBaseHd(sHd, sFmt, cb)
+        if oHd is None:
+            return False;
+
+        fRc = True;
+        try:
+            if fImmutable:
+                oHd.type = vboxcon.MediumType_Immutable;
+            else:
+                oHd.type = vboxcon.MediumType_Normal;
+        except:
+            if fImmutable:
+                reporter.errorXcpt('failed to set hd "%s" immutable' % (sHd));
+            else:
+                reporter.errorXcpt('failed to set hd "%s" normal' % (sHd));
+            fRc = False;
+
+        # Attach it.
+        if fRc is True:
+            try:
+                if self.fpApiVer >= 4.0:
+                    self.o.machine.attachDevice(sController, iPort, iDevice, vboxcon.DeviceType_HardDisk, oHd);
+                else:
+                    self.o.machine.attachDevice(sController, iPort, iDevice, vboxcon.DeviceType_HardDisk, oHd.id);
+            except:
+                reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
+                                   % (sController, iPort, iDevice, oHd.id, self.sName) );
+                fRc = False;
+            else:
+                reporter.log('attached "%s" to %s' % (sHd, self.sName));
+
+        # Delete disk in case of an error
+        if fRc is False:
+            try:
+                oProgressCom = oHd.deleteStorage();
+            except:
+                reporter.errorXcpt('deleteStorage() for disk %s failed' % (sHd,));
+            else:
+                oProgress = ProgressWrapper(oProgressCom, self.oVBoxMgr, self.oTstDrv, 'delete disk %s' % (sHd));
+                oProgress.wait();
+                oProgress.logResult();
+
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def detachHd(self, sController = "IDE Controller", iPort = 0, iDevice = 0):
+        """
+        Detaches a HD, if attached, and returns a reference to it (IMedium).
+
+        In order to delete the detached medium, the caller must first save
+        the changes made in this session.
+
+        Returns (fRc, oHd), where oHd is None unless fRc is True, and fRc is
+        your standard success indicator.  Error information is logged.
+        """
+
+        # What's attached?
+        try:
+            oHd = self.o.machine.getMedium(sController, iPort, iDevice);
+        except:
+            if    self.oVBoxMgr.xcptIsOurXcptKind() \
+              and self.oVBoxMgr.xcptIsEqual(None, self.oVBoxMgr.constants.VBOX_E_OBJECT_NOT_FOUND):
+                reporter.log('No HD attached (to %s %s:%s)' % (sController, iPort, iDevice));
+                return (True, None);
+            return (reporter.errorXcpt('Error getting media at port %s, device %s, on %s.'
+                                       % (iPort, iDevice, sController)), None);
+        # Detach it.
+        try:
+            self.o.machine.detachDevice(sController, iPort, iDevice);
+        except:
+            return (reporter.errorXcpt('detachDevice("%s",%s,%s) failed on "%s"' \
+                                       % (sController, iPort, iDevice, self.sName) ), None);
+        reporter.log('detached HD ("%s",%s,%s) from %s' % (sController, iPort, iDevice, self.sName));
+        return (True, oHd);
+
+    def attachFloppy(self, sFloppy, sController = "Floppy Controller", iPort = 0, iDevice = 0):
+        """
+        Attaches a floppy image to a VM.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        # Input validation.
+        ## @todo Fix this wrt to bootsector-xxx.img from the validationkit.zip.
+        ##if not self.oTstDrv.isResourceFile(sFloppy):
+        ##    reporter.fatal('"%s" is not in the resource set' % (sFloppy));
+        ##     return None;
+
+        if not self.ensureControllerAttached(sController):
+            return False;
+
+        # Find the floppy image, registering it if necessary (as immutable).
+        sFullName = self.oTstDrv.getFullResourceName(sFloppy);
+        try:
+            oFloppy = self.oVBox.findFloppyImage(sFullName);
+        except:
+            try:
+                if self.fpApiVer >= 4.1:
+                    oFloppy = self.oVBox.openMedium(sFullName, vboxcon.DeviceType_Floppy, vboxcon.AccessMode_ReadOnly, False);
+                elif self.fpApiVer >= 4.0:
+                    oFloppy = self.oVBox.openMedium(sFullName, vboxcon.DeviceType_Floppy, vboxcon.AccessMode_ReadOnly);
+                else:
+                    oFloppy = self.oVBox.openFloppyImage(sFullName, "");
+            except:
+                reporter.errorXcpt('failed to open floppy "%s"' % (sFullName));
+                return False;
+        ## @todo the following works but causes trouble below (asserts in main).
+        #try:
+        #    oFloppy.type = vboxcon.MediumType_Immutable;
+        #except:
+        #    reporter.errorXcpt('failed to make floppy "%s" immutable' % (sFullName));
+        #    return False;
+
+        # Attach it.
+        fRc = True;
+        try:
+            if self.fpApiVer >= 4.0:
+                self.o.machine.attachDevice(sController, iPort, iDevice, vboxcon.DeviceType_Floppy, oFloppy);
+            else:
+                self.o.machine.attachDevice(sController, iPort, iDevice, vboxcon.DeviceType_Floppy, oFloppy.id);
+        except:
+            reporter.errorXcpt('attachDevice("%s",%s,%s,Floppy,"%s") failed on "%s"' \
+                               % (sController, iPort, iDevice, oFloppy.id, self.sName) );
+            fRc = False;
+        else:
+            reporter.log('attached "%s" to %s' % (sFloppy, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    def setupNic(self, sType, sXXX):
+        """
+        Attaches a HD to a VM.
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        if sType == "PCNet":        enmType = vboxcon.NetworkAdapterType_Am79C973;
+        elif sType == "PCNetOld":   enmType = vboxcon.NetworkAdapterType_Am79C970A;
+        elif sType == "E1000":      enmType = vboxcon.NetworkAdapterType_I82545EM; # MT Server
+        elif sType == "E1000Desk":  enmType = vboxcon.NetworkAdapterType_I82540EM; # MT Desktop
+        elif sType == "E1000Srv2":  enmType = vboxcon.NetworkAdapterType_I82543GC; # T Server
+        elif sType == "Virtio":     enmType = vboxcon.NetworkAdapterType_Virtio;
+        else:
+            reporter.error('Invalid NIC type: "%s" (sXXX=%s)' % (sType, sXXX));
+            return False;
+        ## @todo Implement me!
+        if enmType is not None: pass
+        return True;
+
+    def setupPreferredConfig(self):                                             # pylint: disable=R0914
+        """
+        Configures the VM according to the preferences of the guest type.
+        """
+        try:
+            sOsTypeId = self.o.machine.OSTypeId;
+        except:
+            reporter.errorXcpt('failed to obtain the OSTypeId for "%s"' % (self.sName));
+            return False;
+
+        try:
+            oOsType = self.oVBox.getGuestOSType(sOsTypeId);
+        except:
+            reporter.errorXcpt('getGuestOSType("%s") failed for "%s"' % (sOsTypeId, self.sName));
+            return False;
+
+        # get the attributes.
+        try:
+            #sFamilyId       = oOsType.familyId;
+            #f64Bit          = oOsType.is64Bit;
+            fIoApic         = oOsType.recommendedIOAPIC;
+            fVirtEx         = oOsType.recommendedVirtEx;
+            cMBRam          = oOsType.recommendedRAM;
+            cMBVRam         = oOsType.recommendedVRAM;
+            #cMBHdd          = oOsType.recommendedHDD;
+            eNicType        = oOsType.adapterType;
+            if self.fpApiVer >= 3.2:
+                if self.fpApiVer >= 4.2:
+                    fPae            = oOsType.recommendedPAE;
+                    fUsbHid         = oOsType.recommendedUSBHID;
+                    fHpet           = oOsType.recommendedHPET;
+                    eStorCtlType    = oOsType.recommendedHDStorageController;
+                else:
+                    fPae            = oOsType.recommendedPae;
+                    fUsbHid         = oOsType.recommendedUsbHid;
+                    fHpet           = oOsType.recommendedHpet;
+                    eStorCtlType    = oOsType.recommendedHdStorageController;
+                eFirmwareType   = oOsType.recommendedFirmware;
+            else:
+                fPae            = False;
+                fUsbHid         = False;
+                fHpet           = False;
+                eFirmwareType   = -1;
+                eStorCtlType    = vboxcon.StorageControllerType_PIIX4;
+        except:
+            reporter.errorXcpt('exception reading IGuestOSType(%s) attribute' % (sOsTypeId));
+            self.oTstDrv.processPendingEvents();
+            return False;
+        self.oTstDrv.processPendingEvents();
+
+        # Do the setting. Continue applying settings on error in case the
+        # caller ignores the return code
+        fRc = True;
+        if not self.enableIoApic(fIoApic):              fRc = False;
+        if not self.enableVirtEx(fVirtEx):              fRc = False;
+        if not self.enablePae(fPae):                    fRc = False;
+        if not self.setRamSize(cMBRam):                 fRc = False;
+        if not self.setVRamSize(cMBVRam):               fRc = False;
+        if not self.setNicType(eNicType, 0):            fRc = False;
+        if self.fpApiVer >= 3.2:
+            if not self.setFirmwareType(eFirmwareType): fRc = False;
+            if not self.enableUsbHid(fUsbHid):          fRc = False;
+            if not self.enableHpet(fHpet):              fRc = False;
+        if  eStorCtlType == vboxcon.StorageControllerType_PIIX3 \
+         or eStorCtlType == vboxcon.StorageControllerType_PIIX4 \
+         or eStorCtlType == vboxcon.StorageControllerType_ICH6:
+            if not self.setStorageControllerType(eStorCtlType, "IDE Controller"):
+                fRc = False;
+
+        return fRc;
+
+    def addUsbDeviceFilter(self, sName, sVendorId, sProductId):
+        """
+        Creates a USB device filter and inserts it into the VM.
+        Returns True on success.
+        Returns False on failure (logged).
+        """
+        fRc = True;
+
+        try:
+            usbDevFilter = self.o.machine.USBDeviceFilters.createDeviceFilter(sName);
+            usbDevFilter.active = True;
+            usbDevFilter.vendorId = sVendorId;
+            usbDevFilter.productId = sProductId;
+            try:
+                self.o.machine.USBDeviceFilters.insertDeviceFilter(0, usbDevFilter);
+            except:
+                reporter.errorXcpt('insertDeviceFilter(%s) failed on "%s"' \
+                                   % (0, self.sName) );
+                fRc = False;
+            else:
+                reporter.log('inserted USB device filter "%s" to %s' % (sName, self.sName));
+        except:
+            reporter.errorXcpt('createDeviceFilter("%s") failed on "%s"' \
+                               % (sName, self.sName) );
+            fRc = False;
+        return fRc;
+
+    def getGuestPropertyValue(self, sName):
+        """
+        Gets a guest property value.
+        Returns the value on success, None on failure (logged).
+        """
+        try:
+            sValue = self.o.machine.getGuestPropertyValue(sName);
+        except:
+            reporter.errorXcpt('IMachine::getGuestPropertyValue("%s") failed' % (sName));
+            return None;
+        return sValue;
+
+    def setGuestPropertyValue(self, sName, sValue):
+        """
+        Sets a guest property value.
+        Returns the True on success, False on failure (logged).
+        """
+        try:
+            self.o.machine.setGuestPropertyValue(sName, sValue);
+        except:
+            reporter.errorXcpt('IMachine::setGuestPropertyValue("%s","%s") failed' % (sName, sValue));
+            return False;
+        return True;
+
+    def delGuestPropertyValue(self, sName):
+        """
+        Deletes a guest property value.
+        Returns the True on success, False on failure (logged).
+        """
+        try:
+            oMachine = self.o.machine;
+            if self.fpApiVer >= 4.2:
+                oMachine.deleteGuestProperty(sName);
+            else:
+                oMachine.setGuestPropertyValue(sName, '');
+        except:
+            reporter.errorXcpt('Unable to delete guest property "%s"' % (sName,));
+            return False;
+        return True;
+
+    def setExtraData(self, sKey, sValue):
+        """
+        Sets extra data.
+        Returns the True on success, False on failure (logged).
+        """
+        try:
+            self.o.machine.setExtraData(sKey, sValue);
+        except:
+            reporter.errorXcpt('IMachine::setExtraData("%s","%s") failed' % (sKey, sValue));
+            return False;
+        return True;
+
+    def getExtraData(self, sKey):
+        """
+        Gets extra data.
+        Returns value on success, None on failure.
+        """
+        try:
+            sValue = self.o.machine.getExtraData(sKey)
+        except:
+            reporter.errorXcpt('IMachine::setExtraData("%s","%s") failed' % (sKey, sValue))
+            return None
+        return sValue
+
+    def setupTeleporter(self, fEnabled=True, uPort = 6500, sAddress = '', sPassword = ''):
+        """
+        Sets up the teleporter for the VM.
+        Returns True on success, False on failure (logged).
+        """
+        try:
+            self.o.machine.teleporterAddress  = sAddress;
+            self.o.machine.teleporterPort     = uPort;
+            self.o.machine.teleporterPassword = sPassword;
+            self.o.machine.teleporterEnabled  = fEnabled;
+        except:
+            reporter.errorXcpt('setupTeleporter(%s, %s, %s, %s)' % (fEnabled, sPassword, uPort, sAddress));
+            return False;
+        return True;
+
+    def enableTeleporter(self, fEnable=True):
+        """
+        Enables or disables the teleporter of the VM.
+        Returns True on success, False on failure (logged).
+        """
+        try:
+            self.o.machine.teleporterEnabled = fEnable;
+        except:
+            reporter.errorXcpt('IMachine::teleporterEnabled=%s failed' % (fEnable));
+            return False;
+        return True;
+
+    def teleport(self, sHostname = 'localhost', uPort = 6500, sPassword = 'password', cMsMaxDowntime = 250):
+        """
+        Wrapper around the IConsole::teleport() method.
+        Returns a progress object on success, None on failure (logged).
+        """
+        reporter.log2('"%s"::teleport(%s,%s,%s,%s)...' % (self.sName, sHostname, uPort, sPassword, cMsMaxDowntime));
+        try:
+            oProgress = self.o.console.teleport(sHostname, uPort, sPassword, cMsMaxDowntime)
+        except:
+            reporter.errorXcpt('IConsole::teleport(%s,%s,%s,%s) failed' % (sHostname, uPort, sPassword, cMsMaxDowntime));
+            return None;
+        return ProgressWrapper(oProgress, self.oVBoxMgr, self.oTstDrv, 'teleport %s' % (self.sName,));
+
+    def getOsType(self):
+        """
+        Gets the IGuestOSType interface for the machine.
+
+        return IGuestOSType interface on success, None + errorXcpt on failure.
+        No exceptions raised.
+        """
+        try:
+            sOsTypeId = self.o.machine.OSTypeId;
+        except:
+            reporter.errorXcpt('failed to obtain the OSTypeId for "%s"' % (self.sName));
+            return None;
+
+        try:
+            oOsType = self.oVBox.getGuestOSType(sOsTypeId);
+        except:
+            reporter.errorXcpt('getGuestOSType("%s") failed for "%s"' % (sOsTypeId, self.sName));
+            return None;
+
+        return oOsType;
+
+    def setOsType(self, sNewTypeId):
+        """
+        Changes the OS type.
+
+        returns True on success, False + errorXcpt on failure.
+        No exceptions raised.
+        """
+        try:
+            self.o.machine.OSTypeId = sNewTypeId;
+        except:
+            reporter.errorXcpt('failed to set the OSTypeId for "%s" to "%s"' % (self.sName, sNewTypeId));
+            return False;
+        return True;
+
+
+    def setParavirtProvider(self, iProvider):
+        """
+        Sets a paravirtualisation provider.
+        Returns the True on success, False on failure (logged).
+        """
+        try:
+            self.o.machine.paravirtProvider = iProvider
+        except:
+            reporter.errorXcpt('Unable to set paravirtualisation provider "%s"' % (iProvider,))
+            return False;
+        return True;
+
+
+
+    #
+    # IConsole wrappers.
+    #
+
+    def powerOff(self, fFudgeOnFailure = True):
+        """
+        Powers off the VM.
+
+        Returns True on success.
+        Returns False on IConsole::powerDown() failure.
+        Returns None if the progress object returns failure.
+        """
+        try:
+            oProgress = self.o.console.powerDown();
+        except:
+            reporter.logXcpt('IConsole::powerDown failed on %s' % (self.sName));
+            if fFudgeOnFailure:
+                self.oTstDrv.waitOnDirectSessionClose(self.oVM, 5000); # fudge
+                self.waitForTask(1000);                                # fudge
+            return False;
+
+        rc = self.oTstDrv.waitOnProgress(oProgress);
+        if rc < 0:
+            self.close();
+            if fFudgeOnFailure:
+                vbox.reportError(oProgress, 'powerDown for "%s" failed' % (self.sName));
+                self.oTstDrv.waitOnDirectSessionClose(self.oVM, 5000); # fudge
+            return None;
+
+        # Wait for the VM to really power off or we'll fail to open a new session to it.
+        self.oTstDrv.waitOnDirectSessionClose(self.oVM, 5000);         # fudge
+        return self.waitForTask(30 * 1000);                            # fudge
+
+    def restoreSnapshot(self, oSnapshot, fFudgeOnFailure = True):
+        """
+        Restores the given snapshot.
+
+        Returns True on success.
+        Returns False on IMachine::restoreSnapshot() failure.
+        Returns None if the progress object returns failure.
+        """
+        try:
+            if self.fpApiVer >= 5.0:
+                oProgress = self.o.machine.restoreSnapshot(oSnapshot);
+            else:
+                oProgress = self.o.console.restoreSnapshot(oSnapshot);
+        except:
+            reporter.logXcpt('IMachine::restoreSnapshot failed on %s' % (self.sName));
+            if fFudgeOnFailure:
+                self.oTstDrv.waitOnDirectSessionClose(self.oVM, 5000); # fudge
+                self.waitForTask(1000);                                # fudge
+            return False;
+
+        rc = self.oTstDrv.waitOnProgress(oProgress);
+        if rc < 0:
+            self.close();
+            if fFudgeOnFailure:
+                vbox.reportError(oProgress, 'restoreSnapshot for "%s" failed' % (self.sName));
+            return None;
+
+        return self.waitForTask(30 * 1000);
+
+    def deleteSnapshot(self, oSnapshot, fFudgeOnFailure = True, cMsTimeout = 30 * 1000):
+        """
+        Deletes the given snapshot merging the diff image into the base.
+
+        Returns True on success.
+        Returns False on IMachine::deleteSnapshot() failure.
+        """
+        try:
+            if self.fpApiVer >= 5.0:
+                oProgressCom = self.o.machine.deleteSnapshot(oSnapshot);
+            else:
+                oProgressCom = self.o.console.deleteSnapshot(oSnapshot);
+            oProgress = ProgressWrapper(oProgressCom, self.oVBoxMgr, self.oTstDrv, 'Delete Snapshot %s' % (oSnapshot));
+            oProgress.wait(cMsTimeout);
+            oProgress.logResult();
+        except:
+            reporter.logXcpt('IMachine::deleteSnapshot failed on %s' % (self.sName));
+            if fFudgeOnFailure:
+                self.oTstDrv.waitOnDirectSessionClose(self.oVM, 5000); # fudge
+                self.waitForTask(1000);                                # fudge
+            return False;
+
+        return True;
+
+    def takeSnapshot(self, sName, sDescription = '', fPause = True, fFudgeOnFailure = True, cMsTimeout = 30 * 1000):
+        """
+        Takes a snapshot with the given name
+
+        Returns True on success.
+        Returns False on IMachine::takeSnapshot() or VM state change failure.
+        """
+        try:
+            if     fPause is True \
+               and self.oVM.state is vboxcon.MachineState_Running:
+                self.o.console.pause();
+            if self.fpApiVer >= 5.0:
+                oProgressCom = self.o.machine.takeSnapshot(sName, sDescription, True);
+            else:
+                oProgressCom = self.o.console.takeSnapshot(sName, sDescription);
+            oProgress = ProgressWrapper(oProgressCom, self.oVBoxMgr, self.oTstDrv, 'Take Snapshot %s' % (sName));
+            oProgress.wait(cMsTimeout);
+            oProgress.logResult();
+        except:
+            reporter.logXcpt('IMachine::takeSnapshot failed on %s' % (self.sName));
+            if fFudgeOnFailure:
+                self.oTstDrv.waitOnDirectSessionClose(self.oVM, 5000); # fudge
+                self.waitForTask(1000);                                # fudge
+            return False;
+
+        if     fPause is True \
+           and self.oVM.state is vboxcon.MachineState_Paused:
+            self.o.console.resume();
+
+        return True;
+
+    def findSnapshot(self, sName):
+        """
+        Returns the snapshot object with the given name
+
+        Returns snapshot object on success.
+        Returns None if there is no snapshot with the given name.
+        """
+        return self.oVM.findSnapshot(sName);
+
+    def takeScreenshot(self, sFilename, iScreenId=0):
+        """
+        Take screenshot from the given display and save it to specified file.
+
+        Returns True on success
+        Returns False on failure.
+        """
+        try:
+            if self.fpApiVer >= 5.0:
+                iWidth, iHeight, _, _, _, _ = self.o.console.display.getScreenResolution(iScreenId)
+                aPngData = self.o.console.display.takeScreenShotToArray(iScreenId, iWidth, iHeight,
+                                                                        vboxcon.BitmapFormat_PNG)
+            else:
+                iWidth, iHeight, _, _, _ = self.o.console.display.getScreenResolution(iScreenId)
+                aPngData = self.o.console.display.takeScreenShotPNGToArray(iScreenId, iWidth, iHeight)
+        except:
+            reporter.logXcpt("Unable to take screenshot")
+            return False
+
+        oFile = open(sFilename, 'wb')
+        oFile.write(aPngData)
+        oFile.close()
+
+        return True
+
+    #
+    # Other methods.
+    #
+
+    def getPrimaryIp(self):
+        """
+        Tries to obtain the primary IP address of the guest via the guest
+        properties.
+
+        Returns IP address on success.
+        Returns empty string on failure.
+        """
+        sIpAddr = self.getGuestPropertyValue('/VirtualBox/GuestInfo/Net/0/V4/IP');
+        if vbox.isIpAddrValid(sIpAddr):
+            return sIpAddr;
+        return '';
+
+    def getPid(self):
+        """
+        Gets the process ID for the direct session unless it's ourselves.
+        """
+        if self.uPid is None and self.o is not None and self.fRemoteSession:
+            try:
+                if self.fpApiVer >= 4.2:
+                    uPid = self.o.machine.sessionPID;
+                else:
+                    uPid = self.o.machine.sessionPid;
+                if uPid != os.getpid() and uPid != 0xffffffff:
+                    self.uPid = uPid;
+            except Exception, oXcpt:
+                if vbox.ComError.equal(oXcpt, vbox.ComError.E_UNEXPECTED):
+                    try:
+                        if self.fpApiVer >= 4.2:
+                            uPid = self.oVM.sessionPID;
+                        else:
+                            uPid = self.oVM.sessionPid;
+                        if uPid != os.getpid() and uPid != 0xffffffff:
+                            self.uPid = uPid;
+                    except:
+                        reporter.log2Xcpt();
+                else:
+                    reporter.log2Xcpt();
+            if self.uPid is not None:
+                reporter.log2('getPid: %u' % (self.uPid,));
+                self.oTstDrv.pidFileAdd(self.uPid);
+        return self.uPid;
+
+    def addLogsToReport(self, cReleaseLogs = 1):
+        """
+        Retrieves and adds the release and debug logs to the test report.
+        """
+        fRc = True;
+
+        # Add each of the requested release logs to the report.
+        for iLog in range(0, cReleaseLogs):
+            try:
+                if self.fpApiVer >= 3.2:
+                    sLogFile = self.oVM.queryLogFilename(iLog);
+                elif iLog > 0:
+                    sLogFile = '%s/VBox.log' % (self.oVM.logFolder,);
+                else:
+                    sLogFile = '%s/VBox.log.%u' % (self.oVM.logFolder, iLog);
+            except:
+                reporter.logXcpt('iLog=%s' % (iLog,));
+                fRc = False;
+            else:
+                if sLogFile is not None and sLogFile != '': # the None bit is for a 3.2.0 bug.
+                    reporter.addLogFile(sLogFile, 'log/release/vm', '%s #%u' % (self.sName, iLog),
+                                        sAltName = '%s-%s' % (self.sName, os.path.basename(sLogFile),));
+
+        # Now for the hardened windows startup log.
+        try:
+            sLogFile = os.path.join(self.oVM.logFolder, 'VBoxStartup.log');
+        except:
+            reporter.logXcpt();
+            fRc = False;
+        else:
+            if os.path.isfile(sLogFile):
+                reporter.addLogFile(sLogFile, 'log/release/vm', '%s startup log' % (self.sName, ),
+                                    sAltName = '%s-%s' % (self.sName, os.path.basename(sLogFile),));
+
+        # Now for the debug log.
+        if self.sLogFile is not None and os.path.isfile(self.sLogFile):
+            reporter.addLogFile(self.sLogFile, 'log/debug/vm', '%s debug' % (self.sName, ),
+                                sAltName = '%s-%s' % (self.sName, os.path.basename(self.sLogFile),));
+
+        return fRc;
+
+    def registerDerivedEventHandler(self, oSubClass, dArgs = None, fMustSucceed = True):
+        """
+        Create an instance of the given ConsoleEventHandlerBase sub-class and
+        register it.
+
+        The new instance is returned on success.  None is returned on error.
+        """
+
+        # We need a console object.
+        try:
+            oConsole = self.o.console;
+        except Exception, oXcpt:
+            if fMustSucceed or vbox.ComError.notEqual(oXcpt, vbox.ComError.E_UNEXPECTED):
+                reporter.errorXcpt('Failed to get ISession::console for "%s"' % (self.sName, ));
+            return None;
+
+        # Add the base class arguments.
+        dArgsCopy = dArgs.copy() if dArgs is not None else dict();
+        dArgsCopy['oSession'] = self;
+        dArgsCopy['oConsole'] = oConsole;
+        sLogSuffix = 'on %s' % (self.sName,)
+        return oSubClass.registerDerivedEventHandler(self.oVBoxMgr, self.fpApiVer, oSubClass, dArgsCopy,
+                                                     oConsole, 'IConsole', 'IConsoleCallback',
+                                                     fMustSucceed = fMustSucceed, sLogSuffix = sLogSuffix);
+
+    def enableVmmDevTestingPart(self, fEnabled, fEnableMMIO = False):
+        """
+        Enables the testing part of the VMMDev.
+
+        Returns True on success and False on failure.  Error information is logged.
+        """
+        fRc = True;
+        try:
+            self.o.machine.setExtraData('VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled',
+                                        '1' if fEnabled else '');
+            self.o.machine.setExtraData('VBoxInternal/Devices/VMMDev/0/Config/TestingMMIO',
+                                        '1' if fEnableMMIO and fEnabled else '');
+        except:
+            reporter.errorXcpt('VM name "%s", fEnabled=%s' % (self.sName, fEnabled));
+            fRc = False;
+        else:
+            reporter.log('set VMMDevTesting=%s for "%s"' % (fEnabled, self.sName));
+        self.oTstDrv.processPendingEvents();
+        return fRc;
+
+    #
+    # Test eXecution Service methods.
+    #
+
+    def txsConnectViaTcp(self, cMsTimeout = 10*60000, sIpAddr = None, sMacAddr = None, fNatForwardingForTxs = False):
+        """
+        Connects to the TXS using TCP/IP as transport.  If no IP or MAC is
+        addresses are specified, we'll get the IP from the guest additions.
+
+        Returns a TxsConnectTask object on success, None + log on failure.
+        """
+        # If the VM is configured with a NAT interface, connect to local host.
+        fReversedSetup = False;
+        fUseNatForTxs  = False;
+        if sIpAddr == None:
+            try:
+                oNic = self.oVM.getNetworkAdapter(0);
+                if oNic.attachmentType == vboxcon.NetworkAttachmentType_NAT:
+                    fUseNatForTxs = True;
+            except:
+                reporter.errorXcpt();
+                return None;
+        if fUseNatForTxs:
+            fReversedSetup = not fNatForwardingForTxs;
+            sIpAddr = '127.0.0.1';
+
+        # Kick off the task.
+        try:
+            oTask = TxsConnectTask(self, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup);
+        except:
+            reporter.errorXcpt();
+            oTask = None;
+        return oTask;
+
+    def txsTryConnectViaTcp(self, cMsTimeout, sHostname, fReversed = False):
+        """
+        Attempts to connect to a TXS instance.
+
+        Returns True if a connection was established, False if not (only grave
+        failures are logged as errors).
+
+        Note!   The timeout is more of a guideline...
+        """
+
+        if sHostname is None  or  sHostname.strip() == '':
+            raise base.GenError('Empty sHostname is not implemented yet');
+
+        oTxsSession = txsclient.tryOpenTcpSession(cMsTimeout, sHostname, fReversedSetup = fReversed,
+                                                  cMsIdleFudge = cMsTimeout / 2);
+        if oTxsSession is None:
+            return False;
+
+        # Wait for the connect task to time out.
+        self.oTstDrv.addTask(oTxsSession);
+        self.oTstDrv.processPendingEvents();
+        oRc = self.oTstDrv.waitForTasks(cMsTimeout);
+        self.oTstDrv.removeTask(oTxsSession);
+        if oRc != oTxsSession:
+            if oRc is not None:
+                reporter.log('oRc=%s, expected %s' % (oRc, oTxsSession));
+            self.oTstDrv.processPendingEvents();
+            oTxsSession.cancelTask(); # this is synchronous
+            return False;
+
+        # Check the status.
+        reporter.log2('TxsSession is ready, isSuccess() -> %s.' % (oTxsSession.isSuccess(),));
+        if not oTxsSession.isSuccess():
+            return False;
+
+        reporter.log2('Disconnecting from TXS...');
+        return oTxsSession.syncDisconnect();
+
+
+
+class TxsConnectTask(TdTaskBase):
+    """
+    Class that takes care of connecting to a VM.
+    """
+
+    class TxsConnectTaskVBoxCallback(vbox.VirtualBoxEventHandlerBase):
+        """ Class for looking for IPv4 address changes on interface 0."""
+        def __init__(self, dArgs):
+            vbox.VirtualBoxEventHandlerBase.__init__(self, dArgs);              # pylint: disable=W0233
+            self.oParentTask = dArgs['oParentTask'];
+            self.sMachineId  = dArgs['sMachineId'];
+
+        def onGuestPropertyChange(self, sMachineId, sName, sValue, sFlags):
+            """Look for IP address."""
+            reporter.log2('onGuestPropertyChange(,%s,%s,%s,%s)' % (sMachineId, sName, sValue, sFlags));
+            if    sMachineId == self.sMachineId \
+              and sName  == '/VirtualBox/GuestInfo/Net/0/V4/IP':
+                self.oParentTask._setIp(sValue);                                # pylint: disable=W0212
+
+
+    def __init__(self, oSession, cMsTimeout, sIpAddr, sMacAddr, fReversedSetup):
+        TdTaskBase.__init__(self, utils.getCallerName());
+        self.cMsTimeout         = cMsTimeout;
+        self.sIpAddr            = None;
+        self.sNextIpAddr        = None;
+        self.sMacAddr           = sMacAddr;
+        self.fReversedSetup     = fReversedSetup;
+        self.oVBox              = oSession.oVBox;
+        self.oVBoxEventHandler  = None;
+        self.oTxsSession        = None;
+        self.fpApiVer           = oSession.fpApiVer;
+
+        # Skip things we don't implement.
+        if sMacAddr is not None:
+            reporter.error('TxsConnectTask does not implement sMacAddr yet');
+            raise base.GenError();
+
+        reporter.log2('TxsConnectTask: sIpAddr=%s fReversedSetup=%s' % (sIpAddr, fReversedSetup))
+        if fReversedSetup is True:
+            self._openTcpSession(sIpAddr, fReversedSetup = True);
+        elif sIpAddr is not None and sIpAddr.strip() != '':
+            self._openTcpSession(sIpAddr, cMsIdleFudge = 5000);
+        else:
+            #
+            # If we've got no IP address, register callbacks that listens for
+            # the primary network adaptor of the VM to set a IPv4 guest prop.
+            # Note! The order in which things are done here is kind of important.
+            #
+
+            # 0. The caller zaps the property before starting the VM.
+            #try:
+            #    oSession.delGuestPropertyValue('/VirtualBox/GuestInfo/Net/0/V4/IP');
+            #except:
+            #    reporter.logXcpt();
+
+            # 1. Register the callback / event listener object.
+            dArgs = {'oParentTask':self, 'sMachineId':oSession.o.machine.id};
+            self.oVBoxEventHandler = self.oVBox.registerDerivedEventHandler(self.TxsConnectTaskVBoxCallback, dArgs);
+
+            # 2. Query the guest properties.
+            try:
+                sIpAddr = oSession.getGuestPropertyValue('/VirtualBox/GuestInfo/Net/0/V4/IP');
+            except:
+                reporter.errorXcpt('IMachine::getGuestPropertyValue("/VirtualBox/GuestInfo/Net/0/V4/IP") failed');
+                self._deregisterEventHandler();
+                raise;
+            else:
+                if sIpAddr is not None:
+                    self._setIp(sIpAddr);
+        # end __init__
+
+    def __del__(self):
+        """ Make sure we deregister the callback. """
+        self._deregisterEventHandler();
+        return TdTaskBase.__del__(self);
+
+    def toString(self):
+        return '<%s cMsTimeout=%s, sIpAddr=%s, sNextIpAddr=%s, sMacAddr=%s, fReversedSetup=%s,' \
+               ' oTxsSession=%s oVBoxEventHandler=%s, oVBox=%s>' \
+             % (TdTaskBase.toString(self), self.cMsTimeout, self.sIpAddr, self.sNextIpAddr, self.sMacAddr, self.fReversedSetup,
+                self.oTxsSession, self.oVBoxEventHandler, self.oVBox);
+
+    def _deregisterEventHandler(self):
+        """Deregisters the event handler."""
+        fRc = True;
+        if self.oVBoxEventHandler is not None:
+            fRc = self.oVBoxEventHandler.unregister();
+            self.oVBoxEventHandler = None;
+        return fRc;
+
+    def _setIp(self, sIpAddr, fInitCall = False):
+        """Called when we get an IP. Will create a TXS session and signal the task."""
+        sIpAddr = sIpAddr.strip();
+
+        if   sIpAddr is not None \
+         and sIpAddr != '':
+            if vbox.isIpAddrValid(sIpAddr) or fInitCall:
+                try:
+                    for s in sIpAddr.split('.'):
+                        i = int(s);
+                        if str(i) != s:
+                            raise Exception();
+                except:
+                    reporter.fatalXcpt();
+                else:
+                    self._openTcpSession(sIpAddr, cMsIdleFudge = 5000);
+                    return None;
+
+            reporter.log('TxsConnectTask: Ignoring Bad ip "%s"' % (sIpAddr));
+        else:
+            reporter.log2('TxsConnectTask: Ignoring empty ip "%s"' % (sIpAddr));
+        return None;
+
+    def _openTcpSession(self, sIpAddr, uPort = None, fReversedSetup = False, cMsIdleFudge = 0):
+        """
+        Calls txsclient.openTcpSession and switches our task to reflect the
+        state of the subtask.
+        """
+        self.oCv.acquire();
+        if self.oTxsSession is None:
+            reporter.log2('_openTcpSession: sIpAddr=%s, uPort=%d, fReversedSetup=%s' % \
+                          (sIpAddr, uPort if uPort is not None else 0, fReversedSetup));
+            self.sIpAddr     = sIpAddr;
+            self.oTxsSession = txsclient.openTcpSession(self.cMsTimeout, sIpAddr, uPort, \
+                                                        fReversedSetup, cMsIdleFudge);
+            self.oTxsSession.setTaskOwner(self);
+        else:
+            self.sNextIpAddr = sIpAddr;
+            reporter.log2('_openTcpSession: sNextIpAddr=%s' % (sIpAddr,));
+        self.oCv.release();
+        return None;
+
+    def notifyAboutReadyTask(self, oTxsSession):
+        """
+        Called by the TXS session task when it's done.
+
+        We'll signal the task completed or retry depending on the result.
+        """
+
+        self.oCv.acquire();
+
+        # Disassociate ourselves with the session (avoid cyclic ref)
+        oTxsSession.setTaskOwner(None);
+        fSuccess = oTxsSession.isSuccess();
+        if self.oTxsSession is not None:
+            if not fSuccess:
+                self.oTxsSession = None;
+            if fSuccess and self.fReversedSetup:
+                self.sIpAddr = oTxsSession.oTransport.sHostname;
+        else:
+            fSuccess = False;
+
+        # Signal done, or retry?
+        if   fSuccess \
+          or self.fReversedSetup \
+          or self.getAgeAsMs() >= self.cMsTimeout:
+            self.signalTaskLocked();
+        else:
+            sIpAddr = self.sNextIpAddr if self.sNextIpAddr is not None else self.sIpAddr;
+            self._openTcpSession(sIpAddr, cMsIdleFudge = 5000);
+
+        self.oCv.release();
+        return True;
+
+    #
+    # Public methods
+    #
+
+    def getResult(self):
+        """
+        Returns the connected TXS session object on success.
+        Returns None on failure or if the task has not yet completed.
+        """
+        self.oCv.acquire();
+        oTxsSession = self.oTxsSession;
+        self.oCv.release();
+
+        if oTxsSession is not None  and  not oTxsSession.isSuccess():
+            oTxsSession = None;
+        return oTxsSession;
+
+    def cancelTask(self):
+        """ Cancels the task. """
+        self.oCv.acquire();
+        if not self.fSignalled:
+            oTxsSession = self.oTxsSession;
+            if oTxsSession is not None:
+                self.oCv.release();
+                oTxsSession.setTaskOwner(None);
+                oTxsSession.cancelTask();
+                oTxsSession.waitForTask(1000);
+                self.oCv.acquire();
+            self.signalTaskLocked();
+        self.oCv.release();
+        return True;
+
diff --git a/src/VBox/ValidationKit/testdriver/win-vbox-net-drvstore-cleanup.ps1 b/src/VBox/ValidationKit/testdriver/win-vbox-net-drvstore-cleanup.ps1
new file mode 100644
index 0000000..2088b25
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/win-vbox-net-drvstore-cleanup.ps1
@@ -0,0 +1,34 @@
+param([switch]$confirm)
+
+Function AskForConfirmation ($title_text, $message_text, $yes_text, $no_text)
+{
+   if ($confirm) {
+      $title = $title_text
+      $message = $message_text
+
+      $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", $yes_text
+
+      $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", $no_text
+
+      $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
+
+      $result = $host.ui.PromptForChoice($title, $message, $options, 0)
+   } else {
+      $result = 0
+   }
+
+   return $result
+}
+
+pnputil -e | ForEach-Object { if ($_ -match "Published name :.*(oem\d+\.inf)") {$inf=$matches[1]} elseif ($_ -match "Driver package provider :.*Oracle") {$inf + " " + $_} }
+
+$result = AskForConfirmation "Clean up the driver store" `
+        "Do you want to delete all VirtualBox drivers from the driver store?" `
+        "Deletes all VirtualBox drivers from the driver store." `
+        "No modifications to the driver store will be made."
+
+switch ($result)
+    {
+        0 {pnputil -e | ForEach-Object { if ($_ -match "Published name :.*(oem\d+\.inf)") {$inf=$matches[1]} elseif ($_ -match "Driver package provider :.*Oracle") {$inf} } | ForEach-Object { pnputil -d $inf } }
+        1 {"Removal cancelled."}
+    }
diff --git a/src/VBox/ValidationKit/testdriver/win-vbox-net-uninstall.ps1 b/src/VBox/ValidationKit/testdriver/win-vbox-net-uninstall.ps1
new file mode 100644
index 0000000..c21cc2f
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/win-vbox-net-uninstall.ps1
@@ -0,0 +1,217 @@
+param([switch]$confirm)
+
+Function AskForConfirmation ($title_text, $message_text, $yes_text, $no_text)
+{
+   if ($confirm) {
+      $title = $title_text
+      $message = $message_text
+
+      $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", $yes_text
+
+      $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", $no_text
+
+      $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
+
+      $result = $host.ui.PromptForChoice($title, $message, $options, 0)
+   } else {
+      $result = 0
+   }
+
+   return $result
+}
+
+Function DeleteUnmatchingKeys ($title_text, $reg_key)
+{
+   $ghostcon = @(Get-ChildItem ($reg_key) | Where-Object { !$connections.ContainsKey($_.PSChildName) } )
+   if ($ghostcon.count -eq 0) {
+      Write-Host "`nNo ghost connections has been found -- nothing to do"
+   } else {
+         Write-Host "`nParameter keys for the following connections will be removed:"
+         Write-Host ($ghostcon | Out-String)
+
+      $result = AskForConfirmation $title_text `
+          "Do you want to delete the keys listed above?" `
+          "Deletes all ghost connection keys from the registry." `
+          "No modifications to the registry will be made."
+
+      switch ($result)
+         {
+            0 {$ghostcon.GetEnumerator() | ForEach-Object { Remove-Item -Path $_ -Recurse }}
+            1 {"Removal cancelled."}
+         }
+   }
+}
+
+
+Push-Location
+cd "Registry::"
+Write-Host "Retrieving valid connections:"
+$iftypes = @{}
+$connections = @{}
+$ghostcon_names = @{}
+Get-Item ".\HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0*" | `
+   ForEach-Object {
+      $prop = (Get-ItemProperty $_.PSPath)
+      $conn = $null
+      if (Test-Path ("HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\" + $prop.NetCfgInstanceId + "\Connection")) {
+         $conn = (Get-ItemProperty ("HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\" + $prop.NetCfgInstanceId + "\Connection"))
+      }
+      $iftype = $prop."*IfType"
+      if ($iftypes.ContainsKey($iftype)) {
+         $iftypes[$iftype] = $iftypes[$iftype] + [Math]::pow(2,$prop.NetLuidIndex)
+      } else {
+         $iftypes[$iftype] = [Math]::pow(2,$prop.NetLuidIndex)
+      }
+      if ($conn -ne $null) {
+         $connections[$prop.NetCfgInstanceId] = $conn.Name
+         Write-Host $prop.NetCfgInstanceId $conn.Name "|" $prop."*IfType" $prop.NetLuidIndex $prop.DriverDesc
+      } else {
+         Write-Host $prop.NetCfgInstanceId [MISSING] "|" $prop."*IfType" $prop.NetLuidIndex $prop.DriverDesc
+      }
+   }
+
+# Someday we may want to process other types than Ethernet as well: $iftypes.GetEnumerator() | ForEach-Object {
+if ($iftypes[6] -gt 9223372036854775808) {
+   Write-Host "Found more than 63 interfaces (mask=" $iftypes[6] ") -- bailing out"
+   exit
+}
+Write-Host "`nChecking if the used LUID index mask is correct:"
+$correctmask = [BitConverter]::GetBytes([int64]($iftypes[6]))
+$actualmask = (Get-ItemProperty -Path "HKLM\SYSTEM\CurrentControlSet\Services\NDIS\IfTypes\6" -Name "IfUsedNetLuidIndices").IfUsedNetLuidIndices
+$needcorrection = $FALSE
+$ai = 0
+$lastnonzero = 0
+for ($ci = 0; $ci -lt $correctmask.Length; $ci++) {
+   if ($ai -lt $actualmask.Length) {
+      $aval = $actualmask[$ai++]
+   } else {
+      $aval = 0
+   }
+   if ($correctmask[$ci] -ne 0) {
+      $lastnonzero = $ci
+   }
+   if ($correctmask[$ci] -eq $aval) {
+      Write-Host "DEBUG: " $correctmask[$ci].ToString("X2") " == " $aval.ToString("X2")
+   } else {
+      Write-Host "DEBUG: " $correctmask[$ci].ToString("X2") " != " $aval.ToString("X2")
+      $needcorrection = $TRUE
+   }
+}
+if ($ai -lt $actualmask.Length) {
+   for (; $ai -lt $actualmask.Length; $ai++) {
+      if ($actualmask[$ai] -eq 0) {
+         Write-Host "DEBUG: 0 == 0"
+      } else {
+         Write-Host "DEBUG: " $actualmask[$ai].ToString("X2") " != 0"
+         $needcorrection = $TRUE
+      }
+   }
+}
+if ($needcorrection) {
+   Write-Host "Current mask is " ($actualmask|foreach {$_.ToString("X2")}) ", while it should be" ($correctmask|foreach {$_.ToString("X2")})
+   if ($confirm) {
+      Set-ItemProperty -Path "HKLM\SYSTEM\CurrentControlSet\Services\NDIS\IfTypes\6" -Name "IfUsedNetLuidIndices" -Value $correctmask -Type Binary -Confirm
+   } else {
+      Set-ItemProperty -Path "HKLM\SYSTEM\CurrentControlSet\Services\NDIS\IfTypes\6" -Name "IfUsedNetLuidIndices" -Value $correctmask -Type Binary
+   }
+} else {
+   Write-Host "The used LUID index mask is correct -- nothing to do"
+}
+
+#Write-Host ($connections | Out-String)
+$ghostcon = @(Get-ChildItem ("HKLM\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}") | Where-Object { !$connections.ContainsKey($_.PSChildName) -and $_.PSChildName -ne "Descriptions" } )
+if ($ghostcon -eq $null) {
+   Write-Host "`nNo ghost connections has been found -- nothing to do"
+} else {
+   Write-Host "`nThe following connections will be removed:"
+   #Write-Host ($ghostcon | Out-String)
+
+   $ghostcon.GetEnumerator() | ForEach-Object {
+      $prop = (Get-ItemProperty "$_\Connection")
+      if ($prop.PnPInstanceId -eq $null) {
+         Write-Host "WARNING! PnPInstanceId does not exist for" $_.PSChildName
+      } elseif (!($prop.PnPInstanceId.ToString() -match "SUN_VBOXNETFLTMP")) {
+         Write-Host "WARNING! PnPInstanceId (" $prop.PnPInstanceId.ToString() ") does not match ROOT\SUN_VBOXNETFLTMP for" $_.PSChildName
+      }
+      if ($prop.Name -eq $null) {
+         Write-Host "WARNING! Name does not exist for" $_.PSChildName
+      } else {
+         $ghostcon_names.Add($_.PSChildName, $prop.Name)
+         Write-Host $_.PSChildName -nonewline
+         Write-Host "  " -nonewline
+         Write-Host $prop.Name
+      }
+   }
+
+   $result = AskForConfirmation "Delete Registry Keys" `
+          "Do you want to delete the keys listed above?" `
+          "Deletes all ghost connection keys from the registry." `
+          "No modifications to the registry will be made."
+
+   switch ($result)
+       {
+           0 {$ghostcon.GetEnumerator() | ForEach-Object { Remove-Item -Path $_.PSPath -Recurse }}
+           1 {"Removal cancelled."}
+       }
+}
+
+# Delete WFPLWFS parameter keys
+DeleteUnmatchingKeys "Delete WFPLWFS Parameter Keys (Adapter subkey)" "HKLM\SYSTEM\CurrentControlSet\Services\WFPLWFS\Parameters\Adapters"
+DeleteUnmatchingKeys "Delete WFPLWFS Parameter Keys (NdisAdapter subkey)" "HKLM\SYSTEM\CurrentControlSet\Services\WFPLWFS\Parameters\NdisAdapters"
+# Delete Psched parameter keys
+DeleteUnmatchingKeys "Delete Psched Parameter Keys (Adapter subkey)" "HKLM\SYSTEM\CurrentControlSet\Services\Psched\Parameters\Adapters"
+DeleteUnmatchingKeys "Delete Psched Parameter Keys (NdisAdapter subkey)" "HKLM\SYSTEM\CurrentControlSet\Services\Psched\Parameters\NdisAdapters"
+
+# Clean up NSI entries
+$nsi_obsolete = New-Object System.Collections.ArrayList
+$nsi_path = "HKLM\SYSTEM\CurrentControlSet\Control\Nsi\{EB004A11-9B1A-11D4-9123-0050047759BC}\10"
+$nsi = (Get-Item $nsi_path) | Select-Object -ExpandProperty property
+$nsi | ForEach-Object {
+   $value = (Get-ItemProperty -Path $nsi_path -Name $_).$_
+   [byte[]]$guid_bytes = $value[1040..1055]
+   $guid = New-Object -TypeName System.Guid -ArgumentList (,$guid_bytes)
+   $guid_string = $guid.ToString("B").ToUpper()
+   $nsi_conn_name_last = 6 + $value[4] + $value[5]*256
+   $nsi_conn_name = [Text.Encoding]::Unicode.GetString($value[6..$nsi_conn_name_last])
+   $nsi_if_name_last = 522 + $value[520] + $value[521]*256
+   $nsi_if_name = [Text.Encoding]::Unicode.GetString($value[522..$nsi_if_name_last])
+   Write-Host $_ -nonewline
+   Write-Host "  " -nonewline
+   Write-Host $guid_string -nonewline
+   Write-Host "  " -nonewline
+   if ($connections.ContainsKey($guid_string)) {
+      Write-Host $nsi_if_name
+   } else {
+      [void] $nsi_obsolete.Add($_)
+      Write-Host "[OBSOLETE] " $nsi_if_name -foregroundcolor red
+   }
+}
+
+$result = AskForConfirmation "Delete NSI Entries" `
+        "Do you want to delete the entries marked in red above?" `
+        "Deletes all marked entries from the NSI registry key." `
+        "No modifications to the registry will be made."
+
+switch ($result)
+    {
+        0 {$nsi_obsolete.GetEnumerator() | ForEach-Object { Remove-ItemProperty -Path $nsi_path -Name $_ }}
+        1 {"Removal cancelled."}
+    }
+
+# Clean up uninstalled connections
+if ( (Get-ChildItem "HKLM\SYSTEM\CurrentControlSet\Control\Network\Uninstalled" | Measure-Object).Count -gt 10 ) {
+   $result = AskForConfirmation "Delete Uninstalled Network Connection Registry Keys" `
+          "There are over 10 uninstalled network connections accumulated in the registry. Do you want to delete them?" `
+          "Deletes uninstalled connection keys from the registry." `
+          "No modifications to the registry will be made."
+
+   switch ($result)
+       {
+           0 {Remove-Item -Path "HKLM\SYSTEM\CurrentControlSet\Control\Network\Uninstalled\*" -Recurse}
+           1 {"Removal cancelled."}
+       }
+} else {
+   Write-Host "Less than 10 uninstalled connections -- no action yet required."
+}
+
+Pop-Location
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testdriver/winbase.py b/src/VBox/ValidationKit/testdriver/winbase.py
new file mode 100644
index 0000000..f62c49e
--- /dev/null
+++ b/src/VBox/ValidationKit/testdriver/winbase.py
@@ -0,0 +1,229 @@
+# -*- coding: utf-8 -*-
+# $Id: winbase.py $
+
+"""
+This module is here to externalize some Windows specifics that gives pychecker
+a hard time when running on non-Windows systems.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os
+
+# Windows specific imports.
+import win32api;            # pylint: disable=F0401
+import win32con;            # pylint: disable=F0401
+import win32console;        # pylint: disable=F0401
+import win32event;          # pylint: disable=F0401
+import win32process;        # pylint: disable=F0401
+
+# Validation Kit imports.
+from testdriver import reporter;
+
+
+
+#
+# Windows specific implementation of base functions.
+#
+
+def processInterrupt(uPid):
+    """
+    The Windows version of base.processInterrupt
+
+    Note! This doesn't work terribly well with a lot of processes.
+    """
+    try:
+        win32console.GenerateConsoleCtrlEvent(win32con.CTRL_BREAK_EVENT, uPid);
+        #GenerateConsoleCtrlEvent = ctypes.windll.kernel32.GenerateConsoleCtrlEvent
+        #rc = GenerateConsoleCtrlEvent(1, uPid);
+        #reporter.log('GenerateConsoleCtrlEvent -> %s' % (rc,));
+        fRc = True;
+    except:
+        reporter.logXcpt('uPid=%s' % (uPid,));
+        fRc = False;
+    return fRc;
+
+def postThreadMesssageClose(uTid):
+    """ Posts a WM_CLOSE message to the specified thread."""
+    fRc = False;
+    try:
+        win32api.PostThreadMessage(uTid, win32con.WM_CLOSE, 0, 0);
+        fRc = True;
+    except:
+        reporter.logXcpt('uTid=%s' % (uTid,));
+    return fRc;
+
+def postThreadMesssageQuit(uTid):
+    """ Posts a WM_QUIT message to the specified thread."""
+    fRc = False;
+    try:
+        win32api.PostThreadMessage(uTid, win32con.WM_QUIT, 0x40010004, 0); # DBG_TERMINATE_PROCESS
+        fRc = True;
+    except:
+        reporter.logXcpt('uTid=%s' % (uTid,));
+    return fRc;
+
+def processTerminate(uPid):
+    """ The Windows version of base.processTerminate """
+    fRc = False;
+    try:
+        hProcess = win32api.OpenProcess(win32con.PROCESS_TERMINATE, False, uPid);
+    except:
+        reporter.logXcpt('uPid=%s' % (uPid,));
+    else:
+        try:
+            win32process.TerminateProcess(hProcess, 0x40010004); # DBG_TERMINATE_PROCESS
+            fRc = True;
+        except:
+            reporter.logXcpt('uPid=%s' % (uPid,));
+        win32api.CloseHandle(hProcess)
+    return fRc;
+
+def processKill(uPid):
+    """ The Windows version of base.processKill """
+    return processTerminate(uPid);
+
+def processExists(uPid):
+    """ The Windows version of base.processExists """
+    fRc = False;
+    try:
+        hProcess = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION, False, uPid);
+    except:
+        reporter.logXcpt('uPid=%s' % (uPid,));
+    else:
+        win32api.CloseHandle(hProcess)
+        fRc = True;
+    return fRc;
+
+def processCheckPidAndName(uPid, sName):
+    """ The Windows version of base.processCheckPidAndName """
+    fRc = processExists(uPid);
+    if fRc is True:
+        try:
+            from win32com.client import GetObject; # pylint: disable=F0401
+            oWmi = GetObject('winmgmts:');
+            aoProcesses = oWmi.InstancesOf('Win32_Process');
+            for oProcess in aoProcesses:
+                if long(oProcess.Properties_("ProcessId").Value) == uPid:
+                    sCurName = oProcess.Properties_("Name").Value;
+                    reporter.log2('uPid=%s sName=%s sCurName=%s' % (uPid, sName, sCurName));
+                    sName    = sName.lower();
+                    sCurName = sCurName.lower();
+                    if os.path.basename(sName) == sName:
+                        sCurName = os.path.basename(sCurName);
+
+                    if  sCurName == sName \
+                    or sCurName + '.exe' == sName \
+                    or sCurName == sName  + '.exe':
+                        fRc = True;
+                    break;
+        except:
+            reporter.logXcpt('uPid=%s sName=%s' % (uPid, sName));
+    return fRc;
+
+#
+# Some helper functions.
+#
+def processCreate(sName, asArgs):
+    """
+    Returns a (pid, handle, tid) tuple on success. (-1, None) on failure (logged).
+    """
+
+    # Construct a command line.
+    sCmdLine = '';
+    for sArg in asArgs:
+        if sCmdLine == '':
+            sCmdLine += '"';
+        else:
+            sCmdLine += ' "';
+        sCmdLine += sArg;
+        sCmdLine += '"';
+
+    # Try start the process.
+    dwCreationFlags = win32con.CREATE_NEW_PROCESS_GROUP;
+    oStartupInfo    = win32process.STARTUPINFO();
+    try:
+        (hProcess, hThread, uPid, uTid) = win32process.CreateProcess(sName,
+            sCmdLine,                   # CommandLine
+            None,                       # ProcessAttributes
+            None,                       # ThreadAttibutes
+            1,                          # fInheritHandles
+            dwCreationFlags,
+            None,                       # Environment
+            None,                       # CurrentDirectory.
+            oStartupInfo);
+    except:
+        reporter.logXcpt('sName="%s" sCmdLine="%s"' % (sName, sCmdLine));
+        return (-1, None, -1);
+
+    # Dispense with the thread handle.
+    try:
+        win32api.CloseHandle(hThread);
+    except:
+        reporter.logXcpt();
+
+    # Try get full access to the process.
+    try:
+        hProcessFullAccess = win32api.DuplicateHandle( \
+            win32api.GetCurrentProcess(), \
+            hProcess, \
+            win32api.GetCurrentProcess(), \
+            win32con.PROCESS_TERMINATE \
+            | win32con.PROCESS_QUERY_INFORMATION \
+            | win32con.SYNCHRONIZE  \
+            | win32con.DELETE, \
+            False, \
+            0);
+        win32api.CloseHandle(hProcess);
+        hProcess = hProcessFullAccess;
+    except:
+        reporter.logXcpt();
+    reporter.log2('processCreate -> %#x, hProcess=%#x' % (uPid, hProcess,));
+    return (uPid, hProcess, uTid);
+
+def processPollByHandle(hProcess):
+    """
+    Polls the process handle to see if it has finished (True) or not (False).
+    """
+    try:
+        dwWait = win32event.WaitForSingleObject(hProcess, 0);
+    except:
+        reporter.logXcpt('hProcess=%s %#x' % (hProcess, hProcess,));
+        return True;
+    return dwWait != win32con.WAIT_TIMEOUT; #0x102; #
+
+
+def processTerminateByHandle(hProcess):
+    """
+    Terminates the process.
+    """
+    try:
+        win32api.TerminateProcess(hProcess, 0x40010004); # DBG_TERMINATE_PROCESS
+    except:
+        reporter.logXcpt('hProcess=%s %#x' % (hProcess, hProcess,));
+        return False;
+    return True;
+
diff --git a/src/VBox/ValidationKit/testmanager/Makefile.kmk b/src/VBox/ValidationKit/testmanager/Makefile.kmk
new file mode 100644
index 0000000..c6378bf
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/Makefile.kmk
@@ -0,0 +1,44 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+include $(PATH_SUB_CURRENT)/cgi/Makefile.kmk
+include $(PATH_SUB_CURRENT)/core/Makefile.kmk
+include $(PATH_SUB_CURRENT)/batch/Makefile.kmk
+include $(PATH_SUB_CURRENT)/debug/Makefile.kmk
+include $(PATH_SUB_CURRENT)/misc/Makefile.kmk
+include $(PATH_SUB_CURRENT)/webui/Makefile.kmk
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+VBOX_VALIDATIONKIT_JS_SOURCES     += $(wildcard $(PATH_SUB_CURRENT)/htdocs/js/*.js)
+
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+$(evalcall def_vbox_validationkit_process_js_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testmanager/__init__.py b/src/VBox/ValidationKit/testmanager/__init__.py
new file mode 100644
index 0000000..6a69a4b
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/__init__.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# $Id: __init__.py $
+
+"""
+Test Manager.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
diff --git a/src/VBox/ValidationKit/testmanager/apache-template-2.2.conf b/src/VBox/ValidationKit/testmanager/apache-template-2.2.conf
new file mode 100644
index 0000000..805851b
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/apache-template-2.2.conf
@@ -0,0 +1,77 @@
+# $Id: apache-template-2.2.conf $
+## @file
+# Test Manager - Apache 2.2 configuration sample.
+#
+# Requires TestManagerRootDir to be set in the environment (envvars file for instance).
+#
+
+#
+# Copyright (C) 2012-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+
+<LocationMatch "^/testmanager/logout.py">
+        AuthType Basic
+        AuthName "Test Manager"
+        AuthUserFile ${TestManagerRootDir}/misc/htpasswd-logout
+        Require user logout
+</LocationMatch>
+
+<LocationMatch "^/testmanager/(?!(testboxdisp.py|logout.py|/*htdocs/downloads/.*))">
+        AuthType Basic
+        AuthName "Test Manager"
+        AuthUserFile ${TestManagerRootDir}/misc/htpasswd-sample
+        Require valid-user
+</LocationMatch>
+
+# These two directives are only for local testing!
+Alias /testmanager/htdocs/downloads/VBoxValidationKit.zip ${VBoxBuildOutputDir}/VBoxValidationKit.zip
+<Location /testmanager/htdocs/downloads/VBoxValidationKit.zip>
+       Options Indexes
+       Order allow,deny
+       Allow from all
+</Location>
+
+Alias /testmanager/htdocs/ ${TestManagerRootDir}/htdocs/
+<Directory ${TestManagerRootDir}/htdocs/>
+       AllowOverride None
+       Options Indexes
+       Order allow,deny
+       Allow from all
+</Directory>
+
+Alias /testmanager/logs/ /var/tmp/testmanager/
+<Directory /var/tmp/testmanager/>
+       AllowOverride None
+       Options Indexes
+       Order allow,deny
+       Allow from all
+</Directory>
+
+Alias /testmanager/ ${TestManagerRootDir}/cgi/
+<Directory ${TestManagerRootDir}/cgi/>
+       AllowOverride None
+       Options Indexes ExecCGI
+       DirectoryIndex index.py
+       AddHandler cgi-script .py
+       Order allow,deny
+       Allow from all
+</Directory>
+
diff --git a/src/VBox/ValidationKit/testmanager/apache-template-2.4.conf b/src/VBox/ValidationKit/testmanager/apache-template-2.4.conf
new file mode 100644
index 0000000..fa68f2c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/apache-template-2.4.conf
@@ -0,0 +1,71 @@
+# $Id: apache-template-2.4.conf $
+## @file
+# Test Manager - Apache 2.4 configuration sample.
+#
+# Use the new Define directive to define TestManagerRootDir and
+# VBoxBuildOutputDir before including this file.
+#
+
+#
+# Copyright (C) 2012-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+
+<LocationMatch "^/testmanager/logout.py">
+        AuthType Basic
+        AuthName "Test Manager"
+        AuthUserFile ${TestManagerRootDir}/misc/htpasswd-logout
+        Require user logout
+</LocationMatch>
+
+<LocationMatch "^/testmanager/(?!(testboxdisp.py|logout.py|/*htdocs/downloads/.*))">
+        AuthType Basic
+        AuthName "Test Manager"
+        AuthUserFile ${TestManagerRootDir}/misc/htpasswd-sample
+        Require valid-user
+</LocationMatch>
+
+# These two directives are only for local testing!
+Alias /testmanager/htdocs/downloads/VBoxValidationKit.zip ${VBoxBuildOutputDir}/VBoxValidationKit.zip
+<Location /testmanager/htdocs/downloads/VBoxValidationKit.zip>
+       Options Indexes
+       Require all granted
+</Location>
+
+Alias /testmanager/htdocs/ ${TestManagerRootDir}/htdocs/
+<Directory ${TestManagerRootDir}/htdocs/>
+       AllowOverride None
+       Options Indexes
+</Directory>
+
+Alias /testmanager/logs/ /var/tmp/testmanager/
+<Directory /var/tmp/testmanager/>
+       AllowOverride None
+       Options Indexes
+</Directory>
+
+Alias /testmanager/ ${TestManagerRootDir}/cgi/
+<Directory ${TestManagerRootDir}/cgi/>
+       AllowOverride None
+       Options Indexes ExecCGI
+       DirectoryIndex index.py
+       AddHandler cgi-script .py
+</Directory>
+
diff --git a/src/VBox/ValidationKit/testmanager/batch/Makefile.kmk b/src/VBox/ValidationKit/testmanager/batch/Makefile.kmk
new file mode 100644
index 0000000..df27b62
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/batch/Makefile.kmk
@@ -0,0 +1,36 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+$(evalcall def_vbox_validationkit_process_js_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testmanager/batch/add_build.py b/src/VBox/ValidationKit/testmanager/batch/add_build.py
new file mode 100755
index 0000000..81a5a33
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/batch/add_build.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: add_build.py $
+# pylint: disable=C0301
+
+"""
+Interface used by the tinderbox server side software to add a fresh build.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports
+import sys;
+import os;
+from optparse import OptionParser;
+
+# Add Test Manager's modules path
+g_ksTestManagerDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksTestManagerDir);
+
+# Test Manager imports
+from testmanager.core.db    import TMDatabaseConnection;
+from testmanager.core.build import BuildDataEx, BuildLogic, BuildCategoryData;
+
+class Build(object): # pylint: disable=R0903
+    """
+    Add build info into Test Manager database.
+    """
+
+    def __init__(self):
+        """
+        Parse command line.
+        """
+
+        oParser = OptionParser();
+        oParser.add_option('-q', '--quiet', dest = 'fQuiet', action = 'store_true',
+                           help = 'Quiet execution');
+        oParser.add_option('-b', '--branch', dest = 'sBranch', metavar = '<branch>',
+                           help = 'branch name (default: trunk)', default = 'trunk');
+        oParser.add_option('-p', '--product', dest = 'sProductName', metavar = '<name>',
+                           help = 'The product name.');
+        oParser.add_option('-r', '--revision', dest = 'iRevision', metavar = '<rev>',
+                           help = 'revision number');
+        oParser.add_option('-R', '--repository', dest = 'sRepository', metavar = '<repository>',
+                           help = 'Version control repository name.');
+        oParser.add_option('-t', '--type', dest = 'sBuildType', metavar = '<type>',
+                           help = 'build type (debug, release etc.)');
+        oParser.add_option('-v', '--version', dest = 'sProductVersion', metavar = '<ver>',
+                           help = 'The product version number (suitable for RTStrVersionCompare)');
+        oParser.add_option('-o', '--os-arch', dest = 'asTargetOsArches', metavar = '<os.arch>', action = 'append',
+                           help = 'Target OS and architecture. This option can be repeated.');
+        oParser.add_option('-l', '--log', dest = 'sBuildLogPath', metavar = '<url>',
+                           help = 'URL to the build logs (optional).');
+        oParser.add_option('-f', '--file', dest = 'asFiles', metavar = '<file|url>', action = 'append',
+                           help = 'URLs or build share relative path to a build output file. This option can be repeated.');
+
+        (self.oConfig, _) = oParser.parse_args();
+
+        # Check command line
+        asMissing = [];
+        if self.oConfig.sBranch is None:            asMissing.append('--branch');
+        if self.oConfig.iRevision is None:          asMissing.append('--revision');
+        if self.oConfig.sProductVersion is None:    asMissing.append('--version');
+        if self.oConfig.sProductName is None:       asMissing.append('--product');
+        if self.oConfig.sBuildType is None:         asMissing.append('--type');
+        if self.oConfig.asTargetOsArches is None:   asMissing.append('--os-arch');
+        if self.oConfig.asFiles is None:            asMissing.append('--file');
+        if len(asMissing) > 0:
+            sys.stderr.write('syntax error: Missing: %s\n' % (asMissing,));
+            sys.exit(1);
+        # Temporary default.
+        if self.oConfig.sRepository is None:
+            self.oConfig.sRepository = 'vbox';
+
+    def add(self):
+        """
+        Add build data record into database.
+        """
+        oDb = TMDatabaseConnection()
+
+        # Assemble the build data.
+        oBuildData = BuildDataEx()
+        oBuildData.idBuildCategory    = None;
+        oBuildData.iRevision          = self.oConfig.iRevision
+        oBuildData.sVersion           = self.oConfig.sProductVersion
+        oBuildData.sLogUrl            = self.oConfig.sBuildLogPath
+        oBuildData.sBinaries          = ','.join(self.oConfig.asFiles);
+        oBuildData.oCat = BuildCategoryData().initFromValues(sProduct    = self.oConfig.sProductName,
+                                                             sRepository = self.oConfig.sRepository,
+                                                             sBranch     = self.oConfig.sBranch,
+                                                             sType       = self.oConfig.sBuildType,
+                                                             asOsArches  = self.oConfig.asTargetOsArches);
+
+        # Add record to database
+        try:
+            BuildLogic(oDb).addEntry(oBuildData, fCommit = True);
+        except:
+            if self.oConfig.fQuiet:
+                sys.exit(1);
+            raise;
+        oDb.close();
+        return 0;
+
+if __name__ == '__main__':
+    sys.exit(Build().add());
+
diff --git a/src/VBox/ValidationKit/testmanager/batch/close_orphaned_testsets.py b/src/VBox/ValidationKit/testmanager/batch/close_orphaned_testsets.py
new file mode 100755
index 0000000..a961e20
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/batch/close_orphaned_testsets.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: close_orphaned_testsets.py $
+# pylint: disable=C0301
+
+"""
+Maintenance tool for closing orphaned testsets.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports
+import sys
+import os
+from optparse import OptionParser
+
+# Add Test Manager's modules path
+g_ksTestManagerDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(g_ksTestManagerDir)
+
+# Test Manager imports
+from testmanager.core.db        import TMDatabaseConnection
+from testmanager.core.testset   import TestSetLogic;
+
+
+class CloseOrphanedTestSets(object):
+    """
+    Finds and closes orphaned testsets.
+    """
+
+    def __init__(self):
+        """
+        Parse command line
+        """
+        oParser = OptionParser();
+        oParser.add_option('-d', '--just-do-it', dest='fJustDoIt', action='store_true',
+                           help='Do the database changes.');
+
+
+        (self.oConfig, _) = oParser.parse_args();
+
+
+    def main(self):
+        """ Main method. """
+        oDb = TMDatabaseConnection();
+
+        # Get a list of orphans.
+        oLogic = TestSetLogic(oDb);
+        aoOrphans = oLogic.fetchOrphaned();
+        if len(aoOrphans) > 0:
+            # Complete them.
+            if self.oConfig.fJustDoIt:
+                print 'Completing %u test sets as abandond:' % (len(aoOrphans),);
+                for oTestSet in aoOrphans:
+                    print '#%-7u: idTestBox=%-3u tsCreated=%s tsDone=%s' \
+                        % (oTestSet.idTestSet, oTestSet.idTestBox, oTestSet.tsCreated, oTestSet.tsDone);
+                    oLogic.completeAsAbandond(oTestSet.idTestSet);
+                print 'Committing...';
+                oDb.commit();
+            else:
+                for oTestSet in aoOrphans:
+                    print '#%-7u: idTestBox=%-3u tsCreated=%s tsDone=%s' \
+                        % (oTestSet.idTestSet, oTestSet.idTestBox, oTestSet.tsCreated, oTestSet.tsDone);
+                print 'Not completing any testsets without seeing the --just-do-it option.'
+        else:
+            print 'No orphaned test sets.\n'
+        return 0;
+
+
+if __name__ == '__main__':
+    sys.exit(CloseOrphanedTestSets().main())
+
diff --git a/src/VBox/ValidationKit/testmanager/batch/del_build.py b/src/VBox/ValidationKit/testmanager/batch/del_build.py
new file mode 100755
index 0000000..99abff8
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/batch/del_build.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: del_build.py $
+# pylint: disable=C0301
+
+"""
+Interface used by the tinderbox server side software to mark build binaries
+deleted.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports
+import sys
+import os
+from optparse import OptionParser
+
+# Add Test Manager's modules path
+g_ksTestManagerDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(g_ksTestManagerDir)
+
+# Test Manager imports
+from testmanager.core.db    import TMDatabaseConnection
+from testmanager.core.build import BuildLogic
+
+
+def markBuildsDeleted():
+    """
+    Marks the builds using the specified binaries as deleted.
+    """
+
+    oParser = OptionParser()
+    oParser.add_option('-q', '--quiet', dest='fQuiet', action='store_true',
+                       help='Quiet execution');
+
+    (oConfig, asArgs) = oParser.parse_args()
+    if len(asArgs) == 0:
+        if not oConfig.fQuiet:
+            sys.stderr.write('syntax error: No builds binaries specified\n');
+        return 1;
+
+
+    oDb = TMDatabaseConnection()
+    oLogic = BuildLogic(oDb)
+
+    for sBuildBin in asArgs:
+        try:
+            cBuilds = oLogic.markDeletedByBinaries(sBuildBin, fCommit = True)
+        except:
+            if oConfig.fQuiet:
+                sys.exit(1);
+            raise;
+        else:
+            if not oConfig.fQuiet:
+                print "del_build.py: Marked %u builds associated with '%s' as deleted." % (cBuilds, sBuildBin,);
+
+    oDb.close()
+    return 0;
+
+if __name__ == '__main__':
+    sys.exit(markBuildsDeleted())
+
diff --git a/src/VBox/ValidationKit/testmanager/batch/filearchiver.py b/src/VBox/ValidationKit/testmanager/batch/filearchiver.py
new file mode 100755
index 0000000..3b81abd
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/batch/filearchiver.py
@@ -0,0 +1,271 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: filearchiver.py $
+# pylint: disable=C0301
+
+"""
+A cronjob that compresses logs and other files, moving them to the
+g_ksZipFileAreaRootDir storage area.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports
+import sys
+import os
+from optparse import OptionParser
+import time;
+import zipfile;
+
+# Add Test Manager's modules path
+g_ksTestManagerDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(g_ksTestManagerDir)
+
+# Test Manager imports
+from common                     import utils;
+from testmanager                import config;
+from testmanager.core.db        import TMDatabaseConnection;
+from testmanager.core.testset   import TestSetData, TestSetLogic;
+
+class FileArchiverBatchJob(object): # pylint: disable=R0903
+    """
+    Log+files comp
+    """
+
+    def __init__(self, oOptions):
+        """
+        Parse command line
+        """
+        self.fVerbose      = oOptions.fVerbose;
+        self.sSrcDir       = config.g_ksFileAreaRootDir;
+        self.sDstDir       = config.g_ksZipFileAreaRootDir;
+        #self.oTestSetLogic = TestSetLogic(TMDatabaseConnection(self.dprint if self.fVerbose else None));
+        self.oTestSetLogic = TestSetLogic(TMDatabaseConnection(None));
+        self.fDryRun       = oOptions.fDryRun;
+
+    def dprint(self, sText):
+        """ Verbose output. """
+        if self.fVerbose:
+            print sText;
+        return True;
+
+    def warning(self, sText):
+        """Prints a warning."""
+        print sText;
+        return True;
+
+    def _processTestSet(self, idTestSet, asFiles, sCurDir):
+        """
+        Worker for processDir.
+        Same return codes as processDir.
+        """
+
+        sBaseFilename = os.path.join(sCurDir, 'TestSet-%d' % (idTestSet,));
+        if sBaseFilename[0:2] == ('.' + os.path.sep):
+            sBaseFilename = sBaseFilename[2:];
+        sSrcFileBase = os.path.join(self.sSrcDir, sBaseFilename + '-');
+
+        #
+        # Skip the file if the test set is still running.
+        # But delete them if the testset is not found.
+        #
+        oTestSet = self.oTestSetLogic.tryFetch(idTestSet);
+        if oTestSet is not None and sBaseFilename != oTestSet.sBaseFilename:
+            self.warning('TestSet %d: Deleting because sBaseFilename differs: "%s" (disk) vs "%s" (db)' \
+                         % (idTestSet, sBaseFilename, oTestSet.sBaseFilename,));
+            oTestSet = None;
+
+        if oTestSet is not None:
+            if oTestSet.enmStatus == TestSetData.ksTestStatus_Running:
+                self.dprint('Skipping test set #%d, still running' % (idTestSet,));
+                return True;
+
+            #
+            # If we have a zip file already, don't try recreate it as we might
+            # have had trouble removing the source files.
+            #
+            sDstDirPath = os.path.join(self.sDstDir, sCurDir);
+            sZipFileNm  = os.path.join(sDstDirPath, 'TestSet-%d.zip' % (idTestSet,));
+            if not os.path.exists(sZipFileNm):
+                #
+                # Create zip file with all testset files as members.
+                #
+                self.dprint('TestSet %d: Creating %s...' % (idTestSet, sZipFileNm,));
+                if not self.fDryRun:
+
+                    if not os.path.exists(sDstDirPath):
+                        os.makedirs(sDstDirPath, 0o755);
+
+                    utils.noxcptDeleteFile(sZipFileNm + '.tmp');
+                    oZipFile = zipfile.ZipFile(sZipFileNm + '.tmp', 'w', zipfile.ZIP_DEFLATED, allowZip64 = True);
+
+                    for sFile in asFiles:
+                        sSuff = os.path.splitext(sFile)[1];
+                        if sSuff in [ '.png', '.webm', '.gz', '.bz2', '.zip', '.mov', '.avi', '.mpg', '.gif', '.jpg' ]:
+                            ## @todo Consider storing these files outside the zip if they are a little largish.
+                            self.dprint('TestSet %d: Storing   %s...' % (idTestSet, sFile));
+                            oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_STORED);
+                        else:
+                            self.dprint('TestSet %d: Deflating %s...' % (idTestSet, sFile));
+                            oZipFile.write(sSrcFileBase + sFile, sFile, zipfile.ZIP_DEFLATED);
+
+                    oZipFile.close();
+
+                    #
+                    # .zip.tmp -> .zip.
+                    #
+                    utils.noxcptDeleteFile(sZipFileNm);
+                    os.rename(sZipFileNm + '.tmp', sZipFileNm);
+
+                #else: Dry run.
+            else:
+                self.dprint('TestSet %d: zip file exists already (%s)' % (idTestSet, sZipFileNm,));
+
+        #
+        # Delete the files.
+        #
+        fRc = True;
+        if self.fVerbose:
+            self.dprint('TestSet %d: deleting file: %s' % (idTestSet, asFiles));
+        if not self.fDryRun:
+            for sFile in asFiles:
+                if utils.noxcptDeleteFile(sSrcFileBase + sFile) is False:
+                    self.warning('TestSet %d: Failed to delete "%s" (%s)' % (idTestSet, sFile, sSrcFileBase + sFile,));
+                    fRc = False;
+
+        return fRc;
+
+
+    def processDir(self, sCurDir):
+        """
+        Process the given directory (relative to sSrcDir and sDstDir).
+        Returns success indicator.
+        """
+        if self.fVerbose:
+            self.dprint('processDir: %s' % (sCurDir,));
+
+        #
+        # Sift thought the directory content, collecting subdirectories and
+        # sort relevant files by test set.
+        # Generally there will either be subdirs or there will be files.
+        #
+        asSubDirs = [];
+        dTestSets = {};
+        sCurPath = os.path.abspath(os.path.join(self.sSrcDir, sCurDir));
+        for sFile in os.listdir(sCurPath):
+            if os.path.isdir(os.path.join(sCurPath, sFile)):
+                if sFile not in [ '.', '..' ]:
+                    asSubDirs.append(sFile);
+            elif sFile.startswith('TestSet-'):
+                # Parse the file name. ASSUMES 'TestSet-%d-filename' format.
+                iSlash1 = sFile.find('-');
+                iSlash2 = sFile.find('-', iSlash1 + 1);
+                if iSlash2 <= iSlash1:
+                    self.warning('Bad filename (1): "%s"' % (sFile,));
+                    continue;
+
+                try:    idTestSet = int(sFile[(iSlash1 + 1):iSlash2]);
+                except:
+                    self.warning('Bad filename (2): "%s"' % (sFile,));
+                    if self.fVerbose:
+                        self.dprint('\n'.join(utils.getXcptInfo(4)));
+                    continue;
+
+                if idTestSet <= 0:
+                    self.warning('Bad filename (3): "%s"' % (sFile,));
+                    continue;
+
+                if iSlash2 + 2 >= len(sFile):
+                    self.warning('Bad filename (4): "%s"' % (sFile,));
+                    continue;
+                sName = sFile[(iSlash2 + 1):];
+
+                # Add it.
+                if idTestSet not in dTestSets:
+                    dTestSets[idTestSet] = [];
+                asTestSet = dTestSets[idTestSet];
+                asTestSet.append(sName);
+
+        #
+        # Test sets.
+        #
+        fRc = True;
+        for idTestSet in dTestSets:
+            try:
+                if self._processTestSet(idTestSet, dTestSets[idTestSet], sCurDir) is not True:
+                    fRc = False;
+            except:
+                self.warning('TestSet %d: Exception in _processTestSet:\n%s' % (idTestSet, '\n'.join(utils.getXcptInfo()),));
+                fRc = False;
+
+        #
+        # Sub dirs.
+        #
+        for sSubDir in asSubDirs:
+            if self.processDir(os.path.join(sCurDir, sSubDir)) is not True:
+                fRc = False;
+
+        #
+        # Try Remove the directory iff it's not '.' and it's been unmodified
+        # for the last 24h (race protection).
+        #
+        if sCurDir != '.':
+            try:
+                fpModTime = float(os.path.getmtime(sCurPath));
+                if fpModTime + (24*3600) <= time.time():
+                    if utils.noxcptRmDir(sCurPath) is True:
+                        self.dprint('Removed "%s".' % (sCurPath,));
+            except:
+                pass;
+
+        return fRc;
+
+    @staticmethod
+    def main():
+        """ C-style main(). """
+        #
+        # Parse options.
+        #
+        oParser = OptionParser();
+        oParser.add_option('-v', '--verbose', dest = 'fVerbose', action = 'store_true',  default = False,
+                           help = 'Verbose output.');
+        oParser.add_option('-q', '--quiet',   dest = 'fVerbose', action = 'store_false', default = False,
+                           help = 'Quiet operation.');
+        oParser.add_option('-d', '--dry-run', dest = 'fDryRun',  action = 'store_true',  default = False,
+                           help = 'Dry run, do not make any changes.');
+        (oOptions, asArgs) = oParser.parse_args()
+        if asArgs != []:
+            oParser.print_help();
+            return 1;
+
+        #
+        # Do the work.
+        #
+        oBatchJob = FileArchiverBatchJob(oOptions);
+        fRc = oBatchJob.processDir('.');
+        return 0 if fRc is True else 1;
+
+if __name__ == '__main__':
+    sys.exit(FileArchiverBatchJob.main());
+
diff --git a/src/VBox/ValidationKit/testmanager/batch/vcs_import.py b/src/VBox/ValidationKit/testmanager/batch/vcs_import.py
new file mode 100755
index 0000000..cada452
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/batch/vcs_import.py
@@ -0,0 +1,139 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: vcs_import.py $
+# pylint: disable=C0301
+
+"""
+Cron job for importing revision history for a repository.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports
+import sys;
+import os;
+from optparse import OptionParser;
+import xml.etree.ElementTree as ET;
+
+# Add Test Manager's modules path
+g_ksTestManagerDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksTestManagerDir);
+
+# Test Manager imports
+from testmanager.core.db            import TMDatabaseConnection;
+from testmanager.core.vcsrevisions  import VcsRevisionData, VcsRevisionLogic;
+from common                         import utils;
+
+class VcsImport(object): # pylint: disable=R0903
+    """
+    Imports revision history from a VSC into the Test Manager database.
+    """
+
+    def __init__(self):
+        """
+        Parse command line.
+        """
+
+        oParser = OptionParser()
+        oParser.add_option('-e', '--extra-option', dest = 'asExtraOptions', action = 'append',
+                           help = 'Adds a extra option to the command retrieving the log.');
+        oParser.add_option('-f', '--full', dest = 'fFull', action = 'store_true',
+                           help = 'Full revision history import.');
+        oParser.add_option('-q', '--quiet', dest = 'fQuiet', action = 'store_true',
+                           help = 'Quiet execution');
+        oParser.add_option('-R', '--repository', dest = 'sRepository', metavar = '<repository>',
+                           help = 'Version control repository name.');
+        oParser.add_option('-s', '--start-revision', dest = 'iStartRevision', metavar = 'start-revision',
+                           type = "int", default = 0,
+                           help = 'The revision to start at when doing a full import.');
+        oParser.add_option('-t', '--type', dest = 'sType', metavar = '<type>',
+                           help = 'The VCS type (default: svn)', choices = [ 'svn', ], default = 'svn');
+        oParser.add_option('-u', '--url', dest = 'sUrl', metavar = '<url>',
+                           help = 'The VCS URL');
+
+        (self.oConfig, _) = oParser.parse_args();
+
+        # Check command line
+        asMissing = [];
+        if self.oConfig.sUrl is None:               asMissing.append('--url');
+        if self.oConfig.sRepository is None:        asMissing.append('--repository');
+        if len(asMissing) > 0:
+            sys.stderr.write('syntax error: Missing: %s\n' % (asMissing,));
+            sys.exit(1);
+
+        assert self.oConfig.sType == 'svn';
+
+    def main(self):
+        """
+        Main function.
+        """
+        oDb = TMDatabaseConnection();
+        oLogic = VcsRevisionLogic(oDb);
+
+        # Where to start.
+        iStartRev = 0;
+        if not self.oConfig.fFull:
+            iStartRev = oLogic.getLastRevision(self.oConfig.sRepository);
+        if iStartRev == 0:
+            iStartRev = self.oConfig.iStartRevision;
+
+        # Construct a command line.
+        os.environ['LC_ALL'] = 'en_US.utf-8';
+        asArgs = [
+            'svn',
+            'log',
+            '--xml',
+            '--revision', str(iStartRev) + ':HEAD',
+        ];
+        if self.oConfig.asExtraOptions is not None:
+            asArgs.extend(self.oConfig.asExtraOptions);
+        asArgs.append(self.oConfig.sUrl);
+        if not self.oConfig.fQuiet:
+            print 'Executing: %s' % (asArgs,);
+        sLogXml = utils.processOutputChecked(asArgs);
+
+        # Parse the XML and add the entries to the database.
+        oParser = ET.XMLParser(target = ET.TreeBuilder(), encoding = 'utf-8');
+        oParser.feed(sLogXml);
+        oRoot = oParser.close();
+
+        for oLogEntry in oRoot.findall('logentry'):
+            iRevision = int(oLogEntry.get('revision'));
+            sAuthor  = oLogEntry.findtext('author').strip();
+            sDate    = oLogEntry.findtext('date').strip();
+            sMessage = oLogEntry.findtext('msg', '').strip();
+            if sMessage == '':
+                sMessage = ' ';
+            if not self.oConfig.fQuiet:
+                print 'sDate=%s iRev=%u sAuthor=%s sMsg[%s]=%s' % (sDate, iRevision, sAuthor, type(sMessage).__name__, sMessage);
+            oData = VcsRevisionData().initFromValues(self.oConfig.sRepository, iRevision, sDate, sAuthor, sMessage);
+            oLogic.addVcsRevision(oData);
+        oDb.commit();
+
+        oDb.close();
+        return 0;
+
+if __name__ == '__main__':
+    sys.exit(VcsImport().main());
+
diff --git a/src/VBox/ValidationKit/testmanager/cgi/Makefile.kmk b/src/VBox/ValidationKit/testmanager/cgi/Makefile.kmk
new file mode 100644
index 0000000..df27b62
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/cgi/Makefile.kmk
@@ -0,0 +1,36 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+$(evalcall def_vbox_validationkit_process_js_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testmanager/cgi/admin.py b/src/VBox/ValidationKit/testmanager/cgi/admin.py
new file mode 100755
index 0000000..b28579a
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/cgi/admin.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: admin.py $
+
+"""
+CGI - Administrator Web-UI.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os
+import sys
+
+# Only the main script needs to modify the path.
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testmanager                        import config;
+from testmanager.core.webservergluecgi  import WebServerGlueCgi;
+from testmanager.webui.wuiadmin         import WuiAdmin;
+
+def main():
+    """
+    Main function a la C/C++. Returns exit code.
+    """
+
+    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True);
+    try:
+        oWui = WuiAdmin(oSrvGlue);
+        oWui.dispatchRequest();
+        oSrvGlue.flush();
+    except Exception as oXcpt:
+        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),), sys.exc_info());
+
+    return 0;
+
+if __name__ == '__main__':
+    if config.g_kfProfileAdmin:
+        from testmanager.debug import cgiprofiling;
+        sys.exit(cgiprofiling.profileIt(main));
+    else:
+        sys.exit(main());
+
diff --git a/src/VBox/ValidationKit/testmanager/cgi/debuginfo.py b/src/VBox/ValidationKit/testmanager/cgi/debuginfo.py
new file mode 100755
index 0000000..706b79e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/cgi/debuginfo.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: debuginfo.py $
+
+"""
+CGI - Debug Info Page.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os
+import sys
+
+# Only the main script needs to modify the path.
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testmanager.core.webservergluecgi  import WebServerGlueCgi;
+
+
+def main():
+    """
+    Main function a la C/C++. Returns exit code.
+    """
+
+    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True);
+    try:
+        oSrvGlue.debugInfoPage();
+        oSrvGlue.flush();
+    except Exception as oXcpt:
+        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),), sys.exc_info());
+
+    return 0;
+
+if __name__ == '__main__':
+    sys.exit(main());
+
diff --git a/src/VBox/ValidationKit/testmanager/cgi/index.py b/src/VBox/ValidationKit/testmanager/cgi/index.py
new file mode 100755
index 0000000..f573709
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/cgi/index.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: index.py $
+
+"""
+CGI - Web UI - Main (index) page.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os
+import sys
+
+# Only the main script needs to modify the path.
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testmanager                        import config;
+from testmanager.core.webservergluecgi  import WebServerGlueCgi;
+from testmanager.webui.wuimain          import WuiMain;
+
+
+def main():
+    """
+    Main function a la C/C++. Returns exit code.
+    """
+
+    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = False);
+    try:
+        oWui = WuiMain(oSrvGlue);
+        oWui.dispatchRequest();
+        oSrvGlue.flush();
+    except Exception as oXcpt:
+        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),), sys.exc_info());
+
+    return 0;
+
+if __name__ == '__main__':
+    if config.g_kfProfileIndex:
+        from testmanager.debug import cgiprofiling;
+        sys.exit(cgiprofiling.profileIt(main));
+    else:
+        sys.exit(main());
+
diff --git a/src/VBox/ValidationKit/testmanager/cgi/logout.py b/src/VBox/ValidationKit/testmanager/cgi/logout.py
new file mode 100755
index 0000000..c3aaa00
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/cgi/logout.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: logout.py $
+
+"""
+VirtualBox Validation Kit - CGI - Log out page.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os
+import sys
+
+# Only the main script needs to modify the path.
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testmanager.core.webservergluecgi import WebServerGlueCgi
+
+
+def main():
+    """
+    Main function a la C/C++. Returns exit code.
+    """
+
+    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True)
+    sUser = oSrvGlue.getLoginName()
+    if sUser != oSrvGlue.ksUnknownUser and sUser != 'logout':
+        oSrvGlue.write('<p>Broken apache config!\n'
+                       'The logout.py script should be configured with .htaccess-logout and require user logout!</p>')
+    else:
+        oSrvGlue.write('<p>Successfully logged out!</p>')
+        oSrvGlue.write('<p><a href="%sadmin.py">Log in</a> under another user name.</p>' %
+                       (oSrvGlue.getBaseUrl(),))
+
+
+        oSrvGlue.write('<hr/><p>debug info:</p>')
+        oSrvGlue.debugInfoPage()
+    oSrvGlue.flush()
+
+    return 0
+
+if __name__ == '__main__':
+    sys.exit(main())
+
diff --git a/src/VBox/ValidationKit/testmanager/cgi/logout2.py b/src/VBox/ValidationKit/testmanager/cgi/logout2.py
new file mode 100755
index 0000000..d3baefb
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/cgi/logout2.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: logout2.py $
+
+"""
+VirtualBox Validation Kit - CGI - Log out page for Safari.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os
+import sys
+
+# Only the main script needs to modify the path.
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testmanager.core.webservergluecgi import WebServerGlueCgi;
+
+
+def main():
+    """
+    Main function a la C/C++. Returns exit code.
+    """
+
+    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = True);
+    sUserAgent = oSrvGlue.getUserAgent();
+    oSrvGlue.setHeaderField('Status', '401 Unauthorized to access the document');
+    oSrvGlue.setHeaderField('WWW-authenticate', 'Basic realm="Test Manager"');
+    if  (sUserAgent.startswith('Mozilla/') and sUserAgent.find('AppleWebKit/') > 0) \
+     or False:
+        oSrvGlue.write('<p>Attempting to log out an Apple browser...</p>');
+    else:
+        oSrvGlue.write('<p>Sorry, not sure this will work...</p>');
+        oSrvGlue.write('<p>User-Agent:' + sUserAgent + '</p>');
+
+    oSrvGlue.write('<p><a href="%sadmin.py">Log in</a> under another user name.</p>' %
+                   (oSrvGlue.getBaseUrl(),))
+
+    oSrvGlue.write('<hr/><p>debug info:</p>');
+    oSrvGlue.debugInfoPage();
+    oSrvGlue.flush();
+
+    return 0;
+
+if __name__ == '__main__':
+    sys.exit(main());
+
diff --git a/src/VBox/ValidationKit/testmanager/cgi/testboxdisp.py b/src/VBox/ValidationKit/testmanager/cgi/testboxdisp.py
new file mode 100755
index 0000000..0f2babc
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/cgi/testboxdisp.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: testboxdisp.py $
+
+"""
+CGI - TestBox Interaction (see testboxscript or the other party).
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os
+import sys
+
+# Only the main script needs to modify the path.
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testmanager                        import config;
+from testmanager.core.webservergluecgi  import WebServerGlueCgi;
+from testmanager.core.testboxcontroller import TestBoxController;
+
+
+def main():
+    """
+    Main function a la C/C++. Returns exit code.
+    """
+
+    oSrvGlue = WebServerGlueCgi(g_ksValidationKitDir, fHtmlOutput = False);
+    oCtrl = TestBoxController(oSrvGlue);
+    try:
+        oCtrl.dispatchRequest()
+        oSrvGlue.flush();
+    except Exception as oXcpt:
+        return oSrvGlue.errorPage('Internal error: %s' % (str(oXcpt),),
+                                  sys.exc_info(),
+                                  config.g_ksTestBoxDispXpctLog);
+    return 0;
+
+if __name__ == '__main__':
+    sys.exit(main());
+
diff --git a/src/VBox/ValidationKit/testmanager/config.py b/src/VBox/ValidationKit/testmanager/config.py
new file mode 100644
index 0000000..32c6f59
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/config.py
@@ -0,0 +1,177 @@
+# -*- coding: utf-8 -*-
+# $Id: config.py $
+
+"""
+Test Manager Configuration.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 97536 $"
+
+import os;
+
+## Test Manager version string.
+g_ksVersion             = 'v0.0.2';
+## Test Manager revision string.
+g_ksRevision            = ('$Revision: 97536 $')[11:-2];
+
+## Enable VBox specific stuff.
+g_kfVBoxSpecific        = True;
+
+
+## @name Used by the TMDatabaseConnection class.
+# @{
+g_ksDatabaseName        = 'testmanager';
+g_ksDatabaseAddress     = None;
+g_ksDatabasePort        = None;
+g_ksDatabaseUser        = 'postgres';
+g_ksDatabasePassword    = '';
+## @}
+
+
+## @name User handling.
+## @{
+
+## Whether login names are case insensitive (True) or case sensitive (False).
+## @note Implemented by inserting lower case names into DB and lower case
+##       bind variables in WHERE clauses.
+g_kfLoginNameCaseInsensitive = True;
+
+## @}
+
+
+## @name File locations
+## @{
+
+## The TestManager directory.
+g_ksTestManagerDir      = os.path.dirname(os.path.abspath(__file__));
+## The Validation Kit directory.
+g_ksValidationKitDir        = os.path.dirname(g_ksTestManagerDir);
+## The TestManager htdoc directory.
+g_ksTmHtDocDir          = os.path.join(g_ksTestManagerDir, 'htdocs');
+## The TestManager download directory (under htdoc somewhere), for validationkit zips.
+g_ksTmDownloadDir       = os.path.join(g_ksTmHtDocDir, 'download');
+## The base URL relative path of the TM download directory (g_ksTmDownloadDir).
+g_ksTmDownloadBaseUrlRel = 'htdocs/downloads';
+## The root of the file area (referred to as TM_FILE_DIR in database docs).
+g_ksFileAreaRootDir     = '/var/tmp/testmanager'
+## The root of the file area with the zip files (best put on a big storage server).
+g_ksZipFileAreaRootDir  = '/var/tmp/testmanager2'
+## URL prefix for trac log viewer.
+g_ksTracLogUrlPrefix    = 'https://linserv.de.oracle.com/vbox/log/'
+## URL prefix for trac log viewer.
+g_ksTracChangsetUrlFmt  = 'https://linserv.de.oracle.com/%(sRepository)s/changeset/%(iRevision)s'
+## URL prefix for unprefixed build logs.
+g_ksBuildLogUrlPrefix   = ''
+## URL prefix for unprefixed build binaries.
+g_ksBuildBinUrlPrefix   = '/builds/'
+## The local path prefix for unprefixed build binaries. (Host file system, not web server.)
+g_ksBuildBinRootDir     = '/mnt/builds/'
+## File on the build binary share that can be used to check that it's mounted.
+g_ksBuildBinRootFile    = 'builds.txt'
+## @}
+
+
+## The time to wait for a gang to gather (in seconds).
+g_kcSecGangGathering    = 600;
+## The max time allowed to spend looking for a new task (in seconds).
+g_kcSecMaxNewTask       = 60;
+
+
+## @name Test result limits.
+## In general, we will fail the test when reached and stop accepting further results.
+## @{
+
+## The max number of test results per test set.
+g_kcMaxTestResultsPerTS = 4096;
+## The max number of test results (children) per test result.
+g_kcMaxTestResultsPerTR = 512;
+## The max number of test result values per test set.
+g_kcMaxTestValuesPerTS  = 4096;
+## The max number of test result values per test result.
+g_kcMaxTestValuesPerTR  = 256;
+## The max number of test result message per test result.
+g_kcMaxTestMsgsPerTR    = 4;
+## The max test result nesting depth.
+g_kcMaxTestResultDepth  = 8;
+
+## The max length of a test result name.
+g_kcchMaxTestResultName = 64;
+## The max length of a test result value name.
+g_kcchMaxTestValueName  = 56;
+## The max length of a test result message.
+g_kcchMaxTestMsg        = 128;
+
+## The max size of the main log file.
+g_kcMbMaxMainLog        = 32;
+## The max size of an uploaded file (individual).
+g_kcMbMaxUploadSingle   = 16;
+## The max size of all uploaded file.
+g_kcMbMaxUploadTotal    = 128;
+## The max number of files that can be uploaded.
+g_kcMaxUploads          = 256;
+## @}
+
+## @name Debug Features
+## @{
+
+## Enables extra DB exception information.
+g_kfDebugDbXcpt         = True;
+
+## Where to write the glue debug.
+# None indicates apache error log, string indicates a file.
+#g_ksSrcGlueDebugLogDst  = '/tmp/testmanager-srv-glue.log';
+g_ksSrcGlueDebugLogDst  = None;
+## Whether to enable CGI trace back in the server glue.
+g_kfSrvGlueCgiTb        = False;
+## Enables glue debug output.
+g_kfSrvGlueDebug        = False;
+## Timestamp the glue debug output.
+g_kfSrvGlueDebugTS      = True;
+## Enables task scheduler debug output to g_ksSrcGlueDebugLogDst.
+g_kfSrvGlueDebugScheduler = False;
+
+## Enables the SQL trace back.
+g_kfWebUiSqlTrace       = False;
+## Enables the explain in the SQL trace back.
+g_kfWebUiSqlTraceExplain = False;
+## Whether the postgresql version supports the TIMING option on EXPLAIN (>= 9.2).
+g_kfWebUiSqlTraceExplainTiming = False;
+## Display time spent processing the page.
+g_kfWebUiProcessedIn    = True;
+## Enables WebUI debug output.
+g_kfWebUiDebug          = False;
+## Enables WebUI SQL debug output print() calls (requires g_kfWebUiDebug).
+g_kfWebUiSqlDebug       = False;
+## Enables the debug panel at the bottom of the page.
+g_kfWebUiDebugPanel     = True;
+
+## Profile cgi/admin.py.
+g_kfProfileAdmin        = False;
+## Profile cgi/index.py.
+g_kfProfileIndex        = False;
+
+## When not None,
+g_ksTestBoxDispXpctLog  = '/tmp/testmanager-testboxdisp-xcpt.log'
+## @}
+
diff --git a/src/VBox/ValidationKit/testmanager/core/Makefile.kmk b/src/VBox/ValidationKit/testmanager/core/Makefile.kmk
new file mode 100644
index 0000000..df27b62
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/Makefile.kmk
@@ -0,0 +1,36 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+$(evalcall def_vbox_validationkit_process_js_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testmanager/core/__init__.py b/src/VBox/ValidationKit/testmanager/core/__init__.py
new file mode 100644
index 0000000..4012de5
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/__init__.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# $Id: __init__.py $
+
+"""
+TestBox Script - Core Logic.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
diff --git a/src/VBox/ValidationKit/testmanager/core/base.py b/src/VBox/ValidationKit/testmanager/core/base.py
new file mode 100644
index 0000000..c95fd39
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/base.py
@@ -0,0 +1,1129 @@
+# -*- coding: utf-8 -*-
+# $Id: base.py $
+# pylint: disable=C0302
+
+"""
+Test Manager Core - Base Class(es).
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import copy;
+import re;
+import socket;
+import sys;
+import uuid;
+import unittest;
+
+# Validation Kit imports.
+from common import utils;
+
+# Python 3 hacks:
+if sys.version_info[0] >= 3:
+    long = int      # pylint: disable=W0622,C0103
+
+
+class TMExceptionBase(Exception):
+    """
+    For exceptions raised by any TestManager component.
+    """
+    pass;
+
+class TMTooManyRows(TMExceptionBase):
+    """
+    Too many rows in the result.
+    Used by ModelLogicBase decendants.
+    """
+    pass;
+
+
+class ModelBase(object): # pylint: disable=R0903
+    """
+    Something all classes in the logical model inherits from.
+
+    Not sure if 'logical model' is the right term here.
+    Will see if it has any purpose later on...
+    """
+
+    def __init__(self):
+        pass;
+
+
+class ModelDataBase(ModelBase): # pylint: disable=R0903
+    """
+    Something all classes in the data classes in the logical model inherits from.
+    """
+
+    ## Child classes can use this to list array attributes which should use
+    # an empty array ([]) instead of None as database NULL value.
+    kasAltArrayNull = [];
+
+
+    def __init__(self):
+        ModelBase.__init__(self);
+
+
+    #
+    # Standard methods implemented by combining python magic and hungarian prefixes.
+    #
+
+    def getDataAttributes(self):
+        """
+        Returns a list of data attributes.
+        """
+        asRet   = [];
+        asAttrs = dir(self);
+        for sAttr in asAttrs:
+            if sAttr[0] == '_' or sAttr[0] == 'k':
+                continue;
+            oValue = getattr(self, sAttr);
+            if callable(oValue):
+                continue;
+            asRet.append(sAttr);
+        return asRet;
+
+    def initFromOther(self, oOther):
+        """
+        Initialize this object with the values from another instance (child
+        class instance is accepted).
+
+        This serves as a kind of copy constructor.
+
+        Returns self.  May raise exception if the type of other object differs
+        or is damaged.
+        """
+        for sAttr in self.getDataAttributes():
+            setattr(self, sAttr, getattr(oOther, sAttr));
+        return self;
+
+    @staticmethod
+    def getHungarianPrefix(sName):
+        """
+        Returns the hungarian prefix of the given name.
+        """
+        for i in range(len(sName)):
+            if sName[i] not in ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+                                'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']:
+                assert re.search('^[A-Z][a-zA-Z0-9]*$', sName[i:]) is not None;
+                return sName[:i];
+        return sName;
+
+    def getAttributeParamNullValues(self, sAttr):
+        """
+        Returns a list of parameter NULL values, with the preferred one being
+        the first element.
+
+        Child classes can override this to handle one or more attributes specially.
+        """
+        sPrefix = self.getHungarianPrefix(sAttr);
+        if sPrefix in ['id', 'uid', 'i', 'off', 'pct']:
+            return [-1, '', '-1',];
+        elif sPrefix in ['l', 'c',]:
+            return [long(-1), '', '-1',];
+        elif sPrefix == 'f':
+            return ['',];
+        elif sPrefix in ['enm', 'ip', 's', 'ts', 'uuid']:
+            return ['',];
+        elif sPrefix in ['ai', 'aid', 'al', 'as']:
+            return [[], '', None]; ## @todo ??
+        elif sPrefix == 'bm':
+            return ['', [],]; ## @todo bitmaps.
+        raise TMExceptionBase('Unable to classify "%s" (prefix %s)' % (sAttr, sPrefix));
+
+    def isAttributeNull(self, sAttr, oValue):
+        """
+        Checks if the specified attribute value indicates NULL.
+        Return True/False.
+
+        Note! This isn't entirely kosher actually.
+        """
+        if oValue is None:
+            return True;
+        aoNilValues = self.getAttributeParamNullValues(sAttr);
+        return oValue in aoNilValues;
+
+    def _convertAttributeFromParamNull(self, sAttr, oValue):
+        """
+        Converts an attribute from parameter NULL to database NULL value.
+        Returns the new attribute value.
+        """
+        aoNullValues = self.getAttributeParamNullValues(sAttr);
+        if oValue in aoNullValues:
+            oValue = None if sAttr not in self.kasAltArrayNull else [];
+        #
+        # Perform deep conversion on ModelDataBase object and lists of them.
+        #
+        elif isinstance(oValue, list) and len(oValue) > 0 and isinstance(oValue[0], ModelDataBase):
+            oValue = copy.copy(oValue);
+            for i in range(len(oValue)):
+                assert isinstance(oValue[i], ModelDataBase);
+                oValue[i] = copy.copy(oValue[i]);
+                oValue[i].convertFromParamNull();
+
+        elif isinstance(oValue, ModelDataBase):
+            oValue = copy.copy(oValue);
+            oValue.convertFromParamNull();
+
+        return oValue;
+
+    def convertFromParamNull(self):
+        """
+        Converts from parameter NULL values to database NULL values (None).
+        Returns self.
+        """
+        for sAttr in self.getDataAttributes():
+            oValue = getattr(self, sAttr);
+            oNewValue = self._convertAttributeFromParamNull(sAttr, oValue);
+            if oValue != oNewValue:
+                setattr(self, sAttr, oNewValue);
+        return self;
+
+    def _convertAttributeToParamNull(self, sAttr, oValue):
+        """
+        Converts an attribute from database NULL to a sepcial value we can pass
+        thru parameter list.
+        Returns the new attribute value.
+        """
+        if oValue is None:
+            oValue = self.getAttributeParamNullValues(sAttr)[0];
+        #
+        # Perform deep conversion on ModelDataBase object and lists of them.
+        #
+        elif isinstance(oValue, list) and len(oValue) > 0 and isinstance(oValue[0], ModelDataBase):
+            oValue = copy.copy(oValue);
+            for i in range(len(oValue)):
+                assert isinstance(oValue[i], ModelDataBase);
+                oValue[i] = copy.copy(oValue[i]);
+                oValue[i].convertToParamNull();
+
+        elif isinstance(oValue, ModelDataBase):
+            oValue = copy.copy(oValue);
+            oValue.convertToParamNull();
+
+        return oValue;
+
+    def convertToParamNull(self):
+        """
+        Converts from database NULL values (None) to special values we can
+        pass thru parameters list.
+        Returns self.
+        """
+        for sAttr in self.getDataAttributes():
+            oValue = getattr(self, sAttr);
+            oNewValue = self._convertAttributeToParamNull(sAttr, oValue);
+            if oValue != oNewValue:
+                setattr(self, sAttr, oNewValue);
+        return self;
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        """
+        Validates and convert one attribute.
+        Returns the converted value.
+
+        Child classes can override this to handle one or more attributes specially.
+        Note! oDb can be None.
+        """
+        sPrefix = self.getHungarianPrefix(sAttr);
+
+        if sPrefix in ['id', 'uid']:
+            (oNewValue, sError) = self.validateInt( oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull);
+        elif sPrefix in ['i', 'off', 'pct']:
+            (oNewValue, sError) = self.validateInt( oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                    iMin = getattr(self, 'kiMin_' + sAttr, 0),
+                                                    iMax = getattr(self, 'kiMax_' + sAttr, 0x7ffffffe));
+        elif sPrefix in ['l', 'c']:
+            (oNewValue, sError) = self.validateLong(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                    lMin = getattr(self, 'klMin_' + sAttr, 0),
+                                                    lMax = getattr(self, 'klMax_' + sAttr, None));
+        elif sPrefix == 'f':
+            if oValue is '' and not fAllowNull: oValue = '0'; # HACK ALERT! Checkboxes are only added when checked.
+            (oNewValue, sError) = self.validateBool(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull);
+        elif sPrefix == 'ts':
+            (oNewValue, sError) = self.validateTs(  oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull);
+        elif sPrefix == 'ip':
+            (oNewValue, sError) = self.validateIp(  oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull);
+        elif sPrefix == 'uuid':
+            (oNewValue, sError) = self.validateUuid(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull);
+        elif sPrefix == 'enm':
+            (oNewValue, sError) = self.validateWord(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                    asValid = getattr(self, 'kasValidValues_' + sAttr)); # The list is required.
+        elif sPrefix == 's':
+            (oNewValue, sError) = self.validateStr( oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                    cchMin = getattr(self, 'kcchMin_' + sAttr, 0),
+                                                    cchMax = getattr(self, 'kcchMax_' + sAttr, 4096));
+        ## @todo al.
+        elif sPrefix == 'aid':
+            (oNewValue, sError) = self.validateListOfInts(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                          iMin = 1, iMax = 0x7ffffffe);
+        elif sPrefix == 'as':
+            (oNewValue, sError) = self.validateListOfStr(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                         asValidValues = getattr(self, 'kasValidValues_' + sAttr, None),
+                                                         cchMin = getattr(self, 'kcchMin_' + sAttr, 0 if fAllowNull else 1),
+                                                         cchMax = getattr(self, 'kcchMax_' + sAttr, 4096));
+
+        elif sPrefix == 'bm':
+            ## @todo figure out bitfields.
+            (oNewValue, sError) = self.validateListOfStr(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull);
+        else:
+            raise TMExceptionBase('Unable to classify "%s" (prefix %s)' % (sAttr, sPrefix));
+
+        _ = sParam; _ = oDb;
+        return (oNewValue, sError);
+
+    def _validateAndConvertWorker(self, asAllowNullAttributes, oDb):
+        """
+        Worker for implementing validateAndConvert().
+        """
+        dErrors = dict();
+        for sAttr in self.getDataAttributes():
+            oValue      = getattr(self, sAttr);
+            sParam      = getattr(self, 'ksParam_' + sAttr);
+            aoNilValues = self.getAttributeParamNullValues(sAttr);
+            aoNilValues.append(None);
+
+            (oNewValue, sError) = self._validateAndConvertAttribute(sAttr, sParam, oValue, aoNilValues,
+                                                                    sAttr in asAllowNullAttributes, oDb);
+            if oValue != oNewValue:
+                setattr(self, sAttr, oNewValue);
+            if sError is not None:
+                dErrors[sParam] = sError;
+        return dErrors;
+
+    def validateAndConvert(self, oDb):
+        """
+        Validates the input and converts valid fields to their right type.
+        Returns a dictionary with per field reports, only invalid fields will
+        be returned, so an empty dictionary means that the data is valid.
+
+        The dictionary keys are ksParam_*.
+
+        Child classes can override _validateAndConvertAttribute to handle
+        selected fields specially.  There are also a few class variables that
+        can be used to advice the validation: kcchMin_sAttr, kcchMax_sAttr,
+            kiMin_iAttr, kiMax_iAttr, klMin_lAttr, klMax_lAttr,
+            kasValidValues_enmAttr, and kasAllowNullAttributes.
+        """
+        return self._validateAndConvertWorker(getattr(self, 'kasAllowNullAttributes', list()), oDb);
+
+    def convertParamToAttribute(self, sAttr, sParam, oValue, oDisp, fStrict):
+        """
+        Calculate the attribute value when initialized from a parameter.
+
+        Returns the new value, with parameter NULL values. Raises exception on
+        invalid parameter value.
+
+        Child classes can override to do special parameter conversion jobs.
+        """
+        sPrefix = self.getHungarianPrefix(sAttr);
+        asValidValues = getattr(self, 'kasValidValues_' + sAttr, None);
+        if fStrict:
+            if sPrefix == 'f':
+                # HACK ALERT! Checkboxes are only present when checked, so we always have to provide a default.
+                oNewValue = oDisp.getStringParam(sParam, asValidValues, '0');
+            elif sPrefix[0] == 'a':
+                # HACK ALERT! List are not present if empty.
+                oNewValue = oDisp.getListOfStrParams(sParam, []);
+            else:
+                oNewValue = oDisp.getStringParam(sParam, asValidValues, None);
+        else:
+            if sPrefix[0] == 'a':
+                oNewValue = oDisp.getListOfStrParams(sParam, []);
+            else:
+                assert oValue is not None, 'sAttr=%s' % (sAttr,);
+                oNewValue = oDisp.getStringParam(sParam, asValidValues, oValue);
+        return oNewValue;
+
+    def initFromParams(self, oDisp, fStrict = True):
+        """
+        Initialize the object from parameters.
+        The input is not validated at all, except that all parameters must be
+        present when fStrict is True.
+
+        Returns self. Raises exception on invalid parameter value.
+
+        Note! The returned object has parameter NULL values, not database ones!
+        """
+
+        self.convertToParamNull()
+        for sAttr in self.getDataAttributes():
+            oValue    = getattr(self, sAttr);
+            oNewValue = self.convertParamToAttribute(sAttr, getattr(self, 'ksParam_' + sAttr), oValue, oDisp, fStrict);
+            if oNewValue != oValue:
+                setattr(self, sAttr, oNewValue);
+        return self;
+
+    def areAttributeValuesEqual(self, sAttr, sPrefix, oValue1, oValue2):
+        """
+        Called to compare two attribute values and python thinks differs.
+
+        Returns True/False.
+
+        Child classes can override this to do special compares of things like arrays.
+        """
+        # Just in case someone uses it directly.
+        if oValue1 == oValue2:
+            return True;
+
+        #
+        # Timestamps can be both string (param) and object (db)
+        # depending on the data source.  Compare string values to make
+        # sure we're doing the right thing here.
+        #
+        if sPrefix == 'ts':
+            return str(oValue1) == str(oValue2);
+
+        #
+        # Some generic code handling ModelDataBase children.
+        #
+        if isinstance(oValue1, list) and isinstance(oValue2, list):
+            if len(oValue1) == len(oValue2):
+                for i in range(len(oValue1)):
+                    if   not isinstance(oValue1[i], ModelDataBase) \
+                      or type(oValue1) != type(oValue2):
+                        return False;
+                    if not oValue1[i].isEqual(oValue2[i]):
+                        return False;
+                return True;
+
+        elif  isinstance(oValue1, ModelDataBase) \
+          and type(oValue1) == type(oValue2):
+            return oValue1[i].isEqual(oValue2[i]);
+
+        _ = sAttr;
+        return False;
+
+    def isEqual(self, oOther):
+        """ Compares two instances. """
+        for sAttr in self.getDataAttributes():
+            if getattr(self, sAttr) != getattr(oOther, sAttr):
+                # Delegate the final decision to an overridable method.
+                if not self.areAttributeValuesEqual(sAttr, self.getHungarianPrefix(sAttr),
+                                                    getattr(self, sAttr), getattr(oOther, sAttr)):
+                    return False;
+        return True;
+
+    def isEqualEx(self, oOther, asExcludeAttrs):
+        """ Compares two instances, omitting the given attributes. """
+        for sAttr in self.getDataAttributes():
+            if    sAttr not in asExcludeAttrs \
+              and getattr(self, sAttr) != getattr(oOther, sAttr):
+                # Delegate the final decision to an overridable method.
+                if not self.areAttributeValuesEqual(sAttr, self.getHungarianPrefix(sAttr),
+                                                    getattr(self, sAttr), getattr(oOther, sAttr)):
+                    return False;
+        return True;
+
+    def reinitToNull(self):
+        """
+        Reinitializes the object to (database) NULL values.
+        Returns self.
+        """
+        for sAttr in self.getDataAttributes():
+            setattr(self, sAttr, None);
+        return self;
+
+    def toString(self):
+        """
+        Stringifies the object.
+        Returns string representation.
+        """
+
+        sMembers = '';
+        for sAttr in self.getDataAttributes():
+            oValue = getattr(self, sAttr);
+            sMembers += ', %s=%s' % (sAttr, oValue);
+
+        oClass = type(self);
+        if sMembers == '':
+            return '<%s>' % (oClass.__name__);
+        return '<%s: %s>' % (oClass.__name__, sMembers[2:]);
+
+    def __str__(self):
+        return self.toString();
+
+
+
+    #
+    # New validation helpers.
+    #
+    # These all return (oValue, sError), where sError is None when the value
+    # is valid and an error message when not.  On success and in case of
+    # range errors, oValue is converted into the requested type.
+    #
+
+    @staticmethod
+    def validateInt(sValue, iMin = 0, iMax = 0x7ffffffe, aoNilValues = tuple([-1, None, '']), fAllowNull = True):
+        """ Validates an integer field. """
+        if sValue in aoNilValues:
+            if fAllowNull:
+                return (None if sValue is None else aoNilValues[0], None);
+            return (sValue, 'Mandatory.');
+
+        try:
+            if utils.isString(sValue):
+                iValue = int(sValue, 0);
+            else:
+                iValue = int(sValue);
+        except:
+            return (sValue, 'Not an integer');
+
+        if iValue in aoNilValues:
+            return (aoNilValues[0], None if fAllowNull else 'Mandatory.');
+
+        if iValue < iMin:
+            return (iValue, 'Value too small (min %d)' % (iMin,));
+        elif iValue > iMax:
+            return (iValue, 'Value too high (max %d)' % (iMax,));
+        return (iValue, None);
+
+    @staticmethod
+    def validateLong(sValue, lMin = 0, lMax = None, aoNilValues = tuple([long(-1), None, '']), fAllowNull = True):
+        """ Validates an long integer field. """
+        if sValue in aoNilValues:
+            if fAllowNull:
+                return (None if sValue is None else aoNilValues[0], None);
+            return (sValue, 'Mandatory.');
+        try:
+            if utils.isString(sValue):
+                lValue = long(sValue, 0);
+            else:
+                lValue = long(sValue);
+        except:
+            return (sValue, 'Not a long integer');
+
+        if lValue in aoNilValues:
+            return (aoNilValues[0], None if fAllowNull else 'Mandatory.');
+
+        if lMin is not None and lValue < lMin:
+            return (lValue, 'Value too small (min %d)' % (lMin,));
+        elif lMax is not None and lValue > lMax:
+            return (lValue, 'Value too high (max %d)' % (lMax,));
+        return (lValue, None);
+
+    @staticmethod
+    def validateTs(sValue, aoNilValues = tuple([None, '']), fAllowNull = True):
+        """ Validates a timestamp field. """
+        if sValue in aoNilValues:
+            return (sValue, None if fAllowNull else 'Mandatory.');
+        if not utils.isString(sValue):
+            return (sValue, None);
+
+        sError = None;
+        if len(sValue) == len('2012-10-08 01:54:06.364207+02:00'):
+            oRes = re.match(r'(\d{4})-([01]\d)-([0123])\d ([012]\d):[0-5]\d:([0-6]\d).\d{6}[+-](\d\d):(\d\d)', sValue);
+            if    oRes is not None \
+              and (   int(oRes.group(6)) >  12 \
+                   or int(oRes.group(7)) >= 60):
+                sError = 'Invalid timezone offset.';
+        elif len(sValue) == len('2012-10-08 01:54:06.00'):
+            oRes = re.match(r'(\d{4})-([01]\d)-([0123])\d ([012]\d):[0-5]\d:([0-6]\d).\d{2}', sValue);
+        elif len(sValue) == len('9999-12-31 23:59:59.999999'):
+            oRes = re.match(r'(\d{4})-([01]\d)-([0123])\d ([012]\d):[0-5]\d:([0-6]\d).\d{6}', sValue);
+        elif len(sValue) == len('999999-12-31 00:00:00.00'):
+            oRes = re.match(r'(\d{6})-([01]\d)-([0123])\d ([012]\d):[0-5]\d:([0-6]\d).\d{2}', sValue);
+        elif len(sValue) == len('9999-12-31T23:59:59.999999Z'):
+            oRes = re.match(r'(\d{4})-([01]\d)-([0123])\d[Tt]([012]\d):[0-5]\d:([0-6]\d).\d{6}[Zz]', sValue);
+        elif len(sValue) == len('9999-12-31T23:59:59.999999999Z'):
+            oRes = re.match(r'(\d{4})-([01]\d)-([0123])\d[Tt]([012]\d):[0-5]\d:([0-6]\d).\d{9}[Zz]', sValue);
+        else:
+            return (sValue, 'Invalid timestamp length.');
+
+        if oRes is None:
+            sError = 'Invalid timestamp (format: 2012-10-08 01:54:06.364207+02:00).';
+        else:
+            iYear  = int(oRes.group(1));
+            if iYear % 4 == 0 and (iYear % 100 != 0  or iYear % 400 == 0):
+                acDaysOfMonth = [31, 29, 31,  30, 31, 30,  31, 31, 30,  31, 30, 31];
+            else:
+                acDaysOfMonth = [31, 28, 31,  30, 31, 30,  31, 31, 30,  31, 30, 31];
+            iMonth = int(oRes.group(2));
+            iDay   = int(oRes.group(3));
+            iHour  = int(oRes.group(4));
+            iSec   = int(oRes.group(5));
+            if iMonth > 12:
+                sError = 'Invalid timestamp month.';
+            elif iDay > acDaysOfMonth[iMonth - 1]:
+                sError = 'Invalid timestamp day-of-month (%02d has %d days).' % (iMonth, acDaysOfMonth[iMonth - 1]);
+            elif iHour > 23:
+                sError = 'Invalid timestamp hour.'
+            elif iSec >= 61:
+                sError = 'Invalid timestamp second.'
+            elif iSec >= 60:
+                sError = 'Invalid timestamp: no leap seconds, please.'
+        return (sValue, sError);
+
+    @staticmethod
+    def validateIp(sValue, aoNilValues = tuple([None, '']), fAllowNull = True):
+        """ Validates an IP address field. """
+        if sValue in aoNilValues:
+            return (sValue, None if fAllowNull else 'Mandatory.');
+
+        if sValue == '::1':
+            return (sValue, None);
+
+        try:
+            socket.inet_pton(socket.AF_INET, sValue); # pylint: disable=E1101
+        except:
+            try:
+                socket.inet_pton(socket.AF_INET6, sValue); # pylint: disable=E1101
+            except:
+                return (sValue, 'Not a valid IP address.');
+
+        return (sValue, None);
+
+    @staticmethod
+    def validateBool(sValue, aoNilValues = tuple([None, '']), fAllowNull = True):
+        """ Validates a boolean field. """
+        if sValue in aoNilValues:
+            return (sValue, None if fAllowNull else 'Mandatory.');
+
+        if sValue in ('True', 'true', '1', True):
+            return (True, None);
+        if sValue in ('False', 'false', '0', False):
+            return (False, None);
+        return (sValue, 'Invalid boolean value.');
+
+    @staticmethod
+    def validateUuid(sValue, aoNilValues = tuple([None, '']), fAllowNull = True):
+        """ Validates an UUID field. """
+        if sValue in aoNilValues:
+            return (sValue, None if fAllowNull else 'Mandatory.');
+
+        try:
+            sValue = str(uuid.UUID(sValue));
+        except:
+            return (sValue, 'Invalid UUID value.');
+        return (sValue, None);
+
+    @staticmethod
+    def validateWord(sValue, cchMin = 1, cchMax = 64, asValid = None, aoNilValues = tuple([None, '']), fAllowNull = True):
+        """ Validates a word field. """
+        if sValue in aoNilValues:
+            return (sValue, None if fAllowNull else 'Mandatory.');
+
+        if re.search('[^a-zA-Z0-9_-]', sValue) is not None:
+            sError = 'Single word ([a-zA-Z0-9_-]), please.';
+        elif cchMin is not None and len(sValue) < cchMin:
+            sError = 'Too short, min %s chars' % (cchMin,);
+        elif cchMax is not None and len(sValue) > cchMax:
+            sError = 'Too long, max %s chars' % (cchMax,);
+        elif asValid is not None and sValue not in asValid:
+            sError = 'Invalid value "%s", must be one of: %s' % (sValue, asValid);
+        else:
+            sError = None;
+        return (sValue, sError);
+
+    @staticmethod
+    def validateStr(sValue, cchMin = 0, cchMax = 4096, aoNilValues = tuple([None, '']), fAllowNull = True, fAllowUnicodeSymbols = False): # pylint: disable=C0301
+        """ Validates a string field. """
+        if sValue in aoNilValues:
+            return (sValue, None if fAllowNull else 'Mandatory.');
+
+        if cchMin is not None and len(sValue) < cchMin:
+            sError = 'Too short, min %s chars' % (cchMin,);
+        elif cchMax is not None and len(sValue) > cchMax:
+            sError = 'Too long, max %s chars' % (cchMax,);
+        elif fAllowUnicodeSymbols is False and utils.hasNonAsciiCharacters(sValue):
+            sError = 'Non-ascii characters not allowed'
+        else:
+            sError = None;
+        return (sValue, sError);
+
+    @staticmethod
+    def validateEmail(sValue, aoNilValues = tuple([None, '']), fAllowNull = True):
+        """ Validates a email field."""
+        if sValue in aoNilValues:
+            return (sValue, None if fAllowNull else 'Mandatory.');
+
+        if re.match(r'.+ at .+\..+', sValue) is None:
+            return (sValue,'Invalid e-mail format.');
+        return (sValue, None);
+
+    @staticmethod
+    def validateListOfSomething(asValues, aoNilValues = tuple([[], None]), fAllowNull = True):
+        """ Validate a list of some uniform values. Returns a copy of the list (if list it is). """
+        if asValues in aoNilValues  or  (len(asValues) == 0 and not fAllowNull):
+            return (asValues, None if fAllowNull else 'Mandatory.')
+
+        if not isinstance(asValues, list):
+            return (asValues, 'Invalid data type (%s).' % (type(asValues),));
+
+        asValues = list(asValues); # copy the list.
+        if len(asValues) > 0:
+            oType = type(asValues[0]);
+            for i in range(1, len(asValues)):
+                if type(asValues[i]) is not oType:
+                    return (asValues, 'Invalid entry data type ([0]=%s vs [%d]=%s).' % (oType, i, type(asValues[i])) );
+
+        return (asValues, None);
+
+    @staticmethod
+    def validateListOfStr(asValues, cchMin = None, cchMax = None, asValidValues = None,
+                          aoNilValues = tuple([[], None]), fAllowNull = True):
+        """ Validates a list of text items."""
+        (asValues, sError) = ModelDataBase.validateListOfSomething(asValues, aoNilValues, fAllowNull);
+
+        if sError is None  and asValues not in aoNilValues  and  len(asValues) > 0:
+            if not utils.isString(asValues[0]):
+                return (asValues, 'Invalid item data type.');
+
+            if not fAllowNull and cchMin is None:
+                cchMin = 1;
+
+            for sValue in asValues:
+                if asValidValues is not None  and  sValue not in asValidValues:
+                    sThisErr = 'Invalid value "%s".' % (sValue,);
+                elif cchMin is not None  and  len(sValue) < cchMin:
+                    sThisErr = 'Value "%s" is too short, min length is %u chars.' % (sValue, cchMin);
+                elif cchMax is not None  and  len(sValue) > cchMax:
+                    sThisErr = 'Value "%s" is too long, max length is %u chars.' % (sValue, cchMax);
+                else:
+                    continue;
+
+                if sError is None:
+                    sError = sThisErr;
+                else:
+                    sError += ' ' + sThisErr;
+
+        return (asValues, sError);
+
+    @staticmethod
+    def validateListOfInts(asValues, iMin = 0, iMax = 0x7ffffffe, aoNilValues = tuple([[], None]), fAllowNull = True):
+        """ Validates a list of integer items."""
+        (asValues, sError) = ModelDataBase.validateListOfSomething(asValues, aoNilValues, fAllowNull);
+
+        if sError is None  and asValues not in aoNilValues  and  len(asValues) > 0:
+            for i in range(len(asValues)):
+                sValue = asValues[i];
+
+                sThisErr = '';
+                try:
+                    iValue = int(sValue);
+                except:
+                    sThisErr = 'Invalid integer value "%s".' % (sValue,);
+                else:
+                    asValues[i] = iValue;
+                    if iValue < iMin:
+                        sThisErr = 'Value %d is too small (min %d)' % (iValue, iMin,);
+                    elif iValue > iMax:
+                        sThisErr = 'Value %d is too high (max %d)' % (iValue, iMax,);
+                    else:
+                        continue;
+
+                if sError is None:
+                    sError = sThisErr;
+                else:
+                    sError += ' ' + sThisErr;
+
+        return (asValues, sError);
+
+
+
+    #
+    # Old validation helpers.
+    #
+
+    @staticmethod
+    def _validateInt(dErrors, sName, sValue, iMin = 0, iMax = 0x7ffffffe, aoNilValues = tuple([-1, None, ''])):
+        """ Validates an integer field. """
+        (sValue, sError) = ModelDataBase.validateInt(sValue, iMin, iMax, aoNilValues, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateIntNN(dErrors, sName, sValue, iMin = 0, iMax = 0x7ffffffe, aoNilValues = tuple([-1, None, ''])):
+        """ Validates an integer field, not null. """
+        (sValue, sError) = ModelDataBase.validateInt(sValue, iMin, iMax, aoNilValues, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateLong(dErrors, sName, sValue, lMin = 0, lMax = None, aoNilValues = tuple([long(-1), None, ''])):
+        """ Validates an long integer field. """
+        (sValue, sError) = ModelDataBase.validateLong(sValue, lMin, lMax, aoNilValues, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateLongNN(dErrors, sName, sValue, lMin = 0, lMax = None, aoNilValues = tuple([long(-1), None, ''])):
+        """ Validates an long integer field, not null. """
+        (sValue, sError) = ModelDataBase.validateLong(sValue, lMin, lMax, aoNilValues, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateTs(dErrors, sName, sValue):
+        """ Validates a timestamp field. """
+        (sValue, sError) = ModelDataBase.validateTs(sValue, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateTsNN(dErrors, sName, sValue):
+        """ Validates a timestamp field, not null. """
+        (sValue, sError) = ModelDataBase.validateTs(sValue, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateIp(dErrors, sName, sValue):
+        """ Validates an IP address field. """
+        (sValue, sError) = ModelDataBase.validateIp(sValue, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateIpNN(dErrors, sName, sValue):
+        """ Validates an IP address field, not null. """
+        (sValue, sError) = ModelDataBase.validateIp(sValue, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateBool(dErrors, sName, sValue):
+        """ Validates a boolean field. """
+        (sValue, sError) = ModelDataBase.validateBool(sValue, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateBoolNN(dErrors, sName, sValue):
+        """ Validates a boolean field, not null. """
+        (sValue, sError) = ModelDataBase.validateBool(sValue, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateUuid(dErrors, sName, sValue):
+        """ Validates an UUID field. """
+        (sValue, sError) = ModelDataBase.validateUuid(sValue, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateUuidNN(dErrors, sName, sValue):
+        """ Validates an UUID field, not null. """
+        (sValue, sError) = ModelDataBase.validateUuid(sValue, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateWord(dErrors, sName, sValue, cchMin = 1, cchMax = 64, asValid = None):
+        """ Validates a word field. """
+        (sValue, sError) = ModelDataBase.validateWord(sValue, cchMin, cchMax, asValid, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateWordNN(dErrors, sName, sValue, cchMin = 1, cchMax = 64, asValid = None):
+        """ Validates a boolean field, not null. """
+        (sValue, sError) = ModelDataBase.validateWord(sValue, cchMin, cchMax, asValid, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateStr(dErrors, sName, sValue, cchMin = 0, cchMax = 4096):
+        """ Validates a string field. """
+        (sValue, sError) = ModelDataBase.validateStr(sValue, cchMin, cchMax, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateStrNN(dErrors, sName, sValue, cchMin = 0, cchMax = 4096):
+        """ Validates a string field, not null. """
+        (sValue, sError) = ModelDataBase.validateStr(sValue, cchMin, cchMax, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateEmail(dErrors, sName, sValue):
+        """ Validates a email field."""
+        (sValue, sError) = ModelDataBase.validateEmail(sValue, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateEmailNN(dErrors, sName, sValue):
+        """ Validates a email field."""
+        (sValue, sError) = ModelDataBase.validateEmail(sValue, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateListOfStr(dErrors, sName, asValues, asValidValues = None):
+        """ Validates a list of text items."""
+        (sValue, sError) = ModelDataBase.validateListOfStr(asValues, asValidValues = asValidValues, fAllowNull = True);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    @staticmethod
+    def _validateListOfStrNN(dErrors, sName, asValues, asValidValues = None):
+        """ Validates a list of text items, not null and len >= 1."""
+        (sValue, sError) = ModelDataBase.validateListOfStr(asValues, asValidValues = asValidValues, fAllowNull = False);
+        if sError is not None:
+            dErrors[sName] = sError;
+        return sValue;
+
+    #
+    # Various helpers.
+    #
+
+    @staticmethod
+    def formatSimpleNowAndPeriod(oDb, tsNow = None, sPeriodBack = None,
+                                 sTablePrefix = '', sExpCol = 'tsExpire', sEffCol = 'tsEffective'):
+        """
+        Formats a set of tsNow and sPeriodBack arguments for a standard testmanager
+        table.
+
+        If sPeriodBack is given, the query is effective for the period
+        (tsNow - sPeriodBack) thru (tsNow).
+
+        If tsNow isn't given, it defaults to current time.
+
+        Returns the final portion of a WHERE query (start with AND) and maybe an
+        ORDER BY and LIMIT bit if sPeriodBack is given.
+        """
+        if tsNow is not None:
+            if sPeriodBack is not None:
+                sRet = oDb.formatBindArgs('  AND  ' + sTablePrefix + sExpCol + ' > (%s::timestamp - %s::interval)\n'
+                                          '  AND  tsEffective <= %s\n'
+                                          'ORDER BY ' + sTablePrefix + sExpCol + ' DESC\n'
+                                          'LIMIT 1\n'
+                                          , ( tsNow, sPeriodBack, tsNow));
+            else:
+                sRet = oDb.formatBindArgs('  AND  ' + sTablePrefix + sExpCol + '     > %s\n'
+                                          '  AND  ' + sTablePrefix + sEffCol + ' <= %s\n'
+                                          , ( tsNow, tsNow, ));
+        else:
+            if sPeriodBack is not None:
+                sRet = oDb.formatBindArgs('  AND  ' + sTablePrefix + sExpCol + '     > (CURRENT_TIMESTAMP - %s::interval)\n'
+                                          '  AND  ' + sTablePrefix + sEffCol + ' <= CURRENT_TIMESTAMP\n'
+                                          'ORDER BY ' + sTablePrefix + sExpCol + ' DESC\n'
+                                          'LIMIT 1\n'
+                                          , ( sPeriodBack, ));
+            else:
+                sRet = '  AND  ' + sTablePrefix + sExpCol + '     = \'infinity\'::timestamp\n';
+        return sRet;
+
+    @staticmethod
+    def formatSimpleNowAndPeriodQuery(oDb, sQuery, aBindArgs, tsNow = None, sPeriodBack = None,
+                                      sTablePrefix = '', sExpCol = 'tsExpire', sEffCol = 'tsEffective'):
+        """
+        Formats a simple query for a standard testmanager table with optional
+        tsNow and sPeriodBack arguments.
+
+        The sQuery and sBindArgs are passed along to oDb.formatBindArgs to form
+        the first part of the query.  Must end with an open WHERE statement as
+        we'll be adding the time part starting with 'AND something...'.
+
+        See formatSimpleNowAndPeriod for tsNow and sPeriodBack description.
+
+        Returns the final portion of a WHERE query (start with AND) and maybe an
+        ORDER BY and LIMIT bit if sPeriodBack is given.
+
+        """
+        return oDb.formatBindArgs(sQuery, aBindArgs) \
+             + ModelDataBase.formatSimpleNowAndPeriod(oDb, tsNow, sPeriodBack, sTablePrefix, sExpCol, sEffCol);
+
+    #
+    # Sub-classes.
+    #
+
+    class DispWrapper(object):
+        """Proxy object."""
+        def __init__(self, oDisp, sAttrFmt):
+            self.oDisp    = oDisp;
+            self.sAttrFmt = sAttrFmt;
+        def getStringParam(self, sName, asValidValues = None, sDefault = None):
+            """See WuiDispatcherBase.getStringParam."""
+            return self.oDisp.getStringParam(self.sAttrFmt % (sName,), asValidValues, sDefault);
+        def getListOfStrParams(self, sName, asDefaults = None):
+            """See WuiDispatcherBase.getListOfStrParams."""
+            return self.oDisp.getListOfStrParams(self.sAttrFmt % (sName,), asDefaults);
+        def getListOfIntParams(self, sName, iMin = None, iMax = None, aiDefaults = None):
+            """See WuiDispatcherBase.getListOfIntParams."""
+            return self.oDisp.getListOfIntParams(self.sAttrFmt % (sName,), iMin, iMax, aiDefaults);
+
+
+
+
+# pylint: disable=E1101,C0111,R0903
+class ModelDataBaseTestCase(unittest.TestCase):
+    """
+    Base testcase for ModelDataBase decendants.
+    Derive from this and override setUp.
+    """
+
+    def setUp(self):
+        """
+        Override this! Don't call super!
+        The subclasses are expected to set aoSamples to an array of instance
+        samples.  The first entry must be a default object, the subsequent ones
+        are optional and their contents freely choosen.
+        """
+        self.aoSamples = [ModelDataBase(),];
+
+    def testEquality(self):
+        for oSample in self.aoSamples:
+            self.assertEqual(oSample.isEqual(copy.copy(oSample)), True);
+            self.assertIsNotNone(oSample.isEqual(self.aoSamples[0]));
+
+    def testNullConversion(self):
+        if len(self.aoSamples[0].getDataAttributes()) == 0:
+            return;
+        for oSample in self.aoSamples:
+            oCopy = copy.copy(oSample);
+            self.assertEqual(oCopy.convertToParamNull(), oCopy);
+            self.assertEqual(oCopy.isEqual(oSample), False);
+            self.assertEqual(oCopy.convertFromParamNull(), oCopy);
+            self.assertEqual(oCopy.isEqual(oSample), True, '\ngot     : %s\nexpected: %s' % (oCopy, oSample,));
+
+            oCopy = copy.copy(oSample);
+            self.assertEqual(oCopy.convertToParamNull(), oCopy);
+            oCopy2 = copy.copy(oCopy);
+            self.assertEqual(oCopy.convertToParamNull(), oCopy);
+            self.assertEqual(oCopy.isEqual(oCopy2), True);
+            self.assertEqual(oCopy.convertToParamNull(), oCopy);
+            self.assertEqual(oCopy.isEqual(oCopy2), True);
+
+            oCopy = copy.copy(oSample);
+            self.assertEqual(oCopy.convertFromParamNull(), oCopy);
+            oCopy2 = copy.copy(oCopy);
+            self.assertEqual(oCopy.convertFromParamNull(), oCopy);
+            self.assertEqual(oCopy.isEqual(oCopy2), True);
+            self.assertEqual(oCopy.convertFromParamNull(), oCopy);
+            self.assertEqual(oCopy.isEqual(oCopy2), True);
+
+    def testReinitToNull(self):
+        oFirst = copy.copy(self.aoSamples[0]);
+        self.assertEqual(oFirst.reinitToNull(), oFirst);
+        for oSample in self.aoSamples:
+            oCopy = copy.copy(oSample);
+            self.assertEqual(oCopy.reinitToNull(), oCopy);
+            self.assertEqual(oCopy.isEqual(oFirst), True);
+
+    def testValidateAndConvert(self):
+        for oSample in self.aoSamples:
+            oCopy = copy.copy(oSample);
+            oCopy.convertToParamNull();
+            dError1 = oCopy.validateAndConvert(None);
+
+            oCopy2  = copy.copy(oCopy);
+            self.assertEqual(oCopy.validateAndConvert(None), dError1);
+            self.assertEqual(oCopy.isEqual(oCopy2), True);
+
+    def testInitFromParams(self):
+        class DummyDisp(object):
+            def getStringParam(self, sName, asValidValues = None, sDefault = None):
+                _ = sName; _ = asValidValues;
+                return sDefault;
+            def getListOfStrParams(self, sName, asDefaults = None):
+                _ = sName;
+                return asDefaults;
+            def getListOfIntParams(self, sName, iMin = None, iMax = None, aiDefaults = None):
+                _ = sName; _ = iMin; _ = iMax;
+                return aiDefaults;
+
+        for oSample in self.aoSamples:
+            oCopy = copy.copy(oSample);
+            self.assertEqual(oCopy.initFromParams(DummyDisp(), fStrict = False), oCopy);
+
+    def testToString(self):
+        for oSample in self.aoSamples:
+            self.assertIsNotNone(oSample.toString());
+
+# pylint: enable=E1101,C0111,R0903
+
+
+class ModelLogicBase(ModelBase): # pylint: disable=R0903
+    """
+    Something all classes in the logic classes the logical model inherits from.
+    """
+
+    def __init__(self, oDb):
+        ModelBase.__init__(self);
+
+        #
+        # Note! Do not create a connection here if None, we need to DB share
+        #       connection with all other logic objects so we can perform half
+        #       complex transactions involving several logic objects.
+        #
+        self._oDb = oDb;
+
+    def getDbConnection(self):
+        """
+        Gets the database connection.
+        This should only be used for instantiating other ModelLogicBase children.
+        """
+        return self._oDb;
+
+
+class AttributeChangeEntry(object): # pylint: disable=R0903
+    """
+    Data class representing the changes made to one attribute.
+    """
+
+    def __init__(self, sAttr, oNewRaw, oOldRaw, sNewText, sOldText):
+        self.sAttr          = sAttr;
+        self.oNewRaw        = oNewRaw;
+        self.oOldRaw        = oOldRaw;
+        self.sNewText       = sNewText;
+        self.sOldText       = sOldText;
+
+class ChangeLogEntry(object): # pylint: disable=R0903
+    """
+    A change log entry returned by the fetchChangeLog method typically
+    implemented by ModelLogicBase child classes.
+    """
+
+    def __init__(self, uidAuthor, sAuthor, tsEffective, tsExpire, oNewRaw, oOldRaw, aoChanges):
+        self.uidAuthor      = uidAuthor;
+        self.sAuthor        = sAuthor;
+        self.tsEffective    = tsEffective;
+        self.tsExpire       = tsExpire;
+        self.oNewRaw        = oNewRaw;
+        self.oOldRaw        = oOldRaw;      # Note! NULL for the last entry.
+        self.aoChanges      = aoChanges;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/build.py b/src/VBox/ValidationKit/testmanager/core/build.py
new file mode 100644
index 0000000..ff123e2
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/build.py
@@ -0,0 +1,808 @@
+# -*- coding: utf-8 -*-
+# $Id: build.py $
+
+"""
+Test Manager - Builds.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os;
+import unittest;
+
+# Validation Kit imports.
+from testmanager                        import config;
+from testmanager.core                   import coreconsts;
+from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+
+
+class BuildCategoryData(ModelDataBase):
+    """
+    A build category.
+    """
+
+    ksIdAttr = 'idBuildCategory';
+
+    ksParam_idBuildCategory     = 'BuildCategory_idBuildCategory';
+    ksParam_sProduct            = 'BuildCategory_sProduct';
+    ksParam_sRepository         = 'BuildCategory_sRepository';
+    ksParam_sBranch             = 'BuildCategory_sBranch';
+    ksParam_sType               = 'BuildCategory_sType';
+    ksParam_asOsArches          = 'BuildCategory_asOsArches';
+
+    kasAllowNullAttributes      = ['idBuildCategory', ];
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idBuildCategory    = None;
+        self.sProduct           = None;
+        self.sRepository        = None;
+        self.sBranch            = None;
+        self.sType              = None;
+        self.asOsArches         = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the object from a SELECT * FROM BuildCategories row.
+        Returns self.  Raises exception if aoRow is None.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('BuildCategory not found.');
+
+        self.idBuildCategory     = aoRow[0];
+        self.sProduct            = aoRow[1];
+        self.sRepository         = aoRow[2];
+        self.sBranch             = aoRow[3];
+        self.sType               = aoRow[4];
+        self.asOsArches          = sorted(aoRow[5]);
+        return self;
+
+    def initFromDbWithId(self, oDb, idBuildCategory, tsNow = None, sPeriodBack = None):
+        """
+        Initialize from the database, given the ID of a row.
+        """
+        _ = tsNow; _ = sPeriodBack; # No history in this table.
+        oDb.execute('SELECT * FROM BuildCategories WHERE idBuildCategory = %s', (idBuildCategory,));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idBuildCategory=%s not found' % (idBuildCategory, ));
+        return self.initFromDbRow(aoRow);
+
+    def initFromValues(self, sProduct, sRepository, sBranch, sType, asOsArches, idBuildCategory = None):
+        """
+        Reinitializes form a set of values.
+        return self.
+        """
+        self.idBuildCategory    = idBuildCategory;
+        self.sProduct           = sProduct;
+        self.sRepository        = sRepository;
+        self.sBranch            = sBranch;
+        self.sType              = sType;
+        self.asOsArches         = asOsArches;
+        return self;
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        # Handle sType and asOsArches specially.
+        if sAttr == 'sType':
+            (oNewValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue,
+                                                                             aoNilValues, fAllowNull, oDb);
+            if sError is None  and  self.sType.lower() != self.sType:
+                sError = 'Invalid build type value';
+
+        elif sAttr == 'asOsArches':
+            (oNewValue, sError) = self.validateListOfStr(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                         asValidValues = coreconsts.g_kasOsDotCpusAll);
+            if sError is not None  and  oNewValue is not None:
+                oNewValue = sorted(oNewValue); # Must be sorted!
+
+        else:
+            return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+
+        return (oNewValue, sError);
+
+    def matchesOsArch(self, sOs, sArch):
+        """ Checks if the build matches the given OS and architecture. """
+        if sOs + '.' + sArch in self.asOsArches:
+            return True;
+        if sOs + '.noarch' in self.asOsArches:
+            return True;
+        if 'os-agnostic.' + sArch in self.asOsArches:
+            return True;
+        if 'os-agnostic.noarch' in self.asOsArches:
+            return True;
+        return False;
+
+
+class BuildCategoryLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    Build categories database logic.
+    """
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches testboxes for listing.
+
+        Returns an array (list) of UserAccountData items, empty list if none.
+        Raises exception on error.
+        """
+        _ = tsNow;
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     BuildCategories\n'
+                          'ORDER BY sProduct, sRepository, sBranch, sType, idBuildCategory\n'
+                          'LIMIT %s OFFSET %s\n'
+                          , (cMaxRows, iStart,));
+
+        aoRows = [];
+        for _ in range(self._oDb.getRowCount()):
+            aoRows.append(BuildCategoryData().initFromDbRow(self._oDb.fetchOne()));
+        return aoRows;
+
+    def fetchForCombo(self):
+        """
+        Gets the list of Build Categories for a combo box.
+        Returns an array of (value [idBuildCategory], drop-down-name [info],
+        hover-text [info]) tuples.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     BuildCategories\n'
+                          'ORDER BY sProduct, sBranch, sType, asOsArches')
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            oData = BuildCategoryData().initFromDbRow(aoRow)
+
+            sInfo = '%s / %s / %s / %s' % \
+                    (oData.sProduct,
+                     oData.sBranch,
+                     oData.sType,
+                     ', '.join(oData.asOsArches))
+
+            # Make short info string if necessary
+            sInfo = sInfo if len(sInfo) < 70 else (sInfo[:70] + '...')
+
+            oInfoItem = (oData.idBuildCategory, sInfo, sInfo)
+            aoRet.append(oInfoItem)
+
+        return aoRet
+
+    def addEntry(self, oData, uidAuthor = None, fCommit = False):
+        """
+        Standard method for adding a build category.
+        """
+
+        # Lazy bird warning! Reuse the soft addBuildCategory method.
+        self.addBuildCategory(oData, fCommit);
+        _ = uidAuthor;
+        return True;
+
+    def removeEntry(self, uidAuthor, idBuildCategory, fCascade = False, fCommit = False):
+        """
+        Tries to delete the build category.
+        Note! Does not implement cascading. This is intentional!
+        """
+
+        #
+        # Check that the build category isn't used by anyone.
+        #
+        self._oDb.execute('SELECT   COUNT(idBuild)\n'
+                          'FROM     Builds\n'
+                          'WHERE    idBuildCategory = %s\n'
+                          , (idBuildCategory,));
+        cBuilds = self._oDb.fetchOne()[0];
+        if cBuilds > 0:
+            raise TMExceptionBase('Build category #%d is used by %d builds and can therefore not be deleted.'
+                                  % (idBuildCategory, cBuilds,));
+
+        #
+        # Ok, it's not used, so just delete it.
+        # (No history on this table. This code is for typos.)
+        #
+        self._oDb.execute('DELETE FROM Builds\n'
+                          'WHERE    idBuildCategory = %s\n'
+                          , (idBuildCategory,));
+
+        self._oDb.maybeCommit(fCommit);
+        _ = uidAuthor; _ = fCascade;
+        return True;
+
+    #
+    # Other methods.
+    #
+
+    def tryFetch(self, idBuildCategory):
+        """
+        Try fetch the build category with the given ID.
+        Returns BuildCategoryData instance if found, None if not found.
+        May raise exception on database error.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     BuildCategories\n'
+                          'WHERE    idBuildCategory = %s\n'
+                          , (idBuildCategory,))
+        aaoRows = self._oDb.fetchAll()
+        if len(aaoRows) == 0:
+            return None;
+        if len(aaoRows) != 1:
+            raise self._oDb.integrityException('Duplicates in BuildCategories: %s' % (aaoRows,));
+        return BuildCategoryData().initFromDbRow(aaoRows[0])
+
+    def tryFindByData(self, oData):
+        """
+        Tries to find the matching build category from the sProduct, sBranch,
+        sType and asOsArches members of oData.
+
+        Returns a valid build category ID and an updated oData object if found.
+        Returns None and unmodified oData object if not found.
+        May raise exception on database error.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     BuildCategories\n'
+                          'WHERE    sProduct    = %s\n'
+                          '  AND    sRepository = %s\n'
+                          '  AND    sBranch     = %s\n'
+                          '  AND    sType       = %s\n'
+                          '  AND    asOsArches  = %s\n'
+                          , ( oData.sProduct,
+                              oData.sRepository,
+                              oData.sBranch,
+                              oData.sType,
+                              sorted(oData.asOsArches),
+                          ));
+        aaoRows = self._oDb.fetchAll();
+        if len(aaoRows) == 0:
+            return None;
+        if len(aaoRows) > 1:
+            raise self._oDb.integrityException('Duplicates in BuildCategories: %s' % (aaoRows,));
+
+        oData.initFromDbRow(aaoRows[0]);
+        return oData.idBuildCategory;
+
+    def addBuildCategory(self, oData, fCommit = False):
+        """
+        Add Build Category record into the database if needed, returning updated oData.
+        Raises exception on input and database errors.
+        """
+
+        # Check BuildCategoryData before do anything
+        dDataErrors = oData.validateAndConvert(self._oDb);
+        if len(dDataErrors) > 0:
+            raise TMExceptionBase('Invalid data passed to addBuildCategory(): %s' % (dDataErrors,));
+
+        # Does it already exist?
+        if self.tryFindByData(oData) is None:
+            # No, We'll have to add it.
+            self._oDb.execute('INSERT INTO BuildCategories (sProduct, sRepository, sBranch, sType, asOsArches)\n'
+                              'VALUES (%s, %s, %s, %s, %s)\n'
+                              'RETURNING idBuildCategory'
+                              , ( oData.sProduct,
+                                  oData.sRepository,
+                                  oData.sBranch,
+                                  oData.sType,
+                                  sorted(oData.asOsArches),
+                              ));
+            oData.idBuildCategory = self._oDb.fetchOne()[0];
+
+        self._oDb.maybeCommit(fCommit);
+        return oData;
+
+
+class BuildData(ModelDataBase):
+    """
+    A build.
+    """
+
+    ksIdAttr = 'idBuild';
+
+    ksParam_idBuild             = 'Build_idBuild';
+    ksParam_tsCreated           = 'Build_tsCreated';
+    ksParam_tsEffective         = 'Build_tsEffective';
+    ksParam_tsExpire            = 'Build_tsExpire';
+    ksParam_uidAuthor           = 'Build_uidAuthor';
+    ksParam_idBuildCategory     = 'Build_idBuildCategory';
+    ksParam_iRevision           = 'Build_iRevision';
+    ksParam_sVersion            = 'Build_sVersion';
+    ksParam_sLogUrl             = 'Build_sLogUrl';
+    ksParam_sBinaries           = 'Build_sBinaries';
+    ksParam_fBinariesDeleted    = 'Build_fBinariesDeleted';
+
+    kasAllowNullAttributes      = ['idBuild', 'tsCreated', 'tsEffective', 'tsExpire', 'uidAuthor', 'tsCreated', 'sLogUrl'];
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idBuild            = None;
+        self.tsCreated          = None;
+        self.tsEffective        = None;
+        self.tsExpire           = None;
+        self.uidAuthor          = None;
+        self.idBuildCategory    = None;
+        self.iRevision          = None;
+        self.sVersion           = None;
+        self.sLogUrl            = None;
+        self.sBinaries          = None;
+        self.fBinariesDeleted   = False;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the object from a SELECT * FROM Builds row.
+        Returns self.  Raises exception if aoRow is None.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Build not found.');
+
+        self.idBuild            = aoRow[0];
+        self.tsCreated          = aoRow[1];
+        self.tsEffective        = aoRow[2];
+        self.tsExpire           = aoRow[3];
+        self.uidAuthor          = aoRow[4];
+        self.idBuildCategory    = aoRow[5];
+        self.iRevision          = aoRow[6];
+        self.sVersion           = aoRow[7];
+        self.sLogUrl            = aoRow[8];
+        self.sBinaries          = aoRow[9];
+        self.fBinariesDeleted   = aoRow[10];
+        return self;
+
+    def initFromDbWithId(self, oDb, idBuild, tsNow = None, sPeriodBack = None):
+        """
+        Initialize from the database, given the ID of a row.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   Builds\n'
+                                                       'WHERE  idBuild = %s\n'
+                                                       , ( idBuild,), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+    def areFilesStillThere(self):
+        """
+        Try check if the build files are still there.
+
+        Returns True if they are, None if we cannot tell, and False if one or
+        more are missing.
+        """
+        if self.fBinariesDeleted:
+            return False;
+
+        for sBinary in self.sBinaries.split(','):
+            sBinary = sBinary.strip();
+            if len(sBinary) == 0:
+                continue;
+            # Same URL tests as in webutils.downloadFile().
+            if   sBinary.startswith('http://') \
+              or sBinary.startswith('https://') \
+              or sBinary.startswith('ftp://'):
+                # URL - don't bother trying to verify that (we don't use it atm).
+                fRc = None;
+            else:
+                # File.
+                if config.g_ksBuildBinRootDir is not None:
+                    sFullPath = os.path.join(config.g_ksBuildBinRootDir, sBinary);
+                    fRc = os.path.isfile(sFullPath);
+                    if    not fRc \
+                      and not os.path.isfile(os.path.join(config.g_ksBuildBinRootDir, config.g_ksBuildBinRootFile)):
+                        fRc = None; # Root file missing, so the share might not be mounted correctly.
+                else:
+                    fRc = None;
+            if fRc is not True:
+                return fRc;
+
+        return True;
+
+
+class BuildDataEx(BuildData):
+    """
+    Complete data set.
+    """
+
+    def __init__(self):
+        BuildData.__init__(self);
+        self.oCat = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT Builds.*, BuildCategories.* FROM Builds, BuildCategories query.
+        Returns self.  Raises exception if aoRow is None.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Build not found.');
+        BuildData.initFromDbRow(self, aoRow);
+        self.oCat = BuildCategoryData().initFromDbRow(aoRow[11:]);
+        return self;
+
+    def initFromDbWithId(self, oDb, idBuild, tsNow = None, sPeriodBack = None):
+        """
+        Reinitialize from database given a row ID.
+        Returns self.  Raises exception on database error or if the ID is invalid.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT Builds.*, BuildCategories.*\n'
+                                                       'FROM   Builds, BuildCategories\n'
+                                                       'WHERE  idBuild = %s\n'
+                                                       '   AND Builds.idBuildCategory = BuildCategories.idBuildCategory\n'
+                                                       , ( idBuild,), tsNow, sPeriodBack, 'Builds.'));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idBuild=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuild, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+    def convertFromParamNull(self):
+        raise TMExceptionBase('Not implemented');
+
+    def isEqual(self, oOther):
+        raise TMExceptionBase('Not implemented');
+
+
+
+class BuildLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    Build database logic (covers build categories as well as builds).
+    """
+
+    #
+    # Standard methods.
+    #
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches builds for listing.
+
+        Returns an array (list) of BuildDataEx items, empty list if none.
+        Raises exception on error.
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     Builds, BuildCategories\n'
+                              'WHERE    Builds.idBuildCategory = BuildCategories.idBuildCategory\n'
+                              '     AND Builds.tsExpire        = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY tsCreated DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     Builds, BuildCategories\n'
+                              'WHERE    Builds.idBuildCategory = BuildCategories.idBuildCategory\n'
+                              '     AND Builds.tsExpire        > %s\n'
+                              '     AND Builds.tsEffective    <= %s\n'
+                              'ORDER BY tsCreated DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRows = [];
+        for _ in range(self._oDb.getRowCount()):
+            aoRows.append(BuildDataEx().initFromDbRow(self._oDb.fetchOne()));
+        return aoRows;
+
+    def addEntry(self, oBuildData, uidAuthor = None, fCommit = False):
+        """
+        Adds the build to the database, optionally adding the build category if
+        a BuildDataEx object used and it's necessary.
+
+        Returns updated data object. Raises exception on failure.
+        """
+
+        # Find/Add the build category if specified.
+        if    isinstance(oBuildData, BuildDataEx) \
+          and oBuildData.idBuildCategory is None:
+            BuildCategoryLogic(self._oDb).addBuildCategory(oBuildData.oCat, fCommit = False);
+            oBuildData.idBuildCategory = oBuildData.oCat.idBuildCategory;
+
+        # Add the build.
+        self._oDb.execute('INSERT INTO Builds (uidAuthor,\n'
+                          '                    idBuildCategory,\n'
+                          '                    iRevision,\n'
+                          '                    sVersion,\n'
+                          '                    sLogUrl,\n'
+                          '                    sBinaries,\n'
+                          '                    fBinariesDeleted)\n'
+                          'VALUES (%s, %s, %s, %s, %s, %s, %s)\n'
+                          'RETURNING idBuild, tsCreated\n'
+                          , ( uidAuthor,
+                              oBuildData.idBuildCategory,
+                              oBuildData.iRevision,
+                              oBuildData.sVersion,
+                              oBuildData.sLogUrl,
+                              oBuildData.sBinaries,
+                              oBuildData.fBinariesDeleted,
+                          ));
+        aoRow = self._oDb.fetchOne();
+        oBuildData.idBuild   = aoRow[0];
+        oBuildData.tsCreated = aoRow[1];
+
+        self._oDb.maybeCommit(fCommit);
+        return oBuildData;
+
+    def editEntry(self, oData, uidAuthor = None, fCommit = False):
+        """Modify database record"""
+
+        #
+        # Validate input and get current data.
+        #
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('editEntry invalid input: %s' % (dErrors,));
+        oOldData = BuildData().initFromDbWithId(self._oDb, oData.idBuild);
+
+        #
+        # Do the work.
+        #
+        if not oData.isEqualEx(oOldData, [ 'tsEffective', 'tsExpire', 'uidAuthor' ]):
+            self._historizeBuild(oData.idBuild);
+            self._oDb.execute('INSERT INTO Builds (uidAuthor,\n'
+                              '                    idBuild,\n'
+                              '                    tsCreated,\n'
+                              '                    idBuildCategory,\n'
+                              '                    iRevision,\n'
+                              '                    sVersion,\n'
+                              '                    sLogUrl,\n'
+                              '                    sBinaries,\n'
+                              '                    fBinariesDeleted)\n'
+                              'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)\n'
+                              'RETURNING idBuild, tsCreated\n'
+                              , ( uidAuthor,
+                                  oData.idBuild,
+                                  oData.tsCreated,
+                                  oData.idBuildCategory,
+                                  oData.iRevision,
+                                  oData.sVersion,
+                                  oData.sLogUrl,
+                                  oData.sBinaries,
+                                  oData.fBinariesDeleted,
+                              ));
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def removeEntry(self, uidAuthor, idBuild, fCascade = False, fCommit = False):
+        """
+        Historize record
+        """
+
+        #
+        # No non-historic refs here, so just go ahead and expire the build.
+        #
+        _ = fCascade;
+        _ = uidAuthor; ## @todo record deleter.
+
+        self._historizeBuild(idBuild, None);
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+
+    #
+    # Other methods.
+    #
+
+    def tryFindSameBuildForOsArch(self, oBuildEx, sOs, sCpuArch):
+        """
+        Attempts to find a matching build for the given OS.ARCH.  May return
+        the input build if if matches.
+
+        Returns BuildDataEx instance if found, None if none.  May raise
+        exception on database error.
+        """
+
+        if oBuildEx.oCat.matchesOsArch(sOs, sCpuArch):
+            return oBuildEx;
+
+        self._oDb.execute('SELECT Builds.*, BuildCategories.*\n'
+                          'FROM   Builds, BuildCategories\n'
+                          'WHERE  BuildCategories.sProduct = %s\n'
+                          '   AND BuildCategories.sBranch  = %s\n'
+                          '   AND BuildCategories.sType    = %s\n'
+                          '   AND (   %s = ANY(BuildCategories.asOsArches)\n'
+                          '        OR %s = ANY(BuildCategories.asOsArches)\n'
+                          '        OR %s = ANY(BuildCategories.asOsArches))\n'
+                          '   AND Builds.idBuildCategory   = BuildCategories.idBuildCategory\n'
+                          '   AND Builds.tsExpire          = \'infinity\'::TIMESTAMP\n'
+                          '   AND Builds.iRevision         = %s\n'
+                          '   AND Builds.sRelease          = %s\n'
+                          '   AND Builds.fBinariesDeleted IS FALSE\n'
+                          'ORDER BY tsCreated DESC\n'
+                          'LIMIT 4096\n'        # stay sane.
+                          , (oBuildEx.oCat.sProduct,
+                             oBuildEx.oCat.sBranch,
+                             oBuildEx.oCat.sType,
+                             '%s.%s' % (sOs, sCpuArch),
+                             '%s.noarch' % (sOs,),
+                             'os-agnostic.%s' % (sCpuArch,),
+                             'os-agnostic.noarch',
+                             oBuildEx.iRevision,
+                             oBuildEx.sRelease,
+                          ) );
+        aaoRows = self._oDb.fetchAll();
+
+        for aoRow in aaoRows:
+            oBuildExRet = BuildDataEx().initFromDbRow(self, aoRow);
+            if not self.isBuildBlacklisted(oBuildExRet):
+                return oBuildExRet;
+
+        return None;
+
+    def isBuildBlacklisted(self, oBuildEx):
+        """
+        Checks if the given build is blacklisted
+        Returns True/False. May raise exception on database error.
+        """
+
+        asOsAgnosticArch = [];
+        asOsNoArch       = [];
+        for i in range(len(oBuildEx.oCat.asOsArches)):
+            asParts = oBuildEx.oCat.asOsArches[i].split('.');
+            if len(asParts) != 2 or len(asParts[0]) == 0 or len(asParts[1]) == 0:
+                raise self._oDb.integrityException('Bad build asOsArches value: %s (idBuild=%s idBuildCategory=%s)'
+                                                   % (oBuildEx.asOsArches[i], oBuildEx.idBuild, oBuildEx.idBuildCategory));
+            asOsNoArch.append(asParts[0] + '.noarch');
+            asOsNoArch.append('os-agnostic.' + asParts[1]);
+
+        self._oDb.execute('SELECT COUNT(*)\n'
+                          'FROM   BuildBlacklist\n'
+                          'WHERE  BuildBlacklist.tsExpire     > CURRENT_TIMESTAMP\n'
+                          '   AND BuildBlacklist.tsEffective <= CURRENT_TIMESTAMP\n'
+                          '   AND BuildBlacklist.sProduct     = %s\n'
+                          '   AND BuildBlacklist.sBranch      = %s\n'
+                          '   AND (   BuildBlacklist.asTypes is NULL\n'
+                          '        OR %s = ANY(BuildBlacklist.asTypes))\n'
+                          '   AND (   BuildBlacklist.asOsArches is NULL\n'
+                          '        OR %s && BuildBlacklist.asOsArches\n'  ## @todo check array rep! Need overload?
+                          '        OR %s && BuildBlacklist.asOsArches\n'
+                          '        OR %s && BuildBlacklist.asOsArches\n'
+                          '        OR %s = ANY(BuildBlacklist.asOsArches))\n'
+                          '   AND BuildBlacklist.iFirstRevision <= %s\n'
+                          '   AND BuildBlacklist.iLastRevision  >= %s\n'
+                          , (oBuildEx.oCat.sProduct,
+                             oBuildEx.oCat.sBranch,
+                             oBuildEx.oCat.sType,
+                             oBuildEx.oCat.asOsArches,
+                             asOsAgnosticArch,
+                             asOsNoArch,
+                             'os-agnostic.noarch',
+                             oBuildEx.iRevision,
+                             oBuildEx.iRevision,
+                          ) );
+        return self._oDb.fetchOne()[0] > 0;
+
+
+    def getById(self, idBuild):
+        """
+        Get build record by its id
+        """
+        self._oDb.execute('SELECT Builds.*, BuildCategories.*\n'
+                          'FROM     Builds, BuildCategories\n'
+                          'WHERE    Builds.idBuild=%s\n'
+                          '     AND Builds.idBuildCategory=BuildCategories.idBuildCategory\n'
+                          '     AND Builds.tsExpire = \'infinity\'::TIMESTAMP\n', (idBuild,))
+
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise TMExceptionBase('Found more than one build with the same credentials. Database structure is corrupted.')
+        try:
+            return BuildDataEx().initFromDbRow(aRows[0])
+        except IndexError:
+            return None
+
+
+    def getAll(self, tsEffective = None):
+        """
+        Gets the list of all builds.
+        Returns an array of BuildDataEx instances.
+        """
+        if tsEffective is None:
+            self._oDb.execute('SELECT   Builds.*, BuildCategories.*\n'
+                              'FROM     Builds, BuildCategories\n'
+                              'WHERE    Builds.tsExpire = \'infinity\'::TIMESTAMP\n'
+                              '     AND Builds.idBuildCategory=BuildCategories.idBuildCategory')
+        else:
+            self._oDb.execute('SELECT   Builds.*, BuildCategories.*\n'
+                              'FROM     Builds, BuildCategories\n'
+                              'WHERE    Builds.tsExpire > %s\n'
+                              '     AND Builds.tsEffective <= %s'
+                              '     AND Builds.idBuildCategory=BuildCategories.idBuildCategory'
+                              , (tsEffective, tsEffective))
+        aoRet = []
+        for aoRow in self._oDb.fetchAll():
+            aoRet.append(BuildDataEx().initFromDbRow(aoRow))
+        return aoRet
+
+
+    def markDeletedByBinaries(self, sBinaries, fCommit = False):
+        """
+        Marks zero or more builds deleted given the build binaries.
+
+        Returns the number of affected builds.
+        """
+        # Fetch a list of affected build IDs (generally 1 build), and used the
+        # editEntry method to do the rest.  This isn't 100% optimal, but it's
+        # short and simple, the main effort is anyway the first query.
+        self._oDb.execute('SELECT   idBuild\n'
+                          'FROM     Builds\n'
+                          'WHERE    sBinaries        = %s\n'
+                          '     AND fBinariesDeleted = FALSE\n'
+                          '     AND tsExpire         = \'infinity\'::TIMESTAMP\n'
+                          , (sBinaries,));
+        aaoRows = self._oDb.fetchAll();
+        for aoRow in aaoRows:
+            oData = BuildData().initFromDbWithId(self._oDb, aoRow[0]);
+            assert not oData.fBinariesDeleted;
+            oData.fBinariesDeleted = True;
+            self.editEntry(oData, fCommit = False);
+        self._oDb.maybeCommit(fCommit);
+        return len(aaoRows);
+
+
+
+    #
+    # Internal helpers.
+    #
+
+    def _historizeBuild(self, idBuild, tsExpire = None):
+        """ Historizes the current entry for the specified build. """
+        if tsExpire is None:
+            self._oDb.execute('UPDATE Builds\n'
+                              'SET    tsExpire = CURRENT_TIMESTAMP\n'
+                              'WHERE  idBuild  = %s\n'
+                              '   AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                              , (idBuild,));
+        else:
+            self._oDb.execute('UPDATE Builds\n'
+                              'SET    tsExpire = %s\n'
+                              'WHERE  idBuild  = %s\n'
+                              '   AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                              , (tsExpire, idBuild,));
+        return True;
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class BuildCategoryDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [BuildCategoryData(),];
+
+class BuildDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [BuildData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/buildblacklist.py b/src/VBox/ValidationKit/testmanager/core/buildblacklist.py
new file mode 100644
index 0000000..b823ce6
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/buildblacklist.py
@@ -0,0 +1,273 @@
+# -*- coding: utf-8 -*-
+# $Id: buildblacklist.py $
+
+"""
+Test Manager - Builds Blacklist.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.core.base          import ModelDataBase, ModelLogicBase, TMExceptionBase
+
+
+class BuildBlacklistData(ModelDataBase):
+    """
+    Build Blacklist Data.
+    """
+
+    ksIdAttr = 'idBlacklisting';
+
+    ksParam_idBlacklisting  = 'BuildBlacklist_idBlacklisting'
+    ksParam_tsEffective     = 'BuildBlacklist_tsEffective'
+    ksParam_tsExpire        = 'BuildBlacklist_tsExpire'
+    ksParam_uidAuthor       = 'BuildBlacklist_uidAuthor'
+    ksParam_idFailureReason = 'BuildBlacklist_idFailureReason'
+    ksParam_sProduct        = 'BuildBlacklist_sProduct'
+    ksParam_sBranch         = 'BuildBlacklist_sBranch'
+    ksParam_asTypes         = 'BuildBlacklist_asTypes'
+    ksParam_asOsArches      = 'BuildBlacklist_asOsArches'
+    ksParam_iFirstRevision  = 'BuildBlacklist_iFirstRevision'
+    ksParam_iLastRevision   = 'BuildBlacklist_iLastRevision'
+
+    kasAllowNullAttributes    = [ 'idBlacklisting',
+                                  'tsEffective',
+                                  'tsExpire',
+                                  'uidAuthor',
+                                  'asTypes',
+                                  'asOsArches' ];
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idBlacklisting  = None
+        self.tsEffective     = None
+        self.tsExpire        = None
+        self.uidAuthor       = None
+        self.idFailureReason = None
+        self.sProduct        = None
+        self.sBranch         = None
+        self.asTypes         = None
+        self.asOsArches      = None
+        self.iFirstRevision  = None
+        self.iLastRevision   = None
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the data with a row from a SELECT * FROM BuildBlacklist.
+
+        Returns self. Raises exception if the row is None or otherwise invalid.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('Build Blacklist item not found.')
+
+        self.idBlacklisting  = aoRow[0]
+        self.tsEffective     = aoRow[1]
+        self.tsExpire        = aoRow[2]
+        self.uidAuthor       = aoRow[3]
+        self.idFailureReason = aoRow[4]
+        self.sProduct        = aoRow[5]
+        self.sBranch         = aoRow[6]
+        self.asTypes         = aoRow[7]
+        self.asOsArches      = aoRow[8]
+        self.iFirstRevision  = aoRow[9]
+        self.iLastRevision   = aoRow[10]
+
+        return self;
+
+    def initFromDbWithId(self, oDb, idBlacklisting, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   BuildBlacklist\n'
+                                                       'WHERE  idBlacklisting   = %s\n'
+                                                       , ( idBlacklisting,), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idBlacklisting=%s not found (tsNow=%s sPeriodBack=%s)'
+                                  % (idBlacklisting, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+
+class BuildBlacklistLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    Build Back List logic.
+    """
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches Build Blacklist records.
+
+        Returns an array (list) of BuildBlacklistData items, empty list if none.
+        Raises exception on error.
+        """
+
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     BuildBlacklist\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idBlacklisting DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     BuildBlacklist\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY idBlacklisting DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRows = []
+        for aoRow in self._oDb.fetchAll():
+            aoRows.append(BuildBlacklistData().initFromDbRow(aoRow))
+        return aoRows
+
+    def addEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Adds a blacklisting to the database.
+        """
+        self._oDb.execute('INSERT INTO BuildBlacklist (\n'
+                          '     uidAuthor,\n'
+                          '     idFailureReason,\n'
+                          '     sProduct,\n'
+                          '     sBranch,\n'
+                          '     asTypes,\n'
+                          '     asOsArches,\n'
+                          '     iFirstRevision,\n'
+                          '     iLastRevision)\n'
+                          'VALUES (%s, %s, %s, %s, %s, %s, %s, %s)'
+                          , ( uidAuthor,
+                              oData.idFailureReason,
+                              oData.sProduct,
+                              oData.sBranch,
+                              oData.asTypes,
+                              oData.asOsArches,
+                              oData.iFirstRevision,
+                              oData.iLastRevision,) );
+        self._oDb.maybeCommit(fCommit);
+        return True
+
+    def editEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Modifies a blacklisting.
+        """
+
+        #
+        # Validate inputs and read in the old(/current) data.
+        #
+        assert isinstance(oData, BuildBlacklistData);
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('editEntry invalid input: %s' % (dErrors,));
+
+        oOldData = BuildBlacklistData().initFromDbWithId(self._oDb, oData.idBlacklisting);
+
+        #
+        # Update the data that needs updating.
+        #
+        if not oData.isEqualEx(oOldData, [ 'tsEffective', 'tsExpire', 'uidAuthor', ]):
+            self._historizeEntry(oData.idBlacklisting, None);
+            self._readdEntry(uidAuthor, oData, None);
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+
+    def removeEntry(self, uidAuthor, idBlacklisting, fCascade = False, fCommit = False):
+        """
+        Deletes a test group.
+        """
+        _ = fCascade; # Not applicable.
+
+        oData = BuildBlacklistData().initFromDbWithId(self._oDb, idBlacklisting);
+
+        (tsCur, tsCurMinusOne) = self._oDb.getCurrentTimestamps();
+        if oData.tsEffective != tsCur and oData.tsEffective != tsCurMinusOne:
+            self._historizeEntry(idBlacklisting, tsCurMinusOne);
+            self._readdEntry(uidAuthor, oData, tsCurMinusOne);
+            self._historizeEntry(idBlacklisting);
+        self._oDb.execute('UPDATE   BuildBlacklist\n'
+                          'SET      tsExpire       = CURRENT_TIMESTAMP\n'
+                          'WHERE    idBlacklisting = %s\n'
+                          '     AND tsExpire       = \'infinity\'::TIMESTAMP\n'
+                          , (idBlacklisting,));
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+
+    #
+    # Helpers.
+    #
+
+    def _historizeEntry(self, idBlacklisting, tsExpire = None):
+        """
+        Historizes the current entry for the given backlisting.
+        """
+        if tsExpire is None:
+            tsExpire = self._oDb.getCurrentTimestamp();
+        self._oDb.execute('UPDATE   BuildBlacklist\n'
+                          'SET      tsExpire       = %s\n'
+                          'WHERE    idBlacklisting = %s\n'
+                          '     AND tsExpire       = \'infinity\'::TIMESTAMP\n'
+                          , ( tsExpire, idBlacklisting, ));
+        return True;
+
+    def _readdEntry(self, uidAuthor, oData, tsEffective = None):
+        """
+        Re-adds the BuildBlacklist entry. Used by editEntry and removeEntry.
+        """
+        if tsEffective is None:
+            tsEffective = self._oDb.getCurrentTimestamp();
+        self._oDb.execute('INSERT INTO BuildBlacklist (\n'
+                          '         uidAuthor,\n'
+                          '         tsEffective,\n'
+                          '         idBlacklisting,\n'
+                          '         idFailureReason,\n'
+                          '         sProduct,\n'
+                          '         sBranch,\n'
+                          '         asTypes,\n'
+                          '         asOsArches,\n'
+                          '         iFirstRevision,\n'
+                          '         iLastRevision)\n'
+                          'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\n'
+                          , ( uidAuthor,
+                              tsEffective,
+                              oData.idBlacklisting,
+                              oData.idFailureReason,
+                              oData.sProduct,
+                              oData.sBranch,
+                              oData.asTypes,
+                              oData.asOsArches,
+                              oData.iFirstRevision,
+                              oData.iLastRevision,) );
+        return True;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/buildsource.py b/src/VBox/ValidationKit/testmanager/core/buildsource.py
new file mode 100644
index 0000000..a788675
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/buildsource.py
@@ -0,0 +1,473 @@
+# -*- coding: utf-8 -*-
+# $Id: buildsource.py $
+
+"""
+Test Manager - Build Sources.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from common                             import utils;
+from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+from testmanager.core                   import coreconsts;
+
+
+class BuildSourceData(ModelDataBase):
+    """
+    A build source.
+    """
+
+    ksIdAttr = 'idBuildSrc';
+
+    ksParam_idBuildSrc          = 'BuildSource_idBuildSrc';
+    ksParam_tsEffective         = 'BuildSource_tsEffective';
+    ksParam_tsExpire            = 'BuildSource_tsExpire';
+    ksParam_uidAuthor           = 'BuildSource_uidAuthor';
+    ksParam_sName               = 'BuildSource_sName';
+    ksParam_sDescription        = 'BuildSource_sDescription';
+    ksParam_sProduct            = 'BuildSource_sProduct';
+    ksParam_sBranch             = 'BuildSource_sBranch';
+    ksParam_asTypes             = 'BuildSource_asTypes';
+    ksParam_asOsArches          = 'BuildSource_asOsArches';
+    ksParam_iFirstRevision      = 'BuildSource_iFirstRevision';
+    ksParam_iLastRevision       = 'BuildSource_iLastRevision';
+    ksParam_cSecMaxAge          = 'BuildSource_cSecMaxAge';
+
+    kasAllowNullAttributes      = [ 'idBuildSrc', 'tsEffective', 'tsExpire', 'uidAuthor', 'sDescription', 'asTypes',
+                                    'asOsArches', 'iFirstRevision', 'iLastRevision', 'cSecMaxAge' ];
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idBuildSrc         = None;
+        self.tsEffective        = None;
+        self.tsExpire           = None;
+        self.uidAuthor          = None;
+        self.sName              = None;
+        self.sDescription       = None;
+        self.sProduct           = None;
+        self.sBranch            = None;
+        self.asTypes            = None;
+        self.asOsArches         = None;
+        self.iFirstRevision     = None;
+        self.iLastRevision      = None;
+        self.cSecMaxAge         = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the object from a SELECT * FROM BuildSources row.
+        Returns self.  Raises exception if aoRow is None.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Build source not found.');
+
+        self.idBuildSrc         = aoRow[0];
+        self.tsEffective        = aoRow[1];
+        self.tsExpire           = aoRow[2];
+        self.uidAuthor          = aoRow[3];
+        self.sName              = aoRow[4];
+        self.sDescription       = aoRow[5];
+        self.sProduct           = aoRow[6];
+        self.sBranch            = aoRow[7];
+        self.asTypes            = aoRow[8];
+        self.asOsArches         = aoRow[9];
+        self.iFirstRevision     = aoRow[10];
+        self.iLastRevision      = aoRow[11];
+        self.cSecMaxAge         = aoRow[12];
+        return self;
+
+    def initFromDbWithId(self, oDb, idBuildSrc, tsNow = None, sPeriodBack = None):
+        """
+        Initialize from the database, given the ID of a row.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   BuildSources\n'
+                                                       'WHERE  idBuildSrc   = %s\n'
+                                                       , ( idBuildSrc,), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idBuildSrc=%s not found (tsNow=%s sPeriodBack=%s)' % (idBuildSrc, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        # Handle asType and asOsArches specially.
+        if sAttr == 'sType':
+            (oNewValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue,
+                                                                             aoNilValues, fAllowNull, oDb);
+            if sError is None:
+                if len(self.asTypes) <= 0:
+                    oNewValue = None;
+                else:
+                    for sType in oNewValue:
+                        if len(sType) < 2  or  sType.lower() != sType:
+                            if sError is None:  sError  = '';
+                            else:               sError += ', ';
+                            sError += 'invalid value "%s"' % (sType,);
+
+        elif sAttr == 'asOsArches':
+            (oNewValue, sError) = self.validateListOfStr(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                         asValidValues = coreconsts.g_kasOsDotCpusAll);
+            if sError is not None  and  oNewValue is not None:
+                oNewValue = sorted(oNewValue); # Must be sorted!
+
+        elif sAttr == 'cSecMaxAge' and oValue not in aoNilValues: # Allow human readable interval formats.
+            (oNewValue, sError) = utils.parseIntervalSeconds(oValue);
+        else:
+            return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+
+        return (oNewValue, sError);
+
+class BuildSourceLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    Build source database logic.
+    """
+
+    #
+    # Standard methods.
+    #
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches build sources.
+
+        Returns an array (list) of BuildSourceData items, empty list if none.
+        Raises exception on error.
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     BuildSources\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idBuildSrc DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     BuildSources\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY idBuildSrc DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRows = []
+        for aoRow in self._oDb.fetchAll():
+            aoRows.append(BuildSourceData().initFromDbRow(aoRow))
+        return aoRows
+
+    def fetchForCombo(self):
+        """Fetch data which is aimed to be passed to HTML form"""
+        self._oDb.execute('SELECT   idBuildSrc, sName, sProduct\n'
+                          'FROM     BuildSources\n'
+                          'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                          'ORDER BY idBuildSrc DESC\n')
+        asRet = self._oDb.fetchAll();
+        asRet.insert(0, (-1, 'None', 'None'));
+        return asRet;
+
+
+    def addEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Add a new build source to the database.
+        """
+
+        #
+        # Validate the input.
+        #
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('addEntry invalid input: %s' % (dErrors,));
+        self._assertUnique(oData, None);
+
+        #
+        # Add it.
+        #
+        self._oDb.execute('INSERT INTO BuildSources (\n'
+                          '         uidAuthor,\n'
+                          '         sName,\n'
+                          '         sDescription,\n'
+                          '         sProduct,\n'
+                          '         sBranch,\n'
+                          '         asTypes,\n'
+                          '         asOsArches,\n'
+                          '         iFirstRevision,\n'
+                          '         iLastRevision,\n'
+                          '         cSecMaxAge)\n'
+                          'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\n'
+                          , ( uidAuthor,
+                              oData.sName,
+                              oData.sDescription,
+                              oData.sProduct,
+                              oData.sBranch,
+                              oData.asTypes,
+                              oData.asOsArches,
+                              oData.iFirstRevision,
+                              oData.iLastRevision,
+                              oData.cSecMaxAge, ));
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def editEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Modifies a build source.
+        """
+
+        #
+        # Validate the input and read the old entry.
+        #
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('addEntry invalid input: %s' % (dErrors,));
+        self._assertUnique(oData, oData.idBuildSrc);
+        oOldData = BuildSourceData().initFromDbWithId(self._oDb, oData.idBuildSrc);
+
+        #
+        # Make the changes (if something actually changed).
+        #
+        if not oData.isEqualEx(oOldData, [ 'tsEffective', 'tsExpire', 'uidAuthor', ]):
+            self._historizeBuildSource(oData.idBuildSrc);
+            self._oDb.execute('INSERT INTO BuildSources (\n'
+                              '         uidAuthor,\n'
+                              '         idBuildSrc,\n'
+                              '         sName,\n'
+                              '         sDescription,\n'
+                              '         sProduct,\n'
+                              '         sBranch,\n'
+                              '         asTypes,\n'
+                              '         asOsArches,\n'
+                              '         iFirstRevision,\n'
+                              '         iLastRevision,\n'
+                              '         cSecMaxAge)\n'
+                              'VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)\n'
+                              , ( uidAuthor,
+                                  oData.idBuildSrc,
+                                  oData.sName,
+                                  oData.sDescription,
+                                  oData.sProduct,
+                                  oData.sBranch,
+                                  oData.asTypes,
+                                  oData.asOsArches,
+                                  oData.iFirstRevision,
+                                  oData.iLastRevision,
+                                  oData.cSecMaxAge, ));
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def removeEntry(self, uidAuthor, idBuildSrc, fCascade = False, fCommit = False):
+        """
+        Deletes a build sources.
+        """
+
+        #
+        # Check cascading.
+        #
+        if fCascade is not True:
+            self._oDb.execute('SELECT   idSchedGroup, sName\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    idBuildSrc          = %s\n'
+                              '     OR  idBuildSrcTestSuite = %s\n'
+                              , (idBuildSrc, idBuildSrc,));
+            if self._oDb.getRowCount() > 0:
+                asGroups = [];
+                for aoRow in self._oDb.fetchAll():
+                    asGroups.append('%s (#%d)' % (aoRow[1], aoRow[0]));
+                raise TMExceptionBase('Build source #%d is used by one or more scheduling groups: %s'
+                                      % (idBuildSrc, ', '.join(asGroups),));
+        else:
+            self._oDb.execute('UPDATE   SchedGroups\n'
+                              'SET      idBuildSrc = NULL\n'
+                              'WHERE    idBuildSrc = %s'
+                              , ( idBuildSrc,));
+            self._oDb.execute('UPDATE   SchedGroups\n'
+                              'SET      idBuildSrcTestSuite = NULL\n'
+                              'WHERE    idBuildSrcTestSuite = %s'
+                              , ( idBuildSrc,));
+
+        #
+        # Do the job.
+        #
+        self._historizeBuildSource(idBuildSrc, None);
+        _ = uidAuthor; ## @todo record deleter.
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+
+    #
+    # Other methods.
+    #
+
+    def openBuildCursor(self, oBuildSource, sOs, sCpuArch, tsNow):
+        """
+        Opens a cursor (SELECT) using the criteria found in the build source
+        and the given OS.CPUARCH.
+
+        Returns database cursor. May raise exception on bad input or logic error.
+
+        Used by SchedulerBase.
+        """
+
+        oCursor = self._oDb.openCursor();
+
+        #
+        # Construct the extra conditionals.
+        #
+        sExtraConditions = '';
+
+        # Types
+        if oBuildSource.asTypes is not None  and  len(oBuildSource.asTypes) > 0:
+            if len(oBuildSource.asTypes) == 1:
+                sExtraConditions += oCursor.formatBindArgs('   AND BuildCategories.sType = %s', (oBuildSource.asTypes[0],));
+            else:
+                sExtraConditions += oCursor.formatBindArgs('   AND BuildCategories.sType IN (%s', (oBuildSource.asTypes[0],))
+                for i in range(1, len(oBuildSource.asTypes) - 1):
+                    sExtraConditions += oCursor.formatBindArgs(', %s', (oBuildSource.asTypes[i],));
+                sExtraConditions += oCursor.formatBindArgs(', %s)\n', (oBuildSource.asTypes[-1],));
+
+        # BuildSource OSes.ARCHes. (Paranoia: use a dictionary to avoid duplicate values.)
+        if oBuildSource.asOsArches is not None  and  len(oBuildSource.asOsArches) > 0:
+            sExtraConditions += oCursor.formatBindArgs('  AND BuildCategories.asOsArches && %s', (oBuildSource.asOsArches,));
+
+        # TestBox OSes.ARCHes. (Paranoia: use a dictionary to avoid duplicate values.)
+        dOsDotArches = {};
+        dOsDotArches[sOs + '.' + sCpuArch] = 1;
+        dOsDotArches[sOs + '.' + coreconsts.g_ksCpuArchAgnostic] = 1;
+        dOsDotArches[coreconsts.g_ksOsAgnostic + '.' + sCpuArch] = 1;
+        dOsDotArches[coreconsts.g_ksOsDotArchAgnostic] = 1;
+        sExtraConditions += oCursor.formatBindArgs('   AND BuildCategories.asOsArches && %s', (list(dOsDotArches.keys()),));
+
+        # Revision range.
+        if oBuildSource.iFirstRevision is not None:
+            sExtraConditions += oCursor.formatBindArgs('   AND Builds.iRevision >= %s\n', (oBuildSource.iFirstRevision,));
+        if oBuildSource.iLastRevision is not None:
+            sExtraConditions += oCursor.formatBindArgs('   AND Builds.iRevision <= %s\n', (oBuildSource.iLastRevision,));
+
+        # Max age.
+        if oBuildSource.cSecMaxAge is not None:
+            sExtraConditions += oCursor.formatBindArgs('   AND Builds.tsCreated >= (%s - \'%s seconds\'::INTERVAL)\n',
+                                                       (tsNow, oBuildSource.cSecMaxAge,));
+
+        #
+        # Execute the query.
+        #
+        oCursor.execute('SELECT Builds.*, BuildCategories.*,\n'
+                        '       EXISTS( SELECT  tsExpire\n'
+                        '               FROM    BuildBlacklist\n'
+                        '               WHERE   BuildBlacklist.tsExpire = \'infinity\'::TIMESTAMP\n'
+                        '                   AND BuildBlacklist.sProduct = %s\n'
+                        '                   AND BuildBlacklist.sBranch  = %s\n'
+                        '                   AND BuildBlacklist.iFirstRevision <= Builds.iRevision\n'
+                        '                   AND BuildBlacklist.iLastRevision  >= Builds.iRevision ) AS fMaybeBlacklisted\n'
+                        'FROM   Builds, BuildCategories\n'
+                        'WHERE  Builds.idBuildCategory   = BuildCategories.idBuildCategory\n'
+                        '   AND Builds.tsExpire          = \'infinity\'::TIMESTAMP\n'
+                        '   AND Builds.tsEffective      <= %s\n'
+                        '   AND Builds.fBinariesDeleted is FALSE\n'
+                        '   AND BuildCategories.sProduct = %s\n'
+                        '   AND BuildCategories.sBranch  = %s\n'
+                        + sExtraConditions +
+                        'ORDER BY Builds.idBuild DESC\n'
+                        'LIMIT 256\n'
+                        , ( oBuildSource.sProduct, oBuildSource.sBranch,
+                            tsNow, oBuildSource.sProduct, oBuildSource.sBranch,));
+
+        return oCursor;
+
+
+    def getById(self, idBuildSrc):
+        """Get Build Source data by idBuildSrc"""
+
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     BuildSources\n'
+                          'WHERE    tsExpire   = \'infinity\'::timestamp\n'
+                          '  AND    idBuildSrc = %s;', (idBuildSrc,))
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise self._oDb.integrityException(
+                'Found more than one build sources with the same credentials. Database structure is corrupted.')
+        try:
+            return BuildSourceData().initFromDbRow(aRows[0])
+        except IndexError:
+            return None
+
+    #
+    # Internal helpers.
+    #
+
+    def _assertUnique(self, oData, idBuildSrcIgnore):
+        """ Checks that the build source name is unique, raises exception if it isn't. """
+        self._oDb.execute('SELECT idBuildSrc\n'
+                          'FROM   BuildSources\n'
+                          'WHERE  sName    = %s\n'
+                          '   AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                          + ('' if idBuildSrcIgnore is None else  '   AND idBuildSrc <> %d\n' % (idBuildSrcIgnore,))
+                          , ( oData.sName, ))
+        if self._oDb.getRowCount() > 0:
+            raise TMExceptionBase('A build source with name "%s" already exist.' % (oData.sName,));
+        return True;
+
+
+    def _historizeBuildSource(self, idBuildSrc, tsExpire = None):
+        """ Historizes the current build source entry. """
+        if tsExpire is None:
+            self._oDb.execute('UPDATE BuildSources\n'
+                              'SET    tsExpire      = CURRENT_TIMESTAMP\n'
+                              'WHERE  idBuildSrc    = %s\n'
+                              '   AND tsExpire      = \'infinity\'::TIMESTAMP\n'
+                              , ( idBuildSrc, ));
+        else:
+            self._oDb.execute('UPDATE BuildSources\n'
+                              'SET    tsExpire      = %s\n'
+                              'WHERE  idBuildSrc    = %s\n'
+                              '   AND tsExpire      = \'infinity\'::TIMESTAMP\n'
+                              , ( tsExpire, idBuildSrc, ));
+        return True;
+
+
+
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class BuildSourceDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [BuildSourceData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/coreconsts.py b/src/VBox/ValidationKit/testmanager/core/coreconsts.py
new file mode 100644
index 0000000..7e30711
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/coreconsts.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+# $Id: coreconsts.py $
+
+"""
+Test Manager - Test Manager Constants (without a more appropriate home).
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+## OS agnostic.
+g_ksOsAgnostic      = 'os-agnostic';
+## All known OSes, except the agnostic one.
+# See KBUILD_OSES in kBuild/header.kmk for reference.
+g_kasOses           = ['darwin', 'dos', 'dragonfly', 'freebsd', 'haiku', 'l4', 'linux', 'netbsd', 'nt', 'openbsd', 'os2',
+                       'solaris', 'win'];
+## All known OSes, including the agnostic one.
+# See KBUILD_OSES in kBuild/header.kmk for reference.
+g_kasOsesAll        = g_kasOses + [g_ksOsAgnostic,];
+
+
+## Architecture agnostic.
+g_ksCpuArchAgnostic = 'noarch';
+## All known CPU architectures, except the agnostic one.
+# See KBUILD_ARCHES in kBuild/header.kmk for reference.
+g_kasCpuArches      = ['amd64', 'x86', 'sparc32', 'sparc64', 's390', 's390x', 'ppc32', 'ppc64', 'mips32', 'mips64', 'ia64',
+                       'hppa32', 'hppa64', 'arm', 'alpha'];
+## All known CPU architectures, except the agnostic one.
+# See KBUILD_ARCHES in kBuild/header.kmk for reference.
+g_kasCpuArchesAll   = g_kasCpuArches + [g_ksCpuArchAgnostic,];
+
+## All known build types
+# See KBUILD_TYPE in kBuild/header.kmk for reference.
+g_kasBuildTypesAll  = [ 'release', 'strict', 'profile', 'debug' ];
+
+## OS and CPU architecture agnostic.
+g_ksOsDotArchAgnostic = 'os-agnostic.noarch';
+## Combinations of all OSes and CPU architectures, except the two agnostic ones.
+# We do some of them by hand to avoid offering too many choices.
+g_kasOsDotCpus = \
+[
+    'darwin.amd64', 'darwin.x86', 'darwin.ppc32', 'darwin.ppc64', 'darwin.arm',
+    'dos.x86',
+    'dragonfly.amd64', 'dragonfly.x86',
+    'freebsd.amd64', 'freebsd.x86', 'freebsd.sparc64', 'freebsd.ia64', 'freebsd.ppc32', 'freebsd.ppc64', 'freebsd.arm',
+    'freebsd.mips32', 'freebsd.mips64',
+    'haiku.amd64', 'haiku.x86',
+    'l4.amd64', 'l4.x86', 'l4.ppc32', 'l4.ppc64', 'l4.arm',
+    'nt.amd64',  'nt.x86',  'nt.arm',  'nt.ia64',  'nt.mips32',  'nt.ppc32',  'nt.alpha',
+    'win.amd64', 'win.x86', 'win.arm', 'win.ia64', 'win.mips32', 'win.ppc32', 'win.alpha',
+    'os2.x86',
+    'solaris.amd64', 'solaris.x86', 'solaris.sparc32', 'solaris.sparc64',
+];
+for sOs in g_kasOses:
+    if sOs not in ['darwin', 'dos', 'dragonfly', 'freebsd', 'haiku', 'l4', 'nt', 'win', 'os2', 'solaris']:
+        for sArch in g_kasCpuArches:
+            g_kasOsDotCpus.append(sOs + '.' + sArch);
+g_kasOsDotCpus.sort();
+
+## Combinations of all OSes and CPU architectures, including the two agnostic ones.
+g_kasOsDotCpusAll = [g_ksOsDotArchAgnostic]
+g_kasOsDotCpusAll.extend(g_kasOsDotCpus);
+for sOs in g_kasOsesAll:
+    g_kasOsDotCpusAll.append(sOs + '.' + g_ksCpuArchAgnostic);
+for sArch in g_kasCpuArchesAll:
+    g_kasOsDotCpusAll.append(g_ksOsAgnostic + '.' + sArch);
+g_kasOsDotCpusAll.sort();
+
diff --git a/src/VBox/ValidationKit/testmanager/core/db.py b/src/VBox/ValidationKit/testmanager/core/db.py
new file mode 100644
index 0000000..729b9ae
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/db.py
@@ -0,0 +1,630 @@
+# -*- coding: utf-8 -*-
+# $Id: db.py $
+
+"""
+Test Manager - Database Interface.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import datetime;
+import os;
+import psycopg2;
+import psycopg2.extensions;
+import sys;
+
+# Validation Kit imports.
+from common                             import utils, webutils;
+from testmanager                        import config;
+
+# Fix psycho unicode handling in psycopg2 with python 2.x.
+if sys.version_info[0] < 3:
+    psycopg2.extensions.register_type(psycopg2.extensions.UNICODE);
+    psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY);
+
+
+def isDbTimestampInfinity(tsValue):
+    """
+    Checks if tsValue is an infinity timestamp.
+    """
+    ## @todo improve this test...
+    return tsValue.year >= 9999;
+
+def isDbTimestamp(oValue):
+    """
+    Checks if oValue is a DB timestamp object.
+    """
+    if isinstance(oValue, datetime.datetime):
+        return True;
+    if utils.isString(oValue):
+        ## @todo detect strings as well.
+        return False;
+    return getattr(oValue, 'pydatetime', None) != None;
+
+def dbTimestampToDatetime(oValue):
+    """
+    Converts a database timestamp to a datetime instance.
+    """
+    if isinstance(oValue, datetime.datetime):
+        return oValue;
+    if utils.isString(oValue):
+        raise Exception('TODO');
+    return oValue.pydatetime();
+
+def dbTimestampToZuluDatetime(oValue):
+    """
+    Converts a database timestamp to a zulu datetime instance.
+    """
+    tsValue = dbTimestampToDatetime(oValue);
+
+    if tsValue.tzinfo is not None:
+        class UTC(datetime.tzinfo):
+            """UTC TZ Info Class"""
+            def utcoffset(self, _):
+                return datetime.timedelta(0);
+            def tzname(self, _):
+                return "UTC";
+            def dst(self, _):
+                return datetime.timedelta(0);
+        tsValue = tsValue.astimezone(UTC());
+
+    return tsValue;
+
+
+class TMDatabaseIntegrityException(Exception):
+    """
+    Herolds a database integrity error up the callstack.
+
+    Do NOT use directly, only thru TMDatabaseConnection.integrityException.
+    Otherwise, we won't be able to log the issue.
+    """
+    pass;
+
+
+class TMDatabaseCursor(object):
+    """ Cursor wrapper class. """
+
+    def __init__(self, oDb, oCursor):
+        self._oDb     = oDb;
+        self._oCursor = oCursor;
+
+    def execute(self, sOperation, aoArgs = None):
+        """ See TMDatabaseConnection.execute()"""
+        return self._oDb.executeInternal(self._oCursor, sOperation, aoArgs, utils.getCallerName());
+
+    def callProc(self, sProcedure, aoArgs = None):
+        """ See TMDatabaseConnection.callProc()"""
+        return self._oDb.callProcInternal(self._oCursor, sProcedure, aoArgs, utils.getCallerName());
+
+    def fetchOne(self):
+        """Wrapper around Psycopg2.cursor.fetchone."""
+        return self._oCursor.fetchone();
+
+    def fetchMany(self, cRows = None):
+        """Wrapper around Psycopg2.cursor.fetchmany."""
+        return self._oCursor.fetchmany(cRows if cRows is not None else self._oCursor.arraysize);
+
+    def fetchAll(self):
+        """Wrapper around Psycopg2.cursor.fetchall."""
+        return self._oCursor.fetchall();
+
+    def getRowCount(self):
+        """Wrapper around Psycopg2.cursor.rowcount."""
+        return self._oCursor.rowcount;
+
+    def formatBindArgs(self, sStatement, aoArgs):
+        """Wrapper around Psycopg2.cursor.mogrify."""
+        oRet = self._oCursor.mogrify(sStatement, aoArgs);
+        if sys.version_info[0] >= 3 and not isinstance(oRet, str):
+            oRet = oRet.decode('utf-8');
+        return oRet;
+
+    @staticmethod
+    def isTsInfinity(tsValue):
+        """ Checks if tsValue is an infinity timestamp. """
+        return isDbTimestampInfinity(tsValue);
+
+
+class TMDatabaseConnection(object):
+    """
+    Test Manager Database Access class.
+
+    This class contains no logic, just raw access abstraction and utilities,
+    as well as some debug help and some statistics.
+    """
+
+    def __init__(self, fnDPrint = None, oSrvGlue = None):
+        """
+        Database connection wrapper.
+        The fnDPrint is for debug logging of all database activity.
+
+        Raises an exception on failure.
+        """
+
+        sAppName = '%s-%s' % (os.getpid(), os.path.basename(sys.argv[0]),)
+        if len(sAppName) >= 64:
+            sAppName = sAppName[:64];
+        os.environ['PGAPPNAME'] = sAppName;
+
+        dArgs = \
+        { \
+            'database': config.g_ksDatabaseName,
+            'user':     config.g_ksDatabaseUser,
+            'password': config.g_ksDatabasePassword,
+        #    'application_name': sAppName, - Darn stale debian! :/
+        };
+        if config.g_ksDatabaseAddress is not None:
+            dArgs['host'] = config.g_ksDatabaseAddress;
+        if config.g_ksDatabasePort is not None:
+            dArgs['port'] = config.g_ksDatabasePort;
+        self._oConn             = psycopg2.connect(**dArgs); # pylint: disable=W0142
+        self._oConn.set_client_encoding('UTF-8');
+        self._oCursor           = self._oConn.cursor();
+        self._oExplainConn      = None;
+        self._oExplainCursor    = None;
+        if config.g_kfWebUiSqlTraceExplain and config.g_kfWebUiSqlTrace:
+            self._oExplainConn  = psycopg2.connect(**dArgs); # pylint: disable=W0142
+            self._oExplainConn.set_client_encoding('UTF-8');
+            self._oExplainCursor = self._oExplainConn.cursor();
+        self._fTransaction      = False;
+        self._tsCurrent         = None;
+        self._tsCurrentMinusOne = None;
+
+        assert self.isAutoCommitting() is False;
+
+        # Debug and introspection.
+        self._fnDPrint              = fnDPrint;
+        self._aoTraceBack           = [];
+
+        # Exception class handles.
+        self.oXcptError         = psycopg2.Error;
+
+        if oSrvGlue is not None:
+            oSrvGlue.registerDebugInfoCallback(self.debugInfoCallback);
+
+    def isAutoCommitting(self):
+        """ Work around missing autocommit attribute in older versions."""
+        return getattr(self._oConn, 'autocommit', False);
+
+    def close(self):
+        """
+        Closes the connection and renders all cursors useless.
+        """
+        if self._oCursor is not None:
+            self._oCursor.close();
+            self._oCursor = None;
+
+        if self._oConn is not None:
+            self._oConn.close();
+            self._oConn = None;
+
+        if self._oExplainCursor is not None:
+            self._oExplainCursor.close();
+            self._oExplainCursor = None;
+
+        if self._oExplainConn is not None:
+            self._oExplainConn.close();
+            self._oExplainConn = None;
+
+
+    def _startedTransaction(self):
+        """
+        Called to work the _fTransaction and related variables when starting
+        a transaction.
+        """
+        self._fTransaction      = True;
+        self._tsCurrent         = None;
+        self._tsCurrentMinusOne = None;
+        return None;
+
+    def _endedTransaction(self):
+        """
+        Called to work the _fTransaction and related variables when ending
+        a transaction.
+        """
+        self._fTransaction      = False;
+        self._tsCurrent         = None;
+        self._tsCurrentMinusOne = None;
+        return None;
+
+    def begin(self):
+        """
+        Currently just for marking where a transaction starts in the code.
+        """
+        assert self._oConn is not None;
+        assert self.isAutoCommitting() is False;
+        self._aoTraceBack.append([utils.timestampNano(), 'START TRANSACTION', 0, 0, utils.getCallerName(), None]);
+        self._startedTransaction();
+        return True;
+
+    def commit(self, sCallerName = None):
+        """ Wrapper around Psycopg2.connection.commit."""
+        assert self._fTransaction is True;
+
+        nsStart = utils.timestampNano();
+        oRc = self._oConn.commit();
+        cNsElapsed = utils.timestampNano() - nsStart;
+
+        if sCallerName is None:
+            sCallerName = utils.getCallerName();
+        self._aoTraceBack.append([nsStart, 'COMMIT', cNsElapsed, 0, sCallerName, None]);
+        self._endedTransaction();
+        return oRc;
+
+    def maybeCommit(self, fCommit):
+        """
+        Commits if fCommit is True.
+        Returns True if committed, False if not.
+        """
+        if fCommit is True:
+            self.commit(utils.getCallerName());
+            return True;
+        return False;
+
+    def rollback(self):
+        """ Wrapper around Psycopg2.connection.rollback."""
+        nsStart = utils.timestampNano();
+        oRc = self._oConn.rollback();
+        cNsElapsed = utils.timestampNano() - nsStart;
+
+        self._aoTraceBack.append([nsStart, 'ROLLBACK', cNsElapsed, 0, utils.getCallerName(), None]);
+        self._endedTransaction();
+        return oRc;
+
+    #
+    # Internal cursor workers.
+    #
+
+    def executeInternal(self, oCursor, sOperation, aoArgs, sCallerName):
+        """
+        Execute a query or command.
+
+        Mostly a wrapper around the psycopg2 cursor method with the same name,
+        but collect data for traceback.
+        """
+        if aoArgs is None:
+            aoArgs = list();
+
+        sBound = oCursor.mogrify(unicode(sOperation), aoArgs);
+        if sys.version_info[0] >= 3 and not isinstance(sBound, str):
+            sBound = sBound.decode('utf-8');
+
+        aasExplain = None;
+        if self._oExplainCursor is not None:
+            try:
+                if config.g_kfWebUiSqlTraceExplainTiming:
+                    self._oExplainCursor.execute('EXPLAIN (ANALYZE, BUFFERS, COSTS, VERBOSE, TIMING) ' + sBound);
+                else:
+                    self._oExplainCursor.execute('EXPLAIN (ANALYZE, BUFFERS, COSTS, VERBOSE) ' + sBound);
+            except Exception as oXcpt:
+                aasExplain = [ ['Explain exception: '], [str(oXcpt)]];
+                try:    self._oExplainConn.rollback();
+                except: pass;
+            else:
+                aasExplain = self._oExplainCursor.fetchall();
+
+        nsStart = utils.timestampNano();
+        try:
+            oRc = oCursor.execute(sBound);
+        except Exception as oXcpt:
+            cNsElapsed = utils.timestampNano() - nsStart;
+            self._aoTraceBack.append([nsStart, 'oXcpt=%s; Statement: %s' % (oXcpt, sBound), cNsElapsed, 0, sCallerName, None]);
+            if self._fnDPrint is not None:
+                self._fnDPrint('db::execute %u ns, caller %s: oXcpt=%s; Statement: %s'
+                               % (cNsElapsed, sCallerName, oXcpt, sBound));
+            raise;
+        cNsElapsed = utils.timestampNano() - nsStart;
+
+        if self._fTransaction is False and not self.isAutoCommitting(): # Even SELECTs starts transactions with psycopg2, see FAQ.
+            self._aoTraceBack.append([nsStart, '[START TRANSACTION]', 0, 0, sCallerName, None]);
+            self._startedTransaction();
+        self._aoTraceBack.append([nsStart, sBound, cNsElapsed, oCursor.rowcount, sCallerName, aasExplain]);
+        if self._fnDPrint is not None:
+            self._fnDPrint('db::execute %u ns, caller %s: "\n%s"' % (cNsElapsed, sCallerName, sBound));
+        if self.isAutoCommitting():
+            self._aoTraceBack.append([nsStart, '[AUTO COMMIT]', 0, 0, sCallerName, None]);
+
+        return oRc;
+
+    def callProcInternal(self, oCursor, sProcedure, aoArgs, sCallerName):
+        """
+        Call a stored procedure.
+
+        Mostly a wrapper around the psycopg2 cursor method 'callproc', but
+        collect data for traceback.
+        """
+        if aoArgs is None:
+            aoArgs = list();
+
+        nsStart = utils.timestampNano();
+        try:
+            oRc = oCursor.callproc(sProcedure, aoArgs);
+        except Exception as oXcpt:
+            cNsElapsed = utils.timestampNano() - nsStart;
+            self._aoTraceBack.append([nsStart, 'oXcpt=%s; Calling: %s(%s)' % (oXcpt, sProcedure, aoArgs),
+                                      cNsElapsed, 0, sCallerName, None]);
+            if self._fnDPrint is not None:
+                self._fnDPrint('db::callproc %u ns, caller %s: oXcpt=%s; Calling: %s(%s)'
+                               % (cNsElapsed, sCallerName, oXcpt, sProcedure, aoArgs));
+            raise;
+        cNsElapsed = utils.timestampNano() - nsStart;
+
+        if self._fTransaction is False and not self.isAutoCommitting(): # Even SELECTs starts transactions with psycopg2, see FAQ.
+            self._aoTraceBack.append([nsStart, '[START TRANSACTION]', 0, 0, sCallerName, None]);
+            self._startedTransaction();
+        self._aoTraceBack.append([nsStart, '%s(%s)' % (sProcedure, aoArgs), cNsElapsed, oCursor.rowcount, sCallerName, None]);
+        if self._fnDPrint is not None:
+            self._fnDPrint('db::callproc %u ns, caller %s: "%s(%s)"' % (cNsElapsed, sCallerName, sProcedure, aoArgs));
+        if self.isAutoCommitting():
+            self._aoTraceBack.append([nsStart, '[AUTO COMMIT]', 0, 0, sCallerName, sCallerName, None]);
+
+        return oRc;
+
+    def _fetchOne(self, oCursor):
+        """Wrapper around Psycopg2.cursor.fetchone."""
+        oRow = oCursor.fetchone()
+        if self._fnDPrint is not None:
+            self._fnDPrint('db:fetchOne returns: %s' % (oRow,));
+        return oRow;
+
+    def _fetchMany(self, oCursor, cRows):
+        """Wrapper around Psycopg2.cursor.fetchmany."""
+        return oCursor.fetchmany(cRows if cRows is not None else oCursor.arraysize);
+
+    def _fetchAll(self, oCursor):
+        """Wrapper around Psycopg2.cursor.fetchall."""
+        return oCursor.fetchall()
+
+    def _getRowCountWorker(self, oCursor):
+        """Wrapper around Psycopg2.cursor.rowcount."""
+        return oCursor.rowcount;
+
+
+    #
+    # Default cursor access.
+    #
+
+    def execute(self, sOperation, aoArgs = None):
+        """
+        Execute a query or command.
+
+        Mostly a wrapper around the psycopg2 cursor method with the same name,
+        but collect data for traceback.
+        """
+        return self.executeInternal(self._oCursor, sOperation, aoArgs, utils.getCallerName());
+
+    def callProc(self, sProcedure, aoArgs = None):
+        """
+        Call a stored procedure.
+
+        Mostly a wrapper around the psycopg2 cursor method 'callproc', but
+        collect data for traceback.
+        """
+        return self.callProcInternal(self._oCursor, sProcedure, aoArgs, utils.getCallerName());
+
+    def fetchOne(self):
+        """Wrapper around Psycopg2.cursor.fetchone."""
+        return self._oCursor.fetchone();
+
+    def fetchMany(self, cRows = None):
+        """Wrapper around Psycopg2.cursor.fetchmany."""
+        return self._oCursor.fetchmany(cRows if cRows is not None else self._oCursor.arraysize);
+
+    def fetchAll(self):
+        """Wrapper around Psycopg2.cursor.fetchall."""
+        return self._oCursor.fetchall();
+
+    def getRowCount(self):
+        """Wrapper around Psycopg2.cursor.rowcount."""
+        return self._oCursor.rowcount;
+
+    def formatBindArgs(self, sStatement, aoArgs):
+        """Wrapper around Psycopg2.cursor.mogrify."""
+        oRet = self._oCursor.mogrify(sStatement, aoArgs);
+        if sys.version_info[0] >= 3 and not isinstance(oRet, str):
+            oRet = oRet.decode('utf-8');
+        return oRet;
+
+    def getCurrentTimestamps(self):
+        """
+        Returns the current timestamp and the current timestamp minus one tick.
+        This will start a transaction if necessary.
+        """
+        if self._tsCurrent is None:
+            self.execute('SELECT CURRENT_TIMESTAMP, CURRENT_TIMESTAMP - INTERVAL \'1 microsecond\'');
+            (self._tsCurrent, self._tsCurrentMinusOne) = self.fetchOne();
+        return (self._tsCurrent, self._tsCurrentMinusOne);
+
+    def getCurrentTimestamp(self):
+        """
+        Returns the current timestamp.
+        This will start a transaction if necessary.
+        """
+        if self._tsCurrent is None:
+            self.getCurrentTimestamps();
+        return self._tsCurrent;
+
+    def getCurrentTimestampMinusOne(self):
+        """
+        Returns the current timestamp minus one tick.
+        This will start a transaction if necessary.
+        """
+        if self._tsCurrentMinusOne is None:
+            self.getCurrentTimestamps();
+        return self._tsCurrentMinusOne;
+
+
+    #
+    # Additional cursors.
+    #
+    def openCursor(self):
+        """
+        Opens a new cursor (TMDatabaseCursor).
+        """
+        oCursor = self._oConn.cursor();
+        return TMDatabaseCursor(self, oCursor);
+
+    #
+    # Utilities.
+    #
+
+    @staticmethod
+    def isTsInfinity(tsValue):
+        """ Checks if tsValue is an infinity timestamp. """
+        return isDbTimestampInfinity(tsValue);
+
+    #
+    # Error stuff.
+    #
+    def integrityException(self, sMessage):
+        """
+        Database integrity reporter and exception factory.
+        Returns an TMDatabaseIntegrityException which the caller can raise.
+        """
+        ## @todo Create a new database connection and log the issue in the SystemLog table.
+        ##       Alternatively, rollback whatever is going on and do it using the current one.
+        return TMDatabaseIntegrityException(sMessage);
+
+
+    #
+    # Debugging.
+    #
+
+    def dprint(self, sText):
+        """
+        Debug output.
+        """
+        if not self._fnDPrint:
+            return False;
+        self._fnDPrint(sText);
+        return True;
+
+    def debugHtmlReport(self, tsStart = 0):
+        """
+        Used to get a SQL activity dump as HTML, usually for WuiBase._sDebug.
+        """
+        cNsElapsed = 0;
+        for aEntry in self._aoTraceBack:
+            cNsElapsed += aEntry[2];
+
+        sDebug = '<h3>SQL Debug Log (total time %s ns):</h3>\n' \
+                 '<table class="tmsqltable">\n' \
+                 ' <tr>\n' \
+                 '  <th>No.</th>\n' \
+                 '  <th>Timestamp (ns)</th>\n' \
+                 '  <th>Elapsed (ns)</th>\n' \
+                 '  <th>Rows Returned</th>\n' \
+                 '  <th>Command</th>\n' \
+                 '  <th>Caller</th>\n' \
+                 ' </tr>\n' \
+               % (utils.formatNumber(cNsElapsed, ' '),);
+
+        iEntry = 0;
+        for aEntry in self._aoTraceBack:
+            iEntry += 1;
+            sDebug += ' <tr>\n' \
+                      '  <td align="right">%s</td>\n' \
+                      '  <td align="right">%s</td>\n' \
+                      '  <td align="right">%s</td>\n' \
+                      '  <td align="right">%s</td>\n' \
+                      '  <td><pre>%s</pre></td>\n' \
+                      '  <td>%s</td>\n' \
+                      ' </tr>\n' \
+                    % (iEntry,
+                       utils.formatNumber(aEntry[0] - tsStart, ' '),
+                       utils.formatNumber(aEntry[2], ' '),
+                       utils.formatNumber(aEntry[3], ' '),
+                       webutils.escapeElem(aEntry[1]),
+                       webutils.escapeElem(aEntry[4]),
+                    );
+            if aEntry[5] is not None:
+                sDebug += ' <tr>\n' \
+                          '  <td colspan="6"><pre style="white-space: pre-wrap;">%s</pre></td>\n' \
+                          ' </tr>\n' \
+                            % (webutils.escapeElem('\n'.join([aoRow[0] for aoRow in aEntry[5]])),);
+
+        sDebug += '</table>';
+        return sDebug;
+
+    def debugTextReport(self, tsStart = 0):
+        """
+        Used to get a SQL activity dump as text.
+        """
+        cNsElapsed = 0;
+        for aEntry in self._aoTraceBack:
+            cNsElapsed += aEntry[2];
+
+        sHdr = 'SQL Debug Log (total time %s ns)' % (utils.formatNumber(cNsElapsed),);
+        sDebug = sHdr + '\n' + '-' * len(sHdr) + '\n';
+
+        iEntry = 0;
+        for aEntry in self._aoTraceBack:
+            iEntry += 1;
+            sHdr = 'Query #%s  Timestamp: %s ns  Elapsed: %s ns  Rows: %s  Caller: %s' \
+                % ( iEntry,
+                    utils.formatNumber(aEntry[0] - tsStart),
+                    utils.formatNumber(aEntry[2]),
+                    utils.formatNumber(aEntry[3]),
+                    aEntry[4], );
+            sDebug += '\n' + sHdr + '\n' + '-' * len(sHdr) + '\n';
+
+            sDebug += aEntry[1];
+            if sDebug[-1] != '\n':
+                sDebug += '\n';
+
+            if aEntry[5] is not None:
+                sDebug += 'Explain:\n' \
+                          '  %s\n' \
+                        % ( '\n'.join([aoRow[0] for aoRow in aEntry[5]]),);
+
+        return sDebug;
+
+    def debugInfoCallback(self, oGlue, fHtml):
+        """ Called back by the glue code on error. """
+        oGlue.write('\n');
+        if not fHtml:   oGlue.write(self.debugTextReport());
+        else:           oGlue.write(self.debugHtmlReport());
+        oGlue.write('\n');
+        return True;
+
+    def debugEnableExplain(self):
+        """ Enabled explain. """
+        if self._oExplainConn is None:
+            dArgs = \
+            { \
+                'database': config.g_ksDatabaseName,
+                'user':     config.g_ksDatabaseUser,
+                'password': config.g_ksDatabasePassword,
+            #    'application_name': sAppName, - Darn stale debian! :/
+            };
+            if config.g_ksDatabaseAddress is not None:
+                dArgs['host'] = config.g_ksDatabaseAddress;
+            if config.g_ksDatabasePort is not None:
+                dArgs['port'] = config.g_ksDatabasePort;
+            self._oExplainConn  = psycopg2.connect(**dArgs); # pylint: disable=W0142
+            self._oExplainCursor = self._oExplainConn.cursor();
+        return True;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/dbobjcache.py b/src/VBox/ValidationKit/testmanager/core/dbobjcache.py
new file mode 100644
index 0000000..3db2a18
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/dbobjcache.py
@@ -0,0 +1,191 @@
+# -*- coding: utf-8 -*-
+# $Id: dbobjcache.py $
+
+"""
+Test Manager - Database object cache.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.core.base              import ModelLogicBase;
+
+
+class DatabaseObjCache(ModelLogicBase):
+    """
+    Database object cache.
+
+    This is mainly for reports and test results where we wish to get further
+    information on a data series or similar.  The cache should reduce database
+    lookups as well as pyhon memory footprint.
+
+    Note! Dependecies are imported when needed to avoid potential cylic dependency issues.
+    """
+
+    ## @name Cache object types.
+    ## @{
+    ksObjType_TestResultStrTab_idStrName        = 0;
+    ksObjType_BuildCategory_idBuildCategory     = 1;
+    ksObjType_TestBox_idTestBox                 = 2;
+    ksObjType_TestBox_idGenTestBox              = 3;
+    ksObjType_TestCase_idTestCase               = 4;
+    ksObjType_TestCase_idGenTestCase            = 5;
+    ksObjType_TestCaseArgs_idTestCaseArgs       = 6;
+    ksObjType_TestCaseArgs_idGenTestCaseArgs    = 7;
+    ksObjType_VcsRevision_sRepository_iRevision = 8;
+    ksObjType_End                               = 9;
+    ## @}
+
+    def __init__(self, oDb, tsNow = None, sPeriodBack = None, cHoursBack = None):
+        ModelLogicBase.__init__(self, oDb);
+
+        self.tsNow       = tsNow;
+        self.sPeriodBack = sPeriodBack;
+        if sPeriodBack is None and cHoursBack is not None:
+            self.sPeriodBack = '%u hours' % cHoursBack;
+
+        self._adCache    = (
+            dict(), dict(), dict(), dict(),
+            dict(), dict(), dict(), dict(),
+            dict(),
+        );
+        assert(len(self._adCache) == self.ksObjType_End);
+
+    def _handleDbException(self):
+        """ Deals with database exceptions. """
+        raise;
+        #self._oDb.rollback();
+        #return False;
+
+    def getTestResultString(self, idStrName):
+        """ Gets a string from the TestResultStrTab. """
+        sRet = self._adCache[self.ksObjType_TestResultStrTab_idStrName].get(idStrName);
+        if sRet is None:
+            # Load cache entry.
+            self._oDb.execute('SELECT sValue FROM TestResultStrTab WHERE idStr = %s', (idStrName,));
+            sRet = self._oDb.fetchOne()[0];
+            self._adCache[self.ksObjType_TestResultStrTab_idStrName][idStrName] = sRet
+        return sRet;
+
+    def getBuildCategory(self, idBuildCategory):
+        """ Gets the corresponding BuildCategoryData object. """
+        oRet = self._adCache[self.ksObjType_BuildCategory_idBuildCategory].get(idBuildCategory);
+        if oRet is None:
+            # Load cache entry.
+            from testmanager.core.build import BuildCategoryData;
+            oRet = BuildCategoryData();
+            try:    oRet.initFromDbWithId(self._oDb, idBuildCategory);
+            except: self._handleDbException();
+            self._adCache[self.ksObjType_BuildCategory_idBuildCategory][idBuildCategory] = oRet;
+        return oRet;
+
+    def getTestBox(self, idTestBox):
+        """ Gets the corresponding TestBoxData object. """
+        oRet = self._adCache[self.ksObjType_TestBox_idTestBox].get(idTestBox);
+        if oRet is None:
+            # Load cache entry.
+            from testmanager.core.testbox import TestBoxData;
+            oRet = TestBoxData();
+            try:    oRet.initFromDbWithId(self._oDb, idTestBox, self.tsNow, self.sPeriodBack);
+            except: self._handleDbException();
+            else:   self._adCache[self.ksObjType_TestBox_idGenTestBox][oRet.idGenTestBox] = oRet;
+            self._adCache[self.ksObjType_TestBox_idTestBox][idTestBox] = oRet;
+        return oRet;
+
+    def getTestCase(self, idTestCase):
+        """ Gets the corresponding TestCaseData object. """
+        oRet = self._adCache[self.ksObjType_TestCase_idTestCase].get(idTestCase);
+        if oRet is None:
+            # Load cache entry.
+            from testmanager.core.testcase import TestCaseData;
+            oRet = TestCaseData();
+            try:    oRet.initFromDbWithId(self._oDb, idTestCase, self.tsNow, self.sPeriodBack);
+            except: self._handleDbException();
+            else:   self._adCache[self.ksObjType_TestCase_idGenTestCase][oRet.idGenTestCase] = oRet;
+            self._adCache[self.ksObjType_TestCase_idTestCase][idTestCase] = oRet;
+        return oRet;
+
+    def getTestCaseArgs(self, idTestCaseArgs):
+        """ Gets the corresponding TestCaseArgsData object. """
+        oRet = self._adCache[self.ksObjType_TestCaseArgs_idTestCaseArgs].get(idTestCaseArgs);
+        if oRet is None:
+            # Load cache entry.
+            from testmanager.core.testcaseargs import TestCaseArgsData;
+            oRet = TestCaseArgsData();
+            try:    oRet.initFromDbWithId(self._oDb, idTestCaseArgs, self.tsNow, self.sPeriodBack);
+            except: self._handleDbException();
+            else:   self._adCache[self.ksObjType_TestCaseArgs_idGenTestCaseArgs][oRet.idGenTestCaseArgs] = oRet;
+            self._adCache[self.ksObjType_TestCaseArgs_idTestCaseArgs][idTestCaseArgs] = oRet;
+        return oRet;
+
+    def preloadVcsRevInfo(self, sRepository, aiRevisions):
+        """
+        Preloads VCS revision information.
+        ASSUMES aiRevisions does not contain duplicate keys.
+        """
+        from testmanager.core.vcsrevisions import VcsRevisionData;
+        dRepo = self._adCache[self.ksObjType_VcsRevision_sRepository_iRevision].get(sRepository);
+        if dRepo is None:
+            dRepo = dict();
+            self._adCache[self.ksObjType_VcsRevision_sRepository_iRevision][sRepository] = dRepo;
+            aiFiltered = aiRevisions;
+        else:
+            aiFiltered = [];
+            for iRevision in aiRevisions:
+                if iRevision not in dRepo:
+                    aiFiltered.append(iRevision);
+        if len(aiFiltered) > 0:
+            self._oDb.execute('SELECT *\n'
+                              'FROM   VcsRevisions\n'
+                              'WHERE  sRepository = %s\n'
+                              '   AND iRevision IN (' + ','.join([str(i) for i in aiFiltered]) + ')'
+                              , ( sRepository, ));
+            for aoRow in self._oDb.fetchAll():
+                oInfo = VcsRevisionData().initFromDbRow(aoRow);
+                dRepo[oInfo.iRevision] = oInfo;
+        return True;
+
+    def getVcsRevInfo(self, sRepository, iRevision):
+        """
+        Gets the corresponding VcsRevisionData object.
+        May return a default (all NULLs) VcsRevisionData object if the revision
+        information isn't available in the database yet.
+        """
+        dRepo = self._adCache[self.ksObjType_VcsRevision_sRepository_iRevision].get(sRepository);
+        if dRepo is not None:
+            oRet = dRepo.get(iRevision);
+        else:
+            dRepo = dict();
+            self._adCache[self.ksObjType_VcsRevision_sRepository_iRevision][sRepository] = dRepo;
+            oRet = None;
+        if oRet is None:
+            from testmanager.core.vcsrevisions import VcsRevisionLogic;
+            oRet = VcsRevisionLogic(self._oDb).tryFetch(sRepository, iRevision);
+            if oRet is None:
+                from testmanager.core.vcsrevisions import VcsRevisionData;
+                oRet = VcsRevisionData();
+            dRepo[iRevision] = oRet;
+        return oRet;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/failurecategory.py b/src/VBox/ValidationKit/testmanager/core/failurecategory.py
new file mode 100644
index 0000000..02224fc
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/failurecategory.py
@@ -0,0 +1,239 @@
+# -*- coding: utf-8 -*-
+# $Id: failurecategory.py $
+
+"""
+Test Manager - Failure Categories.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.core.base          import ModelDataBase, ModelLogicBase, TMExceptionBase
+from testmanager.core.failurereason import FailureReasonLogic
+
+class FailureCategoryData(ModelDataBase):
+    """
+    Failure Category Data.
+    """
+
+    ksParam_idFailureCategory = 'FailureCategory_idFailureCategory'
+    ksParam_tsEffective       = 'FailureCategory_tsEffective'
+    ksParam_tsExpire          = 'FailureCategory_tsExpire'
+    ksParam_uidAuthor         = 'FailureCategory_uidAuthor'
+    ksParam_sShort            = 'FailureCategory_sShort'
+    ksParam_sFull             = 'FailureCategory_sFull'
+
+    kasAllowNullAttributes    = [ 'idFailureCategory', 'tsEffective', 'tsExpire', 'uidAuthor' ]
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+
+        self.idFailureCategory = None
+        self.tsEffective       = None
+        self.tsExpire          = None
+        self.uidAuthor         = None
+        self.sShort            = None
+        self.sFull             = None
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the data with a row from a SELECT * FROM FailureCategoryes.
+
+        Returns self. Raises exception if the row is None or otherwise invalid.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('Failure Category not found.');
+
+        self.idFailureCategory = aoRow[0]
+        self.tsEffective       = aoRow[1]
+        self.tsExpire          = aoRow[2]
+        self.uidAuthor         = aoRow[3]
+        self.sShort            = aoRow[4]
+        self.sFull             = aoRow[5]
+
+        return self
+
+
+class FailureCategoryLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    Failure Category logic.
+    """
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches Failure Category records.
+
+        Returns an array (list) of FailureCategoryData items, empty list if none.
+        Raises exception on error.
+        """
+
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     FailureCategories\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idFailureCategory ASC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     FailureCategories\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY idFailureCategory ASC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRows = []
+        for aoRow in self._oDb.fetchAll():
+            aoRows.append(FailureCategoryData().initFromDbRow(aoRow))
+        return aoRows
+
+    def getFailureCategoriesForCombo(self, tsEffective = None):
+        """
+        Gets the list of Failure Categories for a combo box.
+        Returns an array of (value [idFailureCategory], drop-down-name [sShort],
+        hover-text [sFull]) tuples.
+        """
+        if tsEffective is None:
+            self._oDb.execute('SELECT   idFailureCategory, sShort, sFull\n'
+                              'FROM     FailureCategories\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sShort')
+        else:
+            self._oDb.execute('SELECT   idFailureCategory, sShort, sFull\n'
+                              'FROM     FailureCategories\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY sShort'
+                              , (tsEffective, tsEffective))
+        return self._oDb.fetchAll()
+
+
+    def getById(self, idFailureCategory):
+        """Get Failure Category data by idFailureCategory"""
+
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     FailureCategories\n'
+                          'WHERE    tsExpire   = \'infinity\'::timestamp\n'
+                          '  AND    idFailureCategory = %s;', (idFailureCategory,))
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise self._oDb.integrityException(
+                'Found more than one failure categories with the same credentials. Database structure is corrupted.')
+        try:
+            return FailureCategoryData().initFromDbRow(aRows[0])
+        except IndexError:
+            return None
+
+    def addEntry(self, oFailureCategoryData, uidAuthor, fCommit=True):
+        """
+        Add Failure Category record
+        """
+
+        # Check if record with the same sShort fiels is already exists
+        self._oDb.execute('SELECT *\n'
+                          'FROM   FailureCategories\n'
+                          'WHERE  tsExpire   = \'infinity\'::TIMESTAMP\n'
+                          '   AND sShort = %s\n',
+                          (oFailureCategoryData.sShort,))
+        if len(self._oDb.fetchAll()) != 0:
+            raise Exception('Record already exist')
+
+        # Add record
+        self._oDb.execute('INSERT INTO FailureCategories (\n'
+                          '  uidAuthor, sShort, sFull'
+                          ')\n'
+                          'VALUES (%s, %s, %s)',
+                          (uidAuthor,
+                           oFailureCategoryData.sShort,
+                           oFailureCategoryData.sFull))
+        if fCommit:
+            self._oDb.commit()
+
+        return True
+
+    def remove(self, uidAuthor, idFailureCategory, fNeedCommit=True):
+        """
+        Historize record
+        """
+
+        # Historize Failure Reasons records first
+        self._oDb.execute('SELECT idFailureReason\n'
+                          'FROM   FailureReasons\n'
+                          'WHERE  idFailureCategory = %s\n'
+                          '   AND tsExpire    = \'infinity\'::TIMESTAMP\n',
+                          (idFailureCategory,))
+        for iFailureReasonId in self._oDb.fetchAll():
+            FailureReasonLogic(self._oDb).remove(
+                uidAuthor, iFailureReasonId, fNeedCommit=False)
+
+        self._oDb.execute('UPDATE FailureCategories\n'
+                          'SET    tsExpire    = CURRENT_TIMESTAMP,\n'
+                          '       uidAuthor   = %s\n'
+                          'WHERE  idFailureCategory = %s\n'
+                          '   AND tsExpire    = \'infinity\'::TIMESTAMP\n',
+                          (uidAuthor, idFailureCategory))
+
+        if fNeedCommit:
+            self._oDb.commit()
+
+        return True
+
+    def editEntry(self, oFailureCategoryData, uidAuthor, fCommit=True):
+        """Modify database record"""
+
+        # Check if record exists
+        oFailureCategoryDataOld = self.getById(oFailureCategoryData.idFailureCategory)
+        if oFailureCategoryDataOld is None:
+            raise TMExceptionBase(
+                'Failure Category (id: %d) does not exist'
+                % oFailureCategoryData.idFailureCategory)
+
+        # Check if anything has been changed
+        if oFailureCategoryData.isEqual(oFailureCategoryDataOld):
+            return True
+
+        # Historize record
+        self.remove(
+            uidAuthor, oFailureCategoryData.idFailureCategory, fNeedCommit=False)
+
+        self._oDb.execute('INSERT INTO FailureCategories (\n'
+                          '  idFailureCategory, uidAuthor, sShort, sFull'
+                          ')\n'
+                          'VALUES (%s, %s, %s, %s)',
+                          (oFailureCategoryData.idFailureCategory,
+                           uidAuthor,
+                           oFailureCategoryData.sShort,
+                           oFailureCategoryData.sFull))
+        if fCommit:
+            self._oDb.commit()
+
+        return True
diff --git a/src/VBox/ValidationKit/testmanager/core/failurereason.py b/src/VBox/ValidationKit/testmanager/core/failurereason.py
new file mode 100644
index 0000000..6e6ab62
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/failurereason.py
@@ -0,0 +1,306 @@
+# -*- coding: utf-8 -*-
+# $Id: failurereason.py $
+
+"""
+Test Manager - Failure Reasons.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.core.base          import ModelDataBase, ModelLogicBase, TMExceptionBase
+
+
+class FailureReasonData(ModelDataBase):
+    """
+    Failure Reason Data.
+    """
+
+    ksIdAttr = 'idFailureReason';
+
+    ksParam_idFailureReason   = 'FailureReasonData_idFailureReason'
+    ksParam_tsEffective       = 'FailureReasonData_tsEffective'
+    ksParam_tsExpire          = 'FailureReasonData_tsExpire'
+    ksParam_uidAuthor         = 'FailureReasonData_uidAuthor'
+    ksParam_idFailureCategory = 'FailureReasonData_idFailureCategory'
+    ksParam_sShort            = 'FailureReasonData_sShort'
+    ksParam_sFull             = 'FailureReasonData_sFull'
+    ksParam_iTicket           = 'FailureReasonData_iTicket'
+    ksParam_asUrls            = 'FailureReasonData_asUrls'
+
+    kasAllowNullAttributes    = [ 'idFailureReason', 'tsEffective', 'tsExpire',
+                                  'uidAuthor',       'iTicket',      'asUrls' ]
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+
+        self.idFailureReason   = None
+        self.tsEffective       = None
+        self.tsExpire          = None
+        self.uidAuthor         = None
+        self.idFailureCategory = None
+        self.sShort            = None
+        self.sFull             = None
+        self.iTicket           = None
+        self.asUrls            = None
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the data with a row from a SELECT * FROM FailureReasons.
+
+        Returns self. Raises exception if the row is None or otherwise invalid.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('Failure Reason not found.');
+
+        self.idFailureReason   = aoRow[0]
+        self.tsEffective       = aoRow[1]
+        self.tsExpire          = aoRow[2]
+        self.uidAuthor         = aoRow[3]
+        self.idFailureCategory = aoRow[4]
+        self.sShort            = aoRow[5]
+        self.sFull             = aoRow[6]
+        self.iTicket           = aoRow[7]
+        self.asUrls            = aoRow[8]
+
+        return self
+
+
+class FailureReasonLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    Failure Reason logic.
+    """
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches Failure Category records.
+
+        Returns an array (list) of FailureReasonData items, empty list if none.
+        Raises exception on error.
+        """
+
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     FailureReasons\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idFailureReason DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     FailureReasons\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY idFailureReason DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRows = []
+        for aoRow in self._oDb.fetchAll():
+            aoRows.append(FailureReasonData().initFromDbRow(aoRow))
+        return aoRows
+
+    def fetchForCombo(self, tsEffective = None):
+        """
+        Gets the list of Failure Reasons for a combo box.
+        Returns an array of (value [idFailureReason], drop-down-name [sShort],
+        hover-text [sFull]) tuples.
+        """
+        if tsEffective is None:
+            self._oDb.execute('SELECT   idFailureReason, sShort, sFull\n'
+                              'FROM     FailureReasons\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sShort')
+        else:
+            self._oDb.execute('SELECT   idFailureReason, sShort, sFull\n'
+                              'FROM     FailureReasons\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY sShort'
+                              , (tsEffective, tsEffective))
+        return self._oDb.fetchAll()
+
+    def getById(self, idFailureReason):
+        """Get Failure Reason data by idFailureReason"""
+
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     FailureReasons\n'
+                          'WHERE    tsExpire   = \'infinity\'::timestamp\n'
+                          '  AND    idFailureReason = %s;', (idFailureReason,))
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise self._oDb.integrityException(
+                'Found more than one failure reasons with the same credentials. Database structure is corrupted.')
+        try:
+            return FailureReasonData().initFromDbRow(aRows[0])
+        except IndexError:
+            return None
+
+    def getIdsByCategory(self, idFailureCategory, tsEffective=None):
+        """
+        Gets the list of Failure Ressons IDs,
+        all the items belong to @param idFailureCategory
+        """
+        if tsEffective is None:
+            self._oDb.execute('SELECT   idFailureReason\n'
+                              'FROM     FailureReasons\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              '     AND idFailureCategory = %s\n'
+                              'ORDER BY idFailureReason DESC'
+                              , (idFailureCategory,))
+        else:
+            self._oDb.execute('SELECT   idFailureReason\n'
+                              'FROM     FailureReasons\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              '     AND idFailureCategory = %s\n'
+                              'ORDER BY idFailureReason DESC'
+                              , (tsEffective, tsEffective, idFailureCategory))
+        return self._oDb.fetchAll()
+
+    def getAll(self, tsEffective=None):
+        """
+        Gets the list of all Failure Reasons.
+        Returns an array of FailureReasonData instances.
+        """
+        if tsEffective is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     FailureReasons\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idFailureReason DESC')
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     FailureReasons\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY idFailureReason DESC'
+                              , (tsEffective, tsEffective))
+        aoRet = []
+        for aoRow in self._oDb.fetchAll():
+            aoRet.append(FailureReasonData().initFromDbRow(aoRow))
+        return aoRet
+
+    def addEntry(self, oFailureReasonData, uidAuthor, fCommit=True):
+        """Add record to database"""
+
+        # Check if record with the same sShort fiels is already exists
+        self._oDb.execute('SELECT *\n'
+                          'FROM   FailureReasons\n'
+                          'WHERE  tsExpire   = \'infinity\'::TIMESTAMP\n'
+                          '   AND sShort = %s\n',
+                          (oFailureReasonData.sShort,))
+        if len(self._oDb.fetchAll()) != 0:
+            raise Exception('Record already exist')
+
+        # Add record
+        self._oDb.execute('INSERT INTO FailureReasons (\n'
+                          '  uidAuthor, idFailureCategory,'
+                          '  sShort, sFull, iTicket, asUrls'
+                          ')\n'
+                          'VALUES (%s, %s, %s, %s, %s, %s)',
+                          (uidAuthor,
+                           oFailureReasonData.idFailureCategory,
+                           oFailureReasonData.sShort,
+                           oFailureReasonData.sFull,
+                           oFailureReasonData.iTicket,
+                           oFailureReasonData.asUrls))
+        if fCommit:
+            self._oDb.commit()
+
+        return True
+
+    def remove(self, uidAuthor, idFailureReason, fNeedCommit=True):
+        """
+        Historize record
+        """
+        self._oDb.execute('UPDATE FailureReasons\n'
+                          'SET    tsExpire    = CURRENT_TIMESTAMP,\n'
+                          '       uidAuthor   = %s\n'
+                          'WHERE  idFailureReason = %s\n'
+                          '   AND tsExpire    = \'infinity\'::TIMESTAMP\n',
+                          (uidAuthor, idFailureReason))
+
+        # Also historize Black List records
+        self._oDb.execute('UPDATE BuildBlackList\n'
+                          'SET    tsExpire    = CURRENT_TIMESTAMP,\n'
+                          '       uidAuthor   = %s\n'
+                          'WHERE  idFailureReason = %s\n'
+                          '   AND tsExpire    = \'infinity\'::TIMESTAMP\n',
+                          (uidAuthor, idFailureReason))
+
+        if fNeedCommit:
+            self._oDb.commit()
+
+        return True
+
+    def editEntry(self, oFailureReasonData, uidAuthor, fCommit=True):
+        """Modify database record"""
+
+        # Check if record exists
+        oFailureReasonDataOld = self.getById(oFailureReasonData.idFailureReason)
+        if oFailureReasonDataOld is None:
+            raise TMExceptionBase(
+                'Failure Reason (id: %d) does not exist'
+                % oFailureReasonData.idFailureReason)
+
+        # Check if anything has been changed
+        if oFailureReasonData.isEqual(oFailureReasonDataOld):
+            return True
+
+        # Historize record
+        self.remove(
+            uidAuthor, oFailureReasonData.idFailureReason, fNeedCommit=False)
+
+
+        # Add new record (keeping its ID)
+        self._oDb.execute('INSERT INTO FailureReasons (\n'
+                          '  idFailureReason,'
+                          '  uidAuthor,'
+                          '  idFailureCategory,'
+                          '  sShort,'
+                          '  sFull,'
+                          '  iTicket,'
+                          '  asUrls'
+                          ')\n'
+                          'VALUES (%s, %s, %s, %s, %s, %s, %s)',
+                          (oFailureReasonData.idFailureReason,
+                           uidAuthor,
+                           oFailureReasonData.idFailureCategory,
+                           oFailureReasonData.sShort,
+                           oFailureReasonData.sFull,
+                           oFailureReasonData.iTicket,
+                           oFailureReasonData.asUrls
+                           ))
+
+        if fCommit:
+            self._oDb.commit()
+
+        return True
diff --git a/src/VBox/ValidationKit/testmanager/core/globalresource.pgsql b/src/VBox/ValidationKit/testmanager/core/globalresource.pgsql
new file mode 100644
index 0000000..5b20ccd
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/globalresource.pgsql
@@ -0,0 +1,108 @@
+-- $Id: globalresource.pgsql $
+--- @file
+-- VBox Test Manager Database Stored Procedures.
+--
+
+--
+-- Copyright (C) 2006-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+\set ON_ERROR_STOP 1
+\connect testmanager;
+
+-- Args: uidAuthor, sName, sDescription, fEnabled
+CREATE OR REPLACE function add_globalresource(integer, text, text, bool) RETURNS integer AS $$
+    DECLARE
+        _idGlobalRsrc integer;
+        _uidAuthor ALIAS FOR $1;
+        _sName ALIAS FOR $2;
+        _sDescription ALIAS FOR $3;
+        _fEnabled ALIAS FOR $4;
+    BEGIN
+        -- Check if Global Resource name is unique
+        IF EXISTS(SELECT * FROM GlobalResources
+                    WHERE sName=_sName AND
+                          tsExpire='infinity'::timestamp) THEN
+            RAISE EXCEPTION 'Duplicate Global Resource name';
+        END IF;
+        INSERT INTO GlobalResources (uidAuthor, sName, sDescription, fEnabled)
+            VALUES (_uidAuthor, _sName, _sDescription, _fEnabled) RETURNING idGlobalRsrc INTO _idGlobalRsrc;
+        RETURN _idGlobalRsrc;
+    END;
+$$ LANGUAGE plpgsql;
+
+-- Args: uidAuthor, idGlobalRsrc
+CREATE OR REPLACE function del_globalresource(integer, integer) RETURNS VOID AS $$
+    DECLARE
+        _uidAuthor ALIAS FOR $1;
+        _idGlobalRsrc ALIAS FOR $2;
+    BEGIN
+
+        -- Check if record exist
+        IF NOT EXISTS(SELECT * FROM GlobalResources WHERE idGlobalRsrc=_idGlobalRsrc AND tsExpire='infinity'::timestamp) THEN
+            RAISE EXCEPTION 'Global resource (%) does not exist', _idGlobalRsrc;
+        END IF;
+
+        -- Historize record: GlobalResources
+        UPDATE GlobalResources
+          SET   tsExpire=CURRENT_TIMESTAMP,
+                uidAuthor=_uidAuthor
+          WHERE idGlobalRsrc=_idGlobalRsrc AND
+                tsExpire='infinity'::timestamp;
+
+
+        -- Delete record: GlobalResourceStatuses
+        DELETE FROM GlobalResourceStatuses WHERE idGlobalRsrc=_idGlobalRsrc;
+
+        -- Historize record: TestCaseGlobalRsrcDeps
+        UPDATE TestCaseGlobalRsrcDeps
+          SET   tsExpire=CURRENT_TIMESTAMP,
+                uidAuthor=_uidAuthor
+          WHERE idGlobalRsrc=_idGlobalRsrc AND
+                tsExpire='infinity'::timestamp;
+
+    END;
+$$ LANGUAGE plpgsql;
+
+-- Args: uidAuthor, idGlobalRsrc, sName, sDescription, fEnabled
+CREATE OR REPLACE function update_globalresource(integer, integer, text, text, bool) RETURNS VOID AS $$
+    DECLARE
+        _uidAuthor ALIAS FOR $1;
+        _idGlobalRsrc ALIAS FOR $2;
+        _sName ALIAS FOR $3;
+        _sDescription ALIAS FOR $4;
+        _fEnabled ALIAS FOR $5;
+    BEGIN
+        -- Hostorize record
+        UPDATE GlobalResources
+          SET   tsExpire=CURRENT_TIMESTAMP
+          WHERE idGlobalRsrc=_idGlobalRsrc AND
+                tsExpire='infinity'::timestamp;
+        -- Check if Global Resource name is unique
+        IF EXISTS(SELECT * FROM GlobalResources
+                    WHERE sName=_sName AND
+                          tsExpire='infinity'::timestamp) THEN
+            RAISE EXCEPTION 'Duplicate Global Resource name';
+        END IF;
+        -- Add new record
+        INSERT INTO GlobalResources(uidAuthor, idGlobalRsrc, sName, sDescription, fEnabled)
+            VALUES (_uidAuthor, _idGlobalRsrc, _sName, _sDescription, _fEnabled);
+    END;
+$$ LANGUAGE plpgsql;
diff --git a/src/VBox/ValidationKit/testmanager/core/globalresource.py b/src/VBox/ValidationKit/testmanager/core/globalresource.py
new file mode 100644
index 0000000..e1dfe92
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/globalresource.py
@@ -0,0 +1,276 @@
+# -*- coding: utf-8 -*-
+# $Id: globalresource.py $
+
+"""
+Test Manager - Global Resources.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from testmanager.core.base import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+
+
+class GlobalResourceData(ModelDataBase):
+    """
+    Global resource data
+    """
+
+    ksIdAttr = 'idGlobalRsrc';
+
+    ksParam_idGlobalRsrc        = 'GlobalResource_idGlobalRsrc'
+    ksParam_tsEffective         = 'GlobalResource_tsEffective'
+    ksParam_tsExpire            = 'GlobalResource_tsExpire'
+    ksParam_uidAuthor           = 'GlobalResource_uidAuthor'
+    ksParam_sName               = 'GlobalResource_sName'
+    ksParam_sDescription        = 'GlobalResource_sDescription'
+    ksParam_fEnabled            = 'GlobalResource_fEnabled'
+
+    kasAllowNullAttributes      = ['idGlobalRsrc', 'tsEffective', 'tsExpire', 'uidAuthor', 'sDescription' ];
+    kcchMin_sName               = 2;
+    kcchMax_sName               = 64;
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idGlobalRsrc       = None;
+        self.tsEffective        = None;
+        self.tsExpire           = None;
+        self.uidAuthor          = None;
+        self.sName              = None;
+        self.sDescription       = None;
+        self.fEnabled           = False
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestCases row.
+        Returns self. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Global resource not found.')
+
+        self.idGlobalRsrc       = aoRow[0]
+        self.tsEffective        = aoRow[1]
+        self.tsExpire           = aoRow[2]
+        self.uidAuthor          = aoRow[3]
+        self.sName              = aoRow[4]
+        self.sDescription       = aoRow[5]
+        self.fEnabled           = aoRow[6]
+        return self
+
+    def initFromDbWithId(self, oDb, idGlobalRsrc, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   GlobalResources\n'
+                                                       'WHERE  idGlobalRsrc = %s\n'
+                                                       , ( idGlobalRsrc,), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idGlobalRsrc=%s not found (tsNow=%s sPeriodBack=%s)' % (idGlobalRsrc, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+    def isEqual(self, oOther):
+        """
+        Compares two instances.
+        """
+        return       self.idGlobalRsrc == oOther.idGlobalRsrc \
+            and str(self.tsEffective)  == str(oOther.tsEffective) \
+            and str(self.tsExpire)     == str(oOther.tsExpire) \
+            and      self.uidAuthor    == oOther.uidAuthor \
+            and      self.sName        == oOther.sName \
+            and      self.sDescription == oOther.sDescription \
+            and      self.fEnabled     == oOther.fEnabled
+
+
+class GlobalResourceLogic(ModelLogicBase):
+    """
+    Global resource logic.
+    """
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Returns an array (list) of FailureReasonData items, empty list if none.
+        Raises exception on error.
+        """
+
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     GlobalResources\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idGlobalRsrc DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     GlobalResources\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY idGlobalRsrc DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,))
+
+        aoRows = []
+        for aoRow in self._oDb.fetchAll():
+            aoRows.append(GlobalResourceData().initFromDbRow(aoRow))
+        return aoRows
+
+    def getAll(self, tsEffective = None):
+        """
+        Gets all global resources.
+
+        Returns an array of GlobalResourceData instances on success (can be
+        empty).  Raises exception on database error.
+        """
+        if tsEffective is not None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     GlobalResources\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              , (tsEffective, tsEffective));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     GlobalResources\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n');
+        aaoRows = self._oDb.fetchAll();
+        aoRet = [];
+        for aoRow in aaoRows:
+            aoRet.append(GlobalResourceData().initFromDbRow(aoRow));
+
+        return aoRet;
+
+    def addGlobalResource(self, uidAuthor, oData):
+        """Add Global Resource DB record"""
+        self._oDb.execute('SELECT * FROM add_globalresource(%s, %s, %s, %s);',
+                          (uidAuthor,
+                           oData.sName,
+                           oData.sDescription,
+                           oData.fEnabled))
+        self._oDb.commit()
+        return True
+
+    def editGlobalResource(self, uidAuthor, idGlobalRsrc, oData):
+        """Modify Global Resource DB record"""
+        # Check if anything has been changed
+        oGlobalResourcesDataOld = self.getById(idGlobalRsrc)
+        if oGlobalResourcesDataOld.isEqual(oData):
+            # Nothing has been changed, do nothing
+            return True
+
+        self._oDb.execute('SELECT * FROM update_globalresource(%s, %s, %s, %s, %s);',
+                          (uidAuthor,
+                           idGlobalRsrc,
+                           oData.sName,
+                           oData.sDescription,
+                           oData.fEnabled))
+        self._oDb.commit()
+        return True
+
+    def remove(self, uidAuthor, idGlobalRsrc):
+        """Delete Global Resource DB record"""
+        self._oDb.execute('SELECT * FROM del_globalresource(%s, %s);',
+                          (uidAuthor, idGlobalRsrc))
+        self._oDb.commit()
+        return True
+
+    def getById(self, idGlobalRsrc):
+        """
+        Get global resource record by its id
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     GlobalResources\n'
+                          'WHERE    tsExpire = \'infinity\'::timestamp\n'
+                          '  AND    idGlobalRsrc=%s;', (idGlobalRsrc,))
+
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise self._oDb.integrityException('Duplicate global resource entry with ID %u (current)' % (idGlobalRsrc,));
+        try:
+            return GlobalResourceData().initFromDbRow(aRows[0])
+        except IndexError:
+            raise TMExceptionBase('Global resource not found.')
+
+    def allocateResources(self, idTestBox, aoGlobalRsrcs, fCommit = False):
+        """
+        Allocates the given global resource.
+
+        Returns True of successfully allocated the resources, False if not.
+        May raise exception on DB error.
+        """
+        # Quit quickly if there is nothing to alloocate.
+        if len(aoGlobalRsrcs) == 0:
+            return True;
+
+        #
+        # Note! Someone else might have allocated the resources since the
+        #       scheduler check that they were available. In such case we
+        #       need too quietly rollback and return FALSE.
+        #
+        self._oDb.execute('SAVEPOINT allocateResources');
+
+        for oGlobalRsrc in aoGlobalRsrcs:
+            try:
+                self._oDb.execute('INSERT INTO GlobalResourceStatuses (idGlobalRsrc, idTestBox)\n'
+                                  'VALUES (%s, %s)', (oGlobalRsrc.idGlobalRsrc, idTestBox, ) );
+            except self._oDb.oXcptError:
+                self._oDb.execute('ROLLBACK TO SAVEPOINT allocateResources');
+                return False;
+
+        self._oDb.execute('RELEASE SAVEPOINT allocateResources');
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def freeGlobalResourcesByTestBox(self, idTestBox, fCommit = False):
+        """
+        Frees all global resources own by the given testbox.
+        Returns True. May raise exception on DB error.
+        """
+        self._oDb.execute('DELETE FROM GlobalResourceStatuses\n'
+                          'WHERE    idTestBox = %s\n', (idTestBox, ) );
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class GlobalResourceDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [GlobalResourceData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/report.py b/src/VBox/ValidationKit/testmanager/core/report.py
new file mode 100644
index 0000000..3d7aa6d
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/report.py
@@ -0,0 +1,627 @@
+# -*- coding: utf-8 -*-
+# $Id: report.py $
+
+"""
+Test Manager - Report models.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.core.base          import ModelLogicBase, TMExceptionBase;
+from testmanager.core.build         import BuildCategoryData;
+from testmanager.core.dbobjcache    import DatabaseObjCache;
+from testmanager.core.testbox       import TestBoxData;
+from common                         import constants;
+
+
+
+class ReportModelBase(ModelLogicBase): # pylint: disable=R0903
+    """
+    Something all report logic(/miner) classes inherit from.
+    """
+
+    ## @name Report subjects
+    ## @{
+    ksSubEverything       = 'Everything';
+    ksSubSchedGroup       = 'SchedGroup';
+    ksSubTestGroup        = 'TestGroup';
+    ksSubTestCase         = 'TestCase';
+    ksSubTestCaseArgs     = 'TestCaseArgs';
+    ksSubTestBox          = 'TestBox';
+    ksSubBuild            = 'Build';
+    ## @}
+    kasSubjects           = [ ksSubEverything, ksSubSchedGroup, ksSubTestGroup, ksSubTestCase, ksSubTestBox, ksSubBuild, ];
+
+
+    ## @name TestStatus_T
+    # @{
+    ksTestStatus_Running    = 'running';
+    ksTestStatus_Success    = 'success';
+    ksTestStatus_Skipped    = 'skipped';
+    ksTestStatus_BadTestBox = 'bad-testbox';
+    ksTestStatus_Aborted    = 'aborted';
+    ksTestStatus_Failure    = 'failure';
+    ksTestStatus_TimedOut   = 'timed-out';
+    ksTestStatus_Rebooted   = 'rebooted';
+    ## @}
+
+
+    def __init__(self, oDb, tsNow, cPeriods, cHoursPerPeriod, sSubject, aidSubjects):
+        ModelLogicBase.__init__(self, oDb);
+        # Public so the report generator can easily access them.
+        self.tsNow           = tsNow;               # (Can be None.)
+        self.cPeriods        = cPeriods;
+        self.cHoursPerPeriod = cHoursPerPeriod;
+        self.sSubject        = sSubject;
+        self.aidSubjects     = aidSubjects;
+
+    def getExtraSubjectTables(self):
+        """
+        Returns a string with any extra tables needed by the subject. Each
+        table name is prefixed by a comma, so can be appended to a FROM
+        statement.
+        """
+        if self.sSubject == self.ksSubSchedGroup:
+            return ', TestBoxes';
+        return '';
+
+    def getExtraSubjectWhereExpr(self):
+        """
+        Returns additional WHERE expression relating to the report subject.  It starts
+        with an AND so that it can simply be appended to the WHERE clause.
+        """
+        if self.sSubject == self.ksSubEverything:
+            return '';
+
+        if self.sSubject == self.ksSubSchedGroup:
+            sWhere = '     AND TestBoxes.idTestBox    =  TestSets.idTestBox\n' \
+                     '     AND TestBoxes.tsEffective  >  TestSets.tsCreated\n' \
+                     '     AND TestBoxes.tsExpire     <= TestSets.tsCreated\n' \
+                     '     AND TestBoxes.idSchedGroup';
+        elif self.sSubject == self.ksSubTestGroup:
+            sWhere = '     AND TestSets.idTestGroup';
+        elif self.sSubject == self.ksSubTestCase:
+            sWhere = '     AND TestSets.idTestCase';
+        elif self.sSubject == self.ksSubTestCaseArgs:
+            sWhere = '     AND TestSets.idTestCaseArgs';
+        elif self.sSubject == self.ksSubTestBox:
+            sWhere = '     AND TestSets.idTestBox';
+        elif self.sSubject == self.ksSubBuild:
+            sWhere = '     AND TestSets.idBuild';
+        else:
+            raise TMExceptionBase(self.sSubject);
+
+        if len(self.aidSubjects) == 1:
+            sWhere += self._oDb.formatBindArgs(' = %s\n', (self.aidSubjects[0],));
+        else:
+            assert len(self.aidSubjects) > 0;
+            sWhere += self._oDb.formatBindArgs(' IN (%s', (self.aidSubjects[0],));
+            for i in range(1, len(self.aidSubjects)):
+                sWhere += self._oDb.formatBindArgs(', %s', (self.aidSubjects[i],));
+            sWhere += ')\n';
+
+        return sWhere;
+
+    def getExtraWhereExprForPeriod(self, iPeriod):
+        """
+        Returns additional WHERE expression for getting test sets for the
+        specified period.  It starts with an AND so that it can simply be
+        appended to the WHERE clause.
+        """
+        if self.tsNow is None:
+            sNow = 'CURRENT_TIMESTAMP';
+        else:
+            sNow = self._oDb.formatBindArgs('%s::TIMESTAMP', (self.tsNow,));
+
+        cHoursStart = (self.cPeriods - iPeriod    ) * self.cHoursPerPeriod;
+        cHoursEnd   = (self.cPeriods - iPeriod - 1) * self.cHoursPerPeriod;
+        if cHoursEnd == 0:
+            return '     AND TestSets.tsDone >= (%s - interval \'%u hours\')\n' \
+                   '     AND TestSets.tsDone <  %s\n' \
+                 % (sNow, cHoursStart, sNow);
+        return '     AND TestSets.tsDone >= (%s - interval \'%u hours\')\n' \
+               '     AND TestSets.tsDone <  (%s - interval \'%u hours\')\n' \
+             % (sNow, cHoursStart, sNow, cHoursEnd);
+
+    def getPeriodDesc(self, iPeriod):
+        """
+        Returns the period description, usually for graph data.
+        """
+        if iPeriod == 0:
+            return 'now';
+        if self.cHoursPerPeriod == 24:
+            return '%dd ago' % (iPeriod, );
+        return '%dh ago' % (iPeriod * self.cHoursPerPeriod, );
+
+
+
+
+class ReportLazyModel(ReportModelBase): # pylint: disable=R0903
+    """
+    The 'lazy bird' report model class.
+
+    We may want to have several classes, maybe one for each report even. But,
+    I'm thinking that's a bit overkill so we'll start with this and split it
+    if/when it becomes necessary.
+    """
+
+
+    kdsStatusSimplificationMap = {
+        ReportModelBase.ksTestStatus_Running:       ReportModelBase.ksTestStatus_Running,
+        ReportModelBase.ksTestStatus_Success:       ReportModelBase.ksTestStatus_Success,
+        ReportModelBase.ksTestStatus_Skipped:       ReportModelBase.ksTestStatus_Skipped,
+        ReportModelBase.ksTestStatus_BadTestBox:    ReportModelBase.ksTestStatus_Skipped,
+        ReportModelBase.ksTestStatus_Aborted:       ReportModelBase.ksTestStatus_Skipped,
+        ReportModelBase.ksTestStatus_Failure:       ReportModelBase.ksTestStatus_Failure,
+        ReportModelBase.ksTestStatus_TimedOut:      ReportModelBase.ksTestStatus_Failure,
+        ReportModelBase.ksTestStatus_Rebooted:      ReportModelBase.ksTestStatus_Failure,
+    };
+
+    def getSuccessRates(self):
+        """
+        Gets the success rates of the subject in the specified period.
+
+        Returns an array of data per period (0 is the oldes, self.cPeriods-1 is
+        the latest) where each entry is a status (TestStatus_T) dictionary with
+        the number of occurences of each final status (i.e. not running).
+        """
+
+        adPeriods = [];
+        for iPeriod in range(self.cPeriods):
+            self._oDb.execute('SELECT   enmStatus, COUNT(TestSets.idTestSet)\n'
+                              'FROM     TestSets' + self.getExtraSubjectTables() +'\n'
+                              'WHERE    enmStatus <> \'running\'\n'
+                              + self.getExtraSubjectWhereExpr()
+                              + self.getExtraWhereExprForPeriod(iPeriod)
+                              +
+                              'GROUP BY enmStatus\n');
+
+            dRet = \
+            {
+                self.ksTestStatus_Skipped: 0,
+                self.ksTestStatus_Failure: 0,
+                self.ksTestStatus_Success: 0,
+            };
+
+            for aoRow in self._oDb.fetchAll():
+                sKey = self.kdsStatusSimplificationMap[aoRow[0]]
+                if sKey in dRet:
+                    dRet[sKey] += aoRow[1];
+                else:
+                    dRet[sKey]  = aoRow[1];
+
+            assert len(dRet) == 3;
+
+            adPeriods.insert(0, dRet);
+
+        return adPeriods;
+
+class ReportGraphModel(ReportModelBase): # pylint: disable=R0903
+    """
+    Extended report model used when generating the more complicated graphs
+    detailing results, time elapsed and values over time.
+    """
+
+    ## @name Subject ID types.
+    ## These prefix the values in the aidSubjects array.  The prefix is
+    ## followed by a colon and then a list of string IDs.  Following the prefix
+    ## is one or more string table IDs separated by colons.  These are used to
+    ## drill down the exact test result we're looking for, by matching against
+    ## TestResult::idStrName (in the db).
+    ## @{
+    ksTypeResult  = 'result';
+    ksTypeElapsed = 'elapsed';
+    ## The last string table ID gives the name of the value.
+    ksTypeValue   = 'value';
+    ## List of types.
+    kasTypes = (ksTypeResult, ksTypeElapsed, ksTypeValue);
+    ## @}
+
+    class SampleSource(object):
+        """ A sample source. """
+        def __init__(self, sType, aidStrTests, idStrValue):
+            self.sType       = sType;
+            self.aidStrTests = aidStrTests;
+            self.idStrValue  = idStrValue;
+
+        def getTestResultTables(self):
+            """ Retrieves the list of TestResults tables to join with."""
+            sRet = '';
+            for i in range(len(self.aidStrTests)):
+                sRet += '         TestResults TR%u,\n' % (i,);
+            return sRet;
+
+        def getTestResultConditions(self):
+            """ Retrieves the join conditions for the TestResults tables."""
+            sRet = '';
+            cItems = len(self.aidStrTests);
+            for i in range(cItems - 1):
+                sRet += '     AND TR%u.idStrName = %u\n' \
+                        '     AND TR%u.idTestResultParent = TR%u.idTestResult\n' \
+                      % ( i, self.aidStrTests[cItems - i - 1], i, i + 1 );
+            sRet += '     AND TR%u.idStrName = %u\n' % (cItems - 1, self.aidStrTests[0]);
+            return sRet;
+
+    class DataSeries(object):
+        """ A data series. """
+        def __init__(self, oCache, idBuildCategory, idTestBox, idTestCase, idTestCaseArgs, iUnit):
+            _ = oCache;
+            self.idBuildCategory    = idBuildCategory;
+            self.oBuildCategory     = oCache.getBuildCategory(idBuildCategory);
+            self.idTestBox          = idTestBox;
+            self.oTestBox           = oCache.getTestBox(idTestBox);
+            self.idTestCase         = idTestCase;
+            self.idTestCaseArgs     = idTestCaseArgs;
+            if idTestCase is not None:
+                self.oTestCase      = oCache.getTestCase(idTestCase);
+                self.oTestCaseArgs  = None;
+            else:
+                self.oTestCaseArgs  = oCache.getTestCaseArgs(idTestCaseArgs);
+                self.oTestCase      = oCache.getTestCase(self.oTestCaseArgs.idTestCase);
+            self.iUnit              = iUnit;
+            # Six parallel arrays.
+            self.aiRevisions        = []; # The X values.
+            self.aiValues           = []; # The Y values.
+            self.aiErrorBarBelow    = []; # The Y value minimum errorbars, relative to the Y value (positive).
+            self.aiErrorBarAbove    = []; # The Y value maximum errorbars, relative to the Y value (positive).
+            self.acSamples          = []; # The number of samples at this X value.
+            self.aoRevInfo          = []; # VcsRevisionData objects for each revision. Empty/SQL-NULL objects if no info.
+
+    class DataSeriesCollection(object):
+        """ A collection of data series corresponding to one input sample source. """
+        def __init__(self, oSampleSrc, asTests, sValue = None):
+            self.sType       = oSampleSrc.sType;
+            self.aidStrTests = oSampleSrc.aidStrTests;
+            self.asTests     = list(asTests);
+            self.idStrValue  = oSampleSrc.idStrValue;
+            self.sValue      = sValue;
+            self.aoSeries    = [];
+
+        def addDataSeries(self, oDataSeries):
+            """ Appends a data series to the collection. """
+            self.aoSeries.append(oDataSeries);
+            return oDataSeries;
+
+
+    def __init__(self, oDb, tsNow, cPeriods, cHoursPerPeriod, sSubject, aidSubjects, # pylint: disable=R0913
+                 aidTestBoxes, aidBuildCats, aidTestCases, fSepTestVars):
+        assert(sSubject == self.ksSubEverything); # dummy
+        ReportModelBase.__init__(self, oDb, tsNow, cPeriods, cHoursPerPeriod, sSubject, aidSubjects);
+        self.aidTestBoxes = aidTestBoxes;
+        self.aidBuildCats = aidBuildCats;
+        self.aidTestCases = aidTestCases;
+        self.fOnTestCase  = not fSepTestVars; # (Separates testcase variations into separate data series.)
+        self.oCache       = DatabaseObjCache(self._oDb, self.tsNow, None, self.cPeriods * self.cHoursPerPeriod);
+
+
+        # Quickly validate and convert the subject "IDs".
+        self.aoLookups       = [];
+        for sCur in self.aidSubjects:
+            asParts = sCur.split(':');
+            if len(asParts) < 2:
+                raise TMExceptionBase('Invalid graph value "%s"' % (sCur,));
+
+            sType = asParts[0];
+            if sType not in ReportGraphModel.kasTypes:
+                raise TMExceptionBase('Invalid graph value type "%s" (full: "%s")' % (sType, sCur,));
+
+            aidStrTests = [];
+            for sIdStr in asParts[1:]:
+                try:    idStr = int(sIdStr);
+                except: raise TMExceptionBase('Invalid graph value id "%s" (full: "%s")' % (sIdStr, sCur,));
+                if idStr < 0:
+                    raise TMExceptionBase('Invalid graph value id "%u" (full: "%s")' % (idStr, sCur,));
+                aidStrTests.append(idStr);
+
+            idStrValue = None;
+            if sType == ReportGraphModel.ksTypeValue:
+                idStrValue = aidStrTests.pop();
+            self.aoLookups.append(ReportGraphModel.SampleSource(sType, aidStrTests, idStrValue));
+
+        # done
+
+
+    def getExtraWhereExprForTotalPeriod(self, sTimestampField):
+        """
+        Returns additional WHERE expression for getting test sets for the
+        specified period.  It starts with an AND so that it can simply be
+        appended to the WHERE clause.
+        """
+        return self.getExtraWhereExprForTotalPeriodEx(sTimestampField, sTimestampField, True);
+
+    def getExtraWhereExprForTotalPeriodEx(self, sStartField = 'tsCreated', sEndField = 'tsDone', fLeadingAnd = True):
+        """
+        Returns additional WHERE expression for getting test sets for the
+        specified period.
+        """
+        if self.tsNow is None:
+            sNow = 'CURRENT_TIMESTAMP';
+        else:
+            sNow = self._oDb.formatBindArgs('%s::TIMESTAMP', (self.tsNow,));
+
+        sRet = '     AND %s >= (%s - interval \'%u hours\')\n' \
+               '     AND %s <=  %s\n' \
+             % ( sStartField, sNow, self.cPeriods * self.cHoursPerPeriod,
+                 sEndField, sNow);
+
+        if not fLeadingAnd:
+            assert sRet[8] == ' ' and sRet[7] == 'D';
+            return sRet[9:];
+        return sRet;
+
+    def _getEligibleTestSetPeriod(self, sPrefix = 'TestSets.', fLeadingAnd = False):
+        """
+        Returns additional WHERE expression for getting TestSets rows
+        potentially relevant for the selected period.
+        """
+        if self.tsNow is None:
+            sNow = 'CURRENT_TIMESTAMP';
+        else:
+            sNow = self._oDb.formatBindArgs('%s::TIMESTAMP', (self.tsNow,));
+
+        # The 2nd line is a performance hack on TestSets.  It nudges postgresql
+        # into useing the TestSetsCreatedDoneIdx index instead of doing a table
+        # scan when we look for eligible bits there.
+        # ASSUMES no relevant test runs longer than 7 days!
+        sRet = '     AND %stsCreated <= %s\n' \
+               '     AND %stsCreated >= (%s - interval \'%u hours\' - interval \'%u days\')\n' \
+               '     AND %stsDone    >= (%s - interval \'%u hours\')\n' \
+             % ( sPrefix, sNow,
+                 sPrefix, sNow,  self.cPeriods * self.cHoursPerPeriod, 7,
+                 sPrefix, sNow, self.cPeriods * self.cHoursPerPeriod, );
+
+        if not fLeadingAnd:
+            assert sRet[8] == ' ' and sRet[7] == 'D';
+            return sRet[9:];
+        return sRet;
+
+
+    def _getNameStrings(self, aidStrTests):
+        """ Returns an array of names corresponding to the array of string table entries. """
+        return [self.oCache.getTestResultString(idStr) for idStr in aidStrTests];
+
+    def fetchGraphData(self):
+        """ returns data """
+        sWantedTestCaseId = 'idTestCase' if self.fOnTestCase else 'idTestCaseArgs';
+
+        aoRet = [];
+        for oLookup in self.aoLookups:
+            #
+            # Set up the result collection.
+            #
+            if oLookup.sType == self.ksTypeValue:
+                oCollection = self.DataSeriesCollection(oLookup, self._getNameStrings(oLookup.aidStrTests),
+                                                        self.oCache.getTestResultString(oLookup.idStrValue));
+            else:
+                oCollection = self.DataSeriesCollection(oLookup, self._getNameStrings(oLookup.aidStrTests));
+
+            #
+            # Construct the query.
+            #
+            sQuery  = 'SELECT   Builds.iRevision,\n' \
+                      '         TestSets.idBuildCategory,\n' \
+                      '         TestSets.idTestBox,\n' \
+                      '         TestSets.' + sWantedTestCaseId + ',\n';
+            if oLookup.sType == self.ksTypeValue:
+                sQuery += '         TestResultValues.iUnit as iUnit,\n' \
+                          '         MIN(TestResultValues.lValue),\n' \
+                          '         CAST(ROUND(AVG(TestResultValues.lValue)) AS BIGINT),\n' \
+                          '         MAX(TestResultValues.lValue),\n' \
+                          '         COUNT(TestResultValues.lValue)\n';
+            elif oLookup.sType == self.ksTypeElapsed:
+                sQuery += '         %u as iUnit,\n' \
+                          '         CAST((EXTRACT(EPOCH FROM MIN(TR0.tsElapsed)) * 1000) AS INTEGER),\n' \
+                          '         CAST((EXTRACT(EPOCH FROM AVG(TR0.tsElapsed)) * 1000) AS INTEGER),\n' \
+                          '         CAST((EXTRACT(EPOCH FROM MAX(TR0.tsElapsed)) * 1000) AS INTEGER),\n' \
+                          '         COUNT(TR0.tsElapsed)\n' \
+                        % (constants.valueunit.MS,);
+            else:
+                sQuery += '         %u as iUnit,\n'\
+                          '         MIN(TR0.cErrors),\n' \
+                          '         CAST(ROUND(AVG(TR0.cErrors)) AS INTEGER),\n' \
+                          '         MAX(TR0.cErrors),\n' \
+                          '         COUNT(TR0.cErrors)\n' \
+                        % (constants.valueunit.OCCURRENCES,);
+
+            if oLookup.sType == self.ksTypeValue:
+                sQuery += 'FROM     TestResultValues,\n';
+                sQuery += '         TestSets,\n'
+                sQuery += oLookup.getTestResultTables();
+            else:
+                sQuery += 'FROM     ' + oLookup.getTestResultTables().lstrip();
+                sQuery += '         TestSets,\n';
+            sQuery += '         Builds\n';
+
+            if oLookup.sType == self.ksTypeValue:
+                sQuery += 'WHERE    TestResultValues.idStrName = %u\n' % ( oLookup.idStrValue, );
+                sQuery += self.getExtraWhereExprForTotalPeriod('TestResultValues.tsCreated');
+                sQuery += '     AND TestResultValues.idTestSet = TestSets.idTestSet\n';
+                sQuery += self._getEligibleTestSetPeriod(fLeadingAnd = True);
+            else:
+                sQuery += 'WHERE    ' + (self.getExtraWhereExprForTotalPeriod('TR0.tsCreated').lstrip()[4:]).lstrip();
+                sQuery += '     AND TR0.idTestSet = TestSets.idTestSet\n';
+
+            if len(self.aidTestBoxes) == 1:
+                sQuery += '     AND TestSets.idTestBox = %u\n' % (self.aidTestBoxes[0],);
+            elif len(self.aidTestBoxes) > 0:
+                sQuery += '     AND TestSets.idTestBox IN (' + ','.join([str(i) for i in self.aidTestBoxes]) + ')\n';
+
+            if len(self.aidBuildCats) == 1:
+                sQuery += '     AND TestSets.idBuildCategory = %u\n' % (self.aidBuildCats[0],);
+            elif len(self.aidBuildCats) > 0:
+                sQuery += '     AND TestSets.idBuildCategory IN (' + ','.join([str(i) for i in self.aidBuildCats]) + ')\n';
+
+            if len(self.aidTestCases) == 1:
+                sQuery += '     AND TestSets.idTestCase = %u\n' % (self.aidTestCases[0],);
+            elif len(self.aidTestCases) > 0:
+                sQuery += '     AND TestSets.idTestCase IN (' + ','.join([str(i) for i in self.aidTestCases]) + ')\n';
+
+            if oLookup.sType == self.ksTypeElapsed:
+                sQuery += '     AND TestSets.enmStatus = \'%s\'::TestStatus_T\n' % (self.ksTestStatus_Success,);
+
+            if oLookup.sType == self.ksTypeValue:
+                sQuery += '     AND TestResultValues.idTestResult = TR0.idTestResult\n'
+                sQuery += self.getExtraWhereExprForTotalPeriod('TR0.tsCreated'); # For better index matching in some cases.
+
+            if oLookup.sType != self.ksTypeResult:
+                sQuery += '     AND TR0.enmStatus = \'%s\'::TestStatus_T\n' % (self.ksTestStatus_Success,);
+
+            sQuery += oLookup.getTestResultConditions();
+            sQuery += '     AND TestSets.idBuild = Builds.idBuild\n';
+
+            sQuery += 'GROUP BY TestSets.idBuildCategory,\n' \
+                      '         TestSets.idTestBox,\n' \
+                      '         TestSets.' + sWantedTestCaseId + ',\n' \
+                      '         iUnit,\n' \
+                      '         Builds.iRevision\n';
+            sQuery += 'ORDER BY TestSets.idBuildCategory,\n' \
+                      '         TestSets.idTestBox,\n' \
+                      '         TestSets.' + sWantedTestCaseId + ',\n' \
+                      '         iUnit,\n' \
+                      '         Builds.iRevision\n';
+
+            #
+            # Execute it and collect the result.
+            #
+            sCurRepository   = None;
+            dRevisions       = {};
+            oLastSeries      = None;
+            idLastBuildCat   = -1;
+            idLastTestBox    = -1;
+            idLastTestCase   = -1;
+            iLastUnit        = -1;
+            self._oDb.execute(sQuery);
+            for aoRow in self._oDb.fetchAll(): # Fetching all here so we can make cache queries below.
+                if  aoRow[1] != idLastBuildCat \
+                 or aoRow[2] != idLastTestBox \
+                 or aoRow[3] != idLastTestCase \
+                 or aoRow[4] != iLastUnit:
+                    idLastBuildCat = aoRow[1];
+                    idLastTestBox  = aoRow[2];
+                    idLastTestCase = aoRow[3];
+                    iLastUnit      = aoRow[4];
+                    if self.fOnTestCase:
+                        oLastSeries = self.DataSeries(self.oCache, idLastBuildCat, idLastTestBox,
+                                                      idLastTestCase, None, iLastUnit);
+                    else:
+                        oLastSeries = self.DataSeries(self.oCache, idLastBuildCat, idLastTestBox,
+                                                      None, idLastTestCase, iLastUnit);
+                    oCollection.addDataSeries(oLastSeries);
+                    if oLastSeries.oBuildCategory.sRepository != sCurRepository:
+                        if sCurRepository is not None:
+                            self.oCache.preloadVcsRevInfo(sCurRepository, dRevisions.keys());
+                        sCurRepository = oLastSeries.oBuildCategory.sRepository
+                        dRevisions = {};
+                oLastSeries.aiRevisions.append(aoRow[0]);
+                oLastSeries.aiValues.append(aoRow[6]);
+                oLastSeries.aiErrorBarBelow.append(aoRow[6] - aoRow[5]);
+                oLastSeries.aiErrorBarAbove.append(aoRow[7] - aoRow[6]);
+                oLastSeries.acSamples.append(aoRow[8]);
+                dRevisions[aoRow[0]] = 1;
+
+            if sCurRepository is not None:
+                self.oCache.preloadVcsRevInfo(sCurRepository, dRevisions.keys());
+                del dRevisions;
+
+            #
+            # Look up the VCS revision details.
+            #
+            for oSeries in oCollection.aoSeries:
+                for i in range(len(oSeries.aiRevisions)):
+                    oSeries.aoRevInfo.append(self.oCache.getVcsRevInfo(sCurRepository, oSeries.aiRevisions[i]));
+            aoRet.append(oCollection);
+
+        return aoRet;
+
+    def getEligibleTestBoxes(self):
+        """
+        Returns a list of TestBoxData objects with eligible testboxes for
+        the total period of time defined for this graph.
+        """
+
+        # Taking the simple way out now, getting all active testboxes at the
+        # time without filtering out on sample sources.
+
+        # 1. Collect the relevant testbox generation IDs.
+        self._oDb.execute('SELECT   DISTINCT idTestBox, idGenTestBox\n'
+                          'FROM     TestSets\n'
+                          'WHERE    ' + self._getEligibleTestSetPeriod(fLeadingAnd = False) +
+                          'ORDER BY idTestBox, idGenTestBox DESC');
+        idPrevTestBox    = -1;
+        asIdGenTestBoxes = [];
+        for _ in range(self._oDb.getRowCount()):
+            aoRow = self._oDb.fetchOne();
+            if aoRow[0] != idPrevTestBox:
+                idPrevTestBox = aoRow[0];
+                asIdGenTestBoxes.append(str(aoRow[1]));
+
+        # 2. Query all the testbox data in one go.
+        aoRet = [];
+        if len(asIdGenTestBoxes) > 0:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestBoxes\n'
+                              'WHERE    idGenTestBox in (' + ','.join(asIdGenTestBoxes) + ')\n'
+                              'ORDER BY sName');
+            for _ in range(self._oDb.getRowCount()):
+                aoRet.append(TestBoxData().initFromDbRow(self._oDb.fetchOne()));
+
+        return aoRet;
+
+    def getEligibleBuildCategories(self):
+        """
+        Returns a list of BuildCategoryData objects with eligible build
+        categories for the total period of time defined for this graph.  In
+        addition it will add any currently selected categories that aren't
+        really relevant to the period, just to simplify the WUI code.
+
+        """
+
+        # Taking the simple way out now, getting all used build cat without
+        # any testbox or testcase filtering.
+
+        sSelectedBuildCats = '';
+        if len(self.aidBuildCats) > 0:
+            sSelectedBuildCats = '   OR idBuildCategory IN (' + ','.join([str(i) for i in self.aidBuildCats]) + ')\n';
+
+        self._oDb.execute('SELECT   DISTINCT *\n'
+                          'FROM     BuildCategories\n'
+                          'WHERE    idBuildCategory IN (\n'
+                          '   SELECT DISTINCT Builds.idBuildCategory\n'
+                          '   FROM  TestSets, Builds\n'
+                          '   WHERE ' + self._getEligibleTestSetPeriod(fLeadingAnd = False) +
+                          '     AND TestSets.idBuild       = Builds.idBuild\n'
+                          ')\n'
+                          + sSelectedBuildCats +
+                          'ORDER BY sProduct,\n'
+                          '         sBranch,\n'
+                          '         asOsArches,\n'
+                          '         sType\n');
+        aoRet = [];
+        for _ in range(self._oDb.getRowCount()):
+            aoRet.append(BuildCategoryData().initFromDbRow(self._oDb.fetchOne()));
+
+        return aoRet;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/schedgroup.py b/src/VBox/ValidationKit/testmanager/core/schedgroup.py
new file mode 100644
index 0000000..30acf51
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/schedgroup.py
@@ -0,0 +1,977 @@
+# -*- coding: utf-8 -*-
+# $Id: schedgroup.py $
+
+"""
+Test Manager - Scheduling Group.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from testmanager.core.base          import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+from testmanager.core.buildsource   import BuildSourceData;
+from testmanager.core.testcase      import TestCaseData;
+from testmanager.core.testcaseargs  import TestCaseArgsData;
+from testmanager.core.testbox       import TestBoxData, TestBoxLogic;
+from testmanager.core.testgroup     import TestGroupData;
+
+
+
+class SchedGroupMemberData(ModelDataBase):
+    """
+    SchedGroupMember Data.
+    """
+
+    ksIdAttr = 'idSchedGroup';
+
+    ksParam_idSchedGroup        = 'SchedGroupMember_idSchedGroup';
+    ksParam_idTestGroup         = 'SchedGroupMember_idTestGroup';
+    ksParam_tsEffective         = 'SchedGroupMember_tsEffective';
+    ksParam_tsExpire            = 'SchedGroupMember_tsExpire';
+    ksParam_uidAuthor           = 'SchedGroupMember_uidAuthor';
+    ksParam_iSchedPriority      = 'SchedGroupMember_iSchedPriority';
+    ksParam_bmHourlySchedule    = 'SchedGroupMember_bmHourlySchedule';
+    ksParam_idTestGroupPreReq   = 'SchedGroupMember_idTestGroupPreReq';
+
+    kasAllowNullAttributes      = [ 'idSchedGroup', 'idTestGroup', 'tsEffective', 'tsExpire',
+                                    'uidAuthor', 'bmHourlySchedule', 'idTestGroupPreReq' ];
+    kiMin_iSchedPriority        = 0;
+    kiMax_iSchedPriority        = 32;
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idSchedGroup        = None;
+        self.idTestGroup         = None;
+        self.tsEffective         = None;
+        self.tsExpire            = None;
+        self.uidAuthor           = None;
+        self.iSchedPriority      = 16;
+        self.bmHourlySchedule    = None;
+        self.idTestGroupPreReq   = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the data with a row from a SELECT * FROM SchedGroupMembers.
+
+        Returns self. Raises exception if the row is None or otherwise invalid.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('SchedGroupMember not found.');
+
+        self.idSchedGroup        = aoRow[0];
+        self.idTestGroup         = aoRow[1];
+        self.tsEffective         = aoRow[2];
+        self.tsExpire            = aoRow[3];
+        self.uidAuthor           = aoRow[4];
+        self.iSchedPriority      = aoRow[5];
+        self.bmHourlySchedule    = aoRow[6]; ## @todo figure out how bitmaps are returned...
+        self.idTestGroupPreReq   = aoRow[7];
+        return self;
+
+
+class SchedGroupMemberDataEx(SchedGroupMemberData):
+    """
+    Extended SchedGroupMember data class.
+    This adds the testgroups.
+    """
+
+    def __init__(self):
+        SchedGroupMemberData.__init__(self);
+        self.oTestGroup = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the data with a row from a query like this:
+
+            SELECT  SchedGroupMembers.*, TestGroups.*
+            FROM    SchedGroupMembers
+            JOIN    TestGroups
+                ON  (SchedGroupMembers.idTestGroup = TestGroups.idTestGroup);
+
+        Returns self. Raises exception if the row is None or otherwise invalid.
+        """
+        SchedGroupMemberData.initFromDbRow(self, aoRow);
+        self.oTestGroup = TestGroupData().initFromDbRow(aoRow[8:]);
+        return self;
+
+    def getDataAttributes(self):
+        asAttributes = SchedGroupMemberData.getDataAttributes(self);
+        asAttributes.remove('oTestGroup');
+        return asAttributes;
+
+    def _validateAndConvertWorker(self, asAllowNullAttributes, oDb):
+        dErrors = SchedGroupMemberData._validateAndConvertWorker(self, asAllowNullAttributes, oDb);
+        if self.ksParam_idTestGroup not in dErrors:
+            self.oTestGroup = TestGroupData();
+            try:
+                self.oTestGroup.initFromDbWithId(oDb, self.idTestGroup);
+            except Exception as oXcpt:
+                self.oTestGroup = TestGroupData()
+                dErrors[self.ksParam_idTestGroup] = str(oXcpt);
+        return dErrors;
+
+
+
+class SchedGroupData(ModelDataBase):
+    """
+    SchedGroup Data.
+    """
+
+    ## @name TestBoxState_T
+    # @{
+    ksScheduler_BestEffortContinousItegration   = 'bestEffortContinousItegration';
+    ksScheduler_Reserved                        = 'reserved';
+    ## @}
+
+
+    ksIdAttr = 'idSchedGroup';
+
+    ksParam_idSchedGroup        = 'SchedGroup_idSchedGroup';
+    ksParam_tsEffective         = 'SchedGroup_tsEffective';
+    ksParam_tsExpire            = 'SchedGroup_tsExpire';
+    ksParam_uidAuthor           = 'SchedGroup_uidAuthor';
+    ksParam_sName               = 'SchedGroup_sName';
+    ksParam_sDescription        = 'SchedGroup_sDescription';
+    ksParam_fEnabled            = 'SchedGroup_fEnabled';
+    ksParam_enmScheduler        = 'SchedGroup_enmScheduler';
+    ksParam_idBuildSrc          = 'SchedGroup_idBuildSrc';
+    ksParam_idBuildSrcTestSuite = 'SchedGroup_idBuildSrcTestSuite';
+
+    kasAllowNullAttributes      = ['idSchedGroup', 'tsEffective', 'tsExpire', 'uidAuthor', 'sDescription',
+                                   'idBuildSrc', 'idBuildSrcTestSuite'];
+    kasValidValues_enmScheduler = [ksScheduler_BestEffortContinousItegration, ];
+
+    # Scheduler types
+    kasSchedulerDesc            = \
+    [
+        ( ksScheduler_BestEffortContinousItegration,  'Best-Effort-Continous-Itegration (BECI) scheduler.', ''),
+    ]
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idSchedGroup            = None;
+        self.tsEffective             = None;
+        self.tsExpire                = None;
+        self.uidAuthor               = None;
+        self.sName                   = None;
+        self.sDescription            = None;
+        self.fEnabled                = None;
+        self.enmScheduler            = SchedGroupData.ksScheduler_BestEffortContinousItegration;
+        self.idBuildSrc              = None;
+        self.idBuildSrcTestSuite = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the data with a row from a SELECT * FROM SchedGroups.
+
+        Returns self. Raises exception if the row is None or otherwise invalid.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('SchedGroup not found.');
+
+        self.idSchedGroup            = aoRow[0];
+        self.tsEffective             = aoRow[1];
+        self.tsExpire                = aoRow[2];
+        self.uidAuthor               = aoRow[3];
+        self.sName                   = aoRow[4];
+        self.sDescription            = aoRow[5];
+        self.fEnabled                = aoRow[6];
+        self.enmScheduler            = aoRow[7];
+        self.idBuildSrc              = aoRow[8];
+        self.idBuildSrcTestSuite = aoRow[9];
+        return self;
+
+    def initFromDbWithId(self, oDb, idSchedGroup, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   SchedGroups\n'
+                                                       'WHERE  idSchedGroup = %s\n'
+                                                       , ( idSchedGroup,), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idSchedGroup=%s not found (tsNow=%s, sPeriodBack=%s)' % (idSchedGroup, tsNow, sPeriodBack));
+        return self.initFromDbRow(aoRow);
+
+
+class SchedGroupDataEx(SchedGroupData):
+    """
+    Extended scheduling group data.
+
+    Note! Similar to TestGroupDataEx.
+    """
+
+    ksParam_aoMembers    = 'SchedGroup_aoMembers';
+    kasAltArrayNull      = [ 'aoMembers', ];
+
+    ## Helper parameter containing the comma separated list with the IDs of
+    #  potential members found in the parameters.
+    ksParam_aidTestGroups = 'TestGroupDataEx_aidTestGroups';
+
+
+    def __init__(self):
+        SchedGroupData.__init__(self);
+        self.aoMembers          = [];   # SchedGroupMemberDataEx.
+
+        # Two build sources for convenience sake.
+        self.oBuildSrc          = None;
+        self.oBuildSrcValidationKit = None;
+        # List of test boxes that uses this group for convenience.
+        self.aoTestBoxes        = None;
+
+    def _initExtraMembersFromDb(self, oDb, tsNow = None, sPeriodBack = None):
+        """
+        Worker shared by the initFromDb* methods.
+        Returns self.  Raises exception if no row or database error.
+        """
+        #
+        # It all upfront so the object has some kind of consistency if anything
+        # below raises exceptions.
+        #
+        self.oBuildSrc    = None;
+        self.oBuildSrcValidationKit = None;
+        self.aoTestBoxes = [];
+        self.aoMembers   = [];
+
+        #
+        # Build source.
+        #
+        if self.idBuildSrc:
+            self.oBuildSrc = BuildSourceData().initFromDbWithId(oDb, self.idBuildSrc, tsNow, sPeriodBack);
+
+        if self.idBuildSrcTestSuite:
+            self.oBuildSrcValidationKit = BuildSourceData().initFromDbWithId(oDb, self.idBuildSrcTestSuite,
+                                                                             tsNow, sPeriodBack);
+
+        #
+        # Test Boxes.
+        #
+        ## @todo sPeriodBack!
+        if tsNow is None:
+            oDb.execute('SELECT *\n'
+                        'FROM   TestBoxes\n'
+                        'WHERE  TestBoxes.idSchedGroup = %s\n'
+                        '   AND TestBoxes.tsExpire     = \'infinity\'::TIMESTAMP\n'
+                        'ORDER BY TestBoxes.sName, TestBoxes.idTestBox\n'
+                        , (self.idSchedGroup,));
+        else:
+            oDb.execute('SELECT *\n'
+                        'FROM   TestBoxes\n'
+                        'WHERE  TestBoxes.idSchedGroup = %s\n'
+                        '   AND TestBoxes.tsExpire     > %s\n'
+                        '   AND TestBoxes.tsEffective  <= %s\n'
+                        'ORDER BY TestBoxes.sName, TestBoxes.idTestBox\n'
+                        , (self.idSchedGroup, tsNow, tsNow, tsNow, tsNow));
+        for aoRow in oDb.fetchAll():
+            self.aoTestBoxes.append(TestBoxData().initFromDbRow(aoRow));
+
+        #
+        # Test groups.
+        #
+        ## @todo sPeriodBack!
+        if tsNow is None:
+            oDb.execute('SELECT SchedGroupMembers.*, TestGroups.*\n'
+                        'FROM   SchedGroupMembers\n'
+                        'LEFT OUTER JOIN TestGroups ON (SchedGroupMembers.idTestGroup = TestGroups.idTestGroup)\n'
+                        'WHERE  SchedGroupMembers.idSchedGroup = %s\n'
+                        '   AND SchedGroupMembers.tsExpire     = \'infinity\'::TIMESTAMP\n'
+                        '   AND TestGroups.tsExpire            = \'infinity\'::TIMESTAMP\n'
+                        'ORDER BY SchedGroupMembers.idTestGroupPreReq, SchedGroupMembers.idTestGroup\n'
+                        , (self.idSchedGroup,));
+        else:
+            oDb.execute('SELECT SchedGroupMembers.*, TestGroups.*\n'
+                        'FROM   SchedGroupMembers\n'
+                        'LEFT OUTER JOIN TestGroups ON (SchedGroupMembers.idTestGroup = TestGroups.idTestGroup)\n'
+                        'WHERE  SchedGroupMembers.idSchedGroup = %s\n'
+                        '   AND SchedGroupMembers.tsExpire     > %s\n'
+                        '   AND SchedGroupMembers.tsEffective <= %s\n'
+                        '   AND TestGroups.tsExpire            > %s\n'
+                        '   AND TestGroups.tsEffective        <= %s\n'
+                        'ORDER BY SchedGroupMembers.idTestGroupPreReq, SchedGroupMembers.idTestGroup\n'
+                        , (self.idSchedGroup, tsNow, tsNow, tsNow, tsNow));
+
+        for aoRow in oDb.fetchAll():
+            self.aoMembers.append(SchedGroupMemberDataEx().initFromDbRow(aoRow));
+        return self;
+
+    def initFromDbRowEx(self, aoRow, oDb, tsNow = None):
+        """
+        Reinitialize from a SELECT * FROM SchedGroups row.  Will query the
+        necessary additional data from oDb using tsNow.
+        Returns self.  Raises exception if no row or database error.
+        """
+        SchedGroupData.initFromDbRow(self, aoRow);
+        return self._initExtraMembersFromDb(oDb, tsNow);
+
+    def initFromDbWithId(self, oDb, idSchedGroup, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        SchedGroupData.initFromDbWithId(self, oDb, idSchedGroup, tsNow, sPeriodBack);
+        return self._initExtraMembersFromDb(oDb, tsNow, sPeriodBack);
+
+    def getDataAttributes(self):
+        asAttributes = SchedGroupData.getDataAttributes(self);
+        asAttributes.remove('oBuildSrc');
+        asAttributes.remove('oBuildSrcValidationKit');
+        asAttributes.remove('aoTestBoxes');
+        return asAttributes;
+
+    def getAttributeParamNullValues(self, sAttr):
+        if sAttr != 'aoMembers':
+            return SchedGroupData.getAttributeParamNullValues(self, sAttr);
+        return ['', [], None];
+
+    def convertParamToAttribute(self, sAttr, sParam, oValue, oDisp, fStrict):
+        if sAttr != 'aoMembers':
+            return SchedGroupData.convertParamToAttribute(self, sAttr, sParam, oValue, oDisp, fStrict);
+
+        aoNewValue  = [];
+        aidSelected = oDisp.getListOfIntParams(sParam, iMin = 1, iMax = 0x7ffffffe, aiDefaults = [])
+        sIds        = oDisp.getStringParam(self.ksParam_aidTestGroups, sDefault = '');
+        for idTestGroup in sIds.split(','):
+            try:    idTestGroup = int(idTestGroup);
+            except: pass;
+            oDispWrapper = self.DispWrapper(oDisp, '%s[%s][%%s]' % (SchedGroupDataEx.ksParam_aoMembers, idTestGroup,))
+            oMember = SchedGroupMemberDataEx().initFromParams(oDispWrapper, fStrict = False);
+            if idTestGroup in aidSelected:
+                aoNewValue.append(oMember);
+        return aoNewValue;
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        if sAttr != 'aoMembers':
+            return SchedGroupData._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+
+        asErrors     = [];
+        aoNewMembers = [];
+        for oOldMember in oValue:
+            oNewMember = SchedGroupMemberDataEx().initFromOther(oOldMember);
+            aoNewMembers.append(oNewMember);
+
+            dErrors = oNewMember.validateAndConvert(oDb);
+            if len(dErrors) > 0:
+                asErrors.append(str(dErrors));
+
+        if len(asErrors) == 0:
+            for i in range(len(aoNewMembers)):
+                idTestGroup = aoNewMembers[i];
+                for j in range(i + 1, len(aoNewMembers)):
+                    if aoNewMembers[j].idTestGroup == idTestGroup:
+                        asErrors.append('Duplicate test group #%d!' % (idTestGroup, ));
+                        break;
+
+        return (aoNewMembers, None if len(asErrors) == 0 else '<br>\n'.join(asErrors));
+
+    def _validateAndConvertWorker(self, asAllowNullAttributes, oDb):
+        dErrors = SchedGroupData._validateAndConvertWorker(self, asAllowNullAttributes, oDb);
+
+        #
+        # Fetch the extended build source bits.
+        #
+        if self.ksParam_idBuildSrc not in dErrors:
+            if   self.idBuildSrc in self.getAttributeParamNullValues('idBuildSrc') \
+              or self.idBuildSrc is None:
+                self.oBuildSrc = None;
+            else:
+                try:
+                    self.oBuildSrc = BuildSourceData().initFromDbWithId(oDb, self.idBuildSrc);
+                except Exception as oXcpt:
+                    self.oBuildSrc = BuildSourceData();
+                    dErrors[self.ksParam_idBuildSrc] = str(oXcpt);
+
+        if self.ksParam_idBuildSrcTestSuite not in dErrors:
+            if   self.idBuildSrcTestSuite in self.getAttributeParamNullValues('idBuildSrcTestSuite') \
+              or self.idBuildSrcTestSuite is None:
+                self.oBuildSrcValidationKit = None;
+            else:
+                try:
+                    self.oBuildSrcValidationKit = BuildSourceData().initFromDbWithId(oDb, self.idBuildSrcTestSuite);
+                except Exception as oXcpt:
+                    self.oBuildSrcValidationKit = BuildSourceData();
+                    dErrors[self.ksParam_idBuildSrcTestSuite] = str(oXcpt);
+
+        return dErrors;
+
+
+
+class SchedGroupLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    SchedGroup logic.
+    """
+
+    #
+    # Standard methods.
+    #
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches build sources.
+
+        Returns an array (list) of BuildSourceData items, empty list if none.
+        Raises exception on error.
+        """
+
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idSchedGroup DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY idSchedGroup DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRet = [];
+        for aoRow in self._oDb.fetchAll():
+            aoRet.append(SchedGroupDataEx().initFromDbRowEx(aoRow, self._oDb, tsNow));
+        return aoRet;
+
+    def addEntry(self, oData, uidAuthor, fCommit = False):
+        """Add Scheduling Group record"""
+
+        #
+        # Validate.
+        #
+        dDataErrors = oData.validateAndConvert(self._oDb);
+        if len(dDataErrors) > 0:
+            raise TMExceptionBase('Invalid data passed to addEntry: %s' % (dDataErrors,));
+        if self.exists(oData.sName):
+            raise TMExceptionBase('Scheduling group "%s" already exists.' % (oData.sName,));
+
+        #
+        # Add it.
+        #
+        self._oDb.execute('INSERT INTO SchedGroups (\n'
+                          '         uidAuthor,\n'
+                          '         sName,\n'
+                          '         sDescription,\n'
+                          '         fEnabled,\n'
+                          '         enmScheduler,\n'
+                          '         idBuildSrc,\n'
+                          '         idBuildSrcTestSuite)\n'
+                          'VALUES (%s, %s, %s, %s, %s, %s, %s)\n'
+                          'RETURNING idSchedGroup\n'
+                          , (uidAuthor,
+                             oData.sName,
+                             oData.sDescription,
+                             oData.fEnabled,
+                             oData.enmScheduler,
+                             oData.idBuildSrc,
+                             oData.idBuildSrcTestSuite));
+        idSchedGroup = self._oDb.fetchOne()[0];
+        oData.idSchedGroup = idSchedGroup;
+
+        for oMember in oData.aoMembers:
+            oMember.idSchedGroup = idSchedGroup;
+            self._addSchedGroupMember(uidAuthor, oMember);
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def editEntry(self, oData, uidAuthor, fCommit = False):
+        """Edit Scheduling Group record"""
+
+        #
+        # Validate input and retrieve the old data.
+        #
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('editEntry got invalid data: %s' % (dErrors,));
+        self._assertUnique(oData.sName, oData.idSchedGroup);
+        oOldData = SchedGroupDataEx().initFromDbWithId(self._oDb, oData.idSchedGroup);
+
+        #
+        # Make the changes.
+        #
+        if not oData.isEqualEx(oOldData, [ 'tsEffective', 'tsExpire', 'uidAuthor', 'aoMembers', 'aoTestBoxes',
+                                           'oBuildSrc', 'oBuildSrcValidationKit', ]):
+            self._historizeEntry(oData.idSchedGroup);
+            self._readdEntry(uidAuthor, oData);
+
+        # Remove groups.
+        for oOld in oOldData.aoMembers:
+            fRemove = True;
+            for oNew in oData.aoMembers:
+                if oNew.idTestGroup == oOld.idTestGroup:
+                    fRemove = False;
+                    break;
+            if fRemove:
+                self._removeSchedGroupMember(uidAuthor, oOld);
+
+        # Add / modify groups.
+        for oMember in oData.aoMembers:
+            oOldMember = None;
+            for oOld in oOldData.aoMembers:
+                if oOld.idTestGroup == oMember.idTestGroup:
+                    oOldMember = oOld;
+                    break;
+
+            oMember.idSchedGroup = oData.idSchedGroup;
+            if oOldMember is None:
+                self._addSchedGroupMember(uidAuthor, oMember);
+            elif not oMember.isEqualEx(oOldMember, ['tsEffective', 'tsExpire', 'uidAuthor', 'oTestGroup']):
+                self._historizeSchedGroupMember(oMember);
+                self._addSchedGroupMember(uidAuthor, oMember);
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def removeEntry(self, uidAuthor, idSchedGroup, fCascade = False, fCommit = False):
+        """
+        Deletes a scheduling group.
+        """
+
+        #
+        # Input validation and retrival of current data.
+        #
+        if idSchedGroup == 1:
+            raise TMExceptionBase('Cannot remove the default scheduling group (id 1).');
+        oData = SchedGroupDataEx().initFromDbWithId(self._oDb, idSchedGroup);
+
+        #
+        # We use cascade a little different here... We don't actually delete
+        # associated testboxes or testgroups.
+        #
+        if len(oData.aoTestBoxes) > 0:
+            if fCascade is not True:
+                # Complain about there being associated testboxes.
+                asTestBoxes = ['%s (#%d)' % (oTestBox.sName, oTestBox.idTestBox) for oTestBox in oData.aoTestBoxes];
+                raise TMExceptionBase('Scheduling group #%d is associated with one or more test boxes: %s'
+                                      % (idSchedGroup, ', '.join(asTestBoxes),));
+            else:
+                # Reassign testboxes to scheduling group #1 (the default group).
+                oTbLogic = TestBoxLogic(self._oDb);
+                for oTestBox in oData.aoTestBoxes:
+                    oTbCopy = TestBoxData().initFromOther(oTestBox);
+                    oTbCopy.idSchedGroup = 1;
+                    oTbLogic.editEntry(oTbCopy, uidAuthor, fCommit = False);
+
+                oData = SchedGroupDataEx().initFromDbWithId(self._oDb, idSchedGroup);
+                if len(oData.aoTestBoxes) != 0:
+                    raise TMExceptionBase('More testboxes was added to the scheduling group as we were trying to delete it.');
+
+        #
+        # Remove the group and all member records.
+        #
+        for oMember in oData.aoMembers:
+            self._removeSchedGroupMember(uidAuthor, oMember);
+        self._oDb.execute('UPDATE   SchedGroupMembers\n'
+                          'SET      tsExpire     = CURRENT_TIMESTAMP\n'
+                          'WHERE    idSchedGroup = %s\n'
+                          '     AND tsExpire     = \'infinity\'::TIMESTAMP\n'
+                          , (idSchedGroup,));
+
+        (tsCur, tsCurMinusOne) = self._oDb.getCurrentTimestamps();
+        if oData.tsEffective != tsCur and oData.tsEffective != tsCurMinusOne:
+            self._historizeEntry(idSchedGroup, tsCurMinusOne);
+            self._readdEntry(uidAuthor, oData, tsCurMinusOne);
+            self._historizeEntry(idSchedGroup);
+        self._oDb.execute('UPDATE   SchedGroups\n'
+                          'SET      tsExpire     = CURRENT_TIMESTAMP\n'
+                          'WHERE    idSchedGroup = %s\n'
+                          '     AND tsExpire     = \'infinity\'::TIMESTAMP\n'
+                          , (idSchedGroup,))
+
+        self._oDb.maybeCommit(fCommit)
+        return True;
+
+
+
+    #
+    # Other methods.
+    #
+
+    def fetchOrderedByName(self, tsNow = None):
+        """
+        Return list of objects of type SchedGroups ordered by name.
+        May raise exception on database error.
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sName ASC\n');
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '   AND   tsEffective <= %s\n'
+                              'ORDER BY sName ASC\n'
+                              , (tsNow, tsNow,));
+        aoRet = []
+        for _ in range(self._oDb.getRowCount()):
+            aoRet.append(SchedGroupData().initFromDbRow(self._oDb.fetchOne()));
+        return aoRet;
+
+
+    def getAll(self, tsEffective = None):
+        """
+        Gets the list of all scheduling groups.
+        Returns an array of SchedGroupData instances.
+        """
+        if tsEffective is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n');
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              , (tsEffective, tsEffective));
+        aoRet = [];
+        for aoRow in self._oDb.fetchAll():
+            aoRet.append(SchedGroupData().initFromDbRow(aoRow));
+        return aoRet;
+
+    def getSchedGroupsForCombo(self, tsEffective = None):
+        """
+        Gets the list of active scheduling groups for a combo box.
+        Returns an array of (value [idSchedGroup], drop-down-name [sName],
+        hover-text [sDescription]) tuples.
+        """
+        if tsEffective is None:
+            self._oDb.execute('SELECT   idSchedGroup, sName, sDescription\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sName');
+        else:
+            self._oDb.execute('SELECT   idSchedGroup, sName, sDescription\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY sName'
+                              , (tsEffective, tsEffective));
+        return self._oDb.fetchAll();
+
+
+    def getMembers(self, idSchedGroup, tsEffective = None):
+        """
+        Gets the scheduling groups members for the given scheduling group.
+
+        Returns an array of SchedGroupMemberDataEx instances (sorted by
+        priority and idTestGroup).  May raise exception DB error.
+        """
+
+        if tsEffective is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SchedGroupMembers, TestGroups\n'
+                              'WHERE    SchedGroupMembers.idSchedGroup = %s\n'
+                              '     AND SchedGroupMembers.tsExpire     = \'infinity\'::TIMESTAMP\n'
+                              '     AND TestGroups.idTestGroup         = SchedGroupMembers.idTestGroup\n'
+                              '     AND TestGroups.tsExpire            = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY SchedGroupMembers.iSchedPriority, SchedGroupMembers.idTestGroup\n'
+                              , (idSchedGroup,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SchedGroupMembers, TestGroups\n'
+                              'WHERE    SchedGroupMembers.idSchedGroup = %s\n'
+                              '     AND SchedGroupMembers.tsExpire     < %s\n'
+                              '     AND SchedGroupMembers.tsEffective >= %s\n'
+                              '     AND TestGroups.idTestGroup         = SchedGroupMembers.idTestGroup\n'
+                              '     AND TestGroups.tsExpire            < %s\n'
+                              '     AND TestGroups.tsEffective        >= %s\n'
+                              'ORDER BY SchedGroupMembers.iSchedPriority DESC, SchedGroupMembers.idTestGroup\n'
+                              , (idSchedGroup, tsEffective, tsEffective, tsEffective, tsEffective, ));
+        aaoRows = self._oDb.fetchAll();
+        aoRet = [];
+        for aoRow in aaoRows:
+            aoRet.append(SchedGroupMemberDataEx().initFromDbRow(aoRow));
+        return aoRet;
+
+    def getTestCasesForGroup(self, idSchedGroup, cMax = None):
+        """
+        Gets the enabled testcases w/ testgroup+priority for the given scheduling group.
+
+        Returns an array TestCaseData instance (group id, testcase priority and
+        testcase ids) with an extra iSchedPriority member.
+        May raise exception on DB error or if the result exceeds cMax.
+        """
+
+        self._oDb.execute('SELECT   TestGroupMembers.idTestGroup, TestGroupMembers.iSchedPriority, TestCases.*\n'
+                          'FROM     SchedGroupMembers, TestGroups, TestGroupMembers, TestCases\n'
+                          'WHERE    SchedGroupMembers.idSchedGroup = %s\n'
+                          '     AND SchedGroupMembers.tsExpire     = \'infinity\'::TIMESTAMP\n'
+                          '     AND TestGroups.idTestGroup         = SchedGroupMembers.idTestGroup\n'
+                          '     AND TestGroups.tsExpire            = \'infinity\'::TIMESTAMP\n'
+                          '     AND TestGroupMembers.idTestGroup   = TestGroups.idTestGroup\n'
+                          '     AND TestGroupMembers.tsExpire      = \'infinity\'::TIMESTAMP\n'
+                          '     AND TestCases.idTestCase           = TestGroupMembers.idTestCase\n'
+                          '     AND TestCases.tsExpire             = \'infinity\'::TIMESTAMP\n'
+                          '     AND TestCases.fEnabled             = TRUE\n'
+                          'ORDER BY TestGroupMembers.idTestGroup, TestGroupMembers.iSchedPriority, TestCases.idTestCase\n'
+                          , (idSchedGroup,));
+
+        if cMax is not None  and  self._oDb.getRowCount() > cMax:
+            raise TMExceptionBase('Too many testcases for scheduling group %s: %s, max %s'
+                                  % (idSchedGroup, cMax, self._oDb.getRowCount(),));
+
+        aoRet = [];
+        for aoRow in self._oDb.fetchAll():
+            oTestCase = TestCaseData().initFromDbRow(aoRow[2:]);
+            oTestCase.idTestGroup    = aoRow[0];
+            oTestCase.iSchedPriority = aoRow[1];
+            aoRet.append(oTestCase);
+        return aoRet;
+
+    def getTestCaseArgsForGroup(self, idSchedGroup, cMax = None):
+        """
+        Gets the testcase argument variation w/ testgroup+priority for the given scheduling group.
+
+        Returns an array TestCaseArgsData instance (sorted by group and
+        variation id) with an extra iSchedPriority member.
+        May raise exception on DB error or if the result exceeds cMax.
+        """
+
+        self._oDb.execute('SELECT   TestGroupMembers.idTestGroup, TestGroupMembers.iSchedPriority, TestCaseArgs.*\n'
+                          'FROM     SchedGroupMembers, TestGroups, TestGroupMembers, TestCaseArgs, TestCases\n'
+                          'WHERE    SchedGroupMembers.idSchedGroup = %s\n'
+                          '     AND SchedGroupMembers.tsExpire     = \'infinity\'::TIMESTAMP\n'
+                          '     AND TestGroups.idTestGroup         = SchedGroupMembers.idTestGroup\n'
+                          '     AND TestGroups.tsExpire            = \'infinity\'::TIMESTAMP\n'
+                          '     AND TestGroupMembers.idTestGroup   = TestGroups.idTestGroup\n'
+                          '     AND TestGroupMembers.tsExpire      = \'infinity\'::TIMESTAMP\n'
+                          '     AND TestCaseArgs.idTestCase        = TestGroupMembers.idTestCase\n'
+                          '     AND TestCaseArgs.tsExpire          = \'infinity\'::TIMESTAMP\n'
+                          '     AND (   TestGroupMembers.aidTestCaseArgs is NULL\n'
+                          '          OR TestCaseArgs.idTestCaseArgs = ANY(TestGroupMembers.aidTestCaseArgs) )\n'
+                          '     AND TestCases.idTestCase           = TestCaseArgs.idTestCase\n'
+                          '     AND TestCases.tsExpire             = \'infinity\'::TIMESTAMP\n'
+                          '     AND TestCases.fEnabled             = TRUE\n'
+                          'ORDER BY TestGroupMembers.idTestGroup, TestGroupMembers.idTestCase, TestCaseArgs.idTestCaseArgs\n'
+                          , (idSchedGroup,));
+
+        if cMax is not None  and  self._oDb.getRowCount() > cMax:
+            raise TMExceptionBase('Too many argument variations for scheduling group %s: %s, max %s'
+                                  % (idSchedGroup, cMax, self._oDb.getRowCount(),));
+
+        aoRet = [];
+        for aoRow in self._oDb.fetchAll():
+            oVariation = TestCaseArgsData().initFromDbRow(aoRow[2:]);
+            oVariation.idTestGroup    = aoRow[0];
+            oVariation.iSchedPriority = aoRow[1];
+            aoRet.append(oVariation);
+        return aoRet;
+
+    def exists(self, sName):
+        """Checks if a group with the given name exists."""
+        self._oDb.execute('SELECT *\n'
+                          'FROM   SchedGroups\n'
+                          'WHERE  tsExpire   = \'infinity\'::TIMESTAMP\n'
+                          '   AND sName = %s\n'
+                          , (sName,));
+        return self._oDb.getRowCount() > 0;
+
+    def getById(self, idSchedGroup):
+        """Get Scheduling Group data by idSchedGroup"""
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     SchedGroups\n'
+                          'WHERE    tsExpire   = \'infinity\'::timestamp\n'
+                          '  AND    idSchedGroup = %s;', (idSchedGroup,))
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise self._oDb.integrityException(
+                'Found more than one scheduling groups with the same credentials. Database structure is corrupted.')
+        try:
+            return SchedGroupData().initFromDbRow(aRows[0])
+        except IndexError:
+            return None
+
+    def remove(self, uidAuthor, idScedGroup, fNeedCommit=True):
+        """Historize Scheduling Group record"""
+        self._oDb.execute('UPDATE SchedGroups\n'
+                          'SET    tsExpire     = CURRENT_TIMESTAMP,\n'
+                          '       uidAuthor    = %s\n'
+                          'WHERE  idSchedGroup = %s\n'
+                          '   AND tsExpire     = \'infinity\'::TIMESTAMP\n',
+                          (uidAuthor, idScedGroup))
+        if fNeedCommit:
+            self._oDb.commit()
+        return True
+
+    #
+    # Internal helpers.
+    #
+
+    def _assertUnique(self, sName, idSchedGroupIgnore = None):
+        """
+        Checks that the scheduling group name is unique.
+        Raises exception if the name is already in use.
+        """
+        if idSchedGroupIgnore is None:
+            self._oDb.execute('SELECT   idSchedGroup\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              '   AND   sName    = %s\n'
+                              , ( sName, ) );
+        else:
+            self._oDb.execute('SELECT   idSchedGroup\n'
+                              'FROM     SchedGroups\n'
+                              'WHERE    tsExpire      = \'infinity\'::TIMESTAMP\n'
+                              '   AND   sName         = %s\n'
+                              '   AND   idSchedGroup <> %s\n'
+                              , ( sName, idSchedGroupIgnore, ) );
+        if self._oDb.getRowCount() > 0:
+            raise TMExceptionBase('Scheduling group name (%s) is already in use.' % (sName,));
+        return True;
+
+    def _readdEntry(self, uidAuthor, oData, tsEffective = None):
+        """
+        Re-adds the SchedGroups entry. Used by editEntry and removeEntry.
+        """
+        if tsEffective is None:
+            tsEffective = self._oDb.getCurrentTimestamp();
+        self._oDb.execute('INSERT INTO SchedGroups (\n'
+                          '         uidAuthor,\n'
+                          '         tsEffective,\n'
+                          '         idSchedGroup,\n'
+                          '         sName,\n'
+                          '         sDescription,\n'
+                          '         fEnabled,\n'
+                          '         enmScheduler,\n'
+                          '         idBuildSrc,\n'
+                          '         idBuildSrcTestSuite )\n'
+                          'VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s )\n'
+                          , ( uidAuthor,
+                              tsEffective,
+                              oData.idSchedGroup,
+                              oData.sName,
+                              oData.sDescription,
+                              oData.fEnabled,
+                              oData.enmScheduler,
+                              oData.idBuildSrc,
+                              oData.idBuildSrcTestSuite, ));
+        return True;
+
+    def _historizeEntry(self, idSchedGroup, tsExpire = None):
+        """
+        Historizes the current entry for the given scheduling group.
+        """
+        if tsExpire is None:
+            tsExpire = self._oDb.getCurrentTimestamp();
+        self._oDb.execute('UPDATE SchedGroups\n'
+                          'SET    tsExpire = %s\n'
+                          'WHERE  idSchedGroup = %s\n'
+                          '   AND tsExpire     = \'infinity\'::TIMESTAMP\n'
+                          , ( tsExpire, idSchedGroup, ));
+        return True;
+
+    def _addSchedGroupMember(self, uidAuthor, oMember, tsEffective = None):
+        """
+        addEntry worker for adding a scheduling group member.
+        """
+        if tsEffective is None:
+            tsEffective = self._oDb.getCurrentTimestamp();
+        self._oDb.execute('INSERT INTO SchedGroupMembers(\n'
+                          '         idSchedGroup,\n'
+                          '         idTestGroup,\n'
+                          '         tsEffective,\n'
+                          '         uidAuthor,\n'
+                          '         iSchedPriority,\n'
+                          '         bmHourlySchedule,\n'
+                          '         idTestGroupPreReq)\n'
+                          'VALUES (%s, %s, %s, %s, %s, %s, %s)\n'
+                          , ( oMember.idSchedGroup,
+                              oMember.idTestGroup,
+                              tsEffective,
+                              uidAuthor,
+                              oMember.iSchedPriority,
+                              oMember.bmHourlySchedule,
+                              oMember.idTestGroupPreReq, ));
+        return True;
+
+    def _removeSchedGroupMember(self, uidAuthor, oMember):
+        """
+        Removes a scheduling group member.
+        """
+
+        # Try record who removed it by adding an dummy entry that expires immediately.
+        (tsCur, tsCurMinusOne) = self._oDb.getCurrentTimestamps();
+        if oMember.tsEffective != tsCur and oMember.tsEffective != tsCurMinusOne:
+            self._historizeSchedGroupMember(oMember, tsCurMinusOne);
+            self._addSchedGroupMember(uidAuthor, oMember, tsCurMinusOne); # lazy bird.
+            self._historizeSchedGroupMember(oMember);
+        else:
+            self._historizeSchedGroupMember(oMember);
+        return True;
+
+    def _historizeSchedGroupMember(self, oMember, tsExpire = None):
+        """
+        Historizes the current entry for the given scheduling group.
+        """
+        if tsExpire is None:
+            tsExpire = self._oDb.getCurrentTimestamp();
+        self._oDb.execute('UPDATE SchedGroupMembers\n'
+                          'SET    tsExpire = %s\n'
+                          'WHERE  idSchedGroup = %s\n'
+                          '   AND idTestGroup  = %s\n'
+                          '   AND tsExpire     = \'infinity\'::TIMESTAMP\n'
+                          , ( tsExpire, oMember.idSchedGroup, oMember.idTestGroup, ));
+        return True;
+
+
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class SchedGroupMemberDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [SchedGroupMemberData(),];
+
+class SchedGroupDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [SchedGroupData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/schedulerbase.py b/src/VBox/ValidationKit/testmanager/core/schedulerbase.py
new file mode 100644
index 0000000..5ec604b
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/schedulerbase.py
@@ -0,0 +1,1406 @@
+# -*- coding: utf-8 -*-
+# $Id: schedulerbase.py $
+# pylint: disable=C0302
+
+
+"""
+Test Manager - Base class and utilities for the schedulers.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from common                             import utils, constants;
+from testmanager                        import config;
+from testmanager.core.build             import BuildDataEx, BuildLogic;
+from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, TMExceptionBase;
+from testmanager.core.buildsource       import BuildSourceData, BuildSourceLogic;
+from testmanager.core.globalresource    import GlobalResourceLogic;
+from testmanager.core.schedgroup        import SchedGroupData, SchedGroupLogic;
+from testmanager.core.systemlog         import SystemLogData, SystemLogLogic;
+from testmanager.core.testbox           import TestBoxData;
+from testmanager.core.testboxstatus     import TestBoxStatusData, TestBoxStatusLogic;
+from testmanager.core.testcase          import TestCaseLogic;
+from testmanager.core.testcaseargs      import TestCaseArgsDataEx, TestCaseArgsLogic;
+from testmanager.core.testset           import TestSetData, TestSetLogic;
+
+
+class ReCreateQueueData(object):
+    """
+    Data object for recreating a scheduling queue.
+
+    It's mostly a storage object, but has a few data checking operation
+    associated with it.
+    """
+
+    def __init__(self, oDb, idSchedGroup):
+        #
+        # Load data from the database.
+        #
+
+        # Will extend the entries with aoTestCases and dTestCases members
+        # further down.  checkForGroupDepCycles will add aidTestGroupPreReqs.
+        self.aoTestGroups       = SchedGroupLogic(oDb).getMembers(idSchedGroup);
+
+        # aoTestCases entries are TestCaseData instance with iSchedPriority
+        # and idTestGroup added for our purposes.
+        # We will add oTestGroup and aoArgsVariations members to each further down.
+        self.aoTestCases        = SchedGroupLogic(oDb).getTestCasesForGroup(idSchedGroup, cMax = 4096);
+
+        # Load dependencies.
+        oTestCaseLogic = TestCaseLogic(oDb)
+        for oTestCase in self.aoTestCases:
+            oTestCase.aidPreReqs = oTestCaseLogic.getTestCasePreReqIds(oTestCase.idTestCase, cMax = 4096);
+
+        # aoTestCases entries are TestCaseArgsData instance with iSchedPriority
+        # and idTestGroup added for our purposes.
+        # We will add oTestGroup and oTestCase members to each further down.
+        self.aoArgsVariations   = SchedGroupLogic(oDb).getTestCaseArgsForGroup(idSchedGroup, cMax = 65536);
+
+        #
+        # Generate global lookups.
+        #
+
+        # Generate a testcase lookup dictionary for use when working on
+        # argument variations.
+        self.dTestCases         = dict();
+        for oTestCase in self.aoTestCases:
+            self.dTestCases[oTestCase.idTestCase] = oTestCase;
+        assert len(self.dTestCases) <= len(self.aoTestCases); # Note! Can be shorter!
+
+        # Generate a testgroup lookup dictionary.
+        self.dTestGroups        = dict();
+        for oTestGroup in self.aoTestGroups:
+            self.dTestGroups[oTestGroup.idTestGroup] = oTestGroup;
+        assert len(self.dTestGroups) == len(self.aoTestGroups);
+
+        #
+        # Associate extra members with the base data.
+        #
+        if len(self.aoTestGroups) > 0:
+            # Prep the test groups.
+            for oTestGroup in self.aoTestGroups:
+                oTestGroup.aoTestCases = list();
+                oTestGroup.dTestCases  = dict();
+
+            # Link testcases to their group, both directions. Prep testcases for
+            # argument varation association.
+            oTestGroup = self.aoTestGroups[0];
+            for oTestCase in self.aoTestCases:
+                if oTestGroup.idTestGroup != oTestCase.idTestGroup:
+                    oTestGroup = self.dTestGroups[oTestCase.idTestGroup];
+
+                assert oTestCase.idTestCase not in oTestGroup.dTestCases;
+                oTestGroup.dTestCases[oTestCase.idTestCase] = oTestCase;
+                oTestGroup.aoTestCases.append(oTestCase);
+                oTestCase.oTestGroup       = oTestGroup;
+                oTestCase.aoArgsVariations = list();
+
+            # Associate testcase argument variations with their testcases (group)
+            # in both directions.
+            oTestGroup = self.aoTestGroups[0];
+            oTestCase  = self.aoTestCases[0] if len(self.aoTestCases) > 0 else None;
+            for oArgVariation in self.aoArgsVariations:
+                if oTestGroup.idTestGroup != oArgVariation.idTestGroup:
+                    oTestGroup = self.dTestGroups[oArgVariation.idTestGroup];
+                if oTestCase.idTestCase != oArgVariation.idTestCase  or  oTestCase.idTestGroup != oArgVariation.idTestGroup:
+                    oTestCase = oTestGroup.dTestCases[oArgVariation.idTestCase];
+
+                oTestCase.aoArgsVariations.append(oArgVariation);
+                oArgVariation.oTestCase  = oTestCase;
+                oArgVariation.oTestGroup = oTestGroup;
+
+        else:
+            assert len(self.aoTestCases)      == 0;
+            assert len(self.aoArgsVariations) == 0;
+        # done.
+
+    @staticmethod
+    def _addPreReqError(aoErrors, aidChain, oObj, sMsg):
+        """ Returns a chain of IDs error entry. """
+
+        sMsg += ' Dependency chain: %s' % (aidChain[0],);
+        for i in range(1, len(aidChain)):
+            sMsg += ' -> %s' % (aidChain[i],);
+
+        aoErrors.append([sMsg, oObj]);
+        return aoErrors;
+
+    def checkForGroupDepCycles(self):
+        """
+        Checks for testgroup depencency cycles and any missing testgroup
+        dependencies.
+        Returns array of errors (see SchedulderBase.recreateQueue()).
+        """
+        aoErrors = list();
+        for oTestGroup in self.aoTestGroups:
+            idPreReq = oTestGroup.idTestGroupPreReq;
+            if idPreReq is None:
+                oTestGroup.aidTestGroupPreReqs = list();
+                continue;
+
+            aidChain = [oTestGroup.idTestGroup,];
+            while idPreReq is not None:
+                aidChain.append(idPreReq);
+                if len(aidChain) >= 10:
+                    self._addPreReqError(aoErrors, aidChain, oTestGroup,
+                                         'TestGroup #%s prerequisite chain is too long!'
+                                         % (oTestGroup.idTestGroup,));
+                    break;
+
+                oDep = self.dTestGroups.get(idPreReq, None);
+                if oDep is None:
+                    self._addPreReqError(aoErrors, aidChain, oTestGroup,
+                                         'TestGroup #%s prerequisite #%s is not in the scheduling group!'
+                                         % (oTestGroup.idTestGroup, idPreReq,));
+                    break;
+
+                idPreReq = oDep.idTestGroupPreReq;
+            oTestGroup.aidTestGroupPreReqs = aidChain[1:];
+
+        return aoErrors;
+
+
+    def checkForMissingTestCaseDeps(self):
+        """
+        Checks that testcase dependencies stays within bounds.  We do not allow
+        dependencies outside a testgroup, no dependency cycles or even remotely
+        long dependency chains.
+
+        Returns array of errors (see SchedulderBase.recreateQueue()).
+        """
+        aoErrors = list();
+        for oTestGroup in self.aoTestGroups:
+            for oTestCase in oTestGroup.aoTestCases:
+                if len(oTestCase.aidPreReqs) == 0:
+                    continue;
+
+                # Stupid recursion code using special stack(s).
+                aiIndexes = [(oTestCase, 0), ];
+                aidChain  = [oTestCase.idTestGroup,];
+                while len(aiIndexes) > 0:
+                    (oCur, i) = aiIndexes[-1];
+                    if i >= len(oCur.aidPreReqs):
+                        aiIndexes.pop();
+                        aidChain.pop();
+                    else:
+                        aiIndexes[-1][1] = i + 1; # whatever happens, we'll advance on the current level.
+
+                        idPreReq = oTestCase.aidPreReqs[i];
+                        oDep = oTestGroup.dTestCases.get(idPreReq, None);
+                        if oDep is None:
+                            self._addPreReqError(aoErrors, aidChain, oTestCase,
+                                                 'TestCase #%s prerequisite #%s is not in the scheduling group!'
+                                                 % (oTestCase.idTestCase, idPreReq));
+                        elif idPreReq in aidChain:
+                            self._addPreReqError(aoErrors, aidChain, oTestCase,
+                                                 'TestCase #%s prerequisite #%s creates a cycle!'
+                                                 % (oTestCase.idTestCase, idPreReq));
+                        elif len(oDep.aiPreReqs) == 0:
+                            pass;
+                        elif len(aidChain) >= 10:
+                            self._addPreReqError(aoErrors, aidChain, oTestCase,
+                                                 'TestCase #%s prerequisite chain is too long!'  % (oTestCase.idTestCase,));
+                        else:
+                            aiIndexes.append((oDep, 0));
+                            aidChain.append(idPreReq);
+
+        return aoErrors;
+
+    def deepTestGroupSort(self):
+        """
+        Sorts the testgroups and their testcases by priority and dependencies.
+        Note! Don't call this before checking for dependency cycles!
+        """
+        if len(self.aoTestGroups) == 0:
+            return;
+
+        #
+        # ASSUMES groups as well as testcases are sorted by priority by the
+        # database.  So we only have to concern ourselves with the dependency
+        # sorting.
+        #
+        iGrpPrio = self.aoTestGroups[0].iSchedPriority;
+        for oTestGroup in self.aoTestGroups:
+            if oTestGroup.iSchedPriority > iGrpPrio:
+                raise TMExceptionBase('Incorrectly sorted testgroups returned by database.');
+            iGrpPrio = oTestGroup.iSchedPriority;
+
+            if len(oTestGroup.aoTestCases) > 0:
+                iTstPrio = oTestGroup.aoTestCases[0];
+                for oTestCase in oTestGroup.aoTestCases:
+                    if oTestCase.iSchedPriority > iTstPrio:
+                        raise TMExceptionBase('Incorrectly sorted testcases returned by database.');
+
+        #
+        # Sort the testgroups by dependencies.
+        #
+        i = 0;
+        while i < len(self.aoTestGroups):
+            oTestGroup = self.aoTestGroups[i];
+            if oTestGroup.idTestGroupPreReq is not None:
+                iPreReq = self.aoTestGroups.index(self.dTestGroups[oTestGroup.idTestGroupPreReq]);
+                if iPreReq > i:
+                    # The prerequisite is after the current entry.  Move the
+                    # current entry so that it's following it's prereq entry.
+                    self.aoTestGroups.insert(iPreReq + 1, oTestGroup);
+                    self.aoTestGroups.pop(i);
+                    continue;
+                assert iPreReq < i;
+            i += 1; # Advance.
+
+        #
+        # Sort the testcases by dependencies.
+        # Same algorithm as above, just more prerequisites.
+        #
+        for oTestGroup in self.aoTestGroups:
+            i = 0;
+            while i < len(oTestGroup.aoTestCases):
+                oTestCase = oTestGroup.aoTestCases[i];
+                if len(oTestCase.aidPreReqs) > 0:
+                    for idPreReq in oTestCase.aidPreReqs:
+                        iPreReq = oTestGroup.aoTestCases.index(oTestGroup.dTestCases[idPreReq]);
+                        if iPreReq > i:
+                            # The prerequisite is after the current entry.  Move the
+                            # current entry so that it's following it's prereq entry.
+                            oTestGroup.aoTestGroups.insert(iPreReq + 1, oTestCase);
+                            oTestGroup.aoTestGroups.pop(i);
+                            i -= 1; # Don't advance.
+                            break;
+                        assert iPreReq < i;
+                i += 1; # Advance.
+
+
+        return True;
+
+
+
+class SchedQueueData(ModelDataBase):
+    """
+    Scheduling queue data item.
+    """
+
+    ksIdAttr = 'idSchedGroup';
+
+    ksParam_idSchedGroup            = 'SchedQueueData_idSchedGroup';
+    ksParam_idItem                  = 'SchedQueueData_idItem';
+    ksParam_offQueue                = 'SchedQueueData_offQueue';
+    ksParam_idGenTestCaseArgs       = 'SchedQueueData_idGenTestCaseArgs';
+    ksParam_idTestGroup             = 'SchedQueueData_idTestGroup';
+    ksParam_aidTestGroupPreReqs     = 'SchedQueueData_aidTestGroupPreReqs';
+    ksParam_bmHourlySchedule        = 'SchedQueueData_bmHourlySchedule';
+    ksParam_tsConfig                = 'SchedQueueData_tsConfig';
+    ksParam_tsLastScheduled         = 'SchedQueueData_tsLastScheduled';
+    ksParam_idTestSetGangLeader     = 'SchedQueueData_idTestSetGangLeader';
+    ksParam_cMissingGangMembers     = 'SchedQueueData_cMissingGangMembers';
+
+    kasAllowNullAttributes = [ 'idItem', 'offQueue', 'aidTestGroupPreReqs', 'bmHourlySchedule', 'idTestSetGangLeader',
+                               'tsConfig', 'tsLastScheduled' ];
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idSchedGroup           = None;
+        self.idItem                 = None;
+        self.offQueue               = None;
+        self.idGenTestCaseArgs      = None;
+        self.idTestGroup            = None;
+        self.aidTestGroupPreReqs    = None;
+        self.bmHourlySchedule       = None;
+        self.tsConfig               = None;
+        self.tsLastScheduled        = None;
+        self.idTestSetGangLeader    = None;
+        self.cMissingGangMembers    = 1;
+
+    def initFromValues(self, idSchedGroup, idGenTestCaseArgs, idTestGroup, aidTestGroupPreReqs, # pylint: disable=R0913
+                       bmHourlySchedule, cMissingGangMembers,
+                       idItem = None, offQueue = None, tsConfig = None, tsLastScheduled = None, idTestSetGangLeader = None):
+        """
+        Reinitialize with all attributes potentially given as inputs.
+        Return self.
+        """
+        self.idSchedGroup           = idSchedGroup;
+        self.idItem                 = idItem;
+        self.offQueue               = offQueue;
+        self.idGenTestCaseArgs      = idGenTestCaseArgs;
+        self.idTestGroup            = idTestGroup;
+        self.aidTestGroupPreReqs    = aidTestGroupPreReqs;
+        self.bmHourlySchedule       = bmHourlySchedule;
+        self.tsConfig               = tsConfig;
+        self.tsLastScheduled        = tsLastScheduled;
+        self.idTestSetGangLeader    = idTestSetGangLeader;
+        self.cMissingGangMembers    = cMissingGangMembers;
+        return self;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Initialize from database row (SELECT * FROM SchedQueues).
+        Returns self.
+        Raises exception if no row is specfied.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('SchedQueueData not found.');
+
+        self.idSchedGroup           = aoRow[0];
+        self.idItem                 = aoRow[1];
+        self.offQueue               = aoRow[2];
+        self.idGenTestCaseArgs      = aoRow[3];
+        self.idTestGroup            = aoRow[4];
+        self.aidTestGroupPreReqs    = aoRow[5];
+        self.bmHourlySchedule       = aoRow[6];
+        self.tsConfig               = aoRow[7];
+        self.tsLastScheduled        = aoRow[8];
+        self.idTestSetGangLeader    = aoRow[9];
+        self.cMissingGangMembers    = aoRow[10];
+        return self;
+
+
+
+
+
+
+class SchedulerBase(object):
+    """
+    The scheduler base class.
+
+    The scheduler classes have two functions:
+        1. Recreate the scheduling queue.
+        2. Pick the next task from the queue.
+
+    The first is scheduler specific, the latter isn't.
+    """
+
+    class BuildCache(object):
+        """ Build cache. """
+
+        class BuildCacheIterator(object):
+            """ Build class iterator. """
+            def __init__(self, oCache):
+                self.oCache = oCache;
+                self.iCur   = 0;
+
+            def __iter__(self):
+                """Returns self, required by the language."""
+                return self;
+
+            def next(self):
+                """Returns the next build, raises StopIteration when the end has been reached."""
+                while True:
+                    if self.iCur >= len(self.oCache.aoEntries):
+                        oEntry = self.oCache.fetchFromCursor();
+                        if oEntry is None:
+                            raise StopIteration;
+                    else:
+                        oEntry = self.oCache.aoEntries[self.iCur];
+                    self.iCur += 1;
+                    if not oEntry.fRemoved:
+                        return oEntry;
+                # end
+
+        class BuildCacheEntry(object):
+            """ Build cache entry. """
+
+            def __init__(self, oBuild, fMaybeBlacklisted):
+                self.oBuild             = oBuild;
+                self._fBlacklisted      = None if fMaybeBlacklisted is True else False;
+                self.fRemoved           = False;
+                self._dPreReqDecisions  = dict();
+
+            def remove(self):
+                """
+                Marks the cache entry as removed.
+                This doesn't actually remove it from the cache array, only marks
+                it as removed. It has no effect on open iterators.
+                """
+                self.fRemoved = True;
+
+            def getPreReqDecision(self, sPreReqSet):
+                """
+                Retrieves a cached prerequisite decision.
+                Returns boolean if found, None if not.
+                """
+                return self._dPreReqDecisions.get(sPreReqSet);
+
+            def setPreReqDecision(self, sPreReqSet, fDecision):
+                """
+                Caches a prerequistie decision.
+                """
+                self._dPreReqDecisions[sPreReqSet] = fDecision;
+                return fDecision;
+
+            def isBlacklisted(self, oDb):
+                """ Checks if the build is blacklisted. """
+                if self._fBlacklisted is None:
+                    self._fBlacklisted = BuildLogic(oDb).isBuildBlacklisted(self.oBuild);
+                return self._fBlacklisted;
+
+
+        def __init__(self):
+            self.aoEntries = [];
+            self.oCursor   = None;
+
+        def setupSource(self, oDb, idBuildSrc, sOs, sCpuArch, tsNow):
+            """ Configures the build cursor for the cache. """
+            if len(self.aoEntries) == 0 and self.oCursor is None:
+                oBuildSource = BuildSourceData().initFromDbWithId(oDb, idBuildSrc, tsNow);
+                self.oCursor = BuildSourceLogic(oDb).openBuildCursor(oBuildSource, sOs, sCpuArch, tsNow);
+            return True;
+
+        def __iter__(self):
+            """Return an iterator."""
+            return self.BuildCacheIterator(self);
+
+        def fetchFromCursor(self):
+            """ Fetches a build from the cursor and adds it to the cache."""
+            if self.oCursor is None:
+                return None;
+
+            try:
+                aoRow = self.oCursor.fetchOne();
+            except:
+                return None;
+            if aoRow is None:
+                return None;
+
+            oBuild = BuildDataEx().initFromDbRow(aoRow);
+            oEntry = self.BuildCacheEntry(oBuild, aoRow[-1]);
+            self.aoEntries.append(oEntry);
+            return oEntry;
+
+    def __init__(self, oDb, oSchedGrpData, iVerbosity = 0, tsSecStart = None):
+        self._oDb           = oDb;
+        self._oSchedGrpData = oSchedGrpData;
+        self._iVerbosity    = iVerbosity;
+        self._asMessages    = [];
+        self._tsSecStart    = tsSecStart if tsSecStart is not None else utils.timestampSecond();
+        self.oBuildCache    = self.BuildCache();
+        self.dTestGroupMembers = dict();
+
+    @staticmethod
+    def _instantiate(oDb, oSchedGrpData, iVerbosity = 0, tsSecStart = None):
+        """
+        Instantiate the scheduler specified by the scheduling group.
+        Returns scheduler child class instance.  May raise exception if
+        the input is invalid.
+        """
+        if oSchedGrpData.enmScheduler == SchedGroupData.ksScheduler_BestEffortContinousItegration:
+            from testmanager.core.schedulerbeci import SchdulerBeci;
+            oScheduler = SchdulerBeci(oDb, oSchedGrpData, iVerbosity, tsSecStart);
+        else:
+            raise oDb.integrityException('Invalid scheduler "%s", idSchedGroup=%d' \
+                                         % (oSchedGrpData.enmScheduler, oSchedGrpData.idSchedGroup));
+        return oScheduler;
+
+
+    #
+    # Misc.
+    #
+
+    def msgDebug(self, sText):
+        """Debug printing."""
+        if self._iVerbosity > 1:
+            self._asMessages.append('debug:' + sText);
+        return None;
+
+    def msgInfo(self, sText):
+        """Info printing."""
+        if self._iVerbosity > 1:
+            self._asMessages.append('info: ' + sText);
+        return None;
+
+    def dprint(self, sMsg):
+        """Prints a debug message to the srv glue log (see config.py). """
+        if config.g_kfSrvGlueDebugScheduler:
+            self._oDb.dprint(sMsg);
+        return None;
+
+    def getElapsedSecs(self):
+        """ Returns the number of seconds this scheduling task has been running. """
+        tsSecNow = utils.timestampSecond();
+        if tsSecNow < self._tsSecStart: # paranoia
+            self._tsSecStart = tsSecNow;
+        return tsSecNow - self._tsSecStart;
+
+
+    #
+    # Create schedule.
+    #
+
+    def _recreateQueueCancelGatherings(self):
+        """
+        Cancels all pending gang gatherings on the current queue.
+        """
+        self._oDb.execute('SELECT   idTestSetGangLeader\n'
+                          'FROM     SchedQueues\n'
+                          'WHERE    idSchedGroup = %s\n'
+                          '     AND idTestSetGangLeader is not NULL\n'
+                          , (self._oSchedGrpData.idSchedGroup,));
+        if self._oDb.getRowCount() > 0:
+            oTBStatusLogic = TestBoxStatusLogic(self._oDb);
+            for aoRow in self._oDb.fetchAll():
+                idTestSetGangLeader = aoRow[0];
+                oTBStatusLogic.updateGangStatus(idTestSetGangLeader,
+                                                TestBoxStatusData.ksTestBoxState_GangGatheringTimedOut,
+                                                fCommit = False);
+        return True;
+
+    def _recreateQueueItems(self, oData):
+        """
+        Returns an array of queue items (SchedQueueData).
+        Child classes must override this.
+        """
+        _ = oData;
+        return [];
+
+    def recreateQueueWorker(self):
+        """
+        Worker for recreateQueue.
+        """
+
+        #
+        # Collect the necessary data and validate it.
+        #
+        oData = ReCreateQueueData(self._oDb, self._oSchedGrpData.idSchedGroup);
+        aoErrors = oData.checkForGroupDepCycles();
+        aoErrors.extend(oData.checkForMissingTestCaseDeps());
+        if len(aoErrors) == 0:
+            oData.deepTestGroupSort();
+
+            #
+            # The creation of the scheduling queue is done by the child class.
+            #
+            # We will try guess where in queue we're currently at and rotate
+            # the items such that we will resume execution in the approximately
+            # same position.  The goal of the scheduler is to provide a 100%
+            # deterministic result so that if we regenerate the queue when there
+            # are no changes to the testcases, testgroups or scheduling groups
+            # involved, test execution will be unchanged (save for maybe just a
+            # little for gang gathering).
+            #
+            aoItems = list();
+            if len(oData.aoArgsVariations) > 0:
+                aoItems = self._recreateQueueItems(oData);
+                self.msgDebug('len(aoItems)=%s' % (len(aoItems),));
+                for i in range(len(aoItems)):
+                    self.msgDebug('aoItems[%2d]=%s' % (i, aoItems[i]));
+            if len(aoItems) > 0:
+                self._oDb.execute('SELECT offQueue FROM SchedQueues WHERE idSchedGroup = %s ORDER BY idItem LIMIT 1'
+                                  , (self._oSchedGrpData.idSchedGroup,));
+                if self._oDb.getRowCount() > 0:
+                    offQueue = self._oDb.fetchOne()[0];
+                    self._oDb.execute('SELECT COUNT(*) FROM SchedQueues WHERE idSchedGroup = %s'
+                                      , (self._oSchedGrpData.idSchedGroup,));
+                    cItems  = self._oDb.fetchOne()[0];
+                    offQueueNew = (offQueue * cItems) / len(aoItems);
+                    if offQueueNew != 0:
+                        aoItems = aoItems[offQueueNew:] + aoItems[:offQueueNew];
+
+            #
+            # Replace the scheduling queue.
+            # Care need to be take to first timeout/abort any gangs in the
+            # gathering state since these use the queue to set up the date.
+            #
+            self._recreateQueueCancelGatherings();
+            self._oDb.execute('DELETE FROM SchedQueues WHERE idSchedGroup = %s\n', (self._oSchedGrpData.idSchedGroup,));
+            for oItem in aoItems:
+                self._oDb.execute('INSERT INTO SchedQueues (\n'
+                                  '         idSchedGroup,\n'
+                                  '         offQueue,\n'
+                                  '         idGenTestCaseArgs,\n'
+                                  '         idTestGroup,\n'
+                                  '         aidTestGroupPreReqs,\n'
+                                  '         bmHourlySchedule,\n'
+                                  '         cMissingGangMembers )\n'
+                                  'VALUES ( %s, %s, %s, %s, %s, %s, %s )\n'
+                                  , ( oItem.idSchedGroup,
+                                      oItem.offQueue,
+                                      oItem.idGenTestCaseArgs,
+                                      oItem.idTestGroup,
+                                      oItem.aidTestGroupPreReqs if len(oItem.aidTestGroupPreReqs) > 0 else None,
+                                      oItem.bmHourlySchedule,
+                                      oItem.cMissingGangMembers
+                                  ));
+        return (aoErrors, self._asMessages);
+
+    @staticmethod
+    def recreateQueue(oDb, uidAuthor, idSchedGroup, iVerbosity = 1):
+        """
+        (Re-)creates the scheduling queue for the given group.
+
+        Returns (asMessages, asMessages). On success the array with the error
+        will be empty, on failure it will contain (sError, oRelatedObject)
+        entries.  The messages is for debugging and are simple strings.
+
+        Raises exception database error.
+        """
+        aoErrors   = [];
+        asMessages = [];
+        try:
+            #
+            # To avoid concurrency issues (SchedQueues) and inconsistent data (*),
+            # we lock quite a few tables while doing this work.  We access more
+            # data than scheduleNewTask so we lock some additional tables.
+            #
+            oDb.rollback();
+            oDb.begin();
+            oDb.execute('LOCK TABLE SchedGroups, SchedGroupMembers, TestGroups, TestGroupMembers IN SHARE MODE');
+            oDb.execute('LOCK TABLE TestBoxes, TestCaseArgs, TestCases IN SHARE MODE');
+            oDb.execute('LOCK TABLE TestBoxStatuses, SchedQueues IN EXCLUSIVE MODE');
+
+            #
+            # Instantiate the scheduler and call the worker function.
+            #
+            oSchedGrpData = SchedGroupData().initFromDbWithId(oDb, idSchedGroup);
+            oScheduler = SchedulerBase._instantiate(oDb, oSchedGrpData, iVerbosity);
+
+            (aoErrors, asMessages) = oScheduler.recreateQueueWorker();
+            if len(aoErrors) == 0:
+                SystemLogLogic(oDb).addEntry(SystemLogData.ksEvent_SchedQueueRecreate,
+                                             'User #%d recreated sched queue #%d.' % (uidAuthor, idSchedGroup,));
+                oDb.commit();
+            else:
+                oDb.rollback();
+
+        except:
+            oDb.rollback();
+            raise;
+
+        return (aoErrors, asMessages);
+
+
+
+    #
+    # Schedule Task.
+    #
+
+    def _composeGangArguments(self, idTestSet):
+        """
+        Composes the gang specific testdriver arguments.
+        Returns command line string, including a leading space.
+        """
+
+        oTestSet      = TestSetData().initFromDbWithId(self._oDb, idTestSet);
+        aoGangMembers = TestSetLogic(self._oDb).getGang(oTestSet.idTestSetGangLeader);
+
+        sArgs = ' --gang-member-no %s --gang-members %s' % (oTestSet.iGangMemberNo, len(aoGangMembers));
+        for i in range(len(aoGangMembers)):
+            sArgs = ' --gang-ipv4-%s %s' % (i, aoGangMembers[i].ip); ## @todo IPv6
+
+        return sArgs;
+
+
+    def composeExecResponseWorker(self, idTestSet, oTestEx, oTestBox, oBuild, oValidationKitBuild, sBaseUrl):
+        """
+        Given all the bits of data, compose an EXEC command response to the testbox.
+        """
+        sScriptZips = oTestEx.oTestCase.sValidationKitZips;
+        if sScriptZips is None  or  sScriptZips.find('@VALIDATIONKIT_ZIP@') >= 0:
+            assert oValidationKitBuild;
+            if sScriptZips is None:
+                sScriptZips = oValidationKitBuild.sBinaries;
+            else:
+                sScriptZips = sScriptZips.replace('@VALIDATIONKIT_ZIP@', oValidationKitBuild.sBinaries);
+        sScriptZips = sScriptZips.replace('@DOWNLOAD_BASE_URL@', sBaseUrl + config.g_ksTmDownloadBaseUrlRel);
+
+        sCmdLine = oTestEx.oTestCase.sBaseCmd + ' ' + oTestEx.sArgs;
+        sCmdLine = sCmdLine.replace('@BUILD_BINARIES@', oBuild.sBinaries);
+        sCmdLine = sCmdLine.strip();
+        if oTestEx.cGangMembers > 1:
+            sCmdLine += ' ' + self._composeGangArguments(idTestSet);
+
+        cSecTimeout = oTestEx.cSecTimeout if oTestEx.cSecTimeout is not None else oTestEx.oTestCase.cSecTimeout;
+        cSecTimeout = cSecTimeout * oTestBox.pctScaleTimeout / 100;
+
+        dResponse   = \
+        {
+            constants.tbresp.ALL_PARAM_RESULT:              constants.tbresp.CMD_EXEC,
+            constants.tbresp.EXEC_PARAM_RESULT_ID:          idTestSet,
+            constants.tbresp.EXEC_PARAM_SCRIPT_ZIPS:        sScriptZips,
+            constants.tbresp.EXEC_PARAM_SCRIPT_CMD_LINE:    sCmdLine,
+            constants.tbresp.EXEC_PARAM_TIMEOUT:            cSecTimeout,
+        };
+        return dResponse;
+
+    @staticmethod
+    def composeExecResponse(oDb, idTestSet, sBaseUrl, iVerbosity = 0):
+        """
+        Composes an EXEC response for a gang member (other than the last).
+        Returns a EXEC response or raises an exception (DB/input error).
+        """
+        #
+        # Gather the necessary data.
+        #
+        oTestSet      = TestSetData().initFromDbWithId(oDb, idTestSet);
+        oTestBox      = TestBoxData().initFromDbWithGenId(oDb, oTestSet.idGenTestBox);
+        oTestEx       = TestCaseArgsDataEx().initFromDbWithGenId(oDb, oTestSet.idGenTestCaseArgs);
+        oBuild        = BuildDataEx().initFromDbWithId(oDb, oTestSet.idBuild);
+        oValidationKitBuild = None;
+        if oTestSet.idBuildTestSuite is not None:
+            oValidationKitBuild = BuildDataEx().initFromDbWithId(oDb, oTestSet.idBuildTestSuite);
+
+        #
+        # Instantiate the specified scheduler and let it do the rest.
+        #
+        oSchedGrpData = SchedGroupData().initFromDbWithId(oDb, oTestBox.idSchedGroup, oTestSet.tsCreated);
+        assert oSchedGrpData.fEnabled   is True;
+        assert oSchedGrpData.idBuildSrc is not None;
+        oScheduler = SchedulerBase._instantiate(oDb, oSchedGrpData, iVerbosity);
+
+        return oScheduler.composeExecResponseWorker(idTestSet, oTestEx, oTestBox, oBuild, oValidationKitBuild, sBaseUrl);
+
+
+    def _updateTask(self, oTask, tsNow):
+        """
+        Updates a gang schedule task.
+        """
+        assert oTask.cMissingGangMembers >= 1;
+        assert oTask.idTestSetGangLeader is not None;
+        assert oTask.idTestSetGangLeader >= 1;
+        if tsNow is not None:
+            self._oDb.execute('UPDATE SchedQueues\n'
+                              '   SET idTestSetGangLeader = %s,\n'
+                              '       cMissingGangMembers = %s,\n'
+                              '       tsLastScheduled     = %s\n'
+                              'WHERE  idItem = %s\n'
+                              , (oTask.idTestSetGangLeader, oTask.cMissingGangMembers, tsNow, oTask.idItem,) );
+        else:
+            self._oDb.execute('UPDATE SchedQueues\n'
+                              '   SET cMissingGangMembers = %s\n'
+                              'WHERE  idItem = %s\n'
+                              , (oTask.cMissingGangMembers, oTask.idItem,) );
+        return True;
+
+    def _moveTaskToEndOfQueue(self, oTask, cGangMembers, tsNow):
+        """
+        The task has been scheduled successfully, reset it's data move it to
+        the end of the queue.
+        """
+        if cGangMembers > 1:
+            self._oDb.execute('UPDATE SchedQueues\n'
+                              '   SET idItem = NEXTVAL(\'SchedQueueItemIdSeq\'),\n'
+                              '       idTestSetGangLeader = NULL,\n'
+                              '       cMissingGangMembers = %s\n'
+                              'WHERE  idItem = %s\n'
+                              , (cGangMembers, oTask.idItem,) );
+        else:
+            self._oDb.execute('UPDATE SchedQueues\n'
+                              '   SET idItem = NEXTVAL(\'SchedQueueItemIdSeq\'),\n'
+                              '       idTestSetGangLeader = NULL,\n'
+                              '       cMissingGangMembers = 1,\n'
+                              '       tsLastScheduled     = %s\n'
+                              'WHERE  idItem = %s\n'
+                              , (tsNow, oTask.idItem,) );
+        return True;
+
+
+
+
+    def _createTestSet(self, oTask, oTestEx, oTestBoxData, oBuild, oValidationKitBuild, tsNow):
+        """
+        Creates a test set for using the given data.
+        Will not commit, someone up the callstack will that later on.
+        Returns the test set ID, may raise an exception on database error.
+        """
+        # Lazy bird doesn't want to write testset.py and does it all here.
+
+        #
+        # We're getting the TestSet ID first in order to include it in the base
+        # file name (that way we can directly relate files on the disk to the
+        # test set when doing batch work), and also for idTesetSetGangLeader.
+        #
+        self._oDb.execute('SELECT NEXTVAL(\'TestSetIdSeq\')');
+        idTestSet = self._oDb.fetchOne()[0];
+
+        sBaseFilename = '%04d/%02d/%02d/%02d/TestSet-%s' \
+                      % (tsNow.year, tsNow.month, tsNow.day, (tsNow.hour / 6) * 6, idTestSet);
+
+        #
+        # Gang scheduling parameters.  Changes the oTask data for updating by caller.
+        #
+        iGangMemberNo = 0;
+
+        if oTestEx.cGangMembers <= 1:
+            assert oTask.idTestSetGangLeader is None;
+            assert oTask.cMissingGangMembers <= 1;
+        elif oTask.idTestSetGangLeader is None:
+            assert oTask.cMissingGangMembers == oTestEx.cGangMembers;
+            oTask.cMissingGangMembers = oTestEx.cGangMembers - 1;
+            oTask.idTestSetGangLeader = idTestSet;
+        else:
+            assert oTask.cMissingGangMembers > 0 and oTask.cMissingGangMembers < oTestEx.cGangMembers;
+            oTask.cMissingGangMembers -= 1;
+
+        #
+        # Do the database stuff.
+        #
+        self._oDb.execute('INSERT INTO  TestSets (\n'
+                          '             idTestSet,\n'
+                          '             tsConfig,\n'
+                          '             tsCreated,\n'
+                          '             idBuild,\n'
+                          '             idBuildCategory,\n'
+                          '             idBuildTestSuite,\n'
+                          '             idGenTestBox,\n'
+                          '             idTestBox,\n'
+                          '             idTestGroup,\n'
+                          '             idGenTestCase,\n'
+                          '             idTestCase,\n'
+                          '             idGenTestCaseArgs,\n'
+                          '             idTestCaseArgs,\n'
+                          '             sBaseFilename,\n'
+                          '             iGangMemberNo,\n'
+                          '             idTestSetGangLeader )\n'
+                          'VALUES (     %s,\n'      # idTestSet
+                          '             %s,\n'      # tsConfig
+                          '             %s,\n'      # tsCreated
+                          '             %s,\n'      # idBuild
+                          '             %s,\n'      # idBuildCategory
+                          '             %s,\n'      # idBuildTestSuite
+                          '             %s,\n'      # idGenTestBox
+                          '             %s,\n'      # idTestBox
+                          '             %s,\n'      # idTestGroup
+                          '             %s,\n'      # idGenTestCase
+                          '             %s,\n'      # idTestCase
+                          '             %s,\n'      # idGenTestCaseArgs
+                          '             %s,\n'      # idTestCaseArgs
+                          '             %s,\n'      # sBaseFilename
+                          '             %s,\n'      # iGangMemberNo
+                          '             %s)\n'      # idTestSetGangLeader
+                          , ( idTestSet,
+                              oTask.tsConfig,
+                              tsNow,
+                              oBuild.idBuild,
+                              oBuild.idBuildCategory,
+                              oValidationKitBuild.idBuild if oValidationKitBuild is not None else None,
+                              oTestBoxData.idGenTestBox,
+                              oTestBoxData.idTestBox,
+                              oTask.idTestGroup,
+                              oTestEx.oTestCase.idGenTestCase,
+                              oTestEx.oTestCase.idTestCase,
+                              oTestEx.idGenTestCaseArgs,
+                              oTestEx.idTestCaseArgs,
+                              sBaseFilename,
+                              iGangMemberNo,
+                              oTask.idTestSetGangLeader,
+                          ));
+
+        self._oDb.execute('INSERT INTO  TestResults (\n'
+                          '             idTestResultParent,\n'
+                          '             idTestSet,\n'
+                          '             tsCreated,\n'
+                          '             idStrName,\n'
+                          '             cErrors,\n'
+                          '             enmStatus,\n'
+                          '             iNestingDepth)\n'
+                          'VALUES (     NULL,\n'    # idTestResultParent
+                          '             %s,\n'      # idTestSet
+                          '             %s,\n'      # tsCreated
+                          '             0,\n'       # idStrName
+                          '             0,\n'       # cErrors
+                          '             \'running\'::TestStatus_T,\n'
+                          '             0)\n'       # iNestingDepth
+                          'RETURNING    idTestResult'
+                          , ( idTestSet, tsNow, ));
+        idTestResult = self._oDb.fetchOne()[0];
+
+        self._oDb.execute('UPDATE   TestSets\n'
+                          '     SET idTestResult = %s\n'
+                          'WHERE    idTestSet = %s\n'
+                          , (idTestResult, idTestSet, ));
+
+        return idTestSet;
+
+    def _tryFindValidationKitBit(self, oTestBoxData, tsNow):
+        """
+        Tries to find the most recent validation kit build suitable for the given testbox.
+        Returns BuildDataEx or None. Raise exception on database error.
+
+        Can be overridden by child classes to change the default build requirements.
+        """
+        oBuildLogic  = BuildLogic(self._oDb);
+        oBuildSource = BuildSourceData().initFromDbWithId(self._oDb, self._oSchedGrpData.idBuildSrcTestSuite, tsNow);
+        oCursor = BuildSourceLogic(self._oDb).openBuildCursor(oBuildSource, oTestBoxData.sOs, oTestBoxData.sCpuArch, tsNow);
+        for _ in range(oCursor.getRowCount()):
+            oBuild = BuildDataEx().initFromDbRow(oCursor.fetchOne());
+            if not oBuildLogic.isBuildBlacklisted(oBuild):
+                return oBuild;
+        return None;
+
+    def _tryFindBuild(self, oTask, oTestEx, oTestBoxData, tsNow):
+        """
+        Tries to find a fitting build.
+        Returns BuildDataEx or None. Raise exception on database error.
+
+        Can be overridden by child classes to change the default build requirements.
+        """
+
+        #
+        # Gather the set of prerequisites we have and turn them into a value
+        # set for use in the loop below.
+        #
+        # Note! We're scheduling on testcase level and ignoring argument variation
+        #       selections in TestGroupMembers is intentional.
+        #
+        dPreReqs = {};
+
+        # Direct prerequisites. We assume they're all enabled as this can be
+        # checked at queue creation time.
+        for oPreReq in oTestEx.aoTestCasePreReqs:
+            dPreReqs[oPreReq.idTestCase] = 1;
+
+        # Testgroup dependencies from the scheduling group config.
+        if oTask.aidTestGroupPreReqs is not None:
+            for iTestGroup in oTask.aidTestGroupPreReqs:
+                # Make sure the _active_ test group members are in the cache.
+                if iTestGroup not in self.dTestGroupMembers:
+                    self._oDb.execute('SELECT DISTINCT TestGroupMembers.idTestCase\n'
+                                      'FROM     TestGroupMembers, TestCases\n'
+                                      'WHERE    TestGroupMembers.idTestGroup  = %s\n'
+                                      '     AND TestGroupMembers.tsExpire     > %s\n'
+                                      '     AND TestGroupMembers.tsEffective <= %s\n'
+                                      '     AND TestCases.idTestCase = TestGroupMembers.idTestCase\n'
+                                      '     AND TestCases.tsExpire     > %s\n'
+                                      '     AND TestCases.tsEffective <= %s\n'
+                                      '     AND TestCases.fEnabled is TRUE\n'
+                                      , (iTestGroup, oTask.tsConfig, oTask.tsConfig, oTask.tsConfig, oTask.tsConfig,));
+                    aidTestCases = [];
+                    for aoRow in self._oDb.fetchAll():
+                        aidTestCases.append(aoRow[0]);
+                    self.dTestGroupMembers[iTestGroup] = aidTestCases;
+
+                # Add the testgroup members to the prerequisites.
+                for idTestCase in self.dTestGroupMembers[iTestGroup]:
+                    dPreReqs[idTestCase] = 1;
+
+        # Create a SQL values table out of them.
+        sPreReqSet = ''
+        if len(dPreReqs) > 0:
+            for idPreReq in sorted(dPreReqs.keys()):
+                sPreReqSet += ', (' + str(idPreReq) + ')';
+            sPreReqSet = sPreReqSet[2:]; # drop the leading ', '.
+
+        #
+        # Try the builds.
+        #
+        self.oBuildCache.setupSource(self._oDb, self._oSchedGrpData.idBuildSrc, oTestBoxData.sOs, oTestBoxData.sCpuArch, tsNow);
+        for oEntry in self.oBuildCache:
+            #
+            # Check build requirements set by the test.
+            #
+            if not oTestEx.matchesBuildProps(oEntry.oBuild):
+                continue;
+
+            if oEntry.isBlacklisted(self._oDb):
+                oEntry.remove();
+                continue;
+
+            #
+            # Check prerequisites.  The default scheduler is satisfied if one
+            # argument variation has been executed successfully.  It is not
+            # satisfied if there are any failure runs.
+            #
+            if len(sPreReqSet) > 0:
+                fDecision = oEntry.getPreReqDecision(sPreReqSet);
+                if fDecision is None:
+                    ## @todo DB Tuning
+                    # Check for missing prereqs.
+                    self._oDb.execute('SELECT   COUNT(*)\n'
+                                      'FROM     (VALUES ' + sPreReqSet + ') AS PreReqs(idTestCase)\n'
+                                      'LEFT OUTER JOIN (SELECT  *\n'
+                                      '                 FROM    TestSets\n'
+                                      '                 WHERE   enmStatus IN (%s, %s)\n'
+                                      '                     AND idBuild = %s\n'
+                                      '                 ) AS TestSets\n'
+                                      '      ON (PreReqs.idTestCase = TestSets.idTestCase)\n'
+                                      'WHERE    TestSets.idTestSet is NULL\n'
+                                      , ( TestSetData.ksTestStatus_Success, TestSetData.ksTestStatus_Skipped,
+                                          oEntry.oBuild.idBuild, ));
+                    cMissingPreReqs = self._oDb.fetchOne()[0];
+                    if cMissingPreReqs > 0:
+                        self.dprint('build %s is missing %u prerequisites (out of %s)'
+                                    % (oEntry.oBuild.idBuild, cMissingPreReqs, sPreReqSet,));
+                        oEntry.setPreReqDecision(sPreReqSet, False);
+                        continue;
+
+                    # Check for failed prereq runs.
+                    self._oDb.execute('SELECT   COUNT(*)\n'
+                                      'FROM     (VALUES ' + sPreReqSet + ') AS PreReqs(idTestCase),\n'
+                                      '         TestSets\n'
+                                      'WHERE    PreReqs.idTestCase = TestSets.idTestCase\n'
+                                      '     AND TestSets.idBuild   = %s\n'
+                                      '     AND TestSets.enmStatus IN (%s, %s, %s)\n'
+                                      , ( oEntry.oBuild.idBuild,
+                                          TestSetData.ksTestStatus_Failure,
+                                          TestSetData.ksTestStatus_TimedOut,
+                                          TestSetData.ksTestStatus_Rebooted,
+                                        )
+                                     );
+                    cFailedPreReqs = self._oDb.fetchOne()[0];
+                    if cFailedPreReqs > 0:
+                        self.dprint('build %s is has %u prerequisite failures (out of %s)'
+                                    % (oEntry.oBuild.idBuild, cFailedPreReqs, sPreReqSet,));
+                        oEntry.setPreReqDecision(sPreReqSet, False);
+                        continue;
+
+                    oEntry.setPreReqDecision(sPreReqSet, True);
+                elif not fDecision:
+                    continue;
+
+            #
+            # If we can, check if the build files still exist.
+            #
+            if oEntry.oBuild.areFilesStillThere() is False:
+                self.dprint('build %s no longer exists' % (oEntry.oBuild.idBuild,));
+                oEntry.remove();
+                continue;
+
+            self.dprint('found oBuild=%s' % (oEntry.oBuild,));
+            return oEntry.oBuild;
+        return None;
+
+    def _tryFindMatchingBuild(self, oLeaderBuild, oTestBoxData, idBuildSrc):
+        """
+        Tries to find a matching build for gang scheduling.
+        Returns BuildDataEx or None. Raise exception on database error.
+
+        Can be overridden by child classes to change the default build requirements.
+        """
+        #
+        # Note! Should probably check build prerequisites if we get a different
+        #       build back, so that we don't use a build which hasn't passed
+        #       the smoke test.
+        #
+        _ = idBuildSrc;
+        return BuildLogic(self._oDb).tryFindSameBuildForOsArch(oLeaderBuild, oTestBoxData.sOs, oTestBoxData.sCpuArch);
+
+
+    def _tryAsLeader(self, oTask, oTestEx, oTestBoxData, tsNow, sBaseUrl):
+        """
+        Try schedule the task as a gang leader (can be a gang of one).
+        Returns response or None.  May raise exception on DB error.
+        """
+
+        # We don't wait for busy resources, we just try the next test.
+        oTestArgsLogic = TestCaseArgsLogic(self._oDb);
+        if not oTestArgsLogic.areResourcesFree(oTestEx):
+            self.dprint('Cannot get global test resources!');
+            return None;
+
+        #
+        # Find a matching build (this is the difficult bit).
+        #
+        oBuild = self._tryFindBuild(oTask, oTestEx, oTestBoxData, tsNow);
+        if oBuild is None:
+            self.dprint('No build!');
+            return None;
+        if oTestEx.oTestCase.needValidationKitBit():
+            oValidationKitBuild = self._tryFindValidationKitBit(oTestBoxData, tsNow);
+            if oValidationKitBuild is None:
+                self.dprint('No validation kit build!');
+                return None;
+        else:
+            oValidationKitBuild = None;
+
+        #
+        # Create a testset, allocate the resources and update the state.
+        # Note! Since resource allocation may still fail, we create a nested
+        #       transaction so we can roll back. (Heed lock warning in docs!)
+        #
+        self._oDb.execute('SAVEPOINT tryAsLeader');
+        idTestSet = self._createTestSet(oTask, oTestEx, oTestBoxData, oBuild, oValidationKitBuild, tsNow);
+
+        if GlobalResourceLogic(self._oDb).allocateResources(oTestBoxData.idTestBox, oTestEx.aoGlobalRsrc, fCommit = False) \
+           is not True:
+            self._oDb.execute('ROLLBACK TO SAVEPOINT tryAsLeader');
+            self.dprint('Failed to allocate global resources!');
+            return False;
+
+        if oTestEx.cGangMembers <= 1:
+            # We're alone, put the task back at the end of the queue and issue EXEC cmd.
+            self._moveTaskToEndOfQueue(oTask, oTestEx.cGangMembers, tsNow);
+            dResponse = self.composeExecResponseWorker(idTestSet, oTestEx, oTestBoxData, oBuild, oValidationKitBuild, sBaseUrl);
+            sTBState = TestBoxStatusData.ksTestBoxState_Testing;
+        else:
+            # We're missing gang members, issue WAIT cmd.
+            self._updateTask(oTask, tsNow if idTestSet == oTask.idTestSetGangLeader else None);
+            dResponse = { constants.tbresp.ALL_PARAM_RESULT: constants.tbresp.CMD_WAIT, };
+            sTBState = TestBoxStatusData.ksTestBoxState_GangGathering;
+
+        TestBoxStatusLogic(self._oDb).updateState(oTestBoxData.idTestBox, sTBState, idTestSet, fCommit = False);
+        self._oDb.execute('RELEASE SAVEPOINT tryAsLeader');
+        return dResponse;
+
+    def _tryAsGangMember(self, oTask, oTestEx, oTestBoxData, tsNow, sBaseUrl):
+        """
+        Try schedule the task as a gang member.
+        Returns response or None.  May raise exception on DB error.
+        """
+
+        #
+        # The leader has choosen a build, we need to find a matching one for our platform.
+        # (It's up to the scheduler decide upon how strict dependencies are to be enforced
+        # upon subordinate group members.)
+        #
+        oLeaderTestSet = TestSetData().initFromDbWithId(self._oDb, oTestBoxData.idTestSetGangLeader);
+
+        oLeaderBuild = BuildDataEx().initFromDbWithId(self._oDb, oLeaderTestSet.idBuild);
+        oBuild = self._tryFindMatchingBuild(oLeaderBuild, oTestBoxData, self._oSchedGrpData.idBuildSrc);
+        if oBuild is None:
+            return None;
+
+        oValidationKitBuild = None;
+        if oLeaderTestSet.idBuildTestSuite is not None:
+            oLeaderValidationKitBit = BuildDataEx().initFromDbWithId(self._oDb, oLeaderTestSet.idBuildTestSuite);
+            oValidationKitBuild = self._tryFindMatchingBuild(oLeaderValidationKitBit, oTestBoxData,
+                                                         self._oSchedGrpData.idBuildSrcTestSuite);
+
+        #
+        # Create a testset and update the state(s).
+        #
+        idTestSet = self._createTestSet(oTask, oTestEx, oTestBoxData, oBuild, oValidationKitBuild, tsNow);
+
+        oTBStatusLogic = TestBoxStatusLogic(self._oDb);
+        if oTask.cMissingGangMembers < 1:
+            # The whole gang is there, move the task to the end of the queue
+            # and update the status on the other gang members.
+            self._moveTaskToEndOfQueue(oTask, oTestEx.cGangMembers, tsNow);
+            dResponse = self.composeExecResponseWorker(idTestSet, oTestEx, oTestBoxData, oBuild, oValidationKitBuild, sBaseUrl);
+            sTBState = TestBoxStatusData.ksTestBoxState_GangTesting;
+            oTBStatusLogic.updateGangStatus(oTask.idTestSetGangLeader, sTBState, fCommit = False);
+        else:
+            # We're still missing some gang members, issue WAIT cmd.
+            self._updateTask(oTask, tsNow if idTestSet == oTask.idTestSetGangLeader else None);
+            dResponse = { constants.tbresp.ALL_PARAM_RESULT: constants.tbresp.CMD_WAIT, };
+            sTBState = TestBoxStatusData.ksTestBoxState_GangGathering;
+
+        oTBStatusLogic.updateState(oTestBoxData.idTestBox, sTBState, idTestSet, fCommit = False);
+        return dResponse;
+
+
+    def scheduleNewTaskWorker(self, oTestBoxData, tsNow, sBaseUrl):
+        """
+        Worker for schduling a new task.
+        """
+
+        #
+        # Iterate the scheduler queue (fetch all to avoid having to concurrent
+        # queries), trying out each task to see if the testbox can execute it.
+        #
+        dRejected = {}; # variations we've already checked out and rejected.
+        self._oDb.execute('SELECT  *\n'
+                          'FROM    SchedQueues\n'
+                          'WHERE   idSchedGroup = %s\n'
+                          '   AND  (   bmHourlySchedule IS NULL\n'
+                          '         OR get_bit(bmHourlySchedule, %s) = 1 )\n'
+                          'ORDER BY idItem ASC\n'
+                          , (self._oSchedGrpData.idSchedGroup, utils.getLocalHourOfWeek()) );
+        aaoRows = self._oDb.fetchAll();
+        for aoRow in aaoRows:
+            # Don't loop forever.
+            if self.getElapsedSecs() >= config.g_kcSecMaxNewTask:
+                break;
+
+            # Unpack the data and check if we've rejected the testcasevar/group variation already (they repeat).
+            oTask = SchedQueueData().initFromDbRow(aoRow);
+            if config.g_kfSrvGlueDebugScheduler:
+                self.dprint('** Considering: idItem=%s idGenTestCaseArgs=%s idTestGroup=%s Deps=%s last=%s cfg=%s\n'
+                            % ( oTask.idItem, oTask.idGenTestCaseArgs, oTask.idTestGroup, oTask.aidTestGroupPreReqs,
+                                oTask.tsLastScheduled, oTask.tsConfig,));
+
+            sRejectNm = '%s:%s' % (oTask.idGenTestCaseArgs, oTask.idTestGroup,);
+            if sRejectNm in dRejected:
+                self.dprint('Duplicate, already rejected! (%s)' % (sRejectNm,));
+                continue;
+            dRejected[sRejectNm] = 1;
+
+            # Fetch all the test case info (too much, but who cares right now).
+            oTestEx = TestCaseArgsDataEx().initFromDbWithGenIdEx(self._oDb, oTask.idGenTestCaseArgs,
+                                                                 tsConfigEff = oTask.tsConfig,
+                                                                 tsRsrcEff = oTask.tsConfig);
+            if config.g_kfSrvGlueDebugScheduler:
+                self.dprint('TestCase "%s": %s %s' % (oTestEx.oTestCase.sName, oTestEx.oTestCase.sBaseCmd, oTestEx.sArgs,));
+
+            # This shouldn't happen, but just in case it does...
+            if oTestEx.oTestCase.fEnabled is not True:
+                self.dprint('Testcase is not enabled!!');
+                continue;
+
+            # Check if the testbox properties matches the test.
+            if not oTestEx.matchesTestBoxProps(oTestBoxData):
+                self.dprint('Testbox mismatch!');
+                continue;
+
+            # Try schedule it.
+            if oTask.idTestSetGangLeader is None or oTestEx.cGangMembers <= 1:
+                dResponse = self._tryAsLeader(oTask, oTestEx, oTestBoxData, tsNow, sBaseUrl);
+            elif oTask.cMissingGangMembers > 1:
+                dResponse = self._tryAsGangMember(oTask, oTestEx, oTestBoxData, tsNow, sBaseUrl);
+            else:
+                dResponse = None; # Shouldn't happen!
+            if dResponse is not None:
+                self.dprint('Found a task! dResponse=%s' % (dResponse,));
+                return dResponse;
+
+        # Found no suitable task.
+        return None;
+
+    @staticmethod
+    def scheduleNewTask(oDb, oTestBoxData, sBaseUrl, iVerbosity = 0):
+        """
+        Schedules a new task.
+        """
+        try:
+            #
+            # To avoid concurrency issues in SchedQueues we lock all the rows
+            # related to our scheduling queue.  Also, since this is a very
+            # expensive operation we lock the testbox status row to fend of
+            # repeated retires by fault testbox script.
+            #
+            tsSecStart = utils.timestampSecond();
+            oDb.rollback();
+            oDb.begin();
+            oDb.execute('SELECT idTestBox FROM TestBoxStatuses WHERE idTestBox = %s FOR UPDATE NOWAIT'
+                        % (oTestBoxData.idTestBox,));
+            oDb.execute('SELECT idSchedGroup FROM SchedQueues WHERE idSchedGroup = %s FOR UPDATE'
+                        % (oTestBoxData.idSchedGroup,));
+
+            # We need the current timestamp.
+            tsNow = oDb.getCurrentTimestamp();
+
+            # Re-read the testbox data ...
+            oTestBoxDataCur = TestBoxData().initFromDbWithId(oDb, oTestBoxData.idTestBox, tsNow);
+            if    oTestBoxDataCur.fEnabled \
+              and oTestBoxDataCur.idGenTestBox == oTestBoxData.idGenTestBox \
+              and oTestBoxDataCur.idSchedGroup == oTestBoxData.idSchedGroup: # (paranoia wrt idSchedGroup)
+
+                # ... and schedule group data.
+                oSchedGrpData = SchedGroupData().initFromDbWithId(oDb, oTestBoxDataCur.idSchedGroup, tsNow);
+                if oSchedGrpData.fEnabled  and  oSchedGrpData.idBuildSrc is not None:
+
+                    #
+                    # Instantiate the specified scheduler and let it do the rest.
+                    #
+                    oScheduler = SchedulerBase._instantiate(oDb, oSchedGrpData, iVerbosity, tsSecStart);
+                    dResponse = oScheduler.scheduleNewTaskWorker(oTestBoxDataCur, tsNow, sBaseUrl);
+                    if dResponse is not None:
+                        oDb.commit();
+                        return dResponse;
+        except:
+            oDb.rollback();
+            raise;
+
+        # Not enabled, rollback and return no task.
+        oDb.rollback();
+        return None;
+
+    @staticmethod
+    def tryCancelGangGathering(oDb, oStatusData):
+        """
+        Try canceling a gang gathering.
+
+        Returns True if successfully cancelled.
+        Returns False if not (someone raced us to the SchedQueue table).
+
+        Note! oStatusData is re-initialized.
+        """
+        assert oStatusData.enmState == TestBoxStatusData.ksTestBoxState_GangGathering;
+        try:
+            #
+            # Lock the tables we're updating so we don't run into concurrency
+            # issues (we're racing both scheduleNewTask and other callers of
+            # this method).
+            #
+            oDb.rollback();
+            oDb.begin();
+            oDb.execute('LOCK TABLE TestBoxStatuses, SchedQueues IN EXCLUSIVE MODE');
+
+            #
+            # Re-read the testbox data and check that we're still in the same state.
+            #
+            oStatusData.initFromDbWithId(oDb, oStatusData.idTestBox);
+            if oStatusData.enmState == TestBoxStatusData.ksTestBoxState_GangGathering:
+                #
+                # Get the leader thru the test set and change the state of the whole gang.
+                #
+                oTestSetData = TestSetData().initFromDbWithId(oDb, oStatusData.idTestSet);
+
+                oTBStatusLogic = TestBoxStatusLogic(oDb);
+                oTBStatusLogic.updateGangStatus(oTestSetData.idTestSetGangLeader,
+                                                TestBoxStatusData.ksTestBoxState_GangGatheringTimedOut,
+                                                fCommit = False);
+
+                #
+                # Move the scheduling queue item to the end.
+                #
+                oDb.execute('SELECT *\n'
+                            'FROM   SchedQueues\n'
+                            'WHERE  idTestSetGangLeader = %s\n'
+                            , (oTestSetData.idTestSetGangLeader,) );
+                oTask = SchedQueueData().initFromDbRow(oDb.fetchOne());
+                oTestEx = TestCaseArgsDataEx().initFromDbWithGenId(oDb, oTask.idGenTestCaseArgs);
+
+                oDb.execute('UPDATE SchedQueues\n'
+                            '   SET idItem = NEXTVAL(\'SchedQueueItemIdSeq\'),\n'
+                            '       idTestSetGangLeader = NULL,\n'
+                            '       cMissingGangMembers = %s\n'
+                            'WHERE  idItem = %s\n'
+                            , (oTestEx.cGangMembers, oTask.idItem,) );
+
+                oDb.commit();
+                return True;
+
+            elif oStatusData.enmState == TestBoxStatusData.ksTestBoxState_GangGatheringTimedOut:
+                oDb.rollback();
+                return True;
+        except:
+            oDb.rollback();
+            raise;
+
+        # Not enabled, rollback and return no task.
+        oDb.rollback();
+        return False;
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class SchedQueueDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [SchedQueueData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/schedulerbeci.py b/src/VBox/ValidationKit/testmanager/core/schedulerbeci.py
new file mode 100644
index 0000000..86e08af
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/schedulerbeci.py
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+# $Id: schedulerbeci.py $
+
+"""
+Test Manager - Best-Effort-Continous-Itegration (BECI) scheduler.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.core.schedulerbase  import SchedulerBase, SchedQueueData;
+
+
+class SchdulerBeci(SchedulerBase): # pylint: disable=R0903
+    """
+    The best-effort-continous-itegration scheduler, BECI for short.
+    """
+
+    def __init__(self, oDb, oSchedGrpData, iVerbosity, tsSecStart):
+        SchedulerBase.__init__(self, oDb, oSchedGrpData, iVerbosity, tsSecStart);
+
+    def _recreateQueueItems(self, oData):
+        #
+        # Prepare the input data for the loop below.  We compress the priority
+        # to reduce the number of loops we need to executes below.
+        #
+        # Note! For BECI test group priority only applies to the ordering of
+        #       test groups, which has been resolved by the done sorting in the
+        #       base class.
+        #
+        iMinPriority = 0x7fff;
+        iMaxPriority = 0;
+        for oTestGroup in oData.aoTestGroups:
+            for oTestCase in oTestGroup.aoTestCases:
+                iPrio = oTestCase.iSchedPriority;
+                assert iPrio in range(32);
+                iPrio = iPrio / 4;
+                assert iPrio in range(8);
+                if iPrio > iMaxPriority:
+                    iMaxPriority = iPrio;
+                if iPrio < iMinPriority:
+                    iMinPriority = iPrio;
+
+                oTestCase.iBeciPrio      = iPrio;
+                oTestCase.iNextVariation = -1;
+
+        assert iMinPriority in range(8);
+        assert iMaxPriority in range(8);
+        assert iMinPriority <= iMaxPriority;
+
+        #
+        # Generate the
+        #
+        cMaxItems = len(oData.aoArgsVariations) * 64;
+        if cMaxItems > 1048576:
+            cMaxItems = 1048576;
+
+        aoItems   = list();
+        cNotAtEnd = len(oData.aoTestCases);
+        while len(aoItems) < cMaxItems:
+            self.msgDebug('outer loop: %s items' % (len(aoItems),));
+            for iPrio in range(iMaxPriority, iMinPriority - 1, -1):
+                #self.msgDebug('prio loop: %s' % (iPrio,));
+                for oTestGroup in oData.aoTestGroups:
+                    #self.msgDebug('testgroup loop: %s' % (oTestGroup,));
+                    for oTestCase in oTestGroup.aoTestCases:
+                        self.msgDebug('testcase loop: idTestCase=%s' % (oTestCase.idTestCase,));
+                        if iPrio <= oTestCase.iBeciPrio  and  len(oTestCase.aoArgsVariations) > 0:
+                            # Get variation.
+                            iNext = oTestCase.iNextVariation;
+                            if iNext != 0:
+                                if iNext == -1: iNext = 0;
+                                cNotAtEnd -= 1;
+                            oArgsVariation = oTestCase.aoArgsVariations[iNext];
+
+                            # Update next variation.
+                            iNext = (iNext + 1) % len(oTestCase.aoArgsVariations);
+                            cNotAtEnd += iNext != 0;
+                            oTestCase.iNextVariation = iNext;
+
+                            # Create queue item and append it.
+                            oItem = SchedQueueData();
+                            oItem.initFromValues(idSchedGroup        = self._oSchedGrpData.idSchedGroup,
+                                                 idGenTestCaseArgs   = oArgsVariation.idGenTestCaseArgs,
+                                                 idTestGroup         = oTestGroup.idTestGroup,
+                                                 aidTestGroupPreReqs = oTestGroup.aidTestGroupPreReqs,
+                                                 bmHourlySchedule    = oTestGroup.bmHourlySchedule,
+                                                 cMissingGangMembers = oArgsVariation.cGangMembers,
+                                                 offQueue            = len(aoItems));
+                            aoItems.append(oItem);
+
+                            # Done?
+                            if cNotAtEnd == 0:
+                                self.msgDebug('returns %s items' % (len(aoItems),));
+                                return aoItems;
+        return aoItems;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/systemlog.py b/src/VBox/ValidationKit/testmanager/core/systemlog.py
new file mode 100644
index 0000000..2e0c5d4
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/systemlog.py
@@ -0,0 +1,175 @@
+# -*- coding: utf-8 -*-
+# $Id: systemlog.py $
+
+"""
+Test Manager - SystemLog.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from testmanager.core.base import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+
+
+class SystemLogData(ModelDataBase):  # pylint: disable=R0902
+    """
+    SystemLog Data.
+    """
+
+    ## @name Event Constants
+    # @{
+    ksEvent_CmdNacked           = 'CmdNack ';
+    ksEvent_TestBoxUnknown      = 'TBoxUnkn';
+    ksEvent_TestSetAbandond     = 'TSetAbdd';
+    ksEvent_UserAccountUnknown  = 'TAccUnkn';
+    ksEvent_XmlResultMalformed  = 'XmlRMalf';
+    ksEvent_SchedQueueRecreate  = 'SchQRecr';
+    ## @}
+
+    ## Valid event types.
+    kasEvents = \
+    [ \
+        ksEvent_CmdNacked,
+        ksEvent_TestBoxUnknown,
+        ksEvent_TestSetAbandond,
+        ksEvent_UserAccountUnknown,
+        ksEvent_XmlResultMalformed,
+        ksEvent_SchedQueueRecreate,
+    ];
+
+    ksParam_tsCreated           = 'tsCreated';
+    ksParam_sEvent              = 'sEvent';
+    ksParam_sLogText            = 'sLogText';
+
+    kasValidValues_sEvent       = kasEvents;
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.tsCreated          = None;
+        self.sEvent             = None;
+        self.sLogText           = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Internal worker for initFromDbWithId and initFromDbWithGenId as well as
+        SystemLogLogic.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('SystemLog row not found.');
+
+        self.tsCreated          = aoRow[0];
+        self.sEvent             = aoRow[1];
+        self.sLogText           = aoRow[2];
+        return self;
+
+
+class SystemLogLogic(ModelLogicBase):
+    """
+    SystemLog logic.
+    """
+
+    def __init__(self, oDb):
+        ModelLogicBase.__init__(self, oDb);
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches SystemLog entries.
+
+        Returns an array (list) of SystemLogData items, empty list if none.
+        Raises exception on error.
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SystemLog\n'
+                              'ORDER BY tsCreated DESC\n'
+                              'LIMIT %s OFFSET %s\n',
+                              (cMaxRows, iStart));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     SystemLog\n'
+                              'WHERE    tsCreated <= %s\n'
+                              'ORDER BY tsCreated DESC\n'
+                              'LIMIT %s OFFSET %s\n',
+                              (tsNow, cMaxRows, iStart));
+        aoRows = [];
+        for _ in range(self._oDb.getRowCount()):
+            oData = SystemLogData();
+            oData.initFromDbRow(self._oDb.fetchOne());
+            aoRows.append(oData);
+        return aoRows;
+
+    def addEntry(self, sEvent, sLogText, cHoursRepeat = 0, fCommit = False):
+        """
+        Adds an entry to the SystemLog table.
+        Raises exception on problem.
+        """
+        if sEvent not in SystemLogData.kasEvents:
+            raise TMExceptionBase('Unknown event type "%s"' % (sEvent,));
+
+        # Check the repeat restriction first.
+        if cHoursRepeat > 0:
+            self._oDb.execute('SELECT   COUNT(*) as Stuff\n'
+                              'FROM     SystemLog\n'
+                              'WHERE    tsCreated >= (current_timestamp - interval \'%s hours\')\n'
+                              '     AND sEvent = %s\n'
+                              '     AND sLogText = %s\n',
+                              (cHoursRepeat,
+                               sEvent,
+                               sLogText));
+            aRow = self._oDb.fetchOne();
+            if aRow[0] > 0:
+                return None;
+
+        # Insert it.
+        self._oDb.execute('INSERT INTO SystemLog (sEvent, sLogText)\n'
+                          'VALUES   (%s, %s)\n',
+                          (sEvent, sLogText));
+
+        if fCommit:
+            self._oDb.commit();
+        return True;
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class SystemLogDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [SystemLogData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testbox.py b/src/VBox/ValidationKit/testmanager/core/testbox.py
new file mode 100644
index 0000000..af777b7
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testbox.py
@@ -0,0 +1,885 @@
+# -*- coding: utf-8 -*-
+# $Id: testbox.py $
+
+"""
+Test Manager - TestBox.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from testmanager.core.base  import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase, \
+                                   ChangeLogEntry, AttributeChangeEntry;
+
+
+# pylint: disable=C0103
+class TestBoxData(ModelDataBase):  # pylint: disable=R0902
+    """
+    TestBox Data.
+    """
+
+    ## LomKind_T
+    ksLomKind_None                  = 'none';
+    ksLomKind_ILOM                  = 'ilom';
+    ksLomKind_ELOM                  = 'elom';
+    ksLomKind_AppleXserveLom        = 'apple-xserver-lom';
+    kasLomKindValues                = [ ksLomKind_None, ksLomKind_ILOM, ksLomKind_ELOM, ksLomKind_AppleXserveLom];
+    kaoLomKindDescs                 = \
+    [
+        ( ksLomKind_None,           'None',             ''),
+        ( ksLomKind_ILOM,           'ILOM',             ''),
+        ( ksLomKind_ELOM,           'ELOM',             ''),
+        ( ksLomKind_AppleXserveLom, 'Apple Xserve LOM', ''),
+    ];
+
+
+    ## TestBoxCmd_T
+    ksTestBoxCmd_None               = 'none';
+    ksTestBoxCmd_Abort              = 'abort';
+    ksTestBoxCmd_Reboot             = 'reboot';
+    ksTestBoxCmd_Upgrade            = 'upgrade';
+    ksTestBoxCmd_UpgradeAndReboot   = 'upgrade-and-reboot';
+    ksTestBoxCmd_Special            = 'special';
+    kasTestBoxCmdValues             =  [ ksTestBoxCmd_None, ksTestBoxCmd_Abort, ksTestBoxCmd_Reboot, ksTestBoxCmd_Upgrade,
+                                         ksTestBoxCmd_UpgradeAndReboot, ksTestBoxCmd_Special];
+    kaoTestBoxCmdDescs              = \
+    [
+        ( ksTestBoxCmd_None,              'None',                               ''),
+        ( ksTestBoxCmd_Abort,             'Abort current test',                 ''),
+        ( ksTestBoxCmd_Reboot,            'Reboot TestBox',                     ''),
+        ( ksTestBoxCmd_Upgrade,           'Upgrade TestBox Script',             ''),
+        ( ksTestBoxCmd_UpgradeAndReboot,  'Upgrade TestBox Script and reboot',  ''),
+        ( ksTestBoxCmd_Special,           'Special (reserved)',                 ''),
+    ];
+
+
+    ksIdAttr    = 'idTestBox';
+    ksIdGenAttr = 'idGenTestBox';
+
+    ksParam_idTestBox           = 'TestBox_idTestBox';
+    ksParam_tsEffective         = 'TestBox_tsEffective';
+    ksParam_tsExpire            = 'TestBox_tsExpire';
+    ksParam_uidAuthor           = 'TestBox_uidAuthor';
+    ksParam_idGenTestBox        = 'TestBox_idGenTestBox';
+    ksParam_ip                  = 'TestBox_ip';
+    ksParam_uuidSystem          = 'TestBox_uuidSystem';
+    ksParam_sName               = 'TestBox_sName';
+    ksParam_sDescription        = 'TestBox_sDescription';
+    ksParam_idSchedGroup        = 'TestBox_idSchedGroup';
+    ksParam_fEnabled            = 'TestBox_fEnabled';
+    ksParam_enmLomKind          = 'TestBox_enmLomKind';
+    ksParam_ipLom               = 'TestBox_ipLom';
+    ksParam_pctScaleTimeout     = 'TestBox_pctScaleTimeout';
+    ksParam_sOs                 = 'TestBox_sOs';
+    ksParam_sOsVersion          = 'TestBox_sOsVersion';
+    ksParam_sCpuVendor          = 'TestBox_sCpuVendor';
+    ksParam_sCpuArch            = 'TestBox_sCpuArch';
+    ksParam_sCpuName            = 'TestBox_sCpuName';
+    ksParam_lCpuRevision        = 'TestBox_lCpuRevision';
+    ksParam_cCpus               = 'TestBox_cCpus';
+    ksParam_fCpuHwVirt          = 'TestBox_fCpuHwVirt';
+    ksParam_fCpuNestedPaging    = 'TestBox_fCpuNestedPaging';
+    ksParam_fCpu64BitGuest      = 'TestBox_fCpu64BitGuest';
+    ksParam_fChipsetIoMmu       = 'TestBox_fChipsetIoMmu';
+    ksParam_cMbMemory           = 'TestBox_cMbMemory';
+    ksParam_cMbScratch          = 'TestBox_cMbScratch';
+    ksParam_sReport             = 'TestBox_sReport';
+    ksParam_iTestBoxScriptRev   = 'TestBox_iTestBoxScriptRev';
+    ksParam_iPythonHexVersion   = 'TestBox_iPythonHexVersion';
+    ksParam_enmPendingCmd       = 'TestBox_enmPendingCmd';
+
+    kasAllowNullAttributes      = ['idTestBox', 'tsEffective', 'tsExpire', 'uidAuthor', 'idGenTestBox', 'sDescription',
+                                   'ipLom', 'sOs', 'sOsVersion', 'sCpuVendor', 'sCpuArch', 'sCpuName', 'lCpuRevision', 'cCpus',
+                                   'fCpuHwVirt', 'fCpuNestedPaging', 'fCpu64BitGuest', 'fChipsetIoMmu', 'cMbMemory',
+                                   'cMbScratch', 'sReport', 'iTestBoxScriptRev', 'iPythonHexVersion' ];
+    kasValidValues_enmLomKind   = kasLomKindValues;
+    kasValidValues_enmPendingCmd = kasTestBoxCmdValues;
+    kiMin_pctScaleTimeout       =    11;
+    kiMax_pctScaleTimeout       = 19999;
+    kcchMax_sReport             = 65535;
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestBox           = None;
+        self.tsEffective         = None;
+        self.tsExpire            = None;
+        self.uidAuthor           = None;
+        self.idGenTestBox        = None;
+        self.ip                  = None;
+        self.uuidSystem          = None;
+        self.sName               = None;
+        self.sDescription        = None;
+        self.idSchedGroup        = 1;
+        self.fEnabled            = False;
+        self.enmLomKind          = self.ksLomKind_None;
+        self.ipLom               = None;
+        self.pctScaleTimeout     = 100;
+        self.sOs                 = None;
+        self.sOsVersion          = None;
+        self.sCpuVendor          = None;
+        self.sCpuArch            = None;
+        self.sCpuName            = None;
+        self.lCpuRevision        = None;
+        self.cCpus               = 1;
+        self.fCpuHwVirt          = False;
+        self.fCpuNestedPaging    = False;
+        self.fCpu64BitGuest      = False;
+        self.fChipsetIoMmu       = False;
+        self.cMbMemory           = 1;
+        self.cMbScratch          = 0;
+        self.sReport             = None;
+        self.iTestBoxScriptRev   = 0;
+        self.iPythonHexVersion   = 0;
+        self.enmPendingCmd       = self.ksTestBoxCmd_None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Internal worker for initFromDbWithId and initFromDbWithGenId as well as
+        from TestBoxLogic.  Expecting a SELECT * FROM TestBoxes result.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('TestBox not found.');
+
+        self.idTestBox           = aoRow[0];
+        self.tsEffective         = aoRow[1];
+        self.tsExpire            = aoRow[2];
+        self.uidAuthor           = aoRow[3];
+        self.idGenTestBox        = aoRow[4];
+        self.ip                  = aoRow[5];
+        self.uuidSystem          = aoRow[6];
+        self.sName               = aoRow[7];
+        self.sDescription        = aoRow[8];
+        self.idSchedGroup        = aoRow[9];
+        self.fEnabled            = aoRow[10];
+        self.enmLomKind          = aoRow[11];
+        self.ipLom               = aoRow[12];
+        self.pctScaleTimeout     = aoRow[13];
+        self.sOs                 = aoRow[14];
+        self.sOsVersion          = aoRow[15];
+        self.sCpuVendor          = aoRow[16];
+        self.sCpuArch            = aoRow[17];
+        self.sCpuName            = aoRow[18];
+        self.lCpuRevision        = aoRow[19];
+        self.cCpus               = aoRow[20];
+        self.fCpuHwVirt          = aoRow[21];
+        self.fCpuNestedPaging    = aoRow[22];
+        self.fCpu64BitGuest      = aoRow[23];
+        self.fChipsetIoMmu       = aoRow[24];
+        self.cMbMemory           = aoRow[25];
+        self.cMbScratch          = aoRow[26];
+        self.sReport             = aoRow[27];
+        self.iTestBoxScriptRev   = aoRow[28];
+        self.iPythonHexVersion   = aoRow[29];
+        self.enmPendingCmd       = aoRow[30];
+        return self;
+
+    def initFromDbWithId(self, oDb, idTestBox, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   TestBoxes\n'
+                                                       'WHERE  idTestBox    = %s\n'
+                                                       , ( idTestBox, ), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idTestBox=%s not found (tsNow=%s sPeriodBack=%s)' % (idTestBox, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+    def initFromDbWithGenId(self, oDb, idGenTestBox):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute('SELECT *\n'
+                    'FROM   TestBoxes\n'
+                    'WHERE  idGenTestBox = %s\n'
+                    , (idGenTestBox, ) );
+        return self.initFromDbRow(oDb.fetchOne());
+
+    def _validateAndConvertWorker(self, asAllowNullAttributes, oDb):
+        # Override to do extra ipLom checks.
+        dErrors = ModelDataBase._validateAndConvertWorker(self, asAllowNullAttributes, oDb);
+        if    self.ksParam_ipLom      not in dErrors \
+          and self.ksParam_enmLomKind not in dErrors \
+          and self.enmLomKind != self.ksLomKind_None \
+          and self.ipLom is None:
+            dErrors[self.ksParam_ipLom] = 'Light-out-management IP is mandatory and a LOM is selected.'
+        return dErrors;
+
+    def formatPythonVersion(self):
+        """
+        Unbuttons the version number and formats it as a version string.
+        """
+        if self.iPythonHexVersion is None:
+            return 'N/A';
+        return 'v%d.%d.%d.%d' \
+            % (  self.iPythonHexVersion >> 24,
+                (self.iPythonHexVersion >> 16) & 0xff,
+                (self.iPythonHexVersion >>  8) & 0xff,
+                 self.iPythonHexVersion        & 0xff);
+
+    def getCpuFamily(self):
+        """ Returns the CPU family for a x86 or amd64 testboxes."""
+        if self.lCpuRevision is None:
+            return 0;
+        return (self.lCpuRevision >> 24 & 0xff);
+
+    def getCpuModel(self):
+        """ Returns the CPU model for a x86 or amd64 testboxes."""
+        if self.lCpuRevision is None:
+            return 0;
+        return (self.lCpuRevision >> 8 & 0xffff);
+
+    def getCpuStepping(self):
+        """ Returns the CPU stepping for a x86 or amd64 testboxes."""
+        if self.lCpuRevision is None:
+            return 0;
+        return (self.lCpuRevision & 0xff);
+
+
+class TestBoxLogic(ModelLogicBase):
+    """
+    TestBox logic.
+    """
+
+
+    def __init__(self, oDb):
+        ModelLogicBase.__init__(self, oDb);
+
+    def tryFetchTestBoxByUuid(self, sTestBoxUuid):
+        """
+        Tries to fetch a testbox by its UUID alone.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     TestBoxes\n'
+                          'WHERE    uuidSystem = %s\n'
+                          '     AND tsExpire = \'infinity\'::timestamp\n'
+                          'ORDER BY tsEffective DESC\n',
+                          (sTestBoxUuid,));
+        if self._oDb.getRowCount() == 0:
+            return None;
+        if self._oDb.getRowCount() != 1:
+            raise TMExceptionBase('Database integrity error: %u hits' % (self._oDb.getRowCount(),));
+        oData = TestBoxData();
+        oData.initFromDbRow(self._oDb.fetchOne());
+        return oData;
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches testboxes for listing.
+
+        Returns an array (list) of TestBoxData items, empty list if none. The
+        TestBoxData instances have an extra oStatus member that is either None or
+        a TestBoxStatusData instance, and a member tsCurrent holding
+        CURRENT_TIMESTAMP.
+
+        Raises exception on error.
+        """
+        from testmanager.core.testboxstatus import TestBoxStatusData;
+
+        if tsNow is None:
+            self._oDb.execute('SELECT   TestBoxes.*, TestBoxStatuses.*\n'
+                              'FROM     TestBoxes\n'
+                              'LEFT OUTER JOIN TestBoxStatuses ON (\n'
+                              '         TestBoxStatuses.idTestBox = TestBoxes.idTestBox )\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sName\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   TestBoxes.*, TestBoxStatuses.*\n'
+                              'FROM     TestBoxes\n'
+                              'LEFT OUTER JOIN TestBoxStatuses ON (\n'
+                              '         TestBoxStatuses.idTestBox = TestBoxes.idTestBox )\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY sName\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRows = [];
+        for aoOne in self._oDb.fetchAll():
+            oTestBox = TestBoxData().initFromDbRow(aoOne);
+            oTestBox.tsCurrent = self._oDb.getCurrentTimestamp();                  # pylint: disable=W0201
+            oTestBox.oStatus   = None;                                             # pylint: disable=W0201
+            if aoOne[31] is not None:
+                oTestBox.oStatus = TestBoxStatusData().initFromDbRow(aoOne[31:]);  # pylint: disable=W0201
+            aoRows.append(oTestBox);
+        return aoRows;
+
+    def fetchForChangeLog(self, idTestBox, iStart, cMaxRows, tsNow): # pylint: disable=R0914
+        """
+        Fetches change log entries for a testbox.
+
+        Returns an array of ChangeLogEntry instance and an indicator whether
+        there are more entries.
+        Raises exception on error.
+        """
+
+        if tsNow is None:
+            tsNow = self._oDb.getCurrentTimestamp();
+
+        self._oDb.execute('SELECT   TestBoxes.*, Users.sUsername\n'
+                          'FROM     TestBoxes\n'
+                          'LEFT OUTER JOIN Users \n'
+                          '     ON (    TestBoxes.uidAuthor = Users.uid\n'
+                          '         AND Users.tsEffective <= TestBoxes.tsEffective\n'
+                          '         AND Users.tsExpire    >  TestBoxes.tsEffective)\n'
+                          'WHERE    TestBoxes.tsEffective <= %s\n'
+                          '     AND TestBoxes.idTestBox = %s\n'
+                          'ORDER BY TestBoxes.tsExpire DESC\n'
+                          'LIMIT %s OFFSET %s\n'
+                          , (tsNow, idTestBox, cMaxRows + 1, iStart,));
+
+        aoRows = [];
+        for _ in range(self._oDb.getRowCount()):
+            oRow = self._oDb.fetchOne();
+            aoRows.append([TestBoxData().initFromDbRow(oRow), oRow[-1],]);
+
+        # Calculate the changes.
+        aoEntries = [];
+        for i in range(0, len(aoRows) - 1):
+            (oNew, sAuthor) = aoRows[i];
+            (oOld, _      ) = aoRows[i + 1];
+            aoChanges = [];
+            for sAttr in oNew.getDataAttributes():
+                if sAttr not in [ 'tsEffective', 'tsExpire', 'uidAuthor']:
+                    oOldAttr = getattr(oOld, sAttr);
+                    oNewAttr = getattr(oNew, sAttr);
+                    if oOldAttr != oNewAttr:
+                        aoChanges.append(AttributeChangeEntry(sAttr, oNewAttr, oOldAttr, str(oNewAttr), str(oOldAttr)));
+            aoEntries.append(ChangeLogEntry(oNew.uidAuthor, sAuthor, oNew.tsEffective, oNew.tsExpire, oNew, oOld, aoChanges));
+
+        # If we're at the end of the log, add the initial entry.
+        if len(aoRows) <= cMaxRows and len(aoRows) > 0:
+            (oNew, sAuthor) = aoRows[-1];
+            aoEntries.append(ChangeLogEntry(oNew.uidAuthor, aoRows[-1][1], oNew.tsEffective, oNew.tsExpire, oNew, None, []));
+
+        return (aoEntries, len(aoRows) > cMaxRows);
+
+    def addEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Creates a testbox in the database.
+        Returns the testbox ID, testbox generation ID and effective timestamp
+        of the created testbox on success.  Throws error on failure.
+        """
+        dDataErrors = oData.validateAndConvert(self._oDb);
+        if len(dDataErrors) > 0:
+            raise TMExceptionBase('Invalid data passed to create(): %s' % (dDataErrors,));
+
+        self._oDb.execute('INSERT INTO TestBoxes (\n'
+                          '         idTestBox,\n'
+                          '         tsEffective,\n'
+                          '         tsExpire,\n'
+                          '         uidAuthor,\n'
+                          '         idGenTestBox,\n'
+                          '         ip,\n'
+                          '         uuidSystem,\n'
+                          '         sName,\n'
+                          '         sDescription,\n'
+                          '         idSchedGroup,\n'
+                          '         fEnabled,\n'
+                          '         enmLomKind,\n'
+                          '         ipLom,\n'
+                          '         pctScaleTimeout,\n'
+                          '         sOs,\n'
+                          '         sOsVersion,\n'
+                          '         sCpuVendor,\n'
+                          '         sCpuArch,\n'
+                          '         sCpuName,\n'
+                          '         lCpuRevision,\n'
+                          '         cCpus,\n'
+                          '         fCpuHwVirt,\n'
+                          '         fCpuNestedPaging,\n'
+                          '         fCpu64BitGuest,\n'
+                          '         fChipsetIoMmu,\n'
+                          '         cMbMemory,\n'
+                          '         cMbScratch,\n'
+                          '         sReport,\n'
+                          '         iTestBoxScriptRev,\n'
+                          '         iPythonHexVersion,\n'
+                          '         enmPendingCmd\n'
+                          '         )'
+                          'VALUES (\n'
+                          '         DEFAULT,\n'
+                          '         CURRENT_TIMESTAMP,\n'
+                          '         DEFAULT,\n'
+                          '         %s,\n'          # uidAuthor
+                          '         DEFAULT,\n'
+                          '         %s,\n'          # ip
+                          '         %s,\n'          # uuidSystem
+                          '         %s,\n'          # sName
+                          '         %s,\n'          # sDescription
+                          '         %s,\n'          # idSchedGroup
+                          '         %s,\n'          # fEnabled
+                          '         %s,\n'          # enmLomKind
+                          '         %s,\n'          # ipLom
+                          '         %s,\n'          # pctScaleTimeout
+                          '         %s,\n'          # sOs
+                          '         %s,\n'          # sOsVersion
+                          '         %s,\n'          # sCpuVendor
+                          '         %s,\n'          # sCpuArch
+                          '         %s,\n'          # sCpuName
+                          '         %s,\n'          # lCpuRevision
+                          '         %s,\n'          # cCpus
+                          '         %s,\n'          # fCpuHwVirt
+                          '         %s,\n'          # fCpuNestedPaging
+                          '         %s,\n'          # fCpu64BitGuest
+                          '         %s,\n'          # fChipsetIoMmu
+                          '         %s,\n'          # cMbMemory
+                          '         %s,\n'          # cMbScratch
+                          '         %s,\n'          # sReport
+                          '         %s,\n'          # iTestBoxScriptRev
+                          '         %s,\n'          # iPythonHexVersion
+                          '         %s\n'           # enmPendingCmd
+                          '         )\n'
+                          'RETURNING idTestBox, idGenTestBox, tsEffective'
+                          , (uidAuthor,
+                             oData.ip,
+                             oData.uuidSystem,
+                             oData.sName,
+                             oData.sDescription,
+                             oData.idSchedGroup,
+                             oData.fEnabled,
+                             oData.enmLomKind,
+                             oData.ipLom,
+                             oData.pctScaleTimeout,
+                             oData.sOs,
+                             oData.sOsVersion,
+                             oData.sCpuVendor,
+                             oData.sCpuArch,
+                             oData.sCpuName,
+                             oData.lCpuRevision,
+                             oData.cCpus,
+                             oData.fCpuHwVirt,
+                             oData.fCpuNestedPaging,
+                             oData.fCpu64BitGuest,
+                             oData.fChipsetIoMmu,
+                             oData.cMbMemory,
+                             oData.cMbScratch,
+                             oData.sReport,
+                             oData.iTestBoxScriptRev,
+                             oData.iPythonHexVersion,
+                             oData.enmPendingCmd
+                             )
+                          );
+        oRow = self._oDb.fetchOne();
+        self._oDb.maybeCommit(fCommit);
+        return (oRow[0], oRow[1], oRow[2]);
+
+    def editEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Data edit update, web UI is the primary user.
+        Returns the new generation ID and effective date.
+        """
+
+        dDataErrors = oData.validateAndConvert(self._oDb);
+        if len(dDataErrors) > 0:
+            raise TMExceptionBase('Invalid data passed to create(): %s' % (dDataErrors,));
+
+        ## @todo check if the data changed.
+
+        self._oDb.execute('UPDATE ONLY TestBoxes\n'
+                          'SET      tsExpire = CURRENT_TIMESTAMP\n'
+                          'WHERE    idGenTestBox = %s\n'
+                          '     AND tsExpire = \'infinity\'::timestamp\n'
+                          'RETURNING tsExpire\n',
+                          (oData.idGenTestBox,));
+        try:
+            tsEffective = self._oDb.fetchOne()[0];
+
+            # Would be easier to do this using an insert or update hook, I think. Much easier.
+            self._oDb.execute('INSERT INTO TestBoxes (\n'
+                              '         idGenTestBox,\n'
+                              '         idTestBox,\n'
+                              '         tsEffective,\n'
+                              '         uidAuthor,\n'
+                              '         ip,\n'
+                              '         uuidSystem,\n'
+                              '         sName,\n'
+                              '         sDescription,\n'
+                              '         idSchedGroup,\n'
+                              '         fEnabled,\n'
+                              '         enmLomKind,\n'
+                              '         ipLom,\n'
+                              '         pctScaleTimeout,\n'
+                              '         sOs,\n'
+                              '         sOsVersion,\n'
+                              '         sCpuVendor,\n'
+                              '         sCpuArch,\n'
+                              '         sCpuName,\n'
+                              '         lCpuRevision,\n'
+                              '         cCpus,\n'
+                              '         fCpuHwVirt,\n'
+                              '         fCpuNestedPaging,\n'
+                              '         fCpu64BitGuest,\n'
+                              '         fChipsetIoMmu,\n'
+                              '         cMbMemory,\n'
+                              '         cMbScratch,\n'
+                              '         iTestBoxScriptRev,\n'
+                              '         iPythonHexVersion,\n'
+                              '         enmPendingCmd\n'
+                              '         )\n'
+                              'SELECT   NEXTVAL(\'TestBoxGenIdSeq\'),\n'
+                              '         idTestBox,\n'
+                              '         %s,\n'          # tsEffective
+                              '         %s,\n'          # uidAuthor
+                              '         %s,\n'          # ip
+                              '         %s,\n'          # uuidSystem
+                              '         %s,\n'          # sName
+                              '         %s,\n'          # sDescription
+                              '         %s,\n'          # idSchedGroup
+                              '         %s,\n'          # fEnabled
+                              '         %s,\n'          # enmLomKind
+                              '         %s,\n'          # ipLom
+                              '         %s,\n'          # pctScaleTimeout
+                              '         sOs,\n'
+                              '         sOsVersion,\n'
+                              '         sCpuVendor,\n'
+                              '         sCpuArch,\n'
+                              '         sCpuName,\n'
+                              '         lCpuRevision,\n'
+                              '         cCpus,\n'
+                              '         fCpuHwVirt,\n'
+                              '         fCpuNestedPaging,\n'
+                              '         fCpu64BitGuest,\n'
+                              '         fChipsetIoMmu,\n'
+                              '         cMbMemory,\n'
+                              '         cMbScratch,\n'
+                              '         iTestBoxScriptRev,\n'
+                              '         iPythonHexVersion,\n'
+                              '         %s\n'           # enmPendingCmd
+                              'FROM     TestBoxes\n'
+                              'WHERE    idGenTestBox = %s\n'
+                              'RETURNING idGenTestBox, tsEffective'
+                              , (tsEffective,
+                                 uidAuthor,
+                                 oData.ip,
+                                 oData.uuidSystem,
+                                 oData.sName,
+                                 oData.sDescription,
+                                 oData.idSchedGroup,
+                                 oData.fEnabled,
+                                 oData.enmLomKind,
+                                 oData.ipLom,
+                                 oData.pctScaleTimeout,
+                                 oData.enmPendingCmd,
+                                 oData.idGenTestBox,
+                              ));
+            aRow = self._oDb.fetchOne();
+            if aRow is None:
+                raise TMExceptionBase('Insert failed? oRow=None');
+            idGenTestBox = aRow[0];
+            tsEffective  = aRow[1];
+            self._oDb.maybeCommit(fCommit);
+        except:
+            self._oDb.rollback();
+            raise;
+
+        return (idGenTestBox, tsEffective);
+
+    def updateOnSignOn(self, idTestBox, idGenTestBox, sTestBoxAddr, sOs, sOsVersion, # pylint: disable=R0913,R0914
+                       sCpuVendor, sCpuArch, sCpuName, lCpuRevision, cCpus, fCpuHwVirt, fCpuNestedPaging, fCpu64BitGuest,
+                       fChipsetIoMmu, cMbMemory, cMbScratch, sReport, iTestBoxScriptRev, iPythonHexVersion):
+        """
+        Update the testbox attributes automatically on behalf of the testbox script.
+        Returns the new generation id on success, raises an exception on failure.
+        """
+        try:
+            # Would be easier to do this using an insert or update hook, I think. Much easier.
+            self._oDb.execute('UPDATE ONLY TestBoxes\n'
+                              'SET      tsExpire = CURRENT_TIMESTAMP\n'
+                              'WHERE    idGenTestBox = %s\n'
+                              '     AND tsExpire = \'infinity\'::timestamp\n'
+                              'RETURNING tsExpire\n',
+                              (idGenTestBox,));
+            tsEffective = self._oDb.fetchOne()[0];
+
+            self._oDb.execute('INSERT INTO TestBoxes (\n'
+                              '         idGenTestBox,\n'
+                              '         idTestBox,\n'
+                              '         tsEffective,\n'
+                              '         uidAuthor,\n'
+                              '         ip,\n'
+                              '         uuidSystem,\n'
+                              '         sName,\n'
+                              '         sDescription,\n'
+                              '         idSchedGroup,\n'
+                              '         fEnabled,\n'
+                              '         enmLomKind,\n'
+                              '         ipLom,\n'
+                              '         pctScaleTimeout,\n'
+                              '         sOs,\n'
+                              '         sOsVersion,\n'
+                              '         sCpuVendor,\n'
+                              '         sCpuArch,\n'
+                              '         sCpuName,\n'
+                              '         lCpuRevision,\n'
+                              '         cCpus,\n'
+                              '         fCpuHwVirt,\n'
+                              '         fCpuNestedPaging,\n'
+                              '         fCpu64BitGuest,\n'
+                              '         fChipsetIoMmu,\n'
+                              '         cMbMemory,\n'
+                              '         cMbScratch,\n'
+                              '         sReport,\n'
+                              '         iTestBoxScriptRev,\n'
+                              '         iPythonHexVersion,\n'
+                              '         enmPendingCmd\n'
+                              '         )\n'
+                              'SELECT   NEXTVAL(\'TestBoxGenIdSeq\'),\n'
+                              '         %s,\n'
+                              '         %s,\n'
+                              '         NULL,\n'            # uidAuthor
+                              '         %s,\n'
+                              '         uuidSystem,\n'
+                              '         sName,\n'
+                              '         sDescription,\n'
+                              '         idSchedGroup,\n'
+                              '         fEnabled,\n'
+                              '         enmLomKind,\n'
+                              '         ipLom,\n'
+                              '         pctScaleTimeout,\n'
+                              '         %s,\n'              # sOs
+                              '         %s,\n'              # sOsVersion
+                              '         %s,\n'              # sCpuVendor
+                              '         %s,\n'              # sCpuArch
+                              '         %s,\n'              # sCpuName
+                              '         %s,\n'              # lCpuRevision
+                              '         %s,\n'              # cCpus
+                              '         %s,\n'              # fCpuHwVirt
+                              '         %s,\n'              # fCpuNestedPaging
+                              '         %s,\n'              # fCpu64BitGuest
+                              '         %s,\n'              # fChipsetIoMmu
+                              '         %s,\n'              # cMbMemory
+                              '         %s,\n'              # cMbScratch
+                              '         %s,\n'              # sReport
+                              '         %s,\n'              # iTestBoxScriptRev
+                              '         %s,\n'              # iPythonHexVersion
+                              '         enmPendingCmd\n'
+                              'FROM     TestBoxes\n'
+                              'WHERE    idGenTestBox = %s\n'
+                              'RETURNING idGenTestBox'
+                              , (idTestBox,
+                                 tsEffective,
+                                 sTestBoxAddr,
+                                 sOs,
+                                 sOsVersion,
+                                 sCpuVendor,
+                                 sCpuArch,
+                                 sCpuName,
+                                 lCpuRevision,
+                                 cCpus,
+                                 fCpuHwVirt,
+                                 fCpuNestedPaging,
+                                 fCpu64BitGuest,
+                                 fChipsetIoMmu,
+                                 cMbMemory,
+                                 cMbScratch,
+                                 sReport,
+                                 iTestBoxScriptRev,
+                                 iPythonHexVersion,
+                                 idGenTestBox,
+                              ));
+            idGenTestBox = self._oDb.fetchOne()[0];
+            self._oDb.commit();
+        except:
+            self._oDb.rollback();
+            raise;
+
+        return idGenTestBox;
+
+    def setCommand(self, idTestBox, sOldCommand, sNewCommand, uidAuthor = None, fCommit = False):
+        """
+        Sets or resets the pending command on a testbox.
+        Returns (idGenTestBox, tsEffective) of the new row.
+        """
+        try:
+            # Would be easier to do this using an insert or update hook, I think. Much easier.
+            self._oDb.execute('UPDATE ONLY TestBoxes\n'
+                              'SET      tsExpire = CURRENT_TIMESTAMP\n'
+                              'WHERE    idTestBox = %s\n'
+                              '     AND tsExpire = \'infinity\'::timestamp\n'
+                              '     AND enmPendingCmd = %s\n'
+                              'RETURNING tsExpire\n',
+                              (idTestBox, sOldCommand,));
+            tsEffective = self._oDb.fetchOne()[0];
+
+            self._oDb.execute('INSERT INTO TestBoxes (\n'
+                              '         idGenTestBox,\n'
+                              '         idTestBox,\n'
+                              '         tsEffective,\n'
+                              '         uidAuthor,\n'
+                              '         ip,\n'
+                              '         uuidSystem,\n'
+                              '         sName,\n'
+                              '         sDescription,\n'
+                              '         idSchedGroup,\n'
+                              '         fEnabled,\n'
+                              '         enmLomKind,\n'
+                              '         ipLom,\n'
+                              '         pctScaleTimeout,\n'
+                              '         sOs,\n'
+                              '         sOsVersion,\n'
+                              '         sCpuVendor,\n'
+                              '         sCpuArch,\n'
+                              '         sCpuName,\n'
+                              '         lCpuRevision,\n'
+                              '         cCpus,\n'
+                              '         fCpuHwVirt,\n'
+                              '         fCpuNestedPaging,\n'
+                              '         fCpu64BitGuest,\n'
+                              '         fChipsetIoMmu,\n'
+                              '         cMbMemory,\n'
+                              '         cMbScratch,\n'
+                              '         sReport,\n'
+                              '         iTestBoxScriptRev,\n'
+                              '         iPythonHexVersion,\n'
+                              '         enmPendingCmd\n'
+                              '         )\n'
+                              'SELECT   NEXTVAL(\'TestBoxGenIdSeq\'),\n'
+                              '         %s,\n'      # idTestBox
+                              '         %s,\n'      # tsEffective
+                              '         %s,\n'      # uidAuthor
+                              '         ip,\n'
+                              '         uuidSystem,\n'
+                              '         sName,\n'
+                              '         sDescription,\n'
+                              '         idSchedGroup,\n'
+                              '         fEnabled,\n'
+                              '         enmLomKind,\n'
+                              '         ipLom,\n'
+                              '         pctScaleTimeout,\n'
+                              '         sOs,\n'
+                              '         sOsVersion,\n'
+                              '         sCpuVendor,\n'
+                              '         sCpuArch,\n'
+                              '         sCpuName,\n'
+                              '         lCpuRevision,\n'
+                              '         cCpus,\n'
+                              '         fCpuHwVirt,\n'
+                              '         fCpuNestedPaging,\n'
+                              '         fCpu64BitGuest,\n'
+                              '         fChipsetIoMmu,\n'
+                              '         cMbMemory,\n'
+                              '         cMbScratch,\n'
+                              '         sReport,\n'
+                              '         iTestBoxScriptRev,\n'
+                              '         iPythonHexVersion,\n'
+                              '         %s\n'       # enmPendingCmd
+                              'FROM     TestBoxes\n'
+                              'WHERE    idTestBox = %s\n'
+                              '     AND tsExpire  = %s\n'
+                              '     AND enmPendingCmd = %s\n'
+                              'RETURNING idGenTestBox'
+                              , (idTestBox,
+                                 tsEffective,
+                                 uidAuthor,
+                                 sNewCommand,
+                                 idTestBox,
+                                 tsEffective,
+                                 sOldCommand,
+                              ));
+            idGenTestBox = self._oDb.fetchOne()[0];
+            if fCommit is True:
+                self._oDb.commit();
+        except:
+            self._oDb.rollback();
+            raise;
+
+        return (idGenTestBox, tsEffective);
+
+
+
+    def getAll(self):
+        """
+        Retrieve list of all registered Test Box records from DB.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     TestBoxes\n'
+                          'WHERE    tsExpire=\'infinity\'::timestamp;')
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(TestBoxData().initFromDbRow(aoRow))
+        return aoRet
+
+    def _historize(self, idTestBox, uidAuthor, tsExpire = None):
+        """ Historizes the current entry. """
+        if tsExpire is None:
+            self._oDb.execute('UPDATE TestBoxes\n'
+                              'SET    tsExpire   = CURRENT_TIMESTAMP,\n'
+                              '       uidAuthor  = %s\n'
+                              'WHERE  idTestBox  = %s\n'
+                              '   AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                              , (uidAuthor, idTestBox,));
+        else:
+            self._oDb.execute('UPDATE TestBoxes\n'
+                              'SET    tsExpire   = %s,\n'
+                              '       uidAuthor  = %s\n'
+                              'WHERE  idTestBox  = %s\n'
+                              '   AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                              , (uidAuthor, tsExpire, idTestBox,));
+        return True;
+
+
+    def removeEntry(self, uidAuthor, idTestBox, fCascade = False, fCommit=False):
+        """
+        Delete user account
+        """
+        _ = fCascade;
+
+        fRc = self._historize(idTestBox, uidAuthor, None);
+        if fRc:
+            self._oDb.maybeCommit(fCommit);
+
+        return fRc
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class TestBoxDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestBoxData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testboxcontroller.py b/src/VBox/ValidationKit/testmanager/core/testboxcontroller.py
new file mode 100644
index 0000000..ef480d7
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testboxcontroller.py
@@ -0,0 +1,955 @@
+# -*- coding: utf-8 -*-
+# $Id: testboxcontroller.py $
+
+"""
+Test Manager Core - Web Server Abstraction Base Class.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import re;
+import os;
+import string;                          # pylint: disable=W0402
+import sys;
+import uuid;
+
+# Validation Kit imports.
+from common                             import constants;
+from testmanager                        import config;
+from testmanager.core                   import coreconsts;
+from testmanager.core.db                import TMDatabaseConnection;
+from testmanager.core.base              import TMExceptionBase;
+from testmanager.core.globalresource    import GlobalResourceLogic;
+from testmanager.core.testboxstatus     import TestBoxStatusData, TestBoxStatusLogic;
+from testmanager.core.testbox           import TestBoxData, TestBoxLogic;
+from testmanager.core.testresults       import TestResultLogic;
+from testmanager.core.testset           import TestSetData, TestSetLogic;
+from testmanager.core.systemlog         import SystemLogData, SystemLogLogic;
+from testmanager.core.schedulerbase     import SchedulerBase;
+
+# Python 3 hacks:
+if sys.version_info[0] >= 3:
+    long = int;     # pylint: disable=W0622,C0103
+
+
+class TestBoxControllerException(TMExceptionBase):
+    """
+    Exception class for TestBoxController.
+    """
+    pass;
+
+
+class TestBoxController(object): # pylint: disable=R0903
+    """
+    TestBox Controller class.
+    """
+
+    ## Applicable testbox commands to an idle TestBox.
+    kasIdleCmds = [TestBoxData.ksTestBoxCmd_Reboot,
+                   TestBoxData.ksTestBoxCmd_Upgrade,
+                   TestBoxData.ksTestBoxCmd_UpgradeAndReboot,
+                   TestBoxData.ksTestBoxCmd_Special];
+    ## Applicable testbox commands to a busy TestBox.
+    kasBusyCmds = [TestBoxData.ksTestBoxCmd_Abort, TestBoxData.ksTestBoxCmd_Reboot];
+    ## Commands that can be ACK'ed.
+    kasAckableCmds  = [constants.tbresp.CMD_EXEC, constants.tbresp.CMD_ABORT, constants.tbresp.CMD_REBOOT,
+                       constants.tbresp.CMD_UPGRADE, constants.tbresp.CMD_UPGRADE_AND_REBOOT, constants.tbresp.CMD_SPECIAL];
+    ## Commands that can be NACK'ed or NOTSUP'ed.
+    kasNackableCmds = kasAckableCmds + [kasAckableCmds, constants.tbresp.CMD_IDLE, constants.tbresp.CMD_WAIT];
+
+    ## Mapping from TestBoxCmd_T to TestBoxState_T
+    kdCmdToState = \
+    { \
+        TestBoxData.ksTestBoxCmd_Abort:             None,
+        TestBoxData.ksTestBoxCmd_Reboot:            TestBoxStatusData.ksTestBoxState_Rebooting,
+        TestBoxData.ksTestBoxCmd_Upgrade:           TestBoxStatusData.ksTestBoxState_Upgrading,
+        TestBoxData.ksTestBoxCmd_UpgradeAndReboot:  TestBoxStatusData.ksTestBoxState_UpgradingAndRebooting,
+        TestBoxData.ksTestBoxCmd_Special:           TestBoxStatusData.ksTestBoxState_DoingSpecialCmd,
+    };
+
+    ## Mapping from TestBoxCmd_T to TestBox responses commands.
+    kdCmdToTbRespCmd = \
+    {
+        TestBoxData.ksTestBoxCmd_Abort:             constants.tbresp.CMD_ABORT,
+        TestBoxData.ksTestBoxCmd_Reboot:            constants.tbresp.CMD_REBOOT,
+        TestBoxData.ksTestBoxCmd_Upgrade:           constants.tbresp.CMD_UPGRADE,
+        TestBoxData.ksTestBoxCmd_UpgradeAndReboot:  constants.tbresp.CMD_UPGRADE_AND_REBOOT,
+        TestBoxData.ksTestBoxCmd_Special:           constants.tbresp.CMD_SPECIAL,
+    };
+
+    ## Mapping from TestBox responses to TestBoxCmd_T commands.
+    kdTbRespCmdToCmd = \
+    {
+        constants.tbresp.CMD_IDLE:               None,
+        constants.tbresp.CMD_WAIT:               None,
+        constants.tbresp.CMD_EXEC:               None,
+        constants.tbresp.CMD_ABORT:              TestBoxData.ksTestBoxCmd_Abort,
+        constants.tbresp.CMD_REBOOT:             TestBoxData.ksTestBoxCmd_Reboot,
+        constants.tbresp.CMD_UPGRADE:            TestBoxData.ksTestBoxCmd_Upgrade,
+        constants.tbresp.CMD_UPGRADE_AND_REBOOT: TestBoxData.ksTestBoxCmd_UpgradeAndReboot,
+        constants.tbresp.CMD_SPECIAL:            TestBoxData.ksTestBoxCmd_Special,
+    };
+
+
+    ## The path to the upgrade zip, relative WebServerGlueBase.getBaseUrl().
+    ksUpgradeZip = 'htdocs/upgrade/VBoxTestBoxScript.zip';
+
+    ## Valid TestBox result values.
+    kasValidResults = list(constants.result.g_kasValidResults);
+    ## Mapping TestBox result values to TestStatus_T values.
+    kadTbResultToStatus = \
+    {
+        constants.result.PASSED:        TestSetData.ksTestStatus_Success,
+        constants.result.SKIPPED:       TestSetData.ksTestStatus_Skipped,
+        constants.result.ABORTED:       TestSetData.ksTestStatus_Aborted,
+        constants.result.BAD_TESTBOX:   TestSetData.ksTestStatus_BadTestBox,
+        constants.result.FAILED:        TestSetData.ksTestStatus_Failure,
+        constants.result.TIMED_OUT:     TestSetData.ksTestStatus_TimedOut,
+        constants.result.REBOOTED:      TestSetData.ksTestStatus_Rebooted,
+    };
+
+
+    def __init__(self, oSrvGlue):
+        """
+        Won't raise exceptions.
+        """
+        self._oSrvGlue          = oSrvGlue;
+        self._sAction           = None; # _getStandardParams / dispatchRequest sets this later on.
+        self._idTestBox         = None; # _getStandardParams / dispatchRequest sets this later on.
+        self._sTestBoxUuid      = None; # _getStandardParams / dispatchRequest sets this later on.
+        self._sTestBoxAddr      = None; # _getStandardParams / dispatchRequest sets this later on.
+        self._idTestSet         = None; # _getStandardParams / dispatchRequest sets this later on.
+        self._dParams           = None; # _getStandardParams / dispatchRequest sets this later on.
+        self._asCheckedParams   = [];
+        self._dActions          = \
+        { \
+            constants.tbreq.SIGNON              : self._actionSignOn,
+            constants.tbreq.REQUEST_COMMAND_BUSY: self._actionRequestCommandBusy,
+            constants.tbreq.REQUEST_COMMAND_IDLE: self._actionRequestCommandIdle,
+            constants.tbreq.COMMAND_ACK         : self._actionCommandAck,
+            constants.tbreq.COMMAND_NACK        : self._actionCommandNack,
+            constants.tbreq.COMMAND_NOTSUP      : self._actionCommandNotSup,
+            constants.tbreq.LOG_MAIN            : self._actionLogMain,
+            constants.tbreq.UPLOAD              : self._actionUpload,
+            constants.tbreq.XML_RESULTS         : self._actionXmlResults,
+            constants.tbreq.EXEC_COMPLETED      : self._actionExecCompleted,
+        };
+
+    def _getStringParam(self, sName, asValidValues = None, fStrip = False, sDefValue = None):
+        """
+        Gets a string parameter (stripped).
+
+        Raises exception if not found and no default is provided, or if the
+        value isn't found in asValidValues.
+        """
+        if sName not in self._dParams:
+            if sDefValue is None:
+                raise TestBoxControllerException('%s parameter %s is missing' % (self._sAction, sName));
+            return sDefValue;
+        sValue = self._dParams[sName];
+        if fStrip:
+            sValue = sValue.strip();
+
+        if sName not in self._asCheckedParams:
+            self._asCheckedParams.append(sName);
+
+        if asValidValues is not None and sValue not in asValidValues:
+            raise TestBoxControllerException('%s parameter %s value "%s" not in %s ' \
+                                             % (self._sAction, sName, sValue, asValidValues));
+        return sValue;
+
+    def _getBoolParam(self, sName, fDefValue = None):
+        """
+        Gets a boolean parameter.
+
+        Raises exception if not found and no default is provided, or if not a
+        valid boolean.
+        """
+        sValue = self._getStringParam(sName, [ 'True', 'true', '1', 'False', 'false', '0'], sDefValue = str(fDefValue));
+        return sValue == 'True' or sValue == 'true' or sValue == '1';
+
+    def _getIntParam(self, sName, iMin = None, iMax = None):
+        """
+        Gets a string parameter.
+        Raises exception if not found, not a valid integer, or if the value
+        isn't in the range defined by iMin and iMax.
+        """
+        sValue = self._getStringParam(sName);
+        try:
+            iValue = int(sValue, 0);
+        except:
+            raise TestBoxControllerException('%s parameter %s value "%s" cannot be convert to an integer' \
+                                             % (self._sAction, sName, sValue));
+
+        if   (iMin is not None and iValue < iMin) \
+          or (iMax is not None and iValue > iMax):
+            raise TestBoxControllerException('%s parameter %s value %d is out of range [%s..%s]' \
+                                             % (self._sAction, sName, iValue, iMin, iMax));
+        return iValue;
+
+    def _getLongParam(self, sName, lMin = None, lMax = None, lDefValue = None):
+        """
+        Gets a string parameter.
+        Raises exception if not found, not a valid long integer, or if the value
+        isn't in the range defined by lMin and lMax.
+        """
+        sValue = self._getStringParam(sName, sDefValue = (str(lDefValue) if lDefValue is not None else None));
+        try:
+            lValue = long(sValue, 0);
+        except Exception as oXcpt:
+            raise TestBoxControllerException('%s parameter %s value "%s" cannot be convert to an integer (%s)' \
+                                             % (self._sAction, sName, sValue, oXcpt));
+
+        if   (lMin is not None and lValue < lMin) \
+          or (lMax is not None and lValue > lMax):
+            raise TestBoxControllerException('%s parameter %s value %d is out of range [%s..%s]' \
+                                             % (self._sAction, sName, lValue, lMin, lMax));
+        return lValue;
+
+    def _checkForUnknownParameters(self):
+        """
+        Check if we've handled all parameters, raises exception if anything
+        unknown was found.
+        """
+
+        if len(self._asCheckedParams) != len(self._dParams):
+            sUnknownParams = '';
+            for sKey in self._dParams:
+                if sKey not in self._asCheckedParams:
+                    sUnknownParams += ' ' + sKey + '=' + self._dParams[sKey];
+            raise TestBoxControllerException('Unknown parameters: ' + sUnknownParams);
+
+        return True;
+
+    def _writeResponse(self, dParams):
+        """
+        Makes a reply to the testbox script.
+        Will raise exception on failure.
+        """
+        self._oSrvGlue.writeParams(dParams);
+        self._oSrvGlue.flush();
+        return True;
+
+    def _resultResponse(self, sResultValue):
+        """
+        Makes a simple reply to the testbox script.
+        Will raise exception on failure.
+        """
+        return self._writeResponse({constants.tbresp.ALL_PARAM_RESULT: sResultValue});
+
+
+    def _idleResponse(self):
+        """
+        Makes an IDLE reply to the testbox script.
+        Will raise exception on failure.
+        """
+        return self._writeResponse({ constants.tbresp.ALL_PARAM_RESULT: constants.tbresp.CMD_IDLE });
+
+    def _cleanupOldTest(self, oDb, oStatusData):
+        """
+        Cleans up any old test set that may be left behind and changes the
+        state to 'idle'.  See scenario #9:
+        file://../../docs/AutomaticTestingRevamp.html#cleaning-up-abandond-testcase
+
+        Note. oStatusData.enmState is set to idle, but tsUpdated is not changed.
+        """
+
+        # Cleanup any abandond test.
+        if oStatusData.idTestSet is not None:
+            SystemLogLogic(oDb).addEntry(SystemLogData.ksEvent_TestSetAbandond,
+                                         "idTestSet=%u idTestBox=%u enmState=%s %s"
+                                         % (oStatusData.idTestSet, oStatusData.idTestBox,
+                                            oStatusData.enmState, self._sAction),
+                                         fCommit = False);
+            TestSetLogic(oDb).completeAsAbandond(oStatusData.idTestSet, fCommit = False);
+            GlobalResourceLogic(oDb).freeGlobalResourcesByTestBox(self._idTestBox, fCommit = False);
+
+        # Change to idle status
+        if oStatusData.enmState != TestBoxStatusData.ksTestBoxState_Idle:
+            TestBoxStatusLogic(oDb).updateState(self._idTestBox, TestBoxStatusData.ksTestBoxState_Idle, fCommit = False);
+            oStatusData.tsUpdated = oDb.getCurrentTimestamp();
+            oStatusData.enmState  = TestBoxStatusData.ksTestBoxState_Idle;
+
+        # Commit.
+        oDb.commit();
+
+        return True;
+
+    def _connectToDbAndValidateTb(self, asValidStates = None):
+        """
+        Connects to the database and validates the testbox.
+
+        Returns (TMDatabaseConnection, TestBoxStatusData, TestBoxData) on success.
+        Returns (None, None, None) on failure after sending the box an appropriate response.
+        May raise exception on DB error.
+        """
+        oDb    = TMDatabaseConnection(self._oSrvGlue.dprint);
+        oLogic = TestBoxStatusLogic(oDb);
+        (oStatusData, oTestBoxData) = oLogic.tryFetchStatusAndConfig(self._idTestBox, self._sTestBoxUuid, self._sTestBoxAddr);
+        if oStatusData is None:
+            self._resultResponse(constants.tbresp.STATUS_DEAD);
+        elif asValidStates is not None and oStatusData.enmState not in asValidStates:
+            self._resultResponse(constants.tbresp.STATUS_NACK);
+        elif self._idTestSet is not None and self._idTestSet != oStatusData.idTestSet:
+            self._resultResponse(constants.tbresp.STATUS_NACK);
+        else:
+            return (oDb, oStatusData, oTestBoxData);
+        return (None, None, None);
+
+    def writeToMainLog(self, oTestSet, sText, fIgnoreSizeCheck = False):
+        """ Writes the text to the main log file. """
+
+        # Calc the file name and open the file.
+        sFile = os.path.join(config.g_ksFileAreaRootDir, oTestSet.sBaseFilename + '-main.log');
+        if not os.path.exists(os.path.dirname(sFile)):
+            os.makedirs(os.path.dirname(sFile), 0o755);
+        oFile = open(sFile, 'ab');
+
+        # Check the size.
+        fSizeOk = True;
+        if not fIgnoreSizeCheck:
+            oStat = os.fstat(oFile.fileno());
+            fSizeOk = oStat.st_size / (1024 * 1024) < config.g_kcMbMaxMainLog;
+
+        # Write the text.
+        if fSizeOk:
+            if sys.version_info[0] >= 3:
+                oFile.write(bytes(sText, 'utf-8'));
+            else:
+                oFile.write(sText);
+
+        # Done
+        oFile.close();
+        return fSizeOk;
+
+    def _actionSignOn(self):        # pylint: disable=R0914
+        """ Implement sign-on """
+
+        #
+        # Validate parameters (raises exception on failure).
+        #
+        sOs                 = self._getStringParam(constants.tbreq.SIGNON_PARAM_OS, coreconsts.g_kasOses);
+        sOsVersion          = self._getStringParam(constants.tbreq.SIGNON_PARAM_OS_VERSION);
+        sCpuVendor          = self._getStringParam(constants.tbreq.SIGNON_PARAM_CPU_VENDOR);
+        sCpuArch            = self._getStringParam(constants.tbreq.SIGNON_PARAM_CPU_ARCH, coreconsts.g_kasCpuArches);
+        sCpuName            = self._getStringParam(constants.tbreq.SIGNON_PARAM_CPU_NAME, fStrip = True, sDefValue = ''); # new
+        lCpuRevision        = self._getLongParam(  constants.tbreq.SIGNON_PARAM_CPU_REVISION, lMin = 0, lDefValue = 0);   # new
+        cCpus               = self._getIntParam(   constants.tbreq.SIGNON_PARAM_CPU_COUNT, 1, 16384);
+        fCpuHwVirt          = self._getBoolParam(  constants.tbreq.SIGNON_PARAM_HAS_HW_VIRT);
+        fCpuNestedPaging    = self._getBoolParam(  constants.tbreq.SIGNON_PARAM_HAS_NESTED_PAGING);
+        fCpu64BitGuest      = self._getBoolParam(  constants.tbreq.SIGNON_PARAM_HAS_64_BIT_GUEST, fDefValue = True);
+        fChipsetIoMmu       = self._getBoolParam(  constants.tbreq.SIGNON_PARAM_HAS_IOMMU);
+        cMbMemory           = self._getLongParam(  constants.tbreq.SIGNON_PARAM_MEM_SIZE,     8, 1073741823); # 8MB..1PB
+        cMbScratch          = self._getLongParam(  constants.tbreq.SIGNON_PARAM_SCRATCH_SIZE, 0, 1073741823); # 0..1PB
+        sReport             = self._getStringParam(constants.tbreq.SIGNON_PARAM_REPORT, fStrip = True, sDefValue = '');   # new
+        iTestBoxScriptRev   = self._getIntParam(   constants.tbreq.SIGNON_PARAM_SCRIPT_REV, 1, 100000000);
+        iPythonHexVersion   = self._getIntParam(   constants.tbreq.SIGNON_PARAM_PYTHON_VERSION, 0x020300f0, 0x030f00f0);
+        self._checkForUnknownParameters();
+
+        # Null conversions for new parameters.
+        if len(sReport) == 0:
+            sReport = None;
+        if len(sCpuName) == 0:
+            sCpuName = None;
+        if lCpuRevision <= 0:
+            lCpuRevision = None;
+
+        #
+        # Connect to the database and validate the testbox.
+        #
+        oDb = TMDatabaseConnection(self._oSrvGlue.dprint);
+        oTestBoxLogic = TestBoxLogic(oDb);
+        oTestBox      = oTestBoxLogic.tryFetchTestBoxByUuid(self._sTestBoxUuid);
+        if oTestBox is None:
+            oSystemLogLogic = SystemLogLogic(oDb);
+            oSystemLogLogic.addEntry(SystemLogData.ksEvent_TestBoxUnknown,
+                                     'addr=%s  uuid=%s  os=%s  %d cpus' \
+                                     % (self._sTestBoxAddr, self._sTestBoxUuid, sOs, cCpus),
+                                     24, fCommit = True);
+            return self._resultResponse(constants.tbresp.STATUS_NACK);
+
+        #
+        # Update the row in TestBoxes if something changed.
+        #
+        if   self._sTestBoxAddr != oTestBox.ip \
+          or sOs                != oTestBox.sOs \
+          or sOsVersion         != oTestBox.sOsVersion \
+          or sCpuVendor         != oTestBox.sCpuVendor \
+          or sCpuArch           != oTestBox.sCpuArch \
+          or sCpuName           != oTestBox.sCpuName \
+          or lCpuRevision       != oTestBox.lCpuRevision \
+          or cCpus              != oTestBox.cCpus \
+          or fCpuHwVirt         != oTestBox.fCpuHwVirt \
+          or fCpuNestedPaging   != oTestBox.fCpuNestedPaging \
+          or fCpu64BitGuest     != oTestBox.fCpu64BitGuest \
+          or fChipsetIoMmu      != oTestBox.fChipsetIoMmu \
+          or cMbMemory          != oTestBox.cMbMemory \
+          or cMbScratch         != oTestBox.cMbScratch \
+          or sReport            != oTestBox.sReport \
+          or iTestBoxScriptRev  != oTestBox.iTestBoxScriptRev \
+          or iPythonHexVersion  != oTestBox.iPythonHexVersion:
+            oTestBoxLogic.updateOnSignOn(oTestBox.idTestBox,
+                                         oTestBox.idGenTestBox,
+                                         sTestBoxAddr      = self._sTestBoxAddr,
+                                         sOs               = sOs,
+                                         sOsVersion        = sOsVersion,
+                                         sCpuVendor        = sCpuVendor,
+                                         sCpuArch          = sCpuArch,
+                                         sCpuName          = sCpuName,
+                                         lCpuRevision      = lCpuRevision,
+                                         cCpus             = cCpus,
+                                         fCpuHwVirt        = fCpuHwVirt,
+                                         fCpuNestedPaging  = fCpuNestedPaging,
+                                         fCpu64BitGuest    = fCpu64BitGuest,
+                                         fChipsetIoMmu     = fChipsetIoMmu,
+                                         cMbMemory         = cMbMemory,
+                                         cMbScratch        = cMbScratch,
+                                         sReport           = sReport,
+                                         iTestBoxScriptRev = iTestBoxScriptRev,
+                                         iPythonHexVersion = iPythonHexVersion);
+
+        #
+        # Update the testbox status, making sure there is a status.
+        #
+        oStatusLogic = TestBoxStatusLogic(oDb);
+        oStatusData  = oStatusLogic.tryFetchStatus(oTestBox.idTestBox);
+        if oStatusData is not None:
+            self._cleanupOldTest(oDb, oStatusData);
+        else:
+            oStatusLogic.insertIdleStatus(oTestBox.idTestBox, oTestBox.idGenTestBox, fCommit = True);
+
+        #
+        # ACK the request.
+        #
+        dResponse = \
+        {
+            constants.tbresp.ALL_PARAM_RESULT:  constants.tbresp.STATUS_ACK,
+            constants.tbresp.SIGNON_PARAM_ID:   oTestBox.idTestBox,
+            constants.tbresp.SIGNON_PARAM_NAME: oTestBox.sName,
+        }
+        return self._writeResponse(dResponse);
+
+    def _doGangCleanup(self, oDb, oStatusData):
+        """
+        _doRequestCommand worker for handling a box in gang-cleanup.
+        This will check if all testboxes has completed their run, pretending to
+        be busy until that happens.  Once all are completed, resources will be
+        freed and the testbox returns to idle state (we update oStatusData).
+        """
+        oStatusLogic = TestBoxStatusLogic(oDb)
+        oTestSet = TestSetData().initFromDbWithId(oDb, oStatusData.idTestSet);
+        if oStatusLogic.isWholeGangDoneTesting(oTestSet.idTestSetGangLeader):
+            oDb.begin();
+
+            GlobalResourceLogic(oDb).freeGlobalResourcesByTestBox(self._idTestBox, fCommit = False);
+            TestBoxStatusLogic(oDb).updateState(self._idTestBox, TestBoxStatusData.ksTestBoxState_Idle, fCommit = False);
+
+            oStatusData.tsUpdated = oDb.getCurrentTimestamp();
+            oStatusData.enmState = TestBoxStatusData.ksTestBoxState_Idle;
+
+            oDb.commit();
+        return None;
+
+    def _doGangGatheringTimedOut(self, oDb, oStatusData):
+        """
+        _doRequestCommand worker for handling a box in gang-gathering-timed-out state.
+        This will do clean-ups similar to _cleanupOldTest and update the state likewise.
+        """
+        oDb.begin();
+
+        TestSetLogic(oDb).completeAsGangGatheringTimeout(oStatusData.idTestSet, fCommit = False);
+        GlobalResourceLogic(oDb).freeGlobalResourcesByTestBox(self._idTestBox, fCommit = False);
+        TestBoxStatusLogic(oDb).updateState(self._idTestBox, TestBoxStatusData.ksTestBoxState_Idle, fCommit = False);
+
+        oStatusData.tsUpdated = oDb.getCurrentTimestamp();
+        oStatusData.enmState  = TestBoxStatusData.ksTestBoxState_Idle;
+
+        oDb.commit();
+        return None;
+
+    def _doGangGathering(self, oDb, oStatusData):
+        """
+        _doRequestCommand worker for handling a box in gang-gathering state.
+        This only checks for timeout.  It will update the oStatusData if a
+        timeout is detected, so that the box will be idle upon return.
+        """
+        oStatusLogic = TestBoxStatusLogic(oDb);
+        if     oStatusLogic.timeSinceLastChangeInSecs(oStatusData) > config.g_kcSecGangGathering \
+           and SchedulerBase.tryCancelGangGathering(oDb, oStatusData): # <-- Updates oStatusData.
+            self._doGangGatheringTimedOut(oDb, oStatusData);
+        return None;
+
+    def _doRequestCommand(self, fIdle):
+        """
+        Common code for handling command request.
+        """
+
+        (oDb, oStatusData, oTestBoxData) = self._connectToDbAndValidateTb();
+        if oDb is None:
+            return False;
+
+        #
+        # Status clean up.
+        #
+        # Only when BUSY will the TestBox Script request and execute commands
+        # concurrently.  So, it must be idle when sending REQUEST_COMMAND_IDLE.
+        #
+        if fIdle:
+            if oStatusData.enmState == TestBoxStatusData.ksTestBoxState_GangGathering:
+                self._doGangGathering(oDb, oStatusData);
+            elif oStatusData.enmState == TestBoxStatusData.ksTestBoxState_GangGatheringTimedOut:
+                self._doGangGatheringTimedOut(oDb, oStatusData);
+            elif oStatusData.enmState == TestBoxStatusData.ksTestBoxState_GangTesting:
+                dResponse = SchedulerBase.composeExecResponse(oDb, oTestBoxData.idTestBox, self._oSrvGlue.getBaseUrl());
+                if dResponse is not None:
+                    return dResponse;
+            elif oStatusData.enmState == TestBoxStatusData.ksTestBoxState_GangCleanup:
+                self._doGangCleanup(oDb, oStatusData);
+            elif oStatusData.enmState != TestBoxStatusData.ksTestBoxState_Idle: # (includes ksTestBoxState_GangGatheringTimedOut)
+                self._cleanupOldTest(oDb, oStatusData);
+
+        #
+        # Check for pending command.
+        #
+        if oTestBoxData.enmPendingCmd != TestBoxData.ksTestBoxCmd_None:
+            asValidCmds = TestBoxController.kasIdleCmds if fIdle else TestBoxController.kasBusyCmds;
+            if oTestBoxData.enmPendingCmd in asValidCmds:
+                dResponse = { constants.tbresp.ALL_PARAM_RESULT: TestBoxController.kdCmdToTbRespCmd[oTestBoxData.enmPendingCmd] };
+                if oTestBoxData.enmPendingCmd in [TestBoxData.ksTestBoxCmd_Upgrade, TestBoxData.ksTestBoxCmd_UpgradeAndReboot]:
+                    dResponse[constants.tbresp.UPGRADE_PARAM_URL] = self._oSrvGlue.getBaseUrl() + TestBoxController.ksUpgradeZip;
+                return self._writeResponse(dResponse);
+
+            if oTestBoxData.enmPendingCmd == TestBoxData.ksTestBoxCmd_Abort and fIdle:
+                TestBoxLogic(oDb).setCommand(self._idTestBox, sOldCommand = oTestBoxData.enmPendingCmd,
+                                             sNewCommand = TestBoxData.ksTestBoxCmd_None, fCommit = True);
+
+        #
+        # If doing gang stuff, return 'CMD_WAIT'.
+        #
+        ## @todo r=bird: Why is GangTesting included here? Figure out when testing gang testing.
+        if oStatusData.enmState in [TestBoxStatusData.ksTestBoxState_GangGathering,
+                                    TestBoxStatusData.ksTestBoxState_GangTesting,
+                                    TestBoxStatusData.ksTestBoxState_GangCleanup]:
+            return self._resultResponse(constants.tbresp.CMD_WAIT);
+
+        #
+        # If idling and enabled try schedule a new task.
+        #
+        if fIdle \
+          and oTestBoxData.fEnabled \
+          and oStatusData.enmState == TestBoxStatusData.ksTestBoxState_Idle: # (paranoia)
+            dResponse = SchedulerBase.scheduleNewTask(oDb, oTestBoxData, self._oSrvGlue.getBaseUrl());
+            if dResponse is not None:
+                return self._writeResponse(dResponse);
+
+        #
+        # Touch the status row every couple of mins so we can tell that the box is alive.
+        #
+        oStatusLogic = TestBoxStatusLogic(oDb);
+        if    oStatusData.enmState != TestBoxStatusData.ksTestBoxState_GangGathering \
+          and oStatusLogic.timeSinceLastChangeInSecs(oStatusData) >= TestBoxStatusLogic.kcSecIdleTouchStatus:
+            oStatusLogic.touchStatus(oTestBoxData.idTestBox, fCommit = True);
+
+        return self._idleResponse();
+
+    def _actionRequestCommandBusy(self):
+        """ Implement request for command. """
+        self._checkForUnknownParameters();
+        return self._doRequestCommand(False);
+
+    def _actionRequestCommandIdle(self):
+        """ Implement request for command. """
+        self._checkForUnknownParameters();
+        return self._doRequestCommand(True);
+
+    def _doCommandAckNck(self, sCmd):
+        """ Implements ACK, NACK and NACK(ENOTSUP). """
+
+        (oDb, _, _) = self._connectToDbAndValidateTb();
+        if oDb is None:
+            return False;
+
+        #
+        # If the command maps to a TestBoxCmd_T value, it means we have to
+        # check and update TestBoxes.  If it's an ACK, the testbox status will
+        # need updating as well.
+        #
+        sPendingCmd = TestBoxController.kdTbRespCmdToCmd[sCmd];
+        if sPendingCmd is not None:
+            oTestBoxLogic = TestBoxLogic(oDb)
+            oTestBoxLogic.setCommand(self._idTestBox, sOldCommand = sPendingCmd,
+                                     sNewCommand = TestBoxData.ksTestBoxCmd_None, fCommit = False);
+
+            if    self._sAction == constants.tbreq.COMMAND_ACK \
+              and TestBoxController.kdCmdToState[sPendingCmd] is not None:
+                oStatusLogic = TestBoxStatusLogic(oDb);
+                oStatusLogic.updateState(self._idTestBox, TestBoxController.kdCmdToState[sPendingCmd], fCommit = False);
+
+            # Commit the two updates.
+            oDb.commit();
+
+        #
+        # Log NACKs.
+        #
+        if self._sAction != constants.tbreq.COMMAND_ACK:
+            oSysLogLogic = SystemLogLogic(oDb);
+            oSysLogLogic.addEntry(SystemLogData.ksEvent_CmdNacked,
+                                  'idTestBox=%s sCmd=%s' % (self._idTestBox, sPendingCmd),
+                                  24, fCommit = True);
+
+        return self._resultResponse(constants.tbresp.STATUS_ACK);
+
+    def _actionCommandAck(self):
+        """ Implement command ACK'ing """
+        sCmd = self._getStringParam(constants.tbreq.COMMAND_ACK_PARAM_CMD_NAME, TestBoxController.kasAckableCmds);
+        self._checkForUnknownParameters();
+        return self._doCommandAckNck(sCmd);
+
+    def _actionCommandNack(self):
+        """ Implement command NACK'ing """
+        sCmd = self._getStringParam(constants.tbreq.COMMAND_ACK_PARAM_CMD_NAME, TestBoxController.kasNackableCmds);
+        self._checkForUnknownParameters();
+        return self._doCommandAckNck(sCmd);
+
+    def _actionCommandNotSup(self):
+        """ Implement command NACK(ENOTSUP)'ing """
+        sCmd = self._getStringParam(constants.tbreq.COMMAND_ACK_PARAM_CMD_NAME, TestBoxController.kasNackableCmds);
+        self._checkForUnknownParameters();
+        return self._doCommandAckNck(sCmd);
+
+    def _actionLogMain(self):
+        """ Implement submitting log entries to the main log file. """
+        #
+        # Parameter validation.
+        #
+        sBody = self._getStringParam(constants.tbreq.LOG_PARAM_BODY, fStrip = False);
+        if len(sBody) == 0:
+            return self._resultResponse(constants.tbresp.STATUS_NACK);
+        self._checkForUnknownParameters();
+
+        (oDb, oStatusData, _) = self._connectToDbAndValidateTb([TestBoxStatusData.ksTestBoxState_Testing,
+                                                                TestBoxStatusData.ksTestBoxState_GangTesting]);
+        if oStatusData is None:
+            return False;
+
+        #
+        # Write the text to the log file.
+        #
+        oTestSet = TestSetData().initFromDbWithId(oDb, oStatusData.idTestSet);
+        self.writeToMainLog(oTestSet, sBody);
+        ## @todo Overflow is a hanging offence, need to note it and fail whatever is going on...
+
+        # Done.
+        return self._resultResponse(constants.tbresp.STATUS_ACK);
+
+    def _actionUpload(self):
+        """ Implement uploading of files. """
+        #
+        # Parameter validation.
+        #
+        sName = self._getStringParam(constants.tbreq.UPLOAD_PARAM_NAME);
+        sMime = self._getStringParam(constants.tbreq.UPLOAD_PARAM_MIME);
+        sKind = self._getStringParam(constants.tbreq.UPLOAD_PARAM_KIND);
+        sDesc = self._getStringParam(constants.tbreq.UPLOAD_PARAM_DESC);
+        self._checkForUnknownParameters();
+
+        (oDb, oStatusData, _) = self._connectToDbAndValidateTb([TestBoxStatusData.ksTestBoxState_Testing,
+                                                                TestBoxStatusData.ksTestBoxState_GangTesting]);
+        if oStatusData is None:
+            return False;
+
+        if len(sName) > 128 or len(sName) < 3:
+            raise TestBoxControllerException('Invalid file name "%s"' % (sName,));
+        if re.match(r'^[a-zA-Z0-9_\-(){}#@+,.=]*$', sName) is None:
+            raise TestBoxControllerException('Invalid file name "%s"' % (sName,));
+
+        if sMime not in [ 'text/plain', #'text/html', 'text/xml',
+                          'application/octet-stream',
+                          'image/png', #'image/gif', 'image/jpeg',
+                          #'video/webm', 'video/mpeg', 'video/mpeg4-generic',
+                          ]:
+            raise TestBoxControllerException('Invalid MIME type "%s"' % (sMime,));
+
+        if sKind not in [ 'log/release/vm',
+                          'log/debug/vm',
+                          'log/release/svc',
+                          'log/debug/svc',
+                          'log/release/client',
+                          'log/debug/client',
+                          'log/installer',
+                          'log/uninstaller',
+                          'crash/report/vm',
+                          'crash/dump/vm',
+                          'crash/report/svc',
+                          'crash/dump/svc',
+                          'crash/report/client',
+                          'crash/dump/client',
+                          'misc/other',
+                          'screenshot/failure',
+                          'screenshot/success',
+                          #'screencapture/failure',
+                          ]:
+            raise TestBoxControllerException('Invalid kind "%s"' % (sKind,));
+
+        if len(sDesc) > 256:
+            raise TestBoxControllerException('Invalid description "%s"' % (sDesc,));
+        if not set(sDesc).issubset(set(string.printable)):
+            raise TestBoxControllerException('Invalid description "%s"' % (sDesc,));
+
+        if ('application/octet-stream', {}) != self._oSrvGlue.getContentType():
+            raise TestBoxControllerException('Unexpected content type: %s; %s' % self._oSrvGlue.getContentType());
+
+        cbFile = self._oSrvGlue.getContentLength();
+        if cbFile <= 0:
+            raise TestBoxControllerException('File "%s" is empty or negative in size (%s)' % (sName, cbFile));
+        if (cbFile + 1048575) / 1048576 > config.g_kcMbMaxUploadSingle:
+            raise TestBoxControllerException('File "%s" is too big %u bytes (max %u MiB)'
+                                             % (sName, cbFile, config.g_kcMbMaxUploadSingle,));
+
+        #
+        # Write the text to the log file.
+        #
+        oTestSet = TestSetData().initFromDbWithId(oDb, oStatusData.idTestSet);
+        oDstFile = TestSetLogic(oDb).createFile(oTestSet, sName = sName, sMime = sMime, sKind = sKind, sDesc = sDesc,
+                                                cbFile = cbFile, fCommit = True);
+
+        offFile  = 0;
+        oSrcFile = self._oSrvGlue.getBodyIoStream();
+        while offFile < cbFile:
+            cbToRead = cbFile - offFile;
+            if cbToRead > 256*1024:
+                cbToRead = 256*1024;
+            offFile += cbToRead;
+
+            abBuf = oSrcFile.read(cbToRead);
+            oDstFile.write(abBuf); # pylint: disable=E1103
+            del abBuf;
+
+        oDstFile.close(); # pylint: disable=E1103
+
+        # Done.
+        return self._resultResponse(constants.tbresp.STATUS_ACK);
+
+    def _actionXmlResults(self):
+        """ Implement submitting "XML" like test result stream. """
+        #
+        # Parameter validation.
+        #
+        sXml = self._getStringParam(constants.tbreq.XML_RESULT_PARAM_BODY, fStrip = False);
+        self._checkForUnknownParameters();
+        if len(sXml) == 0: # Used for link check by vboxinstaller.py on Windows.
+            return self._resultResponse(constants.tbresp.STATUS_ACK);
+
+        (oDb, oStatusData, _) = self._connectToDbAndValidateTb([TestBoxStatusData.ksTestBoxState_Testing,
+                                                                TestBoxStatusData.ksTestBoxState_GangTesting]);
+        if oStatusData is None:
+            return False;
+
+        #
+        # Process the XML.
+        #
+        (sError, fUnforgivable) = TestResultLogic(oDb).processXmlStream(sXml, self._idTestSet);
+        if sError is not None:
+            oTestSet = TestSetData().initFromDbWithId(oDb, oStatusData.idTestSet);
+            self.writeToMainLog(oTestSet, '\n!!XML error: %s\n\n' % (sXml,));
+            if fUnforgivable:
+                return self._resultResponse(constants.tbresp.STATUS_NACK);
+        return self._resultResponse(constants.tbresp.STATUS_ACK);
+
+
+    def _actionExecCompleted(self):
+        """
+        Implement EXEC completion.
+
+        Because the action is request by the worker thread of the testbox
+        script we cannot pass pending commands back to it like originally
+        planned.  So, we just complete the test set and update the status.
+        """
+        #
+        # Parameter validation.
+        #
+        sStatus = self._getStringParam(constants.tbreq.EXEC_COMPLETED_PARAM_RESULT, TestBoxController.kasValidResults);
+        self._checkForUnknownParameters();
+
+        (oDb, oStatusData, _) = self._connectToDbAndValidateTb([TestBoxStatusData.ksTestBoxState_Testing,
+                                                                TestBoxStatusData.ksTestBoxState_GangTesting]);
+        if oStatusData is None:
+            return False;
+
+        #
+        # Complete the status.
+        #
+        oDb.rollback();
+        oDb.begin();
+        oTestSetLogic = TestSetLogic(oDb);
+        idTestSetGangLeader = oTestSetLogic.complete(oStatusData.idTestSet, self.kadTbResultToStatus[sStatus], fCommit = False);
+
+        oStatusLogic = TestBoxStatusLogic(oDb);
+        if oStatusData.enmState == TestBoxStatusData.ksTestBoxState_Testing:
+            assert idTestSetGangLeader is None;
+            GlobalResourceLogic(oDb).freeGlobalResourcesByTestBox(self._idTestBox);
+            oStatusLogic.updateState(self._idTestBox, TestBoxStatusData.ksTestBoxState_Idle, fCommit = False);
+        else:
+            assert idTestSetGangLeader is not None;
+            oStatusLogic.updateState(self._idTestBox, TestBoxStatusData.ksTestBoxState_GangCleanup, oStatusData.idTestSet,
+                                     fCommit = False);
+            if oStatusLogic.isWholeGangDoneTesting(idTestSetGangLeader):
+                GlobalResourceLogic(oDb).freeGlobalResourcesByTestBox(self._idTestBox);
+                oStatusLogic.updateState(self._idTestBox, TestBoxStatusData.ksTestBoxState_Idle, fCommit = False);
+
+        oDb.commit();
+        return self._resultResponse(constants.tbresp.STATUS_ACK);
+
+
+
+    def _getStandardParams(self, dParams):
+        """
+        Gets the standard parameters and validates them.
+
+        The parameters are returned as a tuple: sAction, idTestBox, sTestBoxUuid.
+        Note! the sTextBoxId can be None if it's a SIGNON request.
+
+        Raises TestBoxControllerException on invalid input.
+        """
+        #
+        # Get the action parameter and validate it.
+        #
+        if constants.tbreq.ALL_PARAM_ACTION not in dParams:
+            raise TestBoxControllerException('No "%s" parameter in request (params: %s)' \
+                                             % (constants.tbreq.ALL_PARAM_ACTION, dParams,));
+        sAction = dParams[constants.tbreq.ALL_PARAM_ACTION];
+
+        if sAction not in self._dActions:
+            raise TestBoxControllerException('Unknown action "%s" in request (params: %s; action: %s)' \
+                                             % (sAction, dParams, self._dActions));
+
+        #
+        # TestBox UUID.
+        #
+        if constants.tbreq.ALL_PARAM_TESTBOX_UUID not in dParams:
+            raise TestBoxControllerException('No "%s" parameter in request (params: %s)' \
+                                             % (constants.tbreq.ALL_PARAM_TESTBOX_UUID, dParams,));
+        sTestBoxUuid = dParams[constants.tbreq.ALL_PARAM_TESTBOX_UUID];
+        try:
+            sTestBoxUuid = str(uuid.UUID(sTestBoxUuid));
+        except Exception as oXcpt:
+            raise TestBoxControllerException('Invalid %s parameter value "%s": %s ' \
+                                             % (constants.tbreq.ALL_PARAM_TESTBOX_UUID, sTestBoxUuid, oXcpt));
+        if sTestBoxUuid == '00000000-0000-0000-0000-000000000000':
+            raise TestBoxControllerException('Invalid %s parameter value "%s": NULL UUID not allowed.' \
+                                             % (constants.tbreq.ALL_PARAM_TESTBOX_UUID, sTestBoxUuid));
+
+        #
+        # TestBox ID.
+        #
+        if constants.tbreq.ALL_PARAM_TESTBOX_ID in dParams:
+            sTestBoxId = dParams[constants.tbreq.ALL_PARAM_TESTBOX_ID];
+            try:
+                idTestBox = int(sTestBoxId);
+                if idTestBox <= 0 or idTestBox >= 0x7fffffff:
+                    raise Exception;
+            except:
+                raise TestBoxControllerException('Bad value for "%s": "%s"' \
+                                                 % (constants.tbreq.ALL_PARAM_TESTBOX_ID, sTestBoxId));
+        elif sAction == constants.tbreq.SIGNON:
+            idTestBox = None;
+        else:
+            raise TestBoxControllerException('No "%s" parameter in request (params: %s)' \
+                                             % (constants.tbreq.ALL_PARAM_TESTBOX_ID, dParams,));
+
+        #
+        # Test Set ID.
+        #
+        if constants.tbreq.RESULT_PARAM_TEST_SET_ID in dParams:
+            sTestSetId = dParams[constants.tbreq.RESULT_PARAM_TEST_SET_ID];
+            try:
+                idTestSet = int(sTestSetId);
+                if idTestSet <= 0 or idTestSet >= 0x7fffffff:
+                    raise Exception;
+            except:
+                raise TestBoxControllerException('Bad value for "%s": "%s"' \
+                                                 % (constants.tbreq.RESULT_PARAM_TEST_SET_ID, sTestSetId));
+        elif sAction not in [ constants.tbreq.XML_RESULTS, ]: ## More later.
+            idTestSet = None;
+        else:
+            raise TestBoxControllerException('No "%s" parameter in request (params: %s)' \
+                                             % (constants.tbreq.RESULT_PARAM_TEST_SET_ID, dParams,));
+
+        #
+        # The testbox address.
+        #
+        sTestBoxAddr = self._oSrvGlue.getClientAddr();
+        if sTestBoxAddr is None or sTestBoxAddr.strip() == '':
+            raise TestBoxControllerException('Invalid client address "%s"' % (sTestBoxAddr,));
+
+        #
+        # Update the list of checked parameters.
+        #
+        self._asCheckedParams.extend([constants.tbreq.ALL_PARAM_TESTBOX_UUID, constants.tbreq.ALL_PARAM_ACTION]);
+        if idTestBox is not None:
+            self._asCheckedParams.append(constants.tbreq.ALL_PARAM_TESTBOX_ID);
+        if idTestSet is not None:
+            self._asCheckedParams.append(constants.tbreq.RESULT_PARAM_TEST_SET_ID);
+
+        return (sAction, idTestBox, sTestBoxUuid, sTestBoxAddr, idTestSet);
+
+    def dispatchRequest(self):
+        """
+        Dispatches the incoming request.
+
+        Will raise TestBoxControllerException on failure.
+        """
+
+        #
+        # Must be a POST request.
+        #
+        try:
+            sMethod = self._oSrvGlue.getMethod();
+        except Exception as oXcpt:
+            raise TestBoxControllerException('Error retriving request method: %s' % (oXcpt,));
+        if sMethod != 'POST':
+            raise TestBoxControllerException('Error expected POST request not "%s"' % (sMethod,));
+
+        #
+        # Get the parameters and checks for duplicates.
+        #
+        try:
+            dParams = self._oSrvGlue.getParameters();
+        except Exception as oXcpt:
+            raise TestBoxControllerException('Error retriving parameters: %s' % (oXcpt,));
+        for sKey in dParams.keys():
+            if len(dParams[sKey]) > 1:
+                raise TestBoxControllerException('Parameter "%s" is given multiple times: %s' % (sKey, dParams[sKey]));
+            dParams[sKey] = dParams[sKey][0];
+        self._dParams = dParams;
+
+        #
+        # Get+validate the standard action parameters and dispatch the request.
+        #
+        (self._sAction, self._idTestBox, self._sTestBoxUuid, self._sTestBoxAddr, self._idTestSet) = \
+            self._getStandardParams(dParams);
+        return self._dActions[self._sAction]();
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testboxstatus.py b/src/VBox/ValidationKit/testmanager/core/testboxstatus.py
new file mode 100644
index 0000000..471a10e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testboxstatus.py
@@ -0,0 +1,287 @@
+# -*- coding: utf-8 -*-
+# $Id: testboxstatus.py $
+
+"""
+Test Manager - TestBoxStatus.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from testmanager.core.base      import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+from testmanager.core.testbox   import TestBoxData;
+
+
+class TestBoxStatusData(ModelDataBase):
+    """
+    TestBoxStatus Data.
+    """
+
+    ## @name TestBoxState_T
+    # @{
+    ksTestBoxState_Idle                     = 'idle';
+    ksTestBoxState_Testing                  = 'testing';
+    ksTestBoxState_GangGathering            = 'gang-gathering';
+    ksTestBoxState_GangGatheringTimedOut    = 'gang-gathering-timedout';
+    ksTestBoxState_GangTesting              = 'gang-testing';
+    ksTestBoxState_GangCleanup              = 'gang-cleanup';
+    ksTestBoxState_Rebooting                = 'rebooting';
+    ksTestBoxState_Upgrading                = 'upgrading';
+    ksTestBoxState_UpgradingAndRebooting    = 'upgrading-and-rebooting';
+    ksTestBoxState_DoingSpecialCmd          = 'doing-special-cmd';
+    ## @}
+
+    ksParam_idTestBox           = 'TestBoxStatus_idTestBox';
+    ksParam_idGenTestBox        = 'TestBoxStatus_idGenTestBox'
+    ksParam_tsUpdated           = 'TestBoxStatus_tsUpdated';
+    ksParam_enmState            = 'TestBoxStatus_enmState';
+    ksParam_idTestSet           = 'TestBoxStatus_idTestSet';
+
+    kasAllowNullAttributes      = ['idTestSet', ];
+    kasValidValues_enmState     = \
+    [
+        ksTestBoxState_Idle,                    ksTestBoxState_Testing,     ksTestBoxState_GangGathering,
+        ksTestBoxState_GangGatheringTimedOut,   ksTestBoxState_GangTesting, ksTestBoxState_GangCleanup,
+        ksTestBoxState_Rebooting,               ksTestBoxState_Upgrading,   ksTestBoxState_UpgradingAndRebooting,
+        ksTestBoxState_DoingSpecialCmd,
+    ];
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestBox           = None;
+        self.idGenTestBox        = None;
+        self.tsUpdated           = None;
+        self.enmState            = self.ksTestBoxState_Idle;
+        self.idTestSet           = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Internal worker for initFromDbWithId and initFromDbWithGenId as well as
+        TestBoxStatusLogic.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('TestBoxStatus not found.');
+
+        self.idTestBox           = aoRow[0];
+        self.idGenTestBox        = aoRow[1];
+        self.tsUpdated           = aoRow[2];
+        self.enmState            = aoRow[3];
+        self.idTestSet           = aoRow[4];
+        return self;
+
+    def initFromDbWithId(self, oDb, idTestBox):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute('SELECT *\n'
+                    'FROM   TestBoxStatuses\n'
+                    'WHERE  idTestBox    = %s\n'
+                    , (idTestBox, ) );
+        return self.initFromDbRow(oDb.fetchOne());
+
+    def initFromDbWithGenId(self, oDb, idGenTestBox):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute('SELECT *\n'
+                    'FROM   TestBoxStatuses\n'
+                    'WHERE  idGenTestBox = %s\n'
+                    , (idGenTestBox, ) );
+        return self.initFromDbRow(oDb.fetchOne());
+
+
+class TestBoxStatusLogic(ModelLogicBase):
+    """
+    TestBoxStatus logic.
+    """
+
+    ## The number of seconds between each time to call touchStatus() when
+    # returning CMD_IDLE.
+    kcSecIdleTouchStatus = 120;
+
+
+    def __init__(self, oDb):
+        ModelLogicBase.__init__(self, oDb);
+
+
+    def tryFetchStatus(self, idTestBox):
+        """
+        Attempts to fetch the status of the given testbox.
+
+        Returns a TestBoxStatusData object on success.
+        Returns None if no status was found.
+        Raises exception on other errors.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     TestBoxStatuses\n'
+                          'WHERE    idTestBox = %s\n',
+                          (idTestBox,));
+        if self._oDb.getRowCount() == 0:
+            return None;
+        oStatus = TestBoxStatusData();
+        return oStatus.initFromDbRow(self._oDb.fetchOne());
+
+    def tryFetchStatusAndConfig(self, idTestBox, sTestBoxUuid, sTestBoxAddr):
+        """
+        Tries to fetch the testbox status and current testbox config.
+
+        Returns (TestBoxStatusData, TestBoxData) on success, (None, None) if
+        not found.  May throw an exception on database error.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     TestBoxStatuses, TestBoxes\n'
+                          'WHERE    TestBoxStatuses.idTestBox = %s\n'
+                          '     AND TestBoxes.idTestBox  = %s\n'
+                          '     AND TestBoxes.tsExpire   = \'infinity\'::timestamp\n'
+                          '     AND TestBoxes.uuidSystem = %s\n'
+                          '     AND TestBoxes.ip         = %s\n'
+                          , (idTestBox,
+                             idTestBox,
+                             sTestBoxUuid,
+                             sTestBoxAddr,
+                          ));
+        cRows = self._oDb.getRowCount();
+        if cRows != 1:
+            if cRows != 0:
+                raise TMExceptionBase('tryFetchStatusForCommandReq got %s rows for idTestBox=%s' % (cRows, idTestBox));
+            return (None, None);
+        aoRow = self._oDb.fetchOne();
+        return (TestBoxStatusData().initFromDbRow(aoRow[0:5]), TestBoxData().initFromDbRow(aoRow[5:]));
+
+
+    def insertIdleStatus(self, idTestBox, idGenTestBox, fCommit = False):
+        """
+        Inserts an idle status for the specified testbox.
+        """
+        self._oDb.execute('INSERT INTO TestBoxStatuses (\n'
+                          '         idTestBox,\n'
+                          '         idGenTestBox,\n'
+                          '         enmState,\n'
+                          '         idTestSet)\n'
+                          'VALUES ( %s,\n'
+                          '         %s,\n'
+                          '         \'idle\'::TestBoxState_T,\n'
+                          '         NULL)\n',
+                          (idTestBox, idGenTestBox) );
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def touchStatus(self, idTestBox, fCommit = False):
+        """
+        Touches the testbox status row, i.e. sets tsUpdated to the current time.
+        """
+        self._oDb.execute('UPDATE   TestBoxStatuses\n'
+                          'SET      tsUpdated = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestBox = %s\n'
+                          , (idTestBox,));
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def updateState(self, idTestBox, sNewState, idTestSet = None, fCommit = False):
+        """
+        Updates the testbox state.
+        """
+        self._oDb.execute('UPDATE   TestBoxStatuses\n'
+                          'SET      enmState = %s,\n'
+                          '         idTestSet = %s,\n'
+                          '         tsUpdated = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestBox = %s\n',
+                          (sNewState, idTestSet, idTestBox));
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def updateGangStatus(self, idTestSetGangLeader, sNewState, fCommit = False):
+        """
+        Update the state of all members of a gang.
+        """
+        self._oDb.execute('UPDATE   TestBoxStatuses\n'
+                          'SET      enmState  = %s,\n'
+                          '         tsUpdated = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestBox IN (SELECT idTestBox\n'
+                          '                       FROM   TestSets\n'
+                          '                       WHERE  idTestSetGangLeader = %s)\n'
+                          , (sNewState, idTestSetGangLeader,) );
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def isWholeGangDoneTesting(self, idTestSetGangLeader):
+        """
+        Checks if the whole gang is done testing.
+        """
+        self._oDb.execute('SELECT   COUNT(*)\n'
+                          'FROM     TestBoxStatuses, TestSets\n'
+                          'WHERE    TestBoxStatuses.idTestSet    = TestSets.idTestSet\n'
+                          '     AND TestSets.idTestSetGangLeader = %s\n'
+                          '     AND TestBoxStatuses.enmState IN (%s, %s)\n'
+                          , ( idTestSetGangLeader,
+                              TestBoxStatusData.ksTestBoxState_GangGathering,
+                              TestBoxStatusData.ksTestBoxState_GangTesting));
+        return self._oDb.fetchOne()[0] == 0;
+
+    def isTheWholeGangThere(self, idTestSetGangLeader):
+        """
+        Checks if the whole gang is done testing.
+        """
+        self._oDb.execute('SELECT   COUNT(*)\n'
+                          'FROM     TestBoxStatuses, TestSets\n'
+                          'WHERE    TestBoxStatuses.idTestSet    = TestSets.idTestSet\n'
+                          '     AND TestSets.idTestSetGangLeader = %s\n'
+                          '     AND TestBoxStatuses.enmState IN (%s, %s)\n'
+                          , ( idTestSetGangLeader,
+                              TestBoxStatusData.ksTestBoxState_GangGathering,
+                              TestBoxStatusData.ksTestBoxState_GangTesting));
+        return self._oDb.fetchOne()[0] == 0;
+
+    def timeSinceLastChangeInSecs(self, oStatusData):
+        """
+        Figures the time since the last status change.
+        """
+        tsNow = self._oDb.getCurrentTimestamp();
+        oDelta = tsNow - oStatusData.tsUpdated;
+        return oDelta.seconds + oDelta.days * 24 * 3600;
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class TestBoxStatusDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestBoxStatusData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testcase.pgsql b/src/VBox/ValidationKit/testmanager/core/testcase.pgsql
new file mode 100644
index 0000000..1d518a5
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testcase.pgsql
@@ -0,0 +1,254 @@
+-- $Id: testcase.pgsql $
+--- @file
+-- VBox Test Manager Database Stored Procedures - TestCases.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+\set ON_ERROR_STOP 1
+\connect testmanager;
+
+DROP FUNCTION IF EXISTS add_testcase(INTEGER, TEXT, TEXT, BOOLEAN, INTEGER, TEXT, TEXT);
+DROP FUNCTION IF EXISTS edit_testcase(INTEGER, INTEGER, TEXT, TEXT, BOOLEAN, INTEGER, TEXT, TEXT);
+DROP FUNCTION IF EXISTS del_testcase(INTEGER);
+DROP FUNCTION IF EXISTS TestCaseLogic_delEntry(INTEGER, INTEGER);
+
+---
+-- Checks if the test case name is unique, ignoring a_idTestCaseIgnore.
+-- Raises exception if duplicates are found.
+--
+-- @internal
+--
+CREATE OR REPLACE FUNCTION TestCaseLogic_checkUniqueName(a_sName TEXT, a_idTestCaseIgnore INTEGER)
+    RETURNS VOID AS $$
+    DECLARE
+        v_cRows INTEGER;
+    BEGIN
+        SELECT  COUNT(*) INTO v_cRows
+        FROM    TestCases
+        WHERE   sName      =  a_sName
+            AND tsExpire   =  'infinity'::TIMESTAMP
+            AND idTestCase <> a_idTestCaseIgnore;
+        IF v_cRows <> 0 THEN
+            RAISE EXCEPTION 'Duplicate test case name "%" (% times)', a_sName, v_cRows;
+        END IF;
+    END;
+$$ LANGUAGE plpgsql;
+              
+---
+-- Check that the test case exists.
+-- Raises exception if it doesn't.
+--
+-- @internal
+--
+CREATE OR REPLACE FUNCTION TestCaseLogic_checkExists(a_idTestCase INTEGER) RETURNS VOID AS $$
+    BEGIN
+        IF NOT EXISTS(  SELECT  *
+                        FROM    TestCases
+                        WHERE   idTestCase = a_idTestCase
+                            AND tsExpire   = 'infinity'::TIMESTAMP ) THEN
+            RAISE EXCEPTION 'Test case with ID % does not currently exist', a_idTestCase;
+        END IF;
+    END;
+$$ LANGUAGE plpgsql;
+
+
+---
+-- Historize a row.
+-- @internal
+--
+CREATE OR REPLACE FUNCTION TestCaseLogic_historizeEntry(a_idTestCase INTEGER, a_tsExpire TIMESTAMP WITH TIME ZONE) 
+    RETURNS VOID AS $$
+    DECLARE
+        v_cUpdatedRows INTEGER;
+    BEGIN
+        UPDATE  TestCases
+          SET   tsExpire   = a_tsExpire
+          WHERE idTestcase = a_idTestCase
+            AND tsExpire   = 'infinity'::TIMESTAMP;
+        GET DIAGNOSTICS v_cUpdatedRows = ROW_COUNT;
+        IF v_cUpdatedRows <> 1 THEN
+            IF v_cUpdatedRows = 0 THEN
+                RAISE EXCEPTION 'Test case ID % does not currently exist', a_idTestCase;
+            END IF;
+            RAISE EXCEPTION 'Integrity error in TestCases: % current rows with idTestCase=%d', v_cUpdatedRows, a_idTestCase;
+        END IF;
+    END;
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE function TestCaseLogic_addEntry(a_uidAuthor INTEGER, a_sName TEXT, a_sDescription TEXT, 
+                                                  a_fEnabled BOOL, a_cSecTimeout INTEGER,  a_sTestBoxReqExpr TEXT, 
+                                                  a_sBuildReqExpr TEXT, a_sBaseCmd TEXT, a_sTestSuiteZips TEXT) 
+    RETURNS INTEGER AS $$
+    DECLARE 
+         v_idTestCase INTEGER;
+    BEGIN
+        PERFORM TestCaseLogic_checkUniqueName(a_sName, -1);
+
+        INSERT INTO TestCases (uidAuthor, sName, sDescription, fEnabled, cSecTimeout, 
+                               sTestBoxReqExpr, sBuildReqExpr, sBaseCmd, sTestSuiteZips)
+            VALUES (a_uidAuthor, a_sName, a_sDescription, a_fEnabled, a_cSecTimeout, 
+                    a_sTestBoxReqExpr, a_sBuildReqExpr, a_sBaseCmd, a_sTestSuiteZips)
+            RETURNING idTestcase INTO v_idTestCase;
+        RETURN v_idTestCase;
+    END;
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE function TestCaseLogic_editEntry(a_uidAuthor INTEGER, a_idTestCase INTEGER, a_sName TEXT, a_sDescription TEXT, 
+                                                   a_fEnabled BOOL, a_cSecTimeout INTEGER,  a_sTestBoxReqExpr TEXT, 
+                                                   a_sBuildReqExpr TEXT, a_sBaseCmd TEXT, a_sTestSuiteZips TEXT) 
+    RETURNS INTEGER AS $$
+    DECLARE 
+         v_idGenTestCase INTEGER;
+    BEGIN
+        PERFORM TestCaseLogic_checkExists(a_idTestCase);
+        PERFORM TestCaseLogic_checkUniqueName(a_sName, a_idTestCase);
+
+        PERFORM TestCaseLogic_historizeEntry(a_idTestCase, CURRENT_TIMESTAMP);
+        INSERT INTO TestCases (idTestCase, uidAuthor, sName, sDescription, fEnabled, cSecTimeout, 
+                               sTestBoxReqExpr, sBuildReqExpr, sBaseCmd, sTestSuiteZips)
+            VALUES (a_idTestCase, a_uidAuthor, a_sName, a_sDescription, a_fEnabled, a_cSecTimeout, 
+                    a_sTestBoxReqExpr, a_sBuildReqExpr, a_sBaseCmd, a_sTestSuiteZips)
+            RETURNING idGenTestCase INTO v_idGenTestCase;
+       RETURN v_idGenTestCase;
+    END;
+$$ LANGUAGE plpgsql;
+
+
+CREATE OR REPLACE FUNCTION TestCaseLogic_delEntry(a_uidAuthor INTEGER, a_idTestCase INTEGER, a_fCascade BOOLEAN) 
+    RETURNS VOID AS $$
+    DECLARE
+        v_Row           TestCases%ROWTYPE;
+        v_tsEffective   TIMESTAMP WITH TIME ZONE;
+        v_Rec           RECORD;
+        v_sErrors       TEXT;
+    BEGIN
+        --
+        -- Check preconditions.
+        --
+        IF a_fCascade <> TRUE THEN   
+            IF EXISTS(  SELECT  *
+                        FROM    TestCaseDeps
+                        WHERE   idTestCasePreReq = a_idTestCase
+                            AND tsExpire         = 'infinity'::TIMESTAMP ) THEN
+                v_sErrors := '';
+                FOR v_Rec IN    
+                    SELECT  TestCases.idTestCase AS idTestCase, 
+                            TestCases.sName AS sName
+                    FROM    TestCaseDeps, TestCases
+                    WHERE   TestCaseDeps.idTestCasePreReq   = a_idTestCase
+                        AND TestCaseDeps.tsExpire           = 'infinity'::TIMESTAMP
+                        AND TestCases.idTestCase            = TestCaseDeps.idTestCase
+                        AND TestCases.tsExpire              = 'infinity'::TIMESTAMP
+                    LOOP
+                    IF v_sErrors <> '' THEN
+                        v_sErrors := v_sErrors || ', ';
+                    END IF;
+                    v_sErrors := v_sErrors || v_Rec.sName || ' (idTestCase=' || v_Rec.idTestCase || ')';
+                END LOOP;
+                RAISE EXCEPTION 'Other test cases depends on test case with ID %: % ', a_idTestCase, v_sErrors;
+            END IF;
+            
+            IF EXISTS(  SELECT  *
+                        FROM    TestGroupMembers
+                        WHERE   idTestCase = a_idTestCase
+                            AND tsExpire   = 'infinity'::TIMESTAMP ) THEN
+                v_sErrors := '';
+                FOR v_Rec IN    
+                    SELECT  TestGroups.idTestGroup AS idTestGroup, 
+                            TestGroups.sName AS sName
+                    FROM    TestGroupMembers, TestGroups
+                    WHERE   TestGroupMembers.idTestCase     = a_idTestCase
+                        AND TestGroupMembers.tsExpire       = 'infinity'::TIMESTAMP
+                        AND TestGroupMembers.idTestGroup    = TestGroups.idTestGroup
+                        AND TestGroups.tsExpire             = 'infinity'::TIMESTAMP
+                    LOOP
+                    IF v_sErrors <> '' THEN
+                        v_sErrors := v_sErrors || ', ';
+                    END IF;
+                    v_sErrors := v_sErrors || v_Rec.sName || ' (idTestGroup=' || v_Rec.idTestGroup || ')';
+                END LOOP;
+                RAISE EXCEPTION 'Test case with ID % is member of the following test group(s): % ', a_idTestCase, v_sErrors;
+            END IF;
+        END IF;
+
+        --
+        -- To preserve the information about who deleted the record, we try to
+        -- add a dummy record which expires immediately.  I say try because of 
+        -- the primary key, we must let the new record be valid for 1 us. :-(
+        --
+        SELECT  * INTO STRICT v_Row
+        FROM    TestCases
+        WHERE   idTestCase = a_idTestCase
+            AND tsExpire   = 'infinity'::TIMESTAMP;
+
+        v_tsEffective := CURRENT_TIMESTAMP - INTERVAL '1 microsecond';
+        IF v_Row.tsEffective < v_tsEffective THEN
+            PERFORM TestCaseLogic_historizeEntry(a_idTestCase, v_tsEffective);
+            v_Row.tsEffective   := v_tsEffective;
+            v_Row.tsExpire      := CURRENT_TIMESTAMP;
+            SELECT NEXTVAL('TestCaseGenIdSeq') INTO v_Row.idGenTestCase;
+            INSERT INTO TestCases VALUES (v_Row.*);
+        ELSE
+            PERFORM TestCaseLogic_historizeEntry(a_idTestCase, CURRENT_TIMESTAMP);
+        END IF;
+
+        --
+        -- Delete arguments, test case dependencies and resource dependencies.
+        -- (We don't bother recording who deleted the records here since it's 
+        -- a lot of work and sufficiently covered in the TestCases table.)
+        --
+        UPDATE  TestCaseArgs
+        SET     tsExpire   = CURRENT_TIMESTAMP
+        WHERE   idTestCase = a_idTestCase
+            AND tsExpire   = 'infinity'::TIMESTAMP;
+
+        UPDATE  TestCaseDeps
+        SET     tsExpire   = CURRENT_TIMESTAMP
+        WHERE   idTestCase = a_idTestCase
+            AND tsExpire   = 'infinity'::TIMESTAMP;
+
+        UPDATE  TestCaseGlobalRsrcDeps
+        SET     tsExpire   = CURRENT_TIMESTAMP
+        WHERE   idTestCase = a_idTestCase
+            AND tsExpire   = 'infinity'::TIMESTAMP;
+
+        IF a_fCascade = TRUE THEN
+            UPDATE  TestCaseDeps
+            SET     tsExpire         = CURRENT_TIMESTAMP
+            WHERE   idTestCasePreReq = a_idTestCase
+                AND tsExpire         = 'infinity'::TIMESTAMP;
+            
+            UPDATE  TestGroupMembers
+            SET     tsExpire   = CURRENT_TIMESTAMP
+            WHERE   idTestCase = a_idTestCase
+                AND tsExpire   = 'infinity'::TIMESTAMP;
+        END IF;
+
+    EXCEPTION
+        WHEN NO_DATA_FOUND THEN
+            RAISE EXCEPTION 'Test case with ID % does not currently exist', a_idTestCase;
+        WHEN TOO_MANY_ROWS THEN
+            RAISE EXCEPTION 'Integrity error in TestCases: Too many current rows for %', a_idTestCase;
+    END;
+$$ LANGUAGE plpgsql;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testcase.py b/src/VBox/ValidationKit/testmanager/core/testcase.py
new file mode 100644
index 0000000..3f82120
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testcase.py
@@ -0,0 +1,1390 @@
+# -*- coding: utf-8 -*-
+# $Id: testcase.py $
+# pylint: disable=C0302
+
+"""
+Test Manager - Test Case.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import copy;
+import unittest;
+
+# Validation Kit imports.
+from common                             import utils;
+from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase, \
+                                               ChangeLogEntry, AttributeChangeEntry;
+from testmanager.core.globalresource    import GlobalResourceData;
+from testmanager.core.useraccount       import UserAccountLogic;
+
+
+
+class TestCaseGlobalRsrcDepData(ModelDataBase):
+    """
+    Test case dependency on a global resource - data.
+    """
+
+    ksParam_idTestCase          = 'TestCaseDependency_idTestCase';
+    ksParam_idGlobalRsrc        = 'TestCaseDependency_idGlobalRsrc';
+    ksParam_tsEffective         = 'TestCaseDependency_tsEffective';
+    ksParam_tsExpire            = 'TestCaseDependency_tsExpire';
+    ksParam_uidAuthor           = 'TestCaseDependency_uidAuthor';
+
+    kasAllowNullAttributes      = ['idTestSet', ];
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestCase         = None;
+        self.idGlobalRsrc       = None;
+        self.tsEffective        = None;
+        self.tsExpire           = None;
+        self.uidAuthor          = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestCaseDeps row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test case not found.');
+
+        self.idTestCase         = aoRow[0];
+        self.idGlobalRsrc       = aoRow[1];
+        self.tsEffective        = aoRow[2];
+        self.tsExpire           = aoRow[3];
+        self.uidAuthor          = aoRow[4];
+        return self;
+
+
+class TestCaseGlobalRsrcDepLogic(ModelLogicBase):
+    """
+    Test case dependency on a global resources - logic.
+    """
+
+    def getTestCaseDeps(self, idTestCase, tsNow = None):
+        """
+        Returns an array of (TestCaseGlobalRsrcDepData, GlobalResourceData)
+        with the global resources required by idTestCase.
+        Returns empty array if none found. Raises exception on database error.
+
+        Note! Maybe a bit overkill...
+        """
+        ## @todo This code isn't entirely kosher... Should use a DataEx with a oGlobalRsrc = GlobalResourceData().
+        if tsNow is not None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestCaseGlobalRsrcDeps, GlobalResources\n'
+                              'WHERE    TestCaseGlobalRsrcDeps.idTestCase   = %s\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsExpire     > %s\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsEffective <= %s\n'
+                              '     AND GlobalResources.idGlobalRsrc        = TestCaseGlobalRsrcDeps.idGlobalRsrc\n'
+                              '     AND GlobalResources.tsExpire            > %s\n'
+                              '     AND GlobalResources.tsEffective        <= %s\n'
+                              , (idTestCase, tsNow, tsNow, tsNow, tsNow) );
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestCaseGlobalRsrcDeps, GlobalResources\n'
+                              'WHERE    TestCaseGlobalRsrcDeps.idTestCase   =  %s\n'
+                              '     AND GlobalResources.idGlobalRsrc        = TestCaseGlobalRsrcDeps.idGlobalRsrc\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsExpire     = \'infinity\'::TIMESTAMP\n'
+                              '     AND GlobalResources.tsExpire            = \'infinity\'::TIMESTAMP\n'
+                              , (idTestCase,))
+        aaoRows = self._oDb.fetchAll();
+        aoRet = []
+        for aoRow in aaoRows:
+            oItem = [TestCaseDependencyData().initFromDbRow(aoRow),
+                     GlobalResourceData().initFromDbRow(aoRow[5:])];
+            aoRet.append(oItem);
+
+        return aoRet
+
+    def getTestCaseDepsIds(self, idTestCase, tsNow = None):
+        """
+        Returns an array of global resources that idTestCase require.
+        Returns empty array if none found. Raises exception on database error.
+        """
+        if tsNow is not None:
+            self._oDb.execute('SELECT   idGlobalRsrc\n'
+                              'FROM     TestCaseGlobalRsrcDeps\n'
+                              'WHERE    TestCaseGlobalRsrcDeps.idTestCase   = %s\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsExpire     > %s\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsEffective <= %s\n'
+                              , (idTestCase, tsNow, tsNow, ) );
+        else:
+            self._oDb.execute('SELECT   idGlobalRsrc\n'
+                              'FROM     TestCaseGlobalRsrcDeps\n'
+                              'WHERE    TestCaseGlobalRsrcDeps.idTestCase   =  %s\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsExpire     = \'infinity\'::TIMESTAMP\n'
+                              , (idTestCase,))
+        aidGlobalRsrcs = []
+        for aoRow in self._oDb.fetchAll():
+            aidGlobalRsrcs.append(aoRow[0]);
+        return aidGlobalRsrcs;
+
+
+    def getDepGlobalResourceData(self, idTestCase, tsNow = None):
+        """
+        Returns an array of objects of type GlobalResourceData on which the
+        specified test case depends on.
+        """
+        if tsNow is None :
+            self._oDb.execute('SELECT   GlobalResources.*\n'
+                              'FROM     TestCaseGlobalRsrcDeps, GlobalResources\n'
+                              'WHERE    TestCaseGlobalRsrcDeps.idTestCase  =  %s\n'
+                              '     AND GlobalResources.idGlobalRsrc       = TestCaseGlobalRsrcDeps.idGlobalRsrc\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsExpire    = \'infinity\'::TIMESTAMP\n'
+                              '     AND GlobalResources.tsExpire           = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY GlobalResources.idGlobalRsrc\n'
+                              , (idTestCase,))
+        else:
+            self._oDb.execute('SELECT   GlobalResources.*\n'
+                              'FROM     TestCaseGlobalRsrcDeps, GlobalResources\n'
+                              'WHERE    TestCaseGlobalRsrcDeps.idTestCase  =  %s\n'
+                              '     AND GlobalResources.idGlobalRsrc       = TestCaseGlobalRsrcDeps.idGlobalRsrc\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsExpire    > %s\n'
+                              '     AND TestCaseGlobalRsrcDeps.tsExpire   <= %s\n'
+                              '     AND GlobalResources.tsExpire           > %s\n'
+                              '     AND GlobalResources.tsEffective       <= %s\n'
+                              'ORDER BY GlobalResources.idGlobalRsrc\n'
+                              , (idTestCase, tsNow, tsNow, tsNow, tsNow));
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(GlobalResourceData().initFromDbRow(aoRow));
+
+        return aoRet
+
+
+class TestCaseDependencyData(ModelDataBase):
+    """
+    Test case dependency data
+    """
+
+    ksParam_idTestCase          = 'TestCaseDependency_idTestCase';
+    ksParam_idTestCasePreReq    = 'TestCaseDependency_idTestCasePreReq';
+    ksParam_tsEffective         = 'TestCaseDependency_tsEffective';
+    ksParam_tsExpire            = 'TestCaseDependency_tsExpire';
+    ksParam_uidAuthor           = 'TestCaseDependency_uidAuthor';
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestCase         = None;
+        self.idTestCasePreReq   = None;
+        self.tsEffective        = None;
+        self.tsExpire           = None;
+        self.uidAuthor          = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestCaseDeps row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test case not found.');
+
+        self.idTestCase         = aoRow[0];
+        self.idTestCasePreReq   = aoRow[1];
+        self.tsEffective        = aoRow[2];
+        self.tsExpire           = aoRow[3];
+        self.uidAuthor          = aoRow[4];
+        return self;
+
+    def initFromParams(self, oDisp, fStrict=True):
+        """
+        Initialize the object from parameters.
+        The input is not validated at all, except that all parameters must be
+        present when fStrict is True.
+        Note! Returns parameter NULL values, not database ones.
+        """
+
+        self.convertToParamNull();
+        fn = oDisp.getStringParam; # Shorter...
+
+        self.idTestCase         = fn(self.ksParam_idTestCase,       None, None  if fStrict else self.idTestCase);
+        self.idTestCasePreReq   = fn(self.ksParam_idTestCasePreReq, None, None  if fStrict else self.idTestCasePreReq);
+        self.tsEffective        = fn(self.ksParam_tsEffective,      None, None  if fStrict else self.tsEffective);
+        self.tsExpire           = fn(self.ksParam_tsExpire,         None, None  if fStrict else self.tsExpire);
+        self.uidAuthor          = fn(self.ksParam_uidAuthor,        None, None  if fStrict else self.uidAuthor);
+
+        return True
+
+    def validateAndConvert(self, oDb = None):
+        """
+        Validates the input and converts valid fields to their right type.
+        Returns a dictionary with per field reports, only invalid fields will
+        be returned, so an empty dictionary means that the data is valid.
+
+        The dictionary keys are ksParam_*.
+        """
+        dErrors = dict()
+
+        self.idTestCase         = self._validateInt(   dErrors, self.ksParam_idTestCase,        self.idTestCase);
+        self.idTestCasePreReq   = self._validateInt(   dErrors, self.ksParam_idTestCasePreReq,  self.idTestCasePreReq);
+        self.tsEffective        = self._validateTs(    dErrors, self.ksParam_tsEffective,       self.tsEffective);
+        self.tsExpire           = self._validateTs(    dErrors, self.ksParam_tsExpire,          self.tsExpire);
+        self.uidAuthor          = self._validateInt(   dErrors, self.ksParam_uidAuthor,         self.uidAuthor);
+
+        _ = oDb;
+        return dErrors
+
+    def convertFromParamNull(self):
+        """
+        Converts from parameter NULL values to database NULL values (None).
+        """
+        if self.idTestCase        in [-1, '']: self.idTestCase          = None;
+        if self.idTestCasePreReq  in [-1, '']: self.idTestCasePreReq    = None;
+        if self.tsEffective             == '': self.tsEffective         = None;
+        if self.tsExpire                == '': self.tsExpire            = None;
+        if self.uidAuthor         in [-1, '']: self.uidAuthor           = None;
+        return True;
+
+    def convertToParamNull(self):
+        """
+        Converts from database NULL values (None) to special values we can
+        pass thru parameters list.
+        """
+        if self.idTestCase            is None: self.idTestCase          = -1;
+        if self.idTestCasePreReq      is None: self.idTestCasePreReq    = -1;
+        if self.tsEffective           is None: self.tsEffective         = '';
+        if self.tsExpire              is None: self.tsExpire            = '';
+        if self.uidAuthor             is None: self.uidAuthor           = -1;
+        return True;
+
+    def isEqual(self, oOther):
+        """ Compares two instances. """
+        return self.idTestCase       == oOther.idTestCase \
+           and self.idTestCasePreReq == oOther.idTestCasePreReq \
+           and self.tsEffective      == oOther.tsEffective \
+           and self.tsExpire         == oOther.tsExpire \
+           and self.uidAuthor        == oOther.uidAuthor;
+
+    def getTestCasePreReqIds(self, aTestCaseDependencyData):
+        """
+        Get list of Test Case IDs which current
+        Test Case depends on
+        """
+        if len(aTestCaseDependencyData) == 0:
+            return []
+
+        aoRet = []
+        for oTestCaseDependencyData in aTestCaseDependencyData:
+            aoRet.append(oTestCaseDependencyData.idTestCasePreReq)
+
+        return aoRet
+
+class TestCaseDependencyLogic(ModelLogicBase):
+    """Test case dependency management logic"""
+
+    def getTestCaseDeps(self, idTestCase, tsEffective = None):
+        """
+        Returns an array of TestCaseDependencyData with the prerequisites of
+        idTestCase.
+        Returns empty array if none found. Raises exception on database error.
+        """
+        if tsEffective is not None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestCaseDeps\n'
+                              'WHERE    idTestCase   = %s\n'
+                              '     AND tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              , (idTestCase, tsEffective, tsEffective, ) );
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestCaseDeps\n'
+                              'WHERE    idTestCase   = %s\n'
+                              '     AND tsExpire     = \'infinity\'::TIMESTAMP\n'
+                              , (idTestCase, ) );
+        aaoRows = self._oDb.fetchAll();
+        aoRet = [];
+        for aoRow in aaoRows:
+            aoRet.append(TestCaseDependencyData().initFromDbRow(aoRow));
+
+        return aoRet
+
+    def getTestCaseDepsIds(self, idTestCase, tsNow = None):
+        """
+        Returns an array of test case IDs of the prerequisites of idTestCase.
+        Returns empty array if none found. Raises exception on database error.
+        """
+        if tsNow is not None:
+            self._oDb.execute('SELECT   idTestCase\n'
+                              'FROM     TestCaseDeps\n'
+                              'WHERE    idTestCase   = %s\n'
+                              '     AND tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              , (idTestCase, tsNow, tsNow, ) );
+        else:
+            self._oDb.execute('SELECT   idTestCase\n'
+                              'FROM     TestCaseDeps\n'
+                              'WHERE    idTestCase   = %s\n'
+                              '     AND tsExpire     = \'infinity\'::TIMESTAMP\n'
+                              , (idTestCase, ) );
+        aidPreReqs = [];
+        for aoRow in self._oDb.fetchAll():
+            aidPreReqs.append(aoRow[0]);
+        return aidPreReqs;
+
+
+    def getDepTestCaseData(self, idTestCase, tsNow = None):
+        """
+        Returns an array of objects of type TestCaseData2 on which
+        specified test case depends on
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   TestCases.*\n'
+                              'FROM     TestCases, TestCaseDeps\n'
+                              'WHERE    TestCaseDeps.idTestCase       = %s\n'
+                              '     AND TestCaseDeps.idTestCasePreReq = TestCases.idTestCase\n'
+                              '     AND TestCaseDeps.tsExpire         = \'infinity\'::TIMESTAMP\n'
+                              '     AND TestCases.tsExpire            = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY TestCases.idTestCase\n'
+                              , (idTestCase, ) );
+        else:
+            self._oDb.execute('SELECT   TestCases.*\n'
+                              'FROM     TestCases, TestCaseDeps\n'
+                              'WHERE    TestCaseDeps.idTestCase       = %s\n'
+                              '     AND TestCaseDeps.idTestCasePreReq = TestCases.idTestCase\n'
+                              '     AND TestCaseDeps.tsExpire         > %s\n'
+                              '     AND TestCaseDeps.tsEffective     <= %s\n'
+                              '     AND TestCases.tsExpire            > %s\n'
+                              '     AND TestCases.tsEffective        <= %s\n'
+                              'ORDER BY TestCases.idTestCase\n'
+                              , (idTestCase, tsNow, tsNow, tsNow, tsNow, ) );
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(TestCaseData().initFromDbRow(aoRow));
+
+        return aoRet
+
+    def getApplicableDepTestCaseData(self, idTestCase):
+        """
+        Returns an array of objects of type TestCaseData on which
+        specified test case might depends on (all test
+        cases except the specified one and those testcases which are
+        depend on idTestCase)
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     TestCases\n'
+                          'WHERE    idTestCase <> %s\n'
+                          '     AND idTestCase NOT IN (SELECT idTestCase\n'
+                          '                            FROM   TestCaseDeps\n'
+                          '                            WHERE  idTestCasePreReq=%s\n'
+                          '                               AND tsExpire = \'infinity\'::TIMESTAMP)\n'
+                          '     AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                          , (idTestCase, idTestCase) )
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(TestCaseData().initFromDbRow(aoRow));
+
+        return aoRet
+
+class TestCaseData(ModelDataBase):
+    """
+    Test case data
+    """
+
+    ksIdAttr    = 'idTestCase';
+    ksIdGenAttr = 'idGenTestCase';
+
+    ksParam_idTestCase      = 'TestCase_idTestCase'
+    ksParam_tsEffective     = 'TestCase_tsEffective'
+    ksParam_tsExpire        = 'TestCase_tsExpire'
+    ksParam_uidAuthor       = 'TestCase_uidAuthor'
+    ksParam_idGenTestCase   = 'TestCase_idGenTestCase'
+    ksParam_sName           = 'TestCase_sName'
+    ksParam_sDescription    = 'TestCase_sDescription'
+    ksParam_fEnabled        = 'TestCase_fEnabled'
+    ksParam_cSecTimeout     = 'TestCase_cSecTimeout'
+    ksParam_sTestBoxReqExpr = 'TestCase_sTestBoxReqExpr';
+    ksParam_sBuildReqExpr   = 'TestCase_sBuildReqExpr';
+    ksParam_sBaseCmd        = 'TestCase_sBaseCmd'
+    ksParam_sValidationKitZips = 'TestCase_sValidationKitZips'
+
+    kasAllowNullAttributes  = [ 'idTestCase', 'tsEffective', 'tsExpire', 'uidAuthor', 'idGenTestCase', 'sDescription',
+                                'sTestBoxReqExpr', 'sBuildReqExpr', 'sValidationKitZips', ];
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestCase         = None;
+        self.tsEffective        = None;
+        self.tsExpire           = None;
+        self.uidAuthor          = None;
+        self.idGenTestCase      = None;
+        self.sName              = None;
+        self.sDescription       = None;
+        self.fEnabled           = False;
+        self.cSecTimeout        = 10; # Init with minimum timeout value
+        self.sTestBoxReqExpr    = None;
+        self.sBuildReqExpr      = None;
+        self.sBaseCmd           = None;
+        self.sValidationKitZips = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestCases row.
+        Returns self. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test case not found.');
+
+        self.idTestCase         = aoRow[0];
+        self.tsEffective        = aoRow[1];
+        self.tsExpire           = aoRow[2];
+        self.uidAuthor          = aoRow[3];
+        self.idGenTestCase      = aoRow[4];
+        self.sName              = aoRow[5];
+        self.sDescription       = aoRow[6];
+        self.fEnabled           = aoRow[7];
+        self.cSecTimeout        = aoRow[8];
+        self.sTestBoxReqExpr    = aoRow[9];
+        self.sBuildReqExpr      = aoRow[10];
+        self.sBaseCmd           = aoRow[11];
+        self.sValidationKitZips = aoRow[12];
+        return self;
+
+    def initFromDbWithId(self, oDb, idTestCase, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   TestCases\n'
+                                                       'WHERE  idTestCase   = %s\n'
+                                                       , ( idTestCase,), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idTestCase=%s not found (tsNow=%s sPeriodBack=%s)' % (idTestCase, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+    def initFromDbWithGenId(self, oDb, idGenTestCase, tsNow = None):
+        """
+        Initialize the object from the database.
+        """
+        _ = tsNow; # For relevant for the TestCaseDataEx version only.
+        oDb.execute('SELECT *\n'
+                    'FROM   TestCases\n'
+                    'WHERE  idGenTestCase = %s\n'
+                    , (idGenTestCase, ) );
+        return self.initFromDbRow(oDb.fetchOne());
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        if sAttr == 'cSecTimeout' and oValue not in aoNilValues: # Allow human readable interval formats.
+            return utils.parseIntervalSeconds(oValue);
+
+        (oValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+        if sError is None:
+            if sAttr == 'sTestBoxReqExpr':
+                sError = TestCaseData.validateTestBoxReqExpr(oValue);
+            elif sAttr == 'sBuildReqExpr':
+                sError = TestCaseData.validateBuildReqExpr(oValue);
+            elif sAttr == 'sBaseCmd':
+                _, sError = TestCaseData.validateStr(oValue, fAllowUnicodeSymbols=False);
+        return (oValue, sError);
+
+
+    #
+    # Misc.
+    #
+
+    def needValidationKitBit(self):
+        """
+        Predicate method for checking whether a validation kit build is required.
+        """
+        return self.sValidationKitZips is None \
+            or self.sValidationKitZips.find('@VALIDATIONKIT_ZIP@') >= 0;
+
+    def matchesTestBoxProps(self, oTestBoxData):
+        """
+        Checks if the all of the testbox related test requirements matches the
+        given testbox.
+
+        Returns True or False according to the expression, None on exception or
+        non-boolean expression result.
+        """
+        return TestCaseData.matchesTestBoxPropsEx(oTestBoxData, self.sTestBoxReqExpr);
+
+    def matchesBuildProps(self, oBuildDataEx):
+        """
+        Checks if the all of the build related test requirements matches the
+        given build.
+
+        Returns True or False according to the expression, None on exception or
+        non-boolean expression result.
+        """
+        return TestCaseData.matchesBuildPropsEx(oBuildDataEx, self.sBuildReqExpr);
+
+
+    #
+    # Expression validation code shared with TestCaseArgsDataEx.
+    #
+    @staticmethod
+    def _safelyEvalExpr(sExpr, dLocals, fMayRaiseXcpt = False):
+        """
+        Safely evaluate requirment expression given a set of locals.
+
+        Returns True or False according to the expression.  If the expression
+        causes an exception to be raised or does not return a boolean result,
+        None will be returned.
+        """
+        if sExpr is None  or  sExpr == '':
+            return True;
+
+        dGlobals = \
+        {
+            '__builtins__':     None,
+            'long':             long,
+            'int':              int,
+            'bool':             bool,
+            'True':             True,
+            'False':            False,
+            'len':              len,
+            'isinstance':       isinstance,
+            'type':             type,
+            'dict':             dict,
+            'dir':              dir,
+            'list':             list,
+            'versionCompare':   utils.versionCompare,
+        };
+
+        try:
+            fRc = eval(sExpr, dGlobals, dLocals);
+        except:
+            if fMayRaiseXcpt:
+                raise;
+            return None;
+
+        if not isinstance(fRc, bool):
+            if fMayRaiseXcpt:
+                raise Exception('not a boolean result: "%s" - %s' % (fRc, type(fRc)) );
+            return None;
+
+        return fRc;
+
+    @staticmethod
+    def _safelyValidateReqExpr(sExpr, adLocals):
+        """
+        Validates a requirement expression using the given sets of locals,
+        returning None on success and an error string on failure.
+        """
+        for dLocals in adLocals:
+            try:
+                TestCaseData._safelyEvalExpr(sExpr, dLocals, True);
+            except Exception as oXcpt:
+                return str(oXcpt);
+        return None;
+
+    @staticmethod
+    def validateTestBoxReqExpr(sExpr):
+        """
+        Validates a testbox expression, returning None on success and an error
+        string on failure.
+        """
+        adTestBoxes = \
+        [
+            {
+                'sOs':                  'win',
+                'sOsVersion':           '3.1',
+                'sCpuVendor':           'VirtualBox',
+                'sCpuArch':             'x86',
+                'cCpus':                1,
+                'fCpuHwVirt':           False,
+                'fCpuNestedPaging':     False,
+                'fCpu64BitGuest':       False,
+                'fChipsetIoMmu':        False,
+                'cMbMemory':            985034,
+                'cMbScratch':           1234089,
+                'iTestBoxScriptRev':    1,
+                'sName':                'emanon',
+                'uuidSystem':           '8FF81BE5-3901-4AB1-8A65-B48D511C0321',
+            },
+            {
+                'sOs':                  'linux',
+                'sOsVersion':           '3.1',
+                'sCpuVendor':           'VirtualBox',
+                'sCpuArch':             'amd64',
+                'cCpus':                8191,
+                'fCpuHwVirt':           True,
+                'fCpuNestedPaging':     True,
+                'fCpu64BitGuest':       True,
+                'fChipsetIoMmu':        True,
+                'cMbMemory':            9999999999,
+                'cMbScratch':           9999999999999,
+                'iTestBoxScriptRev':    9999999,
+                'sName':                'emanon',
+                'uuidSystem':           '00000000-0000-0000-0000-000000000000',
+            },
+        ];
+        return TestCaseData._safelyValidateReqExpr(sExpr, adTestBoxes);
+
+    @staticmethod
+    def matchesTestBoxPropsEx(oTestBoxData, sExpr):
+        """ Worker for TestCaseData.matchesTestBoxProps and TestCaseArgsDataEx.matchesTestBoxProps. """
+        if sExpr is None:
+            return True;
+        dLocals = \
+        {
+            'sOs':                  oTestBoxData.sOs,
+            'sOsVersion':           oTestBoxData.sOsVersion,
+            'sCpuVendor':           oTestBoxData.sCpuVendor,
+            'sCpuArch':             oTestBoxData.sCpuArch,
+            'cCpus':                oTestBoxData.cCpus,
+            'fCpuHwVirt':           oTestBoxData.fCpuHwVirt,
+            'fCpuNestedPaging':     oTestBoxData.fCpuNestedPaging,
+            'fCpu64BitGuest':       oTestBoxData.fCpu64BitGuest,
+            'fChipsetIoMmu':        oTestBoxData.fChipsetIoMmu,
+            'cMbMemory':            oTestBoxData.cMbMemory,
+            'cMbScratch':           oTestBoxData.cMbScratch,
+            'iTestBoxScriptRev':    oTestBoxData.iTestBoxScriptRev,
+            'iPythonHexVersion':    oTestBoxData.iPythonHexVersion,
+            'sName':                oTestBoxData.sName,
+            'uuidSystem':           oTestBoxData.uuidSystem,
+        };
+        return TestCaseData._safelyEvalExpr(sExpr, dLocals);
+
+    @staticmethod
+    def validateBuildReqExpr(sExpr):
+        """
+        Validates a testbox expression, returning None on success and an error
+        string on failure.
+        """
+        adBuilds = \
+        [
+            {
+                'sProduct':             'VirtualBox',
+                'sBranch':              'trunk',
+                'sType':                'release',
+                'asOsArches':           ['win.amd64', 'win.x86'],
+                'sVersion':             '1.0',
+                'iRevision':            1234,
+                'uidAuthor':            None,
+                'idBuild':              953,
+            },
+            {
+                'sProduct':             'VirtualBox',
+                'sBranch':              'VBox-4.1',
+                'sType':                'release',
+                'asOsArches':           ['linux.x86',],
+                'sVersion':             '4.2.15',
+                'iRevision':            89876,
+                'uidAuthor':            None,
+                'idBuild':              945689,
+            },
+            {
+                'sProduct':             'VirtualBox',
+                'sBranch':              'VBox-4.1',
+                'sType':                'strict',
+                'asOsArches':           ['solaris.x86', 'solaris.amd64',],
+                'sVersion':             '4.3.0_RC3',
+                'iRevision':            97939,
+                'uidAuthor':            33,
+                'idBuild':              9456893,
+            },
+        ];
+        return TestCaseData._safelyValidateReqExpr(sExpr, adBuilds);
+
+    @staticmethod
+    def matchesBuildPropsEx(oBuildDataEx, sExpr):
+        """
+        Checks if the all of the build related test requirements matches the
+        given build.
+        """
+        if sExpr is None:
+            return True;
+        dLocals = \
+        {
+            'sProduct':             oBuildDataEx.oCat.sProduct,
+            'sBranch':              oBuildDataEx.oCat.sBranch,
+            'sType':                oBuildDataEx.oCat.sType,
+            'asOsArches':           oBuildDataEx.oCat.asOsArches,
+            'sVersion':             oBuildDataEx.sVersion,
+            'iRevision':            oBuildDataEx.iRevision,
+            'uidAuthor':            oBuildDataEx.uidAuthor,
+            'idBuild':              oBuildDataEx.idBuild,
+        };
+        return TestCaseData._safelyEvalExpr(sExpr, dLocals);
+
+
+
+
+class TestCaseDataEx(TestCaseData):
+    """
+    Test case data.
+    """
+
+    ksParam_aoTestCaseArgs          = 'TestCase_aoTestCaseArgs';
+    ksParam_aoDepTestCases          = 'TestCase_aoDepTestCases';
+    ksParam_aoDepGlobalResources    = 'TestCase_aoDepGlobalResources';
+
+    # Use [] instead of None.
+    kasAltArrayNull = [ 'aoTestCaseArgs', 'aoDepTestCases', 'aoDepGlobalResources' ];
+
+
+    def __init__(self):
+        TestCaseData.__init__(self);
+
+        # List of objects of type TestCaseData (or TestCaseDataEx, we don't
+        # care) on which current Test Case depends.
+        self.aoDepTestCases         = [];
+
+        # List of objects of type GlobalResourceData on which current Test Case depends.
+        self.aoDepGlobalResources   = [];
+
+        # List of objects of type TestCaseArgsData.
+        self.aoTestCaseArgs         = [];
+
+    def _initExtraMembersFromDb(self, oDb, tsNow = None, sPeriodBack = None):
+        """
+        Worker shared by the initFromDb* methods.
+        Returns self.  Raises exception if no row or database error.
+        """
+        _ = sPeriodBack; ## @todo sPeriodBack
+        from testmanager.core.testcaseargs import TestCaseArgsLogic;
+        self.aoDepTestCases         = TestCaseDependencyLogic(oDb).getDepTestCaseData(self.idTestCase, tsNow);
+        self.aoDepGlobalResources   = TestCaseGlobalRsrcDepLogic(oDb).getDepGlobalResourceData(self.idTestCase, tsNow);
+        self.aoTestCaseArgs         = TestCaseArgsLogic(oDb).getTestCaseArgs(self.idTestCase, tsNow);
+        # Note! The above arrays are sorted by their relvant IDs for fetchForChangeLog's sake.
+        return self;
+
+    def initFromDbRowEx(self, aoRow, oDb, tsNow = None):
+        """
+        Reinitialize from a SELECT * FROM TestCases row.  Will query the
+        necessary additional data from oDb using tsNow.
+        Returns self.  Raises exception if no row or database error.
+        """
+        TestCaseData.initFromDbRow(self, aoRow);
+        return self._initExtraMembersFromDb(oDb, tsNow);
+
+    def initFromDbWithId(self, oDb, idTestCase, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        TestCaseData.initFromDbWithId(self, oDb, idTestCase, tsNow, sPeriodBack);
+        return self._initExtraMembersFromDb(oDb, tsNow, sPeriodBack);
+
+    def initFromDbWithGenId(self, oDb, idGenTestCase, tsNow = None):
+        """
+        Initialize the object from the database.
+        """
+        TestCaseData.initFromDbWithGenId(self, oDb, idGenTestCase);
+        if tsNow == None and not oDb.isTsInfinity(self.tsExpire):
+            tsNow = self.tsEffective;
+        return self._initExtraMembersFromDb(oDb, tsNow);
+
+    def getAttributeParamNullValues(self, sAttr):
+        if sAttr in ['aoDepTestCases', 'aoDepGlobalResources', 'aoTestCaseArgs']:
+            return [[], ''];
+        return TestCaseData.getAttributeParamNullValues(self, sAttr);
+
+    def convertParamToAttribute(self, sAttr, sParam, oValue, oDisp, fStrict):
+        """For dealing with the arrays."""
+        if sAttr not in ['aoDepTestCases', 'aoDepGlobalResources', 'aoTestCaseArgs']:
+            return TestCaseData.convertParamToAttribute(self, sAttr, sParam, oValue, oDisp, fStrict);
+
+        aoNewValues = [];
+        if sAttr == 'aoDepTestCases':
+            for idTestCase in oDisp.getListOfIntParams(sParam, 1, 0x7ffffffe, []):
+                oDep = TestCaseData();
+                oDep.idTestCase = str(idTestCase);
+                aoNewValues.append(oDep);
+
+        elif sAttr == 'aoDepGlobalResources':
+            for idGlobalRsrc in oDisp.getListOfIntParams(sParam, 1, 0x7ffffffe, []):
+                oGlobalRsrc = GlobalResourceData();
+                oGlobalRsrc.idGlobalRsrc = str(idGlobalRsrc);
+                aoNewValues.append(oGlobalRsrc);
+
+        elif sAttr == 'aoTestCaseArgs':
+            from testmanager.core.testcaseargs import TestCaseArgsData;
+            for sArgKey in oDisp.getStringParam(TestCaseDataEx.ksParam_aoTestCaseArgs, sDefault = '').split(','):
+                oDispWrapper = self.DispWrapper(oDisp, '%s[%s][%%s]' % (TestCaseDataEx.ksParam_aoTestCaseArgs, sArgKey,))
+                aoNewValues.append(TestCaseArgsData().initFromParams(oDispWrapper, fStrict = False));
+        return aoNewValues;
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb): # pylint: disable=R0914
+        """
+        Validate special arrays and requirement expressions.
+
+        For the two dependency arrays we have to supply missing bits by
+        looking them up in the database.  In the argument variation case we
+        need to validate each item.
+        """
+        if sAttr not in ['aoDepTestCases', 'aoDepGlobalResources', 'aoTestCaseArgs']:
+            return TestCaseData._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+
+        asErrors = [];
+        aoNewValues = [];
+        if sAttr == 'aoDepTestCases':
+            for oTestCase in self.aoDepTestCases:
+                if utils.isString(oTestCase.idTestCase): # Stored as string convertParamToAttribute.
+                    oTestCase = copy.copy(oTestCase);
+                    try:
+                        oTestCase.idTestCase = int(oTestCase.idTestCase);
+                        oTestCase.initFromDbWithId(oDb, oTestCase.idTestCase);
+                    except Exception, oXcpt:
+                        asErrors.append('Test case dependency #%s: %s' % (oTestCase.idTestCase, oXcpt));
+                aoNewValues.append(oTestCase);
+
+        elif sAttr == 'aoDepGlobalResources':
+            for oGlobalRsrc in self.aoDepGlobalResources:
+                if utils.isString(oGlobalRsrc.idGlobalRsrc): # Stored as string convertParamToAttribute.
+                    oGlobalRsrc = copy.copy(oGlobalRsrc);
+                    try:
+                        oGlobalRsrc.idTestCase = int(oGlobalRsrc.idGlobalRsrc);
+                        oGlobalRsrc.initFromDbWithId(oDb, oGlobalRsrc.idGlobalRsrc);
+                    except Exception, oXcpt:
+                        asErrors.append('Resource dependency #%s: %s' % (oGlobalRsrc.idGlobalRsrc, oXcpt));
+                aoNewValues.append(oGlobalRsrc);
+
+        else:
+            assert sAttr == 'aoTestCaseArgs';
+            if self.aoTestCaseArgs is None or len(self.aoTestCaseArgs) == 0:
+                return (None, 'The testcase requires at least one argument variation to be valid.');
+
+            # Note! We'll be returning an error dictionary instead of an string here.
+            dErrors = {};
+
+            for iVar in range(len(self.aoTestCaseArgs)):
+                oVar = copy.copy(self.aoTestCaseArgs[iVar]);
+                oVar.idTestCase = self.idTestCase;
+                dCurErrors = oVar.validateAndConvert(oDb);
+                if len(dCurErrors) == 0:
+                    pass; ## @todo figure out the ID?
+                else:
+                    asErrors = [];
+                    for sKey in dCurErrors:
+                        asErrors.append('%s: %s' % (sKey[len('TestCaseArgs_'):], dCurErrors[sKey]));
+                    dErrors[iVar] = '<br>\n'.join(asErrors)
+                aoNewValues.append(oVar);
+
+            for iVar in range(len(self.aoTestCaseArgs)):
+                sArgs = self.aoTestCaseArgs[iVar].sArgs;
+                for iVar2 in range(iVar + 1, len(self.aoTestCaseArgs)):
+                    if self.aoTestCaseArgs[iVar2].sArgs == sArgs:
+                        sMsg = 'Duplicate argument variation "%s".' % (sArgs);
+                        if iVar in dErrors:     dErrors[iVar]  += '<br>\n' + sMsg;
+                        else:                   dErrors[iVar]   = sMsg;
+                        if iVar2 in dErrors:    dErrors[iVar2] += '<br>\n' + sMsg;
+                        else:                   dErrors[iVar2]  = sMsg;
+                        break;
+
+            return (aoNewValues, dErrors if len(dErrors) > 0 else None);
+
+        return (aoNewValues, None if len(asErrors) == 0 else ' <br>'.join(asErrors));
+
+    def _validateAndConvertWorker(self, asAllowNullAttributes, oDb):
+        dErrors = TestCaseData._validateAndConvertWorker(self, asAllowNullAttributes, oDb);
+
+        # Validate dependencies a wee bit for paranoid reasons. The scheduler
+        # queue generation code does the real validation here!
+        if len(dErrors) == 0 and self.idTestCase is not None:
+            for oDep in self.aoDepTestCases:
+                if oDep.idTestCase == self.idTestCase:
+                    if self.ksParam_aoDepTestCases in dErrors:
+                        dErrors[self.ksParam_aoDepTestCases] += ' Depending on itself!';
+                    else:
+                        dErrors[self.ksParam_aoDepTestCases]   = 'Depending on itself!';
+        return dErrors;
+
+class TestCaseLogic(ModelLogicBase):
+    """
+    Test case management logic.
+    """
+
+    def getAll(self):
+        """
+        Fetches all test case records from DB (TestCaseData).
+        """
+        self._oDb.execute('SELECT *\n'
+                          'FROM   TestCases\n'
+                          'WHERE  tsExpire = \'infinity\'::TIMESTAMP\n'
+                          'ORDER BY idTestCase ASC;')
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = [];
+        for aoRow in aaoRows:
+            aoRet.append(TestCaseData().initFromDbRow(aoRow))
+        return aoRet
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches test cases.
+
+        Returns an array (list) of TestCaseDataEx items, empty list if none.
+        Raises exception on error.
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestCases\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sName ASC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart, ));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestCases\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY sName ASC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart, ));
+
+        aoRows = [];
+        for aoRow in self._oDb.fetchAll():
+            aoRows.append(TestCaseDataEx().initFromDbRowEx(aoRow, self._oDb, tsNow));
+        return aoRows;
+
+    def fetchForChangeLog(self, idTestCase, iStart, cMaxRows, tsNow): # pylint: disable=R0914
+        """
+        Fetches change log entries for a testbox.
+
+        Returns an array of ChangeLogEntry instance and an indicator whether
+        there are more entries.
+        Raises exception on error.
+        """
+
+        if tsNow is None:
+            tsNow = self._oDb.getCurrentTimestamp();
+
+        # 1. Get a list of the relevant change times.
+        self._oDb.execute('( SELECT tsEffective, uidAuthor FROM TestCases       WHERE idTestCase = %s AND tsEffective <= %s )\n'
+                          'UNION\n'
+                          '( SELECT tsEffective, uidAuthor FROM TestCaseArgs    WHERE idTestCase = %s AND tsEffective <= %s )\n'
+                          'UNION\n'
+                          '( SELECT tsEffective, uidAuthor FROM TestCaseDeps    WHERE idTestCase = %s AND tsEffective <= %s )\n'
+                          'UNION\n'
+                          '( SELECT tsEffective, uidAuthor FROM TestCaseGlobalRsrcDeps \n' \
+                          '  WHERE idTestCase = %s AND tsEffective <= %s )\n'
+                          'ORDER BY tsEffective DESC\n'
+                          'LIMIT %s OFFSET %s\n'
+                          , ( idTestCase, tsNow,
+                              idTestCase, tsNow,
+                              idTestCase, tsNow,
+                              idTestCase, tsNow,
+                              cMaxRows + 1, iStart, ));
+        aaoChanges = self._oDb.fetchAll();
+
+        # 2. Collect data sets for each of those points.
+        #    (Doing it the lazy + inefficient way for now.)
+        aoRows = [];
+        for aoChange in aaoChanges:
+            aoRows.append(TestCaseDataEx().initFromDbWithId(self._oDb, idTestCase, aoChange[0]));
+
+        # 3. Calculate the changes.
+        aoEntries = [];
+        for i in range(0, len(aoRows) - 1):
+            oNew = aoRows[i];
+            oOld = aoRows[i + 1];
+            (tsEffective, uidAuthor) = aaoChanges[i];
+            (tsExpire, _) = aaoChanges[i - 1] if i > 0 else (oNew.tsExpire, None)
+            assert self._oDb.isTsInfinity(tsEffective) != self._oDb.isTsInfinity(tsExpire) or tsEffective < tsExpire, \
+                '%s vs %s' % (tsEffective, tsExpire);
+
+            aoChanges = [];
+
+            # The testcase object.
+            if oNew.tsEffective != oOld.tsEffective:
+                for sAttr in oNew.getDataAttributes():
+                    if sAttr not in [ 'tsEffective', 'tsExpire', 'uidAuthor', \
+                                      'aoTestCaseArgs', 'aoDepTestCases', 'aoDepGlobalResources']:
+                        oOldAttr = getattr(oOld, sAttr);
+                        oNewAttr = getattr(oNew, sAttr);
+                        if oOldAttr != oNewAttr:
+                            aoChanges.append(AttributeChangeEntry(sAttr, oNewAttr, oOldAttr, str(oNewAttr), str(oOldAttr)));
+
+            # The argument variations.
+            iChildOld = 0;
+            for oChildNew in oNew.aoTestCaseArgs:
+                # Locate the old entry, emitting removed markers for old items we have to skip.
+                while iChildOld < len(oOld.aoTestCaseArgs) \
+                  and oOld.aoTestCaseArgs[iChildOld].idTestCaseArgs < oChildNew.idTestCaseArgs:
+                    oChildOld = oOld.aoTestCaseArgs[iChildOld];
+                    aoChanges.append(AttributeChangeEntry('Variation #%s' % (oChildOld.idTestCaseArgs,),
+                                                          None, oChildOld, 'Removed', str(oChildOld)));
+                    iChildOld += 1;
+
+                if    iChildOld < len(oOld.aoTestCaseArgs) \
+                  and oOld.aoTestCaseArgs[iChildOld].idTestCaseArgs == oChildNew.idTestCaseArgs:
+                    oChildOld = oOld.aoTestCaseArgs[iChildOld];
+                    if oChildNew.tsEffective != oChildOld.tsEffective:
+                        for sAttr in oChildNew.getDataAttributes():
+                            if sAttr not in [ 'tsEffective', 'tsExpire', 'uidAuthor', 'idGenTestCase', ]:
+                                oOldAttr = getattr(oChildOld, sAttr);
+                                oNewAttr = getattr(oChildNew, sAttr);
+                                if oOldAttr != oNewAttr:
+                                    aoChanges.append(AttributeChangeEntry('Variation[#%s].%s'
+                                                                          % (oChildOld.idTestCaseArgs, sAttr,),
+                                                                          oNewAttr, oOldAttr,
+                                                                          str(oNewAttr), str(oOldAttr)));
+                    iChildOld += 1;
+                else:
+                    aoChanges.append(AttributeChangeEntry('Variation #%s' % (oChildNew.idTestCaseArgs,),
+                                                          oChildNew, None,
+                                                          str(oChildNew), 'Did not exist'));
+
+            # The testcase dependencies.
+            iChildOld = 0;
+            for oChildNew in oNew.aoDepTestCases:
+                # Locate the old entry, emitting removed markers for old items we have to skip.
+                while iChildOld < len(oOld.aoDepTestCases) \
+                  and oOld.aoDepTestCases[iChildOld].idTestCase < oChildNew.idTestCase:
+                    oChildOld = oOld.aoDepTestCases[iChildOld];
+                    aoChanges.append(AttributeChangeEntry('Dependency #%s' % (oChildOld.idTestCase,),
+                                                          None, oChildOld, 'Removed',
+                                                          '%s (#%u)' % (oChildOld.sName, oChildOld.idTestCase,)));
+                    iChildOld += 1;
+                if    iChildOld < len(oOld.aoDepTestCases) \
+                  and oOld.aoDepTestCases[iChildOld].idTestCase == oChildNew.idTestCase:
+                    iChildOld += 1;
+                else:
+                    aoChanges.append(AttributeChangeEntry('Dependency #%s' % (oChildNew.idTestCase,),
+                                                          oChildNew, None,
+                                                          '%s (#%u)' % (oChildNew.sName, oChildNew.idTestCase,),
+                                                          'Did not exist'));
+
+            # The global resource dependencies.
+            iChildOld = 0;
+            for oChildNew in oNew.aoDepGlobalResources:
+                # Locate the old entry, emitting removed markers for old items we have to skip.
+                while iChildOld < len(oOld.aoDepGlobalResources) \
+                  and oOld.aoDepGlobalResources[iChildOld].idGlobalRsrc < oChildNew.idGlobalRsrc:
+                    oChildOld = oOld.aoDepGlobalResources[iChildOld];
+                    aoChanges.append(AttributeChangeEntry('Global Resource #%s' % (oChildOld.idGlobalRsrc,),
+                                                          None, oChildOld, 'Removed',
+                                                          '%s (#%u)' % (oChildOld.sName, oChildOld.idGlobalRsrc,)));
+                    iChildOld += 1;
+                if    iChildOld < len(oOld.aoDepGlobalResources) \
+                  and oOld.aoDepGlobalResources[iChildOld].idGlobalRsrc == oChildNew.idGlobalRsrc:
+                    iChildOld += 1;
+                else:
+                    aoChanges.append(AttributeChangeEntry('Global Resource #%s' % (oChildNew.idGlobalRsrc,),
+                                                          oChildNew, None,
+                                                          '%s (#%u)' % (oChildNew.sName, oChildNew.idGlobalRsrc,),
+                                                          'Did not exist'));
+
+            # Done.
+            aoEntries.append(ChangeLogEntry(uidAuthor, None, tsEffective, tsExpire, oNew, oOld, aoChanges));
+
+        # If we're at the end of the log, add the initial entry.
+        if len(aoRows) <= cMaxRows and len(aoRows) > 0:
+            oNew = aoRows[-1];
+            aoEntries.append(ChangeLogEntry(oNew.uidAuthor, None,
+                                            aaoChanges[-1][0], aaoChanges[-2][0] if len(aaoChanges) > 1 else oNew.tsExpire,
+                                            oNew, None, []));
+
+        return (UserAccountLogic(self._oDb).resolveChangeLogAuthors(aoEntries), len(aoRows) > cMaxRows);
+
+
+    def addEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Add a new testcase to the DB.
+        """
+
+        #
+        # Validate the input first.
+        #
+        assert isinstance(oData, TestCaseDataEx);
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('Invalid input data: %s' % (dErrors,));
+
+        #
+        # Add the testcase.
+        #
+        self._oDb.callProc('TestCaseLogic_addEntry',
+                           ( uidAuthor, oData.sName, oData.sDescription, oData.fEnabled, oData.cSecTimeout,
+                             oData.sTestBoxReqExpr, oData.sBuildReqExpr, oData.sBaseCmd, oData.sValidationKitZips ));
+        oData.idTestCase = self._oDb.fetchOne()[0];
+
+        # Add testcase dependencies.
+        for oDep in oData.aoDepTestCases:
+            self._oDb.execute('INSERT INTO TestCaseDeps (idTestCase, idTestCasePreReq, uidAuthor) VALUES (%s, %s, %s)'
+                              , (oData.idTestCase, oDep.idTestCase, uidAuthor))
+
+        # Add global resource dependencies.
+        for oDep in oData.aoDepGlobalResources:
+            self._oDb.execute('INSERT INTO TestCaseGlobalRsrcDeps (idTestCase, idGlobalRsrc, uidAuthor) VALUES (%s, %s, %s)'
+                              , (oData.idTestCase, oDep.idGlobalRsrc, uidAuthor))
+
+        # Set Test Case Arguments variations
+        for oVar in oData.aoTestCaseArgs:
+            self._oDb.execute('INSERT INTO TestCaseArgs (\n'
+                             '          idTestCase, uidAuthor, sArgs, cSecTimeout,\n'
+                              '         sTestBoxReqExpr, sBuildReqExpr, cGangMembers)\n'
+                              'VALUES   (%s, %s, %s, %s, %s, %s, %s)'
+                              , ( oData.idTestCase, uidAuthor, oVar.sArgs, oVar.cSecTimeout,
+                                  oVar.sTestBoxReqExpr, oVar.sBuildReqExpr, oVar.cGangMembers,));
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def editEntry(self, oData, uidAuthor, fCommit = False):  # pylint: disable=R0914
+        """
+        Edit a testcase entry (extended).
+        Caller is expected to rollback the database transactions on exception.
+        """
+
+        #
+        # Validate the input.
+        #
+        assert isinstance(oData, TestCaseDataEx);
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('Invalid input data: %s' % (dErrors,));
+
+        #
+        # Did anything change? If not return straight away.
+        #
+        oOldDataEx = TestCaseDataEx().initFromDbWithId(self._oDb, oData.idTestCase);
+        if oOldDataEx.isEqual(oData):
+            self._oDb.maybeCommit(fCommit);
+            return True;
+
+        #
+        # Make the necessary changes.
+        #
+
+        # The test case itself.
+        if not TestCaseData().initFromOther(oOldDataEx).isEqual(oData):
+            self._oDb.callProc('TestCaseLogic_editEntry', ( uidAuthor, oData.idTestCase, oData.sName, oData.sDescription,
+                                                            oData.fEnabled, oData.cSecTimeout, oData.sTestBoxReqExpr,
+                                                            oData.sBuildReqExpr, oData.sBaseCmd, oData.sValidationKitZips ));
+            oData.idGenTestCase = self._oDb.fetchOne()[0];
+
+        #
+        # Its dependencies on other testcases.
+        #
+        aidNewDeps = [oDep.idTestCase for oDep in oData.aoDepTestCases];
+        aidOldDeps = [oDep.idTestCase for oDep in oOldDataEx.aoDepTestCases];
+
+        sQuery = self._oDb.formatBindArgs('UPDATE   TestCaseDeps\n'
+                                          'SET      tsExpire   = CURRENT_TIMESTAMP\n'
+                                          'WHERE    idTestCase = %s\n'
+                                          '     AND tsExpire   = \'infinity\'::timestamp\n'
+                                          , (oData.idTestCase,));
+        asKeepers = [];
+        for idDep in aidOldDeps:
+            if idDep in aidNewDeps:
+                asKeepers.append(str(idDep));
+        if len(asKeepers) > 0:
+            sQuery += '     AND idTestCasePreReq NOT IN (' + ', '.join(asKeepers) + ')\n';
+        self._oDb.execute(sQuery);
+
+        for idDep in aidNewDeps:
+            if idDep not in aidOldDeps:
+                self._oDb.execute('INSERT INTO TestCaseDeps (idTestCase, idTestCasePreReq, uidAuthor)\n'
+                                  'VALUES (%s, %s, %s)\n'
+                                  , (oData.idTestCase, idDep, uidAuthor) );
+
+        #
+        # Its dependencies on global resources.
+        #
+        aidNewDeps = [oDep.idGlobalRsrc for oDep in oData.aoDepGlobalResources];
+        aidOldDeps = [oDep.idGlobalRsrc for oDep in oOldDataEx.aoDepGlobalResources];
+
+        sQuery = self._oDb.formatBindArgs('UPDATE   TestCaseGlobalRsrcDeps\n'
+                                          'SET      tsExpire   = CURRENT_TIMESTAMP\n'
+                                          'WHERE    idTestCase = %s\n'
+                                          '     AND tsExpire   = \'infinity\'::timestamp\n'
+                                          , (oData.idTestCase,));
+        asKeepers = [];
+        for idDep in aidOldDeps:
+            if idDep in aidNewDeps:
+                asKeepers.append(str(idDep));
+        if len(asKeepers) > 0:
+            sQuery = '     AND idGlobalRsrc NOT IN (' + ', '.join(asKeepers) + ')\n';
+        self._oDb.execute(sQuery);
+
+        for idDep in aidNewDeps:
+            if idDep not in aidOldDeps:
+                self._oDb.execute('INSERT INTO TestCaseGlobalRsrcDeps (idTestCase, idGlobalRsrc, uidAuthor)\n'
+                                  'VALUES (%s, %s, %s)\n'
+                                  , (oData.idTestCase, idDep, uidAuthor) );
+
+        #
+        # Update Test Case Args
+        # Note! Primary key is idTestCase, tsExpire, sArgs.
+        #
+
+        # Historize rows that have been removed.
+        sQuery = self._oDb.formatBindArgs('UPDATE TestCaseArgs\n'
+                                          'SET    tsExpire   = CURRENT_TIMESTAMP\n'
+                                          'WHERE  idTestCase = %s\n'
+                                          '   AND tsExpire   = \'infinity\'::TIMESTAMP'
+                                          , (oData.idTestCase, ));
+        for oNewVar in oData.aoTestCaseArgs:
+            asKeepers.append(self._oDb.formatBindArgs('%s', (oNewVar.sArgs,)));
+        if len(asKeepers) > 0:
+            sQuery += '    AND  sArgs NOT IN (' + ', '.join(asKeepers) + ')\n';
+        self._oDb.execute(sQuery);
+
+        # Add new TestCaseArgs records if necessary, reusing old IDs when possible.
+        from testmanager.core.testcaseargs import TestCaseArgsData;
+        for oNewVar in oData.aoTestCaseArgs:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestCaseArgs\n'
+                              'WHERE    idTestCase = %s\n'
+                              '     AND sArgs      = %s\n'
+                              'ORDER BY tsExpire DESC\n'
+                              'LIMIT 1\n'
+                              , (oData.idTestCase, oNewVar.sArgs,));
+            aoRow = self._oDb.fetchOne();
+            if aoRow is None:
+                # New
+                self._oDb.execute('INSERT INTO TestCaseArgs (\n'
+                                 '          idTestCase, uidAuthor, sArgs, cSecTimeout,\n'
+                                  '         sTestBoxReqExpr, sBuildReqExpr, cGangMembers)\n'
+                                  'VALUES   (%s, %s, %s, %s, %s, %s, %s)'
+                                  , ( oData.idTestCase, uidAuthor, oNewVar.sArgs, oNewVar.cSecTimeout,
+                                      oNewVar.sTestBoxReqExpr, oNewVar.sBuildReqExpr, oNewVar.cGangMembers,));
+            else:
+                oCurVar = TestCaseArgsData().initFromDbRow(aoRow);
+                if self._oDb.isTsInfinity(oCurVar.tsExpire):
+                    # Existing current entry, updated if changed.
+                    if    oNewVar.cSecTimeout     == oCurVar.cSecTimeout \
+                      and oNewVar.sTestBoxReqExpr == oCurVar.sTestBoxReqExpr \
+                      and oNewVar.sBuildReqExpr   == oCurVar.sBuildReqExpr \
+                      and oNewVar.cGangMembers    == oCurVar.cGangMembers:
+                        oNewVar.idTestCaseArgs    = oCurVar.idTestCaseArgs;
+                        oNewVar.idGenTestCaseArgs = oCurVar.idGenTestCaseArgs;
+                        continue; # Unchanged.
+                    self._oDb.execute('UPDATE TestCaseArgs SET tsExpire = CURRENT_TIMESTAMP WHERE idGenTestCaseArgs = %s\n'
+                                      , (oCurVar.idGenTestCaseArgs, ));
+                else:
+                    # Existing old entry, re-use the ID.
+                    pass;
+                self._oDb.execute('INSERT INTO TestCaseArgs (\n'
+                                  '         idTestCaseArgs, idTestCase, uidAuthor, sArgs, cSecTimeout,\n'
+                                  '         sTestBoxReqExpr, sBuildReqExpr, cGangMembers)\n'
+                                  'VALUES   (%s, %s, %s, %s, %s, %s, %s, %s)\n'
+                                  'RETURNING idGenTestCaseArgs\n'
+                                  , ( oCurVar.idTestCaseArgs, oData.idTestCase, uidAuthor, oNewVar.sArgs, oNewVar.cSecTimeout,
+                                      oNewVar.sTestBoxReqExpr, oNewVar.sBuildReqExpr, oNewVar.cGangMembers,));
+                oNewVar.idGenTestCaseArgs = self._oDb.fetchOne()[0];
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def removeEntry(self, uidAuthor, idTestCase, fCascade = False, fCommit = False):
+        """ Deletes the test case if possible. """
+        self._oDb.callProc('TestCaseLogic_delEntry', (uidAuthor, idTestCase, fCascade));
+        self._oDb.maybeCommit(fCommit);
+        return True
+
+
+    def getTestCasePreReqIds(self, idTestCase, tsEffective = None, cMax = None):
+        """
+        Returns an array of prerequisite testcases (IDs) for the given testcase.
+        May raise exception on database error or if the result exceeds cMax.
+        """
+        if tsEffective is None:
+            self._oDb.execute('SELECT   idTestCasePreReq\n'
+                              'FROM     TestCaseDeps\n'
+                              'WHERE    idTestCase = %s\n'
+                              '     AND tsExpire   = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idTestCasePreReq\n'
+                              , (idTestCase,) );
+        else:
+            self._oDb.execute('SELECT   idTestCasePreReq\n'
+                              'FROM     TestCaseDeps\n'
+                              'WHERE    idTestCase   = %s\n'
+                              '     AND tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY idTestCasePreReq\n'
+                              , (idTestCase, tsEffective, tsEffective) );
+
+
+        if cMax is not None  and  self._oDb.getRowCount() > cMax:
+            raise TMExceptionBase('Too many prerequisites for testcase %s: %s, max %s'
+                                  % (idTestCase, cMax, self._oDb.getRowCount(),));
+
+        aidPreReqs = [];
+        for aoRow in self._oDb.fetchAll():
+            aidPreReqs.append(aoRow[0]);
+        return aidPreReqs;
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class TestCaseGlobalRsrcDepDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestCaseGlobalRsrcDepData(),];
+
+class TestCaseDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestCaseData(),];
+
+    def testEmptyExpr(self):
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr(None), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr(''), None);
+
+    def testSimpleExpr(self):
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('cMbMemory > 10'), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('cMbScratch < 10'), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('fChipsetIoMmu'), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('fChipsetIoMmu is True'), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('fChipsetIoMmu is False'), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('fChipsetIoMmu is None'), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('isinstance(fChipsetIoMmu, bool)'), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('isinstance(iTestBoxScriptRev, int)'), None);
+        self.assertEqual(TestCaseData.validateTestBoxReqExpr('isinstance(cMbScratch, long)'), None);
+
+    def testBadExpr(self):
+        self.assertNotEqual(TestCaseData.validateTestBoxReqExpr('this is an bad expression, surely it must be'), None);
+        self.assertNotEqual(TestCaseData.validateTestBoxReqExpr('x = 1 + 1'), None);
+        self.assertNotEqual(TestCaseData.validateTestBoxReqExpr('__import__(\'os\').unlink(\'/tmp/no/such/file\')'), None);
+        self.assertNotEqual(TestCaseData.validateTestBoxReqExpr('print "foobar"'), None);
+
+class TestCaseDataExTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestCaseDataEx(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testcaseargs.py b/src/VBox/ValidationKit/testmanager/core/testcaseargs.py
new file mode 100644
index 0000000..8a043ee
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testcaseargs.py
@@ -0,0 +1,356 @@
+# -*- coding: utf-8 -*-
+# $Id: testcaseargs.py $
+
+"""
+Test Manager - Test Case Arguments Variations.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+import sys;
+
+# Validation Kit imports.
+from common                             import utils;
+from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+from testmanager.core.testcase          import TestCaseData, TestCaseDependencyLogic, TestCaseGlobalRsrcDepLogic;
+
+# Python 3 hacks:
+if sys.version_info[0] >= 3:
+    long = int;     # pylint: disable=W0622,C0103
+
+
+class TestCaseArgsData(ModelDataBase):
+    """
+    Test case argument variation.
+    """
+
+    ksIdAttr    = 'idTestCaseArgs';
+    ksIdGenAttr = 'idGenTestCaseArgs';
+
+    ksParam_idTestCase         = 'TestCaseArgs_idTestCase';
+    ksParam_idTestCaseArgs     = 'TestCaseArgs_idTestCaseArgs';
+    ksParam_tsEffective        = 'TestCaseArgs_tsEffective';
+    ksParam_tsExpire           = 'TestCaseArgs_tsExpire';
+    ksParam_uidAuthor          = 'TestCaseArgs_uidAuthor';
+    ksParam_idGenTestCaseArgs  = 'TestCaseArgs_idGenTestCaseArgs';
+    ksParam_sArgs              = 'TestCaseArgs_sArgs';
+    ksParam_cSecTimeout        = 'TestCaseArgs_cSecTimeout';
+    ksParam_sTestBoxReqExpr    = 'TestCaseArgs_sTestBoxReqExpr';
+    ksParam_sBuildReqExpr      = 'TestCaseArgs_sBuildReqExpr';
+    ksParam_cGangMembers       = 'TestCaseArgs_cGangMembers';
+
+    kasAllowNullAttributes      = [ 'idTestCase', 'idTestCaseArgs', 'tsEffective', 'tsExpire', 'uidAuthor', 'idGenTestCaseArgs',
+                                    'cSecTimeout', 'sTestBoxReqExpr', 'sBuildReqExpr', ];
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestCase         = None;
+        self.idTestCaseArgs     = None;
+        self.tsEffective        = None;
+        self.tsExpire           = None;
+        self.uidAuthor          = None;
+        self.idGenTestCaseArgs  = None;
+        self.sArgs              = '';
+        self.cSecTimeout        = None;
+        self.sTestBoxReqExpr    = None;
+        self.sBuildReqExpr      = None;
+        self.cGangMembers       = 1;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the object from a SELECT * FROM TestCaseArgs row.
+        Returns self.  Raises exception if aoRow is None.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('TestBoxStatus not found.');
+
+        self.idTestCase         = aoRow[0];
+        self.idTestCaseArgs     = aoRow[1];
+        self.tsEffective        = aoRow[2];
+        self.tsExpire           = aoRow[3];
+        self.uidAuthor          = aoRow[4];
+        self.idGenTestCaseArgs  = aoRow[5];
+        self.sArgs              = aoRow[6];
+        self.cSecTimeout        = aoRow[7];
+        self.sTestBoxReqExpr    = aoRow[8];
+        self.sBuildReqExpr      = aoRow[9];
+        self.cGangMembers       = aoRow[10];
+        return self;
+
+    def initFromDbWithId(self, oDb, idTestCaseArgs, tsNow = None, sPeriodBack = None):
+        """
+        Initialize from the database.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   TestCaseArgs\n'
+                                                       'WHERE  idTestCaseArgs = %s\n'
+                                                       , ( idTestCaseArgs,), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idTestCaseArgs=%s not found (tsNow=%s sPeriodBack=%s)'
+                                  % (idTestCaseArgs, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+    def initFromDbWithGenId(self, oDb, idGenTestCaseArgs):
+        """
+        Initialize from the database, given the generation ID of a row.
+        """
+        oDb.execute('SELECT * FROM TestCaseArgs WHERE idGenTestCaseArgs = %s', (idGenTestCaseArgs,));
+        return self.initFromDbRow(oDb.fetchOne());
+
+    def initFromValues(self, sArgs, cSecTimeout = None, sTestBoxReqExpr = None, sBuildReqExpr = None,  # pylint: disable=R0913
+                       cGangMembers = 1, idTestCase = None, idTestCaseArgs = None, tsEffective = None, tsExpire = None,
+                       uidAuthor = None, idGenTestCaseArgs = None):
+        """
+        Reinitialize from values.
+        Returns self.
+        """
+        self.idTestCase         = idTestCase;
+        self.idTestCaseArgs     = idTestCaseArgs;
+        self.tsEffective        = tsEffective;
+        self.tsExpire           = tsExpire;
+        self.uidAuthor          = uidAuthor;
+        self.idGenTestCaseArgs  = idGenTestCaseArgs;
+        self.sArgs              = sArgs;
+        self.cSecTimeout        = utils.parseIntervalSeconds(cSecTimeout);
+        self.sTestBoxReqExpr    = sTestBoxReqExpr;
+        self.sBuildReqExpr      = sBuildReqExpr;
+        self.cGangMembers       = cGangMembers;
+        return self;
+
+    def getAttributeParamNullValues(self, sAttr):
+        aoNilValues = ModelDataBase.getAttributeParamNullValues(self, sAttr);
+        if sAttr == 'cSecTimeout':
+            aoNilValues.insert(0, '');  # Prettier NULL value for cSecTimeout.
+        elif sAttr == 'sArgs':
+            aoNilValues = [];           # No NULL value here, thank you.
+        return aoNilValues;
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        if sAttr == 'cSecTimeout' and oValue not in aoNilValues: # Allow human readable interval formats.
+            return utils.parseIntervalSeconds(oValue);
+
+        (oValue, sError) = ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+        if sError is None:
+            if sAttr == 'sTestBoxReqExpr':
+                sError = TestCaseData.validateTestBoxReqExpr(oValue);
+            elif sAttr == 'sBuildReqExpr':
+                sError = TestCaseData.validateBuildReqExpr(oValue);
+        return (oValue, sError);
+
+
+
+
+class TestCaseArgsDataEx(TestCaseArgsData):
+    """
+    Complete data set.
+    """
+
+    def __init__(self):
+        TestCaseArgsData.__init__(self);
+        self.oTestCase          = None;
+        self.aoTestCasePreReqs  = [];
+        self.aoGlobalRsrc       = [];
+
+    def initFromDbRow(self, aoRow):
+        raise TMExceptionBase('Do not call me: %s' % (aoRow,))
+
+    def initFromDbWithId(self, oDb, idTestCaseArgs, tsNow = None, sPeriodBack = None):
+        _ = oDb; _ = idTestCaseArgs; _ = tsNow; _ = sPeriodBack;
+        raise Exception('Not supported.');
+
+    def initFromDbWithGenId(self, oDb, idGenTestCaseArgs):
+        _ = oDb; _ = idGenTestCaseArgs;
+        raise Exception('Use initFromDbWithGenIdEx...');
+
+    def initFromDbWithGenIdEx(self, oDb, idGenTestCaseArgs, tsConfigEff = None, tsRsrcEff = None):
+        """
+        Initialize from the database, given the ID of a row.
+        """
+
+        oDb.execute('SELECT *, CURRENT_TIMESTAMP FROM TestCaseArgs WHERE idGenTestCaseArgs = %s', (idGenTestCaseArgs,));
+        aoRow = oDb.fetchOne();
+        TestCaseArgsData.initFromDbRow(self, aoRow);
+
+        tsNow = aoRow[11];
+        if tsConfigEff is None: tsConfigEff = tsNow;
+        if tsRsrcEff is None:   tsRsrcEff   = tsNow;
+
+        self.oTestCase         = TestCaseData().initFromDbWithId(oDb, self.idTestCase, tsConfigEff);
+        self.aoTestCasePreReqs = TestCaseDependencyLogic(oDb).getTestCaseDeps(self.idTestCase, tsConfigEff);
+        self.aoGlobalRsrc      = TestCaseGlobalRsrcDepLogic(oDb).getTestCaseDeps(self.idTestCase, tsRsrcEff);
+
+        return self;
+
+    def convertFromParamNull(self):
+        raise TMExceptionBase('Not implemented');
+
+    def convertToParamNull(self):
+        raise TMExceptionBase('Not implemented');
+
+    def isEqual(self, oOther):
+        raise TMExceptionBase('Not implemented');
+
+    def matchesTestBoxProps(self, oTestBoxData):
+        """
+        Checks if the all of the testbox related test requirements matches the
+        given testbox.
+
+        Returns True or False according to the expression, None on exception or
+        non-boolean expression result.
+        """
+        return TestCaseData.matchesTestBoxPropsEx(oTestBoxData, self.oTestCase.sTestBoxReqExpr) \
+           and TestCaseData.matchesTestBoxPropsEx(oTestBoxData, self.sTestBoxReqExpr);
+
+    def matchesBuildProps(self, oBuildDataEx):
+        """
+        Checks if the all of the build related test requirements matches the
+        given build.
+
+        Returns True or False according to the expression, None on exception or
+        non-boolean expression result.
+        """
+        return TestCaseData.matchesBuildPropsEx(oBuildDataEx, self.oTestCase.sBuildReqExpr) \
+           and TestCaseData.matchesBuildPropsEx(oBuildDataEx, self.sBuildReqExpr);
+
+
+class TestCaseArgsLogic(ModelLogicBase):
+    """
+    TestCaseArgs database logic.
+    """
+
+    def __init__(self, oDb):
+        ModelLogicBase.__init__(self, oDb);
+
+
+    def areResourcesFree(self, oDataEx):
+        """
+        Checks if all global resources are currently still in existance and free.
+        Returns True/False.  May raise exception on database error.
+        """
+
+        # Create a set of global resource IDs.
+        if len(oDataEx.aoGlobalRsrc) == 0:
+            return True;
+        asIdRsrcs = [str(oDep.idGlobalRsrc) for oDep, _ in oDataEx.aoGlobalRsrc];
+
+        # A record in the resource status table means it's allocated.
+        self._oDb.execute('SELECT   COUNT(*)\n'
+                          'FROM     GlobalResourceStatuses\n'
+                          'WHERE    GlobalResourceStatuses.idGlobalRsrc IN (' + ', '.join(asIdRsrcs) + ')\n');
+        if self._oDb.fetchOne()[0] == 0:
+            # Check for disabled or deleted resources (we cannot allocate them).
+            self._oDb.execute('SELECT   COUNT(*)\n'
+                              'FROM     GlobalResources\n'
+                              'WHERE    GlobalResources.idGlobalRsrc IN (' + ', '.join(asIdRsrcs) + ')\n'
+                              '     AND GlobalResources.tsExpire      = \'infinity\'::TIMESTAMP\n'
+                              '     AND GlobalResources.fEnabled      = TRUE\n');
+            if self._oDb.fetchOne()[0] == len(oDataEx.aoGlobalRsrc):
+                return True;
+        return False;
+
+    def getAll(self):
+        """Get list of objects of type TestCaseArgsData"""
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     TestCaseArgs\n'
+                          'WHERE    tsExpire = \'infinity\'::TIMESTAMP')
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(TestCaseArgsData().initFromDbRow(aoRow))
+
+        return aoRet
+
+    def getTestCaseArgs(self, idTestCase, tsNow = None, aiWhiteList = None):
+        """Get list of testcase's arguments variations"""
+        if aiWhiteList is None:
+            if tsNow is None:
+                self._oDb.execute('SELECT   *\n'
+                                  'FROM     TestCaseArgs\n'
+                                  'WHERE    idTestCase = %s\n'
+                                  '     AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                                  'ORDER BY TestCaseArgs.idTestCaseArgs\n'
+                                  , (idTestCase,));
+            else:
+                self._oDb.execute('SELECT   *\n'
+                                  'FROM     TestCaseArgs\n'
+                                  'WHERE    idTestCase   = %s\n'
+                                  '     AND tsExpire     > %s\n'
+                                  '     AND tsEffective <= %s\n'
+                                  'ORDER BY TestCaseArgs.idTestCaseArgs\n'
+                                  , (idTestCase, tsNow, tsNow));
+        else:
+            sWhiteList = ','.join((str(x) for x in aiWhiteList));
+            if tsNow is None:
+                self._oDb.execute('SELECT   *\n'
+                                  'FROM     TestCaseArgs\n'
+                                  'WHERE    idTestCase = %s\n'
+                                  '     AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                                  '     AND idTestCaseArgs IN (' + sWhiteList + ')\n'
+                                  'ORDER BY TestCaseArgs.idTestCaseArgs\n'
+                                  , (idTestCase,));
+            else:
+                self._oDb.execute('SELECT   *\n'
+                                  'FROM     TestCaseArgs\n'
+                                  'WHERE    idTestCase   = %s\n'
+                                  '     AND tsExpire     > %s\n'
+                                  '     AND tsEffective <= %s\n'
+                                  '     AND idTestCaseArgs IN (' + sWhiteList + ')\n'
+                                  'ORDER BY TestCaseArgs.idTestCaseArgs\n'
+                                  , (idTestCase, tsNow, tsNow));
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(TestCaseArgsData().initFromDbRow(aoRow))
+
+        return aoRet
+
+    def addTestCaseArgs(self, oTestCaseArgsData):
+        """Add Test Case Args record into DB"""
+        pass
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class TestCaseArgsDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestCaseArgsData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testgroup.py b/src/VBox/ValidationKit/testmanager/core/testgroup.py
new file mode 100644
index 0000000..e9abc90
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testgroup.py
@@ -0,0 +1,718 @@
+# -*- coding: utf-8 -*-
+# $Id: testgroup.py $
+
+"""
+Test Manager - Test groups management.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase
+from testmanager.core.testcase          import TestCaseData, TestCaseDataEx;
+
+
+class TestGroupMemberData(ModelDataBase):
+    """Representation of a test group member database row."""
+
+    ksParam_idTestGroup         = 'TestGroupMember_idTestGroup';
+    ksParam_idTestCase          = 'TestGroupMember_idTestCase';
+    ksParam_tsEffective         = 'TestGroupMember_tsEffective';
+    ksParam_tsExpire            = 'TestGroupMember_tsExpire';
+    ksParam_uidAuthor           = 'TestGroupMember_uidAuthor';
+    ksParam_iSchedPriority      = 'TestGroupMember_iSchedPriority';
+    ksParam_aidTestCaseArgs     = 'TestGroupMember_aidTestCaseArgs';
+
+    kasAllowNullAttributes      = ['idTestGroup', 'idTestCase', 'tsEffective', 'tsExpire', 'uidAuthor', 'aidTestCaseArgs' ];
+    kiMin_iSchedPriority        = 0;
+    kiMax_iSchedPriority        = 31;
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self)
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestGroup        = None;
+        self.idTestCase         = None;
+        self.tsEffective        = None;
+        self.tsExpire           = None;
+        self.uidAuthor          = None;
+        self.iSchedPriority     = 16;
+        self.aidTestCaseArgs    = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestCaseGroupMembers.
+        Return self. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test group member not found.')
+
+        self.idTestGroup     = aoRow[0];
+        self.idTestCase      = aoRow[1];
+        self.tsEffective     = aoRow[2];
+        self.tsExpire        = aoRow[3];
+        self.uidAuthor       = aoRow[4];
+        self.iSchedPriority  = aoRow[5];
+        self.aidTestCaseArgs = aoRow[6];
+        return self
+
+
+    def getAttributeParamNullValues(self, sAttr):
+        # Arrays default to [] as NULL currently. That doesn't work for us.
+        if sAttr == 'aidTestCaseArgs':
+            aoNilValues = [None, '-1'];
+        else:
+            aoNilValues = ModelDataBase.getAttributeParamNullValues(self, sAttr);
+        return aoNilValues;
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        if sAttr != 'aidTestCaseArgs':
+            return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+
+        # -1 is a special value, which when present make the whole thing NULL (None).
+        (aidVariations, sError) = self.validateListOfInts(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull,
+                                                          iMin = -1, iMax = 0x7ffffffe);
+        if sError is None:
+            if aidVariations is None:
+                pass;
+            elif -1 in aidVariations:
+                aidVariations = None;
+            elif 0 in aidVariations:
+                sError = 'Invalid test case varation ID #0.';
+            else:
+                aidVariations = sorted(aidVariations);
+        return (aidVariations, sError);
+
+
+
+class TestGroupMemberDataEx(TestGroupMemberData):
+    """Extended representation of a test group member."""
+
+    def __init__(self):
+        """Extend parent class"""
+        TestGroupMemberData.__init__(self)
+        self.oTestCase = None; # TestCaseDataEx.
+
+    def initFromDbRowEx(self, aoRow, oDb, tsNow = None):
+        """
+        Reinitialize from a SELECT * FROM TestGroupMembers, TestCases row.
+        Will query the necessary additional data from oDb using tsNow.
+
+        Returns self.  Raises exception if no row or database error.
+        """
+        TestGroupMemberData.initFromDbRow(self, aoRow);
+        self.oTestCase = TestCaseDataEx();
+        self.oTestCase.initFromDbRowEx(aoRow[7:], oDb, tsNow);
+        return self;
+
+    def initFromParams(self, oDisp, fStrict = True):
+        self.oTestCase = None;
+        return TestGroupMemberData.initFromParams(self, oDisp, fStrict);
+
+    def getDataAttributes(self):
+        asAttributes = TestGroupMemberData.getDataAttributes(self);
+        asAttributes.remove('oTestCase');
+        return asAttributes;
+
+    def _validateAndConvertWorker(self, asAllowNullAttributes, oDb):
+        dErrors = TestGroupMemberData._validateAndConvertWorker(self, asAllowNullAttributes, oDb);
+        if self.ksParam_idTestCase not in dErrors:
+            self.oTestCase = TestCaseDataEx()
+            try:
+                self.oTestCase.initFromDbWithId(oDb, self.idTestCase);
+            except Exception as oXcpt:
+                self.oTestCase = TestCaseDataEx()
+                dErrors[self.ksParam_idTestCase] = str(oXcpt);
+        return dErrors;
+
+
+class TestGroupMemberData2(TestCaseData):
+    """Special representation of a Test Group Member item"""
+
+    def __init__(self):
+        """Extend parent class"""
+        TestCaseData.__init__(self)
+        self.idTestGroup = None
+        self.aidTestCaseArgs = []
+
+    def initFromDbRowEx(self, aoRow):
+        """
+        Reinitialize from a :WRONG QUERY:
+
+            SELECT TestCases.idTestCase,
+                   TestGroupMembers.tsEffective,
+                   TestGroupMembers.tsExpire,
+                   TestGroupMembers.uidAuthor,
+                   TestCases.idGenTestCase,
+                   TestCases.sName,
+                   TestCases.sDescription,
+                   TestCases.fEnabled,
+                   TestCases.cSecTimeout,
+                   TestCases.sBaseCmd,
+                   TestCases.sValidationKitZips,
+                   TestGroupMembers.idTestGroup,
+                   TestGroupMembers.aidTestCaseArgs
+            FROM TestCases, TestGroupMembers
+            WHERE TestCases.idTestCase = TestGroupMembers.idTestCase
+
+        ..row. Represents complete test group member (test case) info.
+        Returns object of type TestGroupMemberData2. Raises exception if no row.
+        """
+        TestCaseData.initFromDbRow(self, aoRow);
+        self.idTestGroup     = aoRow[-2]
+        self.aidTestCaseArgs = aoRow[-1]
+        return self;
+
+
+class TestGroupData(ModelDataBase):
+    """
+    Test group data.
+    """
+
+    ksIdAttr    = 'idTestGroup';
+
+    ksParam_idTestGroup     = 'TestGroup_idTestGroup'
+    ksParam_tsEffective     = 'TestGroup_tsEffective'
+    ksParam_tsExpire        = 'TestGroup_tsExpire'
+    ksParam_uidAuthor       = 'TestGroup_uidAuthor'
+    ksParam_sName           = 'TestGroup_sName'
+    ksParam_sDescription    = 'TestGroup_sDescription'
+
+    kasAllowNullAttributes      = ['idTestGroup', 'tsEffective', 'tsExpire', 'uidAuthor', 'sDescription' ];
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestGroup     = None
+        self.tsEffective     = None
+        self.tsExpire        = None
+        self.uidAuthor       = None
+        self.sName           = None
+        self.sDescription    = None
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestGroups row.
+        Returns object of type TestGroupData. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test group not found.')
+
+        self.idTestGroup     = aoRow[0]
+        self.tsEffective     = aoRow[1]
+        self.tsExpire        = aoRow[2]
+        self.uidAuthor       = aoRow[3]
+        self.sName           = aoRow[4]
+        self.sDescription    = aoRow[5]
+        return self
+
+    def initFromDbWithId(self, oDb, idTestGroup, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   TestGroups\n'
+                                                       'WHERE  idTestGroup = %s\n'
+                                                       , ( idTestGroup,), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idTestGroup=%s not found (tsNow=%s sPeriodBack=%s)' % (idTestGroup, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+
+class TestGroupDataEx(TestGroupData):
+    """
+    Extended test group data.
+    """
+
+    ksParam_aoMembers    = 'TestGroupDataEx_aoMembers';
+    kasAltArrayNull      = [ 'aoMembers', ];
+
+    ## Helper parameter containing the comma separated list with the IDs of
+    #  potential members found in the parameters.
+    ksParam_aidTestCases = 'TestGroupDataEx_aidTestCases';
+
+
+    def __init__(self):
+        TestGroupData.__init__(self);
+        self.aoMembers = []; # TestGroupMemberDataEx.
+
+    def _initExtraMembersFromDb(self, oDb, tsNow = None, sPeriodBack = None):
+        """
+        Worker shared by the initFromDb* methods.
+        Returns self.  Raises exception if no row or database error.
+        """
+        self.aoMembers = [];
+        _ = sPeriodBack; ## @todo sPeriodBack
+
+        if tsNow is None:
+            oDb.execute('SELECT TestGroupMembers.*, TestCases.*\n'
+                        'FROM   TestGroupMembers\n'
+                        'LEFT OUTER JOIN TestCases ON (\n'
+                        '       TestGroupMembers.idTestCase  = TestCases.idTestCase\n'
+                        '   AND TestCases.tsExpire           = \'infinity\'::TIMESTAMP)\n'
+                        'WHERE  TestGroupMembers.idTestGroup = %s\n'
+                        '   AND TestGroupMembers.tsExpire    = \'infinity\'::TIMESTAMP\n'
+                        'ORDER BY TestCases.sName, TestCases.idTestCase\n'
+                        , (self.idTestGroup,));
+        else:
+            oDb.execute('SELECT TestGroupMembers.*, TestCases.*\n'
+                        'FROM   TestGroupMembers\n'
+                        'LEFT OUTER JOIN TestCases ON (\n'
+                        '       TestGroupMembers.idTestCase = TestCases.idTestCase\n'
+                        '   AND TestCases.tsExpire            > %s\n'
+                        '   AND TestCases.tsEffective        <= %s)\n'
+                        'WHERE  TestGroupMembers.idTestGroup  = %s\n'
+                        '   AND TestGroupMembers.tsExpire     > %s\n'
+                        '   AND TestGroupMembers.tsEffective <= %s\n'
+                        'ORDER BY TestCases.sName, TestCases.idTestCase\n'
+                        , (tsNow, tsNow, self.idTestGroup, tsNow, tsNow));
+
+        for aoRow in oDb.fetchAll():
+            self.aoMembers.append(TestGroupMemberDataEx().initFromDbRowEx(aoRow, oDb, tsNow));
+        return self;
+
+    def initFromDbRowEx(self, aoRow, oDb, tsNow = None, sPeriodBack = None):
+        """
+        Reinitialize from a SELECT * FROM TestGroups row.  Will query the
+        necessary additional data from oDb using tsNow.
+        Returns self.  Raises exception if no row or database error.
+        """
+        TestGroupData.initFromDbRow(self, aoRow);
+        return self._initExtraMembersFromDb(oDb, tsNow, sPeriodBack);
+
+    def initFromDbWithId(self, oDb, idTestGroup, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        TestGroupData.initFromDbWithId(self, oDb, idTestGroup, tsNow, sPeriodBack);
+        return self._initExtraMembersFromDb(oDb, tsNow, sPeriodBack);
+
+
+    def getAttributeParamNullValues(self, sAttr):
+        if sAttr != 'aoMembers':
+            return TestGroupData.getAttributeParamNullValues(self, sAttr);
+        return ['', [], None];
+
+    def convertParamToAttribute(self, sAttr, sParam, oValue, oDisp, fStrict):
+        if sAttr != 'aoMembers':
+            return TestGroupData.convertParamToAttribute(self, sAttr, sParam, oValue, oDisp, fStrict);
+
+        aoNewValue  = [];
+        aidSelected = oDisp.getListOfIntParams(sParam, iMin = 1, iMax = 0x7ffffffe, aiDefaults = [])
+        sIds        = oDisp.getStringParam(self.ksParam_aidTestCases, sDefault = '');
+        for idTestCase in sIds.split(','):
+            try:    idTestCase = int(idTestCase);
+            except: pass;
+            oDispWrapper = self.DispWrapper(oDisp, '%s[%s][%%s]' % (TestGroupDataEx.ksParam_aoMembers, idTestCase,))
+            oMember = TestGroupMemberDataEx().initFromParams(oDispWrapper, fStrict = False);
+            if idTestCase in aidSelected:
+                aoNewValue.append(oMember);
+        return aoNewValue;
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        if sAttr != 'aoMembers':
+            return TestGroupData._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+
+        asErrors     = [];
+        aoNewMembers = [];
+        for oOldMember in oValue:
+            oNewMember = TestGroupMemberDataEx().initFromOther(oOldMember);
+            aoNewMembers.append(oNewMember);
+
+            dErrors = oNewMember.validateAndConvert(oDb);
+            if len(dErrors) > 0:
+                asErrors.append(str(dErrors));
+
+        if len(asErrors) == 0:
+            for i in range(len(aoNewMembers)):
+                idTestCase = aoNewMembers[i];
+                for j in range(i + 1, len(aoNewMembers)):
+                    if aoNewMembers[j].idTestCase == idTestCase:
+                        asErrors.append('Duplicate testcase #%d!' % (idTestCase, ));
+                        break;
+
+        return (aoNewMembers, None if len(asErrors) == 0 else '<br>\n'.join(asErrors));
+
+
+class TestGroupLogic(ModelLogicBase):
+    """
+    Test case management logic.
+    """
+
+    #
+    # Standard methods.
+    #
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches test groups.
+
+        Returns an array (list) of TestGroupDataEx items, empty list if none.
+        Raises exception on error.
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestGroups\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sName ASC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestGroups\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY sName ASC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRet = [];
+        for aoRow in self._oDb.fetchAll():
+            aoRet.append(TestGroupDataEx().initFromDbRowEx(aoRow, self._oDb, tsNow));
+        return aoRet;
+
+    def addEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Adds a testgroup to the database.
+        """
+
+        #
+        # Validate inputs.
+        #
+        assert isinstance(oData, TestGroupDataEx);
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('addEntry invalid input: %s' % (dErrors,));
+        self._assertUniq(oData, None);
+
+        #
+        # Do the job.
+        #
+        self._oDb.execute('INSERT INTO TestGroups (uidAuthor, sName, sDescription)\n'
+                          'VALUES (%s, %s, %s)\n'
+                          'RETURNING idTestGroup\n'
+                          , ( uidAuthor,
+                              oData.sName,
+                              oData.sDescription,));
+        idTestGroup = self._oDb.fetchOne()[0];
+        oData.idTestGroup = idTestGroup;
+
+        for oMember in oData.aoMembers:
+            oMember.idTestGroup = idTestGroup;
+            self._insertTestGroupMember(uidAuthor, oMember)
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def editEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Modifies a test group.
+        """
+
+        #
+        # Validate inputs and read in the old(/current) data.
+        #
+        assert isinstance(oData, TestGroupDataEx);
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) > 0:
+            raise TMExceptionBase('editEntry invalid input: %s' % (dErrors,));
+        self._assertUniq(oData, oData.idTestGroup);
+
+        oOldData = TestGroupDataEx().initFromDbWithId(self._oDb, oData.idTestGroup);
+
+        #
+        # Update the data that needs updating.
+        #
+
+        if not oData.isEqualEx(oOldData, [ 'aoMembers', 'tsEffective', 'tsExpire', 'uidAuthor', ]):
+            self._historizeTestGroup(oData.idTestGroup);
+            self._oDb.execute('INSERT INTO TestGroups\n'
+                              '       (uidAuthor, idTestGroup, sName, sDescription)\n'
+                              'VALUES (%s, %s, %s, %s)\n'
+                              , ( uidAuthor,
+                                  oData.idTestGroup,
+                                  oData.sName,
+                                  oData.sDescription, ));
+
+        # Create a lookup dictionary for old entries.
+        dOld = {};
+        for oOld in oOldData.aoMembers:
+            dOld[oOld.idTestCase] = oOld;
+        assert len(dOld) == len(oOldData.aoMembers);
+
+        # Add new members, updated existing ones.
+        dNew = {};
+        for oNewMember in oData.aoMembers:
+            oNewMember.idTestGroup = oData.idTestGroup;
+            if oNewMember.idTestCase in dNew:
+                raise TMExceptionBase('Duplicate test group member: idTestCase=%d (%s / %s)'
+                                      % (oNewMember.idTestCase, oNewMember, dNew[oNewMember.idTestCase],));
+            dNew[oNewMember.idTestCase] = oNewMember;
+
+            oOldMember = dOld.get(oNewMember.idTestCase, None);
+            if oOldMember is not None:
+                if oNewMember.isEqualEx(oOldMember, [ 'uidAuthor', 'tsEffective', 'tsExpire' ]):
+                    continue; # Skip, nothing changed.
+                self._historizeTestGroupMember(oData.idTestGroup, oNewMember.idTestCase);
+            self._insertTestGroupMember(uidAuthor, oNewMember);
+
+        # Expire members that have been removed.
+        sQuery = self._oDb.formatBindArgs('UPDATE TestGroupMembers\n'
+                                          'SET    tsExpire    = CURRENT_TIMESTAMP\n'
+                                          'WHERE  idTestGroup = %s\n'
+                                          '   AND tsExpire    = \'infinity\'::TIMESTAMP\n'
+                                          , ( oData.idTestGroup, ));
+        if len(dNew) > 0:
+            sQuery += '   AND idTestCase NOT IN (%s)' % (', '.join([str(iKey) for iKey in dNew.keys()]),);
+        self._oDb.execute(sQuery);
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def removeEntry(self, uidAuthor, idTestGroup, fCascade = False, fCommit = False):
+        """
+        Deletes a test group.
+        """
+        _ = uidAuthor; ## @todo record uidAuthor.
+
+        #
+        # Cascade.
+        #
+        if fCascade is not True:
+            self._oDb.execute('SELECT   SchedGroups.idSchedGroup, SchedGroups.sName\n'
+                              'FROM     SchedGroupMembers, SchedGroups\n'
+                              'WHERE    SchedGroupMembers.idTestGroup = %s\n'
+                              '     AND SchedGroupMembers.tsExpire    = \'infinity\'::TIMESTAMP\n'
+                              '     AND SchedGroups.idSchedGroup      = SchedGroupMembers.idSchedGroup\n'
+                              '     AND SchedGroups.tsExpire          = \'infinity\'::TIMESTAMP\n'
+                              , ( idTestGroup, ));
+            aoGroups = self._oDb.fetchAll();
+            if len(aoGroups) > 0:
+                asGroups = ['%s (#%d)' % (sName, idSchedGroup) for idSchedGroup, sName in aoGroups];
+                raise TMExceptionBase('Test group #%d is member of one ore more scheduling groups: %s'
+                                      % (idTestGroup, ', '.join(asGroups),));
+        else:
+            self._oDb.execute('UPDATE   SchedGroupMembers\n'
+                              'SET      tsExpire = CURRENT_TIMESTAMP\n'
+                              'WHERE    idTestGroup = %s\n'
+                              '     AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                              , ( idTestGroup, ));
+
+        #
+        # Remove the group.
+        #
+        self._oDb.execute('UPDATE   TestGroupMembers\n'
+                          'SET      tsExpire    = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestGroup = %s\n'
+                          '     AND tsExpire    = \'infinity\'::TIMESTAMP\n'
+                          , (idTestGroup,))
+        self._oDb.execute('UPDATE   TestGroups\n'
+                          'SET      tsExpire    = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestGroup = %s\n'
+                          '     AND tsExpire    = \'infinity\'::TIMESTAMP\n'
+                          , (idTestGroup,))
+
+        self._oDb.maybeCommit(fCommit)
+        return True;
+
+
+    #
+    # Other methods.
+    #
+
+    def fetchOrderedByName(self, tsNow = None):
+        """
+        Return list of objects of type TestGroupData ordered by name.
+        May raise exception on database error.
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestGroups\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sName ASC\n');
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestGroups\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '   AND   tsEffective <= %s\n'
+                              'ORDER BY sName ASC\n'
+                              , (tsNow, tsNow,));
+        aoRet = []
+        for _ in range(self._oDb.getRowCount()):
+            aoRet.append(TestGroupData().initFromDbRow(self._oDb.fetchOne()));
+        return aoRet;
+
+    def getMembers(self, idTestGroup):
+        """
+        Fetches all test case records from DB which are
+        belong to current Test Group.
+        Returns list of objects of type TestGroupMemberData2 (!).
+        """
+        self._oDb.execute('SELECT TestCases.*,\n'
+                          '       TestGroupMembers.idTestGroup,\n'
+                          '       TestGroupMembers.aidTestCaseArgs\n'
+                          'FROM   TestCases, TestGroupMembers\n'
+                          'WHERE  TestCases.tsExpire = \'infinity\'::TIMESTAMP\n'
+                          '   AND TestGroupMembers.tsExpire = \'infinity\'::TIMESTAMP\n'
+                          '   AND TestGroupMembers.idTestCase = TestCases.idTestCase\n'
+                          '   AND TestGroupMembers.idTestGroup = %s\n'
+                          'ORDER BY TestCases.idTestCase ASC;',
+                          (idTestGroup,))
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(TestGroupMemberData2().initFromDbRowEx(aoRow))
+
+        return aoRet
+
+    def getAll(self, tsNow=None):
+        """Return list of objects of type TestGroupData"""
+
+        if tsNow is None:
+            self._oDb.execute('SELECT *\n'
+                              'FROM   TestGroups\n'
+                              'WHERE  tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY idTestGroup ASC;')
+        else:
+            self._oDb.execute('SELECT *\n'
+                              'FROM   TestGroups\n'
+                              'WHERE  tsExpire     > %s\n'
+                              '   AND tsEffective <= %s\n'
+                              'ORDER BY idTestGroup ASC;',
+                              (tsNow, tsNow))
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(TestGroupData().initFromDbRow(aoRow))
+
+        return aoRet
+
+    def getById(self, idTestGroup, tsNow=None):
+        """Get Test Group data by its ID"""
+
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestGroups\n'
+                              'WHERE    tsExpire     = \'infinity\'::timestamp\n'
+                              '  AND    idTestGroup  = %s\n'
+                              'ORDER BY idTestGroup ASC;', (idTestGroup,))
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     TestGroups\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '  AND    tsEffective <= %s\n'
+                              '  AND    idTestGroup  = %s\n'
+                              'ORDER BY idTestGroup ASC;',
+                              (tsNow, tsNow, idTestGroup))
+
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise TMExceptionBase('Found more than one test groups with the same credentials. Database structure is corrupted.')
+        try:
+            return TestGroupData().initFromDbRow(aRows[0])
+        except IndexError:
+            return None
+
+    #
+    # Helpers.
+    #
+
+    def _assertUniq(self, oData, idTestGroupIgnore):
+        """ Checks that the test group name is unique, raises exception if it isn't. """
+        self._oDb.execute('SELECT idTestGroup\n'
+                          'FROM   TestGroups\n'
+                          'WHERE  sName    = %s\n'
+                          '   AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                          + ('' if idTestGroupIgnore is None else  '   AND idTestGroup <> %d\n' % (idTestGroupIgnore,))
+                          , ( oData.sName, ))
+        if self._oDb.getRowCount() > 0:
+            raise TMExceptionBase('A Test group with name "%s" already exist.' % (oData.sName,));
+        return True;
+
+    def _historizeTestGroup(self, idTestGroup):
+        """ Historize Test Group record. """
+        self._oDb.execute('UPDATE   TestGroups\n'
+                          'SET      tsExpire    = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestGroup = %s\n'
+                          '     AND tsExpire    = \'infinity\'::TIMESTAMP\n'
+                          , ( idTestGroup, ));
+        return True;
+
+    def _historizeTestGroupMember(self, idTestGroup, idTestCase):
+        """ Historize Test Group Member record. """
+        self._oDb.execute('UPDATE   TestGroupMembers\n'
+                          'SET      tsExpire    = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestGroup = %s\n'
+                          '     AND idTestCase  = %s\n'
+                          '     AND tsExpire    = \'infinity\'::timestamp\n'
+                          , (idTestGroup, idTestCase,));
+        return True;
+
+    def _insertTestGroupMember(self, uidAuthor, oMember):
+        """ Inserts a test group member. """
+        self._oDb.execute('INSERT INTO TestGroupMembers\n'
+                          '       (uidAuthor, idTestGroup, idTestCase, iSchedPriority, aidTestCaseArgs)\n'
+                          'VALUES (%s, %s, %s, %s, %s)\n'
+                          , ( uidAuthor,
+                              oMember.idTestGroup,
+                              oMember.idTestCase,
+                              oMember.iSchedPriority,
+                              oMember.aidTestCaseArgs, ));
+        return True;
+
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class TestGroupMemberDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestGroupMemberData(),];
+
+class TestGroupDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestGroupData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testresults.py b/src/VBox/ValidationKit/testmanager/core/testresults.py
new file mode 100644
index 0000000..9dde4ed
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testresults.py
@@ -0,0 +1,1613 @@
+# -*- coding: utf-8 -*-
+# $Id: testresults.py $
+# pylint: disable=C0302
+
+## @todo Rename this file to testresult.py!
+
+"""
+Test Manager - Fetch test results.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96526 $"
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from common                         import constants;
+from testmanager                    import config;
+from testmanager.core.base          import ModelDataBase, ModelLogicBase, ModelDataBaseTestCase, TMExceptionBase, TMTooManyRows;
+from testmanager.core.testgroup     import TestGroupData
+from testmanager.core.build         import BuildDataEx
+from testmanager.core.testbox       import TestBoxData
+from testmanager.core.testcase      import TestCaseData
+from testmanager.core.schedgroup    import SchedGroupData
+from testmanager.core.systemlog     import SystemLogData, SystemLogLogic;
+
+
+class TestResultData(ModelDataBase):
+    """
+    Test case execution result data
+    """
+
+    ## @name TestStatus_T
+    # @{
+    ksTestStatus_Running    = 'running';
+    ksTestStatus_Success    = 'success';
+    ksTestStatus_Skipped    = 'skipped';
+    ksTestStatus_BadTestBox = 'bad-testbox';
+    ksTestStatus_Aborted    = 'aborted';
+    ksTestStatus_Failure    = 'failure';
+    ksTestStatus_TimedOut   = 'timed-out';
+    ksTestStatus_Rebooted   = 'rebooted';
+    ## @}
+
+    ## List of relatively harmless (to testgroup/case) statuses.
+    kasHarmlessTestStatuses = [ ksTestStatus_Skipped, ksTestStatus_BadTestBox, ksTestStatus_Aborted, ];
+    ## List of bad statuses.
+    kasBadTestStatuses      = [ ksTestStatus_Failure, ksTestStatus_TimedOut,   ksTestStatus_Rebooted, ];
+
+
+    ksIdAttr    = 'idTestResult';
+
+    ksParam_idTestResult        = 'TestResultData_idTestResult';
+    ksParam_idTestResultParent  = 'TestResultData_idTestResultParent';
+    ksParam_idTestSet           = 'TestResultData_idTestSet';
+    ksParam_tsCreated           = 'TestResultData_tsCreated';
+    ksParam_tsElapsed           = 'TestResultData_tsElapsed';
+    ksParam_idStrName           = 'TestResultData_idStrName';
+    ksParam_cErrors             = 'TestResultData_cErrors';
+    ksParam_enmStatus           = 'TestResultData_enmStatus';
+    ksParam_iNestingDepth       = 'TestResultData_iNestingDepth';
+    kasValidValues_enmStatus    = [
+        ksTestStatus_Running,
+        ksTestStatus_Success,
+        ksTestStatus_Skipped,
+        ksTestStatus_BadTestBox,
+        ksTestStatus_Aborted,
+        ksTestStatus_Failure,
+        ksTestStatus_TimedOut,
+        ksTestStatus_Rebooted
+    ];
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self)
+        self.idTestResult       = None
+        self.idTestResultParent = None
+        self.idTestSet          = None
+        self.tsCreated          = None
+        self.tsElapsed          = None
+        self.idStrName          = None
+        self.cErrors            = 0;
+        self.enmStatus          = None
+        self.iNestingDepth      = None
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestResults.
+        Return self. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test result record not found.')
+
+        self.idTestResult       = aoRow[0]
+        self.idTestResultParent = aoRow[1]
+        self.idTestSet          = aoRow[2]
+        self.tsCreated          = aoRow[3]
+        self.tsElapsed          = aoRow[4]
+        self.idStrName          = aoRow[5]
+        self.cErrors            = aoRow[6]
+        self.enmStatus          = aoRow[7]
+        self.iNestingDepth      = aoRow[8]
+        return self;
+
+    def isFailure(self):
+        """ Check if it's a real failure. """
+        return self.enmStatus in self.kasBadTestStatuses;
+
+
+class TestResultDataEx(TestResultData):
+    """
+    Extended test result data class.
+
+    This is intended for use as a node in a result tree.  This is not intended
+    for serialization to parameters or vice versa.  Use TestResultLogic to
+    construct the tree.
+    """
+
+    def __init__(self):
+        TestResultData.__init__(self)
+        self.sName      = None; # idStrName resolved.
+        self.oParent    = None; # idTestResultParent within the tree.
+
+        self.aoChildren = [];   # TestResultDataEx;
+        self.aoValues   = [];   # TestResultValue;
+        self.aoMsgs     = [];   # TestResultMsg;
+        self.aoFiles    = [];   # TestResultFile;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Initialize from a query like this:
+            SELECT TestResults.*, TestResultStrTab.sValue
+            FROM TestResults, TestResultStrTab
+            WHERE TestResultStrTab.idStr = TestResults.idStrName
+
+        Note! The caller is expected to fetch children, values, failure
+              details, and files.
+        """
+        self.sName      = None;
+        self.oParent    = None;
+        self.aoChildren = [];
+        self.aoValues   = [];
+        self.aoMsgs     = [];
+        self.aoFiles    = [];
+
+        TestResultData.initFromDbRow(self, aoRow);
+
+        self.sName = aoRow[9];
+        return self;
+
+
+class TestResultValueData(ModelDataBase):
+    """
+    Test result value data.
+    """
+
+    ksIdAttr    = 'idTestResultValue';
+
+    ksParam_idTestResultValue   = 'TestResultValue_idTestResultValue';
+    ksParam_idTestResult        = 'TestResultValue_idTestResult';
+    ksParam_idTestSet           = 'TestResultValue_idTestSet';
+    ksParam_tsCreated           = 'TestResultValue_tsCreated';
+    ksParam_idStrName           = 'TestResultValue_idStrName';
+    ksParam_lValue              = 'TestResultValue_lValue';
+    ksParam_iUnit               = 'TestResultValue_iUnit';
+
+    def __init__(self):
+        ModelDataBase.__init__(self)
+        self.idTestResultValue  = None;
+        self.idTestResult       = None;
+        self.idTestSet          = None;
+        self.tsCreated          = None;
+        self.idStrName          = None;
+        self.lValue             = None;
+        self.iUnit              = 0;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestResultValues.
+        Return self. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test result value record not found.')
+
+        self.idTestResultValue  = aoRow[0];
+        self.idTestResult       = aoRow[1];
+        self.idTestSet          = aoRow[2];
+        self.tsCreated          = aoRow[3];
+        self.idStrName          = aoRow[4];
+        self.lValue             = aoRow[5];
+        self.iUnit              = aoRow[6];
+        return self;
+
+
+class TestResultValueDataEx(TestResultValueData):
+    """
+    Extends TestResultValue by resolving the value name and unit string.
+    """
+
+    def __init__(self):
+        TestResultValueData.__init__(self)
+        self.sName = None;
+        self.sUnit = '';
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a query like this:
+            SELECT TestResultValues.*, TestResultStrTab.sValue
+            FROM TestResultValues, TestResultStrTab
+            WHERE TestResultStrTab.idStr = TestResultValues.idStrName
+
+        Return self. Raises exception if no row.
+        """
+        TestResultValueData.initFromDbRow(self, aoRow);
+        self.sName = aoRow[7];
+        if self.iUnit < len(constants.valueunit.g_asNames):
+            self.sUnit = constants.valueunit.g_asNames[self.iUnit];
+        else:
+            self.sUnit = '<%d>' % (self.iUnit,);
+        return self;
+
+class TestResultMsgData(ModelDataBase):
+    """
+    Test result message data.
+    """
+
+    ksIdAttr    = 'idTestResultMsg';
+
+    ksParam_idTestResultMsg    = 'TestResultValue_idTestResultMsg';
+    ksParam_idTestResult       = 'TestResultValue_idTestResult';
+    ksParam_tsCreated          = 'TestResultValue_tsCreated';
+    ksParam_idStrMsg           = 'TestResultValue_idStrMsg';
+    ksParam_enmLevel           = 'TestResultValue_enmLevel';
+
+    def __init__(self):
+        ModelDataBase.__init__(self)
+        self.idTestResultMsg    = None;
+        self.idTestResult       = None;
+        self.tsCreated          = None;
+        self.idStrMsg           = None;
+        self.enmLevel           = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestResultMsgs.
+        Return self. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test result value record not found.')
+
+        self.idTestResultMsg    = aoRow[0];
+        self.idTestResult       = aoRow[1];
+        self.tsCreated          = aoRow[2];
+        self.idStrMsg           = aoRow[3];
+        self.enmLevel           = aoRow[4];
+        return self;
+
+class TestResultMsgDataEx(TestResultMsgData):
+    """
+    Extends TestResultMsg by resolving the message string.
+    """
+
+    def __init__(self):
+        TestResultMsgData.__init__(self)
+        self.sMsg = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a query like this:
+            SELECT TestResultMsg.*, TestResultStrTab.sValue
+            FROM   TestResultMsg, TestResultStrTab
+            WHERE  TestResultStrTab.idStr = TestResultMsgs.idStrName
+
+        Return self. Raises exception if no row.
+        """
+        TestResultMsgData.initFromDbRow(self, aoRow);
+        self.sMsg = aoRow[5];
+        return self;
+
+class TestResultFileData(ModelDataBase):
+    """
+    Test result message data.
+    """
+
+    ksIdAttr    = 'idTestResultFile';
+
+    ksParam_idTestResultFile    = 'TestResultFile_idTestResultFile';
+    ksParam_idTestResult        = 'TestResultFile_idTestResult';
+    ksParam_tsCreated           = 'TestResultFile_tsCreated';
+    ksParam_idStrFile           = 'TestResultFile_idStrFile';
+    ksParam_idStrDescription    = 'TestResultFile_idStrDescription';
+    ksParam_idStrKind           = 'TestResultFile_idStrKind';
+    ksParam_idStrMime           = 'TestResultFile_idStrMime';
+
+    def __init__(self):
+        ModelDataBase.__init__(self)
+        self.idTestResultFile   = None;
+        self.idTestResult       = None;
+        self.tsCreated          = None;
+        self.idStrFile          = None;
+        self.idStrDescription   = None;
+        self.idStrKind          = None;
+        self.idStrMime          = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a SELECT * FROM TestResultFiles.
+        Return self. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test result file record not found.')
+
+        self.idTestResultFile   = aoRow[0];
+        self.idTestResult       = aoRow[1];
+        self.tsCreated          = aoRow[2];
+        self.idStrFile          = aoRow[3];
+        self.idStrDescription   = aoRow[4];
+        self.idStrKind          = aoRow[5];
+        self.idStrMime          = aoRow[6];
+        return self;
+
+class TestResultFileDataEx(TestResultFileData):
+    """
+    Extends TestResultFile by resolving the strings.
+    """
+
+    def __init__(self):
+        TestResultFileData.__init__(self)
+        self.sFile          = None;
+        self.sDescription   = None;
+        self.sKind          = None;
+        self.sMime          = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a query like this:
+            SELECT   TestResultFiles.*,
+                     StrTabFile.sValue AS sFile,
+                     StrTabDesc.sValue AS sDescription
+                     StrTabKind.sValue AS sKind,
+                     StrTabMime.sValue AS sMime,
+            FROM ...
+
+        Return self. Raises exception if no row.
+        """
+        TestResultFileData.initFromDbRow(self, aoRow);
+        self.sFile          = aoRow[7];
+        self.sDescription   = aoRow[8];
+        self.sKind          = aoRow[9];
+        self.sMime          = aoRow[10];
+        return self;
+
+    def initFakeMainLog(self, oTestSet):
+        """
+        Reinitializes to represent the main.log object (not in DB).
+
+        Returns self.
+        """
+        self.idTestResultFile   = 0;
+        self.idTestResult       = oTestSet.idTestResult;
+        self.tsCreated          = oTestSet.tsCreated;
+        self.idStrFile          = None;
+        self.idStrDescription   = None;
+        self.idStrKind          = None;
+        self.idStrMime          = None;
+
+        self.sFile              = 'main.log';
+        self.sDescription       = '';
+        self.sKind              = 'log/main';
+        self.sMime              = 'text/plain';
+        return self;
+
+    def isProbablyUtf8Encoded(self):
+        """
+        Checks if the file is likely to be UTF-8 encoded.
+        """
+        if self.sMime in [ 'text/plain', 'text/html' ]:
+            return True;
+        return False;
+
+    def getMimeWithEncoding(self):
+        """
+        Gets the MIME type with encoding if likely to be UTF-8.
+        """
+        if self.isProbablyUtf8Encoded():
+            return '%s; charset=utf-8' % (self.sMime,);
+        return self.sMime;
+
+
+class TestResultListingData(ModelDataBase): # pylint: disable=R0902
+    """
+    Test case result data representation for table listing
+    """
+
+    def __init__(self):
+        """Initialize"""
+        ModelDataBase.__init__(self)
+
+        self.idTestSet               = None
+
+        self.idBuildCategory         = None;
+        self.sProduct                = None
+        self.sRepository             = None;
+        self.sBranch                 = None
+        self.sType                   = None
+        self.idBuild                 = None;
+        self.sVersion                = None;
+        self.iRevision               = None
+
+        self.sOs                     = None;
+        self.sOsVersion              = None;
+        self.sArch                   = None;
+        self.sCpuVendor              = None;
+        self.sCpuName                = None;
+        self.cCpus                   = None;
+        self.fCpuHwVirt              = None;
+        self.fCpuNestedPaging        = None;
+        self.fCpu64BitGuest          = None;
+        self.idTestBox               = None
+        self.sTestBoxName            = None
+
+        self.tsCreated               = None
+        self.tsElapsed               = None
+        self.enmStatus               = None
+        self.cErrors                 = None;
+
+        self.idTestCase              = None
+        self.sTestCaseName           = None
+        self.sBaseCmd                = None
+        self.sArgs                   = None
+
+        self.idBuildTestSuite        = None;
+        self.iRevisionTestSuite      = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Reinitialize from a database query.
+        Return self. Raises exception if no row.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('Test result record not found.')
+
+        self.idTestSet               = aoRow[0];
+
+        self.idBuildCategory         = aoRow[1];
+        self.sProduct                = aoRow[2];
+        self.sRepository             = aoRow[3];
+        self.sBranch                 = aoRow[4];
+        self.sType                   = aoRow[5];
+        self.idBuild                 = aoRow[6];
+        self.sVersion                = aoRow[7];
+        self.iRevision               = aoRow[8];
+
+        self.sOs                     = aoRow[9];
+        self.sOsVersion              = aoRow[10];
+        self.sArch                   = aoRow[11];
+        self.sCpuVendor              = aoRow[12];
+        self.sCpuName                = aoRow[13];
+        self.cCpus                   = aoRow[14];
+        self.fCpuHwVirt              = aoRow[15];
+        self.fCpuNestedPaging        = aoRow[16];
+        self.fCpu64BitGuest          = aoRow[17];
+        self.idTestBox               = aoRow[18];
+        self.sTestBoxName            = aoRow[19];
+
+        self.tsCreated               = aoRow[20];
+        self.tsElapsed               = aoRow[21];
+        self.enmStatus               = aoRow[22];
+        self.cErrors                 = aoRow[23];
+
+        self.idTestCase              = aoRow[24];
+        self.sTestCaseName           = aoRow[25];
+        self.sBaseCmd                = aoRow[26];
+        self.sArgs                   = aoRow[27];
+
+        self.idBuildTestSuite        = aoRow[28];
+        self.iRevisionTestSuite      = aoRow[29];
+
+        return self
+
+
+class TestResultHangingOffence(TMExceptionBase):
+    """Hanging offence committed by test case."""
+    pass;
+
+class TestResultLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    Results grouped by scheduling group.
+    """
+
+    #
+    # Result grinding for displaying in the WUI.
+    #
+
+    ksResultsGroupingTypeNone       = 'ResultsGroupingTypeNone'
+    ksResultsGroupingTypeTestGroup  = 'ResultsGroupingTypeTestGroup'
+    ksResultsGroupingTypeBuildRev   = 'ResultsGroupingTypeBuild'
+    ksResultsGroupingTypeTestBox    = 'ResultsGroupingTypeTestBox'
+    ksResultsGroupingTypeTestCase   = 'ResultsGroupingTypeTestCase'
+    ksResultsGroupingTypeSchedGroup = 'ResultsGroupingTypeSchedGroup'
+
+    ksBaseTables = 'BuildCategories, Builds, TestBoxes, TestResults, TestCases, TestCaseArgs,\n' \
+                 + '       TestSets LEFT OUTER JOIN Builds AS TestSuiteBits\n' \
+                   '                ON TestSets.idBuildTestSuite = TestSuiteBits.idBuild\n';
+
+    ksBasePreCondition = 'TestSets.idTestSet         = TestResults.idTestSet\n' \
+                + '   AND TestResults.idTestResultParent is NULL\n' \
+                + '   AND TestSets.idBuild           = Builds.idBuild\n' \
+                + '   AND Builds.tsExpire            > TestSets.tsCreated\n' \
+                + '   AND Builds.tsEffective        <= TestSets.tsCreated\n' \
+                + '   AND Builds.idBuildCategory     = BuildCategories.idBuildCategory\n' \
+                + '   AND TestSets.idGenTestBox      = TestBoxes.idGenTestBox\n' \
+                + '   AND TestSets.idGenTestCase     = TestCases.idGenTestCase\n' \
+                + '   AND TestSets.idGenTestCaseArgs = TestCaseArgs.idGenTestCaseArgs\n'
+    kdResultGroupingMap = {
+        ksResultsGroupingTypeNone:       (ksBaseTables,
+                                          ksBasePreCondition,),
+
+        ksResultsGroupingTypeTestGroup:  (ksBaseTables,
+                                          ksBasePreCondition + '   AND TestSets.idTestGroup',),
+
+        ksResultsGroupingTypeBuildRev:   (ksBaseTables,
+                                          ksBasePreCondition + '   AND Builds.iRevision',),
+
+        ksResultsGroupingTypeTestBox:    (ksBaseTables,
+                                          ksBasePreCondition + '   AND TestSets.idTestBox',),
+
+        ksResultsGroupingTypeTestCase:   (ksBaseTables,
+                                          ksBasePreCondition + '   AND TestSets.idTestCase',),
+
+        ksResultsGroupingTypeSchedGroup: (ksBaseTables,
+                                          ksBasePreCondition + '   AND TestBoxes.idSchedGroup',),
+    }
+
+    def _getTimePeriodQueryPart(self, tsNow, sInterval):
+        """
+        Get part of SQL query responsible for SELECT data within
+        specified period of time.
+        """
+        assert sInterval is not None; # too many rows.
+
+        cMonthsMourningPeriod = 2;  # Stop reminding everyone about testboxes after 2 months.  (May also speed up the query.)
+        if tsNow is None:
+            sRet =        '(TestSets.tsDone IS NULL OR TestSets.tsDone >= (CURRENT_TIMESTAMP - \'%s\'::interval))\n' \
+                   '   AND TestSets.tsCreated >= (CURRENT_TIMESTAMP  - \'%s\'::interval - \'%u months\'::interval)\n' \
+                 % (sInterval, sInterval, cMonthsMourningPeriod);
+        else:
+            sTsNow = '\'%s\'::TIMESTAMP' % (tsNow,); # It's actually a string already. duh.
+            sRet =        'TestSets.tsCreated <= %s\n' \
+                   '   AND TestSets.tsCreated >= (%s  - \'%s\'::interval - \'%u months\'::interval)\n' \
+                   '   AND (TestSets.tsDone IS NULL OR TestSets.tsDone >= (%s - \'%s\'::interval))\n' \
+                 % ( sTsNow,
+                     sTsNow, sInterval, cMonthsMourningPeriod,
+                     sTsNow, sInterval );
+        return sRet
+
+    def _getSqlQueryForGroupSearch(self, sWhat, tsNow, sInterval, enmResultsGroupingType, iResultsGroupingValue, fOnlyFailures):
+        """
+        Returns an SQL query that limits SELECT result
+        in order to satisfy @param enmResultsGroupingType.
+        """
+
+        if enmResultsGroupingType is None:
+            raise TMExceptionBase('Unknown grouping type')
+
+        if enmResultsGroupingType not in self.kdResultGroupingMap:
+            raise TMExceptionBase('Unknown grouping type')
+
+        # Get SQL query parameters
+        sTables, sCondition = self.kdResultGroupingMap[enmResultsGroupingType]
+
+        # Extend SQL query with time period limitation
+        sTimePeriodQuery = self._getTimePeriodQueryPart(tsNow, sInterval)
+
+        if iResultsGroupingValue is not None:
+            sCondition += ' = %d' % iResultsGroupingValue + '\n';
+        sCondition += '   AND ' + sTimePeriodQuery
+
+        # Extend the condition with test status limitations if requested.
+        if fOnlyFailures:
+            sCondition += '\n   AND TestSets.enmStatus != \'success\'::TestStatus_T' \
+                          '\n   AND TestSets.enmStatus != \'running\'::TestStatus_T';
+
+        # Assemble the query.
+        sQuery  = 'SELECT DISTINCT %s\n'  % sWhat
+        sQuery += 'FROM   %s\n'  % sTables
+        sQuery += 'WHERE  %s\n' % sCondition
+
+        return sQuery
+
+    def fetchResultsForListing(self, iStart, cMaxRows, tsNow, sInterval, enmResultsGroupingType, iResultsGroupingValue,
+                               fOnlyFailures):
+        """
+        Fetches TestResults table content.
+
+        If @param enmResultsGroupingType and @param iResultsGroupingValue
+        are not None, then resulting (returned) list contains only records
+        that match specified @param enmResultsGroupingType.
+
+        If @param enmResultsGroupingType is None, then
+        @param iResultsGroupingValue is ignored.
+
+        Returns an array (list) of TestResultData items, empty list if none.
+        Raises exception on error.
+        """
+
+        sWhat =        'TestSets.idTestSet,\n' \
+                '       BuildCategories.idBuildCategory,\n' \
+                '       BuildCategories.sProduct,\n' \
+                '       BuildCategories.sRepository,\n' \
+                '       BuildCategories.sBranch,\n' \
+                '       BuildCategories.sType,\n' \
+                '       Builds.idBuild,\n' \
+                '       Builds.sVersion,\n' \
+                '       Builds.iRevision,\n' \
+                '       TestBoxes.sOs,\n' \
+                '       TestBoxes.sOsVersion,\n' \
+                '       TestBoxes.sCpuArch,\n' \
+                '       TestBoxes.sCpuVendor,\n' \
+                '       TestBoxes.sCpuName,\n' \
+                '       TestBoxes.cCpus,\n' \
+                '       TestBoxes.fCpuHwVirt,\n' \
+                '       TestBoxes.fCpuNestedPaging,\n' \
+                '       TestBoxes.fCpu64BitGuest,\n' \
+                '       TestBoxes.idTestBox,\n' \
+                '       TestBoxes.sName,\n' \
+                '       TestResults.tsCreated,\n' \
+                '       COALESCE(TestResults.tsElapsed, CURRENT_TIMESTAMP - TestResults.tsCreated),\n' \
+                '       TestSets.enmStatus,\n' \
+                '       TestResults.cErrors,\n' \
+                '       TestCases.idTestCase,\n' \
+                '       TestCases.sName,\n' \
+                '       TestCases.sBaseCmd,\n' \
+                '       TestCaseArgs.sArgs,\n' \
+                '       TestSuiteBits.idBuild AS idBuildTestSuite,\n' \
+                '       TestSuiteBits.iRevision AS iRevisionTestSuite,\n' \
+                '       (TestSets.tsDone IS NULL) SortRunningFirst' \
+                ;
+
+        sSqlQuery = self._getSqlQueryForGroupSearch(sWhat, tsNow, sInterval, enmResultsGroupingType, iResultsGroupingValue,
+                                                    fOnlyFailures);
+
+        sSqlQuery += 'ORDER BY SortRunningFirst DESC, TestSets.idTestSet DESC\n';
+        sSqlQuery += 'LIMIT %s OFFSET %s\n' % (cMaxRows, iStart,);
+
+        self._oDb.execute(sSqlQuery);
+
+        aoRows = [];
+        for aoRow in self._oDb.fetchAll():
+            aoRows.append(TestResultListingData().initFromDbRow(aoRow))
+
+        return aoRows
+
+    def getEntriesCount(self, tsNow, sInterval, enmResultsGroupingType, iResultsGroupingValue, fOnlyFailures):
+        """
+        Get number of table records.
+
+        If @param enmResultsGroupingType and @param iResultsGroupingValue
+        are not None, then we count only only those records
+        that match specified @param enmResultsGroupingType.
+
+        If @param enmResultsGroupingType is None, then
+        @param iResultsGroupingValue is ignored.
+        """
+
+        sSqlQuery = self._getSqlQueryForGroupSearch('COUNT(TestSets.idTestSet)', tsNow, sInterval,
+                                                    enmResultsGroupingType, iResultsGroupingValue, fOnlyFailures)
+        self._oDb.execute(sSqlQuery)
+        return self._oDb.fetchOne()[0]
+
+    def getTestGroups(self, tsNow, sPeriod):
+        """
+        Get list of uniq TestGroupData objects which
+        found in all test results.
+        """
+
+        self._oDb.execute('SELECT DISTINCT TestGroups.*\n'
+                          'FROM   TestGroups, TestSets\n'
+                          'WHERE  TestSets.idTestGroup   =  TestGroups.idTestGroup\n'
+                          '   AND TestGroups.tsExpire    >  TestSets.tsCreated\n'
+                          '   AND TestGroups.tsEffective <= TestSets.tsCreated'
+                          '   AND ' + self._getTimePeriodQueryPart(tsNow, sPeriod))
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            ## @todo Need to take time into consideration. Will go belly up if we delete a testgroup.
+            aoRet.append(TestGroupData().initFromDbRow(aoRow))
+
+        return aoRet
+
+    def getBuilds(self, tsNow, sPeriod):
+        """
+        Get list of uniq BuildDataEx objects which
+        found in all test results.
+        """
+
+        self._oDb.execute('SELECT DISTINCT Builds.*, BuildCategories.*\n'
+                          'FROM     Builds, BuildCategories, TestSets\n'
+                          'WHERE    TestSets.idBuild       =  Builds.idBuild\n'
+                          '     AND Builds.idBuildCategory =  BuildCategories.idBuildCategory\n'
+                          '     AND Builds.tsExpire        >  TestSets.tsCreated\n'
+                          '     AND Builds.tsEffective     <= TestSets.tsCreated'
+                          '     AND ' + self._getTimePeriodQueryPart(tsNow, sPeriod))
+
+        aaoRows = self._oDb.fetchAll()
+        aoRet = []
+        for aoRow in aaoRows:
+            aoRet.append(BuildDataEx().initFromDbRow(aoRow))
+
+        return aoRet
+
+    def getTestBoxes(self, tsNow, sPeriod):
+        """
+        Get list of uniq TestBoxData objects which
+        found in all test results.
+        """
+
+        ## @todo do all in one query.
+        self._oDb.execute('SELECT DISTINCT TestBoxes.idTestBox, TestBoxes.idGenTestBox\n'
+                          'FROM TestBoxes, TestSets\n'
+                          'WHERE TestSets.idGenTestBox = TestBoxes.idGenTestBox\n'
+                          '  AND ' + self._getTimePeriodQueryPart(tsNow, sPeriod) +
+                          'ORDER BY TestBoxes.idTestBox, TestBoxes.idGenTestBox DESC' );
+        idPrevTestBox = -1;
+        asIdGenTestBoxes = [];
+        for aoRow in self._oDb.fetchAll():
+            if aoRow[0] != idPrevTestBox:
+                idPrevTestBox = aoRow[0];
+                asIdGenTestBoxes.append(str(aoRow[1]));
+
+        aoRet = []
+        if len(asIdGenTestBoxes) > 0:
+            self._oDb.execute('SELECT *\n'
+                              'FROM TestBoxes\n'
+                              'WHERE idGenTestBox IN (' + ','.join(asIdGenTestBoxes) + ')\n'
+                              'ORDER BY sName');
+            for aoRow in self._oDb.fetchAll():
+                aoRet.append(TestBoxData().initFromDbRow(aoRow));
+        return aoRet
+
+    def getTestCases(self, tsNow, sPeriod):
+        """
+        Get a list of unique TestCaseData objects which is appears in the test
+        specified result period.
+        """
+
+        self._oDb.execute('SELECT DISTINCT TestCases.idTestCase, TestCases.idGenTestCase, TestSets.tsConfig\n'
+                          'FROM TestCases, TestSets\n'
+                          'WHERE TestSets.idTestCase   =  TestCases.idTestCase\n'
+                          '  AND TestCases.tsExpire    >  TestSets.tsCreated\n'
+                          '  AND TestCases.tsEffective <= TestSets.tsCreated\n'
+                          '  AND ' + self._getTimePeriodQueryPart(tsNow, sPeriod) +
+                          'ORDER BY TestCases.idTestCase, TestCases.idGenTestCase DESC\n');
+
+        aaoRows        = self._oDb.fetchAll()
+        aoRet          = []
+        idPrevTestCase = -1;
+        for aoRow in aaoRows:
+            ## @todo reduce subqueries
+            if aoRow[0] != idPrevTestCase:
+                idPrevTestCase = aoRow[0];
+                aoRet.append(TestCaseData().initFromDbWithGenId(self._oDb, aoRow[1], aoRow[2]))
+
+        return aoRet
+
+    def getSchedGroups(self, tsNow, sPeriod):
+        """
+        Get list of uniq SchedGroupData objects which
+        found in all test results.
+        """
+
+        self._oDb.execute('SELECT DISTINCT TestBoxes.idSchedGroup\n'
+                          'FROM TestBoxes, TestSets\n'
+                          'WHERE TestSets.idGenTestBox =  TestBoxes.idGenTestBox\n'
+                          '  AND TestBoxes.tsExpire    >  TestSets.tsCreated\n'
+                          '  AND TestBoxes.tsEffective <= TestSets.tsCreated'
+                          '  AND ' + self._getTimePeriodQueryPart(tsNow, sPeriod))
+
+        aiRows = self._oDb.fetchAll()
+        aoRet = []
+        for iRow in aiRows:
+            ## @todo reduce subqueries
+            aoRet.append(SchedGroupData().initFromDbWithId(self._oDb, iRow))
+
+        return aoRet
+
+    def getById(self, idTestResult):
+        """
+        Get build record by its id
+        """
+        self._oDb.execute('SELECT *\n'
+                          'FROM   TestResults\n'
+                          'WHERE  idTestResult = %s\n',
+                          (idTestResult,))
+
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise TMExceptionBase('Found more than one test result with the same credentials. Database structure is corrupted.')
+        try:
+            return TestResultData().initFromDbRow(aRows[0])
+        except IndexError:
+            return None
+
+
+    #
+    # Details view and interface.
+    #
+
+    def fetchResultTree(self, idTestSet, cMaxDepth = None):
+        """
+        Fetches the result tree for the given test set.
+
+        Returns a tree of TestResultDataEx nodes.
+        Raises exception on invalid input and database issues.
+        """
+        # Depth first, i.e. just like the XML added them.
+        ## @todo this still isn't performing extremely well, consider optimizations.
+        sQuery = self._oDb.formatBindArgs(
+            'SELECT   TestResults.*,\n'
+            '         TestResultStrTab.sValue,\n'
+            '         EXISTS ( SELECT idTestResultValue\n'
+            '           FROM   TestResultValues\n'
+            '           WHERE  TestResultValues.idTestResult = TestResults.idTestResult ) AS fHasValues,\n'
+            '         EXISTS ( SELECT idTestResultMsg\n'
+            '           FROM   TestResultMsgs\n'
+            '           WHERE  TestResultMsgs.idTestResult   = TestResults.idTestResult ) AS fHasMsgs,\n'
+            '         EXISTS ( SELECT idTestResultFile\n'
+            '           FROM   TestResultFiles\n'
+            '           WHERE  TestResultFiles.idTestResult  = TestResults.idTestResult ) AS fHasFiles\n'
+            'FROM     TestResults, TestResultStrTab\n'
+            'WHERE    TestResults.idTestSet = %s\n'
+            '     AND TestResults.idStrName = TestResultStrTab.idStr\n'
+            , ( idTestSet, ));
+        if cMaxDepth is not None:
+            sQuery += self._oDb.formatBindArgs('     AND TestResults.iNestingDepth <= %s\n', (cMaxDepth,));
+        sQuery += 'ORDER BY idTestResult ASC\n'
+
+        self._oDb.execute(sQuery);
+        cRows = self._oDb.getRowCount();
+        if cRows > 65536:
+            raise TMTooManyRows('Too many rows returned for idTestSet=%d: %d' % (idTestSet, cRows,));
+
+        aaoRows = self._oDb.fetchAll();
+        if len(aaoRows) == 0:
+            raise TMExceptionBase('No test results for idTestSet=%d.' % (idTestSet,));
+
+        # Set up the root node first.
+        aoRow = aaoRows[0];
+        oRoot = TestResultDataEx().initFromDbRow(aoRow);
+        if oRoot.idTestResultParent is not None:
+            raise self._oDb.integrityException('The root TestResult (#%s) has a parent (#%s)!'
+                                               % (oRoot.idTestResult, oRoot.idTestResultParent));
+        self._fetchResultTreeNodeExtras(oRoot, aoRow[-3], aoRow[-2], aoRow[-1]);
+
+        # The chilren (if any).
+        dLookup = { oRoot.idTestResult: oRoot };
+        oParent = oRoot;
+        for iRow in range(1, len(aaoRows)):
+            aoRow = aaoRows[iRow];
+            oCur = TestResultDataEx().initFromDbRow(aoRow);
+            self._fetchResultTreeNodeExtras(oCur, aoRow[-3], aoRow[-2], aoRow[-1]);
+
+            # Figure out and vet the parent.
+            if oParent.idTestResult != oCur.idTestResultParent:
+                oParent = dLookup.get(oCur.idTestResultParent, None);
+                if oParent is None:
+                    raise self._oDb.integrityException('TestResult #%d is orphaned from its parent #%s.'
+                                                       % (oCur.idTestResult, oCur.idTestResultParent,));
+            if oParent.iNestingDepth + 1 != oCur.iNestingDepth:
+                raise self._oDb.integrityException('TestResult #%d has incorrect nesting depth (%d instead of %d)'
+                                                   % (oCur.idTestResult, oCur.iNestingDepth, oParent.iNestingDepth + 1,));
+
+            # Link it up.
+            oCur.oParent = oParent;
+            oParent.aoChildren.append(oCur);
+            dLookup[oCur.idTestResult] = oCur;
+
+        return (oRoot, dLookup);
+
+    def _fetchResultTreeNodeExtras(self, oCurNode, fHasValues, fHasMsgs, fHasFiles):
+        """
+        fetchResultTree worker that fetches values, message and files for the
+        specified node.
+        """
+        assert(oCurNode.aoValues == []);
+        assert(oCurNode.aoMsgs   == []);
+        assert(oCurNode.aoFiles  == []);
+
+        if fHasValues:
+            self._oDb.execute('SELECT   TestResultValues.*,\n'
+                              '         TestResultStrTab.sValue\n'
+                              'FROM     TestResultValues, TestResultStrTab\n'
+                              'WHERE    TestResultValues.idTestResult = %s\n'
+                              '     AND TestResultValues.idStrName    = TestResultStrTab.idStr\n'
+                              'ORDER BY idTestResultValue ASC\n'
+                              , ( oCurNode.idTestResult, ));
+            for aoRow in self._oDb.fetchAll():
+                oCurNode.aoValues.append(TestResultValueDataEx().initFromDbRow(aoRow));
+
+        if fHasMsgs:
+            self._oDb.execute('SELECT   TestResultMsgs.*,\n'
+                              '         TestResultStrTab.sValue\n'
+                              'FROM     TestResultMsgs, TestResultStrTab\n'
+                              'WHERE    TestResultMsgs.idTestResult = %s\n'
+                              '     AND TestResultMsgs.idStrMsg     = TestResultStrTab.idStr\n'
+                              'ORDER BY idTestResultMsg ASC\n'
+                              , ( oCurNode.idTestResult, ));
+            for aoRow in self._oDb.fetchAll():
+                oCurNode.aoMsgs.append(TestResultMsgDataEx().initFromDbRow(aoRow));
+
+        if fHasFiles:
+            self._oDb.execute('SELECT   TestResultFiles.*,\n'
+                              '         StrTabFile.sValue AS sFile,\n'
+                              '         StrTabDesc.sValue AS sDescription,\n'
+                              '         StrTabKind.sValue AS sKind,\n'
+                              '         StrTabMime.sValue AS sMime\n'
+                              'FROM     TestResultFiles,\n'
+                              '         TestResultStrTab AS StrTabFile,\n'
+                              '         TestResultStrTab AS StrTabDesc,\n'
+                              '         TestResultStrTab AS StrTabKind,\n'
+                              '         TestResultStrTab AS StrTabMime\n'
+                              'WHERE    TestResultFiles.idTestResult     = %s\n'
+                              '     AND TestResultFiles.idStrFile        = StrTabFile.idStr\n'
+                              '     AND TestResultFiles.idStrDescription = StrTabDesc.idStr\n'
+                              '     AND TestResultFiles.idStrKind        = StrTabKind.idStr\n'
+                              '     AND TestResultFiles.idStrMime        = StrTabMime.idStr\n'
+                              'ORDER BY idTestResultFile ASC\n'
+                              , ( oCurNode.idTestResult, ));
+            for aoRow in self._oDb.fetchAll():
+                oCurNode.aoFiles.append(TestResultFileDataEx().initFromDbRow(aoRow));
+
+        return True;
+
+
+
+    #
+    # TestBoxController interface(s).
+    #
+
+    def _inhumeTestResults(self, aoStack, idTestSet, sError):
+        """
+        The test produces too much output, kill and bury it.
+
+        Note! We leave the test set open, only the test result records are
+              completed.  Thus, _getResultStack will return an empty stack and
+              cause XML processing to fail immediately, while we can still
+              record when it actually completed in the test set the normal way.
+        """
+        self._oDb.dprint('** _inhumeTestResults: idTestSet=%d\n%s' % (idTestSet, self._stringifyStack(aoStack),));
+
+        #
+        # First add a message.
+        #
+        self._newFailureDetails(aoStack[0].idTestResult, sError, None);
+
+        #
+        # The complete all open test results.
+        #
+        for oTestResult in aoStack:
+            oTestResult.cErrors += 1;
+            self._completeTestResults(oTestResult, None, TestResultData.ksTestStatus_Failure, oTestResult.cErrors);
+
+        # A bit of paranoia.
+        self._oDb.execute('UPDATE TestResults\n'
+                          'SET    cErrors = cErrors + 1,\n'
+                          '       enmStatus = \'failure\'::TestStatus_T,\n'
+                          '       tsElapsed = CURRENT_TIMESTAMP - tsCreated\n'
+                          'WHERE  idTestSet = %s\n'
+                          '   AND enmStatus = \'running\'::TestStatus_T\n'
+                          , ( idTestSet, ));
+        self._oDb.commit();
+
+        return None;
+
+    def strTabString(self, sString, fCommit = False):
+        """
+        Gets the string table id for the given string, adding it if new.
+
+        Note! A copy of this code is also in TestSetLogic.
+        """
+        ## @todo move this and make a stored procedure for it.
+        self._oDb.execute('SELECT   idStr\n'
+                          'FROM     TestResultStrTab\n'
+                          'WHERE    sValue = %s'
+                          , (sString,));
+        if self._oDb.getRowCount() == 0:
+            self._oDb.execute('INSERT INTO TestResultStrTab (sValue)\n'
+                              'VALUES   (%s)\n'
+                              'RETURNING idStr\n'
+                              , (sString,));
+            if fCommit:
+                self._oDb.commit();
+        return self._oDb.fetchOne()[0];
+
+    @staticmethod
+    def _stringifyStack(aoStack):
+        """Returns a string rep of the stack."""
+        sRet = '';
+        for i in range(len(aoStack)):
+            sRet += 'aoStack[%d]=%s\n' % (i, aoStack[i]);
+        return sRet;
+
+    def _getResultStack(self, idTestSet):
+        """
+        Gets the current stack of result sets.
+        """
+        self._oDb.execute('SELECT *\n'
+                          'FROM   TestResults\n'
+                          'WHERE  idTestSet = %s\n'
+                          '   AND enmStatus = \'running\'::TestStatus_T\n'
+                          'ORDER BY idTestResult DESC'
+                          , ( idTestSet, ));
+        aoStack = [];
+        for aoRow in self._oDb.fetchAll():
+            aoStack.append(TestResultData().initFromDbRow(aoRow));
+
+        for i in range(len(aoStack)):
+            assert aoStack[i].iNestingDepth == len(aoStack) - i - 1, self._stringifyStack(aoStack);
+
+        return aoStack;
+
+    def _newTestResult(self, idTestResultParent, idTestSet, iNestingDepth, tsCreated, sName, dCounts, fCommit = False):
+        """
+        Creates a new test result.
+        Returns the TestResultData object for the new record.
+        May raise exception on database error.
+        """
+        assert idTestResultParent is not None;
+        assert idTestResultParent > 1;
+
+        #
+        # This isn't necessarily very efficient, but it's necessary to prevent
+        # a wild test or testbox from filling up the database.
+        #
+        sCountName = 'cTestResults';
+        if sCountName not in dCounts:
+            self._oDb.execute('SELECT   COUNT(idTestResult)\n'
+                              'FROM     TestResults\n'
+                              'WHERE    idTestSet = %s\n'
+                              , ( idTestSet,));
+            dCounts[sCountName] = self._oDb.fetchOne()[0];
+        dCounts[sCountName] += 1;
+        if dCounts[sCountName] > config.g_kcMaxTestResultsPerTS:
+            raise TestResultHangingOffence('Too many sub-tests in total!');
+
+        sCountName = 'cTestResultsIn%d' % (idTestResultParent,);
+        if sCountName not in dCounts:
+            self._oDb.execute('SELECT   COUNT(idTestResult)\n'
+                              'FROM     TestResults\n'
+                              'WHERE    idTestResultParent = %s\n'
+                              , ( idTestResultParent,));
+            dCounts[sCountName] = self._oDb.fetchOne()[0];
+        dCounts[sCountName] += 1;
+        if dCounts[sCountName] > config.g_kcMaxTestResultsPerTR:
+            raise TestResultHangingOffence('Too many immediate sub-tests!');
+
+        # This is also a hanging offence.
+        if iNestingDepth > config.g_kcMaxTestResultDepth:
+            raise TestResultHangingOffence('To deep sub-test nesting!');
+
+        # Ditto.
+        if len(sName) > config.g_kcchMaxTestResultName:
+            raise TestResultHangingOffence('Test name is too long: %d chars - "%s"' % (len(sName), sName));
+
+        #
+        # Within bounds, do the job.
+        #
+        idStrName = self.strTabString(sName, fCommit);
+        self._oDb.execute('INSERT INTO TestResults (\n'
+                          '         idTestResultParent,\n'
+                          '         idTestSet,\n'
+                          '         tsCreated,\n'
+                          '         idStrName,\n'
+                          '         iNestingDepth )\n'
+                          'VALUES (%s, %s, TIMESTAMP WITH TIME ZONE %s, %s, %s)\n'
+                          'RETURNING *\n'
+                          , ( idTestResultParent, idTestSet, tsCreated, idStrName, iNestingDepth) )
+        oData = TestResultData().initFromDbRow(self._oDb.fetchOne());
+
+        self._oDb.maybeCommit(fCommit);
+        return oData;
+
+    def _newTestValue(self, idTestResult, idTestSet, sName, lValue, sUnit, dCounts, tsCreated = None, fCommit = False):
+        """
+        Creates a test value.
+        May raise exception on database error.
+        """
+
+        #
+        # Bounds checking.
+        #
+        sCountName = 'cTestValues';
+        if sCountName not in dCounts:
+            self._oDb.execute('SELECT   COUNT(idTestResultValue)\n'
+                              'FROM     TestResultValues, TestResults\n'
+                              'WHERE    TestResultValues.idTestResult = TestResults.idTestResult\n'
+                              '     AND TestResults.idTestSet = %s\n'
+                              , ( idTestSet,));
+            dCounts[sCountName] = self._oDb.fetchOne()[0];
+        dCounts[sCountName] += 1;
+        if dCounts[sCountName] > config.g_kcMaxTestValuesPerTS:
+            raise TestResultHangingOffence('Too many values in total!');
+
+        sCountName = 'cTestValuesIn%d' % (idTestResult,);
+        if sCountName not in dCounts:
+            self._oDb.execute('SELECT   COUNT(idTestResultValue)\n'
+                              'FROM     TestResultValues\n'
+                              'WHERE    idTestResult = %s\n'
+                              , ( idTestResult,));
+            dCounts[sCountName] = self._oDb.fetchOne()[0];
+        dCounts[sCountName] += 1;
+        if dCounts[sCountName] > config.g_kcMaxTestValuesPerTR:
+            raise TestResultHangingOffence('Too many immediate values for one test result!');
+
+        if len(sName) > config.g_kcchMaxTestValueName:
+            raise TestResultHangingOffence('Value name is too long: %d chars - "%s"' % (len(sName), sName));
+
+        #
+        # Do the job.
+        #
+        iUnit = constants.valueunit.g_kdNameToConst.get(sUnit, constants.valueunit.NONE);
+
+        idStrName = self.strTabString(sName, fCommit);
+        if tsCreated is None:
+            self._oDb.execute('INSERT INTO TestResultValues (\n'
+                              '         idTestResult,\n'
+                              '         idTestSet,\n'
+                              '         idStrName,\n'
+                              '         lValue,\n'
+                              '         iUnit)\n'
+                              'VALUES (  %s, %s, %s, %s, %s )\n'
+                              , ( idTestResult, idTestSet, idStrName, lValue, iUnit,) );
+        else:
+            self._oDb.execute('INSERT INTO TestResultValues (\n'
+                              '         idTestResult,\n'
+                              '         idTestSet,\n'
+                              '         tsCreated,\n'
+                              '         idStrName,\n'
+                              '         lValue,\n'
+                              '         iUnit)\n'
+                              'VALUES ( %s, %s, TIMESTAMP WITH TIME ZONE %s, %s, %s, %s )\n'
+                              , ( idTestResult, idTestSet, tsCreated, idStrName, lValue, iUnit,) );
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def _newFailureDetails(self, idTestResult, sText, dCounts, tsCreated = None, fCommit = False):
+        """
+        Creates a record detailing cause of failure.
+        May raise exception on database error.
+        """
+
+        #
+        # Overflow protection.
+        #
+        if dCounts is not None:
+            sCountName = 'cTestMsgsIn%d' % (idTestResult,);
+            if sCountName not in dCounts:
+                self._oDb.execute('SELECT   COUNT(idTestResultMsg)\n'
+                                  'FROM     TestResultMsgs\n'
+                                  'WHERE    idTestResult = %s\n'
+                                  , ( idTestResult,));
+                dCounts[sCountName] = self._oDb.fetchOne()[0];
+            dCounts[sCountName] += 1;
+            if dCounts[sCountName] > config.g_kcMaxTestMsgsPerTR:
+                raise TestResultHangingOffence('Too many messages under for one test result!');
+
+            if len(sText) > config.g_kcchMaxTestMsg:
+                raise TestResultHangingOffence('Failure details message is too long: %d chars - "%s"' % (len(sText), sText));
+
+        #
+        # Do the job.
+        #
+        idStrMsg = self.strTabString(sText, fCommit);
+        if tsCreated is None:
+            self._oDb.execute('INSERT INTO TestResultMsgs (\n'
+                              '         idTestResult,\n'
+                              '         idStrMsg,\n'
+                              '         enmLevel)\n'
+                              'VALUES ( %s, %s, %s)\n'
+                              , ( idTestResult, idStrMsg, 'failure',) );
+        else:
+            self._oDb.execute('INSERT INTO TestResultMsgs (\n'
+                              '         idTestResult,\n'
+                              '         tsCreated,\n'
+                              '         idStrMsg,\n'
+                              '         enmLevel)\n'
+                              'VALUES ( %s, TIMESTAMP WITH TIME ZONE %s, %s, %s)\n'
+                              , ( idTestResult, tsCreated, idStrMsg, 'failure',) );
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+
+    def _completeTestResults(self, oTestResult, tsDone, enmStatus, cErrors = 0, fCommit = False):
+        """
+        Completes a test result.  Updates the oTestResult object.
+        May raise exception on database error.
+        """
+        self._oDb.dprint('** _completeTestResults: cErrors=%s tsDone=%s enmStatus=%s oTestResults=\n%s'
+                         % (cErrors, tsDone, enmStatus, oTestResult,));
+
+        #
+        # Sanity check: No open sub tests (aoStack should make sure about this!).
+        #
+        self._oDb.execute('SELECT   COUNT(idTestResult)\n'
+                          'FROM     TestResults\n'
+                          'WHERE    idTestResultParent = %s\n'
+                          '     AND enmStatus = %s\n'
+                          , ( oTestResult.idTestResult, TestResultData.ksTestStatus_Running,));
+        cOpenSubTest = self._oDb.fetchOne()[0];
+        assert cOpenSubTest == 0, 'cOpenSubTest=%d - %s' % (cOpenSubTest, oTestResult,);
+        assert oTestResult.enmStatus == TestResultData.ksTestStatus_Running;
+
+        #
+        # Make sure the reporter isn't lying about successes or error counts.
+        #
+        self._oDb.execute('SELECT   COALESCE(SUM(cErrors), 0)\n'
+                          'FROM     TestResults\n'
+                          'WHERE    idTestResultParent = %s\n'
+                          , ( oTestResult.idTestResult, ));
+        cMinErrors = self._oDb.fetchOne()[0] + oTestResult.cErrors;
+        if cErrors < cMinErrors:
+            cErrors = cMinErrors;
+        if cErrors > 0 and enmStatus == TestResultData.ksTestStatus_Success:
+            enmStatus = TestResultData.ksTestStatus_Failure
+
+        #
+        # Do the update.
+        #
+        if tsDone is None:
+            self._oDb.execute('UPDATE   TestResults\n'
+                              'SET      cErrors = %s,\n'
+                              '         enmStatus = %s,\n'
+                              '         tsElapsed = CURRENT_TIMESTAMP - tsCreated\n'
+                              'WHERE    idTestResult = %s\n'
+                              'RETURNING tsElapsed'
+                              , ( cErrors, enmStatus, oTestResult.idTestResult,) );
+        else:
+            self._oDb.execute('UPDATE   TestResults\n'
+                              'SET      cErrors = %s,\n'
+                              '         enmStatus = %s,\n'
+                              '         tsElapsed = TIMESTAMP WITH TIME ZONE %s - tsCreated\n'
+                              'WHERE    idTestResult = %s\n'
+                              'RETURNING tsElapsed'
+                              , ( cErrors, enmStatus, tsDone, oTestResult.idTestResult,) );
+
+        oTestResult.tsElapsed = self._oDb.fetchOne()[0];
+        oTestResult.enmStatus = enmStatus;
+        oTestResult.cErrors   = cErrors;
+
+        self._oDb.maybeCommit(fCommit);
+        return None;
+
+    def _doPopHint(self, aoStack, cStackEntries, dCounts):
+        """ Executes a PopHint. """
+        assert cStackEntries >= 0;
+        while len(aoStack) > cStackEntries:
+            if aoStack[0].enmStatus == TestResultData.ksTestStatus_Running:
+                self._newFailureDetails(aoStack[0].idTestResult, 'XML error: Missing </Test>', dCounts);
+                self._completeTestResults(aoStack[0], tsDone = None, cErrors = 1,
+                                          enmStatus = TestResultData.ksTestStatus_Failure, fCommit = True);
+            aoStack.pop(0);
+        return True;
+
+
+    @staticmethod
+    def _validateElement(sName, dAttribs, fClosed):
+        """
+        Validates an element and its attributes.
+        """
+
+        #
+        # Validate attributes by name.
+        #
+
+        # Validate integer attributes.
+        for sAttr in [ 'errors', 'testdepth' ]:
+            if sAttr in dAttribs:
+                try:
+                    _ = int(dAttribs[sAttr]);
+                except:
+                    return 'Element %s has an invalid %s attribute value: %s.' % (sName, sAttr, dAttribs[sAttr],);
+
+        # Validate long attributes.
+        for sAttr in [ 'value', ]:
+            if sAttr in dAttribs:
+                try:
+                    _ = long(dAttribs[sAttr]);
+                except:
+                    return 'Element %s has an invalid %s attribute value: %s.' % (sName, sAttr, dAttribs[sAttr],);
+
+        # Validate string attributes.
+        for sAttr in [ 'name', 'unit', 'text' ]:
+            if sAttr in dAttribs and len(dAttribs[sAttr]) == 0:
+                return 'Element %s has an empty %s attribute value.' % (sName, sAttr,);
+
+        # Validate the timestamp attribute.
+        if 'timestamp' in dAttribs:
+            (dAttribs['timestamp'], sError) = ModelDataBase.validateTs(dAttribs['timestamp'], fAllowNull = False);
+            if sError is not None:
+                return 'Element %s has an invalid timestamp ("%s"): %s' % (sName, dAttribs['timestamp'], sError,);
+
+
+        #
+        # Check that attributes that are required are present.
+        # We ignore extra attributes.
+        #
+        dElementAttribs = \
+        {
+            'Test':             [ 'timestamp', 'name', ],
+            'Value':            [ 'timestamp', 'name', 'unit', 'value', ],
+            'FailureDetails':   [ 'timestamp', 'text', ],
+            'Passed':           [ 'timestamp', ],
+            'Skipped':          [ 'timestamp', ],
+            'Failed':           [ 'timestamp', 'errors', ],
+            'TimedOut':         [ 'timestamp', 'errors', ],
+            'End':              [ 'timestamp', ],
+            'PushHint':         [ 'testdepth', ],
+            'PopHint':          [ 'testdepth', ],
+        };
+        if sName not in dElementAttribs:
+            return 'Unknown element "%s".' % (sName,);
+        for sAttr in dElementAttribs[sName]:
+            if sAttr not in dAttribs:
+                return 'Element %s requires attribute "%s".' % (sName, sAttr);
+
+        #
+        # Only the Test element can (and must) remain open.
+        #
+        if sName == 'Test' and fClosed:
+            return '<Test/> is not allowed.';
+        if sName != 'Test' and not fClosed:
+            return 'All elements except <Test> must be closed.';
+
+        return None;
+
+    @staticmethod
+    def _parseElement(sElement):
+        """
+        Parses an element.
+
+        """
+        #
+        # Element level bits.
+        #
+        sName    = sElement.split()[0];
+        sElement = sElement[len(sName):];
+
+        fClosed  = sElement[-1] == '/';
+        if fClosed:
+            sElement = sElement[:-1];
+
+        #
+        # Attributes.
+        #
+        sError   = None;
+        dAttribs = {};
+        sElement = sElement.strip();
+        while len(sElement) > 0:
+            # Extract attribute name.
+            off = sElement.find('=');
+            if off < 0 or not sElement[:off].isalnum():
+                sError = 'Attributes shall have alpha numberical names and have values.';
+                break;
+            sAttr = sElement[:off];
+
+            # Extract attribute value.
+            if off + 2 >= len(sElement) or sElement[off + 1] != '"':
+                sError = 'Attribute (%s) value is missing or not in double quotes.' % (sAttr,);
+                break;
+            off += 2;
+            offEndQuote = sElement.find('"', off);
+            if offEndQuote < 0:
+                sError = 'Attribute (%s) value is missing end quotation mark.' % (sAttr,);
+                break;
+            sValue = sElement[off:offEndQuote];
+
+            # Check for duplicates.
+            if sAttr in dAttribs:
+                sError = 'Attribute "%s" appears more than once.' % (sAttr,);
+                break;
+
+            # Unescape the value.
+            sValue = sValue.replace('<',   '<');
+            sValue = sValue.replace('>',   '>');
+            sValue = sValue.replace(''', '\'');
+            sValue = sValue.replace('"', '"');
+            sValue = sValue.replace('&#xA;',  '\n');
+            sValue = sValue.replace('&#xD;',  '\r');
+            sValue = sValue.replace('&',  '&'); # last
+
+            # Done.
+            dAttribs[sAttr] = sValue;
+
+            # advance
+            sElement = sElement[offEndQuote + 1:];
+            sElement = sElement.lstrip();
+
+        #
+        # Validate the element before we return.
+        #
+        if sError is None:
+            sError = TestResultLogic._validateElement(sName, dAttribs, fClosed);
+
+        return (sName, dAttribs, sError)
+
+    def _handleElement(self, sName, dAttribs, idTestSet, aoStack, aaiHints, dCounts):
+        """
+        Worker for processXmlStream that handles one element.
+
+        Returns None on success, error string on bad XML or similar.
+        Raises exception on hanging offence and on database error.
+        """
+        if sName == 'Test':
+            iNestingDepth = aoStack[0].iNestingDepth + 1 if len(aoStack) > 0 else 0;
+            aoStack.insert(0, self._newTestResult(idTestResultParent = aoStack[0].idTestResult, idTestSet = idTestSet,
+                                                  tsCreated = dAttribs['timestamp'], sName = dAttribs['name'],
+                                                  iNestingDepth = iNestingDepth, dCounts = dCounts, fCommit = True) );
+
+        elif sName == 'Value':
+            self._newTestValue(idTestResult = aoStack[0].idTestResult, idTestSet = idTestSet, tsCreated = dAttribs['timestamp'],
+                               sName = dAttribs['name'], sUnit = dAttribs['unit'], lValue = long(dAttribs['value']),
+                               dCounts = dCounts, fCommit = True);
+
+        elif sName == 'FailureDetails':
+            self._newFailureDetails(idTestResult = aoStack[0].idTestResult, tsCreated = dAttribs['timestamp'],
+                                    sText = dAttribs['text'], dCounts = dCounts, fCommit = True);
+
+        elif sName == 'Passed':
+            self._completeTestResults(aoStack[0], tsDone = dAttribs['timestamp'],
+                                      enmStatus = TestResultData.ksTestStatus_Success, fCommit = True);
+
+        elif sName == 'Skipped':
+            self._completeTestResults(aoStack[0], tsDone = dAttribs['timestamp'],
+                                      enmStatus = TestResultData.ksTestStatus_Skipped, fCommit = True);
+
+        elif sName == 'Failed':
+            self._completeTestResults(aoStack[0], tsDone = dAttribs['timestamp'], cErrors = int(dAttribs['errors']),
+                                      enmStatus = TestResultData.ksTestStatus_Failure, fCommit = True);
+
+        elif sName == 'TimedOut':
+            self._completeTestResults(aoStack[0], tsDone = dAttribs['timestamp'], cErrors = int(dAttribs['errors']),
+                                      enmStatus = TestResultData.ksTestStatus_TimedOut, fCommit = True);
+
+        elif sName == 'End':
+            self._completeTestResults(aoStack[0], tsDone = dAttribs['timestamp'],
+                                      cErrors = int(dAttribs.get('errors', '1')),
+                                      enmStatus = TestResultData.ksTestStatus_Success, fCommit = True);
+
+        elif sName == 'PushHint':
+            if len(aaiHints) > 1:
+                return 'PushHint cannot be nested.'
+
+            aaiHints.insert(0, [len(aoStack), int(dAttribs['testdepth'])]);
+
+        elif sName == 'PopHint':
+            if len(aaiHints) < 1:
+                return 'No hint to pop.'
+
+            iDesiredTestDepth = int(dAttribs['testdepth']);
+            cStackEntries, iTestDepth = aaiHints.pop(0);
+            self._doPopHint(aoStack, cStackEntries, dCounts); # Fake the necessary '<End/></Test>' tags.
+            if iDesiredTestDepth != iTestDepth:
+                return 'PopHint tag has different testdepth: %d, on stack %d.' % (iDesiredTestDepth, iTestDepth);
+        else:
+            return 'Unexpected element "%s".' % (sName,);
+        return None;
+
+
+    def processXmlStream(self, sXml, idTestSet):
+        """
+        Processes the "XML" stream section given in sXml.
+
+        The sXml isn't a complete XML document, even should we save up all sXml
+        for a given set, they may not form a complete and well formed XML
+        document since the test may be aborted, abend or simply be buggy. We
+        therefore do our own parsing and treat the XML tags as commands more
+        than anything else.
+
+        Returns (sError, fUnforgivable), where sError is None on success.
+        May raise database exception.
+        """
+        aoStack    = self._getResultStack(idTestSet); # [0] == top; [-1] == bottom.
+        if len(aoStack) == 0:
+            return ('No open results', True);
+        self._oDb.dprint('** processXmlStream len(aoStack)=%s' % (len(aoStack),));
+        #self._oDb.dprint('processXmlStream: %s' % (self._stringifyStack(aoStack),));
+        #self._oDb.dprint('processXmlStream: sXml=%s' % (sXml,));
+
+        dCounts    = {};
+        aaiHints   = [];
+        sError     = None;
+
+        fExpectCloseTest = False;
+        sXml = sXml.strip();
+        while len(sXml) > 0:
+            if sXml.startswith('</Test>'): # Only closing tag.
+                offNext = len('</Test>');
+                if len(aoStack) <= 1:
+                    sError = 'Trying to close the top test results.'
+                    break;
+                # ASSUMES that we've just seen an <End/>, <Passed/>, <Failed/>,
+                # <TimedOut/> or <Skipped/> tag earlier in this call!
+                if aoStack[0].enmStatus == TestResultData.ksTestStatus_Running  or  not fExpectCloseTest:
+                    sError = 'Missing <End/>, <Passed/>, <Failed/>, <TimedOut/> or <Skipped/> tag.';
+                    break;
+                aoStack.pop(0);
+                fExpectCloseTest = False;
+
+            elif fExpectCloseTest:
+                sError = 'Expected </Test>.'
+                break;
+
+            elif   sXml.startswith('<?xml '):  # Ignore (included files).
+                offNext = sXml.find('?>');
+                if offNext < 0:
+                    sError = 'Unterminated <?xml ?> element.';
+                    break;
+                offNext += 2;
+
+            elif sXml[0] == '<':
+                # Parse and check the tag.
+                if not sXml[1].isalpha():
+                    sError = 'Malformed element.';
+                    break;
+                offNext = sXml.find('>')
+                if offNext < 0:
+                    sError = 'Unterminated element.';
+                    break;
+                (sName, dAttribs, sError) = self._parseElement(sXml[1:offNext]);
+                offNext += 1;
+                if sError is not None:
+                    break;
+
+                # Handle it.
+                try:
+                    sError = self._handleElement(sName, dAttribs, idTestSet, aoStack, aaiHints, dCounts);
+                except TestResultHangingOffence as oXcpt:
+                    self._inhumeTestResults(aoStack, idTestSet, str(oXcpt));
+                    return (str(oXcpt), True);
+
+
+                fExpectCloseTest = sName in [ 'End', 'Passed', 'Failed', 'TimedOut', 'Skipped', ];
+            else:
+                sError = 'Unexpected content.';
+                break;
+
+            # Advance.
+            sXml = sXml[offNext:];
+            sXml = sXml.lstrip();
+
+        #
+        # Post processing checks.
+        #
+        if sError is None and fExpectCloseTest:
+            sError = 'Expected </Test> before the end of the XML section.'
+        elif sError is None and len(aaiHints) > 0:
+            sError = 'Expected </PopHint> before the end of the XML section.'
+        if len(aaiHints) > 0:
+            self._doPopHint(aoStack, aaiHints[-1][0], dCounts);
+
+        #
+        # Log the error.
+        #
+        if sError is not None:
+            SystemLogLogic(self._oDb).addEntry(SystemLogData.ksEvent_XmlResultMalformed,
+                                               'idTestSet=%s idTestResult=%s XML="%s" %s'
+                                               % ( idTestSet,
+                                                   aoStack[0].idTestResult if len(aoStack) > 0 else -1,
+                                                   sXml[:30 if len(sXml) >= 30 else len(sXml)],
+                                                   sError, ),
+                                               cHoursRepeat = 6, fCommit = True);
+        return (sError, False);
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class TestResultDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestResultData(),];
+
+class TestResultValueDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestResultValueData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/testset.py b/src/VBox/ValidationKit/testmanager/core/testset.py
new file mode 100644
index 0000000..f0767a6
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/testset.py
@@ -0,0 +1,650 @@
+# -*- coding: utf-8 -*-
+# $Id: testset.py $
+
+"""
+Test Manager - TestSet.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os;
+import zipfile;
+import unittest;
+
+# Validation Kit imports.
+from common                         import utils;
+from testmanager                    import config;
+from testmanager.core.base          import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+from testmanager.core.testbox       import TestBoxData;
+from testmanager.core.testresults   import TestResultFileDataEx;
+
+
+class TestSetData(ModelDataBase):
+    """
+    TestSet Data.
+    """
+
+    ## @name TestStatus_T
+    # @{
+    ksTestStatus_Running    = 'running';
+    ksTestStatus_Success    = 'success';
+    ksTestStatus_Skipped    = 'skipped';
+    ksTestStatus_BadTestBox = 'bad-testbox';
+    ksTestStatus_Aborted    = 'aborted';
+    ksTestStatus_Failure    = 'failure';
+    ksTestStatus_TimedOut   = 'timed-out';
+    ksTestStatus_Rebooted   = 'rebooted';
+    ## @}
+
+    ## List of relatively harmless (to testgroup/case) statuses.
+    kasHarmlessTestStatuses = [ ksTestStatus_Skipped, ksTestStatus_BadTestBox, ksTestStatus_Aborted, ];
+    ## List of bad statuses.
+    kasBadTestStatuses      = [ ksTestStatus_Failure, ksTestStatus_TimedOut,   ksTestStatus_Rebooted, ];
+
+    ksIdAttr    = 'idTestSet';
+
+    ksParam_idTestSet           = 'TestSet_idTestSet';
+    ksParam_tsConfig            = 'TestSet_tsConfig';
+    ksParam_tsCreated           = 'TestSet_tsCreated';
+    ksParam_tsDone              = 'TestSet_tsDone';
+    ksParam_enmStatus           = 'TestSet_enmStatus';
+    ksParam_idBuild             = 'TestSet_idBuild';
+    ksParam_idBuildCategory     = 'TestSet_idBuildCategory';
+    ksParam_idBuildTestSuite    = 'TestSet_idBuildTestSuite';
+    ksParam_idGenTestBox        = 'TestSet_idGenTestBox';
+    ksParam_idTestBox           = 'TestSet_idTestBox';
+    ksParam_idTestGroup         = 'TestSet_idTestGroup';
+    ksParam_idGenTestCase       = 'TestSet_idGenTestCase';
+    ksParam_idTestCase          = 'TestSet_idTestCase';
+    ksParam_idGenTestCaseArgs   = 'TestSet_idGenTestCaseArgs';
+    ksParam_idTestCaseArgs      = 'TestSet_idTestCaseArgs';
+    ksParam_idTestResult        = 'TestSet_idTestResult';
+    ksParam_sBaseFilename       = 'TestSet_sBaseFilename';
+    ksParam_iGangMemberNo       = 'TestSet_iGangMemberNo';
+    ksParam_idTestSetGangLeader = 'TestSet_idTestSetGangLeader';
+
+    kasAllowNullAttributes      = ['tsDone', 'idBuildTestSuite', 'idTestSetGangLeader' ];
+    kasValidValues_enmStatus    = [
+        ksTestStatus_Running,
+        ksTestStatus_Success,
+        ksTestStatus_Skipped,
+        ksTestStatus_BadTestBox,
+        ksTestStatus_Aborted,
+        ksTestStatus_Failure,
+        ksTestStatus_TimedOut,
+        ksTestStatus_Rebooted,
+    ];
+    kiMin_iGangMemberNo         = 0;
+    kiMax_iGangMemberNo         = 1023;
+
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.idTestSet              = None;
+        self.tsConfig               = None;
+        self.tsCreated              = None;
+        self.tsDone                 = None;
+        self.enmStatus              = 'running';
+        self.idBuild                = None;
+        self.idBuildCategory        = None;
+        self.idBuildTestSuite       = None;
+        self.idGenTestBox           = None;
+        self.idTestBox              = None;
+        self.idTestGroup            = None;
+        self.idGenTestCase          = None;
+        self.idTestCase             = None;
+        self.idGenTestCaseArgs      = None;
+        self.idTestCaseArgs         = None;
+        self.idTestResult           = None;
+        self.sBaseFilename          = None;
+        self.iGangMemberNo          = 0;
+        self.idTestSetGangLeader    = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Internal worker for initFromDbWithId and initFromDbWithGenId as well as
+        TestBoxSetLogic.
+        """
+
+        if aoRow is None:
+            raise TMExceptionBase('TestSet not found.');
+
+        self.idTestSet              = aoRow[0];
+        self.tsConfig               = aoRow[1];
+        self.tsCreated              = aoRow[2];
+        self.tsDone                 = aoRow[3];
+        self.enmStatus              = aoRow[4];
+        self.idBuild                = aoRow[5];
+        self.idBuildCategory        = aoRow[6];
+        self.idBuildTestSuite       = aoRow[7];
+        self.idGenTestBox           = aoRow[8];
+        self.idTestBox              = aoRow[9];
+        self.idTestGroup            = aoRow[10];
+        self.idGenTestCase          = aoRow[11];
+        self.idTestCase             = aoRow[12];
+        self.idGenTestCaseArgs      = aoRow[13];
+        self.idTestCaseArgs         = aoRow[14];
+        self.idTestResult           = aoRow[15];
+        self.sBaseFilename          = aoRow[16];
+        self.iGangMemberNo          = aoRow[17];
+        self.idTestSetGangLeader    = aoRow[18];
+        return self;
+
+
+    def initFromDbWithId(self, oDb, idTestSet):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute('SELECT *\n'
+                    'FROM   TestSets\n'
+                    'WHERE  idTestSet = %s\n'
+                    , (idTestSet, ) );
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('idTestSet=%s not found' % (idTestSet,));
+        return self.initFromDbRow(aoRow);
+
+
+    def openFile(self, sFilename, sMode = 'rb'):
+        """
+        Opens a file.
+
+        Returns (oFile, cbFile, fIsStream) on success.
+        Returns (None,  sErrorMsg, None) on failure.
+        Will not raise exceptions, unless the class instance is invalid.
+        """
+        assert sMode in [ 'rb', 'r', 'rU' ];
+
+        # Try raw file first.
+        sFile1 = os.path.join(config.g_ksFileAreaRootDir, self.sBaseFilename + '-' + sFilename);
+        try:
+            oFile = open(sFile1, sMode);
+            return (oFile, os.fstat(oFile.fileno()).st_size, False);
+        except Exception as oXcpt1:
+            # Try the zip archive next.
+            sFile2 = os.path.join(config.g_ksZipFileAreaRootDir, self.sBaseFilename + '.zip');
+            try:
+                oZipFile    = zipfile.ZipFile(sFile2, 'r');
+                oFile       = oZipFile.open(sFilename, sMode if sMode != 'rb' else 'r');
+                cbFile      = oZipFile.getinfo(sFilename).file_size;
+                return (oFile, cbFile, True);
+            except Exception as oXcpt2:
+                # Construct a meaningful error message.
+                try:
+                    if os.path.exists(sFile1):
+                        return (None, 'Error opening "%s": %s' % (sFile1, oXcpt1), None);
+                    if not os.path.exists(sFile2):
+                        return (None, 'File "%s" not found. [%s, %s]' % (sFilename, sFile1, sFile2,), None);
+                    return (None, 'Error opening "%s" inside "%s": %s' % (sFilename, sFile2, oXcpt2), None);
+                except Exception as oXcpt3:
+                    return (None, 'Aa! Megami-sama! %s; %s; %s' % (oXcpt1, oXcpt2, oXcpt3,), None);
+        return (None, 'Code not reachable!', None);
+
+    def createFile(self, sFilename, sMode = 'wb'):
+        """
+        Creates a new file.
+
+        Returns oFile on success.
+        Returns sErrorMsg on failure.
+        """
+        assert sMode in [ 'wb', 'w', 'wU' ];
+
+        # Try raw file first.
+        sFile1 = os.path.join(config.g_ksFileAreaRootDir, self.sBaseFilename + '-' + sFilename);
+        try:
+            if not os.path.exists(os.path.dirname(sFile1)):
+                os.makedirs(os.path.dirname(sFile1), 0o755);
+            oFile = open(sFile1, sMode);
+        except Exception as oXcpt1:
+            return str(oXcpt1);
+        return oFile;
+
+class TestSetLogic(ModelLogicBase):
+    """
+    TestSet logic.
+    """
+
+
+    def __init__(self, oDb):
+        ModelLogicBase.__init__(self, oDb);
+
+
+    def tryFetch(self, idTestSet):
+        """
+        Attempts to fetch a test set.
+
+        Returns a TestSetData object on success.
+        Returns None if no status was found.
+        Raises exception on other errors.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     TestSets\n'
+                          'WHERE    idTestSet = %s\n',
+                          (idTestSet,));
+        if self._oDb.getRowCount() == 0:
+            return None;
+        oData = TestSetData();
+        return oData.initFromDbRow(self._oDb.fetchOne());
+
+    def strTabString(self, sString, fCommit = False):
+        """
+        Gets the string table id for the given string, adding it if new.
+        """
+        ## @todo move this and make a stored procedure for it.
+        self._oDb.execute('SELECT   idStr\n'
+                          'FROM     TestResultStrTab\n'
+                          'WHERE    sValue = %s'
+                          , (sString,));
+        if self._oDb.getRowCount() == 0:
+            self._oDb.execute('INSERT INTO TestResultStrTab (sValue)\n'
+                              'VALUES   (%s)\n'
+                              'RETURNING idStr\n'
+                              , (sString,));
+            if fCommit:
+                self._oDb.commit();
+        return self._oDb.fetchOne()[0];
+
+    def complete(self, idTestSet, sStatus, fCommit = False):
+        """
+        Completes the testset.
+        Returns the test set ID of the gang leader, None if no gang involvement.
+        Raises exceptions on database errors and invalid input.
+        """
+
+        assert sStatus != TestSetData.ksTestStatus_Running;
+
+        #
+        # Get the basic test set data and check if there is anything to do here.
+        #
+        oData = TestSetData().initFromDbWithId(self._oDb, idTestSet);
+        if oData.enmStatus != TestSetData.ksTestStatus_Running:
+            raise TMExceptionBase('TestSet %s is already completed as %s.' % (idTestSet, oData.enmStatus));
+        if oData.idTestResult is None:
+            raise self._oDb.integrityException('idTestResult is NULL for TestSet %u' % (idTestSet,));
+
+        #
+        # Close open sub test results, count these as errors.
+        # Note! No need to propagate error counts here. Only one tree line will
+        #       have open sets, and it will go all the way to the root.
+        #
+        self._oDb.execute('SELECT idTestResult\n'
+                          'FROM   TestResults\n'
+                          'WHERE  idTestSet     = %s\n'
+                          '   AND enmStatus     = %s\n'
+                          '   AND idTestResult <> %s\n'
+                          'ORDER BY idTestResult DESC\n'
+                          , (idTestSet, TestSetData.ksTestStatus_Running, oData.idTestResult));
+        aaoRows = self._oDb.fetchAll();
+        if len(aaoRows):
+            idStr = self.strTabString('Unclosed test result', fCommit = fCommit);
+            for aoRow in aaoRows:
+                self._oDb.execute('UPDATE   TestResults\n'
+                                  'SET      enmStatus = \'failure\',\n'
+                                  '         tsElapsed = CURRENT_TIMESTAMP - tsCreated,\n'
+                                  '         cErrors   = cErrors + 1\n'
+                                  'WHERE    idTestResult = %s\n'
+                                  , (aoRow[0],));
+                self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idStrMsg, enmLevel)\n'
+                                  'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'
+                                  , (aoRow[0], idStr,));
+
+        #
+        # If it's a success result, check it against error counters.
+        #
+        if sStatus not in TestSetData.kasBadTestStatuses:
+            self._oDb.execute('SELECT COUNT(*)\n'
+                              'FROM   TestResults\n'
+                              'WHERE  idTestSet = %s\n'
+                              '   AND cErrors > 0\n'
+                              , (idTestSet,));
+            cErrors = self._oDb.fetchOne()[0];
+            if cErrors > 0:
+                sStatus = TestSetData.ksTestStatus_Failure;
+
+        #
+        # If it's an pure 'failure', check for timeouts and propagate it.
+        #
+        if sStatus == TestSetData.ksTestStatus_Failure:
+            self._oDb.execute('SELECT COUNT(*)\n'
+                              'FROM   TestResults\n'
+                              'WHERE  idTestSet = %s\n'
+                              '   AND enmStatus = %s\n'
+                              , ( idTestSet, TestSetData.ksTestStatus_TimedOut, ));
+            if self._oDb.fetchOne()[0] > 0:
+                sStatus = TestSetData.ksTestStatus_TimedOut;
+
+        #
+        # Complete the top level test result and then the test set.
+        #
+        self._oDb.execute('UPDATE   TestResults\n'
+                          'SET      cErrors = (SELECT COALESCE(SUM(cErrors), 0)\n'
+                          '                    FROM   TestResults\n'
+                          '                    WHERE idTestResultParent = %s)\n'
+                          'WHERE    idTestResult = %s\n'
+                          'RETURNING cErrors\n'
+                          , (oData.idTestResult, oData.idTestResult));
+        cErrors = self._oDb.fetchOne()[0];
+        if cErrors == 0  and  sStatus in TestSetData.kasBadTestStatuses:
+            self._oDb.execute('UPDATE   TestResults\n'
+                              'SET      cErrors = 1\n'
+                              'WHERE    idTestResult = %s\n'
+                              , (oData.idTestResult,));
+        elif cErrors > 0  and  sStatus not in TestSetData.kasBadTestStatuses:
+            sStatus = TestSetData.ksTestStatus_Failure;  # Impossible.
+        self._oDb.execute('UPDATE   TestResults\n'
+                          'SET      enmStatus = %s,\n'
+                          '         tsElapsed = CURRENT_TIMESTAMP - tsCreated\n'
+                          'WHERE    idTestResult = %s\n'
+                          , (sStatus, oData.idTestResult,));
+
+        self._oDb.execute('UPDATE   TestSets\n'
+                          'SET      enmStatus = %s,\n'
+                          '         tsDone    = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestSet = %s\n'
+                          , (sStatus, idTestSet,));
+
+        self._oDb.maybeCommit(fCommit);
+        return oData.idTestSetGangLeader;
+
+    def completeAsAbandond(self, idTestSet, fCommit = False):
+        """
+        Completes the testset as abandoned if necessary.
+
+        See scenario #9:
+        file://../../docs/AutomaticTestingRevamp.html#cleaning-up-abandond-testcase
+
+        Returns True if successfully completed as abandond, False if it's already
+        completed, and raises exceptions under exceptional circumstances.
+        """
+
+        #
+        # Get the basic test set data and check if there is anything to do here.
+        #
+        oData = self.tryFetch(idTestSet);
+        if oData is None:
+            return False;
+        if oData.enmStatus != TestSetData.ksTestStatus_Running:
+            return False;
+
+        if oData.idTestResult is not None:
+            #
+            # Clean up test results, adding a message why they failed.
+            #
+            self._oDb.execute('UPDATE   TestResults\n'
+                              'SET      enmStatus = \'failure\',\n'
+                              '         tsElapsed = CURRENT_TIMESTAMP - tsCreated,\n'
+                              '         cErrors   = cErrors + 1\n'
+                              'WHERE    idTestSet = %s\n'
+                              '   AND   enmStatus = \'running\'::TestStatus_T\n'
+                              , (idTestSet,));
+
+            idStr = self.strTabString('The test was abandond by the testbox', fCommit = fCommit);
+            self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idStrMsg, enmLevel)\n'
+                              'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'
+                              , (oData.idTestResult, idStr,));
+
+        #
+        # Complete the testset.
+        #
+        self._oDb.execute('UPDATE   TestSets\n'
+                          'SET      enmStatus = \'failure\',\n'
+                          '         tsDone    = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestSet = %s\n'
+                          '   AND   enmStatus = \'running\'::TestStatus_T\n'
+                          , (idTestSet,));
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def completeAsGangGatheringTimeout(self, idTestSet, fCommit = False):
+        """
+        Completes the testset with a gang-gathering timeout.
+        Raises exceptions on database errors and invalid input.
+        """
+        #
+        # Get the basic test set data and check if there is anything to do here.
+        #
+        oData = TestSetData().initFromDbWithId(self._oDb, idTestSet);
+        if oData.enmStatus != TestSetData.ksTestStatus_Running:
+            raise TMExceptionBase('TestSet %s is already completed as %s.' % (idTestSet, oData.enmStatus));
+        if oData.idTestResult is None:
+            raise self._oDb.integrityException('idTestResult is NULL for TestSet %u' % (idTestSet,));
+
+        #
+        # Complete the top level test result and then the test set.
+        #
+        self._oDb.execute('UPDATE   TestResults\n'
+                          'SET      enmStatus = \'failure\',\n'
+                          '         tsElapsed = CURRENT_TIMESTAMP - tsCreated,\n'
+                          '         cErrors   = cErrors + 1\n'
+                          'WHERE    idTestSet = %s\n'
+                          '   AND   enmStatus = \'running\'::TestStatus_T\n'
+                          , (idTestSet,));
+
+        idStr = self.strTabString('Gang gathering timed out', fCommit = fCommit);
+        self._oDb.execute('INSERT INTO TestResultMsgs (idTestResult, idStrMsg, enmLevel)\n'
+                          'VALUES ( %s, %s, \'failure\'::TestResultMsgLevel_T)\n'
+                          , (oData.idTestResult, idStr,));
+
+        self._oDb.execute('UPDATE   TestSets\n'
+                          'SET      enmStatus = \'failure\',\n'
+                          '         tsDone    = CURRENT_TIMESTAMP\n'
+                          'WHERE    idTestSet = %s\n'
+                          , (idTestSet,));
+
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def createFile(self, oTestSet, sName, sMime, sKind, sDesc, cbFile, fCommit = False): # pylint: disable=R0914
+        """
+        Creates a file and associating with the current test result record in
+        the test set.
+
+        Returns file object that the file content can be written to.
+        Raises exception on database error, I/O errors, if there are too many
+        files in the test set or if they take up too much disk space.
+
+        The caller (testboxdisp.py) is expected to do basic input validation,
+        so we skip that and get on with the bits only we can do.
+        """
+
+        #
+        # Furhter input and limit checks.
+        #
+        if oTestSet.enmStatus != TestSetData.ksTestStatus_Running:
+            raise TMExceptionBase('Cannot create files on a test set with status "%s".' % (oTestSet.enmStatus,));
+
+        self._oDb.execute('SELECT   TestResultStrTab.sValue\n'
+                          'FROM     TestResultFiles,\n'
+                          '         TestResults,\n'
+                          '         TestResultStrTab\n'
+                          'WHERE    TestResults.idTestSet        = %s\n'
+                          '     AND TestResultFiles.idTestResult = TestResults.idTestResult\n'
+                          '     AND TestResultStrTab.idStr       = TestResultFiles.idStrFile\n'
+                          , ( oTestSet.idTestSet,));
+        if self._oDb.getRowCount() + 1 > config.g_kcMaxUploads:
+            raise TMExceptionBase('Uploaded too many files already (%d).' % (self._oDb.getRowCount(),));
+
+        dFiles = {}
+        cbTotalFiles = 0;
+        for aoRow in self._oDb.fetchAll():
+            dFiles[aoRow[0].lower()] = 1; # For determining a unique filename further down.
+            sFile = os.path.join(config.g_ksFileAreaRootDir, oTestSet.sBaseFilename + '-' + aoRow[0]);
+            try:
+                cbTotalFiles += os.path.getsize(sFile);
+            except:
+                cbTotalFiles += config.g_kcMbMaxUploadSingle * 1048576;
+        if (cbTotalFiles + cbFile + 1048575) / 1048576 > config.g_kcMbMaxUploadTotal:
+            raise TMExceptionBase('Will exceed total upload limit: %u bytes + %u bytes > %s MiB.' \
+                                  % (cbTotalFiles, cbFile, config.g_kcMbMaxUploadTotal));
+
+        #
+        # Create a new file.
+        #
+        self._oDb.execute('SELECT   idTestResult\n'
+                          'FROM     TestResults\n'
+                          'WHERE    idTestSet = %s\n'
+                          '     AND enmStatus = \'running\'::TestStatus_T\n'
+                          'ORDER BY idTestResult\n'
+                          'LIMIT    1\n'
+                          % ( oTestSet.idTestSet, ));
+        if self._oDb.getRowCount() < 1:
+            raise TMExceptionBase('No open test results - someone committed a capital offence or we ran into a race.');
+        idTestResult = self._oDb.fetchOne()[0];
+
+        if sName.lower() in dFiles:
+            # Note! There is in theory a race here, but that's something the
+            #       test driver doing parallel upload with non-unique names
+            #       should worry about. The TD should always avoid this path.
+            sOrgName = sName;
+            for i in range(2, config.g_kcMaxUploads + 6):
+                sName = '%s-%s' % (i, sName,);
+                if sName not in dFiles:
+                    break;
+                sName = None;
+            if sName is None:
+                raise TMExceptionBase('Failed to find unique name for %s.' % (sOrgName,));
+
+        self._oDb.execute('INSERT INTO TestResultFiles(idTestResult, idStrFile, idStrDescription, idStrKind, idStrMime)\n'
+                          'VALUES (%s, %s, %s, %s, %s)\n'
+                          , ( idTestResult,
+                              self.strTabString(sName),
+                              self.strTabString(sDesc),
+                              self.strTabString(sKind),
+                              self.strTabString(sMime),
+                          ));
+
+        oFile = oTestSet.createFile(sName, 'wb');
+        if utils.isString(oFile):
+            raise TMExceptionBase('Error creating "%s": %s' % (sName, oFile));
+        self._oDb.maybeCommit(fCommit);
+        return oFile;
+
+    def getGang(self, idTestSetGangLeader):
+        """
+        Returns an array of TestBoxData object representing the gang for the given testset.
+        """
+        self._oDb.execute('SELECT   TestBoxes.*\n'
+                          'FROM     TestBoxes, TestSets\n'
+                          'WHERE    TestSets.idTestSetGangLeader = %s\n'
+                          '     AND TestSets.idGenTestBox        = TestBoxes.idGenTestBox\n'
+                          'ORDER BY iGangMemberNo ASC\n'
+                          , (idTestSetGangLeader,));
+        aaoRows = self._oDb.fetchAll();
+        aoTestBoxes = [];
+        for aoRow in aaoRows:
+            aoTestBoxes.append(TestBoxData().initFromDbRow(aoRow));
+        return aoTestBoxes;
+
+    def getFile(self, idTestSet, idTestResultFile):
+        """
+        Gets the TestResultFileEx corresponding to idTestResultFile.
+
+        Raises an exception if the file wasn't found, doesn't belong to
+        idTestSet, and on DB error.
+        """
+        self._oDb.execute('SELECT   TestResultFiles.*,\n'
+                          '         StrTabFile.sValue AS sFile,\n'
+                          '         StrTabDesc.sValue AS sDescription,\n'
+                          '         StrTabKind.sValue AS sKind,\n'
+                          '         StrTabMime.sValue AS sMime\n'
+                          'FROM     TestResultFiles,\n'
+                          '         TestResultStrTab AS StrTabFile,\n'
+                          '         TestResultStrTab AS StrTabDesc,\n'
+                          '         TestResultStrTab AS StrTabKind,\n'
+                          '         TestResultStrTab AS StrTabMime,\n'
+                          '         TestResults\n'
+                          'WHERE    TestResultFiles.idTestResultFile = %s\n'
+                          '     AND TestResultFiles.idStrFile        = StrTabFile.idStr\n'
+                          '     AND TestResultFiles.idStrDescription = StrTabDesc.idStr\n'
+                          '     AND TestResultFiles.idStrKind        = StrTabKind.idStr\n'
+                          '     AND TestResultFiles.idStrMime        = StrTabMime.idStr\n'
+                          '     AND TestResults.idTestResult         = TestResultFiles.idTestResult\n'
+                          '     AND TestResults.idTestSet            = %s\n'
+                          , ( idTestResultFile, idTestSet, ));
+        return TestResultFileDataEx().initFromDbRow(self._oDb.fetchOne());
+
+
+    def getById(self, idTestSet):
+        """
+        Get TestSet table record by its id
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     TestSets\n'
+                          'WHERE    idTestSet=%s\n',
+                          (idTestSet,))
+
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise TMExceptionBase('Found more than one test sets with the same credentials. Database structure is corrupted.')
+        try:
+            return TestSetData().initFromDbRow(aRows[0])
+        except IndexError:
+            return None
+
+
+    def fetchOrphaned(self):
+        """
+        Returns a list of TestSetData objects of orphaned test sets.
+
+        A test set is orphaned if tsDone is NULL and the testbox has created
+        one or more newer testsets.
+        """
+
+        self._oDb.execute('SELECT   TestSets.*\n'
+                          'FROM     TestSets,\n'
+                          '         (SELECT idTestSet, idTestBox FROM TestSets WHERE tsDone is NULL) AS t\n'
+                          'WHERE    TestSets.idTestSet = t.idTestSet\n'
+                          '     AND EXISTS(SELECT 1 FROM TestSets st\n'
+                          '                WHERE st.idTestBox = t.idTestBox AND st.idTestSet > t.idTestSet)\n'
+                          '     AND NOT EXISTS(SELECT 1 FROM TestBoxStatuses tbs\n'
+                          '                    WHERE tbs.idTestBox = t.idTestBox AND tbs.idTestSet = t.idTestSet)\n'
+                          'ORDER by TestSets.idTestBox, TestSets.idTestSet'
+                          );
+        aoRet = [];
+        for aoRow in self._oDb.fetchAll():
+            aoRet.append(TestSetData().initFromDbRow(aoRow));
+        return aoRet;
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class TestSetDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [TestSetData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/useraccount.pgsql b/src/VBox/ValidationKit/testmanager/core/useraccount.pgsql
new file mode 100644
index 0000000..30fea69
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/useraccount.pgsql
@@ -0,0 +1,168 @@
+-- $Id: useraccount.pgsql $
+--- @file
+-- VBox Test Manager Database Stored Procedures - UserAccounts.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+\set ON_ERROR_STOP 1
+\connect testmanager;
+
+---
+-- Checks if the user name and login name are unique, ignoring a_uidIgnore.
+-- Raises exception if duplicates are found.
+--
+-- @internal
+--
+CREATE OR REPLACE FUNCTION UserAccountLogic_checkUniqueUser(a_sUsername TEXT, a_sLoginName TEXT, a_uidIgnore INTEGER)
+    RETURNS VOID AS $$
+    DECLARE
+        v_cRows INTEGER;
+    BEGIN
+        -- sUserName
+        SELECT  COUNT(*) INTO v_cRows
+        FROM    Users
+        WHERE   sUsername = a_sUsername
+            AND tsExpire  = 'infinity'::TIMESTAMP
+            AND uid      <> a_uidIgnore;
+        IF v_cRows <> 0 THEN
+            RAISE EXCEPTION 'Duplicate user name "%" (% times)', a_sUsername, v_cRows;
+        END IF;
+
+        -- sLoginName
+        SELECT  COUNT(*) INTO v_cRows
+        FROM    Users
+        WHERE   sLoginName = a_sLoginName
+            AND tsExpire   = 'infinity'::TIMESTAMP
+            AND uid       <> a_uidIgnore;
+        IF v_cRows <> 0 THEN
+            RAISE EXCEPTION 'Duplicate login name "%" (% times)', a_sUsername, v_cRows;
+        END IF;
+    END;
+$$ LANGUAGE plpgsql;
+              
+---
+-- Check that the user account exists.
+-- Raises exception if it doesn't.
+--
+-- @internal
+--
+CREATE OR REPLACE FUNCTION UserAccountLogic_checkExists(a_uid INTEGER) RETURNS VOID AS $$
+    DECLARE
+        v_cUpdatedRows INTEGER;
+    BEGIN
+        IF NOT EXISTS(  SELECT  *
+                        FROM    Users
+                        WHERE   uid       = a_uid
+                            AND tsExpire  = 'infinity'::TIMESTAMP ) THEN
+            RAISE EXCEPTION 'User with ID % does not currently exist', a_uid;
+        END IF;
+    END;
+$$ LANGUAGE plpgsql;
+
+---
+-- Historize a row.
+-- @internal
+--
+CREATE OR REPLACE FUNCTION UserAccountLogic_historizeEntry(a_uid INTEGER, a_tsExpire TIMESTAMP WITH TIME ZONE) 
+    RETURNS VOID AS $$
+    DECLARE
+        v_cUpdatedRows INTEGER;
+    BEGIN
+        UPDATE  Users
+          SET   tsExpire = a_tsExpire
+          WHERE uid      = a_uid
+            AND tsExpire = 'infinity'::TIMESTAMP;
+        GET DIAGNOSTICS v_cUpdatedRows = ROW_COUNT;
+        IF v_cUpdatedRows <> 1 THEN
+            IF v_cUpdatedRows = 0 THEN
+                RAISE EXCEPTION 'User with ID % does not currently exist', a_uid;
+            END IF;
+            RAISE EXCEPTION 'Integrity error in UserAccounts: % current rows with uid=%d', v_cUpdatedRows, a_uid;
+        END IF;
+    END;
+$$ LANGUAGE plpgsql;
+
+
+---
+-- Adds a new user.
+--
+CREATE OR REPLACE FUNCTION UserAccountLogic_addEntry(a_uidAuthor INTEGER, a_sUsername TEXT, a_sEmail TEXT, a_sFullName TEXT, 
+                                                     a_sLoginName TEXT) 
+    RETURNS VOID AS $$
+    DECLARE
+        v_cRows INTEGER;
+    BEGIN
+        PERFORM UserAccountLogic_checkUniqueUser(a_sUsername, a_sLoginName, -1);
+        INSERT INTO Users(uidAuthor, sUsername, sEmail, sFullName, sLoginName)
+            VALUES (a_uidAuthor, a_sUsername, a_sEmail, a_sFullName, a_sLoginName);
+    END;
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION UserAccountLogic_editEntry(a_uidAuthor INTEGER, a_uid INTEGER, a_sUsername TEXT, a_sEmail TEXT, 
+                                                      a_sFullName TEXT, a_sLoginName TEXT)  
+    RETURNS VOID AS $$
+    BEGIN
+        PERFORM UserAccountLogic_checkExists(a_uid);
+        PERFORM UserAccountLogic_checkUniqueUser(a_sUsername, a_sLoginName, a_uid);
+
+        PERFORM UserAccountLogic_historizeEntry(a_uid, CURRENT_TIMESTAMP);
+        INSERT INTO Users (uid, uidAuthor, sUsername, sEmail, sFullName, sLoginName)
+            VALUES (a_uid, a_uidAuthor, a_sUsername, a_sEmail, a_sFullName, a_sLoginName);
+    END;
+$$ LANGUAGE plpgsql;
+
+
+CREATE OR REPLACE FUNCTION UserAccountLogic_delEntry(a_uidAuthor INTEGER, a_uid INTEGER) RETURNS VOID AS $$
+    DECLARE
+        v_Row           Users%ROWTYPE;
+        v_tsEffective   TIMESTAMP WITH TIME ZONE;
+    BEGIN
+        --
+        -- To preserve the information about who deleted the record, we try to
+        -- add a dummy record which expires immediately.  I say try because of 
+        -- the primary key, we must let the new record be valid for 1 us. :-(
+        --
+
+        SELECT  * INTO STRICT v_Row
+        FROM    Users
+        WHERE   uid      = a_uid
+            AND tsExpire = 'infinity'::TIMESTAMP;
+
+        v_tsEffective := CURRENT_TIMESTAMP - INTERVAL '1 microsecond';
+        IF v_Row.tsEffective < v_tsEffective THEN
+            PERFORM UserAccountLogic_historizeEntry(a_uid, v_tsEffective);
+            v_Row.tsEffective = v_tsEffective;
+            v_Row.tsExpire    = CURRENT_TIMESTAMP;
+            INSERT INTO Users VALUES (v_Row.*);
+        ELSE
+            PERFORM UserAccountLogic_historizeEntry(a_uid, CURRENT_TIMESTAMP);
+        END IF;
+
+    EXCEPTION
+        WHEN NO_DATA_FOUND THEN
+            RAISE EXCEPTION 'User with ID % does not currently exist', a_uid;
+        WHEN TOO_MANY_ROWS THEN
+            RAISE EXCEPTION 'Integrity error in UserAccounts: Too many current rows for %', a_uid;
+    END;
+$$ LANGUAGE plpgsql;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/useraccount.py b/src/VBox/ValidationKit/testmanager/core/useraccount.py
new file mode 100644
index 0000000..725df2d
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/useraccount.py
@@ -0,0 +1,257 @@
+# -*- coding: utf-8 -*-
+# $Id: useraccount.py $
+
+"""
+Test Manager - User DB records management.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from testmanager            import config;
+from testmanager.core.base  import ModelDataBase, ModelLogicBase, ModelDataBaseTestCase, TMExceptionBase;
+
+
+class UserAccountData(ModelDataBase):
+    """
+    User account data
+    """
+
+    ksIdAttr    = 'uid';
+
+    ksParam_uid                 = 'UserAccount_uid'
+    ksParam_tsExpire            = 'UserAccount_tsExpire'
+    ksParam_tsEffective         = 'UserAccount_tsEffective'
+    ksParam_uidAuthor           = 'UserAccount_uidAuthor'
+    ksParam_sLoginName          = 'UserAccount_sLoginName'
+    ksParam_sUsername           = 'UserAccount_sUsername'
+    ksParam_sEmail              = 'UserAccount_sEmail'
+    ksParam_sFullName           = 'UserAccount_sFullName'
+
+    kasAllowNullAttributes      = ['uid', 'tsEffective', 'tsExpire', 'uidAuthor'];
+
+
+    def __init__(self):
+        """Init parameters"""
+        ModelDataBase.__init__(self);
+        self.uid            = None;
+        self.tsEffective    = None;
+        self.tsExpire       = None;
+        self.uidAuthor      = None;
+        self.sUsername      = None;
+        self.sEmail         = None;
+        self.sFullName      = None;
+        self.sLoginName     = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Init from database table row
+        Returns self. Raises exception of the row is None.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('User not found.');
+
+        self.uid            = aoRow[0];
+        self.tsEffective    = aoRow[1];
+        self.tsExpire       = aoRow[2];
+        self.uidAuthor      = aoRow[3];
+        self.sUsername      = aoRow[4];
+        self.sEmail         = aoRow[5];
+        self.sFullName      = aoRow[6];
+        self.sLoginName     = aoRow[7];
+        return self;
+
+    def initFromDbWithId(self, oDb, uid, tsNow = None, sPeriodBack = None):
+        """
+        Initialize the object from the database.
+        """
+        oDb.execute(self.formatSimpleNowAndPeriodQuery(oDb,
+                                                       'SELECT *\n'
+                                                       'FROM   Users\n'
+                                                       'WHERE  uid = %s\n'
+                                                       , ( uid, ), tsNow, sPeriodBack));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('uid=%s not found (tsNow=%s sPeriodBack=%s)' % (uid, tsNow, sPeriodBack,));
+        return self.initFromDbRow(aoRow);
+
+    def _validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb):
+        # Custom handling of the email field.
+        if sAttr == 'sEmail':
+            return ModelDataBase.validateEmail(oValue, aoNilValues = aoNilValues, fAllowNull = fAllowNull);
+
+        # Automatically lowercase the login name if we're supposed to do case
+        # insensitive matching.  (The feature assumes lower case in DB.)
+        if sAttr == 'sLoginName' and oValue is not None and config.g_kfLoginNameCaseInsensitive:
+            oValue = oValue.lower();
+
+        return ModelDataBase._validateAndConvertAttribute(self, sAttr, sParam, oValue, aoNilValues, fAllowNull, oDb);
+
+
+class UserAccountLogic(ModelLogicBase):
+    """
+    SystemLog logic.
+    """
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches user accounts.
+
+        Returns an array (list) of UserAccountData items, empty list if none.
+        Raises exception on error.
+        """
+        if tsNow is None:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     Users\n'
+                              'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                              'ORDER BY sUsername DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (cMaxRows, iStart,));
+        else:
+            self._oDb.execute('SELECT   *\n'
+                              'FROM     Users\n'
+                              'WHERE    tsExpire     > %s\n'
+                              '     AND tsEffective <= %s\n'
+                              'ORDER BY sUsername DESC\n'
+                              'LIMIT %s OFFSET %s\n'
+                              , (tsNow, tsNow, cMaxRows, iStart,));
+
+        aoRows = [];
+        for _ in range(self._oDb.getRowCount()):
+            aoRows.append(UserAccountData().initFromDbRow(self._oDb.fetchOne()));
+        return aoRows;
+
+    def addEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Add user account entry to the DB.
+        """
+        self._oDb.callProc('UserAccountLogic_addEntry',
+                           (uidAuthor, oData.sUsername, oData.sEmail, oData.sFullName, oData.sLoginName,));
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def editEntry(self, oData, uidAuthor, fCommit = False):
+        """
+        Modify user account.
+        """
+        self._oDb.callProc('UserAccountLogic_editEntry',
+                           (uidAuthor, oData.uid, oData.sUsername, oData.sEmail, oData.sFullName, oData.sLoginName,));
+        self._oDb.maybeCommit(fCommit);
+        return True;
+
+    def removeEntry(self, uidAuthor, uid, fCascade = False, fCommit = False):
+        """
+        Delete user account
+        """
+        self._oDb.callProc('UserAccountLogic_delEntry', (uidAuthor, uid));
+        self._oDb.maybeCommit(fCommit);
+        _ = fCascade;
+        return True;
+
+    def _getByField(self, sField, sValue):
+        """
+        Get user account record by its field value
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     Users\n'
+                          'WHERE    tsExpire = \'infinity\'::TIMESTAMP\n'
+                          '  AND    ' + sField + ' = %s'
+                          , (sValue,))
+
+        aRows = self._oDb.fetchAll()
+        if len(aRows) not in (0, 1):
+            raise TMExceptionBase('Found more than one user account with the same credentials. Database structure is corrupted.')
+
+        try:
+            return aRows[0]
+        except IndexError:
+            return []
+
+    def getById(self, idUserId):
+        """
+        Get user account information by ID.
+        """
+        return self._getByField('uid', idUserId)
+
+    def tryFetchAccountByLoginName(self, sLoginName):
+        """
+        Try get user account information by login name.
+
+        Returns UserAccountData if found, None if not.
+        Raises exception on DB error.
+        """
+        if config.g_kfLoginNameCaseInsensitive:
+            sLoginName = sLoginName.lower();
+
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     Users\n'
+                          'WHERE    sLoginName = %s\n'
+                          '     AND tsExpire = \'infinity\'::TIMESTAMP\n'
+                          , (sLoginName, ));
+        if self._oDb.getRowCount() != 1:
+            if self._oDb.getRowCount() != 0:
+                raise self._oDb.integrityException('%u rows in Users with sLoginName="%s"'
+                                                   % (self._oDb.getRowCount(), sLoginName));
+            return None;
+        return UserAccountData().initFromDbRow(self._oDb.fetchOne());
+
+    def resolveChangeLogAuthors(self, aoEntries):
+        """
+        Given an array of ChangeLogEntry instances, set sAuthor to whatever
+        uidAuthor resolves to.
+
+        Returns aoEntries.
+        Raises exception on DB error.
+        """
+        ahCache = dict();
+        for oEntry in aoEntries:
+            oEntry.sAuthor = ahCache.get(oEntry.uidAuthor, None);
+            if oEntry.sAuthor is None and oEntry.uidAuthor is not None:
+                try:
+                    oUser = UserAccountData().initFromDbWithId(self._oDb, oEntry.uidAuthor, oEntry.tsEffective);
+                except:
+                    pass;
+                else:
+                    ahCache[oEntry.uidAuthor] = oUser.sUsername;
+                    oEntry.sAuthor = oUser.sUsername;
+        return aoEntries;
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class UserAccountDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [UserAccountData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/vcsrevisions.py b/src/VBox/ValidationKit/testmanager/core/vcsrevisions.py
new file mode 100644
index 0000000..842d0ea
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/vcsrevisions.py
@@ -0,0 +1,242 @@
+# -*- coding: utf-8 -*-
+# $Id: vcsrevisions.py $
+
+"""
+Test Manager - VcsRevisions
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import unittest;
+
+# Validation Kit imports.
+from testmanager.core.base              import ModelDataBase, ModelDataBaseTestCase, ModelLogicBase, TMExceptionBase;
+
+
+class VcsRevisionData(ModelDataBase):
+    """
+    A version control system (VCS) revision.
+    """
+
+    #kasIdAttr = ['sRepository',iRevision];
+
+    ksParam_sRepository         = 'VcsRevision_sRepository';
+    ksParam_iRevision           = 'VcsRevision_iRevision';
+    ksParam_tsCreated           = 'VcsRevision_tsCreated';
+    ksParam_sAuthor             = 'VcsRevision_sAuthor';
+    ksParam_sMessage            = 'VcsRevision_sMessage';
+
+    kasAllowNullAttributes      = [ ];
+
+    def __init__(self):
+        ModelDataBase.__init__(self);
+
+        #
+        # Initialize with defaults.
+        # See the database for explanations of each of these fields.
+        #
+        self.sRepository        = None;
+        self.iRevision          = None;
+        self.tsCreated          = None;
+        self.sAuthor            = None;
+        self.sMessage           = None;
+
+    def initFromDbRow(self, aoRow):
+        """
+        Re-initializes the object from a SELECT * FROM VcsRevisions row.
+        Returns self.  Raises exception if aoRow is None.
+        """
+        if aoRow is None:
+            raise TMExceptionBase('VcsRevision not found.');
+
+        self.sRepository         = aoRow[0];
+        self.iRevision           = aoRow[1];
+        self.tsCreated           = aoRow[2];
+        self.sAuthor             = aoRow[3];
+        self.sMessage            = aoRow[4];
+        return self;
+
+    def initFromDbWithRepoAndRev(self, oDb, sRepository, iRevision):
+        """
+        Initialize from the database, given the tree and revision of a row.
+        """
+        oDb.execute('SELECT * FROM VcsRevisions WHERE sRepository = %s AND iRevision = %u', (sRepository, iRevision,));
+        aoRow = oDb.fetchOne()
+        if aoRow is None:
+            raise TMExceptionBase('sRepository = %s iRevision = %u not found' % (sRepository, iRevision, ));
+        return self.initFromDbRow(aoRow);
+
+    def initFromValues(self, sRepository, iRevision, tsCreated, sAuthor, sMessage):
+        """
+        Reinitializes form a set of values.
+        return self.
+        """
+        self.sRepository        = sRepository;
+        self.iRevision          = iRevision;
+        self.tsCreated          = tsCreated;
+        self.sAuthor            = sAuthor;
+        self.sMessage           = sMessage;
+        return self;
+
+
+class VcsRevisionLogic(ModelLogicBase): # pylint: disable=R0903
+    """
+    VCS revisions database logic.
+    """
+
+    #
+    # Standard methods.
+    #
+
+    def fetchForListing(self, iStart, cMaxRows, tsNow):
+        """
+        Fetches VCS revisions for listing.
+
+        Returns an array (list) of VcsRevisionData items, empty list if none.
+        Raises exception on error.
+        """
+        _ = tsNow;
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     VcsRevisions\n'
+                          'ORDER BY tsCreated, sRepository, iRevision\n'
+                          'LIMIT %s OFFSET %s\n'
+                          , (cMaxRows, iStart,));
+
+        aoRows = [];
+        for _ in range(self._oDb.getRowCount()):
+            aoRows.append(VcsRevisionData().initFromDbRow(self._oDb.fetchOne()));
+        return aoRows;
+
+    def tryFetch(self, sRepository, iRevision):
+        """
+        Tries to fetch the specified tree revision record.
+        Returns VcsRevisionData instance if found, None if not found.
+        Raises exception on input and database errors.
+        """
+        self._oDb.execute('SELECT * FROM VcsRevisions WHERE sRepository = %s AND iRevision = %s',
+                          ( sRepository, iRevision, ));
+        aaoRows = self._oDb.fetchAll();
+        if len(aaoRows) == 1:
+            return VcsRevisionData().initFromDbRow(aaoRows[0]);
+        if len(aaoRows) != 0:
+            raise TMExceptionBase('VcsRevisions has a primary key problem: %u duplicates' % (len(aaoRows),));
+        return None
+
+
+    #
+    # Other methods.
+    #
+
+    def addVcsRevision(self, oData, fCommit = False):
+        """
+        Adds (or updates) a tree revision record.
+        Raises exception on input and database errors.
+        """
+
+        # Check VcsRevisionData before do anything
+        dDataErrors = oData.validateAndConvert(self._oDb);
+        if len(dDataErrors) > 0:
+            raise TMExceptionBase('Invalid data passed to addCvsRevision(): %s' % (dDataErrors,));
+
+        # Does it already exist?
+        oOldData = self.tryFetch(oData.sRepository, oData.iRevision);
+        if oOldData is None:
+            # New row.
+            self._oDb.execute('INSERT INTO VcsRevisions (sRepository, iRevision, tsCreated, sAuthor, sMessage)\n'
+                              'VALUES (%s, %s, %s, %s, %s)\n'
+                              , ( oData.sRepository,
+                                  oData.iRevision,
+                                  oData.tsCreated,
+                                  oData.sAuthor,
+                                  oData.sMessage,
+                              ));
+        elif not oOldData.isEqual(oData):
+            # Update old row.
+            self._oDb.execute('UPDATE VcsRevisions\n'
+                              '   SET tsCreated   = %s,\n'
+                              '       sAuthor     = %s,\n'
+                              '       sMessage    = %s\n'
+                              'WHERE  sRepository = %s\n'
+                              '   AND iRevision   = %s'
+                              , ( oData.tsCreated,
+                                  oData.sAuthor,
+                                  oData.sMessage,
+                                  oData.sRepository,
+                                  oData.iRevision,
+                              ));
+
+        self._oDb.maybeCommit(fCommit);
+        return oData;
+
+    def getLastRevision(self, sRepository):
+        """
+        Get the last known revision number for the given repository, returns 0
+        if the repository is not known to us:
+        """
+        self._oDb.execute('SELECT iRevision\n'
+                          'FROM   VcsRevisions\n'
+                          'WHERE  sRepository = %s\n'
+                          'ORDER BY iRevision DESC\n'
+                          'LIMIT 1\n'
+                          , ( sRepository, ));
+        if self._oDb.getRowCount() == 0:
+            return 0;
+        return self._oDb.fetchOne()[0];
+
+    def fetchTimeline(self, sRepository, iRevision, cEntriesBack):
+        """
+        Fetches a VCS timeline portion for a repository.
+
+        Returns an array (list) of VcsRevisionData items, empty list if none.
+        Raises exception on error.
+        """
+        self._oDb.execute('SELECT   *\n'
+                          'FROM     VcsRevisions\n'
+                          'WHERE    sRepository = %s\n'
+                          '   AND   iRevision  >  %s\n'
+                          '   AND   iRevision  <= %s\n'
+                          'ORDER BY iRevision DESC\n'
+                          'LIMIT    %s\n'
+                          , ( sRepository, iRevision - cEntriesBack*2 + 1, iRevision, cEntriesBack));
+        aoRows = [];
+        for _ in range(self._oDb.getRowCount()):
+            aoRows.append(VcsRevisionData().initFromDbRow(self._oDb.fetchOne()));
+        return aoRows;
+
+
+#
+# Unit testing.
+#
+
+# pylint: disable=C0111
+class VcsRevisionDataTestCase(ModelDataBaseTestCase):
+    def setUp(self):
+        self.aoSamples = [VcsRevisionData(),];
+
+if __name__ == '__main__':
+    unittest.main();
+    # not reached.
+
diff --git a/src/VBox/ValidationKit/testmanager/core/webservergluebase.py b/src/VBox/ValidationKit/testmanager/core/webservergluebase.py
new file mode 100644
index 0000000..b7c5360
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/webservergluebase.py
@@ -0,0 +1,611 @@
+# -*- coding: utf-8 -*-
+# $Id: webservergluebase.py $
+
+"""
+Test Manager Core - Web Server Abstraction Base Class.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import cgitb
+import codecs;
+import os
+import sys
+
+# Validation Kit imports.
+from common         import webutils, utils;
+from testmanager    import config;
+
+
+class WebServerGlueException(Exception):
+    """
+    For exceptions raised by glue code.
+    """
+    pass;
+
+
+class WebServerGlueBase(object):
+    """
+    Web server interface abstraction and some HTML utils.
+    """
+
+    ## Enables more debug output.
+    kfDebugInfoEnabled = True;
+
+    ## The maximum number of characters to cache.
+    kcchMaxCached = 65536;
+
+    ## Special getUserName return value.
+    ksUnknownUser = 'Unknown User';
+
+
+    def __init__(self, sValidationKitDir, fHtmlDebugOutput = True):
+        self._sValidationKitDir    = sValidationKitDir;
+
+        # Debug
+        self.tsStart           = utils.timestampNano();
+        self._fHtmlDebugOutput = fHtmlDebugOutput; # For trace
+        self._oDbgFile         = sys.stderr;
+        if config.g_ksSrcGlueDebugLogDst is not None and config.g_kfSrvGlueDebug is True:
+            self._oDbgFile = open(config.g_ksSrcGlueDebugLogDst, 'a');
+        self._afnDebugInfo     = [];
+
+        # HTTP header.
+        self._fHeaderWrittenOut = False;
+        self._dHeaderFields = \
+        { \
+            'Content-Type': 'text/html; charset=utf-8',
+        };
+
+        # Body.
+        self._sBodyType = None;
+        self._dParams = dict();
+        self._sHtmlBody = '';
+        self._cchCached = 0;
+        self._cchBodyWrittenOut = 0;
+
+        # Output.
+        self.oOutputRaw = sys.stdout;
+        self.oOutputText = codecs.getwriter('utf-8')(sys.stdout);
+
+
+    #
+    # Get stuff.
+    #
+
+    def getParameters(self):
+        """
+        Returns a dictionary with the query parameters.
+
+        The parameter name is the key, the values are given as lists.  If a
+        parameter is given more than once, the value is appended to the
+        existing dictionary entry.
+        """
+        return dict();
+
+    def getClientAddr(self):
+        """
+        Returns the client address, as a string.
+        """
+        raise WebServerGlueException('getClientAddr is not implemented');
+
+    def getMethod(self):
+        """
+        Gets the HTTP request method.
+        """
+        return 'POST';
+
+    def getLoginName(self):
+        """
+        Gets login name provided by Apache.
+        Returns kUnknownUser if not logged on.
+        """
+        return WebServerGlueBase.ksUnknownUser;
+
+    def getUrlScheme(self):
+        """
+        Gets scheme name (aka. access protocol) from request URL, i.e. 'http' or 'https'.
+        See also urlparse.scheme.
+        """
+        return 'http';
+
+    def getUrlNetLoc(self):
+        """
+        Gets the network location (server host name / ip) from the request URL.
+        See also urlparse.netloc.
+        """
+        raise WebServerGlueException('getUrlNetLoc is not implemented');
+
+    def getUrlPath(self):
+        """
+        Gets the hirarchical path (relative to server) from the request URL.
+        See also urlparse.path.
+        Note! This includes the leading slash.
+        """
+        raise WebServerGlueException('getUrlPath is not implemented');
+
+    def getUrlBasePath(self):
+        """
+        Gets the hirarchical base path (relative to server) from the request URL.
+        Note! This includes both a leading an trailing slash.
+        """
+        sPath = self.getUrlPath();
+        iLastSlash = sPath.rfind('/');
+        if iLastSlash >= 0:
+            sPath = sPath[:iLastSlash];
+            sPath = sPath.rstrip('/');
+        return sPath + '/';
+
+    def getUrl(self):
+        """
+        Gets the URL being accessed, sans parameters.
+        For instance this will return, "http://localhost/testmanager/admin.cgi"
+        when "http://localhost/testmanager/admin.cgi?blah=blah" is being access.
+        """
+        return '%s://%s%s' % (self.getUrlScheme(), self.getUrlNetLoc(), self.getUrlPath());
+
+    def getBaseUrl(self):
+        """
+        Gets the base URL (with trailing slash).
+        For instance this will return, "http://localhost/testmanager/" when
+        "http://localhost/testmanager/admin.cgi?blah=blah" is being access.
+        """
+        return '%s://%s%s' % (self.getUrlScheme(), self.getUrlNetLoc(), self.getUrlBasePath());
+
+    def getUserAgent(self):
+        """
+        Gets the User-Agent field of the HTTP header, returning empty string
+        if not present.
+        """
+        return '';
+
+    def getContentType(self):
+        """
+        Gets the Content-Type field of the HTTP header, parsed into a type
+        string and a dictionary.
+        """
+        return ('text/html', {});
+
+    def getContentLength(self):
+        """
+        Gets the content length.
+        Returns int.
+        """
+        return 0;
+
+    def getBodyIoStream(self):
+        """
+        Returns file object for reading the HTML body.
+        """
+        raise WebServerGlueException('getUrlPath is not implemented');
+
+    #
+    # Output stuff.
+    #
+
+    def _writeHeader(self, sHeaderLine):
+        """
+        Worker function which child classes can override.
+        """
+        self.oOutputText.write(sHeaderLine);
+        return True;
+
+    def flushHeader(self):
+        """
+        Flushes the HTTP header.
+        """
+        if self._fHeaderWrittenOut is False:
+            for sKey in self._dHeaderFields:
+                self._writeHeader('%s: %s\n' % (sKey, self._dHeaderFields[sKey]));
+            self._fHeaderWrittenOut = True;
+            self._writeHeader('\n'); # End of header indicator.
+        return None;
+
+    def setHeaderField(self, sField, sValue):
+        """
+        Sets a header field.
+        """
+        assert self._fHeaderWrittenOut is False;
+        self._dHeaderFields[sField] = sValue;
+        return True;
+
+    def setRedirect(self, sLocation, iCode = 302):
+        """
+        Sets up redirection of the page.
+        Raises an exception if called too late.
+        """
+        if self._fHeaderWrittenOut is True:
+            raise WebServerGlueException('setRedirect called after the header was written');
+        if iCode != 302:
+            raise WebServerGlueException('Redirection code %d is not supported' % (iCode,));
+
+        self.setHeaderField('Location', sLocation);
+        self.setHeaderField('Status', '302 Found');
+        return True;
+
+    def _writeWorker(self, sChunkOfHtml):
+        """
+        Worker function which child classes can override.
+        """
+        self.oOutputText.write(sChunkOfHtml);
+        return True;
+
+    def write(self, sChunkOfHtml):
+        """
+        Writes chunk of HTML, making sure the HTTP header is flushed first.
+        """
+        if self._sBodyType is None:
+            self._sBodyType = 'html';
+        elif self._sBodyType is not 'html':
+            raise WebServerGlueException('Cannot use writeParameter when body type is "%s"' % (self._sBodyType, ));
+
+        self._sHtmlBody += sChunkOfHtml;
+        self._cchCached += len(sChunkOfHtml);
+
+        if self._cchCached > self.kcchMaxCached:
+            self.flush();
+        return True;
+
+    def writeRaw(self, abChunk):
+        """
+        Writes a raw chunk the document. Can be binary or any encoding.
+        No caching.
+        """
+        if self._sBodyType is None:
+            self._sBodyType = 'html';
+        elif self._sBodyType is not 'html':
+            raise WebServerGlueException('Cannot use writeParameter when body type is "%s"' % (self._sBodyType, ));
+
+        self.flushHeader();
+        if self._cchCached > 0:
+            self.flush();
+
+        self.oOutputRaw.write(abChunk);
+        return True;
+
+    def writeParams(self, dParams):
+        """
+        Writes one or more reply parameters in a form style response. The names
+        and values in dParams are unencoded, this method takes care of that.
+
+        Note! This automatically changes the content type to
+        'application/x-www-form-urlencoded', if the header hasn't been flushed
+        already.
+        """
+        if self._sBodyType is None:
+            if not self._fHeaderWrittenOut:
+                self.setHeaderField('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
+            elif self._dHeaderFields['Content-Type'] != 'application/x-www-form-urlencoded; charset=utf-8':
+                raise WebServerGlueException('Cannot use writeParams when content-type is "%s"' % \
+                                             (self._dHeaderFields['Content-Type'],));
+            self._sBodyType = 'form';
+
+        elif self._sBodyType is not 'form':
+            raise WebServerGlueException('Cannot use writeParams when body type is "%s"' % (self._sBodyType, ));
+
+        for sKey in dParams:
+            sValue = str(dParams[sKey]);
+            self._dParams[sKey] = sValue;
+            self._cchCached += len(sKey) + len(sValue);
+
+        if self._cchCached > self.kcchMaxCached:
+            self.flush();
+
+        return True;
+
+    def flush(self):
+        """
+        Flush the output.
+        """
+        self.flushHeader();
+
+        if self._sBodyType == 'form':
+            sBody = webutils.encodeUrlParams(self._dParams);
+            self._writeWorker(sBody);
+
+            self._dParams = dict();
+            self._cchBodyWrittenOut += self._cchCached;
+
+        elif self._sBodyType == 'html':
+            self._writeWorker(self._sHtmlBody);
+
+            self._sHtmlBody = '';
+            self._cchBodyWrittenOut += self._cchCached;
+
+        self._cchCached = 0;
+        return None;
+
+    #
+    # Paths.
+    #
+
+    def pathTmWebUI(self):
+        """
+        Gets the path to the TM 'webui' directory.
+        """
+        return os.path.join(self._sValidationKitDir, 'testmanager', 'webui');
+
+    #
+    # Error stuff & Debugging.
+    #
+
+    def errorLog(self, sError, aXcptInfo, sLogFile):
+        """
+        Writes the error to a log file.
+        """
+        # Easy solution for log file size: Only one report.
+        try:    os.unlink(sLogFile);
+        except: pass;
+
+        # Try write the log file.
+        fRc    = True;
+        fSaved = self._fHtmlDebugOutput;
+
+        try:
+            oFile = open(sLogFile, 'w');
+            oFile.write(sError + '\n\n');
+            if aXcptInfo[0] is not None:
+                oFile.write(' B a c k t r a c e\n');
+                oFile.write('===================\n');
+                oFile.write(cgitb.text(aXcptInfo, 5));
+                oFile.write('\n\n');
+
+            oFile.write(' D e b u g   I n f o\n');
+            oFile.write('=====================\n\n');
+            self._fHtmlDebugOutput = False;
+            self.debugDumpStuff(oFile.write);
+
+            oFile.close();
+        except:
+            fRc = False;
+
+        self._fHtmlDebugOutput = fSaved;
+        return fRc;
+
+    def errorPage(self, sError, aXcptInfo, sLogFile = None):
+        """
+        Displays a page with an error message.
+        """
+        if sLogFile is not None:
+            self.errorLog(sError, aXcptInfo, sLogFile);
+
+        # Reset buffering, hoping that nothing was flushed yet.
+        self._sBodyType = None;
+        self._sHtmlBody = '';
+        self._cchCached = 0;
+        if not self._fHeaderWrittenOut:
+            if self._fHtmlDebugOutput:
+                self.setHeaderField('Content-Type', 'text/html; charset=utf-8');
+            else:
+                self.setHeaderField('Content-Type', 'text/plain; charset=utf-8');
+
+        # Write the error page.
+        if self._fHtmlDebugOutput:
+            self.write('<html><head><title>Test Manage Error</title></head>\n' +
+                       '<body><h1>Test Manager Error:</h1>\n' +
+                       '<p>' + sError + '</p>\n');
+        else:
+            self.write(' Test Manage Error\n'
+                       '===================\n'
+                       '\n'
+                       '' + sError + '\n\n');
+
+        if aXcptInfo[0] is not None:
+            if self._fHtmlDebugOutput:
+                self.write('<h1>Backtrace:</h1>\n');
+                self.write(cgitb.html(aXcptInfo, 5));
+            else:
+                self.write('Backtrace\n'
+                           '---------\n'
+                           '\n');
+                self.write(cgitb.text(aXcptInfo, 5));
+                self.write('\n\n');
+
+        if self.kfDebugInfoEnabled:
+            if self._fHtmlDebugOutput:
+                self.write('<h1>Debug Info:</h1>\n');
+            else:
+                self.write('Debug Info\n'
+                           '----------\n'
+                           '\n');
+            self.debugDumpStuff();
+
+            for fn in self._afnDebugInfo:
+                try:
+                    fn(self, self._fHtmlDebugOutput);
+                except Exception as oXcpt:
+                    self.write('\nDebug info callback %s raised exception: %s\n' % (fn, oXcpt));
+
+        if self._fHtmlDebugOutput:
+            self.write('</body></html>');
+
+        self.flush();
+
+    def debugInfoPage(self, fnWrite = None):
+        """
+        Dumps useful debug info.
+        """
+        if fnWrite is None:
+            fnWrite = self.write;
+
+        fnWrite('<html><head><title>Test Manage Debug Info</title></head>\n<body>\n');
+        self.debugDumpStuff(fnWrite = fnWrite);
+        fnWrite('</body></html>');
+        self.flush();
+
+    def debugDumpDict(self, sName, dDict, fSorted = True, fnWrite = None):
+        """
+        Dumps dictionary.
+        """
+        if fnWrite is None:
+            fnWrite = self.write;
+
+        asKeys = list(dDict.keys());
+        if fSorted:
+            asKeys.sort();
+
+        if self._fHtmlDebugOutput:
+            fnWrite('<h2>%s</h2>\n'
+                    '<table border="1"><tr><th>name</th><th>value</th></tr>\n' % (sName,));
+            for sKey in asKeys:
+                fnWrite('  <tr><td>' + webutils.escapeElem(sKey) + '</td><td>' \
+                        + webutils.escapeElem(str(dDict.get(sKey))) \
+                        + '</td></tr>\n');
+            fnWrite('</table>\n');
+        else:
+            for i in range(len(sName) - 1):
+                fnWrite('%s ' % (sName[i],));
+            fnWrite('%s\n\n' % (sName[-1],));
+
+            fnWrite('%28s  Value\n' % ('Name',));
+            fnWrite('------------------------------------------------------------------------\n');
+            for sKey in asKeys:
+                fnWrite('%28s: %s\n' % (sKey, dDict.get(sKey),));
+            fnWrite('\n');
+
+        return True;
+
+    def debugDumpList(self, sName, aoStuff, fnWrite = None):
+        """
+        Dumps array.
+        """
+        if fnWrite is None:
+            fnWrite = self.write;
+
+        if self._fHtmlDebugOutput:
+            fnWrite('<h2>%s</h2>\n'
+                    '<table border="1"><tr><th>index</th><th>value</th></tr>\n' % (sName,));
+            for i in range(len(aoStuff)):
+                fnWrite('  <tr><td>' + str(i) + '</td><td>' + webutils.escapeElem(str(aoStuff[i])) + '</td></tr>\n');
+            fnWrite('</table>\n');
+        else:
+            for i in range(len(sName) - 1):
+                fnWrite('%s ' % (sName[i],));
+            fnWrite('%s\n\n' % (sName[-1],));
+
+            fnWrite('Index  Value\n');
+            fnWrite('------------------------------------------------------------------------\n');
+            for i in range(len(aoStuff)):
+                fnWrite('%5u  %s\n' % (i, str(aoStuff[i])));
+            fnWrite('\n');
+
+        return True;
+
+    def debugDumpParameters(self, fnWrite):
+        """ Dumps request parameters. """
+        if fnWrite is None:
+            fnWrite = self.write;
+
+        try:
+            dParams = self.getParameters();
+            return self.debugDumpDict('Parameters', dParams);
+        except Exception as oXcpt:
+            if self._fHtmlDebugOutput:
+                fnWrite('<p>Exception %s while retriving parameters.</p>\n' % (oXcpt,))
+            else:
+                fnWrite('Exception %s while retriving parameters.\n' % (oXcpt,))
+            return False;
+
+    def debugDumpEnv(self, fnWrite = None):
+        """ Dumps os.environ. """
+        return self.debugDumpDict('Environment (os.environ)', os.environ, fnWrite = fnWrite);
+
+    def debugDumpArgv(self, fnWrite = None):
+        """ Dumps sys.argv. """
+        return self.debugDumpList('Arguments (sys.argv)', sys.argv, fnWrite = fnWrite);
+
+    def debugDumpPython(self, fnWrite = None):
+        """
+        Dump python info.
+        """
+        dInfo = {};
+        dInfo['sys.version']                = sys.version;
+        dInfo['sys.hexversion']             = sys.hexversion;
+        dInfo['sys.api_version']            = sys.api_version;
+        dInfo['sys.subversion']             = sys.subversion;
+        dInfo['sys.platform']               = sys.platform;
+        dInfo['sys.executable']             = sys.executable;
+        dInfo['sys.copyright']              = sys.copyright;
+        dInfo['sys.byteorder']              = sys.byteorder;
+        dInfo['sys.exec_prefix']            = sys.exec_prefix;
+        dInfo['sys.prefix']                 = sys.prefix;
+        dInfo['sys.path']                   = sys.path;
+        dInfo['sys.builtin_module_names']   = sys.builtin_module_names;
+        dInfo['sys.flags']                  = sys.flags;
+
+        return self.debugDumpDict('Python Info', dInfo, fnWrite = fnWrite);
+
+
+    def debugDumpStuff(self, fnWrite = None):
+        """
+        Dumps stuff to the error page and debug info page.
+        Should be extended by child classes when possible.
+        """
+        self.debugDumpParameters(fnWrite);
+        self.debugDumpEnv(fnWrite);
+        self.debugDumpArgv(fnWrite);
+        self.debugDumpPython(fnWrite);
+        return True;
+
+    def dprint(self, sMessage):
+        """
+        Prints to debug log (usually apache error log).
+        """
+        if config.g_kfSrvGlueDebug is True:
+            if config.g_kfSrvGlueDebugTS is False:
+                self._oDbgFile.write(sMessage);
+                if not sMessage.endswith('\n'):
+                    self._oDbgFile.write('\n');
+            else:
+                tsNow = utils.timestampMilli();
+                tsReq = tsNow - (self.tsStart / 1000000)
+                for sLine in sMessage.split('\n'):
+                    self._oDbgFile.write('%s/%03u: %s\n' % (tsNow, tsReq, sLine,));
+
+        return True;
+
+    def registerDebugInfoCallback(self, fnDebugInfo):
+        """
+        Registers a debug info method for calling when the error page is shown.
+
+        The fnDebugInfo function takes two parameters.  The first is this
+        object, the second is a boolean indicating html (True) or text (False)
+        output.  The return value is ignored.
+        """
+        if self.kfDebugInfoEnabled:
+            self._afnDebugInfo.append(fnDebugInfo);
+        return True;
+
+    def unregisterDebugInfoCallback(self, fnDebugInfo):
+        """
+        Unregisters a debug info method previously registered by
+        registerDebugInfoCallback.
+        """
+        if self.kfDebugInfoEnabled:
+            try:    self._afnDebugInfo.remove(fnDebugInfo);
+            except: pass;
+        return True;
+
diff --git a/src/VBox/ValidationKit/testmanager/core/webservergluecgi.py b/src/VBox/ValidationKit/testmanager/core/webservergluecgi.py
new file mode 100644
index 0000000..5ede79b
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/core/webservergluecgi.py
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+# $Id: webservergluecgi.py $
+
+"""
+Test Manager Core - Web Server Abstraction Base Class.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import cgi;
+import cgitb;
+import os;
+import sys;
+
+# Validation Kit imports.
+from testmanager.core.webservergluebase import WebServerGlueBase;
+from testmanager                        import config;
+
+
+class WebServerGlueCgi(WebServerGlueBase):
+    """
+    CGI glue.
+    """
+    def __init__(self, sValidationKitDir, fHtmlOutput=True):
+        WebServerGlueBase.__init__(self, sValidationKitDir, fHtmlOutput);
+
+        if config.g_kfSrvGlueCgiTb is True:
+            cgitb.enable(format=('html' if fHtmlOutput else 'text'));
+
+    def getParameters(self):
+        return cgi.parse(keep_blank_values=True);
+
+    def getClientAddr(self):
+        return os.environ.get('REMOTE_ADDR');
+
+    def getMethod(self):
+        return os.environ.get('REQUEST_METHOD', 'POST');
+
+    def getLoginName(self):
+        return os.environ.get('REMOTE_USER', WebServerGlueBase.ksUnknownUser);
+
+    def getUrlScheme(self):
+        return 'https' if 'HTTPS' in os.environ else 'http';
+
+    def getUrlNetLoc(self):
+        return os.environ['HTTP_HOST'];
+
+    def getUrlPath(self):
+        return os.environ['REQUEST_URI'];
+
+    def getUserAgent(self):
+        return os.getenv('HTTP_USER_AGENT', '');
+
+    def getContentType(self):
+        return cgi.parse_header(os.environ.get('CONTENT_TYPE', 'text/html'));
+
+    def getContentLength(self):
+        return int(os.environ.get('CONTENT_LENGTH', 0));
+
+    def getBodyIoStream(self):
+        return sys.stdin;
+
diff --git a/src/VBox/ValidationKit/testmanager/db/Makefile.kmk b/src/VBox/ValidationKit/testmanager/db/Makefile.kmk
new file mode 100644
index 0000000..c74fe9e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/Makefile.kmk
@@ -0,0 +1,66 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Makefile for generating .html from .txt.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+GENERATED_FILES = TestManagerDatabaseComments.pgsql
+PSQL := $(firstword $(which $(foreach pgver, 92 91 90,psql$(pgver)) ) psql)
+PSQL_OPTS = -U postgres
+
+all: $(GENERATED_FILES)
+
+clean:
+	kmk_builtin_rm -f -- $(GENERATED_FILES)
+
+
+TestManagerDatabaseComments.pgsql: TestManagerDatabaseInit.pgsql gen-sql-comments.py
+	LC_ALL=C python gen-sql-comments.py $< > $@
+
+
+load-testmanager-db: \
+		TestManagerDatabaseInit.pgsql \
+		TestManagerDatabaseComments.pgsql \
+		../core/useraccount.pgsql \
+		../core/testcase.pgsql \
+		../core/globalresource.pgsql
+	@kmk_builtin_echo "Creating testmanager database: For script verification only!"
+	$(PSQL) $(PSQL_OPTS) -f TestManagerDatabaseInit.pgsql
+	$(PSQL) $(PSQL_OPTS) -d testmanager -f TestManagerDatabaseComments.pgsql
+	$(PSQL) $(PSQL_OPTS) -d testmanager -f ../core/useraccount.pgsql
+	$(PSQL) $(PSQL_OPTS) -d testmanager -f ../core/testcase.pgsql
+	$(PSQL) $(PSQL_OPTS) -d testmanager -f ../core/globalresource.pgsql
+	$(PSQL) $(PSQL_OPTS) -d testmanager -f TestManagerDatabaseDefaultUserAccounts.pgsql
+
+reload-testmanager-db-dunctions: \
+		../core/useraccount.pgsql \
+		../core/testcase.pgsql \
+		../core/globalresource.pgsql
+	@kmk_builtin_echo "Reloading testmanager database functions"
+	$(PSQL) $(PSQL_OPTS) -d testmanager -f ../core/useraccount.pgsql
+	$(PSQL) $(PSQL_OPTS) -d testmanager -f ../core/testcase.pgsql
+	$(PSQL) $(PSQL_OPTS) -d testmanager -f ../core/globalresource.pgsql
+
+# Only for prettier graphs:
+#	$(PSQL) $(PSQL_OPTS) -d testmanager -f TestManagerDatabaseForeignKeyErHacks.pgsql
+
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase.dmd b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase.dmd
new file mode 100644
index 0000000..cf35f3f
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase.dmd
@@ -0,0 +1,8 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<OSDM_Design class="oracle.dbtools.crest.model.design.Design" name="TestManagerDatabase" id="99299876-6D97-026B-55F9-DF582D334681" version="3.5">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 21:58:45 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<capitalNames>false</capitalNames>
+<designId>99299876-6D97-026B-55F9-DF582D334681</designId>
+</OSDM_Design>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/DataTypes.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/DataTypes.xml
new file mode 100644
index 0000000..9b86b6d
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/DataTypes.xml
@@ -0,0 +1,15 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<DataTypesDesign class="oracle.dbtools.crest.model.design.datatypes.DataTypesDesign" name="DataTypes" id="E0EE53BE-07B1-7CE9-B0DA-5D939EA4A3C9" mainViewID="E9476B45-3C62-EE27-4705-6F1EFAD11B74">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 21:58:45 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<shouldBeOpen>false</shouldBeOpen>
+<collectionOfRefsPrefix>array_ref_</collectionOfRefsPrefix>
+<collectionPrefix>array_</collectionPrefix>
+<defaultArrayLimit>10</defaultArrayLimit>
+<defaultCollectionType_Kind>ARRAY</defaultCollectionType_Kind>
+<defaultCollectionType_Suffix>_Array</defaultCollectionType_Suffix>
+<embeddedStructuredTypePrefix>inst_</embeddedStructuredTypePrefix>
+<referencePrefix>ref_</referencePrefix>
+<useRoleInAssociationEndAsName>true</useRoleInAssociationEndAsName>
+</DataTypesDesign>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/structuredtype/seg_0/47E390DE-0671-C4B1-8428-0F45CBEE18F8.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/structuredtype/seg_0/47E390DE-0671-C4B1-8428-0F45CBEE18F8.xml
new file mode 100644
index 0000000..e274e15
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/structuredtype/seg_0/47E390DE-0671-C4B1-8428-0F45CBEE18F8.xml
@@ -0,0 +1,37 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<StructuredType class="oracle.dbtools.crest.model.design.datatypes.StructuredType" name="SDO_GEOMETRY" id="47E390DE-0671-C4B1-8428-0F45CBEE18F8" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 21:58:45 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<visible>false</visible>
+<predefined>true</predefined>
+<final>false</final>
+<instantiable>true</instantiable>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16777056</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Method</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Instantiable</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Mandatory</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+</fonts>
+</StructuredType>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/structuredtype/seg_0/F72C39E0-D1CA-8821-2AD7-A1E95A37D3D1.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/structuredtype/seg_0/F72C39E0-D1CA-8821-2AD7-A1E95A37D3D1.xml
new file mode 100644
index 0000000..5ff7c30
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/structuredtype/seg_0/F72C39E0-D1CA-8821-2AD7-A1E95A37D3D1.xml
@@ -0,0 +1,37 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<StructuredType class="oracle.dbtools.crest.model.design.datatypes.StructuredType" name="XMLTYPE" id="F72C39E0-D1CA-8821-2AD7-A1E95A37D3D1" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 21:58:45 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<visible>false</visible>
+<predefined>true</predefined>
+<final>false</final>
+<instantiable>true</instantiable>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16777056</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Method</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Instantiable</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Mandatory</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+</fonts>
+</StructuredType>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/subviews/E9476B45-3C62-EE27-4705-6F1EFAD11B74.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/subviews/E9476B45-3C62-EE27-4705-6F1EFAD11B74.xml
new file mode 100644
index 0000000..d09e8a6
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/datatypes/subviews/E9476B45-3C62-EE27-4705-6F1EFAD11B74.xml
@@ -0,0 +1,21 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Diagram class="oracle.dbtools.crest.swingui.datatypes.DPVDataTypes" id="E9476B45-3C62-EE27-4705-6F1EFAD11B74">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 21:58:45 UTC</createdTime>
+<autoRoute>false</autoRoute>
+<boxInbox>true</boxInbox>
+<showLegend>false</showLegend>
+<showLabels>false</showLabels>
+<showGrid>false</showGrid>
+<diagramColor>-1</diagramColor>
+<display>false</display>
+<notation>0</notation>
+<objectViews>
+<OView class="oracle.dbtools.crest.swingui.datatypes.TVStructuredType" oid="47E390DE-0671-C4B1-8428-0F45CBEE18F8" otype="StructuredType" vid="48CB0B19-5276-2CC9-FC10-6C17D5E5FAC6">
+<bounds x="20" y="20" width="100" height="100"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.datatypes.TVStructuredType" oid="F72C39E0-D1CA-8821-2AD7-A1E95A37D3D1" otype="StructuredType" vid="5CEA75E2-B53E-AD72-1C75-F8820307529C">
+<bounds x="20" y="20" width="100" height="100"/>
+</OView>
+</objectViews>
+</Diagram>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/defaultRDBMSSites.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/defaultRDBMSSites.xml
new file mode 100644
index 0000000..07122f8
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/defaultRDBMSSites.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<sites version="1.0">
+        <site name="Oracle Database 11g" type="9" oid="32076570-2523-435C-2E92-BF29817DFF70" pathid="1" />
+        <site name="Oracle Database 10g" type="8" oid="D9582E4E-79E2-319F-387A-2ED963CB9D32" pathid="2" />
+        <site name="Oracle9i"            type="7" oid="9807C1FA-0550-772D-1F14-16B19CA63681" pathid="3" />
+        <site name="SQL Server 2005"     type="5" oid="B0943E51-0387-1F2A-CED9-5FB738BA5A0C" pathid="4" />
+        <site name="SQL Server 2000"     type="4" oid="3424E3DB-6FE1-14EB-9311-F76EF3096E76" pathid="5" />
+        <site name="DB2/390 8"           type="1" oid="CC7FDCE5-F5A5-F2C0-C9A7-0C07C92C898D" pathid="6" />
+        <site name="DB2/390 7"           type="0" oid="26535E02-9B31-3EDE-24D5-4E3188C99288" pathid="7" />
+        <site name="DB2/UDB 8.1"         type="3" oid="2BAE410E-5CEB-5134-8F33-CCB20E003569" pathid="8" />
+        <site name="DB2/UDB 7.1"         type="2" oid="BA6252DC-29CE-184D-7701-48F55E3954D4" pathid="9" />
+</sites>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/defaultdomains.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/defaultdomains.xml
new file mode 100644
index 0000000..d858b5c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/defaultdomains.xml
@@ -0,0 +1,13 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<DomainFile class="oracle.dbtools.crest.model.design.DomainFileWrapper" fileName="defaultdomains">
+   <domains>
+      <Domain class="oracle.dbtools.crest.model.design.Domain" name="Unknown" id="DOM3000004">
+         <createdBy>bird</createdBy>
+         <createdTime>2012-08-20 21:58:45 UTC</createdTime>
+         <ownerDesignName>System</ownerDesignName>
+         <avTSortOrder>0</avTSortOrder>
+         <fileName>defaultdomains</fileName>
+         <logicalDatatype>LOGDT017</logicalDatatype>
+      </Domain>
+   </domains>
+</DomainFile>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/dl_settings.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/dl_settings.xml
new file mode 100644
index 0000000..6c42600
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/dl_settings.xml
@@ -0,0 +1,288 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<settings>
+	<logical_type_for_domain_presentation value="false" />
+	<automatic_pk_generation value="false" />
+	<automatic_uk_generation value="false" />
+	<automatic_fk_generation value="false" />
+	<substitution_patterns>
+	</substitution_patterns>
+	<classification_types>
+		<type name="Fact" color="-7482" prefix="" id="1" />
+		<type name="Dimension" color="-1781507" prefix="" id="2" />
+		<type name="Logging" color="-1776412" prefix="" id="3" />
+		<type name="Summary" color="-3148598" prefix="" id="4" />
+		<type name="Temporary" color="-1" prefix="" id="5" />
+	</classification_types>
+	<default_fonts_and_colors>
+		<fc_object classname="Entity" background="-5971457" foreground="-16776961">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Attribute" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Datatype" font_color="-16744448" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="PK Element" font_color="-16776961" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="FK Element" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="UK Element" font_color="-16776961" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Not Null" font_color="-65536" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Key" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Logical View" background="-25750" foreground="-16776961">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Attribute" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Datatype" font_color="-16744448" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Table" background="-76" foreground="-16776961">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Column" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Datatype" font_color="-16744448" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="PK Element" font_color="-16776961" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="FK Element" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="UK Element" font_color="-16776961" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Not Null" font_color="-65536" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Key" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Relational View" background="-6881386" foreground="-16776961">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Column" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Datatype" font_color="-16744448" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Structured Type" background="-7537956" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Attribute" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Datatype" font_color="-16777056" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Method" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Not Instantiable" font_color="-65536" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Mandatory" font_color="-65536" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Cube" background="-7482" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Fact Entities" font_color="-16776961" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Measure Type" font_color="-16776961" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Measure" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Function" font_color="-16777056" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Formula" font_color="-65536" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Child to Parent Attributes" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Dimension" background="-16713196" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Level" background="-1781507" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Level Entity" font_color="-16776961" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Type" font_color="-16776961" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Attribute" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Function" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Process" background="-106" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Process Number" font_color="-65536" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Transformation Task" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="External Agent" background="-5570646" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Information Store" background="-10170881" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16776961" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Number" font_color="-1" font_name="Dialog" font_size="10" font_style="1"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="In-Out Parameters" background="-328966" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16777216" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Parameters" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+			<font_object fo_type="Datatype" font_color="-65536" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Transformation" background="-43" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16777216" font_name="Dialog" font_size="10" font_style="1"/>
+			<font_object fo_type="Process Number" font_color="-65536" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Note" background="-4144960" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Title" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Label" background="-1" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Text" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+		<fc_object classname="Legend" background="-1" foreground="-16777216">
+		<fonts>
+			<font_object fo_type="Text" font_color="-16777216" font_name="Dialog" font_size="10" font_style="0"/>
+		</fonts>
+		</fc_object>
+	</default_fonts_and_colors>
+	<default_line_widths_and_colors>
+		<lwc_object classname="Logical Relation" color="-16777216" width="1">
+		</lwc_object>
+		<lwc_object classname="Logical Inheritance" color="-65536" width="1">
+		</lwc_object>
+		<lwc_object classname="Relational Foreign Key" color="-16777216" width="1">
+		</lwc_object>
+		<lwc_object classname="Type Substitution" color="-16725996" width="1">
+		</lwc_object>
+		<lwc_object classname="Datatype Reference" color="-16776961" width="1">
+		</lwc_object>
+		<lwc_object classname="Datatype Inheritance" color="-65536" width="1">
+		</lwc_object>
+		<lwc_object classname="Multidimentional Link" color="-16776961" width="1">
+		</lwc_object>
+		<lwc_object classname="Multidimensional Hierarchy" color="-16725996" width="1">
+		</lwc_object>
+		<lwc_object classname="Process Flow" color="-65536" width="1">
+		</lwc_object>
+	</default_line_widths_and_colors>
+	<naming_standard_rules>
+		<logical>
+			<separator value= "Title Case" char=" "/>
+			<entity>
+			</entity>
+			<attribute>
+			</attribute>
+		</logical>
+		<relational>
+			<separator value= "_" abbreviated_only="false"/>
+			<table>
+			</table>
+			<column>
+			</column>
+		</relational>
+		<domains>
+			<separator value= " "/>
+			<domain>
+			</domain>
+		</domains>
+		<constraints>
+			<pk value="{table}_PK"/>
+			<fk value="{child}_{parent}_FK"/>
+			<ck value="{table}_CK"/>
+			<un value="{table}_{column}_UN"/>
+			<idx value="{table}_{column}_IDX"/>
+			<colck value="CK_{table}_{column}"/>
+			<column_foreign_key value="{ref table}_{ref column}"/>
+			<ui value="{entity} PK"/>
+			<relation_attribute value="{ref entity}_{ref attribute}"/>
+		</constraints>
+		<glossaries>
+		</glossaries>
+	</naming_standard_rules>
+<comparemapping>
+</comparemapping>
+	<engineering_params>
+		<delete_without_origin value="false"/>
+		<engineer_coordinates value="true"/>
+		<engineer_generated value="false"/>
+		<show_engineering_intree value="false"/>
+		<apply_naming_std value="false"/>
+		<use_pref_abbreviation value="true"/>
+		<upload_directory value=""/>
+		<date_format value="YYYY/MM/DD HH24:MI:SS"/>
+		<timestamp_format value="YYYY/MM/DD HH24:MI:SS.FF"/>
+		<timestamp_tz_format value="YYYY/MM/DD HH24:MI:SS.FFTZH:TZM"/>
+	</engineering_params>
+	<eng_compare show_sel_prop_only="true" not_apply_for_new_objects="true" exclude_from_tree="false">
+		<entity_table>
+			<property name="Name" selected="true"/>
+			<property name="Short Name / Abbreviation" selected="true"/>
+			<property name="Comment" selected="true"/>
+			<property name="Comment in RDBMS" selected="true"/>
+			<property name="Notes" selected="true"/>
+			<property name="Temporary Table Scope" selected="true"/>
+			<property name="Table Type" selected="true"/>
+			<property name="Structured Type" selected="true"/>
+			<property name="Type Substitution (Super-Type Object)" selected="true"/>
+			<property name="Min Volumes" selected="true"/>
+			<property name="Expected Volumes" selected="true"/>
+			<property name="Max Volumes" selected="true"/>
+			<property name="Growth Percent" selected="true"/>
+			<property name="Growth Type" selected="true"/>
+			<property name="Normal Form" selected="true"/>
+			<property name="Adequately Normalized" selected="true"/>
+		</entity_table>
+		<attribute_column>
+			<property name="Name" selected="true"/>
+			<property name="Data Type" selected="true"/>
+			<property name="Data Type Kind" selected="true"/>
+			<property name="Mandatory" selected="true"/>
+			<property name="Default Value" selected="true"/>
+			<property name="Check Constraint Name" selected="true"/>
+			<property name="Use Domain Constraint" selected="true"/>
+			<property name="Check Constraint" selected="true"/>
+			<property name="Range Constraint" selected="true"/>
+			<property name="LOV Constraint" selected="true"/>
+			<property name="Comment" selected="true"/>
+			<property name="Comment in RDBMS" selected="true"/>
+			<property name="Notes" selected="true"/>
+			<property name="Source Type" selected="true"/>
+			<property name="Formula Description" selected="true"/>
+			<property name="Type Substitution" selected="true"/>
+			<property name="Scope" selected="true"/>
+		</attribute_column>
+		<key_index>
+			<property name="Name" selected="true"/>
+			<property name="Comment" selected="true"/>
+			<property name="Comment in RDBMS" selected="true"/>
+			<property name="Notes" selected="true"/>
+			<property name="Primary Key" selected="true"/>
+			<property name="Attributes/Columns" selected="true"/>
+		</key_index>
+		<relation_fk>
+			<property name="Name" selected="true"/>
+			<property name="Delete Rule" selected="true"/>
+			<property name="Comment" selected="true"/>
+			<property name="Comment in RDBMS" selected="true"/>
+			<property name="Notes" selected="true"/>
+		</relation_fk>
+		<entityview_view>
+			<property name="Name" selected="true"/>
+			<property name="Comment" selected="true"/>
+			<property name="Comment in RDBMS" selected="true"/>
+			<property name="Notes" selected="true"/>
+			<property name="Structured Type" selected="true"/>
+			<property name="Where" selected="true"/>
+			<property name="Having" selected="true"/>
+			<property name="User Defined SQL" selected="true"/>
+		</entityview_view>
+	</eng_compare>
+	<naming_options>
+		<model_options objectid="B082B14A-BEA8-D8A7-D661-197F34766ED3">
+			<naming_option class_name="oracle.dbtools.crest.model.design.relational.Table" max_name_length="30" case_type="2" valid_characters="" all_valid="true" />
+			<naming_option class_name="oracle.dbtools.crest.model.design.relational.Column" max_name_length="30" case_type="2" valid_characters="" all_valid="true" />
+			<naming_option class_name="oracle.dbtools.crest.model.design.relational.TableView" max_name_length="30" case_type="2" valid_characters="" all_valid="true" />
+			<naming_option class_name="oracle.dbtools.crest.model.design.constraint.TableLevelConstraint" max_name_length="30" case_type="2" valid_characters="" all_valid="true" />
+			<naming_option class_name="oracle.dbtools.crest.model.design.relational.FKIndexAssociation" max_name_length="30" case_type="2" valid_characters="" all_valid="true" />
+			<naming_option class_name="oracle.dbtools.crest.model.design.relational.Index" max_name_length="30" case_type="2" valid_characters="" all_valid="true" />
+		</model_options>
+		<model_options objectid="E3665D68-35D3-8757-63ED-30AEFB972A2C">
+			<naming_option class_name="oracle.dbtools.crest.model.design.logical.Entity" max_name_length="254" case_type="2" valid_characters="[a-z][A-Z][0-9]" all_valid="false" />
+			<naming_option class_name="oracle.dbtools.crest.model.design.logical.Attribute" max_name_length="254" case_type="2" valid_characters="[a-z][A-Z][0-9] " all_valid="false" />
+			<naming_option class_name="oracle.dbtools.crest.model.design.logical.EntityView" max_name_length="254" case_type="2" valid_characters="[a-z][A-Z][0-9] " all_valid="false" />
+		</model_options>
+	</naming_options>
+	<merge_conflicts>
+	</merge_conflicts>
+	<deleted_files>
+	</deleted_files>
+</settings>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/dr_custom_scripts.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/dr_custom_scripts.xml
new file mode 100644
index 0000000..3580f0f
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/dr_custom_scripts.xml
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dr_custom_scripts>
+	<scr id="D36CE536-D575-BE5C-625F-23DE23913C6B" name="Complex rule - check comments demo" object="Table" engine="Mozilla Rhino" type="Warning" var="table" library="my first library" method="checkcomments" purpose="validation" >
+		<script>
+			<![CDATA[var ruleMessage;
+var errType;
+var table;
+function checkcomments(object){
+ result = true;
+ ruleMessage="";
+ if(table.getCommentInRDBMS().equals("")){
+  ruleMessage="no comments in RDBMS defined";
+  errType="Problem:";
+  result = false;
+ }
+ if(table.getComment().equals("")){
+  if(ruleMessage.equals("")){
+   ruleMessage="no comments defined";
+  }else{
+   ruleMessage= ruleMessage +" , no comments defined";
+   }
+   errType="Error";
+  return false;
+ }
+ return result;
+}]]>
+		</script>
+	</scr>
+	<scr id="0BAA564F-AB5F-D776-2E4F-31FDB3047F69" name="Tables to lower case - Rhino" object="relational" engine="Mozilla Rhino" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[tables = model.getTableSet().toArray();
+for (var t = 0; t<tables.length;t++){
+ table = tables[t];
+ name = table.getName().toLowerCase();
+ table.setName(name);
+ columns = table.getElements();
+ size = table.getElementsCollection().size();
+ for (var i = 0; i < size; i++) {
+	column = columns[i];
+	cname = column.getName().toLowerCase();
+	column.setName(cname);
+ }
+ table.setDirty(true);
+ keys = table.getKeys();
+ for (var i = 0; i < keys.length; i++) {
+  key = keys[i];
+    if(!key.isFK()){
+     kname = key.getName().toLowerCase();
+     key.setName(kname);
+   }else{
+     kname = key.getFKAssociation().getName().toLowerCase();
+     key.getFKAssociation().setName(kname);
+     key.getFKAssociation().setDirty(true);
+   }
+ }
+}]]>
+		</script>
+	</scr>
+	<scr id="B673F271-4836-DD48-15AC-487DDECCAF49" name="Tables to upper case - JRuby" object="relational" engine="JSR 223 JRuby Engine" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[tables =$model.getTableSet().toArray()
+for t in 0..tables.length-1
+ table = tables[t]
+ name = table.getName().upcase
+ table.setName(name)
+ columns = table.getElements()
+ size = table.getElementsCollection().size()-1
+ for i in 0..size
+	column = columns[i]
+	cname = column.getName().upcase
+	column.setName(cname)
+ end
+ keys = table.getKeys()
+ for i in 0..keys.length-1
+  key = keys[i]
+  kname = key.getName().upcase
+  key.setName(kname)
+ end
+end]]>
+		</script>
+	</scr>
+	<scr id="3E7C4F9E-9FCB-56C7-086F-F976F9A66384" name="Tables to upper case - JRuby - library usage" object="relational" engine="JSR 223 JRuby Engine" type="" var="model" library="Jruby lib" method="tables_up" purpose="transformation" >
+		<script>
+			<![CDATA[def tables_up(model)
+tables = model.getTableSet().toArray()
+for t in 0..tables.length-1
+ table = tables[t]
+ name = table.getName().upcase
+ table.setName(name)
+ columns = table.getElements()
+ size = table.getElementsCollection().size()-1
+ for i in 0..size
+	column = columns[i]
+	cname = column.getName().upcase
+	column.setName(cname)
+ end
+ keys = table.getKeys()
+ for i in 0..keys.length-1
+  key = keys[i]
+  kname = key.getName().upcase
+  key.setName(kname)
+ end
+end
+return true
+end]]>
+		</script>
+	</scr>
+	<scr id="E60A5A28-BB9B-3787-10E7-259DF900B9E6" name="Table abbreviation to column" object="relational" engine="Mozilla Rhino" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[tables = model.getTableSet().toArray();
+for (var t = 0; t<tables.length;t++){
+ table = tables[t];
+ abbr = table.getAbbreviation()+"_";
+ if(!"_".equals(abbr)){
+     columns = table.getElements();
+     for (var i = 0; i < columns.length; i++) {
+        column = columns[i];
+        cname = column.getName();
+        if(!cname.startsWith(abbr)){
+         column.setName(abbr+cname);
+        }
+     }
+ }
+}]]>
+		</script>
+	</scr>
+	<scr id="9BE4E26C-36D8-A92C-ADEA-F183327DC239" name="Remove Table abbr from column" object="relational" engine="Mozilla Rhino" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[tables = model.getTableSet().toArray();
+for (var t = 0; t<tables.length;t++){
+ table = tables[t];
+ abbr = table.getAbbreviation()+"_";
+ count = table.getAbbreviation().length()+1;
+ if(!"_".equals(abbr)){
+     columns = table.getElements();
+     for (var i = 0; i < columns.length; i++) {
+        column = columns[i];
+        cname = column.getName();
+        if(cname.startsWith(abbr)){
+         column.setName(cname.substring(count));
+         table.setDirty(true);
+        }
+     }
+ }
+}]]>
+		</script>
+	</scr>
+	<scr id="23BE8827-D732-72B0-C6E6-266EFE116EDD" name="Table template" object="relational" engine="Mozilla Rhino" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[var t_name = "table_template";
+var p_name = "ctemplateID";
+template = model.getTableSet().getByName(t_name);
+if(template!=null){
+    tcolumns = template.getElements();
+    tables = model.getTableSet().toArray();
+    for (var t = 0; t<tables.length;t++){
+     table = tables[t];
+    // compare name ignoring the case
+     if(!table.getName().equalsIgnoreCase(t_name)){
+         for (var i = 0; i < tcolumns.length; i++) {
+            column = tcolumns[i];
+            col = table.getColumnByProperty(p_name,column.getObjectID());
+            if(col==null){
+             col = table.createColumn();
+            }
+            column.copy(col);
+            //set property after copy otherwise it'll be cleared
+            col.setProperty(p_name,column.getObjectID());
+            table.setDirty(true);
+         }
+     }
+    }
+}]]>
+		</script>
+	</scr>
+	<scr id="5A8A151A-13FD-4B0A-E233-E3C5126BA02C" name="Tables to upper case - Rhino" object="relational" engine="Mozilla Rhino" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[tables = model.getTableSet().toArray();
+for (var t = 0; t<tables.length;t++){
+ table = tables[t];
+ name = table.getName().toUpperCase();
+ table.setName(name);
+ columns = table.getElements();
+ size = table.getElementsCollection().size();
+ for (var i = 0; i < size; i++) {
+	column = columns[i];
+	cname = column.getName().toUpperCase();
+	column.setName(cname);
+ }
+ table.setDirty(true);
+ keys = table.getKeys();
+ for (var i = 0; i < keys.length; i++) {
+  key = keys[i];
+    if(!key.isFK()){
+     kname = key.getName().toUpperCase();
+     key.setName(kname);
+   }else{
+     kname = key.getFKAssociation().getName().toUpperCase();
+     key.getFKAssociation().setName(kname);
+     key.getFKAssociation().setDirty(true);
+   }
+ }
+}]]>
+		</script>
+	</scr>
+	<scr id="0528C35C-F29B-E7BB-57AC-37BA2780A98D" name="Table template - uses column name" object="relational" engine="Mozilla Rhino" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[// version without usage of dynamic properties, columns are found by column name
+// this allow reuse of already existing columns
+var t_name = "table_template";
+template = model.getTableSet().getByName(t_name);
+if(template!=null){
+    tcolumns = template.getElements();
+    tables = model.getTableSet().toArray();
+    for (var t = 0; t<tables.length;t++){
+     table = tables[t];
+    // compare name ignoring the case
+     if(!table.getName().equalsIgnoreCase(t_name)){
+         for (var i = 0; i < tcolumns.length; i++) {
+            column = tcolumns[i];
+            col = table.getElementByName(column.getName());
+            if(col==null){
+             col = table.createColumn();
+            }
+            column.copy(col);
+            table.setDirty(true);
+         }
+     }
+    }
+}]]>
+		</script>
+	</scr>
+	<scr id="6279C414-90DD-A52B-4CEB-8D49AB31DC10" name="Copy Comments to Comments in RDBMS" object="relational" engine="Mozilla Rhino" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[max_length = 4000;
+function copyComments(object){
+ if(object.getCommentInRDBMS().equals("")){
+   if(!object.getComment().equals("")){
+     if(object.getComment().length()>max_length){
+       object.setCommentInRDBMS(object.getComment().substring(0, max_length));
+     }else{
+       object.setCommentInRDBMS(object.getComment());
+     }
+     object.setDirty(true);
+   }
+ }
+}
+
+tables = model.getTableSet().toArray();
+for (var t = 0; t<tables.length;t++){
+ table = tables[t]
+ copyComments(table);
+ columns = table.getElements();
+ size = table.getElementsCollection().size();
+ for (var i = 0; i < columns.length; i++) {
+	column = columns[i];
+	copyComments(column);
+ }
+ keys = table.getKeys();
+ for (var i = 0; i < keys.length; i++) {
+   key = keys[i];
+   if(!key.isFK()){
+     copyComments(key);
+   }else{
+     copyComments(key.getFKAssociation());
+   }
+ }
+}]]>
+		</script>
+	</scr>
+	<scr id="7C4EDFC0-26EA-859C-DBD9-AC9345DEAF98" name="Create index on FK" object="relational" engine="Mozilla Rhino" type="" var="model" library="" method="" purpose="transformation" >
+		<script>
+			<![CDATA[function getIndex(tab,cols){
+ keys = tab.getKeys();
+ for (var i = 0; i < keys.length; i++) {
+  index = keys[i];
+  if(!(index.isPK() || index.isUnique()) && !index.isFK() && index.isIndexForColumns(cols)){
+     return index
+   }
+ }
+ return null;
+}
+
+tables = model.getTableSet().toArray();
+for (var t = 0; t<tables.length;t++){
+ table = tables[t];
+ indexes = table.getKeys();
+ for (var i = 0; i < indexes.length; i++) {
+    index = indexes[i];
+    if(index.isFK()){
+     columns = index.getColumns();
+     if(columns.length>0){
+       newIndex = getIndex(table,columns);
+       if(newIndex==null){
+         newIndex = table.createIndex()
+         table.setDirty(true);
+         for (var k = 0; k < columns.length; k++){
+           newIndex.add(columns[k]);
+         }
+       }
+     }
+   }
+ }
+}]]>
+		</script>
+	</scr>
+
+	<lib id="B310E434-78AE-6AED-EA94-6808B0262483" name="my first library" engine="Mozilla Rhino" methods="checkcomments" >
+		<script>
+			<![CDATA[var ruleMessage;
+var errType;
+var table;
+function checkcomments(object){
+ result = true;
+ ruleMessage="";
+ if(table.getCommentInRDBMS().equals("")){
+  ruleMessage="no comments in RDBMS defined";
+  errType="Problem:";
+  result = false;
+ }
+ if(table.getComment().equals("")){
+  if(ruleMessage.equals("")){
+   ruleMessage="no comments defined";
+  }else{
+   ruleMessage= ruleMessage +" , no comments defined";
+   }
+   errType="Error";
+  return false;
+ }
+ return result;
+}]]>
+		</script>
+	</lib>
+	<lib id="2518F33A-DE50-9E1D-7216-DD2A0FD6B84C" name="Jruby lib" engine="JRuby Engine" methods="tables_up" >
+		<script>
+			<![CDATA[def tables_up(model)
+tables = model.getTableSet().toArray()
+for t in 0..tables.length-1
+ table = tables[t]
+ name = table.getName().upcase
+ table.setName(name)
+ columns = table.getElements()
+ size = table.getElementsCollection().size()-1
+ for i in 0..size
+	column = columns[i]
+	cname = column.getName().upcase
+	column.setName(cname)
+ end
+ keys = table.getKeys()
+ for i in 0..keys.length-1
+  key = keys[i]
+  kname = key.getName().upcase
+  key.setName(kname)
+ end
+end
+return true
+end]]>
+		</script>
+	</lib>
+</dr_custom_scripts>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/Logical.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/Logical.xml
new file mode 100644
index 0000000..0403a60
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/Logical.xml
@@ -0,0 +1,7 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<LogicalDesign class="oracle.dbtools.crest.model.design.logical.LogicalDesign" name="Logical" id="E3665D68-35D3-8757-63ED-30AEFB972A2C" mainViewID="AFCEF013-4CF2-4A5A-79A3-31521C1CA20A">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 21:58:45 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<shouldBeOpen>false</shouldBeOpen>
+</LogicalDesign>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/16464F5A-64BE-D2ED-91E0-BCBD0AA34680.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/16464F5A-64BE-D2ED-91E0-BCBD0AA34680.xml
new file mode 100644
index 0000000..6904bb5
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/16464F5A-64BE-D2ED-91E0-BCBD0AA34680.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="16464F5A-64BE-D2ED-91E0-BCBD0AA34680" directorySegmentName="seg_0" name="TestResults">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:11:26 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/1BEAB532-23CA-8628-0C97-7CAD39119A4E.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/1BEAB532-23CA-8628-0C97-7CAD39119A4E.xml
new file mode 100644
index 0000000..9f54c6c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/1BEAB532-23CA-8628-0C97-7CAD39119A4E.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="1BEAB532-23CA-8628-0C97-7CAD39119A4E" directorySegmentName="seg_0" name="TestCaseArgs">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:38:18 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/24150FB1-B00F-4F69-6F77-49ECB58F0F66.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/24150FB1-B00F-4F69-6F77-49ECB58F0F66.xml
new file mode 100644
index 0000000..3a02553
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/24150FB1-B00F-4F69-6F77-49ECB58F0F66.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="24150FB1-B00F-4F69-6F77-49ECB58F0F66" directorySegmentName="seg_0" name="BuildSources">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:54:55 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/28DD93CF-D058-7343-CD47-E9B435E1AC16.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/28DD93CF-D058-7343-CD47-E9B435E1AC16.xml
new file mode 100644
index 0000000..3a9992c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/28DD93CF-D058-7343-CD47-E9B435E1AC16.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="28DD93CF-D058-7343-CD47-E9B435E1AC16" directorySegmentName="seg_0" name="TestResultFiles">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:12:51 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/2F6ACC6D-3D17-537D-8ADF-F8424395B345.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/2F6ACC6D-3D17-537D-8ADF-F8424395B345.xml
new file mode 100644
index 0000000..4ea40fc
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/2F6ACC6D-3D17-537D-8ADF-F8424395B345.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="2F6ACC6D-3D17-537D-8ADF-F8424395B345" directorySegmentName="seg_0" name="GlobalRsrcStatuses">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:17:42 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39.xml
new file mode 100644
index 0000000..e330035
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39" directorySegmentName="seg_0" name="FailureReasons">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-22 11:47:11 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/4579B792-2F35-D72A-1A3B-C7E53C41A766.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/4579B792-2F35-D72A-1A3B-C7E53C41A766.xml
new file mode 100644
index 0000000..e35d8bc
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/4579B792-2F35-D72A-1A3B-C7E53C41A766.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="4579B792-2F35-D72A-1A3B-C7E53C41A766" directorySegmentName="seg_0" name="TestResultMsgs">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:13:03 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/4D937E7C-3A28-E52D-89C0-EC8804C62367.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/4D937E7C-3A28-E52D-89C0-EC8804C62367.xml
new file mode 100644
index 0000000..7b2d1d0
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/4D937E7C-3A28-E52D-89C0-EC8804C62367.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="4D937E7C-3A28-E52D-89C0-EC8804C62367" directorySegmentName="seg_0" name="FailureCategories">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-22 11:47:19 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/504221DA-1B57-4EAD-39DB-40FD553E9FA2.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/504221DA-1B57-4EAD-39DB-40FD553E9FA2.xml
new file mode 100644
index 0000000..e536867
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/504221DA-1B57-4EAD-39DB-40FD553E9FA2.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="504221DA-1B57-4EAD-39DB-40FD553E9FA2" directorySegmentName="seg_0" name="Builds">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:52:15 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/6A886CEE-579B-48FF-63F6-0FB03393FBF6.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/6A886CEE-579B-48FF-63F6-0FB03393FBF6.xml
new file mode 100644
index 0000000..20424c7
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/6A886CEE-579B-48FF-63F6-0FB03393FBF6.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="6A886CEE-579B-48FF-63F6-0FB03393FBF6" directorySegmentName="seg_0" name="SchedGroups">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:16:15 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/7AE36CC1-A030-63E5-6EF3-72FCD04815EE.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/7AE36CC1-A030-63E5-6EF3-72FCD04815EE.xml
new file mode 100644
index 0000000..9475385
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/7AE36CC1-A030-63E5-6EF3-72FCD04815EE.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="7AE36CC1-A030-63E5-6EF3-72FCD04815EE" directorySegmentName="seg_0" name="TestBoxes">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:34:30 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/90367AFB-BA2D-A918-46B9-1E5DE53ACC48.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/90367AFB-BA2D-A918-46B9-1E5DE53ACC48.xml
new file mode 100644
index 0000000..96b815e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/90367AFB-BA2D-A918-46B9-1E5DE53ACC48.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="90367AFB-BA2D-A918-46B9-1E5DE53ACC48" directorySegmentName="seg_0" name="BuildBlacklist">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:59:31 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/90F477EE-35D6-21A7-B693-E5724FB07476.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/90F477EE-35D6-21A7-B693-E5724FB07476.xml
new file mode 100644
index 0000000..6bcf734
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/90F477EE-35D6-21A7-B693-E5724FB07476.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="90F477EE-35D6-21A7-B693-E5724FB07476" directorySegmentName="seg_0" name="TestSets">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:11:20 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/9F78B73C-056D-DDEF-8C50-A9DA76B9E724.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/9F78B73C-056D-DDEF-8C50-A9DA76B9E724.xml
new file mode 100644
index 0000000..d672b27
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/9F78B73C-056D-DDEF-8C50-A9DA76B9E724.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="9F78B73C-056D-DDEF-8C50-A9DA76B9E724" directorySegmentName="seg_0" name="BuildTypes">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:52:32 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/A352A20F-310D-E285-FBC9-90DD0DA7BB9B.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/A352A20F-310D-E285-FBC9-90DD0DA7BB9B.xml
new file mode 100644
index 0000000..301a3f2
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/A352A20F-310D-E285-FBC9-90DD0DA7BB9B.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="A352A20F-310D-E285-FBC9-90DD0DA7BB9B" directorySegmentName="seg_0" name="TestBoxStatuses">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:09:55 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/A6A5F317-479C-A0DD-CAAE-9DCB56B29D40.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/A6A5F317-479C-A0DD-CAAE-9DCB56B29D40.xml
new file mode 100644
index 0000000..a6f3138
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/A6A5F317-479C-A0DD-CAAE-9DCB56B29D40.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="A6A5F317-479C-A0DD-CAAE-9DCB56B29D40" directorySegmentName="seg_0" name="RequirementSets">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:14:04 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/B36A186B-CDB3-7851-8C38-12EA8D50EAEB.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/B36A186B-CDB3-7851-8C38-12EA8D50EAEB.xml
new file mode 100644
index 0000000..7e22bcc
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/B36A186B-CDB3-7851-8C38-12EA8D50EAEB.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="B36A186B-CDB3-7851-8C38-12EA8D50EAEB" directorySegmentName="seg_0" name="RequirementsNum">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:14:37 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/B82DAF9A-6F99-5CF6-4D99-A391BAD66192.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/B82DAF9A-6F99-5CF6-4D99-A391BAD66192.xml
new file mode 100644
index 0000000..aa84dcf
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/B82DAF9A-6F99-5CF6-4D99-A391BAD66192.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="B82DAF9A-6F99-5CF6-4D99-A391BAD66192" directorySegmentName="seg_0" name="TestCases">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:34:30 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/C332E3D7-638B-6CA8-24BF-383CA8659A3A.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/C332E3D7-638B-6CA8-24BF-383CA8659A3A.xml
new file mode 100644
index 0000000..f093d80
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/C332E3D7-638B-6CA8-24BF-383CA8659A3A.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="C332E3D7-638B-6CA8-24BF-383CA8659A3A" directorySegmentName="seg_0" name="SchedQueues">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:09:44 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/C79482B8-771B-FAD8-0337-163E3A45003A.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/C79482B8-771B-FAD8-0337-163E3A45003A.xml
new file mode 100644
index 0000000..3550b18
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/C79482B8-771B-FAD8-0337-163E3A45003A.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="C79482B8-771B-FAD8-0337-163E3A45003A" directorySegmentName="seg_0" name="GlobalResources">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:13:16 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/D09E0DE5-99D6-2991-032A-A8A124F6ACBA.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/D09E0DE5-99D6-2991-032A-A8A124F6ACBA.xml
new file mode 100644
index 0000000..1e10ffb
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/D09E0DE5-99D6-2991-032A-A8A124F6ACBA.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="D09E0DE5-99D6-2991-032A-A8A124F6ACBA" directorySegmentName="seg_0" name="TestResultValues">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:11:32 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/DCC79294-5434-1DED-298C-6473DEE59FBA.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/DCC79294-5434-1DED-298C-6473DEE59FBA.xml
new file mode 100644
index 0000000..7891dab
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/DCC79294-5434-1DED-298C-6473DEE59FBA.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="DCC79294-5434-1DED-298C-6473DEE59FBA" directorySegmentName="seg_0" name="TestResultFailures">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-22 11:46:51 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/DE366053-6F7A-7F42-ABA3-00E583098C37.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/DE366053-6F7A-7F42-ABA3-00E583098C37.xml
new file mode 100644
index 0000000..145b2c7
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/DE366053-6F7A-7F42-ABA3-00E583098C37.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="DE366053-6F7A-7F42-ABA3-00E583098C37" directorySegmentName="seg_0" name="TestGroups">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:34:30 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/E93BBF08-067B-A665-39F3-CF488A6547B2.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/E93BBF08-067B-A665-39F3-CF488A6547B2.xml
new file mode 100644
index 0000000..c8632bf
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/entity/seg_0/E93BBF08-067B-A665-39F3-CF488A6547B2.xml
@@ -0,0 +1,52 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Entity class="oracle.dbtools.crest.model.design.logical.Entity" id="E93BBF08-067B-A665-39F3-CF488A6547B2" directorySegmentName="seg_0" name="RequirementsText">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:14:21 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<adequatelyNormalized>NO</adequatelyNormalized>
+<expectedVolumes>0</expectedVolumes>
+<fwdEngineeringStrategyName>Single Table</fwdEngineeringStrategyName>
+<growthPercent>0</growthPercent>
+<growthType>Year</growthType>
+<maxVolumes>9999999</maxVolumes>
+<minVolumes>0</minVolumes>
+<normalForm>Third</normalForm>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<fontStyle>1</fontStyle>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Attribute</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Datatype</foType>
+<colorRGB>-16744448</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>PK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>FK Element</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>UK Element</foType>
+<colorRGB>-16776961</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Not Null</foType>
+<colorRGB>-65536</colorRGB>
+</FontObject>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Key</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Entity>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/note/seg_0/876CB767-80BA-6C8E-AACA-F1CCC95C445E.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/note/seg_0/876CB767-80BA-6C8E-AACA-F1CCC95C445E.xml
new file mode 100644
index 0000000..31ddc41
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/note/seg_0/876CB767-80BA-6C8E-AACA-F1CCC95C445E.xml
@@ -0,0 +1,16 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Note class="oracle.dbtools.crest.model.design.Note" name="Note_1" id="876CB767-80BA-6C8E-AACA-F1CCC95C445E" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:43:49 UTC</createdTime>
+<comment>Priority, scheduling time, and testgroup dependencies are associated with SchedGroup membership.</comment>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Note>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/note/seg_0/D487AFDC-4027-F824-EA29-5C6D0ABB9E1E.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/note/seg_0/D487AFDC-4027-F824-EA29-5C6D0ABB9E1E.xml
new file mode 100644
index 0000000..9152a7c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/note/seg_0/D487AFDC-4027-F824-EA29-5C6D0ABB9E1E.xml
@@ -0,0 +1,16 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Note class="oracle.dbtools.crest.model.design.Note" name="Note_3" id="D487AFDC-4027-F824-EA29-5C6D0ABB9E1E" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:57:21 UTC</createdTime>
+<comment>Testsuite and build sources.</comment>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<fonts>
+<FontObject class="oracle.dbtools.crest.model.design.FontObjectWr">
+<foType>Title</foType>
+<colorRGB>-16777216</colorRGB>
+</FontObject>
+</fonts>
+</Note>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/01537211-CCFB-0A1E-B43B-E8C641B69471.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/01537211-CCFB-0A1E-B43B-E8C641B69471.xml
new file mode 100644
index 0000000..e8b317c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/01537211-CCFB-0A1E-B43B-E8C641B69471.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="WhichTestcaseArgs" id="01537211-CCFB-0A1E-B43B-E8C641B69471" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:57:18 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>*</sourceCardinality>
+<sourceEntity>90F477EE-35D6-21A7-B693-E5724FB07476</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>1BEAB532-23CA-8628-0C97-7CAD39119A4E</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/02096BBB-0795-1759-1E26-2877BE36BB59.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/02096BBB-0795-1759-1E26-2877BE36BB59.xml
new file mode 100644
index 0000000..48df0a0
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/02096BBB-0795-1759-1E26-2877BE36BB59.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="NestedTestResults" id="02096BBB-0795-1759-1E26-2877BE36BB59" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:16:26 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>16464F5A-64BE-D2ED-91E0-BCBD0AA34680</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>16464F5A-64BE-D2ED-91E0-BCBD0AA34680</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/0CCF1DE3-7916-9054-BEA6-C601FF564DB2.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/0CCF1DE3-7916-9054-BEA6-C601FF564DB2.xml
new file mode 100644
index 0000000..e5304e1
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/0CCF1DE3-7916-9054-BEA6-C601FF564DB2.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestBoxGrouping" id="0CCF1DE3-7916-9054-BEA6-C601FF564DB2" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:35:28 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>true</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>false</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>7AE36CC1-A030-63E5-6EF3-72FCD04815EE</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>6A886CEE-579B-48FF-63F6-0FB03393FBF6</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/10867E70-94CE-FDAF-6B6E-2742D3A49E57.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/10867E70-94CE-FDAF-6B6E-2742D3A49E57.xml
new file mode 100644
index 0000000..ed64227
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/10867E70-94CE-FDAF-6B6E-2742D3A49E57.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="ReasonForBlacklisting" id="10867E70-94CE-FDAF-6B6E-2742D3A49E57" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-22 11:56:22 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>90367AFB-BA2D-A918-46B9-1E5DE53ACC48</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/11710A55-6423-1904-841A-C7D2AB8CEEBF.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/11710A55-6423-1904-841A-C7D2AB8CEEBF.xml
new file mode 100644
index 0000000..4c37ff7
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/11710A55-6423-1904-841A-C7D2AB8CEEBF.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestResultValues\" id="11710A55-6423-1904-841A-C7D2AB8CEEBF" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:17:15 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>16464F5A-64BE-D2ED-91E0-BCBD0AA34680</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>D09E0DE5-99D6-2991-032A-A8A124F6ACBA</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/1C189437-742B-B999-C955-7754C8ADB089.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/1C189437-742B-B999-C955-7754C8ADB089.xml
new file mode 100644
index 0000000..ee34083
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/1C189437-742B-B999-C955-7754C8ADB089.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="SchedTestGroupMembership" id="1C189437-742B-B999-C955-7754C8ADB089" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:46:08 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>*</sourceCardinality>
+<sourceEntity>6A886CEE-579B-48FF-63F6-0FB03393FBF6</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>DE366053-6F7A-7F42-ABA3-00E583098C37</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/34733942-1305-4CA1-47EB-ACE724B04E69.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/34733942-1305-4CA1-47EB-ACE724B04E69.xml
new file mode 100644
index 0000000..bde14e2
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/34733942-1305-4CA1-47EB-ACE724B04E69.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestResultFiles" id="34733942-1305-4CA1-47EB-ACE724B04E69" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:16:58 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>16464F5A-64BE-D2ED-91E0-BCBD0AA34680</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>28DD93CF-D058-7343-CD47-E9B435E1AC16</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3563C940-E524-7F96-7AE0-DAC3C1C17AFC.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3563C940-E524-7F96-7AE0-DAC3C1C17AFC.xml
new file mode 100644
index 0000000..0d924ea
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3563C940-E524-7F96-7AE0-DAC3C1C17AFC.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestedBuild" id="3563C940-E524-7F96-7AE0-DAC3C1C17AFC" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 10:14:03 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>true</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>false</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>504221DA-1B57-4EAD-39DB-40FD553E9FA2</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>90F477EE-35D6-21A7-B693-E5724FB07476</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3983F50A-EBB9-E4DE-1958-60EA4EDD6D6C.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3983F50A-EBB9-E4DE-1958-60EA4EDD6D6C.xml
new file mode 100644
index 0000000..f0a2250
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3983F50A-EBB9-E4DE-1958-60EA4EDD6D6C.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="BuildSource" id="3983F50A-EBB9-E4DE-1958-60EA4EDD6D6C" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:55:43 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>false</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>24150FB1-B00F-4F69-6F77-49ECB58F0F66</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>6A886CEE-579B-48FF-63F6-0FB03393FBF6</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3B7C8913-EB6A-47B1-27D0-E2C85EE9048B.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3B7C8913-EB6A-47B1-27D0-E2C85EE9048B.xml
new file mode 100644
index 0000000..9a95a66
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/3B7C8913-EB6A-47B1-27D0-E2C85EE9048B.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="NumericalRequirement" id="3B7C8913-EB6A-47B1-27D0-E2C85EE9048B" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:41:40 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>true</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>false</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>A6A5F317-479C-A0DD-CAAE-9DCB56B29D40</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>B36A186B-CDB3-7851-8C38-12EA8D50EAEB</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/518CE489-97B4-C05C-07A2-E3DBF14EE267.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/518CE489-97B4-C05C-07A2-E3DBF14EE267.xml
new file mode 100644
index 0000000..7987194
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/518CE489-97B4-C05C-07A2-E3DBF14EE267.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestResultFailureReason" id="518CE489-97B4-C05C-07A2-E3DBF14EE267" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-22 11:58:35 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>DCC79294-5434-1DED-298C-6473DEE59FBA</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/68A0C3E1-0FA1-8414-A361-33B08A8EDB39.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/68A0C3E1-0FA1-8414-A361-33B08A8EDB39.xml
new file mode 100644
index 0000000..bf2200d
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/68A0C3E1-0FA1-8414-A361-33B08A8EDB39.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="FailureRegardingTestResult" id="68A0C3E1-0FA1-8414-A361-33B08A8EDB39" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-22 11:48:45 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>DCC79294-5434-1DED-298C-6473DEE59FBA</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>16464F5A-64BE-D2ED-91E0-BCBD0AA34680</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/7497D76B-781B-3BDD-D797-FFBDB974F772.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/7497D76B-781B-3BDD-D797-FFBDB974F772.xml
new file mode 100644
index 0000000..4367322
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/7497D76B-781B-3BDD-D797-FFBDB974F772.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="GlobalResourceDependencies" id="7497D76B-781B-3BDD-D797-FFBDB974F772" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:42:25 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>*</sourceCardinality>
+<sourceEntity>B82DAF9A-6F99-5CF6-4D99-A391BAD66192</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>C79482B8-771B-FAD8-0337-163E3A45003A</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/7DA9DD83-A52E-CA1E-FCBF-FC9CE71AF635.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/7DA9DD83-A52E-CA1E-FCBF-FC9CE71AF635.xml
new file mode 100644
index 0000000..dd75d4c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/7DA9DD83-A52E-CA1E-FCBF-FC9CE71AF635.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestResultMessages" id="7DA9DD83-A52E-CA1E-FCBF-FC9CE71AF635" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:17:23 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>16464F5A-64BE-D2ED-91E0-BCBD0AA34680</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>4579B792-2F35-D72A-1A3B-C7E53C41A766</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/89A83E25-364B-6B73-0613-FEAD875EF9FB.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/89A83E25-364B-6B73-0613-FEAD875EF9FB.xml
new file mode 100644
index 0000000..e8a4730
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/89A83E25-364B-6B73-0613-FEAD875EF9FB.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestcaseArguments" id="89A83E25-364B-6B73-0613-FEAD875EF9FB" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:40:39 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>false</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>B82DAF9A-6F99-5CF6-4D99-A391BAD66192</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>1BEAB532-23CA-8628-0C97-7CAD39119A4E</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/8E5018CC-34E3-9AFC-D6D1-31E2BC4E9FE2.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/8E5018CC-34E3-9AFC-D6D1-31E2BC4E9FE2.xml
new file mode 100644
index 0000000..9d08655
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/8E5018CC-34E3-9AFC-D6D1-31E2BC4E9FE2.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="WhatToRun" id="8E5018CC-34E3-9AFC-D6D1-31E2BC4E9FE2" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:41:56 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>*</sourceCardinality>
+<sourceEntity>C332E3D7-638B-6CA8-24BF-383CA8659A3A</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>1BEAB532-23CA-8628-0C97-7CAD39119A4E</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/9B1FE0CF-B2AD-EED0-22FC-461A7D46DE51.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/9B1FE0CF-B2AD-EED0-22FC-461A7D46DE51.xml
new file mode 100644
index 0000000..b50ed32
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/9B1FE0CF-B2AD-EED0-22FC-461A7D46DE51.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="WhichResource" id="9B1FE0CF-B2AD-EED0-22FC-461A7D46DE51" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:52:20 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>2F6ACC6D-3D17-537D-8ADF-F8424395B345</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>C79482B8-771B-FAD8-0337-163E3A45003A</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/A182A65A-47AE-5D00-9A30-BC20AB050BF2.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/A182A65A-47AE-5D00-9A30-BC20AB050BF2.xml
new file mode 100644
index 0000000..b29652b
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/A182A65A-47AE-5D00-9A30-BC20AB050BF2.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestSetResult" id="A182A65A-47AE-5D00-9A30-BC20AB050BF2" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:15:48 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>90F477EE-35D6-21A7-B693-E5724FB07476</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>16464F5A-64BE-D2ED-91E0-BCBD0AA34680</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/B346381F-48FE-E495-01A7-E22EC26AEE8A.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/B346381F-48FE-E495-01A7-E22EC26AEE8A.xml
new file mode 100644
index 0000000..ba60f39
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/B346381F-48FE-E495-01A7-E22EC26AEE8A.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestGroupMember" id="B346381F-48FE-E495-01A7-E22EC26AEE8A" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:37:24 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>*</sourceCardinality>
+<sourceEntity>B82DAF9A-6F99-5CF6-4D99-A391BAD66192</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>DE366053-6F7A-7F42-ABA3-00E583098C37</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/B3596116-540F-6397-ECE4-58A386644E15.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/B3596116-540F-6397-ECE4-58A386644E15.xml
new file mode 100644
index 0000000..d4f9edd
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/B3596116-540F-6397-ECE4-58A386644E15.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestcaseDependencies" id="B3596116-540F-6397-ECE4-58A386644E15" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:39:51 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>*</sourceCardinality>
+<sourceEntity>B82DAF9A-6F99-5CF6-4D99-A391BAD66192</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>B82DAF9A-6F99-5CF6-4D99-A391BAD66192</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/BAD8EC05-6F14-4E38-366C-B4B660C6F38A.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/BAD8EC05-6F14-4E38-366C-B4B660C6F38A.xml
new file mode 100644
index 0000000..da1e2a8
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/BAD8EC05-6F14-4E38-366C-B4B660C6F38A.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="InFailureCategory" id="BAD8EC05-6F14-4E38-366C-B4B660C6F38A" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-22 11:57:18 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>true</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>false</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>4D937E7C-3A28-E52D-89C0-EC8804C62367</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/C5B67DD4-FA4F-EF9F-1FF5-0445D51B32EE.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/C5B67DD4-FA4F-EF9F-1FF5-0445D51B32EE.xml
new file mode 100644
index 0000000..d75c9a0
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/C5B67DD4-FA4F-EF9F-1FF5-0445D51B32EE.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="WhichTestBox" id="C5B67DD4-FA4F-EF9F-1FF5-0445D51B32EE" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:59:42 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>*</sourceCardinality>
+<sourceEntity>90F477EE-35D6-21A7-B693-E5724FB07476</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>7AE36CC1-A030-63E5-6EF3-72FCD04815EE</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/CCD38E11-8557-EB34-2651-07EB29E83FA6.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/CCD38E11-8557-EB34-2651-07EB29E83FA6.xml
new file mode 100644
index 0000000..bf216b5
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/CCD38E11-8557-EB34-2651-07EB29E83FA6.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestSuiteSource" id="CCD38E11-8557-EB34-2651-07EB29E83FA6" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:56:11 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>24150FB1-B00F-4F69-6F77-49ECB58F0F66</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>6A886CEE-579B-48FF-63F6-0FB03393FBF6</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E2A47942-ED55-E81D-4C71-9A134C49C147.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E2A47942-ED55-E81D-4C71-9A134C49C147.xml
new file mode 100644
index 0000000..5164076
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E2A47942-ED55-E81D-4C71-9A134C49C147.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestBox" id="E2A47942-ED55-E81D-4C71-9A134C49C147" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:43:14 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>false</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>7AE36CC1-A030-63E5-6EF3-72FCD04815EE</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>A352A20F-310D-E285-FBC9-90DD0DA7BB9B</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E4FE88E9-EE21-B43B-B0FE-A153E38246F9.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E4FE88E9-EE21-B43B-B0FE-A153E38246F9.xml
new file mode 100644
index 0000000..fc0ec02
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E4FE88E9-EE21-B43B-B0FE-A153E38246F9.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TestcaseRequirements" id="E4FE88E9-EE21-B43B-B0FE-A153E38246F9" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:38:38 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>*</sourceCardinality>
+<sourceEntity>B82DAF9A-6F99-5CF6-4D99-A391BAD66192</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>A6A5F317-479C-A0DD-CAAE-9DCB56B29D40</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E62AE7DF-49EE-9280-B328-A867CBD273AE.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E62AE7DF-49EE-9280-B328-A867CBD273AE.xml
new file mode 100644
index 0000000..3121966
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E62AE7DF-49EE-9280-B328-A867CBD273AE.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="CurrentTestSet" id="E62AE7DF-49EE-9280-B328-A867CBD273AE" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:48:53 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>A352A20F-310D-E285-FBC9-90DD0DA7BB9B</sourceEntity>
+<targetCardinalityString>1</targetCardinalityString>
+<targetEntity>90F477EE-35D6-21A7-B693-E5724FB07476</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E74406B5-20F1-4323-DC99-6E45982CB606.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E74406B5-20F1-4323-DC99-6E45982CB606.xml
new file mode 100644
index 0000000..498ce1f
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/E74406B5-20F1-4323-DC99-6E45982CB606.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="TextRequirements" id="E74406B5-20F1-4323-DC99-6E45982CB606" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:41:57 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>true</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>false</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>A6A5F317-479C-A0DD-CAAE-9DCB56B29D40</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>E93BBF08-067B-A665-39F3-CF488A6547B2</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/EC4EB506-3DBE-7F36-6451-F31920EDAB52.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/EC4EB506-3DBE-7F36-6451-F31920EDAB52.xml
new file mode 100644
index 0000000..18840e2
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/EC4EB506-3DBE-7F36-6451-F31920EDAB52.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="AllocatedBy" id="EC4EB506-3DBE-7F36-6451-F31920EDAB52" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:44:47 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>true</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>7AE36CC1-A030-63E5-6EF3-72FCD04815EE</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>2F6ACC6D-3D17-537D-8ADF-F8424395B345</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/EE1D98EF-6AEA-2790-D9B9-DBC2ED21D880.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/EE1D98EF-6AEA-2790-D9B9-DBC2ED21D880.xml
new file mode 100644
index 0000000..6fcc7e2
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/relation/seg_0/EE1D98EF-6AEA-2790-D9B9-DBC2ED21D880.xml
@@ -0,0 +1,17 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Relation class="oracle.dbtools.crest.model.design.logical.Relation" name="BuildToType" id="EE1D98EF-6AEA-2790-D9B9-DBC2ED21D880" directorySegmentName="seg_0">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:53:25 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<engineerTo>
+<item key="B082B14A-BEA8-D8A7-D661-197F34766ED3" value="true"/>
+</engineerTo>
+<identifying>false</identifying>
+<optionalSource>true</optionalSource>
+<optionalTarget>false</optionalTarget>
+<sourceCardinality>1</sourceCardinality>
+<sourceEntity>9F78B73C-056D-DDEF-8C50-A9DA76B9E724</sourceEntity>
+<targetCardinalityString>*</targetCardinalityString>
+<targetEntity>504221DA-1B57-4EAD-39DB-40FD553E9FA2</targetEntity>
+<transferable>true</transferable>
+</Relation>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/016BA1CF-6EA4-9CA4-CDF7-3AAA507EF6EF.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/016BA1CF-6EA4-9CA4-CDF7-3AAA507EF6EF.xml
new file mode 100644
index 0000000..e947c03
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/016BA1CF-6EA4-9CA4-CDF7-3AAA507EF6EF.xml
@@ -0,0 +1,40 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Diagram class="oracle.dbtools.crest.swingui.logical.DPVLogicalSubView" name="Failure Tracking" id="016BA1CF-6EA4-9CA4-CDF7-3AAA507EF6EF">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-22 12:01:22 UTC</createdTime>
+<autoRoute>false</autoRoute>
+<boxInbox>true</boxInbox>
+<showLegend>false</showLegend>
+<showLabels>false</showLabels>
+<showGrid>false</showGrid>
+<diagramColor>-1</diagramColor>
+<display>false</display>
+<notation>0</notation>
+<objectViews>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39" otype="Entity" vid="D1B4D1DF-E3AB-F84A-F479-87FB68F0A2D2">
+<bounds x="1270" y="448" width="151" height="41"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="4D937E7C-3A28-E52D-89C0-EC8804C62367" otype="Entity" vid="37DED3CC-443D-FC8B-A30D-07BF0D742C62">
+<bounds x="1270" y="522" width="152" height="43"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="DCC79294-5434-1DED-298C-6473DEE59FBA" otype="Entity" vid="95A5D57E-9986-0942-BCE8-4B9F5F46AE30">
+<bounds x="1087" y="460" width="157" height="51"/>
+</OView>
+</objectViews>
+<connectors>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="518CE489-97B4-C05C-07A2-E3DBF14EE267" otype="Relation" vid_source="95A5D57E-9986-0942-BCE8-4B9F5F46AE30" vid_target="D1B4D1DF-E3AB-F84A-F479-87FB68F0A2D2">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1244" y="474"/>
+<point x="1270" y="474"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="BAD8EC05-6F14-4E38-366C-B4B660C6F38A" otype="Relation" vid_source="D1B4D1DF-E3AB-F84A-F479-87FB68F0A2D2" vid_target="37DED3CC-443D-FC8B-A30D-07BF0D742C62">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1345" y="489"/>
+<point x="1345" y="522"/>
+</points>
+</Connector>
+</connectors>
+</Diagram>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/32D718B4-250F-95DC-37F0-C0A817F69020.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/32D718B4-250F-95DC-37F0-C0A817F69020.xml
new file mode 100644
index 0000000..6493425
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/32D718B4-250F-95DC-37F0-C0A817F69020.xml
@@ -0,0 +1,70 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Diagram class="oracle.dbtools.crest.swingui.logical.DPVLogicalSubView" name="Outputs" id="32D718B4-250F-95DC-37F0-C0A817F69020">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:19:53 UTC</createdTime>
+<autoRoute>false</autoRoute>
+<boxInbox>true</boxInbox>
+<showLegend>false</showLegend>
+<showLabels>false</showLabels>
+<showGrid>false</showGrid>
+<diagramColor>-1</diagramColor>
+<display>false</display>
+<notation>0</notation>
+<objectViews>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="16464F5A-64BE-D2ED-91E0-BCBD0AA34680" otype="Entity" vid="636E76B2-6F21-38E5-BF29-D4C078AC8F61">
+<bounds x="1014" y="625" width="121" height="102"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="28DD93CF-D058-7343-CD47-E9B435E1AC16" otype="Entity" vid="89BDF7A8-D79D-A869-BE57-BD2E1C2B290C">
+<bounds x="1190" y="610" width="131" height="41"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="4579B792-2F35-D72A-1A3B-C7E53C41A766" otype="Entity" vid="D72D72DA-F9C0-CE9C-E6A6-7A44DA7656DC">
+<bounds x="1190" y="710" width="131" height="41"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="90F477EE-35D6-21A7-B693-E5724FB07476" otype="Entity" vid="0A09F0EB-AF09-D080-F1B5-EC4E3693C1C5">
+<bounds x="824" y="652" width="141" height="51"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="D09E0DE5-99D6-2991-032A-A8A124F6ACBA" otype="Entity" vid="239CADB1-5F1D-1286-1C79-0DCD91157E84">
+<bounds x="1190" y="662" width="131" height="39"/>
+</OView>
+</objectViews>
+<connectors>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="02096BBB-0795-1759-1E26-2877BE36BB59" otype="Relation" vid_source="636E76B2-6F21-38E5-BF29-D4C078AC8F61" vid_target="636E76B2-6F21-38E5-BF29-D4C078AC8F61">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1135" y="676"/>
+<point x="1150" y="676"/>
+<point x="1150" y="742"/>
+<point x="1074" y="742"/>
+<point x="1074" y="727"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="11710A55-6423-1904-841A-C7D2AB8CEEBF" otype="Relation" vid_source="636E76B2-6F21-38E5-BF29-D4C078AC8F61" vid_target="239CADB1-5F1D-1286-1C79-0DCD91157E84">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1135" y="691"/>
+<point x="1190" y="691"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="34733942-1305-4CA1-47EB-ACE724B04E69" otype="Relation" vid_source="636E76B2-6F21-38E5-BF29-D4C078AC8F61" vid_target="89BDF7A8-D79D-A869-BE57-BD2E1C2B290C">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1135" y="638"/>
+<point x="1190" y="638"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="7DA9DD83-A52E-CA1E-FCBF-FC9CE71AF635" otype="Relation" vid_source="636E76B2-6F21-38E5-BF29-D4C078AC8F61" vid_target="D72D72DA-F9C0-CE9C-E6A6-7A44DA7656DC">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1135" y="718"/>
+<point x="1190" y="718"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="A182A65A-47AE-5D00-9A30-BC20AB050BF2" otype="Relation" vid_source="0A09F0EB-AF09-D080-F1B5-EC4E3693C1C5" vid_target="636E76B2-6F21-38E5-BF29-D4C078AC8F61">
+<lineWidth>1</lineWidth>
+<points>
+<point x="965" y="677"/>
+<point x="1014" y="677"/>
+</points>
+</Connector>
+</connectors>
+</Diagram>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/571DBBAF-CDDA-1C46-4220-D1319C0EEC00.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/571DBBAF-CDDA-1C46-4220-D1319C0EEC00.xml
new file mode 100644
index 0000000..25df5af
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/571DBBAF-CDDA-1C46-4220-D1319C0EEC00.xml
@@ -0,0 +1,24 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Diagram class="oracle.dbtools.crest.swingui.logical.DPVLogicalSubView" name="Persistent Test Manager Data" id="571DBBAF-CDDA-1C46-4220-D1319C0EEC00">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:19:18 UTC</createdTime>
+<autoRoute>false</autoRoute>
+<boxInbox>true</boxInbox>
+<showLegend>false</showLegend>
+<showLabels>false</showLabels>
+<showGrid>false</showGrid>
+<diagramColor>-1</diagramColor>
+<display>false</display>
+<notation>0</notation>
+<objectViews>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="2F6ACC6D-3D17-537D-8ADF-F8424395B345" otype="Entity" vid="B4E5F358-5BC8-9B06-4A13-EDF705ED9089">
+<bounds x="110" y="570" width="151" height="61"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="A352A20F-310D-E285-FBC9-90DD0DA7BB9B" otype="Entity" vid="8747577F-8999-3CBF-1376-1DD291702774">
+<bounds x="300" y="570" width="151" height="61"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="C332E3D7-638B-6CA8-24BF-383CA8659A3A" otype="Entity" vid="F053C992-CB30-88B3-66FF-F4E522C60155">
+<bounds x="499" y="570" width="136" height="61"/>
+</OView>
+</objectViews>
+</Diagram>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/65FA5BA0-CC9C-C108-BB1B-AC9E13F5BC83.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/65FA5BA0-CC9C-C108-BB1B-AC9E13F5BC83.xml
new file mode 100644
index 0000000..c248a58
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/65FA5BA0-CC9C-C108-BB1B-AC9E13F5BC83.xml
@@ -0,0 +1,127 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Diagram class="oracle.dbtools.crest.swingui.logical.DPVLogicalSubView" name="Configuration" id="65FA5BA0-CC9C-C108-BB1B-AC9E13F5BC83">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 08:58:45 UTC</createdTime>
+<autoRoute>false</autoRoute>
+<boxInbox>true</boxInbox>
+<showLegend>false</showLegend>
+<showLabels>false</showLabels>
+<showGrid>false</showGrid>
+<diagramColor>-1</diagramColor>
+<display>false</display>
+<notation>0</notation>
+<objectViews>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="1BEAB532-23CA-8628-0C97-7CAD39119A4E" otype="Entity" vid="459DD9CF-0825-0BAE-7BBA-FADAA3B895BB">
+<bounds x="680" y="419" width="161" height="52"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="24150FB1-B00F-4F69-6F77-49ECB58F0F66" otype="Entity" vid="398E8687-F10E-D31E-DD4E-EA0A6A7868A3">
+<bounds x="273" y="96" width="138" height="61"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="6A886CEE-579B-48FF-63F6-0FB03393FBF6" otype="Entity" vid="E301FF23-DE18-19FB-9A6A-9F170D26B939">
+<bounds x="180" y="250" width="131" height="71"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="7AE36CC1-A030-63E5-6EF3-72FCD04815EE" otype="Entity" vid="B06DA0BE-1DA3-3AB7-06CD-E7EA9FDC0B3E">
+<bounds x="101" y="95" width="131" height="61"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="A6A5F317-479C-A0DD-CAAE-9DCB56B29D40" otype="Entity" vid="49F6288A-70A0-788D-3FEE-BE0053D8D44C">
+<bounds x="680" y="130" width="161" height="41"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="B36A186B-CDB3-7851-8C38-12EA8D50EAEB" otype="Entity" vid="9E4B525D-2B00-0B76-39EE-0C0F74693333">
+<bounds x="600" y="30" width="141" height="31"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="B82DAF9A-6F99-5CF6-4D99-A391BAD66192" otype="Entity" vid="2C49F347-32B8-CA7C-2646-4F16FDDA087E">
+<bounds x="680" y="250" width="161" height="71"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="C79482B8-771B-FAD8-0337-163E3A45003A" otype="Entity" vid="8FAC087B-6133-162A-207B-3FAFB7B41E98">
+<bounds x="908" y="250" width="153" height="31"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="DE366053-6F7A-7F42-ABA3-00E583098C37" otype="Entity" vid="61150DED-91F4-1AE3-BD02-4EDC4CC0D98F">
+<bounds x="430" y="250" width="131" height="71"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="E93BBF08-067B-A665-39F3-CF488A6547B2" otype="Entity" vid="C41DA40C-A50A-BDCC-4DA0-2DCA7874C1A2">
+<bounds x="789" y="30" width="132" height="31"/>
+</OView>
+</objectViews>
+<connectors>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="0CCF1DE3-7916-9054-BEA6-C601FF564DB2" otype="Relation" vid_source="B06DA0BE-1DA3-3AB7-06CD-E7EA9FDC0B3E" vid_target="E301FF23-DE18-19FB-9A6A-9F170D26B939">
+<lineWidth>1</lineWidth>
+<points>
+<point x="206" y="156"/>
+<point x="206" y="250"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="1C189437-742B-B999-C955-7754C8ADB089" otype="Relation" vid_source="E301FF23-DE18-19FB-9A6A-9F170D26B939" vid_target="61150DED-91F4-1AE3-BD02-4EDC4CC0D98F">
+<lineWidth>1</lineWidth>
+<points>
+<point x="311" y="285"/>
+<point x="430" y="285"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="3983F50A-EBB9-E4DE-1958-60EA4EDD6D6C" otype="Relation" vid_source="398E8687-F10E-D31E-DD4E-EA0A6A7868A3" vid_target="E301FF23-DE18-19FB-9A6A-9F170D26B939">
+<lineWidth>1</lineWidth>
+<points>
+<point x="292" y="157"/>
+<point x="292" y="250"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="3B7C8913-EB6A-47B1-27D0-E2C85EE9048B" otype="Relation" vid_source="49F6288A-70A0-788D-3FEE-BE0053D8D44C" vid_target="9E4B525D-2B00-0B76-39EE-0C0F74693333">
+<lineWidth>1</lineWidth>
+<points>
+<point x="710" y="130"/>
+<point x="710" y="61"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="7497D76B-781B-3BDD-D797-FFBDB974F772" otype="Relation" vid_source="2C49F347-32B8-CA7C-2646-4F16FDDA087E" vid_target="8FAC087B-6133-162A-207B-3FAFB7B41E98">
+<lineWidth>1</lineWidth>
+<points>
+<point x="841" y="265"/>
+<point x="908" y="265"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="89A83E25-364B-6B73-0613-FEAD875EF9FB" otype="Relation" vid_source="2C49F347-32B8-CA7C-2646-4F16FDDA087E" vid_target="459DD9CF-0825-0BAE-7BBA-FADAA3B895BB">
+<lineWidth>1</lineWidth>
+<points>
+<point x="760" y="321"/>
+<point x="760" y="419"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="B346381F-48FE-E495-01A7-E22EC26AEE8A" otype="Relation" vid_source="2C49F347-32B8-CA7C-2646-4F16FDDA087E" vid_target="61150DED-91F4-1AE3-BD02-4EDC4CC0D98F">
+<lineWidth>1</lineWidth>
+<points>
+<point x="680" y="285"/>
+<point x="561" y="285"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="B3596116-540F-6397-ECE4-58A386644E15" otype="Relation" vid_source="2C49F347-32B8-CA7C-2646-4F16FDDA087E" vid_target="2C49F347-32B8-CA7C-2646-4F16FDDA087E">
+<lineWidth>1</lineWidth>
+<points>
+<point x="841" y="285"/>
+<point x="856" y="285"/>
+<point x="856" y="336"/>
+<point x="760" y="336"/>
+<point x="760" y="321"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="CCD38E11-8557-EB34-2651-07EB29E83FA6" otype="Relation" vid_source="398E8687-F10E-D31E-DD4E-EA0A6A7868A3" vid_target="E301FF23-DE18-19FB-9A6A-9F170D26B939">
+<lineWidth>1</lineWidth>
+<points>
+<point x="302" y="157"/>
+<point x="302" y="250"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="E4FE88E9-EE21-B43B-B0FE-A153E38246F9" otype="Relation" vid_source="2C49F347-32B8-CA7C-2646-4F16FDDA087E" vid_target="49F6288A-70A0-788D-3FEE-BE0053D8D44C">
+<lineWidth>1</lineWidth>
+<points>
+<point x="760" y="250"/>
+<point x="760" y="171"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="E74406B5-20F1-4323-DC99-6E45982CB606" otype="Relation" vid_source="49F6288A-70A0-788D-3FEE-BE0053D8D44C" vid_target="C41DA40C-A50A-BDCC-4DA0-2DCA7874C1A2">
+<lineWidth>1</lineWidth>
+<points>
+<point x="815" y="130"/>
+<point x="815" y="61"/>
+</points>
+</Connector>
+</connectors>
+</Diagram>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/AFCEF013-4CF2-4A5A-79A3-31521C1CA20A.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/AFCEF013-4CF2-4A5A-79A3-31521C1CA20A.xml
new file mode 100644
index 0000000..14a7566
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/AFCEF013-4CF2-4A5A-79A3-31521C1CA20A.xml
@@ -0,0 +1,306 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Diagram class="oracle.dbtools.crest.swingui.logical.DPVLogical" name="Logical" id="AFCEF013-4CF2-4A5A-79A3-31521C1CA20A">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:02:17 UTC</createdTime>
+<autoRoute>false</autoRoute>
+<boxInbox>true</boxInbox>
+<showLegend>false</showLegend>
+<showLabels>true</showLabels>
+<showGrid>true</showGrid>
+<diagramColor>-1</diagramColor>
+<legendPosX>265</legendPosX>
+<legendPosY>490</legendPosY>
+<display>false</display>
+<notation>0</notation>
+<objectViews>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="16464F5A-64BE-D2ED-91E0-BCBD0AA34680" otype="Entity" vid="5B100733-B921-D478-15B5-3BE9A7747A87">
+<bounds x="1014" y="625" width="121" height="102"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="1BEAB532-23CA-8628-0C97-7CAD39119A4E" otype="Entity" vid="62F579AD-F97F-1F92-7C5F-525AE1A2F26C">
+<bounds x="680" y="419" width="161" height="52"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="24150FB1-B00F-4F69-6F77-49ECB58F0F66" otype="Entity" vid="B3D29C8C-8482-D7AF-BE58-122AB07FB853">
+<bounds x="273" y="96" width="138" height="61"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="28DD93CF-D058-7343-CD47-E9B435E1AC16" otype="Entity" vid="ABB72A58-23E7-DF85-4B01-74F467F60284">
+<bounds x="1190" y="610" width="131" height="41"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="2F6ACC6D-3D17-537D-8ADF-F8424395B345" otype="Entity" vid="40AB3AA2-7D9F-7BA7-AB96-050F27CF81AB">
+<bounds x="110" y="570" width="151" height="51"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="44FFF5E9-0C2F-7BAC-B5B7-73CA3A230B39" otype="Entity" vid="BE78445F-B005-8F1A-E390-120DCC587063">
+<bounds x="1270" y="448" width="151" height="41"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="4579B792-2F35-D72A-1A3B-C7E53C41A766" otype="Entity" vid="BA629852-B837-F348-59DD-12899B260C79">
+<bounds x="1190" y="710" width="131" height="41"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="4D937E7C-3A28-E52D-89C0-EC8804C62367" otype="Entity" vid="109E2A3F-B942-1D32-CB1C-4F60260ACF5C">
+<bounds x="1270" y="522" width="152" height="43"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="504221DA-1B57-4EAD-39DB-40FD553E9FA2" otype="Entity" vid="F4CED71A-65B7-151C-3ADC-26F25043F168">
+<bounds x="1092" y="301" width="151" height="70"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="6A886CEE-579B-48FF-63F6-0FB03393FBF6" otype="Entity" vid="81A8E233-0690-CBFE-6102-F71A991903FC">
+<bounds x="180" y="250" width="131" height="71"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="7AE36CC1-A030-63E5-6EF3-72FCD04815EE" otype="Entity" vid="C8DAF849-7026-3615-7FC8-4397BFC6CA14">
+<bounds x="101" y="95" width="131" height="61"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.TVNote" oid="876CB767-80BA-6C8E-AACA-F1CCC95C445E" otype="Note" vid="593FF096-DB74-2562-91B0-A4F1423FEBA7">
+<bounds x="292" y="336" width="149" height="61"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="90367AFB-BA2D-A918-46B9-1E5DE53ACC48" otype="Entity" vid="5A1E3970-E7C2-5B4A-B4FC-A4224370E349">
+<bounds x="1270" y="300" width="145" height="72"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="90F477EE-35D6-21A7-B693-E5724FB07476" otype="Entity" vid="B6946DC3-6424-2A37-D668-5BD36839859C">
+<bounds x="824" y="652" width="141" height="51"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="9F78B73C-056D-DDEF-8C50-A9DA76B9E724" otype="Entity" vid="EEE8DCBD-05DB-E390-AE27-14DFF3B0DD56">
+<bounds x="1091" y="205" width="151" height="63"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="A352A20F-310D-E285-FBC9-90DD0DA7BB9B" otype="Entity" vid="27BF1041-8402-6396-1A77-2223122117A1">
+<bounds x="292" y="570" width="148" height="51"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="A6A5F317-479C-A0DD-CAAE-9DCB56B29D40" otype="Entity" vid="AB9AED98-F420-DDD6-02BA-ABA20D05AFB3">
+<bounds x="680" y="130" width="161" height="41"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="B36A186B-CDB3-7851-8C38-12EA8D50EAEB" otype="Entity" vid="8B654282-58D6-084A-69E2-3C8D7E390802">
+<bounds x="600" y="30" width="141" height="31"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="B82DAF9A-6F99-5CF6-4D99-A391BAD66192" otype="Entity" vid="2F2EDF15-4992-FE58-E928-D09AF0373D9E">
+<bounds x="680" y="250" width="161" height="71"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="C332E3D7-638B-6CA8-24BF-383CA8659A3A" otype="Entity" vid="03B42717-C78B-007E-11B3-EEA11AABA415">
+<bounds x="472" y="570" width="136" height="51"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="C79482B8-771B-FAD8-0337-163E3A45003A" otype="Entity" vid="8D1A1E0A-0651-0364-F81D-EC5D599DF29A">
+<bounds x="909" y="251" width="132" height="51"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="D09E0DE5-99D6-2991-032A-A8A124F6ACBA" otype="Entity" vid="2446BDB4-EEEF-A6B8-6F46-4C1208EDECC2">
+<bounds x="1190" y="662" width="131" height="39"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.TVNote" oid="D487AFDC-4027-F824-EA29-5C6D0ABB9E1E" otype="Note" vid="583B257A-5AD8-026F-84FF-AB3956387595">
+<bounds x="322" y="179" width="89" height="40"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="DCC79294-5434-1DED-298C-6473DEE59FBA" otype="Entity" vid="8689850E-1426-9DCF-EF62-4753AFEE7BE6">
+<bounds x="1087" y="460" width="157" height="51"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="DE366053-6F7A-7F42-ABA3-00E583098C37" otype="Entity" vid="CAF127DE-45F6-6BCE-8FAB-7BAE679347E1">
+<bounds x="430" y="250" width="131" height="71"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="E93BBF08-067B-A665-39F3-CF488A6547B2" otype="Entity" vid="2862D2B6-5340-9024-1DF2-E4408EA96B6E">
+<bounds x="789" y="30" width="132" height="31"/>
+</OView>
+</objectViews>
+<connectors>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="01537211-CCFB-0A1E-B43B-E8C641B69471" otype="Relation" vid_source="B6946DC3-6424-2A37-D668-5BD36839859C" vid_target="62F579AD-F97F-1F92-7C5F-525AE1A2F26C">
+<lineWidth>1</lineWidth>
+<points>
+<point x="832" y="652"/>
+<point x="832" y="471"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="02096BBB-0795-1759-1E26-2877BE36BB59" otype="Relation" vid_source="5B100733-B921-D478-15B5-3BE9A7747A87" vid_target="5B100733-B921-D478-15B5-3BE9A7747A87">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1135" y="676"/>
+<point x="1150" y="676"/>
+<point x="1150" y="742"/>
+<point x="1074" y="742"/>
+<point x="1074" y="727"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="0CCF1DE3-7916-9054-BEA6-C601FF564DB2" otype="Relation" vid_source="C8DAF849-7026-3615-7FC8-4397BFC6CA14" vid_target="81A8E233-0690-CBFE-6102-F71A991903FC">
+<lineWidth>1</lineWidth>
+<points>
+<point x="206" y="156"/>
+<point x="206" y="250"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="10867E70-94CE-FDAF-6B6E-2742D3A49E57" otype="Relation" vid_source="5A1E3970-E7C2-5B4A-B4FC-A4224370E349" vid_target="BE78445F-B005-8F1A-E390-120DCC587063">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1342" y="372"/>
+<point x="1342" y="448"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="11710A55-6423-1904-841A-C7D2AB8CEEBF" otype="Relation" vid_source="5B100733-B921-D478-15B5-3BE9A7747A87" vid_target="2446BDB4-EEEF-A6B8-6F46-4C1208EDECC2">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1135" y="690"/>
+<point x="1190" y="690"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="1C189437-742B-B999-C955-7754C8ADB089" otype="Relation" vid_source="81A8E233-0690-CBFE-6102-F71A991903FC" vid_target="CAF127DE-45F6-6BCE-8FAB-7BAE679347E1">
+<lineWidth>1</lineWidth>
+<points>
+<point x="311" y="285"/>
+<point x="430" y="285"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="34733942-1305-4CA1-47EB-ACE724B04E69" otype="Relation" vid_source="5B100733-B921-D478-15B5-3BE9A7747A87" vid_target="ABB72A58-23E7-DF85-4B01-74F467F60284">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1135" y="638"/>
+<point x="1190" y="638"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="3563C940-E524-7F96-7AE0-DAC3C1C17AFC" otype="Relation" vid_source="F4CED71A-65B7-151C-3ADC-26F25043F168" vid_target="B6946DC3-6424-2A37-D668-5BD36839859C">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1167" y="371"/>
+<point x="894" y="652"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="3983F50A-EBB9-E4DE-1958-60EA4EDD6D6C" otype="Relation" vid_source="B3D29C8C-8482-D7AF-BE58-122AB07FB853" vid_target="81A8E233-0690-CBFE-6102-F71A991903FC">
+<lineWidth>1</lineWidth>
+<points>
+<point x="300" y="157"/>
+<point x="300" y="250"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="3B7C8913-EB6A-47B1-27D0-E2C85EE9048B" otype="Relation" vid_source="AB9AED98-F420-DDD6-02BA-ABA20D05AFB3" vid_target="8B654282-58D6-084A-69E2-3C8D7E390802">
+<lineWidth>1</lineWidth>
+<points>
+<point x="710" y="130"/>
+<point x="710" y="61"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="518CE489-97B4-C05C-07A2-E3DBF14EE267" otype="Relation" vid_source="8689850E-1426-9DCF-EF62-4753AFEE7BE6" vid_target="BE78445F-B005-8F1A-E390-120DCC587063">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1244" y="474"/>
+<point x="1270" y="474"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="68A0C3E1-0FA1-8414-A361-33B08A8EDB39" otype="Relation" vid_source="8689850E-1426-9DCF-EF62-4753AFEE7BE6" vid_target="5B100733-B921-D478-15B5-3BE9A7747A87">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1111" y="511"/>
+<point x="1111" y="625"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="7497D76B-781B-3BDD-D797-FFBDB974F772" otype="Relation" vid_source="2F2EDF15-4992-FE58-E928-D09AF0373D9E" vid_target="8D1A1E0A-0651-0364-F81D-EC5D599DF29A">
+<lineWidth>1</lineWidth>
+<points>
+<point x="841" y="266"/>
+<point x="909" y="266"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="7DA9DD83-A52E-CA1E-FCBF-FC9CE71AF635" otype="Relation" vid_source="5B100733-B921-D478-15B5-3BE9A7747A87" vid_target="BA629852-B837-F348-59DD-12899B260C79">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1135" y="718"/>
+<point x="1190" y="718"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="89A83E25-364B-6B73-0613-FEAD875EF9FB" otype="Relation" vid_source="2F2EDF15-4992-FE58-E928-D09AF0373D9E" vid_target="62F579AD-F97F-1F92-7C5F-525AE1A2F26C">
+<lineWidth>1</lineWidth>
+<points>
+<point x="750" y="321"/>
+<point x="750" y="419"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="8E5018CC-34E3-9AFC-D6D1-31E2BC4E9FE2" otype="Relation" vid_source="03B42717-C78B-007E-11B3-EEA11AABA415" vid_target="62F579AD-F97F-1F92-7C5F-525AE1A2F26C">
+<lineWidth>1</lineWidth>
+<points>
+<point x="540" y="570"/>
+<point x="760" y="471"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="9B1FE0CF-B2AD-EED0-22FC-461A7D46DE51" otype="Relation" vid_source="40AB3AA2-7D9F-7BA7-AB96-050F27CF81AB" vid_target="8D1A1E0A-0651-0364-F81D-EC5D599DF29A">
+<lineWidth>1</lineWidth>
+<points>
+<point x="185" y="570"/>
+<point x="985" y="302"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="A182A65A-47AE-5D00-9A30-BC20AB050BF2" otype="Relation" vid_source="B6946DC3-6424-2A37-D668-5BD36839859C" vid_target="5B100733-B921-D478-15B5-3BE9A7747A87">
+<lineWidth>1</lineWidth>
+<points>
+<point x="965" y="677"/>
+<point x="1014" y="677"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="B346381F-48FE-E495-01A7-E22EC26AEE8A" otype="Relation" vid_source="2F2EDF15-4992-FE58-E928-D09AF0373D9E" vid_target="CAF127DE-45F6-6BCE-8FAB-7BAE679347E1">
+<lineWidth>1</lineWidth>
+<points>
+<point x="680" y="285"/>
+<point x="561" y="285"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="B3596116-540F-6397-ECE4-58A386644E15" otype="Relation" vid_source="2F2EDF15-4992-FE58-E928-D09AF0373D9E" vid_target="2F2EDF15-4992-FE58-E928-D09AF0373D9E">
+<lineWidth>1</lineWidth>
+<points>
+<point x="841" y="285"/>
+<point x="856" y="285"/>
+<point x="856" y="336"/>
+<point x="760" y="336"/>
+<point x="760" y="321"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="BAD8EC05-6F14-4E38-366C-B4B660C6F38A" otype="Relation" vid_source="BE78445F-B005-8F1A-E390-120DCC587063" vid_target="109E2A3F-B942-1D32-CB1C-4F60260ACF5C">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1345" y="489"/>
+<point x="1345" y="522"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="C5B67DD4-FA4F-EF9F-1FF5-0445D51B32EE" otype="Relation" vid_source="B6946DC3-6424-2A37-D668-5BD36839859C" vid_target="C8DAF849-7026-3615-7FC8-4397BFC6CA14">
+<lineWidth>1</lineWidth>
+<points>
+<point x="894" y="652"/>
+<point x="166" y="156"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="CCD38E11-8557-EB34-2651-07EB29E83FA6" otype="Relation" vid_source="B3D29C8C-8482-D7AF-BE58-122AB07FB853" vid_target="81A8E233-0690-CBFE-6102-F71A991903FC">
+<lineWidth>1</lineWidth>
+<points>
+<point x="280" y="157"/>
+<point x="280" y="250"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="E2A47942-ED55-E81D-4C71-9A134C49C147" otype="Relation" vid_source="C8DAF849-7026-3615-7FC8-4397BFC6CA14" vid_target="27BF1041-8402-6396-1A77-2223122117A1">
+<lineWidth>1</lineWidth>
+<points>
+<point x="166" y="156"/>
+<point x="330" y="570"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="E4FE88E9-EE21-B43B-B0FE-A153E38246F9" otype="Relation" vid_source="2F2EDF15-4992-FE58-E928-D09AF0373D9E" vid_target="AB9AED98-F420-DDD6-02BA-ABA20D05AFB3">
+<lineWidth>1</lineWidth>
+<points>
+<point x="760" y="250"/>
+<point x="760" y="171"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="E62AE7DF-49EE-9280-B328-A867CBD273AE" otype="Relation" vid_source="27BF1041-8402-6396-1A77-2223122117A1" vid_target="B6946DC3-6424-2A37-D668-5BD36839859C">
+<lineWidth>1</lineWidth>
+<points>
+<point x="360" y="621"/>
+<point x="824" y="677"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="E74406B5-20F1-4323-DC99-6E45982CB606" otype="Relation" vid_source="AB9AED98-F420-DDD6-02BA-ABA20D05AFB3" vid_target="2862D2B6-5340-9024-1DF2-E4408EA96B6E">
+<lineWidth>1</lineWidth>
+<points>
+<point x="815" y="130"/>
+<point x="815" y="61"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="EC4EB506-3DBE-7F36-6451-F31920EDAB52" otype="Relation" vid_source="C8DAF849-7026-3615-7FC8-4397BFC6CA14" vid_target="40AB3AA2-7D9F-7BA7-AB96-050F27CF81AB">
+<lineWidth>1</lineWidth>
+<points>
+<point x="130" y="156"/>
+<point x="130" y="570"/>
+</points>
+</Connector>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="EE1D98EF-6AEA-2790-D9B9-DBC2ED21D880" otype="Relation" vid_source="EEE8DCBD-05DB-E390-AE27-14DFF3B0DD56" vid_target="F4CED71A-65B7-151C-3ADC-26F25043F168">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1166" y="243"/>
+<point x="1167" y="301"/>
+</points>
+</Connector>
+</connectors>
+</Diagram>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/F936BE6D-7A74-1B57-7564-41C1E13B973B.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/F936BE6D-7A74-1B57-7564-41C1E13B973B.xml
new file mode 100644
index 0000000..bcc0009
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/logical/subviews/F936BE6D-7A74-1B57-7564-41C1E13B973B.xml
@@ -0,0 +1,33 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Diagram class="oracle.dbtools.crest.swingui.logical.DPVLogicalSubView" name="Inputs" id="F936BE6D-7A74-1B57-7564-41C1E13B973B">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-21 09:08:50 UTC</createdTime>
+<autoRoute>false</autoRoute>
+<boxInbox>true</boxInbox>
+<showLegend>false</showLegend>
+<showLabels>false</showLabels>
+<showGrid>false</showGrid>
+<diagramColor>-1</diagramColor>
+<display>false</display>
+<notation>0</notation>
+<objectViews>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="504221DA-1B57-4EAD-39DB-40FD553E9FA2" otype="Entity" vid="EA3885E3-FEE4-031B-1751-1C6351610836">
+<bounds x="1091" y="476" width="151" height="70"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="90367AFB-BA2D-A918-46B9-1E5DE53ACC48" otype="Entity" vid="86784B28-925D-6EAF-24D8-27DE22A0A93B">
+<bounds x="1090" y="376" width="151" height="68"/>
+</OView>
+<OView class="oracle.dbtools.crest.swingui.logical.TVEntity" oid="9F78B73C-056D-DDEF-8C50-A9DA76B9E724" otype="Entity" vid="1B62E962-0DFC-D5AE-0AC4-33E14F65E825">
+<bounds x="1297" y="477" width="151" height="71"/>
+</OView>
+</objectViews>
+<connectors>
+<Connector class="oracle.dbtools.crest.swingui.logical.TVRelation" oid="EE1D98EF-6AEA-2790-D9B9-DBC2ED21D880" otype="Relation" vid_source="1B62E962-0DFC-D5AE-0AC4-33E14F65E825" vid_target="EA3885E3-FEE4-031B-1751-1C6351610836">
+<lineWidth>1</lineWidth>
+<points>
+<point x="1297" y="511"/>
+<point x="1242" y="511"/>
+</points>
+</Connector>
+</connectors>
+</Diagram>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/mapping/ExtendedMap.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/mapping/ExtendedMap.xml
new file mode 100644
index 0000000..6811f63
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/mapping/ExtendedMap.xml
@@ -0,0 +1,3 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<ExtendedMap class="oracle.dbtools.crest.model.xtdmapping.ExtendedMap">
+</ExtendedMap>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/mapping/ExtendedMap_RMB082B14A-BEA8-D8A7-D661-197F34766ED3.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/mapping/ExtendedMap_RMB082B14A-BEA8-D8A7-D661-197F34766ED3.xml
new file mode 100644
index 0000000..7ea5df0
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/mapping/ExtendedMap_RMB082B14A-BEA8-D8A7-D661-197F34766ED3.xml
@@ -0,0 +1,3 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<RMExtendedMap class="oracle.dbtools.crest.model.xtdmapping.RMExtendedMap">
+</RMExtendedMap>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rdbms/TestManagerDatabase_RDBMSSites.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rdbms/TestManagerDatabase_RDBMSSites.xml
new file mode 100644
index 0000000..e0c5dad
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rdbms/TestManagerDatabase_RDBMSSites.xml
@@ -0,0 +1,2 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<metadatadoc version="2.0"/>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rel/B082B14A-197F34766ED3.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rel/B082B14A-197F34766ED3.xml
new file mode 100644
index 0000000..76bdad8
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rel/B082B14A-197F34766ED3.xml
@@ -0,0 +1,8 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<relationalModel class="oracle.dbtools.crest.model.design.relational.RelationalDesign" name="Relational_1" id="B082B14A-BEA8-D8A7-D661-197F34766ED3" mainViewID="6CEC5843-B4DD-D9B0-54D4-2845569D5E9F">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 21:58:45 UTC</createdTime>
+<ownerDesignName>TestManagerDatabase</ownerDesignName>
+<shouldBeOpen>false</shouldBeOpen>
+<selectedRDBMSSite>32076570-2523-435C-2E92-BF29817DFF70</selectedRDBMSSite>
+</relationalModel>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rel/B082B14A-197F34766ED3/subviews/6CEC5843-B4DD-D9B0-54D4-2845569D5E9F.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rel/B082B14A-197F34766ED3/subviews/6CEC5843-B4DD-D9B0-54D4-2845569D5E9F.xml
new file mode 100644
index 0000000..44b040b
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/rel/B082B14A-197F34766ED3/subviews/6CEC5843-B4DD-D9B0-54D4-2845569D5E9F.xml
@@ -0,0 +1,13 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<Diagram class="oracle.dbtools.crest.swingui.relational.DPVRelational" name="Relational_1" id="6CEC5843-B4DD-D9B0-54D4-2845569D5E9F">
+<createdBy>bird</createdBy>
+<createdTime>2012-08-20 22:02:17 UTC</createdTime>
+<autoRoute>false</autoRoute>
+<boxInbox>true</boxInbox>
+<showLegend>false</showLegend>
+<showLabels>false</showLabels>
+<showGrid>false</showGrid>
+<diagramColor>-1</diagramColor>
+<display>false</display>
+<notation>0</notation>
+</Diagram>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/types.xml b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/types.xml
new file mode 100644
index 0000000..64fa7ab
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabase/types.xml
@@ -0,0 +1,933 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<logtypes>
+	<logicaltype name="Audio" objectid="LOGDT005">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">BINARY, size</mapping>
+		<mapping rdbms="SQL Server 2000">BINARY, size</mapping>
+		<mapping rdbms="DB2/390 8">BLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">BLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="BFile" objectid="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10034">
+		<mapping rdbms="Oracle Database 11g">BFILE</mapping>
+		<mapping rdbms="Oracle Database 10g">BFILE</mapping>
+		<mapping rdbms="Oracle9i">BFILE</mapping>
+		<mapping rdbms="SQL Server 2005">VARCHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">DATALINK</mapping>
+		<mapping rdbms="DB2/UDB 7.1">DATALINK</mapping>
+	</logicaltype>
+	<logicaltype name="BIGINT" objectid="LOGDT027">
+		<mapping rdbms="Oracle Database 11g">INTEGER</mapping>
+		<mapping rdbms="Oracle Database 10g">INTEGER</mapping>
+		<mapping rdbms="Oracle9i">INTEGER</mapping>
+		<mapping rdbms="SQL Server 2005">BIGINT</mapping>
+		<mapping rdbms="SQL Server 2000">BIGINT</mapping>
+		<mapping rdbms="DB2/390 8">INTEGER</mapping>
+		<mapping rdbms="DB2/390 7">INTEGER</mapping>
+		<mapping rdbms="DB2/UDB 8.1">INTEGER</mapping>
+		<mapping rdbms="DB2/UDB 7.1">INTEGER</mapping>
+	</logicaltype>
+	<logicaltype name="BINARY" objectid="LOGDT033">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">BINARY, size</mapping>
+		<mapping rdbms="SQL Server 2000">BINARY, size</mapping>
+		<mapping rdbms="DB2/390 8">BLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">BLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="BINARY DOUBLE" objectid="LOGDT056">
+		<mapping rdbms="Oracle Database 11g">BINARY_DOUBLE</mapping>
+		<mapping rdbms="Oracle Database 10g">BINARY_DOUBLE</mapping>
+		<mapping rdbms="Oracle9i">NUMBER</mapping>
+		<mapping rdbms="SQL Server 2005">FLOAT</mapping>
+		<mapping rdbms="SQL Server 2000">FLOAT</mapping>
+		<mapping rdbms="DB2/390 8">DOUBLE</mapping>
+		<mapping rdbms="DB2/390 7">DOUBLE</mapping>
+		<mapping rdbms="DB2/UDB 8.1">DOUBLE</mapping>
+		<mapping rdbms="DB2/UDB 7.1">DOUBLE</mapping>
+	</logicaltype>
+	<logicaltype name="BINARY FLOAT" objectid="LOGDT055">
+		<mapping rdbms="Oracle Database 11g">BINARY_FLOAT</mapping>
+		<mapping rdbms="Oracle Database 10g">BINARY_FLOAT</mapping>
+		<mapping rdbms="Oracle9i">NUMBER</mapping>
+		<mapping rdbms="SQL Server 2005">REAL</mapping>
+		<mapping rdbms="SQL Server 2000">REAL</mapping>
+		<mapping rdbms="DB2/390 8">REAL</mapping>
+		<mapping rdbms="DB2/390 7">REAL</mapping>
+		<mapping rdbms="DB2/UDB 8.1">REAL</mapping>
+		<mapping rdbms="DB2/UDB 7.1">REAL</mapping>
+	</logicaltype>
+	<logicaltype name="BIT" objectid="LOGDT034">
+		<mapping rdbms="Oracle Database 11g">CHAR</mapping>
+		<mapping rdbms="Oracle Database 10g">CHAR</mapping>
+		<mapping rdbms="Oracle9i">CHAR</mapping>
+		<mapping rdbms="SQL Server 2005">BIT</mapping>
+		<mapping rdbms="SQL Server 2000">BIT</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="BLOB" objectid="LOGDT029">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">IMAGE</mapping>
+		<mapping rdbms="SQL Server 2000">IMAGE</mapping>
+		<mapping rdbms="DB2/390 8">BLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">BLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="Boolean" objectid="LOGDT006">
+		<mapping rdbms="Oracle Database 11g">CHAR</mapping>
+		<mapping rdbms="Oracle Database 10g">CHAR</mapping>
+		<mapping rdbms="Oracle9i">CHAR</mapping>
+		<mapping rdbms="SQL Server 2005">BIT</mapping>
+		<mapping rdbms="SQL Server 2000">BIT</mapping>
+		<mapping rdbms="DB2/390 8">CHAR</mapping>
+		<mapping rdbms="DB2/390 7">CHAR</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR</mapping>
+	</logicaltype>
+	<logicaltype name="CHAR" objectid="LOGDT025">
+		<mapping rdbms="Oracle Database 11g">CHAR, size</mapping>
+		<mapping rdbms="Oracle Database 10g">CHAR, size</mapping>
+		<mapping rdbms="Oracle9i">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2005">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="CLOB" objectid="LOGDT028">
+		<mapping rdbms="Oracle Database 11g">CLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">CLOB</mapping>
+		<mapping rdbms="Oracle9i">CLOB</mapping>
+		<mapping rdbms="SQL Server 2005" size_default_value="max">VARCHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">TEXT</mapping>
+		<mapping rdbms="DB2/390 8">CLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="DATALINK" objectid="LOGDT030">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">BINARY</mapping>
+		<mapping rdbms="SQL Server 2000">BINARY</mapping>
+		<mapping rdbms="DB2/390 8">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">DATALINK</mapping>
+		<mapping rdbms="DB2/UDB 7.1">DATALINK</mapping>
+	</logicaltype>
+	<logicaltype name="DBURIType" objectid="LOGDT054">
+		<mapping rdbms="Oracle Database 11g">DBURITYPE</mapping>
+		<mapping rdbms="Oracle Database 10g">DBURITYPE</mapping>
+		<mapping rdbms="Oracle9i">DBURITYPE</mapping>
+		<mapping rdbms="SQL Server 2005">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">DATALINK</mapping>
+		<mapping rdbms="DB2/UDB 7.1">DATALINK</mapping>
+	</logicaltype>
+	<logicaltype name="DECIMAL" objectid="LOGDT026">
+		<mapping rdbms="Oracle Database 11g">NUMBER, precision, scale</mapping>
+		<mapping rdbms="Oracle Database 10g">NUMBER, precision, scale</mapping>
+		<mapping rdbms="Oracle9i">NUMBER, precision, scale</mapping>
+		<mapping rdbms="SQL Server 2005">DECIMAL, precision, scale</mapping>
+		<mapping rdbms="SQL Server 2000">DECIMAL, precision, scale</mapping>
+		<mapping rdbms="DB2/390 8">DECIMAL, precision, scale</mapping>
+		<mapping rdbms="DB2/390 7">DECIMAL, precision, scale</mapping>
+		<mapping rdbms="DB2/UDB 8.1">DECIMAL, precision, scale</mapping>
+		<mapping rdbms="DB2/UDB 7.1">DECIMAL, precision, scale</mapping>
+	</logicaltype>
+	<logicaltype name="DOUBLE" objectid="LOGDT020">
+		<mapping rdbms="Oracle Database 11g">NUMBER</mapping>
+		<mapping rdbms="Oracle Database 10g">NUMBER</mapping>
+		<mapping rdbms="Oracle9i">NUMBER</mapping>
+		<mapping rdbms="SQL Server 2005">BIGINT</mapping>
+		<mapping rdbms="SQL Server 2000">BIGINT</mapping>
+		<mapping rdbms="DB2/390 8">DOUBLE</mapping>
+		<mapping rdbms="DB2/390 7">DOUBLE</mapping>
+		<mapping rdbms="DB2/UDB 8.1">DOUBLE</mapping>
+		<mapping rdbms="DB2/UDB 7.1">DOUBLE</mapping>
+	</logicaltype>
+	<logicaltype name="Date" objectid="LOGDT007">
+		<mapping rdbms="Oracle Database 11g">DATE</mapping>
+		<mapping rdbms="Oracle Database 10g">DATE</mapping>
+		<mapping rdbms="Oracle9i">DATE</mapping>
+		<mapping rdbms="SQL Server 2005">DATETIME</mapping>
+		<mapping rdbms="SQL Server 2000">DATETIME</mapping>
+		<mapping rdbms="DB2/390 8">DATE</mapping>
+		<mapping rdbms="DB2/390 7">DATE</mapping>
+		<mapping rdbms="DB2/UDB 8.1">DATE</mapping>
+		<mapping rdbms="DB2/UDB 7.1">DATE</mapping>
+	</logicaltype>
+	<logicaltype name="Datetime" objectid="LOGDT008">
+		<mapping rdbms="Oracle Database 11g">DATE</mapping>
+		<mapping rdbms="Oracle Database 10g">DATE</mapping>
+		<mapping rdbms="Oracle9i">DATE</mapping>
+		<mapping rdbms="SQL Server 2005">DATETIME</mapping>
+		<mapping rdbms="SQL Server 2000">DATETIME</mapping>
+		<mapping rdbms="DB2/390 8">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/390 7">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 8.1">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 7.1">TIMESTAMP</mapping>
+	</logicaltype>
+	<logicaltype name="FLOAT" objectid="LOGDT021">
+		<mapping rdbms="Oracle Database 11g">FLOAT, precision</mapping>
+		<mapping rdbms="Oracle Database 10g">FLOAT, precision</mapping>
+		<mapping rdbms="Oracle9i">FLOAT, precision</mapping>
+		<mapping rdbms="SQL Server 2005">FLOAT, precision</mapping>
+		<mapping rdbms="SQL Server 2000">FLOAT, precision</mapping>
+		<mapping rdbms="DB2/390 8">FLOAT, precision</mapping>
+		<mapping rdbms="DB2/390 7">FLOAT, precision</mapping>
+		<mapping rdbms="DB2/UDB 8.1">FLOAT, precision</mapping>
+		<mapping rdbms="DB2/UDB 7.1">FLOAT, precision</mapping>
+	</logicaltype>
+	<logicaltype name="GRAPHIC" objectid="LOGDT031">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">BINARY</mapping>
+		<mapping rdbms="SQL Server 2000">BINARY</mapping>
+		<mapping rdbms="DB2/390 8">GRAPHIC, size</mapping>
+		<mapping rdbms="DB2/390 7">GRAPHIC, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">GRAPHIC, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">GRAPHIC, size</mapping>
+	</logicaltype>
+	<logicaltype name="HTTPURIType" objectid="LOGDT052">
+		<mapping rdbms="Oracle Database 11g">HTTPURITYPE</mapping>
+		<mapping rdbms="Oracle Database 10g">HTTPURITYPE</mapping>
+		<mapping rdbms="Oracle9i">HTTPURITYPE</mapping>
+		<mapping rdbms="SQL Server 2005">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="INTERVAL DAY TO SECOND" objectid="LOGDT049">
+		<mapping rdbms="Oracle Database 11g">INTERVAL DAY TO SECOND, precision, scale</mapping>
+		<mapping rdbms="Oracle Database 10g">INTERVAL DAY TO SECOND, precision, scale</mapping>
+		<mapping rdbms="Oracle9i">INTERVAL DAY TO SECOND, precision, scale</mapping>
+		<mapping rdbms="SQL Server 2005">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="INTERVAL YEAR TO MONTH" objectid="LOGDT048">
+		<mapping rdbms="Oracle Database 11g">INTERVAL YEAR TO MONTH, precision</mapping>
+		<mapping rdbms="Oracle Database 10g">INTERVAL YEAR TO MONTH, precision</mapping>
+		<mapping rdbms="Oracle9i">INTERVAL YEAR TO MONTH, precision</mapping>
+		<mapping rdbms="SQL Server 2005">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="Image" objectid="LOGDT010">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">IMAGE</mapping>
+		<mapping rdbms="SQL Server 2000">IMAGE</mapping>
+		<mapping rdbms="DB2/390 8">BLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">BLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="Integer" objectid="LOGDT011">
+		<mapping rdbms="Oracle Database 11g">INTEGER</mapping>
+		<mapping rdbms="Oracle Database 10g">INTEGER</mapping>
+		<mapping rdbms="Oracle9i">INTEGER</mapping>
+		<mapping rdbms="SQL Server 2005">INTEGER</mapping>
+		<mapping rdbms="SQL Server 2000">INTEGER</mapping>
+		<mapping rdbms="DB2/390 8">INTEGER</mapping>
+		<mapping rdbms="DB2/390 7">INTEGER</mapping>
+		<mapping rdbms="DB2/UDB 8.1">INTEGER</mapping>
+		<mapping rdbms="DB2/UDB 7.1">INTEGER</mapping>
+	</logicaltype>
+	<logicaltype name="Long Char" objectid="LogDes-1768A872-F385-FDBA-D95E-0CB63F5908E2 at LOGDT10045">
+		<mapping rdbms="Oracle Database 11g">LONG</mapping>
+		<mapping rdbms="Oracle Database 10g">LONG</mapping>
+		<mapping rdbms="Oracle9i">LONG</mapping>
+		<mapping rdbms="SQL Server 2005">VARCHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="Long_Raw" objectid="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036">
+		<mapping rdbms="Oracle Database 11g">LONG RAW</mapping>
+		<mapping rdbms="Oracle Database 10g">LONG RAW</mapping>
+		<mapping rdbms="Oracle9i">LONG RAW</mapping>
+		<mapping rdbms="SQL Server 2005">VARBINARY, size</mapping>
+		<mapping rdbms="SQL Server 2000">VARBINARY, size</mapping>
+		<mapping rdbms="DB2/390 8">BLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">BLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="MONEY" objectid="LOGDT043">
+		<mapping rdbms="Oracle Database 11g">NUMBER, precision, scale</mapping>
+		<mapping rdbms="Oracle Database 10g">NUMBER, precision, scale</mapping>
+		<mapping rdbms="Oracle9i">NUMBER, precision, scale</mapping>
+		<mapping rdbms="SQL Server 2005">MONEY</mapping>
+		<mapping rdbms="SQL Server 2000">MONEY</mapping>
+		<mapping rdbms="DB2/390 8">DOUBLE</mapping>
+		<mapping rdbms="DB2/390 7">DOUBLE</mapping>
+		<mapping rdbms="DB2/UDB 8.1">DOUBLE</mapping>
+		<mapping rdbms="DB2/UDB 7.1">DOUBLE</mapping>
+	</logicaltype>
+	<logicaltype name="NCHAR" objectid="LOGDT035">
+		<mapping rdbms="Oracle Database 11g">NCHAR, size</mapping>
+		<mapping rdbms="Oracle Database 10g">NCHAR, size</mapping>
+		<mapping rdbms="Oracle9i">NCHAR, size</mapping>
+		<mapping rdbms="SQL Server 2005">NCHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">NCHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="NClob" objectid="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10035">
+		<mapping rdbms="Oracle Database 11g">NCLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">NCLOB</mapping>
+		<mapping rdbms="Oracle9i">NCLOB</mapping>
+		<mapping rdbms="SQL Server 2005">NTEXT</mapping>
+		<mapping rdbms="SQL Server 2000">NTEXT</mapping>
+		<mapping rdbms="DB2/390 8">CLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="NTEXT" objectid="LOGDT036">
+		<mapping rdbms="Oracle Database 11g">NCLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">NCLOB</mapping>
+		<mapping rdbms="Oracle9i">NCLOB</mapping>
+		<mapping rdbms="SQL Server 2005">NTEXT</mapping>
+		<mapping rdbms="SQL Server 2000">NTEXT</mapping>
+		<mapping rdbms="DB2/390 8">CLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="NUMERIC" objectid="LOGDT019">
+		<mapping rdbms="Oracle Database 11g">NUMBER, precision, scale</mapping>
+		<mapping rdbms="Oracle Database 10g">NUMBER, precision, scale</mapping>
+		<mapping rdbms="Oracle9i">NUMBER, precision, scale</mapping>
+		<mapping rdbms="SQL Server 2005">NUMERIC, precision, scale</mapping>
+		<mapping rdbms="SQL Server 2000">NUMERIC, precision, scale</mapping>
+		<mapping rdbms="DB2/390 8">NUMERIC, precision, scale</mapping>
+		<mapping rdbms="DB2/390 7">NUMERIC, precision, scale</mapping>
+		<mapping rdbms="DB2/UDB 8.1">NUMERIC, precision, scale</mapping>
+		<mapping rdbms="DB2/UDB 7.1">NUMERIC, precision, scale</mapping>
+	</logicaltype>
+	<logicaltype name="NVARCHAR" objectid="LOGDT037">
+		<mapping rdbms="Oracle Database 11g">NVARCHAR2, size</mapping>
+		<mapping rdbms="Oracle Database 10g">NVARCHAR2, size</mapping>
+		<mapping rdbms="Oracle9i">NVARCHAR2, size</mapping>
+		<mapping rdbms="SQL Server 2005">NVARCHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">NVARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">VARCHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="ORDAUDIO" objectid="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10005">
+		<mapping rdbms="Oracle Database 11g">ORDSYS.ORDAudio</mapping>
+		<mapping rdbms="Oracle Database 10g">ORDSYS.ORDAudio</mapping>
+		<mapping rdbms="Oracle9i">ORDSYS.ORDAudio</mapping>
+		<mapping rdbms="SQL Server 2005">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2000">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="ORDDOC" objectid="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10009">
+		<mapping rdbms="Oracle Database 11g">ORDSYS.ORDDoc</mapping>
+		<mapping rdbms="Oracle Database 10g">ORDSYS.ORDDoc</mapping>
+		<mapping rdbms="Oracle9i">ORDSYS.ORDDoc</mapping>
+		<mapping rdbms="SQL Server 2005">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2000">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="ORDIMAGE" objectid="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10006">
+		<mapping rdbms="Oracle Database 11g">ORDSYS.ORDImage</mapping>
+		<mapping rdbms="Oracle Database 10g">ORDSYS.ORDImage</mapping>
+		<mapping rdbms="Oracle9i">ORDSYS.ORDImage</mapping>
+		<mapping rdbms="SQL Server 2005">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2000">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="ORDIMAGE_SIGNATURE" objectid="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10007">
+		<mapping rdbms="Oracle Database 11g">ORDSYS.ORDImageSignature</mapping>
+		<mapping rdbms="Oracle Database 10g">ORDSYS.ORDImageSignature</mapping>
+		<mapping rdbms="Oracle9i">ORDSYS.ORDImageSignature</mapping>
+		<mapping rdbms="SQL Server 2005">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2000">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="ORDVIDEO" objectid="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10008">
+		<mapping rdbms="Oracle Database 11g">ORDSYS.ORDVideo</mapping>
+		<mapping rdbms="Oracle Database 10g">ORDSYS.ORDVideo</mapping>
+		<mapping rdbms="Oracle9i">ORDSYS.ORDVideo</mapping>
+		<mapping rdbms="SQL Server 2005">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2000">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="REAL" objectid="LOGDT022">
+		<mapping rdbms="Oracle Database 11g">REAL</mapping>
+		<mapping rdbms="Oracle Database 10g">REAL</mapping>
+		<mapping rdbms="Oracle9i">REAL</mapping>
+		<mapping rdbms="SQL Server 2005">REAL, precision</mapping>
+		<mapping rdbms="SQL Server 2000">REAL, precision</mapping>
+		<mapping rdbms="DB2/390 8">REAL</mapping>
+		<mapping rdbms="DB2/390 7">REAL</mapping>
+		<mapping rdbms="DB2/UDB 8.1">REAL</mapping>
+		<mapping rdbms="DB2/UDB 7.1">REAL</mapping>
+	</logicaltype>
+	<logicaltype name="ROWID" objectid="LOGDT032">
+		<mapping rdbms="Oracle Database 11g">ROWID</mapping>
+		<mapping rdbms="Oracle Database 10g">ROWID</mapping>
+		<mapping rdbms="Oracle9i">ROWID</mapping>
+		<mapping rdbms="SQL Server 2005">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">ROWID</mapping>
+		<mapping rdbms="DB2/390 7">ROWID</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="Raw" objectid="LogDes-4BABEC65-108B-2A3C-F7C4-84AC47D292B0 at LOGDT10040">
+		<mapping rdbms="Oracle Database 11g">RAW, size</mapping>
+		<mapping rdbms="Oracle Database 10g">RAW, size</mapping>
+		<mapping rdbms="Oracle9i">RAW, size</mapping>
+		<mapping rdbms="SQL Server 2005">VARBINARY, size</mapping>
+		<mapping rdbms="SQL Server 2000">VARBINARY, size</mapping>
+		<mapping rdbms="DB2/390 8">VARGRAPHIC, size</mapping>
+		<mapping rdbms="DB2/390 7">VARGRAPHIC, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">VARGRAPHIC, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">VARGRAPHIC, size</mapping>
+	</logicaltype>
+	<logicaltype name="SMALLDATETIME" objectid="LOGDT038">
+		<mapping rdbms="Oracle Database 11g">DATE</mapping>
+		<mapping rdbms="Oracle Database 10g">DATE</mapping>
+		<mapping rdbms="Oracle9i">DATE</mapping>
+		<mapping rdbms="SQL Server 2005">SMALLDATETIME</mapping>
+		<mapping rdbms="SQL Server 2000">SMALLDATETIME</mapping>
+		<mapping rdbms="DB2/390 8">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/390 7">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 8.1">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 7.1">TIMESTAMP</mapping>
+	</logicaltype>
+	<logicaltype name="SMALLINT" objectid="LOGDT018">
+		<mapping rdbms="Oracle Database 11g">SMALLINT</mapping>
+		<mapping rdbms="Oracle Database 10g">SMALLINT</mapping>
+		<mapping rdbms="Oracle9i">SMALLINT</mapping>
+		<mapping rdbms="SQL Server 2005">SMALLINT</mapping>
+		<mapping rdbms="SQL Server 2000">SMALLINT</mapping>
+		<mapping rdbms="DB2/390 8">SMALLINT</mapping>
+		<mapping rdbms="DB2/390 7">SMALLINT</mapping>
+		<mapping rdbms="DB2/UDB 8.1">SMALLINT</mapping>
+		<mapping rdbms="DB2/UDB 7.1">SMALLINT</mapping>
+	</logicaltype>
+	<logicaltype name="SMALLMONEY" objectid="LOGDT044">
+		<mapping rdbms="Oracle Database 11g">NUMBER, precision, scale</mapping>
+		<mapping rdbms="Oracle Database 10g">NUMBER, precision, scale</mapping>
+		<mapping rdbms="Oracle9i">NUMBER, precision, scale</mapping>
+		<mapping rdbms="SQL Server 2005">SMALLMONEY</mapping>
+		<mapping rdbms="SQL Server 2000">SMALLMONEY</mapping>
+		<mapping rdbms="DB2/390 8">REAL</mapping>
+		<mapping rdbms="DB2/390 7">REAL</mapping>
+		<mapping rdbms="DB2/UDB 8.1">REAL</mapping>
+		<mapping rdbms="DB2/UDB 7.1">REAL</mapping>
+	</logicaltype>
+	<logicaltype name="SQL_VARIANT" objectid="LOGDT045">
+		<mapping rdbms="Oracle Database 11g">SYS.ANYDATA</mapping>
+		<mapping rdbms="Oracle Database 10g">SYS.ANYDATA</mapping>
+		<mapping rdbms="Oracle9i">SYS.ANYDATA</mapping>
+		<mapping rdbms="SQL Server 2005">SQL_VARIANT</mapping>
+		<mapping rdbms="SQL Server 2000">SQL_VARIANT</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="SYSNAME" objectid="LOGDT039">
+		<mapping rdbms="Oracle Database 11g">VARCHAR2, size</mapping>
+		<mapping rdbms="Oracle Database 10g">VARCHAR2, size</mapping>
+		<mapping rdbms="Oracle9i">VARCHAR2, size</mapping>
+		<mapping rdbms="SQL Server 2005">SYSNAME</mapping>
+		<mapping rdbms="SQL Server 2000">SYSNAME</mapping>
+		<mapping rdbms="DB2/390 8">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">VARCHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="SYS_ANYDATA" objectid="LogDes-F046B719-7D91-3873-3302-38C441683842 at LOGDT10010">
+		<mapping rdbms="Oracle Database 11g">SYS.ANYDATA</mapping>
+		<mapping rdbms="Oracle Database 10g">SYS.ANYDATA</mapping>
+		<mapping rdbms="Oracle9i">SYS.ANYDATA</mapping>
+		<mapping rdbms="SQL Server 2005">SQL_VARIANT</mapping>
+		<mapping rdbms="SQL Server 2000">SQL_VARIANT</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="SYS_ANYDATASET" objectid="LogDes-22E251EB-9F6C-8137-56B2-DD4B87DC1E33 at LOGDT10030">
+		<mapping rdbms="Oracle Database 11g">SYS.ANYDATASET</mapping>
+		<mapping rdbms="Oracle Database 10g">SYS.ANYDATASET</mapping>
+		<mapping rdbms="Oracle9i">SYS.ANYDATASET</mapping>
+		<mapping rdbms="SQL Server 2005">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2000">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="SYS_ANYTYPE" objectid="LogDes-F046B719-7D91-3873-3302-38C441683842 at LOGDT10011">
+		<mapping rdbms="Oracle Database 11g">SYS.ANYTYPE</mapping>
+		<mapping rdbms="Oracle Database 10g">SYS.ANYTYPE</mapping>
+		<mapping rdbms="Oracle9i">SYS.ANYTYPE</mapping>
+		<mapping rdbms="SQL Server 2005">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2000">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<logicaltype name="TEXT" objectid="LOGDT040">
+		<mapping rdbms="Oracle Database 11g">CLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">CLOB</mapping>
+		<mapping rdbms="Oracle9i">CLOB</mapping>
+		<mapping rdbms="SQL Server 2005">TEXT</mapping>
+		<mapping rdbms="SQL Server 2000">TEXT</mapping>
+		<mapping rdbms="DB2/390 8">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">VARCHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="TIMESTAMP WITH LOCAL TIME ZONE" objectid="LOGDT047">
+		<mapping rdbms="Oracle Database 11g">TIMESTAMP WITH LOCAL TIME ZONE, precision</mapping>
+		<mapping rdbms="Oracle Database 10g">TIMESTAMP WITH LOCAL TIME ZONE, precision</mapping>
+		<mapping rdbms="Oracle9i">TIMESTAMP WITH LOCAL TIME ZONE, precision</mapping>
+		<mapping rdbms="SQL Server 2005">DATETIME</mapping>
+		<mapping rdbms="SQL Server 2000">DATETIME</mapping>
+		<mapping rdbms="DB2/390 8">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/390 7">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 8.1">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 7.1">TIMESTAMP</mapping>
+	</logicaltype>
+	<logicaltype name="TIMESTAMP WITH TIME ZONE" objectid="LOGDT046">
+		<mapping rdbms="Oracle Database 11g">TIMESTAMP WITH TIME ZONE, precision</mapping>
+		<mapping rdbms="Oracle Database 10g">TIMESTAMP WITH TIME ZONE, precision</mapping>
+		<mapping rdbms="Oracle9i">TIMESTAMP WITH TIME ZONE, precision</mapping>
+		<mapping rdbms="SQL Server 2005">DATETIME</mapping>
+		<mapping rdbms="SQL Server 2000">DATETIME</mapping>
+		<mapping rdbms="DB2/390 8">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/390 7">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 8.1">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 7.1">TIMESTAMP</mapping>
+	</logicaltype>
+	<logicaltype name="TINYINT" objectid="LOGDT042">
+		<mapping rdbms="Oracle Database 11g">SMALLINT</mapping>
+		<mapping rdbms="Oracle Database 10g">SMALLINT</mapping>
+		<mapping rdbms="Oracle9i">SMALLINT</mapping>
+		<mapping rdbms="SQL Server 2005">TINYINT</mapping>
+		<mapping rdbms="SQL Server 2000">TINYINT</mapping>
+		<mapping rdbms="DB2/390 8">SMALLINT</mapping>
+		<mapping rdbms="DB2/390 7">SMALLINT</mapping>
+		<mapping rdbms="DB2/UDB 8.1">SMALLINT</mapping>
+		<mapping rdbms="DB2/UDB 7.1">SMALLINT</mapping>
+	</logicaltype>
+	<logicaltype name="Time" objectid="LOGDT014">
+		<mapping rdbms="Oracle Database 11g">DATE</mapping>
+		<mapping rdbms="Oracle Database 10g">DATE</mapping>
+		<mapping rdbms="Oracle9i">DATE</mapping>
+		<mapping rdbms="SQL Server 2005">DATETIME</mapping>
+		<mapping rdbms="SQL Server 2000">DATETIME</mapping>
+		<mapping rdbms="DB2/390 8">TIME</mapping>
+		<mapping rdbms="DB2/390 7">TIME</mapping>
+		<mapping rdbms="DB2/UDB 8.1">TIME</mapping>
+		<mapping rdbms="DB2/UDB 7.1">TIME</mapping>
+	</logicaltype>
+	<logicaltype name="Timestamp" objectid="LOGDT015">
+		<mapping rdbms="Oracle Database 11g">TIMESTAMP, precision</mapping>
+		<mapping rdbms="Oracle Database 10g">TIMESTAMP, precision</mapping>
+		<mapping rdbms="Oracle9i">TIMESTAMP, precision</mapping>
+		<mapping rdbms="SQL Server 2005">DATETIME</mapping>
+		<mapping rdbms="SQL Server 2000">DATETIME</mapping>
+		<mapping rdbms="DB2/390 8">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/390 7">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 8.1">TIMESTAMP</mapping>
+		<mapping rdbms="DB2/UDB 7.1">TIMESTAMP</mapping>
+	</logicaltype>
+	<logicaltype name="UNIQUEIDENTIFIER" objectid="LOGDT057">
+		<mapping rdbms="Oracle Database 11g">CHAR, size</mapping>
+		<mapping rdbms="Oracle Database 10g">CHAR, size</mapping>
+		<mapping rdbms="Oracle9i">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2005">UNIQUEIDENTIFIER</mapping>
+		<mapping rdbms="SQL Server 2000">UNIQUEIDENTIFIER</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="URIType" objectid="LOGDT051">
+		<mapping rdbms="Oracle Database 11g">URITYPE</mapping>
+		<mapping rdbms="Oracle Database 10g">URITYPE</mapping>
+		<mapping rdbms="Oracle9i">URITYPE</mapping>
+		<mapping rdbms="SQL Server 2005">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="URowID" objectid="LogDes-4BABEC65-108B-2A3C-F7C4-84AC47D292B0 at LOGDT10041">
+		<mapping rdbms="Oracle Database 11g">UROWID, size</mapping>
+		<mapping rdbms="Oracle Database 10g">UROWID, size</mapping>
+		<mapping rdbms="Oracle9i">UROWID, size</mapping>
+		<mapping rdbms="SQL Server 2005">VARCHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">VARCHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="VARBINARY" objectid="LOGDT041">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">VARBINARY, size</mapping>
+		<mapping rdbms="SQL Server 2000">VARBINARY, size</mapping>
+		<mapping rdbms="DB2/390 8">BLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">BLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">BLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="VARCHAR" objectid="LOGDT024">
+		<mapping rdbms="Oracle Database 11g">VARCHAR2, size</mapping>
+		<mapping rdbms="Oracle Database 10g">VARCHAR2, size</mapping>
+		<mapping rdbms="Oracle9i">VARCHAR2, size</mapping>
+		<mapping rdbms="SQL Server 2005">VARCHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">VARCHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">VARCHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="VARGRAPHIC" objectid="LOGDT023">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">VARBINARY, size</mapping>
+		<mapping rdbms="SQL Server 2000">VARBINARY, size</mapping>
+		<mapping rdbms="DB2/390 8">VARGRAPHIC, size</mapping>
+		<mapping rdbms="DB2/390 7">VARGRAPHIC, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">VARGRAPHIC, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">VARGRAPHIC, size</mapping>
+	</logicaltype>
+	<logicaltype name="Video" objectid="LOGDT016">
+		<mapping rdbms="Oracle Database 11g">BLOB</mapping>
+		<mapping rdbms="Oracle Database 10g">BLOB</mapping>
+		<mapping rdbms="Oracle9i">BLOB</mapping>
+		<mapping rdbms="SQL Server 2005">IMAGE</mapping>
+		<mapping rdbms="SQL Server 2000">IMAGE</mapping>
+		<mapping rdbms="DB2/390 8">VARGRAPHIC, size</mapping>
+		<mapping rdbms="DB2/390 7">VARGRAPHIC, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">BLOB</mapping>
+		<mapping rdbms="DB2/UDB 7.1">BLOB</mapping>
+	</logicaltype>
+	<logicaltype name="XDBURIType" objectid="LOGDT053">
+		<mapping rdbms="Oracle Database 11g">XDBURITYPE</mapping>
+		<mapping rdbms="Oracle Database 10g">XDBURITYPE</mapping>
+		<mapping rdbms="Oracle9i">XDBURITYPE</mapping>
+		<mapping rdbms="SQL Server 2005">CHAR, size</mapping>
+		<mapping rdbms="SQL Server 2000">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 8">CHAR, size</mapping>
+		<mapping rdbms="DB2/390 7">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">CHAR, size</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CHAR, size</mapping>
+	</logicaltype>
+	<logicaltype name="XMLType" objectid="LOGDT050">
+		<mapping rdbms="Oracle Database 11g">XMLTYPE</mapping>
+		<mapping rdbms="Oracle Database 10g">XMLTYPE</mapping>
+		<mapping rdbms="Oracle9i">XMLTYPE</mapping>
+		<mapping rdbms="SQL Server 2005">XML</mapping>
+		<mapping rdbms="SQL Server 2000">TEXT</mapping>
+		<mapping rdbms="DB2/390 8">CLOB, size</mapping>
+		<mapping rdbms="DB2/390 7">CLOB, size</mapping>
+		<mapping rdbms="DB2/UDB 8.1">XML</mapping>
+		<mapping rdbms="DB2/UDB 7.1">CLOB, size</mapping>
+	</logicaltype>
+	<logicaltype name="unknown" objectid="LOGDT017" default="true">
+		<mapping rdbms="Oracle Database 11g">UNKNOWN</mapping>
+		<mapping rdbms="Oracle Database 10g">UNKNOWN</mapping>
+		<mapping rdbms="Oracle9i">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2005">UNKNOWN</mapping>
+		<mapping rdbms="SQL Server 2000">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 8">UNKNOWN</mapping>
+		<mapping rdbms="DB2/390 7">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 8.1">UNKNOWN</mapping>
+		<mapping rdbms="DB2/UDB 7.1">UNKNOWN</mapping>
+	</logicaltype>
+	<native_to_logical_mappings>
+		<mappings_for_RDBMS_type rdbms_type="Oracle Database 11g">
+			<mapping native_type="BFILE" logicaltype="BFile" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10034" />
+			<mapping native_type="BINARY_DOUBLE" logicaltype="BINARY DOUBLE" log_type_id="LOGDT056" />
+			<mapping native_type="BINARY_FLOAT" logicaltype="BINARY FLOAT" log_type_id="LOGDT055" />
+			<mapping native_type="BLOB" logicaltype="BLOB" log_type_id="LOGDT029" />
+			<mapping native_type="CHAR" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHAR VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CHARACTER" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHARACTER VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CLOB" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="DATE" logicaltype="Date" log_type_id="LOGDT007" />
+			<mapping native_type="DECIMAL" logicaltype="DECIMAL" log_type_id="LOGDT026" />
+			<mapping native_type="DOUBLE" logicaltype="DOUBLE" log_type_id="LOGDT020" />
+			<mapping native_type="FLOAT" logicaltype="FLOAT" log_type_id="LOGDT021" />
+			<mapping native_type="INTEGER" logicaltype="Integer" log_type_id="LOGDT011" />
+			<mapping native_type="LONG" logicaltype="Long Char" log_type_id="LogDes-1768A872-F385-FDBA-D95E-0CB63F5908E2 at LOGDT10045" />
+			<mapping native_type="LONG RAW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="LONG ROW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="LONGROW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="NATIONAL CHAR" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NATIONAL CHAR VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NATIONAL CHARACTER" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NATIONAL CHARACTER VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NCHAR" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NCHAR VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NCLOB" logicaltype="NClob" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10035" />
+			<mapping native_type="NUMBER" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="NUMERIC" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="RAW" logicaltype="Raw" log_type_id="LogDes-4BABEC65-108B-2A3C-F7C4-84AC47D292B0 at LOGDT10040" />
+			<mapping native_type="REAL" logicaltype="REAL" log_type_id="LOGDT022" />
+			<mapping native_type="ROWID" logicaltype="ROWID" log_type_id="LOGDT032" />
+			<mapping native_type="SMALLINT" logicaltype="SMALLINT" log_type_id="LOGDT018" />
+			<mapping native_type="UROWID" logicaltype="URowID" log_type_id="LogDes-4BABEC65-108B-2A3C-F7C4-84AC47D292B0 at LOGDT10041" />
+			<mapping native_type="VARCHAR" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="VARCHAR2" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+		</mappings_for_RDBMS_type>
+		<mappings_for_RDBMS_type rdbms_type="Oracle Database 10g">
+			<mapping native_type="BFILE" logicaltype="BFile" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10034" />
+			<mapping native_type="BINARY_DOUBLE" logicaltype="BINARY DOUBLE" log_type_id="LOGDT056" />
+			<mapping native_type="BINARY_FLOAT" logicaltype="BINARY FLOAT" log_type_id="LOGDT055" />
+			<mapping native_type="BLOB" logicaltype="BLOB" log_type_id="LOGDT029" />
+			<mapping native_type="CHAR" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHAR VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CHARACTER" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHARACTER VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CLOB" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="DATE" logicaltype="Date" log_type_id="LOGDT007" />
+			<mapping native_type="DECIMAL" logicaltype="DECIMAL" log_type_id="LOGDT026" />
+			<mapping native_type="DOUBLE" logicaltype="DOUBLE" log_type_id="LOGDT020" />
+			<mapping native_type="FLOAT" logicaltype="FLOAT" log_type_id="LOGDT021" />
+			<mapping native_type="INTEGER" logicaltype="Integer" log_type_id="LOGDT011" />
+			<mapping native_type="LONG" logicaltype="Long Char" log_type_id="LogDes-1768A872-F385-FDBA-D95E-0CB63F5908E2 at LOGDT10045" />
+			<mapping native_type="LONG RAW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="LONG ROW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="LONGROW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="NATIONAL CHAR" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NATIONAL CHAR VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NATIONAL CHARACTER" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NATIONAL CHARACTER VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NCHAR" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NCHAR VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NCLOB" logicaltype="NClob" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10035" />
+			<mapping native_type="NUMBER" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="NUMERIC" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="RAW" logicaltype="Raw" log_type_id="LogDes-4BABEC65-108B-2A3C-F7C4-84AC47D292B0 at LOGDT10040" />
+			<mapping native_type="REAL" logicaltype="REAL" log_type_id="LOGDT022" />
+			<mapping native_type="ROWID" logicaltype="ROWID" log_type_id="LOGDT032" />
+			<mapping native_type="SMALLINT" logicaltype="SMALLINT" log_type_id="LOGDT018" />
+			<mapping native_type="UROWID" logicaltype="URowID" log_type_id="LogDes-4BABEC65-108B-2A3C-F7C4-84AC47D292B0 at LOGDT10041" />
+			<mapping native_type="VARCHAR" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="VARCHAR2" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+		</mappings_for_RDBMS_type>
+		<mappings_for_RDBMS_type rdbms_type="Oracle9i">
+			<mapping native_type="BFILE" logicaltype="BFile" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10034" />
+			<mapping native_type="BLOB" logicaltype="BLOB" log_type_id="LOGDT029" />
+			<mapping native_type="CHAR" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHAR VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CHARACTER" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHARACTER VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CLOB" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="DATE" logicaltype="Date" log_type_id="LOGDT007" />
+			<mapping native_type="DBURITYPE" logicaltype="DBURIType" log_type_id="LOGDT054" />
+			<mapping native_type="DECIMAL" logicaltype="DECIMAL" log_type_id="LOGDT026" />
+			<mapping native_type="DOUBLE" logicaltype="DOUBLE" log_type_id="LOGDT020" />
+			<mapping native_type="FLOAT" logicaltype="FLOAT" log_type_id="LOGDT021" />
+			<mapping native_type="HTTPURITYPE" logicaltype="HTTPURIType" log_type_id="LOGDT052" />
+			<mapping native_type="INTEGER" logicaltype="Integer" log_type_id="LOGDT011" />
+			<mapping native_type="INTERVAL DAY TO SECOND" logicaltype="INTERVAL DAY TO SECOND" log_type_id="LOGDT049" />
+			<mapping native_type="INTERVAL YEAR TO MONTH" logicaltype="INTERVAL YEAR TO MONTH" log_type_id="LOGDT048" />
+			<mapping native_type="LONG" logicaltype="Long Char" log_type_id="LogDes-1768A872-F385-FDBA-D95E-0CB63F5908E2 at LOGDT10045" />
+			<mapping native_type="LONG RAW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="LONG ROW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="LONGROW" logicaltype="Long_Raw" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10036" />
+			<mapping native_type="NATIONAL CHAR" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NATIONAL CHAR VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NATIONAL CHARACTER" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NATIONAL CHARACTER VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NCHAR" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NCHAR VARYING" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="NCLOB" logicaltype="NClob" log_type_id="LogDes-7DD553FD-11E8-61FA-399D-2E531FB621D0 at LOGDT10035" />
+			<mapping native_type="NUMBER" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="NUMERIC" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="NVARCHAR2" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="ORDSYS.ORDAudio" logicaltype="ORDAUDIO" log_type_id="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10005" />
+			<mapping native_type="ORDSYS.ORDDoc" logicaltype="ORDDOC" log_type_id="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10009" />
+			<mapping native_type="ORDSYS.ORDImage" logicaltype="ORDIMAGE" log_type_id="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10006" />
+			<mapping native_type="ORDSYS.ORDImageSignature" logicaltype="ORDIMAGE_SIGNATURE" log_type_id="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10007" />
+			<mapping native_type="ORDSYS.ORDVideo" logicaltype="ORDVIDEO" log_type_id="LogDes-4972B6D2-6F93-8AE5-6E24-3599E65A7CFE at LOGDT10008" />
+			<mapping native_type="RAW" logicaltype="Raw" log_type_id="LogDes-4BABEC65-108B-2A3C-F7C4-84AC47D292B0 at LOGDT10040" />
+			<mapping native_type="REAL" logicaltype="REAL" log_type_id="LOGDT022" />
+			<mapping native_type="ROWID" logicaltype="ROWID" log_type_id="LOGDT032" />
+			<mapping native_type="SMALLINT" logicaltype="SMALLINT" log_type_id="LOGDT018" />
+			<mapping native_type="SYS.ANYDATA" logicaltype="SYS_ANYDATA" log_type_id="LogDes-F046B719-7D91-3873-3302-38C441683842 at LOGDT10010" />
+			<mapping native_type="SYS.ANYDATASET" logicaltype="SYS_ANYDATASET" log_type_id="LogDes-22E251EB-9F6C-8137-56B2-DD4B87DC1E33 at LOGDT10030" />
+			<mapping native_type="SYS.ANYTYPE" logicaltype="SYS_ANYTYPE" log_type_id="LogDes-F046B719-7D91-3873-3302-38C441683842 at LOGDT10011" />
+			<mapping native_type="TIMESTAMP" logicaltype="Timestamp" log_type_id="LOGDT015" />
+			<mapping native_type="TIMESTAMP WITH LOCAL TIME ZONE" logicaltype="TIMESTAMP WITH LOCAL TIME ZONE" log_type_id="LOGDT047" />
+			<mapping native_type="TIMESTAMP WITH TIME ZONE" logicaltype="TIMESTAMP WITH TIME ZONE" log_type_id="LOGDT046" />
+			<mapping native_type="URITYPE" logicaltype="URIType" log_type_id="LOGDT051" />
+			<mapping native_type="UROWID" logicaltype="URowID" log_type_id="LogDes-4BABEC65-108B-2A3C-F7C4-84AC47D292B0 at LOGDT10041" />
+			<mapping native_type="VARCHAR" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="VARCHAR2" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="XDBURITYPE" logicaltype="XDBURIType" log_type_id="LOGDT053" />
+			<mapping native_type="XMLTYPE" logicaltype="XMLType" log_type_id="LOGDT050" />
+		</mappings_for_RDBMS_type>
+		<mappings_for_RDBMS_type rdbms_type="SQL Server 2005">
+			<mapping native_type="DATE" logicaltype="Date" log_type_id="LOGDT007" />
+			<mapping native_type="DOUBLE" logicaltype="DOUBLE" log_type_id="LOGDT020" />
+			<mapping native_type="XML" logicaltype="XMLType" log_type_id="LOGDT050" />
+		</mappings_for_RDBMS_type>
+		<mappings_for_RDBMS_type rdbms_type="SQL Server 2000">
+			<mapping native_type="BIGINT" logicaltype="BIGINT" log_type_id="LOGDT027" />
+			<mapping native_type="BINARY" logicaltype="BINARY" log_type_id="LOGDT033" />
+			<mapping native_type="BIT" logicaltype="BIT" log_type_id="LOGDT034" />
+			<mapping native_type="CHAR" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="DATE" logicaltype="Date" log_type_id="LOGDT007" />
+			<mapping native_type="DATETIME" logicaltype="Datetime" log_type_id="LOGDT008" />
+			<mapping native_type="DECIMAL" logicaltype="DECIMAL" log_type_id="LOGDT026" />
+			<mapping native_type="DOUBLE" logicaltype="DOUBLE" log_type_id="LOGDT020" />
+			<mapping native_type="FLOAT" logicaltype="FLOAT" log_type_id="LOGDT021" />
+			<mapping native_type="IMAGE" logicaltype="Image" log_type_id="LOGDT010" />
+			<mapping native_type="INT" logicaltype="Integer" log_type_id="LOGDT011" />
+			<mapping native_type="INTEGER" logicaltype="Integer" log_type_id="LOGDT011" />
+			<mapping native_type="MONEY" logicaltype="MONEY" log_type_id="LOGDT043" />
+			<mapping native_type="NCHAR" logicaltype="NCHAR" log_type_id="LOGDT035" />
+			<mapping native_type="NTEXT" logicaltype="NTEXT" log_type_id="LOGDT036" />
+			<mapping native_type="NUMERIC" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="NVARCHAR" logicaltype="NVARCHAR" log_type_id="LOGDT037" />
+			<mapping native_type="REAL" logicaltype="REAL" log_type_id="LOGDT022" />
+			<mapping native_type="ROWID" logicaltype="ROWID" log_type_id="LOGDT032" />
+			<mapping native_type="SMALLDATETIME" logicaltype="SMALLDATETIME" log_type_id="LOGDT038" />
+			<mapping native_type="SMALLINT" logicaltype="SMALLINT" log_type_id="LOGDT018" />
+			<mapping native_type="SMALLMONEY" logicaltype="SMALLMONEY" log_type_id="LOGDT044" />
+			<mapping native_type="SQL_VARIANT" logicaltype="SQL_VARIANT" log_type_id="LOGDT045" />
+			<mapping native_type="SYSNAME" logicaltype="SYSNAME" log_type_id="LOGDT039" />
+			<mapping native_type="TEXT" logicaltype="TEXT" log_type_id="LOGDT040" />
+			<mapping native_type="TIMESTAMP" logicaltype="Timestamp" log_type_id="LOGDT015" />
+			<mapping native_type="TINYINT" logicaltype="TINYINT" log_type_id="LOGDT042" />
+			<mapping native_type="UNIQUEIDENTIFIER" logicaltype="UNIQUEIDENTIFIER" log_type_id="LOGDT057" />
+			<mapping native_type="VARBINARY" logicaltype="VARBINARY" log_type_id="LOGDT041" />
+			<mapping native_type="VARCHAR" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+		</mappings_for_RDBMS_type>
+		<mappings_for_RDBMS_type rdbms_type="DB2/390 8">
+			<mapping native_type="GRAPHIC" logicaltype="GRAPHIC" log_type_id="LOGDT031" />
+		</mappings_for_RDBMS_type>
+		<mappings_for_RDBMS_type rdbms_type="DB2/390 7">
+			<mapping native_type="BINARY LARGE OBJECT" logicaltype="BLOB" log_type_id="LOGDT029" />
+			<mapping native_type="BLOB" logicaltype="BLOB" log_type_id="LOGDT029" />
+			<mapping native_type="CHAR" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHAR LARGE OBJECT" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="CHAR VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CHARACTER" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHARACTER LARGE OBJECT" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="CHARACTER VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CLOB" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="DATE" logicaltype="Date" log_type_id="LOGDT007" />
+			<mapping native_type="DBCLOB" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="DECIMAL" logicaltype="DECIMAL" log_type_id="LOGDT026" />
+			<mapping native_type="DOUBLE" logicaltype="DOUBLE" log_type_id="LOGDT020" />
+			<mapping native_type="FLOAT" logicaltype="FLOAT" log_type_id="LOGDT021" />
+			<mapping native_type="GRAPHIC" logicaltype="GRAPHIC" log_type_id="LOGDT031" />
+			<mapping native_type="INTEGER" logicaltype="Integer" log_type_id="LOGDT011" />
+			<mapping native_type="LONG VARCHAR" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="LONG VARGRAPHIC" logicaltype="VARGRAPHIC" log_type_id="LOGDT023" />
+			<mapping native_type="NUMERIC" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="REAL" logicaltype="REAL" log_type_id="LOGDT022" />
+			<mapping native_type="ROWID" logicaltype="ROWID" log_type_id="LOGDT032" />
+			<mapping native_type="SMALLINT" logicaltype="SMALLINT" log_type_id="LOGDT018" />
+			<mapping native_type="TIME" logicaltype="Time" log_type_id="LOGDT014" />
+			<mapping native_type="TIMESTAMP" logicaltype="Timestamp" log_type_id="LOGDT015" />
+			<mapping native_type="VARCHAR" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="VARGRAPHIC" logicaltype="VARGRAPHIC" log_type_id="LOGDT023" />
+		</mappings_for_RDBMS_type>
+		<mappings_for_RDBMS_type rdbms_type="DB2/UDB 8.1">
+			<mapping native_type="GRAPHIC" logicaltype="GRAPHIC" log_type_id="LOGDT031" />
+			<mapping native_type="XML" logicaltype="XMLType" log_type_id="LOGDT050" />
+		</mappings_for_RDBMS_type>
+		<mappings_for_RDBMS_type rdbms_type="DB2/UDB 7.1">
+			<mapping native_type="BIGINT" logicaltype="BIGINT" log_type_id="LOGDT027" />
+			<mapping native_type="BLOB" logicaltype="BLOB" log_type_id="LOGDT029" />
+			<mapping native_type="CHAR" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHAR VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CHARACTER" logicaltype="CHAR" log_type_id="LOGDT025" />
+			<mapping native_type="CHARACTER VARYING" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="CLOB" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="DATALINK" logicaltype="DATALINK" log_type_id="LOGDT030" />
+			<mapping native_type="DATE" logicaltype="Date" log_type_id="LOGDT007" />
+			<mapping native_type="DBCLOB" logicaltype="CLOB" log_type_id="LOGDT028" />
+			<mapping native_type="DECIMAL" logicaltype="DECIMAL" log_type_id="LOGDT026" />
+			<mapping native_type="DOUBLE" logicaltype="DOUBLE" log_type_id="LOGDT020" />
+			<mapping native_type="FLOAT" logicaltype="FLOAT" log_type_id="LOGDT021" />
+			<mapping native_type="GRAPHIC" logicaltype="GRAPHIC" log_type_id="LOGDT031" />
+			<mapping native_type="INTEGER" logicaltype="Integer" log_type_id="LOGDT011" />
+			<mapping native_type="LONG VARCHAR" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="LONG VARGRAPHIC" logicaltype="VARGRAPHIC" log_type_id="LOGDT023" />
+			<mapping native_type="NUMERIC" logicaltype="NUMERIC" log_type_id="LOGDT019" />
+			<mapping native_type="REAL" logicaltype="REAL" log_type_id="LOGDT022" />
+			<mapping native_type="SMALLINT" logicaltype="SMALLINT" log_type_id="LOGDT018" />
+			<mapping native_type="TIME" logicaltype="Time" log_type_id="LOGDT014" />
+			<mapping native_type="TIMESTAMP" logicaltype="Timestamp" log_type_id="LOGDT015" />
+			<mapping native_type="VARCHAR" logicaltype="VARCHAR" log_type_id="LOGDT024" />
+			<mapping native_type="VARGRAPHIC" logicaltype="VARGRAPHIC" log_type_id="LOGDT023" />
+		</mappings_for_RDBMS_type>
+	</native_to_logical_mappings>
+	<ud_native_db_types />
+</logtypes>
\ No newline at end of file
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseComments.pgsql b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseComments.pgsql
new file mode 100644
index 0000000..d20aa22
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseComments.pgsql
@@ -0,0 +1,1234 @@
+COMMENT ON COLUMN SystemLog.tsCreated IS
+  'When this was logged.';
+
+
+COMMENT ON COLUMN SystemLog.sEvent IS
+  'The event type.
+This is a 8 character string identifier so that we don''t need to change
+some enum type everytime we introduce a new event type.';
+
+
+COMMENT ON COLUMN SystemLog.sLogText IS
+  'The log text.';
+
+
+COMMENT ON TABLE Users IS
+  'Test manager users.
+
+This is mainly for doing simple access checks before permitting access to
+the test manager.  This needs to be coordinated with
+apache/ldap/Oracle-Single-Sign-On.
+
+The main purpose, though, is for tracing who changed the test config and
+analysis data.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.';
+
+
+COMMENT ON COLUMN Users.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN Users.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN Users.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN Users.sUsername IS
+  'User name.';
+
+
+COMMENT ON COLUMN Users.sEmail IS
+  'The email address of the user.';
+
+
+COMMENT ON COLUMN Users.sFullName IS
+  'The full name.';
+
+
+COMMENT ON COLUMN Users.sLoginName IS
+  'The login name used by apache.';
+
+
+COMMENT ON TABLE GlobalResources IS
+  'Global resource configuration.
+
+For example an iSCSI target.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.';
+
+
+COMMENT ON COLUMN GlobalResources.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN GlobalResources.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN GlobalResources.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN GlobalResources.sName IS
+  'The name of the resource.';
+
+
+COMMENT ON COLUMN GlobalResources.sDescription IS
+  'Optional resource description.';
+
+
+COMMENT ON COLUMN GlobalResources.fEnabled IS
+  'Indicates whether this resource is currently enabled (online).';
+
+
+COMMENT ON TABLE BuildSources IS
+  'Build sources.
+
+This is used by a scheduling group to select builds and the default
+Validation Kit from the Builds table.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.
+
+ at todo Any better way of representing this so we could more easily
+      join/whatever when searching for builds?';
+
+
+COMMENT ON COLUMN BuildSources.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN BuildSources.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN BuildSources.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN BuildSources.sName IS
+  'The name of the build source.';
+
+
+COMMENT ON COLUMN BuildSources.sDescription IS
+  'Description.';
+
+
+COMMENT ON COLUMN BuildSources.sProduct IS
+  'Which product.
+ASSUME that it is okay to limit a build source to a single product.';
+
+
+COMMENT ON COLUMN BuildSources.sBranch IS
+  'Which branch.
+ASSUME that it is okay to limit a build source to a branch.';
+
+
+COMMENT ON COLUMN BuildSources.asTypes IS
+  'Build types to include, all matches if NULL.
+ at todo Weighting the types would be nice in a later version.';
+
+
+COMMENT ON COLUMN BuildSources.asOsArches IS
+  'Array of the ''sOs.sCpuArch'' to match, all matches if NULL.
+See KBUILD_OSES in kBuild for a list of standard target OSes, and
+KBUILD_ARCHES for a list of standard architectures.
+
+ at remarks See marks on ''os-agnostic'' and ''noarch'' in BuildCategories.';
+
+
+COMMENT ON COLUMN BuildSources.iFirstRevision IS
+  'The first subversion tree revision to match, no lower limit if NULL.';
+
+
+COMMENT ON COLUMN BuildSources.iLastRevision IS
+  'The last subversion tree revision to match, no upper limit if NULL.';
+
+
+COMMENT ON TABLE TestCases IS
+  'Test case configuration.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.';
+
+
+COMMENT ON COLUMN TestCases.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN TestCases.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN TestCases.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN TestCases.sName IS
+  'The name of the test case.';
+
+
+COMMENT ON COLUMN TestCases.sDescription IS
+  'Optional test case description.';
+
+
+COMMENT ON COLUMN TestCases.fEnabled IS
+  'Indicates whether this test case is currently enabled.';
+
+
+COMMENT ON COLUMN TestCases.cSecTimeout IS
+  'Default test case timeout given in seconds.';
+
+
+COMMENT ON COLUMN TestCases.sTestBoxReqExpr IS
+  'Default TestBox requirement expression (python boolean expression).
+All the scheduler properties are available for use with the same names
+as in that table.
+If NULL everything matches.';
+
+
+COMMENT ON COLUMN TestCases.sBuildReqExpr IS
+  'Default build requirement expression (python boolean expression).
+The following build properties are available: sProduct, sBranch,
+sType, asOsArches, sVersion, iRevision, uidAuthor and idBuild.
+If NULL everything matches.';
+
+
+COMMENT ON COLUMN TestCases.sBaseCmd IS
+  'The base command.
+String suitable for executing in bourne shell with space as separator
+(IFS). References to @BUILD_BINARIES@ will be replaced WITH the content
+of the Builds(sBinaries) field.';
+
+
+COMMENT ON COLUMN TestCases.sTestSuiteZips IS
+  'Comma separated list of test suite zips (or tars) that the testbox will
+need to download and expand prior to testing.
+If NULL the current test suite of the scheduling group will be used (the
+scheduling group will have an optional test suite build queue associated
+with it).  The current test suite can also be referenced by
+ at VALIDATIONKIT_ZIP@ in case more downloads are required.  Files may also be
+uploaded to the test manager download area, in which case the
+ at DOWNLOAD_BASE_URL@ prefix can be used to refer to this area.';
+
+
+COMMENT ON TABLE TestCaseArgs IS
+  'Test case argument list variations.
+
+For example, we have a test case that does a set of tests on a virtual
+machine.  To get better code/feature coverage of this testcase we wish to
+run it with different guest hardware configuration.  The test case may do
+the same stuff, but the guest OS as well as the VMM may react differently to
+the hardware configurations and uncover issues in the VMM, device emulation
+or other places.
+
+Typical hardware variations are:
+     - guest memory size (RAM),
+     - guest video memory size (VRAM),
+     - virtual CPUs / cores / threads,
+     - virtual chipset
+     - virtual network interface card (NIC)
+     - USB 1.1, USB 2.0, no USB
+
+The TM web UI will help the user create a reasonable set of permutations
+of these parameters, the user specifies a maximum and the TM uses certain
+rules together with random selection to generate the desired number.  The
+UI will also help suggest fitting testbox requirements according to the
+RAM/VRAM sizes and the virtual CPU counts.  The user may then make
+adjustments to the suggestions before commit them.
+
+Alternatively, the user may also enter all the permutations without any
+help from the UI.
+
+Note! All test cases has at least one entry in this table, even if it is
+empty, because testbox requirements are specified thru this.
+
+Querying the valid parameter lists for a testase this way:
+     SELECT * ... WHERE idTestCase = TestCases.idTestCase
+                    AND tsExpire     > <when>
+                    AND tsEffective <= <when>;
+
+Querying the valid parameter list for the latest generation can be
+simplified by just checking tsExpire date:
+     SELECT * ... WHERE idTestCase = TestCases.idTestCase
+                    AND tsExpire    == TIMESTAMP WITH TIME ZONE ''infinity'';
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.';
+
+
+COMMENT ON COLUMN TestCaseArgs.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN TestCaseArgs.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN TestCaseArgs.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN TestCaseArgs.sArgs IS
+  'The additional arguments.
+String suitable for bourne shell style argument parsing with space as
+separator (IFS).  References to @BUILD_BINARIES@ will be replaced with
+the content of the Builds(sBinaries) field.';
+
+
+COMMENT ON COLUMN TestCaseArgs.cSecTimeout IS
+  'Optional test case timeout given in seconds.
+If NULL, the TestCases.cSecTimeout field is used instead.';
+
+
+COMMENT ON COLUMN TestCaseArgs.sTestBoxReqExpr IS
+  'Additional TestBox requirement expression (python boolean expression).
+All the scheduler properties are available for use with the same names
+as in that table.  This is checked after first checking the requirements
+in the TestCases.sTestBoxReqExpr field.';
+
+
+COMMENT ON COLUMN TestCaseArgs.sBuildReqExpr IS
+  'Additional build requirement expression (python boolean expression).
+The following build properties are available: sProduct, sBranch,
+sType, asOsArches, sVersion, iRevision, uidAuthor and idBuild. This is
+checked after first checking the requirements in the
+TestCases.sBuildReqExpr field.';
+
+
+COMMENT ON COLUMN TestCaseArgs.cGangMembers IS
+  'Number of testboxes required (gang scheduling).';
+
+
+COMMENT ON INDEX TestCaseArgsLookupIdx IS
+  'The arguments are part of the primary key for several reasons.
+No duplicate argument lists (makes no sense - if you want to prioritize
+argument lists, we add that explicitly).  This may hopefully enable us
+to more easily check coverage later on, even when the test case is
+reconfigured with more/less permutations.';
+
+
+COMMENT ON TABLE TestCaseDeps IS
+  'Test case dependencies (N:M)
+
+This effect build selection.  The build must have passed all runs of the
+given prerequisite testcase (idTestCasePreReq) and executed at a minimum one
+argument list variation.
+
+This should also affect scheduling order, if possible at least one
+prerequisite testcase variation should be place before the specific testcase
+in the scheduling queue.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN TestCaseDeps.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN TestCaseDeps.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN TestCaseDeps.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON TABLE TestCaseGlobalRsrcDeps IS
+  'Test case dependencies on global resources (N:M)
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN TestCaseGlobalRsrcDeps.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN TestCaseGlobalRsrcDeps.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN TestCaseGlobalRsrcDeps.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON TABLE TestGroups IS
+  'Test Group - A collection of test cases.
+
+This is for simplifying test configuration by working with a few groups
+instead of a herd of individual testcases.  It may also be used for creating
+test suites for certain areas (like guest additions) or tasks (like
+performance measurements).
+
+A test case can be member of any number of test groups.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN TestGroups.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN TestGroups.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN TestGroups.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN TestGroups.sName IS
+  'The name of the scheduling group.';
+
+
+COMMENT ON COLUMN TestGroups.sDescription IS
+  'Optional group description.';
+
+
+COMMENT ON TABLE TestGroupMembers IS
+  'The N:M relation ship between test case configurations and test groups.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN TestGroupMembers.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN TestGroupMembers.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN TestGroupMembers.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN TestGroupMembers.iSchedPriority IS
+  'Test case scheduling priority.
+Higher number causes the test case to be run more frequently.
+ at sa SchedGroupMembers.iSchedPriority
+ at todo Not sure we want to keep this...';
+
+
+COMMENT ON TABLE SchedGroups IS
+  'Scheduling group (aka. testbox partitioning) configuration.
+
+A testbox is associated with exactly one scheduling group.  This association
+can be changed, of course.  If we (want to) retire a group which still has
+testboxes associated with it, these will be moved to the ''default'' group.
+
+The TM web UI will make sure that a testbox is always in a group and that
+the default group cannot be deleted.
+
+A scheduling group combines several things:
+     - A selection of builds to test (via idBuildSrc).
+     - A collection of test groups to test with (via SchedGroupMembers).
+     - A set of testboxes to test on (via TestBoxes.idSchedGroup).
+
+In additions there is an optional source of fresh test suite builds (think
+VBoxTestSuite) as well as scheduling options.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN SchedGroups.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN SchedGroups.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN SchedGroups.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)
+ at note This is NULL for the default group.';
+
+
+COMMENT ON COLUMN SchedGroups.sName IS
+  'The name of the scheduling group.';
+
+
+COMMENT ON COLUMN SchedGroups.sDescription IS
+  'Optional group description.';
+
+
+COMMENT ON COLUMN SchedGroups.fEnabled IS
+  'Indicates whether this group is currently enabled.';
+
+
+COMMENT ON COLUMN SchedGroups.enmScheduler IS
+  'The scheduler to use.
+This is for when we later desire different scheduling that the best
+effort stuff provided by the initial implementation.';
+
+
+COMMENT ON TABLE SchedGroupMembers IS
+  'N:M relationship between scheduling groups and test groups.
+
+Several scheduling parameters are associated with this relationship.
+
+The test group dependency (idTestGroupPreReq) can be used in the same way as
+TestCaseDeps.idTestCasePreReq, only here on test group level.  This means it
+affects the build selection.  The builds needs to have passed all test runs
+the prerequisite test group and done at least one argument variation of each
+test case in it.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN SchedGroupMembers.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN SchedGroupMembers.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN SchedGroupMembers.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN SchedGroupMembers.iSchedPriority IS
+  'The scheduling priority if the test group.
+Higher number causes the test case to be run more frequently.
+ at sa TestGroupMembers.iSchedPriority';
+
+
+COMMENT ON COLUMN SchedGroupMembers.bmHourlySchedule IS
+  'When during the week this group is allowed to start running, NULL means
+there are no constraints.
+Each bit in the bitstring represents one hour, with bit 0 indicating the
+midnight hour on a monday.';
+
+
+COMMENT ON TYPE TestBoxCmd_T IS
+  'Testbox commands.';
+
+
+COMMENT ON TYPE LomKind_T IS
+  'The kind of lights out management on a testbox.';
+
+
+COMMENT ON TABLE TestBoxes IS
+  'Testbox configurations.
+
+The testboxes are identified by IP and the system UUID if available. Should
+the IP change, the testbox will be refused at sign on and the testbox
+sheriff will have to update it''s IP.
+
+ at todo Implement the UUID stuff. Get it from DMI, UEFI or whereever.
+      Mismatching needs to be logged somewhere...
+
+To query the currently valid configuration:
+    SELECT ... WHERE id = idTestBox AND tsExpire = TIMESTAMP WITH TIME ZONE ''infinity'';
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN TestBoxes.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN TestBoxes.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN TestBoxes.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+When modified automatically by the testbox, NULL is used.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN TestBoxes.uuidSystem IS
+  'The system or firmware UUID.
+This uniquely identifies the testbox when talking to the server.  After
+SIGNON though, the testbox will also provide idTestBox and ip to
+establish its identity beyond doubt.';
+
+
+COMMENT ON COLUMN TestBoxes.sName IS
+  'The testbox name.
+Usually similar to the DNS name.';
+
+
+COMMENT ON COLUMN TestBoxes.sDescription IS
+  'Optional testbox description.
+Intended for describing the box as well as making other relevant notes.';
+
+
+COMMENT ON COLUMN TestBoxes.fEnabled IS
+  'Indicates whether this testbox is enabled.
+A testbox gets disabled when we''re doing maintenance, debugging a issue
+that happens only on that testbox, or some similar stuff.  This is an
+alternative to deleting the testbox.';
+
+
+COMMENT ON COLUMN TestBoxes.enmLomKind IS
+  'The kind of lights-out-management.';
+
+
+COMMENT ON COLUMN TestBoxes.sOs IS
+  'Same abbrieviations as kBuild, see KBUILD_OSES.';
+
+
+COMMENT ON COLUMN TestBoxes.sOsVersion IS
+  'Informational, no fixed format.';
+
+
+COMMENT ON COLUMN TestBoxes.sCpuVendor IS
+  'Same as CPUID reports (GenuineIntel, AuthenticAMD, CentaurHauls, ...).';
+
+
+COMMENT ON COLUMN TestBoxes.sCpuArch IS
+  'Same as kBuild - x86, amd64, ... See KBUILD_ARCHES.';
+
+
+COMMENT ON COLUMN TestBoxes.cCpus IS
+  'Number of CPUs, CPU cores and CPU threads.';
+
+
+COMMENT ON COLUMN TestBoxes.fCpuHwVirt IS
+  'Set if capable of hardware virtualization.';
+
+
+COMMENT ON COLUMN TestBoxes.fCpuNestedPaging IS
+  'Set if capable of nested paging.';
+
+
+COMMENT ON COLUMN TestBoxes.fCpu64BitGuest IS
+  'Set if CPU capable of 64-bit (VBox) guests.';
+
+
+COMMENT ON COLUMN TestBoxes.fChipsetIoMmu IS
+  'Set if chipset with usable IOMMU (VT-d / AMD-Vi).';
+
+
+COMMENT ON COLUMN TestBoxes.cMbMemory IS
+  'The (approximate) memory size in megabytes (rounded down to nearest 4 MB).';
+
+
+COMMENT ON COLUMN TestBoxes.cMbScratch IS
+  'The amount of scratch space in megabytes (rounded down to nearest 64 MB).';
+
+
+COMMENT ON COLUMN TestBoxes.iTestBoxScriptRev IS
+  'The testbox script revision number, serves the purpose of a version number.
+Probably good to have when scheduling upgrades as well for status purposes.';
+
+
+COMMENT ON COLUMN TestBoxes.iPythonHexVersion IS
+  'The python sys.hexversion (layed out as of 2.7).
+Good to know which python versions we need to support.';
+
+
+COMMENT ON COLUMN TestBoxes.enmPendingCmd IS
+  'Pending command.
+ at note We put it here instead of in TestBoxStatuses to get history.';
+
+
+COMMENT ON INDEX TestBoxesUuidIdx IS
+  'Nested paging requires hardware virtualization.';
+
+
+COMMENT ON TABLE FailureCategories IS
+  'Failure categories.
+
+This is for organizing the failure reasons.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN FailureCategories.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN FailureCategories.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN FailureCategories.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN FailureCategories.sShort IS
+  'The short category description.
+For combo boxes and other selection lists.';
+
+
+COMMENT ON COLUMN FailureCategories.sFull IS
+  'Full description
+For cursor-over-poppups for instance.';
+
+
+COMMENT ON TABLE FailureReasons IS
+  'Failure reasons.
+
+When analysing a test failure, the testbox sheriff will try assign a fitting
+reason for the failure.  This table is here to help the sheriff in his/hers
+job as well as developers looking checking if their changes affected the
+test results in any way.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN FailureReasons.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN FailureReasons.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN FailureReasons.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN FailureReasons.sShort IS
+  'The short failure description.
+For combo boxes and other selection lists.';
+
+
+COMMENT ON COLUMN FailureReasons.sFull IS
+  'Full failure description.';
+
+
+COMMENT ON COLUMN FailureReasons.iTicket IS
+  'Ticket number in the primary bugtracker.';
+
+
+COMMENT ON COLUMN FailureReasons.asUrls IS
+  'Other URLs to reports or discussions of the observed symptoms.';
+
+
+COMMENT ON TABLE TestResultFailures IS
+  'This is for tracking/discussing test result failures.
+
+The rational for putting this is a separate table is that we need history on
+this while TestResults does not.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN TestResultFailures.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN TestResultFailures.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN TestResultFailures.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN TestResultFailures.sComment IS
+  'Optional comment.';
+
+
+COMMENT ON TABLE BuildBlacklist IS
+  'Table used to blacklist sets of builds.
+
+The best usage example is a VMM developer realizing that a change causes the
+host to panic, hang, or otherwise misbehave.  To prevent the testbox sheriff
+from repeatedly having to reboot testboxes, the builds gets blacklisted
+until there is a working build again.  This may mean adding an open ended
+blacklist spec and then updating it with the final revision number once the
+fix has been committed.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.
+
+ at todo Would be nice if we could replace the text strings below with a set of
+      BuildCategories, or sore it in any other way which would enable us to
+      do a negative join with build category...  The way it is specified
+      now, it looks like we have to open a cursor of prospecitve builds and
+      filter then thru this table one by one.
+
+      Any better representation is welcome, but this is low prioirty for
+      now, as it''s relatively easy to change this later one.';
+
+
+COMMENT ON COLUMN BuildBlacklist.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN BuildBlacklist.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN BuildBlacklist.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)';
+
+
+COMMENT ON COLUMN BuildBlacklist.sProduct IS
+  'Which product.
+ASSUME that it is okay to limit a blacklisting to a single product.';
+
+
+COMMENT ON COLUMN BuildBlacklist.sBranch IS
+  'Which branch.
+ASSUME that it is okay to limit a blacklisting to a branch.';
+
+
+COMMENT ON COLUMN BuildBlacklist.asTypes IS
+  'Build types to include, all matches if NULL.';
+
+
+COMMENT ON COLUMN BuildBlacklist.asOsArches IS
+  'Array of the ''sOs.sCpuArch'' to match, all matches if NULL.
+See KBUILD_OSES in kBuild for a list of standard target OSes, and
+KBUILD_ARCHES for a list of standard architectures.
+
+ at remarks See marks on ''os-agnostic'' and ''noarch'' in BuildCategories.';
+
+
+COMMENT ON COLUMN BuildBlacklist.iFirstRevision IS
+  'The first subversion tree revision to blacklist.';
+
+
+COMMENT ON COLUMN BuildBlacklist.iLastRevision IS
+  'The last subversion tree revision to blacklist, no upper limit if NULL.';
+
+
+COMMENT ON TABLE BuildCategories IS
+  'Build categories.
+
+The purpose of this table is saving space in the Builds table and hopefully
+speed things up when selecting builds as well (compared to selecting on 4
+text fields in the much larger Builds table).
+
+Insert only table, no update, no delete.  History is not needed.';
+
+
+COMMENT ON COLUMN BuildCategories.sProduct IS
+  'Product.
+The product name.  For instance ''VBox'' or ''VBoxTestSuite''.';
+
+
+COMMENT ON COLUMN BuildCategories.sBranch IS
+  'The branch name.';
+
+
+COMMENT ON COLUMN BuildCategories.sType IS
+  'The build type.
+See KBUILD_BLD_TYPES in kBuild for a list of standard build types.';
+
+
+COMMENT ON COLUMN BuildCategories.asOsArches IS
+  'Array of the ''sOs.sCpuArch'' supported by the build.
+See KBUILD_OSES in kBuild for a list of standard target OSes, and
+KBUILD_ARCHES for a list of standard architectures.
+
+ at remarks ''os-agnostic'' is used if the build doesn''t really target any
+         specific OS or if it targets all applicable OSes.
+         ''noarch'' is used if the build is architecture independent or if
+         all applicable architectures are handled.
+         Thus, ''os-agnostic.noarch'' will run on all build boxes.
+
+ at note    The array shall be sorted ascendingly to prevent unnecessary duplicates!';
+
+
+COMMENT ON TABLE Builds IS
+  'The builds table contains builds from the tinderboxes and oaccasionally from
+developers.
+
+The tinderbox side could be fed by a batch job enumerating the build output
+directories every so often, looking for new builds.  Or we could query them
+from the tinderbox database.  Yet another alternative is making the
+tinderbox server or client side software inform us about all new builds.
+
+The developer builds are entered manually thru the TM web UI.  They are used
+for subjecting new code to some larger scale testing before commiting,
+enabling, or merging a private branch.
+
+The builds are being selected from this table by the via the build source
+specification that SchedGroups.idBuildSrc and
+SchedGroups.idBuildSrcTestSuite links to.
+
+ at remarks This table stores history.  Never update or delete anything.  The
+         equivalent of deleting is done by setting the ''tsExpire'' field to
+         current_timestamp.  To select the currently valid entries use
+         tsExpire = TIMESTAMP WITH TIME ZONE ''infinity''.';
+
+
+COMMENT ON COLUMN Builds.tsCreated IS
+  'When this build was created or entered into the database.
+This remains unchanged';
+
+
+COMMENT ON COLUMN Builds.tsEffective IS
+  'When this row starts taking effect (inclusive).';
+
+
+COMMENT ON COLUMN Builds.tsExpire IS
+  'When this row stops being tsEffective (exclusive).';
+
+
+COMMENT ON COLUMN Builds.uidAuthor IS
+  'The user id of the one who created/modified this entry.
+Non-unique foreign key: Users(uid)
+ at note This is NULL if added by a batch job / tinderbox.';
+
+
+COMMENT ON COLUMN Builds.iRevision IS
+  'The subversion tree revision of the build.';
+
+
+COMMENT ON COLUMN Builds.sVersion IS
+  'The product version number (suitable for RTStrVersionCompare).';
+
+
+COMMENT ON COLUMN Builds.sLogUrl IS
+  'The link to the tinderbox log of this build.';
+
+
+COMMENT ON COLUMN Builds.sBinaries IS
+  'Comma separated list of binaries.
+The binaries have paths relative to the TESTBOX_PATH_BUILDS or full URLs.';
+
+
+COMMENT ON COLUMN Builds.fBinariesDeleted IS
+  'Set when the binaries gets deleted by the build quota script.';
+
+
+COMMENT ON TABLE TestResultStrTab IS
+  'String table for the test results.
+
+This is a string cache for value names, test names and possible more, that
+is frequently repated in the test results record for each test run.  The
+purpose is not only to save space, but to make datamining queries faster by
+giving them integer fields to work on instead of text fields.  There may
+possibly be some benefits on INSERT as well as there are only integer
+indexes.
+
+Nothing is ever deleted from this table.
+
+ at note Should use a stored procedure to query/insert a string.';
+
+
+COMMENT ON COLUMN TestResultStrTab.sValue IS
+  'The string value.';
+
+
+COMMENT ON COLUMN TestResultStrTab.tsCreated IS
+  'Creation time stamp.';
+
+
+COMMENT ON TYPE TestStatus_T IS
+  'The status of a test (set / result).';
+
+
+COMMENT ON TABLE TestResults IS
+  'Test results - a recursive bundle of joy!
+
+A test case will be created when the testdriver calls reporter.testStart and
+concluded with reporter.testDone.  The testdriver (or it subordinates) can
+use these methods to create nested test results.  For IPRT based test cases,
+RTTestCreate, RTTestInitAndCreate and RTTestSub will both create new test
+result records, where as RTTestSubDone, RTTestSummaryAndDestroy and
+RTTestDestroy will conclude records.
+
+By concluding is meant updating the status.  When the test driver reports
+success, we check it against reported results. (paranoia strikes again!)
+
+Nothing is ever deleted from this table.
+
+ at note    As seen below, several other tables associate data with a
+         test result, and the top most test result is referenced by the
+         test set.';
+
+
+COMMENT ON COLUMN TestResults.tsCreated IS
+  'Creation time stamp.  This may also be the timestamp of when the test started.';
+
+
+COMMENT ON COLUMN TestResults.tsElapsed IS
+  'The elapsed time for this test.
+This is either reported by the directly (with some sanity checking) or
+calculated (current_timestamp - created_ts).
+ at todo maybe use a nanosecond field here, check with what';
+
+
+COMMENT ON COLUMN TestResults.cErrors IS
+  'The error count.';
+
+
+COMMENT ON COLUMN TestResults.enmStatus IS
+  'The test status.';
+
+
+COMMENT ON COLUMN TestResults.iNestingDepth IS
+  'Nesting depth.';
+
+
+COMMENT ON TABLE TestResultValues IS
+  'Test result values.
+
+A testdriver or subordinate may report a test value via
+reporter.testValue(), while IPRT based test will use RTTestValue and
+associates.
+
+This is an insert only table, no deletes, no updates.';
+
+
+COMMENT ON COLUMN TestResultValues.tsCreated IS
+  'Creation time stamp.';
+
+
+COMMENT ON COLUMN TestResultValues.lValue IS
+  'The value.';
+
+
+COMMENT ON COLUMN TestResultValues.iUnit IS
+  'The unit.
+ at todo This is currently not defined properly. Will fix/correlate this
+      with the other places we use unit (IPRT/testdriver/VMMDev).';
+
+
+COMMENT ON TABLE TestResultFiles IS
+  'Test result files.
+
+A testdriver or subordinate may report a file by using
+reporter.addFile() or reporter.addLogFile().
+
+The files stored here as well as the primary log file will be processed by a
+batch job and compressed if considered compressable.  Thus, TM will look for
+files with a .gz/.bz2 suffix first and then without a suffix.
+
+This is an insert only table, no deletes, no updates.';
+
+
+COMMENT ON COLUMN TestResultFiles.tsCreated IS
+  'Creation time stamp.';
+
+
+COMMENT ON INDEX TestResultFilesIdx IS
+  'The mime type for the file.
+For instance: ''text/plain'',
+              ''image/png'',
+              ''video/webm'',
+              ''text/xml''';
+
+
+COMMENT ON TABLE TestResultMsgs IS
+  'Test result message.
+
+A testdriver or subordinate may report a message via the sDetails parameter
+of the reporter.testFailure() method, while IPRT test cases will use
+RTTestFailed, RTTestPrintf and their friends.  For RTTestPrintf, we will
+ignore the more verbose message levels since these can also be found in one
+of the logs.
+
+This is an insert only table, no deletes, no updates.';
+
+
+COMMENT ON COLUMN TestResultMsgs.tsCreated IS
+  'Creation time stamp.';
+
+
+COMMENT ON COLUMN TestResultMsgs.enmLevel IS
+  'The message level.';
+
+
+COMMENT ON TABLE TestSets IS
+  'Test sets / Test case runs.
+
+This is where we collect data about test runs.
+
+ at todo Not entirely sure where the ''test set'' term came from.  Consider
+      finding something more appropriate.';
+
+
+COMMENT ON COLUMN TestSets.tsConfig IS
+  'The test config timestamp, used when reading test config.';
+
+
+COMMENT ON COLUMN TestSets.tsCreated IS
+  'When this test set was scheduled.
+idGenTestBox is valid at this point.';
+
+
+COMMENT ON COLUMN TestSets.tsDone IS
+  'When this test completed, i.e. testing stopped.  This should only be set once.';
+
+
+COMMENT ON COLUMN TestSets.enmStatus IS
+  'The current status.';
+
+
+COMMENT ON COLUMN TestSets.sBaseFilename IS
+  'The base filename used for storing files related to this test set.
+This is a path relative to wherever TM is dumping log files.  In order
+to not become a file system test case, we will try not to put too many
+hundred thousand files in a directory.  A simple first approach would
+be to just use the current date (tsCreated) like this:
+   TM_FILE_DIR/year/month/day/TestSets.idTestSet
+
+The primary log file for the test is this name suffixed by ''.log''.
+
+The files in the testresultfile table gets their full names like this:
+   TM_FILE_DIR/sBaseFilename-testresultfile.id-TestResultStrTab(testresultfile.idStrFilename)
+
+ at remarks We store this explicitly in case we change the directly layout
+         at some later point.';
+
+
+COMMENT ON COLUMN TestSets.iGangMemberNo IS
+  'The gang member number number, 0 is the leader.';
+
+
+COMMENT ON INDEX TestSetsGangIdx IS
+  'The test set of the gang leader, NULL if no gang involved.
+ at note This is set by the gang leader as well, so that we can find all
+      gang members by WHERE idTestSetGangLeader = :id.';
+
+
+COMMENT ON TYPE TestBoxState_T IS
+  'TestBox state.
+
+ at todo Consider drawing a state diagram for this.';
+
+
+COMMENT ON TABLE TestBoxStatuses IS
+  'Testbox status table.
+
+History is not planned on this table.';
+
+
+COMMENT ON COLUMN TestBoxStatuses.tsUpdated IS
+  'When this status was last updated.
+This is updated everytime the testbox talks to the test manager, thus it
+can easily be used to find testboxes which has stopped responding.
+
+This is used for timeout calculation during gang-gathering, so in that
+scenario it won''t be updated until the gang is gathered or we time out.';
+
+
+COMMENT ON COLUMN TestBoxStatuses.enmState IS
+  'The current state.';
+
+
+COMMENT ON TABLE GlobalResourceStatuses IS
+  'Global resource status, tracks which test set resources are allocated by.
+
+History is not planned on this table.';
+
+
+COMMENT ON COLUMN GlobalResourceStatuses.tsAllocated IS
+  'When the allocation took place.';
+
+
+COMMENT ON TABLE SchedQueues IS
+  'Scheduler queue.
+
+The queues are currently associated with a scheduling group, it could
+alternative be changed to hook on to a testbox instead.  It depends on what
+kind of scheduling method we prefer.  The former method aims at test case
+thruput, making sacrifices in the hardware distribution area.  The latter is
+more like the old buildbox style testing, making sure that each test case is
+executed on each testbox.
+
+When there are configuration changes, TM will regenerate the scheduling
+queue for the affected scheduling groups.  We do not concern ourselves with
+trying to continue at the approximately same queue position, we simply take
+it from the top.
+
+When a testbox ask for work, we will open a cursor on the queue and take the
+first test in the queue that can be executed on that testbox.  The test will
+be moved to the end of the queue (getting a new item_id).
+
+If a test is manually changed to the head of the queue, the item will get a
+item_id which is 1 lower than the head of the queue.  Unless someone does
+this a couple of billion times, we shouldn''t have any trouble running out of
+number space. :-)
+
+Manually moving a test to the end of the queue is easy, just get a new
+''item_id''.
+
+History is not planned on this table.';
+
+
+COMMENT ON COLUMN SchedQueues.bmHourlySchedule IS
+  'The scheduling time constraints (see SchedGroupMembers.bmHourlySchedule).';
+
+
+COMMENT ON COLUMN SchedQueues.tsConfig IS
+  'When the queue entry was created and for which config is valid.
+This is the timestamp that should be used when reading config info.';
+
+
+COMMENT ON COLUMN SchedQueues.tsLastScheduled IS
+  'When this status was last scheduled.
+This is set to current_timestamp when moving the entry to the end of the
+queue.  It''s initial value is unix-epoch.  Not entirely sure if it''s
+useful beyond introspection and non-unique foreign key hacking.';
+
+
+COMMENT ON COLUMN SchedQueues.cMissingGangMembers IS
+  'The number of gang members still missing.
+
+This saves calculating the number of missing members via selects like:
+    SELECT COUNT(*) FROM TestSets WHERE idTestSetGangLeader = :idGang;
+and
+    SELECT cGangMembers FROM TestCaseArgs WHERE idGenTestCaseArgs = :idTest;
+to figure out whether to remain in ''gather-gang''::TestBoxState_T.';
+
+
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseDefaultUserAccounts.pgsql b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseDefaultUserAccounts.pgsql
new file mode 100644
index 0000000..429e958
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseDefaultUserAccounts.pgsql
@@ -0,0 +1,33 @@
+-- $Id: TestManagerDatabaseDefaultUserAccounts.pgsql $
+--- @file
+-- VBox Test Manager default user account records creation script.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+\set ON_ERROR_STOP 1
+\connect testmanager;
+
+-- Add record for user 'admin'
+INSERT INTO Users (sUsername, sEmail, sFullName, sLoginName)
+       VALUES ('root', 'admin at example.org', 'Administrator', 'admin');
+
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseForeignKeyErHacks.pgsql b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseForeignKeyErHacks.pgsql
new file mode 100644
index 0000000..421ec2d
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseForeignKeyErHacks.pgsql
@@ -0,0 +1,80 @@
+-- $Id: TestManagerDatabaseForeignKeyErHacks.pgsql $
+--- @file
+-- VBox Test Manager Database Addendum that adds non-unique foreign keys.
+--
+-- This is for getting better visualization in reverse engeering ER tools,
+-- it is not for production databases.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+\set ON_ERROR_STOP 1
+\connect testmanager
+
+ALTER TABLE TestCaseArgs
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idTestCase, tsExpire)             REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
+
+ALTER TABLE TestcaseDeps
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idTestCase, tsExpire)             REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
+ALTER TABLE TestcaseDeps
+   ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idTestCasePreReq,tsExpire)        REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
+
+ALTER TABLE TestCaseGlobalRsrcDeps
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idTestCase, tsExpire)             REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
+ALTER TABLE TestCaseGlobalRsrcDeps
+   ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idGlobalRsrc, tsExpire)           REFERENCES GlobalResources(idGlobalRsrc, tsExpire) MATCH FULL;
+
+ALTER TABLE TestGroupMembers
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idTestGroup, tsExpire)            REFERENCES TestGroups(idTestGroup, tsExpire) MATCH FULL;
+ALTER TABLE TestGroupMembers
+   ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idTestCase, tsExpire)             REFERENCES TestCases(idTestCase, tsExpire) MATCH FULL;
+
+ALTER TABLE SchedGroups
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idBuildSrc, tsExpire)             REFERENCES BuildSources(idBuildSrc, tsExpire) MATCH SIMPLE;
+ALTER TABLE SchedGroups
+   ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idBuildSrcTestSuite, tsExpire)    REFERENCES BuildSources(idBuildSrc, tsExpire) MATCH SIMPLE;
+
+ALTER TABLE SchedGroupMembers
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idSchedGroup, tsExpire)           REFERENCES SchedGroups(idSchedGroup, tsExpire) MATCH FULL;
+ALTER TABLE SchedGroupMembers
+   ADD CONSTRAINT non_unique_fk2 FOREIGN KEY (idTestGroup, tsExpire)            REFERENCES TestGroups(idTestGroup, tsExpire) MATCH FULL;
+ALTER TABLE SchedGroupMembers
+   ADD CONSTRAINT non_unique_fk3 FOREIGN KEY (idTestGroupPreReq, tsExpire)      REFERENCES TestGroups(idTestGroup, tsExpire) MATCH FULL;
+
+ALTER TABLE TestBoxes
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idSchedGroup, tsExpire)           REFERENCES SchedGroups(idSchedGroup, tsExpire) MATCH FULL;
+
+ALTER TABLE FailureReasons
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idFailureCategory, tsExpire)      REFERENCES FailureCategories(idFailureCategory, tsExpire) MATCH FULL;
+
+ALTER TABLE TestResultFailures
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idFailureReason, tsExpire)        REFERENCES FailureReasons(idFailureReason, tsExpire) MATCH FULL;
+
+ALTER TABLE BuildBlacklist
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idFailureReason, tsExpire)        REFERENCES FailureReasons(idFailureReason, tsExpire) MATCH FULL;
+
+ALTER TABLE GlobalResourceStatuses
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idGlobalRsrc, tsAllocated)        REFERENCES GlobalResources(idGlobalRsrc, tsExpire) MATCH FULL;
+
+ALTER TABLE SchedQueues
+   ADD CONSTRAINT non_unique_fk1 FOREIGN KEY (idSchedGroup, tsLastScheduled)    REFERENCES SchedGroups(idSchedGroup, tsExpire) MATCH FULL;
+
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseForeignKeyErHacks2.pgsql b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseForeignKeyErHacks2.pgsql
new file mode 100644
index 0000000..6be7498
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseForeignKeyErHacks2.pgsql
@@ -0,0 +1,67 @@
+-- $Id: TestManagerDatabaseForeignKeyErHacks2.pgsql $
+--- @file
+-- VBox Test Manager Database Addendum that adds non-unique foreign keys to Users.
+--
+-- This is for getting better visualization in reverse engeering ER tools,
+-- it is not for production databases.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+\set ON_ERROR_STOP 1
+\connect testmanager
+
+ALTER TABLE GlobalResources
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE BuildSources
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE RequirementSets
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsCreated) REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE TestCases
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE TestCaseArgs
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE TestcaseDeps
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE TestCaseGlobalRsrcDeps
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE TestGroups
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE TestGroupMembers
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE SchedGroups
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH SIMPLE;
+ALTER TABLE SchedGroupMembers
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE TestBoxes
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE FailureCategories
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE FailureReasons
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE TestResultFailures
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE BuildBlacklist
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsExpire)  REFERENCES Users(uid, tsExpire) MATCH FULL;
+ALTER TABLE Builds
+   ADD CONSTRAINT non_unique_fk9 FOREIGN KEY (uidAuthor, tsCreated) REFERENCES Users(uid, tsExpire) MATCH FULL;
+
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseInit.pgsql b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseInit.pgsql
new file mode 100644
index 0000000..f772aa9
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseInit.pgsql
@@ -0,0 +1,1758 @@
+-- $Id: TestManagerDatabaseInit.pgsql $
+--- @file
+-- VBox Test Manager Database Creation script.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+--
+-- Declaimer:
+--
+--     The guys working on this design are not database experts, web
+--     programming experts or similar, rather we are low level guys
+--     who's main job is x86 & AMD64 virtualization.  So, please don't
+--     be too hard on us. :-)
+--
+--
+
+
+DROP DATABASE testmanager; -- WARNING!! WE CURRENTLY DROP THE DATABASE!
+\set ON_ERROR_STOP 1
+CREATE DATABASE testmanager;
+\connect testmanager;
+
+
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+--
+--     S y s t e m
+--
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+---
+-- Log table for a few important events.
+--
+-- Currently, two events are planned to be logged:
+--      - Sign on of an unknown testbox, including the IP and System UUID.
+--        This will be restricted to one entry per 24h or something like that:
+--              SELECT  COUNT(*)
+--              FROM    SystemLog
+--              WHERE   tsCreated >= (current_timestamp - interval '24 hours')
+--                  AND sEvent = 'TBoxUnkn'
+--                  AND sLogText = :sNewLogText;
+--      - When cleaning up an abandond testcase (scenario #9), log which
+--        testbox abandond which testset.
+--
+-- The Web UI will have some way of displaying the log.
+--
+-- A batch job should regularly clean out old log messages, like for instance
+-- > 64 days.
+--
+CREATE TABLE SystemLog (
+    --- When this was logged.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- The event type.
+    -- This is a 8 character string identifier so that we don't need to change
+    -- some enum type everytime we introduce a new event type.
+    sEvent              CHAR(8)     NOT NULL,
+    --- The log text.
+    sLogText            text        NOT NULL,
+
+    PRIMARY KEY (tsCreated, sEvent)
+);
+
+
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+--
+--     C o n f i g u r a t i o n
+--
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+--- @table Users
+-- Test manager users.
+--
+-- This is mainly for doing simple access checks before permitting access to
+-- the test manager.  This needs to be coordinated with
+-- apache/ldap/Oracle-Single-Sign-On.
+--
+-- The main purpose, though, is for tracing who changed the test config and
+-- analysis data.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.
+--
+CREATE SEQUENCE UserIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE Users (
+    --- The user id.
+    uid                 INTEGER     DEFAULT NEXTVAL('UserIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     DEFAULT NULL,
+    --- User name.
+    sUsername           text        NOT NULL,
+    --- The email address of the user.
+    sEmail              text        NOT NULL,
+    --- The full name.
+    sFullName           text        NOT NULL,
+    --- The login name used by apache.
+    sLoginName          text        NOT NULL,
+
+    PRIMARY KEY (uid, tsExpire)
+);
+CREATE INDEX UsersLoginNameIdx ON Users (tsExpire, sLoginName);
+
+
+--- @table GlobalResources
+-- Global resource configuration.
+--
+-- For example an iSCSI target.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.
+--
+CREATE SEQUENCE GlobalResourceIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE GlobalResources (
+    --- The global resource ID.
+    -- This stays the same thru updates.
+    idGlobalRsrc        INTEGER     DEFAULT NEXTVAL('GlobalResourceIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+    --- The name of the resource.
+    sName               text        NOT NULL,
+    --- Optional resource description.
+    sDescription        text,
+    --- Indicates whether this resource is currently enabled (online).
+    fEnabled            boolean     DEFAULT FALSE  NOT NULL,
+
+    PRIMARY KEY (idGlobalRsrc, tsExpire)
+);
+
+
+--- @table BuildSources
+-- Build sources.
+--
+-- This is used by a scheduling group to select builds and the default
+-- Validation Kit from the Builds table.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.
+--
+-- @todo Any better way of representing this so we could more easily
+--       join/whatever when searching for builds?
+--
+CREATE SEQUENCE BuildSourceIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE BuildSources (
+    --- The build source identifier.
+    -- This stays constant over time.
+    idBuildSrc          INTEGER     DEFAULT NEXTVAL('BuildSourceIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE    DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE    DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    --- The name of the build source.
+    sName               TEXT        NOT NULL,
+    --- Description.
+    sDescription        TEXT        DEFAULT NULL,
+
+    --- Which product.
+    -- ASSUME that it is okay to limit a build source to a single product.
+    sProduct            text        NOT NULL,
+    --- Which branch.
+    -- ASSUME that it is okay to limit a build source to a branch.
+    sBranch             text        NOT NULL,
+
+    --- Build types to include, all matches if NULL.
+    -- @todo Weighting the types would be nice in a later version.
+    asTypes             text ARRAY  DEFAULT NULL,
+    --- Array of the 'sOs.sCpuArch' to match, all matches if NULL.
+    -- See KBUILD_OSES in kBuild for a list of standard target OSes, and
+    -- KBUILD_ARCHES for a list of standard architectures.
+    --
+    -- @remarks See marks on 'os-agnostic' and 'noarch' in BuildCategories.
+    asOsArches          text ARRAY  DEFAULT NULL,
+
+    --- The first subversion tree revision to match, no lower limit if NULL.
+    iFirstRevision      INTEGER     DEFAULT NULL,
+    --- The last subversion tree revision to match, no upper limit if NULL.
+    iLastRevision       INTEGER     DEFAULT NULL,
+
+    --- The maximum age of the builds in seconds, unlimited if NULL.
+    cSecMaxAge          INTEGER     DEFAULT NULL,
+
+    PRIMARY KEY (idBuildSrc, tsExpire)
+);
+
+
+--- @table TestCases
+-- Test case configuration.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.
+--
+CREATE SEQUENCE TestCaseIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE SEQUENCE TestCaseGenIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestCases (
+    --- The fixed test case ID.
+    -- This is assigned when the test case is created and will never change.
+    idTestCase          INTEGER     DEFAULT NEXTVAL('TestCaseIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+    --- Generation ID for this row, a truly unique identifier.
+    -- This is primarily for referencing by TestSets.
+    idGenTestCase       INTEGER     UNIQUE DEFAULT NEXTVAL('TestCaseGenIdSeq')  NOT NULL,
+
+    --- The name of the test case.
+    sName               TEXT        NOT NULL,
+    --- Optional test case description.
+    sDescription        TEXT        DEFAULT NULL,
+    --- Indicates whether this test case is currently enabled.
+    fEnabled            BOOLEAN     DEFAULT FALSE  NOT NULL,
+    --- Default test case timeout given in seconds.
+    cSecTimeout         INTEGER     NOT NULL  CHECK (cSecTimeout > 0),
+    --- Default TestBox requirement expression (python boolean expression).
+    -- All the scheduler properties are available for use with the same names
+    -- as in that table.
+    -- If NULL everything matches.
+    sTestBoxReqExpr     TEXT        DEFAULT NULL,
+    --- Default build requirement expression (python boolean expression).
+    -- The following build properties are available: sProduct, sBranch,
+    -- sType, asOsArches, sVersion, iRevision, uidAuthor and idBuild.
+    -- If NULL everything matches.
+    sBuildReqExpr       TEXT        DEFAULT NULL,
+
+    --- The base command.
+    -- String suitable for executing in bourne shell with space as separator
+    -- (IFS). References to @BUILD_BINARIES@ will be replaced WITH the content
+    -- of the Builds(sBinaries) field.
+    sBaseCmd            TEXT        NOT NULL,
+
+    --- Comma separated list of test suite zips (or tars) that the testbox will
+    -- need to download and expand prior to testing.
+    -- If NULL the current test suite of the scheduling group will be used (the
+    -- scheduling group will have an optional test suite build queue associated
+    -- with it).  The current test suite can also be referenced by
+    -- @VALIDATIONKIT_ZIP@ in case more downloads are required.  Files may also be
+    -- uploaded to the test manager download area, in which case the
+    -- @DOWNLOAD_BASE_URL@ prefix can be used to refer to this area.
+    sTestSuiteZips      TEXT        DEFAULT NULL,
+
+    PRIMARY KEY (idTestCase, tsExpire)
+);
+
+
+--- @table TestCaseArgs
+-- Test case argument list variations.
+--
+-- For example, we have a test case that does a set of tests on a virtual
+-- machine.  To get better code/feature coverage of this testcase we wish to
+-- run it with different guest hardware configuration.  The test case may do
+-- the same stuff, but the guest OS as well as the VMM may react differently to
+-- the hardware configurations and uncover issues in the VMM, device emulation
+-- or other places.
+--
+-- Typical hardware variations are:
+--      - guest memory size (RAM),
+--      - guest video memory size (VRAM),
+--      - virtual CPUs / cores / threads,
+--      - virtual chipset
+--      - virtual network interface card (NIC)
+--      - USB 1.1, USB 2.0, no USB
+--
+-- The TM web UI will help the user create a reasonable set of permutations
+-- of these parameters, the user specifies a maximum and the TM uses certain
+-- rules together with random selection to generate the desired number.  The
+-- UI will also help suggest fitting testbox requirements according to the
+-- RAM/VRAM sizes and the virtual CPU counts.  The user may then make
+-- adjustments to the suggestions before commit them.
+--
+-- Alternatively, the user may also enter all the permutations without any
+-- help from the UI.
+--
+-- Note! All test cases has at least one entry in this table, even if it is
+-- empty, because testbox requirements are specified thru this.
+--
+-- Querying the valid parameter lists for a testase this way:
+--      SELECT * ... WHERE idTestCase = TestCases.idTestCase
+--                     AND tsExpire     > <when>
+--                     AND tsEffective <= <when>;
+--
+-- Querying the valid parameter list for the latest generation can be
+-- simplified by just checking tsExpire date:
+--      SELECT * ... WHERE idTestCase = TestCases.idTestCase
+--                     AND tsExpire    == TIMESTAMP WITH TIME ZONE 'infinity';
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.
+--
+CREATE SEQUENCE TestCaseArgsIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE SEQUENCE TestCaseArgsGenIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestCaseArgs (
+    --- The test case ID.
+    -- Non-unique foreign key: TestCases(idTestCase).
+    idTestCase          INTEGER     NOT NULL,
+    --- The testcase argument variation ID (fixed).
+    -- This is primarily for TestGroupMembers.aidTestCaseArgs.
+    idTestCaseArgs      INTEGER     DEFAULT NEXTVAL('TestCaseArgsIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+    --- Generation ID for this row.
+    -- This is primarily for efficient referencing by TestSets and SchedQueues.
+    idGenTestCaseArgs   INTEGER     UNIQUE DEFAULT NEXTVAL('TestCaseArgsGenIdSeq')  NOT NULL,
+
+    --- The additional arguments.
+    -- String suitable for bourne shell style argument parsing with space as
+    -- separator (IFS).  References to @BUILD_BINARIES@ will be replaced with
+    -- the content of the Builds(sBinaries) field.
+    sArgs               TEXT        NOT NULL,
+    --- Optional test case timeout given in seconds.
+    -- If NULL, the TestCases.cSecTimeout field is used instead.
+    cSecTimeout         INTEGER     DEFAULT NULL  CHECK (cSecTimeout IS NULL OR cSecTimeout > 0),
+    --- Additional TestBox requirement expression (python boolean expression).
+    -- All the scheduler properties are available for use with the same names
+    -- as in that table.  This is checked after first checking the requirements
+    -- in the TestCases.sTestBoxReqExpr field.
+    sTestBoxReqExpr     TEXT        DEFAULT NULL,
+    --- Additional build requirement expression (python boolean expression).
+    -- The following build properties are available: sProduct, sBranch,
+    -- sType, asOsArches, sVersion, iRevision, uidAuthor and idBuild. This is
+    -- checked after first checking the requirements in the
+    -- TestCases.sBuildReqExpr field.
+    sBuildReqExpr       TEXT        DEFAULT NULL,
+    --- Number of testboxes required (gang scheduling).
+    cGangMembers        SMALLINT    DEFAULT 1  NOT NULL  CHECK (cGangMembers > 0 AND cGangMembers < 1024),
+
+    --- The arguments are part of the primary key for several reasons.
+    -- No duplicate argument lists (makes no sense - if you want to prioritize
+    -- argument lists, we add that explicitly).  This may hopefully enable us
+    -- to more easily check coverage later on, even when the test case is
+    -- reconfigured with more/less permutations.
+    PRIMARY KEY (idTestCase, tsExpire, sArgs)
+);
+CREATE INDEX TestCaseArgsLookupIdx ON TestCaseArgs (idTestCase, tsExpire, tsEffective);
+
+
+--- @table TestCaseDeps
+-- Test case dependencies (N:M)
+--
+-- This effect build selection.  The build must have passed all runs of the
+-- given prerequisite testcase (idTestCasePreReq) and executed at a minimum one
+-- argument list variation.
+--
+-- This should also affect scheduling order, if possible at least one
+-- prerequisite testcase variation should be place before the specific testcase
+-- in the scheduling queue.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE TABLE TestCaseDeps (
+    --- The test case that depends on someone.
+    -- Non-unique foreign key: TestCases(idTestCase).
+    idTestCase          INTEGER     NOT NULL,
+    --- The prerequisite test case ID.
+    -- Non-unique foreign key: TestCases(idTestCase).
+    idTestCasePreReq    INTEGER     NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    PRIMARY KEY (idTestCase, idTestCasePreReq, tsExpire)
+);
+
+
+--- @table TestCaseGlobalRsrcDeps
+-- Test case dependencies on global resources (N:M)
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE TABLE TestCaseGlobalRsrcDeps (
+    --- The test case that depends on someone.
+    -- Non-unique foreign key: TestCases(idTestCase).
+    idTestCase          INTEGER     NOT NULL,
+    --- The prerequisite resource ID.
+    -- Non-unique foreign key: GlobalResources(idGlobalRsrc).
+    idGlobalRsrc        INTEGER     NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    PRIMARY KEY (idTestCase, idGlobalRsrc, tsExpire)
+);
+
+
+--- @table TestGroups
+-- Test Group - A collection of test cases.
+--
+-- This is for simplifying test configuration by working with a few groups
+-- instead of a herd of individual testcases.  It may also be used for creating
+-- test suites for certain areas (like guest additions) or tasks (like
+-- performance measurements).
+--
+-- A test case can be member of any number of test groups.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE SEQUENCE TestGroupIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestGroups (
+    --- The fixed scheduling group ID.
+    -- This is assigned when the group is created and will never change.
+    idTestGroup         INTEGER     DEFAULT NEXTVAL('TestGroupIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    --- The name of the scheduling group.
+    sName               text        NOT NULL,
+    --- Optional group description.
+    sDescription        text,
+
+    PRIMARY KEY (idTestGroup, tsExpire)
+);
+CREATE INDEX TestGroups_id_index ON TestGroups (idTestGroup, tsExpire, tsEffective);
+
+
+--- @table TestGroupMembers
+-- The N:M relation ship between test case configurations and test groups.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE TABLE TestGroupMembers (
+    --- The group ID.
+    -- Non-unique foreign key: TestGroups(idTestGroup).
+    idTestGroup         INTEGER     NOT NULL,
+    --- The test case ID.
+    -- Non-unique foreign key: TestCases(idTestCase).
+    idTestCase          INTEGER     NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    --- Test case scheduling priority.
+    -- Higher number causes the test case to be run more frequently.
+    -- @sa SchedGroupMembers.iSchedPriority
+    -- @todo Not sure we want to keep this...
+    iSchedPriority      INTEGER     DEFAULT 16  CHECK (iSchedPriority >= 0 AND iSchedPriority < 32)  NOT NULL,
+
+    --- Limit the memberships to the given argument variations.
+    -- Non-unique foreign key: TestCaseArgs(idTestCase, idTestCaseArgs).
+    aidTestCaseArgs     INTEGER ARRAY  DEFAULT NULL,
+
+    PRIMARY KEY (idTestGroup, idTestCase, tsExpire)
+);
+
+
+--- @table SchedGroups
+-- Scheduling group (aka. testbox partitioning) configuration.
+--
+-- A testbox is associated with exactly one scheduling group.  This association
+-- can be changed, of course.  If we (want to) retire a group which still has
+-- testboxes associated with it, these will be moved to the 'default' group.
+--
+-- The TM web UI will make sure that a testbox is always in a group and that
+-- the default group cannot be deleted.
+--
+-- A scheduling group combines several things:
+--      - A selection of builds to test (via idBuildSrc).
+--      - A collection of test groups to test with (via SchedGroupMembers).
+--      - A set of testboxes to test on (via TestBoxes.idSchedGroup).
+--
+-- In additions there is an optional source of fresh test suite builds (think
+-- VBoxTestSuite) as well as scheduling options.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE TYPE Scheduler_T AS ENUM (
+    'bestEffortContinousItegration',
+    'reserved'
+);
+CREATE SEQUENCE SchedGroupIdSeq
+    START 2
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE SchedGroups (
+    --- The fixed scheduling group ID.
+    -- This is assigned when the group is created and will never change.
+    idSchedGroup        INTEGER     DEFAULT NEXTVAL('SchedGroupIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    -- @note This is NULL for the default group.
+    uidAuthor           INTEGER     DEFAULT NULL,
+
+    --- The name of the scheduling group.
+    sName               text        NOT NULL,
+    --- Optional group description.
+    sDescription        text,
+    --- Indicates whether this group is currently enabled.
+    fEnabled            boolean     NOT NULL,
+    --- The scheduler to use.
+    -- This is for when we later desire different scheduling that the best
+    -- effort stuff provided by the initial implementation.
+    enmScheduler        Scheduler_T DEFAULT 'bestEffortContinousItegration'::Scheduler_T  NOT NULL,
+    --- The build source.
+    -- Non-unique foreign key: BuildSources(idBuildSrc)
+    idBuildSrc          INTEGER     DEFAULT NULL,
+    --- The Validation Kit build source (@VALIDATIONKIT_ZIP@).
+    -- Non-unique foreign key: BuildSources(idBuildSrc)
+    idBuildSrcTestSuite INTEGER     DEFAULT NULL,
+
+    PRIMARY KEY (idSchedGroup, tsExpire)
+);
+
+-- Special default group.
+INSERT INTO SchedGroups (idSchedGroup, tsEffective, tsExpire, sName, sDescription, fEnabled)
+    VALUES (1, TIMESTAMP WITH TIME ZONE 'epoch', TIMESTAMP WITH TIME ZONE 'infinity', 'default', 'default group', FALSE);
+
+
+--- @table SchedGroupMembers
+-- N:M relationship between scheduling groups and test groups.
+--
+-- Several scheduling parameters are associated with this relationship.
+--
+-- The test group dependency (idTestGroupPreReq) can be used in the same way as
+-- TestCaseDeps.idTestCasePreReq, only here on test group level.  This means it
+-- affects the build selection.  The builds needs to have passed all test runs
+-- the prerequisite test group and done at least one argument variation of each
+-- test case in it.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE TABLE SchedGroupMembers (
+    --- Scheduling ID.
+    -- Non-unique foreign key: SchedGroups(idSchedGroup).
+    idSchedGroup        INTEGER     NOT NULL,
+    --- Testgroup ID.
+    -- Non-unique foreign key: TestGroups(idTestGroup).
+    idTestGroup         INTEGER     NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    --- The scheduling priority if the test group.
+    -- Higher number causes the test case to be run more frequently.
+    -- @sa TestGroupMembers.iSchedPriority
+    iSchedPriority      INTEGER     DEFAULT 16 CHECK (iSchedPriority >= 0 AND iSchedPriority < 32)  NOT NULL,
+    --- When during the week this group is allowed to start running, NULL means
+    -- there are no constraints.
+    -- Each bit in the bitstring represents one hour, with bit 0 indicating the
+    -- midnight hour on a monday.
+    bmHourlySchedule    bit(168)    DEFAULT NULL,
+    --- Optional test group dependency.
+    -- Non-unique foreign key: TestGroups(idTestGroup).
+    -- This is for requiring that a build has been subject to smoke tests
+    -- before bothering to subject it to longer tests.
+    -- @todo Not entirely sure this should be here, but I'm not so keen on yet
+    --       another table as the only use case is smoketests.
+    idTestGroupPreReq   INTEGER     DEFAULT NULL,
+
+    PRIMARY KEY (idSchedGroup, idTestGroup, tsExpire)
+);
+
+
+--- @type TestBoxCmd_T
+-- Testbox commands.
+CREATE TYPE TestBoxCmd_T AS ENUM (
+    'none',
+    'abort',
+    'reboot',                   --< This implies abort. Status changes when reaching 'idle'.
+    'upgrade',                  --< This is only handled when asking for work.
+    'upgrade-and-reboot',       --< Ditto.
+    'special'                   --< Similar to upgrade, reserved for the future.
+);
+
+
+--- @type LomKind_T
+-- The kind of lights out management on a testbox.
+CREATE TYPE LomKind_T AS ENUM (
+    'none',
+    'ilom',
+    'elom',
+    'apple-xserve-lom'
+);
+
+
+--- @table TestBoxes
+-- Testbox configurations.
+--
+-- The testboxes are identified by IP and the system UUID if available. Should
+-- the IP change, the testbox will be refused at sign on and the testbox
+-- sheriff will have to update it's IP.
+--
+-- @todo Implement the UUID stuff. Get it from DMI, UEFI or whereever.
+--       Mismatching needs to be logged somewhere...
+--
+-- To query the currently valid configuration:
+--     SELECT ... WHERE id = idTestBox AND tsExpire = TIMESTAMP WITH TIME ZONE 'infinity';
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE SEQUENCE TestBoxIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE SEQUENCE TestBoxGenIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestBoxes (
+    --- The fixed testbox ID.
+    -- This is assigned when the testbox is created and will never change.
+    idTestBox           INTEGER     DEFAULT NEXTVAL('TestBoxIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- When modified automatically by the testbox, NULL is used.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     DEFAULT NULL,
+    --- Generation ID for this row.
+    -- This is primarily for referencing by TestSets.
+    idGenTestBox        INTEGER     UNIQUE DEFAULT NEXTVAL('TestBoxGenIdSeq')  NOT NULL,
+
+    --- The testbox IP.
+    -- This is from the webserver point of view and automatically updated on
+    -- SIGNON.  The test setup doesn't permit for IP addresses to change while
+    -- the testbox is operational, because this will break gang tests.
+    ip                  inet        NOT NULL,
+    --- The system or firmware UUID.
+    -- This uniquely identifies the testbox when talking to the server.  After
+    -- SIGNON though, the testbox will also provide idTestBox and ip to
+    -- establish its identity beyond doubt.
+    uuidSystem          uuid        NOT NULL,
+    --- The testbox name.
+    -- Usually similar to the DNS name.
+    sName               text        NOT NULL,
+    --- Optional testbox description.
+    -- Intended for describing the box as well as making other relevant notes.
+    sDescription        text        DEFAULT NULL,
+
+    --- Reference to the scheduling group that this testbox is a member of.
+    -- Non-unique foreign key: SchedGroups(idSchedGroup)
+    -- A testbox is always part of a group, the default one nothing else.
+    idSchedGroup        INTEGER     DEFAULT 1  NOT NULL,
+
+    --- Indicates whether this testbox is enabled.
+    -- A testbox gets disabled when we're doing maintenance, debugging a issue
+    -- that happens only on that testbox, or some similar stuff.  This is an
+    -- alternative to deleting the testbox.
+    fEnabled            BOOLEAN     DEFAULT NULL,
+
+    --- The kind of lights-out-management.
+    enmLomKind          LomKind_T   DEFAULT 'none'::LomKind_T  NOT NULL,
+    --- The IP adress of the lights-out-management.
+    -- This can be NULL if enmLomKind is 'none', otherwise it must contain a valid address.
+    ipLom               inet        DEFAULT NULL,
+
+    --- Timeout scale factor, given as a percent.
+    -- This is a crude adjustment of the test case timeout for slower hardware.
+    pctScaleTimeout     smallint    DEFAULT 100  NOT NULL  CHECK (pctScaleTimeout > 10 AND pctScaleTimeout < 20000),
+
+    --- @name Scheduling properties (reported by testbox script).
+    -- @{
+    --- Same abbrieviations as kBuild, see KBUILD_OSES.
+    sOs                 text        DEFAULT NULL,
+    --- Informational, no fixed format.
+    sOsVersion          text        DEFAULT NULL,
+    --- Same as CPUID reports (GenuineIntel, AuthenticAMD, CentaurHauls, ...).
+    sCpuVendor          text        DEFAULT NULL,
+    --- Same as kBuild - x86, amd64, ... See KBUILD_ARCHES.
+    sCpuArch            text        DEFAULT NULL,
+    --- The CPU name if available.
+    sCpuName            text        DEFAULT NULL,
+    --- Number identifying the CPU family/model/stepping/whatever.
+    -- For x86 and AMD64 type CPUs, this will on the following format:
+    --   (EffFamily << 24) | (EffModel << 8) | Stepping.
+    lCpuRevision        bigint      DEFAULT NULL,
+    --- Number of CPUs, CPU cores and CPU threads.
+    cCpus               smallint    DEFAULT NULL  CHECK (cCpus IS NULL OR cCpus > 0),
+    --- Set if capable of hardware virtualization.
+    fCpuHwVirt          boolean     DEFAULT NULL,
+    --- Set if capable of nested paging.
+    fCpuNestedPaging    boolean     DEFAULT NULL,
+    --- Set if CPU capable of 64-bit (VBox) guests.
+    fCpu64BitGuest      boolean     DEFAULT NULL,
+    --- Set if chipset with usable IOMMU (VT-d / AMD-Vi).
+    fChipsetIoMmu       boolean     DEFAULT NULL,
+    --- The (approximate) memory size in megabytes (rounded down to nearest 4 MB).
+    cMbMemory           bigint      DEFAULT NULL  CHECK (cMbMemory IS NULL OR cMbMemory > 0),
+    --- The amount of scratch space in megabytes (rounded down to nearest 64 MB).
+    cMbScratch          bigint      DEFAULT NULL  CHECK (cMbScratch IS NULL OR cMbScratch >= 0),
+    --- Free form hardware and software report field.
+    sReport             text        DEFAULT NULL,
+    --- @}
+
+    --- The testbox script revision number, serves the purpose of a version number.
+    -- Probably good to have when scheduling upgrades as well for status purposes.
+    iTestBoxScriptRev   INTEGER     DEFAULT 0  NOT NULL,
+    --- The python sys.hexversion (layed out as of 2.7).
+    -- Good to know which python versions we need to support.
+    iPythonHexVersion   INTEGER     DEFAULT NULL,
+
+    --- Pending command.
+    -- @note We put it here instead of in TestBoxStatuses to get history.
+    enmPendingCmd       TestBoxCmd_T  DEFAULT 'none'::TestBoxCmd_T  NOT NULL,
+
+    PRIMARY KEY (idTestBox, tsExpire),
+
+    --- Nested paging requires hardware virtualization.
+    CHECK (fCpuNestedPaging IS NULL OR (fCpuNestedPaging <> TRUE OR fCpuHwVirt = TRUE))
+);
+CREATE UNIQUE INDEX TestBoxesUuidIdx ON TestBoxes (uuidSystem, tsExpire);
+
+
+
+
+
+
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+--
+--     F a i l u r e   T r a c k i n g
+--
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+--- @table FailureCategories
+-- Failure categories.
+--
+-- This is for organizing the failure reasons.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE SEQUENCE FailureCategoryIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE FailureCategories (
+    --- The identifier of this failure category (once assigned, it will never change).
+    idFailureCategory   INTEGER     DEFAULT NEXTVAL('FailureCategoryIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+    --- The short category description.
+    -- For combo boxes and other selection lists.
+    sShort              text        NOT NULL,
+    --- Full description
+    -- For cursor-over-poppups for instance.
+    sFull               text        NOT NULL,
+
+    PRIMARY KEY (idFailureCategory, tsExpire)
+);
+
+
+--- @table FailureReasons
+-- Failure reasons.
+--
+-- When analysing a test failure, the testbox sheriff will try assign a fitting
+-- reason for the failure.  This table is here to help the sheriff in his/hers
+-- job as well as developers looking checking if their changes affected the
+-- test results in any way.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE SEQUENCE FailureReasonIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE FailureReasons (
+    --- The identifier of this failure reason (once assigned, it will never change).
+    idFailureReason     INTEGER     DEFAULT NEXTVAL('FailureReasonIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    --- The failure category this reason belongs to.
+    -- Non-unique foreign key: FailureCategories(idFailureCategory)
+    idFailureCategory   INTEGER     NOT NULL,
+    --- The short failure description.
+    -- For combo boxes and other selection lists.
+    sShort              text        NOT NULL,
+    --- Full failure description.
+    sFull               text        NOT NULL,
+    --- Ticket number in the primary bugtracker.
+    iTicket             INTEGER     DEFAULT NULL,
+    --- Other URLs to reports or discussions of the observed symptoms.
+    asUrls              text ARRAY  DEFAULT NULL,
+
+    PRIMARY KEY (idFailureReason, tsExpire)
+);
+CREATE INDEX FailureReasonsCategoryIdx ON FailureReasons (idFailureCategory, idFailureReason);
+
+
+
+--- @table TestResultFailures
+-- This is for tracking/discussing test result failures.
+--
+-- The rational for putting this is a separate table is that we need history on
+-- this while TestResults does not.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE TABLE TestResultFailures (
+    --- The test result we're disucssing.
+    -- @note The foreign key is declared after TestResults (further down).
+    idTestResult        INTEGER     NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    --- The suggested failure reason.
+    -- Non-unique foreign key: FailureReasons(idFailureReason)
+    idFailureReason     INTEGER     NOT NULL,
+    --- Optional comment.
+    sComment            text        DEFAULT NULL,
+
+    PRIMARY KEY (idTestResult, tsExpire)
+);
+
+
+
+
+
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+--
+--     T e s t   I n p u t
+--
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+--- @table BuildBlacklist
+-- Table used to blacklist sets of builds.
+--
+-- The best usage example is a VMM developer realizing that a change causes the
+-- host to panic, hang, or otherwise misbehave.  To prevent the testbox sheriff
+-- from repeatedly having to reboot testboxes, the builds gets blacklisted
+-- until there is a working build again.  This may mean adding an open ended
+-- blacklist spec and then updating it with the final revision number once the
+-- fix has been committed.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+-- @todo Would be nice if we could replace the text strings below with a set of
+--       BuildCategories, or sore it in any other way which would enable us to
+--       do a negative join with build category...  The way it is specified
+--       now, it looks like we have to open a cursor of prospecitve builds and
+--       filter then thru this table one by one.
+--
+--       Any better representation is welcome, but this is low prioirty for
+--       now, as it's relatively easy to change this later one.
+--
+CREATE SEQUENCE BuildBlacklistIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE BuildBlacklist (
+    --- The blacklist entry id.
+    -- This stays constant over time.
+    idBlacklisting      INTEGER     DEFAULT NEXTVAL('BuildBlacklistIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     NOT NULL,
+
+    --- The reason for the blacklisting.
+    -- Non-unique foreign key: FailureReasons(idFailureReason)
+    idFailureReason     INTEGER     NOT NULL,
+
+    --- Which product.
+    -- ASSUME that it is okay to limit a blacklisting to a single product.
+    sProduct            text        NOT NULL,
+    --- Which branch.
+    -- ASSUME that it is okay to limit a blacklisting to a branch.
+    sBranch             text        NOT NULL,
+
+    --- Build types to include, all matches if NULL.
+    asTypes             text ARRAY  DEFAULT NULL,
+    --- Array of the 'sOs.sCpuArch' to match, all matches if NULL.
+    -- See KBUILD_OSES in kBuild for a list of standard target OSes, and
+    -- KBUILD_ARCHES for a list of standard architectures.
+    --
+    -- @remarks See marks on 'os-agnostic' and 'noarch' in BuildCategories.
+    asOsArches          text ARRAY  DEFAULT NULL,
+
+    --- The first subversion tree revision to blacklist.
+    iFirstRevision      INTEGER     NOT NULL,
+    --- The last subversion tree revision to blacklist, no upper limit if NULL.
+    iLastRevision       INTEGER     NOT NULL,
+
+    PRIMARY KEY (idBlacklisting, tsExpire)
+);
+
+--- @table BuildCategories
+-- Build categories.
+--
+-- The purpose of this table is saving space in the Builds table and hopefully
+-- speed things up when selecting builds as well (compared to selecting on 4
+-- text fields in the much larger Builds table).
+--
+-- Insert only table, no update, no delete.  History is not needed.
+--
+CREATE SEQUENCE BuildCategoryIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE BuildCategories (
+    --- The build type identifier.
+    idBuildCategory     INTEGER     PRIMARY KEY DEFAULT NEXTVAL('BuildCategoryIdSeq')  NOT NULL,
+    --- Product.
+    -- The product name.  For instance 'VBox' or 'VBoxTestSuite'.
+    sProduct            TEXT        NOT NULL,
+    --- The version control repository name.
+    sRepository         TEXT        NOT NULL,
+    --- The branch name (in the version control system).
+    sBranch             TEXT        NOT NULL,
+    --- The build type.
+    -- See KBUILD_BLD_TYPES in kBuild for a list of standard build types.
+    sType               TEXT        NOT NULL,
+    --- Array of the 'sOs.sCpuArch' supported by the build.
+    -- See KBUILD_OSES in kBuild for a list of standard target OSes, and
+    -- KBUILD_ARCHES for a list of standard architectures.
+    --
+    -- @remarks 'os-agnostic' is used if the build doesn't really target any
+    --          specific OS or if it targets all applicable OSes.
+    --          'noarch' is used if the build is architecture independent or if
+    --          all applicable architectures are handled.
+    --          Thus, 'os-agnostic.noarch' will run on all build boxes.
+    --
+    -- @note    The array shall be sorted ascendingly to prevent unnecessary duplicates!
+    --
+    asOsArches          TEXT ARRAY  NOT NULL,
+
+    UNIQUE (sProduct, sRepository, sBranch, sType, asOsArches)
+);
+
+
+--- @table Builds
+-- The builds table contains builds from the tinderboxes and oaccasionally from
+-- developers.
+--
+-- The tinderbox side could be fed by a batch job enumerating the build output
+-- directories every so often, looking for new builds.  Or we could query them
+-- from the tinderbox database.  Yet another alternative is making the
+-- tinderbox server or client side software inform us about all new builds.
+--
+-- The developer builds are entered manually thru the TM web UI.  They are used
+-- for subjecting new code to some larger scale testing before commiting,
+-- enabling, or merging a private branch.
+--
+-- The builds are being selected from this table by the via the build source
+-- specification that SchedGroups.idBuildSrc and
+-- SchedGroups.idBuildSrcTestSuite links to.
+--
+-- @remarks This table stores history.  Never update or delete anything.  The
+--          equivalent of deleting is done by setting the 'tsExpire' field to
+--          current_timestamp.  To select the currently valid entries use
+--          tsExpire = TIMESTAMP WITH TIME ZONE 'infinity'.
+--
+CREATE SEQUENCE BuildIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE Builds (
+    --- The build identifier.
+    -- This remains unchanged
+    idBuild             INTEGER     DEFAULT NEXTVAL('BuildIdSeq')  NOT NULL,
+    --- When this build was created or entered into the database.
+    -- This remains unchanged
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- Non-unique foreign key: Users(uid)
+    -- @note This is NULL if added by a batch job / tinderbox.
+    uidAuthor           INTEGER     DEFAULT NULL,
+    --- The build category.
+    idBuildCategory     INTEGER     REFERENCES BuildCategories(idBuildCategory)  NOT NULL,
+    --- The subversion tree revision of the build.
+    iRevision           INTEGER     NOT NULL,
+    --- The product version number (suitable for RTStrVersionCompare).
+    sVersion            TEXT        NOT NULL,
+    --- The link to the tinderbox log of this build.
+    sLogUrl             TEXT,
+    --- Comma separated list of binaries.
+    -- The binaries have paths relative to the TESTBOX_PATH_BUILDS or full URLs.
+    sBinaries           TEXT        NOT NULL,
+    --- Set when the binaries gets deleted by the build quota script.
+    fBinariesDeleted    BOOLEAN     DEFAULT FALSE  NOT NULL,
+
+    UNIQUE (idBuild, tsExpire)
+);
+CREATE INDEX BuildsLookupIdx ON Builds (idBuildCategory, iRevision);
+
+
+--- @table VcsRevisions
+-- This table is for translating build revisions into commit details.
+--
+-- For graphs and test results, it would be useful to translate revisions into
+-- dates and maybe provide commit message and the committer.
+--
+-- Data is entered exclusively thru one or more batch jobs, so no internal
+-- authorship needed.  Also, since we're mirroring data from external sources
+-- here, the batch job is allowed to update/replace existing records.
+--
+-- @todo We we could collect more info from the version control systems, if we
+--       believe it's useful and can be presented in a reasonable manner.
+--       Getting a list of affected files would be simple (requires
+--       a separate table with a M:1 relationship to this table), or try
+--       associate a commit to a branch.
+--
+CREATE TABLE VcsRevisions (
+    --- The version control tree name.
+    sRepository         TEXT        NOT NULL,
+    --- The version control tree revision number.
+    iRevision           INTEGER     NOT NULL,
+    --- When the revision was created (committed).
+    tsCreated           TIMESTAMP WITH TIME ZONE  NOT NULL,
+    --- The name of the committer.
+    -- @note Not to be confused with uidAuthor and test manager users.
+    sAuthor             TEXT,
+    --- The commit message.
+    sMessage            TEXT,
+
+    UNIQUE (sRepository, iRevision)
+);
+
+
+
+
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+--
+--     T e s t   R e s u l t s
+--
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+--- @table TestResultStrTab
+-- String table for the test results.
+--
+-- This is a string cache for value names, test names and possible more, that
+-- is frequently repated in the test results record for each test run.  The
+-- purpose is not only to save space, but to make datamining queries faster by
+-- giving them integer fields to work on instead of text fields.  There may
+-- possibly be some benefits on INSERT as well as there are only integer
+-- indexes.
+--
+-- Nothing is ever deleted from this table.
+--
+-- @note Should use a stored procedure to query/insert a string.
+--
+CREATE SEQUENCE TestResultStrTabIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestResultStrTab (
+    --- The ID of this string.
+    idStr               INTEGER     PRIMARY KEY DEFAULT NEXTVAL('TestResultStrTabIdSeq'),
+    --- The string value.
+    sValue              text        NOT NULL,
+    --- Creation time stamp.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL
+);
+CREATE UNIQUE INDEX TestResultStrTabNameIdx ON TestResultStrTab (sValue);
+
+--- Empty string with ID 0.
+INSERT INTO TestResultStrTab (idStr, sValue) VALUES (0, '');
+
+
+--- @type TestStatus_T
+-- The status of a test (set / result).
+--
+CREATE TYPE TestStatus_T AS ENUM (
+    -- Initial status:
+    'running',
+    -- Final statuses:
+    'success',
+    -- Final status: Test didn't fail as such, it was something else.
+    'skipped',
+    'bad-testbox',
+    'aborted',
+    -- Final status: Test failed.
+    'failure',
+    'timed-out',
+    'rebooted'
+);
+
+
+--- @table TestResults
+-- Test results - a recursive bundle of joy!
+--
+-- A test case will be created when the testdriver calls reporter.testStart and
+-- concluded with reporter.testDone.  The testdriver (or it subordinates) can
+-- use these methods to create nested test results.  For IPRT based test cases,
+-- RTTestCreate, RTTestInitAndCreate and RTTestSub will both create new test
+-- result records, where as RTTestSubDone, RTTestSummaryAndDestroy and
+-- RTTestDestroy will conclude records.
+--
+-- By concluding is meant updating the status.  When the test driver reports
+-- success, we check it against reported results. (paranoia strikes again!)
+--
+-- Nothing is ever deleted from this table.
+--
+-- @note    As seen below, several other tables associate data with a
+--          test result, and the top most test result is referenced by the
+--          test set.
+--
+CREATE SEQUENCE TestResultIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestResults (
+    --- The ID of this test result.
+    idTestResult        INTEGER     PRIMARY KEY DEFAULT NEXTVAL('TestResultIdSeq'),
+    --- The parent test result.
+    -- This is NULL for the top test result.
+    idTestResultParent  INTEGER     REFERENCES TestResults(idTestResult),
+    --- The testsest this result is a part of.
+    -- Note! This is a foreign key, but we have to add it after TestSets has
+    --       been created, see further down.
+    idTestSet           INTEGER     NOT NULL,
+    --- Creation time stamp.  This may also be the timestamp of when the test started.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- The elapsed time for this test.
+    -- This is either reported by the directly (with some sanity checking) or
+    -- calculated (current_timestamp - created_ts).
+    -- @todo maybe use a nanosecond field here, check with what
+    tsElapsed           interval    DEFAULT NULL,
+    --- The test name.
+    idStrName           INTEGER     REFERENCES TestResultStrTab(idStr)  NOT NULL,
+    --- The error count.
+    cErrors             INTEGER     DEFAULT 0  NOT NULL,
+    --- The test status.
+    enmStatus           TestStatus_T DEFAULT 'running'::TestStatus_T  NOT NULL,
+    --- Nesting depth.
+    iNestingDepth       smallint    NOT NULL CHECK (iNestingDepth >= 0 AND iNestingDepth < 16),
+    -- Make sure errors and status match up.
+    CONSTRAINT CheckStatusMatchesErrors
+        CHECK (   (cErrors > 0 AND enmStatus IN ('running'::TestStatus_T,
+                                                 'failure'::TestStatus_T, 'timed-out'::TestStatus_T, 'rebooted'::TestStatus_T ))
+               OR (cErrors = 0 AND enmStatus IN ('running'::TestStatus_T, 'success'::TestStatus_T,
+                                                 'skipped'::TestStatus_T, 'aborted'::TestStatus_T, 'bad-testbox'::TestStatus_T))
+              )
+);
+
+CREATE INDEX TestResultsSetIdx ON TestResults (idTestSet, idStrName, idTestResult);
+CREATE INDEX TestResultsParentIdx ON TestResults (idTestResultParent);
+-- The TestResultsNameIdx is for speeding up the result graph & reporting code.
+CREATE INDEX TestResultsNameIdx ON TestResults (idStrName, idTestResult, tsCreated);
+
+ALTER TABLE TestResultFailures
+    ADD CONSTRAINT idTestResultFk FOREIGN KEY (idTestResult) REFERENCES TestResults(idTestResult) MATCH FULL;
+
+
+--- @table TestResultValues
+-- Test result values.
+--
+-- A testdriver or subordinate may report a test value via
+-- reporter.testValue(), while IPRT based test will use RTTestValue and
+-- associates.
+--
+-- This is an insert only table, no deletes, no updates.
+--
+CREATE SEQUENCE TestResultValueIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestResultValues (
+    --- The ID of this value.
+    idTestResultValue   INTEGER     PRIMARY KEY DEFAULT NEXTVAL('TestResultValueIdSeq'),
+    --- The test result it was reported within.
+    idTestResult        INTEGER     REFERENCES TestResults(idTestResult)  NOT NULL,
+    --- The test result it was reported within.
+    -- Note! This is a foreign key, but we have to add it after TestSets has
+    --       been created, see further down.
+    idTestSet           INTEGER     NOT NULL,
+    --- Creation time stamp.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- The name.
+    idStrName           INTEGER     REFERENCES TestResultStrTab(idStr)  NOT NULL,
+    --- The value.
+    lValue              bigint      NOT NULL,
+    --- The unit.
+    -- @todo This is currently not defined properly. Will fix/correlate this
+    --       with the other places we use unit (IPRT/testdriver/VMMDev).
+    iUnit               smallint    NOT NULL CHECK (iUnit >= 0 AND iUnit < 1024)
+);
+
+CREATE INDEX TestResultValuesIdx ON TestResultValues(idTestResult);
+-- The TestResultValuesGraphIdx is for speeding up the result graph & reporting code.
+CREATE INDEX TestResultValuesGraphIdx ON TestResultValues(idStrName, tsCreated);
+
+
+--- @table TestResultFiles
+-- Test result files.
+--
+-- A testdriver or subordinate may report a file by using
+-- reporter.addFile() or reporter.addLogFile().
+--
+-- The files stored here as well as the primary log file will be processed by a
+-- batch job and compressed if considered compressable.  Thus, TM will look for
+-- files with a .gz/.bz2 suffix first and then without a suffix.
+--
+-- This is an insert only table, no deletes, no updates.
+--
+CREATE SEQUENCE TestResultFileId
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestResultFiles (
+    --- The ID of this file.
+    idTestResultFile    INTEGER     PRIMARY KEY DEFAULT NEXTVAL('TestResultFileId'),
+    --- The test result it was reported within.
+    idTestResult        INTEGER     REFERENCES TestResults(idTestResult)  NOT NULL,
+    --- Creation time stamp.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- The filename relative to TestSets(sBaseFilename) + '-'.
+    -- The set of valid filename characters should be very limited so that no
+    -- file system issues can occure either on the TM side or the user when
+    -- loading the files.  Tests trying to use other characters will fail.
+    -- Valid character regular expession: '^[a-zA-Z0-9_-(){}#@+,.=]*$'
+    idStrFile           INTEGER     REFERENCES TestResultStrTab(idStr)  NOT NULL,
+    --- The description.
+    idStrDescription    INTEGER     REFERENCES TestResultStrTab(idStr)  NOT NULL,
+    --- The kind of file.
+    -- For instance: 'log/release/vm',
+    --               'screenshot/failure',
+    --               'screencapture/failure',
+    --               'xmllog/somestuff'
+    idStrKind           INTEGER     REFERENCES TestResultStrTab(idStr)  NOT NULL,
+    --- The mime type for the file.
+    -- For instance: 'text/plain',
+    --               'image/png',
+    --               'video/webm',
+    --               'text/xml'
+    idStrMime           INTEGER     REFERENCES TestResultStrTab(idStr)  NOT NULL
+);
+
+CREATE INDEX TestResultFilesIdx ON TestResultFiles(idTestResult);
+
+
+--- @table TestResultMsgs
+-- Test result message.
+--
+-- A testdriver or subordinate may report a message via the sDetails parameter
+-- of the reporter.testFailure() method, while IPRT test cases will use
+-- RTTestFailed, RTTestPrintf and their friends.  For RTTestPrintf, we will
+-- ignore the more verbose message levels since these can also be found in one
+-- of the logs.
+--
+-- This is an insert only table, no deletes, no updates.
+--
+CREATE TYPE TestResultMsgLevel_T AS ENUM (
+    'failure',
+    'info'
+);
+CREATE SEQUENCE TestResultMsgIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestResultMsgs (
+    --- The ID of this file.
+    idTestResultMsg     INTEGER     PRIMARY KEY DEFAULT NEXTVAL('TestResultMsgIdSeq'),
+    --- The test result it was reported within.
+    idTestResult        INTEGER     REFERENCES TestResults(idTestResult)  NOT NULL,
+    --- Creation time stamp.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- The message string.
+    idStrMsg            INTEGER     REFERENCES TestResultStrTab(idStr)  NOT NULL,
+    --- The message level.
+    enmLevel            TestResultMsgLevel_T  NOT NULL
+);
+
+CREATE INDEX TestResultMsgsIdx ON TestResultMsgs(idTestResult);
+
+
+--- @table TestSets
+-- Test sets / Test case runs.
+--
+-- This is where we collect data about test runs.
+--
+-- @todo Not entirely sure where the 'test set' term came from.  Consider
+--       finding something more appropriate.
+--
+CREATE SEQUENCE TestSetIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE TestSets (
+    --- The ID of this test set.
+    idTestSet           INTEGER     PRIMARY KEY DEFAULT NEXTVAL('TestSetIdSeq')  NOT NULL,
+
+    --- The test config timestamp, used when reading test config.
+    tsConfig            TIMESTAMP WITH TIME ZONE  DEFAULT CURRENT_TIMESTAMP  NOT NULL,
+    --- When this test set was scheduled.
+    -- idGenTestBox is valid at this point.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT CURRENT_TIMESTAMP  NOT NULL,
+    --- When this test completed, i.e. testing stopped.  This should only be set once.
+    tsDone              TIMESTAMP WITH TIME ZONE  DEFAULT NULL,
+    --- The current status.
+    enmStatus           TestStatus_T  DEFAULT 'running'::TestStatus_T  NOT NULL,
+
+    --- The build we're testing.
+    -- Non-unique foreign key: Builds(idBuild)
+    idBuild             INTEGER     NOT NULL,
+    --- The build category of idBuild when the test started.
+    -- This is for speeding up graph data collection, i.e. avoid idBuild
+    -- the WHERE part of the selection.
+    idBuildCategory     INTEGER     REFERENCES BuildCategories(idBuildCategory) NOT NULL,
+    --- The test suite build we're using to do the testing.
+    -- This is NULL if the test suite zip wasn't referred or if a test suite
+    -- build source wasn't configured.
+    -- Non-unique foreign key: Builds(idBuild)
+    idBuildTestSuite    INTEGER     DEFAULT NULL,
+
+    --- The exact testbox configuration.
+    idGenTestBox        INTEGER     REFERENCES TestBoxes(idGenTestBox)  NOT NULL,
+    --- The testbox ID for joining with (valid: tsStarted).
+    -- Non-unique foreign key: TestBoxes(idTestBox)
+    idTestBox           INTEGER     NOT NULL,
+
+    --- The testgroup (valid: tsConfig).
+    -- Non-unique foreign key: TestBoxes(idTestGroup)
+    -- Note! This also gives the member ship entry, since a testcase can only
+    --       have one membership per test group.
+    idTestGroup         INTEGER     NOT NULL,
+
+    --- The exact test case config we executed in this test run.
+    idGenTestCase       INTEGER     REFERENCES TestCases(idGenTestCase)  NOT NULL,
+    --- The test case ID for joining with (valid: tsConfig).
+    -- Non-unique foreign key: TestBoxes(idTestCase)
+    idTestCase          INTEGER     NOT NULL,
+
+    --- The arguments (and requirements++) we executed this test case with.
+    idGenTestCaseArgs   INTEGER     REFERENCES TestCaseArgs(idGenTestCaseArgs)  NOT NULL,
+    --- The argument variation ID (valid: tsConfig).
+    -- Non-unique foreign key: TestCaseArgs(idTestCaseArgs)
+    idTestCaseArgs      INTEGER     NOT NULL,
+
+    --- The root of the test result tree.
+    -- @note This will only be NULL early in the transaction setting up the testset.
+    -- @note If the test reports more than one top level test result, we'll
+    --       fail the whole test run and let the test developer fix it.
+    idTestResult        INTEGER     REFERENCES TestResults(idTestResult)  DEFAULT NULL,
+
+    --- The base filename used for storing files related to this test set.
+    -- This is a path relative to wherever TM is dumping log files.  In order
+    -- to not become a file system test case, we will try not to put too many
+    -- hundred thousand files in a directory.  A simple first approach would
+    -- be to just use the current date (tsCreated) like this:
+    --    TM_FILE_DIR/year/month/day/TestSets.idTestSet
+    --
+    -- The primary log file for the test is this name suffixed by '.log'.
+    --
+    -- The files in the testresultfile table gets their full names like this:
+    --    TM_FILE_DIR/sBaseFilename-testresultfile.id-TestResultStrTab(testresultfile.idStrFilename)
+    --
+    -- @remarks We store this explicitly in case we change the directly layout
+    --          at some later point.
+    sBaseFilename       text        UNIQUE  NOT NULL,
+
+    --- The gang member number number, 0 is the leader.
+    iGangMemberNo       SMALLINT    DEFAULT 0  NOT NULL  CHECK (iGangMemberNo >= 0 AND iGangMemberNo < 1024),
+    --- The test set of the gang leader, NULL if no gang involved.
+    -- @note This is set by the gang leader as well, so that we can find all
+    --       gang members by WHERE idTestSetGangLeader = :id.
+    idTestSetGangLeader INTEGER     REFERENCES TestSets(idTestSet)  DEFAULT NULL
+
+);
+CREATE INDEX TestSetsGangIdx        ON TestSets (idTestSetGangLeader);
+CREATE INDEX TestSetsBoxIdx         ON TestSets (idTestBox, idTestResult);
+CREATE INDEX TestSetsBuildIdx       ON TestSets (idBuild, idTestResult);
+CREATE INDEX TestSetsTestCaseIdx    ON TestSets (idTestCase, idTestResult);
+CREATE INDEX TestSetsTestVarIdx     ON TestSets (idTestCaseArgs, idTestResult);
+--- The TestSetCreatedDone is for testbox results, graph options and such.
+CREATE INDEX TestSetsCreatedDoneIdx ON TestSets (tsCreated, tsDone);
+--- For graphs.
+CREATE INDEX TestSetsGraphBoxIdx    ON TestSets (idTestBox, tsCreated, tsDone, idBuildCategory, idTestCase);
+
+ALTER TABLE TestResults      ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
+ALTER TABLE TestResultValues ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
+
+
+
+
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+--
+--     T e s t   M a n g e r   P e r s i s t e n t   S t o r a g e
+--
+-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+--- @type TestBoxState_T
+-- TestBox state.
+--
+-- @todo Consider drawing a state diagram for this.
+--
+CREATE TYPE TestBoxState_T AS ENUM (
+    --- Nothing to do.
+    -- Prev: testing, gang-cleanup, rebooting, upgrading,
+    --       upgrading-and-rebooting, doing-special-cmd.
+    -- Next: testing, gang-gathering, rebooting, upgrading,
+    --       upgrading-and-rebooting, doing-special-cmd.
+    'idle',
+    --- Executing a test.
+    -- Prev: idle
+    -- Next: idle
+    'testing',
+
+    -- Gang scheduling statuses:
+    --- The gathering of a gang.
+    -- Prev: idle
+    -- Next: gang-gathering-timedout, gang-testing
+    'gang-gathering',
+    --- The gathering timed out, the testbox needs to cleanup and move on.
+    -- Prev: gang-gathering
+    -- Next: idle
+    -- This is set on all gathered members by the testbox who triggers the
+    -- timeout.
+    'gang-gathering-timedout',
+    --- The gang scheduling equivalent of 'testing'.
+    -- Prev: gang-gathering
+    -- Next: gang-cleanup
+    'gang-testing',
+    --- Waiting for the other gang members to stop testing so that cleanups
+    -- can be performed and members safely rescheduled.
+    -- Prev: gang-testing
+    -- Next: idle
+    --
+    -- There are two resource clean up issues being targeted here:
+    --  1. Global resources will be allocated by the leader when he enters the
+    --     'gang-gathering' state.  If the leader quits and frees the resource
+    --     while someone is still using it, bad things will happen.  Imagine a
+    --     global resource without any access checks and relies exclusivly on
+    --     the TM doing its job.
+    --  2. TestBox resource accessed by other gang members may also be used in
+    --     other tests.  Should a gang member leave early and embark on a
+    --     testcase using the same resources, bad things will happen.  Example:
+    --     Live migration.  One partner leaves early because it detected some
+    --     fatal failure, the other one is still trying to connect to him.
+    --     The testbox is scheduled again on the same live migration testcase,
+    --     only with different arguments (VM config), it will try migrate using
+    --     the same TCP ports. Confusion ensues.
+    --
+    -- To figure out whether to remain in this status because someone is
+    -- still testing:
+    --      SELECT COUNT(*) FROM TestBoxStatuses, TestSets
+    --      WHERE TestSets.idTestSetGangLeader = :idGangLeader
+    --        AND TestSets.idTestBox = TestBoxStatuses.idTestBox
+    --        AND TestSets.idTestSet = TestBoxStatuses.idTestSet
+    --        AND TestBoxStatuses.enmState = 'gang-testing'::TestBoxState_T;
+    'gang-cleanup',
+
+    -- Command related statuses (all command status changes comes from 'idle'
+    -- and goes back to 'idle'):
+    'rebooting',
+    'upgrading',
+    'upgrading-and-rebooting',
+    'doing-special-cmd'
+);
+
+--- @table TestBoxStatuses
+-- Testbox status table.
+--
+-- History is not planned on this table.
+--
+CREATE TABLE TestBoxStatuses (
+    --- The testbox.
+    idTestBox           INTEGER     PRIMARY KEY  NOT NULL,
+    --- The testbox generation ID.
+    idGenTestBox        INTEGER     REFERENCES TestBoxes(idGenTestBox)  NOT NULL,
+    --- When this status was last updated.
+    -- This is updated everytime the testbox talks to the test manager, thus it
+    -- can easily be used to find testboxes which has stopped responding.
+    --
+    -- This is used for timeout calculation during gang-gathering, so in that
+    -- scenario it won't be updated until the gang is gathered or we time out.
+    tsUpdated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- The current state.
+    enmState            TestBoxState_T DEFAULT 'idle'::TestBoxState_T  NOT NULL,
+    --- Reference to the test set
+    idTestSet           INTEGER     REFERENCES TestSets(idTestSet)
+);
+
+
+--- @table GlobalResourceStatuses
+-- Global resource status, tracks which test set resources are allocated by.
+--
+-- History is not planned on this table.
+--
+CREATE TABLE GlobalResourceStatuses (
+    --- The resource ID.
+    -- Non-unique foreign key: GlobalResources(idGlobalRsrc).
+    idGlobalRsrc        INTEGER     PRIMARY KEY  NOT NULL,
+    --- The resource owner.
+    -- @note This is going thru testboxstatus to be able to use the testbox ID
+    --       as a foreign key.
+    idTestBox           INTEGER     REFERENCES TestBoxStatuses(idTestBox)  NOT NULL,
+    --- When the allocation took place.
+    tsAllocated         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL
+);
+
+
+--- @table SchedQueues
+-- Scheduler queue.
+--
+-- The queues are currently associated with a scheduling group, it could
+-- alternative be changed to hook on to a testbox instead.  It depends on what
+-- kind of scheduling method we prefer.  The former method aims at test case
+-- thruput, making sacrifices in the hardware distribution area.  The latter is
+-- more like the old buildbox style testing, making sure that each test case is
+-- executed on each testbox.
+--
+-- When there are configuration changes, TM will regenerate the scheduling
+-- queue for the affected scheduling groups.  We do not concern ourselves with
+-- trying to continue at the approximately same queue position, we simply take
+-- it from the top.
+--
+-- When a testbox ask for work, we will open a cursor on the queue and take the
+-- first test in the queue that can be executed on that testbox.  The test will
+-- be moved to the end of the queue (getting a new item_id).
+--
+-- If a test is manually changed to the head of the queue, the item will get a
+-- item_id which is 1 lower than the head of the queue.  Unless someone does
+-- this a couple of billion times, we shouldn't have any trouble running out of
+-- number space. :-)
+--
+-- Manually moving a test to the end of the queue is easy, just get a new
+-- 'item_id'.
+--
+-- History is not planned on this table.
+--
+CREATE SEQUENCE SchedQueueItemIdSeq
+    START 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+CREATE TABLE SchedQueues (
+    --- The scheduling queue (one queue per scheduling group).
+    -- Non-unique foreign key: SchedGroups(idSchedGroup)
+    idSchedGroup        INTEGER     NOT NULL,
+    --- The scheduler queue entry ID.
+    -- Lower numbers means early queue position.
+    idItem              INTEGER     DEFAULT NEXTVAL('SchedQueueItemIdSeq')  NOT NULL,
+    --- The queue offset.
+    -- This is used for repositining the queue when recreating it.  It can also
+    -- be used to figure out how jumbled the queue gets after real life has had
+    -- it's effect on it.
+    offQueue            INTEGER     NOT NULL,
+    --- The test case argument variation to execute.
+    idGenTestCaseArgs   INTEGER     REFERENCES TestCaseArgs(idGenTestCaseArgs)  NOT NULL,
+    --- The relevant testgroup.
+    -- Non-unique foreign key: TestGroups(idTestGroup).
+    idTestGroup         INTEGER     NOT NULL,
+    --- Aggregated test group dependencies (NULL if none).
+    -- Non-unique foreign key: TestGroups(idTestGroup).
+    -- See also comments on SchedGroupMembers.idTestGroupPreReq.
+    aidTestGroupPreReqs INTEGER ARRAY  DEFAULT NULL,
+    --- The scheduling time constraints (see SchedGroupMembers.bmHourlySchedule).
+    bmHourlySchedule    bit(168)    DEFAULT NULL,
+    --- When the queue entry was created and for which config is valid.
+    -- This is the timestamp that should be used when reading config info.
+    tsConfig            TIMESTAMP WITH TIME ZONE  DEFAULT CURRENT_TIMESTAMP  NOT NULL,
+    --- When this status was last scheduled.
+    -- This is set to current_timestamp when moving the entry to the end of the
+    -- queue.  It's initial value is unix-epoch.  Not entirely sure if it's
+    -- useful beyond introspection and non-unique foreign key hacking.
+    tsLastScheduled     TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'epoch'  NOT NULL,
+
+    --- This is used in gang scheduling.
+    idTestSetGangLeader INTEGER     REFERENCES TestSets(idTestSet)  DEFAULT NULL  UNIQUE,
+    --- The number of gang members still missing.
+    --
+    -- This saves calculating the number of missing members via selects like:
+    --     SELECT COUNT(*) FROM TestSets WHERE idTestSetGangLeader = :idGang;
+    -- and
+    --     SELECT cGangMembers FROM TestCaseArgs WHERE idGenTestCaseArgs = :idTest;
+    -- to figure out whether to remain in 'gather-gang'::TestBoxState_T.
+    --
+    cMissingGangMembers smallint    DEFAULT 1  NOT NULL,
+
+
+    PRIMARY KEY (idSchedGroup, idItem)
+);
+
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseMap.png b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseMap.png
new file mode 100644
index 0000000..861a407
Binary files /dev/null and b/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseMap.png differ
diff --git a/src/VBox/ValidationKit/testmanager/db/TestManagerVBoxPilot-1.pgsql b/src/VBox/ValidationKit/testmanager/db/TestManagerVBoxPilot-1.pgsql
new file mode 100644
index 0000000..5bc3646
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/TestManagerVBoxPilot-1.pgsql
@@ -0,0 +1,92 @@
+-- $Id: TestManagerVBoxPilot-1.pgsql $
+--- @file
+-- VBox Test Manager - Setup for the 1st VBox Pilot.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+
+\set ON_ERROR_STOP 1
+\connect testmanager;
+
+BEGIN WORK;
+
+--
+-- The user we assign all the changes too.
+--
+INSERT INTO Users (sUsername, sEmail, sFullName, sLoginName)
+    VALUES ('vbox-pilot-config', 'pilot1 at example.org', 'VBox Pilot Configurator', 'vbox-pilot-config');
+\set idUserQuery '(SELECT uid FROM Users WHERE sUsername = \'vbox-pilot-config\')'
+
+--
+-- Configure a scheduling group with build sources.
+--
+INSERT INTO BuildSources (uidAuthor, sName, sProduct, sBranch, asTypes, asOsArches)
+    VALUES (:idUserQuery, 'VBox trunk builds', 'VirtualBox', 'trunk', ARRAY['release', 'strict'],  NULL);
+
+INSERT INTO BuildSources (uidAuthor, sName, sProduct, sBranch, asTypes, asOsArches)
+    VALUES (:idUserQuery, 'VBox TestSuite trunk builds', 'VBox TestSuite', 'trunk', ARRAY['release'], NULL);
+
+INSERT INTO SchedGroups (sName, sDescription, fEnabled, idBuildSrc, idBuildSrcTestSuite)
+    VALUES ('VirtualBox Trunk', NULL, TRUE,
+            (SELECT idBuildSrc FROM BuildSources WHERE sName = 'VBox trunk builds'), 
+            (SELECT idBuildSrc FROM BuildSources WHERE sName = 'VBox TestSuite trunk builds') );
+\set idSchedGroupQuery '(SELECT idSchedGroup FROM SchedGroups WHERE sName = \'VirtualBox Trunk\')'
+
+--
+-- Configure three test groups.
+--
+INSERT INTO TestGroups (uidAuthor, sName)
+    VALUES (:idUserQuery, 'VBox smoketests');
+\set idGrpSmokeQuery        '(SELECT idTestGroup FROM TestGroups WHERE sName = \'VBox smoketests\')'
+INSERT INTO SchedGroupMembers (idSchedGroup, idTestGroup, uidAuthor, idTestGroupPreReq)
+    VALUES (:idSchedGroupQuery, :idGrpSmokeQuery, :idUserQuery, NULL);
+
+INSERT INTO TestGroups (uidAuthor, sName)
+    VALUES (:idUserQuery, 'VBox general');
+\set idGrpGeneralQuery      '(SELECT idTestGroup FROM TestGroups WHERE sName = \'VBox general\')'
+INSERT INTO SchedGroupMembers (idSchedGroup, idTestGroup, uidAuthor, idTestGroupPreReq)
+    VALUES (:idSchedGroupQuery, :idGrpGeneralQuery, :idUserQuery, :idGrpSmokeQuery);
+
+INSERT INTO TestGroups (uidAuthor, sName)
+    VALUES (:idUserQuery, 'VBox benchmarks');
+\set idGrpBenchmarksQuery   '(SELECT idTestGroup FROM TestGroups WHERE sName = \'VBox benchmarks\')'
+INSERT INTO SchedGroupMembers (idSchedGroup, idTestGroup, uidAuthor, idTestGroupPreReq)
+    VALUES (:idSchedGroupQuery, :idGrpBenchmarksQuery, :idUserQuery, :idGrpGeneralQuery);
+
+
+--
+-- Testcases
+--
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (:idUserQuery, 'VBox install', TRUE, 600,  
+            'validationkit/testdriver/vboxinstaller.py --vbox-build @BUILD_BINARIES@ @ACTION@ -- testdriver/base.py @ACTION@', 
+            '@VALIDATIONKIT_ZIP@');
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase FROM TestCases WHERE sName = 'VBox install'), :idUserQuery, '');
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES (:idGrpSmokeQuery, (SELECT idTestCase FROM TestCases WHERE sName = 'VBox install'), :idUserQuery);
+
+COMMIT WORK;
+
+
diff --git a/src/VBox/ValidationKit/testmanager/db/gen-sql-comments.py b/src/VBox/ValidationKit/testmanager/db/gen-sql-comments.py
new file mode 100755
index 0000000..889cf61
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/gen-sql-comments.py
@@ -0,0 +1,210 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: gen-sql-comments.py $
+
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+"""
+Converts doxygen style comments in SQL script to COMMENT ON statements.
+"""
+
+import sys;
+import re;
+
+
+def errorMsg(sMsg):
+    sys.stderr.write('error: %s\n' % (sMsg,));
+    return 1;
+
+class SqlDox(object):
+    """
+    Class for parsing relevant comments out of a pgsql file
+    and emit COMMENT ON statements from it.
+    """
+
+    def __init__(self, oFile, sFilename):
+        self.oFile              = oFile;
+        self.sFilename          = sFilename;
+        self.iLine              = 0;            # The current input line number.
+        self.sComment           = None;         # The current comment.
+        self.fCommentComplete   = False;        # Indicates that the comment has ended.
+        self.sCommentSqlObj     = None;         # SQL object indicated by the comment (@table).
+        self.sOuterSqlObj       = None;         # Like 'table yyyy' or 'type zzzz'.
+        self.sPrevSqlObj        = None;         # Like 'table xxxx'.
+
+
+    def error(self, sMsg):
+        return errorMsg('%s(%d): %s' % (self.sFilename, self.iLine, sMsg,));
+
+    def dprint(self, sMsg):
+        sys.stderr.write('debug: %s\n' % (sMsg,));
+        return True;
+
+    def resetComment(self):
+        self.sComment           = None;
+        self.fCommentComplete   = False;
+        self.sCommentSqlObj     = None;
+
+    def quoteSqlString(self, s):
+        return s.replace("'", "''");
+
+    def commitComment2(self, sSqlObj):
+        if self.sComment is not None and sSqlObj is not None:
+            print("COMMENT ON %s IS\n  '%s';\n\n" % (sSqlObj, self.quoteSqlString(self.sComment.strip())));
+        self.resetComment();
+        return True;
+
+    def commitComment(self):
+        return self.commitComment2(self.sCommentSqlObj);
+
+    def process(self):
+        for sLine in self.oFile:
+            self.iLine += 1;
+
+            sLine = sLine.strip();
+            self.dprint('line %d: %s\n' % (self.iLine, sLine));
+            if sLine.startswith('--'):
+                if sLine.startswith('--- '):
+                    #
+                    # New comment.
+                    # The first list may have a @table, @type or similar that we're interested in.
+                    #
+                    self.commitComment();
+
+                    sLine = sLine.lstrip('- ');
+                    if sLine.startswith('@table '):
+                        self.sCommentSqlObj = 'TABLE ' + (sLine[7:]).rstrip();
+                        self.sComment = '';
+                    elif sLine.startswith('@type '):
+                        self.sCommentSqlObj = 'TYPE ' + (sLine[6:]).rstrip();
+                        self.sComment = '';
+                    elif sLine.startswith('@todo') \
+                      or sLine.startswith('@file') \
+                      or sLine.startswith('@page') \
+                      or sLine.startswith('@name') \
+                      or sLine.startswith('@{') \
+                      or sLine.startswith('@}'):
+                        # Ignore.
+                        pass;
+                    elif sLine.startswith('@'):
+                        return self.error('Unknown tag: %s' % (sLine,));
+                    else:
+                        self.sComment = sLine;
+
+                elif (sLine.startswith('-- ') or sLine == '--') \
+                    and self.sComment is not None and self.fCommentComplete is False:
+                    #
+                    # Append line to comment.
+                    #
+                    if sLine == '--':
+                        sLine = '';
+                    else:
+                        sLine = (sLine[3:]);
+                    if self.sComment == '':
+                        self.sComment = sLine;
+                    else:
+                        self.sComment += "\n" + sLine;
+
+                elif sLine.startswith('--< '):
+                    #
+                    # Comment that starts on the same line as the object it describes.
+                    #
+                    sLine = (sLine[4:]).rstrip();
+                    # => Later/never.
+                else:
+                    #
+                    # Not a comment that interests us. So, complete any open
+                    # comment and commit it if we know which SQL object it
+                    # applies to.
+                    #
+                    self.fCommentComplete = True;
+                    if self.sCommentSqlObj is not None:
+                        self.commitComment();
+            else:
+                #
+                # Not a comment. As above, we complete and optionally commit
+                # any open comment.
+                #
+                self.fCommentComplete = True;
+                if self.sCommentSqlObj is not None:
+                    self.commitComment();
+
+                #
+                # Check for SQL (very fuzzy and bad).
+                #
+                asWords = sLine.split(' ');
+                if    len(asWords) >= 3 \
+                  and asWords[0] == 'CREATE':
+                    # CREATE statement.
+                    sType = asWords[1];
+                    sName = asWords[2];
+                    if sType == 'UNIQUE' and sName == 'INDEX' and len(asWords) >= 4:
+                        sType = asWords[2];
+                        sName = asWords[3];
+                    if sType in ('TABLE', 'TYPE', 'INDEX', 'VIEW'):
+                        self.sOuterSqlObj = sType + ' ' + sName;
+                        self.sPrevSqlObj  = self.sOuterSqlObj;
+                        self.dprint('%s' % (self.sOuterSqlObj,));
+                        self.commitComment2(self.sOuterSqlObj);
+                elif len(asWords) >= 1 \
+                  and self.sOuterSqlObj is not None \
+                  and self.sOuterSqlObj.startswith('TABLE ') \
+                  and re.search("^(as|al|bm|c|enm|f|i|l|s|ts|uid|uuid)[A-Z][a-zA-Z0-9]*$", asWords[0]) is not None:
+                    # Possibly a column name.
+                    self.sPrevSqlObj = 'COLUMN ' + self.sOuterSqlObj[6:] + '.' + asWords[0];
+                    self.dprint('column? %s' % (self.sPrevSqlObj));
+                    self.commitComment2(self.sPrevSqlObj);
+
+                #
+                # Check for semicolon.
+                #
+                if sLine.find(");") >= 0:
+                    self.sOuterSqlObj = None;
+
+        return 0;
+
+
+def usage():
+    sys.stderr.write('usage: gen-sql-comments.py <filename.pgsql>\n'
+                     '\n'
+                     'The output goes to stdout.\n');
+    return 0;
+
+
+def main(asArgs):
+    # Parse the argument. :-)
+    sInput = None;
+    if (len(asArgs) != 2):
+        sys.stderr.write('syntax error: expected exactly 1 argument, a psql file\n');
+        usage();
+        return 2;
+    sInput = asArgs[1];
+
+    # Do the job, outputting to standard output.
+    try:
+        oFile = open(sInput, 'r');
+    except:
+        return errorMsg("failed to open '%s' for reading" % (sInput,));
+    me = SqlDox(oFile, sInput);
+    return me.process();
+
+sys.exit(main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r01-builds-1.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r01-builds-1.pgsql
new file mode 100644
index 0000000..d03d5b0
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r01-builds-1.pgsql
@@ -0,0 +1,81 @@
+-- $Id: tmdb-r01-builds-1.pgsql $
+--- @file
+-- VBox Test Manager Database - Changed Builds to be historized.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+DROP TABLE OldBuilds;
+DROP TABLE NewBuilds;
+DROP INDEX BuildsLookupIdx;
+
+\set ON_ERROR_STOP 1
+
+--
+-- idBuild won't be unique, so it cannot be used directly as a foreign key
+-- by TestSets.
+--
+ALTER TABLE TestSets
+    DROP CONSTRAINT TestSets_idBuild_fkey;
+ALTER TABLE TestSets
+    DROP CONSTRAINT TestSets_idBuildTestSuite_fkey;
+
+
+--
+-- Create the table, filling it with the current Builds content.
+--
+CREATE TABLE NewBuilds (
+    idBuild             INTEGER     DEFAULT NEXTVAL('BuildIdSeq')  NOT NULL,
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    uidAuthor           INTEGER     DEFAULT NULL,
+    idBuildCategory     INTEGER     REFERENCES BuildCategories(idBuildCategory)  NOT NULL,
+    iRevision           INTEGER     NOT NULL,
+    sVersion            TEXT        NOT NULL,
+    sLogUrl             TEXT,
+    sBinaries           TEXT        NOT NULL,
+    fBinariesDeleted    BOOLEAN     DEFAULT FALSE  NOT NULL,
+    UNIQUE (idBuild, tsExpire)
+);
+
+INSERT INTO NewBuilds (idBuild, tsCreated, tsEffective, uidAuthor, idBuildCategory, iRevision, sVersion, sLogUrl, sBinaries)
+    SELECT idBuild, tsCreated, tsCreated, uidAuthor, idBuildCategory, iRevision, sVersion, sLogUrl, sBinaries
+    FROM Builds;
+COMMIT;
+
+-- Switch the tables.
+ALTER TABLE Builds    RENAME TO OldBuilds;
+ALTER TABLE NewBuilds RENAME TO Builds;
+COMMIT;
+
+-- Finally index the table.
+CREATE INDEX BuildsLookupIdx ON Builds (idBuildCategory, iRevision);
+COMMIT;
+
+DROP TABLE OldBuilds;
+COMMIT;
+
+-- Fix implicit index name.
+ALTER INDEX newbuilds_idbuild_tsexpire_key RENAME TO builds_idbuild_tsexpire_key;
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r02-testboxes-1.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r02-testboxes-1.pgsql
new file mode 100644
index 0000000..a7f345c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r02-testboxes-1.pgsql
@@ -0,0 +1,184 @@
+-- $Id: tmdb-r02-testboxes-1.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds fCpu64BitGuest to TestBoxes
+--
+
+--
+-- Copyright (C) 2013 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+DROP TABLE OldTestBoxes;
+DROP TABLE NewTestBoxes;
+
+\d TestBoxes;
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+LOCK TABLE TestBoxStatuses IN ACCESS EXCLUSIVE MODE;
+LOCK TABLE TestSets        IN ACCESS EXCLUSIVE MODE;
+LOCK TABLE TestBoxes       IN ACCESS EXCLUSIVE MODE;
+
+DROP INDEX TestBoxesUuidIdx;
+
+--
+-- Rename the original table, drop constrains and foreign key references so we
+-- get the right name automatic when creating the new one.
+--
+ALTER TABLE TestBoxes RENAME TO OldTestBoxes;
+
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_ccpus_check;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_check;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_cmbmemory_check;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_cmbscratch_check;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_pctscaletimeout_check;
+
+ALTER TABLE TestBoxStatuses DROP CONSTRAINT TestBoxStatuses_idGenTestBox_fkey;
+ALTER TABLE TestSets        DROP CONSTRAINT TestSets_idGenTestBox_fkey;
+
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_pkey;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_idgentestbox_key;
+
+--
+-- Create the new table, filling it with the current TestBoxes content.
+--
+CREATE TABLE TestBoxes (
+    --- The fixed testbox ID.
+    -- This is assigned when the testbox is created and will never change.
+    idTestBox           INTEGER     DEFAULT NEXTVAL('TestBoxIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- When modified automatically by the testbox, NULL is used.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     DEFAULT NULL,
+    --- Generation ID for this row.
+    -- This is primarily for referencing by TestSets.
+    idGenTestBox        INTEGER     UNIQUE DEFAULT NEXTVAL('TestBoxGenIdSeq')  NOT NULL,
+
+    --- The testbox IP.
+    -- This is from the webserver point of view and automatically updated on
+    -- SIGNON.  The test setup doesn't permit for IP addresses to change while
+    -- the testbox is operational, because this will break gang tests.
+    ip                  inet        NOT NULL,
+    --- The system or firmware UUID.
+    -- This uniquely identifies the testbox when talking to the server.  After
+    -- SIGNON though, the testbox will also provide idTestBox and ip to
+    -- establish its identity beyond doubt.
+    uuidSystem          uuid        NOT NULL,
+    --- The testbox name.
+    -- Usually similar to the DNS name.
+    sName               text        NOT NULL,
+    --- Optional testbox description.
+    -- Intended for describing the box as well as making other relevant notes.
+    sDescription        text        DEFAULT NULL,
+
+    --- Reference to the scheduling group that this testbox is a member of.
+    -- Non-unique foreign key: SchedGroups(idSchedGroup)
+    -- A testbox is always part of a group, the default one nothing else.
+    idSchedGroup        INTEGER     DEFAULT 1  NOT NULL,
+
+    --- Indicates whether this testbox is enabled.
+    -- A testbox gets disabled when we're doing maintenance, debugging a issue
+    -- that happens only on that testbox, or some similar stuff.  This is an
+    -- alternative to deleting the testbox.
+    fEnabled            BOOLEAN     DEFAULT NULL,
+
+    --- The kind of lights-out-management.
+    enmLomKind          LomKind_T   DEFAULT 'none'::LomKind_T  NOT NULL,
+    --- The IP adress of the lights-out-management.
+    -- This can be NULL if enmLomKind is 'none', otherwise it must contain a valid address.
+    ipLom               inet        DEFAULT NULL,
+
+    --- Timeout scale factor, given as a percent.
+    -- This is a crude adjustment of the test case timeout for slower hardware.
+    pctScaleTimeout     smallint    DEFAULT 100  NOT NULL  CHECK (pctScaleTimeout > 10 AND pctScaleTimeout < 20000),
+
+    --- @name Scheduling properties (reported by testbox script).
+    -- @{
+    --- Same abbrieviations as kBuild, see KBUILD_OSES.
+    sOs                 text        DEFAULT NULL,
+    --- Informational, no fixed format.
+    sOsVersion          text        DEFAULT NULL,
+    --- Same as CPUID reports (GenuineIntel, AuthenticAMD, CentaurHauls, ...).
+    sCpuVendor          text        DEFAULT NULL,
+    --- Same as kBuild - x86, amd64, ... See KBUILD_ARCHES.
+    sCpuArch            text        DEFAULT NULL,
+    --- Number of CPUs, CPU cores and CPU threads.
+    cCpus               smallint    DEFAULT NULL  CHECK (cCpus IS NULL OR cCpus > 0),
+    --- Set if capable of hardware virtualization.
+    fCpuHwVirt          boolean     DEFAULT NULL,
+    --- Set if capable of nested paging.
+    fCpuNestedPaging    boolean     DEFAULT NULL,
+    --- Set if CPU capable of 64-bit (VBox) guests.
+    fCpu64BitGuest      boolean     DEFAULT NULL,
+    --- Set if chipset with usable IOMMU (VT-d / AMD-Vi).
+    fChipsetIoMmu       boolean     DEFAULT NULL,
+    --- The (approximate) memory size in megabytes (rounded down to nearest 4 MB).
+    cMbMemory           bigint      DEFAULT NULL  CHECK (cMbMemory IS NULL OR cMbMemory > 0),
+    --- The amount of scratch space in megabytes (rounded down to nearest 64 MB).
+    cMbScratch          bigint      DEFAULT NULL  CHECK (cMbScratch IS NULL OR cMbScratch >= 0),
+    --- @}
+
+    --- The testbox script revision number, serves the purpose of a version number.
+    -- Probably good to have when scheduling upgrades as well for status purposes.
+    iTestBoxScriptRev   INTEGER     DEFAULT 0  NOT NULL,
+    --- The python sys.hexversion (layed out as of 2.7).
+    -- Good to know which python versions we need to support.
+    iPythonHexVersion   INTEGER     DEFAULT NULL,
+
+    --- Pending command.
+    -- @note We put it here instead of in TestBoxStatuses to get history.
+    enmPendingCmd       TestBoxCmd_T  DEFAULT 'none'::TestBoxCmd_T  NOT NULL,
+
+    PRIMARY KEY (idTestBox, tsExpire),
+
+    --- Nested paging requires hardware virtualization.
+    CHECK (fCpuNestedPaging IS NULL OR (fCpuNestedPaging <> TRUE OR fCpuHwVirt = TRUE))
+);
+
+
+INSERT INTO TestBoxes ( idTestBox, tsEffective, tsExpire, uidAuthor, idGenTestBox, ip, uuidSystem, sName, sDescription,
+           idSchedGroup, fEnabled, enmLomKind, ipLom, pctScaleTimeout, sOs, sOsVersion, sCpuVendor, sCpuArch, cCpus, fCpuHwVirt,
+           fCpuNestedPaging, fCpu64BitGuest, fChipsetIoMmu, cMbMemory, cMbScratch, iTestBoxScriptRev, iPythonHexVersion,
+           enmPendingCmd )
+    SELECT idTestBox, tsEffective, tsExpire, uidAuthor, idGenTestBox, ip, uuidSystem, sName, sDescription,
+           idSchedGroup, fEnabled, enmLomKind, ipLom, pctScaleTimeout, sOs, sOsVersion, sCpuVendor, sCpuArch, cCpus, fCpuHwVirt,
+           fCpuNestedPaging, TRUE,           fChipsetIoMmu, cMbMemory, cMbScratch, iTestBoxScriptRev, iPythonHexVersion,
+           enmPendingCmd
+    FROM OldTestBoxes;
+
+-- Add index.
+CREATE UNIQUE INDEX TestBoxesUuidIdx ON TestBoxes (uuidSystem, tsExpire);
+
+-- Restore foreign key references to the table.
+ALTER TABLE TestBoxStatuses ADD  CONSTRAINT TestBoxStatuses_idGenTestBox_fkey  FOREIGN KEY (idGenTestBox) REFERENCES TestBoxes(idGenTestBox);
+ALTER TABLE TestSets ADD  CONSTRAINT TestSets_idGenTestBox_fkey  FOREIGN KEY (idGenTestBox) REFERENCES TestBoxes(idGenTestBox);
+
+-- Drop the old table.
+DROP TABLE OldTestBoxes;
+
+COMMIT;
+
+\d TestBoxes;
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r03-teststatus-1.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r03-teststatus-1.pgsql
new file mode 100644
index 0000000..c2a0b33
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r03-teststatus-1.pgsql
@@ -0,0 +1,38 @@
+-- $Id: tmdb-r03-teststatus-1.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds 'bad-testbox', 'aborted', and 'timeout' to TestStatus_T.
+--
+
+--
+-- Copyright (C) 2013 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 1
+
+\dT+ TestStatus_T
+
+ALTER TYPE TestStatus_T ADD VALUE 'bad-testbox' BEFORE 'failure';
+ALTER TYPE TestStatus_T ADD VALUE 'aborted'     BEFORE 'failure';
+ALTER TYPE TestStatus_T ADD VALUE 'timed-out'   AFTER  'failure';
+
+\dT+ TestStatus_T
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r04-teststatus-2.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r04-teststatus-2.pgsql
new file mode 100644
index 0000000..37afe81
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r04-teststatus-2.pgsql
@@ -0,0 +1,36 @@
+-- $Id: tmdb-r04-teststatus-2.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds 'rebooted' to TestStatus_T.
+--
+
+--
+-- Copyright (C) 2013 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 1
+
+\dT+ TestStatus_T
+
+ALTER TYPE TestStatus_T ADD VALUE 'rebooted'   AFTER  'timed-out';
+
+\dT+ TestStatus_T
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r05-teststatus-3.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r05-teststatus-3.pgsql
new file mode 100644
index 0000000..c7ddeae
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r05-teststatus-3.pgsql
@@ -0,0 +1,44 @@
+-- $Id: tmdb-r05-teststatus-3.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds 'rebooted' to TestStatus_T.
+--
+
+--
+-- Copyright (C) 2013 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+\d+ TestResults
+
+ALTER TABLE TestResults
+    DROP CONSTRAINT CheckStatusMatchesErrors;
+ALTER TABLE TestResults
+    ADD CONSTRAINT CheckStatusMatchesErrors
+        CHECK (   (cErrors > 0 AND enmStatus IN ('running'::TestStatus_T,
+                                                 'failure'::TestStatus_T, 'timed-out'::TestStatus_T, 'rebooted'::TestStatus_T ))
+               OR (cErrors = 0 AND enmStatus IN ('running'::TestStatus_T, 'success'::TestStatus_T,
+                                                 'skipped'::TestStatus_T, 'aborted'::TestStatus_T, 'bad-testbox'::TestStatus_T))
+              );
+COMMIT;
+\d+ TestResults
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r06-buildsources-1.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r06-buildsources-1.pgsql
new file mode 100644
index 0000000..aa7b8e0
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r06-buildsources-1.pgsql
@@ -0,0 +1,36 @@
+-- $Id: tmdb-r06-buildsources-1.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds cMaxSecondsOld to BuildSources.
+--
+
+--
+-- Copyright (C) 2013 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 1
+
+\d+ buildsources
+
+ALTER TABLE BuildSources ADD COLUMN cSecMaxAge INTEGER DEFAULT NULL;
+
+\d+ buildsources
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r07-testresults-1.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r07-testresults-1.pgsql
new file mode 100644
index 0000000..16e030e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r07-testresults-1.pgsql
@@ -0,0 +1,38 @@
+-- $Id: tmdb-r07-testresults-1.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds an index to TestResults.
+--
+
+--
+-- Copyright (C) 2013-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+\d+ TestResults
+
+CREATE INDEX TestResultsNameIdx ON TestResults (idStrName, idTestResult, tsCreated);
+COMMIT;
+
+\d+ TestResults
+
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r08-testresultvalues-1.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r08-testresultvalues-1.pgsql
new file mode 100644
index 0000000..b754d66
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r08-testresultvalues-1.pgsql
@@ -0,0 +1,37 @@
+-- $Id: tmdb-r08-testresultvalues-1.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds an index to TestResultValues.
+--
+
+--
+-- Copyright (C) 2013-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+\d+ TestResultValues
+
+CREATE INDEX TestResultValuesNameIdx ON TestResultValues (idStrName, tsCreated);
+COMMIT;
+
+\d+ TestResultValues
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r09-testsets-1.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r09-testsets-1.pgsql
new file mode 100644
index 0000000..c212c4d
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r09-testsets-1.pgsql
@@ -0,0 +1,38 @@
+-- $Id: tmdb-r09-testsets-1.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds two indexes to TestSets.
+--
+
+--
+-- Copyright (C) 2013-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+\d+ TestSets
+
+CREATE INDEX TestSetsCreated        ON TestSets (tsCreated);
+CREATE INDEX TestSetsDone           ON TestSets (tsDone);
+COMMIT;
+
+\d+ TestSets
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r10-testresultvalues-2.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r10-testresultvalues-2.pgsql
new file mode 100644
index 0000000..0cf0f9e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r10-testresultvalues-2.pgsql
@@ -0,0 +1,101 @@
+-- $Id: tmdb-r10-testresultvalues-2.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds an idTestSet to TestResultValues.
+--
+
+--
+-- Copyright (C) 2013-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+--
+-- Cleanup after failed runs.
+--
+DROP TABLE NewTestResultValues;
+
+--
+-- Drop all indexes (might already be dropped).
+--
+DROP INDEX TestResultValuesIdx;
+DROP INDEX TestResultValuesNameIdx;
+
+-- Die on error from now on.
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+\d+ TestResultValues;
+
+--
+-- Create the new version of the table and filling with the content of the old.
+--
+CREATE TABLE NewTestResultValues (
+    --- The ID of this value.
+    idTestResultValue   INTEGER     DEFAULT NEXTVAL('TestResultValueIdSeq'), -- PRIMARY KEY
+    --- The test result it was reported within.
+    idTestResult        INTEGER     NOT NULL, -- REFERENCES TestResults(idTestResult)  NOT NULL,
+    --- The test result it was reported within.
+    idTestSet           INTEGER     NOT NULL, -- REFERENCES TestSets(idTestSet) NOT NULL,
+    --- Creation time stamp.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- The name.
+    idStrName           INTEGER     NOT NULL, -- REFERENCES TestResultStrTab(idStr)  NOT NULL,
+    --- The value.
+    lValue              bigint      NOT NULL,
+    --- The unit.
+    -- @todo This is currently not defined properly. Will fix/correlate this
+    --       with the other places we use unit (IPRT/testdriver/VMMDev).
+    iUnit               smallint    NOT NULL --CHECK (iUnit >= 0 AND iUnit < 1024)
+);
+COMMIT;
+\d+ NewTestResultValues
+
+-- Note! Using left out join here to speed up things (no hashing).
+SELECT COUNT(*) FROM TestResultValues a LEFT OUTER JOIN TestResults b ON (a.idTestResult = b.idTestResult);
+SELECT COUNT(*) FROM TestResultValues;
+
+INSERT INTO NewTestResultValues (idTestResultValue, idTestResult, idTestSet, tsCreated, idStrName, lValue, iUnit)
+    SELECT a.idTestResultValue, a.idTestResult, b.idTestSet, a.tsCreated, a.idStrName, a.lValue, a.iUnit
+    FROM   TestResultValues a LEFT OUTER JOIN TestResults b ON (a.idTestResult = b.idTestResult);
+COMMIT;
+SELECT COUNT(*) FROM NewTestResultValues;
+
+-- Switch the tables.
+ALTER TABLE TestResultValues RENAME TO OldTestResultValues;
+ALTER TABLE NewTestResultValues RENAME TO TestResultValues;
+COMMIT;
+
+-- Index the table.
+CREATE INDEX TestResultValuesIdx ON TestResultValues(idTestResult);
+CREATE INDEX TestResultValuesNameIdx ON TestResultValues(idStrName, tsCreated);
+COMMIT;
+
+-- Drop the old table.
+DROP TABLE OldTestResultValues;
+COMMIT;
+
+-- Add the constraints constraint.
+ALTER TABLE TestResultValues ADD CONSTRAINT TestResultValues_iUnit_Check CHECK (iUnit >= 0 AND iUnit < 1024);
+ALTER TABLE TestResultValues ADD PRIMARY KEY (idTestResultValue);
+ALTER TABLE TestResultValues ADD FOREIGN KEY (idStrName)    REFERENCES TestResultstrtab(idStr);
+ALTER TABLE TestResultValues ADD FOREIGN KEY (idTestResult) REFERENCES TestResults(idTestResult);
+ALTER TABLE TestResultValues ADD FOREIGN KEY (idTestSet)    REFERENCES TestSets(idTestSet);
+COMMIT;
+
+\d+ TestResultValues;
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r11-testsets-2.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r11-testsets-2.pgsql
new file mode 100644
index 0000000..4bcc986
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r11-testsets-2.pgsql
@@ -0,0 +1,204 @@
+-- $Id: tmdb-r11-testsets-2.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds an idBuildCategories to TestSets.
+--
+
+--
+-- Copyright (C) 2013-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+--
+-- Drop all indexes (might already be dropped).
+--
+DROP INDEX TestSetsGangIdx;
+DROP INDEX TestSetsBoxIdx;
+DROP INDEX TestSetsBuildIdx;
+DROP INDEX TestSetsTestCaseIdx;    
+DROP INDEX TestSetsTestVarIdx;
+DROP INDEX TestSetsCreated;
+DROP INDEX TestSetsDone;
+
+--
+-- Drop foreign keys on this table.
+--
+ALTER TABLE SchedQueues DROP CONSTRAINT SchedQueues_idTestSetGangLeader_fkey;
+ALTER TABLE TestBoxStatuses DROP CONSTRAINT TestBoxStatuses_idTestSet_fkey;
+ALTER TABLE TestResults DROP CONSTRAINT idTestSetFk; -- old name
+ALTER TABLE TestResults DROP CONSTRAINT TestResults_idTestSet_fkey;
+ALTER TABLE TestResultValues DROP CONSTRAINT TestResultValues_idTestSet_fkey;
+
+--
+-- Cleanup after failed runs.
+--
+DROP TABLE NewTestSets;
+DROP TABLE OldTestSets;
+
+-- Die on error from now on.
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+\d+ TestSets;
+
+--
+-- Create the new version of the table and filling with the content of the old.
+--
+CREATE TABLE NewTestSets (
+    --- The ID of this test set.
+    idTestSet           INTEGER      DEFAULT NEXTVAL('TestSetIdSeq')  NOT NULL, -- PRIMARY KEY
+
+    --- The test config timestamp, used when reading test config.
+    tsConfig            TIMESTAMP WITH TIME ZONE  DEFAULT CURRENT_TIMESTAMP  NOT NULL,
+    --- When this test set was scheduled.
+    -- idGenTestBox is valid at this point.
+    tsCreated           TIMESTAMP WITH TIME ZONE  DEFAULT CURRENT_TIMESTAMP  NOT NULL,
+    --- When this test completed, i.e. testing stopped.  This should only be set once.
+    tsDone              TIMESTAMP WITH TIME ZONE  DEFAULT NULL,
+    --- The current status.
+    enmStatus           TestStatus_T  DEFAULT 'running'::TestStatus_T  NOT NULL,
+
+    --- The build we're testing.
+    -- Non-unique foreign key: Builds(idBuild)
+    idBuild             INTEGER     NOT NULL,
+    --- The build category of idBuild when the test started.
+    -- This is for speeding up graph data collection, i.e. avoid idBuild 
+    -- the WHERE part of the selection.
+    idBuildCategory     INTEGER     , -- NOT NULL REFERENCES BuildCategories(idBuildCategory)
+    --- The test suite build we're using to do the testing.
+    -- This is NULL if the test suite zip wasn't referred or if a test suite
+    -- build source wasn't configured.
+    -- Non-unique foreign key: Builds(idBuild)
+    idBuildTestSuite    INTEGER     DEFAULT NULL,
+
+    --- The exact testbox configuration.
+    idGenTestBox        INTEGER     NOT NULL, -- REFERENCES TestBoxes(idGenTestBox)
+    --- The testbox ID for joining with (valid: tsStarted).
+    -- Non-unique foreign key: TestBoxes(idTestBox)
+    idTestBox           INTEGER     NOT NULL,
+
+    --- The testgroup (valid: tsConfig).
+    -- Non-unique foreign key: TestBoxes(idTestGroup)
+    -- Note! This also gives the member ship entry, since a testcase can only
+    --       have one membership per test group.
+    idTestGroup         INTEGER     NOT NULL,
+
+    --- The exact test case config we executed in this test run.
+    idGenTestCase       INTEGER     NOT NULL, -- REFERENCES TestCases(idGenTestCase)
+    --- The test case ID for joining with (valid: tsConfig).
+    -- Non-unique foreign key: TestBoxes(idTestCase)
+    idTestCase          INTEGER     NOT NULL,
+
+    --- The arguments (and requirements++) we executed this test case with.
+    idGenTestCaseArgs   INTEGER     NOT NULL, -- REFERENCES TestCaseArgs(idGenTestCaseArgs)
+    --- The argument variation ID (valid: tsConfig).
+    -- Non-unique foreign key: TestCaseArgs(idTestCaseArgs)
+    idTestCaseArgs      INTEGER     NOT NULL,
+
+    --- The root of the test result tree.
+    -- @note This will only be NULL early in the transaction setting up the testset.
+    -- @note If the test reports more than one top level test result, we'll
+    --       fail the whole test run and let the test developer fix it.
+    idTestResult        INTEGER     DEFAULT NULL, -- REFERENCES TestResults(idTestResult)
+
+    --- The base filename used for storing files related to this test set.
+    -- This is a path relative to wherever TM is dumping log files.  In order
+    -- to not become a file system test case, we will try not to put too many
+    -- hundred thousand files in a directory.  A simple first approach would
+    -- be to just use the current date (tsCreated) like this:
+    --    TM_FILE_DIR/year/month/day/TestSets.idTestSet
+    --
+    -- The primary log file for the test is this name suffixed by '.log'.
+    --
+    -- The files in the testresultfile table gets their full names like this:
+    --    TM_FILE_DIR/sBaseFilename-testresultfile.id-TestResultStrTab(testresultfile.idStrFilename)
+    --
+    -- @remarks We store this explicitly in case we change the directly layout
+    --          at some later point.
+    sBaseFilename       text        UNIQUE  NOT NULL,
+
+    --- The gang member number number, 0 is the leader.
+    iGangMemberNo       SMALLINT    DEFAULT 0  NOT NULL, --CHECK (iGangMemberNo >= 0 AND iGangMemberNo < 1024),
+    --- The test set of the gang leader, NULL if no gang involved.
+    -- @note This is set by the gang leader as well, so that we can find all
+    --       gang members by WHERE idTestSetGangLeader = :id.
+    idTestSetGangLeader INTEGER     DEFAULT NULL -- REFERENCES TestSets(idTestSet)
+
+);
+COMMIT;
+\d+ NewTestSets
+
+-- Note! Using left out join here to speed up things (no hashing).
+SELECT COUNT(*) FROM TestSets a LEFT OUTER JOIN Builds b ON (a.idBuild = b.idBuild AND b.tsExpire = 'infinity'::TIMESTAMP);
+SELECT COUNT(*) FROM TestSets;
+
+INSERT INTO NewTestSets (idTestSet, tsConfig, tsCreated, tsDone, enmStatus, idBuild, idBuildCategory, idBuildTestSuite, 
+                         idGenTestBox, idTestBox, idTestGroup, idGenTestCase, idTestCase, idGenTestCaseArgs, idTestCaseArgs, 
+                         idTestResult, sBaseFilename, iGangMemberNo, idTestSetGangLeader )
+    SELECT a.idTestSet, a.tsConfig, a.tsCreated, tsDone, a.enmStatus, a.idBuild, b.idBuildCategory, a.idBuildTestSuite, 
+           a.idGenTestBox, a.idTestBox, a.idTestGroup, a.idGenTestCase, a.idTestCase, a.idGenTestCaseArgs, a.idTestCaseArgs, 
+           a.idTestResult, a.sBaseFilename, a.iGangMemberNo, a.idTestSetGangLeader
+    FROM   TestSets a LEFT OUTER JOIN Builds b ON (a.idBuild = b.idBuild AND b.tsExpire = 'infinity'::TIMESTAMP);
+COMMIT;
+SELECT COUNT(*) FROM NewTestSets;
+
+-- Note! 2-3 builds are missing from the Builds table, so fudge it.
+UPDATE NewTestSets
+   SET idBuildCategory = 1
+ WHERE idBuildCategory IS NULL;
+
+-- Switch the tables.
+ALTER TABLE TestSets RENAME TO OldTestSets;
+ALTER TABLE NewTestSets RENAME TO TestSets;
+COMMIT;
+
+-- Index the table.
+CREATE INDEX TestSetsGangIdx        ON TestSets (idTestSetGangLeader);
+CREATE INDEX TestSetsBoxIdx         ON TestSets (idTestBox, idTestResult);
+CREATE INDEX TestSetsBuildIdx       ON TestSets (idBuild, idTestResult);
+CREATE INDEX TestSetsTestCaseIdx    ON TestSets (idTestCase, idTestResult);
+CREATE INDEX TestSetsTestVarIdx     ON TestSets (idTestCaseArgs, idTestResult);
+CREATE INDEX TestSetsCreated        ON TestSets (tsCreated);
+CREATE INDEX TestSetsDone           ON TestSets (tsDone);
+COMMIT;
+
+-- Drop the old table.
+DROP TABLE OldTestSets;
+COMMIT;
+
+-- Add the constraints constraint.
+ALTER TABLE TestSets ADD CONSTRAINT TestSets_iGangMemberNo_Check CHECK (iGangMemberNo >= 0 AND iGangMemberNo < 1024);
+ALTER TABLE TestSets ADD PRIMARY KEY (idTestSet);
+ALTER TABLE TestSets ADD FOREIGN KEY (idBuildCategory)      REFERENCES BuildCategories(idBuildCategory);
+ALTER TABLE TestSets ADD FOREIGN KEY (idGenTestBox)         REFERENCES TestBoxes(idGenTestBox);
+ALTER TABLE TestSets ADD FOREIGN KEY (idGenTestCase)        REFERENCES TestCases(idGenTestCase);
+ALTER TABLE TestSets ADD FOREIGN KEY (idGenTestCaseArgs)    REFERENCES TestCaseArgs(idGenTestCaseArgs);
+ALTER TABLE TestSets ADD FOREIGN KEY (idTestResult)         REFERENCES TestResults(idTestResult);
+ALTER TABLE TestSets ADD FOREIGN KEY (idTestSetGangLeader)  REFERENCES TestSets(idTestSet);
+COMMIT;
+
+-- Restore foreign keys.
+LOCK TABLE SchedQueues, TestBoxStatuses, TestResults, TestResultValues IN EXCLUSIVE MODE;
+ALTER TABLE SchedQueues      ADD FOREIGN KEY (idTestSetGangLeader) REFERENCES TestSets(idTestSet) MATCH FULL;
+ALTER TABLE TestBoxStatuses  ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
+ALTER TABLE TestResults      ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
+ALTER TABLE TestResultValues ADD FOREIGN KEY (idTestSet) REFERENCES TestSets(idTestSet) MATCH FULL;
+COMMIT;
+
+\d+ TestSets;
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r12-testresultvalues-3-testsets-3.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r12-testresultvalues-3-testsets-3.pgsql
new file mode 100644
index 0000000..6a93f3e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r12-testresultvalues-3-testsets-3.pgsql
@@ -0,0 +1,48 @@
+-- $Id: tmdb-r12-testresultvalues-3-testsets-3.pgsql $
+--- @file
+-- VBox Test Manager Database - Graph related optimizations for TestResultValues and TestSets.
+--
+
+--
+-- Copyright (C) 2013-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+\d+ TestResultValues
+
+-- Rename index to better show it's purpose.
+ALTER INDEX TestResultValuesNameIdx RENAME TO TestResultValuesGraphIdx;
+COMMIT;
+
+-- Combine the tsCreated and tsDone indexes.
+DROP INDEX TestSetsCreated;
+DROP INDEX TestSetsDone;
+CREATE INDEX TestSetsCreatedDoneIdx ON TestSets (tsCreated, tsDone);
+COMMIT;
+
+-- Create index for graph.
+CREATE INDEX TestSetsGraphBoxIdx ON TestSets (idTestBox, tsCreated, tsDone, idBuildCategory, idTestCase);
+COMMIT;
+
+\d+ TestResultValues
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r13-buildcategories-1-vcsrevisions-1.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r13-buildcategories-1-vcsrevisions-1.pgsql
new file mode 100644
index 0000000..cfbba83
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r13-buildcategories-1-vcsrevisions-1.pgsql
@@ -0,0 +1,124 @@
+-- $Id: tmdb-r13-buildcategories-1-vcsrevisions-1.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds an sRepository to Builds and creates a new VcsRepositories table.
+--
+
+--
+-- Copyright (C) 2013-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+--
+-- Cleanup after failed runs.
+--
+DROP TABLE NewBuildCategories;
+DROP TABLE OldBuildCategories;
+
+--
+-- Drop foreign keys on this table.
+--
+ALTER TABLE Builds DROP CONSTRAINT NewBuilds_idBuildCategory_fkey;
+ALTER TABLE Builds DROP CONSTRAINT Builds_idBuildCategory_fkey;
+ALTER TABLE TestSets DROP CONSTRAINT TestSets_idBuildCategory_fkey;
+
+-- Die on error from now on.
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+\d+ BuildCategories;
+
+--
+-- Create the new version of the table and filling with the content of the old.
+--
+CREATE TABLE NewBuildCategories (
+    --- The build type identifier.
+    idBuildCategory     INTEGER     PRIMARY KEY DEFAULT NEXTVAL('BuildCategoryIdSeq')  NOT NULL,
+    --- Product.
+    -- The product name.  For instance 'VBox' or 'VBoxTestSuite'.
+    sProduct            TEXT        NOT NULL,
+    --- The version control repository name.
+    sRepository         TEXT        NOT NULL,
+    --- The branch name (in the version control system).
+    sBranch             TEXT        NOT NULL,
+    --- The build type.
+    -- See KBUILD_BLD_TYPES in kBuild for a list of standard build types.
+    sType               TEXT        NOT NULL,
+    --- Array of the 'sOs.sCpuArch' supported by the build.
+    -- See KBUILD_OSES in kBuild for a list of standard target OSes, and
+    -- KBUILD_ARCHES for a list of standard architectures.
+    --
+    -- @remarks 'os-agnostic' is used if the build doesn't really target any
+    --          specific OS or if it targets all applicable OSes.
+    --          'noarch' is used if the build is architecture independent or if
+    --          all applicable architectures are handled.
+    --          Thus, 'os-agnostic.noarch' will run on all build boxes.
+    --
+    -- @note    The array shall be sorted ascendingly to prevent unnecessary duplicates!
+    --
+    asOsArches          TEXT ARRAY  NOT NULL,
+
+    UNIQUE (sProduct, sRepository, sBranch, sType, asOsArches)
+);
+COMMIT;
+\d+ NewBuildCategories
+
+INSERT INTO NewBuildCategories (idBuildCategory, sProduct, sRepository, sBranch, sType, asOsArches)
+    SELECT idBuildCategory, sProduct, 'vbox', sBranch, sType, asOsArches
+    FROM   BuildCategories
+COMMIT;
+
+-- Switch the tables.
+ALTER TABLE BuildCategories RENAME TO OldBuildCategories;
+ALTER TABLE NewBuildCategories RENAME TO BuildCategories;
+COMMIT;
+
+-- Drop the old table.
+DROP TABLE OldBuildCategories;
+COMMIT;
+
+-- Restore foreign keys.
+LOCK TABLE Builds, TestSets;
+ALTER TABLE Builds   ADD FOREIGN KEY (idBuildCategory)      REFERENCES BuildCategories(idBuildCategory);
+ALTER TABLE TestSets ADD FOREIGN KEY (idBuildCategory)      REFERENCES BuildCategories(idBuildCategory);
+COMMIT;
+
+\d+ BuildCategories;
+
+
+--
+-- Create the new VcsRevisions table.
+--
+CREATE TABLE VcsRevisions (
+    --- The version control tree name.
+    sRepository         TEXT        NOT NULL,
+    --- The version control tree revision number.
+    iRevision           INTEGER     NOT NULL,
+    --- When the revision was created (committed).
+    tsCreated           TIMESTAMP WITH TIME ZONE  NOT NULL,
+    --- The name of the committer.
+    -- @note Not to be confused with uidAuthor and test manager users.
+    sAuthor             TEXT,
+    --- The commit message.
+    sMessage            TEXT,
+
+    UNIQUE (sRepository, iRevision)
+);
+COMMIT;
+\d+ VcsRevisions;
+
diff --git a/src/VBox/ValidationKit/testmanager/db/tmdb-r14-testboxes-2.pgsql b/src/VBox/ValidationKit/testmanager/db/tmdb-r14-testboxes-2.pgsql
new file mode 100644
index 0000000..99048eb
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/db/tmdb-r14-testboxes-2.pgsql
@@ -0,0 +1,191 @@
+-- $Id: tmdb-r14-testboxes-2.pgsql $
+--- @file
+-- VBox Test Manager Database - Adds sCpuName, lCpuRevision and sReport to TestBoxes.
+--
+
+--
+-- Copyright (C) 2013-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+DROP TABLE OldTestBoxes;
+DROP TABLE NewTestBoxes;
+
+\d TestBoxes;
+
+\set ON_ERROR_STOP 1
+\set AUTOCOMMIT 0
+
+LOCK TABLE TestBoxStatuses IN ACCESS EXCLUSIVE MODE;
+LOCK TABLE TestSets        IN ACCESS EXCLUSIVE MODE;
+LOCK TABLE TestBoxes       IN ACCESS EXCLUSIVE MODE;
+
+DROP INDEX TestBoxesUuidIdx;
+
+--
+-- Rename the original table, drop constrains and foreign key references so we
+-- get the right name automatic when creating the new one.
+--
+ALTER TABLE TestBoxes RENAME TO OldTestBoxes;
+
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_ccpus_check;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_check;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_cmbmemory_check;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_cmbscratch_check;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_pctscaletimeout_check;
+
+ALTER TABLE TestBoxStatuses DROP CONSTRAINT TestBoxStatuses_idGenTestBox_fkey;
+ALTER TABLE TestSets        DROP CONSTRAINT TestSets_idGenTestBox_fkey;
+
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_pkey;
+ALTER TABLE OldTestBoxes DROP CONSTRAINT testboxes_idgentestbox_key;
+
+--
+-- Create the new table, filling it with the current TestBoxes content.
+--
+CREATE TABLE TestBoxes (
+    --- The fixed testbox ID.
+    -- This is assigned when the testbox is created and will never change.
+    idTestBox           INTEGER     DEFAULT NEXTVAL('TestBoxIdSeq')  NOT NULL,
+    --- When this row starts taking effect (inclusive).
+    tsEffective         TIMESTAMP WITH TIME ZONE  DEFAULT current_timestamp  NOT NULL,
+    --- When this row stops being tsEffective (exclusive).
+    tsExpire            TIMESTAMP WITH TIME ZONE  DEFAULT TIMESTAMP WITH TIME ZONE 'infinity'  NOT NULL,
+    --- The user id of the one who created/modified this entry.
+    -- When modified automatically by the testbox, NULL is used.
+    -- Non-unique foreign key: Users(uid)
+    uidAuthor           INTEGER     DEFAULT NULL,
+    --- Generation ID for this row.
+    -- This is primarily for referencing by TestSets.
+    idGenTestBox        INTEGER     UNIQUE DEFAULT NEXTVAL('TestBoxGenIdSeq')  NOT NULL,
+
+    --- The testbox IP.
+    -- This is from the webserver point of view and automatically updated on
+    -- SIGNON.  The test setup doesn't permit for IP addresses to change while
+    -- the testbox is operational, because this will break gang tests.
+    ip                  inet        NOT NULL,
+    --- The system or firmware UUID.
+    -- This uniquely identifies the testbox when talking to the server.  After
+    -- SIGNON though, the testbox will also provide idTestBox and ip to
+    -- establish its identity beyond doubt.
+    uuidSystem          uuid        NOT NULL,
+    --- The testbox name.
+    -- Usually similar to the DNS name.
+    sName               text        NOT NULL,
+    --- Optional testbox description.
+    -- Intended for describing the box as well as making other relevant notes.
+    sDescription        text        DEFAULT NULL,
+
+    --- Reference to the scheduling group that this testbox is a member of.
+    -- Non-unique foreign key: SchedGroups(idSchedGroup)
+    -- A testbox is always part of a group, the default one nothing else.
+    idSchedGroup        INTEGER     DEFAULT 1  NOT NULL,
+
+    --- Indicates whether this testbox is enabled.
+    -- A testbox gets disabled when we're doing maintenance, debugging a issue
+    -- that happens only on that testbox, or some similar stuff.  This is an
+    -- alternative to deleting the testbox.
+    fEnabled            BOOLEAN     DEFAULT NULL,
+
+    --- The kind of lights-out-management.
+    enmLomKind          LomKind_T   DEFAULT 'none'::LomKind_T  NOT NULL,
+    --- The IP adress of the lights-out-management.
+    -- This can be NULL if enmLomKind is 'none', otherwise it must contain a valid address.
+    ipLom               inet        DEFAULT NULL,
+
+    --- Timeout scale factor, given as a percent.
+    -- This is a crude adjustment of the test case timeout for slower hardware.
+    pctScaleTimeout     smallint    DEFAULT 100  NOT NULL  CHECK (pctScaleTimeout > 10 AND pctScaleTimeout < 20000),
+
+    --- @name Scheduling properties (reported by testbox script).
+    -- @{
+    --- Same abbrieviations as kBuild, see KBUILD_OSES.
+    sOs                 text        DEFAULT NULL,
+    --- Informational, no fixed format.
+    sOsVersion          text        DEFAULT NULL,
+    --- Same as CPUID reports (GenuineIntel, AuthenticAMD, CentaurHauls, ...).
+    sCpuVendor          text        DEFAULT NULL,
+    --- Same as kBuild - x86, amd64, ... See KBUILD_ARCHES.
+    sCpuArch            text        DEFAULT NULL,
+    --- The CPU name if available.
+    sCpuName            text        DEFAULT NULL,
+    --- Number identifying the CPU family/model/stepping/whatever.
+    -- For x86 and AMD64 type CPUs, this will on the following format:
+    --   (EffFamily << 24) | (EffModel << 8) | Stepping.
+    lCpuRevision        bigint      DEFAULT NULL,
+    --- Number of CPUs, CPU cores and CPU threads.
+    cCpus               smallint    DEFAULT NULL  CHECK (cCpus IS NULL OR cCpus > 0),
+    --- Set if capable of hardware virtualization.
+    fCpuHwVirt          boolean     DEFAULT NULL,
+    --- Set if capable of nested paging.
+    fCpuNestedPaging    boolean     DEFAULT NULL,
+    --- Set if CPU capable of 64-bit (VBox) guests.
+    fCpu64BitGuest      boolean     DEFAULT NULL,
+    --- Set if chipset with usable IOMMU (VT-d / AMD-Vi).
+    fChipsetIoMmu       boolean     DEFAULT NULL,
+    --- The (approximate) memory size in megabytes (rounded down to nearest 4 MB).
+    cMbMemory           bigint      DEFAULT NULL  CHECK (cMbMemory IS NULL OR cMbMemory > 0),
+    --- The amount of scratch space in megabytes (rounded down to nearest 64 MB).
+    cMbScratch          bigint      DEFAULT NULL  CHECK (cMbScratch IS NULL OR cMbScratch >= 0),
+    --- Free form hardware and software report field.
+    sReport             text        DEFAULT NULL,
+    --- @}
+
+    --- The testbox script revision number, serves the purpose of a version number.
+    -- Probably good to have when scheduling upgrades as well for status purposes.
+    iTestBoxScriptRev   INTEGER     DEFAULT 0  NOT NULL,
+    --- The python sys.hexversion (layed out as of 2.7).
+    -- Good to know which python versions we need to support.
+    iPythonHexVersion   INTEGER     DEFAULT NULL,
+
+    --- Pending command.
+    -- @note We put it here instead of in TestBoxStatuses to get history.
+    enmPendingCmd       TestBoxCmd_T  DEFAULT 'none'::TestBoxCmd_T  NOT NULL,
+
+    PRIMARY KEY (idTestBox, tsExpire),
+
+    --- Nested paging requires hardware virtualization.
+    CHECK (fCpuNestedPaging IS NULL OR (fCpuNestedPaging <> TRUE OR fCpuHwVirt = TRUE))
+);
+
+INSERT INTO TestBoxes ( idTestBox, tsEffective, tsExpire, uidAuthor, idGenTestBox, ip, uuidSystem, sName, sDescription,
+           idSchedGroup, fEnabled, enmLomKind, ipLom, pctScaleTimeout, sOs, sOsVersion, sCpuVendor, sCpuArch, sCpuName,
+           lCpuRevision, cCpus, fCpuHwVirt, fCpuNestedPaging, fCpu64BitGuest, fChipsetIoMmu, cMbMemory, cMbScratch, sReport,
+           iTestBoxScriptRev, iPythonHexVersion, enmPendingCmd )
+    SELECT idTestBox, tsEffective, tsExpire, uidAuthor, idGenTestBox, ip, uuidSystem, sName, sDescription,
+           idSchedGroup, fEnabled, enmLomKind, ipLom, pctScaleTimeout, sOs, sOsVersion, sCpuVendor, sCpuArch, NULL,
+           NULL,        cCpus, fCpuHwVirt, fCpuNestedPaging, fCpu64BitGuest, fChipsetIoMmu, cMbMemory, cMbScratch, NULL,
+           iTestBoxScriptRev, iPythonHexVersion, enmPendingCmd
+    FROM OldTestBoxes;
+
+-- Add index.
+CREATE UNIQUE INDEX TestBoxesUuidIdx ON TestBoxes (uuidSystem, tsExpire);
+
+-- Restore foreign key references to the table.
+ALTER TABLE TestBoxStatuses ADD  CONSTRAINT TestBoxStatuses_idGenTestBox_fkey  FOREIGN KEY (idGenTestBox) REFERENCES TestBoxes(idGenTestBox);
+ALTER TABLE TestSets ADD  CONSTRAINT TestSets_idGenTestBox_fkey  FOREIGN KEY (idGenTestBox) REFERENCES TestBoxes(idGenTestBox);
+
+-- Drop the old table.
+DROP TABLE OldTestBoxes;
+
+COMMIT;
+
+\d TestBoxes;
+
diff --git a/src/VBox/ValidationKit/testmanager/debug/Makefile.kmk b/src/VBox/ValidationKit/testmanager/debug/Makefile.kmk
new file mode 100644
index 0000000..df27b62
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/debug/Makefile.kmk
@@ -0,0 +1,36 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+$(evalcall def_vbox_validationkit_process_js_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testmanager/debug/__init__.py b/src/VBox/ValidationKit/testmanager/debug/__init__.py
new file mode 100644
index 0000000..1fef390
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/debug/__init__.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# $Id: __init__.py $
+
+"""
+Test Manager - Debug Utilities.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
diff --git a/src/VBox/ValidationKit/testmanager/debug/add_testbox.pgsql b/src/VBox/ValidationKit/testmanager/debug/add_testbox.pgsql
new file mode 100644
index 0000000..903c27a
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/debug/add_testbox.pgsql
@@ -0,0 +1,66 @@
+-- $Id: add_testbox.pgsql $
+--- @file
+-- Test data.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+\connect testmanager;
+
+INSERT INTO users (sUsername, sNickname, sFullName, sLoginName)
+           VALUES ('testmanager', 'testmanager', 'testmanager', 'testmanager');
+
+INSERT INTO testboxes (uidAuthor,
+                       ip,
+                       uuidSystem,
+                       sName,
+                       fEnabled,
+                       sOs,
+                       sOsVersion,
+                       sCpuVendor,
+                       sCpuArch,
+                       cCpus,
+                       fCpuHwVirt,
+                       fCpuNestedPaging,
+                       fCpu64BitGuest,
+                       fChipsetIoMmu,
+                       cMbMemory,
+                       cMbScratch)
+
+       VALUES         (1,
+                       '127.0.0.1',
+                       '9394c36a-cb2f-3c7f-b987-9f54a4519bbc',
+                       'localhost',
+                       TRUE,
+                       'LINUX',
+                       '1.0',
+                       'Intel',
+                       'AMD64',
+                       2,
+                       TRUE,
+                       TRUE,
+                       TRUE,
+                       TRUE,
+                       1024,
+                       1024);
+
diff --git a/src/VBox/ValidationKit/testmanager/debug/cgiprofiling.py b/src/VBox/ValidationKit/testmanager/debug/cgiprofiling.py
new file mode 100755
index 0000000..ee77c87
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/debug/cgiprofiling.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: cgiprofiling.py $
+
+"""
+Debug - CGI Profiling.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+def profileIt(fnMain, sAppendToElement = 'main', sSort = 'time'):
+    """
+    Profiles a main() type function call (no parameters, returns int) and
+    outputs a hacky HTML section.
+    """
+
+    #
+    # Execute it.
+    #
+    import cProfile;
+    oProfiler = cProfile.Profile();
+    rc = oProfiler.runcall(fnMain);
+
+    #
+    # Output HTML to stdout (CGI assumption).
+    #
+    print('<div id="debug2"><br>\n' # Lazy BR-layouting!!
+          '  <h2>Profiler Output</h2>\n'
+          '  <pre>');
+    try:
+        oProfiler.print_stats(sort = sSort);
+    except Exception, oXcpt:
+        print('<p><pre>%s</pre></p>\n' % (oXcpt,));
+    else:
+        print('</pre>\n');
+    oProfiler = None;
+    print('</div>\n');
+
+    #
+    # Trick to move the section in under the SQL trace.
+    #
+    print('<script lang="script/javascript">\n'
+          'var oMain = document.getElementById(\'%s\');\n'
+          'if (oMain) {\n'
+          '    oMain.appendChild(document.getElementById(\'debug2\'));\n'
+          '}\n'
+          '</script>\n'
+          % (sAppendToElement, ) );
+
+    return rc;
+
diff --git a/src/VBox/ValidationKit/testmanager/debug/functions.pgsql b/src/VBox/ValidationKit/testmanager/debug/functions.pgsql
new file mode 100644
index 0000000..e2c661a
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/debug/functions.pgsql
@@ -0,0 +1,72 @@
+-- $Id: functions.pgsql $
+--- @file
+-- ?????????????????????????
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+\connect testmanager;
+
+DROP FUNCTION authenticate_testbox(inet, uuid);
+DROP FUNCTION testbox_status_set(integer, TestBoxState_T);
+
+-- Authenticate Test Box record by IP and UUID and set its state to IDLE
+-- Args: IP, UUID
+CREATE OR REPLACE FUNCTION authenticate_testbox(inet, uuid) RETURNS testboxes AS $$
+    DECLARE
+        _ip ALIAS FOR $1;
+        _uuidSystem ALIAS FOR $2;
+        _box TestBoxes;
+    BEGIN
+        -- Find Test Box record
+        SELECT *
+            FROM testboxes
+            WHERE ip=_ip AND uuidSystem=_uuidSystem INTO _box;
+        IF FOUND THEN
+            -- Update Test Box status if exists
+            UPDATE TestBoxStatuses SET enmState='idle' WHERE idTestBox=_box.idTestBox;
+            IF NOT FOUND THEN
+                -- Otherwise, add new record to TestBoxStatuses table
+                INSERT
+                    INTO TestBoxStatuses(idTestBox, idGenTestBox, enmState)
+                    VALUES (_box.idTestBox, _box.idGenTestBox, 'idle');
+            END IF;
+        END IF;
+        return _box;
+    END;
+$$ LANGUAGE plpgsql;
+
+-- Set Test Box status and make sure if it has been set
+-- Args: Test Box ID, new status
+CREATE OR REPLACE FUNCTION testbox_status_set(integer, TestBoxState_T) RETURNS VOID AS $$
+    DECLARE
+        _box ALIAS FOR $1;
+        _status ALIAS FOR $2;
+    BEGIN
+        -- Update Test Box status if exists
+        UPDATE TestBoxStatuses SET enmState=_status WHERE idTestBox=_box;
+        IF NOT FOUND THEN
+            RAISE EXCEPTION 'Test Box (#%) was not found in database', _box;
+        END IF;
+    END;
+$$ LANGUAGE plpgsql;
+
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ValidationKit/testmanager/htdocs/Makefile.kup
similarity index 100%
copy from src/VBox/Devices/Network/lwip/Makefile.kup
copy to src/VBox/ValidationKit/testmanager/htdocs/Makefile.kup
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/css/common.css b/src/VBox/ValidationKit/testmanager/htdocs/css/common.css
new file mode 100644
index 0000000..c8ea2b7
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/htdocs/css/common.css
@@ -0,0 +1,815 @@
+/* $Id: common.css $ */
+/** @file
+ * Test Manager - Common CSS.
+ */
+
+/*
+ * Copyright (C) 2012-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*
+ * Basic HTML elements.
+ */
+* {
+    margin:         0;
+    padding:        0;
+}
+
+html, body {
+    height:         100%;
+}
+
+body {
+    background:     #f9f9f9 repeat-y center;
+    font-family:    Georgia, "Times New Roman", Times, serif;
+    font-family:    Arial, Helvetica, sans-serif;
+    font-size:      0.8em;
+    color:          #2f2f2f;
+}
+
+p, ul, ol {
+    margin-top:     0;
+    line-height:    180%;
+}
+
+div {
+    margin:         0;
+    padding:        0;
+}
+
+h1, h2, h3 {
+    margin:         0px 0 10px 0;
+    padding:        0;
+    font-weight:    normal;
+    color:          #2f2f2f;
+}
+h1 {
+    font-size:      2.4em;
+}
+h2 {
+    font-size:      2.0em;
+}
+h3 {
+    font-size:      1.5em;
+}
+
+dl {
+    margin-bottom:  10px;
+}
+
+
+/*
+ * Misc class stuff.
+ */
+.clear {
+    clear:          both;
+}
+
+.left {
+    float:          left;
+}
+
+.right {
+    float:          right;
+}
+
+
+
+/*
+ * The general layout.
+ *
+ * Note! Not quite sure if something like this will work well everywhere...
+ *       Will get back to that when the logic and content is all there, not
+ *       worth wasting more time on CSS now.
+ */
+
+#logo {
+    position:       fixed;
+    width:          100%;
+    height:         92px;
+    top:            0;
+    left:           0;
+    right:          0;
+    bottom:         auto;
+}
+
+#logo img {
+    height:         64px;
+    width:          64px;
+}
+
+#header {
+    position:       fixed;
+    width:          100%;  /** @todo this is too wide, darn! */
+    height:         92px;
+    top:            0;
+    left:           118px;
+    right:          0;
+    bottom:         auto;
+}
+
+#login {
+    position:       absolute;
+    top:            0;
+    left:           auto;
+    right:          0;
+    right:          10px;
+    bottom:         auto;
+}
+
+#side-menu {
+    position:       fixed;
+    width:          110px;
+    height:         auto;
+    top:            92px;
+    left:           0;
+    right:          auto;
+    bottom:         0;
+}
+
+#top-menu {
+    position:       fixed;
+    width:          auto;
+    height:         auto;
+    max-height:     28px;
+    top:            92px;
+    left:           118px;
+    right:          0;
+    bottom:         auto;
+}
+
+#main {
+    position:       fixed;
+    width:          auto;
+    height:         auto;
+    top:            118px;  /**< header + top-menu + padding. */
+    right:          0;
+    bottom:         0;
+    left:           118px;
+    overflow:       auto;
+    padding-top:    16px;
+    padding-left:   10px;
+    padding-right:  10px;
+}
+
+
+/*
+ * Header and logo.
+ */
+#logo {
+    padding:        16px 32px 16px 32px;
+}
+
+#header {
+    margin-top:     22px;
+    margin-left:    10px;
+    text-align:     left;
+}
+
+
+/*
+ * Navigation menus (common).
+ */
+#top-menu, #side-menu {
+    font-weight:    bold;
+    font-size:      1em;
+    font-family:    Arial, Helvetica, sans-serif;
+    background-color: #c0d0e0;
+    padding:        2px 2px 2px 2px;
+    border-radius:  12px;
+}
+
+#top-menu ul li a, #side-menu ul li a {
+    text-decoration: none;
+    color:          #000000;
+    font-weight:    bold;
+    font-size:      1em;
+    font-family:    Arial, Helvetica, sans-serif;
+}
+
+#top-menu a:hover, #top-menu .current_page_item a, #side-menu a:hover, #side-menu .current_page_item a {
+    text-decoration: none;
+    color:          #b23c1c;
+}
+
+
+/*
+ * Navigation in on the left side.
+ */
+
+#side-menu {
+    padding-top:    36px;
+    margin-right:   3px;
+    margin-left:    3px;
+    margin-bottom:  3px;
+}
+
+#side-menu p {
+    margin-right:   3px;
+    margin-left:    3px;
+}
+
+#side-menu ul {
+    list-style:     none;
+    margin-left:    3px;
+    margin-right:   3px;
+}
+
+#side-menu li {
+    padding-bottom: 0.8em;
+    line-height:    1.2em;
+    text-align:     center;
+}
+
+#side-footer {
+    position:       absolute;
+    top:            auto;
+    bottom:         0;
+    left:           auto;
+    right:          auto;
+
+    width:          107px;
+    margin-left:    2px;
+    margin-right:   2px;
+    padding-top:    1em;
+    padding-bottom: 0.8em;
+    border-top:     thin white ridge;
+}
+
+#side-footer p {
+    margin-left:    3px;
+    margin-right:   3px;
+    font-family:    "Lucida Sans Unicode", "Lucida Grande", sans-serif;
+    font-size:      8px;
+    font-style:     normal;
+    text-align:     center;
+}
+
+
+/*
+ * Navigation in the header.
+ */
+#top-menu {
+   margin:          0 auto;
+   margin-right:    10px;
+   margin-left:     10px;
+}
+
+#top-menu ul li a {
+   padding:         .1em 1em;
+}
+
+#top-menu ul li {
+   display:         inline;
+}
+
+#top-menu ul {
+   margin:          0;
+   padding:         0;
+   list-style:      none;
+   list-style-type: none;
+   text-align:      center;
+}
+
+#top-menu a {
+   border:          none;
+}
+
+#top-menu .current_page_item a {
+}
+
+
+/*
+ * Error message (typically a paragraph in the body).
+ */
+.tmerrormsg {
+    color:          #ff0000;
+    white-space:    pre;
+    font-family:    Monospace, "Lucida Console", "Courier New", "Courier";
+    display:        block;
+    border:         1px solid;
+    margin:         1em;
+    padding:        0.6em;
+}
+
+
+/*
+ * Generic odd/even row and sub-row attribs.
+ */
+.tmeven {
+    background-color: #ececec;
+}
+
+.tmodd {
+    background-color: #fcfcfc;
+}
+
+/** @todo adjust the sub row colors (see change logs for examples). */
+.tmeveneven {
+    background-color: #d8e0f8;
+}
+
+.tmevenodd {
+    background-color: #e8f0ff;
+}
+
+.tmoddeven {
+    background-color: #d8e0f8;
+}
+
+.tmoddodd {
+    background-color: #e8f0ff;
+}
+
+
+/*
+ * Generic thead class (first-child doesn't work for multiple header rows).
+ */
+.tmheader {
+   background-color: #d0d0d0;
+   color:            black;
+}
+
+
+/*
+ * A typical table.
+ */
+/* table.tmtable th {
+    background-color: #d0d0d0;
+    color:            black;
+} */
+
+table.tmtable caption {
+    text-align:     left;
+}
+
+table.tmtable {
+    width:          100%;
+    border-spacing: 0px;
+}
+
+table.tmtable th {
+    font-size:      1.3em;
+    text-align:     center;
+}
+
+table.tmtable, table.tmtable tr, table.tmtable td, table.tmtable th {
+    vertical-align: top;
+}
+
+table.tmtable {
+    border-left:    1px solid black;
+    border-top:     1px solid black;
+    border-right:   none;
+    border-bottom:  none;
+}
+
+table.tmtable td, table.tmtable th {
+    border-left:    none;
+    border-top:     none;
+    border-right:   1px solid black;
+    border-bottom:  1px solid black;
+}
+
+table.tmtable td {
+    padding-left:   3px;
+    padding-right:  3px;
+    padding-top:    3px;
+    padding-bottom: 3px;
+}
+
+table.tmtable th {
+    padding-left:   3px;
+    padding-right:  3px;
+    padding-top:    6px;
+    padding-bottom: 6px;
+}
+
+.tmtable td {
+}
+
+
+/*
+ * Table placed inside of a big table used to display *all* stuff of a category.
+ */
+
+table.tminnertbl tr:nth-child(odd) {
+    background-color: #e8e8e8;
+}
+table.tminnertbl tr:nth-child(even) {
+    background-color: #f8f8f8;
+}
+table.tminnertbl tr:first-child {
+    background-color: #d0d0d0;
+    color:            black;
+}
+
+table.tminnertbl {
+    border-style:    dashed;
+    border-spacing:  1px;
+    border-width:    1px;
+    border-color:    gray;
+    border-collapse: separate;
+}
+
+table.tminnertbl th, table.tminnertbl td {
+    font-size:      1em;
+    text-align:     center;
+    border-style:   none;
+    padding:        1px;
+    border-width:   1px;
+    border-color:   #FFFFF0;
+}
+
+/*
+ * Table placed inside a form.
+ */
+table.tmformtbl {
+    border-style:   none;
+    border-spacing: 1px;
+    border-width:   1px;
+    border-collapse: separate;
+}
+
+table.tmformtbl th, table.tmformtbl td {
+    font-size:      1em;
+    padding-left:   0.5em;
+    padding-right:  0.5em;
+    padding-bottom: 1px;
+    padding-top:    1px;
+    border-width:   1px;
+}
+
+table.tmformtbl th, table.tmformtbl thead {
+    background-color: #d0d0d0;
+    font-size:      1em;
+    font-weight:    bold;
+}
+
+table.tmformtbl tr.tmodd {
+    background:     #e2e2e2;
+}
+
+
+/*
+ * Change log table (used with tmtable).
+ */
+table.tmchangelog > tbody  {
+    font-size:      1em;
+}
+
+table.tmchangelog tr.tmodd  td:nth-child(1),
+table.tmchangelog tr.tmeven td:nth-child(1),
+table.tmchangelog tr.tmodd  td:nth-child(2),
+table.tmchangelog tr.tmeven td:nth-child(2) {
+    min-width:      5em;
+    max-width:      10em; /* futile */
+}
+
+table.tmchangelog tr.tmeven {
+    background-color: #e8f0ff;
+}
+
+table.tmchangelog tr.tmodd {
+    background-color: #d8e0f8;
+}
+
+table.tmchangelog tr.tmoddeven, table.tmchangelog tr.tmeveneven {
+    background-color: #fcfcfc;
+}
+
+table.tmchangelog tr.tmoddodd, table.tmchangelog tr.tmevenodd {
+    background-color: #ececec;
+}
+
+table.tmchangelog tr.tmoddeven, table.tmchangelog tr.tmeveneven, table.tmchangelog tr.tmoddodd, table.tmchangelog tr.tmevenodd {
+    font-size:      0.86em;
+}
+
+
+/*
+ * Elements to be shows on *Show All* pages.
+ */
+
+ul.tmshowall  {
+    margin-left:    15px;
+    margin-right:   15px;
+}
+
+li.tmshowall {
+    margin-left:    5px;
+    margin-right:   5px;
+}
+
+
+/*
+ * List navigation table
+ */
+table.tmlistnavtab {
+    width:          100%;
+}
+
+
+/*
+ * A typical form.
+ *
+ * Note! This _has_ to be redone. It sucks for the wide fields and such.
+ */
+.tmform ul {
+    list-style:      none;
+    list-style-type: none;
+}
+
+.tmform-field {
+    display:        block;
+    clear:          both;
+}
+
+.tmform-field label {
+    float:          left;
+    text-align:     right;
+    width:          20%;
+    min-width:      10em;
+    max-width:      16em;
+    padding-right:  0.9em;
+}
+
+.tmform-error-desc {
+    display:        block;
+    color:          #ff0000;
+    font-style:     italic;
+}
+
+.tmform-button {
+    float:          left;
+    padding-top:    0.8em;
+}
+
+.tmform-field input {
+}
+
+.tmform-field-tiny-int input {
+    width:          2em;
+}
+
+.tmform-field-int input {
+    width:          6em;
+}
+
+.tmform-field-long input {
+    width:          9em;
+}
+
+.tmform-field-submit input {
+}
+
+.tmform-field-string input {
+    width:          24em;
+}
+
+.tmform-field-timestamp input {
+    width:          20em;
+}
+
+.tmform-field-uuid input {
+    width:          24em;
+}
+
+.tmform-field-wide input {
+    width:          78%;
+    overflow:       hidden;
+}
+
+.tmform-field-wide100 input {
+    width:          100%;
+    overflow:       hidden;
+}
+
+.tmform-field-list {
+    padding-top:    2px;
+    padding-bottom: 2px;
+}
+
+.tmform-checkboxes-container {
+    padding:        3px;
+    overflow:       auto;
+    border:         1px dotted #cccccc;
+}
+
+.tmform-checkbox-holder {
+    float:          left;
+    min-width:      20em;
+}
+
+#tmform-checkbox-list-os-arches .tmform-checkbox-holder {
+    min-width:      11em;
+}
+
+#tmform-checkbox-list-build-types .tmform-checkbox-holder {
+    min-width:      6em;
+}
+
+.tmform-input-readonly {
+    background:     #ADD8EF;
+    color:          #ffffff;
+}
+
+/* (Test case argument variation.) */
+
+table.tmform-innertbl {
+    border-style:   none;
+    border-spacing: 1px;
+    border-width:   1px;
+    border-collapse: separate;
+    width:          78%;
+}
+
+table.tmform-innertbl caption {
+    text-align:     left;
+}
+
+table.tmform-innertbl th, table.tmform-innertbl td {
+    font-size:      1em;
+    text-align:     center;
+    border-style:   none;
+    /* padding-top:    1px;*/
+    /*padding-bottom: 1px;*/
+    padding-left:   2px;
+    padding-right:  2px;
+    border-width:   1px;
+    border-color:   #FFFFF0;
+    background-color: #f9f9f9;
+}
+
+.tmform-inntertbl-td-wide input {
+    width:          100%;
+    overflow:       hidden;
+}
+
+.tmform-inntertbl-td-wide {
+    width:          100%;
+}
+
+
+/*
+ * The test case argument variation table.
+ */
+table.tmform-testcasevars  {
+    border-style:   none;
+    border-spacing: 0px;
+    border-width:   0px;
+    border-collapse: collapse;
+    width:          78%;
+}
+
+table.tmform-testcasevars tbody {
+    border-style:   solid;
+    border-spacing: 1px;
+    border-width:   1px;
+    margin: 2px;
+}
+
+table.tmform-testcasevars td {
+    padding-right:  3px;
+    padding-left:   3px;
+}
+
+table.tmform-testcasevars td:first-child, table.tmform-testcasevars td:nth-child(3) {
+    width:          8em;
+    text-align:     right;
+}
+table.tmform-testcasevars td:nth-child(5) {
+    width:          4em;
+    text-align:     left;
+}
+
+
+.tmform-testcasevars caption {
+    text-align:     left;
+}
+
+tr.tmform-testcasevars-first-row td {
+    padding-top:    0px;
+    padding-bottom: 0px;
+    background-color: #e3e3ec;
+}
+
+.tmform-testcasevars-inner-row td {
+    padding-top:    0px;
+    padding-bottom: 0px;
+}
+
+tr.tmform-testcasevars-final-row td {
+    padding-top:    0px;
+    padding-bottom: 1px;
+}
+
+td.tmform-testcasevars-stupid-border-column {
+    /* Stupid hack. */
+    min-width:      2px;
+    width:          0.1%;
+}
+
+
+
+/*
+ * Log viewer.
+ */
+.tmlog a[href] {
+    background-color:   #e0e0e0;
+    padding-left:       0.8em;
+    padding-right:      0.8em;
+}
+
+.tmlog pre {
+    background-color:   #000000;
+    color:              #00ff00;
+    font-family:        "Monospace", "Lucida Console", "Courier New", "Courier";
+}
+
+
+/*
+ * Debug SQL traceback.
+ */
+#debug, #debug h1, #debug h2, #debug h3,
+#debug2, #debug2 h1, #debug2 h2, #debug2 h3 {
+    color:          #00009f;
+}
+
+table.tmsqltable {
+    border-collapse: collapse;
+}
+
+table.tmsqltable, table.tmsqltable tr, table.tmsqltable td, table.tmsqltable th {
+    border:         1px solid;
+    vertical-align: middle;
+    padding: 0.1ex 0.5ex;
+}
+
+table.tmsqltable pre {
+    text-align:     left;
+}
+
+
+/*
+ * Various more or less common span classes.
+ */
+.tmspan-offline {
+    color:      #f08020;
+    font-size:  0.75em;
+}
+
+.tmspan-online {
+    font-size:  0.75em;
+}
+
+.tmspan-name, .tmspan-osarch {
+    font-weight: bold;
+}
+
+.tmspan-osver1 {
+    font-style: italic;
+}
+
+.tmspan-osver2 {
+    font-style: normal;
+}
+
+
+/*
+ * Subversion tooltip.
+ */
+.tmvcstooltip {
+    padding:    0px;
+    min-width:  50em;
+    overflow:   hidden;
+    border:     0px none;
+}
+
+.tmvcstooltip iframe {
+    padding:    0px;
+    margin:     0px;
+    border:     0px none;
+    width:      100%;
+    overflow:   auto;
+}
+
+
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/css/details.css b/src/VBox/ValidationKit/testmanager/htdocs/css/details.css
new file mode 100644
index 0000000..796df0a
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/htdocs/css/details.css
@@ -0,0 +1,203 @@
+/* $Id: details.css $ */
+/** @file
+ * Test Manager - Test Details CSS.
+ */
+
+/*
+ * Copyright (C) 2012-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+
+/*
+ * The test details page has no side menu, so adjust the top-menu and main
+ * sections so they start at the left border.
+ */
+
+#top-menu, #main {
+    left:           0;
+}
+
+.tmtbl-events {
+
+}
+
+.tmstatusrow-failure, .tmstatusrow-timed-out, .tmstatusrow-rebooted {
+    color: #e80000;
+}
+
+.tmstatusrow-skipped, .tmstatusrow-aborted, .tmstatusrow-bad-testbox {
+    color: #0000f0;
+}
+
+
+/*
+ * Test results.
+ */
+
+/*
+ * Details table on the individual test result page.
+ */
+table.tmtbl-testresult-details {
+    border-style:    dashed;
+    border-spacing:  1px;
+    border-width:    1px;
+    border-color:    gray;
+    border-collapse: separate;
+}
+
+table.tmtbl-testresult-details caption {
+    text-align:     left;
+    font-weight:    bold;
+    font-size:      1.2em;
+}
+
+table.tmtbl-testresult-details td, table.tmtbl-testresult-details th {
+    font-size:      1em;
+    border-style:   none;
+    padding-bottom: 3px;
+    padding-top:    3px;
+    padding-left:   2px;
+    padding-right:  2px;
+    border-width:   1px;
+}
+
+table.tmtbl-testresult-details th {
+    text-align:     left;
+}
+
+.tmtbl-result-details-caption {
+    font-size:      1.2em;
+    font-weight:    bold;
+    text-align:     center;
+    background-color: #c0d0e0;
+}
+
+.tmtbl-result-details-subcaption {
+    text-align:     center;
+}
+
+
+/*
+ * Event log on the individual test result page.
+ */
+.tmtbl-events td {
+    padding-bottom: 1px;
+    padding-top:    1px;
+    padding-left:   1px;
+    padding-right:  1px;
+    vertical-align: top;
+}
+
+.tmtbl-events th {
+    font-size:      1.3em;
+    text-align:     center;
+}
+
+table.tmtbl-events, table.tmtbl-events tr, table.tmtbl-events td, table.tmtbl-events th {
+    border-collapse: collapse;
+}
+
+tr.tmtbl-events-leaf {
+}
+
+tr.tmtbl-events-first {
+    border-top:     1px dotted;
+}
+
+tr.tmtbl-events-value {
+}
+
+tr.tmtbl-events-final {
+    border-bottom:     1px dotted;
+}
+
+
+tr.tmtbl-events-lvl0 td {
+    padding-top:    8px;
+    padding-bottom: 8px;
+}
+
+tr.tmtbl-events-lvl1 td {
+    padding-top:    6px;
+    padding-bottom: 6px;
+}
+
+tr.tmtbl-events-lvl2 td {
+    padding-top:    4px;
+    padding-bottom: 4px;
+}
+
+tr.tmtbl-events-lvl3 td {
+    padding-top:    2px;
+    padding-bottom: 2px;
+}
+
+tr.tmtbl-events-lvl4 td {
+    padding-top:    1px;
+    padding-bottom: 1px;
+}
+
+tr.tmtbl-events-lvl5 td,
+tr.tmtbl-events-lvl6 td,
+tr.tmtbl-events-lvl7 td,
+tr.tmtbl-events-lvl8 td,
+tr.tmtbl-events-lvl9 td,
+tr.tmtbl-events-lvl10 td {
+    padding-top:    0px;
+    padding-bottom: 0px;
+}
+
+td.tmtbl-events-number {
+    text-align:     right;
+}
+
+td.tmtbl-events-number, td.tmtbl-events-unit {
+}
+
+tr.tmtbl-events-value   td:nth-child(3),
+tr.tmtbl-events-file    td:nth-child(3),
+tr.tmtbl-events-message td:nth-child(3) {
+    padding-left:   2em;
+}
+
+tr.tmtbl-events-value   td:nth-child(3),
+tr.tmtbl-events-message td:nth-child(3) {
+    font-style:     italic;
+}
+
+
+/*
+ * Status coloring. (move to common.css?)
+ */
+.tmspan-status-success {
+    color:          green;
+}
+.tmspan-status-skipped {
+    color:          blue;
+}
+.tmspan-status-failure {
+    color:          red;
+}
+.tmspan-status-success, .tmspan-status-skipped, .tmspan-status-failure {
+    font-weight:    bold;
+    text-transform: uppercase;
+}
+
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/css/graphwiz.css b/src/VBox/ValidationKit/testmanager/htdocs/css/graphwiz.css
new file mode 100644
index 0000000..de89694
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/htdocs/css/graphwiz.css
@@ -0,0 +1,227 @@
+/* $Id: graphwiz.css $ */
+/** @file
+ * Test Manager - Graph Wizard CSS.
+ */
+
+/*
+ * Copyright (C) 2012-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+
+/*
+ * The graph wizard page currently has no side menu, so adjust the top-menu
+ * and main sections so they start at the left border.
+ */
+
+#top-menu, #main {
+    left:           0;
+}
+
+.tmtbl-events {
+
+}
+
+/*
+ * Let the top navigation and end selection inputs look alike.
+ */
+#graphwiz-nav, #graphwiz-end-selection {
+    background-color: #c0cbd6;
+    padding-left:   3px;
+    padding-right:  3px;
+    padding-top:    3px;
+    padding-bottom: 3px;
+    margin-left:    1px;
+    margin-right:   1px;
+    margin-top:     3px;
+    margin-bottom:  3px;
+    width:          100%;
+}
+
+
+/*
+ * Navigation and it's inputs.
+ */
+
+#graphwiz-nav {
+    min-height:     4.2em;
+}
+
+#graphwiz-top-1, #graphwiz-top-2 {
+    clear:          both;
+}
+
+#graphwiz-time, #graphwiz-top-options-1, #graphwiz-top-submit, #graphwiz-top-options-2 {
+    display:        block;
+}
+
+#graphwiz-time, #graphwiz-top-submit {
+    margin-left:    1em;
+    margin-right:   2em;
+    float:          left;
+}
+
+#graphwiz-top-options-1, #graphwiz-top-options-2 {
+    margin-left:    2em;
+    margin-right:   1em;
+    float: right;
+}
+
+.graphwiz-pixel-input, .graphwiz-dpi-input, .graphwiz-time-input, .graphwiz-period-input {
+    margin-top:     0.2em;
+    margin-bottom:  0.2em;
+}
+
+.graphwiz-pixel-input {
+    width:          3em;
+    text-align:     right
+}
+
+.graphwiz-dpi-input {
+    width:          2em;
+    text-align:     right
+}
+
+.graphwiz-time-input {
+    width:          18em;
+    text-align:     left
+}
+
+.graphwiz-period-input {
+    width:          4em;
+    text-align:     right
+}
+
+.graphwiz-maxerrorbar-input {
+    width:          2em;
+    text-align:     right;
+}
+
+.graphwiz-fontsize-input {
+    width:          2em;
+    text-align:     right;
+}
+
+.graphwiz-maxpergraph-input {
+    width:          2em;
+    text-align:     right;
+}
+
+/*
+ * The graphs.
+ */
+#graphwiz-graphs {
+    margin-top:     0.5em;
+}
+
+.graphwiz-collection {
+    margin-top:     1em;
+    background-color: #f0f0f0;
+    padding-bottom: 1em;
+}
+
+.graphwiz-src-select {
+    margin-left:    0.2em;
+    margin-right:   0.2em;
+    margin-top:     0.2em;
+    margin-bottom:  0.2em;
+    padding-left:   0.3em;
+    padding-top:    0.3em;
+    padding-bottom: 0.3em;
+    padding-right:  0.3em;
+    font-size:      1.4em;
+}
+
+.graphwiz-graph {
+    margin-left:    1em;
+    margin-right:   1em;
+}
+
+.graphwiz-graph svg {
+    width:          100%;
+}
+
+/*
+ * Table data.
+ */
+table.graphwiz-tab {
+    width:          auto;
+}
+
+.graphwiz-tab td {
+    text-align:     right;
+}
+
+/*
+ * The end selection.
+ */
+#graphwiz-end-selection {
+    margin-top:     1em;
+}
+
+.graphwiz-end-selection-group {
+    clear:          both;
+    display:        block;
+}
+
+.graphwiz-end-selection-group li {
+    display:        block;
+    width:          25%;
+    float:          left;
+}
+
+#graphwiz-buildcategories li, #graphwiz-testcase-variations li {
+    width:          50%;
+}
+
+.graphwiz-end-selection-group label {
+    margin-left:    0.3em;
+    vertical-align: middle;
+}
+
+.graphwiz-end-selection-group input {
+    vertical-align: middle;
+}
+
+.graphwiz-end-selection-group h3 {
+    font-size:      1.2em;
+    font-style:     italic;
+    font-weight:    bold;
+    margin-bottom:  0.26em;
+}
+
+#graphwiz-buildcategories h3, #graphwiz-testcase-variations h3, #graphwiz-end-submit {
+    padding-top:    1em;
+}
+
+#graphwiz-end-submit {
+    clear:          both;
+    display:        block;
+}
+
+
+
+/*
+ * Tool tip tables.
+ */
+table.graphwiz-tt td:nth-child(1) {
+    font-weight: bold;
+}
+
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/css/tooltip.css b/src/VBox/ValidationKit/testmanager/htdocs/css/tooltip.css
new file mode 100644
index 0000000..8b5a712
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/htdocs/css/tooltip.css
@@ -0,0 +1,122 @@
+/* $Id: tooltip.css $ */
+/** @file
+ * Test Manager - Tooltip content (via iframe).
+ */
+
+/*
+ * Copyright (C) 2012-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+/*
+ * Form the main divs in template-tooltip.html.
+ */
+#tooltip {
+    width:          100%;
+}
+
+#tooltip-inner {
+    clear:          both;
+    border:         2px solid black;
+    padding-left:   2px;
+    padding-right:  2px;
+    padding-top:    2px;
+    padding-bottom: 2px
+}
+
+/*
+ * Timeline tooltip.
+ */
+.tmtimelinetooltip {
+    font-size:      1em;
+}
+
+/*
+ * Relative stuff that could also be used for a non-tooltip VCS timeline.
+ */
+.tmvcstimeline-highlighted {
+    background:     #f0f0f0;
+}
+
+.tmvcstimeline h2 {
+    clear:          both;
+    font-size:      120%;
+    background:     #e8e8e8;
+    border-bottom:  1px solid #c8c8c8;
+    border-radius:  3px;
+    margin-left:    0.2em;
+    margin-right:   0.2em;
+    margin-top:     0.2em;
+    margin-bottom:  0.4em;
+    padding-left:   0.2em;
+    padding-right:  0.2em;
+    padding-top:    0.2em;
+    padding-bottom: 0.2em;
+}
+
+.tmvcstimeline dl {
+    margin-left:    0.8em;
+    margin-right:   0.2em;
+    margin-top:     0.2em;
+    margin-bottom:  0.8em;
+}
+
+.tmvcstimeline dt {
+    font-size:      118%;
+    padding-left:   0.2em;
+    margin-top:     0.1em;
+    margin-bottom:  0.0em;
+}
+
+.tmvcstimeline dt, .tmvcstimeline :link, .tmvcstimeline :link:visited, .tmvcstimeline :link:hover {
+    color:          black;
+    text-decoration:  none;
+}
+
+.tmvcstimeline :link:hover {
+    border:         1px dotted black;
+}
+
+.tmvcstimeline-time {
+    font-size:      88%;
+    margin-right:   0.2em;
+}
+
+.tmvcstimeline-time, .tmvcstimeline-author {
+    color:          #5858a0;
+}
+
+.tmvcstimeline-rev {
+    color:          #0000ee;
+}
+
+.tmvcstimeline dd {
+    padding-left:    2em;
+    margin-top:     0.0em;
+    margin-bottom:  0.4em;
+    color:          #424250;
+}
+
+/* This helps highlighting the revision we're showing the tooltip for. */
+.tmvcstimeline :target, .tmvcstimeline :target + dd {
+    background-color: #d8e8ff;
+    padding-top:    0.2em;
+    padding-bottom: 0.2em;
+}
+
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/images/VirtualBox.svg b/src/VBox/ValidationKit/testmanager/htdocs/images/VirtualBox.svg
new file mode 100644
index 0000000..2369828
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/htdocs/images/VirtualBox.svg
@@ -0,0 +1,806 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="256px" height="256px" viewBox="0 0 256 256" enable-background="new 0 0 256 256" xml:space="preserve">
+<g>
+	<rect fill="none" width="256" height="256"/>
+	<g>
+		
+			<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-180.1821" y1="784.8389" x2="-56.9487" y2="784.8389" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#0A2B4D"/>
+			<stop  offset="0.0423" style="stop-color:#7DA5DC"/>
+			<stop  offset="0.0441" style="stop-color:#83A9DE"/>
+			<stop  offset="0.0553" style="stop-color:#A1BFE8"/>
+			<stop  offset="0.067" style="stop-color:#B9D0F0"/>
+			<stop  offset="0.0794" style="stop-color:#CADCF6"/>
+			<stop  offset="0.093" style="stop-color:#D4E4F9"/>
+			<stop  offset="0.1099" style="stop-color:#D7E6FA"/>
+			<stop  offset="0.254" style="stop-color:#D0DCFA"/>
+			<stop  offset="0.42" style="stop-color:#85A0C8"/>
+			<stop  offset="0.57" style="stop-color:#2E4573"/>
+			<stop  offset="0.6978" style="stop-color:#14335E"/>
+			<stop  offset="0.7692" style="stop-color:#1C3866"/>
+			<stop  offset="0.8462" style="stop-color:#4F73AA"/>
+			<stop  offset="0.9153" style="stop-color:#6487B9"/>
+			<stop  offset="1" style="stop-color:#1A3B61"/>
+		</linearGradient>
+		<path fill="url(#SVGID_1_)" d="M129.117,141.783c33.426,0,60.732,23.482,60.732,52.32c0,1.838,0,4.744,0,6.578
+			c0,28.838-27.308,51.803-60.732,51.803c-33.503,0-60.811-22.965-60.811-51.803c0-1.834,0-4.74,0-6.578
+			C68.307,165.266,95.614,141.783,129.117,141.783z"/>
+		
+			<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-150.8486" y1="822.7695" x2="-84.4476" y2="740.7712" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#E1E6FA"/>
+			<stop  offset="0.07" style="stop-color:#B4C3E1"/>
+			<stop  offset="0.11" style="stop-color:#8293B8"/>
+			<stop  offset="0.1551" style="stop-color:#2D4173"/>
+			<stop  offset="0.2888" style="stop-color:#1B2F61"/>
+			<stop  offset="0.5" style="stop-color:#14285A"/>
+			<stop  offset="0.7" style="stop-color:#14285A"/>
+			<stop  offset="0.8663" style="stop-color:#213970"/>
+			<stop  offset="1" style="stop-color:#4164A5"/>
+		</linearGradient>
+		<ellipse fill="url(#SVGID_2_)" cx="129.041" cy="194.065" rx="57.889" ry="49.1"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter" filterUnits="userSpaceOnUse" x="70.895" y="144.746" width="116.292" height="98.638">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="70.895" y="144.746" width="116.292" height="98.638" id="SVGID_3_">
+			<g filter="url(#Adobe_OpacityMaskFilter)">
+				
+					<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="-85.9404" y1="823.8486" x2="-149.3573" y2="739.6917" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+					<stop  offset="0" style="stop-color:#CCCCCC"/>
+					<stop  offset="0.15" style="stop-color:#000000"/>
+				</linearGradient>
+				<ellipse fill="url(#SVGID_4_)" cx="129.041" cy="194.065" rx="58.146" ry="49.319"/>
+			</g>
+		</mask>
+		
+			<radialGradient id="SVGID_5_" cx="-148.8311" cy="824.0654" r="100.2425" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)" gradientUnits="userSpaceOnUse">
+			<stop  offset="0" style="stop-color:#DCE6FA"/>
+			<stop  offset="0.4" style="stop-color:#AAC3EB"/>
+			<stop  offset="1" style="stop-color:#AAC3EB"/>
+		</radialGradient>
+		<ellipse mask="url(#SVGID_3_)" fill="url(#SVGID_5_)" cx="129.041" cy="194.065" rx="58.146" ry="49.319"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_1_" filterUnits="userSpaceOnUse" x="70.895" y="144.746" width="116.292" height="98.638">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="70.895" y="144.746" width="116.292" height="98.638" id="SVGID_6_">
+			<g filter="url(#Adobe_OpacityMaskFilter_1_)">
+				
+					<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="-117.6489" y1="831.0889" x2="-117.6489" y2="732.4512" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+					<stop  offset="0" style="stop-color:#999999"/>
+					<stop  offset="0.05" style="stop-color:#000000"/>
+				</linearGradient>
+				<ellipse fill="url(#SVGID_7_)" cx="129.041" cy="194.065" rx="58.146" ry="49.319"/>
+			</g>
+		</mask>
+		
+			<radialGradient id="SVGID_8_" cx="-148.8311" cy="824.0654" r="100.2425" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)" gradientUnits="userSpaceOnUse">
+			<stop  offset="0" style="stop-color:#DCE6FA"/>
+			<stop  offset="0.4" style="stop-color:#AAC3EB"/>
+			<stop  offset="1" style="stop-color:#AAC3EB"/>
+		</radialGradient>
+		<ellipse mask="url(#SVGID_6_)" fill="url(#SVGID_8_)" cx="129.041" cy="194.065" rx="58.146" ry="49.319"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_2_" filterUnits="userSpaceOnUse" x="70.895" y="144.746" width="116.292" height="98.638">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="70.895" y="144.746" width="116.292" height="98.638" id="SVGID_9_">
+			<g filter="url(#Adobe_OpacityMaskFilter_2_)">
+				
+					<linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="-100.396" y1="829.1719" x2="-134.902" y2="734.3676" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+					<stop  offset="0" style="stop-color:#595959"/>
+					<stop  offset="0.0535" style="stop-color:#282828"/>
+					<stop  offset="0.1" style="stop-color:#000000"/>
+				</linearGradient>
+				<ellipse fill="url(#SVGID_10_)" cx="129.041" cy="194.065" rx="58.146" ry="49.319"/>
+			</g>
+		</mask>
+		
+			<radialGradient id="SVGID_11_" cx="-148.8311" cy="824.0654" r="100.2425" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)" gradientUnits="userSpaceOnUse">
+			<stop  offset="0" style="stop-color:#DCE6FA"/>
+			<stop  offset="0.4" style="stop-color:#AAC3EB"/>
+			<stop  offset="1" style="stop-color:#AAC3EB"/>
+		</radialGradient>
+		<ellipse mask="url(#SVGID_9_)" fill="url(#SVGID_11_)" cx="129.041" cy="194.065" rx="58.146" ry="49.319"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_3_" filterUnits="userSpaceOnUse" x="70.895" y="144.746" width="116.292" height="98.638">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="70.895" y="144.746" width="116.292" height="98.638" id="SVGID_12_">
+			<g filter="url(#Adobe_OpacityMaskFilter_3_)">
+				
+					<linearGradient id="SVGID_13_" gradientUnits="userSpaceOnUse" x1="-134.9023" y1="829.1719" x2="-100.3965" y2="734.368" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+					<stop  offset="0" style="stop-color:#FFFFFF"/>
+					<stop  offset="0.05" style="stop-color:#1A1A1A"/>
+					<stop  offset="0.09" style="stop-color:#000000"/>
+				</linearGradient>
+				<ellipse fill="url(#SVGID_13_)" cx="129.041" cy="194.065" rx="58.146" ry="49.319"/>
+			</g>
+		</mask>
+		
+			<radialGradient id="SVGID_14_" cx="-148.8311" cy="824.0654" r="100.2425" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)" gradientUnits="userSpaceOnUse">
+			<stop  offset="0" style="stop-color:#DCE6FA"/>
+			<stop  offset="0.4" style="stop-color:#AAC3EB"/>
+			<stop  offset="1" style="stop-color:#AAC3EB"/>
+		</radialGradient>
+		<ellipse mask="url(#SVGID_12_)" fill="url(#SVGID_14_)" cx="129.041" cy="194.065" rx="58.146" ry="49.319"/>
+		
+			<linearGradient id="SVGID_15_" gradientUnits="userSpaceOnUse" x1="-178.3818" y1="813.666" x2="-56.8384" y2="813.666" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0.0055" style="stop-color:#3C5A78"/>
+			<stop  offset="0.033" style="stop-color:#6E8CBE"/>
+			<stop  offset="0.123" style="stop-color:#A5BEE1"/>
+			<stop  offset="0.25" style="stop-color:#96AFD2"/>
+			<stop  offset="0.52" style="stop-color:#3C5A87"/>
+			<stop  offset="0.72" style="stop-color:#2B486D"/>
+			<stop  offset="0.9" style="stop-color:#466491"/>
+			<stop  offset="1" style="stop-color:#3C5082"/>
+		</linearGradient>
+		<path fill="url(#SVGID_15_)" d="M189.852,198.923c0,0.61,0,1.222,0,1.759c0,28.838-27.309,52.318-60.733,52.318
+			c-33.501,0-60.81-23.48-60.81-52.318c0-0.537,0-1.146,0-1.759c0,28.761,27.308,52.243,60.81,52.243
+			C162.543,251.166,189.852,227.684,189.852,198.923z"/>
+		
+			<linearGradient id="SVGID_16_" gradientUnits="userSpaceOnUse" x1="-178.1328" y1="776.4775" x2="-57.1652" y2="787.0609" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0.0053" style="stop-color:#9BBEE1"/>
+			<stop  offset="0.0802" style="stop-color:#D2E6FA"/>
+			<stop  offset="0.1337" style="stop-color:#F0F5FF"/>
+			<stop  offset="0.1979" style="stop-color:#F0F5FF"/>
+			<stop  offset="0.35" style="stop-color:#DEE6F0"/>
+			<stop  offset="0.55" style="stop-color:#AFBEDC"/>
+			<stop  offset="0.7" style="stop-color:#96AFD7"/>
+			<stop  offset="0.9091" style="stop-color:#A0B4DC"/>
+			<stop  offset="1" style="stop-color:#6487AF"/>
+		</linearGradient>
+		<path fill="url(#SVGID_16_)" d="M129.041,141.693c-33.563,0-60.771,23.449-60.771,52.371s27.208,52.371,60.771,52.371
+			c33.564,0,60.771-23.449,60.771-52.371C189.813,165.145,162.604,141.693,129.041,141.693z M129.041,243.165
+			c-31.971,0-57.887-21.983-57.887-49.101c0-27.115,25.916-49.104,57.887-49.104c31.973,0,57.889,21.986,57.889,49.104
+			S161.014,243.165,129.041,243.165z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_4_" filterUnits="userSpaceOnUse" x="68.27" y="141.693" width="121.542" height="104.742">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="68.27" y="141.693" width="121.542" height="104.742" id="SVGID_17_">
+			<g filter="url(#Adobe_OpacityMaskFilter_4_)">
+				
+					<linearGradient id="SVGID_18_" gradientUnits="userSpaceOnUse" x1="-117.6489" y1="834.1406" x2="-117.6489" y2="729.4004" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+					<stop  offset="0.35" style="stop-color:#000000"/>
+					<stop  offset="0.6" style="stop-color:#FFFFFF"/>
+				</linearGradient>
+				<ellipse fill="url(#SVGID_18_)" cx="129.041" cy="194.065" rx="60.771" ry="52.37"/>
+			</g>
+		</mask>
+		<path mask="url(#SVGID_17_)" fill="#142355" d="M129.041,141.693c-33.563,0-60.771,23.449-60.771,52.371
+			s27.208,52.371,60.771,52.371c33.564,0,60.771-23.449,60.771-52.371C189.813,165.145,162.604,141.693,129.041,141.693z
+			 M129.041,243.165c-31.971,0-57.887-21.983-57.887-49.101c0-27.115,25.916-49.104,57.887-49.104
+			c31.973,0,57.889,21.986,57.889,49.104S161.014,243.165,129.041,243.165z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_5_" filterUnits="userSpaceOnUse" x="68.27" y="141.693" width="121.542" height="104.742">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="68.27" y="141.693" width="121.542" height="104.742" id="SVGID_19_">
+			<g filter="url(#Adobe_OpacityMaskFilter_5_)">
+				
+					<linearGradient id="SVGID_20_" gradientUnits="userSpaceOnUse" x1="-135.9253" y1="831.9824" x2="-99.3735" y2="731.5574" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+					<stop  offset="0.3" style="stop-color:#000000"/>
+					<stop  offset="1" style="stop-color:#CCCCCC"/>
+				</linearGradient>
+				<ellipse fill="url(#SVGID_20_)" cx="129.041" cy="194.065" rx="60.771" ry="52.37"/>
+			</g>
+		</mask>
+		<path mask="url(#SVGID_19_)" fill="#142355" d="M129.041,141.693c-33.563,0-60.771,23.449-60.771,52.371
+			s27.208,52.371,60.771,52.371c33.564,0,60.771-23.449,60.771-52.371C189.813,165.145,162.604,141.693,129.041,141.693z
+			 M129.041,243.165c-31.971,0-57.887-21.983-57.887-49.101c0-27.115,25.916-49.104,57.887-49.104
+			c31.973,0,57.889,21.986,57.889,49.104S161.014,243.165,129.041,243.165z"/>
+		
+			<radialGradient id="SVGID_21_" cx="-242.0352" cy="-534.5098" r="111.9119" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)" gradientUnits="userSpaceOnUse">
+			<stop  offset="0" style="stop-color:#FFFFFF"/>
+			<stop  offset="1" style="stop-color:#C3D2F0"/>
+		</radialGradient>
+		<path fill="url(#SVGID_21_)" d="M234.529,52.965l-8.549,108.286c-0.113,1.454-0.854,2.812-2.012,3.699l-92.826,71.046
+			c-0.933,0.714-2.037,1.068-3.144,1.068c-1.105,0-2.21-0.354-3.14-1.068l-92.832-71.045c-1.157-0.889-1.897-2.246-2.011-3.7
+			L21.47,52.965c-0.173-2.195,1.062-4.258,3.078-5.141L125.929,3.433c1.318-0.577,2.827-0.577,4.147,0l101.375,44.393
+			C233.467,48.708,234.703,50.771,234.529,52.965z"/>
+		
+			<linearGradient id="SVGID_22_" gradientUnits="userSpaceOnUse" x1="-121.1333" y1="710.2393" x2="-217.5764" y2="629.314" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#FFFFFF"/>
+			<stop  offset="0.9" style="stop-color:#F0F5FF"/>
+			<stop  offset="0.96" style="stop-color:#DCE6F8"/>
+			<stop  offset="0.99" style="stop-color:#C3D2F0"/>
+		</linearGradient>
+		<path fill="url(#SVGID_22_)" d="M22.205,49.877c-1.1,1.812,2.384,3.694,2.678,3.872l99.186,60.164
+			c1.081,0.655,1.748,1.842,1.752,3.109l4.361-0.001c0.004-1.266,0.672-2.454,1.752-3.109l-1.959-3.612
+			c-0.578,0.348-1.229,0.521-1.882,0.521c-0.652,0-1.305-0.173-1.883-0.521L26.503,50.528c-0.292-0.175-0.46-0.499-0.439-0.837
+			C26.063,49.691,23.283,48.1,22.205,49.877z"/>
+		
+			<linearGradient id="SVGID_23_" gradientUnits="userSpaceOnUse" x1="-106.9102" y1="716.4375" x2="-29.1729" y2="623.7938" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#FFFFFF"/>
+			<stop  offset="0.6" style="stop-color:#F5FAFF"/>
+			<stop  offset="0.92" style="stop-color:#E1E6FA"/>
+			<stop  offset="0.97" style="stop-color:#CFDAF4"/>
+			<stop  offset="1" style="stop-color:#C0CFEE"/>
+		</linearGradient>
+		<path fill="url(#SVGID_23_)" d="M233.797,49.876c1.1,1.812-2.385,3.694-2.678,3.872l-99.188,60.163
+			c-1.08,0.655-1.748,1.842-1.752,3.109l-4.36-0.001c-0.005-1.266-0.672-2.454-1.752-3.109l1.958-3.612
+			c0.579,0.348,1.231,0.521,1.882,0.521c0.652,0,1.304-0.172,1.882-0.521l99.707-59.771c0.291-0.175,0.461-0.499,0.438-0.837
+			C229.938,49.69,232.719,48.099,233.797,49.876z"/>
+		
+			<linearGradient id="SVGID_24_" gradientUnits="userSpaceOnUse" x1="-118.689" y1="698.002" x2="-118.689" y2="824.7695" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#FFFFFF"/>
+			<stop  offset="0.9" style="stop-color:#DCE6FF"/>
+			<stop  offset="1" style="stop-color:#C2D4F0"/>
+		</linearGradient>
+		<path fill="url(#SVGID_24_)" d="M128,237.064c-2.653,0-2.922-3.642-2.922-3.642c0.138,0,0.278-0.03,0.405-0.096
+			c0.31-0.155,0.507-0.474,0.507-0.819l-0.17-115.49c-0.005-1.267-0.672-2.454-1.752-3.109l2.142-3.612
+			c0.579,0.348,1.231,0.52,1.883,0.52c0.65,0,1.304-0.172,1.882-0.52l1.959,3.611c-1.082,0.655-1.748,1.843-1.752,3.109
+			l-0.17,115.49c0,0.349,0.194,0.665,0.506,0.819c0.127,0.063,0.268,0.095,0.403,0.095C130.922,233.423,130.654,237.064,128,237.064
+			z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_6_" filterUnits="userSpaceOnUse" x="21.454" y="3" width="213.092" height="234.064">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="21.454" y="3" width="213.092" height="234.064" id="SVGID_25_">
+			<g filter="url(#Adobe_OpacityMaskFilter_6_)">
+				
+					<linearGradient id="SVGID_26_" gradientUnits="userSpaceOnUse" x1="-225.665" y1="639.6367" x2="-23.757" y2="755.2705" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+					<stop  offset="0.78" style="stop-color:#000000"/>
+					<stop  offset="0.8" style="stop-color:#FFFFFF"/>
+				</linearGradient>
+				<path fill="url(#SVGID_26_)" d="M234.529,52.965l-8.549,108.286c-0.113,1.454-0.854,2.812-2.012,3.699l-92.826,71.046
+					c-0.933,0.714-2.037,1.068-3.144,1.068c-1.105,0-2.21-0.354-3.14-1.068l-92.832-71.045c-1.157-0.889-1.897-2.246-2.011-3.7
+					L21.47,52.965c-0.173-2.195,1.062-4.258,3.078-5.141L125.929,3.433c1.318-0.577,2.827-0.577,4.147,0l101.375,44.393
+					C233.467,48.708,234.703,50.771,234.529,52.965z"/>
+			</g>
+		</mask>
+		
+			<linearGradient id="SVGID_27_" gradientUnits="userSpaceOnUse" x1="-213.625" y1="755.2715" x2="-11.7157" y2="639.637" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0.2" style="stop-color:#C3D2F0"/>
+			<stop  offset="0.22" style="stop-color:#7DA0D2"/>
+			<stop  offset="0.2674" style="stop-color:#6E91CD"/>
+			<stop  offset="0.7" style="stop-color:#7396D2"/>
+			<stop  offset="1" style="stop-color:#5A78B4"/>
+		</linearGradient>
+		<path mask="url(#SVGID_25_)" fill="url(#SVGID_27_)" d="M234.529,52.965l-8.549,108.286c-0.113,1.454-0.854,2.812-2.012,3.699
+			l-92.826,71.046c-0.933,0.714-2.037,1.068-3.144,1.068c-1.105,0-2.21-0.354-3.14-1.068l-92.832-71.045
+			c-1.157-0.889-1.897-2.246-2.011-3.7L21.47,52.965c-0.173-2.195,1.062-4.258,3.078-5.141L125.929,3.433
+			c1.318-0.577,2.827-0.577,4.147,0l101.375,44.393C233.467,48.708,234.703,50.771,234.529,52.965z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_7_" filterUnits="userSpaceOnUse" x="21.454" y="3" width="213.092" height="234.064">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="21.454" y="3" width="213.092" height="234.064" id="SVGID_28_">
+			<g filter="url(#Adobe_OpacityMaskFilter_7_)">
+				
+					<linearGradient id="SVGID_29_" gradientUnits="userSpaceOnUse" x1="-213.522" y1="755.417" x2="-12.0263" y2="639.0833" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+					<stop  offset="0.2" style="stop-color:#FFFFFF"/>
+					<stop  offset="0.22" style="stop-color:#000000"/>
+				</linearGradient>
+				<path fill="url(#SVGID_29_)" d="M234.529,52.965l-8.549,108.286c-0.113,1.454-0.854,2.812-2.012,3.699l-92.826,71.046
+					c-0.933,0.714-2.037,1.068-3.144,1.068c-1.105,0-2.21-0.354-3.14-1.068l-92.832-71.045c-1.157-0.889-1.897-2.246-2.011-3.7
+					L21.47,52.965c-0.173-2.195,1.062-4.258,3.078-5.141L125.929,3.433c1.318-0.577,2.827-0.577,4.147,0l101.375,44.393
+					C233.467,48.708,234.703,50.771,234.529,52.965z"/>
+			</g>
+		</mask>
+		
+			<linearGradient id="SVGID_30_" gradientUnits="userSpaceOnUse" x1="-225.354" y1="639.084" x2="-23.8602" y2="755.4165" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#B9C8DC"/>
+			<stop  offset="0.3" style="stop-color:#D7D5EB"/>
+			<stop  offset="0.5" style="stop-color:#D7DCEB"/>
+			<stop  offset="0.78" style="stop-color:#DCDCEB"/>
+			<stop  offset="0.8" style="stop-color:#C3D2F0"/>
+		</linearGradient>
+		<path mask="url(#SVGID_28_)" fill="url(#SVGID_30_)" d="M234.529,52.965l-8.549,108.286c-0.113,1.454-0.854,2.812-2.012,3.699
+			l-92.826,71.046c-0.933,0.714-2.037,1.068-3.144,1.068c-1.105,0-2.21-0.354-3.14-1.068l-92.832-71.045
+			c-1.157-0.889-1.897-2.246-2.011-3.7L21.47,52.965c-0.173-2.195,1.062-4.258,3.078-5.141L125.929,3.433
+			c1.318-0.577,2.827-0.577,4.147,0l101.375,44.393C233.467,48.708,234.703,50.771,234.529,52.965z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_8_" filterUnits="userSpaceOnUse" x="21.454" y="3" width="213.092" height="234.064">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="21.454" y="3" width="213.092" height="234.064" id="SVGID_31_">
+			<g filter="url(#Adobe_OpacityMaskFilter_8_)">
+				
+					<radialGradient id="SVGID_32_" cx="-214.9419" cy="621.7891" r="31.5227" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)" gradientUnits="userSpaceOnUse">
+					<stop  offset="0" style="stop-color:#595959"/>
+					<stop  offset="1" style="stop-color:#000000"/>
+				</radialGradient>
+				<path fill="url(#SVGID_32_)" d="M234.529,52.965l-8.549,108.286c-0.113,1.454-0.854,2.812-2.012,3.699l-92.826,71.046
+					c-0.933,0.714-2.037,1.068-3.144,1.068c-1.105,0-2.21-0.354-3.14-1.068l-92.832-71.045c-1.157-0.889-1.897-2.246-2.011-3.7
+					L21.47,52.965c-0.173-2.195,1.062-4.258,3.078-5.141L125.929,3.433c1.318-0.577,2.827-0.577,4.147,0l101.375,44.393
+					C233.467,48.708,234.703,50.771,234.529,52.965z"/>
+			</g>
+		</mask>
+		<path mask="url(#SVGID_31_)" fill="#E1F5FF" d="M234.529,52.965l-8.549,108.286c-0.113,1.454-0.854,2.812-2.012,3.699
+			l-92.826,71.046c-0.933,0.714-2.037,1.068-3.144,1.068c-1.105,0-2.21-0.354-3.14-1.068l-92.832-71.045
+			c-1.157-0.889-1.897-2.246-2.011-3.7L21.47,52.965c-0.173-2.195,1.062-4.258,3.078-5.141L125.929,3.433
+			c1.318-0.577,2.827-0.577,4.147,0l101.375,44.393C233.467,48.708,234.703,50.771,234.529,52.965z"/>
+		<g>
+			
+				<radialGradient id="SVGID_33_" cx="-118.6724" cy="642.2432" r="64.9423" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)" gradientUnits="userSpaceOnUse">
+				<stop  offset="0" style="stop-color:#19416E"/>
+				<stop  offset="1" style="stop-color:#0A2D64"/>
+			</radialGradient>
+			<path fill="url(#SVGID_33_)" d="M209.039,50.425l-79.438,46.227c-0.477,0.275-1.002,0.412-1.528,0.412
+				c-0.527,0-1.053-0.136-1.528-0.412L46.999,50.426c-0.25-0.145-0.398-0.417-0.384-0.705c0.014-0.288,0.188-0.545,0.449-0.666
+				l79.834-36.784c0.746-0.346,1.604-0.346,2.354,0l79.721,36.783c0.262,0.122,0.435,0.377,0.447,0.667
+				C209.436,50.008,209.287,50.28,209.039,50.425z"/>
+			
+				<radialGradient id="SVGID_34_" cx="-172.187" cy="727.8721" r="56.6285" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)" gradientUnits="userSpaceOnUse">
+				<stop  offset="0" style="stop-color:#19416E"/>
+				<stop  offset="1" style="stop-color:#0A2D64"/>
+			</radialGradient>
+			<path fill="url(#SVGID_34_)" d="M114.98,123.905l0.871,83.976c0.002,0.327-0.178,0.628-0.471,0.775
+				c-0.123,0.063-0.257,0.096-0.391,0.096c-0.18,0-0.361-0.057-0.512-0.169l-74.515-54.917c-0.674-0.497-1.095-1.257-1.153-2.092
+				l-5.652-79.07c-0.024-0.324,0.138-0.634,0.417-0.8c0.277-0.166,0.626-0.162,0.902,0.008l79.063,49.616
+				C114.428,121.886,114.969,122.855,114.98,123.905z"/>
+			
+				<radialGradient id="SVGID_35_" cx="-1001.7246" cy="782.7354" r="61.9365" gradientTransform="matrix(-0.9143 0 0 0.9143 -734.343 -575.489)" gradientUnits="userSpaceOnUse">
+				<stop  offset="0" style="stop-color:#19416E"/>
+				<stop  offset="1" style="stop-color:#0A2D64"/>
+			</radialGradient>
+			<path fill="url(#SVGID_35_)" d="M141.057,123.904l-0.871,83.977c-0.002,0.326,0.179,0.627,0.472,0.775
+				c0.122,0.063,0.258,0.095,0.391,0.095c0.181,0,0.361-0.058,0.513-0.168l74.516-54.917c0.674-0.498,1.096-1.257,1.152-2.093
+				l5.651-79.07c0.022-0.324-0.139-0.634-0.416-0.8c-0.276-0.166-0.627-0.163-0.901,0.008L142.5,121.327
+				C141.609,121.885,141.068,122.854,141.057,123.904z"/>
+		</g>
+		
+			<linearGradient id="SVGID_36_" gradientUnits="userSpaceOnUse" x1="-199.5181" y1="619.627" x2="-37.8291" y2="619.627" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#234B82"/>
+			<stop  offset="0.489" style="stop-color:#3C5A8C"/>
+			<stop  offset="0.5112" style="stop-color:#E6F0FF"/>
+			<stop  offset="0.7697" style="stop-color:#FFFFFF"/>
+			<stop  offset="1" style="stop-color:#F0F5FF"/>
+		</linearGradient>
+		<path fill="url(#SVGID_36_)" d="M208.004,51.354c0.525-0.314,0.885-0.917,0.855-1.54c-0.027-0.646-0.422-1.267-1.006-1.537
+			l-78.097-36.02c-0.534-0.248-1.11-0.371-1.687-0.371s-1.153,0.123-1.688,0.373l-78.2,36.018c-0.586,0.27-1.01,0.89-1.01,1.525
+			c0,0.621,0.328,1.245,0.863,1.557l1.186,0.6c-0.243-0.141-0.387-0.405-0.373-0.686c0.014-0.279,0.182-0.53,0.437-0.647
+			l77.641-35.774c0.726-0.335,1.561-0.335,2.289,0l77.533,35.772c0.254,0.119,0.422,0.367,0.436,0.649
+			c0.015,0.279-0.131,0.544-0.371,0.685L208.004,51.354z"/>
+		
+			<linearGradient id="SVGID_37_" gradientUnits="userSpaceOnUse" x1="-114.0732" y1="786.165" x2="-6.8749" y2="678.9667" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#AFC3D7"/>
+			<stop  offset="0.2033" style="stop-color:#BED2E6"/>
+			<stop  offset="0.5879" style="stop-color:#BED7EB"/>
+			<stop  offset="0.6154" style="stop-color:#3C5A8C"/>
+			<stop  offset="1" style="stop-color:#234B82"/>
+		</linearGradient>
+		<path fill="url(#SVGID_37_)" d="M140.545,205.538l-0.002,0.062c-0.002,0.713,0.405,1.371,1.039,1.696
+			c0.271,0.142,0.572,0.212,0.871,0.212c0.393,0,0.795-0.121,1.137-0.375l71.861-52.972c0.945-0.697,1.549-1.777,1.627-2.957
+			l5.451-76.295c0.003-0.051,0.006-0.087,0.006-0.139c-0.003-0.675-0.354-1.291-0.93-1.635c-0.299-0.178-0.64-0.271-0.979-0.271
+			c-0.346,0-0.701,0.094-1.021,0.296l-0.818,0.53c0.266-0.164,0.6-0.167,0.865-0.008c0.266,0.159,0.424,0.457,0.398,0.767
+			l-5.425,75.887c-0.058,0.803-0.461,1.53-1.106,2.008l-71.517,52.707c-0.146,0.108-0.317,0.161-0.489,0.161
+			c-0.13,0-0.259-0.03-0.375-0.091c-0.281-0.143-0.455-0.43-0.453-0.744L140.545,205.538z"/>
+		
+			<linearGradient id="SVGID_38_" gradientUnits="userSpaceOnUse" x1="-230.4624" y1="678.9688" x2="-123.2632" y2="786.1679" gradientTransform="matrix(1 0 0 1 246.6899 -587.7051)">
+			<stop  offset="0" style="stop-color:#234B82"/>
+			<stop  offset="0.3846" style="stop-color:#3C5A8C"/>
+			<stop  offset="0.4045" style="stop-color:#F0F5FF"/>
+			<stop  offset="0.691" style="stop-color:#FFFFFF"/>
+			<stop  offset="1" style="stop-color:#FFFFFF"/>
+		</linearGradient>
+		<path fill="url(#SVGID_38_)" d="M115.354,204.379c0.003,0.314-0.171,0.604-0.451,0.744c-0.119,0.061-0.247,0.091-0.376,0.091
+			c-0.173,0-0.346-0.053-0.49-0.161L42.52,152.346c-0.646-0.478-1.05-1.205-1.106-2.008l-5.425-75.887
+			c-0.023-0.311,0.133-0.608,0.4-0.767c0.266-0.159,0.601-0.156,0.865,0.008l-0.818-0.53c-0.318-0.203-0.675-0.296-1.02-0.296
+			c-0.341,0-0.681,0.092-0.98,0.271c-0.576,0.344-0.926,0.96-0.928,1.635c0,0.052,0.002,0.087,0.004,0.139l5.452,76.295
+			c0.079,1.18,0.682,2.26,1.628,2.957l71.861,52.972c0.341,0.254,0.743,0.375,1.137,0.375c0.298,0,0.599-0.07,0.871-0.212
+			c0.633-0.325,1.04-0.983,1.038-1.696l-0.002-0.062L115.354,204.379z"/>
+		
+			<linearGradient id="SVGID_39_" gradientUnits="userSpaceOnUse" x1="-242.0366" y1="-525.2964" x2="-242.0366" y2="-418.9517" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+			<stop  offset="0" style="stop-color:#FFFFFF"/>
+			<stop  offset="1" style="stop-color:#BEDCFA"/>
+		</linearGradient>
+		<path fill="url(#SVGID_39_)" d="M229.395,48.914l-99.83-44.127c-0.938-0.417-2.003-0.417-2.947,0L26.605,48.914
+			c-0.312,0.138-0.521,0.437-0.542,0.777c-0.021,0.339,0.147,0.662,0.439,0.837l99.707,59.771c0.578,0.348,1.231,0.52,1.883,0.52
+			c0.652,0,1.303-0.172,1.883-0.52l99.52-59.771c0.293-0.175,0.463-0.499,0.439-0.837C229.912,49.351,229.705,49.051,229.395,48.914
+			z M206.813,50.538l-77.256,44.957c-0.461,0.267-0.976,0.4-1.486,0.4c-0.513,0-1.024-0.132-1.486-0.4L49.224,50.539
+			c-0.243-0.141-0.387-0.405-0.373-0.686c0.013-0.279,0.182-0.53,0.437-0.647l77.641-35.774c0.726-0.335,1.561-0.335,2.29,0
+			l77.531,35.772c0.256,0.119,0.422,0.367,0.438,0.649C207.199,50.133,207.057,50.397,206.813,50.538z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_9_" filterUnits="userSpaceOnUse" x="26.061" y="4.475" width="203.875" height="106.344">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="26.061" y="4.475" width="203.875" height="106.344" id="SVGID_40_">
+			<g filter="url(#Adobe_OpacityMaskFilter_9_)">
+				
+					<linearGradient id="SVGID_41_" gradientUnits="userSpaceOnUse" x1="-318.0947" y1="-509.2944" x2="-164.9766" y2="-420.8915" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+					<stop  offset="0.6" style="stop-color:#000000"/>
+					<stop  offset="1" style="stop-color:#FFFFFF"/>
+				</linearGradient>
+				<path fill="url(#SVGID_41_)" d="M229.395,48.914l-99.83-44.127c-0.938-0.417-2.003-0.417-2.947,0L26.605,48.914
+					c-0.312,0.138-0.521,0.437-0.542,0.777c-0.021,0.339,0.147,0.662,0.439,0.837l99.707,59.771c0.578,0.348,1.231,0.52,1.883,0.52
+					c0.652,0,1.303-0.172,1.883-0.52l99.52-59.771c0.293-0.175,0.463-0.499,0.439-0.837
+					C229.912,49.351,229.705,49.051,229.395,48.914z M206.813,50.538l-77.256,44.957c-0.461,0.267-0.976,0.4-1.486,0.4
+					c-0.513,0-1.024-0.132-1.486-0.4L49.224,50.539c-0.243-0.141-0.387-0.405-0.373-0.686c0.013-0.279,0.182-0.53,0.437-0.647
+					l77.641-35.774c0.726-0.335,1.561-0.335,2.29,0l77.531,35.772c0.256,0.119,0.422,0.367,0.438,0.649
+					C207.199,50.133,207.057,50.397,206.813,50.538z"/>
+			</g>
+		</mask>
+		<path mask="url(#SVGID_40_)" fill="#C3DCFA" d="M229.395,48.914l-99.83-44.127c-0.938-0.417-2.003-0.417-2.947,0L26.605,48.914
+			c-0.312,0.138-0.521,0.437-0.542,0.777c-0.021,0.339,0.147,0.662,0.439,0.837l99.707,59.771c0.578,0.348,1.231,0.52,1.883,0.52
+			c0.652,0,1.303-0.172,1.883-0.52l99.52-59.771c0.293-0.175,0.463-0.499,0.439-0.837C229.912,49.351,229.705,49.051,229.395,48.914
+			z M206.813,50.538l-77.256,44.957c-0.461,0.267-0.976,0.4-1.486,0.4c-0.513,0-1.024-0.132-1.486-0.4L49.224,50.539
+			c-0.243-0.141-0.387-0.405-0.373-0.686c0.013-0.279,0.182-0.53,0.437-0.647l77.641-35.774c0.726-0.335,1.561-0.335,2.29,0
+			l77.531,35.772c0.256,0.119,0.422,0.367,0.438,0.649C207.199,50.133,207.057,50.397,206.813,50.538z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_10_" filterUnits="userSpaceOnUse" x="26.061" y="4.475" width="203.875" height="106.344">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="26.061" y="4.475" width="203.875" height="106.344" id="SVGID_42_">
+			<g filter="url(#Adobe_OpacityMaskFilter_10_)">
+				
+					<linearGradient id="SVGID_43_" gradientUnits="userSpaceOnUse" x1="-284.3638" y1="-514.6699" x2="-199.7078" y2="-413.781" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+					<stop  offset="0" style="stop-color:#7A7A7A"/>
+					<stop  offset="0.3048" style="stop-color:#000000"/>
+				</linearGradient>
+				<path fill="url(#SVGID_43_)" d="M229.395,48.914l-99.83-44.127c-0.938-0.417-2.003-0.417-2.947,0L26.605,48.914
+					c-0.312,0.138-0.521,0.437-0.542,0.777c-0.021,0.339,0.147,0.662,0.439,0.837l99.707,59.771c0.578,0.348,1.231,0.52,1.883,0.52
+					c0.652,0,1.303-0.172,1.883-0.52l99.52-59.771c0.293-0.175,0.463-0.499,0.439-0.837
+					C229.912,49.351,229.705,49.051,229.395,48.914z M206.813,50.538l-77.256,44.957c-0.461,0.267-0.976,0.4-1.486,0.4
+					c-0.513,0-1.024-0.132-1.486-0.4L49.224,50.539c-0.243-0.141-0.387-0.405-0.373-0.686c0.013-0.279,0.182-0.53,0.437-0.647
+					l77.641-35.774c0.726-0.335,1.561-0.335,2.29,0l77.531,35.772c0.256,0.119,0.422,0.367,0.438,0.649
+					C207.199,50.133,207.057,50.397,206.813,50.538z"/>
+			</g>
+		</mask>
+		
+			<linearGradient id="SVGID_44_" gradientUnits="userSpaceOnUse" x1="-268.7026" y1="-510.4141" x2="-216.3228" y2="-419.6894" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+			<stop  offset="0.0053" style="stop-color:#FFF5F0"/>
+			<stop  offset="0.25" style="stop-color:#FFFFFF"/>
+		</linearGradient>
+		<path mask="url(#SVGID_42_)" fill="url(#SVGID_44_)" d="M229.395,48.914l-99.83-44.127c-0.938-0.417-2.003-0.417-2.947,0
+			L26.605,48.914c-0.312,0.138-0.521,0.437-0.542,0.777c-0.021,0.339,0.147,0.662,0.439,0.837l99.707,59.771
+			c0.578,0.348,1.231,0.52,1.883,0.52c0.652,0,1.303-0.172,1.883-0.52l99.52-59.771c0.293-0.175,0.463-0.499,0.439-0.837
+			C229.912,49.351,229.705,49.051,229.395,48.914z M206.813,50.538l-77.256,44.957c-0.461,0.267-0.976,0.4-1.486,0.4
+			c-0.513,0-1.024-0.132-1.486-0.4L49.224,50.539c-0.243-0.141-0.387-0.405-0.373-0.686c0.013-0.279,0.182-0.53,0.437-0.647
+			l77.641-35.774c0.726-0.335,1.561-0.335,2.29,0l77.531,35.772c0.256,0.119,0.422,0.367,0.438,0.649
+			C207.199,50.133,207.057,50.397,206.813,50.538z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_11_" filterUnits="userSpaceOnUse" x="26.061" y="4.475" width="203.875" height="106.344">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="26.061" y="4.475" width="203.875" height="106.344" id="SVGID_45_">
+			<g filter="url(#Adobe_OpacityMaskFilter_11_)">
+				
+					<linearGradient id="SVGID_46_" gradientUnits="userSpaceOnUse" x1="-302.0186" y1="-413.8936" x2="-182.0531" y2="-514.5565" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+					<stop  offset="0" style="stop-color:#141414"/>
+					<stop  offset="0.25" style="stop-color:#000000"/>
+				</linearGradient>
+				<path fill="url(#SVGID_46_)" d="M229.395,48.914l-99.83-44.127c-0.938-0.417-2.003-0.417-2.947,0L26.605,48.914
+					c-0.312,0.138-0.521,0.437-0.542,0.777c-0.021,0.339,0.147,0.662,0.439,0.837l99.707,59.771c0.578,0.348,1.231,0.52,1.883,0.52
+					c0.652,0,1.303-0.172,1.883-0.52l99.52-59.771c0.293-0.175,0.463-0.499,0.439-0.837
+					C229.912,49.351,229.705,49.051,229.395,48.914z M206.813,50.538l-77.256,44.957c-0.461,0.267-0.976,0.4-1.486,0.4
+					c-0.513,0-1.024-0.132-1.486-0.4L49.224,50.539c-0.243-0.141-0.387-0.405-0.373-0.686c0.013-0.279,0.182-0.53,0.437-0.647
+					l77.641-35.774c0.726-0.335,1.561-0.335,2.29,0l77.531,35.772c0.256,0.119,0.422,0.367,0.438,0.649
+					C207.199,50.133,207.057,50.397,206.813,50.538z"/>
+			</g>
+		</mask>
+		<path mask="url(#SVGID_45_)" fill="#2B388F" d="M229.395,48.914l-99.83-44.127c-0.938-0.417-2.003-0.417-2.947,0L26.605,48.914
+			c-0.312,0.138-0.521,0.437-0.542,0.777c-0.021,0.339,0.147,0.662,0.439,0.837l99.707,59.771c0.578,0.348,1.231,0.52,1.883,0.52
+			c0.652,0,1.303-0.172,1.883-0.52l99.52-59.771c0.293-0.175,0.463-0.499,0.439-0.837C229.912,49.351,229.705,49.051,229.395,48.914
+			z M206.813,50.538l-77.256,44.957c-0.461,0.267-0.976,0.4-1.486,0.4c-0.513,0-1.024-0.132-1.486-0.4L49.224,50.539
+			c-0.243-0.141-0.387-0.405-0.373-0.686c0.013-0.279,0.182-0.53,0.437-0.647l77.641-35.774c0.726-0.335,1.561-0.335,2.29,0
+			l77.531,35.772c0.256,0.119,0.422,0.367,0.438,0.649C207.199,50.133,207.057,50.397,206.813,50.538z"/>
+		
+			<linearGradient id="SVGID_47_" gradientUnits="userSpaceOnUse" x1="-321.6987" y1="-603.7334" x2="-268.8858" y2="-512.2586" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+			<stop  offset="0.0053" style="stop-color:#E6E1E1"/>
+			<stop  offset="0.5" style="stop-color:#E3E0DC"/>
+			<stop  offset="1" style="stop-color:#EEE9E1"/>
+		</linearGradient>
+		<path fill="url(#SVGID_47_)" d="M125.82,117.02c-0.005-1.267-0.672-2.453-1.752-3.109L24.881,53.748
+			c-0.294-0.178-0.658-0.178-0.951,0.001c-0.292,0.179-0.459,0.505-0.432,0.847l8.144,106.359c0.079,1.038,0.599,1.994,1.429,2.624
+			l91.455,69.657c0.161,0.123,0.357,0.188,0.552,0.188c0.138,0,0.278-0.031,0.405-0.095c0.311-0.155,0.508-0.474,0.507-0.819
+			L125.82,117.02z M113.735,205.9c-0.118,0.061-0.247,0.091-0.375,0.091c-0.174,0-0.347-0.054-0.492-0.161l-71.516-52.707
+			c-0.646-0.479-1.051-1.206-1.107-2.008L34.82,75.227c-0.023-0.311,0.133-0.608,0.4-0.768c0.266-0.159,0.601-0.156,0.865,0.008
+			l75.882,47.62c0.853,0.535,1.372,1.466,1.384,2.473l0.835,80.597C114.19,205.471,114.018,205.758,113.735,205.9z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_12_" filterUnits="userSpaceOnUse" x="23.495" y="53.614" width="102.495" height="179.81">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="23.495" y="53.614" width="102.495" height="179.81" id="SVGID_48_">
+			<g filter="url(#Adobe_OpacityMaskFilter_12_)">
+				
+					<linearGradient id="SVGID_49_" gradientUnits="userSpaceOnUse" x1="-218.2163" y1="-602.4976" x2="-372.3692" y2="-513.4973" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+					<stop  offset="0.2" style="stop-color:#000000"/>
+					<stop  offset="0.9" style="stop-color:#FFFFFF"/>
+				</linearGradient>
+				<path fill="url(#SVGID_49_)" d="M125.82,117.02c-0.005-1.267-0.672-2.453-1.752-3.109L24.881,53.748
+					c-0.294-0.178-0.658-0.178-0.951,0.001c-0.292,0.179-0.459,0.505-0.432,0.847l8.144,106.359
+					c0.079,1.038,0.599,1.994,1.429,2.624l91.455,69.657c0.161,0.123,0.357,0.188,0.552,0.188c0.138,0,0.278-0.031,0.405-0.095
+					c0.311-0.155,0.508-0.474,0.507-0.819L125.82,117.02z M113.735,205.9c-0.118,0.061-0.247,0.091-0.375,0.091
+					c-0.174,0-0.347-0.054-0.492-0.161l-71.516-52.707c-0.646-0.479-1.051-1.206-1.107-2.008L34.82,75.227
+					c-0.023-0.311,0.133-0.608,0.4-0.768c0.266-0.159,0.601-0.156,0.865,0.008l75.882,47.62c0.853,0.535,1.372,1.466,1.384,2.473
+					l0.835,80.597C114.19,205.471,114.018,205.758,113.735,205.9z"/>
+			</g>
+		</mask>
+		
+			<linearGradient id="SVGID_50_" gradientUnits="userSpaceOnUse" x1="-225.4541" y1="-631.8145" x2="-355.862" y2="-476.4005" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+			<stop  offset="0" style="stop-color:#E6D2F0"/>
+			<stop  offset="1" style="stop-color:#C3C8DC"/>
+		</linearGradient>
+		<path mask="url(#SVGID_48_)" fill="url(#SVGID_50_)" d="M125.82,117.02c-0.005-1.267-0.672-2.453-1.752-3.109L24.881,53.748
+			c-0.294-0.178-0.658-0.178-0.951,0.001c-0.292,0.179-0.459,0.505-0.432,0.847l8.144,106.359c0.079,1.038,0.599,1.994,1.429,2.624
+			l91.455,69.657c0.161,0.123,0.357,0.188,0.552,0.188c0.138,0,0.278-0.031,0.405-0.095c0.311-0.155,0.508-0.474,0.507-0.819
+			L125.82,117.02z M113.735,205.9c-0.118,0.061-0.247,0.091-0.375,0.091c-0.174,0-0.347-0.054-0.492-0.161l-71.516-52.707
+			c-0.646-0.479-1.051-1.206-1.107-2.008L34.82,75.227c-0.023-0.311,0.133-0.608,0.4-0.768c0.266-0.159,0.601-0.156,0.865,0.008
+			l75.882,47.62c0.853,0.535,1.372,1.466,1.384,2.473l0.835,80.597C114.19,205.471,114.018,205.758,113.735,205.9z"/>
+		
+			<linearGradient id="SVGID_51_" gradientUnits="userSpaceOnUse" x1="-162.3706" y1="-603.7349" x2="-215.1844" y2="-512.2589" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+			<stop  offset="0" style="stop-color:#7896BE"/>
+			<stop  offset="1" style="stop-color:#4164A5"/>
+		</linearGradient>
+		<path fill="url(#SVGID_51_)" d="M232.068,53.75c-0.293-0.18-0.654-0.18-0.951-0.001l-99.186,60.162
+			c-1.08,0.655-1.748,1.843-1.752,3.109l-0.17,115.49c0,0.348,0.196,0.665,0.506,0.819c0.129,0.063,0.268,0.095,0.405,0.095
+			c0.195,0,0.392-0.063,0.554-0.188l91.457-69.657c0.828-0.629,1.348-1.585,1.428-2.623l8.145-106.359
+			C232.527,54.254,232.361,53.93,232.068,53.75z M215.791,151.115c-0.057,0.802-0.459,1.529-1.104,2.008l-71.52,52.707
+			c-0.145,0.107-0.318,0.161-0.491,0.161c-0.128,0-0.257-0.03-0.375-0.091c-0.28-0.145-0.454-0.433-0.45-0.744l0.834-80.597
+			c0.014-1.007,0.531-1.938,1.383-2.473l75.886-47.62c0.264-0.165,0.599-0.167,0.862-0.008c0.269,0.159,0.425,0.456,0.4,0.768
+			L215.791,151.115z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_13_" filterUnits="userSpaceOnUse" x="130.01" y="53.615" width="102.496" height="179.809">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="130.01" y="53.615" width="102.496" height="179.809" id="SVGID_52_">
+			<g filter="url(#Adobe_OpacityMaskFilter_13_)">
+				
+					<linearGradient id="SVGID_53_" gradientUnits="userSpaceOnUse" x1="-148.5908" y1="-581.1997" x2="-238.9791" y2="-529.0141" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+					<stop  offset="0.0053" style="stop-color:#808080"/>
+					<stop  offset="0.6" style="stop-color:#000000"/>
+				</linearGradient>
+				<path fill="url(#SVGID_53_)" d="M232.068,53.75c-0.293-0.18-0.654-0.18-0.951-0.001l-99.186,60.162
+					c-1.08,0.655-1.748,1.843-1.752,3.109l-0.17,115.49c0,0.348,0.196,0.665,0.506,0.819c0.129,0.063,0.268,0.095,0.405,0.095
+					c0.195,0,0.392-0.063,0.554-0.188l91.457-69.657c0.828-0.629,1.348-1.585,1.428-2.623l8.145-106.359
+					C232.527,54.254,232.361,53.93,232.068,53.75z M215.791,151.115c-0.057,0.802-0.459,1.529-1.104,2.008l-71.52,52.707
+					c-0.145,0.107-0.318,0.161-0.491,0.161c-0.128,0-0.257-0.03-0.375-0.091c-0.28-0.145-0.454-0.433-0.45-0.744l0.834-80.597
+					c0.014-1.007,0.531-1.938,1.383-2.473l75.886-47.62c0.264-0.165,0.599-0.167,0.862-0.008c0.269,0.159,0.425,0.456,0.4,0.768
+					L215.791,151.115z"/>
+			</g>
+		</mask>
+		<path mask="url(#SVGID_52_)" fill="#78A0E6" d="M232.068,53.75c-0.293-0.18-0.654-0.18-0.951-0.001l-99.186,60.162
+			c-1.08,0.655-1.748,1.843-1.752,3.109l-0.17,115.49c0,0.348,0.196,0.665,0.506,0.819c0.129,0.063,0.268,0.095,0.405,0.095
+			c0.195,0,0.392-0.063,0.554-0.188l91.457-69.657c0.828-0.629,1.348-1.585,1.428-2.623l8.145-106.359
+			C232.527,54.254,232.361,53.93,232.068,53.75z M215.791,151.115c-0.057,0.802-0.459,1.529-1.104,2.008l-71.52,52.707
+			c-0.145,0.107-0.318,0.161-0.491,0.161c-0.128,0-0.257-0.03-0.375-0.091c-0.28-0.145-0.454-0.433-0.45-0.744l0.834-80.597
+			c0.014-1.007,0.531-1.938,1.383-2.473l75.886-47.62c0.264-0.165,0.599-0.167,0.862-0.008c0.269,0.159,0.425,0.456,0.4,0.768
+			L215.791,151.115z"/>
+		<defs>
+			<filter id="Adobe_OpacityMaskFilter_14_" filterUnits="userSpaceOnUse" x="130.01" y="53.615" width="102.496" height="179.809">
+				<feColorMatrix  type="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0"/>
+			</filter>
+		</defs>
+		<mask maskUnits="userSpaceOnUse" x="130.01" y="53.615" width="102.496" height="179.809" id="SVGID_54_">
+			<g filter="url(#Adobe_OpacityMaskFilter_14_)">
+				
+					<linearGradient id="SVGID_55_" gradientUnits="userSpaceOnUse" x1="-210.332" y1="-652.9912" x2="-176.5425" y2="-461.3605" gradientTransform="matrix(1 0 0 -1 370.0347 -414.4775)">
+					<stop  offset="0.0053" style="stop-color:#808080"/>
+					<stop  offset="0.4" style="stop-color:#000000"/>
+				</linearGradient>
+				<path fill="url(#SVGID_55_)" d="M232.068,53.75c-0.293-0.18-0.654-0.18-0.951-0.001l-99.186,60.162
+					c-1.08,0.655-1.748,1.843-1.752,3.109l-0.17,115.49c0,0.348,0.196,0.665,0.506,0.819c0.129,0.063,0.268,0.095,0.405,0.095
+					c0.195,0,0.392-0.063,0.554-0.188l91.457-69.657c0.828-0.629,1.348-1.585,1.428-2.623l8.145-106.359
+					C232.527,54.254,232.361,53.93,232.068,53.75z M215.791,151.115c-0.057,0.802-0.459,1.529-1.104,2.008l-71.52,52.707
+					c-0.145,0.107-0.318,0.161-0.491,0.161c-0.128,0-0.257-0.03-0.375-0.091c-0.28-0.145-0.454-0.433-0.45-0.744l0.834-80.597
+					c0.014-1.007,0.531-1.938,1.383-2.473l75.886-47.62c0.264-0.165,0.599-0.167,0.862-0.008c0.269,0.159,0.425,0.456,0.4,0.768
+					L215.791,151.115z"/>
+			</g>
+		</mask>
+		<path mask="url(#SVGID_54_)" fill="#7896BE" d="M232.068,53.75c-0.293-0.18-0.654-0.18-0.951-0.001l-99.186,60.162
+			c-1.08,0.655-1.748,1.843-1.752,3.109l-0.17,115.49c0,0.348,0.196,0.665,0.506,0.819c0.129,0.063,0.268,0.095,0.405,0.095
+			c0.195,0,0.392-0.063,0.554-0.188l91.457-69.657c0.828-0.629,1.348-1.585,1.428-2.623l8.145-106.359
+			C232.527,54.254,232.361,53.93,232.068,53.75z M215.791,151.115c-0.057,0.802-0.459,1.529-1.104,2.008l-71.52,52.707
+			c-0.145,0.107-0.318,0.161-0.491,0.161c-0.128,0-0.257-0.03-0.375-0.091c-0.28-0.145-0.454-0.433-0.45-0.744l0.834-80.597
+			c0.014-1.007,0.531-1.938,1.383-2.473l75.886-47.62c0.264-0.165,0.599-0.167,0.862-0.008c0.269,0.159,0.425,0.456,0.4,0.768
+			L215.791,151.115z"/>
+		<g id="text_3_">
+			<g>
+				<path fill="#FFFFFF" d="M49.103,122.684c-0.36-0.256-0.717-0.627-1.054-1.077c-0.337-0.45-0.654-0.981-0.936-1.557
+					c-0.281-0.577-0.526-1.199-0.719-1.834c-0.192-0.634-0.332-1.281-0.403-1.907c-0.07-0.625-0.064-1.169,0.006-1.617
+					c0.07-0.449,0.206-0.8,0.394-1.043c0.189-0.242,0.432-0.373,0.718-0.38c0.285-0.008,0.613,0.109,0.973,0.367l4.473,3.189
+					c0.36,0.256,0.718,0.628,1.056,1.08c0.337,0.452,0.657,0.984,0.939,1.562c0.282,0.579,0.528,1.203,0.721,1.84
+					c0.193,0.636,0.334,1.285,0.404,1.911c0.07,0.626,0.064,1.169-0.007,1.617c-0.071,0.447-0.208,0.797-0.398,1.037
+					c-0.19,0.24-0.435,0.369-0.721,0.375c-0.287,0.005-0.616-0.113-0.976-0.371L49.103,122.684 M52.382,114.425l-4.682-3.337
+					c-0.555-0.397-1.063-0.577-1.504-0.567c-0.441,0.012-0.817,0.216-1.109,0.591c-0.293,0.374-0.502,0.919-0.611,1.611
+					c-0.109,0.693-0.117,1.533-0.008,2.5c0.108,0.963,0.325,1.963,0.622,2.943c0.298,0.98,0.677,1.943,1.112,2.835
+					c0.435,0.891,0.926,1.712,1.447,2.409c0.521,0.697,1.073,1.271,1.628,1.667l4.68,3.342c0.557,0.397,1.065,0.581,1.506,0.57
+					c0.442-0.009,0.819-0.212,1.112-0.583c0.293-0.372,0.503-0.915,0.613-1.604c0.11-0.69,0.119-1.529,0.01-2.493
+					c-0.108-0.968-0.324-1.97-0.623-2.954c-0.298-0.983-0.678-1.949-1.115-2.844c-0.435-0.895-0.927-1.717-1.449-2.416
+					C53.492,115.396,52.938,114.821,52.382,114.425 M64.026,122.726l-6.789-4.84l1.575,13.998l1.548,1.105l-1.295-11.521
+					l5.131,3.659c0.18,0.129,0.36,0.314,0.528,0.54c0.169,0.225,0.328,0.491,0.469,0.778c0.141,0.289,0.262,0.6,0.359,0.917
+					c0.095,0.317,0.165,0.642,0.2,0.955c0.034,0.313,0.032,0.585-0.002,0.811c-0.036,0.226-0.103,0.402-0.197,0.522
+					c-0.095,0.123-0.216,0.188-0.359,0.192c-0.143,0.003-0.308-0.055-0.489-0.184l-4.374-3.13l5.418,10.305l2.253,1.607
+					l-3.628-6.758l0.713,0.51c0.376,0.269,0.72,0.393,1.02,0.386c0.299-0.006,0.555-0.142,0.753-0.394
+					c0.199-0.252,0.342-0.619,0.417-1.086c0.075-0.469,0.082-1.035,0.008-1.689c-0.073-0.653-0.219-1.329-0.42-1.994
+					c-0.203-0.666-0.459-1.32-0.755-1.925c-0.295-0.606-0.628-1.164-0.981-1.637C64.775,123.383,64.401,122.994,64.026,122.726
+					 M87.361,139.361l-5.595-3.986c-0.558-0.398-1.068-0.581-1.511-0.57c-0.444,0.01-0.823,0.213-1.118,0.588
+					c-0.295,0.373-0.507,0.918-0.619,1.611c-0.111,0.691-0.122,1.536-0.013,2.503c0.109,0.966,0.325,1.968,0.624,2.95
+					c0.298,0.982,0.679,1.949,1.116,2.844c0.438,0.896,0.931,1.719,1.454,2.417c0.523,0.699,1.077,1.274,1.635,1.673l4.802,3.43
+					l0.645-1.813l-5.616-4.009c-0.362-0.258-0.721-0.63-1.059-1.083c-0.339-0.452-0.659-0.984-0.942-1.563
+					c-0.283-0.58-0.529-1.205-0.723-1.84c-0.193-0.639-0.333-1.285-0.403-1.912c-0.07-0.627-0.063-1.173,0.009-1.621
+					c0.072-0.447,0.209-0.802,0.4-1.041c0.192-0.242,0.438-0.373,0.725-0.379c0.288-0.008,0.618,0.112,0.98,0.371l4.571,3.26
+					L87.361,139.361 M89.758,141.07l-1.557-1.109l1.415,12.684c0.01,0.088,0.024,0.177,0.043,0.268
+					c0.018,0.092,0.041,0.184,0.068,0.273c0.028,0.092,0.06,0.186,0.097,0.278c0.037,0.093,0.078,0.187,0.124,0.279
+					c0.044,0.089,0.089,0.174,0.138,0.256c0.048,0.079,0.099,0.153,0.15,0.224c0.052,0.067,0.105,0.131,0.16,0.187
+					c0.054,0.057,0.108,0.103,0.164,0.146l7.112,5.076l0.64-1.816l-7.267-5.188L89.758,141.07 M106.35,152.898l-5.617-4.004
+					c-0.561-0.399-1.073-0.586-1.519-0.576c-0.447,0.011-0.826,0.214-1.123,0.589c-0.297,0.373-0.508,0.919-0.62,1.612
+					c-0.112,0.694-0.123,1.535-0.015,2.506c0.107,0.969,0.324,1.971,0.622,2.953c0.298,0.983,0.679,1.953,1.116,2.849
+					c0.438,0.896,0.932,1.719,1.457,2.421c0.525,0.701,1.081,1.279,1.642,1.679l4.817,3.44l0.643-1.818l-5.633-4.021
+					c-0.298-0.213-0.596-0.506-0.882-0.855c-0.285-0.354-0.561-0.762-0.815-1.215c-0.254-0.451-0.488-0.941-0.691-1.455
+					c-0.203-0.512-0.374-1.046-0.506-1.582l6.679,4.766l0.644-1.817l-7.597-5.419c0.025-0.42,0.098-0.776,0.212-1.063
+					c0.113-0.286,0.268-0.5,0.457-0.635c0.19-0.135,0.412-0.19,0.664-0.161c0.25,0.031,0.529,0.15,0.828,0.362l4.584,3.271
+					L106.35,152.898 M72.648,128.752c-0.1-0.07-0.194-0.119-0.282-0.145c-0.087-0.027-0.169-0.032-0.242-0.018
+					c-0.075,0.016-0.14,0.053-0.198,0.107c-0.058,0.057-0.107,0.132-0.146,0.227l-3.404,9.787l1.829,1.307l2.79-8.179l2.878,7.683
+					l-4.148-2.959l1.189,3.117l4.199,2.998l1.145,3.088l1.831,1.308l-6.404-16.808c-0.068-0.17-0.142-0.33-0.222-0.483
+					c-0.08-0.152-0.166-0.294-0.254-0.425s-0.181-0.248-0.275-0.352C72.838,128.906,72.743,128.82,72.648,128.752"/>
+			</g>
+			<path fill="#FFFFFF" d="M127.647,21.402L64.145,50.701l63.045,36.036l64.158-36.036L127.647,21.402z M127.253,81.504
+				L72.909,50.768l35.185-16.416l8.502,3.661L94.557,59.727l37.996-15.501l-13.538,15.697l24.135-10.007l-12.231,15.239
+				l12.886,7.128L127.253,81.504z M136.936,63.977l18.508-23.021l-23.217,9.484l12.947-15.172L110.25,49.59l12.425-12.426
+				l-10.397-4.773l15.369-7.194l55.001,25.571l-34.4,19.096L136.936,63.977z"/>
+			<g>
+				<path fill="#FFFFFF" d="M155.916,147.47l-1.908,1.384c-0.084,0.539-0.174,1.1-0.269,1.681c-0.099,0.577-0.198,1.18-0.306,1.803
+					c-0.105,0.622-0.222,1.267-0.338,1.929c-0.121,0.664-0.244,1.351-0.373,2.055c-0.134,0.705-0.263,1.388-0.388,2.045
+					c-0.123,0.658-0.246,1.295-0.364,1.908c-0.119,0.612-0.236,1.203-0.351,1.771c-0.111,0.565-0.224,1.112-0.33,1.634
+					c-0.06-0.505-0.114-1.013-0.17-1.523c-0.058-0.514-0.108-1.027-0.162-1.551c-0.053-0.52-0.104-1.045-0.151-1.574
+					c-0.052-0.529-0.099-1.063-0.144-1.604c-0.047-0.541-0.093-1.068-0.133-1.583c-0.039-0.515-0.074-1.015-0.109-1.502
+					c-0.03-0.489-0.062-0.963-0.088-1.424c-0.026-0.463-0.051-0.914-0.069-1.351l-2.175,1.576c0.046,0.646,0.097,1.284,0.146,1.92
+					c0.054,0.633,0.106,1.26,0.162,1.883c0.058,0.623,0.117,1.238,0.179,1.85c0.063,0.609,0.127,1.217,0.194,1.818
+					c0.064,0.599,0.138,1.205,0.209,1.816c0.068,0.612,0.146,1.229,0.228,1.854c0.078,0.625,0.16,1.255,0.246,1.888
+					c0.086,0.637,0.174,1.273,0.267,1.922l2.434-1.775c0.186-0.83,0.365-1.653,0.541-2.469c0.182-0.815,0.354-1.623,0.524-2.426
+					c0.169-0.8,0.337-1.593,0.499-2.375c0.161-0.783,0.319-1.563,0.475-2.33c0.154-0.771,0.309-1.537,0.457-2.308
+					c0.146-0.771,0.293-1.539,0.438-2.31c0.142-0.771,0.281-1.541,0.422-2.313C155.646,149.02,155.783,148.244,155.916,147.47"/>
+				<path fill="#FFFFFF" d="M159.123,149.271l-1.807,1.311l-0.031,0.525l-0.771,12.022l1.805-1.317L159.123,149.271 M158.57,144.455
+					c-0.094,0.064-0.178,0.135-0.256,0.208c-0.08,0.071-0.15,0.149-0.221,0.229c-0.063,0.08-0.125,0.164-0.181,0.25
+					c-0.056,0.088-0.103,0.18-0.146,0.272c-0.041,0.094-0.08,0.194-0.113,0.305c-0.032,0.11-0.063,0.229-0.09,0.354
+					s-0.049,0.259-0.063,0.4c-0.021,0.144-0.032,0.291-0.045,0.451c-0.009,0.162-0.015,0.311-0.015,0.442
+					c0,0.131,0.007,0.25,0.019,0.35c0.013,0.101,0.026,0.188,0.052,0.259c0.021,0.07,0.051,0.127,0.084,0.166
+					c0.032,0.039,0.071,0.065,0.12,0.078c0.05,0.012,0.104,0.012,0.166-0.002c0.062-0.015,0.134-0.042,0.209-0.082
+					c0.076-0.041,0.16-0.094,0.25-0.162c0.095-0.063,0.181-0.135,0.259-0.209c0.08-0.072,0.151-0.149,0.221-0.229
+					c0.066-0.081,0.129-0.164,0.182-0.25c0.055-0.086,0.104-0.178,0.145-0.27c0.041-0.096,0.08-0.197,0.113-0.31
+					c0.031-0.11,0.063-0.229,0.09-0.358c0.025-0.127,0.051-0.267,0.068-0.41c0.016-0.146,0.029-0.299,0.043-0.461
+					c0.01-0.164,0.014-0.311,0.014-0.44c0-0.132-0.008-0.248-0.018-0.349c-0.012-0.102-0.025-0.188-0.047-0.254
+					c-0.021-0.068-0.051-0.123-0.082-0.16c-0.031-0.039-0.072-0.064-0.121-0.076c-0.047-0.012-0.104-0.012-0.166,0.005
+					c-0.063,0.015-0.133,0.043-0.211,0.085C158.75,144.333,158.664,144.386,158.57,144.455"/>
+				<path fill="#FFFFFF" d="M165.184,144.634c-0.069,0.052-0.143,0.113-0.209,0.187c-0.067,0.07-0.139,0.154-0.203,0.248
+					c-0.069,0.095-0.137,0.197-0.203,0.313c-0.063,0.116-0.129,0.242-0.192,0.378c-0.063,0.137-0.135,0.289-0.211,0.463
+					c-0.074,0.174-0.153,0.366-0.24,0.577c-0.086,0.211-0.178,0.443-0.274,0.695c-0.099,0.251-0.199,0.521-0.31,0.813l-0.125-2.01
+					l-1.358,0.987l-0.808,12.532l1.813-1.32l0.516-8.008c0.078-0.208,0.151-0.404,0.223-0.588c0.072-0.184,0.141-0.354,0.203-0.514
+					c0.064-0.158,0.127-0.306,0.184-0.438c0.06-0.137,0.111-0.26,0.162-0.369c0.05-0.105,0.099-0.207,0.146-0.296
+					c0.051-0.089,0.096-0.168,0.145-0.239c0.046-0.068,0.091-0.131,0.136-0.182c0.043-0.053,0.088-0.094,0.131-0.123
+					c0.021-0.016,0.041-0.028,0.065-0.042c0.021-0.015,0.047-0.029,0.07-0.042c0.025-0.014,0.053-0.024,0.08-0.037
+					c0.025-0.014,0.057-0.023,0.086-0.036c0.031-0.008,0.063-0.019,0.092-0.022c0.027-0.012,0.06-0.021,0.092-0.027
+					c0.029-0.008,0.062-0.018,0.091-0.024c0.03-0.008,0.063-0.015,0.094-0.021l0.418-3.135c-0.034,0.011-0.067,0.021-0.101,0.029
+					c-0.03,0.012-0.063,0.021-0.09,0.031c-0.03,0.01-0.061,0.021-0.084,0.033c-0.026,0.011-0.053,0.021-0.076,0.033
+					c-0.022,0.012-0.049,0.021-0.069,0.033s-0.045,0.024-0.067,0.036c-0.021,0.015-0.041,0.026-0.063,0.04
+					C165.223,144.607,165.201,144.621,165.184,144.634"/>
+				<path fill="#FFFFFF" d="M169.717,137.949l-1.076,0.779c-0.07,0.399-0.145,0.791-0.221,1.172c-0.074,0.38-0.154,0.75-0.234,1.11
+					c-0.082,0.361-0.164,0.714-0.252,1.058c-0.084,0.342-0.176,0.676-0.268,0.998l-0.922,0.67l-0.143,2.169l0.91-0.662l-0.435,6.753
+					c-0.022,0.335-0.035,0.639-0.035,0.914c-0.002,0.273,0.006,0.52,0.024,0.736c0.019,0.215,0.05,0.401,0.084,0.563
+					c0.041,0.16,0.089,0.289,0.146,0.393c0.059,0.103,0.133,0.176,0.217,0.225c0.084,0.045,0.182,0.064,0.291,0.056
+					c0.109-0.007,0.23-0.043,0.365-0.104c0.139-0.063,0.283-0.152,0.445-0.271c0.074-0.053,0.15-0.112,0.227-0.177
+					c0.074-0.063,0.152-0.13,0.229-0.204c0.073-0.069,0.153-0.146,0.229-0.229c0.076-0.08,0.156-0.166,0.234-0.254
+					c0.08-0.088,0.154-0.179,0.23-0.271c0.073-0.09,0.146-0.183,0.217-0.274c0.07-0.093,0.139-0.188,0.203-0.281
+					c0.063-0.096,0.129-0.188,0.19-0.286l0.022-1.794c-0.043,0.044-0.086,0.087-0.125,0.125c-0.043,0.039-0.084,0.078-0.123,0.115
+					c-0.041,0.039-0.08,0.074-0.118,0.108c-0.037,0.036-0.078,0.067-0.115,0.101c-0.037,0.03-0.074,0.063-0.108,0.09
+					c-0.041,0.029-0.078,0.062-0.113,0.091c-0.037,0.026-0.074,0.057-0.111,0.087c-0.037,0.025-0.074,0.054-0.111,0.082
+					c-0.055,0.04-0.106,0.068-0.154,0.087c-0.047,0.021-0.092,0.024-0.131,0.021c-0.039-0.008-0.076-0.021-0.104-0.049
+					c-0.033-0.029-0.062-0.068-0.084-0.119s-0.043-0.106-0.062-0.173c-0.014-0.063-0.026-0.137-0.033-0.214
+					c-0.012-0.078-0.014-0.164-0.016-0.258c0-0.094,0.004-0.193,0.01-0.301l0.429-6.604l1.522-1.108l0.142-2.164l-1.523,1.104
+					L169.717,137.949"/>
+				<path fill="#FFFFFF" d="M178.785,134.994l-1.791,1.302l-0.615,9.468c-0.111,0.174-0.225,0.338-0.334,0.487
+					c-0.107,0.149-0.215,0.287-0.32,0.409c-0.104,0.125-0.209,0.234-0.309,0.333c-0.104,0.098-0.201,0.182-0.299,0.252
+					c-0.076,0.057-0.147,0.093-0.213,0.11c-0.063,0.018-0.121,0.014-0.174-0.008s-0.099-0.063-0.14-0.123
+					c-0.04-0.062-0.073-0.142-0.103-0.238c-0.026-0.104-0.049-0.235-0.063-0.402c-0.015-0.167-0.023-0.367-0.025-0.6
+					c-0.002-0.233,0.002-0.498,0.014-0.797s0.027-0.631,0.054-0.996l0.456-6.396l-1.797,1.306c-0.01,0.138-0.021,0.313-0.037,0.531
+					c-0.014,0.219-0.031,0.479-0.055,0.776c-0.021,0.3-0.047,0.64-0.076,1.02c-0.025,0.382-0.061,0.804-0.096,1.265
+					c-0.033,0.462-0.063,0.882-0.092,1.26c-0.025,0.379-0.053,0.716-0.073,1.013c-0.021,0.298-0.04,0.552-0.054,0.767
+					c-0.019,0.215-0.027,0.389-0.037,0.521c-0.031,0.512-0.053,0.979-0.063,1.402c-0.008,0.421-0.002,0.799,0.017,1.131
+					c0.016,0.332,0.045,0.62,0.088,0.863c0.043,0.242,0.1,0.438,0.166,0.595c0.065,0.153,0.146,0.272,0.238,0.356
+					c0.094,0.086,0.196,0.135,0.313,0.149c0.118,0.019,0.245-0.004,0.389-0.056c0.144-0.053,0.298-0.142,0.463-0.264
+					c0.091-0.063,0.181-0.14,0.271-0.224c0.091-0.085,0.185-0.183,0.278-0.285c0.094-0.104,0.188-0.222,0.287-0.348
+					c0.096-0.126,0.194-0.263,0.295-0.409c0.102-0.146,0.196-0.296,0.297-0.452c0.096-0.151,0.188-0.313,0.285-0.479
+					c0.092-0.162,0.186-0.33,0.276-0.504c0.093-0.172,0.185-0.352,0.272-0.533l0.104,1.271l1.389-1.014L178.785,134.994"/>
+				<path fill="#FFFFFF" d="M182.768,141.832c-0.063,0.05-0.127,0.087-0.188,0.115c-0.057,0.027-0.113,0.042-0.162,0.048
+					c-0.053,0.005-0.1,0-0.139-0.017c-0.043-0.019-0.078-0.047-0.113-0.086s-0.063-0.086-0.084-0.145
+					c-0.021-0.061-0.043-0.128-0.055-0.207c-0.014-0.08-0.021-0.168-0.023-0.27c-0.002-0.1,0-0.209,0.008-0.326
+					c0.01-0.143,0.025-0.28,0.051-0.418c0.021-0.137,0.049-0.27,0.086-0.399c0.035-0.131,0.078-0.26,0.125-0.386
+					c0.052-0.126,0.105-0.251,0.17-0.374c0.063-0.123,0.138-0.246,0.224-0.367c0.082-0.119,0.183-0.237,0.285-0.354
+					c0.106-0.115,0.226-0.23,0.354-0.344s0.268-0.224,0.416-0.334l0.521-0.382l-0.166,2.56c-0.059,0.104-0.113,0.203-0.17,0.3
+					c-0.053,0.095-0.109,0.186-0.162,0.271c-0.059,0.085-0.107,0.167-0.162,0.244c-0.052,0.077-0.104,0.146-0.154,0.215
+					c-0.053,0.067-0.104,0.133-0.158,0.191c-0.053,0.063-0.106,0.117-0.162,0.174c-0.055,0.054-0.108,0.104-0.166,0.154
+					C182.885,141.745,182.826,141.791,182.768,141.832 M184.02,130.961c-0.102,0.071-0.199,0.148-0.305,0.232
+					c-0.102,0.084-0.203,0.173-0.311,0.269c-0.105,0.097-0.213,0.196-0.322,0.306c-0.107,0.105-0.219,0.222-0.33,0.34
+					c-0.111,0.117-0.229,0.248-0.354,0.394s-0.254,0.301-0.39,0.472c-0.137,0.172-0.278,0.354-0.426,0.553
+					c-0.147,0.194-0.304,0.406-0.461,0.632l0.067,1.792c0.095-0.117,0.188-0.229,0.277-0.338c0.092-0.108,0.18-0.213,0.27-0.313
+					c0.089-0.1,0.173-0.196,0.257-0.288c0.084-0.091,0.161-0.179,0.241-0.261c0.08-0.083,0.158-0.164,0.24-0.242
+					c0.08-0.079,0.164-0.153,0.246-0.228c0.084-0.071,0.168-0.146,0.254-0.213c0.086-0.068,0.174-0.135,0.262-0.198
+					c0.099-0.072,0.191-0.132,0.281-0.181c0.084-0.047,0.168-0.082,0.246-0.104c0.076-0.022,0.148-0.033,0.215-0.031
+					c0.067,0.002,0.127,0.017,0.185,0.044c0.055,0.026,0.103,0.068,0.142,0.127c0.036,0.058,0.069,0.133,0.092,0.226
+					c0.023,0.092,0.035,0.198,0.041,0.323c0.008,0.123,0.006,0.266-0.006,0.422l-0.056,0.845l-0.483,0.353
+					c-0.295,0.215-0.57,0.439-0.832,0.676c-0.256,0.236-0.5,0.481-0.724,0.74c-0.224,0.258-0.43,0.524-0.618,0.805
+					c-0.187,0.277-0.355,0.565-0.513,0.867c-0.151,0.301-0.287,0.604-0.406,0.907c-0.12,0.306-0.223,0.611-0.312,0.919
+					c-0.086,0.309-0.153,0.615-0.209,0.926c-0.055,0.312-0.092,0.623-0.11,0.935c-0.039,0.601-0.028,1.093,0.031,1.479
+					c0.057,0.385,0.166,0.662,0.321,0.832c0.156,0.17,0.365,0.233,0.621,0.189c0.252-0.043,0.558-0.193,0.908-0.452
+					c0.098-0.067,0.189-0.147,0.287-0.235c0.094-0.088,0.188-0.187,0.283-0.293c0.098-0.106,0.189-0.225,0.284-0.349
+					c0.099-0.125,0.19-0.259,0.288-0.401c0.096-0.146,0.188-0.293,0.281-0.445c0.092-0.15,0.181-0.305,0.268-0.463
+					c0.086-0.157,0.17-0.318,0.252-0.481c0.082-0.164,0.16-0.33,0.236-0.498l0.104,1.269l1.311-0.957l0.566-8.646
+					c0.021-0.337,0.029-0.645,0.021-0.921c-0.002-0.276-0.021-0.524-0.053-0.742c-0.035-0.217-0.08-0.403-0.14-0.561
+					c-0.062-0.157-0.133-0.283-0.22-0.38c-0.086-0.099-0.19-0.161-0.309-0.195c-0.119-0.033-0.254-0.036-0.404-0.005
+					c-0.149,0.028-0.317,0.092-0.5,0.185C184.432,130.682,184.232,130.807,184.02,130.961"/>
+				<path fill="#FFFFFF" d="M191.021,121.232l-1.761,1.275l-0.987,15.075c-0.019,0.257-0.023,0.488-0.023,0.693
+					s0.011,0.387,0.025,0.543c0.02,0.156,0.045,0.287,0.078,0.393s0.074,0.188,0.127,0.246c0.051,0.057,0.108,0.093,0.18,0.113
+					c0.068,0.02,0.146,0.021,0.234,0.004c0.088-0.016,0.184-0.053,0.289-0.105c0.104-0.052,0.221-0.125,0.344-0.215
+					c0.104-0.077,0.212-0.162,0.32-0.256c0.106-0.094,0.219-0.196,0.33-0.307c0.112-0.11,0.227-0.23,0.342-0.358
+					c0.116-0.128,0.229-0.265,0.352-0.409l0.027-1.81l-0.426,0.332c-0.046,0.032-0.082,0.056-0.119,0.069s-0.07,0.018-0.099,0.012
+					c-0.028-0.004-0.053-0.019-0.073-0.041c-0.021-0.022-0.041-0.055-0.056-0.094c-0.015-0.041-0.022-0.099-0.03-0.168
+					c-0.007-0.07-0.013-0.156-0.015-0.259c-0.002-0.101,0-0.217,0.006-0.347c0.002-0.131,0.009-0.277,0.021-0.438L191.021,121.232"
+					/>
+				<path fill="#FFFFFF" d="M195.492,132.34l-0.818,0.523l0.33-5.009l0.77-0.559c0.14-0.101,0.269-0.181,0.39-0.24
+					c0.121-0.06,0.229-0.098,0.332-0.114c0.101-0.017,0.19-0.013,0.271,0.012c0.084,0.024,0.152,0.072,0.215,0.139
+					c0.062,0.069,0.115,0.148,0.158,0.243c0.041,0.094,0.076,0.201,0.104,0.322c0.023,0.12,0.041,0.254,0.047,0.402
+					c0.006,0.149,0.006,0.31-0.006,0.485c-0.016,0.205-0.035,0.403-0.063,0.597c-0.029,0.192-0.063,0.379-0.107,0.563
+					c-0.045,0.185-0.094,0.36-0.153,0.534c-0.058,0.173-0.119,0.342-0.194,0.506c-0.07,0.164-0.151,0.318-0.242,0.469
+					c-0.088,0.148-0.187,0.289-0.293,0.422c-0.105,0.135-0.219,0.26-0.342,0.376C195.764,132.129,195.633,132.238,195.492,132.34
+					 M195.164,125.433l0.277-4.249l0.852-0.618c0.098-0.069,0.186-0.122,0.27-0.158c0.082-0.036,0.158-0.056,0.228-0.06
+					c0.069-0.004,0.133,0.008,0.188,0.037c0.059,0.028,0.106,0.071,0.149,0.131c0.041,0.062,0.078,0.134,0.104,0.219
+					c0.029,0.085,0.056,0.18,0.068,0.287c0.018,0.107,0.027,0.226,0.029,0.355c0.004,0.129,0,0.27-0.012,0.423
+					c-0.01,0.155-0.025,0.309-0.051,0.461c-0.023,0.153-0.058,0.305-0.095,0.457c-0.038,0.15-0.084,0.301-0.137,0.45
+					c-0.054,0.149-0.115,0.298-0.183,0.445c-0.067,0.146-0.143,0.286-0.222,0.418c-0.081,0.132-0.167,0.257-0.261,0.374
+					c-0.094,0.116-0.191,0.225-0.299,0.326c-0.105,0.101-0.219,0.195-0.338,0.282L195.164,125.433 M196.744,117.89l-2.961,2.146
+					l-1.102,16.726l2.411-1.762c0.334-0.243,0.646-0.501,0.938-0.773c0.292-0.271,0.563-0.559,0.813-0.858
+					c0.25-0.302,0.479-0.617,0.688-0.948c0.206-0.331,0.395-0.676,0.561-1.037c0.164-0.357,0.313-0.72,0.443-1.086
+					c0.131-0.363,0.244-0.732,0.34-1.105c0.097-0.373,0.174-0.75,0.233-1.129c0.062-0.379,0.104-0.763,0.13-1.15
+					c0.014-0.209,0.018-0.409,0.01-0.598c-0.008-0.19-0.026-0.368-0.06-0.537c-0.026-0.168-0.067-0.326-0.119-0.474
+					c-0.053-0.147-0.114-0.285-0.188-0.412c-0.069-0.127-0.149-0.23-0.233-0.312c-0.086-0.082-0.176-0.14-0.275-0.176
+					c-0.1-0.036-0.201-0.05-0.313-0.04c-0.111,0.009-0.229,0.042-0.353,0.097c0.119-0.177,0.229-0.354,0.334-0.531
+					c0.104-0.177,0.201-0.353,0.291-0.53c0.09-0.177,0.172-0.354,0.248-0.533c0.075-0.177,0.146-0.356,0.207-0.535
+					c0.062-0.176,0.117-0.36,0.164-0.551c0.053-0.19,0.096-0.388,0.135-0.592c0.037-0.203,0.069-0.413,0.101-0.63
+					c0.024-0.217,0.045-0.438,0.063-0.668c0.021-0.313,0.023-0.598,0.016-0.856c-0.014-0.258-0.037-0.487-0.08-0.69
+					c-0.041-0.203-0.1-0.377-0.172-0.526c-0.074-0.148-0.164-0.269-0.268-0.362c-0.104-0.092-0.225-0.15-0.359-0.179
+					c-0.137-0.027-0.287-0.024-0.453,0.012s-0.348,0.104-0.545,0.205C197.188,117.591,196.973,117.724,196.744,117.89"/>
+				<path fill="#FFFFFF" d="M203.377,126.843c-0.111,0.082-0.217,0.139-0.311,0.17c-0.096,0.033-0.181,0.041-0.26,0.024
+					c-0.076-0.017-0.146-0.058-0.207-0.124c-0.063-0.066-0.115-0.157-0.16-0.273c-0.043-0.117-0.078-0.271-0.104-0.46
+					c-0.025-0.19-0.043-0.417-0.053-0.681c-0.008-0.263-0.008-0.564,0.002-0.902c0.01-0.337,0.027-0.712,0.057-1.124
+					c0.021-0.324,0.047-0.631,0.08-0.92c0.031-0.29,0.07-0.562,0.113-0.817c0.045-0.255,0.096-0.495,0.15-0.717
+					c0.057-0.221,0.115-0.425,0.184-0.614c0.064-0.188,0.137-0.358,0.213-0.517c0.076-0.159,0.158-0.305,0.246-0.438
+					c0.086-0.131,0.176-0.249,0.271-0.354c0.1-0.105,0.198-0.196,0.309-0.274c0.104-0.075,0.197-0.127,0.287-0.154
+					c0.092-0.026,0.172-0.028,0.246-0.005c0.072,0.023,0.139,0.071,0.197,0.145c0.057,0.072,0.106,0.17,0.149,0.293
+					c0.043,0.124,0.076,0.282,0.103,0.477c0.022,0.195,0.041,0.426,0.047,0.693c0.01,0.267,0.008,0.569-0.002,0.908
+					c-0.011,0.339-0.027,0.713-0.056,1.125c-0.022,0.323-0.049,0.629-0.081,0.916c-0.031,0.288-0.07,0.558-0.113,0.81
+					c-0.043,0.251-0.09,0.485-0.146,0.7c-0.054,0.217-0.113,0.414-0.179,0.593c-0.063,0.182-0.135,0.35-0.209,0.503
+					c-0.071,0.154-0.149,0.293-0.231,0.419c-0.082,0.125-0.17,0.239-0.26,0.338C203.57,126.685,203.477,126.771,203.377,126.843
+					 M204.135,116.359c-0.248,0.18-0.484,0.385-0.709,0.616c-0.229,0.231-0.443,0.488-0.646,0.771
+					c-0.204,0.284-0.397,0.593-0.581,0.929c-0.185,0.335-0.357,0.698-0.521,1.087c-0.161,0.386-0.308,0.792-0.438,1.22
+					c-0.13,0.428-0.244,0.876-0.345,1.345c-0.1,0.469-0.186,0.958-0.25,1.469c-0.065,0.511-0.121,1.041-0.156,1.592
+					c-0.034,0.547-0.053,1.044-0.053,1.49c0,0.447,0.019,0.845,0.056,1.191c0.036,0.347,0.092,0.644,0.165,0.892
+					c0.074,0.247,0.164,0.444,0.275,0.594c0.109,0.146,0.238,0.254,0.383,0.318c0.146,0.066,0.308,0.09,0.484,0.074
+					c0.18-0.016,0.375-0.074,0.59-0.172c0.213-0.1,0.441-0.238,0.689-0.418c0.25-0.185,0.488-0.394,0.717-0.627
+					c0.229-0.234,0.447-0.498,0.652-0.785c0.207-0.287,0.402-0.6,0.59-0.94c0.186-0.34,0.359-0.707,0.523-1.101
+					c0.164-0.393,0.313-0.806,0.444-1.237c0.136-0.433,0.248-0.884,0.351-1.355c0.1-0.472,0.184-0.962,0.25-1.472
+					c0.067-0.511,0.123-1.041,0.158-1.59c0.034-0.516,0.049-0.986,0.047-1.412c-0.004-0.426-0.023-0.807-0.064-1.143
+					c-0.039-0.335-0.1-0.625-0.178-0.871c-0.076-0.246-0.174-0.445-0.287-0.6c-0.113-0.155-0.244-0.27-0.393-0.341
+					c-0.146-0.073-0.31-0.103-0.488-0.09c-0.18,0.01-0.375,0.063-0.584,0.157C204.604,116.047,204.377,116.183,204.135,116.359"/>
+				<path fill="#FFFFFF" d="M213.489,109.8l-1.823,1.325c-0.043,0.158-0.084,0.317-0.127,0.478c-0.043,0.16-0.084,0.321-0.129,0.482
+					c-0.043,0.162-0.088,0.324-0.133,0.487c-0.047,0.162-0.094,0.326-0.139,0.49c-0.046,0.163-0.091,0.322-0.138,0.478
+					c-0.045,0.156-0.09,0.31-0.135,0.458c-0.046,0.148-0.091,0.292-0.136,0.433s-0.086,0.277-0.129,0.409l-0.664-2.463l-2.035,1.479
+					l1.427,4.602l-2.521,7.942l1.875-1.37c0.053-0.206,0.105-0.413,0.16-0.619c0.053-0.207,0.107-0.414,0.162-0.621
+					c0.059-0.208,0.113-0.417,0.17-0.626c0.061-0.209,0.117-0.419,0.178-0.631c0.06-0.211,0.117-0.419,0.177-0.623
+					c0.059-0.204,0.116-0.404,0.176-0.601c0.06-0.196,0.116-0.389,0.174-0.579c0.058-0.189,0.115-0.375,0.172-0.558l0.857,3.234
+					l2.096-1.531l-1.696-5.256L213.489,109.8"/>
+			</g>
+		</g>
+	</g>
+</g>
+</svg>
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/images/VirtualBox_64px.png b/src/VBox/ValidationKit/testmanager/htdocs/images/VirtualBox_64px.png
new file mode 100644
index 0000000..d8849bd
Binary files /dev/null and b/src/VBox/ValidationKit/testmanager/htdocs/images/VirtualBox_64px.png differ
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/images/tmfavicon.ico b/src/VBox/ValidationKit/testmanager/htdocs/images/tmfavicon.ico
new file mode 100644
index 0000000..72f7032
Binary files /dev/null and b/src/VBox/ValidationKit/testmanager/htdocs/images/tmfavicon.ico differ
diff --git a/src/VBox/Devices/Network/lwip/Makefile.kup b/src/VBox/ValidationKit/testmanager/htdocs/js/Makefile.kup
similarity index 100%
rename from src/VBox/Devices/Network/lwip/Makefile.kup
rename to src/VBox/ValidationKit/testmanager/htdocs/js/Makefile.kup
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/js/common.js b/src/VBox/ValidationKit/testmanager/htdocs/js/common.js
new file mode 100644
index 0000000..ef34e88
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/htdocs/js/common.js
@@ -0,0 +1,1019 @@
+/* $Id: common.js $ */
+/** @file
+ * Common JavaScript functions
+ */
+
+/*
+ *
+ * Copyright (C) 2012-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+
+/**
+ * Checks if the given value is a decimal integer value.
+ *
+ * @returns true if it is, false if it's isn't.
+ * @param   sValue              The value to inspect.
+ */
+function isInteger(sValue)
+{
+    if (typeof sValue != 'undefined')
+    {
+        var intRegex = /^\d+$/;
+        if (intRegex.test(sValue))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+/**
+ * Removes the element with the specified ID.
+ */
+function removeHtmlNode(sContainerId)
+{
+    var oElement = document.getElementById(sContainerId);
+    if (oElement)
+    {
+        oElement.parentNode.removeChild(oElement);
+    }
+}
+
+/**
+ * Sets the value of the element with id @a sInputId to the keys of aoItems
+ * (comma separated).
+ */
+function setElementValueToKeyList(sInputId, aoItems)
+{
+    var sKey;
+    var oElement = document.getElementById(sInputId);
+    oElement.value = '';
+
+    for (sKey in aoItems)
+    {
+        if (oElement.value.length > 0)
+        {
+            oElement.value += ',';
+        }
+
+        oElement.value += sKey;
+    }
+}
+
+/**
+ * Get the Window.devicePixelRatio in a safe way.
+ *
+ * @returns Floating point ratio. 1.0 means it's a 1:1 ratio.
+ */
+function getDevicePixelRatio()
+{
+    var fpRatio = 1.0;
+    if (window.devicePixelRatio)
+    {
+        fpRatio = window.devicePixelRatio;
+        if (fpRatio < 0.5 || fpRatio > 10.0)
+            fpRatio = 1.0;
+    }
+    return fpRatio;
+}
+
+/**
+ * Tries to figure out the DPI of the device in the X direction.
+ *
+ * @returns DPI on success, null on failure.
+ */
+function getDeviceXDotsPerInch()
+{
+    if (window.deviceXDPI && window.deviceXDPI > 48 && window.deviceXDPI < 2048)
+    {
+        return window.deviceXDPI;
+    }
+    else if (window.devicePixelRatio && window.devicePixelRatio >= 0.5 && window.devicePixelRatio <= 10.0)
+    {
+        cDotsPerInch = Math.round(96 * window.devicePixelRatio);
+    }
+    else
+    {
+        cDotsPerInch = null;
+    }
+    return cDotsPerInch;
+}
+
+/**
+ * Gets the width of the given element (downscaled).
+ *
+ * Useful when using the element to figure the size of a image
+ * or similar.
+ *
+ * @returns Number of pixels.  null if oElement is bad.
+ * @param   oElement        The element (not ID).
+ */
+function getElementWidth(oElement)
+{
+    if (oElement && oElement.offsetWidth)
+        return oElement.offsetWidth;
+    return null;
+}
+
+/** By element ID version of getElementWidth. */
+function getElementWidthById(sElementId)
+{
+    return getElementWidth(document.getElementById(sElementId));
+}
+
+/**
+ * Gets the real unscaled width of the given element.
+ *
+ * Useful when using the element to figure the size of a image
+ * or similar.
+ *
+ * @returns Number of screen pixels.  null if oElement is bad.
+ * @param   oElement        The element (not ID).
+ */
+function getUnscaledElementWidth(oElement)
+{
+    if (oElement && oElement.offsetWidth)
+        return Math.round(oElement.offsetWidth * getDevicePixelRatio());
+    return null;
+}
+
+/** By element ID version of getUnscaledElementWidth. */
+function getUnscaledElementWidthById(sElementId)
+{
+    return getUnscaledElementWidth(document.getElementById(sElementId));
+}
+
+
+/**
+ * Sets the value of an input field element (give by ID).
+ *
+ * @returns Returns success indicator (true/false).
+ * @param   sFieldId            The field ID (required for updating).
+ * @param   sValue              The field value.
+ */
+function setInputFieldValue(sFieldId, sValue)
+{
+    var oInputElement = document.getElementById(sFieldId);
+    if (oInputElement)
+    {
+        oInputElement.value = sValue;
+        return true;
+    }
+    return false;
+}
+
+/**
+ * Adds a hidden input field to a form.
+ *
+ * @returns The new input field element.
+ * @param   oFormElement        The form to append it to.
+ * @param   sName               The field name.
+ * @param   sValue              The field value.
+ * @param   sFieldId            The field ID (optional).
+ */
+function addHiddenInputFieldToForm(oFormElement, sName, sValue, sFieldId)
+{
+    var oNew = document.createElement('input');
+    oNew.type  = 'hidden';
+    oNew.name  = sName;
+    oNew.value = sValue;
+    if (sFieldId)
+        oNew.id = sFieldId;
+    oFormElement.appendChild(oNew);
+    return oNew;
+}
+
+/** By element ID version of addHiddenInputFieldToForm. */
+function addHiddenInputFieldToFormById(sFormId, sName, sValue, sFieldId)
+{
+    return addHiddenInputFieldToForm(document.getElementById(sFormId), sName, sValue, sFieldId);
+}
+
+/**
+ * Adds or updates a hidden input field to/on a form.
+ *
+ * @returns The new input field element.
+ * @param   sFormId             The ID of the form to amend.
+ * @param   sName               The field name.
+ * @param   sValue              The field value.
+ * @param   sFieldId            The field ID (required for updating).
+ */
+function addUpdateHiddenInputFieldToFormById(sFormId, sName, sValue, sFieldId)
+{
+    var oInputElement = null;
+    if (sFieldId)
+    {
+        oInputElement = document.getElementById(sFieldId);
+    }
+    if (oInputElement)
+    {
+        oInputElement.name  = sName;
+        oInputElement.value = sValue;
+    }
+    else
+    {
+        oInputElement = addHiddenInputFieldToFormById(sFormId, sName, sValue, sFieldId);
+    }
+    return oInputElement;
+}
+
+/**
+ * Adds a width and a dpi input to the given form element if possible to
+ * determine the values.
+ *
+ * This is normally employed in an onlick hook, but then you must specify IDs or
+ * the browser may end up adding it several times.
+ *
+ * @param   sFormId             The ID of the form to amend.
+ * @param   sWidthSrcId         The ID of the element to calculate the width
+ *                              value from.
+ * @param   sWidthName          The name of the width value.
+ * @param   sDpiName            The name of the dpi value.
+ */
+function addDynamicGraphInputs(sFormId, sWidthSrcId, sWidthName, sDpiName)
+{
+    var cx            = getUnscaledElementWidthById(sWidthSrcId);
+    var cDotsPerInch  = getDeviceXDotsPerInch();
+
+    if (cx)
+    {
+        addUpdateHiddenInputFieldToFormById(sFormId, sWidthName, cx, sFormId + '-' + sWidthName + '-id');
+    }
+
+    if (cDotsPerInch)
+    {
+        addUpdateHiddenInputFieldToFormById(sFormId, sDpiName, cDotsPerInch, sFormId + '-' + sDpiName + '-id');
+    }
+
+}
+
+
+/** @name Custom Tooltips
+ * @{
+ */
+
+/** Where we keep tooltip elements when not displayed. */
+var g_dTooltips          = {};
+var g_oCurrentTooltip    = null;
+var g_idTooltipShowTimer = null;
+var g_idTooltipHideTimer = null;
+var g_cTooltipSvnRevisions = 12;
+
+/**
+ * Cancel showing/replacing/repositing a tooltip.
+ */
+function tooltipResetShowTimer()
+{
+    if (g_idTooltipShowTimer)
+    {
+        clearTimeout(g_idTooltipShowTimer);
+        g_idTooltipShowTimer = null;
+    }
+}
+
+/**
+ * Cancel hiding of the current tooltip.
+ */
+function tooltipResetHideTimer()
+{
+    if (g_idTooltipHideTimer)
+    {
+        clearTimeout(g_idTooltipHideTimer);
+        g_idTooltipHideTimer = null;
+    }
+}
+
+/**
+ * Really hide the tooltip.
+ */
+function tooltipReallyHide()
+{
+    if (g_oCurrentTooltip)
+    {
+        //console.log('tooltipReallyHide: ' + g_oCurrentTooltip);
+        g_oCurrentTooltip.oElm.style.display = 'none';
+        g_oCurrentTooltip = null;
+    }
+}
+
+/**
+ * Schedule the tooltip for hiding.
+ */
+function tooltipHide()
+{
+    function tooltipDelayedHide()
+    {
+        tooltipResetHideTimer();
+        tooltipReallyHide();
+    }
+
+    /*
+     * Cancel any pending show and schedule hiding if necessary.
+     */
+    tooltipResetShowTimer();
+    if (g_oCurrentTooltip && !g_idTooltipHideTimer)
+    {
+        g_idTooltipHideTimer = setTimeout(tooltipDelayedHide, 700);
+    }
+
+    return true;
+}
+
+/**
+ * Function that is repositions the tooltip when it's shown.
+ *
+ * Used directly, via onload, and hackish timers to catch all browsers and
+ * whatnot.
+ *
+ * Will set several tooltip member variables related to position and space.
+ */
+function tooltipRepositionOnLoad()
+{
+    if (g_oCurrentTooltip)
+    {
+        var oRelToRect = g_oCurrentTooltip.oRelToRect;
+        var cxNeeded   = g_oCurrentTooltip.oElm.offsetWidth  + 8;
+        var cyNeeded   = g_oCurrentTooltip.oElm.offsetHeight + 8;
+
+        var yScroll         = window.pageYOffset || document.documentElement.scrollTop;
+        var yScrollBottom   = yScroll + window.innerHeight;
+        var xScroll         = window.pageXOffset || document.documentElement.scrollLeft;
+        var xScrollRight    = xScroll + window.innerWidth;
+
+        var cyAbove    = Math.max(oRelToRect.top  - yScroll, 0);
+        var cyBelow    = Math.max(yScrollBottom - oRelToRect.bottom, 0);
+        var cxLeft     = Math.max(oRelToRect.left - xScroll, 0);
+        var cxRight    = Math.max(xScrollRight  - oRelToRect.right, 0);
+
+        var xPos;
+        var yPos;
+
+        /*
+         * Decide where to put the thing.
+         */
+        if (cyNeeded < cyBelow)
+        {
+            yPos = oRelToRect.bottom;
+            g_oCurrentTooltip.cyMax = cyBelow;
+        }
+        else if (cyBelow >= cyAbove)
+        {
+            yPos = yScrollBottom - cyNeeded;
+            g_oCurrentTooltip.cyMax = yScrollBottom - yPos;
+        }
+        else
+        {
+            yPos = oRelToRect.top - cyNeeded;
+            g_oCurrentTooltip.cyMax = yScrollBottom - yPos;
+        }
+        if (yPos < yScroll)
+        {
+            yPos = yScroll;
+            g_oCurrentTooltip.cyMax = yScrollBottom - yPos;
+        }
+        g_oCurrentTooltip.yPos    = yPos;
+        g_oCurrentTooltip.yScroll = yScroll;
+        g_oCurrentTooltip.cyMaxUp = yPos - yScroll;
+
+        if (cxNeeded < cxRight || cxNeeded > cxRight)
+        {
+            xPos = oRelToRect.right;
+            g_oCurrentTooltip.cxMax = cxRight;
+        }
+        else
+        {
+            xPos = oRelToRect.left - cxNeeded;
+            g_oCurrentTooltip.cxMax = cxNeeded;
+        }
+        g_oCurrentTooltip.xPos    = xPos;
+        g_oCurrentTooltip.xScroll = xScroll;
+
+        g_oCurrentTooltip.oElm.style.top  = yPos + 'px';
+        g_oCurrentTooltip.oElm.style.left = xPos + 'px';
+    }
+    return true;
+}
+
+
+/**
+ * Really show the tooltip.
+ *
+ * @param   oTooltip            The tooltip object.
+ * @param   oRelTo              What to put the tooltip adjecent to.
+ */
+function tooltipReallyShow(oTooltip, oRelTo)
+{
+    var oRect;
+
+    tooltipResetShowTimer();
+    tooltipResetHideTimer();
+
+    if (g_oCurrentTooltip == oTooltip)
+    {
+        //console.log('moving tooltip');
+    }
+    else if (g_oCurrentTooltip)
+    {
+        //console.log('removing current tooltip and showing new');
+        tooltipReallyHide();
+    }
+    else
+    {
+        //console.log('showing tooltip');
+    }
+
+    oTooltip.oElm.style.display  = 'block';
+    oTooltip.oElm.style.position = 'absolute';
+    oRect = oRelTo.getBoundingClientRect();
+    oTooltip.oRelToRect = oRect;
+    oTooltip.oElm.style.left     = oRect.right + 'px';
+    oTooltip.oElm.style.top      = oRect.bottom + 'px';
+
+    g_oCurrentTooltip = oTooltip;
+
+    /*
+     * This function does the repositioning at some point.
+     */
+    tooltipRepositionOnLoad();
+    if (oTooltip.oElm.onload === null)
+    {
+        oTooltip.oElm.onload = function(){ tooltipRepositionOnLoad(); setTimeout(tooltipRepositionOnLoad, 0); };
+    }
+}
+
+/**
+ * Tooltip onmouseenter handler .
+ */
+function tooltipElementOnMouseEnter()
+{
+    //console.log('tooltipElementOnMouseEnter: arguments.length='+arguments.length+' [0]='+arguments[0]);
+    //console.log('ENT: currentTarget='+arguments[0].currentTarget);
+    tooltipResetShowTimer();
+    tooltipResetHideTimer();
+    return true;
+}
+
+/**
+ * Tooltip onmouseout handler.
+ *
+ * @remarks We only use this and onmouseenter for one tooltip element (iframe
+ *          for svn, because chrome is sending onmouseout events after
+ *          onmouseneter for the next element, which would confuse this simple
+ *          code.
+ */
+function tooltipElementOnMouseOut()
+{
+    //console.log('tooltipElementOnMouseOut: arguments.length='+arguments.length+' [0]='+arguments[0]);
+    //console.log('OUT: currentTarget='+arguments[0].currentTarget);
+    tooltipHide();
+    return true;
+}
+
+/**
+ * iframe.onload hook that repositions and resizes the tooltip.
+ *
+ * This is a little hacky and we're calling it one or three times too many to
+ * work around various browser differences too.
+ */
+function svnHistoryTooltipOnLoad()
+{
+    //console.log('svnHistoryTooltipOnLoad');
+
+    /*
+     * Resize the tooltip to better fit the content.
+     */
+    tooltipRepositionOnLoad(); /* Sets cxMax and cyMax. */
+    if (g_oCurrentTooltip && g_oCurrentTooltip.oIFrame.contentWindow)
+    {
+        var oSubElement = g_oCurrentTooltip.oIFrame;
+        var cxSpace  = Math.max(oSubElement.offsetLeft * 2, 0); /* simplified */
+        var cySpace  = Math.max(oSubElement.offsetTop  * 2, 0); /* simplified */
+        var cxNeeded = oSubElement.contentWindow.document.body.scrollWidth  + cxSpace;
+        var cyNeeded = oSubElement.contentWindow.document.body.scrollHeight + cySpace;
+        var cx = Math.min(cxNeeded, g_oCurrentTooltip.cxMax);
+        var cy;
+
+        g_oCurrentTooltip.oElm.width = cx + 'px';
+        oSubElement.width            = (cx - cxSpace) + 'px';
+        if (cx >= cxNeeded)
+        {
+            //console.log('svnHistoryTooltipOnLoad: overflowX -> hidden');
+            oSubElement.style.overflowX = 'hidden';
+        }
+        else
+        {
+            oSubElement.style.overflowX = 'scroll';
+        }
+
+        cy = Math.min(cyNeeded, g_oCurrentTooltip.cyMax);
+        if (cyNeeded > g_oCurrentTooltip.cyMax && g_oCurrentTooltip.cyMaxUp > 0)
+        {
+            var cyMove = Math.min(cyNeeded - g_oCurrentTooltip.cyMax, g_oCurrentTooltip.cyMaxUp);
+            g_oCurrentTooltip.cyMax += cyMove;
+            g_oCurrentTooltip.yPos  -= cyMove;
+            g_oCurrentTooltip.oElm.style.top = g_oCurrentTooltip.yPos + 'px';
+            cy = Math.min(cyNeeded, g_oCurrentTooltip.cyMax);
+        }
+
+        g_oCurrentTooltip.oElm.height = cy + 'px';
+        oSubElement.height            = (cy - cySpace) + 'px';
+        if (cy >= cyNeeded)
+        {
+            //console.log('svnHistoryTooltipOnLoad: overflowY -> hidden');
+            oSubElement.style.overflowY = 'hidden';
+        }
+        else
+        {
+            oSubElement.style.overflowY = 'scroll';
+        }
+
+        //console.log('cyNeeded='+cyNeeded+' cyMax='+g_oCurrentTooltip.cyMax+' cySpace='+cySpace+' cy='+cy);
+        //console.log('oSubElement.offsetTop='+oSubElement.offsetTop);
+        //console.log('svnHistoryTooltipOnLoad: cx='+cx+'cxMax='+g_oCurrentTooltip.cxMax+' cxNeeded='+cxNeeded+' cy='+cy+' cyMax='+g_oCurrentTooltip.cyMax);
+
+        tooltipRepositionOnLoad();
+    }
+    return true;
+}
+
+/**
+ * Calculates the last revision to get when showing a tooltip for @a iRevision.
+ *
+ * A tooltip covers several change log entries, both to limit the number of
+ * tooltips to load and to give context.  The exact number is defined by
+ * g_cTooltipSvnRevisions.
+ *
+ * @returns Last revision in a tooltip.
+ * @param   iRevision   The revision number.
+ */
+function svnHistoryTooltipCalcLastRevision(iRevision)
+{
+    var iFirstRev = Math.floor(iRevision / g_cTooltipSvnRevisions) * g_cTooltipSvnRevisions;
+    return iFirstRev + g_cTooltipSvnRevisions - 1;
+}
+
+/**
+ * Calculates a unique ID for the tooltip element.
+ *
+ * This is also used as dictionary index.
+ *
+ * @returns tooltip ID value (string).
+ * @param   sRepository The repository name.
+ * @param   iRevision   The revision number.
+ */
+function svnHistoryTooltipCalcId(sRepository, iRevision)
+{
+    return 'svnHistoryTooltip_' + sRepository + '_' + svnHistoryTooltipCalcLastRevision(iRevision);
+}
+
+/**
+ * The onmouseenter event handler for creating the tooltip.
+ *
+ * @param   oEvt        The event.
+ * @param   sRepository The repository name.
+ * @param   iRevision   The revision number.
+ *
+ * @remarks onmouseout must be set to call tooltipHide.
+ */
+function svnHistoryTooltipShow(oEvt, sRepository, iRevision)
+{
+    var sKey        = svnHistoryTooltipCalcId(sRepository, iRevision);
+    var oTooltip    = g_dTooltips[sKey];
+    var oParent     = oEvt.currentTarget;
+    //console.log('svnHistoryTooltipShow ' + sRepository);
+
+    function svnHistoryTooltipDelayedShow()
+    {
+        var oSubElement;
+        var sSrc;
+
+        oTooltip = g_dTooltips[sKey];
+        //console.log('svnHistoryTooltipDelayedShow ' + sRepository + ' ' + oTooltip);
+        if (!oTooltip)
+        {
+            /*
+             * Create a new tooltip element.
+             */
+            //console.log('creating ' + sKey);
+            oTooltip = {};
+            oTooltip.oElm = document.createElement('div');
+            oTooltip.oElm.setAttribute('id', sKey);
+            oTooltip.oElm.setAttribute('class', 'tmvcstooltip');
+            oTooltip.oElm.style.position = 'absolute';
+            oTooltip.oElm.style.zIndex = 6001;
+            oTooltip.xPos    = 0;
+            oTooltip.yPos    = 0;
+            oTooltip.cxMax   = 0;
+            oTooltip.cyMax   = 0;
+            oTooltip.cyMaxUp = 0;
+            oTooltip.xScroll = 0;
+            oTooltip.yScroll = 0;
+
+            oSubElement = document.createElement('iframe');
+            oSubElement.setAttribute('id', sKey + '_iframe');
+            oSubElement.setAttribute('style', 'position: relative;"');
+            oSubElement.onload       = function() {svnHistoryTooltipOnLoad(); setTimeout(svnHistoryTooltipOnLoad,0);};
+            oSubElement.onmouseenter = tooltipElementOnMouseEnter;
+            oSubElement.onmouseout   = tooltipElementOnMouseOut;
+            oTooltip.oElm.appendChild(oSubElement);
+            oTooltip.oIFrame = oSubElement;
+            g_dTooltips[sKey] = oTooltip;
+
+            document.body.appendChild(oTooltip.oElm);
+        }
+        else
+        {
+            oSubElement = oTooltip.oIFrame;
+        }
+
+        oSubElement.setAttribute('src', 'index.py?Action=VcsHistoryTooltip&repo=' + sRepository
+                                 + '&rev=' + svnHistoryTooltipCalcLastRevision(iRevision)
+                                 + '&cEntries=' + g_cTooltipSvnRevisions
+                                 + '#r' + iRevision);
+        tooltipReallyShow(oTooltip, oParent);
+        /* Resize and repositioning hacks. */
+        svnHistoryTooltipOnLoad();
+        setTimeout(svnHistoryTooltipOnLoad, 0);
+    }
+
+    /*
+     * Delay the change.
+     */
+    tooltipResetShowTimer();
+    g_idTooltipShowTimer = setTimeout(svnHistoryTooltipDelayedShow, 512);
+}
+
+/** @} */
+
+
+/** @name Debugging and Introspection
+ * @{
+ */
+
+/**
+ * Python-like dir() implementation.
+ *
+ * @returns Array of names associated with oObj.
+ * @param   oObj        The object under inspection.  If not specified we'll
+ *                      look at the window object.
+ */
+function pythonlikeDir(oObj, fDeep)
+{
+    var aRet = [];
+    var dTmp = {};
+
+    if (!oObj)
+    {
+        oObj = window;
+    }
+
+    for (var oCur = oObj; oCur; oCur = Object.getPrototypeOf(oCur))
+    {
+        var aThis = Object.getOwnPropertyNames(oCur);
+        for (var i = 0; i < aThis.length; i++)
+        {
+            if (!(aThis[i] in dTmp))
+            {
+                dTmp[aThis[i]] = 1;
+                aRet.push(aThis[i]);
+            }
+        }
+    }
+
+    return aRet;
+}
+
+
+/**
+ * Python-like dir() implementation, shallow version.
+ *
+ * @returns Array of names associated with oObj.
+ * @param   oObj        The object under inspection.  If not specified we'll
+ *                      look at the window object.
+ */
+function pythonlikeShallowDir(oObj, fDeep)
+{
+    var aRet = [];
+    var dTmp = {};
+
+    if (oObj)
+    {
+        for (var i in oObj)
+        {
+            aRet.push(i);
+        }
+    }
+
+    return aRet;
+}
+
+
+
+function dbgGetObjType(oObj)
+{
+    var sType = typeof oObj;
+    if (sType == "object" && oObj !== null)
+    {
+        if (oObj.constructor && oObj.constructor.name)
+        {
+            sType = oObj.constructor.name;
+        }
+        else
+        {
+            var fnToString = Object.prototype.toString;
+            var sTmp = fnToString.call(oObj);
+            if (sTmp.indexOf('[object ') === 0)
+            {
+                sType = sTmp.substring(8, sTmp.length);
+            }
+        }
+    }
+    return sType;
+}
+
+
+/**
+ * Dumps the given object to the console.
+ *
+ * @param   oObj        The object under inspection.
+ * @param   sPrefix     What to prefix the log output with.
+ */
+function dbgDumpObj(oObj, sName, sPrefix)
+{
+    var aMembers;
+    var sType;
+
+    /*
+     * Defaults
+     */
+    if (!oObj)
+    {
+        oObj = window;
+    }
+
+    if (!sPrefix)
+    {
+        if (sName)
+        {
+            sPrefix = sName + ':';
+        }
+        else
+        {
+            sPrefix = 'dbgDumpObj:';
+        }
+    }
+
+    if (!sName)
+    {
+        sName = '';
+    }
+
+    /*
+     * The object itself.
+     */
+    sPrefix = sPrefix + ' ';
+    console.log(sPrefix + sName + ' ' + dbgGetObjType(oObj));
+
+    /*
+     * The members.
+     */
+    sPrefix = sPrefix + ' ';
+    aMembers = pythonlikeDir(oObj);
+    for (i = 0; i < aMembers.length; i++)
+    {
+        console.log(sPrefix + aMembers[i]);
+    }
+
+    return true;
+}
+
+function dbgDumpObjWorker(sType, sName, oObj, sPrefix)
+{
+    var sRet;
+    switch (sType)
+    {
+        case 'function':
+        {
+            sRet = sPrefix + 'function ' + sName + '()' + '\n';
+            break;
+        }
+
+        case 'object':
+        {
+            sRet = sPrefix + 'var ' + sName + '(' + dbgGetObjType(oObj) + ') =';
+            if (oObj !== null)
+            {
+                sRet += '\n';
+            }
+            else
+            {
+                sRet += ' null\n';
+            }
+            break;
+        }
+
+        case 'string':
+        {
+            sRet = sPrefix + 'var ' + sName + '(string, ' + oObj.length + ')';
+            if (oObj.length < 80)
+            {
+                sRet += ' = "' + oObj + '"\n';
+            }
+            else
+            {
+                sRet += '\n';
+            }
+            break;
+        }
+
+        case 'Oops!':
+            sRet = sPrefix + sName + '(??)\n';
+            break;
+
+        default:
+            sRet = sPrefix + 'var ' + sName + '(' + sType + ')\n';
+            break;
+    }
+    return sRet;
+}
+
+
+function dbgObjInArray(aoObjs, oObj)
+{
+    var i = aoObjs.length;
+    while (i > 0)
+    {
+        i--;
+        if (aoObjs[i] === oObj)
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+function dbgDumpObjTreeWorker(oObj, sPrefix, aParentObjs, cMaxDepth)
+{
+    var sRet     = '';
+    var aMembers = pythonlikeShallowDir(oObj);
+    var i;
+
+    for (i = 0; i < aMembers.length; i++)
+    {
+        //var sName = i;
+        var sName = aMembers[i];
+        var oMember;
+        var sType;
+        var oEx;
+
+        try
+        {
+            oMember = oObj[sName];
+            sType = typeof oObj[sName];
+        }
+        catch (oEx)
+        {
+            oMember = null;
+            sType = 'Oops!';
+        }
+
+        //sRet += '[' + i + '/' + aMembers.length + ']';
+        sRet += dbgDumpObjWorker(sType, sName, oMember, sPrefix);
+
+        if (   sType == 'object'
+            && oObj !== null)
+        {
+
+            if (dbgObjInArray(aParentObjs, oMember))
+            {
+                sRet += sPrefix + '! parent recursion\n';
+            }
+            else if (   sName == 'previousSibling'
+                     || sName == 'previousElement'
+                     || sName == 'lastChild'
+                     || sName == 'firstElementChild'
+                     || sName == 'lastElementChild'
+                     || sName == 'nextElementSibling'
+                     || sName == 'prevElementSibling'
+                     || sName == 'parentElement'
+                     || sName == 'ownerDocument')
+            {
+                sRet += sPrefix + '! potentially dangerous element name\n';
+            }
+            else if (aParentObjs.length >= cMaxDepth)
+            {
+                sRet = sRet.substring(0, sRet.length - 1);
+                sRet += ' <too deep>!\n';
+            }
+            else
+            {
+
+                aParentObjs.push(oMember);
+                if (i + 1 < aMembers.length)
+                {
+                    sRet += dbgDumpObjTreeWorker(oMember, sPrefix + '| ', aParentObjs, cMaxDepth);
+                }
+                else
+                {
+                    sRet += dbgDumpObjTreeWorker(oMember, sPrefix.substring(0, sPrefix.length - 2) + '  | ', aParentObjs, cMaxDepth);
+                }
+                aParentObjs.pop();
+            }
+        }
+    }
+    return sRet;
+}
+
+/**
+ * Dumps the given object and all it's subobjects to the console.
+ *
+ * @returns String dump of the object.
+ * @param   oObj        The object under inspection.
+ * @param   sName       The object name (optional).
+ * @param   sPrefix     What to prefix the log output with (optional).
+ * @param   cMaxDepth   The max depth, optional.
+ */
+function dbgDumpObjTree(oObj, sName, sPrefix, cMaxDepth)
+{
+    var sType;
+    var sRet;
+    var oEx;
+
+    /*
+     * Defaults
+     */
+    if (!sPrefix)
+    {
+        sPrefix = '';
+    }
+
+    if (!sName)
+    {
+        sName = '??';
+    }
+
+    if (!cMaxDepth)
+    {
+        cMaxDepth = 2;
+    }
+
+    /*
+     * The object itself.
+     */
+    try
+    {
+        sType = typeof oObj;
+    }
+    catch (oEx)
+    {
+        sType = 'Oops!';
+    }
+    sRet = dbgDumpObjWorker(sType, sName, oObj, sPrefix);
+    if (sType == 'object' && oObj !== null)
+    {
+        var aParentObjs = Array();
+        aParentObjs.push(oObj);
+        sRet += dbgDumpObjTreeWorker(oObj, sPrefix + '| ', aParentObjs, cMaxDepth);
+    }
+
+    return sRet;
+}
+
+function dbgLogString(sLongString)
+{
+    var aStrings = sLongString.split("\n");
+    var i;
+    for (i = 0; i < aStrings.length; i++)
+    {
+        console.log(aStrings[i]);
+    }
+    console.log('dbgLogString - end - ' + aStrings.length + '/' + sLongString.length);
+    return true;
+}
+
+function dbgLogObjTree(oObj, sName, sPrefix, cMaxDepth)
+{
+    return dbgLogString(dbgDumpObjTree(oObj, sName, sPrefix, cMaxDepth));
+}
+
+/** @}  */
+
diff --git a/src/VBox/ValidationKit/testmanager/htdocs/js/graphwiz.js b/src/VBox/ValidationKit/testmanager/htdocs/js/graphwiz.js
new file mode 100644
index 0000000..a15d0b5
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/htdocs/js/graphwiz.js
@@ -0,0 +1,117 @@
+/* $Id: graphwiz.js $ */
+/** @file
+ * JavaScript functions for the Graph Wizard.
+ */
+
+/*
+ *
+ * Copyright (C) 2012-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** The previous width of the div element that we measure.  */
+var g_cxPreviousWidth = 0;
+
+
+/**
+ * onload function that sets g_cxPreviousWidth to the width of @a sWidthSrcId.
+ *
+ * @returns true.
+ * @param   sWidthSrcId     The ID of the element which width we should measure.
+ */
+function graphwizOnLoadRememberWidth(sWidthSrcId)
+{
+    var cx = getUnscaledElementWidthById(sWidthSrcId);
+    if (cx)
+    {
+        g_cxPreviousWidth = cx;
+    }
+    return true;
+}
+
+
+/**
+ * onresize callback function that scales the given graph width input field
+ * value according to the resized element.
+ *
+ * @returns true.
+ * @param   sWidthSrcId     The ID of the element which width we should measure
+ *                          the resize effect on.
+ * @param   sWidthInputId   The ID of the input field which values should be
+ *                          scaled.
+ *
+ * @remarks Since we're likely to get several resize calls as part of one user
+ *          resize operation, we're likely to suffer from some rounding
+ *          artifacts.  So, should the user abort or undo the resizing, the
+ *          width value is unlikely to be restored to the exact value it had
+ *          prior to the resizing.
+ */
+function graphwizOnResizeRecalcWidth(sWidthSrcId, sWidthInputId)
+{
+    var cx = getUnscaledElementWidthById(sWidthSrcId);
+    if (cx)
+    {
+        var oElement = document.getElementById(sWidthInputId);
+        if (oElement && g_cxPreviousWidth)
+        {
+            var cxOld = oElement.value;
+            if (isInteger(cxOld))
+            {
+                var fpRatio = cxOld / g_cxPreviousWidth;
+                oElement.value = Math.round(cx * fpRatio);
+            }
+        }
+        g_cxPreviousWidth = cx;
+    }
+
+    return true;
+}
+
+/**
+ * Fills thegraph size (cx, cy) and dpi fields with default values.
+ *
+ * @returns false (for onclick).
+ * @param   sWidthSrcId     The ID of the element which width we should measure.
+ * @param   sWidthInputId   The ID of the graph width field (cx).
+ * @param   sHeightInputId  The ID of the graph height field (cy).
+ * @param   sDpiInputId     The ID of the graph DPI field.
+ */
+function graphwizSetDefaultSizeValues(sWidthSrcId, sWidthInputId, sHeightInputId, sDpiInputId)
+{
+    var cx            = getUnscaledElementWidthById(sWidthSrcId);
+    var cDotsPerInch  = getDeviceXDotsPerInch();
+
+    if (cx)
+    {
+        setInputFieldValue(sWidthInputId, cx);
+        setInputFieldValue(sHeightInputId, Math.round(cx * 5 / 16)); /* See wuimain.py. */
+    }
+
+    if (cDotsPerInch)
+    {
+        setInputFieldValue(sDpiInputId, cDotsPerInch);
+    }
+
+    return false;
+}
+
diff --git a/src/VBox/ValidationKit/testmanager/misc/Makefile.kmk b/src/VBox/ValidationKit/testmanager/misc/Makefile.kmk
new file mode 100644
index 0000000..df27b62
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/misc/Makefile.kmk
@@ -0,0 +1,36 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+$(evalcall def_vbox_validationkit_process_js_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testmanager/misc/htpasswd-logout b/src/VBox/ValidationKit/testmanager/misc/htpasswd-logout
new file mode 100644
index 0000000..8a36998
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/misc/htpasswd-logout
@@ -0,0 +1 @@
+logout:$apr1$OqiMc/Uv$XylAjnIPla7gb57UMW0TK.
diff --git a/src/VBox/ValidationKit/testmanager/misc/htpasswd-sample b/src/VBox/ValidationKit/testmanager/misc/htpasswd-sample
new file mode 100644
index 0000000..6b6c1b3
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/misc/htpasswd-sample
@@ -0,0 +1,2 @@
+admin:ZXHvyrLs.vCmw
+test:ClO2uu6/D7jDg
diff --git a/src/VBox/ValidationKit/testmanager/readme.txt b/src/VBox/ValidationKit/testmanager/readme.txt
new file mode 100644
index 0000000..9bcb941
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/readme.txt
@@ -0,0 +1,13 @@
+$Id: readme.txt $
+
+Directory descriptions:
+    ./                  The Test Manager.
+    ./batch/            Batch scripts to be run via cron.
+    ./cgi/              CGI scripts (we'll use standard CGI at first).
+    ./core/             The core Test Manager logic (model).
+    ./htdocs/           Files to be served directly by the web server.
+    ./htdocs/css/       Style sheets.
+    ./htdocs/images/    Graphics.
+    ./webui/            The Web User Interface (WUI) bits. (Not sure if we will
+                        do model-view-controller stuff, though. Time will show.)
+
diff --git a/src/VBox/ValidationKit/testmanager/selftest/st1-load.pgsql b/src/VBox/ValidationKit/testmanager/selftest/st1-load.pgsql
new file mode 100644
index 0000000..e9618bb
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/selftest/st1-load.pgsql
@@ -0,0 +1,154 @@
+-- $Id: st1-load.pgsql $
+--- @file
+-- VBox Test Manager - Self Test #1 Database Load File.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+
+\set ON_ERROR_STOP 1
+\connect testmanager;
+
+BEGIN WORK;
+
+
+INSERT INTO Users (uid, sUsername, sEmail, sFullName, sLoginName)
+    VALUES (1112223331, 'st1', 'st1 at example.org', 'self test #1', 'st1');
+
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (1112223331, 'st1-test1', TRUE, 3600,  'validationkit/tests/selftests/tdSelfTest1.py', '@DOWNLOAD_BASE_URL@/VBoxValidationKit.zip');
+
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test1'), 1112223331, '');
+
+INSERT INTO TestGroups (uidAuthor, sName)
+    VALUES (1112223331, 'st1-testgroup');
+
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES ((SELECT idTestGroup FROM TestGroups WHERE sName = 'st1-testgroup'),
+            (SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test1'),
+            1112223331);
+
+INSERT INTO BuildSources (uidAuthor, sName, sProduct, sBranch, asTypes, asOsArches)
+    VALUES (1112223331, 'st1-src', 'st1', 'trunk', 
+            ARRAY['release', 'strict'], 
+            ARRAY['win.x86', 'linux.noarch', 'solaris.amd64', 'os-agnostic.sparc64', 'os-agnostic.noarch']);
+
+INSERT INTO BuildCategories (sProduct, sBranch, sType, asOsArches)
+    VALUES ('st1', 'trunk', 'release', ARRAY['os-agnostic.noarch']);
+
+INSERT INTO Builds (uidAuthor, idBuildCategory, iRevision, sVersion, sBinaries)
+    VALUES (1112223331, 
+            (SELECT idBuildCategory FROM BuildCategories WHERE sProduct = 'st1' AND sBranch = 'trunk'),
+            1234, '1.0', '');
+
+INSERT INTO SchedGroups (uidAuthor, sName, sDescription, fEnabled, idBuildSrc)
+    VALUES (1112223331, 'st1-group', 'test test #1', TRUE,
+            (SELECT idBuildSrc   FROM BuildSources WHERE sName = 'st1-src') );
+
+INSERT INTO SchedGroupMembers (idSchedGroup, idTestGroup, uidAuthor)
+    VALUES ((SELECT idSchedGroup FROM SchedGroups  WHERE sName = 'st1-group'),
+            (SELECT idTestGroup  FROM TestGroups   WHERE sName = 'st1-testgroup'),
+            1112223331);
+
+
+-- The second test
+
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (1112223331, 'st1-test2', TRUE, 3600,  'validationkit/tests/selftests/tdSelfTest2.py', '@DOWNLOAD_BASE_URL@/VBoxValidationKit.zip');
+
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test2'), 1112223331, '');
+
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES ((SELECT idTestGroup FROM TestGroups WHERE sName = 'st1-testgroup'),
+            (SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test2'),
+            1112223331);
+
+-- The third test
+
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (1112223331, 'st1-test3', TRUE, 3600,  'validationkit/tests/selftests/tdSelfTest3.py', '@DOWNLOAD_BASE_URL@/VBoxValidationKit.zip');
+
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test3'), 1112223331, '');
+
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES ((SELECT idTestGroup FROM TestGroups WHERE sName = 'st1-testgroup'),
+            (SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test3'),
+            1112223331);
+
+-- The fourth thru eight tests
+
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (1112223331, 'st1-test4-neg', TRUE, 3600,  'validationkit/tests/selftests/tdSelfTest4.py --test immediate-sub-tests', 
+            '@DOWNLOAD_BASE_URL@/VBoxValidationKit.zip');
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test4-neg'), 1112223331, '');
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES ((SELECT idTestGroup FROM TestGroups WHERE sName = 'st1-testgroup'),
+            (SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test4-neg'),
+            1112223331);
+
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (1112223331, 'st1-test5-neg', TRUE, 3600,  'validationkit/tests/selftests/tdSelfTest4.py --test total-sub-tests', 
+            '@DOWNLOAD_BASE_URL@/VBoxValidationKit.zip');
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test5-neg'), 1112223331, '');
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES ((SELECT idTestGroup FROM TestGroups WHERE sName = 'st1-testgroup'),
+            (SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test5-neg'),
+            1112223331);
+
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (1112223331, 'st1-test6-neg', TRUE, 3600,  'validationkit/tests/selftests/tdSelfTest4.py --test immediate-values', 
+            '@DOWNLOAD_BASE_URL@/VBoxValidationKit.zip');
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test6-neg'), 1112223331, '');
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES ((SELECT idTestGroup FROM TestGroups WHERE sName = 'st1-testgroup'),
+            (SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test6-neg'),
+            1112223331);
+
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (1112223331, 'st1-test7-neg', TRUE, 3600,  'validationkit/tests/selftests/tdSelfTest4.py --test total-values', 
+            '@DOWNLOAD_BASE_URL@/VBoxValidationKit.zip');
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test7-neg'), 1112223331, '');
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES ((SELECT idTestGroup FROM TestGroups WHERE sName = 'st1-testgroup'),
+            (SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test7-neg'),
+            1112223331);
+
+INSERT INTO TestCases (uidAuthor, sName, fEnabled, cSecTimeout, sBaseCmd, sTestSuiteZips)
+    VALUES (1112223331, 'st1-test8-neg', TRUE, 3600,  'validationkit/tests/selftests/tdSelfTest4.py --test immediate-messages', 
+            '@DOWNLOAD_BASE_URL@/VBoxValidationKit.zip');
+INSERT INTO TestCaseArgs (idTestCase, uidAuthor, sArgs)
+    VALUES ((SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test8-neg'), 1112223331, '');
+INSERT INTO TestGroupMembers (idTestGroup, idTestCase, uidAuthor)
+    VALUES ((SELECT idTestGroup FROM TestGroups WHERE sName = 'st1-testgroup'),
+            (SELECT idTestCase  FROM TestCases  WHERE sName = 'st1-test8-neg'),
+            1112223331);
+
+COMMIT WORK;
+
diff --git a/src/VBox/ValidationKit/testmanager/selftest/st1-unload.pgsql b/src/VBox/ValidationKit/testmanager/selftest/st1-unload.pgsql
new file mode 100644
index 0000000..a250a9c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/selftest/st1-unload.pgsql
@@ -0,0 +1,77 @@
+-- $Id: st1-unload.pgsql $
+--- @file
+-- VBox Test Manager - Self Test #1 Database Unload File.
+--
+
+--
+-- Copyright (C) 2012-2014 Oracle Corporation
+--
+-- This file is part of VirtualBox Open Source Edition (OSE), as
+-- available from http://www.virtualbox.org. This file is free software;
+-- you can redistribute it and/or modify it under the terms of the GNU
+-- General Public License (GPL) as published by the Free Software
+-- Foundation, in version 2 as it comes in the "COPYING" file of the
+-- VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+-- hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+--
+-- The contents of this file may alternatively be used under the terms
+-- of the Common Development and Distribution License Version 1.0
+-- (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+-- VirtualBox OSE distribution, in which case the provisions of the
+-- CDDL are applicable instead of those of the GPL.
+--
+-- You may elect to license modified versions of this file under the
+-- terms and conditions of either the GPL or the CDDL or both.
+--
+
+
+
+\set ON_ERROR_STOP 1
+\connect testmanager;
+
+BEGIN WORK;
+
+DELETE FROM TestBoxStatuses;
+DELETE FROM SchedQueues;
+
+DELETE FROM SchedGroupMembers   WHERE uidAuthor = 1112223331;
+UPDATE TestBoxes SET idSchedGroup = 1 WHERE idSchedGroup IN ( SELECT idSchedGroup FROM SchedGroups WHERE uidAuthor = 1112223331 );
+DELETE FROM SchedGroups         WHERE uidAuthor = 1112223331 OR sName = 'st1-group';
+
+UPDATE TestSets SET idTestResult = NULL 
+    WHERE idTestCase IN ( SELECT idTestCase FROM TestCases WHERE uidAuthor = 1112223331 );
+
+DELETE FROM TestResultValues
+    WHERE idTestResult IN ( SELECT idTestResult FROM TestResults 
+                            WHERE idTestSet IN (  SELECT idTestSet  FROM TestSets  
+                                                  WHERE idTestCase IN ( SELECT idTestCase FROM TestCases 
+                                                                        WHERE uidAuthor = 1112223331 ) ) );
+DELETE FROM TestResultFiles
+    WHERE idTestResult IN ( SELECT idTestResult FROM TestResults 
+                            WHERE idTestSet IN (  SELECT idTestSet  FROM TestSets  
+                                                  WHERE idTestCase IN ( SELECT idTestCase FROM TestCases 
+                                                                        WHERE uidAuthor = 1112223331 ) ) );
+DELETE FROM TestResultMsgs
+    WHERE idTestResult IN ( SELECT idTestResult FROM TestResults 
+                            WHERE idTestSet IN (  SELECT idTestSet  FROM TestSets  
+                                                  WHERE idTestCase IN ( SELECT idTestCase FROM TestCases 
+                                                                        WHERE uidAuthor = 1112223331 ) ) );
+DELETE FROM TestResults         
+    WHERE idTestSet IN (  SELECT idTestSet  FROM TestSets  
+                          WHERE idTestCase IN ( SELECT idTestCase FROM TestCases WHERE uidAuthor = 1112223331 ) );
+DELETE FROM TestSets            
+    WHERE idTestCase IN ( SELECT idTestCase FROM TestCases WHERE uidAuthor = 1112223331 );
+
+DELETE FROM TestCases           WHERE uidAuthor = 1112223331;
+DELETE FROM TestCaseArgs        WHERE uidAuthor = 1112223331;
+DELETE FROM TestGroups          WHERE uidAuthor = 1112223331 OR sName = 'st1-testgroup';
+DELETE FROM TestGroupMembers    WHERE uidAuthor = 1112223331;
+
+DELETE FROM BuildSources        WHERE uidAuthor = 1112223331;
+DELETE FROM Builds              WHERE uidAuthor = 1112223331;
+DELETE FROM BuildCategories     WHERE sProduct  = 'st1';
+
+DELETE FROM Users               WHERE uid       = 1112223331;
+
+COMMIT WORK;
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/Makefile.kmk b/src/VBox/ValidationKit/testmanager/webui/Makefile.kmk
new file mode 100644
index 0000000..00a71d6
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/Makefile.kmk
@@ -0,0 +1,37 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(wildcard $(PATH_SUB_CURRENT)/*.py)
+VBOX_VALIDATIONKIT_PYUNITTEST_EXCLUDE += $(PATH_SUB_CURRENT)/wuihlpgraphmatplotlib.py
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+$(evalcall def_vbox_validationkit_process_js_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/__init__.py b/src/VBox/ValidationKit/testmanager/webui/__init__.py
new file mode 100644
index 0000000..d06f985
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/__init__.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# $Id: __init__.py $
+
+"""
+TestBox Script - WUI Presentation.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/template-details.html b/src/VBox/ValidationKit/testmanager/webui/template-details.html
new file mode 100644
index 0000000..1700523
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/template-details.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+    <meta http-equiv="content-type"             content="text/html; charset=UTF-8" />
+    <meta http-equiv="content-language"         content="en" />
+    <meta name="language"                       content="en" />
+    <link href="htdocs/images/tmfavicon.ico"    rel="shortcut icon" type="image/x-icon" />
+    <link href="htdocs/images/tmfavicon.ico"    rel="icon"          type="image/x-icon" />
+    <link href="htdocs/css/common.css"          rel="stylesheet"    type="text/css" media="screen" />
+    <link href="htdocs/css/details.css"         rel="stylesheet"    type="text/css" media="screen" />
+    <script type="text/javascript" src="htdocs/js/common.js"></script>
+    <title>@@PAGE_TITLE@@</title>
+</head>
+
+<body>
+
+<div id="logo">
+    <img alt ="VirtualBox" src="htdocs/images/VirtualBox.svg">
+</div>
+
+<div id="header">
+    <h1>@@PAGE_TITLE@@</h1>
+</div>
+
+<div id="login">
+    <p><small>
+        Logged in as <b>@@USER_NAME@@</b>@@LOG_OUT@@
+    </small></p>
+</div>
+
+<div id="top-menu">
+    <ul>
+        @@TOP_MENU_ITEMS@@
+    </ul>
+</div>
+
+<div id="main">
+    @@PAGE_BODY@@
+
+    @@DEBUG@@
+</div>
+
+
+</body>
+</html>
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/template-graphwiz.html b/src/VBox/ValidationKit/testmanager/webui/template-graphwiz.html
new file mode 100644
index 0000000..86765c6
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/template-graphwiz.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+    <meta http-equiv="content-type"             content="text/html; charset=UTF-8" />
+    <meta http-equiv="content-language"         content="en" />
+    <meta name="language"                       content="en" />
+    <link href="htdocs/images/tmfavicon.ico"    rel="shortcut icon" type="image/x-icon" />
+    <link href="htdocs/images/tmfavicon.ico"    rel="icon"          type="image/x-icon" />
+    <link href="htdocs/css/common.css"          rel="stylesheet"    type="text/css" media="screen" />
+    <link href="htdocs/css/graphwiz.css"        rel="stylesheet"    type="text/css" media="screen" />
+    <script type="text/javascript" src="htdocs/js/common.js"></script>
+    <script type="text/javascript" src="htdocs/js/graphwiz.js"></script>
+    <title>@@PAGE_TITLE@@</title>
+</head>
+
+<body>
+
+<div id="logo">
+    <img alt ="VirtualBox" src="htdocs/images/VirtualBox.svg">
+</div>
+
+<div id="header">
+    <h1>@@PAGE_TITLE@@</h1>
+</div>
+
+<div id="login">
+    <p><small>
+        Logged in as <b>@@USER_NAME@@</b>@@LOG_OUT@@
+    </small></p>
+</div>
+
+<div id="top-menu">
+    <ul>
+        @@TOP_MENU_ITEMS@@
+    </ul>
+</div>
+
+<div id="main">
+    @@PAGE_BODY@@
+
+    @@DEBUG@@
+</div>
+
+
+</body>
+</html>
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/template-tooltip.html b/src/VBox/ValidationKit/testmanager/webui/template-tooltip.html
new file mode 100644
index 0000000..ac9f8ad
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/template-tooltip.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+    <meta http-equiv="content-type"             content="text/html; charset=UTF-8" />
+    <meta http-equiv="content-language"         content="en" />
+    <meta name="language"                       content="en" />
+    <link href="htdocs/css/common.css"          rel="stylesheet"    type="text/css" media="screen" />
+    <link href="htdocs/css/tooltip.css"         rel="stylesheet"    type="text/css" media="screen" />
+    <title>@@PAGE_TITLE@@</title>
+</head>
+
+<body scroll="no">
+<div id="tooltip" class="tooltip-main">
+<div id="tooltip-inner">
+@@PAGE_BODY@@
+</div>
+</div>
+</body>
+</html>
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/template.html b/src/VBox/ValidationKit/testmanager/webui/template.html
new file mode 100644
index 0000000..7dbcc4b
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/template.html
@@ -0,0 +1,58 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en">
+<head>
+    <meta http-equiv="content-type"             content="text/html; charset=UTF-8" />
+    <meta http-equiv="content-language"         content="en" />
+    <meta name="language"                       content="en" />
+    <link href="htdocs/images/tmfavicon.ico"    rel="shortcut icon" />
+    <link href="htdocs/images/tmfavicon.ico"    rel="icon"          type="image/x-icon" />
+    <link href="htdocs/css/common.css"          rel="stylesheet"    type="text/css" media="screen" />
+    <script type="text/javascript" src="htdocs/js/common.js"></script>
+    <title>@@PAGE_TITLE@@</title>
+</head>
+
+<body>
+
+<div id="logo">
+    <img alt ="VirtualBox" src="htdocs/images/VirtualBox.svg">
+</div>
+
+<div id="header">
+    <h1>@@PAGE_TITLE@@</h1>
+</div>
+
+<div id="login">
+    <p><small>
+        Logged in as <b>@@USER_NAME@@</b>@@LOG_OUT@@
+    </small></p>
+</div>
+
+<div id="side-menu">
+    <ul>
+        @@SIDE_MENU_ITEMS@@
+    </ul>
+    <div id="side-footer">
+        <p>
+        VBox Test Manager<br/>@@TESTMANAGER_VERSION@@r@@TESTMANAGER_REVISION@@
+        </p>
+        <br>
+        <p>Copyright © 2012-2014 Oracle Corporation</p>
+    </div>
+</div>
+
+<div id="top-menu">
+    <ul>
+        @@TOP_MENU_ITEMS@@
+    </ul>
+</div>
+
+<div id="main">
+    @@PAGE_BODY@@
+
+    @@DEBUG@@
+</div>
+
+
+</body>
+</html>
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py b/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py
new file mode 100644
index 0000000..55096ad
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py
@@ -0,0 +1,739 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadmin.py $
+
+"""
+Test Manager Core - WUI - Admin Main page.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import cgitb;
+import sys;
+
+# Validation Kit imports.
+from common                                    import webutils
+from testmanager                               import config;
+from testmanager.core.buildsource              import BuildSourceLogic, BuildSourceData
+from testmanager.core.build                    import BuildCategoryLogic, BuildCategoryData, BuildLogic, BuildData;
+from testmanager.core.globalresource           import GlobalResourceLogic, GlobalResourceData
+from testmanager.core.schedulerbase            import SchedulerBase
+from testmanager.core.schedgroup               import SchedGroupLogic, SchedGroupData, SchedGroupDataEx
+from testmanager.core.systemlog                import SystemLogLogic
+from testmanager.core.testbox                  import TestBoxData, TestBoxLogic
+from testmanager.core.testcase                 import TestCaseLogic, TestCaseData, TestCaseDataEx
+from testmanager.core.useraccount              import UserAccountLogic, UserAccountData
+from testmanager.core.testgroup                import TestGroupLogic, TestGroupDataEx;
+from testmanager.core.failurecategory          import FailureCategoryLogic, FailureCategoryData
+from testmanager.core.failurereason            import FailureReasonLogic, FailureReasonData
+from testmanager.core.buildblacklist           import BuildBlacklistLogic, BuildBlacklistData
+from testmanager.webui.wuibase                 import WuiDispatcherBase, WuiException
+from testmanager.webui.wuiadminbuild           import WuiAdminBuild, WuiAdminBuildList
+from testmanager.webui.wuiadminsystemlog       import WuiAdminSystemLogList
+from testmanager.webui.wuiadminbuildsource     import WuiAdminBuildSrc, WuiAdminBuildSrcList;
+from testmanager.webui.wuiadminbuildcategory   import WuiAdminBuildCat, WuiAdminBuildCatList;
+from testmanager.webui.wuiadminglobalrsrc      import WuiGlobalResource, WuiGlobalResourceList
+from testmanager.webui.wuiadmintestbox         import WuiTestBoxList, WuiTestBox
+from testmanager.webui.wuiadmintestcase        import WuiTestCase, WuiTestCaseList
+from testmanager.webui.wuiadminuseraccount     import WuiUserAccountList, WuiUserAccount
+from testmanager.webui.wuiadmintestgroup       import WuiTestGroup, WuiTestGroupList;
+from testmanager.webui.wuiadminschedgroup      import WuiSchedGroup, WuiAdminSchedGroupList;
+from testmanager.webui.wuiadminbuildblacklist  import WuiAdminBuildBlacklist, WuiAdminListOfBlacklistItems
+from testmanager.webui.wuifailurecategory      import WuiFailureCategory, WuiFailureCategoryList
+from testmanager.webui.wuiadminfailurereason   import WuiAdminFailureReason, WuiAdminFailureReasonList
+
+
+class WuiAdmin(WuiDispatcherBase):
+    """
+    WUI Admin main page.
+    """
+
+    ## The name of the script.
+    ksScriptName = 'admin.py'
+
+
+    ## @name Actions
+    ## @{
+    ksActionSystemLogList           = 'SystemLogList'
+
+    ksActionUserList                = 'UserList'
+    ksActionUserAdd                 = 'UserAdd'
+    ksActionUserEdit                = 'UserEdit'
+    ksActionUserAddPost             = 'UserAddPost'
+    ksActionUserEditPost            = 'UserEditPost'
+    ksActionUserDelPost             = 'UserDelPost'
+
+    ksActionTestBoxList             = 'TestBoxList'
+    ksActionTestBoxListPost         = 'TestBoxListPost'
+    ksActionTestBoxAdd              = 'TestBoxAdd'
+    ksActionTestBoxAddPost          = 'TestBoxAddPost'
+    ksActionTestBoxEdit             = 'TestBoxEdit'
+    ksActionTestBoxEditPost         = 'TestBoxEditPost'
+    ksActionTestBoxDetails          = 'TestBoxDetails'
+    ksActionTestBoxRemovePost       = 'TestBoxRemove'
+    ksActionTestBoxesRegenQueues    = 'TestBoxesRegenQueues';
+
+    ksActionTestCaseList            = 'TestCaseList'
+    ksActionTestCaseAdd             = 'TestCaseAdd'
+    ksActionTestCaseAddPost         = 'TestCaseAddPost'
+    ksActionTestCaseClone           = 'TestCaseClone'
+    ksActionTestCaseDetails         = 'TestCaseDetails'
+    ksActionTestCaseEdit            = 'TestCaseEdit'
+    ksActionTestCaseEditPost        = 'TestCaseEditPost'
+    ksActionTestCaseDoRemove        = 'TestCaseDoRemove'
+
+    ksActionGlobalRsrcShowAll       = 'GlobalRsrcShowAll'
+    ksActionGlobalRsrcShowAdd       = 'GlobalRsrcShowAdd'
+    ksActionGlobalRsrcShowEdit      = 'GlobalRsrcShowEdit'
+    ksActionGlobalRsrcAdd           = 'GlobalRsrcAddPost'
+    ksActionGlobalRsrcEdit          = 'GlobalRsrcEditPost'
+    ksActionGlobalRsrcDel           = 'GlobalRsrcDelPost'
+
+    ksActionBuildList               = 'BuildList'
+    ksActionBuildAdd                = 'BuildAdd'
+    ksActionBuildAddPost            = 'BuildAddPost'
+    ksActionBuildClone              = 'BuildClone'
+    ksActionBuildDetails            = 'BuildDetails'
+    ksActionBuildDoRemove           = 'BuildDoRemove'
+    ksActionBuildEdit               = 'BuildEdit'
+    ksActionBuildEditPost           = 'BuildEditPost'
+
+    ksActionBuildBlacklist          = 'BuildBlacklist';
+    ksActionBuildBlacklistAdd       = 'BuildBlacklistAdd';
+    ksActionBuildBlacklistAddPost   = 'BuildBlacklistAddPost';
+    ksActionBuildBlacklistClone     = 'BuildBlacklistClone';
+    ksActionBuildBlacklistDetails   = 'BuildBlacklistDetails';
+    ksActionBuildBlacklistDoRemove  = 'BuildBlacklistDoRemove';
+    ksActionBuildBlacklistEdit      = 'BuildBlacklistEdit';
+    ksActionBuildBlacklistEditPost  = 'BuildBlacklistEditPost';
+
+    ksActionFailureCategoryList     = 'FailureCategoryList'
+    ksActionFailureCategoryShowAdd  = 'FailureCategoryShowAdd'
+    ksActionFailureCategoryShowEdit = 'FailureCategoryShowEdit'
+    ksActionFailureCategoryAdd      = 'FailureCategoryAdd'
+    ksActionFailureCategoryEdit     = 'FailureCategoryEdit'
+    ksActionFailureCategoryDel      = 'FailureCategoryDel'
+
+    ksActionFailureReasonList       = 'FailureReasonList'
+    ksActionFailureReasonShowAdd    = 'FailureReasonShowAdd'
+    ksActionFailureReasonShowEdit   = 'FailureReasonShowEdit'
+    ksActionFailureReasonAdd        = 'FailureReasonAdd'
+    ksActionFailureReasonEdit       = 'FailureReasonEdit'
+    ksActionFailureReasonDel        = 'FailureReasonDel'
+
+    ksActionBuildSrcList            = 'BuildSrcList'
+    ksActionBuildSrcAdd             = 'BuildSrcAdd'
+    ksActionBuildSrcAddPost         = 'BuildSrcAddPost'
+    ksActionBuildSrcClone           = 'BuildSrcClone'
+    ksActionBuildSrcDetails         = 'BuildSrcDetails'
+    ksActionBuildSrcEdit            = 'BuildSrcEdit'
+    ksActionBuildSrcEditPost        = 'BuildSrcEditPost'
+    ksActionBuildSrcDoRemove        = 'BuildSrcDoRemove'
+
+    ksActionBuildCategoryList       = 'BuildCategoryList'
+    ksActionBuildCategoryAdd        = 'BuildCategoryAdd'
+    ksActionBuildCategoryAddPost    = 'BuildCategoryAddPost'
+    ksActionBuildCategoryClone      = 'BuildCategoryClone';
+    ksActionBuildCategoryDetails    = 'BuildCategoryDetails';
+    ksActionBuildCategoryDoRemove   = 'BuildCategoryDoRemove';
+
+    ksActionTestGroupList           = 'TestGroupList'
+    ksActionTestGroupAdd            = 'TestGroupAdd'
+    ksActionTestGroupAddPost        = 'TestGroupAddPost'
+    ksActionTestGroupClone          = 'TestGroupClone'
+    ksActionTestGroupDetails        = 'TestGroupDetails'
+    ksActionTestGroupDoRemove       = 'TestGroupDoRemove'
+    ksActionTestGroupEdit           = 'TestGroupEdit'
+    ksActionTestGroupEditPost       = 'TestGroupEditPost'
+    ksActionTestCfgRegenQueues      = 'TestCfgRegenQueues'
+
+    ksActionSchedGroupList          = 'SchedGroupList'
+    ksActionSchedGroupAdd           = 'SchedGroupAdd';
+    ksActionSchedGroupAddPost       = 'SchedGroupAddPost';
+    ksActionSchedGroupClone         = 'SchedGroupClone';
+    ksActionSchedGroupDetails       = 'SchedGroupDetails';
+    ksActionSchedGroupDoRemove      = 'SchedGroupDel';
+    ksActionSchedGroupEdit          = 'SchedGroupEdit';
+    ksActionSchedGroupEditPost      = 'SchedGroupEditPost';
+    ## @}
+
+    def __init__(self, oSrvGlue):
+        WuiDispatcherBase.__init__(self, oSrvGlue, self.ksScriptName);
+
+        self._sTemplate     = 'template.html';
+
+        # Use short form to avoid hitting the right margin (130) when using lambda.
+        d = self._dDispatch;  # pylint: disable=C0103
+
+        #
+        # System Log actions.
+        #
+        d[self.ksActionSystemLogList]           = lambda: self._actionGenericListing(SystemLogLogic, WuiAdminSystemLogList)
+
+        #
+        # User Account actions.
+        #
+        d[self.ksActionUserList]                = lambda: self._actionGenericListing(UserAccountLogic, WuiUserAccountList)
+        d[self.ksActionUserAdd]                 = lambda: self._actionGenericFormAdd(UserAccountData, WuiUserAccount)
+        d[self.ksActionUserEdit]                = lambda: self._actionGenericFormEdit(UserAccountData, WuiUserAccount,
+                                                                                      UserAccountData.ksParam_uid);
+        d[self.ksActionUserAddPost]             = lambda: self._actionGenericFormAddPost(UserAccountData, UserAccountLogic,
+                                                                                         WuiUserAccount, self.ksActionUserList)
+        d[self.ksActionUserEditPost]            = lambda: self._actionGenericFormEditPost(UserAccountData, UserAccountLogic,
+                                                                                          WuiUserAccount, self.ksActionUserList)
+        d[self.ksActionUserDelPost]             = lambda: self._actionGenericDoRemove(UserAccountLogic,
+                                                                                      UserAccountData.ksParam_uid,
+                                                                                      self.ksActionUserList)
+
+        #
+        # TestBox actions.
+        #
+        d[self.ksActionTestBoxList]             = lambda: self._actionGenericListing(TestBoxLogic, WuiTestBoxList);
+        d[self.ksActionTestBoxListPost]         = self._actionTestBoxListPost;
+        d[self.ksActionTestBoxAdd]              = lambda: self._actionGenericFormAdd(TestBoxData, WuiTestBox);
+        d[self.ksActionTestBoxAddPost]          = lambda: self._actionGenericFormAddPost(TestBoxData, TestBoxLogic,
+                                                                                         WuiTestBox, self.ksActionTestBoxList);
+        d[self.ksActionTestBoxDetails]          = lambda: self._actionGenericFormDetails(TestBoxData, TestBoxLogic, WuiTestBox,
+                                                                                         'idTestBox', 'idGenTestBox');
+        d[self.ksActionTestBoxEdit]             = lambda: self._actionGenericFormEdit(TestBoxData, WuiTestBox,
+                                                                                      TestBoxData.ksParam_idTestBox);
+        d[self.ksActionTestBoxEditPost]         = lambda: self._actionGenericFormEditPost(TestBoxData, TestBoxLogic,
+                                                                                          WuiTestBox, self.ksActionTestBoxList);
+        d[self.ksActionTestBoxRemovePost]       = lambda: self._actionGenericDoRemove(TestBoxLogic,
+                                                                                      TestBoxData.ksParam_idTestBox,
+                                                                                      self.ksActionTestBoxList)
+        d[self.ksActionTestBoxesRegenQueues]    = self._actionRegenQueuesCommon;
+
+        #
+        # Test Case actions.
+        #
+        d[self.ksActionTestCaseList]            = lambda: self._actionGenericListing(TestCaseLogic, WuiTestCaseList);
+        d[self.ksActionTestCaseAdd]             = lambda: self._actionGenericFormAdd(TestCaseDataEx, WuiTestCase);
+        d[self.ksActionTestCaseAddPost]         = lambda: self._actionGenericFormAddPost(TestCaseDataEx, TestCaseLogic,
+                                                                                         WuiTestCase, self.ksActionTestCaseList);
+        d[self.ksActionTestCaseClone]           = lambda: self._actionGenericFormClone(  TestCaseDataEx, WuiTestCase,
+                                                                                         'idTestCase', 'idGenTestCase');
+        d[self.ksActionTestCaseDetails]         = lambda: self._actionGenericFormDetails(TestCaseDataEx, TestCaseLogic,
+                                                                                         WuiTestCase, 'idTestCase',
+                                                                                         'idGenTestCase');
+        d[self.ksActionTestCaseEdit]            = lambda: self._actionGenericFormEdit(TestCaseDataEx, WuiTestCase,
+                                                                                      TestCaseDataEx.ksParam_idTestCase);
+        d[self.ksActionTestCaseEditPost]        = lambda: self._actionGenericFormEditPost(TestCaseDataEx, TestCaseLogic,
+                                                                                          WuiTestCase, self.ksActionTestCaseList);
+        d[self.ksActionTestCaseDoRemove]        = lambda: self._actionGenericDoRemove(TestCaseLogic,
+                                                                                      TestCaseData.ksParam_idTestCase,
+                                                                                      self.ksActionTestCaseList);
+
+        #
+        # Global Resource actions
+        #
+        d[self.ksActionGlobalRsrcShowAll]       = lambda: self._actionGenericListing(GlobalResourceLogic, WuiGlobalResourceList)
+        d[self.ksActionGlobalRsrcShowAdd]       = lambda: self._actionGlobalRsrcShowAddEdit(WuiAdmin.ksActionGlobalRsrcAdd)
+        d[self.ksActionGlobalRsrcShowEdit]      = lambda: self._actionGlobalRsrcShowAddEdit(WuiAdmin.ksActionGlobalRsrcEdit)
+        d[self.ksActionGlobalRsrcAdd]           = lambda: self._actionGlobalRsrcAddEdit(WuiAdmin.ksActionGlobalRsrcAdd)
+        d[self.ksActionGlobalRsrcEdit]          = lambda: self._actionGlobalRsrcAddEdit(WuiAdmin.ksActionGlobalRsrcEdit)
+        d[self.ksActionGlobalRsrcDel]           = lambda: self._actionGenericDoDelOld(GlobalResourceLogic,
+                                                                                      GlobalResourceData.ksParam_idGlobalRsrc,
+                                                                                      self.ksActionGlobalRsrcShowAll)
+
+        #
+        # Build Source actions
+        #
+        d[self.ksActionBuildSrcList]        = lambda: self._actionGenericListing(BuildSourceLogic, WuiAdminBuildSrcList)
+        d[self.ksActionBuildSrcAdd]         = lambda: self._actionGenericFormAdd(BuildSourceData, WuiAdminBuildSrc);
+        d[self.ksActionBuildSrcAddPost]     = lambda: self._actionGenericFormAddPost(BuildSourceData, BuildSourceLogic,
+                                                                                     WuiAdminBuildSrc, self.ksActionBuildSrcList);
+        d[self.ksActionBuildSrcClone]       = lambda: self._actionGenericFormClone(  BuildSourceData, WuiAdminBuildSrc,
+                                                                                     'idBuildSrc');
+        d[self.ksActionBuildSrcDetails]     = lambda: self._actionGenericFormDetails(BuildSourceData, BuildSourceLogic,
+                                                                                     WuiAdminBuildSrc, 'idBuildSrc');
+        d[self.ksActionBuildSrcDoRemove]    = lambda: self._actionGenericDoRemove(BuildSourceLogic,
+                                                                                  BuildSourceData.ksParam_idBuildSrc,
+                                                                                  self.ksActionBuildSrcList);
+        d[self.ksActionBuildSrcEdit]        = lambda: self._actionGenericFormEdit(BuildSourceData, WuiAdminBuildSrc,
+                                                                                  BuildSourceData.ksParam_idBuildSrc);
+        d[self.ksActionBuildSrcEditPost]    = lambda: self._actionGenericFormEditPost(BuildSourceData, BuildSourceLogic,
+                                                                                      WuiAdminBuildSrc,
+                                                                                      self.ksActionBuildSrcList);
+
+
+        #
+        # Build actions
+        #
+        d[self.ksActionBuildList]           = lambda: self._actionGenericListing(BuildLogic, WuiAdminBuildList)
+        d[self.ksActionBuildAdd]            = lambda: self._actionGenericFormAdd(BuildData, WuiAdminBuild)
+        d[self.ksActionBuildAddPost]        = lambda: self._actionGenericFormAddPost(BuildData, BuildLogic, WuiAdminBuild,
+                                                                                     self.ksActionBuildList)
+        d[self.ksActionBuildClone]          = lambda: self._actionGenericFormClone(  BuildData, WuiAdminBuild, 'idBuild');
+        d[self.ksActionBuildDetails]        = lambda: self._actionGenericFormDetails(BuildData, BuildLogic,
+                                                                                     WuiAdminBuild, 'idBuild');
+        d[self.ksActionBuildDoRemove]       = lambda: self._actionGenericDoRemove(BuildLogic, BuildData.ksParam_idBuild,
+                                                                                  self.ksActionBuildList);
+        d[self.ksActionBuildEdit]           = lambda: self._actionGenericFormEdit(BuildData, WuiAdminBuild,
+                                                                                  BuildData.ksParam_idBuild);
+        d[self.ksActionBuildEditPost]       = lambda: self._actionGenericFormEditPost(BuildData, BuildLogic, WuiAdminBuild,
+                                                                                      self.ksActionBuildList)
+
+        #
+        # Build Black List actions
+        #
+        d[self.ksActionBuildBlacklist]          = lambda: self._actionGenericListing(BuildBlacklistLogic,
+                                                                                     WuiAdminListOfBlacklistItems);
+        d[self.ksActionBuildBlacklistAdd]       = lambda: self._actionGenericFormAdd(BuildBlacklistData, WuiAdminBuildBlacklist);
+        d[self.ksActionBuildBlacklistAddPost]   = lambda: self._actionGenericFormAddPost(BuildBlacklistData, BuildBlacklistLogic,
+                                                                                         WuiAdminBuildBlacklist,
+                                                                                         self.ksActionBuildBlacklist);
+        d[self.ksActionBuildBlacklistClone]     = lambda: self._actionGenericFormClone(BuildBlacklistData,
+                                                                                       WuiAdminBuildBlacklist,
+                                                                                       'idBlacklisting');
+        d[self.ksActionBuildBlacklistDetails]   = lambda: self._actionGenericFormDetails(BuildBlacklistData,
+                                                                                         BuildBlacklistLogic,
+                                                                                         WuiAdminBuildBlacklist,
+                                                                                         'idBlacklisting');
+        d[self.ksActionBuildBlacklistDoRemove]  = lambda: self._actionGenericDoRemove(BuildBlacklistLogic,
+                                                                                      BuildBlacklistData.ksParam_idBlacklisting,
+                                                                                      self.ksActionBuildBlacklist)
+        d[self.ksActionBuildBlacklistEdit]      = lambda: self._actionGenericFormEdit(BuildBlacklistData,
+                                                                                      WuiAdminBuildBlacklist,
+                                                                                      BuildBlacklistData.ksParam_idBlacklisting);
+        d[self.ksActionBuildBlacklistEditPost]  = lambda: self._actionGenericFormEditPost(BuildBlacklistData,
+                                                                                          BuildBlacklistLogic,
+                                                                                          WuiAdminBuildBlacklist,
+                                                                                          self.ksActionBuildBlacklist)
+
+
+        #
+        # Failure Category actions
+        #
+        d[self.ksActionFailureCategoryList]     = lambda: self._actionGenericListing(
+                                                                FailureCategoryLogic,
+                                                                WuiFailureCategoryList)
+
+        d[self.ksActionFailureCategoryShowAdd]  = lambda: self._actionGenericFormAdd(
+                                                                FailureCategoryData,
+                                                                WuiFailureCategory)
+
+        d[self.ksActionFailureCategoryShowEdit] = lambda: self._actionGenericFormEditL(
+                                                                FailureCategoryLogic,
+                                                                FailureCategoryData.ksParam_idFailureCategory,
+                                                                WuiFailureCategory)
+
+        d[self.ksActionFailureCategoryAdd]      = lambda: self._actionGenericFormAddPost(
+                                                                FailureCategoryData,
+                                                                FailureCategoryLogic,
+                                                                WuiFailureCategory,
+                                                                self.ksActionFailureCategoryList)
+
+        d[self.ksActionFailureCategoryEdit]     = lambda: self._actionGenericFormEditPost(
+                                                                FailureCategoryData,
+                                                                FailureCategoryLogic,
+                                                                WuiFailureCategory,
+                                                                self.ksActionFailureCategoryList)
+
+        d[self.ksActionFailureCategoryDel]      = lambda: self._actionGenericDoDelOld(
+                                                                FailureCategoryLogic,
+                                                                FailureCategoryData.ksParam_idFailureCategory,
+                                                                self.ksActionFailureCategoryList)
+
+        #
+        # Failure Reason actions
+        #
+        d[self.ksActionFailureReasonList]       = lambda: self._actionGenericListing(
+                                                                FailureReasonLogic,
+                                                                WuiAdminFailureReasonList)
+
+        d[self.ksActionFailureReasonShowAdd]    = lambda: self._actionGenericFormAdd(
+                                                                FailureReasonData,
+                                                                WuiAdminFailureReason)
+
+        d[self.ksActionFailureReasonShowEdit]   = lambda: self._actionGenericFormEditL(
+                                                                FailureReasonLogic,
+                                                                FailureReasonData.ksParam_idFailureReason,
+                                                                WuiAdminFailureReason)
+
+        d[self.ksActionFailureReasonAdd]        = lambda: self._actionGenericFormAddPost(
+                                                                FailureReasonData,
+                                                                FailureReasonLogic,
+                                                                WuiAdminFailureReason,
+                                                                self.ksActionFailureReasonList)
+
+        d[self.ksActionFailureReasonEdit]       = lambda: self._actionGenericFormEditPost(
+                                                                FailureReasonData,
+                                                                FailureReasonLogic,
+                                                                WuiAdminFailureReason,
+                                                                self.ksActionFailureReasonList)
+
+        d[self.ksActionFailureReasonDel]        = lambda: self._actionGenericDoDelOld(FailureReasonLogic,
+                                                                                      FailureReasonData.ksParam_idFailureReason,
+                                                                                      self.ksActionFailureReasonList)
+
+        #
+        # Build Category actions
+        #
+        d[self.ksActionBuildCategoryList]       = lambda: self._actionGenericListing(BuildCategoryLogic, WuiAdminBuildCatList);
+        d[self.ksActionBuildCategoryAdd]        = lambda: self._actionGenericFormAdd(BuildCategoryData, WuiAdminBuildCat);
+        d[self.ksActionBuildCategoryAddPost]    = lambda: self._actionGenericFormAddPost(BuildCategoryData, BuildCategoryLogic,
+                                                                                     WuiAdminBuildCat,
+                                                                                     self.ksActionBuildCategoryList);
+        d[self.ksActionBuildCategoryClone]      = lambda: self._actionGenericFormClone(  BuildCategoryData, WuiAdminBuildCat,
+                                                                                         'idBuildCategory');
+        d[self.ksActionBuildCategoryDetails]    = lambda: self._actionGenericFormDetails(BuildCategoryData, BuildCategoryLogic,
+                                                                                         WuiAdminBuildCat, 'idBuildCategory');
+        d[self.ksActionBuildCategoryDoRemove]   = lambda: self._actionGenericDoRemove(BuildCategoryLogic,
+                                                                                  BuildCategoryData.ksParam_idBuildCategory,
+                                                                                  self.ksActionBuildCategoryList)
+
+        #
+        # Test Group actions
+        #
+        d[self.ksActionTestGroupList]       = lambda: self._actionGenericListing(TestGroupLogic, WuiTestGroupList);
+        d[self.ksActionTestGroupAdd]        = lambda: self._actionGenericFormAdd(TestGroupDataEx, WuiTestGroup);
+        d[self.ksActionTestGroupAddPost]    = lambda: self._actionGenericFormAddPost(TestGroupDataEx, TestGroupLogic,
+                                                                                     WuiTestGroup, self.ksActionTestGroupList);
+        d[self.ksActionTestGroupClone]      = lambda: self._actionGenericFormClone(  TestGroupDataEx, WuiTestGroup,
+                                                                                     'idTestGroup');
+        d[self.ksActionTestGroupDetails]    = lambda: self._actionGenericFormDetails(TestGroupDataEx, TestGroupLogic,
+                                                                                     WuiTestGroup, 'idTestGroup');
+        d[self.ksActionTestGroupEdit]       = lambda: self._actionGenericFormEdit(TestGroupDataEx, WuiTestGroup,
+                                                                                  TestGroupDataEx.ksParam_idTestGroup);
+        d[self.ksActionTestGroupEditPost]   = lambda: self._actionGenericFormEditPost(TestGroupDataEx, TestGroupLogic,
+                                                                                      WuiTestGroup, self.ksActionTestGroupList);
+        d[self.ksActionTestGroupDoRemove]   = lambda: self._actionGenericDoRemove(TestGroupLogic,
+                                                                                  TestGroupDataEx.ksParam_idTestGroup,
+                                                                                  self.ksActionTestGroupList)
+        d[self.ksActionTestCfgRegenQueues]  = self._actionRegenQueuesCommon;
+
+        #
+        # Scheduling Group actions
+        #
+        d[self.ksActionSchedGroupList]      = lambda: self._actionGenericListing(SchedGroupLogic, WuiAdminSchedGroupList)
+        d[self.ksActionSchedGroupAdd]       = lambda: self._actionGenericFormAdd(SchedGroupDataEx, WuiSchedGroup);
+        d[self.ksActionSchedGroupClone]     = lambda: self._actionGenericFormClone(  SchedGroupDataEx, WuiSchedGroup,
+                                                                                     'idSchedGroup');
+        d[self.ksActionSchedGroupDetails]   = lambda: self._actionGenericFormDetails(SchedGroupDataEx, SchedGroupLogic,
+                                                                                     WuiSchedGroup, 'idSchedGroup');
+        d[self.ksActionSchedGroupEdit]      = lambda: self._actionGenericFormEdit(SchedGroupDataEx, WuiSchedGroup,
+                                                                                  SchedGroupData.ksParam_idSchedGroup);
+        d[self.ksActionSchedGroupAddPost]   = lambda: self._actionGenericFormAddPost(SchedGroupDataEx, SchedGroupLogic,
+                                                                                     WuiSchedGroup, self.ksActionSchedGroupList);
+        d[self.ksActionSchedGroupEditPost]  = lambda: self._actionGenericFormEditPost(SchedGroupDataEx, SchedGroupLogic,
+                                                                                      WuiSchedGroup, self.ksActionSchedGroupList);
+        d[self.ksActionSchedGroupDoRemove]  = lambda: self._actionGenericDoRemove(SchedGroupLogic,
+                                                                                  SchedGroupData.ksParam_idSchedGroup,
+                                                                                  self.ksActionSchedGroupList)
+
+        self._aaoMenus = \
+        [
+            [
+                'Builds',       self._sActionUrlBase + self.ksActionBuildList,
+                [
+                    [ 'Builds',                 self._sActionUrlBase + self.ksActionBuildList ],
+                    [ 'Blacklist',              self._sActionUrlBase + self.ksActionBuildBlacklist ],
+                    [ 'Build Sources',          self._sActionUrlBase + self.ksActionBuildSrcList ],
+                    [ 'Build Categories',       self._sActionUrlBase + self.ksActionBuildCategoryList ],
+                    [ 'New Build',              self._sActionUrlBase + self.ksActionBuildAdd ],
+                    [ 'New Blacklisting',       self._sActionUrlBase + self.ksActionBuildBlacklistAdd ],
+                    [ 'New Build Source',       self._sActionUrlBase + self.ksActionBuildSrcAdd],
+                    [ 'New Build Category',     self._sActionUrlBase + self.ksActionBuildCategoryAdd ],
+                ]
+            ],
+            [
+                'Failure Reasons',       self._sActionUrlBase + self.ksActionFailureReasonList,
+                [
+                    [ 'Failure Categories',     self._sActionUrlBase + self.ksActionFailureCategoryList ],
+                    [ 'Failure Reasons',        self._sActionUrlBase + self.ksActionFailureReasonList ],
+                    [ 'New Failure Category',   self._sActionUrlBase + self.ksActionFailureCategoryShowAdd ],
+                    [ 'New Failure Reason',     self._sActionUrlBase + self.ksActionFailureReasonShowAdd ],
+                ]
+            ],
+            [
+                'System',      self._sActionUrlBase + self.ksActionSystemLogList,
+                [
+                    [ 'System Log',             self._sActionUrlBase + self.ksActionSystemLogList ],
+                    [ 'User Accounts',          self._sActionUrlBase + self.ksActionUserList ],
+                    [ 'New User',               self._sActionUrlBase + self.ksActionUserAdd ],
+                ]
+            ],
+            [
+                'TestBoxes',   self._sActionUrlBase + self.ksActionTestBoxList,
+                [
+                    [ 'TestBoxes',              self._sActionUrlBase + self.ksActionTestBoxList ],
+                    [ 'Scheduling Groups',      self._sActionUrlBase + self.ksActionSchedGroupList ],
+                    [ 'New TestBox',            self._sActionUrlBase + self.ksActionTestBoxAdd ],
+                    [ 'New Scheduling Group',   self._sActionUrlBase + self.ksActionSchedGroupAdd ],
+                    [ 'Regenerate All Scheduling Queues', self._sActionUrlBase + self.ksActionTestBoxesRegenQueues ],
+                ]
+            ],
+            [
+                'Test Config', self._sActionUrlBase + self.ksActionTestGroupList,
+                [
+                    [ 'Test Cases',             self._sActionUrlBase + self.ksActionTestCaseList ],
+                    [ 'Test Groups',            self._sActionUrlBase + self.ksActionTestGroupList ],
+                    [ 'Global Resources',       self._sActionUrlBase + self.ksActionGlobalRsrcShowAll ],
+                    [ 'New Test Case',          self._sActionUrlBase + self.ksActionTestCaseAdd ],
+                    [ 'New Test Group',         self._sActionUrlBase + self.ksActionTestGroupAdd ],
+                    [ 'New Global Resource',    self._sActionUrlBase + self.ksActionGlobalRsrcShowAdd ],
+                    [ 'Regenerate All Scheduling Queues', self._sActionUrlBase + self.ksActionTestCfgRegenQueues ],
+                ]
+            ],
+            [
+                '> Test Results', 'index.py?' + webutils.encodeUrlParams(self._dDbgParams), []
+            ],
+        ];
+
+
+    def _actionDefault(self):
+        """Show the default admin page."""
+        self._sAction = self.ksActionTestBoxList;
+        return self._actionGenericListing(TestBoxLogic, WuiTestBoxList);
+
+    def _actionGenericDoDelOld(self, oCoreObjectLogic, sCoreObjectIdFieldName, sRedirectAction):
+        """
+        Delete entry (using oLogicType.remove).
+
+        @param oCoreObjectLogic         A *Logic class
+
+        @param sCoreObjectIdFieldName   Name of HTTP POST variable that
+                                        contains object ID information
+
+        @param sRedirectAction          An action for redirect user to
+                                        in case of operation success
+        """
+        iCoreDataObjectId = self.getStringParam(sCoreObjectIdFieldName) # STRING?!?!
+        self._checkForUnknownParameters()
+
+        try:
+            self._sPageTitle  = None
+            self._sPageBody   = None
+            self._sRedirectTo = self._sActionUrlBase + sRedirectAction
+            return oCoreObjectLogic(self._oDb).remove(self._oCurUser.uid, iCoreDataObjectId)
+        except Exception as oXcpt:
+            self._oDb.rollback();
+            self._sPageTitle  = 'Unable to delete record'
+            self._sPageBody   = str(oXcpt);
+            if config.g_kfDebugDbXcpt:
+                self._sPageBody += cgitb.html(sys.exc_info());
+            self._sRedirectTo = None
+
+        return False
+
+    def _actionGenericDoRemove(self, oLogicType, sParamId, sRedirAction):
+        """
+        Delete entry (using oLogicType.removeEntry).
+
+        oLogicType is a class that implements addEntry.
+
+        sParamId is the name (ksParam_...) of the HTTP variable hold the ID of
+        the database entry to delete.
+
+        sRedirAction is what action to redirect to on success.
+        """
+        idEntry = self.getIntParam(sParamId, iMin = 1, iMax = 0x7fffffe)
+        fCascade = self.getBoolParam('fCascadeDelete', False);
+        self._checkForUnknownParameters()
+
+        try:
+            self._sPageTitle  = None
+            self._sPageBody   = None
+            self._sRedirectTo = self._sActionUrlBase + sRedirAction;
+            return oLogicType(self._oDb).removeEntry(self._oCurUser.uid, idEntry, fCascade = fCascade, fCommit = True);
+        except Exception as oXcpt:
+            self._oDb.rollback();
+            self._sPageTitle  = 'Unable to delete entry';
+            self._sPageBody   = str(oXcpt);
+            if config.g_kfDebugDbXcpt:
+                self._sPageBody += cgitb.html(sys.exc_info());
+            self._sRedirectTo = None;
+        return False;
+
+
+    #
+    # System Category.
+    #
+
+    # (all generic)
+
+    #
+    # TestBox & Scheduling Category.
+    #
+
+    def _actionTestBoxListPost(self):
+        """Actions on a list of testboxes."""
+
+        # Parameters.
+        aidTestBoxes = self.getListOfIntParams(TestBoxData.ksParam_idTestBox, iMin = 1, aiDefaults = []);
+        sListAction  = self.getStringParam(self.ksParamListAction);
+        if sListAction in [asDesc[0] for asDesc in WuiTestBoxList.kasTestBoxActionDescs]:
+            idAction = None;
+        else:
+            asActionPrefixes = [ 'setgroup-', ];
+            i = 0;
+            while i < len(asActionPrefixes) and not sListAction.startswith(asActionPrefixes[i]):
+                i += 1;
+            if i >= len(asActionPrefixes):
+                raise WuiException('Parameter "%s" has an invalid value: "%s"' % (self.ksParamListAction, sListAction,));
+            idAction = sListAction[len(asActionPrefixes[i]):];
+            if not idAction.isdigit():
+                raise WuiException('Parameter "%s" has an invalid value: "%s"' % (self.ksParamListAction, sListAction,));
+            idAction = int(idAction);
+            sListAction = sListAction[:len(asActionPrefixes[i]) - 1];
+        self._checkForUnknownParameters();
+
+
+        # Take action.
+        if sListAction is 'none':
+            pass;
+        else:
+            oLogic = TestBoxLogic(self._oDb);
+            aoTestBoxes = []
+            for idTestBox in aidTestBoxes:
+                aoTestBoxes.append(TestBoxData().initFromDbWithId(self._oDb, idTestBox));
+
+            if sListAction in [ 'enable', 'disable' ]:
+                fEnable = sListAction == 'enable';
+                for oTestBox in aoTestBoxes:
+                    if oTestBox.fEnabled != fEnable:
+                        oTestBox.fEnabled = fEnable;
+                        oLogic.editEntry(oTestBox, self._oCurUser.uid, fCommit = False);
+            elif sListAction == 'setgroup':
+                for oTestBox in aoTestBoxes:
+                    if oTestBox.idSchedGroup != idAction:
+                        oTestBox.idSchedGroup = idAction;
+                        oLogic.editEntry(oTestBox, self._oCurUser.uid, fCommit = False);
+            else:
+                for oTestBox in aoTestBoxes:
+                    if oTestBox.enmPendingCmd != sListAction:
+                        oTestBox.enmPendingCmd = sListAction;
+                        oLogic.editEntry(oTestBox, self._oCurUser.uid, fCommit = False);
+            self._oDb.commit();
+
+        # Re-display the list.
+        self._sPageTitle  = None;
+        self._sPageBody   = None;
+        self._sRedirectTo = self._sActionUrlBase + self.ksActionTestBoxList;
+        return True;
+
+    ## @todo scheduling groups code goes here...
+
+    def _actionRegenQueuesCommon(self):
+        """
+        Common code for ksActionTestBoxesRegenQueues and ksActionTestCfgRegenQueues.
+
+        Too lazy to put this in some separate place right now.
+        """
+        self._checkForUnknownParameters();
+        ## @todo should also be changed to a POST with a confirmation dialog preceeding it.
+
+        self._sPageTitle = 'Regenerate All Scheduling Queues';
+        self._sPageBody  = '';
+        aoGroups = SchedGroupLogic(self._oDb).getAll();
+        for oGroup in aoGroups:
+            self._sPageBody += '<h3>%s (ID %#d)</h3>' % (webutils.escapeElem(oGroup.sName), oGroup.idSchedGroup);
+            try:
+                (aoErrors, asMessages) = SchedulerBase.recreateQueue(self._oDb, self._oCurUser.uid, oGroup.idSchedGroup, 2);
+            except Exception as oXcpt:
+                self._oDb.rollback();
+                self._sPageBody += '<p>SchedulerBase.recreateQueue threw an exception: %s</p>' \
+                                % (webutils.escapeElem(str(oXcpt)),);
+                self._sPageBody += cgitb.html(sys.exc_info());
+            else:
+                if len(aoErrors) == 0:
+                    self._sPageBody += '<p>Successfully regenerated.</p>';
+                else:
+                    for oError in aoErrors:
+                        if oError[1] is None:
+                            self._sPageBody += '<p>%s.</p>' % (webutils.escapeElem(oError[0]),);
+                        ## @todo links.
+                        #elif isinstance(oError[1], TestGroupData):
+                        #    self._sPageBody += '<p>%s.</p>' % (webutils.escapeElem(oError[0]),);
+                        #elif isinstance(oError[1], TestGroupCase):
+                        #    self._sPageBody += '<p>%s.</p>' % (webutils.escapeElem(oError[0]),);
+                        else:
+                            self._sPageBody += '<p>%s. [Cannot link to %s]</p>' \
+                                             % (webutils.escapeElem(oError[0]), webutils.escapeElem(str(oError[1])));
+                for sMsg in asMessages:
+                    self._sPageBody += '<p>%s<p>\n' % (webutils.escapeElem(sMsg),);
+        return True;
+
+
+
+    #
+    # Test Config Category.
+    #
+
+    def _actionGlobalRsrcShowAddEdit(self, sAction): # pylint: disable=C0103
+        """Show Global Resource creation or edit dialog"""
+
+        oGlobalResourceLogic = GlobalResourceLogic(self._oDb)
+        if sAction == WuiAdmin.ksActionGlobalRsrcEdit:
+            idGlobalRsrc = self.getIntParam(GlobalResourceData.ksParam_idGlobalRsrc, iDefault = -1)
+            oData = oGlobalResourceLogic.getById(idGlobalRsrc)
+        else:
+            oData = GlobalResourceData()
+            oData.convertToParamNull()
+
+        self._checkForUnknownParameters()
+
+        oContent = WuiGlobalResource(oData)
+        (self._sPageTitle, self._sPageBody) = oContent.showAddModifyPage(sAction)
+
+        return True
+
+    def _actionGlobalRsrcAddEdit(self, sAction):
+        """Add or modify Global Resource record"""
+
+        oData = GlobalResourceData()
+        oData.initFromParams(self, fStrict=True)
+
+        self._checkForUnknownParameters()
+
+        if self._oSrvGlue.getMethod() != 'POST':
+            raise WuiException('Expected "POST" request, got "%s"' % (self._oSrvGlue.getMethod(),))
+
+        oGlobalResourceLogic = GlobalResourceLogic(self._oDb)
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) == 0:
+            if sAction == WuiAdmin.ksActionGlobalRsrcAdd:
+                oGlobalResourceLogic.addGlobalResource(self._oCurUser.uid, oData)
+            elif sAction == WuiAdmin.ksActionGlobalRsrcEdit:
+                idGlobalRsrc = self.getStringParam(GlobalResourceData.ksParam_idGlobalRsrc)
+                oGlobalResourceLogic.editGlobalResource(self._oCurUser.uid, idGlobalRsrc, oData)
+            else:
+                raise WuiException('Invalid parameter.')
+            self._sPageTitle  = None;
+            self._sPageBody   = None;
+            self._sRedirectTo = self._sActionUrlBase + self.ksActionGlobalRsrcShowAll;
+        else:
+            oContent = WuiGlobalResource(oData)
+            (self._sPageTitle, self._sPageBody) = oContent.showAddModifyPage(sAction, dErrors=dErrors)
+
+        return True
+
+    def _generatePage(self):
+        """Override parent handler in order to change page titte"""
+        if self._sPageTitle is not None:
+            self._sPageTitle = 'Test Manager Admin - ' + self._sPageTitle
+
+        return WuiDispatcherBase._generatePage(self)
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminbuild.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminbuild.py
new file mode 100644
index 0000000..53daf3c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminbuild.py
@@ -0,0 +1,140 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminbuild.py $
+
+"""
+Test Manager WUI - Builds.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.webui.wuicontentbase   import WuiFormContentBase, WuiListContentBase, WuiTmLink, WuiBuildLogLink, \
+                                               WuiSvnLinkWithTooltip;
+from testmanager.core.build             import BuildData, BuildCategoryLogic;
+from testmanager.core.buildblacklist    import BuildBlacklistData;
+from testmanager.core.db                import isDbTimestampInfinity;
+
+
+class WuiAdminBuild(WuiFormContentBase):
+    """
+    WUI Build HTML content generator.
+    """
+
+    def __init__(self, oData, sMode, oDisp):
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'Add Build'
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Modify Build - #%s' % (oData.idBuild,);
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'Build - #%s' % (oData.idBuild,);
+        WuiFormContentBase.__init__(self, oData, sMode, 'Build', oDisp, sTitle);
+
+    def _populateForm(self, oForm, oData):
+        oForm.addIntRO      (BuildData.ksParam_idBuild,             oData.idBuild,            'Build ID')
+        oForm.addTimestampRO(BuildData.ksParam_tsCreated,           oData.tsCreated,          'Created')
+        oForm.addTimestampRO(BuildData.ksParam_tsEffective,         oData.tsEffective,        'Last changed')
+        oForm.addTimestampRO(BuildData.ksParam_tsExpire,            oData.tsExpire,           'Expires (excl)')
+        oForm.addIntRO      (BuildData.ksParam_uidAuthor,           oData.uidAuthor,          'Changed by UID')
+
+        oForm.addComboBox   (BuildData.ksParam_idBuildCategory,     oData.idBuildCategory,    'Build category',
+                             BuildCategoryLogic(self._oDisp.getDb()).fetchForCombo());
+
+        oForm.addInt        (BuildData.ksParam_iRevision,           oData.iRevision,          'Revision')
+        oForm.addText       (BuildData.ksParam_sVersion,            oData.sVersion,           'Version')
+        oForm.addWideText   (BuildData.ksParam_sLogUrl,             oData.sLogUrl,            'Log URL')
+        oForm.addWideText   (BuildData.ksParam_sBinaries,           oData.sBinaries,          'Binaries')
+        oForm.addCheckBox   (BuildData.ksParam_fBinariesDeleted,    oData.fBinariesDeleted,   'Binaries deleted')
+
+        oForm.addSubmit()
+        return True;
+
+
+class WuiAdminBuildList(WuiListContentBase):
+    """
+    WUI Admin Build List Content Generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Builds', sId = 'builds', fnDPrint = fnDPrint, oDisp = oDisp);
+
+        self._asColumnHeaders = ['ID', 'Product', 'Branch', 'Version',
+                                 'Type', 'OS(es)', 'Author', 'Added',
+                                 'Files', 'Action' ];
+        self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"', 'align="center"',
+                                 'align="center"', 'align="center"', 'align="center"', 'align="center"',
+                                 '', 'align="center"'];
+
+    def _formatListEntry(self, iEntry):
+        from testmanager.webui.wuiadmin import WuiAdmin
+        oEntry = self._aoEntries[iEntry];
+
+        aoActions = [];
+        if oEntry.sLogUrl is not None:
+            aoActions.append(WuiBuildLogLink(oEntry.sLogUrl, 'Build Log'));
+
+        dParams = { WuiAdmin.ksParamAction:                    WuiAdmin.ksActionBuildBlacklistAdd,
+                    BuildBlacklistData.ksParam_sProduct:       oEntry.oCat.sProduct,
+                    BuildBlacklistData.ksParam_sBranch:        oEntry.oCat.sBranch,
+                    BuildBlacklistData.ksParam_asTypes:        oEntry.oCat.sType,
+                    BuildBlacklistData.ksParam_asOsArches:     oEntry.oCat.asOsArches,
+                    BuildBlacklistData.ksParam_iFirstRevision: oEntry.iRevision,
+                    BuildBlacklistData.ksParam_iLastRevision:  oEntry.iRevision }
+        aoActions += [
+            WuiTmLink('Blacklist', WuiAdmin.ksScriptName, dParams),
+            WuiTmLink('Details', WuiAdmin.ksScriptName,
+                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildDetails,
+                        BuildData.ksParam_idBuild: oEntry.idBuild,
+                        WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
+            WuiTmLink('Clone', WuiAdmin.ksScriptName,
+                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildClone,
+                        BuildData.ksParam_idBuild: oEntry.idBuild,
+                        WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
+        ];
+        if isDbTimestampInfinity(oEntry.tsExpire):
+            aoActions += [
+                WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                          { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildEdit,
+                            BuildData.ksParam_idBuild: oEntry.idBuild }),
+                WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                          { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildDoRemove,
+                            BuildData.ksParam_idBuild: oEntry.idBuild },
+                          sConfirm = 'Are you sure you want to remove build #%d?' % (oEntry.idBuild,) ),
+            ];
+
+        return [ oEntry.idBuild,
+                 oEntry.oCat.sProduct,
+                 oEntry.oCat.sBranch,
+                 WuiSvnLinkWithTooltip(oEntry.iRevision, oEntry.oCat.sRepository,
+                                       sName = '%s r%s' % (oEntry.sVersion, oEntry.iRevision,)),
+                 oEntry.oCat.sType,
+                 ' '.join(oEntry.oCat.asOsArches),
+                 'batch' if oEntry.uidAuthor is None else oEntry.uidAuthor,
+                 self.formatTsShort(oEntry.tsCreated),
+                 oEntry.sBinaries if not oEntry.fBinariesDeleted else '<Deleted>',
+                 aoActions,
+        ];
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildblacklist.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildblacklist.py
new file mode 100644
index 0000000..cb40ab3
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildblacklist.py
@@ -0,0 +1,149 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminbuildblacklist.py $
+
+"""
+Test Manager WUI - Build Blacklist.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.webui.wuibase        import WuiException
+from testmanager.webui.wuicontentbase import WuiFormContentBase, WuiListContentBase, WuiTmLink
+from testmanager.core.buildblacklist  import BuildBlacklistData
+from testmanager.core.failurereason   import FailureReasonLogic
+from testmanager.core.db              import TMDatabaseConnection
+from testmanager.core                 import coreconsts
+
+
+class WuiAdminBuildBlacklist(WuiFormContentBase):
+    """
+    WUI Build Black List Form.
+    """
+
+    def __init__(self, oData, sMode, oDisp):
+        """
+        Prepare & initialize parent
+        """
+
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'Add Build Blacklist Entry'
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Edit Build Blacklist Entry'
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'Build Black';
+        WuiFormContentBase.__init__(self, oData, sMode, 'BuildBlacklist', oDisp, sTitle);
+
+        #
+        # Additional data.
+        #
+        self.asTypes    = coreconsts.g_kasBuildTypesAll
+        self.asOsArches = coreconsts.g_kasOsDotCpusAll
+
+    def _populateForm(self, oForm, oData):
+        """
+        Construct an HTML form
+        """
+
+        aoFailureReasons = FailureReasonLogic(self._oDisp.getDb()).fetchForCombo()
+        if len(aoFailureReasons) == 0:
+            from testmanager.webui.wuiadmin import WuiAdmin
+            raise WuiException('Please <a href="%s?%s=%s">add</a> some Failure Reasons first.'
+                               % (WuiAdmin.ksScriptName, WuiAdmin.ksParamAction, WuiAdmin.ksActionFailureReasonShowAdd));
+
+        asTypes    = self.getListOfItems(self.asTypes,    oData.asTypes)
+        asOsArches = self.getListOfItems(self.asOsArches, oData.asOsArches)
+
+        oForm.addIntRO      (BuildBlacklistData.ksParam_idBlacklisting,  oData.idBlacklisting,  'Blacklist item ID')
+        oForm.addTimestampRO(BuildBlacklistData.ksParam_tsEffective,     oData.tsEffective,     'Last changed')
+        oForm.addTimestampRO(BuildBlacklistData.ksParam_tsExpire,        oData.tsExpire,        'Expires (excl)')
+        oForm.addIntRO      (BuildBlacklistData.ksParam_uidAuthor,       oData.uidAuthor,        'Changed by UID')
+
+        oForm.addComboBox   (BuildBlacklistData.ksParam_idFailureReason, oData.idFailureReason, 'Failure Reason',
+                             aoFailureReasons)
+
+        oForm.addText       (BuildBlacklistData.ksParam_sProduct,        oData.sProduct,        'Product')
+        oForm.addText       (BuildBlacklistData.ksParam_sBranch,         oData.sBranch,         'Branch')
+        oForm.addListOfTypes(BuildBlacklistData.ksParam_asTypes,         asTypes,               'Build types')
+        oForm.addListOfOsArches(BuildBlacklistData.ksParam_asOsArches,   asOsArches,            'Target architectures')
+        oForm.addInt        (BuildBlacklistData.ksParam_iFirstRevision,  oData.iFirstRevision,  'First revision')
+        oForm.addInt        (BuildBlacklistData.ksParam_iLastRevision,   oData.iLastRevision,   'Last revision (incl)')
+
+        oForm.addSubmit();
+
+        return True;
+
+
+class WuiAdminListOfBlacklistItems(WuiListContentBase):
+    """
+    WUI Admin Build Blacklist Content Generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Build Blacklist', sId = 'buildsBlacklist',
+                                    fnDPrint = fnDPrint, oDisp = oDisp);
+
+        self._asColumnHeaders = ['ID', 'Failure Reason',
+                                 'Product', 'Branch', 'Type',
+                                 'OS(es)', 'First Revision', 'Last Revision',
+                                 'Actions' ]
+        self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"', 'align="center"',
+                                 'align="center"', 'align="center"', 'align="center"', 'align="center"',
+                                 'align="center"', 'align="center"', 'align="center"', 'align="center"',
+                                 'align="center"' ]
+
+    def _formatListEntry(self, iEntry):
+        from testmanager.webui.wuiadmin import WuiAdmin
+        oEntry = self._aoEntries[iEntry]
+
+        sShortFailReason = \
+            FailureReasonLogic(TMDatabaseConnection()).getById(oEntry.idFailureReason).sShort
+
+        return [ oEntry.idBlacklisting,
+                 sShortFailReason,
+                 oEntry.sProduct,
+                 oEntry.sBranch,
+                 oEntry.asTypes,
+                 oEntry.asOsArches,
+                 oEntry.iFirstRevision,
+                 oEntry.iLastRevision,
+                 [ WuiTmLink('Details', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildBlacklistDetails,
+                               BuildBlacklistData.ksParam_idBlacklisting: oEntry.idBlacklisting }),
+                   WuiTmLink('Edit', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildBlacklistEdit,
+                               BuildBlacklistData.ksParam_idBlacklisting: oEntry.idBlacklisting }),
+                   WuiTmLink('Clone', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildBlacklistClone,
+                               BuildBlacklistData.ksParam_idBlacklisting: oEntry.idBlacklisting,
+                               WuiAdmin.ksParamEffectiveDate: oEntry.tsEffective,  }),
+                   WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildBlacklistDoRemove,
+                               BuildBlacklistData.ksParam_idBlacklisting: oEntry.idBlacklisting },
+                             sConfirm = 'Are you sure you want to remove black list entry #%d?' % (oEntry.idBlacklisting,)),
+                  ]
+        ];
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildcategory.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildcategory.py
new file mode 100644
index 0000000..0382207
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildcategory.py
@@ -0,0 +1,109 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminbuildcategory.py $
+
+"""
+Test Manager WUI - Build categories.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from common                             import webutils;
+from testmanager.webui.wuicontentbase   import WuiListContentBase, WuiFormContentBase, WuiRawHtml, WuiTmLink;
+from testmanager.core.build             import BuildCategoryData
+from testmanager.core                   import coreconsts;
+
+
+class WuiAdminBuildCatList(WuiListContentBase):
+    """
+    WUI Build Category List Content Generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Build Categories', sId = 'buildcategories',
+                                    fnDPrint = fnDPrint, oDisp = oDisp);
+        self._asColumnHeaders = ([ 'ID', 'Product', 'Repository', 'Branch', 'Build Type', 'OS/Architectures', 'Actions' ]);
+        self._asColumnAttribs = (['align="right"', '', '', '', '', 'align="center"' ]);
+
+    def _formatListEntry(self, iEntry):
+        from testmanager.webui.wuiadmin import WuiAdmin;
+        oEntry  = self._aoEntries[iEntry];
+
+        aoActions = [
+            WuiTmLink('Details', WuiAdmin.ksScriptName,
+                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildCategoryDetails,
+                        BuildCategoryData.ksParam_idBuildCategory: oEntry.idBuildCategory, }),
+            WuiTmLink('Clone', WuiAdmin.ksScriptName,
+                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildCategoryClone,
+                        BuildCategoryData.ksParam_idBuildCategory: oEntry.idBuildCategory, }),
+            WuiTmLink('Try Remove', WuiAdmin.ksScriptName,
+                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildCategoryDoRemove,
+                        BuildCategoryData.ksParam_idBuildCategory: oEntry.idBuildCategory, }),
+        ];
+
+        sHtml = '<ul class="tmshowall">\n';
+        for sOsArch in oEntry.asOsArches:
+            sHtml += '  <li class="tmshowall">%s</li>\n' % (webutils.escapeElem(sOsArch),);
+        sHtml += '</ul>\n'
+
+        return [ oEntry.idBuildCategory,
+                 oEntry.sRepository,
+                 oEntry.sProduct,
+                 oEntry.sBranch,
+                 oEntry.sType,
+                 WuiRawHtml(sHtml),
+                 aoActions,
+        ];
+
+
+class WuiAdminBuildCat(WuiFormContentBase):
+    """
+    WUI Build Category Form Content Generator.
+    """
+    def __init__(self, oData, sMode, oDisp):
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'Create Build Category';
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            assert False, 'not possible'
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'Build Category- %s' % (oData.idBuildCategory,);
+        WuiFormContentBase.__init__(self, oData, sMode, 'BuildCategory', oDisp, sTitle, fEditable = False);
+
+    def _populateForm(self, oForm, oData):
+        oForm.addIntRO( BuildCategoryData.ksParam_idBuildCategory,      oData.idBuildCategory,  'Build Category ID')
+        oForm.addText(  BuildCategoryData.ksParam_sRepository,          oData.sRepository,      'VCS repository name');
+        oForm.addText(  BuildCategoryData.ksParam_sProduct,             oData.sProduct,         'Product name')
+        oForm.addText(  BuildCategoryData.ksParam_sBranch,              oData.sBranch,          'Branch name')
+        oForm.addText(  BuildCategoryData.ksParam_sType,                oData.sType,            'Build type')
+
+        aoOsArches = [[sOsArch, sOsArch in oData.asOsArches, sOsArch] for sOsArch in coreconsts.g_kasOsDotCpusAll];
+        oForm.addListOfOsArches(BuildCategoryData.ksParam_asOsArches,   aoOsArches,             'Target architectures');
+
+        if self._sMode != WuiFormContentBase.ksMode_Show:
+            oForm.addSubmit();
+        return True;
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildsource.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildsource.py
new file mode 100644
index 0000000..ba934c1
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminbuildsource.py
@@ -0,0 +1,147 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminbuildsource.py $
+
+"""
+Test Manager WUI - Build Sources.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from common                             import utils, webutils;
+from testmanager.webui.wuicontentbase   import WuiFormContentBase, WuiListContentBase, WuiTmLink, WuiRawHtml;
+from testmanager.core                   import coreconsts;
+from testmanager.core.db                import isDbTimestampInfinity;
+from testmanager.core.buildsource       import BuildSourceData;
+
+
+class WuiAdminBuildSrc(WuiFormContentBase):
+    """
+    WUI Build Sources HTML content generator.
+    """
+
+    def __init__(self, oData, sMode, oDisp):
+        assert isinstance(oData, BuildSourceData);
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'New Build Source';
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Edit Build Source - %s (#%s)' % (oData.sName, oData.idBuildSrc,);
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'Build Source - %s (#%s)' % (oData.sName, oData.idBuildSrc,);
+        WuiFormContentBase.__init__(self, oData, sMode, 'BuildSrc', oDisp, sTitle);
+
+    def _populateForm(self, oForm, oData):
+        oForm.addIntRO      (BuildSourceData.ksParam_idBuildSrc,       oData.idBuildSrc,       'Build Source item ID')
+        oForm.addTimestampRO(BuildSourceData.ksParam_tsEffective,      oData.tsEffective,      'Last changed')
+        oForm.addTimestampRO(BuildSourceData.ksParam_tsExpire,         oData.tsExpire,         'Expires (excl)')
+        oForm.addIntRO      (BuildSourceData.ksParam_uidAuthor,        oData.uidAuthor,        'Changed by UID')
+        oForm.addText       (BuildSourceData.ksParam_sName,            oData.sName,            'Name')
+        oForm.addText       (BuildSourceData.ksParam_sDescription,     oData.sDescription,     'Description')
+        oForm.addText       (BuildSourceData.ksParam_sProduct,         oData.sProduct,         'Product')
+        oForm.addText       (BuildSourceData.ksParam_sBranch,          oData.sBranch,          'Branch')
+        asTypes    = self.getListOfItems(coreconsts.g_kasBuildTypesAll, oData.asTypes);
+        oForm.addListOfTypes(BuildSourceData.ksParam_asTypes,          asTypes,                'Build types')
+        asOsArches = self.getListOfItems(coreconsts.g_kasOsDotCpusAll, oData.asOsArches);
+        oForm.addListOfOsArches(BuildSourceData.ksParam_asOsArches,    asOsArches,             'Target architectures')
+        oForm.addInt        (BuildSourceData.ksParam_iFirstRevision,   oData.iFirstRevision,   'Starting from revision')
+        oForm.addInt        (BuildSourceData.ksParam_iLastRevision,    oData.iLastRevision,    'Ending by revision')
+        oForm.addLong       (BuildSourceData.ksParam_cSecMaxAge,
+                             utils.formatIntervalSeconds2(oData.cSecMaxAge) if oData.cSecMaxAge not in [-1, '', None] else '',
+                             'Max age in seconds');
+        oForm.addSubmit();
+        return True;
+
+class WuiAdminBuildSrcList(WuiListContentBase):
+    """
+    WUI Build Source content generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Registered Build Sources', sId = 'build sources',
+                                    fnDPrint = fnDPrint, oDisp = oDisp);
+        self._asColumnHeaders = ['ID', 'Name', 'Description', 'Product',
+                                 'Branch', 'Build Types', 'OS/ARCH', 'First Revision', 'Last Revision', 'Max Age',
+                                 'Actions' ];
+        self._asColumnAttribs = ['align="center"', 'align="center"', 'align="center"', 'align="center"', 'align="center"',
+                                 'align="left"', 'align="left"', 'align="center"', 'align="center"', 'align="center"',
+                                 'align="center"' ];
+
+    def _getSubList(self, aList):
+        """
+        Convert pythonic list into HTML list
+        """
+        if aList not in (None, []):
+            sHtml = '  <ul class="tmshowall">\n'
+            for sTmp in aList:
+                sHtml += '    <li class="tmshowall">%s</a></li>\n' % (webutils.escapeElem(sTmp),);
+            sHtml += '  </ul>\n';
+        else:
+            sHtml = '<ul class="tmshowall"><li class="tmshowall">Any</li></ul>\n';
+
+        return WuiRawHtml(sHtml);
+
+    def _formatListEntry(self, iEntry):
+        """
+        Format *show all* table entry
+        """
+
+        from testmanager.webui.wuiadmin import WuiAdmin
+        oEntry  = self._aoEntries[iEntry]
+
+        aoActions = [
+            WuiTmLink('Details', WuiAdmin.ksScriptName,
+                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildSrcDetails,
+                        BuildSourceData.ksParam_idBuildSrc: oEntry.idBuildSrc,
+                        WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
+            WuiTmLink('Clone', WuiAdmin.ksScriptName,
+                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildSrcClone,
+                        BuildSourceData.ksParam_idBuildSrc: oEntry.idBuildSrc,
+                        WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }),
+        ];
+        if isDbTimestampInfinity(oEntry.tsExpire):
+            aoActions += [
+                WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                          { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildSrcEdit,
+                            BuildSourceData.ksParam_idBuildSrc: oEntry.idBuildSrc } ),
+                WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                          { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildSrcDoRemove,
+                            BuildSourceData.ksParam_idBuildSrc: oEntry.idBuildSrc },
+                          sConfirm = 'Are you sure you want to remove build source #%d?' % (oEntry.idBuildSrc,) )
+            ];
+
+        return [ oEntry.idBuildSrc,
+                 oEntry.sName,
+                 oEntry.sDescription,
+                 oEntry.sProduct,
+                 oEntry.sBranch,
+                 self._getSubList(oEntry.asTypes),
+                 self._getSubList(oEntry.asOsArches),
+                 oEntry.iFirstRevision,
+                 oEntry.iLastRevision,
+                 utils.formatIntervalSeconds2(oEntry.cSecMaxAge) if oEntry.cSecMaxAge is not None else None,
+                 aoActions,
+        ]
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminfailurereason.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminfailurereason.py
new file mode 100644
index 0000000..f44dd5a
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminfailurereason.py
@@ -0,0 +1,126 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminfailurereason.py $
+
+"""
+Test Manager WUI - Failure Reasons Web content generator.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.webui.wuibase        import WuiException
+from testmanager.webui.wuicontentbase import WuiFormContentBase, WuiListContentBase, WuiTmLink
+from testmanager.core.failurereason   import FailureReasonData
+from testmanager.core.failurecategory import FailureCategoryLogic
+from testmanager.core.db              import TMDatabaseConnection
+
+
+class WuiAdminFailureReason(WuiFormContentBase):
+    """
+    WUI Failure Reason HTML content generator.
+    """
+
+    def __init__(self, oFailureReasonData, sMode, oDisp):
+        """
+        Prepare & initialize parent
+        """
+
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'Add Failure Reason'
+            sSubmitAction = oDisp.ksActionFailureReasonAdd
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Edit Failure Reason'
+            sSubmitAction = oDisp.ksActionFailureReasonEdit
+        else:
+            raise WuiException('Unknown parameter')
+
+        WuiFormContentBase.__init__(self, oFailureReasonData, sMode, 'FailureReason', oDisp, sTitle,
+                                    sSubmitAction = sSubmitAction, fEditable = False); ## @todo non-standard action names.
+
+    def _populateForm(self, oForm, oData):
+        """
+        Construct an HTML form
+        """
+
+        aoFailureCategories = FailureCategoryLogic(TMDatabaseConnection()).getFailureCategoriesForCombo()
+        if len(aoFailureCategories) == 0:
+            from testmanager.webui.wuiadmin import WuiAdmin
+            sExceptionMsg = 'Please <a href="%s?%s=%s">add</a> Failure Category first.' % \
+                (WuiAdmin.ksScriptName, WuiAdmin.ksParamAction, WuiAdmin.ksActionFailureCategoryShowAdd)
+
+            raise WuiException(sExceptionMsg)
+
+        oForm.addIntRO        (FailureReasonData.ksParam_idFailureReason,    oData.idFailureReason,    'Failure Reason ID')
+        oForm.addTimestampRO  (FailureReasonData.ksParam_tsEffective,        oData.tsEffective,        'Last changed')
+        oForm.addTimestampRO  (FailureReasonData.ksParam_tsExpire,           oData.tsExpire,           'Expires (excl)')
+        oForm.addIntRO        (FailureReasonData.ksParam_uidAuthor,          oData.uidAuthor,          'Changed by UID')
+
+        oForm.addComboBox     (FailureReasonData.ksParam_idFailureCategory,  oData.idFailureCategory,  'Failure Category',
+                               aoFailureCategories)
+
+        oForm.addText         (FailureReasonData.ksParam_sShort,             oData.sShort,             'Short Description')
+        oForm.addText         (FailureReasonData.ksParam_sFull,              oData.sFull,              'Full Description')
+        oForm.addInt          (FailureReasonData.ksParam_iTicket,            oData.iTicket,            'Ticket Number')
+        oForm.addMultilineText(FailureReasonData.ksParam_asUrls,             oData.asUrls,             'Other URLs to reports '
+                                                                                                       'or discussions of the '
+                                                                                                       'observed symptoms')
+        oForm.addSubmit()
+
+        return True
+
+class WuiAdminFailureReasonList(WuiListContentBase):
+    """
+    WUI Admin Failure Reasons Content Generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Failure Reasons', sId = 'failureReasons',
+                                    fnDPrint = fnDPrint, oDisp = oDisp);
+
+        self._asColumnHeaders = ['ID', 'Category', 'Short Description',
+                                 'Full Description', 'Ticket', 'External References', 'Actions' ]
+
+        self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"',
+                                 'align="center"',' align="center"', 'align="center"', 'align="center"']
+
+    def _formatListEntry(self, iEntry):
+        from testmanager.webui.wuiadmin import WuiAdmin
+        oEntry = self._aoEntries[iEntry]
+
+        return [ oEntry.idFailureReason,
+                 oEntry.idFailureCategory,
+                 oEntry.sShort,
+                 oEntry.sFull,
+                 oEntry.iTicket,
+                 oEntry.asUrls,
+                 [ WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureReasonShowEdit,
+                               FailureReasonData.ksParam_idFailureReason: oEntry.idFailureReason } ),
+                   WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureReasonDel,
+                               FailureReasonData.ksParam_idFailureReason: oEntry.idFailureReason },
+                             sConfirm = 'Are you sure you want to remove failure reason #%d?' % (oEntry.idFailureReason,)),
+               ] ]
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminglobalrsrc.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminglobalrsrc.py
new file mode 100644
index 0000000..28e9439
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminglobalrsrc.py
@@ -0,0 +1,115 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminglobalrsrc.py $
+
+"""
+Test Manager WUI - Global resources.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Validation Kit imports.
+from testmanager.webui.wuibase          import WuiException
+from testmanager.webui.wuicontentbase   import WuiContentBase
+from testmanager.webui.wuihlpform       import WuiHlpForm
+from testmanager.core.globalresource    import GlobalResourceData
+from testmanager.webui.wuicontentbase   import WuiListContentBase, WuiTmLink
+
+
+class WuiGlobalResource(WuiContentBase):
+    """
+    WUI global resources content generator.
+    """
+
+    def __init__(self, oData, fnDPrint = None):
+        """
+        Do necessary initializations
+        """
+        WuiContentBase.__init__(self, fnDPrint)
+        self._oData  = oData
+
+    def showAddModifyPage(self, sAction, dErrors = None):
+        """
+        Render add global resource HTML form.
+        """
+        from testmanager.webui.wuiadmin import WuiAdmin
+
+        sFormActionUrl = '%s?%s=%s' % (WuiAdmin.ksScriptName,
+                                       WuiAdmin.ksParamAction, sAction)
+        if sAction == WuiAdmin.ksActionGlobalRsrcAdd:
+            sTitle = 'Add Global Resource'
+        elif sAction == WuiAdmin.ksActionGlobalRsrcEdit:
+            sTitle = 'Modify Global Resource'
+            sFormActionUrl += '&%s=%s' % (GlobalResourceData.ksParam_idGlobalRsrc, self._oData.idGlobalRsrc)
+        else:
+            raise WuiException('Invalid paraemter "%s"' % (sAction,))
+
+        oForm = WuiHlpForm('globalresourceform',
+                           sFormActionUrl,
+                           dErrors if dErrors is not None else dict())
+
+        if sAction == WuiAdmin.ksActionGlobalRsrcAdd:
+            oForm.addIntRO  (GlobalResourceData.ksParam_idGlobalRsrc,    self._oData.idGlobalRsrc,   'Global Resource ID')
+        oForm.addTimestampRO(GlobalResourceData.ksParam_tsEffective,     self._oData.tsEffective,    'Last changed')
+        oForm.addTimestampRO(GlobalResourceData.ksParam_tsExpire,        self._oData.tsExpire,       'Expires (excl)')
+        oForm.addIntRO      (GlobalResourceData.ksParam_uidAuthor,       self._oData.uidAuthor,      'Changed by UID')
+        oForm.addText       (GlobalResourceData.ksParam_sName,           self._oData.sName,          'Name')
+        oForm.addText       (GlobalResourceData.ksParam_sDescription,    self._oData.sDescription,   'Description')
+        oForm.addCheckBox   (GlobalResourceData.ksParam_fEnabled,        self._oData.fEnabled,       'Enabled')
+
+        oForm.addSubmit('Submit')
+
+        return (sTitle, oForm.finalize())
+
+
+class WuiGlobalResourceList(WuiListContentBase):
+    """
+    WUI Content Generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Global Resources', sId = 'globalResources',
+                                    fnDPrint = fnDPrint, oDisp = oDisp)
+
+        self._asColumnHeaders = ['ID', 'Name', 'Description', 'Enabled', 'Actions' ]
+        self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"',
+                                 'align="center"', 'align="center"']
+
+    def _formatListEntry(self, iEntry):
+        from testmanager.webui.wuiadmin import WuiAdmin
+        oEntry = self._aoEntries[iEntry]
+
+        return [ oEntry.idGlobalRsrc,
+                 oEntry.sName,
+                 oEntry.sDescription,
+                 oEntry.fEnabled,
+                 [ WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionGlobalRsrcShowEdit,
+                               GlobalResourceData.ksParam_idGlobalRsrc: oEntry.idGlobalRsrc }),
+                   WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionGlobalRsrcDel,
+                               GlobalResourceData.ksParam_idGlobalRsrc: oEntry.idGlobalRsrc },
+                             sConfirm = 'Are you sure you want to remove global resource #%d?' % (oEntry.idGlobalRsrc,)),
+               ] ]
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminschedgroup.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminschedgroup.py
new file mode 100644
index 0000000..be2e23a
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminschedgroup.py
@@ -0,0 +1,184 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminschedgroup.py $
+
+"""
+Test Manager WUI - Scheduling groups.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.core.buildsource       import BuildSourceData, BuildSourceLogic;
+from testmanager.core.db                import isDbTimestampInfinity;
+from testmanager.core.schedgroup        import SchedGroupData, SchedGroupDataEx;
+from testmanager.core.testgroup         import TestGroupData, TestGroupLogic;
+from testmanager.core.testbox           import TestBoxData;
+from testmanager.webui.wuicontentbase   import WuiFormContentBase, WuiListContentBase, WuiTmLink
+
+
+class WuiSchedGroup(WuiFormContentBase):
+    """
+    WUI Scheduling Groups HTML content generator.
+    """
+
+    def __init__(self, oData, sMode, oDisp):
+        assert isinstance(oData, SchedGroupData);
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'New Scheduling Group';
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Edit Scheduling Group'
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'Scheduling Group';
+        WuiFormContentBase.__init__(self, oData, sMode, 'SchedGroup', oDisp, sTitle);
+
+        # Read additional bits form the DB.
+        self._aoAllTestGroups = TestGroupLogic(oDisp.getDb()).getAll();
+
+
+    def _populateForm(self, oForm, oData):
+        """
+        Construct an HTML form
+        """
+
+        oForm.addIntRO      (SchedGroupData.ksParam_idSchedGroup,     oData.idSchedGroup,     'ID')
+        oForm.addTimestampRO(SchedGroupData.ksParam_tsEffective,      oData.tsEffective,      'Last changed')
+        oForm.addTimestampRO(SchedGroupData.ksParam_tsExpire,         oData.tsExpire,         'Expires (excl)')
+        oForm.addIntRO      (SchedGroupData.ksParam_uidAuthor,        oData.uidAuthor,        'Changed by UID')
+        oForm.addText       (SchedGroupData.ksParam_sName,            oData.sName,            'Name')
+        oForm.addText       (SchedGroupData.ksParam_sDescription,     oData.sDescription,     'Description')
+        oForm.addCheckBox   (SchedGroupData.ksParam_fEnabled,         oData.fEnabled,         'Enabled')
+
+        oForm.addComboBox   (SchedGroupData.ksParam_enmScheduler,     oData.enmScheduler,     'Scheduler type',
+                             SchedGroupData.kasSchedulerDesc)
+
+        aoBuildSrcIds = BuildSourceLogic(self._oDisp.getDb()).fetchForCombo();
+        oForm.addComboBox   (SchedGroupData.ksParam_idBuildSrc,       oData.idBuildSrc,       'Build source',  aoBuildSrcIds);
+        oForm.addComboBox   (SchedGroupData.ksParam_idBuildSrcTestSuite,
+                             oData.idBuildSrcTestSuite, 'Test suite', aoBuildSrcIds);
+
+        oForm.addListOfSchedGroupMembers(SchedGroupDataEx.ksParam_aoMembers,
+                                         oData.aoMembers, self._aoAllTestGroups, 'Test groups',
+                                         fReadOnly = self._sMode == WuiFormContentBase.ksMode_Show);
+
+        oForm.addSubmit()
+
+        return True;
+
+class WuiAdminSchedGroupList(WuiListContentBase):
+    """
+    Content generator for the schedule group listing.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Registered Scheduling Groups', sId = 'schedgroups',
+                                    fnDPrint = fnDPrint, oDisp = oDisp);
+
+        self._asColumnHeaders = [
+            'ID',  'Name', 'Enabled', 'Scheduler Type',
+            'Build Source', 'Validation Kit Source', 'Test Groups', 'TestBoxes', 'Actions',
+        ];
+
+        self._asColumnAttribs = [
+            'align="right"', 'align="center"', 'align="center"', 'align="center"',
+            'align="center"', 'align="center"', '', '', 'align="center"',
+        ];
+
+    def _formatListEntry(self, iEntry):
+        """
+        Format *show all* table entry
+        """
+        from testmanager.webui.wuiadmin import WuiAdmin
+        oEntry  = self._aoEntries[iEntry]
+
+        oBuildSrc = None;
+        if oEntry.idBuildSrc is not None:
+            oBuildSrc     = WuiTmLink(oEntry.oBuildSrc.sName if oEntry.oBuildSrc else str(oEntry.idBuildSrc),
+                                      WuiAdmin.ksScriptName,
+                                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildSrcDetails,
+                                        BuildSourceData.ksParam_idBuildSrc: oEntry.idBuildSrc, });
+
+        oValidationKitSrc = None;
+        if oEntry.idBuildSrcTestSuite is not None:
+            oValidationKitSrc = WuiTmLink(oEntry.oBuildSrcValidationKit.sName if oEntry.oBuildSrcValidationKit
+                                      else str(oEntry.idBuildSrcTestSuite),
+                                      WuiAdmin.ksScriptName,
+                                      { WuiAdmin.ksParamAction: WuiAdmin.ksActionBuildSrcDetails,
+                                        BuildSourceData.ksParam_idBuildSrc: oEntry.idBuildSrcTestSuite, });
+
+        # Test groups
+        aoMembers = [];
+        for oMember in oEntry.aoMembers:
+            aoMembers.append(WuiTmLink(oMember.oTestGroup.sName, WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupDetails,
+                                         TestGroupData.ksParam_idTestGroup: oMember.idTestGroup,
+                                         WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, },
+                                       sTitle = '#%s' % (oMember.idTestGroup,) if oMember.oTestGroup.sDescription is None
+                                                else '#%s - %s' % (oMember.idTestGroup, oMember.oTestGroup.sDescription,) ));
+
+        # Test boxes.
+        aoTestBoxes = [];
+        for oTestBox in oEntry.aoTestBoxes:
+            aoTestBoxes.append(WuiTmLink(oTestBox.sName, WuiAdmin.ksScriptName,
+                                         { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestBoxDetails,
+                                           TestBoxData.ksParam_idTestBox: oTestBox.idTestBox,
+                                           WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, },
+                                         sTitle = '#%s - %s / %s - %s.%s (%s)'
+                                                % (oTestBox.idTestBox, oTestBox.ip, oTestBox.uuidSystem, oTestBox.sOs,
+                                                   oTestBox.sCpuArch, oTestBox.sOsVersion,)));
+
+
+        # Actions
+        aoActions = [ WuiTmLink('Details', WuiAdmin.ksScriptName,
+                                { WuiAdmin.ksParamAction: WuiAdmin.ksActionSchedGroupDetails,
+                                  SchedGroupData.ksParam_idSchedGroup: oEntry.idSchedGroup,
+                                  WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, } ),];
+        if isDbTimestampInfinity(oEntry.tsExpire):
+            aoActions.append(WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionSchedGroupEdit,
+                                         SchedGroupData.ksParam_idSchedGroup: oEntry.idSchedGroup } ));
+        aoActions.append(WuiTmLink('Clone', WuiAdmin.ksScriptName,
+                                   { WuiAdmin.ksParamAction: WuiAdmin.ksActionSchedGroupClone,
+                                     SchedGroupData.ksParam_idSchedGroup: oEntry.idSchedGroup,
+                                     WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, } ));
+        if isDbTimestampInfinity(oEntry.tsExpire):
+            aoActions.append(WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionSchedGroupDoRemove,
+                                         SchedGroupData.ksParam_idSchedGroup: oEntry.idSchedGroup },
+                                       sConfirm = 'Are you sure you want to remove scheduling group #%d?'
+                                                % (oEntry.idSchedGroup,)));
+
+        return [
+            oEntry.idSchedGroup,
+            oEntry.sName,
+            oEntry.fEnabled,
+            oEntry.enmScheduler,
+            oBuildSrc,
+            oValidationKitSrc,
+            aoMembers,
+            aoTestBoxes,
+            aoActions,
+        ];
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminsystemlog.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminsystemlog.py
new file mode 100644
index 0000000..497e516
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminsystemlog.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminsystemlog.py $
+
+"""
+Test Manager WUI - Admin - System Log.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.webui.wuicontentbase   import WuiListContentBase, WuiTmLink;
+from testmanager.core.testbox           import TestBoxData;
+from testmanager.core.systemlog         import SystemLogData;
+from testmanager.core.useraccount       import UserAccountData;
+
+
+class WuiAdminSystemLogList(WuiListContentBase):
+    """
+    WUI System Log Content Generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, 'System Log',
+                                    fnDPrint = fnDPrint, oDisp = oDisp);
+        self._asColumnHeaders = ['Date', 'Event', 'Message', 'Action'];
+        self._asColumnAttribs = ['', '', '', 'align="center"'];
+
+    def _formatListEntry(self, iEntry):
+        from testmanager.webui.wuiadmin import WuiAdmin;
+        oEntry  = self._aoEntries[iEntry];
+
+        oAction = '';
+        if    oEntry.sEvent == SystemLogData.ksEvent_TestBoxUnknown \
+          and oEntry.sLogText.find('addr=') >= 0 \
+          and oEntry.sLogText.find('uuid=') >= 0:
+            sUuid = (oEntry.sLogText[(oEntry.sLogText.find('uuid=') + 5):])[:36];
+            sAddr = (oEntry.sLogText[(oEntry.sLogText.find('addr=') + 5):]).split(' ')[0];
+            oAction = WuiTmLink('Add TestBox', WuiAdmin.ksScriptName,
+                                { WuiAdmin.ksParamAction:         WuiAdmin.ksActionTestBoxAdd,
+                                  TestBoxData.ksParam_uuidSystem: sUuid,
+                                  TestBoxData.ksParam_ip:         sAddr });
+
+        elif oEntry.sEvent == SystemLogData.ksEvent_UserAccountUnknown:
+            sUserName = oEntry.sLogText[oEntry.sLogText.find('(') + 1:
+                                      oEntry.sLogText.find(')')]
+            oAction = WuiTmLink('Add User', WuiAdmin.ksScriptName,
+                                { WuiAdmin.ksParamAction: WuiAdmin.ksActionUserAdd,
+                                  UserAccountData.ksParam_sLoginName: sUserName });
+
+        return [oEntry.tsCreated, oEntry.sEvent, oEntry.sLogText, oAction];
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadmintestbox.py b/src/VBox/ValidationKit/testmanager/webui/wuiadmintestbox.py
new file mode 100644
index 0000000..56ce605
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadmintestbox.py
@@ -0,0 +1,332 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadmintestbox.py $
+
+"""
+Test Manager WUI - TestBox.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96862 $"
+
+
+# Standard python imports.
+import socket;
+
+# Validation Kit imports.
+from testmanager.webui.wuicontentbase   import WuiListContentWithActionBase, WuiFormContentBase, WuiLinkBase, WuiSvnLink, \
+                                               WuiTmLink, WuiSpanText, WuiRawHtml;
+from testmanager.core.db                import TMDatabaseConnection;
+from testmanager.core.schedgroup        import SchedGroupLogic, SchedGroupData;
+from testmanager.core.testbox           import TestBoxData;
+from testmanager.core.testset           import TestSetData;
+from common                             import utils;
+from testmanager.core.db                import isDbTimestampInfinity;
+
+
+class WuiTestBox(WuiFormContentBase):
+    """
+    WUI TestBox Form Content Generator.
+    """
+
+    def __init__(self, oData, sMode, oDisp):
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'Create TextBox';
+            if oData.uuidSystem is not None and len(oData.uuidSystem) > 10:
+                sTitle += ' - ' + oData.uuidSystem;
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Edit TestBox - %s (#%s)' % (oData.sName, oData.idTestBox);
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'TestBox - %s (#%s)' % (oData.sName, oData.idTestBox);
+        WuiFormContentBase.__init__(self, oData, sMode, 'TestBox', oDisp, sTitle);
+
+        # Try enter sName as hostname (no domain) when creating the testbox.
+        if    sMode == WuiFormContentBase.ksMode_Add  \
+          and self._oData.sName in [None, ''] \
+          and self._oData.ip not in [None, '']:
+            try:
+                (self._oData.sName, _, _) = socket.gethostbyaddr(self._oData.ip);
+            except:
+                pass;
+            offDot = self._oData.sName.find('.');
+            if offDot > 0:
+                self._oData.sName = self._oData.sName[:offDot];
+
+
+    def _populateForm(self, oForm, oData):
+        oForm.addIntRO(      TestBoxData.ksParam_idTestBox,         oData.idTestBox, 'TestBox ID');
+        oForm.addIntRO(      TestBoxData.ksParam_idGenTestBox,      oData.idGenTestBox, 'TestBox generation ID');
+        oForm.addTimestampRO(TestBoxData.ksParam_tsEffective,       oData.tsEffective, 'Last changed');
+        oForm.addTimestampRO(TestBoxData.ksParam_tsExpire,          oData.tsExpire, 'Expires (excl)');
+        oForm.addIntRO(      TestBoxData.ksParam_uidAuthor,         oData.uidAuthor, 'Changed by UID');
+
+        oForm.addText(       TestBoxData.ksParam_ip,                oData.ip, 'TestBox IP Address');
+        oForm.addUuid(       TestBoxData.ksParam_uuidSystem,        oData.uuidSystem, 'TestBox System/Firmware UUID');
+        oForm.addText(       TestBoxData.ksParam_sName,             oData.sName, 'TestBox Name');
+        oForm.addText(       TestBoxData.ksParam_sDescription,      oData.sDescription, 'TestBox Description');
+        oForm.addComboBox(   TestBoxData.ksParam_idSchedGroup,      oData.idSchedGroup, 'Scheduling Group',
+                             SchedGroupLogic(TMDatabaseConnection()).getSchedGroupsForCombo());
+        oForm.addCheckBox(   TestBoxData.ksParam_fEnabled,          oData.fEnabled, 'Enabled');
+        oForm.addComboBox(   TestBoxData.ksParam_enmLomKind,        oData.enmLomKind, 'Lights-out-management',
+                             TestBoxData.kaoLomKindDescs);
+        oForm.addText(       TestBoxData.ksParam_ipLom,             oData.ipLom, 'Lights-out-management IP Address');
+        oForm.addInt(        TestBoxData.ksParam_pctScaleTimeout,   oData.pctScaleTimeout, 'Timeout scale factor (%)');
+
+        ## @todo Pretty format the read-only fields and use hidden fields for
+        #        passing the actual values. (Yes, we need the values so we can
+        #        display the form correctly on input error.)
+        oForm.addTextRO(     TestBoxData.ksParam_sOs,               oData.sOs, 'TestBox OS');
+        oForm.addTextRO(     TestBoxData.ksParam_sOsVersion,        oData.sOsVersion, 'TestBox OS version');
+        oForm.addTextRO(     TestBoxData.ksParam_sCpuArch,          oData.sCpuArch, 'TestBox OS kernel architecture');
+        oForm.addTextRO(     TestBoxData.ksParam_sCpuVendor,        oData.sCpuVendor, 'TestBox CPU vendor');
+        oForm.addTextRO(     TestBoxData.ksParam_sCpuName,          oData.sCpuName, 'TestBox CPU name');
+        if oData.lCpuRevision:
+            oForm.addTextRO( TestBoxData.ksParam_lCpuRevision,      '%#x' % (oData.lCpuRevision,), 'TestBox CPU revision',
+                             sPostHtml = ' (family=%#x model=%#x stepping=%#x)'
+                                       % (oData.getCpuFamily(), oData.getCpuModel(), oData.getCpuStepping(),),
+                             sSubClass = 'long');
+        else:
+            oForm.addLongRO( TestBoxData.ksParam_lCpuRevision,      oData.lCpuRevision, 'TestBox CPU revision');
+        oForm.addIntRO(      TestBoxData.ksParam_cCpus,             oData.cCpus, 'Number of CPUs, cores and threads');
+        oForm.addCheckBoxRO( TestBoxData.ksParam_fCpuHwVirt,        oData.fCpuHwVirt, 'VT-x or AMD-V supported');
+        oForm.addCheckBoxRO( TestBoxData.ksParam_fCpuNestedPaging,  oData.fCpuNestedPaging, 'Nested paging supported');
+        oForm.addCheckBoxRO( TestBoxData.ksParam_fCpu64BitGuest,    oData.fCpu64BitGuest, '64-bit guest supported');
+        oForm.addCheckBoxRO( TestBoxData.ksParam_fChipsetIoMmu,     oData.fChipsetIoMmu, 'I/O MMU supported');
+        oForm.addMultilineTextRO(TestBoxData.ksParam_sReport,       oData.sReport, 'Hardware/software report');
+        oForm.addLongRO(     TestBoxData.ksParam_cMbMemory,         oData.cMbMemory, 'Installed RAM size (MB)');
+        oForm.addLongRO(     TestBoxData.ksParam_cMbScratch,        oData.cMbScratch, 'Available scratch space (MB)');
+        oForm.addIntRO(      TestBoxData.ksParam_iTestBoxScriptRev, oData.iTestBoxScriptRev,
+                             'TestBox Script SVN revision');
+        # Later:
+        #if not self.isAttributeNull(''):
+        #    sHexVer = '%s.%s.%.%s' % (oData.iPythonHexVersion >> 24, (oData.iPythonHexVersion >> 16) & 0xff,
+        #                             (oData.iPythonHexVersion >> 8) & 0xff, oData.iPythonHexVersion & 0xff);
+        #else:
+        #    sHexVer = str(oData.iPythonHexVersion);
+
+        oForm.addIntRO(      TestBoxData.ksParam_iPythonHexVersion, oData.iPythonHexVersion,
+                             'Python version (hex)');
+        if self._sMode == WuiFormContentBase.ksMode_Edit:
+            oForm.addComboBox(TestBoxData.ksParam_enmPendingCmd,    oData.enmPendingCmd, 'Pending command',
+                              TestBoxData.kaoTestBoxCmdDescs);
+        else:
+            oForm.addComboBoxRO(TestBoxData.ksParam_enmPendingCmd,  oData.enmPendingCmd, 'Pending command',
+                                TestBoxData.kaoTestBoxCmdDescs);
+
+        if self._sMode != WuiFormContentBase.ksMode_Show:
+            oForm.addSubmit('Create TestBox' if self._sMode == WuiFormContentBase.ksMode_Add else 'Change TestBox');
+
+        return True;
+
+
+class WuiTestBoxList(WuiListContentWithActionBase):
+    """
+    WUI TestBox List Content Generator.
+    """
+
+    ## Descriptors for the combo box.
+    kasTestBoxActionDescs = \
+    [ \
+        [ 'none',    'Select an action...', '' ],
+        [ 'enable',  'Enable',              '' ],
+        [ 'disable', 'Disable',             '' ],
+        TestBoxData.kaoTestBoxCmdDescs[1],
+        TestBoxData.kaoTestBoxCmdDescs[2],
+        TestBoxData.kaoTestBoxCmdDescs[3],
+        TestBoxData.kaoTestBoxCmdDescs[4],
+        TestBoxData.kaoTestBoxCmdDescs[5],
+    ];
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentWithActionBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                              sTitle = 'TestBoxes', sId = 'users', fnDPrint = fnDPrint, oDisp = oDisp);
+        self._asColumnHeaders.extend([ 'Name', 'LOM', 'Status',
+                                       'Cmd', 'Script', 'Python', 'Group',
+                                       'OS', 'CPU', 'Features', 'CPUs', 'RAM', 'Scratch',
+                                       'Actions' ]);
+        self._asColumnAttribs.extend([ 'align="center"', 'align="center"', 'align="center"',
+                                       'align="center"', 'align="center"', 'align="center"', 'align="center"',
+                                       '', '', '', 'align="right"', 'align="right"', 'align="right"',
+                                       'align="center"' ]);
+        self._aoActions     = list(self.kasTestBoxActionDescs);
+        self._aoSchedGroups = SchedGroupLogic(self._oDisp.getDb()).fetchOrderedByName();
+        self._dSchedGroups  = dict();
+        for oSchedGroup in self._aoSchedGroups:
+            self._aoActions.append([ 'setgroup-%u' % (oSchedGroup.idSchedGroup,),
+                                     'Migrate to group %s (#%u)' % (oSchedGroup.sName, oSchedGroup.idSchedGroup,),
+                                     oSchedGroup.sDescription ]);
+            self._dSchedGroups[oSchedGroup.idSchedGroup] = oSchedGroup;
+        self._sAction       = oDisp.ksActionTestBoxListPost;
+        self._sCheckboxName = TestBoxData.ksParam_idTestBox;
+
+    def _formatListEntry(self, iEntry): # pylint: disable=R0914
+        from testmanager.webui.wuiadmin import WuiAdmin;
+        oEntry  = self._aoEntries[iEntry];
+
+        # Lights outs managment.
+        if oEntry.enmLomKind == TestBoxData.ksLomKind_ILOM:
+            aoLom = [ WuiLinkBase('ILOM', 'https://%s/' % (oEntry.ipLom,), fBracketed = False), ];
+        elif oEntry.enmLomKind == TestBoxData.ksLomKind_ELOM:
+            aoLom = [ WuiLinkBase('ELOM', 'http://%s/'  % (oEntry.ipLom,), fBracketed = False), ];
+        elif oEntry.enmLomKind == TestBoxData.ksLomKind_AppleXserveLom:
+            aoLom = [ 'Apple LOM' ];
+        elif oEntry.enmLomKind == TestBoxData.ksLomKind_None:
+            aoLom = [ 'none' ];
+        else:
+            aoLom = [ 'Unexpected enmLomKind value "%s"' % (oEntry.enmLomKind,) ];
+        if oEntry.ipLom is not None:
+            if oEntry.enmLomKind in [ TestBoxData.ksLomKind_ILOM,  TestBoxData.ksLomKind_ELOM ]:
+                aoLom += [ WuiLinkBase('(ssh)', 'ssh://%s' % (oEntry.ipLom,), fBracketed = False) ];
+            aoLom += [ WuiRawHtml('<br>'), '%s' % (oEntry.ipLom,) ];
+
+        # State and Last seen.
+        if oEntry.oStatus is None:
+            oSeen = WuiSpanText('tmspan-offline', 'Never');
+            oState = '';
+        else:
+            oDelta = oEntry.tsCurrent - oEntry.oStatus.tsUpdated;
+            if oDelta.days <= 0 and oDelta.seconds <= 15*60: # 15 mins and we consider you dead.
+                oSeen = WuiSpanText('tmspan-online',  u'%s\u00a0s\u00a0ago' % (oDelta.days * 24 * 3600 + oDelta.seconds,));
+            else:
+                oSeen = WuiSpanText('tmspan-offline', u'%s' % (self.formatTsShort(oEntry.oStatus.tsUpdated),));
+
+            if oEntry.oStatus.idTestSet is None:
+                oState = str(oEntry.oStatus.enmState);
+            else:
+                from testmanager.webui.wuimain import WuiMain;
+                oState = WuiTmLink(oEntry.oStatus.enmState, WuiMain.ksScriptName,
+                                   { WuiMain.ksParamAction: WuiMain.ksActionTestResultDetails,
+                                     TestSetData.ksParam_idTestSet: oEntry.oStatus.idTestSet, },
+                                   sTitle = '#%u' % (oEntry.oStatus.idTestSet,),
+                                   fBracketed = False);
+
+        # Group link.
+        oGroup = self._dSchedGroups.get(oEntry.idSchedGroup);
+        oGroupLink = WuiTmLink(oGroup.sName if oGroup is not None else str(oEntry.idSchedGroup),
+                               WuiAdmin.ksScriptName,
+                               { WuiAdmin.ksParamAction: WuiAdmin.ksActionSchedGroupEdit,
+                                 SchedGroupData.ksParam_idSchedGroup: oEntry.idSchedGroup, },
+                               sTitle = '#%u' % (oEntry.idSchedGroup,),
+                               fBracketed = False);
+
+        # Reformat the OS version to take less space.
+        aoOs = [ 'N/A' ];
+        if oEntry.sOs is not None and oEntry.sOsVersion is not None and oEntry.sCpuArch:
+            sOsVersion = oEntry.sOsVersion;
+            if      sOsVersion[0] not in [ 'v', 'V', 'r', 'R'] \
+                and sOsVersion[0].isdigit() \
+                and sOsVersion.find('.') in range(4) \
+                and oEntry.sOs in [ 'linux', 'solaris', 'darwin', ]:
+                sOsVersion = 'v' + sOsVersion;
+
+            sVer1 = sOsVersion;
+            sVer2 = None;
+            if oEntry.sOs == 'linux' or oEntry.sOs == 'darwin':
+                iSep = sOsVersion.find(' / ');
+                if iSep > 0:
+                    sVer1 = sOsVersion[:iSep].strip();
+                    sVer2 = sOsVersion[iSep + 3:].strip();
+                    sVer2 = sVer2.replace('Red Hat Enterprise Linux Server', 'RHEL');
+                    sVer2 = sVer2.replace('Oracle Linux Server', 'OL');
+            elif oEntry.sOs == 'solaris':
+                iSep = sOsVersion.find(' (');
+                if iSep > 0 and sOsVersion[-1] == ')':
+                    sVer1 = sOsVersion[:iSep].strip();
+                    sVer2 = sOsVersion[iSep + 2:-1].strip();
+            aoOs = [
+                WuiSpanText('tmspan-osarch', u'%s.%s' % (oEntry.sOs, oEntry.sCpuArch,)),
+                WuiSpanText('tmspan-osver1', sVer1.replace('-', u'\u2011'),),
+            ];
+            if sVer2 is not None:
+                aoOs += [ WuiRawHtml('<br>'), WuiSpanText('tmspan-osver2', sVer2.replace('-', u'\u2011')), ];
+
+        # Format the CPU revision.
+        oCpu = None;
+        if oEntry.lCpuRevision is not None  and  oEntry.sCpuVendor is not None and oEntry.sCpuName is not None:
+            oCpu = [
+                u'%s (fam:%xh\u00a0m:%xh\u00a0s:%xh)'
+                % (oEntry.sCpuVendor, oEntry.getCpuFamily(), oEntry.getCpuModel(), oEntry.getCpuStepping(),),
+                WuiRawHtml('<br>'),
+                oEntry.sCpuName,
+            ];
+        else:
+            oCpu = [];
+            if oEntry.sCpuVendor is not None:
+                oCpu.append(oEntry.sCpuVendor);
+            if oEntry.lCpuRevision is not None:
+                oCpu.append('%#x' % (oEntry.lCpuRevision,));
+            if oEntry.sCpuName is not None:
+                oCpu.append(oEntry.sCpuName);
+
+        # Stuff cpu vendor and cpu/box features into one field.
+        asFeatures = []
+        if oEntry.fCpuHwVirt       is True: asFeatures.append(u'HW\u2011Virt');
+        if oEntry.fCpuNestedPaging is True: asFeatures.append(u'Nested\u2011Paging');
+        if oEntry.fCpu64BitGuest   is True: asFeatures.append(u'64\u2011bit\u2011Guest');
+        if oEntry.fChipsetIoMmu    is True: asFeatures.append(u'I/O\u2011MMU');
+        sFeatures = u' '.join(asFeatures) if len(asFeatures) > 0 else u'';
+
+        # Collection applicable actions.
+        aoActions = [
+             WuiTmLink('Details', WuiAdmin.ksScriptName,
+                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestBoxDetails,
+                         TestBoxData.ksParam_idTestBox: oEntry.idTestBox,
+                         WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, } ),
+            ]
+
+        if isDbTimestampInfinity(oEntry.tsExpire):
+            aoActions += [
+                WuiTmLink('Edit', WuiAdmin.ksScriptName,
+                          { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestBoxEdit,
+                            TestBoxData.ksParam_idTestBox: oEntry.idTestBox, } ),
+                WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                          { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestBoxRemovePost,
+                            TestBoxData.ksParam_idTestBox: oEntry.idTestBox },
+                          sConfirm = 'Are you sure that you want to remove %s (%s)?' % (oEntry.sName, oEntry.ip) ),
+            ]
+
+        if oEntry.sOs not in [ 'win', 'os2', ] and oEntry.ip is not None:
+            aoActions.append(WuiLinkBase('ssh', 'ssh://vbox@%s' % (oEntry.ip,),));
+
+        return [ self._getCheckBoxColumn(iEntry, oEntry.idTestBox),
+                 [ WuiSpanText('tmspan-name', oEntry.sName), WuiRawHtml('<br>'), '%s' % (oEntry.ip,),],
+                 aoLom,
+                 [
+                     '' if oEntry.fEnabled else 'disabled / ',
+                     oState,
+                     WuiRawHtml('<br>'),
+                     oSeen,
+                  ],
+                 oEntry.enmPendingCmd,
+                 WuiSvnLink(oEntry.iTestBoxScriptRev),
+                 oEntry.formatPythonVersion(),
+                 oGroupLink,
+                 aoOs,
+                 oCpu,
+                 sFeatures,
+                 oEntry.cCpus            if oEntry.cCpus                is not None else 'N/A',
+                 utils.formatNumberNbsp(oEntry.cMbMemory)  + u'\u00a0MB' if oEntry.cMbMemory  is not None else 'N/A',
+                 utils.formatNumberNbsp(oEntry.cMbScratch) + u'\u00a0MB' if oEntry.cMbScratch is not None else 'N/A',
+                 aoActions,
+        ];
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadmintestcase.py b/src/VBox/ValidationKit/testmanager/webui/wuiadmintestcase.py
new file mode 100644
index 0000000..f990466
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadmintestcase.py
@@ -0,0 +1,210 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadmintestcase.py $
+
+"""
+Test Manager WUI - Test Cases.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from common                             import utils, webutils;
+from testmanager.webui.wuicontentbase   import WuiFormContentBase, WuiListContentBase, WuiTmLink, WuiRawHtml;
+from testmanager.core.db                import isDbTimestampInfinity;
+from testmanager.core.testcase          import TestCaseDataEx, TestCaseData, TestCaseDependencyLogic;
+from testmanager.core.globalresource    import GlobalResourceData, GlobalResourceLogic;
+
+class WuiTestCaseList(WuiListContentBase):
+    """
+    WUI test case list content generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Test Cases', fnDPrint = fnDPrint, oDisp = oDisp);
+        self._asColumnHeaders = \
+        [
+            'Name', 'Active', 'Default Timeout', 'Base Command / Variations', 'Validation Kit Files',
+            'Test Case Prereqs', 'Global Resources', 'Actions'
+        ];
+        self._asColumnAttribs = \
+        [
+            '', '', '', '', '',
+            'valign="top"', 'valign="top"', 'align="center"'
+        ];
+
+    def _formatListEntry(self, iEntry):
+        oEntry = self._aoEntries[iEntry];
+        from testmanager.webui.wuiadmin import WuiAdmin;
+
+        aoRet = \
+        [
+            oEntry.sName.replace('-', u'\u2011'),
+            'Enabled' if oEntry.fEnabled else 'Disabled',
+            utils.formatIntervalSeconds(oEntry.cSecTimeout),
+        ];
+
+        # Base command and variations.
+        fNoGang = True;
+        for oVar in oEntry.aoTestCaseArgs:
+            if oVar.cGangMembers > 1:
+                fNoGang = False;
+                break;
+        sHtml  = '  <table class="tminnertbl" width=100%>\n' \
+                 '    <tr>\n' \
+                 '      <th>';
+        if not fNoGang:
+            sHtml += '<th>Gang Size</th>';
+        sHtml += 'Timeout</th><th>Additional Arguments</b></th>\n' \
+                 '    </tr>\n'
+        for oTmp in oEntry.aoTestCaseArgs:
+            sHtml += '<tr>';
+            if not fNoGang:
+                sHtml += '<td>%d</td>' % (oTmp.cGangMembers,)
+            sHtml += '<td>%s</td><td>%s</td></tr>\n' \
+                   % ( utils.formatIntervalSeconds(oTmp.cSecTimeout) if oTmp.cSecTimeout is not None else 'Default',
+                       webutils.escapeElem(oTmp.sArgs.replace('-', u'\u2011')),)
+        sHtml += '  </table>'
+
+        aoRet.append([oEntry.sBaseCmd.replace('-', u'\u2011'), WuiRawHtml(sHtml)]);
+
+        # Next.
+        aoRet += [ oEntry.sValidationKitZips if oEntry.sValidationKitZips is not None else '', ];
+
+        # Show dependency on other testcases
+        if oEntry.aoDepTestCases not in (None, []):
+            sHtml = '  <ul class="tmshowall">\n'
+            for sTmp in oEntry.aoDepTestCases:
+                sHtml += '    <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' \
+                       % (WuiAdmin.ksScriptName,
+                          WuiAdmin.ksParamAction, WuiAdmin.ksActionTestCaseEdit,
+                          TestCaseData.ksParam_idTestCase, sTmp.idTestCase,
+                          sTmp.sName)
+            sHtml += '  </ul>\n'
+        else:
+            sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n'
+        aoRet.append(WuiRawHtml(sHtml));
+
+        # Show dependency on global resources
+        if oEntry.aoDepGlobalResources not in (None, []):
+            sHtml = '  <ul class="tmshowall">\n'
+            for sTmp in oEntry.aoDepGlobalResources:
+                sHtml += '    <li class="tmshowall"><a href="%s?%s=%s&%s=%s">%s</a></li>\n' \
+                       % (WuiAdmin.ksScriptName,
+                          WuiAdmin.ksParamAction, WuiAdmin.ksActionGlobalRsrcShowEdit,
+                          GlobalResourceData.ksParam_idGlobalRsrc, sTmp.idGlobalRsrc,
+                          sTmp.sName)
+            sHtml += '  </ul>\n'
+        else:
+            sHtml = '<ul class="tmshowall"><li class="tmshowall">None</li></ul>\n'
+        aoRet.append(WuiRawHtml(sHtml));
+
+        # Show actions that can be taken.
+        aoActions = [ WuiTmLink('Details', WuiAdmin.ksScriptName,
+                                { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDetails,
+                                  TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase }), ];
+        if isDbTimestampInfinity(oEntry.tsExpire):
+            aoActions.append(WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseEdit,
+                                         TestCaseData.ksParam_idTestCase: oEntry.idTestCase }));
+        aoActions.append(WuiTmLink('Clone', WuiAdmin.ksScriptName,
+                                   { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseClone,
+                                     TestCaseData.ksParam_idGenTestCase: oEntry.idGenTestCase }));
+        if isDbTimestampInfinity(oEntry.tsExpire):
+            aoActions.append(WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDoRemove,
+                                         TestCaseData.ksParam_idTestCase: oEntry.idTestCase },
+                                       sConfirm = 'Are you sure you want to remove test case #%d?' % (oEntry.idTestCase,)));
+        aoRet.append(aoActions);
+
+        return aoRet;
+
+
+class WuiTestCase(WuiFormContentBase):
+    """
+    WUI user account content generator.
+    """
+
+    def __init__(self, oData, sMode, oDisp):
+        assert isinstance(oData, TestCaseDataEx);
+
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'New Test Case';
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Edit Test Case - %s (#%s)' % (oData.sName, oData.idTestCase);
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'Test Case - %s (#%s)' % (oData.sName, oData.idTestCase);
+        WuiFormContentBase.__init__(self, oData, sMode, 'TestCase', oDisp, sTitle);
+
+        # Read additional bits form the DB.
+        oDepLogic = TestCaseDependencyLogic(oDisp.getDb());
+        self._aoAllTestCases    = oDepLogic.getApplicableDepTestCaseData(-1 if oData.idTestCase is None else oData.idTestCase);
+        self._aoAllGlobalRsrcs  = GlobalResourceLogic(oDisp.getDb()).getAll();
+
+    def _populateForm(self, oForm, oData):
+        oForm.addIntRO      (TestCaseData.ksParam_idTestCase,       oData.idTestCase,       'Test Case ID')
+        oForm.addTimestampRO(TestCaseData.ksParam_tsEffective,      oData.tsEffective,      'Last changed')
+        oForm.addTimestampRO(TestCaseData.ksParam_tsExpire,         oData.tsExpire,         'Expires (excl)')
+        oForm.addIntRO      (TestCaseData.ksParam_uidAuthor,        oData.uidAuthor,        'Changed by UID')
+        oForm.addIntRO      (TestCaseData.ksParam_idGenTestCase,    oData.idGenTestCase,    'Test Case generation ID')
+        oForm.addText       (TestCaseData.ksParam_sName,            oData.sName,            'Name')
+        oForm.addText       (TestCaseData.ksParam_sDescription,     oData.sDescription,     'Description')
+        oForm.addCheckBox   (TestCaseData.ksParam_fEnabled,         oData.fEnabled,         'Enabled')
+        oForm.addLong       (TestCaseData.ksParam_cSecTimeout,
+                             utils.formatIntervalSeconds2(oData.cSecTimeout),               'Default timeout')
+        oForm.addWideText   (TestCaseData.ksParam_sTestBoxReqExpr,  oData.sTestBoxReqExpr,  'TestBox requirements (python)');
+        oForm.addWideText   (TestCaseData.ksParam_sBuildReqExpr,    oData.sBuildReqExpr,    'Build requirement (python)');
+        oForm.addWideText   (TestCaseData.ksParam_sBaseCmd,         oData.sBaseCmd,         'Base command')
+        oForm.addText       (TestCaseData.ksParam_sValidationKitZips,   oData.sValidationKitZips,   'Test suite files')
+
+        oForm.addListOfTestCaseArgs(TestCaseDataEx.ksParam_aoTestCaseArgs, oData.aoTestCaseArgs, 'Argument variations')
+
+        aoTestCaseDeps = [];
+        for oTestCase in self._aoAllTestCases:
+            if oTestCase.idTestCase == oData.idTestCase:
+                continue;
+            fSelected = False;
+            for oDep in oData.aoDepTestCases:
+                if oDep.idTestCase == oTestCase.idTestCase:
+                    fSelected = True;
+                    break;
+            aoTestCaseDeps.append([oTestCase.idTestCase, fSelected, oTestCase.sName]);
+        oForm.addListOfTestCases(TestCaseDataEx.ksParam_aoDepTestCases, aoTestCaseDeps,     'Depends on test cases')
+
+        aoGlobalResrcDeps = [];
+        for oGlobalRsrc in self._aoAllGlobalRsrcs:
+            fSelected = False;
+            for oDep in oData.aoDepGlobalResources:
+                if oDep.idGlobalRsrc == oGlobalRsrc.idGlobalRsrc:
+                    fSelected = True;
+                    break;
+            aoGlobalResrcDeps.append([oGlobalRsrc.idGlobalRsrc, fSelected, oGlobalRsrc.sName]);
+        oForm.addListOfResources(TestCaseDataEx.ksParam_aoDepGlobalResources, aoGlobalResrcDeps, 'Depends on resources')
+
+        oForm.addSubmit();
+
+        return True;
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadmintestgroup.py b/src/VBox/ValidationKit/testmanager/webui/wuiadmintestgroup.py
new file mode 100644
index 0000000..9ae5f48
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadmintestgroup.py
@@ -0,0 +1,181 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadmintestgroup.py $
+
+"""
+Test Manager WUI - Test Groups.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Validation Kit imports.
+from common                             import utils, webutils;
+from testmanager.webui.wuicontentbase   import WuiFormContentBase, WuiListContentBase, WuiTmLink, WuiRawHtml;
+from testmanager.core.db                import isDbTimestampInfinity;
+from testmanager.core.testgroup         import TestGroupData, TestGroupDataEx;
+from testmanager.core.testcase          import TestCaseData, TestCaseLogic;
+
+
+class WuiTestGroup(WuiFormContentBase):
+    """
+    WUI test group content generator.
+    """
+
+    def __init__(self, oData, sMode, oDisp):
+        assert isinstance(oData, TestGroupDataEx);
+
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'Add Test Group';
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Modify Test Group';
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'Test Group';
+        WuiFormContentBase.__init__(self, oData, sMode, 'TestGroup', oDisp, sTitle);
+
+        #
+        # Fetch additional data.
+        #
+        if sMode in [WuiFormContentBase.ksMode_Add, WuiFormContentBase.ksMode_Edit]:
+            self.aoAllTestCases = TestCaseLogic(oDisp.getDb()).fetchForListing(0, 0x7fff, None);
+        else:
+            self.aoAllTestCases = [oMember.oTestCase for oMember in oData.aoMembers];
+
+    def _populateForm(self, oForm, oData):
+        oForm.addIntRO          (TestGroupData.ksParam_idTestGroup,      self._oData.idTestGroup,    'Test Group ID')
+        oForm.addTimestampRO    (TestGroupData.ksParam_tsEffective,      self._oData.tsEffective,    'Last changed')
+        oForm.addTimestampRO    (TestGroupData.ksParam_tsExpire,         self._oData.tsExpire,       'Expires (excl)')
+        oForm.addIntRO          (TestGroupData.ksParam_uidAuthor,        self._oData.uidAuthor,      'Changed by UID')
+        oForm.addText           (TestGroupData.ksParam_sName,            self._oData.sName,          'Name')
+        oForm.addText           (TestGroupData.ksParam_sDescription,     self._oData.sDescription,   'Description')
+
+        oForm.addListOfTestGroupMembers(TestGroupDataEx.ksParam_aoMembers,
+                                        oData.aoMembers, self.aoAllTestCases, 'Test Case List',
+                                        fReadOnly = self._sMode == WuiFormContentBase.ksMode_Show);
+
+        oForm.addSubmit();
+        return True;
+
+
+class WuiTestGroupList(WuiListContentBase):
+    """
+    WUI test group list content generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        assert len(aoEntries) == 0 or isinstance(aoEntries[0], TestGroupDataEx)
+
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Test Groups', fnDPrint = fnDPrint, oDisp = oDisp);
+        self._asColumnHeaders = [ 'ID', 'Name', 'Description', 'Test Cases', 'Actions' ];
+        self._asColumnAttribs = [ 'align="right"', '', '', '', 'align="center"' ];
+
+
+    def _formatListEntry(self, iEntry):
+        oEntry = self._aoEntries[iEntry];
+        from testmanager.webui.wuiadmin import WuiAdmin;
+
+        #
+        # Test case list.
+        #
+        sHtml = '';
+        if len(oEntry.aoMembers) > 0:
+            for oMember in oEntry.aoMembers:
+                sHtml += '<dl>\n' \
+                         '  <dd><strong>%s</strong> (priority: %d) %s %s</dd>\n' \
+                       % ( webutils.escapeElem(oMember.oTestCase.sName),
+                           oMember.iSchedPriority,
+                           WuiTmLink('Details', WuiAdmin.ksScriptName,
+                                     { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseDetails,
+                                       TestCaseData.ksParam_idGenTestCase: oMember.oTestCase.idGenTestCase, } ).toHtml(),
+                           WuiTmLink('Edit', WuiAdmin.ksScriptName,
+                                     { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestCaseEdit,
+                                       TestCaseData.ksParam_idTestCase: oMember.oTestCase.idTestCase, } ).toHtml()
+                           if isDbTimestampInfinity(oMember.oTestCase.tsExpire) else '',
+                           );
+
+                sHtml += '  <dt>\n';
+
+                fNoGang = True;
+                for oVar in oMember.oTestCase.aoTestCaseArgs:
+                    if oVar.cGangMembers > 1:
+                        fNoGang = False
+                        break;
+
+                sHtml += '    <table class="tminnertbl" width="100%">\n'
+                if fNoGang:
+                    sHtml += '      <tr><th>Timeout</th><th>Arguments</th></tr>\n';
+                else:
+                    sHtml += '      <tr><th>Gang Size</th><th>Timeout</th><th style="text-align:left;">Arguments</th></tr>\n';
+
+                cArgsIncluded = 0;
+                for oVar in oMember.oTestCase.aoTestCaseArgs:
+                    if oMember.aidTestCaseArgs is None  or  oVar.idTestCaseArgs in oMember.aidTestCaseArgs:
+                        cArgsIncluded += 1;
+                        if fNoGang:
+                            sHtml += '      <tr>';
+                        else:
+                            sHtml += '      <tr><td>%s</td>' % (oVar.cGangMembers,);
+                        sHtml += '<td>%s</td><td>%s</td></tr>\n' \
+                               % ( utils.formatIntervalSeconds(oMember.oTestCase.cSecTimeout if oVar.cSecTimeout is None
+                                                               else oVar.cSecTimeout),
+                                   webutils.escapeElem(oVar.sArgs), );
+                if cArgsIncluded == 0:
+                    sHtml += '      <tr><td colspan="%u">No arguments selected.</td></tr>\n' % ( 2 if fNoGang else 3, );
+                sHtml += '    </table>\n' \
+                         '  </dl>\n';
+        oTestCases = WuiRawHtml(sHtml);
+
+        #
+        # Actions.
+        #
+        aoActions = [ WuiTmLink('Details', WuiAdmin.ksScriptName,
+                                { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupDetails,
+                                  TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup,
+                                  WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }) ];
+        if isDbTimestampInfinity(oEntry.tsExpire):
+            aoActions.append(WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupEdit,
+                                         TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup }));
+            aoActions.append(WuiTmLink('Clone', WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupClone,
+                                         TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup,
+                                         WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }));
+            aoActions.append(WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupDoRemove,
+                                         TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup },
+                                       sConfirm = 'Do you really want to remove test group #%d?' % (oEntry.idTestGroup,)));
+        else:
+            aoActions.append(WuiTmLink('Clone', WuiAdmin.ksScriptName,
+                                       { WuiAdmin.ksParamAction: WuiAdmin.ksActionTestGroupClone,
+                                         TestGroupData.ksParam_idTestGroup: oEntry.idTestGroup,
+                                         WuiAdmin.ksParamEffectiveDate: self._tsEffectiveDate, }));
+
+
+
+        return [ oEntry.idTestGroup,
+                 oEntry.sName,
+                 oEntry.sDescription if oEntry.sDescription is not None else '',
+                 oTestCases,
+                 aoActions ];
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuiadminuseraccount.py b/src/VBox/ValidationKit/testmanager/webui/wuiadminuseraccount.py
new file mode 100644
index 0000000..214bf64
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuiadminuseraccount.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+# $Id: wuiadminuseraccount.py $
+
+"""
+Test Manager WUI - User accounts.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Validation Kit imports.
+from testmanager.webui.wuicontentbase   import WuiFormContentBase, WuiListContentBase, WuiTmLink;
+from testmanager.core.useraccount       import UserAccountData
+
+
+class WuiUserAccount(WuiFormContentBase):
+    """
+    WUI user account content generator.
+    """
+    def __init__(self, oData, sMode, oDisp):
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'Add User Account';
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Modify User Account';
+        else:
+            assert sMode == WuiFormContentBase.ksMode_Show;
+            sTitle = 'User Account';
+        WuiFormContentBase.__init__(self, oData, sMode, 'User', oDisp, sTitle);
+
+    def _populateForm(self, oForm, oData):
+        oForm.addIntRO(      UserAccountData.ksParam_uid,         oData.uid,         'User ID');
+        oForm.addTimestampRO(UserAccountData.ksParam_tsEffective, oData.tsEffective, 'Effective Date');
+        oForm.addTimestampRO(UserAccountData.ksParam_tsExpire,    oData.tsExpire,    'Effective Date');
+        oForm.addIntRO(      UserAccountData.ksParam_uidAuthor,   oData.uidAuthor,   'Changed by UID');
+        oForm.addText(       UserAccountData.ksParam_sLoginName,  oData.sLoginName,  'Login name')
+        oForm.addText(       UserAccountData.ksParam_sUsername,   oData.sUsername,   'User name')
+        oForm.addText(       UserAccountData.ksParam_sFullName,   oData.sFullName,   'Full name')
+        oForm.addText(       UserAccountData.ksParam_sEmail,      oData.sEmail,      'E-mail')
+        if self._sMode != WuiFormContentBase.ksMode_Show:
+            oForm.addSubmit('Add User' if self._sMode == WuiFormContentBase.ksMode_Add else 'Change User');
+        return True;
+
+
+class WuiUserAccountList(WuiListContentBase):
+    """
+    WUI user account list content generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Registered User Accounts', sId = 'users', fnDPrint = fnDPrint, oDisp = oDisp);
+        self._asColumnHeaders = ['User ID', 'Name', 'E-mail', 'Full Name', 'Login Name', 'Actions'];
+        self._asColumnAttribs = ['align="center"', 'align="center"', 'align="center"', 'align="center"', 'align="center"',
+                                 'align="center"'];
+
+    def _formatListEntry(self, iEntry):
+        from testmanager.webui.wuiadmin import WuiAdmin;
+        oEntry  = self._aoEntries[iEntry];
+        return [ oEntry.uid, oEntry.sUsername, oEntry.sEmail, oEntry.sFullName, oEntry.sLoginName,
+                 [ WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionUserEdit,
+                               UserAccountData.ksParam_uid: oEntry.uid } ),
+                   WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionUserDelPost,
+                               UserAccountData.ksParam_uid: oEntry.uid },
+                             sConfirm = 'Are you sure you want to remove user #%d?' % (oEntry.uid,)),
+               ] ];
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuibase.py b/src/VBox/ValidationKit/testmanager/webui/wuibase.py
new file mode 100644
index 0000000..cd8be72
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuibase.py
@@ -0,0 +1,986 @@
+# -*- coding: utf-8 -*-
+# $Id: wuibase.py $
+
+"""
+Test Manager Web-UI - Base Classes.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import os;
+
+# Validation Kit imports.
+from common                       import webutils, utils;
+from testmanager                  import config;
+from testmanager.core.base        import ModelDataBase, TMExceptionBase;
+from testmanager.core.db          import TMDatabaseConnection;
+from testmanager.core.systemlog   import SystemLogLogic, SystemLogData;
+from testmanager.core.useraccount import UserAccountLogic
+
+
+class WuiException(TMExceptionBase):
+    """
+    For exceptions raised by Web UI code.
+    """
+    pass;
+
+
+class WuiDispatcherBase(object):
+    """
+    Base class for the Web User Interface (WUI) dispatchers.
+
+    The dispatcher class defines the basics of the page (like base template,
+    menu items, action).  It is also responsible for parsing requests and
+    dispatching them to action (POST) or/and content generators (GET+POST).
+    The content returned by the generator is merged into the template and sent
+    back to the webserver glue.
+    """
+
+    ## @todo possible that this should all go into presentation.
+
+    ## The action parameter.
+    ksParamAction       = 'Action';
+    ## The name of the default action.
+    ksActionDefault     = 'default';
+
+    ## The name of the current page number parameter used when displaying lists.
+    ksParamPageNo       = 'PageNo';
+    ## The name of the page length (list items) parameter when displaying lists.
+    ksParamItemsPerPage = 'ItemsPerPage';
+
+    ## The name of the effective date (timestamp) parameter.
+    ksParamEffectiveDate = 'EffectiveDate';
+
+    ## The name of the list-action parameter (WuiListContentWithActionBase).
+    ksParamListAction    = 'ListAction';
+
+    ## The name of the change log enabled/disabled parameter.
+    ksParamChangeLogEnabled         = 'ChangeLogEnabled';
+    ## The name of the parmaeter indicating the change log page number.
+    ksParamChangeLogPageNo          = 'ChangeLogPageNo';
+    ## The name of the parameter indicate number of change log entries per page.
+    ksParamChangeLogEntriesPerPage  = 'ChangeLogEntriesPerPage';
+
+    ## @name Dispatcher debugging parameters.
+    ## {@
+    ksParamDbgSqlTrace      = 'DbgSqlTrace';
+    ksParamDbgSqlExplain    = 'DbgSqlExplain';
+    ## List of all debugging parameters.
+    kasDbgParams = (ksParamDbgSqlTrace, ksParamDbgSqlExplain,);
+    ## @}
+
+    ## Special action return code for skipping _generatePage. Useful for
+    # download pages and the like that messes with the HTTP header and more.
+    ksDispatchRcAllDone = 'Done - Page has been rendered already';
+
+
+    def __init__(self, oSrvGlue, sScriptName):
+        self._oSrvGlue          = oSrvGlue;
+        self._oDb               = TMDatabaseConnection(self.dprint if config.g_kfWebUiSqlDebug else None, oSrvGlue = oSrvGlue);
+        self._asCheckedParams   = [];
+        self._dParams           = None;  # Set by dispatchRequest.
+        self._sAction           = None;  # Set by dispatchRequest.
+        self._dDispatch         = { self.ksActionDefault: self._actionDefault, };
+
+        # Template bits.
+        self._sTemplate         = 'template-default.html';
+        self._sPageTitle        = '$$TODO$$';   # The page title.
+        self._aaoMenus          = [];           # List of [sName, sLink, [ [sSideName, sLink], .. ] tuples.
+        self._sPageBody         = '$$TODO$$';   # The body text.
+        self._sRedirectTo       = None;
+        self._sDebug            = '';
+
+        # Debugger bits.
+        self._fDbgSqlTrace      = False;
+        self._fDbgSqlExplain    = False;
+        self._dDbgParams        = dict();
+        for sKey, sValue in oSrvGlue.getParameters().iteritems():
+            if sKey in self.kasDbgParams:
+                self._dDbgParams[sKey] = sValue;
+        if len(self._dDbgParams) > 0:
+            from testmanager.webui.wuicontentbase import WuiTmLink;
+            WuiTmLink.kdDbgParams = self._dDbgParams;
+
+        # Determine currently logged in user credentials
+        self._oCurUser          = UserAccountLogic(self._oDb).tryFetchAccountByLoginName(oSrvGlue.getLoginName());
+
+        # Calc a couple of URL base strings for this dispatcher.
+        self._sUrlBase          = sScriptName + '?';
+        if len(self._dDbgParams) > 0:
+            self._sUrlBase     += webutils.encodeUrlParams(self._dDbgParams) + '&';
+        self._sActionUrlBase    = self._sUrlBase + self.ksParamAction + '=';
+
+
+    def _redirectPage(self):
+        """
+        Redirects the page to the URL given in self._sRedirectTo.
+        """
+        assert self._sRedirectTo is not None;
+        assert len(self._sRedirectTo) > 0;
+        assert self._sPageBody is None;
+        assert self._sPageTitle is None;
+
+        self._oSrvGlue.setRedirect(self._sRedirectTo);
+        return True;
+
+    def _generateMenus(self):
+        """
+        Generates the two menus, returning them as (sTopMenuItems, sSideMenuItems).
+        """
+        #
+        # We use the action to locate the side menu.
+        #
+        aasSideMenu = None;
+        for cchAction in range(len(self._sAction), 1, -1):
+            sActionParam = '%s=%s' % (self.ksParamAction, self._sAction[:cchAction]);
+            for aoItem in self._aaoMenus:
+                if aoItem[1].find(sActionParam) > 0:
+                    aasSideMenu = aoItem[2];
+                    break;
+                for asSubItem in aoItem[2]:
+                    if asSubItem[1].find(sActionParam) > 0:
+                        aasSideMenu = aoItem[2];
+                        break;
+                if aasSideMenu is not None:
+                    break;
+
+        #
+        # Top menu first.
+        #
+        sTopMenuItems = '';
+        for aoItem in self._aaoMenus:
+            if aasSideMenu is aoItem[2]:
+                sTopMenuItems += '<li class="current_page_item">';
+            else:
+                sTopMenuItems += '<li>';
+            sTopMenuItems += '<a href="' + webutils.escapeAttr(aoItem[1]) + '">' \
+                           + webutils.escapeElem(aoItem[0]) + '</a></li>\n';
+
+        #
+        # Side menu (if found).
+        #
+        sActionParam = '%s=%s' % (self.ksParamAction, self._sAction);
+        sSideMenuItems = '';
+        if aasSideMenu is not None:
+            for asSubItem in aasSideMenu:
+                if asSubItem[1].find(sActionParam) > 0:
+                    sSideMenuItems += '<li class="current_page_item">';
+                else:
+                    sSideMenuItems += '<li>';
+                sSideMenuItems += '<a href="' + webutils.escapeAttr(asSubItem[1]) + '">' \
+                                + webutils.escapeElem(asSubItem[0]) + '</a></li>\n';
+
+        return (sTopMenuItems, sSideMenuItems);
+
+
+    def _generatePage(self):
+        """
+        Generates the page using _sTemplate, _sPageTitle, _aaoMenus, and _sPageBody.
+        """
+        assert self._sRedirectTo is None;
+
+        # Load the template.
+        oFile = open(os.path.join(self._oSrvGlue.pathTmWebUI(), self._sTemplate));
+        sTmpl = oFile.read();
+        oFile.close();
+
+        # Do replacements.
+        sTmpl = sTmpl.replace('@@PAGE_TITLE@@', self._sPageTitle);
+        sTmpl = sTmpl.replace('@@PAGE_BODY@@', self._sPageBody);
+        if self._oCurUser is not None:
+            sTmpl = sTmpl.replace('@@USER_NAME@@', self._oCurUser.sUsername);
+        else:
+            sTmpl = sTmpl.replace('@@USER_NAME@@', 'unauthorized user "' + self._oSrvGlue.getLoginName() + '"');
+        sTmpl = sTmpl.replace('@@TESTMANAGER_VERSION@@', config.g_ksVersion);
+        sTmpl = sTmpl.replace('@@TESTMANAGER_REVISION@@', config.g_ksRevision);
+        sTmpl = sTmpl.replace('@@BASE_URL@@', self._oSrvGlue.getBaseUrl());
+
+        (sTopMenuItems, sSideMenuItems) = self._generateMenus();
+        sTmpl = sTmpl.replace('@@TOP_MENU_ITEMS@@', sTopMenuItems);
+        sTmpl = sTmpl.replace('@@SIDE_MENU_ITEMS@@', sSideMenuItems);
+
+        # Provide basic auth log out for browsers that supports it.
+        sUserAgent = self._oSrvGlue.getUserAgent();
+        if   (sUserAgent.startswith('Mozilla/') and sUserAgent.find('Firefox') > 0) \
+          or False:
+            # Log in as the logout user in the same realm, the browser forgets
+            # the old login and the job is done. (see apache sample conf)
+            sLogOut = ' (<a href="%s://logout:logout@%s%slogout.py">logout</a>)' \
+                % (self._oSrvGlue.getUrlScheme(), self._oSrvGlue.getUrlNetLoc(), self._oSrvGlue.getUrlBasePath());
+        elif (sUserAgent.startswith('Mozilla/') and sUserAgent.find('Safari') > 0) \
+          or False:
+            # For a 401, causing the browser to forget the old login. Works
+            # with safari as well as the two above. Since safari consider the
+            # above method a phishing attempt and displays a warning to that
+            # effect, which when taken seriously aborts the logout, this method
+            # is preferable, even if it throws logon boxes in the user's face
+            # till he/she/it hits escape, because it always works.
+            sLogOut = ' (<a href="logout2.py">logout</a>)'
+        elif (sUserAgent.startswith('Mozilla/') and sUserAgent.find('MSIE') > 0) \
+          or (sUserAgent.startswith('Mozilla/') and sUserAgent.find('Chrome') > 0) \
+          or False:
+            ## There doesn't seem to be any way to make IE really log out
+            # without using a cookie and systematically 401 accesses based on
+            # some logout state associated with it.  Not sure how secure that
+            # can be made and we really want to avoid cookies.  So, perhaps,
+            # just avoid IE for now. :-)
+            ## Chrome/21.0 doesn't want to log out either.
+            sLogOut = ''
+        else:
+            sLogOut = ''
+        sTmpl = sTmpl.replace('@@LOG_OUT@@', sLogOut)
+
+        # Debug section.
+        if self._sDebug == '':
+            if config.g_kfWebUiSqlTrace or self._fDbgSqlTrace or self._fDbgSqlExplain:
+                self._sDebug  = '<h3>Processed in %s ns.</h3>\n%s\n' \
+                              % ( utils.formatNumber(utils.timestampNano() - self._oSrvGlue.tsStart,),
+                                  self._oDb.debugHtmlReport(self._oSrvGlue.tsStart));
+            elif config.g_kfWebUiProcessedIn:
+                self._sDebug  = '<h3>Processed in %s ns.</h3>\n' \
+                              % ( utils.formatNumber(utils.timestampNano() - self._oSrvGlue.tsStart,), );
+            if config.g_kfWebUiDebugPanel:
+                self._sDebug += self._debugRenderPanel();
+
+        if self._sDebug != '':
+            sTmpl = sTmpl.replace('@@DEBUG@@', '<div id="debug"><br><br><hr/>' + \
+                unicode(self._sDebug, errors='ignore') if isinstance(self._sDebug, str) else self._sDebug + '</div>');
+        else:
+            sTmpl = sTmpl.replace('@@DEBUG@@', '');
+
+        # Output the result.
+        self._oSrvGlue.write(sTmpl);
+        return True;
+
+    #
+    # Interface for WuiContentBase classes.
+    #
+
+    def getParameters(self):
+        """
+        Returns a (shallow) copy of the request parameter dictionary.
+        """
+        return self._dParams.copy();
+
+    def getDb(self):
+        """
+        Returns the database connection.
+        """
+        return self._oDb;
+
+
+    #
+    # Parameter handling.
+    #
+
+    def getStringParam(self, sName, asValidValues = None, sDefault = None):
+        """
+        Gets a string parameter.
+        Raises exception if not found and sDefault is None.
+        """
+        if sName in self._dParams:
+            if sName not in self._asCheckedParams:
+                self._asCheckedParams.append(sName);
+            sValue = self._dParams[sName];
+            if isinstance(sValue, list):
+                raise WuiException('%s parameter "%s" is given multiple times: "%s"' % (self._sAction, sName, sValue));
+            sValue = sValue.strip();
+        elif sDefault is None:
+            raise WuiException('%s is missing parameters: "%s"' % (self._sAction, sName,));
+        else:
+            sValue = sDefault;
+
+        if asValidValues is not None and sValue not in asValidValues:
+            raise WuiException('%s parameter %s value "%s" not in %s '
+                               % (self._sAction, sName, sValue, asValidValues));
+        return sValue;
+
+    def getBoolParam(self, sName, fDefault = None):
+        """
+        Gets a boolean parameter.
+        Raises exception if not found and fDefault is None, or if not a valid boolean.
+        """
+        sValue = self.getStringParam(sName, [ 'True', 'true', '1', 'False', 'false', '0'],
+                                     '0' if fDefault is None else str(fDefault));
+        # HACK: Checkboxes doesn't return a value when unchecked, so we always
+        #       provide a default when dealing with boolean parameters.
+        return sValue == 'True' or sValue == 'true' or sValue == '1';
+
+    def getIntParam(self, sName, iMin = None, iMax = None, iDefault = None):
+        """
+        Gets a integer parameter.
+        Raises exception if not found and iDefault is None, if not a valid int,
+        or if outside the range defined by iMin and iMax.
+        """
+        if iDefault is not None and sName not in self._dParams:
+            return iDefault;
+
+        sValue = self.getStringParam(sName, None, None if iDefault is None else str(iDefault));
+        try:
+            iValue = int(sValue);
+        except:
+            raise WuiException('%s parameter %s value "%s" cannot be convert to an integer'
+                               % (self._sAction, sName, sValue));
+
+        if   (iMin is not None and iValue < iMin) \
+          or (iMax is not None and iValue > iMax):
+            raise WuiException('%s parameter %s value %d is out of range [%s..%s]'
+                               % (self._sAction, sName, iValue, iMin, iMax));
+        return iValue;
+
+    def getLongParam(self, sName, lMin = None, lMax = None, lDefault = None):
+        """
+        Gets a long integer parameter.
+        Raises exception if not found and lDefault is None, if not a valid long,
+        or if outside the range defined by lMin and lMax.
+        """
+        if lDefault is not None and sName not in self._dParams:
+            return lDefault;
+
+        sValue = self.getStringParam(sName, None, None if lDefault is None else str(lDefault));
+        try:
+            lValue = long(sValue);
+        except:
+            raise WuiException('%s parameter %s value "%s" cannot be convert to an integer'
+                               % (self._sAction, sName, sValue));
+
+        if   (lMin is not None and lValue < lMin) \
+          or (lMax is not None and lValue > lMax):
+            raise WuiException('%s parameter %s value %d is out of range [%s..%s]'
+                               % (self._sAction, sName, lValue, lMin, lMax));
+        return lValue;
+
+    def getTsParam(self, sName, tsDefault = None, fRequired = True):
+        """
+        Gets a timestamp parameter.
+        Raises exception if not found and fRequired is True.
+        """
+        if fRequired is False and sName not in self._dParams:
+            return tsDefault;
+
+        sValue = self.getStringParam(sName, None, None if tsDefault is None else str(tsDefault));
+        (sValue, sError) = ModelDataBase.validateTs(sValue);
+        if sError is not None:
+            raise WuiException('%s parameter %s value "%s": %s'
+                               % (self._sAction, sName, sValue, sError));
+        return sValue;
+
+    def getListOfIntParams(self, sName, iMin = None, iMax = None, aiDefaults = None):
+        """
+        Gets parameter list.
+        Raises exception if not found and aiDefaults is None, or if any of the
+        values are not valid integers or outside the range defined by iMin and iMax.
+        """
+        if sName in self._dParams:
+            if sName not in self._asCheckedParams:
+                self._asCheckedParams.append(sName);
+
+            if isinstance(self._dParams[sName], list):
+                asValues = self._dParams[sName];
+            else:
+                asValues = [self._dParams[sName],];
+            aiValues = [];
+            for sValue in asValues:
+                try:
+                    iValue = int(sValue);
+                except:
+                    raise WuiException('%s parameter %s value "%s" cannot be convert to an integer'
+                                       % (self._sAction, sName, sValue));
+
+                if   (iMin is not None and iValue < iMin) \
+                  or (iMax is not None and iValue > iMax):
+                    raise WuiException('%s parameter %s value %d is out of range [%s..%s]'
+                                       % (self._sAction, sName, iValue, iMin, iMax));
+                aiValues.append(iValue);
+        else:
+            aiValues = aiDefaults;
+
+        return aiValues;
+
+    def getListOfStrParams(self, sName, asDefaults = None):
+        """
+        Gets parameter list.
+        Raises exception if not found and asDefaults is None.
+        """
+        if sName in self._dParams:
+            if sName not in self._asCheckedParams:
+                self._asCheckedParams.append(sName);
+
+            if isinstance(self._dParams[sName], list):
+                asValues = [str(s).strip() for s in self._dParams[sName]];
+            else:
+                asValues = [str(self._dParams[sName]).strip(), ];
+        elif asDefaults is None:
+            raise WuiException('%s is missing parameters: "%s"' % (self._sAction, sName,));
+        else:
+            asValues = asDefaults;
+
+        return asValues;
+
+    def getListOfTestCasesParam(self, sName, asDefaults = None):  # too many local vars - pylint: disable=R0914
+        """Get list of test cases and their parameters"""
+        if sName in self._dParams:
+            if sName not in self._asCheckedParams:
+                self._asCheckedParams.append(sName)
+
+        aoListOfTestCases = []
+
+        aiSelectedTestCaseIds = self.getListOfIntParams('%s[asCheckedTestCases]' % sName, aiDefaults=[])
+        aiAllTestCases        = self.getListOfIntParams('%s[asAllTestCases]'     % sName, aiDefaults=[])
+
+        for idTestCase in aiAllTestCases:
+            aiCheckedTestCaseArgs = \
+                self.getListOfIntParams(
+                    '%s[%d][asCheckedTestCaseArgs]' % (sName, idTestCase),
+                    aiDefaults=[])
+
+            aiAllTestCaseArgs = \
+                self.getListOfIntParams(
+                    '%s[%d][asAllTestCaseArgs]' % (sName, idTestCase),
+                    aiDefaults=[])
+
+            oListEntryTestCaseArgs = []
+            for idTestCaseArgs in aiAllTestCaseArgs:
+                fArgsChecked   = True if idTestCaseArgs in aiCheckedTestCaseArgs else False
+
+                # Dry run
+                sPrefix = '%s[%d][%d]' % (sName, idTestCase, idTestCaseArgs,);
+                self.getIntParam(sPrefix + '[idTestCaseArgs]', iDefault = -1,)
+
+                sArgs        = self.getStringParam(sPrefix + '[sArgs]',        sDefault = '')
+                cSecTimeout  = self.getStringParam(sPrefix + '[cSecTimeout]',  sDefault = '')
+                cGangMembers = self.getStringParam(sPrefix + '[cGangMembers]', sDefault = '')
+                cGangMembers = self.getStringParam(sPrefix + '[cGangMembers]', sDefault = '')
+
+                oListEntryTestCaseArgs.append((fArgsChecked, idTestCaseArgs, sArgs, cSecTimeout, cGangMembers))
+
+            sTestCaseName = self.getStringParam('%s[%d][sName]' % (sName, idTestCase), sDefault='')
+
+            oListEntryTestCase = \
+                (idTestCase,
+                 True if idTestCase in aiSelectedTestCaseIds else False,
+                 sTestCaseName,
+                 oListEntryTestCaseArgs)
+
+            aoListOfTestCases.append(oListEntryTestCase)
+
+        if aoListOfTestCases == []:
+            if asDefaults is None:
+                raise WuiException('%s is missing parameters: "%s"' % (self._sAction, sName))
+            aoListOfTestCases = asDefaults
+
+        return aoListOfTestCases
+
+    def getEffectiveDateParam(self, sParamName=None):
+        """
+        Gets the effective date parameter.
+        Returns a timestamp suitable for database and url parameters.
+        Returns None if not found or empty.
+        """
+
+        sName = sParamName if sParamName is not None else WuiDispatcherBase.ksParamEffectiveDate
+
+        if sName not in self._dParams:
+            return None;
+
+        if sName not in self._asCheckedParams:
+            self._asCheckedParams.append(sName);
+
+        sValue = self._dParams[sName];
+        if isinstance(sValue, list):
+            raise WuiException('%s parameter "%s" is given multiple times: %s' % (self._sAction, sName, sValue));
+        sValue = sValue.strip();
+        if sValue == '':
+            return None;
+
+        #
+        # Timestamp, just validate it and return.
+        #
+        if sValue[0] not in ['-', '+']:
+            (sValue, sError) = ModelDataBase.validateTs(sValue);
+            if sError is not None:
+                raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError));
+            return sValue;
+
+        #
+        # Relative timestamp. Validate and convert it to a fixed timestamp.
+        #
+        chSign = sValue[0];
+        (sValue, sError) = ModelDataBase.validateTs(sValue[1:]);
+        if sError is not None:
+            raise WuiException('%s parameter "%s" ("%s") is invalid: %s' % (self._sAction, sName, sValue, sError));
+        if sValue[-6] in ['-', '+']:
+            raise WuiException('%s parameter "%s" ("%s") is a relative timestamp but incorrectly includes a time zone.'
+                               % (self._sAction, sName, sValue));
+        offTime = 11;
+        if sValue[offTime - 1] != ' ':
+            raise WuiException('%s parameter "%s" ("%s") incorrect format.' % (self._sAction, sName, sValue));
+        sInterval = 'P' + sValue[:(offTime - 1)] + 'T' + sValue[offTime:];
+
+        self._oDb.execute('SELECT CURRENT_TIMESTAMP ' + chSign + ' \'' + sInterval + '\'::INTERVAL');
+        oDate = self._oDb.fetchOne()[0];
+
+        return str(oDate);
+
+
+    def _checkForUnknownParameters(self):
+        """
+        Check if we've handled all parameters, raises exception if anything
+        unknown was found.
+        """
+
+        if len(self._asCheckedParams) != len(self._dParams):
+            sUnknownParams = '';
+            for sKey in self._dParams:
+                if sKey not in self._asCheckedParams:
+                    sUnknownParams += ' ' + sKey + '=' + str(self._dParams[sKey]);
+            raise WuiException('Unknown parameters: ' + sUnknownParams);
+
+        return True;
+
+    def _assertPostRequest(self):
+        """
+        Makes sure that the request we're dispatching is a POST request.
+        Raises an exception of not.
+        """
+        if self._oSrvGlue.getMethod() != 'POST':
+            raise WuiException('Expected "POST" request, got "%s"' % (self._oSrvGlue.getMethod(),))
+        return True;
+
+    #
+    # Client browser type.
+    #
+
+    ## @name Browser types.
+    ## @{
+    ksBrowserFamily_Unknown     = 0;
+    ksBrowserFamily_Gecko       = 1;
+    ksBrowserFamily_Webkit      = 2;
+    ksBrowserFamily_Trident     = 3;
+    ## @}
+
+    ## @name Browser types.
+    ## @{
+    ksBrowserType_FamilyMask    = 0xff;
+    ksBrowserType_Unknown       = 0;
+    ksBrowserType_Firefox       = (1 << 8) | ksBrowserFamily_Gecko;
+    ksBrowserType_Chrome        = (2 << 8) | ksBrowserFamily_Webkit;
+    ksBrowserType_Safari        = (3 << 8) | ksBrowserFamily_Webkit;
+    ksBrowserType_IE            = (4 << 8) | ksBrowserFamily_Trident;
+    ## @}
+
+    def getBrowserType(self):
+        """
+        Gets the browser type.
+        The browser family can be extracted from this using ksBrowserType_FamilyMask.
+        """
+        sAgent = self._oSrvGlue.getUserAgent();
+        if sAgent.find('AppleWebKit/') > 0:
+            if sAgent.find('Chrome/') > 0:
+                return self.ksBrowserType_Chrome;
+            if sAgent.find('Safari/') > 0:
+                return self.ksBrowserType_Safari;
+            return self.ksBrowserType_Unknown | self.ksBrowserFamily_Webkit;
+        if sAgent.find('Gecko/') > 0:
+            if sAgent.find('Firefox/') > 0:
+                return self.ksBrowserType_Firefox;
+            return self.ksBrowserType_Unknown | self.ksBrowserFamily_Gecko;
+        return self.ksBrowserType_Unknown | self.ksBrowserFamily_Unknown;
+
+    def isBrowserGecko(self, sMinVersion = None):
+        """ Returns true if it's a gecko based browser. """
+        if (self.getBrowserType() & self.ksBrowserType_FamilyMask) != self.ksBrowserFamily_Gecko:
+            return False;
+        if sMinVersion is not None:
+            sAgent = self._oSrvGlue.getUserAgent();
+            sVersion = sAgent[sAgent.find('Gecko/')+6:].split()[0];
+            if sVersion < sMinVersion:
+                return False;
+        return True;
+
+    #
+    # Debugging
+    #
+
+    def _debugProcessDispatch(self):
+        """
+        Processes any debugging parameters in the request and adds them to
+        _asCheckedParams so they won't cause trouble in the action handler.
+        """
+
+        self._fDbgSqlTrace   = self.getBoolParam(self.ksParamDbgSqlTrace, False);
+        self._fDbgSqlExplain = self.getBoolParam(self.ksParamDbgSqlExplain, False);
+
+        if self._fDbgSqlExplain:
+            self._oDb.debugEnableExplain();
+
+        return True;
+
+    def _debugRenderPanel(self):
+        """
+        Renders a simple form for controlling WUI debugging.
+
+        Returns the HTML for it.
+        """
+
+        sHtml  = '<div id="debug-panel">\n' \
+                 ' <form id="debug-panel-form" type="get" action="#">\n';
+
+        for sKey, oValue in self._dParams.iteritems():
+            if sKey not in self.kasDbgParams:
+                sHtml += '  <input type="hidden" name="%s" value="%s"/>\n' \
+                       % (webutils.escapeAttr(sKey), webutils.escapeAttrToStr(oValue),);
+
+        for aoCheckBox in (
+                [self.ksParamDbgSqlTrace, self._fDbgSqlTrace, 'SQL trace'],
+                [self.ksParamDbgSqlExplain, self._fDbgSqlExplain, 'SQL explain'], ):
+            sHtml += ' <input type="checkbox" name="%s" value="1"%s>%s</input>\n' \
+                % (aoCheckBox[0], ' checked' if aoCheckBox[1] else '', aoCheckBox[2]);
+
+        sHtml += '  <button type="submit">Apply</button>\n';
+        sHtml += ' </form>\n' \
+                 '</div>\n';
+        return sHtml;
+
+
+    def _debugGetParameters(self):
+        """
+        Gets a dictionary with the debug parameters.
+
+        For use when links are constructed from scratch instead of self._dParams.
+        """
+        return self._dDbgParams;
+
+    #
+    # Dispatching
+    #
+
+    def _actionDefault(self):
+        """The default action handler, always overridden. """
+        raise WuiException('The child class shall override WuiBase.actionDefault().')
+
+    def _actionGenericListing(self, oLogicType, oListContentType):
+        """
+        Generic listing action.
+
+        oLogicType implements fetchForListing.
+        oListContentType is a child of WuiListContentBase.
+        """
+        tsEffective     = self.getEffectiveDateParam();
+        cItemsPerPage   = self.getIntParam(self.ksParamItemsPerPage, iMin = 2, iMax =   9999, iDefault = 300);
+        iPage           = self.getIntParam(self.ksParamPageNo,       iMin = 0, iMax = 999999, iDefault = 0);
+        self._checkForUnknownParameters();
+
+        aoEntries  = oLogicType(self._oDb).fetchForListing(iPage * cItemsPerPage, cItemsPerPage + 1, tsEffective);
+        oContent   = oListContentType(aoEntries, iPage, cItemsPerPage, tsEffective,
+                                      fnDPrint = self._oSrvGlue.dprint, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oContent.show();
+        return True;
+
+    def _actionGenericFormAdd(self, oDataType, oFormType):
+        """
+        Generic add something form display request handler.
+
+        oDataType is a ModelDataBase child class.
+        oFormType is a WuiFormContentBase child class.
+        """
+        oData = oDataType().initFromParams(oDisp = self, fStrict = False);
+        self._checkForUnknownParameters();
+
+        oForm = oFormType(oData, oFormType.ksMode_Add, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oForm.showForm();
+        return True
+
+    def _actionGenericFormDetails(self, oDataType, oLogicType, oFormType, sIdAttr, sGenIdAttr = None): # pylint: disable=R0914
+        """
+        Generic handler for showing a details form/page.
+
+        oDataType is a ModelDataBase child class.
+        oLogicType may implement fetchForChangeLog.
+        oFormType is a WuiFormContentBase child class.
+        sIdParamName is the name of the ID parameter (not idGen!).
+        """
+        # Parameters.
+        idGenObject = -1;
+        if sGenIdAttr is not None:
+            idGenObject = self.getIntParam(getattr(oDataType, 'ksParam_' + sGenIdAttr), 0, 0x7ffffffe, -1);
+        if idGenObject != -1:
+            idObject = tsNow = None;
+        else:
+            idObject = self.getIntParam(getattr(oDataType, 'ksParam_' + sIdAttr), 0, 0x7ffffffe, -1);
+            tsNow    = self.getEffectiveDateParam();
+        fChangeLog               = self.getBoolParam(WuiDispatcherBase.ksParamChangeLogEnabled, True);
+        iChangeLogPageNo         = self.getIntParam(WuiDispatcherBase.ksParamChangeLogPageNo, 0, 9999, 0);
+        cChangeLogEntriesPerPage = self.getIntParam(WuiDispatcherBase.ksParamChangeLogEntriesPerPage, 2, 9999, 4);
+        self._checkForUnknownParameters();
+
+        # Fetch item and display it.
+        if idGenObject == -1:
+            oData = oDataType().initFromDbWithId(self._oDb, idObject, tsNow);
+        else:
+            oData = oDataType().initFromDbWithGenId(self._oDb, idGenObject);
+
+        oContent  = oFormType(oData, oFormType.ksMode_Show, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oContent.showForm();
+
+        # Add change log if supported.
+        if fChangeLog and hasattr(oLogicType, 'fetchForChangeLog'):
+            (aoEntries, fMore) = oLogicType(self._oDb).fetchForChangeLog(getattr(oData, sIdAttr),
+                                                                         iChangeLogPageNo * cChangeLogEntriesPerPage,
+                                                                         cChangeLogEntriesPerPage ,
+                                                                         tsNow);
+            self._sPageBody += oContent.showChangeLog(aoEntries, fMore, iChangeLogPageNo, cChangeLogEntriesPerPage, tsNow);
+        return True
+
+
+    def _actionGenericFormEdit(self, oDataType, oFormType, sIdParamName):
+        """
+        Generic edit something form display request handler.
+
+        oDataType is a ModelDataBase child class.
+        oFormType is a WuiFormContentBase child class.
+        sIdParamName is the name of the ID parameter (not idGen!).
+        """
+
+        idObject = self.getIntParam(sIdParamName, 0, 0x7ffffffe);
+        self._checkForUnknownParameters();
+        oData = oDataType().initFromDbWithId(self._oDb, idObject);
+
+        oContent = oFormType(oData, oFormType.ksMode_Edit, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oContent.showForm();
+        return True
+
+    def _actionGenericFormEditL(self, oCoreObjectLogic, sCoreObjectIdFieldName, oWuiObjectLogic):
+        """
+        Generic modify something form display request handler.
+
+        @param oCoreObjectLogic         A *Logic class
+
+        @param sCoreObjectIdFieldName   Name of HTTP POST variable that
+                                        contains object ID information
+
+        @param oWuiObjectLogic          Web interface renderer class
+        """
+
+        iCoreDataObjectId = self.getIntParam(sCoreObjectIdFieldName,  0, 0x7ffffffe, -1)
+        self._checkForUnknownParameters();
+
+        ## @todo r=bird: This will return a None object if the object wasn't found... Crash bang in the content generator
+        #                code (that's not logic code btw.).
+        oData = oCoreObjectLogic(self._oDb).getById(iCoreDataObjectId)
+
+        # Instantiate and render the MODIFY dialog form
+        oContent = oWuiObjectLogic(oData, oWuiObjectLogic.ksMode_Edit, oDisp=self)
+
+        (self._sPageTitle, self._sPageBody) = oContent.showForm()
+
+        return True
+
+    def _actionGenericFormClone(self, oDataType, oFormType, sIdAttr, sGenIdAttr = None):
+        """
+        Generic clone something form display request handler.
+
+        oDataType is a ModelDataBase child class.
+        oFormType is a WuiFormContentBase child class.
+        sIdParamName is the name of the ID parameter.
+        sGenIdParamName is the name of the generation ID parameter, None if not applicable.
+        """
+        # Parameters.
+        idGenObject = -1;
+        if sGenIdAttr is not None:
+            idGenObject = self.getIntParam(getattr(oDataType, 'ksParam_' + sGenIdAttr), 0, 0x7ffffffe, -1);
+        if idGenObject != -1:
+            idObject = tsNow = None;
+        else:
+            idObject = self.getIntParam(getattr(oDataType, 'ksParam_' + sIdAttr), 0, 0x7ffffffe, -1);
+            tsNow    = self.getEffectiveDateParam();
+        self._checkForUnknownParameters();
+
+        # Fetch data and clear identifying attributes not relevant to the clone.
+        if idGenObject != -1:
+            oData = oDataType().initFromDbWithGenId(self._oDb, idGenObject);
+        else:
+            oData = oDataType().initFromDbWithId(self._oDb, idObject, tsNow);
+
+        setattr(oData, sIdAttr, None);
+        if sGenIdAttr is not None:
+            setattr(oData, sGenIdAttr, None);
+        oData.tsEffective = None;
+        oData.tsExpire    = None;
+
+        # Display form.
+        oContent = oFormType(oData, oFormType.ksMode_Add, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oContent.showForm()
+        return True
+
+
+    def _actionGenericFormPost(self, sMode, fnLogicAction, oDataType, oFormType, sRedirectTo, fStrict=True):
+        """
+        Generic POST request handling from a WuiFormContentBase child.
+
+        oDataType is a ModelDataBase child class.
+        oFormType is a WuiFormContentBase child class.
+        fnLogicAction is a method taking a oDataType instance and uidAuthor as arguments.
+        """
+        #
+        # Read and validate parameters.
+        #
+        oData = oDataType().initFromParams(oDisp = self, fStrict = fStrict);
+        self._checkForUnknownParameters();
+        self._assertPostRequest();
+        dErrors = oData.validateAndConvert(self._oDb);
+        if len(dErrors) == 0:
+            oData.convertFromParamNull();
+
+            #
+            # Try do the job.
+            #
+            try:
+                fnLogicAction(oData, self._oCurUser.uid, fCommit = True);
+            except Exception as oXcpt:
+                self._oDb.rollback();
+                oForm = oFormType(oData, sMode, oDisp = self);
+                sErrorMsg = str(oXcpt) if not config.g_kfDebugDbXcpt else '\n'.join(utils.getXcptInfo(4));
+                (self._sPageTitle, self._sPageBody) = oForm.showForm(sErrorMsg = sErrorMsg);
+            else:
+                #
+                # Worked, redirect to the specified page.
+                #
+                self._sPageTitle  = None;
+                self._sPageBody   = None;
+                self._sRedirectTo = sRedirectTo;
+        else:
+            oForm = oFormType(oData, sMode, oDisp = self);
+            (self._sPageTitle, self._sPageBody) = oForm.showForm(dErrors = dErrors);
+        return True;
+
+    def _actionGenericFormAddPost(self, oDataType, oLogicType, oFormType, sRedirAction, fStrict=True):
+        """
+        Generic add entry POST request handling from a WuiFormContentBase child.
+
+        oDataType is a ModelDataBase child class.
+        oLogicType is a class that implements addEntry.
+        oFormType is a WuiFormContentBase child class.
+        sRedirAction is what action to redirect to on success.
+        """
+        oLogic = oLogicType(self._oDb);
+        from testmanager.webui.wuicontentbase import WuiFormContentBase;
+        return self._actionGenericFormPost(WuiFormContentBase.ksMode_Add, oLogic.addEntry, oDataType, oFormType,
+                                           '?' + webutils.encodeUrlParams({self.ksParamAction: sRedirAction}), fStrict=fStrict)
+    def _actionGenericFormEditPost(self, oDataType, oLogicType, oFormType, sRedirAction, fStrict = True):
+        """
+        Generic edit POST request handling from a WuiFormContentBase child.
+
+        oDataType is a ModelDataBase child class.
+        oLogicType is a class that implements addEntry.
+        oFormType is a WuiFormContentBase child class.
+        sRedirAction is what action to redirect to on success.
+        """
+        oLogic = oLogicType(self._oDb);
+        from testmanager.webui.wuicontentbase import WuiFormContentBase;
+        return self._actionGenericFormPost(WuiFormContentBase.ksMode_Edit, oLogic.editEntry, oDataType, oFormType,
+                                           '?' + webutils.encodeUrlParams({self.ksParamAction: sRedirAction}),
+                                           fStrict = fStrict);
+
+    def _unauthorizedUser(self):
+        """
+        Displays the unauthorized user message (corresponding record is not
+        present in DB).
+        """
+
+        sLoginName = self._oSrvGlue.getLoginName();
+
+        # Report to system log
+        oSystemLogLogic = SystemLogLogic(self._oDb);
+        oSystemLogLogic.addEntry(SystemLogData.ksEvent_UserAccountUnknown,
+                                 'Unknown user (%s) attempts to access from %s'
+                                 % (sLoginName, self._oSrvGlue.getClientAddr()),
+                                 24, fCommit = True)
+
+        # Display message.
+        self._sPageTitle = 'User not authorized'
+        self._sPageBody = """
+            <p>Access denied for user <b>%s</b>.
+            Please contact an admin user to set up your access.</p>
+            """ % (sLoginName,)
+        return True;
+
+    def dispatchRequest(self):
+        """
+        Dispatches a request.
+        """
+
+        #
+        # Get the parameters and checks for duplicates.
+        #
+        try:
+            dParams = self._oSrvGlue.getParameters();
+        except Exception as oXcpt:
+            raise WuiException('Error retriving parameters: %s' % (oXcpt,));
+
+        for sKey in dParams.keys():
+
+            # Take care about strings which may contain unicode characters: convert percent-encoded symbols back to unicode.
+            for idxItem, _ in enumerate(dParams[sKey]):
+                dParams[sKey][idxItem] = dParams[sKey][idxItem].decode('utf-8')
+
+            if not len(dParams[sKey]) > 1:
+                dParams[sKey] = dParams[sKey][0];
+        self._dParams = dParams;
+
+        #
+        # Figure out the requested action and validate it.
+        #
+        if self.ksParamAction in self._dParams:
+            self._sAction = self._dParams[self.ksParamAction];
+            self._asCheckedParams.append(self.ksParamAction);
+        else:
+            self._sAction = self.ksActionDefault;
+
+        if self._sAction not in self._dDispatch:
+            raise WuiException('Unknown action "%s" requested' % (self._sAction,));
+
+        #
+        # Call action handler and generate the page (if necessary).
+        #
+        if self._oCurUser is not None:
+            self._debugProcessDispatch();
+            if self._dDispatch[self._sAction]() is self.ksDispatchRcAllDone:
+                return True;
+        else:
+            self._unauthorizedUser();
+
+        if self._sRedirectTo is None:
+            self._generatePage();
+        else:
+            self._redirectPage();
+        return True;
+
+
+    def dprint(self, sText):
+        """ Debug printing. """
+        if config.g_kfWebUiDebug and True:
+            self._oSrvGlue.dprint(sText);
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py b/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py
new file mode 100644
index 0000000..b387c70
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py
@@ -0,0 +1,857 @@
+# -*- coding: utf-8 -*-
+# $Id: wuicontentbase.py $
+
+"""
+Test Manager Web-UI - Content Base Classes.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard python imports.
+import copy;
+
+# Validation Kit imports.
+from common                         import webutils;
+from testmanager                    import config;
+from testmanager.webui.wuibase      import WuiDispatcherBase, WuiException
+from testmanager.webui.wuihlpform   import WuiHlpForm;
+from testmanager.core               import db;
+
+
+class WuiHtmlBase(object): # pylint: disable=R0903
+    """
+    Base class for HTML objects.
+    """
+
+    def __init__(self):
+        """Dummy init to shut up pylint."""
+        pass;
+
+    def toHtml(self):
+        """
+        Must be overridden by sub-classes.
+        """
+        assert False;
+        return '';
+
+    def __str__(self):
+        """ String representation is HTML, simplifying formatting and such. """
+        return self.toHtml();
+
+
+class WuiLinkBase(WuiHtmlBase): # pylint: disable=R0903
+    """
+    For passing links from WuiListContentBase._formatListEntry.
+    """
+
+    def __init__(self, sName, sUrlBase, dParams = None, sConfirm = None, sTitle = None,
+                 sFragmentId = None, fBracketed = True, sExtraAttrs = ''):
+        WuiHtmlBase.__init__(self);
+        self.sName          = sName
+        self.sUrl           = sUrlBase
+        self.sConfirm       = sConfirm;
+        self.sTitle         = sTitle;
+        self.fBracketed     = fBracketed;
+        self.sExtraAttrs    = sExtraAttrs;
+
+        if dParams is not None and len(dParams) > 0:
+            # Do some massaging of None arguments.
+            dParams = dict(dParams);
+            for sKey in dParams:
+                if dParams[sKey] is None:
+                    dParams[sKey] = '';
+            self.sUrl += '?' + webutils.encodeUrlParams(dParams)
+
+        if sFragmentId is not None:
+            self.sUrl += '#' + sFragmentId;
+
+    def setBracketed(self, fBracketed):
+        """Changes the bracketing style."""
+        self.fBracketed = fBracketed;
+        return True;
+
+    def toHtml(self):
+        """
+        Returns a simple HTML anchor element.
+        """
+        sExtraAttrs = self.sExtraAttrs;
+        if self.sConfirm is not None:
+            sExtraAttrs += 'onclick=\'return confirm("%s");\' ' % (webutils.escapeAttr(self.sConfirm),);
+        if self.sTitle is not None:
+            sExtraAttrs += 'title="%s" ' % (webutils.escapeAttr(self.sTitle),);
+        if len(sExtraAttrs) > 0 and sExtraAttrs[-1] != ' ':
+            sExtraAttrs += ' ';
+
+        sFmt = '[<a %shref="%s">%s</a>]';
+        if not self.fBracketed:
+            sFmt = '<a %shref="%s">%s</a>';
+        return sFmt % (sExtraAttrs, webutils.escapeAttr(self.sUrl), webutils.escapeElem(self.sName));
+
+class WuiTmLink(WuiLinkBase): # pylint: disable=R0903
+    """ Local link to the test manager. """
+
+    kdDbgParams = None;
+
+    def __init__(self, sName, sUrlBase, dParams = None, sConfirm = None, sTitle = None,
+                 sFragmentId = None, fBracketed = True):
+
+        # Add debug parameters if necessary.
+        if self.kdDbgParams is not None and len(self.kdDbgParams) > 0:
+            if dParams is None or len(dParams) == 0:
+                dParams = dict(self.kdDbgParams);
+            else:
+                dParams = dict(dParams);
+                for sKey in self.kdDbgParams:
+                    if sKey not in dParams:
+                        dParams[sKey] = self.kdDbgParams[sKey];
+
+        WuiLinkBase.__init__(self, sName, sUrlBase, dParams, sConfirm, sTitle, sFragmentId, fBracketed);
+
+
+class WuiSvnLink(WuiLinkBase): # pylint: disable=R0903
+    """
+    For linking to a SVN revision.
+    """
+    def __init__(self, iRevision, sName = None, fBracketed = True, sExtraAttrs = ''):
+        if sName is None:
+            sName = 'r%s' % (iRevision,);
+        WuiLinkBase.__init__(self, sName, config.g_ksTracLogUrlPrefix, { 'rev': iRevision,},
+                             fBracketed = fBracketed, sExtraAttrs = sExtraAttrs);
+
+class WuiSvnLinkWithTooltip(WuiSvnLink): # pylint: disable=R0903
+    """
+    For linking to a SVN revision with changelog tooltip.
+    """
+    def __init__(self, iRevision, sRepository, sName = None, fBracketed = True):
+        sExtraAttrs = ' onmouseover="return svnHistoryTooltipShow(event,\'%s\',%s);" onmouseout="return tooltipHide();"' \
+                    % ( sRepository, iRevision, );
+        WuiSvnLink.__init__(self, iRevision, sName = sName, fBracketed = fBracketed, sExtraAttrs = sExtraAttrs);
+
+class WuiBuildLogLink(WuiLinkBase):
+    """
+    For linking to a build log.
+    """
+    def __init__(self, sUrl, sName = None, fBracketed = True):
+        assert sUrl is not None; assert len(sUrl) > 0;
+        if sName is None:
+            sName = 'Build log';
+        if not webutils.hasSchema(sUrl):
+            WuiLinkBase.__init__(self, sName, config.g_ksBuildLogUrlPrefix + sUrl, fBracketed = fBracketed);
+        else:
+            WuiLinkBase.__init__(self, sName, sUrl, fBracketed = fBracketed);
+
+class WuiRawHtml(WuiHtmlBase): # pylint: disable=R0903
+    """
+    For passing raw html from WuiListContentBase._formatListEntry.
+    """
+    def __init__(self, sHtml):
+        self.sHtml = sHtml;
+        WuiHtmlBase.__init__(self);
+
+    def toHtml(self):
+        return self.sHtml;
+
+class WuiSpanText(WuiRawHtml): # pylint: disable=R0903
+    """
+    Outputs the given text within a span of the given CSS class.
+    """
+    def __init__(self, sSpanClass, sText):
+        WuiRawHtml.__init__(self,
+                            u'<span class="%s">%s</span>'
+                            % (webutils.escapeAttr(sSpanClass), webutils.escapeElem(sText),));
+
+
+class WuiContentBase(object): # pylint: disable=R0903
+    """
+    Base for the content classes.
+    """
+
+    ## The text/symbol for a very short edit link.
+    ksShortEditLink    = u'\u270D'
+    ## The text/symbol for a very short details link.
+    ksShortDetailsLink = u'\u2318'
+
+
+    def __init__(self, fnDPrint = None, oDisp = None):
+        self._oDisp    = oDisp;         # WuiDispatcherBase.
+        self._fnDPrint = fnDPrint;
+        if fnDPrint is None  and  oDisp is not None:
+            self._fnDPrint = oDisp.dprint;
+
+    def dprint(self, sText):
+        """ Debug printing. """
+        if self._fnDPrint:
+            self._fnDPrint(sText);
+
+    def formatTsShort(self, oTs):
+        """
+        Formats a timestamp (db rep) into a short form.
+        """
+        oTsZulu = db.dbTimestampToZuluDatetime(oTs);
+        sTs = oTsZulu.strftime('%Y-%m-%d %H:%M:%SZ');
+        return unicode(sTs).replace('-', u'\u2011').replace(' ', u'\u00a0');
+
+    @staticmethod
+    def genericPageWalker(iCurItem, cItems, sHrefFmt, cWidth = 11, iBase = 1, sItemName = 'page'):
+        """
+        Generic page walker generator.
+
+        sHrefFmt has three %s sequences:
+            1. The first is the page number link parameter (0-based).
+            2. The title text, iBase-based number or text.
+            3. The link text, iBase-based number or text.
+        """
+
+        # Calc display range.
+        iStart = 0 if iCurItem - cWidth / 2 <= cWidth / 4 else iCurItem - cWidth / 2;
+        iEnd   = iStart + cWidth;
+        if iEnd > cItems:
+            iEnd = cItems;
+            if cItems > cWidth:
+                iStart = cItems - cWidth;
+
+        sHtml = u'';
+
+        # Previous page (using << >> because « and &raquo are too tiny).
+        if iCurItem > 0:
+            sHtml += '%s  ' % sHrefFmt % (iCurItem - 1, 'previous ' + sItemName, '<<');
+        else:
+            sHtml += '<<  ';
+
+        # 1 2 3 4...
+        if iStart > 0:
+            sHtml += '%s  ...  \n' % (sHrefFmt % (0, 'first %s' % (sItemName,), 0 + iBase),);
+
+        sHtml += ' \n'.join(sHrefFmt % (i, '%s %d' % (sItemName, i + iBase), i + iBase) if i != iCurItem
+                                 else unicode(i + iBase)
+                                 for i in range(iStart, iEnd));
+        if iEnd < cItems:
+            sHtml += '  ...  %s\n' % (sHrefFmt % (cItems - 1, 'last %s' % (sItemName,), cItems - 1 + iBase));
+
+        # Next page.
+        if iCurItem + 1 < cItems:
+            sHtml += '  %s' % sHrefFmt % (iCurItem + 1, 'next ' + sItemName, '>>');
+        else:
+            sHtml += '  >>';
+
+        return sHtml;
+
+class WuiSingleContentBase(WuiContentBase): # pylint: disable=R0903
+    """
+    Base for the content classes working on a single data object (oData).
+    """
+    def __init__(self, oData, oDisp = None, fnDPrint = None):
+        WuiContentBase.__init__(self, oDisp = oDisp, fnDPrint = fnDPrint);
+        self._oData = oData;            # Usually ModelDataBase.
+
+
+class WuiFormContentBase(WuiSingleContentBase): # pylint: disable=R0903
+    """
+    Base class for simple input form content classes (single data object).
+    """
+
+    ## @name Form mode.
+    ## @{
+    ksMode_Add  = 'add';
+    ksMode_Edit = 'edit';
+    ksMode_Show = 'show';
+    ## @}
+
+    ## Default action mappings.
+    kdSubmitActionMappings = {
+        ksMode_Add:  'AddPost',
+        ksMode_Edit: 'EditPost',
+    };
+
+    def __init__(self, oData, sMode, sCoreName, oDisp, sTitle, sId = None, fEditable = True, sSubmitAction = None):
+        WuiSingleContentBase.__init__(self, copy.copy(oData), oDisp);
+        assert sMode in [self.ksMode_Add, self.ksMode_Edit, self.ksMode_Show];
+        assert len(sTitle) > 1;
+        assert sId is None or len(sId) > 0;
+
+        self._sMode         = sMode;
+        self._sCoreName     = sCoreName;
+        self._sActionBase   = 'ksAction' + sCoreName;
+        self._sTitle        = sTitle;
+        self._sId           = sId if sId is not None else (type(oData).__name__.lower() + 'form');
+        self._fEditable     = fEditable;
+        self._sSubmitAction = sSubmitAction;
+        if sSubmitAction is None and sMode != self.ksMode_Show:
+            self._sSubmitAction = getattr(oDisp, self._sActionBase + self.kdSubmitActionMappings[sMode]);
+
+
+    def _populateForm(self, oForm, oData):
+        """
+        Populates the form.  oData has parameter NULL values.
+        This must be reimplemented by the child.
+        """
+        _ = oForm; _ = oData;
+        raise Exception('Reimplement me!');
+
+    def _calcChangeLogEntryLinks(self, aoEntries, iEntry):
+        """
+        Returns an array of links to go with the change log entry.
+        """
+        _ = aoEntries; _ = iEntry;
+        ## @todo detect deletion and recreation.
+        ## @todo view details link.
+        ## @todo restore link (need new action)
+        ## @todo clone link.
+        return [];
+
+    def _guessChangeLogEntryDescription(self, aoEntries, iEntry):
+        """
+        Guesses the action + author that caused the change log entry.
+        Returns descriptive string.
+        """
+        oEntry = aoEntries[iEntry];
+
+        # Figure the author of the change.
+        if oEntry.sAuthor is not None:
+            sAuthor = '%s (#%s)' % (oEntry.sAuthor, oEntry.uidAuthor,);
+        elif oEntry.uidAuthor is not None:
+            sAuthor = '#%d (??)' % (oEntry.uidAuthor,);
+        else:
+            sAuthor = None;
+
+        # Figure the action.
+        if oEntry.oOldRaw is None:
+            if sAuthor is None:
+                return 'Created by batch job.';
+            return 'Created by %s.' % (sAuthor,);
+
+        if sAuthor is None:
+            return 'Automatically updated.'
+        return 'Modified by %s.' % (sAuthor,);
+
+    def _formatChangeLogEntry(self, aoEntries, iEntry):
+        """
+        Formats one change log entry into one or more HTML table rows.
+
+        Note! The parameters are given as array + index in case someone wishes
+              to access adjacent entries later in order to generate better
+              change descriptions.
+        """
+        oEntry = aoEntries[iEntry];
+
+        # The primary row.
+        sRowClass = 'tmodd' if (iEntry + 1) & 1 else 'tmeven';
+        sContent = '    <tr class="%s">\n' \
+                   '      <td rowspan="%d">%s</td>\n' \
+                   '      <td rowspan="%d">%s</td>\n' \
+                   '      <td colspan="3">%s%s</td>\n' \
+                   '    </tr>\n' \
+                 % ( sRowClass,
+                     len(oEntry.aoChanges) + 1, webutils.escapeElem(self.formatTsShort(oEntry.tsEffective)),
+                     len(oEntry.aoChanges) + 1, webutils.escapeElem(self.formatTsShort(oEntry.tsExpire)),
+                     self._guessChangeLogEntryDescription(aoEntries, iEntry),
+                     ' '.join(oLink.toHtml() for oLink in self._calcChangeLogEntryLinks(aoEntries, iEntry)),);
+
+        # Additional rows for each changed attribute.
+        j = 0;
+        for oChange in oEntry.aoChanges:
+            sContent += '        <tr class="%s%s"><td>%s</td><td>%s</td><td>%s</td></tr>\n' \
+                      % ( sRowClass, 'odd' if j & 1 else 'even',
+                          webutils.escapeElem(oChange.sAttr),
+                          webutils.escapeElem(oChange.sOldText),
+                          webutils.escapeElem(oChange.sNewText), );
+            j += 1;
+
+        return sContent;
+
+    def _showChangeLogNavi(self, fMoreEntries, iPageNo, cEntriesPerPage, tsNow, sWhere):
+        """
+        Returns the HTML for the change log navigator.
+        Note! See also _generateNavigation.
+        """
+        sNavigation  = '<div class="tmlistnav-%s">\n' % sWhere;
+        sNavigation += '  <table class="tmlistnavtab">\n' \
+                       '    <tr>\n';
+        dParams = self._oDisp.getParameters();
+        dParams[WuiDispatcherBase.ksParamChangeLogEntriesPerPage] = cEntriesPerPage;
+        dParams[WuiDispatcherBase.ksParamChangeLogPageNo]         = iPageNo;
+        if tsNow is not None:
+            dParams[WuiDispatcherBase.ksParamEffectiveDate]       = tsNow;
+
+        # Prev and combo box in one cell. Both inside the form for formatting reasons.
+        sNavigation += '    <td align="left">\n' \
+                       '    <form name="ChangeLogEntriesPerPageForm" method="GET">\n'
+
+        # Prev
+        if iPageNo > 0:
+            dParams[WuiDispatcherBase.ksParamChangeLogPageNo] = iPageNo - 1;
+            sNavigation += '<a href="?%s#tmchangelog">Previous</a>\n' \
+                         % (webutils.encodeUrlParams(dParams),);
+            dParams[WuiDispatcherBase.ksParamChangeLogPageNo] = iPageNo;
+        else:
+            sNavigation += 'Previous\n';
+
+        # Entries per page selector.
+        del dParams[WuiDispatcherBase.ksParamChangeLogEntriesPerPage];
+        sNavigation += '   \n' \
+                       '  <select name="%s" onchange="window.location=\'?%s&%s=\' + ' \
+                       'this.options[this.selectedIndex].value + \'#tmchangelog\';" ' \
+                       'title="Max change log entries per page">\n' \
+                     % (WuiDispatcherBase.ksParamChangeLogEntriesPerPage,
+                        webutils.encodeUrlParams(dParams),
+                        WuiDispatcherBase.ksParamChangeLogEntriesPerPage);
+        dParams[WuiDispatcherBase.ksParamChangeLogEntriesPerPage] = cEntriesPerPage;
+
+        for iEntriesPerPage in [2, 4, 8, 16, 32, 64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 8192]:
+            sNavigation += '        <option value="%d" %s>%d entries per page</option>\n' \
+                         % ( iEntriesPerPage,
+                             'selected="selected"' if iEntriesPerPage == cEntriesPerPage else '',
+                             iEntriesPerPage );
+        sNavigation += '      </select>\n';
+
+        # End of cell (and form).
+        sNavigation += '    </form>\n' \
+                       '   </td>\n';
+
+        # Next
+        if fMoreEntries:
+            dParams[WuiDispatcherBase.ksParamChangeLogPageNo] = iPageNo + 1;
+            sNavigation += '    <td align="right"><a href="?%s#tmchangelog">Next</a></td>\n' \
+                         % (webutils.encodeUrlParams(dParams),);
+        else:
+            sNavigation += '      <td align="right">Next</td>\n';
+
+        sNavigation += '    </tr>\n' \
+                       '  </table>\n' \
+                       '</div>\n';
+        return sNavigation;
+
+    def showChangeLog(self, aoEntries, fMoreEntries, iPageNo, cEntriesPerPage, tsNow, fShowNavigation = True):
+        """
+        Render the change log, returning raw HTML.
+        aoEntries is an array of ChangeLogEntry.
+        """
+        sContent  = '\n' \
+                    '<hr>\n' \
+                    '<div id="tmchangelog">\n' \
+                    '  <h3>Change Log </h3>\n';
+        if fShowNavigation:
+            sContent += self._showChangeLogNavi(fMoreEntries, iPageNo, cEntriesPerPage, tsNow, 'top');
+        sContent += '  <table class="tmtable tmchangelog">\n' \
+                    '    <thead class="tmheader">' \
+                    '      <tr>' \
+                    '        <th rowspan="2">When</th>\n' \
+                    '        <th rowspan="2">Expire (excl)</th>\n' \
+                    '        <th colspan="3">Changes</th>\n' \
+                    '      </tr>\n' \
+                    '      <tr>\n' \
+                    '        <th>Attribute</th>\n' \
+                    '        <th>Old value</th>\n' \
+                    '        <th>New value</th>\n' \
+                    '      </tr>\n' \
+                    '    </thead>\n' \
+                    '    <tbody>\n';
+
+        for iEntry in range(len(aoEntries)):
+            sContent += self._formatChangeLogEntry(aoEntries, iEntry);
+
+        sContent += '    <tbody>\n' \
+                    '  </table>\n';
+        if fShowNavigation and len(aoEntries) >= 8:
+            sContent += self._showChangeLogNavi(fMoreEntries, iPageNo, cEntriesPerPage, tsNow, 'bottom');
+        sContent += '</div>\n\n';
+        return sContent;
+
+    def showForm(self, dErrors = None, sErrorMsg = None):
+        """
+        Render the form.
+        """
+        oForm = WuiHlpForm(self._sId,
+                           '?' + webutils.encodeUrlParams({WuiDispatcherBase.ksParamAction: self._sSubmitAction}),
+                           dErrors if dErrors is not None else dict(),
+                           fReadOnly = self._sMode == self.ksMode_Show);
+
+        self._oData.convertToParamNull();
+
+        # If form cannot be constructed due to some reason we
+        # need to show this reason
+        try:
+            self._populateForm(oForm, self._oData);
+        except WuiException, oXcpt:
+            sContent = unicode(oXcpt)
+        else:
+            sContent = oForm.finalize();
+
+        # Add action to the top.
+        aoActions = [];
+        if self._sMode == self.ksMode_Show and self._fEditable:
+            # Remove _idGen and effective date since we're always editing the current data,
+            # and make sure the primary ID is present.
+            dParams = self._oDisp.getParameters();
+            if hasattr(self._oData, 'ksIdGenAttr'):
+                sIdGenParam = getattr(self._oData, 'ksParam_' + self._oData.ksIdGenAttr);
+                if sIdGenParam in dParams:
+                    del dParams[sIdGenParam];
+            if WuiDispatcherBase.ksParamEffectiveDate in dParams:
+                del dParams[WuiDispatcherBase.ksParamEffectiveDate];
+            dParams[getattr(self._oData, 'ksParam_' + self._oData.ksIdAttr)] = getattr(self._oData, self._oData.ksIdAttr);
+
+            dParams[WuiDispatcherBase.ksParamAction] = getattr(self._oDisp, self._sActionBase + 'Edit');
+            aoActions.append(WuiTmLink('Edit', '', dParams));
+
+            # Add clone operation if available. This uses the same data selection as for showing details.
+            if hasattr(self._oDisp, self._sActionBase + 'Clone'):
+                dParams = self._oDisp.getParameters();
+                dParams[WuiDispatcherBase.ksParamAction] = getattr(self._oDisp, self._sActionBase + 'Clone');
+                aoActions.append(WuiTmLink('Clone', '', dParams));
+
+        elif self._sMode == self.ksMode_Edit:
+            # Details views the details at a given time, so we need either idGen or an effecive date + regular id.
+            dParams = {};
+            if hasattr(self._oData, 'ksIdGenAttr'):
+                sIdGenParam = getattr(self._oData, 'ksParam_' + self._oData.ksIdGenAttr);
+                dParams[sIdGenParam] = getattr(self._oData, self._oData.ksIdGenAttr);
+            elif hasattr(self._oData, 'tsEffective'):
+                dParams[WuiDispatcherBase.ksParamEffectiveDate] = self._oData.tsEffective;
+                dParams[getattr(self._oData, 'ksParam_' + self._oData.ksIdAttr)] = getattr(self._oData, self._oData.ksIdAttr);
+            dParams[WuiDispatcherBase.ksParamAction] = getattr(self._oDisp, self._sActionBase + 'Edit');
+            aoActions.append(WuiTmLink('Details', '', dParams));
+
+        if len(aoActions) > 0:
+            sActionLinks = '<p>%s</p>' % (' '.join(unicode(oLink) for oLink in aoActions));
+            sContent = sActionLinks + sContent;
+
+        # Add error info to the top.
+        if sErrorMsg is not None:
+            sContent = '<p class="tmerrormsg">' + webutils.escapeElem(sErrorMsg) + '</p>\n' + sContent;
+
+        return (self._sTitle, sContent);
+
+    def getListOfItems(self, asListItems = tuple(), asSelectedItems = tuple()):
+        """
+        Format generic list which should be used by HTML form
+        """
+        aoRet = []
+        for sListItem in asListItems:
+            fEnabled = True if sListItem in asSelectedItems else False
+            aoRet.append((sListItem, fEnabled, sListItem))
+        return aoRet
+
+
+class WuiListContentBase(WuiContentBase):
+    """
+    Base for the list content classes.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffectiveDate, sTitle, sId = None, fnDPrint = None, oDisp = None):
+        WuiContentBase.__init__(self, fnDPrint = fnDPrint, oDisp = oDisp);
+        self._aoEntries         = aoEntries; ## @todo should replace this with a Logic object and define methods for querying.
+        self._iPage             = iPage;
+        self._cItemsPerPage     = cItemsPerPage;
+        self._tsEffectiveDate   = tsEffectiveDate;
+        self._sTitle            = sTitle;       assert len(sTitle) > 1;
+        if sId is None:
+            sId                 = sTitle.strip().replace(' ', '').lower();
+        assert len(sId.strip()) > 0;
+        self._sId               = sId;
+        self._asColumnHeaders   = [];
+        self._asColumnAttribs   = [];
+
+    def _formatListEntry(self, iEntry):
+        """
+        Formats the specified list entry as a list of column values.
+        Returns HTML for a table row.
+
+        The child class really need to override this!
+        """
+        # ASSUMES ModelDataBase children.
+        asRet = [];
+        for sAttr in self._aoEntries[0].getDataAttributes():
+            asRet.append(getattr(self._aoEntries[iEntry], sAttr));
+        return asRet;
+
+    def _formatListEntryHtml(self, iEntry):
+        """
+        Formats the specified list entry as HTML.
+        Returns HTML for a table row.
+
+        The child class can override this to
+        """
+        if (iEntry + 1) & 1:
+            sRow = u'  <tr class="tmodd">\n';
+        else:
+            sRow = u'  <tr class="tmeven">\n';
+
+        aoValues = self._formatListEntry(iEntry);
+        assert len(aoValues) == len(self._asColumnHeaders), '%s vs %s' % (len(aoValues), len(self._asColumnHeaders));
+
+        for i in range(len(aoValues)):
+            if i < len(self._asColumnAttribs) and len(self._asColumnAttribs[i]) > 0:
+                sRow += u'    <td ' + self._asColumnAttribs[i] + '>';
+            else:
+                sRow += u'    <td>';
+
+            if isinstance(aoValues[i], WuiHtmlBase):
+                sRow += aoValues[i].toHtml();
+            elif isinstance(aoValues[i], list):
+                if len(aoValues[i]) > 0:
+                    for oElement in aoValues[i]:
+                        if isinstance(oElement, WuiHtmlBase):
+                            sRow += oElement.toHtml();
+                        elif db.isDbTimestamp(oElement):
+                            sRow += webutils.escapeElem(self.formatTsShort(oElement));
+                        else:
+                            sRow += webutils.escapeElem(unicode(oElement));
+                        sRow += ' ';
+            elif db.isDbTimestamp(aoValues[i]):
+                sRow += webutils.escapeElem(self.formatTsShort(aoValues[i]));
+            elif aoValues[i] is not None:
+                sRow += webutils.escapeElem(unicode(aoValues[i]));
+
+            sRow += u'</td>\n';
+
+        return sRow + u'  </tr>\n';
+
+    def _generateTimeNavigation(self, sWhere):
+        """
+        Returns HTML for time navigation.
+
+        Note! Views without a need for a timescale just stubs this method.
+        """
+        _ = sWhere;
+        sNavigation = '';
+
+        dParams = self._oDisp.getParameters();
+        dParams[WuiDispatcherBase.ksParamItemsPerPage] = self._cItemsPerPage;
+        dParams[WuiDispatcherBase.ksParamPageNo]       = self._iPage;
+
+        if WuiDispatcherBase.ksParamEffectiveDate in dParams:
+            del dParams[WuiDispatcherBase.ksParamEffectiveDate];
+        sNavigation += ' [<a href="?%s">Now</a>]' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-00 01:00:00.00';
+        sNavigation += ' [<a href="?%s">1</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-00 02:00:00.00';
+        sNavigation += ', <a href="?%s">2</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-00 06:00:00.00';
+        sNavigation += ', <a href="?%s">6</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-00 12:00:00.00';
+        sNavigation += ', <a href="?%s">12</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-01 00:00:00.00';
+        sNavigation += ', or <a href="?%s">24</a> hours ago]' % (webutils.encodeUrlParams(dParams),);
+
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-02 00:00:00.00';
+        sNavigation += ' [<a href="?%s">2</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-03 00:00:00.00';
+        sNavigation += ', <a href="?%s">3</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-05 00:00:00.00';
+        sNavigation += ', <a href="?%s">5</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-07 00:00:00.00';
+        sNavigation += ', <a href="?%s">7</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-14 00:00:00.00';
+        sNavigation += ', <a href="?%s">14</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-21 00:00:00.00';
+        sNavigation += ', <a href="?%s">21</a>' % (webutils.encodeUrlParams(dParams),);
+
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = '-0000-00-28 00:00:00.00';
+        sNavigation += ', or <a href="?%s">28</a> days ago]' % (webutils.encodeUrlParams(dParams),);
+
+        return sNavigation;
+
+
+    def _generateNavigation(self, sWhere):
+        """
+        Return HTML for navigation.
+        """
+
+        #
+        # ASSUMES the dispatcher/controller code fetches one entry more than
+        # needed to fill the page to indicate further records.
+        #
+        sNavigation  = '<div class="tmlistnav-%s">\n' % sWhere;
+        sNavigation += '  <table class="tmlistnavtab">\n' \
+                       '    <tr>\n';
+        dParams = self._oDisp.getParameters();
+        dParams[WuiDispatcherBase.ksParamItemsPerPage] = self._cItemsPerPage;
+        dParams[WuiDispatcherBase.ksParamPageNo]       = self._iPage;
+        if self._tsEffectiveDate is not None:
+            dParams[WuiDispatcherBase.ksParamEffectiveDate] = self._tsEffectiveDate;
+
+        # Prev
+        if self._iPage > 0:
+            dParams[WuiDispatcherBase.ksParamPageNo] = self._iPage - 1;
+            sNavigation += '    <td align="left"><a href="?%s">Previous</a></td>\n' % (webutils.encodeUrlParams(dParams),);
+        else:
+            sNavigation += '      <td></td>\n';
+
+        # Time scale.
+        sNavigation += '<td align="center" class="tmtimenav">';
+        sNavigation += self._generateTimeNavigation(sWhere);
+        sNavigation += '</td>';
+
+        # Next
+        if len(self._aoEntries) > self._cItemsPerPage:
+            dParams[WuiDispatcherBase.ksParamPageNo] = self._iPage + 1;
+            sNavigation += '    <td align="right"><a href="?%s">Next</a></td>\n' % (webutils.encodeUrlParams(dParams),);
+        else:
+            sNavigation += '      <td></td>\n';
+
+        sNavigation += '    </tr>\n' \
+                       '  </table>\n' \
+                       '</div>\n';
+        return sNavigation;
+
+    def _generateTable(self):
+        """
+        show worker that just generates the table.
+        """
+
+        #
+        # Create a table.
+        # If no colum headers are provided, fall back on database field
+        # names, ASSUMING that the entries are ModelDataBase children.
+        # Note! the cellspacing is for IE8.
+        #
+        sPageBody = '<table class="tmtable" id="' + self._sId + '" cellspacing="0">\n';
+
+        if len(self._asColumnHeaders) == 0:
+            self._asColumnHeaders = self._aoEntries[0].getDataAttributes();
+
+        sPageBody += '  <thead class="tmheader"><tr>';
+        for oHeader in self._asColumnHeaders:
+            if isinstance(oHeader, WuiHtmlBase):
+                sPageBody += '<th>' + oHeader.toHtml() + '</th>';
+            else:
+                sPageBody += '<th>' + webutils.escapeElem(oHeader) + '</th>';
+        sPageBody += '</tr><thead>\n';
+
+        #
+        # Format the body and close the table.
+        #
+        sPageBody += '  <tbody>\n';
+        for iEntry in range(min(len(self._aoEntries), self._cItemsPerPage)):
+            sPageBody += self._formatListEntryHtml(iEntry);
+        sPageBody += '  </tbody>\n' \
+                     '</table>\n';
+        return sPageBody;
+
+    def _composeTitle(self):
+        """Composes the title string (return value)."""
+        sTitle = self._sTitle;
+        if self._iPage != 0:
+            sTitle += ' (page ' + unicode(self._iPage + 1) + ')'
+        if self._tsEffectiveDate is not None:
+            sTitle += ' as per ' + unicode(self._tsEffectiveDate); ## @todo shorten this.
+        return sTitle;
+
+
+    def show(self, fShowNavigation = True):
+        """
+        Displays the list.
+        Returns (Title, HTML) on success, raises exception on error.
+        """
+
+        sPageBody = ''
+        if fShowNavigation:
+            sPageBody += self._generateNavigation('top');
+
+        if len(self._aoEntries):
+            sPageBody += self._generateTable();
+            if fShowNavigation:
+                sPageBody += self._generateNavigation('bottom');
+        else:
+            sPageBody += '<p>No entries.</p>'
+
+        return (self._composeTitle(), sPageBody);
+
+
+class WuiListContentWithActionBase(WuiListContentBase):
+    """
+    Base for the list content with action classes.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffectiveDate, sTitle, sId = None, fnDPrint = None, oDisp = None):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffectiveDate, sTitle,
+                                    sId = sId, fnDPrint = fnDPrint, oDisp = oDisp);
+        self._aoActions     = None; # List of [ oValue, sText, sHover ] provided by the child class.
+        self._sAction       = None; # Set by the child class.
+        self._sCheckboxName = None; # Set by the child class.
+        self._asColumnHeaders = [ WuiRawHtml('<input type="checkbox" onClick="toggle%s(this)">'
+                                             % ('' if sId is None else sId)), ];
+        self._asColumnAttribs = [ 'align="center"', ];
+
+    def _getCheckBoxColumn(self, iEntry, sValue):
+        """
+        Used by _formatListEntry implementations, returns a WuiRawHtmlBase object.
+        """
+        _ = iEntry;
+        return WuiRawHtml('<input type="checkbox" name="%s" value="%s">'
+                          % (webutils.escapeAttr(self._sCheckboxName), webutils.escapeAttr(unicode(sValue))));
+
+    def show(self, fShowNavigation=True):
+        """
+        Displays the list.
+        Returns (Title, HTML) on success, raises exception on error.
+        """
+        assert self._aoActions is not None;
+        assert self._sAction   is not None;
+
+        sPageBody = '<script language="JavaScript">\n' \
+                    'function toggle%s(oSource) {\n' \
+                    '    aoCheckboxes = document.getElementsByName(\'%s\');\n' \
+                    '    for(var i in aoCheckboxes)\n' \
+                    '        aoCheckboxes[i].checked = oSource.checked;\n' \
+                    '}\n' \
+                    '</script>\n' \
+                    % ('' if self._sId is None else self._sId, self._sCheckboxName,);
+        if fShowNavigation:
+            sPageBody += self._generateNavigation('top');
+        if len(self._aoEntries) > 0:
+
+            sPageBody += '<form action="?%s" method="post" class="tmlistactionform">\n' \
+                       % (webutils.encodeUrlParams({WuiDispatcherBase.ksParamAction: self._sAction,}),);
+            sPageBody += self._generateTable();
+
+            sPageBody += '  <label>Actions</label>\n' \
+                         '  <select name="%s" id="%s-action-combo" class="tmlistactionform-combo">\n' \
+                       % (webutils.escapeAttr(WuiDispatcherBase.ksParamListAction), webutils.escapeAttr(self._sId),);
+            for oValue, sText, _ in self._aoActions:
+                sPageBody += '    <option value="%s">%s</option>\n' \
+                           % (webutils.escapeAttr(unicode(oValue)), webutils.escapeElem(sText), );
+            sPageBody += '  </select>\n';
+            sPageBody += '  <input type="submit"></input>\n';
+            sPageBody += '</form>\n';
+            if fShowNavigation:
+                sPageBody += self._generateNavigation('bottom');
+        else:
+            sPageBody += '<p>No entries.</p>'
+
+        return (self._composeTitle(), sPageBody);
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuifailurecategory.py b/src/VBox/ValidationKit/testmanager/webui/wuifailurecategory.py
new file mode 100644
index 0000000..b62eca7
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuifailurecategory.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+# $Id: wuifailurecategory.py $
+
+"""
+Test Manager WUI - Failure Categories Web content generator.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.webui.wuicontentbase  import WuiFormContentBase, WuiListContentBase, WuiTmLink
+from testmanager.core.failurecategory  import FailureCategoryData
+from testmanager.webui.wuibase         import WuiException
+
+
+class WuiFailureCategory(WuiFormContentBase):
+    """
+    WUI Failure Category HTML content generator.
+    """
+
+    def __init__(self, oFailureCategoryData, sMode, oDisp):
+        """
+        Prepare & initialize parent
+        """
+
+        if sMode == WuiFormContentBase.ksMode_Add:
+            sTitle = 'Add Failure Category'
+            sSubmitAction = oDisp.ksActionFailureCategoryAdd
+        elif sMode == WuiFormContentBase.ksMode_Edit:
+            sTitle = 'Edit Failure Category'
+            sSubmitAction = oDisp.ksActionFailureCategoryEdit
+        else:
+            raise WuiException('Unknown parameter')
+
+        WuiFormContentBase.__init__(self, oFailureCategoryData, sMode, 'FailureCategory', oDisp, sTitle,
+                                    sSubmitAction = sSubmitAction, fEditable = False); ## @todo non-standard action names.
+
+    def _populateForm(self, oForm, oData):
+        """
+        Construct an HTML form
+        """
+
+        oForm.addIntRO      (FailureCategoryData.ksParam_idFailureCategory,   oData.idFailureCategory,  'Failure Category ID')
+        oForm.addTimestampRO(FailureCategoryData.ksParam_tsEffective,         oData.tsEffective,        'Last changed')
+        oForm.addTimestampRO(FailureCategoryData.ksParam_tsExpire,            oData.tsExpire,           'Expires (excl)')
+        oForm.addIntRO      (FailureCategoryData.ksParam_uidAuthor,           oData.uidAuthor,          'Changed by UID')
+        oForm.addText       (FailureCategoryData.ksParam_sShort,              oData.sShort,             'Short Description')
+        oForm.addText       (FailureCategoryData.ksParam_sFull,               oData.sFull,              'Full Description')
+
+        oForm.addSubmit()
+
+        return True
+
+class WuiFailureCategoryList(WuiListContentBase):
+    """
+    WUI Admin Failure Category Content Generator.
+    """
+
+    def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Failure Categories', sId = 'failureCategories',
+                                    fnDPrint = fnDPrint, oDisp = oDisp);
+
+        self._asColumnHeaders = ['ID', 'Short Description', 'Full Description', 'Actions' ]
+        self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"', 'align="center"']
+
+    def _formatListEntry(self, iEntry):
+        from testmanager.webui.wuiadmin import WuiAdmin
+        oEntry = self._aoEntries[iEntry]
+
+        return [ oEntry.idFailureCategory,
+                 oEntry.sShort,
+                 oEntry.sFull,
+                 [ WuiTmLink('Modify', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureCategoryShowEdit,
+                               FailureCategoryData.ksParam_idFailureCategory: oEntry.idFailureCategory }),
+                   WuiTmLink('Remove', WuiAdmin.ksScriptName,
+                             { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureCategoryDel,
+                               FailureCategoryData.ksParam_idFailureCategory: oEntry.idFailureCategory },
+                             sConfirm = 'Do you really want to remove failure cateogry #%d?' % (oEntry.idFailureCategory,)),
+        ] ];
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuigraphwiz.py b/src/VBox/ValidationKit/testmanager/webui/wuigraphwiz.py
new file mode 100644
index 0000000..520f0bf
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuigraphwiz.py
@@ -0,0 +1,652 @@
+# -*- coding: utf-8 -*-
+# $Id: wuigraphwiz.py $
+
+"""
+Test Manager WUI - Graph Wizard
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Python imports.
+import functools;
+
+# Validation Kit imports.
+from testmanager.webui.wuimain          import WuiMain;
+from testmanager.webui.wuihlpgraph      import WuiHlpLineGraphErrorbarY, WuiHlpGraphDataTableEx;
+from testmanager.webui.wuireport        import WuiReportBase;
+
+from common                             import utils, webutils;
+from common                             import constants;
+
+
+class WuiGraphWiz(WuiReportBase):
+    """Construct a graph for analyzing test results (values) across builds and testboxes."""
+
+    ## @name Series name parts.
+    ## @{
+    kfSeriesName_TestBox        = 1;
+    kfSeriesName_Product        = 2;
+    kfSeriesName_Branch         = 4;
+    kfSeriesName_BuildType      = 8;
+    kfSeriesName_OsArchs        = 16;
+    kfSeriesName_TestCase       = 32;
+    kfSeriesName_TestCaseArgs   = 64;
+    kfSeriesName_All            = 127;
+    ## @}
+
+
+    def __init__(self, oModel, dParams, fSubReport = False, fnDPrint = None, oDisp = None):
+        WuiReportBase.__init__(self, oModel, dParams, fSubReport = fSubReport, fnDPrint = fnDPrint, oDisp = oDisp);
+
+        # Select graph implementation.
+        if dParams[WuiMain.ksParamGraphWizImpl] == 'charts':
+            from testmanager.webui.wuihlpgraphgooglechart import WuiHlpLineGraphErrorbarY as MyGraph;
+            self.oGraphClass = MyGraph;
+        elif dParams[WuiMain.ksParamGraphWizImpl] == 'matplotlib':
+            from testmanager.webui.wuihlpgraphmatplotlib  import WuiHlpLineGraphErrorbarY as MyGraph;
+            self.oGraphClass = MyGraph;
+        else:
+            self.oGraphClass = WuiHlpLineGraphErrorbarY;
+
+
+    #
+    def _figureSeriesNameBits(self, aoSeries):
+        """ Figures out the method (bitmask) to use when naming series. """
+        if len(aoSeries) <= 1:
+            return WuiGraphWiz.kfSeriesName_TestBox;
+
+        # Start with all and drop unnecessary specs one-by-one.
+        fRet = WuiGraphWiz.kfSeriesName_All;
+
+        if [oSrs.idTestBox for oSrs in aoSeries].count(aoSeries[0].idTestBox) == len(aoSeries):
+            fRet &= ~WuiGraphWiz.kfSeriesName_TestBox;
+
+        if [oSrs.idBuildCategory for oSrs in aoSeries].count(aoSeries[0].idBuildCategory) == len(aoSeries):
+            fRet &= ~WuiGraphWiz.kfSeriesName_Product;
+            fRet &= ~WuiGraphWiz.kfSeriesName_Branch;
+            fRet &= ~WuiGraphWiz.kfSeriesName_BuildType;
+            fRet &= ~WuiGraphWiz.kfSeriesName_OsArchs;
+        else:
+            if [oSrs.oBuildCategory.sProduct for oSrs in aoSeries].count(aoSeries[0].oBuildCategory.sProduct) == len(aoSeries):
+                fRet &= ~WuiGraphWiz.kfSeriesName_Product;
+            if [oSrs.oBuildCategory.sBranch for oSrs in aoSeries].count(aoSeries[0].oBuildCategory.sBranch) == len(aoSeries):
+                fRet &= ~WuiGraphWiz.kfSeriesName_Branch;
+            if [oSrs.oBuildCategory.sType for oSrs in aoSeries].count(aoSeries[0].oBuildCategory.sType) == len(aoSeries):
+                fRet &= ~WuiGraphWiz.kfSeriesName_BuildType;
+
+            # Complicated.
+            fRet &= ~WuiGraphWiz.kfSeriesName_OsArchs;
+            daTestBoxes = {};
+            for oSeries in aoSeries:
+                if oSeries.idTestBox in daTestBoxes:
+                    daTestBoxes[oSeries.idTestBox].append(oSeries);
+                else:
+                    daTestBoxes[oSeries.idTestBox] = [oSeries,];
+            for _, aoSeriesPerTestBox in daTestBoxes.iteritems():
+                if len(aoSeriesPerTestBox) >= 0:
+                    asOsArches = aoSeriesPerTestBox[0].oBuildCategory.asOsArches;
+                    for i in range(1, len(aoSeriesPerTestBox)):
+                        if aoSeriesPerTestBox[i].oBuildCategory.asOsArches != asOsArches:
+                            fRet |= WuiGraphWiz.kfSeriesName_OsArchs;
+                            break;
+
+        if aoSeries[0].oTestCaseArgs is None:
+            fRet &= ~WuiGraphWiz.kfSeriesName_TestCaseArgs;
+            if [oSrs.idTestCase for oSrs in aoSeries].count(aoSeries[0].idTestCase) == len(aoSeries):
+                fRet &= ~WuiGraphWiz.kfSeriesName_TestCase;
+        else:
+            fRet &= ~WuiGraphWiz.kfSeriesName_TestCase;
+            if [oSrs.idTestCaseArgs for oSrs in aoSeries].count(aoSeries[0].idTestCaseArgs) == len(aoSeries):
+                fRet &= ~WuiGraphWiz.kfSeriesName_TestCaseArgs;
+
+        return fRet;
+
+    def _getSeriesNameFromBits(self, oSeries, fBits):
+        """ Creates a series name from bits (kfSeriesName_xxx). """
+        assert fBits != 0;
+        sName = '';
+
+        if fBits & WuiGraphWiz.kfSeriesName_Product:
+            if len(sName) > 0: sName += ' / ';
+            sName += oSeries.oBuildCategory.sProduct;
+
+        if fBits & WuiGraphWiz.kfSeriesName_Branch:
+            if len(sName) > 0: sName += ' / ';
+            sName += oSeries.oBuildCategory.sBranch;
+
+        if fBits & WuiGraphWiz.kfSeriesName_BuildType:
+            if len(sName) > 0: sName += ' / ';
+            sName += oSeries.oBuildCategory.sType;
+
+        if fBits & WuiGraphWiz.kfSeriesName_OsArchs:
+            if len(sName) > 0: sName += ' / ';
+            sName += ' & '.join(oSeries.oBuildCategory.asOsArches);
+
+        if fBits & WuiGraphWiz.kfSeriesName_TestCaseArgs:
+            if len(sName) > 0: sName += ' / ';
+            if oSeries.idTestCaseArgs is not None:
+                sName += oSeries.oTestCase.sName + ':#' + str(oSeries.idTestCaseArgs);
+            else:
+                sName += oSeries.oTestCase.sName;
+        elif fBits & WuiGraphWiz.kfSeriesName_TestCase:
+            if len(sName) > 0: sName += ' / ';
+            sName += oSeries.oTestCase.sName;
+
+        if fBits & WuiGraphWiz.kfSeriesName_TestBox:
+            if len(sName) > 0: sName += ' / ';
+            sName += oSeries.oTestBox.sName;
+
+        return sName;
+
+    def _calcGraphName(self, oSeries, fSeriesName, sSampleName):
+        """ Constructs a name for the graph. """
+        fGraphName = ~fSeriesName & (  WuiGraphWiz.kfSeriesName_TestBox
+                                     | WuiGraphWiz.kfSeriesName_Product
+                                     | WuiGraphWiz.kfSeriesName_Branch
+                                     | WuiGraphWiz.kfSeriesName_BuildType
+                                    );
+        sName = self._getSeriesNameFromBits(oSeries, fGraphName);
+        if len(sName) > 0: sName += ' - ';
+        sName += sSampleName;
+        return sName;
+
+    def _calcSampleName(self, oCollection):
+        """ Constructs a name for a sample source (collection). """
+        if oCollection.sValue is not None:
+            asSampleName = [oCollection.sValue, 'in',];
+        elif oCollection.sType == self._oModel.ksTypeElapsed:
+            asSampleName = ['Elapsed time', 'for', ];
+        elif oCollection.sType == self._oModel.ksTypeResult:
+            asSampleName = ['Error count', 'for',];
+        else:
+            return 'Invalid collection type: "%s"' % (oCollection.sType,);
+
+        sTestName = ', '.join(oCollection.asTests if len(oCollection.asTests[0]) else oCollection.asTests[1:]);
+        if sTestName == '':
+            # Use the testcase name if there is only one for all series.
+            if len(oCollection.aoSeries) == 0:
+                return asSampleName[0];
+            if len(oCollection.aoSeries) > 1:
+                idTestCase = oCollection.aoSeries[0].idTestCase;
+                for oSeries in oCollection.aoSeries:
+                    if oSeries.idTestCase != idTestCase:
+                        return asSampleName[0];
+            sTestName = oCollection.aoSeries[0].oTestCase.sName;
+        return ' '.join(asSampleName) + ' ' + sTestName;
+
+
+    def _splitSeries(self, aoSeries):
+        """
+        Splits the data series (ReportGraphModel.DataSeries) into one or more graphs.
+
+        Returns an array of data series arrays.
+        """
+        # Must be at least two series for something to be splittable.
+        if len(aoSeries) <= 1:
+            if len(aoSeries) < 1:
+                return [];
+            return [aoSeries,];
+
+        # Split on unit.
+        dUnitSeries = dict();
+        for oSeries in aoSeries:
+            if oSeries.iUnit not in dUnitSeries:
+                dUnitSeries[oSeries.iUnit] = [];
+            dUnitSeries[oSeries.iUnit].append(oSeries);
+
+        # Sort the per-unit series since the build category was only sorted by ID.
+        for iUnit in dUnitSeries:
+            def mycmp(oSelf, oOther):
+                """ __cmp__ like function. """
+                iCmp = utils.stricmp(oSelf.oBuildCategory.sProduct, oOther.oBuildCategory.sProduct);
+                if iCmp != 0:
+                    return iCmp;
+                iCmp = utils.stricmp(oSelf.oBuildCategory.sBranch, oOther.oBuildCategory.sBranch);
+                if iCmp != 0:
+                    return iCmp;
+                iCmp = utils.stricmp(oSelf.oBuildCategory.sType, oOther.oBuildCategory.sType);
+                if iCmp != 0:
+                    return iCmp;
+                iCmp = utils.stricmp(oSelf.oTestBox.sName, oOther.oTestBox.sName);
+                if iCmp != 0:
+                    return iCmp;
+                return 0;
+            dUnitSeries[iUnit] = sorted(dUnitSeries[iUnit], key = functools.cmp_to_key(mycmp));
+
+        # Split the per-unit series up if necessary.
+        cMaxPerGraph = self._dParams[WuiMain.ksParamGraphWizMaxPerGraph];
+        aaoRet = [];
+        for iUnit in dUnitSeries:
+            aoUnitSeries = dUnitSeries[iUnit];
+            while len(aoUnitSeries) > cMaxPerGraph:
+                aaoRet.append(aoUnitSeries[:cMaxPerGraph]);
+                aoUnitSeries = aoUnitSeries[cMaxPerGraph:];
+            if len(aoUnitSeries) > 0:
+                aaoRet.append(aoUnitSeries);
+
+        return aaoRet;
+
+    def _configureGraph(self, oGraph):
+        """
+        Configures oGraph according to user parameters and other config settings.
+
+        Returns oGraph.
+        """
+        oGraph.setWidth(self._dParams[WuiMain.ksParamGraphWizWidth])
+        oGraph.setHeight(self._dParams[WuiMain.ksParamGraphWizHeight])
+        oGraph.setDpi(self._dParams[WuiMain.ksParamGraphWizDpi])
+        oGraph.setErrorBarY(self._dParams[WuiMain.ksParamGraphWizErrorBarY]);
+        oGraph.setFontSize(self._dParams[WuiMain.ksParamGraphWizFontSize]);
+        if hasattr(oGraph, 'setXkcdStyle'):
+            oGraph.setXkcdStyle(self._dParams[WuiMain.ksParamGraphWizXkcdStyle]);
+
+        return oGraph;
+
+    def _generateInteractiveForm(self):
+        """
+        Generates the HTML for the interactive form.
+        Returns (sTopOfForm, sEndOfForm)
+        """
+
+        #
+        # The top of the form.
+        #
+        sTop  = '<form action="#" method="get" id="graphwiz-form">\n' \
+                ' <input type="hidden" name="%s" value="%s"/>\n' \
+                ' <input type="hidden" name="%s" value="%u"/>\n' \
+                % ( WuiMain.ksParamAction,                 WuiMain.ksActionGraphWiz,
+                    WuiMain.ksParamGraphWizSrcTestSetId,   self._dParams[WuiMain.ksParamGraphWizSrcTestSetId],
+                    );
+
+        sTop  += ' <div id="graphwiz-nav">\n';
+        sTop  += '  <script type="text/javascript">\n' \
+                 '   window.onresize = function(){ return graphwizOnResizeRecalcWidth("graphwiz-nav", "%s"); }\n' \
+                 '   window.onload   = function(){ return graphwizOnLoadRememberWidth("graphwiz-nav"); }\n' \
+                 '  </script>\n' \
+               % ( WuiMain.ksParamGraphWizWidth, );
+
+        #
+        # Top: First row.
+        #
+        sTop  += '  <div id="graphwiz-top-1">\n';
+
+        # time.
+        sNow = self._dParams[WuiMain.ksParamEffectiveDate];
+        if sNow is None: sNow = '';
+        sTop  += '   <div id="graphwiz-time">\n';
+        sTop  += '    <label for="%s">Starting:</label>\n' \
+                 '    <input type="text" name="%s" id="%s" value="%s" class="graphwiz-time-input"/>\n' \
+               % ( WuiMain.ksParamEffectiveDate,
+                   WuiMain.ksParamEffectiveDate, WuiMain.ksParamEffectiveDate, sNow, );
+
+        sTop  += '    <input type="hidden" name="%s" value="%u"/>\n' % ( WuiMain.ksParamReportPeriods, 1, );
+        sTop  += '    <label for="%s"> Going back:\n' \
+                 '    <input type="text" name="%s" id="%s" value="%s" class="graphwiz-period-input"/>\n' \
+               % ( WuiMain.ksParamReportPeriodInHours,
+                   WuiMain.ksParamReportPeriodInHours, WuiMain.ksParamReportPeriodInHours,
+                   utils.formatIntervalHours(self._dParams[WuiMain.ksParamReportPeriodInHours]) );
+        sTop  += '   </div>\n';
+
+        # Graph options top row.
+        sTop  += '   <div id="graphwiz-top-options-1">\n';
+
+        # graph type.
+        sTop  += '    <label for="%s">Graph:</label>\n' \
+                 '    <select name="%s" id="%s">\n' \
+               % ( WuiMain.ksParamGraphWizImpl, WuiMain.ksParamGraphWizImpl, WuiMain.ksParamGraphWizImpl, );
+        for (sImpl, sDesc) in WuiMain.kaasGraphWizImplCombo:
+            sTop  += '     <option value="%s"%s>%s</option>\n' \
+                   % (sImpl, ' selected' if sImpl == self._dParams[WuiMain.ksParamGraphWizImpl] else '', sDesc);
+        sTop  += '    </select>\n';
+
+        # graph size.
+        sTop  += '    <label for="%s">Graph size:</label>\n' \
+                 '    <input type="text" name="%s" id="%s" value="%s" class="graphwiz-pixel-input"> x\n' \
+                 '    <input type="text" name="%s" id="%s" value="%s" class="graphwiz-pixel-input">\n' \
+                 '    <label for="%s">Dpi:</label>'\
+                 '    <input type="text" name="%s" id="%s" value="%s" class="graphwiz-dpi-input">\n' \
+                 '    <button type="button" onclick="%s">Defaults</button>\n' \
+               % ( WuiMain.ksParamGraphWizWidth,
+                   WuiMain.ksParamGraphWizWidth,  WuiMain.ksParamGraphWizWidth,  self._dParams[WuiMain.ksParamGraphWizWidth],
+                   WuiMain.ksParamGraphWizHeight, WuiMain.ksParamGraphWizHeight, self._dParams[WuiMain.ksParamGraphWizHeight],
+                   WuiMain.ksParamGraphWizDpi,
+                   WuiMain.ksParamGraphWizDpi,    WuiMain.ksParamGraphWizDpi,    self._dParams[WuiMain.ksParamGraphWizDpi],
+                   webutils.escapeAttr('return graphwizSetDefaultSizeValues("graphwiz-nav", "%s", "%s", "%s");'
+                                       % ( WuiMain.ksParamGraphWizWidth, WuiMain.ksParamGraphWizHeight,
+                                           WuiMain.ksParamGraphWizDpi )),
+                 );
+
+        sTop  += '   </div>\n'; # (options row 1)
+
+        sTop  += '  </div>\n'; # (end of row 1)
+
+        #
+        # Top: Second row.
+        #
+        sTop  += '  <div id="graphwiz-top-2">\n';
+
+        # Submit
+        sFormButton = '<button type="submit">Refresh</button>\n';
+        sTop  += '   <div id="graphwiz-top-submit">' + sFormButton + '</div>\n';
+
+
+        # Options.
+        sTop  += '   <div id="graphwiz-top-options-2">\n';
+
+        sTop  += '    <input type="checkbox" name="%s" id="%s" value="1"%s/>\n' \
+                 '    <label for="%s">Tabular data</label>\n' \
+               % ( WuiMain.ksParamGraphWizTabular, WuiMain.ksParamGraphWizTabular,
+                   ' checked' if self._dParams[WuiMain.ksParamGraphWizTabular] else '',
+                   WuiMain.ksParamGraphWizTabular);
+
+        if hasattr(self.oGraphClass, 'setXkcdStyle'):
+            sTop  += '    <input type="checkbox" name="%s" id="%s" value="1"%s/>\n' \
+                     '    <label for="%s">xkcd-style</label>\n' \
+                   % ( WuiMain.ksParamGraphWizXkcdStyle, WuiMain.ksParamGraphWizXkcdStyle,
+                       ' checked' if self._dParams[WuiMain.ksParamGraphWizXkcdStyle] else '',
+                       WuiMain.ksParamGraphWizXkcdStyle);
+        elif self._dParams[WuiMain.ksParamGraphWizXkcdStyle]:
+            sTop  += '    <input type="hidden" name="%s" id="%s" value="1"/>\n' \
+                   % ( WuiMain.ksParamGraphWizXkcdStyle, WuiMain.ksParamGraphWizXkcdStyle, );
+
+        if not hasattr(self.oGraphClass, 'kfNoErrorBarsSupport'):
+            sTop  += '    <input type="checkbox" name="%s" id="%s" value="1"%s title="%s"/>\n' \
+                     '    <label for="%s">Error bars,</label>\n' \
+                     '    <label for="%s">max: </label>\n' \
+                     '    <input type="text" name="%s" id="%s" value="%s" class="graphwiz-maxerrorbar-input" title="%s"/>\n' \
+                   % ( WuiMain.ksParamGraphWizErrorBarY, WuiMain.ksParamGraphWizErrorBarY,
+                       ' checked' if self._dParams[WuiMain.ksParamGraphWizErrorBarY] else '',
+                       'Error bars shows some of the max and min results on the Y-axis.',
+                       WuiMain.ksParamGraphWizErrorBarY,
+                       WuiMain.ksParamGraphWizMaxErrorBarY,
+                       WuiMain.ksParamGraphWizMaxErrorBarY, WuiMain.ksParamGraphWizMaxErrorBarY,
+                       self._dParams[WuiMain.ksParamGraphWizMaxErrorBarY],
+                       'Maximum number of Y-axis error bar per graph. (Too many makes it unreadable.)'
+                       );
+        else:
+            if self._dParams[WuiMain.ksParamGraphWizErrorBarY]:
+                sTop += '<input type="hidden" name="%s" id="%s" value="1">\n' \
+                      % ( WuiMain.ksParamGraphWizErrorBarY, WuiMain.ksParamGraphWizErrorBarY, );
+            sTop += '<input type="hidden" name="%s" id="%s" value="%u">\n' \
+                  % ( WuiMain.ksParamGraphWizMaxErrorBarY, WuiMain.ksParamGraphWizMaxErrorBarY,
+                      self._dParams[WuiMain.ksParamGraphWizMaxErrorBarY], );
+
+        sTop  += '    <label for="%s">Font size: </label>\n' \
+                 '    <input type="text" name="%s" id="%s" value="%s" class="graphwiz-fontsize-input"/>\n' \
+               % ( WuiMain.ksParamGraphWizFontSize,
+                   WuiMain.ksParamGraphWizFontSize, WuiMain.ksParamGraphWizFontSize,
+                   self._dParams[WuiMain.ksParamGraphWizFontSize], );
+
+        sTop  += '    <label for="%s">Data series: </label>\n' \
+                 '    <input type="text" name="%s" id="%s" value="%s" class="graphwiz-maxpergraph-input" title="%s"/>\n' \
+               % ( WuiMain.ksParamGraphWizMaxPerGraph,
+                   WuiMain.ksParamGraphWizMaxPerGraph, WuiMain.ksParamGraphWizMaxPerGraph,
+                   self._dParams[WuiMain.ksParamGraphWizMaxPerGraph],
+                   'Max data series per graph.' );
+
+        sTop  += '   </div>\n'; # (options row 2)
+
+        sTop  += '  </div>\n'; # (end of row 2)
+
+        sTop  += ' </div>\n'; # end of top.
+
+        #
+        # The end of the page selection.
+        #
+        sEnd = ' <div id="graphwiz-end-selection">\n';
+
+        #
+        # Testbox selection
+        #
+        aidTestBoxes = list(self._dParams[WuiMain.ksParamGraphWizTestBoxIds]);
+        sEnd += '  <div id="graphwiz-testboxes" class="graphwiz-end-selection-group">\n' \
+                '   <h3>TestBox Selection:</h3>\n' \
+                '   <ol class="tmgraph-testboxes">\n';
+
+        # Get a list of eligible testboxes from the DB.
+        for oTestBox in self._oModel.getEligibleTestBoxes():
+            try:    aidTestBoxes.remove(oTestBox.idTestBox);
+            except: sChecked = '';
+            else:   sChecked = ' checked';
+            sEnd += '   <li><input type="checkbox" name="%s" value="%s" id="gw-tb-%u"%s/>' \
+                    '<label for="gw-tb-%u">%s</label></li>\n' \
+                  % ( WuiMain.ksParamGraphWizTestBoxIds, oTestBox.idTestBox, oTestBox.idTestBox, sChecked,
+                      oTestBox.idTestBox, oTestBox.sName);
+
+        # List testboxes that have been checked in a different period or something.
+        for idTestBox in aidTestBoxes:
+            oTestBox = self._oModel.oCache.getTestBox(idTestBox);
+            sEnd += '   <li><input type="checkbox" name="%s" value="%s" id="gw-tb-%u" checked/>' \
+                    '<label for="gw-tb-%u">%s</label></li>\n' \
+                  % ( WuiMain.ksParamGraphWizTestBoxIds, oTestBox.idTestBox, oTestBox.idTestBox,
+                      oTestBox.idTestBox, oTestBox.sName);
+
+        sEnd += '   </ol>\n' \
+                ' </div>\n';
+
+        #
+        # Build category selection.
+        #
+        aidBuildCategories = list(self._dParams[WuiMain.ksParamGraphWizBuildCatIds]);
+        sEnd += '  <div id="graphwiz-buildcategories" class="graphwiz-end-selection-group">\n' \
+                '   <h3>Build Category Selection:</h3>\n' \
+                '   <ol class="tmgraph-buildcategories">\n';
+        for oBuildCat in self._oModel.getEligibleBuildCategories():
+            try:    aidBuildCategories.remove(oBuildCat.idBuildCategory);
+            except: sChecked = '';
+            else:   sChecked = ' checked';
+            sEnd += '    <li><input type="checkbox" name="%s" value="%s" id="gw-bc-%u" %s/>' \
+                    '<label for="gw-bc-%u">%s / %s / %s / %s</label></li>\n' \
+                  % ( WuiMain.ksParamGraphWizBuildCatIds, oBuildCat.idBuildCategory, oBuildCat.idBuildCategory, sChecked,
+                      oBuildCat.idBuildCategory,
+                      oBuildCat.sProduct, oBuildCat.sBranch, oBuildCat.sType, ' & '.join(oBuildCat.asOsArches) );
+        assert len(aidBuildCategories) == 0; # SQL should return all currently selected.
+
+        sEnd += '   </ol>\n' \
+                ' </div>\n';
+
+        #
+        # Testcase variations.
+        #
+        sEnd += '  <div id="graphwiz-testcase-variations" class="graphwiz-end-selection-group">\n' \
+                '   <h3>Miscellaneous:</h3>\n' \
+                '   <ol>';
+
+        sEnd += '    <li>\n' \
+                '     <input type="checkbox" id="%s" name="%s" value="1"%s/>\n' \
+                '     <label for="%s">Separate by testcase variation.</label>\n' \
+                '    </li>\n' \
+              % ( WuiMain.ksParamGraphWizSepTestVars, WuiMain.ksParamGraphWizSepTestVars,
+                  ' checked' if self._dParams[WuiMain.ksParamGraphWizSepTestVars] else '',
+                  WuiMain.ksParamGraphWizSepTestVars );
+
+
+        sEnd += '    <li>\n' \
+                '     <lable for="%s">Test case ID:</label>\n' \
+                '     <input type="text" id="%s" name="%s" value="%s" readonly/>\n' \
+                '    </li>\n' \
+              % ( WuiMain.ksParamGraphWizTestCaseIds,
+                  WuiMain.ksParamGraphWizTestCaseIds, WuiMain.ksParamGraphWizTestCaseIds,
+                  ','.join([str(i) for i in self._dParams[WuiMain.ksParamGraphWizTestCaseIds]]), );
+
+        sEnd += '   </ol>\n' \
+                '  </div>\n';
+
+        #sEnd += '   <h3> </h3>\n';
+
+        #
+        # Finish up the form.
+        #
+        sEnd += '  <div id="graphwiz-end-submit"><p>' + sFormButton + '</p></div>\n';
+        sEnd += ' </div>\n' \
+                '</form>\n';
+
+        return (sTop, sEnd);
+
+    def generateReportBody(self):
+        fInteractive = not self._fSubReport;
+
+        # Quick mockup.
+        self._sTitle = 'Graph Wizzard';
+
+        sHtml = '';
+        sHtml += '<h2>Incomplete code - no complaints yet, thank you!!</h2>\n';
+
+        #
+        # Create a form for altering the data we're working with.
+        #
+        if fInteractive:
+            (sTopOfForm, sEndOfForm) = self._generateInteractiveForm();
+            sHtml += sTopOfForm;
+            del sTopOfForm;
+
+        #
+        # Emit the graphs.  At least one per sample source.
+        #
+        sHtml += ' <div id="graphwiz-graphs">\n';
+        iGraph = 0;
+        aoCollections = self._oModel.fetchGraphData();
+        for iCollection, oCollection in enumerate(aoCollections):
+            # Name the graph and add a checkbox for removing it.
+            sSampleName = self._calcSampleName(oCollection);
+            sHtml += '  <div class="graphwiz-collection" id="graphwiz-source-%u">\n' % (iCollection,);
+            if fInteractive:
+                sHtml += '   <div class="graphwiz-src-select">\n' \
+                         '    <input type="checkbox" name="%s" id="%s" value="%s:%s%s" checked class="graphwiz-src-input">\n' \
+                         '    <label for="%s">%s</label>\n' \
+                         '   </div>\n' \
+                       % ( WuiMain.ksParamReportSubjectIds, WuiMain.ksParamReportSubjectIds, oCollection.sType,
+                           ':'.join([str(idStr) for idStr in oCollection.aidStrTests]),
+                           ':%u' % oCollection.idStrValue if oCollection.idStrValue else '',
+                           WuiMain.ksParamReportSubjectIds, sSampleName );
+
+            if len(oCollection.aoSeries) > 0:
+                #
+                # Split the series into sub-graphs as needed and produce SVGs.
+                #
+                aaoSeries = self._splitSeries(oCollection.aoSeries);
+                for aoSeries in aaoSeries:
+                    # Gather the data for this graph. (Most big stuff is passed by
+                    # reference, so there shouldn't be any large memory penalty for
+                    # repacking the data here.)
+                    sYUnit = None;
+                    if aoSeries[0].iUnit < len(constants.valueunit.g_asNames) and aoSeries[0].iUnit > 0:
+                        sYUnit = constants.valueunit.g_asNames[aoSeries[0].iUnit];
+                    oData = WuiHlpGraphDataTableEx(sXUnit = 'Build revision', sYUnit = sYUnit);
+
+                    fSeriesName = self._figureSeriesNameBits(aoSeries);
+                    for oSeries in aoSeries:
+                        sSeriesName = self._getSeriesNameFromBits(oSeries, fSeriesName);
+                        asHtmlTooltips = None;
+                        if len(oSeries.aoRevInfo) == len(oSeries.aiRevisions):
+                            asHtmlTooltips = [];
+                            for i in range(len(oSeries.aoRevInfo)):
+                                sPlusMinus = '';
+                                if oSeries.acSamples[i] > 1:
+                                    sPlusMinus = ' (+%s/-%s; %u samples)' \
+                                               % ( utils.formatNumber(oSeries.aiErrorBarAbove[i]),
+                                                   utils.formatNumber(oSeries.aiErrorBarBelow[i]),
+                                                   oSeries.acSamples[i])
+                                sTooltip = '<table class=\'graphwiz-tt\'><tr><td>%s:</td><td>%s %s %s</td></tr>'\
+                                           '<tr><td>Rev:</td><td>r%s</td></tr>' \
+                                         % ( sSeriesName,
+                                             utils.formatNumber(oSeries.aiValues[i]),
+                                             sYUnit, sPlusMinus,
+                                             oSeries.aiRevisions[i],
+                                             );
+                                oRevInfo = oSeries.aoRevInfo[i];
+                                if oRevInfo.sAuthor is not None:
+                                    sMsg = oRevInfo.sMessage[:80].strip();
+                                    #if sMsg.find('\n') >= 0:
+                                    #    sMsg = sMsg[:sMsg.find('\n')].strip();
+                                    sTooltip += '<tr><td>Author:</td><td>%s</td></tr>' \
+                                                '<tr><td>Date:</td><td>%s</td><tr>' \
+                                                '<tr><td>Message:</td><td>%s%s</td></tr>' \
+                                              % ( oRevInfo.sAuthor,
+                                                  self.formatTsShort(oRevInfo.tsCreated),
+                                                  sMsg, '...' if len(oRevInfo.sMessage) > len(sMsg) else '');
+                                sTooltip += '</table>';
+                                asHtmlTooltips.append(sTooltip);
+                        oData.addDataSeries(sSeriesName, oSeries.aiRevisions, oSeries.aiValues, asHtmlTooltips,
+                                            oSeries.aiErrorBarBelow, oSeries.aiErrorBarAbove);
+                    # Render the data into a graph.
+                    oGraph = self.oGraphClass('tmgraph-%u' % (iGraph,), oData, self._oDisp);
+                    self._configureGraph(oGraph);
+
+                    oGraph.setTitle(self._calcGraphName(aoSeries[0], fSeriesName, sSampleName));
+                    sHtml += '   <div class="graphwiz-graph" id="graphwiz-graph-%u">\n' % (iGraph,);
+                    sHtml += oGraph.renderGraph();
+                    sHtml += '\n   </div>\n';
+                    iGraph += 1;
+
+                #
+                # Emit raw tabular data if requested.
+                #
+                if self._dParams[WuiMain.ksParamGraphWizTabular]:
+                    sHtml += '   <div class="graphwiz-tab-div" id="graphwiz-tab-%u">\n' \
+                             '    <table class="tmtable graphwiz-tab">\n' \
+                           % (iCollection, );
+                    for aoSeries in aaoSeries:
+                        if aoSeries[0].iUnit < len(constants.valueunit.g_asNames) and aoSeries[0].iUnit > 0:
+                            sUnit = constants.valueunit.g_asNames[aoSeries[0].iUnit];
+                        else:
+                            sUnit = str(aoSeries[0].iUnit);
+
+                        for iSeries, oSeries in enumerate(aoSeries):
+                            sColor = self.oGraphClass.calcSeriesColor(iSeries);
+
+                            sHtml += '<thead class="tmheader">\n' \
+                                     ' <tr class="graphwiz-tab graphwiz-tab-new-series-row">\n' \
+                                     '  <th colspan="5"><span style="background-color:%s;">  </span> %s</th>\n' \
+                                     ' </tr>\n' \
+                                     ' <tr class="graphwiz-tab graphwiz-tab-col-hdr-row">\n' \
+                                     '  <th>Revision</th><th>Value (%s)</th><th>Δmax</th><th>Δmin</th>' \
+                                     '<th>Samples</th>\n' \
+                                     ' </tr>\n' \
+                                     '</thead>\n' \
+                                   % ( sColor,
+                                       self._getSeriesNameFromBits(oSeries, self.kfSeriesName_All & ~self.kfSeriesName_OsArchs),
+                                       sUnit );
+
+                            for i in range(len(oSeries.aiRevisions)):
+                                sHtml += '     <tr class="%s"><td>r%s</td><td>%s</td><td>+%s</td><td>-%s</td><td>%s</td></tr>\n' \
+                                       % ( 'tmodd' if i & 1 else 'tmeven',
+                                           oSeries.aiRevisions[i], oSeries.aiValues[i],
+                                           oSeries.aiErrorBarAbove[i], oSeries.aiErrorBarBelow[i],
+                                           oSeries.acSamples[i]);
+                    sHtml += '    </table>\n' \
+                             '   </div>\n';
+            else:
+                sHtml += '<i>No results.</i>\n';
+            sHtml += '  </div>\n'
+        sHtml += ' </div>\n';
+
+        #
+        # Finish the form.
+        #
+        if fInteractive:
+            sHtml += sEndOfForm;
+
+        return sHtml;
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuihlpform.py b/src/VBox/ValidationKit/testmanager/webui/wuihlpform.py
new file mode 100644
index 0000000..a8d3d0e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuihlpform.py
@@ -0,0 +1,828 @@
+# -*- coding: utf-8 -*-
+# $Id: wuihlpform.py $
+
+"""
+Test Manager Web-UI - Form Helpers.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Standard python imports.
+import copy;
+
+# Validation Kit imports.
+from common                         import utils;
+from common.webutils                import escapeAttr, escapeElem;
+from testmanager                    import config;
+from testmanager.core.schedgroup    import SchedGroupMemberData, SchedGroupDataEx;
+from testmanager.core.testcaseargs  import TestCaseArgsData;
+from testmanager.core.testgroup     import TestGroupMemberData, TestGroupDataEx;
+
+
+class WuiHlpForm(object):
+    """
+    Helper for constructing a form.
+    """
+
+    ksItemsList = 'ksItemsList'
+
+    def __init__(self, sId, sAction, dErrors = None, fReadOnly = False):
+        self._fFinalized = False;
+        self._fReadOnly  = fReadOnly;
+        self._dErrors    = dErrors if dErrors is not None else dict();
+        self._sBody      = u'\n' \
+                           u'<div id="%s" class="tmform">\n' \
+                           u'  <form action="%s" method="post">\n' \
+                           u'    <ul>\n' \
+                         % (sId, sAction);
+
+    def _add(self, sText):
+        """Internal worker for appending text to the body."""
+        assert not self._fFinalized;
+        if not self._fFinalized:
+            self._sBody += unicode(sText, errors='ignore') if isinstance(sText, str) else sText;
+            return True;
+        return False;
+
+    def _escapeErrorText(self, sText):
+        """Escapes error text, preserving some predefined HTML tags."""
+        if sText.find('<br>') >= 0:
+            asParts = sText.split('<br>');
+            for i in range(len(asParts)):
+                asParts[i] = escapeElem(asParts[i].strip());
+            sText = '<br>\n'.join(asParts);
+        else:
+            sText = escapeElem(sText);
+        return sText;
+
+    def _addLabel(self, sName, sLabel, sDivSubClass = 'normal'):
+        """Internal worker for adding a label."""
+        if sName in self._dErrors:
+            sError = self._dErrors[sName];
+            if utils.isString(sError):          # List error trick (it's an associative array).
+                return self._add('      <li>\n'
+                                 '        <div class="tmform-field"><div class="tmform-field-%s">\n'
+                                 '          <label for="%s" class="tmform-error-label">%s\n'
+                                 '              <span class="tmform-error-desc">%s</span>\n'
+                                 '          </label>\n'
+                                 % (escapeAttr(sDivSubClass), escapeAttr(sName), escapeElem(sLabel),
+                                    self._escapeErrorText(sError), ) );
+        return self._add('      <li>\n'
+                         '        <div class="tmform-field"><div class="tmform-field-%s">\n'
+                         '          <label  for="%s">%s</label>\n'
+                         % (escapeAttr(sDivSubClass), escapeAttr(sName), escapeElem(sLabel)) );
+
+
+    def finalize(self):
+        """
+        Finalizes the form and returns the body.
+        """
+        if not self._fFinalized:
+            self._add('    </ul>\n'
+                      '  </form>\n'
+                      '</div>\n'
+                      '<div class="clear"></div>\n'
+                     );
+        return self._sBody;
+
+    def addTextHidden(self, sName, sValue, sExtraAttribs = ''):
+        """Adds a hidden text input."""
+        return self._add('      <div class="tmform-field-hidden">\n'
+                         '        <input name="%s" id="%s" type="text" hidden%s value="%s" class="tmform-hidden">\n'
+                         '      </div>\n'
+                         '    </li>\n'
+                         % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(str(sValue)) ));
+
+    #
+    # Text input fields.
+    #
+    def addText(self, sName, sValue, sLabel, sSubClass = 'string', sExtraAttribs = '', sPostHtml = ''):
+        """Adds a text input."""
+        if self._fReadOnly:
+            return self.addTextRO(sName, sValue, sLabel, sSubClass, sExtraAttribs);
+        if sSubClass not in ('int', 'long', 'string', 'uuid', 'timestamp', 'wide'): raise Exception(sSubClass);
+        self._addLabel(sName, sLabel, sSubClass);
+        return self._add('          <input name="%s" id="%s" type="text"%s value="%s">%s\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                         % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(sValue), sPostHtml ));
+
+    def addTextRO(self, sName, sValue, sLabel, sSubClass = 'string', sExtraAttribs = '', sPostHtml = ''):
+        """Adds a read-only text input."""
+        if sSubClass not in ('int', 'long', 'string', 'uuid', 'timestamp', 'wide'): raise Exception(sSubClass);
+        self._addLabel(sName, sLabel, sSubClass);
+        return self._add('          <input name="%s" id="%s" type="text" readonly%s value="%s" class="tmform-input-readonly">%s\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                         % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(str(sValue)), sPostHtml ));
+
+    def addWideText(self, sName, sValue, sLabel, sExtraAttribs = ''):
+        """Adds a wide text input."""
+        return self.addText(sName, sValue, sLabel, 'wide', sExtraAttribs);
+
+    def addWideTextRO(self, sName, sValue, sLabel, sExtraAttribs = ''):
+        """Adds a wide read-only text input."""
+        return self.addTextRO(sName, sValue, sLabel, 'wide', sExtraAttribs);
+
+
+    def addMultilineText(self, sName, sValue, sLabel, sSubClass = 'string', sExtraAttribs = ''):
+        """Adds a multiline text input."""
+        if self._fReadOnly:
+            return self.addMultilineTextRO(sName, sValue, sLabel, sSubClass, sExtraAttribs);
+        if sSubClass not in ('int', 'long', 'string', 'uuid', 'timestamp'): raise Exception(sSubClass)
+        self._addLabel(sName, sLabel, sSubClass)
+        sNewValue = str(sValue) if not isinstance(sValue, list) else '\n'.join(sValue)
+        return self._add('          <textarea name="%s" id="%s" %s>%s</textarea>\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                         % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(sNewValue)))
+
+    def addMultilineTextRO(self, sName, sValue, sLabel, sSubClass = 'string', sExtraAttribs = ''):
+        """Adds a multiline read-only text input."""
+        if sSubClass not in ('int', 'long', 'string', 'uuid', 'timestamp'): raise Exception(sSubClass)
+        self._addLabel(sName, sLabel, sSubClass)
+        sNewValue = str(sValue) if not isinstance(sValue, list) else '\n'.join(sValue)
+        return self._add('          <textarea name="%s" id="%s" readonly %s>%s</textarea>\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                         % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(sNewValue)))
+
+    def addInt(self, sName, iValue, sLabel, sExtraAttribs = ''):
+        """Adds an integer input."""
+        return self.addText(sName, str(iValue), sLabel, 'int', sExtraAttribs);
+
+    def addIntRO(self, sName, iValue, sLabel, sExtraAttribs = ''):
+        """Adds an integer input."""
+        return self.addTextRO(sName, str(iValue), sLabel, 'int', sExtraAttribs);
+
+    def addLong(self, sName, lValue, sLabel, sExtraAttribs = ''):
+        """Adds a long input."""
+        return self.addText(sName, str(lValue), sLabel, 'long', sExtraAttribs);
+
+    def addLongRO(self, sName, lValue, sLabel, sExtraAttribs = ''):
+        """Adds a long input."""
+        return self.addTextRO(sName, str(lValue), sLabel, 'long', sExtraAttribs);
+
+    def addUuid(self, sName, uuidValue, sLabel, sExtraAttribs = ''):
+        """Adds an UUID input."""
+        return self.addText(sName, str(uuidValue), sLabel, 'uuid', sExtraAttribs);
+
+    def addUuidRO(self, sName, uuidValue, sLabel, sExtraAttribs = ''):
+        """Adds a read-only UUID input."""
+        return self.addTextRO(sName, str(uuidValue), sLabel, 'uuid', sExtraAttribs);
+
+    def addTimestampRO(self, sName, sTimestamp, sLabel, sExtraAttribs = ''):
+        """Adds a read-only database string timstamp input."""
+        return self.addTextRO(sName, sTimestamp, sLabel, 'timestamp', sExtraAttribs);
+
+
+    #
+    # Text areas.
+    #
+
+
+    #
+    # Combo boxes.
+    #
+    def addComboBox(self, sName, sSelected, sLabel, aoOptions, sExtraAttribs = ''):
+        """Adds a combo box."""
+        if self._fReadOnly:
+            return self.addComboBoxRO(sName, sSelected, sLabel, aoOptions, sExtraAttribs);
+        self._addLabel(sName, sLabel, 'combobox');
+        self._add('          <select name="%s" id="%s" class="tmform-combobox"%s>\n'
+                  % (escapeAttr(sName), escapeAttr(sName), sExtraAttribs));
+        for iValue, sText, _ in aoOptions:
+            sValue = str(iValue);
+            self._add('            <option value="%s"%s>%s</option>\n'
+                      % (escapeAttr(sValue), ' selected' if sValue == str(sSelected) else '',
+                         escapeElem(sText)));
+        return self._add('          </select>\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                        );
+
+    def addComboBoxRO(self, sName, sSelected, sLabel, aoOptions, sExtraAttribs = ''):
+        """Adds a read-only combo box."""
+        self.addTextHidden(sName, sSelected);
+        self._addLabel(sName, sLabel, 'combobox-readonly');
+        self._add('          <select name="%s" id="%s" disabled class="tmform-combobox"%s>\n'
+                  % (escapeAttr(sName), escapeAttr(sName), sExtraAttribs));
+        for iValue, sText, _ in aoOptions:
+            sValue = str(iValue);
+            self._add('            <option value="%s"%s>%s</option>\n'
+                      % (escapeAttr(sValue), ' selected' if sValue == str(sSelected) else '',
+                         escapeElem(sText)));
+        return self._add('          </select>\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                        );
+
+    #
+    # Check boxes.
+    #
+    @staticmethod
+    def _reinterpretBool(fValue):
+        """Reinterprets a value as a boolean type."""
+        if fValue is not type(True):
+            if fValue is None:
+                fValue = False;
+            elif str(fValue) in ('True', 'true', '1'):
+                fValue = True;
+            else:
+                fValue = False;
+        return fValue;
+
+    def addCheckBox(self, sName, fChecked, sLabel, sExtraAttribs = ''):
+        """Adds an check box."""
+        if self._fReadOnly:
+            return self.addCheckBoxRO(sName, fChecked, sLabel, sExtraAttribs);
+        self._addLabel(sName, sLabel, 'checkbox');
+        fChecked = self._reinterpretBool(fChecked);
+        return self._add('          <input name="%s" id="%s" type="checkbox"%s%s value="1" class="tmform-checkbox">\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                         % (escapeAttr(sName), escapeAttr(sName), ' checked' if fChecked else '', sExtraAttribs));
+
+    def addCheckBoxRO(self, sName, fChecked, sLabel, sExtraAttribs = ''):
+        """Adds an readonly check box."""
+        self._addLabel(sName, sLabel, 'checkbox');
+        fChecked = self._reinterpretBool(fChecked);
+        # Hack Alert! The onclick and onkeydown are for preventing editing and fake readonly/disabled.
+        return self._add('          <input name="%s" id="%s" type="checkbox"%s readonly%s value="1" class="readonly"\n'
+                         '              onclick="return false" onkeydown="return false">\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                         % (escapeAttr(sName), escapeAttr(sName), ' checked' if fChecked else '', sExtraAttribs));
+
+    #
+    # List of items to check
+    #
+    def _addList(self, sName, aoRows, sLabel, fUseTable = False, sId = 'dummy', sExtraAttribs = ''):
+        """
+        Adds a list of items to check.
+
+        @param sName  Name of HTML form element
+        @param aoRows  List of [sValue, fChecked, sName] sub-arrays.
+        @param sLabel Label of HTML form element
+        """
+        fReadOnly = self._fReadOnly; ## @todo add this as a parameter.
+        if fReadOnly:
+            sExtraAttribs += ' readonly onclick="return false" onkeydown="return false"';
+
+        self._addLabel(sName, sLabel, 'list');
+        if len(aoRows) == 0:
+            return self._add('No items</div></div></li>')
+        sNameEscaped = escapeAttr(sName);
+
+        self._add('          <div class="tmform-checkboxes-container" id="%s">\n' % (escapeAttr(sId),));
+        if fUseTable:
+            self._add('          <table>\n');
+            for asRow in aoRows:
+                assert len(asRow) == 3; # Don't allow sloppy input data!
+                fChecked = self._reinterpretBool(asRow[1])
+                self._add('            <tr>\n'
+                          '              <td><input type="checkbox" name="%s" value="%s"%s%s></td>\n'
+                          '              <td>%s</td>\n'
+                          '            </tr>\n'
+                          % ( sNameEscaped, escapeAttr(str(asRow[0])), ' checked' if fChecked else '', sExtraAttribs,
+                              escapeElem(str(asRow[2])), ));
+            self._add('          </table>\n');
+        else:
+            for asRow in aoRows:
+                assert len(asRow) == 3; # Don't allow sloppy input data!
+                fChecked = self._reinterpretBool(asRow[1])
+                self._add('            <div class="tmform-checkbox-holder">'
+                          '<input type="checkbox" name="%s" value="%s"%s%s> %s</input></div>\n'
+                          % ( sNameEscaped, escapeAttr(str(asRow[0])), ' checked' if fChecked else '', sExtraAttribs,
+                              escapeElem(str(asRow[2])),));
+        return self._add('        </div></div></div>\n'
+                         '      </li>\n');
+
+
+    def addListOfOsArches(self, sName, aoOsArches, sLabel, sExtraAttribs = ''):
+        """
+        List of checkboxes for OS/ARCH selection.
+        asOsArches is a list of [sValue, fChecked, sName] sub-arrays.
+        """
+        return self._addList(sName, aoOsArches, sLabel, fUseTable = False, sId = 'tmform-checkbox-list-os-arches',
+                             sExtraAttribs = sExtraAttribs);
+
+    def addListOfTypes(self, sName, aoTypes, sLabel, sExtraAttribs = ''):
+        """
+        List of checkboxes for build type selection.
+        aoTypes is a list of [sValue, fChecked, sName] sub-arrays.
+        """
+        return self._addList(sName, aoTypes, sLabel, fUseTable = False, sId = 'tmform-checkbox-list-build-types',
+                             sExtraAttribs = sExtraAttribs);
+
+    def addListOfTestCases(self, sName, aoTestCases, sLabel, sExtraAttribs = ''):
+        """
+        List of checkboxes for test box (dependency) selection.
+        aoTestCases is a list of [sValue, fChecked, sName] sub-arrays.
+        """
+        return self._addList(sName, aoTestCases, sLabel, fUseTable = False, sId = 'tmform-checkbox-list-testcases',
+                             sExtraAttribs = sExtraAttribs);
+
+    def addListOfResources(self, sName, aoTestCases, sLabel, sExtraAttribs = ''):
+        """
+        List of checkboxes for resource selection.
+        aoTestCases is a list of [sValue, fChecked, sName] sub-arrays.
+        """
+        return self._addList(sName, aoTestCases, sLabel, fUseTable = False, sId = 'tmform-checkbox-list-resources',
+                             sExtraAttribs = sExtraAttribs);
+
+    def addListOfTestGroups(self, sName, aoTestGroups, sLabel, sExtraAttribs = ''):
+        """
+        List of checkboxes for test group selection.
+        aoTestGroups is a list of [sValue, fChecked, sName] sub-arrays.
+        """
+        return self._addList(sName, aoTestGroups, sLabel, fUseTable = False, sId = 'tmform-checkbox-list-testgroups',
+                             sExtraAttribs = sExtraAttribs);
+
+    def addListOfTestCaseArgs(self, sName, aoVariations, sLabel): # pylint: disable=R0915
+        """
+        Adds a list of test case argument variations to the form.
+
+        @param sName        Name of HTML form element
+        @param aoVariations List of TestCaseArgsData instances.
+        @param sLabel       Label of HTML form element
+        """
+        self._addLabel(sName, sLabel);
+
+        sTableId = 'TestArgsExtendingListRoot';
+        fReadOnly = self._fReadOnly;  ## @todo argument?
+        sReadOnlyAttr = ' readonly class="tmform-input-readonly"' if fReadOnly else '';
+
+        sHtml  = '<li>\n'
+
+        #
+        # Define javascript function for extending the list of test case
+        # variations.  Doing it here so we can use the python constants. This
+        # also permits multiple argument lists on one page should that ever be
+        # required...
+        #
+        if not fReadOnly:
+            sHtml += '<script type="text/javascript">\n'
+            sHtml += '\n';
+            sHtml += 'g_%s_aItems = { %s };\n' % (sName, ', '.join(('%s: 1' % (i,)) for i in range(len(aoVariations))),);
+            sHtml += 'g_%s_cItems = %s;\n' % (sName, len(aoVariations),);
+            sHtml += 'g_%s_iIdMod = %s;\n' % (sName, len(aoVariations) + 32);
+            sHtml += '\n';
+            sHtml += 'function %s_removeEntry(sId)\n' % (sName,);
+            sHtml += '{\n';
+            sHtml += '    if (g_%s_cItems > 1)\n' % (sName,);
+            sHtml += '    {\n';
+            sHtml += '        g_%s_cItems--;\n' % (sName,);
+            sHtml += '        delete g_%s_aItems[sId];\n' % (sName,);
+            sHtml += '        setElementValueToKeyList(\'%s\', g_%s_aItems);\n' % (sName, sName);
+            sHtml += '\n';
+            for iInput in range(8):
+                sHtml += '        removeHtmlNode(\'%s[\' + sId + \'][%s]\');\n' % (sName, iInput,);
+            sHtml += '    }\n';
+            sHtml += '}\n';
+            sHtml += '\n';
+            sHtml += 'function %s_extendListEx(cGangMembers, cSecTimeout, sArgs, sTestBoxReqExpr, sBuildReqExpr)\n' % (sName,);
+            sHtml += '{\n';
+            sHtml += '    var oElement = document.getElementById(\'%s\');\n' % (sTableId,);
+            sHtml += '    var oTBody   = document.createElement(\'tbody\');\n';
+            sHtml += '    var sHtml    = \'\';\n';
+            sHtml += '    var sId;\n';
+            sHtml += '\n';
+            sHtml += '    g_%s_iIdMod += 1;\n' % (sName,);
+            sHtml += '    sId = g_%s_iIdMod.toString();\n' % (sName,);
+
+            oVarDefaults = TestCaseArgsData();
+            oVarDefaults.convertToParamNull();
+            sHtml += '\n';
+            sHtml += '    sHtml += \'<tr class="tmform-testcasevars-first-row">\';\n';
+            sHtml += '    sHtml += \'  <td>Gang Members:</td>\';\n';
+            sHtml += '    sHtml += \'  <td class="tmform-field-tiny-int">' \
+                     '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][0]" value="\' + cGangMembers + \'"></td>\';\n' \
+                   % (sName, TestCaseArgsData.ksParam_cGangMembers, sName,);
+            sHtml += '    sHtml += \'  <td>Timeout:</td>\';\n';
+            sHtml += '    sHtml += \'  <td class="tmform-field-int">' \
+                     '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][1]" value="\'+ cSecTimeout + \'"></td>\';\n' \
+                   % (sName, TestCaseArgsData.ksParam_cSecTimeout, sName,);
+            sHtml += '    sHtml += \'  <td><a href="#" onclick="%s_removeEntry(\\\'\' + sId + \'\\\');"> Remove</a></td>\';\n' \
+                   % (sName, );
+            sHtml += '    sHtml += \'  <td></td>\';\n';
+            sHtml += '    sHtml += \'</tr>\';\n'
+            sHtml += '\n';
+            sHtml += '    sHtml += \'<tr class="tmform-testcasevars-inner-row">\';\n';
+            sHtml += '    sHtml += \'  <td>Arguments:</td>\';\n';
+            sHtml += '    sHtml += \'  <td class="tmform-field-wide100" colspan="4">' \
+                     '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sArgs + \'"></td>\';\n' \
+                   % (sName, TestCaseArgsData.ksParam_sArgs, sName,);
+            sHtml += '    sHtml += \'  <td></td>\';\n';
+            sHtml += '    sHtml += \'</tr>\';\n'
+            sHtml += '\n';
+            sHtml += '    sHtml += \'<tr class="tmform-testcasevars-inner-row">\';\n';
+            sHtml += '    sHtml += \'  <td>TestBox Reqs:</td>\';\n';
+            sHtml += '    sHtml += \'  <td class="tmform-field-wide100" colspan="4">' \
+                     '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sTestBoxReqExpr' \
+                     ' + \'"></td>\';\n' \
+                   % (sName, TestCaseArgsData.ksParam_sTestBoxReqExpr, sName,);
+            sHtml += '    sHtml += \'  <td></td>\';\n';
+            sHtml += '    sHtml += \'</tr>\';\n'
+            sHtml += '\n';
+            sHtml += '    sHtml += \'<tr class="tmform-testcasevars-final-row">\';\n';
+            sHtml += '    sHtml += \'  <td>Build Reqs:</td>\';\n';
+            sHtml += '    sHtml += \'  <td class="tmform-field-wide100" colspan="4">' \
+                     '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sBuildReqExpr + \'"></td>\';\n' \
+                   % (sName, TestCaseArgsData.ksParam_sBuildReqExpr, sName,);
+            sHtml += '    sHtml += \'  <td></td>\';\n';
+            sHtml += '    sHtml += \'</tr>\';\n'
+            sHtml += '\n';
+            sHtml += '    oTBody.id = \'%s[\' + sId + \'][6]\';\n' % (sName,);
+            sHtml += '    oTBody.innerHTML = sHtml;\n';
+            sHtml += '\n';
+            sHtml += '    oElement.appendChild(oTBody);\n';
+            sHtml += '\n';
+            sHtml += '    g_%s_aItems[sId] = 1;\n' % (sName,);
+            sHtml += '    g_%s_cItems++;\n' % (sName,);
+            sHtml += '    setElementValueToKeyList(\'%s\', g_%s_aItems);\n' % (sName, sName);
+            sHtml += '}\n';
+            sHtml += 'function %s_extendList()\n' % (sName,);
+            sHtml += '{\n';
+            sHtml += '    %s_extendListEx("%s", "%s", "%s", "%s", "%s");\n' % (sName,
+                escapeAttr(str(oVarDefaults.cGangMembers)), escapeAttr(str(oVarDefaults.cSecTimeout)),
+                escapeAttr(oVarDefaults.sArgs), escapeAttr(oVarDefaults.sTestBoxReqExpr),
+                escapeAttr(oVarDefaults.sBuildReqExpr), );
+            sHtml += '}\n';
+            if config.g_kfVBoxSpecific:
+                sSecTimeoutDef = escapeAttr(str(oVarDefaults.cSecTimeout));
+                sHtml += 'function vbox_%s_add_uni()\n' % (sName,);
+                sHtml += '{\n';
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes raw", ' \
+                         ' "", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt", ' \
+                         ' "fCpuHwVirt is True", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt-np", ' \
+                         ' "fCpuNestedPaging is True", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '}\n';
+                sHtml += 'function vbox_%s_add_uni_amd64()\n' % (sName,);
+                sHtml += '{\n';
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt", ' \
+                         ' "fCpuHwVirt is True", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt-np", ' \
+                         ' "fCpuNestedPaging is True", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '}\n';
+                sHtml += 'function vbox_%s_add_smp()\n' % (sName,);
+                sHtml += '{\n';
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 2 --virt-modes hwvirt",' \
+                         ' "fCpuHwVirt is True and cCpus >= 2", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 2 --virt-modes hwvirt-np",' \
+                         ' "fCpuNestedPaging is True and cCpus >= 2", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 3 --virt-modes hwvirt",' \
+                         ' "fCpuHwVirt is True and cCpus >= 3", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 4 --virt-modes hwvirt-np ",' \
+                         ' "fCpuNestedPaging is True and cCpus >= 4", "");\n' % (sName, sSecTimeoutDef);
+                #sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 6 --virt-modes hwvirt",' \
+                #         ' "fCpuHwVirt is True and cCpus >= 6", "");\n' % (sName, sSecTimeoutDef);
+                #sHtml += '    %s_extendListEx("1", "%s", "--cpu-counts 8 --virt-modes hwvirt-np",' \
+                #         ' "fCpuNestedPaging is True and cCpus >= 8", "");\n' % (sName, sSecTimeoutDef);
+                sHtml += '}\n';
+            sHtml += '</script>\n';
+
+
+        #
+        # List current entries.
+        #
+        sHtml += '<input type="hidden" name="%s" id="%s" value="%s">\n' \
+               % (sName, sName, ','.join(str(i) for i in range(len(aoVariations))), );
+        sHtml += '  <table id="%s" class="tmform-testcasevars">\n' % (sTableId,)
+        if not fReadOnly:
+            sHtml += '  <caption>\n' \
+                     '    <a href="#" onClick="%s_extendList()">Add</a>\n' % (sName,);
+            if config.g_kfVBoxSpecific:
+                sHtml += '    [<a href="#" onClick="vbox_%s_add_uni()">Single CPU Variations</a>\n' % (sName,);
+                sHtml += '    <a href="#" onClick="vbox_%s_add_uni_amd64()">amd64</a>]\n' % (sName,);
+                sHtml += '    [<a href="#" onClick="vbox_%s_add_smp()">SMP Variations</a>]\n' % (sName,);
+            sHtml += '  </caption>\n';
+
+        dSubErrors = {};
+        if sName in self._dErrors  and  isinstance(self._dErrors[sName], dict):
+            dSubErrors = self._dErrors[sName];
+
+        for iVar in range(len(aoVariations)):
+            oVar = copy.copy(aoVariations[iVar]);
+            oVar.convertToParamNull();
+
+            sHtml += '<tbody id="%s[%s][6]">\n' % (sName, iVar,)
+            sHtml += '  <tr class="tmform-testcasevars-first-row">\n' \
+                     '    <td>Gang Members:</td>' \
+                     '    <td class="tmform-field-tiny-int"><input name="%s[%s][%s]" id="%s[%s][1]" value="%s"%s></td>\n' \
+                     '    <td>Timeout:</td>' \
+                     '    <td class="tmform-field-int"><input name="%s[%s][%s]" id="%s[%s][2]" value="%s"%s></td>\n' \
+                   % ( sName, iVar, TestCaseArgsData.ksParam_cGangMembers, sName, iVar, oVar.cGangMembers, sReadOnlyAttr,
+                       sName, iVar, TestCaseArgsData.ksParam_cSecTimeout,  sName, iVar,
+                       utils.formatIntervalSeconds2(oVar.cSecTimeout), sReadOnlyAttr, );
+            if not fReadOnly:
+                sHtml += '    <td><a href="#" onclick="%s_removeEntry(\'%s\');">Remove</a></td>\n' \
+                       % (sName, iVar);
+            else:
+                sHtml +=  '    <td></td>\n';
+            sHtml += '    <td class="tmform-testcasevars-stupid-border-column"></td>\n' \
+                     '  </tr>\n';
+
+            sHtml += '  <tr class="tmform-testcasevars-inner-row">\n' \
+                     '    <td>Arguments:</td>' \
+                     '    <td class="tmform-field-wide100" colspan="4">' \
+                     '<input name="%s[%s][%s]" id="%s[%s][3]" value="%s"%s></td>\n' \
+                     '    <td></td>\n' \
+                     '  </tr>\n' \
+                   % ( sName, iVar, TestCaseArgsData.ksParam_sArgs, sName, iVar, escapeAttr(oVar.sArgs), sReadOnlyAttr)
+
+            sHtml += '  <tr class="tmform-testcasevars-inner-row">\n' \
+                     '    <td>TestBox Reqs:</td>' \
+                     '    <td class="tmform-field-wide100" colspan="4">' \
+                     '<input name="%s[%s][%s]" id="%s[%s][4]" value="%s"%s></td>\n' \
+                     '    <td></td>\n' \
+                     '  </tr>\n' \
+                   % ( sName, iVar, TestCaseArgsData.ksParam_sTestBoxReqExpr, sName, iVar,
+                       escapeAttr(oVar.sTestBoxReqExpr), sReadOnlyAttr)
+
+            sHtml += '  <tr class="tmform-testcasevars-final-row">\n' \
+                     '    <td>Build Reqs:</td>' \
+                     '    <td class="tmform-field-wide100" colspan="4">' \
+                     '<input name="%s[%s][%s]" id="%s[%s][5]" value="%s"%s></td>\n' \
+                     '    <td></td>\n' \
+                     '  </tr>\n' \
+                   % ( sName, iVar, TestCaseArgsData.ksParam_sBuildReqExpr, sName, iVar,
+                       escapeAttr(oVar.sBuildReqExpr), sReadOnlyAttr)
+
+
+            if iVar in dSubErrors:
+                sHtml += '  <tr><td colspan="4"><p align="left" class="tmform-error-desc">%s</p></td></tr>\n' \
+                       % (self._escapeErrorText(dSubErrors[iVar]),);
+
+            sHtml += '</tbody>\n';
+        sHtml += '  </table>\n'
+        sHtml += '</li>\n'
+
+        return self._add(sHtml)
+
+    def addListOfTestGroupMembers(self, sName, aoTestGroupMembers, aoAllTestCases, sLabel,  # pylint: disable=R0914
+                                  fReadOnly = True):
+        """
+        For WuiTestGroup.
+        """
+        assert len(aoTestGroupMembers) <= len(aoAllTestCases);
+        self._addLabel(sName, sLabel);
+        if len(aoAllTestCases) == 0:
+            return self._add('<li>No testcases available.</li>\n')
+
+        self._add('<input name="%s" type="hidden" value="%s">\n'
+                  % ( TestGroupDataEx.ksParam_aidTestCases,
+                      ','.join([str(oTestCase.idTestCase) for oTestCase in aoAllTestCases]), ));
+
+        self._add('<table class="tmformtbl">\n'
+                  ' <thead>\n'
+                  '  <tr>\n'
+                  '    <th rowspan="2"></th>\n'
+                  '    <th rowspan="2">Test Case</th>\n'
+                  '    <th rowspan="2">All Vars</th>\n'
+                  '    <th rowspan="2">Priority [0..31]</th>\n'
+                  '    <th colspan="4" align="center">Variations</th>\n'
+                  '  </tr>\n'
+                  '  <tr>\n'
+                  '    <th>Included</th>\n'
+                  '    <th>Gang size</th>\n'
+                  '    <th>Timeout</th>\n'
+                  '    <th>Arguments</th>\n'
+                  '  </tr>\n'
+                  ' </thead>\n'
+                  ' <tbody>\n'
+                  );
+
+        if self._fReadOnly:
+            fReadOnly = True;
+        sCheckBoxAttr = ' readonly onclick="return false" onkeydown="return false"' if fReadOnly else '';
+
+        oDefMember = TestGroupMemberData();
+        aoTestGroupMembers = list(aoTestGroupMembers); # Copy it so we can pop.
+        for iTestCase in range(len(aoAllTestCases)):
+            oTestCase = aoAllTestCases[iTestCase];
+
+            # Is it a member?
+            oMember = None;
+            for i in range(len(aoTestGroupMembers)):
+                if aoTestGroupMembers[i].oTestCase.idTestCase == oTestCase.idTestCase:
+                    oMember = aoTestGroupMembers.pop(i);
+                    break;
+
+            # Start on the rows...
+            sPrefix = '%s[%d]' % (sName, oTestCase.idTestCase,);
+            self._add('  <tr class="%s">\n'
+                      '    <td rowspan="%d">\n'
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # idTestCase
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # idTestGroup
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # tsExpire
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # tsEffective
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # uidAuthor
+                      '      <input name="%s" type="checkbox"%s%s value="%d" class="tmform-checkbox" title="#%d - %s">\n' # (list)
+                      '    </td>\n'
+                      % ( 'tmodd' if iTestCase & 1 else 'tmeven',
+                          len(oTestCase.aoTestCaseArgs),
+                          sPrefix, TestGroupMemberData.ksParam_idTestCase,  oTestCase.idTestCase,
+                          sPrefix, TestGroupMemberData.ksParam_idTestGroup, -1 if oMember is None else oMember.idTestGroup,
+                          sPrefix, TestGroupMemberData.ksParam_tsExpire,    '' if oMember is None else oMember.tsExpire,
+                          sPrefix, TestGroupMemberData.ksParam_tsEffective, '' if oMember is None else oMember.tsEffective,
+                          sPrefix, TestGroupMemberData.ksParam_uidAuthor,   '' if oMember is None else oMember.uidAuthor,
+                          TestGroupDataEx.ksParam_aoMembers, '' if oMember is None else ' checked', sCheckBoxAttr,
+                          oTestCase.idTestCase, oTestCase.idTestCase, escapeElem(oTestCase.sName),
+                          ));
+            self._add('    <td rowspan="%d" align="left">%s</td>\n'
+                      % ( len(oTestCase.aoTestCaseArgs), escapeElem(oTestCase.sName), ));
+
+            self._add('    <td rowspan="%d" title="Include all variations (checked) or choose a set?">\n'
+                      '      <input name="%s[%s]" type="checkbox"%s%s value="-1">\n'
+                      '    </td>\n'
+                      % ( len(oTestCase.aoTestCaseArgs),
+                          sPrefix, TestGroupMemberData.ksParam_aidTestCaseArgs,
+                          ' checked' if oMember is None  or  oMember.aidTestCaseArgs is None else '', sCheckBoxAttr, ));
+
+            self._add('    <td rowspan="%d" align="center">\n'
+                      '      <input name="%s[%s]" type="text" value="%s" style="max-width:3em;" %s>\n'
+                      '    </td>\n'
+                      % ( len(oTestCase.aoTestCaseArgs),
+                          sPrefix, TestGroupMemberData.ksParam_iSchedPriority,
+                          (oMember if oMember is not None else oDefMember).iSchedPriority,
+                          ' readonly class="tmform-input-readonly"' if fReadOnly else '', ));
+
+            # Argument variations.
+            aidTestCaseArgs = [] if oMember is None or oMember.aidTestCaseArgs is None else oMember.aidTestCaseArgs;
+            for iVar in range(len(oTestCase.aoTestCaseArgs)):
+                oVar = oTestCase.aoTestCaseArgs[iVar];
+                if iVar > 0:
+                    self._add('  <tr class="%s">\n' % ('tmodd' if iTestCase & 1 else 'tmeven',));
+                self._add('   <td align="center">\n'
+                          '     <input name="%s[%s]" type="checkbox"%s%s value="%d">'
+                          '   </td>\n'
+                          % ( sPrefix, TestGroupMemberData.ksParam_aidTestCaseArgs,
+                              ' checked' if oVar.idTestCaseArgs in aidTestCaseArgs else '', sCheckBoxAttr, oVar.idTestCaseArgs,
+                              ));
+                self._add('   <td align="center">%s</td>\n'
+                          '   <td align="center">%s</td>\n'
+                          '   <td align="left">%s</td>\n'
+                          % ( oVar.cGangMembers,
+                              'Default' if oVar.cSecTimeout is None else oVar.cSecTimeout,
+                              escapeElem(oVar.sArgs) ));
+
+                self._add('  </tr>\n');
+
+
+
+            if len(oTestCase.aoTestCaseArgs) == 0:
+                self._add('    <td></td> <td></td> <td></td> <td></td>\n'
+                          '  </tr>\n');
+        return self._add(' </tbody>\n'
+                         '</table>\n');
+
+    def addListOfSchedGroupMembers(self, sName, aoSchedGroupMembers, aoAllTestGroups,  # pylint: disable=R0914
+                                   sLabel, fReadOnly = True):
+        """
+        For WuiAdminSchedGroup.
+        """
+        if self._fReadOnly:
+            fReadOnly = True;
+        assert len(aoSchedGroupMembers) <= len(aoAllTestGroups);
+        self._addLabel(sName, sLabel);
+        if len(aoAllTestGroups) == 0:
+            return self._add('<li>No test groups available.</li>\n')
+
+        self._add('<input name="%s" type="hidden" value="%s">\n'
+                  % ( SchedGroupDataEx.ksParam_aidTestGroups,
+                      ','.join([str(oTestGroup.idTestGroup) for oTestGroup in aoAllTestGroups]), ));
+
+        self._add('<table class="tmformtbl">\n'
+                  ' <thead>\n'
+                  '  <tr>\n'
+                  '    <th></th>\n'
+                  '    <th>Test Group</th>\n'
+                  '    <th>Priority [0..31]</th>\n'
+                  '    <th>Prerequisite Test Group</th>\n'
+                  '    <th>Weekly schedule</th>\n'
+                  '  </tr>\n'
+                  ' </thead>\n'
+                  ' <tbody>\n'
+                  );
+
+        sCheckBoxAttr = ' readonly onclick="return false" onkeydown="return false"' if fReadOnly else '';
+        sComboBoxAttr = ' disabled' if fReadOnly else '';
+
+        oDefMember = SchedGroupMemberData();
+        aoSchedGroupMembers = list(aoSchedGroupMembers); # Copy it so we can pop.
+        for iTestGroup in range(len(aoAllTestGroups)):
+            oTestGroup = aoAllTestGroups[iTestGroup];
+
+            # Is it a member?
+            oMember = None;
+            for i in range(len(aoSchedGroupMembers)):
+                if aoSchedGroupMembers[i].oTestGroup.idTestGroup == oTestGroup.idTestGroup:
+                    oMember = aoSchedGroupMembers.pop(i);
+                    break;
+
+            # Start on the rows...
+            sPrefix = '%s[%d]' % (sName, oTestGroup.idTestGroup,);
+            self._add('  <tr class="%s">\n'
+                      '    <td>\n'
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # idTestGroup
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # idSchedGroup
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # tsExpire
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # tsEffective
+                      '      <input name="%s[%s]" type="hidden" value="%s">\n' # uidAuthor
+                      '      <input name="%s" type="checkbox"%s%s value="%d" class="tmform-checkbox" title="#%d - %s">\n' # (list)
+                      '    </td>\n'
+                      % ( 'tmodd' if iTestGroup & 1 else 'tmeven',
+                          sPrefix, SchedGroupMemberData.ksParam_idTestGroup,    oTestGroup.idTestGroup,
+                          sPrefix, SchedGroupMemberData.ksParam_idSchedGroup,   -1 if oMember is None else oMember.idSchedGroup,
+                          sPrefix, SchedGroupMemberData.ksParam_tsExpire,       '' if oMember is None else oMember.tsExpire,
+                          sPrefix, SchedGroupMemberData.ksParam_tsEffective,    '' if oMember is None else oMember.tsEffective,
+                          sPrefix, SchedGroupMemberData.ksParam_uidAuthor,      '' if oMember is None else oMember.uidAuthor,
+                          SchedGroupDataEx.ksParam_aoMembers, '' if oMember is None else ' checked', sCheckBoxAttr,
+                          oTestGroup.idTestGroup, oTestGroup.idTestGroup, escapeElem(oTestGroup.sName),
+                          ));
+            self._add('    <td align="left">%s</td>\n' % ( escapeElem(oTestGroup.sName), ));
+
+            self._add('    <td align="center">\n'
+                      '      <input name="%s[%s]" type="text" value="%s" style="max-width:3em;" %s>\n'
+                      '    </td>\n'
+                      % ( sPrefix, SchedGroupMemberData.ksParam_iSchedPriority,
+                          (oMember if oMember is not None else oDefMember).iSchedPriority,
+                          ' readonly class="tmform-input-readonly"' if fReadOnly else '', ));
+
+            self._add('    <td align="center">\n'
+                      '      <select name="%s[%s]" id="%s[%s]" class="tmform-combobox"%s>\n'
+                      '        <option value="-1"%s>None</option>\n'
+                      % ( sPrefix, SchedGroupMemberData.ksParam_idTestGroupPreReq,
+                          sPrefix, SchedGroupMemberData.ksParam_idTestGroupPreReq,
+                          sComboBoxAttr,
+                          ' selected' if oMember is None or oMember.idTestGroupPreReq is None else '',
+                          ));
+            for oTestGroup2 in aoAllTestGroups:
+                if oTestGroup2 != oTestGroup:
+                    fSelected = oMember is not None and oTestGroup2.idTestGroup == oMember.idTestGroupPreReq;
+                    self._add('        <option value="%s"%s>%s</option>\n'
+                              % ( oTestGroup2.idTestGroup, ' selected' if fSelected else '', escapeElem(oTestGroup2.sName), ));
+            self._add('      </select>\n'
+                      '    </td>\n');
+
+            self._add('    <td align="left">\n'
+                      '      Todo<input name="%s[%s]" type="hidden" value="%s">\n'
+                      '    </td>\n'
+                      % ( sPrefix, SchedGroupMemberData.ksParam_bmHourlySchedule,
+                          '' if oMember is None else oMember.bmHourlySchedule, ));
+
+            self._add('  </tr>\n');
+        return self._add(' </tbody>\n'
+                         '</table>\n');
+
+    #
+    # Buttons.
+    #
+    def addSubmit(self, sLabel = 'Submit'):
+        """Adds the submit button to the form."""
+        if self._fReadOnly:
+            return True;
+        return self._add('      <li>\n'
+                         '        <br>\n'
+                         '        <div class="tmform-field"><div class="tmform-field-submit">\n'
+                         '           <label> </label>\n'
+                         '           <input type="submit" value="%s">\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                         % (escapeElem(sLabel),));
+
+    def addReset(self):
+        """Adds a reset button to the form."""
+        if self._fReadOnly:
+            return True;
+        return self._add('      <li>\n'
+                         '        <div class="tmform-button"><div class="tmform-button-reset">\n'
+                         '          <input type="reset" value="%s">\n'
+                         '        </div></div>\n'
+                         '      </li>\n'
+                        );
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuihlpgraph.py b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraph.py
new file mode 100644
index 0000000..ce2ac66
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraph.py
@@ -0,0 +1,115 @@
+# -*- coding: utf-8 -*-
+# $Id: wuihlpgraph.py $
+
+"""
+Test Manager Web-UI - Graph Helpers.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+class WuiHlpGraphDataTable(object): # pylint: disable=R0903
+    """
+    Data table container.
+    """
+
+    class Row(object): # pylint: disable=R0903
+        """A row."""
+        def __init__(self, sGroup, aoValues, asValues = None):
+            self.sName    = sGroup;
+            self.aoValues = aoValues;
+            if asValues is None:
+                self.asValues = [str(oVal) for oVal in aoValues];
+            else:
+                assert len(asValues) == len(aoValues);
+                self.asValues = asValues;
+
+    def __init__(self, sGroupLable, asMemberLabels):
+        self.aoTable = [ WuiHlpGraphDataTable.Row(sGroupLable, asMemberLabels), ];
+
+    def addRow(self, sGroup, aoValues, asValues = None):
+        """Adds a row to the data table."""
+        self.aoTable.append(WuiHlpGraphDataTable.Row(sGroup, aoValues, asValues));
+        return True;
+
+    def getGroupCount(self):
+        """Gets the number of data groups (rows)."""
+        return len(self.aoTable) - 1;
+
+
+class WuiHlpGraphDataTableEx(object): # pylint: disable=R0903
+    """
+    Data container for an table/graph with optional error bars on the Y values.
+    """
+
+    class DataSeries(object): # pylint: disable=R0903
+        """
+        A data series.
+
+        The aoXValues, aoYValues and aoYErrorBars are parallel arrays, making a
+        series of (X,Y,Y-err-above-delta,Y-err-below-delta) points.
+
+        The error bars are optional.
+        """
+        def __init__(self, sName, aoXValues, aoYValues, asHtmlTooltips = None, aoYErrorBarBelow = None, aoYErrorBarAbove = None):
+            self.sName            = sName;
+            self.aoXValues        = aoXValues;
+            self.aoYValues        = aoYValues;
+            self.asHtmlTooltips   = asHtmlTooltips;
+            self.aoYErrorBarBelow = aoYErrorBarBelow;
+            self.aoYErrorBarAbove = aoYErrorBarAbove;
+
+    def __init__(self, sXUnit, sYUnit):
+        self.sXUnit   = sXUnit;
+        self.sYUnit   = sYUnit;
+        self.aoSeries = [];
+
+    def addDataSeries(self, sName, aoXValues, aoYValues, asHtmlTooltips = None, aoYErrorBarBelow = None, aoYErrorBarAbove = None):
+        """Adds an data series to the table."""
+        self.aoSeries.append(WuiHlpGraphDataTableEx.DataSeries(sName, aoXValues, aoYValues, asHtmlTooltips,
+                                                               aoYErrorBarBelow, aoYErrorBarAbove));
+        return True;
+
+    def getDataSeriesCount(self):
+        """Gets the number of data series."""
+        return len(self.aoSeries);
+
+
+#
+# Dynamically choose implementation.
+#
+if True:
+    from testmanager.webui import wuihlpgraphgooglechart        as GraphImplementation;
+else:
+    try:
+        import matplotlib; # pylint: disable=W0611,F0401
+        from testmanager.webui import wuihlpgraphmatplotlib     as GraphImplementation;
+    except:
+        from testmanager.webui import wuihlpgraphsimple         as GraphImplementation;
+
+# pylint: disable=C0103
+WuiHlpBarGraph              = GraphImplementation.WuiHlpBarGraph;
+WuiHlpLineGraph             = GraphImplementation.WuiHlpLineGraph;
+WuiHlpLineGraphErrorbarY    = GraphImplementation.WuiHlpLineGraphErrorbarY;
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphbase.py b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphbase.py
new file mode 100644
index 0000000..682be64
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphbase.py
@@ -0,0 +1,121 @@
+# -*- coding: utf-8 -*-
+# $Id: wuihlpgraphbase.py $
+
+"""
+Test Manager Web-UI - Graph Helpers - Base Class.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+class WuiHlpGraphBase(object):
+    """
+    Base class for the Graph helpers.
+    """
+
+    ## Set of colors that can be used by child classes to color data series.
+    kasColors = \
+    [
+        '#0000ff', # Blue
+        '#00ff00', # Green
+        '#ff0000', # Red
+        '#000000', # Black
+
+        '#00ffff', # Cyan/Aqua
+        '#ff00ff', # Magenta/Fuchsia
+        '#ffff00', # Yellow
+        '#8b4513', # SaddleBrown
+
+        '#7b68ee', # MediumSlateBlue
+        '#ffc0cb', # Pink
+        '#bdb76b', # DarkKhaki
+        '#008080', # Teal
+
+        '#bc8f8f', # RosyBrown
+        '#000080', # Navy(Blue)
+        '#dc143c', # Crimson
+        '#800080', # Purple
+
+        '#daa520', # Goldenrod
+        '#40e0d0', # Turquoise
+        '#00bfff', # DeepSkyBlue
+        '#c0c0c0', # Silver
+    ];
+
+
+    def __init__(self, sId, oData, oDisp):
+        self._sId           = sId;
+        self._oData         = oData;
+        self._oDisp         = oDisp;
+        # Graph output dimensions.
+        self._cxGraph       = 1024;
+        self._cyGraph       = 448;
+        self._cDpiGraph     = 96;
+        # Other graph attributes
+        self._sTitle        = None;
+        self._cPtFont       = 8;
+
+    def headerContent(self):
+        """
+        Returns content that goes into the HTML header.
+        """
+        return '';
+
+    def renderGraph(self):
+        """
+        Renders the graph.
+        Returning HTML.
+        """
+        return '<p>renderGraph needs to be overridden by the child class!</p>';
+
+    def setTitle(self, sTitle):
+        """ Sets the graph title. """
+        self._sTitle = sTitle;
+        return True;
+
+    def setWidth(self, cx):
+        """ Sets the graph width. """
+        self._cxGraph = cx;
+        return True;
+
+    def setHeight(self, cy):
+        """ Sets the graph height. """
+        self._cyGraph = cy;
+        return True;
+
+    def setDpi(self, cDotsPerInch):
+        """ Sets the graph DPI. """
+        self._cDpiGraph = cDotsPerInch;
+        return True;
+
+    def setFontSize(self, cPtFont):
+        """ Sets the default font size. """
+        self._cPtFont = cPtFont;
+        return True;
+
+
+    @staticmethod
+    def calcSeriesColor(iSeries):
+        """ Returns a #rrggbb color code for the given series. """
+        return WuiHlpGraphBase.kasColors[iSeries % len(WuiHlpGraphBase.kasColors)];
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphgooglechart.py b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphgooglechart.py
new file mode 100644
index 0000000..f907341
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphgooglechart.py
@@ -0,0 +1,246 @@
+# -*- coding: utf-8 -*-
+# $Id: wuihlpgraphgooglechart.py $
+
+"""
+Test Manager Web-UI - Graph Helpers - Implemented using Google Charts.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 97393 $"
+
+# Validation Kit imports.
+from testmanager.webui.wuihlpgraphbase  import WuiHlpGraphBase;
+from common                             import webutils;
+
+
+#*******************************************************************************
+#*  Global Variables                                                           *
+#*******************************************************************************
+g_cGraphs = 0;
+
+class WuiHlpGraphGoogleChartsBase(WuiHlpGraphBase):
+    """ Base class for the Google Charts graphs. """
+    pass;
+
+
+## @todo bar graphs later.
+from testmanager.webui import wuihlpgraphsimple;
+WuiHlpBarGraph = wuihlpgraphsimple.WuiHlpBarGraph;
+
+
+class WuiHlpLineGraph(WuiHlpGraphGoogleChartsBase):
+    """
+    Line graph.
+    """
+
+    ## @todo implement error bars.
+    kfNoErrorBarsSupport = True;
+
+    def __init__(self, sId, oData, oDisp = None, fErrorBarY = False):
+        # oData must be a WuiHlpGraphDataTableEx like object.
+        WuiHlpGraphGoogleChartsBase.__init__(self, sId, oData, oDisp);
+        self._cMaxErrorBars = 12;
+        self._fErrorBarY    = fErrorBarY;
+
+    def setErrorBarY(self, fEnable):
+        """ Enables or Disables error bars, making this work like a line graph. """
+        self._fErrorBarY = fEnable;
+        return True;
+
+    def renderGraph(self): # pylint: disable=R0914
+        fSlideFilter = True;
+
+        # Tooltips?
+        cTooltips = 0;
+        for oSeries in self._oData.aoSeries:
+            cTooltips += oSeries.asHtmlTooltips is not None;
+
+        # Unique on load function.
+        global g_cGraphs;
+        iGraph = g_cGraphs;
+        g_cGraphs += 1;
+
+        sHtml  = '<div id="%s">\n' % ( self._sId, );
+        if fSlideFilter:
+            sHtml += ' <table><tr><td><div id="%s_graph"/></td></tr><tr><td><div id="%s_filter"/></td></tr></table>\n' \
+                   % ( self._sId, self._sId, );
+
+        sHtml += '<script type="text/javascript" src="https://www.google.com/jsapi"></script>\n' \
+                 '<script type="text/javascript">\n' \
+                 'google.load("visualization", "1.0", { packages: ["corechart"%s] });\n' \
+                 'google.setOnLoadCallback(tmDrawLineGraph%u);\n' \
+                 'function tmDrawLineGraph%u()\n' \
+                 '{\n' \
+                 '    var fnResize;\n' \
+                 '    var fnRedraw;\n' \
+                 '    var idRedrawTimer = null;\n' \
+                 '    var cxCur = getElementWidthById("%s") - 20;\n' \
+                 '    var oGraph;\n' \
+                 '    var oData = new google.visualization.DataTable();\n' \
+                 '    var fpXYRatio = %u / %u;\n' \
+                 '    var dGraphOptions = \n' \
+                 '    {\n' \
+                 '         "title":     "%s",\n' \
+                 '         "width":     cxCur,\n' \
+                 '         "height":    Math.round(cxCur / fpXYRatio),\n' \
+                 '         "pointSize": 2,\n' \
+                 '         "fontSize": %u,\n' \
+                 '         "hAxis":     { "title": "%s", "minorGridlines": { count: 5 }},\n' \
+                 '         "vAxis":     { "title": "%s", "minorGridlines": { count: 5 }},\n' \
+                 '         "theme":     "maximized",\n' \
+                 '         "tooltip":   { "isHtml": %s }\n' \
+                 '    };\n' \
+                % ( ', "controls"' if fSlideFilter else '',
+                    iGraph,
+                    iGraph,
+                    self._sId,
+                    self._cxGraph, self._cyGraph,
+                    self._sTitle if self._sTitle is not None else '',
+                    self._cPtFont * self._cDpiGraph / 72, # fudge
+                    self._oData.sXUnit if self._oData.sXUnit else '',
+                    self._oData.sYUnit if self._oData.sYUnit else '',
+                    'true' if cTooltips > 0 else 'false',
+                    );
+        if fSlideFilter:
+            sHtml += '    var oDashboard = new google.visualization.Dashboard(document.getElementById("%s"));\n' \
+                     '    var oSlide = new google.visualization.ControlWrapper({\n' \
+                     '        "controlType": "NumberRangeFilter",\n' \
+                     '        "containerId": "%s_filter",\n' \
+                     '        "options": {\n' \
+                     '            "filterColumnIndex": 0,\n' \
+                     '            "ui": { "width": getElementWidthById("%s") / 2 }, \n' \
+                     '        }\n' \
+                     '     });\n' \
+                   % ( self._sId,
+                       self._sId,
+                       self._sId,);
+
+        # Data variables.
+        for iSeries, oSeries in enumerate(self._oData.aoSeries):
+            sHtml += '    var aSeries%u = [\n' % (iSeries,);
+            if oSeries.asHtmlTooltips is None:
+                sHtml += '[%s,%s]' % ( oSeries.aoXValues[0], oSeries.aoYValues[0],);
+                for i in range(1, len(oSeries.aoXValues)):
+                    if (i & 16) == 0:   sHtml += '\n';
+                    sHtml += ',[%s,%s]' % ( oSeries.aoXValues[i], oSeries.aoYValues[i], );
+            else:
+                sHtml += '[%s,%s,"%s"]' \
+                       % ( oSeries.aoXValues[0], oSeries.aoYValues[0],
+                           webutils.escapeAttrJavaScriptStringDQ(oSeries.asHtmlTooltips[0]),);
+                for i in range(1, len(oSeries.aoXValues)):
+                    if (i & 16) == 0:   sHtml += '\n';
+                    sHtml += ',[%s,%s,"%s"]' \
+                           % ( oSeries.aoXValues[i], oSeries.aoYValues[i],
+                               webutils.escapeAttrJavaScriptStringDQ(oSeries.asHtmlTooltips[i]),);
+
+            sHtml += '];\n'
+
+        sHtml += '    oData.addColumn("number", "%s");\n' % (self._oData.sXUnit if self._oData.sXUnit else '',);
+        cVColumns = 0;
+        for oSeries in self._oData.aoSeries:
+            sHtml += '    oData.addColumn("number", "%s");\n' % (oSeries.sName,);
+            if oSeries.asHtmlTooltips:
+                sHtml += '    oData.addColumn({"type": "string", "role": "tooltip", "p": {"html": true}});\n';
+                cVColumns += 1;
+            cVColumns += 1;
+        sHtml += 'var i;\n'
+
+        cVColumsDone = 0;
+        for iSeries, oSeries in enumerate(self._oData.aoSeries):
+            sVar = 'aSeries%u' % (iSeries,);
+            sHtml += '    for (i = 0; i < %s.length; i++)\n' \
+                     '    {\n' \
+                     '        oData.addRow([%s[i][0]%s,%s[i][1]%s%s]);\n' \
+                   % ( sVar,
+                       sVar,
+                       ',null' * cVColumsDone,
+                       sVar,
+                       '' if oSeries.asHtmlTooltips is None else ',%s[i][2]' % (sVar,),
+                       ',null' * (cVColumns - cVColumsDone - 1 - (oSeries.asHtmlTooltips is not None)),
+                     );
+            sHtml += '    }\n' \
+                     '    %s = null\n' \
+                   % (sVar,);
+            cVColumsDone += 1 + (oSeries.asHtmlTooltips is not None);
+
+        # Create and draw.
+        if fSlideFilter:
+            sHtml += '    oGraph = new google.visualization.ChartWrapper({\n' \
+                     '        "chartType": "LineChart",\n' \
+                     '        "containerId": "%s_graph",\n' \
+                     '        "options": dGraphOptions\n' \
+                     '    });\n' \
+                     '    oDashboard.bind(oSlide, oGraph);\n' \
+                     '    oDashboard.draw(oData);\n' \
+                   % ( self._sId, );
+        else:
+            sHtml += '    oGraph = new google.visualization.LineChart(document.getElementById("%s"));\n' \
+                     '    oGraph.draw(oData, dGraphOptions);\n' \
+                   % ( self._sId, );
+
+        # Register a resize handler for redrawing the graph, using a timer to delay it.
+        sHtml += '    fnRedraw = function() {\n' \
+                 '        var cxNew = getElementWidthById("%s") - 6;\n' \
+                 '        if (Math.abs(cxNew - cxCur) > 8)\n' \
+                 '        {\n' \
+                 '            cxCur = cxNew;\n' \
+                 '            dGraphOptions["width"]  = cxNew;\n' \
+                 '            dGraphOptions["height"] = Math.round(cxNew / fpXYRatio);\n' \
+                 '            oGraph.draw(oData, dGraphOptions);\n' \
+                 '        }\n' \
+                 '        clearTimeout(idRedrawTimer);\n' \
+                 '        idRedrawTimer = null;\n' \
+                 '        return true;\n' \
+                 '    };\n' \
+                 '    fnResize = function() {\n' \
+                 '        if (idRedrawTimer != null) { clearTimeout(idRedrawTimer); } \n' \
+                 '        idRedrawTimer = setTimeout(fnRedraw, 512);\n' \
+                 '        return true;\n' \
+                 '    };\n' \
+                 '    if (window.attachEvent)\n' \
+                 '    { window.attachEvent("onresize", fnResize); }\n' \
+                 '    else if (window.addEventListener)\n' \
+                 '    { window.addEventListener("resize", fnResize, true); }\n' \
+               % ( self._sId, );
+
+        # clean up what the callbacks don't need.
+        sHtml += '    oData = null;\n' \
+                 '    aaaSeries = null;\n';
+
+        # done;
+        sHtml += '    return true;\n' \
+                 '};\n';
+
+        sHtml += '</script>\n' \
+                 '</div>\n';
+        return sHtml;
+
+
+class WuiHlpLineGraphErrorbarY(WuiHlpLineGraph):
+    """
+    Line graph with an errorbar for the Y axis.
+    """
+
+    def __init__(self, sId, oData, oDisp = None):
+        WuiHlpLineGraph.__init__(self, sId, oData, fErrorBarY = True);
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphmatplotlib.py b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphmatplotlib.py
new file mode 100644
index 0000000..b94780a
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphmatplotlib.py
@@ -0,0 +1,322 @@
+# -*- coding: utf-8 -*-
+# $Id: wuihlpgraphmatplotlib.py $
+
+"""
+Test Manager Web-UI - Graph Helpers - Implemented using matplotlib.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 97393 $"
+
+# Standard Python Import and extensions installed on the system.
+import re;
+import StringIO;
+
+import matplotlib;                          # pylint: disable=F0401
+matplotlib.use('Agg'); # Force backend.
+import matplotlib.pyplot;                   # pylint: disable=F0401
+from numpy import arange as numpy_arange;   # pylint: disable=E0611
+
+# Validation Kit imports.
+from testmanager.webui.wuihlpgraphbase  import WuiHlpGraphBase;
+
+
+class WuiHlpGraphMatplotlibBase(WuiHlpGraphBase):
+    """ Base class for the matplotlib graphs. """
+
+    def __init__(self, sId, oData, oDisp):
+        WuiHlpGraphBase.__init__(self, sId, oData, oDisp);
+        self._fXkcdStyle    = True;
+
+    def setXkcdStyle(self, fEnabled = True):
+        """ Enables xkcd style graphs for implementations that supports it. """
+        self._fXkcdStyle = fEnabled;
+        return True;
+
+    def _createFigure(self):
+        """
+        Wrapper around matplotlib.pyplot.figure that feeds the figure the
+        basic graph configuration.
+        """
+        if self._fXkcdStyle and matplotlib.__version__ > '1.2.9':
+            matplotlib.pyplot.xkcd();           # pylint: disable=E1101
+        matplotlib.rcParams.update({'font.size': self._cPtFont});
+
+        oFigure = matplotlib.pyplot.figure(figsize = (float(self._cxGraph) / self._cDpiGraph,
+                                                      float(self._cyGraph) / self._cDpiGraph),
+                                           dpi = self._cDpiGraph);
+        return oFigure;
+
+    def _produceSvg(self, oFigure, fTightLayout = True):
+        """ Creates an SVG string from the given figure. """
+        oOutput = StringIO.StringIO();
+        if fTightLayout:
+            oFigure.tight_layout();
+        oFigure.savefig(oOutput, format = 'svg');
+
+        if self._oDisp and self._oDisp.isBrowserGecko('20100101'):
+            # This browser will stretch images to fit if no size or width is given.
+            sSubstitute = r'\1 \3 reserveAspectRatio="xMidYMin meet"';
+        else:
+            # Chrome and IE likes to have the sizes as well as the viewBox.
+            sSubstitute = r'\1 \3 reserveAspectRatio="xMidYMin meet" \2 \4';
+        return re.sub(r'(<svg) (height="\d+pt") (version="\d+.\d+" viewBox="\d+ \d+ \d+ \d+") (width="\d+pt")',
+                      sSubstitute,
+                      oOutput.getvalue().decode('utf8'),
+                      count = 1);
+
+class WuiHlpBarGraph(WuiHlpGraphMatplotlibBase):
+    """
+    Bar graph.
+    """
+
+    def __init__(self, sId, oData, oDisp = None):
+        WuiHlpGraphMatplotlibBase.__init__(self, sId, oData, oDisp);
+        self.fpMax      = None;
+        self.fpMin      = 0;
+        self.cxBarWidth = None;
+
+    def setRangeMax(self, fpMax):
+        """ Sets the max range."""
+        self.fpMax = float(fpMax);
+        return None;
+
+    def renderGraph(self): # pylint: disable=R0914
+        aoTable  = self._oData.aoTable;
+
+        #
+        # Extract/structure the required data.
+        #
+        aoSeries = list();
+        for j in range(len(aoTable[1].aoValues)):
+            aoSeries.append(list());
+        asNames  = list();
+        oXRange  = numpy_arange(self._oData.getGroupCount());
+        fpMin = self.fpMin;
+        fpMax = self.fpMax;
+        if self.fpMax is None:
+            fpMax = float(aoTable[1].aoValues[0]);
+
+        for i in range(1, len(aoTable)):
+            asNames.append(aoTable[i].sName);
+            for j in range(len(aoTable[i].aoValues)):
+                fpValue = float(aoTable[i].aoValues[j]);
+                aoSeries[j].append(fpValue);
+                if fpValue < fpMin:
+                    fpMin = fpValue;
+                if fpValue > fpMax:
+                    fpMax = fpValue;
+
+        fpMid = fpMin + (fpMax - fpMin) / 2.0;
+
+        if self.cxBarWidth is None:
+            self.cxBarWidth = 1.0 / (len(aoTable[0].asValues) + 1.1);
+
+        # Render the PNG.
+        oFigure = self._createFigure();
+        oSubPlot = oFigure.add_subplot(1, 1, 1);
+
+        aoBars = list();
+        for i in range(len(aoSeries)):
+            sColor = self.calcSeriesColor(i);
+            aoBars.append(oSubPlot.bar(oXRange + self.cxBarWidth * i,
+                                       aoSeries[i],
+                                       self.cxBarWidth,
+                                       color = sColor,
+                                       align = 'edge'));
+
+        #oSubPlot.set_title('Title')
+        #oSubPlot.set_xlabel('X-axis')
+        #oSubPlot.set_xticks(oXRange + self.cxBarWidth);
+        oSubPlot.set_xticks(oXRange);
+        oLegend = oSubPlot.legend(aoTable[0].asValues, loc = 'best', fancybox = True);
+        oLegend.get_frame().set_alpha(0.5);
+        oSubPlot.set_xticklabels(asNames, ha = "left");
+        #oSubPlot.set_ylabel('Y-axis')
+        oSubPlot.set_yticks(numpy_arange(fpMin, fpMax + (fpMax - fpMin) / 10 * 0, fpMax / 10));
+        oSubPlot.grid(True);
+        fpPadding = (fpMax - fpMin) * 0.02;
+        for i in range(len(aoBars)):
+            aoRects = aoBars[i]
+            for j in range(len(aoRects)):
+                oRect = aoRects[j];
+                fpValue = float(aoTable[j + 1].aoValues[i]);
+                if fpValue <= fpMid:
+                    oSubPlot.text(oRect.get_x() + oRect.get_width() / 2.0,
+                                  oRect.get_height() + fpPadding,
+                                  aoTable[j + 1].asValues[i],
+                                  ha = 'center', va = 'bottom', rotation = 'vertical', alpha = 0.6, fontsize = 'small');
+                else:
+                    oSubPlot.text(oRect.get_x() + oRect.get_width() / 2.0,
+                                  oRect.get_height() - fpPadding,
+                                  aoTable[j + 1].asValues[i],
+                                  ha = 'center', va = 'top', rotation = 'vertical', alpha = 0.6, fontsize = 'small');
+
+        return self._produceSvg(oFigure);
+
+
+
+
+class WuiHlpLineGraph(WuiHlpGraphMatplotlibBase):
+    """
+    Line graph.
+    """
+
+    def __init__(self, sId, oData, oDisp = None, fErrorBarY = False):
+        # oData must be a WuiHlpGraphDataTableEx like object.
+        WuiHlpGraphMatplotlibBase.__init__(self, sId, oData, oDisp);
+        self._cMaxErrorBars = 12;
+        self._fErrorBarY    = fErrorBarY;
+
+    def setErrorBarY(self, fEnable):
+        """ Enables or Disables error bars, making this work like a line graph. """
+        self._fErrorBarY = fEnable;
+        return True;
+
+    def renderGraph(self): # pylint: disable=R0914
+        aoSeries = self._oData.aoSeries;
+
+        oFigure = self._createFigure();
+        oSubPlot = oFigure.add_subplot(1, 1, 1);
+        if self._oData.sYUnit is not None:
+            oSubPlot.set_ylabel(self._oData.sYUnit);
+        if self._oData.sXUnit is not None:
+            oSubPlot.set_xlabel(self._oData.sXUnit);
+
+        cSeriesNames = 0;
+        cYMin = 1000;
+        cYMax = 0;
+        for iSeries, oSeries in enumerate(aoSeries):
+            sColor = self.calcSeriesColor(iSeries);
+            cYMin  = min(cYMin, min(oSeries.aoYValues));
+            cYMax  = max(cYMax, max(oSeries.aoYValues));
+            if not self._fErrorBarY:
+                oSubPlot.errorbar(oSeries.aoXValues, oSeries.aoYValues, color = sColor);
+            elif len(oSeries.aoXValues) > self._cMaxErrorBars:
+                if matplotlib.__version__ < '1.3.0':
+                    oSubPlot.errorbar(oSeries.aoXValues, oSeries.aoYValues, color = sColor);
+                else:
+                    oSubPlot.errorbar(oSeries.aoXValues, oSeries.aoYValues,
+                                      yerr = [oSeries.aoYErrorBarBelow, oSeries.aoYErrorBarAbove],
+                                      errorevery = len(oSeries.aoXValues) / self._cMaxErrorBars,
+                                      color = sColor );
+            else:
+                oSubPlot.errorbar(oSeries.aoXValues, oSeries.aoYValues,
+                                  yerr = [oSeries.aoYErrorBarBelow, oSeries.aoYErrorBarAbove],
+                                  color = sColor);
+            cSeriesNames += oSeries.sName is not None;
+
+        if cYMin != 0 or cYMax != 0:
+            oSubPlot.set_ylim(bottom = 0);
+
+        if cSeriesNames > 0:
+            oLegend = oSubPlot.legend([oSeries.sName for oSeries in aoSeries], loc = 'best', fancybox = True);
+            oLegend.get_frame().set_alpha(0.5);
+
+        if self._sTitle is not None:
+            oSubPlot.set_title(self._sTitle);
+
+        if self._cxGraph >= 256:
+            oSubPlot.minorticks_on();
+            oSubPlot.grid(True, 'major', axis = 'both');
+            oSubPlot.grid(True, 'both', axis = 'x');
+
+        if True:
+            #    oSubPlot.axis('off');
+            #oSubPlot.grid(True, 'major', axis = 'none');
+            #oSubPlot.grid(True, 'both', axis = 'none');
+            matplotlib.pyplot.setp(oSubPlot, xticks = [], yticks = []);
+
+        return self._produceSvg(oFigure);
+
+
+class WuiHlpLineGraphErrorbarY(WuiHlpLineGraph):
+    """
+    Line graph with an errorbar for the Y axis.
+    """
+
+    def __init__(self, sId, oData, oDisp = None):
+        WuiHlpLineGraph.__init__(self, sId, oData, fErrorBarY = True);
+
+
+class WuiHlpMiniSuccessRateGraph(WuiHlpGraphMatplotlibBase):
+    """
+    Mini rate graph.
+    """
+
+    def __init__(self, sId, oData, oDisp = None):
+        """
+        oData must be a WuiHlpGraphDataTableEx like object, but only aoSeries,
+        aoSeries[].aoXValues, and aoSeries[].aoYValues will be used.  The
+        values are expected to be a percentage, i.e. values between 0 and 100.
+        """
+        WuiHlpGraphMatplotlibBase.__init__(self, sId, oData, oDisp);
+        self.setFontSize(6);
+
+    def renderGraph(self): # pylint: disable=R0914
+        assert len(self._oData.aoSeries) == 1;
+        oSeries = self._oData.aoSeries[0];
+
+        # hacking
+        #self.setWidth(512);
+        #self.setHeight(128);
+        # end
+
+        oFigure = self._createFigure();
+        from mpl_toolkits.axes_grid.axislines import SubplotZero;
+        oAxis = SubplotZero(oFigure, 111);
+        oFigure.add_subplot(oAxis);
+
+        # Disable all the normal axis.
+        oAxis.axis['right'].set_visible(False)
+        oAxis.axis['top'].set_visible(False)
+        oAxis.axis['bottom'].set_visible(False)
+        oAxis.axis['left'].set_visible(False)
+
+        # Use the zero axis instead.
+        oAxis.axis['yzero'].set_axisline_style('-|>');
+        oAxis.axis['yzero'].set_visible(True);
+        oAxis.axis['xzero'].set_axisline_style('-|>');
+        oAxis.axis['xzero'].set_visible(True);
+
+        if oSeries.aoYValues[-1] == 100:
+            sColor = 'green';
+        elif oSeries.aoYValues[-1] > 75:
+            sColor = 'yellow';
+        else:
+            sColor = 'red';
+        oAxis.plot(oSeries.aoXValues, oSeries.aoYValues, '.-', color = sColor, linewidth = 3);
+        oAxis.fill_between(oSeries.aoXValues, oSeries.aoYValues, facecolor = sColor, alpha = 0.5)
+
+        oAxis.set_xlim(left = -0.01);
+        oAxis.set_xticklabels([]);
+        oAxis.set_xmargin(1);
+
+        oAxis.set_ylim(bottom = 0, top = 100);
+        oAxis.set_yticks([0, 50, 100]);
+        oAxis.set_ylabel('%');
+        #oAxis.set_yticklabels([]);
+        oAxis.set_yticklabels(['', '%', '']);
+
+        return self._produceSvg(oFigure, False);
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphsimple.py b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphsimple.py
new file mode 100644
index 0000000..388395a
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuihlpgraphsimple.py
@@ -0,0 +1,146 @@
+# -*- coding: utf-8 -*-
+# $Id: wuihlpgraphsimple.py $
+
+"""
+Test Manager Web-UI - Graph Helpers - Simple/Stub Implementation.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 97393 $"
+
+# Validation Kit imports.
+from common.webutils                    import escapeAttr, escapeElem;
+from testmanager.webui.wuihlpgraphbase  import WuiHlpGraphBase;
+
+
+
+class WuiHlpBarGraph(WuiHlpGraphBase):
+    """
+    Bar graph.
+    """
+
+    def __init__(self, sId, oData, oDisp = None):
+        WuiHlpGraphBase.__init__(self, sId, oData, oDisp);
+        self.cxMaxBar = 480;
+        self.fpMax = None;
+        self.fpMin = 0;
+
+    def setRangeMax(self, fpMax):
+        """ Sets the max range."""
+        self.fpMax = float(fpMax);
+        return None;
+
+    def renderGraph(self):
+        aoTable  = self._oData.aoTable;
+        sReport  = '<div class="tmbargraph">\n';
+
+        # Figure the range.
+        fpMin = self.fpMin;
+        fpMax = self.fpMax;
+        if self.fpMax is None:
+            fpMax = float(aoTable[1].aoValues[0]);
+        for i in range(1, len(aoTable)):
+            for oValue in aoTable[i].aoValues:
+                fpValue = float(oValue);
+                if fpValue < fpMin:
+                    fpMin = fpValue;
+                if fpValue > fpMax:
+                    fpMax = fpValue;
+        assert fpMin >= 0;
+
+        # Format the data.
+        sReport += '<table class="tmbargraphl1" border="1" id="%s">\n' % (escapeAttr(self._sId),);
+        for i in range(1, len(aoTable)):
+            oRow = aoTable[i];
+            sReport += '  <tr>\n' \
+                       '    <td>%s</td>\n' \
+                       '    <td height="100%%" width="%spx">\n' \
+                       '      <table class="tmbargraphl2" height="100%%" width="100%%" ' \
+                                    'border="0" cellspacing="0" cellpadding="0">\n' \
+                     % (escapeElem(oRow.sName), escapeAttr(str(self.cxMaxBar + 2)));
+            for j in range(len(oRow.aoValues)):
+                oValue = oRow.aoValues[j];
+                cPct   = int(float(oValue) * 100 / fpMax);
+                cxBar  = int(float(oValue) * self.cxMaxBar / fpMax);
+                sValue = escapeElem(oRow.asValues[j]);
+                sColor = self.kasColors[j % len(self.kasColors)];
+
+                sReport += '        <tr><td>\n' \
+                           '          <table class="tmbargraphl3" height="100%%" border="0" cellspacing="0" cellpadding="0">\n' \
+                           '            <tr>\n';
+                if cPct >= 99:
+                    sReport += '              <td width="%spx" nowrap bgcolor="%s" align="right">%s </td>\n' \
+                             % (cxBar, sColor, sValue);
+                elif cPct < 1:
+                    sReport += '              <td width="%spx" nowrap style="color:%s;">%s</td>\n' \
+                             % (self.cxMaxBar - cxBar, sColor, sValue);
+                elif cPct >= 50:
+                    sReport += '              <td width="%spx" nowrap bgcolor="%s" align="right">%s </td>\n' \
+                               '              <td width="%spx" nowrap><div> </div></td>\n' \
+                             % (cxBar, sColor, sValue, self.cxMaxBar - cxBar);
+                else:
+                    sReport += '              <td width="%spx" nowrap bgcolor="%s"></td>\n' \
+                               '              <td width="%spx" nowrap> %s</td>\n' \
+                             % (cxBar, sColor, self.cxMaxBar - cxBar, sValue);
+                sReport += '            </tr>\n' \
+                           '          </table>\n' \
+                           '        </td></tr>\n'
+            sReport += '      </table>\n' \
+                       '    </td>\n' \
+                       '  </tr>\n';
+            if i + 1 < len(aoTable) and len(oRow.aoValues) > 1:
+                sReport += '  <tr></tr>\n'
+
+        sReport += '</table>\n';
+
+        sReport += '<div class="tmgraphlegend">\n' \
+                   '  <p>Legend:\n';
+        for j in range(len(aoTable[0].asValues)):
+            sColor = self.kasColors[j % len(self.kasColors)];
+            sReport += '    <font color="%s">&#x25A0; %s</font>\n' \
+                     % (sColor, escapeElem(aoTable[0].asValues[j]));
+        sReport += '  </p>\n' \
+                   '</div>\n';
+
+        sReport += '</div>\n';
+        return sReport;
+
+
+
+
+class WuiHlpLineGraph(WuiHlpGraphBase):
+    """
+    Line graph.
+    """
+
+    def __init__(self, sId, oData, oDisp):
+        WuiHlpGraphBase.__init__(self, sId, oData, oDisp);
+
+
+class WuiHlpLineGraphErrorbarY(WuiHlpLineGraph):
+    """
+    Line graph with an errorbar for the Y axis.
+    """
+
+    pass;
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuilogviewer.py b/src/VBox/ValidationKit/testmanager/webui/wuilogviewer.py
new file mode 100644
index 0000000..cb3f02d
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuilogviewer.py
@@ -0,0 +1,205 @@
+# -*- coding: utf-8 -*-
+# $Id: wuilogviewer.py $
+
+"""
+Test Manager WUI - Log viewer
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Validation Kit imports.
+from common                             import webutils;
+from testmanager.core.testset           import TestSetData;
+from testmanager.webui.wuicontentbase   import WuiContentBase, WuiTmLink;
+from testmanager.webui.wuimain          import WuiMain;
+
+
+class WuiLogViewer(WuiContentBase):
+    """Log viewer."""
+
+    def __init__(self, oTestSet, oLogFile, cbChunk, iChunk, oDisp = None, fnDPrint = None):
+        WuiContentBase.__init__(self, oDisp = oDisp, fnDPrint = fnDPrint);
+        self._oTestSet  = oTestSet;
+        self._oLogFile  = oLogFile;
+        self._cbChunk   = cbChunk;
+        self._iChunk    = iChunk;
+
+    def _generateNavigation(self, cbFile):
+        """Generate the HTML for the log navigation."""
+
+        dParams = {
+            WuiMain.ksParamAction:          WuiMain.ksActionViewLog,
+            WuiMain.ksParamLogSetId:        self._oTestSet.idTestSet,
+            WuiMain.ksParamLogFileId:       self._oLogFile.idTestResultFile,
+            WuiMain.ksParamLogChunkSize:    self._cbChunk,
+            WuiMain.ksParamLogChunkNo:      self._iChunk,
+        };
+
+        #
+        # The page walker.
+        #
+        dParams2 = dict(dParams);
+        del dParams2[WuiMain.ksParamLogChunkNo];
+        sHrefFmt        = '<a href="?%s&%s=%%s" title="%%s">%%s</a>' \
+                        % (webutils.encodeUrlParams(dParams2).replace('%', '%%'), WuiMain.ksParamLogChunkNo,);
+        sHtmlWalker = self.genericPageWalker(self._iChunk, (cbFile + self._cbChunk - 1) / self._cbChunk,
+                                             sHrefFmt, 11, 0, 'chunk');
+
+        #
+        # The chunk size selector.
+        #
+
+        dParams2 = dict(dParams);
+        del dParams2[WuiMain.ksParamLogChunkSize];
+        sHtmlSize  = '<form name="ChunkSizeForm" method="GET">\n' \
+                     '  Max <select name="%s" onchange="window.location=\'?%s&%s=\' + ' \
+                     'this.options[this.selectedIndex].value;" title="Max items per page">\n' \
+                   % ( WuiMain.ksParamLogChunkSize, webutils.encodeUrlParams(dParams2), WuiMain.ksParamLogChunkSize,);
+
+        for cbChunk in [ 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152,
+                         4194304, 8388608, 16777216 ]:
+            sHtmlSize += '    <option value="%d" %s>%d bytes</option>\n' \
+                       % (cbChunk, 'selected="selected"' if cbChunk == self._cbChunk else '', cbChunk);
+        sHtmlSize += '  </select> per page\n' \
+                     '</form>\n'
+
+        #
+        # Download links.
+        #
+        oRawLink      = WuiTmLink('View Raw', '',
+                                  { WuiMain.ksParamAction:            WuiMain.ksActionGetFile,
+                                    WuiMain.ksParamGetFileSetId:      self._oTestSet.idTestSet,
+                                    WuiMain.ksParamGetFileId:         self._oLogFile.idTestResultFile,
+                                    WuiMain.ksParamGetFileDownloadIt: False,
+                                  },
+                                  sTitle = '%u MiB' % ((cbFile + 1048576 - 1) / 1048576,) );
+        oDownloadLink = WuiTmLink('Download Log', '',
+                                  { WuiMain.ksParamAction:            WuiMain.ksActionGetFile,
+                                    WuiMain.ksParamGetFileSetId:      self._oTestSet.idTestSet,
+                                    WuiMain.ksParamGetFileId:         self._oLogFile.idTestResultFile,
+                                    WuiMain.ksParamGetFileDownloadIt: True,
+                                  },
+                                  sTitle = '%u MiB' % ((cbFile + 1048576 - 1) / 1048576,) );
+        oTestSetLink  = WuiTmLink('Test Set', '',
+                                  { WuiMain.ksParamAction:            WuiMain.ksActionTestResultDetails,
+                                    TestSetData.ksParam_idTestSet:    self._oTestSet.idTestSet,
+                                  });
+
+
+        #
+        # Combine the elements and return.
+        #
+        return '<div class="tmlogviewernavi">\n' \
+               ' <table width=100%>\n' \
+               '  <tr>\n' \
+               '   <td width=20%>\n' \
+               '    ' + oTestSetLink.toHtml() + '\n' \
+               '    ' + oRawLink.toHtml() + '\n' \
+               '    ' + oDownloadLink.toHtml() + '\n' \
+               '   </td>\n' \
+               '   <td width=60% align=center>' + sHtmlWalker + '</td>' \
+               '   <td width=20% align=right>' + sHtmlSize + '</td>\n' \
+               '  </tr>\n' \
+               ' </table>\n' \
+               '</div>\n';
+
+    def _displayLog(self, oFile, offFile, cbFile):
+        """Displays the current section of the log file."""
+        offEnd = offFile + self._cbChunk;
+        if offEnd > cbFile:
+            offEnd = cbFile;
+
+        #
+        # Here is an annoying thing, we cannot seek in zip file members. So,
+        # since we have to read from the start, we can just as well count line
+        # numbers while we're at it.
+        #
+        offCur  = 0;
+        iLine   = 0;
+        while True:
+            sLine   = oFile.readline().decode('utf-8', 'replace');
+            offLine = offCur;
+            iLine  += 1;
+            offCur += len(sLine);
+            if offCur >= offFile or len(sLine) == 0:
+                break;
+
+        #
+        # Got to where we wanted, format the chunk.
+        #
+        sHtml = '\n<div class="tmlog">\n<pre>\n';
+        while True:
+            sHtml += '<a id="L%d" href="#L%d">%05d</a><a id="O%d"> </a>%s\n' \
+                   % (iLine, iLine, iLine, offLine, webutils.escapeElem(sLine.rstrip()));
+            if offCur >= offEnd:
+                break;
+            sLine   = oFile.readline().decode('utf-8', 'replace');
+            offLine = offCur;
+            iLine  += 1;
+            offCur += len(sLine);
+            if len(sLine) == 0:
+                break;
+        sHtml += '<pre/></div>\n';
+
+        return sHtml;
+
+
+    def show(self):
+        """Shows the log."""
+
+        if self._oLogFile.sDescription not in [ '', None ]:
+            sTitle = '%s - %s' % (self._oLogFile.sFile, self._oLogFile.sDescription);
+        else:
+            sTitle = '%s' % (self._oLogFile.sFile,);
+
+        #
+        # Open the log file. No universal line endings here.
+        #
+        (oFile, oSizeOrError, _) = self._oTestSet.openFile(self._oLogFile.sFile, 'rb');
+        if oFile is None:
+            return (sTitle, '<p>%s</p>\n' % (webutils.escapeElem(oSizeOrError),),);
+        cbFile = oSizeOrError;
+
+        #
+        # Generate the page.
+        #
+
+        # Start with a focus hack.
+        sHtml = '<div id="tmlogoutdiv" tabindex="0">\n' \
+                '<script lang="text/javascript">\n' \
+                'document.getElementById(\'tmlogoutdiv\').focus();\n' \
+                '</script>\n';
+
+        sNaviHtml = self._generateNavigation(cbFile);
+        sHtml += sNaviHtml;
+
+        offFile   = self._iChunk * self._cbChunk;
+        if offFile < cbFile:
+            sHtml += self._displayLog(oFile, offFile, cbFile);
+            sHtml += sNaviHtml;
+        else:
+            sHtml += '<p>End Of File</p>';
+
+        return (sTitle, sHtml);
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuimain.py b/src/VBox/ValidationKit/testmanager/webui/wuimain.py
new file mode 100644
index 0000000..3c1fd88
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuimain.py
@@ -0,0 +1,994 @@
+# -*- coding: utf-8 -*-
+# $Id: wuimain.py $
+
+"""
+Test Manager Core - WUI - The Main page.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 99364 $"
+
+# Standard Python imports.
+
+# Validation Kit imports.
+from testmanager                            import config;
+from testmanager.webui.wuibase              import WuiDispatcherBase, WuiException;
+from testmanager.webui.wuicontentbase       import WuiTmLink;
+from testmanager.core.report                import ReportLazyModel, ReportGraphModel, ReportModelBase;
+from testmanager.core.testresults           import TestResultLogic, TestResultFileDataEx;
+from testmanager.core.base                  import TMExceptionBase, TMTooManyRows;
+from testmanager.core.testset               import TestSetData, TestSetLogic;
+from testmanager.core.build                 import BuildDataEx;
+from testmanager.core.testbox               import TestBoxData
+from testmanager.core.testgroup             import TestGroupData;
+from testmanager.core.testcase              import TestCaseDataEx
+from testmanager.core.testcaseargs          import TestCaseArgsDataEx
+from testmanager.core.vcsrevisions          import VcsRevisionLogic;
+from common                                 import webutils, utils;
+
+
+class WuiMain(WuiDispatcherBase):
+    """
+    WUI Main page.
+
+    Note! All cylic dependency avoiance stuff goes here in the dispatcher code,
+          not in the action specific code.  This keeps the uglyness in one place
+          and reduces load time dependencies in the more critical code path.
+    """
+
+    ## The name of the script.
+    ksScriptName = 'index.py'
+
+    ## @name Actions
+    ## @{
+    ksActionResultsUnGrouped            = 'ResultsUnGrouped'
+    ksActionResultsGroupedBySchedGroup  = 'ResultsGroupedBySchedGroup'
+    ksActionResultsGroupedByTestGroup   = 'ResultsGroupedByTestGroup'
+    ksActionResultsGroupedByBuildRev    = 'ResultsGroupedByBuildRev'
+    ksActionResultsGroupedByTestBox     = 'ResultsGroupedByTestBox'
+    ksActionResultsGroupedByTestCase    = 'ResultsGroupedByTestCase'
+    ksActionTestResultDetails           = 'TestResultDetails'
+    ksActionViewLog                     = 'ViewLog'
+    ksActionGetFile                     = 'GetFile'
+    ksActionReportSummary               = 'ReportSummary';
+    ksActionReportRate                  = 'ReportRate';
+    ksActionReportFailureReasons        = 'ReportFailureReasons';
+    ksActionGraphWiz                    = 'GraphWiz';
+    ksActionVcsHistoryTooltip           = 'VcsHistoryTooltip';
+    ## @}
+
+    ## @name Standard report parameters
+    ## @{
+    ksParamReportPeriods        = 'cPeriods';
+    ksParamReportPeriodInHours  = 'cHoursPerPeriod';
+    ksParamReportSubject        = 'sSubject';
+    ksParamReportSubjectIds     = 'SubjectIds';
+    ## @}
+
+    ## @name Graph Wizard parameters
+    ## Common parameters: ksParamReportPeriods, ksParamReportPeriodInHours, ksParamReportSubjectIds,
+    ##                    ksParamReportSubject, ksParamEffectivePeriod, and ksParamEffectiveDate.
+    ## @{
+    ksParamGraphWizTestBoxIds   = 'aidTestBoxes';
+    ksParamGraphWizBuildCatIds  = 'aidBuildCats';
+    ksParamGraphWizTestCaseIds  = 'aidTestCases';
+    ksParamGraphWizSepTestVars  = 'fSepTestVars';
+    ksParamGraphWizImpl         = 'enmImpl';
+    ksParamGraphWizWidth        = 'cx';
+    ksParamGraphWizHeight       = 'cy';
+    ksParamGraphWizDpi          = 'dpi';
+    ksParamGraphWizFontSize     = 'cPtFont';
+    ksParamGraphWizErrorBarY    = 'fErrorBarY';
+    ksParamGraphWizMaxErrorBarY = 'cMaxErrorBarY';
+    ksParamGraphWizMaxPerGraph  = 'cMaxPerGraph';
+    ksParamGraphWizXkcdStyle    = 'fXkcdStyle';
+    ksParamGraphWizTabular      = 'fTabular';
+    ksParamGraphWizSrcTestSetId = 'idSrcTestSet';
+    ## @}
+
+    ## @name Graph implementations values for ksParamGraphWizImpl.
+    ## @{
+    ksGraphWizImpl_Default      = 'default';
+    ksGraphWizImpl_Matplotlib   = 'matplotlib';
+    ksGraphWizImpl_Charts       = 'charts';
+    kasGraphWizImplValid        = [ ksGraphWizImpl_Default, ksGraphWizImpl_Matplotlib, ksGraphWizImpl_Charts];
+    kaasGraphWizImplCombo       = [
+        ( ksGraphWizImpl_Default,       'Default' ),
+        ( ksGraphWizImpl_Matplotlib,    'Matplotlib (server)' ),
+        ( ksGraphWizImpl_Charts,        'Google Charts (client)'),
+    ];
+    ## @}
+
+    ## @name Log Viewer parameters.
+    ## @{
+    ksParamLogSetId             = 'LogViewer_idTestSet';
+    ksParamLogFileId            = 'LogViewer_idFile';
+    ksParamLogChunkSize         = 'LogViewer_cbChunk';
+    ksParamLogChunkNo           = 'LogViewer_iChunk';
+    ## @}
+
+    ## @name File getter parameters.
+    ## @{
+    ksParamGetFileSetId         = 'GetFile_idTestSet';
+    ksParamGetFileId            = 'GetFile_idFile';
+    ksParamGetFileDownloadIt    = 'GetFile_fDownloadIt';
+    ## @}
+
+    ## @name VCS history parameters.
+    ## @{
+    ksParamVcsHistoryRepository = 'repo';
+    ksParamVcsHistoryRevision   = 'rev';
+    ksParamVcsHistoryEntries    = 'cEntries';
+    ## @}
+
+    ## Effective time period. one of the first column values in kaoResultPeriods.
+    ksParamEffectivePeriod      = 'sEffectivePeriod'
+
+    ## If this param is specified, then show only results for this member when results grouped by some parameter.
+    ksParamGroupMemberId        = 'GroupMemberId'
+
+    ## Optional parameter for indicating whether to restrict the listing to failures only.
+    ksParamOnlyFailures         = 'OnlyFailures'
+
+    ## Test result period values.
+    kaoResultPeriods = [
+        ( '1 hour',   'One hour',    1 ),
+        ( '2 hours',  'Two hours',   2 ),
+        ( '3 hours',  'Three hours', 3 ),
+        ( '6 hours',  'Six hours',   6 ),
+        ( '12 hours', '12 hours',    12 ),
+
+        ( '1 day',    'One day',     24 ),
+        ( '2 days',   'Two days',    48 ),
+        ( '3 days',   'Three days',  72 ),
+
+        ( '1 week',   'One week',    168 ),
+        ( '2 weeks',  'Two weeks',   336 ),
+        ( '3 weeks',  'Three weeks', 504 ),
+
+        ( '1 month',  'One month',   31 * 24 ),                             # The approx hour count varies with the start date.
+        ( '2 months', 'Two month',   (31 + 31) * 24 ),                      # Using maximum values.
+        ( '3 months', 'Three month', (31 + 30 + 31) * 24 ),
+
+        ( '6 months', 'Six month',   (31 + 31 + 30 + 31 + 30 + 31) * 24 ),
+
+        ( '1 year',   'One year',    365 * 24 ),
+    ];
+    ## The default test result period.
+    ksResultPeriodDefault = '3 hours';
+
+
+
+    def __init__(self, oSrvGlue):
+        WuiDispatcherBase.__init__(self, oSrvGlue, self.ksScriptName);
+
+        self._sTemplate     = 'template.html'
+
+        #
+        # Populate the action dispatcher dictionary.
+        #
+
+        # Use short form to avoid hitting the right margin (130) when using lambda.
+        d = self._dDispatch;  # pylint: disable=C0103
+
+        from testmanager.webui.wuitestresult import WuiGroupedResultList;
+        #d[self.ksActionResultsUnGrouped]          = lambda: self._actionResultsListing(TestResultLogic, WuiGroupedResultList)
+        d[self.ksActionResultsUnGrouped]          = lambda: self._actionGroupedResultsListing(
+                                                                TestResultLogic.ksResultsGroupingTypeNone,
+                                                                TestResultLogic,
+                                                                WuiGroupedResultList)
+
+        d[self.ksActionResultsGroupedByTestGroup] = lambda: self._actionGroupedResultsListing(
+                                                                TestResultLogic.ksResultsGroupingTypeTestGroup,
+                                                                TestResultLogic,
+                                                                WuiGroupedResultList)
+
+        d[self.ksActionResultsGroupedByBuildRev]  = lambda: self._actionGroupedResultsListing(
+                                                                TestResultLogic.ksResultsGroupingTypeBuildRev,
+                                                                TestResultLogic,
+                                                                WuiGroupedResultList)
+
+        d[self.ksActionResultsGroupedByTestBox]   = lambda: self._actionGroupedResultsListing(
+                                                                TestResultLogic.ksResultsGroupingTypeTestBox,
+                                                                TestResultLogic,
+                                                                WuiGroupedResultList)
+
+        d[self.ksActionResultsGroupedByTestCase]   = lambda: self._actionGroupedResultsListing(
+                                                                TestResultLogic.ksResultsGroupingTypeTestCase,
+                                                                TestResultLogic,
+                                                                WuiGroupedResultList)
+
+        d[self.ksActionResultsGroupedBySchedGroup] = lambda: self._actionGroupedResultsListing(
+                                                                TestResultLogic.ksResultsGroupingTypeSchedGroup,
+                                                                TestResultLogic,
+                                                                WuiGroupedResultList)
+
+        d[self.ksActionTestResultDetails]          = self.actionTestResultDetails
+
+        d[self.ksActionViewLog]                 = self.actionViewLog;
+        d[self.ksActionGetFile]                 = self.actionGetFile;
+        from testmanager.webui.wuireport import WuiReportSummary, WuiReportSuccessRate, WuiReportFailureReasons;
+        d[self.ksActionReportSummary]           = lambda: self._actionGenericReport(ReportLazyModel, WuiReportSummary);
+        d[self.ksActionReportRate]              = lambda: self._actionGenericReport(ReportLazyModel, WuiReportSuccessRate);
+        d[self.ksActionReportFailureReasons]    = lambda: self._actionGenericReport(ReportLazyModel, WuiReportFailureReasons);
+        d[self.ksActionGraphWiz]                = self._actionGraphWiz;
+        d[self.ksActionVcsHistoryTooltip]       = self._actionVcsHistoryTooltip;
+
+
+        #
+        # Popupate the menus.
+        #
+
+        # Additional URL parameters keeping for time navigation.
+        sExtraTimeNav = ''
+        dCurParams = oSrvGlue.getParameters()
+        if dCurParams is not None:
+            asActionUrlExtras = [ self.ksParamItemsPerPage, self.ksParamEffectiveDate, self.ksParamEffectivePeriod, ];
+            for sExtraParam in asActionUrlExtras:
+                if sExtraParam in dCurParams:
+                    sExtraTimeNav += '&%s' % webutils.encodeUrlParams({sExtraParam: dCurParams[sExtraParam]})
+
+        # Shorthand to keep within margins.
+        sActUrlBase = self._sActionUrlBase;
+
+        self._aaoMenus = \
+        [
+            [
+                'Inbox',            sActUrlBase + 'TODO', ## @todo list of failures that needs categorizing.
+                []
+            ],
+            [
+                'Reports',          sActUrlBase + self.ksActionReportSummary,
+                [
+                    [ 'Summary',                  sActUrlBase + self.ksActionReportSummary ],
+                    [ 'Success Rate',             sActUrlBase + self.ksActionReportRate ],
+                    [ 'Failure Reasons',          sActUrlBase + self.ksActionReportFailureReasons ],
+                ]
+            ],
+            [
+                'Test Results',     sActUrlBase + self.ksActionResultsUnGrouped + sExtraTimeNav,
+                [
+                    [ 'Ungrouped results',           sActUrlBase + self.ksActionResultsUnGrouped           + sExtraTimeNav ],
+                    [ 'Grouped by Scheduling Group', sActUrlBase + self.ksActionResultsGroupedBySchedGroup + sExtraTimeNav ],
+                    [ 'Grouped by Test Group',       sActUrlBase + self.ksActionResultsGroupedByTestGroup  + sExtraTimeNav ],
+                    [ 'Grouped by TestBox',          sActUrlBase + self.ksActionResultsGroupedByTestBox    + sExtraTimeNav ],
+                    [ 'Grouped by Test Case',        sActUrlBase + self.ksActionResultsGroupedByTestCase   + sExtraTimeNav ],
+                    [ 'Grouped by Revision',         sActUrlBase + self.ksActionResultsGroupedByBuildRev   + sExtraTimeNav ],
+                ]
+            ],
+            [
+                '> Admin', 'admin.py?' + webutils.encodeUrlParams(self._dDbgParams), []
+            ],
+        ];
+
+
+    def _actionDefault(self):
+        """Show the default admin page."""
+        from testmanager.webui.wuitestresult import WuiGroupedResultList;
+        self._sAction = self.ksActionResultsUnGrouped
+        return self._actionGroupedResultsListing(TestResultLogic.ksResultsGroupingTypeNone,
+                                                 TestResultLogic,
+                                                 WuiGroupedResultList)
+
+
+    #
+    # Navigation bar stuff
+    #
+
+    def _generateStatusSelector(self, dParams, fOnlyFailures):
+        """
+        Generate HTML code for the status code selector.  Currently very simple.
+        """
+        dParams[self.ksParamOnlyFailures] = not fOnlyFailures;
+        return WuiTmLink('Show all results' if fOnlyFailures else 'Only show failed tests', '', dParams,
+                         fBracketed = False).toHtml();
+
+    def _generateTimeSelector(self, dParams, sPreamble, sPostamble):
+        """
+        Generate HTML code for time selector.
+        """
+
+        if WuiDispatcherBase.ksParamEffectiveDate in dParams:
+            tsEffective = dParams[WuiDispatcherBase.ksParamEffectiveDate]
+            del dParams[WuiDispatcherBase.ksParamEffectiveDate]
+        else:
+            tsEffective = ''
+
+        # Forget about page No when changing a period
+        if WuiDispatcherBase.ksParamPageNo in dParams:
+            del dParams[WuiDispatcherBase.ksParamPageNo]
+
+
+        sHtmlTimeSelector  = '<form name="TimeForm" method="GET">\n'
+        sHtmlTimeSelector += sPreamble;
+        sHtmlTimeSelector += '\n  <select name="%s" onchange="window.location=' % WuiDispatcherBase.ksParamEffectiveDate
+        sHtmlTimeSelector += '\'?%s&%s=\' + ' % (webutils.encodeUrlParams(dParams), WuiDispatcherBase.ksParamEffectiveDate)
+        sHtmlTimeSelector += 'this.options[this.selectedIndex].value;" title="Effective date">\n'
+
+        aoWayBackPoints = [
+            ('+0000-00-00 00:00:00.00', 'Now', ' title="Present Day. Present Time."'), # lain :)
+
+            ('-0000-00-00 01:00:00.00', 'One hour ago', ''),
+            ('-0000-00-00 02:00:00.00', 'Two hours ago', ''),
+            ('-0000-00-00 03:00:00.00', 'Three hours ago', ''),
+
+            ('-0000-00-01 00:00:00.00', 'One day ago', ''),
+            ('-0000-00-02 00:00:00.00', 'Two days ago', ''),
+            ('-0000-00-03 00:00:00.00', 'Three days ago', ''),
+
+            ('-0000-00-07 00:00:00.00', 'One week ago', ''),
+            ('-0000-00-14 00:00:00.00', 'Two weeks ago', ''),
+            ('-0000-00-21 00:00:00.00', 'Three weeks ago', ''),
+
+            ('-0000-01-00 00:00:00.00', 'One month ago', ''),
+            ('-0000-02-00 00:00:00.00', 'Two months ago', ''),
+            ('-0000-03-00 00:00:00.00', 'Three months ago', ''),
+            ('-0000-04-00 00:00:00.00', 'Four months ago', ''),
+            ('-0000-05-00 00:00:00.00', 'Five months ago', ''),
+            ('-0000-06-00 00:00:00.00', 'Half a year ago', ''),
+
+            ('-0001-00-00 00:00:00.00', 'One year ago', ''),
+        ]
+        fSelected = False;
+        for sTimestamp, sWayBackPointCaption, sExtraAttrs in aoWayBackPoints:
+            if sTimestamp == tsEffective:
+                fSelected = True;
+            sHtmlTimeSelector += '    <option value="%s"%s%s>%s</option>\n' \
+                              % (webutils.quoteUrl(sTimestamp),
+                                 ' selected="selected"' if sTimestamp == tsEffective else '',
+                                 sExtraAttrs, sWayBackPointCaption)
+        if not fSelected and tsEffective != '':
+            sHtmlTimeSelector += '    <option value="%s" selected>%s</option>\n' \
+                              % (webutils.quoteUrl(tsEffective), tsEffective)
+
+        sHtmlTimeSelector += '  </select>\n';
+        sHtmlTimeSelector += sPostamble;
+        sHtmlTimeSelector += '\n</form>\n'
+
+        return sHtmlTimeSelector
+
+    def _generateTimeWalker(self, dParams, tsEffective, sCurPeriod):
+        """
+        Generates HTML code for walking back and forth in time.
+        """
+        # Have to do some math here. :-/
+        if tsEffective is None:
+            self._oDb.execute('SELECT CURRENT_TIMESTAMP - \'' + sCurPeriod + '\'::interval');
+            tsNext = None;
+            tsPrev = self._oDb.fetchOne()[0];
+        else:
+            self._oDb.execute('SELECT %s::TIMESTAMP - \'' + sCurPeriod + '\'::interval,\n'
+                              '       %s::TIMESTAMP + \'' + sCurPeriod + '\'::interval',
+                              (tsEffective, tsEffective,));
+            tsPrev, tsNext = self._oDb.fetchOne();
+
+        # Forget about page No when changing a period
+        if WuiDispatcherBase.ksParamPageNo in dParams:
+            del dParams[WuiDispatcherBase.ksParamPageNo]
+
+        # Format.
+        dParams[WuiDispatcherBase.ksParamEffectiveDate] = str(tsPrev);
+        sPrev = '<a href="?%s" title="One period earlier"><<</a>  ' \
+              % (webutils.encodeUrlParams(dParams),);
+
+        if tsNext is not None:
+            dParams[WuiDispatcherBase.ksParamEffectiveDate] = str(tsNext);
+            sNext = '  <a href="?%s" title="One period later">>></a>' \
+                   % (webutils.encodeUrlParams(dParams),);
+        else:
+            sNext = '  >>';
+
+        return self._generateTimeSelector(self.getParameters(), sPrev, sNext);
+
+    def _generateResultPeriodSelector(self, dParams, sCurPeriod):
+        """
+        Generate HTML code for result period selector.
+        """
+
+        if self.ksParamEffectivePeriod in dParams:
+            del dParams[self.ksParamEffectivePeriod];
+
+        # Forget about page No when changing a period
+        if WuiDispatcherBase.ksParamPageNo in dParams:
+            del dParams[WuiDispatcherBase.ksParamPageNo]
+
+        sHtmlPeriodSelector  = '<form name="PeriodForm" method="GET">\n'
+        sHtmlPeriodSelector += '  Period is\n'
+        sHtmlPeriodSelector += '  <select name="%s" onchange="window.location=' % self.ksParamEffectivePeriod
+        sHtmlPeriodSelector += '\'?%s&%s=\' + ' % (webutils.encodeUrlParams(dParams), self.ksParamEffectivePeriod)
+        sHtmlPeriodSelector += 'this.options[this.selectedIndex].value;">\n'
+
+        for sPeriodValue, sPeriodCaption, _ in self.kaoResultPeriods:
+            sHtmlPeriodSelector += '    <option value="%s"%s>%s</option>\n' \
+                                % (webutils.quoteUrl(sPeriodValue),
+                                   ' selected="selected"' if sPeriodValue == sCurPeriod else '',
+                                   sPeriodCaption)
+
+        sHtmlPeriodSelector += '  </select>\n' \
+                               '</form>\n'
+
+        return sHtmlPeriodSelector
+
+    def _generateGroupContentSelector(self, aoGroupMembers, iCurrentMember, sAltAction):
+        """
+        Generate HTML code for group content selector.
+        """
+
+        dParams = self.getParameters()
+
+        if self.ksParamGroupMemberId in dParams:
+            del dParams[self.ksParamGroupMemberId]
+
+        if sAltAction is not None:
+            if self.ksParamAction in dParams:
+                del dParams[self.ksParamAction];
+            dParams[self.ksParamAction] = sAltAction;
+
+        sHtmlSelector  = '<form name="GroupContentForm" method="GET">\n'
+        sHtmlSelector += '  <select name="%s" onchange="window.location=' % self.ksParamGroupMemberId
+        sHtmlSelector += '\'?%s&%s=\' + ' % (webutils.encodeUrlParams(dParams), self.ksParamGroupMemberId)
+        sHtmlSelector += 'this.options[this.selectedIndex].value;">\n'
+
+        sHtmlSelector += '<option value="-1">All</option>\n'
+
+        for iGroupMemberId, sGroupMemberName in aoGroupMembers:
+            if iGroupMemberId is not None:
+                sHtmlSelector += '    <option value="%s"%s>%s</option>\n' \
+                                    % (iGroupMemberId,
+                                       ' selected="selected"' if iGroupMemberId == iCurrentMember else '',
+                                       sGroupMemberName)
+
+        sHtmlSelector += '  </select>\n' \
+                         '</form>\n'
+
+        return sHtmlSelector
+
+    def _generatePagesSelector(self, dParams, cItems, cItemsPerPage, iPage):
+        """
+        Generate HTML code for pages (1, 2, 3 ... N) selector
+        """
+
+        if WuiDispatcherBase.ksParamPageNo in dParams:
+            del dParams[WuiDispatcherBase.ksParamPageNo]
+
+        sHrefPtr    = '<a href="?%s&%s=' % (webutils.encodeUrlParams(dParams).replace('%', '%%'),
+                                            WuiDispatcherBase.ksParamPageNo)
+        sHrefPtr   += '%d">%s</a>'
+
+        cNumOfPages      = (cItems + cItemsPerPage - 1) / cItemsPerPage;
+        cPagesToDisplay  = 10
+        cPagesRangeStart = iPage - cPagesToDisplay / 2 \
+                           if not iPage - cPagesToDisplay / 2 < 0 else 0
+        cPagesRangeEnd   = cPagesRangeStart + cPagesToDisplay \
+                           if not cPagesRangeStart + cPagesToDisplay > cNumOfPages else cNumOfPages
+        # Adjust pages range
+        if cNumOfPages < cPagesToDisplay:
+            cPagesRangeStart = 0
+            cPagesRangeEnd   = cNumOfPages
+
+        # 1 2 3 4...
+        sHtmlPager  = ' \n'.join(sHrefPtr % (x, str(x + 1)) if x != iPage else str(x + 1)
+                                      for x in range(cPagesRangeStart, cPagesRangeEnd))
+        if cPagesRangeStart > 0:
+            sHtmlPager = '%s  ...  \n' % (sHrefPtr % (0, str(1))) + sHtmlPager
+        if cPagesRangeEnd < cNumOfPages:
+            sHtmlPager += ' ... %s\n' % (sHrefPtr % (cNumOfPages, str(cNumOfPages + 1)))
+
+        # Prev/Next (using << >> because « and &raquo are too tiny).
+        if iPage > 0:
+            dParams[WuiDispatcherBase.ksParamPageNo] = iPage - 1
+            sHtmlPager = ('<a title="Previous page" href="?%s"><<</a>  \n'
+                          % (webutils.encodeUrlParams(dParams), )) \
+                          + sHtmlPager;
+        else:
+            sHtmlPager = '<<  \n' + sHtmlPager
+
+        if iPage + 1 < cNumOfPages:
+            dParams[WuiDispatcherBase.ksParamPageNo] = iPage + 1
+            sHtmlPager += '\n  <a title="Next page" href="?%s">>></a>\n' % (webutils.encodeUrlParams(dParams),)
+        else:
+            sHtmlPager += '\n  >>\n'
+
+        return sHtmlPager
+
+    def _generateItemPerPageSelector(self, dParams, cItemsPerPage):
+        """
+        Generate HTML code for items per page selector
+        """
+
+        if WuiDispatcherBase.ksParamItemsPerPage in dParams:
+            del dParams[WuiDispatcherBase.ksParamItemsPerPage]
+
+        # Forced reset of the page number
+        dParams[WuiDispatcherBase.ksParamPageNo] = 0
+        sHtmlItemsPerPageSelector  = '<form name="AgesPerPageForm" method="GET">\n' \
+                                     '  Max <select name="%s" onchange="window.location=\'?%s&%s=\' + ' \
+                                     'this.options[this.selectedIndex].value;" title="Max items per page">\n' \
+                                   % (WuiDispatcherBase.ksParamItemsPerPage,
+                                      webutils.encodeUrlParams(dParams),
+                                      WuiDispatcherBase.ksParamItemsPerPage)
+
+        aiItemsPerPage = [16, 32, 64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096];
+        for iItemsPerPage in aiItemsPerPage:
+            sHtmlItemsPerPageSelector += '    <option value="%d" %s>%d</option>\n' \
+                                       % (iItemsPerPage,
+                                          'selected="selected"' if iItemsPerPage == cItemsPerPage else '',
+                                          iItemsPerPage)
+        sHtmlItemsPerPageSelector += '  </select> items per page\n' \
+                                     '</form>\n'
+
+        return sHtmlItemsPerPageSelector
+
+    def _generateResultNavigation(self, cItems, cItemsPerPage, iPage, tsEffective, sCurPeriod, fOnlyFailures,
+                                  sHtmlMemberSelector):
+        """ Make custom time navigation bar for the results. """
+
+        # Generate the elements.
+        sHtmlStatusSelector = self._generateStatusSelector(self.getParameters(), fOnlyFailures);
+        sHtmlPeriodSelector = self._generateResultPeriodSelector(self.getParameters(), sCurPeriod)
+        sHtmlTimeWalker     = self._generateTimeWalker(self.getParameters(), tsEffective, sCurPeriod);
+
+        if cItems > 0:
+            sHtmlPager = self._generatePagesSelector(self.getParameters(), cItems, cItemsPerPage, iPage)
+            sHtmlItemsPerPageSelector = self._generateItemPerPageSelector(self.getParameters(), cItemsPerPage)
+        else:
+            sHtmlPager = ''
+            sHtmlItemsPerPageSelector = ''
+
+        # Generate navigation bar
+        sHtml = '<table width=100%>\n' \
+                '<tr>\n' \
+                ' <td width=30%>' + sHtmlMemberSelector + '</td>\n' \
+                ' <td width=40% align=center>' + sHtmlTimeWalker + '</td>' \
+                ' <td width=30% align=right>\n' + sHtmlPeriodSelector + '</td>\n' \
+                '</tr>\n' \
+                '<tr>\n' \
+                ' <td width=30%>' + sHtmlStatusSelector + '</td>\n' \
+                ' <td width=40% align=center>\n' + sHtmlPager + '</td>\n' \
+                ' <td width=30% align=right>\n' + sHtmlItemsPerPageSelector + '</td>\n'\
+                '</tr>\n' \
+                '</table>\n'
+
+        return sHtml
+
+    def _generateReportNavigation(self, tsEffective, cHoursPerPeriod, cPeriods):
+        """ Make time navigation bar for the reports. """
+
+        # The period length selector.
+        dParams = self.getParameters();
+        if WuiMain.ksParamReportPeriodInHours in dParams:
+            del dParams[WuiMain.ksParamReportPeriodInHours];
+        sHtmlPeriodLength  = '';
+        sHtmlPeriodLength += '<form name="ReportPeriodInHoursForm" method="GET">\n' \
+                             '  Period length <select name="%s" onchange="window.location=\'?%s&%s=\' + ' \
+                             'this.options[this.selectedIndex].value;" title="Statistics period length in hours.">\n' \
+                           % (WuiMain.ksParamReportPeriodInHours,
+                              webutils.encodeUrlParams(dParams),
+                              WuiMain.ksParamReportPeriodInHours)
+        for cHours in [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 18, 24, 48, 72, 96, 120, 144, 168 ]:
+            sHtmlPeriodLength += '    <option value="%d"%s>%d hour%s</option>\n' \
+                               % (cHours, 'selected="selected"' if cHours == cHoursPerPeriod else '', cHours,
+                                  's' if cHours > 1 else '');
+        sHtmlPeriodLength += '  </select>\n' \
+                             '</form>\n'
+
+        # The period count selector.
+        dParams = self.getParameters();
+        if WuiMain.ksParamReportPeriods in dParams:
+            del dParams[WuiMain.ksParamReportPeriods];
+        sHtmlCountOfPeriods  = '';
+        sHtmlCountOfPeriods += '<form name="ReportPeriodsForm" method="GET">\n' \
+                               '  Periods <select name="%s" onchange="window.location=\'?%s&%s=\' + ' \
+                               'this.options[this.selectedIndex].value;" title="Statistics periods to report.">\n' \
+                             % (WuiMain.ksParamReportPeriods,
+                                webutils.encodeUrlParams(dParams),
+                                WuiMain.ksParamReportPeriods)
+        for cCurPeriods in range(2, 43):
+            sHtmlCountOfPeriods += '    <option value="%d"%s>%d</option>\n' \
+                                 % (cCurPeriods, 'selected="selected"' if cCurPeriods == cPeriods else '', cCurPeriods);
+        sHtmlCountOfPeriods += '  </select>\n' \
+                               '</form>\n'
+
+        # The time walker.
+        sHtmlTimeWalker = self._generateTimeWalker(self.getParameters(), tsEffective, '%d hours' % (cHoursPerPeriod));
+
+        # Combine them all.
+        sHtml = '<table width=100%>\n' \
+                ' <tr>\n' \
+                '  <td width=30% align="center">\n' + sHtmlPeriodLength + '</td>\n' \
+                '  <td width=40% align="center">\n' + sHtmlTimeWalker + '</td>' \
+                '  <td width=30% align="center">\n' + sHtmlCountOfPeriods + '</td>\n' \
+                ' </tr>\n' \
+                '</table>\n';
+        return sHtml;
+
+    #
+    # The rest of stuff
+    #
+
+    def _actionGroupedResultsListing( #pylint: disable=R0914
+            self,
+            enmResultsGroupingType,
+            oResultsLogicType,
+            oResultsListContentType):
+        """
+        Override generic listing action.
+
+        oLogicType implements fetchForListing.
+        oListContentType is a child of WuiListContentBase.
+        """
+        cItemsPerPage     = self.getIntParam(self.ksParamItemsPerPage,  iMin =  2, iMax =   9999, iDefault = 128)
+        iPage             = self.getIntParam(self.ksParamPageNo,        iMin =  0, iMax = 999999, iDefault = 0)
+        tsEffective       = self.getEffectiveDateParam()
+        iGroupMemberId    = self.getIntParam(self.ksParamGroupMemberId, iMin = -1, iMax = 999999, iDefault = -1)
+        fOnlyFailures     = self.getBoolParam(self.ksParamOnlyFailures, fDefault = False);
+
+        # Get testing results period and validate it
+        asValidValues = [x for (x, _, _) in self.kaoResultPeriods]
+        sCurPeriod        = self.getStringParam(self.ksParamEffectivePeriod, asValidValues = asValidValues,
+                                                sDefault = self.ksResultPeriodDefault)
+        assert sCurPeriod != ''; # Impossible!
+
+        self._checkForUnknownParameters()
+
+        #
+        # Fetch the group members.
+        #
+        # If no grouping is selected, we'll fill the the grouping combo with
+        # testboxes just to avoid having completely useless combo box.
+        #
+        oTrLogic = TestResultLogic(self._oDb);
+        sAltSelectorAction = None;
+        if   enmResultsGroupingType == TestResultLogic.ksResultsGroupingTypeNone \
+          or enmResultsGroupingType == TestResultLogic.ksResultsGroupingTypeTestBox:
+            aoTmp = oTrLogic.getTestBoxes(tsNow = tsEffective, sPeriod = sCurPeriod)
+            aoGroupMembers = sorted(list(set([ (x.idTestBox, '%s (%s)' % (x.sName, str(x.ip))) for x in aoTmp ])),
+                                    reverse = False, key = lambda asData: asData[1])
+
+            if enmResultsGroupingType == TestResultLogic.ksResultsGroupingTypeTestBox:
+                self._sPageTitle = 'Grouped by Test Box';
+            else:
+                self._sPageTitle = 'Ungrouped results';
+                sAltSelectorAction = self.ksActionResultsGroupedByTestBox;
+                aoGroupMembers.insert(0, [None, None]); # The "All" member.
+
+        elif enmResultsGroupingType == TestResultLogic.ksResultsGroupingTypeTestGroup:
+            aoTmp = oTrLogic.getTestGroups(tsNow = tsEffective, sPeriod = sCurPeriod);
+            aoGroupMembers = sorted(list(set([ (x.idTestGroup, x.sName ) for x in aoTmp ])),
+                                    reverse = False, key = lambda asData: asData[1])
+            self._sPageTitle = 'Grouped by Test Group'
+
+        elif enmResultsGroupingType == TestResultLogic.ksResultsGroupingTypeBuildRev:
+            aoTmp = oTrLogic.getBuilds(tsNow = tsEffective, sPeriod = sCurPeriod)
+            aoGroupMembers = sorted(list(set([ (x.iRevision, '%s.%d' % (x.oCat.sBranch, x.iRevision)) for x in aoTmp ])),
+                                    reverse = True, key = lambda asData: asData[0])
+            self._sPageTitle = 'Grouped by Build'
+
+        elif enmResultsGroupingType == TestResultLogic.ksResultsGroupingTypeTestCase:
+            aoTmp = oTrLogic.getTestCases(tsNow = tsEffective, sPeriod = sCurPeriod)
+            aoGroupMembers = sorted(list(set([ (x.idTestCase, '%s' % x.sName) for x in aoTmp ])),
+                                    reverse = False, key = lambda asData: asData[1])
+            self._sPageTitle = 'Grouped by Test Case'
+
+        elif enmResultsGroupingType == TestResultLogic.ksResultsGroupingTypeSchedGroup:
+            aoTmp = oTrLogic.getSchedGroups(tsNow = tsEffective, sPeriod = sCurPeriod)
+            aoGroupMembers = sorted(list(set([ (x.idSchedGroup, '%s' % x.sName) for x in aoTmp ])),
+                                    reverse = False, key = lambda asData: asData[1])
+            self._sPageTitle = 'Grouped by Scheduling Group'
+
+        else:
+            raise TMExceptionBase('Unknown grouping type')
+
+        _sPageBody  = ''
+        oContent    = None
+        cEntriesMax = 0
+        _dParams    = self.getParameters()
+        for idMember, sMemberName in aoGroupMembers:
+            #
+            # Count and fetch entries to be displayed.
+            #
+
+            # Skip group members that were not specified.
+            if    idMember != iGroupMemberId \
+              and (   (idMember is not None and enmResultsGroupingType == TestResultLogic.ksResultsGroupingTypeNone)
+                   or (iGroupMemberId > 0   and enmResultsGroupingType != TestResultLogic.ksResultsGroupingTypeNone) ):
+                continue
+
+            oResultLogic = oResultsLogicType(self._oDb);
+            cEntries = oResultLogic.getEntriesCount(tsNow = tsEffective,
+                                                    sInterval = sCurPeriod,
+                                                    enmResultsGroupingType = enmResultsGroupingType,
+                                                    iResultsGroupingValue = idMember,
+                                                    fOnlyFailures = fOnlyFailures);
+            if cEntries == 0: # Do not display empty groups
+                continue
+            aoEntries = oResultLogic.fetchResultsForListing(iPage * cItemsPerPage,
+                                                            cItemsPerPage,
+                                                            tsNow = tsEffective,
+                                                            sInterval = sCurPeriod,
+                                                            enmResultsGroupingType = enmResultsGroupingType,
+                                                            iResultsGroupingValue = idMember,
+                                                            fOnlyFailures = fOnlyFailures)
+
+            cEntriesMax = max(cEntriesMax, cEntries)
+
+            #
+            # Format them.
+            #
+            oContent = oResultsListContentType(aoEntries,
+                                               cEntries,
+                                               iPage,
+                                               cItemsPerPage,
+                                               tsEffective,
+                                               fnDPrint = self._oSrvGlue.dprint,
+                                               oDisp = self)
+
+            (_, sHtml) = oContent.show(fShowNavigation = False)
+            if sMemberName is not None:
+                _sPageBody += '<table width=100%><tr><td>'
+
+                _dParams[self.ksParamGroupMemberId] = idMember
+                sLink = WuiTmLink(sMemberName, '', _dParams, fBracketed = False).toHtml()
+
+                _sPageBody += '<h2>%s (%d)</h2></td>' % (sLink, cEntries)
+                _sPageBody += '<td><br></td>'
+                _sPageBody += '</tr></table>'
+            _sPageBody += sHtml
+            _sPageBody += '<br>'
+
+        #
+        # Complete the page by slapping navigation controls at the top and
+        # bottom of it.
+        #
+        sHtmlNavigation = self._generateResultNavigation(cEntriesMax, cItemsPerPage, iPage,
+                                                         tsEffective, sCurPeriod, fOnlyFailures,
+                                                         self._generateGroupContentSelector(aoGroupMembers, iGroupMemberId,
+                                                                                            sAltSelectorAction));
+        if cEntriesMax > 0:
+            self._sPageBody = sHtmlNavigation + _sPageBody + sHtmlNavigation;
+        else:
+            self._sPageBody = sHtmlNavigation + '<p align="center"><i>No data to display</i></p>\n';
+        return True;
+
+    def _generatePage(self):
+        """Override parent handler in order to change page title."""
+        if self._sPageTitle is not None:
+            self._sPageTitle = 'Test Results - ' + self._sPageTitle
+
+        return WuiDispatcherBase._generatePage(self)
+
+    def actionTestResultDetails(self):
+        """Show test case execution result details."""
+        from testmanager.webui.wuitestresult import WuiTestResult;
+
+        self._sTemplate = 'template-details.html';
+        idTestSet = self.getIntParam(TestSetData.ksParam_idTestSet);
+        self._checkForUnknownParameters()
+
+        oTestSetData          = TestSetData().initFromDbWithId(self._oDb, idTestSet);
+        try:
+            (oTestResultTree, _) = TestResultLogic(self._oDb).fetchResultTree(idTestSet);
+        except TMTooManyRows:
+            (oTestResultTree, _) = TestResultLogic(self._oDb).fetchResultTree(idTestSet, 2);
+        oBuildDataEx          = BuildDataEx().initFromDbWithId(self._oDb, oTestSetData.idBuild, oTestSetData.tsCreated);
+        try:    oBuildValidationKitDataEx = BuildDataEx().initFromDbWithId(self._oDb, oTestSetData.idBuildTestSuite,
+                                                                       oTestSetData.tsCreated);
+        except: oBuildValidationKitDataEx = None;
+        oTestBoxData          = TestBoxData().initFromDbWithGenId(self._oDb, oTestSetData.idGenTestBox);
+        oTestGroupData        = TestGroupData().initFromDbWithId(self._oDb,  ## @todo This bogus time wise. Bad DB design?
+                                                                 oTestSetData.idTestGroup, oTestSetData.tsCreated);
+        oTestCaseDataEx       = TestCaseDataEx().initFromDbWithGenId(self._oDb, oTestSetData.idGenTestCase,
+                                                                     oTestSetData.tsConfig);
+        oTestCaseArgsDataEx   = TestCaseArgsDataEx().initFromDbWithGenIdEx(self._oDb, oTestSetData.idGenTestCaseArgs,
+                                                                           oTestSetData.tsConfig);
+
+        oContent = WuiTestResult(oDisp = self, fnDPrint = self._oSrvGlue.dprint);
+        (self._sPageTitle, self._sPageBody) = oContent.showTestCaseResultDetails(oTestResultTree,
+                                                                                 oTestSetData,
+                                                                                 oBuildDataEx,
+                                                                                 oBuildValidationKitDataEx,
+                                                                                 oTestBoxData,
+                                                                                 oTestGroupData,
+                                                                                 oTestCaseDataEx,
+                                                                                 oTestCaseArgsDataEx);
+        return True
+
+    def actionViewLog(self):
+        """
+        Log viewer action.
+        """
+        from testmanager.webui.wuilogviewer import WuiLogViewer;
+        self._sTemplate = 'template-details.html'; ## @todo create new template (background color, etc)
+        idTestSet       = self.getIntParam(self.ksParamLogSetId,     iMin = 1);
+        idLogFile       = self.getIntParam(self.ksParamLogFileId,    iMin = 0,                    iDefault = 0);
+        cbChunk         = self.getIntParam(self.ksParamLogChunkSize, iMin = 256, iMax = 16777216, iDefault = 65536);
+        iChunk          = self.getIntParam(self.ksParamLogChunkNo,   iMin = 0,
+                                           iMax = config.g_kcMbMaxMainLog * 1048576 / cbChunk,    iDefault = 0);
+        self._checkForUnknownParameters();
+
+        oTestSet = TestSetData().initFromDbWithId(self._oDb, idTestSet);
+        if idLogFile == 0:
+            oTestFile = TestResultFileDataEx().initFakeMainLog(oTestSet);
+        else:
+            oTestFile = TestSetLogic(self._oDb).getFile(idTestSet, idLogFile);
+        if oTestFile.sMime not in [ 'text/plain',]:
+            raise WuiException('The log view does not display files of type: %s' % (oTestFile.sMime,));
+
+        oContent = WuiLogViewer(oTestSet, oTestFile, cbChunk, iChunk, oDisp = self, fnDPrint = self._oSrvGlue.dprint);
+        (self._sPageTitle, self._sPageBody) = oContent.show();
+        return True;
+
+    def actionGetFile(self):
+        """
+        Get file action.
+        """
+        idTestSet       = self.getIntParam(self.ksParamGetFileSetId,        iMin = 1);
+        idFile          = self.getIntParam(self.ksParamGetFileId,           iMin = 0, iDefault = 0);
+        fDownloadIt     = self.getBoolParam(self.ksParamGetFileDownloadIt,  fDefault = True);
+        self._checkForUnknownParameters();
+
+        #
+        # Get the file info and open it.
+        #
+        oTestSet = TestSetData().initFromDbWithId(self._oDb, idTestSet);
+        if idFile == 0:
+            oTestFile = TestResultFileDataEx().initFakeMainLog(oTestSet);
+        else:
+            oTestFile = TestSetLogic(self._oDb).getFile(idTestSet, idFile);
+
+        (oFile, oSizeOrError, _) = oTestSet.openFile(oTestFile.sFile, 'rb');
+        if oFile is None:
+            raise Exception(oSizeOrError);
+
+        #
+        # Send the file.
+        #
+        self._oSrvGlue.setHeaderField('Content-Type', oTestFile.getMimeWithEncoding());
+        if fDownloadIt:
+            self._oSrvGlue.setHeaderField('Content-Disposition', 'attachment; filename="TestSet-%d-%s"'
+                                          % (idTestSet, oTestFile.sFile,));
+        while True:
+            abChunk = oFile.read(262144);
+            if len(abChunk) == 0:
+                break;
+            self._oSrvGlue.writeRaw(abChunk);
+        return self.ksDispatchRcAllDone;
+
+    def _actionGenericReport(self, oModelType, oReportType):
+        """
+        Generic report action.
+        oReportType is a child of WuiReportContentBase.
+        oModelType is a child of ReportModelBase.
+        """
+        tsEffective     = self.getEffectiveDateParam();
+        cPeriods        = self.getIntParam(self.ksParamReportPeriods,       iMin = 2, iMax =   99,  iDefault = 7);
+        cHoursPerPeriod = self.getIntParam(self.ksParamReportPeriodInHours, iMin = 1, iMax =   168, iDefault = 24);
+        sSubject        = self.getStringParam(self.ksParamReportSubject, ReportModelBase.kasSubjects,
+                                              ReportModelBase.ksSubEverything);
+        if sSubject == ReportModelBase.ksSubEverything:
+            aidSubjects = self.getListOfIntParams(self.ksParamReportSubjectIds, aiDefaults = []);
+        else:
+            aidSubjects = self.getListOfIntParams(self.ksParamReportSubjectIds, iMin = 1);
+            if aidSubjects is None:
+                raise WuiException('Missing parameter %s' % (self.ksParamReportSubjectIds,));
+        self._checkForUnknownParameters();
+
+        dParams = \
+        {
+            self.ksParamEffectiveDate:          tsEffective,
+            self.ksParamReportPeriods:          cPeriods,
+            self.ksParamReportPeriodInHours:    cHoursPerPeriod,
+            self.ksParamReportSubject:          sSubject,
+            self.ksParamReportSubjectIds:       aidSubjects,
+        };
+
+        oModel   = oModelType(self._oDb, tsEffective, cPeriods, cHoursPerPeriod, sSubject, aidSubjects);
+        oContent = oReportType(oModel, dParams, fSubReport = False, fnDPrint = self._oSrvGlue.dprint, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oContent.show();
+        sNavi = self._generateReportNavigation(tsEffective, cHoursPerPeriod, cPeriods);
+        self._sPageBody = sNavi + self._sPageBody;
+        return True;
+
+    def _actionGraphWiz(self):
+        """
+        Graph wizard action.
+        """
+        from testmanager.webui.wuigraphwiz import WuiGraphWiz;
+        self._sTemplate = 'template-graphwiz.html';
+
+        tsEffective     = self.getEffectiveDateParam();
+        cPeriods        = self.getIntParam(self.ksParamReportPeriods, iMin = 1, iMax = 1, iDefault = 1); # Not needed yet.
+        sTmp            = self.getStringParam(self.ksParamReportPeriodInHours, sDefault = '3 weeks');
+        (cHoursPerPeriod, sError) = utils.parseIntervalHours(sTmp);
+        if sError is not None: raise WuiException(sError);
+        asSubjectIds    = self.getListOfStrParams(self.ksParamReportSubjectIds);
+        sSubject        = self.getStringParam(self.ksParamReportSubject, [ReportModelBase.ksSubEverything],
+                                              ReportModelBase.ksSubEverything); # dummy
+        aidTestBoxes    = self.getListOfIntParams(self.ksParamGraphWizTestBoxIds,  iMin = 1, aiDefaults = []);
+        aidBuildCats    = self.getListOfIntParams(self.ksParamGraphWizBuildCatIds, iMin = 1, aiDefaults = []);
+        aidTestCases    = self.getListOfIntParams(self.ksParamGraphWizTestCaseIds, iMin = 1, aiDefaults = []);
+        fSepTestVars    = self.getBoolParam(self.ksParamGraphWizSepTestVars, fDefault = False);
+
+        enmGraphImpl    = self.getStringParam(self.ksParamGraphWizImpl, asValidValues = self.kasGraphWizImplValid,
+                                              sDefault = self.ksGraphWizImpl_Default);
+        cx              = self.getIntParam(self.ksParamGraphWizWidth,  iMin = 128, iMax = 8192, iDefault = 1280);
+        cy              = self.getIntParam(self.ksParamGraphWizHeight, iMin = 128, iMax = 8192, iDefault = int(cx * 5 / 16) );
+        cDotsPerInch    = self.getIntParam(self.ksParamGraphWizDpi,    iMin =  64, iMax =  512, iDefault = 96);
+        cPtFont         = self.getIntParam(self.ksParamGraphWizFontSize, iMin = 6, iMax =  32,  iDefault = 8);
+        fErrorBarY      = self.getBoolParam(self.ksParamGraphWizErrorBarY, fDefault = False);
+        cMaxErrorBarY   = self.getIntParam(self.ksParamGraphWizMaxErrorBarY, iMin = 8, iMax = 9999999, iDefault = 18);
+        cMaxPerGraph    = self.getIntParam(self.ksParamGraphWizMaxPerGraph, iMin = 1, iMax = 24, iDefault = 8);
+        fXkcdStyle      = self.getBoolParam(self.ksParamGraphWizXkcdStyle, fDefault = False);
+        fTabular        = self.getBoolParam(self.ksParamGraphWizTabular, fDefault = False);
+        idSrcTestSet    = self.getIntParam(self.ksParamGraphWizSrcTestSetId, iDefault = None);
+        self._checkForUnknownParameters();
+
+        dParams = \
+        {
+            self.ksParamEffectiveDate:          tsEffective,
+            self.ksParamReportPeriods:          cPeriods,
+            self.ksParamReportPeriodInHours:    cHoursPerPeriod,
+            self.ksParamReportSubject:          sSubject,
+            self.ksParamReportSubjectIds:       asSubjectIds,
+            self.ksParamGraphWizTestBoxIds:     aidTestBoxes,
+            self.ksParamGraphWizBuildCatIds:    aidBuildCats,
+            self.ksParamGraphWizTestCaseIds:    aidTestCases,
+            self.ksParamGraphWizSepTestVars:    fSepTestVars,
+
+            self.ksParamGraphWizImpl:           enmGraphImpl,
+            self.ksParamGraphWizWidth:          cx,
+            self.ksParamGraphWizHeight:         cy,
+            self.ksParamGraphWizDpi:            cDotsPerInch,
+            self.ksParamGraphWizFontSize:       cPtFont,
+            self.ksParamGraphWizErrorBarY:      fErrorBarY,
+            self.ksParamGraphWizMaxErrorBarY:   cMaxErrorBarY,
+            self.ksParamGraphWizMaxPerGraph:    cMaxPerGraph,
+            self.ksParamGraphWizXkcdStyle:      fXkcdStyle,
+            self.ksParamGraphWizTabular:        fTabular,
+            self.ksParamGraphWizSrcTestSetId:   idSrcTestSet,
+        };
+
+        oModel   = ReportGraphModel(self._oDb, tsEffective, cPeriods, cHoursPerPeriod, sSubject, asSubjectIds,
+                                    aidTestBoxes, aidBuildCats, aidTestCases, fSepTestVars);
+        oContent = WuiGraphWiz(oModel, dParams, fSubReport = False, fnDPrint = self._oSrvGlue.dprint, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oContent.show();
+        return True;
+
+    def _actionVcsHistoryTooltip(self):
+        """
+        Version control system history.
+        """
+        self._sTemplate = 'template-tooltip.html';
+        from testmanager.webui.wuivcshistory import WuiVcsHistoryTooltip;
+
+        iRevision   = self.getIntParam(self.ksParamVcsHistoryRevision, iMin = 0, iMax = 999999999);
+        sRepository = self.getStringParam(self.ksParamVcsHistoryRepository);
+        cEntries    = self.getIntParam(self.ksParamVcsHistoryEntries, iMin = 1, iMax = 1024, iDefault = 8);
+        self._checkForUnknownParameters();
+
+        aoEntries = VcsRevisionLogic(self._oDb).fetchTimeline(sRepository, iRevision, cEntries);
+        oContent  = WuiVcsHistoryTooltip(aoEntries, sRepository, iRevision, cEntries,
+                                         fnDPrint = self._oSrvGlue.dprint, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oContent.show();
+        return True;
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuireport.py b/src/VBox/ValidationKit/testmanager/webui/wuireport.py
new file mode 100644
index 0000000..439a36c
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuireport.py
@@ -0,0 +1,158 @@
+# -*- coding: utf-8 -*-
+# $Id: wuireport.py $
+
+"""
+Test Manager WUI - Reports.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Validation Kit imports.
+from testmanager.webui.wuicontentbase   import WuiContentBase;
+from testmanager.webui.wuihlpgraph       import WuiHlpGraphDataTable, WuiHlpBarGraph;
+from testmanager.core.report            import ReportModelBase;
+
+
+class WuiReportBase(WuiContentBase):
+    """
+    Base class for the reports.
+    """
+
+    def __init__(self, oModel, dParams, fSubReport = False, fnDPrint = None, oDisp = None):
+        WuiContentBase.__init__(self, fnDPrint = fnDPrint, oDisp = oDisp);
+        self._oModel        = oModel;
+        self._dParams       = dParams;
+        self._fSubReport    = fSubReport;
+        self._sTitle        = None;
+
+    def generateNavigator(self, sWhere):
+        """
+        Generates the navigator (manipulate _dParams).
+        Returns HTML.
+        """
+        assert sWhere == 'top' or sWhere == 'bottom';
+
+        return '';
+
+    def generateReportBody(self):
+        """
+        This is overridden by the child class to generate the report.
+        Returns HTML.
+        """
+        return '<h3>Must override generateReportBody!</h3>';
+
+    def show(self):
+        """
+        Generate the report.
+        Returns (sTitle, HTML).
+        """
+
+        sTitle  = self._sTitle if self._sTitle is not None else type(self).__name__;
+        sReport = self.generateReportBody();
+        if not self._fSubReport:
+            sReport = self.generateNavigator('top') + sReport + self.generateNavigator('bottom');
+            sTitle = self._oModel.sSubject + ' - ' + sTitle; ## @todo add subject to title in a proper way!
+
+        return (sTitle, sReport);
+
+
+class WuiReportSuccessRate(WuiReportBase):
+    """
+    Generates a report displaying the success rate over time.
+    """
+
+    def generateReportBody(self):
+        self._sTitle = 'Success rate';
+
+        adPeriods = self._oModel.getSuccessRates();
+
+        sReport = '';
+
+        oTable = WuiHlpGraphDataTable('Period', [ 'Succeeded', 'Skipped', 'Failed' ]);
+
+        #for i in range(len(adPeriods) - 1, -1, -1):
+        for i in range(len(adPeriods)):
+            dStatuses = adPeriods[i];
+            cSuccess  = dStatuses[ReportModelBase.ksTestStatus_Success] + dStatuses[ReportModelBase.ksTestStatus_Skipped];
+            cTotal    = cSuccess + dStatuses[ReportModelBase.ksTestStatus_Failure];
+            sPeriod   = self._oModel.getPeriodDesc(i);
+            if cTotal > 0:
+                iPctSuccess = dStatuses[ReportModelBase.ksTestStatus_Success] * 100 / cTotal;
+                iPctSkipped = dStatuses[ReportModelBase.ksTestStatus_Skipped] * 100 / cTotal;
+                iPctFailure = dStatuses[ReportModelBase.ksTestStatus_Failure] * 100 / cTotal;
+                oTable.addRow(sPeriod, [ iPctSuccess, iPctSkipped, iPctFailure ],
+                              [ '%s%% (%d)' % (iPctSuccess, dStatuses[ReportModelBase.ksTestStatus_Success]),
+                                '%s%% (%d)' % (iPctSkipped, dStatuses[ReportModelBase.ksTestStatus_Skipped]),
+                                '%s%% (%d)' % (iPctFailure, dStatuses[ReportModelBase.ksTestStatus_Failure]), ]);
+            else:
+                oTable.addRow(sPeriod, [ 0, 0, 0 ], [ '0%', '0%', '0%' ]);
+
+        cTotalNow  = adPeriods[0][ReportModelBase.ksTestStatus_Success];
+        cTotalNow += adPeriods[0][ReportModelBase.ksTestStatus_Skipped];
+        cSuccessNow = cTotalNow;
+        cTotalNow += adPeriods[0][ReportModelBase.ksTestStatus_Failure];
+        sReport += '<p>Current success rate: ';
+        if cTotalNow > 0:
+            sReport += '%s%% (thereof %s%% skipped)</p>\n' \
+                     % ( cSuccessNow * 100 / cTotalNow, adPeriods[0][ReportModelBase.ksTestStatus_Skipped] * 100 / cTotalNow);
+        else:
+            sReport += 'N/A</p>\n'
+
+        oGraph = WuiHlpBarGraph('success-rate', oTable, self._oDisp);
+        oGraph.setRangeMax(100);
+        sReport += oGraph.renderGraph();
+
+        return sReport;
+
+
+class WuiReportFailureReasons(WuiReportBase):
+    """
+    Generates a report displaying the failure reasons over time.
+    """
+
+    def generateReportBody(self):
+        # Mockup.
+        self._sTitle = 'Success rate';
+        return '<p>Graph showing COUNT(idFailureReason) grouped by time period.</p>' \
+               '<p>New reasons per period, tracked down to build revision.</p>' \
+               '<p>Show graph content in table form.</p>';
+
+
+class WuiReportSummary(WuiReportBase):
+    """
+    Summary report.
+    """
+
+    def generateReportBody(self):
+        self._sTitle = 'Summary';
+        sHtml = '<p>This will display several reports and listings useful to get an overview of %s (id=%s).</p>' \
+             % (self._oModel.sSubject, self._oModel.aidSubjects,);
+
+        oSuccessRate = WuiReportSuccessRate(self._oModel, self._dParams, fSubReport = True,
+                                            fnDPrint = self._fnDPrint, oDisp = self._oDisp);
+        sHtml += oSuccessRate.show()[1];
+
+        return sHtml;
+
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuitestresult.py b/src/VBox/ValidationKit/testmanager/webui/wuitestresult.py
new file mode 100644
index 0000000..47fa347
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuitestresult.py
@@ -0,0 +1,713 @@
+# -*- coding: utf-8 -*-
+# $Id: wuitestresult.py $
+
+"""
+Test Manager WUI - Test Results.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96526 $"
+
+# Python imports.
+
+# Validation Kit imports.
+from testmanager.webui.wuicontentbase   import WuiContentBase, WuiListContentBase, WuiHtmlBase, WuiTmLink, WuiLinkBase, \
+                                               WuiSvnLink, WuiSvnLinkWithTooltip, WuiBuildLogLink, WuiRawHtml;
+from testmanager.webui.wuimain          import WuiMain;
+from testmanager.core.report            import ReportGraphModel;
+from testmanager.core.testbox           import TestBoxData;
+from testmanager.core.testcase          import TestCaseData;
+from testmanager.core.testset           import TestSetData;
+from testmanager.core.testgroup         import TestGroupData;
+from testmanager.core.build             import BuildData;
+from testmanager.core                   import db;
+from testmanager                        import config;
+from common                             import webutils, utils;
+
+
+class WuiTestResult(WuiContentBase):
+    """Display test case result"""
+
+    def __init__(self, fnDPrint = None, oDisp = None):
+        WuiContentBase.__init__(self, fnDPrint = fnDPrint, oDisp = oDisp);
+
+        # Cyclic import hacks.
+        from testmanager.webui.wuiadmin  import WuiAdmin;
+        self.oWuiAdmin = WuiAdmin;
+
+    def _toHtml(self, oObject):
+        """Translate some object to HTML."""
+        if isinstance(oObject, WuiHtmlBase):
+            return oObject.toHtml();
+        if db.isDbTimestamp(oObject):
+            return webutils.escapeElem(self.formatTsShort(oObject));
+        if utils.isString(oObject):
+            return webutils.escapeElem(oObject);
+        return webutils.escapeElem(str(oObject));
+
+    def _htmlTable(self, aoTableContent):
+        """Generate HTML code for table"""
+        sHtml  = u'   <table class="tmtbl-testresult-details" width="100%%">\n';
+
+        for aoSubRows in aoTableContent:
+            if len(aoSubRows) == 0:
+                continue; # Can happen if there is no testsuit.
+            oCaption = aoSubRows[0];
+            sHtml += u'    \n' \
+                     u'    <tr class="tmtbl-result-details-caption">\n' \
+                     u'      <td colspan="2">%s</td>\n' \
+                     u'    </tr>\n' \
+                % (self._toHtml(oCaption),);
+
+            iRow = 0;
+            for aoRow in aoSubRows[1:]:
+                iRow  += 1;
+                sHtml += u'    <tr class="%s">\n' % ('tmodd' if iRow & 1 else 'tmeven',);
+                if len(aoRow) == 1:
+                    sHtml += u'      <td class="tmtbl-result-details-subcaption" colspan="2">%s</td>\n' \
+                           % (self._toHtml(aoRow[0]),);
+                else:
+                    sHtml += u'      <th scope="row">%s</th>\n' % (webutils.escapeElem(aoRow[0]),);
+                    if len(aoRow) > 2:
+                        sHtml += u'     <td>%s</td>\n' % (aoRow[2](aoRow[1]),);
+                    else:
+                        sHtml += u'     <td>%s</td>\n' % (self._toHtml(aoRow[1]),);
+                sHtml += u'    </tr>\n';
+
+        sHtml += u'   </table>\n';
+
+        return sHtml
+
+    def _highlightStatus(self, sStatus):
+        """Return sStatus string surrounded by HTML highlight code """
+        sTmp = '<font color=%s><b>%s</b></font>' \
+            % ('red' if sStatus == 'failure' else 'green', webutils.escapeElem(sStatus.upper()))
+        return sTmp
+
+    def _anchorAndAppendBinaries(self, sBinaries, aoRows):
+        """ Formats each binary (if any) into a row with a download link. """
+        if sBinaries is not None:
+            for sBinary in sBinaries.split(','):
+                if not webutils.hasSchema(sBinary):
+                    sBinary = config.g_ksBuildBinUrlPrefix + sBinary;
+                aoRows.append([WuiLinkBase(webutils.getFilename(sBinary), sBinary, fBracketed = False),]);
+        return aoRows;
+
+
+    def _recursivelyGenerateEvents(self, oTestResult, sParentName, sLineage, iRow,
+                                   iFailure, oTestSet, iDepth):     # pylint: disable=R0914
+        """
+        Recursively generate event table rows for the result set.
+
+        oTestResult is an object of the type TestResultDataEx.
+        """
+        # Hack: Replace empty outer test result name with (pretty) command line.
+        if iRow == 1:
+            sName = '';
+            sDisplayName = sParentName;
+        else:
+            sName = oTestResult.sName if sParentName == '' else '%s, %s' % (sParentName, oTestResult.sName,);
+            sDisplayName = webutils.escapeElem(sName);
+
+        # Format error count.
+        sErrCnt = '';
+        if oTestResult.cErrors > 0:
+            sErrCnt = ' (1 error)' if oTestResult.cErrors == 1 else ' (%d errors)' % oTestResult.cErrors;
+
+        # Format the include in graph checkboxes.
+        sLineage += ':%u' % (oTestResult.idStrName,);
+        sResultGraph  = '<input type="checkbox" name="%s" value="%s%s" title="Include result in graph."/>' \
+                      % (WuiMain.ksParamReportSubjectIds, ReportGraphModel.ksTypeResult, sLineage,);
+        sElapsedGraph = '';
+        if oTestResult.tsElapsed is not None:
+            sElapsedGraph = '<input type="checkbox" name="%s" value="%s%s" title="Include elapsed time in graph."/>' \
+                          % ( WuiMain.ksParamReportSubjectIds, ReportGraphModel.ksTypeElapsed, sLineage);
+
+
+        if    len(oTestResult.aoChildren) == 0 \
+          and len(oTestResult.aoValues)   == 0 \
+          and len(oTestResult.aoMsgs)     == 0 \
+          and len(oTestResult.aoFiles)    == 0:
+            # Leaf - single row.
+            tsEvent = oTestResult.tsCreated;
+            if oTestResult.tsElapsed is not None:
+                tsEvent += oTestResult.tsElapsed;
+            sHtml  = ' <tr class="%s tmtbl-events-leaf tmtbl-events-lvl%s tmstatusrow-%s">\n' \
+                     '  <td>%s</td>\n' \
+                     '  <td>%s</td>\n' \
+                     '  <td>%s</td>\n' \
+                     '  <td>%s</td>\n' \
+                     '  <td colspan="2"%s>%s%s</td>\n' \
+                     '  <td>%s</td>\n' \
+                     ' </tr>\n' \
+                   % ( 'tmodd' if iRow & 1 else 'tmeven', iDepth, oTestResult.enmStatus,
+                       webutils.escapeElem(self.formatTsShort(tsEvent)),
+                       sElapsedGraph,
+                       webutils.escapeElem(str(oTestResult.tsElapsed)) if oTestResult.tsElapsed is not None else '',
+                       sDisplayName,
+                       ' id="failure-%u"' % (iFailure,) if oTestResult.isFailure() else '',
+                       webutils.escapeElem(oTestResult.enmStatus), webutils.escapeElem(sErrCnt),
+                       sResultGraph );
+            iRow += 1;
+        else:
+            # Multiple rows.
+            sHtml  = ' <tr class="%s tmtbl-events-first tmtbl-events-lvl%s ">\n' \
+                     '  <td>%s</td>\n' \
+                     '  <td></td>\n' \
+                     '  <td></td>\n' \
+                     '  <td>%s</td>\n' \
+                     '  <td colspan="2">%s</td>\n' \
+                     '  <td></td>\n' \
+                     ' </tr>\n' \
+                   % ( 'tmodd' if iRow & 1 else 'tmeven', iDepth,
+                       webutils.escapeElem(self.formatTsShort(oTestResult.tsCreated)), ## @todo more timeline stuff later.
+                       sDisplayName,
+                       'running' if oTestResult.tsElapsed is None else '', );
+            iRow += 1;
+
+            # Depth.
+            for oChild in oTestResult.aoChildren:
+                (sChildHtml, iRow, iFailure) = self._recursivelyGenerateEvents(oChild, sName, sLineage,
+                                                                               iRow, iFailure, oTestSet, iDepth + 1);
+                sHtml += sChildHtml;
+
+
+            # Messages.
+            for oMsg in oTestResult.aoMsgs:
+                sHtml += ' <tr class="%s tmtbl-events-message tmtbl-events-lvl%s">\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td></td>\n' \
+                         '  <td></td>\n' \
+                         '  <td colspan="3">%s: %s</td>\n' \
+                         '  <td></td>\n' \
+                         ' </tr>\n' \
+                       % ( 'tmodd' if iRow & 1 else 'tmeven', iDepth,
+                           webutils.escapeElem(self.formatTsShort(oMsg.tsCreated)),
+                           webutils.escapeElem(oMsg.enmLevel),
+                           webutils.escapeElem(oMsg.sMsg), );
+                iRow += 1;
+
+            # Values.
+            for oValue in oTestResult.aoValues:
+                sHtml += ' <tr class="%s tmtbl-events-value tmtbl-events-lvl%s">\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td></td>\n' \
+                         '  <td></td>\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td class="tmtbl-events-number">%s</td>\n' \
+                         '  <td class="tmtbl-events-unit">%s</td>\n' \
+                         '  <td><input type="checkbox" name="%s" value="%s%s:%u" title="Include value in graph."></td>\n' \
+                         ' </tr>\n' \
+                       % ( 'tmodd' if iRow & 1 else 'tmeven', iDepth,
+                           webutils.escapeElem(self.formatTsShort(oValue.tsCreated)),
+                           webutils.escapeElem(oValue.sName),
+                           utils.formatNumber(oValue.lValue).replace(' ', ' '),
+                           webutils.escapeElem(oValue.sUnit),
+                           WuiMain.ksParamReportSubjectIds, ReportGraphModel.ksTypeValue, sLineage, oValue.idStrName, );
+                iRow += 1;
+
+            # Files.
+            for oFile in oTestResult.aoFiles:
+                if oFile.sMime in [ 'text/plain', ]:
+                    aoLinks = [
+                        WuiTmLink('%s (%s)' % (oFile.sFile, oFile.sKind), '',
+                                  { self._oDisp.ksParamAction:        self._oDisp.ksActionViewLog,
+                                    self._oDisp.ksParamLogSetId:      oTestSet.idTestSet,
+                                    self._oDisp.ksParamLogFileId:     oFile.idTestResultFile, },
+                                  sTitle = oFile.sDescription),
+                        WuiTmLink('View Raw', '',
+                                  { self._oDisp.ksParamAction:        self._oDisp.ksActionGetFile,
+                                    self._oDisp.ksParamGetFileSetId:  oTestSet.idTestSet,
+                                    self._oDisp.ksParamGetFileId:     oFile.idTestResultFile,
+                                    self._oDisp.ksParamGetFileDownloadIt: False, },
+                                  sTitle = oFile.sDescription),
+                    ]
+                else:
+                    aoLinks = [
+                        WuiTmLink('%s (%s)' % (oFile.sFile, oFile.sKind), '',
+                                  { self._oDisp.ksParamAction:        self._oDisp.ksActionGetFile,
+                                    self._oDisp.ksParamGetFileSetId:  oTestSet.idTestSet,
+                                    self._oDisp.ksParamGetFileId:     oFile.idTestResultFile,
+                                    self._oDisp.ksParamGetFileDownloadIt: False, },
+                                  sTitle = oFile.sDescription),
+                    ]
+                aoLinks.append(WuiTmLink('Download', '',
+                                         { self._oDisp.ksParamAction:        self._oDisp.ksActionGetFile,
+                                           self._oDisp.ksParamGetFileSetId:  oTestSet.idTestSet,
+                                           self._oDisp.ksParamGetFileId:     oFile.idTestResultFile,
+                                           self._oDisp.ksParamGetFileDownloadIt: True, },
+                                         sTitle = oFile.sDescription));
+
+                sHtml += ' <tr class="%s tmtbl-events-file tmtbl-events-lvl%s">\n' \
+                         '  <td></td>\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td></td>\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td></td>\n' \
+                         '  <td></td>\n' \
+                         '  <td></td>\n' \
+                         ' </tr>\n' \
+                       % ( 'tmodd' if iRow & 1 else 'tmeven', iDepth,
+                           webutils.escapeElem(self.formatTsShort(oFile.tsCreated)),
+                           '\n'.join(oLink.toHtml() for oLink in aoLinks),);
+                iRow += 1;
+
+            # Done?
+            if oTestResult.tsElapsed is not None:
+                sHtml += ' <tr class="%s tmtbl-events-final tmtbl-events-lvl%s tmstatusrow-%s">\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td>%s</td>\n' \
+                         '  <td colspan="2"%s>%s%s</td>\n' \
+                         '  <td>%s</td>\n' \
+                         ' </tr>\n' \
+                       % ( 'tmodd' if iRow & 1 else 'tmeven', iDepth, oTestResult.enmStatus,
+                           webutils.escapeElem(self.formatTsShort(oTestResult.tsCreated + oTestResult.tsElapsed)),
+                           sElapsedGraph,
+                           webutils.escapeElem(str(oTestResult.tsElapsed)),
+                           sDisplayName,
+                           ' id="failure-%u"' % (iFailure,) if oTestResult.isFailure() else '',
+                           webutils.escapeElem(oTestResult.enmStatus), webutils.escapeElem(sErrCnt),
+                           sResultGraph);
+                iRow += 1;
+
+        if oTestResult.isFailure():
+            iFailure += 1;
+
+        return (sHtml, iRow, iFailure);
+
+    def showTestCaseResultDetails(self,             # pylint: disable=R0914,R0915
+                                  oTestResultTree,
+                                  oTestSet,
+                                  oBuildEx,
+                                  oValidationKitEx,
+                                  oTestBox,
+                                  oTestGroup,
+                                  oTestCaseEx,
+                                  oTestVarEx):
+        """Show detailed result"""
+        def getTcDepsHtmlList(aoTestCaseData):
+            """Get HTML <ul> list of Test Case name items"""
+            if len(aoTestCaseData) > 0:
+                sTmp = '<ul>'
+                for oTestCaseData in aoTestCaseData:
+                    sTmp += '<li>%s</li>' % (webutils.escapeElem(oTestCaseData.sName),);
+                sTmp += '</ul>'
+            else:
+                sTmp = 'No items'
+            return sTmp
+
+        def getGrDepsHtmlList(aoGlobalResourceData):
+            """Get HTML <ul> list of Global Resource name items"""
+            if len(aoGlobalResourceData) > 0:
+                sTmp = '<ul>'
+                for oGlobalResourceData in aoGlobalResourceData:
+                    sTmp += '<li>%s</li>' % (webutils.escapeElem(oGlobalResourceData.sName),);
+                sTmp += '</ul>'
+            else:
+                sTmp = 'No items'
+            return sTmp
+
+
+        asHtml = []
+
+        # Test result + test set details.
+        aoResultRows = [
+            WuiTmLink(oTestCaseEx.sName, self.oWuiAdmin.ksScriptName,
+                      { self.oWuiAdmin.ksParamAction:         self.oWuiAdmin.ksActionTestCaseDetails,
+                        TestCaseData.ksParam_idTestCase:      oTestCaseEx.idTestCase,
+                        self.oWuiAdmin.ksParamEffectiveDate:  oTestSet.tsConfig, },
+                      fBracketed = False),
+        ];
+        if oTestCaseEx.sDescription is not None and len(oTestCaseEx.sDescription) > 0:
+            aoResultRows.append([oTestCaseEx.sDescription,]);
+        aoResultRows.append([ 'Status:', WuiRawHtml('<span class="tmspan-status-%s">%s</span>'
+                                                    % (oTestResultTree.enmStatus, oTestResultTree.enmStatus,))]);
+        if oTestResultTree.cErrors > 0:
+            aoResultRows.append(( 'Errors:',        oTestResultTree.cErrors ));
+        aoResultRows.append([ 'Elapsed:',       oTestResultTree.tsElapsed ]);
+        cSecCfgTimeout = oTestCaseEx.cSecTimeout if oTestVarEx.cSecTimeout is None else oTestVarEx.cSecTimeout;
+        cSecEffTimeout = cSecCfgTimeout * oTestBox.pctScaleTimeout / 100;
+        aoResultRows.append([ 'Timeout:',
+                              '%s (%s sec)' % (utils.formatIntervalSeconds(cSecEffTimeout), cSecEffTimeout,) ]);
+        if cSecEffTimeout != cSecCfgTimeout:
+            aoResultRows.append([ 'Cfg Timeout:',
+                                  '%s (%s sec)' % (utils.formatIntervalSeconds(cSecCfgTimeout), cSecCfgTimeout,) ]);
+        aoResultRows += [
+            ( 'Started:',       WuiTmLink(self.formatTsShort(oTestSet.tsCreated), WuiMain.ksScriptName,
+                                          { WuiMain.ksParamAction:          WuiMain.ksActionResultsUnGrouped,
+                                            WuiMain.ksParamEffectiveDate:   oTestSet.tsCreated,  },
+                                          fBracketed = False) ),
+        ];
+        if oTestSet.tsDone is not None:
+            aoResultRows += [ ( 'Done:',
+                                WuiTmLink(self.formatTsShort(oTestSet.tsDone), WuiMain.ksScriptName,
+                                          { WuiMain.ksParamAction:          WuiMain.ksActionResultsUnGrouped,
+                                            WuiMain.ksParamEffectiveDate:   oTestSet.tsDone,  },
+                                          fBracketed = False) ) ];
+        else:
+            aoResultRows += [( 'Done:',      'Still running...')];
+        aoResultRows += [( 'Config:',        oTestSet.tsConfig )];
+        if oTestVarEx.cGangMembers > 1:
+            aoResultRows.append([ 'Member No:',    '#%s (of %s)' % (oTestSet.iGangMemberNo, oTestVarEx.cGangMembers) ]);
+
+        aoResultRows += [
+            ( 'Test Group:',    WuiTmLink(oTestGroup.sName, self.oWuiAdmin.ksScriptName,
+                                          { self.oWuiAdmin.ksParamAction:         self.oWuiAdmin.ksActionTestGroupDetails,
+                                            TestGroupData.ksParam_idTestGroup:    oTestGroup.idTestGroup,
+                                            self.oWuiAdmin.ksParamEffectiveDate:  oTestSet.tsConfig,  },
+                                          fBracketed = False) ),
+        ];
+        if oTestVarEx.sTestBoxReqExpr is not None:
+            aoResultRows.append([ 'TestBox reqs:', oTestVarEx.sTestBoxReqExpr ]);
+        elif oTestCaseEx.sTestBoxReqExpr is not None or oTestVarEx.sTestBoxReqExpr is not None:
+            aoResultRows.append([ 'TestBox reqs:', oTestCaseEx.sTestBoxReqExpr ]);
+        if oTestVarEx.sBuildReqExpr is not None:
+            aoResultRows.append([ 'Build reqs:', oTestVarEx.sBuildReqExpr ]);
+        elif oTestCaseEx.sBuildReqExpr is not None or oTestVarEx.sBuildReqExpr is not None:
+            aoResultRows.append([ 'Build reqs:', oTestCaseEx.sBuildReqExpr ]);
+        if oTestCaseEx.sValidationKitZips is not None and oTestCaseEx.sValidationKitZips != '@VALIDATIONKIT_ZIP@':
+            aoResultRows.append([ 'Validation Kit:', oTestCaseEx.sValidationKitZips ]);
+        if oTestCaseEx.aoDepTestCases is not None and len(oTestCaseEx.aoDepTestCases) > 0:
+            aoResultRows.append([ 'Prereq. Test Cases:', oTestCaseEx.aoDepTestCases, getTcDepsHtmlList ]);
+        if oTestCaseEx.aoDepGlobalResources is not None and len(oTestCaseEx.aoDepGlobalResources) > 0:
+            aoResultRows.append([ 'Global Resources:', oTestCaseEx.aoDepGlobalResources, getGrDepsHtmlList ]);
+
+        # Builds.
+        aoBuildRows = [];
+        if oBuildEx is not None:
+            aoBuildRows += [
+                WuiTmLink('Build', self.oWuiAdmin.ksScriptName,
+                          { self.oWuiAdmin.ksParamAction:         self.oWuiAdmin.ksActionBuildDetails,
+                            BuildData.ksParam_idBuild:            oBuildEx.idBuild,
+                            self.oWuiAdmin.ksParamEffectiveDate:  oTestSet.tsCreated, },
+                          fBracketed = False),
+            ];
+            self._anchorAndAppendBinaries(oBuildEx.sBinaries, aoBuildRows);
+            aoBuildRows += [
+                ( 'Revision:',                  WuiSvnLinkWithTooltip(oBuildEx.iRevision, oBuildEx.oCat.sRepository,
+                                                                      fBracketed = False) ),
+                ( 'Product:',                   oBuildEx.oCat.sProduct ),
+                ( 'Branch:',                    oBuildEx.oCat.sBranch ),
+                ( 'Type:',                      oBuildEx.oCat.sType ),
+                ( 'Version:',                   oBuildEx.sVersion ),
+                ( 'Created:',                   oBuildEx.tsCreated ),
+            ];
+            if oBuildEx.uidAuthor is not None:
+                aoBuildRows += [ ( 'Author ID:', oBuildEx.uidAuthor ), ];
+            if oBuildEx.sLogUrl is not None:
+                aoBuildRows += [ ( 'Log:',       WuiBuildLogLink(oBuildEx.sLogUrl, fBracketed = False) ), ];
+
+        aoValidationKitRows = [];
+        if oValidationKitEx is not None:
+            aoValidationKitRows += [
+                WuiTmLink('Validation Kit', self.oWuiAdmin.ksScriptName,
+                          { self.oWuiAdmin.ksParamAction:         self.oWuiAdmin.ksActionBuildDetails,
+                            BuildData.ksParam_idBuild:            oValidationKitEx.idBuild,
+                            self.oWuiAdmin.ksParamEffectiveDate:  oTestSet.tsCreated, },
+                          fBracketed = False),
+            ];
+            self._anchorAndAppendBinaries(oValidationKitEx.sBinaries, aoValidationKitRows);
+            aoValidationKitRows += [ ( 'Revision:',    WuiSvnLink(oValidationKitEx.iRevision, fBracketed = False) ) ];
+            if oValidationKitEx.oCat.sProduct != 'VBox TestSuite':
+                aoValidationKitRows += [ ( 'Product:', oValidationKitEx.oCat.sProduct ), ];
+            if oValidationKitEx.oCat.sBranch != 'trunk':
+                aoValidationKitRows += [ ( 'Product:', oValidationKitEx.oCat.sBranch ), ];
+            if oValidationKitEx.oCat.sType != 'release':
+                aoValidationKitRows += [ ( 'Type:',    oValidationKitEx.oCat.sType), ];
+            if oValidationKitEx.sVersion != '0.0.0':
+                aoValidationKitRows += [ ( 'Version:', oValidationKitEx.sVersion ), ];
+            aoValidationKitRows += [
+                ( 'Created:',                   oValidationKitEx.tsCreated ),
+            ];
+            if oValidationKitEx.uidAuthor is not None:
+                aoValidationKitRows += [ ( 'Author ID:', oValidationKitEx.uidAuthor ), ];
+            if oValidationKitEx.sLogUrl is not None:
+                aoValidationKitRows += [ ( 'Log:', WuiBuildLogLink(oValidationKitEx.sLogUrl, fBracketed = False) ), ];
+
+        # TestBox.
+        aoTestBoxRows = [
+            WuiTmLink(oTestBox.sName, self.oWuiAdmin.ksScriptName,
+                      { self.oWuiAdmin.ksParamAction:     self.oWuiAdmin.ksActionTestBoxDetails,
+                        TestBoxData.ksParam_idGenTestBox: oTestSet.idGenTestBox, },
+                      fBracketed = False),
+        ];
+        if oTestBox.sDescription is not None and len(oTestBox.sDescription) > 0:
+            aoTestBoxRows.append([oTestBox.sDescription, ]);
+        aoTestBoxRows += [
+            ( 'IP:',                       oTestBox.ip ),
+            #( 'UUID:',                     oTestBox.uuidSystem ),
+            #( 'Enabled:',                  oTestBox.fEnabled ),
+            #( 'Lom Kind:',                 oTestBox.enmLomKind ),
+            #( 'Lom IP:',                   oTestBox.ipLom ),
+            ( 'OS/Arch:',                  '%s.%s' % (oTestBox.sOs, oTestBox.sCpuArch) ),
+            ( 'OS Version:',               oTestBox.sOsVersion ),
+            ( 'CPUs:',                     oTestBox.cCpus ),
+        ];
+        if oTestBox.sCpuName is not None:
+            aoTestBoxRows.append(['CPU Name', oTestBox.sCpuName.replace('  ', ' ')]);
+        if oTestBox.lCpuRevision is not None:
+            # ASSUMING x86+AMD64 versioning scheme here.
+            uFamily   = (oTestBox.lCpuRevision >> 24) & 0xff;
+            uModel    = (oTestBox.lCpuRevision >>  8) & 0xffff;
+            uStepping = oTestBox.lCpuRevision         & 0xff;
+            aoTestBoxRows += [
+                ( 'CPU Family',   '%u (%#x)' % ( uFamily,   uFamily, ) ),
+                ( 'CPU Model',    '%u (%#x)' % ( uModel,    uModel, ) ),
+                ( 'CPU Stepping', '%u (%#x)' % ( uStepping, uStepping, ) ),
+            ];
+        asFeatures = [ oTestBox.sCpuVendor, ];
+        if oTestBox.fCpuHwVirt is True:         asFeatures.append(u'HW\u2011Virt');
+        if oTestBox.fCpuNestedPaging is True:   asFeatures.append(u'Nested\u2011Paging');
+        if oTestBox.fCpu64BitGuest is True:     asFeatures.append(u'64\u2011bit\u2011Guest');
+        if oTestBox.fChipsetIoMmu is True:      asFeatures.append(u'I/O\u2011MMU');
+        aoTestBoxRows += [
+            ( 'Features:',                 u' '.join(asFeatures) ),
+            ( 'RAM size:',                 '%s MB' % (oTestBox.cMbMemory,) ),
+            ( 'Scratch Size:',             '%s MB' % (oTestBox.cMbScratch,) ),
+            ( 'Scale Timeout:',            '%s%%' % (oTestBox.pctScaleTimeout,) ),
+            ( 'Script Rev:',               WuiSvnLink(oTestBox.iTestBoxScriptRev, fBracketed = False) ),
+            ( 'Python:',                   oTestBox.formatPythonVersion() ),
+            ( 'Pending Command:',          oTestBox.enmPendingCmd ),
+        ];
+
+        aoRows = [
+            aoResultRows,
+            aoBuildRows,
+            aoValidationKitRows,
+            aoTestBoxRows,
+        ];
+
+        asHtml.append(self._htmlTable(aoRows));
+
+        #
+        # Convert the tree to a list of events, values, message and files.
+        #
+        sHtmlEvents = '';
+        sHtmlEvents += '<table class="tmtbl-events" id="tmtbl-events" width="100%">\n';
+        sHtmlEvents += ' <tr class="tmheader">\n' \
+                       '  <th>When</th>\n' \
+                       '  <th></th>\n' \
+                       '  <th>Elapsed</th>\n' \
+                       '  <th>Event name</th>\n' \
+                       '  <th colspan="2">Value (status)</th>' \
+                       '  <th></th>\n' \
+                       ' </tr>\n';
+        sPrettyCmdLine = ' \\<br>    \n'.join(webutils.escapeElem(oTestCaseEx.sBaseCmd
+                                                                                           + ' '
+                                                                                           + oTestVarEx.sArgs).split() );
+        (sTmp, _, cFailures) = self._recursivelyGenerateEvents(oTestResultTree, sPrettyCmdLine, '', 1, 0, oTestSet, 0);
+        sHtmlEvents += sTmp;
+
+        sHtmlEvents += '</table>\n'
+
+        #
+        # Put it all together.
+        #
+        sHtml  = '<table class="tmtbl-testresult-details-base" width="100%">\n';
+        sHtml += ' <tr>\n'
+        sHtml += '  <td valign="top" width="20%%">\n%s\n</td>\n' % '   <br>\n'.join(asHtml);
+
+        sHtml += '  <td valign="top" width="80%" style="padding-left:6px">\n';
+        sHtml += '   <h2>Events:</h2>\n';
+        sHtml += '   <form action="#" method="get" id="graph-form">\n' \
+                 '    <input type="hidden" name="%s" value="%s"/>\n' \
+                 '    <input type="hidden" name="%s" value="%u"/>\n' \
+                 '    <input type="hidden" name="%s" value="%u"/>\n' \
+                 '    <input type="hidden" name="%s" value="%u"/>\n' \
+                 '    <input type="hidden" name="%s" value="%u"/>\n' \
+                 % ( WuiMain.ksParamAction,               WuiMain.ksActionGraphWiz,
+                     WuiMain.ksParamGraphWizTestBoxIds,   oTestBox.idTestBox,
+                     WuiMain.ksParamGraphWizBuildCatIds,  oBuildEx.idBuildCategory,
+                     WuiMain.ksParamGraphWizTestCaseIds,  oTestSet.idTestCase,
+                     WuiMain.ksParamGraphWizSrcTestSetId, oTestSet.idTestSet,
+                   );
+        if oTestSet.tsDone is not None:
+            sHtml += '    <input type="hidden" name="%s" value="%s"/>\n' \
+                   % ( WuiMain.ksParamEffectiveDate, oTestSet.tsDone, );
+        sHtml += '    <p>\n';
+        sFormButton = '<button type="submit" onclick="%s">Show graphs</button>' \
+                    % ( webutils.escapeAttr('addDynamicGraphInputs("graph-form", "main", "%s", "%s");'
+                                            % (WuiMain.ksParamGraphWizWidth, WuiMain.ksParamGraphWizDpi, )) );
+        sHtml += '     ' + sFormButton + '\n';
+        sHtml += '     %s %s %s\n' \
+               % ( WuiTmLink('Log File', '',
+                             { WuiMain.ksParamAction:             WuiMain.ksActionViewLog,
+                               WuiMain.ksParamLogSetId:           oTestSet.idTestSet,
+                             }),
+                   WuiTmLink('Raw Log', '',
+                             { WuiMain.ksParamAction:             WuiMain.ksActionGetFile,
+                               WuiMain.ksParamGetFileSetId:       oTestSet.idTestSet,
+                               WuiMain.ksParamGetFileDownloadIt:  False,
+                             }),
+                   WuiTmLink('Download Log', '',
+                             { WuiMain.ksParamAction:             WuiMain.ksActionGetFile,
+                               WuiMain.ksParamGetFileSetId:       oTestSet.idTestSet,
+                               WuiMain.ksParamGetFileDownloadIt:  True,
+                             }),
+                  );
+        sHtml += '    </p>\n';
+        if cFailures == 1:
+            sHtml += '    <p>%s</p>\n' % ( WuiTmLink('Jump to failure', '#failure-0'), )
+        elif cFailures > 1:
+            sHtml += '    <p>Jump to failure: ';
+            if cFailures <= 13:
+                for iFailure in range(0, cFailures):
+                    sHtml += ' ' + WuiTmLink('#%u' % (iFailure,), '#failure-%u' % (iFailure,)).toHtml();
+            else:
+                for iFailure in range(0, 6):
+                    sHtml += ' ' + WuiTmLink('#%u' % (iFailure,), '#failure-%u' % (iFailure,)).toHtml();
+                sHtml += ' ... ';
+                for iFailure in range(cFailures - 6, cFailures):
+                    sHtml += ' ' + WuiTmLink('#%u' % (iFailure,), '#failure-%u' % (iFailure,)).toHtml();
+            sHtml += '    </p>\n';
+
+        sHtml += sHtmlEvents;
+        sHtml += '   <p>' + sFormButton + '</p>\n';
+        sHtml += '   </form>\n';
+        sHtml += '  </td>\n';
+
+        sHtml += ' </tr>\n';
+        sHtml += '</table>\n';
+
+        return ('Test Case result details', sHtml)
+
+
+class WuiGroupedResultList(WuiListContentBase):
+    """
+    WUI results content generator.
+    """
+
+    def __init__(self, aoEntries, cEntriesCount, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
+        """Override initialization"""
+        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
+                                    sTitle = 'Ungrouped (%d)' % cEntriesCount, sId = 'results',
+                                    fnDPrint = fnDPrint, oDisp = oDisp);
+
+        self._cEntriesCount   = cEntriesCount
+
+        self._asColumnHeaders = [
+            'Start',
+            'Product Build',
+            'Validation Kit',
+            'TestBox OS',
+            'TestBox Name',
+            'Test Case',
+            'Elapsed',
+            'Result',
+        ];
+        self._asColumnAttribs = ['align="center"', 'align="center"', 'align="center"',
+                                 'align="center"', 'align="center"', 'align="center"',
+                                 'align="center"', 'align="center"', 'align="center"',
+                                 'align="center"', 'align="center"', 'align="center"' ]
+
+
+        # Prepare parameter lists.
+        self._dTestBoxLinkParams = self._oDisp.getParameters();
+        self._dTestBoxLinkParams[WuiMain.ksParamAction]  = WuiMain.ksActionResultsGroupedByTestBox;
+
+        self._dTestCaseLinkParams = self._oDisp.getParameters();
+        self._dTestCaseLinkParams[WuiMain.ksParamAction] = WuiMain.ksActionResultsGroupedByTestCase;
+
+        self._dRevLinkParams = self._oDisp.getParameters();
+        self._dRevLinkParams[WuiMain.ksParamAction]  = WuiMain.ksActionResultsGroupedByBuildRev;
+
+
+
+    def _formatListEntry(self, iEntry):
+        """
+        Format *show all* table entry
+        """
+        oEntry = self._aoEntries[iEntry];
+
+        from testmanager.webui.wuiadmin import WuiAdmin;
+
+
+        oValidationKit = None;
+        if oEntry.idBuildTestSuite is not None:
+            oValidationKit = WuiTmLink('#%d - r%s' % (oEntry.idBuildTestSuite, oEntry.iRevisionTestSuite),
+                                   WuiAdmin.ksScriptName,
+                                   { WuiAdmin.ksParamAction:  WuiAdmin.ksActionBuildDetails,
+                                     BuildData.ksParam_idBuild: oEntry.idBuildTestSuite },
+                                   fBracketed = False);
+
+
+        aoTestSetLinks = [ WuiTmLink(oEntry.enmStatus,
+                                     WuiMain.ksScriptName,
+                                     { WuiMain.ksParamAction: WuiMain.ksActionTestResultDetails,
+                                       TestSetData.ksParam_idTestSet: oEntry.idTestSet },
+                                     fBracketed = False),];
+        if oEntry.cErrors > 0:
+            aoTestSetLinks.append(WuiTmLink('- %d error(s)' % (oEntry.cErrors, ),
+                                            WuiMain.ksScriptName,
+                                            { WuiMain.ksParamAction: WuiMain.ksActionTestResultDetails,
+                                              TestSetData.ksParam_idTestSet: oEntry.idTestSet },
+                                            sFragmentId = 'failure-0', fBracketed = False));
+
+
+        self._dTestBoxLinkParams[WuiMain.ksParamGroupMemberId]  = oEntry.idTestBox;
+        self._dTestCaseLinkParams[WuiMain.ksParamGroupMemberId] = oEntry.idTestCase;
+        self._dRevLinkParams[WuiMain.ksParamGroupMemberId]      = oEntry.iRevision;
+
+        sTestBoxTitle = u'';
+        if oEntry.sCpuVendor is not None:
+            sTestBoxTitle += 'CPU vendor:\t%s\n' % ( oEntry.sCpuVendor, );
+        if oEntry.sCpuName is not None:
+            sTestBoxTitle += 'CPU name:\t%s\n' % ( ' '.join(oEntry.sCpuName.split()), );
+        if oEntry.sOsVersion is not None:
+            sTestBoxTitle += 'OS version:\t%s\n' % ( oEntry.sOsVersion, );
+        asFeatures = [];
+        if oEntry.fCpuHwVirt       is True: asFeatures.append(u'HW\u2011Virt');
+        if oEntry.fCpuNestedPaging is True: asFeatures.append(u'Nested\u2011Paging');
+        if oEntry.fCpu64BitGuest   is True: asFeatures.append(u'64\u2011bit\u2011Guest');
+        #if oEntry.fChipsetIoMmu    is True: asFeatures.append(u'I/O\u2011MMU');
+        sTestBoxTitle += u'CPU features:\t' + u', '.join(asFeatures);
+
+        return [
+            oEntry.tsCreated,
+            [ WuiTmLink('#%d - %s %s (%s)' % (oEntry.idBuild, oEntry.sProduct, oEntry.sVersion, oEntry.sType,),
+                        WuiMain.ksScriptName, self._dRevLinkParams, sTitle = '%s' % (oEntry.sBranch,), fBracketed = False),
+              WuiSvnLinkWithTooltip(oEntry.iRevision, 'vbox'), ## @todo add sRepository TestResultListingData
+              WuiTmLink(self.ksShortDetailsLink, WuiAdmin.ksScriptName,
+                        { WuiAdmin.ksParamAction:    WuiAdmin.ksActionBuildDetails,
+                          BuildData.ksParam_idBuild: oEntry.idBuild },
+                        fBracketed = False),
+              ],
+            oValidationKit,
+            '%s.%s' % (oEntry.sOs, oEntry.sArch),
+            [ WuiTmLink(oEntry.sTestBoxName, WuiMain.ksScriptName, self._dTestBoxLinkParams, fBracketed = False,
+                        sTitle = sTestBoxTitle),
+              WuiTmLink(self.ksShortDetailsLink, WuiAdmin.ksScriptName,
+                        { WuiAdmin.ksParamAction:        WuiAdmin.ksActionTestBoxDetails,
+                          TestBoxData.ksParam_idTestBox: oEntry.idTestBox },
+                        fBracketed = False) ],
+            [ WuiTmLink(oEntry.sTestCaseName, WuiMain.ksScriptName, self._dTestCaseLinkParams, fBracketed = False,
+                        sTitle = (oEntry.sBaseCmd + ' ' + oEntry.sArgs) if oEntry.sArgs else oEntry.sBaseCmd),
+              WuiTmLink(self.ksShortDetailsLink, WuiAdmin.ksScriptName,
+                        { WuiAdmin.ksParamAction:          WuiAdmin.ksActionTestCaseDetails,
+                          TestCaseData.ksParam_idTestCase: oEntry.idTestCase },
+                        fBracketed = False), ],
+            oEntry.tsElapsed,
+            aoTestSetLinks
+        ];
diff --git a/src/VBox/ValidationKit/testmanager/webui/wuivcshistory.py b/src/VBox/ValidationKit/testmanager/webui/wuivcshistory.py
new file mode 100644
index 0000000..7fc521e
--- /dev/null
+++ b/src/VBox/ValidationKit/testmanager/webui/wuivcshistory.py
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+# $Id: wuivcshistory.py $
+
+"""
+Test Manager WUI - VCS history
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+# Python imports.
+#import datetime;
+
+# Validation Kit imports.
+from testmanager                        import config;
+from testmanager.core                   import db;
+from testmanager.webui.wuicontentbase   import WuiContentBase;
+from common                             import webutils;
+
+class WuiVcsHistoryTooltip(WuiContentBase):
+    """
+    WUI VCS history tooltip generator.
+    """
+
+    def __init__(self, aoEntries, sRepository, iRevision, cEntries, fnDPrint, oDisp):
+        """Override initialization"""
+        WuiContentBase.__init__(self, fnDPrint = fnDPrint, oDisp = oDisp);
+        self.aoEntries      = aoEntries;
+        self.sRepository    = sRepository;
+        self.iRevision      = iRevision;
+        self.cEntries       = cEntries;
+
+
+    def show(self):
+        """
+        Generates the tooltip.
+        Returns (sTitle, HTML).
+        """
+        sHtml  = '<div class="tmvcstimeline tmvcstimelinetooltip">\n';
+
+        oCurDate = None;
+        for oEntry in self.aoEntries:
+            oTsZulu = db.dbTimestampToZuluDatetime(oEntry.tsCreated);
+            if oCurDate is None or oCurDate != oTsZulu.date():
+                if oCurDate is not None:
+                    sHtml += ' </dl>\n'
+                oCurDate = oTsZulu.date();
+                sHtml += ' <h2>%s:</h2>\n' \
+                         ' <dl>\n' \
+                       % (oTsZulu.strftime('%Y-%m-%d'),);
+
+            sEntry  = '  <dt id="r%s">' % (oEntry.iRevision, );
+            sEntry += '<a href="%s">' \
+                    % ( webutils.escapeAttr(config.g_ksTracChangsetUrlFmt
+                                            % { 'iRevision': oEntry.iRevision, 'sRepository': oEntry.sRepository,}), );
+
+            sEntry += '<span class="tmvcstimeline-time">%s</span>' % ( oTsZulu.strftime('%H:%MZ'), );
+            sEntry += ' Changeset <span class="tmvcstimeline-rev">[%s]</span>' % ( oEntry.iRevision, );
+            sEntry += ' by <span class="tmvcstimeline-author">%s</span>' % ( webutils.escapeElem(oEntry.sAuthor), );
+            sEntry += '</a>\n';
+            sEntry += '</dt>\n';
+            sEntry += '  <dd>%s</dd>\n' % ( webutils.escapeElem(oEntry.sMessage), );
+
+            sHtml += sEntry;
+
+        if oCurDate is not None:
+            sHtml += ' </dl>\n';
+        sHtml += '</div>\n';
+
+        return ('VCS History Tooltip', sHtml);
+
diff --git a/src/VBox/ValidationKit/tests/Makefile.kmk b/src/VBox/ValidationKit/tests/Makefile.kmk
new file mode 100644
index 0000000..17ec7ae
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/Makefile.kmk
@@ -0,0 +1,48 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# Include sub-makefiles.
+#
+include $(PATH_SUB_CURRENT)/additions/Makefile.kmk
+include $(PATH_SUB_CURRENT)/api/Makefile.kmk
+include $(PATH_SUB_CURRENT)/autostart/Makefile.kmk
+include $(PATH_SUB_CURRENT)/benchmarks/Makefile.kmk
+include $(PATH_SUB_CURRENT)/cpu/Makefile.kmk
+include $(PATH_SUB_CURRENT)/network/Makefile.kmk
+include $(PATH_SUB_CURRENT)/selftests/Makefile.kmk
+include $(PATH_SUB_CURRENT)/smoketests/Makefile.kmk
+include $(PATH_SUB_CURRENT)/storage/Makefile.kmk
+include $(PATH_SUB_CURRENT)/teleportation/Makefile.kmk
+include $(PATH_SUB_CURRENT)/unittests/Makefile.kmk
+include $(PATH_SUB_CURRENT)/installation/Makefile.kmk
+include $(PATH_SUB_CURRENT)/usb/Makefile.kmk
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/ValidationKit/tests/additions/Makefile.kmk b/src/VBox/ValidationKit/tests/additions/Makefile.kmk
new file mode 100644
index 0000000..a28d635
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/additions/Makefile.kmk
@@ -0,0 +1,43 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Additions Tests.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsAdditions
+ValidationKitTestsAdditions_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsAdditions_INST = $(INST_VALIDATIONKIT)tests/additions/
+ValidationKitTestsAdditions_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdAddBasic1.py \
+	$(PATH_SUB_CURRENT)/tdAddGuestCtrl.py
+
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsAdditions_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/additions/tdAddBasic1.py b/src/VBox/ValidationKit/tests/additions/tdAddBasic1.py
new file mode 100755
index 0000000..50c50a8
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/additions/tdAddBasic1.py
@@ -0,0 +1,315 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdAddBasic1.py $
+
+"""
+VirtualBox Validation Kit - Additions Basics #1.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+
+# Sub test driver imports.
+sys.path.append(os.path.dirname(os.path.abspath(__file__))); # For sub-test drivers.
+from tdAddGuestCtrl import SubTstDrvAddGuestCtrl;
+
+
+class tdAddBasic1(vbox.TestDriver):                                         # pylint: disable=R0902
+    """
+    Additions Basics #1.
+    """
+    ## @todo
+    # - More of the settings stuff can e and need to be generalized!
+    #
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.oTestVmSet = self.oTestVmManager.getStandardVmSet('nat');
+        self.asTestsDef = ['guestprops', 'stdguestprops', 'guestcontrol'];
+        self.asTests    = self.asTestsDef;
+
+        self.addSubTestDriver(SubTstDrvAddGuestCtrl(self));
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdAddBasic1 Options:');
+        reporter.log('  --tests        <s1[:s2[:]]>');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestsDef)));
+        reporter.log('  --quick');
+        reporter.log('      Same as --virt-modes hwvirt --cpu-counts 1.');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        if asArgs[iArg] == '--tests':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of tests');
+            self.asTests = asArgs[iArg].split(':');
+            for s in self.asTests:
+                if s not in self.asTestsDef:
+                    raise base.InvalidOption('The "--tests" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestsDef)));
+
+        elif asArgs[iArg] == '--quick':
+            self.parseOption(['--virt-modes', 'hwvirt'], 0);
+            self.parseOption(['--cpu-counts', '1'], 0);
+
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def actionConfig(self):
+        if not self.importVBoxApi(): # So we can use the constant below.
+            return False;
+
+        eNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
+        sGaIso = self.getGuestAdditionsIso();
+        return self.oTestVmSet.actionConfig(self, eNic0AttachType = eNic0AttachType, sDvdImage = sGaIso);
+
+    def actionExecute(self):
+        return self.oTestVmSet.actionExecute(self, self.testOneCfg);
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def testOneCfg(self, oVM, oTestVm):
+        """
+        Runs the specified VM thru the tests.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+        fRc = False;
+
+        self.logVmInfo(oVM);
+        oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = True, \
+                                                                  sFileCdWait = 'AUTORUN.INF');
+        if oSession is not None:
+            self.addTask(oSession);
+            # Do the testing.
+            reporter.testStart('Install');
+            fRc, oTxsSession = self.testInstallAdditions(oSession, oTxsSession, oTestVm);
+            reporter.testDone();
+            fSkip = not fRc;
+
+            reporter.testStart('Guest Properties');
+            if not fSkip:
+                fRc = self.testGuestProperties(oSession, oTxsSession, oTestVm) and fRc;
+            reporter.testDone(fSkip);
+
+            reporter.testStart('Guest Control');
+            if not fSkip:
+                (fRc2, oTxsSession) = self.aoSubTstDrvs[0].testIt(oTestVm, oSession, oTxsSession);
+                fRc = fRc2 and fRc;
+            reporter.testDone(fSkip);
+
+            ## @todo Save an restore test.
+
+            ## @todo Reset tests.
+
+            ## @todo Final test: Uninstallation.
+
+            # Cleanup.
+            self.removeTask(oTxsSession);
+            #self.terminateVmBySession(oSession)
+        return fRc;
+
+    def testInstallAdditions(self, oSession, oTxsSession, oTestVm):
+        """
+        Tests installing the guest additions
+        """
+        if oTestVm.isWindows():
+            fRc = self.testWindowsInstallAdditions(oSession, oTxsSession, oTestVm);
+        else:
+            reporter.error('Guest Additions installation not implemented for %s yet! (%s)' % \
+                           (oTestVm.sKind, oTestVm.sVmName));
+            fRc = False;
+
+        #
+        # Verify installation of Guest Additions using commmon bits.
+        #
+        if fRc is True:
+            #
+            # Wait for the GAs to come up.
+            #
+
+            ## @todo need to signed up for a OnAdditionsStateChanged and wait runlevel to
+            #  at least reach Userland.
+
+            #
+            # Check if the additions are operational.
+            #
+            try:    oGuest = oSession.o.console.guest;
+            except:
+                reporter.errorXcpt('Getting IGuest failed.');
+                return (False, oTxsSession);
+
+            # Check the additionsVersion attribute. It must not be empty.
+            reporter.testStart('IGuest::additionsVersion');
+            fRc = self.testIGuest_additionsVersion(oGuest);
+            reporter.testDone();
+
+            reporter.testStart('IGuest::additionsRunLevel');
+            self.testIGuest_additionsRunLevel(oGuest, oTestVm);
+            reporter.testDone();
+
+            ## @todo test IAdditionsFacilities.
+
+        return (fRc, oTxsSession);
+
+    def testWindowsInstallAdditions(self, oSession, oTxsSession, oTestVm):
+        """
+        Installs the Windows guest additions using the test execution service.
+        Since this involves rebooting the guest, we will have to create a new TXS session.
+        """
+        asLogFile = [];
+
+        # Delete relevant log files.
+        if oTestVm.sKind in ('WindowsNT4',):
+            sWinDir = 'C:/WinNT/';
+        else:
+            sWinDir = 'C:/Windows/';
+            asLogFile = [sWinDir+'setupapi.log', sWinDir+'setupact.log', sWinDir+'setuperr.log'];
+
+        for sFile in asLogFile:
+            self.txsRmFile(oSession, oTxsSession, sFile);
+
+        # Install the public signing key.
+        if oTestVm.sKind not in ('WindowsNT4', 'Windows2000', 'WindowsXP', 'Windows2003'):
+            ## TODO
+            pass;
+
+        #
+        # The actual install.
+        # Enable installing the optional auto-logon modules (VBoxGINA/VBoxCredProv) + (Direct)3D support.
+        # Also tell the installer to produce the appropriate log files.
+        #
+        fRc = self.txsRunTest(oTxsSession, 'VBoxWindowsAdditions.exe', 5 * 60 * 1000, \
+            '${CDROM}/VBoxWindowsAdditions.exe', ('${CDROM}/VBoxWindowsAdditions.exe', '/S', '/l', '/with_autologon'));
+        # For testing the installation (D)3D stuff ('/with_d3d') we need to boot up in safe mode.
+
+        #
+        # Reboot the VM and reconnect the TXS session.
+        #
+        if fRc is True:
+            (fRc, oTxsSession) = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, cMsTimeout = 3 * 60000);
+
+            # Add the Windows Guest Additions installer files to the files we want to download
+            # from the guest.
+            sGuestAddsDir = 'C:/Program Files/Oracle/VirtualBox Guest Additions/';
+            asLogFile.append(sGuestAddsDir + 'install.log');
+            # Note: There won't be a install_ui.log because of the silent installation.
+            asLogFile.append(sGuestAddsDir + 'install_drivers.log');
+            asLogFile.append('C:/Windows/setupapi.log');
+            asLogFile.append('C:/Windows/setupapi.dev.log');
+
+            #
+            # Download log files.
+            # Ignore errors as all files above might not be present (or in different locations)
+            # on different Windows guests.
+            #
+            self.txsDownloadFiles(oSession, oTxsSession, asLogFile, fIgnoreErrors = True);
+
+        return (fRc, oTxsSession);
+
+    def testIGuest_additionsVersion(self, oGuest):
+        """
+        Returns False if no version string could be obtained, otherwise True
+        even though errors are logged.
+        """
+        try:
+            sVer = oGuest.additionsVersion;
+        except:
+            reporter.errorXcpt('Getting the additions version failed.');
+            return False;
+        reporter.log('IGuest::additionsVersion="%s"' % (sVer,));
+
+        if sVer.strip() == '':
+            reporter.error('IGuest::additionsVersion is empty.');
+            return False;
+
+        if sVer != sVer.strip():
+            reporter.error('IGuest::additionsVersion is contains spaces: "%s".' % (sVer,));
+
+        asBits = sVer.split('.');
+        if len(asBits) < 3:
+            reporter.error('IGuest::additionsVersion does not contain at least tree dot separated fields: "%s" (%d).'
+                           % (sVer, len(asBits)));
+
+        ## @todo verify the format.
+        return True;
+
+    def testIGuest_additionsRunLevel(self, oGuest, oTestVm):
+        """
+        Do run level tests.
+        """
+        if oTestVm.isLoggedOntoDesktop():
+            eExpectedRunLevel = vboxcon.AdditionsRunLevelType_Desktop;
+        else:
+            eExpectedRunLevel = vboxcon.AdditionsRunLevelType_Userland;
+
+        ## @todo Insert wait for the desired run level.
+        try:
+            iLevel = oGuest.additionsRunLevel;
+        except:
+            reporter.errorXcpt('Getting the additions run level failed.');
+            return False;
+        reporter.log('IGuest::additionsRunLevel=%s' % (iLevel,));
+
+        if iLevel != eExpectedRunLevel:
+            reporter.error('Expected runlevel %d, found %d instead' % (eExpectedRunLevel, iLevel));
+        return True;
+
+
+    def testGuestProperties(self, oSession, oTxsSession, oTestVm):
+        """
+        Test guest properties.
+        """
+        _ = oSession; _ = oTxsSession; _ = oTestVm;
+        return True;
+
+if __name__ == '__main__':
+    sys.exit(tdAddBasic1().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py b/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
new file mode 100755
index 0000000..4aac2a2
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/additions/tdAddGuestCtrl.py
@@ -0,0 +1,3383 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# pylint: disable=C0302
+
+"""
+VirtualBox Validation Kit - Guest Control Tests.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2015 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 100056 $"
+
+# Disable bitching about too many arguments per function.
+# pylint: disable=R0913
+
+## @todo Convert map() usage to a cleaner alternative Python now offers.
+# pylint: disable=W0141
+
+## @todo Convert the context/test classes into named tuples. Not in the mood right now, so
+#        disabling it.
+# pylint: disable=R0903
+
+# Standard Python imports.
+from array import array
+import errno
+import os
+import random
+import string # pylint: disable=W0402
+import struct
+import sys
+import time
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+from testdriver import vboxwrappers;
+
+
+class GuestStream(bytearray):
+    """
+    Class for handling a guest process input/output stream.
+    """
+    def appendStream(self, stream, convertTo='<b'):
+        """
+        Appends and converts a byte sequence to this object;
+        handy for displaying a guest stream.
+        """
+        self.extend(struct.pack(convertTo, stream));
+
+class tdCtxTest(object):
+    """
+    Provides the actual test environment. Should be kept
+    as generic as possible.
+    """
+    def __init__(self, oSession, oTxsSession, oTestVm): # pylint: disable=W0613
+        ## The desired Main API result.
+        self.fRc = False;
+        ## IGuest reference.
+        self.oGuest = oSession.o.console.guest;
+        # Rest not used (yet).
+
+class tdCtxCreds(object):
+    """
+    Provides credentials to pass to the guest.
+    """
+    def __init__(self, sUser, sPassword, sDomain):
+        self.sUser = sUser;
+        self.sPassword = sPassword;
+        self.sDomain = sDomain;
+
+class tdTestGuestCtrlBase(object):
+    """
+    Base class for all guest control tests.
+    Note: This test ASSUMES that working Guest Additions
+          were installed and running on the guest to be tested.
+    """
+    def __init__(self):
+        self.oTest  = None;
+        self.oCreds = None;
+        self.timeoutMS = 30 * 1000; # 30s timeout
+        ## IGuestSession reference or None.
+        self.oGuestSession = None;
+
+    def setEnvironment(self, oSession, oTxsSession, oTestVm):
+        """
+        Sets the test environment required for this test.
+        """
+        self.oTest = tdCtxTest(oSession, oTxsSession, oTestVm);
+        return self.oTest;
+
+    def createSession(self, sName):
+        """
+        Creates (opens) a guest session.
+        Returns (True, IGuestSession) on success or (False, None) on failure.
+        """
+        if self.oGuestSession is None:
+            if sName is None:
+                sName = "<untitled>";
+            try:
+                reporter.log('Creating session "%s" ...' % (sName,));
+                self.oGuestSession = self.oTest.oGuest.createSession(self.oCreds.sUser,
+                                                                     self.oCreds.sPassword,
+                                                                     self.oCreds.sDomain,
+                                                                     sName);
+            except:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                reporter.logXcpt('Creating a guest session "%s" failed; sUser="%s", pw="%s", sDomain="%s":'
+                                 % (sName, self.oCreds.sUser, self.oCreds.sPassword, self.oCreds.sDomain));
+                return (False, None);
+
+            try:
+                reporter.log('Waiting for session "%s" to start within %ldms...' % (sName, self.timeoutMS));
+                fWaitFor = [ vboxcon.GuestSessionWaitForFlag_Start ];
+                waitResult = self.oGuestSession.waitForArray(fWaitFor, self.timeoutMS);
+                #
+                # Be nice to Guest Additions < 4.3: They don't support session handling and
+                # therefore return WaitFlagNotSupported.
+                #
+                if      waitResult != vboxcon.GuestSessionWaitResult_Start \
+                    and waitResult != vboxcon.GuestSessionWaitResult_WaitFlagNotSupported:
+                    # Just log, don't assume an error here (will be done in the main loop then).
+                    reporter.log('Session did not start successfully, returned wait result: %ld' \
+                                  % (waitResult));
+                    return (False, None);
+                reporter.log('Session "%s" successfully started' % (sName,));
+            except:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                reporter.logXcpt('Waiting for guest session "%s" to start failed:' % (sName));
+                return (False, None);
+        else:
+            reporter.log('Warning: Session already set; this is probably not what you want');
+        return (True, self.oGuestSession);
+
+    def setSession(self, oGuestSession):
+        """
+        Sets the current guest session and closes
+        an old one if necessary.
+        """
+        if self.oGuestSession is not None:
+            self.closeSession();
+        self.oGuestSession = oGuestSession;
+        return self.oGuestSession;
+
+    def closeSession(self):
+        """
+        Closes the guest session.
+        """
+        if self.oGuestSession is not None:
+            sName = self.oGuestSession.name;
+            try:
+                reporter.log('Closing session "%s" ...' % (sName,));
+                self.oGuestSession.close();
+                self.oGuestSession = None;
+            except:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                reporter.logXcpt('Closing guest session "%s" failed:' % (sName,));
+                return False;
+        return True;
+
+class tdTestCopyFrom(tdTestGuestCtrlBase):
+    """
+    Test for copying files from the guest to the host.
+    """
+    def __init__(self, sSrc = "", sDst = "", sUser = "", sPassword = "", aFlags = None):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sSrc = sSrc;
+        self.sDst = sDst;
+        self.aFlags = aFlags;
+
+class tdTestCopyTo(tdTestGuestCtrlBase):
+    """
+    Test for copying files from the host to the guest.
+    """
+    def __init__(self, sSrc = "", sDst = "", sUser = "", sPassword = "", aFlags = None):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sSrc = sSrc;
+        self.sDst = sDst;
+        self.aFlags = aFlags;
+
+class tdTestDirCreate(tdTestGuestCtrlBase):
+    """
+    Test for directoryCreate call.
+    """
+    def __init__(self, sDirectory = "", sUser = "", sPassword = "", fMode = 0, aFlags = None):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sDirectory = sDirectory;
+        self.fMode = fMode;
+        self.aFlags = aFlags;
+
+class tdTestDirCreateTemp(tdTestGuestCtrlBase):
+    """
+    Test for the directoryCreateTemp call.
+    """
+    def __init__(self, sDirectory = "", sTemplate = "", sUser = "", sPassword = "", fMode = 0, fSecure = False):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sDirectory = sDirectory;
+        self.sTemplate = sTemplate;
+        self.fMode = fMode;
+        self.fSecure = fSecure;
+
+class tdTestDirOpen(tdTestGuestCtrlBase):
+    """
+    Test for the directoryOpen call.
+    """
+    def __init__(self, sDirectory = "", sUser = "", sPassword = "",
+                 sFilter = "", aFlags = None):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sDirectory = sDirectory;
+        self.sFilter = sFilter;
+        self.aFlags = aFlags or [];
+
+class tdTestDirRead(tdTestDirOpen):
+    """
+    Test for the opening, reading and closing a certain directory.
+    """
+    def __init__(self, sDirectory = "", sUser = "", sPassword = "",
+                 sFilter = "", aFlags = None):
+        tdTestDirOpen.__init__(self, sDirectory, sUser, sPassword, sFilter, aFlags);
+
+class tdTestExec(tdTestGuestCtrlBase):
+    """
+    Specifies exactly one guest control execution test.
+    Has a default timeout of 5 minutes (for safety).
+    """
+    def __init__(self, sCmd = "", aArgs = None, aEnv = None, \
+                 aFlags = None, timeoutMS = 5 * 60 * 1000, \
+                 sUser = "", sPassword = "", sDomain = "", \
+                 fWaitForExit = True):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain);
+        self.sCmd = sCmd;
+        self.aArgs = aArgs if aArgs is not None else [sCmd,];
+        self.aEnv = aEnv;
+        self.aFlags = aFlags or [];
+        self.timeoutMS = timeoutMS;
+        self.fWaitForExit = fWaitForExit;
+        self.uExitStatus = 0;
+        self.iExitCode = 0;
+        self.cbStdOut = 0;
+        self.cbStdErr = 0;
+        self.sBuf = '';
+
+class tdTestFileExists(tdTestGuestCtrlBase):
+    """
+    Test for the file exists API call (fileExists).
+    """
+    def __init__(self, sFile = "", sUser = "", sPassword = ""):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sFile = sFile;
+
+class tdTestFileRemove(tdTestGuestCtrlBase):
+    """
+    Test querying guest file information.
+    """
+    def __init__(self, sFile = "", sUser = "", sPassword = ""):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sFile = sFile;
+
+class tdTestFileStat(tdTestGuestCtrlBase):
+    """
+    Test querying guest file information.
+    """
+    def __init__(self, sFile = "", sUser = "", sPassword = "", cbSize = 0, eFileType = 0):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sFile = sFile;
+        self.cbSize = cbSize;
+        self.eFileType = eFileType;
+
+class tdTestFileIO(tdTestGuestCtrlBase):
+    """
+    Test for the IGuestFile object.
+    """
+    def __init__(self, sFile = "", sUser = "", sPassword = ""):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sFile = sFile;
+
+class tdTestFileQuerySize(tdTestGuestCtrlBase):
+    """
+    Test for the file size query API call (fileQuerySize).
+    """
+    def __init__(self, sFile = "", sUser = "", sPassword = ""):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sFile = sFile;
+
+class tdTestFileReadWrite(tdTestGuestCtrlBase):
+    """
+    Tests reading from guest files.
+    """
+    def __init__(self, sFile = "", sUser = "", sPassword = "",
+                 sOpenMode = "r", sDisposition = "",
+                 sSharingMode = "",
+                 lCreationMode = 0, cbOffset = 0, cbToReadWrite = 0,
+                 aBuf = None):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.sFile = sFile;
+        self.sOpenMode = sOpenMode;
+        self.sDisposition = sDisposition;
+        self.sSharingMode = sSharingMode;
+        self.lCreationMode = lCreationMode;
+        self.cbOffset = cbOffset;
+        self.cbToReadWrite = cbToReadWrite;
+        self.aBuf = aBuf;
+
+    def getOpenAction(self):
+        """ Converts string disposition to open action enum. """
+        if self.sDisposition == 'oe': return vboxcon.FileOpenAction_OpenExisting;
+        if self.sDisposition == 'oc': return vboxcon.FileOpenAction_OpenOrCreate;
+        if self.sDisposition == 'ce': return vboxcon.FileOpenAction_CreateNew;
+        if self.sDisposition == 'ca': return vboxcon.FileOpenAction_CreateOrReplace;
+        if self.sDisposition == 'ot': return vboxcon.FileOpenAction_OpenExistingTruncated;
+        if self.sDisposition == 'oa': return vboxcon.FileOpenAction_AppendOrCreate;
+        raise base.GenError(self.sDisposition);
+
+    def getAccessMode(self):
+        """ Converts open mode to access mode enum. """
+        if self.sOpenMode == 'r':  return vboxcon.FileOpenMode_ReadOnly;
+        if self.sOpenMode == 'w':  return vboxcon.FileOpenMode_WriteOnly;
+        if self.sOpenMode == 'w+': return vboxcon.FileOpenMode_ReadWrite;
+        if self.sOpenMode == 'r+': return vboxcon.FileOpenMode_ReadWrite;
+        raise base.GenError(self.sOpenMode);
+
+    def getSharingMode(self):
+        """ Converts the sharing mode. """
+        return vboxcon.FileSharingMode_All;
+
+class tdTestSession(tdTestGuestCtrlBase):
+    """
+    Test the guest session handling.
+    """
+    def __init__(self, sUser = "", sPassword = "", sDomain = "", \
+                 sSessionName = ""):
+        tdTestGuestCtrlBase.__init__(self);
+        self.sSessionName = sSessionName;
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain);
+
+    def getSessionCount(self, oVBoxMgr):
+        """
+        Helper for returning the number of currently
+        opened guest sessions of a VM.
+        """
+        if self.oTest.oGuest is None:
+            return 0;
+        aoSession = oVBoxMgr.getArray(self.oTest.oGuest, 'sessions')
+        return len(aoSession);
+
+class tdTestSessionEnv(tdTestGuestCtrlBase):
+    """
+    Test the guest session environment.
+    """
+    def __init__(self, sUser = "", sPassword = "", aEnv = None):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
+        self.aEnv = aEnv or [];
+
+class tdTestSessionFileRefs(tdTestGuestCtrlBase):
+    """
+    Tests session file (IGuestFile) reference counting.
+    """
+    def __init__(self, cRefs = 0):
+        tdTestGuestCtrlBase.__init__(self);
+        self.cRefs = cRefs;
+
+class tdTestSessionDirRefs(tdTestGuestCtrlBase):
+    """
+    Tests session directory (IGuestDirectory) reference counting.
+    """
+    def __init__(self, cRefs = 0):
+        tdTestGuestCtrlBase.__init__(self);
+        self.cRefs = cRefs;
+
+class tdTestSessionProcRefs(tdTestGuestCtrlBase):
+    """
+    Tests session process (IGuestProcess) reference counting.
+    """
+    def __init__(self, cRefs = 0):
+        tdTestGuestCtrlBase.__init__(self);
+        self.cRefs = cRefs;
+
+class tdTestUpdateAdditions(tdTestGuestCtrlBase):
+    """
+    Test updating the Guest Additions inside the guest.
+    """
+    def __init__(self, sSrc = "", aArgs = None, aFlags = None,
+                 sUser = "", sPassword = "", sDomain = ""):
+        tdTestGuestCtrlBase.__init__(self);
+        self.oCreds = tdCtxCreds(sUser, sPassword, sDomain);
+        self.sSrc = sSrc;
+        self.aArgs = aArgs;
+        self.aFlags = aFlags;
+
+class tdTestResult(object):
+    """
+    Base class for test results.
+    """
+    def __init__(self, fRc = False):
+        ## The overall test result.
+        self.fRc = fRc;
+
+class tdTestResultDirRead(tdTestResult):
+    """
+    Test result for reading guest directories.
+    """
+    def __init__(self, fRc = False,
+                 numFiles = 0, numDirs = 0):
+        tdTestResult.__init__(self, fRc = fRc);
+        self.numFiles = numFiles;
+        self.numDirs = numDirs;
+
+class tdTestResultExec(tdTestResult):
+    """
+    Holds a guest process execution test result,
+    including the exit code, status + aFlags.
+    """
+    def __init__(self, fRc = False, \
+                 uExitStatus = 500, iExitCode = 0, \
+                 sBuf = None, cbBuf = 0, \
+                 cbStdOut = 0, cbStdErr = 0):
+        tdTestResult.__init__(self);
+        ## The overall test result.
+        self.fRc = fRc;
+        ## Process exit stuff.
+        self.uExitStatus = uExitStatus;
+        self.iExitCode = iExitCode;
+        ## Desired buffer length returned back from stdout/stderr.
+        self.cbBuf = cbBuf;
+        ## Desired buffer result from stdout/stderr. Use with caution!
+        self.sBuf = sBuf;
+        self.cbStdOut = cbStdOut;
+        self.cbStdErr = cbStdErr;
+
+class tdTestResultFileStat(tdTestResult):
+    """
+    Test result for stat'ing guest files.
+    """
+    def __init__(self, fRc = False,
+                 cbSize = 0, eFileType = 0):
+        tdTestResult.__init__(self, fRc = fRc);
+        self.cbSize = cbSize;
+        self.eFileType = eFileType;
+        ## @todo Add more information.
+
+class tdTestResultFileReadWrite(tdTestResult):
+    """
+    Test result for reading + writing guest directories.
+    """
+    def __init__(self, fRc = False,
+                 cbProcessed = 0, cbOffset = 0, aBuf = None):
+        tdTestResult.__init__(self, fRc = fRc);
+        self.cbProcessed = cbProcessed;
+        self.cbOffset = cbOffset;
+        self.aBuf = aBuf;
+
+class tdTestResultSession(tdTestResult):
+    """
+    Test result for guest session counts.
+    """
+    def __init__(self, fRc = False, cNumSessions = 0):
+        tdTestResult.__init__(self, fRc = fRc);
+        self.cNumSessions = cNumSessions;
+
+class tdTestResultSessionEnv(tdTestResult):
+    """
+    Test result for guest session environment tests.
+    """
+    def __init__(self, fRc = False, cNumVars = 0):
+        tdTestResult.__init__(self, fRc = fRc);
+        self.cNumVars = cNumVars;
+
+
+class SubTstDrvAddGuestCtrl(base.SubTestDriverBase):
+    """
+    Sub-test driver for executing guest control (VBoxService, IGuest) tests.
+    """
+
+    def __init__(self, oTstDrv):
+        base.SubTestDriverBase.__init__(self, 'add-guest-ctrl', oTstDrv);
+
+        ## @todo base.TestBase.
+        self.asTestsDef = \
+        [
+            'session_basic', 'session_env', 'session_file_ref', 'session_dir_ref', 'session_proc_ref', \
+            'exec_basic', 'exec_errorlevel', 'exec_timeout', \
+            'dir_create', 'dir_create_temp', 'dir_read', \
+            'file_remove', 'file_stat', 'file_read', 'file_write', \
+            'copy_to', 'copy_from', \
+            'update_additions'
+        ];
+        self.asTests    = self.asTestsDef;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        if asArgs[iArg] == '--add-guest-ctrl-tests':
+            iArg += 1;
+            if asArgs[iArg] == 'all': # Nice for debugging scripts.
+                self.asTests = self.asTestsDef;
+                return iArg + 1;
+
+            iNext = self.oTstDrv.requireMoreArgs(1, asArgs, iArg);
+            self.asTests = asArgs[iArg].split(':');
+            for s in self.asTests:
+                if s not in self.asTestsDef:
+                    raise base.InvalidOption('The "--add-guest-ctrl-tests" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestsDef)));
+            return iNext;
+        return iArg;
+
+    def showUsage(self):
+        base.SubTestDriverBase.showUsage(self);
+        reporter.log('  --add-guest-ctrl-tests  <s1[:s2[:]]>');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestsDef)));
+        return True;
+
+    def testIt(self, oTestVm, oSession, oTxsSession):
+        """
+        Executes the test.
+
+        Returns fRc, oTxsSession.  The latter may have changed.
+        """
+        reporter.log("Active tests: %s" % (self.asTests,));
+
+        # Do the testing.
+        reporter.testStart('Session Basics');
+        fSkip = 'session_basic' not in self.asTests;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlSession(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Session Environment');
+        fSkip = 'session_env' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlSessionEnvironment(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Session File References');
+        fSkip = 'session_file_ref' not in self.asTests;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlSessionFileRefs(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        ## @todo Implement this.
+        #reporter.testStart('Session Directory References');
+        #fSkip = 'session_dir_ref' not in self.asTests;
+        #if fSkip == False:
+        #    fRc, oTxsSession = self.testGuestCtrlSessionDirRefs(oSession, oTxsSession, oTestVm);
+        #reporter.testDone(fSkip);
+
+        reporter.testStart('Session Process References');
+        fSkip = 'session_proc_ref' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlSessionProcRefs(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Execution');
+        fSkip = 'exec_basic' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlExec(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Execution Error Levels');
+        fSkip = 'exec_errorlevel' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlExecErrorLevel(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Execution Timeouts');
+        fSkip = 'exec_timeout' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlExecTimeout(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Creating directories');
+        fSkip = 'dir_create' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlDirCreate(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Creating temporary directories');
+        fSkip = 'dir_create_temp' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlDirCreateTemp(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Reading directories');
+        fSkip = 'dir_read' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlDirRead(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        # FIXME: Failing test.
+        # reporter.testStart('Copy to guest');
+        # fSkip = 'copy_to' not in self.asTests or fRc is False;
+        # if fSkip == False:
+        #     fRc, oTxsSession = self.testGuestCtrlCopyTo(oSession, oTxsSession, oTestVm);
+        # reporter.testDone(fSkip);
+
+        reporter.testStart('Copy from guest');
+        fSkip = 'copy_from' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlCopyFrom(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Removing files');
+        fSkip = 'file_remove' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlFileRemove(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        reporter.testStart('Querying file information (stat)');
+        fSkip = 'file_stat' not in self.asTests or fRc is False;
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlFileStat(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        # FIXME: Failing tests.
+        # reporter.testStart('File read');
+        # fSkip = 'file_read' not in self.asTests or fRc is False;
+        # if fSkip == False:
+        #     fRc, oTxsSession = self.testGuestCtrlFileRead(oSession, oTxsSession, oTestVm);
+        # reporter.testDone(fSkip);
+
+        # reporter.testStart('File write');
+        # fSkip = 'file_write' not in self.asTests or fRc is False;
+        # if fSkip == False:
+        #     fRc, oTxsSession = self.testGuestCtrlFileWrite(oSession, oTxsSession, oTestVm);
+        # reporter.testDone(fSkip);
+
+        reporter.testStart('Updating Guest Additions');
+        fSkip = 'update_additions' not in self.asTests or fRc is False;
+        # Skip test for updating Guest Additions if we run on a too old (Windows) guest.
+        fSkip = oTestVm.sKind in ('WindowsNT4', 'Windows2000', 'WindowsXP', 'Windows2003');
+        if fSkip == False:
+            fRc, oTxsSession = self.testGuestCtrlUpdateAdditions(oSession, oTxsSession, oTestVm);
+        reporter.testDone(fSkip);
+
+        return (fRc, oTxsSession);
+
+    def gctrlCopyFileFrom(self, oGuestSession, sSrc, sDst, aFlags):
+        """
+        Helper function to copy a single file from the guest to the host.
+        """
+        fRc = True; # Be optimistic.
+        try:
+            reporter.log2('Copying guest file "%s" to host "%s"' % (sSrc, sDst));
+            if self.oTstDrv.fpApiVer >= 5.0:
+                curProgress = oGuestSession.fileCopyFromGuest(sSrc, sDst, aFlags);
+            else:
+                curProgress = oGuestSession.copyFrom(sSrc, sDst, aFlags);
+            if curProgress is not None:
+                oProgress = vboxwrappers.ProgressWrapper(curProgress, self.oTstDrv.oVBoxMgr, self, "gctrlCopyFrm");
+                try:
+                    iRc = oProgress.waitForOperation(0, fIgnoreErrors = True);
+                    if iRc != 0:
+                        reporter.log('Waiting for copyFrom failed');
+                        fRc = False;
+                except:
+                    reporter.logXcpt('Copy from waiting exception for sSrc="%s", sDst="%s":' \
+                                     % (sSrc, sDst));
+                    fRc = False;
+        except:
+            # Just log, don't assume an error here (will be done in the main loop then).
+            reporter.logXcpt('Copy from exception for sSrc="%s", sDst="%s":' \
+                             % (sSrc, sDst));
+            fRc = False;
+
+        return fRc;
+
+    def gctrlCopyFileTo(self, oGuestSession, sSrc, sDst, aFlags):
+        """
+        Helper function to copy a single file from host to the guest.
+        """
+        fRc = True; # Be optimistic.
+        try:
+            reporter.log2('Copying host file "%s" to guest "%s"' % (sSrc, sDst));
+            if self.oTstDrv.fpApiVer >= 5.0:
+                curProgress = oGuestSession.fileCopyToGuest(sSrc, sDst, aFlags);
+            else:
+                curProgress = oGuestSession.copyTo(sSrc, sDst, aFlags);
+            if curProgress is not None:
+                oProgress = vboxwrappers.ProgressWrapper(curProgress, self.oTstDrv.oVBoxMgr, self, "gctrlCopyTo");
+                try:
+                    iRc = oProgress.waitForOperation(0, fIgnoreErrors = True);
+                    if iRc != 0:
+                        reporter.log('Waiting for copyTo failed');
+                        fRc = False;
+                except:
+                    reporter.logXcpt('Copy to waiting exception for sSrc="%s", sDst="%s":' \
+                                     % (sSrc, sDst));
+                    fRc = False;
+            else:
+                reporter.error('No progress object returned');
+        except:
+            # Just log, don't assume an error here (will be done in the main loop then).
+            reporter.logXcpt('Copy to exception for sSrc="%s", sDst="%s":' \
+                             % (sSrc, sDst));
+            fRc = False;
+
+        return fRc;
+
+    def gctrlCopyFrom(self, oTest, oRes, oGuestSession, subDir = ''): # pylint: disable=R0914
+        """
+        Copies files / directories to the host.
+        Source always contains the absolute path, subDir all paths
+        below it.
+        """
+        ## @todo r=bird: The use subDir and sSubDir in this method is extremely confusing!!
+        #                Just follow the coding guidelines and ALWAYS use prefixes, please!
+        fRc = True; # Be optimistic.
+
+        sSrc = oTest.sSrc;
+        sDst = oTest.sDst;
+        aFlags = oTest.aFlags;
+
+        if     sSrc == "" \
+            or os.path.isfile(sSrc):
+            return self.gctrlCopyFileFrom(oGuestSession, \
+                                          sSrc, sDst, aFlags);
+        sSrcAbs = sSrc;
+        if subDir != "":
+            sSrcAbs = os.path.join(sSrc, subDir);
+        sFilter = ""; # No filter.
+
+        sDstAbs = os.path.join(sDst, subDir);
+        reporter.log2('Copying guest directory "%s" to host "%s"' % (sSrcAbs, sDstAbs));
+
+        try:
+            #reporter.log2('Directory="%s", filter="%s", aFlags="%s"' % (sCurDir, sFilter, aFlags));
+            oCurDir = oGuestSession.directoryOpen(sSrcAbs, sFilter, aFlags);
+            while fRc:
+                try:
+                    oFsObjInfo = oCurDir.read();
+                    if     oFsObjInfo.name == "." \
+                        or oFsObjInfo.name == "..":
+                        #reporter.log2('\tSkipping "%s"' % (oFsObjInfo.name,));
+                        continue; # Skip "." and ".." entries.
+                    if oFsObjInfo.type is vboxcon.FsObjType_Directory:
+                        #reporter.log2('\tDirectory "%s"' % (oFsObjInfo.name,));
+                        sDirCreate = sDst;
+                        if subDir != "":
+                            sDirCreate = os.path.join(sDirCreate, subDir);
+                        sDirCreate = os.path.join(sDirCreate, oFsObjInfo.name);
+                        try:
+                            reporter.log2('\tCreating directory "%s"' % (sDirCreate,));
+                            os.makedirs(sDirCreate);
+                            sSubDir = oFsObjInfo.name;
+                            if subDir != "":
+                                sSubDir = os.path.join(subDir, oFsObjInfo.name);
+                            self.gctrlCopyFrom(oTest, oRes, oGuestSession, sSubDir);
+                        except (OSError) as e:
+                            if e.errno == errno.EEXIST:
+                                pass;
+                            else:
+                                # Just log, don't assume an error here (will be done in the main loop then).
+                                reporter.logXcpt('\tDirectory creation exception for directory="%s":' % (sSubDir,));
+                                raise;
+                    elif oFsObjInfo.type is vboxcon.FsObjType_File:
+                        #reporter.log2('\tFile "%s"' % (oFsObjInfo.name,));
+                        sSourceFile = os.path.join(sSrcAbs, oFsObjInfo.name);
+                        sDestFile = os.path.join(sDstAbs, oFsObjInfo.name);
+                        self.gctrlCopyFileFrom(oGuestSession, sSourceFile, sDestFile, aFlags);
+                    elif oFsObjInfo.type is vboxcon.FsObjType_Symlink:
+                        #reporter.log2('\tSymlink "%s" -- not tested yet' % oFsObjInfo.name);
+                        pass;
+                    else:
+                        reporter.error('\tDirectory "%s" contains invalid directory entry "%s" (%d)' \
+                                       % (sSubDir, oFsObjInfo.name, oFsObjInfo.type));
+                        fRc = False;
+                except Exception, oXcpt:
+                    # No necessarily an error -- could be VBOX_E_OBJECT_NOT_FOUND. See reference.
+                    if vbox.ComError.equal(oXcpt, vbox.ComError.VBOX_E_OBJECT_NOT_FOUND):
+                        #reporter.log2('\tNo more directory entries for "%s"' % (sCurDir,));
+                        break
+                    # Just log, don't assume an error here (will be done in the main loop then).
+                    reporter.logXcpt('\tDirectory read exception for directory="%s":' % (sSrcAbs,));
+                    fRc = False;
+                    break;
+            oCurDir.close();
+        except:
+            # Just log, don't assume an error here (will be done in the main loop then).
+            reporter.logXcpt('\tDirectory open exception for directory="%s":' % (sSrcAbs,));
+            fRc = False;
+
+        return fRc;
+
+    def gctrlCopyTo(self, oTest, oGuestSession, subDir = ''): # pylint: disable=R0914
+        """
+        Copies files / directories to the guest.
+        Source always contains the absolute path,
+        subDir all paths below it.
+        """
+        fRc = True; # Be optimistic.
+
+        sSrc = oTest.sSrc;
+        sDst = oTest.sDst;
+        aFlags = oTest.aFlags;
+
+        reporter.log2('sSrc=%s, sDst=%s, aFlags=%s' % (sSrc, sDst, aFlags));
+
+        sSrcAbs = sSrc;
+        if subDir != "":
+            sSrcAbs = os.path.join(sSrc, subDir);
+
+        # Note: Current test might want to test copying empty sources
+        if     not os.path.exists(sSrcAbs) \
+            or os.path.isfile(sSrcAbs):
+            return self.gctrlCopyFileTo(oGuestSession, \
+                                        sSrcAbs, sDst, aFlags);
+
+        sDstAbs = os.path.join(sDst, subDir);
+        reporter.log2('Copying host directory "%s" to guest "%s"' % (sSrcAbs, sDstAbs));
+
+        try:
+            # Note: Symlinks intentionally not considered here.
+            for (sDirCurrent, oDirs, oFiles) in os.walk(sSrcAbs, topdown=True):
+                for sFile in oFiles:
+                    sCurFile = os.path.join(sDirCurrent, sFile);
+                    reporter.log2('Processing host file "%s"' % (sCurFile,));
+                    sFileDest = os.path.join(sDstAbs, os.path.relpath(sCurFile, sSrcAbs));
+                    reporter.log2('Copying file to "%s"' % (sFileDest,));
+                    fRc = self.gctrlCopyFileTo(oGuestSession, \
+                                               sCurFile, sFileDest, aFlags);
+                    if fRc is False:
+                        break;
+
+                if fRc is False:
+                    break;
+
+                for sSubDir in oDirs:
+                    sCurDir = os.path.join(sDirCurrent, sSubDir);
+                    reporter.log2('Processing host dir "%s"' % (sCurDir,));
+                    sDirDest = os.path.join(sDstAbs, os.path.relpath(sCurDir, sSrcAbs));
+                    reporter.log2('Creating guest dir "%s"' % (sDirDest,));
+                    oGuestSession.directoryCreate(sDirDest, \
+                                                  700, [ vboxcon.DirectoryCreateFlag_Parents ]);
+                    if fRc is False:
+                        break;
+
+                if fRc is False:
+                    break;
+        except:
+            # Just log, don't assume an error here (will be done in the main loop then).
+            reporter.logXcpt('Copy to exception for sSrc="%s", sDst="%s":' \
+                             % (sSrcAbs, sDst));
+            return False;
+
+        return fRc;
+
+    def gctrlCreateDir(self, oTest, oRes, oGuestSession):
+        """
+        Helper function to create a guest directory specified in
+        the current test.
+        """
+        fRc = True; # Be optimistic.
+        reporter.log2('Creating directory "%s"' % (oTest.sDirectory,));
+
+        try:
+            oGuestSession.directoryCreate(oTest.sDirectory, \
+                                          oTest.fMode, oTest.aFlags);
+            if self.oTstDrv.fpApiVer >= 5.0:
+                fDirExists = oGuestSession.directoryExists(oTest.sDirectory, False);
+            else:
+                fDirExists = oGuestSession.directoryExists(oTest.sDirectory);
+            if      fDirExists is False \
+                and oRes.fRc is True:
+                # Directory does not exist but we want it to.
+                fRc = False;
+        except:
+            reporter.logXcpt('Directory create exception for directory "%s":' % (oTest.sDirectory,));
+            if oRes.fRc is True:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                fRc = False;
+            # Directory creation failed, which was the expected result.
+
+        return fRc;
+
+    def gctrlReadDir(self, oTest, oRes, oGuestSession, subDir = ''): # pylint: disable=R0914
+        """
+        Helper function to read a guest directory specified in
+        the current test.
+        """
+        sDir     = oTest.sDirectory;
+        sFilter  = oTest.sFilter;
+        aFlags   = oTest.aFlags;
+
+        fRc = True; # Be optimistic.
+        cDirs = 0;  # Number of directories read.
+        cFiles = 0; # Number of files read.
+
+        try:
+            sCurDir = os.path.join(sDir, subDir);
+            #reporter.log2('Directory="%s", filter="%s", aFlags="%s"' % (sCurDir, sFilter, aFlags));
+            oCurDir = oGuestSession.directoryOpen(sCurDir, sFilter, aFlags);
+            while fRc:
+                try:
+                    oFsObjInfo = oCurDir.read();
+                    if     oFsObjInfo.name == "." \
+                        or oFsObjInfo.name == "..":
+                        #reporter.log2('\tSkipping "%s"' % oFsObjInfo.name);
+                        continue; # Skip "." and ".." entries.
+                    if oFsObjInfo.type is vboxcon.FsObjType_Directory:
+                        #reporter.log2('\tDirectory "%s"' % oFsObjInfo.name);
+                        cDirs += 1;
+                        sSubDir = oFsObjInfo.name;
+                        if subDir != "":
+                            sSubDir = os.path.join(subDir, oFsObjInfo.name);
+                        fRc, cSubDirs, cSubFiles = self.gctrlReadDir(oTest, oRes, oGuestSession, sSubDir);
+                        cDirs += cSubDirs;
+                        cFiles += cSubFiles;
+                    elif oFsObjInfo.type is vboxcon.FsObjType_File:
+                        #reporter.log2('\tFile "%s"' % oFsObjInfo.name);
+                        cFiles += 1;
+                    elif oFsObjInfo.type is vboxcon.FsObjType_Symlink:
+                        #reporter.log2('\tSymlink "%s" -- not tested yet' % oFsObjInfo.name);
+                        pass;
+                    else:
+                        reporter.error('\tDirectory "%s" contains invalid directory entry "%s" (type %d)' % \
+                                       (sCurDir, oFsObjInfo.name, oFsObjInfo.type));
+                        fRc = False;
+                except Exception, oXcpt:
+                    # No necessarily an error -- could be VBOX_E_OBJECT_NOT_FOUND. See reference.
+                    if vbox.ComError.equal(oXcpt, vbox.ComError.VBOX_E_OBJECT_NOT_FOUND):
+                        #reporter.log2('\tNo more directory entries for "%s"' % (sCurDir,));
+                        break
+                    # Just log, don't assume an error here (will be done in the main loop then).
+                    reporter.logXcpt('\tDirectory open exception for directory="%s":' % (sCurDir,));
+                    fRc = False;
+                    break;
+            oCurDir.close();
+        except:
+            # Just log, don't assume an error here (will be done in the main loop then).
+            reporter.logXcpt('\tDirectory open exception for directory="%s":' % (sCurDir,));
+            fRc = False;
+
+        return (fRc, cDirs, cFiles);
+
+    def gctrlExecDoTest(self, i, oTest, oRes, oGuestSession):
+        """
+        Wrapper function around gctrlExecute to provide more sanity checking
+        when needed in actual execution tests.
+        """
+        reporter.log('Testing #%d, cmd="%s" ...' % (i, oTest.sCmd));
+        fRc = self.gctrlExecute(oTest, oGuestSession);
+        if fRc is oRes.fRc:
+            if fRc is True:
+                # Compare exit status / code on successful process execution.
+                if     oTest.uExitStatus != oRes.uExitStatus \
+                    or oTest.iExitCode   != oRes.iExitCode:
+                    reporter.error('Test #%d failed: Got exit status + code %d,%d, expected %d,%d' % \
+                                   (i, oTest.uExitStatus, oTest.iExitCode, \
+                                       oRes.uExitStatus,  oRes.iExitCode));
+                    return False;
+            if fRc is True:
+                # Compare test / result buffers on successful process execution.
+                if      oTest.sBuf is not None \
+                    and oRes.sBuf is not None:
+                    if bytes(oTest.sBuf) != bytes(oRes.sBuf):
+                        reporter.error('Test #%d failed: Got buffer\n%s (%ld bytes), expected\n%s (%ld bytes)' %
+                                       (i, map(hex, map(ord, oTest.sBuf)), len(oTest.sBuf), \
+                                           map(hex, map(ord, oRes.sBuf)), len(oRes.sBuf)));
+                        return False;
+                    else:
+                        reporter.log2('Test #%d passed: Buffers match (%ld bytes)' % (i, len(oRes.sBuf)));
+                elif     oRes.sBuf is not None \
+                     and len(oRes.sBuf):
+                    reporter.error('Test #%d failed: Got no buffer data, expected\n%s (%dbytes)' %
+                                   (i, map(hex, map(ord, oRes.sBuf)), len(oRes.sBuf)));
+                    return False;
+                elif     oRes.cbStdOut > 0 \
+                     and oRes.cbStdOut != oTest.cbStdOut:
+                    reporter.error('Test #%d failed: Got %ld stdout data, expected %ld'
+                                   % (i, oTest.cbStdOut, oRes.cbStdOut));
+                    return False;
+        else:
+            reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc, oRes.fRc));
+            return False;
+        return True;
+
+    def gctrlExecute(self, oTest, oGuestSession):
+        """
+        Helper function to execute a program on a guest, specified in
+        the current test.
+        """
+        fRc = True; # Be optimistic.
+
+        ## @todo Compare execution timeouts!
+        #tsStart = base.timestampMilli();
+
+        reporter.log2('Using session user=%s, sDomain=%s, session name=%s, session timeout=%ld' \
+                      % (oGuestSession.user, oGuestSession.domain, \
+                         oGuestSession.name, oGuestSession.timeout));
+        reporter.log2('Executing cmd=%s, aFlags=%s, timeout=%ld, args=%s, env=%s' \
+                      % (oTest.sCmd, oTest.aFlags, oTest.timeoutMS, \
+                         oTest.aArgs, oTest.aEnv));
+        try:
+            curProc = oGuestSession.processCreate(oTest.sCmd,
+                                                  oTest.aArgs if self.oTstDrv.fpApiVer >= 5.0 else oTest.aArgs[1:],
+                                                  oTest.aEnv, oTest.aFlags, oTest.timeoutMS);
+            if curProc is not None:
+                reporter.log2('Process start requested, waiting for start (%ldms) ...' % (oTest.timeoutMS,));
+                fWaitFor = [ vboxcon.ProcessWaitForFlag_Start ];
+                waitResult = curProc.waitForArray(fWaitFor, oTest.timeoutMS);
+                reporter.log2('Wait result returned: %d, current process status is: %ld' % (waitResult, curProc.status));
+
+                if curProc.status == vboxcon.ProcessStatus_Started:
+                    fWaitFor = [ vboxcon.ProcessWaitForFlag_Terminate ];
+                    if vboxcon.ProcessCreateFlag_WaitForStdOut in oTest.aFlags:
+                        fWaitFor.append(vboxcon.ProcessWaitForFlag_StdOut);
+                    if vboxcon.ProcessCreateFlag_WaitForStdErr in oTest.aFlags:
+                        fWaitFor.append(vboxcon.ProcessWaitForFlag_StdErr);
+                    ## @todo Add vboxcon.ProcessWaitForFlag_StdIn.
+                    reporter.log2('Process (PID %ld) started, waiting for termination (%dms), waitFlags=%s ...' \
+                                  % (curProc.PID, oTest.timeoutMS, fWaitFor));
+                    while True:
+                        waitResult = curProc.waitForArray(fWaitFor, oTest.timeoutMS);
+                        reporter.log2('Wait returned: %d' % (waitResult,));
+                        try:
+                            # Try stdout.
+                            if     waitResult == vboxcon.ProcessWaitResult_StdOut \
+                                or waitResult == vboxcon.ProcessWaitResult_WaitFlagNotSupported:
+                                reporter.log2('Reading stdout ...');
+                                buf = curProc.Read(1, 64 * 1024, oTest.timeoutMS);
+                                if len(buf):
+                                    reporter.log2('Process (PID %ld) got %ld bytes of stdout data' % (curProc.PID, len(buf)));
+                                    oTest.cbStdOut += len(buf);
+                                    oTest.sBuf = buf; # Appending does *not* work atm, so just assign it. No time now.
+                            # Try stderr.
+                            if     waitResult == vboxcon.ProcessWaitResult_StdErr \
+                                or waitResult == vboxcon.ProcessWaitResult_WaitFlagNotSupported:
+                                reporter.log2('Reading stderr ...');
+                                buf = curProc.Read(2, 64 * 1024, oTest.timeoutMS);
+                                if len(buf):
+                                    reporter.log2('Process (PID %ld) got %ld bytes of stderr data' % (curProc.PID, len(buf)));
+                                    oTest.cbStdErr += len(buf);
+                                    oTest.sBuf = buf; # Appending does *not* work atm, so just assign it. No time now.
+                            # Use stdin.
+                            if     waitResult == vboxcon.ProcessWaitResult_StdIn \
+                                or waitResult == vboxcon.ProcessWaitResult_WaitFlagNotSupported:
+                                pass; #reporter.log2('Process (PID %ld) needs stdin data' % (curProc.pid,));
+                            # Termination or error?
+                            if     waitResult == vboxcon.ProcessWaitResult_Terminate \
+                                or waitResult == vboxcon.ProcessWaitResult_Error \
+                                or waitResult == vboxcon.ProcessWaitResult_Timeout:
+                                reporter.log2('Process (PID %ld) reported terminate/error/timeout: %ld, status: %ld' \
+                                              % (curProc.PID, waitResult, curProc.status));
+                                break;
+                        except:
+                            # Just skip reads which returned nothing.
+                            pass;
+                    reporter.log2('Final process status (PID %ld) is: %ld' % (curProc.PID, curProc.status));
+                    reporter.log2('Process (PID %ld) %ld stdout, %ld stderr' % (curProc.PID, oTest.cbStdOut, oTest.cbStdErr));
+            oTest.uExitStatus = curProc.status;
+            oTest.iExitCode = curProc.exitCode;
+            reporter.log2('Process (PID %ld) has exit code: %ld' % (curProc.PID, oTest.iExitCode));
+        except KeyboardInterrupt:
+            reporter.error('Process (PID %ld) execution interrupted' % (curProc.PID,));
+            if curProc is not None:
+                curProc.close();
+        except:
+            # Just log, don't assume an error here (will be done in the main loop then).
+            reporter.logXcpt('Execution exception for command "%s":' % (oTest.sCmd,));
+            fRc = False;
+
+        return fRc;
+
+    def testGuestCtrlSessionEnvironment(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests the guest session environment changes.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        aaTests = [
+            # No environment set.
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword),
+              tdTestResultSessionEnv(fRc = False) ],
+            # Invalid stuff.
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ '=FOO' ]),
+              tdTestResultSessionEnv(fRc = False) ],
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ '====' ]),
+              tdTestResultSessionEnv(fRc = False) ],
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ '=BAR' ]),
+              tdTestResultSessionEnv(fRc = False) ],
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ u'ß$%ß&' ]),
+              tdTestResultSessionEnv(fRc = False) ],
+            # Key only.
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ 'FOO=' ]),
+              tdTestResultSessionEnv(fRc = True, cNumVars = 1) ],
+            # Values.
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ 'FOO' ]),
+              tdTestResultSessionEnv(fRc = True, cNumVars = 1) ],
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ 'FOO=BAR' ]),
+              tdTestResultSessionEnv(fRc = True, cNumVars = 1) ],
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ 'FOO=BAR', 'BAR=BAZ' ]),
+              tdTestResultSessionEnv(fRc = True, cNumVars = 2) ],
+            # A bit more weird keys/values.
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ '$$$=' ]),
+              tdTestResultSessionEnv(fRc = True, cNumVars = 1) ],
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ '$$$=%%%' ]),
+              tdTestResultSessionEnv(fRc = True, cNumVars = 1) ],
+            # Same stuff.
+            [ tdTestSessionEnv(sUser = sUser, sPassword = sPassword, aEnv = [ 'FOO=BAR', 'FOO=BAR' ]),
+              tdTestResultSessionEnv(fRc = True, cNumVars = 1) ]
+        ];
+
+        # The IGuestSession::environment attribute changed late in 5.0 development.
+        sEnvironmentChangesAttr = 'environmentChanges' if self.oTstDrv.fpApiVer >= 5.0 else 'environment';
+
+        # Parameters.
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            reporter.log('Testing #%d, user="%s", sPassword="%s", env="%s" (%d)...' \
+                         % (i, curTest.oCreds.sUser, curTest.oCreds.sPassword, curTest.aEnv, len(curTest.aEnv)));
+            curGuestSessionName = 'testGuestCtrlSessionEnvironment: Test #%d' % (i,);
+            fRc2, curGuestSession = curTest.createSession(curGuestSessionName);
+            if fRc2 is not True:
+                reporter.error('Test #%d failed: Session creation failed: Got %s, expected True' % (i, fRc2));
+                fRc = False;
+                break;
+            # Make sure environment is empty.
+            curEnv = self.oTstDrv.oVBoxMgr.getArray(curGuestSession, sEnvironmentChangesAttr);
+            reporter.log2('Test #%d: Environment initially has %d elements' % (i, len(curEnv)));
+            if len(curEnv) != 0:
+                reporter.error('Test #%d failed: Initial session environment has %d vars, expected 0' % (i, len(curEnv)));
+                fRc = False;
+                break;
+            try:
+                for (_, aEnv) in enumerate(curTest.aEnv):
+                    aElems = aEnv.split('=');
+                    strKey = '';  ## @todo s/Key/Var/g
+                    strValue = '';
+                    if len(aElems) > 0:
+                        strKey = aElems[0];
+                    if len(aElems) == 2:
+                        strValue = aElems[1];
+                    reporter.log2('Test #%d: Single var="%s", value="%s" (%d) ...' \
+                                  % (i, strKey, strValue, len(aElems)));
+                    try:
+                        if self.oTstDrv.fpApiVer >= 5.0:
+                            curGuestSession.environmentScheduleSet(strKey, strValue);
+                        else:
+                            curGuestSession.environmentSet(strKey, strValue);
+                    except:
+                        # Setting environment variables might fail (e.g. if empty name specified). Check.
+                        reporter.logXcpt('Test #%d failed: Setting environment variable failed:' % (i,));
+                        curEnv = self.oTstDrv.oVBoxMgr.getArray(curGuestSession, sEnvironmentChangesAttr);
+                        if len(curEnv) is not curRes.cNumVars:
+                            reporter.error('Test #%d failed: Session environment has %d vars, expected %d' \
+                                           % (i, len(curEnv), curRes.cNumVars));
+                            fRc = False;
+                            break;
+                        else:
+                            reporter.log('Test #%d: API reported an error (single), good' % (i,));
+                    ## @todo environmentGet() has been removed in 5.0 because it's not up to the task of returning all the
+                    ## putenv strings forms and gives the impression that the environment is something it isn't. This test
+                    ## should be rewritten using the attribute.  What's more, there should be an Unset test here, shouldn't
+                    ## there?
+                    #
+                    #reporter.log2('Getting key="%s" ...' % (strKey,));
+                    #try:
+                    #    strValue2 = curGuestSession.environmentGet(strKey);
+                    #    if      strKey.isalnum() \
+                    #        and strValue != strValue2:
+                    #        reporter.error('Test #%d failed: Got environment value "%s", expected "%s" (var: "%s")' \
+                    #                       % (i, strValue2, strValue, strKey));
+                    #        fRc = False;
+                    #        break;
+                    #    # Getting back an empty value when specifying an invalid key is fine.
+                    #    reporter.log2('Got key "%s=%s"' % (strKey, strValue2));
+                    #except UnicodeDecodeError: # Might happen on unusal values, fine.
+                    #    if strValue != strValue2:
+                    #        reporter.error('Test #%d failed: Got (undecoded) environment variable "%s", ' \
+                    #                       'expected "%s" (var: "%s")' \
+                    #                       % (i, strValue2, strValue, strKey));
+                    #        fRc = False;
+                    #        break;
+                    #except:
+                    #    if     strKey == "" \
+                    #        or not strKey.isalnum():
+                    #        reporter.log('Test #%d: API reported an error (invalid key "%s"), good' % (i, strKey));
+                    #    else:
+                    #        reporter.errorXcpt('Test #%d failed: Getting environment variable:' % (i));
+                if fRc is False:
+                    continue;
+                # Set the same stuff again, this time all at once using the array.
+                if len(curTest.aEnv):
+                    reporter.log('Test #%d: Array %s (%d)' % (i, curTest.aEnv, len(curTest.aEnv)));
+                    try:
+                        ## @todo No return (e.g. boolean) value available thru wrapper.
+                        #curGuestSession.environmentSetArray(curTest.aEnv);
+                        pass;
+                    except:
+                        # Setting environment variables might fail (e.g. if empty name specified). Check.
+                        curEnv = self.oTstDrv.oVBoxMgr.getArray(curGuestSession, sEnvironmentChangesAttr);
+                        if len(curEnv) is not curRes.cNumVars:
+                            reporter.error('Test #%d failed: Session environment has %d vars, expected %d (array)' \
+                                           % (i, len(curEnv), curRes.cNumVars));
+                            fRc = False;
+                            break;
+                        else:
+                            reporter.log('Test #%d: API reported an error (array), good' % (i,));
+                ## @todo Get current system environment and add it to curRes.cNumVars before comparing!
+                reporter.log('Test #%d: Environment size' % (i,));
+                curEnv = self.oTstDrv.oVBoxMgr.getArray(curGuestSession, sEnvironmentChangesAttr);
+                reporter.log2('Test #%d: Environment (%d) -> %s' % (i, len(curEnv), curEnv));
+                if len(curEnv) != curRes.cNumVars:
+                    reporter.error('Test #%d failed: Session environment has %d vars (%s), expected %d' \
+                                   % (i, len(curEnv), curEnv, curRes.cNumVars));
+                    fRc = False;
+                    break;
+
+                self.oTstDrv.oVBoxMgr.setArray(curGuestSession, sEnvironmentChangesAttr, []);
+                curEnv = self.oTstDrv.oVBoxMgr.getArray(curGuestSession, sEnvironmentChangesAttr);
+                if len(curEnv) is not 0:
+                    reporter.error('Test #%d failed: Session environment has %d vars, expected 0');
+                    fRc = False;
+                    break;
+            except:
+                reporter.errorXcpt('Test #%d failed:' % (i,));
+
+            fRc2 = curTest.closeSession();
+            if fRc2 is False:
+                reporter.error('Test #%d failed: Session could not be closed' % (i,));
+                fRc = False;
+                break;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlSession(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests the guest session handling.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        aaTests = [
+            # Invalid parameters.
+            [ tdTestSession(),
+              tdTestResultSession(fRc = False) ],
+            [ tdTestSession(sUser = ''),
+              tdTestResultSession(fRc = False) ],
+            [ tdTestSession(sPassword = 'bar'),
+              tdTestResultSession(fRc = False) ],
+            [ tdTestSession(sDomain = 'boo'),
+              tdTestResultSession(fRc = False) ],
+            [ tdTestSession(sPassword = 'bar', sDomain = 'boo'),
+              tdTestResultSession(fRc = False) ],
+            # User account without a passwort - forbidden.
+            [ tdTestSession(sUser = sUser),
+              tdTestResultSession(fRc = False) ],
+            # Wrong credentials.
+            # Note: On Guest Additions < 4.3 this always succeeds because these don't
+            #       support creating dedicated sessions. Instead, guest process creation
+            #       then will fail. See note below.
+            [ tdTestSession(sUser = 'foo', sPassword = 'bar', sDomain = 'boo'),
+              tdTestResultSession(fRc = False) ],
+            # Correct credentials.
+            [ tdTestSession(sUser = sUser, sPassword = sPassword),
+              tdTestResultSession(fRc = True, cNumSessions = 1) ]
+        ];
+
+        # Parameters.
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestSession, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            reporter.log('Testing #%d, user="%s", sPassword="%s", sDomain="%s" ...' \
+                         % (i, curTest.oCreds.sUser, curTest.oCreds.sPassword, curTest.oCreds.sDomain));
+            curGuestSessionName = 'testGuestCtrlSession: Test #%d' % (i);
+            fRc2, curGuestSession = curTest.createSession(curGuestSessionName);
+            # See note about < 4.3 Guest Additions above.
+            if      curGuestSession is not None \
+                and curGuestSession.protocolVersion >= 2 \
+                and fRc2 is not curRes.fRc:
+                reporter.error('Test #%d failed: Session creation failed: Got %s, expected %s' \
+                               % (i, fRc2, curRes.fRc));
+                fRc = False;
+            if fRc2:
+                # On Guest Additions < 4.3 getSessionCount() always will return 1, so skip the
+                # check then.
+                if curGuestSession.protocolVersion >= 2:
+                    curSessionCount = curTest.getSessionCount(self.oTstDrv.oVBoxMgr);
+                    if curSessionCount is not curRes.cNumSessions:
+                        reporter.error('Test #%d failed: Session count does not match: Got %d, expected %d' \
+                                       % (i, curSessionCount, curRes.cNumSessions));
+                        fRc = False;
+                        break;
+                if      curGuestSession is not None \
+                    and curGuestSession.name != curGuestSessionName:
+                    reporter.error('Test #%d failed: Session name does not match: Got "%s", expected "%s"' \
+                                   % (i, curGuestSession.name, curGuestSessionName));
+                    fRc = False;
+                    break;
+            fRc2 = curTest.closeSession();
+            if fRc2 is False:
+                reporter.error('Test #%d failed: Session could not be closed' % (i,));
+                fRc = False;
+                break;
+
+        if fRc is False:
+            return (False, oTxsSession);
+
+        # Multiple sessions.
+        iMaxGuestSessions = 31; # Maximum number of concurrent guest session allowed.
+                                # Actually, this is 32, but we don't test session 0.
+        multiSession = {};
+        reporter.log2('Opening multiple guest tsessions at once ...');
+        for i in range(iMaxGuestSessions + 1):
+            multiSession[i] = tdTestSession(sUser = sUser, sPassword = sPassword, sSessionName = 'MultiSession #%d' % (i,));
+            multiSession[i].setEnvironment(oSession, oTxsSession, oTestVm);
+            curSessionCount = multiSession[i].getSessionCount(self.oTstDrv.oVBoxMgr);
+            reporter.log2('MultiSession test #%d count is %d' % (i, curSessionCount));
+            if curSessionCount is not i:
+                reporter.error('MultiSession count #%d must be %d, got %d' % (i, i, curSessionCount));
+                fRc = False;
+                break;
+            fRc2, _ = multiSession[i].createSession('MultiSession #%d' % (i,));
+            if fRc2 is not True:
+                if i < iMaxGuestSessions:
+                    reporter.error('MultiSession #%d test failed' % (i,));
+                    fRc = False;
+                else:
+                    reporter.log('MultiSession #%d exceeded concurrent guest session count, good' % (i,));
+                break;
+
+        curSessionCount = multiSession[i].getSessionCount(self.oTstDrv.oVBoxMgr);
+        if curSessionCount is not iMaxGuestSessions:
+            reporter.error('Final MultiSession count must be %d, got %d'
+                           % (iMaxGuestSessions, curSessionCount));
+            return (False, oTxsSession);
+
+        reporter.log2('Closing MultiSessions ...');
+        iLastSession = iMaxGuestSessions - 1;
+        for i in range(iLastSession): # Close all but the last opened session.
+            fRc2 = multiSession[i].closeSession();
+            reporter.log2('MultiSession #%d count is %d' % (i, multiSession[i].getSessionCount(self.oTstDrv.oVBoxMgr),));
+            if fRc2 is False:
+                reporter.error('Closing MultiSession #%d failed' % (i,));
+                fRc = False;
+                break;
+        curSessionCount = multiSession[i].getSessionCount(self.oTstDrv.oVBoxMgr);
+        if curSessionCount is not 1:
+            reporter.error('Final MultiSession count #2 must be 1, got %d' % (curSessionCount,));
+            fRc = False;
+
+        try:
+            # Make sure that accessing the first opened guest session does not work anymore because we just removed (closed) it.
+            curSessionName = multiSession[0].oGuestSession.name;
+            reporter.error('Accessing first removed MultiSession should not be possible, got name="%s"' % (curSessionName,));
+            fRc = False;
+        except:
+            reporter.logXcpt('Could not access first removed MultiSession object, good:');
+
+        try:
+            # Try Accessing last opened session which did not get removed yet.
+            curSessionName = multiSession[iLastSession].oGuestSession.name;
+            reporter.log('Accessing last standing MultiSession worked, got name="%s"' % (curSessionName,));
+            multiSession[iLastSession].closeSession();
+            curSessionCount = multiSession[i].getSessionCount(self.oTstDrv.oVBoxMgr);
+            if curSessionCount is not 0:
+                reporter.error('Final MultiSession count #3 must be 0, got %d' % (curSessionCount,));
+                fRc = False;
+        except:
+            reporter.logXcpt('Could not access last standing MultiSession object:');
+            fRc = False;
+
+        ## @todo Test session timeouts.
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlSessionFileRefs(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests the guest session file reference handling.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+            sPassword = "password";
+            sDomain = "";
+            sFile = "C:\\windows\\system32\\kernel32.dll";
+
+        # Number of stale guest files to create.
+        cStaleFiles = 10;
+
+        fRc = True;
+        try:
+            oGuest = oSession.o.console.guest;
+            oGuestSession = oGuest.createSession(sUser, sPassword, sDomain, \
+                                                 "testGuestCtrlSessionFileRefs");
+            fWaitFor = [ vboxcon.GuestSessionWaitForFlag_Start ];
+            waitResult = oGuestSession.waitForArray(fWaitFor, 30 * 1000);
+            #
+            # Be nice to Guest Additions < 4.3: They don't support session handling and
+            # therefore return WaitFlagNotSupported.
+            #
+            if      waitResult != vboxcon.GuestSessionWaitResult_Start \
+                and waitResult != vboxcon.GuestSessionWaitResult_WaitFlagNotSupported:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                reporter.log('Session did not start successfully, returned wait result: %ld' \
+                              % (waitResult));
+                return (False, oTxsSession);
+            reporter.log('Session successfully started');
+
+            #
+            # Open guest files and "forget" them (stale entries).
+            # For them we don't have any references anymore intentionally.
+            #
+            reporter.log2('Opening stale files');
+            for i in range(0, cStaleFiles):
+                try:
+                    if self.oTstDrv.fpApiVer >= 5.0:
+                        oGuestSession.fileOpen(sFile, vboxcon.FileAccessMode_ReadOnly, vboxcon.FileOpenAction_OpenExisting, 0);
+                    else:
+                        oGuestSession.fileOpen(sFile, "r", "oe", 0);
+                    # Note: Use a timeout in the call above for not letting the stale processes
+                    #       hanging around forever.  This can happen if the installed Guest Additions
+                    #       do not support terminating guest processes.
+                except:
+                    reporter.errorXcpt('Opening stale file #%ld failed:' % (i,));
+                    fRc = False;
+                    break;
+
+            if fRc:
+                cFiles = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'files'));
+                if cFiles != cStaleFiles:
+                    reporter.error('Test failed: Got %ld stale files, expected %ld' % (cFiles, cStaleFiles));
+                    fRc = False;
+
+            if fRc:
+                #
+                # Open non-stale files and close them again.
+                #
+                reporter.log2('Opening non-stale files');
+                aaFiles = [];
+                for i in range(0, cStaleFiles):
+                    try:
+                        if self.oTstDrv.fpApiVer >= 5.0:
+                            oCurFile = oGuestSession.fileOpen(sFile, vboxcon.FileAccessMode_ReadOnly,
+                                                              vboxcon.FileOpenAction_OpenExisting, 0);
+                        else:
+                            oCurFile = oGuestSession.fileOpen(sFile, "r", "oe", 0);
+                        aaFiles.append(oCurFile);
+                    except:
+                        reporter.errorXcpt('Opening non-stale file #%ld failed:' % (i,));
+                        fRc = False;
+                        break;
+            if fRc:
+                cFiles = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'files'));
+                if cFiles != cStaleFiles * 2:
+                    reporter.error('Test failed: Got %ld total files, expected %ld' % (cFiles, cStaleFiles * 2));
+                    fRc = False;
+            if fRc:
+                reporter.log2('Closing all non-stale files again ...');
+                for i in range(0, cStaleFiles):
+                    try:
+                        aaFiles[i].close();
+                    except:
+                        reporter.errorXcpt('Waiting for non-stale file #%ld failed:' % (i,));
+                        fRc = False;
+                        break;
+                cFiles = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'files'));
+                # Here we count the stale files (that is, files we don't have a reference
+                # anymore for) and the opened and then closed non-stale files (that we still keep
+                # a reference in aaFiles[] for).
+                if cFiles != cStaleFiles:
+                    reporter.error('Test failed: Got %ld total files, expected %ld' \
+                                   % (cFiles, cStaleFiles));
+                    fRc = False;
+                if fRc:
+                    #
+                    # Check if all (referenced) non-stale files now are in "closed" state.
+                    #
+                    reporter.log2('Checking statuses of all non-stale files ...');
+                    for i in range(0, cStaleFiles):
+                        try:
+                            curFilesStatus = aaFiles[i].status;
+                            if curFilesStatus != vboxcon.FileStatus_Closed:
+                                reporter.error('Test failed: Non-stale file #%ld has status %ld, expected %ld' \
+                                       % (i, curFilesStatus, vboxcon.FileStatus_Closed));
+                                fRc = False;
+                        except:
+                            reporter.errorXcpt('Checking status of file #%ld failed:' % (i,));
+                            fRc = False;
+                            break;
+            if fRc:
+                reporter.log2('All non-stale files closed');
+            cFiles = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'files'));
+            reporter.log2('Final guest session file count: %ld' % (cFiles,));
+            # Now try to close the session and see what happens.
+            reporter.log2('Closing guest session ...');
+            oGuestSession.close();
+        except:
+            reporter.errorXcpt('Testing for stale processes failed:');
+            fRc = False;
+
+        return (fRc, oTxsSession);
+
+    #def testGuestCtrlSessionDirRefs(self, oSession, oTxsSession, oTestVm):
+    #    """
+    #    Tests the guest session directory reference handling.
+    #    """
+
+    #    fRc = True;
+    #    return (fRc, oTxsSession);
+
+    def testGuestCtrlSessionProcRefs(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests the guest session process reference handling.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+            sPassword = "password";
+            sDomain = "";
+            sCmd = "C:\\windows\\system32\\cmd.exe";
+            aArgs = [sCmd,];
+
+        # Number of stale guest processes to create.
+        cStaleProcs = 10;
+
+        fRc = True;
+        try:
+            oGuest = oSession.o.console.guest;
+            oGuestSession = oGuest.createSession(sUser, sPassword, sDomain, \
+                                                 "testGuestCtrlSessionProcRefs");
+            fWaitFor = [ vboxcon.GuestSessionWaitForFlag_Start ];
+            waitResult = oGuestSession.waitForArray(fWaitFor, 30 * 1000);
+            #
+            # Be nice to Guest Additions < 4.3: They don't support session handling and
+            # therefore return WaitFlagNotSupported.
+            #
+            if      waitResult != vboxcon.GuestSessionWaitResult_Start \
+                and waitResult != vboxcon.GuestSessionWaitResult_WaitFlagNotSupported:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                reporter.log('Session did not start successfully, returned wait result: %ld' \
+                              % (waitResult));
+                return (False, oTxsSession);
+            reporter.log('Session successfully started');
+
+            #
+            # Fire off forever-running processes and "forget" them (stale entries).
+            # For them we don't have any references anymore intentionally.
+            #
+            reporter.log2('Starting stale processes');
+            for i in range(0, cStaleProcs):
+                try:
+                    oGuestSession.processCreate(sCmd,
+                                                aArgs if self.oTstDrv.fpApiVer >= 5.0 else aArgs[1:], [],
+                                                [ vboxcon.ProcessCreateFlag_WaitForStdOut ], \
+                                                30 * 1000);
+                    # Note: Use a timeout in the call above for not letting the stale processes
+                    #       hanging around forever.  This can happen if the installed Guest Additions
+                    #       do not support terminating guest processes.
+                except:
+                    reporter.logXcpt('Creating stale process #%ld failed:' % (i,));
+                    fRc = False;
+                    break;
+
+            if fRc:
+                cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
+                if cProcs != cStaleProcs:
+                    reporter.error('Test failed: Got %ld stale processes, expected %ld' % (cProcs, cStaleProcs));
+                    fRc = False;
+
+            if fRc:
+                #
+                # Fire off non-stale processes and wait for termination.
+                #
+                if oTestVm.isWindows():
+                    aArgs = [ sCmd, '/C', 'dir', '/S', 'C:\\Windows\\system'];
+                reporter.log2('Starting non-stale processes');
+                aaProcs = [];
+                for i in range(0, cStaleProcs):
+                    try:
+                        oCurProc = oGuestSession.processCreate(sCmd, aArgs if self.oTstDrv.fpApiVer >= 5.0 else aArgs[1:],
+                                                               [], [], 0); # Infinite timeout.
+                        aaProcs.append(oCurProc);
+                    except:
+                        reporter.logXcpt('Creating non-stale process #%ld failed:' % (i,));
+                        fRc = False;
+                        break;
+            if fRc:
+                reporter.log2('Waiting for non-stale processes to terminate');
+                for i in range(0, cStaleProcs):
+                    try:
+                        aaProcs[i].waitForArray([ vboxcon.ProcessWaitForFlag_Terminate ], 30 * 1000);
+                        curProcStatus = aaProcs[i].status;
+                        if aaProcs[i].status != vboxcon.ProcessStatus_TerminatedNormally:
+                            reporter.error('Test failed: Waiting for non-stale processes #%ld'
+                                           ' resulted in status %ld, expected %ld' \
+                                   % (i, curProcStatus, vboxcon.ProcessStatus_TerminatedNormally));
+                            fRc = False;
+                    except:
+                        reporter.logXcpt('Waiting for non-stale process #%ld failed:' % (i,));
+                        fRc = False;
+                        break;
+                cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
+                # Here we count the stale processes (that is, processes we don't have a reference
+                # anymore for) and the started + terminated non-stale processes (that we still keep
+                # a reference in aaProcs[] for).
+                if cProcs != (cStaleProcs * 2):
+                    reporter.error('Test failed: Got %ld total processes, expected %ld' \
+                                   % (cProcs, cStaleProcs));
+                    fRc = False;
+                if fRc:
+                    #
+                    # Check if all (referenced) non-stale processes now are in "terminated" state.
+                    #
+                    for i in range(0, cStaleProcs):
+                        curProcStatus = aaProcs[i].status;
+                        if aaProcs[i].status != vboxcon.ProcessStatus_TerminatedNormally:
+                            reporter.error('Test failed: Non-stale processes #%ld has status %ld, expected %ld' \
+                                   % (i, curProcStatus, vboxcon.ProcessStatus_TerminatedNormally));
+                            fRc = False;
+            if fRc:
+                reporter.log2('All non-stale processes terminated');
+
+                # Fire off blocking processes which are terminated via terminate().
+                if oTestVm.isWindows():
+                    aArgs = [ sCmd, '/C', 'dir', '/S', 'C:\\Windows'];
+                reporter.log2('Starting blocking processes');
+                aaProcs = [];
+                for i in range(0, cStaleProcs):
+                    try:
+                        oCurProc = oGuestSession.processCreate(sCmd, aArgs if self.oTstDrv.fpApiVer >= 5.0 else aArgs[1:],
+                                                               [],  [], 30 * 1000);
+                        # Note: Use a timeout in the call above for not letting the stale processes
+                        #       hanging around forever.  This can happen if the installed Guest Additions
+                        #       do not support terminating guest processes.
+                        aaProcs.append(oCurProc);
+                    except:
+                        reporter.logXcpt('Creating blocking process failed:');
+                        fRc = False;
+                        break;
+            if fRc:
+                reporter.log2('Terminating blocking processes');
+                for i in range(0, cStaleProcs):
+                    try:
+                        aaProcs[i].terminate();
+                    except: # Termination might not be supported, just skip and log it.
+                        reporter.logXcpt('Termination of blocking process failed, skipped:');
+                cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
+                if cProcs != (cStaleProcs * 2): # Still should be 20 processes because we terminated the 10 newest ones.
+                    reporter.error('Test failed: Got %ld total processes, expected %ld' % (cProcs, cStaleProcs * 2));
+                    fRc = False;
+            cProcs = len(self.oTstDrv.oVBoxMgr.getArray(oGuestSession, 'processes'));
+            reporter.log2('Final guest session processes count: %ld' % (cProcs,));
+            # Now try to close the session and see what happens.
+            reporter.log2('Closing guest session ...');
+            oGuestSession.close();
+        except:
+            reporter.logXcpt('Testing for stale processes failed:');
+            fRc = False;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlExec(self, oSession, oTxsSession, oTestVm):                # pylint: disable=R0914,R0915
+        """
+        Tests the basic execution feature.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        if oTestVm.isWindows():
+            # Outputting stuff.
+            sImageOut = "C:\\windows\\system32\\cmd.exe";
+        else:
+            reporter.error('Implement me!'); ## @todo Implement non-Windows bits.
+            return (False, oTxsSession);
+
+        aaInvalid = [
+            # Invalid parameters.
+            [ tdTestExec(sUser = sUser, sPassword = sPassword),
+              tdTestResultExec(fRc = False) ],
+            # Non-existent / invalid image.
+            [ tdTestExec(sCmd = "non-existent", sUser = sUser, sPassword = sPassword),
+              tdTestResultExec(fRc = False) ],
+            [ tdTestExec(sCmd = "non-existent2", sUser = sUser, sPassword = sPassword, fWaitForExit = True),
+              tdTestResultExec(fRc = False) ],
+            # Use an invalid format string.
+            [ tdTestExec(sCmd = "%$%%%&", sUser = sUser, sPassword = sPassword),
+              tdTestResultExec(fRc = False) ],
+            # More stuff.
+            [ tdTestExec(sCmd = "ƒ‰‹ˆ÷‹¸", sUser = sUser, sPassword = sPassword),
+              tdTestResultExec(fRc = False) ],
+            [ tdTestExec(sCmd = "???://!!!", sUser = sUser, sPassword = sPassword),
+              tdTestResultExec(fRc = False) ],
+            [ tdTestExec(sCmd = "<>!\\", sUser = sUser, sPassword = sPassword),
+              tdTestResultExec(fRc = False) ]
+            # Enable as soon as ERROR_BAD_DEVICE is implemented.
+            #[ tdTestExec(sCmd = "CON", sUser = sUser, sPassword = sPassword),
+            #  tdTestResultExec(fRc = False) ]
+        ];
+
+        if oTestVm.isWindows():
+            sVBoxControl = "C:\\Program Files\\Oracle\\VirtualBox Guest Additions\\VBoxControl.exe";
+            aaExec = [
+                # Basic executon.
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True) ],
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32\\kernel32.dll' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True) ],
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32\\nonexist.dll' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 1) ],
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', '/wrongparam' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 1) ],
+                # Paths with spaces.
+                ## @todo Get path of installed Guest Additions. Later.
+                [ tdTestExec(sCmd = sVBoxControl, aArgs = [ sVBoxControl, 'version' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True) ],
+                # StdOut.
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True) ],
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stdout-non-existing' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 1) ],
+                # StdErr.
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True) ],
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stderr-non-existing' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 1) ],
+                # StdOut + StdErr.
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'c:\\windows\\system32' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True) ],
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir', '/S', 'stdouterr-non-existing' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 1) ]
+                # FIXME: Failing tests.
+                # Environment variables.
+                # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_NONEXIST' ],
+                #              sUser = sUser, sPassword = sPassword),
+                #   tdTestResultExec(fRc = True, iExitCode = 1) ]
+                # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'windir' ],
+                #              sUser = sUser, sPassword = sPassword,
+                #              aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, sBuf = 'windir=C:\\WINDOWS\r\n') ],
+                # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_FOO' ],
+                #              sUser = sUser, sPassword = sPassword,
+                #              aEnv = [ 'TEST_FOO=BAR' ],
+                #              aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, sBuf = 'TEST_FOO=BAR\r\n') ],
+                # [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'set', 'TEST_FOO' ],
+                #              sUser = sUser, sPassword = sPassword,
+                #              aEnv = [ 'TEST_FOO=BAR', 'TEST_BAZ=BAR' ],
+                #              aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, sBuf = 'TEST_FOO=BAR\r\n') ]
+
+                ## @todo Create some files (or get files) we know the output size of to validate output length!
+                ## @todo Add task which gets killed at some random time while letting the guest output something.
+            ];
+
+            # Manual test, not executed automatically.
+            aaManual = [
+                [ tdTestExec(sCmd = sImageOut, aArgs = [ sImageOut, '/C', 'dir /S C:\\Windows' ],
+                             sUser = sUser, sPassword = sPassword,
+                             aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                  tdTestResultExec(fRc = True, cbStdOut = 497917) ] ];
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        # Build up the final test array for the first batch.
+        aaTests = [];
+        aaTests.extend(aaInvalid);
+        if aaExec is not None:
+            aaTests.extend(aaExec);
+        fRc = True;
+
+        #
+        # Single execution stuff. Nice for debugging.
+        #
+        fManual = False;
+        if fManual:
+            curTest = aaTests[1][0]; # tdTestExec, use an index, later.
+            curRes  = aaTests[1][1]; # tdTestResultExec
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlExec: Single test 1');
+            if fRc is False:
+                reporter.error('Single test failed: Could not create session');
+            else:
+                fRc = self.gctrlExecDoTest(0, curTest, curRes, curGuestSession);
+            curTest.closeSession();
+
+            curTest = aaTests[2][0]; # tdTestExec, use an index, later.
+            curRes  = aaTests[2][1]; # tdTestResultExec
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlExec: Single test 2');
+            if fRc is False:
+                reporter.error('Single test failed: Could not create session');
+            else:
+                fRc = self.gctrlExecDoTest(0, curTest, curRes, curGuestSession);
+            curTest.closeSession();
+
+            curTest = aaTests[3][0]; # tdTestExec, use an index, later.
+            curRes  = aaTests[3][1]; # tdTestResultExec
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlExec: Single test 3');
+            if fRc is False:
+                reporter.error('Single test failed: Could not create session');
+            else:
+                fRc = self.gctrlExecDoTest(0, curTest, curRes, curGuestSession);
+            curTest.closeSession();
+            return (fRc, oTxsSession);
+        else:
+            aaManual = aaManual; # Workaround for pylint #W0612.
+
+        if fRc is False:
+            return (fRc, oTxsSession);
+
+        #
+        # First batch: One session per guest process.
+        #
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResultExec
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlExec: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            fRc = self.gctrlExecDoTest(i, curTest, curRes, curGuestSession);
+            if fRc is False:
+                break;
+            fRc = curTest.closeSession();
+            if fRc is False:
+                break;
+
+        # No sessions left?
+        if fRc is True:
+            cSessions = len(self.oTstDrv.oVBoxMgr.getArray(oSession.o.console.guest, 'sessions'));
+            if cSessions is not 0:
+                reporter.error('Found %d stale session(s), expected 0' % (cSessions,));
+                fRc = False;
+
+        if fRc is False:
+            return (fRc, oTxsSession);
+
+        reporter.log('Now using one guest session for all tests ...');
+
+        #
+        # Second batch: One session for *all* guest processes.
+        #
+        oGuest = oSession.o.console.guest;
+        try:
+            reporter.log('Creating session for all tests ...');
+            curGuestSession = oGuest.createSession(sUser, sPassword, '', 'testGuestCtrlExec: One session for all tests');
+            try:
+                fWaitFor = [ vboxcon.GuestSessionWaitForFlag_Start ];
+                waitResult = curGuestSession.waitForArray(fWaitFor, 30 * 1000);
+                if      waitResult != vboxcon.GuestSessionWaitResult_Start \
+                    and waitResult != vboxcon.GuestSessionWaitResult_WaitFlagNotSupported:
+                    reporter.error('Session did not start successfully, returned wait result: %ld' \
+                                   % (waitResult));
+                    return (False, oTxsSession);
+                reporter.log('Session successfully started');
+            except:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                reporter.logXcpt('Waiting for guest session to start failed:');
+                return (False, oTxsSession);
+            # Note: Not waiting for the guest session to start here
+            #       is intentional. This must be handled by the process execution
+            #       call then.
+            for (i, aTest) in enumerate(aaTests):
+                curTest = aTest[0]; # tdTestExec, use an index, later.
+                curRes  = aTest[1]; # tdTestResultExec
+                curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+                fRc = self.gctrlExecDoTest(i, curTest, curRes, curGuestSession);
+                if fRc is False:
+                    break;
+            try:
+                reporter.log2('Closing guest session ...');
+                curGuestSession.close();
+                curGuestSession = None;
+            except:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                reporter.logXcpt('Closing guest session failed:');
+                fRc = False;
+        except:
+            reporter.logXcpt('Could not create one session:');
+
+        # No sessions left?
+        if fRc is True:
+            cSessions = len(self.oTstDrv.oVBoxMgr.getArray(oSession.o.console.guest, 'sessions'));
+            if cSessions is not 0:
+                reporter.error('Found %d stale session(s), expected 0' % (cSessions,));
+                fRc = False;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlExecErrorLevel(self, oSession, oTxsSession, oTestVm):
+        """
+        Tests handling of error levels from started guest processes.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        if oTestVm.isWindows():
+            # Outputting stuff.
+            sImage = "C:\\windows\\system32\\cmd.exe";
+        else:
+            reporter.error('Implement me!'); ## @todo Implement non-Windows bits.
+            return (False, oTxsSession);
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Simple.
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'wrongcommand' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 1) ],
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'exit', '22' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 22) ],
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'set', 'ERRORLEVEL=234' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 0) ],
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'echo', '%WINDIR%' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 0) ],
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'set', 'ERRORLEVEL=0' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 0) ],
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 0) ],
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32\\kernel32.dll' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 0) ],
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 1) ],
+                [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ],
+                             sUser = sUser, sPassword = sPassword),
+                  tdTestResultExec(fRc = True, iExitCode = 1) ]
+                # FIXME: Failing tests.
+                # With stdout.
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ],
+                #              sUser = sUser, sPassword = sPassword, aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 0) ],
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ],
+                #              sUser = sUser, sPassword = sPassword, aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 1) ],
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ],
+                #              sUser = sUser, sPassword = sPassword, aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 1) ],
+                # With stderr.
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ],
+                #              sUser = sUser, sPassword = sPassword, aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 0) ],
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ],
+                #              sUser = sUser, sPassword = sPassword, aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 1) ],
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ],
+                #              sUser = sUser, sPassword = sPassword, aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 1) ],
+                # With stdout/stderr.
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\windows\\system32' ],
+                #              sUser = sUser, sPassword = sPassword,
+                #              aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 0) ],
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-file' ],
+                #              sUser = sUser, sPassword = sPassword,
+                #              aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 1) ],
+                # [ tdTestExec(sCmd = sImage, aArgs = [ sImage, '/C', 'dir', 'c:\\nonexisting-dir\\' ],
+                #              sUser = sUser, sPassword = sPassword,
+                #              aFlags = [ vboxcon.ProcessCreateFlag_WaitForStdOut, vboxcon.ProcessCreateFlag_WaitForStdErr ]),
+                #   tdTestResultExec(fRc = True, iExitCode = 1) ]
+                ## @todo Test stdin!
+            ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlExecErrorLevel: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            fRc = self.gctrlExecDoTest(i, curTest, curRes, curGuestSession);
+            curTest.closeSession();
+            if fRc is False:
+                break;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlExecTimeout(self, oSession, oTxsSession, oTestVm):
+        """
+        Tests handling of timeouts of started guest processes.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+        sDomain = "";
+
+        if oTestVm.isWindows():
+            # Outputting stuff.
+            sImage = "C:\\windows\\system32\\cmd.exe";
+        else:
+            reporter.error('Implement me!'); ## @todo Implement non-Windows bits.
+            return (False, oTxsSession);
+
+        fRc = True;
+        try:
+            oGuest = oSession.o.console.guest;
+            oGuestSession = oGuest.createSession(sUser, sPassword, sDomain, "testGuestCtrlExecTimeout");
+            oGuestSession.waitForArray([ vboxcon.GuestSessionWaitForFlag_Start ], 30 * 1000);
+            # Create a process which never terminates and should timeout when
+            # waiting for termination.
+            try:
+                curProc = oGuestSession.processCreate(sImage, [sImage,] if self.oTstDrv.fpApiVer >= 5.0 else [], \
+                                                      [], [], 30 * 1000);
+                reporter.log('Waiting for process 1 being started ...');
+                waitRes = curProc.waitForArray([ vboxcon.ProcessWaitForFlag_Start ], 30 * 1000);
+                if waitRes != vboxcon.ProcessWaitResult_Start:
+                    reporter.error('Waiting for process 1 to start failed, got status %ld');
+                    fRc = False;
+                if fRc:
+                    reporter.log('Waiting for process 1 to time out within 1ms ...');
+                    waitRes = curProc.waitForArray([ vboxcon.ProcessWaitForFlag_Terminate ], 1);
+                    if waitRes != vboxcon.ProcessWaitResult_Timeout:
+                        reporter.error('Waiting for process 1 did not time out when it should (1)');
+                        fRc = False;
+                    else:
+                        reporter.log('Waiting for process 1 timed out (1), good');
+                if fRc:
+                    reporter.log('Waiting for process 1 to time out within 5000ms ...');
+                    waitRes = curProc.waitForArray([ vboxcon.ProcessWaitForFlag_Terminate ], 5000);
+                    if waitRes != vboxcon.ProcessWaitResult_Timeout:
+                        reporter.error('Waiting for process 1 did not time out when it should, got wait result %ld' % (waitRes,));
+                        fRc = False;
+                    else:
+                        reporter.log('Waiting for process 1 timed out (5000), good');
+                ## @todo Add curProc.terminate() as soon as it's implemented.
+            except:
+                reporter.errorXcpt('Exception for process 1:');
+                fRc = False;
+            # Create a lengthly running guest process which will be killed by VBoxService on the
+            # guest because it ran out of execution time (5 seconds).
+            if fRc:
+                try:
+                    curProc = oGuestSession.processCreate(sImage, [sImage,] if self.oTstDrv.fpApiVer >= 5.0 else [], \
+                                                          [], [], 5 * 1000);
+                    reporter.log('Waiting for process 2 being started ...');
+                    waitRes = curProc.waitForArray([ vboxcon.ProcessWaitForFlag_Start ], 30 * 1000);
+                    if waitRes != vboxcon.ProcessWaitResult_Start:
+                        reporter.error('Waiting for process 1 to start failed, got status %ld');
+                        fRc = False;
+                    if fRc:
+                        reporter.log('Waiting for process 2 to get killed because it ran out of execution time ...');
+                        waitRes = curProc.waitForArray([ vboxcon.ProcessWaitForFlag_Terminate ], 30 * 1000);
+                        if waitRes != vboxcon.ProcessWaitResult_Timeout:
+                            reporter.error('Waiting for process 2 did not time out when it should, got wait result %ld' \
+                                           % (waitRes,));
+                            fRc = False;
+                    if fRc:
+                        reporter.log('Waiting for process 2 indicated an error, good');
+                        if curProc.status != vboxcon.ProcessStatus_TimedOutKilled:
+                            reporter.error('Status of process 2 wrong; excepted %ld, got %ld' \
+                                           % (vboxcon.ProcessStatus_TimedOutKilled, curProc.status));
+                            fRc = False;
+                        else:
+                            reporter.log('Status of process 2 correct (%ld)' % (vboxcon.ProcessStatus_TimedOutKilled,));
+                    ## @todo Add curProc.terminate() as soon as it's implemented.
+                except:
+                    reporter.errorXcpt('Exception for process 2:');
+                    fRc = False;
+            oGuestSession.close();
+        except:
+            reporter.errorXcpt('Could not handle session:');
+            fRc = False;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlDirCreate(self, oSession, oTxsSession, oTestVm):
+        """
+        Tests creation of guest directories.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        if oTestVm.isWindows():
+            sScratch  = "C:\\Temp\\vboxtest\\testGuestCtrlDirCreate\\";
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Invalid stuff.
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = '' ),
+                  tdTestResult(fRc = False) ],
+                # More unusual stuff.
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = '..\\..\\' ),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = '../../' ),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = 'z:\\' ),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = '\\\\uncrulez\\foo' ),
+                  tdTestResult(fRc = False) ],
+                # Creating directories.
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = sScratch ),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = os.path.join(sScratch, 'foo\\bar\\baz'),
+                                  aFlags = [ vboxcon.DirectoryCreateFlag_Parents ] ),
+                  tdTestResult(fRc = True) ],
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword, sDirectory = os.path.join(sScratch, 'foo\\bar\\baz'),
+                                  aFlags = [ vboxcon.DirectoryCreateFlag_Parents ] ),
+                  tdTestResult(fRc = True) ],
+                # Long (+ random) stuff.
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword,
+                                  sDirectory = os.path.join(sScratch,
+                                  "".join(random.choice(string.ascii_lowercase) for i in range(32))) ),
+                  tdTestResult(fRc = True) ],
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword,
+                                  sDirectory = os.path.join(sScratch,
+                                  "".join(random.choice(string.ascii_lowercase) for i in range(128))) ),
+                  tdTestResult(fRc = True) ],
+                # Following two should fail on Windows (paths too long). Both should timeout.
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword,
+                                  sDirectory = os.path.join(sScratch,
+                                  "".join(random.choice(string.ascii_lowercase) for i in range(255))) ),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreate(sUser = sUser, sPassword = sPassword,
+                                  sDirectory = os.path.join(sScratch,
+                                  "".join(random.choice(string.ascii_lowercase) for i in range(1024))) ),
+                  tdTestResult(fRc = False) ]
+            ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, sDirectory="%s" ...' % (i, curTest.sDirectory));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlDirCreate: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            fRc = self.gctrlCreateDir(curTest, curRes, curGuestSession);
+            curTest.closeSession();
+            if fRc is False:
+                reporter.error('Test #%d failed' % (i,));
+                fRc = False;
+                break;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlDirCreateTemp(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests creation of temporary directories.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        # if oTestVm.isWindows():
+        #     sScratch = "C:\\Temp\\vboxtest\\testGuestCtrlDirCreateTemp\\";
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Invalid stuff.
+                [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sDirectory = ''),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sDirectory = 'C:\\Windows',
+                                      fMode = 1234),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = '',
+                                      sDirectory = 'C:\\Windows', fMode = 1234),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'xXx',
+                                      sDirectory = 'C:\\Windows', fMode = 0700),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'xxx',
+                                      sDirectory = 'C:\\Windows', fMode = 0700),
+                  tdTestResult(fRc = False) ],
+                # More unusual stuff.
+                [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'foo',
+                                      sDirectory = 'z:\\'),
+                  tdTestResult(fRc = False) ],
+                [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'foo',
+                                      sDirectory = '\\\\uncrulez\\foo'),
+                  tdTestResult(fRc = False) ],
+                # Non-existing stuff.
+                [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'bar',
+                                      sDirectory = 'c:\\Apps\\nonexisting\\foo'),
+                  tdTestResult(fRc = False) ],
+                # FIXME: Failing test. Non Windows path
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'bar',
+                #                       sDirectory = '/tmp/non/existing'),
+                #   tdTestResult(fRc = False) ]
+            ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+            # FIXME: Failing tests.
+            # aaTests.extend([
+                # Non-secure variants.
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'X',
+                #                       sDirectory = sScratch),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'X',
+                #                       sDirectory = sScratch),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch,
+                #                       fMode = 0700),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                     sDirectory = sScratch,
+                #                     fMode = 0700),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch,
+                #                       fMode = 0755),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch,
+                #                       fMode = 0755),
+                #   tdTestResult(fRc = True) ],
+                # Secure variants.
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch, fSecure = True),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch, fSecure = True),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch, fSecure = True),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch, fSecure = True),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch,
+                #                       fSecure = True, fMode = 0700),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch,
+                #                       fSecure = True, fMode = 0700),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch,
+                #                       fSecure = True, fMode = 0755),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = 'XXX',
+                #                       sDirectory = sScratch,
+                #                       fSecure = True, fMode = 0755),
+                #   tdTestResult(fRc = True) ],
+                # Random stuff.
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword,
+                #                       sTemplate = "XXX-".join(random.choice(string.ascii_lowercase) for i in range(32)),
+                #                       sDirectory = sScratch,
+                #                       fSecure = True, fMode = 0755),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = "".join('X' for i in range(32)),
+                #                       sDirectory = sScratch,
+                #                       fSecure = True, fMode = 0755),
+                #   tdTestResult(fRc = True) ],
+                # [ tdTestDirCreateTemp(sUser = sUser, sPassword = sPassword, sTemplate = "".join('X' for i in range(128)),
+                #                       sDirectory = sScratch,
+                #                       fSecure = True, fMode = 0755),
+                #   tdTestResult(fRc = True) ]
+            # ]);
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, sTemplate="%s", fMode=%#o, path="%s", secure="%s" ...' %
+                         (i, curTest.sTemplate, curTest.fMode, curTest.sDirectory, curTest.fSecure));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlDirCreateTemp: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            sDirTemp = "";
+            try:
+                sDirTemp = curGuestSession.directoryCreateTemp(curTest.sTemplate, curTest.fMode,
+                                                               curTest.sDirectory, curTest.fSecure);
+            except:
+                if curRes.fRc is True:
+                    reporter.errorXcpt('Creating temp directory "%s" failed:' % (curTest.sDirectory,));
+                    fRc = False;
+                    break;
+                else:
+                    reporter.logXcpt('Creating temp directory "%s" failed expectedly, skipping:' % (curTest.sDirectory,));
+            curTest.closeSession();
+            if sDirTemp  != "":
+                reporter.log2('Temporary directory is: %s' % (sDirTemp,));
+                if self.oTstDrv.fpApiVer >= 5.0:
+                    fExists = curGuestSession.directoryExists(sDirTemp, False);
+                else:
+                    fExists = curGuestSession.directoryExists(sDirTemp);
+                if fExists is False:
+                    reporter.error('Test #%d failed: Temporary directory "%s" does not exists' % (i, sDirTemp));
+                    fRc = False;
+                    break;
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlDirRead(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests opening and reading (enumerating) guest directories.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Invalid stuff.
+                [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = ''),
+                  tdTestResultDirRead(fRc = False) ],
+                [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'C:\\Windows', aFlags = [ 1234 ]),
+                  tdTestResultDirRead(fRc = False) ],
+                [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'C:\\Windows', sFilter = '*.foo'),
+                  tdTestResultDirRead(fRc = False) ],
+                # More unusual stuff.
+                [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'z:\\'),
+                  tdTestResultDirRead(fRc = False) ],
+                [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = '\\\\uncrulez\\foo'),
+                  tdTestResultDirRead(fRc = False) ],
+                # Non-existing stuff.
+                [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'c:\\Apps\\nonexisting'),
+                  tdTestResultDirRead(fRc = False) ],
+                [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'c:\\Apps\\testDirRead'),
+                  tdTestResultDirRead(fRc = False) ]
+            ]);
+
+            if oTestVm.sVmName == 'tst-xppro':
+                aaTests.extend([
+                    # Reading directories.
+                    [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = '../../Windows/Fonts'),
+                      tdTestResultDirRead(fRc = True, numFiles = 191) ],
+                    [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'c:\\Windows\\Help'),
+                      tdTestResultDirRead(fRc = True, numDirs = 13, numFiles = 569) ],
+                    [ tdTestDirRead(sUser = sUser, sPassword = sPassword, sDirectory = 'c:\\Windows\\Web'),
+                      tdTestResultDirRead(fRc = True, numDirs = 3, numFiles = 55) ]
+                ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, dir="%s" ...' % (i, curTest.sDirectory));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlDirRead: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            (fRc2, cDirs, cFiles) = self.gctrlReadDir(curTest, curRes, curGuestSession);
+            curTest.closeSession();
+            reporter.log2('Test #%d: Returned %ld directories, %ld files total' % (i, cDirs, cFiles));
+            if fRc2 is curRes.fRc:
+                if fRc2 is True:
+                    if curRes.numFiles != cFiles:
+                        reporter.error('Test #%d failed: Got %ld files, expected %ld' % (i, cFiles, curRes.numFiles));
+                        fRc = False;
+                        break;
+                    if curRes.numDirs != cDirs:
+                        reporter.error('Test #%d failed: Got %ld directories, expected %ld' % (i, cDirs, curRes.numDirs));
+                        fRc = False;
+                        break;
+            else:
+                reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc2, curRes.fRc));
+                fRc = False;
+                break;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlFileRemove(self, oSession, oTxsSession, oTestVm):
+        """
+        Tests removing guest files.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Invalid stuff.
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = ''),               tdTestResult(fRc = False) ],
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows'),    tdTestResult(fRc = False) ],
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows'),    tdTestResult(fRc = False) ],
+                # More unusual stuff.
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'z:\\'),           tdTestResult(fRc = False) ],
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\foo'),
+                                                                                                   tdTestResult(fRc = False) ],
+                # Non-existing stuff.
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Apps\\nonexisting'),
+                                                                                                   tdTestResult(fRc = False) ],
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Apps\\testFileRemove'),
+                                                                                                   tdTestResult(fRc = False) ],
+                # Try to delete system files.
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\pagefile.sys'),
+                                                                                                   tdTestResult(fRc = False) ],
+                [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\kernel32.sys'),
+                                                                                                   tdTestResult(fRc = False) ]
+            ]);
+
+            if oTestVm.sVmName == 'tst-xppro':
+                aaTests.extend([
+                    # Try delete some unimportant media stuff.
+                    [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\Media\\chimes.wav'),
+                                                                                                   tdTestResult(fRc = True) ],
+                    # Second attempt should fail.
+                    [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\Media\\chimes.wav'),
+                                                                                                   tdTestResult(fRc = False) ],
+                    [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\Media\\chord.wav'),
+                                                                                                   tdTestResult(fRc = True) ],
+                    [ tdTestFileRemove(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\Media\\chord.wav'),
+                                                                                                   tdTestResult(fRc = False) ]
+                ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, file="%s" ...' % (i, curTest.sFile));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlFileRemove: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            try:
+                if self.oTstDrv.fpApiVer >= 5.0:
+                    curGuestSession.fsObjRemove(curTest.sFile);
+                else:
+                    curGuestSession.fileRemove(curTest.sFile);
+            except:
+                if curRes.fRc is True:
+                    reporter.errorXcpt('Removing file "%s" failed:' % (curTest.sFile,));
+                    fRc = False;
+                    break;
+                else:
+                    reporter.logXcpt('Removing file "%s" failed expectedly, skipping:' % (curTest.sFile,));
+            curTest.closeSession();
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlFileStat(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests querying file information through stat.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Invalid stuff.
+                [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = ''),
+                  tdTestResultFileStat(fRc = False) ],
+                [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows'),
+                  tdTestResultFileStat(fRc = False) ],
+                [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows'),
+                  tdTestResultFileStat(fRc = False) ],
+                # More unusual stuff.
+                [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = 'z:\\'),
+                  tdTestResultFileStat(fRc = False) ],
+                [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\foo'),
+                  tdTestResultFileStat(fRc = False) ],
+                # Non-existing stuff.
+                [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Apps\\nonexisting'),
+                  tdTestResultFileStat(fRc = False) ],
+                [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Apps\\testDirRead'),
+                  tdTestResultFileStat(fRc = False) ]
+            ]);
+
+            if oTestVm.sVmName == 'tst-xppro':
+                aaTests.extend([
+                    # Directories; should fail.
+                    [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = '../../Windows/Fonts'),
+                      tdTestResultFileStat(fRc = False) ],
+                    [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\Help'),
+                      tdTestResultFileStat(fRc = False) ],
+                    [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\system32'),
+                      tdTestResultFileStat(fRc = False) ],
+                    # Regular files.
+                    [ tdTestFileStat(sUser = sUser, sPassword = sPassword, sFile = 'c:\\Windows\\system32\\kernel32.dll'),
+                      tdTestResultFileStat(fRc = False, cbSize = 926720, eFileType = vboxcon.FsObjType_File) ]
+                ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, sFile="%s" ...' % (i, curTest.sFile));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlFileStat: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            fileObjInfo = None;
+            try:
+                if self.oTstDrv.fpApiVer >= 5.0:
+                    fileObjInfo = curGuestSession.fsObjQueryInfo(curTest.sFile, True);
+                else:
+                    fileObjInfo = curGuestSession.fileQueryInfo(curTest.sFile);
+            except:
+                if curRes.fRc is True:
+                    reporter.errorXcpt('Querying file information for "%s" failed:' % (curTest.sFile,));
+                    fRc = False;
+                    break;
+                else:
+                    reporter.logXcpt('Querying file information for "%s" failed expectedly, skipping:' % (curTest.sFile,));
+            curTest.closeSession();
+            if fileObjInfo is not None:
+                eFileType = fileObjInfo.type;
+                if curRes.eFileType != eFileType:
+                    reporter.error('Test #%d failed: Got file type %ld, expected %ld' % (i, eFileType, curRes.eFileType));
+                    fRc = False;
+                    break;
+                cbFile = long(fileObjInfo.objectSize);
+                if curRes.cbSize != cbFile:
+                    reporter.error('Test #%d failed: Got %ld bytes size, expected %ld bytes' % (i, cbFile, curRes.cbSize));
+                    fRc = False;
+                    break;
+                ## @todo Add more checks later.
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlFileRead(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests reading from guest files.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        if oTxsSession.syncMkDir('${SCRATCH}/testGuestCtrlFileRead') is False:
+            reporter.error('Could not create scratch directory on guest');
+            return (False, oTxsSession);
+
+        aaTests = [];
+        aaTests.extend([
+            # Invalid stuff.
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, cbToReadWrite = 0),
+              tdTestResultFileReadWrite(fRc = False) ],
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = ''),
+              tdTestResultFileReadWrite(fRc = False) ],
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'non-existing.file'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            # Wrong open mode.
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'non-existing.file', \
+                                  sOpenMode = 'rt', sDisposition = 'oe'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\non-existing.file', \
+                                  sOpenMode = 'tr', sDisposition = 'oe'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '../../non-existing.file', \
+                                  sOpenMode = 'wr', sDisposition = 'oe'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            # Wrong disposition.
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'non-existing.file', \
+                                  sOpenMode = 'r', sDisposition = 'e'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\non-existing.file', \
+                                  sOpenMode = 'r', sDisposition = 'o'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '../../non-existing.file', \
+                                  sOpenMode = 'r', sDisposition = 'c'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            # Opening non-existing file when it should exist.
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'non-existing.file', \
+                                  sOpenMode = 'r', sDisposition = 'oe'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '\\\\uncrulez\\non-existing.file', \
+                                  sOpenMode = 'r', sDisposition = 'oe'),
+              tdTestResultFileReadWrite(fRc = False) ],
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = '../../non-existing.file', \
+                                  sOpenMode = 'r', sDisposition = 'oe'),
+              tdTestResultFileReadWrite(fRc = False) ]
+        ]);
+
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Create a file which must not exist (but it hopefully does).
+                [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\calc.exe', \
+                                      sOpenMode = 'w', sDisposition = 'ce'),
+                  tdTestResultFileReadWrite(fRc = False) ],
+                # Open a file which must exist.
+                [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\kernel32.dll', \
+                                      sOpenMode = 'r', sDisposition = 'oe'),
+                  tdTestResultFileReadWrite(fRc = True) ],
+                # Try truncating a file which already is opened with a different sharing mode (and thus should fail).
+                [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\kernel32.dll', \
+                                      sOpenMode = 'w', sDisposition = 'ot'),
+                  tdTestResultFileReadWrite(fRc = False) ]
+            ]);
+
+        if oTestVm.sKind == "WindowsXP":
+            aaTests.extend([
+                # Reading from beginning.
+                [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\eula.txt', \
+                                      sOpenMode = 'r', sDisposition = 'oe', cbToReadWrite = 33),
+                  tdTestResultFileReadWrite(fRc = True, aBuf = 'Microsoft Windows XP Professional', \
+                                            cbProcessed = 33, cbOffset = 33) ],
+                # Reading from offset.
+                [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = 'C:\\Windows\\System32\\eula.txt', \
+                                      sOpenMode = 'r', sDisposition = 'oe', cbOffset = 17782, cbToReadWrite = 26),
+                  tdTestResultFileReadWrite(fRc = True, aBuf = 'LINKS TO THIRD PARTY SITES', \
+                                            cbProcessed = 26, cbOffset = 17782 + 26) ]
+            ]);
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestFileReadWrite, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, sFile="%s", cbToReadWrite=%d, sOpenMode="%s", sDisposition="%s", cbOffset=%ld ...' % \
+                         (i, curTest.sFile, curTest.cbToReadWrite, curTest.sOpenMode, curTest.sDisposition, curTest.cbOffset));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlFileRead: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            try:
+                if curTest.cbOffset > 0: # The offset parameter is gone.
+                    if self.oTstDrv.fpApiVer >= 5.0:
+                        curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.getAccessMode(), curTest.getOpenAction(),
+                                                             curTest.getSharingMode(), curTest.lCreationMode, []);
+                        curFile.seek(curTest.cbOffset, vboxcon.FileSeekOrigin_Begin);
+                    else:
+                        curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \
+                                                             curTest.sSharingMode, curTest.lCreationMode, curTest.cbOffset);
+                    curOffset = long(curFile.offset);
+                    resOffset = long(curTest.cbOffset);
+                    if curOffset != resOffset:
+                        reporter.error('Test #%d failed: Initial offset on open does not match: Got %ld, expected %ld' \
+                                       % (i, curOffset, resOffset));
+                        fRc = False;
+                else:
+                    if self.oTstDrv.fpApiVer >= 5.0:
+                        curFile = curGuestSession.fileOpen(curTest.sFile, curTest.getAccessMode(), curTest.getOpenAction(),
+                                                           curTest.lCreationMode);
+                    else:
+                        curFile = curGuestSession.fileOpen(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \
+                                                           curTest.lCreationMode);
+                if  fRc \
+                and curTest.cbToReadWrite > 0:
+                    ## @todo Split this up in 64K reads. Later.
+                    ## @todo Test timeouts.
+                    aBufRead = curFile.read(curTest.cbToReadWrite, 30 * 1000);
+                    if  curRes.cbProcessed > 0 \
+                    and curRes.cbProcessed is not len(aBufRead):
+                        reporter.error('Test #%d failed: Read buffer length does not match: Got %ld, expected %ld' \
+                                       % (i, len(aBufRead), curRes.cbProcessed));
+                        fRc = False;
+                    if fRc:
+                        if  curRes.aBuf is not None \
+                        and bytes(curRes.aBuf) != bytes(aBufRead):
+                            reporter.error('Test #%d failed: Got buffer\n%s (%ld bytes), expected\n%s (%ld bytes)' \
+                                           % (i, map(hex, map(ord, aBufRead)), len(aBufRead), \
+                                              map(hex, map(ord, curRes.aBuf)), len(curRes.aBuf)));
+                            reporter.error('Test #%d failed: Got buffer\n%s, expected\n%s' \
+                                           % (i, aBufRead, curRes.aBuf));
+                            fRc = False;
+                # Test final offset.
+                curOffset = long(curFile.offset);
+                resOffset = long(curRes.cbOffset);
+                if curOffset != resOffset:
+                    reporter.error('Test #%d failed: Final offset does not match: Got %ld, expected %ld' \
+                                   % (i, curOffset, resOffset));
+                    fRc = False;
+                curFile.close();
+            except:
+                reporter.logXcpt('Opening "%s" failed:' % (curTest.sFile,));
+                fRc = False;
+
+            curTest.closeSession();
+
+            if fRc != curRes.fRc:
+                reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc, curRes.fRc));
+                fRc = False;
+                break;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlFileWrite(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests writing to guest files.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        if oTestVm.isWindows():
+            sScratch = "C:\\Temp\\vboxtest\\testGuestCtrlFileWrite\\";
+
+        if oTxsSession.syncMkDir('${SCRATCH}/testGuestCtrlFileWrite') is False:
+            reporter.error('Could not create scratch directory on guest');
+            return (False, oTxsSession);
+
+        aaTests = [];
+
+        cScratchBuf = 512;
+        aScratchBuf = array('b', [random.randint(-128, 127) for i in range(cScratchBuf)]);
+        aaTests.extend([
+            # Write to a non-existing file.
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = sScratch + 'testGuestCtrlFileWrite.txt', \
+                                  sOpenMode = 'w+', sDisposition = 'ce', cbToReadWrite = cScratchBuf,
+                                  aBuf = aScratchBuf),
+              tdTestResultFileReadWrite(fRc = True, aBuf = aScratchBuf, \
+                                        cbProcessed = cScratchBuf, cbOffset = cScratchBuf) ]
+        ]);
+
+        aScratchBuf2 = array('b', [random.randint(-128, 127) for i in range(cScratchBuf)]);
+        aaTests.extend([
+            # Append the same amount of data to the just created file.
+            [ tdTestFileReadWrite(sUser = sUser, sPassword = sPassword, sFile = sScratch + 'testGuestCtrlFileWrite.txt', \
+                                  sOpenMode = 'w+', sDisposition = 'oa', cbToReadWrite = cScratchBuf,
+                                  cbOffset = cScratchBuf, aBuf = aScratchBuf2),
+              tdTestResultFileReadWrite(fRc = True, aBuf = aScratchBuf2, \
+                                        cbProcessed = cScratchBuf, cbOffset = cScratchBuf * 2) ],
+        ]);
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestFileReadWrite, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, sFile="%s", cbToReadWrite=%d, sOpenMode="%s", sDisposition="%s", cbOffset=%ld ...' % \
+                         (i, curTest.sFile, curTest.cbToReadWrite, curTest.sOpenMode, curTest.sDisposition, curTest.cbOffset));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlFileWrite: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            try:
+                if curTest.cbOffset > 0: # The offset parameter is gone.
+                    if self.oTstDrv.fpApiVer >= 5.0:
+                        curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.getAccessMode(), curTest.getOpenAction(),
+                                                             curTest.getSharingMode(), []);
+                        curFile.seek(curTest.cbOffset, vboxcon.FileSeekOrigin_Begin);
+                    else:
+                        curFile = curGuestSession.fileOpenEx(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \
+                                                             curTest.sSharingMode, curTest.lCreationMode, curTest.cbOffset);
+                    curOffset = long(curFile.offset);
+                    resOffset = long(curTest.cbOffset);
+                    if curOffset != resOffset:
+                        reporter.error('Test #%d failed: Initial offset on open does not match: Got %ld, expected %ld' \
+                                       % (i, curOffset, resOffset));
+                        fRc = False;
+                else:
+                    if self.oTstDrv.fpApiVer >= 5.0:
+                        curFile = curGuestSession.fileOpen(curTest.sFile, curTest.getAccessMode(), curTest.getOpenAction(),
+                                                           curTest.lCreationMode);
+                    else:
+                        curFile = curGuestSession.fileOpen(curTest.sFile, curTest.sOpenMode, curTest.sDisposition, \
+                                                           curTest.lCreationMode);
+                if  fRc \
+                and curTest.cbToReadWrite > 0:
+                    ## @todo Split this up in 64K writes. Later.
+                    ## @todo Test timeouts.
+                    cBytesWritten = curFile.write(curTest.aBuf, 30 * 1000);
+                    if  curRes.cbProcessed > 0 \
+                    and curRes.cbProcessed != cBytesWritten:
+                        reporter.error('Test #%d failed: Written buffer length does not match: Got %ld, expected %ld' \
+                                       % (i, cBytesWritten, curRes.cbProcessed));
+                        fRc = False;
+                    if fRc:
+                        # Verify written content by seeking back to the initial offset and
+                        # re-read & compare the written data.
+                        try:
+                            if self.oTstDrv.fpApiVer >= 5.0:
+                                curFile.seek(-(curTest.cbToReadWrite), vboxcon.FileSeekOrigin_Current);
+                            else:
+                                curFile.seek(-(curTest.cbToReadWrite), vboxcon.FileSeekType_Current);
+                        except:
+                            reporter.logXcpt('Seeking back to initial write position failed:');
+                            fRc = False;
+                        if  fRc \
+                        and long(curFile.offset) != curTest.cbOffset:
+                            reporter.error('Test #%d failed: Initial write position does not match current position, \
+                                           got %ld, expected %ld' \
+                                           % (i, long(curFile.offset), curTest.cbOffset));
+                            fRc = False;
+                    if fRc:
+                        aBufRead = curFile.read(curTest.cbToReadWrite, 30 * 1000);
+                        if len(aBufRead) != curTest.cbToReadWrite:
+                            reporter.error('Test #%d failed: Got buffer length %ld, expected %ld' \
+                                           % (i, len(aBufRead), curTest.cbToReadWrite));
+                            fRc = False;
+                        if  fRc \
+                        and curRes.aBuf is not None \
+                        and buffer(curRes.aBuf) != aBufRead:
+                            reporter.error('Test #%d failed: Got buffer\n%s, expected\n%s' \
+                                           % (i, aBufRead, curRes.aBuf));
+                            fRc = False;
+                # Test final offset.
+                curOffset = long(curFile.offset);
+                resOffset = long(curRes.cbOffset);
+                if curOffset != resOffset:
+                    reporter.error('Test #%d failed: Final offset does not match: Got %ld, expected %ld' \
+                                   % (i, curOffset, resOffset));
+                    fRc = False;
+                curFile.close();
+            except:
+                reporter.logXcpt('Opening "%s" failed:' % (curTest.sFile,));
+                fRc = False;
+
+            curTest.closeSession();
+
+            if fRc != curRes.fRc:
+                reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc, curRes.fRc));
+                fRc = False;
+                break;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlCopyTo(self, oSession, oTxsSession, oTestVm):
+        """
+        Tests copying files from host to the guest.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        if oTestVm.isWindows():
+            sScratch = "C:\\Temp\\vboxtest\\testGuestCtrlCopyTo\\";
+
+        if oTxsSession.syncMkDir('${SCRATCH}/testGuestCtrlCopyTo') is False:
+            reporter.error('Could not create scratch directory on guest');
+            return (False, oTxsSession);
+
+        # Some stupid trickery to guess the location of the iso.
+        sVBoxValidationKitISO = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxValidationKit.iso'));
+        if not os.path.isfile(sVBoxValidationKitISO):
+            sVBoxValidationKitISO = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxTestSuite.iso'));
+        if not os.path.isfile(sVBoxValidationKitISO):
+            sCur = os.getcwd();
+            for i in range(0, 10):
+                sVBoxValidationKitISO = os.path.join(sCur, 'validationkit/VBoxValidationKit.iso');
+                if os.path.isfile(sVBoxValidationKitISO):
+                    break;
+                sVBoxValidationKitISO = os.path.join(sCur, 'testsuite/VBoxTestSuite.iso');
+                if os.path.isfile(sVBoxValidationKitISO):
+                    break;
+                sCur = os.path.abspath(os.path.join(sCur, '..'));
+                if i is None: pass; # shut up pychecker/pylint.
+        if os.path.isfile(sVBoxValidationKitISO):
+            reporter.log('Validation Kit .ISO found at: %s' % (sVBoxValidationKitISO,));
+        else:
+            reporter.log('Warning: Validation Kit .ISO not found -- some tests might fail');
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Destination missing.
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = ''),                   tdTestResult(fRc = False) ],
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows',
+                               aFlags = [ 1234 ] ),                                                tdTestResult(fRc = False) ],
+                # Source missing.
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sDst = ''),                   tdTestResult(fRc = False) ],
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sDst = 'C:\\Windows',
+                               aFlags = [ 1234 ] ),                                                tdTestResult(fRc = False) ],
+                # Nothing to copy (source and/or destination is empty).
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'z:\\'),               tdTestResult(fRc = False) ],
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = '\\\\uncrulez\\foo'),
+                                                                                                   tdTestResult(fRc = False) ],
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'non-exist',
+                               sDst = os.path.join(sScratch, 'non-exist.dll')),                    tdTestResult(fRc = False) ],
+                # Copying single files.
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
+                               sDst = 'C:\\non-exist\\'),                                          tdTestResult(fRc = False) ],
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
+                               sDst = 'C:\\non\\exist\\'),                                         tdTestResult(fRc = False) ],
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
+                               sDst = 'C:\\non\\exist\\renamedfile.dll'),                          tdTestResult(fRc = False) ],
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
+                               sDst = os.path.join(sScratch, 'HostGuestAdditions.iso')),           tdTestResult(fRc = True) ],
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
+                               sDst = os.path.join(sScratch, 'HostGuestAdditions.iso')),           tdTestResult(fRc = True) ],
+                # Destination is a directory, should fail.
+                [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO,
+                               sDst = sScratch),                                                   tdTestResult(fRc = False) ]
+                ## @todo Add testing the CopyTo flags here!
+            ]);
+
+            if self.oTstDrv.sHost == 'win':
+                ## @todo Check for Windows (7) host.
+                aaTests.extend([
+                    # Copying directories with contain files we don't have read access to.
+                    [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\security',
+                                   sDst = sScratch),                                               tdTestResult(fRc = False) ],
+                    # Copying directories with regular files.
+                    [ tdTestCopyTo(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Help',
+                                   sDst = sScratch),                                               tdTestResult(fRc = True) ]
+                ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, sSrc="%s", sDst="%s", aFlags="%s" ...' % \
+                         (i, curTest.sSrc, curTest.sDst, curTest.aFlags));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlCopyTo: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            fRc2 = self.gctrlCopyTo(curTest, curGuestSession);
+            curTest.closeSession();
+            if fRc2 is curRes.fRc:
+                ## @todo Verify the copied results (size, checksum?).
+                pass;
+            else:
+                reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc2, curRes.fRc));
+                fRc = False;
+                break;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlCopyFrom(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests copying files from guest to the host.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        sScratch = os.path.join(self.oTstDrv.sScratchPath, "testGctrlCopyFrom");
+        try:
+            os.makedirs(sScratch);
+        except OSError as e:
+            if e.errno != errno.EEXIST:
+                reporter.error('Failed: Unable to create scratch directory \"%s\"' % (sScratch,));
+                return (False, oTxsSession);
+        reporter.log('Scratch path is: %s' % (sScratch,));
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Destination missing.
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = ''),
+                  tdTestResult(fRc = False) ],
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows',
+                                 aFlags = [ 1234 ] ),
+                  tdTestResult(fRc = False) ],
+                # Source missing.
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sDst = ''),
+                  tdTestResult(fRc = False) ],
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sDst = 'C:\\Windows',
+                               aFlags = [ 1234 ] ),
+                  tdTestResult(fRc = False) ],
+                # Nothing to copy (sDst is empty / unreachable).
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'z:\\'),
+                  tdTestResult(fRc = False) ],
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = '\\\\uncrulez\\foo'),
+
+                  tdTestResult(fRc = False) ],
+                [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'non-exist',
+                               sDst = os.path.join(sScratch, 'non-exist.dll')),
+                  tdTestResult(fRc = False) ]
+                ## @todo Add testing the CopyFrom aFlags here!
+            ]);
+
+            if self.oTstDrv.sHost == 'win':
+                aaTests.extend([
+                    # FIXME: Failing test.
+                    # Copying single files.
+                    # [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
+                    #                sDst = 'C:\\non-exist\\'), tdTestResult(fRc = False) ],
+                    # [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
+                    #                sDst = 'C:\\non\\exist\\'), tdTestResult(fRc = False) ],
+                    # [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
+                    #                sDst = 'C:\\non\\exist\\renamedfile.dll'), tdTestResult(fRc = False) ],
+                    # [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
+                    #                sDst = os.path.join(sScratch, 'renamedfile.dll')), tdTestResult(fRc = True) ],
+                    # [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
+                    #                sDst = os.path.join(sScratch, 'renamedfile.dll')), tdTestResult(fRc = True) ],
+                    # Destination is a directory, should fail.
+                    [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\system32\\ole32.dll',
+                                   sDst = sScratch),                                                 tdTestResult(fRc = False) ],
+                    # Copying directories.
+                    [ tdTestCopyFrom(sUser = sUser, sPassword = sPassword, sSrc = 'C:\\Windows\\Web',
+                                   sDst = sScratch),                                                 tdTestResult(fRc = True) ]
+                    ## @todo Add testing the CopyFrom aFlags here!
+                ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, sSrc="%s", sDst="%s", aFlags="%s" ...' % \
+                         (i, curTest.sSrc, curTest.sDst, curTest.aFlags));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, curGuestSession = curTest.createSession('testGuestCtrlCopyFrom: Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            fRc2 = self.gctrlCopyFrom(curTest, curRes, curGuestSession);
+            curTest.closeSession();
+            if fRc2 is curRes.fRc:
+                ## @todo Verify the copied results (size, checksum?).
+                pass;
+            else:
+                reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc2, curRes.fRc));
+                fRc = False;
+                break;
+
+        return (fRc, oTxsSession);
+
+    def testGuestCtrlUpdateAdditions(self, oSession, oTxsSession, oTestVm): # pylint: disable=R0914
+        """
+        Tests updating the Guest Additions inside the guest.
+        """
+
+        if oTestVm.isWindows():
+            sUser = "Administrator";
+        else:
+            sUser = "vbox";
+        sPassword = "password";
+
+        # Some stupid trickery to guess the location of the iso.
+        sVBoxValidationKitISO = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxValidationKit.iso'));
+        if not os.path.isfile(sVBoxValidationKitISO):
+            sVBoxValidationKitISO = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxTestSuite.iso'));
+        if not os.path.isfile(sVBoxValidationKitISO):
+            sCur = os.getcwd();
+            for i in range(0, 10):
+                sVBoxValidationKitISO = os.path.join(sCur, 'validationkit/VBoxValidationKit.iso');
+                if os.path.isfile(sVBoxValidationKitISO):
+                    break;
+                sVBoxValidationKitISO = os.path.join(sCur, 'testsuite/VBoxTestSuite.iso');
+                if os.path.isfile(sVBoxValidationKitISO):
+                    break;
+                sCur = os.path.abspath(os.path.join(sCur, '..'));
+                if i is None: pass; # shut up pychecker/pylint.
+        if os.path.isfile(sVBoxValidationKitISO):
+            reporter.log('Validation Kit .ISO found at: %s' % (sVBoxValidationKitISO,));
+        else:
+            reporter.log('Warning: Validation Kit .ISO not found -- some tests might fail');
+
+        sScratch = os.path.join(self.oTstDrv.sScratchPath, "testGctrlUpdateAdditions");
+        try:
+            os.makedirs(sScratch);
+        except OSError as e:
+            if e.errno != errno.EEXIST:
+                reporter.error('Failed: Unable to create scratch directory \"%s\"' % (sScratch,));
+                return (False, oTxsSession);
+        reporter.log('Scratch path is: %s' % (sScratch,));
+
+        aaTests = [];
+        if oTestVm.isWindows():
+            aaTests.extend([
+                # Source is missing.
+                [ tdTestUpdateAdditions(sUser = sUser, sPassword = sPassword, sSrc = ''),
+                  tdTestResult(fRc = False) ],
+                # Wrong aFlags.
+                [ tdTestUpdateAdditions(sUser = sUser, sPassword = sPassword, sSrc = self.oTstDrv.getGuestAdditionsIso(),
+                                        aFlags = [ 1234 ]),
+                  tdTestResult(fRc = False) ],
+                # Non-existing .ISO.
+                [ tdTestUpdateAdditions(sUser = sUser, sPassword = sPassword, sSrc = "non-existing.iso"),
+                  tdTestResult(fRc = False) ],
+                # Wrong .ISO.
+                [ tdTestUpdateAdditions(sUser = sUser, sPassword = sPassword, sSrc = sVBoxValidationKitISO),
+                  tdTestResult(fRc = False) ],
+                # The real thing.
+                [ tdTestUpdateAdditions(sUser = sUser, sPassword = sPassword, sSrc = self.oTstDrv.getGuestAdditionsIso()),
+                  tdTestResult(fRc = True) ],
+                # Test the (optional) installer arguments. This will extract the
+                # installer into our guest's scratch directory.
+                [ tdTestUpdateAdditions(sUser = sUser, sPassword = sPassword, sSrc = self.oTstDrv.getGuestAdditionsIso(),
+                                        aArgs = [ '/extract', '/D=' + sScratch ]),
+                  tdTestResult(fRc = True) ]
+                # Some debg ISO. Only enable locally.
+                #[ tdTestUpdateAdditions(sUser = sUser, sPassword = sPassword,
+                #                      sSrc = "V:\\Downloads\\VBoxGuestAdditions-r80354.iso"),
+                #  tdTestResult(fRc = True) ]
+            ]);
+        else:
+            reporter.log('No OS-specific tests for non-Windows yet!');
+
+        fRc = True;
+        for (i, aTest) in enumerate(aaTests):
+            curTest = aTest[0]; # tdTestExec, use an index, later.
+            curRes  = aTest[1]; # tdTestResult
+            reporter.log('Testing #%d, sSrc="%s", aFlags="%s" ...' % \
+                         (i, curTest.sSrc, curTest.aFlags));
+            curTest.setEnvironment(oSession, oTxsSession, oTestVm);
+            fRc, _ = curTest.createSession('Test #%d' % (i,));
+            if fRc is False:
+                reporter.error('Test #%d failed: Could not create session' % (i,));
+                break;
+            try:
+                curProgress = curTest.oTest.oGuest.updateGuestAdditions(curTest.sSrc, curTest.aArgs, curTest.aFlags);
+                if curProgress is not None:
+                    oProgress = vboxwrappers.ProgressWrapper(curProgress, self.oTstDrv.oVBoxMgr, self, "gctrlUpGA");
+                    try:
+                        iRc = oProgress.waitForOperation(0, fIgnoreErrors = True);
+                        if iRc != 0:
+                            reporter.log('Waiting for updating Guest Additions failed');
+                            fRc = False;
+                    except:
+                        reporter.logXcpt('Updating Guest Additions waiting exception for sSrc="%s", aFlags="%s":' \
+                                         % (curTest.sSrc, curTest.aFlags));
+                        fRc = False;
+            except:
+                # Just log, don't assume an error here (will be done in the main loop then).
+                reporter.logXcpt('Updating Guest Additions exception for sSrc="%s", aFlags="%s":' \
+                                 % (curTest.sSrc, curTest.aFlags));
+                fRc = False;
+            curTest.closeSession();
+            if fRc is curRes.fRc:
+                if fRc:
+                    ## @todo Verify if Guest Additions were really updated (build, revision, ...).
+                    pass;
+            else:
+                reporter.error('Test #%d failed: Got %s, expected %s' % (i, fRc, curRes.fRc));
+                fRc = False;
+                break;
+
+        return (fRc, oTxsSession);
+
+
+
+class tdAddGuestCtrl(vbox.TestDriver):                                         # pylint: disable=R0902,R0904
+    """
+    Guest control using VBoxService on the guest.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.oTestVmSet = self.oTestVmManager.getStandardVmSet('nat');
+        self.fQuick     = False; # Don't skip lengthly tests by default.
+        self.addSubTestDriver(SubTstDrvAddGuestCtrl(self));
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        """
+        Shows the testdriver usage.
+        """
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdAddGuestCtrl Options:');
+        reporter.log('  --quick');
+        reporter.log('      Same as --virt-modes hwvirt --cpu-counts 1.');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        """
+        Parses the testdriver arguments from the command line.
+        """
+        if asArgs[iArg] == '--quick':
+            self.parseOption(['--virt-modes', 'hwvirt'], 0);
+            self.parseOption(['--cpu-counts', '1'], 0);
+            self.fQuick = True;
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def actionConfig(self):
+        if not self.importVBoxApi(): # So we can use the constant below.
+            return False;
+
+        eNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
+        sGaIso = self.getGuestAdditionsIso();
+        return self.oTestVmSet.actionConfig(self, eNic0AttachType = eNic0AttachType, sDvdImage = sGaIso);
+
+    def actionExecute(self):
+        return self.oTestVmSet.actionExecute(self, self.testOneCfg);
+
+    #
+    # Test execution helpers.
+    #
+    def testOneCfg(self, oVM, oTestVm): # pylint: disable=R0915
+        """
+        Runs the specified VM thru the tests.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+
+        self.logVmInfo(oVM);
+
+        fRc = True;
+        oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False);
+        reporter.log("TxsSession: %s" % (oTxsSession,));
+        if oSession is not None:
+            self.addTask(oSession);
+
+            fManual = False; # Manual override for local testing. (Committed version shall be False.)
+            if not fManual:
+                fRc, oTxsSession = self.aoSubTstDrvs[0].testIt(oTestVm, oSession, oTxsSession);
+            else:
+                fRc, oTxsSession = self.testGuestCtrlManual(oSession, oTxsSession, oTestVm);
+
+            # Cleanup.
+            self.removeTask(oTxsSession);
+            if not fManual:
+                self.terminateVmBySession(oSession);
+        else:
+            fRc = False;
+        return fRc;
+
+    def gctrlReportError(self, progress):
+        """
+        Helper function to report an error of a
+        given progress object.
+        """
+        if progress is None:
+            reporter.log('No progress object to print error for');
+        else:
+            errInfo = progress.errorInfo;
+            if errInfo:
+                reporter.log('%s' % (errInfo.text,));
+        return False;
+
+    def gctrlGetRemainingTime(self, msTimeout, msStart):
+        """
+        Helper function to return the remaining time (in ms)
+        based from a timeout value and the start time (both in ms).
+        """
+        if msTimeout is 0:
+            return 0xFFFFFFFE; # Wait forever.
+        msElapsed = base.timestampMilli() - msStart;
+        if msElapsed > msTimeout:
+            return 0; # No time left.
+        return msTimeout - msElapsed;
+
+    def testGuestCtrlManual(self, oSession, oTxsSession, oTestVm):                # pylint: disable=R0914,R0915,W0613,W0612
+        """
+        For manually testing certain bits.
+        """
+
+        reporter.log('Manual testing ...');
+        fRc = True;
+
+        sUser = 'Administrator';
+        sPassword = 'password';
+
+        oGuest = oSession.o.console.guest;
+        oGuestSession = oGuest.createSession(sUser,
+                                             sPassword,
+                                             "", "Manual Test");
+
+        aWaitFor = [ vboxcon.GuestSessionWaitForFlag_Start ];
+        _ = oGuestSession.waitForArray(aWaitFor, 30 * 1000);
+
+        sCmd = 'c:\\windows\\system32\\cmd.exe';
+        aArgs = [ sCmd, '/C', 'dir', '/S', 'c:\\windows' ];
+        aEnv = [];
+        aFlags = [];
+
+        for _ in range(100):
+            oProc = oGuestSession.processCreate(sCmd, aArgs if self.fpApiVer >= 5.0 else aArgs[1:],
+                                                aEnv, aFlags, 30 * 1000);
+
+            aWaitFor = [ vboxcon.ProcessWaitForFlag_Terminate ];
+            _ = oProc.waitForArray(aWaitFor, 30 * 1000);
+
+        oGuestSession.close();
+        oGuestSession = None;
+
+        time.sleep(5);
+
+        oSession.o.console.PowerDown();
+
+        return (fRc, oTxsSession);
+
+if __name__ == '__main__':
+    sys.exit(tdAddGuestCtrl().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/api/Makefile.kmk b/src/VBox/ValidationKit/tests/api/Makefile.kmk
new file mode 100644
index 0000000..4be02be
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/api/Makefile.kmk
@@ -0,0 +1,42 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - API Tests.
+#
+
+#
+# Copyright (C) 2006-2015 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsApi
+ValidationKitTestsApi_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsApi_INST = $(INST_VALIDATIONKIT)tests/api/
+ValidationKitTestsApi_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdPython1.py \
+	$(PATH_SUB_CURRENT)/tdTreeDepth1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsApi_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/api/tdPython1.py b/src/VBox/ValidationKit/tests/api/tdPython1.py
new file mode 100755
index 0000000..9195d3c
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/api/tdPython1.py
@@ -0,0 +1,225 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdPython1.py $
+
+"""
+VirtualBox Validation Kit - Python Bindings Test #1
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os
+import sys
+import time
+import threading
+import types
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+
+
+class tdPython1(vbox.TestDriver):
+    """
+    Python Bindings Test #1.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs            = None;
+
+
+    #
+    # Overridden methods.
+    #
+
+    def actionConfig(self):
+        """
+        Import the API.
+        """
+        if not self.importVBoxApi():
+            return False;
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        return  self.testEventQueueWaiting() \
+            and self.testEventQueueInterrupt();
+
+    #
+    # Test execution helpers.
+    #
+
+    def testEventQueueWaitingThreadProc(self):
+        """ Thread procedure for checking that waitForEvents fails when not called by the main thread. """
+        try:
+            rc2 = self.oVBoxMgr.waitForEvents(0);
+        except:
+            return True;
+        reporter.error('waitForEvents() returned "%s" when called on a worker thread, expected exception.' % (rc2,));
+        return False;
+
+    def testEventQueueWaiting(self):
+        """
+        Test event queue waiting.
+        """
+        reporter.testStart('waitForEvents');
+
+        # Check return values and such.
+        for cMsTimeout in (0, 1, 2, 3, 256, 1000, 0):
+            iLoop = 0;
+            while True:
+                try:
+                    rc = self.oVBoxMgr.waitForEvents(cMsTimeout);
+                except:
+                    reporter.errorXcpt();
+                    break;
+                if not isinstance(rc, types.IntType):
+                    reporter.error('waitForEvents returns non-integer type');
+                    break;
+                if rc == 1:
+                    break;
+                if rc != 0:
+                    reporter.error('waitForEvents returns "%s", expected 0 or 1' % (rc,));
+                    break;
+                iLoop += 1;
+                if iLoop > 10240:
+                    reporter.error('waitForEvents returns 0 (success) %u times. '
+                                   'Expected 1 (timeout/interrupt) after a call or two.'
+                                   % (iLoop,));
+                    break;
+            if reporter.testErrorCount() != 0:
+                break;
+
+        # Check that we get an exception when trying to call the method from
+        # a different thread.
+        reporter.log('If running a debug build, you will see an ignored assertion now. Please ignore it.')
+        sVBoxAssertSaved = os.environ.get('VBOX_ASSERT', 'breakpoint');
+        os.environ['VBOX_ASSERT'] = 'ignore';
+        oThread = threading.Thread(target=self.testEventQueueWaitingThreadProc);
+        oThread.start();
+        oThread.join();
+        os.environ['VBOX_ASSERT'] = sVBoxAssertSaved;
+
+        return reporter.testDone()[1] == 0;
+
+    def interruptWaitEventsThreadProc(self):
+        """ Thread procedure that's used for waking up the main thread. """
+        time.sleep(2);
+        try:
+            rc2 = self.oVBoxMgr.interruptWaitEvents();
+        except:
+            reporter.errorXcpt();
+        else:
+            if rc2 is True:
+                return True;
+            reporter.error('interruptWaitEvents returned "%s" when called from other thread, expected True' % (rc2,));
+        return False;
+
+    def testEventQueueInterrupt(self):
+        """
+        Test interrupting an event queue wait.
+        """
+        reporter.testStart('interruptWait');
+
+        # interrupt ourselves first and check the return value.
+        for i in range(0, 10):
+            try:
+                rc = self.oVBoxMgr.interruptWaitEvents();
+            except:
+                reporter.errorXcpt();
+                break;
+            if rc is not True:
+                reporter.error('interruptWaitEvents returned "%s" expected True' % (rc,));
+                break
+
+        if reporter.testErrorCount() == 0:
+            #
+            # Interrupt a waitForEvents call.
+            #
+            # This test ASSUMES that no other events are posted to the thread's
+            # event queue once we've drained it.  Also ASSUMES the box is
+            # relatively fast and not too busy because we're timing sensitive.
+            #
+            for i in range(0, 4):
+                # Try quiesce the event queue.
+                for _ in range(1, 100):
+                    self.oVBoxMgr.waitForEvents(0);
+
+                # Create a thread that will interrupt us in 2 seconds.
+                try:
+                    oThread = threading.Thread(target=self.interruptWaitEventsThreadProc);
+                    oThread.setDaemon(False);
+                except:
+                    reporter.errorXcpt();
+                    break;
+
+                cMsTimeout = 20000;
+                if i == 2:
+                    cMsTimeout = -1;
+                elif i == 3:
+                    cMsTimeout = -999999;
+
+                # Do the wait.
+                oThread.start();
+                msNow = base.timestampMilli();
+                try:
+                    rc = self.oVBoxMgr.waitForEvents(cMsTimeout);
+                except:
+                    reporter.errorXcpt();
+                else:
+                    msElapsed = base.timestampMilli() - msNow;
+
+                    # Check the return code and elapsed time.
+                    if not isinstance(rc, types.IntType):
+                        reporter.error('waitForEvents returns non-integer type after %u ms, expected 1' % (msElapsed,));
+                    elif rc != 1:
+                        reporter.error('waitForEvents returned "%s" after %u ms, expected 1' % (rc, msElapsed));
+                    if msElapsed > 15000:
+                        reporter.error('waitForEvents after %u ms, expected just above 2-3 seconds' % (msElapsed,));
+                    elif msElapsed < 100:
+                        reporter.error('waitForEvents after %u ms, expected more than 100 ms.' % (msElapsed,));
+
+                oThread.join();
+                oThread = None;
+                if reporter.testErrorCount() != 0:
+                    break;
+                reporter.log('Iteration %u was successful...' % (i + 1,));
+        return reporter.testDone()[1] == 0;
+
+
+if __name__ == '__main__':
+    sys.exit(tdPython1().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/api/tdTreeDepth1.py b/src/VBox/ValidationKit/tests/api/tdTreeDepth1.py
new file mode 100755
index 0000000..2c6c92b
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/api/tdTreeDepth1.py
@@ -0,0 +1,163 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdTreeDepth1.py $
+
+"""
+VirtualBox Validation Kit - Medium and Snapshot Tree Depth Test #1
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2015 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 99187 $"
+
+
+# Standard Python imports.
+import os
+import sys
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0]
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(g_ksValidationKitDir)
+
+# Validation Kit imports.
+from testdriver import reporter
+from testdriver import vbox
+from testdriver import vboxcon
+
+
+class tdTreeDepth1(vbox.TestDriver):
+    """
+    Medium and Snapshot Tree Depth Test #1.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self)
+        self.asRsrcs            = None
+
+
+    #
+    # Overridden methods.
+    #
+
+    def actionConfig(self):
+        """
+        Import the API.
+        """
+        if not self.importVBoxApi():
+            return False
+        return True
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        return  self.testMediumTreeDepth() \
+            and self.testSnapshotTreeDepth()
+
+    #
+    # Test execution helpers.
+    #
+
+    def testMediumTreeDepth(self):
+        """
+        Test medium tree depth.
+        """
+        reporter.testStart('mediumTreeDepth')
+
+        try:
+            oVM = self.createTestVM('test-medium', 1, None, 4)
+            assert oVM is not None
+
+            # create chain with 300 disk images (medium tree depth limit)
+            fRc = True
+            oSession = self.openSession(oVM)
+            for i in range(1, 301):
+                sHddPath = os.path.join(self.sScratchPath, 'Test' + str(i) + '.vdi')
+                if i is 1:
+                    oHd = oSession.createBaseHd(sHddPath, cb=1024*1024)
+                else:
+                    oHd = oSession.createDiffHd(oHd, sHddPath)
+                if oHd is None:
+                    fRc = False
+                    break
+
+            # modify the VM config, attach HDD
+            fRc = fRc and oSession.attachHd(sHddPath, sController='SATA Controller', fImmutable=False, fForceResource=False)
+            fRc = fRc and oSession.saveSettings()
+            fRc = oSession.close() and fRc
+
+            # unregister and re-register to test loading of settings
+            sSettingsFile = oVM.settingsFilePath
+            reporter.log('unregistering VM')
+            oVM.unregister(vboxcon.CleanupMode_DetachAllReturnNone)
+            oVBox = self.oVBoxMgr.getVirtualBox()
+            reporter.log('opening VM %s, testing config reading' % (sSettingsFile))
+            oVM = oVBox.openMachine(sSettingsFile)
+
+            assert fRc is True
+        except:
+            reporter.errorXcpt()
+
+        return reporter.testDone()[1] == 0
+
+    def testSnapshotTreeDepth(self):
+        """
+        Test snapshot tree depth.
+        """
+        reporter.testStart('snapshotTreeDepth')
+
+        try:
+            oVM = self.createTestVM('test-snap', 1, None, 4)
+            assert oVM is not None
+
+            # modify the VM config, create and attach empty HDD
+            oSession = self.openSession(oVM)
+            sHddPath = os.path.join(self.sScratchPath, 'TestSnapEmpty.vdi')
+            fRc = True
+            fRc = fRc and oSession.createAndAttachHd(sHddPath, cb=1024*1024, sController='SATA Controller', fImmutable=False)
+            fRc = fRc and oSession.saveSettings()
+
+            # take 250 snapshots (snapshot tree depth limit)
+            for i in range(1, 251):
+                fRc = fRc and oSession.takeSnapshot('Snapshot ' + str(i))
+            fRc = oSession.close() and fRc
+
+            # unregister and re-register to test loading of settings
+            sSettingsFile = oVM.settingsFilePath
+            reporter.log('unregistering VM')
+            oVM.unregister(vboxcon.CleanupMode_DetachAllReturnNone)
+            oVBox = self.oVBoxMgr.getVirtualBox()
+            reporter.log('opening VM %s, testing config reading' % (sSettingsFile))
+            oVM = oVBox.openMachine(sSettingsFile)
+
+            assert fRc is True
+        except:
+            reporter.errorXcpt()
+
+        return reporter.testDone()[1] == 0
+
+
+if __name__ == '__main__':
+    sys.exit(tdTreeDepth1().main(sys.argv))
+
diff --git a/src/VBox/ValidationKit/tests/autostart/Makefile.kmk b/src/VBox/ValidationKit/tests/autostart/Makefile.kmk
new file mode 100644
index 0000000..b76897c
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/autostart/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Autostart.
+#
+
+#
+# Copyright (C) 2013 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsAutostart
+ValidationKitTestsAutostart_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsAutostart_INST = $(INST_VALIDATIONKIT)tests/autostart/
+ValidationKitTestsAutostart_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdAutostart1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsAutostart_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/autostart/tdAutostart1.py b/src/VBox/ValidationKit/tests/autostart/tdAutostart1.py
new file mode 100755
index 0000000..6458edc
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/autostart/tdAutostart1.py
@@ -0,0 +1,706 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+AUtostart testcase using.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2013 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Id: tdAutostart1.py $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+import re;
+import array;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+
+class VBoxManageStdOutWrapper(object):
+    """ Parser for VBoxManage list runningvms """
+    def __init__(self):
+        self.sVmRunning = '';
+
+    def read(self, cb):
+        """file.read"""
+        _ = cb;
+        return "";
+
+    def write(self, sText):
+        """VBoxManage stdout write"""
+        if isinstance(sText, array.array):
+            sText = sText.tostring();
+
+        asLines = sText.splitlines();
+        for sLine in asLines:
+            sLine = sLine.strip();
+
+                # Extract the value
+            idxVmNameStart = sLine.find('"');
+            if idxVmNameStart is -1:
+                raise Exception('VBoxManageStdOutWrapper: Invalid output');
+
+            idxVmNameStart += 1;
+            idxVmNameEnd = idxVmNameStart;
+            while sLine[idxVmNameEnd] != '"':
+                idxVmNameEnd += 1;
+
+            self.sVmRunning = sLine[idxVmNameStart:idxVmNameEnd];
+            reporter.log('Logging: ' + self.sVmRunning);
+
+        return None;
+
+class tdAutostartOs(object):
+    """
+    Base autostart helper class to provide common methods.
+    """
+
+    def _findFile(self, sRegExp, sTestBuildDir):
+        """
+        Returns a filepath based on the given regex and path to look into
+        or None if no matching file is found.
+        """
+
+        oRegExp = re.compile(sRegExp);
+
+        asFiles = os.listdir(sTestBuildDir);
+
+        for sFile in asFiles:
+            if oRegExp.match(os.path.basename(sFile)) and os.path.exists(sTestBuildDir + '/' + sFile):
+                return sTestBuildDir + '/' + sFile;
+
+        reporter.error('Failed to find a file matching "%s" in %s.' % (sRegExp, sTestBuildDir));
+        return None;
+
+    def _createAutostartCfg(self, sDefaultPolicy = 'allow', asUserAllow = (), asUserDeny = ()):
+        """
+        Creates a autostart config for VirtualBox
+        """
+
+        sVBoxCfg = 'default_policy=' + sDefaultPolicy + '\n';
+
+        for sUserAllow in asUserAllow:
+            sVBoxCfg = sVBoxCfg + sUserAllow + ' = {\n allow = true\n }\n';
+
+        for sUserDeny in asUserDeny:
+            sVBoxCfg = sVBoxCfg + sUserDeny + ' = {\n allow = false\n }\n';
+
+        return sVBoxCfg;
+
+class tdAutostartOsLinux(tdAutostartOs):
+    """
+    Autostart support methods for Linux guests.
+    """
+
+    def __init__(self, oTestDriver, sTestBuildDir):
+        tdAutostartOs.__init__(self);
+        self.sTestBuild = self._findFile('^VirtualBox-.*\\.run$', sTestBuildDir);
+        self.oTestDriver = oTestDriver;
+
+    def installVirtualBox(self, oSession, oTxsSession):
+        """
+        Install VirtualBox in the guest.
+        """
+        fRc = False;
+
+        if self.sTestBuild is not None:
+            fRc = self.oTestDriver.txsUploadFile(oSession, oTxsSession, self.sTestBuild, \
+                                                 '/tmp/' + os.path.basename(self.sTestBuild), \
+                                                 cMsTimeout = 120 * 1000);
+            fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Installing VBox', 10 * 1000, \
+                                                      '/bin/chmod',
+                                                      ('chmod', '755', '/tmp/' + os.path.basename(self.sTestBuild)));
+            fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Installing VBox', 240 * 1000, \
+                                                      '/tmp/' + os.path.basename(self.sTestBuild));
+
+        return fRc;
+
+    def configureAutostart(self, oSession, oTxsSession, sDefaultPolicy = 'allow',
+                           asUserAllow = (), asUserDeny = ()):
+        """
+        Configures the autostart feature in the guest.
+        """
+
+        # Create autostart database directory writeable for everyone
+        fRc = self.oTestDriver.txsRunTest(oTxsSession, 'Creating autostart database', 10 * 1000, \
+                                          '/bin/mkdir',
+                                          ('mkdir', '-m', '1777', '/etc/vbox/autostart.d'));
+
+        # Create /etc/default/virtualbox
+        sVBoxCfg =   'VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg\n' \
+                   + 'VBOXAUTOSTART_DB=/etc/vbox/autostart.d\n';
+        fRc = fRc and self.oTestDriver.txsUploadString(oSession, oTxsSession, sVBoxCfg, '/etc/default/virtualbox');
+        fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Setting permissions', 10 * 1000, \
+                                                  '/bin/chmod',
+                                                  ('chmod', '644', '/etc/default/virtualbox'));
+
+        sVBoxCfg = self._createAutostartCfg(sDefaultPolicy, asUserAllow, asUserDeny);
+        fRc = fRc and self.oTestDriver.txsUploadString(oSession, oTxsSession, sVBoxCfg, '/etc/vbox/autostart.cfg');
+        fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Setting permissions', 10 * 1000, \
+                                                  '/bin/chmod',
+                                                  ('chmod', '644', '/etc/vbox/autostart.cfg'));
+
+        return fRc;
+
+    def createUser(self, oTxsSession, sUser):
+        """
+        Create a new user with the given name
+        """
+
+        fRc = self.oTestDriver.txsRunTest(oTxsSession, 'Creating new user', 10 * 1000, \
+                                          '/usr/sbin/useradd',
+                                          ('useradd', '-m', '-U', sUser));
+
+        return fRc;
+
+    # pylint: disable=R0913
+
+    def runProgAsUser(self, oTxsSession, sTestName, cMsTimeout, sExecName, sAsUser, asArgs = (),
+                      oStdIn = '/dev/null', oStdOut = '/dev/null', oStdErr = '/dev/null', oTestPipe = '/dev/null'):
+        """
+        Runs a program as the specififed user
+        """
+        asNewArgs = ('sudo', '-u', sAsUser, sExecName) + asArgs;
+
+        fRc = self.oTestDriver.txsRunTestRedirectStd(oTxsSession, sTestName, cMsTimeout, '/usr/bin/sudo',
+                                                     asNewArgs, (), "", oStdIn, oStdOut, oStdErr, oTestPipe);
+
+        return fRc;
+
+    # pylint: enable=R0913
+
+    def createTestVM(self, oSession, oTxsSession, sUser, sVmName):
+        """
+        Create a test VM in the guest and enable autostart.
+        """
+
+        _ = oSession;
+
+        fRc = self.runProgAsUser(oTxsSession, 'Configuring autostart database', 10 * 1000, \
+                                 '/opt/VirtualBox/VBoxManage', sUser,
+                                 ('setproperty', 'autostartdbpath', '/etc/vbox/autostart.d'));
+        fRc = fRc and self.runProgAsUser(oTxsSession, 'Create VM ' + sVmName, 10 * 1000, \
+                                         '/opt/VirtualBox/VBoxManage', sUser,
+                                         ('createvm', '--name', sVmName, '--register'));
+        fRc = fRc and self.runProgAsUser(oTxsSession, 'Enabling autostart for test VM', 10 * 1000, \
+                                         '/opt/VirtualBox/VBoxManage', sUser,
+                                         ('modifyvm', sVmName, '--autostart-enabled', 'on'));
+
+        return fRc;
+
+    def checkForRunningVM(self, oSession, oTxsSession, sUser, sVmName):
+        """
+        Check for VM running in the guest after autostart.
+        """
+
+        _ = oSession;
+
+        oStdOut = VBoxManageStdOutWrapper();
+        fRc = self.runProgAsUser(oTxsSession, 'Check for running VM', 20 * 1000, \
+                                 '/opt/VirtualBox/VBoxManage', sUser, ('list', 'runningvms'),
+                                 '/dev/null', oStdOut, '/dev/null', '/dev/null');
+
+        if fRc is True and oStdOut.sVmRunning == sVmName:
+            fRc = True;
+        else:
+            fRc = False;
+
+        return fRc;
+
+class tdAutostartOsDarwin(tdAutostartOs):
+    """
+    Autostart support methods for Darwin guests.
+    """
+
+    def __init__(self, sTestBuildDir):
+        _ = sTestBuildDir;
+        tdAutostartOs.__init__(self);
+
+    def installVirtualBox(self, oSession, oTxsSession):
+        """
+        Install VirtualBox in the guest.
+        """
+        _ = oSession;
+        _ = oTxsSession;
+        return False;
+
+    def configureAutostart(self, oSession, oTxsSession):
+        """
+        Configures the autostart feature in the guest.
+        """
+        _ = oSession;
+        _ = oTxsSession;
+        return False;
+
+    def createTestVM(self, oSession, oTxsSession):
+        """
+        Create a test VM in the guest and enable autostart.
+        """
+        _ = oSession;
+        _ = oTxsSession;
+        return False;
+
+    def checkForRunningVM(self, oSession, oTxsSession):
+        """
+        Check for VM running in the guest after autostart.
+        """
+        _ = oSession;
+        _ = oTxsSession;
+        return False;
+
+class tdAutostartOsSolaris(tdAutostartOs):
+    """
+    Autostart support methods for Solaris guests.
+    """
+
+    def __init__(self, oTestDriver, sTestBuildDir):
+        tdAutostartOs.__init__(self);
+        self.sTestBuildDir = sTestBuildDir;
+        self.sTestBuild = self._findFile('^VirtualBox-.*-SunOS-.*\\.tar.gz$', sTestBuildDir);
+        self.oTestDriver = oTestDriver;
+
+    def installVirtualBox(self, oSession, oTxsSession):
+        """
+        Install VirtualBox in the guest.
+        """
+        fRc = False;
+
+        if self.sTestBuild is not None:
+            reporter.log('Testing build: %s' % (self.sTestBuild));
+            sTestBuildFilename = os.path.basename(self.sTestBuild);
+
+            # Construct the .pkg filename from the tar.gz name.
+            oMatch = re.search(r'\d+.\d+.\d+-SunOS-r\d+', sTestBuildFilename);
+            if oMatch is not None:
+                sPkgFilename = 'VirtualBox-' + oMatch.group() + '.pkg';
+
+                reporter.log('Extracted package filename: %s' % (sPkgFilename));
+
+                fRc = self.oTestDriver.txsUploadFile(oSession, oTxsSession, self.sTestBuild, \
+                                                     '${SCRATCH}/' + sTestBuildFilename, \
+                                                     cMsTimeout = 120 * 1000);
+                fRc = fRc and self.oTestDriver.txsUnpackFile(oSession, oTxsSession, \
+                                                             '${SCRATCH}/' + sTestBuildFilename, \
+                                                             '${SCRATCH}', cMsTimeout = 120 * 1000);
+                fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Installing package', 240 * 1000, \
+                                                          '/usr/sbin/pkgadd',
+                                                          ('pkgadd', '-d', '${SCRATCH}/' + sPkgFilename, \
+                                                           '-n', '-a', '${SCRATCH}/autoresponse', 'SUNWvbox'));
+        return fRc;
+
+    def configureAutostart(self, oSession, oTxsSession, sDefaultPolicy = 'allow',
+                           asUserAllow = (), asUserDeny = ()):
+        """
+        Configures the autostart feature in the guest.
+        """
+
+        fRc = self.oTestDriver.txsRunTest(oTxsSession, 'Creating /etc/vbox directory', 10 * 1000, \
+                                          '/usr/bin/mkdir',
+                                          ('mkdir', '-m', '755', '/etc/vbox'));
+
+        sVBoxCfg = self._createAutostartCfg(sDefaultPolicy, asUserAllow, asUserDeny);
+        fRc = fRc and self.oTestDriver.txsUploadString(oSession, oTxsSession, sVBoxCfg, '/etc/vbox/autostart.cfg');
+        fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Setting permissions', 10 * 1000, \
+                                                  '/usr/bin/chmod',
+                                                  ('chmod', '644', '/etc/vbox/autostart.cfg'));
+
+
+        fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Importing the service', 10 * 1000, \
+                                                  '/usr/sbin/svccfg',
+                                                  ('svccfg', '-s', 'svc:/application/virtualbox/autostart:default', \
+                                                   'setprop', 'config/config=/etc/vbox/autostart.cfg'));
+        fRc = fRc and self.oTestDriver.txsRunTest(oTxsSession, 'Enabling the service', 10 * 1000, \
+                                                  '/usr/sbin/svcadm',
+                                                  ('svcadm', 'enable', 'svc:/application/virtualbox/autostart:default'));
+
+        return fRc;
+
+    def createUser(self, oTxsSession, sUser):
+        """
+        Create a new user with the given name
+        """
+
+        fRc = self.oTestDriver.txsRunTest(oTxsSession, 'Creating new user', 10 * 1000, \
+                                          '/usr/sbin/useradd',
+                                          ('useradd', '-m', '-g', 'staff', sUser));
+
+        return fRc;
+
+    # pylint: disable=R0913
+
+    def runProgAsUser(self, oTxsSession, sTestName, cMsTimeout, sExecName, sAsUser, asArgs = (),
+                      oStdIn = '/dev/null', oStdOut = '/dev/null', oStdErr = '/dev/null', oTestPipe = '/dev/null'):
+        """
+        Runs a program as the specififed user
+        """
+        asNewArgs = ('sudo', '-u', sAsUser, sExecName) + asArgs;
+
+        fRc = self.oTestDriver.txsRunTestRedirectStd(oTxsSession, sTestName, cMsTimeout, '/usr/bin/sudo',
+                                                     asNewArgs, (), "", oStdIn, oStdOut, oStdErr, oTestPipe);
+
+        return fRc;
+
+    # pylint: enable=R0913
+
+    def createTestVM(self, oSession, oTxsSession, sUser, sVmName):
+        """
+        Create a test VM in the guest and enable autostart.
+        """
+
+        _ = oSession;
+
+        fRc = self.runProgAsUser(oTxsSession, 'Create VM ' + sVmName, 10 * 1000, \
+                                 '/opt/VirtualBox/VBoxManage', sUser,
+                                 ('createvm', '--name', sVmName, '--register'));
+        fRc = fRc and self.runProgAsUser(oTxsSession, 'Enabling autostart for test VM', 10 * 1000, \
+                                         '/opt/VirtualBox/VBoxManage', sUser,
+                                         ('modifyvm', sVmName, '--autostart-enabled', 'on'));
+
+        return fRc;
+
+    def checkForRunningVM(self, oSession, oTxsSession, sUser, sVmName):
+        """
+        Check for VM running in the guest after autostart.
+        """
+
+        _ = oSession;
+
+        oStdOut = VBoxManageStdOutWrapper();
+        fRc = self.runProgAsUser(oTxsSession, 'Check for running VM', 20 * 1000, \
+                                 '/opt/VirtualBox/VBoxManage', sUser, ('list', 'runningvms'),
+                                 '/dev/null', oStdOut, '/dev/null', '/dev/null');
+
+        if fRc is True and oStdOut.sVmRunning == sVmName:
+            fRc = True;
+        else:
+            fRc = False;
+
+        return fRc;
+
+
+class tdAutostartOsWin(tdAutostartOs):
+    """
+    Autostart support methods for Windows guests.
+    """
+
+    def __init__(self, sTestBuildDir):
+        _ = sTestBuildDir;
+        tdAutostartOs.__init__(self);
+        return;
+
+    def installVirtualBox(self, oSession, oTxsSession):
+        """
+        Install VirtualBox in the guest.
+        """
+        _ = oSession;
+        _ = oTxsSession;
+        return False;
+
+    def configureAutostart(self, oSession, oTxsSession):
+        """
+        Configures the autostart feature in the guest.
+        """
+        _ = oSession;
+        _ = oTxsSession;
+        return False;
+
+    def createTestVM(self, oSession, oTxsSession):
+        """
+        Create a test VM in the guest and enable autostart.
+        """
+        _ = oSession;
+        _ = oTxsSession;
+        return False;
+
+    def checkForRunningVM(self, oSession, oTxsSession):
+        """
+        Check for VM running in the guest after autostart.
+        """
+        _ = oSession;
+        _ = oTxsSession;
+        return False;
+
+class tdAutostart(vbox.TestDriver):                                      # pylint: disable=R0902
+    """
+    Autostart testcase.
+    """
+
+    ksOsLinux   = 'tst-debian'
+    ksOsWindows = 'tst-win'
+    ksOsDarwin  = 'tst-darwin'
+    ksOsSolaris = 'tst-solaris'
+    ksOsFreeBSD = 'tst-freebsd'
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs           = None;
+        self.asTestVMsDef      = [self.ksOsLinux, self.ksOsSolaris];
+        self.asTestVMs         = self.asTestVMsDef;
+        self.asSkipVMs         = [];
+        self.sTestBuildDir     = '/home/alexander/Downloads';
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdAutostart Options:');
+        reporter.log('  --test-build-dir <path>');
+        reporter.log('      Default: %s' % (self.sTestBuildDir));
+        reporter.log('  --test-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Test the specified VMs in the given order. Use this to change');
+        reporter.log('      the execution order or limit the choice of VMs');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestVMsDef)));
+        reporter.log('  --skip-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        if asArgs[iArg] == '--test-build-dir':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-build-dir" takes a path argument');
+            self.sTestBuildDir = asArgs[iArg];
+        elif asArgs[iArg] == '--test-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
+            self.asTestVMs = asArgs[iArg].split(':');
+            for s in self.asTestVMs:
+                if s not in self.asTestVMsDef:
+                    raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestVMsDef)));
+        elif asArgs[iArg] == '--skip-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
+            self.asSkipVMs = asArgs[iArg].split(':');
+            for s in self.asSkipVMs:
+                if s not in self.asTestVMsDef:
+                    reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        # Remove skipped VMs from the test list.
+        for sVM in self.asSkipVMs:
+            try:    self.asTestVMs.remove(sVM);
+            except: pass;
+
+        return vbox.TestDriver.completeOptions(self);
+
+    def getResourceSet(self):
+        # Construct the resource list the first time it's queried.
+        if self.asRsrcs is None:
+            self.asRsrcs = [];
+            if self.ksOsLinux in self.asTestVMs:
+                self.asRsrcs.append('4.2/autostart/tst-debian.vdi');
+            if self.ksOsSolaris in self.asTestVMs:
+                self.asRsrcs.append('4.2/autostart/tst-solaris.vdi');
+
+        return self.asRsrcs;
+
+    def actionConfig(self):
+
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        #
+        # Configure the VMs we're going to use.
+        #
+
+        # Linux VMs
+        if self.ksOsLinux in self.asTestVMs:
+            oVM = self.createTestVM(self.ksOsLinux, 1, '4.2/autostart/tst-debian.vdi', sKind = 'Debian_64', \
+                                    fIoApic = True, eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
+                                    eNic0Type = vboxcon.NetworkAdapterType_Am79C973);
+            if oVM is None:
+                return False;
+
+        # Solaris VMs
+        if self.ksOsSolaris in self.asTestVMs:
+            oVM = self.createTestVM(self.ksOsSolaris, 1, '4.2/autostart/tst-solaris.vdi', sKind = 'Solaris_64', \
+                                    fIoApic = True, eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
+                                    sHddControllerType = "SATA Controller");
+            if oVM is None:
+                return False;
+
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        fRc = self.testAutostart();
+        return fRc;
+
+    #
+    # Test execution helpers.
+    #
+    def testAutostartRunProgs(self, oSession, oTxsSession, sVmName):
+        """
+        Test VirtualBoxs autostart feature in a VM.
+        """
+        reporter.testStart('Autostart ' + sVmName);
+
+        oGuestOsHlp = None;
+
+        if sVmName == self.ksOsLinux:
+            oGuestOsHlp = tdAutostartOsLinux(self, self.sTestBuildDir);
+        elif sVmName == self.ksOsSolaris:
+            oGuestOsHlp = tdAutostartOsSolaris(self, self.sTestBuildDir);
+        elif sVmName == self.ksOsDarwin:
+            oGuestOsHlp = tdAutostartOsDarwin(self.sTestBuildDir);
+        elif sVmName == self.ksOsWindows:
+            oGuestOsHlp = tdAutostartOsWin(self.sTestBuildDir);
+
+        sTestUserAllow = 'test1';
+        sTestUserDeny = 'test2';
+        sTestVmName = 'TestVM';
+
+        if oGuestOsHlp is not None:
+            # Create two new users
+            fRc = oGuestOsHlp.createUser(oTxsSession, sTestUserAllow);
+            fRc = fRc and oGuestOsHlp.createUser(oTxsSession, sTestUserDeny);
+            if fRc is True:
+                # Install VBox first
+                fRc = oGuestOsHlp.installVirtualBox(oSession, oTxsSession);
+                if fRc is True:
+                    fRc = oGuestOsHlp.configureAutostart(oSession, oTxsSession, 'allow',
+                                                         (sTestUserAllow,), (sTestUserDeny,));
+                    if fRc is True:
+                        # Create a VM with autostart enabled in the guest for both users
+                        fRc = oGuestOsHlp.createTestVM(oSession, oTxsSession, sTestUserAllow, sTestVmName);
+                        fRc = fRc and oGuestOsHlp.createTestVM(oSession, oTxsSession, sTestUserDeny, sTestVmName);
+                        if fRc is True:
+                            # Reboot the guest
+                            (fRc, oTxsSession) = self.txsRebootAndReconnectViaTcp(oSession, oTxsSession, cMsTimeout = 3 * 60000, \
+                                                                                  fNatForwardingForTxs = True);
+                            if fRc is True:
+                                # Fudge factor - Allow the guest to finish starting up.
+                                self.sleep(5);
+                                fRc = oGuestOsHlp.checkForRunningVM(oSession, oTxsSession, sTestUserAllow, sTestVmName);
+                                if fRc is False:
+                                    reporter.error('Test VM is not running inside the guest for allowed user');
+
+                                fRc = oGuestOsHlp.checkForRunningVM(oSession, oTxsSession, sTestUserDeny, sTestVmName);
+                                if fRc is True:
+                                    reporter.error('Test VM is running inside the guest for denied user');
+                            else:
+                                reporter.log('Rebooting the guest failed');
+                        else:
+                            reporter.log('Creating test VM failed');
+                    else:
+                        reporter.log('Configuring autostart in the guest failed');
+                else:
+                    reporter.log('Installing VirtualBox in the guest failed');
+            else:
+                reporter.log('Creating test users failed');
+        else:
+            reporter.log('Guest OS helper not created for VM %s' % (sVmName));
+            fRc = False;
+
+        reporter.testDone(not fRc);
+        return fRc;
+
+    def testAutostartOneCfg(self, sVmName):
+        """
+        Runs the specified VM thru test #1.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+        oVM = self.getVmByName(sVmName);
+
+        # Reconfigure the VM
+        fRc = True;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            fRc = fRc and oSession.enableVirtEx(True);
+            fRc = fRc and oSession.enableNestedPaging(True);
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Start up.
+        if fRc is True:
+            self.logVmInfo(oVM);
+            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
+            if oSession is not None:
+                self.addTask(oSession);
+
+                # Fudge factor - Allow the guest to finish starting up.
+                self.sleep(5);
+
+                fRc = self.testAutostartRunProgs(oSession, oTxsSession, sVmName);
+
+                # cleanup.
+                self.removeTask(oTxsSession);
+                self.terminateVmBySession(oSession)
+            else:
+                fRc = False;
+        return fRc;
+
+    def testAutostartForOneVM(self, sVmName):
+        """
+        Runs one VM thru the various configurations.
+        """
+        reporter.testStart(sVmName);
+        fRc = True;
+        self.testAutostartOneCfg(sVmName);
+        reporter.testDone();
+        return fRc;
+
+    def testAutostart(self):
+        """
+        Executes autostart test.
+        """
+
+        # Loop thru the test VMs.
+        for sVM in self.asTestVMs:
+            # run test on the VM.
+            if not self.testAutostartForOneVM(sVM):
+                fRc = False;
+            else:
+                fRc = True;
+
+        return fRc;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdAutostart().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/benchmarks/Makefile.kmk b/src/VBox/ValidationKit/tests/benchmarks/Makefile.kmk
new file mode 100644
index 0000000..68904b3
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/benchmarks/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Benchmarks.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsBenchmarks
+ValidationKitTestsBenchmarks_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsBenchmarks_INST = $(INST_VALIDATIONKIT)tests/benchmarks/
+ValidationKitTestsBenchmarks_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdBenchmark1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsBenchmarks_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/benchmarks/tdBenchmark1.py b/src/VBox/ValidationKit/tests/benchmarks/tdBenchmark1.py
new file mode 100755
index 0000000..988e3cb
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/benchmarks/tdBenchmark1.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdBenchmark1.py $
+
+"""
+VirtualBox Validation Kit - Test that runs various benchmarks.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 97546 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import vbox;
+from testdriver import vboxtestvms;
+
+
+class tdBenchmark1(vbox.TestDriver):
+    """
+    Benchmark #1.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        oTestVm = vboxtestvms.BootSectorTestVm(self.oTestVmSet, 'tst-bs-test1',
+                                               os.path.join(self.sVBoxBootSectors, 'bootsector2-test1.img'));
+        self.oTestVmSet.aoTestVms.append(oTestVm);
+
+
+    #
+    # Overridden methods.
+    #
+
+
+    def actionConfig(self):
+        self._detectValidationKit();
+        return self.oTestVmSet.actionConfig(self);
+
+    def actionExecute(self):
+        return self.oTestVmSet.actionExecute(self, self.testOneCfg);
+
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def testOneCfg(self, oVM, oTestVm):
+        """
+        Runs the specified VM thru the tests.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+        fRc = False;
+
+        sXmlFile = self.prepareResultFile();
+        asEnv = [ 'IPRT_TEST_FILE=' + sXmlFile];
+
+        self.logVmInfo(oVM);
+        oSession = self.startVm(oVM, sName = oTestVm.sVmName, asEnv = asEnv);
+        if oSession is not None:
+            self.addTask(oSession);
+
+            cMsTimeout = 15*60*1000;
+            if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
+                cMsTimeout = self.adjustTimeoutMs(180 * 60000);
+
+            oRc = self.waitForTasks(cMsTimeout);
+            self.removeTask(oSession);
+            if oRc == oSession:
+                fRc = oSession.assertPoweredOff();
+            else:
+                reporter.error('oRc=%s, expected %s' % (oRc, oSession));
+
+            reporter.addSubXmlFile(sXmlFile);
+            self.terminateVmBySession(oSession);
+        return fRc;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdBenchmark1().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/cpu/Makefile.kmk b/src/VBox/ValidationKit/tests/cpu/Makefile.kmk
new file mode 100644
index 0000000..dc92d4e
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/cpu/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - CPU Tests.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsCpu
+ValidationKitTestsCpu_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsCpu_INST = $(INST_VALIDATIONKIT)tests/cpu/
+ValidationKitTestsCpu_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdCpuPae1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsCpu_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/cpu/tdCpuPae1.py b/src/VBox/ValidationKit/tests/cpu/tdCpuPae1.py
new file mode 100755
index 0000000..83076e2
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/cpu/tdCpuPae1.py
@@ -0,0 +1,256 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdCpuPae1.py $
+
+"""
+VirtualBox Validation Kit - Catch PAE not enabled.
+
+Test that switching into PAE mode when it isn't enable, check that it produces
+the right runtime error.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+
+
+class tdCpuPae1ConsoleCallbacks(vbox.ConsoleEventHandlerBase):
+    """
+    For catching the PAE runtime error.
+    """
+    def __init__(self, dArgs):
+        oTstDrv  = dArgs['oTstDrv'];
+        oVBoxMgr = dArgs['oVBoxMgr']; _ = oVBoxMgr;
+
+        vbox.ConsoleEventHandlerBase.__init__(self, dArgs, 'tdCpuPae1');
+        self.oTstDrv  = oTstDrv;
+
+    def onRuntimeError(self, fFatal, sErrId, sMessage):
+        """ Verify the error. """
+        reporter.log('onRuntimeError: fFatal=%s sErrId="%s" sMessage="%s"' % (fFatal, sErrId, sMessage));
+        if sErrId != 'PAEmode':
+            reporter.testFailure('sErrId=%s, expected PAEmode' % (sErrId,));
+        elif fFatal is not True:
+            reporter.testFailure('fFatal=%s, expected True' % (fFatal,));
+        else:
+            self.oTstDrv.fCallbackSuccess = True;
+        self.oTstDrv.fCallbackFired = True;
+        self.oVBoxMgr.interruptWaitEvents();
+        return None;
+
+
+class tdCpuPae1(vbox.TestDriver):
+    """
+    PAE Test #1.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asSkipTests        = [];
+        self.asVirtModesDef     = ['hwvirt', 'hwvirt-np', 'raw',]
+        self.asVirtModes        = self.asVirtModesDef
+        self.acCpusDef          = [1, 2,]
+        self.acCpus             = self.acCpusDef;
+        self.fCallbackFired     = False;
+        self.fCallbackSuccess   = False;
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdCpuPae1 Options:');
+        reporter.log('  --virt-modes   <m1[:m2[:]]');
+        reporter.log('      Default: %s' % (':'.join(self.asVirtModesDef)));
+        reporter.log('  --cpu-counts   <c1[:c2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
+        reporter.log('  --quick');
+        reporter.log('      Shorthand for: --virt-modes raw --cpu-counts 1 32');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):
+        if asArgs[iArg] == '--virt-modes':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
+            self.asVirtModes = asArgs[iArg].split(':');
+            for s in self.asVirtModes:
+                if s not in self.asVirtModesDef:
+                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asVirtModesDef)));
+        elif asArgs[iArg] == '--cpu-counts':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
+            self.acCpus = [];
+            for s in asArgs[iArg].split(':'):
+                try: c = int(s);
+                except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
+                if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
+                self.acCpus.append(c);
+        elif asArgs[iArg] == '--quick':
+            self.asVirtModes        = ['raw',];
+            self.acCpus             = [1,];
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def getResourceSet(self):
+        return [];
+
+    def actionConfig(self):
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        #
+        # Configure a VM with the PAE bootsector as floppy image.
+        #
+
+        oVM = self.createTestVM('tst-bs-pae', 2, sKind = 'Other', fVirtEx = False, fPae = False, \
+                                sFloppy = os.path.join(self.sVBoxBootSectors, 'bootsector-pae.img') );
+        if oVM is None:
+            return False;
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        return self.test1();
+
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def test1OneCfg(self, oVM, cCpus, fHwVirt, fNestedPaging):
+        """
+        Runs the specified VM thru test #1.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+
+        # Reconfigure the VM
+        fRc = True;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            fRc = fRc and oSession.enableVirtEx(fHwVirt);
+            fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
+            fRc = fRc and oSession.setCpuCount(cCpus);
+            fRc = fRc and oSession.setupBootLogo(True, 2500); # Race avoidance fudge.
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Zap the state (used by the callback).
+        self.fCallbackFired = False;
+        self.fCallbackSuccess = False;
+
+        # Start up.
+        if fRc is True:
+            self.logVmInfo(oVM);
+            oSession = self.startVm(oVM)
+            if oSession is not None:
+                # Set up a callback for catching the runtime error. !Races the guest bootup!
+                oConsoleCallbacks = oSession.registerDerivedEventHandler(tdCpuPae1ConsoleCallbacks, {'oTstDrv':self,})
+
+                fRc = False;
+                if oConsoleCallbacks is not None:
+                    self.addTask(oSession);
+
+                    # Wait for 30 seconds for something to finish.
+                    tsStart = base.timestampMilli();
+                    while base.timestampMilli() - tsStart < 30000:
+                        oTask = self.waitForTasks(1000);
+                        if oTask is not None:
+                            break;
+                        if self.fCallbackFired:
+                            break;
+                    if not self.fCallbackFired:
+                        reporter.testFailure('the callback did not fire');
+                    fRc = self.fCallbackSuccess;
+
+                    # cleanup.
+                    oConsoleCallbacks.unregister();
+                self.terminateVmBySession(oSession) #, fRc);
+            else:
+                fRc = False;
+        return fRc;
+
+
+    def test1(self):
+        """
+        Executes test #1 - Negative API testing.
+
+        ASSUMES that the VMs are
+        """
+        reporter.testStart('Test 1');
+        oVM = self.getVmByName('tst-bs-pae');
+
+        for cCpus in self.acCpus:
+            if cCpus == 1:  reporter.testStart('1 cpu');
+            else:           reporter.testStart('%u cpus' % (cCpus));
+
+            for sVirtMode in self.asVirtModes:
+                if sVirtMode == 'raw' and cCpus > 1:
+                    continue;
+
+                hsVirtModeDesc = {};
+                hsVirtModeDesc['raw']       = 'Raw-mode';
+                hsVirtModeDesc['hwvirt']    = 'HwVirt';
+                hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
+                reporter.testStart(hsVirtModeDesc[sVirtMode]);
+
+                fHwVirt       = sVirtMode != 'raw';
+                fNestedPaging = sVirtMode == 'hwvirt-np';
+                self.test1OneCfg(oVM, cCpus, fHwVirt, fNestedPaging);
+
+                reporter.testDone();
+            reporter.testDone();
+
+        return reporter.testDone()[1] == 0;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdCpuPae1().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/installation/Makefile.kmk b/src/VBox/ValidationKit/tests/installation/Makefile.kmk
new file mode 100644
index 0000000..dd82869
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/installation/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Automatic guest OS installation tests.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitInstallationTests
+ValidationKitInstallationTests_TEMPLATE = VBoxValidationKitR3
+ValidationKitInstallationTests_INST = $(INST_VALIDATIONKIT)tests/installation/
+ValidationKitInstallationTests_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdGuestOsInstTest1.py \
+	$(PATH_SUB_CURRENT)/tdGuestOsInstOs2.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitInstallationTests_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
diff --git a/src/VBox/ValidationKit/tests/installation/tdGuestOsInstOs2.py b/src/VBox/ValidationKit/tests/installation/tdGuestOsInstOs2.py
new file mode 100755
index 0000000..87cfc70
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/installation/tdGuestOsInstOs2.py
@@ -0,0 +1,248 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdGuestOsInstOs2.py $
+
+"""
+VirtualBox Validation Kit - OS/2 install tests.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 97235 $"
+
+
+# Standard Python imports.
+import os
+import sys
+
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0]
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(g_ksValidationKitDir)
+
+# Validation Kit imports.
+from testdriver import vbox
+from testdriver import base
+from testdriver import reporter
+from testdriver import vboxcon
+
+
+class tdGuestOsInstOs2(vbox.TestDriver):
+    """
+    OS/2 unattended installation.
+
+    Scenario:
+        - Create new VM that corresponds specified installation ISO image
+        - Create HDD that corresponds to OS type that will be installed
+        - Set VM boot order: HDD, Floppy, ISO
+        - Start VM: sinse there is no OS installed on HDD, VM will booted from floppy
+        - After first reboot VM will continue installation from HDD automatically
+        - Wait for incomming TCP connection (guest should initiate such a
+          connection in case installation has been completed successfully)
+    """
+
+    ksSataController = 'SATA Controller'
+    ksIdeController  = 'IDE Controller'
+
+    # VM parameters required to run ISO image.
+    # Format: (cBytesHdd, sKind)
+    kaoVmParams = {
+        'acp2-txs.iso': ( 2*1024*1024*1024, 'OS2', ksIdeController ),
+        'mcp2-txs.iso': ( 2*1024*1024*1024, 'OS2', ksIdeController ),
+    }
+
+    def __init__(self):
+        """
+        Reinitialize child class instance.
+        """
+        vbox.TestDriver.__init__(self)
+
+        self.sVmName             = 'TestVM'
+        self.sHddName            = 'TestHdd.vdi'
+        self.sIso                = None
+        self.sFloppy             = None
+        self.sIsoPathBase        = os.path.join(self.sResourcePath, '4.2', 'isos')
+        self.oVM                 = None
+        self.fEnableIOAPIC       = True
+        self.cCpus               = 1
+        self.fEnableNestedPaging = True
+        self.fEnablePAE          = False
+        self.asExtraData         = []
+
+    #
+    # Overridden methods.
+    #
+
+    def showUsage(self):
+        """
+        Extend usage info
+        """
+        rc = vbox.TestDriver.showUsage(self)
+        reporter.log('  --install-iso <ISO file name>')
+        reporter.log('  --cpus <# CPUs>')
+        reporter.log('  --no-ioapic')
+        reporter.log('  --no-nested-paging')
+        reporter.log('  --pae')
+        reporter.log('  --set-extradata <key>:value')
+        reporter.log('      Set VM extra data. This command line option might be used multiple times.')
+        return rc
+
+    def parseOption(self, asArgs, iArg):
+        """
+        Extend standard options set
+        """
+        if asArgs[iArg] == '--install-iso':
+            iArg += 1
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--install-iso" option requires an argument')
+            self.sIso = asArgs[iArg]
+        elif asArgs[iArg] == '--cpus':
+            iArg += 1
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--cpus" option requires an argument')
+            self.cCpus = int(asArgs[iArg])
+        elif asArgs[iArg] == '--no-ioapic':
+            self.fEnableIOAPIC = False
+        elif asArgs[iArg] == '--no-nested-paging':
+            self.fEnableNestedPaging = False
+        elif asArgs[iArg] == '--pae':
+            self.fEnablePAE = True
+        elif asArgs[iArg] == '--extra-mem':
+            self.fEnablePAE = True
+        elif asArgs[iArg] == '--set-extradata':
+            iArg = self.requireMoreArgs(1, asArgs, iArg)
+            self.asExtraData.append(asArgs[iArg])
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg)
+
+        return iArg + 1
+
+    def actionConfig(self):
+        """
+        Configure pre-conditions.
+        """
+
+        if not self.importVBoxApi():
+            return False
+
+        assert self.sIso is not None
+        if self.sIso not in self.kaoVmParams:
+            reporter.log('Error: unknown ISO image specified: %s' % self.sIso)
+            return False
+
+        # Get VM params specific to ISO image
+        cBytesHdd, sKind, sController = self.kaoVmParams[self.sIso]
+
+        # Create VM itself
+        eNic0AttachType = vboxcon.NetworkAttachmentType_NAT
+        self.sIso = os.path.join(self.sIsoPathBase, self.sIso)
+        assert os.path.isfile(self.sIso)
+
+        self.sFloppy = os.path.join(self.sIsoPathBase, os.path.splitext(self.sIso)[0] + '.img')
+
+        self.oVM = self.createTestVM(self.sVmName, 1, sKind = sKind, sDvdImage = self.sIso, cCpus = self.cCpus,
+                                     sFloppy = self.sFloppy, eNic0AttachType = eNic0AttachType)
+        assert self.oVM is not None
+
+        oSession = self.openSession(self.oVM)
+
+        # Create HDD
+        sHddPath = os.path.join(self.sScratchPath, self.sHddName)
+        fRc = True
+        if sController == self.ksSataController:
+            fRc = oSession.setStorageControllerType(vboxcon.StorageControllerType_IntelAhci, sController)
+
+        fRc = fRc and oSession.createAndAttachHd(sHddPath, cb = cBytesHdd,
+                                                 sController = sController, iPort = 0, fImmutable=False)
+        if sController == self.ksSataController:
+            fRc = fRc and oSession.setStorageControllerPortCount(sController, 1)
+
+        # Set proper boot order
+        fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk)
+        fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_Floppy)
+
+        # Enable HW virt
+        fRc = fRc and oSession.enableVirtEx(True)
+
+        # Enable I/O APIC
+        fRc = fRc and oSession.enableIoApic(self.fEnableIOAPIC)
+
+        # Enable Nested Paging
+        fRc = fRc and oSession.enableNestedPaging(self.fEnableNestedPaging)
+
+        # Enable PAE
+        fRc = fRc and oSession.enablePae(self.fEnablePAE)
+
+        # Remote desktop
+        oSession.setupVrdp(True)
+
+        # Set extra data
+        if self.asExtraData != []:
+            for sExtraData in self.asExtraData:
+                try:
+                    sKey, sValue = sExtraData.split(':')
+                except ValueError:
+                    raise base.InvalidOption('Invalid extradata specified: %s' % sExtraData)
+                reporter.log('Set extradata: %s => %s' % (sKey, sValue))
+                fRc = fRc and oSession.setExtraData(sKey, sValue)
+
+        fRc = fRc and oSession.saveSettings()
+        fRc = oSession.close()
+        assert fRc is True
+
+        return vbox.TestDriver.actionConfig(self)
+
+    def actionExecute(self):
+        """
+        Execute the testcase itself.
+        """
+        return self.testDoInstallGuestOs()
+
+    #
+    # Test execution helpers.
+    #
+
+    def testDoInstallGuestOs(self):
+        """
+        Install guest OS and wait for result
+        """
+
+        self.logVmInfo(self.oVM)
+        reporter.testStart('Installing %s' % (os.path.basename(self.sIso),))
+
+        cMsTimeout = 40*60000;
+        if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
+            cMsTimeout = 180 * 60000; # will be adjusted down.
+
+        oSession, _ = self.startVmAndConnectToTxsViaTcp(self.sVmName, fCdWait = False, cMsTimeout = cMsTimeout)
+        if oSession is not None:
+            # Wait until guest reported success
+            reporter.log('Guest reported success')
+            reporter.testDone()
+            fRc = self.terminateVmBySession(oSession)
+            return fRc is True
+        reporter.error('Installation of %s has failed' % (self.sIso,))
+        reporter.testDone()
+        return False
+
+if __name__ == '__main__':
+    sys.exit(tdGuestOsInstOs2().main(sys.argv))
diff --git a/src/VBox/ValidationKit/tests/installation/tdGuestOsInstTest1.py b/src/VBox/ValidationKit/tests/installation/tdGuestOsInstTest1.py
new file mode 100755
index 0000000..b8fdf92
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/installation/tdGuestOsInstTest1.py
@@ -0,0 +1,418 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdGuestOsInstTest1.py $
+
+"""
+VirtualBox Validation Kit - Guest OS installation tests.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 98737 $"
+
+
+# Standard Python imports.
+import os
+import sys
+
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0]
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(g_ksValidationKitDir)
+
+# Validation Kit imports.
+from testdriver import vbox;
+from testdriver import base;
+from testdriver import reporter;
+from testdriver import vboxcon;
+from testdriver import vboxtestvms;
+
+
+class InstallTestVm(vboxtestvms.TestVm):
+    """ Installation test VM. """
+
+    ## @name The primary controller, to which the disk will be attached.
+    ksSataController = 'SATA Controller'
+    ksIdeController  = 'IDE Controller'
+
+    ## @name VM option flags (OR together).
+    ## @{
+    kf32Bit                 = 0x01;
+    kf64Bit                 = 0x02;
+    kfReqIoApic             = 0x10;
+    kfReqIoApicSmp          = 0x20;
+    kfReqPae                = 0x40;
+    kfIdeIrqDelay           = 0x80;
+    kfUbuntuNewAmdBug       = 0x100;
+    kfNoWin81Paravirt       = 0x200;
+    ## @}
+
+    ## IRQ delay extra data config for win2k VMs.
+    kasIdeIrqDelay   = [ 'VBoxInternal/Devices/piix3ide/0/Config/IRQDelay:1', ];
+
+    ## Install ISO path relative to the testrsrc root.
+    ksIsoPathBase    = os.path.join('4.2', 'isos');
+
+    def __init__(self, oSet, sVmName, sKind, sInstallIso, sHdCtrlNm, cGbHdd, fFlags):
+        vboxtestvms.TestVm.__init__(self, oSet, sVmName, sKind = sKind, sHddControllerType = sHdCtrlNm,
+                                    fRandomPvPMode = (fFlags & self.kfNoWin81Paravirt) == 0);
+        self.sDvdImage    = os.path.join(self.ksIsoPathBase, sInstallIso);
+        self.cGbHdd       = cGbHdd;
+        self.fInstVmFlags = fFlags;
+        if fFlags & self.kfReqPae:
+            self.fPae     = True;
+        if fFlags & (self.kfReqIoApic | self.kfReqIoApicSmp):
+            self.fIoApic  = True;
+
+        # Tweaks
+        self.iOptRamAdjust  = 0;
+        self.asExtraData    = [];
+        if fFlags & self.kfIdeIrqDelay:
+            self.asExtraData = self.kasIdeIrqDelay;
+
+    def detatchAndDeleteHd(self, oTestDrv):
+        """
+        Detaches and deletes the HD.
+        Returns success indicator, error info logged.
+        """
+        fRc = False;
+        oVM = oTestDrv.getVmByName(self.sVmName);
+        if oVM is not None:
+            oSession = oTestDrv.openSession(oVM);
+            if oSession is not None:
+                (fRc, oHd) = oSession.detachHd(self.sHddControllerType, iPort = 0, iDevice = 0);
+                if fRc is True and oHd is not None:
+                    fRc = oSession.saveSettings();
+                    fRc = fRc and oTestDrv.oVBox.deleteHdByMedium(oHd);
+                    fRc = fRc and oSession.saveSettings(); # Necessary for media reg?
+                fRc = oSession.close() and fRc;
+        return fRc;
+
+    def getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode=None):
+        #
+        # Do the standard reconfig in the base class first, it'll figure out
+        # if we can run the VM as requested.
+        #
+        (fRc, oVM) = vboxtestvms.TestVm.getReconfiguredVm(self, oTestDrv, cCpus, sVirtMode, sParavirtMode);
+
+        #
+        # Make sure there is no HD from the previous run attached nor taking
+        # up storage on the host.
+        #
+        if fRc is True:
+            fRc = self.detatchAndDeleteHd(oTestDrv);
+
+        #
+        # Check for ubuntu installer vs. AMD host CPU.
+        #
+        if fRc is True and (self.fInstVmFlags & self.kfUbuntuNewAmdBug):
+            if self.isHostCpuAffectedByUbuntuNewAmdBug(oTestDrv):
+                return (None, None); # (skip)
+
+        #
+        # Make adjustments to the default config, and adding a fresh HD.
+        #
+        if fRc is True:
+            oSession = oTestDrv.openSession(oVM);
+            if oSession is not None:
+                if self.sHddControllerType == self.ksSataController:
+                    fRc = fRc and oSession.setStorageControllerType(vboxcon.StorageControllerType_IntelAhci,
+                                                                    self.sHddControllerType)
+                    fRc = fRc and oSession.setStorageControllerPortCount(self.sHddControllerType, 1)
+
+                try:
+                    sHddPath = os.path.join(os.path.dirname(oVM.settingsFilePath),
+                                            '%s-%s-%s.vdi' % (self.sVmName, sVirtMode, cCpus,));
+                except:
+                    reporter.errorXcpt();
+                    sHddPath = None;
+                    fRc = False;
+
+                fRc = fRc and oSession.createAndAttachHd(sHddPath,
+                                                         cb = self.cGbHdd * 1024*1024*1024,
+                                                         sController = self.sHddControllerType,
+                                                         iPort = 0,
+                                                         fImmutable = False);
+
+                # Set proper boot order
+                fRc = fRc and oSession.setBootOrder(1, vboxcon.DeviceType_HardDisk)
+                fRc = fRc and oSession.setBootOrder(2, vboxcon.DeviceType_DVD)
+
+                # Adjust memory if requested.
+                if self.iOptRamAdjust != 0:
+                    fRc = fRc and oSession.setRamSize(oSession.o.machine.memorySize + self.iOptRamAdjust);
+
+                # Set extra data
+                for sExtraData in self.asExtraData:
+                    try:
+                        sKey, sValue = sExtraData.split(':')
+                    except ValueError:
+                        raise base.InvalidOption('Invalid extradata specified: %s' % sExtraData)
+                    reporter.log('Set extradata: %s => %s' % (sKey, sValue))
+                    fRc = fRc and oSession.setExtraData(sKey, sValue)
+
+                # Other variations?
+
+                # Save the settings.
+                fRc = fRc and oSession.saveSettings()
+                fRc = oSession.close() and fRc;
+            else:
+                fRc = False;
+            if fRc is not True:
+                oVM = None;
+
+        # Done.
+        return (fRc, oVM)
+
+    def isHostCpuAffectedByUbuntuNewAmdBug(self, oTestDrv):
+        """
+        Checks if the host OS is affected by older ubuntu installers being very
+        picky about which families of AMD CPUs it would run on.
+
+        The installer checks for family 15, later 16, later 20, and in 11.10
+        they remove the family check for AMD CPUs.
+        """
+        if not oTestDrv.isHostCpuAmd():
+            return False;
+        try:
+            (uMaxExt, _, _, _) = oTestDrv.oVBox.host.getProcessorCPUIDLeaf(0, 0x80000000, 0);
+            (uFamilyModel, _, _, _) = oTestDrv.oVBox.host.getProcessorCPUIDLeaf(0, 0x80000001, 0);
+        except:
+            reporter.logXcpt();
+            return False;
+        if uMaxExt < 0x80000001 or uMaxExt > 0x8000ffff:
+            return False;
+
+        uFamily = (uFamilyModel >> 8) & 0xf
+        if uFamily == 0xf:
+            uFamily = ((uFamilyModel >> 20) & 0x7f) + 0xf;
+        ## @todo Break this down into which old ubuntu release supports exactly
+        ##       which AMD family, if we care.
+        if uFamily <= 15:
+            return False;
+        reporter.log('Skipping "%s" because host CPU is a family %u AMD, which may cause trouble for the guest OS installer.'
+                     % (self.sVmName, uFamily,));
+        return True;
+
+
+
+
+
+class tdGuestOsInstTest1(vbox.TestDriver):
+    """
+    Guest OS installation tests.
+
+    Scenario:
+        - Create new VM that corresponds specified installation ISO image.
+        - Create HDD that corresponds to OS type that will be installed.
+        - Boot VM from ISO image (i.e. install guest OS).
+        - Wait for incomming TCP connection (guest should initiate such a
+          connection in case installation has been completed successfully).
+    """
+
+
+    def __init__(self):
+        """
+        Reinitialize child class instance.
+        """
+        vbox.TestDriver.__init__(self)
+        self.fLegacyOptions = False;
+        assert self.fEnableVrdp; # in parent driver.
+
+        #
+        # Our install test VM set.
+        #
+        oSet = vboxtestvms.TestVmSet(self.oTestVmManager, fIgnoreSkippedVm = True);
+        oSet.aoTestVms.extend([
+            # pylint: disable=C0301
+            InstallTestVm(oSet, 'tst-fedora4',      'Fedora',           'fedora4-txs.iso',          InstallTestVm.ksIdeController,   8, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-fedora5',      'Fedora',           'fedora5-txs.iso',          InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApicSmp),
+            InstallTestVm(oSet, 'tst-fedora6',      'Fedora',           'fedora6-txs.iso',          InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfReqIoApic),
+            InstallTestVm(oSet, 'tst-fedora7',      'Fedora',           'fedora7-txs.iso',          InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqIoApic),
+            InstallTestVm(oSet, 'tst-fedora9',      'Fedora',           'fedora9-txs.iso',          InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-fedora18-64',  'Fedora_64',        'fedora18-x64-txs.iso',     InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
+            InstallTestVm(oSet, 'tst-fedora18',     'Fedora',           'fedora18-txs.iso',         InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-ols6',         'Oracle',           'ols6-i386-txs.iso',        InstallTestVm.ksSataController, 12, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
+            InstallTestVm(oSet, 'tst-ols6-64',      'Oracle_64',        'ols6-x86_64-txs.iso',      InstallTestVm.ksSataController, 12, InstallTestVm.kf64Bit),
+            InstallTestVm(oSet, 'tst-rhel5',        'RedHat',           'rhel5-txs.iso',            InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApic),
+            InstallTestVm(oSet, 'tst-suse102',      'OpenSUSE',         'opensuse102-txs.iso',      InstallTestVm.ksIdeController,   8, InstallTestVm.kf32Bit | InstallTestVm.kfReqIoApic),
+            ## @todo InstallTestVm(oSet, 'tst-ubuntu606',    'Ubuntu',           'ubuntu606-txs.iso',        InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
+            ## @todo InstallTestVm(oSet, 'tst-ubuntu710',    'Ubuntu',           'ubuntu710-txs.iso',        InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-ubuntu804',    'Ubuntu',           'ubuntu804-txs.iso',        InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae | InstallTestVm.kfReqIoApic),
+            InstallTestVm(oSet, 'tst-ubuntu804-64', 'Ubuntu_64',        'ubuntu804-amd64-txs.iso',  InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
+            InstallTestVm(oSet, 'tst-ubuntu904',    'Ubuntu',           'ubuntu904-txs.iso',        InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae),
+            InstallTestVm(oSet, 'tst-ubuntu904-64', 'Ubuntu_64',        'ubuntu904-amd64-txs.iso',  InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
+            #InstallTestVm(oSet, 'tst-ubuntu1404',   'Ubuntu',           'ubuntu1404-txs.iso',       InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfUbuntuNewAmdBug | InstallTestVm.kfReqPae), bird: Is 14.04 one of the 'older ones'?
+            InstallTestVm(oSet, 'tst-ubuntu1404',   'Ubuntu',           'ubuntu1404-txs.iso',       InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit | InstallTestVm.kfReqPae),
+            InstallTestVm(oSet, 'tst-ubuntu1404-64','Ubuntu_64',        'ubuntu1404-amd64-txs.iso', InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
+            InstallTestVm(oSet, 'tst-debian7',      'Debian',           'debian-7.0.0-txs.iso',     InstallTestVm.ksSataController,  8, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-debian7-64',   'Debian_64',        'debian-7.0.0-x64-txs.iso', InstallTestVm.ksSataController,  8, InstallTestVm.kf64Bit),
+            InstallTestVm(oSet, 'tst-w7-64',        'Windows7_64',      'win7-x64-txs.iso',         InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
+            InstallTestVm(oSet, 'tst-w7-32',        'Windows7',         'win7-x86-txs.iso',         InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-w2k3',         'Windows2003',      'win2k3ent-txs.iso',        InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-w2k',          'Windows2000',      'win2ksp0-txs.iso',         InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit | InstallTestVm.kfIdeIrqDelay),
+            InstallTestVm(oSet, 'tst-w2ksp4',       'Windows2000',      'win2ksp4-txs.iso',         InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit | InstallTestVm.kfIdeIrqDelay),
+            InstallTestVm(oSet, 'tst-wxp',          'WindowsXP',        'winxppro-txs.iso',         InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-wxpsp2',       'WindowsXP',        'winxpsp2-txs.iso',         InstallTestVm.ksIdeController,  25, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-wxp64',        'WindowsXP_64',     'winxp64-txs.iso',          InstallTestVm.ksIdeController,  25, InstallTestVm.kf64Bit),
+            ## @todo disable paravirt for Windows 8.1 guests as long as it's not fixed in the code
+            InstallTestVm(oSet, 'tst-w81-32',       'Windows81',        'win81-x86-txs.iso',        InstallTestVm.ksSataController, 25, InstallTestVm.kf32Bit),
+            InstallTestVm(oSet, 'tst-w81-64',       'Windows81_64',     'win81-x64-txs.iso',        InstallTestVm.ksSataController, 25, InstallTestVm.kf64Bit),
+            # pylint: enable=C0301
+        ]);
+        self.oTestVmSet = oSet;
+
+
+
+    #
+    # Overridden methods.
+    #
+
+    def showUsage(self):
+        """
+        Extend usage info
+        """
+        rc = vbox.TestDriver.showUsage(self)
+        reporter.log('');
+        reporter.log('tdGuestOsInstTest1 options:');
+        reporter.log('  --ioapic, --no-ioapic');
+        reporter.log('      Enable or disable the I/O apic.');
+        reporter.log('      Default: --ioapic');
+        reporter.log('  --pae, --no-pae');
+        reporter.log('      Enable or disable PAE support for 32-bit guests.');
+        reporter.log('      Default: Guest dependent.');
+        reporter.log('  --ram-adjust <MBs>')
+        reporter.log('      Adjust the VM ram size by the given delta.  Both negative and positive');
+        reporter.log('      values are accepted.');
+        reporter.log('  --set-extradata <key>:value')
+        reporter.log('      Set VM extra data. This command line option might be used multiple times.')
+        reporter.log('obsolete:');
+        reporter.log('  --nested-paging, --no-nested-paging');
+        reporter.log('  --raw-mode');
+        reporter.log('  --cpus <# CPUs>');
+        reporter.log('  --install-iso <ISO file name>');
+
+        return rc
+
+    def parseOption(self, asArgs, iArg):
+        """
+        Extend standard options set
+        """
+
+        if False:
+            pass;
+        elif asArgs[iArg] == '--ioapic':
+            for oTestVm in self.oTestVmSet.aoTestVms:
+                oTestVm.fIoApic = True;
+        elif asArgs[iArg] == '--no-ioapic':
+            for oTestVm in self.oTestVmSet.aoTestVms:
+                oTestVm.fIoApic = False;
+        elif asArgs[iArg] == '--pae':
+            for oTestVm in self.oTestVmSet.aoTestVms:
+                oTestVm.fPae = True;
+        elif asArgs[iArg] == '--no-pae':
+            for oTestVm in self.oTestVmSet.aoTestVms:
+                oTestVm.fPae = False;
+        elif asArgs[iArg] == '--ram-adjust':
+            iArg = self.requireMoreArgs(1, asArgs, iArg);
+            for oTestVm in self.oTestVmSet.aoTestVms:
+                oTestVm.iOptRamAdjust = int(asArgs[iArg]);
+        elif asArgs[iArg] == '--set-extradata':
+            iArg = self.requireMoreArgs(1, asArgs, iArg)
+            for oTestVm in self.oTestVmSet.aoTestVms:
+                oTestVm.asExtraData.append(asArgs[iArg]);
+
+        # legacy, to be removed once TM is reconfigured.
+        elif asArgs[iArg] == '--install-iso':
+            self.legacyOptions();
+            iArg = self.requireMoreArgs(1, asArgs, iArg);
+            for oTestVm in self.oTestVmSet.aoTestVms:
+                oTestVm.fSkip = os.path.basename(oTestVm.sDvdImage) != asArgs[iArg];
+        elif asArgs[iArg] == '--cpus':
+            self.legacyOptions();
+            iArg = self.requireMoreArgs(1, asArgs, iArg);
+            self.oTestVmSet.acCpus = [ int(asArgs[iArg]), ];
+        elif asArgs[iArg] == '--raw-mode':
+            self.legacyOptions();
+            self.oTestVmSet.asVirtModes = [ 'raw', ];
+        elif asArgs[iArg] == '--nested-paging':
+            self.legacyOptions();
+            self.oTestVmSet.asVirtModes = [ 'hwvirt-np', ];
+        elif asArgs[iArg] == '--no-nested-paging':
+            self.legacyOptions();
+            self.oTestVmSet.asVirtModes = [ 'hwvirt', ];
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg)
+
+        return iArg + 1
+
+    def legacyOptions(self):
+        """ Enables legacy option mode. """
+        if not self.fLegacyOptions:
+            self.fLegacyOptions = True;
+            self.oTestVmSet.asVirtModes = [ 'hwvirt', ];
+            self.oTestVmSet.acCpus      = [ 1, ];
+        return True;
+
+    def actionConfig(self):
+        if not self.importVBoxApi(): # So we can use the constant below.
+            return False;
+        return self.oTestVmSet.actionConfig(self, eNic0AttachType = vboxcon.NetworkAttachmentType_NAT);
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        return self.oTestVmSet.actionExecute(self, self.testOneVmConfig)
+
+    def testOneVmConfig(self, oVM, oTestVm):
+        """
+        Install guest OS and wait for result
+        """
+
+        self.logVmInfo(oVM)
+        reporter.testStart('Installing %s' % (oTestVm.sVmName,))
+
+        cMsTimeout = 40*60000;
+        if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ...
+            cMsTimeout = 180 * 60000; # will be adjusted down.
+
+        oSession, _ = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = False, cMsTimeout = cMsTimeout);
+        if oSession is not None:
+            # The guest has connected to TXS, so we're done (for now anyways).
+            reporter.log('Guest reported success')
+            ## @todo Do save + restore.
+
+            reporter.testDone()
+            fRc = self.terminateVmBySession(oSession)
+            return fRc is True
+
+        reporter.error('Installation of %s has failed' % (oTestVm.sVmName,))
+        oTestVm.detatchAndDeleteHd(self); # Save space.
+        reporter.testDone()
+        return False
+
+if __name__ == '__main__':
+    sys.exit(tdGuestOsInstTest1().main(sys.argv))
+
diff --git a/src/VBox/ValidationKit/tests/network/Makefile.kmk b/src/VBox/ValidationKit/tests/network/Makefile.kmk
new file mode 100644
index 0000000..4b7f549
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/network/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Network Tests.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsNetwork
+ValidationKitTestsNetwork_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsNetwork_INST = $(INST_VALIDATIONKIT)tests/network/
+ValidationKitTestsNetwork_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdNetBenchmark1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsNetwork_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/network/tdNetBenchmark1.py b/src/VBox/ValidationKit/tests/network/tdNetBenchmark1.py
new file mode 100755
index 0000000..8d35617
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/network/tdNetBenchmark1.py
@@ -0,0 +1,621 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdNetBenchmark1.py $
+
+"""
+VirtualBox Validation Kit - Networking benchmark #1.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os;
+import socket
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+
+
+class tdNetBenchmark1(vbox.TestDriver):                                         # pylint: disable=R0902
+    """
+    Networking benchmark #1.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs            = None;
+        self.sLocalName         = socket.getfqdn();
+        self.sLocalIP           = None
+        self.sRemoteName        = None;
+        self.sRemoteIP          = None;
+        self.sGuestName         = None;
+        self.sGuestIP           = None;
+        self.oGuestToGuestVM    = None;
+        self.oGuestToGuestSess  = None;
+        self.oGuestToGuestTxs   = None;
+        self.asTestVMsDef       = ['tst-rhel5', 'tst-win2k3ent', 'tst-sol10'];
+        self.asTestVMs          = self.asTestVMsDef;
+        self.asSkipVMs          = [];
+        self.asVirtModesDef     = ['hwvirt', 'hwvirt-np', 'raw',]
+        self.asVirtModes        = self.asVirtModesDef
+        self.acCpusDef          = [1, 2,]
+        self.acCpus             = self.acCpusDef;
+        self.asNicTypesDef      = ['E1000', 'PCNet', 'Virtio',];
+        self.asNicTypes         = self.asNicTypesDef;
+        self.sNicAttachmentDef  = 'bridged';
+        self.sNicAttachment     = self.sNicAttachmentDef;
+        self.asSetupsDef        = ['g2h', 'g2r', 'g2g',];
+        self.asSetups           = self.asSetupsDef;
+        self.cSecsRunDef        = 30;
+        self.cSecsRun           = self.cSecsRunDef;
+        self.asTestsDef         = ['tcp-latency', 'tcp-throughput', 'udp-latency', 'udp-throughput', 'tbench'];
+        self.asTests            = self.asTestsDef
+        self.acbLatencyPktsDef  = [32, 1024, 4096, 8192, 65536,];
+        self.acbLatencyPkts     = self.acbLatencyPktsDef
+        self.acbThroughputPktsDef = [8192, 65536];
+        self.acbThroughputPkts  = self.acbThroughputPktsDef
+
+        try: self.sLocalName = socket.gethostbyname(self.sLocalName);
+        except: pass;
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdNetBenchmark1 Options:');
+        reporter.log('  --remote-host  <hostname|address>');
+        reporter.log('  --local-host   <hostname|address>');
+        reporter.log('  --guest-host   <hostname|address>');
+        reporter.log('  --virt-modes   <m1[:m2[:]]');
+        reporter.log('      Default: %s' % (':'.join(self.asVirtModesDef)));
+        reporter.log('  --cpu-counts   <c1[:c2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
+        reporter.log('  --nic-types    <type1[:type2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asNicTypes)));
+        reporter.log('  --nic-attachment <bridged|nat>');
+        reporter.log('      Default: %s' % (self.sNicAttachmentDef));
+        reporter.log('  --setups       <s1[:s2[:]]>');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asSetupsDef)));
+        reporter.log('  --secs-per-run <seconds>');
+        reporter.log('      Default: %s' % (self.cSecsRunDef));
+        reporter.log('  --tests        <s1[:s2[:]]>');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestsDef)));
+        reporter.log('  --latency-sizes <size1[:size2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(str(cb) for cb in self.acbLatencyPktsDef))); # pychecker bug?
+        reporter.log('  --throughput-sizes <size1[:size2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(str(cb) for cb in self.acbThroughputPktsDef))); # pychecker bug?
+        reporter.log('  --test-vms     <vm1[:vm2[:...]]>');
+        reporter.log('      Test the specified VMs in the given order. Use this to change');
+        reporter.log('      the execution order or limit the choice of VMs');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestVMsDef)));
+        reporter.log('  --skip-vms     <vm1[:vm2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        reporter.log('  --quick');
+        reporter.log('      Shorthand for: --virt-modes hwvirt --cpu-counts 1 --secs-per-run 5 --latency-sizes 32');
+        reporter.log('                     --throughput-sizes 8192 --test-vms tst-rhel5:tst-win2k3ent:tst-sol10');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        if asArgs[iArg] == '--remote-host':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--remote-host" takes an IP address or a hostname');
+            self.sRemoteName = asArgs[iArg];
+        elif asArgs[iArg] == '--local-host':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--local-host" takes an IP address or a hostname');
+            self.sLocalName = asArgs[iArg];
+        elif asArgs[iArg] == '--guest-host':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--guest-host" takes an IP address or a hostname');
+            self.sGuestName = asArgs[iArg];
+        elif asArgs[iArg] == '--virt-modes':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
+            self.asVirtModes = asArgs[iArg].split(':');
+            for s in self.asVirtModes:
+                if s not in self.asVirtModesDef:
+                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asVirtModesDef)));
+        elif asArgs[iArg] == '--cpu-counts':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
+            self.acCpus = [];
+            for s in asArgs[iArg].split(':'):
+                try: c = int(s);
+                except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
+                if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
+                self.acCpus.append(c);
+        elif asArgs[iArg] == '--nic-types':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--nic-types" takes a colon separated list of NIC types');
+            self.asNicTypes = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--nic-attachment':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--nic-attachment" takes an argument');
+            self.sNicAttachment = asArgs[iArg];
+            if self.sNicAttachment not in ('bridged', 'nat'):
+                raise base.InvalidOption('The "--nic-attachment" value "%s" is not supported. Valid values are: bridged, nat' \
+                        % (self.sNicAttachment));
+        elif asArgs[iArg] == '--setups':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--setups" takes a colon separated list of setups');
+            self.asSetups = asArgs[iArg].split(':');
+            for s in self.asSetups:
+                if s not in self.asSetupsDef:
+                    raise base.InvalidOption('The "--setups" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asSetupsDef)));
+        elif asArgs[iArg] == '--secs-per-run':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--secs-per-run" takes second count');
+            try:    self.cSecsRun = int(asArgs[iArg]);
+            except: raise base.InvalidOption('The "--secs-per-run" value "%s" is not an integer' % (self.cSecsRun,));
+            if self.cSecsRun <= 0:
+                raise base.InvalidOption('The "--secs-per-run" value "%s" is zero or negative.' % (self.cSecsRun,));
+        elif asArgs[iArg] == '--tests':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of tests');
+            self.asTests = asArgs[iArg].split(':');
+            for s in self.asTests:
+                if s not in self.asTestsDef:
+                    raise base.InvalidOption('The "--tests" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestsDef)));
+        elif asArgs[iArg] == '--latency-sizes':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--latency-sizes" takes a colon separated list of sizes');
+            self.acbLatencyPkts = [];
+            for s in asArgs[iArg].split(':'):
+                try: cb = int(s);
+                except: raise base.InvalidOption('The "--latency-sizes" value "%s" is not an integer' % (s,));
+                if cb <= 0: raise base.InvalidOption('The "--latency-sizes" value "%s" is zero or negative' % (s,));
+                self.acbLatencyPkts.append(cb);
+        elif asArgs[iArg] == '--throughput-sizes':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--throughput-sizes" takes a colon separated list of sizes');
+            self.acbThroughputPkts = [];
+            for s in asArgs[iArg].split(':'):
+                try: cb = int(s);
+                except: raise base.InvalidOption('The "--throughput-sizes" value "%s" is not an integer' % (s,));
+                if cb <= 0: raise base.InvalidOption('The "--throughput-sizes" value "%s" is zero or negative' % (s,));
+                self.acbThroughputPkts.append(cb);
+        elif asArgs[iArg] == '--test-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
+            self.asTestVMs = asArgs[iArg].split(':');
+            for s in self.asTestVMs:
+                if s not in self.asTestVMsDef:
+                    raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestVMsDef)));
+        elif asArgs[iArg] == '--skip-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
+            self.asSkipVMs = asArgs[iArg].split(':');
+            for s in self.asSkipVMs:
+                if s not in self.asTestVMsDef:
+                    reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
+        elif asArgs[iArg] == '--quick':
+            self.cSecsRun           = 5;
+            self.asVirtModes        = ['hwvirt',];
+            self.acCpus             = [1,];
+            self.acbLatencyPkts     = [32,];
+            self.acbThroughputPkts  = [8192,];
+            self.asTestVMs          = ['tst-rhel5', 'tst-win2k3ent', 'tst-sol10',];
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        # Remove skipped VMs from the test list.
+        for sVM in self.asSkipVMs:
+            try:    self.asTestVMs.remove(sVM);
+            except: pass;
+
+        # Resolve any names we've been given.
+        self.sLocalIP  = base.tryGetHostByName(self.sLocalName);
+        self.sRemoteIP = base.tryGetHostByName(self.sRemoteName);
+        self.sGuestIP  = base.tryGetHostByName(self.sGuestName);
+
+        reporter.log('Local IP : %s' % (self.sLocalIP));
+        reporter.log('Remote IP: %s' % (self.sRemoteIP));
+        if self.sGuestIP is None:
+            reporter.log('Guest IP : use tst-guest2guest');
+        else:
+            reporter.log('Guest IP : %s' % (self.sGuestIP));
+
+        return vbox.TestDriver.completeOptions(self);
+
+    def getResourceSet(self):
+        # Construct the resource list the first time it's queried.
+        if self.asRsrcs is None:
+            self.asRsrcs = [];
+            if 'tst-rhel5' in self.asTestVMs  or  'g2g' in self.asSetups:
+                self.asRsrcs.append('3.0/tcp/rhel5.vdi');
+            if 'tst-rhel5-64' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/rhel5-64.vdi');
+            if 'tst-sles11' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/sles11.vdi');
+            if 'tst-sles11-64' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/sles11-64.vdi');
+            if 'tst-oel' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/oel.vdi');
+            if 'tst-oel-64' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/oel-64.vdi');
+            if 'tst-win2k3ent' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/win2k3ent-acpi.vdi');
+            if 'tst-win2k3ent-64' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/win2k3ent-64.vdi');
+            if 'tst-win2k8' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/win2k8.vdi');
+            if 'tst-sol10' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/solaris10.vdi');
+            if 'tst-sol11' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/solaris11.vdi');
+        return self.asRsrcs;
+
+    def actionConfig(self):
+        # Some stupid trickery to guess the location of the iso. ## fixme - testsuite unzip ++
+        sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxValidationKit.iso'));
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxTestSuite.iso'));
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/validationkit/VBoxValidationKit.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/testsuite/VBoxTestSuite.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sCur = os.getcwd();
+            for i in range(0, 10):
+                sVBoxValidationKit_iso = os.path.join(sCur, 'validationkit/VBoxValidationKit.iso');
+                if os.path.isfile(sVBoxValidationKit_iso):
+                    break;
+                sVBoxValidationKit_iso = os.path.join(sCur, 'testsuite/VBoxTestSuite.iso');
+                if os.path.isfile(sVBoxValidationKit_iso):
+                    break;
+                sCur = os.path.abspath(os.path.join(sCur, '..'));
+                if i is None: pass; # shut up pychecker/pylint.
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/home/bird/validationkit/VBoxValidationKit.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/home/bird/testsuite/VBoxTestSuite.iso';
+
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        # Guest to Guest VM.
+        if self.sGuestName is None and 'g2g' in self.asSetups:
+            oVM = self.createTestVM('tst-guest2guest', 0, '3.0/tcp/rhel5.vdi', sKind = 'RedHat', fIoApic = True, \
+                    eNic0Type = vboxcon.NetworkAdapterType_I82545EM, \
+                    eNic0AttachType = vboxcon.NetworkAttachmentType_Bridged, \
+                    fVirtEx = True, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+            self.oGuestToGuestVM = oVM;
+
+        #
+        # Configure the VMs we're going to use.
+        #
+        eNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
+        if self.sNicAttachment == 'nat':
+            eNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
+
+        # Linux VMs
+        if 'tst-rhel5' in self.asTestVMs:
+            oVM = self.createTestVM('tst-rhel5', 1, '3.0/tcp/rhel5.vdi', sKind = 'RedHat', fIoApic = True, \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-rhel5-64' in self.asTestVMs:
+            oVM = self.createTestVM('tst-rhel5-64', 1, '3.0/tcp/rhel5-64.vdi', sKind = 'RedHat_64', \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-sles11' in self.asTestVMs:
+            oVM = self.createTestVM('tst-sles11', 1, '3.0/tcp/sles11.vdi', sKind = 'OpenSUSE', fIoApic = True, \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-sles11-64' in self.asTestVMs:
+            oVM = self.createTestVM('tst-sles11-64', 1, '3.0/tcp/sles11-64.vdi', sKind = 'OpenSUSE_64', \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-oel' in self.asTestVMs:
+            oVM = self.createTestVM('tst-oel', 1, '3.0/tcp/oel.vdi', sKind = 'Oracle', fIoApic = True, \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-oel-64' in self.asTestVMs:
+            oVM = self.createTestVM('tst-oel-64', 1, '3.0/tcp/oel-64.vdi', sKind = 'Oracle_64', \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        # Windows VMs
+        if 'tst-win2k3ent' in self.asTestVMs:
+            oVM = self.createTestVM('tst-win2k3ent', 1, '3.0/tcp/win2k3ent-acpi.vdi', sKind = 'Windows2003', \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-win2k3ent-64' in self.asTestVMs:
+            oVM = self.createTestVM('tst-win2k3ent-64', 1, '3.0/tcp/win2k3ent-64.vdi', sKind = 'Windows2003_64', \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-win2k8' in self.asTestVMs:
+            oVM = self.createTestVM('tst-win2k8', 1, '3.0/tcp/win2k8.vdi', sKind = 'Windows2008_64', \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        # Solaris VMs
+        if 'tst-sol10' in self.asTestVMs:
+            oVM = self.createTestVM('tst-sol10', 1, '3.0/tcp/solaris10.vdi', sKind = 'Solaris_64', \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-sol11' in self.asTestVMs:
+            oVM = self.createTestVM('tst-sol11', 1, '3.0/tcp/os2009-11.vdi', sKind = 'Solaris_64', \
+                eNic0AttachType = eNic0AttachType, sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        fRc = self.test1();
+        return fRc;
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def test1RunTestProgs(self, oTxsSession, fRc, sTestName, sAddr):
+        """
+        Runs all the test programs against one 'server' machine.
+        """
+        reporter.testStart(sTestName);
+
+        reporter.testStart('TCP latency');
+        if fRc and 'tcp-latency' in self.asTests and sAddr is not None:
+            for cbPkt in self.acbLatencyPkts:
+                fRc = self.txsRunTest(oTxsSession, '%u bytes' % (cbPkt), self.cSecsRun * 1000 * 4, \
+                    '${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}',
+                        ('NetPerf', '--client', sAddr, '--interval', self.cSecsRun, '--len', cbPkt, '--mode', 'latency'));
+                if not fRc:
+                    break;
+            reporter.testDone();
+        else:
+            reporter.testDone(fSkipped = True);
+
+        reporter.testStart('TCP throughput');
+        if fRc and 'tcp-throughput' in self.asTests and sAddr is not None:
+            for cbPkt in self.acbThroughputPkts:
+                fRc = self.txsRunTest(oTxsSession, '%u bytes' % (cbPkt), self.cSecsRun * 2 * 1000 * 4, \
+                    '${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}',
+                        ('NetPerf', '--client', sAddr, '--interval', self.cSecsRun, '--len', cbPkt, '--mode', 'throughput'));
+                if not fRc:
+                    break;
+            reporter.testDone();
+        else:
+            reporter.testDone(fSkipped = True);
+
+        reporter.testStart('UDP latency');
+        if fRc and 'udp-latency' in self.asTests and sAddr is not None:
+            ## @todo Netperf w/UDP.
+            reporter.testDone(fSkipped = True);
+        else:
+            reporter.testDone(fSkipped = True);
+
+        reporter.testStart('UDP throughput');
+        if fRc and 'udp-throughput' in self.asTests and sAddr is not None:
+            ## @todo Netperf w/UDP.
+            reporter.testDone(fSkipped = True);
+        else:
+            reporter.testDone(fSkipped = True);
+
+        reporter.testStart('tbench');
+        if fRc and 'tbench' in self.asTests and sAddr is not None:
+            ## @todo tbench.
+            reporter.testDone(fSkipped = True);
+        else:
+            reporter.testDone(fSkipped = True);
+
+        reporter.testDone(not fRc);
+        return fRc;
+
+    def test1OneCfg(self, sVmName, eNicType, cCpus, fHwVirt, fNestedPaging):
+        """
+        Runs the specified VM thru test #1.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+        oVM = self.getVmByName(sVmName);
+
+        # Reconfigure the VM
+        fRc = True;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            fRc = fRc and oSession.setNicType(eNicType);
+            fRc = fRc and oSession.enableVirtEx(fHwVirt);
+            fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
+            fRc = fRc and oSession.setCpuCount(cCpus);
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Start up.
+        if fRc is True:
+            self.logVmInfo(oVM);
+            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = True);
+            if oSession is not None:
+                self.addTask(oSession);
+
+                # Fudge factor - Allow the guest to finish starting up.
+                self.sleep(5);
+
+                # Benchmark #1 - guest <-> host.
+                if 'g2h' in self.asSetups:
+                    self.test1RunTestProgs(oTxsSession, fRc, 'guest <-> host',  self.sLocalIP);
+
+                # Benchmark #2 - guest <-> host.
+                if 'g2r' in self.asSetups:
+                    self.test1RunTestProgs(oTxsSession, fRc, 'guest <-> remote', self.sRemoteIP);
+
+                # Benchmark #3 - guest <-> guest.
+                if 'g2g' in self.asSetups:
+                    self.test1RunTestProgs(oTxsSession, fRc, 'guest <-> guest',  self.sGuestIP);
+
+                # cleanup.
+                self.removeTask(oTxsSession);
+                self.terminateVmBySession(oSession)
+            else:
+                fRc = False;
+        return fRc;
+
+    def test1OneVM(self, sVmName, asSkipNicTypes = (), asSupVirtModes = None, rSupCpus = range(1, 256)):
+        """
+        Runs one VM thru the various configurations.
+        """
+        if asSupVirtModes is None:
+            asSupVirtModes = self.asVirtModes;
+
+        reporter.testStart(sVmName);
+        fRc = True;
+        for sNicType in self.asNicTypes:
+            if sNicType in asSkipNicTypes:
+                continue;
+            reporter.testStart(sNicType);
+
+            if sNicType == 'E1000':
+                eNicType = vboxcon.NetworkAdapterType_I82545EM;
+            elif sNicType == 'PCNet':
+                eNicType = vboxcon.NetworkAdapterType_Am79C973;
+            elif sNicType == 'Virtio':
+                eNicType = vboxcon.NetworkAdapterType_Virtio;
+            else:
+                eNicType = None;
+
+            for cCpus in self.acCpus:
+                if cCpus == 1:  reporter.testStart('1 cpu');
+                else:           reporter.testStart('%u cpus' % (cCpus));
+
+                for sVirtMode in self.asVirtModes:
+                    if sVirtMode == 'raw' and cCpus > 1:
+                        continue;
+                    if cCpus not in rSupCpus:
+                        continue;
+                    if sVirtMode not in asSupVirtModes:
+                        continue;
+                    hsVirtModeDesc = {};
+                    hsVirtModeDesc['raw']       = 'Raw-mode';
+                    hsVirtModeDesc['hwvirt']    = 'HwVirt';
+                    hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
+                    reporter.testStart(hsVirtModeDesc[sVirtMode]);
+
+                    fHwVirt       = sVirtMode != 'raw';
+                    fNestedPaging = sVirtMode == 'hwvirt-np';
+                    fRc = self.test1OneCfg(sVmName, eNicType, cCpus, fHwVirt, fNestedPaging)  and  fRc and True; # pychecker hack.
+
+                    reporter.testDone();
+                reporter.testDone();
+            reporter.testDone();
+        reporter.testDone();
+        return fRc;
+
+    def test1(self):
+        """
+        Executes test #1.
+        """
+
+        # Start the VM for the guest to guest testing, if required.
+        fRc = True;
+        if 'g2g' in self.asSetups  and  self.sGuestName is None:
+            self.oGuestToGuestSess, self.oGuestToGuestTxs = self.startVmAndConnectToTxsViaTcp('tst-guest2guest', fCdWait = True);
+            if self.oGuestToGuestSess is None:
+                return False;
+            self.sGuestIP = self.oGuestToGuestSess.getPrimaryIp();
+            reporter.log('tst-guest2guest IP: %s' % (self.sGuestIP));
+
+            # Start the test servers on it.
+            fRc = self.oGuestToGuestTxs.syncExec('${CDROM}/${OS/ARCH}/NetPerf${EXESUFF}',
+                    ('NetPerf', '--server', '--daemonize'), fWithTestPipe=False);
+
+        # Loop thru the test VMs.
+        if fRc:
+            for sVM in self.asTestVMs:
+                # figure args.
+                asSkipNicTypes = [];
+                if sVM not in ('tst-sles11', 'tst-sles11-64'):
+                    asSkipNicTypes.append('Virtio');
+                if sVM in ('tst-sol11', 'tst-sol10'):
+                    asSkipNicTypes.append('PCNet');
+                asSupVirtModes = None;
+                if sVM in ('tst-sol11', 'tst-sol10'): # 64-bit only
+                    asSupVirtModes = ('hwvirt', 'hwvirt-np',);
+
+                # run test on the VM.
+                if not self.test1OneVM(sVM, asSkipNicTypes, asSupVirtModes):
+                    fRc = False;
+
+        # Kill the guest to guest VM and clean up the state.
+        if self.oGuestToGuestSess is not None:
+            self.terminateVmBySession(self.oGuestToGuestSess);
+            self.oGuestToGuestSess = None;
+            self.oGuestToGuestTxs  = None;
+            self.sGuestIP          = None;
+
+        return fRc;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdNetBenchmark1().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/selftests/Makefile.kmk b/src/VBox/ValidationKit/tests/selftests/Makefile.kmk
new file mode 100644
index 0000000..4662e94
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/selftests/Makefile.kmk
@@ -0,0 +1,44 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Testsuite & TestManager Tests.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsSelfTests
+ValidationKitTestsSelfTests_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsSelfTests_INST = $(INST_VALIDATIONKIT)tests/selftests/
+ValidationKitTestsSelfTests_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdSelfTest1.py \
+	$(PATH_SUB_CURRENT)/tdSelfTest2.py \
+	$(PATH_SUB_CURRENT)/tdSelfTest3.py \
+	$(PATH_SUB_CURRENT)/tdSelfTest4.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsSelfTests_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/selftests/tdSelfTest1.py b/src/VBox/ValidationKit/tests/selftests/tdSelfTest1.py
new file mode 100755
index 0000000..f6b8075
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/selftests/tdSelfTest1.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdSelfTest1.py $
+
+"""
+Test Manager Self Test - Dummy Test Driver.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+import sys;
+
+print('dummydriver.py: hello world!');
+print('dummydriver.py: args: %s' % (sys.argv,));
+if sys.argv[-1] in [ 'all', 'execute' ]:
+
+    import time;
+    for i in range(10, 1, -1):
+        print('dummydriver.py: %u...', i);
+        sys.stdout.flush();
+        time.sleep(1);
+    print('dummydriver.py: ...0! done');
+
+sys.exit(0);
+
diff --git a/src/VBox/ValidationKit/tests/selftests/tdSelfTest2.py b/src/VBox/ValidationKit/tests/selftests/tdSelfTest2.py
new file mode 100755
index 0000000..c50f3c1
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/selftests/tdSelfTest2.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdSelfTest2.py $
+
+"""
+Test Manager / Suite Self Test #2 - Everything should succeed.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from common             import utils;
+from testdriver         import reporter;
+from testdriver.base    import TestDriverBase;
+
+
+class tdSelfTest2(TestDriverBase):
+    """
+    Test Manager / Suite Self Test #2 - Everything should succeed.
+    """
+
+    def __init__(self):
+        TestDriverBase.__init__(self);
+
+
+    def actionExecute(self):
+        reporter.testStart('reporter.testXXXX API');
+        reporter.testValue('value-name1', 123456789, 'ms');
+
+        reporter.testStart('subtest');
+        reporter.testValue('value-name2',  11223344, 'times');
+        reporter.testDone();
+
+        reporter.testStart('subtest2');
+        reporter.testValue('value-name3',  39, 'sec');
+        reporter.testValue('value-name4',  42, 'ns');
+        reporter.testDone();
+
+        reporter.testStart('subtest3');
+        reporter.testDone(fSkipped = True);
+
+        # No spaces in XML.
+        reporter.testStart('subtest4');
+        oSubXmlFile = reporter.FileWrapperTestPipe();
+        oSubXmlFile.write('<?xml version="1.0" encoding="UTF-8" ?>');
+        oSubXmlFile.write('<Test timestamp="%s" name="foobar1">' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('<Test timestamp="%s" name="sub1">' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('<Passed timestamp="%s"/>' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('</Test>');
+        oSubXmlFile.write('<End timestamp="%s" errors="0"/>' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('</Test>');
+        oSubXmlFile.close();
+        oSubXmlFile = None;
+        reporter.testDone();
+
+        # Spaces + funny line endings.
+        reporter.testStart('subtest5');
+        oSubXmlFile = reporter.FileWrapperTestPipe();
+        oSubXmlFile.write('<?xml version="1.0" encoding="UTF-8" ?>\r\n');
+        oSubXmlFile.write('<Test timestamp="%s" name="foobar2">\n\n\t\n\r\n' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('<Test timestamp="%s" name="sub2">' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('  <Passed timestamp="%s"/>\n' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('  </Test>\n');
+        oSubXmlFile.write('  <End timestamp="%s" errors="0"/>\r' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('</Test>');
+        oSubXmlFile.close();
+        reporter.testDone();
+
+        # A few long log times for WUI log testing.
+        reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
+                     'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
+                     'asdlkfj  aljkasdflkj alkjdsf lakjsdf');
+        reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
+                     'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
+                     'asdlkfj  aljkasdflkj alkjdsf lakjsdf');
+        reporter.log('long line: asdfasdfljkasdlfkjasldkfjlaksdfjl asdlfkjasdlkfjalskdfjlaksdjfa falkjaldkjfalskdjflaksdjf ' \
+                     'lajksdflkjasdlfkjalsdfj asldfkjlaskdjflaksdjflaksdjflkj asdlfkjalsdkfjalsdkjflaksdj fasdlfkj ' \
+                     'asdlkfj  aljkasdflkj alkjdsf lakjsdf');
+
+        # Upload a file.
+        reporter.addLogFile(__file__, sKind = 'log/release/vm');
+
+        reporter.testDone();
+        return True;
+
+
+if __name__ == '__main__':
+    sys.exit(tdSelfTest2().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/selftests/tdSelfTest3.py b/src/VBox/ValidationKit/tests/selftests/tdSelfTest3.py
new file mode 100755
index 0000000..ef2bcda
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/selftests/tdSelfTest3.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdSelfTest3.py $
+
+"""
+Test Manager / Suite Self Test #3 - Bad XML input and other Failures.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from common             import utils;
+from testdriver         import reporter;
+from testdriver.base    import TestDriverBase;
+
+
+class tdSelfTest3(TestDriverBase):
+    """
+    Test Manager / Suite Self Test #3 - Bad XML input and other Failures.
+    """
+
+    def __init__(self):
+        TestDriverBase.__init__(self);
+
+
+    def actionExecute(self):
+
+        # Testing PushHint/PopHint.
+        reporter.testStart('Negative XML #1');
+        oSubXmlFile = reporter.FileWrapperTestPipe();
+        oSubXmlFile.write('<Test timestamp="%s" name="foobar3">\n\n\t\n\r\n' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('<Test timestamp="%s" name="sub3">' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.write('<Test timestamp="%s" name="subsub1">' % (utils.getIsoTimestamp(),));
+        oSubXmlFile.close();
+        reporter.testDone();
+
+        # Missing end, like we had with IRPT at one time.
+        reporter.testStart('Negative XML #2 (IPRT)');
+        oSubXmlFile = reporter.FileWrapperTestPipe();
+        oSubXmlFile.write("""
+<?xml version="1.0" encoding="UTF-8" ?>
+<Test timestamp="2013-05-29T08:59:05.930602000Z" name="tstRTGetOpt">
+  <Test timestamp="2013-05-29T08:59:05.930656000Z" name="Basics">
+    <Passed timestamp="2013-05-29T08:59:05.930756000Z"/>
+  </Test>
+  <Test timestamp="2013-05-29T08:59:05.930995000Z" name="RTGetOpt - IPv4">
+    <Passed timestamp="2013-05-29T08:59:05.931036000Z"/>
+  </Test>
+  <Test timestamp="2013-05-29T08:59:05.931161000Z" name="RTGetOpt - MAC Address">
+    <Passed timestamp="2013-05-29T08:59:05.931194000Z"/>
+  </Test>
+  <Test timestamp="2013-05-29T08:59:05.931313000Z" name="RTGetOpt - Option w/ Index">
+    <Passed timestamp="2013-05-29T08:59:05.931357000Z"/>
+  </Test>
+  <Test timestamp="2013-05-29T08:59:05.931475000Z" name="RTGetOptFetchValue">
+    <Passed timestamp="2013-05-29T08:59:05.931516000Z"/>
+  </Test>
+  <Test timestamp="2013-05-29T08:59:05.931640000Z" name="RTGetOpt - bool on/off">
+    <Passed timestamp="2013-05-29T08:59:05.931687000Z"/>
+  </Test>
+  <Test timestamp="2013-05-29T08:59:05.931807000Z" name="Standard options">
+    <Passed timestamp="2013-05-29T08:59:05.931843000Z"/>
+  </Test>
+  <Test timestamp="2013-05-29T08:59:05.931963000Z" name="Options first">
+    <Passed timestamp="2013-05-29T08:59:05.932035000Z"/>
+  </Test>
+""");
+        oSubXmlFile.close();
+        oSubXmlFile = None;
+        reporter.testDone();
+
+        # The use of testFailure.
+        reporter.testStart('Using testFailure()');
+        reporter.testValue('value-name3',  12345678, 'times');
+        reporter.testFailure('failure detail message');
+        reporter.testDone();
+
+        return True;
+
+
+if __name__ == '__main__':
+    sys.exit(tdSelfTest3().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/selftests/tdSelfTest4.py b/src/VBox/ValidationKit/tests/selftests/tdSelfTest4.py
new file mode 100755
index 0000000..529da04
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/selftests/tdSelfTest4.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdSelfTest4.py $
+
+"""
+Test Manager / Suite Self Test #4 - Testing result overflow handling.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver         import reporter;
+from testdriver.base    import TestDriverBase, InvalidOption;
+
+
+class tdSelfTest4(TestDriverBase):
+    """
+    Test Manager / Suite Self Test #4 - Testing result overflow handling.
+    """
+
+    ## Valid tests.
+    kasValidTests = [ 'immediate-sub-tests', 'total-sub-tests', 'immediate-values', 'total-values', 'immediate-messages'];
+
+    def __init__(self):
+        TestDriverBase.__init__(self);
+        self.sOptWhich = 'immediate-sub-tests';
+
+    def parseOption(self, asArgs, iArg):
+        if asArgs[iArg] == '--test':
+            iArg = self.requireMoreArgs(1, asArgs, iArg);
+            if asArgs[iArg] not in self.kasValidTests:
+                raise InvalidOption('Invalid test name "%s". Must be one of: %s'
+                                    % (asArgs[iArg], ', '.join(self.kasValidTests),));
+            self.sOptWhich = asArgs[iArg];
+        else:
+            return TestDriverBase.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def actionExecute(self):
+        # Too many immediate sub-tests.
+        if self.sOptWhich == 'immediate-sub-tests':
+            reporter.testStart('Too many immediate sub-tests (negative)');
+            for i in range(1024):
+                reporter.testStart('subsub%d' % i);
+                reporter.testDone();
+        # Too many sub-tests in total.
+        elif self.sOptWhich == 'total-sub-tests':
+            reporter.testStart('Too many sub-tests (negative)');
+            # 32 * 256 = 2^(5+8) = 2^13 = 8192.
+            for i in range(32):
+                reporter.testStart('subsub%d' % i);
+                for j in range(256):
+                    reporter.testStart('subsubsub%d' % j);
+                    reporter.testDone();
+                reporter.testDone();
+        # Too many immediate values.
+        elif self.sOptWhich == 'immediate-values':
+            reporter.testStart('Too many immediate values (negative)');
+            for i in range(512):
+                reporter.testValue('value%d' % i, i, 'times');
+        # Too many values in total.
+        elif self.sOptWhich == 'total-values':
+            reporter.testStart('Too many sub-tests (negative)');
+            for i in range(256):
+                reporter.testStart('subsub%d' % i);
+                for j in range(64):
+                    reporter.testValue('value%d' % j, i * 10000 + j, 'times');
+                reporter.testDone();
+        # Too many failure reasons (only immediate since the limit is extremely low).
+        elif self.sOptWhich == 'immediate-messages':
+            reporter.testStart('Too many immediate messages (negative)');
+            for i in range(16):
+                reporter.testFailure('Detail %d' % i);
+        else:
+            reporter.testStart('Unknown test %s' % (self.sOptWhich,));
+            reporter.error('Invalid test selected: %s' % (self.sOptWhich,));
+        reporter.testDone();
+        return True;
+
+
+if __name__ == '__main__':
+    sys.exit(tdSelfTest4().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/shutdown/tdGuestOsShutdown1.py b/src/VBox/ValidationKit/tests/shutdown/tdGuestOsShutdown1.py
new file mode 100755
index 0000000..13d5ed8
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/shutdown/tdGuestOsShutdown1.py
@@ -0,0 +1,357 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+VMM Guest OS boot tests.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 97235 $"
+
+
+# Standard Python imports.
+import os
+import sys
+import time
+
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0]
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(g_ksValidationKitDir)
+
+# Validation Kit imports.
+from testdriver import vbox
+from testdriver import base
+from testdriver import reporter
+from testdriver import vboxcon
+
+
+class tdGuestOsBootTest1(vbox.TestDriver):
+    """
+    VMM Unit Tests Set.
+
+    Scenario:
+        - Create VM that corresponds to Guest OS pre-installed on selected HDD
+        - Start VM and wait for TXS server connection (which is started after Guest successfully booted)
+    """
+
+    ksSataController = 'SATA Controller'
+    ksIdeController  = 'IDE Controller'
+
+    # VM parameters required to run HDD image.
+    # Format: { HDD image filename: (sKind, HDD controller type) }
+    kaoVmParams = {
+        't-win80.vdi':        ( 'Windows 8 (64 bit)', ksSataController ),
+    }
+
+    # List of platforms which are able to suspend and resume host automatically.
+    # In order to add new platform, self._SuspendResume() should be adapted.
+    kasSuspendAllowedPlatforms = ( 'darwin' )
+
+    kcMsVmStartLimit    = 5 * 60000
+    kcMsVmShutdownLimit = 1 * 60000
+
+    def __init__(self):
+        """
+        Reinitialize child class instance.
+        """
+        vbox.TestDriver.__init__(self)
+
+        self.sVmName             = 'TestVM'
+        self.sHddName            = None
+        self.sHddPathBase        = os.path.join(self.sResourcePath, '4.2', 'nat', 'win80')
+        self.oVM                 = None
+
+        # TODO: that should be moved to some common place
+        self.fEnableIOAPIC       = True
+        self.cCpus               = 1
+        self.fEnableNestedPaging = True
+        self.fEnablePAE          = False
+        self.fSuspendHost        = False
+        self.cSecSuspendTime     = 60
+        self.cShutdownIters      = 1
+        self.fExtraVm            = False
+        self.sExtraVmName        = "TestVM-Extra"
+        self.oExtraVM            = None
+        self.fLocalCatch         = False
+
+    #
+    # Overridden methods.
+    #
+
+    def showUsage(self):
+        """
+        Extend usage info
+        """
+        rc = vbox.TestDriver.showUsage(self)
+        reporter.log('  --boot-hdd <HDD image file name>')
+
+        reporter.log('  --cpus <# CPUs>')
+        reporter.log('  --no-ioapic')
+        reporter.log('  --no-nested-paging')
+        reporter.log('  --pae')
+        reporter.log('  --suspend-host')
+        reporter.log('  --suspend-time <sec>')
+        reporter.log('  --shutdown-iters <# iters>')
+        reporter.log('  --extra-vm')
+        reporter.log('  --local-catch')
+        return rc
+
+    def parseOption(self, asArgs, iArg):
+        """
+        Extend standard options set
+        """
+        if asArgs[iArg] == '--boot-hdd':
+            iArg += 1
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--boot-hdd" option requires an argument')
+            self.sHddName = asArgs[iArg]
+
+        elif asArgs[iArg] == '--cpus':
+            iArg += 1
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--cpus" option requires an argument')
+            self.cCpus = int(asArgs[iArg])
+        elif asArgs[iArg] == '--no-ioapic':
+            self.fEnableIOAPIC = False
+        elif asArgs[iArg] == '--no-nested-paging':
+            self.fEnableNestedPaging = False
+        elif asArgs[iArg] == '--pae':
+            self.fEnablePAE = True
+        elif asArgs[iArg] == '--suspend-host':
+            self.fSuspendHost = True
+        elif asArgs[iArg] == '--suspend-time':
+            iArg += 1
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--suspend-time" option requires an argument')
+            self.cSecSuspendTime = int(asArgs[iArg])
+        elif asArgs[iArg] == '--shutdown-iters':
+            iArg += 1
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--shutdown-iters" option requires an argument')
+            self.cShutdownIters = int(asArgs[iArg])
+        elif asArgs[iArg] == '--extra-vm':
+            self.fExtraVm = True
+        elif asArgs[iArg] == '--local-catch':
+            self.fLocalCatch = True
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg)
+
+        return iArg + 1
+
+    def getResourceSet(self):
+        """
+        Returns a set of file and/or directory names relative to
+        TESTBOX_PATH_RESOURCES.
+        """
+        return [os.path.join(self.sHddPathBase, sRsrc) for sRsrc in self.kaoVmParams];
+
+    def _addVM(self, sVmName, sNicTraceFile=None):
+        """
+        Create VM
+        """
+        # Get VM params specific to HDD image
+        sKind, sController = self.kaoVmParams[self.sHddName]
+
+        # Create VM itself
+        eNic0AttachType = vboxcon.NetworkAttachmentType_NAT
+        sHddPath = os.path.join(self.sHddPathBase, self.sHddName)
+        assert os.path.isfile(sHddPath)
+
+        oVM = \
+            self.createTestVM(sVmName, 1, sKind=sKind, cCpus=self.cCpus,
+                              eNic0AttachType=eNic0AttachType, sDvdImage = self.sVBoxValidationKitIso)
+        assert oVM is not None
+
+        oSession = self.openSession(oVM)
+
+        # Attach an HDD
+        fRc =         oSession.attachHd(sHddPath, sController, fImmutable=True)
+
+        # Enable HW virt
+        fRc = fRc and oSession.enableVirtEx(True)
+
+        # Enable I/O APIC
+        fRc = fRc and oSession.enableIoApic(self.fEnableIOAPIC)
+
+        # Enable Nested Paging
+        fRc = fRc and oSession.enableNestedPaging(self.fEnableNestedPaging)
+
+        # Enable PAE
+        fRc = fRc and oSession.enablePae(self.fEnablePAE)
+
+        if (sNicTraceFile is not None):
+            fRc = fRc and oSession.setNicTraceEnabled(True, sNicTraceFile)
+
+        # Remote desktop
+        oSession.setupVrdp(True)
+
+        fRc = fRc and oSession.saveSettings()
+        fRc = fRc and oSession.close()
+        assert fRc is True
+
+        return oVM
+
+    def actionConfig(self):
+        """
+        Configure pre-conditions.
+        """
+
+        if not self.importVBoxApi():
+            return False
+
+        # Save time: do not start VM if there is no way to suspend host
+        if (self.fSuspendHost is True and sys.platform not in self.kasSuspendAllowedPlatforms):
+            reporter.log('Platform [%s] is not in the list of supported platforms' % sys.platform)
+            return False
+
+        assert self.sHddName is not None
+        if self.sHddName not in self.kaoVmParams:
+            reporter.log('Error: unknown HDD image specified: %s' % self.sHddName)
+            return False
+
+        if (self.fExtraVm is True):
+            self.oExtraVM = self._addVM(self.sExtraVmName)
+
+        self.oVM = self._addVM(self.sVmName)
+
+        return vbox.TestDriver.actionConfig(self)
+
+    def _SuspendResume(self, cSecTimeout):
+        """
+        Put host into sleep and automatically resume it after specified timeout.
+        """
+        fRc = False
+
+        if (sys.platform == 'darwin'):
+            tsStart = time.time()
+            fRc  = os.system("/usr/bin/pmset relative wake %d" % self.cSecSuspendTime)
+            fRc |= os.system("/usr/bin/pmset sleepnow")
+            # Wait for host to wake up
+            while ((time.time() - tsStart) < self.cSecSuspendTime):
+                self.sleep(0.1)
+
+        return fRc == 0
+
+    def _waitKeyboardInterrupt(self):
+        """
+        Idle loop until user press CTRL+C
+        """
+        reporter.log('[LOCAL CATCH]: waiting for keyboard interrupt')
+        while (True):
+            try:
+                self.sleep(1)
+            except KeyboardInterrupt:
+                reporter.log('[LOCAL CATCH]: keyboard interrupt occurred')
+                break
+
+    def actionExecute(self):
+        """
+        Execute the testcase itself.
+        """
+        #self.logVmInfo(self.oVM)
+
+        reporter.testStart('SHUTDOWN GUEST')
+
+        cIter = 0
+        fRc = True
+
+        if (self.fExtraVm is True):
+            oExtraSession, oExtraTxsSession = self.startVmAndConnectToTxsViaTcp(self.sExtraVmName,
+                                                                                fCdWait=False,
+                                                                                cMsTimeout=self.kcMsVmStartLimit)
+            if oExtraSession is None or oExtraTxsSession is None:
+                reporter.error('Unable to start extra VM.')
+                if (self.fLocalCatch is True):
+                    self._waitKeyboardInterrupt()
+                reporter.testDone()
+                return False
+
+        while (cIter < self.cShutdownIters):
+
+            cIter += 1
+
+            reporter.log("Starting iteration #%d." % cIter)
+
+            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(self.sVmName,
+                                                                      fCdWait=False,
+                                                                      cMsTimeout=self.kcMsVmStartLimit)
+            if oSession is not None and oTxsSession is not None:
+                # Wait until guest reported success
+                reporter.log('Guest started. Connection to TXS service established.')
+
+                if (self.fSuspendHost is True):
+                    reporter.log("Disconnect form TXS.")
+                    fRc = fRc and self.txsDisconnect(oSession, oTxsSession)
+                    if (fRc is not True):
+                        reporter.log("Disconnect form TXS failed.")
+                    else:
+                        reporter.log('Put host to sleep and resume it automatically after %d seconds.' % self.cSecSuspendTime)
+                        fRc = fRc and self._SuspendResume(self.cSecSuspendTime)
+                        if (fRc is True):
+                            reporter.log("Sleep/resume success.")
+                        else:
+                            reporter.log("Sleep/resume failed.")
+                        reporter.log("Re-connect to TXS in 10 seconds.")
+                        self.sleep(10)
+                        (fRc, oTxsSession) = self.txsDoConnectViaTcp(oSession, 2 * 60 * 10000)
+                        if (fRc is not True):
+                            reporter.log("Re-connect to TXS failed.")
+
+                if (fRc is True):
+                    reporter.log('Attempt to shutdown guest.')
+                    fRc = fRc and oTxsSession.syncShutdown(cMsTimeout=(4 * 60 * 1000))
+                    if (fRc is True):
+                        reporter.log('Shutdown request issued successfully.')
+                        self.waitOnDirectSessionClose(self.oVM, self.kcMsVmShutdownLimit)
+                        reporter.log('Shutdown %s.' % ('success' if fRc is True else 'failed'))
+                    else:
+                        reporter.error('Shutdown request failed.')
+
+                    # Do not terminate failing VM in order to catch it.
+                    if (fRc is not True and self.fLocalCatch is True):
+                        self._waitKeyboardInterrupt()
+                        break
+
+                    fRc = fRc and self.terminateVmBySession(oSession)
+                    reporter.log('VM terminated.')
+
+            else:
+                reporter.error('Guest did not start (iteration %d of %d)' % (cIter, self.cShutdownIters))
+                fRc = False
+
+            # Stop if fail
+            if (fRc is not True):
+                break
+
+        # Local catch at the end.
+        if (self.fLocalCatch is True):
+            reporter.log("Test completed. Waiting for user to press CTRL+C.")
+            self._waitKeyboardInterrupt()
+
+        if (self.fExtraVm is True):
+            fRc = fRc and  self.terminateVmBySession(oExtraSession)
+
+        reporter.testDone()
+        return fRc is True
+
+if __name__ == '__main__':
+    sys.exit(tdGuestOsBootTest1().main(sys.argv))
diff --git a/src/VBox/ValidationKit/tests/smoketests/Makefile.kmk b/src/VBox/ValidationKit/tests/smoketests/Makefile.kmk
new file mode 100644
index 0000000..59c2724
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/smoketests/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Smoke Tests.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsSmokeTests
+ValidationKitTestsSmokeTests_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsSmokeTests_INST = $(INST_VALIDATIONKIT)tests/smoketests/
+ValidationKitTestsSmokeTests_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdSmokeTest1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsSmokeTests_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/smoketests/tdSmokeTest1.py b/src/VBox/ValidationKit/tests/smoketests/tdSmokeTest1.py
new file mode 100755
index 0000000..7d9340e
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/smoketests/tdSmokeTest1.py
@@ -0,0 +1,160 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdSmokeTest1.py $
+
+"""
+VirtualBox Validation Kit - Smoke Test #1.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+
+
+class tdSmokeTest1(vbox.TestDriver):
+    """
+    VBox Smoke Test #1.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs            = None;
+        self.oTestVmSet         = self.oTestVmManager.getSmokeVmSet();
+        self.sNicAttachmentDef  = 'mixed';
+        self.sNicAttachment     = self.sNicAttachmentDef;
+        self.fQuick             = False;
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('Smoke Test #1 options:');
+        reporter.log('  --nic-attachment <bridged|nat|mixed>');
+        reporter.log('      Default: %s' % (self.sNicAttachmentDef));
+        reporter.log('  --quick');
+        reporter.log('      Very selective testing.')
+        return rc;
+
+    def parseOption(self, asArgs, iArg):
+        if asArgs[iArg] == '--nic-attachment':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--nic-attachment" takes an argument');
+            self.sNicAttachment = asArgs[iArg];
+            if self.sNicAttachment not in ('bridged', 'nat', 'mixed'):
+                raise base.InvalidOption('The "--nic-attachment" value "%s" is not supported. Valid values are: bridged, nat' \
+                        % (self.sNicAttachment));
+        elif asArgs[iArg] == '--quick':
+            # Disable all but a few VMs and configurations.
+            for oTestVm in self.oTestVmSet.aoTestVms:
+                if oTestVm.sVmName == 'tst-win2k3ent':          # 32-bit paging
+                    oTestVm.asVirtModesSup  = [ 'hwvirt' ];
+                    oTestVm.acCpusSup       = range(1, 2);
+                elif oTestVm.sVmName == 'tst-rhel5':            # 32-bit paging
+                    oTestVm.asVirtModesSup  = [ 'raw' ];
+                    oTestVm.acCpusSup       = range(1, 2);
+                elif oTestVm.sVmName == 'tst-win2k8':           # 64-bit
+                    oTestVm.asVirtModesSup  = [ 'hwvirt-np' ];
+                    oTestVm.acCpusSup       = range(1, 2);
+                elif oTestVm.sVmName == 'tst-sol10-64':         # SMP, 64-bit
+                    oTestVm.asVirtModesSup  = [ 'hwvirt' ];
+                    oTestVm.acCpusSup       = range(2, 3);
+                elif oTestVm.sVmName == 'tst-sol10':            # SMP, 32-bit
+                    oTestVm.asVirtModesSup  = [ 'hwvirt-np' ];
+                    oTestVm.acCpusSup       = range(2, 3);
+                else:
+                    oTestVm.fSkip = True;
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def actionVerify(self):
+        if self.sVBoxValidationKitIso is None or not os.path.isfile(self.sVBoxValidationKitIso):
+            reporter.error('Cannot find the VBoxValidationKit.iso! (%s)'
+                           'Please unzip a Validation Kit build in the current directory or in some parent one.'
+                           % (self.sVBoxValidationKitIso,) );
+            return False;
+        return vbox.TestDriver.actionVerify(self);
+
+    def actionConfig(self):
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        # Do the configuring.
+        if self.sNicAttachment == 'nat':        eNic0AttachType = vboxcon.NetworkAttachmentType_NAT;
+        elif self.sNicAttachment == 'bridged':  eNic0AttachType = vboxcon.NetworkAttachmentType_Bridged;
+        else:                                   eNic0AttachType = None;
+        assert self.sVBoxValidationKitIso is not None;
+        return self.oTestVmSet.actionConfig(self, eNic0AttachType = eNic0AttachType, sDvdImage = self.sVBoxValidationKitIso);
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        return self.oTestVmSet.actionExecute(self, self.testOneVmConfig)
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def testOneVmConfig(self, oVM, oTestVm):
+        """
+        Runs the specified VM thru test #1.
+        """
+
+        # Simple test.
+        self.logVmInfo(oVM);
+        oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(oTestVm.sVmName, fCdWait = True);
+        if oSession is not None:
+            self.addTask(oSession);
+
+            ## @todo do some quick tests: save, restore, execute some test program, shut down the guest.
+
+            # cleanup.
+            self.removeTask(oTxsSession);
+            self.terminateVmBySession(oSession)
+            return True;
+        return None;
+
+if __name__ == '__main__':
+    sys.exit(tdSmokeTest1().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/storage/Makefile.kmk b/src/VBox/ValidationKit/tests/storage/Makefile.kmk
new file mode 100644
index 0000000..7095d1c
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/storage/Makefile.kmk
@@ -0,0 +1,43 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Storage Tests.
+#
+
+#
+# Copyright (C) 2012-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsStorage
+ValidationKitTestsStorage_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsStorage_INST = $(INST_VALIDATIONKIT)tests/storage/
+ValidationKitTestsStorage_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdStorageBenchmark1.py \
+	$(PATH_SUB_CURRENT)/tdStorageSnapshotMerging1.py \
+	$(PATH_SUB_CURRENT)/tdStorageStress1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsStorage_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py b/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
new file mode 100755
index 0000000..938cf4f
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/storage/tdStorageBenchmark1.py
@@ -0,0 +1,641 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdStorageBenchmark1.py $
+
+"""
+VirtualBox Validation Kit - Storage benchmark.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2015 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 99376 $"
+
+
+# Standard Python imports.
+import array;
+import os;
+import sys;
+import StringIO;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+
+def _ControllerTypeToName(eControllerType):
+    """ Translate a controller type to a name. """
+    if eControllerType == vboxcon.StorageControllerType_PIIX3 or eControllerType == vboxcon.StorageControllerType_PIIX4:
+        sType = "IDE Controller";
+    elif eControllerType == vboxcon.StorageControllerType_IntelAhci:
+        sType = "SATA Controller";
+    elif eControllerType == vboxcon.StorageControllerType_LsiLogicSas:
+        sType = "SAS Controller";
+    elif eControllerType == vboxcon.StorageControllerType_LsiLogic or eControllerType == vboxcon.StorageControllerType_BusLogic:
+        sType = "SCSI Controller";
+    else:
+        sType = "Storage Controller";
+    return sType;
+
+class IozoneStdOutWrapper(object):
+    """ Parser for iozone standard output """
+    def __init__(self):
+        self.fpInitWriter    = 0.0;
+        self.fpRewriter      = 0.0;
+        self.fpReader        = 0.0;
+        self.fpRereader      = 0.0;
+        self.fpReverseReader = 0.0;
+        self.fpStrideReader  = 0.0;
+        self.fpRandomReader  = 0.0;
+        self.fpMixedWorkload = 0.0;
+        self.fpRandomWriter  = 0.0;
+        self.fpPWrite        = 0.0;
+        self.fpPRead         = 0.0;
+
+    def read(self, cb):
+        """file.read"""
+        _ = cb;
+        return "";
+
+    def write(self, sText):
+        """iozone stdout write"""
+        if isinstance(sText, array.array):
+            try:
+                sText = sText.tostring();
+            except:
+                pass;
+        try:
+            asLines = sText.splitlines();
+            for sLine in asLines:
+                sLine = sLine.strip();
+                if sLine.startswith('Children') is True:
+                    # Extract the value
+                    idxValue = sLine.rfind('=');
+                    if idxValue is -1:
+                        raise Exception('IozoneStdOutWrapper: Invalid state');
+
+                    idxValue += 1;
+                    while sLine[idxValue] == ' ':
+                        idxValue += 1;
+
+                    idxValueEnd = idxValue;
+                    while sLine[idxValueEnd] == '.' or sLine[idxValueEnd].isdigit():
+                        idxValueEnd += 1;
+
+                    fpValue = float(sLine[idxValue:idxValueEnd]);
+
+                    if sLine.rfind('initial writers') is not -1:
+                        self.fpInitWriter = fpValue;
+                    elif sLine.rfind('rewriters') is not -1:
+                        self.fpRewriter = fpValue;
+                    elif sLine.rfind('re-readers') is not -1:
+                        self.fpRereader = fpValue;
+                    elif sLine.rfind('reverse readers') is not -1:
+                        self.fpReverseReader = fpValue;
+                    elif sLine.rfind('stride readers') is not -1:
+                        self.fpStrideReader = fpValue;
+                    elif sLine.rfind('random readers') is not -1:
+                        self.fpRandomReader = fpValue;
+                    elif sLine.rfind('mixed workload') is not -1:
+                        self.fpMixedWorkload = fpValue;
+                    elif sLine.rfind('random writers') is not -1:
+                        self.fpRandomWriter = fpValue;
+                    elif sLine.rfind('pwrite writers') is not -1:
+                        self.fpPWrite = fpValue;
+                    elif sLine.rfind('pread readers') is not -1:
+                        self.fpPRead = fpValue;
+                    elif sLine.rfind('readers') is not -1:
+                        self.fpReader = fpValue;
+                    else:
+                        reporter.log('Unknown test returned %s' % sLine);
+        except:
+            pass;
+        return None;
+
+    def getInitWriter(self):
+        """Get value for initial writers"""
+        return self.fpInitWriter;
+
+    def getRewriter(self):
+        """Get value for re-writers"""
+        return self.fpRewriter;
+
+    def getReader(self):
+        """Get value for initial readers"""
+        return self.fpReader;
+
+    def getRereader(self):
+        """Get value for re-writers"""
+        return self.fpRereader;
+
+    def getReverseReader(self):
+        """Get value for reverse readers"""
+        return self.fpReverseReader;
+
+    def getStrideReader(self):
+        """Get value for stride readers"""
+        return self.fpStrideReader;
+
+    def getRandomReader(self):
+        """Get value for random readers"""
+        return self.fpRandomReader;
+
+    def getMixedWorkload(self):
+        """Get value for mixed workload"""
+        return self.fpMixedWorkload;
+
+    def getRandomWriter(self):
+        """Get value for random writers"""
+        return self.fpRandomWriter;
+
+    def getPWrite(self):
+        """Get value for pwrite writers"""
+        return self.fpPWrite;
+
+    def getPRead(self):
+        """Get value for pread readers"""
+        return self.fpPRead;
+
+class FioWrapper(object):
+    """ Fio stdout parser and config file creator """
+    def __init__(self, sRecordSize, sTestsetSize, sQueueDepth, sPath):
+
+        self.configBuf = StringIO.StringIO();
+        self.configBuf.write('[global]\n');
+        self.configBuf.write('bs=' + sRecordSize + '\n');
+        self.configBuf.write('ioengine=libaio\n');
+        self.configBuf.write('iodepth=' + sQueueDepth + '\n');
+        self.configBuf.write('size=' + sTestsetSize + '\n');
+        self.configBuf.write('direct=1\n');
+        self.configBuf.write('directory=' + sPath + '\n');
+
+        self.configBuf.write('[seq-write]\n');
+        self.configBuf.write('rw=write\n');
+        self.configBuf.write('stonewall\n');
+
+        self.configBuf.write('[rand-write]\n');
+        self.configBuf.write('rw=randwrite\n');
+        self.configBuf.write('stonewall\n');
+
+        self.configBuf.write('[seq-read]\n');
+        self.configBuf.write('rw=read\n');
+        self.configBuf.write('stonewall\n');
+
+        self.configBuf.write('[rand-read]\n');
+        self.configBuf.write('rw=randread\n');
+        self.configBuf.write('stonewall\n');
+        return;
+
+    def getConfig(self):
+        """fio stdin feeder, gives the config file based on the given config values"""
+        return self.configBuf.getvalue();
+
+    def write(self, sText):
+        """fio stdout write"""
+        if isinstance(sText, array.array):
+            try:
+                sText = sText.tostring();
+            except:
+                pass;
+        try:
+            asLines = sText.splitlines();
+            for sLine in asLines:
+                reporter.log(sLine);
+        except:
+            pass;
+        return None;
+
+
+class tdStorageBenchmark(vbox.TestDriver):                                      # pylint: disable=R0902
+    """
+    Storage benchmark.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs           = None;
+        self.oGuestToGuestVM   = None;
+        self.oGuestToGuestSess = None;
+        self.oGuestToGuestTxs  = None;
+        self.asTestVMsDef      = ['tst-debian'];
+        self.asTestVMs         = self.asTestVMsDef;
+        self.asSkipVMs         = [];
+        self.asVirtModesDef    = ['hwvirt', 'hwvirt-np', 'raw',]
+        self.asVirtModes       = self.asVirtModesDef
+        self.acCpusDef         = [1, 2,]
+        self.acCpus            = self.acCpusDef;
+        self.asStorageCtrlsDef = ['AHCI', 'IDE', 'LsiLogicSAS', 'LsiLogic', 'BusLogic'];
+        self.asStorageCtrls    = self.asStorageCtrlsDef;
+        self.asDiskFormatsDef  = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW', 'iSCSI'];
+        self.asDiskFormats     = self.asDiskFormatsDef;
+        self.asTestsDef        = ['iozone', 'fio'];
+        self.asTests           = self.asTestsDef;
+        self.asDirsDef         = ['/run/media/alexander/OWCSSD/alexander', \
+                                  '/run/media/alexander/CrucialSSD/alexander', \
+                                  '/run/media/alexander/HardDisk/alexander', \
+                                  '/home/alexander'];
+        self.asDirs            = self.asDirsDef;
+        self.asIscsiTargetsDef = ['aurora|iqn.2011-03.home.aurora:aurora.storagebench|1'];
+        self.asIscsiTargets    = self.asIscsiTargetsDef;
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdStorageBenchmark1 Options:');
+        reporter.log('  --virt-modes    <m1[:m2[:]]');
+        reporter.log('      Default: %s' % (':'.join(self.asVirtModesDef)));
+        reporter.log('  --cpu-counts    <c1[:c2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
+        reporter.log('  --storage-ctrls <type1[:type2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asStorageCtrls)));
+        reporter.log('  --disk-formats  <type1[:type2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asDiskFormats)));
+        reporter.log('  --disk-dirs     <path1[:path2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asDirs)));
+        reporter.log('  --iscsi-targets     <target1[:target2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asIscsiTargets)));
+        reporter.log('  --tests         <test1[:test2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asTests)));
+        reporter.log('  --test-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Test the specified VMs in the given order. Use this to change');
+        reporter.log('      the execution order or limit the choice of VMs');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestVMsDef)));
+        reporter.log('  --skip-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        if asArgs[iArg] == '--virt-modes':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
+            self.asVirtModes = asArgs[iArg].split(':');
+            for s in self.asVirtModes:
+                if s not in self.asVirtModesDef:
+                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asVirtModesDef)));
+        elif asArgs[iArg] == '--cpu-counts':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
+            self.acCpus = [];
+            for s in asArgs[iArg].split(':'):
+                try: c = int(s);
+                except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
+                if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
+                self.acCpus.append(c);
+        elif asArgs[iArg] == '--storage-ctrls':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
+            self.asStorageCtrls = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--disk-formats':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
+            self.asDiskFormats = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--disk-dirs':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-dirs" takes a colon separated list of directories');
+            self.asDirs = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--iscsi-targets':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--iscsi-targets" takes a colon separated list of iscsi targets');
+            self.asIscsiTargets = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--tests':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of disk formats');
+            self.asTests = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--test-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
+            self.asTestVMs = asArgs[iArg].split(':');
+            for s in self.asTestVMs:
+                if s not in self.asTestVMsDef:
+                    raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestVMsDef)));
+        elif asArgs[iArg] == '--skip-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
+            self.asSkipVMs = asArgs[iArg].split(':');
+            for s in self.asSkipVMs:
+                if s not in self.asTestVMsDef:
+                    reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        # Remove skipped VMs from the test list.
+        for sVM in self.asSkipVMs:
+            try:    self.asTestVMs.remove(sVM);
+            except: pass;
+
+        return vbox.TestDriver.completeOptions(self);
+
+    def getResourceSet(self):
+        # Construct the resource list the first time it's queried.
+        if self.asRsrcs is None:
+            self.asRsrcs = [];
+            if 'tst-debian' in self.asTestVMs:
+                self.asRsrcs.append('4.2/storage/debian.vdi');
+
+        return self.asRsrcs;
+
+    def actionConfig(self):
+
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        #
+        # Configure the VMs we're going to use.
+        #
+
+        # Linux VMs
+        if 'tst-debian' in self.asTestVMs:
+            oVM = self.createTestVM('tst-debian', 1, '4.2/storage/debian.vdi', sKind = 'Debian_64', fIoApic = True, \
+                                    eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
+                                    eNic0Type = vboxcon.NetworkAdapterType_Am79C973);
+            if oVM is None:
+                return False;
+
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        fRc = self.test1();
+        return fRc;
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def test1RunTestProgs(self, oSession, oTxsSession, fRc, sTestName):
+        """
+        Runs all the test programs on the test machine.
+        """
+        reporter.testStart(sTestName);
+
+        # Prepare test disk, just create filesystem without partition
+        reporter.testStart('mkfs.ext4');
+        fRc = self.txsRunTest(oTxsSession, 'Create FS', 60000, \
+            '/sbin/mkfs.ext4',
+                ('mkfs.ext4', '-F', '/dev/vboxtest'));
+        reporter.testDone();
+
+        reporter.testStart('mount');
+        fRc = self.txsRunTest(oTxsSession, 'Mount FS', 30000, \
+            '/bin/mount',
+                ('mount', '/dev/vboxtest', '/mnt'));
+        reporter.testDone();
+
+        reporter.testStart('iozone');
+        if fRc and 'iozone' in self.asTests:
+            oStdOut = IozoneStdOutWrapper();
+            fRc = self.txsRunTestRedirectStd(oTxsSession, '2G', 3600000, \
+                '/usr/bin/iozone',
+                    ('iozone', '-r', '64k', '-s', '2g', '-t', '1', '-T', '-I', '-H', '32','-F', '/mnt/iozone'), \
+                (), '', '/dev/null', oStdOut, '/dev/null', '/dev/null');
+            if fRc is True:
+                reporter.log("Initial writer: " + str(oStdOut.getInitWriter()));
+                reporter.log("Rewriter:       " + str(oStdOut.getRewriter()));
+                reporter.log("Initial reader: " + str(oStdOut.getReader()));
+                reporter.log("Re-reader:      " + str(oStdOut.getRereader()));
+                reporter.log("Reverse reader: " + str(oStdOut.getReverseReader()));
+                reporter.log("Stride reader:  " + str(oStdOut.getStrideReader()));
+                reporter.log("Random reader:  " + str(oStdOut.getRandomReader()));
+                reporter.log("Mixed Workload: " + str(oStdOut.getMixedWorkload()));
+                reporter.log("Random writer:  " + str(oStdOut.getRandomWriter()));
+                reporter.log("pwrite Writer:  " + str(oStdOut.getPWrite()));
+                reporter.log("pread Reader:   " + str(oStdOut.getPRead()));
+            reporter.testDone();
+        else:
+            reporter.testDone(fSkipped = True);
+
+        reporter.testStart('fio');
+        if fRc and 'fio' in self.asTests:
+            oFioWrapper = FioWrapper('64k', '2g', '32', '/mnt');
+            fRc = self.txsUploadString(oSession, oTxsSession, oFioWrapper.getConfig(), '${SCRATCH}/aio-test');
+            fRc = fRc and self.txsRunTestRedirectStd(oTxsSession, '2G', 3600000, \
+                '/usr/bin/fio', ('fio', '${SCRATCH}/aio-test'), \
+                (), '', '/dev/null', oFioWrapper, '/dev/null', '/dev/null');
+        else:
+            reporter.testDone(fSkipped = True);
+
+        reporter.testDone(not fRc);
+        return fRc;
+
+    def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskPath, cCpus, fHwVirt, fNestedPaging):
+        """
+        Runs the specified VM thru test #1.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+        oVM = self.getVmByName(sVmName);
+
+        # Reconfigure the VM
+        fRc = True;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            # Attach HD
+            fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController));
+            fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController));
+
+            if sDiskFormat == "iSCSI":
+                listNames = [];
+                listValues = [];
+                listValues = sDiskPath.split('|');
+                listNames.append('TargetAddress');
+                listNames.append('TargetName');
+                listNames.append('LUN');
+
+                if self.fpApiVer >= 5.0:
+                    oHd = oSession.oVBox.createMedium(sDiskFormat, sDiskPath, vboxcon.AccessMode_ReadWrite, \
+                                                      vboxcon.DeviceType_HardDisk);
+                else:
+                    oHd = oSession.oVBox.createHardDisk(sDiskFormat, sDiskPath);
+                oHd.type = vboxcon.MediumType_Normal;
+                oHd.setProperties(listNames, listValues);
+
+                # Attach it.
+                if fRc is True:
+                    try:
+                        if oSession.fpApiVer >= 4.0:
+                            oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
+                                                            1, 0, vboxcon.DeviceType_HardDisk, oHd);
+                        else:
+                            oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
+                                                            1, 0, vboxcon.DeviceType_HardDisk, oHd.id);
+                    except:
+                        reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
+                                           % (_ControllerTypeToName(eStorageController), 1, 0, oHd.id, oSession.sName) );
+                        fRc = False;
+                    else:
+                        reporter.log('attached "%s" to %s' % (sDiskPath, oSession.sName));
+            else:
+                fRc = fRc and oSession.createAndAttachHd(sDiskPath, sDiskFormat, _ControllerTypeToName(eStorageController), \
+                                                         cb = 10*1024*1024*1024, iPort = 1, fImmutable = False);
+            fRc = fRc and oSession.enableVirtEx(fHwVirt);
+            fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
+            fRc = fRc and oSession.setCpuCount(cCpus);
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Start up.
+        if fRc is True:
+            self.logVmInfo(oVM);
+            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
+            if oSession is not None:
+                self.addTask(oSession);
+
+                # Fudge factor - Allow the guest to finish starting up.
+                self.sleep(5);
+
+                self.test1RunTestProgs(oSession, oTxsSession, fRc, 'Disk benchmark');
+
+                # cleanup.
+                self.removeTask(oTxsSession);
+                self.terminateVmBySession(oSession)
+
+                # Remove disk
+                oSession = self.openSession(oVM);
+                if oSession is not None:
+                    try:
+                        oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 1, 0);
+
+                        # Remove storage controller if it is not an IDE controller.
+                        if     eStorageController is not vboxcon.StorageControllerType_PIIX3 \
+                           and eStorageController is not vboxcon.StorageControllerType_PIIX4:
+                            oSession.o.machine.removeStorageController(_ControllerTypeToName(eStorageController));
+
+                        oSession.saveSettings();
+                        self.oVBox.deleteHdByLocation(sDiskPath);
+                        oSession.saveSettings();
+                        oSession.close();
+                        oSession = None;
+                    except:
+                        reporter.errorXcpt('failed to detach/delete disk %s from storage controller' % (sDiskPath));
+                else:
+                    fRc = False;
+            else:
+                fRc = False;
+        return fRc;
+
+    def test1OneVM(self, sVmName):
+        """
+        Runs one VM thru the various configurations.
+        """
+        reporter.testStart(sVmName);
+        fRc = True;
+        for sStorageCtrl in self.asStorageCtrls:
+            reporter.testStart(sStorageCtrl);
+
+            if sStorageCtrl == 'AHCI':
+                eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
+            elif sStorageCtrl == 'IDE':
+                eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
+            elif sStorageCtrl == 'LsiLogicSAS':
+                eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
+            elif sStorageCtrl == 'LsiLogic':
+                eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
+            elif sStorageCtrl == 'BusLogic':
+                eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
+            else:
+                eStorageCtrl = None;
+
+            for sDiskFormat in self.asDiskFormats:
+                reporter.testStart('%s' % (sDiskFormat));
+
+                if sDiskFormat == "iSCSI":
+                    asPaths = self.asIscsiTargets;
+                else:
+                    asPaths = self.asDirs;
+
+                for sDir in asPaths:
+                    reporter.testStart('%s' % (sDir));
+
+                    if sDiskFormat == "iSCSI":
+                        sPath = sDir;
+                    else:
+                        sPath = sDir + "/test.disk";
+
+                    for cCpus in self.acCpus:
+                        if cCpus == 1:  reporter.testStart('1 cpu');
+                        else:           reporter.testStart('%u cpus' % (cCpus));
+
+                        for sVirtMode in self.asVirtModes:
+                            if sVirtMode == 'raw' and cCpus > 1:
+                                continue;
+                            hsVirtModeDesc = {};
+                            hsVirtModeDesc['raw']       = 'Raw-mode';
+                            hsVirtModeDesc['hwvirt']    = 'HwVirt';
+                            hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
+                            reporter.testStart(hsVirtModeDesc[sVirtMode]);
+
+                            fHwVirt       = sVirtMode != 'raw';
+                            fNestedPaging = sVirtMode == 'hwvirt-np';
+                            fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPath, \
+                                                   cCpus, fHwVirt, fNestedPaging)  and  fRc and True; # pychecker hack.
+                            reporter.testDone();
+
+                        reporter.testDone();
+                    reporter.testDone();
+                reporter.testDone();
+            reporter.testDone();
+        reporter.testDone();
+        return fRc;
+
+    def test1(self):
+        """
+        Executes test #1.
+        """
+
+        # Loop thru the test VMs.
+        for sVM in self.asTestVMs:
+            # run test on the VM.
+            if not self.test1OneVM(sVM):
+                fRc = False;
+            else:
+                fRc = True;
+
+        return fRc;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdStorageBenchmark().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/storage/tdStorageSnapshotMerging1.py b/src/VBox/ValidationKit/tests/storage/tdStorageSnapshotMerging1.py
new file mode 100755
index 0000000..ccc9fad
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/storage/tdStorageSnapshotMerging1.py
@@ -0,0 +1,317 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdStorageSnapshotMerging1.py $
+
+"""
+VirtualBox Validation Kit - Storage snapshotting and merging testcase.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2013 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Id: tdStorageSnapshotMerging1.py $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+import uuid;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+
+def _ControllerTypeToName(eControllerType):
+    """ Translate a controller type to a name. """
+    if eControllerType == vboxcon.StorageControllerType_PIIX3 or eControllerType == vboxcon.StorageControllerType_PIIX4:
+        sType = "IDE Controller";
+    elif eControllerType == vboxcon.StorageControllerType_IntelAhci:
+        sType = "SATA Controller";
+    elif eControllerType == vboxcon.StorageControllerType_LsiLogicSas:
+        sType = "SAS Controller";
+    elif eControllerType == vboxcon.StorageControllerType_LsiLogic or eControllerType == vboxcon.StorageControllerType_BusLogic:
+        sType = "SCSI Controller";
+    else:
+        sType = "Storage Controller";
+    return sType;
+
+class tdStorageSnapshot(vbox.TestDriver):                                      # pylint: disable=R0902
+    """
+    Storage benchmark.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs           = None;
+        self.oGuestToGuestVM   = None;
+        self.oGuestToGuestSess = None;
+        self.oGuestToGuestTxs  = None;
+        self.asTestVMsDef      = ['tst-win7-vhd', 'tst-debian-vhd', 'tst-debian-vdi'];
+        self.asTestVMs         = self.asTestVMsDef;
+        self.asSkipVMs         = [];
+        self.asStorageCtrlsDef = ['AHCI', 'IDE', 'LsiLogicSAS', 'LsiLogic', 'BusLogic'];
+        self.asStorageCtrls    = self.asStorageCtrlsDef;
+        self.asDiskFormatsDef  = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW', 'iSCSI'];
+        self.asDiskFormats     = self.asDiskFormatsDef;
+        self.sRndData          = os.urandom(100*1024*1024);
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdStorageSnapshot1 Options:');
+        reporter.log('  --storage-ctrls <type1[:type2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asStorageCtrls)));
+        reporter.log('  --disk-formats  <type1[:type2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asDiskFormats)));
+        reporter.log('  --test-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Test the specified VMs in the given order. Use this to change');
+        reporter.log('      the execution order or limit the choice of VMs');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestVMsDef)));
+        reporter.log('  --skip-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        if asArgs[iArg] == '--storage-ctrls':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
+            self.asStorageCtrls = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--disk-formats':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
+            self.asDiskFormats = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--test-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
+            self.asTestVMs = asArgs[iArg].split(':');
+            for s in self.asTestVMs:
+                if s not in self.asTestVMsDef:
+                    raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestVMsDef)));
+        elif asArgs[iArg] == '--skip-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
+            self.asSkipVMs = asArgs[iArg].split(':');
+            for s in self.asSkipVMs:
+                if s not in self.asTestVMsDef:
+                    reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        # Remove skipped VMs from the test list.
+        for sVM in self.asSkipVMs:
+            try:    self.asTestVMs.remove(sVM);
+            except: pass;
+
+        return vbox.TestDriver.completeOptions(self);
+
+    def getResourceSet(self):
+        # Construct the resource list the first time it's queried.
+        if self.asRsrcs is None:
+            self.asRsrcs = [];
+            if 'tst-win7-vhd' in self.asTestVMs:
+                self.asRsrcs.append('4.2/storage/win7.vhd');
+
+            if 'tst-debian-vhd' in self.asTestVMs:
+                self.asRsrcs.append('4.2/storage/debian.vhd');
+
+            if 'tst-debian-vdi' in self.asTestVMs:
+                self.asRsrcs.append('4.2/storage/debian.vdi');
+
+        return self.asRsrcs;
+
+    def actionConfig(self):
+
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        #
+        # Configure the VMs we're going to use.
+        #
+
+        # Windows VMs
+        if 'tst-win7-vhd' in self.asTestVMs:
+            oVM = self.createTestVM('tst-win7-vhd', 1, '4.2/storage/win7.vhd', sKind = 'Windows7', fIoApic = True, \
+                                    eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
+                                    eNic0Type = vboxcon.NetworkAdapterType_Am79C973);
+            if oVM is None:
+                return False;
+
+        # Linux VMs
+        if 'tst-debian-vhd' in self.asTestVMs:
+            oVM = self.createTestVM('tst-debian-vhd', 1, '4.2/storage/debian.vhd', sKind = 'Debian_64', fIoApic = True, \
+                                    eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
+                                    eNic0Type = vboxcon.NetworkAdapterType_Am79C973);
+            if oVM is None:
+                return False;
+
+        if 'tst-debian-vdi' in self.asTestVMs:
+            oVM = self.createTestVM('tst-debian-vdi', 1, '4.2/storage/debian.vdi', sKind = 'Debian_64', fIoApic = True, \
+                                    eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
+                                    eNic0Type = vboxcon.NetworkAdapterType_Am79C973);
+            if oVM is None:
+                return False;
+
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        fRc = self.test1();
+        return fRc;
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def test1UploadFile(self, oSession, oTxsSession):
+        """
+        Uploads a test file to the test machine.
+        """
+        reporter.testStart('Upload file');
+
+        fRc = self.txsUploadString(oSession, oTxsSession, self.sRndData, '${SCRATCH}/' + str(uuid.uuid4()), \
+                                   cMsTimeout = 3600 * 1000);
+
+        reporter.testDone(not fRc);
+        return fRc;
+
+    def test1OneCfg(self, sVmName, eStorageController, sDiskFormat):
+        """
+        Runs the specified VM thru test #1.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+        oVM = self.getVmByName(sVmName);
+
+        # @ŧodo: Implement support for different formats.
+        _ = sDiskFormat;
+
+        # Reconfigure the VM
+        fRc = True;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            # Attach HD
+            fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController));
+            fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController));
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Start up.
+        if fRc is True:
+            self.logVmInfo(oVM);
+            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
+            if oSession is not None:
+                self.addTask(oSession);
+
+                # Fudge factor - Allow the guest to finish starting up.
+                self.sleep(5);
+
+                # Do a snapshot first.
+                oSession.takeSnapshot('Base snapshot');
+
+                for i in range(0, 10):
+                    oSession.takeSnapshot('Snapshot ' + str(i));
+                    self.test1UploadFile(oSession, oTxsSession);
+                    msNow = base.timestampMilli();
+                    oSnapshot = oSession.findSnapshot('Snapshot ' + str(i));
+                    oSession.deleteSnapshot(oSnapshot.id, cMsTimeout = 60 * 1000);
+                    msElapsed = base.timestampMilli() - msNow;
+                    reporter.log('Deleting snapshot %d took %d ms' % (i, msElapsed));
+
+                # cleanup.
+                self.removeTask(oTxsSession);
+                self.terminateVmBySession(oSession)
+            else:
+                fRc = False;
+        return fRc;
+
+    def test1OneVM(self, sVmName):
+        """
+        Runs one VM thru the various configurations.
+        """
+        reporter.testStart(sVmName);
+        fRc = True;
+        for sStorageCtrl in self.asStorageCtrls:
+            reporter.testStart(sStorageCtrl);
+
+            if sStorageCtrl == 'AHCI':
+                eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
+            elif sStorageCtrl == 'IDE':
+                eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
+            elif sStorageCtrl == 'LsiLogicSAS':
+                eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
+            elif sStorageCtrl == 'LsiLogic':
+                eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
+            elif sStorageCtrl == 'BusLogic':
+                eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
+            else:
+                eStorageCtrl = None;
+
+            for sDiskFormat in self.asDiskFormats:
+                reporter.testStart('%s' % (sDiskFormat));
+                self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat);
+                reporter.testDone();
+            reporter.testDone();
+        reporter.testDone();
+        return fRc;
+
+    def test1(self):
+        """
+        Executes test #1.
+        """
+
+        # Loop thru the test VMs.
+        for sVM in self.asTestVMs:
+            # run test on the VM.
+            if not self.test1OneVM(sVM):
+                fRc = False;
+            else:
+                fRc = True;
+
+        return fRc;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdStorageSnapshot().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/storage/tdStorageStress1.py b/src/VBox/ValidationKit/tests/storage/tdStorageStress1.py
new file mode 100755
index 0000000..0e3fb09
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/storage/tdStorageStress1.py
@@ -0,0 +1,517 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Storage testcase using xfstests.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2015 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Id: tdStorageStress1.py $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+
+def _ControllerTypeToName(eControllerType):
+    """ Translate a controller type to a name. """
+    if eControllerType == vboxcon.StorageControllerType_PIIX3 or eControllerType == vboxcon.StorageControllerType_PIIX4:
+        sType = "IDE Controller";
+    elif eControllerType == vboxcon.StorageControllerType_IntelAhci:
+        sType = "SATA Controller";
+    elif eControllerType == vboxcon.StorageControllerType_LsiLogicSas:
+        sType = "SAS Controller";
+    elif eControllerType == vboxcon.StorageControllerType_LsiLogic or eControllerType == vboxcon.StorageControllerType_BusLogic:
+        sType = "SCSI Controller";
+    else:
+        sType = "Storage Controller";
+    return sType;
+
+class tdStorageStress(vbox.TestDriver):                                      # pylint: disable=R0902
+    """
+    Storage testcase.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs           = None;
+        self.oGuestToGuestVM   = None;
+        self.oGuestToGuestSess = None;
+        self.oGuestToGuestTxs  = None;
+        self.asTestVMsDef      = ['tst-debian'];
+        self.asTestVMs         = self.asTestVMsDef;
+        self.asSkipVMs         = [];
+        self.asVirtModesDef    = ['hwvirt', 'hwvirt-np', 'raw',]
+        self.asVirtModes       = self.asVirtModesDef
+        self.acCpusDef         = [1, 2,]
+        self.acCpus            = self.acCpusDef;
+        self.asStorageCtrlsDef = ['AHCI', 'IDE', 'LsiLogicSAS', 'LsiLogic', 'BusLogic'];
+        self.asStorageCtrls    = self.asStorageCtrlsDef;
+        self.asDiskFormatsDef  = ['VDI', 'VMDK', 'VHD', 'QED', 'Parallels', 'QCOW'];
+        self.asDiskFormats     = self.asDiskFormatsDef;
+        self.asTestsDef        = ['xfstests'];
+        self.asTests           = self.asTestsDef;
+        self.asGuestFs         = ['xfs', 'ext4', 'btrfs'];
+        self.asGuestFsDef      = self.asGuestFs;
+        self.asIscsiTargetsDef = ['aurora|iqn.2011-03.home.aurora:aurora.storagebench|1'];
+        self.asIscsiTargets    = self.asIscsiTargetsDef;
+        self.asDirsDef         = ['/run/media/alexander/OWCSSD/alexander', \
+                                  '/run/media/alexander/CrucialSSD/alexander', \
+                                  '/run/media/alexander/HardDisk/alexander', \
+                                  '/home/alexander'];
+        self.asDirs            = self.asDirsDef;
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdStorageBenchmark1 Options:');
+        reporter.log('  --virt-modes    <m1[:m2[:]]');
+        reporter.log('      Default: %s' % (':'.join(self.asVirtModesDef)));
+        reporter.log('  --cpu-counts    <c1[:c2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
+        reporter.log('  --storage-ctrls <type1[:type2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asStorageCtrls)));
+        reporter.log('  --disk-formats  <type1[:type2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asDiskFormats)));
+        reporter.log('  --disk-dirs     <path1[:path2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asDirs)));
+        reporter.log('  --iscsi-targets     <target1[:target2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asIscsiTargets)));
+        reporter.log('  --tests         <test1[:test2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asTests)));
+        reporter.log('  --guest-fs      <fs1[:fs2[:...]]>');
+        reporter.log('      Default: %s' % (':'.join(self.asGuestFs)));
+        reporter.log('  --test-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Test the specified VMs in the given order. Use this to change');
+        reporter.log('      the execution order or limit the choice of VMs');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestVMsDef)));
+        reporter.log('  --skip-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        if asArgs[iArg] == '--virt-modes':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
+            self.asVirtModes = asArgs[iArg].split(':');
+            for s in self.asVirtModes:
+                if s not in self.asVirtModesDef:
+                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asVirtModesDef)));
+        elif asArgs[iArg] == '--cpu-counts':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
+            self.acCpus = [];
+            for s in asArgs[iArg].split(':'):
+                try: c = int(s);
+                except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
+                if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
+                self.acCpus.append(c);
+        elif asArgs[iArg] == '--storage-ctrls':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--storage-ctrls" takes a colon separated list of Storage controller types');
+            self.asStorageCtrls = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--disk-formats':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-formats" takes a colon separated list of disk formats');
+            self.asDiskFormats = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--disk-dirs':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--disk-dirs" takes a colon separated list of directories');
+            self.asDirs = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--iscsi-targets':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--iscsi-targets" takes a colon separated list of iscsi targets');
+            self.asIscsiTargets = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--tests':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes a colon separated list of disk formats');
+            self.asTests = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--guest-fs':
+            iArg += 1;
+            if iArg >= len(asArgs):
+                raise base.InvalidOption('The "--guest-fs" takes a colon separated list of filesystem identifiers');
+            self.asGuestFs = asArgs[iArg].split(':');
+        elif asArgs[iArg] == '--test-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
+            self.asTestVMs = asArgs[iArg].split(':');
+            for s in self.asTestVMs:
+                if s not in self.asTestVMsDef:
+                    raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestVMsDef)));
+        elif asArgs[iArg] == '--skip-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
+            self.asSkipVMs = asArgs[iArg].split(':');
+            for s in self.asSkipVMs:
+                if s not in self.asTestVMsDef:
+                    reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        # Remove skipped VMs from the test list.
+        for sVM in self.asSkipVMs:
+            try:    self.asTestVMs.remove(sVM);
+            except: pass;
+
+        return vbox.TestDriver.completeOptions(self);
+
+    def getResourceSet(self):
+        # Construct the resource list the first time it's queried.
+        if self.asRsrcs is None:
+            self.asRsrcs = [];
+            if 'tst-debian' in self.asTestVMs:
+                self.asRsrcs.append('4.2/storage/debian.vdi');
+
+        return self.asRsrcs;
+
+    def actionConfig(self):
+        # Some stupid trickery to guess the location of the iso. ## fixme - testsuite unzip ++
+        sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__),
+                                                 '../../VBoxValidationKitStorIo.iso'));
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__),
+                                                     '../../VBoxValidationKitStorIo.iso'));
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/validationkit/VBoxValidationKitStorIo.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/testsuite/VBoxTestSuiteStorIo.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sCur = os.getcwd();
+            for i in range(0, 10):
+                sVBoxValidationKit_iso = os.path.join(sCur, 'validationkit/VBoxValidationKitStorIo.iso');
+                if os.path.isfile(sVBoxValidationKit_iso):
+                    break;
+                sVBoxValidationKit_iso = os.path.join(sCur, 'testsuite/VBoxTestSuiteStorIo.iso');
+                if os.path.isfile(sVBoxValidationKit_iso):
+                    break;
+                sCur = os.path.abspath(os.path.join(sCur, '..'));
+                if i is None: pass; # shut up pychecker/pylint.
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/VirtualBox/VBoxValidationKitStorIo.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/VirtualBox/VBoxTestSuiteStorIo.iso';
+
+
+
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        #
+        # Configure the VMs we're going to use.
+        #
+
+        # Linux VMs
+        if 'tst-debian' in self.asTestVMs:
+            oVM = self.createTestVM('tst-debian', 1, '4.2/storage/debian.vdi', sKind = 'Debian_64', fIoApic = True, \
+                                    eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
+                                    eNic0Type = vboxcon.NetworkAdapterType_Am79C973, \
+                                    sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        fRc = self.test1();
+        return fRc;
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def test1RunTestProgs(self, oSession, oTxsSession, fRc, sTestName, sGuestFs):
+        """
+        Runs all the test programs on the test machine.
+        """
+        _ = oSession;
+
+        reporter.testStart(sTestName);
+
+        sMkfsCmd = 'mkfs.' + sGuestFs;
+
+        # Prepare test disks, just create filesystem without partition
+        reporter.testStart('Preparation');
+        fRc = fRc and self.txsRunTest(oTxsSession, 'Create FS 1', 60000, \
+                                      '/sbin/' + sMkfsCmd,
+                                      (sMkfsCmd, '/dev/sdb'));
+
+        fRc = fRc and self.txsRunTest(oTxsSession, 'Create FS 2', 60000, \
+                                      '/sbin/' + sMkfsCmd,
+                                      (sMkfsCmd, '/dev/sdc'));
+
+        # Create test and scratch directory
+        fRc = fRc and self.txsRunTest(oTxsSession, 'Create /mnt/test', 10000, \
+                                      '/bin/mkdir',
+                                      ('mkdir', '/mnt/test'));
+
+        fRc = fRc and self.txsRunTest(oTxsSession, 'Create /mnt/scratch', 10000, \
+                                      '/bin/mkdir',
+                                      ('mkdir', '/mnt/scratch'));
+
+        # Mount test and scratch directory.
+        fRc = fRc and self.txsRunTest(oTxsSession, 'Mount /mnt/test', 10000, \
+                                      '/bin/mount',
+                                      ('mount', '/dev/sdb','/mnt/test'));
+
+        fRc = fRc and self.txsRunTest(oTxsSession, 'Mount /mnt/scratch', 10000, \
+                                      '/bin/mount',
+                                      ('mount', '/dev/sdc','/mnt/scratch'));
+
+        fRc = fRc and self.txsRunTest(oTxsSession, 'Copying xfstests', 10000, \
+                                      '/bin/cp',
+                                      ('cp', '-r','${CDROM}/${OS.ARCH}/xfstests', '/tmp'));
+
+        reporter.testDone();
+
+        # Run xfstests (this sh + cd crap is required because the cwd for the script must be in the root
+        # of the xfstests directory...)
+        reporter.testStart('xfstests');
+        if fRc and 'xfstests' in self.asTests:
+            fRc = self.txsRunTest(oTxsSession, 'xfstests', 3600000, \
+                '/bin/sh',
+                    ('sh', '-c', '(cd /tmp/xfstests && ./check -g auto)'), \
+                    ('TEST_DIR=/mnt/test', 'TEST_DEV=/dev/sdb', 'SCRATCH_MNT=/mnt/scratch', 'SCRATCH_DEV=/dev/sdc', \
+                     'FSTYP=' + sGuestFs));
+            reporter.testDone();
+        else:
+            reporter.testDone(fSkipped = True);
+
+        reporter.testDone(not fRc);
+        return fRc;
+
+    # pylint: disable=R0913
+
+    def test1OneCfg(self, sVmName, eStorageController, sDiskFormat, sDiskPath1, sDiskPath2, \
+                    sGuestFs, cCpus, fHwVirt, fNestedPaging):
+        """
+        Runs the specified VM thru test #1.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+        oVM = self.getVmByName(sVmName);
+
+        # Reconfigure the VM
+        fRc = True;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            # Attach HD
+            fRc = oSession.ensureControllerAttached(_ControllerTypeToName(eStorageController));
+            fRc = fRc and oSession.setStorageControllerType(eStorageController, _ControllerTypeToName(eStorageController));
+
+            if sDiskFormat == "iSCSI":
+                listNames = [];
+                listValues = [];
+                listValues = sDiskPath1.split('|');
+                listNames.append('TargetAddress');
+                listNames.append('TargetName');
+                listNames.append('LUN');
+
+                if self.fpApiVer >= 5.0:
+                    oHd = oSession.oVBox.createMedium(sDiskFormat, sDiskPath1, vboxcon.AccessMode_ReadWrite, \
+                                                      vboxcon.DeviceType_HardDisk);
+                else:
+                    oHd = oSession.oVBox.createHardDisk(sDiskFormat, sDiskPath1);
+                oHd.type = vboxcon.MediumType_Normal;
+                oHd.setProperties(listNames, listValues);
+
+                # Attach it.
+                if fRc is True:
+                    try:
+                        if oSession.fpApiVer >= 4.0:
+                            oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
+                                                            1, 0, vboxcon.DeviceType_HardDisk, oHd);
+                        else:
+                            oSession.o.machine.attachDevice(_ControllerTypeToName(eStorageController), \
+                                                            1, 0, vboxcon.DeviceType_HardDisk, oHd.id);
+                    except:
+                        reporter.errorXcpt('attachDevice("%s",%s,%s,HardDisk,"%s") failed on "%s"' \
+                                           % (_ControllerTypeToName(eStorageController), 1, 0, oHd.id, oSession.sName) );
+                        fRc = False;
+                    else:
+                        reporter.log('attached "%s" to %s' % (sDiskPath1, oSession.sName));
+            else:
+                fRc = fRc and oSession.createAndAttachHd(sDiskPath1, sDiskFormat, _ControllerTypeToName(eStorageController), \
+                                                         cb = 10*1024*1024*1024, iPort = 1, fImmutable = False);
+                fRc = fRc and oSession.createAndAttachHd(sDiskPath2, sDiskFormat, _ControllerTypeToName(eStorageController), \
+                                                         cb = 10*1024*1024*1024, iPort = 2, fImmutable = False);
+            fRc = fRc and oSession.enableVirtEx(fHwVirt);
+            fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
+            fRc = fRc and oSession.setCpuCount(cCpus);
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Start up.
+        if fRc is True:
+            self.logVmInfo(oVM);
+            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = True);
+            if oSession is not None:
+                self.addTask(oSession);
+
+                # Fudge factor - Allow the guest to finish starting up.
+                self.sleep(5);
+
+                fRc = self.test1RunTestProgs(oSession, oTxsSession, fRc, 'stress testing', sGuestFs);
+
+                # cleanup.
+                self.removeTask(oTxsSession);
+                self.terminateVmBySession(oSession)
+
+                # Remove disk
+                oSession = self.openSession(oVM);
+                if oSession is not None:
+                    try:
+                        oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 1, 0);
+                        oSession.o.machine.detachDevice(_ControllerTypeToName(eStorageController), 2, 0);
+
+                        # Remove storage controller if it is not an IDE controller.
+                        if     eStorageController is not vboxcon.StorageControllerType_PIIX3 \
+                           and eStorageController is not vboxcon.StorageControllerType_PIIX4:
+                            oSession.o.machine.removeStorageController(_ControllerTypeToName(eStorageController));
+
+                        oSession.saveSettings();
+                        oSession.oVBox.deleteHdByLocation(sDiskPath1);
+                        oSession.oVBox.deleteHdByLocation(sDiskPath2);
+                        oSession.saveSettings();
+                        oSession.close();
+                        oSession = None;
+                    except:
+                        reporter.errorXcpt('failed to detach/delete disks %s and %s from storage controller' % \
+                                           (sDiskPath1, sDiskPath2));
+                else:
+                    fRc = False;
+            else:
+                fRc = False;
+        return fRc;
+
+    def test1OneVM(self, sVmName):
+        """
+        Runs one VM thru the various configurations.
+        """
+        reporter.testStart(sVmName);
+        fRc = True;
+        for sStorageCtrl in self.asStorageCtrls:
+            reporter.testStart(sStorageCtrl);
+
+            if sStorageCtrl == 'AHCI':
+                eStorageCtrl = vboxcon.StorageControllerType_IntelAhci;
+            elif sStorageCtrl == 'IDE':
+                eStorageCtrl = vboxcon.StorageControllerType_PIIX4;
+            elif sStorageCtrl == 'LsiLogicSAS':
+                eStorageCtrl = vboxcon.StorageControllerType_LsiLogicSas;
+            elif sStorageCtrl == 'LsiLogic':
+                eStorageCtrl = vboxcon.StorageControllerType_LsiLogic;
+            elif sStorageCtrl == 'BusLogic':
+                eStorageCtrl = vboxcon.StorageControllerType_BusLogic;
+            else:
+                eStorageCtrl = None;
+
+            for sDiskFormat in self.asDiskFormats:
+                reporter.testStart('%s' % (sDiskFormat,));
+
+                asPaths = self.asDirs;
+
+                for sDir in asPaths:
+                    reporter.testStart('%s' % (sDir,));
+
+                    sPathDisk1 = sDir + "/disk1.disk";
+                    sPathDisk2 = sDir + "/disk2.disk";
+
+                    for sGuestFs in self.asGuestFs:
+                        reporter.testStart('%s' % (sGuestFs,));
+
+                        for cCpus in self.acCpus:
+                            if cCpus == 1:  reporter.testStart('1 cpu');
+                            else:           reporter.testStart('%u cpus' % (cCpus,));
+
+                            for sVirtMode in self.asVirtModes:
+                                if sVirtMode == 'raw' and cCpus > 1:
+                                    continue;
+                                hsVirtModeDesc = {};
+                                hsVirtModeDesc['raw']       = 'Raw-mode';
+                                hsVirtModeDesc['hwvirt']    = 'HwVirt';
+                                hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
+                                reporter.testStart(hsVirtModeDesc[sVirtMode]);
+
+                                fHwVirt       = sVirtMode != 'raw';
+                                fNestedPaging = sVirtMode == 'hwvirt-np';
+                                fRc = self.test1OneCfg(sVmName, eStorageCtrl, sDiskFormat, sPathDisk1, sPathDisk2, \
+                                                       sGuestFs, cCpus, fHwVirt, fNestedPaging) and  fRc and True;
+                                reporter.testDone();
+                            reporter.testDone();
+                        reporter.testDone();
+                    reporter.testDone();
+                reporter.testDone();
+            reporter.testDone();
+        reporter.testDone();
+        return fRc;
+
+    def test1(self):
+        """
+        Executes test #1.
+        """
+
+        # Loop thru the test VMs.
+        for sVM in self.asTestVMs:
+            # run test on the VM.
+            if not self.test1OneVM(sVM):
+                fRc = False;
+            else:
+                fRc = True;
+
+        return fRc;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdStorageStress().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/teleportation/Makefile.kmk b/src/VBox/ValidationKit/tests/teleportation/Makefile.kmk
new file mode 100644
index 0000000..f1f762a
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/teleportation/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Teleportation.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsTeleportation
+ValidationKitTestsTeleportation_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsTeleportation_INST = $(INST_VALIDATIONKIT)testcases/cpu/
+ValidationKitTestsTeleportation_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdTeleportLocal1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsTeleportation_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/teleportation/tdTeleportLocal1.py b/src/VBox/ValidationKit/tests/teleportation/tdTeleportLocal1.py
new file mode 100755
index 0000000..eb99bed
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/teleportation/tdTeleportLocal1.py
@@ -0,0 +1,956 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdTeleportLocal1.py $
+
+"""
+VirtualBox Validation Kit - Local teleportation testdriver.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 96152 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+
+
+class tdTeleportLocal1(vbox.TestDriver):
+    """
+    Local Teleportation Test #1.
+    """
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs            = None;
+
+        self.asTestsDef         = ['test1', 'test2'];
+        self.asTests            = ['test1', 'test2'];
+        self.asSkipTests        = [];
+        self.asTestVMsDef       = ['tst-rhel5', 'tst-win2k3ent', 'tst-sol10'];
+        self.asTestVMs          = self.asTestVMsDef;
+        self.asSkipVMs          = [];
+        self.asVirtModesDef     = ['hwvirt', 'hwvirt-np', 'raw',]
+        self.asVirtModes        = self.asVirtModesDef
+        self.acCpusDef          = [1, 2,]
+        self.acCpus             = self.acCpusDef;
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdTeleportLocal1 Options:');
+        reporter.log('  --virt-modes   <m1[:m2[:]]');
+        reporter.log('      Default: %s' % (':'.join(self.asVirtModesDef)));
+        reporter.log('  --cpu-counts   <c1[:c2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
+        reporter.log('  --test-vms     <vm1[:vm2[:...]]>');
+        reporter.log('      Test the specified VMs in the given order. Use this to change');
+        reporter.log('      the execution order or limit the choice of VMs');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestVMsDef)));
+        reporter.log('  --skip-vms     <vm1[:vm2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        reporter.log('  --tests        <test1[:test2[:...]]>');
+        reporter.log('      Run the specified tests.');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestsDef)));
+        reporter.log('  --skip-tests   <test1[:test2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        reporter.log('  --quick');
+        reporter.log('      Shorthand for: --virt-modes hwvirt --cpu-counts 1');
+        reporter.log('                     --test-vms tst-rhel5:tst-win2k3ent:tst-sol10');
+        return rc;
+
+    def parseOption(self, asArgs, iArg):
+        if asArgs[iArg] == '--virt-modes':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
+            self.asVirtModes = asArgs[iArg].split(':');
+            for s in self.asVirtModes:
+                if s not in self.asVirtModesDef:
+                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asVirtModesDef)));
+        elif asArgs[iArg] == '--cpu-counts':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
+            self.acCpus = [];
+            for s in asArgs[iArg].split(':'):
+                try: c = int(s);
+                except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
+                if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
+                self.acCpus.append(c);
+        elif asArgs[iArg] == '--test-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
+            if len(asArgs[iArg]) > 0:
+                self.asTestVMs = asArgs[iArg].split(':');
+                for s in self.asTestVMs:
+                    if s not in self.asTestVMsDef:
+                        raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
+                            % (s, ' '.join(self.asTestVMsDef)));
+            else:
+                self.asTestVMs = [];
+        elif asArgs[iArg] == '--skip-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
+            self.asSkipVMs = asArgs[iArg].split(':');
+            for s in self.asSkipVMs:
+                if s not in self.asTestVMsDef:
+                    reporter.log('warning: The "--skip-vms" value "%s" does not specify any of our test VMs.' % (s));
+        elif asArgs[iArg] == '--tests':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--tests" takes colon separated list');
+            self.asTests = asArgs[iArg].split(':');
+            for s in self.asTests:
+                if s not in self.asTestsDef:
+                    reporter.log('warning: The "--tests" value "%s" does not specify any of our tests.' % (s));
+        elif asArgs[iArg] == '--skip-tests':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-tests" takes colon separated list');
+            self.asSkipVMs = asArgs[iArg].split(':');
+            for s in self.asSkipTests:
+                if s not in self.asTestsDef:
+                    reporter.log('warning: The "--skip-tests" value "%s" does not specify any of our tests.' % (s));
+        elif asArgs[iArg] == '--quick':
+            self.asVirtModes        = ['hwvirt',];
+            self.acCpus             = [1,];
+            #self.asTestVMs          = ['tst-rhel5', 'tst-win2k3ent', 'tst-sol10',];
+            self.asTestVMs          = ['tst-rhel5', ];
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        # Remove skipped VMs from the test VM list.
+        for sVM in self.asSkipVMs:
+            try:    self.asTestVMs.remove(sVM);
+            except: pass;
+
+        # Remove skipped tests from the test list.
+        for sTest in self.asSkipTests:
+            try:    self.asTests.remove(sTest);
+            except: pass;
+
+        # If no test2, then no test VMs.
+        if 'test2' not in self.asTests:
+            self.asTestVMs = [];
+
+        return vbox.TestDriver.completeOptions(self);
+
+    def getResourceSet(self):
+        # Construct the resource list the first time it's queried.
+        if self.asRsrcs is None:
+            self.asRsrcs = [];
+            if 'tst-rhel5' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/rhel5.vdi');
+            if 'tst-rhel5-64' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/rhel5-64.vdi');
+            if 'tst-sles11' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/sles11.vdi');
+            if 'tst-sles11-64' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/sles11-64.vdi');
+            if 'tst-oel' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/oel.vdi');
+            if 'tst-oel-64' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/oel-64.vdi');
+            if 'tst-win2k3ent' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/win2k3ent-acpi.vdi');
+            if 'tst-win2k3ent-64' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/win2k3ent-64.vdi');
+            if 'tst-win2k8' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/win2k8.vdi');
+            if 'tst-sol10' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/solaris10.vdi');
+            if 'tst-sol11' in self.asTestVMs:
+                self.asRsrcs.append('3.0/tcp/solaris11.vdi');
+        return self.asRsrcs;
+
+    def actionConfig(self):
+        ## @todo actionConfig() and getResourceSet() are working on the same
+        # set of VMs as tdNetBenchmark1, creating common base class would be
+        # a good idea.
+
+        # Some stupid trickery to guess the location of the iso. ## fixme - testsuite unzip ++
+        sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxValidationKit.iso'));
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxTestSuite.iso'));
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/validationkit/VBoxValidationKit.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/testsuite/VBoxTestSuite.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sCur = os.getcwd();
+            for i in range(0, 10):
+                sVBoxValidationKit_iso = os.path.join(sCur, 'validationkit/VBoxValidationKit.iso');
+                if os.path.isfile(sVBoxValidationKit_iso):
+                    break;
+                sVBoxValidationKit_iso = os.path.join(sCur, 'testsuite/VBoxTestSuite.iso');
+                if os.path.isfile(sVBoxValidationKit_iso):
+                    break;
+                sCur = os.path.abspath(os.path.join(sCur, '..'));
+                if i is not None: pass;     # shut up pychecker/pylint.
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/home/bird/validationkit/VBoxValidationKit.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/home/bird/testsuite/VBoxTestSuite.iso';
+
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        #
+        # Configure the empty VMs we're going to use for the first tests.
+        #
+
+        if 'test1' in self.asTests:
+            #oVM = self.createTestVMs('tst-empty-hwvirt', 0, sKind = 'Other', fVirtEx = True);
+            #if oVM is None:
+            #    return False;
+
+            oVM = self.createTestVMs('tst-empty-raw', 2, sKind = 'Other', fVirtEx = False);
+            if oVM is None:
+                return False;
+
+        #
+        # Configure the VMs we're going to use for the last test.
+        #
+
+        # Linux VMs
+        if 'tst-rhel5' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-rhel5', 1, '3.0/tcp/rhel5.vdi', sKind = 'RedHat', fIoApic = True, \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-rhel5-64' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-rhel5-64', 1, '3.0/tcp/rhel5-64.vdi', sKind = 'RedHat_64', \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-sles11' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-sles11', 1, '3.0/tcp/sles11.vdi', sKind = 'OpenSUSE', fIoApic = True, \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-sles11-64' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-sles11-64', 1, '3.0/tcp/sles11-64.vdi', sKind = 'OpenSUSE_64', \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-oel' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-oel', 1, '3.0/tcp/oel.vdi', sKind = 'Oracle', fIoApic = True, \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-oel-64' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-oel-64', 1, '3.0/tcp/oel-64.vdi', sKind = 'Oracle_64', \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        # Windows VMs
+        if 'tst-win2k3ent' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-win2k3ent', 1, '3.0/tcp/win2k3ent-acpi.vdi', sKind = 'Windows2003', \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-win2k3ent-64' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-win2k3ent-64', 1, '3.0/tcp/win2k3ent-64.vdi', sKind = 'Windows2003_64', \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-win2k8' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-win2k8', 1, '3.0/tcp/win2k8.vdi', sKind = 'Windows2008_64', \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        # Solaris VMs
+        if 'tst-sol10' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-sol10', 1, '3.0/tcp/solaris10.vdi', sKind = 'Solaris_64', \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        if 'tst-sol11' in self.asTestVMs:
+            oVM = self.createTestVMs('tst-sol11', 1, '3.0/tcp/os2009-11.vdi', sKind = 'Solaris_64', \
+                                     sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        fRc         = 'test1' not in self.asTests  or  self.test1();
+        if fRc: fRc = 'test2' not in self.asTests  or  self.test2();
+        return fRc;
+
+
+    #
+    # Test config helpers.
+    #
+
+    def createTestVMs(self, sName, iGroup, *tArgs, **dKeywordArgs):
+        """
+        Wrapper around vbox.createTestVM for creating two VMs, the source
+        (sName-1) and target (sName-2).
+
+        Returns the 2nd VM object on success, None on failure.
+        """
+        sName1 = sName + '-1';
+        oVM = self.createTestVM(sName1, iGroup * 2, *tArgs, **dKeywordArgs);
+        if oVM is not None:
+            sName2 = sName + '-2';
+            oVM = self.createTestVM(sName2, iGroup * 2 + 1, *tArgs, **dKeywordArgs);
+        return oVM;
+
+
+    #
+    # Test execution helpers.
+    #
+
+    def test2Teleport(self, oVmSrc, oSessionSrc, oVmDst):
+        """
+        Attempts a teleportation.
+
+        Returns the input parameters for the next test2Teleport call (source
+        and destiation are switched around).  The input session is closed and
+        removed from the task list, while the return session is in the list.
+        """
+
+        # Enable the teleporter of the VM.
+        oSession = self.openSession(oVmDst);
+        fRc = oSession is not None
+        if fRc:
+            fRc = oSession.enableTeleporter();
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+        if fRc:
+            # Start the destination VM.
+            oSessionDst, oProgressDst = self.startVmEx(oVmDst, fWait = False);
+            if oSessionDst is not None:
+                if oProgressDst.waitForOperation(iOperation = -3) == 0:
+
+                    # Do the teleportation.
+                    try:
+                        uDstPort = oVmDst.teleporterPort;
+                    except:
+                        reporter.logXcpt();
+                        uDstPort = 6502;
+                    oProgressSrc = oSessionSrc.teleport('localhost', uDstPort, 'password', 1024);
+                    if oProgressSrc is not None:
+                        oProgressSrc.wait();
+                        if oProgressSrc.isSuccess():
+                            oProgressDst.wait();
+                        if oProgressSrc.isSuccess() and oProgressDst.isSuccess():
+
+                            # Terminate the source VM.
+                            self.terminateVmBySession(oSessionSrc, oProgressSrc);
+
+                            # Return with the source and destination swapped.
+                            self.addTask(oSessionDst);
+                            return oVmDst, oSessionDst, oVmSrc;
+
+                        # Failure / bail out.
+                        oProgressSrc.logResult();
+                oProgressDst.logResult();
+                self.terminateVmBySession(oSessionDst, oProgressDst);
+        return oVmSrc, oSessionSrc, oVmDst;
+
+    def test2OneCfg(self, sVmBaseName, cCpus, fHwVirt, fNestedPaging):
+        """
+        Runs the specified VM thru test #1.
+        """
+
+        # Reconfigure the source VM.
+        oVmSrc = self.getVmByName(sVmBaseName + '-1');
+        fRc = True;
+        oSession = self.openSession(oVmSrc);
+        if oSession is not None:
+            fRc = fRc and oSession.enableVirtEx(fHwVirt);
+            fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
+            fRc = fRc and oSession.setCpuCount(cCpus);
+            fRc = fRc and oSession.setupTeleporter(False, uPort=6501, sPassword='password');
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Reconfigure the destination VM.
+        oVmDst = self.getVmByName(sVmBaseName + '-2');
+        oSession = self.openSession(oVmDst);
+        if oSession is not None:
+            fRc = fRc and oSession.enableVirtEx(fHwVirt);
+            fRc = fRc and oSession.enableNestedPaging(fNestedPaging);
+            fRc = fRc and oSession.setCpuCount(cCpus);
+            fRc = fRc and oSession.setupTeleporter(True, uPort=6502, sPassword='password');
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Simple test.
+        if fRc is True:
+            self.logVmInfo(oVmSrc);
+            self.logVmInfo(oVmDst);
+
+            # Start the source VM.
+            oSessionSrc = self.startVm(oVmSrc);
+            if oSessionSrc is not None:
+                self.addTask(oSessionSrc);
+
+                # Simple back and forth to test the ice...
+                cTeleportations = 0;
+                oVmSrc, oSessionSrc, oVmDst = self.test2Teleport(oVmSrc, oSessionSrc, oVmDst);
+                if reporter.testErrorCount() == 0:
+                    cTeleportations += 1;
+                    oVmSrc, oSessionSrc, oVmDst = self.test2Teleport(oVmSrc, oSessionSrc, oVmDst);
+
+                # Teleport back and forth for a while.
+                msStart = base.timestampMilli();
+                while reporter.testErrorCount() == 0:
+                    cTeleportations += 1;
+                    if oSessionSrc.txsTryConnectViaTcp(2500, 'localhost') is True:
+                        break;
+                    oVmSrc, oSessionSrc, oVmDst = self.test2Teleport(oVmSrc, oSessionSrc, oVmDst);
+                    cMsElapsed = base.timestampMilli() - msStart;
+                    if cMsElapsed > 5*60000:
+                        reporter.testFailure('TXS did not show up after %u min of teleporting (%u)...' \
+                                             % (cMsElapsed / 60000.0, cTeleportations));
+                        break;
+
+                # Clean up the source VM.
+                self.terminateVmBySession(oSessionSrc)
+        return None;
+
+    def test2OneVM(self, sVmBaseName, asSupVirtModes = None, rSupCpus = range(1, 256)):
+        """
+        Runs one VM (a pair really) thru the various configurations.
+        """
+        if asSupVirtModes is None:
+            asSupVirtModes = self.asVirtModes;
+
+        reporter.testStart(sVmBaseName);
+        for cCpus in self.acCpus:
+            if cCpus == 1:  reporter.testStart('1 cpu');
+            else:           reporter.testStart('%u cpus' % (cCpus));
+
+            for sVirtMode in self.asVirtModes:
+                if sVirtMode == 'raw' and cCpus > 1:
+                    continue;
+                if cCpus not in rSupCpus:
+                    continue;
+                if sVirtMode not in asSupVirtModes:
+                    continue;
+                hsVirtModeDesc = {};
+                hsVirtModeDesc['raw']       = 'Raw-mode';
+                hsVirtModeDesc['hwvirt']    = 'HwVirt';
+                hsVirtModeDesc['hwvirt-np'] = 'NestedPaging';
+                reporter.testStart(hsVirtModeDesc[sVirtMode]);
+
+                fHwVirt       = sVirtMode != 'raw';
+                fNestedPaging = sVirtMode == 'hwvirt-np';
+                self.test2OneCfg(sVmBaseName, cCpus, fHwVirt, fNestedPaging);
+
+                reporter.testDone();
+            reporter.testDone();
+        return reporter.testDone()[1] == 0;
+
+    def test2(self):
+        """
+        Executes test #2.
+        """
+
+        # Loop thru the test VMs.
+        fRc = True;
+        for sVM in self.asTestVMs:
+            # figure args.
+            asSupVirtModes = None;
+            if sVM in ('tst-sol11', 'tst-sol10'): # 64-bit only
+                asSupVirtModes = ['hwvirt', 'hwvirt-np',];
+
+            # run test on the VM.
+            if not self.test2OneVM(sVM, asSupVirtModes):
+                fRc = False;
+
+        return fRc;
+    #
+    # Test #1
+    #
+
+    def test1ResetVmConfig(self, oVM, fTeleporterEnabled = False):
+        """
+        Resets the teleportation config for the specified VM.
+        Returns True on success, False on failure.
+        """
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            fRc = oSession.setupTeleporter(fTeleporterEnabled, uPort=6502, sPassword='password');
+            fRc = fRc and oSession.saveSettings();
+            if not oSession.close(): fRc = False;
+            oSession = None;
+        else:
+            fRc = False;
+        return fRc;
+
+    def test1Sub7(self, oVmSrc, oVmDst):
+        """
+        Test the password check.
+        """
+        reporter.testStart('Bad password');
+        if    self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False) \
+          and self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True):
+            # Start the target VM.
+            oSessionDst, oProgressDst = self.startVmEx(oVmDst, fWait = False);
+            if oSessionDst is not None:
+                if oProgressDst.waitForOperation(iOperation = -3) == 0:
+                    # Start the source VM.
+                    oSessionSrc = self.startVm(oVmSrc);
+                    if oSessionSrc is not None:
+                        tsPasswords = ('password-bad', 'passwor', 'pass', 'p', '', 'Password', );
+                        for sPassword in tsPasswords:
+                            reporter.testStart(sPassword);
+                            oProgressSrc = oSessionSrc.teleport('localhost', 6502, sPassword);
+                            if oProgressSrc:
+                                oProgressSrc.wait();
+                                reporter.log('src: %s' % oProgressSrc.stringifyResult());
+                                if oProgressSrc.isSuccess():
+                                    reporter.testFailure('IConsole::teleport succeeded with bad password "%s"' % sPassword);
+                                elif oProgressSrc.getErrInfoResultCode() != vbox.ComError.E_FAIL:
+                                    reporter.testFailure('IConsole::teleport returns %s instead of E_FAIL' \
+                                                         % (vbox.ComError.toString(oProgressSrc.getErrInfoResultCode()),));
+                                elif oProgressSrc.getErrInfoText() != 'Invalid password':
+                                    reporter.testFailure('IConsole::teleport returns "%s" instead of "Invalid password"' \
+                                                         % (oProgressSrc.getErrInfoText(),));
+                                elif oProgressDst.isCompleted():
+                                    reporter.testFailure('Destination completed unexpectedly after bad password "%s"' \
+                                                         % sPassword);
+                            else:
+                                reporter.testFailure('IConsole::teleport failed with password "%s"' % sPassword);
+                            if reporter.testDone()[1] != 0:
+                                break;
+                        self.terminateVmBySession(oSessionSrc, oProgressSrc);
+                self.terminateVmBySession(oSessionDst, oProgressDst);
+        else:
+            reporter.testFailure('reconfig failed');
+        return reporter.testDone()[1] == 0;
+
+    def test1Sub6(self, oVmSrc, oVmDst):
+        """
+        Misconfigure the target VM and check that teleportation fails with the
+        same status and message on both ends.
+        xTracker: #4813
+        """
+        reporter.testStart('Misconfiguration & error message');
+        if    self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False) \
+          and self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True):
+            # Give the source a bit more RAM.
+            oSession = self.openSession(oVmSrc);
+            if oSession is not None:
+                try:    cbMB = oVmSrc.memorySize + 4;
+                except: cbMB = 1; fRc = False;
+                fRc = oSession.setRamSize(cbMB);
+                if not oSession.saveSettings(): fRc = False;
+                if not oSession.close():        fRc = False;
+                oSession = None;
+            else:
+                fRc = False;
+            if fRc:
+                # Start the target VM.
+                oSessionDst, oProgressDst = self.startVmEx(oVmDst, fWait = False);
+                if oSessionDst is not None:
+                    if oProgressDst.waitForOperation(iOperation = -3) == 0:
+                        # Start the source VM.
+                        oSessionSrc = self.startVm(oVmSrc);
+                        if oSessionSrc is not None:
+                            # Try teleport.
+                            oProgressSrc = oSessionSrc.teleport('localhost', 6502, 'password');
+                            if oProgressSrc:
+                                oProgressSrc.wait();
+                                oProgressDst.wait();
+
+                                reporter.log('src: %s' % oProgressSrc.stringifyResult());
+                                reporter.log('dst: %s' % oProgressDst.stringifyResult());
+
+                                # Make sure it failed.
+                                if oProgressSrc.isSuccess() and oProgressDst.isSuccess():
+                                    reporter.testFailure('The teleporation did not fail as expected');
+
+                                # Compare the results.
+                                if oProgressSrc.getResult() != oProgressDst.getResult():
+                                    reporter.testFailure('Result differs - src=%s dst=%s' \
+                                                         % (vbox.ComError.toString(oProgressSrc.getResult()),\
+                                                            vbox.ComError.toString(oProgressDst.getResult())));
+                                elif oProgressSrc.getErrInfoResultCode() != oProgressDst.getErrInfoResultCode():
+                                    reporter.testFailure('ErrorInfo::resultCode differs - src=%s dst=%s' \
+                                                         % (vbox.ComError.toString(oProgressSrc.getErrInfoResultCode()),\
+                                                            vbox.ComError.toString(oProgressDst.getErrInfoResultCode())));
+                                elif oProgressSrc.getErrInfoText() != oProgressDst.getErrInfoText():
+                                    reporter.testFailure('ErrorInfo::text differs - src="%s" dst="%s"' \
+                                                         % (oProgressSrc.getErrInfoText(), oProgressDst.getErrInfoText()));
+
+                            self.terminateVmBySession(oSessionSrc, oProgressSrc);
+                    self.terminateVmBySession(oSessionDst, oProgressDst);
+                    self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False)
+                    self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True);
+            else:
+                reporter.testFailure('reconfig #2 failed');
+        else:
+            reporter.testFailure('reconfig #1 failed');
+        return reporter.testDone()[1] == 0;
+
+    def test1Sub5(self, oVmSrc, oVmDst):
+        """
+        Test that basic teleporting works.
+        xTracker: #4749
+        """
+        reporter.testStart('Simple teleportation');
+        for cSecsX2 in range(0, 10):
+            if    self.test1ResetVmConfig(oVmSrc, fTeleporterEnabled = False) \
+              and self.test1ResetVmConfig(oVmDst, fTeleporterEnabled = True):
+                # Start the target VM.
+                oSessionDst, oProgressDst = self.startVmEx(oVmDst, fWait = False);
+                if oSessionDst is not None:
+                    if oProgressDst.waitForOperation(iOperation = -3) == 0:
+                        # Start the source VM.
+                        oSessionSrc = self.startVm(oVmSrc);
+                        if oSessionSrc is not None:
+                            self.sleep(cSecsX2 / 2);
+                            # Try teleport.
+                            oProgressSrc = oSessionSrc.teleport('localhost', 6502, 'password');
+                            if oProgressSrc:
+                                oProgressSrc.wait();
+                                oProgressDst.wait();
+
+                            self.terminateVmBySession(oSessionSrc, oProgressSrc);
+                    self.terminateVmBySession(oSessionDst, oProgressDst);
+            else:
+                reporter.testFailure('reconfig failed');
+        return reporter.testDone()[1] == 0;
+
+    def test1Sub4(self, oVM):
+        """
+        Test that we can start and cancel a teleportation target.
+        (No source VM trying to connect here.)
+        xTracker: #4965
+        """
+        reporter.testStart('openRemoteSession cancel');
+        for cSecsX2 in range(0, 10):
+            if self.test1ResetVmConfig(oVM, fTeleporterEnabled = True):
+                oSession, oProgress = self.startVmEx(oVM, fWait = False);
+                if oSession is not None:
+                    self.sleep(cSecsX2 / 2);
+                    oProgress.cancel();
+                    oProgress.wait();
+                    self.terminateVmBySession(oSession, oProgress);
+            else:
+                reporter.testFailure('reconfig failed');
+        return reporter.testDone()[1] == 0;
+
+    def test1Sub3(self, oVM):
+        """
+        Test that starting a teleportation target VM will fail if we give it
+        a bad address to bind to.
+        """
+        reporter.testStart('bad IMachine::teleporterAddress');
+
+        # re-configure it with a bad bind-to address.
+        fRc = False;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            fRc = oSession.setupTeleporter(True, uPort=6502, sAddress='no.such.hostname.should.ever.exist.duh');
+            if not oSession.saveSettings(fClose=True): fRc = False;
+            oSession = None;
+        if fRc:
+            # Try start it.
+            oSession, oProgress = self.startVmEx(oVM, fWait = False);
+            if oSession is not None:
+                oProgress.wait();
+                ## TODO: exact error code and look for the IPRT right string.
+                if not oProgress.isCompleted() or oProgress.getResult() >= 0:
+                    reporter.testFailure('%s' % (oProgress.stringifyResult(),));
+                self.terminateVmBySession(oSession, oProgress);
+
+            # put back the old teleporter setup.
+            self.test1ResetVmConfig(oVM, fTeleporterEnabled = True);
+        else:
+            reporter.testFailure('reconfig #1 failed');
+        return reporter.testDone()[1] == 0;
+
+    # test1Sub2 - start
+
+    def test1Sub2SetEnabled(self, oSession, fEnabled):
+        """ This should never fail."""
+        try:
+            oSession.o.machine.teleporterEnabled = fEnabled;
+        except:
+            reporter.testFailureXcpt('machine.teleporterEnabled=%s' % (fEnabled,));
+            return False;
+        try:
+            fNew = oSession.o.machine.teleporterEnabled;
+        except:
+            reporter.testFailureXcpt();
+            return False;
+        if fNew != fEnabled:
+            reporter.testFailure('machine.teleporterEnabled=%s but afterwards it is actually %s' % (fEnabled, fNew));
+            return False;
+        return True;
+
+    def test1Sub2SetPassword(self, oSession, sPassword):
+        """ This should never fail."""
+        try:
+            oSession.o.machine.teleporterPassword = sPassword;
+        except:
+            reporter.testFailureXcpt('machine.teleporterPassword=%s' % (sPassword,));
+            return False;
+        try:
+            sNew = oSession.o.machine.teleporterPassword;
+        except:
+            reporter.testFailureXcpt();
+            return False;
+        if sNew != sPassword:
+            reporter.testFailure('machine.teleporterPassword="%s" but afterwards it is actually "%s"' % (sPassword, sNew));
+            return False;
+        return True;
+
+    def test1Sub2SetPort(self, oSession, uPort, fInvalid = False):
+        """ This can fail, thus fInvalid."""
+        if not fInvalid:
+            uOld = uPort;
+        else:
+            try:    uOld = oSession.o.machine.teleporterPort;
+            except: return reporter.testFailureXcpt();
+
+        try:
+            oSession.o.machine.teleporterPort = uPort;
+        except Exception, oXcpt:
+            if not fInvalid or vbox.ComError.notEqual(oXcpt, vbox.ComError.E_INVALIDARG):
+                return reporter.testFailureXcpt('machine.teleporterPort=%u' % (uPort,));
+        else:
+            if fInvalid:
+                return reporter.testFailureXcpt('machine.teleporterPort=%u succeeded unexpectedly' % (uPort,));
+
+        try:    uNew = oSession.o.machine.teleporterPort;
+        except: return reporter.testFailureXcpt();
+        if uNew != uOld:
+            if not fInvalid:
+                reporter.testFailure('machine.teleporterPort=%u but afterwards it is actually %u' % (uPort, uNew));
+            else:
+                reporter.testFailure('machine.teleporterPort is %u after failure, expected %u' % (uNew, uOld));
+            return False;
+        return True;
+
+    def test1Sub2SetAddress(self, oSession, sAddress):
+        """ This should never fail."""
+        try:
+            oSession.o.machine.teleporterAddress = sAddress;
+        except:
+            reporter.testFailureXcpt('machine.teleporterAddress=%s' % (sAddress,));
+            return False;
+        try:
+            sNew = oSession.o.machine.teleporterAddress;
+        except:
+            reporter.testFailureXcpt();
+            return False;
+        if sNew != sAddress:
+            reporter.testFailure('machine.teleporterAddress="%s" but afterwards it is actually "%s"' % (sAddress, sNew));
+            return False;
+        return True;
+
+    def test1Sub2(self, oVM):
+        """
+        Test the attributes, making sure that we get exceptions on bad values.
+        """
+        reporter.testStart('IMachine::teleport*');
+
+        # Save the original teleporter attributes for the discard test.
+        try:
+            sOrgAddress  = oVM.teleporterAddress;
+            uOrgPort     = oVM.teleporterPort;
+            sOrgPassword = oVM.teleporterPassword;
+            fOrgEnabled  = oVM.teleporterEnabled;
+        except:
+            reporter.testFailureXcpt();
+        else:
+            # Open a session and start messing with the properties.
+            oSession = self.openSession(oVM);
+            if oSession is not None:
+                # Anything goes for the address.
+                reporter.testStart('teleporterAddress');
+                self.test1Sub2SetAddress(oSession, '');
+                self.test1Sub2SetAddress(oSession, '1');
+                self.test1Sub2SetAddress(oSession, 'Anything goes! ^&$@!$%^');
+                reporter.testDone();
+
+                # The port is restricted to {0..65535}.
+                reporter.testStart('teleporterPort');
+                for uPort in range(0, 1000) + range(16000, 17000) + range(32000, 33000) + range(65000, 65536):
+                    if not self.test1Sub2SetPort(oSession, uPort):
+                        break;
+                self.processPendingEvents();
+                reporter.testDone();
+
+                reporter.testStart('teleporterPort negative');
+                self.test1Sub2SetPort(oSession,  65536, True);
+                self.test1Sub2SetPort(oSession, 999999, True);
+                reporter.testDone();
+
+                # Anything goes for the password.
+                reporter.testStart('teleporterPassword');
+                self.test1Sub2SetPassword(oSession, 'password');
+                self.test1Sub2SetPassword(oSession, '');
+                self.test1Sub2SetPassword(oSession, '1');
+                self.test1Sub2SetPassword(oSession, 'Anything goes! ^&$@!$%^');
+                reporter.testDone();
+
+                # Just test that it works.
+                reporter.testStart('teleporterEnabled');
+                self.test1Sub2SetEnabled(oSession, True);
+                self.test1Sub2SetEnabled(oSession, True);
+                self.test1Sub2SetEnabled(oSession, False);
+                self.test1Sub2SetEnabled(oSession, False);
+                reporter.testDone();
+
+                # Finally, discard the changes, close the session and check
+                # that we're back to the originals.
+                if not oSession.discardSettings(True):
+                    reporter.testFailure('Failed to discard settings & close the session')
+            else:
+                reporter.testFailure('Failed to open VM session')
+            try:
+                if oVM.teleporterAddress  != sOrgAddress:   reporter.testFailure('Rollback failed for teleporterAddress');
+                if oVM.teleporterPort     != uOrgPort:      reporter.testFailure('Rollback failed for teleporterPort');
+                if oVM.teleporterPassword != sOrgPassword:  reporter.testFailure('Rollback failed for teleporterPassword');
+                if oVM.teleporterEnabled  != fOrgEnabled:   reporter.testFailure('Rollback failed for teleporterEnabled');
+            except:
+                reporter.testFailureXcpt();
+        return reporter.testDone()[1] != 0;
+
+    # test1Sub1 - start
+
+    def test1Sub1DoTeleport(self, oSession, sHostname, uPort, sPassword, cMsMaxDowntime, hrcExpected, sTestName):
+        """ Do a bad IConsole::teleport call and check the result."""
+        reporter.testStart(sTestName);
+        fRc = False;
+        try:
+            oProgress = oSession.o.console.teleport(sHostname, uPort, sPassword, cMsMaxDowntime);
+        except vbox.ComException, oXcpt:
+            if vbox.ComError.equal(oXcpt, hrcExpected):
+                fRc = True;
+            else:
+                reporter.testFailure('hresult %s, expected %s' \
+                                     % (vbox.ComError.toString(oXcpt.hresult),
+                                        vbox.ComError.toString(hrcExpected)));
+        except Exception, oXcpt:
+            reporter.testFailure('Unexpected exception %s' % (oXcpt));
+        else:
+            reporter.testFailure('Unpexected success');
+            oProgress.cancel();
+            oProgress.wait();
+        reporter.testDone();
+        return fRc;
+
+    def test1Sub1(self, oVM):
+        """ Test simple IConsole::teleport() failure paths. """
+        reporter.testStart('IConsole::teleport');
+        oSession = self.startVm(oVM);
+        if oSession:
+            self.test1Sub1DoTeleport(oSession, 'localhost', 65536, 'password', 10000,
+                                     vbox.ComError.E_INVALIDARG, 'Bad port value 65536');
+            self.test1Sub1DoTeleport(oSession, 'localhost',     0, 'password', 10000,
+                                     vbox.ComError.E_INVALIDARG, 'Bad port value 0');
+            self.test1Sub1DoTeleport(oSession, 'localhost',  5000, 'password', 0,
+                                     vbox.ComError.E_INVALIDARG, 'Bad max downtime');
+            self.test1Sub1DoTeleport(oSession, '',           5000, 'password', 10000,
+                                     vbox.ComError.E_INVALIDARG, 'No hostname');
+            self.test1Sub1DoTeleport(oSession, 'no.such.hostname.should.ever.exist.duh', 5000, 'password', 0,
+                                     vbox.ComError.E_INVALIDARG, 'Non-existing host');
+
+            self.terminateVmBySession(oSession)
+        else:
+            reporter.testFailure('startVm');
+        return reporter.testDone()[1] == 0;
+
+
+    def test1(self):
+        """
+        Executes test #1 - Negative API testing.
+
+        ASSUMES that the VMs are
+        """
+        reporter.testStart('Test 1');
+
+        # Get the VMs.
+        #oVmHwVirt1 = self.getVmByName('tst-empty-hwvirt-1');
+        #oVmHwVirt2 = self.getVmByName('tst-empty-hwvirt-2');
+        oVmRaw1    = self.getVmByName('tst-empty-raw-1');
+        oVmRaw2    = self.getVmByName('tst-empty-raw-2');
+
+        # Reset their teleportation related configuration.
+        fRc = True;
+        #for oVM in (oVmHwVirt1, oVmHwVirt2, oVmRaw1, oVmRaw2):
+        for oVM in (oVmRaw1, oVmRaw2):
+            if not self.test1ResetVmConfig(oVM): fRc = False;
+
+        # Do the testing (don't both with fRc on the subtests).
+        if fRc:
+            self.test1Sub1(oVmRaw1);
+            self.test1Sub2(oVmRaw2);
+            self.test1Sub3(oVmRaw2);
+            self.test1Sub4(oVmRaw2);
+            self.processPendingEvents();
+            self.test1Sub5(oVmRaw1, oVmRaw2);
+            self.test1Sub6(oVmRaw1, oVmRaw2);
+            self.test1Sub7(oVmRaw1, oVmRaw2);
+        else:
+            reporter.testFailure('Failed to reset the VM configs')
+        return reporter.testDone()[1] == 0;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdTeleportLocal1().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/unittests/Makefile.kmk b/src/VBox/ValidationKit/tests/unittests/Makefile.kmk
new file mode 100644
index 0000000..4b2099c
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/unittests/Makefile.kmk
@@ -0,0 +1,41 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Unit Tests.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsUnitTests
+ValidationKitTestsUnitTests_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsUnitTests_INST = $(INST_VALIDATIONKIT)tests/unittests/
+ValidationKitTestsUnitTests_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdUnitTest1.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsUnitTests_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py b/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py
new file mode 100755
index 0000000..4ccb683
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py
@@ -0,0 +1,748 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdUnitTest1.py $
+
+"""
+VirtualBox Validation Kit - Unit Tests.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2010-2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 98857 $"
+
+
+# Standard Python imports.
+import os
+import sys
+import re
+import subprocess
+import shutil
+
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+sys.path.append(g_ksValidationKitDir)
+
+# Validation Kit imports.
+from common     import utils;
+from testdriver import vbox
+from testdriver import reporter
+
+
+class tdUnitTest1(vbox.TestDriver):
+    """
+    Unit Tests.
+    """
+
+    ## The temporary exclude list.
+    ## @note This shall be empty before we release 4.3!
+    kdTestCasesBuggyPerOs = {
+        'darwin': {
+            'testcase/tstRTR0DbgKrnlInfoDriver': '',    # Busted testcase, probably. (VERR_SYMBOL_NOT_FOUND)
+        },
+        'solaris': {
+            'testcase/tstIntNet-1': '',                 # Fails opening rge0, probably a generic issue figuring which nic to use.
+            'testcase/tstIprtList': '',                 # Crashes in the multithreaded test, I think.
+            'testcase/tstRTCritSect': '',               # Fairness/whatever issue here.
+            'testcase/tstRTR0DbgKrnlInfoDriver': '',    # Doesn't even load R0.
+            'testcase/tstRTR0MemUserKernelDriver': '',  # Failes when kernel to kernel buffers.
+            'testcase/tstRTSemRW': '',                  # line 338: RTSemRWReleaseRead(hSemRW): got VERR_ACCESS_DENIED
+            'testcase/tstRTStrAlloc': '',               # VERR_NO_STR_MEMORY!
+            'testcase/tstRTFileGetSize-1': '',          # VERR_DEV_IO_ERROR on /dev/null!
+        },
+        'win': {
+            'testcase/tstFile': '',                     # ??
+            'testcase/tstIntNet-1': '',                 # possibly same issue as solaris.
+            'testcase/tstMouseImpl': '',                # STATUS_ACCESS_VIOLATION
+            'testcase/tstRTR0ThreadPreemptionDriver': '', # ??
+            'testcase/tstRTPath': '<4.3.51r89894',
+            'testcase/tstRTPipe': '',                   # ??
+            'testcase/tstRTR0MemUserKernelDriver': '',  # ??
+            'testcase/tstRTR0SemMutexDriver': '',       # ??
+            'testcase/tstRTStrAlloc': '',               # ??
+            'testcase/tstRTStrFormat': '',              # ??
+            'testcase/tstRTSystemQueryOsInfo': '',      # ??
+            'testcase/tstRTTemp': '',                   # ??
+            'testcase/tstRTTime': '',                   # ??
+            'testcase/tstTime-2': '',                   # Total time differs too much! ... delta=-10859859
+            'testcase/tstUtf8': '',                     # ??
+            'testcase/tstVMMR0CallHost-2': '',          # STATUS_STACK_OVERFLOW
+            'testcase/tstX86-1': '',                    # Fails on win.x86.
+            'tscpasswd': '',                            # ??
+            'tstVMREQ': '',                            # ?? Same as darwin.x86?
+        }
+    };
+
+    kdTestCasesBuggy = {
+        'testcase/tstGuestPropSvc': '',     # GET_NOTIFICATION fails on testboxlin5.de.oracle.com and others.
+        'testcase/tstRTProcCreateEx': '',   # Seen failing on wei01-b6ka-9.de.oracle.com.
+        'testcase/tstTimer': '',            # Sometimes fails on linux, not important atm.
+    };
+
+    ## The permanent exclude list.
+    # @note Stripped extensions!
+    kdTestCasesBlackList = {
+        'testcase/tstClipboardX11Smoke': '',
+        'testcase/tstFileLock': '',
+        'testcase/tstDisasm-2': '',         # without parameters it will disassembler 1GB starting from 0
+        'testcase/tstFileAppendWin-1': '',
+        'testcase/tstDir': '',              # useless without parameters
+        'testcase/tstDir-2': '',            # useless without parameters
+        'testcase/tstGlobalConfig': '',
+        'testcase/tstHostHardwareLinux': '', # must be killed with CTRL-C
+        'testcase/tstHttp': '',             # Talks to outside servers.
+        'testcase/tstRTHttp': '',           # parameters required
+        'testcase/tstLdr-2': '',            # parameters required
+        'testcase/tstLdr-3': '',            # parameters required
+        'testcase/tstLdr': '',              # parameters required
+        'testcase/tstLdrLoad': '',          # parameters required
+        'testcase/tstMove': '',             # parameters required
+        'testcase/tstRTR0Timer': '',        # loads 'tstRTR0Timer.r0'
+        'testcase/tstRTR0ThreadDriver': '', # loads 'tstRTR0Thread.r0'
+        'testcase/tstRunTestcases': '',     # that's a script like this one
+        'testcase/tstRTReqPool': '',        # fails sometimes, testcase buggy
+        'testcase/tstRTS3': '',             # parameters required
+        'testcase/tstSDL': '',              # graphics test
+        'testcase/tstSupLoadModule': '',    # Needs parameters and vboxdrv access. Covered elsewhere.
+        'testcase/tstSeamlessX11': '',      # graphics test
+        'testcase/tstTime-3': '',           # parameters required
+        'testcase/tstVBoxControl': '',      # works only inside a guest
+        'testcase/tstVDCopy': '',           # parameters required
+        'tstAnimate': '',                   # parameters required
+        'tstAPI': '',                       # user interaction required
+        'tstCollector': '',                 # takes forever
+        'testcase/tstHeadless': '',         # parameters required
+        'tstHeadless': '',                  # parameters required
+        'tstMicroRC': '',                   # required by tstMicro
+        'tstVBoxDbg': '',                   # interactive test
+        'testcase/tstTestServMgr': '',      # some strange xpcom18a4 test, does not work
+        'tstTestServMgr': '',               # some strange xpcom18a4 test, does not work
+        'tstPDMAsyncCompletion': '',        # parameters required
+        'testcase/tstXptDump': '',          # parameters required
+        'tstXptDump': '',                   # parameters required
+        'testcase/tstnsIFileEnumerator': '', # some strange xpcom18a4 test, does not work
+        'tstnsIFileEnumerator': '',         # some strange xpcom18a4 test, does not work
+        'testcase/tstSimpleTypeLib': '',    # parameters required
+        'tstSimpleTypeLib': '',             # parameters required
+        'testcase/tstTestAtoms': '',        # additional test file (words.txt) required
+        'tstTestAtoms': '',                 # additional test file (words.txt) required
+        'testcase/tstXptLink': '',          # parameters required
+        'tstXptLink': '',                   # parameters required
+        'tstXPCOMCGlue': '',                # user interaction required
+        'testcase/tstXPCOMCGlue': '',       # user interaction required
+        'testcase/tstCAPIGlue': '',         # user interaction required
+        'testcase/tstTestCallTemplates': '',  # some strange xpcom18a4 test, segfaults
+        'tstTestCallTemplates': '',         # some strange xpcom18a4 test, segfaults
+        'testcase/tstRTFilesystem': '',     # parameters required
+        'testcase/tstRTDvm': '',            # parameters required
+        # later
+        'testcase/tstIntNetR0': '',         # RTSPINLOCK_FLAGS_INTERRUPT_SAFE == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE
+        # slow stuff
+        'testcase/tstAvl': '',              # SLOW!
+        'testcase/tstRTAvl': '',            # SLOW! (new name)
+        'testcase/tstVD': '',               # 8GB fixed-sized vmdk
+        # failed or hang
+        'testcase/tstCryptoPkcs7Verify': '', # hang
+        'tstOVF': '',                       # hang (only ancient version, now in new place)
+        'testcase/tstRTLockValidator': '',  # Lock validation is not enabled for critical sections
+        'testcase/tstGuestControlSvc': '',  # failed: line 288: testHost(&svcTable): expected VINF_SUCCESS, got VERR_NOT_FOUND
+        'testcase/tstRTMemEf': '',          # failed w/o error message
+        'testcase/tstSupSem': '',           # failed: SRE Timeout Accuracy (ms) : FAILED (1 errors)
+        'testcase/tstCryptoPkcs7Sign': '',# failed: 29330:error:02001002:lib(2):func(1):reason(2):NA:0:fopen('server.pem': '','r')
+        'testcase/tstCompressionBenchmark': '', # failed: error: RTZipBlockCompress failed
+                                        # for 'RTZipBlock/LZJB' (#4): VERR_NOT_SUPPORTED
+        'testcase/tstLdr-4': '',            # failed: Failed to get bits for '/home/vbox/test/tmp/bin/testcase/tstLdrObjR0.r0'/0,
+                                        # rc=VERR_SYMBOL_VALUE_TOO_BIG. aborting test
+        'tstPDMAsyncCompletionStress': '',  # VERR_INVALID_PARAMETER (cbSize = 0)
+        'tstMicro': '',                     # doesn't work on solaris, fix later if we care.
+        'tstVMM-HwAccm': '',                # failed: Only checked AMD-V on linux
+        'tstVMM-HM': '',                    # failed: Only checked AMD-V on linux
+        'tstVMMFork': '',                   # failed: xtracker 6171
+        'tstTestFactory': '',               # some strange xpcom18a4 test, does not work
+        'testcase/tstRTSemXRoads': '',      # sporadically failed: Traffic - 8 threads per direction, 10 sec : FAILED (8 errors)
+        'tstVBoxAPILinux': '',              # creates VirtualBox directories for root user because of sudo (should be in vbox)
+        'testcase/tstVMStructDTrace': '',   # This is a D-script generator.
+        'tstVMStructRC': '',                # This is a C-code generator.
+        'tstDeviceStructSizeRC': '',        # This is a C-code generator.
+        'testcase/tstTSC': '',              # Doesn't test anything and might fail with HT or/and too many cores.
+        'testcase/tstOpenUSBDev': '',       # Not a useful testcase.
+    };
+
+    # Suffix exclude list.
+    kasSuffixBlackList = [
+        '.r0',
+        '.gc',
+        '.debug',
+        '.rel',
+        '.sys',
+        '.ko',
+        '.o',
+        '.obj',
+        '.lib',
+        '.a',
+        '.so',
+        '.dll',
+        '.dylib',
+        '.tmp',
+        '.log',
+        '.py',
+        '.pyc',
+        '.pyo',
+        '.pdb',
+        '.dSYM',
+        '.sym',
+    ];
+
+    ## The exclude list.
+    # @note Stripped extensions!
+    kasHardened = [
+        "testcase/tstIntNet-1",
+        "testcase/tstR0ThreadPreemptionDriver", # VBox 4.3
+        "testcase/tstRTR0ThreadPreemptionDriver",
+        "testcase/tstRTR0MemUserKernelDriver",
+        "testcase/tstRTR0SemMutexDriver",
+        "testcase/tstRTR0TimerDriver",
+        "testcase/tstRTR0ThreadDriver",
+        'testcase/tstRTR0DbgKrnlInfoDriver',
+        "tstInt",
+        "tstVMM",
+        "tstVMMFork",
+        "tstVMREQ",
+        'testcase/tstCFGM',
+        'testcase/tstContiguous',
+        'testcase/tstGetPagingMode',
+        'testcase/tstGIP-2',
+        'testcase/tstInit',
+        'testcase/tstLow',
+        'testcase/tstMMHyperHeap',
+        'testcase/tstPage',
+        'testcase/tstPin',
+        'testcase/tstRTTime', 'testcase/tstTime', # GIP test case.
+        'testcase/tstSSM',
+        'testcase/tstSupSem-Zombie',
+    ]
+
+    ## Argument lists
+    kdArguments = {
+        'testcase/tstbntest':       [ '-out', os.devnull, ], # Very noisy.
+    };
+
+
+    ## Status code translations.
+    ## @{
+    kdExitCodeNames = {
+        0:              'RTEXITCODE_SUCCESS',
+        1:              'RTEXITCODE_FAILURE',
+        2:              'RTEXITCODE_SYNTAX',
+        3:              'RTEXITCODE_INIT',
+        4:              'RTEXITCODE_SKIPPED',
+    };
+    kdExitCodeNamesWin = {
+        -1073741515:    'STATUS_DLL_NOT_FOUND',
+        -1073741512:    'STATUS_ORDINAL_NOT_FOUND',
+        -1073741511:    'STATUS_ENTRYPOINT_NOT_FOUND',
+        -1073741502:    'STATUS_DLL_INIT_FAILED',
+        -1073741500:    'STATUS_UNHANDLED_EXCEPTION',
+        -1073741499:    'STATUS_APP_INIT_FAILURE',
+        -1073741819:    'STATUS_ACCESS_VIOLATION',
+        -1073741571:    'STATUS_STACK_OVERFLOW',
+    };
+    ## @}
+
+    def __init__(self):
+        """
+        Reinitialize child class instance.
+        """
+        vbox.TestDriver.__init__(self)
+        self.oTestVmSet = None;
+
+        self.sVBoxInstallRoot = None
+
+        self.cSkipped   = 0
+        self.cPassed    = 0
+        self.cFailed    = 0
+
+        self.sUnitTestsPathBase = None
+        self.sExeSuff   = '.exe' if utils.getHostOs() in [ 'win', 'dos', 'os2' ] else '';
+
+        self.aiVBoxVer  = (4, 3, 0, 0);
+
+        # For testing testcase logic.
+        self.fDryRun    = False;
+
+
+    def _detectPaths(self):
+        """
+        Internal worker for actionVerify and actionExecute that detects paths.
+
+        This sets sVBoxInstallRoot and sUnitTestsPathBase and returns True/False.
+        """
+
+        #
+        # We need a VBox install (/ build) to test.
+        #
+        if False:
+            if not self.importVBoxApi():
+                reporter.error('Unabled to import the VBox Python API.')
+                return False
+        else:
+            self._detectBuild();
+            if self.oBuild is None:
+                reporter.error('Unabled to detect the VBox build.');
+                return False;
+
+        #
+        # Where are the files installed?
+        # Solaris requires special handling because of it's multi arch subdirs.
+        #
+        self.sVBoxInstallRoot = self.oBuild.sInstallPath
+        if not self.oBuild.isDevBuild() and utils.getHostOs() == 'solaris':
+            sArchDir = utils.getHostArch();
+            if sArchDir == 'x86': sArchDir = 'i386';
+            self.sVBoxInstallRoot = os.path.join(self.sVBoxInstallRoot, sArchDir);
+
+        # Add the installation root to the PATH on windows so we can get DLLs from it.
+        if utils.getHostOs() == 'win':
+            sPathName = 'PATH';
+            if not sPathName in os.environ:
+                sPathName = 'Path';
+            sPath = os.environ.get(sPathName, '.');
+            if len(sPath) > 0 and sPath[-1] != ';':
+                sPath += ';';
+            os.environ[sPathName] = sPath + self.sVBoxInstallRoot + ';';
+
+        #
+        # The unittests are generally not installed, so look for them.
+        #
+        sBinOrDist = 'dist' if utils.getHostOs() in [ 'darwin', ] else 'bin';
+        asCandidates = [
+            self.oBuild.sInstallPath,
+            os.path.join(self.sScratchPath, sBinOrDist + '.' + utils.getHostArch()),
+            os.path.join(self.sScratchPath, sBinOrDist, utils.getHostArch()),
+            os.path.join(self.sScratchPath, sBinOrDist),
+        ];
+        if utils.getHostOs() == 'darwin':
+            for i in range(1, len(asCandidates)):
+                asCandidates[i] = os.path.join(asCandidates[i], 'VirtualBox.app', 'Contents', 'MacOS');
+
+        for sCandidat in asCandidates:
+            if os.path.exists(os.path.join(sCandidat, 'testcase', 'tstVMStructSize' + self.sExeSuff)):
+                self.sUnitTestsPathBase = sCandidat;
+                return True;
+
+        reporter.error('Unable to find unit test dir. Candidates: %s' % (asCandidates,))
+        return False;
+
+    #
+    # Overridden methods.
+    #
+
+    def actionVerify(self):
+        return self._detectPaths();
+
+    def actionExecute(self):
+
+        if self.sUnitTestsPathBase is None and self._detectPaths():
+            return False;
+
+        self._figureVersion();
+
+        self.testRunUnitTestsSet(r'^tst*', 'testcase')
+        self.testRunUnitTestsSet(r'^tst*', '.')
+
+        reporter.log('')
+        reporter.log('********************')
+        reporter.log('***  PASSED: %d' % self.cPassed)
+        reporter.log('***  FAILED: %d' % self.cFailed)
+        reporter.log('*** SKIPPED: %d' % self.cSkipped)
+        reporter.log('***   TOTAL: %d' % (self.cPassed + self.cFailed + self.cSkipped))
+
+        return self.cFailed == 0
+
+    #
+    # Test execution helpers.
+    #
+
+    def _figureVersion(self):
+        """ Tries to figure which VBox version this is, setting self.aiVBoxVer. """
+        try:
+            sVer = utils.processOutputChecked(['VBoxManage', '--version'])
+
+            sVer = sVer.strip();
+            sVer = re.sub(r'_BETA.*r', '.', sVer);
+            sVer = re.sub(r'_ALPHA.*r', '.', sVer);
+            sVer = re.sub(r'_RC.*r', '.', sVer);
+            sVer = sVer.replace('r', '.');
+
+            self.aiVBoxVer = [int(sComp) for sComp in sVer.split('.')];
+
+            reporter.log('VBox version: %s' % (self.aiVBoxVer,));
+        except:
+            reporter.logXcpt();
+            return False;
+        return True;
+
+    def _compareVersion(self, aiVer):
+        """
+        Compares the give version string with the vbox version string,
+        returning a result similar to C strcmp().  aiVer is on the right side.
+        """
+        cComponents = min(len(self.aiVBoxVer), len(aiVer));
+        for i in range(cComponents):
+            if self.aiVBoxVer[i] < aiVer[i]:
+                return -1;
+            if self.aiVBoxVer[i] > aiVer[i]:
+                return 1;
+        return len(self.aiVBoxVer) - len(aiVer);
+
+    def _isExcluded(self, sTest, dExclList):
+        """ Checks if the testcase is excluded or not. """
+        if sTest in dExclList:
+            sFullExpr = dExclList[sTest].replace(' ', '').strip();
+            if sFullExpr == '':
+                return True;
+
+            # Consider each exclusion expression. These are generally ranges,
+            # either open ended or closed: "<4.3.51r12345", ">=4.3.0 && <=4.3.4".
+            asExprs = sFullExpr.split(';');
+            for sExpr in asExprs:
+
+                # Split it on the and operator and process each sub expression.
+                fResult = True;
+                for sSubExpr in sExpr.split('&&'):
+                    # Split out the comparison operator and the version value.
+                    if sSubExpr.startswith('<=') or sSubExpr.startswith('>='):
+                        sOp = sSubExpr[:2];
+                        sValue = sSubExpr[2:];
+                    elif sSubExpr.startswith('<') or sSubExpr.startswith('>') or sSubExpr.startswith('='):
+                        sOp = sSubExpr[:1];
+                        sValue = sSubExpr[1:];
+                    else:
+                        sOp = sValue = '';
+
+                    # Convert the version value, making sure we've got a valid one.
+                    try:    aiValue = [int(sComp) for sComp in sValue.replace('r', '.').split('.')];
+                    except: aiValue = ();
+                    if len(aiValue) == 0 or len(aiValue) > 4:
+                        reporter.error('Invalid exclusion expression for %s: "%s" [%s]' % (sTest, sSubExpr, dExclList[sTest]));
+                        return True;
+
+                    # Do the compare.
+                    iCmp = self._compareVersion(aiValue);
+                    if sOp == '>=' and iCmp < 0:
+                        fResult = False;
+                    elif sOp == '>' and iCmp <= 0:
+                        fResult = False;
+                    elif sOp == '<' and iCmp >= 0:
+                        fResult = False;
+                    elif sOp == '>=' and iCmp < 0:
+                        fResult = False;
+                    reporter.log2('iCmp=%s; %s %s %s -> %s' % (iCmp, self.aiVBoxVer, sOp, aiValue, fResult));
+
+                # Did the expression match?
+                if fResult:
+                    return True;
+
+        return False;
+
+    def _sudoExecuteSync(self, asArgs):
+        """
+        Executes a sudo child process synchronously.
+        Returns True if the process executed successfully and returned 0,
+        otherwise False is returned.
+        """
+        reporter.log('Executing [sudo]: %s' % (asArgs, ));
+        try:
+            iRc = utils.sudoProcessCall(asArgs, shell = False, close_fds = False);
+        except:
+            reporter.errorXcpt();
+            return False;
+        reporter.log('Exit code [sudo]: %s (%s)' % (iRc, asArgs));
+        return iRc is 0;
+
+    def _hardenedMkDir(self, sPath):
+        """
+        Creates the directory specified sPath (including parents).
+        """
+        reporter.log('_hardenedMkDir: %s' % (sPath,));
+        if utils.getHostOs() in [ 'win', 'os2' ]:
+            os.makedirs(sPath, 0755);
+        else:
+            fRc = self._sudoExecuteSync(['/bin/mkdir', '-p', '-m', '0755', sPath]);
+            if fRc is not True:
+                raise Exception('Failed to create dir "%s".' % (sPath,));
+        return True;
+
+    def _hardenedCopyFile(self, sSrc, sDst, iMode):
+        """
+        Copies a file.
+        """
+        reporter.log('_hardenedCopyFile: %s -> %s (mode: %o)' % (sSrc, sDst, iMode,));
+        if utils.getHostOs() in [ 'win', 'os2' ]:
+            shutil.copyfile(sSrc, sDst);
+            os.chmod(sDst, iMode);
+        else:
+            fRc = self._sudoExecuteSync(['/bin/cp', sSrc, sDst]);
+            if fRc is not True:
+                raise Exception('Failed to copy "%s" to "%s".' % (sSrc, sDst,));
+            fRc = self._sudoExecuteSync(['/bin/chmod', '%o' % (iMode,), sDst]);
+            if fRc is not True:
+                raise Exception('Failed to chmod "%s".' % (sDst,));
+        return True;
+
+    def _hardenedDeleteFile(self, sPath):
+        """
+        Deletes a file.
+        """
+        reporter.log('_hardenedDeleteFile: %s' % (sPath,));
+        if os.path.exists(sPath):
+            if utils.getHostOs() in [ 'win', 'os2' ]:
+                os.remove(sPath);
+            else:
+                fRc = self._sudoExecuteSync(['/bin/rm', sPath]);
+                if fRc is not True:
+                    raise Exception('Failed to remove "%s".' % (sPath,));
+        return True;
+
+    def _hardenedRemoveDir(self, sPath):
+        """
+        Removes a directory.
+        """
+        reporter.log('_hardenedRemoveDir: %s' % (sPath,));
+        if os.path.exists(sPath):
+            if utils.getHostOs() in [ 'win', 'os2' ]:
+                os.rmdir(sPath);
+            else:
+                fRc = self._sudoExecuteSync(['/bin/rmdir', sPath]);
+                if fRc is not True:
+                    raise Exception('Failed to remove "%s".' % (sPath,));
+        return True;
+
+    def _executeTestCase(self, sName, sFullPath, sTestCaseSubDir, oDevNull): # pylint: disable=R0914
+        """
+        Executes a test case.
+        """
+
+        fSkipped = False;
+
+        #
+        # If hardening is enabled, some test cases and their dependencies
+        # needs to be copied to and execute from the sVBoxInstallRoot
+        # directory in order to work. They also have to be executed as
+        # root, i.e. via sudo.
+        #
+        fHardened       = False;
+        asFilesToRemove = []; # Stuff to clean up.
+        asDirsToRemove  = []; # Ditto.
+        if    sName in self.kasHardened \
+          and self.sUnitTestsPathBase != self.sVBoxInstallRoot:
+
+            sDstDir = os.path.join(self.sVBoxInstallRoot, sTestCaseSubDir);
+            if not os.path.exists(sDstDir):
+                self._hardenedMkDir(sDstDir);
+                asDirsToRemove.append(sDstDir);
+
+            sDst = os.path.join(sDstDir, os.path.basename(sFullPath));
+            self._hardenedCopyFile(sFullPath, sDst, 0755);
+            asFilesToRemove.append(sDst);
+
+            # Copy any associated .dll/.so/.dylib.
+            for sSuff in [ '.dll', '.so', '.dylib' ]:
+                sSrc = os.path.splitext(sFullPath)[0] + sSuff;
+                if os.path.exists(sSrc):
+                    sDst = os.path.join(sDstDir, os.path.basename(sSrc));
+                    self._hardenedCopyFile(sSrc, sDst, 0644);
+                    asFilesToRemove.append(sDst);
+
+            # Copy any associated .r0, .rc and .gc modules.
+            offDriver = sFullPath.rfind('Driver')
+            if offDriver > 0:
+                for sSuff in [ '.r0', 'RC.rc', 'RC.gc' ]:
+                    sSrc = sFullPath[:offDriver] + sSuff;
+                    if os.path.exists(sSrc):
+                        sDst = os.path.join(sDstDir, os.path.basename(sSrc));
+                        self._hardenedCopyFile(sSrc, sDst, 0644);
+                        asFilesToRemove.append(sDst);
+
+            sFullPath = os.path.join(sDstDir, os.path.basename(sFullPath));
+            fHardened = True;
+
+        #
+        # Set up arguments and environment.
+        #
+        asArgs = [sFullPath,]
+        if sName in self.kdArguments:
+            asArgs.extend(self.kdArguments[sName]);
+
+        os.environ['IPRT_TEST_OMIT_TOP_TEST'] = '1';
+        os.environ['IPRT_TEST_FILE'] = sXmlFile = os.path.join(self.sScratchPath, 'result.xml');
+        if os.path.exists(sXmlFile):
+            try:    os.unlink(sXmlFile);
+            except: self._hardenedDeleteFile(sXmlFile);
+
+        #
+        # Execute the test case.
+        #
+        # Windows is confusing output.  Trying a few things to get rid of this.
+        # First, flush both stderr and stdout before running the child.  Second,
+        # assign the child stderr to stdout.  If this doesn't help, we'll have
+        # to capture the child output.
+        #
+        reporter.log('*** Executing %s%s...' % (asArgs, ' [hardened]' if fHardened else ''));
+        try:    sys.stdout.flush();
+        except: pass;
+        try:    sys.stderr.flush();
+        except: pass;
+        if not self.fDryRun:
+            try:
+                if fHardened:
+                    oChild = utils.sudoProcessPopen(asArgs, stdin = oDevNull, stdout = sys.stdout, stderr = sys.stdout);
+                else:
+                    oChild = subprocess.Popen(      asArgs, stdin = oDevNull, stdout = sys.stdout, stderr = sys.stdout);
+            except:
+                if sName in [ 'tstAsmStructsRC',    # 32-bit, may fail to start on 64-bit linux. Just ignore.
+                              ]:
+                    reporter.logXcpt();
+                    fSkipped = True;
+                else:
+                    reporter.errorXcpt();
+                iRc    = 1023;
+                oChild = None;
+
+            if oChild is not None:
+                self.pidFileAdd(oChild.pid, fSudo = fHardened);
+                iRc = oChild.wait();
+                self.pidFileRemove(oChild.pid);
+        else:
+            iRc = 0;
+
+        #
+        # Clean up
+        #
+        for sPath in asFilesToRemove:
+            self._hardenedDeleteFile(sPath);
+        for sPath in asDirsToRemove:
+            self._hardenedRemoveDir(sPath);
+
+        #
+        # Report.
+        #
+        if os.path.exists(sXmlFile):
+            reporter.addSubXmlFile(sXmlFile);
+            if fHardened:
+                self._hardenedDeleteFile(sXmlFile);
+            else:
+                os.unlink(sXmlFile);
+
+        if iRc == 0:
+            reporter.log('*** %s: exit code %d' % (sFullPath, iRc));
+            self.cPassed += 1
+
+        elif iRc == 4: # RTEXITCODE_SKIPPED
+            reporter.log('*** %s: exit code %d (RTEXITCODE_SKIPPED)' % (sFullPath, iRc));
+            fSkipped = True;
+            self.cSkipped += 1;
+
+        elif fSkipped:
+            reporter.log('*** %s: exit code %d (Skipped)' % (sFullPath, iRc));
+            self.cSkipped += 1;
+
+        else:
+            sName = self.kdExitCodeNames.get(iRc, '');
+            if iRc in self.kdExitCodeNamesWin and utils.getHostOs() == 'win':
+                sName = self.kdExitCodeNamesWin[iRc];
+            if sName != '':
+                sName = ' (%s)' % (sName);
+
+            if iRc != 1:
+                reporter.testFailure('Exit status: %d%s' % (iRc, sName));
+                reporter.log(  '!*! %s: exit code %d%s' % (sFullPath, iRc, sName));
+            else:
+                reporter.error('!*! %s: exit code %d%s' % (sFullPath, iRc, sName));
+            self.cFailed += 1
+
+        return fSkipped;
+
+    def testRunUnitTestsSet(self, sTestCasePattern, sTestCaseSubDir):
+        """
+        Run subset of the unit tests set.
+        """
+
+        # Open /dev/null for use as stdin further down.
+        try:
+            oDevNull = open(os.path.devnull, 'w+');
+        except:
+            oDevNull = None;
+
+        # Determin the host OS specific exclusion lists.
+        dTestCasesBuggyForHostOs = self.kdTestCasesBuggyPerOs.get(utils.getHostOs(), []);
+
+        #
+        # Process the file list and run everything looking like a testcase.
+        #
+        for sFilename in sorted(os.listdir(os.path.join(self.sUnitTestsPathBase, sTestCaseSubDir))):
+            # Separate base and suffix and morph the base into something we
+            # can use for reporting and array lookups.
+            sName, sSuffix = os.path.splitext(sFilename);
+            if sTestCaseSubDir != '.':
+                sName = sTestCaseSubDir + '/' + sName;
+
+            # Basic exclusion.
+            if   not re.match(sTestCasePattern, sFilename) \
+              or sSuffix in self.kasSuffixBlackList:
+                reporter.log('"%s" is not a test case.' % (sFilename,))
+                continue
+
+            # Check if the testcase is black listed or buggy before executing it.
+            if self._isExcluded(sName, self.kdTestCasesBlackList):
+                # (No testStart/Done or accounting here!)
+                reporter.log('%s: SKIPPED (blacklisted)' % (sName,));
+
+            elif self._isExcluded(sName, self.kdTestCasesBuggy):
+                reporter.testStart(sName);
+                reporter.log('%s: Skipping, buggy in general.' % (sName,));
+                reporter.testDone(fSkipped = True);
+                self.cSkipped += 1;
+
+            elif self._isExcluded(sName, dTestCasesBuggyForHostOs):
+                reporter.testStart(sName);
+                reporter.log('%s: Skipping, buggy on %s.' % (sName, utils.getHostOs(),));
+                reporter.testDone(fSkipped = True);
+                self.cSkipped += 1;
+
+            else:
+                sFullPath = os.path.normpath(os.path.join(self.sUnitTestsPathBase, os.path.join(sTestCaseSubDir, sFilename)));
+                reporter.testStart(sName);
+                try:
+                    fSkipped = self._executeTestCase(sName, sFullPath, sTestCaseSubDir, oDevNull);
+                except:
+                    reporter.errorXcpt('!*!');
+                    self.cFailed += 1;
+                    fSkipped = False;
+                reporter.testDone(fSkipped);
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdUnitTest1().main(sys.argv))
diff --git a/src/VBox/ValidationKit/tests/usb/Makefile.kmk b/src/VBox/ValidationKit/tests/usb/Makefile.kmk
new file mode 100644
index 0000000..959931e
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/usb/Makefile.kmk
@@ -0,0 +1,42 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - USB.
+#
+
+#
+# Copyright (C) 2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+INSTALLS += ValidationKitTestsUsb
+ValidationKitTestsUsb_TEMPLATE = VBoxValidationKitR3
+ValidationKitTestsUsb_INST = $(INST_VALIDATIONKIT)tests/usb/
+ValidationKitTestsUsb_EXEC_SOURCES := \
+	$(PATH_SUB_CURRENT)/tdUsb1.py \
+	$(PATH_SUB_CURRENT)/usbgadget.py
+
+VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsUsb_EXEC_SOURCES)
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/tests/usb/tdUsb1.py b/src/VBox/ValidationKit/tests/usb/tdUsb1.py
new file mode 100755
index 0000000..c177318
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/usb/tdUsb1.py
@@ -0,0 +1,381 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# $Id: tdUsb1.py $
+
+"""
+VirtualBox Validation Kit - USB testcase and benchmark.
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 98133 $"
+
+
+# Standard Python imports.
+import os;
+import sys;
+import socket;
+
+# Only the main script needs to modify the path.
+try:    __file__
+except: __file__ = sys.argv[0];
+g_ksValidationKitDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))));
+sys.path.append(g_ksValidationKitDir);
+
+# Validation Kit imports.
+from testdriver import reporter;
+from testdriver import base;
+from testdriver import vbox;
+from testdriver import vboxcon;
+
+# USB gadget control import
+from usbgadget import UsbGadget;
+
+class tdUsbBenchmark(vbox.TestDriver):                                      # pylint: disable=R0902
+    """
+    USB benchmark.
+    """
+
+    # The available test devices
+    #
+    # The first key is the hostname of the host the test is running on.
+    # It contains a new dictionary with the attached gadgets based on the
+    # USB speed we want to test (Low, Full, High, Super).
+    # The parameters consist of the hostname of the gadget in the network
+    # and the hardware type.
+    kdGadgetParams = {
+        # The following is for local testing and not for the test lab.
+        'adaris': {
+            'Low':   ('beaglebone', 'BeagleBoneBlack'),
+            'Full':  ('beaglebone', 'BeagleBoneBlack'),
+            'High':  ('beaglebone', 'BeagleBoneBlack'),
+            'Super': ('odroidxu3', 'ODroid-XU3')
+        },
+    };
+
+    # Mappings of USB controllers to supported USB device speeds.
+    kdUsbSpeedMappings = {
+        'OHCI': ['Low', 'Full'],
+        'EHCI': ['High'],
+        'XHCI': ['Low', 'Full', 'High', 'Super']
+    };
+
+    def __init__(self):
+        vbox.TestDriver.__init__(self);
+        self.asRsrcs           = None;
+        self.oGuestToGuestVM   = None;
+        self.oGuestToGuestSess = None;
+        self.oGuestToGuestTxs  = None;
+        self.asTestVMsDef      = ['tst-arch'];
+        self.asTestVMs         = self.asTestVMsDef;
+        self.asSkipVMs         = [];
+        self.asVirtModesDef    = ['hwvirt', 'hwvirt-np', 'raw'];
+        self.asVirtModes       = self.asVirtModesDef;
+        self.acCpusDef         = [1, 2,];
+        self.acCpus            = self.acCpusDef;
+        self.asUsbCtrlsDef     = ['OHCI', 'EHCI', 'XHCI'];
+        self.asUsbCtrls        = self.asUsbCtrlsDef;
+        self.asUsbSpeedDef     = ['Low', 'Full', 'High', 'Super'];
+        self.asUsbSpeed        = self.asUsbSpeedDef;
+        self.sHostname         = socket.gethostname().lower();
+
+    #
+    # Overridden methods.
+    #
+    def showUsage(self):
+        rc = vbox.TestDriver.showUsage(self);
+        reporter.log('');
+        reporter.log('tdStorageBenchmark1 Options:');
+        reporter.log('  --virt-modes    <m1[:m2[:]]');
+        reporter.log('      Default: %s' % (':'.join(self.asVirtModesDef)));
+        reporter.log('  --cpu-counts    <c1[:c2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.acCpusDef)));
+        reporter.log('  --test-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Test the specified VMs in the given order. Use this to change');
+        reporter.log('      the execution order or limit the choice of VMs');
+        reporter.log('      Default: %s  (all)' % (':'.join(self.asTestVMsDef)));
+        reporter.log('  --skip-vms      <vm1[:vm2[:...]]>');
+        reporter.log('      Skip the specified VMs when testing.');
+        reporter.log('  --usb-ctrls     <u1[:u2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.asUsbCtrlsDef)));
+        reporter.log('  --usb-speed     <s1[:s2[:]]');
+        reporter.log('      Default: %s' % (':'.join(str(c) for c in self.asUsbSpeedDef)));
+        return rc;
+
+    def parseOption(self, asArgs, iArg):                                        # pylint: disable=R0912,R0915
+        if asArgs[iArg] == '--virt-modes':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--virt-modes" takes a colon separated list of modes');
+            self.asVirtModes = asArgs[iArg].split(':');
+            for s in self.asVirtModes:
+                if s not in self.asVirtModesDef:
+                    raise base.InvalidOption('The "--virt-modes" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asVirtModesDef)));
+        elif asArgs[iArg] == '--cpu-counts':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--cpu-counts" takes a colon separated list of cpu counts');
+            self.acCpus = [];
+            for s in asArgs[iArg].split(':'):
+                try: c = int(s);
+                except: raise base.InvalidOption('The "--cpu-counts" value "%s" is not an integer' % (s,));
+                if c <= 0:  raise base.InvalidOption('The "--cpu-counts" value "%s" is zero or negative' % (s,));
+                self.acCpus.append(c);
+        elif asArgs[iArg] == '--test-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--test-vms" takes colon separated list');
+            self.asTestVMs = asArgs[iArg].split(':');
+            for s in self.asTestVMs:
+                if s not in self.asTestVMsDef:
+                    raise base.InvalidOption('The "--test-vms" value "%s" is not valid; valid values are: %s' \
+                        % (s, ' '.join(self.asTestVMsDef)));
+        elif asArgs[iArg] == '--skip-vms':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--skip-vms" takes colon separated list');
+            self.asSkipVMs = asArgs[iArg].split(':');
+            for s in self.asSkipVMs:
+                if s not in self.asTestVMsDef:
+                    reporter.log('warning: The "--test-vms" value "%s" does not specify any of our test VMs.' % (s));
+        elif asArgs[iArg] == '--usb-ctrls':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--usb-ctrls" takes a colon separated list of USB controllers');
+            self.asUsbCtrls = asArgs[iArg].split(':');
+            for s in self.asUsbCtrls:
+                if s not in self.asUsbCtrlsDef:
+                    reporter.log('warning: The "--usb-ctrls" value "%s" is not a valid USB controller.' % (s));
+        elif asArgs[iArg] == '--usb-speed':
+            iArg += 1;
+            if iArg >= len(asArgs): raise base.InvalidOption('The "--usb-speed" takes a colon separated list of USB speeds');
+            self.asUsbSpeed = asArgs[iArg].split(':');
+            for s in self.asUsbSpeed:
+                if s not in self.asUsbSpeedDef:
+                    reporter.log('warning: The "--usb-speed" value "%s" is not a valid USB speed.' % (s));
+        else:
+            return vbox.TestDriver.parseOption(self, asArgs, iArg);
+        return iArg + 1;
+
+    def completeOptions(self):
+        # Remove skipped VMs from the test list.
+        for sVM in self.asSkipVMs:
+            try:    self.asTestVMs.remove(sVM);
+            except: pass;
+
+        return vbox.TestDriver.completeOptions(self);
+
+    def getResourceSet(self):
+        # Construct the resource list the first time it's queried.
+        if self.asRsrcs is None:
+            self.asRsrcs = [];
+
+            if 'tst-arch' in self.asTestVMs:
+                self.asRsrcs.append('4.2/usb/tst-arch.vdi');
+
+        return self.asRsrcs;
+
+    def actionConfig(self):
+
+        # Some stupid trickery to guess the location of the iso. ## fixme - testsuite unzip ++
+        sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxValidationKit.iso'));
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../VBoxTestSuite.iso'));
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/validationkit/VBoxValidationKit.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/mnt/ramdisk/vbox/svn/trunk/testsuite/VBoxTestSuite.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sCur = os.getcwd();
+            for i in range(0, 10):
+                sVBoxValidationKit_iso = os.path.join(sCur, 'validationkit/VBoxValidationKit.iso');
+                if os.path.isfile(sVBoxValidationKit_iso):
+                    break;
+                sVBoxValidationKit_iso = os.path.join(sCur, 'testsuite/VBoxTestSuite.iso');
+                if os.path.isfile(sVBoxValidationKit_iso):
+                    break;
+                sCur = os.path.abspath(os.path.join(sCur, '..'));
+                if i is None: pass; # shut up pychecker/pylint.
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/home/bird/validationkit/VBoxValidationKit.iso';
+        if not os.path.isfile(sVBoxValidationKit_iso):
+            sVBoxValidationKit_iso = '/home/bird/testsuite/VBoxTestSuite.iso';
+
+        # Make sure vboxapi has been imported so we can use the constants.
+        if not self.importVBoxApi():
+            return False;
+
+        #
+        # Configure the VMs we're going to use.
+        #
+
+        # Linux VMs
+        if 'tst-arch' in self.asTestVMs:
+            oVM = self.createTestVM('tst-arch', 1, '4.2/usb/tst-arch.vdi', sKind = 'ArchLinux_64', fIoApic = True, \
+                                    eNic0AttachType = vboxcon.NetworkAttachmentType_NAT, \
+                                    sDvdImage = sVBoxValidationKit_iso);
+            if oVM is None:
+                return False;
+
+        return True;
+
+    def actionExecute(self):
+        """
+        Execute the testcase.
+        """
+        fRc = self.testUsb();
+        return fRc;
+
+    def getGadgetParams(self, sHostname, sSpeed):
+        """
+        Returns the gadget hostname and type from the
+        given hostname the test is running on and device speed we want to test.
+        """
+        kdGadgetsConfigured = self.kdGadgetParams.get(sHostname);
+        if kdGadgetsConfigured is not None:
+            return kdGadgetsConfigured.get(sSpeed);
+
+        return (None, None);
+
+    #
+    # Test execution helpers.
+    #
+    def testUsbCompliance(self, oSession, oTxsSession, sSpeed):
+        """
+        Test VirtualBoxs USB stack in a VM.
+        """
+        # Get configured USB test devices from hostname we are running on
+        sGadgetHost, sGadgetType = self.getGadgetParams(self.sHostname, sSpeed);
+
+        # Create device filter
+        fRc = oSession.addUsbDeviceFilter('Compliance device', '0525', 'a4a0');
+        if fRc is True:
+            oUsbGadget = UsbGadget();
+            fRc = oUsbGadget.connectTo(30 * 1000, sGadgetType, sGadgetHost);
+            if fRc is True:
+                fRc = oUsbGadget.impersonate('Test');
+                if fRc is True:
+
+                    # Wait a moment to let the USB device appear
+                    self.sleep(3);
+
+                    fRc = self.txsRunTest(oTxsSession, 'Compliance', 3600 * 1000, \
+                        '${CDROM}/${OS/ARCH}/UsbTest${EXESUFF}', ('UsbTest', ));
+
+                else:
+                    reporter.testFailure('Failed to impersonate test device');
+
+                oUsbGadget.disconnectFrom();
+            else:
+                reporter.testFailure('Failed to connect to USB gadget');
+        else:
+            reporter.testFailure('Failed to create USB device filter');
+
+        return fRc;
+
+    def testUsbOneCfg(self, sVmName, sUsbCtrl, sSpeed):
+        """
+        Runs the specified VM thru test #1.
+
+        Returns a success indicator on the general test execution. This is not
+        the actual test result.
+        """
+        oVM = self.getVmByName(sVmName);
+
+        # Reconfigure the VM
+        fRc = True;
+        oSession = self.openSession(oVM);
+        if oSession is not None:
+            fRc = fRc and oSession.enableVirtEx(True);
+            fRc = fRc and oSession.enableNestedPaging(True);
+
+            # Make sure controllers are disabled initially.
+            fRc = fRc and oSession.enableUsbOhci(False);
+            fRc = fRc and oSession.enableUsbEhci(False);
+            fRc = fRc and oSession.enableUsbXhci(False);
+
+            if sUsbCtrl == 'OHCI':
+                fRc = fRc and oSession.enableUsbOhci(True);
+            elif sUsbCtrl == 'EHCI':
+                fRc = fRc and oSession.enableUsbEhci(True);
+            elif sUsbCtrl == 'XHCI':
+                fRc = fRc and oSession.enableUsbXhci(True);
+            fRc = fRc and oSession.saveSettings();
+            fRc = oSession.close() and fRc and True; # pychecker hack.
+            oSession = None;
+        else:
+            fRc = False;
+
+        # Start up.
+        if fRc is True:
+            self.logVmInfo(oVM);
+            oSession, oTxsSession = self.startVmAndConnectToTxsViaTcp(sVmName, fCdWait = False, fNatForwardingForTxs = False);
+            if oSession is not None:
+                self.addTask(oSession);
+
+                # Fudge factor - Allow the guest to finish starting up.
+                self.sleep(5);
+
+                fRc = self.testUsbCompliance(oSession, oTxsSession, sSpeed);
+
+                # cleanup.
+                self.removeTask(oTxsSession);
+                self.terminateVmBySession(oSession)
+            else:
+                fRc = False;
+        return fRc;
+
+    def testUsbForOneVM(self, sVmName):
+        """
+        Runs one VM thru the various configurations.
+        """
+        reporter.testStart(sVmName);
+        for sUsbCtrl in self.asUsbCtrls:
+            reporter.testStart(sUsbCtrl)
+            for sUsbSpeed in self.asUsbSpeed:
+                asSupportedSpeeds = self.kdUsbSpeedMappings.get(sUsbCtrl);
+                if sUsbSpeed in asSupportedSpeeds:
+                    reporter.testStart(sUsbSpeed)
+                    fRc = self.testUsbOneCfg(sVmName, sUsbCtrl, sUsbSpeed);
+                    reporter.testDone(not fRc);
+            reporter.testDone();
+        reporter.testDone();
+        return fRc;
+
+    def testUsb(self):
+        """
+        Executes USB test.
+        """
+
+        reporter.log("Running on host: " + self.sHostname);
+
+        # Loop thru the test VMs.
+        for sVM in self.asTestVMs:
+            # run test on the VM.
+            if not self.testUsbForOneVM(sVM):
+                fRc = False;
+            else:
+                fRc = True;
+
+        return fRc;
+
+
+
+if __name__ == '__main__':
+    sys.exit(tdUsbBenchmark().main(sys.argv));
+
diff --git a/src/VBox/ValidationKit/tests/usb/usbgadget.py b/src/VBox/ValidationKit/tests/usb/usbgadget.py
new file mode 100644
index 0000000..6033cae
--- /dev/null
+++ b/src/VBox/ValidationKit/tests/usb/usbgadget.py
@@ -0,0 +1,165 @@
+# -*- coding: utf-8 -*-
+# $Id: usbgadget.py $
+# pylint: disable=C0302
+
+"""
+VirtualBox USB gadget control class
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2014 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision: 98132 $"
+
+
+# Validation Kit imports.
+import testdriver.txsclient as txsclient;
+import testdriver.reporter as reporter;
+
+class UsbGadget(object):
+    """
+    USB Gadget control class using the TesteXecService to talk to the external
+    board behaving like a USB device.
+    The board needs to run an embedded Linux system with the TXS service running.
+    """
+
+    def __init__(self):
+        self.oTxsSession = None;
+        self.sImpersonation = 'Invalid';
+        self.sGadgetType    = 'Invalid';
+
+    def _loadModule(self, sModule):
+        """
+        Loads the given module on the USB gadget.
+        Returns True on success.
+        Returns False otherwise.
+        """
+        fRc = False;
+        if self.oTxsSession is not None:
+            fRc = self.oTxsSession.syncExecEx('/usr/bin/modprobe', ('/usr/bin/modprobe', sModule));
+            # For the ODroid-XU3 gadget we have to do a soft connect for the attached host to recognise the device.
+            if self.sGadgetType == 'ODroid-XU3':
+                fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', \
+                        ('/usr/bin/sh', '-c', 'echo connect > /sys/class/udc/12400000.dwc3/soft_connect'));
+
+        return fRc;
+
+    def _unloadModule(self, sModule):
+        """
+        Unloads the given module on the USB gadget.
+        Returns True on success.
+        Returns False otherwise.
+        """
+        fRc = False;
+        if self.oTxsSession is not None:
+            # For the ODroid-XU3 gadget we do a soft disconnect before unloading the gadget driver.
+            if self.sGadgetType == 'ODroid-XU3':
+                fRc = self.oTxsSession.syncExecEx('/usr/bin/sh', \
+                        ('/usr/bin/sh', '-c', 'echo disconnect > /sys/class/udc/12400000.dwc3/soft_connect'));
+            fRc = self.oTxsSession.syncExecEx('/usr/bin/rmmod', ('/usr/bin/rmmod', sModule));
+
+        return fRc;
+
+    def _clearImpersonation(self):
+        """
+        Removes the current impersonation of the gadget.
+        """
+        if self.sImpersonation == 'Invalid':
+            self._unloadModule('g_zero');
+            self._unloadModule('g_mass_storage');
+            self._unloadModule('g_webcam');
+            self._unloadModule('g_ether');
+            return True;
+        elif self.sImpersonation == 'Test':
+            return self._unloadModule('g_zero');
+        elif self.sImpersonation == 'Msd':
+            return self._unloadModule('g_mass_storage');
+        elif self.sImpersonation == 'Webcam':
+            return self._unloadModule('g_webcam');
+        elif self.sImpersonation == 'Network':
+            return self._unloadModule('g_ether');
+        else:
+            reporter.log('Invalid impersonation');
+
+        return False;
+
+    def impersonate(self, sImpersonation):
+        """
+        Impersonate a given device.
+        """
+
+        # Clear any previous impersonation
+        self._clearImpersonation();
+        self.sImpersonation = sImpersonation;
+
+        if sImpersonation == 'Invalid':
+            return False;
+        elif sImpersonation == 'Test':
+            return self._loadModule('g_zero');
+        elif sImpersonation == 'Msd':
+            # @todo: Not complete
+            return self._loadModule('g_mass_storage');
+        elif sImpersonation == 'Webcam':
+            # @todo: Not complete
+            return self._loadModule('g_webcam');
+        elif sImpersonation == 'Network':
+            return self._loadModule('g_ether');
+        else:
+            reporter.log('Invalid impersonation');
+
+        return False;
+
+    def connectTo(self, cMsTimeout, sGadgetType, sHostname, uPort = None):
+        """
+        Connects to the specified target device.
+        Returns True on Success.
+        Returns False otherwise.
+        """
+        if uPort is None:
+            self.oTxsSession = txsclient.openTcpSession(cMsTimeout, sHostname);
+        else:
+            self.oTxsSession = txsclient.openTcpSession(cMsTimeout, sHostname, uPort = uPort);
+        if self.oTxsSession is None:
+            return False;
+
+        fDone = self.oTxsSession.waitForTask(30*1000);
+        print 'connect: waitForTask -> %s, result %s' % (fDone, self.oTxsSession.getResult());
+        if fDone is True and self.oTxsSession.isSuccess():
+            fRc = True;
+        else:
+            fRc = False;
+
+        if fRc is True:
+            self.sGadgetType = sGadgetType;
+
+        return fRc;
+
+    def disconnectFrom(self):
+        """
+        Disconnects from the target device.
+        """
+        fRc = True;
+
+        if self.oTxsSession is not None:
+            self._clearImpersonation();
+            fRc = self.oTxsSession.syncDisconnect();
+
+        return fRc;
diff --git a/src/VBox/ValidationKit/utils/Makefile.kmk b/src/VBox/ValidationKit/utils/Makefile.kmk
new file mode 100644
index 0000000..7580cc5
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/Makefile.kmk
@@ -0,0 +1,60 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Utilities.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# Include sub-makefiles.
+#
+include $(PATH_SUB_CURRENT)/TestExecServ/Makefile.kmk
+include $(PATH_SUB_CURRENT)/cpu/Makefile.kmk
+include $(PATH_SUB_CURRENT)/misc/Makefile.kmk
+include $(PATH_SUB_CURRENT)/network/Makefile.kmk
+ifeq ($(KBUILD_TARGET),win)
+ include $(PATH_SUB_CURRENT)/nt/Makefile.kmk
+endif
+ifeq ($(KBUILD_TARGET),linux)
+ include $(PATH_SUB_CURRENT)/usb/Makefile.kmk
+endif
+
+#
+# On OS/2 the binaries requires the libc DLLs
+# (no official static linking support).
+#
+INSTALLS.os2 += ValidationKitOs2LibC
+ValidationKitOs2LibC_TEMPLATE = VBoxValidationKitR3
+ValidationKitOs2LibC_SOURCES = \
+	$(KBUILD_BIN_PATH)/libc06.dll \
+	$(KBUILD_BIN_PATH)/libc061.dll \
+	$(KBUILD_BIN_PATH)/libc062.dll \
+	$(KBUILD_BIN_PATH)/libc063.dll \
+	$(KBUILD_BIN_PATH)/libc064.dll \
+	$(KBUILD_BIN_PATH)/libc065.dll
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/Makefile.kmk b/src/VBox/ValidationKit/utils/TestExecServ/Makefile.kmk
new file mode 100644
index 0000000..848ecb9
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/Makefile.kmk
@@ -0,0 +1,65 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - The Basic Remote Execution Service.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+
+PROGRAMS += TestExecService
+TestExecService_TEMPLATE = VBoxValidationKitR3
+TestExecService_DEFS = \
+	KBUILD_TARGET=\"$(KBUILD_TARGET)\" \
+	KBUILD_TARGET_ARCH=\"$(KBUILD_TARGET_ARCH)\"
+TestExecService_SOURCES = \
+	TestExecService.cpp \
+	TestExecServiceTcp.cpp
+
+INSTALLS += TestExecServiceFiles
+TestExecServiceFiles_TEMPLATE                = VBoxValidationKitR3
+TestExecServiceFiles_INST                    = $(INST_VALIDATIONKIT)
+TestExecServiceFiles_SOURCES                := \
+	vboxtxs-readme.txt
+
+TestExecServiceFiles_EXEC_SOURCES.linux   := \
+	$(PATH_SUB_CURRENT)/linux/vboxtxs.sh=>linux/vboxtxs \
+	$(PATH_SUB_CURRENT)/linux/vboxtxs-nat.sh=>linux/vboxtxs-nat
+
+TestExecServiceFiles_SOURCES.solaris        := \
+	$(PATH_SUB_CURRENT)/solaris/vboxtxs.xml=>solaris/vboxtxs.xml \
+	$(PATH_SUB_CURRENT)/solaris/vboxtxs-sol10.xml=>solaris/vboxtxs-sol10.xml
+TestExecServiceFiles_EXEC_SOURCES.solaris := \
+	$(PATH_SUB_CURRENT)/solaris/vboxtxs.sh=>solaris/vboxtxs.sh
+
+TestExecServiceFiles_SOURCES.win            := \
+	$(PATH_SUB_CURRENT)/win/vboxtxs.reg=>win/vboxtxs.reg \
+	$(PATH_SUB_CURRENT)/win/vboxtxs-nat.reg=>win/vboxtxs-nat.reg
+TestExecServiceFiles_EXEC_SOURCES.win     := \
+	$(PATH_SUB_CURRENT)/win/vboxtxs.cmd=>win/vboxtxs.cmd \
+	$(PATH_SUB_CURRENT)/win/vboxtxs-nat.cmd=>win/vboxtxs-nat.cmd
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp b/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp
new file mode 100644
index 0000000..06257b3
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/TestExecService.cpp
@@ -0,0 +1,3467 @@
+/* $Id: TestExecService.cpp $ */
+/** @file
+ * TestExecServ - Basic Remote Execution Service.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP RTLOGGROUP_DEFAULT
+#include <iprt/alloca.h>
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/cdrom.h>
+#include <iprt/critsect.h>
+#include <iprt/crc.h>
+#include <iprt/ctype.h>
+#include <iprt/dir.h>
+#include <iprt/env.h>
+#include <iprt/err.h>
+#include <iprt/file.h>
+#include <iprt/getopt.h>
+#include <iprt/handle.h>
+#include <iprt/initterm.h>
+#include <iprt/log.h>
+#include <iprt/mem.h>
+#include <iprt/message.h>
+#include <iprt/param.h>
+#include <iprt/path.h>
+#include <iprt/pipe.h>
+#include <iprt/poll.h>
+#include <iprt/process.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/system.h>
+#include <iprt/thread.h>
+#include <iprt/time.h>
+#include <iprt/uuid.h>
+
+#ifndef RT_OS_WINDOWS
+# include <iprt/zip.h>
+#endif
+
+#include "TestExecServiceInternal.h"
+
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * Handle IDs used by txsDoExec for the poll set.
+ */
+typedef enum TXSEXECHNDID
+{
+    TXSEXECHNDID_STDIN = 0,
+    TXSEXECHNDID_STDOUT,
+    TXSEXECHNDID_STDERR,
+    TXSEXECHNDID_TESTPIPE,
+    TXSEXECHNDID_STDIN_WRITABLE,
+    TXSEXECHNDID_TRANSPORT,
+    TXSEXECHNDID_THREAD
+} TXSEXECHNDID;
+
+
+/**
+ * For buffering process input supplied by the client.
+ */
+typedef struct TXSEXECSTDINBUF
+{
+    /** The mount of buffered data. */
+    size_t  cb;
+    /** The current data offset. */
+    size_t  off;
+    /** The data buffer. */
+    char   *pch;
+    /** The amount of allocated buffer space. */
+    size_t  cbAllocated;
+    /** Send further input into the bit bucket (stdin is dead). */
+    bool    fBitBucket;
+    /** The CRC-32 for standard input (received part). */
+    uint32_t uCrc32;
+} TXSEXECSTDINBUF;
+/** Pointer to a standard input buffer. */
+typedef TXSEXECSTDINBUF *PTXSEXECSTDINBUF;
+
+/**
+ * TXS child process info.
+ */
+typedef struct TXSEXEC
+{
+    PCTXSPKTHDR     pPktHdr;
+    RTMSINTERVAL    cMsTimeout;
+    int             rcReplySend;
+
+    RTPOLLSET       hPollSet;
+    RTPIPE          hStdInW;
+    RTPIPE          hStdOutR;
+    RTPIPE          hStdErrR;
+    RTPIPE          hTestPipeR;
+    RTPIPE          hWakeUpPipeR;
+    RTTHREAD        hThreadWaiter;
+
+    /** @name For the setup phase
+     * @{ */
+    struct StdPipe
+    {
+        RTHANDLE    hChild;
+        PRTHANDLE   phChild;
+    }               StdIn,
+                    StdOut,
+                    StdErr;
+    RTPIPE          hTestPipeW;
+    RTENV           hEnv;
+    /** @} */
+
+    /** For serializating some access. */
+    RTCRITSECT      CritSect;
+    /** @name Members protected by the critical section.
+     * @{ */
+    RTPROCESS       hProcess;
+    /** The process status.  Only valid when fProcessAlive is cleared. */
+    RTPROCSTATUS    ProcessStatus;
+    /** Set when the process is alive, clear when dead. */
+    bool volatile   fProcessAlive;
+    /** The end of the pipe that hThreadWaiter writes to. */
+    RTPIPE          hWakeUpPipeW;
+    /** @} */
+} TXSEXEC;
+/** Pointer to a the TXS child process info. */
+typedef TXSEXEC *PTXSEXEC;
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/**
+ * Transport layers.
+ */
+static const PCTXSTRANSPORT g_apTransports[] =
+{
+    &g_TcpTransport,
+    //&g_SerialTransport,
+    //&g_FileSysTransport,
+    //&g_GuestPropTransport,
+    //&g_TestDevTransport,
+};
+
+/** The select transport layer. */
+static PCTXSTRANSPORT       g_pTransport;
+/** The scratch path. */
+static char                 g_szScratchPath[RTPATH_MAX];
+/** The default scratch path. */
+static char                 g_szDefScratchPath[RTPATH_MAX];
+/** The CD/DVD-ROM path. */
+static char                 g_szCdRomPath[RTPATH_MAX];
+/** The default CD/DVD-ROM path. */
+static char                 g_szDefCdRomPath[RTPATH_MAX];
+/** The operating system short name. */
+static char                 g_szOsShortName[16];
+/** The CPU architecture short name. */
+static char                 g_szArchShortName[16];
+/** The combined "OS.arch" name. */
+static char                 g_szOsDotArchShortName[32];
+/** The combined "OS/arch" name. */
+static char                 g_szOsSlashArchShortName[32];
+/** The executable suffix. */
+static char                 g_szExeSuff[8];
+/** The shell script suffix. */
+static char                 g_szScriptSuff[8];
+/** UUID identifying this TXS instance.  This can be used to see if TXS
+ * has been restarted or not. */
+static RTUUID               g_InstanceUuid;
+/** Whether to display the output of the child process or not.  */
+static bool                 g_fDisplayOutput = true;
+/** Whether to terminate or not.
+ * @todo implement signals and stuff.  */
+static bool volatile        g_fTerminate = false;
+
+/**
+ * Calculates the checksum value, zero any padding space and send the packet.
+ *
+ * @returns IPRT status code.
+ * @param   pPkt                The packet to send.  Must point to a correctly
+ *                              aligned buffer.
+ */
+static int txsSendPkt(PTXSPKTHDR pPkt)
+{
+    Assert(pPkt->cb >= sizeof(*pPkt));
+    pPkt->uCrc32 = RTCrc32(pPkt->achOpcode, pPkt->cb - RT_OFFSETOF(TXSPKTHDR, achOpcode));
+    if (pPkt->cb != RT_ALIGN_32(pPkt->cb, TXSPKT_ALIGNMENT))
+        memset((uint8_t *)pPkt + pPkt->cb, '\0', RT_ALIGN_32(pPkt->cb, TXSPKT_ALIGNMENT) - pPkt->cb);
+
+    Log(("txsSendPkt: cb=%#x opcode=%.8s\n", pPkt->cb, pPkt->achOpcode));
+    Log2(("%.*Rhxd\n", RT_MIN(pPkt->cb, 256), pPkt));
+    int rc = g_pTransport->pfnSendPkt(pPkt);
+    while (RT_UNLIKELY(rc == VERR_INTERRUPTED) && !g_fTerminate)
+        rc = g_pTransport->pfnSendPkt(pPkt);
+    if (RT_FAILURE(rc))
+        Log(("txsSendPkt: rc=%Rrc\n", rc));
+
+    return rc;
+}
+
+/**
+ * Sends a babble reply and disconnects the client (if applicable).
+ *
+ * @param   pszOpcode           The BABBLE opcode.
+ */
+static void txsReplyBabble(const char *pszOpcode)
+{
+    TXSPKTHDR Reply;
+    Reply.cb     = sizeof(Reply);
+    Reply.uCrc32 = 0;
+    memcpy(Reply.achOpcode, pszOpcode, sizeof(Reply.achOpcode));
+
+    g_pTransport->pfnBabble(&Reply, 20*1000);
+}
+
+/**
+ * Receive and validate a packet.
+ *
+ * Will send bable responses to malformed packets that results in a error status
+ * code.
+ *
+ * @returns IPRT status code.
+ * @param   ppPktHdr            Where to return the packet on success.  Free
+ *                              with RTMemFree.
+ * @param   fAutoRetryOnFailure Whether to retry on error.
+ */
+static int txsRecvPkt(PPTXSPKTHDR ppPktHdr, bool fAutoRetryOnFailure)
+{
+    for (;;)
+    {
+        PTXSPKTHDR pPktHdr;
+        int rc = g_pTransport->pfnRecvPkt(&pPktHdr);
+        if (RT_SUCCESS(rc))
+        {
+            /* validate the packet. */
+            if (   pPktHdr->cb >= sizeof(TXSPKTHDR)
+                && pPktHdr->cb < TXSPKT_MAX_SIZE)
+            {
+                Log2(("txsRecvPkt: pPktHdr=%p cb=%#x crc32=%#x opcode=%.8s\n"
+                      "%.*Rhxd\n",
+                      pPktHdr, pPktHdr->cb, pPktHdr->uCrc32, pPktHdr->achOpcode, RT_MIN(pPktHdr->cb, 256), pPktHdr));
+                uint32_t uCrc32Calc = pPktHdr->uCrc32 != 0
+                                    ? RTCrc32(&pPktHdr->achOpcode[0], pPktHdr->cb - RT_OFFSETOF(TXSPKTHDR, achOpcode))
+                                    : 0;
+                if (pPktHdr->uCrc32 == uCrc32Calc)
+                {
+                    AssertCompileMemberSize(TXSPKTHDR, achOpcode, 8);
+                    if (   RT_C_IS_UPPER(pPktHdr->achOpcode[0])
+                        && RT_C_IS_UPPER(pPktHdr->achOpcode[1])
+                        && (RT_C_IS_UPPER(pPktHdr->achOpcode[2]) || pPktHdr->achOpcode[2] == ' ')
+                        && (RT_C_IS_PRINT(pPktHdr->achOpcode[3]) || pPktHdr->achOpcode[3] == ' ')
+                        && (RT_C_IS_PRINT(pPktHdr->achOpcode[4]) || pPktHdr->achOpcode[4] == ' ')
+                        && (RT_C_IS_PRINT(pPktHdr->achOpcode[5]) || pPktHdr->achOpcode[5] == ' ')
+                        && (RT_C_IS_PRINT(pPktHdr->achOpcode[6]) || pPktHdr->achOpcode[6] == ' ')
+                        && (RT_C_IS_PRINT(pPktHdr->achOpcode[7]) || pPktHdr->achOpcode[7] == ' ')
+                       )
+                    {
+                        Log(("txsRecvPkt: cb=%#x opcode=%.8s\n", pPktHdr->cb, pPktHdr->achOpcode));
+                        *ppPktHdr = pPktHdr;
+                        return rc;
+                    }
+
+                    rc = VERR_IO_BAD_COMMAND;
+                }
+                else
+                {
+                    Log(("txsRecvPkt: cb=%#x opcode=%.8s crc32=%#x actual=%#x\n",
+                         pPktHdr->cb, pPktHdr->achOpcode, pPktHdr->uCrc32, uCrc32Calc));
+                    rc = VERR_IO_CRC;
+                }
+            }
+            else
+                rc = VERR_IO_BAD_LENGTH;
+
+            /* Send babble reply and disconnect the client if the transport is
+               connection oriented. */
+            if (rc == VERR_IO_BAD_LENGTH)
+                txsReplyBabble("BABBLE L");
+            else if (rc == VERR_IO_CRC)
+                txsReplyBabble("BABBLE C");
+            else if (rc == VERR_IO_BAD_COMMAND)
+                txsReplyBabble("BABBLE O");
+            else
+                txsReplyBabble("BABBLE  ");
+            RTMemFree(pPktHdr);
+        }
+
+        /* Try again or return failure? */
+        if (   g_fTerminate
+            || rc != VERR_INTERRUPTED
+            || !fAutoRetryOnFailure
+            )
+        {
+            Log(("txsRecvPkt: rc=%Rrc\n", rc));
+            return rc;
+        }
+    }
+}
+
+/**
+ * Make a simple reply, only status opcode.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pReply              The reply packet.
+ * @param   pszOpcode           The status opcode.  Exactly 8 chars long, padd
+ *                              with space.
+ * @param   cbExtra             Bytes in addition to the header.
+ */
+static int txsReplyInternal(PTXSPKTHDR pReply, const char *pszOpcode, size_t cbExtra)
+{
+    /* copy the opcode, don't be too strict in case of a padding screw up. */
+    size_t cchOpcode = strlen(pszOpcode);
+    if (RT_LIKELY(cchOpcode == sizeof(pReply->achOpcode)))
+        memcpy(pReply->achOpcode, pszOpcode, sizeof(pReply->achOpcode));
+    else
+    {
+        Assert(cchOpcode == sizeof(pReply->achOpcode));
+        while (cchOpcode > 0 && pszOpcode[cchOpcode - 1] == ' ')
+            cchOpcode--;
+        AssertMsgReturn(cchOpcode < sizeof(pReply->achOpcode), ("%d/'%.8s'\n", cchOpcode, pszOpcode), VERR_INTERNAL_ERROR_4);
+        memcpy(pReply->achOpcode, pszOpcode, cchOpcode);
+        memset(&pReply->achOpcode[cchOpcode], ' ', sizeof(pReply->achOpcode) - cchOpcode);
+    }
+
+    pReply->cb     = (uint32_t)sizeof(TXSPKTHDR) + (uint32_t)cbExtra;
+    pReply->uCrc32 = 0;
+
+    return txsSendPkt(pReply);
+}
+
+/**
+ * Make a simple reply, only status opcode.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The original packet (for future use).
+ * @param   pszOpcode           The status opcode.  Exactly 8 chars long, padd
+ *                              with space.
+ */
+static int txsReplySimple(PCTXSPKTHDR pPktHdr, const char *pszOpcode)
+{
+    TXSPKTHDR Pkt;
+    NOREF(pPktHdr);
+    return txsReplyInternal(&Pkt, pszOpcode, 0);
+}
+
+/**
+ * Acknowledges a packet with success.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The original packet (for future use).
+ */
+static int txsReplyAck(PCTXSPKTHDR pPktHdr)
+{
+    return txsReplySimple(pPktHdr, "ACK     ");
+}
+
+/**
+ * Replies with a failure.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The original packet (for future use).
+ * @param   pszOpcode           The status opcode.  Exactly 8 chars long, padd
+ *                              with space.
+ * @param   pszDetailsFmt       Longer description of the problem (format
+ *                              string).
+ * @param   va                  Format arguments.
+ */
+static int txsReplyFailureV(PCTXSPKTHDR pPktHdr, const char *pszOpcode, const char *pszDetailFmt, va_list va)
+{
+    NOREF(pPktHdr);
+    union
+    {
+        TXSPKTHDR   Hdr;
+        char        ach[256];
+    } uPkt;
+
+    size_t cchDetail = RTStrPrintfV(&uPkt.ach[sizeof(TXSPKTHDR)],
+                                    sizeof(uPkt) - sizeof(TXSPKTHDR),
+                                    pszDetailFmt, va);
+    return txsReplyInternal(&uPkt.Hdr, pszOpcode, cchDetail + 1);
+}
+
+/**
+ * Replies with a failure.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The original packet (for future use).
+ * @param   pszOpcode           The status opcode.  Exactly 8 chars long, padd
+ *                              with space.
+ * @param   pszDetails          Longer description of the problem (format
+ *                              string).
+ * @param   ...                 Format arguments.
+ */
+static int txsReplyFailure(PCTXSPKTHDR pPktHdr, const char *pszOpcode, const char *pszDetailFmt, ...)
+{
+    va_list va;
+    va_start(va, pszDetailFmt);
+    int rc = txsReplyFailureV(pPktHdr, pszOpcode, pszDetailFmt, va);
+    va_end(va);
+    return rc;
+}
+
+/**
+ * Replies according to the return code.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The packet to reply to.
+ * @param   rcOperation         The status code to report.
+ * @param   pszOperationFmt     The operation that failed.  Typically giving the
+ *                              function call with important arguments.
+ * @param   ...                 Arguments to the format string.
+ */
+static int txsReplyRC(PCTXSPKTHDR pPktHdr, int rcOperation, const char *pszOperationFmt, ...)
+{
+    if (RT_SUCCESS(rcOperation))
+        return txsReplyAck(pPktHdr);
+
+    char    szOperation[128];
+    va_list va;
+    va_start(va, pszOperationFmt);
+    RTStrPrintfV(szOperation, sizeof(szOperation), pszOperationFmt, va);
+    va_end(va);
+
+    return txsReplyFailure(pPktHdr, "FAILED  ", "%s failed with rc=%Rrc (opcode '%.8s')",
+                           szOperation, rcOperation, pPktHdr->achOpcode);
+}
+
+/**
+ * Signal a bad packet minum size.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The packet to reply to.
+ * @param   cbMin               The minimum size.
+ */
+static int txsReplyBadMinSize(PCTXSPKTHDR pPktHdr, size_t cbMin)
+{
+    return txsReplyFailure(pPktHdr, "BAD SIZE", "Expected at least %zu bytes, got %u (opcode '%.8s')",
+                           cbMin, pPktHdr->cb, pPktHdr->achOpcode);
+}
+
+/**
+ * Signal a bad packet exact size.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The packet to reply to.
+ * @param   cb                  The wanted size.
+ */
+static int txsReplyBadSize(PCTXSPKTHDR pPktHdr, size_t cb)
+{
+    return txsReplyFailure(pPktHdr, "BAD SIZE", "Expected at %zu bytes, got %u  (opcode '%.8s')",
+                           cb, pPktHdr->cb, pPktHdr->achOpcode);
+}
+
+/**
+ * Deals with a command that isn't implemented yet.
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The packet which opcode isn't implemented.
+ */
+static int txsReplyNotImplemented(PCTXSPKTHDR pPktHdr)
+{
+    return txsReplyFailure(pPktHdr, "NOT IMPL", "Opcode '%.8s' is not implemented", pPktHdr->achOpcode);
+}
+
+/**
+ * Deals with a unknown command.
+ * @returns IPRT status code of the send.
+ * @param   pPktHdr             The packet to reply to.
+ */
+static int txsReplyUnknown(PCTXSPKTHDR pPktHdr)
+{
+    return txsReplyFailure(pPktHdr, "UNKNOWN ", "Opcode '%.8s' is not known", pPktHdr->achOpcode);
+}
+
+/**
+ * Replaces a variable with its value.
+ *
+ * @returns VINF_SUCCESS or VERR_NO_STR_MEMORY.
+ * @param   ppszNew             In/Out.
+ * @param   pcchNew             In/Out. (Messed up on failure.)
+ * @param   offVar              Variable offset.
+ * @param   cchVar              Variable length.
+ * @param   pszValue            The value.
+ * @param   cchValue            Value length.
+ */
+static int txsReplaceStringVariable(char **ppszNew, size_t *pcchNew, size_t offVar, size_t cchVar,
+                                    const char *pszValue, size_t cchValue)
+{
+    size_t const cchAfter = *pcchNew - offVar - cchVar;
+    if (cchVar < cchValue)
+    {
+        *pcchNew += cchValue - cchVar;
+        int rc = RTStrRealloc(ppszNew, *pcchNew + 1);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    char *pszNew = *ppszNew;
+    memmove(&pszNew[offVar + cchValue], &pszNew[offVar + cchVar], cchAfter + 1);
+    memcpy(&pszNew[offVar], pszValue, cchValue);
+    return VINF_SUCCESS;
+}
+
+/**
+ * Replace the variables found in the source string, returning a new string that
+ * lives on the string heap.
+ *
+ * @returns Boolean success indicator.  Will reply to the client with all the
+ *          gory detail on failure.
+ * @param   pPktHdr             The packet the string relates to.  For replying
+ *                              on error.
+ * @param   pszSrc              The source string.
+ * @param   ppszNew             Where to return the new string.
+ * @param   prcSend             Where to return the status code of the send on
+ *                              failure.
+ */
+static int txsReplaceStringVariables(PCTXSPKTHDR pPktHdr, const char *pszSrc, char **ppszNew, int *prcSend)
+{
+    /* Lazy approach that employs memmove.  */
+    size_t  cchNew    = strlen(pszSrc);
+    char   *pszNew    = RTStrDup(pszSrc);
+    char   *pszDollar = pszNew;
+    while ((pszDollar = strchr(pszDollar, '$')) != NULL)
+    {
+        if (pszDollar[1] == '{')
+        {
+            const char *pszEnd = strchr(&pszDollar[2], '}');
+            if (pszEnd)
+            {
+#define IF_VARIABLE_DO(pszDollar, szVarExpr, pszValue) \
+    if (   cchVar == sizeof(szVarExpr) - 1 \
+        && !memcmp(pszDollar, szVarExpr, sizeof(szVarExpr) - 1) ) \
+    { \
+        size_t const cchValue = strlen(pszValue); \
+        rc = txsReplaceStringVariable(&pszNew, &cchNew, offDollar, \
+                                      sizeof(szVarExpr) - 1, pszValue, cchValue); \
+        offDollar += cchValue; \
+    }
+                int          rc;
+                size_t const cchVar    = pszEnd - pszDollar + 1; /* includes "${}" */
+                size_t       offDollar = pszDollar - pszNew;
+                     IF_VARIABLE_DO(pszDollar, "${CDROM}",   g_szCdRomPath)
+                else IF_VARIABLE_DO(pszDollar, "${SCRATCH}", g_szScratchPath)
+                else IF_VARIABLE_DO(pszDollar, "${ARCH}",    g_szArchShortName)
+                else IF_VARIABLE_DO(pszDollar, "${OS}",      g_szOsShortName)
+                else IF_VARIABLE_DO(pszDollar, "${OS.ARCH}", g_szOsDotArchShortName)
+                else IF_VARIABLE_DO(pszDollar, "${OS/ARCH}", g_szOsSlashArchShortName)
+                else IF_VARIABLE_DO(pszDollar, "${EXESUFF}", g_szExeSuff)
+                else IF_VARIABLE_DO(pszDollar, "${SCRIPTSUFF}", g_szScriptSuff)
+                else
+                {
+                    RTStrFree(pszNew);
+                    *prcSend = txsReplyFailure(pPktHdr, "UNKN VAR", "Unknown variable '%.*s' encountered in '%s'",
+                                               cchVar, pszDollar, pszSrc);
+                    *ppszNew = NULL;
+                    return false;
+                }
+                pszDollar = &pszNew[offDollar];
+
+                if (RT_FAILURE(rc))
+                {
+                    RTStrFree(pszNew);
+                    *prcSend = txsReplyRC(pPktHdr, rc, "RTStrRealloc");
+                    *ppszNew = NULL;
+                    return false;
+                }
+#undef IF_VARIABLE_DO
+            }
+        }
+    }
+
+    *ppszNew = pszNew;
+    *prcSend = VINF_SUCCESS;
+    return true;
+}
+
+/**
+ * Checks if the string is valid and returns the expanded version.
+ *
+ * @returns true if valid, false if invalid.
+ * @param   pPktHdr             The packet being unpacked.
+ * @param   pszArgName           The argument name.
+ * @param   psz                 Pointer to the string within pPktHdr.
+ * @param   ppszExp             Where to return the expanded string.  Must be
+ *                              freed by calling RTStrFree().
+ * @param   ppszNext            Where to return the pointer to the next field.
+ *                              If NULL, then we assume this string is at the
+ *                              end of the packet and will make sure it has the
+ *                              advertised length.
+ * @param   prcSend             Where to return the status code of the send on
+ *                              failure.
+ */
+static bool txsIsStringValid(PCTXSPKTHDR pPktHdr, const char *pszArgName, const char *psz,
+                             char **ppszExp, const char **ppszNext, int *prcSend)
+{
+    *ppszExp = NULL;
+    if (ppszNext)
+        *ppszNext = NULL;
+
+    size_t const    off = psz - (const char *)pPktHdr;
+    if (pPktHdr->cb <= off)
+    {
+        *prcSend = txsReplyFailure(pPktHdr, "STR MISS", "Missing string argument '%s' in '%.8s'",
+                                   pszArgName, pPktHdr->achOpcode);
+        return false;
+    }
+
+    size_t const    cchMax = pPktHdr->cb - off;
+    const char     *pszEnd = RTStrEnd(psz, cchMax);
+    if (!pszEnd)
+    {
+        *prcSend = txsReplyFailure(pPktHdr, "STR TERM", "The string argument '%s' in '%.8s' is unterminated",
+                                   pszArgName, pPktHdr->achOpcode);
+        return false;
+    }
+
+    if (!ppszNext && (size_t)(pszEnd - psz) != cchMax - 1)
+    {
+        *prcSend = txsReplyFailure(pPktHdr, "STR SHRT", "The string argument '%s' in '%.8s' is shorter than advertised",
+                                   pszArgName, pPktHdr->achOpcode);
+        return false;
+    }
+
+    if (!txsReplaceStringVariables(pPktHdr, psz, ppszExp, prcSend))
+        return false;
+    if (ppszNext)
+        *ppszNext = pszEnd + 1;
+    return true;
+}
+
+/**
+ * Validates a packet with a single string after the header.
+ *
+ * @returns true if valid, false if invalid.
+ * @param   pPktHdr             The packet.
+ * @param   pszArgName          The argument name.
+ * @param   ppszExp             Where to return the string pointer.  Variables
+ *                              will be replaced and it must therefore be freed
+ *                              by calling RTStrFree().
+ * @param   prcSend             Where to return the status code of the send on
+ *                              failure.
+ */
+static bool txsIsStringPktValid(PCTXSPKTHDR pPktHdr, const char *pszArgName, char **ppszExp, int *prcSend)
+{
+    if (pPktHdr->cb < sizeof(TXSPKTHDR) + 2)
+    {
+        *ppszExp = NULL;
+        *prcSend = txsReplyBadMinSize(pPktHdr, sizeof(TXSPKTHDR) + 2);
+        return false;
+    }
+
+    return txsIsStringValid(pPktHdr, pszArgName, (const char *)(pPktHdr + 1), ppszExp, NULL, prcSend);
+}
+
+/**
+ * Checks if the two opcodes match.
+ *
+ * @returns true on match, false on mismatch.
+ * @param   pPktHdr             The packet header.
+ * @param   pszOpcode2          The opcode we're comparing with.  Does not have
+ *                              to be the whole 8 chars long.
+ */
+DECLINLINE(bool) txsIsSameOpcode(PCTXSPKTHDR pPktHdr, const char *pszOpcode2)
+{
+    if (pPktHdr->achOpcode[0] != pszOpcode2[0])
+        return false;
+    if (pPktHdr->achOpcode[1] != pszOpcode2[1])
+        return false;
+
+    unsigned i = 2;
+    while (   i < RT_SIZEOFMEMB(TXSPKTHDR, achOpcode)
+           && pszOpcode2[i] != '\0')
+    {
+        if (pPktHdr->achOpcode[i] != pszOpcode2[i])
+            break;
+        i++;
+    }
+
+    if (   i < RT_SIZEOFMEMB(TXSPKTHDR, achOpcode)
+        && pszOpcode2[i] == '\0')
+    {
+        while (   i < RT_SIZEOFMEMB(TXSPKTHDR, achOpcode)
+               && pPktHdr->achOpcode[i] == ' ')
+            i++;
+    }
+
+    return i == RT_SIZEOFMEMB(TXSPKTHDR, achOpcode);
+}
+
+/**
+ * Used by txsDoGetFile to wait for a reply ACK from the client.
+ *
+ * @returns VINF_SUCCESS on ACK, VERR_GENERAL_FAILURE on NACK,
+ *          VERR_NET_NOT_CONNECTED on unknown response (sending a bable reply),
+ *          or whatever txsRecvPkt returns.
+ * @param   pPktHdr             The original packet (for future use).
+ */
+static int txsWaitForAck(PCTXSPKTHDR pPktHdr)
+{
+    NOREF(pPktHdr);
+    /** @todo timeout? */
+    PTXSPKTHDR pReply;
+    int rc = txsRecvPkt(&pReply, false /*fAutoRetryOnFailure*/);
+    if (RT_SUCCESS(rc))
+    {
+        if (txsIsSameOpcode(pReply, "ACK"))
+            rc = VINF_SUCCESS;
+        else if (txsIsSameOpcode(pReply, "NACK"))
+            rc = VERR_GENERAL_FAILURE;
+        else
+        {
+            txsReplyBabble("BABBLE  ");
+            rc = VERR_NET_NOT_CONNECTED;
+        }
+        RTMemFree(pReply);
+    }
+    return rc;
+}
+
+#ifndef RT_OS_WINDOWS
+/**
+ * Unpacks a tar file.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The unpack file packet.
+ */
+static int txsDoUnpackFile(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszFile = NULL;
+    char *pszDirectory = NULL;
+
+    /* Packet cursor. */
+    const char *pchEnd = (const char *)pPktHdr + pPktHdr->cb;
+    const char *pch = (const char *)(pPktHdr + 1);
+
+    if (txsIsStringValid(pPktHdr, "file", pch, &pszFile, &pch, &rc))
+    {
+        if (txsIsStringValid(pPktHdr, "directory", pch, &pszDirectory, &pch, &rc))
+        {
+            char *pszSuff = RTPathSuffix(pszFile);
+
+            const char *apszArgs[7];
+            unsigned cArgs = 0;
+
+            apszArgs[cArgs++] = "RTTar";
+            apszArgs[cArgs++] = "--extract";
+
+            apszArgs[cArgs++] = "--file";
+            apszArgs[cArgs++] = pszFile;
+
+            apszArgs[cArgs++] = "--directory";
+            apszArgs[cArgs++] = pszDirectory;
+
+            if (   pszSuff
+                && (   !RTStrICmp(pszSuff, ".gz")
+                    || !RTStrICmp(pszSuff, ".tgz")))
+                apszArgs[cArgs++] = "--gunzip";
+
+            RTEXITCODE rcExit = RTZipTarCmd(cArgs, (char **)apszArgs);
+            if (rcExit != RTEXITCODE_SUCCESS)
+                rc = VERR_GENERAL_FAILURE; /** @todo proper return code. */
+            else
+                rc = VINF_SUCCESS;
+
+            rc = txsReplyRC(pPktHdr, rc, "RTZipTarCmd(\"%s\",\"%s\")",
+                            pszFile, pszDirectory);
+
+            RTStrFree(pszDirectory);
+        }
+        RTStrFree(pszFile);
+    }
+
+    return rc;
+}
+#endif
+
+/**
+ * Downloads a file to the client.
+ *
+ * The transfer sends a stream of DATA packets (0 or more) and ends it all with
+ * a ACK packet.  If an error occurs, a FAILURE packet is sent and the transfer
+ * aborted.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The get file packet.
+ */
+static int txsDoGetFile(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "file", &pszPath, &rc))
+        return rc;
+
+    RTFILE hFile;
+    rc = RTFileOpen(&hFile, pszPath, RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN);
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t uMyCrc32 = RTCrc32Start();
+        for (;;)
+        {
+            struct
+            {
+                TXSPKTHDR   Hdr;
+                uint32_t    uCrc32;
+                char        ab[_64K];
+                char        abPadding[TXSPKT_ALIGNMENT];
+            }       Pkt;
+            size_t  cbRead;
+            rc = RTFileRead(hFile, &Pkt.ab[0], _64K, &cbRead);
+            if (RT_FAILURE(rc) || cbRead == 0)
+            {
+                if (rc == VERR_EOF || (RT_SUCCESS(rc) && cbRead == 0))
+                {
+                    Pkt.uCrc32 = RTCrc32Finish(uMyCrc32);
+                    rc = txsReplyInternal(&Pkt.Hdr, "DATA EOF", sizeof(uint32_t));
+                    if (RT_SUCCESS(rc))
+                        rc = txsWaitForAck(&Pkt.Hdr);
+                }
+                else
+                    rc = txsReplyRC(pPktHdr, rc, "RTFileRead");
+                break;
+            }
+
+            uMyCrc32   = RTCrc32Process(uMyCrc32, &Pkt.ab[0], cbRead);
+            Pkt.uCrc32 = RTCrc32Finish(uMyCrc32);
+            rc = txsReplyInternal(&Pkt.Hdr, "DATA    ", cbRead + sizeof(uint32_t));
+            if (RT_FAILURE(rc))
+                break;
+            rc = txsWaitForAck(&Pkt.Hdr);
+            if (RT_FAILURE(rc))
+                break;
+        }
+
+        RTFileClose(hFile);
+    }
+    else
+        rc = txsReplyRC(pPktHdr, rc, "RTFileOpen(,\"%s\",)", pszPath);
+
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Uploads a file from the client.
+ *
+ * The transfer sends a stream of DATA packets (0 or more) and ends it all with
+ * a DATA EOF packet.  We ACK each of these, so that if a write error occurs we
+ * can abort the transfer straight away.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The put file packet.
+ */
+static int txsDoPutFile(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "file", &pszPath, &rc))
+        return rc;
+
+    RTFILE hFile;
+    rc = RTFileOpen(&hFile, pszPath, RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE);
+    if (RT_SUCCESS(rc))
+    {
+        bool fSuccess = false;
+        rc = txsReplyAck(pPktHdr);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Read client command packets and process them.
+             */
+            uint32_t uMyCrc32 = RTCrc32Start();
+            for (;;)
+            {
+                PTXSPKTHDR pDataPktHdr;
+                rc = txsRecvPkt(&pDataPktHdr, false /*fAutoRetryOnFailure*/);
+                if (RT_FAILURE(rc))
+                    break;
+
+                if (txsIsSameOpcode(pDataPktHdr, "DATA"))
+                {
+                    size_t const cbMin = sizeof(TXSPKTHDR) + sizeof(uint32_t);
+                    if (pDataPktHdr->cb >= cbMin)
+                    {
+                        size_t      cbData = pDataPktHdr->cb - cbMin;
+                        const void *pvData = (const char *)pDataPktHdr + cbMin;
+                        uint32_t    uCrc32 = *(uint32_t const *)(pDataPktHdr + 1);
+
+                        uMyCrc32 = RTCrc32Process(uMyCrc32, pvData, cbData);
+                        if (RTCrc32Finish(uMyCrc32) == uCrc32)
+                        {
+                            rc = RTFileWrite(hFile, pvData, cbData, NULL);
+                            if (RT_SUCCESS(rc))
+                            {
+                                rc = txsReplyAck(pDataPktHdr);
+                                RTMemFree(pDataPktHdr);
+                                continue;
+                            }
+
+                            rc = txsReplyRC(pDataPktHdr, rc, "RTFileWrite");
+                        }
+                        else
+                            rc = txsReplyFailure(pDataPktHdr, "BAD DCRC", "mycrc=%#x your=%#x", uMyCrc32, uCrc32);
+                    }
+                    else
+                        rc = txsReplyBadMinSize(pPktHdr, cbMin);
+                }
+                else if (txsIsSameOpcode(pDataPktHdr, "DATA EOF"))
+                {
+                    if (pDataPktHdr->cb == sizeof(TXSPKTHDR) + sizeof(uint32_t))
+                    {
+                        uint32_t    uCrc32 = *(uint32_t const *)(pDataPktHdr + 1);
+                        if (RTCrc32Finish(uMyCrc32) == uCrc32)
+                        {
+                            rc = txsReplyAck(pDataPktHdr);
+                            fSuccess = RT_SUCCESS(rc);
+                        }
+                        else
+                            rc = txsReplyFailure(pDataPktHdr, "BAD DCRC", "mycrc=%#x your=%#x", uMyCrc32, uCrc32);
+                    }
+                    else
+                        rc = txsReplyAck(pDataPktHdr);
+                }
+                else if (txsIsSameOpcode(pDataPktHdr, "ABORT"))
+                    rc = txsReplyAck(pDataPktHdr);
+                else
+                    rc = txsReplyFailure(pDataPktHdr, "UNKNOWN ", "Opcode '%.8s' is not known or not recognized during PUT FILE", pDataPktHdr->achOpcode);
+                RTMemFree(pDataPktHdr);
+                break;
+            }
+        }
+
+        RTFileClose(hFile);
+
+        /*
+         * Delete the file on failure.
+         */
+        if (!fSuccess)
+            RTFileDelete(pszPath);
+    }
+    else
+        rc = txsReplyRC(pPktHdr, rc, "RTFileOpen(,\"%s\",)", pszPath);
+
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * List the entries in the specified directory.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The list packet.
+ */
+static int txsDoList(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "dir", &pszPath, &rc))
+        return rc;
+
+    rc = txsReplyNotImplemented(pPktHdr);
+
+    RTStrFree(pszPath);
+    return rc;
+}
+
+
+/**
+ * Get info about a file system object, following all but the symbolic links
+ * except in the final path component.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The lstat packet.
+ */
+static int txsDoLStat(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "path", &pszPath, &rc))
+        return rc;
+
+    RTFSOBJINFO Info;
+    rc = RTPathQueryInfoEx(pszPath, &Info, RTFSOBJATTRADD_UNIX, RTPATH_F_ON_LINK);
+    if (RT_SUCCESS(rc))
+        /** @todo figure out how to format the return buffer here. */
+        rc = txsReplyNotImplemented(pPktHdr);
+    else
+        rc = txsReplyRC(pPktHdr, rc, "RTPathQueryInfoEx(\"%s\",,UNIX,ON_LINK)",  pszPath);
+
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Get info about a file system object, following all symbolic links.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The stat packet.
+ */
+static int txsDoStat(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "path", &pszPath, &rc))
+        return rc;
+
+    RTFSOBJINFO Info;
+    rc = RTPathQueryInfoEx(pszPath, &Info, RTFSOBJATTRADD_UNIX, RTPATH_F_FOLLOW_LINK);
+    if (RT_SUCCESS(rc))
+        /** @todo figure out how to format the return buffer here. */
+        rc = txsReplyNotImplemented(pPktHdr);
+    else
+        rc = txsReplyRC(pPktHdr, rc, "RTPathQueryInfoEx(\"%s\",,UNIX,FOLLOW_LINK)",  pszPath);
+
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Checks if the specified path is a symbolic link.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The issymlnk packet.
+ */
+static int txsDoIsSymlnk(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "symlink", &pszPath, &rc))
+        return rc;
+
+    RTFSOBJINFO Info;
+    rc = RTPathQueryInfoEx(pszPath, &Info, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK);
+    if (RT_SUCCESS(rc) && RTFS_IS_SYMLINK(Info.Attr.fMode))
+        rc = txsReplySimple(pPktHdr, "TRUE    ");
+    else
+        rc = txsReplySimple(pPktHdr, "FALSE   ");
+
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Checks if the specified path is a file or not.
+ *
+ * If the final path element is a symbolic link to a file, we'll return
+ * FALSE.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The isfile packet.
+ */
+static int txsDoIsFile(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "dir", &pszPath, &rc))
+        return rc;
+
+    RTFSOBJINFO Info;
+    rc = RTPathQueryInfoEx(pszPath, &Info, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK);
+    if (RT_SUCCESS(rc) && RTFS_IS_FILE(Info.Attr.fMode))
+        rc = txsReplySimple(pPktHdr, "TRUE    ");
+    else
+        rc = txsReplySimple(pPktHdr, "FALSE   ");
+
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Checks if the specified path is a directory or not.
+ *
+ * If the final path element is a symbolic link to a directory, we'll return
+ * FALSE.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The isdir packet.
+ */
+static int txsDoIsDir(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "dir", &pszPath, &rc))
+        return rc;
+
+    RTFSOBJINFO Info;
+    rc = RTPathQueryInfoEx(pszPath, &Info, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK);
+    if (RT_SUCCESS(rc) && RTFS_IS_DIRECTORY(Info.Attr.fMode))
+        rc = txsReplySimple(pPktHdr, "TRUE    ");
+    else
+        rc = txsReplySimple(pPktHdr, "FALSE   ");
+
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Changes the group of a file, directory of symbolic link.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The chmod packet.
+ */
+static int txsDoChGrp(PCTXSPKTHDR pPktHdr)
+{
+    return txsReplyNotImplemented(pPktHdr);
+}
+
+/**
+ * Changes the owner of a file, directory of symbolic link.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The chmod packet.
+ */
+static int txsDoChOwn(PCTXSPKTHDR pPktHdr)
+{
+    return txsReplyNotImplemented(pPktHdr);
+}
+
+/**
+ * Changes the mode of a file or directory.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The chmod packet.
+ */
+static int txsDoChMod(PCTXSPKTHDR pPktHdr)
+{
+    return txsReplyNotImplemented(pPktHdr);
+}
+
+/**
+ * Removes a directory tree.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The rmtree packet.
+ */
+static int txsDoRmTree(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "dir", &pszPath, &rc))
+        return rc;
+
+    rc = RTDirRemoveRecursive(pszPath, 0 /*fFlags*/);
+
+    rc = txsReplyRC(pPktHdr, rc, "RTDirRemoveRecusive(\"%s\",0)", pszPath);
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Removes a symbolic link.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The rmsymlink packet.
+ */
+static int txsDoRmSymlnk(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "symlink", &pszPath, &rc))
+        return rc;
+
+    rc = VERR_NOT_IMPLEMENTED; /// @todo RTSymlinkDelete(pszPath);
+
+    rc = txsReplyRC(pPktHdr, rc, "RTSymlinkDelete(\"%s\")", pszPath);
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Removes a file.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The rmfile packet.
+ */
+static int txsDoRmFile(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "file", &pszPath, &rc))
+        return rc;
+
+    rc = RTFileDelete(pszPath);
+
+    rc = txsReplyRC(pPktHdr, rc, "RTFileDelete(\"%s\")", pszPath);
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Removes a directory.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The rmdir packet.
+ */
+static int txsDoRmDir(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    char *pszPath;
+    if (!txsIsStringPktValid(pPktHdr, "dir", &pszPath, &rc))
+        return rc;
+
+    rc = RTDirRemove(pszPath);
+
+    rc = txsReplyRC(pPktHdr, rc, "RTDirRemove(\"%s\")", pszPath);
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Creates a symbolic link.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The mksymlnk packet.
+ */
+static int txsDoMkSymlnk(PCTXSPKTHDR pPktHdr)
+{
+    return txsReplyNotImplemented(pPktHdr);
+}
+
+/**
+ * Creates a directory and all its parents.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The mkdir -p packet.
+ */
+static int txsDoMkDrPath(PCTXSPKTHDR pPktHdr)
+{
+    /* The same format as the MKDIR command. */
+    if (pPktHdr->cb < sizeof(TXSPKTHDR) + sizeof(RTFMODE) + 2)
+        return txsReplyBadMinSize(pPktHdr, sizeof(TXSPKTHDR) + sizeof(RTFMODE) + 2);
+
+    int     rc;
+    char   *pszPath;
+    if (!txsIsStringValid(pPktHdr, "dir", (const char *)(pPktHdr + 1) + sizeof(RTFMODE), &pszPath, NULL, &rc))
+        return rc;
+
+    RTFMODE fMode = *(RTFMODE const *)(pPktHdr + 1);
+    rc = RTDirCreateFullPath(pszPath, fMode);
+
+    rc = txsReplyRC(pPktHdr, rc, "RTDirCreateFullPath(\"%s\", %#x)", pszPath, fMode);
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Creates a directory.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The mkdir packet.
+ */
+static int txsDoMkDir(PCTXSPKTHDR pPktHdr)
+{
+    /* After the packet header follows a mode mask and the remainder of
+       the packet is the zero terminated directory name. */
+    size_t const cbMin = sizeof(TXSPKTHDR) + sizeof(RTFMODE) + 2;
+    if (pPktHdr->cb < cbMin)
+        return txsReplyBadMinSize(pPktHdr, cbMin);
+
+    int     rc;
+    char   *pszPath;
+    if (!txsIsStringValid(pPktHdr, "dir", (const char *)(pPktHdr + 1) + sizeof(RTFMODE), &pszPath, NULL, &rc))
+        return rc;
+
+    RTFMODE fMode = *(RTFMODE const *)(pPktHdr + 1);
+    rc = RTDirCreate(pszPath, fMode, 0);
+
+    rc = txsReplyRC(pPktHdr, rc, "RTDirCreate(\"%s\", %#x)", pszPath, fMode);
+    RTStrFree(pszPath);
+    return rc;
+}
+
+/**
+ * Cleans up the scratch area.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The shutdown packet.
+ */
+static int txsDoCleanup(PCTXSPKTHDR pPktHdr)
+{
+    int rc = RTDirRemoveRecursive(g_szScratchPath, RTDIRRMREC_F_CONTENT_ONLY);
+    return txsReplyRC(pPktHdr, rc, "RTDirRemoveRecursive(\"%s\", CONTENT_ONLY)", g_szScratchPath);
+}
+
+/**
+ * Ejects the specified DVD/CD drive.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The eject packet.
+ */
+static int txsDoCdEject(PCTXSPKTHDR pPktHdr)
+{
+    /* After the packet header follows a uint32_t ordinal. */
+    size_t const cbExpected = sizeof(TXSPKTHDR) + sizeof(uint32_t);
+    if (pPktHdr->cb != cbExpected)
+        return txsReplyBadSize(pPktHdr, cbExpected);
+    uint32_t iOrdinal = *(uint32_t const *)(pPktHdr + 1);
+
+    RTCDROM hCdrom;
+    int rc = RTCdromOpenByOrdinal(iOrdinal, RTCDROM_O_CONTROL, &hCdrom);
+    if (RT_FAILURE(rc))
+        return txsReplyRC(pPktHdr, rc, "RTCdromOpenByOrdinal(%u, RTCDROM_O_CONTROL, )", iOrdinal);
+    rc = RTCdromEject(hCdrom, true /*fForce*/);
+    RTCdromRelease(hCdrom);
+
+    return txsReplyRC(pPktHdr, rc, "RTCdromEject(ord=%u, fForce=true)", iOrdinal);
+}
+
+/**
+ * Common worker for txsDoShutdown and txsDoReboot.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The reboot packet.
+ * @param   fAction             Which action to take.
+ */
+static int txsCommonShutdownReboot(PCTXSPKTHDR pPktHdr, uint32_t fAction)
+{
+    /*
+     * We ACK the reboot & shutdown before actually performing them, then we
+     * terminate the transport layer.
+     *
+     * This is to make sure the client isn't stuck with a dead connection. The
+     * transport layer termination also make sure we won't accept new
+     * connections in case the client is too eager to reconnect to a rebooted
+     * test victim.  On the down side, we cannot easily report RTSystemShutdown
+     * failures failures this way.  But the client can kind of figure it out by
+     * reconnecting and seeing that our UUID was unchanged.
+     */
+    int rc;
+    if (pPktHdr->cb != sizeof(TXSPKTHDR))
+        return txsReplyBadSize(pPktHdr, sizeof(TXSPKTHDR));
+    g_pTransport->pfnNotifyReboot();
+    rc = txsReplyAck(pPktHdr);
+    RTThreadSleep(2560);                /* fudge factor */
+    g_pTransport->pfnTerm();
+
+    /*
+     * Do the job, if it fails we'll restart the transport layer.
+     */
+#if 0
+    rc = VINF_SUCCESS;
+#else
+    rc = RTSystemShutdown(0 /*cMsDelay*/,
+                          fAction | RTSYSTEM_SHUTDOWN_PLANNED | RTSYSTEM_SHUTDOWN_FORCE,
+                          "Test Execution Service");
+#endif
+    if (RT_SUCCESS(rc))
+    {
+        RTMsgInfo(fAction == RTSYSTEM_SHUTDOWN_REBOOT ? "Rebooting...\n" : "Shutting down...\n");
+        g_fTerminate = true;
+    }
+    else
+    {
+        RTMsgError("RTSystemShutdown w/ fAction=%#x failed: %Rrc", fAction, rc);
+
+        int rc2 = g_pTransport->pfnInit();
+        if (RT_FAILURE(rc2))
+        {
+            g_fTerminate = true;
+            rc = rc2;
+        }
+    }
+    return rc;
+}
+
+/**
+ * Shuts down the machine, powering it off if possible.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The shutdown packet.
+ */
+static int txsDoShutdown(PCTXSPKTHDR pPktHdr)
+{
+    return txsCommonShutdownReboot(pPktHdr, RTSYSTEM_SHUTDOWN_POWER_OFF_HALT);
+}
+
+/**
+ * Reboots the machine.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The reboot packet.
+ */
+static int txsDoReboot(PCTXSPKTHDR pPktHdr)
+{
+    return txsCommonShutdownReboot(pPktHdr, RTSYSTEM_SHUTDOWN_REBOOT);
+}
+
+/**
+ * Verifies and acknowledges a "UUID" request.
+ *
+ * @returns IPRT status code.
+ * @param   pPktHdr             The howdy packet.
+ */
+static int txsDoUuid(PCTXSPKTHDR pPktHdr)
+{
+    if (pPktHdr->cb != sizeof(TXSPKTHDR))
+        return txsReplyBadSize(pPktHdr, sizeof(TXSPKTHDR));
+
+    struct
+    {
+        TXSPKTHDR   Hdr;
+        char        szUuid[RTUUID_STR_LENGTH];
+        char        abPadding[TXSPKT_ALIGNMENT];
+    } Pkt;
+
+    int rc = RTUuidToStr(&g_InstanceUuid, Pkt.szUuid, sizeof(Pkt.szUuid));
+    if (RT_FAILURE(rc))
+        return txsReplyRC(pPktHdr, rc, "RTUuidToStr");
+    return txsReplyInternal(&Pkt.Hdr, "ACK UUID", strlen(Pkt.szUuid) + 1);
+}
+
+/**
+ * Verifies and acknowledges a "BYE" request.
+ *
+ * @returns IPRT status code.
+ * @param   pPktHdr             The howdy packet.
+ */
+static int txsDoBye(PCTXSPKTHDR pPktHdr)
+{
+    int rc;
+    if (pPktHdr->cb == sizeof(TXSPKTHDR))
+        rc = txsReplyAck(pPktHdr);
+    else
+        rc = txsReplyBadSize(pPktHdr, sizeof(TXSPKTHDR));
+    g_pTransport->pfnNotifyBye();
+    return rc;
+}
+
+/**
+ * Verifies and acknowledges a "HOWDY" request.
+ *
+ * @returns IPRT status code.
+ * @param   pPktHdr             The howdy packet.
+ */
+static int txsDoHowdy(PCTXSPKTHDR pPktHdr)
+{
+    if (pPktHdr->cb != sizeof(TXSPKTHDR))
+        return txsReplyBadSize(pPktHdr, sizeof(TXSPKTHDR));
+    int rc = txsReplyAck(pPktHdr);
+    if (RT_SUCCESS(rc))
+    {
+        g_pTransport->pfnNotifyHowdy();
+        RTDirRemoveRecursive(g_szScratchPath, RTDIRRMREC_F_CONTENT_ONLY);
+    }
+    return rc;
+}
+
+/**
+ * Replies according to the return code.
+ *
+ * @returns rcOperation and pTxsExec->rcReplySend.
+ * @param   pTxsExec            The TXSEXEC instance.
+ * @param   rcOperation         The status code to report.
+ * @param   pszOperationFmt     The operation that failed.  Typically giving the
+ *                              function call with important arguments.
+ * @param   ...                 Arguments to the format string.
+ */
+static int txsExecReplyRC(PTXSEXEC pTxsExec, int rcOperation, const char *pszOperationFmt, ...)
+{
+    AssertStmt(RT_FAILURE_NP(rcOperation), rcOperation = VERR_IPE_UNEXPECTED_INFO_STATUS);
+
+    char    szOperation[128];
+    va_list va;
+    va_start(va, pszOperationFmt);
+    RTStrPrintfV(szOperation, sizeof(szOperation), pszOperationFmt, va);
+    va_end(va);
+
+    pTxsExec->rcReplySend = txsReplyFailure(pTxsExec->pPktHdr, "FAILED  ",
+                                            "%s failed with rc=%Rrc (opcode '%.8s')",
+                                            szOperation, rcOperation, pTxsExec->pPktHdr->achOpcode);
+    return rcOperation;
+}
+
+
+/**
+ * Sends the process exit status reply to the TXS client.
+ *
+ * @returns IPRT status code of the send.
+ * @param   pTxsExec            The TXSEXEC instance.
+ * @param   fProcessAlive       Whether the process is still alive (against our
+ *                              will).
+ * @param   fProcessTimedOut    Whether the process timed out.
+ * @param   MsProcessKilled     When the process was killed, UINT64_MAX if not.
+ */
+static int txsExecSendExitStatus(PTXSEXEC pTxsExec, bool fProcessAlive, bool fProcessTimedOut, uint64_t MsProcessKilled)
+{
+    int rc;
+    if (     fProcessTimedOut  && !fProcessAlive && MsProcessKilled != UINT64_MAX)
+    {
+        rc = txsReplySimple(pTxsExec->pPktHdr, "PROC TOK");
+        if (g_fDisplayOutput)
+            RTPrintf("txs: Process timed out and was killed\n");
+    }
+    else if (fProcessTimedOut  &&  fProcessAlive && MsProcessKilled != UINT64_MAX)
+    {
+        rc = txsReplySimple(pTxsExec->pPktHdr, "PROC TOA");
+        if (g_fDisplayOutput)
+            RTPrintf("txs: Process timed out and was not killed successfully\n");
+    }
+    else if (g_fTerminate && (fProcessAlive || MsProcessKilled != UINT64_MAX))
+        rc = txsReplySimple(pTxsExec->pPktHdr, "PROC DWN");
+    else if (fProcessAlive)
+    {
+        rc = txsReplyFailure(pTxsExec->pPktHdr, "PROC DOO", "Doofus! process is alive when it should not");
+        AssertFailed();
+    }
+    else if (MsProcessKilled != UINT64_MAX)
+    {
+        rc = txsReplyFailure(pTxsExec->pPktHdr, "PROC DOO", "Doofus! process has been killed when it should not");
+        AssertFailed();
+    }
+    else if (   pTxsExec->ProcessStatus.enmReason == RTPROCEXITREASON_NORMAL
+             && pTxsExec->ProcessStatus.iStatus   == 0)
+    {
+        rc = txsReplySimple(pTxsExec->pPktHdr, "PROC OK ");
+        if (g_fDisplayOutput)
+            RTPrintf("txs: Process exited with status: 0\n");
+    }
+    else if (pTxsExec->ProcessStatus.enmReason == RTPROCEXITREASON_NORMAL)
+    {
+        rc = txsReplyFailure(pTxsExec->pPktHdr, "PROC NOK", "%d", pTxsExec->ProcessStatus.iStatus);
+        if (g_fDisplayOutput)
+            RTPrintf("txs: Process exited with status: %d\n", pTxsExec->ProcessStatus.iStatus);
+    }
+    else if (pTxsExec->ProcessStatus.enmReason == RTPROCEXITREASON_SIGNAL)
+    {
+        rc = txsReplyFailure(pTxsExec->pPktHdr, "PROC SIG", "%d", pTxsExec->ProcessStatus.iStatus);
+        if (g_fDisplayOutput)
+            RTPrintf("txs: Process exited with status: signal %d\n", pTxsExec->ProcessStatus.iStatus);
+    }
+    else if (pTxsExec->ProcessStatus.enmReason == RTPROCEXITREASON_ABEND)
+    {
+        rc = txsReplyFailure(pTxsExec->pPktHdr, "PROC ABD", "");
+        if (g_fDisplayOutput)
+            RTPrintf("txs: Process exited with status: abend\n");
+    }
+    else
+    {
+        rc = txsReplyFailure(pTxsExec->pPktHdr, "PROC DOO", "enmReason=%d iStatus=%d",
+                             pTxsExec->ProcessStatus.enmReason, pTxsExec->ProcessStatus.iStatus);
+        AssertMsgFailed(("enmReason=%d iStatus=%d", pTxsExec->ProcessStatus.enmReason, pTxsExec->ProcessStatus.iStatus));
+    }
+    return rc;
+}
+
+/**
+ * Handle pending output data or error on standard out, standard error or the
+ * test pipe.
+ *
+ * @returns IPRT status code from client send.
+ * @param   hPollSet            The polling set.
+ * @param   fPollEvt            The event mask returned by RTPollNoResume.
+ * @param   phPipeR             The pipe handle.
+ * @param   pu32Crc             The current CRC-32 of the stream. (In/Out)
+ * @param   enmHndId            The handle ID.
+ * @param   pszOpcode           The opcode for the data upload.
+ *
+ * @todo    Put the last 4 parameters into a struct!
+ */
+static int txsDoExecHlpHandleOutputEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, PRTPIPE phPipeR,
+                                         uint32_t *puCrc32, TXSEXECHNDID enmHndId, const char *pszOpcode)
+{
+    Log(("txsDoExecHlpHandleOutputEvent: %s fPollEvt=%#x\n", pszOpcode, fPollEvt));
+
+    /*
+     * Try drain the pipe before acting on any errors.
+     */
+    int rc = VINF_SUCCESS;
+    struct
+    {
+        TXSPKTHDR   Hdr;
+        uint32_t    uCrc32;
+        char        abBuf[_64K];
+        char        abPadding[TXSPKT_ALIGNMENT];
+    }       Pkt;
+    size_t  cbRead;
+    int     rc2 = RTPipeRead(*phPipeR, Pkt.abBuf, sizeof(Pkt.abBuf), &cbRead);
+    if (RT_SUCCESS(rc2) && cbRead)
+    {
+        Log(("Crc32=%#x ", *puCrc32));
+        *puCrc32 = RTCrc32Process(*puCrc32, Pkt.abBuf, cbRead);
+        Log(("cbRead=%#x Crc32=%#x \n", cbRead, *puCrc32));
+        Pkt.uCrc32 = RTCrc32Finish(*puCrc32);
+        if (g_fDisplayOutput)
+        {
+            if (enmHndId == TXSEXECHNDID_STDOUT)
+                RTStrmPrintf(g_pStdErr, "%.*s", cbRead, Pkt.abBuf);
+            else if (enmHndId == TXSEXECHNDID_STDERR)
+                RTStrmPrintf(g_pStdErr, "%.*s", cbRead, Pkt.abBuf);
+        }
+
+        rc = txsReplyInternal(&Pkt.Hdr, pszOpcode, cbRead + sizeof(uint32_t));
+
+        /* Make sure we go another poll round in case there was too much data
+           for the buffer to hold. */
+        fPollEvt &= RTPOLL_EVT_ERROR;
+    }
+    else if (RT_FAILURE(rc2))
+    {
+        fPollEvt |= RTPOLL_EVT_ERROR;
+        AssertMsg(rc2 == VERR_BROKEN_PIPE, ("%Rrc\n", rc));
+    }
+
+    /*
+     * If an error was raised signalled,
+     */
+    if (fPollEvt & RTPOLL_EVT_ERROR)
+    {
+        rc2 = RTPollSetRemove(hPollSet, enmHndId);
+        AssertRC(rc2);
+
+        rc2 = RTPipeClose(*phPipeR);
+        AssertRC(rc2);
+        *phPipeR = NIL_RTPIPE;
+    }
+    return rc;
+}
+
+/**
+ * Try write some more data to the standard input of the child.
+ *
+ * @returns IPRT status code.
+ * @param   pStdInBuf           The standard input buffer.
+ * @param   hStdInW             The standard input pipe.
+ */
+static int txsDoExecHlpWriteStdIn(PTXSEXECSTDINBUF pStdInBuf, RTPIPE hStdInW)
+{
+    size_t  cbToWrite = pStdInBuf->cb - pStdInBuf->off;
+    size_t  cbWritten;
+    int     rc = RTPipeWrite(hStdInW, &pStdInBuf->pch[pStdInBuf->off], cbToWrite, &cbWritten);
+    if (RT_SUCCESS(rc))
+    {
+        Assert(cbWritten == cbToWrite);
+        pStdInBuf->off += cbWritten;
+    }
+    return rc;
+}
+
+/**
+ * Handle an error event on standard input.
+ *
+ * @param   hPollSet            The polling set.
+ * @param   fPollEvt            The event mask returned by RTPollNoResume.
+ * @param   phStdInW            The standard input pipe handle.
+ * @param   pStdInBuf           The standard input buffer.
+ */
+static void txsDoExecHlpHandleStdInErrorEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, PRTPIPE phStdInW,
+                                              PTXSEXECSTDINBUF pStdInBuf)
+{
+    NOREF(fPollEvt);
+    int rc2;
+    if (pStdInBuf->off < pStdInBuf->cb)
+    {
+        rc2 = RTPollSetRemove(hPollSet, TXSEXECHNDID_STDIN_WRITABLE);
+        AssertRC(rc2);
+    }
+
+    rc2 = RTPollSetRemove(hPollSet, TXSEXECHNDID_STDIN);
+    AssertRC(rc2);
+
+    rc2 = RTPipeClose(*phStdInW);
+    AssertRC(rc2);
+    *phStdInW = NIL_RTPIPE;
+
+    RTMemFree(pStdInBuf->pch);
+    pStdInBuf->pch          = NULL;
+    pStdInBuf->off          = 0;
+    pStdInBuf->cb           = 0;
+    pStdInBuf->cbAllocated  = 0;
+    pStdInBuf->fBitBucket   = true;
+}
+
+/**
+ * Handle an event indicating we can write to the standard input pipe of the
+ * child process.
+ *
+ * @param   hPollSet            The polling set.
+ * @param   fPollEvt            The event mask returned by RTPollNoResume.
+ * @param   phStdInW            The standard input pipe.
+ * @param   pStdInBuf           The standard input buffer.
+ */
+static void txsDoExecHlpHandleStdInWritableEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, PRTPIPE phStdInW,
+                                                 PTXSEXECSTDINBUF pStdInBuf)
+{
+    int rc;
+    if (!(fPollEvt & RTPOLL_EVT_ERROR))
+    {
+        rc = txsDoExecHlpWriteStdIn(pStdInBuf, *phStdInW);
+        if (RT_FAILURE(rc) && rc != VERR_BAD_PIPE)
+        {
+            /** @todo do we need to do something about this error condition? */
+            AssertRC(rc);
+        }
+
+        if (pStdInBuf->off < pStdInBuf->cb)
+        {
+            rc = RTPollSetRemove(hPollSet, TXSEXECHNDID_STDIN_WRITABLE);
+            AssertRC(rc);
+        }
+    }
+    else
+        txsDoExecHlpHandleStdInErrorEvent(hPollSet, fPollEvt, phStdInW, pStdInBuf);
+}
+
+/**
+ * Handle a transport event or successful pfnPollIn() call.
+ *
+ * @returns IPRT status code from client send.
+ * @retval  VINF_EOF indicates ABORT command.
+ *
+ * @param   hPollSet            The polling set.
+ * @param   fPollEvt            The event mask returned by RTPollNoResume.
+ * @param   idPollHnd           The handle ID.
+ * @param   hStdInW             The standard input pipe.
+ * @param   pStdInBuf           The standard input buffer.
+ */
+static int txsDoExecHlpHandleTransportEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, uint32_t idPollHnd,
+                                            PRTPIPE phStdInW, PTXSEXECSTDINBUF pStdInBuf)
+{
+    /* ASSUMES the transport layer will detect or clear any error condition. */
+    NOREF(fPollEvt); NOREF(idPollHnd);
+    Log(("txsDoExecHlpHandleTransportEvent\n"));
+    /** @todo Use a callback for this case? */
+
+    /*
+     * Read client command packet and process it.
+     */
+    /** @todo Sometimes this hangs on windows because there isn't any data pending.
+     * We probably get woken up at the wrong time or in the wrong way, i.e. RTPoll()
+     * is busted for sockets.
+     *
+     * Temporary workaround: Poll for input before trying to read it. */
+    if (!g_pTransport->pfnPollIn())
+    {
+        Log(("Bad transport event\n"));
+        RTThreadYield();
+        return VINF_SUCCESS;
+    }
+    PTXSPKTHDR pPktHdr;
+    int rc = txsRecvPkt(&pPktHdr, false /*fAutoRetryOnFailure*/);
+    if (RT_FAILURE(rc))
+        return rc;
+    Log(("Bad transport event\n"));
+
+    /*
+     * The most common thing here would be a STDIN request with data
+     * for the child process.
+     */
+    if (txsIsSameOpcode(pPktHdr, "STDIN"))
+    {
+        if (   !pStdInBuf->fBitBucket
+            && pPktHdr->cb >= sizeof(TXSPKTHDR) + sizeof(uint32_t))
+        {
+            uint32_t    uCrc32  = *(uint32_t *)(pPktHdr + 1);
+            const char *pch     = (const char *)(pPktHdr + 1) + sizeof(uint32_t);
+            size_t      cb      = pPktHdr->cb - sizeof(TXSPKTHDR) - sizeof(uint32_t);
+
+            /* Check the CRC */
+            pStdInBuf->uCrc32 = RTCrc32Process(pStdInBuf->uCrc32, pch, cb);
+            if (pStdInBuf->uCrc32 == uCrc32)
+            {
+
+                /* Rewind the buffer if it's empty. */
+                size_t      cbInBuf   = pStdInBuf->cb - pStdInBuf->off;
+                bool const  fAddToSet = cbInBuf == 0;
+                if (fAddToSet)
+                    pStdInBuf->cb = pStdInBuf->off = 0;
+
+                /* Try and see if we can simply append the data. */
+                if (cb + pStdInBuf->cb <= pStdInBuf->cbAllocated)
+                {
+                    memcpy(&pStdInBuf->pch[pStdInBuf->cb], pch, cb);
+                    pStdInBuf->cb += cb;
+                    rc = txsReplyAck(pPktHdr);
+                }
+                else
+                {
+                    /* Try write a bit or two before we move+realloc the buffer. */
+                    if (cbInBuf > 0)
+                        txsDoExecHlpWriteStdIn(pStdInBuf, *phStdInW);
+
+                    /* Move any buffered data to the front. */
+                    cbInBuf = pStdInBuf->cb - pStdInBuf->off;
+                    if (cbInBuf == 0)
+                        pStdInBuf->cb = pStdInBuf->off = 0;
+                    else
+                    {
+                        memmove(pStdInBuf->pch, &pStdInBuf->pch[pStdInBuf->off], cbInBuf);
+                        pStdInBuf->cb  = cbInBuf;
+                        pStdInBuf->off = 0;
+                    }
+
+                    /* Do we need to grow the buffer? */
+                    if (cb + pStdInBuf->cb > pStdInBuf->cbAllocated)
+                    {
+                        size_t cbAlloc = pStdInBuf->cb + cb;
+                        cbAlloc = RT_ALIGN_Z(cbAlloc, _64K);
+                        void *pvNew = RTMemRealloc(pStdInBuf->pch, cbAlloc);
+                        if (pvNew)
+                        {
+                            pStdInBuf->pch         = (char *)pvNew;
+                            pStdInBuf->cbAllocated = cbAlloc;
+                        }
+                    }
+
+                    /* Finally, copy the data. */
+                    if (cb + pStdInBuf->cb <= pStdInBuf->cbAllocated)
+                    {
+                        memcpy(&pStdInBuf->pch[pStdInBuf->cb], pch, cb);
+                        pStdInBuf->cb += cb;
+                        rc = txsReplyAck(pPktHdr);
+                    }
+                    else
+                        rc = txsReplySimple(pPktHdr, "STDINMEM");
+                }
+
+                /*
+                 * Flush the buffered data and add/remove the standard input
+                 * handle from the set.
+                 */
+                txsDoExecHlpWriteStdIn(pStdInBuf, *phStdInW);
+                if (fAddToSet && pStdInBuf->off < pStdInBuf->cb)
+                {
+                    int rc2 = RTPollSetAddPipe(hPollSet, *phStdInW, RTPOLL_EVT_WRITE, TXSEXECHNDID_STDIN_WRITABLE);
+                    AssertRC(rc2);
+                }
+                else if (!fAddToSet && pStdInBuf->off >= pStdInBuf->cb)
+                {
+                    int rc2 = RTPollSetRemove(hPollSet, TXSEXECHNDID_STDIN_WRITABLE);
+                    AssertRC(rc2);
+                }
+            }
+            else
+                rc = txsReplySimple(pPktHdr, "STDINCRC");
+        }
+        else if (pPktHdr->cb < sizeof(TXSPKTHDR) + sizeof(uint32_t))
+            rc = txsReplySimple(pPktHdr, "STDINBAD");
+        else
+            rc = txsReplySimple(pPktHdr, "STDINIGN");
+    }
+    /*
+     * The only other two requests are connection oriented and we return a error
+     * code so that we unwind the whole EXEC shebang and start afresh.
+     */
+    else if (txsIsSameOpcode(pPktHdr, "BYE"))
+    {
+        rc = txsDoBye(pPktHdr);
+        if (RT_SUCCESS(rc))
+            rc = VERR_NET_NOT_CONNECTED;
+    }
+    else if (txsIsSameOpcode(pPktHdr, "HOWDY"))
+    {
+        rc = txsDoHowdy(pPktHdr);
+        if (RT_SUCCESS(rc))
+            rc = VERR_NET_NOT_CONNECTED;
+    }
+    else if (txsIsSameOpcode(pPktHdr, "ABORT"))
+    {
+        rc = txsReplyAck(pPktHdr);
+        if (RT_SUCCESS(rc))
+            rc = VINF_EOF;              /* this is but ugly! */
+    }
+    else
+        rc = txsReplyFailure(pPktHdr, "UNKNOWN ", "Opcode '%.8s' is not known or not recognized during EXEC", pPktHdr->achOpcode);
+
+    RTMemFree(pPktHdr);
+    return rc;
+}
+
+/**
+ * Handles the output and input of the process, waits for it finish up.
+ *
+ * @returns IPRT status code from reply send.
+ * @param   pTxsExec            The TXSEXEC instance.
+ */
+static int txsDoExecHlp2(PTXSEXEC pTxsExec)
+{
+    int                 rc;             /* client send. */
+    int                 rc2;
+    TXSEXECSTDINBUF     StdInBuf            = { 0, 0, NULL, 0, pTxsExec->hStdInW == NIL_RTPIPE, RTCrc32Start() };
+    uint32_t            uStdOutCrc32        = RTCrc32Start();
+    uint32_t            uStdErrCrc32        = uStdOutCrc32;
+    uint32_t            uTestPipeCrc32      = uStdOutCrc32;
+    uint64_t const      MsStart             = RTTimeMilliTS();
+    bool                fProcessTimedOut    = false;
+    uint64_t            MsProcessKilled     = UINT64_MAX;
+    RTMSINTERVAL const  cMsPollBase         = g_pTransport->pfnPollSetAdd || pTxsExec->hStdInW == NIL_RTPIPE
+                                            ? 5000 : 100;
+    RTMSINTERVAL        cMsPollCur          = 0;
+
+    /*
+     * Before entering the loop, tell the client that we've started the guest
+     * and that it's now OK to send input to the process.  (This is not the
+     * final ACK, so the packet header is NULL ... kind of bogus.)
+     */
+    rc = txsReplyAck(NULL);
+
+    /*
+     * Process input, output, the test pipe and client requests.
+     */
+    while (   RT_SUCCESS(rc)
+           && RT_UNLIKELY(!g_fTerminate))
+    {
+        /*
+         * Wait/Process all pending events.
+         */
+        uint32_t idPollHnd;
+        uint32_t fPollEvt;
+        Log3(("Calling RTPollNoResume(,%u,)...\n"));
+        rc2 = RTPollNoResume(pTxsExec->hPollSet, cMsPollCur, &fPollEvt, &idPollHnd);
+        Log3(("RTPollNoResume -> fPollEvt=%#x idPollHnd=%u\n", fPollEvt, idPollHnd));
+        if (g_fTerminate)
+            continue;
+        cMsPollCur = 0;                 /* no rest until we've checked everything. */
+
+        if (RT_SUCCESS(rc2))
+        {
+            switch (idPollHnd)
+            {
+                case TXSEXECHNDID_STDOUT:
+                    rc = txsDoExecHlpHandleOutputEvent(pTxsExec->hPollSet, fPollEvt, &pTxsExec->hStdOutR, &uStdOutCrc32,
+                                                       TXSEXECHNDID_STDOUT, "STDOUT  ");
+                    break;
+
+                case TXSEXECHNDID_STDERR:
+                    rc = txsDoExecHlpHandleOutputEvent(pTxsExec->hPollSet, fPollEvt, &pTxsExec->hStdErrR, &uStdErrCrc32,
+                                                       TXSEXECHNDID_STDERR, "STDERR  ");
+                    break;
+
+                case TXSEXECHNDID_TESTPIPE:
+                    rc = txsDoExecHlpHandleOutputEvent(pTxsExec->hPollSet, fPollEvt, &pTxsExec->hTestPipeR, &uTestPipeCrc32,
+                                                       TXSEXECHNDID_TESTPIPE, "TESTPIPE");
+                    break;
+
+                case TXSEXECHNDID_STDIN:
+                    txsDoExecHlpHandleStdInErrorEvent(pTxsExec->hPollSet, fPollEvt, &pTxsExec->hStdInW, &StdInBuf);
+                    break;
+
+                case TXSEXECHNDID_STDIN_WRITABLE:
+                    txsDoExecHlpHandleStdInWritableEvent(pTxsExec->hPollSet, fPollEvt, &pTxsExec->hStdInW, &StdInBuf);
+                    break;
+
+                case TXSEXECHNDID_THREAD:
+                    rc2 = RTPollSetRemove(pTxsExec->hPollSet, TXSEXECHNDID_THREAD); AssertRC(rc2);
+                    break;
+
+                default:
+                    rc = txsDoExecHlpHandleTransportEvent(pTxsExec->hPollSet, fPollEvt, idPollHnd, &pTxsExec->hStdInW,
+                                                          &StdInBuf);
+                    break;
+            }
+            if (RT_FAILURE(rc) || rc == VINF_EOF)
+                break; /* abort command, or client dead or something */
+            continue;
+        }
+
+        /*
+         * Check for incoming data.
+         */
+        if (g_pTransport->pfnPollIn())
+        {
+            rc = txsDoExecHlpHandleTransportEvent(pTxsExec->hPollSet, 0, UINT32_MAX, &pTxsExec->hStdInW, &StdInBuf);
+            if (RT_FAILURE(rc) || rc == VINF_EOF)
+                break; /* abort command, or client dead or something */
+            continue;
+        }
+
+        /*
+         * If the process has terminated, we're should head out.
+         */
+        if (!ASMAtomicReadBool(&pTxsExec->fProcessAlive))
+            break;
+
+        /*
+         * Check for timed out, killing the process.
+         */
+        uint32_t cMilliesLeft = RT_INDEFINITE_WAIT;
+        if (pTxsExec->cMsTimeout != RT_INDEFINITE_WAIT)
+        {
+            uint64_t u64Now = RTTimeMilliTS();
+            uint64_t cMsElapsed = u64Now - MsStart;
+            if (cMsElapsed >= pTxsExec->cMsTimeout)
+            {
+                fProcessTimedOut = true;
+                if (    MsProcessKilled == UINT64_MAX
+                    ||  u64Now - MsProcessKilled > 1000)
+                {
+                    if (u64Now - MsProcessKilled > 20*60*1000)
+                        break; /* give up after 20 mins */
+                    RTCritSectEnter(&pTxsExec->CritSect);
+                    if (pTxsExec->fProcessAlive)
+                        RTProcTerminate(pTxsExec->hProcess);
+                    RTCritSectLeave(&pTxsExec->CritSect);
+                    MsProcessKilled = u64Now;
+                    continue;
+                }
+                cMilliesLeft = 10000;
+            }
+            else
+                cMilliesLeft = pTxsExec->cMsTimeout - (uint32_t)cMsElapsed;
+        }
+
+        /* Reset the polling interval since we've done all pending work. */
+        cMsPollCur = cMilliesLeft >= cMsPollBase ? cMsPollBase : cMilliesLeft;
+    }
+
+    /*
+     * At this point we should hopefully only have to wait 0 ms on the thread
+     * to release the handle... But if for instance the process refuses to die,
+     * we'll have to try kill it again. Bothersome.
+     */
+    for (size_t i = 0; i < 22; i++)
+    {
+        rc2 = RTThreadWait(pTxsExec->hThreadWaiter, 500, NULL);
+        if (RT_SUCCESS(rc))
+        {
+            pTxsExec->hThreadWaiter = NIL_RTTHREAD;
+            Assert(!pTxsExec->fProcessAlive);
+            break;
+        }
+        if (i == 0 || i == 10 || i == 15 || i == 18 || i > 20)
+        {
+            RTCritSectEnter(&pTxsExec->CritSect);
+            if (pTxsExec->fProcessAlive)
+                RTProcTerminate(pTxsExec->hProcess);
+            RTCritSectLeave(&pTxsExec->CritSect);
+        }
+    }
+
+    /*
+     * If we don't have a client problem (RT_FAILURE(rc) we'll reply to the
+     * clients exec packet now.
+     */
+    if (RT_SUCCESS(rc))
+        rc = txsExecSendExitStatus(pTxsExec, pTxsExec->fProcessAlive, fProcessTimedOut, MsProcessKilled);
+
+    RTMemFree(StdInBuf.pch);
+    return rc;
+}
+
+/**
+ * Creates a poll set for the pipes and let the transport layer add stuff to it
+ * as well.
+ *
+ * @returns IPRT status code, reply to client made on error.
+ * @param   pTxsExec            The TXSEXEC instance.
+ */
+static int txsExecSetupPollSet(PTXSEXEC pTxsExec)
+{
+    int rc = RTPollSetCreate(&pTxsExec->hPollSet);
+    if (RT_FAILURE(rc))
+        return txsExecReplyRC(pTxsExec, rc, "RTPollSetCreate");
+
+    rc = RTPollSetAddPipe(pTxsExec->hPollSet, pTxsExec->hStdInW, RTPOLL_EVT_ERROR, TXSEXECHNDID_STDIN);
+    if (RT_FAILURE(rc))
+        return txsExecReplyRC(pTxsExec, rc, "RTPollSetAddPipe/stdin");
+
+    rc = RTPollSetAddPipe(pTxsExec->hPollSet, pTxsExec->hStdOutR,   RTPOLL_EVT_READ | RTPOLL_EVT_ERROR,
+                          TXSEXECHNDID_STDOUT);
+    if (RT_FAILURE(rc))
+        return txsExecReplyRC(pTxsExec, rc, "RTPollSetAddPipe/stdout");
+
+    rc = RTPollSetAddPipe(pTxsExec->hPollSet, pTxsExec->hStdErrR,   RTPOLL_EVT_READ | RTPOLL_EVT_ERROR,
+                          TXSEXECHNDID_STDERR);
+    if (RT_FAILURE(rc))
+        return txsExecReplyRC(pTxsExec, rc, "RTPollSetAddPipe/stderr");
+
+    rc = RTPollSetAddPipe(pTxsExec->hPollSet, pTxsExec->hTestPipeR, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR,
+                          TXSEXECHNDID_TESTPIPE);
+    if (RT_FAILURE(rc))
+        return txsExecReplyRC(pTxsExec, rc, "RTPollSetAddPipe/test");
+
+    rc = RTPollSetAddPipe(pTxsExec->hPollSet, pTxsExec->hWakeUpPipeR, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR,
+                          TXSEXECHNDID_THREAD);
+    if (RT_FAILURE(rc))
+        return txsExecReplyRC(pTxsExec, rc, "RTPollSetAddPipe/wakeup");
+
+    if (g_pTransport->pfnPollSetAdd)
+    {
+        rc = g_pTransport->pfnPollSetAdd(pTxsExec->hPollSet, TXSEXECHNDID_TRANSPORT);
+        if (RT_FAILURE(rc))
+            return txsExecReplyRC(pTxsExec, rc, "%s->pfnPollSetAdd/stdin", g_pTransport->szName);
+    }
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Thread that calls RTProcWait and signals the main thread when it returns.
+ *
+ * The thread is created before the process is started and is waiting for a user
+ * signal from the main thread before it calls RTProcWait.
+ *
+ * @returns VINF_SUCCESS (ignored).
+ * @param   hThreadSelf         The thread handle.
+ * @param   pvUser              The TXEEXEC structure.
+ */
+static DECLCALLBACK(int) txsExecWaitThreadProc(RTTHREAD hThreadSelf, void *pvUser)
+{
+    PTXSEXEC pTxsExec = (PTXSEXEC)pvUser;
+
+    /* Wait for the go ahead... */
+    int rc = RTThreadUserWait(hThreadSelf, RT_INDEFINITE_WAIT); AssertRC(rc);
+
+    RTCritSectEnter(&pTxsExec->CritSect);
+    for (;;)
+    {
+        RTCritSectLeave(&pTxsExec->CritSect);
+        rc = RTProcWaitNoResume(pTxsExec->hProcess, RTPROCWAIT_FLAGS_BLOCK, &pTxsExec->ProcessStatus);
+        RTCritSectEnter(&pTxsExec->CritSect);
+
+        /* If the pipe is NIL, the destructor wants us to get lost ASAP. */
+        if (pTxsExec->hWakeUpPipeW == NIL_RTPIPE)
+            break;
+
+        if (RT_FAILURE(rc))
+        {
+            rc = RTProcWait(pTxsExec->hProcess, RTPROCWAIT_FLAGS_NOBLOCK, &pTxsExec->ProcessStatus);
+            if (rc == VERR_PROCESS_RUNNING)
+                continue;
+
+            if (RT_FAILURE(rc))
+            {
+                AssertRC(rc);
+                pTxsExec->ProcessStatus.iStatus   = rc;
+                pTxsExec->ProcessStatus.enmReason = RTPROCEXITREASON_ABEND;
+            }
+        }
+
+        /* The process finished, signal the main thread over the pipe. */
+        ASMAtomicWriteBool(&pTxsExec->fProcessAlive, false);
+        size_t cbIgnored;
+        RTPipeWrite(pTxsExec->hWakeUpPipeW, "done", 4, &cbIgnored);
+        RTPipeClose(pTxsExec->hWakeUpPipeW);
+        pTxsExec->hWakeUpPipeW = NIL_RTPIPE;
+        break;
+    }
+    RTCritSectLeave(&pTxsExec->CritSect);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Sets up the thread that waits for the process to complete.
+ *
+ * @returns IPRT status code, reply to client made on error.
+ * @param   pTxsExec            The TXSEXEC instance.
+ */
+static int txsExecSetupThread(PTXSEXEC pTxsExec)
+{
+    int rc = RTPipeCreate(&pTxsExec->hWakeUpPipeR, &pTxsExec->hWakeUpPipeW, 0 /*fFlags*/);
+    if (RT_FAILURE(rc))
+    {
+        pTxsExec->hWakeUpPipeR = pTxsExec->hWakeUpPipeW = NIL_RTPIPE;
+        return txsExecReplyRC(pTxsExec, rc, "RTPipeCreate/wait");
+    }
+
+    rc = RTThreadCreate(&pTxsExec->hThreadWaiter, txsExecWaitThreadProc,
+                        pTxsExec, 0 /*cbStack */, RTTHREADTYPE_DEFAULT,
+                        RTTHREADFLAGS_WAITABLE, "TxsProcW");
+    if (RT_FAILURE(rc))
+    {
+        pTxsExec->hThreadWaiter = NIL_RTTHREAD;
+        return txsExecReplyRC(pTxsExec, rc, "RTThreadCreate");
+    }
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Sets up the test pipe.
+ *
+ * @returns IPRT status code, reply to client made on error.
+ * @param   pTxsExec            The TXSEXEC instance.
+ * @param   pszTestPipe         How to set up the test pipe.
+ */
+static int txsExecSetupTestPipe(PTXSEXEC pTxsExec, const char *pszTestPipe)
+{
+    if (strcmp(pszTestPipe, "|"))
+        return VINF_SUCCESS;
+
+    int rc = RTPipeCreate(&pTxsExec->hTestPipeR, &pTxsExec->hTestPipeW, RTPIPE_C_INHERIT_WRITE);
+    if (RT_FAILURE(rc))
+    {
+        pTxsExec->hTestPipeR = pTxsExec->hTestPipeW = NIL_RTPIPE;
+        return txsExecReplyRC(pTxsExec, rc, "RTPipeCreate/test/%s", pszTestPipe);
+    }
+
+    char szVal[64];
+    RTStrPrintf(szVal, sizeof(szVal), "%#llx", (uint64_t)RTPipeToNative(pTxsExec->hTestPipeW));
+    rc = RTEnvSetEx(pTxsExec->hEnv, "IPRT_TEST_PIPE", szVal);
+    if (RT_FAILURE(rc))
+        return txsExecReplyRC(pTxsExec, rc, "RTEnvSetEx/test/%s", pszTestPipe);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Sets up the redirection / pipe / nothing for one of the standard handles.
+ *
+ * @returns IPRT status code, reply to client made on error.
+ * @param   pTxsExec            The TXSEXEC instance.
+ * @param   pszHowTo            How to set up this standard handle.
+ * @param   fd                  Which standard handle it is (0 == stdin, 1 ==
+ *                              stdout, 2 == stderr).
+ * @param   ph                  The generic handle that @a pph may be set
+ *                              pointing to.  Always set.
+ * @param   pph                 Pointer to the RTProcCreateExec argument.
+ *                              Always set.
+ * @param   phPipe              Where to return the end of the pipe that we
+ *                              should service.  Always set.
+ */
+static int txsExecSetupRedir(PTXSEXEC pTxsExec, const char *pszHowTo, const char *pszStdWhat, int fd, PRTHANDLE ph, PRTHANDLE *pph, PRTPIPE phPipe)
+{
+    ph->enmType = RTHANDLETYPE_PIPE;
+    ph->u.hPipe = NIL_RTPIPE;
+    *pph        = NULL;
+    *phPipe     = NIL_RTPIPE;
+
+    int rc;
+    if (!strcmp(pszHowTo, "|"))
+    {
+        /*
+         * Setup a pipe for forwarding to/from the client.
+         */
+        if (fd == 0)
+            rc = RTPipeCreate(&ph->u.hPipe, phPipe, RTPIPE_C_INHERIT_READ);
+        else
+            rc = RTPipeCreate(phPipe, &ph->u.hPipe, RTPIPE_C_INHERIT_WRITE);
+        if (RT_FAILURE(rc))
+            return txsExecReplyRC(pTxsExec, rc, "RTPipeCreate/%s/%s", pszStdWhat, pszHowTo);
+        ph->enmType = RTHANDLETYPE_PIPE;
+        *pph = ph;
+    }
+    else if (!strcmp(pszHowTo, "/dev/null"))
+    {
+        /*
+         * Redirect to/from /dev/null.
+         */
+        RTFILE hFile;
+        rc = RTFileOpenBitBucket(&hFile, fd == 0 ? RTFILE_O_READ : RTFILE_O_WRITE);
+        if (RT_FAILURE(rc))
+            return txsExecReplyRC(pTxsExec, rc, "RTFileOpenBitBucket/%s/%s", pszStdWhat, pszHowTo);
+
+        ph->enmType = RTHANDLETYPE_FILE;
+        ph->u.hFile = hFile;
+        *pph = ph;
+    }
+    else if (*pszHowTo)
+    {
+        /*
+         * Redirect to/from file.
+         */
+        uint32_t fFlags;
+        if (fd == 0)
+            fFlags = RTFILE_O_READ  | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN;
+        else
+        {
+            if (pszHowTo[0] != '>' || pszHowTo[1] != '>')
+                fFlags = RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE;
+            else
+            {
+                /* append */
+                pszHowTo += 2;
+                fFlags = RTFILE_O_WRITE | RTFILE_O_DENY_NONE | RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND;
+            }
+        }
+
+        RTFILE hFile;
+        rc = RTFileOpen(&hFile, pszHowTo, fFlags);
+        if (RT_FAILURE(rc))
+            return txsExecReplyRC(pTxsExec, rc, "RTFileOpen/%s/%s", pszStdWhat, pszHowTo);
+
+        ph->enmType = RTHANDLETYPE_FILE;
+        ph->u.hFile = hFile;
+        *pph = ph;
+    }
+    else
+        /* same as parent (us) */
+        rc = VINF_SUCCESS;
+    return rc;
+}
+
+/**
+ * Create the environment.
+ *
+ * @returns IPRT status code, reply to client made on error.
+ * @param   pTxsExec            The TXSEXEC instance.
+ * @param   cEnvVars            The number of environment variables.
+ * @param   papszEnv            The environment variables (var=value).
+ */
+static int txsExecSetupEnv(PTXSEXEC pTxsExec, uint32_t cEnvVars, const char * const *papszEnv)
+{
+    /*
+     * Create the environment.
+     */
+    int rc = RTEnvClone(&pTxsExec->hEnv, RTENV_DEFAULT);
+    if (RT_FAILURE(rc))
+        return txsExecReplyRC(pTxsExec, rc, "RTEnvClone");
+
+    for (size_t i = 0; i < cEnvVars; i++)
+    {
+        rc = RTEnvPutEx(pTxsExec->hEnv, papszEnv[i]);
+        if (RT_FAILURE(rc))
+            return txsExecReplyRC(pTxsExec, rc, "RTEnvPutEx(,'%s')", papszEnv[i]);
+    }
+    return VINF_SUCCESS;
+}
+
+/**
+ * Deletes the TXSEXEC structure and frees the memory backing it.
+ *
+ * @param   pTxsExec            The structure to destroy.
+ */
+static void txsExecDestroy(PTXSEXEC pTxsExec)
+{
+    int rc2;
+
+    rc2 = RTEnvDestroy(pTxsExec->hEnv);             AssertRC(rc2);
+    pTxsExec->hEnv              = NIL_RTENV;
+    rc2 = RTPipeClose(pTxsExec->hTestPipeW);        AssertRC(rc2);
+    pTxsExec->hTestPipeW        = NIL_RTPIPE;
+    rc2 = RTHandleClose(pTxsExec->StdErr.phChild);  AssertRC(rc2);
+    pTxsExec->StdErr.phChild    = NULL;
+    rc2 = RTHandleClose(pTxsExec->StdOut.phChild);  AssertRC(rc2);
+    pTxsExec->StdOut.phChild    = NULL;
+    rc2 = RTHandleClose(pTxsExec->StdIn.phChild);   AssertRC(rc2);
+    pTxsExec->StdIn.phChild     = NULL;
+
+    rc2 = RTPipeClose(pTxsExec->hTestPipeR);        AssertRC(rc2);
+    pTxsExec->hTestPipeR        = NIL_RTPIPE;
+    rc2 = RTPipeClose(pTxsExec->hStdErrR);          AssertRC(rc2);
+    pTxsExec->hStdErrR          = NIL_RTPIPE;
+    rc2 = RTPipeClose(pTxsExec->hStdOutR);          AssertRC(rc2);
+    pTxsExec->hStdOutR          = NIL_RTPIPE;
+    rc2 = RTPipeClose(pTxsExec->hStdInW);           AssertRC(rc2);
+    pTxsExec->hStdInW           = NIL_RTPIPE;
+
+    RTPollSetDestroy(pTxsExec->hPollSet);
+    pTxsExec->hPollSet          = NIL_RTPOLLSET;
+
+    /*
+     * If the process is still running we're in a bit of a fix...  Try kill it,
+     * although that's potentially racing process termination and reusage of
+     * the pid.
+     */
+    RTCritSectEnter(&pTxsExec->CritSect);
+
+    RTPipeClose(pTxsExec->hWakeUpPipeW);
+    pTxsExec->hWakeUpPipeW      = NIL_RTPIPE;
+    RTPipeClose(pTxsExec->hWakeUpPipeR);
+    pTxsExec->hWakeUpPipeR      = NIL_RTPIPE;
+
+    if (   pTxsExec->hProcess != NIL_RTPROCESS
+        && pTxsExec->fProcessAlive)
+        RTProcTerminate(pTxsExec->hProcess);
+
+    RTCritSectLeave(&pTxsExec->CritSect);
+
+    int rcThread = VINF_SUCCESS;
+    if (pTxsExec->hThreadWaiter != NIL_RTTHREAD)
+        rcThread = RTThreadWait(pTxsExec->hThreadWaiter, 5000, NULL);
+    if (RT_SUCCESS(rcThread))
+    {
+        pTxsExec->hThreadWaiter = NIL_RTTHREAD;
+        RTCritSectDelete(&pTxsExec->CritSect);
+        RTMemFree(pTxsExec);
+    }
+    /* else: leak it or RTThreadWait may cause heap corruption later. */
+}
+
+/**
+ * Initializes the TXSEXEC structure.
+ *
+ * @returns VINF_SUCCESS and non-NULL *ppTxsExec on success, reply send status
+ *        and *ppTxsExec set to NULL on failure.
+ * @param   pPktHdr             The exec packet.
+ * @param   cMsTimeout          The time parameter.
+ * @param   ppTxsExec           Where to return the structure.
+ */
+static int txsExecCreate(PCTXSPKTHDR pPktHdr, RTMSINTERVAL cMsTimeout, PTXSEXEC *ppTxsExec)
+{
+    *ppTxsExec = NULL;
+
+    /*
+     * Allocate the basic resources.
+     */
+    PTXSEXEC pTxsExec = (PTXSEXEC)RTMemAlloc(sizeof(*pTxsExec));
+    if (!pTxsExec)
+        return txsReplyRC(pPktHdr, VERR_NO_MEMORY, "RTMemAlloc(%zu)", sizeof(*pTxsExec));
+    int rc = RTCritSectInit(&pTxsExec->CritSect);
+    if (RT_FAILURE(rc))
+    {
+        RTMemFree(pTxsExec);
+        return txsReplyRC(pPktHdr, rc, "RTCritSectInit");
+    }
+
+    /*
+     * Initialize the member to NIL values.
+     */
+    pTxsExec->pPktHdr           = pPktHdr;
+    pTxsExec->cMsTimeout        = cMsTimeout;
+    pTxsExec->rcReplySend       = VINF_SUCCESS;
+
+    pTxsExec->hPollSet          = NIL_RTPOLLSET;
+    pTxsExec->hStdInW           = NIL_RTPIPE;
+    pTxsExec->hStdOutR          = NIL_RTPIPE;
+    pTxsExec->hStdErrR          = NIL_RTPIPE;
+    pTxsExec->hTestPipeR        = NIL_RTPIPE;
+    pTxsExec->hWakeUpPipeR      = NIL_RTPIPE;
+    pTxsExec->hThreadWaiter     = NIL_RTTHREAD;
+
+    pTxsExec->StdIn.phChild     = NULL;
+    pTxsExec->StdOut.phChild    = NULL;
+    pTxsExec->StdErr.phChild    = NULL;
+    pTxsExec->hTestPipeW        = NIL_RTPIPE;
+    pTxsExec->hEnv              = NIL_RTENV;
+
+    pTxsExec->hProcess          = NIL_RTPROCESS;
+    pTxsExec->ProcessStatus.iStatus   = 254;
+    pTxsExec->ProcessStatus.enmReason = RTPROCEXITREASON_ABEND;
+    pTxsExec->fProcessAlive     = false;
+    pTxsExec->hWakeUpPipeW      = NIL_RTPIPE;
+
+    *ppTxsExec = pTxsExec;
+    return VINF_SUCCESS;
+}
+
+/**
+ * txsDoExec helper that takes over when txsDoExec has expanded the packet.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The exec packet.
+ * @param   fFlags              Flags, reserved for future use.
+ * @param   pszExecName         The executable name.
+ * @param   cArgs               The argument count.
+ * @param   papszArgs           The arguments.
+ * @param   cEnvVars            The environment variable count.
+ * @param   papszEnv            The environment variables.
+ * @param   pszStdIn            How to deal with standard in.
+ * @param   pszStdOut           How to deal with standard out.
+ * @param   pszStdErr           How to deal with standard err.
+ * @param   pszTestPipe         How to deal with the test pipe.
+ * @param   pszUsername         The user to run the program as.
+ * @param   cMillies            The process time limit in milliseconds.
+ */
+static int txsDoExecHlp(PCTXSPKTHDR pPktHdr, uint32_t fFlags, const char *pszExecName,
+                        uint32_t cArgs,    const char * const *papszArgs,
+                        uint32_t cEnvVars, const char * const *papszEnv,
+                        const char *pszStdIn, const char *pszStdOut, const char *pszStdErr, const char *pszTestPipe,
+                        const char *pszUsername, RTMSINTERVAL cMillies)
+{
+    int     rc2;
+
+    /*
+     * Input validation, filter out things we don't yet support..
+     */
+    Assert(!fFlags);
+    if (!*pszExecName)
+        return txsReplyFailure(pPktHdr, "STR ZERO", "Executable name is empty");
+    if (!*pszStdIn)
+        return txsReplyFailure(pPktHdr, "STR ZERO", "The stdin howto is empty");
+    if (!*pszStdOut)
+        return txsReplyFailure(pPktHdr, "STR ZERO", "The stdout howto is empty");
+    if (!*pszStdErr)
+        return txsReplyFailure(pPktHdr, "STR ZERO", "The stderr howto is empty");
+    if (!*pszTestPipe)
+        return txsReplyFailure(pPktHdr, "STR ZERO", "The testpipe howto is empty");
+    if (strcmp(pszTestPipe, "|") && strcmp(pszTestPipe,  "/dev/null"))
+        return txsReplyFailure(pPktHdr, "BAD TSTP", "Only \"|\" and \"/dev/null\" are allowed as testpipe howtos ('%s')",
+                               pszTestPipe);
+    if (*pszUsername)
+        return txsReplyFailure(pPktHdr, "NOT IMPL", "Executing as a specific user is not implemented ('%s')", pszUsername);
+
+    /*
+     * Prepare for process launch.
+     */
+    PTXSEXEC pTxsExec;
+    int rc = txsExecCreate(pPktHdr, cMillies, &pTxsExec);
+    if (pTxsExec == NULL)
+        return rc;
+    rc = txsExecSetupEnv(pTxsExec, cEnvVars, papszEnv);
+    if (RT_SUCCESS(rc))
+        rc = txsExecSetupRedir(pTxsExec, pszStdIn, "StdIn",   0, &pTxsExec->StdIn.hChild,  &pTxsExec->StdIn.phChild,  &pTxsExec->hStdInW);
+    if (RT_SUCCESS(rc))
+        rc = txsExecSetupRedir(pTxsExec, pszStdOut, "StdOut", 1, &pTxsExec->StdOut.hChild, &pTxsExec->StdOut.phChild, &pTxsExec->hStdOutR);
+    if (RT_SUCCESS(rc))
+        rc = txsExecSetupRedir(pTxsExec, pszStdErr, "StdErr", 2, &pTxsExec->StdErr.hChild, &pTxsExec->StdErr.phChild, &pTxsExec->hStdErrR);
+    if (RT_SUCCESS(rc))
+        rc = txsExecSetupTestPipe(pTxsExec, pszTestPipe);
+    if (RT_SUCCESS(rc))
+        rc = txsExecSetupThread(pTxsExec);
+    if (RT_SUCCESS(rc))
+        rc = txsExecSetupPollSet(pTxsExec);
+    if (RT_SUCCESS(rc))
+    {
+        /*
+         * Create the process.
+         */
+        if (g_fDisplayOutput)
+        {
+            RTPrintf("txs: Executing \"%s\": ", pszExecName);
+            for (uint32_t i = 0; i < cArgs; i++)
+                RTPrintf(" \"%s\"", papszArgs[i]);
+            RTPrintf("\n");
+        }
+        rc = RTProcCreateEx(pszExecName, papszArgs, pTxsExec->hEnv, 0 /*fFlags*/,
+                            pTxsExec->StdIn.phChild, pTxsExec->StdOut.phChild, pTxsExec->StdErr.phChild,
+                            *pszUsername ? pszUsername : NULL, NULL,
+                            &pTxsExec->hProcess);
+        if (RT_SUCCESS(rc))
+        {
+            ASMAtomicWriteBool(&pTxsExec->fProcessAlive, true);
+            rc2 = RTThreadUserSignal(pTxsExec->hThreadWaiter); AssertRC(rc2);
+
+            /*
+             * Close the child ends of any pipes and redirected files.
+             */
+            rc2 = RTHandleClose(pTxsExec->StdIn.phChild);   AssertRC(rc2);
+            pTxsExec->StdIn.phChild     = NULL;
+            rc2 = RTHandleClose(pTxsExec->StdOut.phChild);  AssertRC(rc2);
+            pTxsExec->StdOut.phChild    = NULL;
+            rc2 = RTHandleClose(pTxsExec->StdErr.phChild);  AssertRC(rc2);
+            pTxsExec->StdErr.phChild    = NULL;
+            rc2 = RTPipeClose(pTxsExec->hTestPipeW);        AssertRC(rc2);
+            pTxsExec->hTestPipeW        = NIL_RTPIPE;
+
+            /*
+             * Let another worker function funnel output and input to the
+             * client as well as the process exit code.
+             */
+            rc = txsDoExecHlp2(pTxsExec);
+        }
+        else
+            rc = txsReplyFailure(pPktHdr, "FAILED  ", "Executing process \"%s\" failed with %Rrc",
+                                 pszExecName, rc);
+    }
+    else
+        rc = pTxsExec->rcReplySend;
+    txsExecDestroy(pTxsExec);
+    return rc;
+}
+
+/**
+ * Execute a program.
+ *
+ * @returns IPRT status code from send.
+ * @param   pPktHdr             The exec packet.
+ */
+static int txsDoExec(PCTXSPKTHDR pPktHdr)
+{
+    /*
+     * This packet has a lot of parameters, most of which are zero terminated
+     * strings.  The strings used in items 7 thru 10 are either file names,
+     * "/dev/null" or a pipe char (|).
+     *
+     * Packet content:
+     *    1. Flags reserved for future use (32-bit unsigned).
+     *    2. The executable name (string).
+     *    3. The argument count given as a 32-bit unsigned integer.
+     *    4. The arguments strings.
+     *    5. The number of environment strings (32-bit unsigned).
+     *    6. The environment strings (var=val) to apply the environment.
+     *    7. What to do about standard in (string).
+     *    8. What to do about standard out (string).
+     *    9. What to do about standard err (string).
+     *   10. What to do about the test pipe (string).
+     *   11. The name of the user to run the program as (string).  Empty string
+     *       means running it as the current user.
+     *   12. Process time limit in milliseconds (32-bit unsigned).  Max == no limit.
+     */
+    size_t const cbMin = sizeof(TXSPKTHDR)
+                       + sizeof(uint32_t) /* flags */ + 2
+                       + sizeof(uint32_t) /* argc */  + 2 /* argv */
+                       + sizeof(uint32_t) + 0 /* environ */
+                       + 4 * 1
+                       + sizeof(uint32_t) /* timeout */;
+    if (pPktHdr->cb < cbMin)
+        return txsReplyBadMinSize(pPktHdr, cbMin);
+
+    /* unpack the packet */
+    char const     *pchEnd = (char const *)pPktHdr + pPktHdr->cb;
+    char const     *pch    = (char const *)(pPktHdr + 1); /* cursor */
+
+    /* 1. flags */
+    uint32_t const  fFlags = *(uint32_t const *)pch;
+    pch                   += sizeof(uint32_t);
+    if (fFlags != 0)
+        return txsReplyFailure(pPktHdr, "BAD FLAG", "Invalid EXEC flags %#x, expected 0", fFlags);
+
+    /* 2. exec name */
+    int             rc;
+    char           *pszExecName = NULL;
+    if (!txsIsStringValid(pPktHdr, "execname", pch, &pszExecName, &pch, &rc))
+        return rc;
+
+    /* 3. argc */
+    uint32_t const  cArgs  = (size_t)(pchEnd - pch) > sizeof(uint32_t) ? *(uint32_t const *)pch : 0xff;
+    pch                   += sizeof(uint32_t);
+    if (cArgs * 1 >= (size_t)(pchEnd - pch))
+        rc = txsReplyFailure(pPktHdr, "BAD ARGC", "Bad or missing argument count (%#x)", cArgs);
+    else if (cArgs > 128)
+        rc = txsReplyFailure(pPktHdr, "BAD ARGC", "Too many arguments (%#x)", cArgs);
+    else
+    {
+        char **papszArgs = (char **)RTMemTmpAllocZ(sizeof(char *) * (cArgs + 1));
+        if (papszArgs)
+        {
+            /* 4. argv */
+            bool fOk = true;
+            for (size_t i = 0; i < cArgs && fOk; i++)
+            {
+                fOk = txsIsStringValid(pPktHdr, "argvN", pch, &papszArgs[i], &pch, &rc);
+                if (!fOk)
+                    break;
+            }
+            if (fOk)
+            {
+                /* 5. cEnvVars */
+                uint32_t const  cEnvVars = (size_t)(pchEnd - pch) > sizeof(uint32_t) ? *(uint32_t const *)pch : 0xfff;
+                pch                     += sizeof(uint32_t);
+                if (cEnvVars * 1 >= (size_t)(pchEnd - pch))
+                    rc = txsReplyFailure(pPktHdr, "BAD ENVC", "Bad or missing environment variable count (%#x)", cEnvVars);
+                else if (cEnvVars > 256)
+                    rc = txsReplyFailure(pPktHdr, "BAD ENVC", "Too many environment variables (%#x)", cEnvVars);
+                else
+                {
+                    char **papszEnv = (char **)RTMemTmpAllocZ(sizeof(char *) * (cEnvVars + 1));
+                    if (papszEnv)
+                    {
+                        /* 6. environ */
+                        for (size_t i = 0; i < cEnvVars && fOk; i++)
+                        {
+                            fOk = txsIsStringValid(pPktHdr, "envN", pch, &papszEnv[i], &pch, &rc);
+                            if (!fOk) /* Bail out on error. */
+                                break;
+                        }
+                        if (fOk)
+                        {
+                            /* 7. stdout */
+                            char *pszStdIn;
+                            if (txsIsStringValid(pPktHdr, "stdin", pch, &pszStdIn, &pch, &rc))
+                            {
+                                /* 8. stdout */
+                                char *pszStdOut;
+                                if (txsIsStringValid(pPktHdr, "stdout", pch, &pszStdOut, &pch, &rc))
+                                {
+                                    /* 9. stderr */
+                                    char *pszStdErr;
+                                    if (txsIsStringValid(pPktHdr, "stderr", pch, &pszStdErr, &pch, &rc))
+                                    {
+                                        /* 10. testpipe */
+                                        char *pszTestPipe;
+                                        if (txsIsStringValid(pPktHdr, "testpipe", pch, &pszTestPipe, &pch, &rc))
+                                        {
+                                            /* 11. username */
+                                            char *pszUsername;
+                                            if (txsIsStringValid(pPktHdr, "username", pch, &pszUsername, &pch, &rc))
+                                            {
+                                                /** @todo No password value? */
+
+                                                /* 12. time limit */
+                                                uint32_t const  cMillies = (size_t)(pchEnd - pch) >= sizeof(uint32_t)
+                                                                         ? *(uint32_t const *)pch
+                                                                         : 0;
+                                                if ((size_t)(pchEnd - pch) > sizeof(uint32_t))
+                                                    rc = txsReplyFailure(pPktHdr, "BAD END ", "Timeout argument not at end of packet (%#x)", (size_t)(pchEnd - pch));
+                                                else if ((size_t)(pchEnd - pch) < sizeof(uint32_t))
+                                                    rc = txsReplyFailure(pPktHdr, "BAD NOTO", "No timeout argument");
+                                                else if (cMillies < 1000)
+                                                    rc = txsReplyFailure(pPktHdr, "BAD TO  ", "Timeout is less than a second (%#x)", cMillies);
+                                                else
+                                                {
+                                                    pch += sizeof(uint32_t);
+
+                                                    /*
+                                                     * Time to employ a helper here before we go way beyond
+                                                     * the right margin...
+                                                     */
+                                                    rc = txsDoExecHlp(pPktHdr, fFlags, pszExecName,
+                                                                      cArgs,    papszArgs,
+                                                                      cEnvVars, papszEnv,
+                                                                      pszStdIn, pszStdOut, pszStdErr, pszTestPipe,
+                                                                      pszUsername,
+                                                                      cMillies == UINT32_MAX ? RT_INDEFINITE_WAIT : cMillies);
+                                                }
+                                                RTStrFree(pszUsername);
+                                            }
+                                            RTStrFree(pszTestPipe);
+                                        }
+                                        RTStrFree(pszStdErr);
+                                    }
+                                    RTStrFree(pszStdOut);
+                                }
+                                RTStrFree(pszStdIn);
+                            }
+                        }
+                        for (size_t i = 0; i < cEnvVars; i++)
+                            RTStrFree(papszEnv[i]);
+                        RTMemTmpFree(papszEnv);
+                    }
+                    else
+                        rc = txsReplyFailure(pPktHdr, "NO MEM  ", "Failed to allocate %zu bytes environ", sizeof(char *) * (cEnvVars + 1));
+                }
+            }
+            for (size_t i = 0; i < cArgs; i++)
+                RTStrFree(papszArgs[i]);
+            RTMemTmpFree(papszArgs);
+        }
+        else
+            rc = txsReplyFailure(pPktHdr, "NO MEM  ", "Failed to allocate %zu bytes for argv", sizeof(char *) * (cArgs + 1));
+    }
+    RTStrFree(pszExecName);
+
+    return rc;
+}
+
+/**
+ * The main loop.
+ *
+ * @returns exit code.
+ */
+static RTEXITCODE txsMainLoop(void)
+{
+    RTEXITCODE enmExitCode = RTEXITCODE_SUCCESS;
+    while (!g_fTerminate)
+    {
+        /*
+         * Read client command packet and process it.
+         */
+        PTXSPKTHDR pPktHdr;
+        int rc = txsRecvPkt(&pPktHdr, true /*fAutoRetryOnFailure*/);
+        if (RT_FAILURE(rc))
+            continue;
+
+        /*
+         * Do a string switch on the opcode bit.
+         */
+        /* Connection: */
+        if (     txsIsSameOpcode(pPktHdr, "HOWDY   "))
+            rc = txsDoHowdy(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "BYE     "))
+            rc = txsDoBye(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "UUID    "))
+            rc = txsDoUuid(pPktHdr);
+        /* Process: */
+        else if (txsIsSameOpcode(pPktHdr, "EXEC    "))
+            rc = txsDoExec(pPktHdr);
+        /* Admin: */
+        else if (txsIsSameOpcode(pPktHdr, "REBOOT  "))
+            rc = txsDoReboot(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "SHUTDOWN"))
+            rc = txsDoShutdown(pPktHdr);
+        /* CD/DVD control: */
+        else if (txsIsSameOpcode(pPktHdr, "CD EJECT"))
+            rc = txsDoCdEject(pPktHdr);
+        /* File system: */
+        else if (txsIsSameOpcode(pPktHdr, "CLEANUP "))
+            rc = txsDoCleanup(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "MKDIR   "))
+            rc = txsDoMkDir(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "MKDRPATH"))
+            rc = txsDoMkDrPath(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "MKSYMLNK"))
+            rc = txsDoMkSymlnk(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "RMDIR   "))
+            rc = txsDoRmDir(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "RMFILE  "))
+            rc = txsDoRmFile(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "RMSYMLNK"))
+            rc = txsDoRmSymlnk(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "RMTREE  "))
+            rc = txsDoRmTree(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "CHMOD   "))
+            rc = txsDoChMod(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "CHOWN   "))
+            rc = txsDoChOwn(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "CHGRP   "))
+            rc = txsDoChGrp(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "ISDIR   "))
+            rc = txsDoIsDir(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "ISFILE  "))
+            rc = txsDoIsFile(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "ISSYMLNK"))
+            rc = txsDoIsSymlnk(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "STAT    "))
+            rc = txsDoStat(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "LSTAT   "))
+            rc = txsDoLStat(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "LIST    "))
+            rc = txsDoList(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "PUT FILE"))
+            rc = txsDoPutFile(pPktHdr);
+        else if (txsIsSameOpcode(pPktHdr, "GET FILE"))
+            rc = txsDoGetFile(pPktHdr);
+#ifndef RT_OS_WINDOWS
+        else if (txsIsSameOpcode(pPktHdr, "UNPKFILE"))
+            rc = txsDoUnpackFile(pPktHdr);
+#endif
+        /* Misc: */
+        else
+            rc = txsReplyUnknown(pPktHdr);
+
+        RTMemFree(pPktHdr);
+    }
+
+    return enmExitCode;
+}
+
+
+/**
+ * Finalizes the scratch directory, making sure it exists.
+ *
+ * @returns exit code.
+ */
+static RTEXITCODE txsFinalizeScratch(void)
+{
+    RTPathStripTrailingSlash(g_szScratchPath);
+    char *pszFilename = RTPathFilename(g_szScratchPath);
+    if (!pszFilename)
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "cannot use root for scratch (%s)\n", g_szScratchPath);
+
+    int rc;
+    if (strchr(pszFilename, 'X'))
+    {
+        char ch = *pszFilename;
+        rc = RTDirCreateFullPath(g_szScratchPath, 0700);
+        *pszFilename = ch;
+        if (RT_SUCCESS(rc))
+            rc = RTDirCreateTemp(g_szScratchPath, 0700);
+    }
+    else
+    {
+        if (RTDirExists(g_szScratchPath))
+            rc = VINF_SUCCESS;
+        else
+            rc = RTDirCreateFullPath(g_szScratchPath, 0700);
+    }
+    if (RT_FAILURE(rc))
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "failed to create scratch directory: %Rrc (%s)\n", rc, g_szScratchPath);
+    return RTEXITCODE_SUCCESS;
+}
+
+/**
+ * Attempts to complete an upgrade by updating the original and relaunching
+ * ourselves from there again.
+ *
+ * On failure, we'll continue running as the temporary copy.
+ *
+ * @returns Exit code. Exit if this is non-zero or @a *pfExit is set.
+ * @param   argc                The number of arguments.
+ * @param   argv                The argument vector.
+ * @param   pfExit              For indicating exit when the exit code is zero.
+ */
+static RTEXITCODE txsAutoUpdateStage2(int argc, char **argv, bool *pfExit, const char *pszUpgrading)
+{
+    /*
+     * Copy the current executable onto the original.
+     * Note that we're racing the original program on some platforms, thus the
+     * 60 sec sleep mess.
+     */
+    char szUpgradePath[RTPATH_MAX];
+    if (!RTProcGetExecutablePath(szUpgradePath, sizeof(szUpgradePath)))
+    {
+        RTMsgError("RTProcGetExecutablePath failed (step 2)\n");
+        return RTEXITCODE_SUCCESS;
+    }
+    void    *pvUpgrade;
+    size_t   cbUpgrade;
+    int rc = RTFileReadAll(szUpgradePath, &pvUpgrade, &cbUpgrade);
+    if (RT_FAILURE(rc))
+    {
+        RTMsgError("RTFileReadAllEx(\"%s\"): %Rrc (step 2)\n", szUpgradePath, rc);
+        return RTEXITCODE_SUCCESS;
+    }
+
+    uint64_t StartMilliTS = RTTimeMilliTS();
+    RTFILE  hFile;
+    rc = RTFileOpen(&hFile, pszUpgrading,
+                    RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_TRUNCATE
+                    | (0755 << RTFILE_O_CREATE_MODE_SHIFT));
+    while (   RT_FAILURE(rc)
+           && RTTimeMilliTS() - StartMilliTS < 60000)
+    {
+        RTThreadSleep(1000);
+        rc = RTFileOpen(&hFile, pszUpgrading,
+                        RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN_CREATE | RTFILE_O_TRUNCATE
+                        | (0755 << RTFILE_O_CREATE_MODE_SHIFT));
+    }
+    if (RT_SUCCESS(rc))
+    {
+        rc = RTFileWrite(hFile, pvUpgrade, cbUpgrade, NULL);
+        RTFileClose(hFile);
+        if (RT_SUCCESS(rc))
+        {
+            /*
+             * Relaunch the service with the original name, foricbly barring
+             * further upgrade cycles in case of bugs (and simplifying the code).
+             */
+            const char **papszArgs = (const char **)RTMemAlloc((argc + 1 + 1) * sizeof(char **));
+            if (papszArgs)
+            {
+                papszArgs[0] = pszUpgrading;
+                for (int i = 1; i < argc; i++)
+                    papszArgs[i] = argv[i];
+                papszArgs[argc] = "--no-auto-upgrade";
+                papszArgs[argc + 1] = NULL;
+
+                RTMsgInfo("Launching upgraded image: \"%s\"\n", pszUpgrading);
+                RTPROCESS hProc;
+                rc = RTProcCreate(pszUpgrading, papszArgs, RTENV_DEFAULT, 0 /*fFlags*/, &hProc);
+                if (RT_SUCCESS(rc))
+                    *pfExit = true;
+                else
+                    RTMsgError("RTProcCreate(\"%s\"): %Rrc (upgrade stage 2)\n", pszUpgrading, rc);
+                RTMemFree(papszArgs);
+            }
+            else
+                RTMsgError("RTMemAlloc failed during upgrade attempt (stage 2)\n");
+        }
+        else
+            RTMsgError("RTFileWrite(%s,,%zu): %Rrc (step 2) - BAD\n", pszUpgrading, cbUpgrade, rc);
+    }
+    else
+        RTMsgError("RTFileOpen(,%s,): %Rrc\n", pszUpgrading, rc);
+    RTFileReadAllFree(pvUpgrade, cbUpgrade);
+    return RTEXITCODE_SUCCESS;
+}
+
+/**
+ * Checks for an upgrade and respawns if there is.
+ *
+ * @returns Exit code. Exit if this is non-zero or @a *pfExit is set.
+ * @param   argc                The number of arguments.
+ * @param   argv                The argument vector.
+ * @param   pfExit              For indicating exit when the exit code is zero.
+ */
+static RTEXITCODE txsAutoUpdateStage1(int argc, char **argv, bool *pfExit)
+{
+    /*
+     * Figure names of the current service image and the potential upgrade.
+     */
+    char szOrgPath[RTPATH_MAX];
+    if (!RTProcGetExecutablePath(szOrgPath, sizeof(szOrgPath)))
+    {
+        RTMsgError("RTProcGetExecutablePath failed\n");
+        return RTEXITCODE_SUCCESS;
+    }
+
+    char szUpgradePath[RTPATH_MAX];
+    int rc = RTPathJoin(szUpgradePath, sizeof(szUpgradePath), g_szCdRomPath, g_szOsSlashArchShortName);
+    if (RT_SUCCESS(rc))
+        rc = RTPathAppend(szUpgradePath, sizeof(szUpgradePath), RTPathFilename(szOrgPath));
+    if (RT_FAILURE(rc))
+    {
+        RTMsgError("Failed to construct path to potential service upgrade: %Rrc\n", rc);
+        return RTEXITCODE_SUCCESS;
+    }
+
+    /*
+     * Query information about the two images and read the entire potential source file.
+     */
+    RTFSOBJINFO UpgradeInfo;
+    rc = RTPathQueryInfo(szUpgradePath, &UpgradeInfo, RTFSOBJATTRADD_NOTHING);
+    if (    rc == VERR_FILE_NOT_FOUND
+        ||  rc == VERR_PATH_NOT_FOUND
+        ||  rc == VERR_MEDIA_NOT_PRESENT
+        ||  rc == VERR_MEDIA_NOT_RECOGNIZED)
+        return RTEXITCODE_SUCCESS;
+    if (RT_FAILURE(rc))
+    {
+        RTMsgError("RTPathQueryInfo(\"%s\"): %Rrc (upgrade)\n", szUpgradePath, rc);
+        return RTEXITCODE_SUCCESS;
+    }
+
+    RTFSOBJINFO OrgInfo;
+    rc = RTPathQueryInfo(szOrgPath, &OrgInfo, RTFSOBJATTRADD_NOTHING);
+    if (RT_FAILURE(rc))
+    {
+        RTMsgError("RTPathQueryInfo(\"%s\"): %Rrc (old)\n", szOrgPath, rc);
+        return RTEXITCODE_SUCCESS;
+    }
+
+    void    *pvUpgrade;
+    size_t   cbUpgrade;
+    rc = RTFileReadAllEx(szUpgradePath, 0, UpgradeInfo.cbObject, RTFILE_RDALL_O_DENY_NONE, &pvUpgrade, &cbUpgrade);
+    if (RT_FAILURE(rc))
+    {
+        RTMsgError("RTPathQueryInfo(\"%s\"): %Rrc (old)\n", szOrgPath, rc);
+        return RTEXITCODE_SUCCESS;
+    }
+
+    /*
+     * Compare and see if we've got a different service image or not.
+     */
+    if (OrgInfo.cbObject == UpgradeInfo.cbObject)
+    {
+        /* must compare bytes. */
+        void    *pvOrg;
+        size_t   cbOrg;
+        rc = RTFileReadAllEx(szOrgPath, 0, OrgInfo.cbObject, RTFILE_RDALL_O_DENY_NONE, &pvOrg, &cbOrg);
+        if (RT_FAILURE(rc))
+        {
+            RTMsgError("RTFileReadAllEx(\"%s\"): %Rrc\n", szOrgPath, rc);
+            RTFileReadAllFree(pvUpgrade, cbUpgrade);
+            return RTEXITCODE_SUCCESS;
+        }
+        bool fSame = !memcmp(pvUpgrade, pvOrg, OrgInfo.cbObject);
+        RTFileReadAllFree(pvOrg, cbOrg);
+        if (fSame)
+        {
+            RTFileReadAllFree(pvUpgrade, cbUpgrade);
+            return RTEXITCODE_SUCCESS;
+        }
+    }
+
+    /*
+     * Should upgrade.  Start by creating an executable copy of the update
+     * image in the scratch area.
+     */
+    RTEXITCODE rcExit = txsFinalizeScratch();
+    if (rcExit == RTEXITCODE_SUCCESS)
+    {
+        char szTmpPath[RTPATH_MAX];
+        rc = RTPathJoin(szTmpPath, sizeof(szTmpPath), g_szScratchPath, RTPathFilename(szOrgPath));
+        if (RT_SUCCESS(rc))
+        {
+            RTFileDelete(szTmpPath); /* shouldn't hurt. */
+
+            RTFILE hFile;
+            rc = RTFileOpen(&hFile, szTmpPath,
+                            RTFILE_O_WRITE | RTFILE_O_DENY_WRITE | RTFILE_O_CREATE_REPLACE
+                            | (0755 << RTFILE_O_CREATE_MODE_SHIFT));
+            if (RT_SUCCESS(rc))
+            {
+                rc = RTFileWrite(hFile, pvUpgrade, UpgradeInfo.cbObject, NULL);
+                RTFileClose(hFile);
+                if (RT_SUCCESS(rc))
+                {
+                    /*
+                     * Try execute the new image and quit if it works.
+                     */
+                    const char **papszArgs = (const char **)RTMemAlloc((argc + 2 + 1) * sizeof(char **));
+                    if (papszArgs)
+                    {
+                        papszArgs[0] = szTmpPath;
+                        for (int i = 1; i < argc; i++)
+                            papszArgs[i] = argv[i];
+                        papszArgs[argc] = "--upgrading";
+                        papszArgs[argc + 1] = szOrgPath;
+                        papszArgs[argc + 2] = NULL;
+
+                        RTMsgInfo("Launching intermediate automatic upgrade stage: \"%s\"\n", szTmpPath);
+                        RTPROCESS hProc;
+                        rc = RTProcCreate(szTmpPath, papszArgs, RTENV_DEFAULT, 0 /*fFlags*/, &hProc);
+                        if (RT_SUCCESS(rc))
+                            *pfExit = true;
+                        else
+                            RTMsgError("RTProcCreate(\"%s\"): %Rrc (upgrade stage 1)\n", szTmpPath, rc);
+                        RTMemFree(papszArgs);
+                    }
+                    else
+                        RTMsgError("RTMemAlloc failed during upgrade attempt (stage)\n");
+                }
+                else
+                    RTMsgError("RTFileWrite(%s,,%zu): %Rrc\n", szTmpPath, UpgradeInfo.cbObject, rc);
+            }
+            else
+                RTMsgError("RTFileOpen(,%s,): %Rrc\n", szTmpPath, rc);
+        }
+        else
+            RTMsgError("Failed to construct path to temporary upgrade image: %Rrc\n", rc);
+    }
+
+    RTFileReadAllFree(pvUpgrade, cbUpgrade);
+    return rcExit;
+}
+
+/**
+ * Determines the default configuration.
+ */
+static void txsSetDefaults(void)
+{
+    /*
+     * OS and ARCH.
+     */
+    AssertCompile(sizeof(KBUILD_TARGET) <= sizeof(g_szOsShortName));
+    strcpy(g_szOsShortName, KBUILD_TARGET);
+
+    AssertCompile(sizeof(KBUILD_TARGET_ARCH) <= sizeof(g_szArchShortName));
+    strcpy(g_szArchShortName, KBUILD_TARGET_ARCH);
+
+    AssertCompile(sizeof(KBUILD_TARGET) + sizeof(KBUILD_TARGET_ARCH) <= sizeof(g_szOsDotArchShortName));
+    strcpy(g_szOsDotArchShortName, KBUILD_TARGET);
+    g_szOsDotArchShortName[sizeof(KBUILD_TARGET) - 1] = '.';
+    strcpy(&g_szOsDotArchShortName[sizeof(KBUILD_TARGET)], KBUILD_TARGET_ARCH);
+
+    AssertCompile(sizeof(KBUILD_TARGET) + sizeof(KBUILD_TARGET_ARCH) <= sizeof(g_szOsSlashArchShortName));
+    strcpy(g_szOsSlashArchShortName, KBUILD_TARGET);
+    g_szOsSlashArchShortName[sizeof(KBUILD_TARGET) - 1] = '/';
+    strcpy(&g_szOsSlashArchShortName[sizeof(KBUILD_TARGET)], KBUILD_TARGET_ARCH);
+
+#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
+    strcpy(g_szExeSuff,    ".exe");
+    strcpy(g_szScriptSuff, ".cmd");
+#else
+    strcpy(g_szExeSuff,    "");
+    strcpy(g_szScriptSuff, ".sh");
+#endif
+
+    /*
+     * The CD/DVD-ROM location.
+     */
+    /** @todo do a better job here :-) */
+#ifdef RT_OS_WINDOWS
+    strcpy(g_szDefCdRomPath, "D:/");
+#elif defined(RT_OS_OS2)
+    strcpy(g_szDefCdRomPath, "D:/");
+#else
+    if (RTDirExists("/media"))
+        strcpy(g_szDefCdRomPath, "/media/cdrom");
+    else
+        strcpy(g_szDefCdRomPath, "/mnt/cdrom");
+#endif
+    strcpy(g_szCdRomPath, g_szDefCdRomPath);
+
+    /*
+     * Temporary directory.
+     */
+    int rc = RTPathTemp(g_szDefScratchPath, sizeof(g_szDefScratchPath));
+    if (RT_SUCCESS(rc))
+#if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) || defined(RT_OS_DOS)
+        rc = RTPathAppend(g_szDefScratchPath, sizeof(g_szDefScratchPath), "txs-XXXX.tmp");
+#else
+        rc = RTPathAppend(g_szDefScratchPath, sizeof(g_szDefScratchPath), "txs-XXXXXXXXX.tmp");
+#endif
+    if (RT_FAILURE(rc))
+    {
+        RTMsgError("RTPathTemp/Append failed when constructing scratch path: %Rrc\n", rc);
+        strcpy(g_szDefScratchPath, "/tmp/txs-XXXX.tmp");
+    }
+    strcpy(g_szScratchPath, g_szDefScratchPath);
+
+    /*
+     * The default transporter is the first one.
+     */
+    g_pTransport = g_apTransports[0];
+}
+
+/**
+ * Prints the usage.
+ *
+ * @param   pStrm               Where to print it.
+ * @param   pszArgv0            The program name (argv[0]).
+ */
+static void txsUsage(PRTSTREAM pStrm, const char *argv0)
+{
+    RTStrmPrintf(pStrm,
+                 "Usage: %Rbn [options]\n"
+                 "\n"
+                 "Options:\n"
+                 "  --cdrom <path>\n"
+                 "      Where the CD/DVD-ROM will be mounted.\n"
+                 "      Default: %s\n"
+                 "  --scratch <path>\n"
+                 "      Where to put scratch files.\n"
+                 "      Default: %s \n"
+                 ,
+                 argv0,
+                 g_szDefCdRomPath,
+                 g_szDefScratchPath);
+    RTStrmPrintf(pStrm,
+                 "  --transport <name>\n"
+                 "      Use the specified transport layer, one of the following:\n");
+    for (size_t i = 0; i < RT_ELEMENTS(g_apTransports); i++)
+        RTStrmPrintf(pStrm, "          %s - %s\n", g_apTransports[i]->szName, g_apTransports[i]->pszDesc);
+    RTStrmPrintf(pStrm, "      Default: %s\n", g_pTransport->szName);
+    RTStrmPrintf(pStrm,
+                 "  --auto-upgrade, --no-auto-upgrade\n"
+                 "      To enable or disable the automatic upgrade mechanism where any different\n"
+                 "      version found on the CD-ROM on startup will replace the initial copy.\n"
+                 "      Default: --auto-upgrade\n"
+                 "  --upgrading <org-path>\n"
+                 "      Internal use only.\n");
+    RTStrmPrintf(pStrm,
+                 "  --display-output, --no-display-output\n"
+                 "      Display the output and the result of all child processes.\n");
+    RTStrmPrintf(pStrm,
+                 "  --foreground\n"
+                 "      Don't daemonize, run in the foreground.\n");
+    RTStrmPrintf(pStrm,
+                 "  --help, -h, -?\n"
+                 "      Display this message and exit.\n"
+                 "  --version, -V\n"
+                 "      Display the version and exit.\n");
+
+    for (size_t i = 0; i < RT_ELEMENTS(g_apTransports); i++)
+        if (g_apTransports[i]->cOpts)
+        {
+            RTStrmPrintf(pStrm,
+                         "\n"
+                         "Options for %s:\n", g_apTransports[i]->szName);
+            g_apTransports[i]->pfnUsage(g_pStdOut);
+        }
+}
+
+/**
+ * Parses the arguments.
+ *
+ * @returns Exit code. Exit if this is non-zero or @a *pfExit is set.
+ * @param   argc                The number of arguments.
+ * @param   argv                The argument vector.
+ * @param   pfExit              For indicating exit when the exit code is zero.
+ */
+static RTEXITCODE txsParseArgv(int argc, char **argv, bool *pfExit)
+{
+    *pfExit = false;
+
+    /*
+     * Storage for locally handled options.
+     */
+    bool        fAutoUpgrade    = true;
+    bool        fDaemonize      = true;
+    bool        fDaemonized     = false;
+    bool        fTransportFixed = false;
+    const char *pszUpgrading    = NULL;
+
+    /*
+     * Combine the base and transport layer option arrays.
+     */
+    static const RTGETOPTDEF s_aBaseOptions[] =
+    {
+        { "--transport",        't', RTGETOPT_REQ_STRING  },
+        { "--cdrom",            'c', RTGETOPT_REQ_STRING  },
+        { "--scratch",          's', RTGETOPT_REQ_STRING  },
+        { "--auto-upgrade",     'a', RTGETOPT_REQ_NOTHING },
+        { "--no-auto-upgrade",  'A', RTGETOPT_REQ_NOTHING },
+        { "--upgrading",        'U', RTGETOPT_REQ_STRING  },
+        { "--display-output",   'd', RTGETOPT_REQ_NOTHING  },
+        { "--no-display-output",'D', RTGETOPT_REQ_NOTHING  },
+        { "--foreground",       'f', RTGETOPT_REQ_NOTHING  },
+        { "--daemonized",       'Z', RTGETOPT_REQ_NOTHING  },
+    };
+
+    size_t cOptions = RT_ELEMENTS(s_aBaseOptions);
+    for (size_t i = 0; i < RT_ELEMENTS(g_apTransports); i++)
+        cOptions += g_apTransports[i]->cOpts;
+
+    PRTGETOPTDEF paOptions = (PRTGETOPTDEF)alloca(cOptions * sizeof(RTGETOPTDEF));
+    if (!paOptions)
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "alloca failed\n");
+
+    memcpy(paOptions, s_aBaseOptions, sizeof(s_aBaseOptions));
+    cOptions = RT_ELEMENTS(s_aBaseOptions);
+    for (size_t i = 0; i < RT_ELEMENTS(g_apTransports); i++)
+    {
+        memcpy(&paOptions[cOptions], g_apTransports[i]->paOpts, g_apTransports[i]->cOpts * sizeof(RTGETOPTDEF));
+        cOptions += g_apTransports[i]->cOpts;
+    }
+
+    /*
+     * Parse the arguments.
+     */
+    RTGETOPTSTATE GetState;
+    int rc = RTGetOptInit(&GetState, argc, argv, paOptions, cOptions, 1, 0 /* fFlags */);
+    AssertRC(rc);
+
+    int ch;
+    RTGETOPTUNION Val;
+    while ((ch = RTGetOpt(&GetState, &Val)))
+    {
+        switch (ch)
+        {
+            case 'a':
+                fAutoUpgrade = true;
+                break;
+
+            case 'A':
+                fAutoUpgrade = false;
+                break;
+
+            case 'c':
+                rc = RTStrCopy(g_szCdRomPath, sizeof(g_szCdRomPath), Val.psz);
+                if (RT_FAILURE(rc))
+                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "CD/DVD-ROM is path too long (%Rrc)\n", rc);
+                break;
+
+            case 'd':
+                g_fDisplayOutput = true;
+                break;
+
+            case 'D':
+                g_fDisplayOutput = false;
+                break;
+
+            case 'f':
+                fDaemonize = false;
+                break;
+
+            case 'h':
+                txsUsage(g_pStdOut, argv[0]);
+                *pfExit = true;
+                return RTEXITCODE_SUCCESS;
+
+            case 's':
+                rc = RTStrCopy(g_szScratchPath, sizeof(g_szScratchPath), Val.psz);
+                if (RT_FAILURE(rc))
+                    return RTMsgErrorExit(RTEXITCODE_FAILURE, "scratch path is too long (%Rrc)\n", rc);
+                break;
+
+            case 't':
+            {
+                PCTXSTRANSPORT pTransport = NULL;
+                for (size_t i = 0; RT_ELEMENTS(g_apTransports); i++)
+                    if (!strcmp(g_apTransports[i]->szName, Val.psz))
+                    {
+                        pTransport = g_apTransports[i];
+                        break;
+                    }
+                if (!pTransport)
+                    return RTMsgErrorExit(RTEXITCODE_SYNTAX, "Unknown transport layer name '%s'\n", Val.psz);
+                g_pTransport = pTransport;
+                break;
+            }
+
+            case 'U':
+                pszUpgrading = Val.psz;
+                break;
+
+            case 'V':
+                RTPrintf("$Revision: 96152 $\n");
+                *pfExit = true;
+                return RTEXITCODE_SUCCESS;
+
+            case 'Z':
+                fDaemonized = true;
+                fDaemonize = false;
+                break;
+
+            default:
+            {
+                rc = VERR_TRY_AGAIN;
+                for (size_t i = 0; i < RT_ELEMENTS(g_apTransports); i++)
+                    if (g_apTransports[i]->cOpts)
+                    {
+                        rc = g_apTransports[i]->pfnOption(ch, &Val);
+                        if (RT_SUCCESS(rc))
+                            break;
+                        if (rc != VERR_TRY_AGAIN)
+                        {
+                            *pfExit = true;
+                            return RTEXITCODE_SYNTAX;
+                        }
+                    }
+                if (rc == VERR_TRY_AGAIN)
+                {
+                    *pfExit = true;
+                    return RTGetOptPrintError(ch, &Val);
+                }
+                break;
+            }
+        }
+    }
+
+    /*
+     * Handle automatic upgrading of the service.
+     */
+    if (fAutoUpgrade && !*pfExit)
+    {
+        RTEXITCODE rcExit;
+        if (pszUpgrading)
+            rcExit = txsAutoUpdateStage2(argc, argv, pfExit, pszUpgrading);
+        else
+            rcExit = txsAutoUpdateStage1(argc, argv, pfExit);
+        if (   *pfExit
+            || rcExit != RTEXITCODE_SUCCESS)
+            return rcExit;
+    }
+
+    /*
+     * Daemonize ourselves if asked to.
+     */
+    if (fDaemonize && !*pfExit)
+    {
+        rc = RTProcDaemonize(argv, "--daemonized");
+        if (RT_FAILURE(rc))
+            return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTProcDaemonize: %Rrc\n", rc);
+        *pfExit = true;
+    }
+
+    return RTEXITCODE_SUCCESS;
+}
+
+
+int main(int argc, char **argv)
+{
+    /*
+     * Initialize the runtime.
+     */
+    int rc = RTR3InitExe(argc, &argv, 0);
+    if (RT_FAILURE(rc))
+        return RTMsgInitFailure(rc);
+
+    /*
+     * Determine defaults and parse the arguments.
+     */
+    txsSetDefaults();
+    bool fExit;
+    RTEXITCODE rcExit = txsParseArgv(argc, argv, &fExit);
+    if (rcExit != RTEXITCODE_SUCCESS || fExit)
+        return rcExit;
+
+    /*
+     * Generate a UUID for this TXS instance.
+     */
+    rc = RTUuidCreate(&g_InstanceUuid);
+    if (RT_FAILURE(rc))
+        return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTUuidCreate failed: %Rrc", rc);
+
+    /*
+     * Finalize the scratch directory and initialize the transport layer.
+     */
+    rcExit = txsFinalizeScratch();
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
+    rc = g_pTransport->pfnInit();
+    if (RT_FAILURE(rc))
+        return RTEXITCODE_FAILURE;
+
+    /*
+     * Ok, start working
+     */
+    rcExit = txsMainLoop();
+
+    /*
+     * Cleanup.
+     */
+    g_pTransport->pfnTerm();
+
+    return rcExit;
+}
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/TestExecServiceInternal.h b/src/VBox/ValidationKit/utils/TestExecServ/TestExecServiceInternal.h
new file mode 100644
index 0000000..3f82a1c
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/TestExecServiceInternal.h
@@ -0,0 +1,219 @@
+/* $Id: TestExecServiceInternal.h $ */
+/** @file
+ * TestExecServ - Basic Remote Execution Service, Internal Header.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+#ifndef ___TestExecServiceInternal_h___
+#define ___TestExecServiceInternal_h___
+
+#include <iprt/getopt.h>
+#include <iprt/stream.h>
+
+RT_C_DECLS_BEGIN
+
+/**
+ * Packet header.
+ */
+typedef struct TXSPKTHDR
+{
+    /** The unpadded packet length. This include this header. */
+    uint32_t        cb;
+    /** The CRC-32 for the packet starting from the opcode field.  0 if the packet
+     *  hasn't been CRCed. */
+    uint32_t        uCrc32;
+    /** Packet opcode, an unterminated ASCII string.  */
+    uint8_t         achOpcode[8];
+} TXSPKTHDR;
+AssertCompileSize(TXSPKTHDR, 16);
+/** Pointer to a packet header. */
+typedef TXSPKTHDR *PTXSPKTHDR;
+/** Pointer to a packet header. */
+typedef TXSPKTHDR const *PCTXSPKTHDR;
+/** Pointer to a packet header pointer. */
+typedef PTXSPKTHDR *PPTXSPKTHDR;
+
+/** Packet alignment. */
+#define TXSPKT_ALIGNMENT            16
+/** Max packet size. */
+#define TXSPKT_MAX_SIZE             _256K
+
+
+/**
+ * Transport layer descriptor.
+ */
+typedef struct TXSTRANSPORT
+{
+    /** The name. */
+    char            szName[16];
+    /** The description. */
+    const char     *pszDesc;
+    /** Pointer to an array of options. */
+    PCRTGETOPTDEF   paOpts;
+    /** The number of options in the array. */
+    size_t          cOpts;
+
+    /**
+     * Print the usage information for this transport layer.
+     *
+     * @param   pThis               Pointer to the transport layer descriptor.
+     * @param   pStream             The stream to print the usage info to.
+     *
+     * @remarks This is only required if TXSTRANSPORT::cOpts is greater than 0.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnUsage,(PRTSTREAM pStream));
+
+    /**
+     * Handle an option.
+     *
+     * When encountering an options that is not part of the base options, we'll call
+     * this method for each transport layer until one handles it.
+     *
+     * @retval  VINF_SUCCESS if handled.
+     * @retval  VERR_TRY_AGAIN if not handled.
+     * @retval  VERR_INVALID_PARAMETER if we should exit with a non-zero status.
+     *
+     * @param   pThis               Pointer to the transport layer descriptor.
+     * @param   ch                  The short option value.
+     * @param   pVal                Pointer to the value union.
+     *
+     * @remarks This is only required if TXSTRANSPORT::cOpts is greater than 0.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnOption,(int ch, PCRTGETOPTUNION pVal));
+
+    /**
+     * Initializes the transport layer.
+     *
+     * @returns IPRT status code.  On errors, the transport layer shall call
+     *          RTMsgError to display the error details to the user.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnInit,(void));
+
+    /**
+     * Terminate the transport layer, closing and freeing resources.
+     *
+     * On errors, the transport layer shall call RTMsgError to display the error
+     * details to the user.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnTerm,(void));
+
+    /**
+     * Polls for incoming packets.
+     *
+     * @returns true if there are pending packets, false if there isn't.
+     */
+    DECLR3CALLBACKMEMBER(bool, pfnPollIn,(void));
+
+    /**
+     * Adds any pollable handles to the poll set.
+     *
+     * This is optional and layers that doesn't have anything that can be polled
+     * shall set this method pointer to NULL to indicate that pfnPollIn must be used
+     * instead.
+     *
+     * @returns IPRT status code.
+     * @param   hPollSet            The poll set to add them to.
+     * @param   idStart             The handle ID to start at.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnPollSetAdd,(RTPOLLSET hPollSet, uint32_t idStart));
+
+    /**
+     * Receives an incoming packet.
+     *
+     * This will block until the data becomes available or we're interrupted by a
+     * signal or something.
+     *
+     * @returns IPRT status code.  On error conditions other than VERR_INTERRUPTED,
+     *          the current operation will be aborted when applicable.  When
+     *          interrupted, the transport layer will store the data until the next
+     *          receive call.
+     *
+     * @param   ppPktHdr            Where to return the pointer to the packet we've
+     *                              read.  This is allocated from the heap using
+     *                              RTMemAlloc (w/ TXSPKT_ALIGNMENT) and must be
+     *                              free by calling RTMemFree.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnRecvPkt,(PPTXSPKTHDR ppPktHdr));
+
+    /**
+     * Sends an outgoing packet.
+     *
+     * This will block until the data has been written.
+     *
+     * @returns IPRT status code.
+     * @retval  VERR_INTERRUPTED if interrupted before anything was sent.
+     *
+     * @param   pPktHdr             The packet to send.  The size is given by
+     *                              aligning the size in the header by
+     *                              TXSPKT_ALIGNMENT.
+     */
+    DECLR3CALLBACKMEMBER(int, pfnSendPkt,(PCTXSPKTHDR pPktHdr));
+
+    /**
+     * Sends a babble packet and disconnects the client (if applicable).
+     *
+     * @param   pPktHdr             The packet to send.  The size is given by
+     *                              aligning the size in the header by
+     *                              TXSPKT_ALIGNMENT.
+     * @param   cMsSendTimeout      The send timeout measured in milliseconds.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnBabble,(PCTXSPKTHDR pPktHdr, RTMSINTERVAL cMsSendTimeout));
+
+    /**
+     * Notification about a client HOWDY.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnNotifyHowdy,(void));
+
+    /**
+     * Notification about a client BYE.
+     *
+     * For connection oriented transport layers, it would be good to disconnect the
+     * client at this point.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnNotifyBye,(void));
+
+    /**
+     * Notification about a REBOOT or SHUTDOWN.
+     *
+     * For connection oriented transport layers, stop listening for and
+     * accepting at this point.
+     */
+    DECLR3CALLBACKMEMBER(void, pfnNotifyReboot,(void));
+
+    /** Non-zero end marker. */
+    uint32_t u32EndMarker;
+} TXSTRANSPORT;
+/** Pointer to a const transport layer descriptor. */
+typedef const struct TXSTRANSPORT *PCTXSTRANSPORT;
+
+
+extern TXSTRANSPORT const g_TcpTransport;
+extern TXSTRANSPORT const g_SerialTransport;
+extern TXSTRANSPORT const g_FileSysTransport;
+extern TXSTRANSPORT const g_GuestPropTransport;
+extern TXSTRANSPORT const g_TestDevTransport;
+
+RT_C_DECLS_END
+
+#endif
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/TestExecServiceTcp.cpp b/src/VBox/ValidationKit/utils/TestExecServ/TestExecServiceTcp.cpp
new file mode 100644
index 0000000..c5ce993
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/TestExecServiceTcp.cpp
@@ -0,0 +1,830 @@
+/* $Id: TestExecServiceTcp.cpp $ */
+/** @file
+ * TestExecServ - Basic Remote Execution Service, TCP/IP Transport Layer.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define LOG_GROUP RTLOGGROUP_DEFAULT
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/critsect.h>
+#include <iprt/err.h>
+#include <iprt/log.h>
+#include <iprt/mem.h>
+#include <iprt/message.h>
+#include <iprt/poll.h>
+#include <iprt/string.h>
+#include <iprt/tcp.h>
+#include <iprt/thread.h>
+#include <iprt/time.h>
+
+#include "TestExecServiceInternal.h"
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** The default server port. */
+#define TXS_TCP_DEF_BIND_PORT                   5042
+/** The default client port. */
+#define TXS_TCP_DEF_CONNECT_PORT                5048
+
+/** The default server bind address. */
+#define TXS_TCP_DEF_BIND_ADDRESS                ""
+/** The default client connect address (i.e. of the host server). */
+#define TXS_TCP_DEF_CONNECT_ADDRESS             "10.0.2.2"
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** @name TCP Parameters
+ * @{ */
+static enum  { TXSTCPMODE_BOTH, TXSTCPMODE_CLIENT, TXSTCPMODE_SERVER }
+                            g_enmTcpMode            = TXSTCPMODE_BOTH;
+
+/** The addresses to bind to.  Empty string means any.  */
+static char                 g_szTcpBindAddr[256]    = TXS_TCP_DEF_BIND_ADDRESS;
+/** The TCP port to listen to. */
+static uint32_t             g_uTcpBindPort          = TXS_TCP_DEF_BIND_PORT;
+/** The addresses to connect to if fRevesedSetupMode is @c true. */
+static char                 g_szTcpConnectAddr[256] = TXS_TCP_DEF_CONNECT_ADDRESS;
+/** The TCP port to listen to. */
+static uint32_t             g_uTcpConnectPort       = TXS_TCP_DEF_CONNECT_PORT;
+/** @} */
+
+/** Critical section for serializing access to the next few variables. */
+static RTCRITSECT           g_TcpCritSect;
+/** Pointer to the TCP server instance. */
+static PRTTCPSERVER         g_pTcpServer            = NULL;
+/** Thread calling RTTcpServerListen2. */
+static RTTHREAD             g_hThreadTcpServer      = NIL_RTTHREAD;
+/** Thread calling RTTcpClientConnect. */
+static RTTHREAD             g_hThreadTcpConnect     = NIL_RTTHREAD;
+/** The main thread handle (for signalling). */
+static RTTHREAD             g_hThreadMain           = NIL_RTTHREAD;
+/** Stop connecting attempts when set. */
+static bool                 g_fTcpStopConnecting    = false;
+/** Connect cancel cookie. */
+static PRTTCPCLIENTCONNECTCANCEL volatile g_pTcpConnectCancelCookie = NULL;
+
+/** Socket of the current client. */
+static RTSOCKET             g_hTcpClient            = NIL_RTSOCKET;
+/** Indicates whether g_hTcpClient comes from the server or from a client
+ * connect (relevant when closing it). */
+static bool                 g_fTcpClientFromServer  = false;
+/** The size of the stashed data. */
+static size_t               g_cbTcpStashed          = 0;
+/** The size of the stashed data allocation. */
+static size_t               g_cbTcpStashedAlloced   = 0;
+/** The stashed data. */
+static uint8_t             *g_pbTcpStashed          = NULL;
+
+
+
+/**
+ * Disconnects the current client.
+ */
+static void txsTcpDisconnectClient(void)
+{
+    int rc;
+    if (g_fTcpClientFromServer)
+        rc = RTTcpServerDisconnectClient2(g_hTcpClient);
+    else
+        rc = RTTcpClientClose(g_hTcpClient);
+    AssertRCSuccess(rc);
+    g_hTcpClient = NIL_RTSOCKET;
+}
+
+/**
+ * Sets the current client socket in a safe manner.
+ *
+ * @returns NIL_RTSOCKET if consumed, other wise hTcpClient.
+ * @param   hTcpClient      The client socket.
+ * @param   fFromServer     Set if server type connection.
+ */
+static RTSOCKET txsTcpSetClient(RTSOCKET hTcpClient, bool fFromServer)
+{
+    RTCritSectEnter(&g_TcpCritSect);
+    if (   g_hTcpClient  == NIL_RTSOCKET
+        && !g_fTcpStopConnecting
+        && g_hThreadMain != NIL_RTTHREAD
+       )
+    {
+        g_fTcpClientFromServer = true;
+        g_hTcpClient = hTcpClient;
+        int rc = RTThreadUserSignal(g_hThreadMain); AssertRC(rc);
+        hTcpClient = NIL_RTSOCKET;
+    }
+    RTCritSectLeave(&g_TcpCritSect);
+    return hTcpClient;
+}
+
+/**
+ * Server mode connection thread.
+ *
+ * @returns iprt status code.
+ * @param   hSelf           Thread handle. Ignored.
+ * @param   pvUser          Ignored.
+ */
+static DECLCALLBACK(int) txsTcpServerConnectThread(RTTHREAD hSelf, void *pvUser)
+{
+    RTSOCKET hTcpClient;
+    int rc = RTTcpServerListen2(g_pTcpServer, &hTcpClient);
+    Log(("txsTcpConnectServerThread: RTTcpServerListen2 -> %Rrc\n", rc));
+    if (RT_SUCCESS(rc))
+    {
+        hTcpClient = txsTcpSetClient(hTcpClient, true /*fFromServer*/);
+        RTTcpServerDisconnectClient2(hTcpClient);
+    }
+
+    return rc;
+}
+
+/**
+ * Checks if it's a fatal RTTcpClientConnect return code.
+ *
+ * @returns true / false.
+ * @param   rc              The iprt status.
+ */
+static bool txsTcpIsFatalClientConnectStatus(int rc)
+{
+    return rc != VERR_NET_UNREACHABLE
+        && rc != VERR_NET_HOST_DOWN
+        && rc != VERR_NET_HOST_UNREACHABLE
+        && rc != VERR_NET_CONNECTION_REFUSED
+        && rc != VERR_TIMEOUT
+        && rc != VERR_NET_CONNECTION_TIMED_OUT;
+}
+
+/**
+ * Client mode connection thread.
+ *
+ * @returns iprt status code.
+ * @param   hSelf           Thread handle. Use to sleep on. The main thread will
+ *                          signal it to speed up thread shutdown.
+ * @param   pvUser          Ignored.
+ */
+static DECLCALLBACK(int) txsTcpClientConnectThread(RTTHREAD hSelf, void *pvUser)
+{
+    for (;;)
+    {
+        /* Stop? */
+        RTCritSectEnter(&g_TcpCritSect);
+        bool fStop = g_fTcpStopConnecting;
+        RTCritSectLeave(&g_TcpCritSect);
+        if (fStop)
+            return VINF_SUCCESS;
+
+        /* Try connect. */ /** @todo make cancelable! */
+        RTSOCKET hTcpClient;
+        Log2(("Calling RTTcpClientConnect(%s, %u,)...\n", g_szTcpConnectAddr, g_uTcpConnectPort));
+        int rc = RTTcpClientConnectEx(g_szTcpConnectAddr, g_uTcpConnectPort, &hTcpClient,
+                                      RT_SOCKETCONNECT_DEFAULT_WAIT, &g_pTcpConnectCancelCookie);
+        Log(("txsTcpRecvPkt: RTTcpClientConnect -> %Rrc\n", rc));
+        if (RT_SUCCESS(rc))
+        {
+            hTcpClient = txsTcpSetClient(hTcpClient, true /*fFromServer*/);
+            RTTcpClientCloseEx(hTcpClient, true /* fGracefulShutdown*/);
+            break;
+        }
+
+        if (txsTcpIsFatalClientConnectStatus(rc))
+            return rc;
+
+        /* Delay a wee bit before retrying. */
+        RTThreadUserWait(hSelf, 1536);
+    }
+    return VINF_SUCCESS;
+}
+
+/**
+ * Wait on the threads to complete.
+ *
+ * @returns Thread status (if collected), otherwise VINF_SUCCESS.
+ * @param   cMillies        The period to wait on each thread.
+ */
+static int txsTcpConnectWaitOnThreads(RTMSINTERVAL cMillies)
+{
+    int rcRet = VINF_SUCCESS;
+
+    if (g_hThreadTcpConnect != NIL_RTTHREAD)
+    {
+        int rcThread;
+        int rc2 = RTThreadWait(g_hThreadTcpConnect, cMillies, &rcThread);
+        if (RT_SUCCESS(rc2))
+        {
+            g_hThreadTcpConnect = NIL_RTTHREAD;
+            rcRet = rcThread;
+        }
+    }
+
+    if (g_hThreadTcpServer != NIL_RTTHREAD)
+    {
+        int rcThread;
+        int rc2 = RTThreadWait(g_hThreadTcpServer, cMillies, &rcThread);
+        if (RT_SUCCESS(rc2))
+        {
+            g_hThreadTcpServer = NIL_RTTHREAD;
+            if (RT_SUCCESS(rc2))
+                rcRet = rcThread;
+        }
+    }
+    return rcRet;
+}
+
+/**
+ * Connects to the peer.
+ *
+ * @returns VBox status code. Updates g_hTcpClient and g_fTcpClientFromServer on
+ *          success
+ */
+static int txsTcpConnect(void)
+{
+    int rc;
+    if (g_enmTcpMode == TXSTCPMODE_SERVER)
+    {
+        g_fTcpClientFromServer = true;
+        rc = RTTcpServerListen2(g_pTcpServer, &g_hTcpClient);
+        Log(("txsTcpRecvPkt: RTTcpServerListen2 -> %Rrc\n", rc));
+    }
+    else if (g_enmTcpMode == TXSTCPMODE_CLIENT)
+    {
+        g_fTcpClientFromServer = false;
+        for (;;)
+        {
+            Log2(("Calling RTTcpClientConnect(%s, %u,)...\n", g_szTcpConnectAddr, g_uTcpConnectPort));
+            rc = RTTcpClientConnect(g_szTcpConnectAddr, g_uTcpConnectPort, &g_hTcpClient);
+            Log(("txsTcpRecvPkt: RTTcpClientConnect -> %Rrc\n", rc));
+            if (RT_SUCCESS(rc) || txsTcpIsFatalClientConnectStatus(rc))
+                break;
+
+            /* Delay a wee bit before retrying. */
+            RTThreadSleep(1536);
+        }
+    }
+    else
+    {
+        Assert(g_enmTcpMode == TXSTCPMODE_BOTH);
+        RTTHREAD hSelf = RTThreadSelf();
+
+        /*
+         * Create client threads.
+         */
+        RTCritSectEnter(&g_TcpCritSect);
+        RTThreadUserReset(hSelf);
+        g_hThreadMain        = hSelf;
+        g_fTcpStopConnecting = false;
+        RTCritSectLeave(&g_TcpCritSect);
+
+        txsTcpConnectWaitOnThreads(32);
+
+        rc = VINF_SUCCESS;
+        if (g_hThreadTcpConnect == NIL_RTTHREAD)
+        {
+            g_pTcpConnectCancelCookie = NULL;
+            rc = RTThreadCreate(&g_hThreadTcpConnect, txsTcpClientConnectThread, NULL, 0, RTTHREADTYPE_DEFAULT,
+                                RTTHREADFLAGS_WAITABLE, "tcpconn");
+        }
+        if (g_hThreadTcpServer == NIL_RTTHREAD && RT_SUCCESS(rc))
+            rc = RTThreadCreate(&g_hThreadTcpServer, txsTcpServerConnectThread, NULL, 0, RTTHREADTYPE_DEFAULT,
+                                RTTHREADFLAGS_WAITABLE, "tcpserv");
+
+        RTCritSectEnter(&g_TcpCritSect);
+
+        /*
+         * Wait for connection to be established.
+         */
+        while (   RT_SUCCESS(rc)
+               && g_hTcpClient == NIL_RTSOCKET)
+        {
+            RTCritSectLeave(&g_TcpCritSect);
+            RTThreadUserWait(hSelf, 1536);
+            rc = txsTcpConnectWaitOnThreads(0);
+            RTCritSectEnter(&g_TcpCritSect);
+        }
+
+        /*
+         * Cancel the threads.
+         */
+        g_hThreadMain        = NIL_RTTHREAD;
+        g_fTcpStopConnecting = true;
+
+        RTCritSectLeave(&g_TcpCritSect);
+        RTTcpClientCancelConnect(&g_pTcpConnectCancelCookie);
+    }
+
+    AssertMsg(RT_SUCCESS(rc) ? g_hTcpClient != NIL_RTSOCKET : g_hTcpClient == NIL_RTSOCKET, ("%Rrc %p\n", rc, g_hTcpClient));
+    g_cbTcpStashed = 0;
+    return rc;
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,txsTcpNotifyReboot}
+ */
+static DECLCALLBACK(void) txsTcpNotifyReboot(void)
+{
+    Log(("txsTcpNotifyReboot: RTTcpServerDestroy(%p)\n", g_pTcpServer));
+    if (g_pTcpServer)
+    {
+        int rc = RTTcpServerDestroy(g_pTcpServer);
+        if (RT_FAILURE(rc))
+            RTMsgInfo("RTTcpServerDestroy failed in txsTcpNotifyReboot: %Rrc", rc);
+        g_pTcpServer = NULL;
+    }
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnNotifyBye}
+ */
+static DECLCALLBACK(void) txsTcpNotifyBye(void)
+{
+    Log(("txsTcpNotifyBye: txsTcpDisconnectClient %RTsock\n", g_hTcpClient));
+    txsTcpDisconnectClient();
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnNotifyHowdy}
+ */
+static DECLCALLBACK(void) txsTcpNotifyHowdy(void)
+{
+    /* nothing to do here */
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnBabble}
+ */
+static DECLCALLBACK(void) txsTcpBabble(PCTXSPKTHDR pPktHdr, RTMSINTERVAL cMsSendTimeout)
+{
+    /*
+     * Quietly ignore already disconnected client.
+     */
+    RTSOCKET hTcpClient = g_hTcpClient;
+    if (hTcpClient == NIL_RTSOCKET)
+        return;
+
+    /*
+     * Try send the babble reply.
+     */
+    NOREF(cMsSendTimeout); /** @todo implement the timeout here; non-blocking write + select-on-write. */
+    int     rc;
+    size_t  cbToSend = RT_ALIGN_Z(pPktHdr->cb, TXSPKT_ALIGNMENT);
+    do  rc = RTTcpWrite(hTcpClient, pPktHdr, cbToSend);
+    while (rc == VERR_INTERRUPTED);
+
+    /*
+     * Disconnect the client.
+     */
+    Log(("txsTcpBabble: txsTcpDisconnectClient(%RTsock) (RTTcpWrite rc=%Rrc)\n", g_hTcpClient, rc));
+    txsTcpDisconnectClient();
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnSendPkt}
+ */
+static DECLCALLBACK(int) txsTcpSendPkt(PCTXSPKTHDR pPktHdr)
+{
+    Assert(pPktHdr->cb >= sizeof(TXSPKTHDR));
+
+    /*
+     * Fail if no client connection.
+     */
+    RTSOCKET hTcpClient = g_hTcpClient;
+    if (hTcpClient == NIL_RTSOCKET)
+        return VERR_NET_NOT_CONNECTED;
+
+    /*
+     * Write it.
+     */
+    size_t cbToSend = RT_ALIGN_Z(pPktHdr->cb, TXSPKT_ALIGNMENT);
+    int rc = RTTcpWrite(hTcpClient, pPktHdr, cbToSend);
+    if (    RT_FAILURE(rc)
+        &&  rc != VERR_INTERRUPTED)
+    {
+        /* assume fatal connection error. */
+        Log(("RTTcpWrite -> %Rrc -> txsTcpDisconnectClient(%RTsock)\n", rc, g_hTcpClient));
+        txsTcpDisconnectClient();
+    }
+
+    return rc;
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnRecvPkt}
+ */
+static DECLCALLBACK(int) txsTcpRecvPkt(PPTXSPKTHDR ppPktHdr)
+{
+    int rc = VINF_SUCCESS;
+    *ppPktHdr = NULL;
+
+    /*
+     * Do we have to wait for a client to connect?
+     */
+    RTSOCKET hTcpClient = g_hTcpClient;
+    if (hTcpClient == NIL_RTSOCKET)
+    {
+        rc = txsTcpConnect();
+        if (RT_FAILURE(rc))
+            return rc;
+        hTcpClient = g_hTcpClient; Assert(hTcpClient != NIL_RTSOCKET);
+    }
+
+    /*
+     * Read state.
+     */
+    size_t      offData       = 0;
+    size_t      cbData        = 0;
+    size_t      cbDataAlloced;
+    uint8_t    *pbData        = NULL;
+
+    /*
+     * Any stashed data?
+     */
+    if (g_cbTcpStashedAlloced)
+    {
+        offData               = g_cbTcpStashed;
+        cbDataAlloced         = g_cbTcpStashedAlloced;
+        pbData                = g_pbTcpStashed;
+
+        g_cbTcpStashed        = 0;
+        g_cbTcpStashedAlloced = 0;
+        g_pbTcpStashed        = NULL;
+    }
+    else
+    {
+        cbDataAlloced = RT_ALIGN_Z(64,  TXSPKT_ALIGNMENT);
+        pbData = (uint8_t *)RTMemAlloc(cbDataAlloced);
+        if (!pbData)
+            return VERR_NO_MEMORY;
+    }
+
+    /*
+     * Read and valid the length.
+     */
+    while (offData < sizeof(uint32_t))
+    {
+        size_t cbRead;
+        rc = RTTcpRead(hTcpClient, pbData + offData, sizeof(uint32_t) - offData, &cbRead);
+        if (RT_FAILURE(rc))
+            break;
+        if (cbRead == 0)
+        {
+            Log(("txsTcpRecvPkt: RTTcpRead -> %Rrc / cbRead=0 -> VERR_NET_NOT_CONNECTED (#1)\n", rc));
+            rc = VERR_NET_NOT_CONNECTED;
+            break;
+        }
+        offData += cbRead;
+    }
+    if (RT_SUCCESS(rc))
+    {
+        ASMCompilerBarrier(); /* paranoia^3 */
+        cbData = *(uint32_t volatile *)pbData;
+        if (cbData >= sizeof(TXSPKTHDR) && cbData <= TXSPKT_MAX_SIZE)
+        {
+            /*
+             * Align the length and reallocate the return packet it necessary.
+             */
+            cbData = RT_ALIGN_Z(cbData, TXSPKT_ALIGNMENT);
+            if (cbData > cbDataAlloced)
+            {
+                void *pvNew = RTMemRealloc(pbData, cbData);
+                if (pvNew)
+                {
+                    pbData = (uint8_t *)pvNew;
+                    cbDataAlloced = cbData;
+                }
+                else
+                    rc = VERR_NO_MEMORY;
+            }
+            if (RT_SUCCESS(rc))
+            {
+                /*
+                 * Read the remainder of the data.
+                 */
+                while (offData < cbData)
+                {
+                    size_t cbRead;
+                    rc = RTTcpRead(hTcpClient, pbData + offData, cbData - offData, &cbRead);
+                    if (RT_FAILURE(rc))
+                        break;
+                    if (cbRead == 0)
+                    {
+                        Log(("txsTcpRecvPkt: RTTcpRead -> %Rrc / cbRead=0 -> VERR_NET_NOT_CONNECTED (#2)\n", rc));
+                        rc = VERR_NET_NOT_CONNECTED;
+                        break;
+                    }
+                    offData += cbRead;
+                }
+            }
+        }
+        else
+            rc = VERR_NET_PROTOCOL_ERROR;
+    }
+    if (RT_SUCCESS(rc))
+        *ppPktHdr = (PTXSPKTHDR)pbData;
+    else
+    {
+        /*
+         * Deal with errors.
+         */
+        if (rc == VERR_INTERRUPTED)
+        {
+            /* stash it away for the next call. */
+            g_cbTcpStashed        = cbData;
+            g_cbTcpStashedAlloced = cbDataAlloced;
+            g_pbTcpStashed        = pbData;
+        }
+        else
+        {
+            RTMemFree(pbData);
+
+            /* assume fatal connection error. */
+            Log(("txsTcpRecvPkt: RTTcpRead -> %Rrc -> txsTcpDisconnectClient(%RTsock)\n", rc, g_hTcpClient));
+            txsTcpDisconnectClient();
+        }
+    }
+
+    return rc;
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnPollSetAdd}
+ */
+static DECLCALLBACK(int) txsTcpPollSetAdd(RTPOLLSET hPollSet, uint32_t idStart)
+{
+    return RTPollSetAddSocket(hPollSet, g_hTcpClient, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR, idStart);
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnPollIn}
+ */
+static DECLCALLBACK(bool) txsTcpPollIn(void)
+{
+    RTSOCKET hTcpClient = g_hTcpClient;
+    if (hTcpClient == NIL_RTSOCKET)
+        return false;
+    int rc = RTTcpSelectOne(hTcpClient, 0/*cMillies*/);
+    return RT_SUCCESS(rc);
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnTerm}
+ */
+static DECLCALLBACK(void) txsTcpTerm(void)
+{
+    /* Signal thread */
+    if (RTCritSectIsInitialized(&g_TcpCritSect))
+    {
+        RTCritSectEnter(&g_TcpCritSect);
+        g_fTcpStopConnecting = true;
+        RTCritSectLeave(&g_TcpCritSect);
+    }
+
+    if (g_hThreadTcpConnect != NIL_RTTHREAD)
+    {
+        RTThreadUserSignal(g_hThreadTcpConnect);
+        RTTcpClientCancelConnect(&g_pTcpConnectCancelCookie);
+    }
+
+    /* Shut down the server (will wake up thread). */
+    if (g_pTcpServer)
+    {
+        Log(("txsTcpTerm: Destroying server...\n"));
+        int rc = RTTcpServerDestroy(g_pTcpServer);
+        if (RT_FAILURE(rc))
+            RTMsgInfo("RTTcpServerDestroy failed in txsTcpTerm: %Rrc", rc);
+        g_pTcpServer        = NULL;
+    }
+
+    /* Shut down client */
+    if (g_hTcpClient != NIL_RTSOCKET)
+    {
+        if (g_fTcpClientFromServer)
+        {
+            Log(("txsTcpTerm: Disconnecting client...\n"));
+            int rc = RTTcpServerDisconnectClient2(g_hTcpClient);
+            if (RT_FAILURE(rc))
+                RTMsgInfo("RTTcpServerDisconnectClient2(%RTsock) failed in txsTcpTerm: %Rrc", g_hTcpClient, rc);
+        }
+        else
+        {
+            int rc = RTTcpClientClose(g_hTcpClient);
+            if (RT_FAILURE(rc))
+                RTMsgInfo("RTTcpClientClose(%RTsock) failed in txsTcpTerm: %Rrc", g_hTcpClient, rc);
+        }
+        g_hTcpClient        = NIL_RTSOCKET;
+    }
+
+    /* Clean up stashing. */
+    RTMemFree(g_pbTcpStashed);
+    g_pbTcpStashed          = NULL;
+    g_cbTcpStashed          = 0;
+    g_cbTcpStashedAlloced   = 0;
+
+    /* Wait for the thread (they should've had some time to quit by now). */
+    txsTcpConnectWaitOnThreads(15000);
+
+    /* Finally, clean up the critical section. */
+    if (RTCritSectIsInitialized(&g_TcpCritSect))
+        RTCritSectDelete(&g_TcpCritSect);
+
+    Log(("txsTcpTerm: done\n"));
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnInit}
+ */
+static DECLCALLBACK(int) txsTcpInit(void)
+{
+    int rc = RTCritSectInit(&g_TcpCritSect);
+    if (RT_SUCCESS(rc) && g_enmTcpMode != TXSTCPMODE_CLIENT)
+    {
+        rc = RTTcpServerCreateEx(g_szTcpBindAddr[0] ? g_szTcpBindAddr : NULL, g_uTcpBindPort, &g_pTcpServer);
+        if (RT_FAILURE(rc))
+        {
+            if (rc == VERR_NET_DOWN)
+            {
+                RTMsgInfo("RTTcpServerCreateEx(%s, %u,) failed: %Rrc, retrying for 20 seconds...\n",
+                          g_szTcpBindAddr[0] ? g_szTcpBindAddr : NULL, g_uTcpBindPort, rc);
+                uint64_t StartMs = RTTimeMilliTS();
+                do
+                {
+                    RTThreadSleep(1000);
+                    rc = RTTcpServerCreateEx(g_szTcpBindAddr[0] ? g_szTcpBindAddr : NULL, g_uTcpBindPort, &g_pTcpServer);
+                } while (   rc == VERR_NET_DOWN
+                         && RTTimeMilliTS() - StartMs < 20000);
+                if (RT_SUCCESS(rc))
+                    RTMsgInfo("RTTcpServerCreateEx succceeded.\n");
+            }
+            if (RT_FAILURE(rc))
+            {
+                g_pTcpServer = NULL;
+                RTCritSectDelete(&g_TcpCritSect);
+                RTMsgError("RTTcpServerCreateEx(%s, %u,) failed: %Rrc\n",
+                           g_szTcpBindAddr[0] ? g_szTcpBindAddr : NULL, g_uTcpBindPort, rc);
+            }
+        }
+    }
+
+    return rc;
+}
+
+/** Options  */
+enum TXSTCPOPT
+{
+    TXSTCPOPT_MODE = 1000,
+    TXSTCPOPT_BIND_ADDRESS,
+    TXSTCPOPT_BIND_PORT,
+    TXSTCPOPT_CONNECT_ADDRESS,
+    TXSTCPOPT_CONNECT_PORT,
+
+    /* legacy: */
+    TXSTCPOPT_LEGACY_PORT,
+    TXSTCPOPT_LEGACY_CONNECT
+};
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnOption}
+ */
+static DECLCALLBACK(int) txsTcpOption(int ch, PCRTGETOPTUNION pVal)
+{
+    int rc;
+
+    switch (ch)
+    {
+        case TXSTCPOPT_MODE:
+            if (!strcmp(pVal->psz, "both"))
+                g_enmTcpMode = TXSTCPMODE_BOTH;
+            else if (!strcmp(pVal->psz, "client"))
+                 g_enmTcpMode = TXSTCPMODE_CLIENT;
+            else if (!strcmp(pVal->psz, "server"))
+                 g_enmTcpMode = TXSTCPMODE_SERVER;
+            else
+                return RTMsgErrorRc(VERR_INVALID_PARAMETER, "Invalid TCP mode: '%s'\n", pVal->psz);
+            break;
+
+        case TXSTCPOPT_BIND_ADDRESS:
+            rc = RTStrCopy(g_szTcpBindAddr, sizeof(g_szTcpBindAddr), pVal->psz);
+            if (RT_FAILURE(rc))
+                return RTMsgErrorRc(VERR_INVALID_PARAMETER, "TCP bind address is too long (%Rrc)", rc);
+            return VINF_SUCCESS;
+
+        case TXSTCPOPT_BIND_PORT:
+            g_uTcpBindPort = pVal->u16 == 0 ? TXS_TCP_DEF_BIND_PORT : pVal->u16;
+            break;
+
+        case TXSTCPOPT_LEGACY_CONNECT:
+            g_enmTcpMode = TXSTCPMODE_CLIENT;
+            /* fall thru */
+        case TXSTCPOPT_CONNECT_ADDRESS:
+            rc = RTStrCopy(g_szTcpConnectAddr, sizeof(g_szTcpConnectAddr), pVal->psz);
+            if (RT_FAILURE(rc))
+                return RTMsgErrorRc(VERR_INVALID_PARAMETER, "TCP connect address is too long (%Rrc)", rc);
+            if (!g_szTcpConnectAddr[0])
+                strcpy(g_szTcpConnectAddr, TXS_TCP_DEF_CONNECT_ADDRESS);
+            return VINF_SUCCESS;
+
+        case TXSTCPOPT_CONNECT_PORT:
+            g_uTcpConnectPort = pVal->u16 == 0 ? TXS_TCP_DEF_CONNECT_PORT : pVal->u16;
+            break;
+
+        case TXSTCPOPT_LEGACY_PORT:
+            if (pVal->u16 == 0)
+            {
+                g_uTcpBindPort      = TXS_TCP_DEF_BIND_PORT;
+                g_uTcpConnectPort   = TXS_TCP_DEF_CONNECT_PORT;
+            }
+            else
+            {
+                g_uTcpBindPort      = pVal->u16;
+                g_uTcpConnectPort   = pVal->u16;
+            }
+            return VINF_SUCCESS;
+    }
+    return VERR_TRY_AGAIN;
+}
+
+/**
+ * @interface_method_impl{TXSTRANSPORT,pfnUsage}
+ */
+DECLCALLBACK(void) txsTcpUsage(PRTSTREAM pStream)
+{
+    RTStrmPrintf(pStream,
+                 "  --tcp-mode <both|client|server>\n"
+                 "       Selects the mode of operation.\n"
+                 "       Default: both\n"
+                 "  --tcp-bind-address <address>\n"
+                 "       The address(es) to listen to TCP connection on.  Empty string\n"
+                 "       means any address, this is the default.\n"
+                 "  --tcp-bind-port <port>\n"
+                 "       The port to listen to TCP connections on.\n"
+                 "       Default: %u\n"
+                 "  --tcp-connect-address <address>\n"
+                 "       The address of the server to try connect to in client mode.\n"
+                 "       Default: " TXS_TCP_DEF_CONNECT_ADDRESS "\n"
+                 "  --tcp-connect-port <port>\n"
+                 "       The port on the server to connect to in client mode.\n"
+                 "       Default: %u\n"
+                 , TXS_TCP_DEF_BIND_PORT, TXS_TCP_DEF_CONNECT_PORT);
+}
+
+/** Command line options for the TCP/IP transport layer. */
+static const RTGETOPTDEF  g_TcpOpts[] =
+{
+    { "--tcp-mode",             TXSTCPOPT_MODE,             RTGETOPT_REQ_STRING },
+    { "--tcp-bind-address",     TXSTCPOPT_BIND_ADDRESS,     RTGETOPT_REQ_STRING },
+    { "--tcp-bind-port",        TXSTCPOPT_BIND_PORT,        RTGETOPT_REQ_UINT16 },
+    { "--tcp-connect-address",  TXSTCPOPT_CONNECT_ADDRESS,  RTGETOPT_REQ_STRING },
+    { "--tcp-connect-port",     TXSTCPOPT_CONNECT_PORT,     RTGETOPT_REQ_UINT16 },
+
+    /* legacy */
+    { "--tcp-port",             TXSTCPOPT_LEGACY_PORT,      RTGETOPT_REQ_UINT16 },
+    { "--tcp-connect",          TXSTCPOPT_LEGACY_CONNECT,   RTGETOPT_REQ_STRING },
+};
+
+/** TCP/IP transport layer. */
+const TXSTRANSPORT g_TcpTransport =
+{
+    /* .szName          = */ "tcp",
+    /* .pszDesc         = */ "TCP/IP",
+    /* .cOpts           = */ &g_TcpOpts[0],
+    /* .paOpts          = */ RT_ELEMENTS(g_TcpOpts),
+    /* .pfnUsage        = */ txsTcpUsage,
+    /* .pfnOption       = */ txsTcpOption,
+    /* .pfnInit         = */ txsTcpInit,
+    /* .pfnTerm         = */ txsTcpTerm,
+    /* .pfnPollIn       = */ txsTcpPollIn,
+    /* .pfnPollSetAdd   = */ txsTcpPollSetAdd,
+    /* .pfnRecvPkt      = */ txsTcpRecvPkt,
+    /* .pfnSendPkt      = */ txsTcpSendPkt,
+    /* .pfnBabble       = */ txsTcpBabble,
+    /* .pfnNotifyHowdy  = */ txsTcpNotifyHowdy,
+    /* .pfnNotifyBye    = */ txsTcpNotifyBye,
+    /* .pfnNotifyReboot = */ txsTcpNotifyReboot,
+    /* .u32EndMarker    = */ UINT32_C(0x12345678)
+};
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/linux/vboxtxs-nat.sh b/src/VBox/ValidationKit/utils/TestExecServ/linux/vboxtxs-nat.sh
new file mode 100755
index 0000000..994b982
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/linux/vboxtxs-nat.sh
@@ -0,0 +1,341 @@
+#!/bin/sh
+## @file
+# VirtualBox Test Execution Service Init Script for NATted setups.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+# chkconfig: 35 35 65
+# description: VirtualBox Test Execution Service
+#
+### BEGIN INIT INFO
+# Provides:       vboxtxs
+# Required-Start: $network
+# Required-Stop:
+# Default-Start:  2 3 4 5
+# Default-Stop:   0 1 6
+# Description:    VirtualBox Test Execution Service
+### END INIT INFO
+
+PATH=$PATH:/bin:/sbin:/usr/sbin
+
+CDROM_PATH=/media/cdrom
+SCRATCH_PATH=/tmp/vboxtxs-scratch
+
+system=unknown
+if [ -f /etc/redhat-release ]; then
+    system=redhat
+    PIDFILE="/var/lock/subsys/vboxtxs"
+elif [ -f /etc/SuSE-release ]; then
+    system=suse
+    PIDFILE="/var/lock/subsys/vboxtxs"
+elif [ -f /etc/debian_version ]; then
+    system=debian
+    PIDFILE="/var/run/vboxtxs"
+elif [ -f /etc/gentoo-release ]; then
+    system=gentoo
+    PIDFILE="/var/run/vboxtxs"
+elif [ -f /etc/arch-release ]; then
+     system=arch
+     PIDFILE="/var/run/vboxtxs"
+elif [ -f /etc/slackware-version ]; then
+    system=slackware
+    PIDFILE="/var/run/vboxtxs"
+elif [ -f /etc/lfs-release ]; then
+    system=lfs
+    PIDFILE="/var/run/vboxtxs.pid"
+else
+    system=other
+    if [ -d /var/run -a -w /var/run ]; then
+        PIDFILE="/var/run/vboxtxs"
+    fi
+fi
+
+if [ "$system" = "redhat" ]; then
+    . /etc/init.d/functions
+    fail_msg() {
+        echo_failure
+        echo
+    }
+
+    succ_msg() {
+        echo_success
+        echo
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "suse" ]; then
+    . /etc/rc.status
+    daemon() {
+        startproc ${1+"$@"}
+    }
+
+    fail_msg() {
+        rc_failed 1
+        rc_status -v
+    }
+
+    succ_msg() {
+        rc_reset
+        rc_status -v
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "debian" ]; then
+    daemon() {
+        start-stop-daemon --start --exec $1 -- $2
+    }
+
+    killproc() {
+        start-stop-daemon --stop --exec $@
+    }
+
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "gentoo" ]; then
+    if [ -f /sbin/functions.sh ]; then
+        . /sbin/functions.sh
+    elif [ -f /etc/init.d/functions.sh ]; then
+        . /etc/init.d/functions.sh
+    fi
+    daemon() {
+        start-stop-daemon --start --exec $1 -- $2
+    }
+
+    killproc() {
+        start-stop-daemon --stop --exec $@
+    }
+
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+
+    if [ "`which $0`" = "/sbin/rc" ]; then
+        shift
+    fi
+fi
+
+if [ "$system" = "arch" ]; then
+    USECOLOR=yes
+    . /etc/rc.d/functions
+    daemon() {
+        $@
+        test $? -eq 0 && add_daemon rc.`basename $1`
+    }
+
+    killproc() {
+        killall $@
+        rm_daemon `basename $@`
+    }
+
+    fail_msg() {
+        stat_fail
+    }
+
+    succ_msg() {
+        stat_done
+    }
+
+    begin() {
+        stat_busy "$1"
+    }
+
+fi
+
+if [ "$system" = "slackware" ]; then
+    daemon() {
+        $1 $2
+    }
+
+    killproc() {
+        killall $1
+        rm -f $PIDFILE
+    }
+
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+
+fi
+
+if [ "$system" = "lfs" ]; then
+    . /etc/rc.d/init.d/functions
+    daemon() {
+        loadproc $1 $2
+    }
+
+    fail_msg() {
+        echo_failure
+    }
+
+    succ_msg() {
+        echo_ok
+    }
+
+    begin() {
+        echo $1
+    }
+
+    status() {
+        statusproc $1
+    }
+fi
+
+if [ "$system" = "other" ]; then
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+case "`uname -m`" in
+    AMD64|amd64|X86_64|x86_64)
+        binary=/root/validationkit/linux/amd64/TestExecService
+        ;;
+
+    i386|x86|i486|i586|i686|i787)
+        binary=/root/validationkit/linux/x86/TestExecService
+        ;;
+
+    *)
+        binary=/root/validationkit/linux/x86/TestExecService
+        ;;
+esac
+
+fixAndTestBinary() {
+    chmod a+x "$binary" 2> /dev/null > /dev/null
+    test -x "$binary" || {
+        echo "Cannot run $binary"
+        exit 1
+    }
+}
+
+start() {
+    if ! test -f $PIDFILE; then
+        begin "Starting VirtualBox Test Execution Service ";
+        fixAndTestBinary
+        mount /dev/cdrom "${CDROM_PATH}" 2> /dev/null > /dev/null
+        daemon $binary --auto-upgrade --scratch="${SCRATCH_PATH}" --cdrom="${CDROM_PATH}" \
+            --no-display-output --tcp-connect 10.0.2.2 > /dev/null
+        RETVAL=$?
+        test $RETVAL -eq 0 && sleep 2 && echo `pidof TestExecService` > $PIDFILE
+        if ! test -s "${PIDFILE}"; then
+            RETVAL=5
+        fi
+        if test $RETVAL -eq 0; then
+            succ_msg
+        else
+            fail_msg
+        fi
+    fi
+    return $RETVAL
+}
+
+stop() {
+    if test -f $PIDFILE; then
+        begin "Stopping VirtualBox Test Execution Service ";
+        killproc $binary
+        RETVAL=$?
+        test $RETVAL -eq 0 && rm -f $PIDFILE
+        succ_msg
+    fi
+    return $RETVAL
+}
+
+restart() {
+    stop && start
+}
+
+status() {
+    echo -n "Checking for vboxtxs"
+    if [ -f $PIDFILE ]; then
+        echo " ...running"
+    else
+        echo " ...not running"
+    fi
+}
+
+case "$1" in
+start)
+    start
+    ;;
+stop)
+    stop
+    ;;
+restart)
+    restart
+    ;;
+status)
+    status
+    ;;
+setup)
+    ;;
+cleanup)
+    ;;
+*)
+    echo "Usage: $0 {start|stop|restart|status}"
+    exit 1
+esac
+
+exit $RETVAL
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/linux/vboxtxs.sh b/src/VBox/ValidationKit/utils/TestExecServ/linux/vboxtxs.sh
new file mode 100755
index 0000000..5ba232d
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/linux/vboxtxs.sh
@@ -0,0 +1,340 @@
+#!/bin/sh
+## @file
+# VirtualBox Test Execution Service Init Script.
+#
+
+#
+# Copyright (C) 2006-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+# chkconfig: 35 35 65
+# description: VirtualBox Test Execution Service
+#
+### BEGIN INIT INFO
+# Provides:       vboxtxs
+# Required-Start: $network
+# Required-Stop:
+# Default-Start:  2 3 4 5
+# Default-Stop:   0 1 6
+# Description:    VirtualBox Test Execution Service
+### END INIT INFO
+
+PATH=$PATH:/bin:/sbin:/usr/sbin
+
+CDROM_PATH=/media/cdrom
+SCRATCH_PATH=/tmp/vboxtxs-scratch
+
+system=unknown
+if [ -f /etc/redhat-release ]; then
+    system=redhat
+    PIDFILE="/var/lock/subsys/vboxtxs"
+elif [ -f /etc/SuSE-release ]; then
+    system=suse
+    PIDFILE="/var/lock/subsys/vboxtxs"
+elif [ -f /etc/debian_version ]; then
+    system=debian
+    PIDFILE="/var/run/vboxtxs"
+elif [ -f /etc/gentoo-release ]; then
+    system=gentoo
+    PIDFILE="/var/run/vboxtxs"
+elif [ -f /etc/arch-release ]; then
+     system=arch
+     PIDFILE="/var/run/vboxtxs"
+elif [ -f /etc/slackware-version ]; then
+    system=slackware
+    PIDFILE="/var/run/vboxtxs"
+elif [ -f /etc/lfs-release ]; then
+    system=lfs
+    PIDFILE="/var/run/vboxtxs.pid"
+else
+    system=other
+    if [ -d /var/run -a -w /var/run ]; then
+        PIDFILE="/var/run/vboxtxs"
+    fi
+fi
+
+if [ "$system" = "redhat" ]; then
+    . /etc/init.d/functions
+    fail_msg() {
+        echo_failure
+        echo
+    }
+
+    succ_msg() {
+        echo_success
+        echo
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "suse" ]; then
+    . /etc/rc.status
+    daemon() {
+        startproc ${1+"$@"}
+    }
+
+    fail_msg() {
+        rc_failed 1
+        rc_status -v
+    }
+
+    succ_msg() {
+        rc_reset
+        rc_status -v
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "debian" ]; then
+    daemon() {
+        start-stop-daemon --start --exec $1 -- $2
+    }
+
+    killproc() {
+        start-stop-daemon --stop --exec $@
+    }
+
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+if [ "$system" = "gentoo" ]; then
+    if [ -f /sbin/functions.sh ]; then
+        . /sbin/functions.sh
+    elif [ -f /etc/init.d/functions.sh ]; then
+        . /etc/init.d/functions.sh
+    fi
+    daemon() {
+        start-stop-daemon --start --exec $1 -- $2
+    }
+
+    killproc() {
+        start-stop-daemon --stop --exec $@
+    }
+
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+
+    if [ "`which $0`" = "/sbin/rc" ]; then
+        shift
+    fi
+fi
+
+if [ "$system" = "arch" ]; then
+    USECOLOR=yes
+    . /etc/rc.d/functions
+    daemon() {
+        $@
+        test $? -eq 0 && add_daemon rc.`basename $1`
+    }
+
+    killproc() {
+        killall $@
+        rm_daemon `basename $@`
+    }
+
+    fail_msg() {
+        stat_fail
+    }
+
+    succ_msg() {
+        stat_done
+    }
+
+    begin() {
+        stat_busy "$1"
+    }
+
+fi
+
+if [ "$system" = "slackware" ]; then
+    daemon() {
+        $1 $2
+    }
+
+    killproc() {
+        killall $1
+        rm -f $PIDFILE
+    }
+
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+
+fi
+
+if [ "$system" = "lfs" ]; then
+    . /etc/rc.d/init.d/functions
+    daemon() {
+        loadproc $1 $2
+    }
+
+    fail_msg() {
+        echo_failure
+    }
+
+    succ_msg() {
+        echo_ok
+    }
+
+    begin() {
+        echo $1
+    }
+
+    status() {
+        statusproc $1
+    }
+fi
+
+if [ "$system" = "other" ]; then
+    fail_msg() {
+        echo " ...fail!"
+    }
+
+    succ_msg() {
+        echo " ...done."
+    }
+
+    begin() {
+        echo -n "$1"
+    }
+fi
+
+case "`uname -m`" in
+    AMD64|amd64|X86_64|x86_64)
+        binary=/root/validationkit/linux/amd64/TestExecService
+        ;;
+
+    i386|x86|i486|i586|i686|i787)
+        binary=/root/validationkit/linux/x86/TestExecService
+        ;;
+
+    *)
+        binary=/root/validationkit/linux/x86/TestExecService
+        ;;
+esac
+
+fixAndTestBinary() {
+    chmod a+x "$binary" 2> /dev/null > /dev/null
+    test -x "$binary" || {
+        echo "Cannot run $binary"
+        exit 1
+    }
+}
+
+start() {
+    if ! test -f $PIDFILE; then
+        begin "Starting VirtualBox Test Execution Service ";
+        fixAndTestBinary
+        mount /dev/cdrom "${CDROM_PATH}" 2> /dev/null > /dev/null
+        daemon $binary --auto-upgrade --scratch="${SCRATCH_PATH}" --cdrom="${CDROM_PATH}" --no-display-output > /dev/null
+        RETVAL=$?
+        test $RETVAL -eq 0 && sleep 2 && echo `pidof TestExecService` > $PIDFILE
+        if ! test -s "${PIDFILE}"; then
+            RETVAL=5
+        fi
+        if test $RETVAL -eq 0; then
+            succ_msg
+        else
+            fail_msg
+        fi
+    fi
+    return $RETVAL
+}
+
+stop() {
+    if test -f $PIDFILE; then
+        begin "Stopping VirtualBox Test Execution Service ";
+        killproc $binary
+        RETVAL=$?
+        test $RETVAL -eq 0 && rm -f $PIDFILE
+        succ_msg
+    fi
+    return $RETVAL
+}
+
+restart() {
+    stop && start
+}
+
+status() {
+    echo -n "Checking for vboxtxs"
+    if [ -f $PIDFILE ]; then
+        echo " ...running"
+    else
+        echo " ...not running"
+    fi
+}
+
+case "$1" in
+start)
+    start
+    ;;
+stop)
+    stop
+    ;;
+restart)
+    restart
+    ;;
+status)
+    status
+    ;;
+setup)
+    ;;
+cleanup)
+    ;;
+*)
+    echo "Usage: $0 {start|stop|restart|status}"
+    exit 1
+esac
+
+exit $RETVAL
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs-sol10.xml b/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs-sol10.xml
new file mode 100644
index 0000000..2ff0b14
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs-sol10.xml
@@ -0,0 +1,73 @@
+<?xml version='1.0'?>
+<!--
+ Solaris SMF service manifest for the VirtualBox Test eXecution Service.
+ $Id: vboxtxs-sol10.xml $
+
+    Copyright (C) 2010-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+    The contents of this file may alternatively be used under the terms
+    of the Common Development and Distribution License Version 1.0
+    (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+    VirtualBox OSE distribution, in which case the provisions of the
+    CDDL are applicable instead of those of the GPL.
+
+    You may elect to license modified versions of this file under the
+    terms and conditions of either the GPL or the CDDL or both.
+-->
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+
+<service_bundle type='manifest' name='export'>
+<service name='system/virtualbox/vboxtxs' type='service' version='1'>
+
+    <create_default_instance enabled='false' />
+    <single_instance/>
+
+    <!-- Wait for the network to start up -->
+    <dependency name='milestone-network' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/milestone/network:default' />
+    </dependency>
+
+    <!-- Wait for devices to be initialized as we depend on vboxguest (PCI) -->
+    <dependency name='milestone-devices' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/milestone/devices:default' />
+    </dependency>
+
+    <!-- We wish to be started as late as possible... so go crazy with deps. -->
+    <dependency name='multi-user' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/milestone/multi-user:default' />
+    </dependency>
+    <dependency name='multi-user-server' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/milestone/multi-user-server:default' />
+    </dependency>
+    <dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/system/filesystem/local:default' />
+    </dependency>
+    <dependency name='filesystem-autofs' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/system/filesystem/autofs:default' />
+    </dependency>
+    <dependency name='filesystem-volfs' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/system/filesystem/volfs:default' />
+    </dependency>
+
+    <!-- start + stop methods -->
+    <exec_method type='method' name='start' exec='/opt/VBoxTest/testsuite/solaris/vboxtxs.sh' timeout_seconds='30' />
+    <exec_method type='method' name='stop' exec=':kill' timeout_seconds='60' />
+
+    <!-- Description -->
+    <template>
+        <common_name>
+            <loctext xml:lang='C'>VirtualBox Test eXecution Service</loctext>
+        </common_name>
+    </template>
+</service>
+
+</service_bundle>
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs.sh b/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs.sh
new file mode 100755
index 0000000..27df500
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+## @file
+# VirtualBox Test Execution Service Architecture Wrapper for Solaris.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+# 1. Change directory to the script directory (usually /opt/VBoxTest/).
+set -x
+MY_DIR=`dirname "$0"`
+cd "${MY_DIR}"
+
+# 2. Determine the architecture.
+MY_ARCH=`isainfo -k`
+case "${MY_ARCH}" in
+    amd64)
+        MY_ARCH=amd64
+        ;;
+    i386)
+        MY_ARCH=x86
+        ;;
+    *)
+        echo "vboxtxs.sh: Unsupported architecture '${MY_ARCH}' returned by isainfo -k." >&2
+        exit 2;
+        ;;
+esac
+
+# 3. Exec the service.
+exec "./${MY_ARCH}/TestExecService" \
+    --cdrom="/cdrom/cdrom0/" \
+    --scratch="/var/tmp/VBoxTest/" \
+    --no-display-output \
+    $*
+exit 3;
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs.xml b/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs.xml
new file mode 100644
index 0000000..2945f10
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/solaris/vboxtxs.xml
@@ -0,0 +1,73 @@
+<?xml version='1.0'?>
+<!--
+ Solaris SMF service manifest for the VirtualBox Test eXecution Service.
+ $Id: vboxtxs.xml $
+
+    Copyright (C) 2010-2014 Oracle Corporation
+
+    This file is part of VirtualBox Open Source Edition (OSE), as
+    available from http://www.virtualbox.org. This file is free software;
+    you can redistribute it and/or modify it under the terms of the GNU
+    General Public License (GPL) as published by the Free Software
+    Foundation, in version 2 as it comes in the "COPYING" file of the
+    VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+    hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+    The contents of this file may alternatively be used under the terms
+    of the Common Development and Distribution License Version 1.0
+    (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+    VirtualBox OSE distribution, in which case the provisions of the
+    CDDL are applicable instead of those of the GPL.
+
+    You may elect to license modified versions of this file under the
+    terms and conditions of either the GPL or the CDDL or both.
+-->
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+
+<service_bundle type='manifest' name='export'>
+<service name='system/virtualbox/vboxtxs' type='service' version='1'>
+
+    <create_default_instance enabled='false' />
+    <single_instance/>
+
+    <!-- Wait for the network to start up -->
+    <dependency name='milestone-network' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/milestone/network:default' />
+    </dependency>
+
+    <!-- Wait for devices to be initialized as we depend on vboxguest (PCI) -->
+    <dependency name='milestone-devices' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/milestone/devices:default' />
+    </dependency>
+
+    <!-- We wish to be started as late as possible... so go crazy with deps. -->
+    <dependency name='multi-user' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/milestone/multi-user:default' />
+    </dependency>
+    <dependency name='multi-user-server' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/milestone/multi-user-server:default' />
+    </dependency>
+    <dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/system/filesystem/local:default' />
+    </dependency>
+    <dependency name='filesystem-autofs' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/system/filesystem/autofs:default' />
+    </dependency>
+    <dependency name='filesystem-rmvolmgr' grouping='require_all' restart_on='none' type='service'>
+        <service_fmri value='svc:/system/filesystem/rmvolmgr:default' />
+    </dependency>
+
+    <!-- start + stop methods -->
+    <exec_method type='method' name='start' exec='/opt/VBoxTest/testsuite/solaris/vboxtxs.sh' timeout_seconds='30' />
+    <exec_method type='method' name='stop' exec=':kill' timeout_seconds='60' />
+
+    <!-- Description -->
+    <template>
+        <common_name>
+            <loctext xml:lang='C'>VirtualBox Test eXecution Service</loctext>
+        </common_name>
+    </template>
+</service>
+
+</service_bundle>
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/vboxtxs-readme.txt b/src/VBox/ValidationKit/utils/TestExecServ/vboxtxs-readme.txt
new file mode 100644
index 0000000..2e440ae
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/vboxtxs-readme.txt
@@ -0,0 +1,113 @@
+$Id: vboxtxs-readme.txt $
+
+
+VirtualBox Test eXecution Service
+=================================
+
+This readme briefly describes how to install the Test eXecution Service (TXS)
+on the various systems.
+
+There are currently two transport options for the TXS:
+
+  - The default is to use it in TCP server mode, i.e. the test script needs
+    to know the guest's IP and therefore requires guest additions to be
+    installed as well.  (Please use the latest stable additions compatible with
+    the VBox host versions you intend to test.)
+
+  - The alternative is for NATted setups where TXS will act like a TCP client
+    and try connect to the test script on the host.  Since this require that
+    TXS knows which IP to connect to, it's only really possible in a NATted
+    setup where we know the host IP is 10.0.2.2.
+
+Since r85596 TXS operates in both modes by default so the nat version of
+the init scripts is not required anymore. Instead the other type can be installed
+for both cases.
+
+Linux Installation
+------------------
+
+1. cd /root
+2. scp/download VBoxValidationKit*.zip there.
+3. unzip VBoxValidationKit*.zip
+4. chmod -R u+w,a+x /root/validationkit/
+5. cd /etc/init.d/
+6. Link up the right init script (see connection type above):
+      nat)   ln -s ../../root/validationkit/linux/vboxtxs-nat ./vboxtxs
+      other) ln -s ../../root/validationkit/linux/vboxtxs     ./vboxtxs
+7. Add vboxtxs to runlevels 2, 3, 5 and any other that makes sense
+   on the distro. There is usually some command for doing this...
+8. Check the cdrom location in vboxtxs and fix it so it's correct, make sure
+   to update in svn as well.
+9. reboot / done.
+
+
+OS/2 Installation
+--------------------
+
+1. Start an "OS/2 Window" ("OS/2 System" -> "Command Prompts")
+2. md C:\Apps
+3. cd C:\Apps
+4. Mount the validationkit iso.
+5. copy D:\os2\x86\* C:\Apps
+5. copy D:\os2\x86\libc*.dll C:\OS2\DLL\
+6. Open C:\startup.cmd in an editor (tedit.exe for instance or e.exe).
+7. Add the line "start /C C:\Apps\TestExecService.exe --foreground" at the top of the file.
+8. reboot / done
+9. Do test.
+
+
+Solaris Installation
+--------------------
+
+1. Start the guest and open a root console.
+2. mkdir -p /opt/VBoxTest
+3. cd /opt/VBoxTest
+4. scp/download VBoxValidationKit*.zip there.
+5. unzip VBoxValidationKit*.zip
+6. chmod -R u+w,a+x /opt/VBoxTest/
+7. Import the right service setup depending on the Solaris version:
+      <= 10u9) /usr/sbin/svccfg import /opt/VBoxTest/validationkit/solaris/vboxtxs-sol10.xml
+      >= 11.0) /usr/sbin/svccfg import /opt/VBoxTest/validationkit/solaris/vboxtxs.xml
+8. /usr/sbin/svcadm enable svc:/system/virtualbox/vboxtxs
+9. reboot / done.
+
+To remove the service before repeating steps 7 & 8:
+1. /usr/sbin/svcadm disable -s svc:/system/virtualbox/vboxtxs:default
+2. /usr/sbin/svccfg delete svc:/system/virtualbox/vboxtxs:default
+
+Note. To configure dhcp for more a new interface the files
+/etc/hostname.<if#X> and /etc/dhcp.<ifnm#> have to exist.  If you want the VM
+to work with any network card you throw at it, create /etc/*.pcn[01] and
+/etc/*.e1000g[012] as Solaris will remember it has seen the other variants
+before and use a different instance number (or something to that effect).
+
+
+Windows Installation
+--------------------
+
+1. Log on as Administrator.
+2. Set password to 'password'.
+3. Start CMD.EXE or equivalent.
+4. md C:\Apps
+5. cd C:\Apps
+6. Mount the validationkit iso.
+7. copy D:\win\* C:\Apps
+8. copy D:\win\<x86 or amd64>\* C:\Apps
+9. Import the right service setup (see connection type above):
+     nat)   start C:\Apps\vboxtxs-nat.reg
+     other) start C:\Apps\vboxtxs.reg
+11. reboot / done
+12. Do test.
+
+
+Testing the setup
+-----------------
+
+1. Make sure the validationkit.iso is inserted.
+2. Boot / reboot the guest.
+3. Depending on the TXS transport options:
+      nat)   python testdrivers/tst-txsclient --reversed-setup
+      other) python testdrivers/tst-txsclient --hostname <guest-ip>
+
+
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.cmd b/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.cmd
new file mode 100644
index 0000000..ce91739
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.cmd
@@ -0,0 +1,30 @@
+ at REM REM @file
+ at REM VirtualBox Test Execution Service Init Script for NATted VMs.
+ at REM
+
+ at REM
+REM Copyright (C) 2006-2014 Oracle Corporation
+REM
+REM This file is part of VirtualBox Open Source Edition (OSE), as
+REM available from http://www.virtualbox.org. This file is free software;
+REM you can redistribute it and/or modify it under the terms of the GNU
+REM General Public License (GPL) as published by the Free Software
+REM Foundation, in version 2 as it comes in the "COPYING" file of the
+REM VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+REM hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+REM
+REM The contents of this file may alternatively be used under the terms
+REM of the Common Development and Distribution License Version 1.0
+REM (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+REM VirtualBox OSE distribution, in which case the provisions of the
+REM CDDL are applicable instead of those of the GPL.
+REM
+REM You may elect to license modified versions of this file under the
+REM terms and conditions of either the GPL or the CDDL or both.
+REM
+
+%SystemDrive%\Apps\TestExecService.exe --foreground --display-output ^
+--cdrom D:\ --scratch C:\Temp\vboxtest --auto-upgrade ^
+--tcp-connect 10.0.2.2
+pause
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.reg b/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.reg
new file mode 100644
index 0000000..1102b6e
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs-nat.reg
@@ -0,0 +1,12 @@
+REGEDIT4
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
+"PowerdownAfterShutdown"="1"
+"AutoAdminLogon"="1"
+"ForceAutoLogon"="1"
+"DefaultUserName"="Administrator"
+"DefaultPassword"="password"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
+"NTConfiguration"="c:\\Apps\\vboxtxs-nat.cmd"
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.cmd b/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.cmd
new file mode 100644
index 0000000..d096375
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.cmd
@@ -0,0 +1,29 @@
+ at REM REM @file
+ at REM VirtualBox Test Execution Service Init Script.
+ at REM
+
+ at REM
+REM Copyright (C) 2006-2014 Oracle Corporation
+REM
+REM This file is part of VirtualBox Open Source Edition (OSE), as
+REM available from http://www.virtualbox.org. This file is free software;
+REM you can redistribute it and/or modify it under the terms of the GNU
+REM General Public License (GPL) as published by the Free Software
+REM Foundation, in version 2 as it comes in the "COPYING" file of the
+REM VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+REM hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+REM
+REM The contents of this file may alternatively be used under the terms
+REM of the Common Development and Distribution License Version 1.0
+REM (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+REM VirtualBox OSE distribution, in which case the provisions of the
+REM CDDL are applicable instead of those of the GPL.
+REM
+REM You may elect to license modified versions of this file under the
+REM terms and conditions of either the GPL or the CDDL or both.
+REM
+
+%SystemDrive%\Apps\TestExecService.exe --foreground --display-output ^
+--cdrom D:\ --scratch C:\Temp\vboxtest --auto-upgrade
+pause
+
diff --git a/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.reg b/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.reg
new file mode 100644
index 0000000..3253bd7
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/TestExecServ/win/vboxtxs.reg
@@ -0,0 +1,12 @@
+REGEDIT4
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
+"PowerdownAfterShutdown"="1"
+"AutoAdminLogon"="1"
+"ForceAutoLogon"="1"
+"DefaultUserName"="Administrator"
+"DefaultPassword"="password"
+
+[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
+"NTConfiguration"="c:\\Apps\\vboxtxs.cmd"
+
diff --git a/src/VBox/ValidationKit/utils/cpu/Makefile.kmk b/src/VBox/ValidationKit/utils/cpu/Makefile.kmk
new file mode 100644
index 0000000..8b183fe
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/Makefile.kmk
@@ -0,0 +1,65 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - CPU Test Utilities.
+#
+
+#
+# Copyright (C) 2009-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+PROGRAMS += xmmsaving
+xmmsaving_TEMPLATE = VBoxValidationKitR3
+xmmsaving_SOURCES  = xmmsaving.cpp xmmsaving-asm.asm
+
+PROGRAMS += exceptionsR3
+exceptionsR3_TEMPLATE = VBoxValidationKitR3
+exceptionsR3_SOURCES  = exceptionsR3.cpp exceptionsR3-asm.asm
+
+PROGRAMS += cpu-numa
+cpu-numa_TEMPLATE = VBoxValidationKitR3
+cpu-numa_SOURCES  = cpu-numa.cpp
+
+PROGRAMS += cpu-alloc-all-mem
+cpu-alloc-all-mem_TEMPLATE = VBoxValidationKitR3
+cpu-alloc-all-mem_SOURCES  = cpu-alloc-all-mem.cpp
+
+ifneq ($(KBUILD_HOST),os2)
+PROGRAMS += cidet-app
+endif
+cidet-app_TEMPLATE = VBoxValidationKitR3
+cidet-app_SOURCES  = \
+	cidet-app.cpp \
+	cidet-appA.asm \
+	cidet-core.cpp \
+	cidet-instr-1.cpp
+cidet-app_DEFS = IN_DIS
+cidet-app_DEFS.linux = CIDET_REDUCED_CTX
+cidet-app_LIBS = $(PATH_STAGE_LIB)/DisasmR3Static$(VBOX_SUFF_LIB)
+
+#PROGRAMS += rdtsc
+#rdtsc_TEMPLATE = rdtsc
+#rdtsc_SOURCES  = rdtsc.cpp rdtsc-asm.asm
+
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/utils/cpu/cidet-app.cpp b/src/VBox/ValidationKit/utils/cpu/cidet-app.cpp
new file mode 100644
index 0000000..9644027
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/cidet-app.cpp
@@ -0,0 +1,1361 @@
+/* $Id: cidet-app.cpp $ */
+/** @file
+ * CPU Instruction Decoding & Execution Tests - Ring-3 Driver Application.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "cidet.h"
+
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/buildconfig.h>
+#include <iprt/getopt.h>
+#include <iprt/initterm.h>
+#include <iprt/mem.h>
+#include <iprt/param.h>
+#include <iprt/rand.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+
+#ifdef RT_OS_WINDOWS
+# include <Windows.h>
+#else
+# define USE_SIGNALS
+# include <signal.h>
+# include <unistd.h>
+# include <sys/ucontext.h>
+#endif
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** @def CIDET_LEAVE_GS_ALONE
+ * Leave GS alone on 64-bit darwin (gs is 0, no ldt or gdt entry to load that'll
+ * restore the lower 32-bits of the base when saving and restoring the register).
+ */
+#if defined(RT_OS_DARWIN) && defined(RT_ARCH_AMD64)
+# define CIDET_LEAVE_GS_ALONE
+#endif
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+/**
+ * CIDET driver app buffer.
+ */
+typedef struct CIDETAPPBUF
+{
+    /** The buffer size. */
+    size_t          cb;
+    /** The normal allocation.
+     * There is a fence page before this as well as at pbNormal+cb.  */
+    uint8_t        *pbNormal;
+    /** The low memory allocation (32-bit addressable if 64-bit host, 16-bit
+     * addressable if 32-bit host). */
+    uint8_t        *pbLow;
+    /** Set if we're using the normal buffer, clear if it's the low one. */
+    bool            fUsingNormal : 1;
+    /** Set if the buffer is armed, clear if mostly accessible. */
+    bool            fArmed : 1;
+    /** Set if this is a code buffer. */
+    bool            fIsCode : 1;
+    /** The memory protection for the pages (RTMEM_PROT_XXX). */
+    uint8_t         fDefaultProt : 3;
+    /** The memory protection for the last page (RTMEM_PROT_XXX). */
+    uint8_t         fLastPageProt : 3;
+    /** The buffer index. */
+    uint16_t        idxCfg;
+} CIDETAPPBUF;
+/** Pointer to a CIDET driver app buffer. */
+typedef CIDETAPPBUF *PCIDETAPPBUF;
+
+/** Number of code buffers. */
+#define CIDETAPP_CODE_BUF_COUNT     1
+/** Number of data buffers. */
+#define CIDETAPP_DATA_BUF_COUNT     1
+
+
+/**
+ * CIDET driver app instance.
+ */
+typedef struct CIDETAPP
+{
+    /** The core structure. */
+    CIDETCORE       Core;
+    /** The execute return context. */
+    CIDETCPUCTX     ExecuteCtx;
+    /** Code buffers (runs parallel to g_aCodeBufCfgs). */
+    CIDETAPPBUF     aCodeBuffers[CIDETAPP_CODE_BUF_COUNT];
+    /** Data buffers (runs parallel to g_aDataBufCfgs). */
+    CIDETAPPBUF     aDataBuffers[CIDETAPP_DATA_BUF_COUNT];
+
+    /** The lowest stack address. */
+    uint8_t        *pbStackLow;
+    /** The end of the stack allocation (highest address). */
+    uint8_t        *pbStackEnd;
+    /** Stack size (= pbStackEnd - pbStackLow). */
+    uint32_t        cbStack;
+    /** Whether we're currently using the 'lock int3' to deal with tricky stack. */
+    bool            fUsingLockedInt3;
+} CIDETAPP;
+/** Pointer to a CIDET driver app instance. */
+typedef CIDETAPP *PCIDETAPP;
+/** Pointer to a pointer to a CIDET driver app instance. */
+typedef PCIDETAPP *PPCIDETAPP;
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** The test instance handle. */
+static RTTEST               g_hTest;
+/** Points to the instance data while executing, NULL if not executing or if
+ * we've already handled the first exception while executing. */
+static PCIDETAPP volatile   g_pExecutingThis;
+#ifdef USE_SIGNALS
+/** The default signal mask. */
+static sigset_t             g_ProcSigMask;
+/** The alternative signal stack. */
+static stack_t              g_AltStack;
+#endif
+
+
+/** Code buffer configurations (parallel to CIDETAPP::aCodeBuffers). */
+static CIDETBUFCFG g_aCodeBufCfgs[CIDETAPP_CODE_BUF_COUNT] =
+{
+    {
+        "Normal",
+        CIDETBUF_PROT_RWX | CIDETBUF_DPL_3 | CIDETBUF_DPL_SAME | CIDETBUF_SEG_ER | CIDETBUF_KIND_CODE,
+    },
+};
+
+/** Data buffer configurations (parallel to CIDETAPP::aDataBuffers). */
+static CIDETBUFCFG g_aDataBufCfgs[CIDETAPP_DATA_BUF_COUNT] =
+{
+    {
+        "Normal",
+        CIDETBUF_PROT_RWX | CIDETBUF_DPL_3 | CIDETBUF_DPL_SAME | CIDETBUF_SEG_RW | CIDETBUF_KIND_DATA,
+    },
+};
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+DECLASM(void) CidetAppSaveAndRestoreCtx(void);
+DECLASM(void) CidetAppRestoreCtx(PCCIDETCPUCTX pRestoreCtx);
+DECLASM(void) CidetAppExecute(PCIDETCPUCTX pSaveCtx, PCCIDETCPUCTX pRestoreCtx);
+
+
+/*
+ *
+ *
+ * Exception and signal handling.
+ * Exception and signal handling.
+ * Exception and signal handling.
+ *
+ *
+ */
+
+#ifdef RT_OS_WINDOWS
+static int CidetAppXcptFilter(EXCEPTION_POINTERS *pXcptPtrs)
+{
+    /*
+     * Grab the this point. We expect at most one signal.
+     */
+    PCIDETAPP pThis = g_pExecutingThis;
+    g_pExecutingThis = NULL;
+    if (pThis == NULL)
+    {
+        /* we're up the infamous creek... */
+        for (;;) ExitProcess(2);
+    }
+
+    /*
+     * Gather CPU state information from the context structure.
+     */
+    CONTEXT *pSrcCtx = pXcptPtrs->ContextRecord;
+# ifdef RT_ARCH_AMD64
+    if (   (pSrcCtx->ContextFlags & (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS))
+        !=                          (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS))
+        __debugbreak();
+    pThis->Core.ActualCtx.rip                   = pSrcCtx->Rip;
+    pThis->Core.ActualCtx.rfl                   = pSrcCtx->EFlags;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xAX]  = pSrcCtx->Rax;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xCX]  = pSrcCtx->Rcx;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xDX]  = pSrcCtx->Rdx;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xBX]  = pSrcCtx->Rbx;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xSP]  = pSrcCtx->Rsp;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xBP]  = pSrcCtx->Rbp;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xSI]  = pSrcCtx->Rsi;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xDI]  = pSrcCtx->Rdi;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x8]   = pSrcCtx->R8;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x9]   = pSrcCtx->R9;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x10]  = pSrcCtx->R10;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x11]  = pSrcCtx->R11;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x12]  = pSrcCtx->R12;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x13]  = pSrcCtx->R13;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x14]  = pSrcCtx->R14;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x15]  = pSrcCtx->R15;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_ES]   = pSrcCtx->SegEs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_CS]   = pSrcCtx->SegCs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_SS]   = pSrcCtx->SegSs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_DS]   = pSrcCtx->SegDs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_FS]   = pSrcCtx->SegFs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_GS]   = pSrcCtx->SegGs;
+    if (pSrcCtx->ContextFlags & CONTEXT_FLOATING_POINT)
+    {
+        /* ... */
+    }
+    if (pSrcCtx->ContextFlags & CONTEXT_DEBUG_REGISTERS)
+    {
+        /* ... */
+    }
+
+# elif defined(RT_ARCH_X86)
+    if (   (pSrcCtx->ContextFlags & (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS))
+        !=                          (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS))
+        __debugbreak();
+    pThis->Core.ActualCtx.rip                   = pSrcCtx->Eip;
+    pThis->Core.ActualCtx.rfl                   = pSrcCtx->EFlags;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xAX]  = pSrcCtx->Eax;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xCX]  = pSrcCtx->Ecx;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xDX]  = pSrcCtx->Edx;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xBX]  = pSrcCtx->Ebx;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xSP]  = pSrcCtx->Esp;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xBP]  = pSrcCtx->Ebp;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xSI]  = pSrcCtx->Esi;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xDI]  = pSrcCtx->Edi;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x8]   = 0;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x9]   = 0;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x10]  = 0;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x11]  = 0;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x12]  = 0;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x13]  = 0;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x14]  = 0;
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x15]  = 0;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_ES]   = pSrcCtx->SegEs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_CS]   = pSrcCtx->SegCs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_SS]   = pSrcCtx->SegSs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_DS]   = pSrcCtx->SegDs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_FS]   = pSrcCtx->SegFs;
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_GS]   = pSrcCtx->SegGs;
+    if (pSrcCtx->ContextFlags & CONTEXT_FLOATING_POINT)
+    {
+        /* ... */
+    }
+    if (pSrcCtx->ContextFlags & CONTEXT_EXTENDED_REGISTERS)
+    {
+        /* ... */
+    }
+    if (pSrcCtx->ContextFlags & CONTEXT_DEBUG_REGISTERS)
+    {
+        /* ... */
+    }
+# else
+#  error "Not supported"
+# endif
+
+    /*
+     * Add/Adjust CPU state information according to the exception code.
+     */
+    pThis->Core.ActualCtx.uErr = UINT64_MAX;
+    switch (pXcptPtrs->ExceptionRecord->ExceptionCode)
+    {
+        case EXCEPTION_INT_DIVIDE_BY_ZERO:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_DE;
+            break;
+        case EXCEPTION_SINGLE_STEP:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_DB;
+            break;
+        case EXCEPTION_BREAKPOINT:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_BP;
+            break;
+        case EXCEPTION_INT_OVERFLOW:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_OF;
+            break;
+        case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_BR;
+            break;
+        case EXCEPTION_ILLEGAL_INSTRUCTION:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_UD;
+            break;
+
+        case EXCEPTION_PRIV_INSTRUCTION:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_GP;
+            pThis->Core.ActualCtx.uErr  = 0;
+            break;
+
+        case EXCEPTION_ACCESS_VIOLATION:
+        {
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_PF;
+            pThis->Core.ActualCtx.cr2   = pXcptPtrs->ExceptionRecord->ExceptionInformation[1];
+            pThis->Core.ActualCtx.uErr  = 0;
+            if (pXcptPtrs->ExceptionRecord->ExceptionInformation[0] == EXCEPTION_WRITE_FAULT)
+                pThis->Core.ActualCtx.uErr = X86_TRAP_PF_RW;
+            else if (pXcptPtrs->ExceptionRecord->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT)
+                pThis->Core.ActualCtx.uErr = X86_TRAP_PF_ID;
+            else if (pXcptPtrs->ExceptionRecord->ExceptionInformation[0] != EXCEPTION_READ_FAULT)
+                AssertFatalFailed();
+
+            MEMORY_BASIC_INFORMATION MemInfo = {0};
+            if (VirtualQuery((PVOID)pXcptPtrs->ExceptionRecord->ExceptionInformation[1], &MemInfo, sizeof(MemInfo)) > 0)
+                switch (MemInfo.Protect & 0xff)
+                {
+                    case PAGE_NOACCESS:
+                        break;
+                    case PAGE_READONLY:
+                    case PAGE_READWRITE:
+                    case PAGE_WRITECOPY:
+                    case PAGE_EXECUTE:
+                    case PAGE_EXECUTE_READ:
+                    case PAGE_EXECUTE_READWRITE:
+                    case PAGE_EXECUTE_WRITECOPY:
+                        pThis->Core.ActualCtx.uErr |= X86_TRAP_PF_P;
+                        break;
+                    default:
+                        AssertFatalFailed();
+                }
+            break;
+        }
+
+        case EXCEPTION_FLT_DENORMAL_OPERAND:
+        case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+        case EXCEPTION_FLT_INEXACT_RESULT:
+        case EXCEPTION_FLT_INVALID_OPERATION:
+        case EXCEPTION_FLT_OVERFLOW:
+        case EXCEPTION_FLT_STACK_CHECK:
+        case EXCEPTION_FLT_UNDERFLOW:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_MF;
+            break;
+
+        case EXCEPTION_DATATYPE_MISALIGNMENT:
+            pThis->Core.ActualCtx.uXcpt = X86_XCPT_AC;
+            break;
+
+        default:
+            pThis->Core.ActualCtx.uXcpt = pXcptPtrs->ExceptionRecord->ExceptionCode;
+            break;
+    }
+
+    /*
+     * Our own personal long jump implementation.
+     */
+    CidetAppRestoreCtx(&pThis->ExecuteCtx);
+
+    /* Won't return...*/
+    return EXCEPTION_EXECUTE_HANDLER;
+}
+
+
+/**
+ * Vectored exception handler.
+ *
+ * @returns Long jumps or terminates the process.
+ * @param   pXcptPtrs   The exception record.
+ */
+static LONG CALLBACK CidetAppVectoredXcptHandler(EXCEPTION_POINTERS *pXcptPtrs)
+{
+    RTStrmPrintf(g_pStdErr, "CidetAppVectoredXcptHandler!\n");
+    CidetAppXcptFilter(pXcptPtrs);
+
+    /* won't get here. */
+    return EXCEPTION_CONTINUE_SEARCH;
+}
+
+
+/**
+ * Unhandled exception filter.
+ *
+ * @returns Long jumps or terminates the process.
+ * @param   pXcptPtrs   The exception record.
+ */
+static LONG CALLBACK CidetAppUnhandledXcptFilter(EXCEPTION_POINTERS *pXcptPtrs)
+{
+    RTStrmPrintf(g_pStdErr, "CidetAppUnhandledXcptFilter!\n");
+    CidetAppXcptFilter(pXcptPtrs);
+
+    /* won't get here. */
+    return EXCEPTION_CONTINUE_SEARCH;
+}
+
+
+#elif defined(USE_SIGNALS)
+/**
+ * Signal handler.
+ */
+static void CidetAppSigHandler(int iSignal, siginfo_t *pSigInfo, void *pvCtx)
+{
+# if 1
+    if (   !g_pExecutingThis
+        || !g_pExecutingThis->fUsingLockedInt3
+        || iSignal != SIGILL)
+    {
+        RTStrmPrintf(g_pStdErr, "signal %d pSigInfo=%p pvCtx=%p", iSignal, pSigInfo, pvCtx);
+        if (pSigInfo)
+            RTStrmPrintf(g_pStdErr, " si_addr=%p si_code=%#x sival_ptr=%p sival_int=%d",
+                         pSigInfo->si_addr, pSigInfo->si_code, pSigInfo->si_value.sival_ptr, pSigInfo->si_value.sival_int);
+        RTStrmPrintf(g_pStdErr, "\n");
+    }
+# endif
+
+    /*
+     * Grab the this point. We expect at most one signal.
+     */
+    PCIDETAPP pThis = g_pExecutingThis;
+    g_pExecutingThis = NULL;
+    if (pThis == NULL)
+    {
+        /* we're up the infamous creek... */
+        RTStrmPrintf(g_pStdErr, "Creek time!\n");
+        for (;;) _exit(2);
+    }
+
+    /*
+     * Gather all the CPU state information available.
+     */
+# ifdef RT_OS_LINUX
+    ucontext_t const *pCtx = (ucontext_t const *)pvCtx;
+#  ifdef RT_ARCH_AMD64
+
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xAX] = pCtx->uc_mcontext.gregs[REG_RAX];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xCX] = pCtx->uc_mcontext.gregs[REG_RCX];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xDX] = pCtx->uc_mcontext.gregs[REG_RDX];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xBX] = pCtx->uc_mcontext.gregs[REG_RBX];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xSP] = pCtx->uc_mcontext.gregs[REG_RSP];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xBP] = pCtx->uc_mcontext.gregs[REG_RBP];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xSI] = pCtx->uc_mcontext.gregs[REG_RSI];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xDI] = pCtx->uc_mcontext.gregs[REG_RDI];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x8 ] = pCtx->uc_mcontext.gregs[REG_R8];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x9 ] = pCtx->uc_mcontext.gregs[REG_R9];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x10] = pCtx->uc_mcontext.gregs[REG_R10];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x11] = pCtx->uc_mcontext.gregs[REG_R11];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x12] = pCtx->uc_mcontext.gregs[REG_R12];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x13] = pCtx->uc_mcontext.gregs[REG_R13];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x14] = pCtx->uc_mcontext.gregs[REG_R14];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_x15] = pCtx->uc_mcontext.gregs[REG_R15];
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_CS]  = RT_LO_U16((uint32_t)pCtx->uc_mcontext.gregs[REG_CSGSFS]);
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_GS]  = RT_HI_U16((uint32_t)pCtx->uc_mcontext.gregs[REG_CSGSFS]);
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_FS]  = (uint16_t)RT_HI_U32(pCtx->uc_mcontext.gregs[REG_CSGSFS]);
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_DS]  = ASMGetDS();
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_ES]  = ASMGetES();
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_SS]  = ASMGetSS();
+    pThis->Core.ActualCtx.rip                  = pCtx->uc_mcontext.gregs[REG_RIP];
+    pThis->Core.ActualCtx.rfl                  = pCtx->uc_mcontext.gregs[REG_EFL];
+    pThis->Core.ActualCtx.cr2                  = pCtx->uc_mcontext.gregs[REG_CR2];
+    pThis->Core.ActualCtx.uXcpt                = pCtx->uc_mcontext.gregs[REG_TRAPNO];
+    pThis->Core.ActualCtx.uErr                 = pCtx->uc_mcontext.gregs[REG_ERR];
+
+    /* Fudge the FS and GS registers as setup_sigcontext returns 0. */
+    if (pThis->Core.ActualCtx.aSRegs[X86_SREG_FS] == 0)
+       pThis->Core.ActualCtx.aSRegs[X86_SREG_FS] = pThis->Core.ExpectedCtx.aSRegs[X86_SREG_FS];
+    if (pThis->Core.ActualCtx.aSRegs[X86_SREG_GS] == 0)
+       pThis->Core.ActualCtx.aSRegs[X86_SREG_GS] = pThis->Core.ExpectedCtx.aSRegs[X86_SREG_GS];
+
+#  elif defined(RT_ARCH_X86)
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xAX] = pCtx->uc_mcontext.gregs[REG_EAX];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xCX] = pCtx->uc_mcontext.gregs[REG_ECX];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xDX] = pCtx->uc_mcontext.gregs[REG_EDX];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xBX] = pCtx->uc_mcontext.gregs[REG_EBX];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xSP] = pCtx->uc_mcontext.gregs[REG_ESP];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xBP] = pCtx->uc_mcontext.gregs[REG_EBP];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xSI] = pCtx->uc_mcontext.gregs[REG_ESI];
+    pThis->Core.ActualCtx.aGRegs[X86_GREG_xDI] = pCtx->uc_mcontext.gregs[REG_EDI];
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_CS]  = pCtx->uc_mcontext.gregs[REG_CS];
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_DS]  = pCtx->uc_mcontext.gregs[REG_DS];
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_ES]  = pCtx->uc_mcontext.gregs[REG_ES];
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_FS]  = pCtx->uc_mcontext.gregs[REG_FS];
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_GS]  = pCtx->uc_mcontext.gregs[REG_GS];
+    pThis->Core.ActualCtx.aSRegs[X86_SREG_SS]  = pCtx->uc_mcontext.gregs[REG_SS];
+    pThis->Core.ActualCtx.rip                  = pCtx->uc_mcontext.gregs[REG_EIP];
+    pThis->Core.ActualCtx.rfl                  = pCtx->uc_mcontext.gregs[REG_EFL];
+    pThis->Core.ActualCtx.cr2                  = pCtx->uc_mcontext.cr2;
+    pThis->Core.ActualCtx.uXcpt                = pCtx->uc_mcontext.gregs[REG_TRAPNO];
+    pThis->Core.ActualCtx.uErr                 = pCtx->uc_mcontext.gregs[REG_ERR];
+
+#  else
+#   error "Unsupported arch."
+#  endif
+
+    /* Adjust uErr. */
+    switch (pThis->Core.ActualCtx.uXcpt)
+    {
+        case X86_XCPT_TS:
+        case X86_XCPT_NP:
+        case X86_XCPT_SS:
+        case X86_XCPT_GP:
+        case X86_XCPT_PF:
+        case X86_XCPT_AC:
+        case X86_XCPT_DF:
+            break;
+        default:
+            pThis->Core.ActualCtx.uErr = UINT64_MAX;
+            break;
+    }
+
+#  if 0
+    /* Fudge the resume flag (it's probably always set here). */
+    if (   (pThis->Core.ActualCtx.rfl & X86_EFL_RF)
+        && !(pThis->Core.ExpectedCtx.rfl & X86_EFL_RF))
+        pThis->Core.ActualCtx.rfl &= ~X86_EFL_RF;
+#  endif
+
+# else
+    /** @todo    */
+# endif
+
+
+    /*
+     * Check for the 'lock int3' instruction used for tricky stacks.
+     */
+    if (   pThis->fUsingLockedInt3
+        && pThis->Core.ActualCtx.uXcpt == X86_XCPT_UD
+        && pThis->Core.ActualCtx.rip == pThis->Core.CodeBuf.uEffBufAddr - pThis->Core.CodeBuf.offSegBase
+                                        + pThis->Core.CodeBuf.offActive + pThis->Core.CodeBuf.cbActive )
+    {
+        pThis->Core.ActualCtx.uXcpt = UINT32_MAX;
+        Assert(pThis->Core.ActualCtx.uErr == UINT64_MAX);
+        pThis->Core.ActualCtx.rfl &= ~X86_EFL_RF;
+    }
+
+    /*
+     * Jump back to CidetAppCbExecute.
+     */
+    CidetAppRestoreCtx(&pThis->ExecuteCtx);
+}
+#endif
+
+
+
+/*
+ *
+ * Buffer handling
+ * Buffer handling
+ * Buffer handling
+ *
+ *
+ */
+
+static int cidetAppAllocateAndConfigureOneBuffer(PCIDETAPP pThis, PCIDETAPPBUF pBuf, uint16_t idxBuf, bool fIsCode,
+                                                 uint32_t fFlags)
+{
+    static uint8_t const s_afBufProtToDefaultMemProt[] =
+    {
+        /* [0]  = */ RTMEM_PROT_NONE,
+        /* [1]  = */ RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC,
+        /* [2]  = */ RTMEM_PROT_READ | RTMEM_PROT_WRITE,
+        /* [3]  = */ RTMEM_PROT_READ | RTMEM_PROT_EXEC,
+        /* [4]  = */ RTMEM_PROT_READ,
+        /* [5]  = */ RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC,
+        /* [6]  = */ RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC,
+        /* [7]  = */ RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC,
+        /* [8]  = */ RTMEM_PROT_NONE,
+        /* [9]  = */ RTMEM_PROT_NONE,
+        /* [10] = */ RTMEM_PROT_NONE,
+        /* [11] = */ RTMEM_PROT_NONE,
+        /* [12] = */ RTMEM_PROT_NONE,
+        /* [13] = */ RTMEM_PROT_NONE,
+        /* [14] = */ RTMEM_PROT_NONE,
+        /* [15] = */ RTMEM_PROT_NONE,
+    };
+    static uint8_t const s_afBufProtToLastPageMemProt[] =
+    {
+        /* [0]  = */ RTMEM_PROT_NONE,
+        /* [1]  = */ RTMEM_PROT_READ | RTMEM_PROT_WRITE | RTMEM_PROT_EXEC,
+        /* [2]  = */ RTMEM_PROT_READ | RTMEM_PROT_WRITE,
+        /* [3]  = */ RTMEM_PROT_READ | RTMEM_PROT_EXEC,
+        /* [4]  = */ RTMEM_PROT_READ,
+        /* [5]  = */ RTMEM_PROT_NONE,
+        /* [6]  = */ RTMEM_PROT_READ | RTMEM_PROT_WRITE,
+        /* [7]  = */ RTMEM_PROT_READ,
+        /* [8]  = */ RTMEM_PROT_NONE,
+        /* [9]  = */ RTMEM_PROT_NONE,
+        /* [10] = */ RTMEM_PROT_NONE,
+        /* [11] = */ RTMEM_PROT_NONE,
+        /* [12] = */ RTMEM_PROT_NONE,
+        /* [13] = */ RTMEM_PROT_NONE,
+        /* [14] = */ RTMEM_PROT_NONE,
+        /* [15] = */ RTMEM_PROT_NONE,
+    };
+
+    int rc;
+    Assert(CIDETBUF_IS_CODE(fFlags) == fIsCode);
+    pBuf->fIsCode       = fIsCode;
+    pBuf->idxCfg        = idxBuf;
+    pBuf->fUsingNormal  = true;
+    pBuf->fDefaultProt  = s_afBufProtToDefaultMemProt[fFlags & CIDETBUF_PROT_MASK];
+    pBuf->fLastPageProt = s_afBufProtToLastPageMemProt[fFlags & CIDETBUF_PROT_MASK];
+    if (pBuf->fDefaultProt != RTMEM_PROT_NONE)
+    {
+        /*
+         * Allocate a 3 page buffer plus two fence pages.
+         */
+        pBuf->cb        = fIsCode ? CIDET_CODE_BUF_SIZE : CIDET_DATA_BUF_SIZE;
+        pBuf->pbNormal  = (uint8_t *)RTMemPageAlloc(PAGE_SIZE + pBuf->cb + PAGE_SIZE);
+        if (pBuf->pbNormal)
+        {
+            memset(pBuf->pbNormal, 0x55, PAGE_SIZE);
+            memset(pBuf->pbNormal + PAGE_SIZE, 0xcc, pBuf->cb);
+            memset(pBuf->pbNormal + PAGE_SIZE + pBuf->cb, 0x77, PAGE_SIZE);
+
+            /* Set up fence pages. */
+            rc = RTMemProtect(pBuf->pbNormal, PAGE_SIZE, RTMEM_PROT_NONE); /* fence */
+            if (RT_SUCCESS(rc))
+                rc = RTMemProtect(pBuf->pbNormal + PAGE_SIZE + pBuf->cb, PAGE_SIZE, RTMEM_PROT_NONE); /* fence */
+            pBuf->pbNormal += PAGE_SIZE;
+
+            /* Default protection + read + write. */
+            if (RT_SUCCESS(rc))
+                rc = RTMemProtect(pBuf->pbNormal, pBuf->cb, pBuf->fDefaultProt | RTMEM_PROT_READ | RTMEM_PROT_WRITE);
+
+            /*
+             * Allocate a low memory buffer or LDT if necessary.
+             */
+            if (   RT_SUCCESS(rc)
+                && (uintptr_t)pBuf->pbNormal + pBuf->cb > RT_BIT_64(sizeof(uintptr_t) / 2 * 8))
+            {
+                /** @todo Buffers for the other addressing mode. */
+                pBuf->pbLow = NULL;
+            }
+            else
+                pBuf->pbLow = pBuf->pbNormal;
+            if (RT_SUCCESS(rc))
+                return VINF_SUCCESS;
+
+        }
+        else
+            rc = RTTestIFailedRc(VERR_NO_PAGE_MEMORY, "Error allocating three pages.");
+    }
+    else
+        rc = RTTestIFailedRc(VERR_NO_PAGE_MEMORY, "Unsupported buffer config: fFlags=%#x, idxBuf=%u", fFlags, idxBuf);
+    return rc;
+}
+
+
+static void CidetAppDeleteBuffer(PCIDETAPPBUF pBuf)
+{
+    RTMemProtect(pBuf->pbNormal - PAGE_SIZE, PAGE_SIZE + pBuf->cb + PAGE_SIZE, RTMEM_PROT_READ | RTMEM_PROT_WRITE);
+    RTMemPageFree(pBuf->pbNormal - PAGE_SIZE, PAGE_SIZE + pBuf->cb + PAGE_SIZE);
+    if (pBuf->pbLow != pBuf->pbNormal && pBuf->pbLow)
+    {
+        RTMemProtect(pBuf->pbLow, pBuf->cb, RTMEM_PROT_READ | RTMEM_PROT_WRITE);
+        RTMemFreeEx(pBuf->pbLow, pBuf->cb);
+    }
+}
+
+
+static bool CidetAppArmBuf(PCIDETAPP pThis, PCIDETAPPBUF pAppBuf)
+{
+    uint8_t *pbUsingBuf = (pAppBuf->fUsingNormal ? pAppBuf->pbNormal : pAppBuf->pbLow);
+    if (pAppBuf->fLastPageProt == pAppBuf->fDefaultProt)
+    {
+        if ((pAppBuf->fDefaultProt & (RTMEM_PROT_READ | RTMEM_PROT_WRITE)) != (RTMEM_PROT_READ | RTMEM_PROT_WRITE))
+            RTTESTI_CHECK_RC_RET(RTMemProtect(pbUsingBuf, pAppBuf->cb, pAppBuf->fDefaultProt), VINF_SUCCESS, false);
+    }
+    else
+    {
+        if ((pAppBuf->fDefaultProt & (RTMEM_PROT_READ | RTMEM_PROT_WRITE)) != (RTMEM_PROT_READ | RTMEM_PROT_WRITE))
+            RTTESTI_CHECK_RC_RET(RTMemProtect(pbUsingBuf, pAppBuf->cb - PAGE_SIZE, pAppBuf->fDefaultProt), VINF_SUCCESS, false);
+        RTTESTI_CHECK_RC_RET(RTMemProtect(pbUsingBuf + pAppBuf->cb - PAGE_SIZE, PAGE_SIZE, pAppBuf->fLastPageProt),
+                             VINF_SUCCESS, false);
+    }
+    pAppBuf->fArmed = true;
+    return true;
+}
+
+
+static bool CidetAppDearmBuf(PCIDETAPP pThis, PCIDETAPPBUF pAppBuf)
+{
+    uint8_t *pbUsingBuf = (pAppBuf->fUsingNormal ? pAppBuf->pbNormal : pAppBuf->pbLow);
+    int rc = RTMemProtect(pbUsingBuf, pAppBuf->cb, pAppBuf->fDefaultProt | RTMEM_PROT_READ | RTMEM_PROT_WRITE);
+    if (RT_FAILURE(rc))
+    {
+        RTTestIFailed("RTMemProtect failed on %s buf #%u: %Rrc", pAppBuf->fIsCode ? "code" : "data", pAppBuf->idxCfg, rc);
+        return false;
+    }
+    pAppBuf->fArmed = false;
+    return true;
+}
+
+
+/**
+ * @interface_method_impl{CIDETCORE::pfnReInitDataBuf}
+ */
+static DECLCALLBACK(bool) CidetAppCbReInitDataBuf(PCIDETCORE pThis, PCIDETBUF pBuf)
+{
+    PCIDETAPP    pThisApp = (PCIDETAPP)pThis;
+    PCIDETAPPBUF pAppBuf  = &pThisApp->aDataBuffers[pBuf->idxCfg];
+    Assert(CIDETBUF_IS_DATA(pBuf->pCfg->fFlags));
+
+    /*
+     * De-arm the buffer.
+     */
+    if (pAppBuf->fArmed)
+        if (RT_UNLIKELY(!CidetAppDearmBuf(pThisApp, pAppBuf)))
+            return false;
+
+    /*
+     * Check the allocation requirements.
+     */
+    if (RT_UNLIKELY((size_t)pBuf->off + pBuf->cb > pAppBuf->cb))
+    {
+        RTTestIFailed("Buffer too small; off=%#x cb=%#x pAppBuf->cb=%#x (%s)",
+                      pBuf->off, pBuf->cb, pAppBuf->cb, pBuf->pCfg->pszName);
+        return false;
+    }
+
+    /*
+     * Do we need to use the low buffer?  Check that we have one, if we need it.
+     */
+    bool fUseNormal = pThis->cbAddrMode == ARCH_BITS / 8;
+    if (!fUseNormal && !pAppBuf->pbLow)
+        return false;
+
+    /*
+     * Update the state.
+     */
+    pAppBuf->fUsingNormal   = fUseNormal;
+
+    pBuf->offActive         = pBuf->off;
+    pBuf->cbActive          = pBuf->cb;
+    pBuf->cbPrologue        = 0;
+    pBuf->cbEpilogue        = 0;
+    pBuf->uSeg              = UINT32_MAX;
+    pBuf->cbActiveSegLimit  = UINT64_MAX;
+    pBuf->uSegBase          = 0;
+    if (fUseNormal)
+        pBuf->uEffBufAddr   = (uintptr_t)pAppBuf->pbNormal;
+    else
+        pBuf->uEffBufAddr   = (uintptr_t)pAppBuf->pbLow;
+
+    return true;
+}
+
+
+/**
+ * @interface_method_impl{CIDETCORE::pfnSetupDataBuf}
+ */
+static DECLCALLBACK(bool) CidetAppCbSetupDataBuf(PCIDETCORE pThis, PCIDETBUF pBuf, void const *pvSrc)
+{
+    PCIDETAPP    pThisApp = (PCIDETAPP)pThis;
+    PCIDETAPPBUF pAppBuf  = &pThisApp->aDataBuffers[pBuf->idxCfg];
+    Assert(CIDETBUF_IS_DATA(pBuf->pCfg->fFlags));
+    Assert(!pAppBuf->fArmed);
+
+
+    /*
+     * Copy over the data.
+     */
+    uint8_t *pbUsingBuf = (pAppBuf->fUsingNormal ? pAppBuf->pbNormal : pAppBuf->pbLow);
+    memcpy(pbUsingBuf + pBuf->offActive, pvSrc, pBuf->cbActive);
+
+    /*
+     * Arm the buffer.
+     */
+    return CidetAppArmBuf(pThisApp, pAppBuf);
+}
+
+
+/**
+ * @interface_method_impl{CIDETCORE::pfnIsBufEqual}
+ */
+static DECLCALLBACK(bool) CidetAppCbIsBufEqual(PCIDETCORE pThis, struct CIDETBUF *pBuf, void const *pvExpected)
+{
+    PCIDETAPP    pThisApp = (PCIDETAPP)pThis;
+    PCIDETAPPBUF pAppBuf  = CIDETBUF_IS_CODE(pBuf->pCfg->fFlags)
+                          ? &pThisApp->aCodeBuffers[pBuf->idxCfg]
+                          : &pThisApp->aDataBuffers[pBuf->idxCfg];
+
+    /*
+     * Disarm the buffer if we can't read it all.
+     */
+    if (   pAppBuf->fArmed
+        && (   !(pAppBuf->fLastPageProt & RTMEM_PROT_READ)
+            || !(pAppBuf->fDefaultProt  & RTMEM_PROT_READ)) )
+        if (RT_UNLIKELY(!CidetAppDearmBuf(pThisApp, pAppBuf)))
+            return false;
+
+    /*
+     * Do the comparing.
+     */
+    uint8_t *pbUsingBuf = (pAppBuf->fUsingNormal ? pAppBuf->pbNormal : pAppBuf->pbLow);
+    if (memcmp(pbUsingBuf + pBuf->offActive, pvExpected, pBuf->cbActive) != 0)
+    {
+        /** @todo RTMEM_PROT_NONE may kill content on some hosts... */
+        return false;
+    }
+
+    /** @todo check padding. */
+    return true;
+}
+
+
+/*
+ *
+ * Code buffer, prologue, epilogue, and execution.
+ * Code buffer, prologue, epilogue, and execution.
+ * Code buffer, prologue, epilogue, and execution.
+ *
+ *
+ */
+
+
+/**
+ * @interface_method_impl{CIDETCORE::pfnReInitCodeBuf}
+ */
+static DECLCALLBACK(bool) CidetAppCbReInitCodeBuf(PCIDETCORE pThis, PCIDETBUF pBuf)
+{
+    PCIDETAPP    pThisApp = (PCIDETAPP)pThis;
+    PCIDETAPPBUF pAppBuf  = &pThisApp->aCodeBuffers[pBuf->idxCfg];
+    Assert(CIDETBUF_IS_CODE(pBuf->pCfg->fFlags));
+    Assert(pAppBuf->fUsingNormal);
+
+    /*
+     * De-arm the buffer.
+     */
+    if (pAppBuf->fArmed)
+        if (RT_UNLIKELY(!CidetAppDearmBuf(pThisApp, pAppBuf)))
+            return false;
+
+    /*
+     * Determin the prologue and epilogue sizes.
+     */
+    uint16_t cbPrologue = 0;
+    uint16_t cbEpilogue = ARCH_BITS == 64 ? 0x56 : 0x4e;
+    if (pThis->InCtx.fTrickyStack)
+        cbEpilogue = 16;
+
+    /*
+     * Check the allocation requirements.
+     */
+    if (RT_UNLIKELY(   cbPrologue > pBuf->off
+                    || (size_t)pBuf->off + pBuf->cb + cbEpilogue > pAppBuf->cb))
+    {
+        RTTestIFailed("Buffer too small; off=%#x cb=%#x cbPro=%#x cbEpi=%#x pAppBuf->cb=%#x (%s)",
+                      pBuf->off, pBuf->cb, cbPrologue, cbEpilogue, pAppBuf->cb, pBuf->pCfg->pszName);
+        return false;
+    }
+
+    /*
+     * Update the state.
+     */
+    pAppBuf->fUsingNormal   = true;
+
+    pBuf->cbActive          = pBuf->cb;
+    pBuf->offActive         = pBuf->off;
+    pBuf->cbPrologue        = cbPrologue;
+    pBuf->cbEpilogue        = cbEpilogue;
+    pBuf->uSeg              = UINT32_MAX;
+    pBuf->cbActiveSegLimit  = UINT64_MAX;
+    pBuf->uSegBase          = 0;
+    pBuf->uEffBufAddr       = (uintptr_t)pAppBuf->pbNormal;
+
+    return true;
+}
+
+
+/**
+ * @interface_method_impl{CIDETCORE::pfnSetupCodeBuf}
+ */
+static DECLCALLBACK(bool) CidetAppCbSetupCodeBuf(PCIDETCORE pThis, PCIDETBUF pBuf, void const *pvInstr)
+{
+    PCIDETAPP    pThisApp = (PCIDETAPP)pThis;
+    PCIDETAPPBUF pAppBuf  =&pThisApp->aCodeBuffers[pBuf->idxCfg];
+    Assert(CIDETBUF_IS_CODE(pBuf->pCfg->fFlags));
+    Assert(pAppBuf->fUsingNormal);
+    Assert(!pAppBuf->fArmed);
+
+    /*
+     * Emit prologue code.
+     */
+    uint8_t *pbDst = pAppBuf->pbNormal + pBuf->offActive - pBuf->cbPrologue;
+
+    /*
+     * Copy over the code.
+     */
+    Assert(pbDst == &pAppBuf->pbNormal[pBuf->offActive]);
+    memcpy(pbDst, pvInstr, pBuf->cbActive);
+    pbDst += pBuf->cbActive;
+
+    /*
+     * Emit epilogue code.
+     */
+    if (!pThis->InCtx.fTrickyStack)
+    {
+        /*
+         * The stack is reasonably good, do minimal work.
+         *
+         * Note! Ideally, we would just fill in 16 int3s here and check that
+         *       we hit the first right one.  However, if we wish to run this
+         *       code with IEM, we better skip unnecessary trips to ring-0.
+         */
+        uint8_t * const pbStartEpilogue = pbDst;
+
+        /* jmp      $+6 */
+        *pbDst++ = 0xeb;
+        *pbDst++ = 0x06;        /* This is a push es, so if the decoder is one off, we'll hit the int 3 below. */
+
+        /* Six int3s for trapping incorrectly decoded instructions. */
+        *pbDst++ = 0xcc;
+        *pbDst++ = 0xcc;
+        *pbDst++ = 0xcc;
+        *pbDst++ = 0xcc;
+        *pbDst++ = 0xcc;
+        *pbDst++ = 0xcc;
+
+        /* push     rip / call $+0 */
+        *pbDst++ = 0xe8;
+        *pbDst++ = 0x00;
+        *pbDst++ = 0x00;
+        *pbDst++ = 0x00;
+        *pbDst++ = 0x00;
+        uint8_t offRipAdjust = (uint8_t)(uintptr_t)(pbStartEpilogue - pbDst);
+
+        /* push     xCX */
+        *pbDst++ = 0x51;
+
+        /* mov      xCX, [xSP + xCB] */
+        *pbDst++ = 0x48;
+        *pbDst++ = 0x8b;
+        *pbDst++ = 0x4c;
+        *pbDst++ = 0x24;
+        *pbDst++ = sizeof(uintptr_t);
+
+        /* lea      xCX, [xCX - 24] */
+        *pbDst++ = 0x48;
+        *pbDst++ = 0x8d;
+        *pbDst++ = 0x49;
+        *pbDst++ = offRipAdjust;
+
+        /* mov      xCX, [xSP + xCB] */
+        *pbDst++ = 0x48;
+        *pbDst++ = 0x89;
+        *pbDst++ = 0x4c;
+        *pbDst++ = 0x24;
+        *pbDst++ = sizeof(uintptr_t);
+
+        /* mov      xCX, &pThis->ActualCtx */
+#ifdef RT_ARCH_AMD64
+        *pbDst++ = 0x48;
+#endif
+        *pbDst++ = 0xb9;
+        *(uintptr_t *)pbDst = (uintptr_t)&pThisApp->Core.ActualCtx;
+        pbDst  += sizeof(uintptr_t);
+
+        /* pop      [ss:rcx + ActualCtx.aGRegs[X86_GREG_xCX]] */
+        *pbDst++ = 0x36;
+        *pbDst++ = 0x8f;
+        *pbDst++ = 0x41;
+        *pbDst++ = RT_OFFSETOF(CIDETCPUCTX, aGRegs[X86_GREG_xCX]);
+        Assert(RT_OFFSETOF(CIDETCPUCTX, aGRegs[X86_GREG_xCX]) < 0x7f);
+
+        /* mov      [ss:rcx + ActualCtx.aGRegs[X86_GREG_xDX]], rdx */
+        *pbDst++ = 0x36;
+#ifdef RT_ARCH_AMD64
+        *pbDst++ = 0x48;
+#endif
+        *pbDst++ = 0x89;
+        *pbDst++ = 0x51;
+        *pbDst++ = RT_OFFSETOF(CIDETCPUCTX, aGRegs[X86_GREG_xDX]);
+        Assert(RT_OFFSETOF(CIDETCPUCTX, aGRegs[X86_GREG_xDX]) < 0x7f);
+
+        /* mov      [ss:rcx + ActualCtx.aSRegs[X86_GREG_DS]], ds */
+        *pbDst++ = 0x36;
+        *pbDst++ = 0x8c;
+        *pbDst++ = 0x99;
+        *(uint32_t *)pbDst = RT_OFFSETOF(CIDETCPUCTX, aSRegs[X86_SREG_DS]);
+        pbDst += sizeof(uint32_t);
+
+        /* mov      edx, 0XXYYh */
+        *pbDst++ = 0xba;
+        *(uint32_t *)pbDst = pThisApp->Core.InTemplateCtx.aSRegs[X86_SREG_DS];
+        pbDst   += sizeof(uint32_t);
+
+        /* mov      ds, dx */
+        *pbDst++ = 0x8e;
+        *pbDst++ = 0xda;
+
+        /* mov      xDX, &pThisApp->ExecuteCtx */
+#ifdef RT_ARCH_AMD64
+        *pbDst++ = 0x48;
+#endif
+        *pbDst++ = 0xba;
+        *(uintptr_t *)pbDst = (uintptr_t)&pThisApp->ExecuteCtx;
+        pbDst  += sizeof(uintptr_t);
+
+#ifdef RT_ARCH_AMD64
+        /* jmp      [cs:$ wrt rip] */
+        *pbDst++ = 0xff;
+        *pbDst++ = 0x25;
+        *(uint32_t *)pbDst = 0;
+        pbDst   += sizeof(uint32_t);
+#else
+        /* jmp      NAME(CidetAppSaveAndRestoreCtx) */
+        *pbDst++ = 0xb9;
+#endif
+        *(uintptr_t *)pbDst = (uintptr_t)CidetAppSaveAndRestoreCtx;
+        pbDst  += sizeof(uintptr_t);
+
+        /* int3 */
+        *pbDst++ = 0xcc;
+
+        pThisApp->fUsingLockedInt3 = false;
+
+    }
+    else
+    {
+        /*
+         * Tricky stack, so just make it raise #UD after a successful run.
+         */
+        *pbDst++ = 0xf0;         /* lock prefix */
+        memset(pbDst, 0xcc, 15); /* int3 */
+        pbDst += 15;
+
+        pThisApp->fUsingLockedInt3 = true;
+    }
+
+    AssertMsg(pbDst == &pAppBuf->pbNormal[pBuf->offActive + pBuf->cb + pBuf->cbEpilogue],
+              ("cbEpilogue=%#x, actual %#x\n", pBuf->cbEpilogue, pbDst - &pAppBuf->pbNormal[pBuf->offActive + pBuf->cb]));
+
+    /*
+     * Arm the buffer.
+     */
+    return CidetAppArmBuf(pThisApp, pAppBuf);
+}
+
+
+/**
+ * @interface_method_impl{CIDETCORE::pfnExecute}
+ */
+static DECLCALLBACK(bool) CidetAppCbExecute(PCIDETCORE pThis)
+{
+#if defined(RT_OS_WINDOWS) || defined(RT_OS_DARWIN)
+    /* Skip tricky stack because windows cannot dispatch exception if RSP/ESP is bad. */
+    if (pThis->InCtx.fTrickyStack)
+        return false;
+#endif
+
+    g_pExecutingThis = (PCIDETAPP)pThis;
+#ifdef RT_OS_WINDOWS
+    __try
+    {
+        CidetAppExecute(&((PCIDETAPP)pThis)->ExecuteCtx, &pThis->InCtx);
+    }
+    __except (CidetAppXcptFilter(GetExceptionInformation()))
+    {
+        /* Won't end up here... */
+    }
+    g_pExecutingThis = NULL;
+#else
+    CidetAppExecute(&((PCIDETAPP)pThis)->ExecuteCtx, &pThis->InCtx);
+    if (g_pExecutingThis)
+        g_pExecutingThis = NULL;
+    else
+    {
+        RTTESTI_CHECK_RC(sigprocmask(SIG_SETMASK, &g_ProcSigMask, NULL), 0);
+        RTTESTI_CHECK_RC(sigaltstack(&g_AltStack, NULL), 0);
+    }
+#endif
+
+    return true;
+}
+
+
+
+
+/*
+ *
+ *
+ * CIDET Application.
+ * CIDET Application.
+ * CIDET Application.
+ *
+ *
+ */
+
+
+/**
+ * @interface_method_impl{CIDETCORE::pfnSetupBuf}
+ */
+static DECLCALLBACK(void) CidetAppCbFailureV(PCIDETCORE pThis, const char *pszMsg, va_list va)
+{
+    RTTestIFailedV(pszMsg, va);
+}
+
+
+static int cidetAppAllocateAndConfigureBuffers(PCIDETAPP pThis)
+{
+    /*
+     * Code buffers.
+     */
+    for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCodeBuffers); i++)
+    {
+        int rc = cidetAppAllocateAndConfigureOneBuffer(pThis, &pThis->aCodeBuffers[i], i, true /*fCode*/,
+                                                       g_aCodeBufCfgs[i].fFlags);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    /*
+     * Data buffers.
+     */
+    for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aDataBuffers); i++)
+    {
+        int rc = cidetAppAllocateAndConfigureOneBuffer(pThis, &pThis->aDataBuffers[i], i, false /*fCode*/,
+                                                       g_aDataBufCfgs[i].fFlags);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+
+    /*
+     * Stack.
+     */
+    pThis->cbStack    = _32K;
+    pThis->pbStackLow = (uint8_t *)RTMemPageAlloc(pThis->cbStack);
+    if (!pThis->pbStackLow)
+    {
+        RTTestIFailed("Failed to allocate %u bytes for stack\n", pThis->cbStack);
+        return false;
+    }
+    pThis->pbStackEnd = pThis->pbStackLow + pThis->cbStack;
+
+    return true;
+}
+
+
+static int CidetAppCreate(PPCIDETAPP ppThis)
+{
+    *ppThis = NULL;
+
+    PCIDETAPP pThis = (PCIDETAPP)RTMemAlloc(sizeof(*pThis));
+    if (!pThis)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Error allocating %zu bytes.", sizeof(*pThis));
+
+    /* Create a random source. */
+    RTRAND hRand;
+    int rc = RTRandAdvCreateParkMiller(&hRand);
+    if (RT_SUCCESS(rc))
+    {
+        uint64_t uSeed = ASMReadTSC();
+        rc = RTRandAdvSeed(hRand, uSeed);
+        if (RT_SUCCESS(rc))
+            RTTestIPrintf(RTTESTLVL_ALWAYS, "Random seed %#llx\n", uSeed);
+
+        /* Initialize the CIDET structure. */
+        rc = CidetCoreInit(&pThis->Core, hRand);
+        if (RT_SUCCESS(rc))
+        {
+            pThis->Core.pfnReInitDataBuf    = CidetAppCbReInitDataBuf;
+            pThis->Core.pfnSetupDataBuf     = CidetAppCbSetupDataBuf;
+            pThis->Core.pfnIsBufEqual       = CidetAppCbIsBufEqual;
+            pThis->Core.pfnReInitCodeBuf    = CidetAppCbReInitCodeBuf;
+            pThis->Core.pfnSetupCodeBuf     = CidetAppCbSetupCodeBuf;
+            pThis->Core.pfnExecute          = CidetAppCbExecute;
+            pThis->Core.pfnFailure          = CidetAppCbFailureV;
+
+            pThis->Core.paCodeBufConfigs    = g_aCodeBufCfgs;
+            pThis->Core.cCodeBufConfigs     = CIDETAPP_CODE_BUF_COUNT;
+            pThis->Core.paDataBufConfigs    = g_aDataBufCfgs;
+            pThis->Core.cDataBufConfigs     = CIDETAPP_DATA_BUF_COUNT;
+
+            rc = cidetAppAllocateAndConfigureBuffers(pThis);
+            if (RT_SUCCESS(rc))
+            {
+                rc = CidetCoreSetTargetMode(&pThis->Core, ARCH_BITS == 32 ? CIDETMODE_PP_32 : CIDETMODE_LM_64);
+                if (RT_SUCCESS(rc))
+                {
+                    pThis->Core.InTemplateCtx.aSRegs[X86_SREG_CS] = ASMGetCS();
+                    pThis->Core.InTemplateCtx.aSRegs[X86_SREG_DS] = ASMGetDS();
+                    pThis->Core.InTemplateCtx.aSRegs[X86_SREG_ES] = ASMGetES();
+                    pThis->Core.InTemplateCtx.aSRegs[X86_SREG_FS] = ASMGetFS();
+                    pThis->Core.InTemplateCtx.aSRegs[X86_SREG_GS] = ASMGetGS();
+                    pThis->Core.InTemplateCtx.aSRegs[X86_SREG_SS] = ASMGetSS();
+                    pThis->Core.InTemplateCtx.aGRegs[X86_GREG_xSP] = (uintptr_t)pThis->pbStackEnd - 64;
+
+                    pThis->Core.fTestCfg |= CIDET_TESTCFG_SEG_PRF_CS;
+                    pThis->Core.fTestCfg |= CIDET_TESTCFG_SEG_PRF_DS;
+                    pThis->Core.fTestCfg |= CIDET_TESTCFG_SEG_PRF_ES;
+#if !defined(RT_OS_WINDOWS)
+                    pThis->Core.fTestCfg |= CIDET_TESTCFG_SEG_PRF_FS;
+#endif
+#if !defined(CIDET_LEAVE_GS_ALONE)
+                    pThis->Core.fTestCfg |= CIDET_TESTCFG_SEG_PRF_GS;
+#endif
+
+                    *ppThis = pThis;
+                    return VINF_SUCCESS;
+                }
+                rc = RTTestIFailedRc(rc, "Error setting target mode: %Rrc", rc);
+            }
+            CidetCoreDelete(&pThis->Core);
+        }
+        else
+        {
+            rc = RTTestIFailedRc(rc, "CidetCoreInit failed: %Rrc", rc);
+            RTRandAdvDestroy(hRand);
+        }
+    }
+    else
+        rc = RTTestIFailedRc(rc, "RTRandAdvCreate failed: %Rrc", rc);
+    RTMemFree(pThis);
+    return rc;
+}
+
+
+static void CidetAppDestroy(PCIDETAPP pThis)
+{
+    CidetCoreDelete(&pThis->Core);
+
+    for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCodeBuffers); i++)
+        CidetAppDeleteBuffer(&pThis->aCodeBuffers[i]);
+    for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aDataBuffers); i++)
+        CidetAppDeleteBuffer(&pThis->aDataBuffers[i]);
+    RTMemPageFree(pThis->pbStackLow, pThis->cbStack);
+
+    RTMemFree(pThis);
+}
+
+
+static void CidetAppTestBunch(PCIDETAPP pThis, PCCIDETINSTR paInstructions, uint32_t cInstructions, const char *pszBunchName)
+{
+    for (uint32_t iInstr = 0; iInstr < cInstructions; iInstr++)
+    {
+        RTTestSubF(g_hTest, "%s - %s", pszBunchName, paInstructions[iInstr].pszMnemonic);
+        CidetCoreTestInstruction(&pThis->Core, &paInstructions[iInstr]);
+    }
+}
+
+
+int main(int argc, char **argv)
+{
+    /*
+     * Initialize the runtime.
+     */
+    RTEXITCODE rcExit = RTTestInitExAndCreate(argc, &argv, 0, "cidet-app", &g_hTest);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+
+    /*
+     * Parse arguments.
+     */
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--noop", 'n', RTGETOPT_REQ_NOTHING },
+    };
+
+    int           chOpt;
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0);
+    while ((chOpt = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (chOpt)
+        {
+            case 'n':
+                break;
+
+            case 'h':
+                RTPrintf("usage: %s\n", argv[0]);
+                return RTEXITCODE_SUCCESS;
+
+            case 'V':
+                RTPrintf("%sr%d\n", RTBldCfgVersion(), RTBldCfgRevision());
+                return RTEXITCODE_SUCCESS;
+
+            default:
+                return RTGetOptPrintError(chOpt, &ValueUnion);
+        }
+    }
+
+#ifdef USE_SIGNALS
+    /*
+     * Set up signal handlers with alternate stack.
+     */
+    /* Get the default signal mask. */
+    RTTESTI_CHECK_RC_RET(sigprocmask(SIG_BLOCK, NULL, &g_ProcSigMask), 0, RTEXITCODE_FAILURE);
+
+    /* Alternative stack so we can play with esp/rsp. */
+    RT_ZERO(g_AltStack);
+    g_AltStack.ss_flags = 0;
+# ifdef SIGSTKSZ
+    g_AltStack.ss_size  = RT_MAX(SIGSTKSZ, _128K);
+# else
+    g_AltStack.ss_size  = _128K;
+# endif
+#ifdef RT_OS_FREEBSD
+    g_AltStack.ss_sp    = (char *)RTMemPageAlloc(g_AltStack.ss_size);
+#else
+    g_AltStack.ss_sp    = RTMemPageAlloc(g_AltStack.ss_size);
+#endif
+    RTTESTI_CHECK_RET(g_AltStack.ss_sp != NULL, RTEXITCODE_FAILURE);
+    RTTESTI_CHECK_RC_RET(sigaltstack(&g_AltStack, NULL), 0, RTEXITCODE_FAILURE);
+
+    /* Default signal action config. */
+    struct sigaction Act;
+    RT_ZERO(Act);
+    Act.sa_sigaction  = CidetAppSigHandler;
+    Act.sa_flags      = SA_SIGINFO | SA_ONSTACK;
+    sigfillset(&Act.sa_mask);
+
+    /* Hook the signals we might need. */
+    sigaction(SIGILL,  &Act, NULL);
+    sigaction(SIGTRAP, &Act, NULL);
+# ifdef SIGEMT
+    sigaction(SIGEMT,  &Act, NULL);
+# endif
+    sigaction(SIGFPE,  &Act, NULL);
+    sigaction(SIGBUS,  &Act, NULL);
+    sigaction(SIGSEGV, &Act, NULL);
+
+#elif defined(RT_OS_WINDOWS)
+    /*
+     * Register vectored exception handler and override the default unhandled
+     * exception filter, just to be on the safe side...
+     */
+    RTTESTI_CHECK(AddVectoredExceptionHandler(1 /* first */, CidetAppVectoredXcptHandler) != NULL);
+    SetUnhandledExceptionFilter(CidetAppUnhandledXcptFilter);
+#endif
+
+    /*
+     * Do the work.
+     */
+    RTTestBanner(g_hTest);
+
+    PCIDETAPP pThis;
+    int rc = CidetAppCreate(&pThis);
+    if (RT_SUCCESS(rc))
+    {
+        CidetAppTestBunch(pThis, g_aCidetInstructions1, g_cCidetInstructions1, "First Bunch");
+
+        CidetAppDestroy(pThis);
+    }
+
+    return RTTestSummaryAndDestroy(g_hTest);
+}
+
diff --git a/src/VBox/ValidationKit/utils/cpu/cidet-appA.asm b/src/VBox/ValidationKit/utils/cpu/cidet-appA.asm
new file mode 100644
index 0000000..f4aef8a
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/cidet-appA.asm
@@ -0,0 +1,309 @@
+; $Id: cidet-appA.asm $
+;; @file
+; CPU Instruction Decoding & Execution Tests - Ring-3 Driver Application, Assembly Code.
+;
+
+;
+; Copyright (C) 2009-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;*******************************************************************************
+;*  Header Files                                                               *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+%include "iprt/x86.mac"
+%include "cidet.mac"
+
+
+;*******************************************************************************
+;*      Global Variables                                                       *
+;*******************************************************************************
+%ifdef RT_ARCH_X86
+;; Used by CidetAppSaveAndRestoreCtx when we have a tricky target stack.
+g_uTargetEip    dd 0
+g_uTargetCs     dw 0
+%endif
+
+
+;;
+; Leave GS alone on 64-bit darwin (gs is 0, no ldt or gdt entry to load that'll
+; restore the lower 32-bits of the base when saving and restoring the register).
+%ifdef RT_OS_DARWIN
+ %ifdef RT_ARCH_AMD64
+  %define CIDET_LEAVE_GS_ALONE
+ %endif
+%endif
+
+
+
+BEGINCODE
+
+;;
+; ASSUMES that it's called and the EIP/RIP is found on the stack.
+;
+; @param    pSaveCtx     ds:xCX     The context to save; DS, xDX and xCX have
+;                                   already been saved by the caller.
+; @param    pRestoreCtx  ds:xDX     The context to restore.
+;
+BEGINPROC   CidetAppSaveAndRestoreCtx
+        ;
+        ; Save the stack pointer and program counter first so we can later
+        ; bypass this step if we need to.
+        ;
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xAX * 8], xAX ; need scratch register.
+        lea     xAX, [xSP + xCB]
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xSP * 8], xAX
+        mov     word [xCX + CIDETCPUCTX.aSRegs + X86_SREG_SS * 2], ss
+        mov     word [xCX + CIDETCPUCTX.aSRegs + X86_SREG_CS * 2], cs
+        mov     xAX, [xSP]
+        mov     [xCX + CIDETCPUCTX.rip], xAX
+        jmp     CidetAppSaveAndRestoreCtx_1
+
+GLOBALNAME CidetAppSaveAndRestoreCtx_NoSsSpCsIp
+        mov     [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xAX * 8], xAX
+CidetAppSaveAndRestoreCtx_1:
+
+        ; Flags.
+%ifdef RT_ARCH_AMD64
+        pushfq
+%else
+        pushfd
+%endif
+        pop     xAX
+        mov     [xCX + CIDETCPUCTX.rfl], xAX
+
+        ; Segment registers.
+        mov     word [xCX + CIDETCPUCTX.aSRegs + X86_SREG_ES * 2], es
+        mov     word [xCX + CIDETCPUCTX.aSRegs + X86_SREG_FS * 2], fs
+        mov     word [xCX + CIDETCPUCTX.aSRegs + X86_SREG_GS * 2], gs
+
+        ; Remaining GPRs.
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xBX * 8], xBX
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xBP * 8], xBP
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xSI * 8], xSI
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xDI * 8], xDI
+%ifdef RT_ARCH_AMD64
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x8  * 8], r8
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x9  * 8], r9
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x10 * 8], r10
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x11 * 8], r11
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x12 * 8], r12
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x13 * 8], r13
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x14 * 8], r14
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x15 * 8], r15
+        xor     eax, eax
+        mov     [xCX + CIDETCPUCTX.cr2], rax
+ %ifndef CIDET_REDUCED_CTX
+        mov     [xCX + CIDETCPUCTX.cr0], rax
+        mov     [xCX + CIDETCPUCTX.cr3], rax
+        mov     [xCX + CIDETCPUCTX.cr4], rax
+        mov     [xCX + CIDETCPUCTX.cr8], rax
+        mov     [xCX + CIDETCPUCTX.dr0], rax
+        mov     [xCX + CIDETCPUCTX.dr1], rax
+        mov     [xCX + CIDETCPUCTX.dr2], rax
+        mov     [xCX + CIDETCPUCTX.dr3], rax
+        mov     [xCX + CIDETCPUCTX.dr6], rax
+        mov     [xCX + CIDETCPUCTX.dr7], rax
+        mov     [xCX + CIDETCPUCTX.tr], ax
+        mov     [xCX + CIDETCPUCTX.ldtr], ax
+ %endif
+%else
+        xor     eax, eax
+        mov     [xCX + CIDETCPUCTX.rfl + 4], eax
+        mov     [xCX + CIDETCPUCTX.rip + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xAX * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xCX * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xDX * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xBX * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xSP * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xBP * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xSI * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xDI * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x8  * 8    ], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x8  * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x9  * 8    ], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x9  * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x10 * 8    ], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x10 * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x11 * 8    ], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x11 * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x12 * 8    ], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x12 * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x13 * 8    ], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x13 * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x14 * 8    ], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x14 * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x15 * 8    ], eax
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_x15 * 8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.cr2    ], eax
+        mov     [xCX + CIDETCPUCTX.cr2 + 4], eax
+ %ifndef CIDET_REDUCED_CTX
+        mov     [xCX + CIDETCPUCTX.cr0    ], eax
+        mov     [xCX + CIDETCPUCTX.cr0 + 4], eax
+        mov     [xCX + CIDETCPUCTX.cr3    ], eax
+        mov     [xCX + CIDETCPUCTX.cr3 + 4], eax
+        mov     [xCX + CIDETCPUCTX.cr4    ], eax
+        mov     [xCX + CIDETCPUCTX.cr4 + 4], eax
+        mov     [xCX + CIDETCPUCTX.cr8    ], eax
+        mov     [xCX + CIDETCPUCTX.cr8 + 4], eax
+        mov     [xCX + CIDETCPUCTX.dr0    ], eax
+        mov     [xCX + CIDETCPUCTX.dr0 + 4], eax
+        mov     [xCX + CIDETCPUCTX.dr1    ], eax
+        mov     [xCX + CIDETCPUCTX.dr1 + 4], eax
+        mov     [xCX + CIDETCPUCTX.dr2    ], eax
+        mov     [xCX + CIDETCPUCTX.dr2 + 4], eax
+        mov     [xCX + CIDETCPUCTX.dr3    ], eax
+        mov     [xCX + CIDETCPUCTX.dr3 + 4], eax
+        mov     [xCX + CIDETCPUCTX.dr6    ], eax
+        mov     [xCX + CIDETCPUCTX.dr6 + 4], eax
+        mov     [xCX + CIDETCPUCTX.dr7    ], eax
+        mov     [xCX + CIDETCPUCTX.dr7 + 4], eax
+        mov     [xCX + CIDETCPUCTX.tr], ax
+        mov     [xCX + CIDETCPUCTX.ldtr], ax
+ %endif
+%endif
+        dec     xAX
+        mov     [xCX + CIDETCPUCTX.uErr], xAX
+%ifdef RT_ARCH_X86
+        mov     [xCX + CIDETCPUCTX.uErr + 4], eax
+%endif
+        mov     [xCX + CIDETCPUCTX.uXcpt], eax
+
+        ;
+        ; Restore the other state (pointer in xDX).
+        ;
+NAME(CidetAppSaveAndRestoreCtx_Restore):
+
+        ; Restore ES, FS, and GS.
+        mov     es, [xDX + CIDETCPUCTX.aSRegs + X86_SREG_ES * 2]
+        mov     fs, [xDX + CIDETCPUCTX.aSRegs + X86_SREG_FS * 2]
+%ifndef CIDET_LEAVE_GS_ALONE
+        mov     gs, [xDX + CIDETCPUCTX.aSRegs + X86_SREG_GS * 2]
+%endif
+
+        ; Restore most GPRs (except xCX, xAX and xSP).
+        mov     xCX, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xCX * 8]
+        mov     xBX, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xBX * 8]
+        mov     xBP, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xBP * 8]
+        mov     xSI, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xSI * 8]
+        mov     xDI, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xDI * 8]
+%ifdef RT_ARCH_AMD64
+        mov     r8,  [xDX + CIDETCPUCTX.aGRegs + X86_GREG_x8  * 8]
+        mov     r9,  [xDX + CIDETCPUCTX.aGRegs + X86_GREG_x9  * 8]
+        mov     r10, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_x10 * 8]
+        mov     r11, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_x11 * 8]
+        mov     r12, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_x12 * 8]
+        mov     r13, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_x13 * 8]
+        mov     r14, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_x14 * 8]
+        mov     r15, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_x15 * 8]
+%endif
+
+%ifdef RT_ARCH_AMD64
+        ; Create an iret frame which restores SS:RSP, RFLAGS, and CS:RIP.
+        movzx   eax, word [xDX + CIDETCPUCTX.aSRegs + X86_SREG_SS * 2]
+        push    xAX
+        push    qword [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xSP * 8]
+        push    qword [xDX + CIDETCPUCTX.rfl]
+        movzx   eax, word [xDX + CIDETCPUCTX.aSRegs + X86_SREG_CS * 2]
+        push    xAX
+        push    qword [xDX + CIDETCPUCTX.rip]
+
+        ; Restore DS, xAX and xDX then do the iret.
+        mov     ds, [xDX + CIDETCPUCTX.aSRegs + X86_SREG_DS * 2]
+        mov     xAX, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xAX * 8]
+        mov     xDX, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xDX * 8]
+        iretq
+%else
+        ; In 32-bit mode iret doesn't restore CS:ESP for us, so we have to
+        ; make a choice whether the SS:ESP is more important than EFLAGS.
+        cmp     byte [xDX + CIDETCPUCTX.fTrickyStack], 0
+        jne     .tricky_stack
+
+        mov     ss,  [xDX + CIDETCPUCTX.aSRegs + X86_SREG_SS * 2]
+        mov     xSP, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xSP * 8]
+
+        push    dword [xDX + CIDETCPUCTX.rfl]                           ; iret frame
+        movzx   eax, word [xDX + CIDETCPUCTX.aSRegs + X86_SREG_CS * 2]  ; iret frame
+        push    xAX                                                     ; iret frame
+        push    dword [xDX + CIDETCPUCTX.rip]                           ; iret frame
+
+        mov     xAX, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xAX * 8]
+        mov     ds,  [xDX + CIDETCPUCTX.aSRegs + X86_SREG_DS * 2]
+        mov     xDX, [cs:xDX + CIDETCPUCTX.aGRegs + X86_GREG_xDX * 8]
+        iretd
+
+.tricky_stack:
+        mov     xAX, [xDX + CIDETCPUCTX.rip]
+        mov     [g_uTargetEip], xAX
+        mov     ax, [xDX + CIDETCPUCTX.aSRegs + X86_SREG_CS * 2]
+        mov     [g_uTargetCs], ax
+        push    dword [xDX + CIDETCPUCTX.rfl]
+        popfd
+        mov     ss,  [xDX + CIDETCPUCTX.aSRegs + X86_SREG_SS * 2]
+        mov     xSP, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xSP * 8]
+        mov     xAX, [xDX + CIDETCPUCTX.aGRegs + X86_GREG_xAX * 8]
+        mov     ds,  [xDX + CIDETCPUCTX.aSRegs + X86_SREG_DS * 2]
+        mov     xDX, [cs:xDX + CIDETCPUCTX.aGRegs + X86_GREG_xDX * 8]
+        jmp     far [cs:g_uTargetEip]
+%endif
+ENDPROC     CidetAppSaveAndRestoreCtx
+
+
+;;
+; C callable version of CidetAppSaveAndRestoreCtx more or less.
+;
+; @param    pSaveCtx     x86:esp+4  gcc:rdi  msc:rcx
+; @param    pRestoreCtx  x86:esp+8  gcc:rsi  msc:rdx
+BEGINPROC   CidetAppExecute
+%ifdef RT_ARCH_X86
+        mov     ecx, [esp + 4]
+        mov     edx, [esp + 8]
+%elifdef ASM_CALL64_GCC
+        mov     rcx, rdi
+        mov     rdx, rsi
+%elifndef ASM_CALL64_MSC
+ %error "unsupport arch."
+%endif
+        mov     word [xCX + CIDETCPUCTX.aSRegs + X86_SREG_DS * 2], ds
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xDX * 8], xDX
+        mov     [xCX + CIDETCPUCTX.aGRegs + X86_GREG_xCX * 8], xCX
+        jmp     NAME(CidetAppSaveAndRestoreCtx)
+ENDPROC     CidetAppExecute
+
+
+;;
+; C callable restore function.
+;
+; @param    pRestoreCtx  x86:esp+4  gcc:rdi  msc:rcx
+BEGINPROC   CidetAppRestoreCtx
+%ifdef RT_ARCH_X86
+        mov     edx, [esp + 4]
+%elifdef ASM_CALL64_GCC
+        mov     rdx, rdi
+%elifdef ASM_CALL64_MSC
+        mov     rdx, rcx
+%else
+ %error "unsupport arch."
+%endif
+        mov     ds, [cs:xDX + CIDETCPUCTX.aSRegs + X86_SREG_DS * 2]
+        jmp     NAME(CidetAppSaveAndRestoreCtx_Restore)
+ENDPROC     CidetAppRestoreCtx
+
diff --git a/src/VBox/ValidationKit/utils/cpu/cidet-core.cpp b/src/VBox/ValidationKit/utils/cpu/cidet-core.cpp
new file mode 100644
index 0000000..bebcf5c
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/cidet-core.cpp
@@ -0,0 +1,2351 @@
+/* $Id: cidet-core.cpp $ */
+/** @file
+ * CPU Instruction Decoding & Execution Tests - Simple Instructions.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+#define CIDET_INSTR_TEST_OP_FLAG(a_pInstr, a_fFlag) \
+    (   ((a_pInstr)->afOperands[0] & (a_fFlag)) \
+     || ((a_pInstr)->afOperands[1] & (a_fFlag)) \
+     || (   (a_pInstr)->cOperands > 2 \
+         && (   ((a_pInstr)->afOperands[2] & (a_fFlag)) \
+             || ((a_pInstr)->afOperands[3] & (a_fFlag))  ) ) )
+
+#define CIDET_INSTR_TEST_OP_MASK_VALUE(a_pInstr, a_fMask, a_fValue) \
+    (   ((a_pInstr)->afOperands[0] & (a_fMask)) == (a_fValue) \
+     || ((a_pInstr)->afOperands[1] & (a_fMask)) == (a_fValue) \
+     || (   (a_pInstr)->cOperands > 2 \
+         && (   ((a_pInstr)->afOperands[2] & (a_fMask)) == (a_fValue) \
+             || ((a_pInstr)->afOperands[3] & (a_fMask)) == (a_fValue) ) ) )
+
+/** @def CIDET_DPRINTF
+ * Debug printf. */
+#if 1 //def DEBUG_bird
+# define CIDET_DPRINTF(a)   do { RTPrintf a; } while (0)
+# define CIDET_DPRINTF_ENABLED
+#else
+# define CIDET_DPRINTF(a)   do { } while (0)
+#endif
+
+/** @def CIDET_DEBUG_DISAS
+ * Enables instruction disassembly. */
+#if defined(DOXYGEN_RUNNING)
+# define CIDET_DEBUG_DISAS 1
+#endif
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "cidet.h"
+
+#include <iprt/assert.h>
+#include <iprt/rand.h>
+#include <iprt/param.h>
+#include <iprt/string.h>
+#include <VBox/err.h>
+#if defined(CIDET_DPRINTF_ENABLED) || defined(CIDET_DEBUG_DISAS)
+# include <VBox/dis.h>
+# include <iprt/stream.h>
+#endif
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** For translating CIDET_OF_Z_XXX values (after shifting). */
+uint16_t const g_acbCidetOfSizes[] =
+{
+    /* [CIDET_OF_Z_NONE]    = */  0,
+    /* [CIDET_OF_Z_BYTE]    = */  1,
+    /* [CIDET_OF_Z_WORD]    = */  2,
+    /* [CIDET_OF_Z_DWORD]   = */  4,
+    /* [CIDET_OF_Z_QWORD]   = */  8,
+    /* [CIDET_OF_Z_TBYTE]   = */  10,
+    /* [CIDET_OF_Z_OWORD]   = */  16,
+    /* [CIDET_OF_Z_YWORD]   = */  32,
+    /* [CIDET_OF_Z_ZWORD]   = */  64,
+    /* [CIDET_OF_Z_VAR_WDQ] = */  UINT16_MAX,
+    /* [0xa] = */                 0,
+    /* [0xb] = */                 0,
+    /* [0xc] = */                 0,
+    /* [0xd] = */                 0,
+    /* [0xe] = */                 0,
+    /* [CIDET_OF_Z_SPECIAL] = */  UINT16_MAX - 1,
+};
+
+
+/** Converts operand sizes in bytes to 64-bit masks. */
+static const uint64_t g_au64ByteSizeToMask[] =
+{
+    UINT64_C(0x0000000000000000),
+    UINT64_C(0x00000000000000ff),
+    UINT64_C(0x000000000000ffff),
+    UINT64_C(0x0000000000ffffff),
+    UINT64_C(0x00000000ffffffff),
+    UINT64_C(0x000000ffffffffff),
+    UINT64_C(0x0000ffffffffffff),
+    UINT64_C(0x00ffffffffffffff),
+    UINT64_C(0xffffffffffffffff),
+};
+
+/** Converts operand sizes in bytes to 64-bit signed max values. */
+static const int64_t g_ai64ByteSizeToMax[] =
+{
+    INT64_C(0x0000000000000000),
+    INT64_C(0x000000000000007f),
+    INT64_C(0x0000000000007fff),
+    INT64_C(0x00000000007fffff),
+    INT64_C(0x000000007fffffff),
+    INT64_C(0x0000007fffffffff),
+    INT64_C(0x00007fffffffffff),
+    INT64_C(0x007fffffffffffff),
+    INT64_C(0x7fffffffffffffff),
+};
+
+
+bool CidetInstrHasMrmMemOperand(PCCIDETINSTR pInstr)
+{
+    return CIDET_INSTR_TEST_OP_FLAG(pInstr, CIDET_OF_M_RM_ONLY_M);
+}
+
+
+bool CidetInstrHasMrmRegOperand(PCCIDETINSTR pInstr)
+{
+    return CIDET_INSTR_TEST_OP_FLAG(pInstr, CIDET_OF_M_RM_ONLY_R);
+}
+
+
+bool CidetInstrRespondsToOperandSizePrefixes(PCCIDETINSTR pInstr)
+{
+    return CIDET_INSTR_TEST_OP_MASK_VALUE(pInstr, CIDET_OF_Z_MASK, CIDET_OF_Z_VAR_WDQ);
+}
+
+
+
+
+int CidetCoreInit(PCIDETCORE pThis, RTRAND hRand)
+{
+    AssertPtr(pThis);
+    AssertPtr(hRand);
+
+    RT_ZERO(*pThis);
+    pThis->u32Magic  = CIDETCORE_MAGIC;
+    pThis->hRand = hRand;
+    return VINF_SUCCESS;
+}
+
+
+void CidetCoreDelete(PCIDETCORE pThis)
+{
+    AssertPtr(pThis); Assert(pThis->u32Magic == CIDETCORE_MAGIC);
+
+    RTRandAdvDestroy(pThis->hRand);
+    RT_ZERO(*pThis);
+}
+
+
+/**
+ * Report a test failure via CIDET::pfnFailure
+ *
+ * @returns false
+ * @param   pThis           Pointer to the core structure.
+ * @param   pszFormat       Format string containing failure details.
+ * @param   va              Arguments referenced in @a pszFormat.
+ */
+int CidetCoreSetErrorV(PCIDETCORE pThis, const char *pszFormat, va_list va)
+{
+    pThis->pfnFailure(pThis, pszFormat, va);
+    return false;
+}
+
+
+/**
+ * Report a test failure via CIDET::pfnFailure
+ *
+ * @returns false
+ * @param   pThis           Pointer to the core structure.
+ * @param   pszFormat       Format string containing failure details.
+ * @param   ...             Arguments referenced in @a pszFormat.
+ */
+bool CidetCoreSetError(PCIDETCORE pThis, const char *pszFormat, ...)
+{
+    va_list va;
+    va_start(va, pszFormat);
+    CidetCoreSetErrorV(pThis, pszFormat, va);
+    va_end(va);
+    return false;
+}
+
+
+/**
+ * Get a signed random number, with a given number of significant bytes.
+ *
+ * @returns Random number.
+ * @param   pThis           Pointer to the core structure.
+ * @param   cbSignificant   The number of significant bytes.
+ */
+int64_t CidetCoreGetRandS64(PCIDETCORE pThis, uint8_t cbSignificant)
+{
+    int64_t iVal = RTRandAdvS64(pThis->hRand);
+    switch (cbSignificant)
+    {
+        case 1: return (int8_t)iVal;
+        case 2: return (int16_t)iVal;
+        case 4: return (int32_t)iVal;
+        case 8: return iVal;
+        default:
+            AssertReleaseFailed();
+            return iVal;
+    }
+}
+
+
+/**
+ * Get an unsigned random number, with a given number of significant bytes.
+ *
+ * @returns Random number.
+ * @param   pThis           Pointer to the core structure.
+ * @param   cbSignificant   The number of significant bytes.
+ */
+uint64_t CidetCoreGetRandU64(PCIDETCORE pThis, uint8_t cbSignificant)
+{
+    Assert(cbSignificant == 1 || cbSignificant == 2 || cbSignificant == 4 || cbSignificant == 8);
+
+    uint64_t uVal = RTRandAdvU64(pThis->hRand);
+    uVal &= g_au64ByteSizeToMask[cbSignificant];
+
+    return uVal;
+}
+
+
+
+void CidetCoreInitializeCtxTemplate(PCIDETCORE pThis)
+{
+    pThis->InTemplateCtx.rip = UINT64_MAX;
+    pThis->InTemplateCtx.rfl = X86_EFL_1 | X86_EFL_ID | X86_EFL_IF;
+
+    unsigned i = RT_ELEMENTS(pThis->InTemplateCtx.aGRegs);
+    if (CIDETMODE_IS_LM(pThis->bMode))
+        while (i-- > 0)
+            pThis->InTemplateCtx.aGRegs[i] = UINT64_C(0x3fefcc00daba005d)
+                                           | ((uint64_t)i << 32)
+                                           | ((uint32_t)i << 8);
+    else
+        while (i-- > 0)
+            pThis->InTemplateCtx.aGRegs[i] = UINT64_C(0xfada009b)
+                                           | ((uint32_t)i << 12)
+                                           | ((uint32_t)i << 8);
+    i = RT_ELEMENTS(pThis->InTemplateCtx.aSRegs);
+    while (i-- > 0)
+        pThis->InTemplateCtx.aSRegs[i] = 0; /* Front end sets these afterwards. */
+    pThis->InTemplateCtx.cr2  = 0;
+#ifndef CIDET_REDUCED_CTX
+    pThis->InTemplateCtx.tr   = 0;
+    pThis->InTemplateCtx.ldtr = 0;
+    pThis->InTemplateCtx.cr0  = 0;
+    pThis->InTemplateCtx.cr3  = 0;
+    pThis->InTemplateCtx.cr4  = 0;
+    pThis->InTemplateCtx.cr8  = 0;
+#endif
+    pThis->InTemplateCtx.fIgnoredRFlags = 0;
+    pThis->InTemplateCtx.uXcpt          = UINT32_MAX;
+    pThis->InTemplateCtx.uErr           = UINT64_MAX;
+    pThis->InTemplateCtx.fTrickyStack   = false;
+}
+
+
+/**
+ * Sets the target mode.
+ *
+ * Caller must set up default selector values after calling this function.
+ *
+ * @returns VBox status code.
+ * @param   pThis           Pointer to the core structure.
+ * @param   bMode           The new mode.
+ */
+int CidetCoreSetTargetMode(PCIDETCORE pThis, uint8_t bMode)
+{
+    AssertPtrReturn(pThis, VERR_INVALID_HANDLE); AssertReturn(pThis->u32Magic == CIDETCORE_MAGIC, VERR_INVALID_HANDLE);
+    switch (bMode)
+    {
+        //case CIDETMODE_RM:
+        //case CIDETMODE_PE_16:
+        //case CIDETMODE_PE_32:
+        //case CIDETMODE_PE_V86:
+        //case CIDETMODE_PP_16:
+        case CIDETMODE_PP_32:
+        //case CIDETMODE_PP_V86:
+        //case CIDETMODE_PAE_16:
+        case CIDETMODE_PAE_32:
+        //case CIDETMODE_PAE_V86:
+        //case CIDETMODE_LM_S16:
+        //case CIDETMODE_LM_32:
+        case CIDETMODE_LM_64:
+            break;
+        default:
+            return VERR_NOT_IMPLEMENTED;
+    }
+    pThis->bMode = bMode;
+    CidetCoreInitializeCtxTemplate(pThis);
+    return VINF_SUCCESS;
+}
+
+
+bool CidetCoreIsEncodingCompatibleWithInstruction(PCIDETCORE pThis)
+{
+    return true;
+}
+
+
+/**
+ * Selects the next address size mode.
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ */
+static bool cidetCoreSetupNextBaseEncoding_AddressSize(PCIDETCORE pThis)
+{
+    if (pThis->fAddrSizePrf)
+    {
+        /*
+         * Reset to default.
+         */
+        pThis->cbAddrMode   = CIDETMODE_GET_BYTE_COUNT(pThis->bMode);
+        pThis->fAddrSizePrf = false;
+    }
+    else
+    {
+        /*
+         * The other addressing size.
+         */
+        if (CIDETMODE_IS_64BIT(pThis->bMode))
+            pThis->cbAddrMode = 4;
+        else if (CIDETMODE_IS_32BIT(pThis->bMode))
+            pThis->cbAddrMode = 2;
+        else
+        {
+            AssertRelease(CIDETMODE_IS_16BIT(pThis->bMode));
+            pThis->cbAddrMode = 2;
+        }
+        pThis->fAddrSizePrf = true;
+    }
+    return pThis->fAddrSizePrf;
+}
+
+
+/**
+ * Selects the first REG encoding.
+ *
+ * @param   pThis               The core state structure.
+ */
+static void cidetCoreSetupFirstBaseEncoding_MrmReg(PCIDETCORE pThis)
+{
+    pThis->aOperands[pThis->idxMrmRegOp].iReg            = 0;
+    pThis->aOperands[pThis->idxMrmRegOp].fIsMem          = false;
+    pThis->aOperands[pThis->idxMrmRegOp].fIsRipRelative  = false;
+    pThis->aOperands[pThis->idxMrmRegOp].fIsHighByteRegister = false;
+    pThis->aOperands[pThis->idxMrmRegOp].cbMemDisp       = 0;
+    pThis->aOperands[pThis->idxMrmRegOp].iMemBaseReg     = UINT8_MAX;
+    pThis->aOperands[pThis->idxMrmRegOp].iMemIndexReg    = UINT8_MAX;
+    pThis->aOperands[pThis->idxMrmRegOp].uMemScale       = 1;
+    pThis->aOperands[pThis->idxMrmRegOp].iEffSeg         = UINT8_MAX;
+    pThis->bModRm  &= ~X86_MODRM_REG_MASK;
+    pThis->fRexR    = false;
+}
+
+
+/**
+ * Selects the next REG (ModR/M) encoding.
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ */
+static bool cidetCoreSetupNextBaseEncoding_MrmReg(PCIDETCORE pThis, uint8_t iReg)
+{
+    Assert(pThis->idxMrmRegOp < RT_ELEMENTS(pThis->aOperands) && !pThis->aOperands[pThis->idxMrmRegOp].fIsMem);
+    Assert(iReg < 16);
+
+    /*
+     * Clear the collision flags here because of the byte register kludge.
+     */
+    pThis->fHasRegCollisionDirect   = false;
+    pThis->fHasRegCollisionMemBase  = false;
+    pThis->fHasRegCollisionMemIndex = false;
+    pThis->fHasRegCollisionMem      = false;
+
+    /*
+     * Clear the REX prefix and high byte register tracking too.  ASSUMES MrmReg is after MrmRmMod.
+     */
+    Assert(!pThis->fNoRexPrefixMrmRm);
+    Assert(!pThis->fHasHighByteRegInMrmRm);
+    pThis->fNoRexPrefixMrmReg = false;
+    pThis->fNoRexPrefix = false;
+    pThis->fHasHighByteRegInMrmReg = false;
+    pThis->aOperands[pThis->idxMrmRegOp].fIsHighByteRegister = false;
+
+    /*
+     * Special kludge for ah, ch, dh, bh, spl, bpl, sil, and dil.
+     * Needs extra care in 64-bit mode and special collision detection code.
+     */
+    CIDET_DPRINTF(("aOperands[%u].cb=%u fGpr=%u iReg=%d fRex=%d fRexW=%u fRexX=%u fRexB=%u fRexR=%d\n",
+                   pThis->idxMrmRegOp, pThis->aOperands[pThis->idxMrmRegOp].cb, CIDET_OF_K_IS_GPR(pThis->fMrmRegOp), iReg,
+                   pThis->fRex, pThis->fRexW, pThis->fRexX, pThis->fRexB, pThis->fRexR));
+    if (   pThis->aOperands[pThis->idxMrmRegOp].cb == 1
+        && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp)
+        && iReg >= 3
+        && (   iReg <= 6
+            || (CIDETMODE_IS_64BIT(pThis->bMode) && iReg == 7 && !pThis->fRex)) )
+
+    {
+        if (!pThis->fRex && iReg >= 4 && CIDETMODE_IS_64BIT(pThis->bMode) && !pThis->fNoRexPrefix)
+        {
+            /* The AMD64 low variants: spl, bpl, sil and dil. */
+            pThis->fRex = true;
+            pThis->fHasStackRegInMrmReg = iReg == X86_GREG_xSP;
+
+            /* Check for collisions. */
+            if (pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands))
+            {
+                Assert(!pThis->fHasHighByteRegInMrmRm);
+                if (!pThis->aOperands[pThis->idxMrmRmOp].fIsMem)
+                    pThis->fHasRegCollisionDirect = CIDET_OF_K_IS_GPR(pThis->fMrmRmOp)
+                                                 && iReg == pThis->aOperands[pThis->idxMrmRmOp].iReg;
+                else
+                {
+                    Assert(!pThis->fUsesVexIndexRegs || pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg == UINT8_MAX);
+
+                    pThis->fHasRegCollisionMemBase  = iReg == pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg;
+                    pThis->fHasRegCollisionMemIndex = iReg == pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg;
+                    pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+                }
+            }
+        }
+        else
+        {
+            /* Next register: ah, ch, dh and bh. */
+            iReg++;
+            pThis->aOperands[pThis->idxMrmRegOp].iReg = iReg;
+            pThis->bModRm &= ~X86_MODRM_REG_MASK;
+            pThis->bModRm |= (iReg & X86_MODRM_REG_SMASK) << X86_MODRM_REG_SHIFT;
+            pThis->fRex    = false;
+            pThis->fRexR   = false;
+            pThis->fNoRexPrefixMrmReg       = true;
+            pThis->fNoRexPrefix             = true;
+            pThis->fHasHighByteRegInMrmReg  = true;
+            pThis->fHasStackRegInMrmReg     = false;
+            pThis->aOperands[pThis->idxMrmRegOp].fIsHighByteRegister = true;
+            Assert(!pThis->fRexW); Assert(!pThis->fRexX); Assert(!pThis->fRexB);
+
+            /* Check for collisions. */
+            if (pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands))
+            {
+                if (!pThis->aOperands[pThis->idxMrmRmOp].fIsMem)
+                    pThis->fHasRegCollisionDirect = CIDET_OF_K_IS_GPR(pThis->fMrmRmOp)
+                                                 && (   (   pThis->aOperands[pThis->idxMrmRmOp].cb == 1
+                                                         && iReg == pThis->aOperands[pThis->idxMrmRmOp].iReg
+                                                         && pThis->fHasHighByteRegInMrmRm)
+                                                     || (   pThis->aOperands[pThis->idxMrmRmOp].cb > 1
+                                                         && iReg - 4 == pThis->aOperands[pThis->idxMrmRmOp].iReg));
+                else
+                {
+                    Assert(!pThis->fUsesVexIndexRegs || pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg == UINT8_MAX);
+
+                    pThis->fHasRegCollisionMemBase  = iReg - 4 == pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg;
+                    pThis->fHasRegCollisionMemIndex = iReg - 4 == pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg;
+                    pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+                }
+            }
+        }
+        return true;
+    }
+
+    Assert(!pThis->fRex || (iReg == 7 && CIDETMODE_IS_64BIT(pThis->bMode)));
+    pThis->fRex = false;
+
+    /*
+     * Next register.
+     */
+    iReg = (iReg + 1) & (CIDETMODE_IS_64BIT(pThis->bMode) ? 15 : 7);
+
+    pThis->aOperands[pThis->idxMrmRegOp].iReg = iReg;
+    pThis->bModRm &= ~X86_MODRM_REG_MASK;
+    pThis->bModRm |= (iReg & X86_MODRM_REG_SMASK) << X86_MODRM_REG_SHIFT;
+    pThis->fRexR   = iReg >= 8;
+    pThis->fHasStackRegInMrmReg = iReg == X86_GREG_xSP && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp);
+
+    /*
+     * Register collision detection.
+     */
+    if (pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands))
+    {
+        if (!pThis->aOperands[pThis->idxMrmRmOp].fIsMem)
+            pThis->fHasRegCollisionDirect = iReg == pThis->aOperands[pThis->idxMrmRmOp].iReg
+                                         && CIDET_OF_K_IS_SAME(pThis->fMrmRmOp, pThis->fMrmRegOp);
+        else if (CIDET_OF_K_IS_GPR(pThis->fMrmRegOp))
+        {
+            Assert(!pThis->fUsesVexIndexRegs || pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg == UINT8_MAX);
+            pThis->fHasRegCollisionMemBase  = iReg == pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg;
+            pThis->fHasRegCollisionMemIndex = iReg == pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg;
+            pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+        }
+    }
+    Assert(!pThis->fSib);
+
+    return iReg != 0;
+}
+
+
+/**
+ * Selects the next MOD & R/M encoding, 16-bit addressing variant.
+ *
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ */
+static void cidetCoreSetupFirstBaseEncoding_MrmRmMod_16bit(PCIDETCORE pThis, uint8_t iReg)
+{
+    if (CidetInstrHasMrmRegOperand(pThis->pCurInstr))
+    {
+        pThis->aOperands[pThis->idxMrmRmOp].iReg            = 0;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsMem          = false;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsRipRelative  = false;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsHighByteRegister = false;
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp       = 0;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg     = UINT8_MAX;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg    = UINT8_MAX;
+        pThis->aOperands[pThis->idxMrmRmOp].uMemScale       = 1;
+        pThis->aOperands[pThis->idxMrmRmOp].iEffSeg         = UINT8_MAX;
+        pThis->bModRm                     &= ~(X86_MODRM_RM_MASK | X86_MODRM_MOD_MASK);
+        pThis->bModRm                     |= 3 << X86_MODRM_MOD_SHIFT;
+        pThis->fRexB                       = false;
+        pThis->fRexX                       = false;
+        pThis->fHasMemoryOperand           = false;
+        pThis->fHasRegCollisionDirect      = iReg == 0
+                                          && CIDET_OF_K_IS_SAME(pThis->fMrmRmOp, pThis->fMrmRegOp);
+        pThis->fHasRegCollisionMem         = false;
+        pThis->fHasRegCollisionMemBase     = false;
+        pThis->fHasRegCollisionMemIndex    = false;
+        pThis->fHasStackRegInMrmRmBase     = false;
+    }
+    else
+    {
+        Assert(CidetInstrHasMrmMemOperand(pThis->pCurInstr));
+        pThis->aOperands[pThis->idxMrmRmOp].iReg            = UINT8_MAX;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsMem          = true;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsRipRelative  = false;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsHighByteRegister = false;
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp       = 0;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg     = X86_GREG_xBX;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg    = X86_GREG_xSI;
+        pThis->aOperands[pThis->idxMrmRmOp].uMemScale       = 1;
+        pThis->aOperands[pThis->idxMrmRmOp].iEffSeg         = UINT8_MAX;
+        pThis->bModRm                     &= ~(X86_MODRM_RM_MASK | X86_MODRM_MOD_MASK);
+        pThis->fRexB                       = false;
+        pThis->fRexX                       = false;
+        pThis->fHasMemoryOperand           = true;
+        pThis->fHasRegCollisionDirect      = false;
+        iReg -= pThis->fHasHighByteRegInMrmReg * 4;
+        pThis->fHasRegCollisionMemBase     = iReg == X86_GREG_xBX && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp);
+        pThis->fHasRegCollisionMemIndex    = iReg == X86_GREG_xSI && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp);
+        pThis->fHasRegCollisionMem         = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+        pThis->fHasStackRegInMrmRmBase     = false;
+    }
+}
+
+
+/**
+ * Selects the next MOD & R/M encoding, 16-bit addressing variant.
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ */
+static bool cidetCoreSetupNextBaseEncoding_MrmRmMod_16bit(PCIDETCORE pThis, uint8_t iReg)
+{
+    AssertRelease(!pThis->fRexB);
+    AssertRelease(!pThis->fRexX);
+    uint8_t iRm  = pThis->bModRm & X86_MODRM_RM_MASK;
+    uint8_t iMod = (pThis->bModRm >> X86_MODRM_MOD_SHIFT) & X86_MODRM_MOD_SMASK;
+    if (iMod == 3)
+    {
+        /*
+         * Register access mode.
+         */
+        Assert(pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands) && !pThis->aOperands[pThis->idxMrmRmOp].fIsMem);
+        Assert(!pThis->fHasMemoryOperand);
+        Assert(!pThis->fHasRegCollisionMem);
+        Assert(!pThis->fHasRegCollisionMemBase);
+        Assert(!pThis->fHasRegCollisionMemIndex);
+        if (iRm < 7)
+        {
+            iRm++;
+            pThis->aOperands[pThis->idxMrmRmOp].iReg = iRm;
+            pThis->bModRm &= ~X86_MODRM_RM_MASK;
+            pThis->bModRm |= iRm;
+            pThis->fHasRegCollisionDirect = iRm == iReg
+                                        && CIDET_OF_K_IS_SAME(pThis->fMrmRmOp, pThis->fMrmRegOp);
+            pThis->fHasStackRegInMrmRmBase = iRm == X86_GREG_xSP && CIDET_OF_K_IS_GPR(pThis->fMrmRmOp);
+            return true;
+        }
+
+        /* If no memory modes, we're done.  */
+        if (!CidetInstrHasMrmMemOperand(pThis->pCurInstr))
+        {
+            cidetCoreSetupFirstBaseEncoding_MrmRmMod_16bit(pThis, iReg);
+            return false;
+        }
+
+        /* Next mode: 16-bit memory addressing without displacement. */
+        pThis->aOperands[pThis->idxMrmRmOp].fIsMem = true;
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp = 0;
+        iMod = 0;
+    }
+    else
+    {
+        /*
+         * Memory access mode.
+         */
+        Assert(pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands) && pThis->aOperands[pThis->idxMrmRmOp].fIsMem);
+        Assert(pThis->fHasMemoryOperand);
+        if (iRm < 7)
+        {
+            iRm++;
+            switch (iRm)
+            {
+                case 1:
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg  = X86_GREG_xBX;
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = X86_GREG_xDI;
+                    break;
+                case 2:
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg  = X86_GREG_xBP;
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = X86_GREG_xSI;
+                    break;
+                case 3:
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg  = X86_GREG_xBP;
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = X86_GREG_xDI;
+                    break;
+                case 4:
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg  = UINT8_MAX;
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = X86_GREG_xSI;
+                    break;
+                case 5:
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg  = UINT8_MAX;
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = X86_GREG_xDI;
+                    break;
+                case 6:
+                    if (iMod == 0)
+                    {
+                        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp = 2;
+                        pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg = UINT8_MAX;
+                    }
+                    else
+                        pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg = X86_GREG_xBP;
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = UINT8_MAX;
+                    break;
+                case 7:
+                    if (iMod == 0)
+                        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp = 0;
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg  = X86_GREG_xBX;
+                    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = UINT8_MAX;
+                    break;
+                default: AssertReleaseFailed();
+            }
+            pThis->bModRm &= ~X86_MODRM_RM_MASK;
+            pThis->bModRm |= iRm;
+            if (CIDET_OF_K_IS_GPR(pThis->fMrmRegOp))
+            {
+                iReg -= pThis->fHasHighByteRegInMrmReg * 4;
+                pThis->fHasRegCollisionMemBase = iReg == pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg;
+                pThis->fHasRegCollisionMemIndex = iReg == pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg;
+                pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+            }
+            return true;
+        }
+
+        /* Last mode? */
+        if (iMod >= 2)
+        {
+            cidetCoreSetupFirstBaseEncoding_MrmRmMod_16bit(pThis, iReg);
+            return false;
+        }
+
+        /* Next memory addressing mode (if any). */
+        iMod++;
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp++;
+    }
+    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg  = X86_GREG_xBX;
+    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = X86_GREG_xSI;
+    pThis->aOperands[pThis->idxMrmRmOp].uMemScale    = 1;
+    pThis->bModRm &= ~(X86_MODRM_RM_MASK | X86_MODRM_MOD_MASK);
+    pThis->bModRm |= iMod << X86_MODRM_MOD_SHIFT;
+    pThis->fHasMemoryOperand = true;
+    pThis->fHasRegCollisionDirect = false;
+    pThis->fHasStackRegInMrmRmBase = false;
+    if (CIDET_OF_K_IS_GPR(pThis->fMrmRmOp))
+    {
+        iReg -= pThis->fHasHighByteRegInMrmReg * 4;
+        pThis->fHasRegCollisionMemBase  = iReg == X86_GREG_xBX;
+        pThis->fHasRegCollisionMemIndex = iReg == X86_GREG_xSI;
+        pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+    }
+    return true;
+}
+
+
+/**
+ * Selects the first MOD & R/M encoding, 32-bit and 64-bit addressing variant.
+ *
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ * @param   f64Bit              Set if 64-bit, clear if 32-bit.
+ */
+static void cidetCoreSetupFirstBaseEncoding_MrmRmMod_32bit64bit(PCIDETCORE pThis, uint8_t iReg, bool f64Bit)
+{
+    if (CidetInstrHasMrmRegOperand(pThis->pCurInstr))
+    {
+        pThis->aOperands[pThis->idxMrmRmOp].iReg            = 0;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsMem          = false;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsRipRelative  = false;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsHighByteRegister = false;
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp       = 0;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg     = UINT8_MAX;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg    = UINT8_MAX;
+        pThis->aOperands[pThis->idxMrmRmOp].uMemScale       = 1;
+        pThis->aOperands[pThis->idxMrmRmOp].iEffSeg         = UINT8_MAX;
+        pThis->bModRm                     &= ~(X86_MODRM_RM_MASK | X86_MODRM_MOD_MASK);
+        pThis->bModRm                     |= 3 << X86_MODRM_MOD_SHIFT;
+        pThis->fRexB                       = false;
+        pThis->fRexX                       = false;
+        pThis->fHasMemoryOperand           = false;
+        pThis->fHasRegCollisionDirect      = iReg == 0
+                                          && CIDET_OF_K_IS_SAME(pThis->fMrmRmOp, pThis->fMrmRegOp);
+        pThis->fHasRegCollisionMem         = false;
+        pThis->fHasRegCollisionMemBase     = false;
+        pThis->fHasRegCollisionMemIndex    = false;
+        pThis->fHasStackRegInMrmRmBase     = false;
+    }
+    else
+    {
+        Assert(CidetInstrHasMrmMemOperand(pThis->pCurInstr));
+        pThis->aOperands[pThis->idxMrmRmOp].iReg            = UINT8_MAX;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsMem          = true;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsRipRelative  = false;
+        pThis->aOperands[pThis->idxMrmRmOp].fIsHighByteRegister = false;
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp       = 0;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg     = 0;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg    = UINT8_MAX;
+        pThis->aOperands[pThis->idxMrmRmOp].uMemScale       = 1;
+        pThis->aOperands[pThis->idxMrmRmOp].iEffSeg         = UINT8_MAX;
+        pThis->bModRm                     &= ~(X86_MODRM_RM_MASK | X86_MODRM_MOD_MASK);
+        pThis->fRexB                       = false;
+        pThis->fRexX                       = false;
+        pThis->fHasMemoryOperand           = true;
+        pThis->fHasRegCollisionDirect      = false;
+        pThis->fHasRegCollisionMemIndex    = false;
+        pThis->fHasRegCollisionMemBase     = iReg == pThis->fHasHighByteRegInMrmReg * 4 && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp);
+        pThis->fHasRegCollisionMem         = pThis->fHasRegCollisionMemBase;
+        pThis->fHasStackRegInMrmRmBase     = false;
+    }
+}
+
+
+/**
+ * Selects the next MOD & R/M encoding, 32-bit and 64-bit addressing variant.
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ * @param   f64Bit              Set if 64-bit, clear if 32-bit.
+ */
+static bool cidetCoreSetupNextBaseEncoding_MrmRmMod_32bit64bit(PCIDETCORE pThis, uint8_t iReg, bool f64Bit)
+{
+    AssertRelease(!pThis->fRexX || CIDETMODE_IS_64BIT(pThis->bMode));
+    AssertRelease(!pThis->fRexB || CIDETMODE_IS_64BIT(pThis->bMode));
+    uint8_t iRm  = (pThis->bModRm & X86_MODRM_RM_MASK) + pThis->fRexB * 8;
+    uint8_t iMod = (pThis->bModRm >> X86_MODRM_MOD_SHIFT) & X86_MODRM_MOD_SMASK;
+    if (iMod == 3)
+    {
+        /*
+         * Register access mode.
+         */
+        Assert(pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands) && !pThis->aOperands[pThis->idxMrmRmOp].fIsMem);
+        Assert(!pThis->fHasMemoryOperand);
+        Assert(!pThis->fHasRegCollisionMem);
+        Assert(!pThis->fHasRegCollisionMemBase);
+        Assert(!pThis->fHasRegCollisionMemIndex);
+
+        if (CIDETMODE_IS_64BIT(pThis->bMode) && !pThis->fRexX && !pThis->fNoRexPrefix) /* should be ignored. */
+        {
+            pThis->fRexX = true;
+            return true;
+        }
+
+        /* Reset the byte register kludges variables. */
+        pThis->aOperands[pThis->idxMrmRmOp].fIsHighByteRegister = false;
+        pThis->fHasHighByteRegInMrmRm = false;
+        pThis->fNoRexPrefixMrmRm = false;
+        pThis->fNoRexPrefix = pThis->fNoRexPrefixMrmReg;
+
+        if (iRm < (CIDETMODE_IS_64BIT(pThis->bMode) && !pThis->fNoRexPrefix ? 15 : 7))
+        {
+            /*
+             * Byte register kludge.
+             */
+            if (   pThis->aOperands[pThis->idxMrmRmOp].cb == 1
+                && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp)
+                && iRm >= 3
+                && (   iRm <= 6
+                    || (iRm == 7 && CIDETMODE_IS_64BIT(pThis->bMode) && !pThis->fRexX) ) )
+            {
+                if (!pThis->fRexX && iRm >= 4 && CIDETMODE_IS_64BIT(pThis->bMode) && !pThis->fNoRexPrefix)
+                {
+                    /* The AMD64 low variants: spl, bpl, sil and dil. (Using fRexX here as REG covers fRex.) */
+                    pThis->fRexX = true;
+                    pThis->fHasRegCollisionDirect = CIDET_OF_K_IS_GPR(pThis->fMrmRegOp)
+                                                 && iRm == iReg - pThis->fHasHighByteRegInMrmReg * 4;
+                    pThis->fHasStackRegInMrmRmBase = iRm == X86_GREG_xSP && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp);
+                }
+                else
+                {
+                    /* Next register: ah, ch, dh and bh. */
+                    iRm++;
+                    pThis->aOperands[pThis->idxMrmRmOp].iReg = iRm;
+                    pThis->bModRm &= ~X86_MODRM_RM_MASK;
+                    pThis->bModRm |= iRm & X86_MODRM_RM_MASK;
+                    pThis->fRexB   = false;
+                    pThis->fRexX   = false;
+                    if (!pThis->fRexR && !pThis->fRexW && !pThis->fRex)
+                    {
+                        pThis->fNoRexPrefixMrmRm = true;
+                        pThis->fNoRexPrefix = true;
+                        pThis->fHasHighByteRegInMrmRm = true;
+                        pThis->aOperands[pThis->idxMrmRmOp].fIsHighByteRegister = true;
+                        pThis->fHasRegCollisionDirect = CIDET_OF_K_IS_GPR(pThis->fMrmRegOp)
+                                                     && iRm - 4 == iReg - pThis->fHasHighByteRegInMrmReg * 4;
+                        pThis->fHasStackRegInMrmRmBase = false;
+
+                    }
+                    else
+                    {
+                        /* Can't do the high stuff, so do the spl, bpl, sil and dil variation instead.
+                           Note! We don't set the RexX yet since the base register or operand width holds it down. */
+                        pThis->fHasRegCollisionDirect = CIDET_OF_K_IS_GPR(pThis->fMrmRegOp)
+                                                     && iRm == iReg - pThis->fHasHighByteRegInMrmReg * 4;
+                        pThis->fHasStackRegInMrmRmBase = iRm == X86_GREG_xSP && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp);
+                    }
+                }
+            }
+            /*
+             * Normal register.
+             */
+            else
+            {
+                iRm++;
+                pThis->aOperands[pThis->idxMrmRmOp].iReg = iRm;
+                pThis->bModRm &= ~X86_MODRM_RM_MASK;
+                pThis->bModRm |= iRm & X86_MODRM_RM_MASK;
+                pThis->fRexB   = iRm >= 8;
+                pThis->fRexX   = false;
+                pThis->fHasRegCollisionDirect = iRm == iReg && CIDET_OF_K_IS_SAME(pThis->fMrmRmOp, pThis->fMrmRegOp);
+                pThis->fHasStackRegInMrmRmBase = iRm == X86_GREG_xSP && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp);
+            }
+            return true;
+        }
+
+        /* If no memory modes, we're done.  */
+        if (!CidetInstrHasMrmMemOperand(pThis->pCurInstr))
+        {
+            cidetCoreSetupFirstBaseEncoding_MrmRmMod_32bit64bit(pThis, iReg, f64Bit);
+            return false;
+        }
+
+        /* Next mode: 32-bit/64-bit memory addressing without displacement. */
+        pThis->aOperands[pThis->idxMrmRmOp].fIsMem = true;
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp = 0;
+        iMod = 0;
+    }
+    else
+    {
+        /*
+         * Memory access mode.
+         */
+        Assert(pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands) && pThis->aOperands[pThis->idxMrmRmOp].fIsMem);
+        Assert(pThis->fHasMemoryOperand);
+        Assert(!pThis->fHasStackRegInMrmRmBase);
+        if (iRm < (CIDETMODE_IS_64BIT(pThis->bMode) && !pThis->fNoRexPrefix ? 15 : 7))
+        {
+            iRm++;
+            if (iRm == 12)
+                iRm++; /* Leave REX.B=1 to the next-sib-base function. */
+            if (iRm == 4)
+            {
+                /* SIB */
+                pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg     = 0;
+                pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg    = 0;
+                pThis->fSib = true;
+                pThis->bSib = 0;
+            }
+            else if ((iRm & 7) == 5 && iMod == 0)
+            {
+                /* Absolute or wrt rip addressing. */
+                pThis->aOperands[pThis->idxMrmRmOp].fIsRipRelative  = CIDETMODE_IS_64BIT(pThis->bMode);
+                pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg     = UINT8_MAX;
+                pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg    = UINT8_MAX;
+                pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp       = 4;
+            }
+            else
+            {
+                if ((iRm & 7) == 6 && iMod == 0)
+                {
+                    pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp   = 0;
+                    pThis->aOperands[pThis->idxMrmRmOp].fIsRipRelative = false;
+                }
+                pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg     = iRm;
+                pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg    = UINT8_MAX;
+            }
+            pThis->aOperands[pThis->idxMrmRmOp].uMemScale = 1;
+            pThis->bModRm &= ~X86_MODRM_RM_MASK;
+            pThis->bModRm |= iRm & X86_MODRM_RM_MASK;
+            pThis->fRexB   = iRm >= 8;
+            pThis->fRexX   = false;
+            if (CIDET_OF_K_IS_GPR(pThis->fMrmRegOp))
+            {
+                iReg -= pThis->fHasHighByteRegInMrmReg * 4;
+                pThis->fHasRegCollisionMemBase = iReg == pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg;
+                pThis->fHasRegCollisionMemIndex = iReg == pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg;
+                pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+            }
+            return true;
+        }
+
+        /* Last mode? */
+        if (iMod >= 2)
+        {
+            cidetCoreSetupFirstBaseEncoding_MrmRmMod_32bit64bit(pThis, iReg, f64Bit);
+            return false;
+        }
+
+        /* Next memory addressing mode (if any). */
+        iMod++;
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp = iMod == 1 ? 1 : 4;
+    }
+    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg  = 0;
+    pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = UINT8_MAX;
+    pThis->aOperands[pThis->idxMrmRmOp].uMemScale    = 1;
+    pThis->bModRm &= ~(X86_MODRM_RM_MASK | X86_MODRM_MOD_MASK);
+    pThis->bModRm |= iMod << X86_MODRM_MOD_SHIFT;
+    pThis->fRexB   = false;
+    pThis->fRexX   = false;
+    pThis->fHasMemoryOperand = true;
+    pThis->fHasRegCollisionDirect = false;
+    pThis->fHasRegCollisionMemIndex = false;
+    pThis->fHasRegCollisionMemBase = iReg == pThis->fHasHighByteRegInMrmReg * 4
+                                  && CIDET_OF_K_IS_GPR(pThis->fMrmRmOp);
+    pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase;
+    pThis->fHasStackRegInMrmRmBase = false;
+    return true;
+}
+
+
+/**
+ * Selects the next MOD & R/M encoding.
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ */
+static bool cidetCoreSetupNextBaseEncoding_MrmRmMod(PCIDETCORE pThis, uint8_t iReg)
+{
+    if (pThis->cbAddrMode == 2)
+        return cidetCoreSetupNextBaseEncoding_MrmRmMod_16bit(pThis, iReg);
+    if (pThis->cbAddrMode == 4)
+        return cidetCoreSetupNextBaseEncoding_MrmRmMod_32bit64bit(pThis, iReg, false);
+    if (pThis->cbAddrMode == 8)
+        return cidetCoreSetupNextBaseEncoding_MrmRmMod_32bit64bit(pThis, iReg, true);
+    AssertReleaseFailedReturn(false);
+}
+
+
+
+/**
+ * Selects the next SIB base register (/ encoding).
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ */
+static bool cidetCoreSetupNextBaseEncoding_SibBase(PCIDETCORE pThis, uint8_t iReg)
+{
+    AssertRelease(!pThis->fRexB || CIDETMODE_IS_64BIT(pThis->bMode));
+
+    uint8_t iBase = (pThis->bSib & X86_SIB_BASE_MASK) + pThis->fRexB * 8;
+    iBase = (iBase + 1) & (CIDETMODE_IS_64BIT(pThis->bMode) && !pThis->fNoRexPrefix ? 15 : 7);
+
+    if ((iBase & 7) == 5 && (pThis->bModRm & X86_MODRM_MOD_MASK) == 0)
+    {
+        pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp   = 4;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg = UINT8_MAX;
+    }
+    else
+    {
+        if ((iBase & 7) == 6 && (pThis->bModRm & X86_MODRM_MOD_MASK) == 0)
+            pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp = 0;
+        pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg = iBase;
+    }
+    pThis->bSib  &= ~X86_SIB_BASE_MASK;
+    pThis->bSib  |= iBase & X86_SIB_BASE_MASK;
+    pThis->fRexB  = iBase >= 8;
+    pThis->fHasRegCollisionMemBase =    pThis->aOperands[pThis->idxMrmRmOp].iMemBaseReg
+                                     == iReg - pThis->fHasHighByteRegInMrmReg * 4
+                                  && CIDET_OF_K_IS_GPR(pThis->fMrmRegOp);
+    pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+    pThis->fHasStackRegInMrmRmBase = iBase == X86_GREG_xSP;
+
+    return iBase != 0;
+}
+
+
+/**
+ * Selects the next SIB index register (/ encoding).
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ */
+static bool cidetCoreSetupNextBaseEncoding_SibIndex(PCIDETCORE pThis, uint8_t iReg)
+{
+    AssertRelease(!pThis->fRexX || CIDETMODE_IS_64BIT(pThis->bMode));
+    Assert(pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands) && pThis->aOperands[pThis->idxMrmRmOp].fIsMem);
+
+    uint8_t iIndex = ((pThis->bSib >> X86_SIB_INDEX_SHIFT) & X86_SIB_INDEX_SMASK) + pThis->fRexX * 8;
+    iIndex = (iIndex + 1) & (CIDETMODE_IS_64BIT(pThis->bMode) && !pThis->fNoRexPrefix ? 15 : 7);
+
+    if (iIndex == 4 && !pThis->fUsesVexIndexRegs)
+        pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = UINT8_MAX;
+    else
+        pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg = iIndex;
+    pThis->bSib &= ~X86_SIB_INDEX_MASK;
+    pThis->bSib |= (iIndex & X86_SIB_INDEX_SMASK) << X86_SIB_INDEX_SHIFT;
+    pThis->fRexX = iIndex >= 8;
+    pThis->fHasRegCollisionMemIndex =     pThis->aOperands[pThis->idxMrmRmOp].iMemIndexReg
+                                       == iReg - pThis->fHasHighByteRegInMrmReg * 4
+                                   && (  !pThis->fUsesVexIndexRegs
+                                       ? CIDET_OF_K_IS_GPR(pThis->fMrmRegOp) : CIDET_OF_K_IS_VRX(pThis->fMrmRegOp) );
+    pThis->fHasRegCollisionMem = pThis->fHasRegCollisionMemBase || pThis->fHasRegCollisionMemIndex;
+
+    return iIndex != 0;
+}
+
+
+/**
+ * Selects the next SIB scale.
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ * @param   iReg                The value of MODRM.REG /w REX.R applied.
+ */
+static bool cidetCoreSetupNextBaseEncoding_SibScale(PCIDETCORE pThis, uint8_t iReg)
+{
+    switch ((pThis->bSib >> X86_SIB_SCALE_SHIFT) & X86_SIB_SCALE_SMASK)
+    {
+        case 0:
+            pThis->bSib |= 1 << X86_SIB_SCALE_SHIFT;
+            pThis->aOperands[pThis->idxMrmRmOp].uMemScale = 2;
+            return true;
+        case 1:
+            pThis->bSib &= ~X86_SIB_SCALE_MASK;
+            pThis->bSib |= 2 << X86_SIB_SCALE_SHIFT;
+            pThis->aOperands[pThis->idxMrmRmOp].uMemScale = 4;
+            return true;
+        case 2:
+            pThis->bSib |= 3 << X86_SIB_SCALE_SHIFT;
+            pThis->aOperands[pThis->idxMrmRmOp].uMemScale = 8;
+            return true;
+        case 3:
+            pThis->bSib &= ~X86_SIB_SCALE_MASK;
+            pThis->aOperands[pThis->idxMrmRmOp].uMemScale = 1;
+            return false;
+
+        default: AssertReleaseFailedReturn(false);
+    }
+}
+
+
+/**
+ * Selects the next segment prefix.
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ */
+static bool cidetCoreSetupNextBaseEncoding_SegmentPrefix(PCIDETCORE pThis)
+{
+    if (   pThis->fHasMemoryOperand
+        && (pThis->fTestCfg & CIDET_TESTCFG_SEG_PRF_MASK))
+    {
+        switch (pThis->uSegPrf)
+        {
+            case X86_SREG_COUNT:
+                pThis->uSegPrf = X86_SREG_ES;
+                if (pThis->fTestCfg & CIDET_TESTCFG_SEG_PRF_ES)
+                    return true;
+                /* fall thru */
+            case X86_SREG_ES:
+                pThis->uSegPrf = X86_SREG_CS;
+                if (pThis->fTestCfg & CIDET_TESTCFG_SEG_PRF_CS)
+                    return true;
+                /* fall thru */
+            case X86_SREG_CS:
+                pThis->uSegPrf = X86_SREG_SS;
+                if (pThis->fTestCfg & CIDET_TESTCFG_SEG_PRF_SS)
+                    return true;
+                /* fall thru */
+            case X86_SREG_SS:
+                pThis->uSegPrf = X86_SREG_DS;
+                if (pThis->fTestCfg & CIDET_TESTCFG_SEG_PRF_DS)
+                    return true;
+                /* fall thru */
+            case X86_SREG_DS:
+                pThis->uSegPrf = X86_SREG_FS;
+                if (pThis->fTestCfg & CIDET_TESTCFG_SEG_PRF_FS)
+                    return true;
+                /* fall thru */
+            case X86_SREG_FS:
+                pThis->uSegPrf = X86_SREG_GS;
+                if (pThis->fTestCfg & CIDET_TESTCFG_SEG_PRF_GS)
+                    return true;
+                /* fall thru */
+            case X86_SREG_GS:
+                break;
+            default: AssertReleaseFailedBreak();
+        }
+        pThis->uSegPrf = X86_SREG_COUNT;
+    }
+    return false;
+}
+
+
+/**
+ * Updates the variable sized operands.
+ *
+ * @param   pThis               The core state structure.
+ */
+static void cidetCoreUpdateOperandSizes(PCIDETCORE pThis)
+{
+    uint8_t iOp = pThis->cOperands;
+    while (iOp-- > 0)
+        pThis->aOperands[iOp].cb = (uint8_t)CidetCoreGetOperandSize(pThis, iOp);
+}
+
+
+/**
+ * Selects the next operand size.
+ *
+ * @returns @c true if done, @c false if the next wheel needs to be moved.
+ * @param   pThis               The core state structure.
+ */
+static bool cidetCoreSetupNextBaseEncoding_OperandSize(PCIDETCORE pThis)
+{
+    if (CidetInstrRespondsToOperandSizePrefixes(pThis->pCurInstr))
+    {
+        if (CIDETMODE_IS_64BIT(pThis->bMode))
+        {
+            switch (pThis->fOpSizePrf + pThis->fRexW * 2)
+            {
+                case 0:
+                    pThis->fOpSizePrf = true;
+                    cidetCoreUpdateOperandSizes(pThis);
+                    return true;
+                case 1:
+                    pThis->fOpSizePrf = false;
+                    if (pThis->fNoRexPrefix)
+                        break;
+                    pThis->fRexW = true;
+                    cidetCoreUpdateOperandSizes(pThis);
+                    return true;
+                case 2:
+                    pThis->fOpSizePrf = true; /* check that it's ignored. */
+                    cidetCoreUpdateOperandSizes(pThis);
+                    return true;
+                default: AssertReleaseFailed();
+                case 3:
+                    break;
+            }
+        }
+        else
+        {
+            if (!pThis->fOpSizePrf)
+            {
+                pThis->fOpSizePrf = true;
+                cidetCoreUpdateOperandSizes(pThis);
+                return true;
+            }
+        }
+        pThis->fRexW = false;
+        pThis->fOpSizePrf = false;
+        cidetCoreUpdateOperandSizes(pThis);
+    }
+    return false;
+}
+
+
+bool CidetCoreSetupNextBaseEncoding(PCIDETCORE pThis)
+{
+    if (pThis->fUsesModRm)
+    {
+        /*
+         * The wheels are lined up as follows:
+         *      1. Address size prefix.
+         *      2. MODRM.MOD
+         *      3. MODRM.REG + REX.R
+         *      4. MODRM.R/M + REX.B
+         *      5. SIB - MODRM.R/M == 4 && MODRM.MOD != 3:
+         *          5a) SIB.BASE + REX.B
+         *          5b) SIB.INDEX + REX.X
+         *          5c) SIB.SCALE
+         *      6. Segment prefix overrides if applicable and supported (memory).
+         *      7. Operand size prefix and REX.W if applicable.
+         */
+        if (cidetCoreSetupNextBaseEncoding_OperandSize(pThis))
+            return true;
+        if (cidetCoreSetupNextBaseEncoding_SegmentPrefix(pThis))
+            return true;
+
+        /* The ModR/M register value for collision detection. */
+        uint8_t iReg = ((pThis->bModRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) + pThis->fRexR * 8;
+
+        if (pThis->fSib)
+        {
+            AssertRelease(pThis->fHasMemoryOperand);
+            if (cidetCoreSetupNextBaseEncoding_SibScale(pThis, iReg))
+                return true;
+            if (cidetCoreSetupNextBaseEncoding_SibIndex(pThis, iReg))
+                return true;
+            if (cidetCoreSetupNextBaseEncoding_SibBase(pThis, iReg))
+                return true;
+            Assert(pThis->bSib == 0);
+            pThis->fSib = false;
+        }
+
+        if (cidetCoreSetupNextBaseEncoding_MrmRmMod(pThis, iReg))
+            return true;
+        if (cidetCoreSetupNextBaseEncoding_MrmReg(pThis, iReg))
+            return true;
+        if (cidetCoreSetupNextBaseEncoding_AddressSize(pThis))
+            return true;
+    }
+    else
+        AssertFailedReturn(false);
+    return false;
+}
+
+
+bool CidetCoreSetupFirstBaseEncoding(PCIDETCORE pThis)
+{
+    /*
+     * Reset all the knobs and wheels.
+     */
+    pThis->fSib         = false;
+    pThis->uSegPrf      = X86_SREG_COUNT;
+    pThis->fAddrSizePrf = false;
+    pThis->fOpSizePrf   = false;
+    pThis->fRexW        = false;
+    pThis->fRexR        = false;
+    pThis->fRexX        = false;
+    pThis->fRexB        = false;
+    pThis->fRex         = false;
+    pThis->bModRm       = 0;
+    pThis->bSib         = 0;
+
+    /* Indicators. */
+    pThis->cbAddrMode               = CIDETMODE_GET_BYTE_COUNT(pThis->bMode);
+    pThis->fHasMemoryOperand        = false;
+    pThis->fHasRegCollisionMem      = false;
+    pThis->fHasRegCollisionMemBase  = false;
+    pThis->fHasRegCollisionMemIndex = false;
+    pThis->fHasStackRegInMrmRmBase  = false;
+
+    /*
+     * Now, drill down on the instruction encoding.
+     */
+    if (pThis->pCurInstr->fFlags & CIDET_IF_MODRM)
+    {
+        Assert(pThis->fUsesModRm == true);
+        cidetCoreSetupFirstBaseEncoding_MrmReg(pThis);
+        if (pThis->cbAddrMode == 2)
+            cidetCoreSetupFirstBaseEncoding_MrmRmMod_16bit(pThis, 0);
+        else if (pThis->cbAddrMode == 4)
+            cidetCoreSetupFirstBaseEncoding_MrmRmMod_32bit64bit(pThis, 0, false);
+        else if (pThis->cbAddrMode == 8)
+            cidetCoreSetupFirstBaseEncoding_MrmRmMod_32bit64bit(pThis, 0, true);
+        else
+            AssertReleaseFailedReturn(false);
+    }
+    else
+        AssertFailedReturn(false);
+    return true;
+}
+
+
+/**
+ * The next memory operand configuration.
+ *
+ * @returns true if new one to test, false if we've reached end already.
+ * @param   pThis               The core state structure.
+ */
+bool CidetCoreSetupNextMemoryOperandConfig(PCIDETCORE pThis)
+{
+    return false;
+}
+
+
+/**
+ * Sets up the first memory operand configuration and counts memory operands.
+ *
+ * @returns true on success, false if no data buffers configured or failure.
+ * @param   pThis               The core state structure.
+ */
+bool CidetCoreSetupFirstMemoryOperandConfig(PCIDETCORE pThis)
+{
+    pThis->cMemoryOperands = 0;
+    PCIDETBUF pDataBuf = &pThis->DataBuf;
+    uint8_t idxOp = pThis->cOperands;
+    while (idxOp-- > 0)
+        if (!pThis->aOperands[idxOp].fIsMem)
+            pThis->aOperands[idxOp].pDataBuf = NULL;
+        else
+        {
+            if (RT_UNLIKELY(!pThis->cDataBufConfigs))
+                return false;
+
+            pDataBuf->idxCfg       = 0;
+            pDataBuf->pCfg         = &pThis->paDataBufConfigs[0];
+            pDataBuf->off          = 0;
+            pDataBuf->cb           = pThis->aOperands[idxOp].cb;
+            pDataBuf->cbSegLimit   = UINT16_MAX;
+            pDataBuf->offSegBase   = 0;
+            pDataBuf->fActive      = false;
+            pDataBuf->idxOp        = idxOp;
+            pDataBuf->fXcptAfterInstruction = false;
+            pDataBuf->enmExpectXcpt = kCidetExpectXcpt_None;
+            pThis->aOperands[idxOp].pDataBuf = pDataBuf;
+            pThis->cMemoryOperands++;
+            pDataBuf++;
+        }
+
+    /** @todo implement more than one memory operand. */
+    AssertReleaseReturn(pThis->cMemoryOperands <= 1, false);
+    return true;
+}
+
+
+/**
+ * The next code buffer configuration.
+ *
+ * @returns true if new one to test, false if we've reached end already.
+ * @param   pThis               The core state structure.
+ */
+bool CidetCoreSetupNextCodeBufferConfig(PCIDETCORE pThis)
+{
+    return false;
+}
+
+
+/**
+ * Sets up the first code buffer configuration.
+ *
+ * @returns true on success, false if no data buffers configured or failure.
+ * @param   pThis               The core state structure.
+ */
+bool CidetCoreSetupFirstCodeBufferConfig(PCIDETCORE pThis)
+{
+    Assert(pThis->cCodeBufConfigs > 0);
+    Assert(CIDETBUF_IS_CODE(pThis->paCodeBufConfigs[0].fFlags));
+    pThis->CodeBuf.idxCfg       = 0;
+    pThis->CodeBuf.pCfg         = &pThis->paCodeBufConfigs[0];
+    pThis->CodeBuf.off          = 0;
+    pThis->CodeBuf.cb           = 0x1000;
+    pThis->CodeBuf.cbSegLimit   = UINT16_MAX;
+    pThis->CodeBuf.offSegBase   = 0;
+    pThis->CodeBuf.fActive      = true;
+    pThis->CodeBuf.idxOp        = 7;
+    pThis->CodeBuf.fXcptAfterInstruction = false;
+    pThis->CodeBuf.enmExpectXcpt = kCidetExpectXcpt_None;
+    return true;
+}
+
+
+/**
+ * Gets the (encoded) size of the given operand in the current context.
+ *
+ * @returns Size in bytes.
+ * @param   pThis               The core state structure (for context).
+ * @param   iOp                 The operand index.
+ */
+uint32_t CidetCoreGetOperandSize(PCIDETCORE pThis, uint8_t iOp)
+{
+    Assert(iOp < RT_ELEMENTS(pThis->aOperands));
+    uint32_t cbOp = g_acbCidetOfSizes[(pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) >> CIDET_OF_Z_SHIFT];
+    if (cbOp == UINT16_MAX)
+    {
+        Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_VAR_WDQ);
+        if (CIDETMODE_IS_64BIT(pThis->bMode))
+        {
+            if (pThis->fRexW)
+                cbOp = 8;
+            else if (!pThis->fOpSizePrf)
+                cbOp = 4;
+            else
+                cbOp = 2;
+        }
+        else if (CIDETMODE_IS_32BIT(pThis->bMode))
+            cbOp = !pThis->fOpSizePrf ? 4 : 2;
+        else
+        {
+            Assert(CIDETMODE_IS_16BIT(pThis->bMode));
+            cbOp = !pThis->fOpSizePrf ? 2 : 4;
+        }
+        return cbOp;
+    }
+
+    if (cbOp == UINT16_MAX - 1)
+    {
+        Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_SPECIAL);
+        AssertReleaseFailedReturn(0);
+    }
+
+    if (cbOp)
+    {
+#ifdef VBOX_STRICT
+        switch (cbOp)
+        {
+            case  1: Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_BYTE); break;
+            case  2: Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_WORD); break;
+            case  4: Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_DWORD); break;
+            case  8: Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_QWORD); break;
+            case 10: Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_TBYTE); break;
+            case 16: Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_OWORD); break;
+            case 32: Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_YWORD); break;
+            case 64: Assert((pThis->aOperands[iOp].fFlags & CIDET_OF_Z_MASK) == CIDET_OF_Z_ZWORD); break;
+            default: AssertFailed();
+        }
+#endif
+        return cbOp;
+    }
+    AssertReleaseFailedReturn(0);
+}
+
+
+bool CideCoreSetInstruction(PCIDETCORE pThis, PCCIDETINSTR pInstr)
+{
+    AssertReleaseMsgReturn(RT_VALID_PTR(pInstr), ("%p\n", pInstr), false);
+
+    pThis->pCurInstr = pInstr;
+
+    /*
+     * Extract info from the instruction descriptor.
+     */
+    pThis->fUsesModRm           = false;
+    pThis->fUsesVexIndexRegs    = false;
+    pThis->idxMrmRegOp          = 7;
+    pThis->idxMrmRmOp           = 7;
+    pThis->fMrmRegOp            = 0;
+    pThis->fMrmRmOp             = 0;
+    pThis->fInstrFlags          = pInstr->fFlags;
+    pThis->cOperands            = pInstr->cOperands;
+    if (pInstr->fFlags & CIDET_IF_MODRM)
+    {
+        pThis->fUsesModRm = true;
+        for (uint8_t iOp = 0; iOp < pInstr->cOperands; iOp++)
+            if (pInstr->afOperands[iOp] & CIDET_OF_M_REG)
+            {
+                pThis->idxMrmRegOp = iOp;
+                pThis->fMrmRegOp   = pInstr->afOperands[iOp];
+            }
+            else if (pInstr->afOperands[iOp] & CIDET_OF_M_RM)
+            {
+                pThis->idxMrmRmOp = iOp;
+                pThis->fMrmRmOp   = pInstr->afOperands[iOp];
+            }
+    }
+    else
+        AssertFailedReturn(false);
+
+    uint8_t iOp;
+    for (iOp = 0; iOp < pInstr->cOperands; iOp++)
+    {
+        pThis->aOperands[iOp].fFlags            = pInstr->afOperands[iOp];
+        pThis->aOperands[iOp].iReg              = UINT8_MAX;
+        pThis->aOperands[iOp].cb                = (uint8_t)CidetCoreGetOperandSize(pThis, iOp);
+        pThis->aOperands[iOp].fIsImmediate      = (pInstr->afOperands[iOp] & CIDET_OF_K_MASK) == CIDET_OF_K_IMM;
+        pThis->aOperands[iOp].fIsMem            = (pInstr->afOperands[iOp] & CIDET_OF_K_MASK) == CIDET_OF_K_MEM;
+        pThis->aOperands[iOp].fIsRipRelative    = false;
+        pThis->aOperands[iOp].cbMemDisp         = 0;
+        pThis->aOperands[iOp].iMemBaseReg       = UINT8_MAX;
+        pThis->aOperands[iOp].iMemIndexReg      = UINT8_MAX;
+        pThis->aOperands[iOp].uMemScale         = 1;
+        pThis->aOperands[iOp].iEffSeg           = UINT8_MAX;
+        pThis->aOperands[iOp].offSeg            = UINT64_MAX;
+        pThis->aOperands[iOp].uEffAddr          = UINT64_MAX;
+        pThis->aOperands[iOp].uImmDispValue     = UINT64_MAX;
+        pThis->aOperands[iOp].uMemBaseRegValue  = UINT64_MAX;
+        pThis->aOperands[iOp].uMemIndexRegValue = UINT64_MAX;
+        pThis->aOperands[iOp].In.pv             = NULL;
+        pThis->aOperands[iOp].Expected.pv       = NULL;
+        pThis->aOperands[iOp].pDataBuf          = NULL;
+    }
+
+    for (; iOp < RT_ELEMENTS(pThis->aOperands); iOp++)
+    {
+        pThis->aOperands[iOp].fFlags            = 0;
+        pThis->aOperands[iOp].iReg              = UINT8_MAX;
+        pThis->aOperands[iOp].cb                = 0;
+        pThis->aOperands[iOp].fIsImmediate      = false;
+        pThis->aOperands[iOp].fIsMem            = false;
+        pThis->aOperands[iOp].fIsRipRelative    = false;
+        pThis->aOperands[iOp].cbMemDisp         = 0;
+        pThis->aOperands[iOp].iMemBaseReg       = UINT8_MAX;
+        pThis->aOperands[iOp].iMemIndexReg      = UINT8_MAX;
+        pThis->aOperands[iOp].uMemScale         = 1;
+        pThis->aOperands[iOp].iEffSeg           = UINT8_MAX;
+        pThis->aOperands[iOp].offSeg            = UINT64_MAX;
+        pThis->aOperands[iOp].uEffAddr          = UINT64_MAX;
+        pThis->aOperands[iOp].uImmDispValue     = UINT64_MAX;
+        pThis->aOperands[iOp].uMemBaseRegValue  = UINT64_MAX;
+        pThis->aOperands[iOp].uMemIndexRegValue = UINT64_MAX;
+        pThis->aOperands[iOp].In.pv             = NULL;
+        pThis->aOperands[iOp].Expected.pv       = NULL;
+        pThis->aOperands[iOp].pDataBuf          = NULL;
+    }
+
+    /*
+     * Reset various things.
+     */
+    for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aiInOut); i++)
+        pThis->aiInOut[i] = 0;
+
+    return true;
+}
+
+
+bool CidetCoreSetupInOut(PCIDETCORE pThis)
+{
+    /*
+     * Enumerate the operands.
+     */
+    uint8_t *pbBuf = &pThis->abBuf[0];
+    pbBuf = RT_ALIGN_PT(pbBuf, 16, uint8_t *);
+
+    uint8_t idxOp = pThis->cOperands;
+    while (idxOp-- > 0)
+    {
+        if (pThis->aOperands[idxOp].fIsMem)
+        {
+            /*
+             * Memory operand.
+             */
+            Assert(pThis->aOperands[idxOp].fIsMem);
+
+            /* Set the In & Expected members to point to temporary buffer space. */
+            pThis->aOperands[idxOp].Expected.pu8 = pbBuf;
+            pbBuf += pThis->aOperands[idxOp].cb;
+            pbBuf = RT_ALIGN_PT(pbBuf, 16, uint8_t *);
+
+            pThis->aOperands[idxOp].In.pu8 = pbBuf;
+            pbBuf += pThis->aOperands[idxOp].cb;
+            pbBuf = RT_ALIGN_PT(pbBuf, 16, uint8_t *);
+
+            /* Initialize the buffer we're gonna use. */
+            pThis->aOperands[idxOp].iEffSeg = pThis->uSegPrf != X86_SREG_COUNT
+                                            ? pThis->uSegPrf
+                                            : !(pThis->aOperands[idxOp].fFlags & CIDET_OF_ALWAYS_SEG_ES) ? X86_SREG_DS
+                                            : X86_SREG_ES;
+
+            PCIDETBUF pDataBuf = pThis->aOperands[idxOp].pDataBuf;
+            AssertReleaseReturn(pDataBuf, false);
+            Assert(pDataBuf->cb == pThis->aOperands[idxOp].cb);
+            Assert(pDataBuf->idxOp == idxOp);
+            if (!pThis->pfnReInitDataBuf(pThis, pDataBuf))
+            {
+                pThis->cSkippedReInitDataBuf++;
+                return false;
+            }
+            pDataBuf->fActive = true;
+
+            /* Calc buffer related operand members. */
+            pThis->aOperands[idxOp].uEffAddr = pDataBuf->uEffBufAddr + pDataBuf->off;
+            uint64_t offSeg = pThis->aOperands[idxOp].uEffAddr - pDataBuf->uSegBase;
+            pThis->aOperands[idxOp].offSeg = offSeg;
+            AssertRelease(offSeg <= g_au64ByteSizeToMask[pThis->cbAddrMode]);
+
+            /*
+             * Select register and displacement values for the buffer addressing (works on offSeg).
+             */
+            uint8_t const iMemIndexReg = pThis->aOperands[idxOp].iMemIndexReg;
+            uint8_t const iMemBaseReg  = pThis->aOperands[idxOp].iMemBaseReg;
+            if (pThis->aOperands[idxOp].fIsRipRelative)
+            {
+                /* rip relative. */
+                pThis->aOperands[idxOp].uImmDispValue = offSeg - (pThis->InCtx.rip + pThis->cbInstr);
+                Assert(pThis->aOperands[idxOp].cbMemDisp == 4);
+                if (   (int64_t)pThis->aOperands[idxOp].uImmDispValue > INT32_MAX
+                    || (int64_t)pThis->aOperands[idxOp].uImmDispValue < INT32_MIN)
+                {
+                    pThis->cSkippedDataBufWrtRip++;
+                    return false;
+                }
+            }
+            else if (iMemBaseReg != UINT8_MAX)
+            {
+                if (   iMemBaseReg != iMemIndexReg
+                    || pThis->fUsesVexIndexRegs)
+                {
+                    /* [base] or [base + disp] or [base + index * scale] or [base + index * scale + disp] */
+                    if (pThis->aOperands[idxOp].cbMemDisp > 0)
+                    {
+                        pThis->aOperands[idxOp].uImmDispValue = CidetCoreGetRandS64(pThis, pThis->aOperands[idxOp].cbMemDisp);
+                        offSeg -= (int64_t)pThis->aOperands[idxOp].uImmDispValue;
+                    }
+
+                    if (iMemIndexReg != UINT8_MAX)
+                    {
+                        pThis->aOperands[idxOp].uMemIndexRegValue = CidetCoreGetRandU64(pThis, pThis->cbAddrMode);
+                        offSeg -= pThis->aOperands[idxOp].uMemIndexRegValue * pThis->aOperands[idxOp].uMemScale;
+                    }
+
+                    pThis->aOperands[idxOp].uMemBaseRegValue = offSeg & g_au64ByteSizeToMask[pThis->cbAddrMode];
+                }
+                else
+                {
+                    /* base == index;  [base + index * scale] or [base * (scale + 1)]. */
+                    uint8_t const uEffScale = pThis->aOperands[idxOp].uMemScale + 1;
+                    if (pThis->aOperands[idxOp].cbMemDisp > 0)
+                    {
+                        pThis->aOperands[idxOp].uImmDispValue = CidetCoreGetRandS64(pThis, pThis->aOperands[idxOp].cbMemDisp);
+                        offSeg -= (int64_t)pThis->aOperands[idxOp].uImmDispValue;
+                        offSeg &= g_au64ByteSizeToMask[pThis->cbAddrMode];
+                        uint8_t uRemainder = offSeg % uEffScale;
+                        if (uRemainder != 0)
+                        {
+                            Assert(pThis->aOperands[idxOp].cbMemDisp < 8);
+                            Assert(   (int64_t)pThis->aOperands[idxOp].uImmDispValue
+                                   <= g_ai64ByteSizeToMax[pThis->aOperands[idxOp].cbMemDisp]);
+                            pThis->aOperands[idxOp].uImmDispValue = (int64_t)pThis->aOperands[idxOp].uImmDispValue
+                                                                  + uRemainder;
+                            offSeg -= uRemainder;
+                            if (  (int64_t)pThis->aOperands[idxOp].uImmDispValue
+                                > g_ai64ByteSizeToMax[pThis->aOperands[idxOp].cbMemDisp])
+                            {
+                                pThis->aOperands[idxOp].uImmDispValue -= uEffScale;
+                                offSeg += uEffScale;
+                            }
+                            Assert(offSeg % uEffScale == 0);
+                        }
+                    }
+                    else
+                    {
+                        offSeg &= g_au64ByteSizeToMask[pThis->cbAddrMode];
+                        if (offSeg % uEffScale != 0)
+                        {
+                            pThis->cSkippedSameBaseIndexRemainder++;
+                            return false;
+                        }
+                    }
+                    offSeg /= uEffScale;
+                    pThis->aOperands[idxOp].uMemBaseRegValue = pThis->aOperands[idxOp].uMemIndexRegValue = offSeg;
+                }
+            }
+            else if (iMemIndexReg != UINT8_MAX)
+            {
+                /* [index * scale] or  [index * scale + disp] */
+                if (pThis->aOperands[idxOp].cbMemDisp > 0)
+                {
+                    pThis->aOperands[idxOp].uImmDispValue = CidetCoreGetRandS64(pThis, pThis->aOperands[idxOp].cbMemDisp);
+                    offSeg -= (int64_t)pThis->aOperands[idxOp].uImmDispValue;
+                    pThis->aOperands[idxOp].uImmDispValue += offSeg & (RT_BIT_64(pThis->aOperands[idxOp].uMemScale) - 1);
+                    offSeg &= ~(RT_BIT_64(pThis->aOperands[idxOp].uMemScale) - 1);
+                }
+                else if (offSeg & (RT_BIT_64(pThis->aOperands[idxOp].uMemScale) - 1))
+                {
+                    pThis->cSkippedOnlyIndexRemainder++;
+                    return false;
+                }
+
+                pThis->aOperands[idxOp].uMemIndexRegValue = offSeg / pThis->aOperands[idxOp].uMemScale;
+                Assert((offSeg % pThis->aOperands[idxOp].uMemScale) == 0);
+                AssertRelease(!pThis->fUsesVexIndexRegs); /** @todo implement VEX indexing */
+            }
+            else
+            {
+                /* [disp] */
+                Assert(   pThis->aOperands[idxOp].cbMemDisp == 8
+                       || pThis->aOperands[idxOp].cbMemDisp == 4
+                       || pThis->aOperands[idxOp].cbMemDisp == 2
+                       || pThis->aOperands[idxOp].cbMemDisp == 1);
+                if (  pThis->aOperands[idxOp].cbMemDisp == 4
+                    ? (int64_t)offSeg != (int32_t)offSeg
+                    : pThis->aOperands[idxOp].cbMemDisp == 2
+                    ? (int64_t)offSeg != (int16_t)offSeg
+                    : pThis->aOperands[idxOp].cbMemDisp == 1
+                    ? (int64_t)offSeg != (int8_t)offSeg
+                    : false /* 8 */)
+                {
+                    pThis->cSkippedDirectAddressingOverflow++;
+                    return false;
+                }
+                pThis->aOperands[idxOp].uImmDispValue = offSeg;
+            }
+
+            /*
+             * Modify the input and expected output contexts with the base and
+             * index register values.  To simplify verification and the work
+             * here, we update the uMemBaseRegValue and uMemIndexRegValue
+             * members to reflect the whole register.
+             */
+            if (iMemBaseReg != UINT8_MAX)
+            {
+                if (pThis->cbAddrMode == 4)
+                {
+                    pThis->aOperands[idxOp].uMemBaseRegValue &= UINT32_MAX;
+                    pThis->aOperands[idxOp].uMemBaseRegValue |= pThis->InCtx.aGRegs[iMemBaseReg] & UINT64_C(0xffffffff00000000);
+                }
+                else if (pThis->cbAddrMode == 2)
+                {
+                    pThis->aOperands[idxOp].uMemBaseRegValue &= UINT16_MAX;
+                    pThis->aOperands[idxOp].uMemBaseRegValue |= pThis->InCtx.aGRegs[iMemBaseReg] & UINT64_C(0xffffffffffff0000);
+                }
+                pThis->InCtx.aGRegs[iMemBaseReg]       = pThis->aOperands[idxOp].uMemBaseRegValue;
+                pThis->ExpectedCtx.aGRegs[iMemBaseReg] = pThis->aOperands[idxOp].uMemBaseRegValue;
+            }
+
+            if (iMemIndexReg != UINT8_MAX)
+            {
+                if (pThis->cbAddrMode == 4)
+                {
+                    pThis->aOperands[idxOp].uMemIndexRegValue &= UINT32_MAX;
+                    pThis->aOperands[idxOp].uMemIndexRegValue |= pThis->InCtx.aGRegs[iMemIndexReg] & UINT64_C(0xffffffff00000000);
+                }
+                else if (pThis->cbAddrMode == 2)
+                {
+                    pThis->aOperands[idxOp].uMemIndexRegValue &= UINT16_MAX;
+                    pThis->aOperands[idxOp].uMemIndexRegValue |= pThis->InCtx.aGRegs[iMemIndexReg] & UINT64_C(0xffffffffffff0000);
+                }
+                pThis->InCtx.aGRegs[iMemIndexReg]       = pThis->aOperands[idxOp].uMemIndexRegValue;
+                pThis->ExpectedCtx.aGRegs[iMemIndexReg] = pThis->aOperands[idxOp].uMemIndexRegValue;
+            }
+        }
+        else
+        {
+            /*
+             * Non-memory, so clear the memory related members.
+             */
+            Assert(!pThis->aOperands[idxOp].fIsMem);
+            pThis->aOperands[idxOp].iEffSeg  = UINT8_MAX;
+            pThis->aOperands[idxOp].offSeg   = UINT64_MAX;
+            pThis->aOperands[idxOp].uEffAddr = UINT64_MAX;
+            pThis->aOperands[idxOp].pDataBuf = NULL;
+
+            switch (pThis->aOperands[idxOp].fFlags & CIDET_OF_K_MASK)
+            {
+                case CIDET_OF_K_GPR:
+                    if (!pThis->aOperands[idxOp].fIsHighByteRegister)
+                    {
+                        pThis->aOperands[idxOp].In.pv = &pThis->InCtx.aGRegs[pThis->aOperands[idxOp].iReg];
+                        pThis->aOperands[idxOp].Expected.pv = &pThis->ExpectedCtx.aGRegs[pThis->aOperands[idxOp].iReg];
+                    }
+                    else
+                    {
+                        pThis->aOperands[idxOp].In.pv = &pThis->InCtx.aGRegs[pThis->aOperands[idxOp].iReg - 4];
+                        pThis->aOperands[idxOp].In.pu8++;
+                        pThis->aOperands[idxOp].Expected.pv = &pThis->ExpectedCtx.aGRegs[pThis->aOperands[idxOp].iReg - 4];
+                        pThis->aOperands[idxOp].Expected.pu8++;
+                    }
+                    break;
+
+                case CIDET_OF_K_IMM:
+                    pThis->aOperands[idxOp].In.pv = NULL;
+                    pThis->aOperands[idxOp].Expected.pv = NULL;
+                    break;
+
+                case CIDET_OF_K_SREG:
+                    if (pThis->aOperands[idxOp].iReg < RT_ELEMENTS(pThis->InCtx.aSRegs))
+                    {
+                        pThis->aOperands[idxOp].In.pv = &pThis->InCtx.aSRegs[pThis->aOperands[idxOp].iReg];
+                        pThis->aOperands[idxOp].Expected.pv = &pThis->ExpectedCtx.aSRegs[pThis->aOperands[idxOp].iReg];
+                    }
+                    else
+                    {
+                        pThis->aOperands[idxOp].In.pv = NULL;
+                        pThis->aOperands[idxOp].Expected.pv = NULL;
+                    }
+                    break;
+
+                case CIDET_OF_K_CR:
+                case CIDET_OF_K_SSE:
+                case CIDET_OF_K_AVX:
+                case CIDET_OF_K_AVX512:
+                case CIDET_OF_K_FPU:
+                case CIDET_OF_K_MMX:
+                case CIDET_OF_K_AVXFUTURE:
+                case CIDET_OF_K_SPECIAL:
+                case CIDET_OF_K_TEST:
+                    /** @todo Implement testing these registers. */
+                case CIDET_OF_K_NONE:
+                default:
+                    AssertReleaseFailedReturn(false);
+            }
+        }
+    }
+    AssertRelease((uintptr_t)pbBuf - (uintptr_t)&pThis->abBuf[0] <= sizeof(pThis->abBuf));
+
+    /*
+     * Call instruction specific setup function (for operand values and flags).
+     */
+    int rc = pThis->pCurInstr->pfnSetupInOut(pThis, false /*fInvalid*/);
+    if (RT_FAILURE(rc))
+    {
+        pThis->cSkippedSetupInOut++;
+        return false;
+    }
+
+    /*
+     * Do the 2nd set of the memory operand preparations.
+     */
+    if (pThis->fHasMemoryOperand)
+    {
+        idxOp = pThis->cOperands;
+        while (idxOp-- > 0)
+            if (pThis->aOperands[idxOp].fIsMem)
+            {
+                Assert(pThis->aOperands[idxOp].pDataBuf);
+                if (!pThis->pfnSetupDataBuf(pThis, pThis->aOperands[idxOp].pDataBuf, pThis->aOperands[idxOp].In.pv))
+                {
+                    pThis->cSkippedSetupDataBuf++;
+                    return false;
+                }
+
+                Assert(   pThis->aOperands[idxOp].iMemBaseReg == UINT8_MAX
+                       || pThis->InCtx.aGRegs[pThis->aOperands[idxOp].iMemBaseReg] == pThis->aOperands[idxOp].uMemBaseRegValue);
+                Assert(   pThis->aOperands[idxOp].iMemIndexReg == UINT8_MAX
+                       || (  !pThis->fUsesVexIndexRegs
+                           ?    pThis->InCtx.aGRegs[pThis->aOperands[idxOp].iMemIndexReg]
+                             == pThis->aOperands[idxOp].uMemIndexRegValue
+                           : false /** @todo VEX indexing */));
+            }
+    }
+
+    return true;
+}
+
+
+/**
+ * Figures the instruction length.
+ *
+ * This is a duplicate of CidetCoreAssemble() with the buffer updates removed.
+ *
+ * @returns true and pThis->cbInstr on success, false on failure.
+ * @param   pThis           The core state structure (for context).
+ */
+bool CidetCoreAssembleLength(PCIDETCORE pThis)
+{
+    uint8_t off = 0;
+
+    /*
+     * Prefixes.
+     */
+    if (1)
+    {
+        if (pThis->fAddrSizePrf)
+            off++;
+        if (pThis->fOpSizePrf)
+            off++;
+    }
+    else
+    {
+        /** @todo prefix list. */
+    }
+
+    /*
+     * Prefixes that must come right before the opcode.
+     */
+    /** @todo VEX and EVEX. */
+    if (pThis->fVex)
+    {
+        /** @todo VEX and EVEX. */
+    }
+    else if (pThis->fEvex)
+    {
+        /** @todo VEX and EVEX. */
+    }
+    else
+    {
+        if (pThis->fRexB || pThis->fRexX || pThis->fRexR || pThis->fRexW || pThis->fRex)
+            off++;
+    }
+
+    /*
+     * The opcode.
+     */
+    uint8_t const *pbOpcode = pThis->pCurInstr->abOpcode;
+    switch (pThis->pCurInstr->cbOpcode)
+    {
+        case 3: off++;
+        case 2: off++;
+        case 1: off++;
+            break;
+        default:
+            AssertReleaseFailedReturn(false);
+    }
+
+    /*
+     * Mod R/M
+     */
+    if (pThis->fUsesModRm)
+    {
+        off++;
+        if (pThis->fSib)
+            off++;
+        if (pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands))
+        {
+            uint64_t uDispValue = pThis->aOperands[pThis->idxMrmRmOp].uImmDispValue;
+            switch (pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp)
+            {
+                case 0: break;
+                case 8:
+                case 7:
+                case 6:
+                case 5:
+                case 4:
+                case 3:
+                case 2:
+                case 1:
+                    break;
+                default: AssertReleaseFailedReturn(false);
+            }
+            off += pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp;
+        }
+    }
+
+    /*
+     * Immediates.
+     */
+    uint8_t iOp = pThis->cOperands;
+    while (iOp-- > 0)
+        if ((pThis->aOperands[iOp].fFlags & CIDET_OF_K_MASK) == CIDET_OF_K_IMM)
+        {
+            uint64_t uImmValue = pThis->aOperands[iOp].uImmDispValue;
+            switch (pThis->aOperands[iOp].cb)
+            {
+                case 8:
+                case 7:
+                case 6:
+                case 5:
+                case 4:
+                case 3:
+                case 2:
+                case 1:
+                    break;
+                default: AssertReleaseFailedReturn(false);
+            }
+            off += pThis->aOperands[iOp].cb;
+        }
+
+    pThis->cbInstr = off;
+    return true;
+}
+
+
+/**
+ * Assembles the instruction.
+ *
+ * This is a duplicate of CidetCoreAssembleLength() with buffer writes.
+ *
+ * @returns true and pThis->cbInstr and pThis->abInstr on success, false on
+ *          failure.
+ * @param   pThis           The core state structure (for context).
+ */
+bool CidetCoreAssemble(PCIDETCORE pThis)
+{
+    uint8_t off = 0;
+
+    /*
+     * Prefixes.
+     */
+    if (1)
+    {
+        if (pThis->fAddrSizePrf)
+            pThis->abInstr[off++] = 0x67;
+        if (pThis->fOpSizePrf)
+            pThis->abInstr[off++] = 0x66;
+    }
+    else
+    {
+        /** @todo prefix list. */
+    }
+
+    /*
+     * Prefixes that must come right before the opcode.
+     */
+    /** @todo VEX and EVEX. */
+    if (pThis->fVex)
+    {
+        /** @todo VEX and EVEX. */
+    }
+    else if (pThis->fEvex)
+    {
+        /** @todo VEX and EVEX. */
+    }
+    else
+    {
+        if (pThis->fRexB || pThis->fRexX || pThis->fRexR || pThis->fRexW || pThis->fRex)
+            pThis->abInstr[off++] = 0x40 | (pThis->fRexB * 1) | (pThis->fRexX * 2) | (pThis->fRexR * 4) | (pThis->fRexW * 8);
+    }
+
+    /*
+     * The opcode.
+     */
+    uint8_t const *pbOpcode = pThis->pCurInstr->abOpcode;
+    switch (pThis->pCurInstr->cbOpcode)
+    {
+        case 3: pThis->abInstr[off++] = *pbOpcode++;
+        case 2: pThis->abInstr[off++] = *pbOpcode++;
+        case 1: pThis->abInstr[off++] = *pbOpcode++;
+            break;
+        default:
+            AssertReleaseFailedReturn(false);
+    }
+
+    /*
+     * Mod R/M
+     */
+    if (pThis->fUsesModRm)
+    {
+        pThis->abInstr[off++] = pThis->bModRm;
+        if (pThis->fSib)
+            pThis->abInstr[off++] = pThis->bSib;
+        if (pThis->idxMrmRmOp < RT_ELEMENTS(pThis->aOperands))
+        {
+            uint64_t uDispValue = pThis->aOperands[pThis->idxMrmRmOp].uImmDispValue;
+            switch (pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp)
+            {
+                case 0: break;
+                case 8: pThis->abInstr[off + 3] = (uDispValue >> 56) & UINT8_C(0xff);
+                case 7: pThis->abInstr[off + 3] = (uDispValue >> 48) & UINT8_C(0xff);
+                case 6: pThis->abInstr[off + 3] = (uDispValue >> 40) & UINT8_C(0xff);
+                case 5: pThis->abInstr[off + 3] = (uDispValue >> 32) & UINT8_C(0xff);
+                case 4: pThis->abInstr[off + 3] = (uDispValue >> 24) & UINT8_C(0xff);
+                case 3: pThis->abInstr[off + 2] = (uDispValue >> 16) & UINT8_C(0xff);
+                case 2: pThis->abInstr[off + 1] = (uDispValue >>  8) & UINT8_C(0xff);
+                case 1: pThis->abInstr[off] = uDispValue & UINT8_C(0xff);
+                    break;
+                default: AssertReleaseFailedReturn(false);
+            }
+            off += pThis->aOperands[pThis->idxMrmRmOp].cbMemDisp;
+        }
+    }
+
+    /*
+     * Immediates.
+     */
+    uint8_t iOp = pThis->cOperands;
+    while (iOp-- > 0)
+        if ((pThis->aOperands[iOp].fFlags & CIDET_OF_K_MASK) == CIDET_OF_K_IMM)
+        {
+            uint64_t uImmValue = pThis->aOperands[iOp].uImmDispValue;
+            switch (pThis->aOperands[iOp].cb)
+            {
+                case 8: pThis->abInstr[off + 3] = (uImmValue >> 56) & UINT8_C(0xff);
+                case 7: pThis->abInstr[off + 3] = (uImmValue >> 48) & UINT8_C(0xff);
+                case 6: pThis->abInstr[off + 3] = (uImmValue >> 40) & UINT8_C(0xff);
+                case 5: pThis->abInstr[off + 3] = (uImmValue >> 32) & UINT8_C(0xff);
+                case 4: pThis->abInstr[off + 3] = (uImmValue >> 24) & UINT8_C(0xff);
+                case 3: pThis->abInstr[off + 2] = (uImmValue >> 16) & UINT8_C(0xff);
+                case 2: pThis->abInstr[off + 1] = (uImmValue >>  8) & UINT8_C(0xff);
+                case 1: pThis->abInstr[off] = uImmValue & UINT8_C(0xff);
+                    break;
+                default: AssertReleaseFailedReturn(false);
+            }
+            off += pThis->aOperands[iOp].cb;
+        }
+
+    pThis->cbInstr = off;
+    return true;
+}
+
+
+bool CidetCoreReInitCodeBuf(PCIDETCORE pThis)
+{
+    /*
+     * Re-initialize the buffer.  Requires instruction length and positioning.
+     */
+    if (CidetCoreAssembleLength(pThis))
+    {
+        pThis->CodeBuf.cb  = pThis->cbInstr;
+        pThis->CodeBuf.off = CIDET_CODE_BUF_SIZE - PAGE_SIZE - pThis->cbInstr;
+        if (pThis->pfnReInitCodeBuf(pThis, &pThis->CodeBuf))
+        {
+            pThis->CodeBuf.fActive = true;
+
+            /*
+             * Update the RIP and CS values in the input and expected contexts.
+             */
+            pThis->InCtx.rip       = pThis->CodeBuf.uEffBufAddr + pThis->CodeBuf.offActive - pThis->CodeBuf.uSegBase;
+            pThis->ExpectedCtx.rip = pThis->InCtx.rip + pThis->cbInstr; /** @todo account for expected traps. */
+            if (pThis->CodeBuf.uSeg != UINT32_MAX)
+            {
+                pThis->InCtx.aSRegs[X86_SREG_CS] = pThis->CodeBuf.uSeg;
+                pThis->ExpectedCtx.aSRegs[X86_SREG_CS] = pThis->CodeBuf.uSeg;
+            }
+            return true;
+        }
+        else
+            pThis->cSkippedReInitCodeBuf++;
+    }
+    else
+        pThis->cSkippedAssemble++;
+    return false;
+}
+
+
+#ifdef CIDET_DEBUG_DISAS
+/**
+ * @callback_method_impl{FNDISREADBYTES}
+ */
+static DECLCALLBACK(int) cidetCoreDisReadBytes(PDISSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead)
+{
+    PCIDETCORE pThis = (PCIDETCORE)pDis->pvUser;
+    memcpy(&pDis->abInstr[offInstr], &pThis->abInstr[offInstr], cbMaxRead);
+    pDis->cbCachedInstr = offInstr + cbMaxRead;
+    return VINF_SUCCESS;
+}
+#endif
+
+
+bool CidetCoreSetupCodeBuf(PCIDETCORE pThis, unsigned iSubTest)
+{
+    if (CidetCoreAssemble(pThis))
+    {
+        //CIDET_DPRINTF(("%04u: %.*Rhxs\n", i, pThis->cbInstr, pThis->abInstr));
+#ifdef CIDET_DEBUG_DISAS
+        DISCPUSTATE Dis;
+        char        szInstr[80] = {0};
+        uint32_t    cbInstr;
+        int rcDis = DISInstrToStrEx(pThis->InCtx.rip,
+                                    CIDETMODE_IS_64BIT(pThis->bMode)   ? DISCPUMODE_64BIT
+                                    : CIDETMODE_IS_32BIT(pThis->bMode) ? DISCPUMODE_32BIT : DISCPUMODE_16BIT,
+                                    cidetCoreDisReadBytes,
+                                    pThis,
+                                    DISOPTYPE_ALL,
+                                    &Dis,
+                                    &cbInstr,
+                                    szInstr, sizeof(szInstr));
+        CIDET_DPRINTF(("%04u: %s", iSubTest, szInstr));
+        Assert(cbInstr == pThis->cbInstr);
+#endif
+        if (pThis->pfnSetupCodeBuf(pThis, &pThis->CodeBuf, pThis->abInstr))
+        {
+            return true;
+        }
+        pThis->cSkippedSetupCodeBuf++;
+    }
+    else
+        pThis->cSkippedAssemble++;
+    return false;
+}
+
+
+/**
+ * Compares the output with the output expectations.
+ *
+ * @returns true if ok, false if not (calls pfnFailure too).
+ * @param   pThis           The core state structure.
+ */
+bool CidetCoreCheckResults(PCIDETCORE pThis)
+{
+    if (memcmp(&pThis->ActualCtx, &pThis->ExpectedCtx, CIDETCPUCTX_COMPARE_SIZE) == 0)
+        return true;
+
+    unsigned cDiffs = 0;
+#define IF_FIELD_DIFFERS_SET_ERROR(a_Field, a_Fmt) \
+        if (pThis->ActualCtx.a_Field != pThis->ExpectedCtx.a_Field) \
+        { \
+            CidetCoreSetError(pThis, #a_Field " differs: got %#llx expected %#llx", \
+                              pThis->ActualCtx.a_Field, pThis->ExpectedCtx.a_Field); \
+            cDiffs++; \
+        } else do { } while (0)
+
+    IF_FIELD_DIFFERS_SET_ERROR(rip,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(rfl,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_xAX],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_xBX],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_xCX],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_xDX],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_xSP],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_xBP],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_xSI],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_xDI],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x8],    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x9],    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x9],    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x10],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x11],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x12],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x13],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x14],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aGRegs[X86_GREG_x15],   "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(aSRegs[X86_SREG_CS],    "%#06x");
+    IF_FIELD_DIFFERS_SET_ERROR(aSRegs[X86_SREG_SS],    "%#06x");
+    IF_FIELD_DIFFERS_SET_ERROR(aSRegs[X86_SREG_DS],    "%#06x");
+    IF_FIELD_DIFFERS_SET_ERROR(aSRegs[X86_SREG_ES],    "%#06x");
+    IF_FIELD_DIFFERS_SET_ERROR(aSRegs[X86_SREG_FS],    "%#06x");
+    IF_FIELD_DIFFERS_SET_ERROR(aSRegs[X86_SREG_GS],    "%#06x");
+    IF_FIELD_DIFFERS_SET_ERROR(uXcpt,                  "%#04x");
+    IF_FIELD_DIFFERS_SET_ERROR(uErr,                   "%#04llx");
+    IF_FIELD_DIFFERS_SET_ERROR(cr2,                    "%#010llx");
+#ifndef CIDET_REDUCED_CTX
+    IF_FIELD_DIFFERS_SET_ERROR(tr,                     "%#06x");
+    IF_FIELD_DIFFERS_SET_ERROR(ldtr,                   "%#06x");
+    IF_FIELD_DIFFERS_SET_ERROR(cr0,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(cr3,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(cr4,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(cr8,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(dr0,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(dr1,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(dr2,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(dr3,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(dr6,                    "%#010llx");
+    IF_FIELD_DIFFERS_SET_ERROR(dr7,                    "%#010llx");
+#endif
+
+AssertMsgFailed(("cDiffs=%d\n", cDiffs));
+    Assert(cDiffs > 0);
+    return cDiffs == 0;
+}
+
+
+bool CidetCoreTest_Basic(PCIDETCORE pThis)
+{
+    /*
+     * Iterate all encodings.
+     */
+    if (!CidetCoreSetupFirstBaseEncoding(pThis))
+        return CidetCoreSetError(pThis, "CidetCoreSetupFirstBaseEncoding failed");
+    unsigned cExecuted = 0;
+    unsigned cSkipped = 0;
+    do
+    {
+        /*
+         * Iterate data buffer configurations (one iteration if none).
+         */
+        if (CidetCoreSetupFirstMemoryOperandConfig(pThis))
+        {
+            do
+            {
+                /*
+                 * Iterate code buffer configurations.
+                 */
+                if (!CidetCoreSetupFirstCodeBufferConfig(pThis))
+                    return CidetCoreSetError(pThis, "CidetCoreSetupFirstMemoryOperandConfig failed");
+                do
+                {
+                    /*
+                     * Set up inputs and expected outputs, then emit the test code.
+                     */
+                    pThis->InCtx        = pThis->InTemplateCtx;
+                    pThis->InCtx.fTrickyStack = pThis->fHasStackRegInMrmRmBase || pThis->fHasStackRegInMrmReg;
+                    pThis->ExpectedCtx  = pThis->InCtx;
+                    if (   CidetCoreReInitCodeBuf(pThis)
+                        && CidetCoreSetupInOut(pThis)
+                        && CidetCoreSetupCodeBuf(pThis, cSkipped + cExecuted)
+                       )
+                    {
+                        if (pThis->pfnExecute(pThis))
+                        {
+                            cExecuted++;
+
+                            /*
+                             * Check the result against our expectations.
+                             */
+                            CidetCoreCheckResults(pThis);
+                            /** @todo check result. */
+
+                        }
+                        else
+                            cSkipped++;
+                    }
+                    else
+                        cSkipped++;
+                } while (CidetCoreSetupNextCodeBufferConfig(pThis));
+            } while (CidetCoreSetupNextMemoryOperandConfig(pThis));
+        }
+        else
+            cSkipped++;
+    } while (CidetCoreSetupNextBaseEncoding(pThis));
+
+    CIDET_DPRINTF(("CidetCoreTest_Basic: cExecuted=%u cSkipped=%u\n"
+                   "  cSkippedSetupInOut               =%u\n"
+                   "  cSkippedReInitDataBuf            =%u\n"
+                   "  cSkippedSetupDataBuf             =%u\n"
+                   "  cSkippedDataBufWrtRip            =%u\n"
+                   "  cSkippedAssemble                 =%u\n"
+                   "  cSkippedReInitCodeBuf            =%u\n"
+                   "  cSkippedSetupCodeBuf             =%u\n"
+                   "  cSkippedSameBaseIndexRemainder   =%u\n"
+                   "  cSkippedOnlyIndexRemainder       =%u\n"
+                   "  cSkippedDirectAddressingOverflow =%u\n"
+                   ,
+                   cExecuted, cSkipped,
+                   pThis->cSkippedSetupInOut,
+                   pThis->cSkippedReInitDataBuf,
+                   pThis->cSkippedSetupDataBuf,
+                   pThis->cSkippedDataBufWrtRip,
+                   pThis->cSkippedAssemble,
+                   pThis->cSkippedReInitCodeBuf,
+                   pThis->cSkippedSetupCodeBuf,
+                   pThis->cSkippedSameBaseIndexRemainder,
+                   pThis->cSkippedOnlyIndexRemainder,
+                   pThis->cSkippedDirectAddressingOverflow
+                   ));
+
+    return true;
+}
+
+
+bool CidetCoreTestInstruction(PCIDETCORE pThis, PCCIDETINSTR pInstr)
+{
+    AssertReleaseMsgReturn(RT_VALID_PTR(pThis), ("%p\n", pThis), false);
+    AssertReleaseReturn(pThis->u32Magic == CIDETCORE_MAGIC, false);
+    AssertReleaseReturn(pThis->cCodeBufConfigs > 0, false);
+
+    if (!CideCoreSetInstruction(pThis, pInstr))
+        return CidetCoreSetError(pThis, "CideCoreSetInstruction failed");
+
+    bool fResult = CidetCoreTest_Basic(pThis);
+
+    return fResult;
+}
+
diff --git a/src/VBox/ValidationKit/utils/cpu/cidet-instr-1.cpp b/src/VBox/ValidationKit/utils/cpu/cidet-instr-1.cpp
new file mode 100644
index 0000000..dd92ea0
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/cidet-instr-1.cpp
@@ -0,0 +1,287 @@
+/* $Id: cidet-instr-1.cpp $ */
+/** @file
+ * CPU Instruction Decoding & Execution Tests - First bunch of instructions.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include "cidet.h"
+#include <VBox/err.h>
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/*
+ * Shorter defines for the EFLAGS to save table space.
+ */
+#undef  CF
+#undef  PF
+#undef  AF
+#undef  ZF
+#undef  SF
+#undef  OF
+
+#define CF X86_EFL_CF
+#define PF X86_EFL_PF
+#define AF X86_EFL_AF
+#define ZF X86_EFL_ZF
+#define SF X86_EFL_SF
+#define OF X86_EFL_OF
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef struct CIDET2IN1OUTWITHFLAGSU8ENTRY
+{
+    uint8_t     uIn1;
+    uint8_t     uIn2;
+    uint16_t    fEFlagsIn;
+    uint8_t     uOut;
+    uint16_t    fEFlagsOut;
+} CIDET2IN1OUTWITHFLAGSU8ENTRY;
+typedef CIDET2IN1OUTWITHFLAGSU8ENTRY const *PCCIDET2IN1OUTWITHFLAGSU8ENTRY;
+
+typedef struct CIDET2IN1OUTWITHFLAGSU16ENTRY
+{
+    uint16_t    uIn1;
+    uint16_t    uIn2;
+    uint16_t    fEFlagsIn;
+    uint16_t    uOut;
+    uint16_t    fEFlagsOut;
+} CIDET2IN1OUTWITHFLAGSU16ENTRY;
+typedef CIDET2IN1OUTWITHFLAGSU16ENTRY const *PCCIDET2IN1OUTWITHFLAGSU16ENTRY;
+
+typedef struct CIDET2IN1OUTWITHFLAGSU32ENTRY
+{
+    uint32_t    uIn1;
+    uint32_t    uIn2;
+    uint16_t    fEFlagsIn;
+    uint32_t    uOut;
+    uint16_t    fEFlagsOut;
+} CIDET2IN1OUTWITHFLAGSU32ENTRY;
+typedef CIDET2IN1OUTWITHFLAGSU32ENTRY const *PCCIDET2IN1OUTWITHFLAGSU32ENTRY;
+
+typedef struct CIDET2IN1OUTWITHFLAGSU64ENTRY
+{
+    uint64_t    uIn1;
+    uint64_t    uIn2;
+    uint16_t    fEFlagsIn;
+    uint64_t    uOut;
+    uint16_t    fEFlagsOut;
+} CIDET2IN1OUTWITHFLAGSU64ENTRY;
+typedef CIDET2IN1OUTWITHFLAGSU64ENTRY const *PCCIDET2IN1OUTWITHFLAGSU64ENTRY;
+
+typedef struct CIDET2IN1OUTWITHFLAGS
+{
+    PCCIDET2IN1OUTWITHFLAGSU8ENTRY  pa8Entries;
+    PCCIDET2IN1OUTWITHFLAGSU16ENTRY pa16Entries;
+    PCCIDET2IN1OUTWITHFLAGSU32ENTRY pa32Entries;
+    PCCIDET2IN1OUTWITHFLAGSU64ENTRY pa64Entries;
+    uint16_t c8Entries;
+    uint16_t c16Entries;
+    uint16_t c32Entries;
+    uint16_t c64Entries;
+    uint32_t fRelevantEFlags;
+} CIDET2IN1OUTWITHFLAGS;
+
+#define CIDET2IN1OUTWITHFLAGS_INITIALIZER(a_fRelevantEFlags) \
+    { \
+        &s_a8Results[0], &s_a16Results[0], &s_a32Results[0], &s_a64Results[0], \
+        RT_ELEMENTS(s_a8Results), RT_ELEMENTS(s_a16Results), RT_ELEMENTS(s_a32Results), RT_ELEMENTS(s_a64Results), \
+        (a_fRelevantEFlags) \
+    }
+
+
+/**
+ * Generic worker for a FNCIDETSETUPINOUT function with two GPR/MEM registers,
+ * storing result in the first and flags.
+ *
+ * @returns See FNCIDETSETUPINOUT.
+ * @param   pThis           The core CIDET state structure.  The InCtx
+ *                          and ExpectedCtx members will be modified.
+ * @param   fInvalid        When set, get the next invalid operands that will
+ *                          cause exceptions/faults.
+ * @param   pResults        The result collection.
+ */
+static int CidetGenericIn2Out1WithFlags(PCIDETCORE pThis, bool fInvalid, CIDET2IN1OUTWITHFLAGS const *pResults)
+{
+    int rc;
+
+    Assert(pThis->idxMrmRegOp < 2);
+    Assert(pThis->idxMrmRmOp  < 2);
+    Assert(pThis->idxMrmRmOp != pThis->idxMrmRegOp);
+    AssertCompile(RT_ELEMENTS(pThis->aiInOut) >= 4);
+
+    if (!fInvalid)
+    {
+        if (   !pThis->fHasRegCollisionDirect
+            && !pThis->fHasRegCollisionMem)
+        {
+            pThis->InCtx.rfl       &= ~(uint64_t)pResults->fRelevantEFlags;
+            pThis->ExpectedCtx.rfl &= ~(uint64_t)pResults->fRelevantEFlags;
+            switch (pThis->aOperands[0].cb)
+            {
+                case 1:
+                {
+                    uint16_t                       idx    = ++pThis->aiInOut[0] % pResults->c8Entries;
+                    PCCIDET2IN1OUTWITHFLAGSU8ENTRY pEntry = &pResults->pa8Entries[idx];
+                    rc = idx ? VINF_SUCCESS : VINF_EOF;
+
+                    *pThis->aOperands[0].In.pu8       = pEntry->uIn1;
+                    *pThis->aOperands[1].In.pu8       = pEntry->uIn2;
+                    pThis->InCtx.rfl                 |= pEntry->fEFlagsIn;
+
+                    *pThis->aOperands[0].Expected.pu8 = pEntry->uOut;
+                    *pThis->aOperands[1].Expected.pu8 = pEntry->uIn2;
+                    pThis->ExpectedCtx.rfl           |= pEntry->fEFlagsOut;
+                    break;
+                }
+
+                case 2:
+                {
+                    uint16_t                        idx    = ++pThis->aiInOut[1] % pResults->c16Entries;
+                    PCCIDET2IN1OUTWITHFLAGSU16ENTRY pEntry = &pResults->pa16Entries[idx];
+                    rc = idx ? VINF_SUCCESS : VINF_EOF;
+
+                    *pThis->aOperands[0].In.pu16       = pEntry->uIn1;
+                    *pThis->aOperands[1].In.pu16       = pEntry->uIn2;
+                    pThis->InCtx.rfl                  |= pEntry->fEFlagsIn;
+
+                    *pThis->aOperands[0].Expected.pu16 = pEntry->uOut;
+                    *pThis->aOperands[1].Expected.pu16 = pEntry->uIn2;
+                    pThis->ExpectedCtx.rfl            |= pEntry->fEFlagsOut;
+                    break;
+                }
+
+                case 4:
+                {
+                    uint16_t                        idx    = ++pThis->aiInOut[2] % pResults->c32Entries;
+                    PCCIDET2IN1OUTWITHFLAGSU32ENTRY pEntry = &pResults->pa32Entries[idx];
+                    rc = idx ? VINF_SUCCESS : VINF_EOF;
+
+                    *pThis->aOperands[0].In.pu32       = pEntry->uIn1;
+                    *pThis->aOperands[1].In.pu32       = pEntry->uIn2;
+                    pThis->InCtx.rfl                  |= pEntry->fEFlagsIn;
+
+                    *pThis->aOperands[0].Expected.pu32 = pEntry->uOut;
+                    if (!pThis->aOperands[0].fIsMem)
+                        pThis->aOperands[0].Expected.pu32[1] = 0;
+                    *pThis->aOperands[1].Expected.pu32 = pEntry->uIn2;
+                    pThis->ExpectedCtx.rfl            |= pEntry->fEFlagsOut;
+                    break;
+                }
+
+                case 8:
+                {
+                    uint16_t                        idx    = ++pThis->aiInOut[3] % pResults->c64Entries;
+                    PCCIDET2IN1OUTWITHFLAGSU64ENTRY pEntry = &pResults->pa64Entries[idx];
+                    rc = idx ? VINF_SUCCESS : VINF_EOF;
+
+                    *pThis->aOperands[0].In.pu64       = pEntry->uIn1;
+                    *pThis->aOperands[1].In.pu64       = pEntry->uIn2;
+                    pThis->InCtx.rfl                  |= pEntry->fEFlagsIn;
+
+                    *pThis->aOperands[0].Expected.pu64 = pEntry->uOut;
+                    *pThis->aOperands[1].Expected.pu64 = pEntry->uIn2;
+                    pThis->ExpectedCtx.rfl            |= pEntry->fEFlagsOut;
+                    break;
+                }
+
+                default:
+                    AssertFailed();
+                    rc = VERR_INTERNAL_ERROR_3;
+            }
+        }
+        else
+            rc = VERR_NOT_SUPPORTED;
+    }
+    else
+        rc = VERR_NO_DATA;
+    return rc;
+}
+
+
+static DECLCALLBACK(int) cidetInOutAdd(PCIDETCORE pThis, bool fInvalid)
+{
+    static const CIDET2IN1OUTWITHFLAGSU8ENTRY s_a8Results[] =
+    {
+        { UINT8_C(0x00), UINT8_C(0x00), 0, UINT8_C(0x00), ZF | PF },
+        { UINT8_C(0xff), UINT8_C(0x01), 0, UINT8_C(0x00), CF | ZF | AF | PF  },
+        { UINT8_C(0x7f), UINT8_C(0x80), 0, UINT8_C(0xff), SF | PF },
+        { UINT8_C(0x01), UINT8_C(0x01), 0, UINT8_C(0x02), 0 },
+    };
+    static const CIDET2IN1OUTWITHFLAGSU16ENTRY s_a16Results[] =
+    {
+        { UINT16_C(0x0000), UINT16_C(0x0000), 0, UINT16_C(0x0000), ZF | PF },
+        { UINT16_C(0xfefd), UINT16_C(0x0103), 0, UINT16_C(0x0000), CF | ZF | AF | PF },
+        { UINT16_C(0x8e7d), UINT16_C(0x7182), 0, UINT16_C(0xffff), SF | PF },
+        { UINT16_C(0x0001), UINT16_C(0x0001), 0, UINT16_C(0x0002), 0 },
+    };
+    static const CIDET2IN1OUTWITHFLAGSU32ENTRY s_a32Results[] =
+    {
+        { UINT32_C(0x00000000), UINT32_C(0x00000000), 0, UINT32_C(0x00000000), ZF | PF },
+        { UINT32_C(0xfefdfcfb), UINT32_C(0x01020305), 0, UINT32_C(0x00000000), CF | ZF | AF | PF },
+        { UINT32_C(0x8efdfcfb), UINT32_C(0x71020304), 0, UINT32_C(0xffffffff), SF | PF },
+        { UINT32_C(0x00000001), UINT32_C(0x00000001), 0, UINT32_C(0x00000002), 0 },
+    };
+    static const CIDET2IN1OUTWITHFLAGSU64ENTRY s_a64Results[] =
+    {
+        { UINT64_C(0x0000000000000000), UINT64_C(0x0000000000000000), 0, UINT64_C(0x0000000000000000), ZF | PF },
+        { UINT64_C(0xfefdfcfbfaf9f8f7), UINT64_C(0x0102030405060709), 0, UINT64_C(0x0000000000000000), CF | ZF | AF | PF },
+        { UINT64_C(0x7efdfcfbfaf9f8f7), UINT64_C(0x8102030405060708), 0, UINT64_C(0xffffffffffffffff), SF | PF },
+        { UINT64_C(0x0000000000000001), UINT64_C(0x0000000000000001), 0, UINT64_C(0x0000000000000002), 0 },
+    };
+    static const CIDET2IN1OUTWITHFLAGS s_Results = CIDET2IN1OUTWITHFLAGS_INITIALIZER(CF | PF | AF | SF | OF);
+    return CidetGenericIn2Out1WithFlags(pThis, fInvalid, &s_Results);
+}
+
+
+/** First bunch of instructions.  */
+const CIDETINSTR g_aCidetInstructions1[] =
+{
+#if 1
+    {
+        "add Eb,Gb", cidetInOutAdd,  1, {0x00, 0, 0}, 0, 2,
+        {   CIDET_OF_K_GPR | CIDET_OF_Z_BYTE | CIDET_OF_M_RM | CIDET_OF_A_RW,
+            CIDET_OF_K_GPR | CIDET_OF_Z_BYTE | CIDET_OF_M_REG | CIDET_OF_A_R,
+            0, 0 }, CIDET_IF_MODRM
+    },
+#endif
+#if 1
+    {
+        "add Ev,Gv", cidetInOutAdd,  1, {0x01, 0, 0}, 0, 2,
+        {   CIDET_OF_K_GPR | CIDET_OF_Z_VAR_WDQ | CIDET_OF_M_RM | CIDET_OF_A_RW,
+            CIDET_OF_K_GPR | CIDET_OF_Z_VAR_WDQ | CIDET_OF_M_REG | CIDET_OF_A_R,
+            0, 0 }, CIDET_IF_MODRM
+    },
+#endif
+};
+/** Number of instruction in the g_aInstructions1 array. */
+const uint32_t g_cCidetInstructions1 = RT_ELEMENTS(g_aCidetInstructions1);
+
diff --git a/src/VBox/ValidationKit/utils/cpu/cidet.h b/src/VBox/ValidationKit/utils/cpu/cidet.h
new file mode 100644
index 0000000..fca491c
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/cidet.h
@@ -0,0 +1,1080 @@
+/* $Id: cidet.h $ */
+/** @file
+ * CPU Instruction Decoding & Execution Tests - C/C++ Header.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+#ifndef ___cidet_h___
+#define ___cidet_h___
+
+#include <iprt/types.h>
+#include <iprt/x86.h>
+
+
+/** @name CIDET - Operand flags.
+ * @{ */
+#define CIDET_OF_FIXED_MASK     UINT32_C(0x0000001f) /**< Fixed register/whatever mask. */
+
+#define CIDET_OF_Z_SHIFT        8                    /**< Size shift. */
+#define CIDET_OF_Z_MASK         UINT32_C(0x00000f00) /**< Size mask. */
+#define CIDET_OF_Z_NONE         UINT32_C(0x00000000) /**< Unused zero value. */
+#define CIDET_OF_Z_BYTE         UINT32_C(0x00000100) /**< Byte size. */
+#define CIDET_OF_Z_WORD         UINT32_C(0x00000200) /**< Word (2 bytes) size. */
+#define CIDET_OF_Z_DWORD        UINT32_C(0x00000300) /**< Double word (4 bytes) size. */
+#define CIDET_OF_Z_QWORD        UINT32_C(0x00000400) /**< Quad word (8 bytes) size. */
+#define CIDET_OF_Z_TBYTE        UINT32_C(0x00000500) /**< Ten byte (10 bytes) size - aka TWORD. */
+#define CIDET_OF_Z_OWORD        UINT32_C(0x00000600) /**< Octa word (16 bytes) size - aka DQWORD. */
+#define CIDET_OF_Z_YWORD        UINT32_C(0x00000700) /**< Yxx sized, i.e. 32 bytes. */
+#define CIDET_OF_Z_ZWORD        UINT32_C(0x00000800) /**< Zxx sized, i.e. 64 bytes. */
+#define CIDET_OF_Z_VAR_WDQ      UINT32_C(0x00000900) /**< Variable size depending on size prefix (2, 4, or 8 bytes). */
+#define CIDET_OF_Z_SPECIAL      UINT32_C(0x00000f00) /**< Special size, see instruction flags or smth. */
+
+#define CIDET_OF_K_MASK         UINT32_C(0x0000f000) /**< Kind of operand. */
+#define CIDET_OF_K_NONE         UINT32_C(0x00000000) /**< Unused zero value. */
+#define CIDET_OF_K_GPR          UINT32_C(0x00001000) /**< General purpose register. Includes memory when used with CIDET_OF_M_RM. */
+#define CIDET_OF_K_SREG         UINT32_C(0x00002000) /**< Segment register. */
+#define CIDET_OF_K_CR           UINT32_C(0x00003000) /**< Control register. */
+#define CIDET_OF_K_SSE          UINT32_C(0x00004000) /**< SSE register. */
+#define CIDET_OF_K_AVX          UINT32_C(0x00005000) /**< AVX register. */
+#define CIDET_OF_K_AVX512       UINT32_C(0x00006000) /**< AVX-512 register. */
+#define CIDET_OF_K_AVXFUTURE    UINT32_C(0x00007000) /**< Reserved for future AVX register set. */
+#define CIDET_OF_K_VRX_TST_MASK UINT32_C(0x0000c000) /**< Used for testing for VRX register kind, see CIDET_OF_K_IS_VRX. */
+#define CIDET_OF_K_VRX_TST_RES  UINT32_C(0x00004000) /**< Used for testing for VRX register kind, see CIDET_OF_K_IS_VRX. */
+#define CIDET_OF_K_FPU          UINT32_C(0x00008000) /**< FPU register. */
+#define CIDET_OF_K_MMX          UINT32_C(0x00009000) /**< MMX register. */
+#define CIDET_OF_K_TEST         UINT32_C(0x0000a000) /**< Test register. */
+#define CIDET_OF_K_IMM          UINT32_C(0x0000d000) /**< Immediate. */
+#define CIDET_OF_K_MEM          UINT32_C(0x0000e000) /**< Memory. */
+#define CIDET_OF_K_SPECIAL      UINT32_C(0x0000f000) /**< Special. */
+/** Check if @a a_fOp is a general purpose register. */
+#define CIDET_OF_K_IS_GPR(a_fOp)    ( ((a_fOp) & CIDET_OF_K_MASK) == CIDET_OF_K_GPR )
+/** Check if @a a_fOp is a XMM (SSE), YMM (AVX), ZMM (AVX-512) or similar register. */
+#define CIDET_OF_K_IS_VRX(a_fOp)    ( ((a_fOp) & CIDET_OF_K_VRX_TST_MASK) == CIDET_OF_K_VRX_TST_RES )
+/** Check if @a a_fOp1 and @a a_fOp2 specify the same kind of register,
+ * treating SSE, AVX, AVX-512 and AVX-future as the same kind and ignoring the
+ * special register kind. */
+#define CIDET_OF_K_IS_SAME(a_fOp1, a_fOp2) \
+    (   ((a_fOp1) & CIDET_OF_K_MASK) == ((a_fOp2) & CIDET_OF_K_MASK) \
+     ?  ((a_fOp1) & CIDET_OF_K_MASK) != CIDET_OF_K_SPECIAL \
+     :  (CIDET_OF_K_IS_VRX(a_fOp1) && CIDET_OF_K_IS_VRX(a_fOp2)) )
+
+#define CIDET_OF_M_RM_ONLY_R    UINT32_C(0x00010000)
+#define CIDET_OF_M_RM_ONLY_M    UINT32_C(0x00020000)
+#define CIDET_OF_M_RM           (CIDET_OF_M_RM_ONLY_R | CIDET_OF_M_RM_ONLY_M)
+#define CIDET_OF_M_REG          UINT32_C(0x00040000)
+
+#define CIDET_OF_A_R            UINT32_C(0x00080000) /**< Read access. */
+#define CIDET_OF_A_W            UINT32_C(0x00100000) /**< Write access. */
+#define CIDET_OF_A_RW           UINT32_C(0x00180000) /**< Read & write access. */
+
+/** The operand defaults to 64-bit width in 64-bit mode, making 32-bit width
+ * inaccessible. */
+#define CIDET_OF_DEFAULT_64BIT  UINT32_C(0x40000000)
+/** Operand always uses the ES segment for memory accesses. */
+#define CIDET_OF_ALWAYS_SEG_ES  UINT32_C(0x80000000)
+/** @} */
+
+
+/** @name CIDET - Instruction flags.
+ * @{ */
+#define CIDET_IF_MODRM          RT_BIT_64(0)    /**< ModR/M encoded. */
+#define CIDET_IF_PRIVILEGED     RT_BIT_64(1)    /**< Privileged. */
+/** @} */
+
+
+/**
+ * Callback function for setting up the input and expected output CPU contexts.
+ *
+ * @returns VBox status.
+ * @retval  VINF_EOF when static test data wraps (first entry is returned).
+ * @retval  VERR_NO_DATA if @a fInvalid is set and there are no invalid operand
+ *          values for this instruction.
+ * @retval  VERR_NOT_SUPPORTED if something in the setup prevents us from
+ *          comming up with working set of inputs and outputs.
+ *
+ * @param   pThis           The core CIDET state structure.  The InCtx
+ *                          and ExpectedCtx members will be modified.
+ * @param   fInvalid        When set, get the next invalid operands that will
+ *                          cause exceptions/faults.
+ */
+typedef int FNCIDETSETUPINOUT(struct CIDETCORE *pThis, bool fInvalid);
+/** Pointer to a FNCIDETSETUPINOUT function. */
+typedef FNCIDETSETUPINOUT *PFNCIDETSETUPINOUT;
+
+
+/**
+ * Instruction test descriptor.
+ */
+typedef struct CIDETINSTR
+{
+    /** The mnemonic (kind of). */
+    const char         *pszMnemonic;
+    /** Setup input and outputs. */
+    PFNCIDETSETUPINOUT  pfnSetupInOut;
+    /** Number of opcode bytes. */
+    uint8_t             cbOpcode;
+    /** Opcode byte(s). */
+    uint8_t             abOpcode[3];
+    /** Mandatory prefix (zero if not applicable). */
+    uint8_t             bMandatoryPrefix;
+    /** Number of operands. */
+    uint8_t             cOperands;
+    /** Operand flags. */
+    uint32_t            afOperands[4];
+    /** Flags. */
+    uint64_t            fFlags;
+} CIDETINSTR;
+/** Pointer to an instruction test descriptor. */
+typedef CIDETINSTR const *PCCIDETINSTR;
+
+
+/**
+ * CPU Context with a few extra bits for expectations and results.
+ */
+typedef struct CIDETCPUCTX
+{
+    uint64_t            rip;
+    uint64_t            rfl;
+    uint64_t            aGRegs[16];
+    uint16_t            aSRegs[6];
+
+#ifndef CIDET_REDUCED_CTX
+    uint16_t            tr;
+    uint16_t            ldtr;
+    uint64_t            cr0;
+#else
+    uint16_t            au16Padding[2];
+#endif
+    uint64_t            cr2;
+#ifndef CIDET_REDUCED_CTX
+    uint64_t            cr3;
+    uint64_t            cr4;
+    uint64_t            cr8;
+    uint64_t            dr0;
+    uint64_t            dr1;
+    uint64_t            dr2;
+    uint64_t            dr3;
+    uint64_t            dr6;
+    uint64_t            dr7;
+#endif
+
+    uint64_t            uErr;           /**< Exception error code.  UINT64_MAX if not applicable.  (Not for input context.) */
+    uint32_t            uXcpt;          /**< Exception number.  UINT32_MAX if no exception.  (Not for input context.) */
+
+    uint32_t            fIgnoredRFlags; /**< Only for expected result. */
+    bool                fTrickyStack;   /**< Set if the stack might be bad.  May come at the cost of accurate flags (32-bit). */
+} CIDETCPUCTX;
+typedef CIDETCPUCTX *PCIDETCPUCTX;
+typedef CIDETCPUCTX const *PCCIDETCPUCTX;
+
+/** Number of bytes of CIDETCPUCTX that can be compared quickly using memcmp.
+ * Anything following these bytes are not relevant to the compare.  */
+#define CIDETCPUCTX_COMPARE_SIZE    RT_UOFFSETOF(CIDETCPUCTX, fIgnoredRFlags)
+
+
+/** @name CPU mode + bits + environment.
+ * @{ */
+#define CIDETMODE_BIT_MASK      UINT8_C(0x0e) /**< The instruction bit count. Results in byte size when masked. */
+#define CIDETMODE_BIT_16        UINT8_C(0x02) /**< 16-bit instructions. */
+#define CIDETMODE_BIT_32        UINT8_C(0x04) /**< 32-bit instructions. */
+#define CIDETMODE_BIT_64        UINT8_C(0x08) /**< 64-bit instructions. */
+#define CIDETMODE_MODE_MASK     UINT8_C(0x70) /**< CPU mode mask. */
+#define CIDETMODE_MODE_RM       UINT8_C(0x00) /**< Real mode. */
+#define CIDETMODE_MODE_PE       UINT8_C(0x10) /**< Protected mode without paging. */
+#define CIDETMODE_MODE_PP       UINT8_C(0x20) /**< Paged protected mode. */
+#define CIDETMODE_MODE_PAE      UINT8_C(0x30) /**< PAE protected mode (paged). */
+#define CIDETMODE_MODE_LM       UINT8_C(0x40) /**< Long mode (paged). */
+#define CIDETMODE_ENV_MASK      UINT8_C(0x81) /**< Execution environment. */
+#define CIDETMODE_ENV_NORMAL    UINT8_C(0x01) /**< Normal environment. */
+#define CIDETMODE_ENV_V86       UINT8_C(0x80) /**< V8086 environment. */
+#define CIDETMODE_RM            (CIDETMODE_MODE_RM  | CIDETMODE_BIT_16 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_PE_16         (CIDETMODE_MODE_PE  | CIDETMODE_BIT_16 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_PE_32         (CIDETMODE_MODE_PE  | CIDETMODE_BIT_32 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_PE_V86        (CIDETMODE_MODE_PE  | CIDETMODE_BIT_16 | CIDETMODE_ENV_V86)
+#define CIDETMODE_PP_16         (CIDETMODE_MODE_PP  | CIDETMODE_BIT_16 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_PP_32         (CIDETMODE_MODE_PP  | CIDETMODE_BIT_32 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_PP_V86        (CIDETMODE_MODE_PP  | CIDETMODE_BIT_16 | CIDETMODE_ENV_V86)
+#define CIDETMODE_PAE_16        (CIDETMODE_MODE_PAE | CIDETMODE_BIT_16 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_PAE_32        (CIDETMODE_MODE_PAE | CIDETMODE_BIT_32 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_PAE_V86       (CIDETMODE_MODE_PAE | CIDETMODE_BIT_16 | CIDETMODE_ENV_V86)
+#define CIDETMODE_LM_16         (CIDETMODE_MODE_LM  | CIDETMODE_BIT_16 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_LM_32         (CIDETMODE_MODE_LM  | CIDETMODE_BIT_32 | CIDETMODE_ENV_NORMAL)
+#define CIDETMODE_LM_64         (CIDETMODE_MODE_LM  | CIDETMODE_BIT_64 | CIDETMODE_ENV_NORMAL)
+/** Test if @a a_bMode is a 16-bit mode. */
+#define CIDETMODE_IS_16BIT(a_bMode) ( ((a_bMode) & CIDETMODE_BIT_MASK) == CIDETMODE_BIT_16 )
+/** Test if @a a_bMode is a 32-bit mode. */
+#define CIDETMODE_IS_32BIT(a_bMode) ( ((a_bMode) & CIDETMODE_BIT_MASK) == CIDETMODE_BIT_32 )
+/** Test if @a a_bMode is a 64-bit mode. */
+#define CIDETMODE_IS_64BIT(a_bMode) ( ((a_bMode) & CIDETMODE_BIT_MASK) == CIDETMODE_BIT_64 )
+/** Get the instruction bit count. */
+#define CIDETMODE_GET_BIT_COUNT(a_bMode) ( CIDETMODE_GET_BYTE_COUNT(a_bMode) * 8 )
+/** Get the instruction byte count. */
+#define CIDETMODE_GET_BYTE_COUNT(a_bMode) ( (a_bMode) & CIDETMODE_BIT_MASK )
+/** Test if @a a_bMode long mode. */
+#define CIDETMODE_IS_LM(a_bMode) ( ((a_bMode) & CIDETMODE_MODE_MASK) == CIDETMODE_MODE_LM )
+/** Test if @a a_bMode some kind of protected mode. */
+#define CIDETMODE_IS_PROT(a_bMode) ( ((a_bMode) & CIDETMODE_MODE_MASK) >= CIDETMODE_MODE_PE )
+
+/** @} */
+
+
+/** @name Test Configuration Flags.
+ * @{ */
+#define CIDET_TESTCFG_SEG_PRF_CS            UINT64_C(0x0000000000000001)
+#define CIDET_TESTCFG_SEG_PRF_SS            UINT64_C(0x0000000000000002)
+#define CIDET_TESTCFG_SEG_PRF_DS            UINT64_C(0x0000000000000004)
+#define CIDET_TESTCFG_SEG_PRF_ES            UINT64_C(0x0000000000000008)
+#define CIDET_TESTCFG_SEG_PRF_FS            UINT64_C(0x0000000000000010)
+#define CIDET_TESTCFG_SEG_PRF_GS            UINT64_C(0x0000000000000020)
+#define CIDET_TESTCFG_SEG_PRF_MASK          UINT64_C(0x000000000000003f)
+/** @} */
+
+/** */
+typedef enum CIDETREG
+{
+    kCidetReg_Gpr_Invalid = 0,
+
+    kCidetReg_Gpr_al,
+    kCidetReg_Gpr_cl,
+    kCidetReg_Gpr_dl,
+    kCidetReg_Gpr_bl,
+    kCidetReg_Gpr_spl,
+    kCidetReg_Gpr_bpl,
+    kCidetReg_Gpr_sil,
+    kCidetReg_Gpr_dil,
+    kCidetReg_Gpr_r8b,
+    kCidetReg_Gpr_r9b,
+    kCidetReg_Gpr_r10b,
+    kCidetReg_Gpr_r11b,
+    kCidetReg_Gpr_r12b,
+    kCidetReg_Gpr_r13b,
+    kCidetReg_Gpr_r14b,
+    kCidetReg_Gpr_r15b,
+    kCidetReg_Gpr_ah,
+    kCidetReg_Gpr_ch,
+    kCidetReg_Gpr_dh,
+    kCidetReg_Gpr_bh,
+#define kCidetReg_Gpr_Byte_First                    kCidetReg_Gpr_al
+#define kCidetReg_Gpr_Byte_First_Upper              kCidetReg_Gpr_ah
+#define kCidetReg_Gpr_Byte_Last                     kCidetReg_Gpr_bh
+
+    kCidetReg_Gpr_ax,
+    kCidetReg_Gpr_cx,
+    kCidetReg_Gpr_dx,
+    kCidetReg_Gpr_bx,
+    kCidetReg_Gpr_sp,
+    kCidetReg_Gpr_bp,
+    kCidetReg_Gpr_si,
+    kCidetReg_Gpr_di,
+    kCidetReg_Gpr_r8w,
+    kCidetReg_Gpr_r9w,
+    kCidetReg_Gpr_r10w,
+    kCidetReg_Gpr_r11w,
+    kCidetReg_Gpr_r12w,
+    kCidetReg_Gpr_r13w,
+    kCidetReg_Gpr_r14w,
+    kCidetReg_Gpr_r15w,
+#define kCidetReg_Gpr_Word_First                    kCidetReg_Gpr_ax
+#define kCidetReg_Gpr_Word_Last                     kCidetReg_Gpr_r15w
+
+    kCidetReg_Gpr_eax,
+    kCidetReg_Gpr_ecx,
+    kCidetReg_Gpr_edx,
+    kCidetReg_Gpr_ebx,
+    kCidetReg_Gpr_esp,
+    kCidetReg_Gpr_ebp,
+    kCidetReg_Gpr_esi,
+    kCidetReg_Gpr_edi,
+    kCidetReg_Gpr_r8d,
+    kCidetReg_Gpr_r9d,
+    kCidetReg_Gpr_r10d,
+    kCidetReg_Gpr_r11d,
+    kCidetReg_Gpr_r12d,
+    kCidetReg_Gpr_r13d,
+    kCidetReg_Gpr_r14d,
+    kCidetReg_Gpr_r15d,
+#define kCidetReg_Gpr_DWord_First                    kCidetReg_Gpr_eax
+#define kCidetReg_Gpr_DWord_Last                     kCidetReg_Gpr_r15d
+
+    kCidetReg_Gpr_rax,
+    kCidetReg_Gpr_rcx,
+    kCidetReg_Gpr_rdx,
+    kCidetReg_Gpr_rbx,
+    kCidetReg_Gpr_rsp,
+    kCidetReg_Gpr_rbp,
+    kCidetReg_Gpr_rsi,
+    kCidetReg_Gpr_rdi,
+    kCidetReg_Gpr_r8,
+    kCidetReg_Gpr_r9,
+    kCidetReg_Gpr_r10,
+    kCidetReg_Gpr_r11,
+    kCidetReg_Gpr_r12,
+    kCidetReg_Gpr_r13,
+    kCidetReg_Gpr_r14,
+    kCidetReg_Gpr_r15,
+#define kCidetReg_Gpr_QWord_First                    kCidetReg_Gpr_rax
+#define kCidetReg_Gpr_QWord_Last                     kCidetReg_Gpr_r15
+
+    kCidetReg_Seg_es,
+    kCidetReg_Seg_cs,
+    kCidetReg_Seg_ss,
+    kCidetReg_Seg_ds,
+    kCidetReg_Seg_fs,
+    kCidetReg_Seg_gs,
+    kCidetReg_Seg_Inv6,
+    kCidetReg_Seg_Inv7,
+#define kCidetReg_Seg_First                         kCidetReg_Seg_es
+#define kCidetReg_Seg_Last                          kCidetReg_Seg_gs
+#define kCidetReg_Seg_Last_Inv                      kCidetReg_Seg_Inv7
+
+    kCidetReg_Misc_ip,
+    kCidetReg_Misc_eip,
+    kCidetReg_Misc_rip,
+    kCidetReg_Misc_flags,
+    kCidetReg_Misc_eflags,
+    kCidetReg_Misc_rflags,
+    kCidetReg_Misc_tr,
+    kCidetReg_Misc_ldtr,
+    kCidetReg_Misc_gdtr,
+    kCidetReg_Misc_idtr,
+
+    kCidetReg_Ctrl_cr0,
+    kCidetReg_Ctrl_cr1,
+    kCidetReg_Ctrl_cr2,
+    kCidetReg_Ctrl_cr3,
+    kCidetReg_Ctrl_cr4,
+    kCidetReg_Ctrl_cr5,
+    kCidetReg_Ctrl_cr6,
+    kCidetReg_Ctrl_cr7,
+    kCidetReg_Ctrl_cr8,
+    kCidetReg_Ctrl_cr9,
+    kCidetReg_Ctrl_cr10,
+    kCidetReg_Ctrl_cr11,
+    kCidetReg_Ctrl_cr12,
+    kCidetReg_Ctrl_cr13,
+    kCidetReg_Ctrl_cr14,
+    kCidetReg_Ctrl_cr15,
+#define kCidetReg_Ctrl_First                        kCidetReg_Ctrl_cr0
+#define kCidetReg_Ctrl_Last                         kCidetReg_Ctrl_cr15
+#define CIDETREG_CTRL_IS_VALID(a_iReg) (   (a_iReg) == kCidetReg_Ctrl_cr0 \
+                                        && (a_iReg) == kCidetReg_Ctrl_cr2 \
+                                        && (a_iReg) == kCidetReg_Ctrl_cr3 \
+                                        && (a_iReg) == kCidetReg_Ctrl_cr4 \
+                                        && (a_iReg) == kCidetReg_Ctrl_cr8 )
+
+    kCidetReg_Dbg_dr0,
+    kCidetReg_Dbg_dr1,
+    kCidetReg_Dbg_dr2,
+    kCidetReg_Dbg_dr3,
+    kCidetReg_Dbg_dr4,
+    kCidetReg_Dbg_dr5,
+    kCidetReg_Dbg_dr6,
+    kCidetReg_Dbg_dr7,
+    kCidetReg_Dbg_dr8,
+    kCidetReg_Dbg_dr9,
+    kCidetReg_Dbg_dr10,
+    kCidetReg_Dbg_dr11,
+    kCidetReg_Dbg_dr12,
+    kCidetReg_Dbg_dr13,
+    kCidetReg_Dbg_dr14,
+    kCidetReg_Dbg_dr15,
+#define kCidetReg_Dbg_First                         kCidetReg_Dbg_dr0
+#define kCidetReg_Dbg_Last                          kCidetReg_Dbg_dr15
+#define CIDETREG_DBG_IS_VALID(a_iReg) ((a_iReg) < kCidetReg_Dbg_dr8 && (a_iReg) >= kCidetReg_Dbg_First)
+
+    kCidetReg_Test_tr0,
+    kCidetReg_Test_tr1,
+    kCidetReg_Test_tr2,
+    kCidetReg_Test_tr3,
+    kCidetReg_Test_tr4,
+    kCidetReg_Test_tr5,
+    kCidetReg_Test_tr6,
+    kCidetReg_Test_tr7,
+    kCidetReg_Test_tr8,
+    kCidetReg_Test_tr9,
+    kCidetReg_Test_tr10,
+    kCidetReg_Test_tr11,
+    kCidetReg_Test_tr12,
+    kCidetReg_Test_tr13,
+    kCidetReg_Test_tr14,
+    kCidetReg_Test_tr15,
+#define kCidetReg_Test_First                        kCidetReg_Test_tr0
+#define kCidetReg_Test_Last                         kCidetReg_Test_tr15
+
+    kCidetReg_Fpu_st0,
+    kCidetReg_Fpu_st1,
+    kCidetReg_Fpu_st2,
+    kCidetReg_Fpu_st3,
+    kCidetReg_Fpu_st4,
+    kCidetReg_Fpu_st5,
+    kCidetReg_Fpu_st6,
+    kCidetReg_Fpu_st7,
+#define kCidetReg_Fpu_First                         kCidetReg_Mmx_st0
+#define kCidetReg_Fpu_Last                          kCidetReg_Mmx_st7
+
+    kCidetReg_FpuMisc_cs,
+    kCidetReg_FpuMisc_ip,
+    kCidetReg_FpuMisc_ds,
+    kCidetReg_FpuMisc_dp,
+    kCidetReg_FpuMisc_fop,
+    kCidetReg_FpuMisc_ftw,
+    kCidetReg_FpuMisc_fsw,
+    kCidetReg_FpuMisc_fcw,
+    kCidetReg_FpuMisc_mxcsr_mask,
+    kCidetReg_FpuMisc_mxcsr,
+
+    kCidetReg_Mmx_mm0,
+    kCidetReg_Mmx_mm1,
+    kCidetReg_Mmx_mm2,
+    kCidetReg_Mmx_mm3,
+    kCidetReg_Mmx_mm4,
+    kCidetReg_Mmx_mm5,
+    kCidetReg_Mmx_mm6,
+    kCidetReg_Mmx_mm7,
+#define kCidetReg_Mmx_First                         kCidetReg_Mmx_mm0
+#define kCidetReg_Mmx_Last                          kCidetReg_Mmx_mm7
+
+    kCidetReg_Sse_xmm0,
+    kCidetReg_Sse_xmm1,
+    kCidetReg_Sse_xmm2,
+    kCidetReg_Sse_xmm3,
+    kCidetReg_Sse_xmm4,
+    kCidetReg_Sse_xmm5,
+    kCidetReg_Sse_xmm6,
+    kCidetReg_Sse_xmm7,
+    kCidetReg_Sse_xmm8,
+    kCidetReg_Sse_xmm9,
+    kCidetReg_Sse_xmm10,
+    kCidetReg_Sse_xmm11,
+    kCidetReg_Sse_xmm12,
+    kCidetReg_Sse_xmm13,
+    kCidetReg_Sse_xmm14,
+    kCidetReg_Sse_xmm15,
+    kCidetReg_Sse_xmm16,
+    kCidetReg_Sse_xmm17,
+    kCidetReg_Sse_xmm18,
+    kCidetReg_Sse_xmm19,
+    kCidetReg_Sse_xmm20,
+    kCidetReg_Sse_xmm21,
+    kCidetReg_Sse_xmm22,
+    kCidetReg_Sse_xmm23,
+    kCidetReg_Sse_xmm24,
+    kCidetReg_Sse_xmm25,
+    kCidetReg_Sse_xmm26,
+    kCidetReg_Sse_xmm27,
+    kCidetReg_Sse_xmm28,
+    kCidetReg_Sse_xmm29,
+    kCidetReg_Sse_xmm30,
+    kCidetReg_Sse_xmm31,
+#define kCidetReg_Sse_First                         kCidetReg_Mmx_Xmm0
+#define kCidetReg_Sse_Last                          kCidetReg_Mmx_Xmm15
+#define kCidetReg_Sse_Last_Avx512                   kCidetReg_Mmx_Xmm31
+
+    kCidetReg_Avx_Ymm0,
+    kCidetReg_Avx_Ymm1,
+    kCidetReg_Avx_Ymm2,
+    kCidetReg_Avx_Ymm3,
+    kCidetReg_Avx_Ymm4,
+    kCidetReg_Avx_Ymm5,
+    kCidetReg_Avx_Ymm6,
+    kCidetReg_Avx_Ymm7,
+    kCidetReg_Avx_Ymm8,
+    kCidetReg_Avx_Ymm9,
+    kCidetReg_Avx_Ymm10,
+    kCidetReg_Avx_Ymm11,
+    kCidetReg_Avx_Ymm12,
+    kCidetReg_Avx_Ymm13,
+    kCidetReg_Avx_Ymm14,
+    kCidetReg_Avx_Ymm15,
+    kCidetReg_Avx_Ymm16,
+    kCidetReg_Avx_Ymm17,
+    kCidetReg_Avx_Ymm18,
+    kCidetReg_Avx_Ymm19,
+    kCidetReg_Avx_Ymm20,
+    kCidetReg_Avx_Ymm21,
+    kCidetReg_Avx_Ymm22,
+    kCidetReg_Avx_Ymm23,
+    kCidetReg_Avx_Ymm24,
+    kCidetReg_Avx_Ymm25,
+    kCidetReg_Avx_Ymm26,
+    kCidetReg_Avx_Ymm27,
+    kCidetReg_Avx_Ymm28,
+    kCidetReg_Avx_Ymm29,
+    kCidetReg_Avx_Ymm30,
+    kCidetReg_Avx_Ymm31,
+#define kCidetReg_Avx_First                         kCidetReg_Avx_Ymm0
+#define kCidetReg_Avx_Last                          kCidetReg_Avx_Ymm15
+#define kCidetReg_Avx_Last_Avx512                   kCidetReg_Avx_Ymm31
+
+    kCidetReg_Avx512_Zmm0,
+    kCidetReg_Avx512_Zmm1,
+    kCidetReg_Avx512_Zmm2,
+    kCidetReg_Avx512_Zmm3,
+    kCidetReg_Avx512_Zmm4,
+    kCidetReg_Avx512_Zmm5,
+    kCidetReg_Avx512_Zmm6,
+    kCidetReg_Avx512_Zmm7,
+    kCidetReg_Avx512_Zmm8,
+    kCidetReg_Avx512_Zmm9,
+    kCidetReg_Avx512_Zmm10,
+    kCidetReg_Avx512_Zmm11,
+    kCidetReg_Avx512_Zmm12,
+    kCidetReg_Avx512_Zmm13,
+    kCidetReg_Avx512_Zmm14,
+    kCidetReg_Avx512_Zmm15,
+    kCidetReg_Avx512_Zmm16,
+    kCidetReg_Avx512_Zmm17,
+    kCidetReg_Avx512_Zmm18,
+    kCidetReg_Avx512_Zmm19,
+    kCidetReg_Avx512_Zmm20,
+    kCidetReg_Avx512_Zmm21,
+    kCidetReg_Avx512_Zmm22,
+    kCidetReg_Avx512_Zmm23,
+    kCidetReg_Avx512_Zmm24,
+    kCidetReg_Avx512_Zmm25,
+    kCidetReg_Avx512_Zmm26,
+    kCidetReg_Avx512_Zmm27,
+    kCidetReg_Avx512_Zmm28,
+    kCidetReg_Avx512_Zmm29,
+    kCidetReg_Avx512_Zmm30,
+    kCidetReg_Avx512_Zmm31,
+#define kCidetReg_Avx512_First                      kCidetReg_Avx512_Zmm0
+#define kCidetReg_Avx512_Last                       kCidetReg_Avx512_Zmm31
+
+    kCidetReg_End
+} CIDETREG;
+
+
+/** @name CIDETBUF_XXX - buffer flags.
+ * @{ */
+#define CIDETBUF_PROT_MASK          UINT32_C(0x0000000f) /**< Page protection mask. */
+#define CIDETBUF_PROT_RWX           UINT32_C(0x00000001) /**< Read + write + execute. */
+#define CIDETBUF_PROT_RWNX          UINT32_C(0x00000002) /**< Read + write + no execute. */
+#define CIDETBUF_PROT_RX            UINT32_C(0x00000003) /**< Read + execute. */
+#define CIDETBUF_PROT_RNX           UINT32_C(0x00000004) /**< Read + no execute. */
+#define CIDETBUF_PROT_RWX_1NP       UINT32_C(0x00000005) /**< Read + write + execute; 1 page not present. */
+#define CIDETBUF_PROT_RWX_1RWNX     UINT32_C(0x00000006) /**< Read + write + execute; 1 page read + write + no execute. */
+#define CIDETBUF_PROT_RWX_1RNX      UINT32_C(0x00000007) /**< Read + write + execute; 1 page read + no execute. */
+#define CIDETBUF_PROT_RWX_1RWXS     UINT32_C(0x00000008) /**< Read + write + execute; 1 page read + execute + supervisor. */
+
+#define CIDETBUF_LOC_MASK           UINT32_C(0x000000f0) /**< Location mask. */
+/** Buffer located at top and start of the 32-bit address space. */
+#define CIDETBUF_LOC_32BIT_WRAP     UINT32_C(0x00000010)
+/** Buffer located at the low canonical boundrary (AMD64).   */
+#define CIDETBUF_LOC_CANON_LO       UINT32_C(0x00000020)
+/** Buffer located at the high canonical boundrary (AMD64).   */
+#define CIDETBUF_LOC_CANON_HI       UINT32_C(0x00000030)
+
+/** Segment protection mask. */
+#define CIDETBUF_SEG_MASK           UINT32_C(0x00000f00)
+#define CIDETBUF_SEG_EO             UINT32_C(0x00000100) /**< Execute only */
+#define CIDETBUF_SEG_ER             UINT32_C(0x00000200) /**< Execute + read */
+#define CIDETBUF_SEG_EO_CONF        UINT32_C(0x00000300) /**< Execute only + conforming. */
+#define CIDETBUF_SEG_ER_CONF        UINT32_C(0x00000400) /**< Execute + read + conforming. */
+#define CIDETBUF_SEG_RO             UINT32_C(0x00000500) /**< Read only. */
+#define CIDETBUF_SEG_RW             UINT32_C(0x00000600) /**< Read + write. */
+#define CIDETBUF_SEG_RO_DOWN        UINT32_C(0x00000700) /**< Read only + expand down. */
+#define CIDETBUF_SEG_RW_DOWN        UINT32_C(0x00000800) /**< Read + write + expand down. */
+
+#define CIDETBUF_DPL_MASK           UINT32_C(0x00003000) /**< DPL mask. */
+#define CIDETBUF_DPL_0              UINT32_C(0x00000000) /**< DPL=0. */
+#define CIDETBUF_DPL_1              UINT32_C(0x00001000) /**< DPL=1. */
+#define CIDETBUF_DPL_2              UINT32_C(0x00002000) /**< DPL=2. */
+#define CIDETBUF_DPL_3              UINT32_C(0x00003000) /**< DPL=3. */
+#define CIDETBUF_DPL_SAME           UINT32_C(0x00004000) /**< Same DPL as the execution environment. */
+
+#define CIDETBUF_SEG_LIMIT_BASE_CAP UINT32_C(0x00008000) /**< Capability to change segment limit and base. */
+
+#define CIDETBUF_KIND_DATA          UINT32_C(0x00000000) /**< Data buffer. */
+#define CIDETBUF_KIND_CODE          UINT32_C(0x80000000) /**< Code buffer. */
+/** Checks if @a a_fFlags describes a code buffer. */
+#define CIDETBUF_IS_CODE(a_fFlags)  (((a_fFlags) & CIDETBUF_KIND_CODE) != 0)
+/** Checks if @a a_fFlags describes a data buffer. */
+#define CIDETBUF_IS_DATA(a_fFlags)  (((a_fFlags) & CIDETBUF_KIND_CODE) == 0)
+/** @} */
+
+/** Code buffer size.  (At least two pages.) */
+#define CIDET_CODE_BUF_SIZE         (PAGE_SIZE * 2)
+/** Data buffer size.  (At least two pages.) */
+#define CIDET_DATA_BUF_SIZE         (PAGE_SIZE * 3)
+
+
+/**
+ * Detailed expected exception.
+ *
+ * This is used to internally in the core to calculate the expected exception
+ * considering all the things that may cause exceptions.
+ */
+typedef enum CIDETEXPECTXCPT
+{
+    kCidetExpectXcpt_Invalid = 0,
+    /** No exception expected.   */
+    kCidetExpectXcpt_None,
+
+    /** Page not present. */
+    kCidetExpectXcpt_PageNotPresent,
+    /** Write access to a non-writable page. */
+    kCidetExpectXcpt_PageNotWritable,
+    /** Executable access to a non-executable page. */
+    kCidetExpectXcpt_PageNotExecutable,
+    /** Access to supervisor page from user mode code. */
+    kCidetExpectXcpt_PagePrivileged,
+#define kCidetExpectXcpt_First_PageFault                kCidetExpectXcpt_PageNotPresent
+#define kCidetExpectXcpt_Last_PageFault                 kCidetExpectXcpt_PagePrivileged
+
+    /** Read or write access to an execute only segment. */
+    kCidetExpectXcpt_SegExecuteOnly,
+    /** Write to a read only or execute+read segment. */
+    kCidetExpectXcpt_SegNotWritable,
+    /** Exceeded the limit of a non-stack access. */
+    kCidetExpectXcpt_SegExceededLimit,
+    /** Non-canonical address via any segment other than the stack. */
+    kCidetExpectXcpt_AddrNotCanonical,
+    /** Misaligned 16 or 32 byte SSE or AVX operand. */
+    kCidetExpectXcpt_MisalignedSseAvx,
+    /** Privileged instruction. */
+    kCidetExpectXcpt_PrivilegedInstruction,
+#define kCidetExpectXcpt_First_GeneralProtectionFault   kCidetExpectXcpt_SegExecuteOnly
+#define kCidetExpectXcpt_Last_GeneralProtectionFault    kCidetExpectXcpt_PrivilegedInstruction
+
+    /** Exceeded the limit of a stack access. */
+    kCidetExpectXcpt_StackExceededLimit,
+    /** Non-canonical stack address. */
+    kCidetExpectXcpt_StackAddrNotCanonical,
+#define kCidetExpectXcpt_First_StackFault               kCidetExpectXcpt_StackExceededLimit
+#define kCidetExpectXcpt_Last_StackFault                kCidetExpectXcpt_StackAddrNotCanonical
+
+    /** Misaligned memory operand (and alignment checking is in effect) if AC is
+     * enabled (executing in ring-3). */
+    kCidetExpectXcpt_MisalignedIfAcEnabled,
+    /** Misaligned 16 byte memory operand resulting in \#AC if ring-3 and
+     *  enable, otherwise \#GP(0). */
+    kCidetExpectXcpt_Misaligned16ByteAcEnabledOrGp,
+#define kCidetExpectXcpt_First_AlignmentCheckFault      kCidetExpectXcpt_MisalignedIfAcEnabled
+#define kCidetExpectXcpt_Last_AlignmentCheckFault       kCidetExpectXcpt_Misaligned16ByteAcEnabledOrGp
+
+    kCidetExpectXcpt_End
+} CIDETEXPECTXCPT;
+
+
+/**
+ * Buffer configuration.
+ */
+typedef struct CIDETBUFCFG
+{
+    /** The name of this buffer configuration. */
+    const char *pszName;
+    /** The buffer flags (CIDETBUF_XXX) */
+    uint32_t    fFlags;
+} CIDETBUFCFG;
+/** Pointer to a constant buffer configuration. */
+typedef CIDETBUFCFG const *PCCIDETBUFCFG;
+
+
+/**
+ * CIDET buffer for code or data.
+ *
+ * ASSUMES page aligned buffers.
+ */
+typedef struct CIDETBUF
+{
+    /** @name Owned & modified by the front end.
+     * @{ */
+    /** Effective buffer address. */
+    uint64_t        uEffBufAddr;
+    /** The segment base address. */
+    uint64_t        uSegBase;
+    /** The active segment limit (see also cbSegLimit). UINT64_MAX if flat. */
+    uint64_t        cbActiveSegLimit;
+    /** This specifies the selector to use if a non-flat segment limit or special
+     * segment flags was requested via pfnSetupBuf.  UINT32_MAX if any segment is
+     * selector works. */
+    uint32_t        uSeg;
+    /** The off value at the last pfnReinitBuf call.  */
+    uint16_t        offActive;
+    /** The cb value at the last pfnReinitBuf call.  */
+    uint16_t        cbActive;
+    /** Prologue (or front fence) size. */
+    uint16_t        cbPrologue;
+    /** Epilogue (or tail fence) size. */
+    uint16_t        cbEpilogue;
+    /** @} */
+
+    /** @name Set by the core before pfnReinitBuf call.
+     * @{ */
+    /** Pointer to the buffer config. */
+    PCCIDETBUFCFG   pCfg;
+    /** The configuration index. */
+    uint32_t        idxCfg;
+    /** The offset into the buffer of the data / code. */
+    uint16_t        off;
+    /** The number of bytes of data / code. */
+    uint16_t        cb;
+    /** The segment limit relative to the start of the buffer (last byte included
+     *  in count). UINT16_MAX if maximum segment size should be used. */
+    uint16_t        cbSegLimit;
+    /** Desired segment base offset.
+     * This is for checking where the alignment checks are performed. */
+    uint8_t         offSegBase;
+
+    /** Set if this buffer is actively being used. */
+    bool            fActive : 1;
+    /** The operand index (if data), 7 if not active. */
+    uint8_t         idxOp : 3;
+    /** Code: Set if the expected exception is supposed to occur on the
+     * following insturction, not the instruction unter test. */
+    bool            fXcptAfterInstruction : 1;
+    /** Set if the instruction will read from the buffer. */
+    bool            fRead : 1;
+    /** Set if the instruction will write to the buffer. */
+    bool            fWrite : 1;
+    /** The expected exception. */
+    CIDETEXPECTXCPT enmExpectXcpt;
+    /** @} */
+} CIDETBUF;
+/** Pointer to a CIDET buffer for code or data. */
+typedef CIDETBUF *PCIDETBUF;
+
+
+/**
+ * CPU Instruction Decoding & Execution Testing (CIDET) state.
+ */
+typedef struct CIDETCORE
+{
+    /** Magic number (CIDETCORE_MAGIC).  */
+    uint32_t            u32Magic;
+
+    /** The target CPU mode / environment. */
+    uint8_t             bMode;
+    /** The target ring. */
+    uint8_t             iRing;
+    /** Unused padding bytes.  */
+    uint8_t             abPadding1[2];
+
+    /** Test configuration. */
+    uint64_t            fTestCfg;
+
+    /** Code buffer configurations to test.
+     * The first buffer must be a normal buffer that does not cause any problems. */
+    PCCIDETBUFCFG       paCodeBufConfigs;
+    /** The number of code buffer configurations to test (pafCodeBufConfigs). */
+    uint32_t            cCodeBufConfigs;
+    /** The number of data buffer configurations to test (pafDataBufConfigs). */
+    uint32_t            cDataBufConfigs;
+    /** Data buffer configurations to test.
+     * The first buffer must be a normal buffer that does not cause any problems. */
+    PCCIDETBUFCFG       paDataBufConfigs;
+
+    /** The instruction currently under testing. */
+    PCCIDETINSTR        pCurInstr;
+
+    /** Primary data buffer. */
+    CIDETBUF            DataBuf;
+    /** Secondary data buffer. */
+    CIDETBUF            DataBuf2;
+
+    /** Handle to the random number source. */
+    RTRAND              hRand;
+
+    /**
+     * Re-initializes one of the data buffers.
+     *
+     * @returns true on succes, false if the request cannot be satisfied.
+     * @param   pThis           The core state.
+     * @param   pBuf            Pointer to the buffer structure.
+     */
+    DECLCALLBACKMEMBER(bool, pfnReInitDataBuf)(struct CIDETCORE *pThis, PCIDETBUF pBuf);
+
+    /**
+     * Copies bytes into the data buffer and sets it up for execution.
+     *
+     * @returns true on succes, false if the request cannot be satisfied.
+     * @param   pThis           The core state.
+     * @param   pBuf            Pointer to the buffer structure.
+     * @param   pvSrc           The source bytes (size and destination offset
+     *                          given in pfnReinitBuf call).
+     */
+    DECLCALLBACKMEMBER(bool, pfnSetupDataBuf)(struct CIDETCORE *pThis, PCIDETBUF pBuf, void const *pvSrc);
+
+    /**
+     * Compares buffer content after test execution.
+     *
+     * This also checks any fill bytes in the buffer that the front end may
+     * have put up.  The front end will double buffer the content of supposedly
+     * inaccessible pages as well as non-existing pages to simplify things for
+     * the core code.
+     *
+     * @returns true if equal, false if not.
+     * @param   pThis           The core state.
+     * @param   pBuf            Pointer to the buffer structure.
+     * @param   pvExpected      Pointer to the expected source bytes (size and
+     *                          buffer offset given in pfnReinitBuf call).
+     */
+    DECLCALLBACKMEMBER(bool, pfnIsBufEqual)(struct CIDETCORE *pThis, struct CIDETBUF *pBuf, void const *pvExpected);
+
+    /**
+     * Re-initializes the code buffer.
+     *
+     * @returns true on succes, false if the request cannot be satisfied.
+     * @param   pThis           The core state.
+     * @param   pBuf            Pointer to the CodeBuf member.  The off and cb
+     *                          members represent what the core wants to
+     *                          execute.
+     */
+    DECLCALLBACKMEMBER(bool, pfnReInitCodeBuf)(struct CIDETCORE *pThis, PCIDETBUF pBuf);
+
+    /**
+     * Emit code into the code buffer, making everything ready for pfnExecute.
+     *
+     * @returns VBox status code.
+     * @param   pThis           Pointer to the core structure.
+     * @param   pBuf            Pointer to the CodeBuf member.
+     * @param   pvInstr         Pointer to the encoded instruction bytes.
+     */
+    DECLCALLBACKMEMBER(bool, pfnSetupCodeBuf)(struct CIDETCORE *pThis, PCIDETBUF pBuf, void const *pvInstr);
+
+    /**
+     * Executes the code indicated by InCtx, returning the result in ActualCtx.
+     *
+     * @returns true if execute, false if skipped.
+     * @param   pThis           Pointer to the core structure.
+     */
+    DECLCALLBACKMEMBER(bool, pfnExecute)(struct CIDETCORE *pThis);
+
+    /**
+     * Report a test failure.
+     *
+     * @param   pThis           Pointer to the core structure.
+     * @param   pszFormat       Format string containing failure details.
+     * @param   va              Arguments referenced in @a pszFormat.
+     */
+    DECLCALLBACKMEMBER(void, pfnFailure)(struct CIDETCORE *pThis, const char *pszFormat, va_list va);
+
+    /** Array of indexes for use by FNCIDETSETUPINOUT.
+     * Reset when changing instruction or switching between valid and invalid
+     * inputs. */
+    uint32_t            aiInOut[4];
+
+    /** @name Copyied and extracted instruction information.
+     * @{ */
+    /** The flags (CIDET_OF_XXX) for the MODRM.REG operand, 0 if not applicable. */
+    uint32_t            fMrmRegOp;
+    /** The flags (CIDET_OF_XXX) for the MODRM.RM operand, 0 if not applicable. */
+    uint32_t            fMrmRmOp;
+    /** Instruction flags (CIDETINSTR::fFlags). */
+    uint64_t            fInstrFlags;
+    /** Number of operands (CIDETINSTR::cOperands). */
+    uint8_t             cOperands;
+    /** Number of memory operands (set by CidetCoreSetupFirstMemoryOperandConfig). */
+    uint8_t             cMemoryOperands : 3;
+    /** Set if we're working on a MOD R/M byte. */
+    bool                fUsesModRm : 1;
+    /** The index of the MODRM.REG operand, 7 if not applicable. */
+    uint8_t             idxMrmRegOp : 3;
+    /** The index of the MODRM.RM operand, 7 if not applicable. */
+    uint8_t             idxMrmRmOp : 3;
+    /** Set if the SIB byte uses VEX registers for indexing. */
+    bool                fUsesVexIndexRegs : 1;
+    /** @}  */
+
+    /** @name Basic encoding knobs, wheels and indicators.
+     * @{ */
+    /** Set if we're working on a SIB byte. */
+    bool                fSib : 1;
+    /** Required segment prefix (X86_SREG_XXX), X86_SREG_COUNT if not. */
+    uint8_t             uSegPrf : 3;
+    /** The address size prefix. */
+    bool                fAddrSizePrf : 1;
+    /** The operand size prefix. */
+    bool                fOpSizePrf : 1;
+    /** The REX.W prefix value. */
+    bool                fRexW : 1;
+    /** The REX.R prefix value. */
+    bool                fRexR : 1;
+    /** The REX.X prefix value. */
+    bool                fRexX : 1;
+    /** The REX.B prefix value. */
+    bool                fRexB : 1;
+    /** Set if a REX prefix is required with or without flags (for byte regs). */
+    bool                fRex : 1;
+    /** Use VEX encoding. */
+    bool                fVex : 1;
+    /** Use EVEX encoding. */
+    bool                fEvex : 1;
+    /** Indicator: Effective addressing mode in bytes (2, 4, 8). */
+    uint8_t             cbAddrMode : 4;
+    /** Indicator: Set if there is an operand accessing memory. */
+    bool                fHasMemoryOperand : 1;
+    /** Indicator: Set if a register is used in two or more operands, and one of
+     * them being for addressing. */
+    bool                fHasRegCollisionMem : 1;
+    /** Indicator: Helper indicator for tracking SIB.BASE collision. */
+    bool                fHasRegCollisionMemBase : 1;
+    /** Indicator: Helper indicator for tracking SIB.INDEX collision. */
+    bool                fHasRegCollisionMemIndex : 1;
+    /** Indicator: Set if a register is used directly in more than one operand. */
+    bool                fHasRegCollisionDirect : 1;
+
+    /** Indicator: Set if MODRM.REG is the stack register. */
+    bool                fHasStackRegInMrmReg : 1;
+    /** Indicator: Set if MODRM.RM or SIB.BASE is the stack register. */
+    bool                fHasStackRegInMrmRmBase: 1;
+
+    /** Indicator: High byte-register specified by MODRM.REG. */
+    bool                fHasHighByteRegInMrmReg : 1;
+    /** Indicator: High byte-register specified by MODRM.RM. */
+    bool                fHasHighByteRegInMrmRm : 1;
+    /** Indicator: Set if REX prefixes are incompatible with the byte-register
+     * specified by MODRM.REG. */
+    bool                fNoRexPrefixMrmReg : 1;
+    /** Indicator: Set if REX prefixes are incompatible with the byte-register
+     * specified by MODRM.RM. */
+    bool                fNoRexPrefixMrmRm : 1;
+    /** Indicator: fNoRexPrefixMrmReg || fNoRexPrefixMrmMr. */
+    bool                fNoRexPrefix : 1;
+    /** The MOD R/M byte we're working on (if fUsesModRm is set). */
+    uint8_t             bModRm;
+    /** The SIB/VSIB byte we're working on (if fSib is set). */
+    uint8_t             bSib;
+    /** @} */
+
+    /** The effective instruction address.  (See InCtx.rip and InCtx.cs for the
+     * rest of the instruction addressing stuff.) */
+    uint64_t            uInstrEffAddr;
+
+    /** Operand information, mainly for the FNCIDETSETUPINOUT and similar. */
+    struct
+    {
+        /** The operand flags copied from (CIDETINSTR::afOperands).   */
+        uint32_t        fFlags;
+        /** The encoded register number, if register, UINT8_MAX if not.  */
+        uint8_t         iReg;
+        /** The actual operand size (encoded). */
+        uint8_t         cb;
+        /** Set if immediate value. */
+        bool            fIsImmediate : 1;
+        /** Set if memory access. */
+        bool            fIsMem : 1;
+        /** Set if addressing is relative to RIP. */
+        bool            fIsRipRelative : 1;
+        /** Set if it's a high byte register. */
+        bool            fIsHighByteRegister : 1;
+        /** Size of the disposition, 0 if none. */
+        uint8_t         cbMemDisp;
+        /** Base register, UINT8_MAX if not applicable. */
+        uint8_t         iMemBaseReg;
+        /** Index register, UINT8_MAX if not applicable. */
+        uint8_t         iMemIndexReg;
+        /** Index register, 1 if not applicable. */
+        uint8_t         uMemScale;
+        /** Effective segment register, UINT8_MAX if not memory access. */
+        uint8_t         iEffSeg;
+        /** Segment offset if memory access.  Undefined if not memory access. */
+        uint64_t        offSeg;
+        /** The effective address if memory access. */
+        uint64_t        uEffAddr;
+        /** Immediate or displacement value. */
+        uint64_t        uImmDispValue;
+        /** Base register value, undefined if irrelevant. */
+        uint64_t        uMemBaseRegValue;
+        /** Index register value, undefined if irrelevant. */
+        uint64_t        uMemIndexRegValue;
+        /** Points to where the input data for this operand should be placed,
+         * when possible.  In the fIsMem = true case, it either points directly
+         * to the input buffer or to a temporary one.  While in the other case,
+         * it'll point into InCtx when possible. */
+        RTPTRUNION      In;
+        /** Points to where the expected output data for this operand should be
+         * stored, when possible.  In the fIsMem = false case, it'll point into
+         * ExpectedCtx when possible. */
+        RTPTRUNION      Expected;
+        /** Pointer to the data buffer for this operand. */
+        PCIDETBUF       pDataBuf;
+    }                   aOperands[4];
+
+    /** Buffer where we assemble the instruction. */
+    uint8_t             abInstr[45];
+    /** The size of the instruction in abInstr. */
+    uint8_t             cbInstr;
+    /** Offset of the instruction into the buffer. */
+    uint16_t            offInstr;
+    /** Current code buffer. */
+    CIDETBUF            CodeBuf;
+
+    /** The input context.  Initalized by driver and FNCIDETSETUPINOUT. */
+    CIDETCPUCTX         InCtx;
+    /** The expected output context. */
+    CIDETCPUCTX         ExpectedCtx;
+    /** The actual output context. */
+    CIDETCPUCTX         ActualCtx;
+    /** Template input context, initialized when setting the mode. */
+    CIDETCPUCTX         InTemplateCtx;
+
+    /** Input and expected output temporary memory buffers. */
+    uint8_t             abBuf[0x2000];
+
+
+    /** Number of skipped tests because of pfnSetupInOut failures. */
+    uint32_t            cSkippedSetupInOut;
+    /** Number of skipped tests because of pfnReInitDataBuf failures. */
+    uint32_t            cSkippedReInitDataBuf;
+    /** Number of skipped tests because of pfnSetupDataBuf failures. */
+    uint32_t            cSkippedSetupDataBuf;
+    /** Number of skipped tests because RIP relative addressing constraints. */
+    uint32_t            cSkippedDataBufWrtRip;
+    /** Number of skipped tests because of assemble failures. */
+    uint32_t            cSkippedAssemble;
+    /** Number of skipped tests because of pfnReInitCodeBuf failures. */
+    uint32_t            cSkippedReInitCodeBuf;
+    /** Number of skipped tests because of pfnSetupCodeBuf failures. */
+    uint32_t            cSkippedSetupCodeBuf;
+    /** Number of skipped tests because the base and index registers are the same
+     * one and there was a remainder when trying to point to the data buffer. */
+    uint32_t            cSkippedSameBaseIndexRemainder;
+    /** Number of skipped tests because index-only addressing left a remainder. */
+    uint32_t            cSkippedOnlyIndexRemainder;
+    /** Number of skipped tests because of direct addressing overflowed. */
+    uint32_t            cSkippedDirectAddressingOverflow;
+
+
+} CIDETCORE;
+/** Pointer to the CIDET core state. */
+typedef CIDETCORE *PCIDETCORE;
+
+/** Magic number for CIDETCORE (Lee Konitz). */
+#define CIDETCORE_MAGIC     UINT32_C(0x19271013)
+
+
+int     CidetCoreInit(PCIDETCORE pThis, RTRAND hRand);
+void    CidetCoreDelete(PCIDETCORE pThis);
+int     CidetCoreSetTargetMode(PCIDETCORE pThis, uint8_t bMode);
+uint32_t CidetCoreGetOperandSize(PCIDETCORE pThis, uint8_t iOp);
+bool    CidetCoreTestInstruction(PCIDETCORE pThis, PCCIDETINSTR pInstr);
+
+
+extern const CIDETINSTR g_aCidetInstructions1[];
+extern const uint32_t   g_cCidetInstructions1;
+
+#endif
+
diff --git a/src/VBox/ValidationKit/utils/cpu/cidet.mac b/src/VBox/ValidationKit/utils/cpu/cidet.mac
new file mode 100644
index 0000000..8b3da4f
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/cidet.mac
@@ -0,0 +1,65 @@
+; $Id: cidet.mac $ ;
+;; @file
+; CPU Instruction Decoding & Execution Tests - Assembly Header.
+;
+
+;
+; Copyright (C) 2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%ifndef ___cidet_mac___
+%define ___cidet_mac___
+
+struc CIDETCPUCTX
+    .rip                resq 1
+    .rfl                resq 1
+    .aGRegs             resq 16
+    .aSRegs             resw 6
+
+%ifndef CIDET_REDUCED_CTX
+    .tr                 resw 1
+    .ldtr               resw 1
+    .cr0                resq 1
+%else
+    .au16Padding        resw 2
+%endif
+    .cr2                resq 1
+%ifndef CIDET_REDUCED_CTX
+    .cr3                resq 1
+    .cr4                resq 1
+    .cr8                resq 1
+    .dr0                resq 1
+    .dr1                resq 1
+    .dr2                resq 1
+    .dr3                resq 1
+    .dr6                resq 1
+    .dr7                resq 1
+%endif
+
+    .uErr               resq 1
+    .uXcpt              resd 1
+
+    .fIgnoredRFlags     resd 1
+    .fTrickyStack       resb 1
+endstruc
+
+%endif
+
diff --git a/src/VBox/ValidationKit/utils/cpu/cpu-alloc-all-mem.cpp b/src/VBox/ValidationKit/utils/cpu/cpu-alloc-all-mem.cpp
new file mode 100644
index 0000000..16d9ab1
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/cpu-alloc-all-mem.cpp
@@ -0,0 +1,213 @@
+/* $Id: cpu-alloc-all-mem.cpp $ */
+/** @file
+ * Allocate all memory we can get and then quit.
+ */
+
+/*
+ * Copyright (C) 2011-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/test.h>
+
+#include <iprt/asm.h>
+#include <iprt/list.h>
+#include <iprt/mem.h>
+#include <iprt/param.h>
+#include <iprt/string.h>
+#include <iprt/time.h>
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef struct TSTALLOC
+{
+    /** The page sequence number. */
+    size_t      iPageSeq;
+    /** The allocation sequence number. */
+    size_t      iAllocSeq;
+    /** The allocation size. */
+    size_t      cb;
+    /** Pointer to the ourselves (paranoid). */
+    void       *pv;
+    /** Linked list node. */
+    RTLISTNODE  Node;
+
+} TSTALLOC;
+typedef TSTALLOC *PTSTALLOC;
+
+
+static bool checkList(PRTLISTNODE pHead)
+{
+    size_t iPageSeq  = 0;
+    size_t iAllocSeq = 0;
+    PTSTALLOC pCur;
+    RTListForEach(pHead, pCur, TSTALLOC, Node)
+    {
+        RTTESTI_CHECK_RET(pCur->iAllocSeq == iAllocSeq, false);
+        RTTESTI_CHECK_RET(pCur->pv == pCur, false);
+
+        size_t const *pu    = (size_t const *)pCur;
+        size_t const *puEnd = pu + pCur->cb / sizeof(size_t);
+        while (pu != puEnd)
+        {
+            RTTESTI_CHECK_RET(*pu == iPageSeq, false);
+            iPageSeq++;
+            pu += PAGE_SIZE / sizeof(size_t);
+        }
+        iAllocSeq++;
+    }
+    return true;
+}
+
+
+static void doTest(RTTEST hTest)
+{
+    RTTestSub(hTest, "Allocate all memory");
+
+    RTLISTANCHOR AllocHead;
+    PTSTALLOC    pCur;
+    uint64_t     cNsElapsed  = 0;
+    size_t       cbPrint     = 0;
+    uint64_t     uPrintTS    = 0;
+    size_t       cbTotal     = 0;
+#if ARCH_BITS == 64
+    size_t const cbOneStart  = 64 * _1M;
+    size_t const cbOneMin    = 4  * _1M;
+#else
+    size_t const cbOneStart  = 16 * _1M;
+    size_t const cbOneMin    = 4  * _1M;
+#endif
+    size_t       cbOne       = cbOneStart;
+    size_t       cAllocs     = 0;
+    uint32_t     iPageSeq    = 0;
+    RTListInit(&AllocHead);
+
+    for (;;)
+    {
+        /*
+         * Allocate a chunk and make sure all the pages are there.
+         */
+        uint64_t const uStartTS = RTTimeNanoTS();
+        pCur = (PTSTALLOC)RTMemPageAlloc(cbOne);
+        if (pCur)
+        {
+            size_t *pu    = (size_t *)pCur;
+            size_t *puEnd = pu + cbOne / sizeof(size_t);
+            while (pu != puEnd)
+            {
+                *pu = iPageSeq++;
+                pu += PAGE_SIZE / sizeof(size_t);
+            }
+            uint64_t const uEndTS  = RTTimeNanoTS();
+            uint64_t const cNsThis = uEndTS  - uStartTS;
+
+            /*
+             * Update the statistics.
+             */
+            cNsElapsed += cNsThis;
+            cbTotal    += cbOne;
+            cAllocs++;
+
+            /*
+             * Link the allocation.
+             */
+            pCur->iAllocSeq = cAllocs - 1;
+            pCur->pv        = pCur;
+            pCur->cb        = cbOne;
+            RTListAppend(&AllocHead, &pCur->Node);
+
+            /*
+             * Print progress info?
+             */
+            if (   uEndTS  - uPrintTS >= RT_NS_1SEC_64*10
+#if ARCH_BITS == 64
+                || cbTotal - cbPrint  >= _4G
+#else
+                || cbTotal - cbPrint  >= _2G
+#endif
+               )
+            {
+                cbPrint  = cbTotal;
+                uPrintTS = uEndTS;
+
+                uint32_t cMBPerSec = (uint32_t)(cbTotal / ((double)cNsElapsed / RT_NS_1SEC) / _1M);
+                RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "%'zu bytes in %'llu ns - %'u MB/s\n",
+                             cbTotal, cNsElapsed, cMBPerSec);
+                RTTESTI_CHECK_RETV(checkList(&AllocHead));
+            }
+        }
+        else
+        {
+            /*
+             * Try again with a smaller request.
+             */
+            RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Failed to allocate %'zu bytes (after %'zu bytes)\n", cbOne, cbTotal);
+            if (cbOne <= cbOneMin)
+                break;
+            cbOne = cbOneMin;
+        }
+    }
+
+    RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "Verifying...\n");
+    RTTESTI_CHECK_RETV(checkList(&AllocHead));
+    RTTestPrintf(hTest, RTTESTLVL_ALWAYS, "... detected no corruption.\n");
+
+    /*
+     * Free up some memory before displaying the results.
+     */
+    size_t      i = 0;
+    PTSTALLOC   pPrev;
+    RTListForEachReverseSafe(&AllocHead, pCur, pPrev, TSTALLOC, Node)
+    {
+        RTMemPageFree(pCur->pv, pCur->cb);
+        if (++i > 32)
+            break;
+    }
+
+    RTTestValue(hTest, "amount", cbTotal, RTTESTUNIT_BYTES);
+    RTTestValue(hTest, "time",   cNsElapsed, RTTESTUNIT_NS);
+    uint32_t cMBPerSec = (uint32_t)(cbTotal / ((double)cNsElapsed / RT_NS_1SEC) / _1M);
+    RTTestValue(hTest, "speed",  cMBPerSec, RTTESTUNIT_MEGABYTES_PER_SEC);
+    RTTestSubDone(hTest);
+}
+
+
+int main(int argc, char **argv)
+{
+    RTTEST hTest;
+    RTEXITCODE rcExit = RTTestInitAndCreate("memallocall", &hTest);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+    RTTestBanner(hTest);
+
+    NOREF(argv);
+    if (argc == 1)
+        doTest(hTest);
+    else
+        RTTestFailed(hTest, "This test takes no arguments!");
+
+    return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/ValidationKit/utils/cpu/cpu-numa.cpp b/src/VBox/ValidationKit/utils/cpu/cpu-numa.cpp
new file mode 100644
index 0000000..e4831a2
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/cpu-numa.cpp
@@ -0,0 +1,195 @@
+/* $Id: cpu-numa.cpp $ */
+/** @file
+ * numa - NUMA / memory benchmark.
+ */
+
+/*
+ * Copyright (C) 2011-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/test.h>
+
+#include <iprt/asm.h>
+//#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
+//# include <iprt/asm-amd64-x86.h>
+//#endif
+#include <iprt/mem.h>
+#include <iprt/mp.h>
+#include <iprt/string.h>
+#include <iprt/thread.h>
+#include <iprt/time.h>
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** The number of threads to skip when testing. */
+static uint32_t g_cThreadsToSkip = 1;
+
+/**
+ * Gets the next online CPU.
+ *
+ * @returns Next CPU index or RTCPUSET_MAX_CPUS.
+ * @param   iCurCpu             The current CPU (index).
+ */
+static int getNextCpu(unsigned iCurCpu)
+{
+    /* Skip to the next chip. */
+    iCurCpu = (iCurCpu / g_cThreadsToSkip) * g_cThreadsToSkip;
+    iCurCpu += g_cThreadsToSkip;
+
+    /* Skip offline cpus. */
+    while (   iCurCpu < RTCPUSET_MAX_CPUS
+           && !RTMpIsCpuOnline(iCurCpu) )
+        iCurCpu++;
+
+    /* Make sure we're within bounds (in case of bad input). */
+    if (iCurCpu > RTCPUSET_MAX_CPUS)
+        iCurCpu = RTCPUSET_MAX_CPUS;
+    return iCurCpu;
+}
+
+
+static void doTest(RTTEST hTest)
+{
+    NOREF(hTest);
+    uint32_t iAllocCpu = 0;
+    while (iAllocCpu < RTCPUSET_MAX_CPUS)
+    {
+        const uint32_t cbTestSet   = _1M * 32;
+        const uint32_t cIterations = 384;
+
+        /*
+         * Change CPU and allocate a chunk of memory.
+         */
+        RTTESTI_CHECK_RC_OK_RETV(RTThreadSetAffinityToCpu(RTMpCpuIdFromSetIndex(iAllocCpu)));
+
+        void *pvTest = RTMemPageAlloc(cbTestSet); /* may be leaked, who cares */
+        RTTESTI_CHECK_RETV(pvTest != NULL);
+        memset(pvTest, 0xef, cbTestSet);
+
+        /*
+         * Do the tests.
+         */
+        uint32_t iAccessCpu = 0;
+        while (iAccessCpu < RTCPUSET_MAX_CPUS)
+        {
+            RTTESTI_CHECK_RC_OK_RETV(RTThreadSetAffinityToCpu(RTMpCpuIdFromSetIndex(iAccessCpu)));
+
+            /*
+             * The write test.
+             */
+            RTTimeNanoTS(); RTThreadYield();
+            uint64_t u64StartTS = RTTimeNanoTS();
+            for (uint32_t i = 0; i < cIterations; i++)
+            {
+                ASMCompilerBarrier(); /* paranoia */
+                memset(pvTest, i, cbTestSet);
+            }
+            uint64_t const cNsElapsedWrite = RTTimeNanoTS() - u64StartTS;
+            uint64_t cMBPerSec = (uint64_t)(  ((uint64_t)cIterations * cbTestSet) /* bytes */
+                                            / ((long double)cNsElapsedWrite / RT_NS_1SEC_64) /* seconds */
+                                            / _1M /* MB */ );
+            RTTestIValueF(cMBPerSec, RTTESTUNIT_MEGABYTES_PER_SEC, "cpu%02u-mem%02u-write", iAllocCpu, iAccessCpu);
+
+            /*
+             * The read test.
+             */
+            memset(pvTest, 0, cbTestSet);
+            RTTimeNanoTS(); RTThreadYield();
+            u64StartTS = RTTimeNanoTS();
+            for (uint32_t i = 0; i < cIterations; i++)
+            {
+#if 1
+                size_t register u = 0;
+                size_t volatile *puCur = (size_t volatile *)pvTest;
+                size_t volatile *puEnd = puCur + cbTestSet / sizeof(size_t);
+                while (puCur != puEnd)
+                    u += *puCur++;
+#else
+                ASMCompilerBarrier(); /* paranoia */
+                void *pvFound = memchr(pvTest, (i & 127) + 1, cbTestSet);
+                RTTESTI_CHECK(pvFound == NULL);
+#endif
+            }
+            uint64_t const cNsElapsedRead = RTTimeNanoTS() - u64StartTS;
+            cMBPerSec = (uint64_t)(  ((uint64_t)cIterations * cbTestSet) /* bytes */
+                                   / ((long double)cNsElapsedRead / RT_NS_1SEC_64) /* seconds */
+                                   / _1M /* MB */ );
+            RTTestIValueF(cMBPerSec, RTTESTUNIT_MEGABYTES_PER_SEC, "cpu%02u-mem%02u-read", iAllocCpu, iAccessCpu);
+
+            /*
+             * The read/write test.
+             */
+            RTTimeNanoTS(); RTThreadYield();
+            u64StartTS = RTTimeNanoTS();
+            for (uint32_t i = 0; i < cIterations; i++)
+            {
+                ASMCompilerBarrier(); /* paranoia */
+                memcpy(pvTest, (uint8_t *)pvTest + cbTestSet / 2, cbTestSet / 2);
+            }
+            uint64_t const cNsElapsedRW = RTTimeNanoTS() - u64StartTS;
+            cMBPerSec = (uint64_t)(  ((uint64_t)cIterations * cbTestSet) /* bytes */
+                                   / ((long double)cNsElapsedRW / RT_NS_1SEC_64) /* seconds */
+                                   / _1M /* MB */ );
+            RTTestIValueF(cMBPerSec, RTTESTUNIT_MEGABYTES_PER_SEC, "cpu%02u-mem%02u-read-write", iAllocCpu, iAccessCpu);
+
+            /*
+             * Total time.
+             */
+            RTTestIValueF(cNsElapsedRead + cNsElapsedWrite + cNsElapsedRW, RTTESTUNIT_NS,
+                          "cpu%02u-mem%02u-time", iAllocCpu, iAccessCpu);
+
+            /* advance */
+            iAccessCpu = getNextCpu(iAccessCpu);
+        }
+
+        /*
+         * Clean up and advance to the next CPU.
+         */
+        RTMemPageFree(pvTest, cbTestSet);
+        iAllocCpu = getNextCpu(iAllocCpu);
+    }
+}
+
+
+int main(int argc, char **argv)
+{
+    RTTEST hTest;
+    RTEXITCODE rcExit = RTTestInitAndCreate("numa-1", &hTest);
+    if (rcExit != RTEXITCODE_SUCCESS)
+        return rcExit;
+    RTTestBanner(hTest);
+
+#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
+    /** @todo figure basic topology. */
+#endif
+    if (argc == 2)
+        g_cThreadsToSkip = RTStrToUInt8(argv[1]);
+
+    doTest(hTest);
+
+    return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/ValidationKit/utils/cpu/exceptionsR3-asm.asm b/src/VBox/ValidationKit/utils/cpu/exceptionsR3-asm.asm
new file mode 100644
index 0000000..162c39f
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/exceptionsR3-asm.asm
@@ -0,0 +1,150 @@
+; $Id: exceptionsR3-asm.asm $
+;; @file
+; exceptionsR3-asm.asm - assembly helpers.
+;
+
+;
+; Copyright (C) 2009-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+;*******************************************************************************
+;*      Header Files                                                           *
+;*******************************************************************************
+%include "iprt/asmdefs.mac"
+
+
+;*******************************************************************************
+;*      Defined Constants And Macros                                           *
+;*******************************************************************************
+%ifdef RT_ARCH_AMD64
+ %define TST_XCPT_MAGIC  0123456789abcdef0h
+%else
+ %define TST_XCPT_MAGIC  012345678h
+%endif
+
+%macro tstXcptAsmProlog 0
+        push    xBP
+        push    xDI
+        push    xSI
+        push    xBX
+ %ifdef RT_ARCH_X86
+        push    gs
+        push    fs
+        push    es
+        push    ds
+ %endif
+ %ifdef RT_ARCH_AMD64
+        push    r10
+        push    r11
+        push    r12
+        push    r13
+        push    r14
+        push    r15
+ %endif
+
+        mov     xAX, TST_XCPT_MAGIC
+        mov     xBX, xAX
+        mov     xCX, xAX
+        mov     xDX, xAX
+        mov     xDI, xAX
+        mov     xSI, xAX
+        mov     xBP, xAX
+ %ifdef RT_ARCH_AMD64
+        mov     r8,  xAX
+        mov     r9,  xAX
+        mov     r10, xAX
+        mov     r11, xAX
+        mov     r12, xAX
+        mov     r13, xAX
+        mov     r14, xAX
+        mov     r15, xAX
+ %endif
+%endmacro
+
+%macro tstXcptAsmEpilog 0
+ %ifdef RT_ARCH_AMD64
+        pop     r15
+        pop     r14
+        pop     r13
+        pop     r12
+        pop     r11
+        pop     r10
+ %endif
+ %ifdef RT_ARCH_X86
+        pop     ds
+        pop     es
+        pop     fs
+        pop     gs
+ %endif
+        pop     xBX
+        pop     xSI
+        pop     xDI
+        pop     xBP
+%endmacro
+
+
+BEGINCODE
+
+;;
+BEGINPROC tstXcptAsmNullPtrRead
+;        tstXcptAsmProlog
+        xor     eax, eax
+GLOBALNAME tstXcptAsmNullPtrRead_PC
+        mov     al, [xAX]
+;        tstXcptAsmEpilog
+        ret
+ENDPROC   tstXcptAsmNullPtrRead
+
+
+;;
+BEGINPROC tstXcptAsmNullPtrWrite
+        tstXcptAsmProlog
+        xor     eax, eax
+GLOBALNAME tstXcptAsmNullPtrWrite_PC
+        mov     [xAX], al
+        tstXcptAsmEpilog
+        ret
+ENDPROC   tstXcptAsmNullPtrWrite
+
+
+;;
+BEGINPROC tstXcptAsmSysCall
+        tstXcptAsmProlog
+GLOBALNAME tstXcptAsmSysCall_PC
+        syscall
+        tstXcptAsmEpilog
+        ret
+ENDPROC   tstXcptAsmSysCall
+
+
+;;
+BEGINPROC tstXcptAsmSysEnter
+        tstXcptAsmProlog
+GLOBALNAME tstXcptAsmSysEnter_PC
+%ifdef RT_ARCH_AMD64
+        db 00fh, 034h                   ; test this on 64-bit, yasm complains...
+%else
+        sysenter
+%endif
+        tstXcptAsmEpilog
+        ret
+ENDPROC   tstXcptAsmSysEnter
+
diff --git a/src/VBox/ValidationKit/utils/cpu/exceptionsR3.cpp b/src/VBox/ValidationKit/utils/cpu/exceptionsR3.cpp
new file mode 100644
index 0000000..327f861
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/exceptionsR3.cpp
@@ -0,0 +1,262 @@
+/* $Id: exceptionsR3.cpp $ */
+/** @file
+ * exceptionsR3 - Tests various ring-3 CPU exceptions.
+ */
+
+/*
+ * Copyright (C) 2009-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/cdefs.h>
+#include <iprt/ctype.h>
+#include <iprt/getopt.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+#include <iprt/x86.h>
+
+#include <setjmp.h>
+
+#ifndef RT_OS_WINDOWS
+# define USE_SIGNALS
+# include <signal.h>
+# include <stdlib.h>
+#endif
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** Executes a simple test. */
+#define TST_XCPT(Trapper, iTrap, uErr) \
+    do \
+    { \
+        RTTestISub(#Trapper); \
+        tstXcptReset(); \
+        if (!setjmp(g_JmpBuf)) \
+        { \
+            tstXcptAsm##Trapper(); \
+            RTTestIFailed("%s didn't trap (line no %u)", #Trapper, __LINE__); \
+        } \
+        else if (   (iTrap) != tstXcptCurTrap()  \
+                 || (uErr) != tstXcptCurErr()  ) \
+            RTTestIFailed("%s trapped with %#x/%#x, expected %#x/%#x (line no %u)", \
+                          #Trapper, tstXcptCurTrap(), tstXcptCurErr(), (iTrap), (uErr), __LINE__); \
+        else \
+            RTTestISubDone(); \
+    } while (0)
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** Where to longjmp to when getting a signal/exception. */
+jmp_buf             g_JmpBuf;
+#ifdef USE_SIGNALS
+/** Pending signal.
+ * -1 if no signal is pending. */
+int32_t volatile    g_iSignal;
+/** Pending signal info. */
+siginfo_t volatile  g_SigInfo;
+#endif
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+DECLASM(void) tstXcptAsmNullPtrRead(void);
+DECLASM(void) tstXcptAsmNullPtrWrite(void);
+DECLASM(void) tstXcptAsmSysEnter(void);
+DECLASM(void) tstXcptAsmSysCall(void);
+
+
+
+#ifdef USE_SIGNALS
+/**
+ * Generic signal handler.
+ */
+static void tstXcptSigHandler(int iSignal, siginfo_t *pSigInfo, void *pvCtx)
+{
+#if 1
+    RTStrmPrintf(g_pStdErr, "signal %d pSigInfo=%p pvCtx=%p", iSignal, pSigInfo, pvCtx);
+    if (pSigInfo)
+        RTStrmPrintf(g_pStdErr, " si_addr=%p si_code=%#x sival_ptr=%p sival_int=%d",
+                     pSigInfo->si_addr, pSigInfo->si_code, pSigInfo->si_value.sival_ptr, pSigInfo->si_value.sival_int);
+    RTStrmPrintf(g_pStdErr, "\n");
+#endif
+    if (g_iSignal == -1)
+    {
+        g_iSignal = iSignal;
+        if (pSigInfo)
+            memcpy((void *)&g_SigInfo, pSigInfo, sizeof(g_SigInfo));
+        longjmp(g_JmpBuf, 1);
+    }
+    else
+    {
+        /* we're up the infamous creek... */
+        _Exit(2);
+    }
+}
+
+#elif defined(RT_OS_WINDOWS)
+/** @todo  */
+//# error "PORTME"
+
+#else
+# error "PORTME"
+#endif
+
+
+/** Reset the current exception state and get ready for a new trap. */
+static void tstXcptReset(void)
+{
+#ifdef USE_SIGNALS
+    g_iSignal = -1;
+    memset((void *)&g_SigInfo, 0, sizeof(g_SigInfo));
+#endif
+}
+
+
+
+/** Get the current intel trap number. Returns -1 if none.  */
+static int tstXcptCurTrap(void)
+{
+#ifdef USE_SIGNALS
+    /** @todo this is just a quick sketch. */
+    switch (g_iSignal)
+    {
+        case SIGBUS:
+# ifdef RT_OS_DARWIN
+            if (g_SigInfo.si_code == 2 /*KERN_PROTECTION_FAILURE*/)
+                return X86_XCPT_PF;
+# endif
+            return X86_XCPT_GP;
+
+        case SIGSEGV:
+            return X86_XCPT_GP;
+    }
+#endif
+    return -1;
+}
+
+
+/** Get the exception error code if applicable. */
+static uint32_t tstXcptCurErr(void)
+{
+#ifdef USE_SIGNALS
+    /** @todo this is just a quick sketch. */
+    switch (g_iSignal)
+    {
+        case SIGBUS:
+# ifdef RT_OS_DARWIN
+            if (g_SigInfo.si_code == 2 /*KERN_PROTECTION_FAILURE*/)
+                return 0;
+# endif
+            break;
+
+        case SIGSEGV:
+            break;
+    }
+#endif
+    return UINT32_MAX;
+}
+
+
+int main(int argc, char **argv)
+{
+    /*
+     * Prolog.
+     */
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("exceptionsR3", &hTest);
+    if (rc)
+        return rc;
+
+    /*
+     * Parse options.
+     */
+    bool volatile fRawMode = false;
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--raw-mode",    'r', RTGETOPT_REQ_NOTHING },
+    };
+
+    RTGETOPTUNION ValUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0);
+    while ((rc = RTGetOpt(&GetState, &ValUnion)))
+    {
+        switch (rc)
+        {
+            case 'r':
+                fRawMode = true;
+                break;
+
+            default:
+                return RTGetOptPrintError(rc, &ValUnion);
+        }
+    }
+
+    /*
+     * Test setup.
+     */
+#ifdef USE_SIGNALS
+    struct sigaction Act;
+    RT_ZERO(Act);
+    Act.sa_sigaction = tstXcptSigHandler;
+    Act.sa_flags     = SA_SIGINFO;
+    sigfillset(&Act.sa_mask);
+
+    sigaction(SIGILL,  &Act, NULL);
+    sigaction(SIGTRAP, &Act, NULL);
+# ifdef SIGEMT
+    sigaction(SIGEMT,  &Act, NULL);
+# endif
+    sigaction(SIGFPE,  &Act, NULL);
+    sigaction(SIGBUS,  &Act, NULL);
+    sigaction(SIGSEGV, &Act, NULL);
+
+#else
+    /** @todo Implement this using structured exception handling on Windows and
+     *        OS/2. */
+#endif
+
+    /*
+     * The tests.
+     */
+    RTTestBanner(hTest);
+    TST_XCPT(NullPtrRead,     X86_XCPT_PF, 0);
+    TST_XCPT(NullPtrWrite,    X86_XCPT_PF, 0);
+    if (fRawMode)
+    {
+        TST_XCPT(SysEnter,        X86_XCPT_GP, 0);
+        TST_XCPT(SysCall,         X86_XCPT_UD, 0);
+    }
+
+    /*
+     * Epilog.
+     */
+    return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/ValidationKit/utils/cpu/rdtsc.cpp b/src/VBox/ValidationKit/utils/cpu/rdtsc.cpp
new file mode 100644
index 0000000..2e1d305
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/rdtsc.cpp
@@ -0,0 +1,77 @@
+/* $Id: rdtsc.cpp $ */
+/** @file
+ * rdtsc - Test if three consecutive rdtsc instructions return different values.
+ */
+
+/*
+ * Copyright (C) 2009-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+#include <stdio.h>
+
+int main()
+{
+    int i;
+    int cMatches = 0;
+    for (i = 0; i < 10000000; i++)
+    {
+        int cMatchedNow = 0;
+        __asm
+        {
+            rdtsc
+            mov ebx, eax
+            mov ecx, edx
+            rdtsc
+            mov esi, eax
+            mov edi, edx
+            rdtsc
+
+            cmp eax, ebx
+            jnz l_ok1
+            cmp edx, ecx
+            jnz l_ok1
+            inc [cMatchedNow]
+        l_ok1:
+
+            cmp eax, esi
+            jnz l_ok2
+            cmp edx, edi
+            jnz l_ok2
+            inc [cMatchedNow]
+            jmp l_ok3
+        l_ok2:
+
+            cmp ebx, esi
+            jnz l_ok3
+            cmp ecx, edi
+            jnz l_ok3
+            inc [cMatchedNow]
+        l_ok3:
+        }
+        if (cMatchedNow)
+        {
+            printf("%08d: %d\n", i, cMatchedNow);
+            cMatches += cMatchedNow;
+        }
+    }
+    printf("done: %d matches\n", cMatches);
+    return !!cMatches;
+}
diff --git a/src/VBox/ValidationKit/utils/cpu/xmmsaving-asm.asm b/src/VBox/ValidationKit/utils/cpu/xmmsaving-asm.asm
new file mode 100644
index 0000000..840448e
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/xmmsaving-asm.asm
@@ -0,0 +1,153 @@
+; $Id: xmmsaving-asm.asm $
+;; @file
+; xmmsaving - assembly helpers.
+;
+
+;
+; Copyright (C) 2009-2014 Oracle Corporation
+;
+; This file is part of VirtualBox Open Source Edition (OSE), as
+; available from http://www.virtualbox.org. This file is free software;
+; you can redistribute it and/or modify it under the terms of the GNU
+; General Public License (GPL) as published by the Free Software
+; Foundation, in version 2 as it comes in the "COPYING" file of the
+; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;
+; The contents of this file may alternatively be used under the terms
+; of the Common Development and Distribution License Version 1.0
+; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+; VirtualBox OSE distribution, in which case the provisions of the
+; CDDL are applicable instead of those of the GPL.
+;
+; You may elect to license modified versions of this file under the
+; terms and conditions of either the GPL or the CDDL or both.
+;
+
+
+%include "iprt/asmdefs.mac"
+%include "VBox/vmm/stam.mac"
+
+
+BEGINCODE
+
+
+;;
+; DECLASM(int) XmmSavingTestLoadSet(const MYXMMREGSET *pSet, const MYXMMREGSET *pPrevSet, PRTUINT128U pBadVal);
+;
+; @returns 0 on success, 1-based register number on failure.
+; @param    pSet            The new set.
+; @param    pPrevSet        The previous set. Can be NULL.
+; @param    pBadVal         Where to store the actual register value on failure.
+;
+BEGINPROC XmmSavingTestLoadSet
+    push    xBP
+    mov     xBP, xSP
+    sub     xSP, 32                     ; Space for storing an XMM register (in TEST_REG).
+    and     xSP, ~31                    ; Align it.
+
+    ; Unify register/arguments.
+%ifdef ASM_CALL64_GCC
+    mov     r8, rdx                     ; pBadVal
+    mov     xCX, rdi                    ; pSet
+    mov     xDX, rsi                    ; pPrevSet
+%endif
+%ifdef RT_ARCH_X86
+    mov     xCX, [ebp + 8]              ; pSet
+    mov     xDX, [ebp + 12]             ; pPrevSet
+%endif
+
+    test    xDX, xDX
+    jz near .just_load
+
+    ; Check that the old set is still correct.
+%macro TEST_REG 1,
+    movdqa  [xSP], xmm %+ %1
+    mov     xAX, [xDX + %1 * 8]
+    cmp     [xSP], xAX
+    jne     %%bad
+    mov     xAX, [xDX + %1 * 8 + xCB]
+    cmp     [xSP + xCB], xAX
+%ifdef RT_ARCH_X86
+    jne     %%bad
+    mov     xAX, [xDX + %1 * 8 + xCB*2]
+    cmp     [xSP + xCB*2], xAX
+    jne     %%bad
+    mov     xAX, [xDX + %1 * 8 + xCB*3]
+    cmp     [xSP + xCB*3], xAX
+%endif
+    je      %%next
+%%bad:
+    mov     eax, %1 + 1
+    jmp     .return_copy_badval
+%%next:
+%endmacro
+
+    TEST_REG 0
+    TEST_REG 1
+    TEST_REG 2
+    TEST_REG 3
+    TEST_REG 4
+    TEST_REG 5
+    TEST_REG 6
+    TEST_REG 7
+%ifdef RT_ARCH_AMD64
+    TEST_REG 8
+    TEST_REG 9
+    TEST_REG 10
+    TEST_REG 11
+    TEST_REG 12
+    TEST_REG 13
+    TEST_REG 14
+    TEST_REG 15
+%endif
+
+    ; Load the new state.
+.just_load:
+    movdqu  xmm0,  [xCX + 0*8]
+    movdqu  xmm1,  [xCX + 1*8]
+    movdqu  xmm2,  [xCX + 2*8]
+    movdqu  xmm3,  [xCX + 3*8]
+    movdqu  xmm4,  [xCX + 4*8]
+    movdqu  xmm5,  [xCX + 5*8]
+    movdqu  xmm6,  [xCX + 6*8]
+    movdqu  xmm7,  [xCX + 7*8]
+%ifdef RT_ARCH_AMD64
+    movdqu  xmm8,  [xCX + 8*8]
+    movdqu  xmm9,  [xCX + 9*8]
+    movdqu  xmm10, [xCX + 10*8]
+    movdqu  xmm11, [xCX + 11*8]
+    movdqu  xmm12, [xCX + 12*8]
+    movdqu  xmm13, [xCX + 13*8]
+    movdqu  xmm14, [xCX + 14*8]
+    movdqu  xmm15, [xCX + 15*8]
+%endif
+    xor     eax, eax
+    jmp     .return
+
+.return_copy_badval:
+    ; don't touch eax here.
+%ifdef RT_ARCH_X86
+    mov     edx, [ebp + 16]
+    mov     ecx, [esp]
+    mov     [edx     ], ecx
+    mov     ecx, [esp +  4]
+    mov     [edx +  4], ecx
+    mov     ecx, [esp +  8]
+    mov     [edx +  8], ecx
+    mov     ecx, [esp + 12]
+    mov     [edx + 12], ecx
+%else
+    mov     rdx, [rsp]
+    mov     rcx, [rsp + 8]
+    mov     [r8], rdx
+    mov     [r8 + 8], rcx
+%endif
+    jmp     .return
+
+.return:
+    leave
+    ret
+ENDPROC   XmmSavingTestLoadSet
+
+
diff --git a/src/VBox/ValidationKit/utils/cpu/xmmsaving.cpp b/src/VBox/ValidationKit/utils/cpu/xmmsaving.cpp
new file mode 100644
index 0000000..d409138
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/cpu/xmmsaving.cpp
@@ -0,0 +1,120 @@
+/* $Id: xmmsaving.cpp $ */
+/** @file
+ * xmmsaving - Test that all XMM register state is handled correctly and
+ *             not corrupted the VMM.
+ */
+
+/*
+ * Copyright (C) 2009-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/test.h>
+#include <iprt/x86.h>
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef struct MYXMMREGSET
+{
+    RTUINT128U  aRegs[16];
+} MYXMMREGSET;
+
+
+DECLASM(int) XmmSavingTestLoadSet(const MYXMMREGSET *pSet, const MYXMMREGSET *pPrevSet, PRTUINT128U pBadVal);
+
+
+static void XmmSavingTest(void)
+{
+    RTTestISub("xmm saving and restoring");
+
+    /* Create the test sets. */
+    static MYXMMREGSET s_aSets[256];
+    for (unsigned s = 0; s < RT_ELEMENTS(s_aSets); s++)
+    {
+        for (unsigned r = 0; r < RT_ELEMENTS(s_aSets[s].aRegs); r++)
+        {
+            unsigned x = (s << 4) | r;
+            s_aSets[s].aRegs[r].au32[0] =  x        | UINT32_C(0x12345000);
+            s_aSets[s].aRegs[r].au32[1] = (x << 8)  | UINT32_C(0x88700011);
+            s_aSets[s].aRegs[r].au32[2] = (x << 16) | UINT32_C(0xe000dcba);
+            s_aSets[s].aRegs[r].au32[3] = (x << 20) | UINT32_C(0x00087654);
+        }
+    }
+
+    /* Do the actual testing. */
+    const MYXMMREGSET *pPrev2 = NULL;
+    const MYXMMREGSET *pPrev = NULL;
+    for (int i = 0; i < 1000000; i++)
+    {
+        if ((i % 50000) == 0)
+        {
+            RTTestIPrintf(RTTESTLVL_ALWAYS, ".");
+            pPrev = pPrev2 = NULL; /* May be trashed by the above call. */
+        }
+        for (unsigned s = 0; s < RT_ELEMENTS(s_aSets); s++)
+        {
+            RTUINT128U         BadVal;
+            const MYXMMREGSET *pSet = &s_aSets[s];
+            int r = XmmSavingTestLoadSet(pSet, pPrev, &BadVal);
+            if (r-- != 0)
+            {
+                RTTestIFailed("i=%d s=%d r=%d", i, s, r);
+                RTTestIFailureDetails("XMM%-2d  = %08x,%08x,%08x,%08x\n",
+                                      r,
+                                      BadVal.au32[0],
+                                      BadVal.au32[1],
+                                      BadVal.au32[2],
+                                      BadVal.au32[3]);
+                RTTestIFailureDetails("Expected %08x,%08x,%08x,%08x\n",
+                                      pPrev->aRegs[r].au32[0],
+                                      pPrev->aRegs[r].au32[1],
+                                      pPrev->aRegs[r].au32[2],
+                                      pPrev->aRegs[r].au32[3]);
+                if (pPrev2)
+                    RTTestIFailureDetails("PrevPrev %08x,%08x,%08x,%08x\n",
+                                          pPrev2->aRegs[r].au32[0],
+                                          pPrev2->aRegs[r].au32[1],
+                                          pPrev2->aRegs[r].au32[2],
+                                          pPrev2->aRegs[r].au32[3]);
+                return;
+            }
+            pPrev2 = pPrev;
+            pPrev = pSet;
+        }
+    }
+    RTTestISubDone();
+}
+
+
+int main()
+{
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("xmmsaving", &hTest);
+    if (rc)
+        return rc;
+    XmmSavingTest();
+    return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/ValidationKit/utils/misc/Makefile.kmk b/src/VBox/ValidationKit/utils/misc/Makefile.kmk
new file mode 100644
index 0000000..8d53fd6
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/misc/Makefile.kmk
@@ -0,0 +1,48 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Miscellaneous Utilites.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+PROGRAMS += LoadGenerator
+LoadGenerator_TEMPLATE = VBoxValidationKitR3Host
+LoadGenerator_SOURCES  = loadgenerator.cpp
+
+SYSMODS += loadgeneratorR0
+loadgeneratorR0_TEMPLATE = VBoxValidationKitR0
+loadgeneratorR0_SOURCES = loadgeneratorR0.cpp
+
+PROGRAMS += vts_rm
+vts_rm_TEMPLATE = VBoxValidationKitR3
+vts_rm_SOURCES  = vts_rm.cpp
+
+PROGRAMS += vts_tar
+vts_tar_TEMPLATE = VBoxValidationKitR3
+vts_tar_SDKS     = VBOX_ZLIB_STATIC
+vts_tar_SOURCES  = vts_tar.cpp
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/utils/misc/loadgenerator.cpp b/src/VBox/ValidationKit/utils/misc/loadgenerator.cpp
new file mode 100644
index 0000000..75ef84b
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/misc/loadgenerator.cpp
@@ -0,0 +1,380 @@
+/* $Id: loadgenerator.cpp $ */
+/** @file
+ * Load Generator.
+ */
+
+/*
+ * Copyright (C) 2007-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/thread.h>
+#include <iprt/time.h>
+#include <iprt/initterm.h>
+#include <iprt/string.h>
+#include <iprt/stream.h>
+#include <iprt/param.h>
+#include <iprt/path.h>
+#include <iprt/process.h>
+#include <iprt/mp.h>
+#include <iprt/asm.h>
+#include <iprt/getopt.h>
+#include <VBox/sup.h>
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** Whether the threads should quit or not. */
+static bool volatile    g_fQuit = false;
+static const char      *g_pszProgramName = NULL;
+
+
+/*******************************************************************************
+*   Internal Functions                                                         *
+*******************************************************************************/
+static int Error(const char *pszFormat, ...);
+
+
+static void LoadGenSpin(uint64_t cNanoSeconds)
+{
+    const uint64_t u64StartTS = RTTimeNanoTS();
+    do
+    {
+        for (uint32_t volatile i = 0; i < 10240 && !g_fQuit; i++)
+            i++;
+    } while (RTTimeNanoTS() - u64StartTS < cNanoSeconds && !g_fQuit);
+}
+
+
+static DECLCALLBACK(int) LoadGenSpinThreadFunction(RTTHREAD hThreadSelf, void *pvUser)
+{
+    NOREF(hThreadSelf);
+    LoadGenSpin(*(uint64_t *)pvUser);
+    return VINF_SUCCESS;
+}
+
+
+static int LoadGenIpiInit(void)
+{
+    /*
+     * Try make sure the support library is initialized...
+     */
+    SUPR3Init(NULL);
+
+    /*
+     * Load the module.
+     */
+    char szPath[RTPATH_MAX];
+    int rc = RTPathAppPrivateArchTop(szPath, sizeof(szPath) - sizeof("/loadgenerator.r0"));
+    if (RT_SUCCESS(rc))
+    {
+        strcat(szPath, "/loadgeneratorR0.r0");
+        void *pvImageBase;
+        rc = SUPR3LoadServiceModule(szPath, "loadgeneratorR0", "LoadGenR0ServiceReqHandler", &pvImageBase);
+        if (RT_SUCCESS(rc))
+        {
+            /* done */
+        }
+        else
+            Error("SUPR3LoadServiceModule(%s): %Rrc\n", szPath, rc);
+    }
+    else
+        Error("RTPathAppPrivateArch: %Rrc\n", rc);
+    return rc;
+}
+
+
+static void LoadGenIpi(uint64_t cNanoSeconds)
+{
+    const uint64_t u64StartTS = RTTimeNanoTS();
+    do
+    {
+        int rc = SUPR3CallR0Service("loadgeneratorR0", sizeof("loadgeneratorR0") - 1,
+                                    0 /* uOperation */, 1 /* cIpis */, NULL /* pReqHdr */);
+        if (RT_FAILURE(rc))
+        {
+            Error("SUPR3CallR0Service: %Rrc\n", rc);
+            break;
+        }
+    } while (RTTimeNanoTS() - u64StartTS < cNanoSeconds && !g_fQuit);
+}
+
+
+static DECLCALLBACK(int) LoadGenIpiThreadFunction(RTTHREAD hThreadSelf, void *pvUser)
+{
+    LoadGenIpi(*(uint64_t *)pvUser);
+    NOREF(hThreadSelf);
+    return VINF_SUCCESS;
+}
+
+
+static int Error(const char *pszFormat, ...)
+{
+    va_list va;
+    RTStrmPrintf(g_pStdErr, "%s: error: ", g_pszProgramName);
+    va_start(va, pszFormat);
+    RTStrmPrintfV(g_pStdErr, pszFormat, va);
+    va_end(va);
+    return 1;
+}
+
+
+static int SyntaxError(const char *pszFormat, ...)
+{
+    va_list va;
+    RTStrmPrintf(g_pStdErr, "%s: syntax error: ", g_pszProgramName);
+    va_start(va, pszFormat);
+    RTStrmPrintfV(g_pStdErr, pszFormat, va);
+    va_end(va);
+    return 1;
+}
+
+
+int main(int argc, char **argv)
+{
+    static const struct LOADGENTYPE
+    {
+        const char     *pszName;
+        int           (*pfnInit)(void);
+        PFNRTTHREAD     pfnThread;
+    }               s_aLoadTypes[] =
+    {
+        { "spin",   NULL,           LoadGenSpinThreadFunction },
+        { "ipi",    LoadGenIpiInit, LoadGenIpiThreadFunction },
+    };
+    unsigned        iLoadType = 0;
+    static RTTHREAD s_aThreads[256];
+    int             rc;
+    uint32_t        cThreads = 1;
+    bool            fScaleByCpus = false;
+    RTTHREADTYPE    enmThreadType = RTTHREADTYPE_DEFAULT;
+    RTPROCPRIORITY  enmProcPriority = RTPROCPRIORITY_DEFAULT;
+    uint64_t        cNanoSeconds = UINT64_MAX;
+
+    RTR3InitExe(argc, &argv, 0);
+
+    /*
+     * Set program name.
+     */
+    g_pszProgramName = RTPathFilename(argv[0]);
+
+    /*
+     * Parse arguments.
+     */
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--number-of-threads",    'n', RTGETOPT_REQ_UINT32 },
+        { "--timeout",              't', RTGETOPT_REQ_STRING },
+        { "--thread-type",          'p', RTGETOPT_REQ_STRING },
+        { "--scale-by-cpus",        'c', RTGETOPT_REQ_NOTHING },
+        { "--load",                 'l', RTGETOPT_REQ_STRING },
+    };
+    int ch;
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0 /* fFlags */);
+    while ((ch = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (ch)
+        {
+            case 'n':
+                cThreads = ValueUnion.u64;
+                if (cThreads == 0 || cThreads > RT_ELEMENTS(s_aThreads))
+                    return SyntaxError("Requested number of threads, %RU32, is out of range (1..%d).\n",
+                                       cThreads, RT_ELEMENTS(s_aThreads) - 1);
+                break;
+
+            case 't':
+            {
+                char *psz;
+                rc = RTStrToUInt64Ex(ValueUnion.psz, &psz, 0, &cNanoSeconds);
+                if (RT_FAILURE(rc))
+                    return SyntaxError("Failed reading the alleged number '%s' (option '%s', rc=%Rrc).\n",
+                                       ValueUnion.psz, rc);
+                while (*psz == ' ' || *psz == '\t')
+                    psz++;
+                if (*psz)
+                {
+                    uint64_t u64Factor = 1;
+                    if (!strcmp(psz, "ns"))
+                        u64Factor = 1;
+                    else if (!strcmp(psz, "ms"))
+                        u64Factor = 1000;
+                    else if (!strcmp(psz, "s"))
+                        u64Factor = 1000000000;
+                    else if (!strcmp(psz, "m"))
+                        u64Factor = UINT64_C(60000000000);
+                    else if (!strcmp(psz, "h"))
+                        u64Factor = UINT64_C(3600000000000);
+                    else
+                        return SyntaxError("Unknown time suffix '%s'\n", psz);
+                    uint64_t u64 = cNanoSeconds * u64Factor;
+                    if (u64 < cNanoSeconds || (u64 < u64Factor && u64))
+                        return SyntaxError("Time representation overflowed! (%RU64 * %RU64)\n",
+                                           psz, cNanoSeconds, u64Factor);
+                    cNanoSeconds = u64;
+                }
+                break;
+            }
+
+            case 'p':
+            {
+                enmProcPriority = RTPROCPRIORITY_NORMAL;
+
+                uint32_t u32 = RTTHREADTYPE_INVALID;
+                char *psz;
+                rc = RTStrToUInt32Ex(ValueUnion.psz, &psz, 0, &u32);
+                if (RT_FAILURE(rc) || *psz)
+                {
+                    if (!strcmp(ValueUnion.psz, "default"))
+                    {
+                        enmProcPriority = RTPROCPRIORITY_DEFAULT;
+                        enmThreadType = RTTHREADTYPE_DEFAULT;
+                    }
+                    else if (!strcmp(ValueUnion.psz, "idle"))
+                    {
+                        enmProcPriority = RTPROCPRIORITY_LOW;
+                        enmThreadType = RTTHREADTYPE_INFREQUENT_POLLER;
+                    }
+                    else if (!strcmp(ValueUnion.psz, "high"))
+                    {
+                        enmProcPriority = RTPROCPRIORITY_HIGH;
+                        enmThreadType = RTTHREADTYPE_IO;
+                    }
+                    else
+                        return SyntaxError("can't grok thread type '%s'\n",
+                                           ValueUnion.psz);
+                }
+                else
+                {
+                    enmThreadType = (RTTHREADTYPE)u32;
+                    if (enmThreadType <= RTTHREADTYPE_INVALID || enmThreadType >= RTTHREADTYPE_END)
+                        return SyntaxError("thread type '%d' is out of range (%d..%d)\n",
+                                           ValueUnion.psz, RTTHREADTYPE_INVALID + 1, RTTHREADTYPE_END - 1);
+                }
+                break;
+            }
+
+            case 'c':
+                fScaleByCpus = true;
+                break;
+
+            case 'l':
+            {
+                for (unsigned i = 0; i < RT_ELEMENTS(s_aLoadTypes); i++)
+                    if (!strcmp(s_aLoadTypes[i].pszName, ValueUnion.psz))
+                    {
+                        ValueUnion.psz = NULL;
+                        iLoadType = i;
+                        break;
+                    }
+                if (ValueUnion.psz)
+                    return SyntaxError("Unknown load type '%s'.\n", ValueUnion.psz);
+                break;
+            }
+
+            case 'h':
+                RTStrmPrintf(g_pStdOut,
+                             "Usage: %s [-p|--thread-type <type>] [-t|--timeout <sec|xxx[h|m|s|ms|ns]>] \\\n"
+                             "       %*s [-n|--number-of-threads <threads>] [-l|--load <loadtype>]\n"
+                             "\n"
+                             "Load types: spin, ipi.\n"
+                             ,
+                             g_pszProgramName, strlen(g_pszProgramName), "");
+                return 1;
+
+            case 'V':
+                RTPrintf("$Revision: 96152 $\n");
+                return 0;
+
+            case VINF_GETOPT_NOT_OPTION:
+                return SyntaxError("Unknown argument #%d: '%s'\n", GetState.iNext-1, ValueUnion.psz);
+
+            default:
+                return RTGetOptPrintError(ch, &ValueUnion);
+        }
+    }
+
+    /*
+     * Scale thread count by host cpu count.
+     */
+    if (fScaleByCpus)
+    {
+        const unsigned cCpus = RTMpGetOnlineCount();
+        if (cCpus * cThreads > RT_ELEMENTS(s_aThreads))
+            return SyntaxError("Requested number of threads, %RU32, is out of range (1..%d) when scaled by %d.\n",
+                               cThreads, RT_ELEMENTS(s_aThreads) - 1, cCpus);
+        cThreads *= cCpus;
+    }
+
+    /*
+     * Modify process and thread priority? (ignore failure)
+     */
+    if (enmProcPriority != RTPROCPRIORITY_DEFAULT)
+        RTProcSetPriority(enmProcPriority);
+    if (enmThreadType != RTTHREADTYPE_DEFAULT)
+        RTThreadSetType(RTThreadSelf(), enmThreadType);
+
+    /*
+     * Load type specific init.
+     */
+    if (s_aLoadTypes[iLoadType].pfnInit)
+    {
+        rc = s_aLoadTypes[iLoadType].pfnInit();
+        if (RT_FAILURE(rc))
+            return 1;
+    }
+
+
+    /*
+     * Start threads.
+     */
+    for (unsigned i = 1; i < cThreads; i++)
+    {
+        s_aThreads[i] = NIL_RTTHREAD;
+        rc = RTThreadCreate(&s_aThreads[i], s_aLoadTypes[iLoadType].pfnThread,
+                            &cNanoSeconds, 128*1024, enmThreadType, RTTHREADFLAGS_WAITABLE, "spinner");
+        if (RT_FAILURE(rc))
+        {
+            ASMAtomicXchgBool(&g_fQuit, true);
+            RTStrmPrintf(g_pStdErr, "%s: failed to create thread #%d, rc=%Rrc\n", g_pszProgramName, i, rc);
+            while (i-- > 1)
+                RTThreadWait(s_aThreads[i], 1500, NULL);
+            return 1;
+        }
+    }
+
+    /* our selves */
+    s_aLoadTypes[iLoadType].pfnThread(RTThreadSelf(), &cNanoSeconds);
+
+    /*
+     * Wait for threads.
+     */
+    ASMAtomicXchgBool(&g_fQuit, true);
+    for (unsigned i = 1; i < cThreads; i++)
+        RTThreadWait(s_aThreads[i], 1500, NULL);
+
+    return 0;
+}
+
diff --git a/src/VBox/ValidationKit/utils/misc/loadgeneratorR0.cpp b/src/VBox/ValidationKit/utils/misc/loadgeneratorR0.cpp
new file mode 100644
index 0000000..2a98ca6
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/misc/loadgeneratorR0.cpp
@@ -0,0 +1,91 @@
+/* $Id: loadgeneratorR0.cpp $ */
+/** @file
+ * Load Generator, Ring-0 Service.
+ */
+
+/*
+ * Copyright (C) 2008-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/mp.h>
+#include <VBox/sup.h>
+#include <VBox/err.h>
+
+
+
+
+/**
+ * Worker for loadgenR0Ipi.
+ */
+static DECLCALLBACK(void) loadgenR0IpiWorker(RTCPUID idCpu, void *pvUser1, void *pvUser2)
+{
+    NOREF(idCpu);
+    NOREF(pvUser1);
+    NOREF(pvUser2);
+}
+
+
+/**
+ * Generate broadcast inter processor interrupts (IPI), aka cross calls.
+ *
+ * @returns VBox status code.
+ * @param   cIpis       The number of IPIs to do.
+ */
+static int loadgenR0Ipi(uint64_t cIpis)
+{
+    if (cIpis > _1G || !cIpis)
+        return VERR_INVALID_PARAMETER;
+
+    while (cIpis-- > 0)
+    {
+        int rc = RTMpOnAll(loadgenR0IpiWorker, NULL, NULL);
+        if (RT_FAILURE(rc))
+            return rc;
+    }
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * Service request handler entry point.
+ *
+ * @copydoc SUPR0SERVICEREQHANDLER
+ */
+extern "C" DECLEXPORT(int) LoadGenR0ServiceReqHandler(PSUPDRVSESSION pSession, uint32_t uOperation,
+                                                      uint64_t u64Arg, PSUPR0SERVICEREQHDR pReqHdr)
+
+{
+    switch (uOperation)
+    {
+        case 0:
+            if (pReqHdr)
+                return VERR_INVALID_PARAMETER;
+            return loadgenR0Ipi(u64Arg);
+
+        default:
+            NOREF(pSession);
+            return VERR_NOT_SUPPORTED;
+    }
+}
+
diff --git a/src/VBox/ValidationKit/utils/misc/vts_rm.cpp b/src/VBox/ValidationKit/utils/misc/vts_rm.cpp
new file mode 100644
index 0000000..999cbd9
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/misc/vts_rm.cpp
@@ -0,0 +1,44 @@
+/* $Id: vts_rm.cpp $ */
+/** @file
+ * VirtualBox Validation Kit - rm like utility.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/path.h>
+#include <iprt/err.h>
+#include <iprt/initterm.h>
+#include <iprt/message.h>
+
+
+int main(int argc, char **argv)
+{
+    int rc = RTR3InitExe(argc, &argv, 0);
+    if (RT_FAILURE(rc))
+        return RTMsgInitFailure(rc);
+    return RTPathRmCmd(argc, argv);
+}
+
diff --git a/src/VBox/ValidationKit/utils/misc/vts_tar.cpp b/src/VBox/ValidationKit/utils/misc/vts_tar.cpp
new file mode 100644
index 0000000..658c78b
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/misc/vts_tar.cpp
@@ -0,0 +1,44 @@
+/* $Id: vts_tar.cpp $ */
+/** @file
+ * VirtualBox Validation Kit - tar like utility.
+ */
+
+/*
+ * Copyright (C) 2013 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/zip.h>
+#include <iprt/err.h>
+#include <iprt/initterm.h>
+#include <iprt/message.h>
+
+
+int main(int argc, char **argv)
+{
+    int rc = RTR3InitExe(argc, &argv, 0);
+    if (RT_FAILURE(rc))
+        return RTMsgInitFailure(rc);
+    return RTZipTarCmd(argc, argv);
+}
+
diff --git a/src/VBox/ValidationKit/utils/network/Makefile.kmk b/src/VBox/ValidationKit/utils/network/Makefile.kmk
new file mode 100644
index 0000000..42a58d7
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/network/Makefile.kmk
@@ -0,0 +1,39 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Network tests.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# Network Performance Benchmark.
+#
+PROGRAMS += NetPerf
+NetPerf_TEMPLATE = VBoxValidationKitR3
+NetPerf_SOURCES  = NetPerf.cpp
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/utils/network/NetPerf.cpp b/src/VBox/ValidationKit/utils/network/NetPerf.cpp
new file mode 100644
index 0000000..1c92b90
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/network/NetPerf.cpp
@@ -0,0 +1,1922 @@
+/* $Id: NetPerf.cpp $ */
+/** @file
+ * NetPerf - Network Performance Benchmark.
+ */
+
+/*
+ * Copyright (C) 2010-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/asm.h>
+#include <iprt/assert.h>
+#include <iprt/ctype.h>
+#include <iprt/err.h>
+#include <iprt/getopt.h>
+#include <iprt/initterm.h>
+#include <iprt/mem.h>
+#include <iprt/message.h>
+#include <iprt/path.h>
+#include <iprt/param.h>
+#include <iprt/process.h>
+#include <iprt/rand.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/tcp.h>
+#include <iprt/thread.h>
+#include <iprt/test.h>
+#include <iprt/time.h>
+#include <iprt/timer.h>
+
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+/** Default TCP port (update help text if you change this) */
+#define NETPERF_DEFAULT_PORT                    5002
+
+/** Default TCP packet size (bytes) */
+#define NETPERF_DEFAULT_PKT_SIZE_THROUGHPUT     8192
+/** Default TCP packet size (bytes) */
+#define NETPERF_DEFAULT_PKT_SIZE_LATENCY        1024
+/** Maximum packet size possible (bytes). */
+#define NETPERF_MAX_PKT_SIZE                    _1M
+/** Minimum packet size possible (bytes). */
+#define NETPERF_MIN_PKT_SIZE                    sizeof(NETPERFHDR)
+
+/** Default timeout in (seconds) */
+#define NETPERF_DEFAULT_TIMEOUT                 10
+/** Maximum timeout possible (seconds). */
+#define NETPERF_MAX_TIMEOUT                     3600 /* 1h */
+/** Minimum timeout possible (seconds). */
+#define NETPERF_MIN_TIMEOUT                     1
+
+/** The default warmup time (ms). */
+#define NETPERF_DEFAULT_WARMUP                  1000  /*  1s */
+/** The maxium warmup time (ms). */
+#define NETPERF_MAX_WARMUP                      60000 /* 60s */
+/** The minimum warmup time (ms). */
+#define NETPERF_MIN_WARMUP                      1000  /*  1s */
+
+/** The default cool down time (ms). */
+#define NETPERF_DEFAULT_COOL_DOWN               1000  /*  1s */
+/** The maxium cool down time (ms). */
+#define NETPERF_MAX_COOL_DOWN                   60000 /* 60s */
+/** The minimum cool down time (ms). */
+#define NETPERF_MIN_COOL_DOWN                   1000  /*  1s */
+
+/** The length of the length prefix used when submitting parameters and
+ * results. */
+#define NETPERF_LEN_PREFIX                      4
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef enum NETPERFPROTO
+{
+    NETPERFPROTO_INVALID = 0,
+    NETPERFPROTO_TCP
+    //NETPERFPROTO_UDP
+} NETPERFPROTO;
+
+/**
+ * What kind of test we're performing.
+ */
+typedef enum NETPERFMODE
+{
+    NETPERFMODE_INVALID = 0,
+    /** Latency of a symmetric packet exchange. */
+    NETPERFMODE_LATENCY,
+    /** Separate throughput measurements for each direction. */
+    NETPERFMODE_THROUGHPUT,
+    /** Transmit throughput. */
+    NETPERFMODE_THROUGHPUT_XMIT,
+    /** Transmit throughput. */
+    NETPERFMODE_THROUGHPUT_RECV
+} NETPERFMODE;
+
+/**
+ * Statistics.
+ */
+typedef struct NETPERFSTATS
+{
+    uint64_t        cTx;
+    uint64_t        cRx;
+    uint64_t        cEchos;
+    uint64_t        cErrors;
+    uint64_t        cNsElapsed;
+} NETPERFSTATS;
+
+/**
+ * Settings & a little bit of state.
+ */
+typedef struct NETPERFPARAMS
+{
+    /** @name Static settings
+     * @{ */
+    /** The TCP port number. */
+    uint32_t        uPort;
+    /** Client: Use server statistcs. */
+    bool            fServerStats;
+    /** Server: Quit after the first client. */
+    bool            fSingleClient;
+    /** @} */
+
+    /** @name Dynamic settings
+     * @{ */
+    /** Disable send packet coalescing. */
+    bool            fNoDelay;
+    /** Detect broken payloads. */
+    bool            fCheckData;
+    /** The test mode. */
+    NETPERFMODE     enmMode;
+    /** The number of seconds to run each of the test steps. */
+    uint32_t        cSecTimeout;
+    /** Number of millisecond to spend warning up before testing. */
+    uint32_t        cMsWarmup;
+    /** Number of millisecond to spend cooling down after the testing. */
+    uint32_t        cMsCoolDown;
+    /** The packet size. */
+    uint32_t        cbPacket;
+    /** @} */
+
+    /** @name State
+     * @{ */
+    RTSOCKET        hSocket;
+    /** @} */
+} NETPERFPARAMS;
+
+/**
+ * Packet header used in tests.
+ *
+ * Need to indicate when we've timed out and it's time to reverse the roles or
+ * stop testing.
+ */
+typedef struct NETPERFHDR
+{
+    /** Magic value (little endian). */
+    uint32_t        u32Magic;
+    /** State value. */
+    uint32_t        u32State;
+    /** Sequence number (little endian). */
+    uint32_t        u32Seq;
+    /** Reserved, must be zero. */
+    uint32_t        u32Reserved;
+} NETPERFHDR;
+
+/** Magic value for NETPERFHDR::u32Magic. */
+#define NETPERFHDR_MAGIC     UINT32_C(0xfeedf00d)
+
+/** @name Packet State (NETPERF::u32Magic)
+ * @{ */
+/** Warm up. */
+#define NETPERFHDR_WARMUP    UINT32_C(0x0c0ffe01)
+/** The clock is running. */
+#define NETPERFHDR_TESTING   UINT32_C(0x0c0ffe02)
+/** Stop the clock but continue the package flow. */
+#define NETPERFHDR_COOL_DOWN UINT32_C(0x0c0ffe03)
+/** Done, stop the clock if not done already and reply with results. */
+#define NETPERFHDR_DONE      UINT32_C(0x0c0ffe04)
+/** @} */
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** Connection start/identifier to make sure other end is NetPerf. */
+static const char g_ConnectStart[]  = "yo! waaazzzzzaaaaup dude?";
+/** Start of parameters proposal made by the client. */
+static const char g_szStartParams[] = "deal?";
+/** All okay to start test */
+static const char g_szAck[]         = "okay!";
+/** Negative. */
+static const char g_szNegative[]    = "nope!";
+AssertCompile(sizeof(g_szAck) == sizeof(g_szNegative));
+/** Start of statistics. */
+static const char g_szStartStats[]  = "dude, stats";
+
+/** Command line parameters */
+static const RTGETOPTDEF g_aCmdOptions[] =
+{
+    { "--server",           's', RTGETOPT_REQ_NOTHING },
+    { "--client",           'c', RTGETOPT_REQ_STRING  },
+    { "--interval",         'i', RTGETOPT_REQ_UINT32  },
+    { "--port",             'p', RTGETOPT_REQ_UINT32  },
+    { "--len",              'l', RTGETOPT_REQ_UINT32  },
+    { "--nodelay",          'N', RTGETOPT_REQ_NOTHING },
+    { "--mode",             'm', RTGETOPT_REQ_STRING  },
+    { "--warmpup",          'w', RTGETOPT_REQ_UINT32  },
+    { "--cool-down",        'W', RTGETOPT_REQ_UINT32  },
+    { "--server-stats",     'S', RTGETOPT_REQ_NOTHING },
+    { "--single-client",    '1', RTGETOPT_REQ_NOTHING },
+    { "--daemonize",        'd', RTGETOPT_REQ_NOTHING },
+    { "--daemonized",       'D', RTGETOPT_REQ_NOTHING },
+    { "--check-data",       'C', RTGETOPT_REQ_NOTHING },
+    { "--help",             'h', RTGETOPT_REQ_NOTHING } /* for Usage() */
+};
+
+/** The test handle. */
+static RTTEST g_hTest;
+
+
+
+static void Usage(PRTSTREAM pStrm)
+{
+    char szExec[RTPATH_MAX];
+    RTStrmPrintf(pStrm, "usage: %s <-s|-c <host>> [options]\n",
+                 RTPathFilename(RTProcGetExecutablePath(szExec, sizeof(szExec))));
+    RTStrmPrintf(pStrm, "\n");
+    RTStrmPrintf(pStrm, "options: \n");
+
+
+    for (unsigned i = 0; i < RT_ELEMENTS(g_aCmdOptions); i++)
+    {
+        const char *pszHelp;
+        switch (g_aCmdOptions[i].iShort)
+        {
+            case 'h':
+                pszHelp = "Displays this help and exit";
+                break;
+            case 's':
+                pszHelp = "Run in server mode, waiting for clients (default)";
+                break;
+            case 'c':
+                pszHelp = "Run in client mode, connecting to <host>";
+                break;
+            case 'i':
+                pszHelp = "Interval in seconds to run the test (default " RT_XSTR(NETPERF_DEFAULT_TIMEOUT) " s)";
+                break;
+            case 'p':
+                pszHelp = "Server port to listen/connect to (default " RT_XSTR(NETPERF_DEFAULT_PORT) ")";
+                break;
+            case 'l':
+                pszHelp = "Packet size in bytes (defaults to " RT_XSTR(NETPERF_DEFAULT_PKT_SIZE_LATENCY)
+                    " for latency and " RT_XSTR(NETPERF_DEFAULT_PKT_SIZE_THROUGHPUT) " for throughput)";
+                break;
+            case 'm':
+                pszHelp = "Test mode: latency (default), throughput, throughput-xmit or throughput-recv";
+                break;
+            case 'N':
+                pszHelp = "Set TCP no delay, disabling Nagle's algorithm";
+                break;
+            case 'S':
+                pszHelp = "Report server stats, ignored if server";
+                break;
+            case '1':
+                pszHelp = "Stop the server after the first client";
+                break;
+            case 'd':
+                pszHelp = "Daemonize if server, ignored if client";
+                break;
+            case 'D':
+                continue; /* internal */
+            case 'w':
+                pszHelp = "Warmup time, in milliseconds (default " RT_XSTR(NETPERF_DEFAULT_WARMPUP) " ms)";
+                break;
+            case 'W':
+                pszHelp = "Cool down time, in milliseconds (default " RT_XSTR(NETPERF_DEFAULT_COOL_DOWN) " ms)";
+                break;
+            case 'C':
+                pszHelp = "Check payload data at the receiving end";
+                break;
+            default:
+                pszHelp = "Option undocumented";
+                break;
+        }
+        char szOpt[256];
+        RTStrPrintf(szOpt, sizeof(szOpt), "%s, -%c", g_aCmdOptions[i].pszLong, g_aCmdOptions[i].iShort);
+        RTStrmPrintf(pStrm, "  %-20s%s\n", szOpt, pszHelp);
+    }
+}
+
+/**
+ * Timer callback employed to set the stop indicator.
+ *
+ * This is used both by the client and server side.
+ *
+ * @param   hTimer              The timer, ignored.
+ * @param   pvUser              Pointer to the stop variable.
+ * @param   iTick               The tick, ignored.
+ */
+static void netperfStopTimerCallback(RTTIMERLR hTimer, void *pvUser, uint64_t iTick)
+{
+    bool volatile *pfStop = (bool volatile *)pvUser;
+/*    RTPrintf("Time's Up!\n");*/
+    ASMAtomicWriteBool(pfStop, true);
+    NOREF(hTimer); NOREF(iTick);
+}
+
+/**
+ * Sends a statistics packet to our peer.
+ *
+ * @returns IPRT status.
+ * @param   pStats              The stats to send.
+ * @param   hSocket             The TCP socket to send them to.
+ */
+static int netperfSendStats(NETPERFSTATS const *pStats, RTSOCKET hSocket)
+{
+    char szBuf[256 + NETPERF_LEN_PREFIX];
+    size_t cch = RTStrPrintf(&szBuf[NETPERF_LEN_PREFIX], sizeof(szBuf) - NETPERF_LEN_PREFIX,
+                             "%s:%llu:%llu:%llu:%llu:%llu",
+                             g_szStartStats,
+                             pStats->cTx,
+                             pStats->cRx,
+                             pStats->cEchos,
+                             pStats->cErrors,
+                             pStats->cNsElapsed);
+
+    RTStrPrintf(szBuf, NETPERF_LEN_PREFIX + 1, "%0*u", NETPERF_LEN_PREFIX, cch);
+    szBuf[NETPERF_LEN_PREFIX] = g_szStartStats[0];
+    Assert(strlen(szBuf) == cch + NETPERF_LEN_PREFIX);
+
+    int rc = RTTcpWrite(hSocket, szBuf, cch + NETPERF_LEN_PREFIX);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "stats: Failed to send stats: %Rrc\n", rc);
+
+    /*
+     * Wait for ACK.
+     */
+    rc = RTTcpRead(hSocket, szBuf, sizeof(g_szAck) - 1, NULL);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "stats: failed to write stats: %Rrc\n", szBuf, rc);
+    szBuf[sizeof(g_szAck) - 1] = '\0';
+    if (!strcmp(szBuf, g_szNegative))
+        return RTTestIFailedRc(rc, "stats: client failed to parse them\n", szBuf);
+    if (strcmp(szBuf, g_szAck))
+        return RTTestIFailedRc(rc, "stats: got '%s' in instead of ack/nack\n", szBuf);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * Receives a statistics packet from our peer.
+ *
+ * @returns IPRT status code. Error signalled.
+ * @param   pStats              Where to receive the stats.
+ * @param   hSocket             The TCP socket to recevie them from.
+ */
+static int netperfRecvStats(NETPERFSTATS *pStats, RTSOCKET hSocket)
+{
+    /*
+     * Read the stats message.
+     */
+    /* the length prefix */
+    char szBuf[256 + NETPERF_LEN_PREFIX];
+    int rc = RTTcpRead(hSocket, szBuf, NETPERF_LEN_PREFIX, NULL);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "stats: failed to read stats prefix: %Rrc\n", rc);
+
+    szBuf[NETPERF_LEN_PREFIX] = '\0';
+    uint32_t cch;
+    rc = RTStrToUInt32Full(szBuf, 10, &cch);
+    if (rc != VINF_SUCCESS)
+        return RTTestIFailedRc(RT_SUCCESS(rc) ? -rc : rc, "stats: bad stat length prefix: '%s' - %Rrc\n", szBuf, rc);
+    if (cch >= sizeof(szBuf))
+        return RTTestIFailedRc(VERR_BUFFER_OVERFLOW, "stats: too large: %u bytes\n", cch);
+
+    /* the actual message */
+    rc = RTTcpRead(hSocket, szBuf, cch, NULL);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "failed to read stats: %Rrc\n", rc);
+    szBuf[cch] = '\0';
+
+    /*
+     * Validate the message header.
+     */
+    if (   strncmp(szBuf, g_szStartStats, sizeof(g_szStartStats) - 1)
+        || szBuf[sizeof(g_szStartStats) - 1] != ':')
+        return RTTestIFailedRc(VERR_NET_PROTOCOL_ERROR, "stats: invalid packet start: '%s'\n", szBuf);
+    char *pszCur = &szBuf[sizeof(g_szStartStats)];
+
+    /*
+     * Parse it.
+     */
+    static const char * const s_apszNames[] =
+    {
+        "cTx", "cRx", "cEchos", "cErrors", "cNsElapsed"
+    };
+    uint64_t *apu64[RT_ELEMENTS(s_apszNames)] =
+    {
+        &pStats->cTx,
+        &pStats->cRx,
+        &pStats->cEchos,
+        &pStats->cErrors,
+        &pStats->cNsElapsed
+    };
+
+    for (unsigned i = 0; i < RT_ELEMENTS(apu64); i++)
+    {
+        if (!pszCur)
+            return RTTestIFailedRc(VERR_PARSE_ERROR, "stats: missing %s\n", s_apszNames[i]);
+
+        char *pszNext = strchr(pszCur, ':');
+        if (pszNext)
+            *pszNext++ = '\0';
+        rc = RTStrToUInt64Full(pszCur, 10, apu64[i]);
+        if (rc != VINF_SUCCESS)
+            return RTTestIFailedRc(RT_SUCCESS(rc) ? -rc : rc, "stats: bad value for %s: '%s' - %Rrc\n",
+                                   s_apszNames[i], pszCur, rc);
+
+        pszCur = pszNext;
+    }
+
+    if (pszCur)
+        return RTTestIFailedRc(VERR_PARSE_ERROR, "stats: Unparsed data: '%s'\n", pszCur);
+
+    /*
+     * Send ACK.
+     */
+    rc = RTTcpWrite(hSocket, g_szAck, sizeof(g_szAck) - 1);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "stats: failed to write ack: %Rrc\n", rc);
+
+    return VINF_SUCCESS;
+}
+
+/**
+ * TCP Throughput: Print the statistics.
+ *
+ * @param   pSendStats          Send stats.
+ * @param   pRecvStats          Receive stats.
+ * @param   cbPacket            Packet size.
+ */
+static void netperfPrintThroughputStats(NETPERFSTATS const *pSendStats, NETPERFSTATS const *pRecvStats, uint32_t cbPacket)
+{
+    RTTestIValue("Packet size",         cbPacket,          RTTESTUNIT_BYTES);
+
+    if (pSendStats)
+    {
+        double rdSecElapsed = (double)pSendStats->cNsElapsed / 1000000000.0;
+        RTTestIValue("Sends",               pSendStats->cTx,              RTTESTUNIT_PACKETS);
+        RTTestIValue("Send Interval",       pSendStats->cNsElapsed,       RTTESTUNIT_NS);
+        RTTestIValue("Send Throughput",     (uint64_t)(cbPacket * pSendStats->cTx / rdSecElapsed), RTTESTUNIT_BYTES_PER_SEC);
+        RTTestIValue("Send Rate",           (uint64_t)(pSendStats->cTx / rdSecElapsed),  RTTESTUNIT_PACKETS_PER_SEC);
+        RTTestIValue("Send Latency",        (uint64_t)(rdSecElapsed / pSendStats->cTx * 1000000000.0), RTTESTUNIT_NS_PER_PACKET);
+    }
+
+    if (pRecvStats)
+    {
+        double rdSecElapsed = (double)pRecvStats->cNsElapsed / 1000000000.0;
+        RTTestIValue("Receives",            pRecvStats->cRx,              RTTESTUNIT_PACKETS);
+        RTTestIValue("Receive Interval",    pRecvStats->cNsElapsed,       RTTESTUNIT_NS);
+        RTTestIValue("Receive Throughput",  (uint64_t)(cbPacket * pRecvStats->cRx / rdSecElapsed), RTTESTUNIT_BYTES_PER_SEC);
+        RTTestIValue("Receive Rate",        (uint64_t)(pRecvStats->cRx / rdSecElapsed),  RTTESTUNIT_PACKETS_PER_SEC);
+        RTTestIValue("Receive Latency",     (uint64_t)(rdSecElapsed / pRecvStats->cRx * 1000000000.0), RTTESTUNIT_NS_PER_PACKET);
+    }
+}
+
+/**
+ * TCP Throughput: Send data to the other party.
+ *
+ * @returns IPRT status code.
+ * @param   pParams             The TCP parameters block.
+ * @param   pBuf                The buffer we're using when sending.
+ * @param   pSendStats          Where to return the statistics.
+ */
+static int netperfTCPThroughputSend(NETPERFPARAMS const *pParams, NETPERFHDR *pBuf, NETPERFSTATS *pSendStats)
+{
+    RT_ZERO(*pSendStats);
+
+    /*
+     * Create the timer
+     */
+    RTTIMERLR       hTimer;
+    bool volatile   fStop = false;
+    int rc = RTTimerLRCreateEx(&hTimer, 0 /* nsec */, RTTIMER_FLAGS_CPU_ANY, netperfStopTimerCallback, (void *)&fStop);
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t u32Seq = 0;
+
+        RT_BZERO(pBuf, pParams->cbPacket);
+        pBuf->u32Magic      = RT_H2LE_U32_C(NETPERFHDR_MAGIC);
+        pBuf->u32State      = 0;
+        pBuf->u32Seq        = 0;
+        pBuf->u32Reserved   = 0;
+
+        /*
+         * Warm up.
+         */
+        pBuf->u32State = RT_H2LE_U32_C(NETPERFHDR_WARMUP);
+        rc = RTTimerLRStart(hTimer, pParams->cMsWarmup * UINT64_C(1000000) /* nsec */);
+        if (RT_SUCCESS(rc))
+        {
+            while (!fStop)
+            {
+                u32Seq++;
+                pBuf->u32Seq = RT_H2LE_U32(u32Seq);
+                rc = RTTcpWrite(pParams->hSocket, pBuf, pParams->cbPacket);
+                if (RT_FAILURE(rc))
+                {
+                    RTTestIFailed("RTTcpWrite/warmup: %Rrc\n", rc);
+                    break;
+                }
+            }
+        }
+        else
+            RTTestIFailed("RTTimerLRStart/warmup: %Rrc\n", rc);
+
+        /*
+         * The real thing.
+         */
+        if (RT_SUCCESS(rc))
+        {
+            pBuf->u32State = RT_H2LE_U32_C(NETPERFHDR_TESTING);
+            fStop          = false;
+            rc = RTTimerLRStart(hTimer, pParams->cSecTimeout * UINT64_C(1000000000) /* nsec */);
+            if (RT_SUCCESS(rc))
+            {
+                uint64_t u64StartTS = RTTimeNanoTS();
+                while (!fStop)
+                {
+                    u32Seq++;
+                    pBuf->u32Seq = RT_H2LE_U32(u32Seq);
+                    rc = RTTcpWrite(pParams->hSocket, pBuf, pParams->cbPacket);
+                    if (RT_FAILURE(rc))
+                    {
+                        RTTestIFailed("RTTcpWrite/testing: %Rrc\n", rc);
+                        break;
+                    }
+                    pSendStats->cTx++;
+                }
+                pSendStats->cNsElapsed = RTTimeNanoTS() - u64StartTS;
+            }
+            else
+                RTTestIFailed("RTTimerLRStart/testing: %Rrc\n", rc);
+        }
+
+        /*
+         * Cool down.
+         */
+        if (RT_SUCCESS(rc))
+        {
+            pBuf->u32State = RT_H2LE_U32_C(NETPERFHDR_COOL_DOWN);
+            fStop          = false;
+            rc = RTTimerLRStart(hTimer, pParams->cMsCoolDown * UINT64_C(1000000) /* nsec */);
+            if (RT_SUCCESS(rc))
+            {
+                while (!fStop)
+                {
+                    u32Seq++;
+                    pBuf->u32Seq = RT_H2LE_U32(u32Seq);
+                    rc = RTTcpWrite(pParams->hSocket, pBuf, pParams->cbPacket);
+                    if (RT_FAILURE(rc))
+                    {
+                        RTTestIFailed("RTTcpWrite/cool down: %Rrc\n", rc);
+                        break;
+                    }
+                }
+            }
+            else
+                RTTestIFailed("RTTimerLRStart/testing: %Rrc\n", rc);
+        }
+
+        /*
+         * Send DONE packet.
+         */
+        if (RT_SUCCESS(rc))
+        {
+            u32Seq++;
+            pBuf->u32Seq   = RT_H2LE_U32(u32Seq);
+            pBuf->u32State = RT_H2LE_U32_C(NETPERFHDR_DONE);
+            rc = RTTcpWrite(pParams->hSocket, pBuf, pParams->cbPacket);
+            if (RT_FAILURE(rc))
+                RTTestIFailed("RTTcpWrite/done: %Rrc\n", rc);
+        }
+
+        RTTimerLRDestroy(hTimer);
+    }
+    else
+        RTTestIFailed("Failed to create timer object: %Rrc\n", rc);
+    return rc;
+}
+
+
+/**
+ * TCP Throughput: Receive data from the other party.
+ *
+ * @returns IPRT status code.
+ * @param   pParams             The TCP parameters block.
+ * @param   pBuf                The buffer we're using when sending.
+ * @param   pStats              Where to return the statistics.
+ */
+static int netperfTCPThroughputRecv(NETPERFPARAMS const *pParams, NETPERFHDR *pBuf, NETPERFSTATS *pStats)
+{
+    RT_ZERO(*pStats);
+
+    int         rc;
+    uint32_t    u32Seq      = 0;
+    uint64_t    cRx         = 0;
+    uint64_t    u64StartTS  = 0;
+    uint32_t    uState      = RT_H2LE_U32_C(NETPERFHDR_WARMUP);
+
+    for (;;)
+    {
+        rc = RTTcpRead(pParams->hSocket, pBuf, pParams->cbPacket, NULL);
+        if (RT_FAILURE(rc))
+        {
+            pStats->cErrors++;
+            RTTestIFailed("RTTcpRead failed: %Rrc\n", rc);
+            break;
+        }
+        if (RT_UNLIKELY(   pBuf->u32Magic    != RT_H2LE_U32_C(NETPERFHDR_MAGIC)
+                        || pBuf->u32Reserved != 0))
+        {
+            pStats->cErrors++;
+            RTTestIFailed("Invalid magic or reserved field value: %#x %#x\n", RT_H2LE_U32(pBuf->u32Magic), RT_H2LE_U32(pBuf->u32Reserved));
+            rc = VERR_INVALID_MAGIC;
+            break;
+        }
+
+        u32Seq += 1;
+        if (RT_UNLIKELY(pBuf->u32Seq != RT_H2LE_U32(u32Seq)))
+        {
+            pStats->cErrors++;
+            RTTestIFailed("Out of sequence: got %#x, expected %#x\n", RT_H2LE_U32(pBuf->u32Seq), u32Seq);
+            rc = VERR_WRONG_ORDER;
+            break;
+        }
+
+        if (pParams->fCheckData && uState == RT_H2LE_U32_C(NETPERFHDR_TESTING))
+        {
+            unsigned i = sizeof(NETPERFHDR);
+            for (;i < pParams->cbPacket; ++i)
+                if (((unsigned char *)pBuf)[i])
+                    break;
+            if (i != pParams->cbPacket)
+            {
+                pStats->cErrors++;
+                RTTestIFailed("Broken payload: at %#x got %#x, expected %#x\n", i, ((unsigned char *)pBuf)[i], 0);
+                rc = VERR_NOT_EQUAL;
+                break;
+            }
+        }
+        if (RT_LIKELY(pBuf->u32State == uState))
+            cRx++;
+        /*
+         * Validate and act on switch state.
+         */
+        else if (   uState         == RT_H2LE_U32_C(NETPERFHDR_WARMUP)
+                 && pBuf->u32State == RT_H2LE_U32_C(NETPERFHDR_TESTING))
+        {
+            cRx = 0;
+            u64StartTS = RTTimeNanoTS();
+            uState = pBuf->u32State;
+        }
+        else if (   uState             == RT_H2LE_U32_C(NETPERFHDR_TESTING)
+                 && (   pBuf->u32State == RT_H2LE_U32_C(NETPERFHDR_COOL_DOWN)
+                     || pBuf->u32State == RT_H2LE_U32_C(NETPERFHDR_DONE)) )
+        {
+            pStats->cNsElapsed = RTTimeNanoTS() - u64StartTS;
+            pStats->cRx        = cRx + 1;
+            uState = pBuf->u32State;
+            if (uState == RT_H2LE_U32_C(NETPERFHDR_DONE))
+                break;
+        }
+        else if (   uState         == RT_H2LE_U32_C(NETPERFHDR_COOL_DOWN)
+                 && pBuf->u32State == RT_H2LE_U32_C(NETPERFHDR_DONE))
+        {
+            uState = pBuf->u32State;
+            break;
+        }
+        else
+        {
+            pStats->cErrors++;
+            RTTestIFailed("Protocol error: invalid state transition %#x -> %#x\n",
+                          RT_LE2H_U32(uState), RT_LE2H_U32(pBuf->u32State));
+            rc = VERR_INVALID_MAGIC;
+            break;
+        }
+    }
+
+    AssertReturn(uState == RT_H2LE_U32_C(NETPERFHDR_DONE) || RT_FAILURE(rc), VERR_INVALID_STATE);
+    return rc;
+}
+
+
+/**
+ * Prints the statistics for the latency test.
+ *
+ * @param   pStats              The statistics.
+ */
+static void netperfPrintLatencyStats(NETPERFSTATS const *pStats, uint32_t cbPacket)
+{
+    double rdSecElapsed = (double)pStats->cNsElapsed / 1000000000.0;
+    RTTestIValue("Transmitted",         pStats->cTx,             RTTESTUNIT_PACKETS);
+    RTTestIValue("Successful echos",    pStats->cEchos,          RTTESTUNIT_PACKETS);
+    RTTestIValue("Errors",              pStats->cErrors,         RTTESTUNIT_PACKETS);
+    RTTestIValue("Interval",            pStats->cNsElapsed,      RTTESTUNIT_NS);
+    RTTestIValue("Packet size",         cbPacket,                RTTESTUNIT_BYTES);
+    RTTestIValue("Average rate",        (uint64_t)(pStats->cEchos / rdSecElapsed),  RTTESTUNIT_PACKETS_PER_SEC);
+    RTTestIValue("Average throughput",  (uint64_t)(cbPacket * pStats->cEchos / rdSecElapsed), RTTESTUNIT_BYTES_PER_SEC);
+    RTTestIValue("Average latency",     (uint64_t)(rdSecElapsed / pStats->cEchos * 1000000000.0), RTTESTUNIT_NS_PER_ROUND_TRIP);
+    RTTestISubDone();
+}
+
+
+/**
+ * NETPERFMODE -> string.
+ *
+ * @returns readonly string.
+ * @param   enmMode             The mode.
+ */
+static const char *netperfModeToString(NETPERFMODE enmMode)
+{
+    switch (enmMode)
+    {
+        case NETPERFMODE_LATENCY:           return "latency";
+        case NETPERFMODE_THROUGHPUT:        return "throughput";
+        case NETPERFMODE_THROUGHPUT_XMIT:   return "throughput-xmit";
+        case NETPERFMODE_THROUGHPUT_RECV:   return "throughput-recv";
+        default:                        AssertFailed(); return "internal-error";
+    }
+}
+
+/**
+ * String -> NETPERFMODE.
+ *
+ * @returns The corresponding NETPERFMODE, NETPERFMODE_INVALID on failure.
+ * @param   pszMode             The mode string.
+ */
+static NETPERFMODE netperfModeFromString(const char *pszMode)
+{
+    if (!strcmp(pszMode, "latency"))
+        return NETPERFMODE_LATENCY;
+    if (   !strcmp(pszMode, "throughput")
+        || !strcmp(pszMode, "thruput") )
+        return NETPERFMODE_THROUGHPUT;
+    if (   !strcmp(pszMode, "throughput-xmit")
+        || !strcmp(pszMode, "thruput-xmit")
+        || !strcmp(pszMode, "xmit") )
+        return NETPERFMODE_THROUGHPUT_XMIT;
+    if (   !strcmp(pszMode, "throughput-recv")
+        || !strcmp(pszMode, "thruput-recv")
+        || !strcmp(pszMode, "recv") )
+        return NETPERFMODE_THROUGHPUT_RECV;
+    return NETPERFMODE_INVALID;
+}
+
+
+
+
+
+/**
+ * TCP Server: Throughput test.
+ *
+ * @returns IPRT status code.
+ * @param   pParams             The parameters to use for this test.
+ */
+static int netperfTCPServerDoThroughput(NETPERFPARAMS const *pParams)
+{
+    /*
+     * Allocate the buffer.
+     */
+    NETPERFHDR *pBuf = (NETPERFHDR *)RTMemAllocZ(pParams->cbPacket);
+    if (!pBuf)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Out of memory");
+
+    /*
+     * Receive first, then Send.  The reverse of the client.
+     */
+    NETPERFSTATS RecvStats;
+    int rc = netperfTCPThroughputRecv(pParams, pBuf, &RecvStats);
+    if (RT_SUCCESS(rc))
+    {
+        rc = netperfSendStats(&RecvStats, pParams->hSocket);
+        if (RT_SUCCESS(rc))
+        {
+            NETPERFSTATS SendStats;
+            rc = netperfTCPThroughputSend(pParams, pBuf, &SendStats);
+            if (RT_SUCCESS(rc))
+            {
+                rc = netperfSendStats(&SendStats, pParams->hSocket);
+                netperfPrintThroughputStats(&SendStats, &RecvStats, pParams->cbPacket);
+            }
+        }
+    }
+
+    return rc;
+}
+
+/**
+ * TCP Server: Throughput xmit test (receive from client).
+ *
+ * @returns IPRT status code.
+ * @param   pParams             The parameters to use for this test.
+ */
+static int netperfTCPServerDoThroughputXmit(NETPERFPARAMS const *pParams)
+{
+    /*
+     * Allocate the buffer.
+     */
+    NETPERFHDR *pBuf = (NETPERFHDR *)RTMemAllocZ(pParams->cbPacket);
+    if (!pBuf)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Out of memory");
+
+    /*
+     * Receive the transmitted data (reverse of client).
+     */
+    NETPERFSTATS RecvStats;
+    int rc = netperfTCPThroughputRecv(pParams, pBuf, &RecvStats);
+    if (RT_SUCCESS(rc))
+    {
+        rc = netperfSendStats(&RecvStats, pParams->hSocket);
+        if (RT_SUCCESS(rc))
+            netperfPrintThroughputStats(NULL, &RecvStats, pParams->cbPacket);
+    }
+
+    return rc;
+}
+
+/**
+ * TCP Server: Throughput recv test (transmit to client).
+ *
+ * @returns IPRT status code.
+ * @param   pParams             The parameters to use for this test.
+ */
+static int netperfTCPServerDoThroughputRecv(NETPERFPARAMS const *pParams)
+{
+    /*
+     * Allocate the buffer.
+     */
+    NETPERFHDR *pBuf = (NETPERFHDR *)RTMemAllocZ(pParams->cbPacket);
+    if (!pBuf)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Out of memory");
+
+    /*
+     * Send data to the client (reverse of client).
+     */
+    NETPERFSTATS SendStats;
+    int rc = netperfTCPThroughputSend(pParams, pBuf, &SendStats);
+    if (RT_SUCCESS(rc))
+    {
+        rc = netperfSendStats(&SendStats, pParams->hSocket);
+        if (RT_SUCCESS(rc))
+            netperfPrintThroughputStats(&SendStats, NULL, pParams->cbPacket);
+    }
+
+    return rc;
+}
+
+/**
+ * TCP Server: Latency test.
+ *
+ * @returns IPRT status code.
+ * @param   pParams             The parameters to use for this test.
+ */
+static int netperfTCPServerDoLatency(NETPERFPARAMS const *pParams)
+{
+    NETPERFHDR *pBuf = (NETPERFHDR *)RTMemAllocZ(pParams->cbPacket);
+    if (!pBuf)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Failed to allocated packet buffer of %u bytes.\n", pParams->cbPacket);
+
+    /*
+     * Ping pong with client.
+     */
+    int             rc;
+    uint32_t        uState    = RT_H2LE_U32_C(NETPERFHDR_WARMUP);
+    uint32_t        u32Seq    = 0;
+    uint64_t        cTx       = 0;
+    uint64_t        cRx       = 0;
+    uint64_t        u64StartTS  = 0;
+    NETPERFSTATS    Stats;
+    RT_ZERO(Stats);
+    for (;;)
+    {
+        rc = RTTcpRead(pParams->hSocket, pBuf, pParams->cbPacket, NULL);
+        if (RT_FAILURE(rc))
+        {
+            RTTestIFailed("Failed to read data from client: %Rrc\n", rc);
+            break;
+        }
+
+        /*
+         * Validate the packet
+         */
+        if (RT_UNLIKELY(   pBuf->u32Magic    != RT_H2LE_U32_C(NETPERFHDR_MAGIC)
+                        || pBuf->u32Reserved != 0))
+        {
+            RTTestIFailed("Invalid magic or reserved field value: %#x %#x\n", RT_H2LE_U32(pBuf->u32Magic), RT_H2LE_U32(pBuf->u32Reserved));
+            rc = VERR_INVALID_MAGIC;
+            break;
+        }
+
+        u32Seq += 1;
+        if (RT_UNLIKELY(pBuf->u32Seq != RT_H2LE_U32(u32Seq)))
+        {
+            RTTestIFailed("Out of sequence: got %#x, expected %#x\n", RT_H2LE_U32(pBuf->u32Seq), u32Seq);
+            rc = VERR_WRONG_ORDER;
+            break;
+        }
+
+        /*
+         * Count the packet if the state remains unchanged.
+         */
+        if (RT_LIKELY(pBuf->u32State == uState))
+            cRx++;
+        /*
+         * Validate and act on the state transition.
+         */
+        else if (   uState         == RT_H2LE_U32_C(NETPERFHDR_WARMUP)
+                 && pBuf->u32State == RT_H2LE_U32_C(NETPERFHDR_TESTING))
+        {
+            cRx = cTx = 0;
+            u64StartTS = RTTimeNanoTS();
+            uState = pBuf->u32State;
+        }
+        else if (   uState             == RT_H2LE_U32_C(NETPERFHDR_TESTING)
+                 && (   pBuf->u32State == RT_H2LE_U32_C(NETPERFHDR_COOL_DOWN)
+                     || pBuf->u32State == RT_H2LE_U32_C(NETPERFHDR_DONE)) )
+        {
+            Stats.cNsElapsed = RTTimeNanoTS() - u64StartTS;
+            Stats.cEchos     = cTx;
+            Stats.cTx        = cTx;
+            Stats.cRx        = cRx;
+            uState = pBuf->u32State;
+            if (uState == RT_H2LE_U32_C(NETPERFHDR_DONE))
+                break;
+        }
+        else if (   uState         == RT_H2LE_U32_C(NETPERFHDR_COOL_DOWN)
+                 && pBuf->u32State == RT_H2LE_U32_C(NETPERFHDR_DONE))
+        {
+            uState = pBuf->u32State;
+            break;
+        }
+        else
+        {
+            RTTestIFailed("Protocol error: invalid state transition %#x -> %#x\n",
+                          RT_LE2H_U32(uState), RT_LE2H_U32(pBuf->u32State));
+            break;
+        }
+
+        /*
+         * Write same data back to client.
+         */
+        rc = RTTcpWrite(pParams->hSocket, pBuf, pParams->cbPacket);
+        if (RT_FAILURE(rc))
+        {
+            RTTestIFailed("Failed to write data to client: %Rrc\n", rc);
+            break;
+        }
+
+        cTx++;
+    }
+
+    /*
+     * Send stats to client and print them.
+     */
+    if (uState == RT_H2LE_U32_C(NETPERFHDR_DONE))
+        netperfSendStats(&Stats, pParams->hSocket);
+
+    if (   uState == RT_H2LE_U32_C(NETPERFHDR_DONE)
+        || uState == RT_H2LE_U32_C(NETPERFHDR_COOL_DOWN))
+        netperfPrintLatencyStats(&Stats, pParams->cbPacket);
+
+    RTMemFree(pBuf);
+    return rc;
+}
+
+/**
+ * Parses the parameters the client has sent us.
+ *
+ * @returns IPRT status code. Message has been shown on failure.
+ * @param   pParams             The parameter structure to store the parameters
+ *                              in.
+ * @param   pszParams           The parameter string sent by the client.
+ */
+static int netperfTCPServerParseParams(NETPERFPARAMS *pParams, char *pszParams)
+{
+    /*
+     * Set defaults for the dynamic settings.
+     */
+    pParams->fNoDelay    = false;
+    pParams->enmMode     = NETPERFMODE_LATENCY;
+    pParams->cSecTimeout = NETPERF_DEFAULT_WARMUP;
+    pParams->cMsCoolDown = NETPERF_DEFAULT_COOL_DOWN;
+    pParams->cMsWarmup   = NETPERF_DEFAULT_WARMUP;
+    pParams->cbPacket    = NETPERF_DEFAULT_PKT_SIZE_LATENCY;
+
+    /*
+     * Parse the client parameters.
+     */
+    /* first arg: transport type. [mandatory] */
+    char *pszCur = strchr(pszParams, ':');
+    if (!pszCur)
+        return RTTestIFailedRc(VERR_PARSE_ERROR, "client params: No colon\n");
+    char *pszNext = strchr(++pszCur, ':');
+    if (pszNext)
+        *pszNext++ = '\0';
+    if (strcmp(pszCur, "TCP"))
+        return RTTestIFailedRc(VERR_PARSE_ERROR, "client params: Invalid transport type: \"%s\"\n", pszCur);
+    pszCur = pszNext;
+
+    /* second arg: mode. [mandatory] */
+    if (!pszCur)
+        return RTTestIFailedRc(VERR_PARSE_ERROR, "client params: Missing test mode\n");
+    pszNext = strchr(pszCur, ':');
+    if (pszNext)
+        *pszNext++ = '\0';
+    pParams->enmMode = netperfModeFromString(pszCur);
+    if (pParams->enmMode == NETPERFMODE_INVALID)
+        return RTTestIFailedRc(VERR_PARSE_ERROR, "client params: Invalid test mode: \"%s\"\n", pszCur);
+    pszCur = pszNext;
+
+    /*
+     * The remainder are uint32_t or bool.
+     */
+    struct
+    {
+        bool        fBool;
+        bool        fMandatory;
+        void       *pvValue;
+        uint32_t    uMin;
+        uint32_t    uMax;
+        const char *pszName;
+    } aElements[] =
+    {
+        { false, true, &pParams->cSecTimeout, NETPERF_MIN_TIMEOUT,  NETPERF_MAX_TIMEOUT,  "timeout" },
+        { false, true, &pParams->cbPacket,    NETPERF_MIN_PKT_SIZE, NETPERF_MAX_PKT_SIZE, "packet size" },
+        { false, true, &pParams->cMsWarmup,   NETPERF_MIN_WARMUP, NETPERF_MAX_WARMUP, "warmup period" },
+        { false, true, &pParams->cMsCoolDown, NETPERF_MIN_COOL_DOWN, NETPERF_MAX_COOL_DOWN, "cool down period" },
+        { true,  true, &pParams->fNoDelay,    false, true, "no delay" },
+    };
+
+    for (unsigned i = 0; i < RT_ELEMENTS(aElements); i++)
+    {
+        if (!pszCur)
+            return aElements[i].fMandatory
+                 ? RTTestIFailedRc(VERR_PARSE_ERROR, "client params: missing %s\n", aElements[i].pszName)
+                 : VINF_SUCCESS;
+
+        pszNext = strchr(pszCur, ':');
+        if (pszNext)
+            *pszNext++ = '\0';
+        uint32_t u32;
+        int rc = RTStrToUInt32Full(pszCur, 10, &u32);
+        if (rc != VINF_SUCCESS)
+            return RTTestIFailedRc(VERR_PARSE_ERROR, "client params: bad %s value \"%s\": %Rrc\n",
+                                   aElements[i].pszName, pszCur, rc);
+
+        if (   u32 < aElements[i].uMin
+            || u32 > aElements[i].uMax)
+            return RTTestIFailedRc(VERR_PARSE_ERROR, "client params: %s %u s is out of range (%u..%u)\n",
+                                   aElements[i].pszName, u32, aElements[i].uMin, aElements[i].uMax);
+        if (aElements[i].fBool)
+            *(bool *)aElements[i].pvValue = u32 ? true : false;
+        else
+            *(uint32_t *)aElements[i].pvValue = u32;
+
+        pszCur = pszNext;
+    }
+
+    /* Fail if too many elements. */
+    if (pszCur)
+        return RTTestIFailedRc(VERR_PARSE_ERROR, "client params: too many elements: \"%s\"\n",
+                               pszCur);
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * TCP server callback that handles one client connection.
+ *
+ * @returns IPRT status code. VERR_TCP_SERVER_STOP is special.
+ * @param   hSocket             The client socket.
+ * @param   pvUser              Our parameters.
+ */
+static DECLCALLBACK(int) netperfTCPServerWorker(RTSOCKET hSocket, void *pvUser)
+{
+    NETPERFPARAMS *pParams = (NETPERFPARAMS *)pvUser;
+    AssertReturn(pParams, VERR_INVALID_POINTER);
+
+    pParams->hSocket = hSocket;
+
+    RTNETADDR Addr;
+    int rc = RTTcpGetPeerAddress(hSocket, &Addr);
+    if (RT_SUCCESS(rc))
+        RTTestIPrintf(RTTESTLVL_ALWAYS, "Client connected from %RTnaddr\n", &Addr);
+    else
+    {
+        RTTestIPrintf(RTTESTLVL_ALWAYS, "Failed to get client details: %Rrc\n", rc);
+        Addr.enmType = RTNETADDRTYPE_INVALID;
+    }
+
+    /*
+     * Greet the other dude.
+     */
+    rc = RTTcpWrite(hSocket, g_ConnectStart, sizeof(g_ConnectStart) - 1);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to send connection start Id: %Rrc\n", rc);
+
+    /*
+     * Read connection parameters.
+     */
+    char szBuf[256];
+    rc = RTTcpRead(hSocket, szBuf, NETPERF_LEN_PREFIX, NULL);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to read connection parameters: %Rrc\n", rc);
+    szBuf[NETPERF_LEN_PREFIX] = '\0';
+    uint32_t cchParams;
+    rc = RTStrToUInt32Full(szBuf, 10, &cchParams);
+    if (rc != VINF_SUCCESS)
+        return RTTestIFailedRc(RT_SUCCESS(rc) ? VERR_INTERNAL_ERROR : rc,
+                               "Failed to read connection parameters: %Rrc\n", rc);
+    if (cchParams >= sizeof(szBuf))
+        return RTTestIFailedRc(VERR_TOO_MUCH_DATA, "parameter packet is too big (%u bytes)\n", cchParams);
+    rc = RTTcpRead(hSocket, szBuf, cchParams, NULL);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to read connection parameters: %Rrc\n", rc);
+    szBuf[cchParams] = '\0';
+
+    if (strncmp(szBuf, g_szStartParams, sizeof(g_szStartParams) - 1))
+        return RTTestIFailedRc(VERR_NET_PROTOCOL_ERROR, "Invalid connection parameters '%s'\n", szBuf);
+
+    /*
+     * Parse the parameters and signal whether we've got a deal or not.
+     */
+    rc = netperfTCPServerParseParams(pParams, szBuf);
+    if (RT_FAILURE(rc))
+    {
+        int rc2 = RTTcpWrite(hSocket, g_szNegative, sizeof(g_szNegative) - 1);
+        if (RT_FAILURE(rc2))
+            RTTestIFailed("Failed to send negative ack: %Rrc\n", rc2);
+        return rc;
+    }
+
+    if (Addr.enmType != RTNETADDRTYPE_INVALID)
+        RTTestISubF("%RTnaddr - %s, %u s, %u bytes", &Addr,
+                    netperfModeToString(pParams->enmMode), pParams->cSecTimeout, pParams->cbPacket);
+    else
+        RTTestISubF("Unknown - %s, %u s, %u bytes",
+                    netperfModeToString(pParams->enmMode), pParams->cSecTimeout, pParams->cbPacket);
+
+    rc = RTTcpSetSendCoalescing(hSocket, !pParams->fNoDelay);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to apply no-delay option (%RTbool): %Rrc\n", pParams->fNoDelay, rc);
+
+    rc = RTTcpWrite(hSocket, g_szAck, sizeof(g_szAck) - 1);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to send start test commend to client: %Rrc\n", rc);
+
+    /*
+     * Take action according to our mode.
+     */
+    switch (pParams->enmMode)
+    {
+        case NETPERFMODE_LATENCY:
+            rc = netperfTCPServerDoLatency(pParams);
+            break;
+
+        case NETPERFMODE_THROUGHPUT:
+            rc = netperfTCPServerDoThroughput(pParams);
+            break;
+
+        case NETPERFMODE_THROUGHPUT_XMIT:
+            rc = netperfTCPServerDoThroughputXmit(pParams);
+            break;
+
+        case NETPERFMODE_THROUGHPUT_RECV:
+            rc = netperfTCPServerDoThroughputRecv(pParams);
+            break;
+
+        case NETPERFMODE_INVALID:
+            rc = VERR_INTERNAL_ERROR;
+            break;
+
+        /* no default! */
+    }
+    if (rc == VERR_NO_MEMORY)
+        return VERR_TCP_SERVER_STOP;
+
+    /*
+     * Wait for other clients or quit.
+     */
+    if (pParams->fSingleClient)
+        return VERR_TCP_SERVER_STOP;
+    return VINF_SUCCESS;
+}
+
+
+/**
+ * TCP server.
+ *
+ * @returns IPRT status code.
+ * @param   pParams             The TCP parameter block.
+ */
+static int netperfTCPServer(NETPERFPARAMS *pParams)
+{
+    /*
+     * Spawn the TCP server thread & listen.
+     */
+    PRTTCPSERVER pServer;
+    int rc = RTTcpServerCreateEx(NULL, pParams->uPort, &pServer);
+    if (RT_SUCCESS(rc))
+    {
+        RTPrintf("Server listening on TCP port %d\n", pParams->uPort);
+        rc = RTTcpServerListen(pServer, netperfTCPServerWorker, pParams);
+        RTTcpServerDestroy(pServer);
+    }
+    else
+        RTPrintf("Failed to create TCP server thread: %Rrc\n", rc);
+
+    return rc;
+}
+
+/**
+ * The server part.
+ *
+ * @returns Exit code.
+ * @param   enmProto            The protocol.
+ * @param   pParams             The parameter block.
+ */
+static RTEXITCODE netperfServer(NETPERFPROTO enmProto, NETPERFPARAMS *pParams)
+{
+
+    switch (enmProto)
+    {
+        case NETPERFPROTO_TCP:
+        {
+            int rc = netperfTCPServer(pParams);
+            return RT_SUCCESS(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+        }
+
+        default:
+            RTTestIFailed("Protocol not supported.\n");
+            return RTEXITCODE_FAILURE;
+    }
+}
+
+
+
+
+
+/**
+ * TCP client: Do the throughput test.
+ *
+ * @returns IPRT status code
+ * @param   pParams             The parameters.
+ */
+static int netperfTCPClientDoThroughput(NETPERFPARAMS *pParams)
+{
+    /*
+     * Allocate the buffer.
+     */
+    NETPERFHDR *pBuf = (NETPERFHDR *)RTMemAllocZ(pParams->cbPacket);
+    if (!pBuf)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Out of memory");
+
+    /*
+     * Send first, then Receive.
+     */
+    NETPERFSTATS SendStats;
+    int rc = netperfTCPThroughputSend(pParams, pBuf, &SendStats);
+    if (RT_SUCCESS(rc))
+    {
+        NETPERFSTATS SrvSendStats;
+        rc = netperfRecvStats(&SrvSendStats, pParams->hSocket);
+        if (RT_SUCCESS(rc))
+        {
+            NETPERFSTATS RecvStats;
+            rc = netperfTCPThroughputRecv(pParams, pBuf, &RecvStats);
+            if (RT_SUCCESS(rc))
+            {
+                NETPERFSTATS SrvRecvStats;
+                rc = netperfRecvStats(&SrvRecvStats, pParams->hSocket);
+                if (RT_SUCCESS(rc))
+                {
+                    if (pParams->fServerStats)
+                        netperfPrintThroughputStats(&SrvSendStats, &SrvRecvStats, pParams->cbPacket);
+                    else
+                        netperfPrintThroughputStats(&SendStats, &RecvStats, pParams->cbPacket);
+                }
+            }
+        }
+    }
+
+    RTTestISubDone();
+    return rc;
+}
+
+/**
+ * TCP client: Do the throughput xmit test.
+ *
+ * @returns IPRT status code
+ * @param   pParams             The parameters.
+ */
+static int netperfTCPClientDoThroughputXmit(NETPERFPARAMS *pParams)
+{
+    /*
+     * Allocate the buffer.
+     */
+    NETPERFHDR *pBuf = (NETPERFHDR *)RTMemAllocZ(pParams->cbPacket);
+    if (!pBuf)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Out of memory");
+
+    /*
+     * Do the job.
+     */
+    NETPERFSTATS SendStats;
+    int rc = netperfTCPThroughputSend(pParams, pBuf, &SendStats);
+    if (RT_SUCCESS(rc))
+    {
+        NETPERFSTATS SrvSendStats;
+        rc = netperfRecvStats(&SrvSendStats, pParams->hSocket);
+        if (RT_SUCCESS(rc))
+        {
+            if (pParams->fServerStats)
+                netperfPrintThroughputStats(&SrvSendStats, NULL, pParams->cbPacket);
+            else
+                netperfPrintThroughputStats(&SendStats,    NULL, pParams->cbPacket);
+        }
+    }
+
+    RTTestISubDone();
+    return rc;
+}
+
+/**
+ * TCP client: Do the throughput recv test.
+ *
+ * @returns IPRT status code
+ * @param   pParams             The parameters.
+ */
+static int netperfTCPClientDoThroughputRecv(NETPERFPARAMS *pParams)
+{
+    /*
+     * Allocate the buffer.
+     */
+    NETPERFHDR *pBuf = (NETPERFHDR *)RTMemAllocZ(pParams->cbPacket);
+    if (!pBuf)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Out of memory");
+
+    /*
+     * Do the job.
+     */
+    NETPERFSTATS RecvStats;
+    int rc = netperfTCPThroughputRecv(pParams, pBuf, &RecvStats);
+    if (RT_SUCCESS(rc))
+    {
+        NETPERFSTATS SrvRecvStats;
+        rc = netperfRecvStats(&SrvRecvStats, pParams->hSocket);
+        if (RT_SUCCESS(rc))
+        {
+            if (pParams->fServerStats)
+                netperfPrintThroughputStats(NULL, &SrvRecvStats, pParams->cbPacket);
+            else
+                netperfPrintThroughputStats(NULL, &RecvStats,    pParams->cbPacket);
+        }
+    }
+
+    RTTestISubDone();
+    return rc;
+}
+
+/**
+ * TCP client: Do the latency test.
+ *
+ * @returns IPRT status code
+ * @param   pParams             The parameters.
+ */
+static int netperfTCPClientDoLatency(NETPERFPARAMS *pParams)
+{
+    /*
+     * Generate a selection of packages before we start, after all we're not
+     * benchmarking the random number generator, are we. :-)
+     */
+    void *pvReadBuf = RTMemAllocZ(pParams->cbPacket);
+    if (!pvReadBuf)
+        return RTTestIFailedRc(VERR_NO_MEMORY, "Out of memory");
+
+    size_t i;
+    NETPERFHDR *apPackets[256];
+    for (i = 0; i < RT_ELEMENTS(apPackets); i++)
+    {
+        apPackets[i] = (NETPERFHDR *)RTMemAllocZ(pParams->cbPacket);
+        if (!apPackets[i])
+        {
+            while (i-- > 0)
+                RTMemFree(apPackets[i]);
+            return RTTestIFailedRc(VERR_NO_MEMORY, "Out of memory");
+        }
+        RTRandBytes(apPackets[i], pParams->cbPacket);
+        apPackets[i]->u32Magic      = RT_H2LE_U32_C(NETPERFHDR_MAGIC);
+        apPackets[i]->u32State      = 0;
+        apPackets[i]->u32Seq        = 0;
+        apPackets[i]->u32Reserved   = 0;
+    }
+
+    /*
+     * Create & start a timer to eventually disconnect.
+     */
+    bool volatile fStop = false;
+    RTTIMERLR hTimer;
+    int rc = RTTimerLRCreateEx(&hTimer, 0 /* nsec */, RTTIMER_FLAGS_CPU_ANY, netperfStopTimerCallback, (void *)&fStop);
+    if (RT_SUCCESS(rc))
+    {
+        uint32_t        u32Seq = 0;
+        NETPERFSTATS    Stats;
+        RT_ZERO(Stats);
+
+        /*
+         * Warm up.
+         */
+        rc = RTTimerLRStart(hTimer, pParams->cMsWarmup * UINT64_C(1000000) /* nsec */);
+        if (RT_SUCCESS(rc))
+        {
+            while (!fStop)
+            {
+                NETPERFHDR *pPacket = apPackets[u32Seq % RT_ELEMENTS(apPackets)];
+                u32Seq++;
+                pPacket->u32Seq   = RT_H2LE_U32(u32Seq);
+                pPacket->u32State = RT_H2LE_U32_C(NETPERFHDR_WARMUP);
+                rc = RTTcpWrite(pParams->hSocket, pPacket, pParams->cbPacket);
+                if (RT_FAILURE(rc))
+                {
+                    RTTestIFailed("RTTcpWrite/warmup: %Rrc\n", rc);
+                    break;
+                }
+                rc = RTTcpRead(pParams->hSocket, pvReadBuf, pParams->cbPacket, NULL);
+                if (RT_FAILURE(rc))
+                {
+                    RTTestIFailed("RTTcpRead/warmup: %Rrc\n", rc);
+                    break;
+                }
+            }
+        }
+        else
+            RTTestIFailed("RTTimerLRStart/warmup: %Rrc\n", rc);
+
+        /*
+         * The real thing.
+         */
+        if (RT_SUCCESS(rc))
+        {
+            fStop = false;
+            rc = RTTimerLRStart(hTimer, pParams->cSecTimeout * UINT64_C(1000000000) /* nsec */);
+            if (RT_SUCCESS(rc))
+            {
+                uint64_t u64StartTS = RTTimeNanoTS();
+                while (!fStop)
+                {
+                    NETPERFHDR *pPacket = apPackets[u32Seq % RT_ELEMENTS(apPackets)];
+                    u32Seq++;
+                    pPacket->u32Seq   = RT_H2LE_U32(u32Seq);
+                    pPacket->u32State = RT_H2LE_U32_C(NETPERFHDR_TESTING);
+                    rc = RTTcpWrite(pParams->hSocket, pPacket, pParams->cbPacket);
+                    if (RT_FAILURE(rc))
+                    {
+                        RTTestIFailed("RTTcpWrite/testing: %Rrc\n", rc);
+                        break;
+                    }
+                    Stats.cTx++;
+
+                    rc = RTTcpRead(pParams->hSocket, pvReadBuf, pParams->cbPacket, NULL);
+                    if (RT_FAILURE(rc))
+                    {
+                        RTTestIFailed("RTTcpRead/testing: %Rrc\n", rc);
+                        break;
+                    }
+                    Stats.cRx++;
+
+                    if (!memcmp(pvReadBuf, pPacket, pParams->cbPacket))
+                        Stats.cEchos++;
+                    else
+                        Stats.cErrors++;
+                }
+                Stats.cNsElapsed = RTTimeNanoTS() - u64StartTS;
+            }
+            else
+                RTTestIFailed("RTTimerLRStart/testing: %Rrc\n", rc);
+        }
+
+        /*
+         * Cool down.
+         */
+        if (RT_SUCCESS(rc))
+        {
+            fStop = false;
+            rc = RTTimerLRStart(hTimer, pParams->cMsCoolDown * UINT64_C(1000000) /* nsec */);
+            if (RT_SUCCESS(rc))
+            {
+                while (!fStop)
+                {
+                    NETPERFHDR *pPacket = apPackets[u32Seq % RT_ELEMENTS(apPackets)];
+                    u32Seq++;
+                    pPacket->u32Seq   = RT_H2LE_U32(u32Seq);
+                    pPacket->u32State = RT_H2LE_U32_C(NETPERFHDR_COOL_DOWN);
+                    rc = RTTcpWrite(pParams->hSocket, pPacket, pParams->cbPacket);
+                    if (RT_FAILURE(rc))
+                    {
+                        RTTestIFailed("RTTcpWrite/warmup: %Rrc\n", rc);
+                        break;
+                    }
+                    rc = RTTcpRead(pParams->hSocket, pvReadBuf, pParams->cbPacket, NULL);
+                    if (RT_FAILURE(rc))
+                    {
+                        RTTestIFailed("RTTcpRead/warmup: %Rrc\n", rc);
+                        break;
+                    }
+                }
+            }
+            else
+                RTTestIFailed("RTTimerLRStart/testing: %Rrc\n", rc);
+        }
+
+        /*
+         * Send DONE packet.
+         */
+        if (RT_SUCCESS(rc))
+        {
+            u32Seq++;
+            NETPERFHDR *pPacket = apPackets[u32Seq % RT_ELEMENTS(apPackets)];
+            pPacket->u32Seq   = RT_H2LE_U32(u32Seq);
+            pPacket->u32State = RT_H2LE_U32_C(NETPERFHDR_DONE);
+            rc = RTTcpWrite(pParams->hSocket, pPacket, pParams->cbPacket);
+            if (RT_FAILURE(rc))
+                RTTestIFailed("RTTcpWrite/done: %Rrc\n", rc);
+        }
+
+
+        /*
+         * Get and print stats.
+         */
+        NETPERFSTATS SrvStats;
+        if (RT_SUCCESS(rc))
+        {
+            rc = netperfRecvStats(&SrvStats, pParams->hSocket);
+            if (RT_SUCCESS(rc) && pParams->fServerStats)
+                netperfPrintLatencyStats(&SrvStats, pParams->cbPacket);
+            else if (!pParams->fServerStats)
+                netperfPrintLatencyStats(&Stats, pParams->cbPacket);
+        }
+
+        /* clean up*/
+        RTTimerLRDestroy(hTimer);
+    }
+    else
+        RTTestIFailed("Failed to create timer object: %Rrc\n", rc);
+    for (i = 0; i < RT_ELEMENTS(apPackets); i++)
+        RTMemFree(apPackets[i]);
+
+    return rc;
+}
+
+/**
+ * TCP client test driver.
+ *
+ * @returns IPRT status code
+ * @param   pszServer           The server name.
+ * @param   pParams             The parameter structure.
+ */
+static int netperfTCPClient(const char *pszServer, NETPERFPARAMS *pParams)
+{
+    AssertReturn(pParams, VERR_INVALID_POINTER);
+    RTTestISubF("TCP - %u s, %u bytes%s", pParams->cSecTimeout,
+                pParams->cbPacket, pParams->fNoDelay ? ", no delay" : "");
+
+    RTSOCKET hSocket = NIL_RTSOCKET;
+    int rc = RTTcpClientConnect(pszServer, pParams->uPort, &hSocket);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to connect to %s on port %u: %Rrc\n", pszServer, pParams->uPort, rc);
+    pParams->hSocket = hSocket;
+
+    /*
+     * Disable send coalescing (no-delay).
+     */
+    if (pParams->fNoDelay)
+    {
+        rc = RTTcpSetSendCoalescing(hSocket, false /*fEnable*/);
+        if (RT_FAILURE(rc))
+            return RTTestIFailedRc(rc, "Failed to set no-delay option: %Rrc\n", rc);
+    }
+
+    /*
+     * Verify the super secret Start Connect Id to start the connection.
+     */
+    char szBuf[256 + NETPERF_LEN_PREFIX];
+    RT_ZERO(szBuf);
+    rc = RTTcpRead(hSocket, szBuf, sizeof(g_ConnectStart) - 1, NULL);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to read connection initializer: %Rrc\n", rc);
+
+    if (strcmp(szBuf, g_ConnectStart))
+        return RTTestIFailedRc(VERR_INVALID_MAGIC, "Invalid connection initializer '%s'\n", szBuf);
+
+    /*
+     * Send all the dynamic parameters to the server.
+     * (If the server is newer than the client, it will select default for any
+     * missing parameters.)
+     */
+    size_t cchParams = RTStrPrintf(&szBuf[NETPERF_LEN_PREFIX], sizeof(szBuf) - NETPERF_LEN_PREFIX,
+                                   "%s:%s:%s:%u:%u:%u:%u:%u",
+                                   g_szStartParams,
+                                   "TCP",
+                                   netperfModeToString(pParams->enmMode),
+                                   pParams->cSecTimeout,
+                                   pParams->cbPacket,
+                                   pParams->cMsWarmup,
+                                   pParams->cMsCoolDown,
+                                   pParams->fNoDelay);
+    RTStrPrintf(szBuf, NETPERF_LEN_PREFIX + 1, "%0*u", NETPERF_LEN_PREFIX, cchParams);
+    szBuf[NETPERF_LEN_PREFIX] = g_szStartParams[0];
+    Assert(strlen(szBuf) == NETPERF_LEN_PREFIX + cchParams);
+    rc = RTTcpWrite(hSocket, szBuf, NETPERF_LEN_PREFIX + cchParams);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to send connection parameters: %Rrc\n", rc);
+
+    /*
+     * Wait for acknowledgment.
+     */
+    rc = RTTcpRead(hSocket, szBuf, sizeof(g_szAck) - 1, NULL);
+    if (RT_FAILURE(rc))
+        return RTTestIFailedRc(rc, "Failed to send parameters: %Rrc\n", rc);
+    szBuf[sizeof(g_szAck) - 1] = '\0';
+
+    if (!strcmp(szBuf, g_szNegative))
+        return RTTestIFailedRc(VERR_NET_PROTOCOL_ERROR, "Server failed to accept packet size of %u bytes.\n", pParams->cbPacket);
+    if (strcmp(szBuf, g_szAck))
+        return RTTestIFailedRc(VERR_NET_PROTOCOL_ERROR, "Invalid response from server '%s'\n", szBuf);
+
+    /*
+     * Take action according to our mode.
+     */
+    switch (pParams->enmMode)
+    {
+        case NETPERFMODE_LATENCY:
+            RTTestIPrintf(RTTESTLVL_ALWAYS, "Connected to %s port %u, running the latency test for %u seconds.\n",
+                          pszServer, pParams->uPort, pParams->cSecTimeout);
+            rc = netperfTCPClientDoLatency(pParams);
+            break;
+
+        case NETPERFMODE_THROUGHPUT:
+            RTTestIPrintf(RTTESTLVL_ALWAYS, "Connected to %s port %u, running the throughput test for %u seconds in each direction.\n",
+                          pszServer, pParams->uPort, pParams->cSecTimeout);
+            rc = netperfTCPClientDoThroughput(pParams);
+            break;
+
+        case NETPERFMODE_THROUGHPUT_XMIT:
+            RTTestIPrintf(RTTESTLVL_ALWAYS, "Connected to %s port %u, running the throughput-xmit test for %u seconds.\n",
+                          pszServer, pParams->uPort, pParams->cSecTimeout);
+            rc = netperfTCPClientDoThroughputXmit(pParams);
+            break;
+
+        case NETPERFMODE_THROUGHPUT_RECV:
+            RTTestIPrintf(RTTESTLVL_ALWAYS, "Connected to %s port %u, running the throughput-recv test for %u seconds.\n",
+                          pszServer, pParams->uPort, pParams->cSecTimeout);
+            rc = netperfTCPClientDoThroughputRecv(pParams);
+            break;
+
+        case NETPERFMODE_INVALID:
+            rc = VERR_INTERNAL_ERROR;
+            break;
+
+        /* no default! */
+    }
+    return rc;
+}
+
+/**
+ * The client part.
+ *
+ * @returns Exit code.
+ * @param   enmProto            The protocol.
+ * @param   pParams             The parameter block.
+ */
+static RTEXITCODE netperfClient(NETPERFPROTO enmProto, const char *pszServer, void *pvUser)
+{
+    switch (enmProto)
+    {
+        case NETPERFPROTO_TCP:
+        {
+            NETPERFPARAMS *pParams = (NETPERFPARAMS *)pvUser;
+            int rc = netperfTCPClient(pszServer, pParams);
+            if (pParams->hSocket != NIL_RTSOCKET)
+            {
+                RTTcpClientClose(pParams->hSocket);
+                pParams->hSocket = NIL_RTSOCKET;
+            }
+            return RT_SUCCESS(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
+        }
+
+        default:
+            RTTestIFailed("Protocol not supported.\n", g_pStdErr);
+            return RTEXITCODE_FAILURE;
+    }
+}
+
+
+int main(int argc, char *argv[])
+{
+    /*
+     * Init IPRT and globals.
+     */
+    int rc = RTTestInitAndCreate("NetPerf", &g_hTest);
+    if (rc)
+        return rc;
+
+    /*
+     * Special case.
+     */
+    if (argc < 2)
+    {
+        RTTestFailed(g_hTest, "No arguments given.");
+        return RTTestSummaryAndDestroy(g_hTest);
+    }
+
+    /*
+     * Default values.
+     */
+    NETPERFPROTO        enmProtocol     = NETPERFPROTO_TCP;
+    bool                fServer         = true;
+    bool                fDaemonize      = false;
+    bool                fDaemonized     = false;
+    bool                fPacketSizeSet  = false;
+    const char         *pszServerAddress= NULL;
+    NETPERFPARAMS       Params;
+
+    Params.uPort            = NETPERF_DEFAULT_PORT;
+    Params.fServerStats     = false;
+    Params.fSingleClient    = false;
+
+    Params.fNoDelay         = false;
+    Params.fCheckData       = false;
+    Params.enmMode          = NETPERFMODE_LATENCY;
+    Params.cSecTimeout      = NETPERF_DEFAULT_TIMEOUT;
+    Params.cMsWarmup        = NETPERF_DEFAULT_WARMUP;
+    Params.cMsCoolDown      = NETPERF_DEFAULT_COOL_DOWN;
+    Params.cbPacket         = NETPERF_DEFAULT_PKT_SIZE_LATENCY;
+
+    Params.hSocket          = NIL_RTSOCKET;
+
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, g_aCmdOptions, RT_ELEMENTS(g_aCmdOptions), 1, 0 /* fFlags */);
+    while ((rc = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (rc)
+        {
+            case 's':
+                fServer = true;
+                break;
+
+            case 'c':
+                fServer = false;
+                pszServerAddress = ValueUnion.psz;
+                break;
+
+            case 'd':
+                fDaemonize = true;
+                break;
+
+            case 'D':
+                fDaemonized = true;
+                break;
+
+            case 'i':
+                Params.cSecTimeout = ValueUnion.u32;
+                if (   Params.cSecTimeout < NETPERF_MIN_TIMEOUT
+                    || Params.cSecTimeout > NETPERF_MAX_TIMEOUT)
+                {
+                    RTTestFailed(g_hTest, "Invalid interval %u s, valid range: %u-%u\n",
+                                 Params.cbPacket, NETPERF_MIN_TIMEOUT, NETPERF_MAX_TIMEOUT);
+                    return RTTestSummaryAndDestroy(g_hTest);
+                }
+                break;
+
+            case 'l':
+                Params.cbPacket = ValueUnion.u32;
+                if (    Params.cbPacket < NETPERF_MIN_PKT_SIZE
+                     || Params.cbPacket > NETPERF_MAX_PKT_SIZE)
+                {
+                    RTTestFailed(g_hTest, "Invalid packet size %u bytes, valid range: %u-%u\n",
+                                 Params.cbPacket, NETPERF_MIN_PKT_SIZE, NETPERF_MAX_PKT_SIZE);
+                    return RTTestSummaryAndDestroy(g_hTest);
+                }
+                fPacketSizeSet = true;
+                break;
+
+            case 'm':
+                Params.enmMode = netperfModeFromString(ValueUnion.psz);
+                if (Params.enmMode == NETPERFMODE_INVALID)
+                {
+                    RTTestFailed(g_hTest, "Invalid test mode: \"%s\"\n", ValueUnion.psz);
+                    return RTTestSummaryAndDestroy(g_hTest);
+                }
+                if (!fPacketSizeSet)
+                    switch (Params.enmMode)
+                    {
+                        case NETPERFMODE_LATENCY:
+                            Params.cbPacket = NETPERF_DEFAULT_PKT_SIZE_LATENCY;
+                            break;
+                        case NETPERFMODE_THROUGHPUT:
+                        case NETPERFMODE_THROUGHPUT_XMIT:
+                        case NETPERFMODE_THROUGHPUT_RECV:
+                            Params.cbPacket = NETPERF_DEFAULT_PKT_SIZE_THROUGHPUT;
+                            break;
+                        case NETPERFMODE_INVALID:
+                            break;
+                        /* no default! */
+                    }
+                break;
+
+            case 'p':
+                Params.uPort = ValueUnion.u32;
+                break;
+
+            case 'N':
+                Params.fNoDelay = true;
+                break;
+
+            case 'S':
+                Params.fServerStats = true;
+                break;
+
+            case '1':
+                Params.fSingleClient = true;
+                break;
+
+            case 'h':
+                Usage(g_pStdOut);
+                return RTEXITCODE_SUCCESS;
+
+            case 'V':
+                RTPrintf("$Revision: 96152 $\n");
+                return RTEXITCODE_SUCCESS;
+
+            case 'w':
+                Params.cMsWarmup = ValueUnion.u32;
+                if (   Params.cMsWarmup < NETPERF_MIN_WARMUP
+                    || Params.cMsWarmup > NETPERF_MAX_WARMUP)
+                {
+                    RTTestFailed(g_hTest, "invalid warmup time %u ms, valid range: %u-%u\n",
+                                 Params.cMsWarmup, NETPERF_MIN_WARMUP, NETPERF_MAX_WARMUP);
+                    return RTTestSummaryAndDestroy(g_hTest);
+                }
+                break;
+
+            case 'W':
+                Params.cMsCoolDown = ValueUnion.u32;
+                if (   Params.cMsCoolDown < NETPERF_MIN_COOL_DOWN
+                    || Params.cMsCoolDown > NETPERF_MAX_COOL_DOWN)
+                {
+                    RTTestFailed(g_hTest, "invalid cool down time %u ms, valid range: %u-%u\n",
+                                 Params.cMsCoolDown, NETPERF_MIN_COOL_DOWN, NETPERF_MAX_COOL_DOWN);
+                    return RTTestSummaryAndDestroy(g_hTest);
+                }
+                break;
+
+            case 'C':
+                Params.fCheckData = true;
+                break;
+
+            default:
+                return RTGetOptPrintError(rc, &ValueUnion);
+        }
+    }
+
+    /*
+     * Handle the server process daemoniziation.
+     */
+    if (fDaemonize && !fDaemonized && fServer)
+    {
+        rc = RTProcDaemonize(argv, "--daemonized");
+        if (RT_FAILURE(rc))
+            return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTProcDaemonize failed: %Rrc\n", rc);
+        return RTEXITCODE_SUCCESS;
+    }
+
+    /*
+     * Get down to business.
+     */
+    RTTestBanner(g_hTest);
+    if (fServer)
+        rc = netperfServer(enmProtocol, &Params);
+    else if (pszServerAddress)
+        rc = netperfClient(enmProtocol, pszServerAddress, &Params);
+    else
+        RTTestFailed(g_hTest, "missing server address to connect to\n");
+
+    RTEXITCODE rc2 = RTTestSummaryAndDestroy(g_hTest);
+    return rc2 != RTEXITCODE_FAILURE ? (RTEXITCODE)rc2 : rc;
+}
+
diff --git a/src/VBox/ValidationKit/utils/nt/Makefile.kmk b/src/VBox/ValidationKit/utils/nt/Makefile.kmk
new file mode 100644
index 0000000..950e829
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/nt/Makefile.kmk
@@ -0,0 +1,45 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - Windows NT Specific Utilities.
+#
+
+#
+# Copyright (C) 2010-2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# Set Clock Frequency Utility.
+#
+PROGRAMS.win += ntSetFreq
+ntSetFreq_TEMPLATE = VBoxValidationKitR3
+ntSetFreq_SOURCES  = ntsetfreq.cpp
+
+#
+# Test coherency among NT time sources.
+#
+PROGRAMS.win += ntTimeSources
+ntTimeSources_TEMPLATE = VBoxValidationKitR3
+ntTimeSources_SOURCES  = nttimesources.cpp
+
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/utils/nt/ntsetfreq.cpp b/src/VBox/ValidationKit/utils/nt/ntsetfreq.cpp
new file mode 100644
index 0000000..d5bf574
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/nt/ntsetfreq.cpp
@@ -0,0 +1,158 @@
+/* $Id: ntsetfreq.cpp $ */
+/** @file
+ * Set the NT timer frequency.
+ */
+
+/*
+ * Copyright (C) 2007-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define _WIN32_WINNT 0x0500
+#include <Windows.h>
+
+#include <iprt/initterm.h>
+#include <iprt/getopt.h>
+#include <iprt/message.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/thread.h>
+#include <iprt/err.h>
+
+RT_C_DECLS_BEGIN
+/* from sysinternals. */
+NTSYSAPI LONG NTAPI NtSetTimerResolution(IN ULONG DesiredResolution, IN BOOLEAN SetResolution, OUT PULONG CurrentResolution);
+NTSYSAPI LONG NTAPI NtQueryTimerResolution(OUT PULONG MinimumResolution, OUT PULONG MaximumResolution, OUT PULONG CurrentResolution);
+RT_C_DECLS_END
+
+
+
+int main(int argc, char **argv)
+{
+    int rc = RTR3InitExe(argc, &argv, 0);
+    if (RT_FAILURE(rc))
+        return RTMsgInitFailure(rc);
+
+    /*
+     * Parse arguments.
+     */
+    bool        fVerbose   = true;
+    uint32_t    u32NewRes  = 0;
+    uint32_t    cSecsSleep = UINT32_MAX;
+
+    static const RTGETOPTDEF s_aOptions[] =
+    {
+        { "--resolution",  'r', RTGETOPT_REQ_UINT32 },
+        { "--sleep",       's', RTGETOPT_REQ_UINT32 },
+        { "--quiet",       'q', RTGETOPT_REQ_NOTHING },
+        { "--verbose",     'v', RTGETOPT_REQ_NOTHING },
+    };
+
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0);
+    while ((rc = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (rc)
+        {
+            case 'r':
+                u32NewRes = ValueUnion.u32;
+                if (u32NewRes > 16*10000 /* 16 ms */ || u32NewRes < 1000 /* 100 microsec */)
+                    return RTMsgErrorExit(RTEXITCODE_SYNTAX,
+                                          "syntax error: the new timer resolution (%RU32) is out of range\n",
+                                          u32NewRes);
+                break;
+
+            case 's':
+                cSecsSleep = ValueUnion.u32;
+                break;
+
+            case 'q':
+                fVerbose = false;
+                break;
+
+            case 'v':
+                fVerbose = true;
+                break;
+
+            case 'h':
+                RTPrintf("Usage: ntsetfreq [-q|--quiet] [-v|--verbose] [-r|--resolution <100ns>] [-s|--sleep <1s>]\n");
+                return RTEXITCODE_SUCCESS;
+
+            default:
+                return RTGetOptPrintError(rc, &ValueUnion);
+        }
+    }
+
+
+    /*
+     * Query the current resolution.
+     */
+    ULONG   Cur = ~0;
+    ULONG   Min = ~0;
+    ULONG   Max = ~0;
+    LONG    Status;
+    if (fVerbose || !u32NewRes)
+    {
+        Status = NtQueryTimerResolution(&Min, &Max, &Cur);
+        if (Status >= 0)
+            RTMsgInfo("cur: %u (%u.%02u Hz)  min: %u (%u.%02u Hz)  max: %u (%u.%02u Hz)\n",
+                      Cur, 10000000 / Cur, (10000000 / (Cur * 100)) % 100,
+                      Min, 10000000 / Min, (10000000 / (Min * 100)) % 100,
+                      Max, 10000000 / Max, (10000000 / (Max * 100)) % 100);
+        else
+            RTMsgError("NTQueryTimerResolution failed with status %#x\n", Status);
+    }
+
+    if (u32NewRes)
+    {
+        Status = NtSetTimerResolution(u32NewRes, TRUE, &Cur);
+        if (Status < 0)
+            RTMsgError("NTSetTimerResolution(%RU32,,) failed with status %#x\n", u32NewRes, Status);
+        else if (fVerbose)
+        {
+            Cur = Min = Max = ~0;
+            Status = NtQueryTimerResolution(&Min, &Max, &Cur);
+            if (Status >= 0)
+                RTMsgInfo("new: %u (%u.%02u Hz) requested %RU32 (%u.%02u Hz)\n",
+                          Cur, 10000000 / Cur, (10000000 / (Cur * 100)) % 100,
+                          u32NewRes, 10000000 / u32NewRes, (10000000 / (u32NewRes * 100)) % 100);
+            else
+                RTMsgError("NTSetTimerResolution succeeded but the NTQueryTimerResolution call failed with status %#x (ignored)\n", Status);
+            Status = 0;
+        }
+    }
+
+    if (u32NewRes && Status >= 0)
+    {
+        if (cSecsSleep == UINT32_MAX)
+            for (;;)
+                RTThreadSleep(RT_INDEFINITE_WAIT);
+        else
+            while (cSecsSleep-- > 0)
+                RTThreadSleep(1000);
+    }
+
+    return Status >= 0 ? 0 : 1;
+}
+
diff --git a/src/VBox/ValidationKit/utils/nt/nttimesources.cpp b/src/VBox/ValidationKit/utils/nt/nttimesources.cpp
new file mode 100644
index 0000000..e2d1d61
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/nt/nttimesources.cpp
@@ -0,0 +1,234 @@
+/* $Id: nttimesources.cpp $ */
+/** @file
+ * Check the various time sources on Windows NT.
+ */
+
+/*
+ * Copyright (C) 2009-2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <Windows.h>
+
+#include <iprt/asm.h>
+#include <iprt/asm-amd64-x86.h>
+#include <iprt/err.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+typedef struct _MY_KSYSTEM_TIME
+{
+    ULONG LowPart;
+    LONG High1Time;
+    LONG High2Time;
+} MY_KSYSTEM_TIME;
+
+typedef struct _MY_KUSER_SHARED_DATA
+{
+    ULONG TickCountLowDeprecated;
+    ULONG TickCountMultiplier;
+    volatile MY_KSYSTEM_TIME InterruptTime;
+    volatile MY_KSYSTEM_TIME SystemTime;
+    volatile MY_KSYSTEM_TIME TimeZoneBias;
+    /* The rest is not relevant. */
+} MY_KUSER_SHARED_DATA;
+
+/** The fixed pointer to the user shared data. */
+#define MY_USER_SHARED_DATA ((MY_KUSER_SHARED_DATA *)0x7ffe0000)
+
+/** Spins until GetTickCount() changes. */
+static void SpinUntilTick(void)
+{
+    /* spin till GetTickCount changes. */
+    DWORD dwMsTick = GetTickCount();
+    while (GetTickCount() == dwMsTick)
+        /* nothing */;
+}
+
+/** Delay function that tries to return right after GetTickCount changed. */
+static void DelayMillies(DWORD dwMsStart, DWORD cMillies)
+{
+    /* Delay cMillies - 1. */
+    Sleep(cMillies - 1);
+    while (GetTickCount() - dwMsStart < cMillies - 1U)
+        Sleep(1);
+
+    SpinUntilTick();
+}
+
+
+int main(int argc, char **argv)
+{
+    /*
+     * Init, create a test instance and "parse" arguments.
+     */
+    RTTEST hTest;
+    int rc = RTTestInitAndCreate("nttimesources", &hTest);
+    if (rc)
+        return rc;
+    if (argc > 1)
+    {
+        RTTestFailed(hTest, "Syntax error! no arguments expected");
+        return RTTestSummaryAndDestroy(hTest);
+    }
+
+    /*
+     * Guess MHz using GetTickCount.
+     */
+    RTTestSub(hTest, "Guess MHz");
+    DWORD       dwTickStart, dwTickEnd, cMsTicks;
+    uint64_t    u64TscStart, u64TscEnd, cTscTicks;
+
+    /* get a good start time. */
+    SpinUntilTick();
+    do
+    {
+        dwTickStart = GetTickCount();
+        ASMCompilerBarrier();
+        ASMSerializeInstruction();
+        u64TscStart = ASMReadTSC();
+        ASMCompilerBarrier();
+    } while (GetTickCount() != dwTickStart);
+
+    /* delay a good while. */
+    DelayMillies(dwTickStart, 256);
+
+    /* get a good end time. */
+    do
+    {
+        dwTickEnd = GetTickCount();
+        ASMCompilerBarrier();
+        ASMSerializeInstruction();
+        u64TscEnd = ASMReadTSC();
+        ASMCompilerBarrier();
+    } while (GetTickCount() != dwTickEnd);
+    cMsTicks  = dwTickEnd - dwTickStart;
+    cTscTicks = u64TscEnd - u64TscStart;
+
+    /* Calc an approximate TSC frequency:
+            cTscTicks / uTscHz = cMsTicks / 1000
+                    1 / uTscHz = (cMsTicks / 1000) / cTscTicks
+                        uTscHz = cTscTicks / (cMsTicks / 1000) */
+    uint64_t u64TscHz = (long double)cTscTicks / ((long double)cMsTicks / 1000.0);
+    if (    u64TscHz > _1M*3
+        &&  u64TscHz < _1T)
+        RTTestPrintf(hTest,  RTTESTLVL_ALWAYS,  "u64TscHz=%'llu", u64TscHz);
+    else
+    {
+        RTTestFailed(hTest, "u64TscHz=%'llu - out of range", u64TscHz);
+        u64TscHz = 0;
+    }
+
+
+    /*
+     * Pit GetTickCount, InterruptTime, Performance Counters and TSC against each other.
+     */
+    LARGE_INTEGER PrfHz;
+    LARGE_INTEGER PrfStart, PrfEnd, cPrfTicks;
+    LARGE_INTEGER IntStart, IntEnd, cIntTicks;
+    for (uint32_t i = 0; i < 7; i++)
+    {
+        RTTestSubF(hTest, "The whole bunch - pass #%u", i + 1);
+
+        if (!QueryPerformanceFrequency(&PrfHz))
+        {
+            RTTestFailed(hTest, "QueryPerformanceFrequency failed (%u)", GetLastError());
+            return RTTestSummaryAndDestroy(hTest);
+        }
+
+        /* get a good start time. */
+        SpinUntilTick();
+        do
+        {
+            IntStart.HighPart = MY_USER_SHARED_DATA->InterruptTime.High1Time;
+            IntStart.LowPart  = MY_USER_SHARED_DATA->InterruptTime.LowPart;
+            dwTickStart = GetTickCount();
+            if (!QueryPerformanceCounter(&PrfStart))
+            {
+                RTTestFailed(hTest, "QueryPerformanceCounter failed (%u)", GetLastError());
+                return RTTestSummaryAndDestroy(hTest);
+            }
+            ASMCompilerBarrier();
+            ASMSerializeInstruction();
+            u64TscStart = ASMReadTSC();
+            ASMCompilerBarrier();
+        } while (   MY_USER_SHARED_DATA->InterruptTime.High2Time != IntStart.HighPart
+                 || MY_USER_SHARED_DATA->InterruptTime.LowPart   != IntStart.LowPart
+                 || GetTickCount() != dwTickStart);
+
+        /* delay a good while. */
+        DelayMillies(dwTickStart, 256);
+
+        /* get a good end time. */
+        do
+        {
+            IntEnd.HighPart = MY_USER_SHARED_DATA->InterruptTime.High1Time;
+            IntEnd.LowPart  = MY_USER_SHARED_DATA->InterruptTime.LowPart;
+            dwTickEnd = GetTickCount();
+            if (!QueryPerformanceCounter(&PrfEnd))
+            {
+                RTTestFailed(hTest, "QueryPerformanceCounter failed (%u)", GetLastError());
+                return RTTestSummaryAndDestroy(hTest);
+            }
+            ASMCompilerBarrier();
+            ASMSerializeInstruction();
+            u64TscEnd = ASMReadTSC();
+            ASMCompilerBarrier();
+        } while (   MY_USER_SHARED_DATA->InterruptTime.High2Time != IntEnd.HighPart
+                 || MY_USER_SHARED_DATA->InterruptTime.LowPart   != IntEnd.LowPart
+                 || GetTickCount() != dwTickEnd);
+
+        cMsTicks           = dwTickEnd - dwTickStart;
+        cTscTicks          = u64TscEnd - u64TscStart;
+        cIntTicks.QuadPart = IntEnd.QuadPart - IntStart.QuadPart;
+        cPrfTicks.QuadPart = PrfEnd.QuadPart - PrfStart.QuadPart;
+
+        /* Recalc to micro seconds. */
+        uint64_t u64MicroSecMs  = (uint64_t)cMsTicks * 1000;
+        uint64_t u64MicroSecTsc = u64TscHz ? (long double)cTscTicks /       u64TscHz * 1000000 : u64MicroSecMs;
+        uint64_t u64MicroSecInt = cIntTicks.QuadPart / 10; /* 100ns units*/
+        uint64_t u64MicroSecPrf =   (long double)cPrfTicks.QuadPart / PrfHz.QuadPart * 1000000;
+
+        /* check how much they differ using the millisecond tick count as the standard candle. */
+        RTTestPrintf(hTest, RTTESTLVL_ALWAYS, " %9llu / %7lld us - GetTickCount\n", u64MicroSecMs, 0);
+
+        int64_t off = u64MicroSecTsc - u64MicroSecMs;
+        RTTestPrintf(hTest, RTTESTLVL_ALWAYS, " %9llu / %7lld us - TSC\n", u64MicroSecTsc, off);
+        RTTEST_CHECK(hTest, RT_ABS(off) < 50000 /*us*/); /* some extra uncertainty with TSC.  */
+
+        off = u64MicroSecInt - u64MicroSecMs;
+        RTTestPrintf(hTest, RTTESTLVL_ALWAYS, " %9llu / %7lld us - InterruptTime\n", u64MicroSecInt, off);
+        RTTEST_CHECK(hTest, RT_ABS(off) < 25000 /*us*/);
+
+        off = u64MicroSecPrf - u64MicroSecMs;
+        RTTestPrintf(hTest, RTTESTLVL_ALWAYS, " %9llu / %7lld us - QueryPerformanceCounter\n", u64MicroSecPrf, off);
+        RTTEST_CHECK(hTest, RT_ABS(off) < 25000 /*us*/);
+    }
+
+    return RTTestSummaryAndDestroy(hTest);
+}
+
diff --git a/src/VBox/ValidationKit/utils/usb/Makefile.kmk b/src/VBox/ValidationKit/utils/usb/Makefile.kmk
new file mode 100644
index 0000000..db7433b
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/usb/Makefile.kmk
@@ -0,0 +1,39 @@
+# $Id: Makefile.kmk $
+## @file
+# VirtualBox Validation Kit - USB test helpers.
+#
+
+#
+# Copyright (C) 2014 Oracle Corporation
+#
+# This file is part of VirtualBox Open Source Edition (OSE), as
+# available from http://www.virtualbox.org. This file is free software;
+# you can redistribute it and/or modify it under the terms of the GNU
+# General Public License (GPL) as published by the Free Software
+# Foundation, in version 2 as it comes in the "COPYING" file of the
+# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+#
+# The contents of this file may alternatively be used under the terms
+# of the Common Development and Distribution License Version 1.0
+# (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+# VirtualBox OSE distribution, in which case the provisions of the
+# CDDL are applicable instead of those of the GPL.
+#
+# You may elect to license modified versions of this file under the
+# terms and conditions of either the GPL or the CDDL or both.
+#
+
+SUB_DEPTH = ../../../../..
+include $(KBUILD_PATH)/subheader.kmk
+
+#
+# USB Linux test frontend.
+#
+PROGRAMS += UsbTest
+UsbTest_TEMPLATE = VBoxValidationKitR3
+UsbTest_SOURCES  = UsbTest.cpp
+
+$(evalcall def_vbox_validationkit_process_python_sources)
+include $(FILE_KBUILD_SUB_FOOTER)
+
diff --git a/src/VBox/ValidationKit/utils/usb/UsbTest.cpp b/src/VBox/ValidationKit/utils/usb/UsbTest.cpp
new file mode 100644
index 0000000..26b8dd3
--- /dev/null
+++ b/src/VBox/ValidationKit/utils/usb/UsbTest.cpp
@@ -0,0 +1,371 @@
+/* $Id: UsbTest.cpp $ */
+/** @file
+ * UsbTest - User frontend for the Linux usbtest USB test and benchmarking module.
+ *           Integrates with our test framework for nice outputs.
+ */
+
+/*
+ * Copyright (C) 2014 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#include <iprt/err.h>
+#include <iprt/getopt.h>
+#include <iprt/path.h>
+#include <iprt/param.h>
+#include <iprt/process.h>
+#include <iprt/stream.h>
+#include <iprt/string.h>
+#include <iprt/test.h>
+#include <iprt/file.h>
+
+#include <unistd.h>
+#include <errno.h>
+#include <limits.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <sys/ioctl.h>
+#include <linux/usbdevice_fs.h>
+
+/*******************************************************************************
+*   Defined Constants And Macros                                               *
+*******************************************************************************/
+
+/** Number of tests implemented at the moment. */
+#define USBTEST_TEST_CASES      25
+
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
+
+/**
+ * USB test request data.
+ * There is no public header with this information so we define it ourself here.
+ */
+typedef struct USBTESTPARMS
+{
+    /** Specifies the test to run. */
+    uint32_t        idxTest;
+    /** How many iterations the test should be executed. */
+    uint32_t        cIterations;
+    /** Size of the data packets. */
+    uint32_t        cbData;
+    /** Size of  */
+    uint32_t        cbVariation;
+    /** Length of the S/G list for the test. */
+    uint32_t        cSgLength;
+    /** Returned time data after completing the test. */
+    struct timeval  TimeTest;
+} USBTESTPARAMS;
+/** Pointer to a test parameter structure. */
+typedef USBTESTPARAMS *PUSBTESTPARAMS;
+
+/**
+ * USB device descriptor. Used to search for the test device based
+ * on the vendor and product id.
+ */
+#pragma pack(1)
+typedef struct USBDEVDESC
+{
+    uint8_t  bLength;
+    uint8_t  bDescriptorType;
+    uint16_t bcdUSB;
+    uint8_t  bDeviceClass;
+    uint8_t  bDeviceSubClass;
+    uint8_t  bDeviceProtocol;
+    uint8_t  bMaxPacketSize0;
+    uint16_t idVendor;
+    uint16_t idProduct;
+    uint16_t bcdDevice;
+    uint8_t  iManufacturer;
+    uint8_t  iProduct;
+    uint8_t  iSerialNumber;
+    uint8_t  bNumConfigurations;
+} USBDEVDESC;
+#pragma pack()
+
+#define USBTEST_REQUEST _IOWR('U', 100, USBTESTPARMS)
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+
+/** Command line parameters */
+static const RTGETOPTDEF g_aCmdOptions[] =
+{
+    {"--device",           'd', RTGETOPT_REQ_STRING },
+    {"--help",             'h', RTGETOPT_REQ_NOTHING}
+};
+
+/** (Sort of) Descriptive test descriptions. */
+static const char *g_apszTests[] =
+{
+    "NOP",
+    "Non-queued Bulk write",
+    "Non-queued Bulk read",
+    "Non-queued Bulk write variabe size",
+    "Non-queued Bulk read variabe size",
+    "Queued Bulk write",
+    "Queued Bulk read",
+    "Queued Bulk write variabe size",
+    "Queued Bulk read variabe size",
+    "Chapter 9 Control Test",
+    "Queued control messaging",
+    "Unlink reads",
+    "Unlink writes",
+    "Set/Clear halts",
+    "Control writes",
+    "Isochronous write",
+    "Isochronous read",
+    "Bulk write unaligned (DMA)",
+    "Bulk read unaligned (DMA)",
+    "Bulk write unaligned (no DMA)",
+    "Bulk read unaligned (no DMA)",
+    "Control writes unaligned",
+    "Isochronous write unaligned",
+    "Isochronous read unaligned",
+    "Unlink queued Bulk"
+};
+AssertCompile(RT_ELEMENTS(g_apszTests) == USBTEST_TEST_CASES);
+
+/** The test handle. */
+static RTTEST g_hTest;
+
+
+static void usbTestUsage(PRTSTREAM pStrm)
+{
+    char szExec[RTPATH_MAX];
+    RTStrmPrintf(pStrm, "usage: %s [options]\n",
+                 RTPathFilename(RTProcGetExecutablePath(szExec, sizeof(szExec))));
+    RTStrmPrintf(pStrm, "\n");
+    RTStrmPrintf(pStrm, "options: \n");
+
+
+    for (unsigned i = 0; i < RT_ELEMENTS(g_aCmdOptions); i++)
+    {
+        const char *pszHelp;
+        switch (g_aCmdOptions[i].iShort)
+        {
+            case 'h':
+                pszHelp = "Displays this help and exit";
+                break;
+            case 'd':
+                pszHelp = "Use the specified test device";
+                break;
+            default:
+                pszHelp = "Option undocumented";
+                break;
+        }
+        char szOpt[256];
+        RTStrPrintf(szOpt, sizeof(szOpt), "%s, -%c", g_aCmdOptions[i].pszLong, g_aCmdOptions[i].iShort);
+        RTStrmPrintf(pStrm, "  %-20s%s\n", szOpt, pszHelp);
+    }
+}
+
+/**
+ * Search for a USB test device and return the device path.
+ *
+ * @returns Path to the USB test device or NULL if none was found.
+ */
+static char *usbTestFindDevice(void)
+{
+    /*
+     * Very crude and quick way to search for the correct test device.
+     * Assumption is that the path looks like /dev/bus/usb/%3d/%3d.
+     */
+    uint8_t uBus = 1;
+    bool fBusExists = false;
+    char aszDevPath[64];
+
+    RT_ZERO(aszDevPath);
+
+    do
+    {
+        RTStrPrintf(aszDevPath, sizeof(aszDevPath), "/dev/bus/usb/%03d", uBus);
+
+        fBusExists = RTPathExists(aszDevPath);
+
+        if (fBusExists)
+        {
+            /* Check every device. */
+            bool fDevExists = false;
+            uint8_t uDev = 1;
+
+            do
+            {
+                RTStrPrintf(aszDevPath, sizeof(aszDevPath), "/dev/bus/usb/%03d/%03d", uBus, uDev);
+
+                fDevExists = RTPathExists(aszDevPath);
+
+                if (fDevExists)
+                {
+                    RTFILE hFileDev;
+                    int rc = RTFileOpen(&hFileDev, aszDevPath, RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE);
+                    if (RT_SUCCESS(rc))
+                    {
+                        USBDEVDESC DevDesc;
+
+                        rc = RTFileRead(hFileDev, &DevDesc, sizeof(DevDesc), NULL);
+                        RTFileClose(hFileDev);
+
+                        if (   RT_SUCCESS(rc)
+                            && DevDesc.idVendor == 0x0525
+                            && DevDesc.idProduct == 0xa4a0)
+                            return RTStrDup(aszDevPath);
+                    }
+                }
+
+                uDev++;
+            } while (fDevExists);
+        }
+
+        uBus++;
+    } while (fBusExists);
+
+    return NULL;
+}
+
+static int usbTestIoctl(int iDevFd, int iInterface, PUSBTESTPARAMS pParams)
+{
+    struct usbdevfs_ioctl IoCtlData;
+
+    IoCtlData.ifno = iInterface;
+    IoCtlData.ioctl_code = (int)USBTEST_REQUEST;
+    IoCtlData.data = pParams;
+    return ioctl(iDevFd, USBDEVFS_IOCTL, &IoCtlData);
+}
+
+/**
+ * Test execution worker.
+ *
+ * @returns nothing.
+ * @param   pszDevice    The device to use for testing.
+ */
+static void usbTestExec(const char *pszDevice)
+{
+    int iDevFd;
+
+    RTTestSub(g_hTest, "Opening device");
+    iDevFd = open(pszDevice, O_RDWR);
+    if (iDevFd != -1)
+    {
+        USBTESTPARAMS Params;
+
+        RTTestPassed(g_hTest, "Opening device successful\n");
+
+        /*
+         * Fill params with some defaults.
+         * @todo: Make them configurable.
+         */
+        Params.cIterations = 1000;
+        Params.cbData = 512;
+        Params.cbVariation = 512;
+        Params.cSgLength = 32;
+
+        for (unsigned i = 0; i < USBTEST_TEST_CASES; i++)
+        {
+            RTTestSub(g_hTest, g_apszTests[i]);
+
+            Params.idxTest = i;
+
+            /* Assume the test interface has the number 0 for now. */
+            int rcPosix = usbTestIoctl(iDevFd, 0, &Params);
+            if (rcPosix < 0 && errno == EOPNOTSUPP)
+            {
+                RTTestSkipped(g_hTest, "Not supported");
+                continue;
+            }
+
+            if (rcPosix < 0)
+                RTTestFailed(g_hTest, "Test failed with %Rrc\n", RTErrConvertFromErrno(errno));
+            else
+            {
+                uint64_t u64Ns = Params.TimeTest.tv_sec * RT_NS_1SEC + Params.TimeTest.tv_usec * RT_NS_1US;
+                RTTestValue(g_hTest, "Runtime", u64Ns, RTTESTUNIT_NS);
+            }
+            RTTestSubDone(g_hTest);
+        }
+
+        close(iDevFd);
+    }
+    else
+        RTTestFailed(g_hTest, "Opening device failed with %Rrc\n", RTErrConvertFromErrno(errno));
+
+}
+
+int main(int argc, char *argv[])
+{
+    /*
+     * Init IPRT and globals.
+     */
+    int rc = RTTestInitAndCreate("UsbTest", &g_hTest);
+    if (rc)
+        return rc;
+
+    /*
+     * Default values.
+     */
+    const char *pszDevice = NULL;
+
+    RTGETOPTUNION ValueUnion;
+    RTGETOPTSTATE GetState;
+    RTGetOptInit(&GetState, argc, argv, g_aCmdOptions, RT_ELEMENTS(g_aCmdOptions), 1, 0 /* fFlags */);
+    while ((rc = RTGetOpt(&GetState, &ValueUnion)))
+    {
+        switch (rc)
+        {
+            case 'h':
+                usbTestUsage(g_pStdOut);
+                return RTEXITCODE_SUCCESS;
+            case 'd':
+                pszDevice = ValueUnion.psz;
+                break;
+            default:
+                return RTGetOptPrintError(rc, &ValueUnion);
+        }
+    }
+
+    /*
+     * Start testing.
+     */
+    RTTestBanner(g_hTest);
+
+    /* Find the first test device if none was given. */
+    if (!pszDevice)
+        pszDevice = usbTestFindDevice();
+
+    if (pszDevice)
+        usbTestExec(pszDevice);
+    else
+    {
+        RTTestPrintf(g_hTest, RTTESTLVL_FAILURE, "Failed to find a test device\n");
+        RTTestErrorInc(g_hTest);
+    }
+
+    RTEXITCODE rcExit = RTTestSummaryAndDestroy(g_hTest);
+    return rcExit;
+}
+
diff --git a/src/VBox/ValidationKit/vms/nt4sp1.txt b/src/VBox/ValidationKit/vms/nt4sp1.txt
new file mode 100644
index 0000000..5f2ee00
--- /dev/null
+++ b/src/VBox/ValidationKit/vms/nt4sp1.txt
@@ -0,0 +1,26 @@
+
+Test VM - nt4sp1 - Windows NT 4 Service Pack 1
+==============================================
+
+Setup:
+ - Configure a VM t-nt4sp1 with default Windows NT 4 settings.  Make sure to
+   configure the disk to 8 GB or higher capacity (2 GB suffices).
+ - Make sure networking is NAT.
+ - Install Windows NT 4 SP 1. Create a user 'test' without a password.
+ - Insert the validation kit ISO and install the test execution service (see
+   vboxtxs-readme.txt). (As Administrator.)
+ - Disable CD autorun:
+      - Start regedit.
+      - Set the value HKLM/System/CurrentControlSet/Services/Cdrom to 0.
+ - Shorten boot menu wait, disable automatic reboot on STOP, make it write a
+   dump:
+      - Right click on "My Computer", select "Properties" and go to the
+        "Startup/Shutdown" tab.
+      - Change the "Show list for" entry field to "1" second.
+      - Uncheck "Automatically reboot".
+      - Check "Write debugging information to".
+      - Check "Overwrite any existing file".
+ - Eject the CD and shut down the VM.
+
+Do  N O T install guest additions!
+
diff --git a/src/VBox/ValidationKit/vms/sol11u1.txt b/src/VBox/ValidationKit/vms/sol11u1.txt
new file mode 100644
index 0000000..2f3ec87
--- /dev/null
+++ b/src/VBox/ValidationKit/vms/sol11u1.txt
@@ -0,0 +1,25 @@
+Test VM - sol11u1 - Solaris 11 update 1
+=======================================
+
+Setup:
+ - Configure a VM t-sol11u1 with the default Solaris 11 settings.
+ - Make sure networking is NAT.
+ - Install Solaris 11 update 1, default user 'test'.
+ - Change the default password policy in /etc/default/passwd:
+      - MINUPPER=0
+      - MINLOWER=0
+      - MAXREPEATS=0
+      - MINSPECIAL=0
+      - MINDIGIT=0
+ - Set the 'root' and 'test' passwords to 'password' (as root
+   run 'passwd root; passwd test').
+ - Insert the validation kit ISO and install the test execution service
+   (see vboxtxs-readme.txt).
+ - Adjust the grub timeout to 1 second.
+ - ?More?
+ - ?More?
+ - ?More?
+ - Eject the CD and shut down the VM.
+
+Do  N O T install guest additions!
+
diff --git a/src/VBox/ValidationKit/vms/xppro.txt b/src/VBox/ValidationKit/vms/xppro.txt
new file mode 100644
index 0000000..6fd6276
--- /dev/null
+++ b/src/VBox/ValidationKit/vms/xppro.txt
@@ -0,0 +1,50 @@
+
+Test VM - xppro - Windows XP Professional
+=========================================
+
+Setup:
+ - Configure a VM t-xppro1 with default Windows XP settings. 2 GB or more disk.
+ - Make sure PAE is disabled.
+ - Make sure networking is NAT.
+ - Install Windows XP Pro.
+ - Create a user 'test' without a password.
+ - Set the password of the 'Administrator' account to 'password'.
+ - Insert the validation kit ISO and install the test execution service (see
+   vboxtxs-readme.txt). (As Administrator.)
+ - Disable non-windows-logo signed driver popups:
+      - Start menu -> Right-click on "My Computer" -> Select Properties.
+      - Go to the Hardware tab and press the Driver Signing button.
+      - Select the "Ignore - Install the software anyway and don't ask for my
+        approval" radio button.
+      - Make sure "Make this action the system default" is checked.
+      - Ok both dialogs.
+      - Redo from start to verify that it actually changed.
+ - Complete disable windows update:
+      - Start menu -> Right-click on "My Computer" -> Select Properties.
+      - Go to the Automatic Updates tab.
+      - Select the "Turn off automatic updating" radio button.
+      - Ok the dialog.
+ - Disable automatic reboot on STOP, make it write a
+   dump:
+      - Right click on "My Computer", select "Properties" and go to the
+        "Advanced" tab and press the "Startupp and Recovery" button.
+      - Make sure the "Time to display list of operating systems" is 1.
+      - Uncheck "Automatically restart".
+      - Select "Kernel memory dump".
+      - Check "Overwrite any existing file".
+      - Ok both dialogs.
+      - Redo from start to verify correctness.
+ - Disable CD autorun. Follow these instructions:
+	http://support.microsoft.com/kb/967715
+ - Disable driver search on Windows Update (will fail bitching about
+   unsigned/unknown publisher of iuident.cab, because we're getting
+   redirected when doing v4 update accesses):
+      - Run/start gpedit.msc.
+      - Navigate to User Configuration -> Administrative Templates -> System.
+      - Change "Configure driver search locations" to "Enabled" and check
+        the "Don't search Windows Update".
+      - Change "Windows Automatic Updates" to "Disabled".
+ - Eject the CD and shut down the VM.
+
+Do  N O T install guest additions!
+
diff --git a/src/bldprogs/VBoxCPP.cpp b/src/bldprogs/VBoxCPP.cpp
index 5e0a567..e6ecdf4 100644
--- a/src/bldprogs/VBoxCPP.cpp
+++ b/src/bldprogs/VBoxCPP.cpp
@@ -5359,7 +5359,7 @@ static RTEXITCODE vbcppParseOptions(PVBCPP pThis, int argc, char **argv, bool *p
             case 'V':
             {
                 /* The following is assuming that svn does it's job here. */
-                static const char s_szRev[] = "$Revision: 96257 $";
+                static const char s_szRev[] = "$Revision: 96254 $";
                 const char *psz = RTStrStripL(strchr(s_szRev, ' '));
                 RTPrintf("r%.*s\n", strchr(psz, ' ') - psz, psz);
                 *pfExit = true;
diff --git a/src/bldprogs/VBoxDef2LazyLoad.cpp b/src/bldprogs/VBoxDef2LazyLoad.cpp
index a513bc8..507db93 100644
--- a/src/bldprogs/VBoxDef2LazyLoad.cpp
+++ b/src/bldprogs/VBoxDef2LazyLoad.cpp
@@ -843,7 +843,7 @@ int main(int argc, char **argv)
             else if (   !strcmp(psz, "--version")
                      || !strcmp(psz, "-V"))
             {
-                printf("$Revision: 98272 $\n");
+                printf("$Revision: 98271 $\n");
                 return RTEXITCODE_SUCCESS;
             }
             else
diff --git a/src/bldprogs/VBoxTpG.cpp b/src/bldprogs/VBoxTpG.cpp
index d7a71c5..672ac32 100644
--- a/src/bldprogs/VBoxTpG.cpp
+++ b/src/bldprogs/VBoxTpG.cpp
@@ -1182,6 +1182,15 @@ static RTEXITCODE generateWrapperHeader(PSCMSTREAM pStrm)
                     else
                         ScmStreamPrintf(pStrm, ", (%s)%M", pArg->pszTracerType, pszFmt, pArg->pszName);
                 }
+                else if (pArg->fType & VTG_TYPE_CONST_CHAR_PTR)
+                {
+                    /* Casting from 'const char *' (probe) to 'char *' (dtrace) is required to shut up warnings. */
+                    pszFmt += sizeof(", ") - 1;
+                    if (RTListNodeIsFirst(&pProbe->ArgHead, &pArg->ListEntry))
+                        ScmStreamPrintf(pStrm, "(char *)%M", pszFmt, pArg->pszName);
+                    else
+                        ScmStreamPrintf(pStrm, ", (char *)%M", pszFmt, pArg->pszName);
+                }
                 else
                 {
                     if (RTListNodeIsFirst(&pProbe->ArgHead, &pArg->ListEntry))
@@ -1652,7 +1661,11 @@ static uint32_t parseTypeExpression(const char *pszType)
     /*
      * Try detect pointers.
      */
-    if (pszType[cchType - 1] == '*')    return VTG_TYPE_POINTER;
+    if (pszType[cchType - 1] == '*')
+    {
+        if (MY_STRMATCH("const char *")) return VTG_TYPE_POINTER | VTG_TYPE_CONST_CHAR_PTR;
+        return VTG_TYPE_POINTER;
+    }
     if (pszType[cchType - 1] == '&')
     {
         RTMsgWarning("Please avoid using references like '%s' for probe arguments!", pszType);
@@ -2312,7 +2325,7 @@ static RTEXITCODE parseArguments(int argc,  char **argv)
             case 'V':
             {
                 /* The following is assuming that svn does it's job here. */
-                static const char s_szRev[] = "$Revision: 87697 $";
+                static const char s_szRev[] = "$Revision: 98008 $";
                 const char *psz = RTStrStripL(strchr(s_szRev, ' '));
                 RTPrintf("r%.*s\n", strchr(psz, ' ') - psz, psz);
                 return RTEXITCODE_SUCCESS;
diff --git a/src/bldprogs/scm.cpp b/src/bldprogs/scm.cpp
index c62884a..f0fb15a 100644
--- a/src/bldprogs/scm.cpp
+++ b/src/bldprogs/scm.cpp
@@ -1540,7 +1540,7 @@ int main(int argc, char **argv)
             case 'V':
             {
                 /* The following is assuming that svn does it's job here. */
-                static const char s_szRev[] = "$Revision: 100061 $";
+                static const char s_szRev[] = "$Revision: 100060 $";
                 const char *psz = RTStrStripL(strchr(s_szRev, ' '));
                 RTPrintf("r%.*s\n", strchr(psz, ' ') - psz, psz);
                 return 0;
diff --git a/src/libs/Makefile.kmk b/src/libs/Makefile.kmk
index efae566..28f1b30 100644
--- a/src/libs/Makefile.kmk
+++ b/src/libs/Makefile.kmk
@@ -32,13 +32,13 @@ if  !defined(VBOX_ONLY_SDK) \
 endif
 
 # PNG support (for screenshots).
-if !defined(VBOX_ONLY_DOCS) && !defined(VBOX_ONLY_SDK) && !defined(VBOX_ONLY_TESTSUITE) \
+if !defined(VBOX_ONLY_DOCS) && !defined(VBOX_ONLY_SDK) && !defined(VBOX_ONLY_VALIDATIONKIT) \
  && "$(SDK_VBOX_LIBPNG_INCS)" == "$(PATH_ROOT)/src/libs/libpng-1.2.8"
  include $(PATH_SUB_CURRENT)/libpng-1.2.8/Makefile.kmk
 endif # !VBOX_ONLY_DOCS
 
 # Libcurl for inet access
-if defined(VBOX_WITH_LIBCURL) && !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS) && !defined(VBOX_ONLY_SDK) && !defined(VBOX_ONLY_TESTSUITE) \
+if defined(VBOX_WITH_LIBCURL) && !defined(VBOX_ONLY_EXTPACKS_USE_IMPLIBS) && !defined(VBOX_ONLY_SDK) && !defined(VBOX_ONLY_VALIDATIONKIT) \
  && "$(SDK_VBOX_LIBCURL_INCS)" == "$(PATH_ROOT)/src/libs/curl-7.42.1/include"
  include $(PATH_SUB_CURRENT)/curl-7.42.1/Makefile.kmk
 endif
@@ -63,7 +63,7 @@ endif
 # Main related things - XPCOM and XSLT.
 if defined(VBOX_WITH_MAIN) \
  && !defined(VBOX_ONLY_EXTPACKS) \
- && !defined(VBOX_ONLY_TESTSUITE)
+ && !defined(VBOX_ONLY_VALIDATIONKIT)
  if defined(VBOX_WITH_XPCOM) && !defined(VBOX_ONLY_DOCS)
   include $(PATH_SUB_CURRENT)/xpcom18a4/Makefile.kmk
  endif
diff --git a/src/libs/xpcom18a4/Config.kmk b/src/libs/xpcom18a4/Config.kmk
index fa068a4..7177b9a 100644
--- a/src/libs/xpcom18a4/Config.kmk
+++ b/src/libs/xpcom18a4/Config.kmk
@@ -236,7 +236,7 @@ TEMPLATE_XPCOMOSX105_DEFS.darwin        = $(filter-out $(VBOX_DARWIN_DEF_SDK_DEF
 TEMPLATE_XPCOMOSX105_INCS.darwin        = $(VBOX_PATH_MACOSX_SDK_10_5)/Developer/Headers/FlatCarbon
 
 #
-# Template for building VBoxPhython against the Mac OS X 10.6 SDK.
+# Template for building VBoxPython against the Mac OS X 10.6 SDK.
 # ASSUMES that the SDK bits are in the .darwin properties we're overriding below.
 #
 TEMPLATE_XPCOMOSX106                    = XPCOM libraries (shared) built against the Mac OS X 10.6 SDK
@@ -248,7 +248,7 @@ TEMPLATE_XPCOMOSX106_DEFS.darwin        = $(filter-out $(VBOX_DARWIN_DEF_SDK_DEF
 TEMPLATE_XPCOMOSX106_INCS.darwin        = $(VBOX_PATH_MACOSX_SDK_10_6)/Developer/Headers/FlatCarbon
 
 #
-# Template for building VBoxPhython against the Mac OS X 10.7 SDK.
+# Template for building VBoxPython against the Mac OS X 10.7 SDK.
 # ASSUMES that the SDK bits are in the .darwin properties we're overriding below.
 #
 TEMPLATE_XPCOMOSX107                    = XPCOM libraries (shared) built against the Mac OS X 10.7 SDK
diff --git a/src/libs/xpcom18a4/Makefile.kmk b/src/libs/xpcom18a4/Makefile.kmk
index 6b7d8fb..917e76b 100644
--- a/src/libs/xpcom18a4/Makefile.kmk
+++ b/src/libs/xpcom18a4/Makefile.kmk
@@ -31,7 +31,6 @@ endif
 # symbol namespace pollution, causing trouble with system libraries.
 XPCOM_C_NAMESPACE_MAP = $(VBOX_PATH_XPCOM_SRC)/xpcom-namespace-cleanup.map
 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
- VBOX_NM = nm$(HOSTSUFF_EXE)
  # At the moment, only Solaris uses the generated map file. GNU ld is smart
  # enough to handle symbol wildcards itself.
  if1of ($(KBUILD_TARGET), solaris)
@@ -1435,11 +1434,11 @@ $(PATH_TARGET)/xpcom-namespace-cleanup.map foo.map: $$(VBoxXPCOM_LIBS) $$(VBoxXP
 		-e 's/\<_init$$/&;/p' \
 		--append $@
 	$(QUIET)$(APPEND) $@ '};'
-ifeq ($(KBUILD_TARGET),solaris)
- # Temporary gcc 4.5.2 hack on Solaris which emits unknown mangled symbols for ctors/dtors for certain objects. See @bugref{5838}.
- if $(VBOX_GCC_VERSION_CXX) == 40502
-	$(QUIET)$(SED) -re '/^_Z.*[C-D]5E/d' $@ > $@-sedtmp
-	$(QUIET)$(MV) $@-sedtmp $@
- endif
-endif
+#ifeq ($(KBUILD_TARGET),solaris)
+# # Temporary gcc 4.5.2 hack on Solaris which emits unknown mangled symbols for ctors/dtors for certain objects. See @bugref{5838}.
+# if $(VBOX_GCC_VERSION_CXX) == 40502
+#	$(QUIET)$(SED) -re '/^_Z.*[C-D]5E/d' $@ > $@-sedtmp
+#	$(QUIET)$(MV) $@-sedtmp $@
+# endif
+#endif
 
diff --git a/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h b/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h
index 13d6262..517b265 100644
--- a/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h
+++ b/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.h
@@ -313,8 +313,12 @@ private:
   // this is true after IPC_Shutdown() has been called
   PRBool mDisconnected;
 
+// member is never initialized or used, no point in wasting memory or making
+// someone believe it contains anything relevant
+#ifndef VBOX
   // our IPC client ID
   PRUint32 mSelfID;
+#endif
 
   // global lock to protect access to protect DConnectStub::QueryInterface()
   // (we cannot use mStubLock because it isn't supposed to be held long,
diff --git a/src/libs/xpcom18a4/java/tools/genjifaces.xsl b/src/libs/xpcom18a4/java/tools/genjifaces.xsl
index 3910de7..5d8eb66 100644
--- a/src/libs/xpcom18a4/java/tools/genjifaces.xsl
+++ b/src/libs/xpcom18a4/java/tools/genjifaces.xsl
@@ -32,6 +32,34 @@
 
 <xsl:variable name="G_xsltFilename" select="'genjifaces.xsl'" />
 
+
+<!-- - - - - - - - - - - - - - - - - - - - - - -
+  Keys for more efficiently looking up of types.
+- - - - - - - - - - - - - - - - - - - - - - -->
+<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
+<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
+
+<!--
+     xsltprocNewlineOutputHack - emits a single new line.
+
+     Hack Alert! This template helps xsltproc split up the output text elements
+                 and avoid reallocating them into the MB range. Calls to this
+                 template is made occationally while generating larger output
+                 file.  It's not necessary for small stuff like header.
+
+                 The trick we're playing on xsltproc has to do with CDATA
+                 and/or the escape setting of the xsl:text element.  It forces
+                 xsltproc to allocate a new output element, thus preventing
+                 things from growing out of proportions and slowing us down.
+
+                 This was successfully employed to reduce a 18+ seconds run to
+                 around one second (possibly less due to kmk overhead).
+ -->
+<xsl:template name="xsltprocNewlineOutputHack">
+    <xsl:text disable-output-escaping="yes"><![CDATA[
+]]></xsl:text>
+</xsl:template>
+
 <xsl:template name="uppercase">
   <xsl:param name="str" select="."/>
   <xsl:value-of select="translate($str, 'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
@@ -67,7 +95,7 @@
 <xsl:template name="fileheader">
   <xsl:param name="name" />
   <xsl:text>/**
- *  Copyright (C) 2010-2013 Oracle Corporation
+ *  Copyright (C) 2010-2015 Oracle Corporation
  *
  *  This file is part of VirtualBox Open Source Edition (OSE), as
  *  available from http://www.virtualbox.org. This file is free software;
@@ -102,7 +130,8 @@
 
 <xsl:template name="endFile">
  <xsl:param name="file" />
- <xsl:value-of select="concat('
// ##### ENDFILE "', $file, '"

')" />
+ <xsl:value-of select="concat('
// ##### ENDFILE "', $file, '"
')" />
+ <xsl:call-template name="xsltprocNewlineOutputHack"/>
 </xsl:template>
 
 
@@ -370,11 +399,11 @@ public interface nsILocalFile extends nsIFile
       <xsl:value-of select="'String'" />
     </xsl:when>
 
-    <xsl:when test="//interface[@name=$type]">
+    <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
       <xsl:value-of select="$type" />
     </xsl:when>
 
-    <xsl:when test="//enum[@name=$type]">
+    <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0">
       <xsl:value-of select="'long'" />
     </xsl:when>
 
@@ -394,7 +423,7 @@ public interface nsILocalFile extends nsIFile
     <xsl:with-param name="file" select="$filename" />
   </xsl:call-template>
 
-  <xsl:variable name="extendsidl" select="//interface[@name=$ifname]/@extends" />
+  <xsl:variable name="extendsidl" select="key('G_keyInterfacesByName', $ifname)/@extends" />
 
   <xsl:variable name="extends">
     <xsl:choose>
diff --git a/src/libs/xpcom18a4/nsprpub/pr/include/md/_darwin.h b/src/libs/xpcom18a4/nsprpub/pr/include/md/_darwin.h
index daf2ebe..bc1c500 100644
--- a/src/libs/xpcom18a4/nsprpub/pr/include/md/_darwin.h
+++ b/src/libs/xpcom18a4/nsprpub/pr/include/md/_darwin.h
@@ -72,6 +72,13 @@
 #define _PR_HAVE_LARGE_OFF_T
 #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 /* Mac OS X 10.6 has poll(). */
+# if 0 /* ... but we don't use it because it performs worse on Mt. Lion - WEIRD! */
+# define _PR_POLL_AVAILABLE     1
+# define _PR_USE_POLL           1
+# endif
+#endif
+
 #define _PR_INET6
 /*
  * I'd prefer to use getipnodebyname and getipnodebyaddr but the
diff --git a/src/libs/xpcom18a4/nsprpub/pr/include/md/_vbox.cfg b/src/libs/xpcom18a4/nsprpub/pr/include/md/_vbox.cfg
index 07e012a..ce3c1dd 100644
--- a/src/libs/xpcom18a4/nsprpub/pr/include/md/_vbox.cfg
+++ b/src/libs/xpcom18a4/nsprpub/pr/include/md/_vbox.cfg
@@ -54,7 +54,7 @@
 #elif defined(RT_OS_SOLARIS)
 # if defined(RT_ARCH_X86)
 #  include <md/_solaris32.cfg>
-#else
+# else
 #  include <md/_solaris64.cfg>
 # endif
 #elif defined(RT_OS_OS2)
diff --git a/src/libs/xpcom18a4/nsprpub/pr/src/misc/prnetdb.c b/src/libs/xpcom18a4/nsprpub/pr/src/misc/prnetdb.c
index c3b7cdd..c47d2ab 100644
--- a/src/libs/xpcom18a4/nsprpub/pr/src/misc/prnetdb.c
+++ b/src/libs/xpcom18a4/nsprpub/pr/src/misc/prnetdb.c
@@ -2135,11 +2135,11 @@ PR_IMPLEMENT(void *) PR_EnumerateAddrInfo(void             *iterPtr,
 #if defined(_PR_INET6_PROBE)
     if (!_pr_ipv6_is_present) {
         /* using PRAddrInfoFB */
-        PRIntn iter = (PRIntn) iterPtr;
+        PRIntn iter = (PRIntn)(uintptr_t)iterPtr;
         iter = PR_EnumerateHostEnt(iter, &((PRAddrInfoFB *) base)->hostent, port, result);
         if (iter < 0)
             iter = 0;
-        return (void *) iter;
+        return (void *)(uintptr_t)iter;
     }
 #endif
 
diff --git a/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c b/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c
index f745822..11b7d90 100644
--- a/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c
+++ b/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c
@@ -187,6 +187,10 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
 
 #include "primpl.h"
 
+#if defined(VBOX) && defined(_PR_POLL_AVAILABLE)
+# include <poll.h>
+#endif
+
 #include <netinet/tcp.h>  /* TCP_NODELAY, TCP_MAXSEG */
 #ifdef LINUX
 /* TCP_CORK is not defined in <netinet/tcp.h> on Red Hat Linux 6.0 */
diff --git a/src/libs/xpcom18a4/python/Makefile.kmk b/src/libs/xpcom18a4/python/Makefile.kmk
index 50cc5e2..fd09003 100644
--- a/src/libs/xpcom18a4/python/Makefile.kmk
+++ b/src/libs/xpcom18a4/python/Makefile.kmk
@@ -180,7 +180,7 @@ ifdef VBOX_PYTHON26_INC
 DLLS += VBoxPython2_6
 VBoxPython2_6_EXTENDS    = VBoxPythonBase
 VBoxPython2_6_EXTENDS_BY = appending
-VBoxPython2_6_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX106,)
+VBoxPython2_6_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin" && "$(VBOX_DEF_MACOSX_VERSION_MIN)" <= "10.6",OSX106,)
 VBoxPython2_6_INCS       = $(VBOX_PYTHON26_INC)
 VBoxPython2_6_LIBS       = $(VBOX_PYTHON26_LIB)
 
@@ -188,7 +188,7 @@ VBoxPython2_6_LIBS       = $(VBOX_PYTHON26_LIB)
 DLLS += VBoxPython2_6_x86
 VBoxPython2_6_x86_EXTENDS    = VBoxPythonBase_x86
 VBoxPython2_6_x86_EXTENDS_BY = appending
-VBoxPython2_6_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX106,-x86)
+VBoxPython2_6_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin" && "$(VBOX_DEF_MACOSX_VERSION_MIN)" <= "10.6",OSX106,-x86)
 VBoxPython2_6_x86_INCS       = $(VBOX_PYTHON26_INC)
 VBoxPython2_6_x86_LIBS       = $(VBOX_PYTHON26_LIB_X86)
  endif
@@ -201,7 +201,7 @@ ifdef VBOX_PYTHON27_INC
 DLLS += VBoxPython2_7
 VBoxPython2_7_EXTENDS    = VBoxPythonBase
 VBoxPython2_7_EXTENDS_BY = appending
-VBoxPython2_7_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX107,)
+VBoxPython2_7_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin" && "$(VBOX_DEF_MACOSX_VERSION_MIN)" <= "10.7",OSX107,)
 VBoxPython2_7_INCS       = $(VBOX_PYTHON27_INC)
 VBoxPython2_7_LIBS       = $(VBOX_PYTHON27_LIB)
 
@@ -209,7 +209,7 @@ VBoxPython2_7_LIBS       = $(VBOX_PYTHON27_LIB)
 DLLS += VBoxPython2_7_x86
 VBoxPython2_7_x86_EXTENDS    = VBoxPythonBase_x86
 VBoxPython2_7_x86_EXTENDS_BY = appending
-VBoxPython2_7_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin",OSX107,-x86)
+VBoxPython2_7_x86_TEMPLATE   = XPCOM$(if-expr "$(KBUILD_TARGET)" == "darwin" && "$(VBOX_DEF_MACOSX_VERSION_MIN)" <= "10.7",OSX107,-x86)
 VBoxPython2_7_x86_INCS       = $(VBOX_PYTHON27_INC)
 VBoxPython2_7_x86_LIBS       = $(VBOX_PYTHON27_LIB_X86)
  endif
diff --git a/src/libs/xpcom18a4/python/src/PyISupports.cpp b/src/libs/xpcom18a4/python/src/PyISupports.cpp
index 0802eee..f848dff 100644
--- a/src/libs/xpcom18a4/python/src/PyISupports.cpp
+++ b/src/libs/xpcom18a4/python/src/PyISupports.cpp
@@ -59,10 +59,10 @@ static PyObject *g_obFuncMakeInterfaceCount = NULL; // XXX - never released!!!
 /*static*/ RTONCE            Py_nsISupports::g_Once = RTONCE_INITIALIZER;
 /*static*/ RTCRITSECT        Py_nsISupports::g_CritSect;
 
-/*static*/ DECLCALLBACK(int)
-Py_nsISupports::initOnceCallback(void *pvUser1, void *pvUser2)
+/*static*/ DECLCALLBACK(int32_t)
+Py_nsISupports::initOnceCallback(void *pvUser1)
 {
-    NOREF(pvUser1); NOREF(pvUser2);
+    NOREF(pvUser1);
     RTListInit(&g_List);
     return RTCritSectInit(&g_CritSect);
 }
@@ -70,7 +70,7 @@ Py_nsISupports::initOnceCallback(void *pvUser1, void *pvUser2)
 /*static*/ void
 Py_nsISupports::dumpList(void)
 {
-    RTOnce(&g_Once, initOnceCallback, NULL, NULL);
+    RTOnce(&g_Once, initOnceCallback, NULL);
     RTCritSectEnter(&g_CritSect);
 
     uint32_t i = 0;
@@ -88,7 +88,7 @@ Py_nsISupports::dumpList(void)
 /*static*/ void
 Py_nsISupports::dumpListToStdOut()
 {
-    RTOnce(&g_Once, initOnceCallback, NULL, NULL);
+    RTOnce(&g_Once, initOnceCallback, NULL);
     RTCritSectEnter(&g_CritSect);
 
     uint32_t i = 0;
@@ -139,7 +139,7 @@ Py_nsISupports::Py_nsISupports(nsISupports *punk, const nsIID &iid, PyTypeObject
 	_Py_NewReference(this);
 
 #ifdef VBOX_DEBUG_LIFETIMES
-        RTOnce(&g_Once, initOnceCallback, NULL, NULL);
+        RTOnce(&g_Once, initOnceCallback, NULL);
         RTCritSectEnter(&g_CritSect);
         RTListAppend(&g_List, &m_ListEntry);
         RTCritSectLeave(&g_CritSect);
diff --git a/src/libs/xpcom18a4/python/src/PyXPCOM.h b/src/libs/xpcom18a4/python/src/PyXPCOM.h
index df374e7..1cbe517 100644
--- a/src/libs/xpcom18a4/python/src/PyXPCOM.h
+++ b/src/libs/xpcom18a4/python/src/PyXPCOM.h
@@ -376,7 +376,7 @@ protected:
 	static PyObject *MakeDefaultWrapper(PyObject *pyis, const nsIID &iid);
 
 #ifdef VBOX_DEBUG_LIFETIMES
-	static DECLCALLBACK(int) initOnceCallback(void *pvUser1, void *pvUser2);
+	static DECLCALLBACK(int32_t) initOnceCallback(void *pvUser1);
 
 	RTLISTNODE              m_ListEntry; /**< List entry. */
 
diff --git a/src/libs/xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp b/src/libs/xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp
index ca3d94c..4ee051a 100644
--- a/src/libs/xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp
+++ b/src/libs/xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp
@@ -643,7 +643,7 @@ static void RecycleSerialNumberPtr(void* aPtr)
 
 static PRBool LogThisObj(PRInt32 aSerialNumber)
 {
-  return nsnull != PL_HashTableLookup(gObjectsToLog, (const void*)(aSerialNumber));
+  return nsnull != PL_HashTableLookup(gObjectsToLog, (const void*)(uintptr_t)(aSerialNumber));
 }
 
 static PRBool InitLog(const char* envVar, const char* msg, FILE* *result)
diff --git a/src/libs/xpcom18a4/xpcom/components/nsIServiceManagerUtils.h b/src/libs/xpcom18a4/xpcom/components/nsIServiceManagerUtils.h
index b225b6a..b7b432a 100644
--- a/src/libs/xpcom18a4/xpcom/components/nsIServiceManagerUtils.h
+++ b/src/libs/xpcom18a4/xpcom/components/nsIServiceManagerUtils.h
@@ -87,6 +87,8 @@ class NS_COM nsGetServiceByContractID : public nsCOMPtr_helper
         {
             // nothing else to do
         }
+    // Implement a dummy destructor to workaround linking issue on Solaris gcc 4.8.2 (see @bugref{5838})
+    ~nsGetServiceByContractID() {}
     
     virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
     
diff --git a/src/libs/xpcom18a4/xpcom/ds/nsCheapSets.h b/src/libs/xpcom18a4/xpcom/ds/nsCheapSets.h
index 79209ea..7e1c917 100644
--- a/src/libs/xpcom18a4/xpcom/ds/nsCheapSets.h
+++ b/src/libs/xpcom18a4/xpcom/ds/nsCheapSets.h
@@ -175,7 +175,7 @@ private:
   /** Set the single integer */
   void SetInt(PRInt32 aInt)
   {
-    mValOrHash = (void*)((aInt << 1) | 0x1);
+    mValOrHash = (void*)(uintptr_t)((aInt << 1) | 0x1);
   }
   /** Create the hash and initialize */
   nsresult InitHash(nsInt32HashSet** aSet);
diff --git a/src/libs/xpcom18a4/xpcom/ds/pldhash.c b/src/libs/xpcom18a4/xpcom/ds/pldhash.c
index 9e02268..74f8cd0 100644
--- a/src/libs/xpcom18a4/xpcom/ds/pldhash.c
+++ b/src/libs/xpcom18a4/xpcom/ds/pldhash.c
@@ -103,7 +103,7 @@ PL_DHashGetKeyStub(PLDHashTable *table, PLDHashEntryHdr *entry)
 PR_IMPLEMENT(PLDHashNumber)
 PL_DHashVoidPtrKeyStub(PLDHashTable *table, const void *key)
 {
-    return (PLDHashNumber)key >> 2;
+    return (PLDHashNumber)(uintptr_t)key >> 2;
 }
 
 PR_IMPLEMENT(PRBool)
diff --git a/src/libs/xpcom18a4/xpcom/io/nsFastLoadService.cpp b/src/libs/xpcom18a4/xpcom/io/nsFastLoadService.cpp
index 5489286..4df187c 100644
--- a/src/libs/xpcom18a4/xpcom/io/nsFastLoadService.cpp
+++ b/src/libs/xpcom18a4/xpcom/io/nsFastLoadService.cpp
@@ -397,7 +397,7 @@ nsFastLoadService::ComputeChecksum(nsIFile* aFile,
 #ifndef VBOX
     mChecksumTable.Put(&key, NS_INT32_TO_PTR(checksum));
 #else /* VBOX */
-    mChecksumTable.Put(&key, (void *)checksum);
+    mChecksumTable.Put(&key, (void *)(uintptr_t)checksum);
 #endif /* VBOX */
     *aChecksum = checksum;
     return NS_OK;
@@ -424,7 +424,7 @@ nsFastLoadService::CacheChecksum(nsIFile* aFile, nsIObjectOutputStream *aStream)
 #ifndef VBOX
     mChecksumTable.Put(&key, NS_INT32_TO_PTR(checksum));
 #else /* VBOX */
-    mChecksumTable.Put(&key, (void *)checksum);
+    mChecksumTable.Put(&key, (void *)(uintptr_t)checksum);
 #endif /* VBOX */
     return NS_OK;
 }
diff --git a/src/libs/xpcom18a4/xpcom/proxy/public/nsProxyRelease.h b/src/libs/xpcom18a4/xpcom/proxy/public/nsProxyRelease.h
index 9792736..413a3d0 100644
--- a/src/libs/xpcom18a4/xpcom/proxy/public/nsProxyRelease.h
+++ b/src/libs/xpcom18a4/xpcom/proxy/public/nsProxyRelease.h
@@ -35,7 +35,7 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
-#ifndef nsProxyRelease_h_
+#ifndef nsProxyRelease_h__
 #define nsProxyRelease_h__
 
 #include "nsIEventQueueService.h"
diff --git a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcall.h b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcall.h
index ec2526c..73042ce 100644
--- a/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcall.h
+++ b/src/libs/xpcom18a4/xpcom/reflect/xptcall/public/xptcall.h
@@ -225,6 +225,11 @@ public:
     // *This is needed by the Irix implementation.*
     NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
 
+    // Implement dummy constructor, destructor to workaround Solaris gcc 4.8.2
+    // linking issue (see @bugref{5838}).
+    nsXPTCStubBase() {}
+    ~nsXPTCStubBase() {}
+
     // Include generated vtbl stub declarations.
     // These are virtual and *also* implemented by this class..
 #include "xptcstubsdecl.inc"
diff --git a/src/libs/xpcom18a4/xpcom/tests/TestThreads.cpp b/src/libs/xpcom18a4/xpcom/tests/TestThreads.cpp
index 8c9e812..10025a0 100644
--- a/src/libs/xpcom18a4/xpcom/tests/TestThreads.cpp
+++ b/src/libs/xpcom18a4/xpcom/tests/TestThreads.cpp
@@ -215,7 +215,7 @@ static int StressNSPR(int loops, int threads)
 
         for (k = 0; k < threads; k++) {
             array[k] = PR_CreateThread(PR_USER_THREAD,
-                                       threadProc, (void*) k,
+                                       threadProc, (void*)(uintptr_t)k,
                                        PR_PRIORITY_NORMAL,
                                        PR_GLOBAL_THREAD,
                                        PR_JOINABLE_THREAD,
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpt/src/xpt_xdr.c b/src/libs/xpcom18a4/xpcom/typelib/xpt/src/xpt_xdr.c
index 9da82e8..cd9261d 100644
--- a/src/libs/xpcom18a4/xpcom/typelib/xpt/src/xpt_xdr.c
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpt/src/xpt_xdr.c
@@ -143,7 +143,7 @@ XPT_HashTableDestroy(XPTHashTable *table) {
 static void *
 XPT_HashTableAdd(XPTHashTable *table, void *key, void *value) {
     XPTHashRecord **bucketloc = table->buckets +
-        (((PRUint32)key) % XPT_HASHSIZE);
+        (((PRUint32)(uintptr_t)key) % XPT_HASHSIZE);
     XPTHashRecord *bucket;
 
     while (*bucketloc != NULL)
@@ -159,7 +159,7 @@ XPT_HashTableAdd(XPTHashTable *table, void *key, void *value) {
 
 static void *
 XPT_HashTableLookup(XPTHashTable *table, void *key) {
-    XPTHashRecord *bucket = table->buckets[(PRUint32)key % XPT_HASHSIZE];
+    XPTHashRecord *bucket = table->buckets[(PRUint32)(uintptr_t)key % XPT_HASHSIZE];
     while (bucket != NULL) {
         if (bucket->key == key)
             return bucket->value;
@@ -483,27 +483,27 @@ XPT_DoCString(XPTArena *arena, XPTCursor *cursor, char **identp)
 XPT_PUBLIC_API(PRUint32)
 XPT_GetOffsetForAddr(XPTCursor *cursor, void *addr)
 {
-    return (PRUint32)XPT_HashTableLookup(cursor->state->pool->offset_map, addr);
+    return (PRUint32)(uintptr_t)XPT_HashTableLookup(cursor->state->pool->offset_map, addr);
 }
 
 XPT_PUBLIC_API(PRBool)
 XPT_SetOffsetForAddr(XPTCursor *cursor, void *addr, PRUint32 offset)
 {
     return XPT_HashTableAdd(cursor->state->pool->offset_map,
-                            addr, (void *)offset) != NULL;
+                            addr, (void *)(uintptr_t)offset) != NULL;
 }
 
 XPT_PUBLIC_API(PRBool)
 XPT_SetAddrForOffset(XPTCursor *cursor, PRUint32 offset, void *addr)
 {
     return XPT_HashTableAdd(cursor->state->pool->offset_map,
-                            (void *)offset, addr) != NULL;
+                            (void *)(uintptr_t)offset, addr) != NULL;
 }
 
 XPT_PUBLIC_API(void *)
 XPT_GetAddrForOffset(XPTCursor *cursor, PRUint32 offset)
 {
-    return XPT_HashTableLookup(cursor->state->pool->offset_map, (void *)offset);
+    return XPT_HashTableLookup(cursor->state->pool->offset_map, (void *)(uintptr_t)offset);
 }
 
 /* Used by XPT_PREAMBLE_NO_ALLOC. */
diff --git a/src/recompiler/Makefile.kmk b/src/recompiler/Makefile.kmk
index b5afebb..be92c7c 100644
--- a/src/recompiler/Makefile.kmk
+++ b/src/recompiler/Makefile.kmk
@@ -322,10 +322,9 @@ $$(VBoxREMImp_0_OUTDIR)/VBoxREMRes.o: $(VBOX_PATH_RECOMPILER_SRC)/VBoxREM.rc $(M
 	$(call MSG_GENERATE,,$@)
 	$(QUIET)$(REDIRECT) -E 'COMSPEC=$(VBOX_GOOD_COMSPEC_BS)' -- $(TOOL_MINGWW64_PREFIX)windres \
 	    $(addprefix -I,$(INCS) $(PATH_SDK_$(VBOX_WINPSDK)_INC) $(PATH_TOOL_$(VBOX_VCC_TOOL)_INC)) \
-	    -DVBOX_VERSION_MAJOR_NR=$(VBOX_VERSION_MAJOR) \
-	    -DVBOX_VERSION_MINOR_NR=$(VBOX_VERSION_MINOR) \
-	    -DVBOX_VERSION_BUILD_NR=$(VBOX_VERSION_BUILD) \
-	    -DVBOX_SVN_REV_NR=$(VBOX_SVN_REV) $< $@
+	    -DVBOX_SVN_REV=$(VBOX_SVN_REV) \
+	    -DVBOX_SVN_REV_MOD_5K=$(expr $(VBOX_SVN_REV) % 50000) \
+	    $< $@
 
 #
 # The math testcase as a standalone program for testing and debugging purposes.
diff --git a/src/recompiler/VBoxREM.rc b/src/recompiler/VBoxREM.rc
index f91aa68..ac91004 100644
--- a/src/recompiler/VBoxREM.rc
+++ b/src/recompiler/VBoxREM.rc
@@ -18,33 +18,30 @@
 #include <windows.h>
 #include <VBox/version.h>
 
-/* stupid windres! */
-#define RT_STR(x) #x
-#define RT_XSTR(x) RT_STR(x)
-
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION      VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
-  PRODUCTVERSION   VBOX_VERSION_MAJOR_NR,VBOX_VERSION_MINOR_NR,VBOX_VERSION_BUILD_NR,0
+  FILEVERSION      VBOX_RC_FILE_VERSION
+  PRODUCTVERSION   VBOX_RC_PRODUCT_VERSION
   FILEFLAGSMASK    VS_FFI_FILEFLAGSMASK
-  FILEFLAGS        0x0L
-  FILEOS           VOS_NT_WINDOWS32
-  FILETYPE         VFT_DLL
+  FILEFLAGS        VBOX_RC_FILE_FLAGS
+  FILEOS           VBOX_RC_FILE_OS
+  FILETYPE         VBOX_RC_TYPE_DLL
   FILESUBTYPE      VFT2_UNKNOWN
 BEGIN
   BLOCK "StringFileInfo"
   BEGIN
     BLOCK "040904b0" // Lang=US English, CharSet=Unicode
     BEGIN
-      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
       VALUE "FileDescription",  "VirtualBox Recompiler\0"
-      VALUE "FileVersion",      RT_XSTR(VBOX_VERSION_MAJOR_NR) "." RT_XSTR(VBOX_VERSION_MINOR_NR) "." RT_XSTR(VBOX_VERSION_BUILD_NR) "." RT_XSTR(VBOX_SVN_REV_NR) "\0"
       VALUE "InternalName",     "VBoxREM\0"
-      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
       VALUE "OriginalFilename", "VBoxREM.dll\0"
-      VALUE "ProductName",      VBOX_PRODUCT "\0"
-      VALUE "ProductVersion",   RT_XSTR(VBOX_VERSION_MAJOR_NR) "." RT_XSTR(VBOX_VERSION_MINOR_NR) "." RT_XSTR(VBOX_VERSION_BUILD_NR) ".r" RT_XSTR(VBOX_SVN_REV_NR) "\0"
+      VALUE "CompanyName",      VBOX_RC_COMPANY_NAME
+      VALUE "FileVersion",      VBOX_RC_FILE_VERSION_STR
+      VALUE "LegalCopyright",   VBOX_RC_LEGAL_COPYRIGHT
+      VALUE "ProductName",      VBOX_RC_PRODUCT_NAME_STR
+      VALUE "ProductVersion",   VBOX_RC_PRODUCT_VERSION_STR
+      VBOX_RC_MORE_STRINGS
     END
   END
   BLOCK "VarFileInfo"
diff --git a/src/recompiler/VBoxREMWrapper.cpp b/src/recompiler/VBoxREMWrapper.cpp
index 364aaa2..ba12b1e 100644
--- a/src/recompiler/VBoxREMWrapper.cpp
+++ b/src/recompiler/VBoxREMWrapper.cpp
@@ -365,9 +365,9 @@ static DECLCALLBACKPTR(void, pfnREMR3ReplayHandlerNotifications)(PVM pVM);
 static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamRegister)(PVM, RTGCPHYS, RTGCPHYS, unsigned);
 static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRamDeregister)(PVM, RTGCPHYS, RTUINT);
 static DECLCALLBACKPTR(void, pfnREMR3NotifyPhysRomRegister)(PVM, RTGCPHYS, RTUINT, void *, bool);
-static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalModify)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, RTGCPHYS, bool, bool);
-static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalRegister)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, bool);
-static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalDeregister)(PVM, PGMPHYSHANDLERTYPE, RTGCPHYS, RTGCPHYS, bool, bool);
+static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalModify)(PVM, PGMPHYSHANDLERKIND, RTGCPHYS, RTGCPHYS, RTGCPHYS, bool, bool);
+static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalRegister)(PVM, PGMPHYSHANDLERKIND, RTGCPHYS, RTGCPHYS, bool);
+static DECLCALLBACKPTR(void, pfnREMR3NotifyHandlerPhysicalDeregister)(PVM, PGMPHYSHANDLERKIND, RTGCPHYS, RTGCPHYS, bool, bool);
 static DECLCALLBACKPTR(void, pfnREMR3NotifyInterruptSet)(PVM, PVMCPU);
 static DECLCALLBACKPTR(void, pfnREMR3NotifyInterruptClear)(PVM, PVMCPU);
 static DECLCALLBACKPTR(void, pfnREMR3NotifyTimerPending)(PVM, PVMCPU);
@@ -483,7 +483,7 @@ static const REMPARMDESC g_aArgsNotifyPhysRomRegister[] =
 static const REMPARMDESC g_aArgsNotifyHandlerPhysicalModify[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(PGMPHYSHANDLERTYPE), NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMPHYSHANDLERKIND), NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
@@ -493,7 +493,7 @@ static const REMPARMDESC g_aArgsNotifyHandlerPhysicalModify[] =
 static const REMPARMDESC g_aArgsNotifyHandlerPhysicalRegister[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(PGMPHYSHANDLERTYPE), NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMPHYSHANDLERKIND), NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(bool),               NULL }
@@ -501,7 +501,7 @@ static const REMPARMDESC g_aArgsNotifyHandlerPhysicalRegister[] =
 static const REMPARMDESC g_aArgsNotifyHandlerPhysicalDeregister[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(PGMPHYSHANDLERTYPE), NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMPHYSHANDLERKIND), NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(bool),               NULL },
@@ -558,6 +558,7 @@ static const REMPARMDESC g_aArgsCPUMGetGuestCpuId[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVMCPU),             NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t *),         NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t *),         NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t *),         NULL },
@@ -830,7 +831,8 @@ static const REMPARMDESC g_aArgsPGMPhysRead[] =
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(void *),             NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL }
+    { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
 };
 static const REMPARMDESC g_aArgsPGMPhysSimpleReadGCPtr[] =
 {
@@ -844,7 +846,8 @@ static const REMPARMDESC g_aArgsPGMPhysWrite[] =
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
     { REMPARMDESC_FLAGS_INT,        sizeof(const void *),       NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL }
+    { REMPARMDESC_FLAGS_INT,        sizeof(size_t),             NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
 };
 static const REMPARMDESC g_aArgsPGMChangeMode[] =
 {
@@ -862,31 +865,36 @@ static const REMPARMDESC g_aArgsPGMFlushTLB[] =
 static const REMPARMDESC g_aArgsPGMR3PhysReadUxx[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
-    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL }
+    { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
 };
 static const REMPARMDESC g_aArgsPGMR3PhysWriteU8[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(uint8_t),            NULL }
+    { REMPARMDESC_FLAGS_INT,        sizeof(uint8_t),            NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
 };
 static const REMPARMDESC g_aArgsPGMR3PhysWriteU16[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(uint16_t),           NULL }
+    { REMPARMDESC_FLAGS_INT,        sizeof(uint16_t),           NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
 };
 static const REMPARMDESC g_aArgsPGMR3PhysWriteU32[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL }
+    { REMPARMDESC_FLAGS_INT,        sizeof(uint32_t),           NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
 };
 static const REMPARMDESC g_aArgsPGMR3PhysWriteU64[] =
 {
     { REMPARMDESC_FLAGS_INT,        sizeof(PVM),                NULL },
     { REMPARMDESC_FLAGS_GCPHYS,     sizeof(RTGCPHYS),           NULL },
-    { REMPARMDESC_FLAGS_INT,        sizeof(uint64_t),           NULL }
+    { REMPARMDESC_FLAGS_INT,        sizeof(uint64_t),           NULL },
+    { REMPARMDESC_FLAGS_INT,        sizeof(PGMACCESSORIGIN),    NULL }
 };
 static const REMPARMDESC g_aArgsRTMemReallocTag[] =
 {
@@ -2380,27 +2388,27 @@ REMR3DECL(void) REMR3NotifyPhysRamDeregister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb
 #endif
 }
 
-REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler)
+REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler)
 {
 #ifndef USE_REM_STUBS
     Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalRegister));
-    pfnREMR3NotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, cb, fHasHCHandler);
+    pfnREMR3NotifyHandlerPhysicalRegister(pVM, enmKind, GCPhys, cb, fHasHCHandler);
 #endif
 }
 
-REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
+REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
 {
 #ifndef USE_REM_STUBS
     Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalDeregister));
-    pfnREMR3NotifyHandlerPhysicalDeregister(pVM, enmType, GCPhys, cb, fHasHCHandler, fRestoreAsRAM);
+    pfnREMR3NotifyHandlerPhysicalDeregister(pVM, enmKind, GCPhys, cb, fHasHCHandler, fRestoreAsRAM);
 #endif
 }
 
-REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
+REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
 {
 #ifndef USE_REM_STUBS
     Assert(VALID_PTR(pfnREMR3NotifyHandlerPhysicalModify));
-    pfnREMR3NotifyHandlerPhysicalModify(pVM, enmType, GCPhysOld, GCPhysNew, cb, fHasHCHandler, fRestoreAsRAM);
+    pfnREMR3NotifyHandlerPhysicalModify(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fHasHCHandler, fRestoreAsRAM);
 #endif
 }
 
diff --git a/src/recompiler/VBoxRecompiler.c b/src/recompiler/VBoxRecompiler.c
index d74eeb0..5a7b862 100644
--- a/src/recompiler/VBoxRecompiler.c
+++ b/src/recompiler/VBoxRecompiler.c
@@ -49,6 +49,7 @@
 #include <VBox/err.h>
 
 #include <VBox/log.h>
+#include <iprt/alloca.h>
 #include <iprt/semaphore.h>
 #include <iprt/asm.h>
 #include <iprt/assert.h>
@@ -114,9 +115,10 @@ static void     remR3HandlerWriteU8(void *pvVM, target_phys_addr_t GCPhys, uint3
 static void     remR3HandlerWriteU16(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32);
 static void     remR3HandlerWriteU32(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32);
 
-static void remR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
-static void remR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
-static void remR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
+static void remR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
+static void remR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
+static void remR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
+
 
 /*******************************************************************************
 *   Global Variables                                                           *
@@ -197,7 +199,7 @@ CPUWriteMemoryFunc *g_apfnHandlerWrite[3] =
 };
 
 
-#if defined(VBOX_WITH_DEBUGGER) && !(defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64))
+#ifdef VBOX_WITH_DEBUGGER
 /*
  * Debugger commands.
  */
@@ -320,8 +322,8 @@ REMR3DECL(int) REMR3Init(PVM pVM)
         return VERR_GENERAL_FAILURE;
     }
     PVMCPU pVCpu = VMMGetCpu(pVM);
-    CPUMGetGuestCpuId(pVCpu,          1, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext_features, &pVM->rem.s.Env.cpuid_features);
-    CPUMGetGuestCpuId(pVCpu, 0x80000001, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext3_features, &pVM->rem.s.Env.cpuid_ext2_features);
+    CPUMGetGuestCpuId(pVCpu,          1, 0, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext_features, &pVM->rem.s.Env.cpuid_features);
+    CPUMGetGuestCpuId(pVCpu, 0x80000001, 0, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext3_features, &pVM->rem.s.Env.cpuid_ext2_features);
 
     EMRemLock(pVM);
     cpu_reset(&pVM->rem.s.Env);
@@ -360,7 +362,7 @@ REMR3DECL(int) REMR3Init(PVM pVM)
     if (RT_FAILURE(rc))
         return rc;
 
-#if defined(VBOX_WITH_DEBUGGER) && !(defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64))
+#ifdef VBOX_WITH_DEBUGGER
     /*
      * Debugger commands.
      */
@@ -734,8 +736,8 @@ static DECLCALLBACK(int) remR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion,
      * Get the CPUID features.
      */
     PVMCPU pVCpu = VMMGetCpu(pVM);
-    CPUMGetGuestCpuId(pVCpu,          1, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext_features, &pVM->rem.s.Env.cpuid_features);
-    CPUMGetGuestCpuId(pVCpu, 0x80000001, &u32Dummy, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext2_features);
+    CPUMGetGuestCpuId(pVCpu,          1, 0, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext_features, &pVM->rem.s.Env.cpuid_features);
+    CPUMGetGuestCpuId(pVCpu, 0x80000001, 0, &u32Dummy, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext2_features);
 
     /*
      * Stop ignoring ignorable notifications.
@@ -1388,7 +1390,12 @@ bool remR3CanExecuteRaw(CPUX86State *env, RTGCPTR eip, unsigned fFlags, int *piE
 
     if (HMIsEnabled(env->pVM))
     {
+#ifdef RT_OS_WINDOWS
+        PCPUMCTX pCtx = alloca(sizeof(*pCtx));
+#else
         CPUMCTX Ctx;
+        PCPUMCTX pCtx = &Ctx;
+#endif
 
         env->state |= CPU_RAW_HM;
 
@@ -1401,84 +1408,84 @@ bool remR3CanExecuteRaw(CPUX86State *env, RTGCPTR eip, unsigned fFlags, int *piE
         /*
          * Create partial context for HMR3CanExecuteGuest
          */
-        Ctx.cr0            = env->cr[0];
-        Ctx.cr3            = env->cr[3];
-        Ctx.cr4            = env->cr[4];
-
-        Ctx.tr.Sel         = env->tr.selector;
-        Ctx.tr.ValidSel    = env->tr.selector;
-        Ctx.tr.fFlags      = CPUMSELREG_FLAGS_VALID;
-        Ctx.tr.u64Base     = env->tr.base;
-        Ctx.tr.u32Limit    = env->tr.limit;
-        Ctx.tr.Attr.u      = (env->tr.flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
-
-        Ctx.ldtr.Sel       = env->ldt.selector;
-        Ctx.ldtr.ValidSel  = env->ldt.selector;
-        Ctx.ldtr.fFlags    = CPUMSELREG_FLAGS_VALID;
-        Ctx.ldtr.u64Base   = env->ldt.base;
-        Ctx.ldtr.u32Limit  = env->ldt.limit;
-        Ctx.ldtr.Attr.u    = (env->ldt.flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
-
-        Ctx.idtr.cbIdt     = env->idt.limit;
-        Ctx.idtr.pIdt      = env->idt.base;
-
-        Ctx.gdtr.cbGdt     = env->gdt.limit;
-        Ctx.gdtr.pGdt      = env->gdt.base;
-
-        Ctx.rsp            = env->regs[R_ESP];
-        Ctx.rip            = env->eip;
-
-        Ctx.eflags.u32     = env->eflags;
-
-        Ctx.cs.Sel         = env->segs[R_CS].selector;
-        Ctx.cs.ValidSel    = env->segs[R_CS].selector;
-        Ctx.cs.fFlags      = CPUMSELREG_FLAGS_VALID;
-        Ctx.cs.u64Base     = env->segs[R_CS].base;
-        Ctx.cs.u32Limit    = env->segs[R_CS].limit;
-        Ctx.cs.Attr.u      = (env->segs[R_CS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
-
-        Ctx.ds.Sel         = env->segs[R_DS].selector;
-        Ctx.ds.ValidSel    = env->segs[R_DS].selector;
-        Ctx.ds.fFlags      = CPUMSELREG_FLAGS_VALID;
-        Ctx.ds.u64Base     = env->segs[R_DS].base;
-        Ctx.ds.u32Limit    = env->segs[R_DS].limit;
-        Ctx.ds.Attr.u      = (env->segs[R_DS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
-
-        Ctx.es.Sel         = env->segs[R_ES].selector;
-        Ctx.es.ValidSel    = env->segs[R_ES].selector;
-        Ctx.es.fFlags      = CPUMSELREG_FLAGS_VALID;
-        Ctx.es.u64Base     = env->segs[R_ES].base;
-        Ctx.es.u32Limit    = env->segs[R_ES].limit;
-        Ctx.es.Attr.u      = (env->segs[R_ES].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
-
-        Ctx.fs.Sel         = env->segs[R_FS].selector;
-        Ctx.fs.ValidSel    = env->segs[R_FS].selector;
-        Ctx.fs.fFlags      = CPUMSELREG_FLAGS_VALID;
-        Ctx.fs.u64Base     = env->segs[R_FS].base;
-        Ctx.fs.u32Limit    = env->segs[R_FS].limit;
-        Ctx.fs.Attr.u      = (env->segs[R_FS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
-
-        Ctx.gs.Sel         = env->segs[R_GS].selector;
-        Ctx.gs.ValidSel    = env->segs[R_GS].selector;
-        Ctx.gs.fFlags      = CPUMSELREG_FLAGS_VALID;
-        Ctx.gs.u64Base     = env->segs[R_GS].base;
-        Ctx.gs.u32Limit    = env->segs[R_GS].limit;
-        Ctx.gs.Attr.u      = (env->segs[R_GS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
-
-        Ctx.ss.Sel         = env->segs[R_SS].selector;
-        Ctx.ss.ValidSel    = env->segs[R_SS].selector;
-        Ctx.ss.fFlags      = CPUMSELREG_FLAGS_VALID;
-        Ctx.ss.u64Base     = env->segs[R_SS].base;
-        Ctx.ss.u32Limit    = env->segs[R_SS].limit;
-        Ctx.ss.Attr.u      = (env->segs[R_SS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
-
-        Ctx.msrEFER        = env->efer;
+        pCtx->cr0            = env->cr[0];
+        pCtx->cr3            = env->cr[3];
+        pCtx->cr4            = env->cr[4];
+
+        pCtx->tr.Sel         = env->tr.selector;
+        pCtx->tr.ValidSel    = env->tr.selector;
+        pCtx->tr.fFlags      = CPUMSELREG_FLAGS_VALID;
+        pCtx->tr.u64Base     = env->tr.base;
+        pCtx->tr.u32Limit    = env->tr.limit;
+        pCtx->tr.Attr.u      = (env->tr.flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
+
+        pCtx->ldtr.Sel       = env->ldt.selector;
+        pCtx->ldtr.ValidSel  = env->ldt.selector;
+        pCtx->ldtr.fFlags    = CPUMSELREG_FLAGS_VALID;
+        pCtx->ldtr.u64Base   = env->ldt.base;
+        pCtx->ldtr.u32Limit  = env->ldt.limit;
+        pCtx->ldtr.Attr.u    = (env->ldt.flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
+
+        pCtx->idtr.cbIdt     = env->idt.limit;
+        pCtx->idtr.pIdt      = env->idt.base;
+
+        pCtx->gdtr.cbGdt     = env->gdt.limit;
+        pCtx->gdtr.pGdt      = env->gdt.base;
+
+        pCtx->rsp            = env->regs[R_ESP];
+        pCtx->rip            = env->eip;
+
+        pCtx->eflags.u32     = env->eflags;
+
+        pCtx->cs.Sel         = env->segs[R_CS].selector;
+        pCtx->cs.ValidSel    = env->segs[R_CS].selector;
+        pCtx->cs.fFlags      = CPUMSELREG_FLAGS_VALID;
+        pCtx->cs.u64Base     = env->segs[R_CS].base;
+        pCtx->cs.u32Limit    = env->segs[R_CS].limit;
+        pCtx->cs.Attr.u      = (env->segs[R_CS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
+
+        pCtx->ds.Sel         = env->segs[R_DS].selector;
+        pCtx->ds.ValidSel    = env->segs[R_DS].selector;
+        pCtx->ds.fFlags      = CPUMSELREG_FLAGS_VALID;
+        pCtx->ds.u64Base     = env->segs[R_DS].base;
+        pCtx->ds.u32Limit    = env->segs[R_DS].limit;
+        pCtx->ds.Attr.u      = (env->segs[R_DS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
+
+        pCtx->es.Sel         = env->segs[R_ES].selector;
+        pCtx->es.ValidSel    = env->segs[R_ES].selector;
+        pCtx->es.fFlags      = CPUMSELREG_FLAGS_VALID;
+        pCtx->es.u64Base     = env->segs[R_ES].base;
+        pCtx->es.u32Limit    = env->segs[R_ES].limit;
+        pCtx->es.Attr.u      = (env->segs[R_ES].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
+
+        pCtx->fs.Sel         = env->segs[R_FS].selector;
+        pCtx->fs.ValidSel    = env->segs[R_FS].selector;
+        pCtx->fs.fFlags      = CPUMSELREG_FLAGS_VALID;
+        pCtx->fs.u64Base     = env->segs[R_FS].base;
+        pCtx->fs.u32Limit    = env->segs[R_FS].limit;
+        pCtx->fs.Attr.u      = (env->segs[R_FS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
+
+        pCtx->gs.Sel         = env->segs[R_GS].selector;
+        pCtx->gs.ValidSel    = env->segs[R_GS].selector;
+        pCtx->gs.fFlags      = CPUMSELREG_FLAGS_VALID;
+        pCtx->gs.u64Base     = env->segs[R_GS].base;
+        pCtx->gs.u32Limit    = env->segs[R_GS].limit;
+        pCtx->gs.Attr.u      = (env->segs[R_GS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
+
+        pCtx->ss.Sel         = env->segs[R_SS].selector;
+        pCtx->ss.ValidSel    = env->segs[R_SS].selector;
+        pCtx->ss.fFlags      = CPUMSELREG_FLAGS_VALID;
+        pCtx->ss.u64Base     = env->segs[R_SS].base;
+        pCtx->ss.u32Limit    = env->segs[R_SS].limit;
+        pCtx->ss.Attr.u      = (env->segs[R_SS].flags >> SEL_FLAGS_SHIFT) & SEL_FLAGS_SMASK;
+
+        pCtx->msrEFER        = env->efer;
 
         /* Hardware accelerated raw-mode:
          *
          * Typically only 32-bits protected mode, with paging enabled, code is allowed here.
          */
-        if (HMR3CanExecuteGuest(env->pVM, &Ctx) == true)
+        if (HMR3CanExecuteGuest(env->pVM, pCtx) == true)
         {
             *piException = EXCP_EXECUTE_HM;
             return true;
@@ -2236,6 +2243,11 @@ REMR3DECL(int)  REMR3State(PVM pVM, PVMCPU pVCpu)
         }
     }
 
+    /* Update the inhibit NMI mask. */
+    pVM->rem.s.Env.hflags2 &= ~HF2_NMI_MASK;
+    if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
+        pVM->rem.s.Env.hflags2 |= HF2_NMI_MASK;
+
     /*
      * Sync the A20 gate.
      */
@@ -2340,13 +2352,13 @@ REMR3DECL(int)  REMR3State(PVM pVM, PVMCPU pVCpu)
             /*
              * Get the CPUID features.
              */
-            CPUMGetGuestCpuId(pVCpu,          1, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext_features, &pVM->rem.s.Env.cpuid_features);
-            CPUMGetGuestCpuId(pVCpu, 0x80000001, &u32Dummy, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext2_features);
+            CPUMGetGuestCpuId(pVCpu,          1, 0, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext_features, &pVM->rem.s.Env.cpuid_features);
+            CPUMGetGuestCpuId(pVCpu, 0x80000001, 0, &u32Dummy, &u32Dummy, &u32Dummy, &pVM->rem.s.Env.cpuid_ext2_features);
         }
 
         /* Sync FPU state after CR4, CPUID and EFER (!). */
         if (fFlags & CPUM_CHANGED_FPU_REM)
-            save_raw_fp_state(&pVM->rem.s.Env, (uint8_t *)&pCtx->fpu); /* 'save' is an excellent name. */
+            save_raw_fp_state(&pVM->rem.s.Env, (uint8_t *)&pCtx->pXStateR3->x87); /* 'save' is an excellent name. */
     }
 
     /*
@@ -2539,7 +2551,7 @@ REMR3DECL(int) REMR3StateBack(PVM pVM, PVMCPU pVCpu)
     /** @todo DS */
 
     /** @todo check if FPU/XMM was actually used in the recompiler */
-    restore_raw_fp_state(&pVM->rem.s.Env, (uint8_t *)&pCtx->fpu);
+    restore_raw_fp_state(&pVM->rem.s.Env, (uint8_t *)&pCtx->pXStateR3->x87);
 ////    dprintf2(("FPU state CW=%04X TT=%04X SW=%04X (%04X)\n", env->fpuc, env->fpstt, env->fpus, pVMCtx->fpu.FSW));
 
 #ifdef TARGET_X86_64
@@ -2724,6 +2736,18 @@ REMR3DECL(int) REMR3StateBack(PVM pVM, PVMCPU pVCpu)
         VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
     }
 
+    /* Inhibit NMI flag. */
+    if (pVM->rem.s.Env.hflags2 & HF2_NMI_MASK)
+    {
+        Log(("Settings VMCPU_FF_BLOCK_NMIS at %RGv (REM)\n", (RTGCPTR)pCtx->rip));
+        VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
+    }
+    else if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_BLOCK_NMIS))
+    {
+        Log(("Clearing VMCPU_FF_BLOCK_NMIS at %RGv (REM)\n", (RTGCPTR)pCtx->rip));
+        VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
+    }
+
     remR3TrapClear(pVM);
 
     /*
@@ -2792,17 +2816,18 @@ static void remR3StateUpdate(PVM pVM, PVMCPU pVCpu)
      * This is done in the order they are declared in the CPUMCTX structure.
      */
 
+    PX86FXSTATE pFpuCtx = &pCtx->pXStateR3->x87;
     /** @todo FOP */
     /** @todo FPUIP */
     /** @todo CS */
     /** @todo FPUDP */
     /** @todo DS */
     /** @todo Fix MXCSR support in QEMU so we don't overwrite MXCSR with 0 when we shouldn't! */
-    pCtx->fpu.MXCSR         = 0;
-    pCtx->fpu.MXCSR_MASK    = 0;
+    pFpuCtx->MXCSR       = 0;
+    pFpuCtx->MXCSR_MASK  = 0;
 
     /** @todo check if FPU/XMM was actually used in the recompiler */
-    restore_raw_fp_state(&pVM->rem.s.Env, (uint8_t *)&pCtx->fpu);
+    restore_raw_fp_state(&pVM->rem.s.Env, (uint8_t *)pFpuCtx);
 ////    dprintf2(("FPU state CW=%04X TT=%04X SW=%04X (%04X)\n", env->fpuc, env->fpstt, env->fpus, pVMCtx->fpu.FSW));
 
 #ifdef TARGET_X86_64
@@ -3065,7 +3090,7 @@ REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM)
             {
                 case REMHANDLERNOTIFICATIONKIND_PHYSICAL_REGISTER:
                     remR3NotifyHandlerPhysicalRegister(pVM,
-                                                       pCur->u.PhysicalRegister.enmType,
+                                                       pCur->u.PhysicalRegister.enmKind,
                                                        pCur->u.PhysicalRegister.GCPhys,
                                                        pCur->u.PhysicalRegister.cb,
                                                        pCur->u.PhysicalRegister.fHasHCHandler);
@@ -3073,7 +3098,7 @@ REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM)
 
                 case REMHANDLERNOTIFICATIONKIND_PHYSICAL_DEREGISTER:
                     remR3NotifyHandlerPhysicalDeregister(pVM,
-                                                         pCur->u.PhysicalDeregister.enmType,
+                                                         pCur->u.PhysicalDeregister.enmKind,
                                                          pCur->u.PhysicalDeregister.GCPhys,
                                                          pCur->u.PhysicalDeregister.cb,
                                                          pCur->u.PhysicalDeregister.fHasHCHandler,
@@ -3082,7 +3107,7 @@ REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM)
 
                 case REMHANDLERNOTIFICATIONKIND_PHYSICAL_MODIFY:
                     remR3NotifyHandlerPhysicalModify(pVM,
-                                                     pCur->u.PhysicalModify.enmType,
+                                                     pCur->u.PhysicalModify.enmKind,
                                                      pCur->u.PhysicalModify.GCPhysOld,
                                                      pCur->u.PhysicalModify.GCPhysNew,
                                                      pCur->u.PhysicalModify.cb,
@@ -3286,7 +3311,7 @@ REMR3DECL(void) REMR3NotifyPhysRamDeregister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb
  * Notification about a successful PGMR3HandlerPhysicalRegister() call.
  *
  * @param   pVM             VM Handle.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhys          Handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler has a HC callback function.
@@ -3294,10 +3319,11 @@ REMR3DECL(void) REMR3NotifyPhysRamDeregister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb
  * @remark  MMR3PhysRomRegister assumes that this function will not apply the
  *          Handler memory type to memory which has no HC handler.
  */
-static void remR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler)
+static void remR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
+                                               bool fHasHCHandler)
 {
-    Log(("REMR3NotifyHandlerPhysicalRegister: enmType=%d GCPhys=%RGp cb=%RGp fHasHCHandler=%d\n",
-          enmType, GCPhys, cb, fHasHCHandler));
+    Log(("REMR3NotifyHandlerPhysicalRegister: enmKind=%d GCPhys=%RGp cb=%RGp fHasHCHandler=%d\n",
+         enmKind, GCPhys, cb, fHasHCHandler));
 
     VM_ASSERT_EMT(pVM);
     Assert(RT_ALIGN_T(GCPhys, PAGE_SIZE, RTGCPHYS) == GCPhys);
@@ -3307,7 +3333,7 @@ static void remR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmTy
     ASMAtomicIncU32(&pVM->rem.s.cIgnoreAll);
 
     PDMCritSectEnter(&pVM->rem.s.CritSectRegister, VERR_SEM_BUSY);
-    if (enmType == PGMPHYSHANDLERTYPE_MMIO)
+    if (enmKind == PGMPHYSHANDLERKIND_MMIO)
         cpu_register_physical_memory_offset(GCPhys, cb, pVM->rem.s.iMMIOMemType, GCPhys);
     else if (fHasHCHandler)
         cpu_register_physical_memory_offset(GCPhys, cb, pVM->rem.s.iHandlerMemType, GCPhys);
@@ -3320,7 +3346,7 @@ static void remR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmTy
  * Notification about a successful PGMR3HandlerPhysicalRegister() call.
  *
  * @param   pVM             VM Handle.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhys          Handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler has a HC callback function.
@@ -3328,27 +3354,29 @@ static void remR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmTy
  * @remark  MMR3PhysRomRegister assumes that this function will not apply the
  *          Handler memory type to memory which has no HC handler.
  */
-REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler)
+REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
+                                                   bool fHasHCHandler)
 {
     REMR3ReplayHandlerNotifications(pVM);
 
-    remR3NotifyHandlerPhysicalRegister(pVM, enmType, GCPhys, cb, fHasHCHandler);
+    remR3NotifyHandlerPhysicalRegister(pVM, enmKind, GCPhys, cb, fHasHCHandler);
 }
 
 /**
  * Notification about a successful PGMR3HandlerPhysicalDeregister() operation.
  *
  * @param   pVM             VM Handle.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhys          Handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler has a HC callback function.
  * @param   fRestoreAsRAM   Whether the to restore it as normal RAM or as unassigned memory.
  */
-static void remR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
+static void remR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
+                                                 bool fHasHCHandler, bool fRestoreAsRAM)
 {
-    Log(("REMR3NotifyHandlerPhysicalDeregister: enmType=%d GCPhys=%RGp cb=%RGp fHasHCHandler=%RTbool fRestoreAsRAM=%RTbool RAM=%08x\n",
-          enmType, GCPhys, cb, fHasHCHandler, fRestoreAsRAM, MMR3PhysGetRamSize(pVM)));
+    Log(("REMR3NotifyHandlerPhysicalDeregister: enmKind=%d GCPhys=%RGp cb=%RGp fHasHCHandler=%RTbool fRestoreAsRAM=%RTbool RAM=%08x\n",
+         enmKind, GCPhys, cb, fHasHCHandler, fRestoreAsRAM, MMR3PhysGetRamSize(pVM)));
     VM_ASSERT_EMT(pVM);
 
 
@@ -3356,7 +3384,7 @@ static void remR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enm
 
     PDMCritSectEnter(&pVM->rem.s.CritSectRegister, VERR_SEM_BUSY);
     /** @todo this isn't right, MMIO can (in theory) be restored as RAM. */
-    if (enmType == PGMPHYSHANDLERTYPE_MMIO)
+    if (enmKind == PGMPHYSHANDLERKIND_MMIO)
         cpu_register_physical_memory_offset(GCPhys, cb, IO_MEM_UNASSIGNED, GCPhys);
     else if (fHasHCHandler)
     {
@@ -3381,16 +3409,16 @@ static void remR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enm
  * Notification about a successful PGMR3HandlerPhysicalDeregister() operation.
  *
  * @param   pVM             VM Handle.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhys          Handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler has a HC callback function.
  * @param   fRestoreAsRAM   Whether the to restore it as normal RAM or as unassigned memory.
  */
-REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
+REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
 {
     REMR3ReplayHandlerNotifications(pVM);
-    remR3NotifyHandlerPhysicalDeregister(pVM, enmType, GCPhys, cb, fHasHCHandler, fRestoreAsRAM);
+    remR3NotifyHandlerPhysicalDeregister(pVM, enmKind, GCPhys, cb, fHasHCHandler, fRestoreAsRAM);
 }
 
 
@@ -3398,19 +3426,19 @@ REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE
  * Notification about a successful PGMR3HandlerPhysicalModify() call.
  *
  * @param   pVM             VM Handle.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhysOld       Old handler range address.
  * @param   GCPhysNew       New handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler has a HC callback function.
  * @param   fRestoreAsRAM   Whether the to restore it as normal RAM or as unassigned memory.
  */
-static void remR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
+static void remR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
 {
-    Log(("REMR3NotifyHandlerPhysicalModify: enmType=%d GCPhysOld=%RGp GCPhysNew=%RGp cb=%RGp fHasHCHandler=%RTbool fRestoreAsRAM=%RTbool\n",
-          enmType, GCPhysOld, GCPhysNew, cb, fHasHCHandler, fRestoreAsRAM));
+    Log(("REMR3NotifyHandlerPhysicalModify: enmKind=%d GCPhysOld=%RGp GCPhysNew=%RGp cb=%RGp fHasHCHandler=%RTbool fRestoreAsRAM=%RTbool\n",
+         enmKind, GCPhysOld, GCPhysNew, cb, fHasHCHandler, fRestoreAsRAM));
     VM_ASSERT_EMT(pVM);
-    AssertReleaseMsg(enmType != PGMPHYSHANDLERTYPE_MMIO, ("enmType=%d\n", enmType));
+    AssertReleaseMsg(enmKind != PGMPHYSHANDLERKIND_MMIO, ("enmKind=%d\n", enmKind));
 
     if (fHasHCHandler)
     {
@@ -3446,18 +3474,18 @@ static void remR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType
  * Notification about a successful PGMR3HandlerPhysicalModify() call.
  *
  * @param   pVM             VM Handle.
- * @param   enmType         Handler type.
+ * @param   enmKind         Kind of access handler.
  * @param   GCPhysOld       Old handler range address.
  * @param   GCPhysNew       New handler range address.
  * @param   cb              Size of the handler range.
  * @param   fHasHCHandler   Set if the handler has a HC callback function.
  * @param   fRestoreAsRAM   Whether the to restore it as normal RAM or as unassigned memory.
  */
-REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
+REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM)
 {
     REMR3ReplayHandlerNotifications(pVM);
 
-    remR3NotifyHandlerPhysicalModify(pVM, enmType, GCPhysOld, GCPhysNew, cb, fHasHCHandler, fRestoreAsRAM);
+    remR3NotifyHandlerPhysicalModify(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fHasHCHandler, fRestoreAsRAM);
 }
 
 /**
@@ -3536,7 +3564,7 @@ void remR3PhysRead(RTGCPHYS SrcGCPhys, void *pvDst, unsigned cb)
 {
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    PGMPhysRead(cpu_single_env->pVM, SrcGCPhys, pvDst, cb);
+    PGMPhysRead(cpu_single_env->pVM, SrcGCPhys, pvDst, cb, PGMACCESSORIGIN_REM);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("read(%d): %08x\n", cb, (uint32_t)SrcGCPhys));
 #endif
@@ -3554,7 +3582,7 @@ RTCCUINTREG remR3PhysReadU8(RTGCPHYS SrcGCPhys)
     uint8_t val;
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    val = PGMR3PhysReadU8(cpu_single_env->pVM, SrcGCPhys);
+    val = PGMR3PhysReadU8(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("readu8: %x <- %08x\n", val, (uint32_t)SrcGCPhys));
@@ -3573,7 +3601,7 @@ RTCCINTREG remR3PhysReadS8(RTGCPHYS SrcGCPhys)
     int8_t val;
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    val = PGMR3PhysReadU8(cpu_single_env->pVM, SrcGCPhys);
+    val = PGMR3PhysReadU8(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("reads8: %x <- %08x\n", val, (uint32_t)SrcGCPhys));
@@ -3592,7 +3620,7 @@ RTCCUINTREG remR3PhysReadU16(RTGCPHYS SrcGCPhys)
     uint16_t val;
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    val = PGMR3PhysReadU16(cpu_single_env->pVM, SrcGCPhys);
+    val = PGMR3PhysReadU16(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("readu16: %x <- %08x\n", val, (uint32_t)SrcGCPhys));
@@ -3611,7 +3639,7 @@ RTCCINTREG remR3PhysReadS16(RTGCPHYS SrcGCPhys)
     int16_t val;
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    val = PGMR3PhysReadU16(cpu_single_env->pVM, SrcGCPhys);
+    val = PGMR3PhysReadU16(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("reads16: %x <- %08x\n", (uint16_t)val, (uint32_t)SrcGCPhys));
@@ -3630,7 +3658,7 @@ RTCCUINTREG remR3PhysReadU32(RTGCPHYS SrcGCPhys)
     uint32_t val;
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    val = PGMR3PhysReadU32(cpu_single_env->pVM, SrcGCPhys);
+    val = PGMR3PhysReadU32(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("readu32: %x <- %08x\n", val, (uint32_t)SrcGCPhys));
@@ -3649,7 +3677,7 @@ RTCCINTREG remR3PhysReadS32(RTGCPHYS SrcGCPhys)
     int32_t val;
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    val = PGMR3PhysReadU32(cpu_single_env->pVM, SrcGCPhys);
+    val = PGMR3PhysReadU32(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("reads32: %x <- %08x\n", val, (uint32_t)SrcGCPhys));
@@ -3668,7 +3696,7 @@ uint64_t remR3PhysReadU64(RTGCPHYS SrcGCPhys)
     uint64_t val;
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    val = PGMR3PhysReadU64(cpu_single_env->pVM, SrcGCPhys);
+    val = PGMR3PhysReadU64(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("readu64: %llx <- %08x\n", val, (uint32_t)SrcGCPhys));
@@ -3687,7 +3715,7 @@ int64_t remR3PhysReadS64(RTGCPHYS SrcGCPhys)
     int64_t val;
     STAM_PROFILE_ADV_START(&gStatMemRead, a);
     VBOX_CHECK_ADDR(SrcGCPhys);
-    val = PGMR3PhysReadU64(cpu_single_env->pVM, SrcGCPhys);
+    val = PGMR3PhysReadU64(cpu_single_env->pVM, SrcGCPhys, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemRead, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("reads64: %llx <- %08x\n", val, (uint32_t)SrcGCPhys));
@@ -3707,7 +3735,7 @@ void remR3PhysWrite(RTGCPHYS DstGCPhys, const void *pvSrc, unsigned cb)
 {
     STAM_PROFILE_ADV_START(&gStatMemWrite, a);
     VBOX_CHECK_ADDR(DstGCPhys);
-    PGMPhysWrite(cpu_single_env->pVM, DstGCPhys, pvSrc, cb);
+    PGMPhysWrite(cpu_single_env->pVM, DstGCPhys, pvSrc, cb, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("write(%d): %08x\n", cb, (uint32_t)DstGCPhys));
@@ -3725,7 +3753,7 @@ void remR3PhysWriteU8(RTGCPHYS DstGCPhys, uint8_t val)
 {
     STAM_PROFILE_ADV_START(&gStatMemWrite, a);
     VBOX_CHECK_ADDR(DstGCPhys);
-    PGMR3PhysWriteU8(cpu_single_env->pVM, DstGCPhys, val);
+    PGMR3PhysWriteU8(cpu_single_env->pVM, DstGCPhys, val, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("writeu8: %x -> %08x\n", val, (uint32_t)DstGCPhys));
@@ -3743,7 +3771,7 @@ void remR3PhysWriteU16(RTGCPHYS DstGCPhys, uint16_t val)
 {
     STAM_PROFILE_ADV_START(&gStatMemWrite, a);
     VBOX_CHECK_ADDR(DstGCPhys);
-    PGMR3PhysWriteU16(cpu_single_env->pVM, DstGCPhys, val);
+    PGMR3PhysWriteU16(cpu_single_env->pVM, DstGCPhys, val, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("writeu16: %x -> %08x\n", val, (uint32_t)DstGCPhys));
@@ -3761,7 +3789,7 @@ void remR3PhysWriteU32(RTGCPHYS DstGCPhys, uint32_t val)
 {
     STAM_PROFILE_ADV_START(&gStatMemWrite, a);
     VBOX_CHECK_ADDR(DstGCPhys);
-    PGMR3PhysWriteU32(cpu_single_env->pVM, DstGCPhys, val);
+    PGMR3PhysWriteU32(cpu_single_env->pVM, DstGCPhys, val, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("writeu32: %x -> %08x\n", val, (uint32_t)DstGCPhys));
@@ -3779,7 +3807,7 @@ void remR3PhysWriteU64(RTGCPHYS DstGCPhys, uint64_t val)
 {
     STAM_PROFILE_ADV_START(&gStatMemWrite, a);
     VBOX_CHECK_ADDR(DstGCPhys);
-    PGMR3PhysWriteU64(cpu_single_env->pVM, DstGCPhys, val);
+    PGMR3PhysWriteU64(cpu_single_env->pVM, DstGCPhys, val, PGMACCESSORIGIN_REM);
     STAM_PROFILE_ADV_STOP(&gStatMemWrite, a);
 #ifdef VBOX_DEBUG_PHYS
     LogRel(("writeu64: %llx -> %08x\n", val, (uint32_t)DstGCPhys));
@@ -3862,7 +3890,7 @@ static uint32_t remR3HandlerReadU8(void *pvVM, target_phys_addr_t GCPhys)
 {
     uint8_t u8;
     Log2(("remR3HandlerReadU8: GCPhys=%RGp\n", (RTGCPHYS)GCPhys));
-    PGMPhysRead((PVM)pvVM, GCPhys, &u8, sizeof(u8));
+    PGMPhysRead((PVM)pvVM, GCPhys, &u8, sizeof(u8), PGMACCESSORIGIN_REM);
     return u8;
 }
 
@@ -3870,7 +3898,7 @@ static uint32_t remR3HandlerReadU16(void *pvVM, target_phys_addr_t GCPhys)
 {
     uint16_t u16;
     Log2(("remR3HandlerReadU16: GCPhys=%RGp\n", (RTGCPHYS)GCPhys));
-    PGMPhysRead((PVM)pvVM, GCPhys, &u16, sizeof(u16));
+    PGMPhysRead((PVM)pvVM, GCPhys, &u16, sizeof(u16), PGMACCESSORIGIN_REM);
     return u16;
 }
 
@@ -3878,26 +3906,26 @@ static uint32_t remR3HandlerReadU32(void *pvVM, target_phys_addr_t GCPhys)
 {
     uint32_t u32;
     Log2(("remR3HandlerReadU32: GCPhys=%RGp\n", (RTGCPHYS)GCPhys));
-    PGMPhysRead((PVM)pvVM, GCPhys, &u32, sizeof(u32));
+    PGMPhysRead((PVM)pvVM, GCPhys, &u32, sizeof(u32), PGMACCESSORIGIN_REM);
     return u32;
 }
 
 static void     remR3HandlerWriteU8(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32)
 {
     Log2(("remR3HandlerWriteU8: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
-    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint8_t));
+    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint8_t), PGMACCESSORIGIN_REM);
 }
 
 static void     remR3HandlerWriteU16(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32)
 {
     Log2(("remR3HandlerWriteU16: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
-    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint16_t));
+    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint16_t), PGMACCESSORIGIN_REM);
 }
 
 static void     remR3HandlerWriteU32(void *pvVM, target_phys_addr_t GCPhys, uint32_t u32)
 {
     Log2(("remR3HandlerWriteU32: GCPhys=%RGp u32=%#x\n", (RTGCPHYS)GCPhys, u32));
-    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint32_t));
+    PGMPhysWrite((PVM)pvVM, GCPhys, &u32, sizeof(uint32_t), PGMACCESSORIGIN_REM);
 }
 
 /* -+- disassembly -+- */
@@ -3950,11 +3978,12 @@ REMR3DECL(int) REMR3DisasEnableStepping(PVM pVM, bool fEnable)
 }
 
 
-#if defined(VBOX_WITH_DEBUGGER) && !(defined(RT_OS_WINDOWS) && defined(RT_ARCH_AMD64))
+#ifdef VBOX_WITH_DEBUGGER
 /**
  * External Debugger Command: .remstep [on|off|1|0]
  */
-static DECLCALLBACK(int) remR3CmdDisasEnableStepping(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) remR3CmdDisasEnableStepping(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM,
+                                                     PCDBGCVAR paArgs, unsigned cArgs)
 {
     int rc;
     PVM pVM = pUVM->pVM;
@@ -3985,7 +4014,7 @@ static DECLCALLBACK(int) remR3CmdDisasEnableStepping(PCDBGCCMD pCmd, PDBGCCMDHLP
     }
     return rc;
 }
-#endif /* VBOX_WITH_DEBUGGER && !win.amd64 */
+#endif /* VBOX_WITH_DEBUGGER */
 
 
 /**
@@ -4495,13 +4524,13 @@ void cpu_set_apic_base(CPUX86State *env, uint64_t val)
 uint64_t cpu_get_apic_base(CPUX86State *env)
 {
     uint64_t u64;
-    int rc = CPUMQueryGuestMsr(env->pVCpu, MSR_IA32_APICBASE, &u64);
-    if (RT_SUCCESS(rc))
+    VBOXSTRICTRC rcStrict = CPUMQueryGuestMsr(env->pVCpu, MSR_IA32_APICBASE, &u64);
+    if (RT_SUCCESS(rcStrict))
     {
         LogFlow(("cpu_get_apic_base: returns %#llx \n", u64));
         return u64;
     }
-    LogFlow(("cpu_get_apic_base: returns 0 (rc=%Rrc)\n", rc));
+    LogFlow(("cpu_get_apic_base: returns 0 (rc=%Rrc)\n", VBOXSTRICTRC_VAL(rcStrict)));
     return 0;
 }
 
@@ -4688,7 +4717,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t idx, uint32_t idxSub,
                    uint32_t *pEAX, uint32_t *pEBX, uint32_t *pECX, uint32_t *pEDX)
 {
     NOREF(idxSub);
-    CPUMGetGuestCpuId(env->pVCpu, idx, pEAX, pEBX, pECX, pEDX);
+    CPUMGetGuestCpuId(env->pVCpu, idx, idxSub, pEAX, pEBX, pECX, pEDX);
 }
 
 
diff --git a/src/recompiler/target-i386/cpu.h b/src/recompiler/target-i386/cpu.h
index 2adbd86..39b1d48 100644
--- a/src/recompiler/target-i386/cpu.h
+++ b/src/recompiler/target-i386/cpu.h
@@ -1195,7 +1195,10 @@ static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc,
                                         target_ulong *cs_base, int *flags)
 {
     *cs_base = env->segs[R_CS].base;
-    *pc = *cs_base + env->eip;
+    if (env->hflags & HF_CS64_MASK)
+        *pc = *cs_base + env->eip;
+    else
+        *pc = (uint32_t)(*cs_base + env->eip);
     *flags = env->hflags |
         (env->eflags & (IOPL_MASK | TF_MASK | RF_MASK | VM_MASK));
 }
diff --git a/src/recompiler/target-i386/exec.h b/src/recompiler/target-i386/exec.h
index 5671528..355599f 100644
--- a/src/recompiler/target-i386/exec.h
+++ b/src/recompiler/target-i386/exec.h
@@ -145,25 +145,25 @@ static inline void svm_check_intercept(uint32_t type)
 
 #ifdef VBOX
 # ifdef IPRT_NO_CRT
-#  undef  sin  
-#  undef  cos  
-#  undef  sqrt 
-#  undef  pow  
-#  undef  log  
-#  undef  tan  
+#  undef  sin
+#  undef  cos
+#  undef  sqrt
+#  undef  pow
+#  undef  log
+#  undef  tan
 #  undef  atan2
 #  undef  floor
-#  undef  ceil 
+#  undef  ceil
 #  undef  ldexp
-#  define sin   sinl  
-#  define cos   cosl  
-#  define sqrt  sqrtl 
-#  define pow   powl  
-#  define log   logl  
-#  define tan   tanl  
+#  define sin   sinl
+#  define cos   cosl
+#  define sqrt  sqrtl
+#  define pow   powl
+#  define log   logl
+#  define tan   tanl
 #  define atan2 atan2l
 #  define floor floorl
-#  define ceil  ceill 
+#  define ceil  ceill
 #  define ldexp ldexpl
 # endif
 #endif
diff --git a/src/recompiler/target-i386/op_helper.c b/src/recompiler/target-i386/op_helper.c
index 20d671c..64a6252 100644
--- a/src/recompiler/target-i386/op_helper.c
+++ b/src/recompiler/target-i386/op_helper.c
@@ -3239,7 +3239,7 @@ static inline void helper_ret_protected(int shift, int is_iret, int addend)
                 Log(("RPL 1 -> new_cs %04X -> %04X\n", new_cs, new_cs & 0xfffc));
                 new_cs = new_cs & 0xfffc;
             }
-            else 
+            else
             {
                 /* Ugly assumption: assume a genuine switch to ring-1. */
                 Log(("Genuine switch to ring-1 (iret)\n"));
diff --git a/src/recompiler/tcg/tcg.c b/src/recompiler/tcg/tcg.c
index 79cb48e..4e63609 100644
--- a/src/recompiler/tcg/tcg.c
+++ b/src/recompiler/tcg/tcg.c
@@ -1052,7 +1052,7 @@ void tcg_add_target_add_op_defs(const TCGTargetOpDef *tdefs)
         if (tdefs->op == (TCGOpcode)-1)
             break;
         op = tdefs->op;
-        assert(op >= 0 && op < NB_OPS);
+        assert((unsigned)op < (unsigned)NB_OPS);
         def = &tcg_op_defs[op];
 #if defined(CONFIG_DEBUG_TCG)
         /* Duplicate entry in op definitions? */

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-virtualbox/virtualbox.git



More information about the Pkg-virtualbox-commits mailing list